From 9997785812755b38ec7adb23be9a4fabc98a9bb8 Mon Sep 17 00:00:00 2001 From: Piroro-hs Date: Fri, 26 Feb 2021 16:06:15 +0900 Subject: [PATCH] Change line endings to LF --- AUTHORS.TXT | 280 +- LICENSE | 484 +- README.md | 546 +- developer_tools/stbchecker/Program.cs | 2 +- developer_tools/stbchecker/Stb.cs | 2 +- developer_tools/stbchecker/Str.cs | 2 +- developer_tools/stbchecker/Util.cs | 2 +- developer_tools/stbchecker/stbchecker.sln | 2 +- .../vpnserver-jsonrpc-clients/README.html | 2 +- .../vpnserver-jsonrpc-clients/README.md | 2 +- .../rpc-stubs/JsonRpc.cs | 2 +- .../rpc-stubs/VPNServerRpc.cs | 2 +- .../rpc-stubs/VPNServerRpcTypes.cs | 2 +- .../sample/Main.cs | 2 +- .../sample/VpnServerRpcTest.cs | 2 +- .../vpnserver-jsonrpc-client-csharp.csproj | 2 +- .../vpnserver-jsonrpc-client-csharp.sln | 2 +- .../src/sample.ts | 2 +- .../src/vpnrpc.ts | 2 +- .../sample.ts | 2 +- .../vpnrpc.ts | 2 +- .../CodeGen/CodeGen.cs | 2 +- .../vpnserver-jsonrpc-codegen/Program.cs | 2 +- .../Templates/cs_main.txt | 2 +- .../Templates/cs_proj.txt | 2 +- .../Templates/doc.txt | 2 +- .../Templates/md_html.html | 2 +- .../Templates/ts_rpc.txt | 2 +- .../Templates/ts_test.txt | 2 +- .../VpnServerRpc/JsonRpc.cs | 2 +- .../VpnServerRpc/VPNServerRpc.cs | 2 +- .../VpnServerRpc/VPNServerRpcTypes.cs | 2 +- .../VpnServerRpcTest/VpnServerRpcTest.cs | 2 +- .../vpnserver-jsonrpc-codegen.csproj | 2 +- .../vpnserver-jsonrpc-codegen.sln | 2 +- src/BUILD_UNIX.md | 472 +- src/BuildFiles/Manifests/x64_admin.manifest | 58 +- src/BuildFiles/Manifests/x64_user.manifest | 58 +- src/BuildFiles/Manifests/x86_admin.manifest | 58 +- src/BuildFiles/Manifests/x86_user.manifest | 58 +- src/BuildFiles/OcxCabInf/vpnweb.inf | 36 +- src/BuildFiles/Utility/cabarc_redist.txt | 146 +- src/BuildFiles/VerScript/ver.rc | 60 +- src/BuildFiles/VerScript/ver_vg.rc | 60 +- src/Cedar/Account.c | 2714 +- src/Cedar/Account.h | 422 +- src/Cedar/Admin.c | 31010 +++++----- src/Cedar/Admin.h | 2984 +- src/Cedar/AzureClient.c | 1134 +- src/Cedar/AzureClient.h | 136 +- src/Cedar/AzureServer.c | 20 +- src/Cedar/AzureServer.h | 28 +- src/Cedar/Bridge.c | 932 +- src/Cedar/Bridge.h | 152 +- src/Cedar/BridgeUnix.h | 266 +- src/Cedar/BridgeWin32.c | 4278 +- src/Cedar/BridgeWin32.h | 324 +- src/Cedar/CM.c | 25440 ++++---- src/Cedar/CM.h | 104 +- src/Cedar/CMInner.h | 1090 +- src/Cedar/Cedar.c | 3236 +- src/Cedar/Cedar.h | 2372 +- src/Cedar/CedarPch.c | 18 +- src/Cedar/CedarPch.h | 40 +- src/Cedar/CedarType.h | 1342 +- src/Cedar/Client.c | 21644 +++---- src/Cedar/Client.h | 1520 +- src/Cedar/Command.c | 49140 ++++++++-------- src/Cedar/Command.h | 1198 +- src/Cedar/Connection.c | 6966 +-- src/Cedar/Connection.h | 546 +- src/Cedar/Console.c | 4922 +- src/Cedar/Console.h | 288 +- src/Cedar/DDNS.c | 1822 +- src/Cedar/DDNS.h | 290 +- src/Cedar/Database.c | 318 +- src/Cedar/Database.h | 36 +- src/Cedar/EM.c | 2792 +- src/Cedar/EM.h | 32 +- src/Cedar/EMInner.h | 86 +- src/Cedar/EtherLog.c | 2516 +- src/Cedar/EtherLog.h | 342 +- src/Cedar/Hub.c | 14428 ++--- src/Cedar/Hub.h | 1078 +- src/Cedar/IPC.c | 5226 +- src/Cedar/IPC.h | 482 +- src/Cedar/Layer3.c | 4198 +- src/Cedar/Layer3.h | 298 +- src/Cedar/Link.c | 1356 +- src/Cedar/Link.h | 130 +- src/Cedar/Listener.c | 2022 +- src/Cedar/Listener.h | 216 +- src/Cedar/Logging.c | 5656 +- src/Cedar/Logging.h | 330 +- src/Cedar/NM.c | 3074 +- src/Cedar/NM.h | 32 +- src/Cedar/NMInner.h | 144 +- src/Cedar/Nat.c | 3636 +- src/Cedar/Nat.h | 424 +- src/Cedar/NativeStack.c | 1790 +- src/Cedar/NativeStack.h | 178 +- src/Cedar/NullLan.c | 454 +- src/Cedar/NullLan.h | 78 +- src/Cedar/Proto_EtherIP.c | 902 +- src/Cedar/Proto_EtherIP.h | 136 +- src/Cedar/Proto_IKE.c | 11778 ++-- src/Cedar/Proto_IKE.h | 740 +- src/Cedar/Proto_IPsec.c | 1368 +- src/Cedar/Proto_IPsec.h | 196 +- src/Cedar/Proto_IkePacket.c | 5796 +- src/Cedar/Proto_IkePacket.h | 1308 +- src/Cedar/Proto_L2TP.c | 5254 +- src/Cedar/Proto_L2TP.h | 552 +- src/Cedar/Proto_OpenVPN.c | 6060 +- src/Cedar/Proto_OpenVPN.h | 542 +- src/Cedar/Proto_PPP.c | 8100 ++- src/Cedar/Proto_PPP.h | 828 +- src/Cedar/Proto_SSTP.c | 2140 +- src/Cedar/Proto_SSTP.h | 316 +- src/Cedar/Proto_Win7.c | 938 +- src/Cedar/Proto_Win7.h | 78 +- src/Cedar/Proto_Win7Inner.h | 154 +- src/Cedar/Protocol.c | 13378 ++--- src/Cedar/Protocol.h | 360 +- src/Cedar/Radius.c | 4720 +- src/Cedar/Radius.h | 584 +- src/Cedar/Remote.c | 752 +- src/Cedar/Remote.h | 96 +- src/Cedar/SM.c | 41300 ++++++------- src/Cedar/SM.h | 30 +- src/Cedar/SMInner.h | 1446 +- src/Cedar/SW.c | 12980 ++-- src/Cedar/SW.h | 50 +- src/Cedar/SWInner.h | 692 +- src/Cedar/Sam.c | 2008 +- src/Cedar/Sam.h | 52 +- src/Cedar/SeLowUser.c | 1958 +- src/Cedar/SeLowUser.h | 160 +- src/Cedar/SecureInfo.c | 20 +- src/Cedar/SecureInfo.h | 28 +- src/Cedar/SecureNAT.c | 296 +- src/Cedar/SecureNAT.h | 56 +- src/Cedar/Server.c | 21666 +++---- src/Cedar/Server.h | 1274 +- src/Cedar/Session.c | 4930 +- src/Cedar/Session.h | 696 +- src/Cedar/UT.c | 618 +- src/Cedar/UT.h | 62 +- src/Cedar/UdpAccel.c | 2282 +- src/Cedar/UdpAccel.h | 254 +- src/Cedar/VG.c | 50 +- src/Cedar/VG.h | 42 +- src/Cedar/VLan.c | 56 +- src/Cedar/VLan.h | 64 +- src/Cedar/VLanUnix.c | 1642 +- src/Cedar/VLanUnix.h | 132 +- src/Cedar/VLanWin32.c | 3028 +- src/Cedar/VLanWin32.h | 188 +- src/Cedar/Virtual.c | 20740 +++---- src/Cedar/Virtual.h | 1184 +- src/Cedar/WaterMark.c | 8612 +-- src/Cedar/WaterMark.h | 60 +- src/Cedar/WebUI.c | 3766 +- src/Cedar/WebUI.h | 78 +- src/Cedar/Win32Com.cpp | 2054 +- src/Cedar/Win32Com.h | 644 +- src/Cedar/WinJumpList.cpp | 1358 +- src/Cedar/WinUi.c | 20490 +++---- src/Cedar/WinUi.h | 1558 +- src/Cedar/Wpc.c | 2646 +- src/Cedar/Wpc.h | 270 +- src/Cedar/netcfgn.h | 2670 +- src/Cedar/netcfgx.h | 3882 +- src/Cedar/winpcap/Devioctl.h | 180 +- src/Cedar/winpcap/Gnuc.h | 92 +- src/Cedar/winpcap/Ntddndis.h | 2800 +- src/Cedar/winpcap/Ntddpack.h | 52 +- src/Cedar/winpcap/Packet32.h | 846 +- src/Cedar/winpcap/Win32-Extensions.h | 172 +- src/Cedar/winpcap/bittypes.h | 270 +- src/Cedar/winpcap/bucket_lookup.h | 108 +- src/Cedar/winpcap/count_packets.h | 124 +- src/Cedar/winpcap/ip6_misc.h | 326 +- src/Cedar/winpcap/memory_t.h | 264 +- src/Cedar/winpcap/normal_lookup.h | 112 +- src/Cedar/winpcap/pcap-bpf.h | 1370 +- src/Cedar/winpcap/pcap-int.h | 736 +- src/Cedar/winpcap/pcap-stdinc.h | 130 +- src/Cedar/winpcap/pcap.h | 674 +- src/Cedar/winpcap/pthread.h | 2600 +- src/Cedar/winpcap/remote-ext.h | 840 +- src/Cedar/winpcap/sched.h | 348 +- src/Cedar/winpcap/semaphore.h | 326 +- src/Cedar/winpcap/tcp_session.h | 192 +- src/Cedar/winpcap/time_calls.h | 876 +- src/Cedar/winpcap/tme.h | 348 +- src/GlobalConst.h | 140 +- src/Mayaqua/Cfg.c | 4500 +- src/Mayaqua/Cfg.h | 330 +- src/Mayaqua/Encrypt.c | 9212 +-- src/Mayaqua/Encrypt.h | 916 +- src/Mayaqua/FileIO.c | 5206 +- src/Mayaqua/FileIO.h | 536 +- src/Mayaqua/Internat.c | 6020 +- src/Mayaqua/Internat.h | 254 +- src/Mayaqua/Kernel.c | 4250 +- src/Mayaqua/Kernel.h | 336 +- src/Mayaqua/MayaType.h | 996 +- src/Mayaqua/Mayaqua.c | 2168 +- src/Mayaqua/Mayaqua.h | 1030 +- src/Mayaqua/Memory.c | 8120 +-- src/Mayaqua/Memory.h | 734 +- src/Mayaqua/Microsoft.c | 25194 ++++---- src/Mayaqua/Microsoft.h | 1960 +- src/Mayaqua/Network.c | 41774 ++++++------- src/Mayaqua/Network.h | 2972 +- src/Mayaqua/OS.c | 818 +- src/Mayaqua/OS.h | 262 +- src/Mayaqua/Object.c | 990 +- src/Mayaqua/Object.h | 218 +- src/Mayaqua/Pack.c | 4988 +- src/Mayaqua/Pack.h | 400 +- src/Mayaqua/Secure.c | 4300 +- src/Mayaqua/Secure.h | 440 +- src/Mayaqua/Str.c | 10180 ++-- src/Mayaqua/Str.h | 776 +- src/Mayaqua/Table.c | 2784 +- src/Mayaqua/Table.h | 216 +- src/Mayaqua/TcpIp.c | 8614 +-- src/Mayaqua/TcpIp.h | 1694 +- src/Mayaqua/Tick64.c | 594 +- src/Mayaqua/Tick64.h | 108 +- src/Mayaqua/Tracking.c | 1742 +- src/Mayaqua/Tracking.h | 174 +- src/Mayaqua/TunTap.h | 402 +- src/Mayaqua/Unix.c | 5484 +- src/Mayaqua/Unix.h | 318 +- src/Mayaqua/Win32.c | 6872 +-- src/Mayaqua/Win32.h | 252 +- src/Mayaqua/cryptoki.h | 132 +- src/Mayaqua/pkcs11.h | 598 +- src/Mayaqua/pkcs11f.h | 1824 +- src/Mayaqua/pkcs11t.h | 2880 +- src/Neo/NDIS5.c | 3266 +- src/Neo/NDIS5.h | 378 +- src/Neo/Neo.c | 724 +- src/Neo/Neo.h | 464 +- src/Neo/Neo.rc | 126 +- src/Neo/Neo.vcproj | 560 +- src/Neo/resource.h | 30 +- src/Neo6/NDIS6.c | 3720 +- src/Neo6/NDIS6.h | 322 +- src/Neo6/Neo6.c | 864 +- src/Neo6/Neo6.h | 482 +- src/Neo6/Neo6.rc | 126 +- src/Neo6/Neo6.vcproj | 564 +- src/Neo6/resource.h | 32 +- src/PenCore/Dummy.bin | 2 +- src/PenCore/PenCore.c | 16 +- src/PenCore/PenCore.def | 2 +- src/PenCore/PenCore.rc | 9936 ++-- src/PenCore/resource.h | 2436 +- src/SeLow/SeLow.c | 4222 +- src/SeLow/SeLow.h | 560 +- src/SeLow/SeLow.rc | 126 +- src/SeLow/SeLow.vcproj | 556 +- src/SeLow/SeLowCommon.h | 194 +- src/SeLow/resource.h | 30 +- src/See/DEBUG.H | 126 +- src/See/Devioctl.h | 180 +- src/See/Ntddndis.h | 2800 +- src/See/Ntddpack.h | 52 +- src/See/Openclos.c | 1414 +- src/See/Packet.c | 3286 +- src/See/Packet.h | 1908 +- src/See/Packet32.h | 846 +- src/See/Read.c | 1876 +- src/See/See.rc | 126 +- src/See/See.vcproj | 924 +- src/See/Write.c | 852 +- src/See/bucket_lookup.c | 528 +- src/See/bucket_lookup.h | 108 +- src/See/count_packets.c | 128 +- src/See/count_packets.h | 124 +- src/See/dagc.h | 450 +- src/See/dump.c | 1140 +- src/See/functions.c | 190 +- src/See/functions.h | 156 +- src/See/jitter.c | 1374 +- src/See/jitter.h | 808 +- src/See/memory_t.h | 264 +- src/See/normal_lookup.c | 408 +- src/See/normal_lookup.h | 112 +- src/See/resource.h | 32 +- src/See/resource1.h | 30 +- src/See/tcp_session.c | 592 +- src/See/tcp_session.h | 192 +- src/See/time_calls.h | 972 +- src/See/tme.c | 770 +- src/See/tme.h | 348 +- src/See/valid_insns.h | 234 +- src/See/win_bpf.h | 834 +- src/See/win_bpf_filter.c | 2172 +- src/See/win_bpf_filter_init.c | 1018 +- src/See/win_bpf_filter_init.h | 100 +- src/SeeDll/AdInfo.c | 2820 +- src/SeeDll/Devioctl.h | 180 +- src/SeeDll/Ntddndis.h | 2800 +- src/SeeDll/Ntddpack.h | 52 +- src/SeeDll/Packet32.c | 4604 +- src/SeeDll/Packet32.h | 848 +- src/SeeDll/SeeDll.rc | 126 +- src/SeeDll/SeeDll.vcproj | 580 +- src/SeeDll/See_Win32.def | 68 +- src/SeeDll/See_x64.def | 68 +- src/SeeDll/dagc.h | 450 +- src/SeeDll/resource.h | 30 +- src/THIRD_PARTY.TXT | 1382 +- src/WARNING.TXT | 1130 +- src/Wfp/Wfp.c | 2486 +- src/Wfp/Wfp.h | 92 +- src/Wfp/Wfp.rc | 126 +- src/Wfp/Wfp.vcproj | 552 +- src/Wfp/WfpInner.h | 470 +- src/Wfp/resource1.h | 30 +- .../DriverPackages/Neo/x64/Neo_x64.inf | 228 +- .../DriverPackages/Neo/x86/Neo_x86.inf | 228 +- .../DriverPackages/Neo6/x64/Neo6_x64.inf | 228 +- .../DriverPackages/Neo6/x86/Neo6_x86.inf | 228 +- .../Neo6_Win10/x64/Neo6_x64_VPN.inf | 228 +- .../Neo6_Win10/x64/Neo6_x64_VPN10.inf | 228 +- .../Neo6_Win10/x64/Neo6_x64_VPN100.inf | 228 +- .../Neo6_Win10/x64/Neo6_x64_VPN101.inf | 228 +- .../Neo6_Win10/x64/Neo6_x64_VPN102.inf | 228 +- .../Neo6_Win10/x64/Neo6_x64_VPN103.inf | 228 +- .../Neo6_Win10/x64/Neo6_x64_VPN104.inf | 228 +- .../Neo6_Win10/x64/Neo6_x64_VPN105.inf | 228 +- .../Neo6_Win10/x64/Neo6_x64_VPN106.inf | 228 +- .../Neo6_Win10/x64/Neo6_x64_VPN107.inf | 228 +- .../Neo6_Win10/x64/Neo6_x64_VPN108.inf | 228 +- .../Neo6_Win10/x64/Neo6_x64_VPN109.inf | 228 +- .../Neo6_Win10/x64/Neo6_x64_VPN11.inf | 228 +- .../Neo6_Win10/x64/Neo6_x64_VPN110.inf | 228 +- .../Neo6_Win10/x64/Neo6_x64_VPN111.inf | 228 +- .../Neo6_Win10/x64/Neo6_x64_VPN112.inf | 228 +- .../Neo6_Win10/x64/Neo6_x64_VPN113.inf | 228 +- .../Neo6_Win10/x64/Neo6_x64_VPN114.inf | 228 +- .../Neo6_Win10/x64/Neo6_x64_VPN115.inf | 228 +- .../Neo6_Win10/x64/Neo6_x64_VPN116.inf | 228 +- .../Neo6_Win10/x64/Neo6_x64_VPN117.inf | 228 +- .../Neo6_Win10/x64/Neo6_x64_VPN118.inf | 228 +- .../Neo6_Win10/x64/Neo6_x64_VPN119.inf | 228 +- .../Neo6_Win10/x64/Neo6_x64_VPN12.inf | 228 +- .../Neo6_Win10/x64/Neo6_x64_VPN120.inf | 228 +- .../Neo6_Win10/x64/Neo6_x64_VPN121.inf | 228 +- .../Neo6_Win10/x64/Neo6_x64_VPN122.inf | 228 +- .../Neo6_Win10/x64/Neo6_x64_VPN123.inf | 228 +- .../Neo6_Win10/x64/Neo6_x64_VPN124.inf | 228 +- .../Neo6_Win10/x64/Neo6_x64_VPN125.inf | 228 +- .../Neo6_Win10/x64/Neo6_x64_VPN126.inf | 228 +- .../Neo6_Win10/x64/Neo6_x64_VPN127.inf | 228 +- .../Neo6_Win10/x64/Neo6_x64_VPN13.inf | 228 +- .../Neo6_Win10/x64/Neo6_x64_VPN14.inf | 228 +- .../Neo6_Win10/x64/Neo6_x64_VPN15.inf | 228 +- .../Neo6_Win10/x64/Neo6_x64_VPN16.inf | 228 +- .../Neo6_Win10/x64/Neo6_x64_VPN17.inf | 228 +- .../Neo6_Win10/x64/Neo6_x64_VPN18.inf | 228 +- .../Neo6_Win10/x64/Neo6_x64_VPN19.inf | 228 +- .../Neo6_Win10/x64/Neo6_x64_VPN2.inf | 228 +- .../Neo6_Win10/x64/Neo6_x64_VPN20.inf | 228 +- .../Neo6_Win10/x64/Neo6_x64_VPN21.inf | 228 +- .../Neo6_Win10/x64/Neo6_x64_VPN22.inf | 228 +- .../Neo6_Win10/x64/Neo6_x64_VPN23.inf | 228 +- .../Neo6_Win10/x64/Neo6_x64_VPN24.inf | 228 +- .../Neo6_Win10/x64/Neo6_x64_VPN25.inf | 228 +- .../Neo6_Win10/x64/Neo6_x64_VPN26.inf | 228 +- .../Neo6_Win10/x64/Neo6_x64_VPN27.inf | 228 +- .../Neo6_Win10/x64/Neo6_x64_VPN28.inf | 228 +- .../Neo6_Win10/x64/Neo6_x64_VPN29.inf | 228 +- .../Neo6_Win10/x64/Neo6_x64_VPN3.inf | 228 +- .../Neo6_Win10/x64/Neo6_x64_VPN30.inf | 228 +- .../Neo6_Win10/x64/Neo6_x64_VPN31.inf | 228 +- .../Neo6_Win10/x64/Neo6_x64_VPN32.inf | 228 +- .../Neo6_Win10/x64/Neo6_x64_VPN33.inf | 228 +- .../Neo6_Win10/x64/Neo6_x64_VPN34.inf | 228 +- .../Neo6_Win10/x64/Neo6_x64_VPN35.inf | 228 +- .../Neo6_Win10/x64/Neo6_x64_VPN36.inf | 228 +- .../Neo6_Win10/x64/Neo6_x64_VPN37.inf | 228 +- .../Neo6_Win10/x64/Neo6_x64_VPN38.inf | 228 +- .../Neo6_Win10/x64/Neo6_x64_VPN39.inf | 228 +- .../Neo6_Win10/x64/Neo6_x64_VPN4.inf | 228 +- .../Neo6_Win10/x64/Neo6_x64_VPN40.inf | 228 +- .../Neo6_Win10/x64/Neo6_x64_VPN41.inf | 228 +- .../Neo6_Win10/x64/Neo6_x64_VPN42.inf | 228 +- .../Neo6_Win10/x64/Neo6_x64_VPN43.inf | 228 +- .../Neo6_Win10/x64/Neo6_x64_VPN44.inf | 228 +- .../Neo6_Win10/x64/Neo6_x64_VPN45.inf | 228 +- .../Neo6_Win10/x64/Neo6_x64_VPN46.inf | 228 +- .../Neo6_Win10/x64/Neo6_x64_VPN47.inf | 228 +- .../Neo6_Win10/x64/Neo6_x64_VPN48.inf | 228 +- .../Neo6_Win10/x64/Neo6_x64_VPN49.inf | 228 +- .../Neo6_Win10/x64/Neo6_x64_VPN5.inf | 228 +- .../Neo6_Win10/x64/Neo6_x64_VPN50.inf | 228 +- .../Neo6_Win10/x64/Neo6_x64_VPN51.inf | 228 +- .../Neo6_Win10/x64/Neo6_x64_VPN52.inf | 228 +- .../Neo6_Win10/x64/Neo6_x64_VPN53.inf | 228 +- .../Neo6_Win10/x64/Neo6_x64_VPN54.inf | 228 +- .../Neo6_Win10/x64/Neo6_x64_VPN55.inf | 228 +- .../Neo6_Win10/x64/Neo6_x64_VPN56.inf | 228 +- .../Neo6_Win10/x64/Neo6_x64_VPN57.inf | 228 +- .../Neo6_Win10/x64/Neo6_x64_VPN58.inf | 228 +- .../Neo6_Win10/x64/Neo6_x64_VPN59.inf | 228 +- .../Neo6_Win10/x64/Neo6_x64_VPN6.inf | 228 +- .../Neo6_Win10/x64/Neo6_x64_VPN60.inf | 228 +- .../Neo6_Win10/x64/Neo6_x64_VPN61.inf | 228 +- .../Neo6_Win10/x64/Neo6_x64_VPN62.inf | 228 +- .../Neo6_Win10/x64/Neo6_x64_VPN63.inf | 228 +- .../Neo6_Win10/x64/Neo6_x64_VPN64.inf | 228 +- .../Neo6_Win10/x64/Neo6_x64_VPN65.inf | 228 +- .../Neo6_Win10/x64/Neo6_x64_VPN66.inf | 228 +- .../Neo6_Win10/x64/Neo6_x64_VPN67.inf | 228 +- .../Neo6_Win10/x64/Neo6_x64_VPN68.inf | 228 +- .../Neo6_Win10/x64/Neo6_x64_VPN69.inf | 228 +- .../Neo6_Win10/x64/Neo6_x64_VPN7.inf | 228 +- .../Neo6_Win10/x64/Neo6_x64_VPN70.inf | 228 +- .../Neo6_Win10/x64/Neo6_x64_VPN71.inf | 228 +- .../Neo6_Win10/x64/Neo6_x64_VPN72.inf | 228 +- .../Neo6_Win10/x64/Neo6_x64_VPN73.inf | 228 +- .../Neo6_Win10/x64/Neo6_x64_VPN74.inf | 228 +- .../Neo6_Win10/x64/Neo6_x64_VPN75.inf | 228 +- .../Neo6_Win10/x64/Neo6_x64_VPN76.inf | 228 +- .../Neo6_Win10/x64/Neo6_x64_VPN77.inf | 228 +- .../Neo6_Win10/x64/Neo6_x64_VPN78.inf | 228 +- .../Neo6_Win10/x64/Neo6_x64_VPN79.inf | 228 +- .../Neo6_Win10/x64/Neo6_x64_VPN8.inf | 228 +- .../Neo6_Win10/x64/Neo6_x64_VPN80.inf | 228 +- .../Neo6_Win10/x64/Neo6_x64_VPN81.inf | 228 +- .../Neo6_Win10/x64/Neo6_x64_VPN82.inf | 228 +- .../Neo6_Win10/x64/Neo6_x64_VPN83.inf | 228 +- .../Neo6_Win10/x64/Neo6_x64_VPN84.inf | 228 +- .../Neo6_Win10/x64/Neo6_x64_VPN85.inf | 228 +- .../Neo6_Win10/x64/Neo6_x64_VPN86.inf | 228 +- .../Neo6_Win10/x64/Neo6_x64_VPN87.inf | 228 +- .../Neo6_Win10/x64/Neo6_x64_VPN88.inf | 228 +- .../Neo6_Win10/x64/Neo6_x64_VPN89.inf | 228 +- .../Neo6_Win10/x64/Neo6_x64_VPN9.inf | 228 +- .../Neo6_Win10/x64/Neo6_x64_VPN90.inf | 228 +- .../Neo6_Win10/x64/Neo6_x64_VPN91.inf | 228 +- .../Neo6_Win10/x64/Neo6_x64_VPN92.inf | 228 +- .../Neo6_Win10/x64/Neo6_x64_VPN93.inf | 228 +- .../Neo6_Win10/x64/Neo6_x64_VPN94.inf | 228 +- .../Neo6_Win10/x64/Neo6_x64_VPN95.inf | 228 +- .../Neo6_Win10/x64/Neo6_x64_VPN96.inf | 228 +- .../Neo6_Win10/x64/Neo6_x64_VPN97.inf | 228 +- .../Neo6_Win10/x64/Neo6_x64_VPN98.inf | 228 +- .../Neo6_Win10/x64/Neo6_x64_VPN99.inf | 228 +- .../Neo6_Win10/x86/Neo6_x86_VPN.inf | 228 +- .../Neo6_Win10/x86/Neo6_x86_VPN10.inf | 228 +- .../Neo6_Win10/x86/Neo6_x86_VPN100.inf | 228 +- .../Neo6_Win10/x86/Neo6_x86_VPN101.inf | 228 +- .../Neo6_Win10/x86/Neo6_x86_VPN102.inf | 228 +- .../Neo6_Win10/x86/Neo6_x86_VPN103.inf | 228 +- .../Neo6_Win10/x86/Neo6_x86_VPN104.inf | 228 +- .../Neo6_Win10/x86/Neo6_x86_VPN105.inf | 228 +- .../Neo6_Win10/x86/Neo6_x86_VPN106.inf | 228 +- .../Neo6_Win10/x86/Neo6_x86_VPN107.inf | 228 +- .../Neo6_Win10/x86/Neo6_x86_VPN108.inf | 228 +- .../Neo6_Win10/x86/Neo6_x86_VPN109.inf | 228 +- .../Neo6_Win10/x86/Neo6_x86_VPN11.inf | 228 +- .../Neo6_Win10/x86/Neo6_x86_VPN110.inf | 228 +- .../Neo6_Win10/x86/Neo6_x86_VPN111.inf | 228 +- .../Neo6_Win10/x86/Neo6_x86_VPN112.inf | 228 +- .../Neo6_Win10/x86/Neo6_x86_VPN113.inf | 228 +- .../Neo6_Win10/x86/Neo6_x86_VPN114.inf | 228 +- .../Neo6_Win10/x86/Neo6_x86_VPN115.inf | 228 +- .../Neo6_Win10/x86/Neo6_x86_VPN116.inf | 228 +- .../Neo6_Win10/x86/Neo6_x86_VPN117.inf | 228 +- .../Neo6_Win10/x86/Neo6_x86_VPN118.inf | 228 +- .../Neo6_Win10/x86/Neo6_x86_VPN119.inf | 228 +- .../Neo6_Win10/x86/Neo6_x86_VPN12.inf | 228 +- .../Neo6_Win10/x86/Neo6_x86_VPN120.inf | 228 +- .../Neo6_Win10/x86/Neo6_x86_VPN121.inf | 228 +- .../Neo6_Win10/x86/Neo6_x86_VPN122.inf | 228 +- .../Neo6_Win10/x86/Neo6_x86_VPN123.inf | 228 +- .../Neo6_Win10/x86/Neo6_x86_VPN124.inf | 228 +- .../Neo6_Win10/x86/Neo6_x86_VPN125.inf | 228 +- .../Neo6_Win10/x86/Neo6_x86_VPN126.inf | 228 +- .../Neo6_Win10/x86/Neo6_x86_VPN127.inf | 228 +- .../Neo6_Win10/x86/Neo6_x86_VPN13.inf | 228 +- .../Neo6_Win10/x86/Neo6_x86_VPN14.inf | 228 +- .../Neo6_Win10/x86/Neo6_x86_VPN15.inf | 228 +- .../Neo6_Win10/x86/Neo6_x86_VPN16.inf | 228 +- .../Neo6_Win10/x86/Neo6_x86_VPN17.inf | 228 +- .../Neo6_Win10/x86/Neo6_x86_VPN18.inf | 228 +- .../Neo6_Win10/x86/Neo6_x86_VPN19.inf | 228 +- .../Neo6_Win10/x86/Neo6_x86_VPN2.inf | 228 +- .../Neo6_Win10/x86/Neo6_x86_VPN20.inf | 228 +- .../Neo6_Win10/x86/Neo6_x86_VPN21.inf | 228 +- .../Neo6_Win10/x86/Neo6_x86_VPN22.inf | 228 +- .../Neo6_Win10/x86/Neo6_x86_VPN23.inf | 228 +- .../Neo6_Win10/x86/Neo6_x86_VPN24.inf | 228 +- .../Neo6_Win10/x86/Neo6_x86_VPN25.inf | 228 +- .../Neo6_Win10/x86/Neo6_x86_VPN26.inf | 228 +- .../Neo6_Win10/x86/Neo6_x86_VPN27.inf | 228 +- .../Neo6_Win10/x86/Neo6_x86_VPN28.inf | 228 +- .../Neo6_Win10/x86/Neo6_x86_VPN29.inf | 228 +- .../Neo6_Win10/x86/Neo6_x86_VPN3.inf | 228 +- .../Neo6_Win10/x86/Neo6_x86_VPN30.inf | 228 +- .../Neo6_Win10/x86/Neo6_x86_VPN31.inf | 228 +- .../Neo6_Win10/x86/Neo6_x86_VPN32.inf | 228 +- .../Neo6_Win10/x86/Neo6_x86_VPN33.inf | 228 +- .../Neo6_Win10/x86/Neo6_x86_VPN34.inf | 228 +- .../Neo6_Win10/x86/Neo6_x86_VPN35.inf | 228 +- .../Neo6_Win10/x86/Neo6_x86_VPN36.inf | 228 +- .../Neo6_Win10/x86/Neo6_x86_VPN37.inf | 228 +- .../Neo6_Win10/x86/Neo6_x86_VPN38.inf | 228 +- .../Neo6_Win10/x86/Neo6_x86_VPN39.inf | 228 +- .../Neo6_Win10/x86/Neo6_x86_VPN4.inf | 228 +- .../Neo6_Win10/x86/Neo6_x86_VPN40.inf | 228 +- .../Neo6_Win10/x86/Neo6_x86_VPN41.inf | 228 +- .../Neo6_Win10/x86/Neo6_x86_VPN42.inf | 228 +- .../Neo6_Win10/x86/Neo6_x86_VPN43.inf | 228 +- .../Neo6_Win10/x86/Neo6_x86_VPN44.inf | 228 +- .../Neo6_Win10/x86/Neo6_x86_VPN45.inf | 228 +- .../Neo6_Win10/x86/Neo6_x86_VPN46.inf | 228 +- .../Neo6_Win10/x86/Neo6_x86_VPN47.inf | 228 +- .../Neo6_Win10/x86/Neo6_x86_VPN48.inf | 228 +- .../Neo6_Win10/x86/Neo6_x86_VPN49.inf | 228 +- .../Neo6_Win10/x86/Neo6_x86_VPN5.inf | 228 +- .../Neo6_Win10/x86/Neo6_x86_VPN50.inf | 228 +- .../Neo6_Win10/x86/Neo6_x86_VPN51.inf | 228 +- .../Neo6_Win10/x86/Neo6_x86_VPN52.inf | 228 +- .../Neo6_Win10/x86/Neo6_x86_VPN53.inf | 228 +- .../Neo6_Win10/x86/Neo6_x86_VPN54.inf | 228 +- .../Neo6_Win10/x86/Neo6_x86_VPN55.inf | 228 +- .../Neo6_Win10/x86/Neo6_x86_VPN56.inf | 228 +- .../Neo6_Win10/x86/Neo6_x86_VPN57.inf | 228 +- .../Neo6_Win10/x86/Neo6_x86_VPN58.inf | 228 +- .../Neo6_Win10/x86/Neo6_x86_VPN59.inf | 228 +- .../Neo6_Win10/x86/Neo6_x86_VPN6.inf | 228 +- .../Neo6_Win10/x86/Neo6_x86_VPN60.inf | 228 +- .../Neo6_Win10/x86/Neo6_x86_VPN61.inf | 228 +- .../Neo6_Win10/x86/Neo6_x86_VPN62.inf | 228 +- .../Neo6_Win10/x86/Neo6_x86_VPN63.inf | 228 +- .../Neo6_Win10/x86/Neo6_x86_VPN64.inf | 228 +- .../Neo6_Win10/x86/Neo6_x86_VPN65.inf | 228 +- .../Neo6_Win10/x86/Neo6_x86_VPN66.inf | 228 +- .../Neo6_Win10/x86/Neo6_x86_VPN67.inf | 228 +- .../Neo6_Win10/x86/Neo6_x86_VPN68.inf | 228 +- .../Neo6_Win10/x86/Neo6_x86_VPN69.inf | 228 +- .../Neo6_Win10/x86/Neo6_x86_VPN7.inf | 228 +- .../Neo6_Win10/x86/Neo6_x86_VPN70.inf | 228 +- .../Neo6_Win10/x86/Neo6_x86_VPN71.inf | 228 +- .../Neo6_Win10/x86/Neo6_x86_VPN72.inf | 228 +- .../Neo6_Win10/x86/Neo6_x86_VPN73.inf | 228 +- .../Neo6_Win10/x86/Neo6_x86_VPN74.inf | 228 +- .../Neo6_Win10/x86/Neo6_x86_VPN75.inf | 228 +- .../Neo6_Win10/x86/Neo6_x86_VPN76.inf | 228 +- .../Neo6_Win10/x86/Neo6_x86_VPN77.inf | 228 +- .../Neo6_Win10/x86/Neo6_x86_VPN78.inf | 228 +- .../Neo6_Win10/x86/Neo6_x86_VPN79.inf | 228 +- .../Neo6_Win10/x86/Neo6_x86_VPN8.inf | 228 +- .../Neo6_Win10/x86/Neo6_x86_VPN80.inf | 228 +- .../Neo6_Win10/x86/Neo6_x86_VPN81.inf | 228 +- .../Neo6_Win10/x86/Neo6_x86_VPN82.inf | 228 +- .../Neo6_Win10/x86/Neo6_x86_VPN83.inf | 228 +- .../Neo6_Win10/x86/Neo6_x86_VPN84.inf | 228 +- .../Neo6_Win10/x86/Neo6_x86_VPN85.inf | 228 +- .../Neo6_Win10/x86/Neo6_x86_VPN86.inf | 228 +- .../Neo6_Win10/x86/Neo6_x86_VPN87.inf | 228 +- .../Neo6_Win10/x86/Neo6_x86_VPN88.inf | 228 +- .../Neo6_Win10/x86/Neo6_x86_VPN89.inf | 228 +- .../Neo6_Win10/x86/Neo6_x86_VPN9.inf | 228 +- .../Neo6_Win10/x86/Neo6_x86_VPN90.inf | 228 +- .../Neo6_Win10/x86/Neo6_x86_VPN91.inf | 228 +- .../Neo6_Win10/x86/Neo6_x86_VPN92.inf | 228 +- .../Neo6_Win10/x86/Neo6_x86_VPN93.inf | 228 +- .../Neo6_Win10/x86/Neo6_x86_VPN94.inf | 228 +- .../Neo6_Win10/x86/Neo6_x86_VPN95.inf | 228 +- .../Neo6_Win10/x86/Neo6_x86_VPN96.inf | 228 +- .../Neo6_Win10/x86/Neo6_x86_VPN97.inf | 228 +- .../Neo6_Win10/x86/Neo6_x86_VPN98.inf | 228 +- .../Neo6_Win10/x86/Neo6_x86_VPN99.inf | 228 +- .../Neo6_Win8/x64/Neo6_x64_VPN.inf | 228 +- .../Neo6_Win8/x64/Neo6_x64_VPN10.inf | 228 +- .../Neo6_Win8/x64/Neo6_x64_VPN100.inf | 228 +- .../Neo6_Win8/x64/Neo6_x64_VPN101.inf | 228 +- .../Neo6_Win8/x64/Neo6_x64_VPN102.inf | 228 +- .../Neo6_Win8/x64/Neo6_x64_VPN103.inf | 228 +- .../Neo6_Win8/x64/Neo6_x64_VPN104.inf | 228 +- .../Neo6_Win8/x64/Neo6_x64_VPN105.inf | 228 +- .../Neo6_Win8/x64/Neo6_x64_VPN106.inf | 228 +- .../Neo6_Win8/x64/Neo6_x64_VPN107.inf | 228 +- .../Neo6_Win8/x64/Neo6_x64_VPN108.inf | 228 +- .../Neo6_Win8/x64/Neo6_x64_VPN109.inf | 228 +- .../Neo6_Win8/x64/Neo6_x64_VPN11.inf | 228 +- .../Neo6_Win8/x64/Neo6_x64_VPN110.inf | 228 +- .../Neo6_Win8/x64/Neo6_x64_VPN111.inf | 228 +- .../Neo6_Win8/x64/Neo6_x64_VPN112.inf | 228 +- .../Neo6_Win8/x64/Neo6_x64_VPN113.inf | 228 +- .../Neo6_Win8/x64/Neo6_x64_VPN114.inf | 228 +- .../Neo6_Win8/x64/Neo6_x64_VPN115.inf | 228 +- .../Neo6_Win8/x64/Neo6_x64_VPN116.inf | 228 +- .../Neo6_Win8/x64/Neo6_x64_VPN117.inf | 228 +- .../Neo6_Win8/x64/Neo6_x64_VPN118.inf | 228 +- .../Neo6_Win8/x64/Neo6_x64_VPN119.inf | 228 +- .../Neo6_Win8/x64/Neo6_x64_VPN12.inf | 228 +- .../Neo6_Win8/x64/Neo6_x64_VPN120.inf | 228 +- .../Neo6_Win8/x64/Neo6_x64_VPN121.inf | 228 +- .../Neo6_Win8/x64/Neo6_x64_VPN122.inf | 228 +- .../Neo6_Win8/x64/Neo6_x64_VPN123.inf | 228 +- .../Neo6_Win8/x64/Neo6_x64_VPN124.inf | 228 +- .../Neo6_Win8/x64/Neo6_x64_VPN125.inf | 228 +- .../Neo6_Win8/x64/Neo6_x64_VPN126.inf | 228 +- .../Neo6_Win8/x64/Neo6_x64_VPN127.inf | 228 +- .../Neo6_Win8/x64/Neo6_x64_VPN13.inf | 228 +- .../Neo6_Win8/x64/Neo6_x64_VPN14.inf | 228 +- .../Neo6_Win8/x64/Neo6_x64_VPN15.inf | 228 +- .../Neo6_Win8/x64/Neo6_x64_VPN16.inf | 228 +- .../Neo6_Win8/x64/Neo6_x64_VPN17.inf | 228 +- .../Neo6_Win8/x64/Neo6_x64_VPN18.inf | 228 +- .../Neo6_Win8/x64/Neo6_x64_VPN19.inf | 228 +- .../Neo6_Win8/x64/Neo6_x64_VPN2.inf | 228 +- .../Neo6_Win8/x64/Neo6_x64_VPN20.inf | 228 +- .../Neo6_Win8/x64/Neo6_x64_VPN21.inf | 228 +- .../Neo6_Win8/x64/Neo6_x64_VPN22.inf | 228 +- .../Neo6_Win8/x64/Neo6_x64_VPN23.inf | 228 +- .../Neo6_Win8/x64/Neo6_x64_VPN24.inf | 228 +- .../Neo6_Win8/x64/Neo6_x64_VPN25.inf | 228 +- .../Neo6_Win8/x64/Neo6_x64_VPN26.inf | 228 +- .../Neo6_Win8/x64/Neo6_x64_VPN27.inf | 228 +- .../Neo6_Win8/x64/Neo6_x64_VPN28.inf | 228 +- .../Neo6_Win8/x64/Neo6_x64_VPN29.inf | 228 +- .../Neo6_Win8/x64/Neo6_x64_VPN3.inf | 228 +- .../Neo6_Win8/x64/Neo6_x64_VPN30.inf | 228 +- .../Neo6_Win8/x64/Neo6_x64_VPN31.inf | 228 +- .../Neo6_Win8/x64/Neo6_x64_VPN32.inf | 228 +- .../Neo6_Win8/x64/Neo6_x64_VPN33.inf | 228 +- .../Neo6_Win8/x64/Neo6_x64_VPN34.inf | 228 +- .../Neo6_Win8/x64/Neo6_x64_VPN35.inf | 228 +- .../Neo6_Win8/x64/Neo6_x64_VPN36.inf | 228 +- .../Neo6_Win8/x64/Neo6_x64_VPN37.inf | 228 +- .../Neo6_Win8/x64/Neo6_x64_VPN38.inf | 228 +- .../Neo6_Win8/x64/Neo6_x64_VPN39.inf | 228 +- .../Neo6_Win8/x64/Neo6_x64_VPN4.inf | 228 +- .../Neo6_Win8/x64/Neo6_x64_VPN40.inf | 228 +- .../Neo6_Win8/x64/Neo6_x64_VPN41.inf | 228 +- .../Neo6_Win8/x64/Neo6_x64_VPN42.inf | 228 +- .../Neo6_Win8/x64/Neo6_x64_VPN43.inf | 228 +- .../Neo6_Win8/x64/Neo6_x64_VPN44.inf | 228 +- .../Neo6_Win8/x64/Neo6_x64_VPN45.inf | 228 +- .../Neo6_Win8/x64/Neo6_x64_VPN46.inf | 228 +- .../Neo6_Win8/x64/Neo6_x64_VPN47.inf | 228 +- .../Neo6_Win8/x64/Neo6_x64_VPN48.inf | 228 +- .../Neo6_Win8/x64/Neo6_x64_VPN49.inf | 228 +- .../Neo6_Win8/x64/Neo6_x64_VPN5.inf | 228 +- .../Neo6_Win8/x64/Neo6_x64_VPN50.inf | 228 +- .../Neo6_Win8/x64/Neo6_x64_VPN51.inf | 228 +- .../Neo6_Win8/x64/Neo6_x64_VPN52.inf | 228 +- .../Neo6_Win8/x64/Neo6_x64_VPN53.inf | 228 +- .../Neo6_Win8/x64/Neo6_x64_VPN54.inf | 228 +- .../Neo6_Win8/x64/Neo6_x64_VPN55.inf | 228 +- .../Neo6_Win8/x64/Neo6_x64_VPN56.inf | 228 +- .../Neo6_Win8/x64/Neo6_x64_VPN57.inf | 228 +- .../Neo6_Win8/x64/Neo6_x64_VPN58.inf | 228 +- .../Neo6_Win8/x64/Neo6_x64_VPN59.inf | 228 +- .../Neo6_Win8/x64/Neo6_x64_VPN6.inf | 228 +- .../Neo6_Win8/x64/Neo6_x64_VPN60.inf | 228 +- .../Neo6_Win8/x64/Neo6_x64_VPN61.inf | 228 +- .../Neo6_Win8/x64/Neo6_x64_VPN62.inf | 228 +- .../Neo6_Win8/x64/Neo6_x64_VPN63.inf | 228 +- .../Neo6_Win8/x64/Neo6_x64_VPN64.inf | 228 +- .../Neo6_Win8/x64/Neo6_x64_VPN65.inf | 228 +- .../Neo6_Win8/x64/Neo6_x64_VPN66.inf | 228 +- .../Neo6_Win8/x64/Neo6_x64_VPN67.inf | 228 +- .../Neo6_Win8/x64/Neo6_x64_VPN68.inf | 228 +- .../Neo6_Win8/x64/Neo6_x64_VPN69.inf | 228 +- .../Neo6_Win8/x64/Neo6_x64_VPN7.inf | 228 +- .../Neo6_Win8/x64/Neo6_x64_VPN70.inf | 228 +- .../Neo6_Win8/x64/Neo6_x64_VPN71.inf | 228 +- .../Neo6_Win8/x64/Neo6_x64_VPN72.inf | 228 +- .../Neo6_Win8/x64/Neo6_x64_VPN73.inf | 228 +- .../Neo6_Win8/x64/Neo6_x64_VPN74.inf | 228 +- .../Neo6_Win8/x64/Neo6_x64_VPN75.inf | 228 +- .../Neo6_Win8/x64/Neo6_x64_VPN76.inf | 228 +- .../Neo6_Win8/x64/Neo6_x64_VPN77.inf | 228 +- .../Neo6_Win8/x64/Neo6_x64_VPN78.inf | 228 +- .../Neo6_Win8/x64/Neo6_x64_VPN79.inf | 228 +- .../Neo6_Win8/x64/Neo6_x64_VPN8.inf | 228 +- .../Neo6_Win8/x64/Neo6_x64_VPN80.inf | 228 +- .../Neo6_Win8/x64/Neo6_x64_VPN81.inf | 228 +- .../Neo6_Win8/x64/Neo6_x64_VPN82.inf | 228 +- .../Neo6_Win8/x64/Neo6_x64_VPN83.inf | 228 +- .../Neo6_Win8/x64/Neo6_x64_VPN84.inf | 228 +- .../Neo6_Win8/x64/Neo6_x64_VPN85.inf | 228 +- .../Neo6_Win8/x64/Neo6_x64_VPN86.inf | 228 +- .../Neo6_Win8/x64/Neo6_x64_VPN87.inf | 228 +- .../Neo6_Win8/x64/Neo6_x64_VPN88.inf | 228 +- .../Neo6_Win8/x64/Neo6_x64_VPN89.inf | 228 +- .../Neo6_Win8/x64/Neo6_x64_VPN9.inf | 228 +- .../Neo6_Win8/x64/Neo6_x64_VPN90.inf | 228 +- .../Neo6_Win8/x64/Neo6_x64_VPN91.inf | 228 +- .../Neo6_Win8/x64/Neo6_x64_VPN92.inf | 228 +- .../Neo6_Win8/x64/Neo6_x64_VPN93.inf | 228 +- .../Neo6_Win8/x64/Neo6_x64_VPN94.inf | 228 +- .../Neo6_Win8/x64/Neo6_x64_VPN95.inf | 228 +- .../Neo6_Win8/x64/Neo6_x64_VPN96.inf | 228 +- .../Neo6_Win8/x64/Neo6_x64_VPN97.inf | 228 +- .../Neo6_Win8/x64/Neo6_x64_VPN98.inf | 228 +- .../Neo6_Win8/x64/Neo6_x64_VPN99.inf | 228 +- .../Neo6_Win8/x86/Neo6_x86_VPN.inf | 228 +- .../Neo6_Win8/x86/Neo6_x86_VPN10.inf | 228 +- .../Neo6_Win8/x86/Neo6_x86_VPN100.inf | 228 +- .../Neo6_Win8/x86/Neo6_x86_VPN101.inf | 228 +- .../Neo6_Win8/x86/Neo6_x86_VPN102.inf | 228 +- .../Neo6_Win8/x86/Neo6_x86_VPN103.inf | 228 +- .../Neo6_Win8/x86/Neo6_x86_VPN104.inf | 228 +- .../Neo6_Win8/x86/Neo6_x86_VPN105.inf | 228 +- .../Neo6_Win8/x86/Neo6_x86_VPN106.inf | 228 +- .../Neo6_Win8/x86/Neo6_x86_VPN107.inf | 228 +- .../Neo6_Win8/x86/Neo6_x86_VPN108.inf | 228 +- .../Neo6_Win8/x86/Neo6_x86_VPN109.inf | 228 +- .../Neo6_Win8/x86/Neo6_x86_VPN11.inf | 228 +- .../Neo6_Win8/x86/Neo6_x86_VPN110.inf | 228 +- .../Neo6_Win8/x86/Neo6_x86_VPN111.inf | 228 +- .../Neo6_Win8/x86/Neo6_x86_VPN112.inf | 228 +- .../Neo6_Win8/x86/Neo6_x86_VPN113.inf | 228 +- .../Neo6_Win8/x86/Neo6_x86_VPN114.inf | 228 +- .../Neo6_Win8/x86/Neo6_x86_VPN115.inf | 228 +- .../Neo6_Win8/x86/Neo6_x86_VPN116.inf | 228 +- .../Neo6_Win8/x86/Neo6_x86_VPN117.inf | 228 +- .../Neo6_Win8/x86/Neo6_x86_VPN118.inf | 228 +- .../Neo6_Win8/x86/Neo6_x86_VPN119.inf | 228 +- .../Neo6_Win8/x86/Neo6_x86_VPN12.inf | 228 +- .../Neo6_Win8/x86/Neo6_x86_VPN120.inf | 228 +- .../Neo6_Win8/x86/Neo6_x86_VPN121.inf | 228 +- .../Neo6_Win8/x86/Neo6_x86_VPN122.inf | 228 +- .../Neo6_Win8/x86/Neo6_x86_VPN123.inf | 228 +- .../Neo6_Win8/x86/Neo6_x86_VPN124.inf | 228 +- .../Neo6_Win8/x86/Neo6_x86_VPN125.inf | 228 +- .../Neo6_Win8/x86/Neo6_x86_VPN126.inf | 228 +- .../Neo6_Win8/x86/Neo6_x86_VPN127.inf | 228 +- .../Neo6_Win8/x86/Neo6_x86_VPN13.inf | 228 +- .../Neo6_Win8/x86/Neo6_x86_VPN14.inf | 228 +- .../Neo6_Win8/x86/Neo6_x86_VPN15.inf | 228 +- .../Neo6_Win8/x86/Neo6_x86_VPN16.inf | 228 +- .../Neo6_Win8/x86/Neo6_x86_VPN17.inf | 228 +- .../Neo6_Win8/x86/Neo6_x86_VPN18.inf | 228 +- .../Neo6_Win8/x86/Neo6_x86_VPN19.inf | 228 +- .../Neo6_Win8/x86/Neo6_x86_VPN2.inf | 228 +- .../Neo6_Win8/x86/Neo6_x86_VPN20.inf | 228 +- .../Neo6_Win8/x86/Neo6_x86_VPN21.inf | 228 +- .../Neo6_Win8/x86/Neo6_x86_VPN22.inf | 228 +- .../Neo6_Win8/x86/Neo6_x86_VPN23.inf | 228 +- .../Neo6_Win8/x86/Neo6_x86_VPN24.inf | 228 +- .../Neo6_Win8/x86/Neo6_x86_VPN25.inf | 228 +- .../Neo6_Win8/x86/Neo6_x86_VPN26.inf | 228 +- .../Neo6_Win8/x86/Neo6_x86_VPN27.inf | 228 +- .../Neo6_Win8/x86/Neo6_x86_VPN28.inf | 228 +- .../Neo6_Win8/x86/Neo6_x86_VPN29.inf | 228 +- .../Neo6_Win8/x86/Neo6_x86_VPN3.inf | 228 +- .../Neo6_Win8/x86/Neo6_x86_VPN30.inf | 228 +- .../Neo6_Win8/x86/Neo6_x86_VPN31.inf | 228 +- .../Neo6_Win8/x86/Neo6_x86_VPN32.inf | 228 +- .../Neo6_Win8/x86/Neo6_x86_VPN33.inf | 228 +- .../Neo6_Win8/x86/Neo6_x86_VPN34.inf | 228 +- .../Neo6_Win8/x86/Neo6_x86_VPN35.inf | 228 +- .../Neo6_Win8/x86/Neo6_x86_VPN36.inf | 228 +- .../Neo6_Win8/x86/Neo6_x86_VPN37.inf | 228 +- .../Neo6_Win8/x86/Neo6_x86_VPN38.inf | 228 +- .../Neo6_Win8/x86/Neo6_x86_VPN39.inf | 228 +- .../Neo6_Win8/x86/Neo6_x86_VPN4.inf | 228 +- .../Neo6_Win8/x86/Neo6_x86_VPN40.inf | 228 +- .../Neo6_Win8/x86/Neo6_x86_VPN41.inf | 228 +- .../Neo6_Win8/x86/Neo6_x86_VPN42.inf | 228 +- .../Neo6_Win8/x86/Neo6_x86_VPN43.inf | 228 +- .../Neo6_Win8/x86/Neo6_x86_VPN44.inf | 228 +- .../Neo6_Win8/x86/Neo6_x86_VPN45.inf | 228 +- .../Neo6_Win8/x86/Neo6_x86_VPN46.inf | 228 +- .../Neo6_Win8/x86/Neo6_x86_VPN47.inf | 228 +- .../Neo6_Win8/x86/Neo6_x86_VPN48.inf | 228 +- .../Neo6_Win8/x86/Neo6_x86_VPN49.inf | 228 +- .../Neo6_Win8/x86/Neo6_x86_VPN5.inf | 228 +- .../Neo6_Win8/x86/Neo6_x86_VPN50.inf | 228 +- .../Neo6_Win8/x86/Neo6_x86_VPN51.inf | 228 +- .../Neo6_Win8/x86/Neo6_x86_VPN52.inf | 228 +- .../Neo6_Win8/x86/Neo6_x86_VPN53.inf | 228 +- .../Neo6_Win8/x86/Neo6_x86_VPN54.inf | 228 +- .../Neo6_Win8/x86/Neo6_x86_VPN55.inf | 228 +- .../Neo6_Win8/x86/Neo6_x86_VPN56.inf | 228 +- .../Neo6_Win8/x86/Neo6_x86_VPN57.inf | 228 +- .../Neo6_Win8/x86/Neo6_x86_VPN58.inf | 228 +- .../Neo6_Win8/x86/Neo6_x86_VPN59.inf | 228 +- .../Neo6_Win8/x86/Neo6_x86_VPN6.inf | 228 +- .../Neo6_Win8/x86/Neo6_x86_VPN60.inf | 228 +- .../Neo6_Win8/x86/Neo6_x86_VPN61.inf | 228 +- .../Neo6_Win8/x86/Neo6_x86_VPN62.inf | 228 +- .../Neo6_Win8/x86/Neo6_x86_VPN63.inf | 228 +- .../Neo6_Win8/x86/Neo6_x86_VPN64.inf | 228 +- .../Neo6_Win8/x86/Neo6_x86_VPN65.inf | 228 +- .../Neo6_Win8/x86/Neo6_x86_VPN66.inf | 228 +- .../Neo6_Win8/x86/Neo6_x86_VPN67.inf | 228 +- .../Neo6_Win8/x86/Neo6_x86_VPN68.inf | 228 +- .../Neo6_Win8/x86/Neo6_x86_VPN69.inf | 228 +- .../Neo6_Win8/x86/Neo6_x86_VPN7.inf | 228 +- .../Neo6_Win8/x86/Neo6_x86_VPN70.inf | 228 +- .../Neo6_Win8/x86/Neo6_x86_VPN71.inf | 228 +- .../Neo6_Win8/x86/Neo6_x86_VPN72.inf | 228 +- .../Neo6_Win8/x86/Neo6_x86_VPN73.inf | 228 +- .../Neo6_Win8/x86/Neo6_x86_VPN74.inf | 228 +- .../Neo6_Win8/x86/Neo6_x86_VPN75.inf | 228 +- .../Neo6_Win8/x86/Neo6_x86_VPN76.inf | 228 +- .../Neo6_Win8/x86/Neo6_x86_VPN77.inf | 228 +- .../Neo6_Win8/x86/Neo6_x86_VPN78.inf | 228 +- .../Neo6_Win8/x86/Neo6_x86_VPN79.inf | 228 +- .../Neo6_Win8/x86/Neo6_x86_VPN8.inf | 228 +- .../Neo6_Win8/x86/Neo6_x86_VPN80.inf | 228 +- .../Neo6_Win8/x86/Neo6_x86_VPN81.inf | 228 +- .../Neo6_Win8/x86/Neo6_x86_VPN82.inf | 228 +- .../Neo6_Win8/x86/Neo6_x86_VPN83.inf | 228 +- .../Neo6_Win8/x86/Neo6_x86_VPN84.inf | 228 +- .../Neo6_Win8/x86/Neo6_x86_VPN85.inf | 228 +- .../Neo6_Win8/x86/Neo6_x86_VPN86.inf | 228 +- .../Neo6_Win8/x86/Neo6_x86_VPN87.inf | 228 +- .../Neo6_Win8/x86/Neo6_x86_VPN88.inf | 228 +- .../Neo6_Win8/x86/Neo6_x86_VPN89.inf | 228 +- .../Neo6_Win8/x86/Neo6_x86_VPN9.inf | 228 +- .../Neo6_Win8/x86/Neo6_x86_VPN90.inf | 228 +- .../Neo6_Win8/x86/Neo6_x86_VPN91.inf | 228 +- .../Neo6_Win8/x86/Neo6_x86_VPN92.inf | 228 +- .../Neo6_Win8/x86/Neo6_x86_VPN93.inf | 228 +- .../Neo6_Win8/x86/Neo6_x86_VPN94.inf | 228 +- .../Neo6_Win8/x86/Neo6_x86_VPN95.inf | 228 +- .../Neo6_Win8/x86/Neo6_x86_VPN96.inf | 228 +- .../Neo6_Win8/x86/Neo6_x86_VPN97.inf | 228 +- .../Neo6_Win8/x86/Neo6_x86_VPN98.inf | 228 +- .../Neo6_Win8/x86/Neo6_x86_VPN99.inf | 228 +- .../DriverPackages/Neo9x/x86/Neo9x_x86.inf | 232 +- .../SeLow_Win10/x64/SeLow_x64.inf | 136 +- .../SeLow_Win10/x86/SeLow_x86.inf | 136 +- .../SeLow_Win8/x64/SeLow_x64.inf | 136 +- .../SeLow_Win8/x86/SeLow_x86.inf | 136 +- .../DriverPackages/Wfp/x64/pxwfp_x64.inf | 104 +- .../DriverPackages/Wfp/x86/pxwfp_x86.inf | 104 +- .../Wfp_Win10/x64/pxwfp_x64.inf | 104 +- .../Wfp_Win10/x86/pxwfp_x86.inf | 104 +- src/bin/hamcore/SOURCES_OF_BINARY_FILES.TXT | 220 +- src/bin/hamcore/backup_dir_readme.txt | 20 +- src/bin/hamcore/empty.config | 6 +- src/bin/hamcore/eula.txt | 50 +- src/bin/hamcore/lang.config | 34 +- src/bin/hamcore/languages.txt | 22 +- src/bin/hamcore/languages_wine.txt | 12 +- src/bin/hamcore/legal.txt | 588 +- src/bin/hamcore/openvpn_readme.txt | 584 +- src/bin/hamcore/strtable_cn.stb | 14630 ++--- src/bin/hamcore/strtable_en.stb | 14610 ++--- src/bin/hamcore/strtable_ja.stb | 14612 ++--- src/bin/hamcore/strtable_tw.stb | 2 +- src/bin/hamcore/vpnserver_api_doc.html | 2 +- src/bin/hamcore/vpnweb_sample_cn.htm | 142 +- src/bin/hamcore/vpnweb_sample_en.htm | 142 +- src/bin/hamcore/vpnweb_sample_ja.htm | 144 +- src/bin/hamcore/vpnweb_sample_tw.htm | 2 +- src/bin/hamcore/webui/cryptcom.cgi | 98 +- src/bin/hamcore/webui/edituser.cgi | 64 +- src/bin/hamcore/webui/error.cgi | 12 +- src/bin/hamcore/webui/hub.cgi | 102 +- src/bin/hamcore/webui/license.cgi | 72 +- src/bin/hamcore/webui/listener.cgi | 26 +- src/bin/hamcore/webui/localbridge.cgi | 104 +- src/bin/hamcore/webui/login.cgi | 34 +- src/bin/hamcore/webui/newhub.cgi | 36 +- src/bin/hamcore/webui/redirect.cgi | 10 +- src/bin/hamcore/webui/securenat.cgi | 118 +- src/bin/hamcore/webui/server.cgi | 84 +- src/bin/hamcore/webui/session.cgi | 32 +- src/bin/hamcore/webui/user.cgi | 36 +- src/bin/hamcore/webui/webui.css | 6 +- src/bin/hamcore/wwwroot/admin/index.html | 2 +- src/hamcorebuilder/hamcorebuilder.c | 150 +- src/vpn16/Resource.h | 34 +- src/vpn16/Vpn16.def | 16 +- src/vpn16/Vpn16.mak | 172 +- src/vpn16/Vpn16.rc | 114 +- src/vpn16/Vpn16.vcw | 12 +- src/vpn16/vpn16.c | 762 +- src/vpn16/vpn16.h | 52 +- src/vpnbridge/resource.h | 34 +- src/vpnbridge/vpnbridge.c | 126 +- src/vpnbridge/vpnbridge.rc | 144 +- src/vpnclient/resource.h | 34 +- src/vpnclient/vpnclient.rc | 144 +- src/vpnclient/vpncsvc.c | 100 +- src/vpnclient/vpncsvc.h | 36 +- src/vpncmd/resource.h | 34 +- src/vpncmd/vpncmd.c | 210 +- src/vpncmd/vpncmd.rc | 144 +- src/vpncmdsys/resource.h | 32 +- src/vpncmdsys/vpncmdsys.c | 388 +- src/vpncmdsys/vpncmdsys.h | 32 +- src/vpncmdsys/vpncmdsys.rc | 144 +- src/vpncmdsys/vpncmdsys.vcproj | 516 +- src/vpncmgr/resource.h | 42 +- src/vpncmgr/vpncmgr.c | 110 +- src/vpncmgr/vpncmgr.rc | 148 +- src/vpndrvinst/resource.h | 38 +- src/vpndrvinst/vpndrvinst.c | 506 +- src/vpndrvinst/vpndrvinst.h | 46 +- src/vpndrvinst/vpndrvinst.rc | 144 +- src/vpninstall/resource.h | 172 +- src/vpninstall/vpninstall.c | 3134 +- src/vpninstall/vpninstall.h | 264 +- src/vpninstall/vpninstall.rc | 442 +- src/vpninstall/vpninstall.vcproj | 496 +- src/vpnserver/resource.h | 34 +- src/vpnserver/vpnserver.c | 126 +- src/vpnserver/vpnserver.rc | 144 +- src/vpnsetup/resource.h | 66 +- src/vpnsetup/vpnsetup.c | 84 +- src/vpnsetup/vpnsetup.rc | 348 +- src/vpnsmgr/resource.h | 36 +- src/vpnsmgr/vpnsmgr.c | 92 +- src/vpnsmgr/vpnsmgr.rc | 144 +- src/vpntest/resource.h | 38 +- src/vpntest/vpntest.c | 538 +- src/vpntest/vpntest.h | 2 +- src/vpntest/vpntest.rc | 144 +- src/vpnweb/VpnWebControl.cpp | 8 +- src/vpnweb/VpnWebControl.h | 764 +- src/vpnweb/VpnWebControl.rgs | 68 +- src/vpnweb/dlldata.c | 76 +- src/vpnweb/resource.h | 160 +- src/vpnweb/stdafx.cpp | 2 +- src/vpnweb/stdafx.h | 70 +- src/vpnweb/vpnweb.cpp | 122 +- src/vpnweb/vpnweb.def | 14 +- src/vpnweb/vpnweb.idl | 102 +- src/vpnweb/vpnweb.rc | 376 +- src/vpnweb/vpnweb.rgs | 22 +- src/vpnweb/vpnweb.vcproj | 740 +- src/vpnweb/vpnwebdlg.c | 3002 +- src/vpnweb/vpnwebdlg.h | 84 +- src/vpnweb/vpnwebdlg_inner.h | 350 +- 944 files changed, 450585 insertions(+), 450587 deletions(-) diff --git a/AUTHORS.TXT b/AUTHORS.TXT index 962e91fe..ae891c03 100644 --- a/AUTHORS.TXT +++ b/AUTHORS.TXT @@ -1,140 +1,140 @@ -SoftEther VPN is developed by SoftEther VPN Project at University of Tsukuba. -https://www.softether.org/ - -AUTHORS OF SOFTETHER VPN ------------------------- - -CORE DEVELOPERS: - - - Daiyuu Nobori, Ph.D. - Computer Science, Graduate School of University of Tsukuba - SoftEther Corporation - E-mail: daiyuu-nobori [at] softether.org - - - Tetsuo Sugiyama, Ph.D. - SoftEther Corporation - - - Junpei Kuwana, Ph.D. - Risk Engineering, Graduate School of University of Tsukuba - SoftEther Corporation - - - Takao Ito, Ph.D. - Computer Science, Graduate School of University of Tsukuba - SoftEther Corporation - - - Mei Sharie Ann Yamaguchi, Ph.D. - Life and Environmental Sciences, Graduate School of University of Tsukuba - - - Christopher Smith - College of Information Science, University of Tsukuba - - -WEB-SITE DESIGNER: - - - Genya Hatakeyama - College of Information Science, University of Tsukuba - - -DEVELOPMENT BOARD MEMBERS: - - - Moataz Elmasry - https://github.com/moatazelmasry2 - - - Zulyandri Zardi - https://github.com/zulzardi - - - Alex Maslakov - https://github.com/GildedHonour - - - Davide Beatrici - https://github.com/davidebeatrici - - - Ilya Shipitsin - https://github.com/chipitsine - - -SPECIAL CONTRIBUTORS: - - - Guido Vranken - https://github.com/guidovranken - - -CONTRIBUTORS: - - - ajeecai - - Alexandre De Oliveira - - Alexey Kryuchkov - - Allen Cui - - Andy Walsh - - Bernhard Rosenkränzer - - Bill Welliver - - Charles Surett - - cm0x4d - - DDGo - - Denis Lesnov - - Den Lesnov - - Dexter Ang - - Dmitry Glushenok - - Dmitry Orlov - - ELIN - - Guanzhong Chen - - Hideki Saito - - holoreimu - - Holoreimu - - hoppler - - Igor Pikovets - - James Brink - - Jeff Tang - - Jioh L. Jung - - Johan de Vries - - Josh Soref - - Joshua Perry - - Koichiro Iwao - - Luiz Eduardo Gava - - macvk - - Maks Naumov - - Matt Lewandowsky - - Max Miroshnikov - - Melvyn - - Michael B - - Michael Clausen - - Michael Clausen - - Mike Selivanov - - Mikhail Pridushchenko - - mogikanin - - Mykhaylo Yehorov - - nattoheaven - - Nguyễn Hồng Quân - - Noah O'Donoghue - - NOKUBI Takatsugu - - NoNameA 774 - - Norbert Preining - - NV - - Olimjon - - parly - - PeTeeR - - Quantum - - Quintin - - Raymond Tau - - rel22 - - Renaud Allard - - root - - Sacha J Bernstein - - Sahal Ansari - - Shadus Black - - thepyper - - Tim Schneider - - tonychung00 - - Victor Salgado - - William Welliver - - YF - - -JOIN THE SOFTETHER VPN DEVELOPMENT ----------------------------------- - -Want to become a contributor? Please send us a patch. - -See also: SoftEther VPN Patch Acceptance Policy -https://www.softether.org/5-download/src/9.patch - +SoftEther VPN is developed by SoftEther VPN Project at University of Tsukuba. +https://www.softether.org/ + +AUTHORS OF SOFTETHER VPN +------------------------ + +CORE DEVELOPERS: + + - Daiyuu Nobori, Ph.D. + Computer Science, Graduate School of University of Tsukuba + SoftEther Corporation + E-mail: daiyuu-nobori [at] softether.org + + - Tetsuo Sugiyama, Ph.D. + SoftEther Corporation + + - Junpei Kuwana, Ph.D. + Risk Engineering, Graduate School of University of Tsukuba + SoftEther Corporation + + - Takao Ito, Ph.D. + Computer Science, Graduate School of University of Tsukuba + SoftEther Corporation + + - Mei Sharie Ann Yamaguchi, Ph.D. + Life and Environmental Sciences, Graduate School of University of Tsukuba + + - Christopher Smith + College of Information Science, University of Tsukuba + + +WEB-SITE DESIGNER: + + - Genya Hatakeyama + College of Information Science, University of Tsukuba + + +DEVELOPMENT BOARD MEMBERS: + + - Moataz Elmasry + https://github.com/moatazelmasry2 + + - Zulyandri Zardi + https://github.com/zulzardi + + - Alex Maslakov + https://github.com/GildedHonour + + - Davide Beatrici + https://github.com/davidebeatrici + + - Ilya Shipitsin + https://github.com/chipitsine + + +SPECIAL CONTRIBUTORS: + + - Guido Vranken + https://github.com/guidovranken + + +CONTRIBUTORS: + + - ajeecai + - Alexandre De Oliveira + - Alexey Kryuchkov + - Allen Cui + - Andy Walsh + - Bernhard Rosenkränzer + - Bill Welliver + - Charles Surett + - cm0x4d + - DDGo + - Denis Lesnov + - Den Lesnov + - Dexter Ang + - Dmitry Glushenok + - Dmitry Orlov + - ELIN + - Guanzhong Chen + - Hideki Saito + - holoreimu + - Holoreimu + - hoppler + - Igor Pikovets + - James Brink + - Jeff Tang + - Jioh L. Jung + - Johan de Vries + - Josh Soref + - Joshua Perry + - Koichiro Iwao + - Luiz Eduardo Gava + - macvk + - Maks Naumov + - Matt Lewandowsky + - Max Miroshnikov + - Melvyn + - Michael B + - Michael Clausen + - Michael Clausen + - Mike Selivanov + - Mikhail Pridushchenko + - mogikanin + - Mykhaylo Yehorov + - nattoheaven + - Nguyễn Hồng Quân + - Noah O'Donoghue + - NOKUBI Takatsugu + - NoNameA 774 + - Norbert Preining + - NV + - Olimjon + - parly + - PeTeeR + - Quantum + - Quintin + - Raymond Tau + - rel22 + - Renaud Allard + - root + - Sacha J Bernstein + - Sahal Ansari + - Shadus Black + - thepyper + - Tim Schneider + - tonychung00 + - Victor Salgado + - William Welliver + - YF + + +JOIN THE SOFTETHER VPN DEVELOPMENT +---------------------------------- + +Want to become a contributor? Please send us a patch. + +See also: SoftEther VPN Patch Acceptance Policy +https://www.softether.org/5-download/src/9.patch + diff --git a/LICENSE b/LICENSE index c81d1ad8..0cd59b5b 100644 --- a/LICENSE +++ b/LICENSE @@ -1,242 +1,242 @@ - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - - Copyright (c) all contributors on SoftEther VPN project in GitHub. - Copyright (c) Daiyuu Nobori, SoftEther Project at University of Tsukuba, and SoftEther Corporation. - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. - - - -DISCLAIMER -========== - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. - -THIS SOFTWARE IS DEVELOPED IN JAPAN, AND DISTRIBUTED FROM JAPAN, UNDER -JAPANESE LAWS. YOU MUST AGREE IN ADVANCE TO USE, COPY, MODIFY, MERGE, PUBLISH, -DISTRIBUTE, SUBLICENSE, AND/OR SELL COPIES OF THIS SOFTWARE, THAT ANY -JURIDICAL DISPUTES WHICH ARE CONCERNED TO THIS SOFTWARE OR ITS CONTENTS, -AGAINST US (SOFTETHER PROJECT, SOFTETHER CORPORATION, DAIYUU NOBORI OR OTHER -SUPPLIERS), OR ANY JURIDICAL DISPUTES AGAINST US WHICH ARE CAUSED BY ANY KIND -OF USING, COPYING, MODIFYING, MERGING, PUBLISHING, DISTRIBUTING, SUBLICENSING, -AND/OR SELLING COPIES OF THIS SOFTWARE SHALL BE REGARDED AS BE CONSTRUED AND -CONTROLLED BY JAPANESE LAWS, AND YOU MUST FURTHER CONSENT TO EXCLUSIVE -JURISDICTION AND VENUE IN THE COURTS SITTING IN TOKYO, JAPAN. YOU MUST WAIVE -ALL DEFENSES OF LACK OF PERSONAL JURISDICTION AND FORUM NON CONVENIENS. -PROCESS MAY BE SERVED ON EITHER PARTY IN THE MANNER AUTHORIZED BY APPLICABLE -LAW OR COURT RULE. - -USE ONLY IN JAPAN. DO NOT USE THIS SOFTWARE IN ANOTHER COUNTRY UNLESS YOU HAVE -A CONFIRMATION THAT THIS SOFTWARE DOES NOT VIOLATE ANY CRIMINAL LAWS OR CIVIL -RIGHTS IN THAT PARTICULAR COUNTRY. USING THIS SOFTWARE IN OTHER COUNTRIES IS -COMPLETELY AT YOUR OWN RISK. THE SOFTETHER VPN PROJECT HAS DEVELOPED AND -DISTRIBUTED THIS SOFTWARE TO COMPLY ONLY WITH THE JAPANESE LAWS AND EXISTING -CIVIL RIGHTS INCLUDING PATENTS WHICH ARE SUBJECTS APPLY IN JAPAN. OTHER -COUNTRIES' LAWS OR CIVIL RIGHTS ARE NONE OF OUR CONCERNS NOR RESPONSIBILITIES. -WE HAVE NEVER INVESTIGATED ANY CRIMINAL REGULATIONS, CIVIL LAWS OR -INTELLECTUAL PROPERTY RIGHTS INCLUDING PATENTS IN ANY OF OTHER 200+ COUNTRIES -AND TERRITORIES. BY NATURE, THERE ARE 200+ REGIONS IN THE WORLD, WITH -DIFFERENT LAWS. IT IS IMPOSSIBLE TO VERIFY EVERY COUNTRIES' LAWS, REGULATIONS -AND CIVIL RIGHTS TO MAKE THE SOFTWARE COMPLY WITH ALL COUNTRIES' LAWS BY THE -PROJECT. EVEN IF YOU WILL BE SUED BY A PRIVATE ENTITY OR BE DAMAGED BY A -PUBLIC SERVANT IN YOUR COUNTRY, THE DEVELOPERS OF THIS SOFTWARE WILL NEVER BE -LIABLE TO RECOVER OR COMPENSATE SUCH DAMAGES, CRIMINAL OR CIVIL -RESPONSIBILITIES. NOTE THAT THIS LINE IS NOT LICENSE RESTRICTION BUT JUST A -STATEMENT FOR WARNING AND DISCLAIMER. - -READ AND UNDERSTAND THE 'src/WARNING.TXT' FILE BEFORE USING THIS SOFTWARE. -SOME SOFTWARE PROGRAMS FROM THIRD PARTIES ARE INCLUDED ON THIS SOFTWARE WITH -LICENSE CONDITIONS WHICH ARE DESCRIBED ON THE 'src/THIRD_PARTY.TXT' FILE. - + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + + Copyright (c) all contributors on SoftEther VPN project in GitHub. + Copyright (c) Daiyuu Nobori, SoftEther Project at University of Tsukuba, and SoftEther Corporation. + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + + + +DISCLAIMER +========== + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. + +THIS SOFTWARE IS DEVELOPED IN JAPAN, AND DISTRIBUTED FROM JAPAN, UNDER +JAPANESE LAWS. YOU MUST AGREE IN ADVANCE TO USE, COPY, MODIFY, MERGE, PUBLISH, +DISTRIBUTE, SUBLICENSE, AND/OR SELL COPIES OF THIS SOFTWARE, THAT ANY +JURIDICAL DISPUTES WHICH ARE CONCERNED TO THIS SOFTWARE OR ITS CONTENTS, +AGAINST US (SOFTETHER PROJECT, SOFTETHER CORPORATION, DAIYUU NOBORI OR OTHER +SUPPLIERS), OR ANY JURIDICAL DISPUTES AGAINST US WHICH ARE CAUSED BY ANY KIND +OF USING, COPYING, MODIFYING, MERGING, PUBLISHING, DISTRIBUTING, SUBLICENSING, +AND/OR SELLING COPIES OF THIS SOFTWARE SHALL BE REGARDED AS BE CONSTRUED AND +CONTROLLED BY JAPANESE LAWS, AND YOU MUST FURTHER CONSENT TO EXCLUSIVE +JURISDICTION AND VENUE IN THE COURTS SITTING IN TOKYO, JAPAN. YOU MUST WAIVE +ALL DEFENSES OF LACK OF PERSONAL JURISDICTION AND FORUM NON CONVENIENS. +PROCESS MAY BE SERVED ON EITHER PARTY IN THE MANNER AUTHORIZED BY APPLICABLE +LAW OR COURT RULE. + +USE ONLY IN JAPAN. DO NOT USE THIS SOFTWARE IN ANOTHER COUNTRY UNLESS YOU HAVE +A CONFIRMATION THAT THIS SOFTWARE DOES NOT VIOLATE ANY CRIMINAL LAWS OR CIVIL +RIGHTS IN THAT PARTICULAR COUNTRY. USING THIS SOFTWARE IN OTHER COUNTRIES IS +COMPLETELY AT YOUR OWN RISK. THE SOFTETHER VPN PROJECT HAS DEVELOPED AND +DISTRIBUTED THIS SOFTWARE TO COMPLY ONLY WITH THE JAPANESE LAWS AND EXISTING +CIVIL RIGHTS INCLUDING PATENTS WHICH ARE SUBJECTS APPLY IN JAPAN. OTHER +COUNTRIES' LAWS OR CIVIL RIGHTS ARE NONE OF OUR CONCERNS NOR RESPONSIBILITIES. +WE HAVE NEVER INVESTIGATED ANY CRIMINAL REGULATIONS, CIVIL LAWS OR +INTELLECTUAL PROPERTY RIGHTS INCLUDING PATENTS IN ANY OF OTHER 200+ COUNTRIES +AND TERRITORIES. BY NATURE, THERE ARE 200+ REGIONS IN THE WORLD, WITH +DIFFERENT LAWS. IT IS IMPOSSIBLE TO VERIFY EVERY COUNTRIES' LAWS, REGULATIONS +AND CIVIL RIGHTS TO MAKE THE SOFTWARE COMPLY WITH ALL COUNTRIES' LAWS BY THE +PROJECT. EVEN IF YOU WILL BE SUED BY A PRIVATE ENTITY OR BE DAMAGED BY A +PUBLIC SERVANT IN YOUR COUNTRY, THE DEVELOPERS OF THIS SOFTWARE WILL NEVER BE +LIABLE TO RECOVER OR COMPENSATE SUCH DAMAGES, CRIMINAL OR CIVIL +RESPONSIBILITIES. NOTE THAT THIS LINE IS NOT LICENSE RESTRICTION BUT JUST A +STATEMENT FOR WARNING AND DISCLAIMER. + +READ AND UNDERSTAND THE 'src/WARNING.TXT' FILE BEFORE USING THIS SOFTWARE. +SOME SOFTWARE PROGRAMS FROM THIRD PARTIES ARE INCLUDED ON THIS SOFTWARE WITH +LICENSE CONDITIONS WHICH ARE DESCRIBED ON THE 'src/THIRD_PARTY.TXT' FILE. + diff --git a/README.md b/README.md index a11dcbf9..a4fe2de4 100644 --- a/README.md +++ b/README.md @@ -1,273 +1,273 @@ -# SoftEther VPN - -||Badges| -|---|---| -|AppVeyor|[![AppVeyor build status](https://ci.appveyor.com/api/projects/status/github/softethervpn/softethervpn?branch=master&svg=true)](https://ci.appveyor.com/project/softethervpn/softethervpn) | -|Travis CI|[![Travis CI build status](https://travis-ci.org/SoftEtherVPN/SoftEtherVPN.svg?branch=master)](https://travis-ci.org/SoftEtherVPN/SoftEtherVPN) | -|GitLab CI|[![GitLab CI build status](https://gitlab.com/SoftEther/SoftEtherVPN/badges/master/pipeline.svg)](https://gitlab.com/SoftEther/SoftEtherVPN/pipelines)| -|Coverity Scan|[![Coverity Scan build status](https://scan.coverity.com/projects/16304/badge.svg)](https://scan.coverity.com/projects/softethervpn-softethervpn)| -|Azure Pipelines|[![Azure Pipelines build status for Nightly](https://dev.azure.com/SoftEther-VPN/SoftEther%20VPN/_apis/build/status/6?api-version=6.0-preview.1)](https://dev.azure.com/SoftEther-VPN/SoftEther%20VPN/_build?definitionId=6)| -|Cirrus CI|[![Cirrus CI build status](https://api.cirrus-ci.com/github/SoftEtherVPN/SoftEtherVPN.svg)](https://cirrus-ci.com/github/SoftEtherVPN/SoftEtherVPN)| - -- [SoftEther VPN](#softether-vpn) -- [BOARD MEMBERS OF THIS REPOSITORY](#board-members-of-this-repository) -- [SOFTETHER VPN ADVANTAGES](#softether-vpn-advantages) -- [Installation](#installation) - * [For Ubuntu](#for-ubuntu) - * [For FreeBSD](#for-freebsd) - * [From binary installers:](#from-binary-installers) - * [Build from Source code](#build-from-source-code) -- [About HTML5-based Modern Admin Console and JSON-RPC API Suite](#about-html5-based-modern-admin-console-and-json-rpc-api-suite) - * [Built-in SoftEther VPN Server HTML5 Ajax-based Web Administration Console](#built-in-softether-vpn-server-html5-ajax-based-web-administration-console) - * [Built-in SoftEther Server VPN JSON-RPC API Suite](#built-in-softether-server-vpn-json-rpc-api-suite) -- [TO CIRCUMVENT YOUR GOVERNMENT'S FIREWALL RESTRICTION](#to-circumvent-your-governments-firewall-restriction) -- [SOURCE CODE CONTRIBUTION](#source-code-contribution) -- [DEAR SECURITY EXPERTS](#dear-security-experts) - -SoftEther VPN (Developer Edition Master Repository) -- An Open-Source Cross-platform Multi-protocol VPN Program -https://www.softether.org/ - - -This repository has experimental codes. Pull requests are welcome. - -Stable Edition is available on -https://github.com/SoftEtherVPN/SoftEtherVPN_Stable -which the non-developer user can stable use. - -Source code packages (.zip and .tar.gz) and binary files of Stable Edition are also available: -https://www.softether-download.com/ - -Copyright (c) all contributors on SoftEther VPN project in GitHub. -Copyright (c) Daiyuu Nobori, SoftEther Project at University of Tsukuba, and SoftEther Corporation. - ---- - -The development of SoftEther VPN was supported by the MITOH Project, -a research and development project by Japanese Government, -subsidized by Ministry of Economy, Trade and Industry of Japan, -administrated by Information Promotion Agency. -https://www.ipa.go.jp/english/humandev/ - ---- - -![https://icons8.com](resources/icons8.png "Icons8") - -[Icons8](https://icons8.com) kindly supported the project by gifting a license which allows to edit and redistribute their icons. - -Please note that you are not allowed to redistribute those icons outside of this repository. - -The developers of SoftEther VPN love Icons8's work and kindly ask the users to support them as much as possible. - ---- - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -SoftEther VPN ("SoftEther" means "Software Ethernet") is one of the -world's most powerful and easy-to-use multi-protocol VPN software. - -SoftEther VPN runs on Windows, Linux, Mac, FreeBSD and Solaris. - -SoftEther VPN supports most of widely-used VPN protocols -including SSL-VPN, OpenVPN, IPsec, L2TP, MS-SSTP, L2TPv3 and EtherIP -by the single SoftEther VPN Server program. - -More details on https://www.softether.org/. - - -# BOARD MEMBERS OF THIS REPOSITORY - - -Daiyuu Nobori (Since Jan 2, 2014) -https://github.com/dnobori - -Moataz Elmasry (Since Nov 6, 2017) -https://github.com/moatazelmasry2 - -Zulyandri Zardi (Since Nov 6, 2017) -https://github.com/zulzardi - -Alex Maslakov (Since Nov 6, 2017) -https://github.com/GildedHonour - -Davide Beatrici (Since Jul 21, 2018) -https://github.com/davidebeatrici - -Ilya Shipitsin (Since Jul 21, 2018) -https://github.com/chipitsine - - -# SOFTETHER VPN ADVANTAGES - - -- Supporting all popular VPN protocols by the single VPN server: - SSL-VPN (HTTPS) - OpenVPN - IPsec - L2TP - MS-SSTP - L2TPv3 - EtherIP -- Free and open-source software. -- Easy to establish both remote-access and site-to-site VPN. -- SSL-VPN Tunneling on HTTPS to pass through NATs and firewalls. -- Revolutionary VPN over ICMP and VPN over DNS features. -- Resistance to highly-restricted firewall. -- Ethernet-bridging (L2) and IP-routing (L3) over VPN. -- Embedded dynamic-DNS and NAT-traversal so that no static nor - fixed IP address is required. -- AES 256-bit and RSA 4096-bit encryptions. -- Sufficient security features such as logging and firewall inner - VPN tunnel. -- User authentication with RADIUS and NT domain controllers. -- User authentication with X.509 client certificate. -- Packet logging. -- 1Gbps-class high-speed throughput performance with low memory and - CPU usage. -- Windows, Linux, Mac, Android, iPhone, iPad and Windows Phone are - supported. -- The OpenVPN clone function supports legacy OpenVPN clients. -- IPv4 / IPv6 dual-stack. -- The VPN server runs on Windows, Linux, FreeBSD, Solaris and Mac OS X. -- Configure All settings on GUI. -- Multi-languages (English, Japanese and Simplified-Chinese). -- No memory leaks. High quality stable codes, intended for long-term runs. - We always verify that there are no memory or resource leaks before - releasing the build. -- More details at https://www.softether.org/. - - -# Installation - -## For Ubuntu - -Launchpad PPA maintained by [Dmitry Verkhoturov](https://github.com/paskal): - -[Daily builds](https://code.launchpad.net/~paskal-07/+archive/ubuntu/softethervpn) (latest released tag) - -[Nightly builds](https://code.launchpad.net/~paskal-07/+archive/ubuntu/softethervpn-nightly) - -## For FreeBSD - -SoftEther VPN in FreeBSD Ports Collection is maintained by -[Koichiro Iwao](https://people.FreeBSD.org/~meta/) ([@metalefty](https://github.com/metalefty)). - -Binary package can be installed by pkg: -``` -pkg install softether5 -``` - -Alternatively, it can be built & installed by ports: -``` -make install -C /usr/ports/security/softether5 -``` - -To run SoftEther VPN Server: -``` -service softether_server start -``` - -To configure SoftEther VPN Server startup on boot: -``` -sysrc softether_server_enable=yes -``` - -Also SoftEther VPN [Stable Edition](https://www.freshports.org/security/softether-devel/) and -[RTM version](https://www.freshports.org/security/softether/) are available on FreeBSD. - -## From binary installers: - -Those can be found under https://www.softether-download.com/ -There you can also find SoftEtherVPN source code in zip and tar formats. - -## Build from Source code - -see [BUILD_UNIX](src/BUILD_UNIX.md) or [BUILD_WINDOWS](src/BUILD_WINDOWS.md) - -There are two flavours of SoftEtherVPN source code: - -1. Unstable. Found under https://github.com/SoftEtherVPN/SoftEtherVPN -2. Stable. Found under https://github.com/SoftEtherVPN/SoftEtherVPN_Stable - - -# About HTML5-based Modern Admin Console and JSON-RPC API Suite - -## Built-in SoftEther VPN Server HTML5 Ajax-based Web Administration Console -We are developing the HTML5 Ajax-based Web Administration Console (currently very limited, under construction) in the embedded HTTPS server on the SoftEther VPN Server. - -Access to the following URL from your favorite web browser. - -``` -https://:/admin/ -``` - -For example if your VPN Server is running as the port 5555 on the host at 192.168.0.1, you can access to the web console by: - -``` -https://192.168.0.1:5555/admin/ -``` - -Note: Your HTML5 development contribution is very appreciated. The current HTML5 pages are written by Daiyuu Nobori (the core developer of SoftEther VPN). He is obviously lack of HTML5 development ability. Please kindly consider to contribute for SoftEther VPN's development on GitHub. Your code will help every people running SoftEther VPN Server. - - -## Built-in SoftEther Server VPN JSON-RPC API Suite -The API Suite allows you to easily develop your original SoftEther VPN Server management application to control the VPN Server (e.g. creating users, adding Virtual Hubs, disconnecting a specified VPN sessions). - -You can access to the [latest SoftEther VPN Server JSON-RPC Document on GitHub.](https://github.com/SoftEtherVPN/SoftEtherVPN/tree/master/developer_tools/vpnserver-jsonrpc-clients/) - -- Almost all control APIs, which the VPN Server provides, are available as JSON-RPC API. -You can write your own VPN Server management application in your favorite languages (JavaScript, TypeScript, Java, Python, Ruby, C#, ... etc.) -- If you are planning to develop your own VPN cloud service, the JSON-RPC API is the best choice to realize the automated operations for the VPN Server. -- No need to use any specific API client library since all APIs are provided on the JSON-RPC 2.0 Specification. You can use your favorite JSON and HTTPS client library to call any of all APIs in your pure runtime environment. -- Also, the SoftEther VPN Project provides high-quality JSON-RPC client stub libraries which define all of the API client stub codes. These libraries are written in C#, JavaScript and TypeScript. The Node.js Client Library for VPN Server RPC (vpnrpc) package is also available. - - -# TO CIRCUMVENT YOUR GOVERNMENT'S FIREWALL RESTRICTION - -Because SoftEther VPN is overly strong tool to build a VPN tunnel, -some censorship governments want to block your access to the source code -of SoftEther VPN, by abusing their censorship firewalls. - -To circumvent your censor's unjust restriction, -SoftEther VPN Project distributes the up-to-date source-code -on all the following open-source repositories: - - - GitHub - https://github.com/SoftEtherVPN/SoftEtherVPN/ - -``` -$ git clone https://github.com/SoftEtherVPN/SoftEtherVPN.git -``` - - - GitLab (mirrored from GitHub) - https://gitlab.com/SoftEther/SoftEtherVPN/ - -``` -$ git clone https://gitlab.com/SoftEther/SoftEtherVPN.git -``` - -We hope that you can reach one of the above URLs at least! - - -# SOURCE CODE CONTRIBUTION - -Your contribution to SoftEther VPN Project is much appreciated. -Please send patches to us through GitHub. - - -# DEAR SECURITY EXPERTS - -If you find a bug or a security vulnerability please kindly inform us -about the problem immediately so that we can fix the security problem -to protect a lot of users around the world as soon as possible. - -Our e-mail address for security reports is: -**softether-vpn-security at softether.org** - -Please note that the above e-mail address is not a technical support -inquiry address. If you need technical assistance, please visit -https://www.softether.org/ and ask your question on the users forum. +# SoftEther VPN + +||Badges| +|---|---| +|AppVeyor|[![AppVeyor build status](https://ci.appveyor.com/api/projects/status/github/softethervpn/softethervpn?branch=master&svg=true)](https://ci.appveyor.com/project/softethervpn/softethervpn) | +|Travis CI|[![Travis CI build status](https://travis-ci.org/SoftEtherVPN/SoftEtherVPN.svg?branch=master)](https://travis-ci.org/SoftEtherVPN/SoftEtherVPN) | +|GitLab CI|[![GitLab CI build status](https://gitlab.com/SoftEther/SoftEtherVPN/badges/master/pipeline.svg)](https://gitlab.com/SoftEther/SoftEtherVPN/pipelines)| +|Coverity Scan|[![Coverity Scan build status](https://scan.coverity.com/projects/16304/badge.svg)](https://scan.coverity.com/projects/softethervpn-softethervpn)| +|Azure Pipelines|[![Azure Pipelines build status for Nightly](https://dev.azure.com/SoftEther-VPN/SoftEther%20VPN/_apis/build/status/6?api-version=6.0-preview.1)](https://dev.azure.com/SoftEther-VPN/SoftEther%20VPN/_build?definitionId=6)| +|Cirrus CI|[![Cirrus CI build status](https://api.cirrus-ci.com/github/SoftEtherVPN/SoftEtherVPN.svg)](https://cirrus-ci.com/github/SoftEtherVPN/SoftEtherVPN)| + +- [SoftEther VPN](#softether-vpn) +- [BOARD MEMBERS OF THIS REPOSITORY](#board-members-of-this-repository) +- [SOFTETHER VPN ADVANTAGES](#softether-vpn-advantages) +- [Installation](#installation) + * [For Ubuntu](#for-ubuntu) + * [For FreeBSD](#for-freebsd) + * [From binary installers:](#from-binary-installers) + * [Build from Source code](#build-from-source-code) +- [About HTML5-based Modern Admin Console and JSON-RPC API Suite](#about-html5-based-modern-admin-console-and-json-rpc-api-suite) + * [Built-in SoftEther VPN Server HTML5 Ajax-based Web Administration Console](#built-in-softether-vpn-server-html5-ajax-based-web-administration-console) + * [Built-in SoftEther Server VPN JSON-RPC API Suite](#built-in-softether-server-vpn-json-rpc-api-suite) +- [TO CIRCUMVENT YOUR GOVERNMENT'S FIREWALL RESTRICTION](#to-circumvent-your-governments-firewall-restriction) +- [SOURCE CODE CONTRIBUTION](#source-code-contribution) +- [DEAR SECURITY EXPERTS](#dear-security-experts) + +SoftEther VPN (Developer Edition Master Repository) +- An Open-Source Cross-platform Multi-protocol VPN Program +https://www.softether.org/ + + +This repository has experimental codes. Pull requests are welcome. + +Stable Edition is available on +https://github.com/SoftEtherVPN/SoftEtherVPN_Stable +which the non-developer user can stable use. + +Source code packages (.zip and .tar.gz) and binary files of Stable Edition are also available: +https://www.softether-download.com/ + +Copyright (c) all contributors on SoftEther VPN project in GitHub. +Copyright (c) Daiyuu Nobori, SoftEther Project at University of Tsukuba, and SoftEther Corporation. + +--- + +The development of SoftEther VPN was supported by the MITOH Project, +a research and development project by Japanese Government, +subsidized by Ministry of Economy, Trade and Industry of Japan, +administrated by Information Promotion Agency. +https://www.ipa.go.jp/english/humandev/ + +--- + +![https://icons8.com](resources/icons8.png "Icons8") + +[Icons8](https://icons8.com) kindly supported the project by gifting a license which allows to edit and redistribute their icons. + +Please note that you are not allowed to redistribute those icons outside of this repository. + +The developers of SoftEther VPN love Icons8's work and kindly ask the users to support them as much as possible. + +--- + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +SoftEther VPN ("SoftEther" means "Software Ethernet") is one of the +world's most powerful and easy-to-use multi-protocol VPN software. + +SoftEther VPN runs on Windows, Linux, Mac, FreeBSD and Solaris. + +SoftEther VPN supports most of widely-used VPN protocols +including SSL-VPN, OpenVPN, IPsec, L2TP, MS-SSTP, L2TPv3 and EtherIP +by the single SoftEther VPN Server program. + +More details on https://www.softether.org/. + + +# BOARD MEMBERS OF THIS REPOSITORY + + +Daiyuu Nobori (Since Jan 2, 2014) +https://github.com/dnobori + +Moataz Elmasry (Since Nov 6, 2017) +https://github.com/moatazelmasry2 + +Zulyandri Zardi (Since Nov 6, 2017) +https://github.com/zulzardi + +Alex Maslakov (Since Nov 6, 2017) +https://github.com/GildedHonour + +Davide Beatrici (Since Jul 21, 2018) +https://github.com/davidebeatrici + +Ilya Shipitsin (Since Jul 21, 2018) +https://github.com/chipitsine + + +# SOFTETHER VPN ADVANTAGES + + +- Supporting all popular VPN protocols by the single VPN server: + SSL-VPN (HTTPS) + OpenVPN + IPsec + L2TP + MS-SSTP + L2TPv3 + EtherIP +- Free and open-source software. +- Easy to establish both remote-access and site-to-site VPN. +- SSL-VPN Tunneling on HTTPS to pass through NATs and firewalls. +- Revolutionary VPN over ICMP and VPN over DNS features. +- Resistance to highly-restricted firewall. +- Ethernet-bridging (L2) and IP-routing (L3) over VPN. +- Embedded dynamic-DNS and NAT-traversal so that no static nor + fixed IP address is required. +- AES 256-bit and RSA 4096-bit encryptions. +- Sufficient security features such as logging and firewall inner + VPN tunnel. +- User authentication with RADIUS and NT domain controllers. +- User authentication with X.509 client certificate. +- Packet logging. +- 1Gbps-class high-speed throughput performance with low memory and + CPU usage. +- Windows, Linux, Mac, Android, iPhone, iPad and Windows Phone are + supported. +- The OpenVPN clone function supports legacy OpenVPN clients. +- IPv4 / IPv6 dual-stack. +- The VPN server runs on Windows, Linux, FreeBSD, Solaris and Mac OS X. +- Configure All settings on GUI. +- Multi-languages (English, Japanese and Simplified-Chinese). +- No memory leaks. High quality stable codes, intended for long-term runs. + We always verify that there are no memory or resource leaks before + releasing the build. +- More details at https://www.softether.org/. + + +# Installation + +## For Ubuntu + +Launchpad PPA maintained by [Dmitry Verkhoturov](https://github.com/paskal): + +[Daily builds](https://code.launchpad.net/~paskal-07/+archive/ubuntu/softethervpn) (latest released tag) + +[Nightly builds](https://code.launchpad.net/~paskal-07/+archive/ubuntu/softethervpn-nightly) + +## For FreeBSD + +SoftEther VPN in FreeBSD Ports Collection is maintained by +[Koichiro Iwao](https://people.FreeBSD.org/~meta/) ([@metalefty](https://github.com/metalefty)). + +Binary package can be installed by pkg: +``` +pkg install softether5 +``` + +Alternatively, it can be built & installed by ports: +``` +make install -C /usr/ports/security/softether5 +``` + +To run SoftEther VPN Server: +``` +service softether_server start +``` + +To configure SoftEther VPN Server startup on boot: +``` +sysrc softether_server_enable=yes +``` + +Also SoftEther VPN [Stable Edition](https://www.freshports.org/security/softether-devel/) and +[RTM version](https://www.freshports.org/security/softether/) are available on FreeBSD. + +## From binary installers: + +Those can be found under https://www.softether-download.com/ +There you can also find SoftEtherVPN source code in zip and tar formats. + +## Build from Source code + +see [BUILD_UNIX](src/BUILD_UNIX.md) or [BUILD_WINDOWS](src/BUILD_WINDOWS.md) + +There are two flavours of SoftEtherVPN source code: + +1. Unstable. Found under https://github.com/SoftEtherVPN/SoftEtherVPN +2. Stable. Found under https://github.com/SoftEtherVPN/SoftEtherVPN_Stable + + +# About HTML5-based Modern Admin Console and JSON-RPC API Suite + +## Built-in SoftEther VPN Server HTML5 Ajax-based Web Administration Console +We are developing the HTML5 Ajax-based Web Administration Console (currently very limited, under construction) in the embedded HTTPS server on the SoftEther VPN Server. + +Access to the following URL from your favorite web browser. + +``` +https://:/admin/ +``` + +For example if your VPN Server is running as the port 5555 on the host at 192.168.0.1, you can access to the web console by: + +``` +https://192.168.0.1:5555/admin/ +``` + +Note: Your HTML5 development contribution is very appreciated. The current HTML5 pages are written by Daiyuu Nobori (the core developer of SoftEther VPN). He is obviously lack of HTML5 development ability. Please kindly consider to contribute for SoftEther VPN's development on GitHub. Your code will help every people running SoftEther VPN Server. + + +## Built-in SoftEther Server VPN JSON-RPC API Suite +The API Suite allows you to easily develop your original SoftEther VPN Server management application to control the VPN Server (e.g. creating users, adding Virtual Hubs, disconnecting a specified VPN sessions). + +You can access to the [latest SoftEther VPN Server JSON-RPC Document on GitHub.](https://github.com/SoftEtherVPN/SoftEtherVPN/tree/master/developer_tools/vpnserver-jsonrpc-clients/) + +- Almost all control APIs, which the VPN Server provides, are available as JSON-RPC API. +You can write your own VPN Server management application in your favorite languages (JavaScript, TypeScript, Java, Python, Ruby, C#, ... etc.) +- If you are planning to develop your own VPN cloud service, the JSON-RPC API is the best choice to realize the automated operations for the VPN Server. +- No need to use any specific API client library since all APIs are provided on the JSON-RPC 2.0 Specification. You can use your favorite JSON and HTTPS client library to call any of all APIs in your pure runtime environment. +- Also, the SoftEther VPN Project provides high-quality JSON-RPC client stub libraries which define all of the API client stub codes. These libraries are written in C#, JavaScript and TypeScript. The Node.js Client Library for VPN Server RPC (vpnrpc) package is also available. + + +# TO CIRCUMVENT YOUR GOVERNMENT'S FIREWALL RESTRICTION + +Because SoftEther VPN is overly strong tool to build a VPN tunnel, +some censorship governments want to block your access to the source code +of SoftEther VPN, by abusing their censorship firewalls. + +To circumvent your censor's unjust restriction, +SoftEther VPN Project distributes the up-to-date source-code +on all the following open-source repositories: + + - GitHub + https://github.com/SoftEtherVPN/SoftEtherVPN/ + +``` +$ git clone https://github.com/SoftEtherVPN/SoftEtherVPN.git +``` + + - GitLab (mirrored from GitHub) + https://gitlab.com/SoftEther/SoftEtherVPN/ + +``` +$ git clone https://gitlab.com/SoftEther/SoftEtherVPN.git +``` + +We hope that you can reach one of the above URLs at least! + + +# SOURCE CODE CONTRIBUTION + +Your contribution to SoftEther VPN Project is much appreciated. +Please send patches to us through GitHub. + + +# DEAR SECURITY EXPERTS + +If you find a bug or a security vulnerability please kindly inform us +about the problem immediately so that we can fix the security problem +to protect a lot of users around the world as soon as possible. + +Our e-mail address for security reports is: +**softether-vpn-security at softether.org** + +Please note that the above e-mail address is not a technical support +inquiry address. If you need technical assistance, please visit +https://www.softether.org/ and ask your question on the users forum. diff --git a/developer_tools/stbchecker/Program.cs b/developer_tools/stbchecker/Program.cs index e2dde10e..255f5982 100644 --- a/developer_tools/stbchecker/Program.cs +++ b/developer_tools/stbchecker/Program.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.IO; public class Program diff --git a/developer_tools/stbchecker/Stb.cs b/developer_tools/stbchecker/Stb.cs index b11c7a4e..f209a3f1 100644 --- a/developer_tools/stbchecker/Stb.cs +++ b/developer_tools/stbchecker/Stb.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Collections.Generic; using System.IO; diff --git a/developer_tools/stbchecker/Str.cs b/developer_tools/stbchecker/Str.cs index 570d4e3f..73e38920 100644 --- a/developer_tools/stbchecker/Str.cs +++ b/developer_tools/stbchecker/Str.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Text; using System.Collections.Generic; using System.IO; diff --git a/developer_tools/stbchecker/Util.cs b/developer_tools/stbchecker/Util.cs index 243eb7ec..05725aee 100644 --- a/developer_tools/stbchecker/Util.cs +++ b/developer_tools/stbchecker/Util.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Text; using System.Collections; using System.Security.Cryptography; diff --git a/developer_tools/stbchecker/stbchecker.sln b/developer_tools/stbchecker/stbchecker.sln index fca35aa8..1d4f10a9 100644 --- a/developer_tools/stbchecker/stbchecker.sln +++ b/developer_tools/stbchecker/stbchecker.sln @@ -1,4 +1,4 @@ -Microsoft Visual Studio Solution File, Format Version 12.00 +Microsoft Visual Studio Solution File, Format Version 12.00 # Visual Studio 15 VisualStudioVersion = 15.0.28010.2026 MinimumVisualStudioVersion = 10.0.40219.1 diff --git a/developer_tools/vpnserver-jsonrpc-clients/README.html b/developer_tools/vpnserver-jsonrpc-clients/README.html index 637f0c6b..ad5eb877 100644 --- a/developer_tools/vpnserver-jsonrpc-clients/README.html +++ b/developer_tools/vpnserver-jsonrpc-clients/README.html @@ -1,4 +1,4 @@ - + diff --git a/developer_tools/vpnserver-jsonrpc-clients/README.md b/developer_tools/vpnserver-jsonrpc-clients/README.md index 0ba20617..9c8e0aa6 100644 --- a/developer_tools/vpnserver-jsonrpc-clients/README.md +++ b/developer_tools/vpnserver-jsonrpc-clients/README.md @@ -1,4 +1,4 @@ -# SoftEther VPN Server JSON-RPC API Suite Document +# SoftEther VPN Server JSON-RPC API Suite Document This reference describes all JSON-RPC functions available on SoftEther VPN Server. diff --git a/developer_tools/vpnserver-jsonrpc-clients/vpnserver-jsonrpc-client-csharp/rpc-stubs/JsonRpc.cs b/developer_tools/vpnserver-jsonrpc-clients/vpnserver-jsonrpc-client-csharp/rpc-stubs/JsonRpc.cs index 8263a325..a0d63cb9 100644 --- a/developer_tools/vpnserver-jsonrpc-clients/vpnserver-jsonrpc-client-csharp/rpc-stubs/JsonRpc.cs +++ b/developer_tools/vpnserver-jsonrpc-clients/vpnserver-jsonrpc-client-csharp/rpc-stubs/JsonRpc.cs @@ -1,4 +1,4 @@ -// SoftEther VPN Server JSON-RPC Stub code for C# +// SoftEther VPN Server JSON-RPC Stub code for C# // // JsonRpc.cs - JSON-RPC Client Utility Functions // diff --git a/developer_tools/vpnserver-jsonrpc-clients/vpnserver-jsonrpc-client-csharp/rpc-stubs/VPNServerRpc.cs b/developer_tools/vpnserver-jsonrpc-clients/vpnserver-jsonrpc-client-csharp/rpc-stubs/VPNServerRpc.cs index e4a0b895..f66f8681 100644 --- a/developer_tools/vpnserver-jsonrpc-clients/vpnserver-jsonrpc-client-csharp/rpc-stubs/VPNServerRpc.cs +++ b/developer_tools/vpnserver-jsonrpc-clients/vpnserver-jsonrpc-client-csharp/rpc-stubs/VPNServerRpc.cs @@ -1,4 +1,4 @@ -// SoftEther VPN Server JSON-RPC Stub code for C# +// SoftEther VPN Server JSON-RPC Stub code for C# // // VPNServerRpc.cs - SoftEther VPN Server's JSON-RPC Stubs // diff --git a/developer_tools/vpnserver-jsonrpc-clients/vpnserver-jsonrpc-client-csharp/rpc-stubs/VPNServerRpcTypes.cs b/developer_tools/vpnserver-jsonrpc-clients/vpnserver-jsonrpc-client-csharp/rpc-stubs/VPNServerRpcTypes.cs index 27f224cf..10c970b7 100644 --- a/developer_tools/vpnserver-jsonrpc-clients/vpnserver-jsonrpc-client-csharp/rpc-stubs/VPNServerRpcTypes.cs +++ b/developer_tools/vpnserver-jsonrpc-clients/vpnserver-jsonrpc-client-csharp/rpc-stubs/VPNServerRpcTypes.cs @@ -1,4 +1,4 @@ -// SoftEther VPN Server JSON-RPC Stub code for C# +// SoftEther VPN Server JSON-RPC Stub code for C# // // VPNServerRpcTypes.cs - Data Type Definition for SoftEther VPN Server JSON-RPC Stubs // diff --git a/developer_tools/vpnserver-jsonrpc-clients/vpnserver-jsonrpc-client-csharp/sample/Main.cs b/developer_tools/vpnserver-jsonrpc-clients/vpnserver-jsonrpc-client-csharp/sample/Main.cs index 1021e12b..dc4542de 100644 --- a/developer_tools/vpnserver-jsonrpc-clients/vpnserver-jsonrpc-client-csharp/sample/Main.cs +++ b/developer_tools/vpnserver-jsonrpc-clients/vpnserver-jsonrpc-client-csharp/sample/Main.cs @@ -1,4 +1,4 @@ -// SoftEther VPN Server JSON-RPC Stub code for C# +// SoftEther VPN Server JSON-RPC Stub code for C# // // Program.cs - The Main() entry point // diff --git a/developer_tools/vpnserver-jsonrpc-clients/vpnserver-jsonrpc-client-csharp/sample/VpnServerRpcTest.cs b/developer_tools/vpnserver-jsonrpc-clients/vpnserver-jsonrpc-client-csharp/sample/VpnServerRpcTest.cs index d9ab15f3..c44bd51b 100644 --- a/developer_tools/vpnserver-jsonrpc-clients/vpnserver-jsonrpc-client-csharp/sample/VpnServerRpcTest.cs +++ b/developer_tools/vpnserver-jsonrpc-clients/vpnserver-jsonrpc-client-csharp/sample/VpnServerRpcTest.cs @@ -1,4 +1,4 @@ -// SoftEther VPN Server JSON-RPC Stub code for C# +// SoftEther VPN Server JSON-RPC Stub code for C# // // VpnServerRpcTest.cs - Test sample code for SoftEther VPN Server JSON-RPC Stub // diff --git a/developer_tools/vpnserver-jsonrpc-clients/vpnserver-jsonrpc-client-csharp/vpnserver-jsonrpc-client-csharp.csproj b/developer_tools/vpnserver-jsonrpc-clients/vpnserver-jsonrpc-client-csharp/vpnserver-jsonrpc-client-csharp.csproj index 6d97ba0c..64488c72 100644 --- a/developer_tools/vpnserver-jsonrpc-clients/vpnserver-jsonrpc-client-csharp/vpnserver-jsonrpc-client-csharp.csproj +++ b/developer_tools/vpnserver-jsonrpc-clients/vpnserver-jsonrpc-client-csharp/vpnserver-jsonrpc-client-csharp.csproj @@ -1,4 +1,4 @@ - + Exe diff --git a/developer_tools/vpnserver-jsonrpc-clients/vpnserver-jsonrpc-client-csharp/vpnserver-jsonrpc-client-csharp.sln b/developer_tools/vpnserver-jsonrpc-clients/vpnserver-jsonrpc-client-csharp/vpnserver-jsonrpc-client-csharp.sln index 819e7f03..8cef1417 100644 --- a/developer_tools/vpnserver-jsonrpc-clients/vpnserver-jsonrpc-client-csharp/vpnserver-jsonrpc-client-csharp.sln +++ b/developer_tools/vpnserver-jsonrpc-clients/vpnserver-jsonrpc-client-csharp/vpnserver-jsonrpc-client-csharp.sln @@ -1,4 +1,4 @@ - + Microsoft Visual Studio Solution File, Format Version 12.00 # Visual Studio 15 VisualStudioVersion = 15.0.28010.2041 diff --git a/developer_tools/vpnserver-jsonrpc-clients/vpnserver-jsonrpc-client-nodejs-package/src/sample.ts b/developer_tools/vpnserver-jsonrpc-clients/vpnserver-jsonrpc-client-nodejs-package/src/sample.ts index ddb69314..0c57247c 100644 --- a/developer_tools/vpnserver-jsonrpc-clients/vpnserver-jsonrpc-client-nodejs-package/src/sample.ts +++ b/developer_tools/vpnserver-jsonrpc-clients/vpnserver-jsonrpc-client-nodejs-package/src/sample.ts @@ -1,4 +1,4 @@ -// Test sample code for SoftEther VPN Server JSON-RPC Stub +// Test sample code for SoftEther VPN Server JSON-RPC Stub // Runs on both web browsers and Node.js // // sample.ts diff --git a/developer_tools/vpnserver-jsonrpc-clients/vpnserver-jsonrpc-client-nodejs-package/src/vpnrpc.ts b/developer_tools/vpnserver-jsonrpc-clients/vpnserver-jsonrpc-client-nodejs-package/src/vpnrpc.ts index 1774bbd6..f5818187 100644 --- a/developer_tools/vpnserver-jsonrpc-clients/vpnserver-jsonrpc-client-nodejs-package/src/vpnrpc.ts +++ b/developer_tools/vpnserver-jsonrpc-clients/vpnserver-jsonrpc-client-nodejs-package/src/vpnrpc.ts @@ -1,4 +1,4 @@ -// SoftEther VPN Server JSON-RPC Stub code for TypeScript +// SoftEther VPN Server JSON-RPC Stub code for TypeScript // // vpnrpc.ts // Automatically generated at 2019-07-10 14:36:11 by vpnserver-jsonrpc-codegen diff --git a/developer_tools/vpnserver-jsonrpc-clients/vpnserver-jsonrpc-client-typescript/sample.ts b/developer_tools/vpnserver-jsonrpc-clients/vpnserver-jsonrpc-client-typescript/sample.ts index ddb69314..0c57247c 100644 --- a/developer_tools/vpnserver-jsonrpc-clients/vpnserver-jsonrpc-client-typescript/sample.ts +++ b/developer_tools/vpnserver-jsonrpc-clients/vpnserver-jsonrpc-client-typescript/sample.ts @@ -1,4 +1,4 @@ -// Test sample code for SoftEther VPN Server JSON-RPC Stub +// Test sample code for SoftEther VPN Server JSON-RPC Stub // Runs on both web browsers and Node.js // // sample.ts diff --git a/developer_tools/vpnserver-jsonrpc-clients/vpnserver-jsonrpc-client-typescript/vpnrpc.ts b/developer_tools/vpnserver-jsonrpc-clients/vpnserver-jsonrpc-client-typescript/vpnrpc.ts index 1774bbd6..f5818187 100644 --- a/developer_tools/vpnserver-jsonrpc-clients/vpnserver-jsonrpc-client-typescript/vpnrpc.ts +++ b/developer_tools/vpnserver-jsonrpc-clients/vpnserver-jsonrpc-client-typescript/vpnrpc.ts @@ -1,4 +1,4 @@ -// SoftEther VPN Server JSON-RPC Stub code for TypeScript +// SoftEther VPN Server JSON-RPC Stub code for TypeScript // // vpnrpc.ts // Automatically generated at 2019-07-10 14:36:11 by vpnserver-jsonrpc-codegen diff --git a/developer_tools/vpnserver-jsonrpc-codegen/CodeGen/CodeGen.cs b/developer_tools/vpnserver-jsonrpc-codegen/CodeGen/CodeGen.cs index 82aedf17..72057bc6 100644 --- a/developer_tools/vpnserver-jsonrpc-codegen/CodeGen/CodeGen.cs +++ b/developer_tools/vpnserver-jsonrpc-codegen/CodeGen/CodeGen.cs @@ -1,4 +1,4 @@ -using Microsoft.CodeAnalysis; +using Microsoft.CodeAnalysis; using Microsoft.CodeAnalysis.CSharp; using Microsoft.CodeAnalysis.CSharp.Syntax; using System; diff --git a/developer_tools/vpnserver-jsonrpc-codegen/Program.cs b/developer_tools/vpnserver-jsonrpc-codegen/Program.cs index 203860dd..a88b24e3 100644 --- a/developer_tools/vpnserver-jsonrpc-codegen/Program.cs +++ b/developer_tools/vpnserver-jsonrpc-codegen/Program.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.IO; using System.Diagnostics; using Newtonsoft.Json; diff --git a/developer_tools/vpnserver-jsonrpc-codegen/Templates/cs_main.txt b/developer_tools/vpnserver-jsonrpc-codegen/Templates/cs_main.txt index a73d31ac..8afc1688 100644 --- a/developer_tools/vpnserver-jsonrpc-codegen/Templates/cs_main.txt +++ b/developer_tools/vpnserver-jsonrpc-codegen/Templates/cs_main.txt @@ -1,4 +1,4 @@ -// SoftEther VPN Server JSON-RPC Stub code for C# +// SoftEther VPN Server JSON-RPC Stub code for C# // // Program.cs - The Main() entry point // diff --git a/developer_tools/vpnserver-jsonrpc-codegen/Templates/cs_proj.txt b/developer_tools/vpnserver-jsonrpc-codegen/Templates/cs_proj.txt index 6d97ba0c..64488c72 100644 --- a/developer_tools/vpnserver-jsonrpc-codegen/Templates/cs_proj.txt +++ b/developer_tools/vpnserver-jsonrpc-codegen/Templates/cs_proj.txt @@ -1,4 +1,4 @@ - + Exe diff --git a/developer_tools/vpnserver-jsonrpc-codegen/Templates/doc.txt b/developer_tools/vpnserver-jsonrpc-codegen/Templates/doc.txt index aed5c743..c778ea16 100644 --- a/developer_tools/vpnserver-jsonrpc-codegen/Templates/doc.txt +++ b/developer_tools/vpnserver-jsonrpc-codegen/Templates/doc.txt @@ -1,4 +1,4 @@ -# SoftEther VPN Server JSON-RPC API Suite Document +# SoftEther VPN Server JSON-RPC API Suite Document This reference describes all JSON-RPC functions available on SoftEther VPN Server. diff --git a/developer_tools/vpnserver-jsonrpc-codegen/Templates/md_html.html b/developer_tools/vpnserver-jsonrpc-codegen/Templates/md_html.html index ac6d7185..0f7d920c 100644 --- a/developer_tools/vpnserver-jsonrpc-codegen/Templates/md_html.html +++ b/developer_tools/vpnserver-jsonrpc-codegen/Templates/md_html.html @@ -1,4 +1,4 @@ - + diff --git a/developer_tools/vpnserver-jsonrpc-codegen/Templates/ts_rpc.txt b/developer_tools/vpnserver-jsonrpc-codegen/Templates/ts_rpc.txt index 572cadb2..22642043 100644 --- a/developer_tools/vpnserver-jsonrpc-codegen/Templates/ts_rpc.txt +++ b/developer_tools/vpnserver-jsonrpc-codegen/Templates/ts_rpc.txt @@ -1,4 +1,4 @@ -// SoftEther VPN Server JSON-RPC Stub code for TypeScript +// SoftEther VPN Server JSON-RPC Stub code for TypeScript // // vpnrpc.ts // Automatically generated at __TIMESTAMP__ by vpnserver-jsonrpc-codegen diff --git a/developer_tools/vpnserver-jsonrpc-codegen/Templates/ts_test.txt b/developer_tools/vpnserver-jsonrpc-codegen/Templates/ts_test.txt index a265ab04..16956dfa 100644 --- a/developer_tools/vpnserver-jsonrpc-codegen/Templates/ts_test.txt +++ b/developer_tools/vpnserver-jsonrpc-codegen/Templates/ts_test.txt @@ -1,4 +1,4 @@ -// Test sample code for SoftEther VPN Server JSON-RPC Stub +// Test sample code for SoftEther VPN Server JSON-RPC Stub // Runs on both web browsers and Node.js // // sample.ts diff --git a/developer_tools/vpnserver-jsonrpc-codegen/VpnServerRpc/JsonRpc.cs b/developer_tools/vpnserver-jsonrpc-codegen/VpnServerRpc/JsonRpc.cs index d7ee166b..d6e23c26 100644 --- a/developer_tools/vpnserver-jsonrpc-codegen/VpnServerRpc/JsonRpc.cs +++ b/developer_tools/vpnserver-jsonrpc-codegen/VpnServerRpc/JsonRpc.cs @@ -1,4 +1,4 @@ -// SoftEther VPN Server JSON-RPC Stub code for C# +// SoftEther VPN Server JSON-RPC Stub code for C# // // JsonRpc.cs - JSON-RPC Client Utility Functions // diff --git a/developer_tools/vpnserver-jsonrpc-codegen/VpnServerRpc/VPNServerRpc.cs b/developer_tools/vpnserver-jsonrpc-codegen/VpnServerRpc/VPNServerRpc.cs index 63da0e6d..2d89b044 100644 --- a/developer_tools/vpnserver-jsonrpc-codegen/VpnServerRpc/VPNServerRpc.cs +++ b/developer_tools/vpnserver-jsonrpc-codegen/VpnServerRpc/VPNServerRpc.cs @@ -1,4 +1,4 @@ -// SoftEther VPN Server JSON-RPC Stub code for C# +// SoftEther VPN Server JSON-RPC Stub code for C# // // VPNServerRpc.cs - SoftEther VPN Server's JSON-RPC Stubs // diff --git a/developer_tools/vpnserver-jsonrpc-codegen/VpnServerRpc/VPNServerRpcTypes.cs b/developer_tools/vpnserver-jsonrpc-codegen/VpnServerRpc/VPNServerRpcTypes.cs index 08db87e4..0eef4fa8 100644 --- a/developer_tools/vpnserver-jsonrpc-codegen/VpnServerRpc/VPNServerRpcTypes.cs +++ b/developer_tools/vpnserver-jsonrpc-codegen/VpnServerRpc/VPNServerRpcTypes.cs @@ -1,4 +1,4 @@ -// SoftEther VPN Server JSON-RPC Stub code for C# +// SoftEther VPN Server JSON-RPC Stub code for C# // // VPNServerRpcTypes.cs - Data Type Definition for SoftEther VPN Server JSON-RPC Stubs // diff --git a/developer_tools/vpnserver-jsonrpc-codegen/VpnServerRpcTest/VpnServerRpcTest.cs b/developer_tools/vpnserver-jsonrpc-codegen/VpnServerRpcTest/VpnServerRpcTest.cs index b407750f..5a4eb0b2 100644 --- a/developer_tools/vpnserver-jsonrpc-codegen/VpnServerRpcTest/VpnServerRpcTest.cs +++ b/developer_tools/vpnserver-jsonrpc-codegen/VpnServerRpcTest/VpnServerRpcTest.cs @@ -1,4 +1,4 @@ -// SoftEther VPN Server JSON-RPC Stub code for C# +// SoftEther VPN Server JSON-RPC Stub code for C# // // VpnServerRpcTest.cs - Test sample code for SoftEther VPN Server JSON-RPC Stub // diff --git a/developer_tools/vpnserver-jsonrpc-codegen/vpnserver-jsonrpc-codegen.csproj b/developer_tools/vpnserver-jsonrpc-codegen/vpnserver-jsonrpc-codegen.csproj index 8dd4a3cb..eeecd387 100644 --- a/developer_tools/vpnserver-jsonrpc-codegen/vpnserver-jsonrpc-codegen.csproj +++ b/developer_tools/vpnserver-jsonrpc-codegen/vpnserver-jsonrpc-codegen.csproj @@ -1,4 +1,4 @@ - + Exe diff --git a/developer_tools/vpnserver-jsonrpc-codegen/vpnserver-jsonrpc-codegen.sln b/developer_tools/vpnserver-jsonrpc-codegen/vpnserver-jsonrpc-codegen.sln index fbd0f7ec..e05e6b7c 100644 --- a/developer_tools/vpnserver-jsonrpc-codegen/vpnserver-jsonrpc-codegen.sln +++ b/developer_tools/vpnserver-jsonrpc-codegen/vpnserver-jsonrpc-codegen.sln @@ -1,4 +1,4 @@ - + Microsoft Visual Studio Solution File, Format Version 12.00 # Visual Studio 15 VisualStudioVersion = 15.0.28010.2041 diff --git a/src/BUILD_UNIX.md b/src/BUILD_UNIX.md index d0a032e7..63f61ca1 100644 --- a/src/BUILD_UNIX.md +++ b/src/BUILD_UNIX.md @@ -1,236 +1,236 @@ -This document describes how to build SoftEtherVPN for UNIX based Operating systems - -- [Requirements](#requirements) - * [Install requirements on Centos/RedHat](#install-requirements-on-centosredhat) - * [Install Requirements on Debian/Ubuntu](#install-requirements-on-debianubuntu) - * [Install Requirements on macOS](#install-requirements-on-macos) -- [Build from source code and install](#build-from-source-code-and-install) -- [Additional Build Options](#additional-build-options) -- [How to Run SoftEther](#how-to-run-softether) - * [Start/Stop SoftEther VPN Server](#startstop-softether-vpn-server) - * [Start/Stop SoftEther VPN Bridge](#startstop-softether-vpn-bridge) - * [Start/Stop SoftEther VPN Client](#startstop-softether-vpn-client) -- [About HTML5-based Modern Admin Console and JSON-RPC API Suite](#about-html5-based-modern-admin-console-and-json-rpc-api-suite) - * [Built-in SoftEther VPN Server HTML5 Ajax-based Web Administration Console](#built-in-softether-vpn-server-html5-ajax-based-web-administration-console) - * [Built-in SoftEther Server VPN JSON-RPC API Suite](#built-in-softether-server-vpn-json-rpc-api-suite) -- [Using SoftEther without installation.](#using-softether-without-installation) - -# Requirements - -You need to install the following software to build SoftEther VPN for UNIX. - -- [CMake](https://cmake.org) -- C compiler (GCC, Clang, etc) -- C Library (BSD libc, GNU libc, musl libc, etc) -- POSIX threads library (pthread) -- OpenSSL or LibreSSL (crypto, ssl) -- make (GNU make, BSD make, etc) -- libiconv -- readline -- ncurses - -## Install requirements on Centos/RedHat - -```bash -sudo yum -y groupinstall "Development Tools" -sudo yum -y install cmake ncurses-devel openssl-devel readline-devel zlib-devel -``` - -## Install requirements on Debian/Ubuntu -```bash -sudo apt -y install cmake gcc g++ libncurses5-dev libreadline-dev libssl-dev make zlib1g-dev -``` - -## Install requirements on macOS -```bash -/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)" -brew install cmake openssl readline -``` - -# Build from source code and install - -To build the programs from the source code, run the following commands: - -```bash -git clone https://github.com/SoftEtherVPN/SoftEtherVPN.git -cd SoftEtherVPN -git submodule init && git submodule update -./configure -make -C build -make -C build install -``` - -This will compile and install SoftEther VPN Server, Bridge and Client binaries under your executable path. - -If any error occurs, please check the above requirements. - -# Build on musl-based linux - -To build the programs from the source code when using musl as libc, run the following commands: - -```bash -export USE_MUSL=YES -git clone https://github.com/SoftEtherVPN/SoftEtherVPN.git -cd SoftEtherVPN -git submodule init && git submodule update -./configure -make -C build -make -C build install -``` - -Building without USE_MUSL environment variable set compiles, but produced executables exhibit bad run-time behaviour. - -# Additional Build Options - -There are some additional build options useful if you're a distro package maintainer and creating a package of SoftEther VPN. It is recommended that you only specify these options when you understand what happens. - -## Specify log, config, PID directories - -By default, SoftEther VPN writes out all files such as logs, config files, PID files under the same directory as `vpnserver`, `vpnbridge`, `vpnclient` executables. This behaviour is suitable when [using SoftEther without installation](#using-softether-without-installation) however not appropriate using with installation. -Usually PID files are to put in `/var/run` or `/run`. Logs are `/var/log`. Other variable state information files including config files are `/var/lib` or `/var/db`. - -These directories can be changed at compile-time by specifying via CMake variables. -* `SE_PIDDIR` - PID directory -* `SE_LOGDIR` - root log directory -* `SE_DBDIR` - config files and variable state directory - -To specify directories, perform `./configure` like below. - -```bash -CMAKE_FLAGS="-DSE_PIDDIR=/run/softether -DSE_LOGDIR=/var/log/softether -DSE_DBDIR=/var/lib/softether" ./configure -``` - -Please note that these directories are not created automatically after installation. Make sure to create these directories before starting SoftEther VPN Server, Bridge or Client. - -## Build without [cpu_features](https://github.com/google/cpu_features) - -SoftEther VPN uses cpu_features library to retrieve CPU features such as available processor instructions. However, cpu_features is not available on some architectures. Whether to build with cpu_features is auto detected but autodetection is not so smart. - -If you want to build without cpu_features explicitly, perform `./configure` like below. - -```bash -CMAKE_FLAGS="-DSKIP_CPU_FEATURES" ./configure -``` - -# How to Run SoftEther - -## Start/Stop SoftEther VPN Server - -To start the SoftEther VPN Server background service, run the following: - -```bash -vpnserver start -``` - -To stop the service, run the following: - -```bash -vpnserver stop -``` - -To configure the running SoftEther VPN Server service, -you can use SoftEther VPN Command Line Management Utility as following: - -```bash -vpncmd -``` - -Or you can also use VPN Server Manager GUI Tool on other Windows PC to -connect to the VPN Server remotely. You can download the GUI Tool -from https://www.softether-download.com/. - - -## Start/Stop SoftEther VPN Bridge - -To start the SoftEther VPN Bridge background service, run the following: - -```bash -vpnbridge start -``` - -To stop the service, run the following: - -```bash -vpnbridge stop -``` - -To configure the running SoftEther VPN Bridge service, -you can use SoftEther VPN Command Line Management Utility as following: - -```bash -vpncmd -``` - -Or you can also use VPN Server Manager GUI Tool on other Windows PC to -connect to the VPN Bridge remotely. You can download the GUI Tool -from https://www.softether-download.com/. - - -## Start/Stop SoftEther VPN Client - -To start the SoftEther VPN Client background service, run the following: - -```bash -vpnclient start -``` - -To stop the service, run the following: - -```bash -vpnclient stop -``` - -To configure the running SoftEther VPN Client service, -you can use SoftEther VPN Command Line Management Utility as following: - -```bash -vpncmd -``` - -Or you can also use VPN Client Manager GUI Tool on other Windows PC to -connect to the VPN Client remotely. You can download the GUI Tool -from https://www.softether-download.com/. - - -# About HTML5-based Modern Admin Console and JSON-RPC API Suite - -## Built-in SoftEther VPN Server HTML5 Ajax-based Web Administration Console -We are developing the HTML5 Ajax-based Web Administration Console (currently very limited, under construction) in the embedded HTTPS server on the SoftEther VPN Server. - -Access to the following URL from your favorite web browser. - -``` -https://:/admin/ -``` - -For example if your VPN Server is running as the port 5555 on the host at 192.168.0.1, you can access to the web console by: - -``` -https://192.168.0.1:5555/admin/ -``` - -Note: Your HTML5 development contribution is very appreciated. The current HTML5 pages are written by Daiyuu Nobori (the core developer of SoftEther VPN). He is obviously lack of HTML5 development ability. Please kindly consider to contribute for SoftEther VPN's development on GitHub. Your code will help every people running SoftEther VPN Server. - - -## Built-in SoftEther Server VPN JSON-RPC API Suite -The API Suite allows you to easily develop your original SoftEther VPN Server management application to control the VPN Server (e.g. creating users, adding Virtual Hubs, disconnecting a specified VPN sessions). - -You can access to the [latest SoftEther VPN Server JSON-RPC Document on GitHub.](https://github.com/SoftEtherVPN/SoftEtherVPN/tree/master/developer_tools/vpnserver-jsonrpc-clients/) - -- Almost all control APIs, which the VPN Server provides, are available as JSON-RPC API. -You can write your own VPN Server management application in your favorite languages (JavaScript, TypeScript, Java, Python, Ruby, C#, ... etc.) -- If you are planning to develop your own VPN cloud service, the JSON-RPC API is the best choice to realize the automated operations for the VPN Server. -- No need to use any specific API client library since all APIs are provided on the JSON-RPC 2.0 Specification. You can use your favorite JSON and HTTPS client library to call any of all APIs in your pure runtime environment. -- Also, the SoftEther VPN Project provides high-quality JSON-RPC client stub libraries which define all of the API client stub codes. These libraries are written in C#, JavaScript and TypeScript. The Node.js Client Library for VPN Server RPC (vpnrpc) package is also available. - - -# Using SoftEther without installation - -You can use any SoftEtherVPN component (server, client, bridge) without installing it, if you wish so. - -In this case please do not run the `make install` command after compiling the source code, and head directly to the **bin/** directory. There you will find the generated binaries for SoftEtherVPN and those could be used without installing SoftEtherVPN. - -************************************ -Thank You Using SoftEther VPN ! -By SoftEther VPN Open-Source Project -https://www.softether.org/ +This document describes how to build SoftEtherVPN for UNIX based Operating systems + +- [Requirements](#requirements) + * [Install requirements on Centos/RedHat](#install-requirements-on-centosredhat) + * [Install Requirements on Debian/Ubuntu](#install-requirements-on-debianubuntu) + * [Install Requirements on macOS](#install-requirements-on-macos) +- [Build from source code and install](#build-from-source-code-and-install) +- [Additional Build Options](#additional-build-options) +- [How to Run SoftEther](#how-to-run-softether) + * [Start/Stop SoftEther VPN Server](#startstop-softether-vpn-server) + * [Start/Stop SoftEther VPN Bridge](#startstop-softether-vpn-bridge) + * [Start/Stop SoftEther VPN Client](#startstop-softether-vpn-client) +- [About HTML5-based Modern Admin Console and JSON-RPC API Suite](#about-html5-based-modern-admin-console-and-json-rpc-api-suite) + * [Built-in SoftEther VPN Server HTML5 Ajax-based Web Administration Console](#built-in-softether-vpn-server-html5-ajax-based-web-administration-console) + * [Built-in SoftEther Server VPN JSON-RPC API Suite](#built-in-softether-server-vpn-json-rpc-api-suite) +- [Using SoftEther without installation.](#using-softether-without-installation) + +# Requirements + +You need to install the following software to build SoftEther VPN for UNIX. + +- [CMake](https://cmake.org) +- C compiler (GCC, Clang, etc) +- C Library (BSD libc, GNU libc, musl libc, etc) +- POSIX threads library (pthread) +- OpenSSL or LibreSSL (crypto, ssl) +- make (GNU make, BSD make, etc) +- libiconv +- readline +- ncurses + +## Install requirements on Centos/RedHat + +```bash +sudo yum -y groupinstall "Development Tools" +sudo yum -y install cmake ncurses-devel openssl-devel readline-devel zlib-devel +``` + +## Install requirements on Debian/Ubuntu +```bash +sudo apt -y install cmake gcc g++ libncurses5-dev libreadline-dev libssl-dev make zlib1g-dev +``` + +## Install requirements on macOS +```bash +/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)" +brew install cmake openssl readline +``` + +# Build from source code and install + +To build the programs from the source code, run the following commands: + +```bash +git clone https://github.com/SoftEtherVPN/SoftEtherVPN.git +cd SoftEtherVPN +git submodule init && git submodule update +./configure +make -C build +make -C build install +``` + +This will compile and install SoftEther VPN Server, Bridge and Client binaries under your executable path. + +If any error occurs, please check the above requirements. + +# Build on musl-based linux + +To build the programs from the source code when using musl as libc, run the following commands: + +```bash +export USE_MUSL=YES +git clone https://github.com/SoftEtherVPN/SoftEtherVPN.git +cd SoftEtherVPN +git submodule init && git submodule update +./configure +make -C build +make -C build install +``` + +Building without USE_MUSL environment variable set compiles, but produced executables exhibit bad run-time behaviour. + +# Additional Build Options + +There are some additional build options useful if you're a distro package maintainer and creating a package of SoftEther VPN. It is recommended that you only specify these options when you understand what happens. + +## Specify log, config, PID directories + +By default, SoftEther VPN writes out all files such as logs, config files, PID files under the same directory as `vpnserver`, `vpnbridge`, `vpnclient` executables. This behaviour is suitable when [using SoftEther without installation](#using-softether-without-installation) however not appropriate using with installation. +Usually PID files are to put in `/var/run` or `/run`. Logs are `/var/log`. Other variable state information files including config files are `/var/lib` or `/var/db`. + +These directories can be changed at compile-time by specifying via CMake variables. +* `SE_PIDDIR` - PID directory +* `SE_LOGDIR` - root log directory +* `SE_DBDIR` - config files and variable state directory + +To specify directories, perform `./configure` like below. + +```bash +CMAKE_FLAGS="-DSE_PIDDIR=/run/softether -DSE_LOGDIR=/var/log/softether -DSE_DBDIR=/var/lib/softether" ./configure +``` + +Please note that these directories are not created automatically after installation. Make sure to create these directories before starting SoftEther VPN Server, Bridge or Client. + +## Build without [cpu_features](https://github.com/google/cpu_features) + +SoftEther VPN uses cpu_features library to retrieve CPU features such as available processor instructions. However, cpu_features is not available on some architectures. Whether to build with cpu_features is auto detected but autodetection is not so smart. + +If you want to build without cpu_features explicitly, perform `./configure` like below. + +```bash +CMAKE_FLAGS="-DSKIP_CPU_FEATURES" ./configure +``` + +# How to Run SoftEther + +## Start/Stop SoftEther VPN Server + +To start the SoftEther VPN Server background service, run the following: + +```bash +vpnserver start +``` + +To stop the service, run the following: + +```bash +vpnserver stop +``` + +To configure the running SoftEther VPN Server service, +you can use SoftEther VPN Command Line Management Utility as following: + +```bash +vpncmd +``` + +Or you can also use VPN Server Manager GUI Tool on other Windows PC to +connect to the VPN Server remotely. You can download the GUI Tool +from https://www.softether-download.com/. + + +## Start/Stop SoftEther VPN Bridge + +To start the SoftEther VPN Bridge background service, run the following: + +```bash +vpnbridge start +``` + +To stop the service, run the following: + +```bash +vpnbridge stop +``` + +To configure the running SoftEther VPN Bridge service, +you can use SoftEther VPN Command Line Management Utility as following: + +```bash +vpncmd +``` + +Or you can also use VPN Server Manager GUI Tool on other Windows PC to +connect to the VPN Bridge remotely. You can download the GUI Tool +from https://www.softether-download.com/. + + +## Start/Stop SoftEther VPN Client + +To start the SoftEther VPN Client background service, run the following: + +```bash +vpnclient start +``` + +To stop the service, run the following: + +```bash +vpnclient stop +``` + +To configure the running SoftEther VPN Client service, +you can use SoftEther VPN Command Line Management Utility as following: + +```bash +vpncmd +``` + +Or you can also use VPN Client Manager GUI Tool on other Windows PC to +connect to the VPN Client remotely. You can download the GUI Tool +from https://www.softether-download.com/. + + +# About HTML5-based Modern Admin Console and JSON-RPC API Suite + +## Built-in SoftEther VPN Server HTML5 Ajax-based Web Administration Console +We are developing the HTML5 Ajax-based Web Administration Console (currently very limited, under construction) in the embedded HTTPS server on the SoftEther VPN Server. + +Access to the following URL from your favorite web browser. + +``` +https://:/admin/ +``` + +For example if your VPN Server is running as the port 5555 on the host at 192.168.0.1, you can access to the web console by: + +``` +https://192.168.0.1:5555/admin/ +``` + +Note: Your HTML5 development contribution is very appreciated. The current HTML5 pages are written by Daiyuu Nobori (the core developer of SoftEther VPN). He is obviously lack of HTML5 development ability. Please kindly consider to contribute for SoftEther VPN's development on GitHub. Your code will help every people running SoftEther VPN Server. + + +## Built-in SoftEther Server VPN JSON-RPC API Suite +The API Suite allows you to easily develop your original SoftEther VPN Server management application to control the VPN Server (e.g. creating users, adding Virtual Hubs, disconnecting a specified VPN sessions). + +You can access to the [latest SoftEther VPN Server JSON-RPC Document on GitHub.](https://github.com/SoftEtherVPN/SoftEtherVPN/tree/master/developer_tools/vpnserver-jsonrpc-clients/) + +- Almost all control APIs, which the VPN Server provides, are available as JSON-RPC API. +You can write your own VPN Server management application in your favorite languages (JavaScript, TypeScript, Java, Python, Ruby, C#, ... etc.) +- If you are planning to develop your own VPN cloud service, the JSON-RPC API is the best choice to realize the automated operations for the VPN Server. +- No need to use any specific API client library since all APIs are provided on the JSON-RPC 2.0 Specification. You can use your favorite JSON and HTTPS client library to call any of all APIs in your pure runtime environment. +- Also, the SoftEther VPN Project provides high-quality JSON-RPC client stub libraries which define all of the API client stub codes. These libraries are written in C#, JavaScript and TypeScript. The Node.js Client Library for VPN Server RPC (vpnrpc) package is also available. + + +# Using SoftEther without installation + +You can use any SoftEtherVPN component (server, client, bridge) without installing it, if you wish so. + +In this case please do not run the `make install` command after compiling the source code, and head directly to the **bin/** directory. There you will find the generated binaries for SoftEtherVPN and those could be used without installing SoftEtherVPN. + +************************************ +Thank You Using SoftEther VPN ! +By SoftEther VPN Open-Source Project +https://www.softether.org/ diff --git a/src/BuildFiles/Manifests/x64_admin.manifest b/src/BuildFiles/Manifests/x64_admin.manifest index 58caa97d..acce442e 100644 --- a/src/BuildFiles/Manifests/x64_admin.manifest +++ b/src/BuildFiles/Manifests/x64_admin.manifest @@ -1,29 +1,29 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - true - - - + + + + + + + + + + + + + + + + + + + + + + + + + + true + + + diff --git a/src/BuildFiles/Manifests/x64_user.manifest b/src/BuildFiles/Manifests/x64_user.manifest index 2c19b412..f8dbd852 100644 --- a/src/BuildFiles/Manifests/x64_user.manifest +++ b/src/BuildFiles/Manifests/x64_user.manifest @@ -1,29 +1,29 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - true - - - + + + + + + + + + + + + + + + + + + + + + + + + + + true + + + diff --git a/src/BuildFiles/Manifests/x86_admin.manifest b/src/BuildFiles/Manifests/x86_admin.manifest index 7feaa3c2..42aa90da 100644 --- a/src/BuildFiles/Manifests/x86_admin.manifest +++ b/src/BuildFiles/Manifests/x86_admin.manifest @@ -1,29 +1,29 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - true - - - + + + + + + + + + + + + + + + + + + + + + + + + + + true + + + diff --git a/src/BuildFiles/Manifests/x86_user.manifest b/src/BuildFiles/Manifests/x86_user.manifest index 61ee3699..6e12693d 100644 --- a/src/BuildFiles/Manifests/x86_user.manifest +++ b/src/BuildFiles/Manifests/x86_user.manifest @@ -1,29 +1,29 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - true - - - + + + + + + + + + + + + + + + + + + + + + + + + + + true + + + diff --git a/src/BuildFiles/OcxCabInf/vpnweb.inf b/src/BuildFiles/OcxCabInf/vpnweb.inf index 9a7c46dd..67afa956 100644 --- a/src/BuildFiles/OcxCabInf/vpnweb.inf +++ b/src/BuildFiles/OcxCabInf/vpnweb.inf @@ -1,18 +1,18 @@ -; VPN Client Web Installer Inf File -; -; Copyright (c) SoftEther Project at University of Tsukuba, Japan. -; All Rights Reserved. - -[version] -signature="$CHICAGO$" -AdvancedINF=2.0 - -[Add.Code] -vpnweb.ocx=vpnweb.ocx - -[vpnweb.ocx] -file-win32-x86=thiscab -clsid={64F1A16B-C3EE-484C-B551-35338A9BB6D2} -FileVersion=$CAB_VERSION$ -RegisterServer=yes - +; VPN Client Web Installer Inf File +; +; Copyright (c) SoftEther Project at University of Tsukuba, Japan. +; All Rights Reserved. + +[version] +signature="$CHICAGO$" +AdvancedINF=2.0 + +[Add.Code] +vpnweb.ocx=vpnweb.ocx + +[vpnweb.ocx] +file-win32-x86=thiscab +clsid={64F1A16B-C3EE-484C-B551-35338A9BB6D2} +FileVersion=$CAB_VERSION$ +RegisterServer=yes + diff --git a/src/BuildFiles/Utility/cabarc_redist.txt b/src/BuildFiles/Utility/cabarc_redist.txt index 9241359f..23689916 100644 --- a/src/BuildFiles/Utility/cabarc_redist.txt +++ b/src/BuildFiles/Utility/cabarc_redist.txt @@ -1,74 +1,74 @@ - -MICROSOFT CABINET SOFTWARE DEVELOPMENT KIT - -END-USER LICENSE AGREEMENT FOR MICROSOFT SOFTWARE - -IMPORTANT-READ CAREFULLY: This Microsoft End-User License Agreement ("EULA") is a legal agreement between you (either an individual or a single entity) and Microsoft Corporation for the Microsoft software product identified above, which includes computer software and associated media and printed materials, and may include "online" or electronic documentation ("SOFTWARE PRODUCT" or "SOFTWARE"). By installing, copying, or otherwise using the SOFTWARE PRODUCT, you agree to be bound by the terms of this EULA. If you do not agree to the terms of this EULA; promptly return the unused SOFTWARE PRODUCT to the place from which you obtained it for a full refund; or if you received the SOFTWARE PRODUCT as part of a subscription or other service from Microsoft, you may cancel the subscription and receive a pro rata portion of the subscription price. - -SOFTWARE PRODUCT LICENSE - -The SOFTWARE PRODUCT is protected by copyright laws and international copyright treaties, as well as other intellectual property laws and treaties. The SOFTWARE PRODUCT is licensed, not sold. - -1. GRANT OF LICENSE. This EULA grants you the following limited, non-exclusive rights: - -Software Product. You may install and use the SOFTWARE PRODUCT on a single computer solely for the purpose of developing applications which create, extract or manipulate files that are compatible with Microsoft CAB file format ("Application"). You may not use the SOFTWARE PRODUCT to create files which are not compatible with the Microsoft CAB file format. - -Microsoft Developer Network Subscriber. If you acquired the SOFTWARE PRODUCT through a subscription to the Microsoft Developer Network, and you are either an individual developer or an individual designated within a single entity, you are granted the following additional rights with respect to the SOFTWARE PRODUCT: (a) you may make and use copies of the SOFTWARE PRODUCT on up to ten (10) separate computers, provided that you are the only individual using the SOFTWARE PRODUCT on each such computer, and (b) if you are a single entity, you may designate one individual within your organization to have the right to use the SOFTWARE PRODUCT in the manner described herein. - -Sample Code. You may modify the sample source code located in the SOFTWARE PRODUCT's "SAMPLES" directory ("Sample Code") to design, develop, and test your Application. You may also reproduce and distribute the Sample Code in object code form along with any modifications you make to the Sample Code, provided that the modifications do not create files which are not compatible with Microsoft CAB file format and that you comply with the Distribution Requirements described below. For purposes of this section, "modifications" shall mean changes to the functionality of the Sample Code. - -Redistributable Code. Portions of the SOFTWARE PRODUCT in the "BIN" and "LIB" directories are designated as "Redistributable Code." You may reproduce and distribute the Redistributable Code provided you comply with the Distribution Requirements described below. - -Distribution Requirements. You may copy and redistribute the Sample Code and/or Redistributable Code (collectively "REDISTRIBUTABLE COMPONENTS") as described above, provided that (a) you distribute the REDISTRIBUTABLE COMPONENTS only in conjunction with, and as a part of, your Application; (b) your Application adds significant and primary functionality to the REDISTRIBUTABLE COMPONENTS; (c) the Application does not allow the use of the REDISTRIBUTABLE COMPONENTS for files which are not compatible with the Microsoft CAB files; (d) the executable code in the BIN directory may be redistributed unmodified in conjunction with your Application provided that your Application adds significant and primary functionality to the REDISTRIBUTABLE COMPONENTS; (e) the library code in the LIB directory may only be redistributed when linked into your Application; (f) you do not use Microsoft's name, logo, or trademarks to market your Application; (g) you include a valid copyright notice on your Application; and (h) you agree to indemnify, hold harmless, and defend Microsoft from and against any claims or lawsuits, including attorneys' fees, that arise or result from the use or distribution of your Application. Contact Microsoft for the applicable royalties due and other licensing terms for all other uses and/or distribution of the REDISTRIBUTABLE COMPONENTS. - -Microsoft reserves all rights not expressly granted to you. - -2. COPYRIGHT. All rights, title, and copyrights in and to the SOFTWARE PRODUCT (including, but not limited to, any images, photographs, animations, video, audio, music, text, and "applets" incorporated into the SOFTWARE PRODUCT) and any copies of the SOFTWARE PRODUCT are owned by Microsoft or its suppliers. The SOFTWARE PRODUCT is protected by copyright laws and international treaty provisions. Therefore, you must treat the SOFTWARE PRODUCT like any other copyrighted material, except that you may either (a) make one copy of the SOFTWARE PRODUCT solely for backup or archival purposes, or (b) install the SOFTWARE PRODUCT on a single computer, provided you keep the original solely for backup or archival purposes. You may not copy the printed materials accompanying the SOFTWARE PRODUCT. - -3. PRERELEASE CODE. The SOFTWARE PRODUCT may contain PRERELEASE CODE that is not at the level of performance and compatibility of the final, generally available, product offering. These portions of the SOFTWARE PRODUCT may not operate correctly and may be substantially modified prior to first commercial shipment. Microsoft is not obligated to make this or any later version of the SOFTWARE PRODUCT commercially available. Microsoft grants you the right to distribute test versions of your Application created using the PRERELEASE CODE provided you comply with the Distribution Requirements described in Section 1 and the following additional provisions: (a) you must mark the test version of your Application "BETA" and (b) you are solely responsible for updating your customers with versions of your Application that operate satisfactorily with the final commercial release of the PRERELEASE CODE. - -4. DESCRIPTION OF OTHER RIGHTS AND LIMITATIONS. - -Limitations on Reverse-Engineering, Decompilation, and Disassembly. You may not reverse- engineer, decompile, or disassemble the SOFTWARE PRODUCT, except and only to the extent that such activity is expressly permitted by applicable law notwithstanding this limitation. - -Rental. You may not rent or lease the SOFTWARE PRODUCT. - -Software Transfer. You may permanently transfer all of your rights under this EULA, provided you retain no copies, you transfer all of the SOFTWARE PRODUCT (including all component parts, the media and printed materials, any upgrades, this EULA, and, if applicable, the Certificate of Authenticity), and the recipient agrees to the terms of this EULA. If the SOFTWARE PRODUCT is an upgrade, any transfer must include all prior versions of the SOFTWARE PRODUCT. - -Termination. Without prejudice to any other rights, Microsoft may terminate this EULA if you fail to comply with the terms and conditions of this EULA. In such event, you must destroy all copies of the SOFTWARE PRODUCT and all of its component parts. - -5. EXPORT RESTRICTIONS. You agree that neither you nor your customers intend to or will, directly or indirectly, export or transmit (a) the SOFTWARE PRODUCT or related documentation and technical data, or (b) your Application as described in Section 1 of this EULA (or any part thereof), or process, or service that is the direct product of the SOFTWARE PRODUCT to any country to which such export or transmission is restricted by any applicable U.S. regulation or statute, without the prior written consent, if required, of the Bureau of Export Administration of the U.S. Department of Commerce, or such other governmental entity as may have jurisdiction over such export or transmission. - -6. U.S. GOVERNMENT RESTRICTED RIGHTS. The SOFTWARE PRODUCT and documentation are provided with RESTRICTED RIGHTS. Use, duplication, or disclosure by the Government is subject to restrictions as set forth in subparagraph (c)(1)(ii) of The Rights in Technical Data and Computer Software clause at DFARS 252.227-7013 or subparagraphs (c)(1) and (2) of the Commercial Computer Software - Restricted Rights at 48 CFR 52.227-19, as applicable. Manufacturer is Microsoft Corporation/One Microsoft Way/Redmond, WA 98052-6399. - -MISCELLANEOUS - -If you acquired this product in the United States, this EULA is governed by the laws of the State of Washington. - -If you acquired this product in Canada, this EULA is governed by the laws of the Province of Ontario, Canada. Each of the parties hereto irrevocably attorns to the jurisdiction of the courts of the Province of Ontario and further agrees to commence any litigation that may arise hereunder in the courts located in the Judicial District of York, Province of Ontario. - -If this product was acquired outside the United States, local law may apply. - -Should you have any questions concerning this EULA, or if you desire to contact Microsoft for any reason, please contact the Microsoft subsidiary serving your country, or write: Microsoft Customer Sales and Service/One Microsoft Way/Redmond, WA 98052-6399. - -NO WARRANTIES. To the maximum extent permitted by applicable law, Microsoft expressly disclaims any warranty for the SOFTWARE PRODUCT. The SOFTWARE PRODUCT and any related documentation are provided "as is" without warranty of any kind, either express or implied, including, without limitation, the implied warranties of merchantability or fitness for a particular purpose. The entire risk arising out of use or performance of the SOFTWARE PRODUCT remains with you. - -LIMITATION OF LIABILITY. Microsoft's entire liability and your exclusive remedy under this EULA shall not exceed five dollars (US$5.00). - -NO LIABILITY FOR CONSEQUENTIAL DAMAGES. To the maximum extent permitted by applicable law, in no event shall Microsoft or its suppliers be liable for any damages whatsoever (including, without limitation, damages for loss of business profit, business interruption, loss of business information, or any other pecuniary loss) arising out of the use of, or inability to use, this Microsoft product, even if Microsoft has been advised of the possibility of such damages. Because some states/jurisdictions do not allow the exclusion or limitation of liability for consequential or incidental damages, the above limitation may not apply to you. - - -Si vous avez acquis votre produit Microsoft au CANADA, la garantie limite suivante vous concerne: - -GARANTIE LIMITE - -EXCLUSION DE GARANTIES. Microsoft renonce entirement toute garantie pour le LOGICIEL. Le LOGICIEL et toute autre documentation s'y rapportant sont fournis comme tels sans aucune garantie quelle qu'elle soit, expresse ou implicite, y compris, mais ne se limitant pas aux garanties implicites de la qualit marchande ou un usage particulier. Le risque total dcoulant de l'utilisation ou de la performance du LOGICIEL est entre vos mains. - -RESPONSABILIT LIMITE. La seule obligation de Microsoft et votre recours exclusif concernant ce contrat n'excderont pas cinq dollars (US$5.00). - -ABSENCE DE RESPONSABILIT POUR LES DOMMAGES INDIRECTS. Microsoft ou ses -fournisseurs ne pourront tre tenus responsables en aucune circonstance de tout dommage quel qu'il soit (y compris mais non de faon limitative les dommages directs ou indirects causs par la perte de bnfices commerciaux, l'interruption des affaires, la perte d'information commerciale ou toute autre perte pcuniaire) rsultant de l'utilisation ou de l'impossibilit d'utilisation de ce produit, et ce, mme si la socit Microsoft a t avise de l'ventualit de tels dommages. Certains tats/juridictions ne permettent pas l'exclusion ou la limitation de responsabilit relative aux dommages indirects ou conscutifs, et la limitation ci-dessus peut ne pas s'appliquer votre gard. -La prsente Convention est rgie par les lois de la province d'Ontario, Canada. Chacune des parties la Convention reconnat irrvocablement la comptence des tribunaux de la province d'Ontario et consent instituer tout litige qui pourrait dcouler de la Convention auprs des tribunaux situs dans le district judiciaire de York, province d'Ontario. -Au cas o vous auriez des questions concernant cette licence ou que vous dsiriez vous mettre en rapport avec Microsoft pour quelque raison que ce soit, veuillez contacter la succursale Microsoft desservant votre pays, dont l'adresse est fournie dans ce produit, ou crire : Microsoft Customer Sales and Service, One Microsoft Way, Redmond, Washington 98052-6399. - + +MICROSOFT CABINET SOFTWARE DEVELOPMENT KIT + +END-USER LICENSE AGREEMENT FOR MICROSOFT SOFTWARE + +IMPORTANT-READ CAREFULLY: This Microsoft End-User License Agreement ("EULA") is a legal agreement between you (either an individual or a single entity) and Microsoft Corporation for the Microsoft software product identified above, which includes computer software and associated media and printed materials, and may include "online" or electronic documentation ("SOFTWARE PRODUCT" or "SOFTWARE"). By installing, copying, or otherwise using the SOFTWARE PRODUCT, you agree to be bound by the terms of this EULA. If you do not agree to the terms of this EULA; promptly return the unused SOFTWARE PRODUCT to the place from which you obtained it for a full refund; or if you received the SOFTWARE PRODUCT as part of a subscription or other service from Microsoft, you may cancel the subscription and receive a pro rata portion of the subscription price. + +SOFTWARE PRODUCT LICENSE + +The SOFTWARE PRODUCT is protected by copyright laws and international copyright treaties, as well as other intellectual property laws and treaties. The SOFTWARE PRODUCT is licensed, not sold. + +1. GRANT OF LICENSE. This EULA grants you the following limited, non-exclusive rights: + +Software Product. You may install and use the SOFTWARE PRODUCT on a single computer solely for the purpose of developing applications which create, extract or manipulate files that are compatible with Microsoft CAB file format ("Application"). You may not use the SOFTWARE PRODUCT to create files which are not compatible with the Microsoft CAB file format. + +Microsoft Developer Network Subscriber. If you acquired the SOFTWARE PRODUCT through a subscription to the Microsoft Developer Network, and you are either an individual developer or an individual designated within a single entity, you are granted the following additional rights with respect to the SOFTWARE PRODUCT: (a) you may make and use copies of the SOFTWARE PRODUCT on up to ten (10) separate computers, provided that you are the only individual using the SOFTWARE PRODUCT on each such computer, and (b) if you are a single entity, you may designate one individual within your organization to have the right to use the SOFTWARE PRODUCT in the manner described herein. + +Sample Code. You may modify the sample source code located in the SOFTWARE PRODUCT's "SAMPLES" directory ("Sample Code") to design, develop, and test your Application. You may also reproduce and distribute the Sample Code in object code form along with any modifications you make to the Sample Code, provided that the modifications do not create files which are not compatible with Microsoft CAB file format and that you comply with the Distribution Requirements described below. For purposes of this section, "modifications" shall mean changes to the functionality of the Sample Code. + +Redistributable Code. Portions of the SOFTWARE PRODUCT in the "BIN" and "LIB" directories are designated as "Redistributable Code." You may reproduce and distribute the Redistributable Code provided you comply with the Distribution Requirements described below. + +Distribution Requirements. You may copy and redistribute the Sample Code and/or Redistributable Code (collectively "REDISTRIBUTABLE COMPONENTS") as described above, provided that (a) you distribute the REDISTRIBUTABLE COMPONENTS only in conjunction with, and as a part of, your Application; (b) your Application adds significant and primary functionality to the REDISTRIBUTABLE COMPONENTS; (c) the Application does not allow the use of the REDISTRIBUTABLE COMPONENTS for files which are not compatible with the Microsoft CAB files; (d) the executable code in the BIN directory may be redistributed unmodified in conjunction with your Application provided that your Application adds significant and primary functionality to the REDISTRIBUTABLE COMPONENTS; (e) the library code in the LIB directory may only be redistributed when linked into your Application; (f) you do not use Microsoft's name, logo, or trademarks to market your Application; (g) you include a valid copyright notice on your Application; and (h) you agree to indemnify, hold harmless, and defend Microsoft from and against any claims or lawsuits, including attorneys' fees, that arise or result from the use or distribution of your Application. Contact Microsoft for the applicable royalties due and other licensing terms for all other uses and/or distribution of the REDISTRIBUTABLE COMPONENTS. + +Microsoft reserves all rights not expressly granted to you. + +2. COPYRIGHT. All rights, title, and copyrights in and to the SOFTWARE PRODUCT (including, but not limited to, any images, photographs, animations, video, audio, music, text, and "applets" incorporated into the SOFTWARE PRODUCT) and any copies of the SOFTWARE PRODUCT are owned by Microsoft or its suppliers. The SOFTWARE PRODUCT is protected by copyright laws and international treaty provisions. Therefore, you must treat the SOFTWARE PRODUCT like any other copyrighted material, except that you may either (a) make one copy of the SOFTWARE PRODUCT solely for backup or archival purposes, or (b) install the SOFTWARE PRODUCT on a single computer, provided you keep the original solely for backup or archival purposes. You may not copy the printed materials accompanying the SOFTWARE PRODUCT. + +3. PRERELEASE CODE. The SOFTWARE PRODUCT may contain PRERELEASE CODE that is not at the level of performance and compatibility of the final, generally available, product offering. These portions of the SOFTWARE PRODUCT may not operate correctly and may be substantially modified prior to first commercial shipment. Microsoft is not obligated to make this or any later version of the SOFTWARE PRODUCT commercially available. Microsoft grants you the right to distribute test versions of your Application created using the PRERELEASE CODE provided you comply with the Distribution Requirements described in Section 1 and the following additional provisions: (a) you must mark the test version of your Application "BETA" and (b) you are solely responsible for updating your customers with versions of your Application that operate satisfactorily with the final commercial release of the PRERELEASE CODE. + +4. DESCRIPTION OF OTHER RIGHTS AND LIMITATIONS. + +Limitations on Reverse-Engineering, Decompilation, and Disassembly. You may not reverse- engineer, decompile, or disassemble the SOFTWARE PRODUCT, except and only to the extent that such activity is expressly permitted by applicable law notwithstanding this limitation. + +Rental. You may not rent or lease the SOFTWARE PRODUCT. + +Software Transfer. You may permanently transfer all of your rights under this EULA, provided you retain no copies, you transfer all of the SOFTWARE PRODUCT (including all component parts, the media and printed materials, any upgrades, this EULA, and, if applicable, the Certificate of Authenticity), and the recipient agrees to the terms of this EULA. If the SOFTWARE PRODUCT is an upgrade, any transfer must include all prior versions of the SOFTWARE PRODUCT. + +Termination. Without prejudice to any other rights, Microsoft may terminate this EULA if you fail to comply with the terms and conditions of this EULA. In such event, you must destroy all copies of the SOFTWARE PRODUCT and all of its component parts. + +5. EXPORT RESTRICTIONS. You agree that neither you nor your customers intend to or will, directly or indirectly, export or transmit (a) the SOFTWARE PRODUCT or related documentation and technical data, or (b) your Application as described in Section 1 of this EULA (or any part thereof), or process, or service that is the direct product of the SOFTWARE PRODUCT to any country to which such export or transmission is restricted by any applicable U.S. regulation or statute, without the prior written consent, if required, of the Bureau of Export Administration of the U.S. Department of Commerce, or such other governmental entity as may have jurisdiction over such export or transmission. + +6. U.S. GOVERNMENT RESTRICTED RIGHTS. The SOFTWARE PRODUCT and documentation are provided with RESTRICTED RIGHTS. Use, duplication, or disclosure by the Government is subject to restrictions as set forth in subparagraph (c)(1)(ii) of The Rights in Technical Data and Computer Software clause at DFARS 252.227-7013 or subparagraphs (c)(1) and (2) of the Commercial Computer Software - Restricted Rights at 48 CFR 52.227-19, as applicable. Manufacturer is Microsoft Corporation/One Microsoft Way/Redmond, WA 98052-6399. + +MISCELLANEOUS + +If you acquired this product in the United States, this EULA is governed by the laws of the State of Washington. + +If you acquired this product in Canada, this EULA is governed by the laws of the Province of Ontario, Canada. Each of the parties hereto irrevocably attorns to the jurisdiction of the courts of the Province of Ontario and further agrees to commence any litigation that may arise hereunder in the courts located in the Judicial District of York, Province of Ontario. + +If this product was acquired outside the United States, local law may apply. + +Should you have any questions concerning this EULA, or if you desire to contact Microsoft for any reason, please contact the Microsoft subsidiary serving your country, or write: Microsoft Customer Sales and Service/One Microsoft Way/Redmond, WA 98052-6399. + +NO WARRANTIES. To the maximum extent permitted by applicable law, Microsoft expressly disclaims any warranty for the SOFTWARE PRODUCT. The SOFTWARE PRODUCT and any related documentation are provided "as is" without warranty of any kind, either express or implied, including, without limitation, the implied warranties of merchantability or fitness for a particular purpose. The entire risk arising out of use or performance of the SOFTWARE PRODUCT remains with you. + +LIMITATION OF LIABILITY. Microsoft's entire liability and your exclusive remedy under this EULA shall not exceed five dollars (US$5.00). + +NO LIABILITY FOR CONSEQUENTIAL DAMAGES. To the maximum extent permitted by applicable law, in no event shall Microsoft or its suppliers be liable for any damages whatsoever (including, without limitation, damages for loss of business profit, business interruption, loss of business information, or any other pecuniary loss) arising out of the use of, or inability to use, this Microsoft product, even if Microsoft has been advised of the possibility of such damages. Because some states/jurisdictions do not allow the exclusion or limitation of liability for consequential or incidental damages, the above limitation may not apply to you. + + +Si vous avez acquis votre produit Microsoft au CANADA, la garantie limite suivante vous concerne: + +GARANTIE LIMITE + +EXCLUSION DE GARANTIES. Microsoft renonce entirement toute garantie pour le LOGICIEL. Le LOGICIEL et toute autre documentation s'y rapportant sont fournis comme tels sans aucune garantie quelle qu'elle soit, expresse ou implicite, y compris, mais ne se limitant pas aux garanties implicites de la qualit marchande ou un usage particulier. Le risque total dcoulant de l'utilisation ou de la performance du LOGICIEL est entre vos mains. + +RESPONSABILIT LIMITE. La seule obligation de Microsoft et votre recours exclusif concernant ce contrat n'excderont pas cinq dollars (US$5.00). + +ABSENCE DE RESPONSABILIT POUR LES DOMMAGES INDIRECTS. Microsoft ou ses +fournisseurs ne pourront tre tenus responsables en aucune circonstance de tout dommage quel qu'il soit (y compris mais non de faon limitative les dommages directs ou indirects causs par la perte de bnfices commerciaux, l'interruption des affaires, la perte d'information commerciale ou toute autre perte pcuniaire) rsultant de l'utilisation ou de l'impossibilit d'utilisation de ce produit, et ce, mme si la socit Microsoft a t avise de l'ventualit de tels dommages. Certains tats/juridictions ne permettent pas l'exclusion ou la limitation de responsabilit relative aux dommages indirects ou conscutifs, et la limitation ci-dessus peut ne pas s'appliquer votre gard. +La prsente Convention est rgie par les lois de la province d'Ontario, Canada. Chacune des parties la Convention reconnat irrvocablement la comptence des tribunaux de la province d'Ontario et consent instituer tout litige qui pourrait dcouler de la Convention auprs des tribunaux situs dans le district judiciaire de York, province d'Ontario. +Au cas o vous auriez des questions concernant cette licence ou que vous dsiriez vous mettre en rapport avec Microsoft pour quelque raison que ce soit, veuillez contacter la succursale Microsoft desservant votre pays, dont l'adresse est fournie dans ce produit, ou crire : Microsoft Customer Sales and Service, One Microsoft Way, Redmond, Washington 98052-6399. + 3/27/97 10:39 AM 970860004 \ No newline at end of file diff --git a/src/BuildFiles/VerScript/ver.rc b/src/BuildFiles/VerScript/ver.rc index 0b36b425..d7988797 100644 --- a/src/BuildFiles/VerScript/ver.rc +++ b/src/BuildFiles/VerScript/ver.rc @@ -1,30 +1,30 @@ -#pragma code_page(932) - -1 VERSIONINFO - FILEVERSION ${PROJECT_VERSION_MAJOR},${PROJECT_VERSION_MINOR},0,${PROJECT_VERSION_PATCH} - PRODUCTVERSION ${PROJECT_VERSION_MAJOR},${PROJECT_VERSION_MINOR},0,${PROJECT_VERSION_PATCH} - FILEFLAGSMASK 0x17L - FILEOS 0x4L - FILETYPE 0x1L - FILESUBTYPE 0x0L -BEGIN - BLOCK "StringFileInfo" - BEGIN - BLOCK "041104b0" - BEGIN - VALUE "CompanyName", "SoftEther VPN Project at University of Tsukuba, Japan." - VALUE "FileDescription", "${PROJECT_NAME} ${COMPONENT_NAME} (Developer Edition)" - VALUE "FileVersion", "${PROJECT_VERSION_MAJOR}, ${PROJECT_VERSION_MINOR}, 0, ${PROJECT_VERSION_PATCH}" - VALUE "InternalName", "${COMPONENT_INTERNAL_NAME}" - VALUE "LegalCopyright", "Copyright (c) 2012-${DATE_YEAR} all contributors on SoftEther VPN project in GitHub. Copyright (C) 2004-${DATE_YEAR} Daiyuu Nobori, SoftEther Project at University of Tsukuba, and SoftEther Corporation. All Rights Reserved." - VALUE "LegalTrademarks", "SoftEther(R) is a registered trademark of SoftEther Corporation in Japan, United States and People's Republic of China. SoftEther Corporation is a company founded at University of Tsukuba, Japan." - VALUE "OriginalFilename", "${COMPONENT_FILE_NAME}" - VALUE "ProductName", "${PROJECT_NAME} ${COMPONENT_NAME}" - VALUE "ProductVersion", "${PROJECT_VERSION_MAJOR}, ${PROJECT_VERSION_MINOR}, 0, ${PROJECT_VERSION_PATCH}" - END - END - BLOCK "VarFileInfo" - BEGIN - VALUE "Translation", 0x411, 1200 - END -END +#pragma code_page(932) + +1 VERSIONINFO + FILEVERSION ${PROJECT_VERSION_MAJOR},${PROJECT_VERSION_MINOR},0,${PROJECT_VERSION_PATCH} + PRODUCTVERSION ${PROJECT_VERSION_MAJOR},${PROJECT_VERSION_MINOR},0,${PROJECT_VERSION_PATCH} + FILEFLAGSMASK 0x17L + FILEOS 0x4L + FILETYPE 0x1L + FILESUBTYPE 0x0L +BEGIN + BLOCK "StringFileInfo" + BEGIN + BLOCK "041104b0" + BEGIN + VALUE "CompanyName", "SoftEther VPN Project at University of Tsukuba, Japan." + VALUE "FileDescription", "${PROJECT_NAME} ${COMPONENT_NAME} (Developer Edition)" + VALUE "FileVersion", "${PROJECT_VERSION_MAJOR}, ${PROJECT_VERSION_MINOR}, 0, ${PROJECT_VERSION_PATCH}" + VALUE "InternalName", "${COMPONENT_INTERNAL_NAME}" + VALUE "LegalCopyright", "Copyright (c) 2012-${DATE_YEAR} all contributors on SoftEther VPN project in GitHub. Copyright (C) 2004-${DATE_YEAR} Daiyuu Nobori, SoftEther Project at University of Tsukuba, and SoftEther Corporation. All Rights Reserved." + VALUE "LegalTrademarks", "SoftEther(R) is a registered trademark of SoftEther Corporation in Japan, United States and People's Republic of China. SoftEther Corporation is a company founded at University of Tsukuba, Japan." + VALUE "OriginalFilename", "${COMPONENT_FILE_NAME}" + VALUE "ProductName", "${PROJECT_NAME} ${COMPONENT_NAME}" + VALUE "ProductVersion", "${PROJECT_VERSION_MAJOR}, ${PROJECT_VERSION_MINOR}, 0, ${PROJECT_VERSION_PATCH}" + END + END + BLOCK "VarFileInfo" + BEGIN + VALUE "Translation", 0x411, 1200 + END +END diff --git a/src/BuildFiles/VerScript/ver_vg.rc b/src/BuildFiles/VerScript/ver_vg.rc index b185c5d5..fa96181e 100644 --- a/src/BuildFiles/VerScript/ver_vg.rc +++ b/src/BuildFiles/VerScript/ver_vg.rc @@ -1,30 +1,30 @@ -#pragma code_page(932) - -1 VERSIONINFO - FILEVERSION $VER_MAJOR$,$VER_MINOR$,0,$VER_BUILD$ - PRODUCTVERSION $VER_MAJOR$,$VER_MINOR$,0,$VER_BUILD$ - FILEFLAGSMASK 0x17L - FILEOS 0x4L - FILETYPE 0x1L - FILESUBTYPE 0x0L -BEGIN - BLOCK "StringFileInfo" - BEGIN - BLOCK "041104b0" - BEGIN - VALUE "CompanyName", "University of Tsukuba" - VALUE "FileDescription", "VPN Gate Plug-in DLL for SoftEther VPN" - VALUE "FileVersion", "$VER_MAJOR$, $VER_MINOR$, 0, $VER_BUILD$" - VALUE "InternalName", "$INTERNALNAME$" - VALUE "LegalCopyright", "Copyright (C) 2012-$YEAR$ VPN Gate Project at University of Tsukuba. All Rights Reserved." - VALUE "LegalTrademarks", "" - VALUE "OriginalFilename", "$FILENAME$" - VALUE "ProductName", "VPN Gate Software" - VALUE "ProductVersion", "$VER_MAJOR$, $VER_MINOR$, 0, $VER_BUILD$" - END - END - BLOCK "VarFileInfo" - BEGIN - VALUE "Translation", 0x411, 1200 - END -END +#pragma code_page(932) + +1 VERSIONINFO + FILEVERSION $VER_MAJOR$,$VER_MINOR$,0,$VER_BUILD$ + PRODUCTVERSION $VER_MAJOR$,$VER_MINOR$,0,$VER_BUILD$ + FILEFLAGSMASK 0x17L + FILEOS 0x4L + FILETYPE 0x1L + FILESUBTYPE 0x0L +BEGIN + BLOCK "StringFileInfo" + BEGIN + BLOCK "041104b0" + BEGIN + VALUE "CompanyName", "University of Tsukuba" + VALUE "FileDescription", "VPN Gate Plug-in DLL for SoftEther VPN" + VALUE "FileVersion", "$VER_MAJOR$, $VER_MINOR$, 0, $VER_BUILD$" + VALUE "InternalName", "$INTERNALNAME$" + VALUE "LegalCopyright", "Copyright (C) 2012-$YEAR$ VPN Gate Project at University of Tsukuba. All Rights Reserved." + VALUE "LegalTrademarks", "" + VALUE "OriginalFilename", "$FILENAME$" + VALUE "ProductName", "VPN Gate Software" + VALUE "ProductVersion", "$VER_MAJOR$, $VER_MINOR$, 0, $VER_BUILD$" + END + END + BLOCK "VarFileInfo" + BEGIN + VALUE "Translation", 0x411, 1200 + END +END diff --git a/src/Cedar/Account.c b/src/Cedar/Account.c index 31b5397a..c38ed1c4 100644 --- a/src/Cedar/Account.c +++ b/src/Cedar/Account.c @@ -1,1357 +1,1357 @@ -// SoftEther VPN Source Code - Developer Edition Master Branch -// Cedar Communication Module - - -// Account.c -// Account Manager - -#include "CedarPch.h" - -// Policy items -POLICY_ITEM policy_item[] = -{ -// ID, Value, Omittable, Min, Max, Default, Unit name -// Ver 2.0 - {0, false, false, 0, 0, 0, NULL}, // Access - {1, false, false, 0, 0, 0, NULL}, // DHCPFilter - {2, false, false, 0, 0, 0, NULL}, // DHCPNoServer - {3, false, false, 0, 0, 0, NULL}, // DHCPForce - {4, false, false, 0, 0, 0, NULL}, // NoBridge - {5, false, false, 0, 0, 0, NULL}, // NoRouting - {6, false, false, 0, 0, 0, NULL}, // CheckMac - {7, false, false, 0, 0, 0, NULL}, // CheckIP - {8, false, false, 0, 0, 0, NULL}, // ArpDhcpOnly - {9, false, false, 0, 0, 0, NULL}, // PrivacyFilter - {10, false, false, 0, 0, 0, NULL}, // NoServer - {11, false, false, 0, 0, 0, NULL}, // NoBroadcastLimiter - {12, false, false, 0, 0, 0, NULL}, // MonitorPort - {13, true, false, 1, 32, 32, "POL_INT_COUNT"}, // MaxConnection - {14, true, false, 5, 60, 20, "POL_INT_SEC"}, // TimeOut - {15, true, true, 1, 65535, 0, "POL_INT_COUNT"}, // MaxMac - {16, true, true, 1, 65535, 0, "POL_INT_COUNT"}, // MaxIP - {17, true, true, 1, 4294967295UL, 0, "POL_INT_BPS"}, // MaxUpload - {18, true, true, 1, 4294967295UL, 0, "POL_INT_BPS"}, // MaxDownload - {19, false, false, 0, 0, 0, NULL}, // FixPassword - {20, true, true, 1, 65535, 0, "POL_INT_COUNT"}, // MultiLogins - {21, false, false, 0, 0, 0, NULL}, // NoQoS -// Ver 3.0 - {22, false, false, 0, 0, 0, NULL}, // RSandRAFilter - {23, false, false, 0, 0, 0, NULL}, // RAFilter - {24, false, false, 0, 0, 0, NULL}, // DHCPv6Filter - {25, false, false, 0, 0, 0, NULL}, // DHCPv6NoServer - {26, false, false, 0, 0, 0, NULL}, // NoRoutingV6 - {27, false, false, 0, 0, 0, NULL}, // CheckIPv6 - {28, false, false, 0, 0, 0, NULL}, // NoServerV6 - {29, true, true, 1, 65535, 0, "POL_INT_COUNT"}, // MaxIPv6 - {30, false, false, 0, 0, 0, NULL}, // NoSavePassword - {31, true, true, 1, 4294967295UL, 0, "POL_INT_SEC"}, // AutoDisconnect - {32, false, false, 0, 0, 0, NULL}, // FilterIPv4 - {33, false, false, 0, 0, 0, NULL}, // FilterIPv6 - {34, false, false, 0, 0, 0, NULL}, // FilterNonIP - {35, false, false, 0, 0, 0, NULL}, // NoIPv6DefaultRouterInRA - {36, false, false, 0, 0, 0, NULL}, // NoIPv6DefaultRouterInRAWhenIPv6 - {37, true, true, 1, 4095, 0, "POL_INT_VLAN"}, // VLanId -}; - -// Format policy value -void FormatPolicyValue(wchar_t *str, UINT size, UINT id, UINT value) -{ - POLICY_ITEM *p; - // Validate arguments - if (str == NULL) - { - return; - } - - p = GetPolicyItem(id); - - if (p->TypeInt == false) - { - // bool type - if (value == 0) - { - UniStrCpy(str, size, L"No"); - } - else - { - UniStrCpy(str, size, L"Yes"); - } - } - else - { - // int type - if (value == 0 && p->AllowZero) - { - UniStrCpy(str, size, _UU("CMD_NO_SETTINGS")); - } - else - { - UniFormat(str, size, _UU(p->FormatStr), value); - } - } -} - -// Get description string for range of the policy value -void GetPolicyValueRangeStr(wchar_t *str, UINT size, UINT id) -{ - POLICY_ITEM *p; - // Validate arguments - if (str == NULL) - { - return; - } - - p = GetPolicyItem(id); - - if (p->TypeInt == false) - { - // bool type - UniStrCpy(str, size, _UU("CMD_PolicyList_Range_Bool")); - } - else - { - wchar_t *tag; - wchar_t tmp1[256], tmp2[256]; - - // int type - if (p->AllowZero) - { - tag = _UU("CMD_PolicyList_Range_Int_2"); - } - else - { - tag = _UU("CMD_PolicyList_Range_Int_1"); - } - - UniFormat(tmp1, sizeof(tmp1), _UU(p->FormatStr), p->MinValue); - UniFormat(tmp2, sizeof(tmp2), _UU(p->FormatStr), p->MaxValue); - - UniFormat(str, size, tag, tmp1, tmp2); - } -} - -// Get a policy item for id -POLICY_ITEM *GetPolicyItem(UINT id) -{ - return &policy_item[id]; -} - -// Does cascade connection support the specified policy? -bool PolicyIsSupportedForCascade(UINT i) -{ - if (i == 0 || i == 4 || i == 5 || i == 12 || i == 13 || - i == 14 || i == 19 || i == 20 || i == 21 || i == 26 || i == 30 || i == 31 || i == 36) - { - // These items are not supported by cascade connection. - return false; - } - - return true; -} - -// Get policy name -char *PolicyIdToStr(UINT i) -{ - switch (i) - { - // Ver 2.0 - case 0: return "Access"; - case 1: return "DHCPFilter"; - case 2: return "DHCPNoServer"; - case 3: return "DHCPForce"; - case 4: return "NoBridge"; - case 5: return "NoRouting"; - case 6: return "CheckMac"; - case 7: return "CheckIP"; - case 8: return "ArpDhcpOnly"; - case 9: return "PrivacyFilter"; - case 10: return "NoServer"; - case 11: return "NoBroadcastLimiter"; - case 12: return "MonitorPort"; - case 13: return "MaxConnection"; - case 14: return "TimeOut"; - case 15: return "MaxMac"; - case 16: return "MaxIP"; - case 17: return "MaxUpload"; - case 18: return "MaxDownload"; - case 19: return "FixPassword"; - case 20: return "MultiLogins"; - case 21: return "NoQoS"; - - // Ver 3.0 - case 22: return "RSandRAFilter"; - case 23: return "RAFilter"; - case 24: return "DHCPv6Filter"; - case 25: return "DHCPv6NoServer"; - case 26: return "NoRoutingV6"; - case 27: return "CheckIPv6"; - case 28: return "NoServerV6"; - case 29: return "MaxIPv6"; - case 30: return "NoSavePassword"; - case 31: return "AutoDisconnect"; - case 32: return "FilterIPv4"; - case 33: return "FilterIPv6"; - case 34: return "FilterNonIP"; - case 35: return "NoIPv6DefaultRouterInRA"; - case 36: return "NoIPv6DefaultRouterInRAWhenIPv6"; - case 37: return "VLanId"; - } - - return NULL; -} - -// Get policy id for name -UINT PolicyStrToId(char *name) -{ - UINT i; - // Validate arguments - if (name == NULL) - { - return INFINITE; - } - - for (i = 0;i < NUM_POLICY_ITEM;i++) - { - if (StartWith(PolicyIdToStr(i), name)) - { - return i; - } - } - - return INFINITE; -} - -// Get number of policies -UINT PolicyNum() -{ - return NUM_POLICY_ITEM; -} - -// Check the name is valid for account name -bool IsUserName(char *name) -{ - UINT i, len; - char tmp[MAX_SIZE]; - // Validate arguments - if (name == NULL) - { - return false; - } - - StrCpy(tmp, sizeof(tmp), name); - name = tmp; - - Trim(name); - - len = StrLen(name); - if (len == 0) - { - return false; - } - - if (StrCmpi(name, "*") == 0) - { - return true; - } - - for (i = 0; i < len; i++) - { - if (IsSafeChar(name[i]) == false && name[i] != '@') - { - return false; - } - } - - if (StrCmpi(name, LINK_USER_NAME) == 0) - { - return false; - } - - if (StartWith(name, L3_USERNAME)) - { - return false; - } - - if (StrCmpi(name, LINK_USER_NAME_PRINT) == 0) - { - return false; - } - - if (StrCmpi(name, SNAT_USER_NAME) == 0) - { - return false; - } - - if (StrCmpi(name, SNAT_USER_NAME_PRINT) == 0) - { - return false; - } - - if (StrCmpi(name, BRIDGE_USER_NAME) == 0) - { - return false; - } - - if (StrCmpi(name, BRIDGE_USER_NAME_PRINT) == 0) - { - return false; - } - - if (StrCmpi(name, ADMINISTRATOR_USERNAME) == 0) - { - return false; - } - - return true; -} - -// Get policy title -wchar_t *GetPolicyTitle(UINT id) -{ - char tmp[MAX_SIZE]; - Format(tmp, sizeof(tmp), "POL_%u", id); - - return _UU(tmp); -} - -// Get policy description -wchar_t *GetPolicyDescription(UINT id) -{ - char tmp[MAX_SIZE]; - Format(tmp, sizeof(tmp), "POL_EX_%u", id); - - return _UU(tmp); -} - -// Clone the policy value -POLICY *ClonePolicy(POLICY *policy) -{ - POLICY *ret; - // Validate arguments - if (policy == NULL) - { - return NULL; - } - - ret = ZeroMalloc(sizeof(POLICY)); - Copy(ret, policy, sizeof(POLICY)); - - return ret; -} - -// Overwrite policy value (If old version data overwrites new version, leave new version value as it is.) -void OverwritePolicy(POLICY **target, POLICY *p) -{ - // Validate arguments - if (target == NULL) - { - return; - } - - if (p == NULL) - { - // Erase policy - if (*target != NULL) - { - Free(*target); - *target = NULL; - } - } - else - { - if (p->Ver3) - { - // Ver 3 - if (*target != NULL) - { - Free(*target); - *target = NULL; - } - - *target = ClonePolicy(p); - } - else - { - // Ver 2 - if (*target == NULL) - { - *target = ClonePolicy(p); - } - else - { - Copy(*target, p, NUM_POLICY_ITEM_FOR_VER2 * sizeof(UINT)); - } - } - } -} - -// Set user policy -void SetUserPolicy(USER *u, POLICY *policy) -{ - // Validate arguments - if (u == NULL) - { - return; - } - - Lock(u->lock); - { - OverwritePolicy(&u->Policy, policy); - } - Unlock(u->lock); -} - -// Set group policy -void SetGroupPolicy(USERGROUP *g, POLICY *policy) -{ - // Validate arguments - if (g == NULL) - { - return; - } - - Lock(g->lock); - { - OverwritePolicy(&g->Policy, policy); - } - Unlock(g->lock); -} - -// Get group policy -POLICY *GetGroupPolicy(USERGROUP *g) -{ - POLICY *ret; - // Validate arguments - if (g == NULL) - { - return NULL; - } - - Lock(g->lock); - { - if (g->Policy == NULL) - { - ret = NULL; - } - else - { - ret = ClonePolicy(g->Policy); - } - } - Unlock(g->lock); - - return ret; -} - -// Get default policy template -POLICY *GetDefaultPolicy() -{ - static POLICY def_policy = - { - true, - false, - false, - false, - false, - false, - false, - false, - false, - false, - false, - false, - false, - 32, - 20, - 0, - 0, - 0, - 0, - false, - 0, - false, - false, - false, - false, - false, - false, - false, - false, - 0, - false, - 0, - false, - false, - false, - false, - false, - }; - - return &def_policy; -} - -// Create a NT authentication data -void *NewNTAuthData(wchar_t *username) -{ - AUTHNT *a; - // Validate arguments - a = ZeroMallocEx(sizeof(AUTHNT), true); - a->NtUsername = CopyUniStr(username); - - return a; -} - -// Create a Radius authentication data -void *NewRadiusAuthData(wchar_t *username) -{ - AUTHRADIUS *a; - // Validate arguments - a = ZeroMallocEx(sizeof(AUTHRADIUS), true); - a->RadiusUsername = CopyUniStr(username); - - return a; -} - -// Create a root certification authentication data -void *NewRootCertAuthData(X_SERIAL *serial, wchar_t *common_name) -{ - AUTHROOTCERT *a; - - a = ZeroMallocEx(sizeof(AUTHROOTCERT), true); - if (common_name != NULL && UniIsEmptyStr(common_name) == false) - { - a->CommonName = CopyUniStr(common_name); - } - if (serial != NULL && serial->size >= 1) - { - a->Serial = CloneXSerial(serial); - } - - return a; -} - -// Create an authentication data for user certification -void *NewUserCertAuthData(X *x) -{ - AUTHUSERCERT *a; - - a = ZeroMalloc(sizeof(AUTHUSERCERT)); - a->UserX = CloneX(x); - - return a; -} - -// Hash the password -void HashPassword(void *dst, char *username, char *password) -{ - BUF *b; - char *username_upper; - // Validate arguments - if (dst == NULL || username == NULL || password == NULL) - { - return; - } - - b = NewBuf(); - username_upper = CopyStr(username); - StrUpper(username_upper); - WriteBuf(b, password, StrLen(password)); - WriteBuf(b, username_upper, StrLen(username_upper)); - Sha0(dst, b->Buf, b->Size); - - FreeBuf(b); - Free(username_upper); -} - -// Create a password authentication data -void *NewPasswordAuthData(char *username, char *password) -{ - AUTHPASSWORD *pw; - // Validate arguments - if (username == NULL || password == NULL) - { - return NULL; - } - - pw = ZeroMalloc(sizeof(AUTHPASSWORD)); - HashPassword(pw->HashedKey, username, password); - GenerateNtPasswordHash(pw->NtLmSecureHash, password); - - return pw; -} - -// Create a password authentication data for the hashed password -void *NewPasswordAuthDataRaw(UCHAR *hashed_password, UCHAR *ntlm_secure_hash) -{ - AUTHPASSWORD *pw; - // Validate arguments - if (hashed_password == NULL) - { - return NULL; - } - - pw = ZeroMalloc(sizeof(AUTHPASSWORD)); - Copy(pw->HashedKey, hashed_password, SHA1_SIZE); - - if (ntlm_secure_hash != NULL) - { - Copy(pw->NtLmSecureHash, ntlm_secure_hash, MD5_SIZE); - } - - return pw; -} - -// Clone authentication data -void *CopyAuthData(void *authdata, UINT authtype) -{ - AUTHPASSWORD *pw = (AUTHPASSWORD *)authdata; - AUTHUSERCERT *usercert = (AUTHUSERCERT *)authdata; - AUTHROOTCERT *rootcert = (AUTHROOTCERT *)authdata; - AUTHRADIUS *radius = (AUTHRADIUS *)authdata; - AUTHNT *nt = (AUTHNT *)authdata; - // Validate arguments - if (authdata == NULL || authtype == AUTHTYPE_ANONYMOUS) - { - return NULL; - } - - switch (authtype) - { - case AUTHTYPE_PASSWORD: - { - AUTHPASSWORD *ret = ZeroMalloc(sizeof(AUTHPASSWORD)); - Copy(ret, pw, sizeof(AUTHPASSWORD)); - return ret; - } - break; - - case AUTHTYPE_USERCERT: - { - AUTHUSERCERT *ret = ZeroMalloc(sizeof(AUTHUSERCERT)); - ret->UserX = CloneX(usercert->UserX); - return ret; - } - break; - - case AUTHTYPE_ROOTCERT: - { - AUTHROOTCERT *ret = ZeroMalloc(sizeof(AUTHROOTCERT)); - ret->CommonName = CopyUniStr(rootcert->CommonName); - ret->Serial = CloneXSerial(rootcert->Serial); - return ret; - } - break; - - case AUTHTYPE_RADIUS: - { - AUTHRADIUS *ret = ZeroMalloc(sizeof(AUTHRADIUS)); - ret->RadiusUsername = UniCopyStr(radius->RadiusUsername); - return ret; - } - break; - - case AUTHTYPE_NT: - { - AUTHNT *ret = ZeroMalloc(sizeof(AUTHNT)); - ret->NtUsername = UniCopyStr(nt->NtUsername); - return ret; - } - break; - } - - return NULL; -} - -// Set authentication data to the user -void SetUserAuthData(USER *u, UINT authtype, void *authdata) -{ - // Validate arguments - if (u == NULL) - { - return; - } - if (authtype != AUTHTYPE_ANONYMOUS && authdata == NULL) - { - return; - } - - Lock(u->lock); - { - if (u->AuthType != AUTHTYPE_ANONYMOUS) - { - if (u->AuthType == AUTHTYPE_PASSWORD && authtype == AUTHTYPE_PASSWORD) - { - AUTHPASSWORD *pw_old = (AUTHPASSWORD *)u->AuthData; - AUTHPASSWORD *pw_new = (AUTHPASSWORD *)authdata; - - // Copy NTLM hash for new password from old data, if the password is not changed - // and management tool don't send NTLM hash. - - if (Cmp(pw_old->HashedKey, pw_new->HashedKey, SHA1_SIZE) == 0) - { - if (IsZero(pw_new->NtLmSecureHash, MD5_SIZE)) - { - Copy(pw_new->NtLmSecureHash, pw_old->NtLmSecureHash, MD5_SIZE); - } - } - } - - // Free current authentication data - FreeAuthData(u->AuthType, u->AuthData); - } - // Set new authentication data - u->AuthType = authtype; - u->AuthData = authdata; - } - Unlock(u->lock); -} - -// Set traffic data for group -void SetGroupTraffic(USERGROUP *g, TRAFFIC *t) -{ - // Validate arguments - if (g == NULL) - { - return; - } - - Lock(g->lock); - { - if (t != NULL) - { - Copy(g->Traffic, t, sizeof(TRAFFIC)); - } - else - { - Zero(g->Traffic, sizeof(TRAFFIC)); - } - } - Unlock(g->lock); -} - -// Set traffic data for user -void SetUserTraffic(USER *u, TRAFFIC *t) -{ - // Validate arguments - if (u == NULL) - { - return; - } - - Lock(u->lock); - { - if (t != NULL) - { - Copy(u->Traffic, t, sizeof(TRAFFIC)); - } - else - { - Zero(u->Traffic, sizeof(TRAFFIC)); - } - } - Unlock(u->lock); -} - -// Join the user to the group -void JoinUserToGroup(USER *u, USERGROUP *g) -{ - // Validate arguments - if (u == NULL) - { - return; - } - - if (g != NULL) - { - // Join - Lock(u->lock); - { - Lock(g->lock); - { - if (u->Group != NULL) - { - // Remove the user from current group first - // - ReleaseGroup(u->Group); - u->Group = NULL; - Free(u->GroupName); - u->GroupName = NULL; - } - // Join the user to the group - u->GroupName = CopyStr(g->Name); - u->Group = g; - AddRef(g->ref); - } - Unlock(g->lock); - } - Unlock(u->lock); - } - else - { - // Withdrawal - Lock(u->lock); - { - if (u->Group != NULL) - { - // Remove the user from current group - ReleaseGroup(u->Group); - u->Group = NULL; - Free(u->GroupName); - u->GroupName = NULL; - } - } - Unlock(u->lock); - } -} - -// Validate group name -bool AcIsGroup(HUB *h, char *name) -{ - USERGROUP *g; - // Validate arguments - if (h == NULL || name == NULL || NO_ACCOUNT_DB(h)) - { - return false; - } - - g = AcGetGroup(h, name); - if (g == NULL) - { - return false; - } - ReleaseGroup(g); - - return true; -} - -// Validate user name -bool AcIsUser(HUB *h, char *name) -{ - USER *u; - // Validate arguments - if (h == NULL || name == NULL || NO_ACCOUNT_DB(h)) - { - return false; - } - - u = AcGetUser(h, name); - if (u == NULL) - { - return false; - } - ReleaseUser(u); - - return true; -} - -// Get group object -USERGROUP *AcGetGroup(HUB *h, char *name) -{ - USERGROUP *g, t; - // Validate arguments - if (h == NULL || name == NULL || NO_ACCOUNT_DB(h)) - { - return NULL; - } - - t.Name = name; - g = Search(h->HubDb->GroupList, &t); - if (g == NULL) - { - return NULL; - } - AddRef(g->ref); - - return g; -} - -// Get user object -USER *AcGetUser(HUB *h, char *name) -{ - USER *u, t; - // Validate arguments - if (h == NULL || name == NULL || NO_ACCOUNT_DB(h)) - { - return NULL; - } - - t.Name = name; - u = Search(h->HubDb->UserList, &t); - if (u == NULL) - { - return NULL; - } - AddRef(u->ref); - - return u; -} - -// Delete the user -bool AcDeleteUser(HUB *h, char *name) -{ - USER *u; - // Validate arguments - if (h == NULL || name == NULL) - { - return false; - } - - u = AcGetUser(h, name); - if (u == NULL) - { - return false; - } - - if (Delete(h->HubDb->UserList, u)) - { - ReleaseUser(u); - } - - ReleaseUser(u); - - return true; -} - -// Delete the group -bool AcDeleteGroup(HUB *h, char *name) -{ - USERGROUP *g; - UINT i; - // Validate arguments - if (h == NULL || name == NULL) - { - return false; - } - - g = AcGetGroup(h, name); - if (g == NULL) - { - return false; - } - - if (Delete(h->HubDb->GroupList, g)) - { - ReleaseGroup(g); - } - - for (i = 0;i < LIST_NUM(h->HubDb->UserList);i++) - { - USER *u = LIST_DATA(h->HubDb->UserList, i); - Lock(u->lock); - { - if (u->Group == g) - { - JoinUserToGroup(u, NULL); - } - } - Unlock(u->lock); - } - - ReleaseGroup(g); - - return true; -} - -// Add new group to the hub -bool AcAddGroup(HUB *h, USERGROUP *g) -{ - // Validate arguments - if (h == NULL || g == NULL || NO_ACCOUNT_DB(h)) - { - return false; - } - - if (LIST_NUM(h->HubDb->GroupList) >= MAX_GROUPS) - { - return false; - } - - if (AcIsGroup(h, g->Name) != false) - { - return false; - } - - Insert(h->HubDb->GroupList, g); - AddRef(g->ref); - - return true; -} - -// Add new user in the hub -bool AcAddUser(HUB *h, USER *u) -{ - // Validate arguments - if (h == NULL || u == NULL || NO_ACCOUNT_DB(h)) - { - return false; - } - - if (LIST_NUM(h->HubDb->UserList) >= MAX_USERS) - { - return false; - } - - if (AcIsUser(h, u->Name) != false) - { - return false; - } - - Insert(h->HubDb->UserList, u); - AddRef(u->ref); - - return true; -} - -// Release user object (decrease reference counter) -void ReleaseUser(USER *u) -{ - // Validate arguments - if (u == NULL) - { - return; - } - - if (Release(u->ref) == 0) - { - CleanupUser(u); - } -} - -// Cleanup the user object -void CleanupUser(USER *u) -{ - // Validate arguments - if (u == NULL) - { - return; - } - - DeleteLock(u->lock); - Free(u->Name); - Free(u->RealName); - Free(u->Note); - Free(u->GroupName); - if (u->Group != NULL) - { - ReleaseGroup(u->Group); - } - - // Free authentication data - FreeAuthData(u->AuthType, u->AuthData); - - if (u->Policy) - { - // Free policy data - Free(u->Policy); - } - - FreeTraffic(u->Traffic); - - Free(u); -} - -// Free authentication data -void FreeAuthData(UINT authtype, void *authdata) -{ - AUTHPASSWORD *pw = (AUTHPASSWORD *)authdata; - AUTHUSERCERT *uc = (AUTHUSERCERT *)authdata; - AUTHROOTCERT *rc = (AUTHROOTCERT *)authdata; - AUTHRADIUS *rd = (AUTHRADIUS *)authdata; - AUTHNT *nt = (AUTHNT *)authdata; - // Validate arguments - if (authtype == AUTHTYPE_ANONYMOUS || authdata == NULL) - { - return; - } - - switch (authtype) - { - case AUTHTYPE_PASSWORD: - // Password authentication - // Nothing to free - break; - - case AUTHTYPE_USERCERT: - // User certification - FreeX(uc->UserX); - break; - - case AUTHTYPE_ROOTCERT: - // Root certification - if (rc->Serial != NULL) - { - FreeXSerial(rc->Serial); - } - if (rc->CommonName != NULL) - { - Free(rc->CommonName); - } - break; - - case AUTHTYPE_RADIUS: - // Radius authentication - Free(rd->RadiusUsername); - break; - - case AUTHTYPE_NT: - // Windows NT authentication - Free(nt->NtUsername); - break; - } - - Free(authdata); -} - -// Create new user object -USER *NewUser(char *name, wchar_t *realname, wchar_t *note, UINT authtype, void *authdata) -{ - USER *u; - // Validate arguments - if (name == NULL || realname == NULL || note == NULL) - { - return NULL; - } - if (authtype != AUTHTYPE_ANONYMOUS && authdata == NULL) - { - return NULL; - } - - u = ZeroMalloc(sizeof(USER)); - u->lock = NewLock(); - u->ref = NewRef(); - u->Name = CopyStr(name); - u->RealName = CopyUniStr(realname); - u->Note = CopyUniStr(note); - u->GroupName = NULL; - u->Group = NULL; - u->AuthType = authtype; - u->AuthData = authdata; - u->CreatedTime = SystemTime64(); - u->UpdatedTime = SystemTime64(); - - u->Policy = NULL; - u->Traffic = NewTraffic(); - - return u; -} - -// Release group object (decrease reference counter) -void ReleaseGroup(USERGROUP *g) -{ - // Validate arguments - if (g == NULL) - { - return; - } - - if (Release(g->ref) == 0) - { - CleanupGroup(g); - } -} - -// Cleanup the group object -void CleanupGroup(USERGROUP *g) -{ - // Validate arguments - if (g == NULL) - { - return; - } - - Free(g->Name); - Free(g->RealName); - Free(g->Note); - - if (g->Policy) - { - // Free policy data - Free(g->Policy); - } - - - FreeTraffic(g->Traffic); - - DeleteLock(g->lock); - Free(g); -} - -// Create new group object -USERGROUP *NewGroup(char *name, wchar_t *realname, wchar_t *note) -{ - USERGROUP *g; - // Validate arguments - if (name == NULL || realname == NULL || note == NULL) - { - return NULL; - } - - g = ZeroMalloc(sizeof(USERGROUP)); - g->lock = NewLock(); - g->ref = NewRef(); - g->Name = CopyStr(name); - g->RealName = CopyUniStr(realname); - g->Note = CopyUniStr(note); - g->Policy = NULL; - g->Traffic = NewTraffic(); - - return g; -} - -// Lock the account database for the hub -void AcLock(HUB *h) -{ - // Validate arguments - if (h == NULL) - { - return; - } - if (NO_ACCOUNT_DB(h)) - { - return; - } - - // Lock group list and user list - LockList(h->HubDb->GroupList); - LockList(h->HubDb->UserList); -} - -// Unlock the account database for the hub -void AcUnlock(HUB *h) -{ - // Validate arguments - if (h == NULL) - { - return; - } - if (NO_ACCOUNT_DB(h)) - { - return; - } - - // Unlock group list and user list - UnlockList(h->HubDb->UserList); - UnlockList(h->HubDb->GroupList); -} - -// Compare group names (for sort) -int CompareGroupName(void *p1, void *p2) -{ - USERGROUP *g1, *g2; - // Validate arguments - if (p1 == NULL || p2 == NULL) - { - return 0; - } - g1 = *(USERGROUP **)p1; - g2 = *(USERGROUP **)p2; - if (g1 == NULL || g2 == NULL) - { - return 0; - } - - return StrCmpi(g1->Name, g2->Name); -} - -// Compare user names (for sort) -int CompareUserName(void *p1, void *p2) -{ - USER *u1, *u2; - // Validate arguments - if (p1 == NULL || p2 == NULL) - { - return 0; - } - u1 = *(USER **)p1; - u2 = *(USER **)p2; - if (u1 == NULL || u2 == NULL) - { - return 0; - } - - return StrCmpi(u1->Name, u2->Name); -} - -// Get the MAC address from the user's note string -bool GetUserMacAddressFromUserNote(UCHAR *mac, wchar_t *note) -{ - bool ret = false; - UINT i; - - Zero(mac, 6); - if (mac == NULL || note == NULL) - { - return false; - } - - i = UniSearchStrEx(note, USER_MAC_STR_PREFIX, 0, false); - if (i != INFINITE) - { - wchar_t *macstr_start = ¬e[i + UniStrLen(USER_MAC_STR_PREFIX)]; - wchar_t macstr2[MAX_SIZE]; - UNI_TOKEN_LIST *tokens; - - UniStrCpy(macstr2, sizeof(macstr2), macstr_start); - - UniTrim(macstr2); - - tokens = UniParseToken(macstr2, L" ,/()[]."); - if (tokens != NULL) - { - if (tokens->NumTokens >= 1) - { - wchar_t *macstr = tokens->Token[0]; - - if (UniIsEmptyStr(macstr) == false) - { - char macstr_a[MAX_SIZE]; - - UniToStr(macstr_a, sizeof(macstr_a), macstr); - - ret = StrToMac(mac, macstr_a); - } - } - - UniFreeToken(tokens); - } - } - - return ret; -} - -// Get the static IPv4 address from the user's note string -UINT GetUserIPv4AddressFromUserNote32(wchar_t *note) -{ - bool ret = false; - UINT ip32 = 0; - - UINT i = UniSearchStrEx(note, USER_IPV4_STR_PREFIX, 0, false); - if (i != INFINITE) - { - wchar_t *ipv4str_start = ¬e[i + UniStrLen(USER_IPV4_STR_PREFIX)]; - wchar_t ipv4str2[MAX_SIZE]; - UNI_TOKEN_LIST *tokens; - - UniStrCpy(ipv4str2, sizeof(ipv4str2), ipv4str_start); - UniTrim(ipv4str2); - - tokens = UniParseToken(ipv4str2, L" ,/()[]"); - if (tokens != NULL) - { - if (tokens->NumTokens >= 1) - { - wchar_t *ipv4str = tokens->Token[0]; - if (UniIsEmptyStr(ipv4str) == false) - { - char ipv4str_a[MAX_SIZE]; - UniToStr(ipv4str_a, sizeof(ipv4str_a), ipv4str); - ip32 = StrToIP32(ipv4str_a); - } - } - - UniFreeToken(tokens); - } - } - - return ip32; -} +// SoftEther VPN Source Code - Developer Edition Master Branch +// Cedar Communication Module + + +// Account.c +// Account Manager + +#include "CedarPch.h" + +// Policy items +POLICY_ITEM policy_item[] = +{ +// ID, Value, Omittable, Min, Max, Default, Unit name +// Ver 2.0 + {0, false, false, 0, 0, 0, NULL}, // Access + {1, false, false, 0, 0, 0, NULL}, // DHCPFilter + {2, false, false, 0, 0, 0, NULL}, // DHCPNoServer + {3, false, false, 0, 0, 0, NULL}, // DHCPForce + {4, false, false, 0, 0, 0, NULL}, // NoBridge + {5, false, false, 0, 0, 0, NULL}, // NoRouting + {6, false, false, 0, 0, 0, NULL}, // CheckMac + {7, false, false, 0, 0, 0, NULL}, // CheckIP + {8, false, false, 0, 0, 0, NULL}, // ArpDhcpOnly + {9, false, false, 0, 0, 0, NULL}, // PrivacyFilter + {10, false, false, 0, 0, 0, NULL}, // NoServer + {11, false, false, 0, 0, 0, NULL}, // NoBroadcastLimiter + {12, false, false, 0, 0, 0, NULL}, // MonitorPort + {13, true, false, 1, 32, 32, "POL_INT_COUNT"}, // MaxConnection + {14, true, false, 5, 60, 20, "POL_INT_SEC"}, // TimeOut + {15, true, true, 1, 65535, 0, "POL_INT_COUNT"}, // MaxMac + {16, true, true, 1, 65535, 0, "POL_INT_COUNT"}, // MaxIP + {17, true, true, 1, 4294967295UL, 0, "POL_INT_BPS"}, // MaxUpload + {18, true, true, 1, 4294967295UL, 0, "POL_INT_BPS"}, // MaxDownload + {19, false, false, 0, 0, 0, NULL}, // FixPassword + {20, true, true, 1, 65535, 0, "POL_INT_COUNT"}, // MultiLogins + {21, false, false, 0, 0, 0, NULL}, // NoQoS +// Ver 3.0 + {22, false, false, 0, 0, 0, NULL}, // RSandRAFilter + {23, false, false, 0, 0, 0, NULL}, // RAFilter + {24, false, false, 0, 0, 0, NULL}, // DHCPv6Filter + {25, false, false, 0, 0, 0, NULL}, // DHCPv6NoServer + {26, false, false, 0, 0, 0, NULL}, // NoRoutingV6 + {27, false, false, 0, 0, 0, NULL}, // CheckIPv6 + {28, false, false, 0, 0, 0, NULL}, // NoServerV6 + {29, true, true, 1, 65535, 0, "POL_INT_COUNT"}, // MaxIPv6 + {30, false, false, 0, 0, 0, NULL}, // NoSavePassword + {31, true, true, 1, 4294967295UL, 0, "POL_INT_SEC"}, // AutoDisconnect + {32, false, false, 0, 0, 0, NULL}, // FilterIPv4 + {33, false, false, 0, 0, 0, NULL}, // FilterIPv6 + {34, false, false, 0, 0, 0, NULL}, // FilterNonIP + {35, false, false, 0, 0, 0, NULL}, // NoIPv6DefaultRouterInRA + {36, false, false, 0, 0, 0, NULL}, // NoIPv6DefaultRouterInRAWhenIPv6 + {37, true, true, 1, 4095, 0, "POL_INT_VLAN"}, // VLanId +}; + +// Format policy value +void FormatPolicyValue(wchar_t *str, UINT size, UINT id, UINT value) +{ + POLICY_ITEM *p; + // Validate arguments + if (str == NULL) + { + return; + } + + p = GetPolicyItem(id); + + if (p->TypeInt == false) + { + // bool type + if (value == 0) + { + UniStrCpy(str, size, L"No"); + } + else + { + UniStrCpy(str, size, L"Yes"); + } + } + else + { + // int type + if (value == 0 && p->AllowZero) + { + UniStrCpy(str, size, _UU("CMD_NO_SETTINGS")); + } + else + { + UniFormat(str, size, _UU(p->FormatStr), value); + } + } +} + +// Get description string for range of the policy value +void GetPolicyValueRangeStr(wchar_t *str, UINT size, UINT id) +{ + POLICY_ITEM *p; + // Validate arguments + if (str == NULL) + { + return; + } + + p = GetPolicyItem(id); + + if (p->TypeInt == false) + { + // bool type + UniStrCpy(str, size, _UU("CMD_PolicyList_Range_Bool")); + } + else + { + wchar_t *tag; + wchar_t tmp1[256], tmp2[256]; + + // int type + if (p->AllowZero) + { + tag = _UU("CMD_PolicyList_Range_Int_2"); + } + else + { + tag = _UU("CMD_PolicyList_Range_Int_1"); + } + + UniFormat(tmp1, sizeof(tmp1), _UU(p->FormatStr), p->MinValue); + UniFormat(tmp2, sizeof(tmp2), _UU(p->FormatStr), p->MaxValue); + + UniFormat(str, size, tag, tmp1, tmp2); + } +} + +// Get a policy item for id +POLICY_ITEM *GetPolicyItem(UINT id) +{ + return &policy_item[id]; +} + +// Does cascade connection support the specified policy? +bool PolicyIsSupportedForCascade(UINT i) +{ + if (i == 0 || i == 4 || i == 5 || i == 12 || i == 13 || + i == 14 || i == 19 || i == 20 || i == 21 || i == 26 || i == 30 || i == 31 || i == 36) + { + // These items are not supported by cascade connection. + return false; + } + + return true; +} + +// Get policy name +char *PolicyIdToStr(UINT i) +{ + switch (i) + { + // Ver 2.0 + case 0: return "Access"; + case 1: return "DHCPFilter"; + case 2: return "DHCPNoServer"; + case 3: return "DHCPForce"; + case 4: return "NoBridge"; + case 5: return "NoRouting"; + case 6: return "CheckMac"; + case 7: return "CheckIP"; + case 8: return "ArpDhcpOnly"; + case 9: return "PrivacyFilter"; + case 10: return "NoServer"; + case 11: return "NoBroadcastLimiter"; + case 12: return "MonitorPort"; + case 13: return "MaxConnection"; + case 14: return "TimeOut"; + case 15: return "MaxMac"; + case 16: return "MaxIP"; + case 17: return "MaxUpload"; + case 18: return "MaxDownload"; + case 19: return "FixPassword"; + case 20: return "MultiLogins"; + case 21: return "NoQoS"; + + // Ver 3.0 + case 22: return "RSandRAFilter"; + case 23: return "RAFilter"; + case 24: return "DHCPv6Filter"; + case 25: return "DHCPv6NoServer"; + case 26: return "NoRoutingV6"; + case 27: return "CheckIPv6"; + case 28: return "NoServerV6"; + case 29: return "MaxIPv6"; + case 30: return "NoSavePassword"; + case 31: return "AutoDisconnect"; + case 32: return "FilterIPv4"; + case 33: return "FilterIPv6"; + case 34: return "FilterNonIP"; + case 35: return "NoIPv6DefaultRouterInRA"; + case 36: return "NoIPv6DefaultRouterInRAWhenIPv6"; + case 37: return "VLanId"; + } + + return NULL; +} + +// Get policy id for name +UINT PolicyStrToId(char *name) +{ + UINT i; + // Validate arguments + if (name == NULL) + { + return INFINITE; + } + + for (i = 0;i < NUM_POLICY_ITEM;i++) + { + if (StartWith(PolicyIdToStr(i), name)) + { + return i; + } + } + + return INFINITE; +} + +// Get number of policies +UINT PolicyNum() +{ + return NUM_POLICY_ITEM; +} + +// Check the name is valid for account name +bool IsUserName(char *name) +{ + UINT i, len; + char tmp[MAX_SIZE]; + // Validate arguments + if (name == NULL) + { + return false; + } + + StrCpy(tmp, sizeof(tmp), name); + name = tmp; + + Trim(name); + + len = StrLen(name); + if (len == 0) + { + return false; + } + + if (StrCmpi(name, "*") == 0) + { + return true; + } + + for (i = 0; i < len; i++) + { + if (IsSafeChar(name[i]) == false && name[i] != '@') + { + return false; + } + } + + if (StrCmpi(name, LINK_USER_NAME) == 0) + { + return false; + } + + if (StartWith(name, L3_USERNAME)) + { + return false; + } + + if (StrCmpi(name, LINK_USER_NAME_PRINT) == 0) + { + return false; + } + + if (StrCmpi(name, SNAT_USER_NAME) == 0) + { + return false; + } + + if (StrCmpi(name, SNAT_USER_NAME_PRINT) == 0) + { + return false; + } + + if (StrCmpi(name, BRIDGE_USER_NAME) == 0) + { + return false; + } + + if (StrCmpi(name, BRIDGE_USER_NAME_PRINT) == 0) + { + return false; + } + + if (StrCmpi(name, ADMINISTRATOR_USERNAME) == 0) + { + return false; + } + + return true; +} + +// Get policy title +wchar_t *GetPolicyTitle(UINT id) +{ + char tmp[MAX_SIZE]; + Format(tmp, sizeof(tmp), "POL_%u", id); + + return _UU(tmp); +} + +// Get policy description +wchar_t *GetPolicyDescription(UINT id) +{ + char tmp[MAX_SIZE]; + Format(tmp, sizeof(tmp), "POL_EX_%u", id); + + return _UU(tmp); +} + +// Clone the policy value +POLICY *ClonePolicy(POLICY *policy) +{ + POLICY *ret; + // Validate arguments + if (policy == NULL) + { + return NULL; + } + + ret = ZeroMalloc(sizeof(POLICY)); + Copy(ret, policy, sizeof(POLICY)); + + return ret; +} + +// Overwrite policy value (If old version data overwrites new version, leave new version value as it is.) +void OverwritePolicy(POLICY **target, POLICY *p) +{ + // Validate arguments + if (target == NULL) + { + return; + } + + if (p == NULL) + { + // Erase policy + if (*target != NULL) + { + Free(*target); + *target = NULL; + } + } + else + { + if (p->Ver3) + { + // Ver 3 + if (*target != NULL) + { + Free(*target); + *target = NULL; + } + + *target = ClonePolicy(p); + } + else + { + // Ver 2 + if (*target == NULL) + { + *target = ClonePolicy(p); + } + else + { + Copy(*target, p, NUM_POLICY_ITEM_FOR_VER2 * sizeof(UINT)); + } + } + } +} + +// Set user policy +void SetUserPolicy(USER *u, POLICY *policy) +{ + // Validate arguments + if (u == NULL) + { + return; + } + + Lock(u->lock); + { + OverwritePolicy(&u->Policy, policy); + } + Unlock(u->lock); +} + +// Set group policy +void SetGroupPolicy(USERGROUP *g, POLICY *policy) +{ + // Validate arguments + if (g == NULL) + { + return; + } + + Lock(g->lock); + { + OverwritePolicy(&g->Policy, policy); + } + Unlock(g->lock); +} + +// Get group policy +POLICY *GetGroupPolicy(USERGROUP *g) +{ + POLICY *ret; + // Validate arguments + if (g == NULL) + { + return NULL; + } + + Lock(g->lock); + { + if (g->Policy == NULL) + { + ret = NULL; + } + else + { + ret = ClonePolicy(g->Policy); + } + } + Unlock(g->lock); + + return ret; +} + +// Get default policy template +POLICY *GetDefaultPolicy() +{ + static POLICY def_policy = + { + true, + false, + false, + false, + false, + false, + false, + false, + false, + false, + false, + false, + false, + 32, + 20, + 0, + 0, + 0, + 0, + false, + 0, + false, + false, + false, + false, + false, + false, + false, + false, + 0, + false, + 0, + false, + false, + false, + false, + false, + }; + + return &def_policy; +} + +// Create a NT authentication data +void *NewNTAuthData(wchar_t *username) +{ + AUTHNT *a; + // Validate arguments + a = ZeroMallocEx(sizeof(AUTHNT), true); + a->NtUsername = CopyUniStr(username); + + return a; +} + +// Create a Radius authentication data +void *NewRadiusAuthData(wchar_t *username) +{ + AUTHRADIUS *a; + // Validate arguments + a = ZeroMallocEx(sizeof(AUTHRADIUS), true); + a->RadiusUsername = CopyUniStr(username); + + return a; +} + +// Create a root certification authentication data +void *NewRootCertAuthData(X_SERIAL *serial, wchar_t *common_name) +{ + AUTHROOTCERT *a; + + a = ZeroMallocEx(sizeof(AUTHROOTCERT), true); + if (common_name != NULL && UniIsEmptyStr(common_name) == false) + { + a->CommonName = CopyUniStr(common_name); + } + if (serial != NULL && serial->size >= 1) + { + a->Serial = CloneXSerial(serial); + } + + return a; +} + +// Create an authentication data for user certification +void *NewUserCertAuthData(X *x) +{ + AUTHUSERCERT *a; + + a = ZeroMalloc(sizeof(AUTHUSERCERT)); + a->UserX = CloneX(x); + + return a; +} + +// Hash the password +void HashPassword(void *dst, char *username, char *password) +{ + BUF *b; + char *username_upper; + // Validate arguments + if (dst == NULL || username == NULL || password == NULL) + { + return; + } + + b = NewBuf(); + username_upper = CopyStr(username); + StrUpper(username_upper); + WriteBuf(b, password, StrLen(password)); + WriteBuf(b, username_upper, StrLen(username_upper)); + Sha0(dst, b->Buf, b->Size); + + FreeBuf(b); + Free(username_upper); +} + +// Create a password authentication data +void *NewPasswordAuthData(char *username, char *password) +{ + AUTHPASSWORD *pw; + // Validate arguments + if (username == NULL || password == NULL) + { + return NULL; + } + + pw = ZeroMalloc(sizeof(AUTHPASSWORD)); + HashPassword(pw->HashedKey, username, password); + GenerateNtPasswordHash(pw->NtLmSecureHash, password); + + return pw; +} + +// Create a password authentication data for the hashed password +void *NewPasswordAuthDataRaw(UCHAR *hashed_password, UCHAR *ntlm_secure_hash) +{ + AUTHPASSWORD *pw; + // Validate arguments + if (hashed_password == NULL) + { + return NULL; + } + + pw = ZeroMalloc(sizeof(AUTHPASSWORD)); + Copy(pw->HashedKey, hashed_password, SHA1_SIZE); + + if (ntlm_secure_hash != NULL) + { + Copy(pw->NtLmSecureHash, ntlm_secure_hash, MD5_SIZE); + } + + return pw; +} + +// Clone authentication data +void *CopyAuthData(void *authdata, UINT authtype) +{ + AUTHPASSWORD *pw = (AUTHPASSWORD *)authdata; + AUTHUSERCERT *usercert = (AUTHUSERCERT *)authdata; + AUTHROOTCERT *rootcert = (AUTHROOTCERT *)authdata; + AUTHRADIUS *radius = (AUTHRADIUS *)authdata; + AUTHNT *nt = (AUTHNT *)authdata; + // Validate arguments + if (authdata == NULL || authtype == AUTHTYPE_ANONYMOUS) + { + return NULL; + } + + switch (authtype) + { + case AUTHTYPE_PASSWORD: + { + AUTHPASSWORD *ret = ZeroMalloc(sizeof(AUTHPASSWORD)); + Copy(ret, pw, sizeof(AUTHPASSWORD)); + return ret; + } + break; + + case AUTHTYPE_USERCERT: + { + AUTHUSERCERT *ret = ZeroMalloc(sizeof(AUTHUSERCERT)); + ret->UserX = CloneX(usercert->UserX); + return ret; + } + break; + + case AUTHTYPE_ROOTCERT: + { + AUTHROOTCERT *ret = ZeroMalloc(sizeof(AUTHROOTCERT)); + ret->CommonName = CopyUniStr(rootcert->CommonName); + ret->Serial = CloneXSerial(rootcert->Serial); + return ret; + } + break; + + case AUTHTYPE_RADIUS: + { + AUTHRADIUS *ret = ZeroMalloc(sizeof(AUTHRADIUS)); + ret->RadiusUsername = UniCopyStr(radius->RadiusUsername); + return ret; + } + break; + + case AUTHTYPE_NT: + { + AUTHNT *ret = ZeroMalloc(sizeof(AUTHNT)); + ret->NtUsername = UniCopyStr(nt->NtUsername); + return ret; + } + break; + } + + return NULL; +} + +// Set authentication data to the user +void SetUserAuthData(USER *u, UINT authtype, void *authdata) +{ + // Validate arguments + if (u == NULL) + { + return; + } + if (authtype != AUTHTYPE_ANONYMOUS && authdata == NULL) + { + return; + } + + Lock(u->lock); + { + if (u->AuthType != AUTHTYPE_ANONYMOUS) + { + if (u->AuthType == AUTHTYPE_PASSWORD && authtype == AUTHTYPE_PASSWORD) + { + AUTHPASSWORD *pw_old = (AUTHPASSWORD *)u->AuthData; + AUTHPASSWORD *pw_new = (AUTHPASSWORD *)authdata; + + // Copy NTLM hash for new password from old data, if the password is not changed + // and management tool don't send NTLM hash. + + if (Cmp(pw_old->HashedKey, pw_new->HashedKey, SHA1_SIZE) == 0) + { + if (IsZero(pw_new->NtLmSecureHash, MD5_SIZE)) + { + Copy(pw_new->NtLmSecureHash, pw_old->NtLmSecureHash, MD5_SIZE); + } + } + } + + // Free current authentication data + FreeAuthData(u->AuthType, u->AuthData); + } + // Set new authentication data + u->AuthType = authtype; + u->AuthData = authdata; + } + Unlock(u->lock); +} + +// Set traffic data for group +void SetGroupTraffic(USERGROUP *g, TRAFFIC *t) +{ + // Validate arguments + if (g == NULL) + { + return; + } + + Lock(g->lock); + { + if (t != NULL) + { + Copy(g->Traffic, t, sizeof(TRAFFIC)); + } + else + { + Zero(g->Traffic, sizeof(TRAFFIC)); + } + } + Unlock(g->lock); +} + +// Set traffic data for user +void SetUserTraffic(USER *u, TRAFFIC *t) +{ + // Validate arguments + if (u == NULL) + { + return; + } + + Lock(u->lock); + { + if (t != NULL) + { + Copy(u->Traffic, t, sizeof(TRAFFIC)); + } + else + { + Zero(u->Traffic, sizeof(TRAFFIC)); + } + } + Unlock(u->lock); +} + +// Join the user to the group +void JoinUserToGroup(USER *u, USERGROUP *g) +{ + // Validate arguments + if (u == NULL) + { + return; + } + + if (g != NULL) + { + // Join + Lock(u->lock); + { + Lock(g->lock); + { + if (u->Group != NULL) + { + // Remove the user from current group first + // + ReleaseGroup(u->Group); + u->Group = NULL; + Free(u->GroupName); + u->GroupName = NULL; + } + // Join the user to the group + u->GroupName = CopyStr(g->Name); + u->Group = g; + AddRef(g->ref); + } + Unlock(g->lock); + } + Unlock(u->lock); + } + else + { + // Withdrawal + Lock(u->lock); + { + if (u->Group != NULL) + { + // Remove the user from current group + ReleaseGroup(u->Group); + u->Group = NULL; + Free(u->GroupName); + u->GroupName = NULL; + } + } + Unlock(u->lock); + } +} + +// Validate group name +bool AcIsGroup(HUB *h, char *name) +{ + USERGROUP *g; + // Validate arguments + if (h == NULL || name == NULL || NO_ACCOUNT_DB(h)) + { + return false; + } + + g = AcGetGroup(h, name); + if (g == NULL) + { + return false; + } + ReleaseGroup(g); + + return true; +} + +// Validate user name +bool AcIsUser(HUB *h, char *name) +{ + USER *u; + // Validate arguments + if (h == NULL || name == NULL || NO_ACCOUNT_DB(h)) + { + return false; + } + + u = AcGetUser(h, name); + if (u == NULL) + { + return false; + } + ReleaseUser(u); + + return true; +} + +// Get group object +USERGROUP *AcGetGroup(HUB *h, char *name) +{ + USERGROUP *g, t; + // Validate arguments + if (h == NULL || name == NULL || NO_ACCOUNT_DB(h)) + { + return NULL; + } + + t.Name = name; + g = Search(h->HubDb->GroupList, &t); + if (g == NULL) + { + return NULL; + } + AddRef(g->ref); + + return g; +} + +// Get user object +USER *AcGetUser(HUB *h, char *name) +{ + USER *u, t; + // Validate arguments + if (h == NULL || name == NULL || NO_ACCOUNT_DB(h)) + { + return NULL; + } + + t.Name = name; + u = Search(h->HubDb->UserList, &t); + if (u == NULL) + { + return NULL; + } + AddRef(u->ref); + + return u; +} + +// Delete the user +bool AcDeleteUser(HUB *h, char *name) +{ + USER *u; + // Validate arguments + if (h == NULL || name == NULL) + { + return false; + } + + u = AcGetUser(h, name); + if (u == NULL) + { + return false; + } + + if (Delete(h->HubDb->UserList, u)) + { + ReleaseUser(u); + } + + ReleaseUser(u); + + return true; +} + +// Delete the group +bool AcDeleteGroup(HUB *h, char *name) +{ + USERGROUP *g; + UINT i; + // Validate arguments + if (h == NULL || name == NULL) + { + return false; + } + + g = AcGetGroup(h, name); + if (g == NULL) + { + return false; + } + + if (Delete(h->HubDb->GroupList, g)) + { + ReleaseGroup(g); + } + + for (i = 0;i < LIST_NUM(h->HubDb->UserList);i++) + { + USER *u = LIST_DATA(h->HubDb->UserList, i); + Lock(u->lock); + { + if (u->Group == g) + { + JoinUserToGroup(u, NULL); + } + } + Unlock(u->lock); + } + + ReleaseGroup(g); + + return true; +} + +// Add new group to the hub +bool AcAddGroup(HUB *h, USERGROUP *g) +{ + // Validate arguments + if (h == NULL || g == NULL || NO_ACCOUNT_DB(h)) + { + return false; + } + + if (LIST_NUM(h->HubDb->GroupList) >= MAX_GROUPS) + { + return false; + } + + if (AcIsGroup(h, g->Name) != false) + { + return false; + } + + Insert(h->HubDb->GroupList, g); + AddRef(g->ref); + + return true; +} + +// Add new user in the hub +bool AcAddUser(HUB *h, USER *u) +{ + // Validate arguments + if (h == NULL || u == NULL || NO_ACCOUNT_DB(h)) + { + return false; + } + + if (LIST_NUM(h->HubDb->UserList) >= MAX_USERS) + { + return false; + } + + if (AcIsUser(h, u->Name) != false) + { + return false; + } + + Insert(h->HubDb->UserList, u); + AddRef(u->ref); + + return true; +} + +// Release user object (decrease reference counter) +void ReleaseUser(USER *u) +{ + // Validate arguments + if (u == NULL) + { + return; + } + + if (Release(u->ref) == 0) + { + CleanupUser(u); + } +} + +// Cleanup the user object +void CleanupUser(USER *u) +{ + // Validate arguments + if (u == NULL) + { + return; + } + + DeleteLock(u->lock); + Free(u->Name); + Free(u->RealName); + Free(u->Note); + Free(u->GroupName); + if (u->Group != NULL) + { + ReleaseGroup(u->Group); + } + + // Free authentication data + FreeAuthData(u->AuthType, u->AuthData); + + if (u->Policy) + { + // Free policy data + Free(u->Policy); + } + + FreeTraffic(u->Traffic); + + Free(u); +} + +// Free authentication data +void FreeAuthData(UINT authtype, void *authdata) +{ + AUTHPASSWORD *pw = (AUTHPASSWORD *)authdata; + AUTHUSERCERT *uc = (AUTHUSERCERT *)authdata; + AUTHROOTCERT *rc = (AUTHROOTCERT *)authdata; + AUTHRADIUS *rd = (AUTHRADIUS *)authdata; + AUTHNT *nt = (AUTHNT *)authdata; + // Validate arguments + if (authtype == AUTHTYPE_ANONYMOUS || authdata == NULL) + { + return; + } + + switch (authtype) + { + case AUTHTYPE_PASSWORD: + // Password authentication + // Nothing to free + break; + + case AUTHTYPE_USERCERT: + // User certification + FreeX(uc->UserX); + break; + + case AUTHTYPE_ROOTCERT: + // Root certification + if (rc->Serial != NULL) + { + FreeXSerial(rc->Serial); + } + if (rc->CommonName != NULL) + { + Free(rc->CommonName); + } + break; + + case AUTHTYPE_RADIUS: + // Radius authentication + Free(rd->RadiusUsername); + break; + + case AUTHTYPE_NT: + // Windows NT authentication + Free(nt->NtUsername); + break; + } + + Free(authdata); +} + +// Create new user object +USER *NewUser(char *name, wchar_t *realname, wchar_t *note, UINT authtype, void *authdata) +{ + USER *u; + // Validate arguments + if (name == NULL || realname == NULL || note == NULL) + { + return NULL; + } + if (authtype != AUTHTYPE_ANONYMOUS && authdata == NULL) + { + return NULL; + } + + u = ZeroMalloc(sizeof(USER)); + u->lock = NewLock(); + u->ref = NewRef(); + u->Name = CopyStr(name); + u->RealName = CopyUniStr(realname); + u->Note = CopyUniStr(note); + u->GroupName = NULL; + u->Group = NULL; + u->AuthType = authtype; + u->AuthData = authdata; + u->CreatedTime = SystemTime64(); + u->UpdatedTime = SystemTime64(); + + u->Policy = NULL; + u->Traffic = NewTraffic(); + + return u; +} + +// Release group object (decrease reference counter) +void ReleaseGroup(USERGROUP *g) +{ + // Validate arguments + if (g == NULL) + { + return; + } + + if (Release(g->ref) == 0) + { + CleanupGroup(g); + } +} + +// Cleanup the group object +void CleanupGroup(USERGROUP *g) +{ + // Validate arguments + if (g == NULL) + { + return; + } + + Free(g->Name); + Free(g->RealName); + Free(g->Note); + + if (g->Policy) + { + // Free policy data + Free(g->Policy); + } + + + FreeTraffic(g->Traffic); + + DeleteLock(g->lock); + Free(g); +} + +// Create new group object +USERGROUP *NewGroup(char *name, wchar_t *realname, wchar_t *note) +{ + USERGROUP *g; + // Validate arguments + if (name == NULL || realname == NULL || note == NULL) + { + return NULL; + } + + g = ZeroMalloc(sizeof(USERGROUP)); + g->lock = NewLock(); + g->ref = NewRef(); + g->Name = CopyStr(name); + g->RealName = CopyUniStr(realname); + g->Note = CopyUniStr(note); + g->Policy = NULL; + g->Traffic = NewTraffic(); + + return g; +} + +// Lock the account database for the hub +void AcLock(HUB *h) +{ + // Validate arguments + if (h == NULL) + { + return; + } + if (NO_ACCOUNT_DB(h)) + { + return; + } + + // Lock group list and user list + LockList(h->HubDb->GroupList); + LockList(h->HubDb->UserList); +} + +// Unlock the account database for the hub +void AcUnlock(HUB *h) +{ + // Validate arguments + if (h == NULL) + { + return; + } + if (NO_ACCOUNT_DB(h)) + { + return; + } + + // Unlock group list and user list + UnlockList(h->HubDb->UserList); + UnlockList(h->HubDb->GroupList); +} + +// Compare group names (for sort) +int CompareGroupName(void *p1, void *p2) +{ + USERGROUP *g1, *g2; + // Validate arguments + if (p1 == NULL || p2 == NULL) + { + return 0; + } + g1 = *(USERGROUP **)p1; + g2 = *(USERGROUP **)p2; + if (g1 == NULL || g2 == NULL) + { + return 0; + } + + return StrCmpi(g1->Name, g2->Name); +} + +// Compare user names (for sort) +int CompareUserName(void *p1, void *p2) +{ + USER *u1, *u2; + // Validate arguments + if (p1 == NULL || p2 == NULL) + { + return 0; + } + u1 = *(USER **)p1; + u2 = *(USER **)p2; + if (u1 == NULL || u2 == NULL) + { + return 0; + } + + return StrCmpi(u1->Name, u2->Name); +} + +// Get the MAC address from the user's note string +bool GetUserMacAddressFromUserNote(UCHAR *mac, wchar_t *note) +{ + bool ret = false; + UINT i; + + Zero(mac, 6); + if (mac == NULL || note == NULL) + { + return false; + } + + i = UniSearchStrEx(note, USER_MAC_STR_PREFIX, 0, false); + if (i != INFINITE) + { + wchar_t *macstr_start = ¬e[i + UniStrLen(USER_MAC_STR_PREFIX)]; + wchar_t macstr2[MAX_SIZE]; + UNI_TOKEN_LIST *tokens; + + UniStrCpy(macstr2, sizeof(macstr2), macstr_start); + + UniTrim(macstr2); + + tokens = UniParseToken(macstr2, L" ,/()[]."); + if (tokens != NULL) + { + if (tokens->NumTokens >= 1) + { + wchar_t *macstr = tokens->Token[0]; + + if (UniIsEmptyStr(macstr) == false) + { + char macstr_a[MAX_SIZE]; + + UniToStr(macstr_a, sizeof(macstr_a), macstr); + + ret = StrToMac(mac, macstr_a); + } + } + + UniFreeToken(tokens); + } + } + + return ret; +} + +// Get the static IPv4 address from the user's note string +UINT GetUserIPv4AddressFromUserNote32(wchar_t *note) +{ + bool ret = false; + UINT ip32 = 0; + + UINT i = UniSearchStrEx(note, USER_IPV4_STR_PREFIX, 0, false); + if (i != INFINITE) + { + wchar_t *ipv4str_start = ¬e[i + UniStrLen(USER_IPV4_STR_PREFIX)]; + wchar_t ipv4str2[MAX_SIZE]; + UNI_TOKEN_LIST *tokens; + + UniStrCpy(ipv4str2, sizeof(ipv4str2), ipv4str_start); + UniTrim(ipv4str2); + + tokens = UniParseToken(ipv4str2, L" ,/()[]"); + if (tokens != NULL) + { + if (tokens->NumTokens >= 1) + { + wchar_t *ipv4str = tokens->Token[0]; + if (UniIsEmptyStr(ipv4str) == false) + { + char ipv4str_a[MAX_SIZE]; + UniToStr(ipv4str_a, sizeof(ipv4str_a), ipv4str); + ip32 = StrToIP32(ipv4str_a); + } + } + + UniFreeToken(tokens); + } + } + + return ip32; +} diff --git a/src/Cedar/Account.h b/src/Cedar/Account.h index 633e9919..fafac1da 100644 --- a/src/Cedar/Account.h +++ b/src/Cedar/Account.h @@ -1,211 +1,211 @@ -// SoftEther VPN Source Code - Developer Edition Master Branch -// Cedar Communication Module - - -// Account.h -// Header of Account.c - -#ifndef ACCOUNT_H -#define ACCOUNT_H - -#define USER_MAC_STR_PREFIX L"MAC:" -#define USER_IPV4_STR_PREFIX L"IPv4:" - -// Policy item -struct POLICY_ITEM -{ - UINT Index; - bool TypeInt; - bool AllowZero; - UINT MinValue; - UINT MaxValue; - UINT DefaultValue; - char *FormatStr; -}; - -// Policy -struct POLICY -{ - // For Ver 2.0 - bool Access; // Grant access - bool DHCPFilter; // Filter DHCP packets (IPv4) - bool DHCPNoServer; // Prohibit the behavior of the DHCP server (IPv4) - bool DHCPForce; // Force DHCP-assigned IP address (IPv4) - bool NoBridge; // Prohibit the bridge behavior - bool NoRouting; // Prohibit the router behavior (IPv4) - bool CheckMac; // Prohibit the duplicate MAC address - bool CheckIP; // Prohibit a duplicate IP address (IPv4) - bool ArpDhcpOnly; // Prohibit the broadcast other than ARP, DHCP, ICMPv6 - bool PrivacyFilter; // Privacy filter mode - bool NoServer; // Prohibit to operate as a TCP/IP server (IPv4) - bool NoBroadcastLimiter; // Not to limit the number of broadcast - bool MonitorPort; // Allow monitoring mode - UINT MaxConnection; // Maximum number of TCP connections - UINT TimeOut; // Communication time-out period - UINT MaxMac; // Maximum number of MAC address - UINT MaxIP; // Maximum number of IP address (IPv4) - UINT MaxUpload; // Upload bandwidth - UINT MaxDownload; // Download bandwidth - bool FixPassword; // User can not change password - UINT MultiLogins; // Multiple logins limit - bool NoQoS; // Prohibit the use of VoIP / QoS features - - // For Ver 3.0 - bool RSandRAFilter; // Filter the Router Solicitation / Advertising packet (IPv6) - bool RAFilter; // Filter the router advertisement packet (IPv6) - bool DHCPv6Filter; // Filter DHCP packets (IPv6) - bool DHCPv6NoServer; // Prohibit the behavior of the DHCP server (IPv6) - bool NoRoutingV6; // Prohibit the router behavior (IPv6) - bool CheckIPv6; // Prohibit the duplicate IP address (IPv6) - bool NoServerV6; // Prohibit to operate as a TCP/IP server (IPv6) - UINT MaxIPv6; // Maximum number of IP address (IPv6) - bool NoSavePassword; // Prohibit to save the password in the VPN Client - UINT AutoDisconnect; // Disconnect the VPN Client automatically at a certain period of time - bool FilterIPv4; // Filter all IPv4 packets - bool FilterIPv6; // Filter all IPv6 packets - bool FilterNonIP; // Filter all non-IP packets - bool NoIPv6DefaultRouterInRA; // Delete the default router specification from the IPv6 router advertisement - bool NoIPv6DefaultRouterInRAWhenIPv6; // Delete the default router specification from the IPv6 router advertisement (Enable IPv6 connection) - UINT VLanId; // Specify the VLAN ID - - bool Ver3; // Whether version 3.0 -}; - -// Group -struct USERGROUP -{ - LOCK *lock; // Lock - REF *ref; // Reference counter - char *Name; // Group name - wchar_t *RealName; // Display name - wchar_t *Note; // Note - POLICY *Policy; // Policy - TRAFFIC *Traffic; // Traffic data -}; - -// User -struct USER -{ - LOCK *lock; // Lock - REF *ref; // Reference counter - char *Name; // User name - wchar_t *RealName; // Real name - wchar_t *Note; // Note - char *GroupName; // Group name - USERGROUP *Group; // Group - UINT AuthType; // Authentication type - void *AuthData; // Authentication data - UINT64 CreatedTime; // Creation date and time - UINT64 UpdatedTime; // Updating date - UINT64 ExpireTime; // Expiration date - UINT64 LastLoginTime; // Last login time - UINT NumLogin; // Total number of logins - POLICY *Policy; // Policy - TRAFFIC *Traffic; // Traffic data -}; - -// Password authentication data -struct AUTHPASSWORD -{ - UCHAR HashedKey[SHA1_SIZE]; // Hashed passwords - UCHAR NtLmSecureHash[MD5_SIZE]; // Encrypted password for the NTLM -}; - -// User certificate authentication data -struct AUTHUSERCERT -{ - X *UserX; // X509 certificate for the user -}; - -// Root certification authority authentication data -struct AUTHROOTCERT -{ - X_SERIAL *Serial; // Serial number - wchar_t *CommonName; // CommonName -}; - -// Radius authentication data -struct AUTHRADIUS -{ - wchar_t *RadiusUsername; // User name in the Radius -}; - -// Windows NT authentication data -struct AUTHNT -{ - wchar_t *NtUsername; // User name on NT -}; - - - -// Macro -#define POLICY_CURRENT_VERSION 3 -#define NUM_POLICY_ITEM ((sizeof(POLICY) / sizeof(UINT)) - 1) -#define NUM_POLICY_ITEM_FOR_VER2 22 -#define NUM_POLICY_ITEM_FOR_VER3 38 - -#define IS_POLICY_FOR_VER2(index) (((index) >= 0) && ((index) < NUM_POLICY_ITEM_FOR_VER2)) -#define IS_POLICY_FOR_VER3(index) (((index) >= 0) && ((index) < NUM_POLICY_ITEM_FOR_VER3)) - -#define IS_POLICY_FOR_CURRENT_VER(index, ver) ((ver) >= 3 ? IS_POLICY_FOR_VER3(index) : IS_POLICY_FOR_VER2(index)) - -#define POLICY_BOOL(p, i) (((bool *)(p))[(i)]) -#define POLICY_INT(p, i) (((UINT *)(p))[(i)]) - -extern POLICY_ITEM policy_item[]; - - - - -// Function prototype -int CompareUserName(void *p1, void *p2); -int CompareGroupName(void *p1, void *p2); -void AcLock(HUB *h); -void AcUnlock(HUB *h); -USERGROUP *NewGroup(char *name, wchar_t *realname, wchar_t *note); -void ReleaseGroup(USERGROUP *g); -void CleanupGroup(USERGROUP *g); -USER *NewUser(char *name, wchar_t *realname, wchar_t *note, UINT authtype, void *authdata); -void ReleaseUser(USER *u); -void CleanupUser(USER *u); -void FreeAuthData(UINT authtype, void *authdata); -bool AcAddUser(HUB *h, USER *u); -bool AcAddGroup(HUB *h, USERGROUP *g); -USER *AcGetUser(HUB *h, char *name); -USERGROUP *AcGetGroup(HUB *h, char *name); -bool AcIsUser(HUB *h, char *name); -bool AcIsGroup(HUB *h, char *name); -bool AcDeleteUser(HUB *h, char *name); -bool AcDeleteGroup(HUB *h, char *name); -void JoinUserToGroup(USER *u, USERGROUP *g); -void SetUserTraffic(USER *u, TRAFFIC *t); -void SetGroupTraffic(USERGROUP *g, TRAFFIC *t); -void SetUserAuthData(USER *u, UINT authtype, void *authdata); -void *NewPasswordAuthData(char *username, char *password); -void *NewPasswordAuthDataRaw(UCHAR *hashed_password, UCHAR *ntlm_secure_hash); -void *NewUserCertAuthData(X *x); -void *NewRootCertAuthData(X_SERIAL *serial, wchar_t *common_name); -void *NewRadiusAuthData(wchar_t *username); -void *NewNTAuthData(wchar_t *username); -void HashPassword(void *dst, char *username, char *password); -POLICY *GetDefaultPolicy(); -POLICY *ClonePolicy(POLICY *policy); -void SetUserPolicy(USER *u, POLICY *policy); -void OverwritePolicy(POLICY **target, POLICY *p); -void SetGroupPolicy(USERGROUP *g, POLICY *policy); -POLICY *GetGroupPolicy(USERGROUP *g); -wchar_t *GetPolicyTitle(UINT id); -wchar_t *GetPolicyDescription(UINT id); -bool IsUserName(char *name); -void *CopyAuthData(void *authdata, UINT authtype); -UINT PolicyNum(); -bool PolicyIsSupportedForCascade(UINT i); -UINT PolicyStrToId(char *name); -char *PolicyIdToStr(UINT i); -POLICY_ITEM *GetPolicyItem(UINT id); -void GetPolicyValueRangeStr(wchar_t *str, UINT size, UINT id); -void FormatPolicyValue(wchar_t *str, UINT size, UINT id, UINT value); -bool GetUserMacAddressFromUserNote(UCHAR *mac, wchar_t *note); -UINT GetUserIPv4AddressFromUserNote32(wchar_t *note); - -#endif // ACCOUNT_H +// SoftEther VPN Source Code - Developer Edition Master Branch +// Cedar Communication Module + + +// Account.h +// Header of Account.c + +#ifndef ACCOUNT_H +#define ACCOUNT_H + +#define USER_MAC_STR_PREFIX L"MAC:" +#define USER_IPV4_STR_PREFIX L"IPv4:" + +// Policy item +struct POLICY_ITEM +{ + UINT Index; + bool TypeInt; + bool AllowZero; + UINT MinValue; + UINT MaxValue; + UINT DefaultValue; + char *FormatStr; +}; + +// Policy +struct POLICY +{ + // For Ver 2.0 + bool Access; // Grant access + bool DHCPFilter; // Filter DHCP packets (IPv4) + bool DHCPNoServer; // Prohibit the behavior of the DHCP server (IPv4) + bool DHCPForce; // Force DHCP-assigned IP address (IPv4) + bool NoBridge; // Prohibit the bridge behavior + bool NoRouting; // Prohibit the router behavior (IPv4) + bool CheckMac; // Prohibit the duplicate MAC address + bool CheckIP; // Prohibit a duplicate IP address (IPv4) + bool ArpDhcpOnly; // Prohibit the broadcast other than ARP, DHCP, ICMPv6 + bool PrivacyFilter; // Privacy filter mode + bool NoServer; // Prohibit to operate as a TCP/IP server (IPv4) + bool NoBroadcastLimiter; // Not to limit the number of broadcast + bool MonitorPort; // Allow monitoring mode + UINT MaxConnection; // Maximum number of TCP connections + UINT TimeOut; // Communication time-out period + UINT MaxMac; // Maximum number of MAC address + UINT MaxIP; // Maximum number of IP address (IPv4) + UINT MaxUpload; // Upload bandwidth + UINT MaxDownload; // Download bandwidth + bool FixPassword; // User can not change password + UINT MultiLogins; // Multiple logins limit + bool NoQoS; // Prohibit the use of VoIP / QoS features + + // For Ver 3.0 + bool RSandRAFilter; // Filter the Router Solicitation / Advertising packet (IPv6) + bool RAFilter; // Filter the router advertisement packet (IPv6) + bool DHCPv6Filter; // Filter DHCP packets (IPv6) + bool DHCPv6NoServer; // Prohibit the behavior of the DHCP server (IPv6) + bool NoRoutingV6; // Prohibit the router behavior (IPv6) + bool CheckIPv6; // Prohibit the duplicate IP address (IPv6) + bool NoServerV6; // Prohibit to operate as a TCP/IP server (IPv6) + UINT MaxIPv6; // Maximum number of IP address (IPv6) + bool NoSavePassword; // Prohibit to save the password in the VPN Client + UINT AutoDisconnect; // Disconnect the VPN Client automatically at a certain period of time + bool FilterIPv4; // Filter all IPv4 packets + bool FilterIPv6; // Filter all IPv6 packets + bool FilterNonIP; // Filter all non-IP packets + bool NoIPv6DefaultRouterInRA; // Delete the default router specification from the IPv6 router advertisement + bool NoIPv6DefaultRouterInRAWhenIPv6; // Delete the default router specification from the IPv6 router advertisement (Enable IPv6 connection) + UINT VLanId; // Specify the VLAN ID + + bool Ver3; // Whether version 3.0 +}; + +// Group +struct USERGROUP +{ + LOCK *lock; // Lock + REF *ref; // Reference counter + char *Name; // Group name + wchar_t *RealName; // Display name + wchar_t *Note; // Note + POLICY *Policy; // Policy + TRAFFIC *Traffic; // Traffic data +}; + +// User +struct USER +{ + LOCK *lock; // Lock + REF *ref; // Reference counter + char *Name; // User name + wchar_t *RealName; // Real name + wchar_t *Note; // Note + char *GroupName; // Group name + USERGROUP *Group; // Group + UINT AuthType; // Authentication type + void *AuthData; // Authentication data + UINT64 CreatedTime; // Creation date and time + UINT64 UpdatedTime; // Updating date + UINT64 ExpireTime; // Expiration date + UINT64 LastLoginTime; // Last login time + UINT NumLogin; // Total number of logins + POLICY *Policy; // Policy + TRAFFIC *Traffic; // Traffic data +}; + +// Password authentication data +struct AUTHPASSWORD +{ + UCHAR HashedKey[SHA1_SIZE]; // Hashed passwords + UCHAR NtLmSecureHash[MD5_SIZE]; // Encrypted password for the NTLM +}; + +// User certificate authentication data +struct AUTHUSERCERT +{ + X *UserX; // X509 certificate for the user +}; + +// Root certification authority authentication data +struct AUTHROOTCERT +{ + X_SERIAL *Serial; // Serial number + wchar_t *CommonName; // CommonName +}; + +// Radius authentication data +struct AUTHRADIUS +{ + wchar_t *RadiusUsername; // User name in the Radius +}; + +// Windows NT authentication data +struct AUTHNT +{ + wchar_t *NtUsername; // User name on NT +}; + + + +// Macro +#define POLICY_CURRENT_VERSION 3 +#define NUM_POLICY_ITEM ((sizeof(POLICY) / sizeof(UINT)) - 1) +#define NUM_POLICY_ITEM_FOR_VER2 22 +#define NUM_POLICY_ITEM_FOR_VER3 38 + +#define IS_POLICY_FOR_VER2(index) (((index) >= 0) && ((index) < NUM_POLICY_ITEM_FOR_VER2)) +#define IS_POLICY_FOR_VER3(index) (((index) >= 0) && ((index) < NUM_POLICY_ITEM_FOR_VER3)) + +#define IS_POLICY_FOR_CURRENT_VER(index, ver) ((ver) >= 3 ? IS_POLICY_FOR_VER3(index) : IS_POLICY_FOR_VER2(index)) + +#define POLICY_BOOL(p, i) (((bool *)(p))[(i)]) +#define POLICY_INT(p, i) (((UINT *)(p))[(i)]) + +extern POLICY_ITEM policy_item[]; + + + + +// Function prototype +int CompareUserName(void *p1, void *p2); +int CompareGroupName(void *p1, void *p2); +void AcLock(HUB *h); +void AcUnlock(HUB *h); +USERGROUP *NewGroup(char *name, wchar_t *realname, wchar_t *note); +void ReleaseGroup(USERGROUP *g); +void CleanupGroup(USERGROUP *g); +USER *NewUser(char *name, wchar_t *realname, wchar_t *note, UINT authtype, void *authdata); +void ReleaseUser(USER *u); +void CleanupUser(USER *u); +void FreeAuthData(UINT authtype, void *authdata); +bool AcAddUser(HUB *h, USER *u); +bool AcAddGroup(HUB *h, USERGROUP *g); +USER *AcGetUser(HUB *h, char *name); +USERGROUP *AcGetGroup(HUB *h, char *name); +bool AcIsUser(HUB *h, char *name); +bool AcIsGroup(HUB *h, char *name); +bool AcDeleteUser(HUB *h, char *name); +bool AcDeleteGroup(HUB *h, char *name); +void JoinUserToGroup(USER *u, USERGROUP *g); +void SetUserTraffic(USER *u, TRAFFIC *t); +void SetGroupTraffic(USERGROUP *g, TRAFFIC *t); +void SetUserAuthData(USER *u, UINT authtype, void *authdata); +void *NewPasswordAuthData(char *username, char *password); +void *NewPasswordAuthDataRaw(UCHAR *hashed_password, UCHAR *ntlm_secure_hash); +void *NewUserCertAuthData(X *x); +void *NewRootCertAuthData(X_SERIAL *serial, wchar_t *common_name); +void *NewRadiusAuthData(wchar_t *username); +void *NewNTAuthData(wchar_t *username); +void HashPassword(void *dst, char *username, char *password); +POLICY *GetDefaultPolicy(); +POLICY *ClonePolicy(POLICY *policy); +void SetUserPolicy(USER *u, POLICY *policy); +void OverwritePolicy(POLICY **target, POLICY *p); +void SetGroupPolicy(USERGROUP *g, POLICY *policy); +POLICY *GetGroupPolicy(USERGROUP *g); +wchar_t *GetPolicyTitle(UINT id); +wchar_t *GetPolicyDescription(UINT id); +bool IsUserName(char *name); +void *CopyAuthData(void *authdata, UINT authtype); +UINT PolicyNum(); +bool PolicyIsSupportedForCascade(UINT i); +UINT PolicyStrToId(char *name); +char *PolicyIdToStr(UINT i); +POLICY_ITEM *GetPolicyItem(UINT id); +void GetPolicyValueRangeStr(wchar_t *str, UINT size, UINT id); +void FormatPolicyValue(wchar_t *str, UINT size, UINT id, UINT value); +bool GetUserMacAddressFromUserNote(UCHAR *mac, wchar_t *note); +UINT GetUserIPv4AddressFromUserNote32(wchar_t *note); + +#endif // ACCOUNT_H diff --git a/src/Cedar/Admin.c b/src/Cedar/Admin.c index 556d90be..1571842a 100644 --- a/src/Cedar/Admin.c +++ b/src/Cedar/Admin.c @@ -1,15505 +1,15505 @@ -// SoftEther VPN Source Code - Developer Edition Master Branch -// Cedar Communication Module - - -// Admin.c -// RPC Module for Management - -#include "CedarPch.h" - -// Macro for RPC function declaration -#define DECLARE_RPC_EX(rpc_name, data_type, function, in_rpc, out_rpc, free_rpc) \ - else if (StrCmpi(name, rpc_name) == 0) \ - { \ - data_type *t; \ - t = ZeroMalloc(sizeof(data_type)); \ - in_rpc(t, p); \ - err = function(a, t); \ - if (err == ERR_NO_ERROR) \ - { \ - out_rpc(ret, t); \ - } \ - free_rpc(t); \ - Free(t); \ - ok = true; \ - } -#define DECLARE_RPC(rpc_name, data_type, function, in_rpc, out_rpc) \ - else if (StrCmpi(name, rpc_name) == 0) \ - { \ - data_type *t; \ - t = ZeroMalloc(sizeof(data_type)); \ - in_rpc(t, p); \ - err = function(a, t); \ - if (err == ERR_NO_ERROR) \ - { \ - out_rpc(ret, t); \ - } \ - Free(t); \ - ok = true; \ - } -#define DECLARE_SC_EX(rpc_name, data_type, function, in_rpc, out_rpc, free_rpc) \ - UINT function(RPC *r, data_type *t) \ - { \ - PACK *p, *ret; \ - UINT err; \ - if (r == NULL || t == NULL) \ - { \ - return ERR_INTERNAL_ERROR; \ - } \ - p = NewPack(); \ - out_rpc(p, t); \ - free_rpc(t); \ - Zero(t, sizeof(data_type)); \ - ret = AdminCall(r, rpc_name, p); \ - err = GetErrorFromPack(ret); \ - if (err == ERR_NO_ERROR) \ - { \ - in_rpc(t, ret); \ - } \ - FreePack(ret); \ - return err; \ - } -#define DECLARE_SC(rpc_name, data_type, function, in_rpc, out_rpc) \ - UINT function(RPC *r, data_type *t) \ - { \ - PACK *p, *ret; \ - UINT err; \ - if (r == NULL || t == NULL) \ - { \ - return ERR_INTERNAL_ERROR; \ - } \ - p = NewPack(); \ - out_rpc(p, t); \ - ret = AdminCall(r, rpc_name, p); \ - err = GetErrorFromPack(ret); \ - if (err == ERR_NO_ERROR) \ - { \ - in_rpc(t, ret); \ - } \ - FreePack(ret); \ - return err; \ - } -#define CHECK_RIGHT \ - if (a->ServerAdmin == false && (StrCmpi(a->HubName, t->HubName) != 0)) \ - return ERR_NOT_ENOUGH_RIGHT; \ - if (IsEmptyStr(t->HubName)) \ - return ERR_INVALID_PARAMETER; -#define SERVER_ADMIN_ONLY \ - if (a->ServerAdmin == false) \ - return ERR_NOT_ENOUGH_RIGHT; -#define NO_SUPPORT_FOR_BRIDGE \ - if (a->Server->Cedar->Bridge) \ - return ERR_NOT_SUPPORTED; - -// Get server Caps (Guessing from the build number if failed to get Caps) -CAPSLIST *ScGetCapsEx(RPC *rpc) -{ - RPC_SERVER_INFO info; - CAPSLIST *t; - bool is_bridge = false; - // Validate arguments - if (rpc == NULL) - { - return NULL; - } - - Zero(&info, sizeof(info)); - ScGetServerInfo(rpc, &info); - - t = ZeroMalloc(sizeof(CAPSLIST)); - - // Try to get Caps by RPC - if (ScGetCaps(rpc, t) != ERR_NO_ERROR) - { - UINT build; - - Free(t); - t = NewCapsList(); - - // Since acquisition of Caps went wrong, get build number - build = info.ServerBuildInt; - - is_bridge = (SearchStrEx(info.ServerProductName, "bridge", 0, false) == INFINITE) ? false : true; - - AddCapsInt(t, "i_max_packet_size", 1514); - - if (is_bridge == false) - { - AddCapsInt(t, "i_max_hubs", 4096); - AddCapsInt(t, "i_max_sessions", 4096); - - if (info.ServerType != SERVER_TYPE_FARM_MEMBER) - { - AddCapsInt(t, "i_max_users_per_hub", 10000); - AddCapsInt(t, "i_max_groups_per_hub", 10000); - AddCapsInt(t, "i_max_access_lists", 4096); - } - else - { - AddCapsInt(t, "i_max_users_per_hub", 0); - AddCapsInt(t, "i_max_groups_per_hub", 0); - AddCapsInt(t, "i_max_access_lists", 0); - } - } - else - { - AddCapsInt(t, "i_max_hubs", 0); - AddCapsInt(t, "i_max_sessions", 0); - AddCapsInt(t, "i_max_users_per_hub", 0); - AddCapsInt(t, "i_max_groups_per_hub", 0); - AddCapsInt(t, "i_max_access_lists", 0); - } - - AddCapsInt(t, "i_max_mac_tables", 10000); - AddCapsInt(t, "i_max_ip_tables", 10000); - - if (info.ServerType == SERVER_TYPE_STANDALONE) - { - AddCapsBool(t, "b_support_securenat", (build >= 3600) ? true : false); - AddCapsInt(t, "i_max_secnat_tables", 4096); - } - else - { - AddCapsBool(t, "b_support_securenat", false); - AddCapsInt(t, "i_max_secnat_tables", 0); - } - - if (is_bridge) - { - AddCapsBool(t, "b_bridge", true); - } - else if (info.ServerType == SERVER_TYPE_STANDALONE) - { - AddCapsBool(t, "b_standalone", true); - } - else if (info.ServerType == SERVER_TYPE_FARM_CONTROLLER) - { - AddCapsBool(t, "b_cluster_controller", true); - } - else - { - AddCapsBool(t, "b_cluster_member", true); - } - - AddCapsBool(t, "b_support_config_hub", info.ServerType != SERVER_TYPE_FARM_MEMBER && - is_bridge == false); - - AddCapsBool(t, "b_vpn_client_connect", is_bridge == false ? true : false); - - AddCapsBool(t, "b_support_radius", info.ServerType != SERVER_TYPE_FARM_MEMBER && - is_bridge == false); - - if (build >= 3600) - { - RPC_BRIDGE_SUPPORT b; - Zero(&b, sizeof(b)); - if (ScGetBridgeSupport(rpc, &b) == ERR_NO_ERROR) - { - AddCapsBool(t, "b_local_bridge", b.IsBridgeSupportedOs); - AddCapsBool(t, "b_must_install_pcap", b.IsWinPcapNeeded); - } - else - { - AddCapsBool(t, "b_local_bridge", false); - AddCapsBool(t, "b_must_install_pcap", false); - } - } - else - { - AddCapsBool(t, "b_local_bridge", false); - AddCapsBool(t, "b_must_install_pcap", false); - } - - AddCapsBool(t, "b_tap_supported", false); - - if (info.ServerType == SERVER_TYPE_STANDALONE) - { - AddCapsBool(t, "b_support_cascade", true); - } - else - { - AddCapsBool(t, "b_support_cascade", false); - } - - AddCapsBool(t, "b_support_cascade_cert", false); - AddCapsBool(t, "b_support_config_log", info.ServerType != SERVER_TYPE_FARM_MEMBER); - AddCapsBool(t, "b_support_autodelete", false); - } - else - { - // Success getting Caps - if (info.ServerBuildInt <= 4350) - { - if (is_bridge == false) - { - // b_support_cluster should be true for build 4300 or earlier - CAPS *caps = GetCaps(t, "b_support_cluster"); - if (caps == NULL) - { - AddCapsBool(t, "b_support_cluster", true); - } - else - { - caps->Value = 1; - } - } - } - } - - if (true) - { - TOKEN_LIST *names; - - // Fill items that doesn't exist in server-side as false - names = GetTableNameStartWith("CT_b_"); - if (names != NULL) - { - UINT i; - for (i = 0;i < names->NumTokens;i++) - { - char *name = names->Token[i] + 3; - - if (GetCaps(t, name) == NULL) - { - AddCapsBool(t, name, false); - } - } - - FreeToken(names); - } - } - - FreeRpcServerInfo(&info); - - return t; -} - - - -// Process server side include -BUF *AdminWebProcessServerSideInclude(BUF *src_txt, char *filename, UINT depth) -{ - char *src_str; - UINT src_str_size; - UINT i, len; - BUF *ret = NULL; - UINT pos = 0; - char dirname[MAX_PATH]; - if (src_txt == NULL || filename == NULL || depth >= 4) - { - return CloneBuf(src_txt); - } - if (EndWith(filename, ".html") == false) - { - // We process only .html files - return CloneBuf(src_txt); - } - - GetDirNameFromFilePath(dirname, sizeof(dirname), filename); - - src_str_size = src_txt->Size + 1; - src_str = ZeroMalloc(src_str_size); - - Copy(src_str, src_txt->Buf, src_txt->Size); - - len = StrLen(src_str); - - ret = NewBuf(); - - for (i = 0;i < len;i++) - { - char *start_tag = ""; - UINT x; - - Zero(inc_filename, sizeof(inc_filename)); - - StrCpy(inc_filename, sizeof(inc_filename), src_str + i + StrLen(start_tag) + 1); - inc_filename[b - (i + StrLen(start_tag) + 1)] = 0; - - x = SearchStrEx(src_str, end_tag, b + 1, true); - - if ((x != INFINITE) && (x >= (b + 1))) - { - BUF *inc_buf; - char full_inc_filename[MAX_PATH]; - - if (StartWith(inc_filename, "/")) - { - Format(full_inc_filename, sizeof(full_inc_filename), "|wwwroot/%s", inc_filename + 1); - } - else - { - StrCpy(full_inc_filename, sizeof(full_inc_filename), dirname); - StrCat(full_inc_filename, sizeof(full_inc_filename), "/"); - StrCat(full_inc_filename, sizeof(full_inc_filename), inc_filename); - } - - Debug("dirname = %s, full_inc_filename (src) = %s\n\n", dirname, full_inc_filename); - NormalizePath(full_inc_filename, sizeof(full_inc_filename), full_inc_filename); - - if (StartWith(full_inc_filename, "|wwwroot/") == false - && StartWith(full_inc_filename, "|wwwroot\\") == false) - { - char tmp[MAX_PATH]; - Format(tmp, sizeof(tmp), "|wwwroot/%s", full_inc_filename); - StrCpy(full_inc_filename, sizeof(full_inc_filename), tmp); - } - - Debug("inc_filename = %s\nfull_inc_filename = %s\n\n", inc_filename, full_inc_filename); - - inc_buf = ReadDump(full_inc_filename); - - if (inc_buf != NULL) - { - BUF *inc_buf2; - - inc_buf2 = AdminWebProcessServerSideInclude(inc_buf, full_inc_filename, depth + 1); - - BufSkipUtf8Bom(inc_buf2); - WriteBufBufWithOffset(ret, inc_buf2); - - FreeBuf(inc_buf); - FreeBuf(inc_buf2); - } - else - { - Debug("Loading SSI '%s' error.\n", inc_buf); - } - - i = (x + StrLen(end_tag) - 1); - - is_ssi = true; - } - } - } - } - - if (is_ssi == false) - { - WriteBufChar(ret, src_str[i]); - } - } - - Free(src_str); - - return ret; -} - -// Handle the file request -bool AdminWebHandleFileRequest(ADMIN *a, CONNECTION *c, SOCK *s, HTTP_HEADER *h, char *url_src, char *query_string, char *virtual_root_dir, char *physical_root_dir) -{ - bool ret = false; - char url[MAX_PATH]; - UINT i, len; - if (a == NULL || c == NULL || s == NULL || h == NULL || query_string == NULL || - virtual_root_dir == NULL || physical_root_dir == NULL) - { - return false; - } - - StrCpy(url, sizeof(url), url_src); - - len = StrLen(url); - for (i = 0;i < len;i++) - { - if (url[i] == '\\') - { - url[i] = '/'; - } - } - - // Is dangerous URL? - if (InStr(url, "..") || InStr(url, "//") || InStr(url, "\\\\") || InStr(url, "/\\") || InStr(url, "\\/")) - { - ret = AdminWebSend404Error(s, h); - } - else - { - char filename[MAX_PATH]; - bool is_index_file = false; - - BUF *b = AdminWebTryFindAndReadFile(virtual_root_dir, physical_root_dir, url, - filename, sizeof(filename), &is_index_file); - - if (b == NULL) - { - ret = AdminWebSend404Error(s, h); - } - else - { - if (is_index_file && EndWith(url, "/") == false) - { - char url2[MAX_PATH]; - StrCpy(url2, sizeof(url2), url); - StrCat(url2, sizeof(url2), "/"); - ret = AdminWebSend302Redirect(s, url2, query_string, h); - } - else if (is_index_file == false && EndWith(url, "/")) - { - char url2[MAX_PATH]; - TrimEndWith(url2, sizeof(url2), url, "/"); - ret = AdminWebSend302Redirect(s, url2, query_string, h); - } - else - { - BUF *b2 = AdminWebProcessServerSideInclude(b, filename, 0); - char *mime = GetMimeTypeFromFileName(filename); - - if (mime == NULL) - { - mime = "application/octet-stream"; - } - - ret = AdminWebSendBody(s, 200, "OK", b2->Buf, b2->Size, mime, NULL, NULL, h); - - FreeBuf(b2); - } - FreeBuf(b); - } - } - - return ret; -} - -// Try to find a file, and if exists return the file contents -BUF *AdminWebTryFindAndReadFile(char *vroot, char *proot, char *url, char *ret_filename, UINT ret_filename_size, bool *is_index_html) -{ - char tmp[MAX_PATH]; - char tmp2[MAX_PATH]; - UINT vroot_len; - UINT url_len; - char relative_path[MAX_PATH]; - BUF *b; - if (vroot == NULL || proot == NULL || url == NULL || ret_filename == NULL || is_index_html == NULL) - { - return NULL; - } - - *is_index_html = false; - - if (StartWith(url, vroot) == false) - { - return NULL; - } - - vroot_len = StrLen(vroot); - url_len = StrLen(url); - - StrCpy(relative_path, sizeof(relative_path), url + vroot_len); - - if (StartWith(relative_path, "/")) - { - char tmp3[MAX_PATH]; - - StrCpy(tmp3, sizeof(tmp3), relative_path + 1); - StrCpy(relative_path, sizeof(relative_path), tmp3); - } - - CombinePath(tmp, sizeof(tmp), proot, relative_path); - - // index.html - CombinePath(tmp2, sizeof(tmp2), tmp, "index.html"); - b = AdminWebTryOneFile(tmp2, ret_filename, ret_filename_size); - if (b != NULL) - { - *is_index_html = true; - return b; - } - - // dirname/filename - StrCpy(tmp2, sizeof(tmp2), tmp); - b = AdminWebTryOneFile(tmp2, ret_filename, ret_filename_size); - if (b != NULL) - { - return b; - } - - return NULL; -} -BUF *AdminWebTryOneFile(char *filename, char *ret_filename, UINT ret_filename_size) -{ - BUF *b; - if (filename == NULL || ret_filename == NULL) - { - return NULL; - } - - b = ReadDump(filename); - if (b == NULL) - { - return NULL; - } - - StrCpy(ret_filename, ret_filename_size, filename); - - return b; -} - -// Send a 401 Unauthorized error -bool AdminWebSendUnauthorized(SOCK *s, HTTP_HEADER *http_request_headers) -{ - char *http_401_str = "\r\n\r\n401 Unauthorized\r\n\r\n

" CEDAR_SERVER_STR ": Administrative authentication required.

\r\n

This VPN Server could not verify that you are authorized to access to the \r\nserver in administrative mode.

\r\n

For web browser logins:
You must supply the HTTP basic \r\nauthentication credential as following.

\r\n
    \r\n\t
  • To login to the VPN server as the entire server administrator, specify empty or "administrator" as the username field, and specify the server administrative \r\n\tpassword as the password field.
  • \r\n\t
  • To login to a particular Virtual Hub as the hub administrator, specify \r\n\tthe hub name as the username field, and specify the hub administrative \r\n\tpassword as the password field.
  • \r\n
\r\n

For JSON-RPC client logins:
Instead to HTTP basic \r\nauthentication, you can also specify the HTTP header parameters as following.

\r\n
    \r\n\t
  • X-VPNADMIN-HUBNAME: Empty to login to the VPN Server as the entire \r\n\tserver administrator, or specify the target Virtual Hub name as the hub \r\n\tadministrator.
  • \r\n\t
  • X-VPNADMIN-PASSWORD: Specify the administrative password.
  • \r\n
\r\n\r\n"; - bool ret; - // Validate arguments - if (s == NULL || http_request_headers == NULL) - { - return false; - } - - // Creating a Data - ret = AdminWebSendBody(s, 401, "Unauthorized", http_401_str, StrLen(http_401_str), HTTP_CONTENT_TYPE, - "WWW-Authenticate", - "Basic realm=\"Username 'administrator' for entire VPN Server privilege, or specify Virtual Hub name as the username for specified Virtual Hub administrative privilege.\"", - http_request_headers); - - return ret; -} - -// Send reply -bool AdminWebSendBody(SOCK *s, UINT status_code, char *status_string, UCHAR *data, UINT data_size, char *content_type, char *add_header_name, char *add_header_value, - HTTP_HEADER *request_headers) -{ - HTTP_HEADER *h; - char date_str[MAX_SIZE]; - char error_code_str[16]; - bool ret = false; - HTTP_VALUE *origin; - if (s == NULL || status_string == NULL || (data_size != 0 && data == NULL) || request_headers == NULL) - { - return false; - } - if (content_type == NULL) - { - content_type = "text/html; charset=utf-8"; - } - - ToStr(error_code_str, status_code); - GetHttpDateStr(date_str, sizeof(date_str), SystemTime64()); - - h = NewHttpHeader("HTTP/1.1", error_code_str, status_string); - - if (StrCmpi(request_headers->Method, "OPTIONS") == 0) - { - AddHttpValue(h, NewHttpValue("Allow", "OPTIONS, GET, POST")); - } - - AddHttpValue(h, NewHttpValue("Cache-Control", "no-cache")); - AddHttpValue(h, NewHttpValue("Content-Type", content_type)); - AddHttpValue(h, NewHttpValue("Date", date_str)); - AddHttpValue(h, NewHttpValue("Connection", "Keep-Alive")); - AddHttpValue(h, NewHttpValue("Access-Control-Allow-Methods", "OPTIONS,GET,POST")); - AddHttpValue(h, NewHttpValue("Access-Control-Allow-Headers", "X-VPNADMIN-HUBNAME,X-VPNADMIN-PASSWORD")); - AddHttpValue(h, NewHttpValue("Access-Control-Allow-Credentials", "true")); - - origin = GetHttpValue(request_headers, "Origin"); - if (origin != NULL) - { - AddHttpValue(h, NewHttpValue("Access-Control-Allow-Origin", origin->Data)); - } - - if (add_header_name != NULL && add_header_value != NULL) - { - AddHttpValue(h, NewHttpValue(add_header_name, add_header_value)); - } - - ret = PostHttp(s, h, data, data_size); - - FreeHttpHeader(h); - - return ret; -} - -// Send 404 error -bool AdminWebSend404Error(SOCK *s, HTTP_HEADER *request_headers) -{ - char *body = "\r\n404 Not Found

Not Found

The requested URL was not found on this server.

\r\n"; - if (s == NULL || request_headers == NULL) - { - return false; - } - - return AdminWebSendBody(s, 404, "Not Found", body, StrLen(body), NULL, NULL, NULL, request_headers); -} - -// Send 302 redirect -bool AdminWebSend302Redirect(SOCK *s, char *url, char *query_string, HTTP_HEADER *request_headers) -{ - bool ret = false; - char *txt; - UINT txt_size; - char *url2; - UINT url2_size; - char *body = "Object moved\r\n

Object moved to here.

\r\n"; - if (s == NULL || url == NULL || request_headers == NULL) - { - return false; - } - - url2_size = (StrSize(url) + StrSize(query_string) + MAX_SIZE) * 2; - url2 = ZeroMalloc(url2_size); - - StrCpy(url2, url2_size, url); - if (IsEmptyStr(query_string) == false) - { - StrCat(url2, url2_size, "?"); - StrCat(url2, url2_size, query_string); - } - - txt_size = (StrSize(body) + StrSize(url2) + MAX_SIZE) * 2; - txt = ZeroMalloc(txt_size); - - ReplaceStrEx(txt, txt_size, body, "$URL$", url2, false); - - ret = AdminWebSendBody(s, 302, "Found", txt, StrLen(txt), NULL, "Location", url2, request_headers); - - Free(txt); - - Free(url2); - - return ret; -} - -// "/admin" web page POST handler -void AdminWebProcPost(CONNECTION *c, SOCK *s, HTTP_HEADER *h, UINT post_data_size, char *url_target) -{ - ADMIN *a; - UCHAR *data; - char url[MAX_PATH]; - char query_string[MAX_SIZE]; - UINT i; - if (c == NULL || s == NULL || h == NULL || url_target == NULL) - { - return; - } - - a = JsonRpcAuthLogin(c->Cedar, s, h); - if (a == NULL) - { - RecvAllWithDiscard(s, post_data_size, s->SecureMode); - AdminWebSendUnauthorized(s, h); - return; - } - - if (post_data_size > a->MaxJsonRpcRecvSize) - { - Disconnect(s); - return; - } - - data = ZeroMalloc(post_data_size + 1); - - if (RecvAll(s, data, post_data_size, s->SecureMode)) - { - c->JsonRpcAuthed = true; -#ifndef GC_SOFTETHER_OSS - RemoveDosEntry(c->Listener, s); -#endif // GC_SOFTETHER_OSS - - // Divide url_target into URL and query string - StrCpy(url, sizeof(url), url_target); - Zero(query_string, sizeof(query_string)); - i = SearchStr(url, "?", 0); - if (i != INFINITE) - { - StrCpy(query_string, sizeof(query_string), url + i + 1); - url[i] = 0; - } - - AdminWebHandleFileRequest(a, c, s, h, url, query_string, "/admin", "|wwwroot/admin"); - } - - Free(data); - Free(a); -} - -// "/admin" web page GET handler -void AdminWebProcGet(CONNECTION *c, SOCK *s, HTTP_HEADER *h, char *url_target) -{ - ADMIN *a; - char url[MAX_PATH]; - char query_string[MAX_SIZE]; - UINT i; - if (c == NULL || s == NULL || h == NULL || url_target == NULL) - { - return; - } - - a = JsonRpcAuthLogin(c->Cedar, s, h); - if (a == NULL) - { - AdminWebSendUnauthorized(s, h); - return; - } - - c->JsonRpcAuthed = true; -#ifndef GC_SOFTETHER_OSS - RemoveDosEntry(c->Listener, s); -#endif // GC_SOFTETHER_OSS - - // Divide url_target into URL and query string - StrCpy(url, sizeof(url), url_target); - Zero(query_string, sizeof(query_string)); - i = SearchStr(url, "?", 0); - if (i != INFINITE) - { - StrCpy(query_string, sizeof(query_string), url + i + 1); - url[i] = 0; - } - - AdminWebHandleFileRequest(a, c, s, h, url, query_string, "/admin", "|wwwroot/admin"); - - Free(a); -} - -// New JSON-RPC Result -JSON_VALUE *JsonRpcNewResponse(PACK *p) -{ - JSON_VALUE *jv; - JSON_OBJECT *jo; - JSON_VALUE *jv2; - - if (p == NULL) - { - return NULL; - } - - jv = JsonNewObject(); - jo = JsonValueGetObject(jv); - - jv2 = PackToJson(p); - - JsonSet(jo, "result", jv2); - - return jv; -} - -// New JSON-RPC Error -JSON_VALUE *JsonRpcNewError(int code, wchar_t *message) -{ - wchar_t msg[MAX_PATH]; - JSON_VALUE *jv; - JSON_OBJECT *jo; - JSON_VALUE *jv2; - JSON_OBJECT *jo2; - - if (UniIsEmptyStr(message)) - { - UniFormat(msg, sizeof(msg), L"Error code %u", code); - } - else - { - UniFormat(msg, sizeof(msg), L"Error code %u: %s", code, message); - } - - jv = JsonNewObject(); - jo = JsonValueGetObject(jv); - - jv2 = JsonNewObject(); - jo2 = JsonValueGetObject(jv2); - - JsonSet(jo, "error", jv2); - - JsonSetNumber(jo2, "code", (UINT64)code); - JsonSetUniStr(jo2, "message", msg); - - return jv; -} - -// JSON-RPC process request object -JSON_VALUE *JsonRpcProcRequestObject(ADMIN *admin, CONNECTION *c, SOCK *s, JSON_VALUE *json_req, char *method_name) -{ - PACK *pack_request; - JSON_VALUE *ret = NULL; - if (c == NULL || s == NULL || json_req == NULL || admin == NULL) - { - return NULL; - } - - pack_request = JsonToPack(json_req); - - PackAddStr(pack_request, "function_name", method_name); - - if (pack_request != NULL) - { - RPC *rpc; - PACK *pack_response; - UINT err; - - // RPC Server - rpc = StartRpcServer(s, AdminDispatch, admin); - - admin->Rpc = rpc; - - pack_response = CallRpcDispatcher(rpc, pack_request); - - if (pack_response == NULL) - { - pack_response = PackError(ERR_NOT_SUPPORTED); - } - - RpcFreeEx(rpc, true); - - FreePack(pack_request); - - // Construct response object - err = GetErrorFromPack(pack_response); - if (err != 0) - { - // Return the error - ret = JsonRpcNewError(err, _E(err)); - } - else - { - // Return the PACK - ret = JsonRpcNewResponse(pack_response); - } - - SLog(admin->Server->Cedar, "LS_API_RPC_CALL", - &s->RemoteIP, s->RemotePort, s->RemoteHostname, - method_name, err, _E(err)); - - FreePack(pack_response); - } - - return ret; -} - -// JSON-RPC HTTP user authentication -bool HttpParseBasicAuthHeader(HTTP_HEADER *h, char *username, UINT username_size, char *password, UINT password_size) -{ - bool ret = false; - HTTP_VALUE *auth_value; - HTTP_VALUE *vpnadmin_hubname; - HTTP_VALUE *vpnadmin_password; - if (h == NULL || username == NULL || password == NULL) - { - return false; - } - - auth_value = GetHttpValue(h, "Authorization"); - vpnadmin_hubname = GetHttpValue(h, "X-VPNADMIN-HUBNAME"); - vpnadmin_password = GetHttpValue(h, "X-VPNADMIN-PASSWORD"); - - if (vpnadmin_password != NULL) - { - if (vpnadmin_hubname == NULL) - { - StrCpy(username, username_size, ""); - } - else - { - StrCpy(username, username_size, vpnadmin_hubname->Data); - } - - StrCpy(password, password_size, vpnadmin_password->Data); - - ret = true; - } - - if (ret == false && auth_value != NULL) - { - char key[32], value[MAX_SIZE]; - - if (GetKeyAndValue(auth_value->Data, key, sizeof(key), value, sizeof(value), " \t")) - { - if (StrCmpi(key, "Basic") == 0 && IsEmptyStr(value) == false) - { - UINT b64_dest_size = StrSize(value) * 2 + 256; - char *b64_dest = ZeroMalloc(b64_dest_size); - - Decode64(b64_dest, value); - - if (IsEmptyStr(b64_dest) == false) - { - if (b64_dest[0] == ':') - { - // Empty username - StrCpy(username, username_size, ""); - StrCpy(password, password_size, b64_dest + 1); - ret = true; - } - else - { - if (GetKeyAndValue(b64_dest, username, username_size, password, password_size, ":")) - { - ret = true; - } - } - } - - Free(b64_dest); - } - } - } - - return ret; -} - -// JSON-RPC Login -ADMIN *JsonRpcAuthLogin(CEDAR *c, SOCK *sock, HTTP_HEADER *h) -{ - ADMIN *a = NULL; - char username[MAX_HUBNAME_LEN + 1]; - char password[MAX_PASSWORD_LEN + 1]; - SERVER *s; - char empty_pw_hash[SHA1_SIZE]; - - if (c == NULL || h == NULL || sock == NULL) - { - return NULL; - } - - s = c->Server; - - HashAdminPassword(empty_pw_hash, ""); - - Zero(username, sizeof(username)); - Zero(password, sizeof(password)); - - if (HttpParseBasicAuthHeader(h, username, sizeof(username), password, sizeof(password))) - { - char pw_hash[SHA1_SIZE]; - bool is_server_admin = false; - bool is_hub_admin = false; - char hub_name[MAX_HUBNAME_LEN + 1]; - - HashAdminPassword(pw_hash, password); - - Zero(hub_name, sizeof(hub_name)); - - // Check if the server administrator password is empty. If yes, login always success. - if (Cmp(s->HashedPassword, empty_pw_hash, SHA1_SIZE) == 0) - { - is_server_admin = true; - } - else - { - if (IsEmptyStr(username) || StrCmpi(username, ADMINISTRATOR_USERNAME) == 0) - { - // If the username is empty or 'administrator', verify with the server admin password. - if (Cmp(s->HashedPassword, pw_hash, SHA1_SIZE) == 0) - { - is_server_admin = true; - } - } - } - - if (is_server_admin == false) - { - HUB *h; - // Hub admin mode - LockHubList(c); - { - h = GetHub(c, username); - } - UnlockHubList(c); - - if (h != NULL) - { - Lock(h->lock); - { - if (Cmp(h->HashedPassword, empty_pw_hash, SHA1_SIZE) != 0 && IsZero(h->HashedPassword, sizeof(h->HashedPassword)) == false) - { - if (Cmp(pw_hash, h->HashedPassword, SHA1_SIZE) == 0) - { - is_hub_admin = true; - - StrCpy(hub_name, sizeof(hub_name), h->Name); - } - } - } - Unlock(h->lock); - - ReleaseHub(h); - } - } - - if (is_server_admin || is_hub_admin) - { - if (CheckAdminSourceAddress(sock, hub_name)) - { - a = ZeroMalloc(sizeof(ADMIN)); - - a->Server = s; - a->ServerAdmin = is_server_admin; - a->ClientBuild = c->Build; - - if (is_hub_admin) - { - StrCpy(a->dummy1, sizeof(a->dummy1), hub_name); - a->HubName = a->dummy1; - } - } - } - } - - if (a != NULL) - { - char admin_mode[256]; - if (a->ServerAdmin) - { - a->MaxJsonRpcRecvSize = ADMIN_RPC_MAX_POST_SIZE_BY_SERVER_ADMIN; - } - else - { - a->MaxJsonRpcRecvSize = ADMIN_RPC_MAX_POST_SIZE_BY_HUB_ADMIN; - } - - if (IsEmptyStr(a->HubName)) - { - StrCpy(admin_mode, sizeof(admin_mode), - "Entire VPN Server Admin Mode"); - } - else - { - Format(admin_mode, sizeof(admin_mode), - "Virtual Hub Admin Mode for '%s'", - a->HubName); - } - - SLog(s->Cedar, "LS_API_AUTH_OK", - &sock->RemoteIP, sock->RemotePort, sock->RemoteHostname, - admin_mode, username, h->Method, h->Target); - } - else - { - SLog(s->Cedar, "LS_API_AUTH_ERROR", - &sock->RemoteIP, sock->RemotePort, sock->RemoteHostname, - username, h->Method, h->Target); - } - - - return a; -} - -// Query string to JSON list value -JSON_VALUE *QueryStringToJsonListValue(char *qs) -{ - TOKEN_LIST *t; - UINT i; - LIST *distinct_list = NULL; - JSON_VALUE *v = NULL; - JSON_OBJECT *o = NULL; - if (qs == NULL) - { - return NULL; - } - - t = ParseTokenWithoutNullStr(qs, "&"); - if (t == NULL) - { - return NULL; - } - - distinct_list = NewStrList(); - - v = JsonNewObject(); - o = JsonValueGetObject(v); - - for (i = 0;i < t->NumTokens;i++) - { - char *token = t->Token[i]; - UINT pos; - - pos = SearchStr(token, "=", 0); - if (pos != INFINITE) - { - char *key_decoded; - char *value_decoded; - char *key = CopyStr(token); - char *value = CopyStr(token + pos + 1); - - key[pos] = 0; - key_decoded = UrlDecode(key); - value_decoded = UrlDecode(value); - - if (key_decoded != NULL && value_decoded != NULL) - { - if (AddStrToStrListDistinct(distinct_list, key_decoded)) - { - JsonSetStr(o, key_decoded, value_decoded); - } - } - - Free(value_decoded); - Free(key_decoded); - Free(key); - Free(value); - } - } - - FreeToken(t); - - FreeStrList(distinct_list); - - return v; -} - -// Construct new JSON-RPC dummy request -JSON_VALUE *ConstructDummyJsonRpcRequest(char *method_name, JSON_VALUE *p) -{ - JSON_VALUE *ret; - JSON_OBJECT *ret_object; - UCHAR rand[16]; - char id_str[64]; - - Rand(rand, sizeof(rand)); - - BinToStr(id_str, sizeof(id_str), rand, sizeof(rand)); - - ret = JsonNewObject(); - ret_object = JsonObject(ret); - - JsonSetStr(ret_object, "jsonrpc", "2.0"); - JsonSetStr(ret_object, "method", method_name); - JsonSet(ret_object, "params", p); - JsonSetStr(ret_object, "id", id_str); - - return ret; -} - -// JSON-RPC Options Dispatch -void JsonRpcProcOptions(CONNECTION *c, SOCK *s, HTTP_HEADER *h, char *url_target) -{ - if (c == NULL || s == NULL || h == NULL || url_target == NULL) - { - return; - } - - c->JsonRpcAuthed = true; - -#ifndef GC_SOFTETHER_OSS - RemoveDosEntry(c->Listener, s); -#endif // GC_SOFTETHER_OSS - - AdminWebSendBody(s, 200, "OK", NULL, 0, NULL, NULL, NULL, h); -} - -// JSON-RPC GET Dispatch -void JsonRpcProcGet(CONNECTION *c, SOCK *s, HTTP_HEADER *h, char *url_target) -{ - ADMIN *a; - char url[MAX_PATH]; - char query_string[MAX_SIZE]; - UINT i; - bool reply_sent = false; - if (c == NULL || s == NULL || h == NULL || url_target == NULL) - { - return; - } - - a = JsonRpcAuthLogin(c->Cedar, s, h); - if (a == NULL) - { - AdminWebSendUnauthorized(s, h); - return; - } - - c->JsonRpcAuthed = true; - -#ifndef GC_SOFTETHER_OSS - RemoveDosEntry(c->Listener, s); -#endif // GC_SOFTETHER_OSS - - // Divide url_target into URL and query string - StrCpy(url, sizeof(url), url_target); - Zero(query_string, sizeof(query_string)); - i = SearchStr(url, "?", 0); - if (i != INFINITE) - { - StrCpy(query_string, sizeof(query_string), url + i + 1); - url[i] = 0; - } - - if (StartWith(url, "/api/")) - { - // Call a method - JSON_VALUE *params_value = NULL; - JSON_OBJECT *params_object = NULL; - UINT i; - char method_name[MAX_PATH]; - - StrCpy(method_name, sizeof(method_name), url + 5); - - i = SearchStr(method_name, "/", 0); - if (i != INFINITE) - { - method_name[i] = 0; - } - - if (IsEmptyStr(method_name) == false) - { - // Call a method - params_value = QueryStringToJsonListValue(query_string); - - if (params_value != NULL) - { - JSON_VALUE *json_ret = NULL; - char id[96]; - char *ret_str = NULL; - - GetDateTimeStrMilli64(id, sizeof(id), LocalTime64()); - - params_object = JsonObject(params_value); - - // Process the request - json_ret = JsonRpcProcRequestObject(a, c, s, params_value, method_name); - - if (json_ret == NULL) - { - json_ret = JsonRpcNewError(ERR_INTERNAL_ERROR, L"Internal error"); - } - - JsonSetStr(JsonObject(json_ret), "jsonrpc", "2.0"); - JsonSetStr(JsonObject(json_ret), "id", id); - - ret_str = JsonToStr(json_ret); - - AdminWebSendBody(s, 200, "OK", ret_str, StrLen(ret_str), "text/plain; charset=UTF-8", NULL, NULL, h); - - Free(ret_str); - JsonFree(json_ret); - JsonFree(params_value); - } - } - } - - - if (reply_sent == false) - { - BUF *html_buf = ReadDump("|vpnserver_api_doc.html"); - - if (html_buf != NULL) - { - AdminWebSendBody(s, 200, "OK", html_buf->Buf, html_buf->Size, "text/html; charset=UTF-8", NULL, NULL, h); - - FreeBuf(html_buf); - } - else - { - AdminWebSend404Error(s, h); - } - } - - if (a->LogFileList != NULL) - { - FreeEnumLogFile(a->LogFileList); - } - Free(a); -} - -// JSON-RPC POST Dispatch -void JsonRpcProcPost(CONNECTION *c, SOCK *s, HTTP_HEADER *h, UINT post_data_size) -{ - ADMIN *a; - UCHAR *data; - if (c == NULL || s == NULL || h == NULL) - { - return; - } - - a = JsonRpcAuthLogin(c->Cedar, s, h); - if (a == NULL) - { - RecvAllWithDiscard(s, post_data_size, s->SecureMode); - AdminWebSendUnauthorized(s, h); - return; - } - - if (post_data_size > a->MaxJsonRpcRecvSize) - { - Disconnect(s); - return; - } - - data = ZeroMalloc(post_data_size + 1); - - if (RecvAll(s, data, post_data_size, s->SecureMode)) - { - // Parse JSON - JSON_VALUE *json_req = StrToJson(data); - JSON_OBJECT *json_req_object = JsonObject(json_req); - JSON_VALUE *json_ret = NULL; - char *res = NULL; - char *request_id = NULL; - char *method_name = NULL; - - c->JsonRpcAuthed = true; - -#ifndef GC_SOFTETHER_OSS - RemoveDosEntry(c->Listener, s); -#endif // GC_SOFTETHER_OSS - - if (json_req == NULL || json_req_object == NULL) - { - // Parse error - json_ret = JsonRpcNewError(ERR_INVALID_PARAMETER, L"Parameter is invalid: JSON-RPC Parse Error"); - } - else - { - // check the JSON-RPC version - char *ver_str = JsonGetStr(json_req_object, "jsonrpc"); - if (StrCmpi(ver_str, "2.0") != 0) - { - // Invalid version - json_ret = JsonRpcNewError(ERR_INVALID_PARAMETER, L"JSON-RPC version is invalid"); - } - else - { - JSON_VALUE *params_value = NULL; - JSON_OBJECT *params_object = NULL; - - // Get Request ID - request_id = JsonGetStr(json_req_object, "id"); - - // Get method name - method_name = JsonGetStr(json_req_object, "method"); - - // Get parameters - params_value = JsonGet(json_req_object, "params"); - params_object = JsonObject(params_value); - - if (IsEmptyStr(method_name)) - { - // method is empty - json_ret = JsonRpcNewError(ERR_INVALID_PARAMETER, L"JSON-RPC method name is empty"); - } - else if (params_value == NULL || params_object == NULL) - { - // params is empty - json_ret = JsonRpcNewError(ERR_INVALID_PARAMETER, L"JSON-RPC parameter is empty"); - } - else - { - // Process the request - json_ret = JsonRpcProcRequestObject(a, c, s, params_value, method_name); - } - } - } - - if (json_ret == NULL) - { - json_ret = JsonRpcNewError(ERR_INTERNAL_ERROR, L"Internal error"); - } - - JsonSetStr(JsonObject(json_ret), "jsonrpc", "2.0"); - if (request_id == NULL) - { - request_id = "0"; - } - JsonSetStr(JsonObject(json_ret), "id", request_id); - - res = JsonToStr(json_ret); - - AdminWebSendBody(s, 200, "OK", res, StrLen(res), "application/json", NULL, NULL, h); - - Free(res); - - JsonFree(json_ret); - JsonFree(json_req); - } - - Free(data); - - if (a->LogFileList != NULL) - { - FreeEnumLogFile(a->LogFileList); - } - Free(a); -} - -// Dispatch routine for Administration RPC -PACK *AdminDispatch(RPC *rpc, char *name, PACK *p) -{ - ADMIN *a; - PACK *ret; - UINT err; - SERVER *server = NULL; - CEDAR *cedar = NULL; - bool ok = false; - // Validate arguments - if (rpc == NULL || name == NULL || p == NULL) - { - return NULL; - } - - ret = NewPack(); - err = ERR_NO_ERROR; - - // Administration structure - a = (ADMIN *)rpc->Param; - if (a == NULL) - { - FreePack(ret); - return NULL; - } - - server = a->Server; - - if (server == NULL) - { - return NULL; - } - - cedar = server->Cedar; - Lock(cedar->CedarSuperLock); - - if (true) - { - char tmp[MAX_PATH]; - char ip[MAX_PATH]; - UINT rpc_id = 0; - - StrCpy(ip, sizeof(ip), "Unknown"); - - if (rpc->Sock != NULL) - { - IPToStr(ip, sizeof(ip), &rpc->Sock->RemoteIP); - rpc_id = rpc->Sock->socket; - } - - Format(tmp, sizeof(tmp), "RPC: RPC-%u (%s): Entering RPC [%s]...", - rpc_id, ip, name); - - SiDebugLog(a->Server, tmp); - } - - if (0) {} - - // RPC function declaration: from here - DECLARE_RPC_EX("Test", RPC_TEST, StTest, InRpcTest, OutRpcTest, FreeRpcTest) - DECLARE_RPC_EX("GetServerInfo", RPC_SERVER_INFO, StGetServerInfo, InRpcServerInfo, OutRpcServerInfo, FreeRpcServerInfo) - DECLARE_RPC("GetServerStatus", RPC_SERVER_STATUS, StGetServerStatus, InRpcServerStatus, OutRpcServerStatus) - DECLARE_RPC("CreateListener", RPC_LISTENER, StCreateListener, InRpcListener, OutRpcListener) - DECLARE_RPC_EX("EnumListener", RPC_LISTENER_LIST, StEnumListener, InRpcListenerList, OutRpcListenerList, FreeRpcListenerList) - DECLARE_RPC("DeleteListener", RPC_LISTENER, StDeleteListener, InRpcListener, OutRpcListener) - DECLARE_RPC("EnableListener", RPC_LISTENER, StEnableListener, InRpcListener, OutRpcListener) - DECLARE_RPC_EX("SetPortsUDP", RPC_PORTS, StSetPortsUDP, InRpcPorts, OutRpcPorts, FreeRpcPorts) - DECLARE_RPC_EX("GetPortsUDP", RPC_PORTS, StGetPortsUDP, InRpcPorts, OutRpcPorts, FreeRpcPorts) - DECLARE_RPC_EX("SetProtoOptions", RPC_PROTO_OPTIONS, StSetProtoOptions, InRpcProtoOptions, OutRpcProtoOptions, FreeRpcProtoOptions) - DECLARE_RPC_EX("GetProtoOptions", RPC_PROTO_OPTIONS, StGetProtoOptions, InRpcProtoOptions, OutRpcProtoOptions, FreeRpcProtoOptions) - DECLARE_RPC("SetServerPassword", RPC_SET_PASSWORD, StSetServerPassword, InRpcSetPassword, OutRpcSetPassword) - DECLARE_RPC_EX("SetFarmSetting", RPC_FARM, StSetFarmSetting, InRpcFarm, OutRpcFarm, FreeRpcFarm) - DECLARE_RPC_EX("GetFarmSetting", RPC_FARM, StGetFarmSetting, InRpcFarm, OutRpcFarm, FreeRpcFarm) - DECLARE_RPC_EX("GetFarmInfo", RPC_FARM_INFO, StGetFarmInfo, InRpcFarmInfo, OutRpcFarmInfo, FreeRpcFarmInfo) - DECLARE_RPC_EX("EnumFarmMember", RPC_ENUM_FARM, StEnumFarmMember, InRpcEnumFarm, OutRpcEnumFarm, FreeRpcEnumFarm) - DECLARE_RPC("GetFarmConnectionStatus", RPC_FARM_CONNECTION_STATUS, StGetFarmConnectionStatus, InRpcFarmConnectionStatus, OutRpcFarmConnectionStatus) - DECLARE_RPC_EX("SetServerCert", RPC_KEY_PAIR, StSetServerCert, InRpcKeyPair, OutRpcKeyPair, FreeRpcKeyPair) - DECLARE_RPC_EX("GetServerCert", RPC_KEY_PAIR, StGetServerCert, InRpcKeyPair, OutRpcKeyPair, FreeRpcKeyPair) - DECLARE_RPC_EX("GetServerCipherList", RPC_STR, StGetServerCipherList, InRpcStr, OutRpcStr, FreeRpcStr) - DECLARE_RPC_EX("GetServerCipher", RPC_STR, StGetServerCipher, InRpcStr, OutRpcStr, FreeRpcStr) - DECLARE_RPC_EX("SetServerCipher", RPC_STR, StSetServerCipher, InRpcStr, OutRpcStr, FreeRpcStr) - DECLARE_RPC("CreateHub", RPC_CREATE_HUB, StCreateHub, InRpcCreateHub, OutRpcCreateHub) - DECLARE_RPC("SetHub", RPC_CREATE_HUB, StSetHub, InRpcCreateHub, OutRpcCreateHub) - DECLARE_RPC("GetHub", RPC_CREATE_HUB, StGetHub, InRpcCreateHub, OutRpcCreateHub) - DECLARE_RPC_EX("EnumHub", RPC_ENUM_HUB, StEnumHub, InRpcEnumHub, OutRpcEnumHub, FreeRpcEnumHub) - DECLARE_RPC("DeleteHub", RPC_DELETE_HUB, StDeleteHub, InRpcDeleteHub, OutRpcDeleteHub) - DECLARE_RPC("GetHubRadius", RPC_RADIUS, StGetHubRadius, InRpcRadius, OutRpcRadius) - DECLARE_RPC("SetHubRadius", RPC_RADIUS, StSetHubRadius, InRpcRadius, OutRpcRadius) - DECLARE_RPC_EX("EnumConnection", RPC_ENUM_CONNECTION, StEnumConnection, InRpcEnumConnection, OutRpcEnumConnection, FreeRpcEnumConnection) - DECLARE_RPC("DisconnectConnection", RPC_DISCONNECT_CONNECTION, StDisconnectConnection, InRpcDisconnectConnection, OutRpcDisconnectConnection) - DECLARE_RPC("GetConnectionInfo", RPC_CONNECTION_INFO, StGetConnectionInfo, InRpcConnectionInfo, OutRpcConnectionInfo) - DECLARE_RPC("SetHubOnline", RPC_SET_HUB_ONLINE, StSetHubOnline, InRpcSetHubOnline, OutRpcSetHubOnline) - DECLARE_RPC("GetHubStatus", RPC_HUB_STATUS, StGetHubStatus, InRpcHubStatus, OutRpcHubStatus) - DECLARE_RPC("SetHubLog", RPC_HUB_LOG, StSetHubLog, InRpcHubLog, OutRpcHubLog) - DECLARE_RPC("GetHubLog", RPC_HUB_LOG, StGetHubLog, InRpcHubLog, OutRpcHubLog) - DECLARE_RPC_EX("AddCa", RPC_HUB_ADD_CA, StAddCa, InRpcHubAddCa, OutRpcHubAddCa, FreeRpcHubAddCa) - DECLARE_RPC_EX("EnumCa", RPC_HUB_ENUM_CA, StEnumCa, InRpcHubEnumCa, OutRpcHubEnumCa, FreeRpcHubEnumCa) - DECLARE_RPC_EX("GetCa", RPC_HUB_GET_CA, StGetCa, InRpcHubGetCa, OutRpcHubGetCa, FreeRpcHubGetCa) - DECLARE_RPC("DeleteCa", RPC_HUB_DELETE_CA, StDeleteCa, InRpcHubDeleteCa, OutRpcHubDeleteCa) - DECLARE_RPC("SetLinkOnline", RPC_LINK, StSetLinkOnline, InRpcLink, OutRpcLink) - DECLARE_RPC("SetLinkOffline", RPC_LINK, StSetLinkOffline, InRpcLink, OutRpcLink) - DECLARE_RPC("DeleteLink", RPC_LINK, StDeleteLink, InRpcLink, OutRpcLink) - DECLARE_RPC("RenameLink", RPC_RENAME_LINK, StRenameLink, InRpcRenameLink, OutRpcRenameLink) - DECLARE_RPC_EX("CreateLink", RPC_CREATE_LINK, StCreateLink, InRpcCreateLink, OutRpcCreateLink, FreeRpcCreateLink) - DECLARE_RPC_EX("GetLink", RPC_CREATE_LINK, StGetLink, InRpcCreateLink, OutRpcCreateLink, FreeRpcCreateLink) - DECLARE_RPC_EX("SetLink", RPC_CREATE_LINK, StSetLink, InRpcCreateLink, OutRpcCreateLink, FreeRpcCreateLink) - DECLARE_RPC_EX("EnumLink", RPC_ENUM_LINK, StEnumLink, InRpcEnumLink, OutRpcEnumLink, FreeRpcEnumLink) - DECLARE_RPC_EX("GetLinkStatus", RPC_LINK_STATUS, StGetLinkStatus, InRpcLinkStatus, OutRpcLinkStatus, FreeRpcLinkStatus) - DECLARE_RPC("AddAccess", RPC_ADD_ACCESS, StAddAccess, InRpcAddAccess, OutRpcAddAccess) - DECLARE_RPC("DeleteAccess", RPC_DELETE_ACCESS, StDeleteAccess, InRpcDeleteAccess, OutRpcDeleteAccess) - DECLARE_RPC_EX("EnumAccess", RPC_ENUM_ACCESS_LIST, StEnumAccess, InRpcEnumAccessList, OutRpcEnumAccessList, FreeRpcEnumAccessList) - DECLARE_RPC_EX("SetAccessList", RPC_ENUM_ACCESS_LIST, StSetAccessList, InRpcEnumAccessList, OutRpcEnumAccessList, FreeRpcEnumAccessList) - DECLARE_RPC_EX("CreateUser", RPC_SET_USER, StCreateUser, InRpcSetUser, OutRpcSetUser, FreeRpcSetUser) - DECLARE_RPC_EX("SetUser", RPC_SET_USER, StSetUser, InRpcSetUser, OutRpcSetUser, FreeRpcSetUser) - DECLARE_RPC_EX("GetUser", RPC_SET_USER, StGetUser, InRpcSetUser, OutRpcSetUser, FreeRpcSetUser) - DECLARE_RPC("DeleteUser", RPC_DELETE_USER, StDeleteUser, InRpcDeleteUser, OutRpcDeleteUser) - DECLARE_RPC_EX("EnumUser", RPC_ENUM_USER, StEnumUser, InRpcEnumUser, OutRpcEnumUser, FreeRpcEnumUser) - DECLARE_RPC_EX("CreateGroup", RPC_SET_GROUP, StCreateGroup, InRpcSetGroup, OutRpcSetGroup, FreeRpcSetGroup) - DECLARE_RPC_EX("SetGroup", RPC_SET_GROUP, StSetGroup, InRpcSetGroup, OutRpcSetGroup, FreeRpcSetGroup) - DECLARE_RPC_EX("GetGroup", RPC_SET_GROUP, StGetGroup, InRpcSetGroup, OutRpcSetGroup, FreeRpcSetGroup) - DECLARE_RPC("DeleteGroup", RPC_DELETE_USER, StDeleteGroup, InRpcDeleteUser, OutRpcDeleteUser) - DECLARE_RPC_EX("EnumGroup", RPC_ENUM_GROUP, StEnumGroup, InRpcEnumGroup, OutRpcEnumGroup, FreeRpcEnumGroup) - DECLARE_RPC_EX("EnumSession", RPC_ENUM_SESSION, StEnumSession, InRpcEnumSession, OutRpcEnumSession, FreeRpcEnumSession) - DECLARE_RPC_EX("GetSessionStatus", RPC_SESSION_STATUS, StGetSessionStatus, InRpcSessionStatus, OutRpcSessionStatus, FreeRpcSessionStatus) - DECLARE_RPC("DeleteSession", RPC_DELETE_SESSION, StDeleteSession, InRpcDeleteSession, OutRpcDeleteSession) - DECLARE_RPC_EX("EnumMacTable", RPC_ENUM_MAC_TABLE, StEnumMacTable, InRpcEnumMacTable, OutRpcEnumMacTable, FreeRpcEnumMacTable) - DECLARE_RPC("DeleteMacTable", RPC_DELETE_TABLE, StDeleteMacTable, InRpcDeleteTable, OutRpcDeleteTable) - DECLARE_RPC_EX("EnumIpTable", RPC_ENUM_IP_TABLE, StEnumIpTable, InRpcEnumIpTable, OutRpcEnumIpTable, FreeRpcEnumIpTable) - DECLARE_RPC("DeleteIpTable", RPC_DELETE_TABLE, StDeleteIpTable, InRpcDeleteTable, OutRpcDeleteTable) - DECLARE_RPC("SetKeep", RPC_KEEP, StSetKeep, InRpcKeep, OutRpcKeep) - DECLARE_RPC("GetKeep", RPC_KEEP, StGetKeep, InRpcKeep, OutRpcKeep) - DECLARE_RPC("EnableSecureNAT", RPC_HUB, StEnableSecureNAT, InRpcHub, OutRpcHub) - DECLARE_RPC("DisableSecureNAT", RPC_HUB, StDisableSecureNAT, InRpcHub, OutRpcHub) - DECLARE_RPC("SetSecureNATOption", VH_OPTION, StSetSecureNATOption, InVhOption, OutVhOption) - DECLARE_RPC("GetSecureNATOption", VH_OPTION, StGetSecureNATOption, InVhOption, OutVhOption) - DECLARE_RPC_EX("EnumNAT", RPC_ENUM_NAT, StEnumNAT, InRpcEnumNat, OutRpcEnumNat, FreeRpcEnumNat) - DECLARE_RPC_EX("EnumDHCP", RPC_ENUM_DHCP, StEnumDHCP, InRpcEnumDhcp, OutRpcEnumDhcp, FreeRpcEnumDhcp) - DECLARE_RPC("GetSecureNATStatus", RPC_NAT_STATUS, StGetSecureNATStatus, InRpcNatStatus, OutRpcNatStatus) - DECLARE_RPC_EX("EnumEthernet", RPC_ENUM_ETH, StEnumEthernet, InRpcEnumEth, OutRpcEnumEth, FreeRpcEnumEth) - DECLARE_RPC("AddLocalBridge", RPC_LOCALBRIDGE, StAddLocalBridge, InRpcLocalBridge, OutRpcLocalBridge) - DECLARE_RPC("DeleteLocalBridge", RPC_LOCALBRIDGE, StDeleteLocalBridge, InRpcLocalBridge, OutRpcLocalBridge) - DECLARE_RPC_EX("EnumLocalBridge", RPC_ENUM_LOCALBRIDGE, StEnumLocalBridge, InRpcEnumLocalBridge, OutRpcEnumLocalBridge, FreeRpcEnumLocalBridge) - DECLARE_RPC("GetBridgeSupport", RPC_BRIDGE_SUPPORT, StGetBridgeSupport, InRpcBridgeSupport, OutRpcBridgeSupport) - DECLARE_RPC("RebootServer", RPC_TEST, StRebootServer, InRpcTest, OutRpcTest) - DECLARE_RPC_EX("GetCaps", CAPSLIST, StGetCaps, InRpcCapsList, OutRpcCapsList, FreeRpcCapsList) - DECLARE_RPC_EX("GetConfig", RPC_CONFIG, StGetConfig, InRpcConfig, OutRpcConfig, FreeRpcConfig) - DECLARE_RPC_EX("SetConfig", RPC_CONFIG, StSetConfig, InRpcConfig, OutRpcConfig, FreeRpcConfig) - DECLARE_RPC_EX("GetDefaultHubAdminOptions", RPC_ADMIN_OPTION, StGetDefaultHubAdminOptions, InRpcAdminOption, OutRpcAdminOption, FreeRpcAdminOption) - DECLARE_RPC_EX("GetHubAdminOptions", RPC_ADMIN_OPTION, StGetHubAdminOptions, InRpcAdminOption, OutRpcAdminOption, FreeRpcAdminOption) - DECLARE_RPC_EX("SetHubAdminOptions", RPC_ADMIN_OPTION, StSetHubAdminOptions, InRpcAdminOption, OutRpcAdminOption, FreeRpcAdminOption) - DECLARE_RPC_EX("GetHubExtOptions", RPC_ADMIN_OPTION, StGetHubExtOptions, InRpcAdminOption, OutRpcAdminOption, FreeRpcAdminOption) - DECLARE_RPC_EX("SetHubExtOptions", RPC_ADMIN_OPTION, StSetHubExtOptions, InRpcAdminOption, OutRpcAdminOption, FreeRpcAdminOption) - DECLARE_RPC("AddL3Switch", RPC_L3SW, StAddL3Switch, InRpcL3Sw, OutRpcL3Sw) - DECLARE_RPC("DelL3Switch", RPC_L3SW, StDelL3Switch, InRpcL3Sw, OutRpcL3Sw) - DECLARE_RPC_EX("EnumL3Switch", RPC_ENUM_L3SW, StEnumL3Switch, InRpcEnumL3Sw, OutRpcEnumL3Sw, FreeRpcEnumL3Sw) - DECLARE_RPC("StartL3Switch", RPC_L3SW, StStartL3Switch, InRpcL3Sw, OutRpcL3Sw) - DECLARE_RPC("StopL3Switch", RPC_L3SW, StStopL3Switch, InRpcL3Sw, OutRpcL3Sw) - DECLARE_RPC("AddL3If", RPC_L3IF, StAddL3If, InRpcL3If, OutRpcL3If) - DECLARE_RPC("DelL3If", RPC_L3IF, StDelL3If, InRpcL3If, OutRpcL3If) - DECLARE_RPC_EX("EnumL3If", RPC_ENUM_L3IF, StEnumL3If, InRpcEnumL3If, OutRpcEnumL3If, FreeRpcEnumL3If) - DECLARE_RPC("AddL3Table", RPC_L3TABLE, StAddL3Table, InRpcL3Table, OutRpcL3Table) - DECLARE_RPC("DelL3Table", RPC_L3TABLE, StDelL3Table, InRpcL3Table, OutRpcL3Table) - DECLARE_RPC_EX("EnumL3Table", RPC_ENUM_L3TABLE, StEnumL3Table, InRpcEnumL3Table, OutRpcEnumL3Table, FreeRpcEnumL3Table) - DECLARE_RPC_EX("EnumCrl", RPC_ENUM_CRL, StEnumCrl, InRpcEnumCrl, OutRpcEnumCrl, FreeRpcEnumCrl) - DECLARE_RPC_EX("AddCrl", RPC_CRL, StAddCrl, InRpcCrl, OutRpcCrl, FreeRpcCrl) - DECLARE_RPC_EX("DelCrl", RPC_CRL, StDelCrl, InRpcCrl, OutRpcCrl, FreeRpcCrl) - DECLARE_RPC_EX("GetCrl", RPC_CRL, StGetCrl, InRpcCrl, OutRpcCrl, FreeRpcCrl) - DECLARE_RPC_EX("SetCrl", RPC_CRL, StSetCrl, InRpcCrl, OutRpcCrl, FreeRpcCrl) - DECLARE_RPC_EX("SetAcList", RPC_AC_LIST, StSetAcList, InRpcAcList, OutRpcAcList, FreeRpcAcList) - DECLARE_RPC_EX("GetAcList", RPC_AC_LIST, StGetAcList, InRpcAcList, OutRpcAcList, FreeRpcAcList) - DECLARE_RPC_EX("EnumLogFile", RPC_ENUM_LOG_FILE, StEnumLogFile, InRpcEnumLogFile, OutRpcEnumLogFile, FreeRpcEnumLogFile) - DECLARE_RPC_EX("ReadLogFile", RPC_READ_LOG_FILE, StReadLogFile, InRpcReadLogFile, OutRpcReadLogFile, FreeRpcReadLogFile) - DECLARE_RPC("AddLicenseKey", RPC_TEST, StAddLicenseKey, InRpcTest, OutRpcTest) - DECLARE_RPC("DelLicenseKey", RPC_TEST, StDelLicenseKey, InRpcTest, OutRpcTest) - DECLARE_RPC_EX("EnumLicenseKey", RPC_ENUM_LICENSE_KEY, StEnumLicenseKey, InRpcEnumLicenseKey, OutRpcEnumLicenseKey, FreeRpcEnumLicenseKey) - DECLARE_RPC("GetLicenseStatus", RPC_LICENSE_STATUS, StGetLicenseStatus, InRpcLicenseStatus, OutRpcLicenseStatus) - DECLARE_RPC("SetSysLog", SYSLOG_SETTING, StSetSysLog, InRpcSysLogSetting, OutRpcSysLogSetting) - DECLARE_RPC("GetSysLog", SYSLOG_SETTING, StGetSysLog, InRpcSysLogSetting, OutRpcSysLogSetting) - DECLARE_RPC_EX("EnumEthVLan", RPC_ENUM_ETH_VLAN, StEnumEthVLan, InRpcEnumEthVLan, OutRpcEnumEthVLan, FreeRpcEnumEthVLan) - DECLARE_RPC("SetEnableEthVLan", RPC_TEST, StSetEnableEthVLan, InRpcTest, OutRpcTest) - DECLARE_RPC_EX("SetHubMsg", RPC_MSG, StSetHubMsg, InRpcMsg, OutRpcMsg, FreeRpcMsg) - DECLARE_RPC_EX("GetHubMsg", RPC_MSG, StGetHubMsg, InRpcMsg, OutRpcMsg, FreeRpcMsg) - DECLARE_RPC("Crash", RPC_TEST, StCrash, InRpcTest, OutRpcTest) - DECLARE_RPC_EX("GetAdminMsg", RPC_MSG, StGetAdminMsg, InRpcMsg, OutRpcMsg, FreeRpcMsg) - DECLARE_RPC("Flush", RPC_TEST, StFlush, InRpcTest, OutRpcTest) - DECLARE_RPC("Debug", RPC_TEST, StDebug, InRpcTest, OutRpcTest) - DECLARE_RPC("SetIPsecServices", IPSEC_SERVICES, StSetIPsecServices, InIPsecServices, OutIPsecServices) - DECLARE_RPC("GetIPsecServices", IPSEC_SERVICES, StGetIPsecServices, InIPsecServices, OutIPsecServices) - DECLARE_RPC("AddEtherIpId", ETHERIP_ID, StAddEtherIpId, InEtherIpId, OutEtherIpId) - DECLARE_RPC("GetEtherIpId", ETHERIP_ID, StGetEtherIpId, InEtherIpId, OutEtherIpId) - DECLARE_RPC("DeleteEtherIpId", ETHERIP_ID, StDeleteEtherIpId, InEtherIpId, OutEtherIpId) - DECLARE_RPC_EX("EnumEtherIpId", RPC_ENUM_ETHERIP_ID, StEnumEtherIpId, InRpcEnumEtherIpId, OutRpcEnumEtherIpId, FreeRpcEnumEtherIpId) - DECLARE_RPC("SetOpenVpnSstpConfig", OPENVPN_SSTP_CONFIG, StSetOpenVpnSstpConfig, InOpenVpnSstpConfig, OutOpenVpnSstpConfig) - DECLARE_RPC("GetOpenVpnSstpConfig", OPENVPN_SSTP_CONFIG, StGetOpenVpnSstpConfig, InOpenVpnSstpConfig, OutOpenVpnSstpConfig) - DECLARE_RPC("GetDDnsClientStatus", DDNS_CLIENT_STATUS, StGetDDnsClientStatus, InDDnsClientStatus, OutDDnsClientStatus) - DECLARE_RPC("ChangeDDnsClientHostname", RPC_TEST, StChangeDDnsClientHostname, InRpcTest, OutRpcTest) - DECLARE_RPC("RegenerateServerCert", RPC_TEST, StRegenerateServerCert, InRpcTest, OutRpcTest) - DECLARE_RPC_EX("MakeOpenVpnConfigFile", RPC_READ_LOG_FILE, StMakeOpenVpnConfigFile, InRpcReadLogFile, OutRpcReadLogFile, FreeRpcReadLogFile) - DECLARE_RPC("SetSpecialListener", RPC_SPECIAL_LISTENER, StSetSpecialListener, InRpcSpecialListener, OutRpcSpecialListener) - DECLARE_RPC("GetSpecialListener", RPC_SPECIAL_LISTENER, StGetSpecialListener, InRpcSpecialListener, OutRpcSpecialListener) - DECLARE_RPC("GetAzureStatus", RPC_AZURE_STATUS, StGetAzureStatus, InRpcAzureStatus, OutRpcAzureStatus) - DECLARE_RPC("SetAzureStatus", RPC_AZURE_STATUS, StSetAzureStatus, InRpcAzureStatus, OutRpcAzureStatus) - DECLARE_RPC("GetDDnsInternetSettng", INTERNET_SETTING, StGetDDnsInternetSetting, InRpcInternetSetting, OutRpcInternetSetting) - DECLARE_RPC("SetDDnsInternetSettng", INTERNET_SETTING, StSetDDnsInternetSetting, InRpcInternetSetting, OutRpcInternetSetting) - // RPC function declaration: till here - - - if (ok == false) - { - err = ERR_NOT_SUPPORTED; - } - - if (err != ERR_NO_ERROR) - { - PackAddInt(ret, "error", err); - } - - if (true) - { - char tmp[MAX_PATH]; - char ip[MAX_PATH]; - UINT rpc_id = 0; - - StrCpy(ip, sizeof(ip), "Unknown"); - - if (rpc->Sock != NULL) - { - IPToStr(ip, sizeof(ip), &rpc->Sock->RemoteIP); - rpc_id = rpc->Sock->socket; - } - - Format(tmp, sizeof(tmp), "RPC: RPC-%u (%s): Leaving RPC [%s] (Error: %u).", - rpc_id, ip, name, err); - - SiDebugLog(a->Server, tmp); - } - - Unlock(cedar->CedarSuperLock); - - return ret; -} - -// RPC call function declaration: from here -DECLARE_SC_EX("Test", RPC_TEST, ScTest, InRpcTest, OutRpcTest, FreeRpcTest) -DECLARE_SC_EX("GetServerInfo", RPC_SERVER_INFO, ScGetServerInfo, InRpcServerInfo, OutRpcServerInfo, FreeRpcServerInfo) -DECLARE_SC("GetServerStatus", RPC_SERVER_STATUS, ScGetServerStatus, InRpcServerStatus, OutRpcServerStatus) -DECLARE_SC("CreateListener", RPC_LISTENER, ScCreateListener, InRpcListener, OutRpcListener) -DECLARE_SC_EX("EnumListener", RPC_LISTENER_LIST, ScEnumListener, InRpcListenerList, OutRpcListenerList, FreeRpcListenerList) -DECLARE_SC("DeleteListener", RPC_LISTENER, ScDeleteListener, InRpcListener, OutRpcListener) -DECLARE_SC("EnableListener", RPC_LISTENER, ScEnableListener, InRpcListener, OutRpcListener) -DECLARE_SC_EX("SetPortsUDP", RPC_PORTS, ScSetPortsUDP, InRpcPorts, OutRpcPorts, FreeRpcPorts) -DECLARE_SC_EX("GetPortsUDP", RPC_PORTS, ScGetPortsUDP, InRpcPorts, OutRpcPorts, FreeRpcPorts) -DECLARE_SC_EX("SetProtoOptions", RPC_PROTO_OPTIONS, ScSetProtoOptions, InRpcProtoOptions, OutRpcProtoOptions, FreeRpcProtoOptions) -DECLARE_SC_EX("GetProtoOptions", RPC_PROTO_OPTIONS, ScGetProtoOptions, InRpcProtoOptions, OutRpcProtoOptions, FreeRpcProtoOptions) -DECLARE_SC("SetServerPassword", RPC_SET_PASSWORD, ScSetServerPassword, InRpcSetPassword, OutRpcSetPassword) -DECLARE_SC_EX("SetFarmSetting", RPC_FARM, ScSetFarmSetting, InRpcFarm, OutRpcFarm, FreeRpcFarm) -DECLARE_SC_EX("GetFarmSetting", RPC_FARM, ScGetFarmSetting, InRpcFarm, OutRpcFarm, FreeRpcFarm) -DECLARE_SC_EX("GetFarmInfo", RPC_FARM_INFO, ScGetFarmInfo, InRpcFarmInfo, OutRpcFarmInfo, FreeRpcFarmInfo) -DECLARE_SC_EX("EnumFarmMember", RPC_ENUM_FARM, ScEnumFarmMember, InRpcEnumFarm, OutRpcEnumFarm, FreeRpcEnumFarm) -DECLARE_SC("GetFarmConnectionStatus", RPC_FARM_CONNECTION_STATUS, ScGetFarmConnectionStatus, InRpcFarmConnectionStatus, OutRpcFarmConnectionStatus) -DECLARE_SC_EX("SetServerCert", RPC_KEY_PAIR, ScSetServerCert, InRpcKeyPair, OutRpcKeyPair, FreeRpcKeyPair) -DECLARE_SC_EX("GetServerCert", RPC_KEY_PAIR, ScGetServerCert, InRpcKeyPair, OutRpcKeyPair, FreeRpcKeyPair) -DECLARE_SC_EX("GetServerCipherList", RPC_STR, ScGetServerCipherList, InRpcStr, OutRpcStr, FreeRpcStr) -DECLARE_SC_EX("GetServerCipher", RPC_STR, ScGetServerCipher, InRpcStr, OutRpcStr, FreeRpcStr) -DECLARE_SC_EX("SetServerCipher", RPC_STR, ScSetServerCipher, InRpcStr, OutRpcStr, FreeRpcStr) -DECLARE_SC("CreateHub", RPC_CREATE_HUB, ScCreateHub, InRpcCreateHub, OutRpcCreateHub) -DECLARE_SC("SetHub", RPC_CREATE_HUB, ScSetHub, InRpcCreateHub, OutRpcCreateHub) -DECLARE_SC("GetHub", RPC_CREATE_HUB, ScGetHub, InRpcCreateHub, OutRpcCreateHub) -DECLARE_SC_EX("EnumHub", RPC_ENUM_HUB, ScEnumHub, InRpcEnumHub, OutRpcEnumHub, FreeRpcEnumHub) -DECLARE_SC("DeleteHub", RPC_DELETE_HUB, ScDeleteHub, InRpcDeleteHub, OutRpcDeleteHub) -DECLARE_SC("GetHubRadius", RPC_RADIUS, ScGetHubRadius, InRpcRadius, OutRpcRadius) -DECLARE_SC("SetHubRadius", RPC_RADIUS, ScSetHubRadius, InRpcRadius, OutRpcRadius) -DECLARE_SC_EX("EnumConnection", RPC_ENUM_CONNECTION, ScEnumConnection, InRpcEnumConnection, OutRpcEnumConnection, FreeRpcEnumConnection) -DECLARE_SC("DisconnectConnection", RPC_DISCONNECT_CONNECTION, ScDisconnectConnection, InRpcDisconnectConnection, OutRpcDisconnectConnection) -DECLARE_SC("GetConnectionInfo", RPC_CONNECTION_INFO, ScGetConnectionInfo, InRpcConnectionInfo, OutRpcConnectionInfo) -DECLARE_SC("SetHubOnline", RPC_SET_HUB_ONLINE, ScSetHubOnline, InRpcSetHubOnline, OutRpcSetHubOnline) -DECLARE_SC("GetHubStatus", RPC_HUB_STATUS, ScGetHubStatus, InRpcHubStatus, OutRpcHubStatus) -DECLARE_SC("SetHubLog", RPC_HUB_LOG, ScSetHubLog, InRpcHubLog, OutRpcHubLog) -DECLARE_SC("GetHubLog", RPC_HUB_LOG, ScGetHubLog, InRpcHubLog, OutRpcHubLog) -DECLARE_SC_EX("AddCa", RPC_HUB_ADD_CA, ScAddCa, InRpcHubAddCa, OutRpcHubAddCa, FreeRpcHubAddCa) -DECLARE_SC_EX("EnumCa", RPC_HUB_ENUM_CA, ScEnumCa, InRpcHubEnumCa, OutRpcHubEnumCa, FreeRpcHubEnumCa) -DECLARE_SC_EX("GetCa", RPC_HUB_GET_CA, ScGetCa, InRpcHubGetCa, OutRpcHubGetCa, FreeRpcHubGetCa) -DECLARE_SC("DeleteCa", RPC_HUB_DELETE_CA, ScDeleteCa, InRpcHubDeleteCa, OutRpcHubDeleteCa) -DECLARE_SC_EX("CreateLink", RPC_CREATE_LINK, ScCreateLink, InRpcCreateLink, OutRpcCreateLink, FreeRpcCreateLink) -DECLARE_SC_EX("GetLink", RPC_CREATE_LINK, ScGetLink, InRpcCreateLink, OutRpcCreateLink, FreeRpcCreateLink) -DECLARE_SC_EX("SetLink", RPC_CREATE_LINK, ScSetLink, InRpcCreateLink, OutRpcCreateLink, FreeRpcCreateLink) -DECLARE_SC_EX("EnumLink", RPC_ENUM_LINK, ScEnumLink, InRpcEnumLink, OutRpcEnumLink, FreeRpcEnumLink) -DECLARE_SC_EX("GetLinkStatus", RPC_LINK_STATUS, ScGetLinkStatus, InRpcLinkStatus, OutRpcLinkStatus, FreeRpcLinkStatus) -DECLARE_SC("SetLinkOnline", RPC_LINK, ScSetLinkOnline, InRpcLink, OutRpcLink) -DECLARE_SC("SetLinkOffline", RPC_LINK, ScSetLinkOffline, InRpcLink, OutRpcLink) -DECLARE_SC("DeleteLink", RPC_LINK, ScDeleteLink, InRpcLink, OutRpcLink) -DECLARE_SC("RenameLink", RPC_RENAME_LINK, ScRenameLink, InRpcRenameLink, OutRpcRenameLink) -DECLARE_SC("AddAccess", RPC_ADD_ACCESS, ScAddAccess, InRpcAddAccess, OutRpcAddAccess) -DECLARE_SC("DeleteAccess", RPC_DELETE_ACCESS, ScDeleteAccess, InRpcDeleteAccess, OutRpcDeleteAccess) -DECLARE_SC_EX("EnumAccess", RPC_ENUM_ACCESS_LIST, ScEnumAccess, InRpcEnumAccessList, OutRpcEnumAccessList, FreeRpcEnumAccessList) -DECLARE_SC_EX("SetAccessList", RPC_ENUM_ACCESS_LIST, ScSetAccessList, InRpcEnumAccessList, OutRpcEnumAccessList, FreeRpcEnumAccessList) -DECLARE_SC_EX("CreateUser", RPC_SET_USER, ScCreateUser, InRpcSetUser, OutRpcSetUser, FreeRpcSetUser) -DECLARE_SC_EX("SetUser", RPC_SET_USER, ScSetUser, InRpcSetUser, OutRpcSetUser, FreeRpcSetUser) -DECLARE_SC_EX("GetUser", RPC_SET_USER, ScGetUser, InRpcSetUser, OutRpcSetUser, FreeRpcSetUser) -DECLARE_SC("DeleteUser", RPC_DELETE_USER, ScDeleteUser, InRpcDeleteUser, OutRpcDeleteUser) -DECLARE_SC_EX("EnumUser", RPC_ENUM_USER, ScEnumUser, InRpcEnumUser, OutRpcEnumUser, FreeRpcEnumUser) -DECLARE_SC_EX("CreateGroup", RPC_SET_GROUP, ScCreateGroup, InRpcSetGroup, OutRpcSetGroup, FreeRpcSetGroup) -DECLARE_SC_EX("SetGroup", RPC_SET_GROUP, ScSetGroup, InRpcSetGroup, OutRpcSetGroup, FreeRpcSetGroup) -DECLARE_SC_EX("GetGroup", RPC_SET_GROUP, ScGetGroup, InRpcSetGroup, OutRpcSetGroup, FreeRpcSetGroup) -DECLARE_SC("DeleteGroup", RPC_DELETE_USER, ScDeleteGroup, InRpcDeleteUser, OutRpcDeleteUser) -DECLARE_SC_EX("EnumGroup", RPC_ENUM_GROUP, ScEnumGroup, InRpcEnumGroup, OutRpcEnumGroup, FreeRpcEnumGroup) -DECLARE_SC_EX("EnumSession", RPC_ENUM_SESSION, ScEnumSession, InRpcEnumSession, OutRpcEnumSession, FreeRpcEnumSession) -DECLARE_SC_EX("GetSessionStatus", RPC_SESSION_STATUS, ScGetSessionStatus, InRpcSessionStatus, OutRpcSessionStatus, FreeRpcSessionStatus) -DECLARE_SC("DeleteSession", RPC_DELETE_SESSION, ScDeleteSession, InRpcDeleteSession, OutRpcDeleteSession) -DECLARE_SC_EX("EnumMacTable", RPC_ENUM_MAC_TABLE, ScEnumMacTable, InRpcEnumMacTable, OutRpcEnumMacTable, FreeRpcEnumMacTable) -DECLARE_SC("DeleteMacTable", RPC_DELETE_TABLE, ScDeleteMacTable, InRpcDeleteTable, OutRpcDeleteTable) -DECLARE_SC_EX("EnumIpTable", RPC_ENUM_IP_TABLE, ScEnumIpTable, InRpcEnumIpTable, OutRpcEnumIpTable, FreeRpcEnumIpTable) -DECLARE_SC("DeleteIpTable", RPC_DELETE_TABLE, ScDeleteIpTable, InRpcDeleteTable, OutRpcDeleteTable) -DECLARE_SC("SetKeep", RPC_KEEP, ScSetKeep, InRpcKeep, OutRpcKeep) -DECLARE_SC("GetKeep", RPC_KEEP, ScGetKeep, InRpcKeep, OutRpcKeep) -DECLARE_SC("EnableSecureNAT", RPC_HUB, ScEnableSecureNAT, InRpcHub, OutRpcHub) -DECLARE_SC("DisableSecureNAT", RPC_HUB, ScDisableSecureNAT, InRpcHub, OutRpcHub) -DECLARE_SC("SetSecureNATOption", VH_OPTION, ScSetSecureNATOption, InVhOption, OutVhOption) -DECLARE_SC("GetSecureNATOption", VH_OPTION, ScGetSecureNATOption, InVhOption, OutVhOption) -DECLARE_SC_EX("EnumNAT", RPC_ENUM_NAT, ScEnumNAT, InRpcEnumNat, OutRpcEnumNat, FreeRpcEnumNat) -DECLARE_SC_EX("EnumDHCP", RPC_ENUM_DHCP, ScEnumDHCP, InRpcEnumDhcp, OutRpcEnumDhcp, FreeRpcEnumDhcp) -DECLARE_SC("GetSecureNATStatus", RPC_NAT_STATUS, ScGetSecureNATStatus, InRpcNatStatus, OutRpcNatStatus) -DECLARE_SC_EX("EnumEthernet", RPC_ENUM_ETH, ScEnumEthernet, InRpcEnumEth, OutRpcEnumEth, FreeRpcEnumEth) -DECLARE_SC("AddLocalBridge", RPC_LOCALBRIDGE, ScAddLocalBridge, InRpcLocalBridge, OutRpcLocalBridge) -DECLARE_SC("DeleteLocalBridge", RPC_LOCALBRIDGE, ScDeleteLocalBridge, InRpcLocalBridge, OutRpcLocalBridge) -DECLARE_SC_EX("EnumLocalBridge", RPC_ENUM_LOCALBRIDGE, ScEnumLocalBridge, InRpcEnumLocalBridge, OutRpcEnumLocalBridge, FreeRpcEnumLocalBridge) -DECLARE_SC("GetBridgeSupport", RPC_BRIDGE_SUPPORT, ScGetBridgeSupport, InRpcBridgeSupport, OutRpcBridgeSupport) -DECLARE_SC("RebootServer", RPC_TEST, ScRebootServer, InRpcTest, OutRpcTest) -DECLARE_SC_EX("GetCaps", CAPSLIST, ScGetCaps, InRpcCapsList, OutRpcCapsList, FreeRpcCapsList) -DECLARE_SC_EX("GetConfig", RPC_CONFIG, ScGetConfig, InRpcConfig, OutRpcConfig, FreeRpcConfig) -DECLARE_SC_EX("SetConfig", RPC_CONFIG, ScSetConfig, InRpcConfig, OutRpcConfig, FreeRpcConfig) -DECLARE_SC_EX("GetHubAdminOptions", RPC_ADMIN_OPTION, ScGetHubAdminOptions, InRpcAdminOption, OutRpcAdminOption, FreeRpcAdminOption) -DECLARE_SC_EX("SetHubAdminOptions", RPC_ADMIN_OPTION, ScSetHubAdminOptions, InRpcAdminOption, OutRpcAdminOption, FreeRpcAdminOption) -DECLARE_SC_EX("GetHubExtOptions", RPC_ADMIN_OPTION, ScGetHubExtOptions, InRpcAdminOption, OutRpcAdminOption, FreeRpcAdminOption) -DECLARE_SC_EX("SetHubExtOptions", RPC_ADMIN_OPTION, ScSetHubExtOptions, InRpcAdminOption, OutRpcAdminOption, FreeRpcAdminOption) -DECLARE_SC_EX("GetDefaultHubAdminOptions", RPC_ADMIN_OPTION, ScGetDefaultHubAdminOptions, InRpcAdminOption, OutRpcAdminOption, FreeRpcAdminOption) -DECLARE_SC("AddL3Switch", RPC_L3SW, ScAddL3Switch, InRpcL3Sw, OutRpcL3Sw) -DECLARE_SC("DelL3Switch", RPC_L3SW, ScDelL3Switch, InRpcL3Sw, OutRpcL3Sw) -DECLARE_SC_EX("EnumL3Switch", RPC_ENUM_L3SW, ScEnumL3Switch, InRpcEnumL3Sw, OutRpcEnumL3Sw, FreeRpcEnumL3Sw) -DECLARE_SC("StartL3Switch", RPC_L3SW, ScStartL3Switch, InRpcL3Sw, OutRpcL3Sw) -DECLARE_SC("StopL3Switch", RPC_L3SW, ScStopL3Switch, InRpcL3Sw, OutRpcL3Sw) -DECLARE_SC("AddL3If", RPC_L3IF, ScAddL3If, InRpcL3If, OutRpcL3If) -DECLARE_SC("DelL3If", RPC_L3IF, ScDelL3If, InRpcL3If, OutRpcL3If) -DECLARE_SC_EX("EnumL3If", RPC_ENUM_L3IF, ScEnumL3If, InRpcEnumL3If, OutRpcEnumL3If, FreeRpcEnumL3If) -DECLARE_SC("AddL3Table", RPC_L3TABLE, ScAddL3Table, InRpcL3Table, OutRpcL3Table) -DECLARE_SC("DelL3Table", RPC_L3TABLE, ScDelL3Table, InRpcL3Table, OutRpcL3Table) -DECLARE_SC_EX("EnumL3Table", RPC_ENUM_L3TABLE, ScEnumL3Table, InRpcEnumL3Table, OutRpcEnumL3Table, FreeRpcEnumL3Table) -DECLARE_SC_EX("EnumCrl", RPC_ENUM_CRL, ScEnumCrl, InRpcEnumCrl, OutRpcEnumCrl, FreeRpcEnumCrl) -DECLARE_SC_EX("AddCrl", RPC_CRL, ScAddCrl, InRpcCrl, OutRpcCrl, FreeRpcCrl) -DECLARE_SC_EX("DelCrl", RPC_CRL, ScDelCrl, InRpcCrl, OutRpcCrl, FreeRpcCrl) -DECLARE_SC_EX("GetCrl", RPC_CRL, ScGetCrl, InRpcCrl, OutRpcCrl, FreeRpcCrl) -DECLARE_SC_EX("SetCrl", RPC_CRL, ScSetCrl, InRpcCrl, OutRpcCrl, FreeRpcCrl) -DECLARE_SC_EX("SetAcList", RPC_AC_LIST, ScSetAcList, InRpcAcList, OutRpcAcList, FreeRpcAcList) -DECLARE_SC_EX("GetAcList", RPC_AC_LIST, ScGetAcList, InRpcAcList, OutRpcAcList, FreeRpcAcList) -DECLARE_SC_EX("EnumLogFile", RPC_ENUM_LOG_FILE, ScEnumLogFile, InRpcEnumLogFile, OutRpcEnumLogFile, FreeRpcEnumLogFile) -DECLARE_SC_EX("ReadLogFile", RPC_READ_LOG_FILE, ScReadLogFile, InRpcReadLogFile, OutRpcReadLogFile, FreeRpcReadLogFile) -DECLARE_SC("AddLicenseKey", RPC_TEST, ScAddLicenseKey, InRpcTest, OutRpcTest) -DECLARE_SC("DelLicenseKey", RPC_TEST, ScDelLicenseKey, InRpcTest, OutRpcTest) -DECLARE_SC_EX("EnumLicenseKey", RPC_ENUM_LICENSE_KEY, ScEnumLicenseKey, InRpcEnumLicenseKey, OutRpcEnumLicenseKey, FreeRpcEnumLicenseKey) -DECLARE_SC("GetLicenseStatus", RPC_LICENSE_STATUS, ScGetLicenseStatus, InRpcLicenseStatus, OutRpcLicenseStatus) -DECLARE_SC("SetSysLog", SYSLOG_SETTING, ScSetSysLog, InRpcSysLogSetting, OutRpcSysLogSetting) -DECLARE_SC("GetSysLog", SYSLOG_SETTING, ScGetSysLog, InRpcSysLogSetting, OutRpcSysLogSetting) -DECLARE_SC_EX("EnumEthVLan", RPC_ENUM_ETH_VLAN, ScEnumEthVLan, InRpcEnumEthVLan, OutRpcEnumEthVLan, FreeRpcEnumEthVLan) -DECLARE_SC("SetEnableEthVLan", RPC_TEST, ScSetEnableEthVLan, InRpcTest, OutRpcTest) -DECLARE_SC_EX("SetHubMsg", RPC_MSG, ScSetHubMsg, InRpcMsg, OutRpcMsg, FreeRpcMsg) -DECLARE_SC_EX("GetHubMsg", RPC_MSG, ScGetHubMsg, InRpcMsg, OutRpcMsg, FreeRpcMsg) -DECLARE_SC("Crash", RPC_TEST, ScCrash, InRpcTest, OutRpcTest) -DECLARE_SC_EX("GetAdminMsg", RPC_MSG, ScGetAdminMsg, InRpcMsg, OutRpcMsg, FreeRpcMsg) -DECLARE_SC("Flush", RPC_TEST, ScFlush, InRpcTest, OutRpcTest) -DECLARE_SC("Debug", RPC_TEST, ScDebug, InRpcTest, OutRpcTest) -DECLARE_SC("SetIPsecServices", IPSEC_SERVICES, ScSetIPsecServices, InIPsecServices, OutIPsecServices) -DECLARE_SC("GetIPsecServices", IPSEC_SERVICES, ScGetIPsecServices, InIPsecServices, OutIPsecServices) -DECLARE_SC("AddEtherIpId", ETHERIP_ID, ScAddEtherIpId, InEtherIpId, OutEtherIpId) -DECLARE_SC("GetEtherIpId", ETHERIP_ID, ScGetEtherIpId, InEtherIpId, OutEtherIpId) -DECLARE_SC("DeleteEtherIpId", ETHERIP_ID, ScDeleteEtherIpId, InEtherIpId, OutEtherIpId) -DECLARE_SC_EX("EnumEtherIpId", RPC_ENUM_ETHERIP_ID, ScEnumEtherIpId, InRpcEnumEtherIpId, OutRpcEnumEtherIpId, FreeRpcEnumEtherIpId) -DECLARE_SC("SetOpenVpnSstpConfig", OPENVPN_SSTP_CONFIG, ScSetOpenVpnSstpConfig, InOpenVpnSstpConfig, OutOpenVpnSstpConfig) -DECLARE_SC("GetOpenVpnSstpConfig", OPENVPN_SSTP_CONFIG, ScGetOpenVpnSstpConfig, InOpenVpnSstpConfig, OutOpenVpnSstpConfig) -DECLARE_SC("GetDDnsClientStatus", DDNS_CLIENT_STATUS, ScGetDDnsClientStatus, InDDnsClientStatus, OutDDnsClientStatus) -DECLARE_SC("ChangeDDnsClientHostname", RPC_TEST, ScChangeDDnsClientHostname, InRpcTest, OutRpcTest) -DECLARE_SC("RegenerateServerCert", RPC_TEST, ScRegenerateServerCert, InRpcTest, OutRpcTest) -DECLARE_SC_EX("MakeOpenVpnConfigFile", RPC_READ_LOG_FILE, ScMakeOpenVpnConfigFile, InRpcReadLogFile, OutRpcReadLogFile, FreeRpcReadLogFile) -DECLARE_SC("SetSpecialListener", RPC_SPECIAL_LISTENER, ScSetSpecialListener, InRpcSpecialListener, OutRpcSpecialListener) -DECLARE_SC("GetSpecialListener", RPC_SPECIAL_LISTENER, ScGetSpecialListener, InRpcSpecialListener, OutRpcSpecialListener) -DECLARE_SC("GetAzureStatus", RPC_AZURE_STATUS, ScGetAzureStatus, InRpcAzureStatus, OutRpcAzureStatus) -DECLARE_SC("SetAzureStatus", RPC_AZURE_STATUS, ScSetAzureStatus, InRpcAzureStatus, OutRpcAzureStatus) -DECLARE_SC("GetDDnsInternetSettng", INTERNET_SETTING, ScGetDDnsInternetSetting, InRpcInternetSetting, OutRpcInternetSetting) -DECLARE_SC("SetDDnsInternetSettng", INTERNET_SETTING, ScSetDDnsInternetSetting, InRpcInternetSetting, OutRpcInternetSetting) -// RPC call function declaration: till here - -// Setting VPN Gate Server Configuration -UINT StSetVgsConfig(ADMIN *a, VGS_CONFIG *t) -{ - return ERR_NOT_SUPPORTED; -} - -// Get VPN Gate configuration -UINT StGetVgsConfig(ADMIN *a, VGS_CONFIG *t) -{ - return ERR_NOT_SUPPORTED; -} - -// Get DDNS proxy configuration -UINT StGetDDnsInternetSetting(ADMIN *a, INTERNET_SETTING *t) -{ - SERVER *s = a->Server; - CEDAR *c = s->Cedar; - UINT ret = ERR_NO_ERROR; - - SERVER_ADMIN_ONLY; - NO_SUPPORT_FOR_BRIDGE; - - if (s->DDnsClient == NULL) - { - return ERR_NOT_SUPPORTED; - } - - Zero(t, sizeof(INTERNET_SETTING)); - - DCGetInternetSetting(s->DDnsClient, t); - - return ret; -} - -// Set DDNS proxy configuration -UINT StSetDDnsInternetSetting(ADMIN *a, INTERNET_SETTING *t) -{ - SERVER *s = a->Server; - CEDAR *c = s->Cedar; - UINT ret = ERR_NO_ERROR; - - SERVER_ADMIN_ONLY; - NO_SUPPORT_FOR_BRIDGE; - - if (s->DDnsClient == NULL) - { - return ERR_NOT_SUPPORTED; - } - - DCSetInternetSetting(s->DDnsClient, t); - - IncrementServerConfigRevision(s); - - return ret; -} - -// Get Azure status -UINT StGetAzureStatus(ADMIN *a, RPC_AZURE_STATUS *t) -{ - SERVER *s = a->Server; - CEDAR *c = s->Cedar; - UINT ret = ERR_NO_ERROR; - AZURE_CLIENT *ac; - - SERVER_ADMIN_ONLY; - NO_SUPPORT_FOR_BRIDGE; - - if (SiIsAzureSupported(s) == false) - { - return ERR_NOT_SUPPORTED; - } - - ac = s->AzureClient; - if (ac == NULL) - { - return ERR_NOT_SUPPORTED; - } - - Zero(t, sizeof(RPC_AZURE_STATUS)); - - Lock(ac->Lock); - { - t->IsConnected = ac->IsConnected; - t->IsEnabled = ac->IsEnabled; - } - Unlock(ac->Lock); - - return ERR_NO_ERROR; -} - -// Set Azure status -UINT StSetAzureStatus(ADMIN *a, RPC_AZURE_STATUS *t) -{ - SERVER *s = a->Server; - CEDAR *c = s->Cedar; - UINT ret = ERR_NO_ERROR; - - SERVER_ADMIN_ONLY; - NO_SUPPORT_FOR_BRIDGE; - - if (SiIsAzureSupported(s) == false) - { - return ERR_NOT_SUPPORTED; - } - - SiSetAzureEnable(s, t->IsEnabled); - - IncrementServerConfigRevision(s); - - return ERR_NO_ERROR; -} - -// Get special listener status -UINT StGetSpecialListener(ADMIN *a, RPC_SPECIAL_LISTENER *t) -{ - SERVER *s = a->Server; - CEDAR *c = s->Cedar; - UINT ret = ERR_NO_ERROR; - - SERVER_ADMIN_ONLY; - NO_SUPPORT_FOR_BRIDGE; - - Zero(t, sizeof(RPC_SPECIAL_LISTENER)); - t->VpnOverDnsListener = s->EnableVpnOverDns; - t->VpnOverIcmpListener = s->EnableVpnOverIcmp; - - return ERR_NO_ERROR; -} - -// Set special listener status -UINT StSetSpecialListener(ADMIN *a, RPC_SPECIAL_LISTENER *t) -{ - SERVER *s = a->Server; - CEDAR *c = s->Cedar; - UINT ret = ERR_NO_ERROR; - - SERVER_ADMIN_ONLY; - NO_SUPPORT_FOR_BRIDGE; - - // Check ports - if (t->VpnOverDnsListener && (MAKEBOOL(s->EnableVpnOverDns) != MAKEBOOL(t->VpnOverDnsListener))) - { - if (SiCanOpenVpnOverDnsPort() == false) - { - return ERR_SPECIAL_LISTENER_DNS_ERROR; - } - } - - if (t->VpnOverIcmpListener && (MAKEBOOL(s->EnableVpnOverIcmp) != MAKEBOOL(t->VpnOverIcmpListener))) - { - if (SiCanOpenVpnOverIcmpPort() == false) - { - return ERR_SPECIAL_LISTENER_ICMP_ERROR; - } - } - - s->EnableVpnOverDns = t->VpnOverDnsListener; - s->EnableVpnOverIcmp = t->VpnOverIcmpListener; - - SiApplySpecialListenerStatus(s); - - ALog(a, NULL, "LA_SET_SPECIAL_LISTENER"); - - IncrementServerConfigRevision(s); - - return ERR_NO_ERROR; -} - -// Set configurations for OpenVPN and SSTP -UINT StSetOpenVpnSstpConfig(ADMIN *a, OPENVPN_SSTP_CONFIG *t) -{ - PROTO *proto = a->Server->Proto; - PROTO_CONTAINER *container, tmp_c; - PROTO_OPTION *option, tmp_o; - UINT ret = ERR_NO_ERROR; - bool changed = false; - - SERVER_ADMIN_ONLY; - - if (proto == NULL) - { - return ERR_NOT_SUPPORTED; - } - - tmp_o.Name = PROTO_OPTION_TOGGLE_NAME; - tmp_c.Name = "OpenVPN"; - - container = Search(proto->Containers, &tmp_c); - if (container != NULL) - { - option = Search(container->Options, &tmp_o); - if (option != NULL) - { - if (option->Type == PROTO_OPTION_BOOL) - { - option->Bool = t->EnableOpenVPN; - changed = true; - } - else - { - ret = ERR_INVALID_PARAMETER; - } - } - else - { - ret = ERR_OBJECT_NOT_FOUND; - } - } - else - { - ret = ERR_OBJECT_NOT_FOUND; - } - - tmp_c.Name = "SSTP"; - - container = Search(proto->Containers, &tmp_c); - if (container != NULL) - { - option = Search(container->Options, &tmp_o); - if (option != NULL) - { - if (option->Type == PROTO_OPTION_BOOL) - { - option->Bool = t->EnableSSTP; - changed = true; - } - else - { - ret = ERR_INVALID_PARAMETER; - } - } - else - { - ret = ERR_OBJECT_NOT_FOUND; - } - } - else - { - ret = ERR_OBJECT_NOT_FOUND; - } - - if (changed) - { - ALog(a, NULL, "LA_SET_OVPN_SSTP_CONFIG"); - IncrementServerConfigRevision(a->Server); - } - - return ret; -} - -// Get configurations for OpenVPN and SSTP -UINT StGetOpenVpnSstpConfig(ADMIN *a, OPENVPN_SSTP_CONFIG *t) -{ - PROTO *proto = a->Server->Proto; - if (proto == NULL) - { - return ERR_NOT_SUPPORTED; - } - - t->EnableOpenVPN = ProtoEnabled(proto, "OpenVPN"); - t->EnableSSTP = ProtoEnabled(proto, "SSTP"); - - return ERR_NO_ERROR; -} - -// Get status of DDNS client -UINT StGetDDnsClientStatus(ADMIN *a, DDNS_CLIENT_STATUS *t) -{ - SERVER *s = a->Server; - CEDAR *c = s->Cedar; - UINT ret = ERR_NO_ERROR; - - SERVER_ADMIN_ONLY; - NO_SUPPORT_FOR_BRIDGE; - - if (s->DDnsClient == NULL) - { - return ERR_NOT_SUPPORTED; - } - - Zero(t, sizeof(DDNS_CLIENT_STATUS)); - DCGetStatus(s->DDnsClient, t); - - return ERR_NO_ERROR; -} - -// Change host-name for DDNS client -UINT StChangeDDnsClientHostname(ADMIN *a, RPC_TEST *t) -{ - SERVER *s = a->Server; - CEDAR *c = s->Cedar; - UINT ret = ERR_NO_ERROR; - - SERVER_ADMIN_ONLY; - NO_SUPPORT_FOR_BRIDGE; - - if (s->DDnsClient == NULL) - { - return ERR_NOT_SUPPORTED; - } - - ret = DCChangeHostName(s->DDnsClient, t->StrValue); - - if (ret == ERR_NO_ERROR) - { - ALog(a, NULL, "LA_DDNS_HOSTNAME_CHANGED", t->StrValue); - } - - IncrementServerConfigRevision(s); - - return ret; -} - -// Regenerate server certification -UINT StRegenerateServerCert(ADMIN *a, RPC_TEST *t) -{ - SERVER *s = a->Server; - CEDAR *c = s->Cedar; - UINT ret = ERR_NO_ERROR; - X *x; - K *k; - - SERVER_ADMIN_ONLY; - - SiGenerateDefaultCertEx(&x, &k, t->StrValue); - - SetCedarCert(c, x, k); - - ALog(a, NULL, "LA_REGENERATE_SERVER_CERT", t->StrValue); - - IncrementServerConfigRevision(s); - - FreeX(x); - FreeK(k); - - return ERR_NO_ERROR; -} - -// Generate OpenVPN configuration files -UINT StMakeOpenVpnConfigFile(ADMIN *a, RPC_READ_LOG_FILE *t) -{ - SERVER *s = a->Server; - CEDAR *c = s->Cedar; - UINT ret = ERR_NO_ERROR; - ZIP_PACKER *p; - FIFO *f; - BUF *readme_buf; - BUF *readme_pdf_buf; - BUF *sample_buf; - LIST *port_list; - char my_hostname[MAX_SIZE]; - - SERVER_ADMIN_ONLY; - NO_SUPPORT_FOR_BRIDGE; - if (s->ServerType != SERVER_TYPE_STANDALONE) - { - return ERR_NOT_SUPPORTED; - } - - if (ProtoEnabled(s->Proto, "OpenVPN") == false) - { - return ERR_OPENVPN_IS_NOT_ENABLED; - } - - port_list = s->PortsUDP; - - FreeRpcReadLogFile(t); - Zero(t, sizeof(RPC_READ_LOG_FILE)); - - p = NewZipPacker(); - - // readme.txt - readme_buf = ReadDump("|openvpn_readme.txt"); - - // readme.pdf - readme_pdf_buf = ReadDump("|openvpn_readme.pdf"); - - // sample.ovpn - sample_buf = ReadDump("|openvpn_sample.ovpn"); - - // host name - GetMachineHostName(my_hostname, sizeof(my_hostname)); - my_hostname[16] = 0; - - if (readme_buf == NULL || sample_buf == NULL || readme_pdf_buf == NULL) - { - ret = ERR_INTERNAL_ERROR; - } - else - { - BUF *config_l3_buf, *config_l2_buf; - X *x = NULL; - BUF *x_buf; - char protocol[MAX_SIZE]; - UINT port = OPENVPN_UDP_PORT; - char port_str[MAX_SIZE]; - char hostname[MAX_SIZE]; - char tag_before_hostname[MAX_SIZE]; - DDNS_CLIENT_STATUS ddns; - UCHAR *zero_buffer; - UINT zero_buffer_size = 128 * 1024; - char name_tmp[MAX_SIZE]; - - zero_buffer = ZeroMalloc(zero_buffer_size); - - - if (x == NULL) - { - Lock(c->lock); - { - x = CloneX(c->ServerX); - } - Unlock(c->lock); - - if (x != NULL) - { - // Get the root certificate - if (x->root_cert == false) - { - X *root_x = NULL; - LIST *cert_list = NewCertList(true); - - if (TryGetRootCertChain(cert_list, x, true, &root_x)) - { - FreeX(x); - x = root_x; - } - - FreeCertList(cert_list); - } - } - } - - x_buf = XToBuf(x, true); - - SeekBufToEnd(x_buf); - WriteBufChar(x_buf, 0); - SeekBufToBegin(x_buf); - - FreeX(x); - Zero(hostname, sizeof(hostname)); - Zero(tag_before_hostname, sizeof(tag_before_hostname)); - - Zero(&ddns, sizeof(ddns)); - if (s->DDnsClient != NULL) - { - DCGetStatus(s->DDnsClient, &ddns); - - if (IsEmptyStr(ddns.CurrentHostName) == false && IsEmptyStr(ddns.DnsSuffix) == false && - ddns.Err_IPv4 == ERR_NO_ERROR) - { - StrCpy(tag_before_hostname, sizeof(tag_before_hostname), - "# Note: The below hostname is came from the Dynamic DNS Client function\r\n" - "# which is running on the VPN Server. If you don't want to use\r\n" - "# the Dynamic DNS hostname, replace it to either IP address or\r\n" - "# other domain's hostname.\r\n\r\n"); - - Format(hostname, sizeof(hostname), "%s.v4%s", ddns.CurrentHostName, ddns.DnsSuffix); - } - } - - if (IsEmptyStr(hostname)) - { - IP myip; - - Zero(&myip, sizeof(myip)); - GetCurrentGlobalIP(&myip, false); - - if (IsZeroIP(&myip)) - { - GetCurrentGlobalIPGuess(&myip, false); - } - - IPToStr(hostname, sizeof(hostname), &myip); - } - - SeekBuf(sample_buf, sample_buf->Size, 0); - WriteBuf(sample_buf, zero_buffer, zero_buffer_size); - - config_l3_buf = CloneBuf(sample_buf); - config_l2_buf = CloneBuf(sample_buf); - - // Generate contents of configuration - if (LIST_NUM(port_list) >= 1) - { - StrCpy(protocol, sizeof(protocol), "udp"); - - if (IsIntInList(port_list, OPENVPN_UDP_PORT)) - { - port = OPENVPN_UDP_PORT; - } - else - { - port = *((UINT *)(LIST_DATA(port_list, 0))); - } - } - else - { - RPC_LISTENER_LIST tt; - UINT i; - - port = 0; - - StrCpy(protocol, sizeof(protocol), "tcp"); - - Zero(&tt, sizeof(tt)); - - StEnumListener(a, &tt); - - for (i = 0;i < tt.NumPort;i++) - { - if (tt.Enables[i] && tt.Errors[i] == false) - { - port = tt.Ports[i]; - break; - } - } - - FreeRpcListenerList(&tt); - - if (port == 0) - { - StrCpy(protocol, sizeof(protocol), "udp"); - port = OPENVPN_UDP_PORT; - } - } - - ToStr(port_str, port); - - if (IsEmptyStr(my_hostname) == false) - { - StrCat(my_hostname, sizeof(my_hostname), "_"); - - StrLower(my_hostname); - } - - ZipAddFileSimple(p, "readme.txt", LocalTime64(), 0, readme_buf->Buf, readme_buf->Size); - ZipAddFileSimple(p, "readme.pdf", LocalTime64(), 0, readme_pdf_buf->Buf, readme_pdf_buf->Size); - - ReplaceStrEx((char *)config_l3_buf->Buf, config_l3_buf->Size, (char *)config_l3_buf->Buf, - "$TAG_TUN_TAP$", "tun", false); - ReplaceStrEx((char *)config_l3_buf->Buf, config_l3_buf->Size, (char *)config_l3_buf->Buf, - "$TAG_PROTO$", protocol, false); - ReplaceStrEx((char *)config_l3_buf->Buf, config_l3_buf->Size, (char *)config_l3_buf->Buf, - "$TAG_HOSTNAME$", hostname, false); - ReplaceStrEx((char *)config_l3_buf->Buf, config_l3_buf->Size, (char *)config_l3_buf->Buf, - "$TAG_BEFORE_REMOTE$", tag_before_hostname, false); - ReplaceStrEx((char *)config_l3_buf->Buf, config_l3_buf->Size, (char *)config_l3_buf->Buf, - "$TAG_PORT$", port_str, false); - - if (x_buf != NULL) - { - ReplaceStrEx((char *)config_l3_buf->Buf, config_l3_buf->Size, (char *)config_l3_buf->Buf, - "$CA$", x_buf->Buf, false); - } - - Format(name_tmp, sizeof(name_tmp), "%sopenvpn_remote_access_l3.ovpn", my_hostname); - ZipAddFileSimple(p, name_tmp, LocalTime64(), 0, config_l3_buf->Buf, StrLen(config_l3_buf->Buf)); - - ReplaceStrEx((char *)config_l2_buf->Buf, config_l2_buf->Size, (char *)config_l2_buf->Buf, - "$TAG_TUN_TAP$", "tap", false); - ReplaceStrEx((char *)config_l2_buf->Buf, config_l2_buf->Size, (char *)config_l2_buf->Buf, - "$TAG_PROTO$", protocol, false); - ReplaceStrEx((char *)config_l2_buf->Buf, config_l2_buf->Size, (char *)config_l2_buf->Buf, - "$TAG_HOSTNAME$", hostname, false); - ReplaceStrEx((char *)config_l2_buf->Buf, config_l2_buf->Size, (char *)config_l2_buf->Buf, - "$TAG_BEFORE_REMOTE$", tag_before_hostname, false); - ReplaceStrEx((char *)config_l2_buf->Buf, config_l2_buf->Size, (char *)config_l2_buf->Buf, - "$TAG_PORT$", port_str, false); - - if (x_buf != NULL) - { - ReplaceStrEx((char *)config_l2_buf->Buf, config_l2_buf->Size, (char *)config_l2_buf->Buf, - "$CA$", x_buf->Buf, false); - } - - Format(name_tmp, sizeof(name_tmp), "%sopenvpn_site_to_site_bridge_l2.ovpn", my_hostname); - ZipAddFileSimple(p, name_tmp, LocalTime64(), 0, config_l2_buf->Buf, StrLen(config_l2_buf->Buf)); - - FreeBuf(config_l3_buf); - FreeBuf(config_l2_buf); - - f = ZipFinish(p); - - if (f != NULL) - { - t->Buffer = NewBuf(); - WriteBuf(t->Buffer, FifoPtr(f), FifoSize(f)); - SeekBuf(t->Buffer, 0, 0); - } - - FreeBuf(readme_buf); - FreeBuf(sample_buf); - FreeBuf(readme_pdf_buf); - FreeBuf(x_buf); - - Free(zero_buffer); - } - - FreeZipPacker(p); - - return ERR_NO_ERROR; -} - -// Set IPsec service configuration -UINT StSetIPsecServices(ADMIN *a, IPSEC_SERVICES *t) -{ - SERVER *s = a->Server; - CEDAR *c = s->Cedar; - UINT ret = ERR_NO_ERROR; - - SERVER_ADMIN_ONLY; - NO_SUPPORT_FOR_BRIDGE; - if (GetServerCapsBool(s, "b_support_ipsec") == false || s->IPsecServer == NULL) - { - return ERR_NOT_SUPPORTED; - } - - IPsecServerSetServices(s->IPsecServer, t); - - ALog(a, NULL, "LA_SET_IPSEC_CONFIG"); - - IncrementServerConfigRevision(s); - - return ERR_NO_ERROR; -} - -// Get IPsec service configuration -UINT StGetIPsecServices(ADMIN *a, IPSEC_SERVICES *t) -{ - SERVER *s = a->Server; - CEDAR *c = s->Cedar; - UINT ret = ERR_NO_ERROR; - - SERVER_ADMIN_ONLY; - NO_SUPPORT_FOR_BRIDGE; - if (GetServerCapsBool(s, "b_support_ipsec") == false || s->IPsecServer == NULL) - { - return ERR_NOT_SUPPORTED; - } - - Zero(t, sizeof(IPSEC_SERVICES)); - IPsecServerGetServices(s->IPsecServer, t); - - return ERR_NO_ERROR; -} - -// Add EtherIP ID setting -UINT StAddEtherIpId(ADMIN *a, ETHERIP_ID *t) -{ - SERVER *s = a->Server; - CEDAR *c = s->Cedar; - UINT ret = ERR_NO_ERROR; - - SERVER_ADMIN_ONLY; - NO_SUPPORT_FOR_BRIDGE; - if (GetServerCapsBool(s, "b_support_ipsec") == false || s->IPsecServer == NULL) - { - return ERR_NOT_SUPPORTED; - } - - AddEtherIPId(s->IPsecServer, t); - - ALog(a, NULL, "LA_ADD_ETHERIP_ID", t->Id); - - IncrementServerConfigRevision(s); - - return ERR_NO_ERROR; -} - -// Get EtherIP ID setting -UINT StGetEtherIpId(ADMIN *a, ETHERIP_ID *t) -{ - SERVER *s = a->Server; - CEDAR *c = s->Cedar; - UINT ret = ERR_NO_ERROR; - char id[MAX_SIZE]; - - SERVER_ADMIN_ONLY; - NO_SUPPORT_FOR_BRIDGE; - if (GetServerCapsBool(s, "b_support_ipsec") == false || s->IPsecServer == NULL) - { - return ERR_NOT_SUPPORTED; - } - - StrCpy(id, sizeof(id), t->Id); - - Zero(t, sizeof(ETHERIP_ID)); - if (SearchEtherIPId(s->IPsecServer, t, id) == false) - { - return ERR_OBJECT_NOT_FOUND; - } - - return ERR_NO_ERROR; -} - -// Delete EtherIP ID setting -UINT StDeleteEtherIpId(ADMIN *a, ETHERIP_ID *t) -{ - SERVER *s = a->Server; - CEDAR *c = s->Cedar; - UINT ret = ERR_NO_ERROR; - char id[MAX_SIZE]; - - SERVER_ADMIN_ONLY; - NO_SUPPORT_FOR_BRIDGE; - if (GetServerCapsBool(s, "b_support_ipsec") == false || s->IPsecServer == NULL) - { - return ERR_NOT_SUPPORTED; - } - - StrCpy(id, sizeof(id), t->Id); - - if (DeleteEtherIPId(s->IPsecServer, id) == false) - { - return ERR_OBJECT_NOT_FOUND; - } - - ALog(a, NULL, "LA_DEL_ETHERIP_ID", id); - - IncrementServerConfigRevision(s); - - return ERR_NO_ERROR; -} - -// Enumerate EtherIP ID settings -UINT StEnumEtherIpId(ADMIN *a, RPC_ENUM_ETHERIP_ID *t) -{ - SERVER *s = a->Server; - CEDAR *c = s->Cedar; - UINT ret = ERR_NO_ERROR; - SERVER_ADMIN_ONLY; - NO_SUPPORT_FOR_BRIDGE; - if (GetServerCapsBool(s, "b_support_ipsec") == false || s->IPsecServer == NULL) - { - return ERR_NOT_SUPPORTED; - } - - FreeRpcEnumEtherIpId(t); - Zero(t, sizeof(RPC_ENUM_ETHERIP_ID)); - - Lock(s->IPsecServer->LockSettings); - { - UINT i; - UINT num; - - num = LIST_NUM(s->IPsecServer->EtherIPIdList); - - t->NumItem = num; - t->IdList = ZeroMalloc(sizeof(ETHERIP_ID) * num); - - for (i = 0;i < num;i++) - { - ETHERIP_ID *d = &t->IdList[i]; - ETHERIP_ID *src = LIST_DATA(s->IPsecServer->EtherIPIdList, i); - - Copy(d, src, sizeof(ETHERIP_ID)); - } - } - Unlock(s->IPsecServer->LockSettings); - - return ERR_NO_ERROR; -} - -// Set message of today on hub -UINT StSetHubMsg(ADMIN *a, RPC_MSG *t) -{ - SERVER *s = a->Server; - CEDAR *c = s->Cedar; - HUB *h; - UINT ret = ERR_NO_ERROR; - char hubname[MAX_HUBNAME_LEN + 1]; - - CHECK_RIGHT; - NO_SUPPORT_FOR_BRIDGE; - if (s->ServerType == SERVER_TYPE_FARM_MEMBER) - { - return ERR_NOT_SUPPORTED; - } - if (UniStrLen(t->Msg) > HUB_MAXMSG_LEN) - { - return ERR_MEMORY_NOT_ENOUGH; - } - - StrCpy(hubname, sizeof(hubname), t->HubName); - - h = GetHub(c, hubname); - - if (h == NULL) - { - ret = ERR_HUB_NOT_FOUND; - } - else - { - if (a->ServerAdmin == false && GetHubAdminOption(h, "no_change_msg") != 0) - { - ret = ERR_NOT_ENOUGH_RIGHT; - } - else - { - SetHubMsg(h, t->Msg); - } - - ReleaseHub(h); - } - - IncrementServerConfigRevision(s); - - return ret; -} - -// Get message of today on hub -UINT StGetHubMsg(ADMIN *a, RPC_MSG *t) -{ - SERVER *s = a->Server; - CEDAR *c = s->Cedar; - HUB *h; - UINT ret = ERR_NO_ERROR; - char hubname[MAX_HUBNAME_LEN + 1]; - - CHECK_RIGHT; - NO_SUPPORT_FOR_BRIDGE; - if (s->ServerType == SERVER_TYPE_FARM_MEMBER) - { - return ERR_NOT_SUPPORTED; - } - if (UniStrLen(t->Msg) > HUB_MAXMSG_LEN) - { - return ERR_MEMORY_NOT_ENOUGH; - } - - StrCpy(hubname, sizeof(hubname), t->HubName); - - h = GetHub(c, hubname); - - if (h == NULL) - { - ret = ERR_HUB_NOT_FOUND; - } - else - { - FreeRpcMsg(t); - Zero(t, sizeof(RPC_MSG)); - - t->Msg = GetHubMsg(h); - - ReleaseHub(h); - } - - return ret; -} - -// Do debug function -UINT StDebug(ADMIN *a, RPC_TEST *t) -{ - SERVER *s = a->Server; - CEDAR *c = s->Cedar; - UINT ret = ERR_NO_ERROR; - RPC_TEST t2; - - SERVER_ADMIN_ONLY; - - Zero(&t2, sizeof(t2)); - - ret = SiDebug(s, &t2, t->IntValue, t->StrValue); - - if (ret == ERR_NO_ERROR) - { - Copy(t, &t2, sizeof(RPC_TEST)); - } - else - { - Zero(t, sizeof(RPC_TEST)); - } - - return ret; -} - -// Flush configuration file -UINT StFlush(ADMIN *a, RPC_TEST *t) -{ - SERVER *s = a->Server; - CEDAR *c = s->Cedar; - UINT ret = ERR_NO_ERROR; - UINT size; - - SERVER_ADMIN_ONLY; - - size = SiWriteConfigurationFile(s); - - t->IntValue = size; - - return ERR_NO_ERROR; -} - -// Do Crash -UINT StCrash(ADMIN *a, RPC_TEST *t) -{ - SERVER *s = a->Server; - CEDAR *c = s->Cedar; - UINT ret = ERR_NO_ERROR; - - SERVER_ADMIN_ONLY; - -#ifdef OS_WIN32 - MsSetEnableMinidump(false); -#endif // OS_WIN32 - - CrashNow(); - - return ERR_NO_ERROR; -} - -// Get message for administrators -UINT StGetAdminMsg(ADMIN *a, RPC_MSG *t) -{ - SERVER *s = a->Server; - CEDAR *c = s->Cedar; - UINT ret = ERR_NO_ERROR; - RPC_WINVER server_ver; - RPC_WINVER client_ver; - wchar_t winver_msg_client[3800]; - wchar_t winver_msg_server[3800]; - UINT tmpsize; - wchar_t *tmp; - - FreeRpcMsg(t); - Zero(t, sizeof(RPC_MSG)); - - // Check for Windows version - GetWinVer(&server_ver); - Copy(&client_ver, &a->ClientWinVer, sizeof(RPC_WINVER)); - - Zero(winver_msg_client, sizeof(winver_msg_client)); - Zero(winver_msg_server, sizeof(winver_msg_server)); - - if (IsSupportedWinVer(&client_ver) == false) - { - SYSTEMTIME st; - - LocalTime(&st); - - UniFormat(winver_msg_client, sizeof(winver_msg_client), _UU("WINVER_ERROR_FORMAT"), - _UU("WINVER_ERROR_PC_LOCAL"), - client_ver.Title, - _UU("WINVER_ERROR_VPNSERVER"), - SUPPORTED_WINDOWS_LIST, - _UU("WINVER_ERROR_PC_LOCAL"), - _UU("WINVER_ERROR_VPNSERVER"), - _UU("WINVER_ERROR_VPNSERVER"), - _UU("WINVER_ERROR_VPNSERVER"), - st.wYear, st.wMonth); - } - - if (IsSupportedWinVer(&server_ver) == false) - { - SYSTEMTIME st; - - LocalTime(&st); - - UniFormat(winver_msg_server, sizeof(winver_msg_server), _UU("WINVER_ERROR_FORMAT"), - _UU("WINVER_ERROR_PC_REMOTE"), - server_ver.Title, - _UU("WINVER_ERROR_VPNSERVER"), - SUPPORTED_WINDOWS_LIST, - _UU("WINVER_ERROR_PC_REMOTE"), - _UU("WINVER_ERROR_VPNSERVER"), - _UU("WINVER_ERROR_VPNSERVER"), - _UU("WINVER_ERROR_VPNSERVER"), - st.wYear, st.wMonth); - } - - tmpsize = UniStrSize(winver_msg_client) + UniStrSize(winver_msg_server) + 10000; - - tmp = ZeroMalloc(tmpsize); - - if ( - c->Bridge == false) - { - if (GetGlobalServerFlag(GSF_SHOW_OSS_MSG) != 0) - { - UniStrCat(tmp, tmpsize, _UU("OSS_MSG")); - } - } - - UniStrCat(tmp, tmpsize, winver_msg_client); - UniStrCat(tmp, tmpsize, winver_msg_server); - - t->Msg = tmp; - - return ERR_NO_ERROR; -} - -// Enumerate VLAN tag transparent setting -UINT StEnumEthVLan(ADMIN *a, RPC_ENUM_ETH_VLAN *t) -{ - SERVER *s = a->Server; - CEDAR *c = s->Cedar; - UINT ret = ERR_NO_ERROR; - - SERVER_ADMIN_ONLY; - -#ifdef OS_WIN32 - if (GetServerCapsBool(s, "b_support_eth_vlan") == false) - { - ret = ERR_NOT_SUPPORTED; - } - else - { - FreeRpcEnumEthVLan(t); - Zero(t, sizeof(RPC_ENUM_ETH_VLAN)); - - if (EnumEthVLanWin32(t) == false) - { - ret = ERR_INTERNAL_ERROR; - } - } -#else // OS_WIN32 - ret = ERR_NOT_SUPPORTED; -#endif // OS_WIN32 - - return ret; -} - -// Set VLAN tag transparent setting -UINT StSetEnableEthVLan(ADMIN *a, RPC_TEST *t) -{ - SERVER *s = a->Server; - CEDAR *c = s->Cedar; - UINT ret = ERR_NO_ERROR; - - SERVER_ADMIN_ONLY; - -#ifdef OS_WIN32 - if (GetServerCapsBool(s, "b_support_eth_vlan") == false) - { - ret = ERR_NOT_SUPPORTED; - } - else if (MsIsAdmin() == false) - { - ret = ERR_NOT_ENOUGH_RIGHT; - } - else - { - if (SetVLanEnableStatus(t->StrValue, MAKEBOOL(t->IntValue)) == false) - { - ret = ERR_INTERNAL_ERROR; - } - } -#else // OS_WIN32 - ret = ERR_NOT_SUPPORTED; -#endif // OS_WIN32 - - return ret; -} - -// Get license status -UINT StGetLicenseStatus(ADMIN *a, RPC_LICENSE_STATUS *t) -{ - return ERR_NOT_SUPPORTED; -} - -// Enumerate license key -UINT StEnumLicenseKey(ADMIN *a, RPC_ENUM_LICENSE_KEY *t) -{ - return ERR_NOT_SUPPORTED; -} - -// Add new license key -UINT StAddLicenseKey(ADMIN *a, RPC_TEST *t) -{ - return ERR_NOT_SUPPORTED; -} - -// Delete a license key -UINT StDelLicenseKey(ADMIN *a, RPC_TEST *t) -{ - return ERR_NOT_SUPPORTED; -} - -// Download a log file -BUF *DownloadFileFromServer(RPC *r, char *server_name, char *filepath, UINT total_size, DOWNLOAD_PROC *proc, void *param) -{ - UINT offset; - BUF *buf; - // Validate arguments - if (r == NULL || filepath == NULL) - { - return NULL; - } - - if (server_name == NULL) - { - server_name = ""; - } - - offset = 0; - - buf = NewBuf(); - - while (true) - { - DOWNLOAD_PROGRESS g; - RPC_READ_LOG_FILE t; - UINT ret; - - Zero(&t, sizeof(t)); - StrCpy(t.FilePath, sizeof(t.FilePath), filepath); - t.Offset = offset; - StrCpy(t.ServerName, sizeof(t.ServerName), server_name); - - ret = ScReadLogFile(r, &t); - - if (ret != ERR_NO_ERROR) - { - // Failed - FreeRpcReadLogFile(&t); - FreeBuf(buf); - return NULL; - } - - if (t.Buffer == NULL) - { - // read to the end - break; - } - - // Update current progress - offset += t.Buffer->Size; - Zero(&g, sizeof(g)); - g.Param = param; - g.CurrentSize = offset; - g.TotalSize = MAX(total_size, offset); - g.ProgressPercent = (UINT)(MAKESURE((UINT64)g.CurrentSize * 100ULL / (UINT64)(MAX(g.TotalSize, 1)), 0, 100ULL)); - - WriteBuf(buf, t.Buffer->Buf, t.Buffer->Size); - - FreeRpcReadLogFile(&t); - - if (proc != NULL) - { - if (proc(&g) == false) - { - // Canceled by user - FreeBuf(buf); - return NULL; - } - } - } - - if (buf->Size == 0) - { - // Downloading failed - FreeBuf(buf); - return NULL; - } - - return buf; -} - -// Read a log file -UINT StReadLogFile(ADMIN *a, RPC_READ_LOG_FILE *t) -{ - SERVER *s = a->Server; - CEDAR *c = s->Cedar; - char logfilename[MAX_PATH]; - char servername[MAX_HOST_NAME_LEN + 1]; - UINT offset; - bool local = true; - - if (IsEmptyStr(t->FilePath)) - { - return ERR_INVALID_PARAMETER; - } - - StrCpy(logfilename, sizeof(logfilename), t->FilePath); - StrCpy(servername, sizeof(servername), t->ServerName); - offset = t->Offset; - - if (s->ServerType != SERVER_TYPE_FARM_CONTROLLER) - { - GetMachineName(servername, sizeof(servername)); - } - - // Check the permission to read the log file - if (a->LogFileList == NULL) - { - // Enum the log files first - RPC_ENUM_LOG_FILE elf; - UINT elf_ret; - - Zero(&elf, sizeof(elf)); - - elf_ret = StEnumLogFile(a, &elf); - - FreeRpcEnumLogFile(&elf); - - if (elf_ret != ERR_NO_ERROR) - { - return elf_ret; - } - } - if (CheckLogFileNameFromEnumList(a->LogFileList, logfilename, servername) == false) - { - // There is no such file in the log file list - return ERR_OBJECT_NOT_FOUND; - } - - FreeRpcReadLogFile(t); - Zero(t, sizeof(RPC_READ_LOG_FILE)); - - if (s->ServerType == SERVER_TYPE_FARM_CONTROLLER) - { - UINT i; - - // When the host name in request is a cluster member, redirect the request - LockList(s->FarmMemberList); - { - for (i = 0;i < LIST_NUM(s->FarmMemberList);i++) - { - FARM_MEMBER *f = LIST_DATA(s->FarmMemberList, i); - - if (f->Me == false) - { - if (StrCmpi(f->hostname, servername) == 0) - { - RPC_READ_LOG_FILE tt; - - Zero(&tt, sizeof(tt)); - local = false; - - StrCpy(tt.ServerName, sizeof(tt.ServerName), servername); - StrCpy(tt.FilePath, sizeof(tt.FilePath), logfilename); - tt.Offset = offset; - - if (SiCallReadLogFile(s, f, &tt)) - { - if (tt.Buffer != NULL && tt.Buffer->Size > 0) - { - t->Buffer = NewBuf(); - WriteBuf(t->Buffer, tt.Buffer->Buf, tt.Buffer->Size); - } - } - - FreeRpcReadLogFile(&tt); - - break; - } - } - } - } - UnlockList(s->FarmMemberList); - } - - // Read a local file - if (local) - { - SiReadLocalLogFile(s, logfilename, offset, t); - } - - if (offset == 0) - { - ALog(a, NULL, "LA_READ_LOG_FILE", servername, logfilename); - } - - StrCpy(t->FilePath, sizeof(t->FilePath), logfilename); - StrCpy(t->ServerName, sizeof(t->ServerName), servername); - t->Offset = offset; - - return ERR_NO_ERROR; -} - -// Enumerate log files -UINT StEnumLogFile(ADMIN *a, RPC_ENUM_LOG_FILE *t) -{ - SERVER *s = a->Server; - CEDAR *c = s->Cedar; - UINT i; - bool no_access = false; - - HUB *h; - - if (a->ServerAdmin == false) - { - h = GetHub(c, a->HubName); - - if (a->ServerAdmin == false && GetHubAdminOption(h, "no_read_log_file") != 0) - { - no_access = true; - } - - ReleaseHub(h); - } - else - { - if (s->ServerType == SERVER_TYPE_FARM_CONTROLLER) - { - // Since Management session will become unstable if log files are - // enumerated on a cluster controller, it forbids. - return ERR_NOT_SUPPORTED; - } - } - - if (no_access) - { - return ERR_NOT_ENOUGH_RIGHT; - } - - FreeRpcEnumLogFile(t); - Zero(t, sizeof(RPC_ENUM_LOG_FILE)); - - // Enumerate local log files - SiEnumLocalLogFileList(s, a->ServerAdmin ? NULL : a->HubName, t); - - if (s->ServerType == SERVER_TYPE_FARM_CONTROLLER) - { - UINT i; - LIST *tt_list = NewListFast(NULL); - - LockList(s->FarmMemberList); - { - for (i = 0;i < LIST_NUM(s->FarmMemberList);i++) - { - FARM_MEMBER *f = LIST_DATA(s->FarmMemberList, i); - - if (f->Me == false) - { - // Enumerate log files on other cluster members. - RPC_ENUM_LOG_FILE *tt; - tt = ZeroMalloc(sizeof(RPC_ENUM_LOG_FILE)); - - if (SiCallEnumLogFileList(s, f, tt, a->ServerAdmin ? "" : a->HubName)) - { - UINT i; - for (i = 0;i < tt->NumItem;i++) - { - RPC_ENUM_LOG_FILE_ITEM *e = &tt->Items[i]; - - StrCpy(e->ServerName, sizeof(e->ServerName), f->hostname); - } - - Add(tt_list, tt); - } - else - { - Free(tt); - } - } - } - } - UnlockList(s->FarmMemberList); - - for (i = 0;i < LIST_NUM(tt_list);i++) - { - RPC_ENUM_LOG_FILE *tt = LIST_DATA(tt_list, i); - - AdjoinRpcEnumLogFile(t, tt); - FreeRpcEnumLogFile(tt); - - Free(tt); - } - - ReleaseList(tt_list); - } - - // Cache the last list of log files on RPC session - if (a->LogFileList != NULL) - { - FreeEnumLogFile(a->LogFileList); - } - - a->LogFileList = NewListFast(CmpLogFile); - - for (i = 0;i < t->NumItem;i++) - { - RPC_ENUM_LOG_FILE_ITEM *e = &t->Items[i]; - LOG_FILE *f = ZeroMalloc(sizeof(LOG_FILE)); - - f->FileSize = e->FileSize; - f->UpdatedTime = e->UpdatedTime; - StrCpy(f->Path, sizeof(f->Path), e->FilePath); - StrCpy(f->ServerName, sizeof(f->ServerName), e->ServerName); - - Insert(a->LogFileList, f); - } - - return ERR_NO_ERROR; -} - - -// Get access control list -UINT StGetAcList(ADMIN *a, RPC_AC_LIST *t) -{ - SERVER *s = a->Server; - CEDAR *c = s->Cedar; - HUB *h; - UINT ret = ERR_NO_ERROR; - char hubname[MAX_HUBNAME_LEN + 1]; - - CHECK_RIGHT; - NO_SUPPORT_FOR_BRIDGE; - if (s->ServerType == SERVER_TYPE_FARM_MEMBER) - { - return ERR_NOT_SUPPORTED; - } - - - StrCpy(hubname, sizeof(hubname), t->HubName); - - FreeRpcAcList(t); - Zero(t, sizeof(RPC_AC_LIST)); - StrCpy(t->HubName, sizeof(t->HubName), hubname); - - h = GetHub(c, hubname); - - if (h == NULL) - { - ret = ERR_HUB_NOT_FOUND; - } - else - { - if (h->HubDb == NULL) - { - ret = ERR_NOT_SUPPORTED; - } - else - { - HUBDB *db = h->HubDb; - - LockList(db->AcList); - { - t->o = NewAcList(); - - SetAcList(t->o, db->AcList); - } - UnlockList(db->AcList); - } - ReleaseHub(h); - } - - return ret; -} - -// Set access control list -UINT StSetAcList(ADMIN *a, RPC_AC_LIST *t) -{ - SERVER *s = a->Server; - CEDAR *c = s->Cedar; - HUB *h; - UINT ret = ERR_NO_ERROR; - char hubname[MAX_HUBNAME_LEN + 1]; - - - if (c->Bridge) - { - return ERR_NOT_SUPPORTED; - } - - if (GetGlobalServerFlag(GSF_DISABLE_AC) != 0 && LIST_NUM(t->o) >= 1) - { - return ERR_NOT_SUPPORTED_FUNCTION_ON_OPENSOURCE; - } - - CHECK_RIGHT; - NO_SUPPORT_FOR_BRIDGE; - if (s->ServerType == SERVER_TYPE_FARM_MEMBER) - { - return ERR_NOT_SUPPORTED; - } - - StrCpy(hubname, sizeof(hubname), t->HubName); - - h = GetHub(c, hubname); - - if (h == NULL) - { - ret = ERR_HUB_NOT_FOUND; - } - else - { - if (a->ServerAdmin == false && GetHubAdminOption(h, "no_change_access_control_list") != 0) - { - ret = ERR_NOT_ENOUGH_RIGHT; - } - else - { - if (h->HubDb == NULL) - { - ret = ERR_NOT_SUPPORTED; - } - else - { - HUBDB *db = h->HubDb; - - LockList(db->AcList); - { - SetAcList(db->AcList, t->o); - - { - ALog(a, h, "LA_SET_AC_LIST", LIST_NUM(t->o)); - - IncrementServerConfigRevision(s); - } - } - UnlockList(db->AcList); - } - } - ReleaseHub(h); - } - - return ret; -} - -// Set CRL (Certificate Revocation List) entry -UINT StSetCrl(ADMIN *a, RPC_CRL *t) -{ - SERVER *s = a->Server; - CEDAR *c = s->Cedar; - HUB *h; - UINT ret = ERR_NO_ERROR; - UINT key; - char hubname[MAX_HUBNAME_LEN + 1]; - - CHECK_RIGHT; - NO_SUPPORT_FOR_BRIDGE; - if (s->ServerType == SERVER_TYPE_FARM_MEMBER) - { - return ERR_NOT_SUPPORTED; - } - - StrCpy(hubname, sizeof(hubname), t->HubName); - key = t->Key; - - h = GetHub(c, hubname); - - if (h == NULL) - { - ret = ERR_HUB_NOT_FOUND; - } - else - { - if (a->ServerAdmin == false && GetHubAdminOption(h, "no_change_crl_list") != 0) - { - ret = ERR_NOT_ENOUGH_RIGHT; - } - else - { - if (h->HubDb == NULL) - { - ret = ERR_NOT_SUPPORTED; - } - else - { - LockList(h->HubDb->CrlList); - { - CRL *crl = ListKeyToPointer(h->HubDb->CrlList, t->Key); - - if (crl == NULL) - { - ret = ERR_OBJECT_NOT_FOUND; - } - else - { - CRL *new_crl = CopyCrl(t->Crl); - if (ReplaceListPointer(h->HubDb->CrlList, crl, new_crl)) - { - ALog(a, h, "LA_ADD_CRL"); - FreeCrl(crl); - - IncrementServerConfigRevision(s); - } - } - } - UnlockList(h->HubDb->CrlList); - } - } - - ReleaseHub(h); - } - - return ret; -} - -// Get CRL (Certificate Revocation List) entry -UINT StGetCrl(ADMIN *a, RPC_CRL *t) -{ - SERVER *s = a->Server; - CEDAR *c = s->Cedar; - HUB *h; - UINT ret = ERR_NO_ERROR; - UINT key; - char hubname[MAX_HUBNAME_LEN + 1]; - - CHECK_RIGHT; - NO_SUPPORT_FOR_BRIDGE; - if (s->ServerType == SERVER_TYPE_FARM_MEMBER) - { - return ERR_NOT_SUPPORTED; - } - - StrCpy(hubname, sizeof(hubname), t->HubName); - key = t->Key; - - FreeRpcCrl(t); - Zero(t, sizeof(RPC_CRL)); - StrCpy(t->HubName, sizeof(t->HubName), hubname); - t->Key = key; - - h = GetHub(c, hubname); - - if (h == NULL) - { - ret = ERR_HUB_NOT_FOUND; - } - else - { - if (h->HubDb == NULL) - { - ret = ERR_NOT_SUPPORTED; - } - else - { - LockList(h->HubDb->CrlList); - { - CRL *crl = ListKeyToPointer(h->HubDb->CrlList, t->Key); - - if (crl == NULL) - { - ret = ERR_OBJECT_NOT_FOUND; - } - else - { - t->Crl = CopyCrl(crl); - } - } - UnlockList(h->HubDb->CrlList); - } - - ReleaseHub(h); - } - - return ret; -} - -// Delete CRL (Certificate Revocation List) entry -UINT StDelCrl(ADMIN *a, RPC_CRL *t) -{ - SERVER *s = a->Server; - CEDAR *c = s->Cedar; - HUB *h; - UINT ret = ERR_NO_ERROR; - char hubname[MAX_HUBNAME_LEN + 1]; - - CHECK_RIGHT; - NO_SUPPORT_FOR_BRIDGE; - if (s->ServerType == SERVER_TYPE_FARM_MEMBER) - { - return ERR_NOT_SUPPORTED; - } - - StrCpy(hubname, sizeof(hubname), t->HubName); - - h = GetHub(c, hubname); - - if (h == NULL) - { - ret = ERR_HUB_NOT_FOUND; - } - else - { - if (a->ServerAdmin == false && GetHubAdminOption(h, "no_change_crl_list") != 0) - { - ret = ERR_NOT_ENOUGH_RIGHT; - } - else - { - if (h->HubDb == NULL) - { - ret = ERR_NOT_SUPPORTED; - } - else - { - LockList(h->HubDb->CrlList); - { - CRL *crl = ListKeyToPointer(h->HubDb->CrlList, t->Key); - - if (crl == NULL) - { - ret = ERR_OBJECT_NOT_FOUND; - } - else - { - ALog(a, h, "LA_DEL_CRL"); - FreeCrl(crl); - Delete(h->HubDb->CrlList, crl); - } - } - UnlockList(h->HubDb->CrlList); - } - } - - ReleaseHub(h); - } - - return ret; -} - -// Add new CRL (Certificate Revocation List) entry -UINT StAddCrl(ADMIN *a, RPC_CRL *t) -{ - SERVER *s = a->Server; - CEDAR *c = s->Cedar; - HUB *h; - UINT ret = ERR_NO_ERROR; - char hubname[MAX_HUBNAME_LEN + 1]; - - if (c->Bridge) - { - return ERR_NOT_SUPPORTED; - } - - CHECK_RIGHT; - NO_SUPPORT_FOR_BRIDGE; - if (s->ServerType == SERVER_TYPE_FARM_MEMBER) - { - return ERR_NOT_SUPPORTED; - } - - StrCpy(hubname, sizeof(hubname), t->HubName); - - h = GetHub(c, hubname); - - if (h == NULL) - { - ret = ERR_HUB_NOT_FOUND; - } - else - { - if (a->ServerAdmin == false && GetHubAdminOption(h, "no_change_crl_list") != 0) - { - ret = ERR_NOT_ENOUGH_RIGHT; - } - else - { - if (h->HubDb == NULL) - { - ret = ERR_NOT_SUPPORTED; - } - else - { - LockList(h->HubDb->CrlList); - { - if (LIST_NUM(h->HubDb->CrlList) < MAX_HUB_CRLS) - { - CRL *crl = CopyCrl(t->Crl); - - Insert(h->HubDb->CrlList, crl); - - ALog(a, h, "LA_SET_CRL"); - - IncrementServerConfigRevision(s); - } - } - UnlockList(h->HubDb->CrlList); - } - } - - ReleaseHub(h); - } - - return ret; -} - -// Get CRL (Certificate Revocation List) index -UINT StEnumCrl(ADMIN *a, RPC_ENUM_CRL *t) -{ - SERVER *s = a->Server; - CEDAR *c = s->Cedar; - HUB *h; - UINT ret = ERR_NO_ERROR; - char hubname[MAX_HUBNAME_LEN + 1]; - - CHECK_RIGHT; - NO_SUPPORT_FOR_BRIDGE; - if (s->ServerType == SERVER_TYPE_FARM_MEMBER) - { - return ERR_NOT_SUPPORTED; - } - - StrCpy(hubname, sizeof(hubname), t->HubName); - FreeRpcEnumCrl(t); - Zero(t, sizeof(RPC_ENUM_CRL)); - - StrCpy(t->HubName, sizeof(t->HubName), hubname); - - h = GetHub(c, hubname); - - if (h == NULL) - { - ret = ERR_HUB_NOT_FOUND; - } - else - { - if (h->HubDb == NULL) - { - ret = ERR_NOT_SUPPORTED; - } - else - { - LockList(h->HubDb->CrlList); - { - UINT i; - - t->NumItem = LIST_NUM(h->HubDb->CrlList); - t->Items = ZeroMalloc(sizeof(RPC_ENUM_CRL_ITEM) * t->NumItem); - - for (i = 0;i < LIST_NUM(h->HubDb->CrlList);i++) - { - CRL *crl = LIST_DATA(h->HubDb->CrlList, i); - wchar_t *info = GenerateCrlStr(crl); - - UniStrCpy(t->Items[i].CrlInfo, sizeof(t->Items[i].CrlInfo), info); - Free(info); - - t->Items[i].Key = POINTER_TO_KEY(crl); - } - } - UnlockList(h->HubDb->CrlList); - } - - ReleaseHub(h); - } - - return ret; -} - -// Get routing table on virtual L3 switch -UINT StEnumL3Table(ADMIN *a, RPC_ENUM_L3TABLE *t) -{ - SERVER *s = a->Server; - CEDAR *c = s->Cedar; - UINT ret = ERR_NO_ERROR; - L3SW *sw; - char name[MAX_HUBNAME_LEN + 1]; - - if (IsEmptyStr(t->Name)) - { - return ERR_INVALID_PARAMETER; - } - - NO_SUPPORT_FOR_BRIDGE; - - StrCpy(name, sizeof(name), t->Name); - FreeRpcEnumL3Table(t); - Zero(t, sizeof(RPC_ENUM_L3TABLE)); - StrCpy(t->Name, sizeof(t->Name), name); - - sw = L3GetSw(c, t->Name); - - if (sw == NULL) - { - ret = ERR_LAYER3_SW_NOT_FOUND; - } - else - { - UINT i; - - Lock(sw->lock); - { - t->NumItem = LIST_NUM(sw->TableList); - t->Items = ZeroMalloc(sizeof(RPC_L3TABLE) * t->NumItem); - - for (i = 0;i < t->NumItem;i++) - { - L3TABLE *tbl = LIST_DATA(sw->TableList, i); - RPC_L3TABLE *e = &t->Items[i]; - - StrCpy(e->Name, sizeof(e->Name), name); - e->NetworkAddress = tbl->NetworkAddress; - e->SubnetMask = tbl->SubnetMask; - e->GatewayAddress = tbl->GatewayAddress; - e->Metric = tbl->Metric; - } - } - Unlock(sw->lock); - - ReleaseL3Sw(sw); - } - - return ret; -} - -// Delete routing table entry on virtual L3 switch -UINT StDelL3Table(ADMIN *a, RPC_L3TABLE *t) -{ - SERVER *s = a->Server; - CEDAR *c = s->Cedar; - UINT ret = ERR_NO_ERROR; - L3SW *sw; - - SERVER_ADMIN_ONLY; - - NO_SUPPORT_FOR_BRIDGE; - - sw = L3GetSw(c, t->Name); - - if (sw == NULL) - { - ret = ERR_LAYER3_SW_NOT_FOUND; - } - else - { - L3TABLE tbl; - - Zero(&tbl, sizeof(tbl)); - tbl.NetworkAddress = t->NetworkAddress; - tbl.SubnetMask = t->SubnetMask; - tbl.GatewayAddress = t->GatewayAddress; - tbl.Metric = t->Metric; - - if (L3DelTable(sw, &tbl) == false) - { - ret = ERR_LAYER3_TABLE_DEL_FAILED; - } - else - { - char tmp[MAX_SIZE]; - IPToStr32(tmp, sizeof(tmp), tbl.NetworkAddress); - ALog(a, NULL, "LA_DEL_L3_TABLE", tmp, t->Name); - - IncrementServerConfigRevision(s); - } - - ReleaseL3Sw(sw); - } - - return ret; -} - -// Add new routing table entry on virtual L3 switch -UINT StAddL3Table(ADMIN *a, RPC_L3TABLE *t) -{ - SERVER *s = a->Server; - CEDAR *c = s->Cedar; - UINT ret = ERR_NO_ERROR; - L3SW *sw; - - if (IsNetworkAddress32(t->NetworkAddress, t->SubnetMask) == false || - IsHostIPAddress32(t->GatewayAddress) == false) - { - return ERR_INVALID_PARAMETER; - } - - SERVER_ADMIN_ONLY; - - NO_SUPPORT_FOR_BRIDGE; - - sw = L3GetSw(c, t->Name); - - if (sw == NULL) - { - ret = ERR_LAYER3_SW_NOT_FOUND; - } - else - { - L3TABLE tbl; - - Zero(&tbl, sizeof(tbl)); - tbl.NetworkAddress = t->NetworkAddress; - tbl.SubnetMask = t->SubnetMask; - tbl.GatewayAddress = t->GatewayAddress; - tbl.Metric = t->Metric; - - if (L3AddTable(sw, &tbl) == false) - { - ret = ERR_LAYER3_TABLE_ADD_FAILED; - } - else - { - char tmp[MAX_SIZE]; - IPToStr32(tmp, sizeof(tmp), tbl.NetworkAddress); - ALog(a, NULL, "LA_ADD_L3_TABLE", tmp, t->Name); - - IncrementServerConfigRevision(s); - } - - ReleaseL3Sw(sw); - } - - return ret; -} - -// Enumerate virtual interfaces on virtual L3 switch -UINT StEnumL3If(ADMIN *a, RPC_ENUM_L3IF *t) -{ - SERVER *s = a->Server; - CEDAR *c = s->Cedar; - UINT ret = ERR_NO_ERROR; - L3SW *sw; - char name[MAX_HUBNAME_LEN + 1]; - - NO_SUPPORT_FOR_BRIDGE; - - StrCpy(name, sizeof(name), t->Name); - - FreeRpcEnumL3If(t); - Zero(t, sizeof(RPC_ENUM_L3IF)); - - StrCpy(t->Name, sizeof(t->Name), name); - - sw = L3GetSw(c, t->Name); - - if (sw == NULL) - { - ret = ERR_LAYER3_SW_NOT_FOUND; - } - else - { - Lock(sw->lock); - { - UINT i; - - t->NumItem = LIST_NUM(sw->IfList); - t->Items = ZeroMalloc(sizeof(RPC_L3IF) * t->NumItem); - - for (i = 0;i < t->NumItem;i++) - { - L3IF *f = LIST_DATA(sw->IfList, i); - RPC_L3IF *e = &t->Items[i]; - - StrCpy(e->Name, sizeof(e->Name), sw->Name); - StrCpy(e->HubName, sizeof(e->HubName), f->HubName); - e->IpAddress = f->IpAddress; - e->SubnetMask = f->SubnetMask; - } - } - Unlock(sw->lock); - - ReleaseL3Sw(sw); - } - - return ret; -} - -// Delete a virtual interface on virtual L3 switch -UINT StDelL3If(ADMIN *a, RPC_L3IF *t) -{ - SERVER *s = a->Server; - CEDAR *c = s->Cedar; - UINT ret = ERR_NO_ERROR; - L3SW *sw; - - NO_SUPPORT_FOR_BRIDGE; - - SERVER_ADMIN_ONLY; - - sw = L3GetSw(c, t->Name); - - if (sw == NULL) - { - ret = ERR_LAYER3_SW_NOT_FOUND; - } - else - { - if (L3DelIf(sw, t->HubName) == false) - { - ret = ERR_LAYER3_IF_DEL_FAILED; - } - else - { - ALog(a, NULL, "LA_DEL_L3_IF", t->HubName, t->Name); - - IncrementServerConfigRevision(s); - } - ReleaseL3Sw(sw); - } - - return ret; -} - -// Add new virtual interface on virtual L3 switch -UINT StAddL3If(ADMIN *a, RPC_L3IF *t) -{ - SERVER *s = a->Server; - CEDAR *c = s->Cedar; - UINT ret = ERR_NO_ERROR; - L3SW *sw; - - - if (IsSubnetMask32(t->SubnetMask) == false || IsHostIPAddress32(t->IpAddress) == false) - { - return ERR_INVALID_PARAMETER; - } - if ((t->IpAddress & (~t->SubnetMask)) == 0) - { - return ERR_INVALID_PARAMETER; - } - - NO_SUPPORT_FOR_BRIDGE; - - SERVER_ADMIN_ONLY; - - sw = L3GetSw(c, t->Name); - - if (sw == NULL) - { - ret = ERR_LAYER3_SW_NOT_FOUND; - } - else - { - Lock(sw->lock); - { - if (L3SearchIf(sw, t->HubName) != NULL) - { - // Already exists - ret = ERR_LAYER3_IF_EXISTS; - } - else - { - if (L3AddIf(sw, t->HubName, t->IpAddress, t->SubnetMask) == false) - { - ret = ERR_LAYER3_IF_ADD_FAILED; - } - else - { - ALog(a, NULL, "LA_ADD_L3_IF", t->HubName, t->Name); - - IncrementServerConfigRevision(s); - } - } - } - Unlock(sw->lock); - ReleaseL3Sw(sw); - } - - return ret; -} - -// Stop a virtual layer-3 switch -UINT StStopL3Switch(ADMIN *a, RPC_L3SW *t) -{ - SERVER *s = a->Server; - CEDAR *c = s->Cedar; - UINT ret = ERR_NO_ERROR; - L3SW *sw; - - if (IsEmptyStr(t->Name)) - { - return ERR_INVALID_PARAMETER; - } - - NO_SUPPORT_FOR_BRIDGE; - - SERVER_ADMIN_ONLY; - - sw = L3GetSw(c, t->Name); - - if (sw == NULL) - { - ret = ERR_LAYER3_SW_NOT_FOUND; - } - else - { - L3SwStop(sw); - ALog(a, NULL, "LA_STOP_L3_SW", sw->Name); - ReleaseL3Sw(sw); - - IncrementServerConfigRevision(s); - } - - return ret; -} - -// Start a virtual layer-3 switch -UINT StStartL3Switch(ADMIN *a, RPC_L3SW *t) -{ - SERVER *s = a->Server; - CEDAR *c = s->Cedar; - UINT ret = ERR_NO_ERROR; - L3SW *sw; - - if (IsEmptyStr(t->Name)) - { - return ERR_INVALID_PARAMETER; - } - - NO_SUPPORT_FOR_BRIDGE; - - SERVER_ADMIN_ONLY; - - sw = L3GetSw(c, t->Name); - - if (sw == NULL) - { - ret = ERR_LAYER3_SW_NOT_FOUND; - } - else - { - Lock(sw->lock); - { - // Count the registered virtual interfaces - if (LIST_NUM(sw->IfList) >= 1) - { - L3SwStart(sw); - - ALog(a, NULL, "LA_START_L3_SW", sw->Name); - - IncrementServerConfigRevision(s); - } - else - { - ret = ERR_LAYER3_CANT_START_SWITCH; - } - } - Unlock(sw->lock); - - ReleaseL3Sw(sw); - } - - return ret; -} - -// Enumerate virtual layer-3 switches -UINT StEnumL3Switch(ADMIN *a, RPC_ENUM_L3SW *t) -{ - UINT i; - SERVER *s = a->Server; - CEDAR *c = s->Cedar; - UINT ret = ERR_NO_ERROR; - - NO_SUPPORT_FOR_BRIDGE; - - FreeRpcEnumL3Sw(t); - Zero(t, sizeof(RPC_ENUM_L3SW)); - - LockList(c->L3SwList); - { - t->NumItem = LIST_NUM(c->L3SwList); - t->Items = ZeroMalloc(sizeof(RPC_ENUM_L3SW_ITEM) * t->NumItem); - for (i = 0;i < LIST_NUM(c->L3SwList);i++) - { - L3SW *sw = LIST_DATA(c->L3SwList, i); - RPC_ENUM_L3SW_ITEM *e = &t->Items[i]; - - Lock(sw->lock); - { - StrCpy(e->Name, sizeof(e->Name), sw->Name); - e->NumInterfaces = LIST_NUM(sw->IfList); - e->NumTables = LIST_NUM(sw->TableList); - e->Active = sw->Active; - e->Online = sw->Online; - } - Unlock(sw->lock); - } - } - UnlockList(c->L3SwList); - - return ret; -} - -// Delete a virtual layer-3 switch -UINT StDelL3Switch(ADMIN *a, RPC_L3SW *t) -{ - SERVER *s = a->Server; - CEDAR *c = s->Cedar; - UINT ret = ERR_NO_ERROR; - - if (IsEmptyStr(t->Name)) - { - return ERR_INVALID_PARAMETER; - } - - NO_SUPPORT_FOR_BRIDGE; - - SERVER_ADMIN_ONLY; - - if (L3DelSw(c, t->Name) == false) - { - ret = ERR_LAYER3_SW_NOT_FOUND; - } - else - { - ALog(a, NULL, "LA_DEL_L3_SW", t->Name); - - IncrementServerConfigRevision(s); - } - - return ret; -} - -// Add a new virtual layer-3 switch -UINT StAddL3Switch(ADMIN *a, RPC_L3SW *t) -{ - SERVER *s = a->Server; - CEDAR *c = s->Cedar; - UINT ret = ERR_NO_ERROR; - L3SW *sw; - - NO_SUPPORT_FOR_BRIDGE; - - if (IsEmptyStr(t->Name)) - { - return ERR_INVALID_PARAMETER; - } - - if (IsSafeStr(t->Name) == false) - { - return ERR_INVALID_PARAMETER; - } - - SERVER_ADMIN_ONLY; - - // Duplication check - sw = L3GetSw(c, t->Name); - if (sw != NULL) - { - // Already exists - ReleaseL3Sw(sw); - ret = ERR_LAYER3_SW_EXISTS; - } - else - { - LockList(c->L3SwList); - { - if (LIST_NUM(c->L3SwList) >= GetServerCapsInt(s, "i_max_l3_sw")) - { - // No more virtual interfaces - sw = NULL; - } - else - { - // Create - sw = L3AddSw(c, t->Name); - - if (sw != NULL) - { - ALog(a, NULL, "LA_ADD_L3_SW", t->Name); - - IncrementServerConfigRevision(s); - } - } - } - UnlockList(c->L3SwList); - - if (sw == NULL) - { - // Failed - ret = ERR_INTERNAL_ERROR; - } - else - { - // Success - ReleaseL3Sw(sw); - } - } - - return ret; -} - -// Set hub extended options -UINT StSetHubExtOptions(ADMIN *a, RPC_ADMIN_OPTION *t) -{ - SERVER *s = a->Server; - CEDAR *c = s->Cedar; - HUB *h; - - bool not_server_admin = false; - - if (t->NumItem > MAX_HUB_ADMIN_OPTIONS) - { - return ERR_TOO_MANT_ITEMS; - } - - if (s->ServerType == SERVER_TYPE_FARM_MEMBER) - { - return ERR_NOT_SUPPORTED; - } - - - CHECK_RIGHT; - - if (a->ServerAdmin == false) - { - not_server_admin = true; - } - - LockHubList(c); - { - h = GetHub(c, t->HubName); - } - UnlockHubList(c); - - if (h == NULL) - { - return ERR_HUB_NOT_FOUND; - } - - if (GetHubAdminOption(h, "deny_hub_admin_change_ext_option") && not_server_admin) - { - // Insufficient permission - ReleaseHub(h); - - return ERR_NOT_ENOUGH_RIGHT; - } - - // Update setting - Lock(h->lock); - { - DataToHubOptionStruct(h->Option, t); - } - Unlock(h->lock); - - ALog(a, NULL, "LA_SET_HUB_EXT_OPTION", h->Name); - - h->CurrentVersion++; - SiHubUpdateProc(h); - - ReleaseHub(h); - - IncrementServerConfigRevision(s); - - return ERR_NO_ERROR; -} - -// Get hub extended options -UINT StGetHubExtOptions(ADMIN *a, RPC_ADMIN_OPTION *t) -{ - SERVER *s = a->Server; - CEDAR *c = s->Cedar; - HUB *h; - - CHECK_RIGHT; - - LockHubList(c); - { - h = GetHub(c, t->HubName); - } - UnlockHubList(c); - - if (h == NULL) - { - return ERR_HUB_NOT_FOUND; - } - - FreeRpcAdminOption(t); - Zero(t, sizeof(RPC_ADMIN_OPTION)); - - StrCpy(t->HubName, sizeof(t->HubName), h->Name); - - // Get options - Lock(h->lock); - { - HubOptionStructToData(t, h->Option, h->Name); - } - Unlock(h->lock); - - ReleaseHub(h); - - return ERR_NO_ERROR; -} - -// Set hub administration options -UINT StSetHubAdminOptions(ADMIN *a, RPC_ADMIN_OPTION *t) -{ - UINT i; - SERVER *s = a->Server; - CEDAR *c = s->Cedar; - HUB *h; - - bool not_server_admin = false; - - - if (t->NumItem > MAX_HUB_ADMIN_OPTIONS) - { - return ERR_TOO_MANT_ITEMS; - } - - NO_SUPPORT_FOR_BRIDGE; - if (s->ServerType == SERVER_TYPE_FARM_MEMBER) - { - return ERR_NOT_SUPPORTED; - } - - CHECK_RIGHT; - - if (a->ServerAdmin == false) - { - not_server_admin = true; - } - - LockHubList(c); - { - h = GetHub(c, t->HubName); - } - UnlockHubList(c); - - if (h == NULL) - { - return ERR_HUB_NOT_FOUND; - } - - if (GetHubAdminOption(h, "allow_hub_admin_change_option") == false - && not_server_admin) - { - // Insufficient permission - ReleaseHub(h); - - return ERR_NOT_ENOUGH_RIGHT; - } - - LockList(h->AdminOptionList); - { - DeleteAllHubAdminOption(h, false); - - for (i = 0;i < t->NumItem;i++) - { - ADMIN_OPTION *e = &t->Items[i]; - ADMIN_OPTION *a = ZeroMalloc(sizeof(ADMIN_OPTION)); - - StrCpy(a->Name, sizeof(a->Name), e->Name); - a->Value = e->Value; - - Insert(h->AdminOptionList, a); - } - - AddHubAdminOptionsDefaults(h, false); - } - UnlockList(h->AdminOptionList); - - ALog(a, NULL, "LA_SET_HUB_ADMIN_OPTION", h->Name); - - h->CurrentVersion++; - SiHubUpdateProc(h); - - ReleaseHub(h); - - IncrementServerConfigRevision(s); - - return ERR_NO_ERROR; -} - -// Get hub administration options -UINT StGetHubAdminOptions(ADMIN *a, RPC_ADMIN_OPTION *t) -{ - UINT i; - SERVER *s = a->Server; - CEDAR *c = s->Cedar; - HUB *h; - - CHECK_RIGHT; - - NO_SUPPORT_FOR_BRIDGE; - if (s->ServerType == SERVER_TYPE_FARM_MEMBER) - { - return ERR_NOT_SUPPORTED; - } - - LockHubList(c); - { - h = GetHub(c, t->HubName); - } - UnlockHubList(c); - - if (h == NULL) - { - return ERR_HUB_NOT_FOUND; - } - - FreeRpcAdminOption(t); - Zero(t, sizeof(RPC_ADMIN_OPTION)); - - StrCpy(t->HubName, sizeof(t->HubName), h->Name); - - LockList(h->AdminOptionList); - { - t->NumItem = LIST_NUM(h->AdminOptionList); - t->Items = ZeroMalloc(sizeof(ADMIN_OPTION) * t->NumItem); - - for (i = 0;i < t->NumItem;i++) - { - ADMIN_OPTION *a = LIST_DATA(h->AdminOptionList, i); - ADMIN_OPTION *e = &t->Items[i]; - - StrCpy(e->Name, sizeof(e->Name), a->Name); - e->Value = a->Value; - UniStrCpy(e->Descrption, sizeof(e->Descrption), GetHubAdminOptionHelpString(e->Name)); - } - } - UnlockList(h->AdminOptionList); - - ReleaseHub(h); - - return ERR_NO_ERROR; -} - -// Get default hub administration options -UINT StGetDefaultHubAdminOptions(ADMIN *a, RPC_ADMIN_OPTION *t) -{ - UINT i; - - NO_SUPPORT_FOR_BRIDGE; - if (a->Server->ServerType == SERVER_TYPE_FARM_MEMBER) - { - return ERR_NOT_SUPPORTED; - } - - FreeRpcAdminOption(t); - Zero(t, sizeof(RPC_ADMIN_OPTION)); - - t->NumItem = num_admin_options; - t->Items = ZeroMalloc(sizeof(ADMIN_OPTION) * t->NumItem); - - for (i = 0;i < t->NumItem;i++) - { - ADMIN_OPTION *a = &t->Items[i]; - - StrCpy(a->Name, sizeof(a->Name), admin_options[i].Name); - a->Value = admin_options[i].Value; - UniStrCpy(a->Descrption, sizeof(a->Descrption), GetHubAdminOptionHelpString(a->Name)); - } - - return ERR_NO_ERROR; -} - -// Get configuration file stream -UINT StGetConfig(ADMIN *a, RPC_CONFIG *t) -{ - SERVER *s; - - SERVER_ADMIN_ONLY; - - FreeRpcConfig(t); - Zero(t, sizeof(RPC_CONFIG)); - - s = a->Server; - - ALog(a, NULL, "LA_GET_CONFIG"); - - if (s->CfgRw != NULL) - { - FOLDER *f = SiWriteConfigurationToCfg(s); - BUF *b = CfgFolderToBuf(f, true); - - StrCpy(t->FileName, sizeof(t->FileName), s->CfgRw->FileName + (s->CfgRw->FileName[0] == '@' ? 1 : 0)); - - t->FileData = ZeroMalloc(b->Size + 1); - Copy(t->FileData, b->Buf, b->Size); - - CfgDeleteFolder(f); - FreeBuf(b); - - return ERR_NO_ERROR; - } - else - { - return ERR_INTERNAL_ERROR; - } -} - -// Overwrite configuration file by specified data -UINT StSetConfig(ADMIN *a, RPC_CONFIG *t) -{ - SERVER *s; - IO *o; - char filename[MAX_PATH]; - - SERVER_ADMIN_ONLY; - - s = a->Server; - if (s->CfgRw == NULL) - { - return ERR_INTERNAL_ERROR; - } - - // Write new configuration file - Format(filename, sizeof(filename), "%s.new", s->CfgRw->FileName); - - o = FileCreate(filename); - - FileWrite(o, t->FileData, StrLen(t->FileData)); - - FileClose(o); - - IncrementServerConfigRevision(s); - - ALog(a, NULL, "LA_SET_CONFIG"); - - // Reboot server itself - SiRebootServer(s->Cedar->Bridge); - - return ERR_NO_ERROR; -} - -// Get capabilities -UINT StGetCaps(ADMIN *a, CAPSLIST *t) -{ - FreeRpcCapsList(t); - Zero(t, sizeof(CAPSLIST)); - - GetServerCapsMain(a->Server, t); - - return ERR_NO_ERROR; -} - -// Reboot server itself -UINT StRebootServer(ADMIN *a, RPC_TEST *t) -{ - SERVER_ADMIN_ONLY; - - ALog(a, NULL, "LA_REBOOT_SERVER"); - - SiRebootServerEx(a->Server->Cedar->Bridge, t->IntValue); - - return ERR_NO_ERROR; -} - -// Get availability to localbridge function -UINT StGetBridgeSupport(ADMIN *a, RPC_BRIDGE_SUPPORT *t) -{ - Zero(t, sizeof(RPC_BRIDGE_SUPPORT)); - - t->IsBridgeSupportedOs = IsBridgeSupported(); - t->IsWinPcapNeeded = IsNeedWinPcap(); - - return ERR_NO_ERROR; -} - -// Enumerate Ethernet devices -UINT StEnumEthernet(ADMIN *a, RPC_ENUM_ETH *t) -{ - TOKEN_LIST *o; - UINT i; - char tmp[MAX_SIZE]; - bool unix_support = false; - - SERVER_ADMIN_ONLY; - -#ifdef OS_UNIX - unix_support = EthIsInterfaceDescriptionSupportedUnix(); -#endif // OS_UNIX - - o = GetEthList(); - if (o == NULL) - { - return ERR_NOT_SUPPORTED; - } - - FreeRpcEnumEth(t); - Zero(t, sizeof(RPC_ENUM_ETH)); - - t->NumItem = o->NumTokens; - t->Items = ZeroMalloc(sizeof(RPC_ENUM_ETH_ITEM) * t->NumItem); - - for (i = 0;i < t->NumItem;i++) - { - RPC_ENUM_ETH_ITEM *e = &t->Items[i]; - - StrCpy(e->DeviceName, sizeof(e->DeviceName), o->Token[i]); - - StrCpy(tmp, sizeof(tmp), e->DeviceName); - -#ifdef OS_WIN32 - GetEthNetworkConnectionName(e->NetworkConnectionName, sizeof(e->NetworkConnectionName), e->DeviceName); -#else - if (unix_support == false) - { - StrCpy(tmp, sizeof(tmp), ""); - } - else - { - if (EthGetInterfaceDescriptionUnix(e->DeviceName, tmp, sizeof(tmp)) == false) - { - StrCpy(tmp, sizeof(tmp), e->DeviceName); - } - } - - StrToUni(e->NetworkConnectionName, sizeof(e->NetworkConnectionName), tmp); -#endif - } - - FreeToken(o); - - return ERR_NO_ERROR; -} - -// Add a new local bridge -UINT StAddLocalBridge(ADMIN *a, RPC_LOCALBRIDGE *t) -{ - if (IsEmptyStr(t->DeviceName) || IsEmptyStr(t->HubName)) - { - return ERR_INVALID_PARAMETER; - } - - SERVER_ADMIN_ONLY; - - - if (IsEthSupported() == false) - { - return ERR_LOCAL_BRIDGE_UNSUPPORTED; - } - -#ifdef OS_WIN32 - if (true) - { - char tmp[MAX_SIZE]; - UINT id = Win32EthGetNameAndIdFromCombinedName(tmp, sizeof(tmp), t->DeviceName); - - if (id == 0) - { - // If a ID is not specified in Win32, adding will fail - return ERR_OBJECT_NOT_FOUND; - } - } -#endif // OS_WIN32 - - ALog(a, NULL, "LA_ADD_BRIDGE", t->HubName, t->DeviceName); - - AddLocalBridge(a->Server->Cedar, t->HubName, t->DeviceName, false, false, t->TapMode, NULL, false); - - IncrementServerConfigRevision(a->Server); - - return ERR_NO_ERROR; -} - -// Delete a local bridge -UINT StDeleteLocalBridge(ADMIN *a, RPC_LOCALBRIDGE *t) -{ - if (IsEmptyStr(t->DeviceName) || IsEmptyStr(t->HubName)) - { - return ERR_INVALID_PARAMETER; - } - - SERVER_ADMIN_ONLY; - - ALog(a, NULL, "LA_DELETE_BRIDGE", t->HubName, t->DeviceName); - - if (DeleteLocalBridge(a->Server->Cedar, t->HubName, t->DeviceName) == false) - { - return ERR_OBJECT_NOT_FOUND; - } - - IncrementServerConfigRevision(a->Server); - - return ERR_NO_ERROR; -} - -// Enumerate local bridges -UINT StEnumLocalBridge(ADMIN *a, RPC_ENUM_LOCALBRIDGE *t) -{ - UINT i; - CEDAR *c; - - if (IsEthSupported() == false) - { - return ERR_LOCAL_BRIDGE_UNSUPPORTED; - } - - FreeRpcEnumLocalBridge(t); - Zero(t, sizeof(RPC_ENUM_LOCALBRIDGE)); - - c = a->Server->Cedar; - - LockList(c->LocalBridgeList); - { - t->NumItem = LIST_NUM(c->LocalBridgeList); - t->Items = ZeroMalloc(sizeof(RPC_LOCALBRIDGE) * t->NumItem); - - for (i = 0;i < t->NumItem;i++) - { - RPC_LOCALBRIDGE *e = &t->Items[i]; - LOCALBRIDGE *br = LIST_DATA(c->LocalBridgeList, i); - - if (br->Bridge == false) - { - e->Online = e->Active = false; - } - else - { - e->Online = true; - if (br->Bridge->Active) - { - e->Active = true; - } - else - { - e->Active = false; - } - } - StrCpy(e->DeviceName, sizeof(e->DeviceName), br->DeviceName); - StrCpy(e->HubName, sizeof(e->HubName), br->HubName); - - e->TapMode = br->TapMode; - } - } - UnlockList(c->LocalBridgeList); - - return ERR_NO_ERROR; -} - -// Set syslog function setting -UINT StSetSysLog(ADMIN *a, SYSLOG_SETTING *t) -{ - SERVER *s = a->Server; - - SERVER_ADMIN_ONLY; - - if (GetGlobalServerFlag(GSF_DISABLE_SYSLOG) != 0 && t->SaveType != SYSLOG_NONE) - { - return ERR_NOT_SUPPORTED_FUNCTION_ON_OPENSOURCE; - } - - if (GetServerCapsBool(s, "b_support_syslog") == false) - { - return ERR_NOT_SUPPORTED; - } - - SiSetSysLogSetting(s, t); - - IncrementServerConfigRevision(s); - ALog(a, NULL, "LA_SET_SYSLOG"); - - return ERR_NO_ERROR; -} - -// Get syslog function setting -UINT StGetSysLog(ADMIN *a, SYSLOG_SETTING *t) -{ - SERVER *s = a->Server; - - SiGetSysLogSetting(s, t); - - if (a->ServerAdmin == false) - { - // Hide server name for non-administrator - if (t->SaveType == SYSLOG_NONE) - { - StrCpy(t->Hostname, sizeof(t->Hostname), ""); - t->Port = 0; - } - else - { - StrCpy(t->Hostname, sizeof(t->Hostname), "Secret"); - t->Port = 0; - } - } - - return ERR_NO_ERROR; -} - -// Set keep-alive function setting -UINT StSetKeep(ADMIN *a, RPC_KEEP *t) -{ - SERVER *s = a->Server; - - if (t->UseKeepConnect) - { - if (IsEmptyStr(t->KeepConnectHost) || - t->KeepConnectPort == 0 || - t->KeepConnectPort >= 65536) - { - return ERR_INVALID_PARAMETER; - } - } - - SERVER_ADMIN_ONLY; - - Lock(s->Keep->lock); - { - KEEP *keep = s->Keep; - keep->Enable = t->UseKeepConnect; - keep->Server = true; - StrCpy(keep->ServerName, sizeof(keep->ServerName), t->KeepConnectHost); - keep->ServerPort = t->KeepConnectPort; - keep->UdpMode = t->KeepConnectProtocol; - keep->Interval = t->KeepConnectInterval * 1000; - if (keep->Interval < 5000) - { - keep->Interval = 5000; - } - else if (keep->Interval > 600000) - { - keep->Interval = 600000; - } - } - Unlock(s->Keep->lock); - - ALog(a, NULL, "LA_SET_KEEP"); - - IncrementServerConfigRevision(s); - - return ERR_NO_ERROR; -} - -// Get keep-alive function setting -UINT StGetKeep(ADMIN *a, RPC_KEEP *t) -{ - SERVER *s = a->Server; - - Zero(t, sizeof(RPC_KEEP)); - - Lock(s->Keep->lock); - { - KEEP *k = s->Keep; - t->UseKeepConnect = k->Enable; - StrCpy(t->KeepConnectHost, sizeof(t->KeepConnectHost), k->ServerName); - t->KeepConnectPort = k->ServerPort; - t->KeepConnectProtocol = k->UdpMode; - t->KeepConnectInterval = k->Interval / 1000; - } - Unlock(s->Keep->lock); - - return ERR_NO_ERROR; -} - -// Delete IP address table entry -UINT StDeleteIpTable(ADMIN *a, RPC_DELETE_TABLE *t) -{ - SERVER *s = a->Server; - CEDAR *c = s->Cedar; - HUB *h = NULL; - UINT ret = ERR_NO_ERROR; - - CHECK_RIGHT; - - LockHubList(c); - { - h = GetHub(c, t->HubName); - } - UnlockHubList(c); - - if (h == NULL) - { - return ERR_HUB_NOT_FOUND; - } - - if (a->ServerAdmin == false && GetHubAdminOption(h, "no_delete_iptable") != 0) - { - ReleaseHub(h); - return ERR_NOT_ENOUGH_RIGHT; - } - - LockList(h->IpTable); - { - if (IsInListKey(h->IpTable, t->Key)) - { - IP_TABLE_ENTRY *e = ListKeyToPointer(h->IpTable, t->Key); - Free(e); - Delete(h->IpTable, e); - } - else - { - ret = ERR_OBJECT_NOT_FOUND; - } - } - UnlockList(h->IpTable); - - if (ret == ERR_OBJECT_NOT_FOUND) - { - if (s->ServerType == SERVER_TYPE_FARM_CONTROLLER) - { - UINT i; - LockList(s->FarmMemberList); - { - for (i = 0;i < LIST_NUM(s->FarmMemberList);i++) - { - FARM_MEMBER *f = LIST_DATA(s->FarmMemberList, i); - if (f->Me == false) - { - SiCallDeleteIpTable(s, f, t->HubName, t->Key); - ret = ERR_NO_ERROR; - } - } - } - UnlockList(s->FarmMemberList); - } - } - - ReleaseHub(h); - - return ret; -} - -// Get local IP address table -UINT SiEnumIpTable(SERVER *s, char *hubname, RPC_ENUM_IP_TABLE *t) -{ - CEDAR *c; - UINT i; - HUB *h = NULL; - // Validate arguments - if (s == NULL || hubname == NULL || t == NULL) - { - return ERR_INTERNAL_ERROR; - } - - c = s->Cedar; - - LockHubList(c); - { - h = GetHub(c, hubname); - } - UnlockHubList(c); - - if (h == NULL) - { - return ERR_HUB_NOT_FOUND; - } - - StrCpy(t->HubName, sizeof(t->HubName), hubname); - - LockList(h->IpTable); - { - t->NumIpTable = LIST_NUM(h->IpTable); - t->IpTables = ZeroMalloc(sizeof(RPC_ENUM_IP_TABLE_ITEM) * t->NumIpTable); - - for (i = 0;i < t->NumIpTable;i++) - { - RPC_ENUM_IP_TABLE_ITEM *e = &t->IpTables[i]; - IP_TABLE_ENTRY *table = LIST_DATA(h->IpTable, i); - - e->Key = POINTER_TO_KEY(table); - StrCpy(e->SessionName, sizeof(e->SessionName), table->Session->Name); - e->Ip = IPToUINT(&table->Ip); - Copy(&e->IpV6, &table->Ip, sizeof(IP)); - Copy(&e->IpAddress, &table->Ip, sizeof(IP)); - e->DhcpAllocated = table->DhcpAllocated; - e->CreatedTime = TickToTime(table->CreatedTime); - e->UpdatedTime = TickToTime(table->UpdatedTime); - - GetMachineName(e->RemoteHostname, sizeof(e->RemoteHostname)); - } - } - UnlockList(h->IpTable); - - ReleaseHub(h); - - return ERR_NO_ERROR; -} - -// Get IP address table -UINT StEnumIpTable(ADMIN *a, RPC_ENUM_IP_TABLE *t) -{ - SERVER *s = a->Server; - CEDAR *c = s->Cedar; - UINT ret = ERR_NO_ERROR; - char hubname[MAX_HUBNAME_LEN + 1]; - UINT i; - - CHECK_RIGHT; - - // Get local IP address table - StrCpy(hubname, sizeof(hubname), t->HubName); - FreeRpcEnumIpTable(t); - Zero(t, sizeof(RPC_ENUM_IP_TABLE)); - StrCpy(t->HubName, sizeof(t->HubName), hubname); - - ret = SiEnumIpTable(s, hubname, t); - if (ret != ERR_NO_ERROR) - { - return ret; - } - - if (s->ServerType == SERVER_TYPE_FARM_CONTROLLER) - { - // Get remote IP address table - LockList(s->FarmMemberList); - { - for (i = 0;i < LIST_NUM(s->FarmMemberList);i++) - { - FARM_MEMBER *f = LIST_DATA(s->FarmMemberList, i); - if (f->Me == false) - { - RPC_ENUM_IP_TABLE tmp; - - Zero(&tmp, sizeof(tmp)); - - SiCallEnumIpTable(s, f, hubname, &tmp); - - AdjoinRpcEnumIpTable(t, &tmp); - FreeRpcEnumIpTable(&tmp); - } - } - } - UnlockList(s->FarmMemberList); - } - - return ret; -} - -// Delete MAC address table entry -UINT StDeleteMacTable(ADMIN *a, RPC_DELETE_TABLE *t) -{ - SERVER *s = a->Server; - CEDAR *c = s->Cedar; - HUB *h = NULL; - UINT ret = ERR_NO_ERROR; - - CHECK_RIGHT; - - LockHubList(c); - { - h = GetHub(c, t->HubName); - } - UnlockHubList(c); - - if (h == NULL) - { - return ERR_HUB_NOT_FOUND; - } - - if (a->ServerAdmin == false && GetHubAdminOption(h, "no_delete_mactable") != 0) - { - ReleaseHub(h); - return ERR_NOT_ENOUGH_RIGHT; - } - - LockHashList(h->MacHashTable); - { - if (IsInHashListKey(h->MacHashTable, t->Key)) - { - MAC_TABLE_ENTRY *e = HashListKeyToPointer(h->MacHashTable, t->Key); - DeleteHash(h->MacHashTable, e); - Free(e); - } - else - { - ret = ERR_OBJECT_NOT_FOUND; - } - } - UnlockHashList(h->MacHashTable); - - if (ret == ERR_OBJECT_NOT_FOUND) - { - if (s->ServerType == SERVER_TYPE_FARM_CONTROLLER) - { - UINT i; - LockList(s->FarmMemberList); - { - for (i = 0;i < LIST_NUM(s->FarmMemberList);i++) - { - FARM_MEMBER *f = LIST_DATA(s->FarmMemberList, i); - if (f->Me == false) - { - SiCallDeleteMacTable(s, f, t->HubName, t->Key); - ret = ERR_NO_ERROR; - } - } - } - UnlockList(s->FarmMemberList); - } - } - - ReleaseHub(h); - - return ret; -} - -// Get local MAC address table -UINT SiEnumMacTable(SERVER *s, char *hubname, RPC_ENUM_MAC_TABLE *t) -{ - CEDAR *c; - UINT i; - HUB *h = NULL; - // Validate arguments - if (s == NULL || hubname == NULL || t == NULL) - { - return ERR_INTERNAL_ERROR; - } - - c = s->Cedar; - - LockHubList(c); - { - h = GetHub(c, hubname); - } - UnlockHubList(c); - - if (h == NULL) - { - return ERR_HUB_NOT_FOUND; - } - - StrCpy(t->HubName, sizeof(t->HubName), hubname); - - LockHashList(h->MacHashTable); - { - MAC_TABLE_ENTRY **pp = (MAC_TABLE_ENTRY **)HashListToArray(h->MacHashTable, &t->NumMacTable); - t->MacTables = ZeroMalloc(sizeof(RPC_ENUM_MAC_TABLE_ITEM) * t->NumMacTable); - - for (i = 0;i < t->NumMacTable;i++) - { - RPC_ENUM_MAC_TABLE_ITEM *e = &t->MacTables[i]; - MAC_TABLE_ENTRY *mac = pp[i]; - - e->Key = POINTER_TO_KEY(mac); - StrCpy(e->SessionName, sizeof(e->SessionName), mac->Session->Name); - Copy(e->MacAddress, mac->MacAddress, sizeof(e->MacAddress)); - e->CreatedTime = TickToTime(mac->CreatedTime); - e->UpdatedTime = TickToTime(mac->UpdatedTime); - e->VlanId = mac->VlanId; - - GetMachineName(e->RemoteHostname, sizeof(e->RemoteHostname)); - } - - Free(pp); - } - UnlockHashList(h->MacHashTable); - - ReleaseHub(h); - - return ERR_NO_ERROR; -} - -// Get MAC address table -UINT StEnumMacTable(ADMIN *a, RPC_ENUM_MAC_TABLE *t) -{ - SERVER *s = a->Server; - CEDAR *c = s->Cedar; - HUB *h = NULL; - UINT ret = ERR_NO_ERROR; - char hubname[MAX_HUBNAME_LEN + 1]; - UINT i; - - CHECK_RIGHT; - - // Get local MAC address table - StrCpy(hubname, sizeof(hubname), t->HubName); - FreeRpcEnumMacTable(t); - Zero(t, sizeof(RPC_ENUM_MAC_TABLE)); - - ret = SiEnumMacTable(s, hubname, t); - if (ret != ERR_NO_ERROR) - { - return ret; - } - - if (s->ServerType == SERVER_TYPE_FARM_CONTROLLER) - { - // Get remote MAC address table - LockList(s->FarmMemberList); - { - for (i = 0;i < LIST_NUM(s->FarmMemberList);i++) - { - FARM_MEMBER *f = LIST_DATA(s->FarmMemberList, i); - if (f->Me == false) - { - RPC_ENUM_MAC_TABLE tmp; - - Zero(&tmp, sizeof(tmp)); - - SiCallEnumMacTable(s, f, hubname, &tmp); - - AdjoinRpcEnumMacTable(t, &tmp); - FreeRpcEnumMacTable(&tmp); - } - } - } - UnlockList(s->FarmMemberList); - } - - return ret; -} - -// Delete a session -UINT StDeleteSession(ADMIN *a, RPC_DELETE_SESSION *t) -{ - SERVER *s = a->Server; - CEDAR *c = s->Cedar; - HUB *h = NULL; - UINT ret = ERR_NO_ERROR; - char hubname[MAX_HUBNAME_LEN + 1]; - char name[MAX_SESSION_NAME_LEN + 1]; - SESSION *sess; - - if (IsEmptyStr(t->Name)) - { - return ERR_INVALID_PARAMETER; - } - - StrCpy(hubname, sizeof(hubname), t->HubName); - StrCpy(name, sizeof(name), t->Name); - - CHECK_RIGHT; - - LockHubList(c); - { - h = GetHub(c, t->HubName); - } - UnlockHubList(c); - - if (h == NULL) - { - return ERR_HUB_NOT_FOUND; - } - - if (a->ServerAdmin == false && GetHubAdminOption(h, "no_disconnect_session") != 0) - { - ReleaseHub(h); - return ERR_NOT_ENOUGH_RIGHT; - } - - sess = GetSessionByName(h, name); - - if (sess == NULL) - { - if (s->ServerType == SERVER_TYPE_FARM_CONTROLLER) - { - // Cluster controller - UINT i; - LockList(s->FarmMemberList); - { - for (i = 0;i < LIST_NUM(s->FarmMemberList);i++) - { - FARM_MEMBER *f = LIST_DATA(s->FarmMemberList, i); - if (f->Me == false) - { - // Try to disconnect - SiCallDeleteSession(s, f, t->HubName, t->Name); - } - } - } - UnlockList(s->FarmMemberList); - } - else - { - ret = ERR_OBJECT_NOT_FOUND; - } - } - else - { - if (sess->LinkModeServer) - { - ret = ERR_LINK_CANT_DISCONNECT; - } - else if (sess->SecureNATMode) - { - ret = ERR_SNAT_CANT_DISCONNECT; - } - else if (sess->BridgeMode) - { - ret = ERR_BRIDGE_CANT_DISCONNECT; - } - else if (sess->L3SwitchMode) - { - ret = ERR_LAYER3_CANT_DISCONNECT; - } - else - { - StopSession(sess); - } - ReleaseSession(sess); - } - - if (ret != ERR_NO_ERROR) - { - ALog(a, h, "LA_DELETE_SESSION", t->Name); - } - - ReleaseHub(h); - - return ret; -} - -// Get session status -UINT StGetSessionStatus(ADMIN *a, RPC_SESSION_STATUS *t) -{ - SERVER *s = a->Server; - CEDAR *c = s->Cedar; - HUB *h = NULL; - UINT ret = ERR_NO_ERROR; - char hubname[MAX_HUBNAME_LEN + 1]; - char name[MAX_SESSION_NAME_LEN + 1]; - SESSION *sess; - - StrCpy(hubname, sizeof(hubname), t->HubName); - StrCpy(name, sizeof(name), t->Name); - - if (IsEmptyStr(t->Name)) - { - return ERR_INVALID_PARAMETER; - } - - CHECK_RIGHT; - - LockHubList(c); - { - h = GetHub(c, t->HubName); - } - UnlockHubList(c); - - if (h == NULL) - { - return ERR_HUB_NOT_FOUND; - } - - if (a->ServerAdmin == false && GetHubAdminOption(h, "no_query_session") != 0) - { - ReleaseHub(h); - return ERR_NOT_ENOUGH_RIGHT; - } - - FreeRpcSessionStatus(t); - Zero(t, sizeof(RPC_SESSION_STATUS)); - StrCpy(t->HubName, sizeof(t->HubName), hubname); - StrCpy(t->Name, sizeof(t->Name), name); - - sess = GetSessionByName(h, t->Name); - - if (sess == NULL) - { - if (s->ServerType != SERVER_TYPE_FARM_CONTROLLER) - { - // Session is not found - ret = ERR_OBJECT_NOT_FOUND; - } - else - { - UINT i; - // Try to find the session on other cluster member - LockList(s->FarmMemberList); - { - for (i = 0;i < LIST_NUM(s->FarmMemberList);i++) - { - FARM_MEMBER *f = LIST_DATA(s->FarmMemberList, i); - if (f->Me == false) - { - RPC_SESSION_STATUS tmp; - Zero(&tmp, sizeof(tmp)); - StrCpy(tmp.HubName, sizeof(tmp.HubName), t->HubName); - StrCpy(tmp.Name, sizeof(tmp.Name), t->Name); - - if (SiCallGetSessionStatus(s, f, &tmp)) - { - if (StrLen(tmp.HubName) != 0) - { - // Success to get session status - Copy(t, &tmp, sizeof(RPC_SESSION_STATUS)); - break; - } - else - { - FreeRpcSessionStatus(&tmp); - } - } - } - } - - if (i == LIST_NUM(s->FarmMemberList)) - { - // not found after all - // - ret = ERR_OBJECT_NOT_FOUND; - } - } - UnlockList(s->FarmMemberList); - } - } - else - { - SESSION *s = sess; - - Lock(s->lock); - { - StrCpy(t->Username, sizeof(t->Username), s->Username); - StrCpy(t->RealUsername, sizeof(t->RealUsername), s->UserNameReal); - StrCpy(t->GroupName, sizeof(t->GroupName), s->GroupName); - Copy(&t->NodeInfo, &s->NodeInfo, sizeof(NODE_INFO)); - - if (s->Connection != NULL) - { - t->ClientIp = IPToUINT(&s->Connection->ClientIp); - if (IsIP6(&s->Connection->ClientIp)) - { - Copy(&t->ClientIp6, &s->Connection->ClientIp.ipv6_addr, sizeof(t->ClientIp6)); - } - - CopyIP(&t->ClientIpAddress, &s->Connection->ClientIp); - - StrCpy(t->ClientHostName, sizeof(t->ClientHostName), s->Connection->ClientHostname); - } - } - Unlock(s->lock); - - CiGetSessionStatus(&t->Status, s); - - ReleaseSession(s); - } - - ReleaseHub(h); - - return ret; -} - -// Main routine of session enumeration -void SiEnumSessionMain(SERVER *s, RPC_ENUM_SESSION *t) -{ - char hubname[MAX_HUBNAME_LEN + 1]; - UINT ret = ERR_NO_ERROR; - UINT num; - UINT i; - // Validate arguments - if (s == NULL || t == NULL) - { - return; - } - - StrCpy(hubname, sizeof(hubname), t->HubName); - - FreeRpcEnumSession(t); - Zero(t, sizeof(RPC_ENUM_SESSION)); - StrCpy(t->HubName, sizeof(t->HubName), hubname); - - // Local session enumeration - num = 0; - SiEnumLocalSession(s, hubname, t); - - if (s->ServerType == SERVER_TYPE_FARM_CONTROLLER) - { - LIST *fm_list; - - fm_list = NewListFast(NULL); - - // Remote session enumeration - LockList(s->FarmMemberList); - { - while (true) - { - bool escape = true; - - for (i = 0;i < LIST_NUM(s->FarmMemberList);i++) - { - FARM_MEMBER *f = LIST_DATA(s->FarmMemberList, i); - - if (IsInList(fm_list, f) == false) - { - Add(fm_list, f); - escape = false; - - if (f->Me == false) - { - RPC_ENUM_SESSION tmp; - - Zero(&tmp, sizeof(tmp)); - - SiCallEnumSession(s, f, hubname, &tmp); - - AdjoinRpcEnumSession(t, &tmp); - FreeRpcEnumSession(&tmp); - } - - break; - } - } - - if (escape) - { - break; - } - - UnlockList(s->FarmMemberList); - LockList(s->FarmMemberList); - } - } - UnlockList(s->FarmMemberList); - - ReleaseList(fm_list); - } -} - -// Enumerate sessions -UINT StEnumSession(ADMIN *a, RPC_ENUM_SESSION *t) -{ - SERVER *s = a->Server; - CEDAR *c = s->Cedar; - HUB *h = NULL; - UINT ret = ERR_NO_ERROR; - - CHECK_RIGHT; - - LockHubList(c); - { - h = GetHub(c, t->HubName); - } - UnlockHubList(c); - - if (h == NULL) - { - return ERR_HUB_NOT_FOUND; - } - - if (a->ServerAdmin == false && GetHubAdminOption(h, "no_enum_session") != 0) - { - ReleaseHub(h); - return ERR_NOT_ENOUGH_RIGHT; - } - - SiEnumSessionMain(s, t); - - ReleaseHub(h); - - return ret; -} - -// Enumerate groups -UINT StEnumGroup(ADMIN *a, RPC_ENUM_GROUP *t) -{ - SERVER *s = a->Server; - CEDAR *c = s->Cedar; - HUB *h = NULL; - UINT ret = ERR_NO_ERROR; - char hubname[MAX_HUBNAME_LEN + 1]; - - StrCpy(hubname, sizeof(hubname), t->HubName); - - CHECK_RIGHT; - - NO_SUPPORT_FOR_BRIDGE; - if (s->ServerType == SERVER_TYPE_FARM_MEMBER) - { - return ERR_NOT_SUPPORTED; - } - - - LockHubList(c); - { - h = GetHub(c, t->HubName); - } - UnlockHubList(c); - - if (h == NULL) - { - return ERR_HUB_NOT_FOUND; - } - - AcLock(h); - { - UINT i, j; - - FreeRpcEnumGroup(t); - Zero(t, sizeof(RPC_ENUM_GROUP)); - StrCpy(t->HubName, sizeof(t->HubName), hubname); - - t->NumGroup = LIST_NUM(h->HubDb->GroupList); - t->Groups = ZeroMalloc(sizeof(RPC_ENUM_GROUP_ITEM) * t->NumGroup); - - for (i = 0;i < t->NumGroup;i++) - { - RPC_ENUM_GROUP_ITEM *e = &t->Groups[i]; - USERGROUP *g = LIST_DATA(h->HubDb->GroupList, i); - - Lock(g->lock); - { - StrCpy(e->Name, sizeof(e->Name), g->Name); - UniStrCpy(e->Realname, sizeof(e->Realname), g->RealName); - UniStrCpy(e->Note, sizeof(e->Note), g->Note); - if (g->Policy != NULL) - { - if (g->Policy->Access == false) - { - e->DenyAccess = true; - } - } - } - Unlock(g->lock); - - e->NumUsers = 0; - - - LockList(h->HubDb->UserList); - { - for (j = 0;j < LIST_NUM(h->HubDb->UserList);j++) - { - USER *u = LIST_DATA(h->HubDb->UserList, j); - - Lock(u->lock); - { - if (u->Group == g) - { - e->NumUsers++; - } - } - Unlock(u->lock); - } - } - UnlockList(h->HubDb->UserList); - } - } - AcUnlock(h); - - ReleaseHub(h); - - return ERR_NO_ERROR; -} - -// Delete a group -UINT StDeleteGroup(ADMIN *a, RPC_DELETE_USER *t) -{ - SERVER *s = a->Server; - CEDAR *c = s->Cedar; - HUB *h = NULL; - UINT ret = ERR_NO_ERROR; - - if (IsEmptyStr(t->Name) || IsSafeStr(t->Name) == false) - { - return ERR_INVALID_PARAMETER; - } - - CHECK_RIGHT; - - NO_SUPPORT_FOR_BRIDGE; - if (s->ServerType == SERVER_TYPE_FARM_MEMBER) - { - return ERR_NOT_SUPPORTED; - } - - LockHubList(c); - { - h = GetHub(c, t->HubName); - } - UnlockHubList(c); - - if (h == NULL) - { - return ERR_HUB_NOT_FOUND; - } - - if (a->ServerAdmin == false && GetHubAdminOption(h, "no_change_groups") != 0) - { - ReleaseHub(h); - return ERR_NOT_ENOUGH_RIGHT; - } - - AcLock(h); - { - if (AcDeleteGroup(h, t->Name) == false) - { - ret = ERR_OBJECT_NOT_FOUND; - } - } - AcUnlock(h); - - if (ret == ERR_NO_ERROR) - { - ALog(a, h, "LA_DELETE_GROUP", t->Name); - } - - ReleaseHub(h); - - IncrementServerConfigRevision(s); - - return ret; -} - -// Get group information -UINT StGetGroup(ADMIN *a, RPC_SET_GROUP *t) -{ - SERVER *s = a->Server; - CEDAR *c = s->Cedar; - HUB *h = NULL; - UINT ret = ERR_NO_ERROR; - char hubname[MAX_HUBNAME_LEN + 1]; - - if (IsEmptyStr(t->Name) || IsSafeStr(t->Name) == false) - { - return ERR_INVALID_PARAMETER; - } - - CHECK_RIGHT; - NO_SUPPORT_FOR_BRIDGE; - if (s->ServerType == SERVER_TYPE_FARM_MEMBER) - { - return ERR_NOT_SUPPORTED; - } - - StrCpy(hubname, sizeof(hubname), t->HubName); - - LockHubList(c); - { - h = GetHub(c, t->HubName); - } - UnlockHubList(c); - - if (h == NULL) - { - return ERR_HUB_NOT_FOUND; - } - - AcLock(h); - { - USERGROUP *g = AcGetGroup(h, t->Name); - - if (g == NULL) - { - ret = ERR_OBJECT_NOT_FOUND; - } - else - { - FreeRpcSetGroup(t); - Zero(t, sizeof(RPC_SET_GROUP)); - - StrCpy(t->HubName, sizeof(t->HubName), hubname); - - Lock(g->lock); - { - StrCpy(t->Name, sizeof(t->Name), g->Name); - UniStrCpy(t->Realname, sizeof(t->Realname), g->RealName); - UniStrCpy(t->Note, sizeof(t->Note), g->Note); - Copy(&t->Traffic, g->Traffic, sizeof(TRAFFIC)); - } - Unlock(g->lock); - - t->Policy = GetGroupPolicy(g); - - ReleaseGroup(g); - } - } - AcUnlock(h); - - ReleaseHub(h); - - return ret; -} - -// Set group setting -UINT StSetGroup(ADMIN *a, RPC_SET_GROUP *t) -{ - SERVER *s = a->Server; - CEDAR *c = s->Cedar; - HUB *h = NULL; - UINT ret = ERR_NO_ERROR; - - if (IsEmptyStr(t->Name) || IsSafeStr(t->Name) == false) - { - return ERR_INVALID_PARAMETER; - } - - CHECK_RIGHT; - NO_SUPPORT_FOR_BRIDGE; - if (s->ServerType == SERVER_TYPE_FARM_MEMBER) - { - return ERR_NOT_SUPPORTED; - } - - LockHubList(c); - { - h = GetHub(c, t->HubName); - } - UnlockHubList(c); - - if (h == NULL) - { - return ERR_HUB_NOT_FOUND; - } - - if (a->ServerAdmin == false && GetHubAdminOption(h, "no_change_groups") != 0) - { - ReleaseHub(h); - return ERR_NOT_ENOUGH_RIGHT; - } - - AcLock(h); - { - USERGROUP *g = AcGetGroup(h, t->Name); - if (g == NULL) - { - ret = ERR_OBJECT_NOT_FOUND; - } - else - { - Lock(g->lock); - { - Free(g->RealName); - Free(g->Note); - g->RealName = UniCopyStr(t->Realname); - g->Note = UniCopyStr(t->Note); - } - Unlock(g->lock); - - SetGroupPolicy(g, t->Policy); - - ReleaseGroup(g); - - ALog(a, h, "LA_SET_GROUP", t->Name); - } - } - AcUnlock(h); - - ReleaseHub(h); - - IncrementServerConfigRevision(s); - - return ret; -} - -// Create a group -UINT StCreateGroup(ADMIN *a, RPC_SET_GROUP *t) -{ - SERVER *s = a->Server; - CEDAR *c = s->Cedar; - HUB *h = NULL; - UINT ret = ERR_NO_ERROR; - - if (IsEmptyStr(t->Name) || IsSafeStr(t->Name) == false) - { - return ERR_INVALID_PARAMETER; - } - - if (s->ServerType == SERVER_TYPE_FARM_MEMBER) - { - return ERR_NOT_FARM_CONTROLLER; - } - - CHECK_RIGHT; - - NO_SUPPORT_FOR_BRIDGE; - if (s->ServerType == SERVER_TYPE_FARM_MEMBER) - { - return ERR_NOT_SUPPORTED; - } - - LockHubList(c); - { - h = GetHub(c, t->HubName); - } - UnlockHubList(c); - - if (h == NULL) - { - return ERR_HUB_NOT_FOUND; - } - - if (a->ServerAdmin == false && GetHubAdminOption(h, "no_change_groups") != 0) - { - ReleaseHub(h); - return ERR_NOT_ENOUGH_RIGHT; - } - - AcLock(h); - { - if (AcIsGroup(h, t->Name)) - { - ret = ERR_GROUP_ALREADY_EXISTS; - } - else - { - USERGROUP *g = NewGroup(t->Name, t->Realname, t->Note); - SetGroupPolicy(g, t->Policy); - - if ((LIST_NUM(h->HubDb->GroupList) >= GetServerCapsInt(a->Server, "i_max_users_per_hub")) || - ((GetHubAdminOption(h, "max_groups") != 0) && (LIST_NUM(h->HubDb->GroupList) >= GetHubAdminOption(h, "max_groups")))) - { - ret = ERR_TOO_MANY_GROUP; - } - else - { - AcAddGroup(h, g); - } - - ReleaseGroup(g); - - ALog(a, h, "LA_CREATE_GROUP", t->Name); - } - } - AcUnlock(h); - - ReleaseHub(h); - - IncrementServerConfigRevision(s); - - return ret; -} - -// Enumerate users -UINT StEnumUser(ADMIN *a, RPC_ENUM_USER *t) -{ - SERVER *s = a->Server; - CEDAR *c = s->Cedar; - HUB *h = NULL; - UINT ret = ERR_NO_ERROR; - char hubname[MAX_HUBNAME_LEN + 1]; - UINT i, num; - - CHECK_RIGHT; - NO_SUPPORT_FOR_BRIDGE; - if (s->ServerType == SERVER_TYPE_FARM_MEMBER) - { - return ERR_NOT_SUPPORTED; - } - - LockHubList(c); - { - h = GetHub(c, t->HubName); - } - UnlockHubList(c); - - if (h == NULL) - { - return ERR_HUB_NOT_FOUND; - } - - FreeRpcEnumUser(t); - - StrCpy(hubname, sizeof(hubname), t->HubName); - - Zero(t, sizeof(RPC_ENUM_USER)); - StrCpy(t->HubName, sizeof(t->HubName), hubname); - - LockList(h->HubDb->UserList); - { - num = LIST_NUM(h->HubDb->UserList); - - t->NumUser = num; - t->Users = ZeroMalloc(sizeof(RPC_ENUM_USER_ITEM) * num); - - for (i = 0;i < num;i++) - { - USER *u = LIST_DATA(h->HubDb->UserList, i); - - Lock(u->lock); - { - RPC_ENUM_USER_ITEM *e = &t->Users[i]; - - StrCpy(e->Name, sizeof(e->Name), u->Name); - StrCpy(e->GroupName, sizeof(e->GroupName), u->GroupName); - UniStrCpy(e->Realname, sizeof(e->Realname), u->RealName); - UniStrCpy(e->Note, sizeof(e->Note), u->Note); - e->AuthType = u->AuthType; - e->LastLoginTime = u->LastLoginTime; - e->NumLogin = u->NumLogin; - - if (u->Policy != NULL) - { - e->DenyAccess = u->Policy->Access ? false : true; - } - - Copy(&e->Traffic, u->Traffic, sizeof(TRAFFIC)); - e->IsTrafficFilled = true; - - e->Expires = u->ExpireTime; - e->IsExpiresFilled = true; - } - Unlock(u->lock); - } - } - UnlockList(h->HubDb->UserList); - - ReleaseHub(h); - - IncrementServerConfigRevision(s); - - return ERR_NO_ERROR; -} - -// Delete a user -UINT StDeleteUser(ADMIN *a, RPC_DELETE_USER *t) -{ - SERVER *s = a->Server; - CEDAR *c = s->Cedar; - HUB *h = NULL; - UINT ret = ERR_NO_ERROR; - - - if (IsEmptyStr(t->Name) || IsUserName(t->Name) == false) - { - return ERR_INVALID_PARAMETER; - } - - CHECK_RIGHT; - NO_SUPPORT_FOR_BRIDGE; - if (s->ServerType == SERVER_TYPE_FARM_MEMBER) - { - return ERR_NOT_SUPPORTED; - } - - LockHubList(c); - { - h = GetHub(c, t->HubName); - } - UnlockHubList(c); - - if (h == NULL) - { - return ERR_HUB_NOT_FOUND; - } - - if (a->ServerAdmin == false && GetHubAdminOption(h, "no_change_users") != 0) - { - ReleaseHub(h); - return ERR_NOT_ENOUGH_RIGHT; - } - - ALog(a, h, "LA_DELETE_USER", t->Name); - - AcLock(h); - { - if (AcDeleteUser(h, t->Name) == false) - { - ret = ERR_OBJECT_NOT_FOUND; - } - } - AcUnlock(h); - - ReleaseHub(h); - - IncrementServerConfigRevision(s); - - return ret; -} - -// Get user setting -UINT StGetUser(ADMIN *a, RPC_SET_USER *t) -{ - SERVER *s = a->Server; - CEDAR *c = s->Cedar; - HUB *h = NULL; - UINT ret = ERR_NO_ERROR; - USER *u = NULL; - USERGROUP *g = NULL; - char name[MAX_USERNAME_LEN + 1]; - char hubname[MAX_HUBNAME_LEN + 1]; - StrCpy(name, sizeof(name), t->Name); - StrCpy(hubname, sizeof(hubname), t->HubName); - - if (IsEmptyStr(t->Name) || IsUserName(t->Name) == false) - { - return ERR_INVALID_PARAMETER; - } - - CHECK_RIGHT; - NO_SUPPORT_FOR_BRIDGE; - if (s->ServerType == SERVER_TYPE_FARM_MEMBER) - { - return ERR_NOT_SUPPORTED; - } - - FreeRpcSetUser(t); - Zero(t, sizeof(RPC_SET_USER)); - StrCpy(t->HubName, sizeof(t->HubName), hubname); - StrCpy(t->Name, sizeof(t->Name), name); - - LockHubList(c); - { - h = GetHub(c, hubname); - } - UnlockHubList(c); - - if (h == NULL) - { - return ERR_HUB_NOT_FOUND; - } - - AcLock(h); - { - u = AcGetUser(h, name); - if (u == NULL) - { - ret = ERR_OBJECT_NOT_FOUND; - } - else - { - Lock(u->lock); - { - StrCpy(t->GroupName, sizeof(t->GroupName), u->GroupName); - UniStrCpy(t->Realname, sizeof(t->Realname), u->RealName); - UniStrCpy(t->Note, sizeof(t->Note), u->Note); - t->CreatedTime = u->CreatedTime; - t->UpdatedTime = u->UpdatedTime; - t->ExpireTime = u->ExpireTime; - - t->AuthType = u->AuthType; - t->AuthData = CopyAuthData(u->AuthData, t->AuthType); - t->NumLogin = u->NumLogin; - Copy(&t->Traffic, u->Traffic, sizeof(TRAFFIC)); - if (u->Policy != NULL) - { - t->Policy = ClonePolicy(u->Policy); - } - } - Unlock(u->lock); - - ReleaseUser(u); - } - } - AcUnlock(h); - - ReleaseHub(h); - - return ret; -} - -// Set user setting -UINT StSetUser(ADMIN *a, RPC_SET_USER *t) -{ - SERVER *s = a->Server; - CEDAR *c = s->Cedar; - HUB *h = NULL; - UINT ret = ERR_NO_ERROR; - USER *u = NULL; - USERGROUP *g = NULL; - - - if (IsEmptyStr(t->Name) || IsUserName(t->Name) == false) - { - return ERR_INVALID_PARAMETER; - } - - NO_SUPPORT_FOR_BRIDGE; - if (s->ServerType == SERVER_TYPE_FARM_MEMBER) - { - return ERR_NOT_SUPPORTED; - } - - CHECK_RIGHT; - - if (GetGlobalServerFlag(GSF_DISABLE_RADIUS_AUTH) != 0) - { - if (t->AuthType == AUTHTYPE_USERCERT || t->AuthType == AUTHTYPE_RADIUS || t->AuthType == AUTHTYPE_ROOTCERT || t->AuthType == AUTHTYPE_NT) - { - return ERR_NOT_SUPPORTED_AUTH_ON_OPENSOURCE; - } - } - - if (StrCmpi(t->Name, "*") == 0) - { - if (t->AuthType != AUTHTYPE_RADIUS && t->AuthType != AUTHTYPE_NT) - { - return ERR_INVALID_PARAMETER; - } - } - - if (t->AuthType == AUTHTYPE_USERCERT) - { - AUTHUSERCERT *c = t->AuthData; - if (c != NULL && c->UserX != NULL && - c->UserX->is_compatible_bit == false) - { - return ERR_NOT_RSA_1024; - } - if (c == NULL || c->UserX == NULL) - { - return ERR_INVALID_PARAMETER; - } - } - - LockHubList(c); - { - h = GetHub(c, t->HubName); - } - UnlockHubList(c); - - if (h == NULL) - { - return ERR_HUB_NOT_FOUND; - } - - if (a->ServerAdmin == false && GetHubAdminOption(h, "no_change_users") != 0) - { - ReleaseHub(h); - return ERR_NOT_ENOUGH_RIGHT; - } - - AcLock(h); - { - u = AcGetUser(h, t->Name); - if (u == NULL) - { - ret = ERR_OBJECT_NOT_FOUND; - } - else - { - Lock(u->lock); - { - if (StrLen(t->GroupName) != 0) - { - g = AcGetGroup(h, t->GroupName); - - if (g != NULL) - { - JoinUserToGroup(u, g); - ReleaseGroup(g); - } - else - { - ret = ERR_GROUP_NOT_FOUND; - } - } - else - { - JoinUserToGroup(u, NULL); - } - - if (ret != ERR_GROUP_NOT_FOUND) - { - Free(u->RealName); - Free(u->Note); - u->RealName = UniCopyStr(t->Realname); - u->Note = UniCopyStr(t->Note); - SetUserAuthData(u, t->AuthType, CopyAuthData(t->AuthData, t->AuthType)); - u->ExpireTime = t->ExpireTime; - u->UpdatedTime = SystemTime64(); - - SetUserPolicy(u, t->Policy); - } - } - Unlock(u->lock); - - IncrementServerConfigRevision(s); - - ReleaseUser(u); - } - } - AcUnlock(h); - - if (ret == ERR_NO_ERROR) - { - ALog(a, h, "LA_SET_USER", t->Name); - } - - ReleaseHub(h); - - return ret; -} - -// Create a user -UINT StCreateUser(ADMIN *a, RPC_SET_USER *t) -{ - SERVER *s = a->Server; - CEDAR *c = s->Cedar; - HUB *h = NULL; - UINT ret = ERR_NO_ERROR; - USER *u; - USERGROUP *g = NULL; - - - if (IsEmptyStr(t->Name) || IsUserName(t->Name) == false) - { - return ERR_INVALID_PARAMETER; - } - - NO_SUPPORT_FOR_BRIDGE; - if (s->ServerType == SERVER_TYPE_FARM_MEMBER) - { - return ERR_NOT_SUPPORTED; - } - - CHECK_RIGHT; - - if (GetGlobalServerFlag(GSF_DISABLE_RADIUS_AUTH) != 0) - { - if (t->AuthType == AUTHTYPE_USERCERT || t->AuthType == AUTHTYPE_RADIUS || t->AuthType == AUTHTYPE_ROOTCERT || t->AuthType == AUTHTYPE_NT) - { - return ERR_NOT_SUPPORTED_AUTH_ON_OPENSOURCE; - } - } - - if (t->AuthType == AUTHTYPE_USERCERT) - { - AUTHUSERCERT *c = t->AuthData; - if (c != NULL && c->UserX != NULL && - c->UserX->is_compatible_bit == false) - { - return ERR_NOT_RSA_1024; - } - if (c == NULL || c->UserX == NULL) - { - return ERR_INVALID_PARAMETER; - } - } - - if (IsUserName(t->Name) == false) - { - return ERR_INVALID_PARAMETER; - } - - if (StrCmpi(t->Name, "*") == 0) - { - if (t->AuthType != AUTHTYPE_RADIUS && t->AuthType != AUTHTYPE_NT) - { - return ERR_INVALID_PARAMETER; - } - } - - LockHubList(c); - { - h = GetHub(c, t->HubName); - } - UnlockHubList(c); - - if (h == NULL) - { - return ERR_HUB_NOT_FOUND; - } - - if (a->ServerAdmin == false && GetHubAdminOption(h, "no_change_users") != 0) - { - ReleaseHub(h); - return ERR_NOT_ENOUGH_RIGHT; - } - - u = NewUser(t->Name, t->Realname, t->Note, t->AuthType, CopyAuthData(t->AuthData, t->AuthType)); - if (u == NULL) - { - ReleaseHub(h); - return ERR_INTERNAL_ERROR; - } - - u->ExpireTime = t->ExpireTime; - - SetUserPolicy(u, t->Policy); - - AcLock(h); - { - if ((LIST_NUM(h->HubDb->UserList) >= GetServerCapsInt(a->Server, "i_max_users_per_hub")) || - ((GetHubAdminOption(h, "max_users") != 0) && (LIST_NUM(h->HubDb->UserList) >= GetHubAdminOption(h, "max_users")))) - { - ret = ERR_TOO_MANY_USER; - } - else if (SiTooManyUserObjectsInServer(s, false)) - { - ret = ERR_TOO_MANY_USERS_CREATED; - ALog(a, h, "ERR_128"); - } - else if (AcIsUser(h, t->Name)) - { - ret = ERR_USER_ALREADY_EXISTS; - } - else - { - if (StrLen(t->GroupName) != 0) - { - g = AcGetGroup(h, t->GroupName); - if (g == NULL) - { - ret = ERR_GROUP_NOT_FOUND; - } - } - - if (ret != ERR_GROUP_NOT_FOUND) - { - if (g != NULL) - { - JoinUserToGroup(u, g); - ReleaseGroup(g); - } - - AcAddUser(h, u); - ALog(a, h, "LA_CREATE_USER", t->Name); - - IncrementServerConfigRevision(s); - } - } - } - AcUnlock(h); - - ReleaseUser(u); - - ReleaseHub(h); - - return ret; -} - -// Get access list -UINT StEnumAccess(ADMIN *a, RPC_ENUM_ACCESS_LIST *t) -{ - SERVER *s = a->Server; - CEDAR *c = s->Cedar; - HUB *h; - UINT i; - char hubname[MAX_HUBNAME_LEN + 1]; - - CHECK_RIGHT; - NO_SUPPORT_FOR_BRIDGE; - if (s->ServerType == SERVER_TYPE_FARM_MEMBER) - { - return ERR_NOT_SUPPORTED; - } - - LockHubList(c); - { - h = GetHub(c, t->HubName); - } - UnlockHubList(c); - - if (h == NULL) - { - return ERR_HUB_NOT_FOUND; - } - - StrCpy(hubname, sizeof(hubname), t->HubName); - FreeRpcEnumAccessList(t); - Zero(t, sizeof(RPC_ENUM_ACCESS_LIST)); - StrCpy(t->HubName, sizeof(t->HubName), hubname); - - LockList(h->AccessList); - { - t->NumAccess = LIST_NUM(h->AccessList); - t->Accesses = ZeroMalloc(sizeof(ACCESS) * t->NumAccess); - - for (i = 0;i < LIST_NUM(h->AccessList);i++) - { - ACCESS *a = &t->Accesses[i]; - Copy(a, LIST_DATA(h->AccessList, i), sizeof(ACCESS)); - a->UniqueId = HashPtrToUINT(LIST_DATA(h->AccessList, i)); - } - } - UnlockList(h->AccessList); - - ReleaseHub(h); - - return ERR_NO_ERROR; -} - -// Delete access list entry -UINT StDeleteAccess(ADMIN *a, RPC_DELETE_ACCESS *t) -{ - SERVER *s = a->Server; - CEDAR *c = s->Cedar; - HUB *h; - UINT i; - bool exists; - - - if (s->ServerType == SERVER_TYPE_FARM_MEMBER) - { - return ERR_NOT_FARM_CONTROLLER; - } - - CHECK_RIGHT; - NO_SUPPORT_FOR_BRIDGE; - - LockHubList(c); - { - h = GetHub(c, t->HubName); - } - UnlockHubList(c); - - if (h == NULL) - { - return ERR_HUB_NOT_FOUND; - } - - if (a->ServerAdmin == false && GetHubAdminOption(h, "no_change_access_list") != 0) - { - ReleaseHub(h); - return ERR_NOT_ENOUGH_RIGHT; - } - - exists = false; - - LockList(h->AccessList); - { - for (i = 0;i < LIST_NUM(h->AccessList);i++) - { - ACCESS *access = LIST_DATA(h->AccessList, i); - - if ((t->Id < MAX_ACCESSLISTS && access->Id == t->Id) || - (t->Id >= MAX_ACCESSLISTS && HashPtrToUINT(access) == t->Id)) - { - Free(access); - Delete(h->AccessList, access); - exists = true; - - break; - } - } - } - UnlockList(h->AccessList); - - if (exists == false) - { - ReleaseHub(h); - return ERR_OBJECT_NOT_FOUND; - } - - ALog(a, h, "LA_DELETE_ACCESS"); - - IncrementServerConfigRevision(s); - - ReleaseHub(h); - - return ERR_NO_ERROR; -} - -// Set access list -UINT StSetAccessList(ADMIN *a, RPC_ENUM_ACCESS_LIST *t) -{ - SERVER *s = a->Server; - CEDAR *c = s->Cedar; - HUB *h; - UINT i; - bool no_jitter = false; - bool no_include = false; - UINT ret = ERR_NO_ERROR; - - - NO_SUPPORT_FOR_BRIDGE; - if (s->ServerType == SERVER_TYPE_FARM_MEMBER) - { - return ERR_NOT_SUPPORTED; - } - - CHECK_RIGHT; - - if (t->NumAccess > GetServerCapsInt(a->Server, "i_max_access_lists")) - { - return ERR_TOO_MANY_ACCESS_LIST; - } - - LockHubList(c); - { - h = GetHub(c, t->HubName); - } - UnlockHubList(c); - - if (h == NULL) - { - return ERR_HUB_NOT_FOUND; - } - - no_jitter = GetHubAdminOption(h, "no_delay_jitter_packet_loss"); - no_include = GetHubAdminOption(h, "no_access_list_include_file"); - - if (a->ServerAdmin == false && GetHubAdminOption(h, "no_change_access_list") != 0) - { - ReleaseHub(h); - return ERR_NOT_ENOUGH_RIGHT; - } - - if (a->ServerAdmin == false && GetHubAdminOption(h, "max_accesslists") != 0 && - t->NumAccess > GetHubAdminOption(h, "max_accesslists")) - { - ReleaseHub(h); - return ERR_TOO_MANY_ACCESS_LIST; - } - - LockList(h->AccessList); - { - UINT i; - - if (a->ClientBuild != 0) - { - // Confirm whether the access list of form which cannot handle by the old client already exists - if (a->ClientBuild < 6560) - { - for (i = 0;i < LIST_NUM(h->AccessList);i++) - { - ACCESS *access = LIST_DATA(h->AccessList, i); - if (access->IsIPv6 || - access->Jitter != 0 || access->Loss != 0 || access->Delay != 0) - { - ret = ERR_VERSION_INVALID; - break; - } - } - } - - if (a->ClientBuild < 8234) - { - for (i = 0;i < LIST_NUM(h->AccessList);i++) - { - ACCESS *access = LIST_DATA(h->AccessList, i); - - if (IsEmptyStr(access->RedirectUrl) == false) - { - ret = ERR_VERSION_INVALID; - break; - } - } - } - } - - if (ret == ERR_NO_ERROR) - { - // Delete whole access list - for (i = 0;i < LIST_NUM(h->AccessList);i++) - { - ACCESS *access = LIST_DATA(h->AccessList, i); - Free(access); - } - - DeleteAll(h->AccessList); - } - } - - if (ret == ERR_NO_ERROR) - { - ALog(a, h, "LA_SET_ACCESS_LIST", t->NumAccess); - - // Add whole access list - for (i = 0;i < t->NumAccess;i++) - { - ACCESS *a = &t->Accesses[i]; - - if (no_jitter) - { - a->Jitter = a->Loss = a->Delay = 0; - } - - if (no_include) - { - if (StartWith(a->SrcUsername, ACCESS_LIST_INCLUDED_PREFIX) || - StartWith(a->SrcUsername, ACCESS_LIST_EXCLUDED_PREFIX)) - { - ClearStr(a->SrcUsername, sizeof(a->SrcUsername)); - } - - if (StartWith(a->DestUsername, ACCESS_LIST_INCLUDED_PREFIX) || - StartWith(a->DestUsername, ACCESS_LIST_EXCLUDED_PREFIX)) - { - ClearStr(a->DestUsername, sizeof(a->DestUsername)); - } - } - - if (i == (t->NumAccess - 1)) - { - Sort(h->AccessList); - } - - AddAccessListEx(h, a, ((i != (t->NumAccess - 1)) ? true : false), ((i != (t->NumAccess - 1)) ? true : false)); - } - - UnlockList(h->AccessList); - - IncrementServerConfigRevision(s); - - h->CurrentVersion++; - SiHubUpdateProc(h); - } - else - { - UnlockList(h->AccessList); - } - - ReleaseHub(h); - - return ret; -} - -// Add access list entry -UINT StAddAccess(ADMIN *a, RPC_ADD_ACCESS *t) -{ - SERVER *s = a->Server; - CEDAR *c = s->Cedar; - HUB *h; - bool no_jitter = false; - bool no_include = false; - - - NO_SUPPORT_FOR_BRIDGE; - if (s->ServerType == SERVER_TYPE_FARM_MEMBER) - { - return ERR_NOT_SUPPORTED; - } - - CHECK_RIGHT; - - LockHubList(c); - { - h = GetHub(c, t->HubName); - } - UnlockHubList(c); - - if (h == NULL) - { - return ERR_HUB_NOT_FOUND; - } - - no_jitter = GetHubAdminOption(h, "no_delay_jitter_packet_loss"); - no_include = GetHubAdminOption(h, "no_access_list_include_file"); - - if (a->ServerAdmin == false && GetHubAdminOption(h, "no_change_access_list") != 0) - { - ReleaseHub(h); - return ERR_NOT_ENOUGH_RIGHT; - } - - if ((LIST_NUM(h->AccessList) >= GetServerCapsInt(a->Server, "i_max_access_lists") || - (GetHubAdminOption(h, "max_accesslists") != 0) && (LIST_NUM(h->AccessList) >= GetHubAdminOption(h, "max_accesslists")))) - { - ReleaseHub(h); - return ERR_TOO_MANY_ACCESS_LIST; - } - - ALog(a, h, "LA_ADD_ACCESS"); - - if (no_jitter) - { - t->Access.Jitter = t->Access.Delay = t->Access.Loss = 0; - } - - if (no_include) - { - if (StartWith(t->Access.SrcUsername, ACCESS_LIST_INCLUDED_PREFIX) || - StartWith(t->Access.SrcUsername, ACCESS_LIST_EXCLUDED_PREFIX)) - { - ClearStr(t->Access.SrcUsername, sizeof(t->Access.SrcUsername)); - } - - if (StartWith(t->Access.DestUsername, ACCESS_LIST_INCLUDED_PREFIX) || - StartWith(t->Access.DestUsername, ACCESS_LIST_EXCLUDED_PREFIX)) - { - ClearStr(t->Access.DestUsername, sizeof(t->Access.DestUsername)); - } - } - - AddAccessList(h, &t->Access); - - h->CurrentVersion++; - SiHubUpdateProc(h); - - ReleaseHub(h); - - IncrementServerConfigRevision(s); - - return ERR_NO_ERROR; -} - -// Rename link (cascade connection) -UINT StRenameLink(ADMIN *a, RPC_RENAME_LINK *t) -{ - UINT i; - SERVER *s = a->Server; - CEDAR *c = s->Cedar; - HUB *h; - UINT ret = ERR_NO_ERROR; - LINK *k; - bool exists = false; - - if (UniIsEmptyStr(t->OldAccountName) || UniIsEmptyStr(t->NewAccountName)) - { - return ERR_INVALID_PARAMETER; - } - - if (s->ServerType != SERVER_TYPE_STANDALONE) - { - return ERR_NOT_SUPPORTED; - } - - CHECK_RIGHT; - - if (UniStrCmpi(t->NewAccountName, t->OldAccountName) == 0) - { - // Noop if new name is same to old name - return ERR_NO_ERROR; - } - - h = GetHub(c, t->HubName); - - if (h == NULL) - { - return ERR_HUB_NOT_FOUND; - } - - if (a->ServerAdmin == false && GetHubAdminOption(h, "no_cascade") != 0) - { - ReleaseHub(h); - return ERR_NOT_ENOUGH_RIGHT; - } - - k = NULL; - - // Find specified link - LockList(h->LinkList); - { - for (i = 0;i < LIST_NUM(h->LinkList);i++) - { - LINK *kk = LIST_DATA(h->LinkList, i); - Lock(kk->lock); - { - if (UniStrCmpi(kk->Option->AccountName, t->OldAccountName) == 0) - { - k = kk; - AddRef(kk->ref); - } - } - Unlock(kk->lock); - - if (k != NULL) - { - break; - } - } - - exists = false; - - if (k != NULL) - { - // Check whether the new link name is same to other links - for (i = 0;i < LIST_NUM(h->LinkList);i++) - { - LINK *kk = LIST_DATA(h->LinkList, i); - Lock(kk->lock); - { - if (UniStrCmpi(kk->Option->AccountName, t->NewAccountName) == 0) - { - // duplicated - exists = true; - } - } - Unlock(kk->lock); - } - - if (exists) - { - // Already same name exists - ret = ERR_LINK_ALREADY_EXISTS; - } - else - { - // Do rename - UniStrCpy(k->Option->AccountName, sizeof(k->Option->AccountName), t->NewAccountName); - - ALog(a, h, "LA_RENAME_LINK", t->OldAccountName, t->NewAccountName); - - IncrementServerConfigRevision(s); - } - } - } - UnlockList(h->LinkList); - - if (k == NULL) - { - // specified link is not found - ReleaseHub(h); - return ERR_OBJECT_NOT_FOUND; - } - - ReleaseLink(k); - - ReleaseHub(h); - - return ret; -} - -// Delete a link -UINT StDeleteLink(ADMIN *a, RPC_LINK *t) -{ - UINT i; - SERVER *s = a->Server; - CEDAR *c = s->Cedar; - HUB *h; - UINT ret = ERR_NO_ERROR; - char hubname[MAX_HUBNAME_LEN + 1]; - wchar_t accountname[MAX_ACCOUNT_NAME_LEN + 1]; - LINK *k; - - if (UniIsEmptyStr(t->AccountName)) - { - return ERR_INVALID_PARAMETER; - } - - if (s->ServerType != SERVER_TYPE_STANDALONE) - { - return ERR_NOT_SUPPORTED; - } - - CHECK_RIGHT; - - LockHubList(c); - { - h = GetHub(c, t->HubName); - } - UnlockHubList(c); - - if (h == NULL) - { - return ERR_HUB_NOT_FOUND; - } - - if (a->ServerAdmin == false && GetHubAdminOption(h, "no_cascade") != 0) - { - ReleaseHub(h); - return ERR_NOT_ENOUGH_RIGHT; - } - - StrCpy(hubname, sizeof(hubname), t->HubName); - UniStrCpy(accountname, sizeof(accountname), t->AccountName); - k = NULL; - - // Find specified link - LockList(h->LinkList); - { - for (i = 0;i < LIST_NUM(h->LinkList);i++) - { - LINK *kk = LIST_DATA(h->LinkList, i); - Lock(kk->lock); - { - if (UniStrCmpi(kk->Option->AccountName, accountname) == 0) - { - k = kk; - AddRef(kk->ref); - } - } - Unlock(kk->lock); - - if (k != NULL) - { - break; - } - } - } - UnlockList(h->LinkList); - - if (k == NULL) - { - // Specified link is not found - ReleaseHub(h); - - return ERR_OBJECT_NOT_FOUND; - } - - k->NoOnline = true; - - ALog(a, h, "LA_DELETE_LINK", t->AccountName); - - SetLinkOffline(k); - - IncrementServerConfigRevision(s); - - DelLink(h, k); - - ReleaseLink(k); - ReleaseHub(h); - - return ret; -} - -// Make a link into off-line -UINT StSetLinkOffline(ADMIN *a, RPC_LINK *t) -{ - UINT i; - SERVER *s = a->Server; - CEDAR *c = s->Cedar; - HUB *h; - UINT ret = ERR_NO_ERROR; - char hubname[MAX_HUBNAME_LEN + 1]; - wchar_t accountname[MAX_ACCOUNT_NAME_LEN + 1]; - LINK *k; - - - if (UniIsEmptyStr(t->AccountName)) - { - return ERR_INVALID_PARAMETER; - } - - if (s->ServerType != SERVER_TYPE_STANDALONE) - { - return ERR_NOT_SUPPORTED; - } - - CHECK_RIGHT; - - LockHubList(c); - { - h = GetHub(c, t->HubName); - } - UnlockHubList(c); - - if (h == NULL) - { - return ERR_HUB_NOT_FOUND; - } - - if (a->ServerAdmin == false && GetHubAdminOption(h, "no_cascade") != 0) - { - ReleaseHub(h); - return ERR_NOT_ENOUGH_RIGHT; - } - - StrCpy(hubname, sizeof(hubname), t->HubName); - UniStrCpy(accountname, sizeof(accountname), t->AccountName); - k = NULL; - - // Find specified link - LockList(h->LinkList); - { - for (i = 0;i < LIST_NUM(h->LinkList);i++) - { - LINK *kk = LIST_DATA(h->LinkList, i); - Lock(kk->lock); - { - if (UniStrCmpi(kk->Option->AccountName, accountname) == 0) - { - k = kk; - AddRef(kk->ref); - } - } - Unlock(kk->lock); - - if (k != NULL) - { - break; - } - } - } - UnlockList(h->LinkList); - - if (k == NULL) - { - // Link is not found - ReleaseHub(h); - - return ERR_OBJECT_NOT_FOUND; - } - - ALog(a, h, "LA_SET_LINK_OFFLINE", t->AccountName); - - SetLinkOffline(k); - - IncrementServerConfigRevision(s); - - ReleaseLink(k); - ReleaseHub(h); - - return ret; -} - -// Make a link into on-line -UINT StSetLinkOnline(ADMIN *a, RPC_LINK *t) -{ - UINT i; - SERVER *s = a->Server; - CEDAR *c = s->Cedar; - HUB *h; - UINT ret = ERR_NO_ERROR; - char hubname[MAX_HUBNAME_LEN + 1]; - wchar_t accountname[MAX_ACCOUNT_NAME_LEN + 1]; - LINK *k; - - - if (UniIsEmptyStr(t->AccountName)) - { - return ERR_INVALID_PARAMETER; - } - - if (s->ServerType != SERVER_TYPE_STANDALONE) - { - return ERR_NOT_SUPPORTED; - } - - CHECK_RIGHT; - - LockHubList(c); - { - h = GetHub(c, t->HubName); - } - UnlockHubList(c); - - if (h == NULL) - { - return ERR_HUB_NOT_FOUND; - } - - if (a->ServerAdmin == false && GetHubAdminOption(h, "no_cascade") != 0) - { - ReleaseHub(h); - return ERR_NOT_ENOUGH_RIGHT; - } - - StrCpy(hubname, sizeof(hubname), t->HubName); - UniStrCpy(accountname, sizeof(accountname), t->AccountName); - k = NULL; - - // Find specified link - LockList(h->LinkList); - { - for (i = 0;i < LIST_NUM(h->LinkList);i++) - { - LINK *kk = LIST_DATA(h->LinkList, i); - Lock(kk->lock); - { - if (UniStrCmpi(kk->Option->AccountName, accountname) == 0) - { - k = kk; - AddRef(kk->ref); - } - } - Unlock(kk->lock); - - if (k != NULL) - { - break; - } - } - } - UnlockList(h->LinkList); - - if (k == NULL) - { - // Specified link is not found - ReleaseHub(h); - - return ERR_OBJECT_NOT_FOUND; - } - - ALog(a, h, "LA_SET_LINK_ONLINE", t->AccountName); - - SetLinkOnline(k); - - ReleaseLink(k); - ReleaseHub(h); - - IncrementServerConfigRevision(s); - - return ret; -} - -// Get link status -UINT StGetLinkStatus(ADMIN *a, RPC_LINK_STATUS *t) -{ - UINT i; - SERVER *s = a->Server; - CEDAR *c = s->Cedar; - HUB *h; - UINT ret = ERR_NO_ERROR; - char hubname[MAX_HUBNAME_LEN + 1]; - wchar_t accountname[MAX_ACCOUNT_NAME_LEN + 1]; - LINK *k; - SESSION *sess; - - if (UniIsEmptyStr(t->AccountName)) - { - return ERR_INVALID_PARAMETER; - } - - if (s->ServerType != SERVER_TYPE_STANDALONE) - { - return ERR_NOT_SUPPORTED; - } - - CHECK_RIGHT; - - LockHubList(c); - { - h = GetHub(c, t->HubName); - } - UnlockHubList(c); - - if (h == NULL) - { - return ERR_HUB_NOT_FOUND; - } - - StrCpy(hubname, sizeof(hubname), t->HubName); - UniStrCpy(accountname, sizeof(accountname), t->AccountName); - FreeRpcLinkStatus(t); - Zero(t, sizeof(RPC_LINK_STATUS)); - StrCpy(t->HubName, sizeof(t->HubName), hubname); - UniStrCpy(t->AccountName, sizeof(t->AccountName), accountname); - - k = NULL; - - // Find the link - LockList(h->LinkList); - { - for (i = 0;i < LIST_NUM(h->LinkList);i++) - { - LINK *kk = LIST_DATA(h->LinkList, i); - Lock(kk->lock); - { - if (UniStrCmpi(kk->Option->AccountName, accountname) == 0) - { - k = kk; - AddRef(kk->ref); - } - } - Unlock(kk->lock); - - if (k != NULL) - { - break; - } - } - } - UnlockList(h->LinkList); - - if (k == NULL) - { - // Specified link is not found - ReleaseHub(h); - - return ERR_OBJECT_NOT_FOUND; - } - - // Get status information from session - Lock(k->lock); - { - sess = k->ClientSession; - if (sess != NULL) - { - AddRef(sess->ref); - } - } - Unlock(k->lock); - - if (sess != NULL && k->Offline == false) - { - CiGetSessionStatus(&t->Status, sess); - } - else - { - ret = ERR_LINK_IS_OFFLINE; - } - ReleaseSession(sess); - - ReleaseLink(k); - ReleaseHub(h); - - return ret; -} - -// Enumerate links -UINT StEnumLink(ADMIN *a, RPC_ENUM_LINK *t) -{ - SERVER *s = a->Server; - CEDAR *c = s->Cedar; - HUB *h; - char hubname[MAX_HUBNAME_LEN + 1]; - UINT i; - - if (s->ServerType != SERVER_TYPE_STANDALONE) - { - return ERR_NOT_SUPPORTED; - } - - CHECK_RIGHT; - - LockHubList(c); - { - h = GetHub(c, t->HubName); - } - UnlockHubList(c); - - if (h == NULL) - { - return ERR_HUB_NOT_FOUND; - } - - StrCpy(hubname, sizeof(hubname), t->HubName); - FreeRpcEnumLink(t); - Zero(t, sizeof(RPC_ENUM_LINK)); - StrCpy(t->HubName, sizeof(t->HubName), hubname); - - LockList(h->LinkList); - { - t->NumLink = LIST_NUM(h->LinkList); - t->Links = ZeroMalloc(sizeof(RPC_ENUM_LINK_ITEM) * t->NumLink); - - for (i = 0;i < LIST_NUM(h->LinkList);i++) - { - LINK *k = LIST_DATA(h->LinkList, i); - RPC_ENUM_LINK_ITEM *e = &t->Links[i]; - - Lock(k->lock); - { - UniStrCpy(e->AccountName, sizeof(e->AccountName), k->Option->AccountName); - StrCpy(e->Hostname, sizeof(e->Hostname), k->Option->Hostname); - StrCpy(e->HubName, sizeof(e->HubName), k->Option->HubName); - e->Online = k->Offline ? false : true; - - if (e->Online) - { - if (k->ClientSession != NULL) - { - e->ConnectedTime = TickToTime(k->ClientSession->CurrentConnectionEstablishTime); - e->Connected = (k->ClientSession->ClientStatus == CLIENT_STATUS_ESTABLISHED); - e->LastError = k->ClientSession->Err; - } - } - } - Unlock(k->lock); - } - } - UnlockList(h->LinkList); - - ReleaseHub(h); - - return ERR_NO_ERROR; -} - -// Get link configuration -UINT StGetLink(ADMIN *a, RPC_CREATE_LINK *t) -{ - SERVER *s = a->Server; - CEDAR *c = s->Cedar; - HUB *h; - UINT ret = ERR_NO_ERROR; - UINT i; - char hubname[MAX_SIZE]; - LINK *k; - - if (s->ServerType != SERVER_TYPE_STANDALONE) - { - return ERR_NOT_SUPPORTED; - } - - CHECK_RIGHT; - - if (s->ServerType != SERVER_TYPE_STANDALONE) - { - return ERR_LINK_CANT_CREATE_ON_FARM; - } - - LockHubList(c); - { - h = GetHub(c, t->HubName); - } - UnlockHubList(c); - - if (h == NULL) - { - return ERR_HUB_NOT_FOUND; - } - - k = NULL; - - // Find the link - LockList(h->LinkList); - { - for (i = 0;i < LIST_NUM(h->LinkList);i++) - { - LINK *kk = LIST_DATA(h->LinkList, i); - Lock(kk->lock); - { - if (UniStrCmpi(kk->Option->AccountName, t->ClientOption->AccountName) == 0) - { - k = kk; - AddRef(kk->ref); - } - } - Unlock(kk->lock); - - if (k != NULL) - { - break; - } - } - } - UnlockList(h->LinkList); - - if (k == NULL) - { - // The link is not found - ReleaseHub(h); - return ERR_OBJECT_NOT_FOUND; - } - - StrCpy(hubname, sizeof(hubname), t->HubName); - FreeRpcCreateLink(t); - Zero(t, sizeof(RPC_CREATE_LINK)); - StrCpy(t->HubName, sizeof(t->HubName), hubname); - - Lock(k->lock); - { - // Get configuration - t->Online = k->Offline ? false : true; - t->ClientOption = ZeroMalloc(sizeof(CLIENT_OPTION)); - Copy(t->ClientOption, k->Option, sizeof(CLIENT_OPTION)); - t->ClientAuth = CopyClientAuth(k->Auth); - Copy(&t->Policy, k->Policy, sizeof(POLICY)); - - t->CheckServerCert = k->CheckServerCert; - t->ServerCert = CloneX(k->ServerCert); - } - Unlock(k->lock); - - ReleaseLink(k); - ReleaseHub(h); - - return ret; -} - -// Set link configuration -UINT StSetLink(ADMIN *a, RPC_CREATE_LINK *t) -{ - SERVER *s = a->Server; - CEDAR *c = s->Cedar; - HUB *h; - UINT ret = ERR_NO_ERROR; - UINT i; - LINK *k; - - - if (s->ServerType != SERVER_TYPE_STANDALONE) - { - return ERR_NOT_SUPPORTED; - } - - CHECK_RIGHT; - - if (s->ServerType != SERVER_TYPE_STANDALONE) - { - return ERR_LINK_CANT_CREATE_ON_FARM; - } - - LockHubList(c); - { - h = GetHub(c, t->HubName); - } - UnlockHubList(c); - - if (h == NULL) - { - return ERR_HUB_NOT_FOUND; - } - - if (a->ServerAdmin == false && GetHubAdminOption(h, "no_cascade") != 0) - { - ReleaseHub(h); - return ERR_NOT_ENOUGH_RIGHT; - } - - k = NULL; - - // Find the link - LockList(h->LinkList); - { - for (i = 0;i < LIST_NUM(h->LinkList);i++) - { - LINK *kk = LIST_DATA(h->LinkList, i); - Lock(kk->lock); - { - if (UniStrCmpi(kk->Option->AccountName, t->ClientOption->AccountName) == 0) - { - k = kk; - AddRef(kk->ref); - } - } - Unlock(kk->lock); - - if (k != NULL) - { - break; - } - } - } - UnlockList(h->LinkList); - - if (k == NULL) - { - // The link is not found - ReleaseHub(h); - return ERR_OBJECT_NOT_FOUND; - } - - ALog(a, h, "LA_SET_LINK", t->ClientOption->AccountName); - - Lock(k->lock); - { - // Update the configuration of the link - if (k->ServerCert != NULL) - { - FreeX(k->ServerCert); - k->ServerCert = NULL; - } - - Copy(k->Option, t->ClientOption, sizeof(CLIENT_OPTION)); - StrCpy(k->Option->DeviceName, sizeof(k->Option->DeviceName), LINK_DEVICE_NAME); - k->Option->NumRetry = INFINITE; - k->Option->RetryInterval = 10; - k->Option->NoRoutingTracking = true; - CiFreeClientAuth(k->Auth); - k->Auth = CopyClientAuth(t->ClientAuth); - - if (t->Policy.Ver3 == false) - { - Copy(k->Policy, &t->Policy, sizeof(UINT) * NUM_POLICY_ITEM_FOR_VER2); - } - else - { - Copy(k->Policy, &t->Policy, sizeof(POLICY)); - } - - k->Option->RequireBridgeRoutingMode = true; // Enable Bridge / Routing mode - k->Option->RequireMonitorMode = false; // Disable monitor mode - - k->CheckServerCert = t->CheckServerCert; - k->ServerCert = CloneX(t->ServerCert); - } - Unlock(k->lock); - - IncrementServerConfigRevision(s); - - ReleaseLink(k); - ReleaseHub(h); - - return ret; -} - -// Create a new link(cascade) -UINT StCreateLink(ADMIN *a, RPC_CREATE_LINK *t) -{ - SERVER *s = a->Server; - CEDAR *c = s->Cedar; - HUB *h; - UINT ret = ERR_NO_ERROR; - UINT i; - LINK *k; - - CHECK_RIGHT; - - - if (s->ServerType != SERVER_TYPE_STANDALONE) - { - return ERR_LINK_CANT_CREATE_ON_FARM; - } - - LockHubList(c); - { - h = GetHub(c, t->HubName); - } - UnlockHubList(c); - - if (h == NULL) - { - return ERR_HUB_NOT_FOUND; - } - - if (a->ServerAdmin == false && GetHubAdminOption(h, "no_cascade") != 0) - { - ReleaseHub(h); - return ERR_NOT_ENOUGH_RIGHT; - } - - k = NULL; - - // Check for existing a link which has same name - LockList(h->LinkList); - { - for (i = 0;i < LIST_NUM(h->LinkList);i++) - { - LINK *kk = LIST_DATA(h->LinkList, i); - Lock(kk->lock); - { - if (UniStrCmpi(kk->Option->AccountName, t->ClientOption->AccountName) == 0) - { - k = kk; - AddRef(kk->ref); - } - } - Unlock(kk->lock); - - if (k != NULL) - { - break; - } - } - } - UnlockList(h->LinkList); - - if (k != NULL) - { - // There is a link which has same name - ReleaseLink(k); - ReleaseHub(h); - return ERR_LINK_ALREADY_EXISTS; - } - - ALog(a, h, "LA_CREATE_LINK", t->ClientOption->AccountName); - - // Create a new link - k = NewLink(c, h, t->ClientOption, t->ClientAuth, &t->Policy); - - if (k == NULL) - { - // Link creation failed - ret = ERR_INTERNAL_ERROR; - } - else - { - // setting of verifying server certification - // - k->CheckServerCert = t->CheckServerCert; - k->ServerCert = CloneX(t->ServerCert); - - // stay this off-line - k->Offline = false; - SetLinkOffline(k); - ReleaseLink(k); - - IncrementServerConfigRevision(s); - } - - ReleaseHub(h); - - return ret; -} - -// Delete a CA(Certificate Authority) setting from the hub -UINT StDeleteCa(ADMIN *a, RPC_HUB_DELETE_CA *t) -{ - SERVER *s = a->Server; - CEDAR *c = s->Cedar; - HUB *h; - UINT ret = ERR_NO_ERROR; - - if (s->ServerType == SERVER_TYPE_FARM_MEMBER) - { - return ERR_NOT_FARM_CONTROLLER; - } - - NO_SUPPORT_FOR_BRIDGE; - CHECK_RIGHT; - - LockHubList(c); - { - h = GetHub(c, t->HubName); - } - UnlockHubList(c); - - if (h == NULL) - { - return ERR_HUB_NOT_FOUND; - } - - if (a->ServerAdmin == false && GetHubAdminOption(h, "no_change_cert_list") != 0) - { - ReleaseHub(h); - return ERR_NOT_ENOUGH_RIGHT; - } - - LockList(h->HubDb->RootCertList); - { - if (IsInListKey(h->HubDb->RootCertList, t->Key)) - { - X *x = ListKeyToPointer(h->HubDb->RootCertList, t->Key); - Delete(h->HubDb->RootCertList, x); - FreeX(x); - - ALog(a, h, "LA_DELETE_CA"); - - IncrementServerConfigRevision(s); - } - else - { - ret = ERR_OBJECT_NOT_FOUND; - } - } - UnlockList(h->HubDb->RootCertList); - - ReleaseHub(h); - - return ret; -} - -// Get CA(Certificate Authority) setting from the hub -UINT StGetCa(ADMIN *a, RPC_HUB_GET_CA *t) -{ - SERVER *s = a->Server; - CEDAR *c = s->Cedar; - HUB *h; - UINT ret = ERR_NO_ERROR; - char hubname[MAX_HUBNAME_LEN + 1]; - UINT key; - - if (s->ServerType == SERVER_TYPE_FARM_MEMBER) - { - return ERR_NOT_FARM_CONTROLLER; - } - - NO_SUPPORT_FOR_BRIDGE; - - StrCpy(hubname, sizeof(hubname), t->HubName); - key = t->Key; - - FreeRpcHubGetCa(t); - Zero(t, sizeof(RPC_HUB_GET_CA)); - t->Key = key; - StrCpy(t->HubName, sizeof(t->HubName), hubname); - - CHECK_RIGHT; - - LockHubList(c); - { - h = GetHub(c, t->HubName); - } - UnlockHubList(c); - - if (h == NULL) - { - return ERR_HUB_NOT_FOUND; - } - - LockList(h->HubDb->RootCertList); - { - if (IsInListKey(h->HubDb->RootCertList, key)) - { - X *x = ListKeyToPointer(h->HubDb->RootCertList, key); - - t->Cert = CloneX(x); - } - else - { - ret = ERR_OBJECT_NOT_FOUND; - } - } - UnlockList(h->HubDb->RootCertList); - - ReleaseHub(h); - - return ret; -} - -// Enumerate CA(Certificate Authority) in the hub -UINT StEnumCa(ADMIN *a, RPC_HUB_ENUM_CA *t) -{ - SERVER *s = a->Server; - CEDAR *c = s->Cedar; - HUB *h; - char hubname[MAX_HUBNAME_LEN + 1]; - UINT i; - - if (s->ServerType == SERVER_TYPE_FARM_MEMBER) - { - return ERR_NOT_FARM_CONTROLLER; - } - - NO_SUPPORT_FOR_BRIDGE; - - StrCpy(hubname, sizeof(hubname), t->HubName); - - FreeRpcHubEnumCa(t); - Zero(t, sizeof(RPC_HUB_ENUM_CA)); - - StrCpy(t->HubName, sizeof(t->HubName), hubname); - CHECK_RIGHT; - - LockHubList(c); - { - h = GetHub(c, hubname); - } - UnlockHubList(c); - - if (h == NULL) - { - return ERR_HUB_NOT_FOUND; - } - - Zero(t, sizeof(RPC_HUB_ENUM_CA)); - StrCpy(t->HubName, sizeof(t->HubName), hubname); - - if (h->HubDb->RootCertList != NULL) - { - LockList(h->HubDb->RootCertList); - { - t->NumCa = LIST_NUM(h->HubDb->RootCertList); - t->Ca = ZeroMalloc(sizeof(RPC_HUB_ENUM_CA_ITEM) * t->NumCa); - - for (i = 0;i < t->NumCa;i++) - { - RPC_HUB_ENUM_CA_ITEM *e = &t->Ca[i]; - X *x = LIST_DATA(h->HubDb->RootCertList, i); - - e->Key = POINTER_TO_KEY(x); - GetAllNameFromNameEx(e->SubjectName, sizeof(e->SubjectName), x->subject_name); - GetAllNameFromNameEx(e->IssuerName, sizeof(e->IssuerName), x->issuer_name); - e->Expires = x->notAfter; - } - } - UnlockList(h->HubDb->RootCertList); - } - - ReleaseHub(h); - - return ERR_NO_ERROR; -} - -// Add CA(Certificate Authority) into the hub -UINT StAddCa(ADMIN *a, RPC_HUB_ADD_CA *t) -{ - SERVER *s = a->Server; - CEDAR *c = s->Cedar; - HUB *h; - - if (s->ServerType == SERVER_TYPE_FARM_MEMBER) - { - return ERR_NOT_FARM_CONTROLLER; - } - - if (c->Bridge) - { - return ERR_NOT_SUPPORTED; - } - - if (t->Cert == NULL) - { - return ERR_INVALID_PARAMETER; - } - - if (t->Cert->is_compatible_bit == false) - { - return ERR_NOT_RSA_1024; - } - - CHECK_RIGHT; - - LockHubList(c); - { - h = GetHub(c, t->HubName); - } - UnlockHubList(c); - - if (h == NULL) - { - return ERR_HUB_NOT_FOUND; - } - - if (a->ServerAdmin == false && GetHubAdminOption(h, "no_change_cert_list") != 0) - { - ReleaseHub(h); - return ERR_NOT_ENOUGH_RIGHT; - } - - IncrementServerConfigRevision(s); - - ALog(a, h, "LA_ADD_CA"); - - AddRootCert(h, t->Cert); - - ReleaseHub(h); - - return ERR_NO_ERROR; -} - -// Get logging configuration of the hub -UINT StGetHubLog(ADMIN *a, RPC_HUB_LOG *t) -{ - SERVER *s = a->Server; - CEDAR *c = s->Cedar; - HUB *h; - - CHECK_RIGHT; - - LockHubList(c); - { - h = GetHub(c, t->HubName); - } - UnlockHubList(c); - - if (h == NULL) - { - return ERR_HUB_NOT_FOUND; - } - - GetHubLogSetting(h, &t->LogSetting); - - ReleaseHub(h); - - return ERR_NO_ERROR; -} - -// Set logging configuration into the hub -UINT StSetHubLog(ADMIN *a, RPC_HUB_LOG *t) -{ - SERVER *s = a->Server; - CEDAR *c = s->Cedar; - HUB *h; - - CHECK_RIGHT; - - - LockHubList(c); - { - h = GetHub(c, t->HubName); - } - UnlockHubList(c); - - if (h == NULL) - { - return ERR_HUB_NOT_FOUND; - } - - if (a->ServerAdmin == false && GetHubAdminOption(h, "no_change_log_config") != 0) - { - ReleaseHub(h); - return ERR_NOT_ENOUGH_RIGHT; - } - - ALog(a, h, "LA_SET_HUB_LOG"); - - SetHubLogSettingEx(h, &t->LogSetting, - (a->ServerAdmin == false && GetHubAdminOption(h, "no_change_log_switch_type") != 0)); - - h->CurrentVersion++; - SiHubUpdateProc(h); - - ReleaseHub(h); - - IncrementServerConfigRevision(s); - - return ERR_NO_ERROR; -} - -// Get hub status -UINT StGetHubStatus(ADMIN *a, RPC_HUB_STATUS *t) -{ - SERVER *s = a->Server; - CEDAR *c = s->Cedar; - HUB *h; - - CHECK_RIGHT; - - LockHubList(c); - { - h = GetHub(c, t->HubName); - } - UnlockHubList(c); - - if (h == NULL) - { - return ERR_HUB_NOT_FOUND; - } - - Zero(t, sizeof(RPC_HUB_STATUS)); - - Lock(h->lock); - { - StrCpy(t->HubName, sizeof(t->HubName), h->Name); - t->HubType = h->Type; - t->Online = h->Offline ? false : true; - t->NumSessions = LIST_NUM(h->SessionList); - t->NumSessionsClient = Count(h->NumSessionsClient); - t->NumSessionsBridge = Count(h->NumSessionsBridge); - t->NumAccessLists = LIST_NUM(h->AccessList); - - if (h->HubDb != NULL) - { - t->NumUsers = LIST_NUM(h->HubDb->UserList); - t->NumGroups = LIST_NUM(h->HubDb->GroupList); - } - - t->NumMacTables = HASH_LIST_NUM(h->MacHashTable); - t->NumIpTables = LIST_NUM(h->IpTable); - - Lock(h->TrafficLock); - { - Copy(&t->Traffic, h->Traffic, sizeof(TRAFFIC)); - } - Unlock(h->TrafficLock); - - t->NumLogin = h->NumLogin; - t->LastCommTime = h->LastCommTime; - t->LastLoginTime = h->LastLoginTime; - t->CreatedTime = h->CreatedTime; - } - Unlock(h->lock); - - if (s->ServerType == SERVER_TYPE_FARM_CONTROLLER) - { - UINT i; - LockList(s->FarmMemberList); - { - for (i = 0;i < LIST_NUM(s->FarmMemberList);i++) - { - UINT k; - FARM_MEMBER *f = LIST_DATA(s->FarmMemberList, i); - - if (f->Me == false) - { - LockList(f->HubList); - { - for (k = 0;k < LIST_NUM(f->HubList);k++) - { - HUB_LIST *h = LIST_DATA(f->HubList, k); - - if (StrCmpi(h->Name, t->HubName) == 0) - { - t->NumSessions += h->NumSessions; - t->NumSessionsClient += h->NumSessionsClient; - t->NumSessionsBridge += h->NumSessionsBridge; - t->NumMacTables += h->NumMacTables; - t->NumIpTables += h->NumIpTables; - } - } - } - UnlockList(f->HubList); - } - } - } - UnlockList(s->FarmMemberList); - } - - if (h->Type != HUB_TYPE_FARM_STATIC) - { - t->SecureNATEnabled = h->EnableSecureNAT; - } - - ReleaseHub(h); - - return ERR_NO_ERROR; -} - -// Enable SecureNAT function of the hub -UINT StEnableSecureNAT(ADMIN *a, RPC_HUB *t) -{ - SERVER *s = a->Server; - CEDAR *c = s->Cedar; - HUB *h; - - CHECK_RIGHT; - - - LockHubList(c); - { - h = GetHub(c, t->HubName); - } - UnlockHubList(c); - - if (h == NULL) - { - return ERR_HUB_NOT_FOUND; - } - - if (h->Type == HUB_TYPE_FARM_STATIC || GetServerCapsBool(s, "b_support_securenat") == false) - { - ReleaseHub(h); - return ERR_NOT_SUPPORTED; - } - if (s->ServerType == SERVER_TYPE_FARM_MEMBER) - { - ReleaseHub(h); - return ERR_NOT_FARM_CONTROLLER; - } - - if (a->ServerAdmin == false && GetHubAdminOption(h, "no_securenat") != 0) - { - ReleaseHub(h); - return ERR_NOT_ENOUGH_RIGHT; - } - - ALog(a, h, "LA_ENABLE_SNAT"); - - EnableSecureNAT(h, true); - - h->CurrentVersion++; - SiHubUpdateProc(h); - - IncrementServerConfigRevision(s); - - ReleaseHub(h); - - return ERR_NO_ERROR; -} - -// Disable the SecureNAT function of the hub -UINT StDisableSecureNAT(ADMIN *a, RPC_HUB *t) -{ - SERVER *s = a->Server; - CEDAR *c = s->Cedar; - HUB *h; - - CHECK_RIGHT; - - - LockHubList(c); - { - h = GetHub(c, t->HubName); - } - UnlockHubList(c); - - if (h == NULL) - { - return ERR_HUB_NOT_FOUND; - } - - if (h->Type == HUB_TYPE_FARM_STATIC || GetServerCapsBool(s, "b_support_securenat") == false) - { - ReleaseHub(h); - return ERR_NOT_SUPPORTED; - } - if (s->ServerType == SERVER_TYPE_FARM_MEMBER) - { - ReleaseHub(h); - return ERR_NOT_FARM_CONTROLLER; - } - - if (a->ServerAdmin == false && GetHubAdminOption(h, "no_securenat") != 0) - { - ReleaseHub(h); - return ERR_NOT_ENOUGH_RIGHT; - } - - ALog(a, h, "LA_DISABLE_SNAT"); - - EnableSecureNAT(h, false); - - h->CurrentVersion++; - SiHubUpdateProc(h); - - IncrementServerConfigRevision(s); - - ReleaseHub(h); - - return ERR_NO_ERROR; -} - -// Enumerate NAT entries of the SecureNAT -UINT StEnumNAT(ADMIN *a, RPC_ENUM_NAT *t) -{ - SERVER *s = a->Server; - CEDAR *c = s->Cedar; - HUB *h; - UINT ret = ERR_NO_ERROR; - char hubname[MAX_HUBNAME_LEN + 1]; - UINT i; - - CHECK_RIGHT; - - StrCpy(hubname, sizeof(hubname), t->HubName); - - LockHubList(c); - { - h = GetHub(c, t->HubName); - } - UnlockHubList(c); - - if (h == NULL) - { - return ERR_HUB_NOT_FOUND; - } - - if (h->Type == HUB_TYPE_FARM_STATIC || GetServerCapsBool(s, "b_support_securenat") == false) - { - ReleaseHub(h); - return ERR_NOT_SUPPORTED; - } - - Lock(h->lock_online); - { - if (h->SecureNAT == NULL) - { - ret = ERR_SNAT_NOT_RUNNING; - } - else - { - NtEnumNatList(h->SecureNAT->Nat, t); - } - } - Unlock(h->lock_online); - - if (h->Type == HUB_TYPE_FARM_DYNAMIC) - { - if (ret == ERR_SNAT_NOT_RUNNING) - { - // Get status of remote SecureNAT - LockList(s->FarmMemberList); - { - for (i = 0;i < LIST_NUM(s->FarmMemberList);i++) - { - FARM_MEMBER *f = LIST_DATA(s->FarmMemberList, i); - if (f->Me == false) - { - RPC_ENUM_NAT tmp; - - Zero(&tmp, sizeof(tmp)); - - SiCallEnumNat(s, f, hubname, &tmp); - - if (tmp.NumItem >= 1) - { - FreeRpcEnumNat(t); - Copy(t, &tmp, sizeof(RPC_ENUM_NAT)); - ret = ERR_NO_ERROR; - break; - } - else - { - FreeRpcEnumNat(&tmp); - } - } - } - } - UnlockList(s->FarmMemberList); - } - } - - ReleaseHub(h); - - ret = ERR_NO_ERROR; - - return ret; -} - -// Get status of the SecureNAT -UINT StGetSecureNATStatus(ADMIN *a, RPC_NAT_STATUS *t) -{ - SERVER *s = a->Server; - CEDAR *c = s->Cedar; - HUB *h; - UINT ret = ERR_NO_ERROR; - char hubname[MAX_HUBNAME_LEN + 1]; - UINT i; - - CHECK_RIGHT; - - StrCpy(hubname, sizeof(hubname), t->HubName); - - LockHubList(c); - { - h = GetHub(c, t->HubName); - } - UnlockHubList(c); - - if (h == NULL) - { - return ERR_HUB_NOT_FOUND; - } - - if (h->Type == HUB_TYPE_FARM_STATIC || GetServerCapsBool(s, "b_support_securenat") == false) - { - ReleaseHub(h); - return ERR_NOT_SUPPORTED; - } - - Lock(h->lock_online); - { - if (h->SecureNAT == NULL) - { - ret = ERR_SNAT_NOT_RUNNING; - } - else - { - NtGetStatus(h->SecureNAT->Nat, t); - } - } - Unlock(h->lock_online); - - if (h->Type == HUB_TYPE_FARM_DYNAMIC) - { - if (ret == ERR_SNAT_NOT_RUNNING) - { - // Get status of remote secureNAT - LockList(s->FarmMemberList); - { - for (i = 0;i < LIST_NUM(s->FarmMemberList);i++) - { - FARM_MEMBER *f = LIST_DATA(s->FarmMemberList, i); - if (f->Me == false) - { - RPC_NAT_STATUS tmp; - - Zero(&tmp, sizeof(tmp)); - - SiCallGetNatStatus(s, f, hubname, &tmp); - - if (tmp.NumDhcpClients == 0 && tmp.NumTcpSessions == 0 && tmp.NumUdpSessions == 0) - { - } - else - { - Copy(t, &tmp, sizeof(RPC_NAT_STATUS)); - ret = ERR_NO_ERROR; - break; - } - } - } - } - UnlockList(s->FarmMemberList); - } - } - - ReleaseHub(h); - - StrCpy(t->HubName, sizeof(t->HubName), hubname); - ret = ERR_NO_ERROR; - - return ret; -} - -// Enumerate DHCP entries -UINT StEnumDHCP(ADMIN *a, RPC_ENUM_DHCP *t) -{ - SERVER *s = a->Server; - CEDAR *c = s->Cedar; - HUB *h; - UINT ret = ERR_NO_ERROR; - char hubname[MAX_HUBNAME_LEN + 1]; - UINT i; - StrCpy(hubname, sizeof(hubname), t->HubName); - - CHECK_RIGHT; - - LockHubList(c); - { - h = GetHub(c, t->HubName); - } - UnlockHubList(c); - - if (h == NULL) - { - return ERR_HUB_NOT_FOUND; - } - - if (h->Type == HUB_TYPE_FARM_STATIC || GetServerCapsBool(s, "b_support_securenat") == false) - { - ReleaseHub(h); - return ERR_NOT_SUPPORTED; - } - - Lock(h->lock_online); - { - if (h->SecureNAT == NULL) - { - ret = ERR_SNAT_NOT_RUNNING; - } - else - { - NtEnumDhcpList(h->SecureNAT->Nat, t); - } - } - Unlock(h->lock_online); - - if (h->Type == HUB_TYPE_FARM_DYNAMIC) - { - if (ret == ERR_SNAT_NOT_RUNNING) - { - // Get status of remote DHCP service - LockList(s->FarmMemberList); - { - for (i = 0;i < LIST_NUM(s->FarmMemberList);i++) - { - FARM_MEMBER *f = LIST_DATA(s->FarmMemberList, i); - if (f->Me == false) - { - RPC_ENUM_DHCP tmp; - - Zero(&tmp, sizeof(tmp)); - - SiCallEnumDhcp(s, f, hubname, &tmp); - - if (tmp.NumItem >= 1) - { - FreeRpcEnumDhcp(t); - Copy(t, &tmp, sizeof(RPC_ENUM_DHCP)); - ret = ERR_NO_ERROR; - break; - } - else - { - FreeRpcEnumDhcp(&tmp); - } - } - } - } - UnlockList(s->FarmMemberList); - } - } - - ReleaseHub(h); - - ret = ERR_NO_ERROR; - - return ret; -} - -// Set SecureNAT options -UINT StSetSecureNATOption(ADMIN *a, VH_OPTION *t) -{ - SERVER *s = a->Server; - CEDAR *c = s->Cedar; - HUB *h; - char push_routes_str_old[MAX_DHCP_CLASSLESS_ROUTE_TABLE_STR_SIZE]; - - - if (IsZero(t->MacAddress, sizeof(t->MacAddress)) || - IsHostIPAddress4(&t->Ip) == false || - IsSubnetMask4(&t->Mask) == false) - { - return ERR_INVALID_PARAMETER; - } - if ((IPToUINT(&t->Ip) & (~(IPToUINT(&t->Mask)))) == 0) - { - return ERR_INVALID_PARAMETER; - } - if (GetServerCapsBool(s, "b_support_securenat") == false) - { - t->ApplyDhcpPushRoutes = false; - } - if (t->ApplyDhcpPushRoutes) - { - if (NormalizeClasslessRouteTableStr(t->DhcpPushRoutes, sizeof(t->DhcpPushRoutes), t->DhcpPushRoutes) == false) - { - return ERR_INVALID_PARAMETER; - } - } - - CHECK_RIGHT; - - LockHubList(c); - { - h = GetHub(c, t->HubName); - } - UnlockHubList(c); - - if (h == NULL) - { - return ERR_HUB_NOT_FOUND; - } - - if (h->Type == HUB_TYPE_FARM_STATIC || GetServerCapsBool(s, "b_support_securenat") == false) - { - ReleaseHub(h); - return ERR_NOT_SUPPORTED; - } - if (s->ServerType == SERVER_TYPE_FARM_MEMBER) - { - ReleaseHub(h); - return ERR_NOT_FARM_CONTROLLER; - } - - if (a->ServerAdmin == false && GetHubAdminOption(h, "no_securenat") != 0) - { - ReleaseHub(h); - return ERR_NOT_ENOUGH_RIGHT; - } - - if (h->SecureNATOption->UseNat == false && t->UseNat) - { - if (a->ServerAdmin == false && GetHubAdminOption(h, "no_securenat_enablenat") != 0) - { - ReleaseHub(h); - return ERR_NOT_ENOUGH_RIGHT; - } - } - - if (h->SecureNATOption->UseDhcp == false && t->UseDhcp) - { - if (a->ServerAdmin == false && GetHubAdminOption(h, "no_securenat_enabledhcp") != 0) - { - ReleaseHub(h); - return ERR_NOT_ENOUGH_RIGHT; - } - } - - StrCpy(push_routes_str_old, sizeof(push_routes_str_old), h->SecureNATOption->DhcpPushRoutes); - Copy(h->SecureNATOption, t, sizeof(VH_OPTION)); - if (t->ApplyDhcpPushRoutes == false) - { - StrCpy(h->SecureNATOption->DhcpPushRoutes, sizeof(h->SecureNATOption->DhcpPushRoutes), push_routes_str_old); - } - - if (h->Type != HUB_TYPE_STANDALONE && h->Cedar != NULL && h->Cedar->Server != NULL && - h->Cedar->Server->ServerType == SERVER_TYPE_FARM_CONTROLLER) - { - NiClearUnsupportedVhOptionForDynamicHub(h->SecureNATOption, false); - } - - Lock(h->lock_online); - { - if (h->SecureNAT != NULL) - { - SetVirtualHostOption(h->SecureNAT->Nat->Virtual, t); - } - } - Unlock(h->lock_online); - - ALog(a, h, "LA_SET_SNAT_OPTION"); - - h->CurrentVersion++; - SiHubUpdateProc(h); - - IncrementServerConfigRevision(s); - - ReleaseHub(h); - - return ERR_NO_ERROR; -} - -// Get SecureNAT options -UINT StGetSecureNATOption(ADMIN *a, VH_OPTION *t) -{ - SERVER *s = a->Server; - CEDAR *c = s->Cedar; - HUB *h; - char hubname[MAX_HUBNAME_LEN + 1]; - - StrCpy(hubname, sizeof(hubname), t->HubName); - - CHECK_RIGHT; - - LockHubList(c); - { - h = GetHub(c, t->HubName); - } - UnlockHubList(c); - - if (h == NULL) - { - return ERR_HUB_NOT_FOUND; - } - - if (h->Type == HUB_TYPE_FARM_STATIC || GetServerCapsBool(s, "b_support_securenat") == false) - { - ReleaseHub(h); - return ERR_NOT_SUPPORTED; - } - if (s->ServerType == SERVER_TYPE_FARM_MEMBER) - { - ReleaseHub(h); - return ERR_NOT_FARM_CONTROLLER; - } - - Zero(t, sizeof(VH_OPTION)); - Copy(t, h->SecureNATOption, sizeof(VH_OPTION)); - StrCpy(t->HubName, sizeof(t->HubName), h->Name); - t->ApplyDhcpPushRoutes = true; - - ReleaseHub(h); - - return ERR_NO_ERROR; -} - -// Make a hub on-line or off-line -UINT StSetHubOnline(ADMIN *a, RPC_SET_HUB_ONLINE *t) -{ - SERVER *s = a->Server; - CEDAR *c = s->Cedar; - HUB *h; - - if (s->ServerType == SERVER_TYPE_FARM_MEMBER) - { - return ERR_NOT_FARM_CONTROLLER; - } - - - NO_SUPPORT_FOR_BRIDGE; - - CHECK_RIGHT; - - LockHubList(c); - { - h = GetHub(c, t->HubName); - } - UnlockHubList(c); - - if (h == NULL) - { - return ERR_HUB_NOT_FOUND; - } - - if (a->ServerAdmin == false && t->Online && GetHubAdminOption(h, "no_online") != 0) - { - ReleaseHub(h); - return ERR_NOT_ENOUGH_RIGHT; - } - - if (a->ServerAdmin == false && t->Online == false && GetHubAdminOption(h, "no_offline") != 0) - { - ReleaseHub(h); - return ERR_NOT_ENOUGH_RIGHT; - } - - if (t->Online) - { - ALog(a, h, "LA_SET_HUB_ONLINE"); - SetHubOnline(h); - } - else - { - ALog(a, h, "LA_SET_HUB_OFFLINE"); - SetHubOffline(h); - } - - h->CurrentVersion++; - SiHubUpdateProc(h); - - IncrementServerConfigRevision(s); - - ReleaseHub(h); - - return ERR_NO_ERROR; -} - -// Get connection information -UINT StGetConnectionInfo(ADMIN *a, RPC_CONNECTION_INFO *t) -{ - SERVER *s = a->Server; - CEDAR *c = s->Cedar; - CONNECTION *connection; - char name[MAX_CONNECTION_NAME_LEN + 1]; - - if (IsEmptyStr(t->Name)) - { - return ERR_INVALID_PARAMETER; - } - - SERVER_ADMIN_ONLY; - - LockList(c->ConnectionList); - { - CONNECTION tt; - Zero(&tt, sizeof(tt)); - tt.Name = t->Name; - StrCpy(name, sizeof(name), t->Name); - - connection = Search(c->ConnectionList, &tt); - - if (connection != NULL) - { - AddRef(connection->ref); - } - } - UnlockList(c->ConnectionList); - - if (connection == NULL) - { - return ERR_OBJECT_NOT_FOUND; - } - - Zero(t, sizeof(RPC_CONNECTION_INFO)); - StrCpy(t->Name, sizeof(t->Name), name); - - Lock(connection->lock); - { - SOCK *s = connection->FirstSock; - - if (s != NULL) - { - t->Ip = IPToUINT(&s->RemoteIP); - t->Port = s->RemotePort; - StrCpy(t->Hostname, sizeof(t->Hostname), s->RemoteHostname); - } - - StrCpy(t->Name, sizeof(t->Name), connection->Name); - t->ConnectedTime = TickToTime(connection->ConnectedTick); - t->Type = connection->Type; - - StrCpy(t->ServerStr, sizeof(t->ServerStr), connection->ServerStr); - StrCpy(t->ClientStr, sizeof(t->ClientStr), connection->ClientStr); - t->ServerVer = connection->ServerVer; - t->ServerBuild = connection->ServerBuild; - t->ClientVer = connection->ClientVer; - t->ClientBuild = connection->ClientBuild; - } - Unlock(connection->lock); - - ReleaseConnection(connection); - - return ERR_NO_ERROR; -} - -// Disconnect a connection -UINT StDisconnectConnection(ADMIN *a, RPC_DISCONNECT_CONNECTION *t) -{ - SERVER *s = a->Server; - CEDAR *c = s->Cedar; - CONNECTION *connection; - - if (IsEmptyStr(t->Name)) - { - return ERR_INVALID_PARAMETER; - } - - SERVER_ADMIN_ONLY; - - LockList(c->ConnectionList); - { - CONNECTION tt; - Zero(&tt, sizeof(tt)); - tt.Name = t->Name; - - connection = Search(c->ConnectionList, &tt); - if (connection != NULL) - { - AddRef(connection->ref); - } - } - UnlockList(c->ConnectionList); - - if (connection == NULL) - { - return ERR_OBJECT_NOT_FOUND; - } - - StopConnection(connection, true); - - ReleaseConnection(connection); - - ALog(a, NULL, "LA_DISCONNECT_CONN", t->Name); - - return ERR_NO_ERROR; -} - -// Enumerate connections -UINT StEnumConnection(ADMIN *a, RPC_ENUM_CONNECTION *t) -{ - SERVER *s = a->Server; - CEDAR *c = s->Cedar; - - SERVER_ADMIN_ONLY; - - FreeRpcEnumConnection(t); - Zero(t, sizeof(RPC_ENUM_CONNECTION)); - - LockList(c->ConnectionList); - { - UINT i; - t->NumConnection = LIST_NUM(c->ConnectionList); - t->Connections = ZeroMalloc(sizeof(RPC_ENUM_CONNECTION_ITEM) * t->NumConnection); - - for (i = 0;i < t->NumConnection;i++) - { - RPC_ENUM_CONNECTION_ITEM *e = &t->Connections[i]; - CONNECTION *connection = LIST_DATA(c->ConnectionList, i); - - Lock(connection->lock); - { - SOCK *s = connection->FirstSock; - - if (s != NULL) - { - e->Ip = IPToUINT(&s->RemoteIP); - e->Port = s->RemotePort; - StrCpy(e->Hostname, sizeof(e->Hostname), s->RemoteHostname); - } - - StrCpy(e->Name, sizeof(e->Name), connection->Name); - e->ConnectedTime = TickToTime(connection->ConnectedTick); - e->Type = connection->Type; - } - Unlock(connection->lock); - } - } - UnlockList(c->ConnectionList); - - return ERR_NO_ERROR; -} - -// Set Radius options of the hub -UINT StSetHubRadius(ADMIN *a, RPC_RADIUS *t) -{ - SERVER *s = a->Server; - CEDAR *c = s->Cedar; - HUB *h = NULL; - - NO_SUPPORT_FOR_BRIDGE; - - if (s->ServerType == SERVER_TYPE_FARM_MEMBER) - { - return ERR_NOT_SUPPORTED; - } - - if (GetGlobalServerFlag(GSF_DISABLE_RADIUS_AUTH) != 0 && IsEmptyStr(t->RadiusServerName) == false) - { - return ERR_NOT_SUPPORTED_FUNCTION_ON_OPENSOURCE; - } - - CHECK_RIGHT; - - LockHubList(c); - { - h = GetHub(c, t->HubName); - } - UnlockHubList(c); - - if (h == NULL) - { - return ERR_HUB_NOT_FOUND; - } - - //SetRadiusServer(h, t->RadiusServerName, t->RadiusPort, t->RadiusSecret); - SetRadiusServerEx(h, t->RadiusServerName, t->RadiusPort, t->RadiusSecret, t->RadiusRetryInterval); - - ALog(a, h, "LA_SET_HUB_RADIUS"); - - ReleaseHub(h); - - IncrementServerConfigRevision(s); - - return ERR_NO_ERROR; -} - -// Get Radius options of the hub -UINT StGetHubRadius(ADMIN *a, RPC_RADIUS *t) -{ - SERVER *s = a->Server; - CEDAR *c = s->Cedar; - HUB *h = NULL; - - CHECK_RIGHT; - - if (s->ServerType == SERVER_TYPE_FARM_MEMBER) - { - return ERR_NOT_SUPPORTED; - } - - LockHubList(c); - { - h = GetHub(c, t->HubName); - } - UnlockHubList(c); - - if (h == NULL) - { - return ERR_HUB_NOT_FOUND; - } - - Zero(t, sizeof(RPC_RADIUS)); - //GetRadiusServer(h, t->RadiusServerName, sizeof(t->RadiusServerName), - // &t->RadiusPort, t->RadiusSecret, sizeof(t->RadiusSecret)); - GetRadiusServerEx(h, t->RadiusServerName, sizeof(t->RadiusServerName), - &t->RadiusPort, t->RadiusSecret, sizeof(t->RadiusSecret), &t->RadiusRetryInterval); - - ReleaseHub(h); - - return ERR_NO_ERROR; -} - -// Delete a hub -UINT StDeleteHub(ADMIN *a, RPC_DELETE_HUB *t) -{ - SERVER *s = a->Server; - CEDAR *c = s->Cedar; - HUB *h = NULL; - - if (s->ServerType == SERVER_TYPE_FARM_MEMBER) - { - return ERR_NOT_FARM_CONTROLLER; - } - - - if (IsEmptyStr(t->HubName) || IsSafeStr(t->HubName) == false) - { - return ERR_INVALID_PARAMETER; - } - - NO_SUPPORT_FOR_BRIDGE; - - SERVER_ADMIN_ONLY; - - LockHubList(c); - { - h = GetHub(c, t->HubName); - } - UnlockHubList(c); - - if (h == NULL) - { - return ERR_HUB_NOT_FOUND; - } - - StopHub(h); - - IncrementServerConfigRevision(s); - - DelHub(c, h); - ReleaseHub(h); - - ALog(a, NULL, "LA_DELETE_HUB", t->HubName); - - return ERR_NO_ERROR; -} - -// Enumerate hubs -UINT StEnumHub(ADMIN *a, RPC_ENUM_HUB *t) -{ - SERVER *s = a->Server; - CEDAR *c = s->Cedar; - HUB *h = NULL; - - FreeRpcEnumHub(t); - - Zero(t, sizeof(RPC_ENUM_HUB)); - - LockHubList(c); - { - UINT i, num, j; - - num = 0; - - for (i = 0;i < LIST_NUM(c->HubList);i++) - { - HUB *h = LIST_DATA(c->HubList, i); - - Lock(h->lock); - - if (a->ServerAdmin == false && - h->Option != NULL && - StrCmpi(h->Name, a->HubName) != 0) - { - // This hub is not listed - } - else - { - // This hub is listed - num++; - } - } - - t->NumHub = num; - - t->Hubs = ZeroMalloc(sizeof(RPC_ENUM_HUB_ITEM) * num); - - i = 0; - for (j = 0;j < LIST_NUM(c->HubList);j++) - { - HUB *h = LIST_DATA(c->HubList, j); - - if (a->ServerAdmin == false && - h->Option != NULL && - StrCmpi(h->Name, a->HubName) != 0) - { - // This hub is not listed - } - else - { - // This hub is listed - RPC_ENUM_HUB_ITEM *e = &t->Hubs[i++]; - - StrCpy(e->HubName, sizeof(e->HubName), h->Name); - e->Online = h->Offline ? false : true; - e->HubType = h->Type; - - e->NumSessions = LIST_NUM(h->SessionList); - - LockHashList(h->MacHashTable); - { - e->NumMacTables = HASH_LIST_NUM(h->MacHashTable); - } - UnlockHashList(h->MacHashTable); - - LockList(h->IpTable); - { - e->NumIpTables = LIST_NUM(h->IpTable); - } - UnlockList(h->IpTable); - - if (h->HubDb != NULL) - { - LockList(h->HubDb->UserList); - { - e->NumUsers = LIST_NUM(h->HubDb->UserList); - } - UnlockList(h->HubDb->UserList); - - LockList(h->HubDb->GroupList); - { - e->NumGroups = LIST_NUM(h->HubDb->GroupList); - } - UnlockList(h->HubDb->GroupList); - } - - e->LastCommTime = h->LastCommTime; - e->LastLoginTime = h->LastLoginTime; - e->NumLogin = h->NumLogin; - e->CreatedTime = h->CreatedTime; - - Lock(h->TrafficLock); - { - Copy(&e->Traffic, h->Traffic, sizeof(TRAFFIC)); - } - Unlock(h->TrafficLock); - - e->IsTrafficFilled = true; - } - - Unlock(h->lock); - } - } - UnlockHubList(c); - - if (s->ServerType == SERVER_TYPE_FARM_CONTROLLER) - { - UINT i, j, k; - LockList(s->FarmMemberList); - { - for (i = 0;i < LIST_NUM(s->FarmMemberList);i++) - { - FARM_MEMBER *f = LIST_DATA(s->FarmMemberList, i); - - LockList(f->HubList); - { - if (f->Me == false) - { - for (j = 0;j < LIST_NUM(f->HubList);j++) - { - HUB_LIST *o = LIST_DATA(f->HubList, j); - - for (k = 0;k < t->NumHub;k++) - { - RPC_ENUM_HUB_ITEM *e = &t->Hubs[k]; - - if (StrCmpi(e->HubName, o->Name) == 0) - { - e->NumIpTables += o->NumIpTables; - e->NumMacTables += o->NumMacTables; - e->NumSessions += o->NumSessions; - } - } - } - } - } - UnlockList(f->HubList); - } - } - UnlockList(s->FarmMemberList); - } - - return ERR_NO_ERROR; -} - -// Get hub configuration -UINT StGetHub(ADMIN *a, RPC_CREATE_HUB *t) -{ - SERVER *s = a->Server; - CEDAR *c = s->Cedar; - UINT ret = ERR_NO_ERROR; - HUB *h; - - if (s->ServerType == SERVER_TYPE_FARM_MEMBER) - { - return ERR_NOT_FARM_CONTROLLER; - } - - if (IsEmptyStr(t->HubName) || IsSafeStr(t->HubName) == false) - { - return ERR_INVALID_PARAMETER; - } - - if (s->ServerType == SERVER_TYPE_FARM_MEMBER) - { - return ERR_NOT_FARM_CONTROLLER; - } - - NO_SUPPORT_FOR_BRIDGE; - CHECK_RIGHT; - - LockHubList(c); - { - h = GetHub(c, t->HubName); - } - UnlockHubList(c); - - Zero(t, sizeof(RPC_CREATE_HUB)); - - if (h == NULL) - { - return ERR_HUB_NOT_FOUND; - } - - Lock(h->lock); - { - StrCpy(t->HubName, sizeof(t->HubName), h->Name); - t->Online = h->Offline ? false : true; - t->HubOption.MaxSession = h->Option->MaxSession; - t->HubOption.NoEnum = h->Option->NoEnum; - t->HubType = h->Type; - } - Unlock(h->lock); - - ReleaseHub(h); - - return ret; -} - -// Set hub configuration -UINT StSetHub(ADMIN *a, RPC_CREATE_HUB *t) -{ - SERVER *s = a->Server; - CEDAR *c = s->Cedar; - HUB *h; - UINT ret = ERR_NO_ERROR; - - if (s->ServerType == SERVER_TYPE_FARM_MEMBER) - { - return ERR_NOT_FARM_CONTROLLER; - } - - if (IsEmptyStr(t->HubName) || IsSafeStr(t->HubName) == false) - { - return ERR_INVALID_PARAMETER; - } - - - CHECK_RIGHT; - NO_SUPPORT_FOR_BRIDGE; - - if (s->ServerType == SERVER_TYPE_FARM_MEMBER) - { - return ERR_NOT_FARM_CONTROLLER; - } - - if (s->ServerType == SERVER_TYPE_STANDALONE) - { - if (t->HubType != HUB_TYPE_STANDALONE) - { - return ERR_INVALID_PARAMETER; - } - } - - if (s->ServerType == SERVER_TYPE_FARM_CONTROLLER) - { - if (t->HubType == HUB_TYPE_STANDALONE) - { - return ERR_INVALID_PARAMETER; - } - } - - LockHubList(c); - { - h = GetHub(c, t->HubName); - } - UnlockHubList(c); - - if (h == NULL) - { - return ERR_HUB_NOT_FOUND; - } - - if (h->Type != t->HubType) - { - ReleaseHub(h); - return ERR_NOT_SUPPORTED; - } - - // For JSON-RPC - if (StrLen(t->AdminPasswordPlainText) != 0) - { - Sha0(t->HashedPassword, t->AdminPasswordPlainText, StrLen(t->AdminPasswordPlainText)); - HashPassword(t->SecurePassword, ADMINISTRATOR_USERNAME, t->AdminPasswordPlainText); - } - - if (IsZero(t->HashedPassword, sizeof(t->HashedPassword)) == false && - IsZero(t->SecurePassword, sizeof(t->SecurePassword)) == false) - { - if (a->ServerAdmin == false && GetHubAdminOption(h, "no_change_admin_password") != 0) - { - ReleaseHub(h); - return ERR_NOT_ENOUGH_RIGHT; - } - } - - // Is the password to be set blank - { - UCHAR hash1[SHA1_SIZE], hash2[SHA1_SIZE]; - HashPassword(hash1, ADMINISTRATOR_USERNAME, ""); - Sha0(hash2, "", 0); - - if (Cmp(t->HashedPassword, hash2, SHA1_SIZE) == 0 || Cmp(t->SecurePassword, hash1, SHA1_SIZE) == 0) - { - if (a->ServerAdmin == false && a->Rpc->Sock->RemoteIP.addr[0] != 127) - { - // Refuse to set a blank password to hub admin from remote host - ReleaseHub(h); - return ERR_INVALID_PARAMETER; - } - } - } - - Lock(h->lock); - { - if (a->ServerAdmin == false && h->Type != t->HubType) - { - ret = ERR_NOT_ENOUGH_RIGHT; - } - else - { - h->Type = t->HubType; - h->Option->MaxSession = t->HubOption.MaxSession; - h->Option->NoEnum = t->HubOption.NoEnum; - if (IsZero(t->HashedPassword, sizeof(t->HashedPassword)) == false && - IsZero(t->SecurePassword, sizeof(t->SecurePassword)) == false) - { - Copy(h->HashedPassword, t->HashedPassword, SHA1_SIZE); - Copy(h->SecurePassword, t->SecurePassword, SHA1_SIZE); - } - } - } - Unlock(h->lock); - - if (t->Online) - { - if (a->ServerAdmin || GetHubAdminOption(h, "no_online") == 0) - { - SetHubOnline(h); - } - } - else - { - if (a->ServerAdmin || GetHubAdminOption(h, "no_offline") == 0) - { - SetHubOffline(h); - } - } - - if (h->Type == HUB_TYPE_FARM_STATIC) - { - EnableSecureNAT(h, false); - } - - h->CurrentVersion++; - SiHubUpdateProc(h); - - IncrementServerConfigRevision(s); - - ALog(a, h, "LA_SET_HUB"); - - ReleaseHub(h); - - return ret; -} - -// Create a hub -UINT StCreateHub(ADMIN *a, RPC_CREATE_HUB *t) -{ - SERVER *s = a->Server; - CEDAR *c = s->Cedar; - HUB *h; - HUB_OPTION o; - UINT current_hub_num; - bool b; - - if (s->ServerType == SERVER_TYPE_FARM_MEMBER) - { - return ERR_NOT_FARM_CONTROLLER; - } - - - - if (IsEmptyStr(t->HubName) || IsSafeStr(t->HubName) == false) - { - return ERR_INVALID_PARAMETER; - } - - NO_SUPPORT_FOR_BRIDGE; - - if (s->ServerType == SERVER_TYPE_FARM_MEMBER) - { - return ERR_NOT_FARM_CONTROLLER; - } - - SERVER_ADMIN_ONLY; - - Trim(t->HubName); - if (StrLen(t->HubName) == 0) - { - return ERR_INVALID_PARAMETER; - } - if (StartWith(t->HubName, ".") || EndWith(t->HubName, ".")) - { - return ERR_INVALID_PARAMETER; - } - - if (s->ServerType == SERVER_TYPE_FARM_MEMBER) - { - return ERR_NOT_FARM_CONTROLLER; - } - - if (s->ServerType == SERVER_TYPE_STANDALONE) - { - if (t->HubType != HUB_TYPE_STANDALONE) - { - return ERR_INVALID_PARAMETER; - } - } - else if (t->HubType != HUB_TYPE_FARM_DYNAMIC && t->HubType != HUB_TYPE_FARM_STATIC) - { - return ERR_INVALID_PARAMETER; - } - - // Create a hub object - Zero(&o, sizeof(o)); - o.MaxSession = t->HubOption.MaxSession; - o.NoEnum = t->HubOption.NoEnum; - - // Default setting for hub admin options - SiSetDefaultHubOption(&o); - - LockList(c->HubList); - { - current_hub_num = LIST_NUM(c->HubList); - } - UnlockList(c->HubList); - - if (current_hub_num > GetServerCapsInt(a->Server, "i_max_hubs")) - { - return ERR_TOO_MANY_HUBS; - } - - LockList(c->HubList); - { - b = IsHub(c, t->HubName); - } - UnlockList(c->HubList); - - if (b) - { - return ERR_HUB_ALREADY_EXISTS; - } - - ALog(a, NULL, "LA_CREATE_HUB", t->HubName); - - // For JSON-RPC - if ((IsZero(t->HashedPassword, sizeof(t->HashedPassword)) && - IsZero(t->SecurePassword, sizeof(t->SecurePassword))) || - StrLen(t->AdminPasswordPlainText) != 0) - { - Sha0(t->HashedPassword, t->AdminPasswordPlainText, StrLen(t->AdminPasswordPlainText)); - HashPassword(t->SecurePassword, ADMINISTRATOR_USERNAME, t->AdminPasswordPlainText); - } - - h = NewHub(c, t->HubName, &o); - Copy(h->HashedPassword, t->HashedPassword, SHA1_SIZE); - Copy(h->SecurePassword, t->SecurePassword, SHA1_SIZE); - - h->Type = t->HubType; - - AddHub(c, h); - - if (t->Online) - { - h->Offline = true; - SetHubOnline(h); - } - else - { - h->Offline = false; - SetHubOffline(h); - } - - h->CreatedTime = SystemTime64(); - - ReleaseHub(h); - - IncrementServerConfigRevision(s); - - return ERR_NO_ERROR; -} - -// Set cipher for SSL to the server -UINT StSetServerCipher(ADMIN *a, RPC_STR *t) -{ - SERVER *s = a->Server; - CEDAR *c = s->Cedar; - - if (IsEmptyStr(t->String)) - { - return ERR_INVALID_PARAMETER; - } - - SERVER_ADMIN_ONLY; - - StrUpper(t->String); - - ALog(a, NULL, "LA_SET_SERVER_CIPHER", t->String); - - Lock(c->lock); - { - SetCedarCipherList(c, t->String); - } - Unlock(c->lock); - - IncrementServerConfigRevision(s); - - return ERR_NO_ERROR; -} - -// Get cipher for SSL -UINT StGetServerCipher(ADMIN *a, RPC_STR *t) -{ - SERVER *s = a->Server; - CEDAR *c = s->Cedar; - - FreeRpcStr(t); - Zero(t, sizeof(RPC_STR)); - - Lock(c->lock); - { - t->String = CopyStr(c->CipherList); - } - Unlock(c->lock); - - return ERR_NO_ERROR; -} - -// Get list of available ciphers for SSL -UINT StGetServerCipherList(ADMIN *a, RPC_STR *t) -{ - SERVER *s = a->Server; - CEDAR *c = s->Cedar; - - FreeRpcStr(t); - Zero(t, sizeof(RPC_STR)); - - Lock(c->lock); - { - UINT i; - TOKEN_LIST *ciphers = GetCipherList(); - if (ciphers->NumTokens > 0) - { - UINT size = StrSize(ciphers->Token[0]); - t->String = Malloc(size); - StrCpy(t->String, size, ciphers->Token[0]); - i = 1; - - for (; i < ciphers->NumTokens; i++) - { - // We use StrSize() because we need the extra space for ';' - size += StrSize(ciphers->Token[i]); - t->String = ReAlloc(t->String, size); - StrCat(t->String, size, ";"); - StrCat(t->String, size, ciphers->Token[i]); - } - } - - FreeToken(ciphers); - } - Unlock(c->lock); - - return ERR_NO_ERROR; -} - -// Get the server certification -UINT StGetServerCert(ADMIN *a, RPC_KEY_PAIR *t) -{ - bool admin; - SERVER *s = a->Server; - CEDAR *c = s->Cedar; - bool is_vgs_cert = false; - - admin = a->ServerAdmin; - - FreeRpcKeyPair(t); - Zero(t, sizeof(RPC_KEY_PAIR)); - - Lock(c->lock); - { - - t->Cert = CloneX(c->ServerX); - if (admin && is_vgs_cert == false) - { - t->Key = CloneK(c->ServerK); - } - } - Unlock(c->lock); - - return ERR_NO_ERROR; -} - -// Set the server certification -UINT StSetServerCert(ADMIN *a, RPC_KEY_PAIR *t) -{ - SERVER *s = a->Server; - CEDAR *c = s->Cedar; - - SERVER_ADMIN_ONLY; - - if (t->Cert == NULL || t->Key == NULL) - { - return ERR_PROTOCOL_ERROR; - } - - if (t->Cert->is_compatible_bit == false) - { - return ERR_NOT_RSA_1024; - } - - if (CheckXandK(t->Cert, t->Key) == false) - { - return ERR_PROTOCOL_ERROR; - } - - t->Flag1 = 1; - if (t->Cert->root_cert == false) - { - if (DownloadAndSaveIntermediateCertificatesIfNecessary(t->Cert) == false) - { - t->Flag1 = 0; - } - } - - SetCedarCert(c, t->Cert, t->Key); - - ALog(a, NULL, "LA_SET_SERVER_CERT"); - - IncrementServerConfigRevision(s); - - return ERR_NO_ERROR; -} - -// Get status of connection to cluster controller -UINT StGetFarmConnectionStatus(ADMIN *a, RPC_FARM_CONNECTION_STATUS *t) -{ - SERVER *s = a->Server; - CEDAR *c = s->Cedar; - FARM_CONTROLLER *fc; - - if (s->ServerType != SERVER_TYPE_FARM_MEMBER) - { - return ERR_NOT_FARM_MEMBER; - } - - Zero(t, sizeof(RPC_FARM_CONNECTION_STATUS)); - - fc = s->FarmController; - - Lock(fc->lock); - { - if (fc->Sock != NULL) - { - t->Ip = IPToUINT(&fc->Sock->RemoteIP); - t->Port = fc->Sock->RemotePort; - } - - t->Online = fc->Online; - t->LastError = ERR_NO_ERROR; - - if (t->Online == false) - { - t->LastError = fc->LastError; - } - else - { - t->CurrentConnectedTime = fc->CurrentConnectedTime; - } - - t->StartedTime = fc->StartedTime; - t->FirstConnectedTime = fc->FirstConnectedTime; - - t->NumConnected = fc->NumConnected; - t->NumTry = fc->NumTry; - t->NumFailed = fc->NumFailed; - } - Unlock(fc->lock); - - return ERR_NO_ERROR; -} - -// Enumerate cluster members -UINT StEnumFarmMember(ADMIN *a, RPC_ENUM_FARM *t) -{ - SERVER *s = a->Server; - CEDAR *c = s->Cedar; - UINT i; - - FreeRpcEnumFarm(t); - Zero(t, sizeof(RPC_ENUM_FARM)); - - if (s->ServerType != SERVER_TYPE_FARM_CONTROLLER) - { - return ERR_NOT_FARM_CONTROLLER; - } - - Zero(t, sizeof(RPC_ENUM_FARM)); - - LockList(s->FarmMemberList); - { - t->NumFarm = LIST_NUM(s->FarmMemberList); - t->Farms = ZeroMalloc(sizeof(RPC_ENUM_FARM_ITEM) * t->NumFarm); - - for (i = 0;i < t->NumFarm;i++) - { - FARM_MEMBER *f = LIST_DATA(s->FarmMemberList, i); - RPC_ENUM_FARM_ITEM *e = &t->Farms[i]; - - e->Id = POINTER_TO_KEY(f); - e->Controller = f->Me; - - if (e->Controller) - { - e->ConnectedTime = TickToTime(c->CreatedTick); - e->Ip = 0x0100007f; - GetMachineName(e->Hostname, sizeof(e->Hostname)); - e->Point = f->Point; - e->NumSessions = Count(c->CurrentSessions); - e->NumTcpConnections = Count(c->CurrentTcpConnections); - - e->AssignedBridgeLicense = Count(c->AssignedBridgeLicense); - e->AssignedClientLicense = Count(c->AssignedClientLicense); - } - else - { - e->ConnectedTime = f->ConnectedTime; - e->Ip = f->Ip; - StrCpy(e->Hostname, sizeof(e->Hostname), f->hostname); - e->Point = f->Point; - e->NumSessions = f->NumSessions; - e->NumTcpConnections = f->NumTcpConnections; - - e->AssignedBridgeLicense = f->AssignedBridgeLicense; - e->AssignedClientLicense = f->AssignedClientLicense; - } - e->NumHubs = LIST_NUM(f->HubList); - } - } - UnlockList(s->FarmMemberList); - - return ERR_NO_ERROR; -} - -// Get cluster member information -UINT StGetFarmInfo(ADMIN *a, RPC_FARM_INFO *t) -{ - SERVER *s = a->Server; - UINT id = t->Id; - UINT i; - UINT ret = ERR_NO_ERROR; - - FreeRpcFarmInfo(t); - Zero(t, sizeof(RPC_FARM_INFO)); - - if (s->ServerType != SERVER_TYPE_FARM_CONTROLLER) - { - return ERR_NOT_FARM_CONTROLLER; - } - - LockList(s->FarmMemberList); - { - if (IsInListKey(s->FarmMemberList, id)) - { - FARM_MEMBER *f = ListKeyToPointer(s->FarmMemberList, id); - - t->Id = id; - t->Controller = f->Me; - t->Weight = f->Weight; - - LockList(f->HubList); - { - t->NumFarmHub = LIST_NUM(f->HubList); - t->FarmHubs = ZeroMalloc(sizeof(RPC_FARM_HUB) * t->NumFarmHub); - - for (i = 0;i < t->NumFarmHub;i++) - { - RPC_FARM_HUB *h = &t->FarmHubs[i]; - HUB_LIST *hh = LIST_DATA(f->HubList, i); - - h->DynamicHub = hh->DynamicHub; - StrCpy(h->HubName, sizeof(h->HubName), hh->Name); - } - } - UnlockList(f->HubList); - - if (t->Controller) - { - t->ConnectedTime = TickToTime(s->Cedar->CreatedTick); - t->Ip = 0x0100007f; - GetMachineName(t->Hostname, sizeof(t->Hostname)); - t->Point = f->Point; - - LockList(s->ServerListenerList); - { - UINT i, n; - t->NumPort = 0; - for (i = 0;i < LIST_NUM(s->ServerListenerList);i++) - { - SERVER_LISTENER *o = LIST_DATA(s->ServerListenerList, i); - if (o->Enabled) - { - t->NumPort++; - } - } - t->Ports = ZeroMalloc(sizeof(UINT) * t->NumPort); - n = 0; - for (i = 0;i < LIST_NUM(s->ServerListenerList);i++) - { - SERVER_LISTENER *o = LIST_DATA(s->ServerListenerList, i); - if (o->Enabled) - { - t->Ports[n++] = o->Port; - } - } - } - UnlockList(s->ServerListenerList); - - t->ServerCert = CloneX(s->Cedar->ServerX); - t->NumSessions = Count(s->Cedar->CurrentSessions); - t->NumTcpConnections = Count(s->Cedar->CurrentTcpConnections); - } - else - { - t->ConnectedTime = f->ConnectedTime; - t->Ip = f->Ip; - StrCpy(t->Hostname, sizeof(t->Hostname), f->hostname); - t->Point = f->Point; - t->NumPort = f->NumPort; - t->Ports = ZeroMalloc(sizeof(UINT) * t->NumPort); - Copy(t->Ports, f->Ports, sizeof(UINT) * t->NumPort); - t->ServerCert = CloneX(f->ServerCert); - t->NumSessions = f->NumSessions; - t->NumTcpConnections = f->NumTcpConnections; - } - } - else - { - ret = ERR_OBJECT_NOT_FOUND; - } - } - UnlockList(s->FarmMemberList); - - return ret; -} - -// Get clustering configuration -UINT StGetFarmSetting(ADMIN *a, RPC_FARM *t) -{ - SERVER *s; - FreeRpcFarm(t); - Zero(t, sizeof(RPC_FARM)); - - s = a->Server; - t->ServerType = s->ServerType; - t->ControllerOnly = s->ControllerOnly; - t->Weight = s->Weight; - - if (t->ServerType == SERVER_TYPE_FARM_MEMBER) - { - t->NumPort = s->NumPublicPort; - t->Ports = ZeroMalloc(sizeof(UINT) * t->NumPort); - Copy(t->Ports, s->PublicPorts, sizeof(UINT) * t->NumPort); - t->PublicIp = s->PublicIp; - StrCpy(t->ControllerName, sizeof(t->ControllerName), s->ControllerName); - t->ControllerPort = s->ControllerPort; - } - else - { - t->NumPort = 0; - t->Ports = ZeroMalloc(0); - } - - return ERR_NO_ERROR; -} - -// Set clustering configuration -UINT StSetFarmSetting(ADMIN *a, RPC_FARM *t) -{ - bool cluster_allowed = false; - - SERVER_ADMIN_ONLY; - NO_SUPPORT_FOR_BRIDGE; - - - cluster_allowed = GetServerCapsInt(a->Server, "b_support_cluster"); - - if (t->ServerType != SERVER_TYPE_STANDALONE && cluster_allowed == false) - { - // When clustering function is disabled, deny turning into clustering mode - return ERR_NOT_SUPPORTED; - } - - if (IsZero(t->MemberPassword, sizeof(t->MemberPassword))) - { - if (IsEmptyStr(t->MemberPasswordPlaintext) == false) - { - // For JSON-RPC - HashAdminPassword(t->MemberPassword, t->MemberPasswordPlaintext); - } - } - - ALog(a, NULL, "LA_SET_FARM_SETTING"); - - IncrementServerConfigRevision(a->Server); - - SiSetServerType(a->Server, t->ServerType, t->PublicIp, t->NumPort, t->Ports, - t->ControllerName, t->ControllerPort, t->MemberPassword, t->Weight, t->ControllerOnly); - - return ERR_NO_ERROR; -} - -// Set server password -UINT StSetServerPassword(ADMIN *a, RPC_SET_PASSWORD *t) -{ - SERVER_ADMIN_ONLY; - - if (IsZero(t->HashedPassword, sizeof(t->HashedPassword))) - { - // For JSON-RPC - HashAdminPassword(t->HashedPassword, t->PlainTextPassword); - } - - Copy(a->Server->HashedPassword, t->HashedPassword, SHA1_SIZE); - - ALog(a, NULL, "LA_SET_SERVER_PASSWORD"); - - IncrementServerConfigRevision(a->Server); - - return ERR_NO_ERROR; -} - -// Enable / Disable listener -UINT StEnableListener(ADMIN *a, RPC_LISTENER *t) -{ - UINT ret = ERR_NO_ERROR; - - SERVER_ADMIN_ONLY; - - - LockList(a->Server->ServerListenerList); - { - if (t->Enable) - { - if (SiEnableListener(a->Server, t->Port) == false) - { - ret = ERR_LISTENER_NOT_FOUND; - } - else - { - ALog(a, NULL, "LA_ENABLE_LISTENER", t->Port); - } - } - else - { - if (SiDisableListener(a->Server, t->Port) == false) - { - ret = ERR_LISTENER_NOT_FOUND; - } - else - { - ALog(a, NULL, "LA_DISABLE_LISTENER", t->Port); - } - } - } - UnlockList(a->Server->ServerListenerList); - - IncrementServerConfigRevision(a->Server); - - SleepThread(250); - - return ret; -} - -// Delete a listener -UINT StDeleteListener(ADMIN *a, RPC_LISTENER *t) -{ - UINT ret = ERR_NO_ERROR; - - SERVER_ADMIN_ONLY; - - - LockList(a->Server->ServerListenerList); - { - if (SiDeleteListener(a->Server, t->Port) == false) - { - ret = ERR_LISTENER_NOT_FOUND; - } - else - { - ALog(a, NULL, "LA_DELETE_LISTENER", t->Port); - - IncrementServerConfigRevision(a->Server); - } - } - UnlockList(a->Server->ServerListenerList); - - return ret; -} - -// Enumerating listeners -UINT StEnumListener(ADMIN *a, RPC_LISTENER_LIST *t) -{ - CEDAR *c = a->Server->Cedar; - UINT i; - - FreeRpcListenerList(t); - Zero(t, sizeof(RPC_LISTENER_LIST)); - - LockList(a->Server->ServerListenerList); - { - t->NumPort = LIST_NUM(a->Server->ServerListenerList); - t->Ports = ZeroMalloc(sizeof(UINT) * t->NumPort); - t->Enables = ZeroMalloc(sizeof(bool) * t->NumPort); - t->Errors = ZeroMalloc(sizeof(bool) * t->NumPort); - - for (i = 0;i < t->NumPort;i++) - { - SERVER_LISTENER *o = LIST_DATA(a->Server->ServerListenerList, i); - - t->Ports[i] = o->Port; - t->Enables[i] = o->Enabled; - if (t->Enables[i]) - { - if (o->Listener->Status == LISTENER_STATUS_TRYING) - { - t->Errors[i] = true; - } - } - } - } - UnlockList(a->Server->ServerListenerList); - - return ERR_NO_ERROR; -} - -// Create a listener -UINT StCreateListener(ADMIN *a, RPC_LISTENER *t) -{ - UINT ret = ERR_NO_ERROR; - CEDAR *c = a->Server->Cedar; - - if (t->Port == 0 || t->Port > 65535) - { - return ERR_INVALID_PARAMETER; - } - - SERVER_ADMIN_ONLY; - - LockList(a->Server->ServerListenerList); - { - if (SiAddListener(a->Server, t->Port, t->Enable) == false) - { - ret = ERR_LISTENER_ALREADY_EXISTS; - } - else - { - ALog(a, NULL, "LA_CREATE_LISTENER", t->Port); - - IncrementServerConfigRevision(a->Server); - } - } - UnlockList(a->Server->ServerListenerList); - - SleepThread(250); - - return ret; -} - -// Set UDP ports the server should listen on -UINT StSetPortsUDP(ADMIN *a, RPC_PORTS *t) -{ - UINT i; - LIST *ports, *server_ports; - - SERVER_ADMIN_ONLY; - - ports = NewIntList(true); - - for (i = 0; i < t->Num; ++i) - { - const UINT port = t->Ports[i]; - if (port < 1 || port > 65535) - { - ReleaseIntList(ports); - return ERR_INVALID_PARAMETER; - } - - AddIntDistinct(ports, port); - } - - server_ports = a->Server->PortsUDP; - - LockList(server_ports); - { - char tmp[MAX_SIZE]; - wchar_t str[MAX_SIZE]; - - for (i = 0; i < LIST_NUM(server_ports); ++i) - { - Free(LIST_DATA(server_ports, i)); - } - DeleteAll(server_ports); - - for (i = 0; i < LIST_NUM(ports); ++i) - { - const UINT port = *(UINT *)LIST_DATA(ports, i); - AddInt(server_ports, port); - } - - ProtoSetUdpPorts(a->Server->Proto, server_ports); - - IntListToStr(tmp, sizeof(tmp), server_ports, ", "); - StrToUni(str, sizeof(str), tmp); - ALog(a, NULL, "LA_SET_PORTS_UDP", str); - } - UnlockList(server_ports); - - ReleaseIntList(ports); - - IncrementServerConfigRevision(a->Server); - - return ERR_NO_ERROR; -} - -// List UDP ports the server is listening on -UINT StGetPortsUDP(ADMIN *a, RPC_PORTS *t) -{ - LIST *ports = a->Server->PortsUDP; - - FreeRpcPorts(t); - - LockList(ports); - { - t->Num = LIST_NUM(ports); - t->Ports = t->Num > 0 ? Malloc(sizeof(UINT) * t->Num) : NULL; - if (t->Ports != NULL) - { - UINT i; - for (i = 0; i < t->Num; ++i) - { - const UINT port = *(UINT *)LIST_DATA(ports, i); - t->Ports[i] = port; - } - } - } - UnlockList(ports); - - return ERR_NO_ERROR; -} - -UINT StGetProtoOptions(ADMIN *a, RPC_PROTO_OPTIONS *t) -{ - PROTO *proto = a->Server->Proto; - PROTO_CONTAINER *container, tmp; - UINT ret = ERR_NO_ERROR; - LIST *options; - - if (proto == NULL) - { - return ERR_NOT_SUPPORTED; - } - - tmp.Name = t->Protocol; - - container = Search(proto->Containers, &tmp); - if (container == NULL) - { - return ERR_INVALID_PARAMETER; - } - - options = container->Options; - LockList(options); - { - UINT i; - - t->Num = LIST_NUM(options); - t->Options = Malloc(sizeof(PROTO_OPTION) * t->Num); - - for (i = 0; i < t->Num; ++i) - { - const PROTO_OPTION *option = LIST_DATA(options, i); - PROTO_OPTION *rpc_option = &t->Options[i]; - - switch (option->Type) - { - case PROTO_OPTION_BOOL: - rpc_option->Bool = option->Bool; - break; - case PROTO_OPTION_STRING: - rpc_option->String = CopyStr(option->String); - break; - default: - Debug("StGetProtoOptions(): unhandled option type %u!\n", option->Type); - ret = ERR_INTERNAL_ERROR; - } - - if (ret == ERR_NO_ERROR) - { - rpc_option->Name = CopyStr(option->Name); - rpc_option->Type = option->Type; - } - else - { - break; - } - } - } - UnlockList(options); - - return ret; -} - -UINT StSetProtoOptions(ADMIN *a, RPC_PROTO_OPTIONS *t) -{ - PROTO *proto = a->Server->Proto; - PROTO_CONTAINER *container, tmp; - UINT ret = ERR_NO_ERROR; - bool changed = false; - LIST *options; - - SERVER_ADMIN_ONLY; - - if (proto == NULL) - { - return ERR_NOT_SUPPORTED; - } - - tmp.Name = t->Protocol; - - container = Search(proto->Containers, &tmp); - if (container == NULL) - { - return ERR_INVALID_PARAMETER; - } - - options = container->Options; - LockList(options); - { - UINT i; - for (i = 0; i < t->Num; ++i) - { - PROTO_OPTION *rpc_option = &t->Options[i]; - PROTO_OPTION *option = Search(options, rpc_option); - if (option == NULL || rpc_option->Type != option->Type) - { - ret = ERR_INVALID_PARAMETER; - break; - } - - switch (option->Type) - { - case PROTO_OPTION_BOOL: - option->Bool = rpc_option->Bool; - break; - case PROTO_OPTION_STRING: - Free(option->String); - option->String = CopyStr(rpc_option->String); - break; - default: - Debug("StSetProtoOptions(): unhandled option type %u!\n", option->Type); - ret = ERR_INTERNAL_ERROR; - } - - if (ret == ERR_NO_ERROR) - { - changed = true; - } - else - { - break; - } - } - } - UnlockList(options); - - if (changed) - { - ALog(a, NULL, "LA_SET_PROTO_OPTIONS", t->Protocol); - IncrementServerConfigRevision(a->Server); - } - - return ret; -} - -// Get server status -UINT StGetServerStatus(ADMIN *a, RPC_SERVER_STATUS *t) -{ - CEDAR *c; - UINT i; - - c = a->Server->Cedar; - - Zero(t, sizeof(RPC_SERVER_STATUS)); - - Lock(c->TrafficLock); - { - Copy(&t->Traffic, c->Traffic, sizeof(TRAFFIC)); - } - Unlock(c->TrafficLock); - - GetMemInfo(&t->MemInfo); - - t->ServerType = a->Server->ServerType; - t->NumTcpConnections = t->NumTcpConnectionsLocal = t->NumTcpConnectionsRemote = 0; - t->NumSessionsTotal = t->NumSessionsLocal = t->NumSessionsRemote = 0; - - t->NumTcpConnectionsLocal = Count(c->CurrentTcpConnections); - - if (a->Server->ServerType == SERVER_TYPE_FARM_CONTROLLER) - { - LockList(a->Server->FarmMemberList); - { - for (i = 0;i < LIST_NUM(a->Server->FarmMemberList);i++) - { - FARM_MEMBER *f = LIST_DATA(a->Server->FarmMemberList, i); - - if (f->Me == false) - { - t->NumTcpConnectionsRemote += f->NumTcpConnections; - t->NumSessionsRemote += f->NumSessions; - AddTraffic(&t->Traffic, &f->Traffic); - } - } - } - UnlockList(a->Server->FarmMemberList); - } - - t->NumMacTables = t->NumIpTables = t->NumUsers = t->NumGroups = 0; - - // The number of hubs - LockList(c->HubList); - { - t->NumHubTotal = LIST_NUM(c->HubList); - - t->NumHubStandalone = t->NumHubDynamic = t->NumHubStatic = 0; - - for (i = 0;i < LIST_NUM(c->HubList);i++) - { - HUB *h = LIST_DATA(c->HubList, i); - Lock(h->lock); - { - switch (h->Type) - { - case HUB_TYPE_STANDALONE: - t->NumHubStandalone++; - break; - - case HUB_TYPE_FARM_STATIC: - t->NumHubStatic++; - break; - - case HUB_TYPE_FARM_DYNAMIC: - t->NumHubDynamic++; - break; - } - } - - t->NumMacTables += HASH_LIST_NUM(h->MacHashTable); - t->NumIpTables += LIST_NUM(h->IpTable); - - if (h->HubDb != NULL) - { - t->NumUsers += LIST_NUM(h->HubDb->UserList); - t->NumGroups += LIST_NUM(h->HubDb->GroupList); - } - - Unlock(h->lock); - } - } - UnlockList(c->HubList); - - // The number of sessions - t->NumSessionsLocal = Count(c->CurrentSessions); - t->NumSessionsTotal = t->NumSessionsLocal + t->NumSessionsRemote; - t->NumTcpConnections = t->NumTcpConnectionsLocal + t->NumTcpConnectionsRemote; - - t->AssignedBridgeLicenses = Count(c->AssignedBridgeLicense); - t->AssignedClientLicenses = Count(c->AssignedClientLicense); - - t->AssignedBridgeLicensesTotal = a->Server->CurrentAssignedBridgeLicense; - t->AssignedClientLicensesTotal = a->Server->CurrentAssignedClientLicense; - - t->CurrentTick = Tick64(); - t->CurrentTime = SystemTime64(); - - t->StartTime = a->Server->StartTime; - - return ERR_NO_ERROR; -} - -// Get server information -UINT StGetServerInfo(ADMIN *a, RPC_SERVER_INFO *t) -{ - CEDAR *c; - OS_INFO *info; - SYSTEMTIME st; - // Validate arguments - if (a == NULL || t == NULL) - { - return ERR_INTERNAL_ERROR; - } - - FreeRpcServerInfo(t); - Zero(t, sizeof(RPC_SERVER_INFO)); - - c = a->Server->Cedar; - - GetServerProductName(a->Server, t->ServerProductName, sizeof(t->ServerProductName)); - - StrCpy(t->ServerVersionString, sizeof(t->ServerVersionString), c->VerString); - StrCpy(t->ServerBuildInfoString, sizeof(t->ServerBuildInfoString), c->BuildInfo); - t->ServerVerInt = c->Version; - t->ServerBuildInt = c->Build; - GetMachineName(t->ServerHostName, sizeof(t->ServerHostName)); - t->ServerType = c->Server->ServerType; - - Zero(&st, sizeof(st)); - st.wYear = BUILD_DATE_Y; - st.wMonth = BUILD_DATE_M; - st.wDay = BUILD_DATE_D; - st.wHour = BUILD_DATE_HO; - st.wMinute = BUILD_DATE_MI; - st.wSecond = BUILD_DATE_SE; - - t->ServerBuildDate = SystemToUINT64(&st); - StrCpy(t->ServerFamilyName, sizeof(t->ServerFamilyName), UPDATE_FAMILY_NAME); - - info = GetOsInfo(); - if (info != NULL) - { - CopyOsInfo(&t->OsInfo, info); - } - - return ERR_NO_ERROR; -} - -// Copy OS_INFO -void CopyOsInfo(OS_INFO *dst, OS_INFO *info) -{ - // Validate arguments - if (info == NULL || dst == NULL) - { - return; - } - - dst->OsType = info->OsType; - dst->OsServicePack = info->OsServicePack; - dst->OsSystemName = CopyStr(info->OsSystemName); - dst->OsProductName = CopyStr(info->OsProductName); - dst->OsVendorName = CopyStr(info->OsVendorName); - dst->OsVersion = CopyStr(info->OsVersion); - dst->KernelName = CopyStr(info->KernelName); - dst->KernelVersion = CopyStr(info->KernelVersion); -} - -// OPENVPN_SSTP_CONFIG -void InOpenVpnSstpConfig(OPENVPN_SSTP_CONFIG *t, PACK *p) -{ - // Validate arguments - if (t == NULL || p == NULL) - { - return; - } - - Zero(t, sizeof(OPENVPN_SSTP_CONFIG)); - - t->EnableOpenVPN = PackGetBool(p, "EnableOpenVPN"); - t->EnableSSTP = PackGetBool(p, "EnableSSTP"); -} -void OutOpenVpnSstpConfig(PACK *p, OPENVPN_SSTP_CONFIG *t) -{ - // Validate arguments - if (t == NULL || p == NULL) - { - return; - } - - PackAddBool(p, "EnableOpenVPN", t->EnableOpenVPN); - PackAddBool(p, "EnableSSTP", t->EnableSSTP); -} - -// DDNS_CLIENT_STATUS -void InDDnsClientStatus(DDNS_CLIENT_STATUS *t, PACK *p) -{ - // Validate arguments - if (t == NULL || p == NULL) - { - return; - } - - Zero(t, sizeof(DDNS_CLIENT_STATUS)); - - t->Err_IPv4 = PackGetInt(p, "Err_IPv4"); - t->Err_IPv6 = PackGetInt(p, "Err_IPv6"); - - PackGetStr(p, "CurrentHostName", t->CurrentHostName, sizeof(t->CurrentHostName)); - PackGetStr(p, "CurrentFqdn", t->CurrentFqdn, sizeof(t->CurrentFqdn)); - PackGetStr(p, "DnsSuffix", t->DnsSuffix, sizeof(t->DnsSuffix)); - PackGetStr(p, "CurrentIPv4", t->CurrentIPv4, sizeof(t->CurrentIPv4)); - PackGetStr(p, "CurrentIPv6", t->CurrentIPv6, sizeof(t->CurrentIPv6)); - PackGetUniStr(p, "ErrStr_IPv4", t->ErrStr_IPv4, sizeof(t->ErrStr_IPv4)); - PackGetUniStr(p, "ErrStr_IPv6", t->ErrStr_IPv6, sizeof(t->ErrStr_IPv6)); -} -void OutDDnsClientStatus(PACK *p, DDNS_CLIENT_STATUS *t) -{ - // Validate arguments - if (t == NULL || p == NULL) - { - return; - } - - PackAddInt(p, "Err_IPv4", t->Err_IPv4); - PackAddInt(p, "Err_IPv6", t->Err_IPv6); - PackAddStr(p, "CurrentHostName", t->CurrentHostName); - PackAddStr(p, "CurrentFqdn", t->CurrentFqdn); - PackAddStr(p, "DnsSuffix", t->DnsSuffix); - PackAddStr(p, "CurrentIPv4", t->CurrentIPv4); - PackAddStr(p, "CurrentIPv6", t->CurrentIPv6); - PackAddUniStr(p, "ErrStr_IPv4", t->ErrStr_IPv4); - PackAddUniStr(p, "ErrStr_IPv6", t->ErrStr_IPv6); -} - -// INTERNET_SETTING -void InRpcInternetSetting(INTERNET_SETTING *t, PACK *p) -{ - // Validate arguments - if (t == NULL || p == NULL) - { - return; - } - - t->ProxyType = PackGetInt(p, "ProxyType"); - PackGetStr(p, "ProxyHostName", t->ProxyHostName, sizeof(t->ProxyHostName)); - t->ProxyPort = PackGetInt(p, "ProxyPort"); - PackGetStr(p, "ProxyUsername", t->ProxyUsername, sizeof(t->ProxyUsername)); - PackGetStr(p, "ProxyPassword", t->ProxyPassword, sizeof(t->ProxyPassword)); - PackGetStr(p, "CustomHttpHeader", t->CustomHttpHeader, sizeof(t->CustomHttpHeader)); -} -void OutRpcInternetSetting(PACK *p, INTERNET_SETTING *t) -{ - // Validate arguments - if (t == NULL || p == NULL) - { - return; - } - - PackAddInt(p, "ProxyType", t->ProxyType); - PackAddStr(p, "ProxyHostName", t->ProxyHostName); - PackAddInt(p, "ProxyPort", t->ProxyPort); - PackAddStr(p, "ProxyUsername", t->ProxyUsername); - PackAddStr(p, "ProxyPassword", t->ProxyPassword); - PackAddStr(p, "CustomHttpHeader", t->CustomHttpHeader); -} - -// RPC_AZURE_STATUS -void InRpcAzureStatus(RPC_AZURE_STATUS *t, PACK *p) -{ - // Validate arguments - if (t == NULL || p == NULL) - { - return; - } - - Zero(t, sizeof(RPC_AZURE_STATUS)); - - t->IsConnected = PackGetBool(p, "IsConnected"); - t->IsEnabled = PackGetBool(p, "IsEnabled"); -} -void OutRpcAzureStatus(PACK *p, RPC_AZURE_STATUS *t) -{ - // Validate arguments - if (t == NULL || p == NULL) - { - return; - } - - PackAddBool(p, "IsConnected", t->IsConnected); - PackAddBool(p, "IsEnabled", t->IsEnabled); -} - -// RPC_SPECIAL_LISTENER -void InRpcSpecialListener(RPC_SPECIAL_LISTENER *t, PACK *p) -{ - // Validate arguments - if (t == NULL || p == NULL) - { - return; - } - - Zero(t, sizeof(RPC_SPECIAL_LISTENER)); - - t->VpnOverIcmpListener = PackGetBool(p, "VpnOverIcmpListener"); - t->VpnOverDnsListener = PackGetBool(p, "VpnOverDnsListener"); -} -void OutRpcSpecialListener(PACK *p, RPC_SPECIAL_LISTENER *t) -{ - // Validate arguments - if (t == NULL || p == NULL) - { - return; - } - - PackAddBool(p, "VpnOverIcmpListener", t->VpnOverIcmpListener); - PackAddBool(p, "VpnOverDnsListener", t->VpnOverDnsListener); -} - - -// ETHERIP_ID -void InEtherIpId(ETHERIP_ID *t, PACK *p) -{ - // Validate arguments - if (t == NULL || p == NULL) - { - return; - } - - Zero(t, sizeof(ETHERIP_ID)); - - PackGetStr(p, "Id", t->Id, sizeof(t->Id)); - PackGetStr(p, "HubName", t->HubName, sizeof(t->HubName)); - PackGetStr(p, "UserName", t->UserName, sizeof(t->UserName)); - PackGetStr(p, "Password", t->Password, sizeof(t->Password)); -} -void OutEtherIpId(PACK *p, ETHERIP_ID *t) -{ - // Validate arguments - if (t == NULL || p == NULL) - { - return; - } - - PackAddStr(p, "Id", t->Id); - PackAddStr(p, "HubName", t->HubName); - PackAddStr(p, "UserName", t->UserName); - PackAddStr(p, "Password", t->Password); -} - -// RPC_ENUM_ETHERIP_ID -void InRpcEnumEtherIpId(RPC_ENUM_ETHERIP_ID *t, PACK *p) -{ - UINT i; - // Validate arguments - if (t == NULL || p == NULL) - { - return; - } - - Zero(t, sizeof(RPC_ENUM_ETHERIP_ID)); - - t->NumItem = PackGetInt(p, "NumItem"); - t->IdList = ZeroMalloc(sizeof(ETHERIP_ID) * t->NumItem); - - for (i = 0;i < t->NumItem;i++) - { - ETHERIP_ID *e = &t->IdList[i]; - - PackGetStrEx(p, "Id", e->Id, sizeof(e->Id), i); - PackGetStrEx(p, "HubName", e->HubName, sizeof(e->HubName), i); - PackGetStrEx(p, "UserName", e->UserName, sizeof(e->UserName), i); - PackGetStrEx(p, "Password", e->Password, sizeof(e->Password), i); - } -} -void OutRpcEnumEtherIpId(PACK *p, RPC_ENUM_ETHERIP_ID *t) -{ - UINT i; - // Validate arguments - if (p == NULL || t == NULL) - { - return; - } - - PackAddInt(p, "NumItem", t->NumItem); - - PackSetCurrentJsonGroupName(p, "Settings"); - for (i = 0;i < t->NumItem;i++) - { - ETHERIP_ID *e = &t->IdList[i]; - - PackAddStrEx(p, "Id", e->Id, i, t->NumItem); - PackAddStrEx(p, "HubName", e->HubName, i, t->NumItem); - PackAddStrEx(p, "UserName", e->UserName, i, t->NumItem); - PackAddStrEx(p, "Password", e->Password, i, t->NumItem); - } - PackSetCurrentJsonGroupName(p, NULL); -} -void FreeRpcEnumEtherIpId(RPC_ENUM_ETHERIP_ID *t) -{ - // Validate arguments - if (t == NULL) - { - return; - } - - Free(t->IdList); -} - -// IPSEC_SERVICES -void InIPsecServices(IPSEC_SERVICES *t, PACK *p) -{ - // Validate arguments - if (t == NULL || p == NULL) - { - return; - } - - Zero(t, sizeof(IPSEC_SERVICES)); - - t->L2TP_Raw = PackGetBool(p, "L2TP_Raw"); - t->L2TP_IPsec = PackGetBool(p, "L2TP_IPsec"); - t->EtherIP_IPsec = PackGetBool(p, "EtherIP_IPsec"); - - PackGetStr(p, "IPsec_Secret", t->IPsec_Secret, sizeof(t->IPsec_Secret)); - PackGetStr(p, "L2TP_DefaultHub", t->L2TP_DefaultHub, sizeof(t->L2TP_DefaultHub)); -} -void OutIPsecServices(PACK *p, IPSEC_SERVICES *t) -{ - // Validate arguments - if (t == NULL || p == NULL) - { - return; - } - - PackAddBool(p, "L2TP_Raw", t->L2TP_Raw); - PackAddBool(p, "L2TP_IPsec", t->L2TP_IPsec); - PackAddBool(p, "EtherIP_IPsec", t->EtherIP_IPsec); - - PackAddStr(p, "IPsec_Secret", t->IPsec_Secret); - PackAddStr(p, "L2TP_DefaultHub", t->L2TP_DefaultHub); -} - -// RPC_WINVER -void InRpcWinVer(RPC_WINVER *t, PACK *p) -{ - // Validate arguments - if (t == NULL || p == NULL) - { - return; - } - - Zero(t, sizeof(RPC_WINVER)); - - t->IsWindows = PackGetBool(p, "V_IsWindows"); - t->IsNT = PackGetBool(p, "V_IsNT"); - t->IsServer = PackGetBool(p, "V_IsServer"); - t->IsBeta = PackGetBool(p, "V_IsBeta"); - t->VerMajor = PackGetInt(p, "V_VerMajor"); - t->VerMinor = PackGetInt(p, "V_VerMinor"); - t->Build = PackGetInt(p, "V_Build"); - t->ServicePack = PackGetInt(p, "V_ServicePack"); - PackGetStr(p, "V_Title", t->Title, sizeof(t->Title)); -} -void OutRpcWinVer(PACK *p, RPC_WINVER *t) -{ - // Validate arguments - if (t == NULL || p == NULL) - { - return; - } - - PackAddBool(p, "V_IsWindows", t->IsWindows); - PackAddBool(p, "V_IsNT", t->IsNT); - PackAddBool(p, "V_IsServer", t->IsServer); - PackAddBool(p, "V_IsBeta", t->IsBeta); - PackAddInt(p, "V_VerMajor", t->VerMajor); - PackAddInt(p, "V_VerMinor", t->VerMinor); - PackAddInt(p, "V_Build", t->Build); - PackAddInt(p, "V_ServicePack", t->ServicePack); - PackAddStr(p, "V_Title", t->Title); -} - -// RPC_MSG -void InRpcMsg(RPC_MSG *t, PACK *p) -{ - UINT size; - char *utf8; - // Validate arguments - if (t == NULL || p == NULL) - { - return; - } - - Zero(t, sizeof(RPC_MSG)); - - PackGetStr(p, "HubName", t->HubName, sizeof(t->HubName)); - size = PackGetDataSize(p, "Msg"); - utf8 = ZeroMalloc(size + 8); - PackGetData(p, "Msg", utf8); - t->Msg = CopyUtfToUni(utf8); - Free(utf8); -} -void OutRpcMsg(PACK *p, RPC_MSG *t) -{ - UINT size; - char *utf8; - // Validate arguments - if (t == NULL || p == NULL) - { - return; - } - - PackAddStr(p, "HubName", t->HubName); - utf8 = CopyUniToUtf(t->Msg); - size = StrLen(utf8); - PackAddData(p, "Msg", utf8, size); - Free(utf8); -} -void FreeRpcMsg(RPC_MSG *t) -{ - // Validate arguments - if (t == NULL) - { - return; - } - - Free(t->Msg); -} - -// RPC_ENUM_ETH_VLAN -void InRpcEnumEthVLan(RPC_ENUM_ETH_VLAN *t, PACK *p) -{ - UINT i; - // Validate arguments - if (t == NULL || p == NULL) - { - return; - } - - Zero(t, sizeof(RPC_ENUM_ETH_VLAN)); - - t->NumItem = PackGetIndexCount(p, "DeviceName"); - t->Items = ZeroMalloc(sizeof(RPC_ENUM_ETH_VLAN_ITEM) * t->NumItem); - - for (i = 0;i < t->NumItem;i++) - { - RPC_ENUM_ETH_VLAN_ITEM *e = &t->Items[i]; - - PackGetStrEx(p, "DeviceName", e->DeviceName, sizeof(e->DeviceName), i); - PackGetStrEx(p, "Guid", e->Guid, sizeof(e->Guid), i); - PackGetStrEx(p, "DeviceInstanceId", e->DeviceInstanceId, sizeof(e->DeviceInstanceId), i); - PackGetStrEx(p, "DriverName", e->DriverName, sizeof(e->DriverName), i); - PackGetStrEx(p, "DriverType", e->DriverType, sizeof(e->DriverType), i); - e->Support = PackGetBoolEx(p, "Support", i); - e->Enabled = PackGetBoolEx(p, "Enabled", i); - } -} -void OutRpcEnumEthVLan(PACK *p, RPC_ENUM_ETH_VLAN *t) -{ - UINT i; - // Validate arguments - if (t == NULL || p == NULL) - { - return; - } - - PackSetCurrentJsonGroupName(p, "Devices"); - for (i = 0;i < t->NumItem;i++) - { - RPC_ENUM_ETH_VLAN_ITEM *e = &t->Items[i]; - - PackAddStrEx(p, "DeviceName", e->DeviceName, i, t->NumItem); - PackAddStrEx(p, "Guid", e->Guid, i, t->NumItem); - PackAddStrEx(p, "DeviceInstanceId", e->DeviceInstanceId, i, t->NumItem); - PackAddStrEx(p, "DriverName", e->DriverName, i, t->NumItem); - PackAddStrEx(p, "DriverType", e->DriverType, i, t->NumItem); - PackAddBoolEx(p, "Support", e->Support, i, t->NumItem); - PackAddBoolEx(p, "Enabled", e->Enabled, i, t->NumItem); - } - PackSetCurrentJsonGroupName(p, NULL); -} -void FreeRpcEnumEthVLan(RPC_ENUM_ETH_VLAN *t) -{ - // Validate arguments - if (t == NULL) - { - return; - } - - Free(t->Items); -} - -// RPC_ENUM_LOG_FILE -void InRpcEnumLogFile(RPC_ENUM_LOG_FILE *t, PACK *p) -{ - UINT i; - // Validate arguments - if (t == NULL || p == NULL) - { - return; - } - - Zero(t, sizeof(RPC_ENUM_LOG_FILE)); - t->NumItem = PackGetInt(p, "NumItem"); - t->Items = ZeroMalloc(sizeof(RPC_ENUM_LOG_FILE_ITEM) * t->NumItem); - - for (i = 0;i < t->NumItem;i++) - { - RPC_ENUM_LOG_FILE_ITEM *e = &t->Items[i]; - - PackGetStrEx(p, "FilePath", e->FilePath, sizeof(e->FilePath), i); - PackGetStrEx(p, "ServerName", e->ServerName, sizeof(e->ServerName), i); - e->FileSize = PackGetIntEx(p, "FileSize", i); - e->UpdatedTime = PackGetInt64Ex(p, "UpdatedTime", i); - } -} -void OutRpcEnumLogFile(PACK *p, RPC_ENUM_LOG_FILE *t) -{ - UINT i; - // Validate arguments - if (t == NULL || p == NULL) - { - return; - } - - PackAddInt(p, "NumItem", t->NumItem); - - PackSetCurrentJsonGroupName(p, "LogFiles"); - for (i = 0;i < t->NumItem;i++) - { - RPC_ENUM_LOG_FILE_ITEM *e = &t->Items[i]; - - PackAddStrEx(p, "FilePath", e->FilePath, i, t->NumItem); - PackAddStrEx(p, "ServerName", e->ServerName, i, t->NumItem); - PackAddIntEx(p, "FileSize", e->FileSize, i, t->NumItem); - PackAddTime64Ex(p, "UpdatedTime", e->UpdatedTime, i, t->NumItem); - } - PackSetCurrentJsonGroupName(p, NULL); -} -void FreeRpcEnumLogFile(RPC_ENUM_LOG_FILE *t) -{ - // Validate arguments - if (t == NULL) - { - return; - } - - Free(t->Items); -} -void AdjoinRpcEnumLogFile(RPC_ENUM_LOG_FILE *t, RPC_ENUM_LOG_FILE *src) -{ - LIST *o; - UINT i; - // Validate arguments - if (t == NULL || src == NULL) - { - return; - } - - o = NewListFast(CmpLogFile); - - for (i = 0;i < t->NumItem;i++) - { - RPC_ENUM_LOG_FILE_ITEM *e = &t->Items[i]; - LOG_FILE *f = ZeroMalloc(sizeof(LOG_FILE)); - - f->FileSize = e->FileSize; - StrCpy(f->Path, sizeof(f->Path), e->FilePath); - StrCpy(f->ServerName, sizeof(f->ServerName), e->ServerName); - f->UpdatedTime = e->UpdatedTime; - - Add(o, f); - } - - for (i = 0;i < src->NumItem;i++) - { - RPC_ENUM_LOG_FILE_ITEM *e = &src->Items[i]; - LOG_FILE *f = ZeroMalloc(sizeof(LOG_FILE)); - - f->FileSize = e->FileSize; - StrCpy(f->Path, sizeof(f->Path), e->FilePath); - StrCpy(f->ServerName, sizeof(f->ServerName), e->ServerName); - f->UpdatedTime = e->UpdatedTime; - - Add(o, f); - } - - FreeRpcEnumLogFile(t); - - Sort(o); - - Zero(t, sizeof(RPC_ENUM_LOG_FILE)); - t->NumItem = LIST_NUM(o); - t->Items = ZeroMalloc(sizeof(RPC_ENUM_LOG_FILE_ITEM) * t->NumItem); - - for (i = 0;i < t->NumItem;i++) - { - LOG_FILE *f = LIST_DATA(o, i); - RPC_ENUM_LOG_FILE_ITEM *e = &t->Items[i]; - - StrCpy(e->FilePath, sizeof(e->FilePath), f->Path); - StrCpy(e->ServerName, sizeof(e->ServerName), f->ServerName); - e->FileSize = f->FileSize; - e->UpdatedTime = f->UpdatedTime; - } - - FreeEnumLogFile(o); -} - -// RPC_READ_LOG_FILE -void InRpcReadLogFile(RPC_READ_LOG_FILE *t, PACK *p) -{ - // Validate arguments - if (t == NULL || p == NULL) - { - return; - } - - Zero(t, sizeof(RPC_READ_LOG_FILE)); - PackGetStr(p, "FilePath", t->FilePath, sizeof(t->FilePath)); - PackGetStr(p, "ServerName", t->ServerName, sizeof(t->ServerName)); - t->Offset = PackGetInt(p, "Offset"); - - t->Buffer = PackGetBuf(p, "Buffer"); -} -void OutRpcReadLogFile(PACK *p, RPC_READ_LOG_FILE *t) -{ - // Validate arguments - if (p == NULL || t == NULL) - { - return; - } - - PackAddStr(p, "FilePath", t->FilePath); - PackAddStr(p, "ServerName", t->ServerName); - PackAddInt(p, "Offset", t->Offset); - - if (t->Buffer != NULL) - { - PackAddBuf(p, "Buffer", t->Buffer); - } -} -void FreeRpcReadLogFile(RPC_READ_LOG_FILE *t) -{ - // Validate arguments - if (t == NULL) - { - return; - } - - if (t->Buffer != NULL) - { - FreeBuf(t->Buffer); - } -} - -// RPC_AC_LIST -void InRpcAcList(RPC_AC_LIST *t, PACK *p) -{ - UINT i; - LIST *o; - UINT num; - // Validate arguments - if (t == NULL || p == NULL) - { - return; - } - - Zero(t, sizeof(RPC_AC_LIST)); - o = NewAcList(); - - PackGetStr(p, "HubName", t->HubName, sizeof(t->HubName)); - num = PackGetIndexCount(p, "IpAddress"); - - for (i = 0;i < num;i++) - { - AC *ac = ZeroMalloc(sizeof(AC)); - - ac->Id = PackGetIntEx(p, "Id", i); - ac->Deny = PackGetBoolEx(p, "Deny", i); - PackGetIpEx(p, "IpAddress", &ac->IpAddress, i); - ac->Masked = PackGetBoolEx(p, "Masked", i); - - if (ac->Masked) - { - PackGetIpEx(p, "SubnetMask", &ac->SubnetMask, i); - } - - ac->Priority = PackGetIntEx(p, "Priority", i); - - AddAc(o, ac); - - Free(ac); - } - - t->o = o; -} -void OutRpcAcList(PACK *p, RPC_AC_LIST *t) -{ - UINT i, num; - LIST *o; - // Validate arguments - if (t == NULL || p == NULL) - { - return; - } - - o = t->o; - num = LIST_NUM(o); - - PackAddInt(p, "NumItem", num); - - PackAddStr(p, "HubName", t->HubName); - - PackSetCurrentJsonGroupName(p, "ACList"); - for (i = 0;i < num;i++) - { - AC *ac = LIST_DATA(o, i); - - PackAddIntEx(p, "Id", ac->Id, i, num); - PackAddBoolEx(p, "Deny", ac->Deny, i, num); - PackAddIpEx(p, "IpAddress", &ac->IpAddress, i, num); - PackAddBoolEx(p, "Masked", ac->Masked, i, num); - - PackAddIpEx(p, "SubnetMask", &ac->SubnetMask, i, num); - - PackAddIntEx(p, "Priority", ac->Priority, i, num); - } - PackSetCurrentJsonGroupName(p, NULL); -} -void FreeRpcAcList(RPC_AC_LIST *t) -{ - // Validate arguments - if (t == NULL) - { - return; - } - - FreeAcList(t->o); -} - -// RPC_INT -void InRpcInt(RPC_INT *t, PACK *p) -{ - // Validate arguments - if (t == NULL || p == NULL) - { - return; - } - - Zero(t, sizeof(RPC_INT)); - t->IntValue = PackGetInt(p, "IntValue"); -} -void OutRpcInt(PACK *p, RPC_INT *t) -{ - // Validate arguments - if (t == NULL || p == NULL) - { - return; - } - - PackAddInt(p, "IntValue", t->IntValue); -} - -// RPC_ENUM_CRL -void InRpcEnumCrl(RPC_ENUM_CRL *t, PACK *p) -{ - UINT i; - // Validate arguments - if (t == NULL || p == NULL) - { - return; - } - - Zero(t, sizeof(RPC_ENUM_CRL)); - PackGetStr(p, "HubName", t->HubName, sizeof(t->HubName)); - t->NumItem = PackGetInt(p, "NumItem"); - - t->Items = ZeroMalloc(sizeof(RPC_ENUM_CRL_ITEM) * t->NumItem); - for (i = 0;i < t->NumItem;i++) - { - RPC_ENUM_CRL_ITEM *e = &t->Items[i]; - - e->Key = PackGetIntEx(p, "Key", i); - PackGetUniStrEx(p, "CrlInfo", e->CrlInfo, sizeof(e->CrlInfo), i); - } -} -void OutRpcEnumCrl(PACK *p, RPC_ENUM_CRL *t) -{ - UINT i; - // Validate arguments - if (t == NULL || p == NULL) - { - return; - } - - PackAddStr(p, "HubName", t->HubName); - PackAddInt(p, "NumItem", t->NumItem); - - PackSetCurrentJsonGroupName(p, "CRLList"); - for (i = 0;i < t->NumItem;i++) - { - RPC_ENUM_CRL_ITEM *e = &t->Items[i]; - - PackAddIntEx(p, "Key", e->Key, i, t->NumItem); - PackAddUniStrEx(p, "CrlInfo", e->CrlInfo, i, t->NumItem); - } - PackSetCurrentJsonGroupName(p, NULL); -} -void FreeRpcEnumCrl(RPC_ENUM_CRL *t) -{ - // Validate arguments - if (t == NULL) - { - return; - } - - Free(t->Items); -} - -// RPC_CRL -void InRpcCrl(RPC_CRL *t, PACK *p) -{ - BUF *b; - NAME *n; - wchar_t tmp[MAX_SIZE]; - // Validate arguments - if (t == NULL || p == NULL) - { - return; - } - - Zero(t, sizeof(RPC_CRL)); - PackGetStr(p, "HubName", t->HubName, sizeof(t->HubName)); - t->Key = PackGetInt(p, "Key"); - b = PackGetBuf(p, "Serial"); - t->Crl = ZeroMalloc(sizeof(CRL)); - if (b != NULL) - { - t->Crl->Serial = NewXSerial(b->Buf, b->Size); - FreeBuf(b); - } - t->Crl->Name = ZeroMalloc(sizeof(NAME)); - n = t->Crl->Name; - if (PackGetUniStr(p, "CommonName", tmp, sizeof(tmp))) - { - n->CommonName = CopyUniStr(tmp); - } - if (PackGetUniStr(p, "Organization", tmp, sizeof(tmp))) - { - n->Organization = CopyUniStr(tmp); - } - if (PackGetUniStr(p, "Unit", tmp, sizeof(tmp))) - { - n->Unit = CopyUniStr(tmp); - } - if (PackGetUniStr(p, "Country", tmp, sizeof(tmp))) - { - n->Country = CopyUniStr(tmp); - } - if (PackGetUniStr(p, "State", tmp, sizeof(tmp))) - { - n->State = CopyUniStr(tmp); - } - if (PackGetUniStr(p, "Local", tmp, sizeof(tmp))) - { - n->Local = CopyUniStr(tmp); - } - if (PackGetDataSize(p, "DigestMD5") == MD5_SIZE) - { - PackGetData(p, "DigestMD5", t->Crl->DigestMD5); - } - if (PackGetDataSize(p, "DigestSHA1") == SHA1_SIZE) - { - PackGetData(p, "DigestSHA1", t->Crl->DigestSHA1); - } -} -void OutRpcCrl(PACK *p, RPC_CRL *t) -{ - NAME *n; - // Validate arguments - if (p == NULL || t == NULL) - { - return; - } - - PackAddStr(p, "HubName", t->HubName); - PackAddInt(p, "Key", t->Key); - - if (t->Crl == NULL) - { - return; - } - - if (t->Crl->Serial != NULL) - { - PackAddData(p, "Serial", t->Crl->Serial->data, t->Crl->Serial->size); - } - n = t->Crl->Name; - if (n->CommonName != NULL) - { - PackAddUniStr(p, "CommonName", n->CommonName); - } - if (n->Organization != NULL) - { - PackAddUniStr(p, "Organization", n->Organization); - } - if (n->Unit != NULL) - { - PackAddUniStr(p, "Unit", n->Unit); - } - if (n->Country != NULL) - { - PackAddUniStr(p, "Country", n->Country); - } - if (n->State != NULL) - { - PackAddUniStr(p, "State", n->State); - } - if (n->Local != NULL) - { - PackAddUniStr(p, "Local", n->Local); - } - if (IsZero(t->Crl->DigestMD5, MD5_SIZE) == false) - { - PackAddData(p, "DigestMD5", t->Crl->DigestMD5, MD5_SIZE); - } - if (IsZero(t->Crl->DigestSHA1, SHA1_SIZE) == false) - { - PackAddData(p, "DigestSHA1", t->Crl->DigestSHA1, SHA1_SIZE); - } -} -void FreeRpcCrl(RPC_CRL *t) -{ - // Validate arguments - if (t == NULL) - { - return; - } - - FreeCrl(t->Crl); -} - -// RPC_ENUM_L3TABLE -void InRpcEnumL3Table(RPC_ENUM_L3TABLE *t, PACK *p) -{ - UINT i; - // Validate arguments - if (t == NULL || p == NULL) - { - return; - } - - Zero(t, sizeof(RPC_ENUM_L3TABLE)); - t->NumItem = PackGetInt(p, "NumItem"); - PackGetStr(p, "Name", t->Name, sizeof(t->Name)); - t->Items = ZeroMalloc(sizeof(RPC_L3TABLE) * t->NumItem); - - for (i = 0;i < t->NumItem;i++) - { - RPC_L3TABLE *e = &t->Items[i]; - - e->NetworkAddress = PackGetIp32Ex(p, "NetworkAddress", i); - e->SubnetMask = PackGetIp32Ex(p, "SubnetMask", i); - e->GatewayAddress = PackGetIp32Ex(p, "GatewayAddress", i); - e->Metric = PackGetIntEx(p, "Metric", i); - } -} -void OutRpcEnumL3Table(PACK *p, RPC_ENUM_L3TABLE *t) -{ - UINT i; - // Validate arguments - if (p == NULL || t == NULL) - { - return; - } - - PackAddInt(p, "NumItem", t->NumItem); - PackAddStr(p, "Name", t->Name); - - PackSetCurrentJsonGroupName(p, "L3Table"); - for (i = 0;i < t->NumItem;i++) - { - RPC_L3TABLE *e = &t->Items[i]; - - PackAddIp32Ex(p, "NetworkAddress", e->NetworkAddress, i, t->NumItem); - PackAddIp32Ex(p, "SubnetMask", e->SubnetMask, i, t->NumItem); - PackAddIp32Ex(p, "GatewayAddress", e->GatewayAddress, i, t->NumItem); - PackAddIntEx(p, "Metric", e->Metric, i, t->NumItem); - } - PackSetCurrentJsonGroupName(p, NULL); -} -void FreeRpcEnumL3Table(RPC_ENUM_L3TABLE *t) -{ - Free(t->Items); -} - -// RPC_L3TABLE -void InRpcL3Table(RPC_L3TABLE *t, PACK *p) -{ - // Validate arguments - if (t == NULL || p == NULL) - { - return; - } - - Zero(t, sizeof(RPC_L3TABLE)); - PackGetStr(p, "Name", t->Name, sizeof(t->Name)); - t->NetworkAddress = PackGetIp32(p, "NetworkAddress"); - t->SubnetMask = PackGetIp32(p, "SubnetMask"); - t->GatewayAddress = PackGetIp32(p, "GatewayAddress"); - t->Metric = PackGetInt(p, "Metric"); -} -void OutRpcL3Table(PACK *p, RPC_L3TABLE *t) -{ - // Validate arguments - if (p == NULL || t == NULL) - { - return; - } - - PackAddStr(p, "Name", t->Name); - PackAddIp32(p, "NetworkAddress", t->NetworkAddress); - PackAddIp32(p, "SubnetMask", t->SubnetMask); - PackAddIp32(p, "GatewayAddress", t->GatewayAddress); - PackAddInt(p, "Metric", t->Metric); -} - -// RPC_ENUM_L3IF -void InRpcEnumL3If(RPC_ENUM_L3IF *t, PACK *p) -{ - UINT i; - // Validate arguments - if (t == NULL || p == NULL) - { - return; - } - - Zero(t, sizeof(RPC_ENUM_L3IF)); - t->NumItem = PackGetInt(p, "NumItem"); - PackGetStr(p, "Name", t->Name, sizeof(t->Name)); - t->Items = ZeroMalloc(sizeof(RPC_L3IF) * t->NumItem); - - for (i = 0;i < t->NumItem;i++) - { - RPC_L3IF *f = &t->Items[i]; - - PackGetStrEx(p, "HubName", f->HubName, sizeof(f->HubName), i); - f->IpAddress = PackGetIp32Ex(p, "IpAddress", i); - f->SubnetMask = PackGetIp32Ex(p, "SubnetMask", i); - } -} -void OutRpcEnumL3If(PACK *p, RPC_ENUM_L3IF *t) -{ - UINT i; - // Validate arguments - if (p == NULL || t == NULL) - { - return; - } - - PackAddInt(p, "NumItem", t->NumItem); - PackAddStr(p, "Name", t->Name); - - PackSetCurrentJsonGroupName(p, "L3IFList"); - for (i = 0;i < t->NumItem;i++) - { - RPC_L3IF *f = &t->Items[i]; - - PackAddStrEx(p, "HubName", f->HubName, i, t->NumItem); - PackAddIp32Ex(p, "IpAddress", f->IpAddress, i, t->NumItem); - PackAddIp32Ex(p, "SubnetMask", f->SubnetMask, i, t->NumItem); - } - PackSetCurrentJsonGroupName(p, NULL); -} -void FreeRpcEnumL3If(RPC_ENUM_L3IF *t) -{ - // Validate arguments - if (t == NULL) - { - return; - } - - Free(t->Items); -} - -// RPC_L3IF -void InRpcL3If(RPC_L3IF *t, PACK *p) -{ - // Validate arguments - if (t == NULL || p == NULL) - { - return; - } - - Zero(t, sizeof(RPC_L3IF)); - PackGetStr(p, "Name", t->Name, sizeof(t->Name)); - PackGetStr(p, "HubName", t->HubName, sizeof(t->HubName)); - t->IpAddress = PackGetIp32(p, "IpAddress"); - t->SubnetMask = PackGetIp32(p, "SubnetMask"); -} -void OutRpcL3If(PACK *p, RPC_L3IF *t) -{ - // Validate arguments - if (p == NULL || t == NULL) - { - return; - } - - PackAddStr(p, "Name", t->Name); - PackAddStr(p, "HubName", t->HubName); - PackAddIp32(p, "IpAddress", t->IpAddress); - PackAddIp32(p, "SubnetMask", t->SubnetMask); -} - -// RPC_L3SW -void InRpcL3Sw(RPC_L3SW *t, PACK *p) -{ - // Validate arguments - if (t == NULL || p == NULL) - { - return; - } - - Zero(t, sizeof(RPC_L3SW)); - PackGetStr(p, "Name", t->Name, sizeof(t->Name)); -} -void OutRpcL3Sw(PACK *p, RPC_L3SW *t) -{ - // Validate arguments - if (p == NULL || t == NULL) - { - return; - } - - PackAddStr(p, "Name", t->Name); -} - -// RPC_ENUM_L3SW -void InRpcEnumL3Sw(RPC_ENUM_L3SW *t, PACK *p) -{ - UINT i; - // Validate arguments - if (t == NULL || p == NULL) - { - return; - } - - Zero(t, sizeof(RPC_ENUM_L3SW)); - t->NumItem = PackGetInt(p, "NumItem"); - t->Items = ZeroMalloc(sizeof(RPC_ENUM_L3SW_ITEM) * t->NumItem); - - for (i = 0;i < t->NumItem;i++) - { - RPC_ENUM_L3SW_ITEM *s = &t->Items[i]; - - PackGetStrEx(p, "Name", s->Name, sizeof(s->Name), i); - s->NumInterfaces = PackGetIntEx(p, "NumInterfaces", i); - s->NumTables = PackGetIntEx(p, "NumTables", i); - s->Active = PackGetBoolEx(p, "Active", i); - s->Online = PackGetBoolEx(p, "Online", i); - } -} -void OutRpcEnumL3Sw(PACK *p, RPC_ENUM_L3SW *t) -{ - UINT i; - // Validate arguments - if (p == NULL || t == NULL) - { - return; - } - - PackAddInt(p, "NumItem", t->NumItem); - - PackSetCurrentJsonGroupName(p, "L3SWList"); - for (i = 0;i < t->NumItem;i++) - { - RPC_ENUM_L3SW_ITEM *s = &t->Items[i]; - - PackAddStrEx(p, "Name", s->Name, i, t->NumItem); - PackAddIntEx(p, "NumInterfaces", s->NumInterfaces, i, t->NumItem); - PackAddIntEx(p, "NumTables", s->NumTables, i, t->NumItem); - PackAddBoolEx(p, "Active", s->Active, i, t->NumItem); - PackAddBoolEx(p, "Online", s->Online, i, t->NumItem); - } - PackSetCurrentJsonGroupName(p, NULL); -} -void FreeRpcEnumL3Sw(RPC_ENUM_L3SW *t) -{ - // Validate arguments - if (t == NULL) - { - return; - } - - Free(t->Items); -} - -// RPC_ENUM_ETH -void InRpcEnumEth(RPC_ENUM_ETH *t, PACK *p) -{ - UINT i; - // Validate arguments - if (t == NULL || p == NULL) - { - return; - } - - Zero(t, sizeof(RPC_ENUM_ETH)); - t->NumItem = PackGetInt(p, "NumItem"); - t->Items = ZeroMalloc(sizeof(RPC_ENUM_ETH_ITEM) * t->NumItem); - - for (i = 0;i < t->NumItem;i++) - { - RPC_ENUM_ETH_ITEM *e = &t->Items[i]; - PackGetStrEx(p, "DeviceName", e->DeviceName, sizeof(e->DeviceName), i); - PackGetUniStrEx(p, "NetworkConnectionName", e->NetworkConnectionName, sizeof(e->NetworkConnectionName), i); - } -} -void OutRpcEnumEth(PACK *p, RPC_ENUM_ETH *t) -{ - UINT i; - // Validate arguments - if (p == NULL || t == NULL) - { - return; - } - - PackAddInt(p, "NumItem", t->NumItem); - - PackSetCurrentJsonGroupName(p, "EthList"); - for (i = 0;i < t->NumItem;i++) - { - RPC_ENUM_ETH_ITEM *e = &t->Items[i]; - PackAddStrEx(p, "DeviceName", e->DeviceName, i, t->NumItem); - PackAddUniStrEx(p, "NetworkConnectionName", e->NetworkConnectionName, i, t->NumItem); - } - PackSetCurrentJsonGroupName(p, NULL); -} -void FreeRpcEnumEth(RPC_ENUM_ETH *t) -{ - // Validate arguments - if (t == NULL) - { - return; - } - - Free(t->Items); -} - -// RPC_LOCALBRIDGE -void InRpcLocalBridge(RPC_LOCALBRIDGE *t, PACK *p) -{ - // Validate arguments - if (t == NULL || p == NULL) - { - return; - } - - Zero(t, sizeof(RPC_LOCALBRIDGE)); - PackGetStr(p, "DeviceName", t->DeviceName, sizeof(t->DeviceName)); - PackGetStr(p, "HubNameLB", t->HubName, sizeof(t->HubName)); - t->TapMode = PackGetBool(p, "TapMode"); -} -void OutRpcLocalBridge(PACK *p, RPC_LOCALBRIDGE *t) -{ - // Validate arguments - if (t == NULL || p == NULL) - { - return; - } - - PackAddStr(p, "DeviceName", t->DeviceName); - PackAddStr(p, "HubNameLB", t->HubName); - PackAddBool(p, "TapMode", t->TapMode); -} - -// RPC_ENUM_LOCALBRIDGE -void InRpcEnumLocalBridge(RPC_ENUM_LOCALBRIDGE *t, PACK *p) -{ - UINT i; - // Validate arguments - if (t == NULL || p == NULL) - { - return; - } - - Zero(t, sizeof(RPC_ENUM_LOCALBRIDGE)); - t->NumItem = PackGetInt(p, "NumItem"); - t->Items = ZeroMalloc(sizeof(RPC_LOCALBRIDGE) * t->NumItem); - - for (i = 0;i < t->NumItem;i++) - { - RPC_LOCALBRIDGE *e = &t->Items[i]; - - PackGetStrEx(p, "DeviceName", e->DeviceName, sizeof(e->DeviceName), i); - PackGetStrEx(p, "HubNameLB", e->HubName, sizeof(e->HubName), i); - e->Online = PackGetBoolEx(p, "Online", i); - e->Active = PackGetBoolEx(p, "Active", i); - e->TapMode = PackGetBoolEx(p, "TapMode", i); - } -} -void OutRpcEnumLocalBridge(PACK *p, RPC_ENUM_LOCALBRIDGE *t) -{ - UINT i; - // Validate arguments - if (t == NULL || p == NULL) - { - return; - } - - PackAddInt(p, "NumItem", t->NumItem); - - PackSetCurrentJsonGroupName(p, "LocalBridgeList"); - for (i = 0;i < t->NumItem;i++) - { - RPC_LOCALBRIDGE *e = &t->Items[i]; - - PackAddStrEx(p, "DeviceName", e->DeviceName, i, t->NumItem); - PackAddStrEx(p, "HubNameLB", e->HubName, i, t->NumItem); - PackAddBoolEx(p, "Online", e->Online, i, t->NumItem); - PackAddBoolEx(p, "Active", e->Active, i, t->NumItem); - PackAddBoolEx(p, "TapMode", e->TapMode, i, t->NumItem); - } - PackSetCurrentJsonGroupName(p, NULL); -} -void FreeRpcEnumLocalBridge(RPC_ENUM_LOCALBRIDGE *t) -{ - // Validate arguments - if (t == NULL) - { - return; - } - Free(t->Items); -} - -// MEMINFO -void InRpcMemInfo(MEMINFO *t, PACK *p) -{ - // Validate arguments - if (t == NULL || p == NULL) - { - return; - } - - Zero(t, sizeof(MEMINFO)); - t->TotalMemory = PackGetInt64(p, "TotalMemory"); - t->UsedMemory = PackGetInt64(p, "UsedMemory"); - t->FreeMemory = PackGetInt64(p, "FreeMemory"); - t->TotalPhys = PackGetInt64(p, "TotalPhys"); - t->UsedPhys = PackGetInt64(p, "UsedPhys"); - t->FreePhys = PackGetInt64(p, "FreePhys"); -} -void OutRpcMemInfo(PACK *p, MEMINFO *t) -{ - // Validate arguments - if (t == NULL || p == NULL) - { - return; - } - - PackAddInt64(p, "TotalMemory", t->TotalMemory); - PackAddInt64(p, "UsedMemory", t->UsedMemory); - PackAddInt64(p, "FreeMemory", t->FreeMemory); - PackAddInt64(p, "TotalPhys", t->TotalPhys); - PackAddInt64(p, "UsedPhys", t->UsedPhys); - PackAddInt64(p, "FreePhys", t->FreePhys); -} - -// OS_INFO -void InRpcOsInfo(OS_INFO *t, PACK *p) -{ - char tmp[MAX_SIZE]; - // Validate arguments - if (t == NULL || p == NULL) - { - return; - } - - Zero(t, sizeof(OS_INFO)); - t->OsType = PackGetInt(p, "OsType"); - t->OsServicePack = PackGetInt(p, "OsServicePack"); - if (PackGetStr(p, "OsSystemName", tmp, sizeof(tmp))) - { - t->OsSystemName = CopyStr(tmp); - } - if (PackGetStr(p, "OsProductName", tmp, sizeof(tmp))) - { - t->OsProductName = CopyStr(tmp); - } - if (PackGetStr(p, "OsVendorName", tmp, sizeof(tmp))) - { - t->OsVendorName = CopyStr(tmp); - } - if (PackGetStr(p, "OsVersion", tmp, sizeof(tmp))) - { - t->OsVersion = CopyStr(tmp); - } - if (PackGetStr(p, "KernelName", tmp, sizeof(tmp))) - { - t->KernelName = CopyStr(tmp); - } - if (PackGetStr(p, "KernelVersion", tmp, sizeof(tmp))) - { - t->KernelVersion = CopyStr(tmp); - } -} -void OutRpcOsInfo(PACK *p, OS_INFO *t) -{ - // Validate arguments - if (t == NULL || p == NULL) - { - return; - } - - PackAddInt(p, "OsType", t->OsType); - PackAddInt(p, "OsServicePack", t->OsServicePack); - PackAddStr(p, "OsSystemName", t->OsSystemName); - PackAddStr(p, "OsProductName", t->OsProductName); - PackAddStr(p, "OsVendorName", t->OsVendorName); - PackAddStr(p, "OsVersion", t->OsVersion); - PackAddStr(p, "KernelName", t->KernelName); - PackAddStr(p, "KernelVersion", t->KernelVersion); -} -void FreeRpcOsInfo(OS_INFO *t) -{ - // Validate arguments - if (t == NULL) - { - return; - } - - Free(t->OsSystemName); - Free(t->OsProductName); - Free(t->OsVendorName); - Free(t->OsVersion); - Free(t->KernelName); - Free(t->KernelVersion); -} - -// Read a local log file -void SiReadLocalLogFile(SERVER *s, char *filepath, UINT offset, RPC_READ_LOG_FILE *t) -{ - char exe_dir[MAX_PATH], full_path[MAX_PATH]; - IO *o; - // Validate arguments - if (s == NULL || t == NULL || filepath == NULL) - { - return; - } - - Zero(t, sizeof(RPC_READ_LOG_FILE)); - - GetLogDir(exe_dir, sizeof(exe_dir)); - Format(full_path, sizeof(full_path), "%s/%s", exe_dir, filepath); - - // Read file - o = FileOpenEx(full_path, false, false); - if (o != NULL) - { - UINT filesize = FileSize(o); - - if (offset < filesize) - { - UINT readsize = MIN(filesize - offset, FTP_BLOCK_SIZE); - void *buf = ZeroMalloc(readsize); - - FileSeek(o, FILE_BEGIN, offset); - FileRead(o, buf, readsize); - - t->Buffer = NewBuf(); - WriteBuf(t->Buffer, buf, readsize); - Free(buf); - } - - FileClose(o); - } -} - -// Enumerate local log files -void SiEnumLocalLogFileList(SERVER *s, char *hubname, RPC_ENUM_LOG_FILE *t) -{ - LIST *o; - UINT i; - // Validate arguments - if (s == NULL || t == NULL) - { - return; - } - - Zero(t, sizeof(RPC_ENUM_LOG_FILE)); - - o = EnumLogFile(hubname); - - t->NumItem = LIST_NUM(o); - t->Items = ZeroMalloc(sizeof(RPC_ENUM_LOG_FILE_ITEM) * t->NumItem); - - for (i = 0;i < LIST_NUM(o);i++) - { - LOG_FILE *f = LIST_DATA(o, i); - RPC_ENUM_LOG_FILE_ITEM *e = &t->Items[i]; - - StrCpy(e->FilePath, sizeof(e->FilePath), f->Path); - StrCpy(e->ServerName, sizeof(e->ServerName), f->ServerName); - e->FileSize = f->FileSize; - e->UpdatedTime = f->UpdatedTime; - } - - FreeEnumLogFile(o); -} - -// Enumerate local sessions -void SiEnumLocalSession(SERVER *s, char *hubname, RPC_ENUM_SESSION *t) -{ - HUB *h; - UINT64 now = Tick64(); - UINT64 dormant_interval = 0; - // Validate arguments - if (s == NULL || hubname == NULL || t == NULL) - { - return; - } - - LockHubList(s->Cedar); - h = GetHub(s->Cedar, hubname); - UnlockHubList(s->Cedar); - - if (h == NULL) - { - t->NumSession = 0; - t->Sessions = ZeroMalloc(0); - return; - } - - if (h->Option != NULL) - { - dormant_interval = h->Option->DetectDormantSessionInterval * (UINT64)1000; - } - - LockList(h->SessionList); - { - UINT i; - t->NumSession = LIST_NUM(h->SessionList); - t->Sessions = ZeroMalloc(sizeof(RPC_ENUM_SESSION_ITEM) * t->NumSession); - - for (i = 0;i < t->NumSession;i++) - { - SESSION *s = LIST_DATA(h->SessionList, i); - RPC_ENUM_SESSION_ITEM *e = &t->Sessions[i]; - Lock(s->lock); - { - StrCpy(e->Name, sizeof(e->Name), s->Name); - StrCpy(e->Username, sizeof(e->Username), s->Username); - e->Ip = IPToUINT(&s->Connection->ClientIp); - CopyIP(&e->ClientIP, &s->Connection->ClientIp); - StrCpy(e->Hostname, sizeof(e->Hostname), s->Connection->ClientHostname); - e->MaxNumTcp = s->MaxConnection; - e->CreatedTime = Tick64ToTime64(s->CreatedTime); - e->LastCommTime = Tick64ToTime64(s->LastCommTime); - e->LinkMode = s->LinkModeServer; - e->SecureNATMode = s->SecureNATMode; - e->BridgeMode = s->BridgeMode; - e->Layer3Mode = s->L3SwitchMode; - e->VLanId = s->VLanId; - LockList(s->Connection->Tcp->TcpSockList); - { - e->CurrentNumTcp = s->Connection->Tcp->TcpSockList->num_item; - } - UnlockList(s->Connection->Tcp->TcpSockList); - Lock(s->TrafficLock); - { - e->PacketSize = GetTrafficPacketSize(s->Traffic); - e->PacketNum = GetTrafficPacketNum(s->Traffic); - } - Unlock(s->TrafficLock); - e->Client_BridgeMode = s->IsBridgeMode; - e->Client_MonitorMode = s->IsMonitorMode; - Copy(e->UniqueId, s->NodeInfo.UniqueId, 16); - - if (s->NormalClient) - { - e->IsDormantEnabled = (dormant_interval == 0 ? false : true); - if (e->IsDormantEnabled) - { - if (s->LastCommTimeForDormant == 0) - { - e->LastCommDormant = (UINT64)0x7FFFFFFF; - } - else - { - e->LastCommDormant = now - s->LastCommTimeForDormant; - } - if (s->LastCommTimeForDormant == 0) - { - e->IsDormant = true; - } - else - { - if ((s->LastCommTimeForDormant + dormant_interval) < now) - { - e->IsDormant = true; - } - } - } - } - } - Unlock(s->lock); - - GetMachineName(e->RemoteHostname, sizeof(e->RemoteHostname)); - } - } - UnlockList(h->SessionList); - - ReleaseHub(h); -} - -// RPC_ENUM_LICENSE_KEY -void InRpcEnumLicenseKey(RPC_ENUM_LICENSE_KEY *t, PACK *p) -{ - UINT i; - // Validate arguments - if (t == NULL || p == NULL) - { - return; - } - - Zero(t, sizeof(RPC_ENUM_LICENSE_KEY)); - t->NumItem = PackGetInt(p, "NumItem"); - t->Items = ZeroMalloc(sizeof(RPC_ENUM_LICENSE_KEY_ITEM) * t->NumItem); - for (i = 0;i < t->NumItem;i++) - { - RPC_ENUM_LICENSE_KEY_ITEM *e = &t->Items[i]; - - e->Id = PackGetIntEx(p, "Id", i); - PackGetStrEx(p, "LicenseKey", e->LicenseKey, sizeof(e->LicenseKey), i); - PackGetStrEx(p, "LicenseId", e->LicenseId, sizeof(e->LicenseId), i); - PackGetStrEx(p, "LicenseName", e->LicenseName, sizeof(e->LicenseName), i); - e->Expires = PackGetInt64Ex(p, "Expires", i); - e->Status = PackGetIntEx(p, "Status", i); - e->ProductId = PackGetIntEx(p, "ProductId", i); - e->SystemId = PackGetInt64Ex(p, "SystemId", i); - e->SerialId = PackGetIntEx(p, "SerialId", i); - } -} -void OutRpcEnumLicenseKey(PACK *p, RPC_ENUM_LICENSE_KEY *t) -{ - UINT i; - // Validate arguments - if (t == NULL || p == NULL) - { - return; - } - - PackAddInt(p, "NumItem", t->NumItem); - - PackSetCurrentJsonGroupName(p, "LicenseKeyList"); - for (i = 0;i < t->NumItem;i++) - { - RPC_ENUM_LICENSE_KEY_ITEM *e = &t->Items[i]; - - PackAddIntEx(p, "Id", e->Id, i, t->NumItem); - PackAddStrEx(p, "LicenseKey", e->LicenseKey, i, t->NumItem); - PackAddStrEx(p, "LicenseId", e->LicenseId, i, t->NumItem); - PackAddStrEx(p, "LicenseName", e->LicenseName, i, t->NumItem); - PackAddTime64Ex(p, "Expires", e->Expires, i, t->NumItem); - PackAddIntEx(p, "Status", e->Status, i, t->NumItem); - PackAddIntEx(p, "ProductId", e->ProductId, i, t->NumItem); - PackAddInt64Ex(p, "SystemId", e->SystemId, i, t->NumItem); - PackAddIntEx(p, "SerialId", e->SerialId, i, t->NumItem); - } - PackSetCurrentJsonGroupName(p, NULL); -} -void FreeRpcEnumLicenseKey(RPC_ENUM_LICENSE_KEY *t) -{ - // Validate arguments - if (t == NULL) - { - return; - } - - Free(t->Items); -} - -// RPC_LICENSE_STATUS -void InRpcLicenseStatus(RPC_LICENSE_STATUS *t, PACK *p) -{ - // Validate arguments - if (t == NULL || p == NULL) - { - return; - } - - Zero(t, sizeof(RPC_LICENSE_STATUS)); - - t->EditionId = PackGetInt(p, "EditionId"); - PackGetStr(p, "EditionStr", t->EditionStr, sizeof(t->EditionStr) ); - t->SystemId = PackGetInt64(p, "SystemId"); - t->SystemExpires = PackGetInt64(p, "SystemExpires"); - t->NumClientConnectLicense = PackGetInt(p, "NumClientConnectLicense"); - t->NumBridgeConnectLicense = PackGetInt(p, "NumBridgeConnectLicense"); - - // v3.0 - t->NeedSubscription = PackGetBool(p, "NeedSubscription"); - t->AllowEnterpriseFunction = PackGetBool(p, "AllowEnterpriseFunction"); - t->SubscriptionExpires = PackGetInt64(p, "SubscriptionExpires"); - t->IsSubscriptionExpired = PackGetBool(p, "IsSubscriptionExpired"); - t->NumUserCreationLicense = PackGetInt(p, "NumUserCreationLicense"); - t->ReleaseDate = PackGetInt64(p, "ReleaseDate"); -} -void OutRpcLicenseStatus(PACK *p, RPC_LICENSE_STATUS *t) -{ - // Validate arguments - if (t == NULL || p == NULL) - { - return; - } - - PackAddInt(p, "EditionId", t->EditionId); - PackAddStr(p, "EditionStr", t->EditionStr); - PackAddInt64(p, "SystemId", t->SystemId); - PackAddTime64(p, "SystemExpires", t->SystemExpires); - PackAddInt(p, "NumClientConnectLicense", t->NumClientConnectLicense); - PackAddInt(p, "NumBridgeConnectLicense", t->NumBridgeConnectLicense); - - // v3.0 - PackAddBool(p, "NeedSubscription", t->NeedSubscription); - PackAddBool(p, "AllowEnterpriseFunction", t->AllowEnterpriseFunction); - PackAddTime64(p, "SubscriptionExpires", t->SubscriptionExpires); - PackAddBool(p, "IsSubscriptionExpired", t->IsSubscriptionExpired); - PackAddInt(p, "NumUserCreationLicense", t->NumUserCreationLicense); - PackAddTime64(p, "ReleaseDate", t->ReleaseDate); -} - -// RPC_ADMIN_OPTION -void InRpcAdminOption(RPC_ADMIN_OPTION *t, PACK *p) -{ - UINT i; - // Validate arguments - if (t == NULL || p == NULL) - { - return; - } - - Zero(t, sizeof(RPC_ADMIN_OPTION)); - t->NumItem = PackGetIndexCount(p, "Name"); - t->Items = ZeroMalloc(sizeof(ADMIN_OPTION) * t->NumItem); - - PackGetStr(p, "HubName", t->HubName, sizeof(t->HubName)); - - for (i = 0;i < t->NumItem;i++) - { - ADMIN_OPTION *o = &t->Items[i]; - - PackGetStrEx(p, "Name", o->Name, sizeof(o->Name), i); - o->Value = PackGetIntEx(p, "Value", i); - PackGetUniStrEx(p, "Descrption", o->Descrption, sizeof(o->Descrption), i); - } -} -void OutRpcAdminOption(PACK *p, RPC_ADMIN_OPTION *t) -{ - UINT i; - // Validate arguments - if (t == NULL || p == NULL) - { - return; - } - - PackAddInt(p, "NumItem", t->NumItem); - - PackAddStr(p, "HubName", t->HubName); - - PackSetCurrentJsonGroupName(p, "AdminOptionList"); - for (i = 0;i < t->NumItem;i++) - { - ADMIN_OPTION *o = &t->Items[i]; - - PackAddStrEx(p, "Name", o->Name, i, t->NumItem); - PackAddIntEx(p, "Value", o->Value, i, t->NumItem); - PackAddUniStrEx(p, "Descrption", o->Descrption, i, t->NumItem); - } - PackSetCurrentJsonGroupName(p, NULL); -} -void FreeRpcAdminOption(RPC_ADMIN_OPTION *t) -{ - // Validate arguments - if (t == NULL) - { - return; - } - - Free(t->Items); -} - -// RPC_CONFIG -void InRpcConfig(RPC_CONFIG *t, PACK *p) -{ - UINT size; - // Validate arguments - if (t == NULL || p == NULL) - { - return; - } - - Zero(t, sizeof(RPC_CONFIG)); - PackGetStr(p, "FileName", t->FileName, sizeof(t->FileName)); - size = PackGetDataSize(p, "FileData"); - t->FileData = ZeroMalloc(size + 1); - PackGetData(p, "FileData", t->FileData); -} -void OutRpcConfig(PACK *p, RPC_CONFIG *t) -{ - // Validate arguments - if (t == NULL || p == NULL) - { - return; - } - - PackAddStr(p, "FileName", t->FileName); - PackAddData(p, "FileData", t->FileData, StrLen(t->FileData)); -} -void FreeRpcConfig(RPC_CONFIG *t) -{ - // Validate arguments - if (t == NULL) - { - return; - } - - Free(t->FileData); -} - -// RPC_BRIDGE_SUPPORT -void InRpcBridgeSupport(RPC_BRIDGE_SUPPORT *t, PACK *p) -{ - // Validate arguments - if (t == NULL || p == NULL) - { - return; - } - - Zero(t, sizeof(RPC_BRIDGE_SUPPORT)); - - t->IsBridgeSupportedOs = PackGetBool(p, "IsBridgeSupportedOs"); - t->IsWinPcapNeeded = PackGetBool(p, "IsWinPcapNeeded"); -} -void OutRpcBridgeSupport(PACK *p, RPC_BRIDGE_SUPPORT *t) -{ - // Validate arguments - if (p == NULL || t == NULL) - { - return; - } - - PackAddBool(p, "IsBridgeSupportedOs", t->IsBridgeSupportedOs); - PackAddBool(p, "IsWinPcapNeeded",t->IsWinPcapNeeded); -} - -// RPC_ADD_ACCESS -void InRpcAddAccess(RPC_ADD_ACCESS *t, PACK *p) -{ - // Validate arguments - if (t == NULL || p == NULL) - { - return; - } - - Zero(t, sizeof(RPC_ADD_ACCESS)); - - PackGetStr(p, "HubName", t->HubName, sizeof(t->HubName)); - InRpcAccess(&t->Access, p); -} -void OutRpcAddAccess(PACK *p, RPC_ADD_ACCESS *t) -{ - // Validate arguments - if (t == NULL || p == NULL) - { - return; - } - - PackAddStr(p, "HubName", t->HubName); - OutRpcAccess(p, &t->Access); -} - -// RPC_DELETE_ACCESS -void InRpcDeleteAccess(RPC_DELETE_ACCESS *t, PACK *p) -{ - // Validate arguments - if (t == NULL || p == NULL) - { - return; - } - - Zero(t, sizeof(RPC_DELETE_ACCESS)); - - PackGetStr(p, "HubName", t->HubName, sizeof(t->HubName)); - t->Id = PackGetInt(p, "Id"); -} -void OutRpcDeleteAccess(PACK *p, RPC_DELETE_ACCESS *t) -{ - // Validate arguments - if (t == NULL || p == NULL) - { - return; - } - - PackAddStr(p, "HubName", t->HubName); - PackAddInt(p, "Id", t->Id); -} - - -// RPC_SERVER_INFO -void InRpcServerInfo(RPC_SERVER_INFO *t, PACK *p) -{ - // Validate arguments - if (t == NULL || p == NULL) - { - return; - } - - Zero(t, sizeof(RPC_SERVER_INFO)); - - PackGetStr(p, "ServerProductName", t->ServerProductName, sizeof(t->ServerProductName)); - PackGetStr(p, "ServerVersionString", t->ServerVersionString, sizeof(t->ServerVersionString)); - PackGetStr(p, "ServerBuildInfoString", t->ServerBuildInfoString, sizeof(t->ServerBuildInfoString)); - t->ServerVerInt = PackGetInt(p, "ServerVerInt"); - t->ServerBuildInt = PackGetInt(p, "ServerBuildInt"); - PackGetStr(p, "ServerHostName", t->ServerHostName, sizeof(t->ServerHostName)); - t->ServerType = PackGetInt(p, "ServerType"); - t->ServerBuildDate = PackGetInt64(p, "ServerBuildDate"); - PackGetStr(p, "ServerFamilyName", t->ServerFamilyName, sizeof(t->ServerFamilyName)); - InRpcOsInfo(&t->OsInfo, p); -} -void OutRpcServerInfo(PACK *p, RPC_SERVER_INFO *t) -{ - // Validate arguments - if (t == NULL || p == NULL) - { - return; - } - - PackAddStr(p, "ServerProductName", t->ServerProductName); - PackAddStr(p, "ServerVersionString", t->ServerVersionString); - PackAddStr(p, "ServerBuildInfoString", t->ServerBuildInfoString); - PackAddInt(p, "ServerVerInt", t->ServerVerInt); - PackAddInt(p, "ServerBuildInt", t->ServerBuildInt); - PackAddStr(p, "ServerHostName", t->ServerHostName); - PackAddInt(p, "ServerType", t->ServerType); - PackAddTime64(p, "ServerBuildDate", t->ServerBuildDate); - PackAddStr(p, "ServerFamilyName", t->ServerFamilyName); - OutRpcOsInfo(p, &t->OsInfo); -} -void FreeRpcServerInfo(RPC_SERVER_INFO *t) -{ - // Validate arguments - if (t == NULL) - { - return; - } - - FreeRpcOsInfo(&t->OsInfo); -} - -// RPC_SERVER_STATUS -void InRpcServerStatus(RPC_SERVER_STATUS *t, PACK *p) -{ - // Validate arguments - if (t == NULL || p == NULL) - { - return; - } - - Zero(t, sizeof(RPC_SERVER_STATUS)); - t->ServerType = PackGetInt(p, "ServerType"); - t->NumTcpConnections = PackGetInt(p, "NumTcpConnections"); - t->NumTcpConnectionsLocal = PackGetInt(p, "NumTcpConnectionsLocal"); - t->NumTcpConnectionsRemote = PackGetInt(p, "NumTcpConnectionsRemote"); - t->NumHubTotal = PackGetInt(p, "NumHubTotal"); - t->NumHubStandalone = PackGetInt(p, "NumHubStandalone"); - t->NumHubStatic = PackGetInt(p, "NumHubStatic"); - t->NumHubDynamic = PackGetInt(p, "NumHubDynamic"); - t->NumSessionsTotal = PackGetInt(p, "NumSessionsTotal"); - t->NumSessionsLocal = PackGetInt(p, "NumSessionsLocal"); - t->NumSessionsRemote = PackGetInt(p, "NumSessionsRemote"); - t->NumMacTables = PackGetInt(p, "NumMacTables"); - t->NumIpTables = PackGetInt(p, "NumIpTables"); - t->NumUsers = PackGetInt(p, "NumUsers"); - t->NumGroups = PackGetInt(p, "NumGroups"); - t->CurrentTime = PackGetInt64(p, "CurrentTime"); - t->CurrentTick = PackGetInt64(p, "CurrentTick"); - t->AssignedBridgeLicenses = PackGetInt(p, "AssignedBridgeLicenses"); - t->AssignedClientLicenses = PackGetInt(p, "AssignedClientLicenses"); - t->AssignedBridgeLicensesTotal = PackGetInt(p, "AssignedBridgeLicensesTotal"); - t->AssignedClientLicensesTotal = PackGetInt(p, "AssignedClientLicensesTotal"); - t->StartTime = PackGetInt64(p, "StartTime"); - - InRpcTraffic(&t->Traffic, p); - - InRpcMemInfo(&t->MemInfo, p); -} -void OutRpcServerStatus(PACK *p, RPC_SERVER_STATUS *t) -{ - // Validate arguments - if (t == NULL || p == NULL) - { - return; - } - - PackAddInt(p, "ServerType", t->ServerType); - PackAddInt(p, "NumHubTotal", t->NumHubTotal); - PackAddInt(p, "NumHubStandalone", t->NumHubStandalone); - PackAddInt(p, "NumHubStatic", t->NumHubStatic); - PackAddInt(p, "NumHubDynamic", t->NumHubDynamic); - PackAddInt(p, "NumSessionsTotal", t->NumSessionsTotal); - PackAddInt(p, "NumSessionsLocal", t->NumSessionsLocal); - PackAddInt(p, "NumSessionsRemote", t->NumSessionsRemote); - PackAddInt(p, "NumTcpConnections", t->NumTcpConnections); - PackAddInt(p, "NumTcpConnectionsLocal", t->NumTcpConnectionsLocal); - PackAddInt(p, "NumTcpConnectionsRemote", t->NumTcpConnectionsRemote); - PackAddInt(p, "NumMacTables", t->NumMacTables); - PackAddInt(p, "NumIpTables", t->NumIpTables); - PackAddInt(p, "NumUsers", t->NumUsers); - PackAddInt(p, "NumGroups", t->NumGroups); - PackAddTime64(p, "CurrentTime", t->CurrentTime); - PackAddInt64(p, "CurrentTick", t->CurrentTick); - PackAddInt(p, "AssignedBridgeLicenses", t->AssignedBridgeLicenses); - PackAddInt(p, "AssignedClientLicenses", t->AssignedClientLicenses); - PackAddInt(p, "AssignedBridgeLicensesTotal", t->AssignedBridgeLicensesTotal); - PackAddInt(p, "AssignedClientLicensesTotal", t->AssignedClientLicensesTotal); - PackAddTime64(p, "StartTime", t->StartTime); - - OutRpcTraffic(p, &t->Traffic); - - OutRpcMemInfo(p, &t->MemInfo); -} - -// RPC_LISTENER -void InRpcListener(RPC_LISTENER *t, PACK *p) -{ - // Validate arguments - if (t == NULL || p == NULL) - { - return; - } - - Zero(t, sizeof(RPC_LISTENER)); - t->Port = PackGetInt(p, "Port"); - t->Enable = PackGetBool(p, "Enable"); -} -void OutRpcListener(PACK *p, RPC_LISTENER *t) -{ - // Validate arguments - if (t == NULL || p == NULL) - { - return; - } - - PackAddInt(p, "Port", t->Port); - PackAddBool(p, "Enable", t->Enable); -} - -// RPC_LISTENER_LIST -void InRpcListenerList(RPC_LISTENER_LIST *t, PACK *p) -{ - UINT i; - // Validate arguments - if (t == NULL || p == NULL) - { - return; - } - - Zero(t, sizeof(RPC_LISTENER_LIST)); - t->NumPort = PackGetIndexCount(p, "Ports"); - t->Ports = ZeroMalloc(sizeof(UINT) * t->NumPort); - t->Enables = ZeroMalloc(sizeof(UINT) * t->NumPort); - t->Errors = ZeroMalloc(sizeof(UINT) * t->NumPort); - for (i = 0;i < t->NumPort;i++) - { - t->Ports[i] = PackGetIntEx(p, "Ports", i); - t->Enables[i] = PackGetBoolEx(p, "Enables", i); - t->Errors[i] = PackGetBoolEx(p, "Errors", i); - } -} -void OutRpcListenerList(PACK *p, RPC_LISTENER_LIST *t) -{ - UINT i; - // Validate arguments - if (t == NULL || p == NULL) - { - return; - } - - PackSetCurrentJsonGroupName(p, "ListenerList"); - for (i = 0;i < t->NumPort;i++) - { - PackAddIntEx(p, "Ports", t->Ports[i], i, t->NumPort); - PackAddBoolEx(p, "Enables", t->Enables[i], i, t->NumPort); - PackAddBoolEx(p, "Errors", t->Errors[i], i, t->NumPort); - } - PackSetCurrentJsonGroupName(p, NULL); -} -void FreeRpcListenerList(RPC_LISTENER_LIST *t) -{ - // Validate arguments - if (t == NULL) - { - return; - } - - Free(t->Ports); - Free(t->Enables); - Free(t->Errors); -} - -// RPC_PORTS -void InRpcPorts(RPC_PORTS *t, PACK *p) -{ - UINT i; - // Validate arguments - if (t == NULL || p == NULL) - { - return; - } - - t->Num = PackGetIndexCount(p, "Ports"); - t->Ports = ZeroMalloc(sizeof(UINT) * t->Num); - - for (i = 0; i < t->Num; ++i) - { - t->Ports[i] = PackGetIntEx(p, "Ports", i); - } -} -void OutRpcPorts(PACK *p, RPC_PORTS *t) -{ - UINT i; - // Validate arguments - if (t == NULL || p == NULL) - { - return; - } - - for (i = 0; i < t->Num; ++i) - { - PackAddIntEx(p, "Ports", t->Ports[i], i, t->Num); - } -} -void FreeRpcPorts(RPC_PORTS *t) -{ - // Validate arguments - if (t == NULL) - { - return; - } - - Free(t->Ports); -} - -// RPC_STR -void InRpcStr(RPC_STR *t, PACK *p) -{ - UINT size = 65536; - char *tmp = Malloc(size); - // Validate arguments - if (t == NULL || p == NULL) - { - return; - } - - Zero(t, sizeof(RPC_STR)); - if (PackGetStr(p, "String", tmp, size) == false) - { - t->String = CopyStr(""); - } - else - { - t->String = CopyStr(tmp); - } - Free(tmp); -} -void OutRpcStr(PACK *p, RPC_STR *t) -{ - // Validate arguments - if (t == NULL || p == NULL) - { - return; - } - - PackAddStr(p, "String", t->String); -} -void FreeRpcStr(RPC_STR *t) -{ - // Validate arguments - if (t == NULL ) - { - return; - } - - Free(t->String); -} - -// RPC_PROTO_OPTIONS -void InRpcProtoOptions(RPC_PROTO_OPTIONS *t, PACK *p) -{ - UINT i, size; - // Validate arguments - if (t == NULL || p == NULL) - { - return; - } - - Zero(t, sizeof(RPC_PROTO_OPTIONS)); - - size = PackGetStrSize(p, "Protocol"); - if (size > 0) - { - t->Protocol = Malloc(size); - - if (PackGetStr(p, "Protocol", t->Protocol, size) == false) - { - Zero(t->Protocol, size); - } - } - - t->Num = PackGetIndexCount(p, "Name"); - if (t->Num == 0) - { - return; - } - - t->Options = ZeroMalloc(sizeof(PROTO_OPTION) * t->Num); - - for (i = 0; i < t->Num; ++i) - { - PROTO_OPTION *option = &t->Options[i]; - - size = PackGetStrSizeEx(p, "Name", i); - if (size > 0) - { - option->Name = Malloc(size); - if (PackGetStrEx(p, "Name", option->Name, size, i) == false) - { - Zero(option->Name, size); - } - } - - option->Type = PackGetIntEx(p, "Type", i); - switch (option->Type) - { - case PROTO_OPTION_STRING: - size = PackGetDataSizeEx(p, "Value", i); - if (size > 0) - { - option->String = Malloc(size); - if (PackGetDataEx2(p, "Value", option->String, size, i) == false) - { - Zero(option->String, size); - } - } - break; - case PROTO_OPTION_BOOL: - PackGetDataEx2(p, "Value", &option->Bool, sizeof(option->Bool), i); - break; - default: - Debug("InRpcProtoOptions(): unhandled type %u!\n", option->Type); - } - } -} -void OutRpcProtoOptions(PACK *p, RPC_PROTO_OPTIONS *t) -{ - UINT i; - // Validate arguments - if (t == NULL || p == NULL) - { - return; - } - - PackAddStr(p, "Protocol", t->Protocol); - - for (i = 0; i < t->Num; ++i) - { - PROTO_OPTION *option = &t->Options[i]; - - PackAddStrEx(p, "Name", option->Name, i, t->Num); - PackAddIntEx(p, "Type", option->Type, i, t->Num); - - switch (option->Type) - { - case PROTO_OPTION_STRING: - PackAddDataEx(p, "Value", option->String, StrLen(option->String) + 1, i, t->Num); - break; - case PROTO_OPTION_BOOL: - PackAddDataEx(p, "Value", &option->Bool, sizeof(option->Bool), i, t->Num); - break; - default: - Debug("OutRpcProtoOptions(): unhandled type %u!\n", option->Type); - } - } -} -void FreeRpcProtoOptions(RPC_PROTO_OPTIONS *t) -{ - UINT i; - // Validate arguments - if (t == NULL) - { - return; - } - - Free(t->Protocol); - - for (i = 0; i < t->Num; ++i) - { - PROTO_OPTION *option = &t->Options[i]; - - Free(option->Name); - - if (option->Type == PROTO_OPTION_STRING) - { - Free(option->String); - } - } - - Free(t->Options); -} - -// RPC_SET_PASSWORD -void InRpcSetPassword(RPC_SET_PASSWORD *t, PACK *p) -{ - // Validate arguments - if (t == NULL || p == NULL) - { - return; - } - - Zero(t, sizeof(RPC_SET_PASSWORD)); - PackGetData2(p, "HashedPassword", t->HashedPassword, sizeof(t->HashedPassword)); - PackGetStr(p, "PlainTextPassword", t->PlainTextPassword, sizeof(t->PlainTextPassword)); -} -void OutRpcSetPassword(PACK *p, RPC_SET_PASSWORD *t) -{ - // Validate arguments - if (t == NULL || p == NULL) - { - return; - } - - PackAddData(p, "HashedPassword", t->HashedPassword, sizeof(t->HashedPassword)); - PackAddStr(p, "PlainTextPassword", t->PlainTextPassword); -} - -// RPC_FARM -void InRpcFarm(RPC_FARM *t, PACK *p) -{ - UINT i; - // Validate arguments - if (t == NULL || p == NULL) - { - return; - } - - Zero(t, sizeof(RPC_FARM)); - t->ServerType = PackGetInt(p, "ServerType"); - t->NumPort = PackGetIndexCount(p, "Ports"); - t->Ports = ZeroMalloc(sizeof(UINT) * t->NumPort); - for (i = 0;i < t->NumPort;i++) - { - t->Ports[i] = PackGetIntEx(p, "Ports", i); - } - t->PublicIp = PackGetIp32(p, "PublicIp"); - PackGetStr(p, "ControllerName", t->ControllerName, sizeof(t->ControllerName)); - t->ControllerPort = PackGetInt(p, "ControllerPort"); - PackGetData2(p, "MemberPassword", t->MemberPassword, sizeof(t->MemberPassword)); - PackGetStr(p, "MemberPasswordPlaintext", t->MemberPasswordPlaintext, sizeof(t->MemberPasswordPlaintext)); - t->Weight = PackGetInt(p, "Weight"); - t->ControllerOnly = PackGetBool(p, "ControllerOnly"); -} -void OutRpcFarm(PACK *p, RPC_FARM *t) -{ - UINT i; - // Validate arguments - if (t == NULL || p == NULL) - { - return; - } - - PackAddInt(p, "ServerType", t->ServerType); - for (i = 0;i < t->NumPort;i++) - { - PackAddIntEx(p, "Ports", t->Ports[i], i, t->NumPort); - } - PackAddIp32(p, "PublicIp", t->PublicIp); - PackAddStr(p, "ControllerName", t->ControllerName); - PackAddInt(p, "ControllerPort", t->ControllerPort); - PackAddData(p, "MemberPassword", t->MemberPassword, sizeof(t->MemberPassword)); - PackAddStr(p, "MemberPasswordPlaintext", t->MemberPasswordPlaintext); - PackAddInt(p, "Weight", t->Weight); - PackAddBool(p, "ControllerOnly", t->ControllerOnly); -} -void FreeRpcFarm(RPC_FARM *t) -{ - // Validate arguments - if (t == NULL) - { - return; - } - - Free(t->Ports); -} - -// RPC_FARM_HUB -void InRpcFarmHub(RPC_FARM_HUB *t, PACK *p) -{ - // Validate arguments - if (t == NULL || p == NULL) - { - return; - } - - Zero(t, sizeof(RPC_FARM_HUB)); - PackGetStr(p, "HubName", t->HubName, sizeof(t->HubName)); - t->DynamicHub = PackGetBool(p, "DynamicHub"); -} -void OutRpcFarmHub(PACK *p, RPC_FARM_HUB *t) -{ - // Validate arguments - if (t == NULL || p == NULL) - { - return; - } - - PackAddStr(p, "HubName", t->HubName); - PackAddBool(p, "DynamicHub", t->DynamicHub); -} - -// RPC_FARM_INFO -void InRpcFarmInfo(RPC_FARM_INFO *t, PACK *p) -{ - UINT i; - // Validate arguments - if (t == NULL) - { - return; - } - - Zero(t, sizeof(RPC_FARM_INFO)); - t->Id = PackGetInt(p, "Id"); - t->Controller = PackGetBool(p, "Controller"); - t->ConnectedTime = PackGetInt64(p, "ConnectedTime"); - t->Ip = PackGetIp32(p, "Ip"); - PackGetStr(p, "Hostname", t->Hostname, sizeof(t->Hostname)); - t->Point = PackGetInt(p, "Point"); - t->NumPort = PackGetIndexCount(p, "Ports"); - t->Ports = ZeroMalloc(sizeof(UINT) * t->NumPort); - for (i = 0;i < t->NumPort;i++) - { - t->Ports[i] = PackGetIntEx(p, "Ports", i); - } - t->ServerCert = PackGetX(p, "ServerCert"); - t->NumFarmHub = PackGetIndexCount(p, "HubName"); - t->FarmHubs = ZeroMalloc(sizeof(RPC_FARM_HUB) * t->NumFarmHub); - for (i = 0;i < t->NumFarmHub;i++) - { - PackGetStrEx(p, "HubName", t->FarmHubs[i].HubName, sizeof(t->FarmHubs[i].HubName), i); - t->FarmHubs[i].DynamicHub = PackGetBoolEx(p, "DynamicHub", i); - } - t->NumSessions = PackGetInt(p, "NumSessions"); - t->NumTcpConnections = PackGetInt(p, "NumTcpConnections"); - t->Weight = PackGetInt(p, "Weight"); -} -void OutRpcFarmInfo(PACK *p, RPC_FARM_INFO *t) -{ - UINT i; - // Validate arguments - if (t == NULL || p == NULL) - { - return; - } - - PackAddInt(p, "Id", t->Id); - PackAddBool(p, "Controller", t->Controller); - PackAddTime64(p, "ConnectedTime", t->ConnectedTime); - PackAddIp32(p, "Ip", t->Ip); - PackAddStr(p, "Hostname", t->Hostname); - PackAddInt(p, "Point", t->Point); - for (i = 0;i < t->NumPort;i++) - { - PackAddIntEx(p, "Ports", t->Ports[i], i, t->NumPort); - } - PackAddX(p, "ServerCert", t->ServerCert); - - PackSetCurrentJsonGroupName(p, "HubsList"); - for (i = 0;i < t->NumFarmHub;i++) - { - PackAddStrEx(p, "HubName", t->FarmHubs[i].HubName, i, t->NumFarmHub); - PackAddBoolEx(p, "DynamicHub", t->FarmHubs[i].DynamicHub, i, t->NumFarmHub); - } - PackSetCurrentJsonGroupName(p, NULL); - - PackAddInt(p, "NumSessions", t->NumSessions); - PackAddInt(p, "NumTcpConnections", t->NumTcpConnections); - PackAddInt(p, "Weight", t->Weight); -} -void FreeRpcFarmInfo(RPC_FARM_INFO *t) -{ - // Validate arguments - if (t == NULL) - { - return; - } - - Free(t->Ports); - Free(t->FarmHubs); - FreeX(t->ServerCert); -} - -void InRpcEnumFarm(RPC_ENUM_FARM *t, PACK *p) -{ - UINT i; - // Validate arguments - if (t == NULL || p == NULL) - { - return; - } - - Zero(t, sizeof(RPC_ENUM_FARM)); - t->NumFarm = PackGetIndexCount(p, "Id"); - t->Farms = ZeroMalloc(sizeof(RPC_ENUM_FARM_ITEM) * t->NumFarm); - - for (i = 0;i < t->NumFarm;i++) - { - RPC_ENUM_FARM_ITEM *e = &t->Farms[i]; - - e->Id = PackGetIntEx(p, "Id", i); - e->Controller = PackGetBoolEx(p, "Controller", i); - e->ConnectedTime = PackGetInt64Ex(p, "ConnectedTime", i); - e->Ip = PackGetIp32Ex(p, "Ip", i); - PackGetStrEx(p, "Hostname", e->Hostname, sizeof(e->Hostname), i); - e->Point = PackGetIntEx(p, "Point", i); - e->NumSessions = PackGetIntEx(p, "NumSessions", i); - e->NumTcpConnections = PackGetIntEx(p, "NumTcpConnections", i); - e->NumHubs = PackGetIntEx(p, "NumHubs", i); - e->AssignedClientLicense = PackGetIntEx(p, "AssignedClientLicense", i); - e->AssignedBridgeLicense = PackGetIntEx(p, "AssignedBridgeLicense", i); - } -} -void OutRpcEnumFarm(PACK *p, RPC_ENUM_FARM *t) -{ - UINT i; - // Validate arguments - if (t == NULL || p == NULL) - { - return; - } - - PackSetCurrentJsonGroupName(p, "FarmMemberList"); - for (i = 0;i < t->NumFarm;i++) - { - RPC_ENUM_FARM_ITEM *e = &t->Farms[i]; - - PackAddIntEx(p, "Id", e->Id, i, t->NumFarm); - PackAddBoolEx(p, "Controller", e->Controller, i, t->NumFarm); - PackAddTime64Ex(p, "ConnectedTime", e->ConnectedTime, i, t->NumFarm); - PackAddIp32Ex(p, "Ip", e->Ip, i, t->NumFarm); - PackAddStrEx(p, "Hostname", e->Hostname, i, t->NumFarm); - PackAddIntEx(p, "Point", e->Point, i, t->NumFarm); - PackAddIntEx(p, "NumSessions", e->NumSessions, i, t->NumFarm); - PackAddIntEx(p, "NumTcpConnections", e->NumTcpConnections, i, t->NumFarm); - PackAddIntEx(p, "NumHubs", e->NumHubs, i, t->NumFarm); - PackAddIntEx(p, "AssignedClientLicense", e->AssignedClientLicense, i, t->NumFarm); - PackAddIntEx(p, "AssignedBridgeLicense", e->AssignedBridgeLicense, i, t->NumFarm); - } - PackSetCurrentJsonGroupName(p, NULL); -} -void FreeRpcEnumFarm(RPC_ENUM_FARM *t) -{ - // Validate arguments - if (t == NULL) - { - return; - } - - Free(t->Farms); -} - -// RPC_FARM_CONNECTION_STATUS -void InRpcFarmConnectionStatus(RPC_FARM_CONNECTION_STATUS *t, PACK *p) -{ - Zero(t, sizeof(RPC_FARM_CONNECTION_STATUS)); - // Validate arguments - if (t == NULL || p == NULL) - { - return; - } - - t->Ip = PackGetIp32(p, "Ip"); - t->Port = PackGetInt(p, "Port"); - t->Online = PackGetBool(p, "Online"); - t->LastError = PackGetInt(p, "LastError"); - t->StartedTime = PackGetInt64(p, "StartedTime"); - t->CurrentConnectedTime = PackGetInt64(p, "CurrentConnectedTime"); - t->FirstConnectedTime = PackGetInt64(p, "FirstConnectedTime"); - t->NumConnected = PackGetInt(p, "NumConnected"); - t->NumTry = PackGetInt(p, "NumTry"); - t->NumFailed = PackGetInt(p, "NumFailed"); -} -void OutRpcFarmConnectionStatus(PACK *p, RPC_FARM_CONNECTION_STATUS *t) -{ - // Validate arguments - if (t == NULL || p == NULL) - { - return; - } - - PackAddIp32(p, "Ip", t->Ip); - PackAddInt(p, "Port", t->Port); - PackAddBool(p, "Online", t->Online); - PackAddInt(p, "LastError", t->LastError); - PackAddTime64(p, "StartedTime", t->StartedTime); - PackAddTime64(p, "CurrentConnectedTime", t->CurrentConnectedTime); - PackAddTime64(p, "FirstConnectedTime", t->FirstConnectedTime); - PackAddInt(p, "NumConnected", t->NumConnected); - PackAddInt(p, "NumTry", t->NumTry); - PackAddInt(p, "NumFailed", t->NumFailed); -} - -// RPC_HUB_OPTION -void InRpcHubOption(RPC_HUB_OPTION *t, PACK *p) -{ - // Validate arguments - if (t == NULL || p == NULL) - { - return; - } - - Zero(t, sizeof(RPC_HUB_OPTION)); - t->MaxSession = PackGetInt(p, "MaxSession"); - t->NoEnum = PackGetBool(p, "NoEnum"); -} -void OutRpcHubOption(PACK *p, RPC_HUB_OPTION *t) -{ - // Validate arguments - if (t == NULL || p == NULL) - { - return; - } - - PackAddInt(p, "MaxSession", t->MaxSession); - PackAddBool(p, "NoEnum", t->NoEnum); -} - -// RPC_RADIUS -void InRpcRadius(RPC_RADIUS *t, PACK *p) -{ - // Validate arguments - if (t == NULL || p == NULL) - { - return; - } - - Zero(t, sizeof(RPC_RADIUS)); - PackGetStr(p, "RadiusServerName", t->RadiusServerName, sizeof(t->RadiusServerName)); - t->RadiusPort = PackGetInt(p, "RadiusPort"); - PackGetStr(p, "HubName", t->HubName, sizeof(t->HubName)); - PackGetStr(p, "RadiusSecret", t->RadiusSecret, sizeof(t->RadiusSecret)); - t->RadiusRetryInterval = PackGetInt(p, "RadiusRetryInterval"); -} -void OutRpcRadius(PACK *p, RPC_RADIUS *t) -{ - // Validate arguments - if (t == NULL || p == NULL) - { - return; - } - - PackAddStr(p, "RadiusServerName", t->RadiusServerName); - PackAddInt(p, "RadiusPort", t->RadiusPort); - PackAddStr(p, "HubName", t->HubName); - PackAddStr(p, "RadiusSecret", t->RadiusSecret); - PackAddInt(p, "RadiusRetryInterval", t->RadiusRetryInterval); -} - -// RPC_HUB -void InRpcHub(RPC_HUB *t, PACK *p) -{ - // Validate arguments - if (t == NULL || p == NULL) - { - return; - } - - Zero(t, sizeof(RPC_HUB)); - PackGetStr(p, "HubName", t->HubName, sizeof(t->HubName)); -} -void OutRpcHub(PACK *p, RPC_HUB *t) -{ - // Validate arguments - if (t == NULL || p == NULL) - { - return; - } - - PackAddStr(p, "HubName", t->HubName); -} - -// RPC_CREATE_HUB -void InRpcCreateHub(RPC_CREATE_HUB *t, PACK *p) -{ - // Validate arguments - if (t == NULL || p == NULL) - { - return; - } - - Zero(t, sizeof(RPC_CREATE_HUB)); - PackGetStr(p, "HubName", t->HubName, sizeof(t->HubName)); - PackGetData2(p, "HashedPassword", t->HashedPassword, sizeof(t->HashedPassword)); - PackGetData2(p, "SecurePassword", t->SecurePassword, sizeof(t->SecurePassword)); - PackGetStr(p, "AdminPasswordPlainText", t->AdminPasswordPlainText, sizeof(t->AdminPasswordPlainText)); - t->Online = PackGetBool(p, "Online"); - InRpcHubOption(&t->HubOption, p); - t->HubType = PackGetInt(p, "HubType"); -} -void OutRpcCreateHub(PACK *p, RPC_CREATE_HUB *t) -{ - // Validate arguments - if (t == NULL || p == NULL) - { - return; - } - - PackAddStr(p, "HubName", t->HubName); - PackAddData(p, "HashedPassword", t->HashedPassword, sizeof(t->HashedPassword)); - PackAddData(p, "SecurePassword", t->SecurePassword, sizeof(t->SecurePassword)); - PackAddBool(p, "Online", t->Online); - PackAddStr(p, "AdminPasswordPlainText", t->AdminPasswordPlainText); - OutRpcHubOption(p, &t->HubOption); - PackAddInt(p, "HubType", t->HubType); -} - -// RPC_ENUM_HUB -void InRpcEnumHub(RPC_ENUM_HUB *t, PACK *p) -{ - UINT i; - // Validate arguments - if (t == NULL || p == NULL) - { - return; - } - - Zero(t, sizeof(RPC_ENUM_HUB)); - t->NumHub = PackGetIndexCount(p, "HubName"); - t->Hubs = ZeroMalloc(sizeof(RPC_ENUM_HUB_ITEM) * t->NumHub); - - for (i = 0;i < t->NumHub;i++) - { - RPC_ENUM_HUB_ITEM *e = &t->Hubs[i]; - - PackGetStrEx(p, "HubName", e->HubName, sizeof(e->HubName), i); - e->Online = PackGetBoolEx(p, "Online", i); - e->HubType = PackGetIntEx(p, "HubType", i); - e->NumSessions = PackGetIntEx(p, "NumSessions", i); - e->NumUsers = PackGetIntEx(p, "NumUsers", i); - e->NumGroups = PackGetIntEx(p, "NumGroups", i); - e->NumMacTables = PackGetIntEx(p, "NumMacTables", i); - e->NumIpTables = PackGetIntEx(p, "NumIpTables", i); - e->LastCommTime = PackGetInt64Ex(p, "LastCommTime", i); - e->CreatedTime = PackGetInt64Ex(p, "CreatedTime", i); - e->LastLoginTime = PackGetInt64Ex(p, "LastLoginTime", i); - e->NumLogin = PackGetIntEx(p, "NumLogin", i); - e->IsTrafficFilled = PackGetBoolEx(p, "IsTrafficFilled", i); - - InRpcTrafficEx(&e->Traffic, p, i); - } -} -void OutRpcEnumHub(PACK *p, RPC_ENUM_HUB *t) -{ - UINT i; - // Validate arguments - if (t == NULL || p == NULL) - { - return; - } - - PackSetCurrentJsonGroupName(p, "HubList"); - for (i = 0;i < t->NumHub;i++) - { - RPC_ENUM_HUB_ITEM *e = &t->Hubs[i]; - - PackAddStrEx(p, "HubName", e->HubName, i, t->NumHub); - PackAddBoolEx(p, "Online", e->Online, i, t->NumHub); - PackAddIntEx(p, "HubType", e->HubType, i, t->NumHub); - PackAddIntEx(p, "NumSessions", e->NumSessions, i, t->NumHub); - PackAddIntEx(p, "NumUsers", e->NumUsers, i, t->NumHub); - PackAddIntEx(p, "NumGroups", e->NumGroups, i, t->NumHub); - PackAddIntEx(p, "NumMacTables", e->NumMacTables, i, t->NumHub); - PackAddIntEx(p, "NumIpTables", e->NumIpTables, i, t->NumHub); - PackAddTime64Ex(p, "LastCommTime", e->LastCommTime, i, t->NumHub); - PackAddTime64Ex(p, "CreatedTime", e->CreatedTime, i, t->NumHub); - PackAddTime64Ex(p, "LastLoginTime", e->LastLoginTime, i, t->NumHub); - PackAddIntEx(p, "NumLogin", e->NumLogin, i, t->NumHub); - PackAddBoolEx(p, "IsTrafficFilled", e->IsTrafficFilled, i, t->NumHub); - - OutRpcTrafficEx(&e->Traffic, p, i, t->NumHub); - } - PackSetCurrentJsonGroupName(p, NULL); -} -void FreeRpcEnumHub(RPC_ENUM_HUB *t) -{ - // Validate arguments - if (t == NULL) - { - return; - } - - Free(t->Hubs); -} - -// RPC_DELETE_HUB -void InRpcDeleteHub(RPC_DELETE_HUB *t, PACK *p) -{ - // Validate arguments - if (t == NULL || p == NULL) - { - return; - } - - Zero(t, sizeof(RPC_DELETE_HUB)); - PackGetStr(p, "HubName", t->HubName, sizeof(t->HubName)); -} -void OutRpcDeleteHub(PACK *p, RPC_DELETE_HUB *t) -{ - // Validate arguments - if (t == NULL || p == NULL) - { - return; - } - - PackAddStr(p, "HubName", t->HubName); -} - -// RPC_ENUM_CONNECTION -void InRpcEnumConnection(RPC_ENUM_CONNECTION *t, PACK *p) -{ - UINT i; - // Validate arguments - if (t == NULL || p == NULL) - { - return; - } - - Zero(t, sizeof(RPC_ENUM_CONNECTION)); - t->NumConnection = PackGetIndexCount(p, "Name"); - t->Connections = ZeroMalloc(sizeof(RPC_ENUM_CONNECTION_ITEM) * t->NumConnection); - - for (i = 0;i < t->NumConnection;i++) - { - RPC_ENUM_CONNECTION_ITEM *e = &t->Connections[i]; - - e->Ip = PackGetIp32Ex(p, "Ip", i); - e->Port = PackGetIntEx(p, "Port", i); - PackGetStrEx(p, "Name", e->Name, sizeof(e->Name), i); - PackGetStrEx(p, "Hostname", e->Hostname, sizeof(e->Hostname), i); - e->ConnectedTime = PackGetInt64Ex(p, "ConnectedTime", i); - e->Type = PackGetIntEx(p, "Type", i); - } -} -void OutRpcEnumConnection(PACK *p, RPC_ENUM_CONNECTION *t) -{ - UINT i; - // Validate arguments - if (t == NULL || p == NULL) - { - return; - } - - PackSetCurrentJsonGroupName(p, "ConnectionList"); - for (i = 0;i < t->NumConnection;i++) - { - RPC_ENUM_CONNECTION_ITEM *e = &t->Connections[i]; - - PackAddIp32Ex(p, "Ip", e->Ip, i, t->NumConnection); - PackAddIntEx(p, "Port", e->Port, i, t->NumConnection); - PackAddStrEx(p, "Name", e->Name, i, t->NumConnection); - PackAddStrEx(p, "Hostname", e->Hostname, i, t->NumConnection); - PackAddTime64Ex(p, "ConnectedTime", e->ConnectedTime, i, t->NumConnection); - PackAddIntEx(p, "Type", e->Type, i, t->NumConnection); - } - PackSetCurrentJsonGroupName(p, NULL); -} -void FreeRpcEnumConnection(RPC_ENUM_CONNECTION *t) -{ - // Validate arguments - if (t == NULL) - { - return; - } - - Free(t->Connections); -} - -// RPC_DISCONNECT_CONNECTION -void InRpcDisconnectConnection(RPC_DISCONNECT_CONNECTION *t, PACK *p) -{ - // Validate arguments - if (t == NULL || p == NULL) - { - return; - } - - Zero(t, sizeof(RPC_DISCONNECT_CONNECTION)); - PackGetStr(p, "Name", t->Name, sizeof(t->Name)); -} -void OutRpcDisconnectConnection(PACK *p, RPC_DISCONNECT_CONNECTION *t) -{ - // Validate arguments - if (t == NULL || p == NULL) - { - return; - } - - PackAddStr(p, "Name", t->Name); -} - -// RPC_CONNECTION_INFO -void InRpcConnectionInfo(RPC_CONNECTION_INFO *t, PACK *p) -{ - // Validate arguments - if (t == NULL || p == NULL) - { - return; - } - - Zero(t, sizeof(RPC_CONNECTION_INFO)); - PackGetStr(p, "Name", t->Name, sizeof(t->Name)); - t->Ip = PackGetIp32(p, "Ip"); - t->Port = PackGetInt(p, "Port"); - t->ConnectedTime = PackGetInt64(p, "ConnectedTime"); - PackGetStr(p, "Hostname", t->Hostname, sizeof(t->Hostname)); - PackGetStr(p, "ServerStr", t->ServerStr, sizeof(t->ServerStr)); - PackGetStr(p, "ClientStr", t->ClientStr, sizeof(t->ClientStr)); - t->ServerVer = PackGetInt(p, "ServerVer"); - t->ServerBuild = PackGetInt(p, "ServerBuild"); - t->ClientVer = PackGetInt(p, "ClientVer"); - t->ClientBuild = PackGetInt(p, "ClientBuild"); - t->Type = PackGetInt(p, "Type"); -} -void OutRpcConnectionInfo(PACK *p, RPC_CONNECTION_INFO *t) -{ - // Validate arguments - if (t == NULL || p == NULL) - { - return; - } - - PackAddStr(p, "Name", t->Name); - PackAddIp32(p, "Ip", t->Ip); - PackAddInt(p, "Port", t->Port); - PackAddTime64(p, "ConnectedTime", t->ConnectedTime); - PackAddStr(p, "Hostname", t->Hostname); - PackAddStr(p, "ServerStr", t->ServerStr); - PackAddStr(p, "ClientStr", t->ClientStr); - PackAddInt(p, "ServerVer", t->ServerVer); - PackAddInt(p, "ServerBuild", t->ServerBuild); - PackAddInt(p, "ClientVer", t->ClientVer); - PackAddInt(p, "ClientBuild", t->ClientBuild); - PackAddInt(p, "Type", t->Type); -} - -// RPC_SET_HUB_ONLINE -void InRpcSetHubOnline(RPC_SET_HUB_ONLINE *t, PACK *p) -{ - // Validate arguments - if (t == NULL || p == NULL) - { - return; - } - - Zero(t, sizeof(RPC_SET_HUB_ONLINE)); - PackGetStr(p, "HubName", t->HubName, sizeof(t->HubName)); - t->Online = PackGetBool(p, "Online"); -} -void OutRpcSetHubOnline(PACK *p, RPC_SET_HUB_ONLINE *t) -{ - // Validate arguments - if (t == NULL || p == NULL) - { - return; - } - - PackAddStr(p, "HubName", t->HubName); - PackAddBool(p, "Online", t->Online); -} - -// RPC_HUB_STATUS -void InRpcHubStatus(RPC_HUB_STATUS *t, PACK *p) -{ - Zero(t, sizeof(RPC_HUB_STATUS)); - // Validate arguments - if (t == NULL || p == NULL) - { - return; - } - - PackGetStr(p, "HubName", t->HubName, sizeof(t->HubName)); - t->Online = PackGetBool(p, "Online"); - t->HubType = PackGetInt(p, "HubType"); - t->NumSessions = PackGetInt(p, "NumSessions"); - t->NumSessionsClient = PackGetInt(p, "NumSessionsClient"); - t->NumSessionsBridge = PackGetInt(p, "NumSessionsBridge"); - t->NumAccessLists = PackGetInt(p, "NumAccessLists"); - t->NumUsers = PackGetInt(p, "NumUsers"); - t->NumGroups = PackGetInt(p, "NumGroups"); - t->NumMacTables = PackGetInt(p, "NumMacTables"); - t->NumIpTables = PackGetInt(p, "NumIpTables"); - t->SecureNATEnabled = PackGetBool(p, "SecureNATEnabled"); - InRpcTraffic(&t->Traffic, p); - t->LastCommTime = PackGetInt64(p, "LastCommTime"); - t->CreatedTime = PackGetInt64(p, "CreatedTime"); - t->LastLoginTime = PackGetInt64(p, "LastLoginTime"); - t->NumLogin = PackGetInt(p, "NumLogin"); -} -void OutRpcHubStatus(PACK *p, RPC_HUB_STATUS *t) -{ - // Validate arguments - if (t == NULL || p == NULL) - { - return; - } - - PackAddStr(p, "HubName", t->HubName); - PackAddBool(p, "Online", t->Online); - PackAddInt(p, "HubType", t->HubType); - PackAddInt(p, "NumSessions", t->NumSessions); - PackAddInt(p, "NumSessionsClient", t->NumSessionsClient); - PackAddInt(p, "NumSessionsBridge", t->NumSessionsBridge); - PackAddInt(p, "NumAccessLists", t->NumAccessLists); - PackAddInt(p, "NumUsers", t->NumUsers); - PackAddInt(p, "NumGroups", t->NumGroups); - PackAddInt(p, "NumMacTables", t->NumMacTables); - PackAddInt(p, "NumIpTables", t->NumIpTables); - PackAddBool(p, "SecureNATEnabled", t->SecureNATEnabled); - OutRpcTraffic(p, &t->Traffic); - PackAddTime64(p, "LastCommTime", t->LastCommTime); - PackAddTime64(p, "CreatedTime", t->CreatedTime); - PackAddTime64(p, "LastLoginTime", t->LastLoginTime); - PackAddInt(p, "NumLogin", t->NumLogin); -} - -// RPC_HUB_LOG -void InRpcHubLog(RPC_HUB_LOG *t, PACK *p) -{ - UINT i; - // Validate arguments - if (t == NULL || p == NULL) - { - return; - } - - Zero(t, sizeof(RPC_HUB_LOG)); - PackGetStr(p, "HubName", t->HubName, sizeof(t->HubName)); - t->LogSetting.SaveSecurityLog = PackGetBool(p, "SaveSecurityLog"); - t->LogSetting.SecurityLogSwitchType = PackGetInt(p, "SecurityLogSwitchType"); - t->LogSetting.SavePacketLog = PackGetBool(p, "SavePacketLog"); - t->LogSetting.PacketLogSwitchType = PackGetInt(p, "PacketLogSwitchType"); - for (i = 0;i < NUM_PACKET_LOG;i++) - { - t->LogSetting.PacketLogConfig[i] = PackGetIntEx(p, "PacketLogConfig", i); - } -} -void OutRpcHubLog(PACK *p, RPC_HUB_LOG *t) -{ - UINT i; - // Validate arguments - if (t == NULL || p == NULL) - { - return; - } - - PackAddStr(p, "HubName", t->HubName); - PackAddBool(p, "SaveSecurityLog", t->LogSetting.SaveSecurityLog); - PackAddInt(p, "SecurityLogSwitchType", t->LogSetting.SecurityLogSwitchType); - PackAddBool(p, "SavePacketLog", t->LogSetting.SavePacketLog); - PackAddInt(p, "PacketLogSwitchType", t->LogSetting.PacketLogSwitchType); - for (i = 0;i < NUM_PACKET_LOG;i++) - { - PackAddIntEx(p, "PacketLogConfig", t->LogSetting.PacketLogConfig[i], i, NUM_PACKET_LOG); - } -} - -// RPC_HUB_ADD_CA -void InRpcHubAddCa(RPC_HUB_ADD_CA *t, PACK *p) -{ - // Validate arguments - if (t == NULL || p == NULL) - { - return; - } - - Zero(t, sizeof(RPC_HUB_ADD_CA)); - PackGetStr(p, "HubName", t->HubName, sizeof(t->HubName)); - t->Cert = PackGetX(p, "Cert"); -} -void OutRpcHubAddCa(PACK *p, RPC_HUB_ADD_CA *t) -{ - // Validate arguments - if (t == NULL || p == NULL) - { - return; - } - - PackAddStr(p, "HubName", t->HubName); - PackAddX(p, "Cert", t->Cert); -} -void FreeRpcHubAddCa(RPC_HUB_ADD_CA *t) -{ - // Validate arguments - if (t == NULL) - { - return; - } - - FreeX(t->Cert); -} - -// RPC_HUB_ENUM_CA -void InRpcHubEnumCa(RPC_HUB_ENUM_CA *t, PACK *p) -{ - UINT i; - // Validate arguments - if (t == NULL || p == NULL) - { - return; - } - - Zero(t, sizeof(RPC_HUB_ENUM_CA)); - PackGetStr(p, "HubName", t->HubName, sizeof(t->HubName)); - t->NumCa = PackGetIndexCount(p, "Key"); - t->Ca = ZeroMalloc(sizeof(RPC_HUB_ENUM_CA_ITEM) * t->NumCa); - - for (i = 0;i < t->NumCa;i++) - { - RPC_HUB_ENUM_CA_ITEM *e = &t->Ca[i]; - - e->Key = PackGetIntEx(p, "Key", i); - PackGetUniStrEx(p, "SubjectName", e->SubjectName, sizeof(e->SubjectName), i); - PackGetUniStrEx(p, "IssuerName", e->IssuerName, sizeof(e->IssuerName), i); - e->Expires = PackGetInt64Ex(p, "Expires", i); - } -} -void OutRpcHubEnumCa(PACK *p, RPC_HUB_ENUM_CA *t) -{ - UINT i; - // Validate arguments - if (t == NULL || p == NULL) - { - return; - } - PackAddStr(p, "HubName", t->HubName); - - PackSetCurrentJsonGroupName(p, "CAList"); - for (i = 0;i < t->NumCa;i++) - { - RPC_HUB_ENUM_CA_ITEM *e = &t->Ca[i]; - - PackAddIntEx(p, "Key", e->Key, i, t->NumCa); - PackAddUniStrEx(p, "SubjectName", e->SubjectName, i, t->NumCa); - PackAddUniStrEx(p, "IssuerName", e->IssuerName, i, t->NumCa); - PackAddTime64Ex(p, "Expires", e->Expires, i, t->NumCa); - } - PackSetCurrentJsonGroupName(p, NULL); -} -void FreeRpcHubEnumCa(RPC_HUB_ENUM_CA *t) -{ - // Validate arguments - if (t == NULL) - { - return; - } - - Free(t->Ca); -} - -// RPC_HUB_GET_CA -void InRpcHubGetCa(RPC_HUB_GET_CA *t, PACK *p) -{ - // Validate arguments - if (t == NULL || p == NULL) - { - return; - } - - Zero(t, sizeof(RPC_HUB_GET_CA)); - PackGetStr(p, "HubName", t->HubName, sizeof(t->HubName)); - t->Key = PackGetInt(p, "Key"); - t->Cert = PackGetX(p, "Cert"); -} -void OutRpcHubGetCa(PACK *p, RPC_HUB_GET_CA *t) -{ - // Validate arguments - if (t == NULL || p == NULL) - { - return; - } - - PackAddStr(p, "HubName", t->HubName); - PackAddInt(p, "Key", t->Key); - PackAddX(p, "Cert", t->Cert); -} -void FreeRpcHubGetCa(RPC_HUB_GET_CA *t) -{ - // Validate arguments - if (t == NULL) - { - return; - } - - FreeX(t->Cert); -} - -// RPC_HUB_DELETE_CA -void InRpcHubDeleteCa(RPC_HUB_DELETE_CA *t, PACK *p) -{ - // Validate arguments - if (t == NULL || p == NULL) - { - return; - } - - Zero(t, sizeof(RPC_HUB_DELETE_CA)); - PackGetStr(p, "HubName", t->HubName, sizeof(t->HubName)); - t->Key = PackGetInt(p, "Key"); -} -void OutRpcHubDeleteCa(PACK *p, RPC_HUB_DELETE_CA *t) -{ - // Validate arguments - if (t == NULL || p == NULL) - { - return; - } - - PackAddStr(p, "HubName", t->HubName); - PackAddInt(p, "Key", t->Key); -} - -// RPC_CREATE_LINK -void InRpcCreateLink(RPC_CREATE_LINK *t, PACK *p) -{ - BUF *b; - // Validate arguments - if (t == NULL || p == NULL) - { - return; - } - - Zero(t, sizeof(RPC_CREATE_LINK)); - PackGetStr(p, "HubName_Ex", t->HubName, sizeof(t->HubName)); - t->Online = PackGetBool(p, "Online"); - t->ClientOption = ZeroMalloc(sizeof(CLIENT_OPTION)); - InRpcClientOption(t->ClientOption, p); - t->ClientAuth = ZeroMalloc(sizeof(CLIENT_AUTH)); - InRpcClientAuth(t->ClientAuth, p); - InRpcPolicy(&t->Policy, p); - - t->CheckServerCert = PackGetBool(p, "CheckServerCert"); - b = PackGetBuf(p, "ServerCert"); - if (b != NULL) - { - t->ServerCert = BufToX(b, false); - FreeBuf(b); - } -} -void OutRpcCreateLink(PACK *p, RPC_CREATE_LINK *t) -{ - // Validate arguments - if (t == NULL || p == NULL) - { - return; - } - - PackAddStr(p, "HubName_Ex",t->HubName); - PackAddBool(p, "Online", t->Online); - OutRpcClientOption(p, t->ClientOption); - OutRpcClientAuth(p, t->ClientAuth); - OutRpcPolicy(p, &t->Policy); - - PackAddBool(p, "CheckServerCert", t->CheckServerCert); - if (t->ServerCert != NULL) - { - BUF *b; - b = XToBuf(t->ServerCert, false); - PackAddBuf(p, "ServerCert", b); - FreeBuf(b); - } -} -void FreeRpcCreateLink(RPC_CREATE_LINK *t) -{ - // Validate arguments - if (t == NULL) - { - return; - } - - if (t->ServerCert != NULL) - { - FreeX(t->ServerCert); - } - Free(t->ClientOption); - CiFreeClientAuth(t->ClientAuth); -} - -// RPC_ENUM_LINK -void InRpcEnumLink(RPC_ENUM_LINK *t, PACK *p) -{ - UINT i; - // Validate arguments - if (t == NULL || p == NULL) - { - return; - } - - Zero(t, sizeof(RPC_ENUM_LINK)); - PackGetStr(p, "HubName", t->HubName, sizeof(t->HubName)); - t->NumLink = PackGetIndexCount(p, "AccountName"); - t->Links = ZeroMalloc(sizeof(RPC_ENUM_LINK_ITEM) * t->NumLink); - - for (i = 0;i < t->NumLink;i++) - { - RPC_ENUM_LINK_ITEM *e = &t->Links[i]; - - PackGetUniStrEx(p, "AccountName", e->AccountName, sizeof(e->AccountName), i); - PackGetStrEx(p, "Hostname", e->Hostname, sizeof(e->Hostname), i); - PackGetStrEx(p, "ConnectedHubName", e->HubName, sizeof(e->HubName), i); - e->Online = PackGetBoolEx(p, "Online", i); - e->ConnectedTime = PackGetInt64Ex(p, "ConnectedTime", i); - e->Connected = PackGetBoolEx(p, "Connected", i); - e->LastError = PackGetIntEx(p, "LastError", i); - PackGetStrEx(p, "LinkHubName", e->HubName, sizeof(e->HubName), i); - } -} -void OutRpcEnumLink(PACK *p, RPC_ENUM_LINK *t) -{ - UINT i; - // Validate arguments - if (t == NULL || p == NULL) - { - return; - } - - PackAddStr(p, "HubName", t->HubName); - - PackSetCurrentJsonGroupName(p, "LinkList"); - for (i = 0;i < t->NumLink;i++) - { - RPC_ENUM_LINK_ITEM *e = &t->Links[i]; - - PackAddUniStrEx(p, "AccountName", e->AccountName, i, t->NumLink); - PackAddStrEx(p, "ConnectedHubName", e->HubName, i, t->NumLink); - PackAddStrEx(p, "Hostname", e->Hostname, i, t->NumLink); - PackAddBoolEx(p, "Online", e->Online, i, t->NumLink); - PackAddTime64Ex(p, "ConnectedTime", e->ConnectedTime, i, t->NumLink); - PackAddBoolEx(p, "Connected", e->Connected, i, t->NumLink); - PackAddIntEx(p, "LastError", e->LastError, i, t->NumLink); - PackAddStrEx(p, "TargetHubName", e->HubName, i, t->NumLink); - } - PackSetCurrentJsonGroupName(p, NULL); -} -void FreeRpcEnumLink(RPC_ENUM_LINK *t) -{ - // Validate arguments - if (t == NULL) - { - return; - } - - Free(t->Links); -} - -// RPC_LINK_STATUS -void InRpcLinkStatus(RPC_LINK_STATUS *t, PACK *p) -{ - // Validate arguments - if (t == NULL || p == NULL) - { - return; - } - - Zero(t, sizeof(RPC_LINK_STATUS)); - PackGetStr(p, "HubName_Ex", t->HubName, sizeof(t->HubName)); - PackGetUniStr(p, "AccountName", t->AccountName, sizeof(t->AccountName)); - InRpcClientGetConnectionStatus(&t->Status, p); -} -void OutRpcLinkStatus(PACK *p, RPC_LINK_STATUS *t) -{ - // Validate arguments - if (t == NULL || p == NULL) - { - return; - } - - PackAddStr(p, "HubName_Ex", t->HubName); - PackAddUniStr(p, "AccountName", t->AccountName); - OutRpcClientGetConnectionStatus(p, &t->Status); -} -void FreeRpcLinkStatus(RPC_LINK_STATUS *t) -{ - // Validate arguments - if (t == NULL) - { - return; - } - - CiFreeClientGetConnectionStatus(&t->Status); -} - -// RPC_LINK -void InRpcLink(RPC_LINK *t, PACK *p) -{ - // Validate arguments - if (t == NULL || p == NULL) - { - return; - } - - Zero(t, sizeof(RPC_LINK)); - PackGetStr(p, "HubName", t->HubName, sizeof(t->HubName)); - PackGetUniStr(p, "AccountName", t->AccountName, sizeof(t->AccountName)); -} -void OutRpcLink(PACK *p, RPC_LINK *t) -{ - // Validate arguments - if (t == NULL) - { - return; - } - - PackAddStr(p, "HubName", t->HubName); - PackAddUniStr(p, "AccountName", t->AccountName); -} - -// RPC_RENAME_LINK -void InRpcRenameLink(RPC_RENAME_LINK *t, PACK *p) -{ - // Validate arguments - if (t == NULL || p == NULL) - { - return; - } - - Zero(t, sizeof(RPC_RENAME_LINK)); - PackGetStr(p, "HubName", t->HubName, sizeof(t->HubName)); - PackGetUniStr(p, "OldAccountName", t->OldAccountName, sizeof(t->OldAccountName)); - PackGetUniStr(p, "NewAccountName", t->NewAccountName, sizeof(t->NewAccountName)); -} -void OutRpcRenameLink(PACK *p, RPC_RENAME_LINK *t) -{ - // Validate arguments - if (p == NULL || t == NULL) - { - return; - } - - PackAddStr(p, "HubName", t->HubName); - PackAddUniStr(p, "OldAccountName", t->OldAccountName); - PackAddUniStr(p, "NewAccountName", t->NewAccountName); -} - -// ACCESS -void InRpcAccessEx(ACCESS *a, PACK *p, UINT index) -{ - // Validate arguments - if (a == NULL || p == NULL) - { - return; - } - - Zero(a, sizeof(ACCESS)); - a->Id = PackGetIntEx(p, "Id", index); - PackGetUniStrEx(p, "Note", a->Note, sizeof(a->Note), index); - a->Active = PackGetBoolEx(p, "Active", index); - a->Priority = PackGetIntEx(p, "Priority", index); - a->Discard = PackGetBoolEx(p, "Discard", index); - a->SrcIpAddress = PackGetIp32Ex(p, "SrcIpAddress", index); - a->SrcSubnetMask = PackGetIp32Ex(p, "SrcSubnetMask", index); - a->DestIpAddress = PackGetIp32Ex(p, "DestIpAddress", index); - a->DestSubnetMask = PackGetIp32Ex(p, "DestSubnetMask", index); - a->Protocol = PackGetIntEx(p, "Protocol", index); - a->SrcPortStart = PackGetIntEx(p, "SrcPortStart", index); - a->SrcPortEnd = PackGetIntEx(p, "SrcPortEnd", index); - a->DestPortStart = PackGetIntEx(p, "DestPortStart", index); - a->DestPortEnd = PackGetIntEx(p, "DestPortEnd", index); - //a->SrcUsernameHash = PackGetIntEx(p, "SrcUsernameHash", index); - PackGetStrEx(p, "SrcUsername", a->SrcUsername, sizeof(a->SrcUsername), index); - //a->DestUsernameHash = PackGetIntEx(p, "DestUsernameHash", index); - PackGetStrEx(p, "DestUsername", a->DestUsername, sizeof(a->DestUsername), index); - a->CheckSrcMac = PackGetBoolEx(p, "CheckSrcMac", index); - PackGetDataEx2(p, "SrcMacAddress", a->SrcMacAddress, sizeof(a->SrcMacAddress), index); - PackGetDataEx2(p, "SrcMacMask", a->SrcMacMask, sizeof(a->SrcMacMask), index); - a->CheckDstMac = PackGetBoolEx(p, "CheckDstMac", index); - PackGetDataEx2(p, "DstMacAddress", a->DstMacAddress, sizeof(a->DstMacAddress), index); - PackGetDataEx2(p, "DstMacMask", a->DstMacMask, sizeof(a->DstMacMask), index); - a->CheckTcpState = PackGetBoolEx(p, "CheckTcpState", index); - a->Established = PackGetBoolEx(p, "Established", index); - a->Delay = PackGetIntEx(p, "Delay", index); - a->Jitter = PackGetIntEx(p, "Jitter", index); - a->Loss = PackGetIntEx(p, "Loss", index); - a->IsIPv6 = PackGetBoolEx(p, "IsIPv6", index); - a->UniqueId = PackGetIntEx(p, "UniqueId", index); - PackGetStrEx(p, "RedirectUrl", a->RedirectUrl, sizeof(a->RedirectUrl), index); - if (a->IsIPv6) - { - PackGetIp6AddrEx(p, "SrcIpAddress6", &a->SrcIpAddress6, index); - PackGetIp6AddrEx(p, "SrcSubnetMask6", &a->SrcSubnetMask6, index); - PackGetIp6AddrEx(p, "DestIpAddress6", &a->DestIpAddress6, index); - PackGetIp6AddrEx(p, "DestSubnetMask6", &a->DestSubnetMask6, index); - } -} -void InRpcAccess(ACCESS *a, PACK *p) -{ - // Validate arguments - if (a == NULL || p == NULL) - { - return; - } - - InRpcAccessEx(a, p, 0); -} -void OutRpcAccessEx(PACK *p, ACCESS *a, UINT index, UINT total) -{ - // Validate arguments - if (a == NULL || p == NULL) - { - return; - } - - PackAddIntEx(p, "Id", a->Id, index, total); - PackAddUniStrEx(p, "Note", a->Note, index, total); - PackAddBoolEx(p, "Active", a->Active, index, total); - PackAddIntEx(p, "Priority", a->Priority, index, total); - PackAddBoolEx(p, "Discard", a->Discard, index, total); - if (a->IsIPv6) - { - PackAddIp32Ex(p, "SrcIpAddress", 0xFDFFFFDF, index, total); - PackAddIp32Ex(p, "SrcSubnetMask", 0xFFFFFFFF, index, total); - PackAddIp32Ex(p, "DestIpAddress", 0xFDFFFFDF, index, total); - PackAddIp32Ex(p, "DestSubnetMask", 0xFFFFFFFF, index, total); - } - else - { - PackAddIp32Ex(p, "SrcIpAddress", a->SrcIpAddress, index, total); - PackAddIp32Ex(p, "SrcSubnetMask", a->SrcSubnetMask, index, total); - PackAddIp32Ex(p, "DestIpAddress", a->DestIpAddress, index, total); - PackAddIp32Ex(p, "DestSubnetMask", a->DestSubnetMask, index, total); - } - PackAddIntEx(p, "Protocol", a->Protocol, index, total); - PackAddIntEx(p, "SrcPortStart", a->SrcPortStart, index, total); - PackAddIntEx(p, "SrcPortEnd", a->SrcPortEnd, index, total); - PackAddIntEx(p, "DestPortStart", a->DestPortStart, index, total); - PackAddIntEx(p, "DestPortEnd", a->DestPortEnd, index, total); - //PackAddIntEx(p, "SrcUsernameHash", a->SrcUsernameHash, index, total); - PackAddStrEx(p, "SrcUsername", a->SrcUsername, index, total); - //PackAddIntEx(p, "DestUsernameHash", a->DestUsernameHash, index, total); - PackAddStrEx(p, "DestUsername", a->DestUsername, index, total); - PackAddBoolEx(p, "CheckSrcMac", a->CheckSrcMac, index, total); - PackAddDataEx(p, "SrcMacAddress", a->SrcMacAddress, sizeof(a->SrcMacAddress), index, total); - PackAddDataEx(p, "SrcMacMask", a->SrcMacMask, sizeof(a->SrcMacMask), index, total); - PackAddBoolEx(p, "CheckDstMac", a->CheckDstMac, index, total); - PackAddDataEx(p, "DstMacAddress", a->DstMacAddress, sizeof(a->DstMacAddress), index, total); - PackAddDataEx(p, "DstMacMask", a->DstMacMask, sizeof(a->DstMacMask), index, total); - PackAddBoolEx(p, "CheckTcpState", a->CheckTcpState, index, total); - PackAddBoolEx(p, "Established", a->Established, index, total); - PackAddIntEx(p, "Delay", a->Delay, index, total); - PackAddIntEx(p, "Jitter", a->Jitter, index, total); - PackAddIntEx(p, "Loss", a->Loss, index, total); - PackAddBoolEx(p, "IsIPv6", a->IsIPv6, index, total); - PackAddIntEx(p, "UniqueId", a->UniqueId, index, total); - PackAddStrEx(p, "RedirectUrl", a->RedirectUrl, index, total); - if (a->IsIPv6) - { - PackAddIp6AddrEx(p, "SrcIpAddress6", &a->SrcIpAddress6, index, total); - PackAddIp6AddrEx(p, "SrcSubnetMask6", &a->SrcSubnetMask6, index, total); - PackAddIp6AddrEx(p, "DestIpAddress6", &a->DestIpAddress6, index, total); - PackAddIp6AddrEx(p, "DestSubnetMask6", &a->DestSubnetMask6, index, total); - } - else - { - IPV6_ADDR zero; - - Zero(&zero, sizeof(zero)); - - PackAddIp6AddrEx(p, "SrcIpAddress6", &zero, index, total); - PackAddIp6AddrEx(p, "SrcSubnetMask6", &zero, index, total); - PackAddIp6AddrEx(p, "DestIpAddress6", &zero, index, total); - PackAddIp6AddrEx(p, "DestSubnetMask6", &zero, index, total); - } -} -void OutRpcAccess(PACK *p, ACCESS *a) -{ - // Validate arguments - if (a == NULL || p == NULL) - { - return; - } - - OutRpcAccessEx(p, a, 0, 1); -} - -// RPC_ENUM_ACCESS_LIST -void InRpcEnumAccessList(RPC_ENUM_ACCESS_LIST *a, PACK *p) -{ - UINT i; - // Validate arguments - if (a == NULL || p == NULL) - { - return; - } - - Zero(a, sizeof(RPC_ENUM_ACCESS_LIST)); - PackGetStr(p, "HubName", a->HubName, sizeof(a->HubName)); - a->NumAccess = PackGetIndexCount(p, "Protocol"); - a->Accesses = ZeroMalloc(sizeof(ACCESS) * a->NumAccess); - - for (i = 0;i < a->NumAccess;i++) - { - ACCESS *e = &a->Accesses[i]; - - InRpcAccessEx(e, p, i); - } -} -void OutRpcEnumAccessList(PACK *p, RPC_ENUM_ACCESS_LIST *a) -{ - UINT i; - // Validate arguments - if (a == NULL || p == NULL) - { - return; - } - PackAddStr(p, "HubName", a->HubName); - - PackSetCurrentJsonGroupName(p, "AccessList"); - for (i = 0;i < a->NumAccess;i++) - { - ACCESS *e = &a->Accesses[i]; - - OutRpcAccessEx(p, e, i, a->NumAccess); - } - PackSetCurrentJsonGroupName(p, NULL); -} -void FreeRpcEnumAccessList(RPC_ENUM_ACCESS_LIST *a) -{ - // Validate arguments - if (a == NULL) - { - return; - } - - Free(a->Accesses); -} - -// AUTHDATA -void *InRpcAuthData(PACK *p, UINT *authtype, char *username) -{ - wchar_t tmp[MAX_SIZE]; - AUTHPASSWORD *pw; - AUTHUSERCERT *usercert; - AUTHROOTCERT *rootcert; - AUTHRADIUS *radius; - AUTHNT *nt; - BUF *b; - char plain_pw[MAX_SIZE]; - // Validate arguments - if (p == NULL) - { - return NULL; - } - if (authtype == NULL) - { - return NULL; - } - - *authtype = PackGetInt(p, "AuthType"); - - switch (*authtype) - { - case AUTHTYPE_PASSWORD: - pw = ZeroMalloc(sizeof(AUTHPASSWORD)); - PackGetData2(p, "HashedKey", pw->HashedKey, sizeof(pw->HashedKey)); - PackGetData2(p, "NtLmSecureHash", pw->NtLmSecureHash, sizeof(pw->NtLmSecureHash)); - - if (PackGetStr(p, "Auth_Password", plain_pw, sizeof(plain_pw))) - { - if (IsZero(pw->HashedKey, sizeof(pw->HashedKey))) - { - HashPassword(pw->HashedKey, username, plain_pw); - GenerateNtPasswordHash(pw->NtLmSecureHash, plain_pw); - } - } - return pw; - - case AUTHTYPE_USERCERT: - usercert = ZeroMalloc(sizeof(AUTHUSERCERT)); - usercert->UserX = PackGetX(p, "UserX"); - return usercert; - - case AUTHTYPE_ROOTCERT: - rootcert = ZeroMalloc(sizeof(AUTHROOTCERT)); - b = PackGetBuf(p, "Serial"); - if (b != NULL) - { - rootcert->Serial = NewXSerial(b->Buf, b->Size); - FreeBuf(b); - } - if (PackGetUniStr(p, "CommonName", tmp, sizeof(tmp))) - { - rootcert->CommonName = CopyUniStr(tmp); - } - return rootcert; - - case AUTHTYPE_RADIUS: - radius = ZeroMalloc(sizeof(AUTHRADIUS)); - if (PackGetUniStr(p, "RadiusUsername", tmp, sizeof(tmp))) - { - radius->RadiusUsername = CopyUniStr(tmp); - } - else - { - radius->RadiusUsername = CopyUniStr(L""); - } - return radius; - - case AUTHTYPE_NT: - nt = ZeroMalloc(sizeof(AUTHNT)); - if (PackGetUniStr(p, "NtUsername", tmp, sizeof(tmp))) - { - nt->NtUsername = CopyUniStr(tmp); - } - else - { - nt->NtUsername = CopyUniStr(L""); - } - return nt; - } - - return NULL; -} -void OutRpcAuthData(PACK *p, void *authdata, UINT authtype) -{ - AUTHPASSWORD *pw = authdata; - AUTHUSERCERT *usercert = authdata; - AUTHROOTCERT *rootcert = authdata; - AUTHRADIUS *radius = authdata; - AUTHNT *nt = authdata; - // Validate arguments - if (p == NULL) - { - return; - } - - PackAddInt(p, "AuthType", authtype); - - switch (authtype) - { - case AUTHTYPE_PASSWORD: - PackAddData(p, "HashedKey", pw->HashedKey, sizeof(pw->HashedKey)); - PackAddData(p, "NtLmSecureHash", pw->NtLmSecureHash, sizeof(pw->NtLmSecureHash)); - break; - - case AUTHTYPE_USERCERT: - PackAddX(p, "UserX", usercert->UserX); - break; - - case AUTHTYPE_ROOTCERT: - if (rootcert->Serial != NULL) - { - PackAddData(p, "Serial", rootcert->Serial->data, rootcert->Serial->size); - } - if (rootcert->CommonName != NULL) - { - PackAddUniStr(p, "CommonName", rootcert->CommonName); - } - break; - - case AUTHTYPE_RADIUS: - PackAddUniStr(p, "RadiusUsername", radius->RadiusUsername); - break; - - case AUTHTYPE_NT: - PackAddUniStr(p, "NtUsername", nt->NtUsername); - break; - } -} -void FreeRpcAuthData(void *authdata, UINT authtype) -{ - FreeAuthData(authtype, authdata); -} - -// RPC_SET_USER -void InRpcSetUser(RPC_SET_USER *t, PACK *p) -{ - // Validate arguments - if (t == NULL || p == NULL) - { - return; - } - - Zero(t, sizeof(RPC_SET_USER)); - PackGetStr(p, "HubName", t->HubName, sizeof(t->HubName)); - PackGetStr(p, "Name", t->Name, sizeof(t->Name)); - PackGetStr(p, "GroupName", t->GroupName, sizeof(t->GroupName)); - PackGetUniStr(p, "Realname", t->Realname, sizeof(t->Realname)); - PackGetUniStr(p, "Note", t->Note, sizeof(t->Note)); - t->CreatedTime = PackGetInt64(p, "CreatedTime"); - t->UpdatedTime = PackGetInt64(p, "UpdatedTime"); - t->ExpireTime = PackGetInt64(p, "ExpireTime"); - t->AuthData = InRpcAuthData(p, &t->AuthType, t->Name); - t->NumLogin = PackGetInt(p, "NumLogin"); - InRpcTraffic(&t->Traffic, p); - - if (PackGetBool(p, "UsePolicy")) - { - t->Policy = ZeroMalloc(sizeof(POLICY)); - InRpcPolicy(t->Policy, p); - } -} - -void OutRpcSetUser(PACK *p, RPC_SET_USER *t) -{ - // Validate arguments - if (t == NULL || p == NULL) - { - return; - } - - PackAddStr(p, "HubName", t->HubName); - PackAddStr(p, "Name", t->Name); - PackAddStr(p, "GroupName", t->GroupName); - PackAddUniStr(p, "Realname", t->Realname); - PackAddUniStr(p, "Note", t->Note); - PackAddTime64(p, "CreatedTime", t->CreatedTime); - PackAddTime64(p, "UpdatedTime", t->UpdatedTime); - PackAddTime64(p, "ExpireTime", t->ExpireTime); - OutRpcAuthData(p, t->AuthData, t->AuthType); - PackAddInt(p, "NumLogin", t->NumLogin); - OutRpcTraffic(p, &t->Traffic); - - if (t->Policy != NULL) - { - PackAddBool(p, "UsePolicy", true); - OutRpcPolicy(p, t->Policy); - } -} -void FreeRpcSetUser(RPC_SET_USER *t) -{ - // Validate arguments - if (t == NULL) - { - return; - } - - FreeRpcAuthData(t->AuthData, t->AuthType); - if (t->Policy) - { - Free(t->Policy); - } -} - -// RPC_ENUM_USER -void InRpcEnumUser(RPC_ENUM_USER *t, PACK *p) -{ - UINT i; - // Validate arguments - if (t == NULL || p == NULL) - { - return; - } - - Zero(t, sizeof(RPC_ENUM_USER)); - PackGetStr(p, "HubName", t->HubName, sizeof(t->HubName)); - t->NumUser = PackGetIndexCount(p, "Name"); - t->Users = ZeroMalloc(sizeof(RPC_ENUM_USER_ITEM) * t->NumUser); - - for (i = 0;i < t->NumUser;i++) - { - RPC_ENUM_USER_ITEM *e = &t->Users[i]; - - PackGetStrEx(p, "Name", e->Name, sizeof(e->Name), i); - PackGetStrEx(p, "GroupName", e->GroupName, sizeof(e->GroupName), i); - PackGetUniStrEx(p, "Realname", e->Realname, sizeof(e->Realname), i); - PackGetUniStrEx(p, "Note", e->Note, sizeof(e->Note), i); - e->AuthType = PackGetIntEx(p, "AuthType", i); - e->LastLoginTime = PackGetInt64Ex(p, "LastLoginTime", i); - e->NumLogin = PackGetIntEx(p, "NumLogin", i); - e->DenyAccess = PackGetBoolEx(p, "DenyAccess", i); - - e->IsTrafficFilled = PackGetBoolEx(p, "IsTrafficFilled", i); - InRpcTrafficEx(&e->Traffic, p, i); - - e->IsExpiresFilled = PackGetBoolEx(p, "IsExpiresFilled", i); - e->Expires = PackGetInt64Ex(p, "Expires", i); - } -} -void OutRpcEnumUser(PACK *p, RPC_ENUM_USER *t) -{ - UINT i; - // Validate arguments - if (t == NULL || p == NULL) - { - return; - } - PackAddStr(p, "HubName", t->HubName); - - PackSetCurrentJsonGroupName(p, "UserList"); - for (i = 0;i < t->NumUser;i++) - { - RPC_ENUM_USER_ITEM *e = &t->Users[i]; - - PackAddStrEx(p, "Name", e->Name, i, t->NumUser); - PackAddStrEx(p, "GroupName", e->GroupName, i, t->NumUser); - PackAddUniStrEx(p, "Realname", e->Realname, i, t->NumUser); - PackAddUniStrEx(p, "Note", e->Note, i, t->NumUser); - PackAddIntEx(p, "AuthType", e->AuthType, i, t->NumUser); - PackAddTime64Ex(p, "LastLoginTime", e->LastLoginTime, i, t->NumUser); - PackAddIntEx(p, "NumLogin", e->NumLogin, i, t->NumUser); - PackAddBoolEx(p, "DenyAccess", e->DenyAccess, i, t->NumUser); - - PackAddBoolEx(p, "IsTrafficFilled", e->IsTrafficFilled, i, t->NumUser); - OutRpcTrafficEx(&e->Traffic, p, i, t->NumUser); - - PackAddBoolEx(p, "IsExpiresFilled", e->IsExpiresFilled, i, t->NumUser); - PackAddTime64Ex(p, "Expires", e->Expires, i, t->NumUser); - } - PackSetCurrentJsonGroupName(p, NULL); -} -void FreeRpcEnumUser(RPC_ENUM_USER *t) -{ - // Validate arguments - if (t == NULL) - { - return; - } - - Free(t->Users); -} - -// RPC_SET_GROUP -void InRpcSetGroup(RPC_SET_GROUP *t, PACK *p) -{ - // Validate arguments - if (t == NULL || p == NULL) - { - return; - } - - Zero(t, sizeof(RPC_SET_GROUP)); - PackGetStr(p, "HubName", t->HubName, sizeof(t->HubName)); - PackGetStr(p, "Name", t->Name, sizeof(t->Name)); - PackGetUniStr(p, "Realname", t->Realname, sizeof(t->Realname)); - PackGetUniStr(p, "Note", t->Note, sizeof(t->Note)); - InRpcTraffic(&t->Traffic, p); - - if (PackGetBool(p, "UsePolicy")) - { - t->Policy = ZeroMalloc(sizeof(POLICY)); - InRpcPolicy(t->Policy, p); - } -} -void OutRpcSetGroup(PACK *p, RPC_SET_GROUP *t) -{ - // Validate arguments - if (t == NULL || p == NULL) - { - return; - } - - PackAddStr(p, "HubName", t->HubName); - PackAddStr(p, "Name", t->Name); - PackAddUniStr(p, "Realname", t->Realname); - PackAddUniStr(p, "Note", t->Note); - OutRpcTraffic(p, &t->Traffic); - - if (t->Policy != NULL) - { - PackAddBool(p, "UsePolicy", true); - OutRpcPolicy(p, t->Policy); - } -} -void FreeRpcSetGroup(RPC_SET_GROUP *t) -{ - Free(t->Policy); -} - -// RPC_ENUM_GROUP -void InRpcEnumGroup(RPC_ENUM_GROUP *t, PACK *p) -{ - UINT i; - // Validate arguments - if (t == NULL || p == NULL) - { - return; - } - - Zero(t, sizeof(RPC_ENUM_GROUP)); - PackGetStr(p, "HubName", t->HubName, sizeof(t->HubName)); - t->NumGroup = PackGetIndexCount(p, "Name"); - t->Groups = ZeroMalloc(sizeof(RPC_ENUM_GROUP_ITEM) * t->NumGroup); - - for (i = 0;i < t->NumGroup;i++) - { - RPC_ENUM_GROUP_ITEM *e = &t->Groups[i]; - - PackGetStrEx(p, "Name", e->Name, sizeof(e->Name), i); - PackGetUniStrEx(p, "Realname", e->Realname, sizeof(e->Realname), i); - PackGetUniStrEx(p, "Note", e->Note, sizeof(e->Note), i); - e->NumUsers = PackGetIntEx(p, "NumUsers", i); - e->DenyAccess = PackGetBoolEx(p, "DenyAccess", i); - } -} -void OutRpcEnumGroup(PACK *p, RPC_ENUM_GROUP *t) -{ - UINT i; - // Validate arguments - if (t == NULL || p == NULL) - { - return; - } - - PackAddStr(p, "HubName", t->HubName); - - PackSetCurrentJsonGroupName(p, "GroupList"); - for (i = 0;i < t->NumGroup;i++) - { - RPC_ENUM_GROUP_ITEM *e = &t->Groups[i]; - - PackAddStrEx(p, "Name", e->Name, i, t->NumGroup); - PackAddUniStrEx(p, "Realname", e->Realname, i, t->NumGroup); - PackAddUniStrEx(p, "Note", e->Note, i, t->NumGroup); - PackAddIntEx(p, "NumUsers", e->NumUsers, i, t->NumGroup); - PackAddBoolEx(p, "DenyAccess", e->DenyAccess, i, t->NumGroup); - } - PackSetCurrentJsonGroupName(p, NULL); -} -void FreeRpcEnumGroup(RPC_ENUM_GROUP *t) -{ - // Validate arguments - if (t == NULL) - { - return; - } - - Free(t->Groups); -} - -// RPC_DELETE_USER -void InRpcDeleteUser(RPC_DELETE_USER *t, PACK *p) -{ - // Validate arguments - if (t == NULL || p == NULL) - { - return; - } - - Zero(t, sizeof(RPC_DELETE_USER)); - PackGetStr(p, "HubName", t->HubName, sizeof(t->HubName)); - PackGetStr(p, "Name", t->Name, sizeof(t->Name)); -} -void OutRpcDeleteUser(PACK *p, RPC_DELETE_USER *t) -{ - // Validate arguments - if (t == NULL || p == NULL) - { - return; - } - - PackAddStr(p, "HubName", t->HubName); - PackAddStr(p, "Name", t->Name); -} - -// RPC_ENUM_SESSION -void InRpcEnumSession(RPC_ENUM_SESSION *t, PACK *p) -{ - UINT i; - // Validate arguments - if (t == NULL || p == NULL) - { - return; - } - - Zero(t, sizeof(RPC_ENUM_SESSION)); - PackGetStr(p, "HubName", t->HubName, sizeof(t->HubName)); - t->NumSession = PackGetIndexCount(p, "Name"); - t->Sessions = ZeroMalloc(sizeof(RPC_ENUM_SESSION_ITEM) * t->NumSession); - - for (i = 0;i < t->NumSession;i++) - { - RPC_ENUM_SESSION_ITEM *e = &t->Sessions[i]; - - PackGetStrEx(p, "Name", e->Name, sizeof(e->Name), i); - PackGetStrEx(p, "Username", e->Username, sizeof(e->Username), i); - e->Ip = PackGetIntEx(p, "Ip", i); - PackGetIpEx(p, "ClientIP", &e->ClientIP, i); - PackGetStrEx(p, "Hostname", e->Hostname, sizeof(e->Hostname), i); - e->MaxNumTcp = PackGetIntEx(p, "MaxNumTcp", i); - e->CurrentNumTcp = PackGetIntEx(p, "CurrentNumTcp", i); - e->PacketSize = PackGetInt64Ex(p, "PacketSize", i); - e->PacketNum = PackGetInt64Ex(p, "PacketNum", i); - e->RemoteSession = PackGetBoolEx(p, "RemoteSession", i); - e->LinkMode = PackGetBoolEx(p, "LinkMode", i); - e->SecureNATMode = PackGetBoolEx(p, "SecureNATMode", i); - e->BridgeMode = PackGetBoolEx(p, "BridgeMode", i); - e->Layer3Mode = PackGetBoolEx(p, "Layer3Mode", i); - e->Client_BridgeMode = PackGetBoolEx(p, "Client_BridgeMode", i); - e->Client_MonitorMode = PackGetBoolEx(p, "Client_MonitorMode", i); - PackGetStrEx(p, "RemoteHostname", e->RemoteHostname, sizeof(e->RemoteHostname), i); - e->VLanId = PackGetIntEx(p, "VLanId", i); - PackGetDataEx2(p, "UniqueId", e->UniqueId, sizeof(e->UniqueId), i); - e->IsDormantEnabled = PackGetBoolEx(p, "IsDormantEnabled", i); - e->IsDormant = PackGetBoolEx(p, "IsDormant", i); - e->LastCommDormant = PackGetInt64Ex(p, "LastCommDormant", i); - e->CreatedTime = PackGetInt64Ex(p, "CreatedTime", i); - e->LastCommTime = PackGetInt64Ex(p, "LastCommTime", i); - } -} -void OutRpcEnumSession(PACK *p, RPC_ENUM_SESSION *t) -{ - UINT i; - // Validate arguments - if (t == NULL || p == NULL) - { - return; - } - PackAddStr(p, "HubName", t->HubName); - - PackSetCurrentJsonGroupName(p, "SessionList"); - for (i = 0;i < t->NumSession;i++) - { - RPC_ENUM_SESSION_ITEM *e = &t->Sessions[i]; - - PackAddStrEx(p, "Name", e->Name, i, t->NumSession); - PackAddStrEx(p, "Username", e->Username, i, t->NumSession); - PackAddIp32Ex(p, "Ip", e->Ip, i, t->NumSession); - PackAddIpEx(p, "ClientIP", &e->ClientIP, i, t->NumSession); - PackAddStrEx(p, "Hostname", e->Hostname, i, t->NumSession); - PackAddIntEx(p, "MaxNumTcp", e->MaxNumTcp, i, t->NumSession); - PackAddIntEx(p, "CurrentNumTcp", e->CurrentNumTcp, i, t->NumSession); - PackAddInt64Ex(p, "PacketSize", e->PacketSize, i, t->NumSession); - PackAddInt64Ex(p, "PacketNum", e->PacketNum, i, t->NumSession); - PackAddBoolEx(p, "RemoteSession", e->RemoteSession, i, t->NumSession); - PackAddStrEx(p, "RemoteHostname", e->RemoteHostname, i, t->NumSession); - PackAddBoolEx(p, "LinkMode", e->LinkMode, i, t->NumSession); - PackAddBoolEx(p, "SecureNATMode", e->SecureNATMode, i, t->NumSession); - PackAddBoolEx(p, "BridgeMode", e->BridgeMode, i, t->NumSession); - PackAddBoolEx(p, "Layer3Mode", e->Layer3Mode, i, t->NumSession); - PackAddBoolEx(p, "Client_BridgeMode", e->Client_BridgeMode, i, t->NumSession); - PackAddBoolEx(p, "Client_MonitorMode", e->Client_MonitorMode, i, t->NumSession); - PackAddIntEx(p, "VLanId", e->VLanId, i, t->NumSession); - PackAddDataEx(p, "UniqueId", e->UniqueId, sizeof(e->UniqueId), i, t->NumSession); - PackAddBoolEx(p, "IsDormantEnabled", e->IsDormantEnabled, i, t->NumSession); - PackAddBoolEx(p, "IsDormant", e->IsDormant, i, t->NumSession); - PackAddTime64Ex(p, "LastCommDormant", e->LastCommDormant, i, t->NumSession); - PackAddTime64Ex(p, "CreatedTime", e->CreatedTime, i, t->NumSession); - PackAddTime64Ex(p, "LastCommTime", e->LastCommTime, i, t->NumSession); - } - PackSetCurrentJsonGroupName(p, NULL); -} -void FreeRpcEnumSession(RPC_ENUM_SESSION *t) -{ - // Validate arguments - if (t == NULL) - { - return; - } - - Free(t->Sessions); -} - -// RPC_KEY_PAIR -void InRpcKeyPair(RPC_KEY_PAIR *t, PACK *p) -{ - // Validate arguments - if (t == NULL || p == NULL) - { - return; - } - - t->Cert = PackGetX(p, "Cert"); - t->Key = PackGetK(p, "Key"); - t->Flag1 = PackGetInt(p, "Flag1"); -} -void OutRpcKeyPair(PACK *p, RPC_KEY_PAIR *t) -{ - // Validate arguments - if (p == NULL || t == NULL) - { - return; - } - - PackAddX(p, "Cert", t->Cert); - PackAddK(p, "Key", t->Key); - PackAddInt(p, "Flag1", t->Flag1); -} -void FreeRpcKeyPair(RPC_KEY_PAIR *t) -{ - FreeX(t->Cert); - FreeK(t->Key); -} - -// NODE_INFO -void InRpcNodeInfo(NODE_INFO *t, PACK *p) -{ - // Validate arguments - if (t == NULL || p == NULL) - { - return; - } - - Zero(t, sizeof(NODE_INFO)); - PackGetStr(p, "ClientProductName", t->ClientProductName, sizeof(t->ClientProductName)); - PackGetStr(p, "ServerProductName", t->ServerProductName, sizeof(t->ServerProductName)); - PackGetStr(p, "ClientOsName", t->ClientOsName, sizeof(t->ClientOsName)); - PackGetStr(p, "ClientOsVer", t->ClientOsVer, sizeof(t->ClientOsVer)); - PackGetStr(p, "ClientOsProductId", t->ClientOsProductId, sizeof(t->ClientOsProductId)); - PackGetStr(p, "ClientHostname", t->ClientHostname, sizeof(t->ClientHostname)); - PackGetStr(p, "ServerHostname", t->ServerHostname, sizeof(t->ServerHostname)); - PackGetStr(p, "ProxyHostname", t->ProxyHostname, sizeof(t->ProxyHostname)); - PackGetStr(p, "HubName", t->HubName, sizeof(t->HubName)); - PackGetData2(p, "UniqueId", t->UniqueId, sizeof(t->UniqueId)); - - t->ClientProductVer = PackGetInt(p, "ClientProductVer"); - t->ClientProductBuild = PackGetInt(p, "ClientProductBuild"); - t->ServerProductVer = PackGetInt(p, "ServerProductVer"); - t->ServerProductBuild = PackGetInt(p, "ServerProductBuild"); - t->ClientIpAddress = PackGetIp32(p, "ClientIpAddress"); - PackGetData2(p, "ClientIpAddress6", t->ClientIpAddress6, sizeof(t->ClientIpAddress6)); - t->ClientPort = PackGetInt(p, "ClientPort"); - t->ServerIpAddress = PackGetIp32(p, "ServerIpAddress"); - PackGetData2(p, "ServerIpAddress6", t->ServerIpAddress6, sizeof(t->ServerIpAddress6)); - t->ServerPort = PackGetInt(p, "ServerPort2"); - t->ProxyIpAddress = PackGetIp32(p, "ProxyIpAddress"); - PackGetData2(p, "ProxyIpAddress6", t->ProxyIpAddress6, sizeof(t->ProxyIpAddress6)); - t->ProxyPort = PackGetInt(p, "ProxyPort"); -} -void OutRpcNodeInfo(PACK *p, NODE_INFO *t) -{ - // Validate arguments - if (t == NULL || p == NULL) - { - return; - } - - PackAddStr(p, "ClientProductName", t->ClientProductName); - PackAddStr(p, "ServerProductName", t->ServerProductName); - PackAddStr(p, "ClientOsName", t->ClientOsName); - PackAddStr(p, "ClientOsVer", t->ClientOsVer); - PackAddStr(p, "ClientOsProductId", t->ClientOsProductId); - PackAddStr(p, "ClientHostname", t->ClientHostname); - PackAddStr(p, "ServerHostname", t->ServerHostname); - PackAddStr(p, "ProxyHostname", t->ProxyHostname); - PackAddStr(p, "HubName", t->HubName); - PackAddData(p, "UniqueId", t->UniqueId, sizeof(t->UniqueId)); - - PackAddInt(p, "ClientProductVer", t->ClientProductVer); - PackAddInt(p, "ClientProductBuild", t->ClientProductBuild); - PackAddInt(p, "ServerProductVer", t->ServerProductVer); - PackAddInt(p, "ServerProductBuild", t->ServerProductBuild); - PackAddIp32(p, "ClientIpAddress", t->ClientIpAddress); - PackAddData(p, "ClientIpAddress6", t->ClientIpAddress6, sizeof(t->ClientIpAddress6)); - PackAddInt(p, "ClientPort", t->ClientPort); - PackAddIp32(p, "ServerIpAddress", t->ServerIpAddress); - PackAddData(p, "ServerIpAddress6", t->ServerIpAddress6, sizeof(t->ServerIpAddress6)); - PackAddInt(p, "ServerPort2", t->ServerPort); - PackAddIp32(p, "ProxyIpAddress", t->ProxyIpAddress); - PackAddData(p, "ProxyIpAddress6", t->ProxyIpAddress6, sizeof(t->ProxyIpAddress6)); - PackAddInt(p, "ProxyPort", t->ProxyPort); -} - -// RPC_SESSION_STATUS -void InRpcSessionStatus(RPC_SESSION_STATUS *t, PACK *p) -{ - // Validate arguments - if (t == NULL || p == NULL) - { - return; - } - - Zero(t, sizeof(RPC_SESSION_STATUS)); - PackGetStr(p, "HubName", t->HubName, sizeof(t->HubName)); - PackGetStr(p, "Name", t->Name, sizeof(t->Name)); - PackGetStr(p, "Username", t->Username, sizeof(t->Username)); - PackGetStr(p, "GroupName", t->GroupName, sizeof(t->GroupName)); - PackGetStr(p, "RealUsername", t->RealUsername, sizeof(t->RealUsername)); - t->ClientIp = PackGetIp32(p, "SessionStatus_ClientIp"); - PackGetData2(p, "SessionStatus_ClientIp6", t->ClientIp6, sizeof(t->ClientIp6)); - PackGetStr(p, "SessionStatus_ClientHostName", t->ClientHostName, sizeof(t->ClientHostName)); - PackGetIp(p, "Client_Ip_Address", &t->ClientIpAddress); - - InRpcClientGetConnectionStatus(&t->Status, p); - InRpcNodeInfo(&t->NodeInfo, p); -} -void OutRpcSessionStatus(PACK *p, RPC_SESSION_STATUS *t) -{ - // Validate arguments - if (t == NULL || p == NULL) - { - return; - } - - PackAddStr(p, "HubName", t->HubName); - PackAddStr(p, "Name", t->Name); - PackAddStr(p, "Username", t->Username); - PackAddStr(p, "GroupName", t->GroupName); - PackAddStr(p, "RealUsername", t->RealUsername); - PackAddIp32(p, "SessionStatus_ClientIp", t->ClientIp); - PackAddData(p, "SessionStatus_ClientIp6", t->ClientIp6, sizeof(t->ClientIp6)); - PackAddStr(p, "SessionStatus_ClientHostName", t->ClientHostName); - PackAddIp(p, "Client_Ip_Address", &t->ClientIpAddress); - - OutRpcClientGetConnectionStatus(p, &t->Status); - OutRpcNodeInfo(p, &t->NodeInfo); -} -void FreeRpcSessionStatus(RPC_SESSION_STATUS *t) -{ - // Validate arguments - if (t == NULL) - { - return; - } - - CiFreeClientGetConnectionStatus(&t->Status); -} - -// RPC_DELETE_SESSION -void InRpcDeleteSession(RPC_DELETE_SESSION *t, PACK *p) -{ - // Validate arguments - if (t == NULL || p == NULL) - { - return; - } - - Zero(t, sizeof(RPC_DELETE_SESSION)); - PackGetStr(p, "HubName", t->HubName, sizeof(t->HubName)); - PackGetStr(p, "Name", t->Name, sizeof(t->Name)); -} -void OutRpcDeleteSession(PACK *p, RPC_DELETE_SESSION *t) -{ - // Validate arguments - if (t == NULL || p == NULL) - { - return; - } - - PackAddStr(p, "HubName", t->HubName); - PackAddStr(p, "Name", t->Name); -} - -// RPC_ENUM_MAC_TABLE -void InRpcEnumMacTable(RPC_ENUM_MAC_TABLE *t, PACK *p) -{ - UINT i; - // Validate arguments - if (t == NULL || p == NULL) - { - return; - } - - Zero(t, sizeof(RPC_ENUM_MAC_TABLE)); - PackGetStr(p, "HubName", t->HubName, sizeof(t->HubName)); - t->NumMacTable = PackGetIndexCount(p, "SessionName"); - t->MacTables = ZeroMalloc(sizeof(RPC_ENUM_MAC_TABLE_ITEM) * t->NumMacTable); - - for (i = 0;i < t->NumMacTable;i++) - { - RPC_ENUM_MAC_TABLE_ITEM *e = &t->MacTables[i]; - - e->Key = PackGetIntEx(p, "Key", i); - PackGetStrEx(p, "SessionName", e->SessionName, sizeof(e->SessionName), i); - PackGetDataEx2(p, "MacAddress", e->MacAddress, sizeof(e->MacAddress), i); - e->VlanId = PackGetIntEx(p, "VlanId", i); - e->CreatedTime = PackGetInt64Ex(p, "CreatedTime", i); - e->UpdatedTime = PackGetInt64Ex(p, "UpdatedTime", i); - e->RemoteItem = PackGetBoolEx(p, "RemoteItem", i); - PackGetStrEx(p, "RemoteHostname", e->RemoteHostname, sizeof(e->RemoteHostname), i); - } -} -void OutRpcEnumMacTable(PACK *p, RPC_ENUM_MAC_TABLE *t) -{ - UINT i; - // Validate arguments - if (t == NULL || p == NULL) - { - return; - } - - PackAddStr(p, "HubName", t->HubName); - - PackSetCurrentJsonGroupName(p, "MacTable"); - for (i = 0;i < t->NumMacTable;i++) - { - RPC_ENUM_MAC_TABLE_ITEM *e = &t->MacTables[i]; - - PackAddIntEx(p, "Key", e->Key, i, t->NumMacTable); - PackAddStrEx(p, "SessionName", e->SessionName, i, t->NumMacTable); - PackAddDataEx(p, "MacAddress", e->MacAddress, sizeof(e->MacAddress), i, t->NumMacTable); - PackAddIntEx(p, "VlanId", e->VlanId, i, t->NumMacTable); - PackAddTime64Ex(p, "CreatedTime", e->CreatedTime, i, t->NumMacTable); - PackAddTime64Ex(p, "UpdatedTime", e->UpdatedTime, i, t->NumMacTable); - PackAddBoolEx(p, "RemoteItem", e->RemoteItem, i, t->NumMacTable); - PackAddStrEx(p, "RemoteHostname", e->RemoteHostname, i, t->NumMacTable); - } - PackSetCurrentJsonGroupName(p, NULL); -} -void FreeRpcEnumMacTable(RPC_ENUM_MAC_TABLE *t) -{ - // Validate arguments - if (t == NULL) - { - return; - } - - Free(t->MacTables); -} - -// RPC_ENUM_IP_TABLE -void InRpcEnumIpTable(RPC_ENUM_IP_TABLE *t, PACK *p) -{ - UINT i; - // Validate arguments - if (t == NULL || p == NULL) - { - return; - } - - Zero(t, sizeof(RPC_ENUM_IP_TABLE)); - PackGetStr(p, "HubName", t->HubName, sizeof(t->HubName)); - t->NumIpTable = PackGetIndexCount(p, "SessionName"); - t->IpTables = ZeroMalloc(sizeof(RPC_ENUM_IP_TABLE_ITEM) * t->NumIpTable); - - for (i = 0;i < t->NumIpTable;i++) - { - RPC_ENUM_IP_TABLE_ITEM *e = &t->IpTables[i]; - - e->Key = PackGetIntEx(p, "Key", i); - PackGetStrEx(p, "SessionName", e->SessionName, sizeof(e->SessionName), i); - e->Ip = PackGetIp32Ex(p, "Ip", i); - if (PackGetIpEx(p, "IpV6", &e->IpV6, i) == false) - { - UINTToIP(&e->IpV6, e->Ip); - } - PackGetIp(p, "IpAddress", &e->IpAddress); - e->DhcpAllocated = PackGetBoolEx(p, "DhcpAllocated", i); - e->CreatedTime = PackGetInt64Ex(p, "CreatedTime", i); - e->UpdatedTime = PackGetInt64Ex(p, "UpdatedTime", i); - e->RemoteItem = PackGetBoolEx(p, "RemoteItem", i); - PackGetStrEx(p, "RemoteHostname", e->RemoteHostname, sizeof(e->RemoteHostname), i); - } -} -void OutRpcEnumIpTable(PACK *p, RPC_ENUM_IP_TABLE *t) -{ - UINT i; - // Validate arguments - if (t == NULL || p == NULL) - { - return; - } - - PackAddStr(p, "HubName", t->HubName); - - PackSetCurrentJsonGroupName(p, "IpTable"); - for (i = 0;i < t->NumIpTable;i++) - { - RPC_ENUM_IP_TABLE_ITEM *e = &t->IpTables[i]; - - PackAddIntEx(p, "Key", e->Key, i, t->NumIpTable); - PackAddStrEx(p, "SessionName", e->SessionName, i, t->NumIpTable); - PackAddIp32Ex(p, "Ip", e->Ip, i, t->NumIpTable); - PackAddIpEx(p, "IpV6", &e->IpV6, i, t->NumIpTable); - PackAddIpEx(p, "IpAddress", &e->IpAddress, i, t->NumIpTable); - PackAddBoolEx(p, "DhcpAllocated", e->DhcpAllocated, i, t->NumIpTable); - PackAddTime64Ex(p, "CreatedTime", e->CreatedTime, i, t->NumIpTable); - PackAddTime64Ex(p, "UpdatedTime", e->UpdatedTime, i, t->NumIpTable); - PackAddBoolEx(p, "RemoteItem", e->RemoteItem, i, t->NumIpTable); - PackAddStrEx(p, "RemoteHostname", e->RemoteHostname, i, t->NumIpTable); - } - PackSetCurrentJsonGroupName(p, NULL); -} -void FreeRpcEnumIpTable(RPC_ENUM_IP_TABLE *t) -{ - // Validate arguments - if (t == NULL) - { - return; - } - - Free(t->IpTables); -} - -// RPC_DELETE_TABLE -void InRpcDeleteTable(RPC_DELETE_TABLE *t, PACK *p) -{ - // Validate arguments - if (t == NULL || p == NULL) - { - return; - } - - Zero(t, sizeof(RPC_DELETE_TABLE)); - PackGetStr(p, "HubName", t->HubName, sizeof(t->HubName)); - t->Key = PackGetInt(p, "Key"); -} -void OutRpcDeleteTable(PACK *p, RPC_DELETE_TABLE *t) -{ - // Validate arguments - if (t == NULL || p == NULL) - { - return; - } - - PackAddStr(p, "HubName", t->HubName); - PackAddInt(p, "Key", t->Key); -} - -// Adjoin RPC_ENUM_IP_TABLE -void AdjoinRpcEnumIpTable(RPC_ENUM_IP_TABLE *dest, RPC_ENUM_IP_TABLE *src) -{ - UINT old_num; - UINT i, n; - if (dest == NULL || src == NULL) - { - return; - } - - if (src->NumIpTable == 0) - { - return; - } - - old_num = dest->NumIpTable; - dest->NumIpTable += src->NumIpTable; - dest->IpTables = ReAlloc(dest->IpTables, sizeof(RPC_ENUM_IP_TABLE_ITEM) * dest->NumIpTable); - - n = 0; - for (i = old_num;i < dest->NumIpTable;i++) - { - Copy(&dest->IpTables[i], &src->IpTables[n++], sizeof(RPC_ENUM_IP_TABLE_ITEM)); - } -} - -// Adjoin RPC_ENUM_MAC_TABLE -void AdjoinRpcEnumMacTable(RPC_ENUM_MAC_TABLE *dest, RPC_ENUM_MAC_TABLE *src) -{ - UINT old_num; - UINT i, n; - if (dest == NULL || src == NULL) - { - return; - } - - if (src->NumMacTable == 0) - { - return; - } - - old_num = dest->NumMacTable; - dest->NumMacTable += src->NumMacTable; - dest->MacTables = ReAlloc(dest->MacTables, sizeof(RPC_ENUM_MAC_TABLE_ITEM) * dest->NumMacTable); - - n = 0; - for (i = old_num;i < dest->NumMacTable;i++) - { - Copy(&dest->MacTables[i], &src->MacTables[n++], sizeof(RPC_ENUM_MAC_TABLE_ITEM)); - } -} - -// Adjoin RPC_ENUM_SESSION -void AdjoinRpcEnumSession(RPC_ENUM_SESSION *dest, RPC_ENUM_SESSION *src) -{ - UINT old_num; - UINT i, n; - if (dest == NULL || src == NULL) - { - return; - } - - if (src->NumSession == 0) - { - return; - } - - old_num = dest->NumSession; - dest->NumSession += src->NumSession; - dest->Sessions = ReAlloc(dest->Sessions, sizeof(RPC_ENUM_SESSION_ITEM) * dest->NumSession); - - n = 0; - for (i = old_num;i < dest->NumSession;i++) - { - Copy(&dest->Sessions[i], &src->Sessions[n++], sizeof(RPC_ENUM_SESSION_ITEM)); - } -} - -// RPC_KEEP -void InRpcKeep(RPC_KEEP *t, PACK *p) -{ - // Validate arguments - if (t == NULL || p == NULL) - { - return; - } - - Zero(t, sizeof(RPC_KEEP)); - t->UseKeepConnect = PackGetBool(p, "UseKeepConnect"); - PackGetStr(p, "KeepConnectHost", t->KeepConnectHost, sizeof(t->KeepConnectHost)); - t->KeepConnectPort = PackGetInt(p, "KeepConnectPort"); - t->KeepConnectProtocol = PackGetInt(p, "KeepConnectProtocol"); - t->KeepConnectInterval = PackGetInt(p, "KeepConnectInterval"); -} -void OutRpcKeep(PACK *p, RPC_KEEP *t) -{ - // Validate arguments - if (t == NULL || p == NULL) - { - return; - } - - PackAddBool(p, "UseKeepConnect", t->UseKeepConnect); - PackAddStr(p, "KeepConnectHost", t->KeepConnectHost); - PackAddInt(p, "KeepConnectPort", t->KeepConnectPort); - PackAddInt(p, "KeepConnectProtocol", t->KeepConnectProtocol); - PackAddInt(p, "KeepConnectInterval", t->KeepConnectInterval); -} - -// test RPC function -UINT StTest(ADMIN *a, RPC_TEST *t) -{ - Format(t->StrValue, sizeof(t->StrValue), "%u", t->IntValue); - - return ERR_NO_ERROR; -} - -// RPC_TEST -void InRpcTest(RPC_TEST *t, PACK *p) -{ - Zero(t, sizeof(RPC_TEST)); - t->IntValue = PackGetInt(p, "IntValue"); - t->Int64Value = PackGetInt64(p, "Int64Value"); - PackGetStr(p, "StrValue", t->StrValue, sizeof(t->StrValue)); - PackGetUniStr(p, "UniStrValue", t->UniStrValue, sizeof(t->UniStrValue)); -} -void OutRpcTest(PACK *p, RPC_TEST *t) -{ - PackAddInt(p, "IntValue", t->IntValue); - PackAddInt64(p, "Int64Value", t->Int64Value); - PackAddStr(p, "StrValue", t->StrValue); - PackAddUniStr(p, "UniStrValue", t->UniStrValue); -} -void FreeRpcTest(RPC_TEST *t) -{ -} - -// Admin RPC call -PACK *AdminCall(RPC *rpc, char *function_name, PACK *p) -{ - // Validate arguments - if (rpc == NULL || function_name == NULL) - { - return NULL; - } - if (p == NULL) - { - p = NewPack(); - } - -// Debug("Admin RPC Call: %s\n", function_name); - - return RpcCall(rpc, function_name, p); -} - -// Check whether the source IP address is permitted to admin connection -bool CheckAdminSourceAddress(SOCK *sock, char *hubname) -{ - BUF *b; - char *s; - bool ok = false; - // Validate arguments - if (sock == NULL) - { - return false; - } - - b = ReadDump(ADMINIP_TXT); - if (b == NULL) - { - return true; - } - - while (true) - { - UINT i; - TOKEN_LIST *t; - IP ip; - IP mask; - IP ip1; - IP ip2; - s = CfgReadNextLine(b); - - if (s == NULL) - { - break; - } - - Trim(s); - - i = SearchStrEx(s, "//", 0, false); - if (i != INFINITE) - { - s[i] = 0; - } - - i = SearchStrEx(s, "#", 0, false); - if (i != INFINITE) - { - s[i] = 0; - } - - Trim(s); - - t = ParseToken(s, " \t"); - if (t != NULL) - { - if (t->NumTokens >= 1) - { - if (t->NumTokens == 1 || StrCmpi(hubname, t->Token[1]) == 0) - { - if (ParseIpAndMask46(t->Token[0], &ip, &mask)) - { - if (IsIP4(&sock->RemoteIP) && IsIP4(&ip)) - { - IPAnd4(&ip1, &sock->RemoteIP, &mask); - IPAnd4(&ip2, &ip, &mask); - - if (CmpIpAddr(&ip1, &ip2) == 0) - { - ok = true; - } - } - else if (IsIP6(&sock->RemoteIP) && IsIP6(&ip)) - { - IPAnd6(&ip1, &sock->RemoteIP, &mask); - IPAnd6(&ip2, &ip, &mask); - - if (CmpIpAddr(&ip1, &ip2) == 0) - { - ok = true; - } - } - } - else if (StrToIP(&ip, t->Token[0])) - { - if (CmpIpAddr(&sock->RemoteIP, &ip) == 0) - { - ok = true; - } - } - - if (StrCmpi(t->Token[0], "*") == 0) - { - ok = true; - } - } - } - - FreeToken(t); - } - - Free(s); - } - - FreeBuf(b); - - return ok; -} - -// Accept admin connection -UINT AdminAccept(CONNECTION *c, PACK *p) -{ - ADMIN *a; - UCHAR secure_password[SHA1_SIZE]; - UCHAR null_password[SHA1_SIZE]; - UCHAR secure_null_password[SHA1_SIZE]; - char hubname[MAX_HUBNAME_LEN + 1]; - CEDAR *cedar; - SOCK *sock; - RPC *rpc; - UINT err; - SERVER *server = NULL; - RPC_WINVER ver; - bool accept_empty_password; - bool is_empty_password = false; - // Validate arguments - if (c == NULL || p == NULL) - { - return ERR_INTERNAL_ERROR; - } - - cedar = c->Cedar; - sock = c->FirstSock; - - if (cedar != NULL) - { - server = cedar->Server; - } - - accept_empty_password = PackGetBool(p, "accept_empty_password"); - - // Get client OS version - InRpcWinVer(&ver, p); - - // Get hub name - if (PackGetStr(p, "hubname", hubname, sizeof(hubname)) == false) - { - // without hub name - StrCpy(hubname, sizeof(hubname), ""); - } - - // Check source IP address - if (CheckAdminSourceAddress(sock, hubname) == false) - { - SLog(c->Cedar, "LA_IP_DENIED", c->Name); - return ERR_IP_ADDRESS_DENIED; - } - - // Get password information - if (PackGetDataSize(p, "secure_password") != SHA1_SIZE) - { - // Malformed information - return ERR_PROTOCOL_ERROR; - } - PackGetData(p, "secure_password", secure_password); - - if (StrLen(hubname) == 0) - { - // Server admin mode - SLog(c->Cedar, "LA_CONNECTED_1", c->Name); - } - else - { - // Hub admin mode - if (server != NULL && server->ServerType == SERVER_TYPE_FARM_MEMBER) - { - // Connection with hub admin mode to cluster member is not permitted - return ERR_NOT_ENOUGH_RIGHT; - } - SLog(c->Cedar, "LA_CONNECTED_2", c->Name, hubname); - } - - // Check password - err = AdminCheckPassword(cedar, c->Random, secure_password, - StrLen(hubname) != 0 ? hubname : NULL, accept_empty_password, &is_empty_password); - - if (err != ERR_NO_ERROR) - { - // Error occured - SLog(c->Cedar, "LA_ERROR", c->Name, GetUniErrorStr(err), err); - return err; - } - - SLog(c->Cedar, "LA_OK", c->Name); - - HashAdminPassword(null_password, ""); - SecurePassword(secure_null_password, null_password, c->Random); - - if (Cmp(secure_null_password, secure_password, SHA1_SIZE) == 0) - { - if (sock->RemoteIP.addr[0] != 127) - { - // The client tried to use blank password for hub admin mode from remote - if (StrLen(hubname) != 0) - { - return ERR_NULL_PASSWORD_LOCAL_ONLY; - } - } - } - - - // Reply success result - p = NewPack(); - if (accept_empty_password && is_empty_password) - { - PackAddBool(p, "empty_password", true); - } - HttpServerSend(sock, p); - FreePack(p); - - // Construct ADMIN object - a = ZeroMalloc(sizeof(ADMIN)); - a->ServerAdmin = ((StrLen(hubname) == 0) ? true : false); - a->HubName = (StrLen(hubname) != 0 ? hubname : NULL); - a->Server = c->Cedar->Server; - a->ClientBuild = c->ClientBuild; - - Copy(&a->ClientWinVer, &ver, sizeof(RPC_WINVER)); - - // Timeout setting - SetTimeout(sock, INFINITE); - - // RPC Server - rpc = StartRpcServer(sock, AdminDispatch, a); - - a->Rpc = rpc; - - SLog(c->Cedar, "LA_RPC_START", c->Name, rpc->Name); - - RpcServer(rpc); - RpcFree(rpc); - - if (a->LogFileList != NULL) - { - // Free cached log file list, if it exists - FreeEnumLogFile(a->LogFileList); - } - - // Free ADMIN object - Free(a); - - return ERR_NO_ERROR; -} - -// Check for admin password -UINT AdminCheckPassword(CEDAR *c, void *random, void *secure_password, char *hubname, - bool accept_empty_password, bool *is_password_empty) -{ - UCHAR check[SHA1_SIZE]; - bool b_dummy; - // Validate arguments - if (c == NULL || random == NULL || secure_password == NULL) - { - return ERR_INTERNAL_ERROR; - } - if (is_password_empty == NULL) - { - is_password_empty = &b_dummy; - } - - *is_password_empty = false; - - if (hubname == NULL || StrLen(hubname) == 0) - { - // Server admin mode - Lock(c->lock); - { - if (accept_empty_password && SiIsEmptyPassword(c->Server->HashedPassword)) - { - // blank password - *is_password_empty = true; - } - - SecurePassword(check, c->Server->HashedPassword, random); - } - Unlock(c->lock); - - if (Cmp(check, secure_password, SHA1_SIZE) != 0) - { - // Password incorrect - return ERR_ACCESS_DENIED; - } - } - else - { - HUB *h; - -#if 0 - if (c->Server->ServerType == SERVER_TYPE_FARM_MEMBER) - { - // In cluster member mode, hub admin mode is disabled - return ERR_FARM_MEMBER_HUB_ADMIN; - } -#endif - - // Hub admin mode - LockHubList(c); - { - h = GetHub(c, hubname); - } - UnlockHubList(c); - - if (h == NULL) - { - // Specified hub is not found - return ERR_HUB_NOT_FOUND; - } - - Lock(h->lock); - { - if (accept_empty_password && SiIsEmptyPassword(h->HashedPassword)) - { - // User specified blank password - *is_password_empty = true; - } - - SecurePassword(check, h->HashedPassword, random); - } - Unlock(h->lock); - - ReleaseHub(h); - - if (Cmp(check, secure_password, SHA1_SIZE) != 0) - { - // Incorrect password - return ERR_ACCESS_DENIED; - } - } - - return ERR_NO_ERROR; -} - -// Hash admin password -void HashAdminPassword(void *hash, char *password) -{ - // Validate arguments - if (hash == NULL || password == NULL) - { - return; - } - - Sha0(hash, password, StrLen(password)); -} - -// Disconnect admin connection -void AdminDisconnect(RPC *rpc) -{ - SESSION *s; - SOCK *sock; - // Validate arguments - if (rpc == NULL) - { - return; - } - - s = (SESSION *)rpc->Param; - sock = rpc->Sock; - - EndRpc(rpc); - - Disconnect(sock); - ReleaseSession(s); -} - -// Admin connection main routine -SESSION *AdminConnectMain(CEDAR *cedar, CLIENT_OPTION *o, char *hubname, void *hashed_password, UINT *err, char *client_name, void *hWnd, bool *empty_password) -{ - UCHAR secure_password[SHA1_SIZE]; - SESSION *s; - SOCK *sock; - PACK *p; - RPC_WINVER ver; - // connect - s = NewRpcSessionEx2(cedar, o, err, client_name, hWnd); - if (s == NULL) - { - return NULL; - } - - // Get socket - sock = s->Connection->FirstSock; - - // Generate connect method - p = NewPack(); - - PackAddClientVersion(p, s->Connection); - - PackAddStr(p, "method", "admin"); - PackAddBool(p, "accept_empty_password", true); - - // Windows version on client - GetWinVer(&ver); - OutRpcWinVer(p, &ver); - - // Secure Password - SecurePassword(secure_password, hashed_password, s->Connection->Random); - - PackAddData(p, "secure_password", secure_password, sizeof(secure_password)); - - // HUB name - if (hubname != NULL) - { - PackAddStr(p, "hubname", hubname); - } - - if (HttpClientSend(sock, p) == false) - { - // disconnect - FreePack(p); - ReleaseSession(s); - *err = ERR_DISCONNECTED; - return NULL; - } - - FreePack(p); - - p = HttpClientRecv(sock); - if (p == NULL) - { - // disconnect - ReleaseSession(s); - *err = ERR_DISCONNECTED; - return NULL; - } - - if (GetErrorFromPack(p) != 0) - { - // error - ReleaseSession(s); - *err = GetErrorFromPack(p); - FreePack(p); - return NULL; - } - - if (empty_password != NULL) - { - *empty_password = PackGetBool(p, "empty_password"); - } - - FreePack(p); - - return s; -} - -// Admin connection -RPC *AdminConnectEx(CEDAR *cedar, CLIENT_OPTION *o, char *hubname, void *hashed_password, UINT *err, char *client_name) -{ - return AdminConnectEx2(cedar, o, hubname, hashed_password, err, client_name, NULL); -} -RPC *AdminConnectEx2(CEDAR *cedar, CLIENT_OPTION *o, char *hubname, void *hashed_password, UINT *err, char *client_name, void *hWnd) -{ - SESSION *s; - SOCK *sock; - RPC *rpc; - UCHAR hashed_password_2[SHA1_SIZE]; - bool empty_password = false; - // Validate arguments - if (cedar == NULL || o == NULL || hashed_password == NULL || err == NULL) - { - return NULL; - } - - if (client_name == NULL) - { - client_name = CEDAR_MANAGER_STR; - } - - Copy(hashed_password_2, hashed_password, SHA1_SIZE); - - s = AdminConnectMain(cedar, o, hubname, hashed_password_2, err, client_name, hWnd, &empty_password); - - if (s == NULL) - { - return NULL; - } - - sock = s->Connection->FirstSock; - - // RPC start - rpc = StartRpcClient(sock, s); - - rpc->IsVpnServer = true; - Copy(&rpc->VpnServerClientOption, o, sizeof(CLIENT_OPTION)); - StrCpy(rpc->VpnServerHubName, sizeof(rpc->VpnServerHubName), hubname); - StrCpy(rpc->VpnServerClientName, sizeof(rpc->VpnServerClientName), client_name); - - if (empty_password == false) - { - Copy(rpc->VpnServerHashedPassword, hashed_password_2, SHA1_SIZE); - } - else - { - HashAdminPassword(rpc->VpnServerHashedPassword, ""); - } - - // timeout setting - SetTimeout(sock, INFINITE); - - return rpc; -} - -// Reconnect admin connection -UINT AdminReconnect(RPC *rpc) -{ - SESSION *s; - SOCK *sock; - CEDAR *cedar; - UINT err; - bool empty_password = false; - // Validate arguments - if (rpc == NULL || rpc->IsVpnServer == false) - { - return ERR_INTERNAL_ERROR; - } - - s = (SESSION *)rpc->Param; - cedar = s->Cedar; - AddRef(cedar->ref); - - sock = rpc->Sock; - Disconnect(sock); - ReleaseSock(sock); - ReleaseSession(s); - rpc->Param = NULL; - - rpc->Sock = NULL; - - s = AdminConnectMain(cedar, &rpc->VpnServerClientOption, - rpc->VpnServerHubName, - rpc->VpnServerHashedPassword, - &err, - rpc->VpnServerClientName, NULL, &empty_password); - - ReleaseCedar(cedar); - - if (s == NULL) - { - return err; - } - - if (empty_password) - { - HashAdminPassword(rpc->VpnServerHashedPassword, ""); - } - - rpc->Param = s; - rpc->Sock = s->Connection->FirstSock; - AddRef(rpc->Sock->ref); - - return ERR_NO_ERROR; -} - -// Identify blank password -bool SiIsEmptyPassword(void *hash_password) -{ - UCHAR hash[SHA1_SIZE]; - // Validate arguments - if (hash_password == NULL) - { - return false; - } - - Sha0(hash, "", 0); - - if (Cmp(hash_password, hash, SHA1_SIZE) == 0) - { - return true; - } - - return false; -} - +// SoftEther VPN Source Code - Developer Edition Master Branch +// Cedar Communication Module + + +// Admin.c +// RPC Module for Management + +#include "CedarPch.h" + +// Macro for RPC function declaration +#define DECLARE_RPC_EX(rpc_name, data_type, function, in_rpc, out_rpc, free_rpc) \ + else if (StrCmpi(name, rpc_name) == 0) \ + { \ + data_type *t; \ + t = ZeroMalloc(sizeof(data_type)); \ + in_rpc(t, p); \ + err = function(a, t); \ + if (err == ERR_NO_ERROR) \ + { \ + out_rpc(ret, t); \ + } \ + free_rpc(t); \ + Free(t); \ + ok = true; \ + } +#define DECLARE_RPC(rpc_name, data_type, function, in_rpc, out_rpc) \ + else if (StrCmpi(name, rpc_name) == 0) \ + { \ + data_type *t; \ + t = ZeroMalloc(sizeof(data_type)); \ + in_rpc(t, p); \ + err = function(a, t); \ + if (err == ERR_NO_ERROR) \ + { \ + out_rpc(ret, t); \ + } \ + Free(t); \ + ok = true; \ + } +#define DECLARE_SC_EX(rpc_name, data_type, function, in_rpc, out_rpc, free_rpc) \ + UINT function(RPC *r, data_type *t) \ + { \ + PACK *p, *ret; \ + UINT err; \ + if (r == NULL || t == NULL) \ + { \ + return ERR_INTERNAL_ERROR; \ + } \ + p = NewPack(); \ + out_rpc(p, t); \ + free_rpc(t); \ + Zero(t, sizeof(data_type)); \ + ret = AdminCall(r, rpc_name, p); \ + err = GetErrorFromPack(ret); \ + if (err == ERR_NO_ERROR) \ + { \ + in_rpc(t, ret); \ + } \ + FreePack(ret); \ + return err; \ + } +#define DECLARE_SC(rpc_name, data_type, function, in_rpc, out_rpc) \ + UINT function(RPC *r, data_type *t) \ + { \ + PACK *p, *ret; \ + UINT err; \ + if (r == NULL || t == NULL) \ + { \ + return ERR_INTERNAL_ERROR; \ + } \ + p = NewPack(); \ + out_rpc(p, t); \ + ret = AdminCall(r, rpc_name, p); \ + err = GetErrorFromPack(ret); \ + if (err == ERR_NO_ERROR) \ + { \ + in_rpc(t, ret); \ + } \ + FreePack(ret); \ + return err; \ + } +#define CHECK_RIGHT \ + if (a->ServerAdmin == false && (StrCmpi(a->HubName, t->HubName) != 0)) \ + return ERR_NOT_ENOUGH_RIGHT; \ + if (IsEmptyStr(t->HubName)) \ + return ERR_INVALID_PARAMETER; +#define SERVER_ADMIN_ONLY \ + if (a->ServerAdmin == false) \ + return ERR_NOT_ENOUGH_RIGHT; +#define NO_SUPPORT_FOR_BRIDGE \ + if (a->Server->Cedar->Bridge) \ + return ERR_NOT_SUPPORTED; + +// Get server Caps (Guessing from the build number if failed to get Caps) +CAPSLIST *ScGetCapsEx(RPC *rpc) +{ + RPC_SERVER_INFO info; + CAPSLIST *t; + bool is_bridge = false; + // Validate arguments + if (rpc == NULL) + { + return NULL; + } + + Zero(&info, sizeof(info)); + ScGetServerInfo(rpc, &info); + + t = ZeroMalloc(sizeof(CAPSLIST)); + + // Try to get Caps by RPC + if (ScGetCaps(rpc, t) != ERR_NO_ERROR) + { + UINT build; + + Free(t); + t = NewCapsList(); + + // Since acquisition of Caps went wrong, get build number + build = info.ServerBuildInt; + + is_bridge = (SearchStrEx(info.ServerProductName, "bridge", 0, false) == INFINITE) ? false : true; + + AddCapsInt(t, "i_max_packet_size", 1514); + + if (is_bridge == false) + { + AddCapsInt(t, "i_max_hubs", 4096); + AddCapsInt(t, "i_max_sessions", 4096); + + if (info.ServerType != SERVER_TYPE_FARM_MEMBER) + { + AddCapsInt(t, "i_max_users_per_hub", 10000); + AddCapsInt(t, "i_max_groups_per_hub", 10000); + AddCapsInt(t, "i_max_access_lists", 4096); + } + else + { + AddCapsInt(t, "i_max_users_per_hub", 0); + AddCapsInt(t, "i_max_groups_per_hub", 0); + AddCapsInt(t, "i_max_access_lists", 0); + } + } + else + { + AddCapsInt(t, "i_max_hubs", 0); + AddCapsInt(t, "i_max_sessions", 0); + AddCapsInt(t, "i_max_users_per_hub", 0); + AddCapsInt(t, "i_max_groups_per_hub", 0); + AddCapsInt(t, "i_max_access_lists", 0); + } + + AddCapsInt(t, "i_max_mac_tables", 10000); + AddCapsInt(t, "i_max_ip_tables", 10000); + + if (info.ServerType == SERVER_TYPE_STANDALONE) + { + AddCapsBool(t, "b_support_securenat", (build >= 3600) ? true : false); + AddCapsInt(t, "i_max_secnat_tables", 4096); + } + else + { + AddCapsBool(t, "b_support_securenat", false); + AddCapsInt(t, "i_max_secnat_tables", 0); + } + + if (is_bridge) + { + AddCapsBool(t, "b_bridge", true); + } + else if (info.ServerType == SERVER_TYPE_STANDALONE) + { + AddCapsBool(t, "b_standalone", true); + } + else if (info.ServerType == SERVER_TYPE_FARM_CONTROLLER) + { + AddCapsBool(t, "b_cluster_controller", true); + } + else + { + AddCapsBool(t, "b_cluster_member", true); + } + + AddCapsBool(t, "b_support_config_hub", info.ServerType != SERVER_TYPE_FARM_MEMBER && + is_bridge == false); + + AddCapsBool(t, "b_vpn_client_connect", is_bridge == false ? true : false); + + AddCapsBool(t, "b_support_radius", info.ServerType != SERVER_TYPE_FARM_MEMBER && + is_bridge == false); + + if (build >= 3600) + { + RPC_BRIDGE_SUPPORT b; + Zero(&b, sizeof(b)); + if (ScGetBridgeSupport(rpc, &b) == ERR_NO_ERROR) + { + AddCapsBool(t, "b_local_bridge", b.IsBridgeSupportedOs); + AddCapsBool(t, "b_must_install_pcap", b.IsWinPcapNeeded); + } + else + { + AddCapsBool(t, "b_local_bridge", false); + AddCapsBool(t, "b_must_install_pcap", false); + } + } + else + { + AddCapsBool(t, "b_local_bridge", false); + AddCapsBool(t, "b_must_install_pcap", false); + } + + AddCapsBool(t, "b_tap_supported", false); + + if (info.ServerType == SERVER_TYPE_STANDALONE) + { + AddCapsBool(t, "b_support_cascade", true); + } + else + { + AddCapsBool(t, "b_support_cascade", false); + } + + AddCapsBool(t, "b_support_cascade_cert", false); + AddCapsBool(t, "b_support_config_log", info.ServerType != SERVER_TYPE_FARM_MEMBER); + AddCapsBool(t, "b_support_autodelete", false); + } + else + { + // Success getting Caps + if (info.ServerBuildInt <= 4350) + { + if (is_bridge == false) + { + // b_support_cluster should be true for build 4300 or earlier + CAPS *caps = GetCaps(t, "b_support_cluster"); + if (caps == NULL) + { + AddCapsBool(t, "b_support_cluster", true); + } + else + { + caps->Value = 1; + } + } + } + } + + if (true) + { + TOKEN_LIST *names; + + // Fill items that doesn't exist in server-side as false + names = GetTableNameStartWith("CT_b_"); + if (names != NULL) + { + UINT i; + for (i = 0;i < names->NumTokens;i++) + { + char *name = names->Token[i] + 3; + + if (GetCaps(t, name) == NULL) + { + AddCapsBool(t, name, false); + } + } + + FreeToken(names); + } + } + + FreeRpcServerInfo(&info); + + return t; +} + + + +// Process server side include +BUF *AdminWebProcessServerSideInclude(BUF *src_txt, char *filename, UINT depth) +{ + char *src_str; + UINT src_str_size; + UINT i, len; + BUF *ret = NULL; + UINT pos = 0; + char dirname[MAX_PATH]; + if (src_txt == NULL || filename == NULL || depth >= 4) + { + return CloneBuf(src_txt); + } + if (EndWith(filename, ".html") == false) + { + // We process only .html files + return CloneBuf(src_txt); + } + + GetDirNameFromFilePath(dirname, sizeof(dirname), filename); + + src_str_size = src_txt->Size + 1; + src_str = ZeroMalloc(src_str_size); + + Copy(src_str, src_txt->Buf, src_txt->Size); + + len = StrLen(src_str); + + ret = NewBuf(); + + for (i = 0;i < len;i++) + { + char *start_tag = ""; + UINT x; + + Zero(inc_filename, sizeof(inc_filename)); + + StrCpy(inc_filename, sizeof(inc_filename), src_str + i + StrLen(start_tag) + 1); + inc_filename[b - (i + StrLen(start_tag) + 1)] = 0; + + x = SearchStrEx(src_str, end_tag, b + 1, true); + + if ((x != INFINITE) && (x >= (b + 1))) + { + BUF *inc_buf; + char full_inc_filename[MAX_PATH]; + + if (StartWith(inc_filename, "/")) + { + Format(full_inc_filename, sizeof(full_inc_filename), "|wwwroot/%s", inc_filename + 1); + } + else + { + StrCpy(full_inc_filename, sizeof(full_inc_filename), dirname); + StrCat(full_inc_filename, sizeof(full_inc_filename), "/"); + StrCat(full_inc_filename, sizeof(full_inc_filename), inc_filename); + } + + Debug("dirname = %s, full_inc_filename (src) = %s\n\n", dirname, full_inc_filename); + NormalizePath(full_inc_filename, sizeof(full_inc_filename), full_inc_filename); + + if (StartWith(full_inc_filename, "|wwwroot/") == false + && StartWith(full_inc_filename, "|wwwroot\\") == false) + { + char tmp[MAX_PATH]; + Format(tmp, sizeof(tmp), "|wwwroot/%s", full_inc_filename); + StrCpy(full_inc_filename, sizeof(full_inc_filename), tmp); + } + + Debug("inc_filename = %s\nfull_inc_filename = %s\n\n", inc_filename, full_inc_filename); + + inc_buf = ReadDump(full_inc_filename); + + if (inc_buf != NULL) + { + BUF *inc_buf2; + + inc_buf2 = AdminWebProcessServerSideInclude(inc_buf, full_inc_filename, depth + 1); + + BufSkipUtf8Bom(inc_buf2); + WriteBufBufWithOffset(ret, inc_buf2); + + FreeBuf(inc_buf); + FreeBuf(inc_buf2); + } + else + { + Debug("Loading SSI '%s' error.\n", inc_buf); + } + + i = (x + StrLen(end_tag) - 1); + + is_ssi = true; + } + } + } + } + + if (is_ssi == false) + { + WriteBufChar(ret, src_str[i]); + } + } + + Free(src_str); + + return ret; +} + +// Handle the file request +bool AdminWebHandleFileRequest(ADMIN *a, CONNECTION *c, SOCK *s, HTTP_HEADER *h, char *url_src, char *query_string, char *virtual_root_dir, char *physical_root_dir) +{ + bool ret = false; + char url[MAX_PATH]; + UINT i, len; + if (a == NULL || c == NULL || s == NULL || h == NULL || query_string == NULL || + virtual_root_dir == NULL || physical_root_dir == NULL) + { + return false; + } + + StrCpy(url, sizeof(url), url_src); + + len = StrLen(url); + for (i = 0;i < len;i++) + { + if (url[i] == '\\') + { + url[i] = '/'; + } + } + + // Is dangerous URL? + if (InStr(url, "..") || InStr(url, "//") || InStr(url, "\\\\") || InStr(url, "/\\") || InStr(url, "\\/")) + { + ret = AdminWebSend404Error(s, h); + } + else + { + char filename[MAX_PATH]; + bool is_index_file = false; + + BUF *b = AdminWebTryFindAndReadFile(virtual_root_dir, physical_root_dir, url, + filename, sizeof(filename), &is_index_file); + + if (b == NULL) + { + ret = AdminWebSend404Error(s, h); + } + else + { + if (is_index_file && EndWith(url, "/") == false) + { + char url2[MAX_PATH]; + StrCpy(url2, sizeof(url2), url); + StrCat(url2, sizeof(url2), "/"); + ret = AdminWebSend302Redirect(s, url2, query_string, h); + } + else if (is_index_file == false && EndWith(url, "/")) + { + char url2[MAX_PATH]; + TrimEndWith(url2, sizeof(url2), url, "/"); + ret = AdminWebSend302Redirect(s, url2, query_string, h); + } + else + { + BUF *b2 = AdminWebProcessServerSideInclude(b, filename, 0); + char *mime = GetMimeTypeFromFileName(filename); + + if (mime == NULL) + { + mime = "application/octet-stream"; + } + + ret = AdminWebSendBody(s, 200, "OK", b2->Buf, b2->Size, mime, NULL, NULL, h); + + FreeBuf(b2); + } + FreeBuf(b); + } + } + + return ret; +} + +// Try to find a file, and if exists return the file contents +BUF *AdminWebTryFindAndReadFile(char *vroot, char *proot, char *url, char *ret_filename, UINT ret_filename_size, bool *is_index_html) +{ + char tmp[MAX_PATH]; + char tmp2[MAX_PATH]; + UINT vroot_len; + UINT url_len; + char relative_path[MAX_PATH]; + BUF *b; + if (vroot == NULL || proot == NULL || url == NULL || ret_filename == NULL || is_index_html == NULL) + { + return NULL; + } + + *is_index_html = false; + + if (StartWith(url, vroot) == false) + { + return NULL; + } + + vroot_len = StrLen(vroot); + url_len = StrLen(url); + + StrCpy(relative_path, sizeof(relative_path), url + vroot_len); + + if (StartWith(relative_path, "/")) + { + char tmp3[MAX_PATH]; + + StrCpy(tmp3, sizeof(tmp3), relative_path + 1); + StrCpy(relative_path, sizeof(relative_path), tmp3); + } + + CombinePath(tmp, sizeof(tmp), proot, relative_path); + + // index.html + CombinePath(tmp2, sizeof(tmp2), tmp, "index.html"); + b = AdminWebTryOneFile(tmp2, ret_filename, ret_filename_size); + if (b != NULL) + { + *is_index_html = true; + return b; + } + + // dirname/filename + StrCpy(tmp2, sizeof(tmp2), tmp); + b = AdminWebTryOneFile(tmp2, ret_filename, ret_filename_size); + if (b != NULL) + { + return b; + } + + return NULL; +} +BUF *AdminWebTryOneFile(char *filename, char *ret_filename, UINT ret_filename_size) +{ + BUF *b; + if (filename == NULL || ret_filename == NULL) + { + return NULL; + } + + b = ReadDump(filename); + if (b == NULL) + { + return NULL; + } + + StrCpy(ret_filename, ret_filename_size, filename); + + return b; +} + +// Send a 401 Unauthorized error +bool AdminWebSendUnauthorized(SOCK *s, HTTP_HEADER *http_request_headers) +{ + char *http_401_str = "\r\n\r\n401 Unauthorized\r\n\r\n

" CEDAR_SERVER_STR ": Administrative authentication required.

\r\n

This VPN Server could not verify that you are authorized to access to the \r\nserver in administrative mode.

\r\n

For web browser logins:
You must supply the HTTP basic \r\nauthentication credential as following.

\r\n
    \r\n\t
  • To login to the VPN server as the entire server administrator, specify empty or "administrator" as the username field, and specify the server administrative \r\n\tpassword as the password field.
  • \r\n\t
  • To login to a particular Virtual Hub as the hub administrator, specify \r\n\tthe hub name as the username field, and specify the hub administrative \r\n\tpassword as the password field.
  • \r\n
\r\n

For JSON-RPC client logins:
Instead to HTTP basic \r\nauthentication, you can also specify the HTTP header parameters as following.

\r\n
    \r\n\t
  • X-VPNADMIN-HUBNAME: Empty to login to the VPN Server as the entire \r\n\tserver administrator, or specify the target Virtual Hub name as the hub \r\n\tadministrator.
  • \r\n\t
  • X-VPNADMIN-PASSWORD: Specify the administrative password.
  • \r\n
\r\n\r\n"; + bool ret; + // Validate arguments + if (s == NULL || http_request_headers == NULL) + { + return false; + } + + // Creating a Data + ret = AdminWebSendBody(s, 401, "Unauthorized", http_401_str, StrLen(http_401_str), HTTP_CONTENT_TYPE, + "WWW-Authenticate", + "Basic realm=\"Username 'administrator' for entire VPN Server privilege, or specify Virtual Hub name as the username for specified Virtual Hub administrative privilege.\"", + http_request_headers); + + return ret; +} + +// Send reply +bool AdminWebSendBody(SOCK *s, UINT status_code, char *status_string, UCHAR *data, UINT data_size, char *content_type, char *add_header_name, char *add_header_value, + HTTP_HEADER *request_headers) +{ + HTTP_HEADER *h; + char date_str[MAX_SIZE]; + char error_code_str[16]; + bool ret = false; + HTTP_VALUE *origin; + if (s == NULL || status_string == NULL || (data_size != 0 && data == NULL) || request_headers == NULL) + { + return false; + } + if (content_type == NULL) + { + content_type = "text/html; charset=utf-8"; + } + + ToStr(error_code_str, status_code); + GetHttpDateStr(date_str, sizeof(date_str), SystemTime64()); + + h = NewHttpHeader("HTTP/1.1", error_code_str, status_string); + + if (StrCmpi(request_headers->Method, "OPTIONS") == 0) + { + AddHttpValue(h, NewHttpValue("Allow", "OPTIONS, GET, POST")); + } + + AddHttpValue(h, NewHttpValue("Cache-Control", "no-cache")); + AddHttpValue(h, NewHttpValue("Content-Type", content_type)); + AddHttpValue(h, NewHttpValue("Date", date_str)); + AddHttpValue(h, NewHttpValue("Connection", "Keep-Alive")); + AddHttpValue(h, NewHttpValue("Access-Control-Allow-Methods", "OPTIONS,GET,POST")); + AddHttpValue(h, NewHttpValue("Access-Control-Allow-Headers", "X-VPNADMIN-HUBNAME,X-VPNADMIN-PASSWORD")); + AddHttpValue(h, NewHttpValue("Access-Control-Allow-Credentials", "true")); + + origin = GetHttpValue(request_headers, "Origin"); + if (origin != NULL) + { + AddHttpValue(h, NewHttpValue("Access-Control-Allow-Origin", origin->Data)); + } + + if (add_header_name != NULL && add_header_value != NULL) + { + AddHttpValue(h, NewHttpValue(add_header_name, add_header_value)); + } + + ret = PostHttp(s, h, data, data_size); + + FreeHttpHeader(h); + + return ret; +} + +// Send 404 error +bool AdminWebSend404Error(SOCK *s, HTTP_HEADER *request_headers) +{ + char *body = "\r\n404 Not Found

Not Found

The requested URL was not found on this server.

\r\n"; + if (s == NULL || request_headers == NULL) + { + return false; + } + + return AdminWebSendBody(s, 404, "Not Found", body, StrLen(body), NULL, NULL, NULL, request_headers); +} + +// Send 302 redirect +bool AdminWebSend302Redirect(SOCK *s, char *url, char *query_string, HTTP_HEADER *request_headers) +{ + bool ret = false; + char *txt; + UINT txt_size; + char *url2; + UINT url2_size; + char *body = "Object moved\r\n

Object moved to here.

\r\n"; + if (s == NULL || url == NULL || request_headers == NULL) + { + return false; + } + + url2_size = (StrSize(url) + StrSize(query_string) + MAX_SIZE) * 2; + url2 = ZeroMalloc(url2_size); + + StrCpy(url2, url2_size, url); + if (IsEmptyStr(query_string) == false) + { + StrCat(url2, url2_size, "?"); + StrCat(url2, url2_size, query_string); + } + + txt_size = (StrSize(body) + StrSize(url2) + MAX_SIZE) * 2; + txt = ZeroMalloc(txt_size); + + ReplaceStrEx(txt, txt_size, body, "$URL$", url2, false); + + ret = AdminWebSendBody(s, 302, "Found", txt, StrLen(txt), NULL, "Location", url2, request_headers); + + Free(txt); + + Free(url2); + + return ret; +} + +// "/admin" web page POST handler +void AdminWebProcPost(CONNECTION *c, SOCK *s, HTTP_HEADER *h, UINT post_data_size, char *url_target) +{ + ADMIN *a; + UCHAR *data; + char url[MAX_PATH]; + char query_string[MAX_SIZE]; + UINT i; + if (c == NULL || s == NULL || h == NULL || url_target == NULL) + { + return; + } + + a = JsonRpcAuthLogin(c->Cedar, s, h); + if (a == NULL) + { + RecvAllWithDiscard(s, post_data_size, s->SecureMode); + AdminWebSendUnauthorized(s, h); + return; + } + + if (post_data_size > a->MaxJsonRpcRecvSize) + { + Disconnect(s); + return; + } + + data = ZeroMalloc(post_data_size + 1); + + if (RecvAll(s, data, post_data_size, s->SecureMode)) + { + c->JsonRpcAuthed = true; +#ifndef GC_SOFTETHER_OSS + RemoveDosEntry(c->Listener, s); +#endif // GC_SOFTETHER_OSS + + // Divide url_target into URL and query string + StrCpy(url, sizeof(url), url_target); + Zero(query_string, sizeof(query_string)); + i = SearchStr(url, "?", 0); + if (i != INFINITE) + { + StrCpy(query_string, sizeof(query_string), url + i + 1); + url[i] = 0; + } + + AdminWebHandleFileRequest(a, c, s, h, url, query_string, "/admin", "|wwwroot/admin"); + } + + Free(data); + Free(a); +} + +// "/admin" web page GET handler +void AdminWebProcGet(CONNECTION *c, SOCK *s, HTTP_HEADER *h, char *url_target) +{ + ADMIN *a; + char url[MAX_PATH]; + char query_string[MAX_SIZE]; + UINT i; + if (c == NULL || s == NULL || h == NULL || url_target == NULL) + { + return; + } + + a = JsonRpcAuthLogin(c->Cedar, s, h); + if (a == NULL) + { + AdminWebSendUnauthorized(s, h); + return; + } + + c->JsonRpcAuthed = true; +#ifndef GC_SOFTETHER_OSS + RemoveDosEntry(c->Listener, s); +#endif // GC_SOFTETHER_OSS + + // Divide url_target into URL and query string + StrCpy(url, sizeof(url), url_target); + Zero(query_string, sizeof(query_string)); + i = SearchStr(url, "?", 0); + if (i != INFINITE) + { + StrCpy(query_string, sizeof(query_string), url + i + 1); + url[i] = 0; + } + + AdminWebHandleFileRequest(a, c, s, h, url, query_string, "/admin", "|wwwroot/admin"); + + Free(a); +} + +// New JSON-RPC Result +JSON_VALUE *JsonRpcNewResponse(PACK *p) +{ + JSON_VALUE *jv; + JSON_OBJECT *jo; + JSON_VALUE *jv2; + + if (p == NULL) + { + return NULL; + } + + jv = JsonNewObject(); + jo = JsonValueGetObject(jv); + + jv2 = PackToJson(p); + + JsonSet(jo, "result", jv2); + + return jv; +} + +// New JSON-RPC Error +JSON_VALUE *JsonRpcNewError(int code, wchar_t *message) +{ + wchar_t msg[MAX_PATH]; + JSON_VALUE *jv; + JSON_OBJECT *jo; + JSON_VALUE *jv2; + JSON_OBJECT *jo2; + + if (UniIsEmptyStr(message)) + { + UniFormat(msg, sizeof(msg), L"Error code %u", code); + } + else + { + UniFormat(msg, sizeof(msg), L"Error code %u: %s", code, message); + } + + jv = JsonNewObject(); + jo = JsonValueGetObject(jv); + + jv2 = JsonNewObject(); + jo2 = JsonValueGetObject(jv2); + + JsonSet(jo, "error", jv2); + + JsonSetNumber(jo2, "code", (UINT64)code); + JsonSetUniStr(jo2, "message", msg); + + return jv; +} + +// JSON-RPC process request object +JSON_VALUE *JsonRpcProcRequestObject(ADMIN *admin, CONNECTION *c, SOCK *s, JSON_VALUE *json_req, char *method_name) +{ + PACK *pack_request; + JSON_VALUE *ret = NULL; + if (c == NULL || s == NULL || json_req == NULL || admin == NULL) + { + return NULL; + } + + pack_request = JsonToPack(json_req); + + PackAddStr(pack_request, "function_name", method_name); + + if (pack_request != NULL) + { + RPC *rpc; + PACK *pack_response; + UINT err; + + // RPC Server + rpc = StartRpcServer(s, AdminDispatch, admin); + + admin->Rpc = rpc; + + pack_response = CallRpcDispatcher(rpc, pack_request); + + if (pack_response == NULL) + { + pack_response = PackError(ERR_NOT_SUPPORTED); + } + + RpcFreeEx(rpc, true); + + FreePack(pack_request); + + // Construct response object + err = GetErrorFromPack(pack_response); + if (err != 0) + { + // Return the error + ret = JsonRpcNewError(err, _E(err)); + } + else + { + // Return the PACK + ret = JsonRpcNewResponse(pack_response); + } + + SLog(admin->Server->Cedar, "LS_API_RPC_CALL", + &s->RemoteIP, s->RemotePort, s->RemoteHostname, + method_name, err, _E(err)); + + FreePack(pack_response); + } + + return ret; +} + +// JSON-RPC HTTP user authentication +bool HttpParseBasicAuthHeader(HTTP_HEADER *h, char *username, UINT username_size, char *password, UINT password_size) +{ + bool ret = false; + HTTP_VALUE *auth_value; + HTTP_VALUE *vpnadmin_hubname; + HTTP_VALUE *vpnadmin_password; + if (h == NULL || username == NULL || password == NULL) + { + return false; + } + + auth_value = GetHttpValue(h, "Authorization"); + vpnadmin_hubname = GetHttpValue(h, "X-VPNADMIN-HUBNAME"); + vpnadmin_password = GetHttpValue(h, "X-VPNADMIN-PASSWORD"); + + if (vpnadmin_password != NULL) + { + if (vpnadmin_hubname == NULL) + { + StrCpy(username, username_size, ""); + } + else + { + StrCpy(username, username_size, vpnadmin_hubname->Data); + } + + StrCpy(password, password_size, vpnadmin_password->Data); + + ret = true; + } + + if (ret == false && auth_value != NULL) + { + char key[32], value[MAX_SIZE]; + + if (GetKeyAndValue(auth_value->Data, key, sizeof(key), value, sizeof(value), " \t")) + { + if (StrCmpi(key, "Basic") == 0 && IsEmptyStr(value) == false) + { + UINT b64_dest_size = StrSize(value) * 2 + 256; + char *b64_dest = ZeroMalloc(b64_dest_size); + + Decode64(b64_dest, value); + + if (IsEmptyStr(b64_dest) == false) + { + if (b64_dest[0] == ':') + { + // Empty username + StrCpy(username, username_size, ""); + StrCpy(password, password_size, b64_dest + 1); + ret = true; + } + else + { + if (GetKeyAndValue(b64_dest, username, username_size, password, password_size, ":")) + { + ret = true; + } + } + } + + Free(b64_dest); + } + } + } + + return ret; +} + +// JSON-RPC Login +ADMIN *JsonRpcAuthLogin(CEDAR *c, SOCK *sock, HTTP_HEADER *h) +{ + ADMIN *a = NULL; + char username[MAX_HUBNAME_LEN + 1]; + char password[MAX_PASSWORD_LEN + 1]; + SERVER *s; + char empty_pw_hash[SHA1_SIZE]; + + if (c == NULL || h == NULL || sock == NULL) + { + return NULL; + } + + s = c->Server; + + HashAdminPassword(empty_pw_hash, ""); + + Zero(username, sizeof(username)); + Zero(password, sizeof(password)); + + if (HttpParseBasicAuthHeader(h, username, sizeof(username), password, sizeof(password))) + { + char pw_hash[SHA1_SIZE]; + bool is_server_admin = false; + bool is_hub_admin = false; + char hub_name[MAX_HUBNAME_LEN + 1]; + + HashAdminPassword(pw_hash, password); + + Zero(hub_name, sizeof(hub_name)); + + // Check if the server administrator password is empty. If yes, login always success. + if (Cmp(s->HashedPassword, empty_pw_hash, SHA1_SIZE) == 0) + { + is_server_admin = true; + } + else + { + if (IsEmptyStr(username) || StrCmpi(username, ADMINISTRATOR_USERNAME) == 0) + { + // If the username is empty or 'administrator', verify with the server admin password. + if (Cmp(s->HashedPassword, pw_hash, SHA1_SIZE) == 0) + { + is_server_admin = true; + } + } + } + + if (is_server_admin == false) + { + HUB *h; + // Hub admin mode + LockHubList(c); + { + h = GetHub(c, username); + } + UnlockHubList(c); + + if (h != NULL) + { + Lock(h->lock); + { + if (Cmp(h->HashedPassword, empty_pw_hash, SHA1_SIZE) != 0 && IsZero(h->HashedPassword, sizeof(h->HashedPassword)) == false) + { + if (Cmp(pw_hash, h->HashedPassword, SHA1_SIZE) == 0) + { + is_hub_admin = true; + + StrCpy(hub_name, sizeof(hub_name), h->Name); + } + } + } + Unlock(h->lock); + + ReleaseHub(h); + } + } + + if (is_server_admin || is_hub_admin) + { + if (CheckAdminSourceAddress(sock, hub_name)) + { + a = ZeroMalloc(sizeof(ADMIN)); + + a->Server = s; + a->ServerAdmin = is_server_admin; + a->ClientBuild = c->Build; + + if (is_hub_admin) + { + StrCpy(a->dummy1, sizeof(a->dummy1), hub_name); + a->HubName = a->dummy1; + } + } + } + } + + if (a != NULL) + { + char admin_mode[256]; + if (a->ServerAdmin) + { + a->MaxJsonRpcRecvSize = ADMIN_RPC_MAX_POST_SIZE_BY_SERVER_ADMIN; + } + else + { + a->MaxJsonRpcRecvSize = ADMIN_RPC_MAX_POST_SIZE_BY_HUB_ADMIN; + } + + if (IsEmptyStr(a->HubName)) + { + StrCpy(admin_mode, sizeof(admin_mode), + "Entire VPN Server Admin Mode"); + } + else + { + Format(admin_mode, sizeof(admin_mode), + "Virtual Hub Admin Mode for '%s'", + a->HubName); + } + + SLog(s->Cedar, "LS_API_AUTH_OK", + &sock->RemoteIP, sock->RemotePort, sock->RemoteHostname, + admin_mode, username, h->Method, h->Target); + } + else + { + SLog(s->Cedar, "LS_API_AUTH_ERROR", + &sock->RemoteIP, sock->RemotePort, sock->RemoteHostname, + username, h->Method, h->Target); + } + + + return a; +} + +// Query string to JSON list value +JSON_VALUE *QueryStringToJsonListValue(char *qs) +{ + TOKEN_LIST *t; + UINT i; + LIST *distinct_list = NULL; + JSON_VALUE *v = NULL; + JSON_OBJECT *o = NULL; + if (qs == NULL) + { + return NULL; + } + + t = ParseTokenWithoutNullStr(qs, "&"); + if (t == NULL) + { + return NULL; + } + + distinct_list = NewStrList(); + + v = JsonNewObject(); + o = JsonValueGetObject(v); + + for (i = 0;i < t->NumTokens;i++) + { + char *token = t->Token[i]; + UINT pos; + + pos = SearchStr(token, "=", 0); + if (pos != INFINITE) + { + char *key_decoded; + char *value_decoded; + char *key = CopyStr(token); + char *value = CopyStr(token + pos + 1); + + key[pos] = 0; + key_decoded = UrlDecode(key); + value_decoded = UrlDecode(value); + + if (key_decoded != NULL && value_decoded != NULL) + { + if (AddStrToStrListDistinct(distinct_list, key_decoded)) + { + JsonSetStr(o, key_decoded, value_decoded); + } + } + + Free(value_decoded); + Free(key_decoded); + Free(key); + Free(value); + } + } + + FreeToken(t); + + FreeStrList(distinct_list); + + return v; +} + +// Construct new JSON-RPC dummy request +JSON_VALUE *ConstructDummyJsonRpcRequest(char *method_name, JSON_VALUE *p) +{ + JSON_VALUE *ret; + JSON_OBJECT *ret_object; + UCHAR rand[16]; + char id_str[64]; + + Rand(rand, sizeof(rand)); + + BinToStr(id_str, sizeof(id_str), rand, sizeof(rand)); + + ret = JsonNewObject(); + ret_object = JsonObject(ret); + + JsonSetStr(ret_object, "jsonrpc", "2.0"); + JsonSetStr(ret_object, "method", method_name); + JsonSet(ret_object, "params", p); + JsonSetStr(ret_object, "id", id_str); + + return ret; +} + +// JSON-RPC Options Dispatch +void JsonRpcProcOptions(CONNECTION *c, SOCK *s, HTTP_HEADER *h, char *url_target) +{ + if (c == NULL || s == NULL || h == NULL || url_target == NULL) + { + return; + } + + c->JsonRpcAuthed = true; + +#ifndef GC_SOFTETHER_OSS + RemoveDosEntry(c->Listener, s); +#endif // GC_SOFTETHER_OSS + + AdminWebSendBody(s, 200, "OK", NULL, 0, NULL, NULL, NULL, h); +} + +// JSON-RPC GET Dispatch +void JsonRpcProcGet(CONNECTION *c, SOCK *s, HTTP_HEADER *h, char *url_target) +{ + ADMIN *a; + char url[MAX_PATH]; + char query_string[MAX_SIZE]; + UINT i; + bool reply_sent = false; + if (c == NULL || s == NULL || h == NULL || url_target == NULL) + { + return; + } + + a = JsonRpcAuthLogin(c->Cedar, s, h); + if (a == NULL) + { + AdminWebSendUnauthorized(s, h); + return; + } + + c->JsonRpcAuthed = true; + +#ifndef GC_SOFTETHER_OSS + RemoveDosEntry(c->Listener, s); +#endif // GC_SOFTETHER_OSS + + // Divide url_target into URL and query string + StrCpy(url, sizeof(url), url_target); + Zero(query_string, sizeof(query_string)); + i = SearchStr(url, "?", 0); + if (i != INFINITE) + { + StrCpy(query_string, sizeof(query_string), url + i + 1); + url[i] = 0; + } + + if (StartWith(url, "/api/")) + { + // Call a method + JSON_VALUE *params_value = NULL; + JSON_OBJECT *params_object = NULL; + UINT i; + char method_name[MAX_PATH]; + + StrCpy(method_name, sizeof(method_name), url + 5); + + i = SearchStr(method_name, "/", 0); + if (i != INFINITE) + { + method_name[i] = 0; + } + + if (IsEmptyStr(method_name) == false) + { + // Call a method + params_value = QueryStringToJsonListValue(query_string); + + if (params_value != NULL) + { + JSON_VALUE *json_ret = NULL; + char id[96]; + char *ret_str = NULL; + + GetDateTimeStrMilli64(id, sizeof(id), LocalTime64()); + + params_object = JsonObject(params_value); + + // Process the request + json_ret = JsonRpcProcRequestObject(a, c, s, params_value, method_name); + + if (json_ret == NULL) + { + json_ret = JsonRpcNewError(ERR_INTERNAL_ERROR, L"Internal error"); + } + + JsonSetStr(JsonObject(json_ret), "jsonrpc", "2.0"); + JsonSetStr(JsonObject(json_ret), "id", id); + + ret_str = JsonToStr(json_ret); + + AdminWebSendBody(s, 200, "OK", ret_str, StrLen(ret_str), "text/plain; charset=UTF-8", NULL, NULL, h); + + Free(ret_str); + JsonFree(json_ret); + JsonFree(params_value); + } + } + } + + + if (reply_sent == false) + { + BUF *html_buf = ReadDump("|vpnserver_api_doc.html"); + + if (html_buf != NULL) + { + AdminWebSendBody(s, 200, "OK", html_buf->Buf, html_buf->Size, "text/html; charset=UTF-8", NULL, NULL, h); + + FreeBuf(html_buf); + } + else + { + AdminWebSend404Error(s, h); + } + } + + if (a->LogFileList != NULL) + { + FreeEnumLogFile(a->LogFileList); + } + Free(a); +} + +// JSON-RPC POST Dispatch +void JsonRpcProcPost(CONNECTION *c, SOCK *s, HTTP_HEADER *h, UINT post_data_size) +{ + ADMIN *a; + UCHAR *data; + if (c == NULL || s == NULL || h == NULL) + { + return; + } + + a = JsonRpcAuthLogin(c->Cedar, s, h); + if (a == NULL) + { + RecvAllWithDiscard(s, post_data_size, s->SecureMode); + AdminWebSendUnauthorized(s, h); + return; + } + + if (post_data_size > a->MaxJsonRpcRecvSize) + { + Disconnect(s); + return; + } + + data = ZeroMalloc(post_data_size + 1); + + if (RecvAll(s, data, post_data_size, s->SecureMode)) + { + // Parse JSON + JSON_VALUE *json_req = StrToJson(data); + JSON_OBJECT *json_req_object = JsonObject(json_req); + JSON_VALUE *json_ret = NULL; + char *res = NULL; + char *request_id = NULL; + char *method_name = NULL; + + c->JsonRpcAuthed = true; + +#ifndef GC_SOFTETHER_OSS + RemoveDosEntry(c->Listener, s); +#endif // GC_SOFTETHER_OSS + + if (json_req == NULL || json_req_object == NULL) + { + // Parse error + json_ret = JsonRpcNewError(ERR_INVALID_PARAMETER, L"Parameter is invalid: JSON-RPC Parse Error"); + } + else + { + // check the JSON-RPC version + char *ver_str = JsonGetStr(json_req_object, "jsonrpc"); + if (StrCmpi(ver_str, "2.0") != 0) + { + // Invalid version + json_ret = JsonRpcNewError(ERR_INVALID_PARAMETER, L"JSON-RPC version is invalid"); + } + else + { + JSON_VALUE *params_value = NULL; + JSON_OBJECT *params_object = NULL; + + // Get Request ID + request_id = JsonGetStr(json_req_object, "id"); + + // Get method name + method_name = JsonGetStr(json_req_object, "method"); + + // Get parameters + params_value = JsonGet(json_req_object, "params"); + params_object = JsonObject(params_value); + + if (IsEmptyStr(method_name)) + { + // method is empty + json_ret = JsonRpcNewError(ERR_INVALID_PARAMETER, L"JSON-RPC method name is empty"); + } + else if (params_value == NULL || params_object == NULL) + { + // params is empty + json_ret = JsonRpcNewError(ERR_INVALID_PARAMETER, L"JSON-RPC parameter is empty"); + } + else + { + // Process the request + json_ret = JsonRpcProcRequestObject(a, c, s, params_value, method_name); + } + } + } + + if (json_ret == NULL) + { + json_ret = JsonRpcNewError(ERR_INTERNAL_ERROR, L"Internal error"); + } + + JsonSetStr(JsonObject(json_ret), "jsonrpc", "2.0"); + if (request_id == NULL) + { + request_id = "0"; + } + JsonSetStr(JsonObject(json_ret), "id", request_id); + + res = JsonToStr(json_ret); + + AdminWebSendBody(s, 200, "OK", res, StrLen(res), "application/json", NULL, NULL, h); + + Free(res); + + JsonFree(json_ret); + JsonFree(json_req); + } + + Free(data); + + if (a->LogFileList != NULL) + { + FreeEnumLogFile(a->LogFileList); + } + Free(a); +} + +// Dispatch routine for Administration RPC +PACK *AdminDispatch(RPC *rpc, char *name, PACK *p) +{ + ADMIN *a; + PACK *ret; + UINT err; + SERVER *server = NULL; + CEDAR *cedar = NULL; + bool ok = false; + // Validate arguments + if (rpc == NULL || name == NULL || p == NULL) + { + return NULL; + } + + ret = NewPack(); + err = ERR_NO_ERROR; + + // Administration structure + a = (ADMIN *)rpc->Param; + if (a == NULL) + { + FreePack(ret); + return NULL; + } + + server = a->Server; + + if (server == NULL) + { + return NULL; + } + + cedar = server->Cedar; + Lock(cedar->CedarSuperLock); + + if (true) + { + char tmp[MAX_PATH]; + char ip[MAX_PATH]; + UINT rpc_id = 0; + + StrCpy(ip, sizeof(ip), "Unknown"); + + if (rpc->Sock != NULL) + { + IPToStr(ip, sizeof(ip), &rpc->Sock->RemoteIP); + rpc_id = rpc->Sock->socket; + } + + Format(tmp, sizeof(tmp), "RPC: RPC-%u (%s): Entering RPC [%s]...", + rpc_id, ip, name); + + SiDebugLog(a->Server, tmp); + } + + if (0) {} + + // RPC function declaration: from here + DECLARE_RPC_EX("Test", RPC_TEST, StTest, InRpcTest, OutRpcTest, FreeRpcTest) + DECLARE_RPC_EX("GetServerInfo", RPC_SERVER_INFO, StGetServerInfo, InRpcServerInfo, OutRpcServerInfo, FreeRpcServerInfo) + DECLARE_RPC("GetServerStatus", RPC_SERVER_STATUS, StGetServerStatus, InRpcServerStatus, OutRpcServerStatus) + DECLARE_RPC("CreateListener", RPC_LISTENER, StCreateListener, InRpcListener, OutRpcListener) + DECLARE_RPC_EX("EnumListener", RPC_LISTENER_LIST, StEnumListener, InRpcListenerList, OutRpcListenerList, FreeRpcListenerList) + DECLARE_RPC("DeleteListener", RPC_LISTENER, StDeleteListener, InRpcListener, OutRpcListener) + DECLARE_RPC("EnableListener", RPC_LISTENER, StEnableListener, InRpcListener, OutRpcListener) + DECLARE_RPC_EX("SetPortsUDP", RPC_PORTS, StSetPortsUDP, InRpcPorts, OutRpcPorts, FreeRpcPorts) + DECLARE_RPC_EX("GetPortsUDP", RPC_PORTS, StGetPortsUDP, InRpcPorts, OutRpcPorts, FreeRpcPorts) + DECLARE_RPC_EX("SetProtoOptions", RPC_PROTO_OPTIONS, StSetProtoOptions, InRpcProtoOptions, OutRpcProtoOptions, FreeRpcProtoOptions) + DECLARE_RPC_EX("GetProtoOptions", RPC_PROTO_OPTIONS, StGetProtoOptions, InRpcProtoOptions, OutRpcProtoOptions, FreeRpcProtoOptions) + DECLARE_RPC("SetServerPassword", RPC_SET_PASSWORD, StSetServerPassword, InRpcSetPassword, OutRpcSetPassword) + DECLARE_RPC_EX("SetFarmSetting", RPC_FARM, StSetFarmSetting, InRpcFarm, OutRpcFarm, FreeRpcFarm) + DECLARE_RPC_EX("GetFarmSetting", RPC_FARM, StGetFarmSetting, InRpcFarm, OutRpcFarm, FreeRpcFarm) + DECLARE_RPC_EX("GetFarmInfo", RPC_FARM_INFO, StGetFarmInfo, InRpcFarmInfo, OutRpcFarmInfo, FreeRpcFarmInfo) + DECLARE_RPC_EX("EnumFarmMember", RPC_ENUM_FARM, StEnumFarmMember, InRpcEnumFarm, OutRpcEnumFarm, FreeRpcEnumFarm) + DECLARE_RPC("GetFarmConnectionStatus", RPC_FARM_CONNECTION_STATUS, StGetFarmConnectionStatus, InRpcFarmConnectionStatus, OutRpcFarmConnectionStatus) + DECLARE_RPC_EX("SetServerCert", RPC_KEY_PAIR, StSetServerCert, InRpcKeyPair, OutRpcKeyPair, FreeRpcKeyPair) + DECLARE_RPC_EX("GetServerCert", RPC_KEY_PAIR, StGetServerCert, InRpcKeyPair, OutRpcKeyPair, FreeRpcKeyPair) + DECLARE_RPC_EX("GetServerCipherList", RPC_STR, StGetServerCipherList, InRpcStr, OutRpcStr, FreeRpcStr) + DECLARE_RPC_EX("GetServerCipher", RPC_STR, StGetServerCipher, InRpcStr, OutRpcStr, FreeRpcStr) + DECLARE_RPC_EX("SetServerCipher", RPC_STR, StSetServerCipher, InRpcStr, OutRpcStr, FreeRpcStr) + DECLARE_RPC("CreateHub", RPC_CREATE_HUB, StCreateHub, InRpcCreateHub, OutRpcCreateHub) + DECLARE_RPC("SetHub", RPC_CREATE_HUB, StSetHub, InRpcCreateHub, OutRpcCreateHub) + DECLARE_RPC("GetHub", RPC_CREATE_HUB, StGetHub, InRpcCreateHub, OutRpcCreateHub) + DECLARE_RPC_EX("EnumHub", RPC_ENUM_HUB, StEnumHub, InRpcEnumHub, OutRpcEnumHub, FreeRpcEnumHub) + DECLARE_RPC("DeleteHub", RPC_DELETE_HUB, StDeleteHub, InRpcDeleteHub, OutRpcDeleteHub) + DECLARE_RPC("GetHubRadius", RPC_RADIUS, StGetHubRadius, InRpcRadius, OutRpcRadius) + DECLARE_RPC("SetHubRadius", RPC_RADIUS, StSetHubRadius, InRpcRadius, OutRpcRadius) + DECLARE_RPC_EX("EnumConnection", RPC_ENUM_CONNECTION, StEnumConnection, InRpcEnumConnection, OutRpcEnumConnection, FreeRpcEnumConnection) + DECLARE_RPC("DisconnectConnection", RPC_DISCONNECT_CONNECTION, StDisconnectConnection, InRpcDisconnectConnection, OutRpcDisconnectConnection) + DECLARE_RPC("GetConnectionInfo", RPC_CONNECTION_INFO, StGetConnectionInfo, InRpcConnectionInfo, OutRpcConnectionInfo) + DECLARE_RPC("SetHubOnline", RPC_SET_HUB_ONLINE, StSetHubOnline, InRpcSetHubOnline, OutRpcSetHubOnline) + DECLARE_RPC("GetHubStatus", RPC_HUB_STATUS, StGetHubStatus, InRpcHubStatus, OutRpcHubStatus) + DECLARE_RPC("SetHubLog", RPC_HUB_LOG, StSetHubLog, InRpcHubLog, OutRpcHubLog) + DECLARE_RPC("GetHubLog", RPC_HUB_LOG, StGetHubLog, InRpcHubLog, OutRpcHubLog) + DECLARE_RPC_EX("AddCa", RPC_HUB_ADD_CA, StAddCa, InRpcHubAddCa, OutRpcHubAddCa, FreeRpcHubAddCa) + DECLARE_RPC_EX("EnumCa", RPC_HUB_ENUM_CA, StEnumCa, InRpcHubEnumCa, OutRpcHubEnumCa, FreeRpcHubEnumCa) + DECLARE_RPC_EX("GetCa", RPC_HUB_GET_CA, StGetCa, InRpcHubGetCa, OutRpcHubGetCa, FreeRpcHubGetCa) + DECLARE_RPC("DeleteCa", RPC_HUB_DELETE_CA, StDeleteCa, InRpcHubDeleteCa, OutRpcHubDeleteCa) + DECLARE_RPC("SetLinkOnline", RPC_LINK, StSetLinkOnline, InRpcLink, OutRpcLink) + DECLARE_RPC("SetLinkOffline", RPC_LINK, StSetLinkOffline, InRpcLink, OutRpcLink) + DECLARE_RPC("DeleteLink", RPC_LINK, StDeleteLink, InRpcLink, OutRpcLink) + DECLARE_RPC("RenameLink", RPC_RENAME_LINK, StRenameLink, InRpcRenameLink, OutRpcRenameLink) + DECLARE_RPC_EX("CreateLink", RPC_CREATE_LINK, StCreateLink, InRpcCreateLink, OutRpcCreateLink, FreeRpcCreateLink) + DECLARE_RPC_EX("GetLink", RPC_CREATE_LINK, StGetLink, InRpcCreateLink, OutRpcCreateLink, FreeRpcCreateLink) + DECLARE_RPC_EX("SetLink", RPC_CREATE_LINK, StSetLink, InRpcCreateLink, OutRpcCreateLink, FreeRpcCreateLink) + DECLARE_RPC_EX("EnumLink", RPC_ENUM_LINK, StEnumLink, InRpcEnumLink, OutRpcEnumLink, FreeRpcEnumLink) + DECLARE_RPC_EX("GetLinkStatus", RPC_LINK_STATUS, StGetLinkStatus, InRpcLinkStatus, OutRpcLinkStatus, FreeRpcLinkStatus) + DECLARE_RPC("AddAccess", RPC_ADD_ACCESS, StAddAccess, InRpcAddAccess, OutRpcAddAccess) + DECLARE_RPC("DeleteAccess", RPC_DELETE_ACCESS, StDeleteAccess, InRpcDeleteAccess, OutRpcDeleteAccess) + DECLARE_RPC_EX("EnumAccess", RPC_ENUM_ACCESS_LIST, StEnumAccess, InRpcEnumAccessList, OutRpcEnumAccessList, FreeRpcEnumAccessList) + DECLARE_RPC_EX("SetAccessList", RPC_ENUM_ACCESS_LIST, StSetAccessList, InRpcEnumAccessList, OutRpcEnumAccessList, FreeRpcEnumAccessList) + DECLARE_RPC_EX("CreateUser", RPC_SET_USER, StCreateUser, InRpcSetUser, OutRpcSetUser, FreeRpcSetUser) + DECLARE_RPC_EX("SetUser", RPC_SET_USER, StSetUser, InRpcSetUser, OutRpcSetUser, FreeRpcSetUser) + DECLARE_RPC_EX("GetUser", RPC_SET_USER, StGetUser, InRpcSetUser, OutRpcSetUser, FreeRpcSetUser) + DECLARE_RPC("DeleteUser", RPC_DELETE_USER, StDeleteUser, InRpcDeleteUser, OutRpcDeleteUser) + DECLARE_RPC_EX("EnumUser", RPC_ENUM_USER, StEnumUser, InRpcEnumUser, OutRpcEnumUser, FreeRpcEnumUser) + DECLARE_RPC_EX("CreateGroup", RPC_SET_GROUP, StCreateGroup, InRpcSetGroup, OutRpcSetGroup, FreeRpcSetGroup) + DECLARE_RPC_EX("SetGroup", RPC_SET_GROUP, StSetGroup, InRpcSetGroup, OutRpcSetGroup, FreeRpcSetGroup) + DECLARE_RPC_EX("GetGroup", RPC_SET_GROUP, StGetGroup, InRpcSetGroup, OutRpcSetGroup, FreeRpcSetGroup) + DECLARE_RPC("DeleteGroup", RPC_DELETE_USER, StDeleteGroup, InRpcDeleteUser, OutRpcDeleteUser) + DECLARE_RPC_EX("EnumGroup", RPC_ENUM_GROUP, StEnumGroup, InRpcEnumGroup, OutRpcEnumGroup, FreeRpcEnumGroup) + DECLARE_RPC_EX("EnumSession", RPC_ENUM_SESSION, StEnumSession, InRpcEnumSession, OutRpcEnumSession, FreeRpcEnumSession) + DECLARE_RPC_EX("GetSessionStatus", RPC_SESSION_STATUS, StGetSessionStatus, InRpcSessionStatus, OutRpcSessionStatus, FreeRpcSessionStatus) + DECLARE_RPC("DeleteSession", RPC_DELETE_SESSION, StDeleteSession, InRpcDeleteSession, OutRpcDeleteSession) + DECLARE_RPC_EX("EnumMacTable", RPC_ENUM_MAC_TABLE, StEnumMacTable, InRpcEnumMacTable, OutRpcEnumMacTable, FreeRpcEnumMacTable) + DECLARE_RPC("DeleteMacTable", RPC_DELETE_TABLE, StDeleteMacTable, InRpcDeleteTable, OutRpcDeleteTable) + DECLARE_RPC_EX("EnumIpTable", RPC_ENUM_IP_TABLE, StEnumIpTable, InRpcEnumIpTable, OutRpcEnumIpTable, FreeRpcEnumIpTable) + DECLARE_RPC("DeleteIpTable", RPC_DELETE_TABLE, StDeleteIpTable, InRpcDeleteTable, OutRpcDeleteTable) + DECLARE_RPC("SetKeep", RPC_KEEP, StSetKeep, InRpcKeep, OutRpcKeep) + DECLARE_RPC("GetKeep", RPC_KEEP, StGetKeep, InRpcKeep, OutRpcKeep) + DECLARE_RPC("EnableSecureNAT", RPC_HUB, StEnableSecureNAT, InRpcHub, OutRpcHub) + DECLARE_RPC("DisableSecureNAT", RPC_HUB, StDisableSecureNAT, InRpcHub, OutRpcHub) + DECLARE_RPC("SetSecureNATOption", VH_OPTION, StSetSecureNATOption, InVhOption, OutVhOption) + DECLARE_RPC("GetSecureNATOption", VH_OPTION, StGetSecureNATOption, InVhOption, OutVhOption) + DECLARE_RPC_EX("EnumNAT", RPC_ENUM_NAT, StEnumNAT, InRpcEnumNat, OutRpcEnumNat, FreeRpcEnumNat) + DECLARE_RPC_EX("EnumDHCP", RPC_ENUM_DHCP, StEnumDHCP, InRpcEnumDhcp, OutRpcEnumDhcp, FreeRpcEnumDhcp) + DECLARE_RPC("GetSecureNATStatus", RPC_NAT_STATUS, StGetSecureNATStatus, InRpcNatStatus, OutRpcNatStatus) + DECLARE_RPC_EX("EnumEthernet", RPC_ENUM_ETH, StEnumEthernet, InRpcEnumEth, OutRpcEnumEth, FreeRpcEnumEth) + DECLARE_RPC("AddLocalBridge", RPC_LOCALBRIDGE, StAddLocalBridge, InRpcLocalBridge, OutRpcLocalBridge) + DECLARE_RPC("DeleteLocalBridge", RPC_LOCALBRIDGE, StDeleteLocalBridge, InRpcLocalBridge, OutRpcLocalBridge) + DECLARE_RPC_EX("EnumLocalBridge", RPC_ENUM_LOCALBRIDGE, StEnumLocalBridge, InRpcEnumLocalBridge, OutRpcEnumLocalBridge, FreeRpcEnumLocalBridge) + DECLARE_RPC("GetBridgeSupport", RPC_BRIDGE_SUPPORT, StGetBridgeSupport, InRpcBridgeSupport, OutRpcBridgeSupport) + DECLARE_RPC("RebootServer", RPC_TEST, StRebootServer, InRpcTest, OutRpcTest) + DECLARE_RPC_EX("GetCaps", CAPSLIST, StGetCaps, InRpcCapsList, OutRpcCapsList, FreeRpcCapsList) + DECLARE_RPC_EX("GetConfig", RPC_CONFIG, StGetConfig, InRpcConfig, OutRpcConfig, FreeRpcConfig) + DECLARE_RPC_EX("SetConfig", RPC_CONFIG, StSetConfig, InRpcConfig, OutRpcConfig, FreeRpcConfig) + DECLARE_RPC_EX("GetDefaultHubAdminOptions", RPC_ADMIN_OPTION, StGetDefaultHubAdminOptions, InRpcAdminOption, OutRpcAdminOption, FreeRpcAdminOption) + DECLARE_RPC_EX("GetHubAdminOptions", RPC_ADMIN_OPTION, StGetHubAdminOptions, InRpcAdminOption, OutRpcAdminOption, FreeRpcAdminOption) + DECLARE_RPC_EX("SetHubAdminOptions", RPC_ADMIN_OPTION, StSetHubAdminOptions, InRpcAdminOption, OutRpcAdminOption, FreeRpcAdminOption) + DECLARE_RPC_EX("GetHubExtOptions", RPC_ADMIN_OPTION, StGetHubExtOptions, InRpcAdminOption, OutRpcAdminOption, FreeRpcAdminOption) + DECLARE_RPC_EX("SetHubExtOptions", RPC_ADMIN_OPTION, StSetHubExtOptions, InRpcAdminOption, OutRpcAdminOption, FreeRpcAdminOption) + DECLARE_RPC("AddL3Switch", RPC_L3SW, StAddL3Switch, InRpcL3Sw, OutRpcL3Sw) + DECLARE_RPC("DelL3Switch", RPC_L3SW, StDelL3Switch, InRpcL3Sw, OutRpcL3Sw) + DECLARE_RPC_EX("EnumL3Switch", RPC_ENUM_L3SW, StEnumL3Switch, InRpcEnumL3Sw, OutRpcEnumL3Sw, FreeRpcEnumL3Sw) + DECLARE_RPC("StartL3Switch", RPC_L3SW, StStartL3Switch, InRpcL3Sw, OutRpcL3Sw) + DECLARE_RPC("StopL3Switch", RPC_L3SW, StStopL3Switch, InRpcL3Sw, OutRpcL3Sw) + DECLARE_RPC("AddL3If", RPC_L3IF, StAddL3If, InRpcL3If, OutRpcL3If) + DECLARE_RPC("DelL3If", RPC_L3IF, StDelL3If, InRpcL3If, OutRpcL3If) + DECLARE_RPC_EX("EnumL3If", RPC_ENUM_L3IF, StEnumL3If, InRpcEnumL3If, OutRpcEnumL3If, FreeRpcEnumL3If) + DECLARE_RPC("AddL3Table", RPC_L3TABLE, StAddL3Table, InRpcL3Table, OutRpcL3Table) + DECLARE_RPC("DelL3Table", RPC_L3TABLE, StDelL3Table, InRpcL3Table, OutRpcL3Table) + DECLARE_RPC_EX("EnumL3Table", RPC_ENUM_L3TABLE, StEnumL3Table, InRpcEnumL3Table, OutRpcEnumL3Table, FreeRpcEnumL3Table) + DECLARE_RPC_EX("EnumCrl", RPC_ENUM_CRL, StEnumCrl, InRpcEnumCrl, OutRpcEnumCrl, FreeRpcEnumCrl) + DECLARE_RPC_EX("AddCrl", RPC_CRL, StAddCrl, InRpcCrl, OutRpcCrl, FreeRpcCrl) + DECLARE_RPC_EX("DelCrl", RPC_CRL, StDelCrl, InRpcCrl, OutRpcCrl, FreeRpcCrl) + DECLARE_RPC_EX("GetCrl", RPC_CRL, StGetCrl, InRpcCrl, OutRpcCrl, FreeRpcCrl) + DECLARE_RPC_EX("SetCrl", RPC_CRL, StSetCrl, InRpcCrl, OutRpcCrl, FreeRpcCrl) + DECLARE_RPC_EX("SetAcList", RPC_AC_LIST, StSetAcList, InRpcAcList, OutRpcAcList, FreeRpcAcList) + DECLARE_RPC_EX("GetAcList", RPC_AC_LIST, StGetAcList, InRpcAcList, OutRpcAcList, FreeRpcAcList) + DECLARE_RPC_EX("EnumLogFile", RPC_ENUM_LOG_FILE, StEnumLogFile, InRpcEnumLogFile, OutRpcEnumLogFile, FreeRpcEnumLogFile) + DECLARE_RPC_EX("ReadLogFile", RPC_READ_LOG_FILE, StReadLogFile, InRpcReadLogFile, OutRpcReadLogFile, FreeRpcReadLogFile) + DECLARE_RPC("AddLicenseKey", RPC_TEST, StAddLicenseKey, InRpcTest, OutRpcTest) + DECLARE_RPC("DelLicenseKey", RPC_TEST, StDelLicenseKey, InRpcTest, OutRpcTest) + DECLARE_RPC_EX("EnumLicenseKey", RPC_ENUM_LICENSE_KEY, StEnumLicenseKey, InRpcEnumLicenseKey, OutRpcEnumLicenseKey, FreeRpcEnumLicenseKey) + DECLARE_RPC("GetLicenseStatus", RPC_LICENSE_STATUS, StGetLicenseStatus, InRpcLicenseStatus, OutRpcLicenseStatus) + DECLARE_RPC("SetSysLog", SYSLOG_SETTING, StSetSysLog, InRpcSysLogSetting, OutRpcSysLogSetting) + DECLARE_RPC("GetSysLog", SYSLOG_SETTING, StGetSysLog, InRpcSysLogSetting, OutRpcSysLogSetting) + DECLARE_RPC_EX("EnumEthVLan", RPC_ENUM_ETH_VLAN, StEnumEthVLan, InRpcEnumEthVLan, OutRpcEnumEthVLan, FreeRpcEnumEthVLan) + DECLARE_RPC("SetEnableEthVLan", RPC_TEST, StSetEnableEthVLan, InRpcTest, OutRpcTest) + DECLARE_RPC_EX("SetHubMsg", RPC_MSG, StSetHubMsg, InRpcMsg, OutRpcMsg, FreeRpcMsg) + DECLARE_RPC_EX("GetHubMsg", RPC_MSG, StGetHubMsg, InRpcMsg, OutRpcMsg, FreeRpcMsg) + DECLARE_RPC("Crash", RPC_TEST, StCrash, InRpcTest, OutRpcTest) + DECLARE_RPC_EX("GetAdminMsg", RPC_MSG, StGetAdminMsg, InRpcMsg, OutRpcMsg, FreeRpcMsg) + DECLARE_RPC("Flush", RPC_TEST, StFlush, InRpcTest, OutRpcTest) + DECLARE_RPC("Debug", RPC_TEST, StDebug, InRpcTest, OutRpcTest) + DECLARE_RPC("SetIPsecServices", IPSEC_SERVICES, StSetIPsecServices, InIPsecServices, OutIPsecServices) + DECLARE_RPC("GetIPsecServices", IPSEC_SERVICES, StGetIPsecServices, InIPsecServices, OutIPsecServices) + DECLARE_RPC("AddEtherIpId", ETHERIP_ID, StAddEtherIpId, InEtherIpId, OutEtherIpId) + DECLARE_RPC("GetEtherIpId", ETHERIP_ID, StGetEtherIpId, InEtherIpId, OutEtherIpId) + DECLARE_RPC("DeleteEtherIpId", ETHERIP_ID, StDeleteEtherIpId, InEtherIpId, OutEtherIpId) + DECLARE_RPC_EX("EnumEtherIpId", RPC_ENUM_ETHERIP_ID, StEnumEtherIpId, InRpcEnumEtherIpId, OutRpcEnumEtherIpId, FreeRpcEnumEtherIpId) + DECLARE_RPC("SetOpenVpnSstpConfig", OPENVPN_SSTP_CONFIG, StSetOpenVpnSstpConfig, InOpenVpnSstpConfig, OutOpenVpnSstpConfig) + DECLARE_RPC("GetOpenVpnSstpConfig", OPENVPN_SSTP_CONFIG, StGetOpenVpnSstpConfig, InOpenVpnSstpConfig, OutOpenVpnSstpConfig) + DECLARE_RPC("GetDDnsClientStatus", DDNS_CLIENT_STATUS, StGetDDnsClientStatus, InDDnsClientStatus, OutDDnsClientStatus) + DECLARE_RPC("ChangeDDnsClientHostname", RPC_TEST, StChangeDDnsClientHostname, InRpcTest, OutRpcTest) + DECLARE_RPC("RegenerateServerCert", RPC_TEST, StRegenerateServerCert, InRpcTest, OutRpcTest) + DECLARE_RPC_EX("MakeOpenVpnConfigFile", RPC_READ_LOG_FILE, StMakeOpenVpnConfigFile, InRpcReadLogFile, OutRpcReadLogFile, FreeRpcReadLogFile) + DECLARE_RPC("SetSpecialListener", RPC_SPECIAL_LISTENER, StSetSpecialListener, InRpcSpecialListener, OutRpcSpecialListener) + DECLARE_RPC("GetSpecialListener", RPC_SPECIAL_LISTENER, StGetSpecialListener, InRpcSpecialListener, OutRpcSpecialListener) + DECLARE_RPC("GetAzureStatus", RPC_AZURE_STATUS, StGetAzureStatus, InRpcAzureStatus, OutRpcAzureStatus) + DECLARE_RPC("SetAzureStatus", RPC_AZURE_STATUS, StSetAzureStatus, InRpcAzureStatus, OutRpcAzureStatus) + DECLARE_RPC("GetDDnsInternetSettng", INTERNET_SETTING, StGetDDnsInternetSetting, InRpcInternetSetting, OutRpcInternetSetting) + DECLARE_RPC("SetDDnsInternetSettng", INTERNET_SETTING, StSetDDnsInternetSetting, InRpcInternetSetting, OutRpcInternetSetting) + // RPC function declaration: till here + + + if (ok == false) + { + err = ERR_NOT_SUPPORTED; + } + + if (err != ERR_NO_ERROR) + { + PackAddInt(ret, "error", err); + } + + if (true) + { + char tmp[MAX_PATH]; + char ip[MAX_PATH]; + UINT rpc_id = 0; + + StrCpy(ip, sizeof(ip), "Unknown"); + + if (rpc->Sock != NULL) + { + IPToStr(ip, sizeof(ip), &rpc->Sock->RemoteIP); + rpc_id = rpc->Sock->socket; + } + + Format(tmp, sizeof(tmp), "RPC: RPC-%u (%s): Leaving RPC [%s] (Error: %u).", + rpc_id, ip, name, err); + + SiDebugLog(a->Server, tmp); + } + + Unlock(cedar->CedarSuperLock); + + return ret; +} + +// RPC call function declaration: from here +DECLARE_SC_EX("Test", RPC_TEST, ScTest, InRpcTest, OutRpcTest, FreeRpcTest) +DECLARE_SC_EX("GetServerInfo", RPC_SERVER_INFO, ScGetServerInfo, InRpcServerInfo, OutRpcServerInfo, FreeRpcServerInfo) +DECLARE_SC("GetServerStatus", RPC_SERVER_STATUS, ScGetServerStatus, InRpcServerStatus, OutRpcServerStatus) +DECLARE_SC("CreateListener", RPC_LISTENER, ScCreateListener, InRpcListener, OutRpcListener) +DECLARE_SC_EX("EnumListener", RPC_LISTENER_LIST, ScEnumListener, InRpcListenerList, OutRpcListenerList, FreeRpcListenerList) +DECLARE_SC("DeleteListener", RPC_LISTENER, ScDeleteListener, InRpcListener, OutRpcListener) +DECLARE_SC("EnableListener", RPC_LISTENER, ScEnableListener, InRpcListener, OutRpcListener) +DECLARE_SC_EX("SetPortsUDP", RPC_PORTS, ScSetPortsUDP, InRpcPorts, OutRpcPorts, FreeRpcPorts) +DECLARE_SC_EX("GetPortsUDP", RPC_PORTS, ScGetPortsUDP, InRpcPorts, OutRpcPorts, FreeRpcPorts) +DECLARE_SC_EX("SetProtoOptions", RPC_PROTO_OPTIONS, ScSetProtoOptions, InRpcProtoOptions, OutRpcProtoOptions, FreeRpcProtoOptions) +DECLARE_SC_EX("GetProtoOptions", RPC_PROTO_OPTIONS, ScGetProtoOptions, InRpcProtoOptions, OutRpcProtoOptions, FreeRpcProtoOptions) +DECLARE_SC("SetServerPassword", RPC_SET_PASSWORD, ScSetServerPassword, InRpcSetPassword, OutRpcSetPassword) +DECLARE_SC_EX("SetFarmSetting", RPC_FARM, ScSetFarmSetting, InRpcFarm, OutRpcFarm, FreeRpcFarm) +DECLARE_SC_EX("GetFarmSetting", RPC_FARM, ScGetFarmSetting, InRpcFarm, OutRpcFarm, FreeRpcFarm) +DECLARE_SC_EX("GetFarmInfo", RPC_FARM_INFO, ScGetFarmInfo, InRpcFarmInfo, OutRpcFarmInfo, FreeRpcFarmInfo) +DECLARE_SC_EX("EnumFarmMember", RPC_ENUM_FARM, ScEnumFarmMember, InRpcEnumFarm, OutRpcEnumFarm, FreeRpcEnumFarm) +DECLARE_SC("GetFarmConnectionStatus", RPC_FARM_CONNECTION_STATUS, ScGetFarmConnectionStatus, InRpcFarmConnectionStatus, OutRpcFarmConnectionStatus) +DECLARE_SC_EX("SetServerCert", RPC_KEY_PAIR, ScSetServerCert, InRpcKeyPair, OutRpcKeyPair, FreeRpcKeyPair) +DECLARE_SC_EX("GetServerCert", RPC_KEY_PAIR, ScGetServerCert, InRpcKeyPair, OutRpcKeyPair, FreeRpcKeyPair) +DECLARE_SC_EX("GetServerCipherList", RPC_STR, ScGetServerCipherList, InRpcStr, OutRpcStr, FreeRpcStr) +DECLARE_SC_EX("GetServerCipher", RPC_STR, ScGetServerCipher, InRpcStr, OutRpcStr, FreeRpcStr) +DECLARE_SC_EX("SetServerCipher", RPC_STR, ScSetServerCipher, InRpcStr, OutRpcStr, FreeRpcStr) +DECLARE_SC("CreateHub", RPC_CREATE_HUB, ScCreateHub, InRpcCreateHub, OutRpcCreateHub) +DECLARE_SC("SetHub", RPC_CREATE_HUB, ScSetHub, InRpcCreateHub, OutRpcCreateHub) +DECLARE_SC("GetHub", RPC_CREATE_HUB, ScGetHub, InRpcCreateHub, OutRpcCreateHub) +DECLARE_SC_EX("EnumHub", RPC_ENUM_HUB, ScEnumHub, InRpcEnumHub, OutRpcEnumHub, FreeRpcEnumHub) +DECLARE_SC("DeleteHub", RPC_DELETE_HUB, ScDeleteHub, InRpcDeleteHub, OutRpcDeleteHub) +DECLARE_SC("GetHubRadius", RPC_RADIUS, ScGetHubRadius, InRpcRadius, OutRpcRadius) +DECLARE_SC("SetHubRadius", RPC_RADIUS, ScSetHubRadius, InRpcRadius, OutRpcRadius) +DECLARE_SC_EX("EnumConnection", RPC_ENUM_CONNECTION, ScEnumConnection, InRpcEnumConnection, OutRpcEnumConnection, FreeRpcEnumConnection) +DECLARE_SC("DisconnectConnection", RPC_DISCONNECT_CONNECTION, ScDisconnectConnection, InRpcDisconnectConnection, OutRpcDisconnectConnection) +DECLARE_SC("GetConnectionInfo", RPC_CONNECTION_INFO, ScGetConnectionInfo, InRpcConnectionInfo, OutRpcConnectionInfo) +DECLARE_SC("SetHubOnline", RPC_SET_HUB_ONLINE, ScSetHubOnline, InRpcSetHubOnline, OutRpcSetHubOnline) +DECLARE_SC("GetHubStatus", RPC_HUB_STATUS, ScGetHubStatus, InRpcHubStatus, OutRpcHubStatus) +DECLARE_SC("SetHubLog", RPC_HUB_LOG, ScSetHubLog, InRpcHubLog, OutRpcHubLog) +DECLARE_SC("GetHubLog", RPC_HUB_LOG, ScGetHubLog, InRpcHubLog, OutRpcHubLog) +DECLARE_SC_EX("AddCa", RPC_HUB_ADD_CA, ScAddCa, InRpcHubAddCa, OutRpcHubAddCa, FreeRpcHubAddCa) +DECLARE_SC_EX("EnumCa", RPC_HUB_ENUM_CA, ScEnumCa, InRpcHubEnumCa, OutRpcHubEnumCa, FreeRpcHubEnumCa) +DECLARE_SC_EX("GetCa", RPC_HUB_GET_CA, ScGetCa, InRpcHubGetCa, OutRpcHubGetCa, FreeRpcHubGetCa) +DECLARE_SC("DeleteCa", RPC_HUB_DELETE_CA, ScDeleteCa, InRpcHubDeleteCa, OutRpcHubDeleteCa) +DECLARE_SC_EX("CreateLink", RPC_CREATE_LINK, ScCreateLink, InRpcCreateLink, OutRpcCreateLink, FreeRpcCreateLink) +DECLARE_SC_EX("GetLink", RPC_CREATE_LINK, ScGetLink, InRpcCreateLink, OutRpcCreateLink, FreeRpcCreateLink) +DECLARE_SC_EX("SetLink", RPC_CREATE_LINK, ScSetLink, InRpcCreateLink, OutRpcCreateLink, FreeRpcCreateLink) +DECLARE_SC_EX("EnumLink", RPC_ENUM_LINK, ScEnumLink, InRpcEnumLink, OutRpcEnumLink, FreeRpcEnumLink) +DECLARE_SC_EX("GetLinkStatus", RPC_LINK_STATUS, ScGetLinkStatus, InRpcLinkStatus, OutRpcLinkStatus, FreeRpcLinkStatus) +DECLARE_SC("SetLinkOnline", RPC_LINK, ScSetLinkOnline, InRpcLink, OutRpcLink) +DECLARE_SC("SetLinkOffline", RPC_LINK, ScSetLinkOffline, InRpcLink, OutRpcLink) +DECLARE_SC("DeleteLink", RPC_LINK, ScDeleteLink, InRpcLink, OutRpcLink) +DECLARE_SC("RenameLink", RPC_RENAME_LINK, ScRenameLink, InRpcRenameLink, OutRpcRenameLink) +DECLARE_SC("AddAccess", RPC_ADD_ACCESS, ScAddAccess, InRpcAddAccess, OutRpcAddAccess) +DECLARE_SC("DeleteAccess", RPC_DELETE_ACCESS, ScDeleteAccess, InRpcDeleteAccess, OutRpcDeleteAccess) +DECLARE_SC_EX("EnumAccess", RPC_ENUM_ACCESS_LIST, ScEnumAccess, InRpcEnumAccessList, OutRpcEnumAccessList, FreeRpcEnumAccessList) +DECLARE_SC_EX("SetAccessList", RPC_ENUM_ACCESS_LIST, ScSetAccessList, InRpcEnumAccessList, OutRpcEnumAccessList, FreeRpcEnumAccessList) +DECLARE_SC_EX("CreateUser", RPC_SET_USER, ScCreateUser, InRpcSetUser, OutRpcSetUser, FreeRpcSetUser) +DECLARE_SC_EX("SetUser", RPC_SET_USER, ScSetUser, InRpcSetUser, OutRpcSetUser, FreeRpcSetUser) +DECLARE_SC_EX("GetUser", RPC_SET_USER, ScGetUser, InRpcSetUser, OutRpcSetUser, FreeRpcSetUser) +DECLARE_SC("DeleteUser", RPC_DELETE_USER, ScDeleteUser, InRpcDeleteUser, OutRpcDeleteUser) +DECLARE_SC_EX("EnumUser", RPC_ENUM_USER, ScEnumUser, InRpcEnumUser, OutRpcEnumUser, FreeRpcEnumUser) +DECLARE_SC_EX("CreateGroup", RPC_SET_GROUP, ScCreateGroup, InRpcSetGroup, OutRpcSetGroup, FreeRpcSetGroup) +DECLARE_SC_EX("SetGroup", RPC_SET_GROUP, ScSetGroup, InRpcSetGroup, OutRpcSetGroup, FreeRpcSetGroup) +DECLARE_SC_EX("GetGroup", RPC_SET_GROUP, ScGetGroup, InRpcSetGroup, OutRpcSetGroup, FreeRpcSetGroup) +DECLARE_SC("DeleteGroup", RPC_DELETE_USER, ScDeleteGroup, InRpcDeleteUser, OutRpcDeleteUser) +DECLARE_SC_EX("EnumGroup", RPC_ENUM_GROUP, ScEnumGroup, InRpcEnumGroup, OutRpcEnumGroup, FreeRpcEnumGroup) +DECLARE_SC_EX("EnumSession", RPC_ENUM_SESSION, ScEnumSession, InRpcEnumSession, OutRpcEnumSession, FreeRpcEnumSession) +DECLARE_SC_EX("GetSessionStatus", RPC_SESSION_STATUS, ScGetSessionStatus, InRpcSessionStatus, OutRpcSessionStatus, FreeRpcSessionStatus) +DECLARE_SC("DeleteSession", RPC_DELETE_SESSION, ScDeleteSession, InRpcDeleteSession, OutRpcDeleteSession) +DECLARE_SC_EX("EnumMacTable", RPC_ENUM_MAC_TABLE, ScEnumMacTable, InRpcEnumMacTable, OutRpcEnumMacTable, FreeRpcEnumMacTable) +DECLARE_SC("DeleteMacTable", RPC_DELETE_TABLE, ScDeleteMacTable, InRpcDeleteTable, OutRpcDeleteTable) +DECLARE_SC_EX("EnumIpTable", RPC_ENUM_IP_TABLE, ScEnumIpTable, InRpcEnumIpTable, OutRpcEnumIpTable, FreeRpcEnumIpTable) +DECLARE_SC("DeleteIpTable", RPC_DELETE_TABLE, ScDeleteIpTable, InRpcDeleteTable, OutRpcDeleteTable) +DECLARE_SC("SetKeep", RPC_KEEP, ScSetKeep, InRpcKeep, OutRpcKeep) +DECLARE_SC("GetKeep", RPC_KEEP, ScGetKeep, InRpcKeep, OutRpcKeep) +DECLARE_SC("EnableSecureNAT", RPC_HUB, ScEnableSecureNAT, InRpcHub, OutRpcHub) +DECLARE_SC("DisableSecureNAT", RPC_HUB, ScDisableSecureNAT, InRpcHub, OutRpcHub) +DECLARE_SC("SetSecureNATOption", VH_OPTION, ScSetSecureNATOption, InVhOption, OutVhOption) +DECLARE_SC("GetSecureNATOption", VH_OPTION, ScGetSecureNATOption, InVhOption, OutVhOption) +DECLARE_SC_EX("EnumNAT", RPC_ENUM_NAT, ScEnumNAT, InRpcEnumNat, OutRpcEnumNat, FreeRpcEnumNat) +DECLARE_SC_EX("EnumDHCP", RPC_ENUM_DHCP, ScEnumDHCP, InRpcEnumDhcp, OutRpcEnumDhcp, FreeRpcEnumDhcp) +DECLARE_SC("GetSecureNATStatus", RPC_NAT_STATUS, ScGetSecureNATStatus, InRpcNatStatus, OutRpcNatStatus) +DECLARE_SC_EX("EnumEthernet", RPC_ENUM_ETH, ScEnumEthernet, InRpcEnumEth, OutRpcEnumEth, FreeRpcEnumEth) +DECLARE_SC("AddLocalBridge", RPC_LOCALBRIDGE, ScAddLocalBridge, InRpcLocalBridge, OutRpcLocalBridge) +DECLARE_SC("DeleteLocalBridge", RPC_LOCALBRIDGE, ScDeleteLocalBridge, InRpcLocalBridge, OutRpcLocalBridge) +DECLARE_SC_EX("EnumLocalBridge", RPC_ENUM_LOCALBRIDGE, ScEnumLocalBridge, InRpcEnumLocalBridge, OutRpcEnumLocalBridge, FreeRpcEnumLocalBridge) +DECLARE_SC("GetBridgeSupport", RPC_BRIDGE_SUPPORT, ScGetBridgeSupport, InRpcBridgeSupport, OutRpcBridgeSupport) +DECLARE_SC("RebootServer", RPC_TEST, ScRebootServer, InRpcTest, OutRpcTest) +DECLARE_SC_EX("GetCaps", CAPSLIST, ScGetCaps, InRpcCapsList, OutRpcCapsList, FreeRpcCapsList) +DECLARE_SC_EX("GetConfig", RPC_CONFIG, ScGetConfig, InRpcConfig, OutRpcConfig, FreeRpcConfig) +DECLARE_SC_EX("SetConfig", RPC_CONFIG, ScSetConfig, InRpcConfig, OutRpcConfig, FreeRpcConfig) +DECLARE_SC_EX("GetHubAdminOptions", RPC_ADMIN_OPTION, ScGetHubAdminOptions, InRpcAdminOption, OutRpcAdminOption, FreeRpcAdminOption) +DECLARE_SC_EX("SetHubAdminOptions", RPC_ADMIN_OPTION, ScSetHubAdminOptions, InRpcAdminOption, OutRpcAdminOption, FreeRpcAdminOption) +DECLARE_SC_EX("GetHubExtOptions", RPC_ADMIN_OPTION, ScGetHubExtOptions, InRpcAdminOption, OutRpcAdminOption, FreeRpcAdminOption) +DECLARE_SC_EX("SetHubExtOptions", RPC_ADMIN_OPTION, ScSetHubExtOptions, InRpcAdminOption, OutRpcAdminOption, FreeRpcAdminOption) +DECLARE_SC_EX("GetDefaultHubAdminOptions", RPC_ADMIN_OPTION, ScGetDefaultHubAdminOptions, InRpcAdminOption, OutRpcAdminOption, FreeRpcAdminOption) +DECLARE_SC("AddL3Switch", RPC_L3SW, ScAddL3Switch, InRpcL3Sw, OutRpcL3Sw) +DECLARE_SC("DelL3Switch", RPC_L3SW, ScDelL3Switch, InRpcL3Sw, OutRpcL3Sw) +DECLARE_SC_EX("EnumL3Switch", RPC_ENUM_L3SW, ScEnumL3Switch, InRpcEnumL3Sw, OutRpcEnumL3Sw, FreeRpcEnumL3Sw) +DECLARE_SC("StartL3Switch", RPC_L3SW, ScStartL3Switch, InRpcL3Sw, OutRpcL3Sw) +DECLARE_SC("StopL3Switch", RPC_L3SW, ScStopL3Switch, InRpcL3Sw, OutRpcL3Sw) +DECLARE_SC("AddL3If", RPC_L3IF, ScAddL3If, InRpcL3If, OutRpcL3If) +DECLARE_SC("DelL3If", RPC_L3IF, ScDelL3If, InRpcL3If, OutRpcL3If) +DECLARE_SC_EX("EnumL3If", RPC_ENUM_L3IF, ScEnumL3If, InRpcEnumL3If, OutRpcEnumL3If, FreeRpcEnumL3If) +DECLARE_SC("AddL3Table", RPC_L3TABLE, ScAddL3Table, InRpcL3Table, OutRpcL3Table) +DECLARE_SC("DelL3Table", RPC_L3TABLE, ScDelL3Table, InRpcL3Table, OutRpcL3Table) +DECLARE_SC_EX("EnumL3Table", RPC_ENUM_L3TABLE, ScEnumL3Table, InRpcEnumL3Table, OutRpcEnumL3Table, FreeRpcEnumL3Table) +DECLARE_SC_EX("EnumCrl", RPC_ENUM_CRL, ScEnumCrl, InRpcEnumCrl, OutRpcEnumCrl, FreeRpcEnumCrl) +DECLARE_SC_EX("AddCrl", RPC_CRL, ScAddCrl, InRpcCrl, OutRpcCrl, FreeRpcCrl) +DECLARE_SC_EX("DelCrl", RPC_CRL, ScDelCrl, InRpcCrl, OutRpcCrl, FreeRpcCrl) +DECLARE_SC_EX("GetCrl", RPC_CRL, ScGetCrl, InRpcCrl, OutRpcCrl, FreeRpcCrl) +DECLARE_SC_EX("SetCrl", RPC_CRL, ScSetCrl, InRpcCrl, OutRpcCrl, FreeRpcCrl) +DECLARE_SC_EX("SetAcList", RPC_AC_LIST, ScSetAcList, InRpcAcList, OutRpcAcList, FreeRpcAcList) +DECLARE_SC_EX("GetAcList", RPC_AC_LIST, ScGetAcList, InRpcAcList, OutRpcAcList, FreeRpcAcList) +DECLARE_SC_EX("EnumLogFile", RPC_ENUM_LOG_FILE, ScEnumLogFile, InRpcEnumLogFile, OutRpcEnumLogFile, FreeRpcEnumLogFile) +DECLARE_SC_EX("ReadLogFile", RPC_READ_LOG_FILE, ScReadLogFile, InRpcReadLogFile, OutRpcReadLogFile, FreeRpcReadLogFile) +DECLARE_SC("AddLicenseKey", RPC_TEST, ScAddLicenseKey, InRpcTest, OutRpcTest) +DECLARE_SC("DelLicenseKey", RPC_TEST, ScDelLicenseKey, InRpcTest, OutRpcTest) +DECLARE_SC_EX("EnumLicenseKey", RPC_ENUM_LICENSE_KEY, ScEnumLicenseKey, InRpcEnumLicenseKey, OutRpcEnumLicenseKey, FreeRpcEnumLicenseKey) +DECLARE_SC("GetLicenseStatus", RPC_LICENSE_STATUS, ScGetLicenseStatus, InRpcLicenseStatus, OutRpcLicenseStatus) +DECLARE_SC("SetSysLog", SYSLOG_SETTING, ScSetSysLog, InRpcSysLogSetting, OutRpcSysLogSetting) +DECLARE_SC("GetSysLog", SYSLOG_SETTING, ScGetSysLog, InRpcSysLogSetting, OutRpcSysLogSetting) +DECLARE_SC_EX("EnumEthVLan", RPC_ENUM_ETH_VLAN, ScEnumEthVLan, InRpcEnumEthVLan, OutRpcEnumEthVLan, FreeRpcEnumEthVLan) +DECLARE_SC("SetEnableEthVLan", RPC_TEST, ScSetEnableEthVLan, InRpcTest, OutRpcTest) +DECLARE_SC_EX("SetHubMsg", RPC_MSG, ScSetHubMsg, InRpcMsg, OutRpcMsg, FreeRpcMsg) +DECLARE_SC_EX("GetHubMsg", RPC_MSG, ScGetHubMsg, InRpcMsg, OutRpcMsg, FreeRpcMsg) +DECLARE_SC("Crash", RPC_TEST, ScCrash, InRpcTest, OutRpcTest) +DECLARE_SC_EX("GetAdminMsg", RPC_MSG, ScGetAdminMsg, InRpcMsg, OutRpcMsg, FreeRpcMsg) +DECLARE_SC("Flush", RPC_TEST, ScFlush, InRpcTest, OutRpcTest) +DECLARE_SC("Debug", RPC_TEST, ScDebug, InRpcTest, OutRpcTest) +DECLARE_SC("SetIPsecServices", IPSEC_SERVICES, ScSetIPsecServices, InIPsecServices, OutIPsecServices) +DECLARE_SC("GetIPsecServices", IPSEC_SERVICES, ScGetIPsecServices, InIPsecServices, OutIPsecServices) +DECLARE_SC("AddEtherIpId", ETHERIP_ID, ScAddEtherIpId, InEtherIpId, OutEtherIpId) +DECLARE_SC("GetEtherIpId", ETHERIP_ID, ScGetEtherIpId, InEtherIpId, OutEtherIpId) +DECLARE_SC("DeleteEtherIpId", ETHERIP_ID, ScDeleteEtherIpId, InEtherIpId, OutEtherIpId) +DECLARE_SC_EX("EnumEtherIpId", RPC_ENUM_ETHERIP_ID, ScEnumEtherIpId, InRpcEnumEtherIpId, OutRpcEnumEtherIpId, FreeRpcEnumEtherIpId) +DECLARE_SC("SetOpenVpnSstpConfig", OPENVPN_SSTP_CONFIG, ScSetOpenVpnSstpConfig, InOpenVpnSstpConfig, OutOpenVpnSstpConfig) +DECLARE_SC("GetOpenVpnSstpConfig", OPENVPN_SSTP_CONFIG, ScGetOpenVpnSstpConfig, InOpenVpnSstpConfig, OutOpenVpnSstpConfig) +DECLARE_SC("GetDDnsClientStatus", DDNS_CLIENT_STATUS, ScGetDDnsClientStatus, InDDnsClientStatus, OutDDnsClientStatus) +DECLARE_SC("ChangeDDnsClientHostname", RPC_TEST, ScChangeDDnsClientHostname, InRpcTest, OutRpcTest) +DECLARE_SC("RegenerateServerCert", RPC_TEST, ScRegenerateServerCert, InRpcTest, OutRpcTest) +DECLARE_SC_EX("MakeOpenVpnConfigFile", RPC_READ_LOG_FILE, ScMakeOpenVpnConfigFile, InRpcReadLogFile, OutRpcReadLogFile, FreeRpcReadLogFile) +DECLARE_SC("SetSpecialListener", RPC_SPECIAL_LISTENER, ScSetSpecialListener, InRpcSpecialListener, OutRpcSpecialListener) +DECLARE_SC("GetSpecialListener", RPC_SPECIAL_LISTENER, ScGetSpecialListener, InRpcSpecialListener, OutRpcSpecialListener) +DECLARE_SC("GetAzureStatus", RPC_AZURE_STATUS, ScGetAzureStatus, InRpcAzureStatus, OutRpcAzureStatus) +DECLARE_SC("SetAzureStatus", RPC_AZURE_STATUS, ScSetAzureStatus, InRpcAzureStatus, OutRpcAzureStatus) +DECLARE_SC("GetDDnsInternetSettng", INTERNET_SETTING, ScGetDDnsInternetSetting, InRpcInternetSetting, OutRpcInternetSetting) +DECLARE_SC("SetDDnsInternetSettng", INTERNET_SETTING, ScSetDDnsInternetSetting, InRpcInternetSetting, OutRpcInternetSetting) +// RPC call function declaration: till here + +// Setting VPN Gate Server Configuration +UINT StSetVgsConfig(ADMIN *a, VGS_CONFIG *t) +{ + return ERR_NOT_SUPPORTED; +} + +// Get VPN Gate configuration +UINT StGetVgsConfig(ADMIN *a, VGS_CONFIG *t) +{ + return ERR_NOT_SUPPORTED; +} + +// Get DDNS proxy configuration +UINT StGetDDnsInternetSetting(ADMIN *a, INTERNET_SETTING *t) +{ + SERVER *s = a->Server; + CEDAR *c = s->Cedar; + UINT ret = ERR_NO_ERROR; + + SERVER_ADMIN_ONLY; + NO_SUPPORT_FOR_BRIDGE; + + if (s->DDnsClient == NULL) + { + return ERR_NOT_SUPPORTED; + } + + Zero(t, sizeof(INTERNET_SETTING)); + + DCGetInternetSetting(s->DDnsClient, t); + + return ret; +} + +// Set DDNS proxy configuration +UINT StSetDDnsInternetSetting(ADMIN *a, INTERNET_SETTING *t) +{ + SERVER *s = a->Server; + CEDAR *c = s->Cedar; + UINT ret = ERR_NO_ERROR; + + SERVER_ADMIN_ONLY; + NO_SUPPORT_FOR_BRIDGE; + + if (s->DDnsClient == NULL) + { + return ERR_NOT_SUPPORTED; + } + + DCSetInternetSetting(s->DDnsClient, t); + + IncrementServerConfigRevision(s); + + return ret; +} + +// Get Azure status +UINT StGetAzureStatus(ADMIN *a, RPC_AZURE_STATUS *t) +{ + SERVER *s = a->Server; + CEDAR *c = s->Cedar; + UINT ret = ERR_NO_ERROR; + AZURE_CLIENT *ac; + + SERVER_ADMIN_ONLY; + NO_SUPPORT_FOR_BRIDGE; + + if (SiIsAzureSupported(s) == false) + { + return ERR_NOT_SUPPORTED; + } + + ac = s->AzureClient; + if (ac == NULL) + { + return ERR_NOT_SUPPORTED; + } + + Zero(t, sizeof(RPC_AZURE_STATUS)); + + Lock(ac->Lock); + { + t->IsConnected = ac->IsConnected; + t->IsEnabled = ac->IsEnabled; + } + Unlock(ac->Lock); + + return ERR_NO_ERROR; +} + +// Set Azure status +UINT StSetAzureStatus(ADMIN *a, RPC_AZURE_STATUS *t) +{ + SERVER *s = a->Server; + CEDAR *c = s->Cedar; + UINT ret = ERR_NO_ERROR; + + SERVER_ADMIN_ONLY; + NO_SUPPORT_FOR_BRIDGE; + + if (SiIsAzureSupported(s) == false) + { + return ERR_NOT_SUPPORTED; + } + + SiSetAzureEnable(s, t->IsEnabled); + + IncrementServerConfigRevision(s); + + return ERR_NO_ERROR; +} + +// Get special listener status +UINT StGetSpecialListener(ADMIN *a, RPC_SPECIAL_LISTENER *t) +{ + SERVER *s = a->Server; + CEDAR *c = s->Cedar; + UINT ret = ERR_NO_ERROR; + + SERVER_ADMIN_ONLY; + NO_SUPPORT_FOR_BRIDGE; + + Zero(t, sizeof(RPC_SPECIAL_LISTENER)); + t->VpnOverDnsListener = s->EnableVpnOverDns; + t->VpnOverIcmpListener = s->EnableVpnOverIcmp; + + return ERR_NO_ERROR; +} + +// Set special listener status +UINT StSetSpecialListener(ADMIN *a, RPC_SPECIAL_LISTENER *t) +{ + SERVER *s = a->Server; + CEDAR *c = s->Cedar; + UINT ret = ERR_NO_ERROR; + + SERVER_ADMIN_ONLY; + NO_SUPPORT_FOR_BRIDGE; + + // Check ports + if (t->VpnOverDnsListener && (MAKEBOOL(s->EnableVpnOverDns) != MAKEBOOL(t->VpnOverDnsListener))) + { + if (SiCanOpenVpnOverDnsPort() == false) + { + return ERR_SPECIAL_LISTENER_DNS_ERROR; + } + } + + if (t->VpnOverIcmpListener && (MAKEBOOL(s->EnableVpnOverIcmp) != MAKEBOOL(t->VpnOverIcmpListener))) + { + if (SiCanOpenVpnOverIcmpPort() == false) + { + return ERR_SPECIAL_LISTENER_ICMP_ERROR; + } + } + + s->EnableVpnOverDns = t->VpnOverDnsListener; + s->EnableVpnOverIcmp = t->VpnOverIcmpListener; + + SiApplySpecialListenerStatus(s); + + ALog(a, NULL, "LA_SET_SPECIAL_LISTENER"); + + IncrementServerConfigRevision(s); + + return ERR_NO_ERROR; +} + +// Set configurations for OpenVPN and SSTP +UINT StSetOpenVpnSstpConfig(ADMIN *a, OPENVPN_SSTP_CONFIG *t) +{ + PROTO *proto = a->Server->Proto; + PROTO_CONTAINER *container, tmp_c; + PROTO_OPTION *option, tmp_o; + UINT ret = ERR_NO_ERROR; + bool changed = false; + + SERVER_ADMIN_ONLY; + + if (proto == NULL) + { + return ERR_NOT_SUPPORTED; + } + + tmp_o.Name = PROTO_OPTION_TOGGLE_NAME; + tmp_c.Name = "OpenVPN"; + + container = Search(proto->Containers, &tmp_c); + if (container != NULL) + { + option = Search(container->Options, &tmp_o); + if (option != NULL) + { + if (option->Type == PROTO_OPTION_BOOL) + { + option->Bool = t->EnableOpenVPN; + changed = true; + } + else + { + ret = ERR_INVALID_PARAMETER; + } + } + else + { + ret = ERR_OBJECT_NOT_FOUND; + } + } + else + { + ret = ERR_OBJECT_NOT_FOUND; + } + + tmp_c.Name = "SSTP"; + + container = Search(proto->Containers, &tmp_c); + if (container != NULL) + { + option = Search(container->Options, &tmp_o); + if (option != NULL) + { + if (option->Type == PROTO_OPTION_BOOL) + { + option->Bool = t->EnableSSTP; + changed = true; + } + else + { + ret = ERR_INVALID_PARAMETER; + } + } + else + { + ret = ERR_OBJECT_NOT_FOUND; + } + } + else + { + ret = ERR_OBJECT_NOT_FOUND; + } + + if (changed) + { + ALog(a, NULL, "LA_SET_OVPN_SSTP_CONFIG"); + IncrementServerConfigRevision(a->Server); + } + + return ret; +} + +// Get configurations for OpenVPN and SSTP +UINT StGetOpenVpnSstpConfig(ADMIN *a, OPENVPN_SSTP_CONFIG *t) +{ + PROTO *proto = a->Server->Proto; + if (proto == NULL) + { + return ERR_NOT_SUPPORTED; + } + + t->EnableOpenVPN = ProtoEnabled(proto, "OpenVPN"); + t->EnableSSTP = ProtoEnabled(proto, "SSTP"); + + return ERR_NO_ERROR; +} + +// Get status of DDNS client +UINT StGetDDnsClientStatus(ADMIN *a, DDNS_CLIENT_STATUS *t) +{ + SERVER *s = a->Server; + CEDAR *c = s->Cedar; + UINT ret = ERR_NO_ERROR; + + SERVER_ADMIN_ONLY; + NO_SUPPORT_FOR_BRIDGE; + + if (s->DDnsClient == NULL) + { + return ERR_NOT_SUPPORTED; + } + + Zero(t, sizeof(DDNS_CLIENT_STATUS)); + DCGetStatus(s->DDnsClient, t); + + return ERR_NO_ERROR; +} + +// Change host-name for DDNS client +UINT StChangeDDnsClientHostname(ADMIN *a, RPC_TEST *t) +{ + SERVER *s = a->Server; + CEDAR *c = s->Cedar; + UINT ret = ERR_NO_ERROR; + + SERVER_ADMIN_ONLY; + NO_SUPPORT_FOR_BRIDGE; + + if (s->DDnsClient == NULL) + { + return ERR_NOT_SUPPORTED; + } + + ret = DCChangeHostName(s->DDnsClient, t->StrValue); + + if (ret == ERR_NO_ERROR) + { + ALog(a, NULL, "LA_DDNS_HOSTNAME_CHANGED", t->StrValue); + } + + IncrementServerConfigRevision(s); + + return ret; +} + +// Regenerate server certification +UINT StRegenerateServerCert(ADMIN *a, RPC_TEST *t) +{ + SERVER *s = a->Server; + CEDAR *c = s->Cedar; + UINT ret = ERR_NO_ERROR; + X *x; + K *k; + + SERVER_ADMIN_ONLY; + + SiGenerateDefaultCertEx(&x, &k, t->StrValue); + + SetCedarCert(c, x, k); + + ALog(a, NULL, "LA_REGENERATE_SERVER_CERT", t->StrValue); + + IncrementServerConfigRevision(s); + + FreeX(x); + FreeK(k); + + return ERR_NO_ERROR; +} + +// Generate OpenVPN configuration files +UINT StMakeOpenVpnConfigFile(ADMIN *a, RPC_READ_LOG_FILE *t) +{ + SERVER *s = a->Server; + CEDAR *c = s->Cedar; + UINT ret = ERR_NO_ERROR; + ZIP_PACKER *p; + FIFO *f; + BUF *readme_buf; + BUF *readme_pdf_buf; + BUF *sample_buf; + LIST *port_list; + char my_hostname[MAX_SIZE]; + + SERVER_ADMIN_ONLY; + NO_SUPPORT_FOR_BRIDGE; + if (s->ServerType != SERVER_TYPE_STANDALONE) + { + return ERR_NOT_SUPPORTED; + } + + if (ProtoEnabled(s->Proto, "OpenVPN") == false) + { + return ERR_OPENVPN_IS_NOT_ENABLED; + } + + port_list = s->PortsUDP; + + FreeRpcReadLogFile(t); + Zero(t, sizeof(RPC_READ_LOG_FILE)); + + p = NewZipPacker(); + + // readme.txt + readme_buf = ReadDump("|openvpn_readme.txt"); + + // readme.pdf + readme_pdf_buf = ReadDump("|openvpn_readme.pdf"); + + // sample.ovpn + sample_buf = ReadDump("|openvpn_sample.ovpn"); + + // host name + GetMachineHostName(my_hostname, sizeof(my_hostname)); + my_hostname[16] = 0; + + if (readme_buf == NULL || sample_buf == NULL || readme_pdf_buf == NULL) + { + ret = ERR_INTERNAL_ERROR; + } + else + { + BUF *config_l3_buf, *config_l2_buf; + X *x = NULL; + BUF *x_buf; + char protocol[MAX_SIZE]; + UINT port = OPENVPN_UDP_PORT; + char port_str[MAX_SIZE]; + char hostname[MAX_SIZE]; + char tag_before_hostname[MAX_SIZE]; + DDNS_CLIENT_STATUS ddns; + UCHAR *zero_buffer; + UINT zero_buffer_size = 128 * 1024; + char name_tmp[MAX_SIZE]; + + zero_buffer = ZeroMalloc(zero_buffer_size); + + + if (x == NULL) + { + Lock(c->lock); + { + x = CloneX(c->ServerX); + } + Unlock(c->lock); + + if (x != NULL) + { + // Get the root certificate + if (x->root_cert == false) + { + X *root_x = NULL; + LIST *cert_list = NewCertList(true); + + if (TryGetRootCertChain(cert_list, x, true, &root_x)) + { + FreeX(x); + x = root_x; + } + + FreeCertList(cert_list); + } + } + } + + x_buf = XToBuf(x, true); + + SeekBufToEnd(x_buf); + WriteBufChar(x_buf, 0); + SeekBufToBegin(x_buf); + + FreeX(x); + Zero(hostname, sizeof(hostname)); + Zero(tag_before_hostname, sizeof(tag_before_hostname)); + + Zero(&ddns, sizeof(ddns)); + if (s->DDnsClient != NULL) + { + DCGetStatus(s->DDnsClient, &ddns); + + if (IsEmptyStr(ddns.CurrentHostName) == false && IsEmptyStr(ddns.DnsSuffix) == false && + ddns.Err_IPv4 == ERR_NO_ERROR) + { + StrCpy(tag_before_hostname, sizeof(tag_before_hostname), + "# Note: The below hostname is came from the Dynamic DNS Client function\r\n" + "# which is running on the VPN Server. If you don't want to use\r\n" + "# the Dynamic DNS hostname, replace it to either IP address or\r\n" + "# other domain's hostname.\r\n\r\n"); + + Format(hostname, sizeof(hostname), "%s.v4%s", ddns.CurrentHostName, ddns.DnsSuffix); + } + } + + if (IsEmptyStr(hostname)) + { + IP myip; + + Zero(&myip, sizeof(myip)); + GetCurrentGlobalIP(&myip, false); + + if (IsZeroIP(&myip)) + { + GetCurrentGlobalIPGuess(&myip, false); + } + + IPToStr(hostname, sizeof(hostname), &myip); + } + + SeekBuf(sample_buf, sample_buf->Size, 0); + WriteBuf(sample_buf, zero_buffer, zero_buffer_size); + + config_l3_buf = CloneBuf(sample_buf); + config_l2_buf = CloneBuf(sample_buf); + + // Generate contents of configuration + if (LIST_NUM(port_list) >= 1) + { + StrCpy(protocol, sizeof(protocol), "udp"); + + if (IsIntInList(port_list, OPENVPN_UDP_PORT)) + { + port = OPENVPN_UDP_PORT; + } + else + { + port = *((UINT *)(LIST_DATA(port_list, 0))); + } + } + else + { + RPC_LISTENER_LIST tt; + UINT i; + + port = 0; + + StrCpy(protocol, sizeof(protocol), "tcp"); + + Zero(&tt, sizeof(tt)); + + StEnumListener(a, &tt); + + for (i = 0;i < tt.NumPort;i++) + { + if (tt.Enables[i] && tt.Errors[i] == false) + { + port = tt.Ports[i]; + break; + } + } + + FreeRpcListenerList(&tt); + + if (port == 0) + { + StrCpy(protocol, sizeof(protocol), "udp"); + port = OPENVPN_UDP_PORT; + } + } + + ToStr(port_str, port); + + if (IsEmptyStr(my_hostname) == false) + { + StrCat(my_hostname, sizeof(my_hostname), "_"); + + StrLower(my_hostname); + } + + ZipAddFileSimple(p, "readme.txt", LocalTime64(), 0, readme_buf->Buf, readme_buf->Size); + ZipAddFileSimple(p, "readme.pdf", LocalTime64(), 0, readme_pdf_buf->Buf, readme_pdf_buf->Size); + + ReplaceStrEx((char *)config_l3_buf->Buf, config_l3_buf->Size, (char *)config_l3_buf->Buf, + "$TAG_TUN_TAP$", "tun", false); + ReplaceStrEx((char *)config_l3_buf->Buf, config_l3_buf->Size, (char *)config_l3_buf->Buf, + "$TAG_PROTO$", protocol, false); + ReplaceStrEx((char *)config_l3_buf->Buf, config_l3_buf->Size, (char *)config_l3_buf->Buf, + "$TAG_HOSTNAME$", hostname, false); + ReplaceStrEx((char *)config_l3_buf->Buf, config_l3_buf->Size, (char *)config_l3_buf->Buf, + "$TAG_BEFORE_REMOTE$", tag_before_hostname, false); + ReplaceStrEx((char *)config_l3_buf->Buf, config_l3_buf->Size, (char *)config_l3_buf->Buf, + "$TAG_PORT$", port_str, false); + + if (x_buf != NULL) + { + ReplaceStrEx((char *)config_l3_buf->Buf, config_l3_buf->Size, (char *)config_l3_buf->Buf, + "$CA$", x_buf->Buf, false); + } + + Format(name_tmp, sizeof(name_tmp), "%sopenvpn_remote_access_l3.ovpn", my_hostname); + ZipAddFileSimple(p, name_tmp, LocalTime64(), 0, config_l3_buf->Buf, StrLen(config_l3_buf->Buf)); + + ReplaceStrEx((char *)config_l2_buf->Buf, config_l2_buf->Size, (char *)config_l2_buf->Buf, + "$TAG_TUN_TAP$", "tap", false); + ReplaceStrEx((char *)config_l2_buf->Buf, config_l2_buf->Size, (char *)config_l2_buf->Buf, + "$TAG_PROTO$", protocol, false); + ReplaceStrEx((char *)config_l2_buf->Buf, config_l2_buf->Size, (char *)config_l2_buf->Buf, + "$TAG_HOSTNAME$", hostname, false); + ReplaceStrEx((char *)config_l2_buf->Buf, config_l2_buf->Size, (char *)config_l2_buf->Buf, + "$TAG_BEFORE_REMOTE$", tag_before_hostname, false); + ReplaceStrEx((char *)config_l2_buf->Buf, config_l2_buf->Size, (char *)config_l2_buf->Buf, + "$TAG_PORT$", port_str, false); + + if (x_buf != NULL) + { + ReplaceStrEx((char *)config_l2_buf->Buf, config_l2_buf->Size, (char *)config_l2_buf->Buf, + "$CA$", x_buf->Buf, false); + } + + Format(name_tmp, sizeof(name_tmp), "%sopenvpn_site_to_site_bridge_l2.ovpn", my_hostname); + ZipAddFileSimple(p, name_tmp, LocalTime64(), 0, config_l2_buf->Buf, StrLen(config_l2_buf->Buf)); + + FreeBuf(config_l3_buf); + FreeBuf(config_l2_buf); + + f = ZipFinish(p); + + if (f != NULL) + { + t->Buffer = NewBuf(); + WriteBuf(t->Buffer, FifoPtr(f), FifoSize(f)); + SeekBuf(t->Buffer, 0, 0); + } + + FreeBuf(readme_buf); + FreeBuf(sample_buf); + FreeBuf(readme_pdf_buf); + FreeBuf(x_buf); + + Free(zero_buffer); + } + + FreeZipPacker(p); + + return ERR_NO_ERROR; +} + +// Set IPsec service configuration +UINT StSetIPsecServices(ADMIN *a, IPSEC_SERVICES *t) +{ + SERVER *s = a->Server; + CEDAR *c = s->Cedar; + UINT ret = ERR_NO_ERROR; + + SERVER_ADMIN_ONLY; + NO_SUPPORT_FOR_BRIDGE; + if (GetServerCapsBool(s, "b_support_ipsec") == false || s->IPsecServer == NULL) + { + return ERR_NOT_SUPPORTED; + } + + IPsecServerSetServices(s->IPsecServer, t); + + ALog(a, NULL, "LA_SET_IPSEC_CONFIG"); + + IncrementServerConfigRevision(s); + + return ERR_NO_ERROR; +} + +// Get IPsec service configuration +UINT StGetIPsecServices(ADMIN *a, IPSEC_SERVICES *t) +{ + SERVER *s = a->Server; + CEDAR *c = s->Cedar; + UINT ret = ERR_NO_ERROR; + + SERVER_ADMIN_ONLY; + NO_SUPPORT_FOR_BRIDGE; + if (GetServerCapsBool(s, "b_support_ipsec") == false || s->IPsecServer == NULL) + { + return ERR_NOT_SUPPORTED; + } + + Zero(t, sizeof(IPSEC_SERVICES)); + IPsecServerGetServices(s->IPsecServer, t); + + return ERR_NO_ERROR; +} + +// Add EtherIP ID setting +UINT StAddEtherIpId(ADMIN *a, ETHERIP_ID *t) +{ + SERVER *s = a->Server; + CEDAR *c = s->Cedar; + UINT ret = ERR_NO_ERROR; + + SERVER_ADMIN_ONLY; + NO_SUPPORT_FOR_BRIDGE; + if (GetServerCapsBool(s, "b_support_ipsec") == false || s->IPsecServer == NULL) + { + return ERR_NOT_SUPPORTED; + } + + AddEtherIPId(s->IPsecServer, t); + + ALog(a, NULL, "LA_ADD_ETHERIP_ID", t->Id); + + IncrementServerConfigRevision(s); + + return ERR_NO_ERROR; +} + +// Get EtherIP ID setting +UINT StGetEtherIpId(ADMIN *a, ETHERIP_ID *t) +{ + SERVER *s = a->Server; + CEDAR *c = s->Cedar; + UINT ret = ERR_NO_ERROR; + char id[MAX_SIZE]; + + SERVER_ADMIN_ONLY; + NO_SUPPORT_FOR_BRIDGE; + if (GetServerCapsBool(s, "b_support_ipsec") == false || s->IPsecServer == NULL) + { + return ERR_NOT_SUPPORTED; + } + + StrCpy(id, sizeof(id), t->Id); + + Zero(t, sizeof(ETHERIP_ID)); + if (SearchEtherIPId(s->IPsecServer, t, id) == false) + { + return ERR_OBJECT_NOT_FOUND; + } + + return ERR_NO_ERROR; +} + +// Delete EtherIP ID setting +UINT StDeleteEtherIpId(ADMIN *a, ETHERIP_ID *t) +{ + SERVER *s = a->Server; + CEDAR *c = s->Cedar; + UINT ret = ERR_NO_ERROR; + char id[MAX_SIZE]; + + SERVER_ADMIN_ONLY; + NO_SUPPORT_FOR_BRIDGE; + if (GetServerCapsBool(s, "b_support_ipsec") == false || s->IPsecServer == NULL) + { + return ERR_NOT_SUPPORTED; + } + + StrCpy(id, sizeof(id), t->Id); + + if (DeleteEtherIPId(s->IPsecServer, id) == false) + { + return ERR_OBJECT_NOT_FOUND; + } + + ALog(a, NULL, "LA_DEL_ETHERIP_ID", id); + + IncrementServerConfigRevision(s); + + return ERR_NO_ERROR; +} + +// Enumerate EtherIP ID settings +UINT StEnumEtherIpId(ADMIN *a, RPC_ENUM_ETHERIP_ID *t) +{ + SERVER *s = a->Server; + CEDAR *c = s->Cedar; + UINT ret = ERR_NO_ERROR; + SERVER_ADMIN_ONLY; + NO_SUPPORT_FOR_BRIDGE; + if (GetServerCapsBool(s, "b_support_ipsec") == false || s->IPsecServer == NULL) + { + return ERR_NOT_SUPPORTED; + } + + FreeRpcEnumEtherIpId(t); + Zero(t, sizeof(RPC_ENUM_ETHERIP_ID)); + + Lock(s->IPsecServer->LockSettings); + { + UINT i; + UINT num; + + num = LIST_NUM(s->IPsecServer->EtherIPIdList); + + t->NumItem = num; + t->IdList = ZeroMalloc(sizeof(ETHERIP_ID) * num); + + for (i = 0;i < num;i++) + { + ETHERIP_ID *d = &t->IdList[i]; + ETHERIP_ID *src = LIST_DATA(s->IPsecServer->EtherIPIdList, i); + + Copy(d, src, sizeof(ETHERIP_ID)); + } + } + Unlock(s->IPsecServer->LockSettings); + + return ERR_NO_ERROR; +} + +// Set message of today on hub +UINT StSetHubMsg(ADMIN *a, RPC_MSG *t) +{ + SERVER *s = a->Server; + CEDAR *c = s->Cedar; + HUB *h; + UINT ret = ERR_NO_ERROR; + char hubname[MAX_HUBNAME_LEN + 1]; + + CHECK_RIGHT; + NO_SUPPORT_FOR_BRIDGE; + if (s->ServerType == SERVER_TYPE_FARM_MEMBER) + { + return ERR_NOT_SUPPORTED; + } + if (UniStrLen(t->Msg) > HUB_MAXMSG_LEN) + { + return ERR_MEMORY_NOT_ENOUGH; + } + + StrCpy(hubname, sizeof(hubname), t->HubName); + + h = GetHub(c, hubname); + + if (h == NULL) + { + ret = ERR_HUB_NOT_FOUND; + } + else + { + if (a->ServerAdmin == false && GetHubAdminOption(h, "no_change_msg") != 0) + { + ret = ERR_NOT_ENOUGH_RIGHT; + } + else + { + SetHubMsg(h, t->Msg); + } + + ReleaseHub(h); + } + + IncrementServerConfigRevision(s); + + return ret; +} + +// Get message of today on hub +UINT StGetHubMsg(ADMIN *a, RPC_MSG *t) +{ + SERVER *s = a->Server; + CEDAR *c = s->Cedar; + HUB *h; + UINT ret = ERR_NO_ERROR; + char hubname[MAX_HUBNAME_LEN + 1]; + + CHECK_RIGHT; + NO_SUPPORT_FOR_BRIDGE; + if (s->ServerType == SERVER_TYPE_FARM_MEMBER) + { + return ERR_NOT_SUPPORTED; + } + if (UniStrLen(t->Msg) > HUB_MAXMSG_LEN) + { + return ERR_MEMORY_NOT_ENOUGH; + } + + StrCpy(hubname, sizeof(hubname), t->HubName); + + h = GetHub(c, hubname); + + if (h == NULL) + { + ret = ERR_HUB_NOT_FOUND; + } + else + { + FreeRpcMsg(t); + Zero(t, sizeof(RPC_MSG)); + + t->Msg = GetHubMsg(h); + + ReleaseHub(h); + } + + return ret; +} + +// Do debug function +UINT StDebug(ADMIN *a, RPC_TEST *t) +{ + SERVER *s = a->Server; + CEDAR *c = s->Cedar; + UINT ret = ERR_NO_ERROR; + RPC_TEST t2; + + SERVER_ADMIN_ONLY; + + Zero(&t2, sizeof(t2)); + + ret = SiDebug(s, &t2, t->IntValue, t->StrValue); + + if (ret == ERR_NO_ERROR) + { + Copy(t, &t2, sizeof(RPC_TEST)); + } + else + { + Zero(t, sizeof(RPC_TEST)); + } + + return ret; +} + +// Flush configuration file +UINT StFlush(ADMIN *a, RPC_TEST *t) +{ + SERVER *s = a->Server; + CEDAR *c = s->Cedar; + UINT ret = ERR_NO_ERROR; + UINT size; + + SERVER_ADMIN_ONLY; + + size = SiWriteConfigurationFile(s); + + t->IntValue = size; + + return ERR_NO_ERROR; +} + +// Do Crash +UINT StCrash(ADMIN *a, RPC_TEST *t) +{ + SERVER *s = a->Server; + CEDAR *c = s->Cedar; + UINT ret = ERR_NO_ERROR; + + SERVER_ADMIN_ONLY; + +#ifdef OS_WIN32 + MsSetEnableMinidump(false); +#endif // OS_WIN32 + + CrashNow(); + + return ERR_NO_ERROR; +} + +// Get message for administrators +UINT StGetAdminMsg(ADMIN *a, RPC_MSG *t) +{ + SERVER *s = a->Server; + CEDAR *c = s->Cedar; + UINT ret = ERR_NO_ERROR; + RPC_WINVER server_ver; + RPC_WINVER client_ver; + wchar_t winver_msg_client[3800]; + wchar_t winver_msg_server[3800]; + UINT tmpsize; + wchar_t *tmp; + + FreeRpcMsg(t); + Zero(t, sizeof(RPC_MSG)); + + // Check for Windows version + GetWinVer(&server_ver); + Copy(&client_ver, &a->ClientWinVer, sizeof(RPC_WINVER)); + + Zero(winver_msg_client, sizeof(winver_msg_client)); + Zero(winver_msg_server, sizeof(winver_msg_server)); + + if (IsSupportedWinVer(&client_ver) == false) + { + SYSTEMTIME st; + + LocalTime(&st); + + UniFormat(winver_msg_client, sizeof(winver_msg_client), _UU("WINVER_ERROR_FORMAT"), + _UU("WINVER_ERROR_PC_LOCAL"), + client_ver.Title, + _UU("WINVER_ERROR_VPNSERVER"), + SUPPORTED_WINDOWS_LIST, + _UU("WINVER_ERROR_PC_LOCAL"), + _UU("WINVER_ERROR_VPNSERVER"), + _UU("WINVER_ERROR_VPNSERVER"), + _UU("WINVER_ERROR_VPNSERVER"), + st.wYear, st.wMonth); + } + + if (IsSupportedWinVer(&server_ver) == false) + { + SYSTEMTIME st; + + LocalTime(&st); + + UniFormat(winver_msg_server, sizeof(winver_msg_server), _UU("WINVER_ERROR_FORMAT"), + _UU("WINVER_ERROR_PC_REMOTE"), + server_ver.Title, + _UU("WINVER_ERROR_VPNSERVER"), + SUPPORTED_WINDOWS_LIST, + _UU("WINVER_ERROR_PC_REMOTE"), + _UU("WINVER_ERROR_VPNSERVER"), + _UU("WINVER_ERROR_VPNSERVER"), + _UU("WINVER_ERROR_VPNSERVER"), + st.wYear, st.wMonth); + } + + tmpsize = UniStrSize(winver_msg_client) + UniStrSize(winver_msg_server) + 10000; + + tmp = ZeroMalloc(tmpsize); + + if ( + c->Bridge == false) + { + if (GetGlobalServerFlag(GSF_SHOW_OSS_MSG) != 0) + { + UniStrCat(tmp, tmpsize, _UU("OSS_MSG")); + } + } + + UniStrCat(tmp, tmpsize, winver_msg_client); + UniStrCat(tmp, tmpsize, winver_msg_server); + + t->Msg = tmp; + + return ERR_NO_ERROR; +} + +// Enumerate VLAN tag transparent setting +UINT StEnumEthVLan(ADMIN *a, RPC_ENUM_ETH_VLAN *t) +{ + SERVER *s = a->Server; + CEDAR *c = s->Cedar; + UINT ret = ERR_NO_ERROR; + + SERVER_ADMIN_ONLY; + +#ifdef OS_WIN32 + if (GetServerCapsBool(s, "b_support_eth_vlan") == false) + { + ret = ERR_NOT_SUPPORTED; + } + else + { + FreeRpcEnumEthVLan(t); + Zero(t, sizeof(RPC_ENUM_ETH_VLAN)); + + if (EnumEthVLanWin32(t) == false) + { + ret = ERR_INTERNAL_ERROR; + } + } +#else // OS_WIN32 + ret = ERR_NOT_SUPPORTED; +#endif // OS_WIN32 + + return ret; +} + +// Set VLAN tag transparent setting +UINT StSetEnableEthVLan(ADMIN *a, RPC_TEST *t) +{ + SERVER *s = a->Server; + CEDAR *c = s->Cedar; + UINT ret = ERR_NO_ERROR; + + SERVER_ADMIN_ONLY; + +#ifdef OS_WIN32 + if (GetServerCapsBool(s, "b_support_eth_vlan") == false) + { + ret = ERR_NOT_SUPPORTED; + } + else if (MsIsAdmin() == false) + { + ret = ERR_NOT_ENOUGH_RIGHT; + } + else + { + if (SetVLanEnableStatus(t->StrValue, MAKEBOOL(t->IntValue)) == false) + { + ret = ERR_INTERNAL_ERROR; + } + } +#else // OS_WIN32 + ret = ERR_NOT_SUPPORTED; +#endif // OS_WIN32 + + return ret; +} + +// Get license status +UINT StGetLicenseStatus(ADMIN *a, RPC_LICENSE_STATUS *t) +{ + return ERR_NOT_SUPPORTED; +} + +// Enumerate license key +UINT StEnumLicenseKey(ADMIN *a, RPC_ENUM_LICENSE_KEY *t) +{ + return ERR_NOT_SUPPORTED; +} + +// Add new license key +UINT StAddLicenseKey(ADMIN *a, RPC_TEST *t) +{ + return ERR_NOT_SUPPORTED; +} + +// Delete a license key +UINT StDelLicenseKey(ADMIN *a, RPC_TEST *t) +{ + return ERR_NOT_SUPPORTED; +} + +// Download a log file +BUF *DownloadFileFromServer(RPC *r, char *server_name, char *filepath, UINT total_size, DOWNLOAD_PROC *proc, void *param) +{ + UINT offset; + BUF *buf; + // Validate arguments + if (r == NULL || filepath == NULL) + { + return NULL; + } + + if (server_name == NULL) + { + server_name = ""; + } + + offset = 0; + + buf = NewBuf(); + + while (true) + { + DOWNLOAD_PROGRESS g; + RPC_READ_LOG_FILE t; + UINT ret; + + Zero(&t, sizeof(t)); + StrCpy(t.FilePath, sizeof(t.FilePath), filepath); + t.Offset = offset; + StrCpy(t.ServerName, sizeof(t.ServerName), server_name); + + ret = ScReadLogFile(r, &t); + + if (ret != ERR_NO_ERROR) + { + // Failed + FreeRpcReadLogFile(&t); + FreeBuf(buf); + return NULL; + } + + if (t.Buffer == NULL) + { + // read to the end + break; + } + + // Update current progress + offset += t.Buffer->Size; + Zero(&g, sizeof(g)); + g.Param = param; + g.CurrentSize = offset; + g.TotalSize = MAX(total_size, offset); + g.ProgressPercent = (UINT)(MAKESURE((UINT64)g.CurrentSize * 100ULL / (UINT64)(MAX(g.TotalSize, 1)), 0, 100ULL)); + + WriteBuf(buf, t.Buffer->Buf, t.Buffer->Size); + + FreeRpcReadLogFile(&t); + + if (proc != NULL) + { + if (proc(&g) == false) + { + // Canceled by user + FreeBuf(buf); + return NULL; + } + } + } + + if (buf->Size == 0) + { + // Downloading failed + FreeBuf(buf); + return NULL; + } + + return buf; +} + +// Read a log file +UINT StReadLogFile(ADMIN *a, RPC_READ_LOG_FILE *t) +{ + SERVER *s = a->Server; + CEDAR *c = s->Cedar; + char logfilename[MAX_PATH]; + char servername[MAX_HOST_NAME_LEN + 1]; + UINT offset; + bool local = true; + + if (IsEmptyStr(t->FilePath)) + { + return ERR_INVALID_PARAMETER; + } + + StrCpy(logfilename, sizeof(logfilename), t->FilePath); + StrCpy(servername, sizeof(servername), t->ServerName); + offset = t->Offset; + + if (s->ServerType != SERVER_TYPE_FARM_CONTROLLER) + { + GetMachineName(servername, sizeof(servername)); + } + + // Check the permission to read the log file + if (a->LogFileList == NULL) + { + // Enum the log files first + RPC_ENUM_LOG_FILE elf; + UINT elf_ret; + + Zero(&elf, sizeof(elf)); + + elf_ret = StEnumLogFile(a, &elf); + + FreeRpcEnumLogFile(&elf); + + if (elf_ret != ERR_NO_ERROR) + { + return elf_ret; + } + } + if (CheckLogFileNameFromEnumList(a->LogFileList, logfilename, servername) == false) + { + // There is no such file in the log file list + return ERR_OBJECT_NOT_FOUND; + } + + FreeRpcReadLogFile(t); + Zero(t, sizeof(RPC_READ_LOG_FILE)); + + if (s->ServerType == SERVER_TYPE_FARM_CONTROLLER) + { + UINT i; + + // When the host name in request is a cluster member, redirect the request + LockList(s->FarmMemberList); + { + for (i = 0;i < LIST_NUM(s->FarmMemberList);i++) + { + FARM_MEMBER *f = LIST_DATA(s->FarmMemberList, i); + + if (f->Me == false) + { + if (StrCmpi(f->hostname, servername) == 0) + { + RPC_READ_LOG_FILE tt; + + Zero(&tt, sizeof(tt)); + local = false; + + StrCpy(tt.ServerName, sizeof(tt.ServerName), servername); + StrCpy(tt.FilePath, sizeof(tt.FilePath), logfilename); + tt.Offset = offset; + + if (SiCallReadLogFile(s, f, &tt)) + { + if (tt.Buffer != NULL && tt.Buffer->Size > 0) + { + t->Buffer = NewBuf(); + WriteBuf(t->Buffer, tt.Buffer->Buf, tt.Buffer->Size); + } + } + + FreeRpcReadLogFile(&tt); + + break; + } + } + } + } + UnlockList(s->FarmMemberList); + } + + // Read a local file + if (local) + { + SiReadLocalLogFile(s, logfilename, offset, t); + } + + if (offset == 0) + { + ALog(a, NULL, "LA_READ_LOG_FILE", servername, logfilename); + } + + StrCpy(t->FilePath, sizeof(t->FilePath), logfilename); + StrCpy(t->ServerName, sizeof(t->ServerName), servername); + t->Offset = offset; + + return ERR_NO_ERROR; +} + +// Enumerate log files +UINT StEnumLogFile(ADMIN *a, RPC_ENUM_LOG_FILE *t) +{ + SERVER *s = a->Server; + CEDAR *c = s->Cedar; + UINT i; + bool no_access = false; + + HUB *h; + + if (a->ServerAdmin == false) + { + h = GetHub(c, a->HubName); + + if (a->ServerAdmin == false && GetHubAdminOption(h, "no_read_log_file") != 0) + { + no_access = true; + } + + ReleaseHub(h); + } + else + { + if (s->ServerType == SERVER_TYPE_FARM_CONTROLLER) + { + // Since Management session will become unstable if log files are + // enumerated on a cluster controller, it forbids. + return ERR_NOT_SUPPORTED; + } + } + + if (no_access) + { + return ERR_NOT_ENOUGH_RIGHT; + } + + FreeRpcEnumLogFile(t); + Zero(t, sizeof(RPC_ENUM_LOG_FILE)); + + // Enumerate local log files + SiEnumLocalLogFileList(s, a->ServerAdmin ? NULL : a->HubName, t); + + if (s->ServerType == SERVER_TYPE_FARM_CONTROLLER) + { + UINT i; + LIST *tt_list = NewListFast(NULL); + + LockList(s->FarmMemberList); + { + for (i = 0;i < LIST_NUM(s->FarmMemberList);i++) + { + FARM_MEMBER *f = LIST_DATA(s->FarmMemberList, i); + + if (f->Me == false) + { + // Enumerate log files on other cluster members. + RPC_ENUM_LOG_FILE *tt; + tt = ZeroMalloc(sizeof(RPC_ENUM_LOG_FILE)); + + if (SiCallEnumLogFileList(s, f, tt, a->ServerAdmin ? "" : a->HubName)) + { + UINT i; + for (i = 0;i < tt->NumItem;i++) + { + RPC_ENUM_LOG_FILE_ITEM *e = &tt->Items[i]; + + StrCpy(e->ServerName, sizeof(e->ServerName), f->hostname); + } + + Add(tt_list, tt); + } + else + { + Free(tt); + } + } + } + } + UnlockList(s->FarmMemberList); + + for (i = 0;i < LIST_NUM(tt_list);i++) + { + RPC_ENUM_LOG_FILE *tt = LIST_DATA(tt_list, i); + + AdjoinRpcEnumLogFile(t, tt); + FreeRpcEnumLogFile(tt); + + Free(tt); + } + + ReleaseList(tt_list); + } + + // Cache the last list of log files on RPC session + if (a->LogFileList != NULL) + { + FreeEnumLogFile(a->LogFileList); + } + + a->LogFileList = NewListFast(CmpLogFile); + + for (i = 0;i < t->NumItem;i++) + { + RPC_ENUM_LOG_FILE_ITEM *e = &t->Items[i]; + LOG_FILE *f = ZeroMalloc(sizeof(LOG_FILE)); + + f->FileSize = e->FileSize; + f->UpdatedTime = e->UpdatedTime; + StrCpy(f->Path, sizeof(f->Path), e->FilePath); + StrCpy(f->ServerName, sizeof(f->ServerName), e->ServerName); + + Insert(a->LogFileList, f); + } + + return ERR_NO_ERROR; +} + + +// Get access control list +UINT StGetAcList(ADMIN *a, RPC_AC_LIST *t) +{ + SERVER *s = a->Server; + CEDAR *c = s->Cedar; + HUB *h; + UINT ret = ERR_NO_ERROR; + char hubname[MAX_HUBNAME_LEN + 1]; + + CHECK_RIGHT; + NO_SUPPORT_FOR_BRIDGE; + if (s->ServerType == SERVER_TYPE_FARM_MEMBER) + { + return ERR_NOT_SUPPORTED; + } + + + StrCpy(hubname, sizeof(hubname), t->HubName); + + FreeRpcAcList(t); + Zero(t, sizeof(RPC_AC_LIST)); + StrCpy(t->HubName, sizeof(t->HubName), hubname); + + h = GetHub(c, hubname); + + if (h == NULL) + { + ret = ERR_HUB_NOT_FOUND; + } + else + { + if (h->HubDb == NULL) + { + ret = ERR_NOT_SUPPORTED; + } + else + { + HUBDB *db = h->HubDb; + + LockList(db->AcList); + { + t->o = NewAcList(); + + SetAcList(t->o, db->AcList); + } + UnlockList(db->AcList); + } + ReleaseHub(h); + } + + return ret; +} + +// Set access control list +UINT StSetAcList(ADMIN *a, RPC_AC_LIST *t) +{ + SERVER *s = a->Server; + CEDAR *c = s->Cedar; + HUB *h; + UINT ret = ERR_NO_ERROR; + char hubname[MAX_HUBNAME_LEN + 1]; + + + if (c->Bridge) + { + return ERR_NOT_SUPPORTED; + } + + if (GetGlobalServerFlag(GSF_DISABLE_AC) != 0 && LIST_NUM(t->o) >= 1) + { + return ERR_NOT_SUPPORTED_FUNCTION_ON_OPENSOURCE; + } + + CHECK_RIGHT; + NO_SUPPORT_FOR_BRIDGE; + if (s->ServerType == SERVER_TYPE_FARM_MEMBER) + { + return ERR_NOT_SUPPORTED; + } + + StrCpy(hubname, sizeof(hubname), t->HubName); + + h = GetHub(c, hubname); + + if (h == NULL) + { + ret = ERR_HUB_NOT_FOUND; + } + else + { + if (a->ServerAdmin == false && GetHubAdminOption(h, "no_change_access_control_list") != 0) + { + ret = ERR_NOT_ENOUGH_RIGHT; + } + else + { + if (h->HubDb == NULL) + { + ret = ERR_NOT_SUPPORTED; + } + else + { + HUBDB *db = h->HubDb; + + LockList(db->AcList); + { + SetAcList(db->AcList, t->o); + + { + ALog(a, h, "LA_SET_AC_LIST", LIST_NUM(t->o)); + + IncrementServerConfigRevision(s); + } + } + UnlockList(db->AcList); + } + } + ReleaseHub(h); + } + + return ret; +} + +// Set CRL (Certificate Revocation List) entry +UINT StSetCrl(ADMIN *a, RPC_CRL *t) +{ + SERVER *s = a->Server; + CEDAR *c = s->Cedar; + HUB *h; + UINT ret = ERR_NO_ERROR; + UINT key; + char hubname[MAX_HUBNAME_LEN + 1]; + + CHECK_RIGHT; + NO_SUPPORT_FOR_BRIDGE; + if (s->ServerType == SERVER_TYPE_FARM_MEMBER) + { + return ERR_NOT_SUPPORTED; + } + + StrCpy(hubname, sizeof(hubname), t->HubName); + key = t->Key; + + h = GetHub(c, hubname); + + if (h == NULL) + { + ret = ERR_HUB_NOT_FOUND; + } + else + { + if (a->ServerAdmin == false && GetHubAdminOption(h, "no_change_crl_list") != 0) + { + ret = ERR_NOT_ENOUGH_RIGHT; + } + else + { + if (h->HubDb == NULL) + { + ret = ERR_NOT_SUPPORTED; + } + else + { + LockList(h->HubDb->CrlList); + { + CRL *crl = ListKeyToPointer(h->HubDb->CrlList, t->Key); + + if (crl == NULL) + { + ret = ERR_OBJECT_NOT_FOUND; + } + else + { + CRL *new_crl = CopyCrl(t->Crl); + if (ReplaceListPointer(h->HubDb->CrlList, crl, new_crl)) + { + ALog(a, h, "LA_ADD_CRL"); + FreeCrl(crl); + + IncrementServerConfigRevision(s); + } + } + } + UnlockList(h->HubDb->CrlList); + } + } + + ReleaseHub(h); + } + + return ret; +} + +// Get CRL (Certificate Revocation List) entry +UINT StGetCrl(ADMIN *a, RPC_CRL *t) +{ + SERVER *s = a->Server; + CEDAR *c = s->Cedar; + HUB *h; + UINT ret = ERR_NO_ERROR; + UINT key; + char hubname[MAX_HUBNAME_LEN + 1]; + + CHECK_RIGHT; + NO_SUPPORT_FOR_BRIDGE; + if (s->ServerType == SERVER_TYPE_FARM_MEMBER) + { + return ERR_NOT_SUPPORTED; + } + + StrCpy(hubname, sizeof(hubname), t->HubName); + key = t->Key; + + FreeRpcCrl(t); + Zero(t, sizeof(RPC_CRL)); + StrCpy(t->HubName, sizeof(t->HubName), hubname); + t->Key = key; + + h = GetHub(c, hubname); + + if (h == NULL) + { + ret = ERR_HUB_NOT_FOUND; + } + else + { + if (h->HubDb == NULL) + { + ret = ERR_NOT_SUPPORTED; + } + else + { + LockList(h->HubDb->CrlList); + { + CRL *crl = ListKeyToPointer(h->HubDb->CrlList, t->Key); + + if (crl == NULL) + { + ret = ERR_OBJECT_NOT_FOUND; + } + else + { + t->Crl = CopyCrl(crl); + } + } + UnlockList(h->HubDb->CrlList); + } + + ReleaseHub(h); + } + + return ret; +} + +// Delete CRL (Certificate Revocation List) entry +UINT StDelCrl(ADMIN *a, RPC_CRL *t) +{ + SERVER *s = a->Server; + CEDAR *c = s->Cedar; + HUB *h; + UINT ret = ERR_NO_ERROR; + char hubname[MAX_HUBNAME_LEN + 1]; + + CHECK_RIGHT; + NO_SUPPORT_FOR_BRIDGE; + if (s->ServerType == SERVER_TYPE_FARM_MEMBER) + { + return ERR_NOT_SUPPORTED; + } + + StrCpy(hubname, sizeof(hubname), t->HubName); + + h = GetHub(c, hubname); + + if (h == NULL) + { + ret = ERR_HUB_NOT_FOUND; + } + else + { + if (a->ServerAdmin == false && GetHubAdminOption(h, "no_change_crl_list") != 0) + { + ret = ERR_NOT_ENOUGH_RIGHT; + } + else + { + if (h->HubDb == NULL) + { + ret = ERR_NOT_SUPPORTED; + } + else + { + LockList(h->HubDb->CrlList); + { + CRL *crl = ListKeyToPointer(h->HubDb->CrlList, t->Key); + + if (crl == NULL) + { + ret = ERR_OBJECT_NOT_FOUND; + } + else + { + ALog(a, h, "LA_DEL_CRL"); + FreeCrl(crl); + Delete(h->HubDb->CrlList, crl); + } + } + UnlockList(h->HubDb->CrlList); + } + } + + ReleaseHub(h); + } + + return ret; +} + +// Add new CRL (Certificate Revocation List) entry +UINT StAddCrl(ADMIN *a, RPC_CRL *t) +{ + SERVER *s = a->Server; + CEDAR *c = s->Cedar; + HUB *h; + UINT ret = ERR_NO_ERROR; + char hubname[MAX_HUBNAME_LEN + 1]; + + if (c->Bridge) + { + return ERR_NOT_SUPPORTED; + } + + CHECK_RIGHT; + NO_SUPPORT_FOR_BRIDGE; + if (s->ServerType == SERVER_TYPE_FARM_MEMBER) + { + return ERR_NOT_SUPPORTED; + } + + StrCpy(hubname, sizeof(hubname), t->HubName); + + h = GetHub(c, hubname); + + if (h == NULL) + { + ret = ERR_HUB_NOT_FOUND; + } + else + { + if (a->ServerAdmin == false && GetHubAdminOption(h, "no_change_crl_list") != 0) + { + ret = ERR_NOT_ENOUGH_RIGHT; + } + else + { + if (h->HubDb == NULL) + { + ret = ERR_NOT_SUPPORTED; + } + else + { + LockList(h->HubDb->CrlList); + { + if (LIST_NUM(h->HubDb->CrlList) < MAX_HUB_CRLS) + { + CRL *crl = CopyCrl(t->Crl); + + Insert(h->HubDb->CrlList, crl); + + ALog(a, h, "LA_SET_CRL"); + + IncrementServerConfigRevision(s); + } + } + UnlockList(h->HubDb->CrlList); + } + } + + ReleaseHub(h); + } + + return ret; +} + +// Get CRL (Certificate Revocation List) index +UINT StEnumCrl(ADMIN *a, RPC_ENUM_CRL *t) +{ + SERVER *s = a->Server; + CEDAR *c = s->Cedar; + HUB *h; + UINT ret = ERR_NO_ERROR; + char hubname[MAX_HUBNAME_LEN + 1]; + + CHECK_RIGHT; + NO_SUPPORT_FOR_BRIDGE; + if (s->ServerType == SERVER_TYPE_FARM_MEMBER) + { + return ERR_NOT_SUPPORTED; + } + + StrCpy(hubname, sizeof(hubname), t->HubName); + FreeRpcEnumCrl(t); + Zero(t, sizeof(RPC_ENUM_CRL)); + + StrCpy(t->HubName, sizeof(t->HubName), hubname); + + h = GetHub(c, hubname); + + if (h == NULL) + { + ret = ERR_HUB_NOT_FOUND; + } + else + { + if (h->HubDb == NULL) + { + ret = ERR_NOT_SUPPORTED; + } + else + { + LockList(h->HubDb->CrlList); + { + UINT i; + + t->NumItem = LIST_NUM(h->HubDb->CrlList); + t->Items = ZeroMalloc(sizeof(RPC_ENUM_CRL_ITEM) * t->NumItem); + + for (i = 0;i < LIST_NUM(h->HubDb->CrlList);i++) + { + CRL *crl = LIST_DATA(h->HubDb->CrlList, i); + wchar_t *info = GenerateCrlStr(crl); + + UniStrCpy(t->Items[i].CrlInfo, sizeof(t->Items[i].CrlInfo), info); + Free(info); + + t->Items[i].Key = POINTER_TO_KEY(crl); + } + } + UnlockList(h->HubDb->CrlList); + } + + ReleaseHub(h); + } + + return ret; +} + +// Get routing table on virtual L3 switch +UINT StEnumL3Table(ADMIN *a, RPC_ENUM_L3TABLE *t) +{ + SERVER *s = a->Server; + CEDAR *c = s->Cedar; + UINT ret = ERR_NO_ERROR; + L3SW *sw; + char name[MAX_HUBNAME_LEN + 1]; + + if (IsEmptyStr(t->Name)) + { + return ERR_INVALID_PARAMETER; + } + + NO_SUPPORT_FOR_BRIDGE; + + StrCpy(name, sizeof(name), t->Name); + FreeRpcEnumL3Table(t); + Zero(t, sizeof(RPC_ENUM_L3TABLE)); + StrCpy(t->Name, sizeof(t->Name), name); + + sw = L3GetSw(c, t->Name); + + if (sw == NULL) + { + ret = ERR_LAYER3_SW_NOT_FOUND; + } + else + { + UINT i; + + Lock(sw->lock); + { + t->NumItem = LIST_NUM(sw->TableList); + t->Items = ZeroMalloc(sizeof(RPC_L3TABLE) * t->NumItem); + + for (i = 0;i < t->NumItem;i++) + { + L3TABLE *tbl = LIST_DATA(sw->TableList, i); + RPC_L3TABLE *e = &t->Items[i]; + + StrCpy(e->Name, sizeof(e->Name), name); + e->NetworkAddress = tbl->NetworkAddress; + e->SubnetMask = tbl->SubnetMask; + e->GatewayAddress = tbl->GatewayAddress; + e->Metric = tbl->Metric; + } + } + Unlock(sw->lock); + + ReleaseL3Sw(sw); + } + + return ret; +} + +// Delete routing table entry on virtual L3 switch +UINT StDelL3Table(ADMIN *a, RPC_L3TABLE *t) +{ + SERVER *s = a->Server; + CEDAR *c = s->Cedar; + UINT ret = ERR_NO_ERROR; + L3SW *sw; + + SERVER_ADMIN_ONLY; + + NO_SUPPORT_FOR_BRIDGE; + + sw = L3GetSw(c, t->Name); + + if (sw == NULL) + { + ret = ERR_LAYER3_SW_NOT_FOUND; + } + else + { + L3TABLE tbl; + + Zero(&tbl, sizeof(tbl)); + tbl.NetworkAddress = t->NetworkAddress; + tbl.SubnetMask = t->SubnetMask; + tbl.GatewayAddress = t->GatewayAddress; + tbl.Metric = t->Metric; + + if (L3DelTable(sw, &tbl) == false) + { + ret = ERR_LAYER3_TABLE_DEL_FAILED; + } + else + { + char tmp[MAX_SIZE]; + IPToStr32(tmp, sizeof(tmp), tbl.NetworkAddress); + ALog(a, NULL, "LA_DEL_L3_TABLE", tmp, t->Name); + + IncrementServerConfigRevision(s); + } + + ReleaseL3Sw(sw); + } + + return ret; +} + +// Add new routing table entry on virtual L3 switch +UINT StAddL3Table(ADMIN *a, RPC_L3TABLE *t) +{ + SERVER *s = a->Server; + CEDAR *c = s->Cedar; + UINT ret = ERR_NO_ERROR; + L3SW *sw; + + if (IsNetworkAddress32(t->NetworkAddress, t->SubnetMask) == false || + IsHostIPAddress32(t->GatewayAddress) == false) + { + return ERR_INVALID_PARAMETER; + } + + SERVER_ADMIN_ONLY; + + NO_SUPPORT_FOR_BRIDGE; + + sw = L3GetSw(c, t->Name); + + if (sw == NULL) + { + ret = ERR_LAYER3_SW_NOT_FOUND; + } + else + { + L3TABLE tbl; + + Zero(&tbl, sizeof(tbl)); + tbl.NetworkAddress = t->NetworkAddress; + tbl.SubnetMask = t->SubnetMask; + tbl.GatewayAddress = t->GatewayAddress; + tbl.Metric = t->Metric; + + if (L3AddTable(sw, &tbl) == false) + { + ret = ERR_LAYER3_TABLE_ADD_FAILED; + } + else + { + char tmp[MAX_SIZE]; + IPToStr32(tmp, sizeof(tmp), tbl.NetworkAddress); + ALog(a, NULL, "LA_ADD_L3_TABLE", tmp, t->Name); + + IncrementServerConfigRevision(s); + } + + ReleaseL3Sw(sw); + } + + return ret; +} + +// Enumerate virtual interfaces on virtual L3 switch +UINT StEnumL3If(ADMIN *a, RPC_ENUM_L3IF *t) +{ + SERVER *s = a->Server; + CEDAR *c = s->Cedar; + UINT ret = ERR_NO_ERROR; + L3SW *sw; + char name[MAX_HUBNAME_LEN + 1]; + + NO_SUPPORT_FOR_BRIDGE; + + StrCpy(name, sizeof(name), t->Name); + + FreeRpcEnumL3If(t); + Zero(t, sizeof(RPC_ENUM_L3IF)); + + StrCpy(t->Name, sizeof(t->Name), name); + + sw = L3GetSw(c, t->Name); + + if (sw == NULL) + { + ret = ERR_LAYER3_SW_NOT_FOUND; + } + else + { + Lock(sw->lock); + { + UINT i; + + t->NumItem = LIST_NUM(sw->IfList); + t->Items = ZeroMalloc(sizeof(RPC_L3IF) * t->NumItem); + + for (i = 0;i < t->NumItem;i++) + { + L3IF *f = LIST_DATA(sw->IfList, i); + RPC_L3IF *e = &t->Items[i]; + + StrCpy(e->Name, sizeof(e->Name), sw->Name); + StrCpy(e->HubName, sizeof(e->HubName), f->HubName); + e->IpAddress = f->IpAddress; + e->SubnetMask = f->SubnetMask; + } + } + Unlock(sw->lock); + + ReleaseL3Sw(sw); + } + + return ret; +} + +// Delete a virtual interface on virtual L3 switch +UINT StDelL3If(ADMIN *a, RPC_L3IF *t) +{ + SERVER *s = a->Server; + CEDAR *c = s->Cedar; + UINT ret = ERR_NO_ERROR; + L3SW *sw; + + NO_SUPPORT_FOR_BRIDGE; + + SERVER_ADMIN_ONLY; + + sw = L3GetSw(c, t->Name); + + if (sw == NULL) + { + ret = ERR_LAYER3_SW_NOT_FOUND; + } + else + { + if (L3DelIf(sw, t->HubName) == false) + { + ret = ERR_LAYER3_IF_DEL_FAILED; + } + else + { + ALog(a, NULL, "LA_DEL_L3_IF", t->HubName, t->Name); + + IncrementServerConfigRevision(s); + } + ReleaseL3Sw(sw); + } + + return ret; +} + +// Add new virtual interface on virtual L3 switch +UINT StAddL3If(ADMIN *a, RPC_L3IF *t) +{ + SERVER *s = a->Server; + CEDAR *c = s->Cedar; + UINT ret = ERR_NO_ERROR; + L3SW *sw; + + + if (IsSubnetMask32(t->SubnetMask) == false || IsHostIPAddress32(t->IpAddress) == false) + { + return ERR_INVALID_PARAMETER; + } + if ((t->IpAddress & (~t->SubnetMask)) == 0) + { + return ERR_INVALID_PARAMETER; + } + + NO_SUPPORT_FOR_BRIDGE; + + SERVER_ADMIN_ONLY; + + sw = L3GetSw(c, t->Name); + + if (sw == NULL) + { + ret = ERR_LAYER3_SW_NOT_FOUND; + } + else + { + Lock(sw->lock); + { + if (L3SearchIf(sw, t->HubName) != NULL) + { + // Already exists + ret = ERR_LAYER3_IF_EXISTS; + } + else + { + if (L3AddIf(sw, t->HubName, t->IpAddress, t->SubnetMask) == false) + { + ret = ERR_LAYER3_IF_ADD_FAILED; + } + else + { + ALog(a, NULL, "LA_ADD_L3_IF", t->HubName, t->Name); + + IncrementServerConfigRevision(s); + } + } + } + Unlock(sw->lock); + ReleaseL3Sw(sw); + } + + return ret; +} + +// Stop a virtual layer-3 switch +UINT StStopL3Switch(ADMIN *a, RPC_L3SW *t) +{ + SERVER *s = a->Server; + CEDAR *c = s->Cedar; + UINT ret = ERR_NO_ERROR; + L3SW *sw; + + if (IsEmptyStr(t->Name)) + { + return ERR_INVALID_PARAMETER; + } + + NO_SUPPORT_FOR_BRIDGE; + + SERVER_ADMIN_ONLY; + + sw = L3GetSw(c, t->Name); + + if (sw == NULL) + { + ret = ERR_LAYER3_SW_NOT_FOUND; + } + else + { + L3SwStop(sw); + ALog(a, NULL, "LA_STOP_L3_SW", sw->Name); + ReleaseL3Sw(sw); + + IncrementServerConfigRevision(s); + } + + return ret; +} + +// Start a virtual layer-3 switch +UINT StStartL3Switch(ADMIN *a, RPC_L3SW *t) +{ + SERVER *s = a->Server; + CEDAR *c = s->Cedar; + UINT ret = ERR_NO_ERROR; + L3SW *sw; + + if (IsEmptyStr(t->Name)) + { + return ERR_INVALID_PARAMETER; + } + + NO_SUPPORT_FOR_BRIDGE; + + SERVER_ADMIN_ONLY; + + sw = L3GetSw(c, t->Name); + + if (sw == NULL) + { + ret = ERR_LAYER3_SW_NOT_FOUND; + } + else + { + Lock(sw->lock); + { + // Count the registered virtual interfaces + if (LIST_NUM(sw->IfList) >= 1) + { + L3SwStart(sw); + + ALog(a, NULL, "LA_START_L3_SW", sw->Name); + + IncrementServerConfigRevision(s); + } + else + { + ret = ERR_LAYER3_CANT_START_SWITCH; + } + } + Unlock(sw->lock); + + ReleaseL3Sw(sw); + } + + return ret; +} + +// Enumerate virtual layer-3 switches +UINT StEnumL3Switch(ADMIN *a, RPC_ENUM_L3SW *t) +{ + UINT i; + SERVER *s = a->Server; + CEDAR *c = s->Cedar; + UINT ret = ERR_NO_ERROR; + + NO_SUPPORT_FOR_BRIDGE; + + FreeRpcEnumL3Sw(t); + Zero(t, sizeof(RPC_ENUM_L3SW)); + + LockList(c->L3SwList); + { + t->NumItem = LIST_NUM(c->L3SwList); + t->Items = ZeroMalloc(sizeof(RPC_ENUM_L3SW_ITEM) * t->NumItem); + for (i = 0;i < LIST_NUM(c->L3SwList);i++) + { + L3SW *sw = LIST_DATA(c->L3SwList, i); + RPC_ENUM_L3SW_ITEM *e = &t->Items[i]; + + Lock(sw->lock); + { + StrCpy(e->Name, sizeof(e->Name), sw->Name); + e->NumInterfaces = LIST_NUM(sw->IfList); + e->NumTables = LIST_NUM(sw->TableList); + e->Active = sw->Active; + e->Online = sw->Online; + } + Unlock(sw->lock); + } + } + UnlockList(c->L3SwList); + + return ret; +} + +// Delete a virtual layer-3 switch +UINT StDelL3Switch(ADMIN *a, RPC_L3SW *t) +{ + SERVER *s = a->Server; + CEDAR *c = s->Cedar; + UINT ret = ERR_NO_ERROR; + + if (IsEmptyStr(t->Name)) + { + return ERR_INVALID_PARAMETER; + } + + NO_SUPPORT_FOR_BRIDGE; + + SERVER_ADMIN_ONLY; + + if (L3DelSw(c, t->Name) == false) + { + ret = ERR_LAYER3_SW_NOT_FOUND; + } + else + { + ALog(a, NULL, "LA_DEL_L3_SW", t->Name); + + IncrementServerConfigRevision(s); + } + + return ret; +} + +// Add a new virtual layer-3 switch +UINT StAddL3Switch(ADMIN *a, RPC_L3SW *t) +{ + SERVER *s = a->Server; + CEDAR *c = s->Cedar; + UINT ret = ERR_NO_ERROR; + L3SW *sw; + + NO_SUPPORT_FOR_BRIDGE; + + if (IsEmptyStr(t->Name)) + { + return ERR_INVALID_PARAMETER; + } + + if (IsSafeStr(t->Name) == false) + { + return ERR_INVALID_PARAMETER; + } + + SERVER_ADMIN_ONLY; + + // Duplication check + sw = L3GetSw(c, t->Name); + if (sw != NULL) + { + // Already exists + ReleaseL3Sw(sw); + ret = ERR_LAYER3_SW_EXISTS; + } + else + { + LockList(c->L3SwList); + { + if (LIST_NUM(c->L3SwList) >= GetServerCapsInt(s, "i_max_l3_sw")) + { + // No more virtual interfaces + sw = NULL; + } + else + { + // Create + sw = L3AddSw(c, t->Name); + + if (sw != NULL) + { + ALog(a, NULL, "LA_ADD_L3_SW", t->Name); + + IncrementServerConfigRevision(s); + } + } + } + UnlockList(c->L3SwList); + + if (sw == NULL) + { + // Failed + ret = ERR_INTERNAL_ERROR; + } + else + { + // Success + ReleaseL3Sw(sw); + } + } + + return ret; +} + +// Set hub extended options +UINT StSetHubExtOptions(ADMIN *a, RPC_ADMIN_OPTION *t) +{ + SERVER *s = a->Server; + CEDAR *c = s->Cedar; + HUB *h; + + bool not_server_admin = false; + + if (t->NumItem > MAX_HUB_ADMIN_OPTIONS) + { + return ERR_TOO_MANT_ITEMS; + } + + if (s->ServerType == SERVER_TYPE_FARM_MEMBER) + { + return ERR_NOT_SUPPORTED; + } + + + CHECK_RIGHT; + + if (a->ServerAdmin == false) + { + not_server_admin = true; + } + + LockHubList(c); + { + h = GetHub(c, t->HubName); + } + UnlockHubList(c); + + if (h == NULL) + { + return ERR_HUB_NOT_FOUND; + } + + if (GetHubAdminOption(h, "deny_hub_admin_change_ext_option") && not_server_admin) + { + // Insufficient permission + ReleaseHub(h); + + return ERR_NOT_ENOUGH_RIGHT; + } + + // Update setting + Lock(h->lock); + { + DataToHubOptionStruct(h->Option, t); + } + Unlock(h->lock); + + ALog(a, NULL, "LA_SET_HUB_EXT_OPTION", h->Name); + + h->CurrentVersion++; + SiHubUpdateProc(h); + + ReleaseHub(h); + + IncrementServerConfigRevision(s); + + return ERR_NO_ERROR; +} + +// Get hub extended options +UINT StGetHubExtOptions(ADMIN *a, RPC_ADMIN_OPTION *t) +{ + SERVER *s = a->Server; + CEDAR *c = s->Cedar; + HUB *h; + + CHECK_RIGHT; + + LockHubList(c); + { + h = GetHub(c, t->HubName); + } + UnlockHubList(c); + + if (h == NULL) + { + return ERR_HUB_NOT_FOUND; + } + + FreeRpcAdminOption(t); + Zero(t, sizeof(RPC_ADMIN_OPTION)); + + StrCpy(t->HubName, sizeof(t->HubName), h->Name); + + // Get options + Lock(h->lock); + { + HubOptionStructToData(t, h->Option, h->Name); + } + Unlock(h->lock); + + ReleaseHub(h); + + return ERR_NO_ERROR; +} + +// Set hub administration options +UINT StSetHubAdminOptions(ADMIN *a, RPC_ADMIN_OPTION *t) +{ + UINT i; + SERVER *s = a->Server; + CEDAR *c = s->Cedar; + HUB *h; + + bool not_server_admin = false; + + + if (t->NumItem > MAX_HUB_ADMIN_OPTIONS) + { + return ERR_TOO_MANT_ITEMS; + } + + NO_SUPPORT_FOR_BRIDGE; + if (s->ServerType == SERVER_TYPE_FARM_MEMBER) + { + return ERR_NOT_SUPPORTED; + } + + CHECK_RIGHT; + + if (a->ServerAdmin == false) + { + not_server_admin = true; + } + + LockHubList(c); + { + h = GetHub(c, t->HubName); + } + UnlockHubList(c); + + if (h == NULL) + { + return ERR_HUB_NOT_FOUND; + } + + if (GetHubAdminOption(h, "allow_hub_admin_change_option") == false + && not_server_admin) + { + // Insufficient permission + ReleaseHub(h); + + return ERR_NOT_ENOUGH_RIGHT; + } + + LockList(h->AdminOptionList); + { + DeleteAllHubAdminOption(h, false); + + for (i = 0;i < t->NumItem;i++) + { + ADMIN_OPTION *e = &t->Items[i]; + ADMIN_OPTION *a = ZeroMalloc(sizeof(ADMIN_OPTION)); + + StrCpy(a->Name, sizeof(a->Name), e->Name); + a->Value = e->Value; + + Insert(h->AdminOptionList, a); + } + + AddHubAdminOptionsDefaults(h, false); + } + UnlockList(h->AdminOptionList); + + ALog(a, NULL, "LA_SET_HUB_ADMIN_OPTION", h->Name); + + h->CurrentVersion++; + SiHubUpdateProc(h); + + ReleaseHub(h); + + IncrementServerConfigRevision(s); + + return ERR_NO_ERROR; +} + +// Get hub administration options +UINT StGetHubAdminOptions(ADMIN *a, RPC_ADMIN_OPTION *t) +{ + UINT i; + SERVER *s = a->Server; + CEDAR *c = s->Cedar; + HUB *h; + + CHECK_RIGHT; + + NO_SUPPORT_FOR_BRIDGE; + if (s->ServerType == SERVER_TYPE_FARM_MEMBER) + { + return ERR_NOT_SUPPORTED; + } + + LockHubList(c); + { + h = GetHub(c, t->HubName); + } + UnlockHubList(c); + + if (h == NULL) + { + return ERR_HUB_NOT_FOUND; + } + + FreeRpcAdminOption(t); + Zero(t, sizeof(RPC_ADMIN_OPTION)); + + StrCpy(t->HubName, sizeof(t->HubName), h->Name); + + LockList(h->AdminOptionList); + { + t->NumItem = LIST_NUM(h->AdminOptionList); + t->Items = ZeroMalloc(sizeof(ADMIN_OPTION) * t->NumItem); + + for (i = 0;i < t->NumItem;i++) + { + ADMIN_OPTION *a = LIST_DATA(h->AdminOptionList, i); + ADMIN_OPTION *e = &t->Items[i]; + + StrCpy(e->Name, sizeof(e->Name), a->Name); + e->Value = a->Value; + UniStrCpy(e->Descrption, sizeof(e->Descrption), GetHubAdminOptionHelpString(e->Name)); + } + } + UnlockList(h->AdminOptionList); + + ReleaseHub(h); + + return ERR_NO_ERROR; +} + +// Get default hub administration options +UINT StGetDefaultHubAdminOptions(ADMIN *a, RPC_ADMIN_OPTION *t) +{ + UINT i; + + NO_SUPPORT_FOR_BRIDGE; + if (a->Server->ServerType == SERVER_TYPE_FARM_MEMBER) + { + return ERR_NOT_SUPPORTED; + } + + FreeRpcAdminOption(t); + Zero(t, sizeof(RPC_ADMIN_OPTION)); + + t->NumItem = num_admin_options; + t->Items = ZeroMalloc(sizeof(ADMIN_OPTION) * t->NumItem); + + for (i = 0;i < t->NumItem;i++) + { + ADMIN_OPTION *a = &t->Items[i]; + + StrCpy(a->Name, sizeof(a->Name), admin_options[i].Name); + a->Value = admin_options[i].Value; + UniStrCpy(a->Descrption, sizeof(a->Descrption), GetHubAdminOptionHelpString(a->Name)); + } + + return ERR_NO_ERROR; +} + +// Get configuration file stream +UINT StGetConfig(ADMIN *a, RPC_CONFIG *t) +{ + SERVER *s; + + SERVER_ADMIN_ONLY; + + FreeRpcConfig(t); + Zero(t, sizeof(RPC_CONFIG)); + + s = a->Server; + + ALog(a, NULL, "LA_GET_CONFIG"); + + if (s->CfgRw != NULL) + { + FOLDER *f = SiWriteConfigurationToCfg(s); + BUF *b = CfgFolderToBuf(f, true); + + StrCpy(t->FileName, sizeof(t->FileName), s->CfgRw->FileName + (s->CfgRw->FileName[0] == '@' ? 1 : 0)); + + t->FileData = ZeroMalloc(b->Size + 1); + Copy(t->FileData, b->Buf, b->Size); + + CfgDeleteFolder(f); + FreeBuf(b); + + return ERR_NO_ERROR; + } + else + { + return ERR_INTERNAL_ERROR; + } +} + +// Overwrite configuration file by specified data +UINT StSetConfig(ADMIN *a, RPC_CONFIG *t) +{ + SERVER *s; + IO *o; + char filename[MAX_PATH]; + + SERVER_ADMIN_ONLY; + + s = a->Server; + if (s->CfgRw == NULL) + { + return ERR_INTERNAL_ERROR; + } + + // Write new configuration file + Format(filename, sizeof(filename), "%s.new", s->CfgRw->FileName); + + o = FileCreate(filename); + + FileWrite(o, t->FileData, StrLen(t->FileData)); + + FileClose(o); + + IncrementServerConfigRevision(s); + + ALog(a, NULL, "LA_SET_CONFIG"); + + // Reboot server itself + SiRebootServer(s->Cedar->Bridge); + + return ERR_NO_ERROR; +} + +// Get capabilities +UINT StGetCaps(ADMIN *a, CAPSLIST *t) +{ + FreeRpcCapsList(t); + Zero(t, sizeof(CAPSLIST)); + + GetServerCapsMain(a->Server, t); + + return ERR_NO_ERROR; +} + +// Reboot server itself +UINT StRebootServer(ADMIN *a, RPC_TEST *t) +{ + SERVER_ADMIN_ONLY; + + ALog(a, NULL, "LA_REBOOT_SERVER"); + + SiRebootServerEx(a->Server->Cedar->Bridge, t->IntValue); + + return ERR_NO_ERROR; +} + +// Get availability to localbridge function +UINT StGetBridgeSupport(ADMIN *a, RPC_BRIDGE_SUPPORT *t) +{ + Zero(t, sizeof(RPC_BRIDGE_SUPPORT)); + + t->IsBridgeSupportedOs = IsBridgeSupported(); + t->IsWinPcapNeeded = IsNeedWinPcap(); + + return ERR_NO_ERROR; +} + +// Enumerate Ethernet devices +UINT StEnumEthernet(ADMIN *a, RPC_ENUM_ETH *t) +{ + TOKEN_LIST *o; + UINT i; + char tmp[MAX_SIZE]; + bool unix_support = false; + + SERVER_ADMIN_ONLY; + +#ifdef OS_UNIX + unix_support = EthIsInterfaceDescriptionSupportedUnix(); +#endif // OS_UNIX + + o = GetEthList(); + if (o == NULL) + { + return ERR_NOT_SUPPORTED; + } + + FreeRpcEnumEth(t); + Zero(t, sizeof(RPC_ENUM_ETH)); + + t->NumItem = o->NumTokens; + t->Items = ZeroMalloc(sizeof(RPC_ENUM_ETH_ITEM) * t->NumItem); + + for (i = 0;i < t->NumItem;i++) + { + RPC_ENUM_ETH_ITEM *e = &t->Items[i]; + + StrCpy(e->DeviceName, sizeof(e->DeviceName), o->Token[i]); + + StrCpy(tmp, sizeof(tmp), e->DeviceName); + +#ifdef OS_WIN32 + GetEthNetworkConnectionName(e->NetworkConnectionName, sizeof(e->NetworkConnectionName), e->DeviceName); +#else + if (unix_support == false) + { + StrCpy(tmp, sizeof(tmp), ""); + } + else + { + if (EthGetInterfaceDescriptionUnix(e->DeviceName, tmp, sizeof(tmp)) == false) + { + StrCpy(tmp, sizeof(tmp), e->DeviceName); + } + } + + StrToUni(e->NetworkConnectionName, sizeof(e->NetworkConnectionName), tmp); +#endif + } + + FreeToken(o); + + return ERR_NO_ERROR; +} + +// Add a new local bridge +UINT StAddLocalBridge(ADMIN *a, RPC_LOCALBRIDGE *t) +{ + if (IsEmptyStr(t->DeviceName) || IsEmptyStr(t->HubName)) + { + return ERR_INVALID_PARAMETER; + } + + SERVER_ADMIN_ONLY; + + + if (IsEthSupported() == false) + { + return ERR_LOCAL_BRIDGE_UNSUPPORTED; + } + +#ifdef OS_WIN32 + if (true) + { + char tmp[MAX_SIZE]; + UINT id = Win32EthGetNameAndIdFromCombinedName(tmp, sizeof(tmp), t->DeviceName); + + if (id == 0) + { + // If a ID is not specified in Win32, adding will fail + return ERR_OBJECT_NOT_FOUND; + } + } +#endif // OS_WIN32 + + ALog(a, NULL, "LA_ADD_BRIDGE", t->HubName, t->DeviceName); + + AddLocalBridge(a->Server->Cedar, t->HubName, t->DeviceName, false, false, t->TapMode, NULL, false); + + IncrementServerConfigRevision(a->Server); + + return ERR_NO_ERROR; +} + +// Delete a local bridge +UINT StDeleteLocalBridge(ADMIN *a, RPC_LOCALBRIDGE *t) +{ + if (IsEmptyStr(t->DeviceName) || IsEmptyStr(t->HubName)) + { + return ERR_INVALID_PARAMETER; + } + + SERVER_ADMIN_ONLY; + + ALog(a, NULL, "LA_DELETE_BRIDGE", t->HubName, t->DeviceName); + + if (DeleteLocalBridge(a->Server->Cedar, t->HubName, t->DeviceName) == false) + { + return ERR_OBJECT_NOT_FOUND; + } + + IncrementServerConfigRevision(a->Server); + + return ERR_NO_ERROR; +} + +// Enumerate local bridges +UINT StEnumLocalBridge(ADMIN *a, RPC_ENUM_LOCALBRIDGE *t) +{ + UINT i; + CEDAR *c; + + if (IsEthSupported() == false) + { + return ERR_LOCAL_BRIDGE_UNSUPPORTED; + } + + FreeRpcEnumLocalBridge(t); + Zero(t, sizeof(RPC_ENUM_LOCALBRIDGE)); + + c = a->Server->Cedar; + + LockList(c->LocalBridgeList); + { + t->NumItem = LIST_NUM(c->LocalBridgeList); + t->Items = ZeroMalloc(sizeof(RPC_LOCALBRIDGE) * t->NumItem); + + for (i = 0;i < t->NumItem;i++) + { + RPC_LOCALBRIDGE *e = &t->Items[i]; + LOCALBRIDGE *br = LIST_DATA(c->LocalBridgeList, i); + + if (br->Bridge == false) + { + e->Online = e->Active = false; + } + else + { + e->Online = true; + if (br->Bridge->Active) + { + e->Active = true; + } + else + { + e->Active = false; + } + } + StrCpy(e->DeviceName, sizeof(e->DeviceName), br->DeviceName); + StrCpy(e->HubName, sizeof(e->HubName), br->HubName); + + e->TapMode = br->TapMode; + } + } + UnlockList(c->LocalBridgeList); + + return ERR_NO_ERROR; +} + +// Set syslog function setting +UINT StSetSysLog(ADMIN *a, SYSLOG_SETTING *t) +{ + SERVER *s = a->Server; + + SERVER_ADMIN_ONLY; + + if (GetGlobalServerFlag(GSF_DISABLE_SYSLOG) != 0 && t->SaveType != SYSLOG_NONE) + { + return ERR_NOT_SUPPORTED_FUNCTION_ON_OPENSOURCE; + } + + if (GetServerCapsBool(s, "b_support_syslog") == false) + { + return ERR_NOT_SUPPORTED; + } + + SiSetSysLogSetting(s, t); + + IncrementServerConfigRevision(s); + ALog(a, NULL, "LA_SET_SYSLOG"); + + return ERR_NO_ERROR; +} + +// Get syslog function setting +UINT StGetSysLog(ADMIN *a, SYSLOG_SETTING *t) +{ + SERVER *s = a->Server; + + SiGetSysLogSetting(s, t); + + if (a->ServerAdmin == false) + { + // Hide server name for non-administrator + if (t->SaveType == SYSLOG_NONE) + { + StrCpy(t->Hostname, sizeof(t->Hostname), ""); + t->Port = 0; + } + else + { + StrCpy(t->Hostname, sizeof(t->Hostname), "Secret"); + t->Port = 0; + } + } + + return ERR_NO_ERROR; +} + +// Set keep-alive function setting +UINT StSetKeep(ADMIN *a, RPC_KEEP *t) +{ + SERVER *s = a->Server; + + if (t->UseKeepConnect) + { + if (IsEmptyStr(t->KeepConnectHost) || + t->KeepConnectPort == 0 || + t->KeepConnectPort >= 65536) + { + return ERR_INVALID_PARAMETER; + } + } + + SERVER_ADMIN_ONLY; + + Lock(s->Keep->lock); + { + KEEP *keep = s->Keep; + keep->Enable = t->UseKeepConnect; + keep->Server = true; + StrCpy(keep->ServerName, sizeof(keep->ServerName), t->KeepConnectHost); + keep->ServerPort = t->KeepConnectPort; + keep->UdpMode = t->KeepConnectProtocol; + keep->Interval = t->KeepConnectInterval * 1000; + if (keep->Interval < 5000) + { + keep->Interval = 5000; + } + else if (keep->Interval > 600000) + { + keep->Interval = 600000; + } + } + Unlock(s->Keep->lock); + + ALog(a, NULL, "LA_SET_KEEP"); + + IncrementServerConfigRevision(s); + + return ERR_NO_ERROR; +} + +// Get keep-alive function setting +UINT StGetKeep(ADMIN *a, RPC_KEEP *t) +{ + SERVER *s = a->Server; + + Zero(t, sizeof(RPC_KEEP)); + + Lock(s->Keep->lock); + { + KEEP *k = s->Keep; + t->UseKeepConnect = k->Enable; + StrCpy(t->KeepConnectHost, sizeof(t->KeepConnectHost), k->ServerName); + t->KeepConnectPort = k->ServerPort; + t->KeepConnectProtocol = k->UdpMode; + t->KeepConnectInterval = k->Interval / 1000; + } + Unlock(s->Keep->lock); + + return ERR_NO_ERROR; +} + +// Delete IP address table entry +UINT StDeleteIpTable(ADMIN *a, RPC_DELETE_TABLE *t) +{ + SERVER *s = a->Server; + CEDAR *c = s->Cedar; + HUB *h = NULL; + UINT ret = ERR_NO_ERROR; + + CHECK_RIGHT; + + LockHubList(c); + { + h = GetHub(c, t->HubName); + } + UnlockHubList(c); + + if (h == NULL) + { + return ERR_HUB_NOT_FOUND; + } + + if (a->ServerAdmin == false && GetHubAdminOption(h, "no_delete_iptable") != 0) + { + ReleaseHub(h); + return ERR_NOT_ENOUGH_RIGHT; + } + + LockList(h->IpTable); + { + if (IsInListKey(h->IpTable, t->Key)) + { + IP_TABLE_ENTRY *e = ListKeyToPointer(h->IpTable, t->Key); + Free(e); + Delete(h->IpTable, e); + } + else + { + ret = ERR_OBJECT_NOT_FOUND; + } + } + UnlockList(h->IpTable); + + if (ret == ERR_OBJECT_NOT_FOUND) + { + if (s->ServerType == SERVER_TYPE_FARM_CONTROLLER) + { + UINT i; + LockList(s->FarmMemberList); + { + for (i = 0;i < LIST_NUM(s->FarmMemberList);i++) + { + FARM_MEMBER *f = LIST_DATA(s->FarmMemberList, i); + if (f->Me == false) + { + SiCallDeleteIpTable(s, f, t->HubName, t->Key); + ret = ERR_NO_ERROR; + } + } + } + UnlockList(s->FarmMemberList); + } + } + + ReleaseHub(h); + + return ret; +} + +// Get local IP address table +UINT SiEnumIpTable(SERVER *s, char *hubname, RPC_ENUM_IP_TABLE *t) +{ + CEDAR *c; + UINT i; + HUB *h = NULL; + // Validate arguments + if (s == NULL || hubname == NULL || t == NULL) + { + return ERR_INTERNAL_ERROR; + } + + c = s->Cedar; + + LockHubList(c); + { + h = GetHub(c, hubname); + } + UnlockHubList(c); + + if (h == NULL) + { + return ERR_HUB_NOT_FOUND; + } + + StrCpy(t->HubName, sizeof(t->HubName), hubname); + + LockList(h->IpTable); + { + t->NumIpTable = LIST_NUM(h->IpTable); + t->IpTables = ZeroMalloc(sizeof(RPC_ENUM_IP_TABLE_ITEM) * t->NumIpTable); + + for (i = 0;i < t->NumIpTable;i++) + { + RPC_ENUM_IP_TABLE_ITEM *e = &t->IpTables[i]; + IP_TABLE_ENTRY *table = LIST_DATA(h->IpTable, i); + + e->Key = POINTER_TO_KEY(table); + StrCpy(e->SessionName, sizeof(e->SessionName), table->Session->Name); + e->Ip = IPToUINT(&table->Ip); + Copy(&e->IpV6, &table->Ip, sizeof(IP)); + Copy(&e->IpAddress, &table->Ip, sizeof(IP)); + e->DhcpAllocated = table->DhcpAllocated; + e->CreatedTime = TickToTime(table->CreatedTime); + e->UpdatedTime = TickToTime(table->UpdatedTime); + + GetMachineName(e->RemoteHostname, sizeof(e->RemoteHostname)); + } + } + UnlockList(h->IpTable); + + ReleaseHub(h); + + return ERR_NO_ERROR; +} + +// Get IP address table +UINT StEnumIpTable(ADMIN *a, RPC_ENUM_IP_TABLE *t) +{ + SERVER *s = a->Server; + CEDAR *c = s->Cedar; + UINT ret = ERR_NO_ERROR; + char hubname[MAX_HUBNAME_LEN + 1]; + UINT i; + + CHECK_RIGHT; + + // Get local IP address table + StrCpy(hubname, sizeof(hubname), t->HubName); + FreeRpcEnumIpTable(t); + Zero(t, sizeof(RPC_ENUM_IP_TABLE)); + StrCpy(t->HubName, sizeof(t->HubName), hubname); + + ret = SiEnumIpTable(s, hubname, t); + if (ret != ERR_NO_ERROR) + { + return ret; + } + + if (s->ServerType == SERVER_TYPE_FARM_CONTROLLER) + { + // Get remote IP address table + LockList(s->FarmMemberList); + { + for (i = 0;i < LIST_NUM(s->FarmMemberList);i++) + { + FARM_MEMBER *f = LIST_DATA(s->FarmMemberList, i); + if (f->Me == false) + { + RPC_ENUM_IP_TABLE tmp; + + Zero(&tmp, sizeof(tmp)); + + SiCallEnumIpTable(s, f, hubname, &tmp); + + AdjoinRpcEnumIpTable(t, &tmp); + FreeRpcEnumIpTable(&tmp); + } + } + } + UnlockList(s->FarmMemberList); + } + + return ret; +} + +// Delete MAC address table entry +UINT StDeleteMacTable(ADMIN *a, RPC_DELETE_TABLE *t) +{ + SERVER *s = a->Server; + CEDAR *c = s->Cedar; + HUB *h = NULL; + UINT ret = ERR_NO_ERROR; + + CHECK_RIGHT; + + LockHubList(c); + { + h = GetHub(c, t->HubName); + } + UnlockHubList(c); + + if (h == NULL) + { + return ERR_HUB_NOT_FOUND; + } + + if (a->ServerAdmin == false && GetHubAdminOption(h, "no_delete_mactable") != 0) + { + ReleaseHub(h); + return ERR_NOT_ENOUGH_RIGHT; + } + + LockHashList(h->MacHashTable); + { + if (IsInHashListKey(h->MacHashTable, t->Key)) + { + MAC_TABLE_ENTRY *e = HashListKeyToPointer(h->MacHashTable, t->Key); + DeleteHash(h->MacHashTable, e); + Free(e); + } + else + { + ret = ERR_OBJECT_NOT_FOUND; + } + } + UnlockHashList(h->MacHashTable); + + if (ret == ERR_OBJECT_NOT_FOUND) + { + if (s->ServerType == SERVER_TYPE_FARM_CONTROLLER) + { + UINT i; + LockList(s->FarmMemberList); + { + for (i = 0;i < LIST_NUM(s->FarmMemberList);i++) + { + FARM_MEMBER *f = LIST_DATA(s->FarmMemberList, i); + if (f->Me == false) + { + SiCallDeleteMacTable(s, f, t->HubName, t->Key); + ret = ERR_NO_ERROR; + } + } + } + UnlockList(s->FarmMemberList); + } + } + + ReleaseHub(h); + + return ret; +} + +// Get local MAC address table +UINT SiEnumMacTable(SERVER *s, char *hubname, RPC_ENUM_MAC_TABLE *t) +{ + CEDAR *c; + UINT i; + HUB *h = NULL; + // Validate arguments + if (s == NULL || hubname == NULL || t == NULL) + { + return ERR_INTERNAL_ERROR; + } + + c = s->Cedar; + + LockHubList(c); + { + h = GetHub(c, hubname); + } + UnlockHubList(c); + + if (h == NULL) + { + return ERR_HUB_NOT_FOUND; + } + + StrCpy(t->HubName, sizeof(t->HubName), hubname); + + LockHashList(h->MacHashTable); + { + MAC_TABLE_ENTRY **pp = (MAC_TABLE_ENTRY **)HashListToArray(h->MacHashTable, &t->NumMacTable); + t->MacTables = ZeroMalloc(sizeof(RPC_ENUM_MAC_TABLE_ITEM) * t->NumMacTable); + + for (i = 0;i < t->NumMacTable;i++) + { + RPC_ENUM_MAC_TABLE_ITEM *e = &t->MacTables[i]; + MAC_TABLE_ENTRY *mac = pp[i]; + + e->Key = POINTER_TO_KEY(mac); + StrCpy(e->SessionName, sizeof(e->SessionName), mac->Session->Name); + Copy(e->MacAddress, mac->MacAddress, sizeof(e->MacAddress)); + e->CreatedTime = TickToTime(mac->CreatedTime); + e->UpdatedTime = TickToTime(mac->UpdatedTime); + e->VlanId = mac->VlanId; + + GetMachineName(e->RemoteHostname, sizeof(e->RemoteHostname)); + } + + Free(pp); + } + UnlockHashList(h->MacHashTable); + + ReleaseHub(h); + + return ERR_NO_ERROR; +} + +// Get MAC address table +UINT StEnumMacTable(ADMIN *a, RPC_ENUM_MAC_TABLE *t) +{ + SERVER *s = a->Server; + CEDAR *c = s->Cedar; + HUB *h = NULL; + UINT ret = ERR_NO_ERROR; + char hubname[MAX_HUBNAME_LEN + 1]; + UINT i; + + CHECK_RIGHT; + + // Get local MAC address table + StrCpy(hubname, sizeof(hubname), t->HubName); + FreeRpcEnumMacTable(t); + Zero(t, sizeof(RPC_ENUM_MAC_TABLE)); + + ret = SiEnumMacTable(s, hubname, t); + if (ret != ERR_NO_ERROR) + { + return ret; + } + + if (s->ServerType == SERVER_TYPE_FARM_CONTROLLER) + { + // Get remote MAC address table + LockList(s->FarmMemberList); + { + for (i = 0;i < LIST_NUM(s->FarmMemberList);i++) + { + FARM_MEMBER *f = LIST_DATA(s->FarmMemberList, i); + if (f->Me == false) + { + RPC_ENUM_MAC_TABLE tmp; + + Zero(&tmp, sizeof(tmp)); + + SiCallEnumMacTable(s, f, hubname, &tmp); + + AdjoinRpcEnumMacTable(t, &tmp); + FreeRpcEnumMacTable(&tmp); + } + } + } + UnlockList(s->FarmMemberList); + } + + return ret; +} + +// Delete a session +UINT StDeleteSession(ADMIN *a, RPC_DELETE_SESSION *t) +{ + SERVER *s = a->Server; + CEDAR *c = s->Cedar; + HUB *h = NULL; + UINT ret = ERR_NO_ERROR; + char hubname[MAX_HUBNAME_LEN + 1]; + char name[MAX_SESSION_NAME_LEN + 1]; + SESSION *sess; + + if (IsEmptyStr(t->Name)) + { + return ERR_INVALID_PARAMETER; + } + + StrCpy(hubname, sizeof(hubname), t->HubName); + StrCpy(name, sizeof(name), t->Name); + + CHECK_RIGHT; + + LockHubList(c); + { + h = GetHub(c, t->HubName); + } + UnlockHubList(c); + + if (h == NULL) + { + return ERR_HUB_NOT_FOUND; + } + + if (a->ServerAdmin == false && GetHubAdminOption(h, "no_disconnect_session") != 0) + { + ReleaseHub(h); + return ERR_NOT_ENOUGH_RIGHT; + } + + sess = GetSessionByName(h, name); + + if (sess == NULL) + { + if (s->ServerType == SERVER_TYPE_FARM_CONTROLLER) + { + // Cluster controller + UINT i; + LockList(s->FarmMemberList); + { + for (i = 0;i < LIST_NUM(s->FarmMemberList);i++) + { + FARM_MEMBER *f = LIST_DATA(s->FarmMemberList, i); + if (f->Me == false) + { + // Try to disconnect + SiCallDeleteSession(s, f, t->HubName, t->Name); + } + } + } + UnlockList(s->FarmMemberList); + } + else + { + ret = ERR_OBJECT_NOT_FOUND; + } + } + else + { + if (sess->LinkModeServer) + { + ret = ERR_LINK_CANT_DISCONNECT; + } + else if (sess->SecureNATMode) + { + ret = ERR_SNAT_CANT_DISCONNECT; + } + else if (sess->BridgeMode) + { + ret = ERR_BRIDGE_CANT_DISCONNECT; + } + else if (sess->L3SwitchMode) + { + ret = ERR_LAYER3_CANT_DISCONNECT; + } + else + { + StopSession(sess); + } + ReleaseSession(sess); + } + + if (ret != ERR_NO_ERROR) + { + ALog(a, h, "LA_DELETE_SESSION", t->Name); + } + + ReleaseHub(h); + + return ret; +} + +// Get session status +UINT StGetSessionStatus(ADMIN *a, RPC_SESSION_STATUS *t) +{ + SERVER *s = a->Server; + CEDAR *c = s->Cedar; + HUB *h = NULL; + UINT ret = ERR_NO_ERROR; + char hubname[MAX_HUBNAME_LEN + 1]; + char name[MAX_SESSION_NAME_LEN + 1]; + SESSION *sess; + + StrCpy(hubname, sizeof(hubname), t->HubName); + StrCpy(name, sizeof(name), t->Name); + + if (IsEmptyStr(t->Name)) + { + return ERR_INVALID_PARAMETER; + } + + CHECK_RIGHT; + + LockHubList(c); + { + h = GetHub(c, t->HubName); + } + UnlockHubList(c); + + if (h == NULL) + { + return ERR_HUB_NOT_FOUND; + } + + if (a->ServerAdmin == false && GetHubAdminOption(h, "no_query_session") != 0) + { + ReleaseHub(h); + return ERR_NOT_ENOUGH_RIGHT; + } + + FreeRpcSessionStatus(t); + Zero(t, sizeof(RPC_SESSION_STATUS)); + StrCpy(t->HubName, sizeof(t->HubName), hubname); + StrCpy(t->Name, sizeof(t->Name), name); + + sess = GetSessionByName(h, t->Name); + + if (sess == NULL) + { + if (s->ServerType != SERVER_TYPE_FARM_CONTROLLER) + { + // Session is not found + ret = ERR_OBJECT_NOT_FOUND; + } + else + { + UINT i; + // Try to find the session on other cluster member + LockList(s->FarmMemberList); + { + for (i = 0;i < LIST_NUM(s->FarmMemberList);i++) + { + FARM_MEMBER *f = LIST_DATA(s->FarmMemberList, i); + if (f->Me == false) + { + RPC_SESSION_STATUS tmp; + Zero(&tmp, sizeof(tmp)); + StrCpy(tmp.HubName, sizeof(tmp.HubName), t->HubName); + StrCpy(tmp.Name, sizeof(tmp.Name), t->Name); + + if (SiCallGetSessionStatus(s, f, &tmp)) + { + if (StrLen(tmp.HubName) != 0) + { + // Success to get session status + Copy(t, &tmp, sizeof(RPC_SESSION_STATUS)); + break; + } + else + { + FreeRpcSessionStatus(&tmp); + } + } + } + } + + if (i == LIST_NUM(s->FarmMemberList)) + { + // not found after all + // + ret = ERR_OBJECT_NOT_FOUND; + } + } + UnlockList(s->FarmMemberList); + } + } + else + { + SESSION *s = sess; + + Lock(s->lock); + { + StrCpy(t->Username, sizeof(t->Username), s->Username); + StrCpy(t->RealUsername, sizeof(t->RealUsername), s->UserNameReal); + StrCpy(t->GroupName, sizeof(t->GroupName), s->GroupName); + Copy(&t->NodeInfo, &s->NodeInfo, sizeof(NODE_INFO)); + + if (s->Connection != NULL) + { + t->ClientIp = IPToUINT(&s->Connection->ClientIp); + if (IsIP6(&s->Connection->ClientIp)) + { + Copy(&t->ClientIp6, &s->Connection->ClientIp.ipv6_addr, sizeof(t->ClientIp6)); + } + + CopyIP(&t->ClientIpAddress, &s->Connection->ClientIp); + + StrCpy(t->ClientHostName, sizeof(t->ClientHostName), s->Connection->ClientHostname); + } + } + Unlock(s->lock); + + CiGetSessionStatus(&t->Status, s); + + ReleaseSession(s); + } + + ReleaseHub(h); + + return ret; +} + +// Main routine of session enumeration +void SiEnumSessionMain(SERVER *s, RPC_ENUM_SESSION *t) +{ + char hubname[MAX_HUBNAME_LEN + 1]; + UINT ret = ERR_NO_ERROR; + UINT num; + UINT i; + // Validate arguments + if (s == NULL || t == NULL) + { + return; + } + + StrCpy(hubname, sizeof(hubname), t->HubName); + + FreeRpcEnumSession(t); + Zero(t, sizeof(RPC_ENUM_SESSION)); + StrCpy(t->HubName, sizeof(t->HubName), hubname); + + // Local session enumeration + num = 0; + SiEnumLocalSession(s, hubname, t); + + if (s->ServerType == SERVER_TYPE_FARM_CONTROLLER) + { + LIST *fm_list; + + fm_list = NewListFast(NULL); + + // Remote session enumeration + LockList(s->FarmMemberList); + { + while (true) + { + bool escape = true; + + for (i = 0;i < LIST_NUM(s->FarmMemberList);i++) + { + FARM_MEMBER *f = LIST_DATA(s->FarmMemberList, i); + + if (IsInList(fm_list, f) == false) + { + Add(fm_list, f); + escape = false; + + if (f->Me == false) + { + RPC_ENUM_SESSION tmp; + + Zero(&tmp, sizeof(tmp)); + + SiCallEnumSession(s, f, hubname, &tmp); + + AdjoinRpcEnumSession(t, &tmp); + FreeRpcEnumSession(&tmp); + } + + break; + } + } + + if (escape) + { + break; + } + + UnlockList(s->FarmMemberList); + LockList(s->FarmMemberList); + } + } + UnlockList(s->FarmMemberList); + + ReleaseList(fm_list); + } +} + +// Enumerate sessions +UINT StEnumSession(ADMIN *a, RPC_ENUM_SESSION *t) +{ + SERVER *s = a->Server; + CEDAR *c = s->Cedar; + HUB *h = NULL; + UINT ret = ERR_NO_ERROR; + + CHECK_RIGHT; + + LockHubList(c); + { + h = GetHub(c, t->HubName); + } + UnlockHubList(c); + + if (h == NULL) + { + return ERR_HUB_NOT_FOUND; + } + + if (a->ServerAdmin == false && GetHubAdminOption(h, "no_enum_session") != 0) + { + ReleaseHub(h); + return ERR_NOT_ENOUGH_RIGHT; + } + + SiEnumSessionMain(s, t); + + ReleaseHub(h); + + return ret; +} + +// Enumerate groups +UINT StEnumGroup(ADMIN *a, RPC_ENUM_GROUP *t) +{ + SERVER *s = a->Server; + CEDAR *c = s->Cedar; + HUB *h = NULL; + UINT ret = ERR_NO_ERROR; + char hubname[MAX_HUBNAME_LEN + 1]; + + StrCpy(hubname, sizeof(hubname), t->HubName); + + CHECK_RIGHT; + + NO_SUPPORT_FOR_BRIDGE; + if (s->ServerType == SERVER_TYPE_FARM_MEMBER) + { + return ERR_NOT_SUPPORTED; + } + + + LockHubList(c); + { + h = GetHub(c, t->HubName); + } + UnlockHubList(c); + + if (h == NULL) + { + return ERR_HUB_NOT_FOUND; + } + + AcLock(h); + { + UINT i, j; + + FreeRpcEnumGroup(t); + Zero(t, sizeof(RPC_ENUM_GROUP)); + StrCpy(t->HubName, sizeof(t->HubName), hubname); + + t->NumGroup = LIST_NUM(h->HubDb->GroupList); + t->Groups = ZeroMalloc(sizeof(RPC_ENUM_GROUP_ITEM) * t->NumGroup); + + for (i = 0;i < t->NumGroup;i++) + { + RPC_ENUM_GROUP_ITEM *e = &t->Groups[i]; + USERGROUP *g = LIST_DATA(h->HubDb->GroupList, i); + + Lock(g->lock); + { + StrCpy(e->Name, sizeof(e->Name), g->Name); + UniStrCpy(e->Realname, sizeof(e->Realname), g->RealName); + UniStrCpy(e->Note, sizeof(e->Note), g->Note); + if (g->Policy != NULL) + { + if (g->Policy->Access == false) + { + e->DenyAccess = true; + } + } + } + Unlock(g->lock); + + e->NumUsers = 0; + + + LockList(h->HubDb->UserList); + { + for (j = 0;j < LIST_NUM(h->HubDb->UserList);j++) + { + USER *u = LIST_DATA(h->HubDb->UserList, j); + + Lock(u->lock); + { + if (u->Group == g) + { + e->NumUsers++; + } + } + Unlock(u->lock); + } + } + UnlockList(h->HubDb->UserList); + } + } + AcUnlock(h); + + ReleaseHub(h); + + return ERR_NO_ERROR; +} + +// Delete a group +UINT StDeleteGroup(ADMIN *a, RPC_DELETE_USER *t) +{ + SERVER *s = a->Server; + CEDAR *c = s->Cedar; + HUB *h = NULL; + UINT ret = ERR_NO_ERROR; + + if (IsEmptyStr(t->Name) || IsSafeStr(t->Name) == false) + { + return ERR_INVALID_PARAMETER; + } + + CHECK_RIGHT; + + NO_SUPPORT_FOR_BRIDGE; + if (s->ServerType == SERVER_TYPE_FARM_MEMBER) + { + return ERR_NOT_SUPPORTED; + } + + LockHubList(c); + { + h = GetHub(c, t->HubName); + } + UnlockHubList(c); + + if (h == NULL) + { + return ERR_HUB_NOT_FOUND; + } + + if (a->ServerAdmin == false && GetHubAdminOption(h, "no_change_groups") != 0) + { + ReleaseHub(h); + return ERR_NOT_ENOUGH_RIGHT; + } + + AcLock(h); + { + if (AcDeleteGroup(h, t->Name) == false) + { + ret = ERR_OBJECT_NOT_FOUND; + } + } + AcUnlock(h); + + if (ret == ERR_NO_ERROR) + { + ALog(a, h, "LA_DELETE_GROUP", t->Name); + } + + ReleaseHub(h); + + IncrementServerConfigRevision(s); + + return ret; +} + +// Get group information +UINT StGetGroup(ADMIN *a, RPC_SET_GROUP *t) +{ + SERVER *s = a->Server; + CEDAR *c = s->Cedar; + HUB *h = NULL; + UINT ret = ERR_NO_ERROR; + char hubname[MAX_HUBNAME_LEN + 1]; + + if (IsEmptyStr(t->Name) || IsSafeStr(t->Name) == false) + { + return ERR_INVALID_PARAMETER; + } + + CHECK_RIGHT; + NO_SUPPORT_FOR_BRIDGE; + if (s->ServerType == SERVER_TYPE_FARM_MEMBER) + { + return ERR_NOT_SUPPORTED; + } + + StrCpy(hubname, sizeof(hubname), t->HubName); + + LockHubList(c); + { + h = GetHub(c, t->HubName); + } + UnlockHubList(c); + + if (h == NULL) + { + return ERR_HUB_NOT_FOUND; + } + + AcLock(h); + { + USERGROUP *g = AcGetGroup(h, t->Name); + + if (g == NULL) + { + ret = ERR_OBJECT_NOT_FOUND; + } + else + { + FreeRpcSetGroup(t); + Zero(t, sizeof(RPC_SET_GROUP)); + + StrCpy(t->HubName, sizeof(t->HubName), hubname); + + Lock(g->lock); + { + StrCpy(t->Name, sizeof(t->Name), g->Name); + UniStrCpy(t->Realname, sizeof(t->Realname), g->RealName); + UniStrCpy(t->Note, sizeof(t->Note), g->Note); + Copy(&t->Traffic, g->Traffic, sizeof(TRAFFIC)); + } + Unlock(g->lock); + + t->Policy = GetGroupPolicy(g); + + ReleaseGroup(g); + } + } + AcUnlock(h); + + ReleaseHub(h); + + return ret; +} + +// Set group setting +UINT StSetGroup(ADMIN *a, RPC_SET_GROUP *t) +{ + SERVER *s = a->Server; + CEDAR *c = s->Cedar; + HUB *h = NULL; + UINT ret = ERR_NO_ERROR; + + if (IsEmptyStr(t->Name) || IsSafeStr(t->Name) == false) + { + return ERR_INVALID_PARAMETER; + } + + CHECK_RIGHT; + NO_SUPPORT_FOR_BRIDGE; + if (s->ServerType == SERVER_TYPE_FARM_MEMBER) + { + return ERR_NOT_SUPPORTED; + } + + LockHubList(c); + { + h = GetHub(c, t->HubName); + } + UnlockHubList(c); + + if (h == NULL) + { + return ERR_HUB_NOT_FOUND; + } + + if (a->ServerAdmin == false && GetHubAdminOption(h, "no_change_groups") != 0) + { + ReleaseHub(h); + return ERR_NOT_ENOUGH_RIGHT; + } + + AcLock(h); + { + USERGROUP *g = AcGetGroup(h, t->Name); + if (g == NULL) + { + ret = ERR_OBJECT_NOT_FOUND; + } + else + { + Lock(g->lock); + { + Free(g->RealName); + Free(g->Note); + g->RealName = UniCopyStr(t->Realname); + g->Note = UniCopyStr(t->Note); + } + Unlock(g->lock); + + SetGroupPolicy(g, t->Policy); + + ReleaseGroup(g); + + ALog(a, h, "LA_SET_GROUP", t->Name); + } + } + AcUnlock(h); + + ReleaseHub(h); + + IncrementServerConfigRevision(s); + + return ret; +} + +// Create a group +UINT StCreateGroup(ADMIN *a, RPC_SET_GROUP *t) +{ + SERVER *s = a->Server; + CEDAR *c = s->Cedar; + HUB *h = NULL; + UINT ret = ERR_NO_ERROR; + + if (IsEmptyStr(t->Name) || IsSafeStr(t->Name) == false) + { + return ERR_INVALID_PARAMETER; + } + + if (s->ServerType == SERVER_TYPE_FARM_MEMBER) + { + return ERR_NOT_FARM_CONTROLLER; + } + + CHECK_RIGHT; + + NO_SUPPORT_FOR_BRIDGE; + if (s->ServerType == SERVER_TYPE_FARM_MEMBER) + { + return ERR_NOT_SUPPORTED; + } + + LockHubList(c); + { + h = GetHub(c, t->HubName); + } + UnlockHubList(c); + + if (h == NULL) + { + return ERR_HUB_NOT_FOUND; + } + + if (a->ServerAdmin == false && GetHubAdminOption(h, "no_change_groups") != 0) + { + ReleaseHub(h); + return ERR_NOT_ENOUGH_RIGHT; + } + + AcLock(h); + { + if (AcIsGroup(h, t->Name)) + { + ret = ERR_GROUP_ALREADY_EXISTS; + } + else + { + USERGROUP *g = NewGroup(t->Name, t->Realname, t->Note); + SetGroupPolicy(g, t->Policy); + + if ((LIST_NUM(h->HubDb->GroupList) >= GetServerCapsInt(a->Server, "i_max_users_per_hub")) || + ((GetHubAdminOption(h, "max_groups") != 0) && (LIST_NUM(h->HubDb->GroupList) >= GetHubAdminOption(h, "max_groups")))) + { + ret = ERR_TOO_MANY_GROUP; + } + else + { + AcAddGroup(h, g); + } + + ReleaseGroup(g); + + ALog(a, h, "LA_CREATE_GROUP", t->Name); + } + } + AcUnlock(h); + + ReleaseHub(h); + + IncrementServerConfigRevision(s); + + return ret; +} + +// Enumerate users +UINT StEnumUser(ADMIN *a, RPC_ENUM_USER *t) +{ + SERVER *s = a->Server; + CEDAR *c = s->Cedar; + HUB *h = NULL; + UINT ret = ERR_NO_ERROR; + char hubname[MAX_HUBNAME_LEN + 1]; + UINT i, num; + + CHECK_RIGHT; + NO_SUPPORT_FOR_BRIDGE; + if (s->ServerType == SERVER_TYPE_FARM_MEMBER) + { + return ERR_NOT_SUPPORTED; + } + + LockHubList(c); + { + h = GetHub(c, t->HubName); + } + UnlockHubList(c); + + if (h == NULL) + { + return ERR_HUB_NOT_FOUND; + } + + FreeRpcEnumUser(t); + + StrCpy(hubname, sizeof(hubname), t->HubName); + + Zero(t, sizeof(RPC_ENUM_USER)); + StrCpy(t->HubName, sizeof(t->HubName), hubname); + + LockList(h->HubDb->UserList); + { + num = LIST_NUM(h->HubDb->UserList); + + t->NumUser = num; + t->Users = ZeroMalloc(sizeof(RPC_ENUM_USER_ITEM) * num); + + for (i = 0;i < num;i++) + { + USER *u = LIST_DATA(h->HubDb->UserList, i); + + Lock(u->lock); + { + RPC_ENUM_USER_ITEM *e = &t->Users[i]; + + StrCpy(e->Name, sizeof(e->Name), u->Name); + StrCpy(e->GroupName, sizeof(e->GroupName), u->GroupName); + UniStrCpy(e->Realname, sizeof(e->Realname), u->RealName); + UniStrCpy(e->Note, sizeof(e->Note), u->Note); + e->AuthType = u->AuthType; + e->LastLoginTime = u->LastLoginTime; + e->NumLogin = u->NumLogin; + + if (u->Policy != NULL) + { + e->DenyAccess = u->Policy->Access ? false : true; + } + + Copy(&e->Traffic, u->Traffic, sizeof(TRAFFIC)); + e->IsTrafficFilled = true; + + e->Expires = u->ExpireTime; + e->IsExpiresFilled = true; + } + Unlock(u->lock); + } + } + UnlockList(h->HubDb->UserList); + + ReleaseHub(h); + + IncrementServerConfigRevision(s); + + return ERR_NO_ERROR; +} + +// Delete a user +UINT StDeleteUser(ADMIN *a, RPC_DELETE_USER *t) +{ + SERVER *s = a->Server; + CEDAR *c = s->Cedar; + HUB *h = NULL; + UINT ret = ERR_NO_ERROR; + + + if (IsEmptyStr(t->Name) || IsUserName(t->Name) == false) + { + return ERR_INVALID_PARAMETER; + } + + CHECK_RIGHT; + NO_SUPPORT_FOR_BRIDGE; + if (s->ServerType == SERVER_TYPE_FARM_MEMBER) + { + return ERR_NOT_SUPPORTED; + } + + LockHubList(c); + { + h = GetHub(c, t->HubName); + } + UnlockHubList(c); + + if (h == NULL) + { + return ERR_HUB_NOT_FOUND; + } + + if (a->ServerAdmin == false && GetHubAdminOption(h, "no_change_users") != 0) + { + ReleaseHub(h); + return ERR_NOT_ENOUGH_RIGHT; + } + + ALog(a, h, "LA_DELETE_USER", t->Name); + + AcLock(h); + { + if (AcDeleteUser(h, t->Name) == false) + { + ret = ERR_OBJECT_NOT_FOUND; + } + } + AcUnlock(h); + + ReleaseHub(h); + + IncrementServerConfigRevision(s); + + return ret; +} + +// Get user setting +UINT StGetUser(ADMIN *a, RPC_SET_USER *t) +{ + SERVER *s = a->Server; + CEDAR *c = s->Cedar; + HUB *h = NULL; + UINT ret = ERR_NO_ERROR; + USER *u = NULL; + USERGROUP *g = NULL; + char name[MAX_USERNAME_LEN + 1]; + char hubname[MAX_HUBNAME_LEN + 1]; + StrCpy(name, sizeof(name), t->Name); + StrCpy(hubname, sizeof(hubname), t->HubName); + + if (IsEmptyStr(t->Name) || IsUserName(t->Name) == false) + { + return ERR_INVALID_PARAMETER; + } + + CHECK_RIGHT; + NO_SUPPORT_FOR_BRIDGE; + if (s->ServerType == SERVER_TYPE_FARM_MEMBER) + { + return ERR_NOT_SUPPORTED; + } + + FreeRpcSetUser(t); + Zero(t, sizeof(RPC_SET_USER)); + StrCpy(t->HubName, sizeof(t->HubName), hubname); + StrCpy(t->Name, sizeof(t->Name), name); + + LockHubList(c); + { + h = GetHub(c, hubname); + } + UnlockHubList(c); + + if (h == NULL) + { + return ERR_HUB_NOT_FOUND; + } + + AcLock(h); + { + u = AcGetUser(h, name); + if (u == NULL) + { + ret = ERR_OBJECT_NOT_FOUND; + } + else + { + Lock(u->lock); + { + StrCpy(t->GroupName, sizeof(t->GroupName), u->GroupName); + UniStrCpy(t->Realname, sizeof(t->Realname), u->RealName); + UniStrCpy(t->Note, sizeof(t->Note), u->Note); + t->CreatedTime = u->CreatedTime; + t->UpdatedTime = u->UpdatedTime; + t->ExpireTime = u->ExpireTime; + + t->AuthType = u->AuthType; + t->AuthData = CopyAuthData(u->AuthData, t->AuthType); + t->NumLogin = u->NumLogin; + Copy(&t->Traffic, u->Traffic, sizeof(TRAFFIC)); + if (u->Policy != NULL) + { + t->Policy = ClonePolicy(u->Policy); + } + } + Unlock(u->lock); + + ReleaseUser(u); + } + } + AcUnlock(h); + + ReleaseHub(h); + + return ret; +} + +// Set user setting +UINT StSetUser(ADMIN *a, RPC_SET_USER *t) +{ + SERVER *s = a->Server; + CEDAR *c = s->Cedar; + HUB *h = NULL; + UINT ret = ERR_NO_ERROR; + USER *u = NULL; + USERGROUP *g = NULL; + + + if (IsEmptyStr(t->Name) || IsUserName(t->Name) == false) + { + return ERR_INVALID_PARAMETER; + } + + NO_SUPPORT_FOR_BRIDGE; + if (s->ServerType == SERVER_TYPE_FARM_MEMBER) + { + return ERR_NOT_SUPPORTED; + } + + CHECK_RIGHT; + + if (GetGlobalServerFlag(GSF_DISABLE_RADIUS_AUTH) != 0) + { + if (t->AuthType == AUTHTYPE_USERCERT || t->AuthType == AUTHTYPE_RADIUS || t->AuthType == AUTHTYPE_ROOTCERT || t->AuthType == AUTHTYPE_NT) + { + return ERR_NOT_SUPPORTED_AUTH_ON_OPENSOURCE; + } + } + + if (StrCmpi(t->Name, "*") == 0) + { + if (t->AuthType != AUTHTYPE_RADIUS && t->AuthType != AUTHTYPE_NT) + { + return ERR_INVALID_PARAMETER; + } + } + + if (t->AuthType == AUTHTYPE_USERCERT) + { + AUTHUSERCERT *c = t->AuthData; + if (c != NULL && c->UserX != NULL && + c->UserX->is_compatible_bit == false) + { + return ERR_NOT_RSA_1024; + } + if (c == NULL || c->UserX == NULL) + { + return ERR_INVALID_PARAMETER; + } + } + + LockHubList(c); + { + h = GetHub(c, t->HubName); + } + UnlockHubList(c); + + if (h == NULL) + { + return ERR_HUB_NOT_FOUND; + } + + if (a->ServerAdmin == false && GetHubAdminOption(h, "no_change_users") != 0) + { + ReleaseHub(h); + return ERR_NOT_ENOUGH_RIGHT; + } + + AcLock(h); + { + u = AcGetUser(h, t->Name); + if (u == NULL) + { + ret = ERR_OBJECT_NOT_FOUND; + } + else + { + Lock(u->lock); + { + if (StrLen(t->GroupName) != 0) + { + g = AcGetGroup(h, t->GroupName); + + if (g != NULL) + { + JoinUserToGroup(u, g); + ReleaseGroup(g); + } + else + { + ret = ERR_GROUP_NOT_FOUND; + } + } + else + { + JoinUserToGroup(u, NULL); + } + + if (ret != ERR_GROUP_NOT_FOUND) + { + Free(u->RealName); + Free(u->Note); + u->RealName = UniCopyStr(t->Realname); + u->Note = UniCopyStr(t->Note); + SetUserAuthData(u, t->AuthType, CopyAuthData(t->AuthData, t->AuthType)); + u->ExpireTime = t->ExpireTime; + u->UpdatedTime = SystemTime64(); + + SetUserPolicy(u, t->Policy); + } + } + Unlock(u->lock); + + IncrementServerConfigRevision(s); + + ReleaseUser(u); + } + } + AcUnlock(h); + + if (ret == ERR_NO_ERROR) + { + ALog(a, h, "LA_SET_USER", t->Name); + } + + ReleaseHub(h); + + return ret; +} + +// Create a user +UINT StCreateUser(ADMIN *a, RPC_SET_USER *t) +{ + SERVER *s = a->Server; + CEDAR *c = s->Cedar; + HUB *h = NULL; + UINT ret = ERR_NO_ERROR; + USER *u; + USERGROUP *g = NULL; + + + if (IsEmptyStr(t->Name) || IsUserName(t->Name) == false) + { + return ERR_INVALID_PARAMETER; + } + + NO_SUPPORT_FOR_BRIDGE; + if (s->ServerType == SERVER_TYPE_FARM_MEMBER) + { + return ERR_NOT_SUPPORTED; + } + + CHECK_RIGHT; + + if (GetGlobalServerFlag(GSF_DISABLE_RADIUS_AUTH) != 0) + { + if (t->AuthType == AUTHTYPE_USERCERT || t->AuthType == AUTHTYPE_RADIUS || t->AuthType == AUTHTYPE_ROOTCERT || t->AuthType == AUTHTYPE_NT) + { + return ERR_NOT_SUPPORTED_AUTH_ON_OPENSOURCE; + } + } + + if (t->AuthType == AUTHTYPE_USERCERT) + { + AUTHUSERCERT *c = t->AuthData; + if (c != NULL && c->UserX != NULL && + c->UserX->is_compatible_bit == false) + { + return ERR_NOT_RSA_1024; + } + if (c == NULL || c->UserX == NULL) + { + return ERR_INVALID_PARAMETER; + } + } + + if (IsUserName(t->Name) == false) + { + return ERR_INVALID_PARAMETER; + } + + if (StrCmpi(t->Name, "*") == 0) + { + if (t->AuthType != AUTHTYPE_RADIUS && t->AuthType != AUTHTYPE_NT) + { + return ERR_INVALID_PARAMETER; + } + } + + LockHubList(c); + { + h = GetHub(c, t->HubName); + } + UnlockHubList(c); + + if (h == NULL) + { + return ERR_HUB_NOT_FOUND; + } + + if (a->ServerAdmin == false && GetHubAdminOption(h, "no_change_users") != 0) + { + ReleaseHub(h); + return ERR_NOT_ENOUGH_RIGHT; + } + + u = NewUser(t->Name, t->Realname, t->Note, t->AuthType, CopyAuthData(t->AuthData, t->AuthType)); + if (u == NULL) + { + ReleaseHub(h); + return ERR_INTERNAL_ERROR; + } + + u->ExpireTime = t->ExpireTime; + + SetUserPolicy(u, t->Policy); + + AcLock(h); + { + if ((LIST_NUM(h->HubDb->UserList) >= GetServerCapsInt(a->Server, "i_max_users_per_hub")) || + ((GetHubAdminOption(h, "max_users") != 0) && (LIST_NUM(h->HubDb->UserList) >= GetHubAdminOption(h, "max_users")))) + { + ret = ERR_TOO_MANY_USER; + } + else if (SiTooManyUserObjectsInServer(s, false)) + { + ret = ERR_TOO_MANY_USERS_CREATED; + ALog(a, h, "ERR_128"); + } + else if (AcIsUser(h, t->Name)) + { + ret = ERR_USER_ALREADY_EXISTS; + } + else + { + if (StrLen(t->GroupName) != 0) + { + g = AcGetGroup(h, t->GroupName); + if (g == NULL) + { + ret = ERR_GROUP_NOT_FOUND; + } + } + + if (ret != ERR_GROUP_NOT_FOUND) + { + if (g != NULL) + { + JoinUserToGroup(u, g); + ReleaseGroup(g); + } + + AcAddUser(h, u); + ALog(a, h, "LA_CREATE_USER", t->Name); + + IncrementServerConfigRevision(s); + } + } + } + AcUnlock(h); + + ReleaseUser(u); + + ReleaseHub(h); + + return ret; +} + +// Get access list +UINT StEnumAccess(ADMIN *a, RPC_ENUM_ACCESS_LIST *t) +{ + SERVER *s = a->Server; + CEDAR *c = s->Cedar; + HUB *h; + UINT i; + char hubname[MAX_HUBNAME_LEN + 1]; + + CHECK_RIGHT; + NO_SUPPORT_FOR_BRIDGE; + if (s->ServerType == SERVER_TYPE_FARM_MEMBER) + { + return ERR_NOT_SUPPORTED; + } + + LockHubList(c); + { + h = GetHub(c, t->HubName); + } + UnlockHubList(c); + + if (h == NULL) + { + return ERR_HUB_NOT_FOUND; + } + + StrCpy(hubname, sizeof(hubname), t->HubName); + FreeRpcEnumAccessList(t); + Zero(t, sizeof(RPC_ENUM_ACCESS_LIST)); + StrCpy(t->HubName, sizeof(t->HubName), hubname); + + LockList(h->AccessList); + { + t->NumAccess = LIST_NUM(h->AccessList); + t->Accesses = ZeroMalloc(sizeof(ACCESS) * t->NumAccess); + + for (i = 0;i < LIST_NUM(h->AccessList);i++) + { + ACCESS *a = &t->Accesses[i]; + Copy(a, LIST_DATA(h->AccessList, i), sizeof(ACCESS)); + a->UniqueId = HashPtrToUINT(LIST_DATA(h->AccessList, i)); + } + } + UnlockList(h->AccessList); + + ReleaseHub(h); + + return ERR_NO_ERROR; +} + +// Delete access list entry +UINT StDeleteAccess(ADMIN *a, RPC_DELETE_ACCESS *t) +{ + SERVER *s = a->Server; + CEDAR *c = s->Cedar; + HUB *h; + UINT i; + bool exists; + + + if (s->ServerType == SERVER_TYPE_FARM_MEMBER) + { + return ERR_NOT_FARM_CONTROLLER; + } + + CHECK_RIGHT; + NO_SUPPORT_FOR_BRIDGE; + + LockHubList(c); + { + h = GetHub(c, t->HubName); + } + UnlockHubList(c); + + if (h == NULL) + { + return ERR_HUB_NOT_FOUND; + } + + if (a->ServerAdmin == false && GetHubAdminOption(h, "no_change_access_list") != 0) + { + ReleaseHub(h); + return ERR_NOT_ENOUGH_RIGHT; + } + + exists = false; + + LockList(h->AccessList); + { + for (i = 0;i < LIST_NUM(h->AccessList);i++) + { + ACCESS *access = LIST_DATA(h->AccessList, i); + + if ((t->Id < MAX_ACCESSLISTS && access->Id == t->Id) || + (t->Id >= MAX_ACCESSLISTS && HashPtrToUINT(access) == t->Id)) + { + Free(access); + Delete(h->AccessList, access); + exists = true; + + break; + } + } + } + UnlockList(h->AccessList); + + if (exists == false) + { + ReleaseHub(h); + return ERR_OBJECT_NOT_FOUND; + } + + ALog(a, h, "LA_DELETE_ACCESS"); + + IncrementServerConfigRevision(s); + + ReleaseHub(h); + + return ERR_NO_ERROR; +} + +// Set access list +UINT StSetAccessList(ADMIN *a, RPC_ENUM_ACCESS_LIST *t) +{ + SERVER *s = a->Server; + CEDAR *c = s->Cedar; + HUB *h; + UINT i; + bool no_jitter = false; + bool no_include = false; + UINT ret = ERR_NO_ERROR; + + + NO_SUPPORT_FOR_BRIDGE; + if (s->ServerType == SERVER_TYPE_FARM_MEMBER) + { + return ERR_NOT_SUPPORTED; + } + + CHECK_RIGHT; + + if (t->NumAccess > GetServerCapsInt(a->Server, "i_max_access_lists")) + { + return ERR_TOO_MANY_ACCESS_LIST; + } + + LockHubList(c); + { + h = GetHub(c, t->HubName); + } + UnlockHubList(c); + + if (h == NULL) + { + return ERR_HUB_NOT_FOUND; + } + + no_jitter = GetHubAdminOption(h, "no_delay_jitter_packet_loss"); + no_include = GetHubAdminOption(h, "no_access_list_include_file"); + + if (a->ServerAdmin == false && GetHubAdminOption(h, "no_change_access_list") != 0) + { + ReleaseHub(h); + return ERR_NOT_ENOUGH_RIGHT; + } + + if (a->ServerAdmin == false && GetHubAdminOption(h, "max_accesslists") != 0 && + t->NumAccess > GetHubAdminOption(h, "max_accesslists")) + { + ReleaseHub(h); + return ERR_TOO_MANY_ACCESS_LIST; + } + + LockList(h->AccessList); + { + UINT i; + + if (a->ClientBuild != 0) + { + // Confirm whether the access list of form which cannot handle by the old client already exists + if (a->ClientBuild < 6560) + { + for (i = 0;i < LIST_NUM(h->AccessList);i++) + { + ACCESS *access = LIST_DATA(h->AccessList, i); + if (access->IsIPv6 || + access->Jitter != 0 || access->Loss != 0 || access->Delay != 0) + { + ret = ERR_VERSION_INVALID; + break; + } + } + } + + if (a->ClientBuild < 8234) + { + for (i = 0;i < LIST_NUM(h->AccessList);i++) + { + ACCESS *access = LIST_DATA(h->AccessList, i); + + if (IsEmptyStr(access->RedirectUrl) == false) + { + ret = ERR_VERSION_INVALID; + break; + } + } + } + } + + if (ret == ERR_NO_ERROR) + { + // Delete whole access list + for (i = 0;i < LIST_NUM(h->AccessList);i++) + { + ACCESS *access = LIST_DATA(h->AccessList, i); + Free(access); + } + + DeleteAll(h->AccessList); + } + } + + if (ret == ERR_NO_ERROR) + { + ALog(a, h, "LA_SET_ACCESS_LIST", t->NumAccess); + + // Add whole access list + for (i = 0;i < t->NumAccess;i++) + { + ACCESS *a = &t->Accesses[i]; + + if (no_jitter) + { + a->Jitter = a->Loss = a->Delay = 0; + } + + if (no_include) + { + if (StartWith(a->SrcUsername, ACCESS_LIST_INCLUDED_PREFIX) || + StartWith(a->SrcUsername, ACCESS_LIST_EXCLUDED_PREFIX)) + { + ClearStr(a->SrcUsername, sizeof(a->SrcUsername)); + } + + if (StartWith(a->DestUsername, ACCESS_LIST_INCLUDED_PREFIX) || + StartWith(a->DestUsername, ACCESS_LIST_EXCLUDED_PREFIX)) + { + ClearStr(a->DestUsername, sizeof(a->DestUsername)); + } + } + + if (i == (t->NumAccess - 1)) + { + Sort(h->AccessList); + } + + AddAccessListEx(h, a, ((i != (t->NumAccess - 1)) ? true : false), ((i != (t->NumAccess - 1)) ? true : false)); + } + + UnlockList(h->AccessList); + + IncrementServerConfigRevision(s); + + h->CurrentVersion++; + SiHubUpdateProc(h); + } + else + { + UnlockList(h->AccessList); + } + + ReleaseHub(h); + + return ret; +} + +// Add access list entry +UINT StAddAccess(ADMIN *a, RPC_ADD_ACCESS *t) +{ + SERVER *s = a->Server; + CEDAR *c = s->Cedar; + HUB *h; + bool no_jitter = false; + bool no_include = false; + + + NO_SUPPORT_FOR_BRIDGE; + if (s->ServerType == SERVER_TYPE_FARM_MEMBER) + { + return ERR_NOT_SUPPORTED; + } + + CHECK_RIGHT; + + LockHubList(c); + { + h = GetHub(c, t->HubName); + } + UnlockHubList(c); + + if (h == NULL) + { + return ERR_HUB_NOT_FOUND; + } + + no_jitter = GetHubAdminOption(h, "no_delay_jitter_packet_loss"); + no_include = GetHubAdminOption(h, "no_access_list_include_file"); + + if (a->ServerAdmin == false && GetHubAdminOption(h, "no_change_access_list") != 0) + { + ReleaseHub(h); + return ERR_NOT_ENOUGH_RIGHT; + } + + if ((LIST_NUM(h->AccessList) >= GetServerCapsInt(a->Server, "i_max_access_lists") || + (GetHubAdminOption(h, "max_accesslists") != 0) && (LIST_NUM(h->AccessList) >= GetHubAdminOption(h, "max_accesslists")))) + { + ReleaseHub(h); + return ERR_TOO_MANY_ACCESS_LIST; + } + + ALog(a, h, "LA_ADD_ACCESS"); + + if (no_jitter) + { + t->Access.Jitter = t->Access.Delay = t->Access.Loss = 0; + } + + if (no_include) + { + if (StartWith(t->Access.SrcUsername, ACCESS_LIST_INCLUDED_PREFIX) || + StartWith(t->Access.SrcUsername, ACCESS_LIST_EXCLUDED_PREFIX)) + { + ClearStr(t->Access.SrcUsername, sizeof(t->Access.SrcUsername)); + } + + if (StartWith(t->Access.DestUsername, ACCESS_LIST_INCLUDED_PREFIX) || + StartWith(t->Access.DestUsername, ACCESS_LIST_EXCLUDED_PREFIX)) + { + ClearStr(t->Access.DestUsername, sizeof(t->Access.DestUsername)); + } + } + + AddAccessList(h, &t->Access); + + h->CurrentVersion++; + SiHubUpdateProc(h); + + ReleaseHub(h); + + IncrementServerConfigRevision(s); + + return ERR_NO_ERROR; +} + +// Rename link (cascade connection) +UINT StRenameLink(ADMIN *a, RPC_RENAME_LINK *t) +{ + UINT i; + SERVER *s = a->Server; + CEDAR *c = s->Cedar; + HUB *h; + UINT ret = ERR_NO_ERROR; + LINK *k; + bool exists = false; + + if (UniIsEmptyStr(t->OldAccountName) || UniIsEmptyStr(t->NewAccountName)) + { + return ERR_INVALID_PARAMETER; + } + + if (s->ServerType != SERVER_TYPE_STANDALONE) + { + return ERR_NOT_SUPPORTED; + } + + CHECK_RIGHT; + + if (UniStrCmpi(t->NewAccountName, t->OldAccountName) == 0) + { + // Noop if new name is same to old name + return ERR_NO_ERROR; + } + + h = GetHub(c, t->HubName); + + if (h == NULL) + { + return ERR_HUB_NOT_FOUND; + } + + if (a->ServerAdmin == false && GetHubAdminOption(h, "no_cascade") != 0) + { + ReleaseHub(h); + return ERR_NOT_ENOUGH_RIGHT; + } + + k = NULL; + + // Find specified link + LockList(h->LinkList); + { + for (i = 0;i < LIST_NUM(h->LinkList);i++) + { + LINK *kk = LIST_DATA(h->LinkList, i); + Lock(kk->lock); + { + if (UniStrCmpi(kk->Option->AccountName, t->OldAccountName) == 0) + { + k = kk; + AddRef(kk->ref); + } + } + Unlock(kk->lock); + + if (k != NULL) + { + break; + } + } + + exists = false; + + if (k != NULL) + { + // Check whether the new link name is same to other links + for (i = 0;i < LIST_NUM(h->LinkList);i++) + { + LINK *kk = LIST_DATA(h->LinkList, i); + Lock(kk->lock); + { + if (UniStrCmpi(kk->Option->AccountName, t->NewAccountName) == 0) + { + // duplicated + exists = true; + } + } + Unlock(kk->lock); + } + + if (exists) + { + // Already same name exists + ret = ERR_LINK_ALREADY_EXISTS; + } + else + { + // Do rename + UniStrCpy(k->Option->AccountName, sizeof(k->Option->AccountName), t->NewAccountName); + + ALog(a, h, "LA_RENAME_LINK", t->OldAccountName, t->NewAccountName); + + IncrementServerConfigRevision(s); + } + } + } + UnlockList(h->LinkList); + + if (k == NULL) + { + // specified link is not found + ReleaseHub(h); + return ERR_OBJECT_NOT_FOUND; + } + + ReleaseLink(k); + + ReleaseHub(h); + + return ret; +} + +// Delete a link +UINT StDeleteLink(ADMIN *a, RPC_LINK *t) +{ + UINT i; + SERVER *s = a->Server; + CEDAR *c = s->Cedar; + HUB *h; + UINT ret = ERR_NO_ERROR; + char hubname[MAX_HUBNAME_LEN + 1]; + wchar_t accountname[MAX_ACCOUNT_NAME_LEN + 1]; + LINK *k; + + if (UniIsEmptyStr(t->AccountName)) + { + return ERR_INVALID_PARAMETER; + } + + if (s->ServerType != SERVER_TYPE_STANDALONE) + { + return ERR_NOT_SUPPORTED; + } + + CHECK_RIGHT; + + LockHubList(c); + { + h = GetHub(c, t->HubName); + } + UnlockHubList(c); + + if (h == NULL) + { + return ERR_HUB_NOT_FOUND; + } + + if (a->ServerAdmin == false && GetHubAdminOption(h, "no_cascade") != 0) + { + ReleaseHub(h); + return ERR_NOT_ENOUGH_RIGHT; + } + + StrCpy(hubname, sizeof(hubname), t->HubName); + UniStrCpy(accountname, sizeof(accountname), t->AccountName); + k = NULL; + + // Find specified link + LockList(h->LinkList); + { + for (i = 0;i < LIST_NUM(h->LinkList);i++) + { + LINK *kk = LIST_DATA(h->LinkList, i); + Lock(kk->lock); + { + if (UniStrCmpi(kk->Option->AccountName, accountname) == 0) + { + k = kk; + AddRef(kk->ref); + } + } + Unlock(kk->lock); + + if (k != NULL) + { + break; + } + } + } + UnlockList(h->LinkList); + + if (k == NULL) + { + // Specified link is not found + ReleaseHub(h); + + return ERR_OBJECT_NOT_FOUND; + } + + k->NoOnline = true; + + ALog(a, h, "LA_DELETE_LINK", t->AccountName); + + SetLinkOffline(k); + + IncrementServerConfigRevision(s); + + DelLink(h, k); + + ReleaseLink(k); + ReleaseHub(h); + + return ret; +} + +// Make a link into off-line +UINT StSetLinkOffline(ADMIN *a, RPC_LINK *t) +{ + UINT i; + SERVER *s = a->Server; + CEDAR *c = s->Cedar; + HUB *h; + UINT ret = ERR_NO_ERROR; + char hubname[MAX_HUBNAME_LEN + 1]; + wchar_t accountname[MAX_ACCOUNT_NAME_LEN + 1]; + LINK *k; + + + if (UniIsEmptyStr(t->AccountName)) + { + return ERR_INVALID_PARAMETER; + } + + if (s->ServerType != SERVER_TYPE_STANDALONE) + { + return ERR_NOT_SUPPORTED; + } + + CHECK_RIGHT; + + LockHubList(c); + { + h = GetHub(c, t->HubName); + } + UnlockHubList(c); + + if (h == NULL) + { + return ERR_HUB_NOT_FOUND; + } + + if (a->ServerAdmin == false && GetHubAdminOption(h, "no_cascade") != 0) + { + ReleaseHub(h); + return ERR_NOT_ENOUGH_RIGHT; + } + + StrCpy(hubname, sizeof(hubname), t->HubName); + UniStrCpy(accountname, sizeof(accountname), t->AccountName); + k = NULL; + + // Find specified link + LockList(h->LinkList); + { + for (i = 0;i < LIST_NUM(h->LinkList);i++) + { + LINK *kk = LIST_DATA(h->LinkList, i); + Lock(kk->lock); + { + if (UniStrCmpi(kk->Option->AccountName, accountname) == 0) + { + k = kk; + AddRef(kk->ref); + } + } + Unlock(kk->lock); + + if (k != NULL) + { + break; + } + } + } + UnlockList(h->LinkList); + + if (k == NULL) + { + // Link is not found + ReleaseHub(h); + + return ERR_OBJECT_NOT_FOUND; + } + + ALog(a, h, "LA_SET_LINK_OFFLINE", t->AccountName); + + SetLinkOffline(k); + + IncrementServerConfigRevision(s); + + ReleaseLink(k); + ReleaseHub(h); + + return ret; +} + +// Make a link into on-line +UINT StSetLinkOnline(ADMIN *a, RPC_LINK *t) +{ + UINT i; + SERVER *s = a->Server; + CEDAR *c = s->Cedar; + HUB *h; + UINT ret = ERR_NO_ERROR; + char hubname[MAX_HUBNAME_LEN + 1]; + wchar_t accountname[MAX_ACCOUNT_NAME_LEN + 1]; + LINK *k; + + + if (UniIsEmptyStr(t->AccountName)) + { + return ERR_INVALID_PARAMETER; + } + + if (s->ServerType != SERVER_TYPE_STANDALONE) + { + return ERR_NOT_SUPPORTED; + } + + CHECK_RIGHT; + + LockHubList(c); + { + h = GetHub(c, t->HubName); + } + UnlockHubList(c); + + if (h == NULL) + { + return ERR_HUB_NOT_FOUND; + } + + if (a->ServerAdmin == false && GetHubAdminOption(h, "no_cascade") != 0) + { + ReleaseHub(h); + return ERR_NOT_ENOUGH_RIGHT; + } + + StrCpy(hubname, sizeof(hubname), t->HubName); + UniStrCpy(accountname, sizeof(accountname), t->AccountName); + k = NULL; + + // Find specified link + LockList(h->LinkList); + { + for (i = 0;i < LIST_NUM(h->LinkList);i++) + { + LINK *kk = LIST_DATA(h->LinkList, i); + Lock(kk->lock); + { + if (UniStrCmpi(kk->Option->AccountName, accountname) == 0) + { + k = kk; + AddRef(kk->ref); + } + } + Unlock(kk->lock); + + if (k != NULL) + { + break; + } + } + } + UnlockList(h->LinkList); + + if (k == NULL) + { + // Specified link is not found + ReleaseHub(h); + + return ERR_OBJECT_NOT_FOUND; + } + + ALog(a, h, "LA_SET_LINK_ONLINE", t->AccountName); + + SetLinkOnline(k); + + ReleaseLink(k); + ReleaseHub(h); + + IncrementServerConfigRevision(s); + + return ret; +} + +// Get link status +UINT StGetLinkStatus(ADMIN *a, RPC_LINK_STATUS *t) +{ + UINT i; + SERVER *s = a->Server; + CEDAR *c = s->Cedar; + HUB *h; + UINT ret = ERR_NO_ERROR; + char hubname[MAX_HUBNAME_LEN + 1]; + wchar_t accountname[MAX_ACCOUNT_NAME_LEN + 1]; + LINK *k; + SESSION *sess; + + if (UniIsEmptyStr(t->AccountName)) + { + return ERR_INVALID_PARAMETER; + } + + if (s->ServerType != SERVER_TYPE_STANDALONE) + { + return ERR_NOT_SUPPORTED; + } + + CHECK_RIGHT; + + LockHubList(c); + { + h = GetHub(c, t->HubName); + } + UnlockHubList(c); + + if (h == NULL) + { + return ERR_HUB_NOT_FOUND; + } + + StrCpy(hubname, sizeof(hubname), t->HubName); + UniStrCpy(accountname, sizeof(accountname), t->AccountName); + FreeRpcLinkStatus(t); + Zero(t, sizeof(RPC_LINK_STATUS)); + StrCpy(t->HubName, sizeof(t->HubName), hubname); + UniStrCpy(t->AccountName, sizeof(t->AccountName), accountname); + + k = NULL; + + // Find the link + LockList(h->LinkList); + { + for (i = 0;i < LIST_NUM(h->LinkList);i++) + { + LINK *kk = LIST_DATA(h->LinkList, i); + Lock(kk->lock); + { + if (UniStrCmpi(kk->Option->AccountName, accountname) == 0) + { + k = kk; + AddRef(kk->ref); + } + } + Unlock(kk->lock); + + if (k != NULL) + { + break; + } + } + } + UnlockList(h->LinkList); + + if (k == NULL) + { + // Specified link is not found + ReleaseHub(h); + + return ERR_OBJECT_NOT_FOUND; + } + + // Get status information from session + Lock(k->lock); + { + sess = k->ClientSession; + if (sess != NULL) + { + AddRef(sess->ref); + } + } + Unlock(k->lock); + + if (sess != NULL && k->Offline == false) + { + CiGetSessionStatus(&t->Status, sess); + } + else + { + ret = ERR_LINK_IS_OFFLINE; + } + ReleaseSession(sess); + + ReleaseLink(k); + ReleaseHub(h); + + return ret; +} + +// Enumerate links +UINT StEnumLink(ADMIN *a, RPC_ENUM_LINK *t) +{ + SERVER *s = a->Server; + CEDAR *c = s->Cedar; + HUB *h; + char hubname[MAX_HUBNAME_LEN + 1]; + UINT i; + + if (s->ServerType != SERVER_TYPE_STANDALONE) + { + return ERR_NOT_SUPPORTED; + } + + CHECK_RIGHT; + + LockHubList(c); + { + h = GetHub(c, t->HubName); + } + UnlockHubList(c); + + if (h == NULL) + { + return ERR_HUB_NOT_FOUND; + } + + StrCpy(hubname, sizeof(hubname), t->HubName); + FreeRpcEnumLink(t); + Zero(t, sizeof(RPC_ENUM_LINK)); + StrCpy(t->HubName, sizeof(t->HubName), hubname); + + LockList(h->LinkList); + { + t->NumLink = LIST_NUM(h->LinkList); + t->Links = ZeroMalloc(sizeof(RPC_ENUM_LINK_ITEM) * t->NumLink); + + for (i = 0;i < LIST_NUM(h->LinkList);i++) + { + LINK *k = LIST_DATA(h->LinkList, i); + RPC_ENUM_LINK_ITEM *e = &t->Links[i]; + + Lock(k->lock); + { + UniStrCpy(e->AccountName, sizeof(e->AccountName), k->Option->AccountName); + StrCpy(e->Hostname, sizeof(e->Hostname), k->Option->Hostname); + StrCpy(e->HubName, sizeof(e->HubName), k->Option->HubName); + e->Online = k->Offline ? false : true; + + if (e->Online) + { + if (k->ClientSession != NULL) + { + e->ConnectedTime = TickToTime(k->ClientSession->CurrentConnectionEstablishTime); + e->Connected = (k->ClientSession->ClientStatus == CLIENT_STATUS_ESTABLISHED); + e->LastError = k->ClientSession->Err; + } + } + } + Unlock(k->lock); + } + } + UnlockList(h->LinkList); + + ReleaseHub(h); + + return ERR_NO_ERROR; +} + +// Get link configuration +UINT StGetLink(ADMIN *a, RPC_CREATE_LINK *t) +{ + SERVER *s = a->Server; + CEDAR *c = s->Cedar; + HUB *h; + UINT ret = ERR_NO_ERROR; + UINT i; + char hubname[MAX_SIZE]; + LINK *k; + + if (s->ServerType != SERVER_TYPE_STANDALONE) + { + return ERR_NOT_SUPPORTED; + } + + CHECK_RIGHT; + + if (s->ServerType != SERVER_TYPE_STANDALONE) + { + return ERR_LINK_CANT_CREATE_ON_FARM; + } + + LockHubList(c); + { + h = GetHub(c, t->HubName); + } + UnlockHubList(c); + + if (h == NULL) + { + return ERR_HUB_NOT_FOUND; + } + + k = NULL; + + // Find the link + LockList(h->LinkList); + { + for (i = 0;i < LIST_NUM(h->LinkList);i++) + { + LINK *kk = LIST_DATA(h->LinkList, i); + Lock(kk->lock); + { + if (UniStrCmpi(kk->Option->AccountName, t->ClientOption->AccountName) == 0) + { + k = kk; + AddRef(kk->ref); + } + } + Unlock(kk->lock); + + if (k != NULL) + { + break; + } + } + } + UnlockList(h->LinkList); + + if (k == NULL) + { + // The link is not found + ReleaseHub(h); + return ERR_OBJECT_NOT_FOUND; + } + + StrCpy(hubname, sizeof(hubname), t->HubName); + FreeRpcCreateLink(t); + Zero(t, sizeof(RPC_CREATE_LINK)); + StrCpy(t->HubName, sizeof(t->HubName), hubname); + + Lock(k->lock); + { + // Get configuration + t->Online = k->Offline ? false : true; + t->ClientOption = ZeroMalloc(sizeof(CLIENT_OPTION)); + Copy(t->ClientOption, k->Option, sizeof(CLIENT_OPTION)); + t->ClientAuth = CopyClientAuth(k->Auth); + Copy(&t->Policy, k->Policy, sizeof(POLICY)); + + t->CheckServerCert = k->CheckServerCert; + t->ServerCert = CloneX(k->ServerCert); + } + Unlock(k->lock); + + ReleaseLink(k); + ReleaseHub(h); + + return ret; +} + +// Set link configuration +UINT StSetLink(ADMIN *a, RPC_CREATE_LINK *t) +{ + SERVER *s = a->Server; + CEDAR *c = s->Cedar; + HUB *h; + UINT ret = ERR_NO_ERROR; + UINT i; + LINK *k; + + + if (s->ServerType != SERVER_TYPE_STANDALONE) + { + return ERR_NOT_SUPPORTED; + } + + CHECK_RIGHT; + + if (s->ServerType != SERVER_TYPE_STANDALONE) + { + return ERR_LINK_CANT_CREATE_ON_FARM; + } + + LockHubList(c); + { + h = GetHub(c, t->HubName); + } + UnlockHubList(c); + + if (h == NULL) + { + return ERR_HUB_NOT_FOUND; + } + + if (a->ServerAdmin == false && GetHubAdminOption(h, "no_cascade") != 0) + { + ReleaseHub(h); + return ERR_NOT_ENOUGH_RIGHT; + } + + k = NULL; + + // Find the link + LockList(h->LinkList); + { + for (i = 0;i < LIST_NUM(h->LinkList);i++) + { + LINK *kk = LIST_DATA(h->LinkList, i); + Lock(kk->lock); + { + if (UniStrCmpi(kk->Option->AccountName, t->ClientOption->AccountName) == 0) + { + k = kk; + AddRef(kk->ref); + } + } + Unlock(kk->lock); + + if (k != NULL) + { + break; + } + } + } + UnlockList(h->LinkList); + + if (k == NULL) + { + // The link is not found + ReleaseHub(h); + return ERR_OBJECT_NOT_FOUND; + } + + ALog(a, h, "LA_SET_LINK", t->ClientOption->AccountName); + + Lock(k->lock); + { + // Update the configuration of the link + if (k->ServerCert != NULL) + { + FreeX(k->ServerCert); + k->ServerCert = NULL; + } + + Copy(k->Option, t->ClientOption, sizeof(CLIENT_OPTION)); + StrCpy(k->Option->DeviceName, sizeof(k->Option->DeviceName), LINK_DEVICE_NAME); + k->Option->NumRetry = INFINITE; + k->Option->RetryInterval = 10; + k->Option->NoRoutingTracking = true; + CiFreeClientAuth(k->Auth); + k->Auth = CopyClientAuth(t->ClientAuth); + + if (t->Policy.Ver3 == false) + { + Copy(k->Policy, &t->Policy, sizeof(UINT) * NUM_POLICY_ITEM_FOR_VER2); + } + else + { + Copy(k->Policy, &t->Policy, sizeof(POLICY)); + } + + k->Option->RequireBridgeRoutingMode = true; // Enable Bridge / Routing mode + k->Option->RequireMonitorMode = false; // Disable monitor mode + + k->CheckServerCert = t->CheckServerCert; + k->ServerCert = CloneX(t->ServerCert); + } + Unlock(k->lock); + + IncrementServerConfigRevision(s); + + ReleaseLink(k); + ReleaseHub(h); + + return ret; +} + +// Create a new link(cascade) +UINT StCreateLink(ADMIN *a, RPC_CREATE_LINK *t) +{ + SERVER *s = a->Server; + CEDAR *c = s->Cedar; + HUB *h; + UINT ret = ERR_NO_ERROR; + UINT i; + LINK *k; + + CHECK_RIGHT; + + + if (s->ServerType != SERVER_TYPE_STANDALONE) + { + return ERR_LINK_CANT_CREATE_ON_FARM; + } + + LockHubList(c); + { + h = GetHub(c, t->HubName); + } + UnlockHubList(c); + + if (h == NULL) + { + return ERR_HUB_NOT_FOUND; + } + + if (a->ServerAdmin == false && GetHubAdminOption(h, "no_cascade") != 0) + { + ReleaseHub(h); + return ERR_NOT_ENOUGH_RIGHT; + } + + k = NULL; + + // Check for existing a link which has same name + LockList(h->LinkList); + { + for (i = 0;i < LIST_NUM(h->LinkList);i++) + { + LINK *kk = LIST_DATA(h->LinkList, i); + Lock(kk->lock); + { + if (UniStrCmpi(kk->Option->AccountName, t->ClientOption->AccountName) == 0) + { + k = kk; + AddRef(kk->ref); + } + } + Unlock(kk->lock); + + if (k != NULL) + { + break; + } + } + } + UnlockList(h->LinkList); + + if (k != NULL) + { + // There is a link which has same name + ReleaseLink(k); + ReleaseHub(h); + return ERR_LINK_ALREADY_EXISTS; + } + + ALog(a, h, "LA_CREATE_LINK", t->ClientOption->AccountName); + + // Create a new link + k = NewLink(c, h, t->ClientOption, t->ClientAuth, &t->Policy); + + if (k == NULL) + { + // Link creation failed + ret = ERR_INTERNAL_ERROR; + } + else + { + // setting of verifying server certification + // + k->CheckServerCert = t->CheckServerCert; + k->ServerCert = CloneX(t->ServerCert); + + // stay this off-line + k->Offline = false; + SetLinkOffline(k); + ReleaseLink(k); + + IncrementServerConfigRevision(s); + } + + ReleaseHub(h); + + return ret; +} + +// Delete a CA(Certificate Authority) setting from the hub +UINT StDeleteCa(ADMIN *a, RPC_HUB_DELETE_CA *t) +{ + SERVER *s = a->Server; + CEDAR *c = s->Cedar; + HUB *h; + UINT ret = ERR_NO_ERROR; + + if (s->ServerType == SERVER_TYPE_FARM_MEMBER) + { + return ERR_NOT_FARM_CONTROLLER; + } + + NO_SUPPORT_FOR_BRIDGE; + CHECK_RIGHT; + + LockHubList(c); + { + h = GetHub(c, t->HubName); + } + UnlockHubList(c); + + if (h == NULL) + { + return ERR_HUB_NOT_FOUND; + } + + if (a->ServerAdmin == false && GetHubAdminOption(h, "no_change_cert_list") != 0) + { + ReleaseHub(h); + return ERR_NOT_ENOUGH_RIGHT; + } + + LockList(h->HubDb->RootCertList); + { + if (IsInListKey(h->HubDb->RootCertList, t->Key)) + { + X *x = ListKeyToPointer(h->HubDb->RootCertList, t->Key); + Delete(h->HubDb->RootCertList, x); + FreeX(x); + + ALog(a, h, "LA_DELETE_CA"); + + IncrementServerConfigRevision(s); + } + else + { + ret = ERR_OBJECT_NOT_FOUND; + } + } + UnlockList(h->HubDb->RootCertList); + + ReleaseHub(h); + + return ret; +} + +// Get CA(Certificate Authority) setting from the hub +UINT StGetCa(ADMIN *a, RPC_HUB_GET_CA *t) +{ + SERVER *s = a->Server; + CEDAR *c = s->Cedar; + HUB *h; + UINT ret = ERR_NO_ERROR; + char hubname[MAX_HUBNAME_LEN + 1]; + UINT key; + + if (s->ServerType == SERVER_TYPE_FARM_MEMBER) + { + return ERR_NOT_FARM_CONTROLLER; + } + + NO_SUPPORT_FOR_BRIDGE; + + StrCpy(hubname, sizeof(hubname), t->HubName); + key = t->Key; + + FreeRpcHubGetCa(t); + Zero(t, sizeof(RPC_HUB_GET_CA)); + t->Key = key; + StrCpy(t->HubName, sizeof(t->HubName), hubname); + + CHECK_RIGHT; + + LockHubList(c); + { + h = GetHub(c, t->HubName); + } + UnlockHubList(c); + + if (h == NULL) + { + return ERR_HUB_NOT_FOUND; + } + + LockList(h->HubDb->RootCertList); + { + if (IsInListKey(h->HubDb->RootCertList, key)) + { + X *x = ListKeyToPointer(h->HubDb->RootCertList, key); + + t->Cert = CloneX(x); + } + else + { + ret = ERR_OBJECT_NOT_FOUND; + } + } + UnlockList(h->HubDb->RootCertList); + + ReleaseHub(h); + + return ret; +} + +// Enumerate CA(Certificate Authority) in the hub +UINT StEnumCa(ADMIN *a, RPC_HUB_ENUM_CA *t) +{ + SERVER *s = a->Server; + CEDAR *c = s->Cedar; + HUB *h; + char hubname[MAX_HUBNAME_LEN + 1]; + UINT i; + + if (s->ServerType == SERVER_TYPE_FARM_MEMBER) + { + return ERR_NOT_FARM_CONTROLLER; + } + + NO_SUPPORT_FOR_BRIDGE; + + StrCpy(hubname, sizeof(hubname), t->HubName); + + FreeRpcHubEnumCa(t); + Zero(t, sizeof(RPC_HUB_ENUM_CA)); + + StrCpy(t->HubName, sizeof(t->HubName), hubname); + CHECK_RIGHT; + + LockHubList(c); + { + h = GetHub(c, hubname); + } + UnlockHubList(c); + + if (h == NULL) + { + return ERR_HUB_NOT_FOUND; + } + + Zero(t, sizeof(RPC_HUB_ENUM_CA)); + StrCpy(t->HubName, sizeof(t->HubName), hubname); + + if (h->HubDb->RootCertList != NULL) + { + LockList(h->HubDb->RootCertList); + { + t->NumCa = LIST_NUM(h->HubDb->RootCertList); + t->Ca = ZeroMalloc(sizeof(RPC_HUB_ENUM_CA_ITEM) * t->NumCa); + + for (i = 0;i < t->NumCa;i++) + { + RPC_HUB_ENUM_CA_ITEM *e = &t->Ca[i]; + X *x = LIST_DATA(h->HubDb->RootCertList, i); + + e->Key = POINTER_TO_KEY(x); + GetAllNameFromNameEx(e->SubjectName, sizeof(e->SubjectName), x->subject_name); + GetAllNameFromNameEx(e->IssuerName, sizeof(e->IssuerName), x->issuer_name); + e->Expires = x->notAfter; + } + } + UnlockList(h->HubDb->RootCertList); + } + + ReleaseHub(h); + + return ERR_NO_ERROR; +} + +// Add CA(Certificate Authority) into the hub +UINT StAddCa(ADMIN *a, RPC_HUB_ADD_CA *t) +{ + SERVER *s = a->Server; + CEDAR *c = s->Cedar; + HUB *h; + + if (s->ServerType == SERVER_TYPE_FARM_MEMBER) + { + return ERR_NOT_FARM_CONTROLLER; + } + + if (c->Bridge) + { + return ERR_NOT_SUPPORTED; + } + + if (t->Cert == NULL) + { + return ERR_INVALID_PARAMETER; + } + + if (t->Cert->is_compatible_bit == false) + { + return ERR_NOT_RSA_1024; + } + + CHECK_RIGHT; + + LockHubList(c); + { + h = GetHub(c, t->HubName); + } + UnlockHubList(c); + + if (h == NULL) + { + return ERR_HUB_NOT_FOUND; + } + + if (a->ServerAdmin == false && GetHubAdminOption(h, "no_change_cert_list") != 0) + { + ReleaseHub(h); + return ERR_NOT_ENOUGH_RIGHT; + } + + IncrementServerConfigRevision(s); + + ALog(a, h, "LA_ADD_CA"); + + AddRootCert(h, t->Cert); + + ReleaseHub(h); + + return ERR_NO_ERROR; +} + +// Get logging configuration of the hub +UINT StGetHubLog(ADMIN *a, RPC_HUB_LOG *t) +{ + SERVER *s = a->Server; + CEDAR *c = s->Cedar; + HUB *h; + + CHECK_RIGHT; + + LockHubList(c); + { + h = GetHub(c, t->HubName); + } + UnlockHubList(c); + + if (h == NULL) + { + return ERR_HUB_NOT_FOUND; + } + + GetHubLogSetting(h, &t->LogSetting); + + ReleaseHub(h); + + return ERR_NO_ERROR; +} + +// Set logging configuration into the hub +UINT StSetHubLog(ADMIN *a, RPC_HUB_LOG *t) +{ + SERVER *s = a->Server; + CEDAR *c = s->Cedar; + HUB *h; + + CHECK_RIGHT; + + + LockHubList(c); + { + h = GetHub(c, t->HubName); + } + UnlockHubList(c); + + if (h == NULL) + { + return ERR_HUB_NOT_FOUND; + } + + if (a->ServerAdmin == false && GetHubAdminOption(h, "no_change_log_config") != 0) + { + ReleaseHub(h); + return ERR_NOT_ENOUGH_RIGHT; + } + + ALog(a, h, "LA_SET_HUB_LOG"); + + SetHubLogSettingEx(h, &t->LogSetting, + (a->ServerAdmin == false && GetHubAdminOption(h, "no_change_log_switch_type") != 0)); + + h->CurrentVersion++; + SiHubUpdateProc(h); + + ReleaseHub(h); + + IncrementServerConfigRevision(s); + + return ERR_NO_ERROR; +} + +// Get hub status +UINT StGetHubStatus(ADMIN *a, RPC_HUB_STATUS *t) +{ + SERVER *s = a->Server; + CEDAR *c = s->Cedar; + HUB *h; + + CHECK_RIGHT; + + LockHubList(c); + { + h = GetHub(c, t->HubName); + } + UnlockHubList(c); + + if (h == NULL) + { + return ERR_HUB_NOT_FOUND; + } + + Zero(t, sizeof(RPC_HUB_STATUS)); + + Lock(h->lock); + { + StrCpy(t->HubName, sizeof(t->HubName), h->Name); + t->HubType = h->Type; + t->Online = h->Offline ? false : true; + t->NumSessions = LIST_NUM(h->SessionList); + t->NumSessionsClient = Count(h->NumSessionsClient); + t->NumSessionsBridge = Count(h->NumSessionsBridge); + t->NumAccessLists = LIST_NUM(h->AccessList); + + if (h->HubDb != NULL) + { + t->NumUsers = LIST_NUM(h->HubDb->UserList); + t->NumGroups = LIST_NUM(h->HubDb->GroupList); + } + + t->NumMacTables = HASH_LIST_NUM(h->MacHashTable); + t->NumIpTables = LIST_NUM(h->IpTable); + + Lock(h->TrafficLock); + { + Copy(&t->Traffic, h->Traffic, sizeof(TRAFFIC)); + } + Unlock(h->TrafficLock); + + t->NumLogin = h->NumLogin; + t->LastCommTime = h->LastCommTime; + t->LastLoginTime = h->LastLoginTime; + t->CreatedTime = h->CreatedTime; + } + Unlock(h->lock); + + if (s->ServerType == SERVER_TYPE_FARM_CONTROLLER) + { + UINT i; + LockList(s->FarmMemberList); + { + for (i = 0;i < LIST_NUM(s->FarmMemberList);i++) + { + UINT k; + FARM_MEMBER *f = LIST_DATA(s->FarmMemberList, i); + + if (f->Me == false) + { + LockList(f->HubList); + { + for (k = 0;k < LIST_NUM(f->HubList);k++) + { + HUB_LIST *h = LIST_DATA(f->HubList, k); + + if (StrCmpi(h->Name, t->HubName) == 0) + { + t->NumSessions += h->NumSessions; + t->NumSessionsClient += h->NumSessionsClient; + t->NumSessionsBridge += h->NumSessionsBridge; + t->NumMacTables += h->NumMacTables; + t->NumIpTables += h->NumIpTables; + } + } + } + UnlockList(f->HubList); + } + } + } + UnlockList(s->FarmMemberList); + } + + if (h->Type != HUB_TYPE_FARM_STATIC) + { + t->SecureNATEnabled = h->EnableSecureNAT; + } + + ReleaseHub(h); + + return ERR_NO_ERROR; +} + +// Enable SecureNAT function of the hub +UINT StEnableSecureNAT(ADMIN *a, RPC_HUB *t) +{ + SERVER *s = a->Server; + CEDAR *c = s->Cedar; + HUB *h; + + CHECK_RIGHT; + + + LockHubList(c); + { + h = GetHub(c, t->HubName); + } + UnlockHubList(c); + + if (h == NULL) + { + return ERR_HUB_NOT_FOUND; + } + + if (h->Type == HUB_TYPE_FARM_STATIC || GetServerCapsBool(s, "b_support_securenat") == false) + { + ReleaseHub(h); + return ERR_NOT_SUPPORTED; + } + if (s->ServerType == SERVER_TYPE_FARM_MEMBER) + { + ReleaseHub(h); + return ERR_NOT_FARM_CONTROLLER; + } + + if (a->ServerAdmin == false && GetHubAdminOption(h, "no_securenat") != 0) + { + ReleaseHub(h); + return ERR_NOT_ENOUGH_RIGHT; + } + + ALog(a, h, "LA_ENABLE_SNAT"); + + EnableSecureNAT(h, true); + + h->CurrentVersion++; + SiHubUpdateProc(h); + + IncrementServerConfigRevision(s); + + ReleaseHub(h); + + return ERR_NO_ERROR; +} + +// Disable the SecureNAT function of the hub +UINT StDisableSecureNAT(ADMIN *a, RPC_HUB *t) +{ + SERVER *s = a->Server; + CEDAR *c = s->Cedar; + HUB *h; + + CHECK_RIGHT; + + + LockHubList(c); + { + h = GetHub(c, t->HubName); + } + UnlockHubList(c); + + if (h == NULL) + { + return ERR_HUB_NOT_FOUND; + } + + if (h->Type == HUB_TYPE_FARM_STATIC || GetServerCapsBool(s, "b_support_securenat") == false) + { + ReleaseHub(h); + return ERR_NOT_SUPPORTED; + } + if (s->ServerType == SERVER_TYPE_FARM_MEMBER) + { + ReleaseHub(h); + return ERR_NOT_FARM_CONTROLLER; + } + + if (a->ServerAdmin == false && GetHubAdminOption(h, "no_securenat") != 0) + { + ReleaseHub(h); + return ERR_NOT_ENOUGH_RIGHT; + } + + ALog(a, h, "LA_DISABLE_SNAT"); + + EnableSecureNAT(h, false); + + h->CurrentVersion++; + SiHubUpdateProc(h); + + IncrementServerConfigRevision(s); + + ReleaseHub(h); + + return ERR_NO_ERROR; +} + +// Enumerate NAT entries of the SecureNAT +UINT StEnumNAT(ADMIN *a, RPC_ENUM_NAT *t) +{ + SERVER *s = a->Server; + CEDAR *c = s->Cedar; + HUB *h; + UINT ret = ERR_NO_ERROR; + char hubname[MAX_HUBNAME_LEN + 1]; + UINT i; + + CHECK_RIGHT; + + StrCpy(hubname, sizeof(hubname), t->HubName); + + LockHubList(c); + { + h = GetHub(c, t->HubName); + } + UnlockHubList(c); + + if (h == NULL) + { + return ERR_HUB_NOT_FOUND; + } + + if (h->Type == HUB_TYPE_FARM_STATIC || GetServerCapsBool(s, "b_support_securenat") == false) + { + ReleaseHub(h); + return ERR_NOT_SUPPORTED; + } + + Lock(h->lock_online); + { + if (h->SecureNAT == NULL) + { + ret = ERR_SNAT_NOT_RUNNING; + } + else + { + NtEnumNatList(h->SecureNAT->Nat, t); + } + } + Unlock(h->lock_online); + + if (h->Type == HUB_TYPE_FARM_DYNAMIC) + { + if (ret == ERR_SNAT_NOT_RUNNING) + { + // Get status of remote SecureNAT + LockList(s->FarmMemberList); + { + for (i = 0;i < LIST_NUM(s->FarmMemberList);i++) + { + FARM_MEMBER *f = LIST_DATA(s->FarmMemberList, i); + if (f->Me == false) + { + RPC_ENUM_NAT tmp; + + Zero(&tmp, sizeof(tmp)); + + SiCallEnumNat(s, f, hubname, &tmp); + + if (tmp.NumItem >= 1) + { + FreeRpcEnumNat(t); + Copy(t, &tmp, sizeof(RPC_ENUM_NAT)); + ret = ERR_NO_ERROR; + break; + } + else + { + FreeRpcEnumNat(&tmp); + } + } + } + } + UnlockList(s->FarmMemberList); + } + } + + ReleaseHub(h); + + ret = ERR_NO_ERROR; + + return ret; +} + +// Get status of the SecureNAT +UINT StGetSecureNATStatus(ADMIN *a, RPC_NAT_STATUS *t) +{ + SERVER *s = a->Server; + CEDAR *c = s->Cedar; + HUB *h; + UINT ret = ERR_NO_ERROR; + char hubname[MAX_HUBNAME_LEN + 1]; + UINT i; + + CHECK_RIGHT; + + StrCpy(hubname, sizeof(hubname), t->HubName); + + LockHubList(c); + { + h = GetHub(c, t->HubName); + } + UnlockHubList(c); + + if (h == NULL) + { + return ERR_HUB_NOT_FOUND; + } + + if (h->Type == HUB_TYPE_FARM_STATIC || GetServerCapsBool(s, "b_support_securenat") == false) + { + ReleaseHub(h); + return ERR_NOT_SUPPORTED; + } + + Lock(h->lock_online); + { + if (h->SecureNAT == NULL) + { + ret = ERR_SNAT_NOT_RUNNING; + } + else + { + NtGetStatus(h->SecureNAT->Nat, t); + } + } + Unlock(h->lock_online); + + if (h->Type == HUB_TYPE_FARM_DYNAMIC) + { + if (ret == ERR_SNAT_NOT_RUNNING) + { + // Get status of remote secureNAT + LockList(s->FarmMemberList); + { + for (i = 0;i < LIST_NUM(s->FarmMemberList);i++) + { + FARM_MEMBER *f = LIST_DATA(s->FarmMemberList, i); + if (f->Me == false) + { + RPC_NAT_STATUS tmp; + + Zero(&tmp, sizeof(tmp)); + + SiCallGetNatStatus(s, f, hubname, &tmp); + + if (tmp.NumDhcpClients == 0 && tmp.NumTcpSessions == 0 && tmp.NumUdpSessions == 0) + { + } + else + { + Copy(t, &tmp, sizeof(RPC_NAT_STATUS)); + ret = ERR_NO_ERROR; + break; + } + } + } + } + UnlockList(s->FarmMemberList); + } + } + + ReleaseHub(h); + + StrCpy(t->HubName, sizeof(t->HubName), hubname); + ret = ERR_NO_ERROR; + + return ret; +} + +// Enumerate DHCP entries +UINT StEnumDHCP(ADMIN *a, RPC_ENUM_DHCP *t) +{ + SERVER *s = a->Server; + CEDAR *c = s->Cedar; + HUB *h; + UINT ret = ERR_NO_ERROR; + char hubname[MAX_HUBNAME_LEN + 1]; + UINT i; + StrCpy(hubname, sizeof(hubname), t->HubName); + + CHECK_RIGHT; + + LockHubList(c); + { + h = GetHub(c, t->HubName); + } + UnlockHubList(c); + + if (h == NULL) + { + return ERR_HUB_NOT_FOUND; + } + + if (h->Type == HUB_TYPE_FARM_STATIC || GetServerCapsBool(s, "b_support_securenat") == false) + { + ReleaseHub(h); + return ERR_NOT_SUPPORTED; + } + + Lock(h->lock_online); + { + if (h->SecureNAT == NULL) + { + ret = ERR_SNAT_NOT_RUNNING; + } + else + { + NtEnumDhcpList(h->SecureNAT->Nat, t); + } + } + Unlock(h->lock_online); + + if (h->Type == HUB_TYPE_FARM_DYNAMIC) + { + if (ret == ERR_SNAT_NOT_RUNNING) + { + // Get status of remote DHCP service + LockList(s->FarmMemberList); + { + for (i = 0;i < LIST_NUM(s->FarmMemberList);i++) + { + FARM_MEMBER *f = LIST_DATA(s->FarmMemberList, i); + if (f->Me == false) + { + RPC_ENUM_DHCP tmp; + + Zero(&tmp, sizeof(tmp)); + + SiCallEnumDhcp(s, f, hubname, &tmp); + + if (tmp.NumItem >= 1) + { + FreeRpcEnumDhcp(t); + Copy(t, &tmp, sizeof(RPC_ENUM_DHCP)); + ret = ERR_NO_ERROR; + break; + } + else + { + FreeRpcEnumDhcp(&tmp); + } + } + } + } + UnlockList(s->FarmMemberList); + } + } + + ReleaseHub(h); + + ret = ERR_NO_ERROR; + + return ret; +} + +// Set SecureNAT options +UINT StSetSecureNATOption(ADMIN *a, VH_OPTION *t) +{ + SERVER *s = a->Server; + CEDAR *c = s->Cedar; + HUB *h; + char push_routes_str_old[MAX_DHCP_CLASSLESS_ROUTE_TABLE_STR_SIZE]; + + + if (IsZero(t->MacAddress, sizeof(t->MacAddress)) || + IsHostIPAddress4(&t->Ip) == false || + IsSubnetMask4(&t->Mask) == false) + { + return ERR_INVALID_PARAMETER; + } + if ((IPToUINT(&t->Ip) & (~(IPToUINT(&t->Mask)))) == 0) + { + return ERR_INVALID_PARAMETER; + } + if (GetServerCapsBool(s, "b_support_securenat") == false) + { + t->ApplyDhcpPushRoutes = false; + } + if (t->ApplyDhcpPushRoutes) + { + if (NormalizeClasslessRouteTableStr(t->DhcpPushRoutes, sizeof(t->DhcpPushRoutes), t->DhcpPushRoutes) == false) + { + return ERR_INVALID_PARAMETER; + } + } + + CHECK_RIGHT; + + LockHubList(c); + { + h = GetHub(c, t->HubName); + } + UnlockHubList(c); + + if (h == NULL) + { + return ERR_HUB_NOT_FOUND; + } + + if (h->Type == HUB_TYPE_FARM_STATIC || GetServerCapsBool(s, "b_support_securenat") == false) + { + ReleaseHub(h); + return ERR_NOT_SUPPORTED; + } + if (s->ServerType == SERVER_TYPE_FARM_MEMBER) + { + ReleaseHub(h); + return ERR_NOT_FARM_CONTROLLER; + } + + if (a->ServerAdmin == false && GetHubAdminOption(h, "no_securenat") != 0) + { + ReleaseHub(h); + return ERR_NOT_ENOUGH_RIGHT; + } + + if (h->SecureNATOption->UseNat == false && t->UseNat) + { + if (a->ServerAdmin == false && GetHubAdminOption(h, "no_securenat_enablenat") != 0) + { + ReleaseHub(h); + return ERR_NOT_ENOUGH_RIGHT; + } + } + + if (h->SecureNATOption->UseDhcp == false && t->UseDhcp) + { + if (a->ServerAdmin == false && GetHubAdminOption(h, "no_securenat_enabledhcp") != 0) + { + ReleaseHub(h); + return ERR_NOT_ENOUGH_RIGHT; + } + } + + StrCpy(push_routes_str_old, sizeof(push_routes_str_old), h->SecureNATOption->DhcpPushRoutes); + Copy(h->SecureNATOption, t, sizeof(VH_OPTION)); + if (t->ApplyDhcpPushRoutes == false) + { + StrCpy(h->SecureNATOption->DhcpPushRoutes, sizeof(h->SecureNATOption->DhcpPushRoutes), push_routes_str_old); + } + + if (h->Type != HUB_TYPE_STANDALONE && h->Cedar != NULL && h->Cedar->Server != NULL && + h->Cedar->Server->ServerType == SERVER_TYPE_FARM_CONTROLLER) + { + NiClearUnsupportedVhOptionForDynamicHub(h->SecureNATOption, false); + } + + Lock(h->lock_online); + { + if (h->SecureNAT != NULL) + { + SetVirtualHostOption(h->SecureNAT->Nat->Virtual, t); + } + } + Unlock(h->lock_online); + + ALog(a, h, "LA_SET_SNAT_OPTION"); + + h->CurrentVersion++; + SiHubUpdateProc(h); + + IncrementServerConfigRevision(s); + + ReleaseHub(h); + + return ERR_NO_ERROR; +} + +// Get SecureNAT options +UINT StGetSecureNATOption(ADMIN *a, VH_OPTION *t) +{ + SERVER *s = a->Server; + CEDAR *c = s->Cedar; + HUB *h; + char hubname[MAX_HUBNAME_LEN + 1]; + + StrCpy(hubname, sizeof(hubname), t->HubName); + + CHECK_RIGHT; + + LockHubList(c); + { + h = GetHub(c, t->HubName); + } + UnlockHubList(c); + + if (h == NULL) + { + return ERR_HUB_NOT_FOUND; + } + + if (h->Type == HUB_TYPE_FARM_STATIC || GetServerCapsBool(s, "b_support_securenat") == false) + { + ReleaseHub(h); + return ERR_NOT_SUPPORTED; + } + if (s->ServerType == SERVER_TYPE_FARM_MEMBER) + { + ReleaseHub(h); + return ERR_NOT_FARM_CONTROLLER; + } + + Zero(t, sizeof(VH_OPTION)); + Copy(t, h->SecureNATOption, sizeof(VH_OPTION)); + StrCpy(t->HubName, sizeof(t->HubName), h->Name); + t->ApplyDhcpPushRoutes = true; + + ReleaseHub(h); + + return ERR_NO_ERROR; +} + +// Make a hub on-line or off-line +UINT StSetHubOnline(ADMIN *a, RPC_SET_HUB_ONLINE *t) +{ + SERVER *s = a->Server; + CEDAR *c = s->Cedar; + HUB *h; + + if (s->ServerType == SERVER_TYPE_FARM_MEMBER) + { + return ERR_NOT_FARM_CONTROLLER; + } + + + NO_SUPPORT_FOR_BRIDGE; + + CHECK_RIGHT; + + LockHubList(c); + { + h = GetHub(c, t->HubName); + } + UnlockHubList(c); + + if (h == NULL) + { + return ERR_HUB_NOT_FOUND; + } + + if (a->ServerAdmin == false && t->Online && GetHubAdminOption(h, "no_online") != 0) + { + ReleaseHub(h); + return ERR_NOT_ENOUGH_RIGHT; + } + + if (a->ServerAdmin == false && t->Online == false && GetHubAdminOption(h, "no_offline") != 0) + { + ReleaseHub(h); + return ERR_NOT_ENOUGH_RIGHT; + } + + if (t->Online) + { + ALog(a, h, "LA_SET_HUB_ONLINE"); + SetHubOnline(h); + } + else + { + ALog(a, h, "LA_SET_HUB_OFFLINE"); + SetHubOffline(h); + } + + h->CurrentVersion++; + SiHubUpdateProc(h); + + IncrementServerConfigRevision(s); + + ReleaseHub(h); + + return ERR_NO_ERROR; +} + +// Get connection information +UINT StGetConnectionInfo(ADMIN *a, RPC_CONNECTION_INFO *t) +{ + SERVER *s = a->Server; + CEDAR *c = s->Cedar; + CONNECTION *connection; + char name[MAX_CONNECTION_NAME_LEN + 1]; + + if (IsEmptyStr(t->Name)) + { + return ERR_INVALID_PARAMETER; + } + + SERVER_ADMIN_ONLY; + + LockList(c->ConnectionList); + { + CONNECTION tt; + Zero(&tt, sizeof(tt)); + tt.Name = t->Name; + StrCpy(name, sizeof(name), t->Name); + + connection = Search(c->ConnectionList, &tt); + + if (connection != NULL) + { + AddRef(connection->ref); + } + } + UnlockList(c->ConnectionList); + + if (connection == NULL) + { + return ERR_OBJECT_NOT_FOUND; + } + + Zero(t, sizeof(RPC_CONNECTION_INFO)); + StrCpy(t->Name, sizeof(t->Name), name); + + Lock(connection->lock); + { + SOCK *s = connection->FirstSock; + + if (s != NULL) + { + t->Ip = IPToUINT(&s->RemoteIP); + t->Port = s->RemotePort; + StrCpy(t->Hostname, sizeof(t->Hostname), s->RemoteHostname); + } + + StrCpy(t->Name, sizeof(t->Name), connection->Name); + t->ConnectedTime = TickToTime(connection->ConnectedTick); + t->Type = connection->Type; + + StrCpy(t->ServerStr, sizeof(t->ServerStr), connection->ServerStr); + StrCpy(t->ClientStr, sizeof(t->ClientStr), connection->ClientStr); + t->ServerVer = connection->ServerVer; + t->ServerBuild = connection->ServerBuild; + t->ClientVer = connection->ClientVer; + t->ClientBuild = connection->ClientBuild; + } + Unlock(connection->lock); + + ReleaseConnection(connection); + + return ERR_NO_ERROR; +} + +// Disconnect a connection +UINT StDisconnectConnection(ADMIN *a, RPC_DISCONNECT_CONNECTION *t) +{ + SERVER *s = a->Server; + CEDAR *c = s->Cedar; + CONNECTION *connection; + + if (IsEmptyStr(t->Name)) + { + return ERR_INVALID_PARAMETER; + } + + SERVER_ADMIN_ONLY; + + LockList(c->ConnectionList); + { + CONNECTION tt; + Zero(&tt, sizeof(tt)); + tt.Name = t->Name; + + connection = Search(c->ConnectionList, &tt); + if (connection != NULL) + { + AddRef(connection->ref); + } + } + UnlockList(c->ConnectionList); + + if (connection == NULL) + { + return ERR_OBJECT_NOT_FOUND; + } + + StopConnection(connection, true); + + ReleaseConnection(connection); + + ALog(a, NULL, "LA_DISCONNECT_CONN", t->Name); + + return ERR_NO_ERROR; +} + +// Enumerate connections +UINT StEnumConnection(ADMIN *a, RPC_ENUM_CONNECTION *t) +{ + SERVER *s = a->Server; + CEDAR *c = s->Cedar; + + SERVER_ADMIN_ONLY; + + FreeRpcEnumConnection(t); + Zero(t, sizeof(RPC_ENUM_CONNECTION)); + + LockList(c->ConnectionList); + { + UINT i; + t->NumConnection = LIST_NUM(c->ConnectionList); + t->Connections = ZeroMalloc(sizeof(RPC_ENUM_CONNECTION_ITEM) * t->NumConnection); + + for (i = 0;i < t->NumConnection;i++) + { + RPC_ENUM_CONNECTION_ITEM *e = &t->Connections[i]; + CONNECTION *connection = LIST_DATA(c->ConnectionList, i); + + Lock(connection->lock); + { + SOCK *s = connection->FirstSock; + + if (s != NULL) + { + e->Ip = IPToUINT(&s->RemoteIP); + e->Port = s->RemotePort; + StrCpy(e->Hostname, sizeof(e->Hostname), s->RemoteHostname); + } + + StrCpy(e->Name, sizeof(e->Name), connection->Name); + e->ConnectedTime = TickToTime(connection->ConnectedTick); + e->Type = connection->Type; + } + Unlock(connection->lock); + } + } + UnlockList(c->ConnectionList); + + return ERR_NO_ERROR; +} + +// Set Radius options of the hub +UINT StSetHubRadius(ADMIN *a, RPC_RADIUS *t) +{ + SERVER *s = a->Server; + CEDAR *c = s->Cedar; + HUB *h = NULL; + + NO_SUPPORT_FOR_BRIDGE; + + if (s->ServerType == SERVER_TYPE_FARM_MEMBER) + { + return ERR_NOT_SUPPORTED; + } + + if (GetGlobalServerFlag(GSF_DISABLE_RADIUS_AUTH) != 0 && IsEmptyStr(t->RadiusServerName) == false) + { + return ERR_NOT_SUPPORTED_FUNCTION_ON_OPENSOURCE; + } + + CHECK_RIGHT; + + LockHubList(c); + { + h = GetHub(c, t->HubName); + } + UnlockHubList(c); + + if (h == NULL) + { + return ERR_HUB_NOT_FOUND; + } + + //SetRadiusServer(h, t->RadiusServerName, t->RadiusPort, t->RadiusSecret); + SetRadiusServerEx(h, t->RadiusServerName, t->RadiusPort, t->RadiusSecret, t->RadiusRetryInterval); + + ALog(a, h, "LA_SET_HUB_RADIUS"); + + ReleaseHub(h); + + IncrementServerConfigRevision(s); + + return ERR_NO_ERROR; +} + +// Get Radius options of the hub +UINT StGetHubRadius(ADMIN *a, RPC_RADIUS *t) +{ + SERVER *s = a->Server; + CEDAR *c = s->Cedar; + HUB *h = NULL; + + CHECK_RIGHT; + + if (s->ServerType == SERVER_TYPE_FARM_MEMBER) + { + return ERR_NOT_SUPPORTED; + } + + LockHubList(c); + { + h = GetHub(c, t->HubName); + } + UnlockHubList(c); + + if (h == NULL) + { + return ERR_HUB_NOT_FOUND; + } + + Zero(t, sizeof(RPC_RADIUS)); + //GetRadiusServer(h, t->RadiusServerName, sizeof(t->RadiusServerName), + // &t->RadiusPort, t->RadiusSecret, sizeof(t->RadiusSecret)); + GetRadiusServerEx(h, t->RadiusServerName, sizeof(t->RadiusServerName), + &t->RadiusPort, t->RadiusSecret, sizeof(t->RadiusSecret), &t->RadiusRetryInterval); + + ReleaseHub(h); + + return ERR_NO_ERROR; +} + +// Delete a hub +UINT StDeleteHub(ADMIN *a, RPC_DELETE_HUB *t) +{ + SERVER *s = a->Server; + CEDAR *c = s->Cedar; + HUB *h = NULL; + + if (s->ServerType == SERVER_TYPE_FARM_MEMBER) + { + return ERR_NOT_FARM_CONTROLLER; + } + + + if (IsEmptyStr(t->HubName) || IsSafeStr(t->HubName) == false) + { + return ERR_INVALID_PARAMETER; + } + + NO_SUPPORT_FOR_BRIDGE; + + SERVER_ADMIN_ONLY; + + LockHubList(c); + { + h = GetHub(c, t->HubName); + } + UnlockHubList(c); + + if (h == NULL) + { + return ERR_HUB_NOT_FOUND; + } + + StopHub(h); + + IncrementServerConfigRevision(s); + + DelHub(c, h); + ReleaseHub(h); + + ALog(a, NULL, "LA_DELETE_HUB", t->HubName); + + return ERR_NO_ERROR; +} + +// Enumerate hubs +UINT StEnumHub(ADMIN *a, RPC_ENUM_HUB *t) +{ + SERVER *s = a->Server; + CEDAR *c = s->Cedar; + HUB *h = NULL; + + FreeRpcEnumHub(t); + + Zero(t, sizeof(RPC_ENUM_HUB)); + + LockHubList(c); + { + UINT i, num, j; + + num = 0; + + for (i = 0;i < LIST_NUM(c->HubList);i++) + { + HUB *h = LIST_DATA(c->HubList, i); + + Lock(h->lock); + + if (a->ServerAdmin == false && + h->Option != NULL && + StrCmpi(h->Name, a->HubName) != 0) + { + // This hub is not listed + } + else + { + // This hub is listed + num++; + } + } + + t->NumHub = num; + + t->Hubs = ZeroMalloc(sizeof(RPC_ENUM_HUB_ITEM) * num); + + i = 0; + for (j = 0;j < LIST_NUM(c->HubList);j++) + { + HUB *h = LIST_DATA(c->HubList, j); + + if (a->ServerAdmin == false && + h->Option != NULL && + StrCmpi(h->Name, a->HubName) != 0) + { + // This hub is not listed + } + else + { + // This hub is listed + RPC_ENUM_HUB_ITEM *e = &t->Hubs[i++]; + + StrCpy(e->HubName, sizeof(e->HubName), h->Name); + e->Online = h->Offline ? false : true; + e->HubType = h->Type; + + e->NumSessions = LIST_NUM(h->SessionList); + + LockHashList(h->MacHashTable); + { + e->NumMacTables = HASH_LIST_NUM(h->MacHashTable); + } + UnlockHashList(h->MacHashTable); + + LockList(h->IpTable); + { + e->NumIpTables = LIST_NUM(h->IpTable); + } + UnlockList(h->IpTable); + + if (h->HubDb != NULL) + { + LockList(h->HubDb->UserList); + { + e->NumUsers = LIST_NUM(h->HubDb->UserList); + } + UnlockList(h->HubDb->UserList); + + LockList(h->HubDb->GroupList); + { + e->NumGroups = LIST_NUM(h->HubDb->GroupList); + } + UnlockList(h->HubDb->GroupList); + } + + e->LastCommTime = h->LastCommTime; + e->LastLoginTime = h->LastLoginTime; + e->NumLogin = h->NumLogin; + e->CreatedTime = h->CreatedTime; + + Lock(h->TrafficLock); + { + Copy(&e->Traffic, h->Traffic, sizeof(TRAFFIC)); + } + Unlock(h->TrafficLock); + + e->IsTrafficFilled = true; + } + + Unlock(h->lock); + } + } + UnlockHubList(c); + + if (s->ServerType == SERVER_TYPE_FARM_CONTROLLER) + { + UINT i, j, k; + LockList(s->FarmMemberList); + { + for (i = 0;i < LIST_NUM(s->FarmMemberList);i++) + { + FARM_MEMBER *f = LIST_DATA(s->FarmMemberList, i); + + LockList(f->HubList); + { + if (f->Me == false) + { + for (j = 0;j < LIST_NUM(f->HubList);j++) + { + HUB_LIST *o = LIST_DATA(f->HubList, j); + + for (k = 0;k < t->NumHub;k++) + { + RPC_ENUM_HUB_ITEM *e = &t->Hubs[k]; + + if (StrCmpi(e->HubName, o->Name) == 0) + { + e->NumIpTables += o->NumIpTables; + e->NumMacTables += o->NumMacTables; + e->NumSessions += o->NumSessions; + } + } + } + } + } + UnlockList(f->HubList); + } + } + UnlockList(s->FarmMemberList); + } + + return ERR_NO_ERROR; +} + +// Get hub configuration +UINT StGetHub(ADMIN *a, RPC_CREATE_HUB *t) +{ + SERVER *s = a->Server; + CEDAR *c = s->Cedar; + UINT ret = ERR_NO_ERROR; + HUB *h; + + if (s->ServerType == SERVER_TYPE_FARM_MEMBER) + { + return ERR_NOT_FARM_CONTROLLER; + } + + if (IsEmptyStr(t->HubName) || IsSafeStr(t->HubName) == false) + { + return ERR_INVALID_PARAMETER; + } + + if (s->ServerType == SERVER_TYPE_FARM_MEMBER) + { + return ERR_NOT_FARM_CONTROLLER; + } + + NO_SUPPORT_FOR_BRIDGE; + CHECK_RIGHT; + + LockHubList(c); + { + h = GetHub(c, t->HubName); + } + UnlockHubList(c); + + Zero(t, sizeof(RPC_CREATE_HUB)); + + if (h == NULL) + { + return ERR_HUB_NOT_FOUND; + } + + Lock(h->lock); + { + StrCpy(t->HubName, sizeof(t->HubName), h->Name); + t->Online = h->Offline ? false : true; + t->HubOption.MaxSession = h->Option->MaxSession; + t->HubOption.NoEnum = h->Option->NoEnum; + t->HubType = h->Type; + } + Unlock(h->lock); + + ReleaseHub(h); + + return ret; +} + +// Set hub configuration +UINT StSetHub(ADMIN *a, RPC_CREATE_HUB *t) +{ + SERVER *s = a->Server; + CEDAR *c = s->Cedar; + HUB *h; + UINT ret = ERR_NO_ERROR; + + if (s->ServerType == SERVER_TYPE_FARM_MEMBER) + { + return ERR_NOT_FARM_CONTROLLER; + } + + if (IsEmptyStr(t->HubName) || IsSafeStr(t->HubName) == false) + { + return ERR_INVALID_PARAMETER; + } + + + CHECK_RIGHT; + NO_SUPPORT_FOR_BRIDGE; + + if (s->ServerType == SERVER_TYPE_FARM_MEMBER) + { + return ERR_NOT_FARM_CONTROLLER; + } + + if (s->ServerType == SERVER_TYPE_STANDALONE) + { + if (t->HubType != HUB_TYPE_STANDALONE) + { + return ERR_INVALID_PARAMETER; + } + } + + if (s->ServerType == SERVER_TYPE_FARM_CONTROLLER) + { + if (t->HubType == HUB_TYPE_STANDALONE) + { + return ERR_INVALID_PARAMETER; + } + } + + LockHubList(c); + { + h = GetHub(c, t->HubName); + } + UnlockHubList(c); + + if (h == NULL) + { + return ERR_HUB_NOT_FOUND; + } + + if (h->Type != t->HubType) + { + ReleaseHub(h); + return ERR_NOT_SUPPORTED; + } + + // For JSON-RPC + if (StrLen(t->AdminPasswordPlainText) != 0) + { + Sha0(t->HashedPassword, t->AdminPasswordPlainText, StrLen(t->AdminPasswordPlainText)); + HashPassword(t->SecurePassword, ADMINISTRATOR_USERNAME, t->AdminPasswordPlainText); + } + + if (IsZero(t->HashedPassword, sizeof(t->HashedPassword)) == false && + IsZero(t->SecurePassword, sizeof(t->SecurePassword)) == false) + { + if (a->ServerAdmin == false && GetHubAdminOption(h, "no_change_admin_password") != 0) + { + ReleaseHub(h); + return ERR_NOT_ENOUGH_RIGHT; + } + } + + // Is the password to be set blank + { + UCHAR hash1[SHA1_SIZE], hash2[SHA1_SIZE]; + HashPassword(hash1, ADMINISTRATOR_USERNAME, ""); + Sha0(hash2, "", 0); + + if (Cmp(t->HashedPassword, hash2, SHA1_SIZE) == 0 || Cmp(t->SecurePassword, hash1, SHA1_SIZE) == 0) + { + if (a->ServerAdmin == false && a->Rpc->Sock->RemoteIP.addr[0] != 127) + { + // Refuse to set a blank password to hub admin from remote host + ReleaseHub(h); + return ERR_INVALID_PARAMETER; + } + } + } + + Lock(h->lock); + { + if (a->ServerAdmin == false && h->Type != t->HubType) + { + ret = ERR_NOT_ENOUGH_RIGHT; + } + else + { + h->Type = t->HubType; + h->Option->MaxSession = t->HubOption.MaxSession; + h->Option->NoEnum = t->HubOption.NoEnum; + if (IsZero(t->HashedPassword, sizeof(t->HashedPassword)) == false && + IsZero(t->SecurePassword, sizeof(t->SecurePassword)) == false) + { + Copy(h->HashedPassword, t->HashedPassword, SHA1_SIZE); + Copy(h->SecurePassword, t->SecurePassword, SHA1_SIZE); + } + } + } + Unlock(h->lock); + + if (t->Online) + { + if (a->ServerAdmin || GetHubAdminOption(h, "no_online") == 0) + { + SetHubOnline(h); + } + } + else + { + if (a->ServerAdmin || GetHubAdminOption(h, "no_offline") == 0) + { + SetHubOffline(h); + } + } + + if (h->Type == HUB_TYPE_FARM_STATIC) + { + EnableSecureNAT(h, false); + } + + h->CurrentVersion++; + SiHubUpdateProc(h); + + IncrementServerConfigRevision(s); + + ALog(a, h, "LA_SET_HUB"); + + ReleaseHub(h); + + return ret; +} + +// Create a hub +UINT StCreateHub(ADMIN *a, RPC_CREATE_HUB *t) +{ + SERVER *s = a->Server; + CEDAR *c = s->Cedar; + HUB *h; + HUB_OPTION o; + UINT current_hub_num; + bool b; + + if (s->ServerType == SERVER_TYPE_FARM_MEMBER) + { + return ERR_NOT_FARM_CONTROLLER; + } + + + + if (IsEmptyStr(t->HubName) || IsSafeStr(t->HubName) == false) + { + return ERR_INVALID_PARAMETER; + } + + NO_SUPPORT_FOR_BRIDGE; + + if (s->ServerType == SERVER_TYPE_FARM_MEMBER) + { + return ERR_NOT_FARM_CONTROLLER; + } + + SERVER_ADMIN_ONLY; + + Trim(t->HubName); + if (StrLen(t->HubName) == 0) + { + return ERR_INVALID_PARAMETER; + } + if (StartWith(t->HubName, ".") || EndWith(t->HubName, ".")) + { + return ERR_INVALID_PARAMETER; + } + + if (s->ServerType == SERVER_TYPE_FARM_MEMBER) + { + return ERR_NOT_FARM_CONTROLLER; + } + + if (s->ServerType == SERVER_TYPE_STANDALONE) + { + if (t->HubType != HUB_TYPE_STANDALONE) + { + return ERR_INVALID_PARAMETER; + } + } + else if (t->HubType != HUB_TYPE_FARM_DYNAMIC && t->HubType != HUB_TYPE_FARM_STATIC) + { + return ERR_INVALID_PARAMETER; + } + + // Create a hub object + Zero(&o, sizeof(o)); + o.MaxSession = t->HubOption.MaxSession; + o.NoEnum = t->HubOption.NoEnum; + + // Default setting for hub admin options + SiSetDefaultHubOption(&o); + + LockList(c->HubList); + { + current_hub_num = LIST_NUM(c->HubList); + } + UnlockList(c->HubList); + + if (current_hub_num > GetServerCapsInt(a->Server, "i_max_hubs")) + { + return ERR_TOO_MANY_HUBS; + } + + LockList(c->HubList); + { + b = IsHub(c, t->HubName); + } + UnlockList(c->HubList); + + if (b) + { + return ERR_HUB_ALREADY_EXISTS; + } + + ALog(a, NULL, "LA_CREATE_HUB", t->HubName); + + // For JSON-RPC + if ((IsZero(t->HashedPassword, sizeof(t->HashedPassword)) && + IsZero(t->SecurePassword, sizeof(t->SecurePassword))) || + StrLen(t->AdminPasswordPlainText) != 0) + { + Sha0(t->HashedPassword, t->AdminPasswordPlainText, StrLen(t->AdminPasswordPlainText)); + HashPassword(t->SecurePassword, ADMINISTRATOR_USERNAME, t->AdminPasswordPlainText); + } + + h = NewHub(c, t->HubName, &o); + Copy(h->HashedPassword, t->HashedPassword, SHA1_SIZE); + Copy(h->SecurePassword, t->SecurePassword, SHA1_SIZE); + + h->Type = t->HubType; + + AddHub(c, h); + + if (t->Online) + { + h->Offline = true; + SetHubOnline(h); + } + else + { + h->Offline = false; + SetHubOffline(h); + } + + h->CreatedTime = SystemTime64(); + + ReleaseHub(h); + + IncrementServerConfigRevision(s); + + return ERR_NO_ERROR; +} + +// Set cipher for SSL to the server +UINT StSetServerCipher(ADMIN *a, RPC_STR *t) +{ + SERVER *s = a->Server; + CEDAR *c = s->Cedar; + + if (IsEmptyStr(t->String)) + { + return ERR_INVALID_PARAMETER; + } + + SERVER_ADMIN_ONLY; + + StrUpper(t->String); + + ALog(a, NULL, "LA_SET_SERVER_CIPHER", t->String); + + Lock(c->lock); + { + SetCedarCipherList(c, t->String); + } + Unlock(c->lock); + + IncrementServerConfigRevision(s); + + return ERR_NO_ERROR; +} + +// Get cipher for SSL +UINT StGetServerCipher(ADMIN *a, RPC_STR *t) +{ + SERVER *s = a->Server; + CEDAR *c = s->Cedar; + + FreeRpcStr(t); + Zero(t, sizeof(RPC_STR)); + + Lock(c->lock); + { + t->String = CopyStr(c->CipherList); + } + Unlock(c->lock); + + return ERR_NO_ERROR; +} + +// Get list of available ciphers for SSL +UINT StGetServerCipherList(ADMIN *a, RPC_STR *t) +{ + SERVER *s = a->Server; + CEDAR *c = s->Cedar; + + FreeRpcStr(t); + Zero(t, sizeof(RPC_STR)); + + Lock(c->lock); + { + UINT i; + TOKEN_LIST *ciphers = GetCipherList(); + if (ciphers->NumTokens > 0) + { + UINT size = StrSize(ciphers->Token[0]); + t->String = Malloc(size); + StrCpy(t->String, size, ciphers->Token[0]); + i = 1; + + for (; i < ciphers->NumTokens; i++) + { + // We use StrSize() because we need the extra space for ';' + size += StrSize(ciphers->Token[i]); + t->String = ReAlloc(t->String, size); + StrCat(t->String, size, ";"); + StrCat(t->String, size, ciphers->Token[i]); + } + } + + FreeToken(ciphers); + } + Unlock(c->lock); + + return ERR_NO_ERROR; +} + +// Get the server certification +UINT StGetServerCert(ADMIN *a, RPC_KEY_PAIR *t) +{ + bool admin; + SERVER *s = a->Server; + CEDAR *c = s->Cedar; + bool is_vgs_cert = false; + + admin = a->ServerAdmin; + + FreeRpcKeyPair(t); + Zero(t, sizeof(RPC_KEY_PAIR)); + + Lock(c->lock); + { + + t->Cert = CloneX(c->ServerX); + if (admin && is_vgs_cert == false) + { + t->Key = CloneK(c->ServerK); + } + } + Unlock(c->lock); + + return ERR_NO_ERROR; +} + +// Set the server certification +UINT StSetServerCert(ADMIN *a, RPC_KEY_PAIR *t) +{ + SERVER *s = a->Server; + CEDAR *c = s->Cedar; + + SERVER_ADMIN_ONLY; + + if (t->Cert == NULL || t->Key == NULL) + { + return ERR_PROTOCOL_ERROR; + } + + if (t->Cert->is_compatible_bit == false) + { + return ERR_NOT_RSA_1024; + } + + if (CheckXandK(t->Cert, t->Key) == false) + { + return ERR_PROTOCOL_ERROR; + } + + t->Flag1 = 1; + if (t->Cert->root_cert == false) + { + if (DownloadAndSaveIntermediateCertificatesIfNecessary(t->Cert) == false) + { + t->Flag1 = 0; + } + } + + SetCedarCert(c, t->Cert, t->Key); + + ALog(a, NULL, "LA_SET_SERVER_CERT"); + + IncrementServerConfigRevision(s); + + return ERR_NO_ERROR; +} + +// Get status of connection to cluster controller +UINT StGetFarmConnectionStatus(ADMIN *a, RPC_FARM_CONNECTION_STATUS *t) +{ + SERVER *s = a->Server; + CEDAR *c = s->Cedar; + FARM_CONTROLLER *fc; + + if (s->ServerType != SERVER_TYPE_FARM_MEMBER) + { + return ERR_NOT_FARM_MEMBER; + } + + Zero(t, sizeof(RPC_FARM_CONNECTION_STATUS)); + + fc = s->FarmController; + + Lock(fc->lock); + { + if (fc->Sock != NULL) + { + t->Ip = IPToUINT(&fc->Sock->RemoteIP); + t->Port = fc->Sock->RemotePort; + } + + t->Online = fc->Online; + t->LastError = ERR_NO_ERROR; + + if (t->Online == false) + { + t->LastError = fc->LastError; + } + else + { + t->CurrentConnectedTime = fc->CurrentConnectedTime; + } + + t->StartedTime = fc->StartedTime; + t->FirstConnectedTime = fc->FirstConnectedTime; + + t->NumConnected = fc->NumConnected; + t->NumTry = fc->NumTry; + t->NumFailed = fc->NumFailed; + } + Unlock(fc->lock); + + return ERR_NO_ERROR; +} + +// Enumerate cluster members +UINT StEnumFarmMember(ADMIN *a, RPC_ENUM_FARM *t) +{ + SERVER *s = a->Server; + CEDAR *c = s->Cedar; + UINT i; + + FreeRpcEnumFarm(t); + Zero(t, sizeof(RPC_ENUM_FARM)); + + if (s->ServerType != SERVER_TYPE_FARM_CONTROLLER) + { + return ERR_NOT_FARM_CONTROLLER; + } + + Zero(t, sizeof(RPC_ENUM_FARM)); + + LockList(s->FarmMemberList); + { + t->NumFarm = LIST_NUM(s->FarmMemberList); + t->Farms = ZeroMalloc(sizeof(RPC_ENUM_FARM_ITEM) * t->NumFarm); + + for (i = 0;i < t->NumFarm;i++) + { + FARM_MEMBER *f = LIST_DATA(s->FarmMemberList, i); + RPC_ENUM_FARM_ITEM *e = &t->Farms[i]; + + e->Id = POINTER_TO_KEY(f); + e->Controller = f->Me; + + if (e->Controller) + { + e->ConnectedTime = TickToTime(c->CreatedTick); + e->Ip = 0x0100007f; + GetMachineName(e->Hostname, sizeof(e->Hostname)); + e->Point = f->Point; + e->NumSessions = Count(c->CurrentSessions); + e->NumTcpConnections = Count(c->CurrentTcpConnections); + + e->AssignedBridgeLicense = Count(c->AssignedBridgeLicense); + e->AssignedClientLicense = Count(c->AssignedClientLicense); + } + else + { + e->ConnectedTime = f->ConnectedTime; + e->Ip = f->Ip; + StrCpy(e->Hostname, sizeof(e->Hostname), f->hostname); + e->Point = f->Point; + e->NumSessions = f->NumSessions; + e->NumTcpConnections = f->NumTcpConnections; + + e->AssignedBridgeLicense = f->AssignedBridgeLicense; + e->AssignedClientLicense = f->AssignedClientLicense; + } + e->NumHubs = LIST_NUM(f->HubList); + } + } + UnlockList(s->FarmMemberList); + + return ERR_NO_ERROR; +} + +// Get cluster member information +UINT StGetFarmInfo(ADMIN *a, RPC_FARM_INFO *t) +{ + SERVER *s = a->Server; + UINT id = t->Id; + UINT i; + UINT ret = ERR_NO_ERROR; + + FreeRpcFarmInfo(t); + Zero(t, sizeof(RPC_FARM_INFO)); + + if (s->ServerType != SERVER_TYPE_FARM_CONTROLLER) + { + return ERR_NOT_FARM_CONTROLLER; + } + + LockList(s->FarmMemberList); + { + if (IsInListKey(s->FarmMemberList, id)) + { + FARM_MEMBER *f = ListKeyToPointer(s->FarmMemberList, id); + + t->Id = id; + t->Controller = f->Me; + t->Weight = f->Weight; + + LockList(f->HubList); + { + t->NumFarmHub = LIST_NUM(f->HubList); + t->FarmHubs = ZeroMalloc(sizeof(RPC_FARM_HUB) * t->NumFarmHub); + + for (i = 0;i < t->NumFarmHub;i++) + { + RPC_FARM_HUB *h = &t->FarmHubs[i]; + HUB_LIST *hh = LIST_DATA(f->HubList, i); + + h->DynamicHub = hh->DynamicHub; + StrCpy(h->HubName, sizeof(h->HubName), hh->Name); + } + } + UnlockList(f->HubList); + + if (t->Controller) + { + t->ConnectedTime = TickToTime(s->Cedar->CreatedTick); + t->Ip = 0x0100007f; + GetMachineName(t->Hostname, sizeof(t->Hostname)); + t->Point = f->Point; + + LockList(s->ServerListenerList); + { + UINT i, n; + t->NumPort = 0; + for (i = 0;i < LIST_NUM(s->ServerListenerList);i++) + { + SERVER_LISTENER *o = LIST_DATA(s->ServerListenerList, i); + if (o->Enabled) + { + t->NumPort++; + } + } + t->Ports = ZeroMalloc(sizeof(UINT) * t->NumPort); + n = 0; + for (i = 0;i < LIST_NUM(s->ServerListenerList);i++) + { + SERVER_LISTENER *o = LIST_DATA(s->ServerListenerList, i); + if (o->Enabled) + { + t->Ports[n++] = o->Port; + } + } + } + UnlockList(s->ServerListenerList); + + t->ServerCert = CloneX(s->Cedar->ServerX); + t->NumSessions = Count(s->Cedar->CurrentSessions); + t->NumTcpConnections = Count(s->Cedar->CurrentTcpConnections); + } + else + { + t->ConnectedTime = f->ConnectedTime; + t->Ip = f->Ip; + StrCpy(t->Hostname, sizeof(t->Hostname), f->hostname); + t->Point = f->Point; + t->NumPort = f->NumPort; + t->Ports = ZeroMalloc(sizeof(UINT) * t->NumPort); + Copy(t->Ports, f->Ports, sizeof(UINT) * t->NumPort); + t->ServerCert = CloneX(f->ServerCert); + t->NumSessions = f->NumSessions; + t->NumTcpConnections = f->NumTcpConnections; + } + } + else + { + ret = ERR_OBJECT_NOT_FOUND; + } + } + UnlockList(s->FarmMemberList); + + return ret; +} + +// Get clustering configuration +UINT StGetFarmSetting(ADMIN *a, RPC_FARM *t) +{ + SERVER *s; + FreeRpcFarm(t); + Zero(t, sizeof(RPC_FARM)); + + s = a->Server; + t->ServerType = s->ServerType; + t->ControllerOnly = s->ControllerOnly; + t->Weight = s->Weight; + + if (t->ServerType == SERVER_TYPE_FARM_MEMBER) + { + t->NumPort = s->NumPublicPort; + t->Ports = ZeroMalloc(sizeof(UINT) * t->NumPort); + Copy(t->Ports, s->PublicPorts, sizeof(UINT) * t->NumPort); + t->PublicIp = s->PublicIp; + StrCpy(t->ControllerName, sizeof(t->ControllerName), s->ControllerName); + t->ControllerPort = s->ControllerPort; + } + else + { + t->NumPort = 0; + t->Ports = ZeroMalloc(0); + } + + return ERR_NO_ERROR; +} + +// Set clustering configuration +UINT StSetFarmSetting(ADMIN *a, RPC_FARM *t) +{ + bool cluster_allowed = false; + + SERVER_ADMIN_ONLY; + NO_SUPPORT_FOR_BRIDGE; + + + cluster_allowed = GetServerCapsInt(a->Server, "b_support_cluster"); + + if (t->ServerType != SERVER_TYPE_STANDALONE && cluster_allowed == false) + { + // When clustering function is disabled, deny turning into clustering mode + return ERR_NOT_SUPPORTED; + } + + if (IsZero(t->MemberPassword, sizeof(t->MemberPassword))) + { + if (IsEmptyStr(t->MemberPasswordPlaintext) == false) + { + // For JSON-RPC + HashAdminPassword(t->MemberPassword, t->MemberPasswordPlaintext); + } + } + + ALog(a, NULL, "LA_SET_FARM_SETTING"); + + IncrementServerConfigRevision(a->Server); + + SiSetServerType(a->Server, t->ServerType, t->PublicIp, t->NumPort, t->Ports, + t->ControllerName, t->ControllerPort, t->MemberPassword, t->Weight, t->ControllerOnly); + + return ERR_NO_ERROR; +} + +// Set server password +UINT StSetServerPassword(ADMIN *a, RPC_SET_PASSWORD *t) +{ + SERVER_ADMIN_ONLY; + + if (IsZero(t->HashedPassword, sizeof(t->HashedPassword))) + { + // For JSON-RPC + HashAdminPassword(t->HashedPassword, t->PlainTextPassword); + } + + Copy(a->Server->HashedPassword, t->HashedPassword, SHA1_SIZE); + + ALog(a, NULL, "LA_SET_SERVER_PASSWORD"); + + IncrementServerConfigRevision(a->Server); + + return ERR_NO_ERROR; +} + +// Enable / Disable listener +UINT StEnableListener(ADMIN *a, RPC_LISTENER *t) +{ + UINT ret = ERR_NO_ERROR; + + SERVER_ADMIN_ONLY; + + + LockList(a->Server->ServerListenerList); + { + if (t->Enable) + { + if (SiEnableListener(a->Server, t->Port) == false) + { + ret = ERR_LISTENER_NOT_FOUND; + } + else + { + ALog(a, NULL, "LA_ENABLE_LISTENER", t->Port); + } + } + else + { + if (SiDisableListener(a->Server, t->Port) == false) + { + ret = ERR_LISTENER_NOT_FOUND; + } + else + { + ALog(a, NULL, "LA_DISABLE_LISTENER", t->Port); + } + } + } + UnlockList(a->Server->ServerListenerList); + + IncrementServerConfigRevision(a->Server); + + SleepThread(250); + + return ret; +} + +// Delete a listener +UINT StDeleteListener(ADMIN *a, RPC_LISTENER *t) +{ + UINT ret = ERR_NO_ERROR; + + SERVER_ADMIN_ONLY; + + + LockList(a->Server->ServerListenerList); + { + if (SiDeleteListener(a->Server, t->Port) == false) + { + ret = ERR_LISTENER_NOT_FOUND; + } + else + { + ALog(a, NULL, "LA_DELETE_LISTENER", t->Port); + + IncrementServerConfigRevision(a->Server); + } + } + UnlockList(a->Server->ServerListenerList); + + return ret; +} + +// Enumerating listeners +UINT StEnumListener(ADMIN *a, RPC_LISTENER_LIST *t) +{ + CEDAR *c = a->Server->Cedar; + UINT i; + + FreeRpcListenerList(t); + Zero(t, sizeof(RPC_LISTENER_LIST)); + + LockList(a->Server->ServerListenerList); + { + t->NumPort = LIST_NUM(a->Server->ServerListenerList); + t->Ports = ZeroMalloc(sizeof(UINT) * t->NumPort); + t->Enables = ZeroMalloc(sizeof(bool) * t->NumPort); + t->Errors = ZeroMalloc(sizeof(bool) * t->NumPort); + + for (i = 0;i < t->NumPort;i++) + { + SERVER_LISTENER *o = LIST_DATA(a->Server->ServerListenerList, i); + + t->Ports[i] = o->Port; + t->Enables[i] = o->Enabled; + if (t->Enables[i]) + { + if (o->Listener->Status == LISTENER_STATUS_TRYING) + { + t->Errors[i] = true; + } + } + } + } + UnlockList(a->Server->ServerListenerList); + + return ERR_NO_ERROR; +} + +// Create a listener +UINT StCreateListener(ADMIN *a, RPC_LISTENER *t) +{ + UINT ret = ERR_NO_ERROR; + CEDAR *c = a->Server->Cedar; + + if (t->Port == 0 || t->Port > 65535) + { + return ERR_INVALID_PARAMETER; + } + + SERVER_ADMIN_ONLY; + + LockList(a->Server->ServerListenerList); + { + if (SiAddListener(a->Server, t->Port, t->Enable) == false) + { + ret = ERR_LISTENER_ALREADY_EXISTS; + } + else + { + ALog(a, NULL, "LA_CREATE_LISTENER", t->Port); + + IncrementServerConfigRevision(a->Server); + } + } + UnlockList(a->Server->ServerListenerList); + + SleepThread(250); + + return ret; +} + +// Set UDP ports the server should listen on +UINT StSetPortsUDP(ADMIN *a, RPC_PORTS *t) +{ + UINT i; + LIST *ports, *server_ports; + + SERVER_ADMIN_ONLY; + + ports = NewIntList(true); + + for (i = 0; i < t->Num; ++i) + { + const UINT port = t->Ports[i]; + if (port < 1 || port > 65535) + { + ReleaseIntList(ports); + return ERR_INVALID_PARAMETER; + } + + AddIntDistinct(ports, port); + } + + server_ports = a->Server->PortsUDP; + + LockList(server_ports); + { + char tmp[MAX_SIZE]; + wchar_t str[MAX_SIZE]; + + for (i = 0; i < LIST_NUM(server_ports); ++i) + { + Free(LIST_DATA(server_ports, i)); + } + DeleteAll(server_ports); + + for (i = 0; i < LIST_NUM(ports); ++i) + { + const UINT port = *(UINT *)LIST_DATA(ports, i); + AddInt(server_ports, port); + } + + ProtoSetUdpPorts(a->Server->Proto, server_ports); + + IntListToStr(tmp, sizeof(tmp), server_ports, ", "); + StrToUni(str, sizeof(str), tmp); + ALog(a, NULL, "LA_SET_PORTS_UDP", str); + } + UnlockList(server_ports); + + ReleaseIntList(ports); + + IncrementServerConfigRevision(a->Server); + + return ERR_NO_ERROR; +} + +// List UDP ports the server is listening on +UINT StGetPortsUDP(ADMIN *a, RPC_PORTS *t) +{ + LIST *ports = a->Server->PortsUDP; + + FreeRpcPorts(t); + + LockList(ports); + { + t->Num = LIST_NUM(ports); + t->Ports = t->Num > 0 ? Malloc(sizeof(UINT) * t->Num) : NULL; + if (t->Ports != NULL) + { + UINT i; + for (i = 0; i < t->Num; ++i) + { + const UINT port = *(UINT *)LIST_DATA(ports, i); + t->Ports[i] = port; + } + } + } + UnlockList(ports); + + return ERR_NO_ERROR; +} + +UINT StGetProtoOptions(ADMIN *a, RPC_PROTO_OPTIONS *t) +{ + PROTO *proto = a->Server->Proto; + PROTO_CONTAINER *container, tmp; + UINT ret = ERR_NO_ERROR; + LIST *options; + + if (proto == NULL) + { + return ERR_NOT_SUPPORTED; + } + + tmp.Name = t->Protocol; + + container = Search(proto->Containers, &tmp); + if (container == NULL) + { + return ERR_INVALID_PARAMETER; + } + + options = container->Options; + LockList(options); + { + UINT i; + + t->Num = LIST_NUM(options); + t->Options = Malloc(sizeof(PROTO_OPTION) * t->Num); + + for (i = 0; i < t->Num; ++i) + { + const PROTO_OPTION *option = LIST_DATA(options, i); + PROTO_OPTION *rpc_option = &t->Options[i]; + + switch (option->Type) + { + case PROTO_OPTION_BOOL: + rpc_option->Bool = option->Bool; + break; + case PROTO_OPTION_STRING: + rpc_option->String = CopyStr(option->String); + break; + default: + Debug("StGetProtoOptions(): unhandled option type %u!\n", option->Type); + ret = ERR_INTERNAL_ERROR; + } + + if (ret == ERR_NO_ERROR) + { + rpc_option->Name = CopyStr(option->Name); + rpc_option->Type = option->Type; + } + else + { + break; + } + } + } + UnlockList(options); + + return ret; +} + +UINT StSetProtoOptions(ADMIN *a, RPC_PROTO_OPTIONS *t) +{ + PROTO *proto = a->Server->Proto; + PROTO_CONTAINER *container, tmp; + UINT ret = ERR_NO_ERROR; + bool changed = false; + LIST *options; + + SERVER_ADMIN_ONLY; + + if (proto == NULL) + { + return ERR_NOT_SUPPORTED; + } + + tmp.Name = t->Protocol; + + container = Search(proto->Containers, &tmp); + if (container == NULL) + { + return ERR_INVALID_PARAMETER; + } + + options = container->Options; + LockList(options); + { + UINT i; + for (i = 0; i < t->Num; ++i) + { + PROTO_OPTION *rpc_option = &t->Options[i]; + PROTO_OPTION *option = Search(options, rpc_option); + if (option == NULL || rpc_option->Type != option->Type) + { + ret = ERR_INVALID_PARAMETER; + break; + } + + switch (option->Type) + { + case PROTO_OPTION_BOOL: + option->Bool = rpc_option->Bool; + break; + case PROTO_OPTION_STRING: + Free(option->String); + option->String = CopyStr(rpc_option->String); + break; + default: + Debug("StSetProtoOptions(): unhandled option type %u!\n", option->Type); + ret = ERR_INTERNAL_ERROR; + } + + if (ret == ERR_NO_ERROR) + { + changed = true; + } + else + { + break; + } + } + } + UnlockList(options); + + if (changed) + { + ALog(a, NULL, "LA_SET_PROTO_OPTIONS", t->Protocol); + IncrementServerConfigRevision(a->Server); + } + + return ret; +} + +// Get server status +UINT StGetServerStatus(ADMIN *a, RPC_SERVER_STATUS *t) +{ + CEDAR *c; + UINT i; + + c = a->Server->Cedar; + + Zero(t, sizeof(RPC_SERVER_STATUS)); + + Lock(c->TrafficLock); + { + Copy(&t->Traffic, c->Traffic, sizeof(TRAFFIC)); + } + Unlock(c->TrafficLock); + + GetMemInfo(&t->MemInfo); + + t->ServerType = a->Server->ServerType; + t->NumTcpConnections = t->NumTcpConnectionsLocal = t->NumTcpConnectionsRemote = 0; + t->NumSessionsTotal = t->NumSessionsLocal = t->NumSessionsRemote = 0; + + t->NumTcpConnectionsLocal = Count(c->CurrentTcpConnections); + + if (a->Server->ServerType == SERVER_TYPE_FARM_CONTROLLER) + { + LockList(a->Server->FarmMemberList); + { + for (i = 0;i < LIST_NUM(a->Server->FarmMemberList);i++) + { + FARM_MEMBER *f = LIST_DATA(a->Server->FarmMemberList, i); + + if (f->Me == false) + { + t->NumTcpConnectionsRemote += f->NumTcpConnections; + t->NumSessionsRemote += f->NumSessions; + AddTraffic(&t->Traffic, &f->Traffic); + } + } + } + UnlockList(a->Server->FarmMemberList); + } + + t->NumMacTables = t->NumIpTables = t->NumUsers = t->NumGroups = 0; + + // The number of hubs + LockList(c->HubList); + { + t->NumHubTotal = LIST_NUM(c->HubList); + + t->NumHubStandalone = t->NumHubDynamic = t->NumHubStatic = 0; + + for (i = 0;i < LIST_NUM(c->HubList);i++) + { + HUB *h = LIST_DATA(c->HubList, i); + Lock(h->lock); + { + switch (h->Type) + { + case HUB_TYPE_STANDALONE: + t->NumHubStandalone++; + break; + + case HUB_TYPE_FARM_STATIC: + t->NumHubStatic++; + break; + + case HUB_TYPE_FARM_DYNAMIC: + t->NumHubDynamic++; + break; + } + } + + t->NumMacTables += HASH_LIST_NUM(h->MacHashTable); + t->NumIpTables += LIST_NUM(h->IpTable); + + if (h->HubDb != NULL) + { + t->NumUsers += LIST_NUM(h->HubDb->UserList); + t->NumGroups += LIST_NUM(h->HubDb->GroupList); + } + + Unlock(h->lock); + } + } + UnlockList(c->HubList); + + // The number of sessions + t->NumSessionsLocal = Count(c->CurrentSessions); + t->NumSessionsTotal = t->NumSessionsLocal + t->NumSessionsRemote; + t->NumTcpConnections = t->NumTcpConnectionsLocal + t->NumTcpConnectionsRemote; + + t->AssignedBridgeLicenses = Count(c->AssignedBridgeLicense); + t->AssignedClientLicenses = Count(c->AssignedClientLicense); + + t->AssignedBridgeLicensesTotal = a->Server->CurrentAssignedBridgeLicense; + t->AssignedClientLicensesTotal = a->Server->CurrentAssignedClientLicense; + + t->CurrentTick = Tick64(); + t->CurrentTime = SystemTime64(); + + t->StartTime = a->Server->StartTime; + + return ERR_NO_ERROR; +} + +// Get server information +UINT StGetServerInfo(ADMIN *a, RPC_SERVER_INFO *t) +{ + CEDAR *c; + OS_INFO *info; + SYSTEMTIME st; + // Validate arguments + if (a == NULL || t == NULL) + { + return ERR_INTERNAL_ERROR; + } + + FreeRpcServerInfo(t); + Zero(t, sizeof(RPC_SERVER_INFO)); + + c = a->Server->Cedar; + + GetServerProductName(a->Server, t->ServerProductName, sizeof(t->ServerProductName)); + + StrCpy(t->ServerVersionString, sizeof(t->ServerVersionString), c->VerString); + StrCpy(t->ServerBuildInfoString, sizeof(t->ServerBuildInfoString), c->BuildInfo); + t->ServerVerInt = c->Version; + t->ServerBuildInt = c->Build; + GetMachineName(t->ServerHostName, sizeof(t->ServerHostName)); + t->ServerType = c->Server->ServerType; + + Zero(&st, sizeof(st)); + st.wYear = BUILD_DATE_Y; + st.wMonth = BUILD_DATE_M; + st.wDay = BUILD_DATE_D; + st.wHour = BUILD_DATE_HO; + st.wMinute = BUILD_DATE_MI; + st.wSecond = BUILD_DATE_SE; + + t->ServerBuildDate = SystemToUINT64(&st); + StrCpy(t->ServerFamilyName, sizeof(t->ServerFamilyName), UPDATE_FAMILY_NAME); + + info = GetOsInfo(); + if (info != NULL) + { + CopyOsInfo(&t->OsInfo, info); + } + + return ERR_NO_ERROR; +} + +// Copy OS_INFO +void CopyOsInfo(OS_INFO *dst, OS_INFO *info) +{ + // Validate arguments + if (info == NULL || dst == NULL) + { + return; + } + + dst->OsType = info->OsType; + dst->OsServicePack = info->OsServicePack; + dst->OsSystemName = CopyStr(info->OsSystemName); + dst->OsProductName = CopyStr(info->OsProductName); + dst->OsVendorName = CopyStr(info->OsVendorName); + dst->OsVersion = CopyStr(info->OsVersion); + dst->KernelName = CopyStr(info->KernelName); + dst->KernelVersion = CopyStr(info->KernelVersion); +} + +// OPENVPN_SSTP_CONFIG +void InOpenVpnSstpConfig(OPENVPN_SSTP_CONFIG *t, PACK *p) +{ + // Validate arguments + if (t == NULL || p == NULL) + { + return; + } + + Zero(t, sizeof(OPENVPN_SSTP_CONFIG)); + + t->EnableOpenVPN = PackGetBool(p, "EnableOpenVPN"); + t->EnableSSTP = PackGetBool(p, "EnableSSTP"); +} +void OutOpenVpnSstpConfig(PACK *p, OPENVPN_SSTP_CONFIG *t) +{ + // Validate arguments + if (t == NULL || p == NULL) + { + return; + } + + PackAddBool(p, "EnableOpenVPN", t->EnableOpenVPN); + PackAddBool(p, "EnableSSTP", t->EnableSSTP); +} + +// DDNS_CLIENT_STATUS +void InDDnsClientStatus(DDNS_CLIENT_STATUS *t, PACK *p) +{ + // Validate arguments + if (t == NULL || p == NULL) + { + return; + } + + Zero(t, sizeof(DDNS_CLIENT_STATUS)); + + t->Err_IPv4 = PackGetInt(p, "Err_IPv4"); + t->Err_IPv6 = PackGetInt(p, "Err_IPv6"); + + PackGetStr(p, "CurrentHostName", t->CurrentHostName, sizeof(t->CurrentHostName)); + PackGetStr(p, "CurrentFqdn", t->CurrentFqdn, sizeof(t->CurrentFqdn)); + PackGetStr(p, "DnsSuffix", t->DnsSuffix, sizeof(t->DnsSuffix)); + PackGetStr(p, "CurrentIPv4", t->CurrentIPv4, sizeof(t->CurrentIPv4)); + PackGetStr(p, "CurrentIPv6", t->CurrentIPv6, sizeof(t->CurrentIPv6)); + PackGetUniStr(p, "ErrStr_IPv4", t->ErrStr_IPv4, sizeof(t->ErrStr_IPv4)); + PackGetUniStr(p, "ErrStr_IPv6", t->ErrStr_IPv6, sizeof(t->ErrStr_IPv6)); +} +void OutDDnsClientStatus(PACK *p, DDNS_CLIENT_STATUS *t) +{ + // Validate arguments + if (t == NULL || p == NULL) + { + return; + } + + PackAddInt(p, "Err_IPv4", t->Err_IPv4); + PackAddInt(p, "Err_IPv6", t->Err_IPv6); + PackAddStr(p, "CurrentHostName", t->CurrentHostName); + PackAddStr(p, "CurrentFqdn", t->CurrentFqdn); + PackAddStr(p, "DnsSuffix", t->DnsSuffix); + PackAddStr(p, "CurrentIPv4", t->CurrentIPv4); + PackAddStr(p, "CurrentIPv6", t->CurrentIPv6); + PackAddUniStr(p, "ErrStr_IPv4", t->ErrStr_IPv4); + PackAddUniStr(p, "ErrStr_IPv6", t->ErrStr_IPv6); +} + +// INTERNET_SETTING +void InRpcInternetSetting(INTERNET_SETTING *t, PACK *p) +{ + // Validate arguments + if (t == NULL || p == NULL) + { + return; + } + + t->ProxyType = PackGetInt(p, "ProxyType"); + PackGetStr(p, "ProxyHostName", t->ProxyHostName, sizeof(t->ProxyHostName)); + t->ProxyPort = PackGetInt(p, "ProxyPort"); + PackGetStr(p, "ProxyUsername", t->ProxyUsername, sizeof(t->ProxyUsername)); + PackGetStr(p, "ProxyPassword", t->ProxyPassword, sizeof(t->ProxyPassword)); + PackGetStr(p, "CustomHttpHeader", t->CustomHttpHeader, sizeof(t->CustomHttpHeader)); +} +void OutRpcInternetSetting(PACK *p, INTERNET_SETTING *t) +{ + // Validate arguments + if (t == NULL || p == NULL) + { + return; + } + + PackAddInt(p, "ProxyType", t->ProxyType); + PackAddStr(p, "ProxyHostName", t->ProxyHostName); + PackAddInt(p, "ProxyPort", t->ProxyPort); + PackAddStr(p, "ProxyUsername", t->ProxyUsername); + PackAddStr(p, "ProxyPassword", t->ProxyPassword); + PackAddStr(p, "CustomHttpHeader", t->CustomHttpHeader); +} + +// RPC_AZURE_STATUS +void InRpcAzureStatus(RPC_AZURE_STATUS *t, PACK *p) +{ + // Validate arguments + if (t == NULL || p == NULL) + { + return; + } + + Zero(t, sizeof(RPC_AZURE_STATUS)); + + t->IsConnected = PackGetBool(p, "IsConnected"); + t->IsEnabled = PackGetBool(p, "IsEnabled"); +} +void OutRpcAzureStatus(PACK *p, RPC_AZURE_STATUS *t) +{ + // Validate arguments + if (t == NULL || p == NULL) + { + return; + } + + PackAddBool(p, "IsConnected", t->IsConnected); + PackAddBool(p, "IsEnabled", t->IsEnabled); +} + +// RPC_SPECIAL_LISTENER +void InRpcSpecialListener(RPC_SPECIAL_LISTENER *t, PACK *p) +{ + // Validate arguments + if (t == NULL || p == NULL) + { + return; + } + + Zero(t, sizeof(RPC_SPECIAL_LISTENER)); + + t->VpnOverIcmpListener = PackGetBool(p, "VpnOverIcmpListener"); + t->VpnOverDnsListener = PackGetBool(p, "VpnOverDnsListener"); +} +void OutRpcSpecialListener(PACK *p, RPC_SPECIAL_LISTENER *t) +{ + // Validate arguments + if (t == NULL || p == NULL) + { + return; + } + + PackAddBool(p, "VpnOverIcmpListener", t->VpnOverIcmpListener); + PackAddBool(p, "VpnOverDnsListener", t->VpnOverDnsListener); +} + + +// ETHERIP_ID +void InEtherIpId(ETHERIP_ID *t, PACK *p) +{ + // Validate arguments + if (t == NULL || p == NULL) + { + return; + } + + Zero(t, sizeof(ETHERIP_ID)); + + PackGetStr(p, "Id", t->Id, sizeof(t->Id)); + PackGetStr(p, "HubName", t->HubName, sizeof(t->HubName)); + PackGetStr(p, "UserName", t->UserName, sizeof(t->UserName)); + PackGetStr(p, "Password", t->Password, sizeof(t->Password)); +} +void OutEtherIpId(PACK *p, ETHERIP_ID *t) +{ + // Validate arguments + if (t == NULL || p == NULL) + { + return; + } + + PackAddStr(p, "Id", t->Id); + PackAddStr(p, "HubName", t->HubName); + PackAddStr(p, "UserName", t->UserName); + PackAddStr(p, "Password", t->Password); +} + +// RPC_ENUM_ETHERIP_ID +void InRpcEnumEtherIpId(RPC_ENUM_ETHERIP_ID *t, PACK *p) +{ + UINT i; + // Validate arguments + if (t == NULL || p == NULL) + { + return; + } + + Zero(t, sizeof(RPC_ENUM_ETHERIP_ID)); + + t->NumItem = PackGetInt(p, "NumItem"); + t->IdList = ZeroMalloc(sizeof(ETHERIP_ID) * t->NumItem); + + for (i = 0;i < t->NumItem;i++) + { + ETHERIP_ID *e = &t->IdList[i]; + + PackGetStrEx(p, "Id", e->Id, sizeof(e->Id), i); + PackGetStrEx(p, "HubName", e->HubName, sizeof(e->HubName), i); + PackGetStrEx(p, "UserName", e->UserName, sizeof(e->UserName), i); + PackGetStrEx(p, "Password", e->Password, sizeof(e->Password), i); + } +} +void OutRpcEnumEtherIpId(PACK *p, RPC_ENUM_ETHERIP_ID *t) +{ + UINT i; + // Validate arguments + if (p == NULL || t == NULL) + { + return; + } + + PackAddInt(p, "NumItem", t->NumItem); + + PackSetCurrentJsonGroupName(p, "Settings"); + for (i = 0;i < t->NumItem;i++) + { + ETHERIP_ID *e = &t->IdList[i]; + + PackAddStrEx(p, "Id", e->Id, i, t->NumItem); + PackAddStrEx(p, "HubName", e->HubName, i, t->NumItem); + PackAddStrEx(p, "UserName", e->UserName, i, t->NumItem); + PackAddStrEx(p, "Password", e->Password, i, t->NumItem); + } + PackSetCurrentJsonGroupName(p, NULL); +} +void FreeRpcEnumEtherIpId(RPC_ENUM_ETHERIP_ID *t) +{ + // Validate arguments + if (t == NULL) + { + return; + } + + Free(t->IdList); +} + +// IPSEC_SERVICES +void InIPsecServices(IPSEC_SERVICES *t, PACK *p) +{ + // Validate arguments + if (t == NULL || p == NULL) + { + return; + } + + Zero(t, sizeof(IPSEC_SERVICES)); + + t->L2TP_Raw = PackGetBool(p, "L2TP_Raw"); + t->L2TP_IPsec = PackGetBool(p, "L2TP_IPsec"); + t->EtherIP_IPsec = PackGetBool(p, "EtherIP_IPsec"); + + PackGetStr(p, "IPsec_Secret", t->IPsec_Secret, sizeof(t->IPsec_Secret)); + PackGetStr(p, "L2TP_DefaultHub", t->L2TP_DefaultHub, sizeof(t->L2TP_DefaultHub)); +} +void OutIPsecServices(PACK *p, IPSEC_SERVICES *t) +{ + // Validate arguments + if (t == NULL || p == NULL) + { + return; + } + + PackAddBool(p, "L2TP_Raw", t->L2TP_Raw); + PackAddBool(p, "L2TP_IPsec", t->L2TP_IPsec); + PackAddBool(p, "EtherIP_IPsec", t->EtherIP_IPsec); + + PackAddStr(p, "IPsec_Secret", t->IPsec_Secret); + PackAddStr(p, "L2TP_DefaultHub", t->L2TP_DefaultHub); +} + +// RPC_WINVER +void InRpcWinVer(RPC_WINVER *t, PACK *p) +{ + // Validate arguments + if (t == NULL || p == NULL) + { + return; + } + + Zero(t, sizeof(RPC_WINVER)); + + t->IsWindows = PackGetBool(p, "V_IsWindows"); + t->IsNT = PackGetBool(p, "V_IsNT"); + t->IsServer = PackGetBool(p, "V_IsServer"); + t->IsBeta = PackGetBool(p, "V_IsBeta"); + t->VerMajor = PackGetInt(p, "V_VerMajor"); + t->VerMinor = PackGetInt(p, "V_VerMinor"); + t->Build = PackGetInt(p, "V_Build"); + t->ServicePack = PackGetInt(p, "V_ServicePack"); + PackGetStr(p, "V_Title", t->Title, sizeof(t->Title)); +} +void OutRpcWinVer(PACK *p, RPC_WINVER *t) +{ + // Validate arguments + if (t == NULL || p == NULL) + { + return; + } + + PackAddBool(p, "V_IsWindows", t->IsWindows); + PackAddBool(p, "V_IsNT", t->IsNT); + PackAddBool(p, "V_IsServer", t->IsServer); + PackAddBool(p, "V_IsBeta", t->IsBeta); + PackAddInt(p, "V_VerMajor", t->VerMajor); + PackAddInt(p, "V_VerMinor", t->VerMinor); + PackAddInt(p, "V_Build", t->Build); + PackAddInt(p, "V_ServicePack", t->ServicePack); + PackAddStr(p, "V_Title", t->Title); +} + +// RPC_MSG +void InRpcMsg(RPC_MSG *t, PACK *p) +{ + UINT size; + char *utf8; + // Validate arguments + if (t == NULL || p == NULL) + { + return; + } + + Zero(t, sizeof(RPC_MSG)); + + PackGetStr(p, "HubName", t->HubName, sizeof(t->HubName)); + size = PackGetDataSize(p, "Msg"); + utf8 = ZeroMalloc(size + 8); + PackGetData(p, "Msg", utf8); + t->Msg = CopyUtfToUni(utf8); + Free(utf8); +} +void OutRpcMsg(PACK *p, RPC_MSG *t) +{ + UINT size; + char *utf8; + // Validate arguments + if (t == NULL || p == NULL) + { + return; + } + + PackAddStr(p, "HubName", t->HubName); + utf8 = CopyUniToUtf(t->Msg); + size = StrLen(utf8); + PackAddData(p, "Msg", utf8, size); + Free(utf8); +} +void FreeRpcMsg(RPC_MSG *t) +{ + // Validate arguments + if (t == NULL) + { + return; + } + + Free(t->Msg); +} + +// RPC_ENUM_ETH_VLAN +void InRpcEnumEthVLan(RPC_ENUM_ETH_VLAN *t, PACK *p) +{ + UINT i; + // Validate arguments + if (t == NULL || p == NULL) + { + return; + } + + Zero(t, sizeof(RPC_ENUM_ETH_VLAN)); + + t->NumItem = PackGetIndexCount(p, "DeviceName"); + t->Items = ZeroMalloc(sizeof(RPC_ENUM_ETH_VLAN_ITEM) * t->NumItem); + + for (i = 0;i < t->NumItem;i++) + { + RPC_ENUM_ETH_VLAN_ITEM *e = &t->Items[i]; + + PackGetStrEx(p, "DeviceName", e->DeviceName, sizeof(e->DeviceName), i); + PackGetStrEx(p, "Guid", e->Guid, sizeof(e->Guid), i); + PackGetStrEx(p, "DeviceInstanceId", e->DeviceInstanceId, sizeof(e->DeviceInstanceId), i); + PackGetStrEx(p, "DriverName", e->DriverName, sizeof(e->DriverName), i); + PackGetStrEx(p, "DriverType", e->DriverType, sizeof(e->DriverType), i); + e->Support = PackGetBoolEx(p, "Support", i); + e->Enabled = PackGetBoolEx(p, "Enabled", i); + } +} +void OutRpcEnumEthVLan(PACK *p, RPC_ENUM_ETH_VLAN *t) +{ + UINT i; + // Validate arguments + if (t == NULL || p == NULL) + { + return; + } + + PackSetCurrentJsonGroupName(p, "Devices"); + for (i = 0;i < t->NumItem;i++) + { + RPC_ENUM_ETH_VLAN_ITEM *e = &t->Items[i]; + + PackAddStrEx(p, "DeviceName", e->DeviceName, i, t->NumItem); + PackAddStrEx(p, "Guid", e->Guid, i, t->NumItem); + PackAddStrEx(p, "DeviceInstanceId", e->DeviceInstanceId, i, t->NumItem); + PackAddStrEx(p, "DriverName", e->DriverName, i, t->NumItem); + PackAddStrEx(p, "DriverType", e->DriverType, i, t->NumItem); + PackAddBoolEx(p, "Support", e->Support, i, t->NumItem); + PackAddBoolEx(p, "Enabled", e->Enabled, i, t->NumItem); + } + PackSetCurrentJsonGroupName(p, NULL); +} +void FreeRpcEnumEthVLan(RPC_ENUM_ETH_VLAN *t) +{ + // Validate arguments + if (t == NULL) + { + return; + } + + Free(t->Items); +} + +// RPC_ENUM_LOG_FILE +void InRpcEnumLogFile(RPC_ENUM_LOG_FILE *t, PACK *p) +{ + UINT i; + // Validate arguments + if (t == NULL || p == NULL) + { + return; + } + + Zero(t, sizeof(RPC_ENUM_LOG_FILE)); + t->NumItem = PackGetInt(p, "NumItem"); + t->Items = ZeroMalloc(sizeof(RPC_ENUM_LOG_FILE_ITEM) * t->NumItem); + + for (i = 0;i < t->NumItem;i++) + { + RPC_ENUM_LOG_FILE_ITEM *e = &t->Items[i]; + + PackGetStrEx(p, "FilePath", e->FilePath, sizeof(e->FilePath), i); + PackGetStrEx(p, "ServerName", e->ServerName, sizeof(e->ServerName), i); + e->FileSize = PackGetIntEx(p, "FileSize", i); + e->UpdatedTime = PackGetInt64Ex(p, "UpdatedTime", i); + } +} +void OutRpcEnumLogFile(PACK *p, RPC_ENUM_LOG_FILE *t) +{ + UINT i; + // Validate arguments + if (t == NULL || p == NULL) + { + return; + } + + PackAddInt(p, "NumItem", t->NumItem); + + PackSetCurrentJsonGroupName(p, "LogFiles"); + for (i = 0;i < t->NumItem;i++) + { + RPC_ENUM_LOG_FILE_ITEM *e = &t->Items[i]; + + PackAddStrEx(p, "FilePath", e->FilePath, i, t->NumItem); + PackAddStrEx(p, "ServerName", e->ServerName, i, t->NumItem); + PackAddIntEx(p, "FileSize", e->FileSize, i, t->NumItem); + PackAddTime64Ex(p, "UpdatedTime", e->UpdatedTime, i, t->NumItem); + } + PackSetCurrentJsonGroupName(p, NULL); +} +void FreeRpcEnumLogFile(RPC_ENUM_LOG_FILE *t) +{ + // Validate arguments + if (t == NULL) + { + return; + } + + Free(t->Items); +} +void AdjoinRpcEnumLogFile(RPC_ENUM_LOG_FILE *t, RPC_ENUM_LOG_FILE *src) +{ + LIST *o; + UINT i; + // Validate arguments + if (t == NULL || src == NULL) + { + return; + } + + o = NewListFast(CmpLogFile); + + for (i = 0;i < t->NumItem;i++) + { + RPC_ENUM_LOG_FILE_ITEM *e = &t->Items[i]; + LOG_FILE *f = ZeroMalloc(sizeof(LOG_FILE)); + + f->FileSize = e->FileSize; + StrCpy(f->Path, sizeof(f->Path), e->FilePath); + StrCpy(f->ServerName, sizeof(f->ServerName), e->ServerName); + f->UpdatedTime = e->UpdatedTime; + + Add(o, f); + } + + for (i = 0;i < src->NumItem;i++) + { + RPC_ENUM_LOG_FILE_ITEM *e = &src->Items[i]; + LOG_FILE *f = ZeroMalloc(sizeof(LOG_FILE)); + + f->FileSize = e->FileSize; + StrCpy(f->Path, sizeof(f->Path), e->FilePath); + StrCpy(f->ServerName, sizeof(f->ServerName), e->ServerName); + f->UpdatedTime = e->UpdatedTime; + + Add(o, f); + } + + FreeRpcEnumLogFile(t); + + Sort(o); + + Zero(t, sizeof(RPC_ENUM_LOG_FILE)); + t->NumItem = LIST_NUM(o); + t->Items = ZeroMalloc(sizeof(RPC_ENUM_LOG_FILE_ITEM) * t->NumItem); + + for (i = 0;i < t->NumItem;i++) + { + LOG_FILE *f = LIST_DATA(o, i); + RPC_ENUM_LOG_FILE_ITEM *e = &t->Items[i]; + + StrCpy(e->FilePath, sizeof(e->FilePath), f->Path); + StrCpy(e->ServerName, sizeof(e->ServerName), f->ServerName); + e->FileSize = f->FileSize; + e->UpdatedTime = f->UpdatedTime; + } + + FreeEnumLogFile(o); +} + +// RPC_READ_LOG_FILE +void InRpcReadLogFile(RPC_READ_LOG_FILE *t, PACK *p) +{ + // Validate arguments + if (t == NULL || p == NULL) + { + return; + } + + Zero(t, sizeof(RPC_READ_LOG_FILE)); + PackGetStr(p, "FilePath", t->FilePath, sizeof(t->FilePath)); + PackGetStr(p, "ServerName", t->ServerName, sizeof(t->ServerName)); + t->Offset = PackGetInt(p, "Offset"); + + t->Buffer = PackGetBuf(p, "Buffer"); +} +void OutRpcReadLogFile(PACK *p, RPC_READ_LOG_FILE *t) +{ + // Validate arguments + if (p == NULL || t == NULL) + { + return; + } + + PackAddStr(p, "FilePath", t->FilePath); + PackAddStr(p, "ServerName", t->ServerName); + PackAddInt(p, "Offset", t->Offset); + + if (t->Buffer != NULL) + { + PackAddBuf(p, "Buffer", t->Buffer); + } +} +void FreeRpcReadLogFile(RPC_READ_LOG_FILE *t) +{ + // Validate arguments + if (t == NULL) + { + return; + } + + if (t->Buffer != NULL) + { + FreeBuf(t->Buffer); + } +} + +// RPC_AC_LIST +void InRpcAcList(RPC_AC_LIST *t, PACK *p) +{ + UINT i; + LIST *o; + UINT num; + // Validate arguments + if (t == NULL || p == NULL) + { + return; + } + + Zero(t, sizeof(RPC_AC_LIST)); + o = NewAcList(); + + PackGetStr(p, "HubName", t->HubName, sizeof(t->HubName)); + num = PackGetIndexCount(p, "IpAddress"); + + for (i = 0;i < num;i++) + { + AC *ac = ZeroMalloc(sizeof(AC)); + + ac->Id = PackGetIntEx(p, "Id", i); + ac->Deny = PackGetBoolEx(p, "Deny", i); + PackGetIpEx(p, "IpAddress", &ac->IpAddress, i); + ac->Masked = PackGetBoolEx(p, "Masked", i); + + if (ac->Masked) + { + PackGetIpEx(p, "SubnetMask", &ac->SubnetMask, i); + } + + ac->Priority = PackGetIntEx(p, "Priority", i); + + AddAc(o, ac); + + Free(ac); + } + + t->o = o; +} +void OutRpcAcList(PACK *p, RPC_AC_LIST *t) +{ + UINT i, num; + LIST *o; + // Validate arguments + if (t == NULL || p == NULL) + { + return; + } + + o = t->o; + num = LIST_NUM(o); + + PackAddInt(p, "NumItem", num); + + PackAddStr(p, "HubName", t->HubName); + + PackSetCurrentJsonGroupName(p, "ACList"); + for (i = 0;i < num;i++) + { + AC *ac = LIST_DATA(o, i); + + PackAddIntEx(p, "Id", ac->Id, i, num); + PackAddBoolEx(p, "Deny", ac->Deny, i, num); + PackAddIpEx(p, "IpAddress", &ac->IpAddress, i, num); + PackAddBoolEx(p, "Masked", ac->Masked, i, num); + + PackAddIpEx(p, "SubnetMask", &ac->SubnetMask, i, num); + + PackAddIntEx(p, "Priority", ac->Priority, i, num); + } + PackSetCurrentJsonGroupName(p, NULL); +} +void FreeRpcAcList(RPC_AC_LIST *t) +{ + // Validate arguments + if (t == NULL) + { + return; + } + + FreeAcList(t->o); +} + +// RPC_INT +void InRpcInt(RPC_INT *t, PACK *p) +{ + // Validate arguments + if (t == NULL || p == NULL) + { + return; + } + + Zero(t, sizeof(RPC_INT)); + t->IntValue = PackGetInt(p, "IntValue"); +} +void OutRpcInt(PACK *p, RPC_INT *t) +{ + // Validate arguments + if (t == NULL || p == NULL) + { + return; + } + + PackAddInt(p, "IntValue", t->IntValue); +} + +// RPC_ENUM_CRL +void InRpcEnumCrl(RPC_ENUM_CRL *t, PACK *p) +{ + UINT i; + // Validate arguments + if (t == NULL || p == NULL) + { + return; + } + + Zero(t, sizeof(RPC_ENUM_CRL)); + PackGetStr(p, "HubName", t->HubName, sizeof(t->HubName)); + t->NumItem = PackGetInt(p, "NumItem"); + + t->Items = ZeroMalloc(sizeof(RPC_ENUM_CRL_ITEM) * t->NumItem); + for (i = 0;i < t->NumItem;i++) + { + RPC_ENUM_CRL_ITEM *e = &t->Items[i]; + + e->Key = PackGetIntEx(p, "Key", i); + PackGetUniStrEx(p, "CrlInfo", e->CrlInfo, sizeof(e->CrlInfo), i); + } +} +void OutRpcEnumCrl(PACK *p, RPC_ENUM_CRL *t) +{ + UINT i; + // Validate arguments + if (t == NULL || p == NULL) + { + return; + } + + PackAddStr(p, "HubName", t->HubName); + PackAddInt(p, "NumItem", t->NumItem); + + PackSetCurrentJsonGroupName(p, "CRLList"); + for (i = 0;i < t->NumItem;i++) + { + RPC_ENUM_CRL_ITEM *e = &t->Items[i]; + + PackAddIntEx(p, "Key", e->Key, i, t->NumItem); + PackAddUniStrEx(p, "CrlInfo", e->CrlInfo, i, t->NumItem); + } + PackSetCurrentJsonGroupName(p, NULL); +} +void FreeRpcEnumCrl(RPC_ENUM_CRL *t) +{ + // Validate arguments + if (t == NULL) + { + return; + } + + Free(t->Items); +} + +// RPC_CRL +void InRpcCrl(RPC_CRL *t, PACK *p) +{ + BUF *b; + NAME *n; + wchar_t tmp[MAX_SIZE]; + // Validate arguments + if (t == NULL || p == NULL) + { + return; + } + + Zero(t, sizeof(RPC_CRL)); + PackGetStr(p, "HubName", t->HubName, sizeof(t->HubName)); + t->Key = PackGetInt(p, "Key"); + b = PackGetBuf(p, "Serial"); + t->Crl = ZeroMalloc(sizeof(CRL)); + if (b != NULL) + { + t->Crl->Serial = NewXSerial(b->Buf, b->Size); + FreeBuf(b); + } + t->Crl->Name = ZeroMalloc(sizeof(NAME)); + n = t->Crl->Name; + if (PackGetUniStr(p, "CommonName", tmp, sizeof(tmp))) + { + n->CommonName = CopyUniStr(tmp); + } + if (PackGetUniStr(p, "Organization", tmp, sizeof(tmp))) + { + n->Organization = CopyUniStr(tmp); + } + if (PackGetUniStr(p, "Unit", tmp, sizeof(tmp))) + { + n->Unit = CopyUniStr(tmp); + } + if (PackGetUniStr(p, "Country", tmp, sizeof(tmp))) + { + n->Country = CopyUniStr(tmp); + } + if (PackGetUniStr(p, "State", tmp, sizeof(tmp))) + { + n->State = CopyUniStr(tmp); + } + if (PackGetUniStr(p, "Local", tmp, sizeof(tmp))) + { + n->Local = CopyUniStr(tmp); + } + if (PackGetDataSize(p, "DigestMD5") == MD5_SIZE) + { + PackGetData(p, "DigestMD5", t->Crl->DigestMD5); + } + if (PackGetDataSize(p, "DigestSHA1") == SHA1_SIZE) + { + PackGetData(p, "DigestSHA1", t->Crl->DigestSHA1); + } +} +void OutRpcCrl(PACK *p, RPC_CRL *t) +{ + NAME *n; + // Validate arguments + if (p == NULL || t == NULL) + { + return; + } + + PackAddStr(p, "HubName", t->HubName); + PackAddInt(p, "Key", t->Key); + + if (t->Crl == NULL) + { + return; + } + + if (t->Crl->Serial != NULL) + { + PackAddData(p, "Serial", t->Crl->Serial->data, t->Crl->Serial->size); + } + n = t->Crl->Name; + if (n->CommonName != NULL) + { + PackAddUniStr(p, "CommonName", n->CommonName); + } + if (n->Organization != NULL) + { + PackAddUniStr(p, "Organization", n->Organization); + } + if (n->Unit != NULL) + { + PackAddUniStr(p, "Unit", n->Unit); + } + if (n->Country != NULL) + { + PackAddUniStr(p, "Country", n->Country); + } + if (n->State != NULL) + { + PackAddUniStr(p, "State", n->State); + } + if (n->Local != NULL) + { + PackAddUniStr(p, "Local", n->Local); + } + if (IsZero(t->Crl->DigestMD5, MD5_SIZE) == false) + { + PackAddData(p, "DigestMD5", t->Crl->DigestMD5, MD5_SIZE); + } + if (IsZero(t->Crl->DigestSHA1, SHA1_SIZE) == false) + { + PackAddData(p, "DigestSHA1", t->Crl->DigestSHA1, SHA1_SIZE); + } +} +void FreeRpcCrl(RPC_CRL *t) +{ + // Validate arguments + if (t == NULL) + { + return; + } + + FreeCrl(t->Crl); +} + +// RPC_ENUM_L3TABLE +void InRpcEnumL3Table(RPC_ENUM_L3TABLE *t, PACK *p) +{ + UINT i; + // Validate arguments + if (t == NULL || p == NULL) + { + return; + } + + Zero(t, sizeof(RPC_ENUM_L3TABLE)); + t->NumItem = PackGetInt(p, "NumItem"); + PackGetStr(p, "Name", t->Name, sizeof(t->Name)); + t->Items = ZeroMalloc(sizeof(RPC_L3TABLE) * t->NumItem); + + for (i = 0;i < t->NumItem;i++) + { + RPC_L3TABLE *e = &t->Items[i]; + + e->NetworkAddress = PackGetIp32Ex(p, "NetworkAddress", i); + e->SubnetMask = PackGetIp32Ex(p, "SubnetMask", i); + e->GatewayAddress = PackGetIp32Ex(p, "GatewayAddress", i); + e->Metric = PackGetIntEx(p, "Metric", i); + } +} +void OutRpcEnumL3Table(PACK *p, RPC_ENUM_L3TABLE *t) +{ + UINT i; + // Validate arguments + if (p == NULL || t == NULL) + { + return; + } + + PackAddInt(p, "NumItem", t->NumItem); + PackAddStr(p, "Name", t->Name); + + PackSetCurrentJsonGroupName(p, "L3Table"); + for (i = 0;i < t->NumItem;i++) + { + RPC_L3TABLE *e = &t->Items[i]; + + PackAddIp32Ex(p, "NetworkAddress", e->NetworkAddress, i, t->NumItem); + PackAddIp32Ex(p, "SubnetMask", e->SubnetMask, i, t->NumItem); + PackAddIp32Ex(p, "GatewayAddress", e->GatewayAddress, i, t->NumItem); + PackAddIntEx(p, "Metric", e->Metric, i, t->NumItem); + } + PackSetCurrentJsonGroupName(p, NULL); +} +void FreeRpcEnumL3Table(RPC_ENUM_L3TABLE *t) +{ + Free(t->Items); +} + +// RPC_L3TABLE +void InRpcL3Table(RPC_L3TABLE *t, PACK *p) +{ + // Validate arguments + if (t == NULL || p == NULL) + { + return; + } + + Zero(t, sizeof(RPC_L3TABLE)); + PackGetStr(p, "Name", t->Name, sizeof(t->Name)); + t->NetworkAddress = PackGetIp32(p, "NetworkAddress"); + t->SubnetMask = PackGetIp32(p, "SubnetMask"); + t->GatewayAddress = PackGetIp32(p, "GatewayAddress"); + t->Metric = PackGetInt(p, "Metric"); +} +void OutRpcL3Table(PACK *p, RPC_L3TABLE *t) +{ + // Validate arguments + if (p == NULL || t == NULL) + { + return; + } + + PackAddStr(p, "Name", t->Name); + PackAddIp32(p, "NetworkAddress", t->NetworkAddress); + PackAddIp32(p, "SubnetMask", t->SubnetMask); + PackAddIp32(p, "GatewayAddress", t->GatewayAddress); + PackAddInt(p, "Metric", t->Metric); +} + +// RPC_ENUM_L3IF +void InRpcEnumL3If(RPC_ENUM_L3IF *t, PACK *p) +{ + UINT i; + // Validate arguments + if (t == NULL || p == NULL) + { + return; + } + + Zero(t, sizeof(RPC_ENUM_L3IF)); + t->NumItem = PackGetInt(p, "NumItem"); + PackGetStr(p, "Name", t->Name, sizeof(t->Name)); + t->Items = ZeroMalloc(sizeof(RPC_L3IF) * t->NumItem); + + for (i = 0;i < t->NumItem;i++) + { + RPC_L3IF *f = &t->Items[i]; + + PackGetStrEx(p, "HubName", f->HubName, sizeof(f->HubName), i); + f->IpAddress = PackGetIp32Ex(p, "IpAddress", i); + f->SubnetMask = PackGetIp32Ex(p, "SubnetMask", i); + } +} +void OutRpcEnumL3If(PACK *p, RPC_ENUM_L3IF *t) +{ + UINT i; + // Validate arguments + if (p == NULL || t == NULL) + { + return; + } + + PackAddInt(p, "NumItem", t->NumItem); + PackAddStr(p, "Name", t->Name); + + PackSetCurrentJsonGroupName(p, "L3IFList"); + for (i = 0;i < t->NumItem;i++) + { + RPC_L3IF *f = &t->Items[i]; + + PackAddStrEx(p, "HubName", f->HubName, i, t->NumItem); + PackAddIp32Ex(p, "IpAddress", f->IpAddress, i, t->NumItem); + PackAddIp32Ex(p, "SubnetMask", f->SubnetMask, i, t->NumItem); + } + PackSetCurrentJsonGroupName(p, NULL); +} +void FreeRpcEnumL3If(RPC_ENUM_L3IF *t) +{ + // Validate arguments + if (t == NULL) + { + return; + } + + Free(t->Items); +} + +// RPC_L3IF +void InRpcL3If(RPC_L3IF *t, PACK *p) +{ + // Validate arguments + if (t == NULL || p == NULL) + { + return; + } + + Zero(t, sizeof(RPC_L3IF)); + PackGetStr(p, "Name", t->Name, sizeof(t->Name)); + PackGetStr(p, "HubName", t->HubName, sizeof(t->HubName)); + t->IpAddress = PackGetIp32(p, "IpAddress"); + t->SubnetMask = PackGetIp32(p, "SubnetMask"); +} +void OutRpcL3If(PACK *p, RPC_L3IF *t) +{ + // Validate arguments + if (p == NULL || t == NULL) + { + return; + } + + PackAddStr(p, "Name", t->Name); + PackAddStr(p, "HubName", t->HubName); + PackAddIp32(p, "IpAddress", t->IpAddress); + PackAddIp32(p, "SubnetMask", t->SubnetMask); +} + +// RPC_L3SW +void InRpcL3Sw(RPC_L3SW *t, PACK *p) +{ + // Validate arguments + if (t == NULL || p == NULL) + { + return; + } + + Zero(t, sizeof(RPC_L3SW)); + PackGetStr(p, "Name", t->Name, sizeof(t->Name)); +} +void OutRpcL3Sw(PACK *p, RPC_L3SW *t) +{ + // Validate arguments + if (p == NULL || t == NULL) + { + return; + } + + PackAddStr(p, "Name", t->Name); +} + +// RPC_ENUM_L3SW +void InRpcEnumL3Sw(RPC_ENUM_L3SW *t, PACK *p) +{ + UINT i; + // Validate arguments + if (t == NULL || p == NULL) + { + return; + } + + Zero(t, sizeof(RPC_ENUM_L3SW)); + t->NumItem = PackGetInt(p, "NumItem"); + t->Items = ZeroMalloc(sizeof(RPC_ENUM_L3SW_ITEM) * t->NumItem); + + for (i = 0;i < t->NumItem;i++) + { + RPC_ENUM_L3SW_ITEM *s = &t->Items[i]; + + PackGetStrEx(p, "Name", s->Name, sizeof(s->Name), i); + s->NumInterfaces = PackGetIntEx(p, "NumInterfaces", i); + s->NumTables = PackGetIntEx(p, "NumTables", i); + s->Active = PackGetBoolEx(p, "Active", i); + s->Online = PackGetBoolEx(p, "Online", i); + } +} +void OutRpcEnumL3Sw(PACK *p, RPC_ENUM_L3SW *t) +{ + UINT i; + // Validate arguments + if (p == NULL || t == NULL) + { + return; + } + + PackAddInt(p, "NumItem", t->NumItem); + + PackSetCurrentJsonGroupName(p, "L3SWList"); + for (i = 0;i < t->NumItem;i++) + { + RPC_ENUM_L3SW_ITEM *s = &t->Items[i]; + + PackAddStrEx(p, "Name", s->Name, i, t->NumItem); + PackAddIntEx(p, "NumInterfaces", s->NumInterfaces, i, t->NumItem); + PackAddIntEx(p, "NumTables", s->NumTables, i, t->NumItem); + PackAddBoolEx(p, "Active", s->Active, i, t->NumItem); + PackAddBoolEx(p, "Online", s->Online, i, t->NumItem); + } + PackSetCurrentJsonGroupName(p, NULL); +} +void FreeRpcEnumL3Sw(RPC_ENUM_L3SW *t) +{ + // Validate arguments + if (t == NULL) + { + return; + } + + Free(t->Items); +} + +// RPC_ENUM_ETH +void InRpcEnumEth(RPC_ENUM_ETH *t, PACK *p) +{ + UINT i; + // Validate arguments + if (t == NULL || p == NULL) + { + return; + } + + Zero(t, sizeof(RPC_ENUM_ETH)); + t->NumItem = PackGetInt(p, "NumItem"); + t->Items = ZeroMalloc(sizeof(RPC_ENUM_ETH_ITEM) * t->NumItem); + + for (i = 0;i < t->NumItem;i++) + { + RPC_ENUM_ETH_ITEM *e = &t->Items[i]; + PackGetStrEx(p, "DeviceName", e->DeviceName, sizeof(e->DeviceName), i); + PackGetUniStrEx(p, "NetworkConnectionName", e->NetworkConnectionName, sizeof(e->NetworkConnectionName), i); + } +} +void OutRpcEnumEth(PACK *p, RPC_ENUM_ETH *t) +{ + UINT i; + // Validate arguments + if (p == NULL || t == NULL) + { + return; + } + + PackAddInt(p, "NumItem", t->NumItem); + + PackSetCurrentJsonGroupName(p, "EthList"); + for (i = 0;i < t->NumItem;i++) + { + RPC_ENUM_ETH_ITEM *e = &t->Items[i]; + PackAddStrEx(p, "DeviceName", e->DeviceName, i, t->NumItem); + PackAddUniStrEx(p, "NetworkConnectionName", e->NetworkConnectionName, i, t->NumItem); + } + PackSetCurrentJsonGroupName(p, NULL); +} +void FreeRpcEnumEth(RPC_ENUM_ETH *t) +{ + // Validate arguments + if (t == NULL) + { + return; + } + + Free(t->Items); +} + +// RPC_LOCALBRIDGE +void InRpcLocalBridge(RPC_LOCALBRIDGE *t, PACK *p) +{ + // Validate arguments + if (t == NULL || p == NULL) + { + return; + } + + Zero(t, sizeof(RPC_LOCALBRIDGE)); + PackGetStr(p, "DeviceName", t->DeviceName, sizeof(t->DeviceName)); + PackGetStr(p, "HubNameLB", t->HubName, sizeof(t->HubName)); + t->TapMode = PackGetBool(p, "TapMode"); +} +void OutRpcLocalBridge(PACK *p, RPC_LOCALBRIDGE *t) +{ + // Validate arguments + if (t == NULL || p == NULL) + { + return; + } + + PackAddStr(p, "DeviceName", t->DeviceName); + PackAddStr(p, "HubNameLB", t->HubName); + PackAddBool(p, "TapMode", t->TapMode); +} + +// RPC_ENUM_LOCALBRIDGE +void InRpcEnumLocalBridge(RPC_ENUM_LOCALBRIDGE *t, PACK *p) +{ + UINT i; + // Validate arguments + if (t == NULL || p == NULL) + { + return; + } + + Zero(t, sizeof(RPC_ENUM_LOCALBRIDGE)); + t->NumItem = PackGetInt(p, "NumItem"); + t->Items = ZeroMalloc(sizeof(RPC_LOCALBRIDGE) * t->NumItem); + + for (i = 0;i < t->NumItem;i++) + { + RPC_LOCALBRIDGE *e = &t->Items[i]; + + PackGetStrEx(p, "DeviceName", e->DeviceName, sizeof(e->DeviceName), i); + PackGetStrEx(p, "HubNameLB", e->HubName, sizeof(e->HubName), i); + e->Online = PackGetBoolEx(p, "Online", i); + e->Active = PackGetBoolEx(p, "Active", i); + e->TapMode = PackGetBoolEx(p, "TapMode", i); + } +} +void OutRpcEnumLocalBridge(PACK *p, RPC_ENUM_LOCALBRIDGE *t) +{ + UINT i; + // Validate arguments + if (t == NULL || p == NULL) + { + return; + } + + PackAddInt(p, "NumItem", t->NumItem); + + PackSetCurrentJsonGroupName(p, "LocalBridgeList"); + for (i = 0;i < t->NumItem;i++) + { + RPC_LOCALBRIDGE *e = &t->Items[i]; + + PackAddStrEx(p, "DeviceName", e->DeviceName, i, t->NumItem); + PackAddStrEx(p, "HubNameLB", e->HubName, i, t->NumItem); + PackAddBoolEx(p, "Online", e->Online, i, t->NumItem); + PackAddBoolEx(p, "Active", e->Active, i, t->NumItem); + PackAddBoolEx(p, "TapMode", e->TapMode, i, t->NumItem); + } + PackSetCurrentJsonGroupName(p, NULL); +} +void FreeRpcEnumLocalBridge(RPC_ENUM_LOCALBRIDGE *t) +{ + // Validate arguments + if (t == NULL) + { + return; + } + Free(t->Items); +} + +// MEMINFO +void InRpcMemInfo(MEMINFO *t, PACK *p) +{ + // Validate arguments + if (t == NULL || p == NULL) + { + return; + } + + Zero(t, sizeof(MEMINFO)); + t->TotalMemory = PackGetInt64(p, "TotalMemory"); + t->UsedMemory = PackGetInt64(p, "UsedMemory"); + t->FreeMemory = PackGetInt64(p, "FreeMemory"); + t->TotalPhys = PackGetInt64(p, "TotalPhys"); + t->UsedPhys = PackGetInt64(p, "UsedPhys"); + t->FreePhys = PackGetInt64(p, "FreePhys"); +} +void OutRpcMemInfo(PACK *p, MEMINFO *t) +{ + // Validate arguments + if (t == NULL || p == NULL) + { + return; + } + + PackAddInt64(p, "TotalMemory", t->TotalMemory); + PackAddInt64(p, "UsedMemory", t->UsedMemory); + PackAddInt64(p, "FreeMemory", t->FreeMemory); + PackAddInt64(p, "TotalPhys", t->TotalPhys); + PackAddInt64(p, "UsedPhys", t->UsedPhys); + PackAddInt64(p, "FreePhys", t->FreePhys); +} + +// OS_INFO +void InRpcOsInfo(OS_INFO *t, PACK *p) +{ + char tmp[MAX_SIZE]; + // Validate arguments + if (t == NULL || p == NULL) + { + return; + } + + Zero(t, sizeof(OS_INFO)); + t->OsType = PackGetInt(p, "OsType"); + t->OsServicePack = PackGetInt(p, "OsServicePack"); + if (PackGetStr(p, "OsSystemName", tmp, sizeof(tmp))) + { + t->OsSystemName = CopyStr(tmp); + } + if (PackGetStr(p, "OsProductName", tmp, sizeof(tmp))) + { + t->OsProductName = CopyStr(tmp); + } + if (PackGetStr(p, "OsVendorName", tmp, sizeof(tmp))) + { + t->OsVendorName = CopyStr(tmp); + } + if (PackGetStr(p, "OsVersion", tmp, sizeof(tmp))) + { + t->OsVersion = CopyStr(tmp); + } + if (PackGetStr(p, "KernelName", tmp, sizeof(tmp))) + { + t->KernelName = CopyStr(tmp); + } + if (PackGetStr(p, "KernelVersion", tmp, sizeof(tmp))) + { + t->KernelVersion = CopyStr(tmp); + } +} +void OutRpcOsInfo(PACK *p, OS_INFO *t) +{ + // Validate arguments + if (t == NULL || p == NULL) + { + return; + } + + PackAddInt(p, "OsType", t->OsType); + PackAddInt(p, "OsServicePack", t->OsServicePack); + PackAddStr(p, "OsSystemName", t->OsSystemName); + PackAddStr(p, "OsProductName", t->OsProductName); + PackAddStr(p, "OsVendorName", t->OsVendorName); + PackAddStr(p, "OsVersion", t->OsVersion); + PackAddStr(p, "KernelName", t->KernelName); + PackAddStr(p, "KernelVersion", t->KernelVersion); +} +void FreeRpcOsInfo(OS_INFO *t) +{ + // Validate arguments + if (t == NULL) + { + return; + } + + Free(t->OsSystemName); + Free(t->OsProductName); + Free(t->OsVendorName); + Free(t->OsVersion); + Free(t->KernelName); + Free(t->KernelVersion); +} + +// Read a local log file +void SiReadLocalLogFile(SERVER *s, char *filepath, UINT offset, RPC_READ_LOG_FILE *t) +{ + char exe_dir[MAX_PATH], full_path[MAX_PATH]; + IO *o; + // Validate arguments + if (s == NULL || t == NULL || filepath == NULL) + { + return; + } + + Zero(t, sizeof(RPC_READ_LOG_FILE)); + + GetLogDir(exe_dir, sizeof(exe_dir)); + Format(full_path, sizeof(full_path), "%s/%s", exe_dir, filepath); + + // Read file + o = FileOpenEx(full_path, false, false); + if (o != NULL) + { + UINT filesize = FileSize(o); + + if (offset < filesize) + { + UINT readsize = MIN(filesize - offset, FTP_BLOCK_SIZE); + void *buf = ZeroMalloc(readsize); + + FileSeek(o, FILE_BEGIN, offset); + FileRead(o, buf, readsize); + + t->Buffer = NewBuf(); + WriteBuf(t->Buffer, buf, readsize); + Free(buf); + } + + FileClose(o); + } +} + +// Enumerate local log files +void SiEnumLocalLogFileList(SERVER *s, char *hubname, RPC_ENUM_LOG_FILE *t) +{ + LIST *o; + UINT i; + // Validate arguments + if (s == NULL || t == NULL) + { + return; + } + + Zero(t, sizeof(RPC_ENUM_LOG_FILE)); + + o = EnumLogFile(hubname); + + t->NumItem = LIST_NUM(o); + t->Items = ZeroMalloc(sizeof(RPC_ENUM_LOG_FILE_ITEM) * t->NumItem); + + for (i = 0;i < LIST_NUM(o);i++) + { + LOG_FILE *f = LIST_DATA(o, i); + RPC_ENUM_LOG_FILE_ITEM *e = &t->Items[i]; + + StrCpy(e->FilePath, sizeof(e->FilePath), f->Path); + StrCpy(e->ServerName, sizeof(e->ServerName), f->ServerName); + e->FileSize = f->FileSize; + e->UpdatedTime = f->UpdatedTime; + } + + FreeEnumLogFile(o); +} + +// Enumerate local sessions +void SiEnumLocalSession(SERVER *s, char *hubname, RPC_ENUM_SESSION *t) +{ + HUB *h; + UINT64 now = Tick64(); + UINT64 dormant_interval = 0; + // Validate arguments + if (s == NULL || hubname == NULL || t == NULL) + { + return; + } + + LockHubList(s->Cedar); + h = GetHub(s->Cedar, hubname); + UnlockHubList(s->Cedar); + + if (h == NULL) + { + t->NumSession = 0; + t->Sessions = ZeroMalloc(0); + return; + } + + if (h->Option != NULL) + { + dormant_interval = h->Option->DetectDormantSessionInterval * (UINT64)1000; + } + + LockList(h->SessionList); + { + UINT i; + t->NumSession = LIST_NUM(h->SessionList); + t->Sessions = ZeroMalloc(sizeof(RPC_ENUM_SESSION_ITEM) * t->NumSession); + + for (i = 0;i < t->NumSession;i++) + { + SESSION *s = LIST_DATA(h->SessionList, i); + RPC_ENUM_SESSION_ITEM *e = &t->Sessions[i]; + Lock(s->lock); + { + StrCpy(e->Name, sizeof(e->Name), s->Name); + StrCpy(e->Username, sizeof(e->Username), s->Username); + e->Ip = IPToUINT(&s->Connection->ClientIp); + CopyIP(&e->ClientIP, &s->Connection->ClientIp); + StrCpy(e->Hostname, sizeof(e->Hostname), s->Connection->ClientHostname); + e->MaxNumTcp = s->MaxConnection; + e->CreatedTime = Tick64ToTime64(s->CreatedTime); + e->LastCommTime = Tick64ToTime64(s->LastCommTime); + e->LinkMode = s->LinkModeServer; + e->SecureNATMode = s->SecureNATMode; + e->BridgeMode = s->BridgeMode; + e->Layer3Mode = s->L3SwitchMode; + e->VLanId = s->VLanId; + LockList(s->Connection->Tcp->TcpSockList); + { + e->CurrentNumTcp = s->Connection->Tcp->TcpSockList->num_item; + } + UnlockList(s->Connection->Tcp->TcpSockList); + Lock(s->TrafficLock); + { + e->PacketSize = GetTrafficPacketSize(s->Traffic); + e->PacketNum = GetTrafficPacketNum(s->Traffic); + } + Unlock(s->TrafficLock); + e->Client_BridgeMode = s->IsBridgeMode; + e->Client_MonitorMode = s->IsMonitorMode; + Copy(e->UniqueId, s->NodeInfo.UniqueId, 16); + + if (s->NormalClient) + { + e->IsDormantEnabled = (dormant_interval == 0 ? false : true); + if (e->IsDormantEnabled) + { + if (s->LastCommTimeForDormant == 0) + { + e->LastCommDormant = (UINT64)0x7FFFFFFF; + } + else + { + e->LastCommDormant = now - s->LastCommTimeForDormant; + } + if (s->LastCommTimeForDormant == 0) + { + e->IsDormant = true; + } + else + { + if ((s->LastCommTimeForDormant + dormant_interval) < now) + { + e->IsDormant = true; + } + } + } + } + } + Unlock(s->lock); + + GetMachineName(e->RemoteHostname, sizeof(e->RemoteHostname)); + } + } + UnlockList(h->SessionList); + + ReleaseHub(h); +} + +// RPC_ENUM_LICENSE_KEY +void InRpcEnumLicenseKey(RPC_ENUM_LICENSE_KEY *t, PACK *p) +{ + UINT i; + // Validate arguments + if (t == NULL || p == NULL) + { + return; + } + + Zero(t, sizeof(RPC_ENUM_LICENSE_KEY)); + t->NumItem = PackGetInt(p, "NumItem"); + t->Items = ZeroMalloc(sizeof(RPC_ENUM_LICENSE_KEY_ITEM) * t->NumItem); + for (i = 0;i < t->NumItem;i++) + { + RPC_ENUM_LICENSE_KEY_ITEM *e = &t->Items[i]; + + e->Id = PackGetIntEx(p, "Id", i); + PackGetStrEx(p, "LicenseKey", e->LicenseKey, sizeof(e->LicenseKey), i); + PackGetStrEx(p, "LicenseId", e->LicenseId, sizeof(e->LicenseId), i); + PackGetStrEx(p, "LicenseName", e->LicenseName, sizeof(e->LicenseName), i); + e->Expires = PackGetInt64Ex(p, "Expires", i); + e->Status = PackGetIntEx(p, "Status", i); + e->ProductId = PackGetIntEx(p, "ProductId", i); + e->SystemId = PackGetInt64Ex(p, "SystemId", i); + e->SerialId = PackGetIntEx(p, "SerialId", i); + } +} +void OutRpcEnumLicenseKey(PACK *p, RPC_ENUM_LICENSE_KEY *t) +{ + UINT i; + // Validate arguments + if (t == NULL || p == NULL) + { + return; + } + + PackAddInt(p, "NumItem", t->NumItem); + + PackSetCurrentJsonGroupName(p, "LicenseKeyList"); + for (i = 0;i < t->NumItem;i++) + { + RPC_ENUM_LICENSE_KEY_ITEM *e = &t->Items[i]; + + PackAddIntEx(p, "Id", e->Id, i, t->NumItem); + PackAddStrEx(p, "LicenseKey", e->LicenseKey, i, t->NumItem); + PackAddStrEx(p, "LicenseId", e->LicenseId, i, t->NumItem); + PackAddStrEx(p, "LicenseName", e->LicenseName, i, t->NumItem); + PackAddTime64Ex(p, "Expires", e->Expires, i, t->NumItem); + PackAddIntEx(p, "Status", e->Status, i, t->NumItem); + PackAddIntEx(p, "ProductId", e->ProductId, i, t->NumItem); + PackAddInt64Ex(p, "SystemId", e->SystemId, i, t->NumItem); + PackAddIntEx(p, "SerialId", e->SerialId, i, t->NumItem); + } + PackSetCurrentJsonGroupName(p, NULL); +} +void FreeRpcEnumLicenseKey(RPC_ENUM_LICENSE_KEY *t) +{ + // Validate arguments + if (t == NULL) + { + return; + } + + Free(t->Items); +} + +// RPC_LICENSE_STATUS +void InRpcLicenseStatus(RPC_LICENSE_STATUS *t, PACK *p) +{ + // Validate arguments + if (t == NULL || p == NULL) + { + return; + } + + Zero(t, sizeof(RPC_LICENSE_STATUS)); + + t->EditionId = PackGetInt(p, "EditionId"); + PackGetStr(p, "EditionStr", t->EditionStr, sizeof(t->EditionStr) ); + t->SystemId = PackGetInt64(p, "SystemId"); + t->SystemExpires = PackGetInt64(p, "SystemExpires"); + t->NumClientConnectLicense = PackGetInt(p, "NumClientConnectLicense"); + t->NumBridgeConnectLicense = PackGetInt(p, "NumBridgeConnectLicense"); + + // v3.0 + t->NeedSubscription = PackGetBool(p, "NeedSubscription"); + t->AllowEnterpriseFunction = PackGetBool(p, "AllowEnterpriseFunction"); + t->SubscriptionExpires = PackGetInt64(p, "SubscriptionExpires"); + t->IsSubscriptionExpired = PackGetBool(p, "IsSubscriptionExpired"); + t->NumUserCreationLicense = PackGetInt(p, "NumUserCreationLicense"); + t->ReleaseDate = PackGetInt64(p, "ReleaseDate"); +} +void OutRpcLicenseStatus(PACK *p, RPC_LICENSE_STATUS *t) +{ + // Validate arguments + if (t == NULL || p == NULL) + { + return; + } + + PackAddInt(p, "EditionId", t->EditionId); + PackAddStr(p, "EditionStr", t->EditionStr); + PackAddInt64(p, "SystemId", t->SystemId); + PackAddTime64(p, "SystemExpires", t->SystemExpires); + PackAddInt(p, "NumClientConnectLicense", t->NumClientConnectLicense); + PackAddInt(p, "NumBridgeConnectLicense", t->NumBridgeConnectLicense); + + // v3.0 + PackAddBool(p, "NeedSubscription", t->NeedSubscription); + PackAddBool(p, "AllowEnterpriseFunction", t->AllowEnterpriseFunction); + PackAddTime64(p, "SubscriptionExpires", t->SubscriptionExpires); + PackAddBool(p, "IsSubscriptionExpired", t->IsSubscriptionExpired); + PackAddInt(p, "NumUserCreationLicense", t->NumUserCreationLicense); + PackAddTime64(p, "ReleaseDate", t->ReleaseDate); +} + +// RPC_ADMIN_OPTION +void InRpcAdminOption(RPC_ADMIN_OPTION *t, PACK *p) +{ + UINT i; + // Validate arguments + if (t == NULL || p == NULL) + { + return; + } + + Zero(t, sizeof(RPC_ADMIN_OPTION)); + t->NumItem = PackGetIndexCount(p, "Name"); + t->Items = ZeroMalloc(sizeof(ADMIN_OPTION) * t->NumItem); + + PackGetStr(p, "HubName", t->HubName, sizeof(t->HubName)); + + for (i = 0;i < t->NumItem;i++) + { + ADMIN_OPTION *o = &t->Items[i]; + + PackGetStrEx(p, "Name", o->Name, sizeof(o->Name), i); + o->Value = PackGetIntEx(p, "Value", i); + PackGetUniStrEx(p, "Descrption", o->Descrption, sizeof(o->Descrption), i); + } +} +void OutRpcAdminOption(PACK *p, RPC_ADMIN_OPTION *t) +{ + UINT i; + // Validate arguments + if (t == NULL || p == NULL) + { + return; + } + + PackAddInt(p, "NumItem", t->NumItem); + + PackAddStr(p, "HubName", t->HubName); + + PackSetCurrentJsonGroupName(p, "AdminOptionList"); + for (i = 0;i < t->NumItem;i++) + { + ADMIN_OPTION *o = &t->Items[i]; + + PackAddStrEx(p, "Name", o->Name, i, t->NumItem); + PackAddIntEx(p, "Value", o->Value, i, t->NumItem); + PackAddUniStrEx(p, "Descrption", o->Descrption, i, t->NumItem); + } + PackSetCurrentJsonGroupName(p, NULL); +} +void FreeRpcAdminOption(RPC_ADMIN_OPTION *t) +{ + // Validate arguments + if (t == NULL) + { + return; + } + + Free(t->Items); +} + +// RPC_CONFIG +void InRpcConfig(RPC_CONFIG *t, PACK *p) +{ + UINT size; + // Validate arguments + if (t == NULL || p == NULL) + { + return; + } + + Zero(t, sizeof(RPC_CONFIG)); + PackGetStr(p, "FileName", t->FileName, sizeof(t->FileName)); + size = PackGetDataSize(p, "FileData"); + t->FileData = ZeroMalloc(size + 1); + PackGetData(p, "FileData", t->FileData); +} +void OutRpcConfig(PACK *p, RPC_CONFIG *t) +{ + // Validate arguments + if (t == NULL || p == NULL) + { + return; + } + + PackAddStr(p, "FileName", t->FileName); + PackAddData(p, "FileData", t->FileData, StrLen(t->FileData)); +} +void FreeRpcConfig(RPC_CONFIG *t) +{ + // Validate arguments + if (t == NULL) + { + return; + } + + Free(t->FileData); +} + +// RPC_BRIDGE_SUPPORT +void InRpcBridgeSupport(RPC_BRIDGE_SUPPORT *t, PACK *p) +{ + // Validate arguments + if (t == NULL || p == NULL) + { + return; + } + + Zero(t, sizeof(RPC_BRIDGE_SUPPORT)); + + t->IsBridgeSupportedOs = PackGetBool(p, "IsBridgeSupportedOs"); + t->IsWinPcapNeeded = PackGetBool(p, "IsWinPcapNeeded"); +} +void OutRpcBridgeSupport(PACK *p, RPC_BRIDGE_SUPPORT *t) +{ + // Validate arguments + if (p == NULL || t == NULL) + { + return; + } + + PackAddBool(p, "IsBridgeSupportedOs", t->IsBridgeSupportedOs); + PackAddBool(p, "IsWinPcapNeeded",t->IsWinPcapNeeded); +} + +// RPC_ADD_ACCESS +void InRpcAddAccess(RPC_ADD_ACCESS *t, PACK *p) +{ + // Validate arguments + if (t == NULL || p == NULL) + { + return; + } + + Zero(t, sizeof(RPC_ADD_ACCESS)); + + PackGetStr(p, "HubName", t->HubName, sizeof(t->HubName)); + InRpcAccess(&t->Access, p); +} +void OutRpcAddAccess(PACK *p, RPC_ADD_ACCESS *t) +{ + // Validate arguments + if (t == NULL || p == NULL) + { + return; + } + + PackAddStr(p, "HubName", t->HubName); + OutRpcAccess(p, &t->Access); +} + +// RPC_DELETE_ACCESS +void InRpcDeleteAccess(RPC_DELETE_ACCESS *t, PACK *p) +{ + // Validate arguments + if (t == NULL || p == NULL) + { + return; + } + + Zero(t, sizeof(RPC_DELETE_ACCESS)); + + PackGetStr(p, "HubName", t->HubName, sizeof(t->HubName)); + t->Id = PackGetInt(p, "Id"); +} +void OutRpcDeleteAccess(PACK *p, RPC_DELETE_ACCESS *t) +{ + // Validate arguments + if (t == NULL || p == NULL) + { + return; + } + + PackAddStr(p, "HubName", t->HubName); + PackAddInt(p, "Id", t->Id); +} + + +// RPC_SERVER_INFO +void InRpcServerInfo(RPC_SERVER_INFO *t, PACK *p) +{ + // Validate arguments + if (t == NULL || p == NULL) + { + return; + } + + Zero(t, sizeof(RPC_SERVER_INFO)); + + PackGetStr(p, "ServerProductName", t->ServerProductName, sizeof(t->ServerProductName)); + PackGetStr(p, "ServerVersionString", t->ServerVersionString, sizeof(t->ServerVersionString)); + PackGetStr(p, "ServerBuildInfoString", t->ServerBuildInfoString, sizeof(t->ServerBuildInfoString)); + t->ServerVerInt = PackGetInt(p, "ServerVerInt"); + t->ServerBuildInt = PackGetInt(p, "ServerBuildInt"); + PackGetStr(p, "ServerHostName", t->ServerHostName, sizeof(t->ServerHostName)); + t->ServerType = PackGetInt(p, "ServerType"); + t->ServerBuildDate = PackGetInt64(p, "ServerBuildDate"); + PackGetStr(p, "ServerFamilyName", t->ServerFamilyName, sizeof(t->ServerFamilyName)); + InRpcOsInfo(&t->OsInfo, p); +} +void OutRpcServerInfo(PACK *p, RPC_SERVER_INFO *t) +{ + // Validate arguments + if (t == NULL || p == NULL) + { + return; + } + + PackAddStr(p, "ServerProductName", t->ServerProductName); + PackAddStr(p, "ServerVersionString", t->ServerVersionString); + PackAddStr(p, "ServerBuildInfoString", t->ServerBuildInfoString); + PackAddInt(p, "ServerVerInt", t->ServerVerInt); + PackAddInt(p, "ServerBuildInt", t->ServerBuildInt); + PackAddStr(p, "ServerHostName", t->ServerHostName); + PackAddInt(p, "ServerType", t->ServerType); + PackAddTime64(p, "ServerBuildDate", t->ServerBuildDate); + PackAddStr(p, "ServerFamilyName", t->ServerFamilyName); + OutRpcOsInfo(p, &t->OsInfo); +} +void FreeRpcServerInfo(RPC_SERVER_INFO *t) +{ + // Validate arguments + if (t == NULL) + { + return; + } + + FreeRpcOsInfo(&t->OsInfo); +} + +// RPC_SERVER_STATUS +void InRpcServerStatus(RPC_SERVER_STATUS *t, PACK *p) +{ + // Validate arguments + if (t == NULL || p == NULL) + { + return; + } + + Zero(t, sizeof(RPC_SERVER_STATUS)); + t->ServerType = PackGetInt(p, "ServerType"); + t->NumTcpConnections = PackGetInt(p, "NumTcpConnections"); + t->NumTcpConnectionsLocal = PackGetInt(p, "NumTcpConnectionsLocal"); + t->NumTcpConnectionsRemote = PackGetInt(p, "NumTcpConnectionsRemote"); + t->NumHubTotal = PackGetInt(p, "NumHubTotal"); + t->NumHubStandalone = PackGetInt(p, "NumHubStandalone"); + t->NumHubStatic = PackGetInt(p, "NumHubStatic"); + t->NumHubDynamic = PackGetInt(p, "NumHubDynamic"); + t->NumSessionsTotal = PackGetInt(p, "NumSessionsTotal"); + t->NumSessionsLocal = PackGetInt(p, "NumSessionsLocal"); + t->NumSessionsRemote = PackGetInt(p, "NumSessionsRemote"); + t->NumMacTables = PackGetInt(p, "NumMacTables"); + t->NumIpTables = PackGetInt(p, "NumIpTables"); + t->NumUsers = PackGetInt(p, "NumUsers"); + t->NumGroups = PackGetInt(p, "NumGroups"); + t->CurrentTime = PackGetInt64(p, "CurrentTime"); + t->CurrentTick = PackGetInt64(p, "CurrentTick"); + t->AssignedBridgeLicenses = PackGetInt(p, "AssignedBridgeLicenses"); + t->AssignedClientLicenses = PackGetInt(p, "AssignedClientLicenses"); + t->AssignedBridgeLicensesTotal = PackGetInt(p, "AssignedBridgeLicensesTotal"); + t->AssignedClientLicensesTotal = PackGetInt(p, "AssignedClientLicensesTotal"); + t->StartTime = PackGetInt64(p, "StartTime"); + + InRpcTraffic(&t->Traffic, p); + + InRpcMemInfo(&t->MemInfo, p); +} +void OutRpcServerStatus(PACK *p, RPC_SERVER_STATUS *t) +{ + // Validate arguments + if (t == NULL || p == NULL) + { + return; + } + + PackAddInt(p, "ServerType", t->ServerType); + PackAddInt(p, "NumHubTotal", t->NumHubTotal); + PackAddInt(p, "NumHubStandalone", t->NumHubStandalone); + PackAddInt(p, "NumHubStatic", t->NumHubStatic); + PackAddInt(p, "NumHubDynamic", t->NumHubDynamic); + PackAddInt(p, "NumSessionsTotal", t->NumSessionsTotal); + PackAddInt(p, "NumSessionsLocal", t->NumSessionsLocal); + PackAddInt(p, "NumSessionsRemote", t->NumSessionsRemote); + PackAddInt(p, "NumTcpConnections", t->NumTcpConnections); + PackAddInt(p, "NumTcpConnectionsLocal", t->NumTcpConnectionsLocal); + PackAddInt(p, "NumTcpConnectionsRemote", t->NumTcpConnectionsRemote); + PackAddInt(p, "NumMacTables", t->NumMacTables); + PackAddInt(p, "NumIpTables", t->NumIpTables); + PackAddInt(p, "NumUsers", t->NumUsers); + PackAddInt(p, "NumGroups", t->NumGroups); + PackAddTime64(p, "CurrentTime", t->CurrentTime); + PackAddInt64(p, "CurrentTick", t->CurrentTick); + PackAddInt(p, "AssignedBridgeLicenses", t->AssignedBridgeLicenses); + PackAddInt(p, "AssignedClientLicenses", t->AssignedClientLicenses); + PackAddInt(p, "AssignedBridgeLicensesTotal", t->AssignedBridgeLicensesTotal); + PackAddInt(p, "AssignedClientLicensesTotal", t->AssignedClientLicensesTotal); + PackAddTime64(p, "StartTime", t->StartTime); + + OutRpcTraffic(p, &t->Traffic); + + OutRpcMemInfo(p, &t->MemInfo); +} + +// RPC_LISTENER +void InRpcListener(RPC_LISTENER *t, PACK *p) +{ + // Validate arguments + if (t == NULL || p == NULL) + { + return; + } + + Zero(t, sizeof(RPC_LISTENER)); + t->Port = PackGetInt(p, "Port"); + t->Enable = PackGetBool(p, "Enable"); +} +void OutRpcListener(PACK *p, RPC_LISTENER *t) +{ + // Validate arguments + if (t == NULL || p == NULL) + { + return; + } + + PackAddInt(p, "Port", t->Port); + PackAddBool(p, "Enable", t->Enable); +} + +// RPC_LISTENER_LIST +void InRpcListenerList(RPC_LISTENER_LIST *t, PACK *p) +{ + UINT i; + // Validate arguments + if (t == NULL || p == NULL) + { + return; + } + + Zero(t, sizeof(RPC_LISTENER_LIST)); + t->NumPort = PackGetIndexCount(p, "Ports"); + t->Ports = ZeroMalloc(sizeof(UINT) * t->NumPort); + t->Enables = ZeroMalloc(sizeof(UINT) * t->NumPort); + t->Errors = ZeroMalloc(sizeof(UINT) * t->NumPort); + for (i = 0;i < t->NumPort;i++) + { + t->Ports[i] = PackGetIntEx(p, "Ports", i); + t->Enables[i] = PackGetBoolEx(p, "Enables", i); + t->Errors[i] = PackGetBoolEx(p, "Errors", i); + } +} +void OutRpcListenerList(PACK *p, RPC_LISTENER_LIST *t) +{ + UINT i; + // Validate arguments + if (t == NULL || p == NULL) + { + return; + } + + PackSetCurrentJsonGroupName(p, "ListenerList"); + for (i = 0;i < t->NumPort;i++) + { + PackAddIntEx(p, "Ports", t->Ports[i], i, t->NumPort); + PackAddBoolEx(p, "Enables", t->Enables[i], i, t->NumPort); + PackAddBoolEx(p, "Errors", t->Errors[i], i, t->NumPort); + } + PackSetCurrentJsonGroupName(p, NULL); +} +void FreeRpcListenerList(RPC_LISTENER_LIST *t) +{ + // Validate arguments + if (t == NULL) + { + return; + } + + Free(t->Ports); + Free(t->Enables); + Free(t->Errors); +} + +// RPC_PORTS +void InRpcPorts(RPC_PORTS *t, PACK *p) +{ + UINT i; + // Validate arguments + if (t == NULL || p == NULL) + { + return; + } + + t->Num = PackGetIndexCount(p, "Ports"); + t->Ports = ZeroMalloc(sizeof(UINT) * t->Num); + + for (i = 0; i < t->Num; ++i) + { + t->Ports[i] = PackGetIntEx(p, "Ports", i); + } +} +void OutRpcPorts(PACK *p, RPC_PORTS *t) +{ + UINT i; + // Validate arguments + if (t == NULL || p == NULL) + { + return; + } + + for (i = 0; i < t->Num; ++i) + { + PackAddIntEx(p, "Ports", t->Ports[i], i, t->Num); + } +} +void FreeRpcPorts(RPC_PORTS *t) +{ + // Validate arguments + if (t == NULL) + { + return; + } + + Free(t->Ports); +} + +// RPC_STR +void InRpcStr(RPC_STR *t, PACK *p) +{ + UINT size = 65536; + char *tmp = Malloc(size); + // Validate arguments + if (t == NULL || p == NULL) + { + return; + } + + Zero(t, sizeof(RPC_STR)); + if (PackGetStr(p, "String", tmp, size) == false) + { + t->String = CopyStr(""); + } + else + { + t->String = CopyStr(tmp); + } + Free(tmp); +} +void OutRpcStr(PACK *p, RPC_STR *t) +{ + // Validate arguments + if (t == NULL || p == NULL) + { + return; + } + + PackAddStr(p, "String", t->String); +} +void FreeRpcStr(RPC_STR *t) +{ + // Validate arguments + if (t == NULL ) + { + return; + } + + Free(t->String); +} + +// RPC_PROTO_OPTIONS +void InRpcProtoOptions(RPC_PROTO_OPTIONS *t, PACK *p) +{ + UINT i, size; + // Validate arguments + if (t == NULL || p == NULL) + { + return; + } + + Zero(t, sizeof(RPC_PROTO_OPTIONS)); + + size = PackGetStrSize(p, "Protocol"); + if (size > 0) + { + t->Protocol = Malloc(size); + + if (PackGetStr(p, "Protocol", t->Protocol, size) == false) + { + Zero(t->Protocol, size); + } + } + + t->Num = PackGetIndexCount(p, "Name"); + if (t->Num == 0) + { + return; + } + + t->Options = ZeroMalloc(sizeof(PROTO_OPTION) * t->Num); + + for (i = 0; i < t->Num; ++i) + { + PROTO_OPTION *option = &t->Options[i]; + + size = PackGetStrSizeEx(p, "Name", i); + if (size > 0) + { + option->Name = Malloc(size); + if (PackGetStrEx(p, "Name", option->Name, size, i) == false) + { + Zero(option->Name, size); + } + } + + option->Type = PackGetIntEx(p, "Type", i); + switch (option->Type) + { + case PROTO_OPTION_STRING: + size = PackGetDataSizeEx(p, "Value", i); + if (size > 0) + { + option->String = Malloc(size); + if (PackGetDataEx2(p, "Value", option->String, size, i) == false) + { + Zero(option->String, size); + } + } + break; + case PROTO_OPTION_BOOL: + PackGetDataEx2(p, "Value", &option->Bool, sizeof(option->Bool), i); + break; + default: + Debug("InRpcProtoOptions(): unhandled type %u!\n", option->Type); + } + } +} +void OutRpcProtoOptions(PACK *p, RPC_PROTO_OPTIONS *t) +{ + UINT i; + // Validate arguments + if (t == NULL || p == NULL) + { + return; + } + + PackAddStr(p, "Protocol", t->Protocol); + + for (i = 0; i < t->Num; ++i) + { + PROTO_OPTION *option = &t->Options[i]; + + PackAddStrEx(p, "Name", option->Name, i, t->Num); + PackAddIntEx(p, "Type", option->Type, i, t->Num); + + switch (option->Type) + { + case PROTO_OPTION_STRING: + PackAddDataEx(p, "Value", option->String, StrLen(option->String) + 1, i, t->Num); + break; + case PROTO_OPTION_BOOL: + PackAddDataEx(p, "Value", &option->Bool, sizeof(option->Bool), i, t->Num); + break; + default: + Debug("OutRpcProtoOptions(): unhandled type %u!\n", option->Type); + } + } +} +void FreeRpcProtoOptions(RPC_PROTO_OPTIONS *t) +{ + UINT i; + // Validate arguments + if (t == NULL) + { + return; + } + + Free(t->Protocol); + + for (i = 0; i < t->Num; ++i) + { + PROTO_OPTION *option = &t->Options[i]; + + Free(option->Name); + + if (option->Type == PROTO_OPTION_STRING) + { + Free(option->String); + } + } + + Free(t->Options); +} + +// RPC_SET_PASSWORD +void InRpcSetPassword(RPC_SET_PASSWORD *t, PACK *p) +{ + // Validate arguments + if (t == NULL || p == NULL) + { + return; + } + + Zero(t, sizeof(RPC_SET_PASSWORD)); + PackGetData2(p, "HashedPassword", t->HashedPassword, sizeof(t->HashedPassword)); + PackGetStr(p, "PlainTextPassword", t->PlainTextPassword, sizeof(t->PlainTextPassword)); +} +void OutRpcSetPassword(PACK *p, RPC_SET_PASSWORD *t) +{ + // Validate arguments + if (t == NULL || p == NULL) + { + return; + } + + PackAddData(p, "HashedPassword", t->HashedPassword, sizeof(t->HashedPassword)); + PackAddStr(p, "PlainTextPassword", t->PlainTextPassword); +} + +// RPC_FARM +void InRpcFarm(RPC_FARM *t, PACK *p) +{ + UINT i; + // Validate arguments + if (t == NULL || p == NULL) + { + return; + } + + Zero(t, sizeof(RPC_FARM)); + t->ServerType = PackGetInt(p, "ServerType"); + t->NumPort = PackGetIndexCount(p, "Ports"); + t->Ports = ZeroMalloc(sizeof(UINT) * t->NumPort); + for (i = 0;i < t->NumPort;i++) + { + t->Ports[i] = PackGetIntEx(p, "Ports", i); + } + t->PublicIp = PackGetIp32(p, "PublicIp"); + PackGetStr(p, "ControllerName", t->ControllerName, sizeof(t->ControllerName)); + t->ControllerPort = PackGetInt(p, "ControllerPort"); + PackGetData2(p, "MemberPassword", t->MemberPassword, sizeof(t->MemberPassword)); + PackGetStr(p, "MemberPasswordPlaintext", t->MemberPasswordPlaintext, sizeof(t->MemberPasswordPlaintext)); + t->Weight = PackGetInt(p, "Weight"); + t->ControllerOnly = PackGetBool(p, "ControllerOnly"); +} +void OutRpcFarm(PACK *p, RPC_FARM *t) +{ + UINT i; + // Validate arguments + if (t == NULL || p == NULL) + { + return; + } + + PackAddInt(p, "ServerType", t->ServerType); + for (i = 0;i < t->NumPort;i++) + { + PackAddIntEx(p, "Ports", t->Ports[i], i, t->NumPort); + } + PackAddIp32(p, "PublicIp", t->PublicIp); + PackAddStr(p, "ControllerName", t->ControllerName); + PackAddInt(p, "ControllerPort", t->ControllerPort); + PackAddData(p, "MemberPassword", t->MemberPassword, sizeof(t->MemberPassword)); + PackAddStr(p, "MemberPasswordPlaintext", t->MemberPasswordPlaintext); + PackAddInt(p, "Weight", t->Weight); + PackAddBool(p, "ControllerOnly", t->ControllerOnly); +} +void FreeRpcFarm(RPC_FARM *t) +{ + // Validate arguments + if (t == NULL) + { + return; + } + + Free(t->Ports); +} + +// RPC_FARM_HUB +void InRpcFarmHub(RPC_FARM_HUB *t, PACK *p) +{ + // Validate arguments + if (t == NULL || p == NULL) + { + return; + } + + Zero(t, sizeof(RPC_FARM_HUB)); + PackGetStr(p, "HubName", t->HubName, sizeof(t->HubName)); + t->DynamicHub = PackGetBool(p, "DynamicHub"); +} +void OutRpcFarmHub(PACK *p, RPC_FARM_HUB *t) +{ + // Validate arguments + if (t == NULL || p == NULL) + { + return; + } + + PackAddStr(p, "HubName", t->HubName); + PackAddBool(p, "DynamicHub", t->DynamicHub); +} + +// RPC_FARM_INFO +void InRpcFarmInfo(RPC_FARM_INFO *t, PACK *p) +{ + UINT i; + // Validate arguments + if (t == NULL) + { + return; + } + + Zero(t, sizeof(RPC_FARM_INFO)); + t->Id = PackGetInt(p, "Id"); + t->Controller = PackGetBool(p, "Controller"); + t->ConnectedTime = PackGetInt64(p, "ConnectedTime"); + t->Ip = PackGetIp32(p, "Ip"); + PackGetStr(p, "Hostname", t->Hostname, sizeof(t->Hostname)); + t->Point = PackGetInt(p, "Point"); + t->NumPort = PackGetIndexCount(p, "Ports"); + t->Ports = ZeroMalloc(sizeof(UINT) * t->NumPort); + for (i = 0;i < t->NumPort;i++) + { + t->Ports[i] = PackGetIntEx(p, "Ports", i); + } + t->ServerCert = PackGetX(p, "ServerCert"); + t->NumFarmHub = PackGetIndexCount(p, "HubName"); + t->FarmHubs = ZeroMalloc(sizeof(RPC_FARM_HUB) * t->NumFarmHub); + for (i = 0;i < t->NumFarmHub;i++) + { + PackGetStrEx(p, "HubName", t->FarmHubs[i].HubName, sizeof(t->FarmHubs[i].HubName), i); + t->FarmHubs[i].DynamicHub = PackGetBoolEx(p, "DynamicHub", i); + } + t->NumSessions = PackGetInt(p, "NumSessions"); + t->NumTcpConnections = PackGetInt(p, "NumTcpConnections"); + t->Weight = PackGetInt(p, "Weight"); +} +void OutRpcFarmInfo(PACK *p, RPC_FARM_INFO *t) +{ + UINT i; + // Validate arguments + if (t == NULL || p == NULL) + { + return; + } + + PackAddInt(p, "Id", t->Id); + PackAddBool(p, "Controller", t->Controller); + PackAddTime64(p, "ConnectedTime", t->ConnectedTime); + PackAddIp32(p, "Ip", t->Ip); + PackAddStr(p, "Hostname", t->Hostname); + PackAddInt(p, "Point", t->Point); + for (i = 0;i < t->NumPort;i++) + { + PackAddIntEx(p, "Ports", t->Ports[i], i, t->NumPort); + } + PackAddX(p, "ServerCert", t->ServerCert); + + PackSetCurrentJsonGroupName(p, "HubsList"); + for (i = 0;i < t->NumFarmHub;i++) + { + PackAddStrEx(p, "HubName", t->FarmHubs[i].HubName, i, t->NumFarmHub); + PackAddBoolEx(p, "DynamicHub", t->FarmHubs[i].DynamicHub, i, t->NumFarmHub); + } + PackSetCurrentJsonGroupName(p, NULL); + + PackAddInt(p, "NumSessions", t->NumSessions); + PackAddInt(p, "NumTcpConnections", t->NumTcpConnections); + PackAddInt(p, "Weight", t->Weight); +} +void FreeRpcFarmInfo(RPC_FARM_INFO *t) +{ + // Validate arguments + if (t == NULL) + { + return; + } + + Free(t->Ports); + Free(t->FarmHubs); + FreeX(t->ServerCert); +} + +void InRpcEnumFarm(RPC_ENUM_FARM *t, PACK *p) +{ + UINT i; + // Validate arguments + if (t == NULL || p == NULL) + { + return; + } + + Zero(t, sizeof(RPC_ENUM_FARM)); + t->NumFarm = PackGetIndexCount(p, "Id"); + t->Farms = ZeroMalloc(sizeof(RPC_ENUM_FARM_ITEM) * t->NumFarm); + + for (i = 0;i < t->NumFarm;i++) + { + RPC_ENUM_FARM_ITEM *e = &t->Farms[i]; + + e->Id = PackGetIntEx(p, "Id", i); + e->Controller = PackGetBoolEx(p, "Controller", i); + e->ConnectedTime = PackGetInt64Ex(p, "ConnectedTime", i); + e->Ip = PackGetIp32Ex(p, "Ip", i); + PackGetStrEx(p, "Hostname", e->Hostname, sizeof(e->Hostname), i); + e->Point = PackGetIntEx(p, "Point", i); + e->NumSessions = PackGetIntEx(p, "NumSessions", i); + e->NumTcpConnections = PackGetIntEx(p, "NumTcpConnections", i); + e->NumHubs = PackGetIntEx(p, "NumHubs", i); + e->AssignedClientLicense = PackGetIntEx(p, "AssignedClientLicense", i); + e->AssignedBridgeLicense = PackGetIntEx(p, "AssignedBridgeLicense", i); + } +} +void OutRpcEnumFarm(PACK *p, RPC_ENUM_FARM *t) +{ + UINT i; + // Validate arguments + if (t == NULL || p == NULL) + { + return; + } + + PackSetCurrentJsonGroupName(p, "FarmMemberList"); + for (i = 0;i < t->NumFarm;i++) + { + RPC_ENUM_FARM_ITEM *e = &t->Farms[i]; + + PackAddIntEx(p, "Id", e->Id, i, t->NumFarm); + PackAddBoolEx(p, "Controller", e->Controller, i, t->NumFarm); + PackAddTime64Ex(p, "ConnectedTime", e->ConnectedTime, i, t->NumFarm); + PackAddIp32Ex(p, "Ip", e->Ip, i, t->NumFarm); + PackAddStrEx(p, "Hostname", e->Hostname, i, t->NumFarm); + PackAddIntEx(p, "Point", e->Point, i, t->NumFarm); + PackAddIntEx(p, "NumSessions", e->NumSessions, i, t->NumFarm); + PackAddIntEx(p, "NumTcpConnections", e->NumTcpConnections, i, t->NumFarm); + PackAddIntEx(p, "NumHubs", e->NumHubs, i, t->NumFarm); + PackAddIntEx(p, "AssignedClientLicense", e->AssignedClientLicense, i, t->NumFarm); + PackAddIntEx(p, "AssignedBridgeLicense", e->AssignedBridgeLicense, i, t->NumFarm); + } + PackSetCurrentJsonGroupName(p, NULL); +} +void FreeRpcEnumFarm(RPC_ENUM_FARM *t) +{ + // Validate arguments + if (t == NULL) + { + return; + } + + Free(t->Farms); +} + +// RPC_FARM_CONNECTION_STATUS +void InRpcFarmConnectionStatus(RPC_FARM_CONNECTION_STATUS *t, PACK *p) +{ + Zero(t, sizeof(RPC_FARM_CONNECTION_STATUS)); + // Validate arguments + if (t == NULL || p == NULL) + { + return; + } + + t->Ip = PackGetIp32(p, "Ip"); + t->Port = PackGetInt(p, "Port"); + t->Online = PackGetBool(p, "Online"); + t->LastError = PackGetInt(p, "LastError"); + t->StartedTime = PackGetInt64(p, "StartedTime"); + t->CurrentConnectedTime = PackGetInt64(p, "CurrentConnectedTime"); + t->FirstConnectedTime = PackGetInt64(p, "FirstConnectedTime"); + t->NumConnected = PackGetInt(p, "NumConnected"); + t->NumTry = PackGetInt(p, "NumTry"); + t->NumFailed = PackGetInt(p, "NumFailed"); +} +void OutRpcFarmConnectionStatus(PACK *p, RPC_FARM_CONNECTION_STATUS *t) +{ + // Validate arguments + if (t == NULL || p == NULL) + { + return; + } + + PackAddIp32(p, "Ip", t->Ip); + PackAddInt(p, "Port", t->Port); + PackAddBool(p, "Online", t->Online); + PackAddInt(p, "LastError", t->LastError); + PackAddTime64(p, "StartedTime", t->StartedTime); + PackAddTime64(p, "CurrentConnectedTime", t->CurrentConnectedTime); + PackAddTime64(p, "FirstConnectedTime", t->FirstConnectedTime); + PackAddInt(p, "NumConnected", t->NumConnected); + PackAddInt(p, "NumTry", t->NumTry); + PackAddInt(p, "NumFailed", t->NumFailed); +} + +// RPC_HUB_OPTION +void InRpcHubOption(RPC_HUB_OPTION *t, PACK *p) +{ + // Validate arguments + if (t == NULL || p == NULL) + { + return; + } + + Zero(t, sizeof(RPC_HUB_OPTION)); + t->MaxSession = PackGetInt(p, "MaxSession"); + t->NoEnum = PackGetBool(p, "NoEnum"); +} +void OutRpcHubOption(PACK *p, RPC_HUB_OPTION *t) +{ + // Validate arguments + if (t == NULL || p == NULL) + { + return; + } + + PackAddInt(p, "MaxSession", t->MaxSession); + PackAddBool(p, "NoEnum", t->NoEnum); +} + +// RPC_RADIUS +void InRpcRadius(RPC_RADIUS *t, PACK *p) +{ + // Validate arguments + if (t == NULL || p == NULL) + { + return; + } + + Zero(t, sizeof(RPC_RADIUS)); + PackGetStr(p, "RadiusServerName", t->RadiusServerName, sizeof(t->RadiusServerName)); + t->RadiusPort = PackGetInt(p, "RadiusPort"); + PackGetStr(p, "HubName", t->HubName, sizeof(t->HubName)); + PackGetStr(p, "RadiusSecret", t->RadiusSecret, sizeof(t->RadiusSecret)); + t->RadiusRetryInterval = PackGetInt(p, "RadiusRetryInterval"); +} +void OutRpcRadius(PACK *p, RPC_RADIUS *t) +{ + // Validate arguments + if (t == NULL || p == NULL) + { + return; + } + + PackAddStr(p, "RadiusServerName", t->RadiusServerName); + PackAddInt(p, "RadiusPort", t->RadiusPort); + PackAddStr(p, "HubName", t->HubName); + PackAddStr(p, "RadiusSecret", t->RadiusSecret); + PackAddInt(p, "RadiusRetryInterval", t->RadiusRetryInterval); +} + +// RPC_HUB +void InRpcHub(RPC_HUB *t, PACK *p) +{ + // Validate arguments + if (t == NULL || p == NULL) + { + return; + } + + Zero(t, sizeof(RPC_HUB)); + PackGetStr(p, "HubName", t->HubName, sizeof(t->HubName)); +} +void OutRpcHub(PACK *p, RPC_HUB *t) +{ + // Validate arguments + if (t == NULL || p == NULL) + { + return; + } + + PackAddStr(p, "HubName", t->HubName); +} + +// RPC_CREATE_HUB +void InRpcCreateHub(RPC_CREATE_HUB *t, PACK *p) +{ + // Validate arguments + if (t == NULL || p == NULL) + { + return; + } + + Zero(t, sizeof(RPC_CREATE_HUB)); + PackGetStr(p, "HubName", t->HubName, sizeof(t->HubName)); + PackGetData2(p, "HashedPassword", t->HashedPassword, sizeof(t->HashedPassword)); + PackGetData2(p, "SecurePassword", t->SecurePassword, sizeof(t->SecurePassword)); + PackGetStr(p, "AdminPasswordPlainText", t->AdminPasswordPlainText, sizeof(t->AdminPasswordPlainText)); + t->Online = PackGetBool(p, "Online"); + InRpcHubOption(&t->HubOption, p); + t->HubType = PackGetInt(p, "HubType"); +} +void OutRpcCreateHub(PACK *p, RPC_CREATE_HUB *t) +{ + // Validate arguments + if (t == NULL || p == NULL) + { + return; + } + + PackAddStr(p, "HubName", t->HubName); + PackAddData(p, "HashedPassword", t->HashedPassword, sizeof(t->HashedPassword)); + PackAddData(p, "SecurePassword", t->SecurePassword, sizeof(t->SecurePassword)); + PackAddBool(p, "Online", t->Online); + PackAddStr(p, "AdminPasswordPlainText", t->AdminPasswordPlainText); + OutRpcHubOption(p, &t->HubOption); + PackAddInt(p, "HubType", t->HubType); +} + +// RPC_ENUM_HUB +void InRpcEnumHub(RPC_ENUM_HUB *t, PACK *p) +{ + UINT i; + // Validate arguments + if (t == NULL || p == NULL) + { + return; + } + + Zero(t, sizeof(RPC_ENUM_HUB)); + t->NumHub = PackGetIndexCount(p, "HubName"); + t->Hubs = ZeroMalloc(sizeof(RPC_ENUM_HUB_ITEM) * t->NumHub); + + for (i = 0;i < t->NumHub;i++) + { + RPC_ENUM_HUB_ITEM *e = &t->Hubs[i]; + + PackGetStrEx(p, "HubName", e->HubName, sizeof(e->HubName), i); + e->Online = PackGetBoolEx(p, "Online", i); + e->HubType = PackGetIntEx(p, "HubType", i); + e->NumSessions = PackGetIntEx(p, "NumSessions", i); + e->NumUsers = PackGetIntEx(p, "NumUsers", i); + e->NumGroups = PackGetIntEx(p, "NumGroups", i); + e->NumMacTables = PackGetIntEx(p, "NumMacTables", i); + e->NumIpTables = PackGetIntEx(p, "NumIpTables", i); + e->LastCommTime = PackGetInt64Ex(p, "LastCommTime", i); + e->CreatedTime = PackGetInt64Ex(p, "CreatedTime", i); + e->LastLoginTime = PackGetInt64Ex(p, "LastLoginTime", i); + e->NumLogin = PackGetIntEx(p, "NumLogin", i); + e->IsTrafficFilled = PackGetBoolEx(p, "IsTrafficFilled", i); + + InRpcTrafficEx(&e->Traffic, p, i); + } +} +void OutRpcEnumHub(PACK *p, RPC_ENUM_HUB *t) +{ + UINT i; + // Validate arguments + if (t == NULL || p == NULL) + { + return; + } + + PackSetCurrentJsonGroupName(p, "HubList"); + for (i = 0;i < t->NumHub;i++) + { + RPC_ENUM_HUB_ITEM *e = &t->Hubs[i]; + + PackAddStrEx(p, "HubName", e->HubName, i, t->NumHub); + PackAddBoolEx(p, "Online", e->Online, i, t->NumHub); + PackAddIntEx(p, "HubType", e->HubType, i, t->NumHub); + PackAddIntEx(p, "NumSessions", e->NumSessions, i, t->NumHub); + PackAddIntEx(p, "NumUsers", e->NumUsers, i, t->NumHub); + PackAddIntEx(p, "NumGroups", e->NumGroups, i, t->NumHub); + PackAddIntEx(p, "NumMacTables", e->NumMacTables, i, t->NumHub); + PackAddIntEx(p, "NumIpTables", e->NumIpTables, i, t->NumHub); + PackAddTime64Ex(p, "LastCommTime", e->LastCommTime, i, t->NumHub); + PackAddTime64Ex(p, "CreatedTime", e->CreatedTime, i, t->NumHub); + PackAddTime64Ex(p, "LastLoginTime", e->LastLoginTime, i, t->NumHub); + PackAddIntEx(p, "NumLogin", e->NumLogin, i, t->NumHub); + PackAddBoolEx(p, "IsTrafficFilled", e->IsTrafficFilled, i, t->NumHub); + + OutRpcTrafficEx(&e->Traffic, p, i, t->NumHub); + } + PackSetCurrentJsonGroupName(p, NULL); +} +void FreeRpcEnumHub(RPC_ENUM_HUB *t) +{ + // Validate arguments + if (t == NULL) + { + return; + } + + Free(t->Hubs); +} + +// RPC_DELETE_HUB +void InRpcDeleteHub(RPC_DELETE_HUB *t, PACK *p) +{ + // Validate arguments + if (t == NULL || p == NULL) + { + return; + } + + Zero(t, sizeof(RPC_DELETE_HUB)); + PackGetStr(p, "HubName", t->HubName, sizeof(t->HubName)); +} +void OutRpcDeleteHub(PACK *p, RPC_DELETE_HUB *t) +{ + // Validate arguments + if (t == NULL || p == NULL) + { + return; + } + + PackAddStr(p, "HubName", t->HubName); +} + +// RPC_ENUM_CONNECTION +void InRpcEnumConnection(RPC_ENUM_CONNECTION *t, PACK *p) +{ + UINT i; + // Validate arguments + if (t == NULL || p == NULL) + { + return; + } + + Zero(t, sizeof(RPC_ENUM_CONNECTION)); + t->NumConnection = PackGetIndexCount(p, "Name"); + t->Connections = ZeroMalloc(sizeof(RPC_ENUM_CONNECTION_ITEM) * t->NumConnection); + + for (i = 0;i < t->NumConnection;i++) + { + RPC_ENUM_CONNECTION_ITEM *e = &t->Connections[i]; + + e->Ip = PackGetIp32Ex(p, "Ip", i); + e->Port = PackGetIntEx(p, "Port", i); + PackGetStrEx(p, "Name", e->Name, sizeof(e->Name), i); + PackGetStrEx(p, "Hostname", e->Hostname, sizeof(e->Hostname), i); + e->ConnectedTime = PackGetInt64Ex(p, "ConnectedTime", i); + e->Type = PackGetIntEx(p, "Type", i); + } +} +void OutRpcEnumConnection(PACK *p, RPC_ENUM_CONNECTION *t) +{ + UINT i; + // Validate arguments + if (t == NULL || p == NULL) + { + return; + } + + PackSetCurrentJsonGroupName(p, "ConnectionList"); + for (i = 0;i < t->NumConnection;i++) + { + RPC_ENUM_CONNECTION_ITEM *e = &t->Connections[i]; + + PackAddIp32Ex(p, "Ip", e->Ip, i, t->NumConnection); + PackAddIntEx(p, "Port", e->Port, i, t->NumConnection); + PackAddStrEx(p, "Name", e->Name, i, t->NumConnection); + PackAddStrEx(p, "Hostname", e->Hostname, i, t->NumConnection); + PackAddTime64Ex(p, "ConnectedTime", e->ConnectedTime, i, t->NumConnection); + PackAddIntEx(p, "Type", e->Type, i, t->NumConnection); + } + PackSetCurrentJsonGroupName(p, NULL); +} +void FreeRpcEnumConnection(RPC_ENUM_CONNECTION *t) +{ + // Validate arguments + if (t == NULL) + { + return; + } + + Free(t->Connections); +} + +// RPC_DISCONNECT_CONNECTION +void InRpcDisconnectConnection(RPC_DISCONNECT_CONNECTION *t, PACK *p) +{ + // Validate arguments + if (t == NULL || p == NULL) + { + return; + } + + Zero(t, sizeof(RPC_DISCONNECT_CONNECTION)); + PackGetStr(p, "Name", t->Name, sizeof(t->Name)); +} +void OutRpcDisconnectConnection(PACK *p, RPC_DISCONNECT_CONNECTION *t) +{ + // Validate arguments + if (t == NULL || p == NULL) + { + return; + } + + PackAddStr(p, "Name", t->Name); +} + +// RPC_CONNECTION_INFO +void InRpcConnectionInfo(RPC_CONNECTION_INFO *t, PACK *p) +{ + // Validate arguments + if (t == NULL || p == NULL) + { + return; + } + + Zero(t, sizeof(RPC_CONNECTION_INFO)); + PackGetStr(p, "Name", t->Name, sizeof(t->Name)); + t->Ip = PackGetIp32(p, "Ip"); + t->Port = PackGetInt(p, "Port"); + t->ConnectedTime = PackGetInt64(p, "ConnectedTime"); + PackGetStr(p, "Hostname", t->Hostname, sizeof(t->Hostname)); + PackGetStr(p, "ServerStr", t->ServerStr, sizeof(t->ServerStr)); + PackGetStr(p, "ClientStr", t->ClientStr, sizeof(t->ClientStr)); + t->ServerVer = PackGetInt(p, "ServerVer"); + t->ServerBuild = PackGetInt(p, "ServerBuild"); + t->ClientVer = PackGetInt(p, "ClientVer"); + t->ClientBuild = PackGetInt(p, "ClientBuild"); + t->Type = PackGetInt(p, "Type"); +} +void OutRpcConnectionInfo(PACK *p, RPC_CONNECTION_INFO *t) +{ + // Validate arguments + if (t == NULL || p == NULL) + { + return; + } + + PackAddStr(p, "Name", t->Name); + PackAddIp32(p, "Ip", t->Ip); + PackAddInt(p, "Port", t->Port); + PackAddTime64(p, "ConnectedTime", t->ConnectedTime); + PackAddStr(p, "Hostname", t->Hostname); + PackAddStr(p, "ServerStr", t->ServerStr); + PackAddStr(p, "ClientStr", t->ClientStr); + PackAddInt(p, "ServerVer", t->ServerVer); + PackAddInt(p, "ServerBuild", t->ServerBuild); + PackAddInt(p, "ClientVer", t->ClientVer); + PackAddInt(p, "ClientBuild", t->ClientBuild); + PackAddInt(p, "Type", t->Type); +} + +// RPC_SET_HUB_ONLINE +void InRpcSetHubOnline(RPC_SET_HUB_ONLINE *t, PACK *p) +{ + // Validate arguments + if (t == NULL || p == NULL) + { + return; + } + + Zero(t, sizeof(RPC_SET_HUB_ONLINE)); + PackGetStr(p, "HubName", t->HubName, sizeof(t->HubName)); + t->Online = PackGetBool(p, "Online"); +} +void OutRpcSetHubOnline(PACK *p, RPC_SET_HUB_ONLINE *t) +{ + // Validate arguments + if (t == NULL || p == NULL) + { + return; + } + + PackAddStr(p, "HubName", t->HubName); + PackAddBool(p, "Online", t->Online); +} + +// RPC_HUB_STATUS +void InRpcHubStatus(RPC_HUB_STATUS *t, PACK *p) +{ + Zero(t, sizeof(RPC_HUB_STATUS)); + // Validate arguments + if (t == NULL || p == NULL) + { + return; + } + + PackGetStr(p, "HubName", t->HubName, sizeof(t->HubName)); + t->Online = PackGetBool(p, "Online"); + t->HubType = PackGetInt(p, "HubType"); + t->NumSessions = PackGetInt(p, "NumSessions"); + t->NumSessionsClient = PackGetInt(p, "NumSessionsClient"); + t->NumSessionsBridge = PackGetInt(p, "NumSessionsBridge"); + t->NumAccessLists = PackGetInt(p, "NumAccessLists"); + t->NumUsers = PackGetInt(p, "NumUsers"); + t->NumGroups = PackGetInt(p, "NumGroups"); + t->NumMacTables = PackGetInt(p, "NumMacTables"); + t->NumIpTables = PackGetInt(p, "NumIpTables"); + t->SecureNATEnabled = PackGetBool(p, "SecureNATEnabled"); + InRpcTraffic(&t->Traffic, p); + t->LastCommTime = PackGetInt64(p, "LastCommTime"); + t->CreatedTime = PackGetInt64(p, "CreatedTime"); + t->LastLoginTime = PackGetInt64(p, "LastLoginTime"); + t->NumLogin = PackGetInt(p, "NumLogin"); +} +void OutRpcHubStatus(PACK *p, RPC_HUB_STATUS *t) +{ + // Validate arguments + if (t == NULL || p == NULL) + { + return; + } + + PackAddStr(p, "HubName", t->HubName); + PackAddBool(p, "Online", t->Online); + PackAddInt(p, "HubType", t->HubType); + PackAddInt(p, "NumSessions", t->NumSessions); + PackAddInt(p, "NumSessionsClient", t->NumSessionsClient); + PackAddInt(p, "NumSessionsBridge", t->NumSessionsBridge); + PackAddInt(p, "NumAccessLists", t->NumAccessLists); + PackAddInt(p, "NumUsers", t->NumUsers); + PackAddInt(p, "NumGroups", t->NumGroups); + PackAddInt(p, "NumMacTables", t->NumMacTables); + PackAddInt(p, "NumIpTables", t->NumIpTables); + PackAddBool(p, "SecureNATEnabled", t->SecureNATEnabled); + OutRpcTraffic(p, &t->Traffic); + PackAddTime64(p, "LastCommTime", t->LastCommTime); + PackAddTime64(p, "CreatedTime", t->CreatedTime); + PackAddTime64(p, "LastLoginTime", t->LastLoginTime); + PackAddInt(p, "NumLogin", t->NumLogin); +} + +// RPC_HUB_LOG +void InRpcHubLog(RPC_HUB_LOG *t, PACK *p) +{ + UINT i; + // Validate arguments + if (t == NULL || p == NULL) + { + return; + } + + Zero(t, sizeof(RPC_HUB_LOG)); + PackGetStr(p, "HubName", t->HubName, sizeof(t->HubName)); + t->LogSetting.SaveSecurityLog = PackGetBool(p, "SaveSecurityLog"); + t->LogSetting.SecurityLogSwitchType = PackGetInt(p, "SecurityLogSwitchType"); + t->LogSetting.SavePacketLog = PackGetBool(p, "SavePacketLog"); + t->LogSetting.PacketLogSwitchType = PackGetInt(p, "PacketLogSwitchType"); + for (i = 0;i < NUM_PACKET_LOG;i++) + { + t->LogSetting.PacketLogConfig[i] = PackGetIntEx(p, "PacketLogConfig", i); + } +} +void OutRpcHubLog(PACK *p, RPC_HUB_LOG *t) +{ + UINT i; + // Validate arguments + if (t == NULL || p == NULL) + { + return; + } + + PackAddStr(p, "HubName", t->HubName); + PackAddBool(p, "SaveSecurityLog", t->LogSetting.SaveSecurityLog); + PackAddInt(p, "SecurityLogSwitchType", t->LogSetting.SecurityLogSwitchType); + PackAddBool(p, "SavePacketLog", t->LogSetting.SavePacketLog); + PackAddInt(p, "PacketLogSwitchType", t->LogSetting.PacketLogSwitchType); + for (i = 0;i < NUM_PACKET_LOG;i++) + { + PackAddIntEx(p, "PacketLogConfig", t->LogSetting.PacketLogConfig[i], i, NUM_PACKET_LOG); + } +} + +// RPC_HUB_ADD_CA +void InRpcHubAddCa(RPC_HUB_ADD_CA *t, PACK *p) +{ + // Validate arguments + if (t == NULL || p == NULL) + { + return; + } + + Zero(t, sizeof(RPC_HUB_ADD_CA)); + PackGetStr(p, "HubName", t->HubName, sizeof(t->HubName)); + t->Cert = PackGetX(p, "Cert"); +} +void OutRpcHubAddCa(PACK *p, RPC_HUB_ADD_CA *t) +{ + // Validate arguments + if (t == NULL || p == NULL) + { + return; + } + + PackAddStr(p, "HubName", t->HubName); + PackAddX(p, "Cert", t->Cert); +} +void FreeRpcHubAddCa(RPC_HUB_ADD_CA *t) +{ + // Validate arguments + if (t == NULL) + { + return; + } + + FreeX(t->Cert); +} + +// RPC_HUB_ENUM_CA +void InRpcHubEnumCa(RPC_HUB_ENUM_CA *t, PACK *p) +{ + UINT i; + // Validate arguments + if (t == NULL || p == NULL) + { + return; + } + + Zero(t, sizeof(RPC_HUB_ENUM_CA)); + PackGetStr(p, "HubName", t->HubName, sizeof(t->HubName)); + t->NumCa = PackGetIndexCount(p, "Key"); + t->Ca = ZeroMalloc(sizeof(RPC_HUB_ENUM_CA_ITEM) * t->NumCa); + + for (i = 0;i < t->NumCa;i++) + { + RPC_HUB_ENUM_CA_ITEM *e = &t->Ca[i]; + + e->Key = PackGetIntEx(p, "Key", i); + PackGetUniStrEx(p, "SubjectName", e->SubjectName, sizeof(e->SubjectName), i); + PackGetUniStrEx(p, "IssuerName", e->IssuerName, sizeof(e->IssuerName), i); + e->Expires = PackGetInt64Ex(p, "Expires", i); + } +} +void OutRpcHubEnumCa(PACK *p, RPC_HUB_ENUM_CA *t) +{ + UINT i; + // Validate arguments + if (t == NULL || p == NULL) + { + return; + } + PackAddStr(p, "HubName", t->HubName); + + PackSetCurrentJsonGroupName(p, "CAList"); + for (i = 0;i < t->NumCa;i++) + { + RPC_HUB_ENUM_CA_ITEM *e = &t->Ca[i]; + + PackAddIntEx(p, "Key", e->Key, i, t->NumCa); + PackAddUniStrEx(p, "SubjectName", e->SubjectName, i, t->NumCa); + PackAddUniStrEx(p, "IssuerName", e->IssuerName, i, t->NumCa); + PackAddTime64Ex(p, "Expires", e->Expires, i, t->NumCa); + } + PackSetCurrentJsonGroupName(p, NULL); +} +void FreeRpcHubEnumCa(RPC_HUB_ENUM_CA *t) +{ + // Validate arguments + if (t == NULL) + { + return; + } + + Free(t->Ca); +} + +// RPC_HUB_GET_CA +void InRpcHubGetCa(RPC_HUB_GET_CA *t, PACK *p) +{ + // Validate arguments + if (t == NULL || p == NULL) + { + return; + } + + Zero(t, sizeof(RPC_HUB_GET_CA)); + PackGetStr(p, "HubName", t->HubName, sizeof(t->HubName)); + t->Key = PackGetInt(p, "Key"); + t->Cert = PackGetX(p, "Cert"); +} +void OutRpcHubGetCa(PACK *p, RPC_HUB_GET_CA *t) +{ + // Validate arguments + if (t == NULL || p == NULL) + { + return; + } + + PackAddStr(p, "HubName", t->HubName); + PackAddInt(p, "Key", t->Key); + PackAddX(p, "Cert", t->Cert); +} +void FreeRpcHubGetCa(RPC_HUB_GET_CA *t) +{ + // Validate arguments + if (t == NULL) + { + return; + } + + FreeX(t->Cert); +} + +// RPC_HUB_DELETE_CA +void InRpcHubDeleteCa(RPC_HUB_DELETE_CA *t, PACK *p) +{ + // Validate arguments + if (t == NULL || p == NULL) + { + return; + } + + Zero(t, sizeof(RPC_HUB_DELETE_CA)); + PackGetStr(p, "HubName", t->HubName, sizeof(t->HubName)); + t->Key = PackGetInt(p, "Key"); +} +void OutRpcHubDeleteCa(PACK *p, RPC_HUB_DELETE_CA *t) +{ + // Validate arguments + if (t == NULL || p == NULL) + { + return; + } + + PackAddStr(p, "HubName", t->HubName); + PackAddInt(p, "Key", t->Key); +} + +// RPC_CREATE_LINK +void InRpcCreateLink(RPC_CREATE_LINK *t, PACK *p) +{ + BUF *b; + // Validate arguments + if (t == NULL || p == NULL) + { + return; + } + + Zero(t, sizeof(RPC_CREATE_LINK)); + PackGetStr(p, "HubName_Ex", t->HubName, sizeof(t->HubName)); + t->Online = PackGetBool(p, "Online"); + t->ClientOption = ZeroMalloc(sizeof(CLIENT_OPTION)); + InRpcClientOption(t->ClientOption, p); + t->ClientAuth = ZeroMalloc(sizeof(CLIENT_AUTH)); + InRpcClientAuth(t->ClientAuth, p); + InRpcPolicy(&t->Policy, p); + + t->CheckServerCert = PackGetBool(p, "CheckServerCert"); + b = PackGetBuf(p, "ServerCert"); + if (b != NULL) + { + t->ServerCert = BufToX(b, false); + FreeBuf(b); + } +} +void OutRpcCreateLink(PACK *p, RPC_CREATE_LINK *t) +{ + // Validate arguments + if (t == NULL || p == NULL) + { + return; + } + + PackAddStr(p, "HubName_Ex",t->HubName); + PackAddBool(p, "Online", t->Online); + OutRpcClientOption(p, t->ClientOption); + OutRpcClientAuth(p, t->ClientAuth); + OutRpcPolicy(p, &t->Policy); + + PackAddBool(p, "CheckServerCert", t->CheckServerCert); + if (t->ServerCert != NULL) + { + BUF *b; + b = XToBuf(t->ServerCert, false); + PackAddBuf(p, "ServerCert", b); + FreeBuf(b); + } +} +void FreeRpcCreateLink(RPC_CREATE_LINK *t) +{ + // Validate arguments + if (t == NULL) + { + return; + } + + if (t->ServerCert != NULL) + { + FreeX(t->ServerCert); + } + Free(t->ClientOption); + CiFreeClientAuth(t->ClientAuth); +} + +// RPC_ENUM_LINK +void InRpcEnumLink(RPC_ENUM_LINK *t, PACK *p) +{ + UINT i; + // Validate arguments + if (t == NULL || p == NULL) + { + return; + } + + Zero(t, sizeof(RPC_ENUM_LINK)); + PackGetStr(p, "HubName", t->HubName, sizeof(t->HubName)); + t->NumLink = PackGetIndexCount(p, "AccountName"); + t->Links = ZeroMalloc(sizeof(RPC_ENUM_LINK_ITEM) * t->NumLink); + + for (i = 0;i < t->NumLink;i++) + { + RPC_ENUM_LINK_ITEM *e = &t->Links[i]; + + PackGetUniStrEx(p, "AccountName", e->AccountName, sizeof(e->AccountName), i); + PackGetStrEx(p, "Hostname", e->Hostname, sizeof(e->Hostname), i); + PackGetStrEx(p, "ConnectedHubName", e->HubName, sizeof(e->HubName), i); + e->Online = PackGetBoolEx(p, "Online", i); + e->ConnectedTime = PackGetInt64Ex(p, "ConnectedTime", i); + e->Connected = PackGetBoolEx(p, "Connected", i); + e->LastError = PackGetIntEx(p, "LastError", i); + PackGetStrEx(p, "LinkHubName", e->HubName, sizeof(e->HubName), i); + } +} +void OutRpcEnumLink(PACK *p, RPC_ENUM_LINK *t) +{ + UINT i; + // Validate arguments + if (t == NULL || p == NULL) + { + return; + } + + PackAddStr(p, "HubName", t->HubName); + + PackSetCurrentJsonGroupName(p, "LinkList"); + for (i = 0;i < t->NumLink;i++) + { + RPC_ENUM_LINK_ITEM *e = &t->Links[i]; + + PackAddUniStrEx(p, "AccountName", e->AccountName, i, t->NumLink); + PackAddStrEx(p, "ConnectedHubName", e->HubName, i, t->NumLink); + PackAddStrEx(p, "Hostname", e->Hostname, i, t->NumLink); + PackAddBoolEx(p, "Online", e->Online, i, t->NumLink); + PackAddTime64Ex(p, "ConnectedTime", e->ConnectedTime, i, t->NumLink); + PackAddBoolEx(p, "Connected", e->Connected, i, t->NumLink); + PackAddIntEx(p, "LastError", e->LastError, i, t->NumLink); + PackAddStrEx(p, "TargetHubName", e->HubName, i, t->NumLink); + } + PackSetCurrentJsonGroupName(p, NULL); +} +void FreeRpcEnumLink(RPC_ENUM_LINK *t) +{ + // Validate arguments + if (t == NULL) + { + return; + } + + Free(t->Links); +} + +// RPC_LINK_STATUS +void InRpcLinkStatus(RPC_LINK_STATUS *t, PACK *p) +{ + // Validate arguments + if (t == NULL || p == NULL) + { + return; + } + + Zero(t, sizeof(RPC_LINK_STATUS)); + PackGetStr(p, "HubName_Ex", t->HubName, sizeof(t->HubName)); + PackGetUniStr(p, "AccountName", t->AccountName, sizeof(t->AccountName)); + InRpcClientGetConnectionStatus(&t->Status, p); +} +void OutRpcLinkStatus(PACK *p, RPC_LINK_STATUS *t) +{ + // Validate arguments + if (t == NULL || p == NULL) + { + return; + } + + PackAddStr(p, "HubName_Ex", t->HubName); + PackAddUniStr(p, "AccountName", t->AccountName); + OutRpcClientGetConnectionStatus(p, &t->Status); +} +void FreeRpcLinkStatus(RPC_LINK_STATUS *t) +{ + // Validate arguments + if (t == NULL) + { + return; + } + + CiFreeClientGetConnectionStatus(&t->Status); +} + +// RPC_LINK +void InRpcLink(RPC_LINK *t, PACK *p) +{ + // Validate arguments + if (t == NULL || p == NULL) + { + return; + } + + Zero(t, sizeof(RPC_LINK)); + PackGetStr(p, "HubName", t->HubName, sizeof(t->HubName)); + PackGetUniStr(p, "AccountName", t->AccountName, sizeof(t->AccountName)); +} +void OutRpcLink(PACK *p, RPC_LINK *t) +{ + // Validate arguments + if (t == NULL) + { + return; + } + + PackAddStr(p, "HubName", t->HubName); + PackAddUniStr(p, "AccountName", t->AccountName); +} + +// RPC_RENAME_LINK +void InRpcRenameLink(RPC_RENAME_LINK *t, PACK *p) +{ + // Validate arguments + if (t == NULL || p == NULL) + { + return; + } + + Zero(t, sizeof(RPC_RENAME_LINK)); + PackGetStr(p, "HubName", t->HubName, sizeof(t->HubName)); + PackGetUniStr(p, "OldAccountName", t->OldAccountName, sizeof(t->OldAccountName)); + PackGetUniStr(p, "NewAccountName", t->NewAccountName, sizeof(t->NewAccountName)); +} +void OutRpcRenameLink(PACK *p, RPC_RENAME_LINK *t) +{ + // Validate arguments + if (p == NULL || t == NULL) + { + return; + } + + PackAddStr(p, "HubName", t->HubName); + PackAddUniStr(p, "OldAccountName", t->OldAccountName); + PackAddUniStr(p, "NewAccountName", t->NewAccountName); +} + +// ACCESS +void InRpcAccessEx(ACCESS *a, PACK *p, UINT index) +{ + // Validate arguments + if (a == NULL || p == NULL) + { + return; + } + + Zero(a, sizeof(ACCESS)); + a->Id = PackGetIntEx(p, "Id", index); + PackGetUniStrEx(p, "Note", a->Note, sizeof(a->Note), index); + a->Active = PackGetBoolEx(p, "Active", index); + a->Priority = PackGetIntEx(p, "Priority", index); + a->Discard = PackGetBoolEx(p, "Discard", index); + a->SrcIpAddress = PackGetIp32Ex(p, "SrcIpAddress", index); + a->SrcSubnetMask = PackGetIp32Ex(p, "SrcSubnetMask", index); + a->DestIpAddress = PackGetIp32Ex(p, "DestIpAddress", index); + a->DestSubnetMask = PackGetIp32Ex(p, "DestSubnetMask", index); + a->Protocol = PackGetIntEx(p, "Protocol", index); + a->SrcPortStart = PackGetIntEx(p, "SrcPortStart", index); + a->SrcPortEnd = PackGetIntEx(p, "SrcPortEnd", index); + a->DestPortStart = PackGetIntEx(p, "DestPortStart", index); + a->DestPortEnd = PackGetIntEx(p, "DestPortEnd", index); + //a->SrcUsernameHash = PackGetIntEx(p, "SrcUsernameHash", index); + PackGetStrEx(p, "SrcUsername", a->SrcUsername, sizeof(a->SrcUsername), index); + //a->DestUsernameHash = PackGetIntEx(p, "DestUsernameHash", index); + PackGetStrEx(p, "DestUsername", a->DestUsername, sizeof(a->DestUsername), index); + a->CheckSrcMac = PackGetBoolEx(p, "CheckSrcMac", index); + PackGetDataEx2(p, "SrcMacAddress", a->SrcMacAddress, sizeof(a->SrcMacAddress), index); + PackGetDataEx2(p, "SrcMacMask", a->SrcMacMask, sizeof(a->SrcMacMask), index); + a->CheckDstMac = PackGetBoolEx(p, "CheckDstMac", index); + PackGetDataEx2(p, "DstMacAddress", a->DstMacAddress, sizeof(a->DstMacAddress), index); + PackGetDataEx2(p, "DstMacMask", a->DstMacMask, sizeof(a->DstMacMask), index); + a->CheckTcpState = PackGetBoolEx(p, "CheckTcpState", index); + a->Established = PackGetBoolEx(p, "Established", index); + a->Delay = PackGetIntEx(p, "Delay", index); + a->Jitter = PackGetIntEx(p, "Jitter", index); + a->Loss = PackGetIntEx(p, "Loss", index); + a->IsIPv6 = PackGetBoolEx(p, "IsIPv6", index); + a->UniqueId = PackGetIntEx(p, "UniqueId", index); + PackGetStrEx(p, "RedirectUrl", a->RedirectUrl, sizeof(a->RedirectUrl), index); + if (a->IsIPv6) + { + PackGetIp6AddrEx(p, "SrcIpAddress6", &a->SrcIpAddress6, index); + PackGetIp6AddrEx(p, "SrcSubnetMask6", &a->SrcSubnetMask6, index); + PackGetIp6AddrEx(p, "DestIpAddress6", &a->DestIpAddress6, index); + PackGetIp6AddrEx(p, "DestSubnetMask6", &a->DestSubnetMask6, index); + } +} +void InRpcAccess(ACCESS *a, PACK *p) +{ + // Validate arguments + if (a == NULL || p == NULL) + { + return; + } + + InRpcAccessEx(a, p, 0); +} +void OutRpcAccessEx(PACK *p, ACCESS *a, UINT index, UINT total) +{ + // Validate arguments + if (a == NULL || p == NULL) + { + return; + } + + PackAddIntEx(p, "Id", a->Id, index, total); + PackAddUniStrEx(p, "Note", a->Note, index, total); + PackAddBoolEx(p, "Active", a->Active, index, total); + PackAddIntEx(p, "Priority", a->Priority, index, total); + PackAddBoolEx(p, "Discard", a->Discard, index, total); + if (a->IsIPv6) + { + PackAddIp32Ex(p, "SrcIpAddress", 0xFDFFFFDF, index, total); + PackAddIp32Ex(p, "SrcSubnetMask", 0xFFFFFFFF, index, total); + PackAddIp32Ex(p, "DestIpAddress", 0xFDFFFFDF, index, total); + PackAddIp32Ex(p, "DestSubnetMask", 0xFFFFFFFF, index, total); + } + else + { + PackAddIp32Ex(p, "SrcIpAddress", a->SrcIpAddress, index, total); + PackAddIp32Ex(p, "SrcSubnetMask", a->SrcSubnetMask, index, total); + PackAddIp32Ex(p, "DestIpAddress", a->DestIpAddress, index, total); + PackAddIp32Ex(p, "DestSubnetMask", a->DestSubnetMask, index, total); + } + PackAddIntEx(p, "Protocol", a->Protocol, index, total); + PackAddIntEx(p, "SrcPortStart", a->SrcPortStart, index, total); + PackAddIntEx(p, "SrcPortEnd", a->SrcPortEnd, index, total); + PackAddIntEx(p, "DestPortStart", a->DestPortStart, index, total); + PackAddIntEx(p, "DestPortEnd", a->DestPortEnd, index, total); + //PackAddIntEx(p, "SrcUsernameHash", a->SrcUsernameHash, index, total); + PackAddStrEx(p, "SrcUsername", a->SrcUsername, index, total); + //PackAddIntEx(p, "DestUsernameHash", a->DestUsernameHash, index, total); + PackAddStrEx(p, "DestUsername", a->DestUsername, index, total); + PackAddBoolEx(p, "CheckSrcMac", a->CheckSrcMac, index, total); + PackAddDataEx(p, "SrcMacAddress", a->SrcMacAddress, sizeof(a->SrcMacAddress), index, total); + PackAddDataEx(p, "SrcMacMask", a->SrcMacMask, sizeof(a->SrcMacMask), index, total); + PackAddBoolEx(p, "CheckDstMac", a->CheckDstMac, index, total); + PackAddDataEx(p, "DstMacAddress", a->DstMacAddress, sizeof(a->DstMacAddress), index, total); + PackAddDataEx(p, "DstMacMask", a->DstMacMask, sizeof(a->DstMacMask), index, total); + PackAddBoolEx(p, "CheckTcpState", a->CheckTcpState, index, total); + PackAddBoolEx(p, "Established", a->Established, index, total); + PackAddIntEx(p, "Delay", a->Delay, index, total); + PackAddIntEx(p, "Jitter", a->Jitter, index, total); + PackAddIntEx(p, "Loss", a->Loss, index, total); + PackAddBoolEx(p, "IsIPv6", a->IsIPv6, index, total); + PackAddIntEx(p, "UniqueId", a->UniqueId, index, total); + PackAddStrEx(p, "RedirectUrl", a->RedirectUrl, index, total); + if (a->IsIPv6) + { + PackAddIp6AddrEx(p, "SrcIpAddress6", &a->SrcIpAddress6, index, total); + PackAddIp6AddrEx(p, "SrcSubnetMask6", &a->SrcSubnetMask6, index, total); + PackAddIp6AddrEx(p, "DestIpAddress6", &a->DestIpAddress6, index, total); + PackAddIp6AddrEx(p, "DestSubnetMask6", &a->DestSubnetMask6, index, total); + } + else + { + IPV6_ADDR zero; + + Zero(&zero, sizeof(zero)); + + PackAddIp6AddrEx(p, "SrcIpAddress6", &zero, index, total); + PackAddIp6AddrEx(p, "SrcSubnetMask6", &zero, index, total); + PackAddIp6AddrEx(p, "DestIpAddress6", &zero, index, total); + PackAddIp6AddrEx(p, "DestSubnetMask6", &zero, index, total); + } +} +void OutRpcAccess(PACK *p, ACCESS *a) +{ + // Validate arguments + if (a == NULL || p == NULL) + { + return; + } + + OutRpcAccessEx(p, a, 0, 1); +} + +// RPC_ENUM_ACCESS_LIST +void InRpcEnumAccessList(RPC_ENUM_ACCESS_LIST *a, PACK *p) +{ + UINT i; + // Validate arguments + if (a == NULL || p == NULL) + { + return; + } + + Zero(a, sizeof(RPC_ENUM_ACCESS_LIST)); + PackGetStr(p, "HubName", a->HubName, sizeof(a->HubName)); + a->NumAccess = PackGetIndexCount(p, "Protocol"); + a->Accesses = ZeroMalloc(sizeof(ACCESS) * a->NumAccess); + + for (i = 0;i < a->NumAccess;i++) + { + ACCESS *e = &a->Accesses[i]; + + InRpcAccessEx(e, p, i); + } +} +void OutRpcEnumAccessList(PACK *p, RPC_ENUM_ACCESS_LIST *a) +{ + UINT i; + // Validate arguments + if (a == NULL || p == NULL) + { + return; + } + PackAddStr(p, "HubName", a->HubName); + + PackSetCurrentJsonGroupName(p, "AccessList"); + for (i = 0;i < a->NumAccess;i++) + { + ACCESS *e = &a->Accesses[i]; + + OutRpcAccessEx(p, e, i, a->NumAccess); + } + PackSetCurrentJsonGroupName(p, NULL); +} +void FreeRpcEnumAccessList(RPC_ENUM_ACCESS_LIST *a) +{ + // Validate arguments + if (a == NULL) + { + return; + } + + Free(a->Accesses); +} + +// AUTHDATA +void *InRpcAuthData(PACK *p, UINT *authtype, char *username) +{ + wchar_t tmp[MAX_SIZE]; + AUTHPASSWORD *pw; + AUTHUSERCERT *usercert; + AUTHROOTCERT *rootcert; + AUTHRADIUS *radius; + AUTHNT *nt; + BUF *b; + char plain_pw[MAX_SIZE]; + // Validate arguments + if (p == NULL) + { + return NULL; + } + if (authtype == NULL) + { + return NULL; + } + + *authtype = PackGetInt(p, "AuthType"); + + switch (*authtype) + { + case AUTHTYPE_PASSWORD: + pw = ZeroMalloc(sizeof(AUTHPASSWORD)); + PackGetData2(p, "HashedKey", pw->HashedKey, sizeof(pw->HashedKey)); + PackGetData2(p, "NtLmSecureHash", pw->NtLmSecureHash, sizeof(pw->NtLmSecureHash)); + + if (PackGetStr(p, "Auth_Password", plain_pw, sizeof(plain_pw))) + { + if (IsZero(pw->HashedKey, sizeof(pw->HashedKey))) + { + HashPassword(pw->HashedKey, username, plain_pw); + GenerateNtPasswordHash(pw->NtLmSecureHash, plain_pw); + } + } + return pw; + + case AUTHTYPE_USERCERT: + usercert = ZeroMalloc(sizeof(AUTHUSERCERT)); + usercert->UserX = PackGetX(p, "UserX"); + return usercert; + + case AUTHTYPE_ROOTCERT: + rootcert = ZeroMalloc(sizeof(AUTHROOTCERT)); + b = PackGetBuf(p, "Serial"); + if (b != NULL) + { + rootcert->Serial = NewXSerial(b->Buf, b->Size); + FreeBuf(b); + } + if (PackGetUniStr(p, "CommonName", tmp, sizeof(tmp))) + { + rootcert->CommonName = CopyUniStr(tmp); + } + return rootcert; + + case AUTHTYPE_RADIUS: + radius = ZeroMalloc(sizeof(AUTHRADIUS)); + if (PackGetUniStr(p, "RadiusUsername", tmp, sizeof(tmp))) + { + radius->RadiusUsername = CopyUniStr(tmp); + } + else + { + radius->RadiusUsername = CopyUniStr(L""); + } + return radius; + + case AUTHTYPE_NT: + nt = ZeroMalloc(sizeof(AUTHNT)); + if (PackGetUniStr(p, "NtUsername", tmp, sizeof(tmp))) + { + nt->NtUsername = CopyUniStr(tmp); + } + else + { + nt->NtUsername = CopyUniStr(L""); + } + return nt; + } + + return NULL; +} +void OutRpcAuthData(PACK *p, void *authdata, UINT authtype) +{ + AUTHPASSWORD *pw = authdata; + AUTHUSERCERT *usercert = authdata; + AUTHROOTCERT *rootcert = authdata; + AUTHRADIUS *radius = authdata; + AUTHNT *nt = authdata; + // Validate arguments + if (p == NULL) + { + return; + } + + PackAddInt(p, "AuthType", authtype); + + switch (authtype) + { + case AUTHTYPE_PASSWORD: + PackAddData(p, "HashedKey", pw->HashedKey, sizeof(pw->HashedKey)); + PackAddData(p, "NtLmSecureHash", pw->NtLmSecureHash, sizeof(pw->NtLmSecureHash)); + break; + + case AUTHTYPE_USERCERT: + PackAddX(p, "UserX", usercert->UserX); + break; + + case AUTHTYPE_ROOTCERT: + if (rootcert->Serial != NULL) + { + PackAddData(p, "Serial", rootcert->Serial->data, rootcert->Serial->size); + } + if (rootcert->CommonName != NULL) + { + PackAddUniStr(p, "CommonName", rootcert->CommonName); + } + break; + + case AUTHTYPE_RADIUS: + PackAddUniStr(p, "RadiusUsername", radius->RadiusUsername); + break; + + case AUTHTYPE_NT: + PackAddUniStr(p, "NtUsername", nt->NtUsername); + break; + } +} +void FreeRpcAuthData(void *authdata, UINT authtype) +{ + FreeAuthData(authtype, authdata); +} + +// RPC_SET_USER +void InRpcSetUser(RPC_SET_USER *t, PACK *p) +{ + // Validate arguments + if (t == NULL || p == NULL) + { + return; + } + + Zero(t, sizeof(RPC_SET_USER)); + PackGetStr(p, "HubName", t->HubName, sizeof(t->HubName)); + PackGetStr(p, "Name", t->Name, sizeof(t->Name)); + PackGetStr(p, "GroupName", t->GroupName, sizeof(t->GroupName)); + PackGetUniStr(p, "Realname", t->Realname, sizeof(t->Realname)); + PackGetUniStr(p, "Note", t->Note, sizeof(t->Note)); + t->CreatedTime = PackGetInt64(p, "CreatedTime"); + t->UpdatedTime = PackGetInt64(p, "UpdatedTime"); + t->ExpireTime = PackGetInt64(p, "ExpireTime"); + t->AuthData = InRpcAuthData(p, &t->AuthType, t->Name); + t->NumLogin = PackGetInt(p, "NumLogin"); + InRpcTraffic(&t->Traffic, p); + + if (PackGetBool(p, "UsePolicy")) + { + t->Policy = ZeroMalloc(sizeof(POLICY)); + InRpcPolicy(t->Policy, p); + } +} + +void OutRpcSetUser(PACK *p, RPC_SET_USER *t) +{ + // Validate arguments + if (t == NULL || p == NULL) + { + return; + } + + PackAddStr(p, "HubName", t->HubName); + PackAddStr(p, "Name", t->Name); + PackAddStr(p, "GroupName", t->GroupName); + PackAddUniStr(p, "Realname", t->Realname); + PackAddUniStr(p, "Note", t->Note); + PackAddTime64(p, "CreatedTime", t->CreatedTime); + PackAddTime64(p, "UpdatedTime", t->UpdatedTime); + PackAddTime64(p, "ExpireTime", t->ExpireTime); + OutRpcAuthData(p, t->AuthData, t->AuthType); + PackAddInt(p, "NumLogin", t->NumLogin); + OutRpcTraffic(p, &t->Traffic); + + if (t->Policy != NULL) + { + PackAddBool(p, "UsePolicy", true); + OutRpcPolicy(p, t->Policy); + } +} +void FreeRpcSetUser(RPC_SET_USER *t) +{ + // Validate arguments + if (t == NULL) + { + return; + } + + FreeRpcAuthData(t->AuthData, t->AuthType); + if (t->Policy) + { + Free(t->Policy); + } +} + +// RPC_ENUM_USER +void InRpcEnumUser(RPC_ENUM_USER *t, PACK *p) +{ + UINT i; + // Validate arguments + if (t == NULL || p == NULL) + { + return; + } + + Zero(t, sizeof(RPC_ENUM_USER)); + PackGetStr(p, "HubName", t->HubName, sizeof(t->HubName)); + t->NumUser = PackGetIndexCount(p, "Name"); + t->Users = ZeroMalloc(sizeof(RPC_ENUM_USER_ITEM) * t->NumUser); + + for (i = 0;i < t->NumUser;i++) + { + RPC_ENUM_USER_ITEM *e = &t->Users[i]; + + PackGetStrEx(p, "Name", e->Name, sizeof(e->Name), i); + PackGetStrEx(p, "GroupName", e->GroupName, sizeof(e->GroupName), i); + PackGetUniStrEx(p, "Realname", e->Realname, sizeof(e->Realname), i); + PackGetUniStrEx(p, "Note", e->Note, sizeof(e->Note), i); + e->AuthType = PackGetIntEx(p, "AuthType", i); + e->LastLoginTime = PackGetInt64Ex(p, "LastLoginTime", i); + e->NumLogin = PackGetIntEx(p, "NumLogin", i); + e->DenyAccess = PackGetBoolEx(p, "DenyAccess", i); + + e->IsTrafficFilled = PackGetBoolEx(p, "IsTrafficFilled", i); + InRpcTrafficEx(&e->Traffic, p, i); + + e->IsExpiresFilled = PackGetBoolEx(p, "IsExpiresFilled", i); + e->Expires = PackGetInt64Ex(p, "Expires", i); + } +} +void OutRpcEnumUser(PACK *p, RPC_ENUM_USER *t) +{ + UINT i; + // Validate arguments + if (t == NULL || p == NULL) + { + return; + } + PackAddStr(p, "HubName", t->HubName); + + PackSetCurrentJsonGroupName(p, "UserList"); + for (i = 0;i < t->NumUser;i++) + { + RPC_ENUM_USER_ITEM *e = &t->Users[i]; + + PackAddStrEx(p, "Name", e->Name, i, t->NumUser); + PackAddStrEx(p, "GroupName", e->GroupName, i, t->NumUser); + PackAddUniStrEx(p, "Realname", e->Realname, i, t->NumUser); + PackAddUniStrEx(p, "Note", e->Note, i, t->NumUser); + PackAddIntEx(p, "AuthType", e->AuthType, i, t->NumUser); + PackAddTime64Ex(p, "LastLoginTime", e->LastLoginTime, i, t->NumUser); + PackAddIntEx(p, "NumLogin", e->NumLogin, i, t->NumUser); + PackAddBoolEx(p, "DenyAccess", e->DenyAccess, i, t->NumUser); + + PackAddBoolEx(p, "IsTrafficFilled", e->IsTrafficFilled, i, t->NumUser); + OutRpcTrafficEx(&e->Traffic, p, i, t->NumUser); + + PackAddBoolEx(p, "IsExpiresFilled", e->IsExpiresFilled, i, t->NumUser); + PackAddTime64Ex(p, "Expires", e->Expires, i, t->NumUser); + } + PackSetCurrentJsonGroupName(p, NULL); +} +void FreeRpcEnumUser(RPC_ENUM_USER *t) +{ + // Validate arguments + if (t == NULL) + { + return; + } + + Free(t->Users); +} + +// RPC_SET_GROUP +void InRpcSetGroup(RPC_SET_GROUP *t, PACK *p) +{ + // Validate arguments + if (t == NULL || p == NULL) + { + return; + } + + Zero(t, sizeof(RPC_SET_GROUP)); + PackGetStr(p, "HubName", t->HubName, sizeof(t->HubName)); + PackGetStr(p, "Name", t->Name, sizeof(t->Name)); + PackGetUniStr(p, "Realname", t->Realname, sizeof(t->Realname)); + PackGetUniStr(p, "Note", t->Note, sizeof(t->Note)); + InRpcTraffic(&t->Traffic, p); + + if (PackGetBool(p, "UsePolicy")) + { + t->Policy = ZeroMalloc(sizeof(POLICY)); + InRpcPolicy(t->Policy, p); + } +} +void OutRpcSetGroup(PACK *p, RPC_SET_GROUP *t) +{ + // Validate arguments + if (t == NULL || p == NULL) + { + return; + } + + PackAddStr(p, "HubName", t->HubName); + PackAddStr(p, "Name", t->Name); + PackAddUniStr(p, "Realname", t->Realname); + PackAddUniStr(p, "Note", t->Note); + OutRpcTraffic(p, &t->Traffic); + + if (t->Policy != NULL) + { + PackAddBool(p, "UsePolicy", true); + OutRpcPolicy(p, t->Policy); + } +} +void FreeRpcSetGroup(RPC_SET_GROUP *t) +{ + Free(t->Policy); +} + +// RPC_ENUM_GROUP +void InRpcEnumGroup(RPC_ENUM_GROUP *t, PACK *p) +{ + UINT i; + // Validate arguments + if (t == NULL || p == NULL) + { + return; + } + + Zero(t, sizeof(RPC_ENUM_GROUP)); + PackGetStr(p, "HubName", t->HubName, sizeof(t->HubName)); + t->NumGroup = PackGetIndexCount(p, "Name"); + t->Groups = ZeroMalloc(sizeof(RPC_ENUM_GROUP_ITEM) * t->NumGroup); + + for (i = 0;i < t->NumGroup;i++) + { + RPC_ENUM_GROUP_ITEM *e = &t->Groups[i]; + + PackGetStrEx(p, "Name", e->Name, sizeof(e->Name), i); + PackGetUniStrEx(p, "Realname", e->Realname, sizeof(e->Realname), i); + PackGetUniStrEx(p, "Note", e->Note, sizeof(e->Note), i); + e->NumUsers = PackGetIntEx(p, "NumUsers", i); + e->DenyAccess = PackGetBoolEx(p, "DenyAccess", i); + } +} +void OutRpcEnumGroup(PACK *p, RPC_ENUM_GROUP *t) +{ + UINT i; + // Validate arguments + if (t == NULL || p == NULL) + { + return; + } + + PackAddStr(p, "HubName", t->HubName); + + PackSetCurrentJsonGroupName(p, "GroupList"); + for (i = 0;i < t->NumGroup;i++) + { + RPC_ENUM_GROUP_ITEM *e = &t->Groups[i]; + + PackAddStrEx(p, "Name", e->Name, i, t->NumGroup); + PackAddUniStrEx(p, "Realname", e->Realname, i, t->NumGroup); + PackAddUniStrEx(p, "Note", e->Note, i, t->NumGroup); + PackAddIntEx(p, "NumUsers", e->NumUsers, i, t->NumGroup); + PackAddBoolEx(p, "DenyAccess", e->DenyAccess, i, t->NumGroup); + } + PackSetCurrentJsonGroupName(p, NULL); +} +void FreeRpcEnumGroup(RPC_ENUM_GROUP *t) +{ + // Validate arguments + if (t == NULL) + { + return; + } + + Free(t->Groups); +} + +// RPC_DELETE_USER +void InRpcDeleteUser(RPC_DELETE_USER *t, PACK *p) +{ + // Validate arguments + if (t == NULL || p == NULL) + { + return; + } + + Zero(t, sizeof(RPC_DELETE_USER)); + PackGetStr(p, "HubName", t->HubName, sizeof(t->HubName)); + PackGetStr(p, "Name", t->Name, sizeof(t->Name)); +} +void OutRpcDeleteUser(PACK *p, RPC_DELETE_USER *t) +{ + // Validate arguments + if (t == NULL || p == NULL) + { + return; + } + + PackAddStr(p, "HubName", t->HubName); + PackAddStr(p, "Name", t->Name); +} + +// RPC_ENUM_SESSION +void InRpcEnumSession(RPC_ENUM_SESSION *t, PACK *p) +{ + UINT i; + // Validate arguments + if (t == NULL || p == NULL) + { + return; + } + + Zero(t, sizeof(RPC_ENUM_SESSION)); + PackGetStr(p, "HubName", t->HubName, sizeof(t->HubName)); + t->NumSession = PackGetIndexCount(p, "Name"); + t->Sessions = ZeroMalloc(sizeof(RPC_ENUM_SESSION_ITEM) * t->NumSession); + + for (i = 0;i < t->NumSession;i++) + { + RPC_ENUM_SESSION_ITEM *e = &t->Sessions[i]; + + PackGetStrEx(p, "Name", e->Name, sizeof(e->Name), i); + PackGetStrEx(p, "Username", e->Username, sizeof(e->Username), i); + e->Ip = PackGetIntEx(p, "Ip", i); + PackGetIpEx(p, "ClientIP", &e->ClientIP, i); + PackGetStrEx(p, "Hostname", e->Hostname, sizeof(e->Hostname), i); + e->MaxNumTcp = PackGetIntEx(p, "MaxNumTcp", i); + e->CurrentNumTcp = PackGetIntEx(p, "CurrentNumTcp", i); + e->PacketSize = PackGetInt64Ex(p, "PacketSize", i); + e->PacketNum = PackGetInt64Ex(p, "PacketNum", i); + e->RemoteSession = PackGetBoolEx(p, "RemoteSession", i); + e->LinkMode = PackGetBoolEx(p, "LinkMode", i); + e->SecureNATMode = PackGetBoolEx(p, "SecureNATMode", i); + e->BridgeMode = PackGetBoolEx(p, "BridgeMode", i); + e->Layer3Mode = PackGetBoolEx(p, "Layer3Mode", i); + e->Client_BridgeMode = PackGetBoolEx(p, "Client_BridgeMode", i); + e->Client_MonitorMode = PackGetBoolEx(p, "Client_MonitorMode", i); + PackGetStrEx(p, "RemoteHostname", e->RemoteHostname, sizeof(e->RemoteHostname), i); + e->VLanId = PackGetIntEx(p, "VLanId", i); + PackGetDataEx2(p, "UniqueId", e->UniqueId, sizeof(e->UniqueId), i); + e->IsDormantEnabled = PackGetBoolEx(p, "IsDormantEnabled", i); + e->IsDormant = PackGetBoolEx(p, "IsDormant", i); + e->LastCommDormant = PackGetInt64Ex(p, "LastCommDormant", i); + e->CreatedTime = PackGetInt64Ex(p, "CreatedTime", i); + e->LastCommTime = PackGetInt64Ex(p, "LastCommTime", i); + } +} +void OutRpcEnumSession(PACK *p, RPC_ENUM_SESSION *t) +{ + UINT i; + // Validate arguments + if (t == NULL || p == NULL) + { + return; + } + PackAddStr(p, "HubName", t->HubName); + + PackSetCurrentJsonGroupName(p, "SessionList"); + for (i = 0;i < t->NumSession;i++) + { + RPC_ENUM_SESSION_ITEM *e = &t->Sessions[i]; + + PackAddStrEx(p, "Name", e->Name, i, t->NumSession); + PackAddStrEx(p, "Username", e->Username, i, t->NumSession); + PackAddIp32Ex(p, "Ip", e->Ip, i, t->NumSession); + PackAddIpEx(p, "ClientIP", &e->ClientIP, i, t->NumSession); + PackAddStrEx(p, "Hostname", e->Hostname, i, t->NumSession); + PackAddIntEx(p, "MaxNumTcp", e->MaxNumTcp, i, t->NumSession); + PackAddIntEx(p, "CurrentNumTcp", e->CurrentNumTcp, i, t->NumSession); + PackAddInt64Ex(p, "PacketSize", e->PacketSize, i, t->NumSession); + PackAddInt64Ex(p, "PacketNum", e->PacketNum, i, t->NumSession); + PackAddBoolEx(p, "RemoteSession", e->RemoteSession, i, t->NumSession); + PackAddStrEx(p, "RemoteHostname", e->RemoteHostname, i, t->NumSession); + PackAddBoolEx(p, "LinkMode", e->LinkMode, i, t->NumSession); + PackAddBoolEx(p, "SecureNATMode", e->SecureNATMode, i, t->NumSession); + PackAddBoolEx(p, "BridgeMode", e->BridgeMode, i, t->NumSession); + PackAddBoolEx(p, "Layer3Mode", e->Layer3Mode, i, t->NumSession); + PackAddBoolEx(p, "Client_BridgeMode", e->Client_BridgeMode, i, t->NumSession); + PackAddBoolEx(p, "Client_MonitorMode", e->Client_MonitorMode, i, t->NumSession); + PackAddIntEx(p, "VLanId", e->VLanId, i, t->NumSession); + PackAddDataEx(p, "UniqueId", e->UniqueId, sizeof(e->UniqueId), i, t->NumSession); + PackAddBoolEx(p, "IsDormantEnabled", e->IsDormantEnabled, i, t->NumSession); + PackAddBoolEx(p, "IsDormant", e->IsDormant, i, t->NumSession); + PackAddTime64Ex(p, "LastCommDormant", e->LastCommDormant, i, t->NumSession); + PackAddTime64Ex(p, "CreatedTime", e->CreatedTime, i, t->NumSession); + PackAddTime64Ex(p, "LastCommTime", e->LastCommTime, i, t->NumSession); + } + PackSetCurrentJsonGroupName(p, NULL); +} +void FreeRpcEnumSession(RPC_ENUM_SESSION *t) +{ + // Validate arguments + if (t == NULL) + { + return; + } + + Free(t->Sessions); +} + +// RPC_KEY_PAIR +void InRpcKeyPair(RPC_KEY_PAIR *t, PACK *p) +{ + // Validate arguments + if (t == NULL || p == NULL) + { + return; + } + + t->Cert = PackGetX(p, "Cert"); + t->Key = PackGetK(p, "Key"); + t->Flag1 = PackGetInt(p, "Flag1"); +} +void OutRpcKeyPair(PACK *p, RPC_KEY_PAIR *t) +{ + // Validate arguments + if (p == NULL || t == NULL) + { + return; + } + + PackAddX(p, "Cert", t->Cert); + PackAddK(p, "Key", t->Key); + PackAddInt(p, "Flag1", t->Flag1); +} +void FreeRpcKeyPair(RPC_KEY_PAIR *t) +{ + FreeX(t->Cert); + FreeK(t->Key); +} + +// NODE_INFO +void InRpcNodeInfo(NODE_INFO *t, PACK *p) +{ + // Validate arguments + if (t == NULL || p == NULL) + { + return; + } + + Zero(t, sizeof(NODE_INFO)); + PackGetStr(p, "ClientProductName", t->ClientProductName, sizeof(t->ClientProductName)); + PackGetStr(p, "ServerProductName", t->ServerProductName, sizeof(t->ServerProductName)); + PackGetStr(p, "ClientOsName", t->ClientOsName, sizeof(t->ClientOsName)); + PackGetStr(p, "ClientOsVer", t->ClientOsVer, sizeof(t->ClientOsVer)); + PackGetStr(p, "ClientOsProductId", t->ClientOsProductId, sizeof(t->ClientOsProductId)); + PackGetStr(p, "ClientHostname", t->ClientHostname, sizeof(t->ClientHostname)); + PackGetStr(p, "ServerHostname", t->ServerHostname, sizeof(t->ServerHostname)); + PackGetStr(p, "ProxyHostname", t->ProxyHostname, sizeof(t->ProxyHostname)); + PackGetStr(p, "HubName", t->HubName, sizeof(t->HubName)); + PackGetData2(p, "UniqueId", t->UniqueId, sizeof(t->UniqueId)); + + t->ClientProductVer = PackGetInt(p, "ClientProductVer"); + t->ClientProductBuild = PackGetInt(p, "ClientProductBuild"); + t->ServerProductVer = PackGetInt(p, "ServerProductVer"); + t->ServerProductBuild = PackGetInt(p, "ServerProductBuild"); + t->ClientIpAddress = PackGetIp32(p, "ClientIpAddress"); + PackGetData2(p, "ClientIpAddress6", t->ClientIpAddress6, sizeof(t->ClientIpAddress6)); + t->ClientPort = PackGetInt(p, "ClientPort"); + t->ServerIpAddress = PackGetIp32(p, "ServerIpAddress"); + PackGetData2(p, "ServerIpAddress6", t->ServerIpAddress6, sizeof(t->ServerIpAddress6)); + t->ServerPort = PackGetInt(p, "ServerPort2"); + t->ProxyIpAddress = PackGetIp32(p, "ProxyIpAddress"); + PackGetData2(p, "ProxyIpAddress6", t->ProxyIpAddress6, sizeof(t->ProxyIpAddress6)); + t->ProxyPort = PackGetInt(p, "ProxyPort"); +} +void OutRpcNodeInfo(PACK *p, NODE_INFO *t) +{ + // Validate arguments + if (t == NULL || p == NULL) + { + return; + } + + PackAddStr(p, "ClientProductName", t->ClientProductName); + PackAddStr(p, "ServerProductName", t->ServerProductName); + PackAddStr(p, "ClientOsName", t->ClientOsName); + PackAddStr(p, "ClientOsVer", t->ClientOsVer); + PackAddStr(p, "ClientOsProductId", t->ClientOsProductId); + PackAddStr(p, "ClientHostname", t->ClientHostname); + PackAddStr(p, "ServerHostname", t->ServerHostname); + PackAddStr(p, "ProxyHostname", t->ProxyHostname); + PackAddStr(p, "HubName", t->HubName); + PackAddData(p, "UniqueId", t->UniqueId, sizeof(t->UniqueId)); + + PackAddInt(p, "ClientProductVer", t->ClientProductVer); + PackAddInt(p, "ClientProductBuild", t->ClientProductBuild); + PackAddInt(p, "ServerProductVer", t->ServerProductVer); + PackAddInt(p, "ServerProductBuild", t->ServerProductBuild); + PackAddIp32(p, "ClientIpAddress", t->ClientIpAddress); + PackAddData(p, "ClientIpAddress6", t->ClientIpAddress6, sizeof(t->ClientIpAddress6)); + PackAddInt(p, "ClientPort", t->ClientPort); + PackAddIp32(p, "ServerIpAddress", t->ServerIpAddress); + PackAddData(p, "ServerIpAddress6", t->ServerIpAddress6, sizeof(t->ServerIpAddress6)); + PackAddInt(p, "ServerPort2", t->ServerPort); + PackAddIp32(p, "ProxyIpAddress", t->ProxyIpAddress); + PackAddData(p, "ProxyIpAddress6", t->ProxyIpAddress6, sizeof(t->ProxyIpAddress6)); + PackAddInt(p, "ProxyPort", t->ProxyPort); +} + +// RPC_SESSION_STATUS +void InRpcSessionStatus(RPC_SESSION_STATUS *t, PACK *p) +{ + // Validate arguments + if (t == NULL || p == NULL) + { + return; + } + + Zero(t, sizeof(RPC_SESSION_STATUS)); + PackGetStr(p, "HubName", t->HubName, sizeof(t->HubName)); + PackGetStr(p, "Name", t->Name, sizeof(t->Name)); + PackGetStr(p, "Username", t->Username, sizeof(t->Username)); + PackGetStr(p, "GroupName", t->GroupName, sizeof(t->GroupName)); + PackGetStr(p, "RealUsername", t->RealUsername, sizeof(t->RealUsername)); + t->ClientIp = PackGetIp32(p, "SessionStatus_ClientIp"); + PackGetData2(p, "SessionStatus_ClientIp6", t->ClientIp6, sizeof(t->ClientIp6)); + PackGetStr(p, "SessionStatus_ClientHostName", t->ClientHostName, sizeof(t->ClientHostName)); + PackGetIp(p, "Client_Ip_Address", &t->ClientIpAddress); + + InRpcClientGetConnectionStatus(&t->Status, p); + InRpcNodeInfo(&t->NodeInfo, p); +} +void OutRpcSessionStatus(PACK *p, RPC_SESSION_STATUS *t) +{ + // Validate arguments + if (t == NULL || p == NULL) + { + return; + } + + PackAddStr(p, "HubName", t->HubName); + PackAddStr(p, "Name", t->Name); + PackAddStr(p, "Username", t->Username); + PackAddStr(p, "GroupName", t->GroupName); + PackAddStr(p, "RealUsername", t->RealUsername); + PackAddIp32(p, "SessionStatus_ClientIp", t->ClientIp); + PackAddData(p, "SessionStatus_ClientIp6", t->ClientIp6, sizeof(t->ClientIp6)); + PackAddStr(p, "SessionStatus_ClientHostName", t->ClientHostName); + PackAddIp(p, "Client_Ip_Address", &t->ClientIpAddress); + + OutRpcClientGetConnectionStatus(p, &t->Status); + OutRpcNodeInfo(p, &t->NodeInfo); +} +void FreeRpcSessionStatus(RPC_SESSION_STATUS *t) +{ + // Validate arguments + if (t == NULL) + { + return; + } + + CiFreeClientGetConnectionStatus(&t->Status); +} + +// RPC_DELETE_SESSION +void InRpcDeleteSession(RPC_DELETE_SESSION *t, PACK *p) +{ + // Validate arguments + if (t == NULL || p == NULL) + { + return; + } + + Zero(t, sizeof(RPC_DELETE_SESSION)); + PackGetStr(p, "HubName", t->HubName, sizeof(t->HubName)); + PackGetStr(p, "Name", t->Name, sizeof(t->Name)); +} +void OutRpcDeleteSession(PACK *p, RPC_DELETE_SESSION *t) +{ + // Validate arguments + if (t == NULL || p == NULL) + { + return; + } + + PackAddStr(p, "HubName", t->HubName); + PackAddStr(p, "Name", t->Name); +} + +// RPC_ENUM_MAC_TABLE +void InRpcEnumMacTable(RPC_ENUM_MAC_TABLE *t, PACK *p) +{ + UINT i; + // Validate arguments + if (t == NULL || p == NULL) + { + return; + } + + Zero(t, sizeof(RPC_ENUM_MAC_TABLE)); + PackGetStr(p, "HubName", t->HubName, sizeof(t->HubName)); + t->NumMacTable = PackGetIndexCount(p, "SessionName"); + t->MacTables = ZeroMalloc(sizeof(RPC_ENUM_MAC_TABLE_ITEM) * t->NumMacTable); + + for (i = 0;i < t->NumMacTable;i++) + { + RPC_ENUM_MAC_TABLE_ITEM *e = &t->MacTables[i]; + + e->Key = PackGetIntEx(p, "Key", i); + PackGetStrEx(p, "SessionName", e->SessionName, sizeof(e->SessionName), i); + PackGetDataEx2(p, "MacAddress", e->MacAddress, sizeof(e->MacAddress), i); + e->VlanId = PackGetIntEx(p, "VlanId", i); + e->CreatedTime = PackGetInt64Ex(p, "CreatedTime", i); + e->UpdatedTime = PackGetInt64Ex(p, "UpdatedTime", i); + e->RemoteItem = PackGetBoolEx(p, "RemoteItem", i); + PackGetStrEx(p, "RemoteHostname", e->RemoteHostname, sizeof(e->RemoteHostname), i); + } +} +void OutRpcEnumMacTable(PACK *p, RPC_ENUM_MAC_TABLE *t) +{ + UINT i; + // Validate arguments + if (t == NULL || p == NULL) + { + return; + } + + PackAddStr(p, "HubName", t->HubName); + + PackSetCurrentJsonGroupName(p, "MacTable"); + for (i = 0;i < t->NumMacTable;i++) + { + RPC_ENUM_MAC_TABLE_ITEM *e = &t->MacTables[i]; + + PackAddIntEx(p, "Key", e->Key, i, t->NumMacTable); + PackAddStrEx(p, "SessionName", e->SessionName, i, t->NumMacTable); + PackAddDataEx(p, "MacAddress", e->MacAddress, sizeof(e->MacAddress), i, t->NumMacTable); + PackAddIntEx(p, "VlanId", e->VlanId, i, t->NumMacTable); + PackAddTime64Ex(p, "CreatedTime", e->CreatedTime, i, t->NumMacTable); + PackAddTime64Ex(p, "UpdatedTime", e->UpdatedTime, i, t->NumMacTable); + PackAddBoolEx(p, "RemoteItem", e->RemoteItem, i, t->NumMacTable); + PackAddStrEx(p, "RemoteHostname", e->RemoteHostname, i, t->NumMacTable); + } + PackSetCurrentJsonGroupName(p, NULL); +} +void FreeRpcEnumMacTable(RPC_ENUM_MAC_TABLE *t) +{ + // Validate arguments + if (t == NULL) + { + return; + } + + Free(t->MacTables); +} + +// RPC_ENUM_IP_TABLE +void InRpcEnumIpTable(RPC_ENUM_IP_TABLE *t, PACK *p) +{ + UINT i; + // Validate arguments + if (t == NULL || p == NULL) + { + return; + } + + Zero(t, sizeof(RPC_ENUM_IP_TABLE)); + PackGetStr(p, "HubName", t->HubName, sizeof(t->HubName)); + t->NumIpTable = PackGetIndexCount(p, "SessionName"); + t->IpTables = ZeroMalloc(sizeof(RPC_ENUM_IP_TABLE_ITEM) * t->NumIpTable); + + for (i = 0;i < t->NumIpTable;i++) + { + RPC_ENUM_IP_TABLE_ITEM *e = &t->IpTables[i]; + + e->Key = PackGetIntEx(p, "Key", i); + PackGetStrEx(p, "SessionName", e->SessionName, sizeof(e->SessionName), i); + e->Ip = PackGetIp32Ex(p, "Ip", i); + if (PackGetIpEx(p, "IpV6", &e->IpV6, i) == false) + { + UINTToIP(&e->IpV6, e->Ip); + } + PackGetIp(p, "IpAddress", &e->IpAddress); + e->DhcpAllocated = PackGetBoolEx(p, "DhcpAllocated", i); + e->CreatedTime = PackGetInt64Ex(p, "CreatedTime", i); + e->UpdatedTime = PackGetInt64Ex(p, "UpdatedTime", i); + e->RemoteItem = PackGetBoolEx(p, "RemoteItem", i); + PackGetStrEx(p, "RemoteHostname", e->RemoteHostname, sizeof(e->RemoteHostname), i); + } +} +void OutRpcEnumIpTable(PACK *p, RPC_ENUM_IP_TABLE *t) +{ + UINT i; + // Validate arguments + if (t == NULL || p == NULL) + { + return; + } + + PackAddStr(p, "HubName", t->HubName); + + PackSetCurrentJsonGroupName(p, "IpTable"); + for (i = 0;i < t->NumIpTable;i++) + { + RPC_ENUM_IP_TABLE_ITEM *e = &t->IpTables[i]; + + PackAddIntEx(p, "Key", e->Key, i, t->NumIpTable); + PackAddStrEx(p, "SessionName", e->SessionName, i, t->NumIpTable); + PackAddIp32Ex(p, "Ip", e->Ip, i, t->NumIpTable); + PackAddIpEx(p, "IpV6", &e->IpV6, i, t->NumIpTable); + PackAddIpEx(p, "IpAddress", &e->IpAddress, i, t->NumIpTable); + PackAddBoolEx(p, "DhcpAllocated", e->DhcpAllocated, i, t->NumIpTable); + PackAddTime64Ex(p, "CreatedTime", e->CreatedTime, i, t->NumIpTable); + PackAddTime64Ex(p, "UpdatedTime", e->UpdatedTime, i, t->NumIpTable); + PackAddBoolEx(p, "RemoteItem", e->RemoteItem, i, t->NumIpTable); + PackAddStrEx(p, "RemoteHostname", e->RemoteHostname, i, t->NumIpTable); + } + PackSetCurrentJsonGroupName(p, NULL); +} +void FreeRpcEnumIpTable(RPC_ENUM_IP_TABLE *t) +{ + // Validate arguments + if (t == NULL) + { + return; + } + + Free(t->IpTables); +} + +// RPC_DELETE_TABLE +void InRpcDeleteTable(RPC_DELETE_TABLE *t, PACK *p) +{ + // Validate arguments + if (t == NULL || p == NULL) + { + return; + } + + Zero(t, sizeof(RPC_DELETE_TABLE)); + PackGetStr(p, "HubName", t->HubName, sizeof(t->HubName)); + t->Key = PackGetInt(p, "Key"); +} +void OutRpcDeleteTable(PACK *p, RPC_DELETE_TABLE *t) +{ + // Validate arguments + if (t == NULL || p == NULL) + { + return; + } + + PackAddStr(p, "HubName", t->HubName); + PackAddInt(p, "Key", t->Key); +} + +// Adjoin RPC_ENUM_IP_TABLE +void AdjoinRpcEnumIpTable(RPC_ENUM_IP_TABLE *dest, RPC_ENUM_IP_TABLE *src) +{ + UINT old_num; + UINT i, n; + if (dest == NULL || src == NULL) + { + return; + } + + if (src->NumIpTable == 0) + { + return; + } + + old_num = dest->NumIpTable; + dest->NumIpTable += src->NumIpTable; + dest->IpTables = ReAlloc(dest->IpTables, sizeof(RPC_ENUM_IP_TABLE_ITEM) * dest->NumIpTable); + + n = 0; + for (i = old_num;i < dest->NumIpTable;i++) + { + Copy(&dest->IpTables[i], &src->IpTables[n++], sizeof(RPC_ENUM_IP_TABLE_ITEM)); + } +} + +// Adjoin RPC_ENUM_MAC_TABLE +void AdjoinRpcEnumMacTable(RPC_ENUM_MAC_TABLE *dest, RPC_ENUM_MAC_TABLE *src) +{ + UINT old_num; + UINT i, n; + if (dest == NULL || src == NULL) + { + return; + } + + if (src->NumMacTable == 0) + { + return; + } + + old_num = dest->NumMacTable; + dest->NumMacTable += src->NumMacTable; + dest->MacTables = ReAlloc(dest->MacTables, sizeof(RPC_ENUM_MAC_TABLE_ITEM) * dest->NumMacTable); + + n = 0; + for (i = old_num;i < dest->NumMacTable;i++) + { + Copy(&dest->MacTables[i], &src->MacTables[n++], sizeof(RPC_ENUM_MAC_TABLE_ITEM)); + } +} + +// Adjoin RPC_ENUM_SESSION +void AdjoinRpcEnumSession(RPC_ENUM_SESSION *dest, RPC_ENUM_SESSION *src) +{ + UINT old_num; + UINT i, n; + if (dest == NULL || src == NULL) + { + return; + } + + if (src->NumSession == 0) + { + return; + } + + old_num = dest->NumSession; + dest->NumSession += src->NumSession; + dest->Sessions = ReAlloc(dest->Sessions, sizeof(RPC_ENUM_SESSION_ITEM) * dest->NumSession); + + n = 0; + for (i = old_num;i < dest->NumSession;i++) + { + Copy(&dest->Sessions[i], &src->Sessions[n++], sizeof(RPC_ENUM_SESSION_ITEM)); + } +} + +// RPC_KEEP +void InRpcKeep(RPC_KEEP *t, PACK *p) +{ + // Validate arguments + if (t == NULL || p == NULL) + { + return; + } + + Zero(t, sizeof(RPC_KEEP)); + t->UseKeepConnect = PackGetBool(p, "UseKeepConnect"); + PackGetStr(p, "KeepConnectHost", t->KeepConnectHost, sizeof(t->KeepConnectHost)); + t->KeepConnectPort = PackGetInt(p, "KeepConnectPort"); + t->KeepConnectProtocol = PackGetInt(p, "KeepConnectProtocol"); + t->KeepConnectInterval = PackGetInt(p, "KeepConnectInterval"); +} +void OutRpcKeep(PACK *p, RPC_KEEP *t) +{ + // Validate arguments + if (t == NULL || p == NULL) + { + return; + } + + PackAddBool(p, "UseKeepConnect", t->UseKeepConnect); + PackAddStr(p, "KeepConnectHost", t->KeepConnectHost); + PackAddInt(p, "KeepConnectPort", t->KeepConnectPort); + PackAddInt(p, "KeepConnectProtocol", t->KeepConnectProtocol); + PackAddInt(p, "KeepConnectInterval", t->KeepConnectInterval); +} + +// test RPC function +UINT StTest(ADMIN *a, RPC_TEST *t) +{ + Format(t->StrValue, sizeof(t->StrValue), "%u", t->IntValue); + + return ERR_NO_ERROR; +} + +// RPC_TEST +void InRpcTest(RPC_TEST *t, PACK *p) +{ + Zero(t, sizeof(RPC_TEST)); + t->IntValue = PackGetInt(p, "IntValue"); + t->Int64Value = PackGetInt64(p, "Int64Value"); + PackGetStr(p, "StrValue", t->StrValue, sizeof(t->StrValue)); + PackGetUniStr(p, "UniStrValue", t->UniStrValue, sizeof(t->UniStrValue)); +} +void OutRpcTest(PACK *p, RPC_TEST *t) +{ + PackAddInt(p, "IntValue", t->IntValue); + PackAddInt64(p, "Int64Value", t->Int64Value); + PackAddStr(p, "StrValue", t->StrValue); + PackAddUniStr(p, "UniStrValue", t->UniStrValue); +} +void FreeRpcTest(RPC_TEST *t) +{ +} + +// Admin RPC call +PACK *AdminCall(RPC *rpc, char *function_name, PACK *p) +{ + // Validate arguments + if (rpc == NULL || function_name == NULL) + { + return NULL; + } + if (p == NULL) + { + p = NewPack(); + } + +// Debug("Admin RPC Call: %s\n", function_name); + + return RpcCall(rpc, function_name, p); +} + +// Check whether the source IP address is permitted to admin connection +bool CheckAdminSourceAddress(SOCK *sock, char *hubname) +{ + BUF *b; + char *s; + bool ok = false; + // Validate arguments + if (sock == NULL) + { + return false; + } + + b = ReadDump(ADMINIP_TXT); + if (b == NULL) + { + return true; + } + + while (true) + { + UINT i; + TOKEN_LIST *t; + IP ip; + IP mask; + IP ip1; + IP ip2; + s = CfgReadNextLine(b); + + if (s == NULL) + { + break; + } + + Trim(s); + + i = SearchStrEx(s, "//", 0, false); + if (i != INFINITE) + { + s[i] = 0; + } + + i = SearchStrEx(s, "#", 0, false); + if (i != INFINITE) + { + s[i] = 0; + } + + Trim(s); + + t = ParseToken(s, " \t"); + if (t != NULL) + { + if (t->NumTokens >= 1) + { + if (t->NumTokens == 1 || StrCmpi(hubname, t->Token[1]) == 0) + { + if (ParseIpAndMask46(t->Token[0], &ip, &mask)) + { + if (IsIP4(&sock->RemoteIP) && IsIP4(&ip)) + { + IPAnd4(&ip1, &sock->RemoteIP, &mask); + IPAnd4(&ip2, &ip, &mask); + + if (CmpIpAddr(&ip1, &ip2) == 0) + { + ok = true; + } + } + else if (IsIP6(&sock->RemoteIP) && IsIP6(&ip)) + { + IPAnd6(&ip1, &sock->RemoteIP, &mask); + IPAnd6(&ip2, &ip, &mask); + + if (CmpIpAddr(&ip1, &ip2) == 0) + { + ok = true; + } + } + } + else if (StrToIP(&ip, t->Token[0])) + { + if (CmpIpAddr(&sock->RemoteIP, &ip) == 0) + { + ok = true; + } + } + + if (StrCmpi(t->Token[0], "*") == 0) + { + ok = true; + } + } + } + + FreeToken(t); + } + + Free(s); + } + + FreeBuf(b); + + return ok; +} + +// Accept admin connection +UINT AdminAccept(CONNECTION *c, PACK *p) +{ + ADMIN *a; + UCHAR secure_password[SHA1_SIZE]; + UCHAR null_password[SHA1_SIZE]; + UCHAR secure_null_password[SHA1_SIZE]; + char hubname[MAX_HUBNAME_LEN + 1]; + CEDAR *cedar; + SOCK *sock; + RPC *rpc; + UINT err; + SERVER *server = NULL; + RPC_WINVER ver; + bool accept_empty_password; + bool is_empty_password = false; + // Validate arguments + if (c == NULL || p == NULL) + { + return ERR_INTERNAL_ERROR; + } + + cedar = c->Cedar; + sock = c->FirstSock; + + if (cedar != NULL) + { + server = cedar->Server; + } + + accept_empty_password = PackGetBool(p, "accept_empty_password"); + + // Get client OS version + InRpcWinVer(&ver, p); + + // Get hub name + if (PackGetStr(p, "hubname", hubname, sizeof(hubname)) == false) + { + // without hub name + StrCpy(hubname, sizeof(hubname), ""); + } + + // Check source IP address + if (CheckAdminSourceAddress(sock, hubname) == false) + { + SLog(c->Cedar, "LA_IP_DENIED", c->Name); + return ERR_IP_ADDRESS_DENIED; + } + + // Get password information + if (PackGetDataSize(p, "secure_password") != SHA1_SIZE) + { + // Malformed information + return ERR_PROTOCOL_ERROR; + } + PackGetData(p, "secure_password", secure_password); + + if (StrLen(hubname) == 0) + { + // Server admin mode + SLog(c->Cedar, "LA_CONNECTED_1", c->Name); + } + else + { + // Hub admin mode + if (server != NULL && server->ServerType == SERVER_TYPE_FARM_MEMBER) + { + // Connection with hub admin mode to cluster member is not permitted + return ERR_NOT_ENOUGH_RIGHT; + } + SLog(c->Cedar, "LA_CONNECTED_2", c->Name, hubname); + } + + // Check password + err = AdminCheckPassword(cedar, c->Random, secure_password, + StrLen(hubname) != 0 ? hubname : NULL, accept_empty_password, &is_empty_password); + + if (err != ERR_NO_ERROR) + { + // Error occured + SLog(c->Cedar, "LA_ERROR", c->Name, GetUniErrorStr(err), err); + return err; + } + + SLog(c->Cedar, "LA_OK", c->Name); + + HashAdminPassword(null_password, ""); + SecurePassword(secure_null_password, null_password, c->Random); + + if (Cmp(secure_null_password, secure_password, SHA1_SIZE) == 0) + { + if (sock->RemoteIP.addr[0] != 127) + { + // The client tried to use blank password for hub admin mode from remote + if (StrLen(hubname) != 0) + { + return ERR_NULL_PASSWORD_LOCAL_ONLY; + } + } + } + + + // Reply success result + p = NewPack(); + if (accept_empty_password && is_empty_password) + { + PackAddBool(p, "empty_password", true); + } + HttpServerSend(sock, p); + FreePack(p); + + // Construct ADMIN object + a = ZeroMalloc(sizeof(ADMIN)); + a->ServerAdmin = ((StrLen(hubname) == 0) ? true : false); + a->HubName = (StrLen(hubname) != 0 ? hubname : NULL); + a->Server = c->Cedar->Server; + a->ClientBuild = c->ClientBuild; + + Copy(&a->ClientWinVer, &ver, sizeof(RPC_WINVER)); + + // Timeout setting + SetTimeout(sock, INFINITE); + + // RPC Server + rpc = StartRpcServer(sock, AdminDispatch, a); + + a->Rpc = rpc; + + SLog(c->Cedar, "LA_RPC_START", c->Name, rpc->Name); + + RpcServer(rpc); + RpcFree(rpc); + + if (a->LogFileList != NULL) + { + // Free cached log file list, if it exists + FreeEnumLogFile(a->LogFileList); + } + + // Free ADMIN object + Free(a); + + return ERR_NO_ERROR; +} + +// Check for admin password +UINT AdminCheckPassword(CEDAR *c, void *random, void *secure_password, char *hubname, + bool accept_empty_password, bool *is_password_empty) +{ + UCHAR check[SHA1_SIZE]; + bool b_dummy; + // Validate arguments + if (c == NULL || random == NULL || secure_password == NULL) + { + return ERR_INTERNAL_ERROR; + } + if (is_password_empty == NULL) + { + is_password_empty = &b_dummy; + } + + *is_password_empty = false; + + if (hubname == NULL || StrLen(hubname) == 0) + { + // Server admin mode + Lock(c->lock); + { + if (accept_empty_password && SiIsEmptyPassword(c->Server->HashedPassword)) + { + // blank password + *is_password_empty = true; + } + + SecurePassword(check, c->Server->HashedPassword, random); + } + Unlock(c->lock); + + if (Cmp(check, secure_password, SHA1_SIZE) != 0) + { + // Password incorrect + return ERR_ACCESS_DENIED; + } + } + else + { + HUB *h; + +#if 0 + if (c->Server->ServerType == SERVER_TYPE_FARM_MEMBER) + { + // In cluster member mode, hub admin mode is disabled + return ERR_FARM_MEMBER_HUB_ADMIN; + } +#endif + + // Hub admin mode + LockHubList(c); + { + h = GetHub(c, hubname); + } + UnlockHubList(c); + + if (h == NULL) + { + // Specified hub is not found + return ERR_HUB_NOT_FOUND; + } + + Lock(h->lock); + { + if (accept_empty_password && SiIsEmptyPassword(h->HashedPassword)) + { + // User specified blank password + *is_password_empty = true; + } + + SecurePassword(check, h->HashedPassword, random); + } + Unlock(h->lock); + + ReleaseHub(h); + + if (Cmp(check, secure_password, SHA1_SIZE) != 0) + { + // Incorrect password + return ERR_ACCESS_DENIED; + } + } + + return ERR_NO_ERROR; +} + +// Hash admin password +void HashAdminPassword(void *hash, char *password) +{ + // Validate arguments + if (hash == NULL || password == NULL) + { + return; + } + + Sha0(hash, password, StrLen(password)); +} + +// Disconnect admin connection +void AdminDisconnect(RPC *rpc) +{ + SESSION *s; + SOCK *sock; + // Validate arguments + if (rpc == NULL) + { + return; + } + + s = (SESSION *)rpc->Param; + sock = rpc->Sock; + + EndRpc(rpc); + + Disconnect(sock); + ReleaseSession(s); +} + +// Admin connection main routine +SESSION *AdminConnectMain(CEDAR *cedar, CLIENT_OPTION *o, char *hubname, void *hashed_password, UINT *err, char *client_name, void *hWnd, bool *empty_password) +{ + UCHAR secure_password[SHA1_SIZE]; + SESSION *s; + SOCK *sock; + PACK *p; + RPC_WINVER ver; + // connect + s = NewRpcSessionEx2(cedar, o, err, client_name, hWnd); + if (s == NULL) + { + return NULL; + } + + // Get socket + sock = s->Connection->FirstSock; + + // Generate connect method + p = NewPack(); + + PackAddClientVersion(p, s->Connection); + + PackAddStr(p, "method", "admin"); + PackAddBool(p, "accept_empty_password", true); + + // Windows version on client + GetWinVer(&ver); + OutRpcWinVer(p, &ver); + + // Secure Password + SecurePassword(secure_password, hashed_password, s->Connection->Random); + + PackAddData(p, "secure_password", secure_password, sizeof(secure_password)); + + // HUB name + if (hubname != NULL) + { + PackAddStr(p, "hubname", hubname); + } + + if (HttpClientSend(sock, p) == false) + { + // disconnect + FreePack(p); + ReleaseSession(s); + *err = ERR_DISCONNECTED; + return NULL; + } + + FreePack(p); + + p = HttpClientRecv(sock); + if (p == NULL) + { + // disconnect + ReleaseSession(s); + *err = ERR_DISCONNECTED; + return NULL; + } + + if (GetErrorFromPack(p) != 0) + { + // error + ReleaseSession(s); + *err = GetErrorFromPack(p); + FreePack(p); + return NULL; + } + + if (empty_password != NULL) + { + *empty_password = PackGetBool(p, "empty_password"); + } + + FreePack(p); + + return s; +} + +// Admin connection +RPC *AdminConnectEx(CEDAR *cedar, CLIENT_OPTION *o, char *hubname, void *hashed_password, UINT *err, char *client_name) +{ + return AdminConnectEx2(cedar, o, hubname, hashed_password, err, client_name, NULL); +} +RPC *AdminConnectEx2(CEDAR *cedar, CLIENT_OPTION *o, char *hubname, void *hashed_password, UINT *err, char *client_name, void *hWnd) +{ + SESSION *s; + SOCK *sock; + RPC *rpc; + UCHAR hashed_password_2[SHA1_SIZE]; + bool empty_password = false; + // Validate arguments + if (cedar == NULL || o == NULL || hashed_password == NULL || err == NULL) + { + return NULL; + } + + if (client_name == NULL) + { + client_name = CEDAR_MANAGER_STR; + } + + Copy(hashed_password_2, hashed_password, SHA1_SIZE); + + s = AdminConnectMain(cedar, o, hubname, hashed_password_2, err, client_name, hWnd, &empty_password); + + if (s == NULL) + { + return NULL; + } + + sock = s->Connection->FirstSock; + + // RPC start + rpc = StartRpcClient(sock, s); + + rpc->IsVpnServer = true; + Copy(&rpc->VpnServerClientOption, o, sizeof(CLIENT_OPTION)); + StrCpy(rpc->VpnServerHubName, sizeof(rpc->VpnServerHubName), hubname); + StrCpy(rpc->VpnServerClientName, sizeof(rpc->VpnServerClientName), client_name); + + if (empty_password == false) + { + Copy(rpc->VpnServerHashedPassword, hashed_password_2, SHA1_SIZE); + } + else + { + HashAdminPassword(rpc->VpnServerHashedPassword, ""); + } + + // timeout setting + SetTimeout(sock, INFINITE); + + return rpc; +} + +// Reconnect admin connection +UINT AdminReconnect(RPC *rpc) +{ + SESSION *s; + SOCK *sock; + CEDAR *cedar; + UINT err; + bool empty_password = false; + // Validate arguments + if (rpc == NULL || rpc->IsVpnServer == false) + { + return ERR_INTERNAL_ERROR; + } + + s = (SESSION *)rpc->Param; + cedar = s->Cedar; + AddRef(cedar->ref); + + sock = rpc->Sock; + Disconnect(sock); + ReleaseSock(sock); + ReleaseSession(s); + rpc->Param = NULL; + + rpc->Sock = NULL; + + s = AdminConnectMain(cedar, &rpc->VpnServerClientOption, + rpc->VpnServerHubName, + rpc->VpnServerHashedPassword, + &err, + rpc->VpnServerClientName, NULL, &empty_password); + + ReleaseCedar(cedar); + + if (s == NULL) + { + return err; + } + + if (empty_password) + { + HashAdminPassword(rpc->VpnServerHashedPassword, ""); + } + + rpc->Param = s; + rpc->Sock = s->Connection->FirstSock; + AddRef(rpc->Sock->ref); + + return ERR_NO_ERROR; +} + +// Identify blank password +bool SiIsEmptyPassword(void *hash_password) +{ + UCHAR hash[SHA1_SIZE]; + // Validate arguments + if (hash_password == NULL) + { + return false; + } + + Sha0(hash, "", 0); + + if (Cmp(hash_password, hash, SHA1_SIZE) == 0) + { + return true; + } + + return false; +} + diff --git a/src/Cedar/Admin.h b/src/Cedar/Admin.h index 0872c9f6..f0c3add4 100644 --- a/src/Cedar/Admin.h +++ b/src/Cedar/Admin.h @@ -1,1492 +1,1492 @@ -// SoftEther VPN Source Code - Developer Edition Master Branch -// Cedar Communication Module - - -// Admin.h -// Header of Admin.c - -#ifndef ADMIN_H -#define ADMIN_H - -// Windows version -struct RPC_WINVER -{ - bool IsWindows; - bool IsNT; - bool IsServer; - bool IsBeta; - UINT VerMajor; - UINT VerMinor; - UINT Build; - UINT ServicePack; - char Title[128]; -}; - -// Server-side structure -struct ADMIN -{ - SERVER *Server; // Server - bool ServerAdmin; // Server Administrator - char *HubName; // HUB name that can be managed - RPC *Rpc; // RPC - LIST *LogFileList; // Accessible log file list - UINT ClientBuild; // Build number of the client - RPC_WINVER ClientWinVer; // Windows version of client - UINT MaxJsonRpcRecvSize; // Max JSON-RPC Receive Size - char dummy1[MAX_HUBNAME_LEN + 1]; // hubname buffer (dummy) -}; - -// Test -struct RPC_TEST -{ - UINT IntValue; - UINT64 Int64Value; - char StrValue[1024]; - wchar_t UniStrValue[1024]; -}; - -// Server Information * -struct RPC_SERVER_INFO -{ - char ServerProductName[128]; // Server product name - char ServerVersionString[128]; // Server version string - char ServerBuildInfoString[128]; // Server build information string - UINT ServerVerInt; // Server version integer value - UINT ServerBuildInt; // Server build number integer value - char ServerHostName[MAX_HOST_NAME_LEN + 1]; // Server host name - UINT ServerType; // Type of server - UINT64 ServerBuildDate; // Build date and time of the server - char ServerFamilyName[128]; // Family name - OS_INFO OsInfo; // OS information -}; - -// Server status -struct RPC_SERVER_STATUS -{ - UINT ServerType; // Type of server - UINT NumTcpConnections; // Total number of TCP connections - UINT NumTcpConnectionsLocal; // Number of Local TCP connections - UINT NumTcpConnectionsRemote; // Number of remote TCP connections - UINT NumHubTotal; // Total number of HUBs - UINT NumHubStandalone; // Number of stand-alone HUB - UINT NumHubStatic; // Number of static HUBs - UINT NumHubDynamic; // Number of Dynamic HUBs - UINT NumSessionsTotal; // Total number of sessions - UINT NumSessionsLocal; // Number of Local sessions (only controller) - UINT NumSessionsRemote; // The number of remote sessions (other than the controller) - UINT NumMacTables; // Number of MAC table entries - UINT NumIpTables; // Number of IP table entries - UINT NumUsers; // Number of users - UINT NumGroups; // Number of groups - UINT AssignedBridgeLicenses; // Number of assigned bridge licenses - UINT AssignedClientLicenses; // Number of assigned client licenses - UINT AssignedBridgeLicensesTotal; // Number of Assigned bridge license (cluster-wide) - UINT AssignedClientLicensesTotal; // Number of assigned client licenses (cluster-wide) - TRAFFIC Traffic; // Traffic information - UINT64 CurrentTime; // Current time - UINT64 CurrentTick; // Current tick - UINT64 StartTime; // Start-up time - MEMINFO MemInfo; // Memory information -}; - -// Listener -struct RPC_LISTENER -{ - UINT Port; // Port number - bool Enable; // Active state -}; - -// List of listeners * -struct RPC_LISTENER_LIST -{ - UINT NumPort; // Number of ports - UINT *Ports; // Port List - bool *Enables; // Effective state - bool *Errors; // An error occurred -}; - -// List of ports -struct RPC_PORTS -{ - UINT Num; // Number of ports - UINT *Ports; // Ports -}; - -// String * -struct RPC_STR -{ - char *String; // String -}; - -// Integer -struct RPC_INT -{ - UINT IntValue; // Integer -}; - -// Proto options -struct RPC_PROTO_OPTIONS -{ - char *Protocol; // Protocol name - UINT Num; // Number of options - PROTO_OPTION *Options; // Options -}; - -// Set Password -struct RPC_SET_PASSWORD -{ - UCHAR HashedPassword[SHA1_SIZE]; // Hashed password (for traditional RPC) - char PlainTextPassword[MAX_SIZE]; // Plaintext password (for JSON-RPC) -}; - -// Server farm configuration * -struct RPC_FARM -{ - UINT ServerType; // Type of server - UINT NumPort; // Number of public ports - UINT *Ports; // Public port list - UINT PublicIp; // Public IP - char ControllerName[MAX_HOST_NAME_LEN + 1]; // Controller name - UINT ControllerPort; // Controller port - UCHAR MemberPassword[SHA1_SIZE]; // Member password - char MemberPasswordPlaintext[MAX_SIZE]; // Member password (plaintext) - UINT Weight; // Performance ratio - bool ControllerOnly; // Only controller function -}; - -// HUB item of each farm member -struct RPC_FARM_HUB -{ - char HubName[MAX_HUBNAME_LEN + 1]; // HUB Name - bool DynamicHub; // Dynamic HUB -}; - -// Server farm member information acquisition * -struct RPC_FARM_INFO -{ - UINT Id; // ID - bool Controller; // Controller - UINT64 ConnectedTime; // Connection time - UINT Ip; // IP address - char Hostname[MAX_HOST_NAME_LEN + 1]; // Host name - UINT Point; // Point - UINT NumPort; // Number of ports - UINT *Ports; // Port - X *ServerCert; // Server certificate - UINT NumFarmHub; // Number of farm HUB - RPC_FARM_HUB *FarmHubs; // Farm HUB - UINT NumSessions; // Number of sessions - UINT NumTcpConnections; // Number of TCP connections - UINT Weight; // Performance ratio -}; - -// Server farm members enumeration items -struct RPC_ENUM_FARM_ITEM -{ - UINT Id; // ID - bool Controller; // Controller - UINT64 ConnectedTime; // Connection time - UINT Ip; // IP address - char Hostname[MAX_HOST_NAME_LEN + 1]; // Host name - UINT Point; // Point - UINT NumSessions; // Number of sessions - UINT NumTcpConnections; // Number of TCP connections - UINT NumHubs; // Number of HUBs - UINT AssignedClientLicense; // Number of assigned client licenses - UINT AssignedBridgeLicense; // Number of assigned bridge licenses -}; - -// Server farm member enumeration * -struct RPC_ENUM_FARM -{ - UINT NumFarm; // Number of farm members - RPC_ENUM_FARM_ITEM *Farms; // Farm member list -}; - -// Connection state to the controller -struct RPC_FARM_CONNECTION_STATUS -{ - UINT Ip; // IP address - UINT Port; // Port number - bool Online; // Online state - UINT LastError; // Last error - UINT64 StartedTime; // Connection start time - UINT64 FirstConnectedTime; // First connection time - UINT64 CurrentConnectedTime; // Connection time of this time - UINT NumTry; // Number of trials - UINT NumConnected; // Number of connection count - UINT NumFailed; // Connection failure count -}; - -// Key pair -struct RPC_KEY_PAIR -{ - X *Cert; // Certificate - K *Key; // Secret key - UINT Flag1; // Flag1 -}; - -// HUB option -struct RPC_HUB_OPTION -{ - UINT MaxSession; // Maximum number of sessions - bool NoEnum; // Not listed -}; - -// Radius server options -struct RPC_RADIUS -{ - char HubName[MAX_HUBNAME_LEN + 1]; // HUB Name - char RadiusServerName[MAX_HOST_NAME_LEN + 1]; // Radius server name - UINT RadiusPort; // Radius port number - char RadiusSecret[MAX_PASSWORD_LEN + 1]; // Secret key - UINT RadiusRetryInterval; // Radius retry interval -}; - -// Specify the HUB -struct RPC_HUB -{ - char HubName[MAX_HUBNAME_LEN + 1]; // HUB Name -}; - -// Create a HUB -struct RPC_CREATE_HUB -{ - char HubName[MAX_HUBNAME_LEN + 1]; // HUB Name - UCHAR HashedPassword[SHA1_SIZE]; // Administrative password - UCHAR SecurePassword[SHA1_SIZE]; // Administrator password - char AdminPasswordPlainText[MAX_SIZE]; // Password (plaintext) - bool Online; // Online flag - RPC_HUB_OPTION HubOption; // HUB options - UINT HubType; // Type of HUB -}; - -// Enumeration items of HUB -struct RPC_ENUM_HUB_ITEM -{ - char HubName[MAX_HUBNAME_LEN + 1]; // HUB Name - bool Online; // Online - UINT HubType; // Type of HUB - UINT NumUsers; // Number of users - UINT NumGroups; // Number of groups - UINT NumSessions; // Number of sessions - UINT NumMacTables; // Number of MAC table entries - UINT NumIpTables; // Number of IP table entries - UINT64 LastCommTime; // Last communication date and time - UINT64 LastLoginTime; // Last login date and time - UINT64 CreatedTime; // Creation date and time - UINT NumLogin; // Number of logins - bool IsTrafficFilled; // Whether the traffic information exists - TRAFFIC Traffic; // Traffic -}; - -// Enumeration of HUB -struct RPC_ENUM_HUB -{ - UINT NumHub; // Number of HUBs - RPC_ENUM_HUB_ITEM *Hubs; // HUB -}; - -// Delete the HUB -struct RPC_DELETE_HUB -{ - char HubName[MAX_HUBNAME_LEN + 1]; // HUB Name -}; - -// Connection enumeration items -struct RPC_ENUM_CONNECTION_ITEM -{ - char Name[MAX_SIZE]; // Connection name - char Hostname[MAX_SIZE]; // Host name - UINT Ip; // IP address - UINT Port; // Port number - UINT64 ConnectedTime; // Connected time - UINT Type; // Type -}; - -// Connection enumeration -struct RPC_ENUM_CONNECTION -{ - UINT NumConnection; // Number of connections - RPC_ENUM_CONNECTION_ITEM *Connections; // Connection list -}; - -// Disconnection -struct RPC_DISCONNECT_CONNECTION -{ - char Name[MAX_SIZE]; // Connection name -}; - -// Connection information -struct RPC_CONNECTION_INFO -{ - char Name[MAX_SIZE]; // Connection name - UINT Type; // Type - char Hostname[MAX_SIZE]; // Host name - UINT Ip; // IP address - UINT Port; // Port number - UINT64 ConnectedTime; // Connected time - char ServerStr[MAX_SERVER_STR_LEN + 1]; // Server string - UINT ServerVer; // Server version - UINT ServerBuild; // Server build number - char ClientStr[MAX_CLIENT_STR_LEN + 1]; // Client string - UINT ClientVer; // Client version - UINT ClientBuild; // Client build number -}; - -// Online or offline the HUB -struct RPC_SET_HUB_ONLINE -{ - char HubName[MAX_HUBNAME_LEN + 1]; // HUB Name - bool Online; // Online / offline flag -}; - -// Get the state HUB -struct RPC_HUB_STATUS -{ - char HubName[MAX_HUBNAME_LEN + 1]; // HUB Name - bool Online; // Online - UINT HubType; // Type of HUB - UINT NumSessions; // Number of sessions - UINT NumSessionsClient; // Number of sessions (client) - UINT NumSessionsBridge; // Number of sessions (bridge) - UINT NumAccessLists; // Number of Access list entries - UINT NumUsers; // Number of users - UINT NumGroups; // Number of groups - UINT NumMacTables; // Number of MAC table entries - UINT NumIpTables; // Number of IP table entries - TRAFFIC Traffic; // Traffic - bool SecureNATEnabled; // Whether SecureNAT is enabled - UINT64 LastCommTime; // Last communication date and time - UINT64 LastLoginTime; // Last login date and time - UINT64 CreatedTime; // Creation date and time - UINT NumLogin; // Number of logins -}; - -// HUB log settings -struct RPC_HUB_LOG -{ - char HubName[MAX_HUBNAME_LEN + 1]; // HUB Name - HUB_LOG LogSetting; // Log Settings -}; - -// Add CA to HUB * -struct RPC_HUB_ADD_CA -{ - char HubName[MAX_HUBNAME_LEN + 1]; // HUB Name - X *Cert; // Certificate -}; - -// CA enumeration items of HUB -struct RPC_HUB_ENUM_CA_ITEM -{ - UINT Key; // Certificate key - wchar_t SubjectName[MAX_SIZE]; // Issued to - wchar_t IssuerName[MAX_SIZE]; // Issuer - UINT64 Expires; // Expiration date -}; - -// CA enumeration of HUB * -struct RPC_HUB_ENUM_CA -{ - char HubName[MAX_HUBNAME_LEN + 1]; // HUB Name - UINT NumCa; // CA number - RPC_HUB_ENUM_CA_ITEM *Ca; // CA -}; - -// Get the CA of HUB * -struct RPC_HUB_GET_CA -{ - char HubName[MAX_HUBNAME_LEN + 1]; // HUB Name - UINT Key; // Certificate key - X *Cert; // Certificate -}; - -// Delete the CA of HUB -struct RPC_HUB_DELETE_CA -{ - char HubName[MAX_HUBNAME_LEN + 1]; // HUB Name - UINT Key; // Certificate key to be deleted -}; - -// Create and set of link * -struct RPC_CREATE_LINK -{ - char HubName[MAX_HUBNAME_LEN + 1]; // HUB Name - bool Online; // Online flag - CLIENT_OPTION *ClientOption; // Client Option - CLIENT_AUTH *ClientAuth; // Client authentication data - POLICY Policy; // Policy - bool CheckServerCert; // Validate the server certificate - X *ServerCert; // Server certificate -}; - -// Enumeration items of link -struct RPC_ENUM_LINK_ITEM -{ - wchar_t AccountName[MAX_ACCOUNT_NAME_LEN + 1]; // Account name - bool Online; // Online flag - bool Connected; // Connection completion flag - UINT LastError; // The error that last occurred - UINT64 ConnectedTime; // Connection completion time - char Hostname[MAX_HOST_NAME_LEN + 1]; // Host name - char HubName[MAX_HUBNAME_LEN + 1]; // HUB Name -}; - -// Enumeration of the link * -struct RPC_ENUM_LINK -{ - char HubName[MAX_HUBNAME_LEN + 1]; // HUB Name - UINT NumLink; // Number of links - RPC_ENUM_LINK_ITEM *Links; // Link List -}; - -// Get the link state * -struct RPC_LINK_STATUS -{ - char HubName[MAX_HUBNAME_LEN + 1]; // HUB Name - wchar_t AccountName[MAX_ACCOUNT_NAME_LEN + 1]; // Account name - RPC_CLIENT_GET_CONNECTION_STATUS Status; // Status -}; - -// Specify the Link -struct RPC_LINK -{ - char HubName[MAX_HUBNAME_LEN + 1]; // HUB Name - wchar_t AccountName[MAX_ACCOUNT_NAME_LEN + 1]; // Account name -}; - -// Rename link -struct RPC_RENAME_LINK -{ - char HubName[MAX_HUBNAME_LEN + 1]; // HUB Name - wchar_t OldAccountName[MAX_ACCOUNT_NAME_LEN + 1]; // Old account name - wchar_t NewAccountName[MAX_ACCOUNT_NAME_LEN + 1]; // New account name -}; - -// Enumeration of the access list * -struct RPC_ENUM_ACCESS_LIST -{ - char HubName[MAX_HUBNAME_LEN + 1]; // HUB Name - UINT NumAccess; // Number of Access list entries - ACCESS *Accesses; // Access list -}; - -// Add to Access List -struct RPC_ADD_ACCESS -{ - char HubName[MAX_HUBNAME_LEN + 1]; // HUB Name - ACCESS Access; // Access list -}; - -// Delete the access list -struct RPC_DELETE_ACCESS -{ - char HubName[MAX_HUBNAME_LEN + 1]; // HUB Name - UINT Id; // ID -}; - -// Create, configure, and get the user * -struct RPC_SET_USER -{ - char HubName[MAX_HUBNAME_LEN + 1]; // HUB Name - char Name[MAX_USERNAME_LEN + 1]; // User name - char GroupName[MAX_USERNAME_LEN + 1]; // Group name - wchar_t Realname[MAX_SIZE]; // Real name - wchar_t Note[MAX_SIZE]; // Note - UINT64 CreatedTime; // Creation date and time - UINT64 UpdatedTime; // Updating date - UINT64 ExpireTime; // Expiration date - UINT AuthType; // Authentication method - void *AuthData; // Authentication data - UINT NumLogin; // Number of logins - TRAFFIC Traffic; // Traffic data - POLICY *Policy; // Policy -}; - -// Enumeration item of user -struct RPC_ENUM_USER_ITEM -{ - char Name[MAX_USERNAME_LEN + 1]; // User name - char GroupName[MAX_USERNAME_LEN + 1]; // Group name - wchar_t Realname[MAX_SIZE]; // Real name - wchar_t Note[MAX_SIZE]; // Note - UINT AuthType; // Authentication method - UINT NumLogin; // Number of logins - UINT64 LastLoginTime; // Last login date and time - bool DenyAccess; // Access denied - bool IsTrafficFilled; // Flag of whether the traffic variable is set - TRAFFIC Traffic; // Traffic - bool IsExpiresFilled; // Flag of whether expiration date variable is set - UINT64 Expires; // Expiration date -}; - -// Enumeration of user -struct RPC_ENUM_USER -{ - char HubName[MAX_HUBNAME_LEN + 1]; // HUB Name - UINT NumUser; // Number of users - RPC_ENUM_USER_ITEM *Users; // User -}; - -// Create, configure, and get the group * -struct RPC_SET_GROUP -{ - char HubName[MAX_HUBNAME_LEN + 1]; // HUB Name - char Name[MAX_USERNAME_LEN + 1]; // User name - wchar_t Realname[MAX_SIZE]; // Real name - wchar_t Note[MAX_SIZE]; // Note - TRAFFIC Traffic; // Traffic data - POLICY *Policy; // Policy -}; - -// Enumeration items in the group -struct RPC_ENUM_GROUP_ITEM -{ - char Name[MAX_USERNAME_LEN + 1]; // User name - wchar_t Realname[MAX_SIZE]; // Real name - wchar_t Note[MAX_SIZE]; // Note - UINT NumUsers; // Number of users - bool DenyAccess; // Access denied -}; - -// Group enumeration -struct RPC_ENUM_GROUP -{ - char HubName[MAX_HUBNAME_LEN + 1]; // HUB Name - UINT NumGroup; // Number of groups - RPC_ENUM_GROUP_ITEM *Groups; // Group -}; - -// Deleting a user or group -struct RPC_DELETE_USER -{ - char HubName[MAX_HUBNAME_LEN + 1]; // HUB Name - char Name[MAX_USERNAME_LEN + 1]; // User or group name -}; - -// Enumeration items of session -struct RPC_ENUM_SESSION_ITEM -{ - char Name[MAX_SESSION_NAME_LEN + 1]; // Session name - bool RemoteSession; // Remote session - char RemoteHostname[MAX_HOST_NAME_LEN + 1]; // Remote server name - char Username[MAX_USERNAME_LEN + 1]; // User name - UINT Ip; // IP address (IPv4) - IP ClientIP; // IP address (IPv4 / IPv6) - char Hostname[MAX_HOST_NAME_LEN + 1]; // Host name - UINT MaxNumTcp; // Maximum number of TCP connections - UINT CurrentNumTcp; // Number of currentl TCP connections - UINT64 PacketSize; // Packet size - UINT64 PacketNum; // Number of packets - bool LinkMode; // Link mode - bool SecureNATMode; // SecureNAT mode - bool BridgeMode; // Bridge mode - bool Layer3Mode; // Layer 3 mode - bool Client_BridgeMode; // Client is bridge mode - bool Client_MonitorMode; // Client is monitoring mode - UINT VLanId; // VLAN ID - UCHAR UniqueId[16]; // Unique ID - bool IsDormantEnabled; // Is the dormant state enabled - bool IsDormant; // Is in the dormant state - UINT64 LastCommDormant; // Last comm interval in the dormant state - UINT64 CreatedTime; // Creation date and time - UINT64 LastCommTime; // Last communication date and time -}; - -// Disconnect the session -struct RPC_DELETE_SESSION -{ - char HubName[MAX_HUBNAME_LEN + 1]; // HUB Name - char Name[MAX_SESSION_NAME_LEN + 1]; // Session name -}; - -// Enumeration items of the MAC table -struct RPC_ENUM_MAC_TABLE_ITEM -{ - UINT Key; // Key - char SessionName[MAX_SESSION_NAME_LEN + 1]; // Session name - UCHAR MacAddress[6]; // MAC address - UCHAR Padding[2]; - UINT64 CreatedTime; // Creation date and time - UINT64 UpdatedTime; // Updating date - bool RemoteItem; // Remote items - char RemoteHostname[MAX_HOST_NAME_LEN + 1]; // Remote host name - UINT VlanId; // VLAN ID -}; - -// Enumeration of the MAC table -struct RPC_ENUM_MAC_TABLE -{ - char HubName[MAX_HUBNAME_LEN + 1]; // HUB Name - UINT NumMacTable; // Number of tables - RPC_ENUM_MAC_TABLE_ITEM *MacTables; // MAC table -}; - -// Enumeration items of IP table -struct RPC_ENUM_IP_TABLE_ITEM -{ - UINT Key; // Key - char SessionName[MAX_SESSION_NAME_LEN + 1]; // Session name - UINT Ip; // IPv4 address - IP IpV6; // IPv6 address - IP IpAddress; // IPv4 / IPv6 Address - bool DhcpAllocated; // Assigned by the DHCP - UINT64 CreatedTime; // Creation date and time - UINT64 UpdatedTime; // Updating date - bool RemoteItem; // Remote items - char RemoteHostname[MAX_HOST_NAME_LEN + 1]; // Remote host name -}; - -// Enumeration of IP table -struct RPC_ENUM_IP_TABLE -{ - char HubName[MAX_HUBNAME_LEN + 1]; // HUB Name - UINT NumIpTable; // Number of tables - RPC_ENUM_IP_TABLE_ITEM *IpTables; // MAC table -}; - -// Delete the table -struct RPC_DELETE_TABLE -{ - char HubName[MAX_HUBNAME_LEN + 1]; // HUB Name - UINT Key; // Key -}; - -// KEEP setting -struct RPC_KEEP -{ - bool UseKeepConnect; // Keep connected to the Internet - char KeepConnectHost[MAX_HOST_NAME_LEN + 1]; // Host name - UINT KeepConnectPort; // Port number - UINT KeepConnectProtocol; // Protocol - UINT KeepConnectInterval; // Interval -}; - -// Ethernet enumeration item -struct RPC_ENUM_ETH_ITEM -{ - char DeviceName[MAX_SIZE]; // Device name - wchar_t NetworkConnectionName[MAX_SIZE];// Network connection name -}; - -// Ethernet enumeration -struct RPC_ENUM_ETH -{ - UINT NumItem; // Number of items - RPC_ENUM_ETH_ITEM *Items; // Item -}; - -// Bridge item -struct RPC_LOCALBRIDGE -{ - char DeviceName[MAX_SIZE]; // Device name - char HubName[MAX_HUBNAME_LEN + 1]; // HUB Name - bool Online; // Online flag - bool Active; // Running flag - bool TapMode; // Tap mode -}; - -// Bridge enumeration -struct RPC_ENUM_LOCALBRIDGE -{ - UINT NumItem; // Number of items - RPC_LOCALBRIDGE *Items; // Item -}; - -// Bridge support information -struct RPC_BRIDGE_SUPPORT -{ - bool IsBridgeSupportedOs; // Whether the OS supports the bridge - bool IsWinPcapNeeded; // Whether WinPcap is necessary -}; - -// Config operation -struct RPC_CONFIG -{ - char FileName[MAX_PATH]; // File name - char *FileData; // File data -}; - -// Administration options list -struct RPC_ADMIN_OPTION -{ - char HubName[MAX_HUBNAME_LEN + 1]; // Virtual HUB name - UINT NumItem; // Count - ADMIN_OPTION *Items; // Data -}; - -// Layer-3 switch -struct RPC_L3SW -{ - char Name[MAX_HUBNAME_LEN + 1]; // L3 switch name -}; - -// Layer-3 switch enumeration -struct RPC_ENUM_L3SW_ITEM -{ - char Name[MAX_HUBNAME_LEN + 1]; // Name - UINT NumInterfaces; // Number of interfaces - UINT NumTables; // Routing table number - bool Active; // In operation - bool Online; // Online -}; -struct RPC_ENUM_L3SW -{ - UINT NumItem; - RPC_ENUM_L3SW_ITEM *Items; -}; - -// Layer-3 interface -struct RPC_L3IF -{ - char Name[MAX_HUBNAME_LEN + 1]; // L3 switch name - char HubName[MAX_HUBNAME_LEN + 1]; // Virtual HUB name - UINT IpAddress; // IP address - UINT SubnetMask; // Subnet mask -}; - -// Layer-3 interface enumeration -struct RPC_ENUM_L3IF -{ - char Name[MAX_HUBNAME_LEN + 1]; // L3 switch name - UINT NumItem; - RPC_L3IF *Items; -}; - -// Routing table -struct RPC_L3TABLE -{ - char Name[MAX_HUBNAME_LEN + 1]; // L3 switch name - UINT NetworkAddress; // Network address - UINT SubnetMask; // Subnet mask - UINT GatewayAddress; // Gateway address - UINT Metric; // Metric -}; - -// Routing table enumeration -struct RPC_ENUM_L3TABLE -{ - char Name[MAX_HUBNAME_LEN + 1]; // L3 switch name - UINT NumItem; - RPC_L3TABLE *Items; -}; - -// CRL entry -struct RPC_CRL -{ - char HubName[MAX_HUBNAME_LEN + 1]; // HUB Name - UINT Key; // Key - CRL *Crl; // CRL body -}; - -// CRL enumeration -struct RPC_ENUM_CRL_ITEM -{ - UINT Key; // Key - wchar_t CrlInfo[MAX_SIZE]; // Information -}; -struct RPC_ENUM_CRL -{ - char HubName[MAX_HUBNAME_LEN + 1]; // HUB Name - UINT NumItem; // Number of items - RPC_ENUM_CRL_ITEM *Items; // List -}; - -// AC list -struct RPC_AC_LIST -{ - char HubName[MAX_HUBNAME_LEN + 1]; // HUB Name - LIST *o; // List body - bool InternalFlag1; -}; - -// Log file enumeration -struct RPC_ENUM_LOG_FILE_ITEM -{ - char ServerName[MAX_HOST_NAME_LEN + 1]; // Server name - char FilePath[MAX_PATH]; // File Path - UINT FileSize; // File size - UINT64 UpdatedTime; // Updating date -}; -struct RPC_ENUM_LOG_FILE -{ - UINT NumItem; // Number of items - RPC_ENUM_LOG_FILE_ITEM *Items; // List -}; - -// Read a Log file -struct RPC_READ_LOG_FILE -{ - char ServerName[MAX_HOST_NAME_LEN + 1]; // Server name - char FilePath[MAX_PATH]; // File Path - UINT Offset; // Offset - BUF *Buffer; // Buffer -}; - -// Download information -struct DOWNLOAD_PROGRESS -{ - void *Param; // User define data - UINT TotalSize; // The total file size - UINT CurrentSize; // Size which has loaded - UINT ProgressPercent; // Percent Complete -}; - -// Enumerate the license keys -struct RPC_ENUM_LICENSE_KEY_ITEM -{ - UINT Id; // ID - char LicenseKey[LICENSE_KEYSTR_LEN + 1]; // License key - char LicenseId[LICENSE_LICENSEID_STR_LEN + 1]; // License ID - char LicenseName[LICENSE_MAX_PRODUCT_NAME_LEN + 1]; // License name - UINT64 Expires; // Expiration date - UINT Status; // Situation - UINT ProductId; // Product ID - UINT64 SystemId; // System ID - UINT SerialId; // Serial ID -}; -struct RPC_ENUM_LICENSE_KEY -{ - UINT NumItem; // Number of items - RPC_ENUM_LICENSE_KEY_ITEM *Items; // List -}; - -// License status of the server -struct RPC_LICENSE_STATUS -{ - UINT EditionId; // Edition ID - char EditionStr[LICENSE_MAX_PRODUCT_NAME_LEN + 1]; // Edition name - UINT64 SystemId; // System ID - UINT64 SystemExpires; // System expiration date - UINT NumClientConnectLicense; // Maximum number of concurrent client connections - UINT NumBridgeConnectLicense; // Available number of concurrent bridge connections - - // v3.0 - bool NeedSubscription; // Subscription system is enabled - UINT64 SubscriptionExpires; // Subscription expiration date - bool IsSubscriptionExpired; // Whether the subscription is expired - UINT NumUserCreationLicense; // Maximum number of users - bool AllowEnterpriseFunction; // Operation of the enterprise function - UINT64 ReleaseDate; // Release date -}; - -// Enumeration of VLAN support status of physical LAN card -struct RPC_ENUM_ETH_VLAN_ITEM -{ - char DeviceName[MAX_SIZE]; // Device name - char Guid[MAX_SIZE]; // GUID - char DeviceInstanceId[MAX_SIZE]; // Device Instance ID - char DriverName[MAX_SIZE]; // Driver file name - char DriverType[MAX_SIZE]; // Type of driver - bool Support; // Check whether it is supported - bool Enabled; // Whether it is enabled -}; -struct RPC_ENUM_ETH_VLAN -{ - UINT NumItem; // Number of items - RPC_ENUM_ETH_VLAN_ITEM *Items; // List -}; - -// Message -struct RPC_MSG -{ - char HubName[MAX_HUBNAME_LEN + 1]; // HUB Name - wchar_t *Msg; // Message -}; - -// EtherIP setting list -struct RPC_ENUM_ETHERIP_ID -{ - UINT NumItem; - ETHERIP_ID *IdList; -}; - -// Set the special listener -struct RPC_SPECIAL_LISTENER -{ - bool VpnOverIcmpListener; // VPN over ICMP - bool VpnOverDnsListener; // VPN over DNS -}; - -// Get / Set the Azure state -struct RPC_AZURE_STATUS -{ - bool IsEnabled; // Whether enabled - bool IsConnected; // Whether it's connected -}; - -// Constants -#define ADMIN_RPC_MAX_POST_SIZE_BY_SERVER_ADMIN MAX_PACK_SIZE -#define ADMIN_RPC_MAX_POST_SIZE_BY_HUB_ADMIN (8 * 1024 * 1024) - - -// Function prototype -UINT AdminAccept(CONNECTION *c, PACK *p); -void HashAdminPassword(void *hash, char *password); -SESSION *AdminConnectMain(CEDAR *cedar, CLIENT_OPTION *o, char *hubname, void *hashed_password, UINT *err, char *client_name, void *hWnd, bool *empty_password); -RPC *AdminConnectEx(CEDAR *cedar, CLIENT_OPTION *o, char *hubname, void *hashed_password, UINT *err, char *client_name); -RPC *AdminConnectEx2(CEDAR *cedar, CLIENT_OPTION *o, char *hubname, void *hashed_password, UINT *err, char *client_name, void *hWnd); -void AdminDisconnect(RPC *rpc); -UINT AdminReconnect(RPC *rpc); -UINT AdminCheckPassword(CEDAR *c, void *random, void *secure_password, char *hubname, bool accept_empty_password, bool *is_password_empty); -PACK *AdminDispatch(RPC *rpc, char *name, PACK *p); -PACK *AdminCall(RPC *rpc, char *function_name, PACK *p); -void SiEnumLocalSession(SERVER *s, char *hubname, RPC_ENUM_SESSION *t); -void CopyOsInfo(OS_INFO *dst, OS_INFO *info); -CAPSLIST *ScGetCapsEx(RPC *rpc); -UINT SiEnumMacTable(SERVER *s, char *hubname, RPC_ENUM_MAC_TABLE *t); -UINT SiEnumIpTable(SERVER *s, char *hubname, RPC_ENUM_IP_TABLE *t); -void SiEnumLocalLogFileList(SERVER *s, char *hubname, RPC_ENUM_LOG_FILE *t); -void SiReadLocalLogFile(SERVER *s, char *filepath, UINT offset, RPC_READ_LOG_FILE *t); -typedef bool (DOWNLOAD_PROC)(DOWNLOAD_PROGRESS *progress); -BUF *DownloadFileFromServer(RPC *r, char *server_name, char *filepath, UINT total_size, DOWNLOAD_PROC *proc, void *param); -bool CheckAdminSourceAddress(SOCK *sock, char *hubname); -void SiEnumSessionMain(SERVER *s, RPC_ENUM_SESSION *t); -bool SiIsEmptyPassword(void *hash_password); -void JsonRpcProcPost(CONNECTION *c, SOCK *s, HTTP_HEADER *h, UINT post_data_size); -void JsonRpcProcGet(CONNECTION *c, SOCK *s, HTTP_HEADER *h, char *url_target); -void JsonRpcProcOptions(CONNECTION *c, SOCK *s, HTTP_HEADER *h, char *url_target); -JSON_VALUE *JsonRpcProcRequestObject(ADMIN *admin, CONNECTION *c, SOCK *s, JSON_VALUE *json_req, char *method_name); -JSON_VALUE *JsonRpcNewError(int code, wchar_t *message); -JSON_VALUE *JsonRpcNewResponse(PACK *p); -bool HttpParseBasicAuthHeader(HTTP_HEADER *h, char *username, UINT username_size, char *password, UINT password_size); -ADMIN *JsonRpcAuthLogin(CEDAR *c, SOCK *sock, HTTP_HEADER *h); -JSON_VALUE *QueryStringToJsonListValue(char *qs); -JSON_VALUE *ConstructDummyJsonRpcRequest(char *method_name, JSON_VALUE *p); -void AdminWebProcPost(CONNECTION *c, SOCK *s, HTTP_HEADER *h, UINT post_data_size, char *url_target); -void AdminWebProcGet(CONNECTION *c, SOCK *s, HTTP_HEADER *h, char *url_target); -bool AdminWebHandleFileRequest(ADMIN *a, CONNECTION *c, SOCK *s, HTTP_HEADER *h, char *url_src, char *query_string, char *virtual_root_dir, char *physical_root_dir); -BUF *AdminWebProcessServerSideInclude(BUF *src_txt, char *filename, UINT depth); -bool AdminWebSendBody(SOCK *s, UINT status_code, char *status_string, UCHAR *data, UINT data_size, char *content_type, char *add_header_name, char *add_header_value, HTTP_HEADER *request_headers); -bool AdminWebSend404Error(SOCK *s, HTTP_HEADER *request_headers); -bool AdminWebSend302Redirect(SOCK *s, char *url, char *query_string, HTTP_HEADER *request_headers); -BUF *AdminWebTryFindAndReadFile(char *vroot, char *proot, char *url, char *ret_filename, UINT ret_filename_size, bool *is_index_html); -BUF *AdminWebTryOneFile(char *filename, char *ret_filename, UINT ret_filename_size); -bool AdminWebSendUnauthorized(SOCK *s, HTTP_HEADER *http_request_headers); - -UINT StTest(ADMIN *a, RPC_TEST *t); -UINT StGetServerInfo(ADMIN *a, RPC_SERVER_INFO *t); -UINT StGetServerStatus(ADMIN *a, RPC_SERVER_STATUS *t); -UINT StCreateListener(ADMIN *a, RPC_LISTENER *t); -UINT StEnumListener(ADMIN *a, RPC_LISTENER_LIST *t); -UINT StDeleteListener(ADMIN *a, RPC_LISTENER *t); -UINT StEnableListener(ADMIN *a, RPC_LISTENER *t); -UINT StSetPortsUDP(ADMIN *a, RPC_PORTS *t); -UINT StGetPortsUDP(ADMIN *a, RPC_PORTS *t); -UINT StGetProtoOptions(ADMIN *a, RPC_PROTO_OPTIONS *t); -UINT StSetProtoOptions(ADMIN *a, RPC_PROTO_OPTIONS *t); -UINT StSetServerPassword(ADMIN *a, RPC_SET_PASSWORD *t); -UINT StSetFarmSetting(ADMIN *a, RPC_FARM *t); -UINT StGetFarmSetting(ADMIN *a, RPC_FARM *t); -UINT StGetFarmInfo(ADMIN *a, RPC_FARM_INFO *t); -UINT StEnumFarmMember(ADMIN *a, RPC_ENUM_FARM *t); -UINT StGetFarmConnectionStatus(ADMIN *a, RPC_FARM_CONNECTION_STATUS *t); -UINT StSetServerCert(ADMIN *a, RPC_KEY_PAIR *t); -UINT StGetServerCert(ADMIN *a, RPC_KEY_PAIR *t); -UINT StGetServerCipherList(ADMIN *a, RPC_STR *t); -UINT StGetServerCipher(ADMIN *a, RPC_STR *t); -UINT StSetServerCipher(ADMIN *a, RPC_STR *t); -UINT StCreateHub(ADMIN *a, RPC_CREATE_HUB *t); -UINT StSetHub(ADMIN *a, RPC_CREATE_HUB *t); -UINT StGetHub(ADMIN *a, RPC_CREATE_HUB *t); -UINT StEnumHub(ADMIN *a, RPC_ENUM_HUB *t); -UINT StDeleteHub(ADMIN *a, RPC_DELETE_HUB *t); -UINT StGetHubRadius(ADMIN *a, RPC_RADIUS *t); -UINT StSetHubRadius(ADMIN *a, RPC_RADIUS *t); -UINT StEnumConnection(ADMIN *a, RPC_ENUM_CONNECTION *t); -UINT StDisconnectConnection(ADMIN *a, RPC_DISCONNECT_CONNECTION *t); -UINT StGetConnectionInfo(ADMIN *a, RPC_CONNECTION_INFO *t); -UINT StSetHubOnline(ADMIN *a, RPC_SET_HUB_ONLINE *t); -UINT StGetHubStatus(ADMIN *a, RPC_HUB_STATUS *t); -UINT StSetHubLog(ADMIN *a, RPC_HUB_LOG *t); -UINT StGetHubLog(ADMIN *a, RPC_HUB_LOG *t); -UINT StAddCa(ADMIN *a, RPC_HUB_ADD_CA *t); -UINT StEnumCa(ADMIN *a, RPC_HUB_ENUM_CA *t); -UINT StGetCa(ADMIN *a, RPC_HUB_GET_CA *t); -UINT StDeleteCa(ADMIN *a, RPC_HUB_DELETE_CA *t); -UINT StCreateLink(ADMIN *a, RPC_CREATE_LINK *t); -UINT StEnumLink(ADMIN *a, RPC_ENUM_LINK *t); -UINT StGetLinkStatus(ADMIN *a, RPC_LINK_STATUS *t); -UINT StSetLinkOnline(ADMIN *a, RPC_LINK *t); -UINT StSetLinkOffline(ADMIN *a, RPC_LINK *t); -UINT StDeleteLink(ADMIN *a, RPC_LINK *t); -UINT StRenameLink(ADMIN *a, RPC_RENAME_LINK *t); -UINT StAddAccess(ADMIN *a, RPC_ADD_ACCESS *t); -UINT StDeleteAccess(ADMIN *a, RPC_DELETE_ACCESS *t); -UINT StEnumAccess(ADMIN *a, RPC_ENUM_ACCESS_LIST *t); -UINT StCreateUser(ADMIN *a, RPC_SET_USER *t); -UINT StSetUser(ADMIN *a, RPC_SET_USER *t); -UINT StGetUser(ADMIN *a, RPC_SET_USER *t); -UINT StDeleteUser(ADMIN *a, RPC_DELETE_USER *t); -UINT StEnumUser(ADMIN *a, RPC_ENUM_USER *t); -UINT StCreateGroup(ADMIN *a, RPC_SET_GROUP *t); -UINT StSetGroup(ADMIN *a, RPC_SET_GROUP *t); -UINT StGetGroup(ADMIN *a, RPC_SET_GROUP *t); -UINT StDeleteGroup(ADMIN *a, RPC_DELETE_USER *t); -UINT StEnumGroup(ADMIN *a, RPC_ENUM_GROUP *t); -UINT StEnumSession(ADMIN *a, RPC_ENUM_SESSION *t); -UINT StGetSessionStatus(ADMIN *a, RPC_SESSION_STATUS *t); -UINT StDeleteSession(ADMIN *a, RPC_DELETE_SESSION *t); -UINT StEnumMacTable(ADMIN *a, RPC_ENUM_MAC_TABLE *t); -UINT StDeleteMacTable(ADMIN *a, RPC_DELETE_TABLE *t); -UINT StEnumIpTable(ADMIN *a, RPC_ENUM_IP_TABLE *t); -UINT StDeleteIpTable(ADMIN *a, RPC_DELETE_TABLE *t); -UINT StGetLink(ADMIN *a, RPC_CREATE_LINK *t); -UINT StSetLink(ADMIN *a, RPC_CREATE_LINK *t); -UINT StSetAccessList(ADMIN *a, RPC_ENUM_ACCESS_LIST *t); -UINT StSetKeep(ADMIN *a, RPC_KEEP *t); -UINT StGetKeep(ADMIN *a, RPC_KEEP *t); -UINT StEnableSecureNAT(ADMIN *a, RPC_HUB *t); -UINT StDisableSecureNAT(ADMIN *a, RPC_HUB *t); -UINT StSetSecureNATOption(ADMIN *a, VH_OPTION *t); -UINT StGetSecureNATOption(ADMIN *a, VH_OPTION *t); -UINT StEnumNAT(ADMIN *a, RPC_ENUM_NAT *t); -UINT StEnumDHCP(ADMIN *a, RPC_ENUM_DHCP *t); -UINT StGetSecureNATStatus(ADMIN *a, RPC_NAT_STATUS *t); -UINT StEnumEthernet(ADMIN *a, RPC_ENUM_ETH *t); -UINT StAddLocalBridge(ADMIN *a, RPC_LOCALBRIDGE *t); -UINT StDeleteLocalBridge(ADMIN *a, RPC_LOCALBRIDGE *t); -UINT StEnumLocalBridge(ADMIN *a, RPC_ENUM_LOCALBRIDGE *t); -UINT StGetBridgeSupport(ADMIN *a, RPC_BRIDGE_SUPPORT *t); -UINT StRebootServer(ADMIN *a, RPC_TEST *t); -UINT StGetCaps(ADMIN *a, CAPSLIST *t); -UINT StGetConfig(ADMIN *a, RPC_CONFIG *t); -UINT StSetConfig(ADMIN *a, RPC_CONFIG *t); -UINT StGetDefaultHubAdminOptions(ADMIN *a, RPC_ADMIN_OPTION *t); -UINT StGetHubAdminOptions(ADMIN *a, RPC_ADMIN_OPTION *t); -UINT StSetHubAdminOptions(ADMIN *a, RPC_ADMIN_OPTION *t); -UINT StGetHubExtOptions(ADMIN *a, RPC_ADMIN_OPTION *t); -UINT StSetHubExtOptions(ADMIN *a, RPC_ADMIN_OPTION *t); -UINT StAddL3Switch(ADMIN *a, RPC_L3SW *t); -UINT StDelL3Switch(ADMIN *a, RPC_L3SW *t); -UINT StEnumL3Switch(ADMIN *a, RPC_ENUM_L3SW *t); -UINT StStartL3Switch(ADMIN *a, RPC_L3SW *t); -UINT StStopL3Switch(ADMIN *a, RPC_L3SW *t); -UINT StAddL3If(ADMIN *a, RPC_L3IF *t); -UINT StDelL3If(ADMIN *a, RPC_L3IF *t); -UINT StEnumL3If(ADMIN *a, RPC_ENUM_L3IF *t); -UINT StAddL3Table(ADMIN *a, RPC_L3TABLE *t); -UINT StDelL3Table(ADMIN *a, RPC_L3TABLE *t); -UINT StEnumL3Table(ADMIN *a, RPC_ENUM_L3TABLE *t); -UINT StEnumCrl(ADMIN *a, RPC_ENUM_CRL *t); -UINT StAddCrl(ADMIN *a, RPC_CRL *t); -UINT StDelCrl(ADMIN *a, RPC_CRL *t); -UINT StGetCrl(ADMIN *a, RPC_CRL *t); -UINT StSetCrl(ADMIN *a, RPC_CRL *t); -UINT StSetAcList(ADMIN *a, RPC_AC_LIST *t); -UINT StGetAcList(ADMIN *a, RPC_AC_LIST *t); -UINT StEnumLogFile(ADMIN *a, RPC_ENUM_LOG_FILE *t); -UINT StReadLogFile(ADMIN *a, RPC_READ_LOG_FILE *t); -UINT StAddLicenseKey(ADMIN *a, RPC_TEST *t); -UINT StDelLicenseKey(ADMIN *a, RPC_TEST *t); -UINT StEnumLicenseKey(ADMIN *a, RPC_ENUM_LICENSE_KEY *t); -UINT StGetLicenseStatus(ADMIN *a, RPC_LICENSE_STATUS *t); -UINT StSetSysLog(ADMIN *a, SYSLOG_SETTING *t); -UINT StGetSysLog(ADMIN *a, SYSLOG_SETTING *t); -UINT StEnumEthVLan(ADMIN *a, RPC_ENUM_ETH_VLAN *t); -UINT StSetEnableEthVLan(ADMIN *a, RPC_TEST *t); -UINT StSetHubMsg(ADMIN *a, RPC_MSG *t); -UINT StGetHubMsg(ADMIN *a, RPC_MSG *t); -UINT StCrash(ADMIN *a, RPC_TEST *t); -UINT StGetAdminMsg(ADMIN *a, RPC_MSG *t); -UINT StFlush(ADMIN *a, RPC_TEST *t); -UINT StDebug(ADMIN *a, RPC_TEST *t); -UINT StSetIPsecServices(ADMIN *a, IPSEC_SERVICES *t); -UINT StGetIPsecServices(ADMIN *a, IPSEC_SERVICES *t); -UINT StAddEtherIpId(ADMIN *a, ETHERIP_ID *t); -UINT StGetEtherIpId(ADMIN *a, ETHERIP_ID *t); -UINT StDeleteEtherIpId(ADMIN *a, ETHERIP_ID *t); -UINT StEnumEtherIpId(ADMIN *a, RPC_ENUM_ETHERIP_ID *t); -UINT StSetOpenVpnSstpConfig(ADMIN *a, OPENVPN_SSTP_CONFIG *t); -UINT StGetOpenVpnSstpConfig(ADMIN *a, OPENVPN_SSTP_CONFIG *t); -UINT StGetDDnsClientStatus(ADMIN *a, DDNS_CLIENT_STATUS *t); -UINT StChangeDDnsClientHostname(ADMIN *a, RPC_TEST *t); -UINT StRegenerateServerCert(ADMIN *a, RPC_TEST *t); -UINT StMakeOpenVpnConfigFile(ADMIN *a, RPC_READ_LOG_FILE *t); -UINT StSetSpecialListener(ADMIN *a, RPC_SPECIAL_LISTENER *t); -UINT StGetSpecialListener(ADMIN *a, RPC_SPECIAL_LISTENER *t); -UINT StGetAzureStatus(ADMIN *a, RPC_AZURE_STATUS *t); -UINT StSetAzureStatus(ADMIN *a, RPC_AZURE_STATUS *t); -UINT StGetDDnsInternetSetting(ADMIN *a, INTERNET_SETTING *t); -UINT StSetDDnsInternetSetting(ADMIN *a, INTERNET_SETTING *t); -UINT StSetVgsConfig(ADMIN *a, VGS_CONFIG *t); -UINT StGetVgsConfig(ADMIN *a, VGS_CONFIG *t); - -UINT ScTest(RPC *r, RPC_TEST *t); -UINT ScGetServerInfo(RPC *r, RPC_SERVER_INFO *t); -UINT ScGetServerStatus(RPC *r, RPC_SERVER_STATUS *t); -UINT ScCreateListener(RPC *r, RPC_LISTENER *t); -UINT ScEnumListener(RPC *r, RPC_LISTENER_LIST *t); -UINT ScDeleteListener(RPC *r, RPC_LISTENER *t); -UINT ScEnableListener(RPC *r, RPC_LISTENER *t); -UINT ScSetPortsUDP(RPC *r, RPC_PORTS *t); -UINT ScGetPortsUDP(RPC *r, RPC_PORTS *t); -UINT ScSetProtoOptions(RPC *r, RPC_PROTO_OPTIONS *t); -UINT ScGetProtoOptions(RPC *r, RPC_PROTO_OPTIONS *t); -UINT ScSetServerPassword(RPC *r, RPC_SET_PASSWORD *t); -UINT ScSetFarmSetting(RPC *r, RPC_FARM *t); -UINT ScGetFarmSetting(RPC *r, RPC_FARM *t); -UINT ScGetFarmInfo(RPC *r, RPC_FARM_INFO *t); -UINT ScEnumFarmMember(RPC *r, RPC_ENUM_FARM *t); -UINT ScGetFarmConnectionStatus(RPC *r, RPC_FARM_CONNECTION_STATUS *t); -UINT ScSetServerCert(RPC *r, RPC_KEY_PAIR *t); -UINT ScGetServerCert(RPC *r, RPC_KEY_PAIR *t); -UINT ScGetServerCipherList(RPC *r, RPC_STR *t); -UINT ScGetServerCipher(RPC *r, RPC_STR *t); -UINT ScSetServerCipher(RPC *r, RPC_STR *t); -UINT ScCreateHub(RPC *r, RPC_CREATE_HUB *t); -UINT ScSetHub(RPC *r, RPC_CREATE_HUB *t); -UINT ScGetHub(RPC *r, RPC_CREATE_HUB *t); -UINT ScEnumHub(RPC *r, RPC_ENUM_HUB *t); -UINT ScDeleteHub(RPC *r, RPC_DELETE_HUB *t); -UINT ScGetHubRadius(RPC *r, RPC_RADIUS *t); -UINT ScSetHubRadius(RPC *r, RPC_RADIUS *t); -UINT ScEnumConnection(RPC *r, RPC_ENUM_CONNECTION *t); -UINT ScDisconnectConnection(RPC *r, RPC_DISCONNECT_CONNECTION *t); -UINT ScGetConnectionInfo(RPC *r, RPC_CONNECTION_INFO *t); -UINT ScSetHubOnline(RPC *r, RPC_SET_HUB_ONLINE *t); -UINT ScGetHubStatus(RPC *r, RPC_HUB_STATUS *t); -UINT ScSetHubLog(RPC *r, RPC_HUB_LOG *t); -UINT ScGetHubLog(RPC *r, RPC_HUB_LOG *t); -UINT ScAddCa(RPC *r, RPC_HUB_ADD_CA *t); -UINT ScEnumCa(RPC *r, RPC_HUB_ENUM_CA *t); -UINT ScGetCa(RPC *r, RPC_HUB_GET_CA *t); -UINT ScDeleteCa(RPC *r, RPC_HUB_DELETE_CA *t); -UINT ScCreateLink(RPC *r, RPC_CREATE_LINK *t); -UINT ScEnumLink(RPC *r, RPC_ENUM_LINK *t); -UINT ScGetLinkStatus(RPC *r, RPC_LINK_STATUS *t); -UINT ScSetLinkOnline(RPC *r, RPC_LINK *t); -UINT ScSetLinkOffline(RPC *r, RPC_LINK *t); -UINT ScDeleteLink(RPC *r, RPC_LINK *t); -UINT ScRenameLink(RPC *r, RPC_RENAME_LINK *t); -UINT ScAddAccess(RPC *r, RPC_ADD_ACCESS *t); -UINT ScDeleteAccess(RPC *r, RPC_DELETE_ACCESS *t); -UINT ScEnumAccess(RPC *r, RPC_ENUM_ACCESS_LIST *t); -UINT ScCreateUser(RPC *r, RPC_SET_USER *t); -UINT ScSetUser(RPC *r, RPC_SET_USER *t); -UINT ScGetUser(RPC *r, RPC_SET_USER *t); -UINT ScDeleteUser(RPC *r, RPC_DELETE_USER *t); -UINT ScEnumUser(RPC *r, RPC_ENUM_USER *t); -UINT ScCreateGroup(RPC *r, RPC_SET_GROUP *t); -UINT ScSetGroup(RPC *r, RPC_SET_GROUP *t); -UINT ScGetGroup(RPC *r, RPC_SET_GROUP *t); -UINT ScDeleteGroup(RPC *r, RPC_DELETE_USER *t); -UINT ScEnumGroup(RPC *r, RPC_ENUM_GROUP *t); -UINT ScEnumSession(RPC *r, RPC_ENUM_SESSION *t); -UINT ScGetSessionStatus(RPC *r, RPC_SESSION_STATUS *t); -UINT ScDeleteSession(RPC *r, RPC_DELETE_SESSION *t); -UINT ScEnumMacTable(RPC *r, RPC_ENUM_MAC_TABLE *t); -UINT ScDeleteMacTable(RPC *r, RPC_DELETE_TABLE *t); -UINT ScEnumIpTable(RPC *r, RPC_ENUM_IP_TABLE *t); -UINT ScDeleteIpTable(RPC *r, RPC_DELETE_TABLE *t); -UINT ScGetLink(RPC *a, RPC_CREATE_LINK *t); -UINT ScSetLink(RPC *a, RPC_CREATE_LINK *t); -UINT ScSetAccessList(RPC *r, RPC_ENUM_ACCESS_LIST *t); -UINT ScSetKeep(RPC *r, RPC_KEEP *t); -UINT ScGetKeep(RPC *r, RPC_KEEP *t); -UINT ScEnableSecureNAT(RPC *r, RPC_HUB *t); -UINT ScDisableSecureNAT(RPC *r, RPC_HUB *t); -UINT ScSetSecureNATOption(RPC *r, VH_OPTION *t); -UINT ScGetSecureNATOption(RPC *r, VH_OPTION *t); -UINT ScEnumNAT(RPC *r, RPC_ENUM_NAT *t); -UINT ScEnumDHCP(RPC *r, RPC_ENUM_DHCP *t); -UINT ScGetSecureNATStatus(RPC *r, RPC_NAT_STATUS *t); -UINT ScEnumEthernet(RPC *r, RPC_ENUM_ETH *t); -UINT ScAddLocalBridge(RPC *r, RPC_LOCALBRIDGE *t); -UINT ScDeleteLocalBridge(RPC *r, RPC_LOCALBRIDGE *t); -UINT ScEnumLocalBridge(RPC *r, RPC_ENUM_LOCALBRIDGE *t); -UINT ScGetBridgeSupport(RPC *r, RPC_BRIDGE_SUPPORT *t); -UINT ScRebootServer(RPC *r, RPC_TEST *t); -UINT ScGetCaps(RPC *r, CAPSLIST *t); -UINT ScGetConfig(RPC *r, RPC_CONFIG *t); -UINT ScSetConfig(RPC *r, RPC_CONFIG *t); -UINT ScGetDefaultHubAdminOptions(RPC *r, RPC_ADMIN_OPTION *t); -UINT ScGetHubAdminOptions(RPC *r, RPC_ADMIN_OPTION *t); -UINT ScSetHubAdminOptions(RPC *r, RPC_ADMIN_OPTION *t); -UINT ScGetHubExtOptions(RPC *r, RPC_ADMIN_OPTION *t); -UINT ScSetHubExtOptions(RPC *r, RPC_ADMIN_OPTION *t); -UINT ScAddL3Switch(RPC *r, RPC_L3SW *t); -UINT ScDelL3Switch(RPC *r, RPC_L3SW *t); -UINT ScEnumL3Switch(RPC *r, RPC_ENUM_L3SW *t); -UINT ScStartL3Switch(RPC *r, RPC_L3SW *t); -UINT ScStopL3Switch(RPC *r, RPC_L3SW *t); -UINT ScAddL3If(RPC *r, RPC_L3IF *t); -UINT ScDelL3If(RPC *r, RPC_L3IF *t); -UINT ScEnumL3If(RPC *r, RPC_ENUM_L3IF *t); -UINT ScAddL3Table(RPC *r, RPC_L3TABLE *t); -UINT ScDelL3Table(RPC *r, RPC_L3TABLE *t); -UINT ScEnumL3Table(RPC *r, RPC_ENUM_L3TABLE *t); -UINT ScEnumCrl(RPC *r, RPC_ENUM_CRL *t); -UINT ScAddCrl(RPC *r, RPC_CRL *t); -UINT ScDelCrl(RPC *r, RPC_CRL *t); -UINT ScGetCrl(RPC *r, RPC_CRL *t); -UINT ScSetCrl(RPC *r, RPC_CRL *t); -UINT ScSetAcList(RPC *r, RPC_AC_LIST *t); -UINT ScGetAcList(RPC *r, RPC_AC_LIST *t); -UINT ScEnumLogFile(RPC *r, RPC_ENUM_LOG_FILE *t); -UINT ScReadLogFile(RPC *r, RPC_READ_LOG_FILE *t); -UINT ScAddLicenseKey(RPC *r, RPC_TEST *t); -UINT ScDelLicenseKey(RPC *r, RPC_TEST *t); -UINT ScEnumLicenseKey(RPC *r, RPC_ENUM_LICENSE_KEY *t); -UINT ScGetLicenseStatus(RPC *r, RPC_LICENSE_STATUS *t); -UINT ScSetSysLog(RPC *r, SYSLOG_SETTING *t); -UINT ScGetSysLog(RPC *r, SYSLOG_SETTING *t); -UINT ScEnumEthVLan(RPC *r, RPC_ENUM_ETH_VLAN *t); -UINT ScSetEnableEthVLan(RPC *r, RPC_TEST *t); -UINT ScSetHubMsg(RPC *r, RPC_MSG *t); -UINT ScGetHubMsg(RPC *r, RPC_MSG *t); -UINT ScCrash(RPC *r, RPC_TEST *t); -UINT ScGetAdminMsg(RPC *r, RPC_MSG *t); -UINT ScFlush(RPC *r, RPC_TEST *t); -UINT ScDebug(RPC *r, RPC_TEST *t); -UINT ScSetIPsecServices(RPC *r, IPSEC_SERVICES *t); -UINT ScGetIPsecServices(RPC *r, IPSEC_SERVICES *t); -UINT ScAddEtherIpId(RPC *r, ETHERIP_ID *t); -UINT ScGetEtherIpId(RPC *r, ETHERIP_ID *t); -UINT ScDeleteEtherIpId(RPC *r, ETHERIP_ID *t); -UINT ScEnumEtherIpId(RPC *r, RPC_ENUM_ETHERIP_ID *t); -UINT ScSetOpenVpnSstpConfig(RPC *r, OPENVPN_SSTP_CONFIG *t); -UINT ScGetOpenVpnSstpConfig(RPC *r, OPENVPN_SSTP_CONFIG *t); -UINT ScGetDDnsClientStatus(RPC *r, DDNS_CLIENT_STATUS *t); -UINT ScChangeDDnsClientHostname(RPC *r, RPC_TEST *t); -UINT ScRegenerateServerCert(RPC *r, RPC_TEST *t); -UINT ScMakeOpenVpnConfigFile(RPC *r, RPC_READ_LOG_FILE *t); -UINT ScSetSpecialListener(RPC *r, RPC_SPECIAL_LISTENER *t); -UINT ScGetSpecialListener(RPC *r, RPC_SPECIAL_LISTENER *t); -UINT ScGetAzureStatus(RPC *r, RPC_AZURE_STATUS *t); -UINT ScSetAzureStatus(RPC *r, RPC_AZURE_STATUS *t); -UINT ScGetDDnsInternetSetting(RPC *r, INTERNET_SETTING *t); -UINT ScSetDDnsInternetSetting(RPC *r, INTERNET_SETTING *t); -UINT ScSetVgsConfig(RPC *r, VGS_CONFIG *t); -UINT ScGetVgsConfig(RPC *r, VGS_CONFIG *t); - -void InRpcTest(RPC_TEST *t, PACK *p); -void OutRpcTest(PACK *p, RPC_TEST *t); -void FreeRpcTest(RPC_TEST *t); -void InRpcServerInfo(RPC_SERVER_INFO *t, PACK *p); -void OutRpcServerInfo(PACK *p, RPC_SERVER_INFO *t); -void FreeRpcServerInfo(RPC_SERVER_INFO *t); -void InRpcServerStatus(RPC_SERVER_STATUS *t, PACK *p); -void OutRpcServerStatus(PACK *p, RPC_SERVER_STATUS *t); -void InRpcListener(RPC_LISTENER *t, PACK *p); -void OutRpcListener(PACK *p, RPC_LISTENER *t); -void InRpcListenerList(RPC_LISTENER_LIST *t, PACK *p); -void OutRpcListenerList(PACK *p, RPC_LISTENER_LIST *t); -void FreeRpcListenerList(RPC_LISTENER_LIST *t); -void InRpcPorts(RPC_PORTS *t, PACK *p); -void OutRpcPorts(PACK *p, RPC_PORTS *t); -void FreeRpcPorts(RPC_PORTS *t); -void InRpcStr(RPC_STR *t, PACK *p); -void OutRpcStr(PACK *p, RPC_STR *t); -void FreeRpcStr(RPC_STR *t); -void InRpcProtoOptions(RPC_PROTO_OPTIONS *t, PACK *p); -void OutRpcProtoOptions(PACK *p, RPC_PROTO_OPTIONS *t); -void FreeRpcProtoOptions(RPC_PROTO_OPTIONS *t); -void InRpcSetPassword(RPC_SET_PASSWORD *t, PACK *p); -void OutRpcSetPassword(PACK *p, RPC_SET_PASSWORD *t); -void InRpcFarm(RPC_FARM *t, PACK *p); -void OutRpcFarm(PACK *p, RPC_FARM *t); -void FreeRpcFarm(RPC_FARM *t); -void InRpcFarmHub(RPC_FARM_HUB *t, PACK *p); -void OutRpcFarmHub(PACK *p, RPC_FARM_HUB *t); -void InRpcFarmInfo(RPC_FARM_INFO *t, PACK *p); -void OutRpcFarmInfo(PACK *p, RPC_FARM_INFO *t); -void FreeRpcFarmInfo(RPC_FARM_INFO *t); -void InRpcEnumFarm(RPC_ENUM_FARM *t, PACK *p); -void OutRpcEnumFarm(PACK *p, RPC_ENUM_FARM *t); -void FreeRpcEnumFarm(RPC_ENUM_FARM *t); -void InRpcFarmConnectionStatus(RPC_FARM_CONNECTION_STATUS *t, PACK *p); -void OutRpcFarmConnectionStatus(PACK *p, RPC_FARM_CONNECTION_STATUS *t); -void InRpcHubOption(RPC_HUB_OPTION *t, PACK *p); -void OutRpcHubOption(PACK *p, RPC_HUB_OPTION *t); -void InRpcRadius(RPC_RADIUS *t, PACK *p); -void OutRpcRadius(PACK *p, RPC_RADIUS *t); -void InRpcHub(RPC_HUB *t, PACK *p); -void OutRpcHub(PACK *p, RPC_HUB *t); -void InRpcCreateHub(RPC_CREATE_HUB *t, PACK *p); -void OutRpcCreateHub(PACK *p, RPC_CREATE_HUB *t); -void InRpcEnumHub(RPC_ENUM_HUB *t, PACK *p); -void OutRpcEnumHub(PACK *p, RPC_ENUM_HUB *t); -void FreeRpcEnumHub(RPC_ENUM_HUB *t); -void InRpcDeleteHub(RPC_DELETE_HUB *t, PACK *p); -void OutRpcDeleteHub(PACK *p, RPC_DELETE_HUB *t); -void InRpcEnumConnection(RPC_ENUM_CONNECTION *t, PACK *p); -void OutRpcEnumConnection(PACK *p, RPC_ENUM_CONNECTION *t); -void FreeRpcEnumConnection(RPC_ENUM_CONNECTION *t); -void InRpcDisconnectConnection(RPC_DISCONNECT_CONNECTION *t, PACK *p); -void OutRpcDisconnectConnection(PACK *p, RPC_DISCONNECT_CONNECTION *t); -void InRpcConnectionInfo(RPC_CONNECTION_INFO *t, PACK *p); -void OutRpcConnectionInfo(PACK *p, RPC_CONNECTION_INFO *t); -void InRpcSetHubOnline(RPC_SET_HUB_ONLINE *t, PACK *p); -void OutRpcSetHubOnline(PACK *p, RPC_SET_HUB_ONLINE *t); -void InRpcHubStatus(RPC_HUB_STATUS *t, PACK *p); -void OutRpcHubStatus(PACK *p, RPC_HUB_STATUS *t); -void InRpcHubLog(RPC_HUB_LOG *t, PACK *p); -void OutRpcHubLog(PACK *p, RPC_HUB_LOG *t); -void InRpcHubAddCa(RPC_HUB_ADD_CA *t, PACK *p); -void OutRpcHubAddCa(PACK *p, RPC_HUB_ADD_CA *t); -void FreeRpcHubAddCa(RPC_HUB_ADD_CA *t); -void InRpcHubEnumCa(RPC_HUB_ENUM_CA *t, PACK *p); -void OutRpcHubEnumCa(PACK *p, RPC_HUB_ENUM_CA *t); -void FreeRpcHubEnumCa(RPC_HUB_ENUM_CA *t); -void InRpcHubGetCa(RPC_HUB_GET_CA *t, PACK *p); -void OutRpcHubGetCa(PACK *p, RPC_HUB_GET_CA *t); -void FreeRpcHubGetCa(RPC_HUB_GET_CA *t); -void InRpcHubDeleteCa(RPC_HUB_DELETE_CA *t, PACK *p); -void OutRpcHubDeleteCa(PACK *p, RPC_HUB_DELETE_CA *t); -void InRpcCreateLink(RPC_CREATE_LINK *t, PACK *p); -void OutRpcCreateLink(PACK *p, RPC_CREATE_LINK *t); -void FreeRpcCreateLink(RPC_CREATE_LINK *t); -void InRpcEnumLink(RPC_ENUM_LINK *t, PACK *p); -void OutRpcEnumLink(PACK *p, RPC_ENUM_LINK *t); -void FreeRpcEnumLink(RPC_ENUM_LINK *t); -void InRpcLinkStatus(RPC_LINK_STATUS *t, PACK *p); -void OutRpcLinkStatus(PACK *p, RPC_LINK_STATUS *t); -void FreeRpcLinkStatus(RPC_LINK_STATUS *t); -void InRpcLink(RPC_LINK *t, PACK *p); -void OutRpcLink(PACK *p, RPC_LINK *t); -void InRpcAccessEx(ACCESS *a, PACK *p, UINT index); -void InRpcAccess(ACCESS *a, PACK *p); -void OutRpcAccessEx(PACK *p, ACCESS *a, UINT index, UINT total); -void OutRpcAccess(PACK *p, ACCESS *a); -void InRpcEnumAccessList(RPC_ENUM_ACCESS_LIST *a, PACK *p); -void OutRpcEnumAccessList(PACK *p, RPC_ENUM_ACCESS_LIST *a); -void FreeRpcEnumAccessList(RPC_ENUM_ACCESS_LIST *a); -void *InRpcAuthData(PACK *p, UINT *authtype, char *username); -void OutRpcAuthData(PACK *p, void *authdata, UINT authtype); -void FreeRpcAuthData(void *authdata, UINT authtype); -void InRpcSetUser(RPC_SET_USER *t, PACK *p); -void OutRpcSetUser(PACK *p, RPC_SET_USER *t); -void FreeRpcSetUser(RPC_SET_USER *t); -void InRpcEnumUser(RPC_ENUM_USER *t, PACK *p); -void OutRpcEnumUser(PACK *p, RPC_ENUM_USER *t); -void FreeRpcEnumUser(RPC_ENUM_USER *t); -void InRpcSetGroup(RPC_SET_GROUP *t, PACK *p); -void OutRpcSetGroup(PACK *p, RPC_SET_GROUP *t); -void InRpcEnumGroup(RPC_ENUM_GROUP *t, PACK *p); -void OutRpcEnumGroup(PACK *p, RPC_ENUM_GROUP *t); -void FreeRpcEnumGroup(RPC_ENUM_GROUP *t); -void InRpcDeleteUser(RPC_DELETE_USER *t, PACK *p); -void OutRpcDeleteUser(PACK *p, RPC_DELETE_USER *t); -void InRpcEnumSession(RPC_ENUM_SESSION *t, PACK *p); -void OutRpcEnumSession(PACK *p, RPC_ENUM_SESSION *t); -void FreeRpcEnumSession(RPC_ENUM_SESSION *t); -void InRpcNodeInfo(NODE_INFO *t, PACK *p); -void OutRpcNodeInfo(PACK *p, NODE_INFO *t); -void InRpcSessionStatus(RPC_SESSION_STATUS *t, PACK *p); -void OutRpcSessionStatus(PACK *p, RPC_SESSION_STATUS *t); -void FreeRpcSessionStatus(RPC_SESSION_STATUS *t); -void InRpcDeleteSession(RPC_DELETE_SESSION *t, PACK *p); -void OutRpcDeleteSession(PACK *p, RPC_DELETE_SESSION *t); -void InRpcEnumMacTable(RPC_ENUM_MAC_TABLE *t, PACK *p); -void OutRpcEnumMacTable(PACK *p, RPC_ENUM_MAC_TABLE *t); -void FreeRpcEnumMacTable(RPC_ENUM_MAC_TABLE *t); -void InRpcEnumIpTable(RPC_ENUM_IP_TABLE *t, PACK *p); -void OutRpcEnumIpTable(PACK *p, RPC_ENUM_IP_TABLE *t); -void FreeRpcEnumIpTable(RPC_ENUM_IP_TABLE *t); -void InRpcDeleteTable(RPC_DELETE_TABLE *t, PACK *p); -void OutRpcDeleteTable(PACK *p, RPC_DELETE_TABLE *t); -void InRpcMemInfo(MEMINFO *t, PACK *p); -void OutRpcMemInfo(PACK *p, MEMINFO *t); -void InRpcKeyPair(RPC_KEY_PAIR *t, PACK *p); -void OutRpcKeyPair(PACK *p, RPC_KEY_PAIR *t); -void FreeRpcKeyPair(RPC_KEY_PAIR *t); -void InRpcAddAccess(RPC_ADD_ACCESS *t, PACK *p); -void OutRpcAddAccess(PACK *p, RPC_ADD_ACCESS *t); -void InRpcDeleteAccess(RPC_DELETE_ACCESS *t, PACK *p); -void OutRpcDeleteAccess(PACK *p, RPC_DELETE_ACCESS *t); -void FreeRpcSetGroup(RPC_SET_GROUP *t); -void AdjoinRpcEnumSession(RPC_ENUM_SESSION *dest, RPC_ENUM_SESSION *src); -void AdjoinRpcEnumMacTable(RPC_ENUM_MAC_TABLE *dest, RPC_ENUM_MAC_TABLE *src); -void AdjoinRpcEnumIpTable(RPC_ENUM_IP_TABLE *dest, RPC_ENUM_IP_TABLE *src); -void InRpcKeep(RPC_KEEP *t, PACK *p); -void OutRpcKeep(PACK *p, RPC_KEEP *t); -void InRpcOsInfo(OS_INFO *t, PACK *p); -void OutRpcOsInfo(PACK *p, OS_INFO *t); -void FreeRpcOsInfo(OS_INFO *t); -void InRpcEnumEth(RPC_ENUM_ETH *t, PACK *p); -void OutRpcEnumEth(PACK *p, RPC_ENUM_ETH *t); -void FreeRpcEnumEth(RPC_ENUM_ETH *t); -void InRpcLocalBridge(RPC_LOCALBRIDGE *t, PACK *p); -void OutRpcLocalBridge(PACK *p, RPC_LOCALBRIDGE *t); -void InRpcEnumLocalBridge(RPC_ENUM_LOCALBRIDGE *t, PACK *p); -void OutRpcEnumLocalBridge(PACK *p, RPC_ENUM_LOCALBRIDGE *t); -void FreeRpcEnumLocalBridge(RPC_ENUM_LOCALBRIDGE *t); -void InRpcBridgeSupport(RPC_BRIDGE_SUPPORT *t, PACK *p); -void OutRpcBridgeSupport(PACK *p, RPC_BRIDGE_SUPPORT *t); -void InRpcConfig(RPC_CONFIG *t, PACK *p); -void OutRpcConfig(PACK *p, RPC_CONFIG *t); -void FreeRpcConfig(RPC_CONFIG *t); -void InRpcAdminOption(RPC_ADMIN_OPTION *t, PACK *p); -void OutRpcAdminOption(PACK *p, RPC_ADMIN_OPTION *t); -void FreeRpcAdminOption(RPC_ADMIN_OPTION *t); -void InRpcEnumL3Table(RPC_ENUM_L3TABLE *t, PACK *p); -void OutRpcEnumL3Table(PACK *p, RPC_ENUM_L3TABLE *t); -void FreeRpcEnumL3Table(RPC_ENUM_L3TABLE *t); -void InRpcL3Table(RPC_L3TABLE *t, PACK *p); -void OutRpcL3Table(PACK *p, RPC_L3TABLE *t); -void InRpcEnumL3If(RPC_ENUM_L3IF *t, PACK *p); -void OutRpcEnumL3If(PACK *p, RPC_ENUM_L3IF *t); -void FreeRpcEnumL3If(RPC_ENUM_L3IF *t); -void InRpcL3If(RPC_L3IF *t, PACK *p); -void OutRpcL3If(PACK *p, RPC_L3IF *t); -void InRpcL3Sw(RPC_L3SW *t, PACK *p); -void OutRpcL3Sw(PACK *p, RPC_L3SW *t); -void InRpcEnumL3Sw(RPC_ENUM_L3SW *t, PACK *p); -void OutRpcEnumL3Sw(PACK *p, RPC_ENUM_L3SW *t); -void FreeRpcEnumL3Sw(RPC_ENUM_L3SW *t); -void InRpcCrl(RPC_CRL *t, PACK *p); -void OutRpcCrl(PACK *p, RPC_CRL *t); -void FreeRpcCrl(RPC_CRL *t); -void InRpcEnumCrl(RPC_ENUM_CRL *t, PACK *p); -void OutRpcEnumCrl(PACK *p, RPC_ENUM_CRL *t); -void FreeRpcEnumCrl(RPC_ENUM_CRL *t); -void InRpcInt(RPC_INT *t, PACK *p); -void OutRpcInt(PACK *p, RPC_INT *t); -void InRpcAcList(RPC_AC_LIST *t, PACK *p); -void OutRpcAcList(PACK *p, RPC_AC_LIST *t); -void FreeRpcAcList(RPC_AC_LIST *t); -void InRpcEnumLogFile(RPC_ENUM_LOG_FILE *t, PACK *p); -void OutRpcEnumLogFile(PACK *p, RPC_ENUM_LOG_FILE *t); -void FreeRpcEnumLogFile(RPC_ENUM_LOG_FILE *t); -void AdjoinRpcEnumLogFile(RPC_ENUM_LOG_FILE *t, RPC_ENUM_LOG_FILE *src); -void InRpcReadLogFile(RPC_READ_LOG_FILE *t, PACK *p); -void OutRpcReadLogFile(PACK *p, RPC_READ_LOG_FILE *t); -void FreeRpcReadLogFile(RPC_READ_LOG_FILE *t); -void InRpcRenameLink(RPC_RENAME_LINK *t, PACK *p); -void OutRpcRenameLink(PACK *p, RPC_RENAME_LINK *t); -void InRpcEnumLicenseKey(RPC_ENUM_LICENSE_KEY *t, PACK *p); -void OutRpcEnumLicenseKey(PACK *p, RPC_ENUM_LICENSE_KEY *t); -void FreeRpcEnumLicenseKey(RPC_ENUM_LICENSE_KEY *t); -void InRpcLicenseStatus(RPC_LICENSE_STATUS *t, PACK *p); -void OutRpcLicenseStatus(PACK *p, RPC_LICENSE_STATUS *t); -void InRpcEnumEthVLan(RPC_ENUM_ETH_VLAN *t, PACK *p); -void OutRpcEnumEthVLan(PACK *p, RPC_ENUM_ETH_VLAN *t); -void FreeRpcEnumEthVLan(RPC_ENUM_ETH_VLAN *t); -void InRpcMsg(RPC_MSG *t, PACK *p); -void OutRpcMsg(PACK *p, RPC_MSG *t); -void FreeRpcMsg(RPC_MSG *t); -void InRpcWinVer(RPC_WINVER *t, PACK *p); -void OutRpcWinVer(PACK *p, RPC_WINVER *t); -void InIPsecServices(IPSEC_SERVICES *t, PACK *p); -void OutIPsecServices(PACK *p, IPSEC_SERVICES *t); -void InRpcEnumEtherIpId(RPC_ENUM_ETHERIP_ID *t, PACK *p); -void OutRpcEnumEtherIpId(PACK *p, RPC_ENUM_ETHERIP_ID *t); -void FreeRpcEnumEtherIpId(RPC_ENUM_ETHERIP_ID *t); -void InEtherIpId(ETHERIP_ID *t, PACK *p); -void OutEtherIpId(PACK *p, ETHERIP_ID *t); -void InOpenVpnSstpConfig(OPENVPN_SSTP_CONFIG *t, PACK *p); -void OutOpenVpnSstpConfig(PACK *p, OPENVPN_SSTP_CONFIG *t); -void InDDnsClientStatus(DDNS_CLIENT_STATUS *t, PACK *p); -void OutDDnsClientStatus(PACK *p, DDNS_CLIENT_STATUS *t); -void InRpcSpecialListener(RPC_SPECIAL_LISTENER *t, PACK *p); -void OutRpcSpecialListener(PACK *p, RPC_SPECIAL_LISTENER *t); -void InRpcAzureStatus(RPC_AZURE_STATUS *t, PACK *p); -void OutRpcAzureStatus(PACK *p, RPC_AZURE_STATUS *t); -void InRpcInternetSetting(INTERNET_SETTING *t, PACK *p); -void OutRpcInternetSetting(PACK *p, INTERNET_SETTING *t); - -#endif // ADMIN_H - - +// SoftEther VPN Source Code - Developer Edition Master Branch +// Cedar Communication Module + + +// Admin.h +// Header of Admin.c + +#ifndef ADMIN_H +#define ADMIN_H + +// Windows version +struct RPC_WINVER +{ + bool IsWindows; + bool IsNT; + bool IsServer; + bool IsBeta; + UINT VerMajor; + UINT VerMinor; + UINT Build; + UINT ServicePack; + char Title[128]; +}; + +// Server-side structure +struct ADMIN +{ + SERVER *Server; // Server + bool ServerAdmin; // Server Administrator + char *HubName; // HUB name that can be managed + RPC *Rpc; // RPC + LIST *LogFileList; // Accessible log file list + UINT ClientBuild; // Build number of the client + RPC_WINVER ClientWinVer; // Windows version of client + UINT MaxJsonRpcRecvSize; // Max JSON-RPC Receive Size + char dummy1[MAX_HUBNAME_LEN + 1]; // hubname buffer (dummy) +}; + +// Test +struct RPC_TEST +{ + UINT IntValue; + UINT64 Int64Value; + char StrValue[1024]; + wchar_t UniStrValue[1024]; +}; + +// Server Information * +struct RPC_SERVER_INFO +{ + char ServerProductName[128]; // Server product name + char ServerVersionString[128]; // Server version string + char ServerBuildInfoString[128]; // Server build information string + UINT ServerVerInt; // Server version integer value + UINT ServerBuildInt; // Server build number integer value + char ServerHostName[MAX_HOST_NAME_LEN + 1]; // Server host name + UINT ServerType; // Type of server + UINT64 ServerBuildDate; // Build date and time of the server + char ServerFamilyName[128]; // Family name + OS_INFO OsInfo; // OS information +}; + +// Server status +struct RPC_SERVER_STATUS +{ + UINT ServerType; // Type of server + UINT NumTcpConnections; // Total number of TCP connections + UINT NumTcpConnectionsLocal; // Number of Local TCP connections + UINT NumTcpConnectionsRemote; // Number of remote TCP connections + UINT NumHubTotal; // Total number of HUBs + UINT NumHubStandalone; // Number of stand-alone HUB + UINT NumHubStatic; // Number of static HUBs + UINT NumHubDynamic; // Number of Dynamic HUBs + UINT NumSessionsTotal; // Total number of sessions + UINT NumSessionsLocal; // Number of Local sessions (only controller) + UINT NumSessionsRemote; // The number of remote sessions (other than the controller) + UINT NumMacTables; // Number of MAC table entries + UINT NumIpTables; // Number of IP table entries + UINT NumUsers; // Number of users + UINT NumGroups; // Number of groups + UINT AssignedBridgeLicenses; // Number of assigned bridge licenses + UINT AssignedClientLicenses; // Number of assigned client licenses + UINT AssignedBridgeLicensesTotal; // Number of Assigned bridge license (cluster-wide) + UINT AssignedClientLicensesTotal; // Number of assigned client licenses (cluster-wide) + TRAFFIC Traffic; // Traffic information + UINT64 CurrentTime; // Current time + UINT64 CurrentTick; // Current tick + UINT64 StartTime; // Start-up time + MEMINFO MemInfo; // Memory information +}; + +// Listener +struct RPC_LISTENER +{ + UINT Port; // Port number + bool Enable; // Active state +}; + +// List of listeners * +struct RPC_LISTENER_LIST +{ + UINT NumPort; // Number of ports + UINT *Ports; // Port List + bool *Enables; // Effective state + bool *Errors; // An error occurred +}; + +// List of ports +struct RPC_PORTS +{ + UINT Num; // Number of ports + UINT *Ports; // Ports +}; + +// String * +struct RPC_STR +{ + char *String; // String +}; + +// Integer +struct RPC_INT +{ + UINT IntValue; // Integer +}; + +// Proto options +struct RPC_PROTO_OPTIONS +{ + char *Protocol; // Protocol name + UINT Num; // Number of options + PROTO_OPTION *Options; // Options +}; + +// Set Password +struct RPC_SET_PASSWORD +{ + UCHAR HashedPassword[SHA1_SIZE]; // Hashed password (for traditional RPC) + char PlainTextPassword[MAX_SIZE]; // Plaintext password (for JSON-RPC) +}; + +// Server farm configuration * +struct RPC_FARM +{ + UINT ServerType; // Type of server + UINT NumPort; // Number of public ports + UINT *Ports; // Public port list + UINT PublicIp; // Public IP + char ControllerName[MAX_HOST_NAME_LEN + 1]; // Controller name + UINT ControllerPort; // Controller port + UCHAR MemberPassword[SHA1_SIZE]; // Member password + char MemberPasswordPlaintext[MAX_SIZE]; // Member password (plaintext) + UINT Weight; // Performance ratio + bool ControllerOnly; // Only controller function +}; + +// HUB item of each farm member +struct RPC_FARM_HUB +{ + char HubName[MAX_HUBNAME_LEN + 1]; // HUB Name + bool DynamicHub; // Dynamic HUB +}; + +// Server farm member information acquisition * +struct RPC_FARM_INFO +{ + UINT Id; // ID + bool Controller; // Controller + UINT64 ConnectedTime; // Connection time + UINT Ip; // IP address + char Hostname[MAX_HOST_NAME_LEN + 1]; // Host name + UINT Point; // Point + UINT NumPort; // Number of ports + UINT *Ports; // Port + X *ServerCert; // Server certificate + UINT NumFarmHub; // Number of farm HUB + RPC_FARM_HUB *FarmHubs; // Farm HUB + UINT NumSessions; // Number of sessions + UINT NumTcpConnections; // Number of TCP connections + UINT Weight; // Performance ratio +}; + +// Server farm members enumeration items +struct RPC_ENUM_FARM_ITEM +{ + UINT Id; // ID + bool Controller; // Controller + UINT64 ConnectedTime; // Connection time + UINT Ip; // IP address + char Hostname[MAX_HOST_NAME_LEN + 1]; // Host name + UINT Point; // Point + UINT NumSessions; // Number of sessions + UINT NumTcpConnections; // Number of TCP connections + UINT NumHubs; // Number of HUBs + UINT AssignedClientLicense; // Number of assigned client licenses + UINT AssignedBridgeLicense; // Number of assigned bridge licenses +}; + +// Server farm member enumeration * +struct RPC_ENUM_FARM +{ + UINT NumFarm; // Number of farm members + RPC_ENUM_FARM_ITEM *Farms; // Farm member list +}; + +// Connection state to the controller +struct RPC_FARM_CONNECTION_STATUS +{ + UINT Ip; // IP address + UINT Port; // Port number + bool Online; // Online state + UINT LastError; // Last error + UINT64 StartedTime; // Connection start time + UINT64 FirstConnectedTime; // First connection time + UINT64 CurrentConnectedTime; // Connection time of this time + UINT NumTry; // Number of trials + UINT NumConnected; // Number of connection count + UINT NumFailed; // Connection failure count +}; + +// Key pair +struct RPC_KEY_PAIR +{ + X *Cert; // Certificate + K *Key; // Secret key + UINT Flag1; // Flag1 +}; + +// HUB option +struct RPC_HUB_OPTION +{ + UINT MaxSession; // Maximum number of sessions + bool NoEnum; // Not listed +}; + +// Radius server options +struct RPC_RADIUS +{ + char HubName[MAX_HUBNAME_LEN + 1]; // HUB Name + char RadiusServerName[MAX_HOST_NAME_LEN + 1]; // Radius server name + UINT RadiusPort; // Radius port number + char RadiusSecret[MAX_PASSWORD_LEN + 1]; // Secret key + UINT RadiusRetryInterval; // Radius retry interval +}; + +// Specify the HUB +struct RPC_HUB +{ + char HubName[MAX_HUBNAME_LEN + 1]; // HUB Name +}; + +// Create a HUB +struct RPC_CREATE_HUB +{ + char HubName[MAX_HUBNAME_LEN + 1]; // HUB Name + UCHAR HashedPassword[SHA1_SIZE]; // Administrative password + UCHAR SecurePassword[SHA1_SIZE]; // Administrator password + char AdminPasswordPlainText[MAX_SIZE]; // Password (plaintext) + bool Online; // Online flag + RPC_HUB_OPTION HubOption; // HUB options + UINT HubType; // Type of HUB +}; + +// Enumeration items of HUB +struct RPC_ENUM_HUB_ITEM +{ + char HubName[MAX_HUBNAME_LEN + 1]; // HUB Name + bool Online; // Online + UINT HubType; // Type of HUB + UINT NumUsers; // Number of users + UINT NumGroups; // Number of groups + UINT NumSessions; // Number of sessions + UINT NumMacTables; // Number of MAC table entries + UINT NumIpTables; // Number of IP table entries + UINT64 LastCommTime; // Last communication date and time + UINT64 LastLoginTime; // Last login date and time + UINT64 CreatedTime; // Creation date and time + UINT NumLogin; // Number of logins + bool IsTrafficFilled; // Whether the traffic information exists + TRAFFIC Traffic; // Traffic +}; + +// Enumeration of HUB +struct RPC_ENUM_HUB +{ + UINT NumHub; // Number of HUBs + RPC_ENUM_HUB_ITEM *Hubs; // HUB +}; + +// Delete the HUB +struct RPC_DELETE_HUB +{ + char HubName[MAX_HUBNAME_LEN + 1]; // HUB Name +}; + +// Connection enumeration items +struct RPC_ENUM_CONNECTION_ITEM +{ + char Name[MAX_SIZE]; // Connection name + char Hostname[MAX_SIZE]; // Host name + UINT Ip; // IP address + UINT Port; // Port number + UINT64 ConnectedTime; // Connected time + UINT Type; // Type +}; + +// Connection enumeration +struct RPC_ENUM_CONNECTION +{ + UINT NumConnection; // Number of connections + RPC_ENUM_CONNECTION_ITEM *Connections; // Connection list +}; + +// Disconnection +struct RPC_DISCONNECT_CONNECTION +{ + char Name[MAX_SIZE]; // Connection name +}; + +// Connection information +struct RPC_CONNECTION_INFO +{ + char Name[MAX_SIZE]; // Connection name + UINT Type; // Type + char Hostname[MAX_SIZE]; // Host name + UINT Ip; // IP address + UINT Port; // Port number + UINT64 ConnectedTime; // Connected time + char ServerStr[MAX_SERVER_STR_LEN + 1]; // Server string + UINT ServerVer; // Server version + UINT ServerBuild; // Server build number + char ClientStr[MAX_CLIENT_STR_LEN + 1]; // Client string + UINT ClientVer; // Client version + UINT ClientBuild; // Client build number +}; + +// Online or offline the HUB +struct RPC_SET_HUB_ONLINE +{ + char HubName[MAX_HUBNAME_LEN + 1]; // HUB Name + bool Online; // Online / offline flag +}; + +// Get the state HUB +struct RPC_HUB_STATUS +{ + char HubName[MAX_HUBNAME_LEN + 1]; // HUB Name + bool Online; // Online + UINT HubType; // Type of HUB + UINT NumSessions; // Number of sessions + UINT NumSessionsClient; // Number of sessions (client) + UINT NumSessionsBridge; // Number of sessions (bridge) + UINT NumAccessLists; // Number of Access list entries + UINT NumUsers; // Number of users + UINT NumGroups; // Number of groups + UINT NumMacTables; // Number of MAC table entries + UINT NumIpTables; // Number of IP table entries + TRAFFIC Traffic; // Traffic + bool SecureNATEnabled; // Whether SecureNAT is enabled + UINT64 LastCommTime; // Last communication date and time + UINT64 LastLoginTime; // Last login date and time + UINT64 CreatedTime; // Creation date and time + UINT NumLogin; // Number of logins +}; + +// HUB log settings +struct RPC_HUB_LOG +{ + char HubName[MAX_HUBNAME_LEN + 1]; // HUB Name + HUB_LOG LogSetting; // Log Settings +}; + +// Add CA to HUB * +struct RPC_HUB_ADD_CA +{ + char HubName[MAX_HUBNAME_LEN + 1]; // HUB Name + X *Cert; // Certificate +}; + +// CA enumeration items of HUB +struct RPC_HUB_ENUM_CA_ITEM +{ + UINT Key; // Certificate key + wchar_t SubjectName[MAX_SIZE]; // Issued to + wchar_t IssuerName[MAX_SIZE]; // Issuer + UINT64 Expires; // Expiration date +}; + +// CA enumeration of HUB * +struct RPC_HUB_ENUM_CA +{ + char HubName[MAX_HUBNAME_LEN + 1]; // HUB Name + UINT NumCa; // CA number + RPC_HUB_ENUM_CA_ITEM *Ca; // CA +}; + +// Get the CA of HUB * +struct RPC_HUB_GET_CA +{ + char HubName[MAX_HUBNAME_LEN + 1]; // HUB Name + UINT Key; // Certificate key + X *Cert; // Certificate +}; + +// Delete the CA of HUB +struct RPC_HUB_DELETE_CA +{ + char HubName[MAX_HUBNAME_LEN + 1]; // HUB Name + UINT Key; // Certificate key to be deleted +}; + +// Create and set of link * +struct RPC_CREATE_LINK +{ + char HubName[MAX_HUBNAME_LEN + 1]; // HUB Name + bool Online; // Online flag + CLIENT_OPTION *ClientOption; // Client Option + CLIENT_AUTH *ClientAuth; // Client authentication data + POLICY Policy; // Policy + bool CheckServerCert; // Validate the server certificate + X *ServerCert; // Server certificate +}; + +// Enumeration items of link +struct RPC_ENUM_LINK_ITEM +{ + wchar_t AccountName[MAX_ACCOUNT_NAME_LEN + 1]; // Account name + bool Online; // Online flag + bool Connected; // Connection completion flag + UINT LastError; // The error that last occurred + UINT64 ConnectedTime; // Connection completion time + char Hostname[MAX_HOST_NAME_LEN + 1]; // Host name + char HubName[MAX_HUBNAME_LEN + 1]; // HUB Name +}; + +// Enumeration of the link * +struct RPC_ENUM_LINK +{ + char HubName[MAX_HUBNAME_LEN + 1]; // HUB Name + UINT NumLink; // Number of links + RPC_ENUM_LINK_ITEM *Links; // Link List +}; + +// Get the link state * +struct RPC_LINK_STATUS +{ + char HubName[MAX_HUBNAME_LEN + 1]; // HUB Name + wchar_t AccountName[MAX_ACCOUNT_NAME_LEN + 1]; // Account name + RPC_CLIENT_GET_CONNECTION_STATUS Status; // Status +}; + +// Specify the Link +struct RPC_LINK +{ + char HubName[MAX_HUBNAME_LEN + 1]; // HUB Name + wchar_t AccountName[MAX_ACCOUNT_NAME_LEN + 1]; // Account name +}; + +// Rename link +struct RPC_RENAME_LINK +{ + char HubName[MAX_HUBNAME_LEN + 1]; // HUB Name + wchar_t OldAccountName[MAX_ACCOUNT_NAME_LEN + 1]; // Old account name + wchar_t NewAccountName[MAX_ACCOUNT_NAME_LEN + 1]; // New account name +}; + +// Enumeration of the access list * +struct RPC_ENUM_ACCESS_LIST +{ + char HubName[MAX_HUBNAME_LEN + 1]; // HUB Name + UINT NumAccess; // Number of Access list entries + ACCESS *Accesses; // Access list +}; + +// Add to Access List +struct RPC_ADD_ACCESS +{ + char HubName[MAX_HUBNAME_LEN + 1]; // HUB Name + ACCESS Access; // Access list +}; + +// Delete the access list +struct RPC_DELETE_ACCESS +{ + char HubName[MAX_HUBNAME_LEN + 1]; // HUB Name + UINT Id; // ID +}; + +// Create, configure, and get the user * +struct RPC_SET_USER +{ + char HubName[MAX_HUBNAME_LEN + 1]; // HUB Name + char Name[MAX_USERNAME_LEN + 1]; // User name + char GroupName[MAX_USERNAME_LEN + 1]; // Group name + wchar_t Realname[MAX_SIZE]; // Real name + wchar_t Note[MAX_SIZE]; // Note + UINT64 CreatedTime; // Creation date and time + UINT64 UpdatedTime; // Updating date + UINT64 ExpireTime; // Expiration date + UINT AuthType; // Authentication method + void *AuthData; // Authentication data + UINT NumLogin; // Number of logins + TRAFFIC Traffic; // Traffic data + POLICY *Policy; // Policy +}; + +// Enumeration item of user +struct RPC_ENUM_USER_ITEM +{ + char Name[MAX_USERNAME_LEN + 1]; // User name + char GroupName[MAX_USERNAME_LEN + 1]; // Group name + wchar_t Realname[MAX_SIZE]; // Real name + wchar_t Note[MAX_SIZE]; // Note + UINT AuthType; // Authentication method + UINT NumLogin; // Number of logins + UINT64 LastLoginTime; // Last login date and time + bool DenyAccess; // Access denied + bool IsTrafficFilled; // Flag of whether the traffic variable is set + TRAFFIC Traffic; // Traffic + bool IsExpiresFilled; // Flag of whether expiration date variable is set + UINT64 Expires; // Expiration date +}; + +// Enumeration of user +struct RPC_ENUM_USER +{ + char HubName[MAX_HUBNAME_LEN + 1]; // HUB Name + UINT NumUser; // Number of users + RPC_ENUM_USER_ITEM *Users; // User +}; + +// Create, configure, and get the group * +struct RPC_SET_GROUP +{ + char HubName[MAX_HUBNAME_LEN + 1]; // HUB Name + char Name[MAX_USERNAME_LEN + 1]; // User name + wchar_t Realname[MAX_SIZE]; // Real name + wchar_t Note[MAX_SIZE]; // Note + TRAFFIC Traffic; // Traffic data + POLICY *Policy; // Policy +}; + +// Enumeration items in the group +struct RPC_ENUM_GROUP_ITEM +{ + char Name[MAX_USERNAME_LEN + 1]; // User name + wchar_t Realname[MAX_SIZE]; // Real name + wchar_t Note[MAX_SIZE]; // Note + UINT NumUsers; // Number of users + bool DenyAccess; // Access denied +}; + +// Group enumeration +struct RPC_ENUM_GROUP +{ + char HubName[MAX_HUBNAME_LEN + 1]; // HUB Name + UINT NumGroup; // Number of groups + RPC_ENUM_GROUP_ITEM *Groups; // Group +}; + +// Deleting a user or group +struct RPC_DELETE_USER +{ + char HubName[MAX_HUBNAME_LEN + 1]; // HUB Name + char Name[MAX_USERNAME_LEN + 1]; // User or group name +}; + +// Enumeration items of session +struct RPC_ENUM_SESSION_ITEM +{ + char Name[MAX_SESSION_NAME_LEN + 1]; // Session name + bool RemoteSession; // Remote session + char RemoteHostname[MAX_HOST_NAME_LEN + 1]; // Remote server name + char Username[MAX_USERNAME_LEN + 1]; // User name + UINT Ip; // IP address (IPv4) + IP ClientIP; // IP address (IPv4 / IPv6) + char Hostname[MAX_HOST_NAME_LEN + 1]; // Host name + UINT MaxNumTcp; // Maximum number of TCP connections + UINT CurrentNumTcp; // Number of currentl TCP connections + UINT64 PacketSize; // Packet size + UINT64 PacketNum; // Number of packets + bool LinkMode; // Link mode + bool SecureNATMode; // SecureNAT mode + bool BridgeMode; // Bridge mode + bool Layer3Mode; // Layer 3 mode + bool Client_BridgeMode; // Client is bridge mode + bool Client_MonitorMode; // Client is monitoring mode + UINT VLanId; // VLAN ID + UCHAR UniqueId[16]; // Unique ID + bool IsDormantEnabled; // Is the dormant state enabled + bool IsDormant; // Is in the dormant state + UINT64 LastCommDormant; // Last comm interval in the dormant state + UINT64 CreatedTime; // Creation date and time + UINT64 LastCommTime; // Last communication date and time +}; + +// Disconnect the session +struct RPC_DELETE_SESSION +{ + char HubName[MAX_HUBNAME_LEN + 1]; // HUB Name + char Name[MAX_SESSION_NAME_LEN + 1]; // Session name +}; + +// Enumeration items of the MAC table +struct RPC_ENUM_MAC_TABLE_ITEM +{ + UINT Key; // Key + char SessionName[MAX_SESSION_NAME_LEN + 1]; // Session name + UCHAR MacAddress[6]; // MAC address + UCHAR Padding[2]; + UINT64 CreatedTime; // Creation date and time + UINT64 UpdatedTime; // Updating date + bool RemoteItem; // Remote items + char RemoteHostname[MAX_HOST_NAME_LEN + 1]; // Remote host name + UINT VlanId; // VLAN ID +}; + +// Enumeration of the MAC table +struct RPC_ENUM_MAC_TABLE +{ + char HubName[MAX_HUBNAME_LEN + 1]; // HUB Name + UINT NumMacTable; // Number of tables + RPC_ENUM_MAC_TABLE_ITEM *MacTables; // MAC table +}; + +// Enumeration items of IP table +struct RPC_ENUM_IP_TABLE_ITEM +{ + UINT Key; // Key + char SessionName[MAX_SESSION_NAME_LEN + 1]; // Session name + UINT Ip; // IPv4 address + IP IpV6; // IPv6 address + IP IpAddress; // IPv4 / IPv6 Address + bool DhcpAllocated; // Assigned by the DHCP + UINT64 CreatedTime; // Creation date and time + UINT64 UpdatedTime; // Updating date + bool RemoteItem; // Remote items + char RemoteHostname[MAX_HOST_NAME_LEN + 1]; // Remote host name +}; + +// Enumeration of IP table +struct RPC_ENUM_IP_TABLE +{ + char HubName[MAX_HUBNAME_LEN + 1]; // HUB Name + UINT NumIpTable; // Number of tables + RPC_ENUM_IP_TABLE_ITEM *IpTables; // MAC table +}; + +// Delete the table +struct RPC_DELETE_TABLE +{ + char HubName[MAX_HUBNAME_LEN + 1]; // HUB Name + UINT Key; // Key +}; + +// KEEP setting +struct RPC_KEEP +{ + bool UseKeepConnect; // Keep connected to the Internet + char KeepConnectHost[MAX_HOST_NAME_LEN + 1]; // Host name + UINT KeepConnectPort; // Port number + UINT KeepConnectProtocol; // Protocol + UINT KeepConnectInterval; // Interval +}; + +// Ethernet enumeration item +struct RPC_ENUM_ETH_ITEM +{ + char DeviceName[MAX_SIZE]; // Device name + wchar_t NetworkConnectionName[MAX_SIZE];// Network connection name +}; + +// Ethernet enumeration +struct RPC_ENUM_ETH +{ + UINT NumItem; // Number of items + RPC_ENUM_ETH_ITEM *Items; // Item +}; + +// Bridge item +struct RPC_LOCALBRIDGE +{ + char DeviceName[MAX_SIZE]; // Device name + char HubName[MAX_HUBNAME_LEN + 1]; // HUB Name + bool Online; // Online flag + bool Active; // Running flag + bool TapMode; // Tap mode +}; + +// Bridge enumeration +struct RPC_ENUM_LOCALBRIDGE +{ + UINT NumItem; // Number of items + RPC_LOCALBRIDGE *Items; // Item +}; + +// Bridge support information +struct RPC_BRIDGE_SUPPORT +{ + bool IsBridgeSupportedOs; // Whether the OS supports the bridge + bool IsWinPcapNeeded; // Whether WinPcap is necessary +}; + +// Config operation +struct RPC_CONFIG +{ + char FileName[MAX_PATH]; // File name + char *FileData; // File data +}; + +// Administration options list +struct RPC_ADMIN_OPTION +{ + char HubName[MAX_HUBNAME_LEN + 1]; // Virtual HUB name + UINT NumItem; // Count + ADMIN_OPTION *Items; // Data +}; + +// Layer-3 switch +struct RPC_L3SW +{ + char Name[MAX_HUBNAME_LEN + 1]; // L3 switch name +}; + +// Layer-3 switch enumeration +struct RPC_ENUM_L3SW_ITEM +{ + char Name[MAX_HUBNAME_LEN + 1]; // Name + UINT NumInterfaces; // Number of interfaces + UINT NumTables; // Routing table number + bool Active; // In operation + bool Online; // Online +}; +struct RPC_ENUM_L3SW +{ + UINT NumItem; + RPC_ENUM_L3SW_ITEM *Items; +}; + +// Layer-3 interface +struct RPC_L3IF +{ + char Name[MAX_HUBNAME_LEN + 1]; // L3 switch name + char HubName[MAX_HUBNAME_LEN + 1]; // Virtual HUB name + UINT IpAddress; // IP address + UINT SubnetMask; // Subnet mask +}; + +// Layer-3 interface enumeration +struct RPC_ENUM_L3IF +{ + char Name[MAX_HUBNAME_LEN + 1]; // L3 switch name + UINT NumItem; + RPC_L3IF *Items; +}; + +// Routing table +struct RPC_L3TABLE +{ + char Name[MAX_HUBNAME_LEN + 1]; // L3 switch name + UINT NetworkAddress; // Network address + UINT SubnetMask; // Subnet mask + UINT GatewayAddress; // Gateway address + UINT Metric; // Metric +}; + +// Routing table enumeration +struct RPC_ENUM_L3TABLE +{ + char Name[MAX_HUBNAME_LEN + 1]; // L3 switch name + UINT NumItem; + RPC_L3TABLE *Items; +}; + +// CRL entry +struct RPC_CRL +{ + char HubName[MAX_HUBNAME_LEN + 1]; // HUB Name + UINT Key; // Key + CRL *Crl; // CRL body +}; + +// CRL enumeration +struct RPC_ENUM_CRL_ITEM +{ + UINT Key; // Key + wchar_t CrlInfo[MAX_SIZE]; // Information +}; +struct RPC_ENUM_CRL +{ + char HubName[MAX_HUBNAME_LEN + 1]; // HUB Name + UINT NumItem; // Number of items + RPC_ENUM_CRL_ITEM *Items; // List +}; + +// AC list +struct RPC_AC_LIST +{ + char HubName[MAX_HUBNAME_LEN + 1]; // HUB Name + LIST *o; // List body + bool InternalFlag1; +}; + +// Log file enumeration +struct RPC_ENUM_LOG_FILE_ITEM +{ + char ServerName[MAX_HOST_NAME_LEN + 1]; // Server name + char FilePath[MAX_PATH]; // File Path + UINT FileSize; // File size + UINT64 UpdatedTime; // Updating date +}; +struct RPC_ENUM_LOG_FILE +{ + UINT NumItem; // Number of items + RPC_ENUM_LOG_FILE_ITEM *Items; // List +}; + +// Read a Log file +struct RPC_READ_LOG_FILE +{ + char ServerName[MAX_HOST_NAME_LEN + 1]; // Server name + char FilePath[MAX_PATH]; // File Path + UINT Offset; // Offset + BUF *Buffer; // Buffer +}; + +// Download information +struct DOWNLOAD_PROGRESS +{ + void *Param; // User define data + UINT TotalSize; // The total file size + UINT CurrentSize; // Size which has loaded + UINT ProgressPercent; // Percent Complete +}; + +// Enumerate the license keys +struct RPC_ENUM_LICENSE_KEY_ITEM +{ + UINT Id; // ID + char LicenseKey[LICENSE_KEYSTR_LEN + 1]; // License key + char LicenseId[LICENSE_LICENSEID_STR_LEN + 1]; // License ID + char LicenseName[LICENSE_MAX_PRODUCT_NAME_LEN + 1]; // License name + UINT64 Expires; // Expiration date + UINT Status; // Situation + UINT ProductId; // Product ID + UINT64 SystemId; // System ID + UINT SerialId; // Serial ID +}; +struct RPC_ENUM_LICENSE_KEY +{ + UINT NumItem; // Number of items + RPC_ENUM_LICENSE_KEY_ITEM *Items; // List +}; + +// License status of the server +struct RPC_LICENSE_STATUS +{ + UINT EditionId; // Edition ID + char EditionStr[LICENSE_MAX_PRODUCT_NAME_LEN + 1]; // Edition name + UINT64 SystemId; // System ID + UINT64 SystemExpires; // System expiration date + UINT NumClientConnectLicense; // Maximum number of concurrent client connections + UINT NumBridgeConnectLicense; // Available number of concurrent bridge connections + + // v3.0 + bool NeedSubscription; // Subscription system is enabled + UINT64 SubscriptionExpires; // Subscription expiration date + bool IsSubscriptionExpired; // Whether the subscription is expired + UINT NumUserCreationLicense; // Maximum number of users + bool AllowEnterpriseFunction; // Operation of the enterprise function + UINT64 ReleaseDate; // Release date +}; + +// Enumeration of VLAN support status of physical LAN card +struct RPC_ENUM_ETH_VLAN_ITEM +{ + char DeviceName[MAX_SIZE]; // Device name + char Guid[MAX_SIZE]; // GUID + char DeviceInstanceId[MAX_SIZE]; // Device Instance ID + char DriverName[MAX_SIZE]; // Driver file name + char DriverType[MAX_SIZE]; // Type of driver + bool Support; // Check whether it is supported + bool Enabled; // Whether it is enabled +}; +struct RPC_ENUM_ETH_VLAN +{ + UINT NumItem; // Number of items + RPC_ENUM_ETH_VLAN_ITEM *Items; // List +}; + +// Message +struct RPC_MSG +{ + char HubName[MAX_HUBNAME_LEN + 1]; // HUB Name + wchar_t *Msg; // Message +}; + +// EtherIP setting list +struct RPC_ENUM_ETHERIP_ID +{ + UINT NumItem; + ETHERIP_ID *IdList; +}; + +// Set the special listener +struct RPC_SPECIAL_LISTENER +{ + bool VpnOverIcmpListener; // VPN over ICMP + bool VpnOverDnsListener; // VPN over DNS +}; + +// Get / Set the Azure state +struct RPC_AZURE_STATUS +{ + bool IsEnabled; // Whether enabled + bool IsConnected; // Whether it's connected +}; + +// Constants +#define ADMIN_RPC_MAX_POST_SIZE_BY_SERVER_ADMIN MAX_PACK_SIZE +#define ADMIN_RPC_MAX_POST_SIZE_BY_HUB_ADMIN (8 * 1024 * 1024) + + +// Function prototype +UINT AdminAccept(CONNECTION *c, PACK *p); +void HashAdminPassword(void *hash, char *password); +SESSION *AdminConnectMain(CEDAR *cedar, CLIENT_OPTION *o, char *hubname, void *hashed_password, UINT *err, char *client_name, void *hWnd, bool *empty_password); +RPC *AdminConnectEx(CEDAR *cedar, CLIENT_OPTION *o, char *hubname, void *hashed_password, UINT *err, char *client_name); +RPC *AdminConnectEx2(CEDAR *cedar, CLIENT_OPTION *o, char *hubname, void *hashed_password, UINT *err, char *client_name, void *hWnd); +void AdminDisconnect(RPC *rpc); +UINT AdminReconnect(RPC *rpc); +UINT AdminCheckPassword(CEDAR *c, void *random, void *secure_password, char *hubname, bool accept_empty_password, bool *is_password_empty); +PACK *AdminDispatch(RPC *rpc, char *name, PACK *p); +PACK *AdminCall(RPC *rpc, char *function_name, PACK *p); +void SiEnumLocalSession(SERVER *s, char *hubname, RPC_ENUM_SESSION *t); +void CopyOsInfo(OS_INFO *dst, OS_INFO *info); +CAPSLIST *ScGetCapsEx(RPC *rpc); +UINT SiEnumMacTable(SERVER *s, char *hubname, RPC_ENUM_MAC_TABLE *t); +UINT SiEnumIpTable(SERVER *s, char *hubname, RPC_ENUM_IP_TABLE *t); +void SiEnumLocalLogFileList(SERVER *s, char *hubname, RPC_ENUM_LOG_FILE *t); +void SiReadLocalLogFile(SERVER *s, char *filepath, UINT offset, RPC_READ_LOG_FILE *t); +typedef bool (DOWNLOAD_PROC)(DOWNLOAD_PROGRESS *progress); +BUF *DownloadFileFromServer(RPC *r, char *server_name, char *filepath, UINT total_size, DOWNLOAD_PROC *proc, void *param); +bool CheckAdminSourceAddress(SOCK *sock, char *hubname); +void SiEnumSessionMain(SERVER *s, RPC_ENUM_SESSION *t); +bool SiIsEmptyPassword(void *hash_password); +void JsonRpcProcPost(CONNECTION *c, SOCK *s, HTTP_HEADER *h, UINT post_data_size); +void JsonRpcProcGet(CONNECTION *c, SOCK *s, HTTP_HEADER *h, char *url_target); +void JsonRpcProcOptions(CONNECTION *c, SOCK *s, HTTP_HEADER *h, char *url_target); +JSON_VALUE *JsonRpcProcRequestObject(ADMIN *admin, CONNECTION *c, SOCK *s, JSON_VALUE *json_req, char *method_name); +JSON_VALUE *JsonRpcNewError(int code, wchar_t *message); +JSON_VALUE *JsonRpcNewResponse(PACK *p); +bool HttpParseBasicAuthHeader(HTTP_HEADER *h, char *username, UINT username_size, char *password, UINT password_size); +ADMIN *JsonRpcAuthLogin(CEDAR *c, SOCK *sock, HTTP_HEADER *h); +JSON_VALUE *QueryStringToJsonListValue(char *qs); +JSON_VALUE *ConstructDummyJsonRpcRequest(char *method_name, JSON_VALUE *p); +void AdminWebProcPost(CONNECTION *c, SOCK *s, HTTP_HEADER *h, UINT post_data_size, char *url_target); +void AdminWebProcGet(CONNECTION *c, SOCK *s, HTTP_HEADER *h, char *url_target); +bool AdminWebHandleFileRequest(ADMIN *a, CONNECTION *c, SOCK *s, HTTP_HEADER *h, char *url_src, char *query_string, char *virtual_root_dir, char *physical_root_dir); +BUF *AdminWebProcessServerSideInclude(BUF *src_txt, char *filename, UINT depth); +bool AdminWebSendBody(SOCK *s, UINT status_code, char *status_string, UCHAR *data, UINT data_size, char *content_type, char *add_header_name, char *add_header_value, HTTP_HEADER *request_headers); +bool AdminWebSend404Error(SOCK *s, HTTP_HEADER *request_headers); +bool AdminWebSend302Redirect(SOCK *s, char *url, char *query_string, HTTP_HEADER *request_headers); +BUF *AdminWebTryFindAndReadFile(char *vroot, char *proot, char *url, char *ret_filename, UINT ret_filename_size, bool *is_index_html); +BUF *AdminWebTryOneFile(char *filename, char *ret_filename, UINT ret_filename_size); +bool AdminWebSendUnauthorized(SOCK *s, HTTP_HEADER *http_request_headers); + +UINT StTest(ADMIN *a, RPC_TEST *t); +UINT StGetServerInfo(ADMIN *a, RPC_SERVER_INFO *t); +UINT StGetServerStatus(ADMIN *a, RPC_SERVER_STATUS *t); +UINT StCreateListener(ADMIN *a, RPC_LISTENER *t); +UINT StEnumListener(ADMIN *a, RPC_LISTENER_LIST *t); +UINT StDeleteListener(ADMIN *a, RPC_LISTENER *t); +UINT StEnableListener(ADMIN *a, RPC_LISTENER *t); +UINT StSetPortsUDP(ADMIN *a, RPC_PORTS *t); +UINT StGetPortsUDP(ADMIN *a, RPC_PORTS *t); +UINT StGetProtoOptions(ADMIN *a, RPC_PROTO_OPTIONS *t); +UINT StSetProtoOptions(ADMIN *a, RPC_PROTO_OPTIONS *t); +UINT StSetServerPassword(ADMIN *a, RPC_SET_PASSWORD *t); +UINT StSetFarmSetting(ADMIN *a, RPC_FARM *t); +UINT StGetFarmSetting(ADMIN *a, RPC_FARM *t); +UINT StGetFarmInfo(ADMIN *a, RPC_FARM_INFO *t); +UINT StEnumFarmMember(ADMIN *a, RPC_ENUM_FARM *t); +UINT StGetFarmConnectionStatus(ADMIN *a, RPC_FARM_CONNECTION_STATUS *t); +UINT StSetServerCert(ADMIN *a, RPC_KEY_PAIR *t); +UINT StGetServerCert(ADMIN *a, RPC_KEY_PAIR *t); +UINT StGetServerCipherList(ADMIN *a, RPC_STR *t); +UINT StGetServerCipher(ADMIN *a, RPC_STR *t); +UINT StSetServerCipher(ADMIN *a, RPC_STR *t); +UINT StCreateHub(ADMIN *a, RPC_CREATE_HUB *t); +UINT StSetHub(ADMIN *a, RPC_CREATE_HUB *t); +UINT StGetHub(ADMIN *a, RPC_CREATE_HUB *t); +UINT StEnumHub(ADMIN *a, RPC_ENUM_HUB *t); +UINT StDeleteHub(ADMIN *a, RPC_DELETE_HUB *t); +UINT StGetHubRadius(ADMIN *a, RPC_RADIUS *t); +UINT StSetHubRadius(ADMIN *a, RPC_RADIUS *t); +UINT StEnumConnection(ADMIN *a, RPC_ENUM_CONNECTION *t); +UINT StDisconnectConnection(ADMIN *a, RPC_DISCONNECT_CONNECTION *t); +UINT StGetConnectionInfo(ADMIN *a, RPC_CONNECTION_INFO *t); +UINT StSetHubOnline(ADMIN *a, RPC_SET_HUB_ONLINE *t); +UINT StGetHubStatus(ADMIN *a, RPC_HUB_STATUS *t); +UINT StSetHubLog(ADMIN *a, RPC_HUB_LOG *t); +UINT StGetHubLog(ADMIN *a, RPC_HUB_LOG *t); +UINT StAddCa(ADMIN *a, RPC_HUB_ADD_CA *t); +UINT StEnumCa(ADMIN *a, RPC_HUB_ENUM_CA *t); +UINT StGetCa(ADMIN *a, RPC_HUB_GET_CA *t); +UINT StDeleteCa(ADMIN *a, RPC_HUB_DELETE_CA *t); +UINT StCreateLink(ADMIN *a, RPC_CREATE_LINK *t); +UINT StEnumLink(ADMIN *a, RPC_ENUM_LINK *t); +UINT StGetLinkStatus(ADMIN *a, RPC_LINK_STATUS *t); +UINT StSetLinkOnline(ADMIN *a, RPC_LINK *t); +UINT StSetLinkOffline(ADMIN *a, RPC_LINK *t); +UINT StDeleteLink(ADMIN *a, RPC_LINK *t); +UINT StRenameLink(ADMIN *a, RPC_RENAME_LINK *t); +UINT StAddAccess(ADMIN *a, RPC_ADD_ACCESS *t); +UINT StDeleteAccess(ADMIN *a, RPC_DELETE_ACCESS *t); +UINT StEnumAccess(ADMIN *a, RPC_ENUM_ACCESS_LIST *t); +UINT StCreateUser(ADMIN *a, RPC_SET_USER *t); +UINT StSetUser(ADMIN *a, RPC_SET_USER *t); +UINT StGetUser(ADMIN *a, RPC_SET_USER *t); +UINT StDeleteUser(ADMIN *a, RPC_DELETE_USER *t); +UINT StEnumUser(ADMIN *a, RPC_ENUM_USER *t); +UINT StCreateGroup(ADMIN *a, RPC_SET_GROUP *t); +UINT StSetGroup(ADMIN *a, RPC_SET_GROUP *t); +UINT StGetGroup(ADMIN *a, RPC_SET_GROUP *t); +UINT StDeleteGroup(ADMIN *a, RPC_DELETE_USER *t); +UINT StEnumGroup(ADMIN *a, RPC_ENUM_GROUP *t); +UINT StEnumSession(ADMIN *a, RPC_ENUM_SESSION *t); +UINT StGetSessionStatus(ADMIN *a, RPC_SESSION_STATUS *t); +UINT StDeleteSession(ADMIN *a, RPC_DELETE_SESSION *t); +UINT StEnumMacTable(ADMIN *a, RPC_ENUM_MAC_TABLE *t); +UINT StDeleteMacTable(ADMIN *a, RPC_DELETE_TABLE *t); +UINT StEnumIpTable(ADMIN *a, RPC_ENUM_IP_TABLE *t); +UINT StDeleteIpTable(ADMIN *a, RPC_DELETE_TABLE *t); +UINT StGetLink(ADMIN *a, RPC_CREATE_LINK *t); +UINT StSetLink(ADMIN *a, RPC_CREATE_LINK *t); +UINT StSetAccessList(ADMIN *a, RPC_ENUM_ACCESS_LIST *t); +UINT StSetKeep(ADMIN *a, RPC_KEEP *t); +UINT StGetKeep(ADMIN *a, RPC_KEEP *t); +UINT StEnableSecureNAT(ADMIN *a, RPC_HUB *t); +UINT StDisableSecureNAT(ADMIN *a, RPC_HUB *t); +UINT StSetSecureNATOption(ADMIN *a, VH_OPTION *t); +UINT StGetSecureNATOption(ADMIN *a, VH_OPTION *t); +UINT StEnumNAT(ADMIN *a, RPC_ENUM_NAT *t); +UINT StEnumDHCP(ADMIN *a, RPC_ENUM_DHCP *t); +UINT StGetSecureNATStatus(ADMIN *a, RPC_NAT_STATUS *t); +UINT StEnumEthernet(ADMIN *a, RPC_ENUM_ETH *t); +UINT StAddLocalBridge(ADMIN *a, RPC_LOCALBRIDGE *t); +UINT StDeleteLocalBridge(ADMIN *a, RPC_LOCALBRIDGE *t); +UINT StEnumLocalBridge(ADMIN *a, RPC_ENUM_LOCALBRIDGE *t); +UINT StGetBridgeSupport(ADMIN *a, RPC_BRIDGE_SUPPORT *t); +UINT StRebootServer(ADMIN *a, RPC_TEST *t); +UINT StGetCaps(ADMIN *a, CAPSLIST *t); +UINT StGetConfig(ADMIN *a, RPC_CONFIG *t); +UINT StSetConfig(ADMIN *a, RPC_CONFIG *t); +UINT StGetDefaultHubAdminOptions(ADMIN *a, RPC_ADMIN_OPTION *t); +UINT StGetHubAdminOptions(ADMIN *a, RPC_ADMIN_OPTION *t); +UINT StSetHubAdminOptions(ADMIN *a, RPC_ADMIN_OPTION *t); +UINT StGetHubExtOptions(ADMIN *a, RPC_ADMIN_OPTION *t); +UINT StSetHubExtOptions(ADMIN *a, RPC_ADMIN_OPTION *t); +UINT StAddL3Switch(ADMIN *a, RPC_L3SW *t); +UINT StDelL3Switch(ADMIN *a, RPC_L3SW *t); +UINT StEnumL3Switch(ADMIN *a, RPC_ENUM_L3SW *t); +UINT StStartL3Switch(ADMIN *a, RPC_L3SW *t); +UINT StStopL3Switch(ADMIN *a, RPC_L3SW *t); +UINT StAddL3If(ADMIN *a, RPC_L3IF *t); +UINT StDelL3If(ADMIN *a, RPC_L3IF *t); +UINT StEnumL3If(ADMIN *a, RPC_ENUM_L3IF *t); +UINT StAddL3Table(ADMIN *a, RPC_L3TABLE *t); +UINT StDelL3Table(ADMIN *a, RPC_L3TABLE *t); +UINT StEnumL3Table(ADMIN *a, RPC_ENUM_L3TABLE *t); +UINT StEnumCrl(ADMIN *a, RPC_ENUM_CRL *t); +UINT StAddCrl(ADMIN *a, RPC_CRL *t); +UINT StDelCrl(ADMIN *a, RPC_CRL *t); +UINT StGetCrl(ADMIN *a, RPC_CRL *t); +UINT StSetCrl(ADMIN *a, RPC_CRL *t); +UINT StSetAcList(ADMIN *a, RPC_AC_LIST *t); +UINT StGetAcList(ADMIN *a, RPC_AC_LIST *t); +UINT StEnumLogFile(ADMIN *a, RPC_ENUM_LOG_FILE *t); +UINT StReadLogFile(ADMIN *a, RPC_READ_LOG_FILE *t); +UINT StAddLicenseKey(ADMIN *a, RPC_TEST *t); +UINT StDelLicenseKey(ADMIN *a, RPC_TEST *t); +UINT StEnumLicenseKey(ADMIN *a, RPC_ENUM_LICENSE_KEY *t); +UINT StGetLicenseStatus(ADMIN *a, RPC_LICENSE_STATUS *t); +UINT StSetSysLog(ADMIN *a, SYSLOG_SETTING *t); +UINT StGetSysLog(ADMIN *a, SYSLOG_SETTING *t); +UINT StEnumEthVLan(ADMIN *a, RPC_ENUM_ETH_VLAN *t); +UINT StSetEnableEthVLan(ADMIN *a, RPC_TEST *t); +UINT StSetHubMsg(ADMIN *a, RPC_MSG *t); +UINT StGetHubMsg(ADMIN *a, RPC_MSG *t); +UINT StCrash(ADMIN *a, RPC_TEST *t); +UINT StGetAdminMsg(ADMIN *a, RPC_MSG *t); +UINT StFlush(ADMIN *a, RPC_TEST *t); +UINT StDebug(ADMIN *a, RPC_TEST *t); +UINT StSetIPsecServices(ADMIN *a, IPSEC_SERVICES *t); +UINT StGetIPsecServices(ADMIN *a, IPSEC_SERVICES *t); +UINT StAddEtherIpId(ADMIN *a, ETHERIP_ID *t); +UINT StGetEtherIpId(ADMIN *a, ETHERIP_ID *t); +UINT StDeleteEtherIpId(ADMIN *a, ETHERIP_ID *t); +UINT StEnumEtherIpId(ADMIN *a, RPC_ENUM_ETHERIP_ID *t); +UINT StSetOpenVpnSstpConfig(ADMIN *a, OPENVPN_SSTP_CONFIG *t); +UINT StGetOpenVpnSstpConfig(ADMIN *a, OPENVPN_SSTP_CONFIG *t); +UINT StGetDDnsClientStatus(ADMIN *a, DDNS_CLIENT_STATUS *t); +UINT StChangeDDnsClientHostname(ADMIN *a, RPC_TEST *t); +UINT StRegenerateServerCert(ADMIN *a, RPC_TEST *t); +UINT StMakeOpenVpnConfigFile(ADMIN *a, RPC_READ_LOG_FILE *t); +UINT StSetSpecialListener(ADMIN *a, RPC_SPECIAL_LISTENER *t); +UINT StGetSpecialListener(ADMIN *a, RPC_SPECIAL_LISTENER *t); +UINT StGetAzureStatus(ADMIN *a, RPC_AZURE_STATUS *t); +UINT StSetAzureStatus(ADMIN *a, RPC_AZURE_STATUS *t); +UINT StGetDDnsInternetSetting(ADMIN *a, INTERNET_SETTING *t); +UINT StSetDDnsInternetSetting(ADMIN *a, INTERNET_SETTING *t); +UINT StSetVgsConfig(ADMIN *a, VGS_CONFIG *t); +UINT StGetVgsConfig(ADMIN *a, VGS_CONFIG *t); + +UINT ScTest(RPC *r, RPC_TEST *t); +UINT ScGetServerInfo(RPC *r, RPC_SERVER_INFO *t); +UINT ScGetServerStatus(RPC *r, RPC_SERVER_STATUS *t); +UINT ScCreateListener(RPC *r, RPC_LISTENER *t); +UINT ScEnumListener(RPC *r, RPC_LISTENER_LIST *t); +UINT ScDeleteListener(RPC *r, RPC_LISTENER *t); +UINT ScEnableListener(RPC *r, RPC_LISTENER *t); +UINT ScSetPortsUDP(RPC *r, RPC_PORTS *t); +UINT ScGetPortsUDP(RPC *r, RPC_PORTS *t); +UINT ScSetProtoOptions(RPC *r, RPC_PROTO_OPTIONS *t); +UINT ScGetProtoOptions(RPC *r, RPC_PROTO_OPTIONS *t); +UINT ScSetServerPassword(RPC *r, RPC_SET_PASSWORD *t); +UINT ScSetFarmSetting(RPC *r, RPC_FARM *t); +UINT ScGetFarmSetting(RPC *r, RPC_FARM *t); +UINT ScGetFarmInfo(RPC *r, RPC_FARM_INFO *t); +UINT ScEnumFarmMember(RPC *r, RPC_ENUM_FARM *t); +UINT ScGetFarmConnectionStatus(RPC *r, RPC_FARM_CONNECTION_STATUS *t); +UINT ScSetServerCert(RPC *r, RPC_KEY_PAIR *t); +UINT ScGetServerCert(RPC *r, RPC_KEY_PAIR *t); +UINT ScGetServerCipherList(RPC *r, RPC_STR *t); +UINT ScGetServerCipher(RPC *r, RPC_STR *t); +UINT ScSetServerCipher(RPC *r, RPC_STR *t); +UINT ScCreateHub(RPC *r, RPC_CREATE_HUB *t); +UINT ScSetHub(RPC *r, RPC_CREATE_HUB *t); +UINT ScGetHub(RPC *r, RPC_CREATE_HUB *t); +UINT ScEnumHub(RPC *r, RPC_ENUM_HUB *t); +UINT ScDeleteHub(RPC *r, RPC_DELETE_HUB *t); +UINT ScGetHubRadius(RPC *r, RPC_RADIUS *t); +UINT ScSetHubRadius(RPC *r, RPC_RADIUS *t); +UINT ScEnumConnection(RPC *r, RPC_ENUM_CONNECTION *t); +UINT ScDisconnectConnection(RPC *r, RPC_DISCONNECT_CONNECTION *t); +UINT ScGetConnectionInfo(RPC *r, RPC_CONNECTION_INFO *t); +UINT ScSetHubOnline(RPC *r, RPC_SET_HUB_ONLINE *t); +UINT ScGetHubStatus(RPC *r, RPC_HUB_STATUS *t); +UINT ScSetHubLog(RPC *r, RPC_HUB_LOG *t); +UINT ScGetHubLog(RPC *r, RPC_HUB_LOG *t); +UINT ScAddCa(RPC *r, RPC_HUB_ADD_CA *t); +UINT ScEnumCa(RPC *r, RPC_HUB_ENUM_CA *t); +UINT ScGetCa(RPC *r, RPC_HUB_GET_CA *t); +UINT ScDeleteCa(RPC *r, RPC_HUB_DELETE_CA *t); +UINT ScCreateLink(RPC *r, RPC_CREATE_LINK *t); +UINT ScEnumLink(RPC *r, RPC_ENUM_LINK *t); +UINT ScGetLinkStatus(RPC *r, RPC_LINK_STATUS *t); +UINT ScSetLinkOnline(RPC *r, RPC_LINK *t); +UINT ScSetLinkOffline(RPC *r, RPC_LINK *t); +UINT ScDeleteLink(RPC *r, RPC_LINK *t); +UINT ScRenameLink(RPC *r, RPC_RENAME_LINK *t); +UINT ScAddAccess(RPC *r, RPC_ADD_ACCESS *t); +UINT ScDeleteAccess(RPC *r, RPC_DELETE_ACCESS *t); +UINT ScEnumAccess(RPC *r, RPC_ENUM_ACCESS_LIST *t); +UINT ScCreateUser(RPC *r, RPC_SET_USER *t); +UINT ScSetUser(RPC *r, RPC_SET_USER *t); +UINT ScGetUser(RPC *r, RPC_SET_USER *t); +UINT ScDeleteUser(RPC *r, RPC_DELETE_USER *t); +UINT ScEnumUser(RPC *r, RPC_ENUM_USER *t); +UINT ScCreateGroup(RPC *r, RPC_SET_GROUP *t); +UINT ScSetGroup(RPC *r, RPC_SET_GROUP *t); +UINT ScGetGroup(RPC *r, RPC_SET_GROUP *t); +UINT ScDeleteGroup(RPC *r, RPC_DELETE_USER *t); +UINT ScEnumGroup(RPC *r, RPC_ENUM_GROUP *t); +UINT ScEnumSession(RPC *r, RPC_ENUM_SESSION *t); +UINT ScGetSessionStatus(RPC *r, RPC_SESSION_STATUS *t); +UINT ScDeleteSession(RPC *r, RPC_DELETE_SESSION *t); +UINT ScEnumMacTable(RPC *r, RPC_ENUM_MAC_TABLE *t); +UINT ScDeleteMacTable(RPC *r, RPC_DELETE_TABLE *t); +UINT ScEnumIpTable(RPC *r, RPC_ENUM_IP_TABLE *t); +UINT ScDeleteIpTable(RPC *r, RPC_DELETE_TABLE *t); +UINT ScGetLink(RPC *a, RPC_CREATE_LINK *t); +UINT ScSetLink(RPC *a, RPC_CREATE_LINK *t); +UINT ScSetAccessList(RPC *r, RPC_ENUM_ACCESS_LIST *t); +UINT ScSetKeep(RPC *r, RPC_KEEP *t); +UINT ScGetKeep(RPC *r, RPC_KEEP *t); +UINT ScEnableSecureNAT(RPC *r, RPC_HUB *t); +UINT ScDisableSecureNAT(RPC *r, RPC_HUB *t); +UINT ScSetSecureNATOption(RPC *r, VH_OPTION *t); +UINT ScGetSecureNATOption(RPC *r, VH_OPTION *t); +UINT ScEnumNAT(RPC *r, RPC_ENUM_NAT *t); +UINT ScEnumDHCP(RPC *r, RPC_ENUM_DHCP *t); +UINT ScGetSecureNATStatus(RPC *r, RPC_NAT_STATUS *t); +UINT ScEnumEthernet(RPC *r, RPC_ENUM_ETH *t); +UINT ScAddLocalBridge(RPC *r, RPC_LOCALBRIDGE *t); +UINT ScDeleteLocalBridge(RPC *r, RPC_LOCALBRIDGE *t); +UINT ScEnumLocalBridge(RPC *r, RPC_ENUM_LOCALBRIDGE *t); +UINT ScGetBridgeSupport(RPC *r, RPC_BRIDGE_SUPPORT *t); +UINT ScRebootServer(RPC *r, RPC_TEST *t); +UINT ScGetCaps(RPC *r, CAPSLIST *t); +UINT ScGetConfig(RPC *r, RPC_CONFIG *t); +UINT ScSetConfig(RPC *r, RPC_CONFIG *t); +UINT ScGetDefaultHubAdminOptions(RPC *r, RPC_ADMIN_OPTION *t); +UINT ScGetHubAdminOptions(RPC *r, RPC_ADMIN_OPTION *t); +UINT ScSetHubAdminOptions(RPC *r, RPC_ADMIN_OPTION *t); +UINT ScGetHubExtOptions(RPC *r, RPC_ADMIN_OPTION *t); +UINT ScSetHubExtOptions(RPC *r, RPC_ADMIN_OPTION *t); +UINT ScAddL3Switch(RPC *r, RPC_L3SW *t); +UINT ScDelL3Switch(RPC *r, RPC_L3SW *t); +UINT ScEnumL3Switch(RPC *r, RPC_ENUM_L3SW *t); +UINT ScStartL3Switch(RPC *r, RPC_L3SW *t); +UINT ScStopL3Switch(RPC *r, RPC_L3SW *t); +UINT ScAddL3If(RPC *r, RPC_L3IF *t); +UINT ScDelL3If(RPC *r, RPC_L3IF *t); +UINT ScEnumL3If(RPC *r, RPC_ENUM_L3IF *t); +UINT ScAddL3Table(RPC *r, RPC_L3TABLE *t); +UINT ScDelL3Table(RPC *r, RPC_L3TABLE *t); +UINT ScEnumL3Table(RPC *r, RPC_ENUM_L3TABLE *t); +UINT ScEnumCrl(RPC *r, RPC_ENUM_CRL *t); +UINT ScAddCrl(RPC *r, RPC_CRL *t); +UINT ScDelCrl(RPC *r, RPC_CRL *t); +UINT ScGetCrl(RPC *r, RPC_CRL *t); +UINT ScSetCrl(RPC *r, RPC_CRL *t); +UINT ScSetAcList(RPC *r, RPC_AC_LIST *t); +UINT ScGetAcList(RPC *r, RPC_AC_LIST *t); +UINT ScEnumLogFile(RPC *r, RPC_ENUM_LOG_FILE *t); +UINT ScReadLogFile(RPC *r, RPC_READ_LOG_FILE *t); +UINT ScAddLicenseKey(RPC *r, RPC_TEST *t); +UINT ScDelLicenseKey(RPC *r, RPC_TEST *t); +UINT ScEnumLicenseKey(RPC *r, RPC_ENUM_LICENSE_KEY *t); +UINT ScGetLicenseStatus(RPC *r, RPC_LICENSE_STATUS *t); +UINT ScSetSysLog(RPC *r, SYSLOG_SETTING *t); +UINT ScGetSysLog(RPC *r, SYSLOG_SETTING *t); +UINT ScEnumEthVLan(RPC *r, RPC_ENUM_ETH_VLAN *t); +UINT ScSetEnableEthVLan(RPC *r, RPC_TEST *t); +UINT ScSetHubMsg(RPC *r, RPC_MSG *t); +UINT ScGetHubMsg(RPC *r, RPC_MSG *t); +UINT ScCrash(RPC *r, RPC_TEST *t); +UINT ScGetAdminMsg(RPC *r, RPC_MSG *t); +UINT ScFlush(RPC *r, RPC_TEST *t); +UINT ScDebug(RPC *r, RPC_TEST *t); +UINT ScSetIPsecServices(RPC *r, IPSEC_SERVICES *t); +UINT ScGetIPsecServices(RPC *r, IPSEC_SERVICES *t); +UINT ScAddEtherIpId(RPC *r, ETHERIP_ID *t); +UINT ScGetEtherIpId(RPC *r, ETHERIP_ID *t); +UINT ScDeleteEtherIpId(RPC *r, ETHERIP_ID *t); +UINT ScEnumEtherIpId(RPC *r, RPC_ENUM_ETHERIP_ID *t); +UINT ScSetOpenVpnSstpConfig(RPC *r, OPENVPN_SSTP_CONFIG *t); +UINT ScGetOpenVpnSstpConfig(RPC *r, OPENVPN_SSTP_CONFIG *t); +UINT ScGetDDnsClientStatus(RPC *r, DDNS_CLIENT_STATUS *t); +UINT ScChangeDDnsClientHostname(RPC *r, RPC_TEST *t); +UINT ScRegenerateServerCert(RPC *r, RPC_TEST *t); +UINT ScMakeOpenVpnConfigFile(RPC *r, RPC_READ_LOG_FILE *t); +UINT ScSetSpecialListener(RPC *r, RPC_SPECIAL_LISTENER *t); +UINT ScGetSpecialListener(RPC *r, RPC_SPECIAL_LISTENER *t); +UINT ScGetAzureStatus(RPC *r, RPC_AZURE_STATUS *t); +UINT ScSetAzureStatus(RPC *r, RPC_AZURE_STATUS *t); +UINT ScGetDDnsInternetSetting(RPC *r, INTERNET_SETTING *t); +UINT ScSetDDnsInternetSetting(RPC *r, INTERNET_SETTING *t); +UINT ScSetVgsConfig(RPC *r, VGS_CONFIG *t); +UINT ScGetVgsConfig(RPC *r, VGS_CONFIG *t); + +void InRpcTest(RPC_TEST *t, PACK *p); +void OutRpcTest(PACK *p, RPC_TEST *t); +void FreeRpcTest(RPC_TEST *t); +void InRpcServerInfo(RPC_SERVER_INFO *t, PACK *p); +void OutRpcServerInfo(PACK *p, RPC_SERVER_INFO *t); +void FreeRpcServerInfo(RPC_SERVER_INFO *t); +void InRpcServerStatus(RPC_SERVER_STATUS *t, PACK *p); +void OutRpcServerStatus(PACK *p, RPC_SERVER_STATUS *t); +void InRpcListener(RPC_LISTENER *t, PACK *p); +void OutRpcListener(PACK *p, RPC_LISTENER *t); +void InRpcListenerList(RPC_LISTENER_LIST *t, PACK *p); +void OutRpcListenerList(PACK *p, RPC_LISTENER_LIST *t); +void FreeRpcListenerList(RPC_LISTENER_LIST *t); +void InRpcPorts(RPC_PORTS *t, PACK *p); +void OutRpcPorts(PACK *p, RPC_PORTS *t); +void FreeRpcPorts(RPC_PORTS *t); +void InRpcStr(RPC_STR *t, PACK *p); +void OutRpcStr(PACK *p, RPC_STR *t); +void FreeRpcStr(RPC_STR *t); +void InRpcProtoOptions(RPC_PROTO_OPTIONS *t, PACK *p); +void OutRpcProtoOptions(PACK *p, RPC_PROTO_OPTIONS *t); +void FreeRpcProtoOptions(RPC_PROTO_OPTIONS *t); +void InRpcSetPassword(RPC_SET_PASSWORD *t, PACK *p); +void OutRpcSetPassword(PACK *p, RPC_SET_PASSWORD *t); +void InRpcFarm(RPC_FARM *t, PACK *p); +void OutRpcFarm(PACK *p, RPC_FARM *t); +void FreeRpcFarm(RPC_FARM *t); +void InRpcFarmHub(RPC_FARM_HUB *t, PACK *p); +void OutRpcFarmHub(PACK *p, RPC_FARM_HUB *t); +void InRpcFarmInfo(RPC_FARM_INFO *t, PACK *p); +void OutRpcFarmInfo(PACK *p, RPC_FARM_INFO *t); +void FreeRpcFarmInfo(RPC_FARM_INFO *t); +void InRpcEnumFarm(RPC_ENUM_FARM *t, PACK *p); +void OutRpcEnumFarm(PACK *p, RPC_ENUM_FARM *t); +void FreeRpcEnumFarm(RPC_ENUM_FARM *t); +void InRpcFarmConnectionStatus(RPC_FARM_CONNECTION_STATUS *t, PACK *p); +void OutRpcFarmConnectionStatus(PACK *p, RPC_FARM_CONNECTION_STATUS *t); +void InRpcHubOption(RPC_HUB_OPTION *t, PACK *p); +void OutRpcHubOption(PACK *p, RPC_HUB_OPTION *t); +void InRpcRadius(RPC_RADIUS *t, PACK *p); +void OutRpcRadius(PACK *p, RPC_RADIUS *t); +void InRpcHub(RPC_HUB *t, PACK *p); +void OutRpcHub(PACK *p, RPC_HUB *t); +void InRpcCreateHub(RPC_CREATE_HUB *t, PACK *p); +void OutRpcCreateHub(PACK *p, RPC_CREATE_HUB *t); +void InRpcEnumHub(RPC_ENUM_HUB *t, PACK *p); +void OutRpcEnumHub(PACK *p, RPC_ENUM_HUB *t); +void FreeRpcEnumHub(RPC_ENUM_HUB *t); +void InRpcDeleteHub(RPC_DELETE_HUB *t, PACK *p); +void OutRpcDeleteHub(PACK *p, RPC_DELETE_HUB *t); +void InRpcEnumConnection(RPC_ENUM_CONNECTION *t, PACK *p); +void OutRpcEnumConnection(PACK *p, RPC_ENUM_CONNECTION *t); +void FreeRpcEnumConnection(RPC_ENUM_CONNECTION *t); +void InRpcDisconnectConnection(RPC_DISCONNECT_CONNECTION *t, PACK *p); +void OutRpcDisconnectConnection(PACK *p, RPC_DISCONNECT_CONNECTION *t); +void InRpcConnectionInfo(RPC_CONNECTION_INFO *t, PACK *p); +void OutRpcConnectionInfo(PACK *p, RPC_CONNECTION_INFO *t); +void InRpcSetHubOnline(RPC_SET_HUB_ONLINE *t, PACK *p); +void OutRpcSetHubOnline(PACK *p, RPC_SET_HUB_ONLINE *t); +void InRpcHubStatus(RPC_HUB_STATUS *t, PACK *p); +void OutRpcHubStatus(PACK *p, RPC_HUB_STATUS *t); +void InRpcHubLog(RPC_HUB_LOG *t, PACK *p); +void OutRpcHubLog(PACK *p, RPC_HUB_LOG *t); +void InRpcHubAddCa(RPC_HUB_ADD_CA *t, PACK *p); +void OutRpcHubAddCa(PACK *p, RPC_HUB_ADD_CA *t); +void FreeRpcHubAddCa(RPC_HUB_ADD_CA *t); +void InRpcHubEnumCa(RPC_HUB_ENUM_CA *t, PACK *p); +void OutRpcHubEnumCa(PACK *p, RPC_HUB_ENUM_CA *t); +void FreeRpcHubEnumCa(RPC_HUB_ENUM_CA *t); +void InRpcHubGetCa(RPC_HUB_GET_CA *t, PACK *p); +void OutRpcHubGetCa(PACK *p, RPC_HUB_GET_CA *t); +void FreeRpcHubGetCa(RPC_HUB_GET_CA *t); +void InRpcHubDeleteCa(RPC_HUB_DELETE_CA *t, PACK *p); +void OutRpcHubDeleteCa(PACK *p, RPC_HUB_DELETE_CA *t); +void InRpcCreateLink(RPC_CREATE_LINK *t, PACK *p); +void OutRpcCreateLink(PACK *p, RPC_CREATE_LINK *t); +void FreeRpcCreateLink(RPC_CREATE_LINK *t); +void InRpcEnumLink(RPC_ENUM_LINK *t, PACK *p); +void OutRpcEnumLink(PACK *p, RPC_ENUM_LINK *t); +void FreeRpcEnumLink(RPC_ENUM_LINK *t); +void InRpcLinkStatus(RPC_LINK_STATUS *t, PACK *p); +void OutRpcLinkStatus(PACK *p, RPC_LINK_STATUS *t); +void FreeRpcLinkStatus(RPC_LINK_STATUS *t); +void InRpcLink(RPC_LINK *t, PACK *p); +void OutRpcLink(PACK *p, RPC_LINK *t); +void InRpcAccessEx(ACCESS *a, PACK *p, UINT index); +void InRpcAccess(ACCESS *a, PACK *p); +void OutRpcAccessEx(PACK *p, ACCESS *a, UINT index, UINT total); +void OutRpcAccess(PACK *p, ACCESS *a); +void InRpcEnumAccessList(RPC_ENUM_ACCESS_LIST *a, PACK *p); +void OutRpcEnumAccessList(PACK *p, RPC_ENUM_ACCESS_LIST *a); +void FreeRpcEnumAccessList(RPC_ENUM_ACCESS_LIST *a); +void *InRpcAuthData(PACK *p, UINT *authtype, char *username); +void OutRpcAuthData(PACK *p, void *authdata, UINT authtype); +void FreeRpcAuthData(void *authdata, UINT authtype); +void InRpcSetUser(RPC_SET_USER *t, PACK *p); +void OutRpcSetUser(PACK *p, RPC_SET_USER *t); +void FreeRpcSetUser(RPC_SET_USER *t); +void InRpcEnumUser(RPC_ENUM_USER *t, PACK *p); +void OutRpcEnumUser(PACK *p, RPC_ENUM_USER *t); +void FreeRpcEnumUser(RPC_ENUM_USER *t); +void InRpcSetGroup(RPC_SET_GROUP *t, PACK *p); +void OutRpcSetGroup(PACK *p, RPC_SET_GROUP *t); +void InRpcEnumGroup(RPC_ENUM_GROUP *t, PACK *p); +void OutRpcEnumGroup(PACK *p, RPC_ENUM_GROUP *t); +void FreeRpcEnumGroup(RPC_ENUM_GROUP *t); +void InRpcDeleteUser(RPC_DELETE_USER *t, PACK *p); +void OutRpcDeleteUser(PACK *p, RPC_DELETE_USER *t); +void InRpcEnumSession(RPC_ENUM_SESSION *t, PACK *p); +void OutRpcEnumSession(PACK *p, RPC_ENUM_SESSION *t); +void FreeRpcEnumSession(RPC_ENUM_SESSION *t); +void InRpcNodeInfo(NODE_INFO *t, PACK *p); +void OutRpcNodeInfo(PACK *p, NODE_INFO *t); +void InRpcSessionStatus(RPC_SESSION_STATUS *t, PACK *p); +void OutRpcSessionStatus(PACK *p, RPC_SESSION_STATUS *t); +void FreeRpcSessionStatus(RPC_SESSION_STATUS *t); +void InRpcDeleteSession(RPC_DELETE_SESSION *t, PACK *p); +void OutRpcDeleteSession(PACK *p, RPC_DELETE_SESSION *t); +void InRpcEnumMacTable(RPC_ENUM_MAC_TABLE *t, PACK *p); +void OutRpcEnumMacTable(PACK *p, RPC_ENUM_MAC_TABLE *t); +void FreeRpcEnumMacTable(RPC_ENUM_MAC_TABLE *t); +void InRpcEnumIpTable(RPC_ENUM_IP_TABLE *t, PACK *p); +void OutRpcEnumIpTable(PACK *p, RPC_ENUM_IP_TABLE *t); +void FreeRpcEnumIpTable(RPC_ENUM_IP_TABLE *t); +void InRpcDeleteTable(RPC_DELETE_TABLE *t, PACK *p); +void OutRpcDeleteTable(PACK *p, RPC_DELETE_TABLE *t); +void InRpcMemInfo(MEMINFO *t, PACK *p); +void OutRpcMemInfo(PACK *p, MEMINFO *t); +void InRpcKeyPair(RPC_KEY_PAIR *t, PACK *p); +void OutRpcKeyPair(PACK *p, RPC_KEY_PAIR *t); +void FreeRpcKeyPair(RPC_KEY_PAIR *t); +void InRpcAddAccess(RPC_ADD_ACCESS *t, PACK *p); +void OutRpcAddAccess(PACK *p, RPC_ADD_ACCESS *t); +void InRpcDeleteAccess(RPC_DELETE_ACCESS *t, PACK *p); +void OutRpcDeleteAccess(PACK *p, RPC_DELETE_ACCESS *t); +void FreeRpcSetGroup(RPC_SET_GROUP *t); +void AdjoinRpcEnumSession(RPC_ENUM_SESSION *dest, RPC_ENUM_SESSION *src); +void AdjoinRpcEnumMacTable(RPC_ENUM_MAC_TABLE *dest, RPC_ENUM_MAC_TABLE *src); +void AdjoinRpcEnumIpTable(RPC_ENUM_IP_TABLE *dest, RPC_ENUM_IP_TABLE *src); +void InRpcKeep(RPC_KEEP *t, PACK *p); +void OutRpcKeep(PACK *p, RPC_KEEP *t); +void InRpcOsInfo(OS_INFO *t, PACK *p); +void OutRpcOsInfo(PACK *p, OS_INFO *t); +void FreeRpcOsInfo(OS_INFO *t); +void InRpcEnumEth(RPC_ENUM_ETH *t, PACK *p); +void OutRpcEnumEth(PACK *p, RPC_ENUM_ETH *t); +void FreeRpcEnumEth(RPC_ENUM_ETH *t); +void InRpcLocalBridge(RPC_LOCALBRIDGE *t, PACK *p); +void OutRpcLocalBridge(PACK *p, RPC_LOCALBRIDGE *t); +void InRpcEnumLocalBridge(RPC_ENUM_LOCALBRIDGE *t, PACK *p); +void OutRpcEnumLocalBridge(PACK *p, RPC_ENUM_LOCALBRIDGE *t); +void FreeRpcEnumLocalBridge(RPC_ENUM_LOCALBRIDGE *t); +void InRpcBridgeSupport(RPC_BRIDGE_SUPPORT *t, PACK *p); +void OutRpcBridgeSupport(PACK *p, RPC_BRIDGE_SUPPORT *t); +void InRpcConfig(RPC_CONFIG *t, PACK *p); +void OutRpcConfig(PACK *p, RPC_CONFIG *t); +void FreeRpcConfig(RPC_CONFIG *t); +void InRpcAdminOption(RPC_ADMIN_OPTION *t, PACK *p); +void OutRpcAdminOption(PACK *p, RPC_ADMIN_OPTION *t); +void FreeRpcAdminOption(RPC_ADMIN_OPTION *t); +void InRpcEnumL3Table(RPC_ENUM_L3TABLE *t, PACK *p); +void OutRpcEnumL3Table(PACK *p, RPC_ENUM_L3TABLE *t); +void FreeRpcEnumL3Table(RPC_ENUM_L3TABLE *t); +void InRpcL3Table(RPC_L3TABLE *t, PACK *p); +void OutRpcL3Table(PACK *p, RPC_L3TABLE *t); +void InRpcEnumL3If(RPC_ENUM_L3IF *t, PACK *p); +void OutRpcEnumL3If(PACK *p, RPC_ENUM_L3IF *t); +void FreeRpcEnumL3If(RPC_ENUM_L3IF *t); +void InRpcL3If(RPC_L3IF *t, PACK *p); +void OutRpcL3If(PACK *p, RPC_L3IF *t); +void InRpcL3Sw(RPC_L3SW *t, PACK *p); +void OutRpcL3Sw(PACK *p, RPC_L3SW *t); +void InRpcEnumL3Sw(RPC_ENUM_L3SW *t, PACK *p); +void OutRpcEnumL3Sw(PACK *p, RPC_ENUM_L3SW *t); +void FreeRpcEnumL3Sw(RPC_ENUM_L3SW *t); +void InRpcCrl(RPC_CRL *t, PACK *p); +void OutRpcCrl(PACK *p, RPC_CRL *t); +void FreeRpcCrl(RPC_CRL *t); +void InRpcEnumCrl(RPC_ENUM_CRL *t, PACK *p); +void OutRpcEnumCrl(PACK *p, RPC_ENUM_CRL *t); +void FreeRpcEnumCrl(RPC_ENUM_CRL *t); +void InRpcInt(RPC_INT *t, PACK *p); +void OutRpcInt(PACK *p, RPC_INT *t); +void InRpcAcList(RPC_AC_LIST *t, PACK *p); +void OutRpcAcList(PACK *p, RPC_AC_LIST *t); +void FreeRpcAcList(RPC_AC_LIST *t); +void InRpcEnumLogFile(RPC_ENUM_LOG_FILE *t, PACK *p); +void OutRpcEnumLogFile(PACK *p, RPC_ENUM_LOG_FILE *t); +void FreeRpcEnumLogFile(RPC_ENUM_LOG_FILE *t); +void AdjoinRpcEnumLogFile(RPC_ENUM_LOG_FILE *t, RPC_ENUM_LOG_FILE *src); +void InRpcReadLogFile(RPC_READ_LOG_FILE *t, PACK *p); +void OutRpcReadLogFile(PACK *p, RPC_READ_LOG_FILE *t); +void FreeRpcReadLogFile(RPC_READ_LOG_FILE *t); +void InRpcRenameLink(RPC_RENAME_LINK *t, PACK *p); +void OutRpcRenameLink(PACK *p, RPC_RENAME_LINK *t); +void InRpcEnumLicenseKey(RPC_ENUM_LICENSE_KEY *t, PACK *p); +void OutRpcEnumLicenseKey(PACK *p, RPC_ENUM_LICENSE_KEY *t); +void FreeRpcEnumLicenseKey(RPC_ENUM_LICENSE_KEY *t); +void InRpcLicenseStatus(RPC_LICENSE_STATUS *t, PACK *p); +void OutRpcLicenseStatus(PACK *p, RPC_LICENSE_STATUS *t); +void InRpcEnumEthVLan(RPC_ENUM_ETH_VLAN *t, PACK *p); +void OutRpcEnumEthVLan(PACK *p, RPC_ENUM_ETH_VLAN *t); +void FreeRpcEnumEthVLan(RPC_ENUM_ETH_VLAN *t); +void InRpcMsg(RPC_MSG *t, PACK *p); +void OutRpcMsg(PACK *p, RPC_MSG *t); +void FreeRpcMsg(RPC_MSG *t); +void InRpcWinVer(RPC_WINVER *t, PACK *p); +void OutRpcWinVer(PACK *p, RPC_WINVER *t); +void InIPsecServices(IPSEC_SERVICES *t, PACK *p); +void OutIPsecServices(PACK *p, IPSEC_SERVICES *t); +void InRpcEnumEtherIpId(RPC_ENUM_ETHERIP_ID *t, PACK *p); +void OutRpcEnumEtherIpId(PACK *p, RPC_ENUM_ETHERIP_ID *t); +void FreeRpcEnumEtherIpId(RPC_ENUM_ETHERIP_ID *t); +void InEtherIpId(ETHERIP_ID *t, PACK *p); +void OutEtherIpId(PACK *p, ETHERIP_ID *t); +void InOpenVpnSstpConfig(OPENVPN_SSTP_CONFIG *t, PACK *p); +void OutOpenVpnSstpConfig(PACK *p, OPENVPN_SSTP_CONFIG *t); +void InDDnsClientStatus(DDNS_CLIENT_STATUS *t, PACK *p); +void OutDDnsClientStatus(PACK *p, DDNS_CLIENT_STATUS *t); +void InRpcSpecialListener(RPC_SPECIAL_LISTENER *t, PACK *p); +void OutRpcSpecialListener(PACK *p, RPC_SPECIAL_LISTENER *t); +void InRpcAzureStatus(RPC_AZURE_STATUS *t, PACK *p); +void OutRpcAzureStatus(PACK *p, RPC_AZURE_STATUS *t); +void InRpcInternetSetting(INTERNET_SETTING *t, PACK *p); +void OutRpcInternetSetting(PACK *p, INTERNET_SETTING *t); + +#endif // ADMIN_H + + diff --git a/src/Cedar/AzureClient.c b/src/Cedar/AzureClient.c index 65b0106c..10dbec37 100644 --- a/src/Cedar/AzureClient.c +++ b/src/Cedar/AzureClient.c @@ -1,567 +1,567 @@ -// SoftEther VPN Source Code - Developer Edition Master Branch -// Cedar Communication Module - - -// AzureClient.c -// VPN Azure Client - -#include "CedarPch.h" - -// Wait for connection request -void AcWaitForRequest(AZURE_CLIENT *ac, SOCK *s, AZURE_PARAM *param) -{ - // Validate arguments - if (ac == NULL || s == NULL || param == NULL) - { - return; - } - - while (ac->Halt == false) - { - UCHAR uc; - - // Receive 1 byte - if (RecvAll(s, &uc, 1, false) == 0) - { - break; - } - - if (uc != 0) - { - // Receive a Pack - PACK *p = RecvPackWithHash(s); - - if (p == NULL) - { - break; - } - else - { - // Verify contents of Pack - char opcode[MAX_SIZE]; - char cipher_name[MAX_SIZE]; - char hostname[MAX_SIZE]; - - PackGetStr(p, "opcode", opcode, sizeof(opcode)); - PackGetStr(p, "cipher_name", cipher_name, sizeof(cipher_name)); - PackGetStr(p, "hostname", hostname, sizeof(hostname)); - - if (StrCmpi(opcode, "relay") == 0) - { - IP client_ip, server_ip; - UINT client_port; - UINT server_port; - UCHAR session_id[SHA1_SIZE]; - - if (PackGetIp(p, "client_ip", &client_ip) && - PackGetIp(p, "server_ip", &server_ip) && - PackGetData2(p, "session_id", session_id, sizeof(session_id))) - { - client_port = PackGetInt(p, "client_port"); - server_port = PackGetInt(p, "server_port"); - - if (client_port != 0 && server_port != 0) - { - SOCK *ns; - Debug("Connect Request from %r:%u\n", &client_ip, client_port); - - // Create new socket and connect VPN Azure Server - if (ac->DDnsStatusCopy.InternetSetting.ProxyType == PROXY_DIRECT) - { - ns = ConnectEx2(ac->DDnsStatusCopy.CurrentAzureIp, AZURE_SERVER_PORT, - 0, (bool *)&ac->Halt); - } - else - { - ns = WpcSockConnect2(ac->DDnsStatusCopy.CurrentAzureIp, AZURE_SERVER_PORT, - &ac->DDnsStatusCopy.InternetSetting, NULL, AZURE_VIA_PROXY_TIMEOUT); - } - - if (ns == NULL) - { - Debug("Connect Error.\n"); - } - else - { - Debug("Connected to the relay server.\n"); - - SetTimeout(ns, param->DataTimeout); - - if (StartSSLEx(ns, NULL, NULL, 0, NULL)) - { - // Check certification - char server_cert_hash_str[MAX_SIZE]; - UCHAR server_cert_hash[SHA1_SIZE]; - - Zero(server_cert_hash, sizeof(server_cert_hash)); - GetXDigest(ns->RemoteX, server_cert_hash, true); - - BinToStr(server_cert_hash_str, sizeof(server_cert_hash_str), - server_cert_hash, SHA1_SIZE); - - if (IsEmptyStr(ac->DDnsStatusCopy.AzureCertHash) || StrCmpi(server_cert_hash_str, ac->DDnsStatusCopy.AzureCertHash) == 0 - || StrCmpi(server_cert_hash_str, ac->DDnsStatus.AzureCertHash) == 0) - { - if (SendAll(ns, AZURE_PROTOCOL_DATA_SIANGTURE, 24, true)) - { - PACK *p2 = NewPack(); - - PackAddStr(p2, "hostname", hostname); - PackAddData(p2, "session_id", session_id, sizeof(session_id)); - - if (SendPackWithHash(ns, p2)) - { - UCHAR uc; - - if (RecvAll(ns, &uc, 1, true) != false) - { - if (uc != 0) - { - SOCK *accept_sock = GetReverseListeningSock(ac->Cedar); - - if (accept_sock != NULL) - { - AddRef(ns->ref); - - SetTimeout(ns, INFINITE); - - Copy(&ns->Reverse_MyServerGlobalIp, &server_ip, sizeof(IP)); - ns->Reverse_MyServerPort = server_port; - - InjectNewReverseSocketToAccept(accept_sock, ns, - &client_ip, client_port); - - ReleaseSock(accept_sock); - } - } - } - } - - FreePack(p2); - } - } - } - - ReleaseSock(ns); - } - } - } - } - - FreePack(p); - } - } - - // Send 1 byte - uc = 0; - if (SendAll(s, &uc, 1, false) == 0) - { - break; - } - } -} - -// VPN Azure client main thread -void AcMainThread(THREAD *thread, void *param) -{ - AZURE_CLIENT *ac = (AZURE_CLIENT *)param; - UINT last_ip_revision = INFINITE; - UINT64 last_reconnect_tick = 0; - UINT64 next_reconnect_interval = AZURE_CONNECT_INITIAL_RETRY_INTERVAL; - UINT num_reconnect_retry = 0; - UINT64 next_ddns_retry_tick = 0; - bool last_connect_ok = false; - // Validate arguments - if (ac == NULL || thread == NULL) - { - return; - } - - while (ac->Halt == false) - { - UINT64 now = Tick64(); - bool connect_was_ok = false; - // Wait for enabling VPN Azure function - if (ac->IsEnabled) - { - // VPN Azure is enabled - DDNS_CLIENT_STATUS st; - bool connect_now = false; - bool azure_ip_changed = false; - - Lock(ac->Lock); - { - Copy(&st, &ac->DDnsStatus, sizeof(DDNS_CLIENT_STATUS)); - - if (StrCmpi(st.CurrentAzureIp, ac->DDnsStatusCopy.CurrentAzureIp) != 0) - { - if (IsEmptyStr(st.CurrentAzureIp) == false) - { - // Destination IP address is changed - connect_now = true; - num_reconnect_retry = 0; - } - } - - if (StrCmpi(st.CurrentHostName, ac->DDnsStatusCopy.CurrentHostName) != 0) - { - // DDNS host name is changed - connect_now = true; - num_reconnect_retry = 0; - } - - Copy(&ac->DDnsStatusCopy, &st, sizeof(DDNS_CLIENT_STATUS)); - } - Unlock(ac->Lock); - - if (last_ip_revision != ac->IpStatusRevision) - { - last_ip_revision = ac->IpStatusRevision; - - connect_now = true; - - num_reconnect_retry = 0; - } - - if (last_reconnect_tick == 0 || (now >= (last_reconnect_tick + next_reconnect_interval))) - { - UINT r; - - last_reconnect_tick = now; - num_reconnect_retry++; - next_reconnect_interval = (UINT64)num_reconnect_retry * AZURE_CONNECT_INITIAL_RETRY_INTERVAL; - next_reconnect_interval = MIN(next_reconnect_interval, AZURE_CONNECT_MAX_RETRY_INTERVAL); - - r = (UINT)next_reconnect_interval; - - r = GenRandInterval(r / 2, r); - - next_reconnect_interval = r; - - connect_now = true; - } - - if (IsEmptyStr(st.CurrentAzureIp) == false && IsEmptyStr(st.CurrentHostName) == false) - { - if (connect_now) - { - SOCK *s; - char *host = NULL; - UINT port = AZURE_SERVER_PORT; - - Debug("VPN Azure: Connecting to %s...\n", st.CurrentAzureIp); - - if (ParseHostPort(st.CurrentAzureIp, &host, &port, AZURE_SERVER_PORT)) - { - if (st.InternetSetting.ProxyType == PROXY_DIRECT) - { - s = ConnectEx2(host, port, 0, (bool *)&ac->Halt); - } - else - { - s = WpcSockConnect2(host, port, &st.InternetSetting, NULL, AZURE_VIA_PROXY_TIMEOUT); - } - - if (s != NULL) - { - PACK *p; - UINT64 established_tick = 0; - - Debug("VPN Azure: Connected.\n"); - - SetTimeout(s, AZURE_PROTOCOL_CONTROL_TIMEOUT_DEFAULT); - - Lock(ac->Lock); - { - ac->CurrentSock = s; - ac->IsConnected = true; - StrCpy(ac->ConnectingAzureIp, sizeof(ac->ConnectingAzureIp), st.CurrentAzureIp); - } - Unlock(ac->Lock); - - SendAll(s, AZURE_PROTOCOL_CONTROL_SIGNATURE, StrLen(AZURE_PROTOCOL_CONTROL_SIGNATURE), false); - - // Receive parameter - p = RecvPackWithHash(s); - if (p != NULL) - { - UCHAR c; - AZURE_PARAM param; - bool hostname_changed = false; - - Zero(¶m, sizeof(param)); - - param.ControlKeepAlive = PackGetInt(p, "ControlKeepAlive"); - param.ControlTimeout = PackGetInt(p, "ControlTimeout"); - param.DataTimeout = PackGetInt(p, "DataTimeout"); - param.SslTimeout = PackGetInt(p, "SslTimeout"); - - FreePack(p); - - param.ControlKeepAlive = MAKESURE(param.ControlKeepAlive, 1000, AZURE_SERVER_MAX_KEEPALIVE); - param.ControlTimeout = MAKESURE(param.ControlTimeout, 1000, AZURE_SERVER_MAX_TIMEOUT); - param.DataTimeout = MAKESURE(param.DataTimeout, 1000, AZURE_SERVER_MAX_TIMEOUT); - param.SslTimeout = MAKESURE(param.SslTimeout, 1000, AZURE_SERVER_MAX_TIMEOUT); - - Lock(ac->Lock); - { - Copy(&ac->AzureParam, ¶m, sizeof(AZURE_PARAM)); - } - Unlock(ac->Lock); - - SetTimeout(s, param.ControlTimeout); - - // Send parameter - p = NewPack(); - PackAddStr(p, "CurrentHostName", st.CurrentHostName); - PackAddStr(p, "CurrentAzureIp", st.CurrentAzureIp); - PackAddInt64(p, "CurrentAzureTimestamp", st.CurrentAzureTimestamp); - PackAddStr(p, "CurrentAzureSignature", st.CurrentAzureSignature); - - Lock(ac->Lock); - { - if (StrCmpi(st.CurrentHostName, ac->DDnsStatus.CurrentHostName) != 0) - { - hostname_changed = true; - } - } - Unlock(ac->Lock); - - if (hostname_changed == false) - { - if (SendPackWithHash(s, p)) - { - // Receive result - if (RecvAll(s, &c, 1, false)) - { - if (c && ac->Halt == false) - { - connect_was_ok = true; - - established_tick = Tick64(); - - AcWaitForRequest(ac, s, ¶m); - } - } - } - } - - FreePack(p); - } - else - { - WHERE; - } - - Debug("VPN Azure: Disconnected.\n"); - - Lock(ac->Lock); - { - ac->IsConnected = false; - ac->CurrentSock = NULL; - ClearStr(ac->ConnectingAzureIp, sizeof(ac->ConnectingAzureIp)); - } - Unlock(ac->Lock); - - if (established_tick != 0) - { - if ((established_tick + (UINT64)AZURE_CONNECT_MAX_RETRY_INTERVAL) <= Tick64()) - { - // If the connected time exceeds the AZURE_CONNECT_MAX_RETRY_INTERVAL, reset the retry counter. - last_reconnect_tick = 0; - num_reconnect_retry = 0; - next_reconnect_interval = AZURE_CONNECT_INITIAL_RETRY_INTERVAL; - } - } - - Disconnect(s); - ReleaseSock(s); - } - else - { - Debug("VPN Azure: Error: Connect Failed.\n"); - } - - Free(host); - } - } - } - } - else - { - last_reconnect_tick = 0; - num_reconnect_retry = 0; - next_reconnect_interval = AZURE_CONNECT_INITIAL_RETRY_INTERVAL; - } - - if (ac->Halt) - { - break; - } - - if (connect_was_ok) - { - // If connection goes out after connected, increment connection success count to urge DDNS client query - next_ddns_retry_tick = Tick64() + MIN((UINT64)DDNS_VPN_AZURE_CONNECT_ERROR_DDNS_RETRY_TIME_DIFF * (UINT64)(num_reconnect_retry + 1), (UINT64)DDNS_VPN_AZURE_CONNECT_ERROR_DDNS_RETRY_TIME_DIFF_MAX); - } - - if ((next_ddns_retry_tick != 0) && (Tick64() >= next_ddns_retry_tick)) - { - next_ddns_retry_tick = 0; - - ac->DDnsTriggerInt++; - } - - Wait(ac->Event, rand() % 1000); - } -} - -// Enable or disable VPN Azure client -void AcSetEnable(AZURE_CLIENT *ac, bool enabled) -{ - bool old_status; - // Validate arguments - if (ac == NULL) - { - return; - } - - old_status = ac->IsEnabled; - - ac->IsEnabled = enabled; - - if (ac->IsEnabled && (ac->IsEnabled != old_status)) - { - ac->DDnsTriggerInt++; - } - - AcApplyCurrentConfig(ac, NULL); -} - -// Set current configuration to VPN Azure client -void AcApplyCurrentConfig(AZURE_CLIENT *ac, DDNS_CLIENT_STATUS *ddns_status) -{ - bool disconnect_now = false; - SOCK *disconnect_sock = NULL; - // Validate arguments - if (ac == NULL) - { - return; - } - - // Get current DDNS configuration - Lock(ac->Lock); - { - if (ddns_status != NULL) - { - if (StrCmpi(ac->DDnsStatus.CurrentHostName, ddns_status->CurrentHostName) != 0) - { - // If host name is changed, disconnect current data connection - disconnect_now = true; - } - - if (Cmp(&ac->DDnsStatus.InternetSetting, &ddns_status->InternetSetting, sizeof(INTERNET_SETTING)) != 0) - { - // If proxy setting is changed, disconnect current data connection - disconnect_now = true; - } - - Copy(&ac->DDnsStatus, ddns_status, sizeof(DDNS_CLIENT_STATUS)); - } - - if (ac->IsEnabled == false) - { - // If VPN Azure client is disabled, disconnect current data connection - disconnect_now = true; - } - - if (disconnect_now) - { - if (ac->CurrentSock != NULL) - { - disconnect_sock = ac->CurrentSock; - AddRef(disconnect_sock->ref); - } - } - } - Unlock(ac->Lock); - - if (disconnect_sock != NULL) - { - Disconnect(disconnect_sock); - ReleaseSock(disconnect_sock); - } - - Set(ac->Event); -} - -// Free VPN Azure client -void FreeAzureClient(AZURE_CLIENT *ac) -{ - SOCK *disconnect_sock = NULL; - // Validate arguments - if (ac == NULL) - { - return; - } - - ac->Halt = true; - - Lock(ac->Lock); - { - if (ac->CurrentSock != NULL) - { - disconnect_sock = ac->CurrentSock; - - AddRef(disconnect_sock->ref); - } - } - Unlock(ac->Lock); - - if (disconnect_sock != NULL) - { - Disconnect(disconnect_sock); - ReleaseSock(disconnect_sock); - } - - Set(ac->Event); - - // Stop main thread - WaitThread(ac->MainThread, INFINITE); - ReleaseThread(ac->MainThread); - - ReleaseEvent(ac->Event); - - DeleteLock(ac->Lock); - - Free(ac); -} - -// Create new VPN Azure client -AZURE_CLIENT *NewAzureClient(CEDAR *cedar, SERVER *server) -{ - AZURE_CLIENT *ac; - // Validate arguments - if (cedar == NULL || server == NULL) - { - return NULL; - } - - ac = ZeroMalloc(sizeof(AZURE_CLIENT)); - - ac->Cedar = cedar; - - ac->Server = server; - - ac->Lock = NewLock(); - - ac->IsEnabled = false; - - ac->Event = NewEvent(); - - // Start main thread - ac->MainThread = NewThread(AcMainThread, ac); - - return ac; -} - +// SoftEther VPN Source Code - Developer Edition Master Branch +// Cedar Communication Module + + +// AzureClient.c +// VPN Azure Client + +#include "CedarPch.h" + +// Wait for connection request +void AcWaitForRequest(AZURE_CLIENT *ac, SOCK *s, AZURE_PARAM *param) +{ + // Validate arguments + if (ac == NULL || s == NULL || param == NULL) + { + return; + } + + while (ac->Halt == false) + { + UCHAR uc; + + // Receive 1 byte + if (RecvAll(s, &uc, 1, false) == 0) + { + break; + } + + if (uc != 0) + { + // Receive a Pack + PACK *p = RecvPackWithHash(s); + + if (p == NULL) + { + break; + } + else + { + // Verify contents of Pack + char opcode[MAX_SIZE]; + char cipher_name[MAX_SIZE]; + char hostname[MAX_SIZE]; + + PackGetStr(p, "opcode", opcode, sizeof(opcode)); + PackGetStr(p, "cipher_name", cipher_name, sizeof(cipher_name)); + PackGetStr(p, "hostname", hostname, sizeof(hostname)); + + if (StrCmpi(opcode, "relay") == 0) + { + IP client_ip, server_ip; + UINT client_port; + UINT server_port; + UCHAR session_id[SHA1_SIZE]; + + if (PackGetIp(p, "client_ip", &client_ip) && + PackGetIp(p, "server_ip", &server_ip) && + PackGetData2(p, "session_id", session_id, sizeof(session_id))) + { + client_port = PackGetInt(p, "client_port"); + server_port = PackGetInt(p, "server_port"); + + if (client_port != 0 && server_port != 0) + { + SOCK *ns; + Debug("Connect Request from %r:%u\n", &client_ip, client_port); + + // Create new socket and connect VPN Azure Server + if (ac->DDnsStatusCopy.InternetSetting.ProxyType == PROXY_DIRECT) + { + ns = ConnectEx2(ac->DDnsStatusCopy.CurrentAzureIp, AZURE_SERVER_PORT, + 0, (bool *)&ac->Halt); + } + else + { + ns = WpcSockConnect2(ac->DDnsStatusCopy.CurrentAzureIp, AZURE_SERVER_PORT, + &ac->DDnsStatusCopy.InternetSetting, NULL, AZURE_VIA_PROXY_TIMEOUT); + } + + if (ns == NULL) + { + Debug("Connect Error.\n"); + } + else + { + Debug("Connected to the relay server.\n"); + + SetTimeout(ns, param->DataTimeout); + + if (StartSSLEx(ns, NULL, NULL, 0, NULL)) + { + // Check certification + char server_cert_hash_str[MAX_SIZE]; + UCHAR server_cert_hash[SHA1_SIZE]; + + Zero(server_cert_hash, sizeof(server_cert_hash)); + GetXDigest(ns->RemoteX, server_cert_hash, true); + + BinToStr(server_cert_hash_str, sizeof(server_cert_hash_str), + server_cert_hash, SHA1_SIZE); + + if (IsEmptyStr(ac->DDnsStatusCopy.AzureCertHash) || StrCmpi(server_cert_hash_str, ac->DDnsStatusCopy.AzureCertHash) == 0 + || StrCmpi(server_cert_hash_str, ac->DDnsStatus.AzureCertHash) == 0) + { + if (SendAll(ns, AZURE_PROTOCOL_DATA_SIANGTURE, 24, true)) + { + PACK *p2 = NewPack(); + + PackAddStr(p2, "hostname", hostname); + PackAddData(p2, "session_id", session_id, sizeof(session_id)); + + if (SendPackWithHash(ns, p2)) + { + UCHAR uc; + + if (RecvAll(ns, &uc, 1, true) != false) + { + if (uc != 0) + { + SOCK *accept_sock = GetReverseListeningSock(ac->Cedar); + + if (accept_sock != NULL) + { + AddRef(ns->ref); + + SetTimeout(ns, INFINITE); + + Copy(&ns->Reverse_MyServerGlobalIp, &server_ip, sizeof(IP)); + ns->Reverse_MyServerPort = server_port; + + InjectNewReverseSocketToAccept(accept_sock, ns, + &client_ip, client_port); + + ReleaseSock(accept_sock); + } + } + } + } + + FreePack(p2); + } + } + } + + ReleaseSock(ns); + } + } + } + } + + FreePack(p); + } + } + + // Send 1 byte + uc = 0; + if (SendAll(s, &uc, 1, false) == 0) + { + break; + } + } +} + +// VPN Azure client main thread +void AcMainThread(THREAD *thread, void *param) +{ + AZURE_CLIENT *ac = (AZURE_CLIENT *)param; + UINT last_ip_revision = INFINITE; + UINT64 last_reconnect_tick = 0; + UINT64 next_reconnect_interval = AZURE_CONNECT_INITIAL_RETRY_INTERVAL; + UINT num_reconnect_retry = 0; + UINT64 next_ddns_retry_tick = 0; + bool last_connect_ok = false; + // Validate arguments + if (ac == NULL || thread == NULL) + { + return; + } + + while (ac->Halt == false) + { + UINT64 now = Tick64(); + bool connect_was_ok = false; + // Wait for enabling VPN Azure function + if (ac->IsEnabled) + { + // VPN Azure is enabled + DDNS_CLIENT_STATUS st; + bool connect_now = false; + bool azure_ip_changed = false; + + Lock(ac->Lock); + { + Copy(&st, &ac->DDnsStatus, sizeof(DDNS_CLIENT_STATUS)); + + if (StrCmpi(st.CurrentAzureIp, ac->DDnsStatusCopy.CurrentAzureIp) != 0) + { + if (IsEmptyStr(st.CurrentAzureIp) == false) + { + // Destination IP address is changed + connect_now = true; + num_reconnect_retry = 0; + } + } + + if (StrCmpi(st.CurrentHostName, ac->DDnsStatusCopy.CurrentHostName) != 0) + { + // DDNS host name is changed + connect_now = true; + num_reconnect_retry = 0; + } + + Copy(&ac->DDnsStatusCopy, &st, sizeof(DDNS_CLIENT_STATUS)); + } + Unlock(ac->Lock); + + if (last_ip_revision != ac->IpStatusRevision) + { + last_ip_revision = ac->IpStatusRevision; + + connect_now = true; + + num_reconnect_retry = 0; + } + + if (last_reconnect_tick == 0 || (now >= (last_reconnect_tick + next_reconnect_interval))) + { + UINT r; + + last_reconnect_tick = now; + num_reconnect_retry++; + next_reconnect_interval = (UINT64)num_reconnect_retry * AZURE_CONNECT_INITIAL_RETRY_INTERVAL; + next_reconnect_interval = MIN(next_reconnect_interval, AZURE_CONNECT_MAX_RETRY_INTERVAL); + + r = (UINT)next_reconnect_interval; + + r = GenRandInterval(r / 2, r); + + next_reconnect_interval = r; + + connect_now = true; + } + + if (IsEmptyStr(st.CurrentAzureIp) == false && IsEmptyStr(st.CurrentHostName) == false) + { + if (connect_now) + { + SOCK *s; + char *host = NULL; + UINT port = AZURE_SERVER_PORT; + + Debug("VPN Azure: Connecting to %s...\n", st.CurrentAzureIp); + + if (ParseHostPort(st.CurrentAzureIp, &host, &port, AZURE_SERVER_PORT)) + { + if (st.InternetSetting.ProxyType == PROXY_DIRECT) + { + s = ConnectEx2(host, port, 0, (bool *)&ac->Halt); + } + else + { + s = WpcSockConnect2(host, port, &st.InternetSetting, NULL, AZURE_VIA_PROXY_TIMEOUT); + } + + if (s != NULL) + { + PACK *p; + UINT64 established_tick = 0; + + Debug("VPN Azure: Connected.\n"); + + SetTimeout(s, AZURE_PROTOCOL_CONTROL_TIMEOUT_DEFAULT); + + Lock(ac->Lock); + { + ac->CurrentSock = s; + ac->IsConnected = true; + StrCpy(ac->ConnectingAzureIp, sizeof(ac->ConnectingAzureIp), st.CurrentAzureIp); + } + Unlock(ac->Lock); + + SendAll(s, AZURE_PROTOCOL_CONTROL_SIGNATURE, StrLen(AZURE_PROTOCOL_CONTROL_SIGNATURE), false); + + // Receive parameter + p = RecvPackWithHash(s); + if (p != NULL) + { + UCHAR c; + AZURE_PARAM param; + bool hostname_changed = false; + + Zero(¶m, sizeof(param)); + + param.ControlKeepAlive = PackGetInt(p, "ControlKeepAlive"); + param.ControlTimeout = PackGetInt(p, "ControlTimeout"); + param.DataTimeout = PackGetInt(p, "DataTimeout"); + param.SslTimeout = PackGetInt(p, "SslTimeout"); + + FreePack(p); + + param.ControlKeepAlive = MAKESURE(param.ControlKeepAlive, 1000, AZURE_SERVER_MAX_KEEPALIVE); + param.ControlTimeout = MAKESURE(param.ControlTimeout, 1000, AZURE_SERVER_MAX_TIMEOUT); + param.DataTimeout = MAKESURE(param.DataTimeout, 1000, AZURE_SERVER_MAX_TIMEOUT); + param.SslTimeout = MAKESURE(param.SslTimeout, 1000, AZURE_SERVER_MAX_TIMEOUT); + + Lock(ac->Lock); + { + Copy(&ac->AzureParam, ¶m, sizeof(AZURE_PARAM)); + } + Unlock(ac->Lock); + + SetTimeout(s, param.ControlTimeout); + + // Send parameter + p = NewPack(); + PackAddStr(p, "CurrentHostName", st.CurrentHostName); + PackAddStr(p, "CurrentAzureIp", st.CurrentAzureIp); + PackAddInt64(p, "CurrentAzureTimestamp", st.CurrentAzureTimestamp); + PackAddStr(p, "CurrentAzureSignature", st.CurrentAzureSignature); + + Lock(ac->Lock); + { + if (StrCmpi(st.CurrentHostName, ac->DDnsStatus.CurrentHostName) != 0) + { + hostname_changed = true; + } + } + Unlock(ac->Lock); + + if (hostname_changed == false) + { + if (SendPackWithHash(s, p)) + { + // Receive result + if (RecvAll(s, &c, 1, false)) + { + if (c && ac->Halt == false) + { + connect_was_ok = true; + + established_tick = Tick64(); + + AcWaitForRequest(ac, s, ¶m); + } + } + } + } + + FreePack(p); + } + else + { + WHERE; + } + + Debug("VPN Azure: Disconnected.\n"); + + Lock(ac->Lock); + { + ac->IsConnected = false; + ac->CurrentSock = NULL; + ClearStr(ac->ConnectingAzureIp, sizeof(ac->ConnectingAzureIp)); + } + Unlock(ac->Lock); + + if (established_tick != 0) + { + if ((established_tick + (UINT64)AZURE_CONNECT_MAX_RETRY_INTERVAL) <= Tick64()) + { + // If the connected time exceeds the AZURE_CONNECT_MAX_RETRY_INTERVAL, reset the retry counter. + last_reconnect_tick = 0; + num_reconnect_retry = 0; + next_reconnect_interval = AZURE_CONNECT_INITIAL_RETRY_INTERVAL; + } + } + + Disconnect(s); + ReleaseSock(s); + } + else + { + Debug("VPN Azure: Error: Connect Failed.\n"); + } + + Free(host); + } + } + } + } + else + { + last_reconnect_tick = 0; + num_reconnect_retry = 0; + next_reconnect_interval = AZURE_CONNECT_INITIAL_RETRY_INTERVAL; + } + + if (ac->Halt) + { + break; + } + + if (connect_was_ok) + { + // If connection goes out after connected, increment connection success count to urge DDNS client query + next_ddns_retry_tick = Tick64() + MIN((UINT64)DDNS_VPN_AZURE_CONNECT_ERROR_DDNS_RETRY_TIME_DIFF * (UINT64)(num_reconnect_retry + 1), (UINT64)DDNS_VPN_AZURE_CONNECT_ERROR_DDNS_RETRY_TIME_DIFF_MAX); + } + + if ((next_ddns_retry_tick != 0) && (Tick64() >= next_ddns_retry_tick)) + { + next_ddns_retry_tick = 0; + + ac->DDnsTriggerInt++; + } + + Wait(ac->Event, rand() % 1000); + } +} + +// Enable or disable VPN Azure client +void AcSetEnable(AZURE_CLIENT *ac, bool enabled) +{ + bool old_status; + // Validate arguments + if (ac == NULL) + { + return; + } + + old_status = ac->IsEnabled; + + ac->IsEnabled = enabled; + + if (ac->IsEnabled && (ac->IsEnabled != old_status)) + { + ac->DDnsTriggerInt++; + } + + AcApplyCurrentConfig(ac, NULL); +} + +// Set current configuration to VPN Azure client +void AcApplyCurrentConfig(AZURE_CLIENT *ac, DDNS_CLIENT_STATUS *ddns_status) +{ + bool disconnect_now = false; + SOCK *disconnect_sock = NULL; + // Validate arguments + if (ac == NULL) + { + return; + } + + // Get current DDNS configuration + Lock(ac->Lock); + { + if (ddns_status != NULL) + { + if (StrCmpi(ac->DDnsStatus.CurrentHostName, ddns_status->CurrentHostName) != 0) + { + // If host name is changed, disconnect current data connection + disconnect_now = true; + } + + if (Cmp(&ac->DDnsStatus.InternetSetting, &ddns_status->InternetSetting, sizeof(INTERNET_SETTING)) != 0) + { + // If proxy setting is changed, disconnect current data connection + disconnect_now = true; + } + + Copy(&ac->DDnsStatus, ddns_status, sizeof(DDNS_CLIENT_STATUS)); + } + + if (ac->IsEnabled == false) + { + // If VPN Azure client is disabled, disconnect current data connection + disconnect_now = true; + } + + if (disconnect_now) + { + if (ac->CurrentSock != NULL) + { + disconnect_sock = ac->CurrentSock; + AddRef(disconnect_sock->ref); + } + } + } + Unlock(ac->Lock); + + if (disconnect_sock != NULL) + { + Disconnect(disconnect_sock); + ReleaseSock(disconnect_sock); + } + + Set(ac->Event); +} + +// Free VPN Azure client +void FreeAzureClient(AZURE_CLIENT *ac) +{ + SOCK *disconnect_sock = NULL; + // Validate arguments + if (ac == NULL) + { + return; + } + + ac->Halt = true; + + Lock(ac->Lock); + { + if (ac->CurrentSock != NULL) + { + disconnect_sock = ac->CurrentSock; + + AddRef(disconnect_sock->ref); + } + } + Unlock(ac->Lock); + + if (disconnect_sock != NULL) + { + Disconnect(disconnect_sock); + ReleaseSock(disconnect_sock); + } + + Set(ac->Event); + + // Stop main thread + WaitThread(ac->MainThread, INFINITE); + ReleaseThread(ac->MainThread); + + ReleaseEvent(ac->Event); + + DeleteLock(ac->Lock); + + Free(ac); +} + +// Create new VPN Azure client +AZURE_CLIENT *NewAzureClient(CEDAR *cedar, SERVER *server) +{ + AZURE_CLIENT *ac; + // Validate arguments + if (cedar == NULL || server == NULL) + { + return NULL; + } + + ac = ZeroMalloc(sizeof(AZURE_CLIENT)); + + ac->Cedar = cedar; + + ac->Server = server; + + ac->Lock = NewLock(); + + ac->IsEnabled = false; + + ac->Event = NewEvent(); + + // Start main thread + ac->MainThread = NewThread(AcMainThread, ac); + + return ac; +} + diff --git a/src/Cedar/AzureClient.h b/src/Cedar/AzureClient.h index 6ffa8bf7..08b39aed 100644 --- a/src/Cedar/AzureClient.h +++ b/src/Cedar/AzureClient.h @@ -1,68 +1,68 @@ -// SoftEther VPN Source Code - Developer Edition Master Branch -// Cedar Communication Module - - -// AzureClient.h -// Header of AzureClient.c - -#ifndef AZURE_CLIENT_H -#define AZURE_CLIENT_H - -// Constants -#define AZURE_SERVER_PORT 443 -#define AZURE_PROTOCOL_CONTROL_SIGNATURE "ACTL" -#define AZURE_PROTOCOL_DATA_SIANGTURE "AZURE_CONNECT_SIGNATURE!" -#define AZURE_PROTOCOL_CONTROL_TIMEOUT_DEFAULT (5 * 1000) // Default timeout -#define AZURE_CONNECT_INITIAL_RETRY_INTERVAL (1 * 1000) // Initial re-connection interval (15 * 1000) -#define AZURE_CONNECT_MAX_RETRY_INTERVAL (60 * 60 * 1000) // Maximum re-connection interval - -#define AZURE_DOMAIN_SUFFIX ".vpnazure.net" - -#define AZURE_SERVER_MAX_KEEPALIVE (5 * 60 * 1000) -#define AZURE_SERVER_MAX_TIMEOUT (10 * 60 * 1000) - -#define AZURE_VIA_PROXY_TIMEOUT 5000 - - -// Communications parameter -struct AZURE_PARAM -{ - UINT ControlKeepAlive; - UINT ControlTimeout; - UINT DataTimeout; - UINT SslTimeout; -}; - -// VPN Azure Client -struct AZURE_CLIENT -{ - CEDAR *Cedar; - SERVER *Server; - LOCK *Lock; - DDNS_CLIENT_STATUS DDnsStatus; - volatile bool IsEnabled; - EVENT *Event; - volatile bool Halt; - THREAD *MainThread; - volatile UINT IpStatusRevision; - DDNS_CLIENT_STATUS DDnsStatusCopy; - SOCK *CurrentSock; - char ConnectingAzureIp[MAX_SIZE]; - AZURE_PARAM AzureParam; - volatile UINT DDnsTriggerInt; - volatile bool IsConnected; -}; - - -// Function prototype -AZURE_CLIENT *NewAzureClient(CEDAR *cedar, SERVER *server); -void FreeAzureClient(AZURE_CLIENT *ac); -void AcApplyCurrentConfig(AZURE_CLIENT *ac, DDNS_CLIENT_STATUS *ddns_status); -void AcMainThread(THREAD *thread, void *param); -void AcSetEnable(AZURE_CLIENT *ac, bool enabled); -void AcWaitForRequest(AZURE_CLIENT *ac, SOCK *s, AZURE_PARAM *param); - - -#endif // AZURE_CLIENT_H - - +// SoftEther VPN Source Code - Developer Edition Master Branch +// Cedar Communication Module + + +// AzureClient.h +// Header of AzureClient.c + +#ifndef AZURE_CLIENT_H +#define AZURE_CLIENT_H + +// Constants +#define AZURE_SERVER_PORT 443 +#define AZURE_PROTOCOL_CONTROL_SIGNATURE "ACTL" +#define AZURE_PROTOCOL_DATA_SIANGTURE "AZURE_CONNECT_SIGNATURE!" +#define AZURE_PROTOCOL_CONTROL_TIMEOUT_DEFAULT (5 * 1000) // Default timeout +#define AZURE_CONNECT_INITIAL_RETRY_INTERVAL (1 * 1000) // Initial re-connection interval (15 * 1000) +#define AZURE_CONNECT_MAX_RETRY_INTERVAL (60 * 60 * 1000) // Maximum re-connection interval + +#define AZURE_DOMAIN_SUFFIX ".vpnazure.net" + +#define AZURE_SERVER_MAX_KEEPALIVE (5 * 60 * 1000) +#define AZURE_SERVER_MAX_TIMEOUT (10 * 60 * 1000) + +#define AZURE_VIA_PROXY_TIMEOUT 5000 + + +// Communications parameter +struct AZURE_PARAM +{ + UINT ControlKeepAlive; + UINT ControlTimeout; + UINT DataTimeout; + UINT SslTimeout; +}; + +// VPN Azure Client +struct AZURE_CLIENT +{ + CEDAR *Cedar; + SERVER *Server; + LOCK *Lock; + DDNS_CLIENT_STATUS DDnsStatus; + volatile bool IsEnabled; + EVENT *Event; + volatile bool Halt; + THREAD *MainThread; + volatile UINT IpStatusRevision; + DDNS_CLIENT_STATUS DDnsStatusCopy; + SOCK *CurrentSock; + char ConnectingAzureIp[MAX_SIZE]; + AZURE_PARAM AzureParam; + volatile UINT DDnsTriggerInt; + volatile bool IsConnected; +}; + + +// Function prototype +AZURE_CLIENT *NewAzureClient(CEDAR *cedar, SERVER *server); +void FreeAzureClient(AZURE_CLIENT *ac); +void AcApplyCurrentConfig(AZURE_CLIENT *ac, DDNS_CLIENT_STATUS *ddns_status); +void AcMainThread(THREAD *thread, void *param); +void AcSetEnable(AZURE_CLIENT *ac, bool enabled); +void AcWaitForRequest(AZURE_CLIENT *ac, SOCK *s, AZURE_PARAM *param); + + +#endif // AZURE_CLIENT_H + + diff --git a/src/Cedar/AzureServer.c b/src/Cedar/AzureServer.c index 0a1a000e..6b0eaf86 100644 --- a/src/Cedar/AzureServer.c +++ b/src/Cedar/AzureServer.c @@ -1,10 +1,10 @@ -// SoftEther VPN Source Code - Developer Edition Master Branch -// Cedar Communication Module - - -// AzureServer.c -// VPN Azure Server - -#include "CedarPch.h" - - +// SoftEther VPN Source Code - Developer Edition Master Branch +// Cedar Communication Module + + +// AzureServer.c +// VPN Azure Server + +#include "CedarPch.h" + + diff --git a/src/Cedar/AzureServer.h b/src/Cedar/AzureServer.h index 6e86bd8f..e26e4ccf 100644 --- a/src/Cedar/AzureServer.h +++ b/src/Cedar/AzureServer.h @@ -1,14 +1,14 @@ -// SoftEther VPN Source Code - Developer Edition Master Branch -// Cedar Communication Module - - -// AzureServer.h -// Header of AzureServer.c - -#ifndef AZURE_SERVER_H -#define AZURE_SERVER_H - - -#endif // AZURE_SERVER_H - - +// SoftEther VPN Source Code - Developer Edition Master Branch +// Cedar Communication Module + + +// AzureServer.h +// Header of AzureServer.c + +#ifndef AZURE_SERVER_H +#define AZURE_SERVER_H + + +#endif // AZURE_SERVER_H + + diff --git a/src/Cedar/Bridge.c b/src/Cedar/Bridge.c index 3a4ca7b2..a52ae469 100644 --- a/src/Cedar/Bridge.c +++ b/src/Cedar/Bridge.c @@ -1,466 +1,466 @@ -// SoftEther VPN Source Code - Developer Edition Master Branch -// Cedar Communication Module - - -// Bridge.c -// Ethernet Bridge Program (Local Bridge) - -#include - -#define BRIDGE_C - -#ifdef WIN32 -#define OS_WIN32 -#endif - -#ifdef OS_WIN32 - -// Win32 -#include "BridgeWin32.c" - -#else - -// Unix -#include "BridgeUnix.c" - -#endif // OS_WIN32 - -// Hash the list of current Ethernet devices -UINT GetEthDeviceHash() -{ -#ifdef OS_UNIX - // UNIX - UINT num = 0; - UINT i; - char tmp[4096]; - UCHAR hash[SHA1_SIZE]; - TOKEN_LIST *t = GetEthList(); - - tmp[0] = 0; - - if (t != NULL) - { - num = t->NumTokens; - for (i = 0; i < t->NumTokens; i++) - { - StrCat(tmp, sizeof(tmp), t->Token[i]); - } - FreeToken(t); - } - - Sha0(hash, tmp, StrLen(tmp)); - - Copy(&num, hash, sizeof(UINT)); - - return num; -#else // OS_UNIX - // Win32 - UINT ret = 0; - MS_ADAPTER_LIST *a = MsCreateAdapterListEx(true); - UINT num; - UINT i; - char tmp[4096]; - UCHAR hash[SHA1_SIZE]; - - tmp[0] = 0; - if (a != NULL) - { - for (i = 0;i < a->Num;i++) - { - StrCat(tmp, sizeof(tmp), a->Adapters[i]->Title); - } - } - MsFreeAdapterList(a); - - Sha0(hash, tmp, StrLen(tmp)); - - Copy(&num, hash, sizeof(UINT)); - - return num; -#endif // OS_UNIX -} - -// Get whether WinPcap is needed -bool IsNeedWinPcap() -{ - if (IsBridgeSupported() == false) - { - // Not in Windows - return false; - } - else - { - // Windows - if (IsEthSupported()) - { - // Already success to access the Ethernet device - return false; - } - else - { - // Failed to access the Ethernet device - return true; - } - } -} - -// Get whether the local-bridging is supported by current OS -bool IsBridgeSupported() -{ - UINT type = GetOsInfo()->OsType; - - if (OS_IS_WINDOWS(type)) - { - if (IsEthSupported()) - { - return true; - } - else - { - bool ret = false; - -#ifdef OS_WIN32 - ret = MsIsAdmin(); -#endif // OS_WIN32 - - return ret; - } - } - else - { - return IsEthSupported(); - } -} - -// Delete a local-bridge -bool DeleteLocalBridge(CEDAR *c, char *hubname, char *devicename) -{ - bool ret = false; - // Validate arguments - if (c == NULL || hubname == NULL || devicename == NULL) - { - return false; - } - - LockList(c->HubList); - { - LockList(c->LocalBridgeList); - { - UINT i; - - for (i = 0;i < LIST_NUM(c->LocalBridgeList);i++) - { - LOCALBRIDGE *br = LIST_DATA(c->LocalBridgeList, i); - - if (StrCmpi(br->HubName, hubname) == 0) - { - if (StrCmpi(br->DeviceName, devicename) == 0) - { - if (br->Bridge != NULL) - { - BrFreeBridge(br->Bridge); - br->Bridge = NULL; - } - - Delete(c->LocalBridgeList, br); - Free(br); - - ret = true; - break; - } - } - } - } - UnlockList(c->LocalBridgeList); - } - UnlockList(c->HubList); - - return ret; -} - -// Add a local-bridge -void AddLocalBridge(CEDAR *c, char *hubname, char *devicename, bool local, bool monitor, bool tapmode, char *tapaddr, bool limit_broadcast) -{ - UINT i; - HUB *h = NULL; - LOCALBRIDGE *br = NULL; - // Validate arguments - if (c == NULL || hubname == NULL || devicename == NULL) - { - return; - } - - if (OS_IS_UNIX(GetOsInfo()->OsType) == false) - { - tapmode = false; - } - - LockList(c->HubList); - { - LockList(c->LocalBridgeList); - { - bool exists = false; - - // Ensure that the same configuration local-bridge doesn't exist already - for (i = 0;i < LIST_NUM(c->LocalBridgeList);i++) - { - LOCALBRIDGE *br = LIST_DATA(c->LocalBridgeList, i); - if (StrCmpi(br->DeviceName, devicename) == 0) - { - if (StrCmpi(br->HubName, hubname) == 0) - { - if (br->TapMode == tapmode) - { - exists = true; - } - } - } - } - - if (exists == false) - { - // Add configuration - br = ZeroMalloc(sizeof(LOCALBRIDGE)); - StrCpy(br->HubName, sizeof(br->HubName), hubname); - StrCpy(br->DeviceName, sizeof(br->DeviceName), devicename); - br->Bridge = NULL; - br->Local = local; - br->TapMode = tapmode; - br->LimitBroadcast = limit_broadcast; - br->Monitor = monitor; - if (br->TapMode) - { - if (tapaddr != NULL && IsZero(tapaddr, 6) == false) - { - Copy(br->TapMacAddress, tapaddr, 6); - } - else - { - GenMacAddress(br->TapMacAddress); - } - } - - Add(c->LocalBridgeList, br); - - // Find the hub - for (i = 0;i < LIST_NUM(c->HubList);i++) - { - HUB *hub = LIST_DATA(c->HubList, i); - if (StrCmpi(hub->Name, br->HubName) == 0) - { - h = hub; - AddRef(h->ref); - break; - } - } - } - } - UnlockList(c->LocalBridgeList); - } - UnlockList(c->HubList); - - // Start the local-bridge immediately - if (h != NULL && br != NULL && h->Type != HUB_TYPE_FARM_DYNAMIC) - { - Lock(h->lock_online); - { - if (h->Offline == false) - { - LockList(c->LocalBridgeList); - { - if (IsInList(c->LocalBridgeList, br)) - { - if (br->Bridge == NULL) - { - br->Bridge = BrNewBridge(h, br->DeviceName, NULL, br->Local, br->Monitor, br->TapMode, br->TapMacAddress, br->LimitBroadcast, br); - } - } - } - UnlockList(c->LocalBridgeList); - } - } - Unlock(h->lock_online); - } - - ReleaseHub(h); -} - -// Initialize the local-bridge list -void InitLocalBridgeList(CEDAR *c) -{ - // Validate arguments - if (c == NULL) - { - return; - } - - c->LocalBridgeList = NewList(NULL); -} - -// Free the local-bridge list -void FreeLocalBridgeList(CEDAR *c) -{ - UINT i; - // Validate arguments - if (c == NULL) - { - return; - } - - for (i = 0;i < LIST_NUM(c->LocalBridgeList);i++) - { - LOCALBRIDGE *br = LIST_DATA(c->LocalBridgeList, i); - Free(br); - } - - ReleaseList(c->LocalBridgeList); - c->LocalBridgeList = NULL; -} - -// Bridging thread -void BrBridgeThread(THREAD *thread, void *param) -{ - BRIDGE *b; - CONNECTION *c; - SESSION *s; - HUB *h; - char name[MAX_SIZE]; - // Validate arguments - if (thread == NULL || param == NULL) - { - return; - } - - b = (BRIDGE *)param; - - // Create a connection object - c = NewServerConnection(b->Cedar, NULL, thread); - c->Protocol = CONNECTION_HUB_BRIDGE; - - // Create a session object - s = NewServerSession(b->Cedar, c, b->Hub, BRIDGE_USER_NAME, b->Policy); - HLog(b->Hub, "LH_START_BRIDGE", b->Name, s->Name); - StrCpy(name, sizeof(name), b->Name); - h = b->Hub; - AddRef(h->ref); - s->BridgeMode = true; - s->Bridge = b; - c->Session = s; - ReleaseConnection(c); - - // Dummy user name for local-bridge - s->Username = CopyStr(BRIDGE_USER_NAME_PRINT); - - b->Session = s; - AddRef(s->ref); - - // Notify completion - NoticeThreadInit(thread); - - // Main procedure of the session - Debug("Bridge %s Start.\n", b->Name); - SessionMain(s); - Debug("Bridge %s Stop.\n", b->Name); - - HLog(h, "LH_STOP_BRIDGE", name); - - ReleaseHub(h); - - ReleaseSession(s); -} - -// Free the local-bridge object -void BrFreeBridge(BRIDGE *b) -{ - // Validate arguments - if (b == NULL) - { - return; - } - - if (b->ParentLocalBridge != NULL) - { - b->ParentLocalBridge = NULL; - } - - // Stop session thread - StopSession(b->Session); - ReleaseSession(b->Session); - - Free(b); -} - -// Create new local-bridge -BRIDGE *BrNewBridge(HUB *h, char *name, POLICY *p, bool local, bool monitor, bool tapmode, char *tapaddr, bool limit_broadcast, LOCALBRIDGE *parent_local_bridge) -{ - BRIDGE *b; - POLICY *policy; - THREAD *t; - // Validate arguments - if (h == NULL || name == NULL || parent_local_bridge == NULL) - { - return NULL; - } - - if (p == NULL) - { - policy = ClonePolicy(GetDefaultPolicy()); - } - else - { - policy = ClonePolicy(p); - } - - b = ZeroMalloc(sizeof(BRIDGE)); - b->Cedar = h->Cedar; - b->Hub = h; - StrCpy(b->Name, sizeof(b->Name), name); - b->Policy = policy; - b->Local = local; - b->Monitor = monitor; - b->TapMode = tapmode; - b->LimitBroadcast = limit_broadcast; - b->ParentLocalBridge = parent_local_bridge; - - if (b->TapMode) - { - if (tapaddr != NULL && IsZero(tapaddr, 6) == false) - { - Copy(b->TapMacAddress, tapaddr, 6); - } - else - { - GenMacAddress(b->TapMacAddress); - } - } - - if (monitor) - { - // Enabling monitoring mode - policy->MonitorPort = true; - } - - if (b->LimitBroadcast == false) - { - // Disable broadcast limiter - policy->NoBroadcastLimiter = true; - } - - // Start thread - t = NewThread(BrBridgeThread, b); - WaitThreadInit(t); - ReleaseThread(t); - - return b; -} - -// Raw IP bridge is supported only on Linux -bool IsRawIpBridgeSupported() -{ -#ifdef UNIX_LINUX - return true; -#else // UNIX_LINUX - return false; -#endif // UNIX_LINUX -} - +// SoftEther VPN Source Code - Developer Edition Master Branch +// Cedar Communication Module + + +// Bridge.c +// Ethernet Bridge Program (Local Bridge) + +#include + +#define BRIDGE_C + +#ifdef WIN32 +#define OS_WIN32 +#endif + +#ifdef OS_WIN32 + +// Win32 +#include "BridgeWin32.c" + +#else + +// Unix +#include "BridgeUnix.c" + +#endif // OS_WIN32 + +// Hash the list of current Ethernet devices +UINT GetEthDeviceHash() +{ +#ifdef OS_UNIX + // UNIX + UINT num = 0; + UINT i; + char tmp[4096]; + UCHAR hash[SHA1_SIZE]; + TOKEN_LIST *t = GetEthList(); + + tmp[0] = 0; + + if (t != NULL) + { + num = t->NumTokens; + for (i = 0; i < t->NumTokens; i++) + { + StrCat(tmp, sizeof(tmp), t->Token[i]); + } + FreeToken(t); + } + + Sha0(hash, tmp, StrLen(tmp)); + + Copy(&num, hash, sizeof(UINT)); + + return num; +#else // OS_UNIX + // Win32 + UINT ret = 0; + MS_ADAPTER_LIST *a = MsCreateAdapterListEx(true); + UINT num; + UINT i; + char tmp[4096]; + UCHAR hash[SHA1_SIZE]; + + tmp[0] = 0; + if (a != NULL) + { + for (i = 0;i < a->Num;i++) + { + StrCat(tmp, sizeof(tmp), a->Adapters[i]->Title); + } + } + MsFreeAdapterList(a); + + Sha0(hash, tmp, StrLen(tmp)); + + Copy(&num, hash, sizeof(UINT)); + + return num; +#endif // OS_UNIX +} + +// Get whether WinPcap is needed +bool IsNeedWinPcap() +{ + if (IsBridgeSupported() == false) + { + // Not in Windows + return false; + } + else + { + // Windows + if (IsEthSupported()) + { + // Already success to access the Ethernet device + return false; + } + else + { + // Failed to access the Ethernet device + return true; + } + } +} + +// Get whether the local-bridging is supported by current OS +bool IsBridgeSupported() +{ + UINT type = GetOsInfo()->OsType; + + if (OS_IS_WINDOWS(type)) + { + if (IsEthSupported()) + { + return true; + } + else + { + bool ret = false; + +#ifdef OS_WIN32 + ret = MsIsAdmin(); +#endif // OS_WIN32 + + return ret; + } + } + else + { + return IsEthSupported(); + } +} + +// Delete a local-bridge +bool DeleteLocalBridge(CEDAR *c, char *hubname, char *devicename) +{ + bool ret = false; + // Validate arguments + if (c == NULL || hubname == NULL || devicename == NULL) + { + return false; + } + + LockList(c->HubList); + { + LockList(c->LocalBridgeList); + { + UINT i; + + for (i = 0;i < LIST_NUM(c->LocalBridgeList);i++) + { + LOCALBRIDGE *br = LIST_DATA(c->LocalBridgeList, i); + + if (StrCmpi(br->HubName, hubname) == 0) + { + if (StrCmpi(br->DeviceName, devicename) == 0) + { + if (br->Bridge != NULL) + { + BrFreeBridge(br->Bridge); + br->Bridge = NULL; + } + + Delete(c->LocalBridgeList, br); + Free(br); + + ret = true; + break; + } + } + } + } + UnlockList(c->LocalBridgeList); + } + UnlockList(c->HubList); + + return ret; +} + +// Add a local-bridge +void AddLocalBridge(CEDAR *c, char *hubname, char *devicename, bool local, bool monitor, bool tapmode, char *tapaddr, bool limit_broadcast) +{ + UINT i; + HUB *h = NULL; + LOCALBRIDGE *br = NULL; + // Validate arguments + if (c == NULL || hubname == NULL || devicename == NULL) + { + return; + } + + if (OS_IS_UNIX(GetOsInfo()->OsType) == false) + { + tapmode = false; + } + + LockList(c->HubList); + { + LockList(c->LocalBridgeList); + { + bool exists = false; + + // Ensure that the same configuration local-bridge doesn't exist already + for (i = 0;i < LIST_NUM(c->LocalBridgeList);i++) + { + LOCALBRIDGE *br = LIST_DATA(c->LocalBridgeList, i); + if (StrCmpi(br->DeviceName, devicename) == 0) + { + if (StrCmpi(br->HubName, hubname) == 0) + { + if (br->TapMode == tapmode) + { + exists = true; + } + } + } + } + + if (exists == false) + { + // Add configuration + br = ZeroMalloc(sizeof(LOCALBRIDGE)); + StrCpy(br->HubName, sizeof(br->HubName), hubname); + StrCpy(br->DeviceName, sizeof(br->DeviceName), devicename); + br->Bridge = NULL; + br->Local = local; + br->TapMode = tapmode; + br->LimitBroadcast = limit_broadcast; + br->Monitor = monitor; + if (br->TapMode) + { + if (tapaddr != NULL && IsZero(tapaddr, 6) == false) + { + Copy(br->TapMacAddress, tapaddr, 6); + } + else + { + GenMacAddress(br->TapMacAddress); + } + } + + Add(c->LocalBridgeList, br); + + // Find the hub + for (i = 0;i < LIST_NUM(c->HubList);i++) + { + HUB *hub = LIST_DATA(c->HubList, i); + if (StrCmpi(hub->Name, br->HubName) == 0) + { + h = hub; + AddRef(h->ref); + break; + } + } + } + } + UnlockList(c->LocalBridgeList); + } + UnlockList(c->HubList); + + // Start the local-bridge immediately + if (h != NULL && br != NULL && h->Type != HUB_TYPE_FARM_DYNAMIC) + { + Lock(h->lock_online); + { + if (h->Offline == false) + { + LockList(c->LocalBridgeList); + { + if (IsInList(c->LocalBridgeList, br)) + { + if (br->Bridge == NULL) + { + br->Bridge = BrNewBridge(h, br->DeviceName, NULL, br->Local, br->Monitor, br->TapMode, br->TapMacAddress, br->LimitBroadcast, br); + } + } + } + UnlockList(c->LocalBridgeList); + } + } + Unlock(h->lock_online); + } + + ReleaseHub(h); +} + +// Initialize the local-bridge list +void InitLocalBridgeList(CEDAR *c) +{ + // Validate arguments + if (c == NULL) + { + return; + } + + c->LocalBridgeList = NewList(NULL); +} + +// Free the local-bridge list +void FreeLocalBridgeList(CEDAR *c) +{ + UINT i; + // Validate arguments + if (c == NULL) + { + return; + } + + for (i = 0;i < LIST_NUM(c->LocalBridgeList);i++) + { + LOCALBRIDGE *br = LIST_DATA(c->LocalBridgeList, i); + Free(br); + } + + ReleaseList(c->LocalBridgeList); + c->LocalBridgeList = NULL; +} + +// Bridging thread +void BrBridgeThread(THREAD *thread, void *param) +{ + BRIDGE *b; + CONNECTION *c; + SESSION *s; + HUB *h; + char name[MAX_SIZE]; + // Validate arguments + if (thread == NULL || param == NULL) + { + return; + } + + b = (BRIDGE *)param; + + // Create a connection object + c = NewServerConnection(b->Cedar, NULL, thread); + c->Protocol = CONNECTION_HUB_BRIDGE; + + // Create a session object + s = NewServerSession(b->Cedar, c, b->Hub, BRIDGE_USER_NAME, b->Policy); + HLog(b->Hub, "LH_START_BRIDGE", b->Name, s->Name); + StrCpy(name, sizeof(name), b->Name); + h = b->Hub; + AddRef(h->ref); + s->BridgeMode = true; + s->Bridge = b; + c->Session = s; + ReleaseConnection(c); + + // Dummy user name for local-bridge + s->Username = CopyStr(BRIDGE_USER_NAME_PRINT); + + b->Session = s; + AddRef(s->ref); + + // Notify completion + NoticeThreadInit(thread); + + // Main procedure of the session + Debug("Bridge %s Start.\n", b->Name); + SessionMain(s); + Debug("Bridge %s Stop.\n", b->Name); + + HLog(h, "LH_STOP_BRIDGE", name); + + ReleaseHub(h); + + ReleaseSession(s); +} + +// Free the local-bridge object +void BrFreeBridge(BRIDGE *b) +{ + // Validate arguments + if (b == NULL) + { + return; + } + + if (b->ParentLocalBridge != NULL) + { + b->ParentLocalBridge = NULL; + } + + // Stop session thread + StopSession(b->Session); + ReleaseSession(b->Session); + + Free(b); +} + +// Create new local-bridge +BRIDGE *BrNewBridge(HUB *h, char *name, POLICY *p, bool local, bool monitor, bool tapmode, char *tapaddr, bool limit_broadcast, LOCALBRIDGE *parent_local_bridge) +{ + BRIDGE *b; + POLICY *policy; + THREAD *t; + // Validate arguments + if (h == NULL || name == NULL || parent_local_bridge == NULL) + { + return NULL; + } + + if (p == NULL) + { + policy = ClonePolicy(GetDefaultPolicy()); + } + else + { + policy = ClonePolicy(p); + } + + b = ZeroMalloc(sizeof(BRIDGE)); + b->Cedar = h->Cedar; + b->Hub = h; + StrCpy(b->Name, sizeof(b->Name), name); + b->Policy = policy; + b->Local = local; + b->Monitor = monitor; + b->TapMode = tapmode; + b->LimitBroadcast = limit_broadcast; + b->ParentLocalBridge = parent_local_bridge; + + if (b->TapMode) + { + if (tapaddr != NULL && IsZero(tapaddr, 6) == false) + { + Copy(b->TapMacAddress, tapaddr, 6); + } + else + { + GenMacAddress(b->TapMacAddress); + } + } + + if (monitor) + { + // Enabling monitoring mode + policy->MonitorPort = true; + } + + if (b->LimitBroadcast == false) + { + // Disable broadcast limiter + policy->NoBroadcastLimiter = true; + } + + // Start thread + t = NewThread(BrBridgeThread, b); + WaitThreadInit(t); + ReleaseThread(t); + + return b; +} + +// Raw IP bridge is supported only on Linux +bool IsRawIpBridgeSupported() +{ +#ifdef UNIX_LINUX + return true; +#else // UNIX_LINUX + return false; +#endif // UNIX_LINUX +} + diff --git a/src/Cedar/Bridge.h b/src/Cedar/Bridge.h index c3ff9815..77d7a4e9 100644 --- a/src/Cedar/Bridge.h +++ b/src/Cedar/Bridge.h @@ -1,76 +1,76 @@ -// SoftEther VPN Source Code - Developer Edition Master Branch -// Cedar Communication Module - - -// Bridge.h -// Header of Bridge.c - -#ifndef BRIDGE_H -#define BRIDGE_H - -#ifdef OS_WIN32 - -// For Win32 -#include - -#else - -// For Unix -#include - -#endif // OS_WIN32 - -// Constants -#define BRIDGE_SPECIAL_IPRAW_NAME "ipv4_rawsocket_virtual_router" - -// Bridge -struct BRIDGE -{ - bool Active; // Status - CEDAR *Cedar; // Cedar - HUB *Hub; // HUB - SESSION *Session; // Session - POLICY *Policy; // Policy - ETH *Eth; // Ethernet - char Name[MAX_SIZE]; // Device name - UINT64 LastBridgeTry; // Time to try to bridge at last - bool Local; // Local mode - bool Monitor; // Monitor mode - bool TapMode; // Tap mode - bool LimitBroadcast; // Broadcasts limiting mode - UCHAR TapMacAddress[6]; // MAC address of the tap - UINT LastNumDevice; // Number of device (Number of last checked) - UINT64 LastNumDeviceCheck; // Time at which to check the number of devices at last - UINT64 LastChangeMtuError; // Time that recorded the error to change the MTU at last - LOCALBRIDGE *ParentLocalBridge; // Parent Local Bridge -}; - -// Local bridge -struct LOCALBRIDGE -{ - char HubName[MAX_HUBNAME_LEN + 1]; // Virtual HUB name - char DeviceName[MAX_SIZE]; // Device name - bool Local; // Local mode - bool Monitor; // Monitor mode - bool TapMode; // Tap mode - bool LimitBroadcast; // Broadcast packets limiting mode - UCHAR TapMacAddress[6]; // MAC address of the tap - BRIDGE *Bridge; // Bridge -}; - -BRIDGE *BrNewBridge(HUB *h, char *name, POLICY *p, bool local, bool monitor, bool tapmode, char *tapaddr, bool limit_broadcast, LOCALBRIDGE *parent_local_bridge); -void BrBridgeThread(THREAD *thread, void *param); -void BrFreeBridge(BRIDGE *b); -void InitLocalBridgeList(CEDAR *c); -void FreeLocalBridgeList(CEDAR *c); -void AddLocalBridge(CEDAR *c, char *hubname, char *devicename, bool local, bool monitor, bool tapmode, char *tapaddr, bool limit_broadcast); -bool DeleteLocalBridge(CEDAR *c, char *hubname, char *devicename); -bool IsBridgeSupported(); -bool IsNeedWinPcap(); -UINT GetEthDeviceHash(); -bool IsRawIpBridgeSupported(); - -#endif // BRIDGE_H - - - +// SoftEther VPN Source Code - Developer Edition Master Branch +// Cedar Communication Module + + +// Bridge.h +// Header of Bridge.c + +#ifndef BRIDGE_H +#define BRIDGE_H + +#ifdef OS_WIN32 + +// For Win32 +#include + +#else + +// For Unix +#include + +#endif // OS_WIN32 + +// Constants +#define BRIDGE_SPECIAL_IPRAW_NAME "ipv4_rawsocket_virtual_router" + +// Bridge +struct BRIDGE +{ + bool Active; // Status + CEDAR *Cedar; // Cedar + HUB *Hub; // HUB + SESSION *Session; // Session + POLICY *Policy; // Policy + ETH *Eth; // Ethernet + char Name[MAX_SIZE]; // Device name + UINT64 LastBridgeTry; // Time to try to bridge at last + bool Local; // Local mode + bool Monitor; // Monitor mode + bool TapMode; // Tap mode + bool LimitBroadcast; // Broadcasts limiting mode + UCHAR TapMacAddress[6]; // MAC address of the tap + UINT LastNumDevice; // Number of device (Number of last checked) + UINT64 LastNumDeviceCheck; // Time at which to check the number of devices at last + UINT64 LastChangeMtuError; // Time that recorded the error to change the MTU at last + LOCALBRIDGE *ParentLocalBridge; // Parent Local Bridge +}; + +// Local bridge +struct LOCALBRIDGE +{ + char HubName[MAX_HUBNAME_LEN + 1]; // Virtual HUB name + char DeviceName[MAX_SIZE]; // Device name + bool Local; // Local mode + bool Monitor; // Monitor mode + bool TapMode; // Tap mode + bool LimitBroadcast; // Broadcast packets limiting mode + UCHAR TapMacAddress[6]; // MAC address of the tap + BRIDGE *Bridge; // Bridge +}; + +BRIDGE *BrNewBridge(HUB *h, char *name, POLICY *p, bool local, bool monitor, bool tapmode, char *tapaddr, bool limit_broadcast, LOCALBRIDGE *parent_local_bridge); +void BrBridgeThread(THREAD *thread, void *param); +void BrFreeBridge(BRIDGE *b); +void InitLocalBridgeList(CEDAR *c); +void FreeLocalBridgeList(CEDAR *c); +void AddLocalBridge(CEDAR *c, char *hubname, char *devicename, bool local, bool monitor, bool tapmode, char *tapaddr, bool limit_broadcast); +bool DeleteLocalBridge(CEDAR *c, char *hubname, char *devicename); +bool IsBridgeSupported(); +bool IsNeedWinPcap(); +UINT GetEthDeviceHash(); +bool IsRawIpBridgeSupported(); + +#endif // BRIDGE_H + + + diff --git a/src/Cedar/BridgeUnix.h b/src/Cedar/BridgeUnix.h index 7c1b7465..9e895617 100644 --- a/src/Cedar/BridgeUnix.h +++ b/src/Cedar/BridgeUnix.h @@ -1,133 +1,133 @@ -// SoftEther VPN Source Code - Developer Edition Master Branch -// Cedar Communication Module - - -// BridgeUnix.h -// Header of BridgeUnix.c - -#ifndef BRIDGEUNIX_H -#define BRIDGEUNIX_H - -// Macro -#ifndef SOL_PACKET -#define SOL_PACKET 263 -#endif -#ifndef ifr_newname -#define ifr_newname ifr_ifru.ifru_slave -#endif - -// Constants -#define UNIX_ETH_TMP_BUFFER_SIZE (2000) -#define SOLARIS_MAXDLBUF (32768) -#define BRIDGE_MAX_QUEUE_SIZE (4096*1500) - -// ETH structure -struct ETH -{ - char *Name; // Adapter name - char *Title; // Adapter title - CANCEL *Cancel; // Cancel object - int IfIndex; // Index - int Socket; // Socket - UINT InitialMtu; // Initial MTU value - UINT CurrentMtu; // Current MTU value - int SocketBsdIf; // BSD interface operation socket - UCHAR MacAddress[6]; // MAC address - -#ifdef BRIDGE_PCAP - void *Pcap; // Pcap descriptor - QUEUE *Queue; // Queue of the relay thread - UINT QueueSize; // Number of bytes in Queue - THREAD *CaptureThread; // Pcap relay thread -#endif // BRIDGE_PCAP - -#ifdef BRIDGE_BPF - UINT BufSize; // Buffer size to read the BPF (error for other) -#ifdef BRIDGE_BPF_THREAD - QUEUE *Queue; // Queue of the relay thread - UINT QueueSize; // Number of bytes in Queue - THREAD *CaptureThread; // BPF relay thread -#else // BRIDGE_BPF_THREAD - UCHAR *Buffer; // Buffer to read the BPF - UCHAR *Next; - int Rest; -#endif // BRIDGE_BPF_THREAD -#endif // BRIDGE_BPF - - VLAN *Tap; // tap - bool Linux_IsAuxDataSupported; // Is PACKET_AUXDATA supported - - bool IsRawIpMode; // RAW IP mode - SOCK *RawTcp, *RawUdp, *RawIcmp; // RAW sockets - bool RawIp_HasError; - UCHAR RawIpMyMacAddr[6]; - UCHAR RawIpYourMacAddr[6]; - IP MyIP; - IP YourIP; - QUEUE *RawIpSendQueue; - IP MyPhysicalIP; - IP MyPhysicalIPForce; - UCHAR *RawIP_TmpBuffer; - UINT RawIP_TmpBufferSize; -}; - -#if defined( BRIDGE_BPF ) || defined( BRIDGE_PCAP ) -struct CAPTUREBLOCK{ - UINT Size; - UCHAR *Buf; -}; -#endif // BRIDGE_BPF - - -// Function prototype -void InitEth(); -void FreeEth(); -bool IsEthSupported(); -bool IsEthSupportedLinux(); -bool IsEthSupportedSolaris(); -bool IsEthSupportedPcap(); -TOKEN_LIST *GetEthList(); -TOKEN_LIST *GetEthListEx(UINT *total_num_including_hidden, bool enum_normal, bool enum_rawip); -TOKEN_LIST *GetEthListLinux(bool enum_normal, bool enum_rawip); -TOKEN_LIST *GetEthListSolaris(); -TOKEN_LIST *GetEthListPcap(); -ETH *OpenEth(char *name, bool local, bool tapmode, char *tapaddr); -ETH *OpenEthLinux(char *name, bool local, bool tapmode, char *tapaddr); -ETH *OpenEthSolaris(char *name, bool local, bool tapmode, char *tapaddr); -ETH *OpenEthPcap(char *name, bool local, bool tapmode, char *tapaddr); -bool ParseUnixEthDeviceName(char *dst_devname, UINT dst_devname_size, char *src_name); -void CloseEth(ETH *e); -CANCEL *EthGetCancel(ETH *e); -UINT EthGetPacket(ETH *e, void **data); -UINT EthGetPacketLinux(ETH *e, void **data); -UINT EthGetPacketSolaris(ETH *e, void **data); -UINT EthGetPacketPcap(ETH *e, void **data); -UINT EthGetPacketBpf(ETH *e, void **data); -void EthPutPacket(ETH *e, void *data, UINT size); -void EthPutPackets(ETH *e, UINT num, void **datas, UINT *sizes); -UINT EthGetMtu(ETH *e); -bool EthSetMtu(ETH *e, UINT mtu); -bool EthIsChangeMtuSupported(ETH *e); -bool EthGetInterfaceDescriptionUnix(char *name, char *str, UINT size); -bool EthIsInterfaceDescriptionSupportedUnix(); - -ETH *OpenEthLinuxIpRaw(); -void CloseEthLinuxIpRaw(ETH *e); -UINT EthGetPacketLinuxIpRaw(ETH *e, void **data); -UINT EthGetPacketLinuxIpRawForSock(ETH *e, void **data, SOCK *s, UINT proto); -void EthPutPacketLinuxIpRaw(ETH *e, void *data, UINT size); -bool EthProcessIpPacketInnerIpRaw(ETH *e, PKT *p); -void EthSendIpPacketInnerIpRaw(ETH *e, void *data, UINT size, USHORT protocol); - -#ifdef UNIX_SOLARIS -// Function prototype for Solaris -bool DlipReceiveAck(int fd); -bool DlipPromiscuous(int fd, UINT level); -bool DlipBindRequest(int fd); -#endif // OS_SOLARIS - -int UnixEthOpenRawSocket(); - -#endif // BRIDGEUNIX_H - - +// SoftEther VPN Source Code - Developer Edition Master Branch +// Cedar Communication Module + + +// BridgeUnix.h +// Header of BridgeUnix.c + +#ifndef BRIDGEUNIX_H +#define BRIDGEUNIX_H + +// Macro +#ifndef SOL_PACKET +#define SOL_PACKET 263 +#endif +#ifndef ifr_newname +#define ifr_newname ifr_ifru.ifru_slave +#endif + +// Constants +#define UNIX_ETH_TMP_BUFFER_SIZE (2000) +#define SOLARIS_MAXDLBUF (32768) +#define BRIDGE_MAX_QUEUE_SIZE (4096*1500) + +// ETH structure +struct ETH +{ + char *Name; // Adapter name + char *Title; // Adapter title + CANCEL *Cancel; // Cancel object + int IfIndex; // Index + int Socket; // Socket + UINT InitialMtu; // Initial MTU value + UINT CurrentMtu; // Current MTU value + int SocketBsdIf; // BSD interface operation socket + UCHAR MacAddress[6]; // MAC address + +#ifdef BRIDGE_PCAP + void *Pcap; // Pcap descriptor + QUEUE *Queue; // Queue of the relay thread + UINT QueueSize; // Number of bytes in Queue + THREAD *CaptureThread; // Pcap relay thread +#endif // BRIDGE_PCAP + +#ifdef BRIDGE_BPF + UINT BufSize; // Buffer size to read the BPF (error for other) +#ifdef BRIDGE_BPF_THREAD + QUEUE *Queue; // Queue of the relay thread + UINT QueueSize; // Number of bytes in Queue + THREAD *CaptureThread; // BPF relay thread +#else // BRIDGE_BPF_THREAD + UCHAR *Buffer; // Buffer to read the BPF + UCHAR *Next; + int Rest; +#endif // BRIDGE_BPF_THREAD +#endif // BRIDGE_BPF + + VLAN *Tap; // tap + bool Linux_IsAuxDataSupported; // Is PACKET_AUXDATA supported + + bool IsRawIpMode; // RAW IP mode + SOCK *RawTcp, *RawUdp, *RawIcmp; // RAW sockets + bool RawIp_HasError; + UCHAR RawIpMyMacAddr[6]; + UCHAR RawIpYourMacAddr[6]; + IP MyIP; + IP YourIP; + QUEUE *RawIpSendQueue; + IP MyPhysicalIP; + IP MyPhysicalIPForce; + UCHAR *RawIP_TmpBuffer; + UINT RawIP_TmpBufferSize; +}; + +#if defined( BRIDGE_BPF ) || defined( BRIDGE_PCAP ) +struct CAPTUREBLOCK{ + UINT Size; + UCHAR *Buf; +}; +#endif // BRIDGE_BPF + + +// Function prototype +void InitEth(); +void FreeEth(); +bool IsEthSupported(); +bool IsEthSupportedLinux(); +bool IsEthSupportedSolaris(); +bool IsEthSupportedPcap(); +TOKEN_LIST *GetEthList(); +TOKEN_LIST *GetEthListEx(UINT *total_num_including_hidden, bool enum_normal, bool enum_rawip); +TOKEN_LIST *GetEthListLinux(bool enum_normal, bool enum_rawip); +TOKEN_LIST *GetEthListSolaris(); +TOKEN_LIST *GetEthListPcap(); +ETH *OpenEth(char *name, bool local, bool tapmode, char *tapaddr); +ETH *OpenEthLinux(char *name, bool local, bool tapmode, char *tapaddr); +ETH *OpenEthSolaris(char *name, bool local, bool tapmode, char *tapaddr); +ETH *OpenEthPcap(char *name, bool local, bool tapmode, char *tapaddr); +bool ParseUnixEthDeviceName(char *dst_devname, UINT dst_devname_size, char *src_name); +void CloseEth(ETH *e); +CANCEL *EthGetCancel(ETH *e); +UINT EthGetPacket(ETH *e, void **data); +UINT EthGetPacketLinux(ETH *e, void **data); +UINT EthGetPacketSolaris(ETH *e, void **data); +UINT EthGetPacketPcap(ETH *e, void **data); +UINT EthGetPacketBpf(ETH *e, void **data); +void EthPutPacket(ETH *e, void *data, UINT size); +void EthPutPackets(ETH *e, UINT num, void **datas, UINT *sizes); +UINT EthGetMtu(ETH *e); +bool EthSetMtu(ETH *e, UINT mtu); +bool EthIsChangeMtuSupported(ETH *e); +bool EthGetInterfaceDescriptionUnix(char *name, char *str, UINT size); +bool EthIsInterfaceDescriptionSupportedUnix(); + +ETH *OpenEthLinuxIpRaw(); +void CloseEthLinuxIpRaw(ETH *e); +UINT EthGetPacketLinuxIpRaw(ETH *e, void **data); +UINT EthGetPacketLinuxIpRawForSock(ETH *e, void **data, SOCK *s, UINT proto); +void EthPutPacketLinuxIpRaw(ETH *e, void *data, UINT size); +bool EthProcessIpPacketInnerIpRaw(ETH *e, PKT *p); +void EthSendIpPacketInnerIpRaw(ETH *e, void *data, UINT size, USHORT protocol); + +#ifdef UNIX_SOLARIS +// Function prototype for Solaris +bool DlipReceiveAck(int fd); +bool DlipPromiscuous(int fd, UINT level); +bool DlipBindRequest(int fd); +#endif // OS_SOLARIS + +int UnixEthOpenRawSocket(); + +#endif // BRIDGEUNIX_H + + diff --git a/src/Cedar/BridgeWin32.c b/src/Cedar/BridgeWin32.c index eca7952a..462275b1 100644 --- a/src/Cedar/BridgeWin32.c +++ b/src/Cedar/BridgeWin32.c @@ -1,2139 +1,2139 @@ -// SoftEther VPN Source Code - Developer Edition Master Branch -// Cedar Communication Module - - -// BridgeWin32.c -// Ethernet Bridge Program (Win32) - -#include - -#ifdef BRIDGE_C - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - - -static WP *wp = NULL; -static LIST *eth_list = NULL; - -static LOCK *eth_list_lock = NULL; -static bool is_see_mode = false; -static bool is_using_selow = false; -static bool enable_selow = true; - -static bool g_bridge_win32_show_all_if = false; - -#define LOAD_DLL_ADDR(name) \ - { \ - void *addr = GetProcAddress(h, #name); \ - Copy(&wp->name, &addr, sizeof(void *)); \ - } - -// Set the flag which indicates whether using SeLow -void Win32SetEnableSeLow(bool b) -{ - enable_selow = b; -} - -// Get the flag which indicates whether using SeLow -bool Win32GetEnableSeLow() -{ - return enable_selow; -} - -// Set the flag which indicates whether enumerating all interfaces -void Win32EthSetShowAllIf(bool b) -{ - g_bridge_win32_show_all_if = b; -} - -// Get the flag which indicates whether enumerating all interfaces -bool Win32EthGetShowAllIf() -{ - return g_bridge_win32_show_all_if; -} - -// Compare Ethernet device list -int CmpRpcEnumEthVLan(void *p1, void *p2) -{ - RPC_ENUM_ETH_VLAN_ITEM *v1, *v2; - if (p1 == NULL || p2 == NULL) - { - return 0; - } - v1 = *((RPC_ENUM_ETH_VLAN_ITEM **)p1); - v2 = *((RPC_ENUM_ETH_VLAN_ITEM **)p2); - if (v1 == NULL || v2 == NULL) - { - return 0; - } - - return StrCmpi(v1->DeviceName, v2->DeviceName); -} - -// Get the value of MTU (Not supported in Windows) -UINT EthGetMtu(ETH *e) -{ - return 0; -} - -// Set the value of MTU (Not supported in Windows) -bool EthSetMtu(ETH *e, UINT mtu) -{ - return false; -} - -// Check whether setting MEU value (Not supported in Windows) -bool EthIsChangeMtuSupported(ETH *e) -{ - return false; -} - -// Set the state of VLAN tag pass-through -bool SetVLanEnableStatus(char *title, bool enable) -{ - RPC_ENUM_ETH_VLAN t; - RPC_ENUM_ETH_VLAN_ITEM *e; - bool ret = false; - char key[MAX_SIZE]; - char tcpkey[MAX_SIZE]; - char short_key[MAX_SIZE]; - // Validate arguments - if (title == NULL) - { - return false; - } - - Zero(&t, sizeof(t)); - if (EnumEthVLanWin32(&t) == false) - { - return false; - } - - e = FindEthVLanItem(&t, title); - - if (e != NULL) - { - if (GetClassRegKeyWin32(key, sizeof(key), short_key, sizeof(short_key), e->Guid)) - { - if (StrCmpi(e->DriverType, "Intel") == 0) - { - if (enable) - { - MsRegWriteStr(REG_LOCAL_MACHINE, key, "VlanFiltering", "0"); - MsRegWriteStr(REG_LOCAL_MACHINE, key, "TaggingMode", "0"); - MsRegWriteInt(REG_LOCAL_MACHINE, key, "MonitorMode", 1); - MsRegWriteInt(REG_LOCAL_MACHINE, key, "MonitorModeEnabled", 1); - } - else - { - if (MsRegReadInt(REG_LOCAL_MACHINE, key, "TaggingMode") == 0) - { - MsRegDeleteValue(REG_LOCAL_MACHINE, key, "TaggingMode"); - } - - if (MsRegReadInt(REG_LOCAL_MACHINE, key, "MonitorMode") == 1) - { - MsRegDeleteValue(REG_LOCAL_MACHINE, key, "MonitorMode"); - } - - if (MsRegReadInt(REG_LOCAL_MACHINE, key, "MonitorModeEnabled") == 1) - { - MsRegDeleteValue(REG_LOCAL_MACHINE, key, "MonitorModeEnabled"); - } - } - - ret = true; - } - else if (StrCmpi(e->DriverType, "Broadcom") == 0) - { - if (enable) - { - MsRegWriteStr(REG_LOCAL_MACHINE, key, "PreserveVlanInfoInRxPacket", "1"); - } - else - { - MsRegDeleteValue(REG_LOCAL_MACHINE, key, "PreserveVlanInfoInRxPacket"); - } - - ret = true; - } - else if (StrCmpi(e->DriverType, "Marvell") == 0) - { - if (enable) - { - MsRegWriteInt(REG_LOCAL_MACHINE, key, "SkDisableVlanStrip", 1); - } - else - { - MsRegDeleteValue(REG_LOCAL_MACHINE, key, "SkDisableVlanStrip"); - } - - ret = true; - } - - Format(tcpkey, sizeof(tcpkey), - "SYSTEM\\CurrentControlSet\\Services\\Tcpip\\Parameters\\Interfaces\\%s", - e->Guid); - - if (enable) - { - if (MsRegIsValue(REG_LOCAL_MACHINE, tcpkey, "MTU") == false) - { - MsRegWriteInt(REG_LOCAL_MACHINE, tcpkey, "MTU", 1500); - } - } - else - { - UINT mtu = MsRegReadInt(REG_LOCAL_MACHINE, tcpkey, "MTU"); - if (mtu == 1500) - { - MsRegDeleteValue(REG_LOCAL_MACHINE, tcpkey, "MTU"); - } - } - } - } - - FreeRpcEnumEthVLan(&t); - - return ret; -} - -// Find Ethernet device -RPC_ENUM_ETH_VLAN_ITEM *FindEthVLanItem(RPC_ENUM_ETH_VLAN *t, char *name) -{ - UINT i; - // Validate arguments - if (t == NULL || name == NULL) - { - return NULL; - } - - for (i = 0;i < t->NumItem;i++) - { - if (StrCmpi(t->Items[i].DeviceName, name) == 0) - { - return &t->Items[i]; - } - } - - return NULL; -} - -// Get the state of VLAN tag pass-through -void GetVLanEnableStatus(RPC_ENUM_ETH_VLAN_ITEM *e) -{ - char key[MAX_SIZE]; - char short_key[MAX_SIZE]; - char tcpkey[MAX_SIZE]; - // Validate arguments - if (e == NULL) - { - return; - } - - e->Enabled = false; - - if (e->Support == false) - { - return; - } - - if (GetClassRegKeyWin32(key, sizeof(key), short_key, sizeof(short_key), e->Guid) == false) - { - return; - } - - Format(tcpkey, sizeof(tcpkey), - "SYSTEM\\CurrentControlSet\\Services\\Tcpip\\Parameters\\Interfaces\\%s", - e->Guid); - - if (StrCmpi(e->DriverType, "Intel") == 0) - { - char *VlanFiltering = MsRegReadStr(REG_LOCAL_MACHINE, key, "VlanFiltering"); - UINT MonitorMode = MsRegReadInt(REG_LOCAL_MACHINE, key, "MonitorMode"); - UINT MonitorModeEnabled = MsRegReadInt(REG_LOCAL_MACHINE, key, "MonitorModeEnabled"); - char *TaggingMode = MsRegReadStr(REG_LOCAL_MACHINE, key, "TaggingMode"); - - if (StrCmpi(VlanFiltering, "0") == 0 && - MonitorMode == 1 && - MonitorModeEnabled == 1 && - StrCmpi(TaggingMode, "0") == 0) - { - e->Enabled = true; - } - - Free(VlanFiltering); - Free(TaggingMode); - } - else if (StrCmpi(e->DriverType, "Broadcom") == 0) - { - char *PreserveVlanInfoInRxPacket = MsRegReadStr(REG_LOCAL_MACHINE, - key, "PreserveVlanInfoInRxPacket"); - - if (StrCmpi(PreserveVlanInfoInRxPacket, "1") == 0) - { - e->Enabled = true; - } - - Free(PreserveVlanInfoInRxPacket); - } - else if (StrCmpi(e->DriverType, "Marvell") == 0) - { - DWORD SkDisableVlanStrip = MsRegReadInt(REG_LOCAL_MACHINE, - key, "SkDisableVlanStrip"); - - if (SkDisableVlanStrip == 1) - { - e->Enabled = true; - } - } - - if (MsRegIsValue(REG_LOCAL_MACHINE, tcpkey, "MTU") == false) - { - e->Enabled = false; - } -} - -// Get VLAN tag pass-through availability of the device -void GetVLanSupportStatus(RPC_ENUM_ETH_VLAN_ITEM *e) -{ - BUF *b; - char filename[MAX_SIZE]; - void *wow; - // Validate arguments - if (e == NULL) - { - return; - } - - wow = MsDisableWow64FileSystemRedirection(); - - // Read the device driver file - CombinePath(filename, sizeof(filename), MsGetSystem32Dir(), "drivers"); - CombinePath(filename, sizeof(filename), filename, e->DriverName); - - b = ReadDump(filename); - - if (b != NULL) - { - char intel1[] = "VlanFiltering"; - char intel2[] = "V\0l\0a\0n\0F\0i\0l\0t\0e\0r\0i\0n\0g"; - char intel3[] = "MonitorMode"; - char intel4[] = "M\0o\0n\0i\0t\0o\0r\0M\0o\0d\0e"; - char intel5[] = "TaggingMode"; - char intel6[] = "T\0a\0g\0g\0i\0n\0g\0M\0o\0d\0e"; - char broadcom1[] = "PreserveVlanInfoInRxPacket"; - char broadcom2[] = "P\0r\0e\0s\0e\0r\0v\0e\0V\0l\0a\0n\0I\0n\0f\0o\0I\0n\0R\0x\0P\0a\0c\0k\0e\0t"; - char marvell1[] = "SkDisableVlanStrip"; - char marvell2[] = "S\0k\0D\0i\0s\0a\0b\0l\0e\0V\0l\0a\0n\0S\0t\0r\0i\0p"; - char *driver_type = ""; - - if (SearchBin(b->Buf, 0, b->Size, intel1, sizeof(intel1)) != INFINITE - || SearchBin(b->Buf, 0, b->Size, intel2, sizeof(intel2)) != INFINITE - || SearchBin(b->Buf, 0, b->Size, intel3, sizeof(intel3)) != INFINITE - || SearchBin(b->Buf, 0, b->Size, intel4, sizeof(intel4)) != INFINITE - || SearchBin(b->Buf, 0, b->Size, intel5, sizeof(intel5)) != INFINITE - || SearchBin(b->Buf, 0, b->Size, intel6, sizeof(intel6)) != INFINITE) - { - driver_type = "Intel"; - } - else if (SearchBin(b->Buf, 0, b->Size, broadcom1, sizeof(broadcom1)) != INFINITE - || SearchBin(b->Buf, 0, b->Size, broadcom2, sizeof(broadcom2)) != INFINITE) - { - driver_type = "Broadcom"; - } - else if (SearchBin(b->Buf, 0, b->Size, marvell1, sizeof(marvell1)) != INFINITE - || SearchBin(b->Buf, 0, b->Size, marvell2, sizeof(marvell2)) != INFINITE) - { - driver_type = "Marvell"; - } - - if (IsEmptyStr(driver_type) == false) - { - StrCpy(e->DriverType, sizeof(e->DriverType), driver_type); - e->Support = true; - } - - FreeBuf(b); - } - - MsRestoreWow64FileSystemRedirection(wow); -} - -// Get the device instance id from short_key -char *SearchDeviceInstanceIdFromShortKey(char *short_key) -{ - char *ret = NULL; - TOKEN_LIST *t1; - // Validate arguments - if (short_key == NULL) - { - return NULL; - } - - t1 = MsRegEnumKey(REG_LOCAL_MACHINE, "SYSTEM\\CurrentControlSet\\Enum"); - - if (t1 != NULL) - { - TOKEN_LIST *t2; - char tmp[MAX_SIZE]; - UINT i; - - for (i = 0;i < t1->NumTokens;i++) - { - Format(tmp, sizeof(tmp), "SYSTEM\\CurrentControlSet\\Enum\\%s", t1->Token[i]); - - t2 = MsRegEnumKey(REG_LOCAL_MACHINE, tmp); - - if (t2 != NULL) - { - TOKEN_LIST *t3; - UINT i; - - for (i = 0;i < t2->NumTokens;i++) - { - char tmp2[MAX_SIZE]; - - Format(tmp2, sizeof(tmp2), "%s\\%s", tmp, t2->Token[i]); - - t3 = MsRegEnumKey(REG_LOCAL_MACHINE, tmp2); - - if (t3 != NULL) - { - UINT i; - - for (i = 0;i < t3->NumTokens;i++) - { - char tmp3[MAX_SIZE]; - char *s; - - Format(tmp3, sizeof(tmp3), "%s\\%s", tmp2, t3->Token[i]); - - s = MsRegReadStr(REG_LOCAL_MACHINE, tmp3, "Driver"); - - if (s != NULL) - { - if (StrCmpi(s, short_key) == 0) - { - if (ret != NULL) - { - Free(ret); - } - - ret = CopyStr(tmp3 + StrLen("SYSTEM\\CurrentControlSet\\Enum\\")); - } - - Free(s); - } - } - - FreeToken(t3); - } - } - - FreeToken(t2); - } - } - - FreeToken(t1); - } - - return ret; -} - -// Get VLAN tag pass-through availability of all devices -bool EnumEthVLanWin32(RPC_ENUM_ETH_VLAN *t) -{ - UINT i; - LIST *o; - // Validate arguments - if (t == NULL) - { - return false; - } - - Zero(t, sizeof(RPC_ENUM_ETH_VLAN)); - - if (MsIsWin2000OrGreater() == false) - { - return false; - } - - if (IsEthSupported() == false) - { - return false; - } - - // Get device list - Lock(eth_list_lock); - - InitEthAdaptersList(); - - o = NewListFast(CmpRpcEnumEthVLan); - - for (i = 0;i < LIST_NUM(eth_list);i++) - { - WP_ADAPTER *a = LIST_DATA(eth_list, i); - - if (IsEmptyStr(a->Guid) == false) - { - char class_key[MAX_SIZE]; - char short_key[MAX_SIZE]; - - if (GetClassRegKeyWin32(class_key, sizeof(class_key), - short_key, sizeof(short_key), a->Guid)) - { - char *device_instance_id = MsRegReadStr(REG_LOCAL_MACHINE, class_key, "DeviceInstanceID"); - - if (IsEmptyStr(device_instance_id)) - { - Free(device_instance_id); - device_instance_id = SearchDeviceInstanceIdFromShortKey(short_key); - } - - if (IsEmptyStr(device_instance_id) == false) - { - char device_key[MAX_SIZE]; - char *service_name; - - Format(device_key, sizeof(device_key), "SYSTEM\\CurrentControlSet\\Enum\\%s", - device_instance_id); - - service_name = MsRegReadStr(REG_LOCAL_MACHINE, device_key, "Service"); - if (IsEmptyStr(service_name) == false) - { - char service_key[MAX_SIZE]; - char *sys; - - Format(service_key, sizeof(service_key), - "SYSTEM\\CurrentControlSet\\services\\%s", - service_name); - - sys = MsRegReadStr(REG_LOCAL_MACHINE, service_key, "ImagePath"); - - if (IsEmptyStr(sys) == false) - { - char sysname[MAX_PATH]; - - GetFileNameFromFilePath(sysname, sizeof(sysname), sys); - - Trim(sysname); - - if (EndWith(sysname, ".sys")) - { - // device found - RPC_ENUM_ETH_VLAN_ITEM *e = ZeroMalloc(sizeof(RPC_ENUM_ETH_VLAN_ITEM)); - - StrCpy(e->DeviceName, sizeof(e->DeviceName), a->Title); - StrCpy(e->Guid, sizeof(e->Guid), a->Guid); - StrCpy(e->DeviceInstanceId, sizeof(e->DeviceInstanceId), device_instance_id); - StrCpy(e->DriverName, sizeof(e->DriverName), sysname); - - // Get VLAN tag pass-through availability of the device - GetVLanSupportStatus(e); - - // Get current pass-through setting of the device - GetVLanEnableStatus(e); - - Insert(o, e); - } - } - - Free(sys); - } - - Free(service_name); - } - - Free(device_instance_id); - } - } - } - - t->NumItem = LIST_NUM(o); - t->Items = ZeroMalloc(sizeof(RPC_ENUM_ETH_VLAN_ITEM) * i); - - for (i = 0;i < LIST_NUM(o);i++) - { - RPC_ENUM_ETH_VLAN_ITEM *e = LIST_DATA(o, i); - - Copy(&t->Items[i], e, sizeof(RPC_ENUM_ETH_VLAN_ITEM)); - - Free(e); - } - - ReleaseList(o); - - Unlock(eth_list_lock); - - return true; -} - -// Get registry key of the network class data by GUID -bool GetClassRegKeyWin32(char *key, UINT key_size, char *short_key, UINT short_key_size, char *guid) -{ - TOKEN_LIST *t; - bool ret = false; - UINT i; - // Validate arguments - if (key == NULL || short_key == NULL || guid == NULL) - { - return false; - } - - t = MsRegEnumKey(REG_LOCAL_MACHINE, - "SYSTEM\\CurrentControlSet\\Control\\Class\\{4D36E972-E325-11CE-BFC1-08002BE10318}"); - if (t == NULL) - { - return false; - } - - for (i = 0;i < t->NumTokens;i++) - { - char keyname[MAX_SIZE]; - char *value; - - Format(keyname, sizeof(keyname), - "SYSTEM\\CurrentControlSet\\Control\\Class\\{4D36E972-E325-11CE-BFC1-08002BE10318}\\%s", - t->Token[i]); - - value = MsRegReadStr(REG_LOCAL_MACHINE, keyname, "NetCfgInstanceId"); - - if (StrCmpi(value, guid) == 0) - { - ret = true; - - StrCpy(key, key_size, keyname); - - Format(short_key, short_key_size, "{4D36E972-E325-11CE-BFC1-08002BE10318}\\%s", - t->Token[i]); - } - - Free(value); - } - - FreeToken(t); - - return ret; -} - -// Send multiple packets -void EthPutPackets(ETH *e, UINT num, void **datas, UINT *sizes) -{ - UINT i, total_size; - UCHAR *buf; - UINT write_pointer; - UINT err = 0; - // Validate arguments - if (e == NULL || num == 0 || datas == NULL || sizes == NULL) - { - return; - } - if (e->HasFatalError) - { - return; - } - - if (e->SuAdapter != NULL) - { - bool ok = true; - - // Send packets with SeLow - for (i = 0;i < num;i++) - { - UCHAR *data = datas[i]; - UINT size = sizes[i]; - - if (ok) - { - // Actually, only enqueuing - ok = SuPutPacket(e->SuAdapter, data, size); - } - - if (ok == false) - { - // Free memory on write error - Free(data); - } - } - - if (ok) - { - // Send all data in queue at once - ok = SuPutPacket(e->SuAdapter, NULL, 0); - } - - if (ok == false) - { - // Error occurred - e->HasFatalError = true; - } - - return; - } - - if (IsWin32BridgeWithSee() == false) - { - if (e->LastSetSingleCpu == 0 || (e->LastSetSingleCpu + 10000) <= Tick64()) - { - e->LastSetSingleCpu = Tick64(); - MsSetThreadSingleCpu(); - } - } - - // Calculate buffer size - total_size = 0; - for (i = 0;i < num;i++) - { - void *data = datas[i]; - UINT size = sizes[i]; - if (data != NULL && size >= 14 && size <= MAX_PACKET_SIZE) - { - total_size += size + sizeof(struct dump_bpf_hdr); - } - } - - buf = MallocFast(total_size * 100 / 75 + 1600); - - write_pointer = 0; - // Enqueue - for (i = 0;i < num;i++) - { - void *data = datas[i]; - UINT size = sizes[i]; - if (data != NULL && size >= 14 && size <= MAX_PACKET_SIZE) - { - struct dump_bpf_hdr *h; - - h = (struct dump_bpf_hdr *)(buf + write_pointer); - Zero(h, sizeof(struct dump_bpf_hdr)); - h->caplen = h->len = size; - write_pointer += sizeof(struct dump_bpf_hdr); - Copy(buf + write_pointer, data, size); - write_pointer += size; - - PROBE_DATA2("EthPutPackets", data, size); - } - // Free original buffer - Free(data); - } - - // Send - if (total_size != 0) - { - err = wp->PacketSendPackets(e->Adapter, buf, total_size, true); - } - - Free(buf); - - if (err == 0x7FFFFFFF) - { - // Critical error (infinite loop) occurred on sending - e->HasFatalError = true; - } -} - -// Send a packet -void EthPutPacket(ETH *e, void *data, UINT size) -{ - // Validate arguments - if (e == NULL || data == NULL || size == 0) - { - return; - } - - EthPutPackets(e, 1, &data, &size); -} - -// Read next packet -UINT EthGetPacket(ETH *e, void **data) -{ - BLOCK *b; - bool flag = false; - // Validate arguments - if (e == NULL || data == NULL) - { - return INFINITE; - } - if (e->HasFatalError) - { - return INFINITE; - } - - if (e->SuAdapter != NULL) - { - // Read packet with SeLow - UINT size; - if (SuGetNextPacket(e->SuAdapter, data, &size) == false) - { - // Error occurred - e->HasFatalError = true; - return INFINITE; - } - - return size; - } - -RETRY: - // Check the presence of the packet in queue - b = GetNext(e->PacketQueue); - if (b != NULL) - { - UINT size; - size = b->Size; - *data = b->Buf; - Free(b); - - if (e->PacketQueue->num_item == 0) - { - e->Empty = true; - } - - return size; - } - - if (e->Empty) - { - e->Empty = false; - return 0; - } - - if (flag == false) - { - // Try to get next packet - PROBE_STR("EthGetPacket: PacketInitPacket"); - wp->PacketInitPacket(e->Packet, e->Buffer, e->BufferSize); - PROBE_STR("EthGetPacket: PacketReceivePacket"); - if (wp->PacketReceivePacket(e->Adapter, e->Packet, false) == false) - { - // Failed - return INFINITE; - } - else - { - UCHAR *buf; - UINT total; - UINT offset; - - buf = (UCHAR *)e->Packet->Buffer; - total = e->Packet->ulBytesReceived; - offset = 0; - - while (offset < total) - { - struct bpf_hdr *header; - UINT packet_size; - UCHAR *packet_data; - - header = (struct bpf_hdr *)(buf + offset); - packet_size = header->bh_caplen; - offset += header->bh_hdrlen; - packet_data = buf + offset; - offset = Packet_WORDALIGN(offset + packet_size); - - if (packet_size >= 14) - { - UCHAR *tmp; - BLOCK *b; - - PROBE_DATA2("EthGetPacket: NewBlock", packet_data, packet_size); - - tmp = MallocFast(packet_size); - - Copy(tmp, packet_data, packet_size); - b = NewBlock(tmp, packet_size, 0); - InsertQueue(e->PacketQueue, b); - } - } - - flag = true; - goto RETRY; - } - } - - // No more packet - return 0; -} - -// Get cancel object -CANCEL *EthGetCancel(ETH *e) -{ - // Validate arguments - if (e == NULL) - { - return NULL; - } - - AddRef(e->Cancel->ref); - - return e->Cancel; -} - -// Close adapter -void CloseEth(ETH *e) -{ - BLOCK *b; - // Validate arguments - if (e == NULL) - { - return; - } - - ReleaseCancel(e->Cancel); - - if (e->SuAdapter != NULL) - { - // Close SeLow adapter - SuCloseAdapter(e->SuAdapter); - SuFree(e->Su); - } - else - { - // Close SEE adapter - wp->PacketCloseAdapter(e->Adapter); - wp->PacketFreePacket(e->Packet); - wp->PacketFreePacket(e->PutPacket); - } - - while (b = GetNext(e->PacketQueue)) - { - FreeBlock(b); - } - ReleaseQueue(e->PacketQueue); - - Free(e->Name); - Free(e->Title); - Free(e->Buffer); - - Free(e); -} - -// Search adapter with the name -struct WP_ADAPTER *Win32EthSearch(char *name) -{ - UINT i; - UINT id; - char simple_name[MAX_SIZE]; - WP_ADAPTER *ret = NULL; - - id = Win32EthGetNameAndIdFromCombinedName(simple_name, sizeof(simple_name), name); - - if (id != 0) - { - UINT num_match = 0; - // Search with ID when ID is specified - for (i = 0;i < LIST_NUM(eth_list);i++) - { - WP_ADAPTER *a = LIST_DATA(eth_list, i); - - if (a->Id != 0 && a->Id == id) - { - ret = a; - num_match++; - } - } - - if (num_match >= 2) - { - // If the ID matches to 2 or more devices, search with the name - for (i = 0;i < LIST_NUM(eth_list);i++) - { - WP_ADAPTER *a = LIST_DATA(eth_list, i); - - if (a->Id != 0 && a->Id == id) - { - if (StrCmpi(a->Title, name) == 0) - { - ret = a; - break; - } - } - } - } - } - else - { - // Search with name when ID is not specified - for (i = 0;i < LIST_NUM(eth_list);i++) - { - WP_ADAPTER *a = LIST_DATA(eth_list, i); - - if (StrCmpi(a->Title, name) == 0) - { - ret = a; - break; - } - } - } - - return ret; -} - -// Open adapter -ETH *OpenEth(char *name, bool local, bool tapmode, char *tapaddr) -{ - ETH *ret; - void *p; - - p = MsDisableWow64FileSystemRedirection(); - - ret = OpenEthInternal(name, local, tapmode, tapaddr); - - MsRestoreWow64FileSystemRedirection(p); - - return ret; -} -ETH *OpenEthInternal(char *name, bool local, bool tapmode, char *tapaddr) -{ - WP_ADAPTER *t; - ETH *e; - ADAPTER *a = NULL; - HANDLE h; - CANCEL *c; - MS_ADAPTER *ms; - char name_with_id[MAX_SIZE]; - SU *su = NULL; - SU_ADAPTER *su_adapter = NULL; - // Validate arguments - if (name == NULL || IsEthSupported() == false) - { - return NULL; - } - - if (tapmode) - { - // Tap is not supported in Windows - return NULL; - } - - Lock(eth_list_lock); - - InitEthAdaptersList(); - - t = Win32EthSearch(name); - - if (t == NULL) - { - Unlock(eth_list_lock); - return NULL; - } - - Debug("OpenEthInternal: %s\n", t->Name); - - if (StartWith(t->Name, SL_ADAPTER_ID_PREFIX)) - { - // Open with SU - su = SuInit(); - if (su == NULL) - { - // Fail to initialize SU - Unlock(eth_list_lock); - return NULL; - } - - su_adapter = SuOpenAdapter(su, t->Name); - - if (su_adapter == NULL) - { - // Fail to get adapter - SuFree(su); - Unlock(eth_list_lock); - return NULL; - } - - is_using_selow = true; - } - else - { - // Open with SEE - a = wp->PacketOpenAdapter(t->Name); - if (a == NULL) - { - Unlock(eth_list_lock); - return NULL; - } - - if (IsWin32BridgeWithSee() == false) - { - MsSetThreadSingleCpu(); - } - - is_using_selow = false; - } - - e = ZeroMalloc(sizeof(ETH)); - e->Name = CopyStr(t->Name); - - Win32EthMakeCombinedName(name_with_id, sizeof(name_with_id), t->Title, t->Guid); - e->Title = CopyStr(name_with_id); - - if (su_adapter != NULL) - { - // SU - e->SuAdapter = su_adapter; - e->Su = su; - - // Get event object - h = e->SuAdapter->hEvent; - - c = NewCancelSpecial(h); - e->Cancel = c; - } - else - { - // SEE - e->Adapter = a; - - wp->PacketSetBuff(e->Adapter, BRIDGE_WIN32_ETH_BUFFER); - wp->PacketSetHwFilter(e->Adapter, local ? 0x0080 : 0x0020); - wp->PacketSetMode(e->Adapter, PACKET_MODE_CAPT); - wp->PacketSetReadTimeout(e->Adapter, -1); - wp->PacketSetNumWrites(e->Adapter, 1); - - if (wp->PacketSetLoopbackBehavior != NULL) - { - // Filter loopback packet in kernel - if (GET_KETA(GetOsType(), 100) >= 3) - { - if (MsIsWindows8() == false) - { - // Enable for Windows XP, Server 2003 or later - // But disable for Windows 8 or later - bool ret = wp->PacketSetLoopbackBehavior(e->Adapter, 1); - Debug("*** PacketSetLoopbackBehavior: %u\n", ret); - - e->LoopbackBlock = ret; - } - } - } - - // Get event object - h = wp->PacketGetReadEvent(e->Adapter); - - c = NewCancelSpecial(h); - e->Cancel = c; - - e->Packet = wp->PacketAllocatePacket(); - - e->PutPacket = wp->PacketAllocatePacket(); - } - - e->Buffer = Malloc(BRIDGE_WIN32_ETH_BUFFER); - e->BufferSize = BRIDGE_WIN32_ETH_BUFFER; - - e->PacketQueue = NewQueue(); - - // Get MAC address by GUID - ms = MsGetAdapterByGuid(t->Guid); - if (ms != NULL) - { - if (ms->AddressSize == 6) - { - Copy(e->MacAddress, ms->Address, 6); - } - - MsFreeAdapter(ms); - } - - Unlock(eth_list_lock); - - return e; -} - -// Generate a combined name from NIC name and GUID -void Win32EthMakeCombinedName(char *dst, UINT dst_size, char *nicname, char *guid) -{ - // Validate arguments - if (dst == NULL || nicname == NULL || guid == NULL) - { - return; - } - - if (IsEmptyStr(guid) == false) - { - Format(dst, dst_size, "%s (ID=%010u)", nicname, Win32EthGenIdFromGuid(guid)); - } - else - { - StrCpy(dst, dst_size, nicname); - } -} - -// Decompose combined name -UINT Win32EthGetNameAndIdFromCombinedName(char *name, UINT name_size, char *str) -{ - UINT ret = 0; - char id_str[MAX_SIZE]; - UINT len; - // Validate arguments - ClearStr(name, name_size); - StrCpy(name, name_size, str); - if (name == NULL || str == NULL) - { - return 0; - } - - len = StrLen(str); - - if (len >= 16) - { - StrCpy(id_str, sizeof(id_str), str + len - 16); - - if (StartWith(id_str, " (ID=")) - { - if (EndWith(id_str, ")")) - { - char num[MAX_SIZE]; - - Zero(num, sizeof(num)); - StrCpy(num, sizeof(num), id_str + 5); - - num[StrLen(num) - 1] = 0; - - ret = ToInt(num); - - if (ret != 0) - { - name[len - 16] = 0; - } - } - } - } - - return ret; -} - -// Generate an ID from GUID -UINT Win32EthGenIdFromGuid(char *guid) -{ - char tmp[MAX_SIZE]; - UCHAR hash[SHA1_SIZE]; - UINT i; - // Validate arguments - if (guid == NULL) - { - return 0; - } - - StrCpy(tmp, sizeof(tmp), guid); - Trim(tmp); - StrUpper(tmp); - - Sha1(hash, tmp, StrLen(tmp)); - - Copy(&i, hash, sizeof(UINT)); - - i = Endian32(i); - - if (i == 0) - { - i = 1; - } - - return i; -} - -// Get Ethernet adapter list -TOKEN_LIST *GetEthList() -{ - UINT v; - - return GetEthListEx(&v, true, false); -} -TOKEN_LIST *GetEthListEx(UINT *total_num_including_hidden, bool enum_normal, bool enum_rawip) -{ - TOKEN_LIST *ret; - UINT i; - UINT j; - UINT dummy_int; - MS_ADAPTER_LIST *adapter_list; - - if (IsEthSupported() == false) - { - return NULL; - } - - if (enum_normal == false) - { - return NullToken(); - } - - if (total_num_including_hidden == NULL) - { - total_num_including_hidden = &dummy_int; - } - - *total_num_including_hidden = 0; - - Lock(eth_list_lock); - - InitEthAdaptersList(); - - adapter_list = MsCreateAdapterList(); - - ret = ZeroMalloc(sizeof(TOKEN_LIST)); - ret->NumTokens = LIST_NUM(eth_list); - ret->Token = ZeroMalloc(sizeof(char *) * ret->NumTokens); - j = 0; - for (i = 0;i < ret->NumTokens;i++) - { - char tmp[MAX_SIZE]; - WP_ADAPTER *a = LIST_DATA(eth_list, i); - MS_ADAPTER *msa = NULL; - bool show = true; - - if (Win32EthGetShowAllIf() == false) - { - msa = MsGetAdapterByGuidFromList(adapter_list, a->Guid); - - if (InStr(a->Title, "vpn client adapter")) - { - // Hide virtual NIC for VPN client - show = false; - } - - if (InStr(a->Title, "tunnel adapter")) - { - // Hide tunnel adapter - show = false; - } - - if (InStr(a->Title, "teredo tunnel")) - { - // Hide tunnel adapter - show = false; - } - - if (InStr(a->Title, "MS Tunnel Interface")) - { - // Hide tunnel adapter - show = false; - } - - if (InStr(a->Title, "pseudo-interface")) - { - // Hide tunnel adapter - show = false; - } - } - - if (msa != NULL) - { - // Hide except physical Ethernet NIC - if (msa->IsNotEthernetLan) - { - show = false; - } - - MsFreeAdapter(msa); - } - - Win32EthMakeCombinedName(tmp, sizeof(tmp), a->Title, a->Guid); - - if (show) - { - ret->Token[j++] = CopyStr(tmp); - - Debug("%s - %s\n", a->Guid, a->Title); - } - } - - *total_num_including_hidden = ret->NumTokens; - - ret->NumTokens = j; - - Unlock(eth_list_lock); - - MsFreeAdapterList(adapter_list); - - return ret; -} - -// Compare the name of WP_ADAPTER -int CompareWpAdapter(void *p1, void *p2) -{ - int i; - WP_ADAPTER *a1, *a2; - if (p1 == NULL || p2 == NULL) - { - return 0; - } - a1 = *(WP_ADAPTER **)p1; - a2 = *(WP_ADAPTER **)p2; - if (a1 == NULL || a2 == NULL) - { - return 0; - } - i = StrCmpi(a1->Title, a2->Title); - return i; -} - -// Get whether the SeLow is used -bool Win32IsUsingSeLow() -{ - return is_using_selow; -} - -// Get Ethernet adapter list -LIST *GetEthAdapterList() -{ - void *p; - LIST *o; - - p = MsDisableWow64FileSystemRedirection(); - - o = GetEthAdapterListInternal(); - - MsRestoreWow64FileSystemRedirection(p); - - return o; -} -LIST *GetEthAdapterListInternal() -{ - LIST *o; - LIST *ret; - UINT size; - char *buf; - UINT i, j; - char *qos_tag = " (Microsoft's Packet Scheduler)"; - SU *su = NULL; - LIST *su_adapter_list = NULL; - - // Try to use SeLow - if (enable_selow) - { - su = SuInit(); - } - - o = NewListFast(CompareWpAdapter); - - size = 200000; - buf = ZeroMalloc(size); - - // Try to enumerate with SeLow - if (su != NULL) - { - su_adapter_list = SuGetAdapterList(su); - - if (su_adapter_list == NULL) - { - // Fail to enumerate - SuFree(su); - su = NULL; - //WHERE; - is_using_selow = false; - } - else - { - //WHERE; - is_using_selow = true; - } - } - else - { - is_using_selow = false; - } - - if (su_adapter_list != NULL) - { - // If 1 or more adapters are enumerated by SeLow, create adapter list object - UINT i; - - for (i = 0;i < LIST_NUM(su_adapter_list);i++) - { - SU_ADAPTER_LIST *t = LIST_DATA(su_adapter_list, i); - WP_ADAPTER *a = ZeroMalloc(sizeof(WP_ADAPTER)); - - StrCpy(a->Name, sizeof(a->Name), t->Name); - StrCpy(a->Guid, sizeof(a->Guid), t->Guid); - StrCpy(a->Title, sizeof(a->Title), t->Info.FriendlyName); - - TrimCrlf(a->Title); - Trim(a->Title); - TrimCrlf(a->Title); - Trim(a->Title); - - if (EndWith(a->Title, qos_tag)) - { - a->Title[StrLen(a->Title) - StrLen(qos_tag)] = 0; - TrimCrlf(a->Title); - Trim(a->Title); - TrimCrlf(a->Title); - Trim(a->Title); - } - - Add(o, a); - } - } - else - { - // When SeLow is not used, create adapter list with SEE or WinPcap - if (wp->PacketGetAdapterNames(buf, &size) == false) - { - Free(buf); - return o; - } - - i = 0; - - if (OS_IS_WINDOWS_NT(GetOsInfo()->OsType)) - { - // Windows NT - if (size >= 2 && buf[0] != 0 && buf[1] != 0) - { - goto ANSI_STR; - } - - while (true) - { - wchar_t tmp[MAX_SIZE]; - WP_ADAPTER *a; - UniStrCpy(tmp, sizeof(tmp), L""); - - if (*((wchar_t *)(&buf[i])) == 0) - { - i += sizeof(wchar_t); - break; - } - - for (;*((wchar_t *)(&buf[i])) != 0;i += sizeof(wchar_t)) - { - wchar_t str[2]; - str[0] = *((wchar_t *)(&buf[i])); - str[1] = 0; - UniStrCat(tmp, sizeof(tmp), str); - } - - i += sizeof(wchar_t); - - a = ZeroMalloc(sizeof(WP_ADAPTER)); - UniToStr(a->Name, sizeof(a->Name), tmp); - - Add(o, a); - } - } - else - { - // Windows 9x -ANSI_STR: - while (true) - { - char tmp[MAX_SIZE]; - WP_ADAPTER *a; - StrCpy(tmp, sizeof(tmp), ""); - - if (*((char *)(&buf[i])) == 0) - { - i += sizeof(char); - break; - } - - for (;*((char *)(&buf[i])) != 0;i += sizeof(char)) - { - char str[2]; - str[0] = *((char *)(&buf[i])); - str[1] = 0; - StrCat(tmp, sizeof(tmp), str); - } - - i += sizeof(char); - - a = ZeroMalloc(sizeof(WP_ADAPTER)); - StrCpy(a->Name, sizeof(a->Name), tmp); - - Add(o, a); - } - } - - for (j = 0;j < LIST_NUM(o);j++) - { - WP_ADAPTER *a = LIST_DATA(o, j); - - StrCpy(a->Title, sizeof(a->Title), &buf[i]); - i += StrSize(a->Title); - - // If device description is "Unknown" in Win9x, skip 1 byte - if (OS_IS_WINDOWS_9X(GetOsInfo()->OsType)) - { - if (StrCmp(a->Title, "Unknown") == 0) - { - if (buf[i] == 0) - { - i+=sizeof(char); - } - } - } - - TrimCrlf(a->Title); - Trim(a->Title); - TrimCrlf(a->Title); - Trim(a->Title); - - if (EndWith(a->Title, qos_tag)) - { - a->Title[StrLen(a->Title) - StrLen(qos_tag)] = 0; - TrimCrlf(a->Title); - Trim(a->Title); - TrimCrlf(a->Title); - Trim(a->Title); - } - } - } - - for (j = 0;j < LIST_NUM(o);j++) - { - // Extract GUID - WP_ADAPTER *a = LIST_DATA(o, j); - - if (IsEmptyStr(a->Guid)) - { - StrCpy(a->Guid, sizeof(a->Guid), a->Name); - ReplaceStr(a->Guid, sizeof(a->Guid), a->Guid, "\\Device\\SEE_", ""); - ReplaceStr(a->Guid, sizeof(a->Guid), a->Guid, "\\Device\\NPF_", ""); - ReplaceStr(a->Guid, sizeof(a->Guid), a->Guid, "\\Device\\PCD_", ""); - } - } - - // Sort - if (su_adapter_list != NULL) - { - // Since adapter list made by SeLow is already sorted, don't sort here - Sort(o); - } - - ret = NewListFast(CompareWpAdapter); - - for (i = 0;i < LIST_NUM(o);i++) - { - WP_ADAPTER *a = LIST_DATA(o, i); - ADAPTER *ad; - bool is_ethernet = false; - bool ok = false; - - if (SearchStrEx(a->Title, "ppp", 0, false) != INFINITE || - SearchStrEx(a->Title, "wan", 0, false) != INFINITE || - SearchStrEx(a->Title, "dialup", 0, false) != INFINITE || - SearchStrEx(a->Title, "pptp", 0, false) != INFINITE || - SearchStrEx(a->Title, "telepho", 0, false) != INFINITE || - SearchStrEx(a->Title, "modem", 0, false) != INFINITE || - SearchStrEx(a->Title, "ras", 0, false) != INFINITE) - { - Free(a); - continue; - } - - // Determine whether the adapter type is Ethernet - if (su == NULL) - { - // Determine with See - ad = wp->PacketOpenAdapter(a->Name); - if (ad != NULL) - { - NetType type; - if (wp->PacketGetNetType(ad, &type)) - { - if (type.LinkType == 0) - { - is_ethernet = true; - } - } - - wp->PacketCloseAdapter(ad); - } - } - else - { - // In using SeLow, all devices should be Ethernet device - is_ethernet = true; - } - - if (is_ethernet) - { - // Add only Ethernet device - char tmp[MAX_SIZE]; - UINT k; - - StrCpy(tmp, sizeof(tmp), a->Title); - - for (k = 0;;k++) - { - if (k == 0) - { - StrCpy(tmp, sizeof(tmp), a->Title); - } - else - { - Format(tmp, sizeof(tmp), "%s (%u)", a->Title, k + 1); - } - - ok = true; - for (j = 0;j < LIST_NUM(ret);j++) - { - WP_ADAPTER *aa = LIST_DATA(ret, j); - if (StrCmpi(aa->Title, tmp) == 0) - { - ok = false; - } - } - - if (ok) - { - break; - } - } - - StrCpy(a->Title, sizeof(a->Title), tmp); - a->Id = Win32EthGenIdFromGuid(a->Guid); - Add(ret, a); - } - - if (ok == false) - { - Free(a); - } - } - - Free(buf); - - Sort(ret); - - ReleaseList(o); - - if (su != NULL) - { - SuFreeAdapterList(su_adapter_list); - - SuFree(su); - } - - return ret; -} - -// Initialize Ethernet adapter list -void InitEthAdaptersList() -{ - if (eth_list != NULL) - { - FreeEthAdaptersList(); - eth_list = NULL; - } - eth_list = GetEthAdapterList(); -} - -// Free Ethernet adapter list -void FreeEthAdaptersList() -{ - UINT i; - if (eth_list == NULL) - { - return; - } - for (i = 0;i < LIST_NUM(eth_list);i++) - { - WP_ADAPTER *a = LIST_DATA(eth_list, i); - Free(a); - } - ReleaseList(eth_list); - eth_list = NULL; -} - -// Is the SU supported -bool Win32EthIsSuSupported() -{ - bool ret = false; - SU *su = SuInit(); - - if (su != NULL) - { - ret = true; - } - - SuFree(su); - - return ret; -} - -// Is the Ethernet supported -bool IsEthSupported() -{ - bool ret = IsEthSupportedInner(); - - if (ret == false) - { - ret = Win32EthIsSuSupported(); - } - - return ret; -} -bool IsEthSupportedInner() -{ - if (wp == NULL) - { - return false; - } - - return wp->Inited; -} - -// Is the PCD driver supported in current OS -bool IsPcdSupported() -{ - UINT type; - OS_INFO *info = GetOsInfo(); - - if (MsIsWindows10()) - { - // Windows 10 or later never supports PCD driver. - return false; - } - - type = info->OsType; - - if (OS_IS_WINDOWS_NT(type) == false) - { - // Only on Windows NT series - return false; - } - - if (GET_KETA(type, 100) >= 2) - { - // Good for Windows 2000 or later - return true; - } - - // Not good for Windows NT 4.0 or Longhorn - return false; -} - -// Save build number of PCD driver -void SavePcdDriverBuild(UINT build) -{ - MsRegWriteInt(REG_LOCAL_MACHINE, BRIDGE_WIN32_PCD_REGKEY, BRIDGE_WIN32_PCD_BUILDVALUE, - build); -} - -// Load build number of PCD driver -UINT LoadPcdDriverBuild() -{ - return MsRegReadInt(REG_LOCAL_MACHINE, BRIDGE_WIN32_PCD_REGKEY, BRIDGE_WIN32_PCD_BUILDVALUE); -} - -// Try to install PCD driver -HINSTANCE InstallPcdDriver() -{ - HINSTANCE ret; - void *p = MsDisableWow64FileSystemRedirection(); - - ret = InstallPcdDriverInternal(); - - MsRestoreWow64FileSystemRedirection(p); - - return ret; -} -HINSTANCE InstallPcdDriverInternal() -{ - char tmp[MAX_PATH]; - bool install_driver = true; - HINSTANCE h; - char *dll_filename; - - // Confirm whether the see.sys is installed in system32\drivers folder - Format(tmp, sizeof(tmp), "%s\\drivers\\see.sys", MsGetSystem32Dir()); - - if (IsFileExists(tmp)) - { - // If driver file is exist, try to get build number from registry - if (LoadPcdDriverBuild() >= CEDAR_VERSION_BUILD) - { - // Already latest driver is installed - install_driver = false; - } - } - - if (install_driver) - { - char *src_filename = BRIDGE_WIN32_PCD_SYS; - // If need to install the driver, confirm user is administrator - if (MsIsAdmin() == false) - { - // Non administrator can't install driver - return NULL; - } - - if (MsIsX64()) - { - src_filename = BRIDGE_WIN32_PCD_SYS_X64; - } - - // Copy see.sys - if (FileCopy(src_filename, tmp) == false) - { - return NULL; - } - - // Save build number - SavePcdDriverBuild(CEDAR_VERSION_BUILD); - } - - dll_filename = BRIDGE_WIN32_PCD_DLL; - - if (Is64()) - { - if (MsIsX64()) - { - dll_filename = BRIDGE_WIN32_PCD_DLL_X64; - } - } - - // Try to load see.dll and initialize - h = MsLoadLibrary(dll_filename); - if (h == NULL) - { - return NULL; - } - - return h; -} - -// Initialize Ethernet -void InitEth() -{ - HINSTANCE h; - if (wp != NULL) - { - // Already initialized - return; - } - - eth_list_lock = NewLock(); - - wp = ZeroMalloc(sizeof(WP)); - - is_see_mode = false; - - if (IsPcdSupported()) - { - // PCD is supported in this OS - h = InstallPcdDriver(); - if (h != NULL) - { - // Try to initialize with PCD - if (InitWpWithLoadLibrary(wp, h) == false) - { - Debug("InitEth: SEE Failed.\n"); - FreeLibrary(h); - } - else - { - Debug("InitEth: SEE Loaded.\n"); - is_see_mode = true; - } - } - } - - if (wp->Inited == false) - { - // Try to initialize with Packet.dll of WinPcap - h = LoadLibrary(BRIDGE_WIN32_PACKET_DLL); - if (h != NULL) - { - if (InitWpWithLoadLibrary(wp, h) == false) - { - Debug("InitEth: Packet.dll Failed.\n"); - FreeLibrary(h); - } - else - { - Debug("InitEth: Packet.dll Loaded.\n"); - } - } - } -} - -// Get whether local-bridge uses see.sys -bool IsWin32BridgeWithSee() -{ - return is_see_mode; -} - -// Initialize WP structure with DLL -bool InitWpWithLoadLibrary(WP *wp, HINSTANCE h) -{ - TOKEN_LIST *o; - UINT total_num = 0; - // Validate arguments - if (wp == NULL || h == NULL) - { - return false; - } - wp->Inited = true; - wp->hPacketDll = h; - - LOAD_DLL_ADDR(PacketGetVersion); - LOAD_DLL_ADDR(PacketGetDriverVersion); - LOAD_DLL_ADDR(PacketSetMinToCopy); - LOAD_DLL_ADDR(PacketSetNumWrites); - LOAD_DLL_ADDR(PacketSetMode); - LOAD_DLL_ADDR(PacketSetReadTimeout); - LOAD_DLL_ADDR(PacketSetBpf); - LOAD_DLL_ADDR(PacketSetSnapLen); - LOAD_DLL_ADDR(PacketGetStats); - LOAD_DLL_ADDR(PacketGetStatsEx); - LOAD_DLL_ADDR(PacketSetBuff); - LOAD_DLL_ADDR(PacketGetNetType); - LOAD_DLL_ADDR(PacketOpenAdapter); - LOAD_DLL_ADDR(PacketSendPacket); - LOAD_DLL_ADDR(PacketSendPackets); - LOAD_DLL_ADDR(PacketAllocatePacket); - LOAD_DLL_ADDR(PacketInitPacket); - LOAD_DLL_ADDR(PacketFreePacket); - LOAD_DLL_ADDR(PacketReceivePacket); - LOAD_DLL_ADDR(PacketSetHwFilter); - LOAD_DLL_ADDR(PacketGetAdapterNames); - LOAD_DLL_ADDR(PacketGetNetInfoEx); - LOAD_DLL_ADDR(PacketRequest); - LOAD_DLL_ADDR(PacketGetReadEvent); - LOAD_DLL_ADDR(PacketSetDumpName); - LOAD_DLL_ADDR(PacketSetDumpLimits); - LOAD_DLL_ADDR(PacketSetDumpLimits); - LOAD_DLL_ADDR(PacketIsDumpEnded); - LOAD_DLL_ADDR(PacketStopDriver); - LOAD_DLL_ADDR(PacketCloseAdapter); - LOAD_DLL_ADDR(PacketSetLoopbackBehavior); - - if (wp->PacketSetMinToCopy == NULL || - wp->PacketSetNumWrites == NULL || - wp->PacketSetMode == NULL || - wp->PacketSetReadTimeout == NULL || - wp->PacketSetBuff == NULL || - wp->PacketGetNetType == NULL || - wp->PacketOpenAdapter == NULL || - wp->PacketSendPacket == NULL || - wp->PacketSendPackets == NULL || - wp->PacketAllocatePacket == NULL || - wp->PacketInitPacket == NULL || - wp->PacketFreePacket == NULL || - wp->PacketReceivePacket == NULL || - wp->PacketSetHwFilter == NULL || - wp->PacketGetAdapterNames == NULL || - wp->PacketGetNetInfoEx == NULL || - wp->PacketCloseAdapter == NULL) - { -RELEASE: - wp->Inited = false; - wp->hPacketDll = NULL; - - return false; - } - - o = GetEthListEx(&total_num, true, false); - if (o == NULL || total_num == 0) - { - FreeToken(o); - goto RELEASE; - } - - FreeToken(o); - - return true; -} - -// Free Ethernet -void FreeEth() -{ - if (wp == NULL) - { - // Not initialized - return; - } - - // Free adapter list - FreeEthAdaptersList(); - - if (wp->Inited) - { - // Free DLL - FreeLibrary(wp->hPacketDll); - } - - Free(wp); - wp = NULL; - - DeleteLock(eth_list_lock); - eth_list_lock = NULL; -} - -// Get network connection name from Ethernet device name -void GetEthNetworkConnectionName(wchar_t *dst, UINT size, char *device_name) -{ - WP_ADAPTER *t; - char *tmp = NULL, guid[MAX_SIZE]; - wchar_t *ncname = NULL; - - UniStrCpy(dst, size, L""); - - // Validate arguments - if (device_name == NULL || IsEthSupported() == false || - IsNt() == false || MsIsWin2000OrGreater() == false) - { - return; - } - - Lock(eth_list_lock); - - InitEthAdaptersList(); - - t = Win32EthSearch(device_name); - - if (t == NULL) - { - Unlock(eth_list_lock); - return; - } - - tmp = CopyStr(t->Name); - Unlock(eth_list_lock); - - if (IsEmptyStr(t->Guid) == false) - { - StrCpy(guid, sizeof(guid), t->Guid); - - Free(tmp); - } - else - { - ReplaceStr(guid, sizeof(guid), tmp, "\\Device\\SEE_", ""); - Free(tmp); - - ReplaceStr(guid, sizeof(guid), guid, "\\Device\\NPF_", ""); - ReplaceStr(guid, sizeof(guid), guid, "\\Device\\PCD_", ""); - } - - if(guid == NULL) - { - return; - } - - ncname = MsGetNetworkConnectionName(guid); - if(ncname != NULL) - { - UniStrCpy(dst, size, ncname); - } - Free(ncname); -} - -#endif // BRIDGE_C - - +// SoftEther VPN Source Code - Developer Edition Master Branch +// Cedar Communication Module + + +// BridgeWin32.c +// Ethernet Bridge Program (Win32) + +#include + +#ifdef BRIDGE_C + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + + +static WP *wp = NULL; +static LIST *eth_list = NULL; + +static LOCK *eth_list_lock = NULL; +static bool is_see_mode = false; +static bool is_using_selow = false; +static bool enable_selow = true; + +static bool g_bridge_win32_show_all_if = false; + +#define LOAD_DLL_ADDR(name) \ + { \ + void *addr = GetProcAddress(h, #name); \ + Copy(&wp->name, &addr, sizeof(void *)); \ + } + +// Set the flag which indicates whether using SeLow +void Win32SetEnableSeLow(bool b) +{ + enable_selow = b; +} + +// Get the flag which indicates whether using SeLow +bool Win32GetEnableSeLow() +{ + return enable_selow; +} + +// Set the flag which indicates whether enumerating all interfaces +void Win32EthSetShowAllIf(bool b) +{ + g_bridge_win32_show_all_if = b; +} + +// Get the flag which indicates whether enumerating all interfaces +bool Win32EthGetShowAllIf() +{ + return g_bridge_win32_show_all_if; +} + +// Compare Ethernet device list +int CmpRpcEnumEthVLan(void *p1, void *p2) +{ + RPC_ENUM_ETH_VLAN_ITEM *v1, *v2; + if (p1 == NULL || p2 == NULL) + { + return 0; + } + v1 = *((RPC_ENUM_ETH_VLAN_ITEM **)p1); + v2 = *((RPC_ENUM_ETH_VLAN_ITEM **)p2); + if (v1 == NULL || v2 == NULL) + { + return 0; + } + + return StrCmpi(v1->DeviceName, v2->DeviceName); +} + +// Get the value of MTU (Not supported in Windows) +UINT EthGetMtu(ETH *e) +{ + return 0; +} + +// Set the value of MTU (Not supported in Windows) +bool EthSetMtu(ETH *e, UINT mtu) +{ + return false; +} + +// Check whether setting MEU value (Not supported in Windows) +bool EthIsChangeMtuSupported(ETH *e) +{ + return false; +} + +// Set the state of VLAN tag pass-through +bool SetVLanEnableStatus(char *title, bool enable) +{ + RPC_ENUM_ETH_VLAN t; + RPC_ENUM_ETH_VLAN_ITEM *e; + bool ret = false; + char key[MAX_SIZE]; + char tcpkey[MAX_SIZE]; + char short_key[MAX_SIZE]; + // Validate arguments + if (title == NULL) + { + return false; + } + + Zero(&t, sizeof(t)); + if (EnumEthVLanWin32(&t) == false) + { + return false; + } + + e = FindEthVLanItem(&t, title); + + if (e != NULL) + { + if (GetClassRegKeyWin32(key, sizeof(key), short_key, sizeof(short_key), e->Guid)) + { + if (StrCmpi(e->DriverType, "Intel") == 0) + { + if (enable) + { + MsRegWriteStr(REG_LOCAL_MACHINE, key, "VlanFiltering", "0"); + MsRegWriteStr(REG_LOCAL_MACHINE, key, "TaggingMode", "0"); + MsRegWriteInt(REG_LOCAL_MACHINE, key, "MonitorMode", 1); + MsRegWriteInt(REG_LOCAL_MACHINE, key, "MonitorModeEnabled", 1); + } + else + { + if (MsRegReadInt(REG_LOCAL_MACHINE, key, "TaggingMode") == 0) + { + MsRegDeleteValue(REG_LOCAL_MACHINE, key, "TaggingMode"); + } + + if (MsRegReadInt(REG_LOCAL_MACHINE, key, "MonitorMode") == 1) + { + MsRegDeleteValue(REG_LOCAL_MACHINE, key, "MonitorMode"); + } + + if (MsRegReadInt(REG_LOCAL_MACHINE, key, "MonitorModeEnabled") == 1) + { + MsRegDeleteValue(REG_LOCAL_MACHINE, key, "MonitorModeEnabled"); + } + } + + ret = true; + } + else if (StrCmpi(e->DriverType, "Broadcom") == 0) + { + if (enable) + { + MsRegWriteStr(REG_LOCAL_MACHINE, key, "PreserveVlanInfoInRxPacket", "1"); + } + else + { + MsRegDeleteValue(REG_LOCAL_MACHINE, key, "PreserveVlanInfoInRxPacket"); + } + + ret = true; + } + else if (StrCmpi(e->DriverType, "Marvell") == 0) + { + if (enable) + { + MsRegWriteInt(REG_LOCAL_MACHINE, key, "SkDisableVlanStrip", 1); + } + else + { + MsRegDeleteValue(REG_LOCAL_MACHINE, key, "SkDisableVlanStrip"); + } + + ret = true; + } + + Format(tcpkey, sizeof(tcpkey), + "SYSTEM\\CurrentControlSet\\Services\\Tcpip\\Parameters\\Interfaces\\%s", + e->Guid); + + if (enable) + { + if (MsRegIsValue(REG_LOCAL_MACHINE, tcpkey, "MTU") == false) + { + MsRegWriteInt(REG_LOCAL_MACHINE, tcpkey, "MTU", 1500); + } + } + else + { + UINT mtu = MsRegReadInt(REG_LOCAL_MACHINE, tcpkey, "MTU"); + if (mtu == 1500) + { + MsRegDeleteValue(REG_LOCAL_MACHINE, tcpkey, "MTU"); + } + } + } + } + + FreeRpcEnumEthVLan(&t); + + return ret; +} + +// Find Ethernet device +RPC_ENUM_ETH_VLAN_ITEM *FindEthVLanItem(RPC_ENUM_ETH_VLAN *t, char *name) +{ + UINT i; + // Validate arguments + if (t == NULL || name == NULL) + { + return NULL; + } + + for (i = 0;i < t->NumItem;i++) + { + if (StrCmpi(t->Items[i].DeviceName, name) == 0) + { + return &t->Items[i]; + } + } + + return NULL; +} + +// Get the state of VLAN tag pass-through +void GetVLanEnableStatus(RPC_ENUM_ETH_VLAN_ITEM *e) +{ + char key[MAX_SIZE]; + char short_key[MAX_SIZE]; + char tcpkey[MAX_SIZE]; + // Validate arguments + if (e == NULL) + { + return; + } + + e->Enabled = false; + + if (e->Support == false) + { + return; + } + + if (GetClassRegKeyWin32(key, sizeof(key), short_key, sizeof(short_key), e->Guid) == false) + { + return; + } + + Format(tcpkey, sizeof(tcpkey), + "SYSTEM\\CurrentControlSet\\Services\\Tcpip\\Parameters\\Interfaces\\%s", + e->Guid); + + if (StrCmpi(e->DriverType, "Intel") == 0) + { + char *VlanFiltering = MsRegReadStr(REG_LOCAL_MACHINE, key, "VlanFiltering"); + UINT MonitorMode = MsRegReadInt(REG_LOCAL_MACHINE, key, "MonitorMode"); + UINT MonitorModeEnabled = MsRegReadInt(REG_LOCAL_MACHINE, key, "MonitorModeEnabled"); + char *TaggingMode = MsRegReadStr(REG_LOCAL_MACHINE, key, "TaggingMode"); + + if (StrCmpi(VlanFiltering, "0") == 0 && + MonitorMode == 1 && + MonitorModeEnabled == 1 && + StrCmpi(TaggingMode, "0") == 0) + { + e->Enabled = true; + } + + Free(VlanFiltering); + Free(TaggingMode); + } + else if (StrCmpi(e->DriverType, "Broadcom") == 0) + { + char *PreserveVlanInfoInRxPacket = MsRegReadStr(REG_LOCAL_MACHINE, + key, "PreserveVlanInfoInRxPacket"); + + if (StrCmpi(PreserveVlanInfoInRxPacket, "1") == 0) + { + e->Enabled = true; + } + + Free(PreserveVlanInfoInRxPacket); + } + else if (StrCmpi(e->DriverType, "Marvell") == 0) + { + DWORD SkDisableVlanStrip = MsRegReadInt(REG_LOCAL_MACHINE, + key, "SkDisableVlanStrip"); + + if (SkDisableVlanStrip == 1) + { + e->Enabled = true; + } + } + + if (MsRegIsValue(REG_LOCAL_MACHINE, tcpkey, "MTU") == false) + { + e->Enabled = false; + } +} + +// Get VLAN tag pass-through availability of the device +void GetVLanSupportStatus(RPC_ENUM_ETH_VLAN_ITEM *e) +{ + BUF *b; + char filename[MAX_SIZE]; + void *wow; + // Validate arguments + if (e == NULL) + { + return; + } + + wow = MsDisableWow64FileSystemRedirection(); + + // Read the device driver file + CombinePath(filename, sizeof(filename), MsGetSystem32Dir(), "drivers"); + CombinePath(filename, sizeof(filename), filename, e->DriverName); + + b = ReadDump(filename); + + if (b != NULL) + { + char intel1[] = "VlanFiltering"; + char intel2[] = "V\0l\0a\0n\0F\0i\0l\0t\0e\0r\0i\0n\0g"; + char intel3[] = "MonitorMode"; + char intel4[] = "M\0o\0n\0i\0t\0o\0r\0M\0o\0d\0e"; + char intel5[] = "TaggingMode"; + char intel6[] = "T\0a\0g\0g\0i\0n\0g\0M\0o\0d\0e"; + char broadcom1[] = "PreserveVlanInfoInRxPacket"; + char broadcom2[] = "P\0r\0e\0s\0e\0r\0v\0e\0V\0l\0a\0n\0I\0n\0f\0o\0I\0n\0R\0x\0P\0a\0c\0k\0e\0t"; + char marvell1[] = "SkDisableVlanStrip"; + char marvell2[] = "S\0k\0D\0i\0s\0a\0b\0l\0e\0V\0l\0a\0n\0S\0t\0r\0i\0p"; + char *driver_type = ""; + + if (SearchBin(b->Buf, 0, b->Size, intel1, sizeof(intel1)) != INFINITE + || SearchBin(b->Buf, 0, b->Size, intel2, sizeof(intel2)) != INFINITE + || SearchBin(b->Buf, 0, b->Size, intel3, sizeof(intel3)) != INFINITE + || SearchBin(b->Buf, 0, b->Size, intel4, sizeof(intel4)) != INFINITE + || SearchBin(b->Buf, 0, b->Size, intel5, sizeof(intel5)) != INFINITE + || SearchBin(b->Buf, 0, b->Size, intel6, sizeof(intel6)) != INFINITE) + { + driver_type = "Intel"; + } + else if (SearchBin(b->Buf, 0, b->Size, broadcom1, sizeof(broadcom1)) != INFINITE + || SearchBin(b->Buf, 0, b->Size, broadcom2, sizeof(broadcom2)) != INFINITE) + { + driver_type = "Broadcom"; + } + else if (SearchBin(b->Buf, 0, b->Size, marvell1, sizeof(marvell1)) != INFINITE + || SearchBin(b->Buf, 0, b->Size, marvell2, sizeof(marvell2)) != INFINITE) + { + driver_type = "Marvell"; + } + + if (IsEmptyStr(driver_type) == false) + { + StrCpy(e->DriverType, sizeof(e->DriverType), driver_type); + e->Support = true; + } + + FreeBuf(b); + } + + MsRestoreWow64FileSystemRedirection(wow); +} + +// Get the device instance id from short_key +char *SearchDeviceInstanceIdFromShortKey(char *short_key) +{ + char *ret = NULL; + TOKEN_LIST *t1; + // Validate arguments + if (short_key == NULL) + { + return NULL; + } + + t1 = MsRegEnumKey(REG_LOCAL_MACHINE, "SYSTEM\\CurrentControlSet\\Enum"); + + if (t1 != NULL) + { + TOKEN_LIST *t2; + char tmp[MAX_SIZE]; + UINT i; + + for (i = 0;i < t1->NumTokens;i++) + { + Format(tmp, sizeof(tmp), "SYSTEM\\CurrentControlSet\\Enum\\%s", t1->Token[i]); + + t2 = MsRegEnumKey(REG_LOCAL_MACHINE, tmp); + + if (t2 != NULL) + { + TOKEN_LIST *t3; + UINT i; + + for (i = 0;i < t2->NumTokens;i++) + { + char tmp2[MAX_SIZE]; + + Format(tmp2, sizeof(tmp2), "%s\\%s", tmp, t2->Token[i]); + + t3 = MsRegEnumKey(REG_LOCAL_MACHINE, tmp2); + + if (t3 != NULL) + { + UINT i; + + for (i = 0;i < t3->NumTokens;i++) + { + char tmp3[MAX_SIZE]; + char *s; + + Format(tmp3, sizeof(tmp3), "%s\\%s", tmp2, t3->Token[i]); + + s = MsRegReadStr(REG_LOCAL_MACHINE, tmp3, "Driver"); + + if (s != NULL) + { + if (StrCmpi(s, short_key) == 0) + { + if (ret != NULL) + { + Free(ret); + } + + ret = CopyStr(tmp3 + StrLen("SYSTEM\\CurrentControlSet\\Enum\\")); + } + + Free(s); + } + } + + FreeToken(t3); + } + } + + FreeToken(t2); + } + } + + FreeToken(t1); + } + + return ret; +} + +// Get VLAN tag pass-through availability of all devices +bool EnumEthVLanWin32(RPC_ENUM_ETH_VLAN *t) +{ + UINT i; + LIST *o; + // Validate arguments + if (t == NULL) + { + return false; + } + + Zero(t, sizeof(RPC_ENUM_ETH_VLAN)); + + if (MsIsWin2000OrGreater() == false) + { + return false; + } + + if (IsEthSupported() == false) + { + return false; + } + + // Get device list + Lock(eth_list_lock); + + InitEthAdaptersList(); + + o = NewListFast(CmpRpcEnumEthVLan); + + for (i = 0;i < LIST_NUM(eth_list);i++) + { + WP_ADAPTER *a = LIST_DATA(eth_list, i); + + if (IsEmptyStr(a->Guid) == false) + { + char class_key[MAX_SIZE]; + char short_key[MAX_SIZE]; + + if (GetClassRegKeyWin32(class_key, sizeof(class_key), + short_key, sizeof(short_key), a->Guid)) + { + char *device_instance_id = MsRegReadStr(REG_LOCAL_MACHINE, class_key, "DeviceInstanceID"); + + if (IsEmptyStr(device_instance_id)) + { + Free(device_instance_id); + device_instance_id = SearchDeviceInstanceIdFromShortKey(short_key); + } + + if (IsEmptyStr(device_instance_id) == false) + { + char device_key[MAX_SIZE]; + char *service_name; + + Format(device_key, sizeof(device_key), "SYSTEM\\CurrentControlSet\\Enum\\%s", + device_instance_id); + + service_name = MsRegReadStr(REG_LOCAL_MACHINE, device_key, "Service"); + if (IsEmptyStr(service_name) == false) + { + char service_key[MAX_SIZE]; + char *sys; + + Format(service_key, sizeof(service_key), + "SYSTEM\\CurrentControlSet\\services\\%s", + service_name); + + sys = MsRegReadStr(REG_LOCAL_MACHINE, service_key, "ImagePath"); + + if (IsEmptyStr(sys) == false) + { + char sysname[MAX_PATH]; + + GetFileNameFromFilePath(sysname, sizeof(sysname), sys); + + Trim(sysname); + + if (EndWith(sysname, ".sys")) + { + // device found + RPC_ENUM_ETH_VLAN_ITEM *e = ZeroMalloc(sizeof(RPC_ENUM_ETH_VLAN_ITEM)); + + StrCpy(e->DeviceName, sizeof(e->DeviceName), a->Title); + StrCpy(e->Guid, sizeof(e->Guid), a->Guid); + StrCpy(e->DeviceInstanceId, sizeof(e->DeviceInstanceId), device_instance_id); + StrCpy(e->DriverName, sizeof(e->DriverName), sysname); + + // Get VLAN tag pass-through availability of the device + GetVLanSupportStatus(e); + + // Get current pass-through setting of the device + GetVLanEnableStatus(e); + + Insert(o, e); + } + } + + Free(sys); + } + + Free(service_name); + } + + Free(device_instance_id); + } + } + } + + t->NumItem = LIST_NUM(o); + t->Items = ZeroMalloc(sizeof(RPC_ENUM_ETH_VLAN_ITEM) * i); + + for (i = 0;i < LIST_NUM(o);i++) + { + RPC_ENUM_ETH_VLAN_ITEM *e = LIST_DATA(o, i); + + Copy(&t->Items[i], e, sizeof(RPC_ENUM_ETH_VLAN_ITEM)); + + Free(e); + } + + ReleaseList(o); + + Unlock(eth_list_lock); + + return true; +} + +// Get registry key of the network class data by GUID +bool GetClassRegKeyWin32(char *key, UINT key_size, char *short_key, UINT short_key_size, char *guid) +{ + TOKEN_LIST *t; + bool ret = false; + UINT i; + // Validate arguments + if (key == NULL || short_key == NULL || guid == NULL) + { + return false; + } + + t = MsRegEnumKey(REG_LOCAL_MACHINE, + "SYSTEM\\CurrentControlSet\\Control\\Class\\{4D36E972-E325-11CE-BFC1-08002BE10318}"); + if (t == NULL) + { + return false; + } + + for (i = 0;i < t->NumTokens;i++) + { + char keyname[MAX_SIZE]; + char *value; + + Format(keyname, sizeof(keyname), + "SYSTEM\\CurrentControlSet\\Control\\Class\\{4D36E972-E325-11CE-BFC1-08002BE10318}\\%s", + t->Token[i]); + + value = MsRegReadStr(REG_LOCAL_MACHINE, keyname, "NetCfgInstanceId"); + + if (StrCmpi(value, guid) == 0) + { + ret = true; + + StrCpy(key, key_size, keyname); + + Format(short_key, short_key_size, "{4D36E972-E325-11CE-BFC1-08002BE10318}\\%s", + t->Token[i]); + } + + Free(value); + } + + FreeToken(t); + + return ret; +} + +// Send multiple packets +void EthPutPackets(ETH *e, UINT num, void **datas, UINT *sizes) +{ + UINT i, total_size; + UCHAR *buf; + UINT write_pointer; + UINT err = 0; + // Validate arguments + if (e == NULL || num == 0 || datas == NULL || sizes == NULL) + { + return; + } + if (e->HasFatalError) + { + return; + } + + if (e->SuAdapter != NULL) + { + bool ok = true; + + // Send packets with SeLow + for (i = 0;i < num;i++) + { + UCHAR *data = datas[i]; + UINT size = sizes[i]; + + if (ok) + { + // Actually, only enqueuing + ok = SuPutPacket(e->SuAdapter, data, size); + } + + if (ok == false) + { + // Free memory on write error + Free(data); + } + } + + if (ok) + { + // Send all data in queue at once + ok = SuPutPacket(e->SuAdapter, NULL, 0); + } + + if (ok == false) + { + // Error occurred + e->HasFatalError = true; + } + + return; + } + + if (IsWin32BridgeWithSee() == false) + { + if (e->LastSetSingleCpu == 0 || (e->LastSetSingleCpu + 10000) <= Tick64()) + { + e->LastSetSingleCpu = Tick64(); + MsSetThreadSingleCpu(); + } + } + + // Calculate buffer size + total_size = 0; + for (i = 0;i < num;i++) + { + void *data = datas[i]; + UINT size = sizes[i]; + if (data != NULL && size >= 14 && size <= MAX_PACKET_SIZE) + { + total_size += size + sizeof(struct dump_bpf_hdr); + } + } + + buf = MallocFast(total_size * 100 / 75 + 1600); + + write_pointer = 0; + // Enqueue + for (i = 0;i < num;i++) + { + void *data = datas[i]; + UINT size = sizes[i]; + if (data != NULL && size >= 14 && size <= MAX_PACKET_SIZE) + { + struct dump_bpf_hdr *h; + + h = (struct dump_bpf_hdr *)(buf + write_pointer); + Zero(h, sizeof(struct dump_bpf_hdr)); + h->caplen = h->len = size; + write_pointer += sizeof(struct dump_bpf_hdr); + Copy(buf + write_pointer, data, size); + write_pointer += size; + + PROBE_DATA2("EthPutPackets", data, size); + } + // Free original buffer + Free(data); + } + + // Send + if (total_size != 0) + { + err = wp->PacketSendPackets(e->Adapter, buf, total_size, true); + } + + Free(buf); + + if (err == 0x7FFFFFFF) + { + // Critical error (infinite loop) occurred on sending + e->HasFatalError = true; + } +} + +// Send a packet +void EthPutPacket(ETH *e, void *data, UINT size) +{ + // Validate arguments + if (e == NULL || data == NULL || size == 0) + { + return; + } + + EthPutPackets(e, 1, &data, &size); +} + +// Read next packet +UINT EthGetPacket(ETH *e, void **data) +{ + BLOCK *b; + bool flag = false; + // Validate arguments + if (e == NULL || data == NULL) + { + return INFINITE; + } + if (e->HasFatalError) + { + return INFINITE; + } + + if (e->SuAdapter != NULL) + { + // Read packet with SeLow + UINT size; + if (SuGetNextPacket(e->SuAdapter, data, &size) == false) + { + // Error occurred + e->HasFatalError = true; + return INFINITE; + } + + return size; + } + +RETRY: + // Check the presence of the packet in queue + b = GetNext(e->PacketQueue); + if (b != NULL) + { + UINT size; + size = b->Size; + *data = b->Buf; + Free(b); + + if (e->PacketQueue->num_item == 0) + { + e->Empty = true; + } + + return size; + } + + if (e->Empty) + { + e->Empty = false; + return 0; + } + + if (flag == false) + { + // Try to get next packet + PROBE_STR("EthGetPacket: PacketInitPacket"); + wp->PacketInitPacket(e->Packet, e->Buffer, e->BufferSize); + PROBE_STR("EthGetPacket: PacketReceivePacket"); + if (wp->PacketReceivePacket(e->Adapter, e->Packet, false) == false) + { + // Failed + return INFINITE; + } + else + { + UCHAR *buf; + UINT total; + UINT offset; + + buf = (UCHAR *)e->Packet->Buffer; + total = e->Packet->ulBytesReceived; + offset = 0; + + while (offset < total) + { + struct bpf_hdr *header; + UINT packet_size; + UCHAR *packet_data; + + header = (struct bpf_hdr *)(buf + offset); + packet_size = header->bh_caplen; + offset += header->bh_hdrlen; + packet_data = buf + offset; + offset = Packet_WORDALIGN(offset + packet_size); + + if (packet_size >= 14) + { + UCHAR *tmp; + BLOCK *b; + + PROBE_DATA2("EthGetPacket: NewBlock", packet_data, packet_size); + + tmp = MallocFast(packet_size); + + Copy(tmp, packet_data, packet_size); + b = NewBlock(tmp, packet_size, 0); + InsertQueue(e->PacketQueue, b); + } + } + + flag = true; + goto RETRY; + } + } + + // No more packet + return 0; +} + +// Get cancel object +CANCEL *EthGetCancel(ETH *e) +{ + // Validate arguments + if (e == NULL) + { + return NULL; + } + + AddRef(e->Cancel->ref); + + return e->Cancel; +} + +// Close adapter +void CloseEth(ETH *e) +{ + BLOCK *b; + // Validate arguments + if (e == NULL) + { + return; + } + + ReleaseCancel(e->Cancel); + + if (e->SuAdapter != NULL) + { + // Close SeLow adapter + SuCloseAdapter(e->SuAdapter); + SuFree(e->Su); + } + else + { + // Close SEE adapter + wp->PacketCloseAdapter(e->Adapter); + wp->PacketFreePacket(e->Packet); + wp->PacketFreePacket(e->PutPacket); + } + + while (b = GetNext(e->PacketQueue)) + { + FreeBlock(b); + } + ReleaseQueue(e->PacketQueue); + + Free(e->Name); + Free(e->Title); + Free(e->Buffer); + + Free(e); +} + +// Search adapter with the name +struct WP_ADAPTER *Win32EthSearch(char *name) +{ + UINT i; + UINT id; + char simple_name[MAX_SIZE]; + WP_ADAPTER *ret = NULL; + + id = Win32EthGetNameAndIdFromCombinedName(simple_name, sizeof(simple_name), name); + + if (id != 0) + { + UINT num_match = 0; + // Search with ID when ID is specified + for (i = 0;i < LIST_NUM(eth_list);i++) + { + WP_ADAPTER *a = LIST_DATA(eth_list, i); + + if (a->Id != 0 && a->Id == id) + { + ret = a; + num_match++; + } + } + + if (num_match >= 2) + { + // If the ID matches to 2 or more devices, search with the name + for (i = 0;i < LIST_NUM(eth_list);i++) + { + WP_ADAPTER *a = LIST_DATA(eth_list, i); + + if (a->Id != 0 && a->Id == id) + { + if (StrCmpi(a->Title, name) == 0) + { + ret = a; + break; + } + } + } + } + } + else + { + // Search with name when ID is not specified + for (i = 0;i < LIST_NUM(eth_list);i++) + { + WP_ADAPTER *a = LIST_DATA(eth_list, i); + + if (StrCmpi(a->Title, name) == 0) + { + ret = a; + break; + } + } + } + + return ret; +} + +// Open adapter +ETH *OpenEth(char *name, bool local, bool tapmode, char *tapaddr) +{ + ETH *ret; + void *p; + + p = MsDisableWow64FileSystemRedirection(); + + ret = OpenEthInternal(name, local, tapmode, tapaddr); + + MsRestoreWow64FileSystemRedirection(p); + + return ret; +} +ETH *OpenEthInternal(char *name, bool local, bool tapmode, char *tapaddr) +{ + WP_ADAPTER *t; + ETH *e; + ADAPTER *a = NULL; + HANDLE h; + CANCEL *c; + MS_ADAPTER *ms; + char name_with_id[MAX_SIZE]; + SU *su = NULL; + SU_ADAPTER *su_adapter = NULL; + // Validate arguments + if (name == NULL || IsEthSupported() == false) + { + return NULL; + } + + if (tapmode) + { + // Tap is not supported in Windows + return NULL; + } + + Lock(eth_list_lock); + + InitEthAdaptersList(); + + t = Win32EthSearch(name); + + if (t == NULL) + { + Unlock(eth_list_lock); + return NULL; + } + + Debug("OpenEthInternal: %s\n", t->Name); + + if (StartWith(t->Name, SL_ADAPTER_ID_PREFIX)) + { + // Open with SU + su = SuInit(); + if (su == NULL) + { + // Fail to initialize SU + Unlock(eth_list_lock); + return NULL; + } + + su_adapter = SuOpenAdapter(su, t->Name); + + if (su_adapter == NULL) + { + // Fail to get adapter + SuFree(su); + Unlock(eth_list_lock); + return NULL; + } + + is_using_selow = true; + } + else + { + // Open with SEE + a = wp->PacketOpenAdapter(t->Name); + if (a == NULL) + { + Unlock(eth_list_lock); + return NULL; + } + + if (IsWin32BridgeWithSee() == false) + { + MsSetThreadSingleCpu(); + } + + is_using_selow = false; + } + + e = ZeroMalloc(sizeof(ETH)); + e->Name = CopyStr(t->Name); + + Win32EthMakeCombinedName(name_with_id, sizeof(name_with_id), t->Title, t->Guid); + e->Title = CopyStr(name_with_id); + + if (su_adapter != NULL) + { + // SU + e->SuAdapter = su_adapter; + e->Su = su; + + // Get event object + h = e->SuAdapter->hEvent; + + c = NewCancelSpecial(h); + e->Cancel = c; + } + else + { + // SEE + e->Adapter = a; + + wp->PacketSetBuff(e->Adapter, BRIDGE_WIN32_ETH_BUFFER); + wp->PacketSetHwFilter(e->Adapter, local ? 0x0080 : 0x0020); + wp->PacketSetMode(e->Adapter, PACKET_MODE_CAPT); + wp->PacketSetReadTimeout(e->Adapter, -1); + wp->PacketSetNumWrites(e->Adapter, 1); + + if (wp->PacketSetLoopbackBehavior != NULL) + { + // Filter loopback packet in kernel + if (GET_KETA(GetOsType(), 100) >= 3) + { + if (MsIsWindows8() == false) + { + // Enable for Windows XP, Server 2003 or later + // But disable for Windows 8 or later + bool ret = wp->PacketSetLoopbackBehavior(e->Adapter, 1); + Debug("*** PacketSetLoopbackBehavior: %u\n", ret); + + e->LoopbackBlock = ret; + } + } + } + + // Get event object + h = wp->PacketGetReadEvent(e->Adapter); + + c = NewCancelSpecial(h); + e->Cancel = c; + + e->Packet = wp->PacketAllocatePacket(); + + e->PutPacket = wp->PacketAllocatePacket(); + } + + e->Buffer = Malloc(BRIDGE_WIN32_ETH_BUFFER); + e->BufferSize = BRIDGE_WIN32_ETH_BUFFER; + + e->PacketQueue = NewQueue(); + + // Get MAC address by GUID + ms = MsGetAdapterByGuid(t->Guid); + if (ms != NULL) + { + if (ms->AddressSize == 6) + { + Copy(e->MacAddress, ms->Address, 6); + } + + MsFreeAdapter(ms); + } + + Unlock(eth_list_lock); + + return e; +} + +// Generate a combined name from NIC name and GUID +void Win32EthMakeCombinedName(char *dst, UINT dst_size, char *nicname, char *guid) +{ + // Validate arguments + if (dst == NULL || nicname == NULL || guid == NULL) + { + return; + } + + if (IsEmptyStr(guid) == false) + { + Format(dst, dst_size, "%s (ID=%010u)", nicname, Win32EthGenIdFromGuid(guid)); + } + else + { + StrCpy(dst, dst_size, nicname); + } +} + +// Decompose combined name +UINT Win32EthGetNameAndIdFromCombinedName(char *name, UINT name_size, char *str) +{ + UINT ret = 0; + char id_str[MAX_SIZE]; + UINT len; + // Validate arguments + ClearStr(name, name_size); + StrCpy(name, name_size, str); + if (name == NULL || str == NULL) + { + return 0; + } + + len = StrLen(str); + + if (len >= 16) + { + StrCpy(id_str, sizeof(id_str), str + len - 16); + + if (StartWith(id_str, " (ID=")) + { + if (EndWith(id_str, ")")) + { + char num[MAX_SIZE]; + + Zero(num, sizeof(num)); + StrCpy(num, sizeof(num), id_str + 5); + + num[StrLen(num) - 1] = 0; + + ret = ToInt(num); + + if (ret != 0) + { + name[len - 16] = 0; + } + } + } + } + + return ret; +} + +// Generate an ID from GUID +UINT Win32EthGenIdFromGuid(char *guid) +{ + char tmp[MAX_SIZE]; + UCHAR hash[SHA1_SIZE]; + UINT i; + // Validate arguments + if (guid == NULL) + { + return 0; + } + + StrCpy(tmp, sizeof(tmp), guid); + Trim(tmp); + StrUpper(tmp); + + Sha1(hash, tmp, StrLen(tmp)); + + Copy(&i, hash, sizeof(UINT)); + + i = Endian32(i); + + if (i == 0) + { + i = 1; + } + + return i; +} + +// Get Ethernet adapter list +TOKEN_LIST *GetEthList() +{ + UINT v; + + return GetEthListEx(&v, true, false); +} +TOKEN_LIST *GetEthListEx(UINT *total_num_including_hidden, bool enum_normal, bool enum_rawip) +{ + TOKEN_LIST *ret; + UINT i; + UINT j; + UINT dummy_int; + MS_ADAPTER_LIST *adapter_list; + + if (IsEthSupported() == false) + { + return NULL; + } + + if (enum_normal == false) + { + return NullToken(); + } + + if (total_num_including_hidden == NULL) + { + total_num_including_hidden = &dummy_int; + } + + *total_num_including_hidden = 0; + + Lock(eth_list_lock); + + InitEthAdaptersList(); + + adapter_list = MsCreateAdapterList(); + + ret = ZeroMalloc(sizeof(TOKEN_LIST)); + ret->NumTokens = LIST_NUM(eth_list); + ret->Token = ZeroMalloc(sizeof(char *) * ret->NumTokens); + j = 0; + for (i = 0;i < ret->NumTokens;i++) + { + char tmp[MAX_SIZE]; + WP_ADAPTER *a = LIST_DATA(eth_list, i); + MS_ADAPTER *msa = NULL; + bool show = true; + + if (Win32EthGetShowAllIf() == false) + { + msa = MsGetAdapterByGuidFromList(adapter_list, a->Guid); + + if (InStr(a->Title, "vpn client adapter")) + { + // Hide virtual NIC for VPN client + show = false; + } + + if (InStr(a->Title, "tunnel adapter")) + { + // Hide tunnel adapter + show = false; + } + + if (InStr(a->Title, "teredo tunnel")) + { + // Hide tunnel adapter + show = false; + } + + if (InStr(a->Title, "MS Tunnel Interface")) + { + // Hide tunnel adapter + show = false; + } + + if (InStr(a->Title, "pseudo-interface")) + { + // Hide tunnel adapter + show = false; + } + } + + if (msa != NULL) + { + // Hide except physical Ethernet NIC + if (msa->IsNotEthernetLan) + { + show = false; + } + + MsFreeAdapter(msa); + } + + Win32EthMakeCombinedName(tmp, sizeof(tmp), a->Title, a->Guid); + + if (show) + { + ret->Token[j++] = CopyStr(tmp); + + Debug("%s - %s\n", a->Guid, a->Title); + } + } + + *total_num_including_hidden = ret->NumTokens; + + ret->NumTokens = j; + + Unlock(eth_list_lock); + + MsFreeAdapterList(adapter_list); + + return ret; +} + +// Compare the name of WP_ADAPTER +int CompareWpAdapter(void *p1, void *p2) +{ + int i; + WP_ADAPTER *a1, *a2; + if (p1 == NULL || p2 == NULL) + { + return 0; + } + a1 = *(WP_ADAPTER **)p1; + a2 = *(WP_ADAPTER **)p2; + if (a1 == NULL || a2 == NULL) + { + return 0; + } + i = StrCmpi(a1->Title, a2->Title); + return i; +} + +// Get whether the SeLow is used +bool Win32IsUsingSeLow() +{ + return is_using_selow; +} + +// Get Ethernet adapter list +LIST *GetEthAdapterList() +{ + void *p; + LIST *o; + + p = MsDisableWow64FileSystemRedirection(); + + o = GetEthAdapterListInternal(); + + MsRestoreWow64FileSystemRedirection(p); + + return o; +} +LIST *GetEthAdapterListInternal() +{ + LIST *o; + LIST *ret; + UINT size; + char *buf; + UINT i, j; + char *qos_tag = " (Microsoft's Packet Scheduler)"; + SU *su = NULL; + LIST *su_adapter_list = NULL; + + // Try to use SeLow + if (enable_selow) + { + su = SuInit(); + } + + o = NewListFast(CompareWpAdapter); + + size = 200000; + buf = ZeroMalloc(size); + + // Try to enumerate with SeLow + if (su != NULL) + { + su_adapter_list = SuGetAdapterList(su); + + if (su_adapter_list == NULL) + { + // Fail to enumerate + SuFree(su); + su = NULL; + //WHERE; + is_using_selow = false; + } + else + { + //WHERE; + is_using_selow = true; + } + } + else + { + is_using_selow = false; + } + + if (su_adapter_list != NULL) + { + // If 1 or more adapters are enumerated by SeLow, create adapter list object + UINT i; + + for (i = 0;i < LIST_NUM(su_adapter_list);i++) + { + SU_ADAPTER_LIST *t = LIST_DATA(su_adapter_list, i); + WP_ADAPTER *a = ZeroMalloc(sizeof(WP_ADAPTER)); + + StrCpy(a->Name, sizeof(a->Name), t->Name); + StrCpy(a->Guid, sizeof(a->Guid), t->Guid); + StrCpy(a->Title, sizeof(a->Title), t->Info.FriendlyName); + + TrimCrlf(a->Title); + Trim(a->Title); + TrimCrlf(a->Title); + Trim(a->Title); + + if (EndWith(a->Title, qos_tag)) + { + a->Title[StrLen(a->Title) - StrLen(qos_tag)] = 0; + TrimCrlf(a->Title); + Trim(a->Title); + TrimCrlf(a->Title); + Trim(a->Title); + } + + Add(o, a); + } + } + else + { + // When SeLow is not used, create adapter list with SEE or WinPcap + if (wp->PacketGetAdapterNames(buf, &size) == false) + { + Free(buf); + return o; + } + + i = 0; + + if (OS_IS_WINDOWS_NT(GetOsInfo()->OsType)) + { + // Windows NT + if (size >= 2 && buf[0] != 0 && buf[1] != 0) + { + goto ANSI_STR; + } + + while (true) + { + wchar_t tmp[MAX_SIZE]; + WP_ADAPTER *a; + UniStrCpy(tmp, sizeof(tmp), L""); + + if (*((wchar_t *)(&buf[i])) == 0) + { + i += sizeof(wchar_t); + break; + } + + for (;*((wchar_t *)(&buf[i])) != 0;i += sizeof(wchar_t)) + { + wchar_t str[2]; + str[0] = *((wchar_t *)(&buf[i])); + str[1] = 0; + UniStrCat(tmp, sizeof(tmp), str); + } + + i += sizeof(wchar_t); + + a = ZeroMalloc(sizeof(WP_ADAPTER)); + UniToStr(a->Name, sizeof(a->Name), tmp); + + Add(o, a); + } + } + else + { + // Windows 9x +ANSI_STR: + while (true) + { + char tmp[MAX_SIZE]; + WP_ADAPTER *a; + StrCpy(tmp, sizeof(tmp), ""); + + if (*((char *)(&buf[i])) == 0) + { + i += sizeof(char); + break; + } + + for (;*((char *)(&buf[i])) != 0;i += sizeof(char)) + { + char str[2]; + str[0] = *((char *)(&buf[i])); + str[1] = 0; + StrCat(tmp, sizeof(tmp), str); + } + + i += sizeof(char); + + a = ZeroMalloc(sizeof(WP_ADAPTER)); + StrCpy(a->Name, sizeof(a->Name), tmp); + + Add(o, a); + } + } + + for (j = 0;j < LIST_NUM(o);j++) + { + WP_ADAPTER *a = LIST_DATA(o, j); + + StrCpy(a->Title, sizeof(a->Title), &buf[i]); + i += StrSize(a->Title); + + // If device description is "Unknown" in Win9x, skip 1 byte + if (OS_IS_WINDOWS_9X(GetOsInfo()->OsType)) + { + if (StrCmp(a->Title, "Unknown") == 0) + { + if (buf[i] == 0) + { + i+=sizeof(char); + } + } + } + + TrimCrlf(a->Title); + Trim(a->Title); + TrimCrlf(a->Title); + Trim(a->Title); + + if (EndWith(a->Title, qos_tag)) + { + a->Title[StrLen(a->Title) - StrLen(qos_tag)] = 0; + TrimCrlf(a->Title); + Trim(a->Title); + TrimCrlf(a->Title); + Trim(a->Title); + } + } + } + + for (j = 0;j < LIST_NUM(o);j++) + { + // Extract GUID + WP_ADAPTER *a = LIST_DATA(o, j); + + if (IsEmptyStr(a->Guid)) + { + StrCpy(a->Guid, sizeof(a->Guid), a->Name); + ReplaceStr(a->Guid, sizeof(a->Guid), a->Guid, "\\Device\\SEE_", ""); + ReplaceStr(a->Guid, sizeof(a->Guid), a->Guid, "\\Device\\NPF_", ""); + ReplaceStr(a->Guid, sizeof(a->Guid), a->Guid, "\\Device\\PCD_", ""); + } + } + + // Sort + if (su_adapter_list != NULL) + { + // Since adapter list made by SeLow is already sorted, don't sort here + Sort(o); + } + + ret = NewListFast(CompareWpAdapter); + + for (i = 0;i < LIST_NUM(o);i++) + { + WP_ADAPTER *a = LIST_DATA(o, i); + ADAPTER *ad; + bool is_ethernet = false; + bool ok = false; + + if (SearchStrEx(a->Title, "ppp", 0, false) != INFINITE || + SearchStrEx(a->Title, "wan", 0, false) != INFINITE || + SearchStrEx(a->Title, "dialup", 0, false) != INFINITE || + SearchStrEx(a->Title, "pptp", 0, false) != INFINITE || + SearchStrEx(a->Title, "telepho", 0, false) != INFINITE || + SearchStrEx(a->Title, "modem", 0, false) != INFINITE || + SearchStrEx(a->Title, "ras", 0, false) != INFINITE) + { + Free(a); + continue; + } + + // Determine whether the adapter type is Ethernet + if (su == NULL) + { + // Determine with See + ad = wp->PacketOpenAdapter(a->Name); + if (ad != NULL) + { + NetType type; + if (wp->PacketGetNetType(ad, &type)) + { + if (type.LinkType == 0) + { + is_ethernet = true; + } + } + + wp->PacketCloseAdapter(ad); + } + } + else + { + // In using SeLow, all devices should be Ethernet device + is_ethernet = true; + } + + if (is_ethernet) + { + // Add only Ethernet device + char tmp[MAX_SIZE]; + UINT k; + + StrCpy(tmp, sizeof(tmp), a->Title); + + for (k = 0;;k++) + { + if (k == 0) + { + StrCpy(tmp, sizeof(tmp), a->Title); + } + else + { + Format(tmp, sizeof(tmp), "%s (%u)", a->Title, k + 1); + } + + ok = true; + for (j = 0;j < LIST_NUM(ret);j++) + { + WP_ADAPTER *aa = LIST_DATA(ret, j); + if (StrCmpi(aa->Title, tmp) == 0) + { + ok = false; + } + } + + if (ok) + { + break; + } + } + + StrCpy(a->Title, sizeof(a->Title), tmp); + a->Id = Win32EthGenIdFromGuid(a->Guid); + Add(ret, a); + } + + if (ok == false) + { + Free(a); + } + } + + Free(buf); + + Sort(ret); + + ReleaseList(o); + + if (su != NULL) + { + SuFreeAdapterList(su_adapter_list); + + SuFree(su); + } + + return ret; +} + +// Initialize Ethernet adapter list +void InitEthAdaptersList() +{ + if (eth_list != NULL) + { + FreeEthAdaptersList(); + eth_list = NULL; + } + eth_list = GetEthAdapterList(); +} + +// Free Ethernet adapter list +void FreeEthAdaptersList() +{ + UINT i; + if (eth_list == NULL) + { + return; + } + for (i = 0;i < LIST_NUM(eth_list);i++) + { + WP_ADAPTER *a = LIST_DATA(eth_list, i); + Free(a); + } + ReleaseList(eth_list); + eth_list = NULL; +} + +// Is the SU supported +bool Win32EthIsSuSupported() +{ + bool ret = false; + SU *su = SuInit(); + + if (su != NULL) + { + ret = true; + } + + SuFree(su); + + return ret; +} + +// Is the Ethernet supported +bool IsEthSupported() +{ + bool ret = IsEthSupportedInner(); + + if (ret == false) + { + ret = Win32EthIsSuSupported(); + } + + return ret; +} +bool IsEthSupportedInner() +{ + if (wp == NULL) + { + return false; + } + + return wp->Inited; +} + +// Is the PCD driver supported in current OS +bool IsPcdSupported() +{ + UINT type; + OS_INFO *info = GetOsInfo(); + + if (MsIsWindows10()) + { + // Windows 10 or later never supports PCD driver. + return false; + } + + type = info->OsType; + + if (OS_IS_WINDOWS_NT(type) == false) + { + // Only on Windows NT series + return false; + } + + if (GET_KETA(type, 100) >= 2) + { + // Good for Windows 2000 or later + return true; + } + + // Not good for Windows NT 4.0 or Longhorn + return false; +} + +// Save build number of PCD driver +void SavePcdDriverBuild(UINT build) +{ + MsRegWriteInt(REG_LOCAL_MACHINE, BRIDGE_WIN32_PCD_REGKEY, BRIDGE_WIN32_PCD_BUILDVALUE, + build); +} + +// Load build number of PCD driver +UINT LoadPcdDriverBuild() +{ + return MsRegReadInt(REG_LOCAL_MACHINE, BRIDGE_WIN32_PCD_REGKEY, BRIDGE_WIN32_PCD_BUILDVALUE); +} + +// Try to install PCD driver +HINSTANCE InstallPcdDriver() +{ + HINSTANCE ret; + void *p = MsDisableWow64FileSystemRedirection(); + + ret = InstallPcdDriverInternal(); + + MsRestoreWow64FileSystemRedirection(p); + + return ret; +} +HINSTANCE InstallPcdDriverInternal() +{ + char tmp[MAX_PATH]; + bool install_driver = true; + HINSTANCE h; + char *dll_filename; + + // Confirm whether the see.sys is installed in system32\drivers folder + Format(tmp, sizeof(tmp), "%s\\drivers\\see.sys", MsGetSystem32Dir()); + + if (IsFileExists(tmp)) + { + // If driver file is exist, try to get build number from registry + if (LoadPcdDriverBuild() >= CEDAR_VERSION_BUILD) + { + // Already latest driver is installed + install_driver = false; + } + } + + if (install_driver) + { + char *src_filename = BRIDGE_WIN32_PCD_SYS; + // If need to install the driver, confirm user is administrator + if (MsIsAdmin() == false) + { + // Non administrator can't install driver + return NULL; + } + + if (MsIsX64()) + { + src_filename = BRIDGE_WIN32_PCD_SYS_X64; + } + + // Copy see.sys + if (FileCopy(src_filename, tmp) == false) + { + return NULL; + } + + // Save build number + SavePcdDriverBuild(CEDAR_VERSION_BUILD); + } + + dll_filename = BRIDGE_WIN32_PCD_DLL; + + if (Is64()) + { + if (MsIsX64()) + { + dll_filename = BRIDGE_WIN32_PCD_DLL_X64; + } + } + + // Try to load see.dll and initialize + h = MsLoadLibrary(dll_filename); + if (h == NULL) + { + return NULL; + } + + return h; +} + +// Initialize Ethernet +void InitEth() +{ + HINSTANCE h; + if (wp != NULL) + { + // Already initialized + return; + } + + eth_list_lock = NewLock(); + + wp = ZeroMalloc(sizeof(WP)); + + is_see_mode = false; + + if (IsPcdSupported()) + { + // PCD is supported in this OS + h = InstallPcdDriver(); + if (h != NULL) + { + // Try to initialize with PCD + if (InitWpWithLoadLibrary(wp, h) == false) + { + Debug("InitEth: SEE Failed.\n"); + FreeLibrary(h); + } + else + { + Debug("InitEth: SEE Loaded.\n"); + is_see_mode = true; + } + } + } + + if (wp->Inited == false) + { + // Try to initialize with Packet.dll of WinPcap + h = LoadLibrary(BRIDGE_WIN32_PACKET_DLL); + if (h != NULL) + { + if (InitWpWithLoadLibrary(wp, h) == false) + { + Debug("InitEth: Packet.dll Failed.\n"); + FreeLibrary(h); + } + else + { + Debug("InitEth: Packet.dll Loaded.\n"); + } + } + } +} + +// Get whether local-bridge uses see.sys +bool IsWin32BridgeWithSee() +{ + return is_see_mode; +} + +// Initialize WP structure with DLL +bool InitWpWithLoadLibrary(WP *wp, HINSTANCE h) +{ + TOKEN_LIST *o; + UINT total_num = 0; + // Validate arguments + if (wp == NULL || h == NULL) + { + return false; + } + wp->Inited = true; + wp->hPacketDll = h; + + LOAD_DLL_ADDR(PacketGetVersion); + LOAD_DLL_ADDR(PacketGetDriverVersion); + LOAD_DLL_ADDR(PacketSetMinToCopy); + LOAD_DLL_ADDR(PacketSetNumWrites); + LOAD_DLL_ADDR(PacketSetMode); + LOAD_DLL_ADDR(PacketSetReadTimeout); + LOAD_DLL_ADDR(PacketSetBpf); + LOAD_DLL_ADDR(PacketSetSnapLen); + LOAD_DLL_ADDR(PacketGetStats); + LOAD_DLL_ADDR(PacketGetStatsEx); + LOAD_DLL_ADDR(PacketSetBuff); + LOAD_DLL_ADDR(PacketGetNetType); + LOAD_DLL_ADDR(PacketOpenAdapter); + LOAD_DLL_ADDR(PacketSendPacket); + LOAD_DLL_ADDR(PacketSendPackets); + LOAD_DLL_ADDR(PacketAllocatePacket); + LOAD_DLL_ADDR(PacketInitPacket); + LOAD_DLL_ADDR(PacketFreePacket); + LOAD_DLL_ADDR(PacketReceivePacket); + LOAD_DLL_ADDR(PacketSetHwFilter); + LOAD_DLL_ADDR(PacketGetAdapterNames); + LOAD_DLL_ADDR(PacketGetNetInfoEx); + LOAD_DLL_ADDR(PacketRequest); + LOAD_DLL_ADDR(PacketGetReadEvent); + LOAD_DLL_ADDR(PacketSetDumpName); + LOAD_DLL_ADDR(PacketSetDumpLimits); + LOAD_DLL_ADDR(PacketSetDumpLimits); + LOAD_DLL_ADDR(PacketIsDumpEnded); + LOAD_DLL_ADDR(PacketStopDriver); + LOAD_DLL_ADDR(PacketCloseAdapter); + LOAD_DLL_ADDR(PacketSetLoopbackBehavior); + + if (wp->PacketSetMinToCopy == NULL || + wp->PacketSetNumWrites == NULL || + wp->PacketSetMode == NULL || + wp->PacketSetReadTimeout == NULL || + wp->PacketSetBuff == NULL || + wp->PacketGetNetType == NULL || + wp->PacketOpenAdapter == NULL || + wp->PacketSendPacket == NULL || + wp->PacketSendPackets == NULL || + wp->PacketAllocatePacket == NULL || + wp->PacketInitPacket == NULL || + wp->PacketFreePacket == NULL || + wp->PacketReceivePacket == NULL || + wp->PacketSetHwFilter == NULL || + wp->PacketGetAdapterNames == NULL || + wp->PacketGetNetInfoEx == NULL || + wp->PacketCloseAdapter == NULL) + { +RELEASE: + wp->Inited = false; + wp->hPacketDll = NULL; + + return false; + } + + o = GetEthListEx(&total_num, true, false); + if (o == NULL || total_num == 0) + { + FreeToken(o); + goto RELEASE; + } + + FreeToken(o); + + return true; +} + +// Free Ethernet +void FreeEth() +{ + if (wp == NULL) + { + // Not initialized + return; + } + + // Free adapter list + FreeEthAdaptersList(); + + if (wp->Inited) + { + // Free DLL + FreeLibrary(wp->hPacketDll); + } + + Free(wp); + wp = NULL; + + DeleteLock(eth_list_lock); + eth_list_lock = NULL; +} + +// Get network connection name from Ethernet device name +void GetEthNetworkConnectionName(wchar_t *dst, UINT size, char *device_name) +{ + WP_ADAPTER *t; + char *tmp = NULL, guid[MAX_SIZE]; + wchar_t *ncname = NULL; + + UniStrCpy(dst, size, L""); + + // Validate arguments + if (device_name == NULL || IsEthSupported() == false || + IsNt() == false || MsIsWin2000OrGreater() == false) + { + return; + } + + Lock(eth_list_lock); + + InitEthAdaptersList(); + + t = Win32EthSearch(device_name); + + if (t == NULL) + { + Unlock(eth_list_lock); + return; + } + + tmp = CopyStr(t->Name); + Unlock(eth_list_lock); + + if (IsEmptyStr(t->Guid) == false) + { + StrCpy(guid, sizeof(guid), t->Guid); + + Free(tmp); + } + else + { + ReplaceStr(guid, sizeof(guid), tmp, "\\Device\\SEE_", ""); + Free(tmp); + + ReplaceStr(guid, sizeof(guid), guid, "\\Device\\NPF_", ""); + ReplaceStr(guid, sizeof(guid), guid, "\\Device\\PCD_", ""); + } + + if(guid == NULL) + { + return; + } + + ncname = MsGetNetworkConnectionName(guid); + if(ncname != NULL) + { + UniStrCpy(dst, size, ncname); + } + Free(ncname); +} + +#endif // BRIDGE_C + + diff --git a/src/Cedar/BridgeWin32.h b/src/Cedar/BridgeWin32.h index da08850d..69560511 100644 --- a/src/Cedar/BridgeWin32.h +++ b/src/Cedar/BridgeWin32.h @@ -1,162 +1,162 @@ -// SoftEther VPN Source Code - Developer Edition Master Branch -// Cedar Communication Module - - -// BridgeWin32.h -// Header of BridgeWin32.c - -#ifndef BRIDGEWIN32_H -#define BRIDGEWIN32_H - -#define BRIDGE_WIN32_PACKET_DLL "Packet.dll" -#define BRIDGE_WIN32_PCD_DLL "|see.dll" -#define BRIDGE_WIN32_PCD_SYS "|DriverPackages\\See\\x86\\See_x86.sys" -#define BRIDGE_WIN32_PCD_DLL_X64 "|see_x64.dll" -#define BRIDGE_WIN32_PCD_SYS_X64 "|DriverPackages\\See\\x64\\See_x64.sys" -#define BRIDGE_WIN32_PCD_REGKEY "SYSTEM\\CurrentControlSet\\services\\SEE" -#define BRIDGE_WIN32_PCD_BUILDVALUE "CurrentInstalledBuild" - -#define BRIDGE_WIN32_ETH_BUFFER (1048576) - - -typedef void *HANDLE; - -#ifdef BRIDGE_C - -// Header for Internal function (for BridgeWin32.c) -typedef struct WP -{ - bool Inited; - HINSTANCE hPacketDll; - PCHAR (*PacketGetVersion)(); - PCHAR (*PacketGetDriverVersion)(); - BOOLEAN (*PacketSetMinToCopy)(LPADAPTER AdapterObject,int nbytes); - BOOLEAN (*PacketSetNumWrites)(LPADAPTER AdapterObject,int nwrites); - BOOLEAN (*PacketSetMode)(LPADAPTER AdapterObject,int mode); - BOOLEAN (*PacketSetReadTimeout)(LPADAPTER AdapterObject,int timeout); - BOOLEAN (*PacketSetBpf)(LPADAPTER AdapterObject,struct bpf_program *fp); - INT (*PacketSetSnapLen)(LPADAPTER AdapterObject,int snaplen); - BOOLEAN (*PacketGetStats)(LPADAPTER AdapterObject,struct bpf_stat *s); - BOOLEAN (*PacketGetStatsEx)(LPADAPTER AdapterObject,struct bpf_stat *s); - BOOLEAN (*PacketSetBuff)(LPADAPTER AdapterObject,int dim); - BOOLEAN (*PacketGetNetType)(LPADAPTER AdapterObject,NetType *type); - LPADAPTER (*PacketOpenAdapter)(PCHAR AdapterName); - BOOLEAN (*PacketSendPacket)(LPADAPTER AdapterObject,LPPACKET pPacket,BOOLEAN Sync); - INT (*PacketSendPackets)(LPADAPTER AdapterObject,PVOID PacketBuff,ULONG Size, BOOLEAN Sync); - LPPACKET (*PacketAllocatePacket)(void); - VOID (*PacketInitPacket)(LPPACKET lpPacket,PVOID Buffer,UINT Length); - VOID (*PacketFreePacket)(LPPACKET lpPacket); - BOOLEAN (*PacketReceivePacket)(LPADAPTER AdapterObject,LPPACKET lpPacket,BOOLEAN Sync); - BOOLEAN (*PacketSetHwFilter)(LPADAPTER AdapterObject,ULONG Filter); - BOOLEAN (*PacketGetAdapterNames)(PTSTR pStr,PULONG BufferSize); - BOOLEAN (*PacketGetNetInfoEx)(PCHAR AdapterName, npf_if_addr* buffer, PLONG NEntries); - BOOLEAN (*PacketRequest)(LPADAPTER AdapterObject,BOOLEAN Set,PPACKET_OID_DATA OidData); - HANDLE (*PacketGetReadEvent)(LPADAPTER AdapterObject); - BOOLEAN (*PacketSetDumpName)(LPADAPTER AdapterObject, void *name, int len); - BOOLEAN (*PacketSetDumpLimits)(LPADAPTER AdapterObject, UINT maxfilesize, UINT maxnpacks); - BOOLEAN (*PacketIsDumpEnded)(LPADAPTER AdapterObject, BOOLEAN sync); - BOOL (*PacketStopDriver)(); - VOID (*PacketCloseAdapter)(LPADAPTER lpAdapter); - BOOLEAN (*PacketSetLoopbackBehavior)(LPADAPTER AdapterObject, UINT LoopbackBehavior); -} WP; - -// Adapter list -typedef struct WP_ADAPTER -{ - char Name[MAX_SIZE]; - char Title[MAX_SIZE]; - char Guid[MAX_SIZE]; - UINT Id; -} WP_ADAPTER; - -// Internal function prototype -void InitEthAdaptersList(); -void FreeEthAdaptersList(); -int CompareWpAdapter(void *p1, void *p2); -LIST *GetEthAdapterList(); -LIST *GetEthAdapterListInternal(); -bool InitWpWithLoadLibrary(WP *wp, HINSTANCE h); -bool IsPcdSupported(); -HINSTANCE InstallPcdDriver(); -HINSTANCE InstallPcdDriverInternal(); -UINT LoadPcdDriverBuild(); -void SavePcdDriverBuild(UINT build); - -#endif // BRIDGE_C - -typedef struct _ADAPTER ADAPTER; -typedef struct _PACKET PACKET; - -// ETH structure -struct ETH -{ - char *Name; // Adapter name - char *Title; // Adapter title - ADAPTER *Adapter; // Adapter - CANCEL *Cancel; // Cancel object - UCHAR *Buffer; // Buffer - UINT BufferSize; // Buffer size - PACKET *Packet; // Packet - PACKET *PutPacket; // Write packet - QUEUE *PacketQueue; // Packet queue - UINT64 LastSetSingleCpu; // Date and time set to a single CPU to last - bool LoopbackBlock; // Whether to block the loop back packet - bool Empty; // It is empty - UCHAR MacAddress[6]; // MAC address - bool HasFatalError; // A fatal error occurred on the transmission side - - SU *Su; // SeLow handle - SU_ADAPTER *SuAdapter; // SeLow adapter handle - - // Unused - bool IsRawIpMode; // RAW IP mode - UCHAR RawIpMyMacAddr[6]; - UCHAR RawIpYourMacAddr[6]; - IP MyPhysicalIPForce; -}; - -// Function prototype -void InitEth(); -void FreeEth(); -bool IsEthSupported(); -bool IsEthSupportedInner(); -TOKEN_LIST *GetEthList(); -TOKEN_LIST *GetEthListEx(UINT *total_num_including_hidden, bool enum_normal, bool enum_rawip); -ETH *OpenEth(char *name, bool local, bool tapmode, char *tapaddr); -ETH *OpenEthInternal(char *name, bool local, bool tapmode, char *tapaddr); -void CloseEth(ETH *e); -CANCEL *EthGetCancel(ETH *e); -UINT EthGetPacket(ETH *e, void **data); -void EthPutPacket(ETH *e, void *data, UINT size); -void EthPutPackets(ETH *e, UINT num, void **datas, UINT *sizes); -void GetEthNetworkConnectionName(wchar_t *dst, UINT size, char *device_name); -bool IsWin32BridgeWithSee(); -UINT EthGetMtu(ETH *e); -bool EthSetMtu(ETH *e, UINT mtu); -bool EthIsChangeMtuSupported(ETH *e); - -bool Win32EthIsSuSupported(); - -void Win32EthSetShowAllIf(bool b); -bool Win32EthGetShowAllIf(); - -bool EnumEthVLanWin32(RPC_ENUM_ETH_VLAN *t); -bool GetClassRegKeyWin32(char *key, UINT key_size, char *short_key, UINT short_key_size, char *guid); -int CmpRpcEnumEthVLan(void *p1, void *p2); -void GetVLanSupportStatus(RPC_ENUM_ETH_VLAN_ITEM *e); -void GetVLanEnableStatus(RPC_ENUM_ETH_VLAN_ITEM *e); -bool SetVLanEnableStatus(char *title, bool enable); -RPC_ENUM_ETH_VLAN_ITEM *FindEthVLanItem(RPC_ENUM_ETH_VLAN *t, char *name); -char *SearchDeviceInstanceIdFromShortKey(char *short_key); -void Win32EthMakeCombinedName(char *dst, UINT dst_size, char *nicname, char *guid); -UINT Win32EthGenIdFromGuid(char *guid); -UINT Win32EthGetNameAndIdFromCombinedName(char *name, UINT name_size, char *str); - -struct WP_ADAPTER *Win32EthSearch(char *name); -bool Win32IsUsingSeLow(); -void Win32SetEnableSeLow(bool b); -bool Win32GetEnableSeLow(); - -#endif // BRIDGEWIN32_H - - +// SoftEther VPN Source Code - Developer Edition Master Branch +// Cedar Communication Module + + +// BridgeWin32.h +// Header of BridgeWin32.c + +#ifndef BRIDGEWIN32_H +#define BRIDGEWIN32_H + +#define BRIDGE_WIN32_PACKET_DLL "Packet.dll" +#define BRIDGE_WIN32_PCD_DLL "|see.dll" +#define BRIDGE_WIN32_PCD_SYS "|DriverPackages\\See\\x86\\See_x86.sys" +#define BRIDGE_WIN32_PCD_DLL_X64 "|see_x64.dll" +#define BRIDGE_WIN32_PCD_SYS_X64 "|DriverPackages\\See\\x64\\See_x64.sys" +#define BRIDGE_WIN32_PCD_REGKEY "SYSTEM\\CurrentControlSet\\services\\SEE" +#define BRIDGE_WIN32_PCD_BUILDVALUE "CurrentInstalledBuild" + +#define BRIDGE_WIN32_ETH_BUFFER (1048576) + + +typedef void *HANDLE; + +#ifdef BRIDGE_C + +// Header for Internal function (for BridgeWin32.c) +typedef struct WP +{ + bool Inited; + HINSTANCE hPacketDll; + PCHAR (*PacketGetVersion)(); + PCHAR (*PacketGetDriverVersion)(); + BOOLEAN (*PacketSetMinToCopy)(LPADAPTER AdapterObject,int nbytes); + BOOLEAN (*PacketSetNumWrites)(LPADAPTER AdapterObject,int nwrites); + BOOLEAN (*PacketSetMode)(LPADAPTER AdapterObject,int mode); + BOOLEAN (*PacketSetReadTimeout)(LPADAPTER AdapterObject,int timeout); + BOOLEAN (*PacketSetBpf)(LPADAPTER AdapterObject,struct bpf_program *fp); + INT (*PacketSetSnapLen)(LPADAPTER AdapterObject,int snaplen); + BOOLEAN (*PacketGetStats)(LPADAPTER AdapterObject,struct bpf_stat *s); + BOOLEAN (*PacketGetStatsEx)(LPADAPTER AdapterObject,struct bpf_stat *s); + BOOLEAN (*PacketSetBuff)(LPADAPTER AdapterObject,int dim); + BOOLEAN (*PacketGetNetType)(LPADAPTER AdapterObject,NetType *type); + LPADAPTER (*PacketOpenAdapter)(PCHAR AdapterName); + BOOLEAN (*PacketSendPacket)(LPADAPTER AdapterObject,LPPACKET pPacket,BOOLEAN Sync); + INT (*PacketSendPackets)(LPADAPTER AdapterObject,PVOID PacketBuff,ULONG Size, BOOLEAN Sync); + LPPACKET (*PacketAllocatePacket)(void); + VOID (*PacketInitPacket)(LPPACKET lpPacket,PVOID Buffer,UINT Length); + VOID (*PacketFreePacket)(LPPACKET lpPacket); + BOOLEAN (*PacketReceivePacket)(LPADAPTER AdapterObject,LPPACKET lpPacket,BOOLEAN Sync); + BOOLEAN (*PacketSetHwFilter)(LPADAPTER AdapterObject,ULONG Filter); + BOOLEAN (*PacketGetAdapterNames)(PTSTR pStr,PULONG BufferSize); + BOOLEAN (*PacketGetNetInfoEx)(PCHAR AdapterName, npf_if_addr* buffer, PLONG NEntries); + BOOLEAN (*PacketRequest)(LPADAPTER AdapterObject,BOOLEAN Set,PPACKET_OID_DATA OidData); + HANDLE (*PacketGetReadEvent)(LPADAPTER AdapterObject); + BOOLEAN (*PacketSetDumpName)(LPADAPTER AdapterObject, void *name, int len); + BOOLEAN (*PacketSetDumpLimits)(LPADAPTER AdapterObject, UINT maxfilesize, UINT maxnpacks); + BOOLEAN (*PacketIsDumpEnded)(LPADAPTER AdapterObject, BOOLEAN sync); + BOOL (*PacketStopDriver)(); + VOID (*PacketCloseAdapter)(LPADAPTER lpAdapter); + BOOLEAN (*PacketSetLoopbackBehavior)(LPADAPTER AdapterObject, UINT LoopbackBehavior); +} WP; + +// Adapter list +typedef struct WP_ADAPTER +{ + char Name[MAX_SIZE]; + char Title[MAX_SIZE]; + char Guid[MAX_SIZE]; + UINT Id; +} WP_ADAPTER; + +// Internal function prototype +void InitEthAdaptersList(); +void FreeEthAdaptersList(); +int CompareWpAdapter(void *p1, void *p2); +LIST *GetEthAdapterList(); +LIST *GetEthAdapterListInternal(); +bool InitWpWithLoadLibrary(WP *wp, HINSTANCE h); +bool IsPcdSupported(); +HINSTANCE InstallPcdDriver(); +HINSTANCE InstallPcdDriverInternal(); +UINT LoadPcdDriverBuild(); +void SavePcdDriverBuild(UINT build); + +#endif // BRIDGE_C + +typedef struct _ADAPTER ADAPTER; +typedef struct _PACKET PACKET; + +// ETH structure +struct ETH +{ + char *Name; // Adapter name + char *Title; // Adapter title + ADAPTER *Adapter; // Adapter + CANCEL *Cancel; // Cancel object + UCHAR *Buffer; // Buffer + UINT BufferSize; // Buffer size + PACKET *Packet; // Packet + PACKET *PutPacket; // Write packet + QUEUE *PacketQueue; // Packet queue + UINT64 LastSetSingleCpu; // Date and time set to a single CPU to last + bool LoopbackBlock; // Whether to block the loop back packet + bool Empty; // It is empty + UCHAR MacAddress[6]; // MAC address + bool HasFatalError; // A fatal error occurred on the transmission side + + SU *Su; // SeLow handle + SU_ADAPTER *SuAdapter; // SeLow adapter handle + + // Unused + bool IsRawIpMode; // RAW IP mode + UCHAR RawIpMyMacAddr[6]; + UCHAR RawIpYourMacAddr[6]; + IP MyPhysicalIPForce; +}; + +// Function prototype +void InitEth(); +void FreeEth(); +bool IsEthSupported(); +bool IsEthSupportedInner(); +TOKEN_LIST *GetEthList(); +TOKEN_LIST *GetEthListEx(UINT *total_num_including_hidden, bool enum_normal, bool enum_rawip); +ETH *OpenEth(char *name, bool local, bool tapmode, char *tapaddr); +ETH *OpenEthInternal(char *name, bool local, bool tapmode, char *tapaddr); +void CloseEth(ETH *e); +CANCEL *EthGetCancel(ETH *e); +UINT EthGetPacket(ETH *e, void **data); +void EthPutPacket(ETH *e, void *data, UINT size); +void EthPutPackets(ETH *e, UINT num, void **datas, UINT *sizes); +void GetEthNetworkConnectionName(wchar_t *dst, UINT size, char *device_name); +bool IsWin32BridgeWithSee(); +UINT EthGetMtu(ETH *e); +bool EthSetMtu(ETH *e, UINT mtu); +bool EthIsChangeMtuSupported(ETH *e); + +bool Win32EthIsSuSupported(); + +void Win32EthSetShowAllIf(bool b); +bool Win32EthGetShowAllIf(); + +bool EnumEthVLanWin32(RPC_ENUM_ETH_VLAN *t); +bool GetClassRegKeyWin32(char *key, UINT key_size, char *short_key, UINT short_key_size, char *guid); +int CmpRpcEnumEthVLan(void *p1, void *p2); +void GetVLanSupportStatus(RPC_ENUM_ETH_VLAN_ITEM *e); +void GetVLanEnableStatus(RPC_ENUM_ETH_VLAN_ITEM *e); +bool SetVLanEnableStatus(char *title, bool enable); +RPC_ENUM_ETH_VLAN_ITEM *FindEthVLanItem(RPC_ENUM_ETH_VLAN *t, char *name); +char *SearchDeviceInstanceIdFromShortKey(char *short_key); +void Win32EthMakeCombinedName(char *dst, UINT dst_size, char *nicname, char *guid); +UINT Win32EthGenIdFromGuid(char *guid); +UINT Win32EthGetNameAndIdFromCombinedName(char *name, UINT name_size, char *str); + +struct WP_ADAPTER *Win32EthSearch(char *name); +bool Win32IsUsingSeLow(); +void Win32SetEnableSeLow(bool b); +bool Win32GetEnableSeLow(); + +#endif // BRIDGEWIN32_H + + diff --git a/src/Cedar/CM.c b/src/Cedar/CM.c index fda76b33..4663403d 100644 --- a/src/Cedar/CM.c +++ b/src/Cedar/CM.c @@ -1,12720 +1,12720 @@ -// SoftEther VPN Source Code - Developer Edition Master Branch -// Cedar Communication Module - - -// CM.c -// VPN Client Connection Manager for Win32 - -#include - -#ifdef WIN32 - -#define CM_C -#define SM_C -#define MICROSOFT_C - -#define _WIN32_WINNT 0x0502 -#define WINVER 0x0502 -#define SECURITY_WIN32 -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "CMInner.h" -#include "SMInner.h" -#include "NMInner.h" -#include "EMInner.h" -#include "../PenCore/resource.h" - - -// Get the proxy server settings from the registry string of IE -bool CmGetProxyServerNameAndPortFromIeProxyRegStr(char *name, UINT name_size, UINT *port, char *str, char *server_type) -{ - TOKEN_LIST *t; - UINT i; - bool ret = false; - // Validate arguments - if (name == NULL || port == NULL || str == NULL || server_type == NULL) - { - return false; - } - - t = ParseToken(str, ";"); - - for (i = 0;i < t->NumTokens;i++) - { - char *s = t->Token[i]; - UINT i; - - Trim(s); - - i = SearchStrEx(s, "=", 0, false); - if (i != INFINITE) - { - char tmp[MAX_PATH]; - - StrCpy(name, name_size, s); - name[i] = 0; - - if (StrCmpi(name, server_type) == 0) - { - char *host; - StrCpy(tmp, sizeof(tmp), s + i + 1); - - if (ParseHostPort(tmp, &host, port, 0)) - { - StrCpy(name, name_size, host); - Free(host); - - if (*port != 0) - { - ret = true; - } - break; - } - } - } - } - - FreeToken(t); - - return ret; -} - - -// Reflect the contents of the proxy settings to the connection settings -void CmProxyDlgSet(HWND hWnd, CLIENT_OPTION *o, CM_INTERNET_SETTING *setting) -{ - // Validate arguments - if(hWnd == NULL || setting == NULL) - { - return; - } - - // Make check in check-box - Check(hWnd, R_DIRECT_TCP, setting->ProxyType == PROXY_DIRECT); - Check(hWnd, R_HTTPS, setting->ProxyType == PROXY_HTTP); - Check(hWnd, R_SOCKS, setting->ProxyType == PROXY_SOCKS); - Check(hWnd, R_SOCKS5, setting->ProxyType == PROXY_SOCKS5); - - // Proxy Settings - if(setting->ProxyType != PROXY_DIRECT) - { - StrCpy(o->ProxyName, sizeof(setting->ProxyHostName), setting->ProxyHostName); - o->ProxyPort = setting->ProxyPort; - } -} - -// Get the proxy settings of IE -void CmGetSystemInternetSetting(CM_INTERNET_SETTING *setting) -{ - bool use_proxy; - // Validate arguments - if (setting == NULL) - { - return; - } - - Zero(setting, sizeof(CM_INTERNET_SETTING)); - - use_proxy = MsRegReadInt(REG_CURRENT_USER, - "Software\\Microsoft\\Windows\\CurrentVersion\\Internet Settings", - "ProxyEnable"); - - if (use_proxy) - { - char *str = MsRegReadStr(REG_CURRENT_USER, - "Software\\Microsoft\\Windows\\CurrentVersion\\Internet Settings", - "ProxyServer"); - if (str != NULL) - { - char name[MAX_HOST_NAME_LEN + 1]; - UINT port; - - if (CmGetProxyServerNameAndPortFromIeProxyRegStr(name, sizeof(name), - &port, str, "https")) - { - setting->ProxyType = PROXY_HTTP; - StrCpy(setting->ProxyHostName, sizeof(setting->ProxyHostName), name); - setting->ProxyPort = port; - } - else if (CmGetProxyServerNameAndPortFromIeProxyRegStr(name, sizeof(name), - &port, str, "http")) - { - setting->ProxyType = PROXY_HTTP; - StrCpy(setting->ProxyHostName, sizeof(setting->ProxyHostName), name); - setting->ProxyPort = port; - } - else if (CmGetProxyServerNameAndPortFromIeProxyRegStr(name, sizeof(name), - &port, str, "socks")) - { - setting->ProxyType = PROXY_SOCKS; - StrCpy(setting->ProxyHostName, sizeof(setting->ProxyHostName), name); - setting->ProxyPort = port; - } - else - { - if (SearchStrEx(str, "=", 0, false) == INFINITE) - { - char *host; - UINT port; - if (ParseHostPort(str, &host, &port, 0)) - { - if (port != 0) - { - setting->ProxyType = PROXY_HTTP; - StrCpy(setting->ProxyHostName, sizeof(setting->ProxyHostName), host); - setting->ProxyPort = port; - } - Free(host); - } - } - } - - Free(str); - } - } -} - -// For the proxy settings to go through, use the IE settings -void CmProxyDlgUseForIE(HWND hWnd, CLIENT_OPTION *o) -{ - CM_INTERNET_SETTING s; - - // Validate arguments - if(hWnd == NULL) - { - return; - } - - Zero(&s, sizeof(s)); - CmGetSystemInternetSetting(&s); - - CmProxyDlgSet(hWnd, o, &s); -} - -// Determine the bitmap ID of the smart card authentication screen -UINT CmGetSecureBitmapId(char *dest_hostname) -{ - // Validate arguments - if (dest_hostname == NULL) - { - return 0; - } - - if (EndWith(dest_hostname, ".cc.tsukuba.ac.jp")) - { - return BMP_TSUKUBA; - } - - return 0; -} - -// Activate the window of UAC -void CmSetUacWindowActive() -{ - HWND hWnd; - - if (MsIsVista() == false) - { - return; - } - - hWnd = FindWindowA("$$$Secure UAP Dummy Window Class For Interim Dialog", NULL); - if (hWnd == NULL) - { - return; - } - - SwitchToThisWindow(hWnd, true); -} - -// UAC helper thread -void CmUacHelperThread(THREAD *thread, void *param) -{ - CM_UAC_HELPER *c = (CM_UAC_HELPER *)param; - // Validate arguments - if (c == NULL) - { - return; - } - - while (c->Halt == false) - { - CmSetUacWindowActive(); - - Wait(c->HaltEvent, 200); - } -} - -// Start the UAC helper -void *CmStartUacHelper() -{ - CM_UAC_HELPER *c = ZeroMalloc(sizeof(CM_UAC_HELPER)); - - c->HaltEvent = NewEvent(); - c->Thread = NewThread(CmUacHelperThread, c); - - return (void *)c; -} - -// Stop the UAC helper -void CmStopUacHelper(void *p) -{ - CM_UAC_HELPER *c = (CM_UAC_HELPER *)p; - // Validate arguments - if (c == NULL) - { - return; - } - - c->Halt = true; - Set(c->HaltEvent); - WaitThread(c->Thread, INFINITE); - ReleaseEvent(c->HaltEvent); - ReleaseThread(c->Thread); - - Free(c); -} - -// Command invocation of the simple connection manager -void CmEasyDlgOnCommand(HWND hWnd, CM_EASY_DLG *d, WPARAM wParam, LPARAM lParam) -{ - // Validate arguments - if (hWnd == NULL || d == NULL) - { - return; - } - - switch (wParam) - { - case B_MODE: - Command(hWnd, CMD_CM_SETTING); - return; - - case B_STATUS: - Command(hWnd, CMD_STATUS); - return; - - case IDCANCEL: - Close(hWnd); - return; - - } - - if (wParam == CMD_CONNECT) - { - cm->ConnectStartedFlag = false; - } - - CmMainWindowOnCommandEx(hWnd, wParam, lParam, true); - - if (wParam == CMD_CONNECT && cm->ConnectStartedFlag) - { - // Close the window when the connection started successfully - Close(hWnd); - } -} - -// Keyboard pressing of the simple connection manager -void CmEasyDlgOnKey(HWND hWnd, CM_EASY_DLG *d, bool ctrl, bool alt, UINT key) -{ - // Validate arguments - if (hWnd == NULL) - { - return; - } - - // Single key - switch (key) - { - case VK_RETURN: - Command(hWnd, IDOK); - break; - case VK_DELETE: - // Delete - if (IsFocus(hWnd, L_ACCOUNT)) - { - // Operation on the account list - Command(hWnd, CMD_DELETE); - } - else - { - // Operation on the virtual LAN card list - Command(hWnd, CMD_DELETE_VLAN); - } - break; - case VK_F2: - // Change the name - Command(hWnd, CMD_RENAME); - break; - case VK_F5: - // Update the status - Command(hWnd, CMD_REFRESH); - break; - } - - if (alt) - { - switch (key) - { - case 'Q': - // Close - Command(hWnd, CMD_QUIT); - break; - } - } - - if (ctrl) - { - switch (key) - { - case 'G': - // Smart Card Manager - Command(hWnd, CMD_SECURE_MANAGER); - break; - case 'S': - // Show the status - Command(hWnd, CMD_STATUS); - break; - case 'I': - // Disconnect all connections - Command(hWnd, CMD_DISCONNECT_ALL); - break; - case 'D': - // Disconnect - Command(hWnd, CMD_DISCONNECT); - break; - case 'N': - // Create a new connection setting - Command(hWnd, CMD_NEW); - break; - case 'C': - // Creating a copy - Command(hWnd, CMD_CLONE); - break; - case 'T': - // Set to start-up connection - Command(hWnd, CMD_STARTUP); - break; - case 'A': - // Select all - Command(hWnd, CMD_SELECT_ALL); - break; - case 'L': - // Create a new virtual LAN card - Command(hWnd, CMD_NEW_VLAN); - break; - case 'P': - // Set the password - Command(hWnd, CMD_PASSWORD); - break; - case 'O': - // Option settings - Command(hWnd, CMD_TRAFFIC); - break; - case 'R': - // Certificate management - Command(hWnd, CMD_TRUST); - break; - case 'Q': - // Throughput - Command(hWnd, CMD_TRAFFIC); - break; - } - } -} - -// Operation on the list view of the simple connection manager -void CmEasyDlgOnNotify(HWND hWnd, CM_EASY_DLG *d, NMHDR *n) -{ - NMLVDISPINFOW *disp_info; - NMLVKEYDOWN *key; - - // Validate arguments - if (hWnd == NULL || n == NULL) - { - return; - } - - switch (n->idFrom) - { - case L_ACCOUNT: - switch (n->code) - { - case LVN_ITEMCHANGED: - CmEasyDlgUpdate(hWnd, d); - break; - case NM_DBLCLK: - // Double click - Command(hWnd, CMD_EASY_DBLCLICK); - break; - case NM_RCLICK: - // Right click - CmAccountListRightClick(hWnd); - break; - case LVN_ENDLABELEDITW: - // Change the name - disp_info = (NMLVDISPINFOW *)n; - if (disp_info->item.pszText != NULL) - { - wchar_t *new_name = disp_info->item.pszText; - wchar_t *old_name = LvGetStr(hWnd, L_ACCOUNT, disp_info->item.iItem, 0); - - if (old_name != NULL) - { - if (UniStrCmp(new_name, old_name) != 0 && UniIsEmptyStr(new_name) == false) - { - RPC_RENAME_ACCOUNT a; - Zero(&a, sizeof(a)); - UniStrCpy(a.OldName, sizeof(a.OldName), old_name); - UniStrCpy(a.NewName, sizeof(a.NewName), new_name); - if (CALL(hWnd, CcRenameAccount(cm->Client, &a))) - { - LvSetItem(hWnd, L_ACCOUNT, disp_info->item.iItem, 0, new_name); - } - } - - Free(old_name); - } - } - break; - case LVN_KEYDOWN: - // Key-press - key = (NMLVKEYDOWN *)n; - if (key != NULL) - { - bool ctrl, alt; - UINT code = key->wVKey; - ctrl = (GetKeyState(VK_CONTROL) & 0x8000) == 0 ? false : true; - alt = (GetKeyState(VK_MENU) & 0x8000) == 0 ? false : true; - CmEasyDlgOnKey(hWnd, d, ctrl, alt, code); - } - break; - } - break; - } -} - -// Send an update notification to the Simple Connection Manager -void CmRefreshEasy() -{ - if (cm->hEasyWnd == NULL) - { - return; - } - - SendMessage(cm->hEasyWnd, WM_CM_EASY_REFRESH, 0, 0); -} - -// Initialize the Simple Connect Manager -void CmEasyDlgInit(HWND hWnd, CM_EASY_DLG *d) -{ - HFONT hFontForList; - HFONT hFontButton; - HFONT hFontTitle; - HFONT hFontInfo; - HFONT hFontOther; - UINT i, num, num2, j; - bool b = false; - char *font_name = NULL; - bool font_bold = true; - // Validate arguments - if (hWnd == NULL || d == NULL) - { - return; - } - - SetIcon(hWnd, 0, ICO_VPN); - - // Window handle registration - cm->hEasyWnd = hWnd; - - // Show in the center - Center(hWnd); - - // Update the account list - CmInitAccountListEx(hWnd, true); - - // Font settings of the list - if (cm->VistaStyle) - { - if (_GETLANG() == 0) - { - font_name = "Meiryo"; - font_bold = false; - } - else if (_GETLANG() == 2) - { - font_name = "Microsoft YaHei"; - font_bold = false; - } - } - - hFontForList = GetFont(font_name, 14, font_bold, false, false, false); - hFontButton = GetFont(font_name, 13, font_bold, false, false, false); - hFontTitle = GetFont(font_name, 14, font_bold, false, false, false); - hFontInfo = GetFont(font_name, 11, font_bold, false, false, false); - hFontOther = GetDialogDefaultFont(); - - if (cm->VistaStyle) - { - hFontOther = GetMeiryoFont(); - } - - SetFont(hWnd, L_ACCOUNT, hFontForList); - SetFont(hWnd, IDOK, hFontButton); - SetFont(hWnd, S_TITLE, hFontTitle); - SetFont(hWnd, S_INFO, hFontInfo); - SetFont(hWnd, B_MODE, hFontOther); - SetFont(hWnd, IDCANCEL, hFontOther); - SetFont(hWnd, B_VGC, hFontOther); - - SetShow(hWnd, B_VGC, cm->Client->IsVgcSupported); - - CmEasyDlgRefresh(hWnd, d); - - num = LvNum(hWnd, L_ACCOUNT); - num2 = 0; - j = 0; - for (i = 0;i < num;i++) - { - wchar_t *str = LvGetStr(hWnd, L_ACCOUNT, i, 1); - - if (str != NULL) - { - if (UniStrCmpi(str, _UU("CM_ACCOUNT_ONLINE")) == 0 || UniStrCmpi(str, _UU("CM_ACCOUNT_CONNECTING")) == 0) - { - num2++; - j = i; - } - Free(str); - } - } - - if (num2 == 1) - { - LvSelect(hWnd, L_ACCOUNT, j); - b = true; - } - - if (b == false) - { - if (UniIsEmptyStr(cm->EasyLastSelectedAccountName) == false) - { - i = LvSearchStr(hWnd, L_ACCOUNT, 0, cm->EasyLastSelectedAccountName); - if (i != INFINITE) - { - LvSelect(hWnd, L_ACCOUNT, i); - b = true; - } - } - } - - if (b == false) - { - if (LvNum(hWnd, L_ACCOUNT) != 0) - { - LvSelect(hWnd, L_ACCOUNT, 0); - } - } - - Focus(hWnd, L_ACCOUNT); - - CmEasyDlgUpdate(hWnd, d); -} - -// Update the Simple Connection Manager control -void CmEasyDlgUpdate(HWND hWnd, CM_EASY_DLG *d) -{ - bool ok = true; - bool show_status = false; - wchar_t *button_str = _UU("CM_EASY_CONNECT_BUTTON_1"); - wchar_t *info_str = _UU("CM_EASY_INFO_1"); - wchar_t *title_str = _UU("CM_EASY_TITLE"); - // Validate arguments - if (hWnd == NULL || d == NULL) - { - return; - } - - if (LvIsSingleSelected(hWnd, L_ACCOUNT) == false) - { - ok = false; - } - - if (ok) - { - UINT i = LvGetSelected(hWnd, L_ACCOUNT); - wchar_t *str = LvGetStr(hWnd, L_ACCOUNT, i, 1); - - info_str = _UU("CM_EASY_INFO_2"); - - if (str != NULL) - { - if (UniStrCmpi(str, _UU("CM_ACCOUNT_ONLINE")) == 0 || UniStrCmpi(str, _UU("CM_ACCOUNT_CONNECTING")) == 0) - { - button_str = _UU("CM_EASY_CONNECT_BUTTON_2"); - show_status = true; - info_str = _UU("CM_EASY_INFO_3"); - - if (UniStrCmpi(str, _UU("CM_ACCOUNT_ONLINE")) == 0) - { - title_str = _UU("CM_EASY_CONNECTED"); - } - else - { - title_str = _UU("CM_EASY_CONNECTING"); - } - } - Free(str); - } - } - - SetShow(hWnd, B_STATUS, show_status); - - SetText(hWnd, IDOK, button_str); - SetText(hWnd, S_INFO, info_str); - SetText(hWnd, S_TITLE, title_str); - - SetShow(hWnd, IDOK, ok); -} - -// Update the Simple Connect Manager content -void CmEasyDlgRefresh(HWND hWnd, CM_EASY_DLG *d) -{ - // Validate arguments - if (hWnd == NULL || d == NULL) - { - return; - } - - // Update the account list - CmRefreshAccountListEx(hWnd, true); - - CmEasyDlgUpdate(hWnd, d); -} - -// Dialog procedure of the simple connection manager -UINT CmEasyDlg(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param) -{ - CM_EASY_DLG *d = (CM_EASY_DLG *)param; - NMHDR *n; - UINT i; - // Validate arguments - if (hWnd == NULL) - { - return 0; - } - - switch (msg) - { - case WM_INITDIALOG: - CmEasyDlgInit(hWnd, d); - SetTimer(hWnd, 1, 10, NULL); - break; - - case WM_TIMER: - switch (wParam) - { - case 1: - KillTimer(hWnd, 1); - SetForegroundWindow(hWnd); - SetActiveWindow(hWnd); - break; - } - break; - - case WM_CM_EASY_REFRESH: - CmEasyDlgRefresh(hWnd, d); - break; - - case WM_COMMAND: - CmEasyDlgOnCommand(hWnd, d, wParam, lParam); - break; - - case WM_NOTIFY: - n = (NMHDR *)lParam; - CmEasyDlgOnNotify(hWnd, d, n); - break; - - case WM_CLOSE: - i = LvGetSelected(hWnd, L_ACCOUNT); - if (i != INFINITE) - { - wchar_t *s = LvGetStr(hWnd, L_ACCOUNT, i, 0); - if (s != NULL) - { - UniStrCpy(cm->EasyLastSelectedAccountName, sizeof(cm->EasyLastSelectedAccountName), - s); - Free(s); - } - } - else - { - Zero(cm->EasyLastSelectedAccountName, sizeof(cm->EasyLastSelectedAccountName)); - } - EndDialog(hWnd, false); - break; - } - - return 0; -} - -// Show the window of the simple connection manager (This is called by a delaying timer) -void CmMainWindowOnShowEasy(HWND hWnd) -{ - CM_EASY_DLG d; - - Zero(&d, sizeof(d)); - - if (cm->CmSetting.EasyMode == false) - { - // Not in simple mode - return; - } - - if (cm->hEasyWnd != NULL) - { - // It is shown already - SetForegroundWindow(cm->hEasyWnd); - SetActiveWindow(cm->hEasyWnd); - return; - } - - Dialog(NULL, D_CM_EASY, CmEasyDlg, &d); - - cm->hEasyWnd = NULL; -} - -// Show the window of the simple connection manager -void CmShowEasy() -{ - SetTimer(cm->hMainWnd, 4, 2, NULL); -} - -// Close the window of the simple connection manager -void CmCloseEasy() -{ - if (cm->hEasyWnd == NULL) - { - return; - } - - SendMessage(cm->hEasyWnd, WM_CLOSE, 0, 0); -} - -// Message processing for such as clicking on the tray icon -void CmMainWindowOnTrayClicked(HWND hWnd, WPARAM wParam, LPARAM lParam) -{ - bool easymode = cm->CmSetting.EasyMode; - - switch (wParam) - { - case 1: - switch (lParam) - { - case WM_LBUTTONDOWN: - case WM_RBUTTONDOWN: - // Click - if (easymode == false) - { - if (IsEnable(hWnd, 0)) - { - CmShowTrayMenu(hWnd); - } - else - { - CmShowOrHideWindow(hWnd); - } - } - else - { - if (cm->hEasyWnd == NULL || IsEnable(cm->hEasyWnd, 0)) - { - CmShowTrayMenu(hWnd); - } - else - { - //CmShowOrHideWindow(hWnd); - } - } - break; - case WM_LBUTTONDBLCLK: - case WM_RBUTTONDBLCLK: - // Double click - if (easymode == false) - { - if (IsEnable(hWnd, 0)) - { - CmShowOrHideWindow(hWnd); - } - } - else - { - if (cm->hEasyWnd == NULL) - { - CmShowEasy(); - } - else - { - SetForegroundWindow(cm->hEasyWnd); - SetActiveWindow(cm->hEasyWnd); - } - } - break; - } - break; - } -} - -// Apply the setting of the operation mode -void CmApplyCmSetting() -{ - CM_SETTING a; - bool changed = false; - - if (cm->CmSettingSupported == false) - { - return; - } - - // Get the configuration of the current vpnclient - Zero(&a, sizeof(a)); - CcGetCmSetting(cm->Client, &a); - - // Check whether there is change point as compared to the previous CM_SETTING - if (cm->CmSetting.EasyMode != a.EasyMode) - { - changed = true; - } - if (cm->CmSetting.LockMode != a.LockMode) - { - changed = true; - } - - Copy(&cm->CmSetting, &a, sizeof(CM_SETTING)); - - if (changed == false) - { - return; - } - - if (cm->StartupFinished) - { - if (IsShow(cm->hMainWnd, 0) && cm->CmSetting.EasyMode) - { - // Close the main window if it is shown - Hide(cm->hMainWnd, 0); - } - else - { - WINDOWPLACEMENT current_pos; - if (cm->CmSetting.EasyMode == false && IsShow(cm->hMainWnd, 0) == false) - { - // When restored to normal mode, restore the main window - if (IsZero(&cm->FakeWindowPlacement, sizeof(cm->FakeWindowPlacement)) == false) - { - cm->FakeWindowPlacement.flags = cm->FakeWindowPlacement.flags & ~SW_MINIMIZE; - SetWindowPlacement(cm->hMainWnd, &cm->FakeWindowPlacement); - Zero(&cm->FakeWindowPlacement, sizeof(cm->FakeWindowPlacement)); - Hide(cm->hMainWnd, 0); - } - CmShowOrHideWindow(cm->hMainWnd); - } - - if (cm->CmSetting.EasyMode == false) - { - if (GetWindowPlacement(cm->hMainWnd, ¤t_pos)) - { - if (current_pos.rcNormalPosition.right < 0 || - current_pos.rcNormalPosition.bottom < 0) - { - // If the window is off the screen for some reason, - // return it in a visible place - SetWindowPos(cm->hMainWnd, NULL, 0, 0, CM_DEFAULT_WIDTH, CM_DEFAULT_HEIGHT, SWP_NOREDRAW | SWP_SHOWWINDOW); - Center(cm->hMainWnd); - } - } - } - } - - Command(cm->hMainWnd, CMD_REFRESH); - } - - if (cm->CmSetting.EasyMode) - { - if (cm->StartupFinished == false && cm->StartupMode) - { - // Don't show in the case of /startup - } - else - { - CmShowEasy(); - } - } - else - { - CmCloseEasy(); - } -} - -// Initialize the operation mode changing dialog -void CmSettingDlgInit(HWND hWnd, CM_SETTING_DLG *d) -{ - CM_SETTING a; - // Validate arguments - if (hWnd == NULL || d == NULL) - { - return; - } - - // Get the configuration of the current vpnclient - Zero(&a, sizeof(a)); - CcGetCmSetting(cm->Client, &a); - - Check(hWnd, R_EASY, a.EasyMode); - Check(hWnd, R_NORMAL, a.EasyMode == false); - - if (a.EasyMode == false) - { - Focus(hWnd, R_NORMAL); - } - else - { - Focus(hWnd, R_EASY); - } - - Check(hWnd, R_LOCK, a.LockMode); - - SetEnable(hWnd, R_EASY, cm->CmEasyModeSupported); - - if (a.LockMode) - { - if (IsZero(a.HashedPassword, sizeof(a.HashedPassword)) == false) - { - // Password is set - SetText(hWnd, S_PASSWORD1, _UU("CM_SETTING_PASSWORD")); - Hide(hWnd, S_PASSWORD3); - Hide(hWnd, E_PASSWORD2); - - d->CheckPassword = true; - Copy(d->HashedPassword, a.HashedPassword, sizeof(d->HashedPassword)); - } - } - - SetShow(hWnd, S_VGS1, cm->Client->IsVgcSupported); - SetShow(hWnd, S_VGS2, cm->Client->IsVgcSupported); - SetShow(hWnd, S_VGS3, cm->Client->IsVgcSupported); - SetShow(hWnd, B_VGS, cm->Client->IsVgcSupported); - - CmSettingDlgUpdate(hWnd, d); -} - -// Update the operation mode changing dialog -void CmSettingDlgUpdate(HWND hWnd, CM_SETTING_DLG *d) -{ - bool ok = true; - char tmp1[MAX_SIZE], tmp2[MAX_SIZE]; - // Validate arguments - if (hWnd == NULL || d == NULL) - { - return; - } - - GetTxtA(hWnd, E_PASSWORD1, tmp1, sizeof(tmp1)); - GetTxtA(hWnd, E_PASSWORD2, tmp2, sizeof(tmp2)); - - if (d->CheckPassword == false) - { - if (IsChecked(hWnd, R_LOCK)) - { - if (StrCmp(tmp1, tmp2) != 0) - { - ok = false; - } - } - } - else - { - bool password_ok = false; - UCHAR hash[SHA1_SIZE]; - - Sha0(hash, tmp1, StrLen(tmp1)); - if (Cmp(hash, d->HashedPassword, sizeof(hash)) == 0) - { - password_ok = true; - } - - if (password_ok == false) - { - Check(hWnd, R_LOCK, true); - Disable(hWnd, R_LOCK); - } - else - { - Enable(hWnd, R_LOCK); - } - } - - SetEnable(hWnd, S_PASSWORD1, IsChecked(hWnd, R_LOCK)); - SetEnable(hWnd, S_PASSWORD2, IsChecked(hWnd, R_LOCK)); - SetEnable(hWnd, S_PASSWORD3, IsChecked(hWnd, R_LOCK)); - SetEnable(hWnd, E_PASSWORD1, IsChecked(hWnd, R_LOCK)); - SetEnable(hWnd, E_PASSWORD2, IsChecked(hWnd, R_LOCK)); - - SetEnable(hWnd, IDOK, ok); -} - -// Operation mode changing dialog OK -void CmSettingDlgOnOk(HWND hWnd, CM_SETTING_DLG *d) -{ - CM_SETTING a; - char tmp1[MAX_SIZE], tmp2[MAX_SIZE]; - // Validate arguments - if (hWnd == NULL || d == NULL) - { - return; - } - - GetTxtA(hWnd, E_PASSWORD1, tmp1, sizeof(tmp1)); - GetTxtA(hWnd, E_PASSWORD2, tmp2, sizeof(tmp2)); - - Zero(&a, sizeof(a)); - - a.EasyMode = IsChecked(hWnd, R_EASY); - a.LockMode = IsChecked(hWnd, R_LOCK); - - if (a.LockMode) - { - if (d->CheckPassword && IsEnable(hWnd, R_LOCK) == false) - { - Copy(a.HashedPassword, d->HashedPassword, sizeof(a.HashedPassword)); - } - else - { - if (StrLen(tmp1) >= 1) - { - Sha0(a.HashedPassword, tmp1, StrLen(tmp1)); - } - } - } - - CcSetCmSetting(cm->Client, &a); - - EndDialog(hWnd, true); -} - -// Operation mode changing dialog -UINT CmSettingDlg(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param) -{ - CM_SETTING_DLG *d = (CM_SETTING_DLG *)param; - // Validate arguments - if (hWnd == NULL) - { - return 0; - } - - switch (msg) - { - case WM_INITDIALOG: - CmSettingDlgInit(hWnd, d); - break; - - case WM_COMMAND: - switch (LOWORD(wParam)) - { - case R_EASY: - case R_NORMAL: - case R_LOCK: - case E_PASSWORD1: - case E_PASSWORD2: - case IDOK: - case IDCANCEL: - CmSettingDlgUpdate(hWnd, d); - break; - } - switch (wParam) - { - case IDOK: - CmSettingDlgOnOk(hWnd, d); - break; - - case IDCANCEL: - Close(hWnd); - break; - - case R_LOCK: - if (IsChecked(hWnd, R_LOCK)) - { - if (IsEmpty(hWnd, E_PASSWORD1)) - { - Focus(hWnd, E_PASSWORD1); - } - } - break; - - } - break; - - case WM_CLOSE: - EndDialog(hWnd, false); - break; - } - - return 0; -} - - -// Change operation mode -bool CmSetting(HWND hWnd) -{ - CM_SETTING_DLG d; - - Zero(&d, sizeof(d)); - - return Dialog(hWnd, D_CM_SETTING, CmSettingDlg, &d); -} - - -// Attempting thread for starting the UI Helper -void CmTryToExecUiHelperThread(THREAD *thread, void *param) -{ - bool first_flag = true; - - while (cm->TryExecUiHelperHalt == false && cm->WindowsShutdowning == false) - { - if (first_flag == false) - { - // Wait a little for other than the first time - Wait(cm->TryExecUiHelperHaltEvent, CM_TRY_EXEC_UI_HELPER_INTERVAL * 2); - - if (cm->TryExecUiHelperHalt || cm->WindowsShutdowning) - { - break; - } - } - first_flag = false; - - if (cm->TryExecUiHelperHalt == false && cm->WindowsShutdowning == false) - { - if (cm->TryExecUiHelperProcessHandle == NULL) - { - CmTryToExecUiHelper(); - } - } - - if (cm->TryExecUiHelperHalt || cm->WindowsShutdowning) - { - break; - } - - if (cm->TryExecUiHelperProcessHandle == NULL) - { - Wait(cm->TryExecUiHelperHaltEvent, CM_TRY_EXEC_UI_HELPER_INTERVAL); - } - else - { - HANDLE handles[2]; - handles[0] = cm->TryExecUiHelperProcessHandle; - handles[1] = (HANDLE)cm->TryExecUiHelperHaltEvent->pData; - WaitForMultipleObjects(2, handles, false, CM_TRY_EXEC_UI_HELPER_INTERVAL); - - if (WaitForSingleObject(cm->TryExecUiHelperProcessHandle, 0) != WAIT_TIMEOUT) - { - CloseHandle(cm->TryExecUiHelperProcessHandle); - cm->TryExecUiHelperProcessHandle = NULL; - if (cm->TryExecUiHelperHalt || cm->WindowsShutdowning) - { - break; - } - Wait(cm->TryExecUiHelperHaltEvent, CM_TRY_EXEC_UI_HELPER_INTERVAL * 2); - } - } - } -} - -// Stop the UI Helper -void CmFreeTryToExecUiHelper() -{ - cm->TryExecUiHelperHalt = true; - Set(cm->TryExecUiHelperHaltEvent); - - WaitThread(cm->TryExecUiHelperThread, INFINITE); - - ReleaseThread(cm->TryExecUiHelperThread); - cm->TryExecUiHelperThread = NULL; - - ReleaseEvent(cm->TryExecUiHelperHaltEvent); - cm->TryExecUiHelperHaltEvent = NULL; - - cm->TryExecUiHelperHalt = false; - cm->TryExecUiHelperProcessHandle = NULL; -} - -// Initialize the UI Helper starting -void CmInitTryToExecUiHelper() -{ - cm->TryExecUiHelperProcessHandle = NULL; - cm->TryExecUiHelperHalt = false; - cm->TryExecUiHelperHaltEvent = NewEvent(); - cm->TryExecUiHelperThread = NewThread(CmTryToExecUiHelperThread, NULL); -} - -// Start the UI Helper -void *CmExecUiHelperMain() -{ - HANDLE h; - wchar_t tmp[MAX_SIZE]; - - UniFormat(tmp, sizeof(tmp), L"%s\\%S", MsGetExeDirNameW(), CLIENT_WIN32_EXE_FILENAME); - - // Start - h = Win32RunExW(tmp, SVC_ARG_UIHELP_W, false); - - return (void *)h; -} - -// Attempt to start the UI Helper -void CmTryToExecUiHelper() -{ - HANDLE h; - // Check that it isn't already running - if (CnCheckAlreadyExists(false)) - { - // It have already started - return; - } - - h = (HANDLE)CmExecUiHelperMain(); - - if (h != NULL) - { - cm->TryExecUiHelperProcessHandle = h; - } -} - -// Initialize the dialog -void CmTrafficResultDlgInit(HWND hWnd, TT_RESULT *res) -{ - LVB *ct; - wchar_t tmp[MAX_SIZE]; - wchar_t tmp1[MAX_SIZE]; - wchar_t tmp2[MAX_SIZE]; - char str[MAX_SIZE]; - // Validate arguments - if (hWnd == NULL || res == NULL) - { - return; - } - - SetIcon(hWnd, 0, ICO_SWITCH); - - SetFont(hWnd, L_STATUS, GetFont(_SS("DEFAULT_FONT_2"), 10, false, false, false, false)); - - LvInit(hWnd, L_STATUS); - LvSetStyle(hWnd, L_STATUS, LVS_EX_GRIDLINES); - LvInsertColumn(hWnd, L_STATUS, 0, _UU("TTC_RES_COLUMN_1"), 100); - LvInsertColumn(hWnd, L_STATUS, 1, _UU("TTC_RES_COLUMN_2"), 100); - LvInsertColumn(hWnd, L_STATUS, 2, _UU("TTC_RES_COLUMN_3"), 100); - - ct = LvInsertStart(); - - // Time that was used to measure - GetSpanStrMilli(str, sizeof(str), res->Span); - StrToUni(tmp, sizeof(tmp), str); - LvInsertAdd(ct, ICO_DATETIME, NULL, 3, _UU("TTC_RES_SPAN"), tmp, L""); - - // Correct the data for Ethernet frame - LvInsertAdd(ct, ICO_INFORMATION, NULL, 3, _UU("TTC_RES_ETHER"), res->Raw ? _UU("SEC_NO") : _UU("SEC_YES"), L""); - - // Amount of communication data of download direction - ToStr3(str, sizeof(str), res->NumBytesDownload); - UniFormat(tmp1, sizeof(tmp1), L"%S Bytes", str); - ToStrByte1000(str, sizeof(str), res->NumBytesDownload); - StrToUni(tmp2, sizeof(tmp2), str); - LvInsertAdd(ct, ICO_INFORMATION, NULL, 3, _UU("TTC_RES_BYTES_DOWNLOAD"), tmp1, tmp2); - - // Amount of communication data of upload direction - ToStr3(str, sizeof(str), res->NumBytesUpload); - UniFormat(tmp1, sizeof(tmp1), L"%S Bytes", str); - ToStrByte1000(str, sizeof(str), res->NumBytesUpload); - StrToUni(tmp2, sizeof(tmp2), str); - LvInsertAdd(ct, ICO_INFORMATION, NULL, 3, _UU("TTC_RES_BYTES_UPLOAD"), tmp1, tmp2); - - // Total amount of communication data - ToStr3(str, sizeof(str), res->NumBytesTotal); - UniFormat(tmp1, sizeof(tmp1), L"%S Bytes", str); - ToStrByte1000(str, sizeof(str), res->NumBytesTotal); - StrToUni(tmp2, sizeof(tmp2), str); - LvInsertAdd(ct, ICO_INFORMATION, NULL, 3, _UU("TTC_RES_BYTES_TOTAL"), tmp1, tmp2); - - // Calculate the total throughput of input and output of the relay equipment - LvInsertAdd(ct, ICO_INFORMATION, NULL, 3, _UU("TTC_RES_DOUBLE"), (res->Double == false) ? _UU("SEC_NO") : _UU("SEC_YES"), L""); - - // Average throughput of download direction - ToStr3(str, sizeof(str), res->BpsDownload); - UniFormat(tmp1, sizeof(tmp1), L"%S bps", str); - ToStrByte1000(str, sizeof(str), res->BpsDownload); - ReplaceStr(str, sizeof(str), str, "Bytes", "bps"); - StrToUni(tmp2, sizeof(tmp2), str); - LvInsertAdd(ct, ICO_INFORMATION, NULL, 3, _UU("TTC_RES_BPS_DOWNLOAD"), tmp1, tmp2); - - // Average throughput of upload direction - ToStr3(str, sizeof(str), res->BpsUpload); - UniFormat(tmp1, sizeof(tmp1), L"%S bps", str); - ToStrByte1000(str, sizeof(str), res->BpsUpload); - ReplaceStr(str, sizeof(str), str, "Bytes", "bps"); - StrToUni(tmp2, sizeof(tmp2), str); - LvInsertAdd(ct, ICO_INFORMATION, NULL, 3, _UU("TTC_RES_BPS_UPLOAD"), tmp1, tmp2); - - // Total average throughput - ToStr3(str, sizeof(str), res->BpsTotal); - UniFormat(tmp1, sizeof(tmp1), L"%S bps", str); - ToStrByte1000(str, sizeof(str), res->BpsTotal); - ReplaceStr(str, sizeof(str), str, "Bytes", "bps"); - StrToUni(tmp2, sizeof(tmp2), str); - LvInsertAdd(ct, ICO_INFORMATION, NULL, 3, _UU("TTC_RES_BPS_TOTAL"), tmp1, tmp2); - - LvInsertEnd(ct, hWnd, L_STATUS); - - LvAutoSize(hWnd, L_STATUS); -} - -// Dialog procedure to display results of traffic measurements -UINT CmTrafficResultDlg(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param) -{ - TT_RESULT *r = (TT_RESULT *)param; - // Validate arguments - if (hWnd == NULL) - { - return 0; - } - - switch (msg) - { - case WM_INITDIALOG: - CmTrafficResultDlgInit(hWnd, r); - break; - - case WM_COMMAND: - switch (wParam) - { - case IDOK: - case IDCANCEL: - Close(hWnd); - break; - } - break; - - case WM_CLOSE: - EndDialog(hWnd, 0); - break; - } - - return 0; -} - -// Display results of traffic measurement -void CmTrafficResult(HWND hWnd, TT_RESULT *r) -{ - // Validate arguments - if (r == NULL) - { - return; - } - - Dialog(hWnd, D_CM_TRAFFIC_RESULT, CmTrafficResultDlg, r); -} - -// Thread to wait for the termination of the client -void CmTrafficRunDlgClientWaitThread(THREAD *t, void *param) -{ - CM_TRAFFIC_DLG *d = (CM_TRAFFIC_DLG *)param; - TT_RESULT result; - UINT ret; - // Validate arguments - if (t == NULL || param == NULL) - { - return; - } - - Zero(&result, sizeof(result)); - ret = FreeTtc(d->Ttc, &result); - d->Ttc = NULL; - - d->RetCode = ret; - Copy(&d->Result, &result, sizeof(TT_RESULT)); - - PostMessage(d->hWnd, WM_APP + 66, 0, 0); -} - -// Append the string -void CmTrafficRunDlgAddStr(HWND hWnd, wchar_t *str) -{ - wchar_t *tmp; - UINT tmp_size; - - tmp_size = UniStrSize(str) + 32; - tmp = Malloc(tmp_size); - UniStrCpy(tmp, tmp_size, str); - if (UniEndWith(str, L"\n") == false) - { - UniStrCat(tmp, tmp_size, L"\n"); - } - - UniReplaceStrEx(tmp, tmp_size, tmp, L"\r\n", L"\n", false); - UniReplaceStrEx(tmp, tmp_size, tmp, L"\n", L"\r\n", false); - - if (MsIsNt()) - { - SendMsg(hWnd, E_EDIT, EM_SETSEL, 0x7fffffff, 0x7fffffff); - SendMsg(hWnd, E_EDIT, EM_REPLACESEL, false, (LPARAM)tmp); - } - else - { - char *s = CopyUniToStr(tmp); - UINT len; - - len = GetWindowTextLength(DlgItem(hWnd, E_EDIT)); - SendMsg(hWnd, E_EDIT, EM_SETSEL, 0x7fffffff, 0x7fffffff); - SendMsg(hWnd, E_EDIT, EM_SETSEL, len, len); - SendMsg(hWnd, E_EDIT, EM_REPLACESEL, false, (LPARAM)s); - Free(s); - } - - Free(tmp); -} - -// Show the string -void CmTrafficRunDlgPrintProc(void *param, wchar_t *str) -{ - CM_TRAFFIC_DLG *d = (CM_TRAFFIC_DLG *)param; - HWND hWnd; - // Validate arguments - if (param == NULL || str == NULL) - { - return; - } - - hWnd = d->hWnd; - - PostMessage(hWnd, WM_APP + 64, 0, (LPARAM)UniCopyStr(str)); -} - -// Thread for stop the measurement program -void CmTrafficRunDlgHaltThread(THREAD *t, void *param) -{ - CM_TRAFFIC_DLG *d = (CM_TRAFFIC_DLG *)param; - // Validate arguments - if (t == NULL || param == NULL) - { - return; - } - - if (d->Setting->ServerMode) - { - // Stop the server - d->RetCode = FreeTts(d->Tts); - - PostMessage(d->hWnd, WM_APP + 65, 0, 0); - } -} - -// Stop the measurement program -void CmTrafficRunDlgHalt(HWND hWnd, CM_TRAFFIC_DLG *d) -{ - // Validate arguments - if (hWnd == NULL || d == NULL) - { - return; - } - - if (d->Started == false) - { - return; - } - - if (d->Setting->ServerMode) - { - if (d->HaltThread == NULL) - { - Disable(hWnd, IDCANCEL); - d->HaltThread = NewThread(CmTrafficRunDlgHaltThread, d); - } - } - else - { - if (d->ClientEndWaitThread != NULL) - { - StopTtc(d->Ttc); - } - else - { - EndDialog(hWnd, 0); - } - } -} - -// Start the operation of traffic measurement -void CmTrafficRunDlgStart(HWND hWnd, CM_TRAFFIC_DLG *d) -{ - // Validate arguments - if (hWnd == NULL || d == NULL) - { - return; - } - - if (d->Setting->ServerMode) - { - // Start the measurement server - d->Tts = NewTts(d->Setting->Port, d, CmTrafficRunDlgPrintProc); - } - else - { - // Start the measurement client - d->Ttc = NewTtc(d->Setting->Host, d->Setting->Port, - d->Setting->NumTcp, d->Setting->Type, d->Setting->Span * 1000ULL, - d->Setting->Double, d->Setting->Raw, CmTrafficRunDlgPrintProc, d); - - d->ClientEndWaitThread = NewThread(CmTrafficRunDlgClientWaitThread, d); - } - - d->Started = true; -} - -// Traffic measurement operation dialog initialization -void CmTrafficRunDlgInit(HWND hWnd, CM_TRAFFIC_DLG *d) -{ - // Validate arguments - if (hWnd == NULL || d == NULL) - { - return; - } - - d->hWnd = hWnd; - - SetIcon(hWnd, 0, ICO_SWITCH); - DlgFont(hWnd, S_INFO, 11, false); - SetFont(hWnd, E_EDIT, GetFont(_SS("DEFAULT_FONT_2"), 0, false, false, - false, false)); - - Focus(hWnd, IDCANCEL); -} - -// Traffic measurement operation dialog procedure -UINT CmTrafficRunDlg(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param) -{ - CM_TRAFFIC_DLG *d = (CM_TRAFFIC_DLG *)param; - wchar_t *s; - // Validate arguments - if (hWnd == NULL) - { - return 0; - } - - switch (msg) - { - case WM_INITDIALOG: - CmTrafficRunDlgInit(hWnd, d); - - SetTimer(hWnd, 1, 10, NULL); - break; - - case WM_APP + 64: - // Add a string - s = (wchar_t *)lParam; - if (s != NULL) - { - CmTrafficRunDlgAddStr(hWnd, s); - Free(s); - } - break; - - case WM_APP + 65: - // Stopping complete - if (d->HaltThread != NULL) - { - WaitThread(d->HaltThread, INFINITE); - ReleaseThread(d->HaltThread); - d->HaltThread = NULL; - EndDialog(hWnd, 0); - } - break; - - case WM_APP + 66: - // Show results - if (d->RetCode == ERR_NO_ERROR) - { - CmTrafficResult(hWnd, &d->Result); - } - - if (d->ClientEndWaitThread != NULL) - { - WaitThread(d->ClientEndWaitThread, INFINITE); - ReleaseThread(d->ClientEndWaitThread); - d->ClientEndWaitThread = NULL; - } - - if (d->CloseDialogAfter) - { - EndDialog(hWnd, 0); - } - break; - - case WM_TIMER: - switch (wParam) - { - case 1: - KillTimer(hWnd, 1); - - CmTrafficRunDlgStart(hWnd, d); - break; - } - break; - - case WM_COMMAND: - switch (wParam) - { - case IDOK: - case IDCANCEL: - Close(hWnd); - break; - } - break; - - case WM_CLOSE: - d->CloseDialogAfter = true; - CmTrafficRunDlgHalt(hWnd, d); - return 1; - } - - return 0; -} - -// Execute a traffic measurement -void CmExecTraffic(HWND hWnd, CM_TRAFFIC *t) -{ - CM_TRAFFIC_DLG d; - // Validate arguments - if (t == NULL) - { - return; - } - - Zero(&d, sizeof(d)); - d.Setting = t; - d.ResultShowEvent = NewEvent(); - - MsSetThreadPriorityHigh(); - Dialog(hWnd, D_CM_TRAFFIC_RUN, CmTrafficRunDlg, &d); - MsRestoreThreadPriority(); - - ReleaseEvent(d.ResultShowEvent); -} - -// Write the settings to the registry -void CmTrafficSaveToReg(CM_TRAFFIC *t) -{ - // Validate arguments - if (t == NULL) - { - return; - } - - MsRegWriteInt(REG_CURRENT_USER, CM_TRAFFIC_REG_KEY, "ServerMode", t->ServerMode ? 1 : 0); - MsRegWriteInt(REG_CURRENT_USER, CM_TRAFFIC_REG_KEY, "Double", t->Double ? 1 : 0); - MsRegWriteInt(REG_CURRENT_USER, CM_TRAFFIC_REG_KEY, "Raw", t->Raw ? 1 : 0); - MsRegWriteInt(REG_CURRENT_USER, CM_TRAFFIC_REG_KEY, "Port", t->Port); - MsRegWriteInt(REG_CURRENT_USER, CM_TRAFFIC_REG_KEY, "NumTcp", t->NumTcp); - MsRegWriteInt(REG_CURRENT_USER, CM_TRAFFIC_REG_KEY, "Type", t->Type); - MsRegWriteInt(REG_CURRENT_USER, CM_TRAFFIC_REG_KEY, "Span", t->Span); - MsRegWriteStr(REG_CURRENT_USER, CM_TRAFFIC_REG_KEY, "Host", t->Host); -} - -// Read the settings from the registry -bool CmTrafficLoadFromReg(CM_TRAFFIC *t) -{ - char *s; - // Validate arguments - if (t == NULL) - { - return false; - } - - Zero(t, sizeof(CM_TRAFFIC)); - - if (MsRegIsKey(REG_CURRENT_USER, CM_TRAFFIC_REG_KEY) == false) - { - return false; - } - - t->Double = MsRegReadInt(REG_CURRENT_USER, CM_TRAFFIC_REG_KEY, "Double") == 0 ? false : true; - t->Raw = MsRegReadInt(REG_CURRENT_USER, CM_TRAFFIC_REG_KEY, "Raw") == 0 ? false : true; - t->Port = MsRegReadInt(REG_CURRENT_USER, CM_TRAFFIC_REG_KEY, "Port"); - if (t->Port == 0) - { - t->Port = TRAFFIC_DEFAULT_PORT; - } - - s = MsRegReadStr(REG_CURRENT_USER, CM_TRAFFIC_REG_KEY, "Host"); - - if (IsEmptyStr(s) == false) - { - Trim(s); - StrCpy(t->Host, sizeof(t->Host), s); - } - - Free(s); - - t->NumTcp = MsRegReadInt(REG_CURRENT_USER, CM_TRAFFIC_REG_KEY, "NumTcp"); - t->NumTcp = MAKESURE(t->NumTcp, 1, TRAFFIC_NUMTCP_MAX); - t->Type = MsRegReadInt(REG_CURRENT_USER, CM_TRAFFIC_REG_KEY, "Type"); - - if (t->Type != TRAFFIC_TYPE_DOWNLOAD && t->Type != TRAFFIC_TYPE_UPLOAD && - t->Type != TRAFFIC_TYPE_FULL) - { - t->Type = TRAFFIC_TYPE_FULL; - } - - t->Span = MsRegReadInt(REG_CURRENT_USER, CM_TRAFFIC_REG_KEY, "Span"); - if (t->Span == 0) - { - t->Span = TRAFFIC_SPAN_DEFAULT; - } - - t->ServerMode = MsRegReadInt(REG_CURRENT_USER, CM_TRAFFIC_REG_KEY, "ServerMode") == 0 ? false : true; - - return true; -} - -// Get the default settings -void CmTrafficGetDefaultSetting(CM_TRAFFIC *t) -{ - // Validate arguments - if (t == NULL) - { - return; - } - - Zero(t, sizeof(CM_TRAFFIC)); - - t->Double = false; - t->Raw = false; - t->Port = TRAFFIC_DEFAULT_PORT; - t->NumTcp = TRAFFIC_NUMTCP_DEFAULT; - t->Type = TRAFFIC_TYPE_FULL; - t->Span = TRAFFIC_SPAN_DEFAULT; - t->ServerMode = false; -} - -// Communication throughput measurement tool dialog initialization -void CmTrafficDlgInit(HWND hWnd) -{ - CM_TRAFFIC t; - LIST *c1, *c2; - UINT i; - // Validate arguments - if (hWnd == NULL) - { - return; - } - - DlgFont(hWnd, S_8, 9, true); - DlgFont(hWnd, S_3, 9, true); - - Zero(&t, sizeof(t)); - if (CmTrafficLoadFromReg(&t) == false) - { - CmTrafficGetDefaultSetting(&t); - } - - // Write the settings to the dialog - Check(hWnd, R_SERVER, t.ServerMode); - Check(hWnd, R_CLIENT, t.ServerMode == false); - - c1 = ReadCandidateFromReg(REG_CURRENT_USER, CM_TRAFFIC_REG_KEY, "HostCandidate"); - if (c1 != NULL) - { - UINT i; - - CbReset(hWnd, C_HOST); - - for (i = 0;i < LIST_NUM(c1);i++) - { - CANDIDATE *c = LIST_DATA(c1, i); - - CbAddStr(hWnd, C_HOST, c->Str, 0); - } - - FreeCandidateList(c1); - } - - if (CbNum(hWnd, C_HOST) == 0) - { - CbAddStr(hWnd, C_HOST, L"speed.softether.com", 0); - } - - if (IsEmptyStr(t.Host) == false) - { - SetTextA(hWnd, C_HOST, t.Host); - } - - c2 = ReadCandidateFromReg(REG_CURRENT_USER, CM_TRAFFIC_REG_KEY, "PortCandidate"); - if (c2 != NULL) - { - UINT i; - - if (t.Port != 0) - { - wchar_t tmp[32]; - - UniToStru(tmp, t.Port); - - AddCandidate(c2, tmp, 0); - } - - CbReset(hWnd, C_PORT); - - for (i = 0;i < LIST_NUM(c2);i++) - { - CANDIDATE *c = LIST_DATA(c2, i); - - CbAddStr(hWnd, C_PORT, c->Str, 0); - } - - FreeCandidateList(c2); - } - - CbReset(hWnd, C_NUM); - - for (i = 1;i <= TRAFFIC_NUMTCP_MAX;i++) - { - wchar_t tmp[32]; - - UniToStru(tmp, i); - - CbAddStr(hWnd, C_NUM, tmp, i); - } - - CbSelect(hWnd, C_NUM, t.NumTcp); - - Check(hWnd, R_DOWNLOAD, t.Type == TRAFFIC_TYPE_DOWNLOAD); - Check(hWnd, R_UPLOAD, t.Type == TRAFFIC_TYPE_UPLOAD); - Check(hWnd, R_FULL, t.Type == TRAFFIC_TYPE_FULL); - - Check(hWnd, R_ETHERNET, t.Raw ? false : true); - Check(hWnd, R_DOUBLE, t.Double); - - SetIntEx(hWnd, E_SPAN, t.Span); - - CmTrafficDlgUpdate(hWnd); -} - -// Put the contents of the dialog to structure -void CmTrafficDlgToStruct(HWND hWnd, CM_TRAFFIC *t) -{ - // Validate arguments - if (hWnd == NULL || t == NULL) - { - return; - } - - Zero(t, sizeof(CM_TRAFFIC)); - t->ServerMode = IsChecked(hWnd, R_SERVER); - GetTxtA(hWnd, C_HOST, t->Host, sizeof(t->Host)); - Trim(t->Host); - - t->Port = GetInt(hWnd, C_PORT); - t->NumTcp = CbGetSelect(hWnd, C_NUM); - t->Span = GetInt(hWnd, E_SPAN); - t->Raw = IsChecked(hWnd, R_ETHERNET) ? false : true; - t->Double = IsChecked(hWnd, R_DOUBLE); - - if (IsChecked(hWnd, R_DOWNLOAD)) - { - t->Type = TRAFFIC_TYPE_DOWNLOAD; - } - else if (IsChecked(hWnd, R_UPLOAD)) - { - t->Type = TRAFFIC_TYPE_UPLOAD; - } - else - { - t->Type = TRAFFIC_TYPE_FULL; - } -} - -// Communication throughput measurement tool dialog update -bool CmTrafficDlgUpdate(HWND hWnd) -{ - CM_TRAFFIC t; - bool ok = true; - bool client_only; - // Validate arguments - if (hWnd == NULL) - { - return false; - } - - CmTrafficDlgToStruct(hWnd, &t); - - client_only = t.ServerMode ? false : true; - - SetEnable(hWnd, C_HOST, client_only); - SetEnable(hWnd, S_5, client_only); - SetEnable(hWnd, S_8, client_only); - SetEnable(hWnd, S_9, client_only); - SetEnable(hWnd, R_DOWNLOAD, client_only); - SetEnable(hWnd, R_UPLOAD, client_only); - SetEnable(hWnd, R_FULL, client_only); - SetEnable(hWnd, S_10, client_only); - SetEnable(hWnd, S_11, client_only); - SetEnable(hWnd, C_NUM, client_only); - SetEnable(hWnd, S_14, client_only); - SetEnable(hWnd, S_12, client_only); - SetEnable(hWnd, E_SPAN, client_only); - SetEnable(hWnd, S_13, client_only); - SetEnable(hWnd, R_ETHERNET, client_only); - SetEnable(hWnd, R_DOUBLE, client_only); - - if (t.Port == 0 || t.Port >= 65536) - { - ok = false; - } - - if (t.ServerMode == false) - { - if (IsEmptyStr(t.Host)) - { - ok = false; - } - - if (t.NumTcp == 0 || t.NumTcp >= 33) - { - ok = false; - } - - if (t.Span == 0) - { - ok = false; - } - - if (t.Type == TRAFFIC_TYPE_FULL && ((t.NumTcp % 2) != 0)) - { - ok = false; - } - } - - SetEnable(hWnd, IDOK, ok); - - return ok; -} - -// Communication throughput measurement tool dialog OK button -void CmTrafficDlgOnOk(HWND hWnd) -{ - CM_TRAFFIC t; - LIST *c; - // Validate arguments - if (hWnd == NULL) - { - return; - } - - // Get the basic data - CmTrafficDlgToStruct(hWnd, &t); - - // Save to registry - CmTrafficSaveToReg(&t); - - // Retrieve and save the server name candidate - if (IsEmptyStr(t.Host) == false) - { - c = ReadCandidateFromReg(REG_CURRENT_USER, CM_TRAFFIC_REG_KEY, "HostCandidate"); - if (c != NULL) - { - wchar_t tmp[MAX_SIZE]; - - StrToUni(tmp, sizeof(tmp), t.Host); - AddCandidate(c, tmp, 0); - - WriteCandidateToReg(REG_CURRENT_USER, CM_TRAFFIC_REG_KEY, c, "HostCandidate"); - - FreeCandidateList(c); - } - } - - if (t.Port != 0 && t.Port <= 65536) - { - // Retrieve and store the port number candidate - c = ReadCandidateFromReg(REG_CURRENT_USER, CM_TRAFFIC_REG_KEY, "PortCandidate"); - if (c != NULL) - { - wchar_t tmp[MAX_SIZE]; - - UniToStru(tmp, t.Port); - AddCandidate(c, tmp, 0); - - WriteCandidateToReg(REG_CURRENT_USER, CM_TRAFFIC_REG_KEY, c, "PortCandidate"); - - FreeCandidateList(c); - } - } - - // Execute - CmExecTraffic(hWnd, &t); - - // Update the dialog - CmTrafficDlgInit(hWnd); -} - -// Communication throughput measurement tool dialog procedure -UINT CmTrafficDlgProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param) -{ - // Validate arguments - if (hWnd == NULL) - { - return 0; - } - - switch (msg) - { - case WM_INITDIALOG: - SetIcon(hWnd, 0, ICO_SWITCH); - CmTrafficDlgInit(hWnd); - break; - - case WM_COMMAND: - switch (LOWORD(wParam)) - { - case R_SERVER: - case R_CLIENT: - case C_HOST: - case C_PORT: - case R_DOWNLOAD: - case R_UPLOAD: - case R_FULL: - case C_NUM: - case E_SPAN: - case R_ETHERNET: - case R_DOUBLE: - CmTrafficDlgUpdate(hWnd); - break; - } - - switch (wParam) - { - case IDOK: - CmTrafficDlgOnOk(hWnd); - break; - - case IDCANCEL: - Close(hWnd); - break; - } - break; - - case WM_CLOSE: - EndDialog(hWnd, 0); - break; - } - - return 0; -} - -// Communication throughput measurement tool -void CmTraffic(HWND hWnd) -{ - Dialog(hWnd, D_CM_TRAFFIC, CmTrafficDlgProc, NULL); -} - -// Delete old startup file -void CmDeleteOldStartupTrayFile() -{ - char tmp[MAX_SIZE]; - char *tag = _SS("CM_JAPANESE_ONLY_OLD_STARTUP"); - if (IsEmptyStr(tag)) - { - return; - } - - Format(tmp, sizeof(tmp), tag, MsGetCommonStartupDir()); - - FileDelete(tmp); -} - -// PKCS license confirmation dialog -UINT CmPkcsEulaDlg(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param) -{ - UINT id; - SECURE_DEVICE *dev; - char *name; - // Validate arguments - if (hWnd == NULL) - { - return 0; - } - - switch (msg) - { - case WM_INITDIALOG: - id = (UINT)param; - dev = GetSecureDevice(id); - if (dev == NULL) - { - EndDialog(hWnd, 0); - return 0; - } - - name = dev->ModuleName; - - FormatText(hWnd, S_INFO_1, name); - FormatText(hWnd, S_INFO_2, name, name); - FormatText(hWnd, S_INFO_3, name); - - break; - - case WM_COMMAND: - switch (wParam) - { - case IDOK: - EndDialog(hWnd, 1); - break; - - case IDCANCEL: - Close(hWnd); - break; - } - break; - - case WM_CLOSE: - EndDialog(hWnd, 0); - break; - } - - return 0; -} - -// Confirmation screen of whether the user accepts the EULA of the PKCS DLL -bool CmCheckPkcsEula(HWND hWnd, UINT id) -{ - return (Dialog(hWnd, D_CM_PKCSEULA, CmPkcsEulaDlg, (void *)id) == 0) ? false : true; -} - -// Update controls -void CmSecurePinDlgUpdate(HWND hWnd) -{ - char *tmp1, *tmp2, *tmp3; - bool ok = true; - // Validate arguments - if (hWnd == NULL) - { - return; - } - - tmp1 = GetTextA(hWnd, E_PIN1); - tmp2 = GetTextA(hWnd, E_PIN2); - tmp3 = GetTextA(hWnd, E_PIN3); - if (IsEmptyStr(tmp1)) - { - ok = false; - } - if (IsEmptyStr(tmp2)) - { - ok = false; - } - if (IsEmptyStr(tmp3)) - { - ok = false; - } - if (StrCmp(tmp2, tmp3) != 0) - { - ok = false; - } - Free(tmp1); - Free(tmp2); - Free(tmp3); - SetEnable(hWnd, IDOK, ok); -} - -// PIN code changing dialog -UINT CmSecurePinDlg(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param) -{ - UINT id = (UINT)param; - char *src, *dst; - SECURE *s; - // Validate arguments - if (hWnd == NULL) - { - return 0; - } - - switch (msg) - { - case WM_INITDIALOG: - CmSecurePinDlgUpdate(hWnd); - break; - - case WM_COMMAND: - switch (LOWORD(wParam)) - { - case E_PIN1: - case E_PIN2: - case E_PIN3: - CmSecurePinDlgUpdate(hWnd); - break; - } - - switch (wParam) - { - case IDOK: - src = GetTextA(hWnd, E_PIN1); - dst = GetTextA(hWnd, E_PIN3); - - Disable(hWnd, IDOK); - Disable(hWnd, IDCANCEL); - - s = OpenSec(id); - if (s == NULL) - { - if (GetSecureDevice(id) != NULL) - { - MsgBoxEx(hWnd, MB_ICONEXCLAMATION, _UU("SEC_PIN_DEVICE_OPEN_ERR"), - GetSecureDevice(id)->DeviceName); - } - else - { - MsgBoxEx(hWnd, MB_ICONEXCLAMATION, _UU("SEC_PIN_DEVICE_OPEN_ERR"), - "Unknown"); - } - } - else - { - if (OpenSecSession(s, 0) == false) - { - if (GetSecureDevice(id) != NULL) - { - MsgBoxEx(hWnd, MB_ICONEXCLAMATION, _UU("SEC_PIN_DEVICE_OPEN_ERR"), - GetSecureDevice(id)->DeviceName); - } - else - { - MsgBoxEx(hWnd, MB_ICONEXCLAMATION, _UU("SEC_PIN_DEVICE_OPEN_ERR"), - "Unknown"); - } - } - else - { - if (LoginSec(s, src) == false) - { - MsgBox(hWnd, MB_ICONEXCLAMATION, _UU("SEC_PIN_CURRENT_BAD")); - FocusEx(hWnd, E_PIN1); - } - else - { - if (ChangePin(s, src, dst) == false) - { - MsgBox(hWnd, MB_ICONEXCLAMATION, _UU("SEC_PIN_CHANGE_FAILED")); - FocusEx(hWnd, E_PIN1); - } - else - { - // Clear the cache for PIN code - cached_pin_code_expires = 0; - cached_pin_code[0] = 0; - MsgBox(hWnd, MB_ICONINFORMATION, _UU("SEC_PIN_OK")); - EndDialog(hWnd, true); - } - - LogoutSec(s); - } - - CloseSecSession(s); - } - CloseSec(s); - } - - Enable(hWnd, IDOK); - Enable(hWnd, IDCANCEL); - - Free(src); - Free(dst); - break; - - case IDCANCEL: - Close(hWnd); - break; - } - break; - - case WM_CLOSE: - EndDialog(hWnd, false); - break; - } - - return 0; -} - -// Change the PIN code -void CmSecurePin(HWND hWnd, UINT id) -{ - // Validate arguments - if (hWnd == NULL || id == 0 || CheckSecureDeviceId(id) == false) - { - return; - } - - Dialog(hWnd, D_CM_SECURE_PIN, CmSecurePinDlg, (void *)id); -} - -// Object type selection dialog -UINT CmSecureTypeDlg(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param) -{ - UINT type; - // Validate arguments - if (hWnd == NULL) - { - return 0; - } - - switch (msg) - { - case WM_INITDIALOG: - type = MsRegReadInt(REG_CURRENT_USER, SECURE_MANAGER_KEY, "DefaultImportType"); - Check(hWnd, R_DATA, type == SEC_DATA); - Check(hWnd, R_CERT, type == SEC_X); - Check(hWnd, R_KEY, type == SEC_K); - goto UPDATE_CONTROL; - - case WM_COMMAND: - switch (wParam) - { - case IDOK: - type = SEC_DATA; - if (IsChecked(hWnd, R_CERT)) - { - type = SEC_X; - } - else if (IsChecked(hWnd, R_KEY)) - { - type = SEC_K; - } - - MsRegWriteInt(REG_CURRENT_USER, SECURE_MANAGER_KEY, "DefaultImportType", type); - - EndDialog(hWnd, type); - break; - - case IDCANCEL: - Close(hWnd); - break; - case R_CERT: - case R_KEY: - case R_DATA: -UPDATE_CONTROL: - SetEnable(hWnd, IDOK, IsChecked(hWnd, R_CERT) || - IsChecked(hWnd, R_KEY) || - IsChecked(hWnd, R_DATA)); - break; - } - break; - - case WM_CLOSE: - EndDialog(hWnd, INFINITE); - break; - } - - return 0; -} - -// Object type selection -UINT CmSecureType(HWND hWnd) -{ - return Dialog(hWnd, D_CM_SECURE_TYPE, CmSecureTypeDlg, NULL); -} - -// Initialize the dialog -void CmSecureManagerDlgInit(HWND hWnd, UINT id) -{ - SECURE_DEVICE *dev; - // Validate arguments - if (hWnd == NULL || id == 0) - { - return; - } - - SetIcon(hWnd, 0, ICO_SECURE); - - dev = GetSecureDevice(id); - if (dev != NULL) - { - FormatText(hWnd, S_INFO, dev->DeviceName); - } - - SetFont(hWnd, B_BOLD, Font(0, true)); - - LvInit(hWnd, L_LIST); - LvInsertColumn(hWnd, L_LIST, 0, _UU("SEC_MGR_COLUMN1"), 200); - LvInsertColumn(hWnd, L_LIST, 1, _UU("SEC_MGR_COLUMN2"), 110); - - CmSecureManagerDlgUpdate(hWnd, id); -} - -// Update controls -void CmSecureManagerDlgUpdate(HWND hWnd, UINT id) -{ - bool b = true; - bool read_only = IsJPKI(id); - // Validate arguments - if (hWnd == NULL) - { - return; - } - - if (LvIsSingleSelected(hWnd, L_LIST) == false) - { - b = false; - } - - SetEnable(hWnd, B_EXPORT, b && ((UINT)LvGetParam(hWnd, L_LIST, LvGetSelected(hWnd, L_LIST)) != SEC_K)); - SetEnable(hWnd, B_DELETE, b && (read_only == false)); - SetEnable(hWnd, B_PIN, (read_only == false)); - SetEnable(hWnd, B_IMPORT, (read_only == false)); - SetEnable(hWnd, B_NEW_CERT, (read_only == false)); -} - -// Content update -void CmSecureManagerDlgRefresh(HWND hWnd, UINT id) -{ - bool ret; - LIST *o; - WINUI_SECURE_BATCH batch[] = - { - {WINUI_SECURE_ENUM_OBJECTS, NULL, false, NULL, NULL, NULL, NULL, NULL, NULL}, - }; - // Validate arguments - if (hWnd == NULL || id == 0) - { - return; - } - - ret = SecureDeviceWindow(hWnd, batch, sizeof(batch) / sizeof(batch[0]), id, 0); - - if (ret == false) - { - return; - } - - o = batch[0].EnumList; - if (o != NULL) - { - CmSecureManagerDlgPrintList(hWnd, o); - - FreeEnumSecObject(o); - } - - // update controls - CmSecureManagerDlgUpdate(hWnd, id); -} - -// Show the list of secure objects -void CmSecureManagerDlgPrintList(HWND hWnd, LIST *o) -{ - CmSecureManagerDlgPrintListEx(hWnd, L_LIST, o, INFINITE); -} -void CmSecureManagerDlgPrintListEx(HWND hWnd, UINT id, LIST *o, UINT type) -{ - UINT i; - LVB *v; - // Validate arguments - if (hWnd == NULL || o == NULL) - { - return; - } - - LvReset(hWnd, id); - - v = LvInsertStart(); - - for (i = 0;i < LIST_NUM(o);i++) - { - UINT icon = ICO_LOG2; - wchar_t tmp1[MAX_SIZE], *tmp2, *tmp3; - SEC_OBJ *obj = LIST_DATA(o, i); - - if (type == INFINITE || obj->Type == type) - { - StrToUni(tmp1, sizeof(tmp1), obj->Name); - tmp2 = CmSecureObjTypeToStr(obj->Type); - tmp3 = obj->Private ? _UU("SEC_YES") : _UU("SEC_NO"); - - if (obj->Type == SEC_X) - { - icon = ICO_CERT; - } - else if (obj->Type == SEC_K || obj->Type == SEC_P) - { - icon = ICO_KEY; - } - - LvInsertAdd(v, icon, (void *)obj->Type, 2, tmp1, tmp2); - } - } - - LvInsertEnd(v, hWnd, id); -} - -// Convert the type of secure object to a string -wchar_t *CmSecureObjTypeToStr(UINT type) -{ - wchar_t *ret = _UU("SEC_TYPE_DATA"); - - if (type == SEC_X) - { - ret = _UU("SEC_TYPE_CERT"); - } - else if (type == SEC_K) - { - ret = _UU("SEC_TYPE_KEY"); - } - else if (type == SEC_P) - { - ret = _UU("SEC_TYPE_PUB"); - } - - return ret; -} - -// Write by creating a new certificate -void CmSecureManagerDlgNewCert(HWND hWnd, UINT id) -{ - X *x; - K *k; - char default_name[MAX_SIZE]; - char *object_name; - bool ok = false; - WINUI_SECURE_BATCH batch[] = - { - {WINUI_SECURE_WRITE_CERT, NULL, true, NULL, NULL, NULL, NULL, NULL, NULL}, - {WINUI_SECURE_WRITE_KEY, NULL, true, NULL, NULL, NULL, NULL, NULL, NULL}, - {WINUI_SECURE_ENUM_OBJECTS, NULL, false, NULL, NULL, NULL, NULL, NULL, NULL}, - }; - // Validate arguments - if (hWnd == NULL || id == 0) - { - return; - } - - // Dialog for creating certificate - if (SmCreateCert(hWnd, &x, &k, true, NULL, false) == false) - { - return; - } - // Generate the default name - GetPrintNameFromXA(default_name, sizeof(default_name), x); - ConvertSafeFileName(default_name, sizeof(default_name), default_name); - - object_name = StringDlgA(hWnd, _UU("SEC_OBJECT_NAME_TITLE"), - _UU("SEC_OBJECT_NAME_INFO"), default_name, ICO_CERT, false, false); - - if (object_name != NULL) - { - // Enumerate and write - batch[0].InputX = x; - batch[0].Name = object_name; - batch[1].InputK = k; - batch[1].Name = object_name; - - if (SecureDeviceWindow(hWnd, batch, sizeof(batch) / sizeof(batch[0]), id, 0) == false) - { - // Failure - } - else - { - ok = true; - } - - Free(object_name); - } - - if (ok) - { - LIST *o = batch[2].EnumList; - - CmSecureManagerDlgPrintList(hWnd, o); - - FreeEnumSecObject(o); - - MsgBox(hWnd, MB_ICONINFORMATION, _UU("SEC_NEW_CERT_IMPORT_OK")); - } - - FreeX(x); - FreeK(k); -} - -// Import -void CmSecureManagerDlgImport(HWND hWnd, UINT id) -{ - UINT type; - char name[MAX_SIZE]; - wchar_t tmp2[MAX_SIZE]; - wchar_t *tmp; - wchar_t *filename; - BUF *b; - K *k; - bool ok = false; - X *x; - WINUI_SECURE_BATCH batch[] = - { - {WINUI_SECURE_WRITE_DATA, name, true, NULL, NULL, NULL, NULL, NULL, NULL}, - {WINUI_SECURE_ENUM_OBJECTS, NULL, false, NULL, NULL, NULL, NULL, NULL, NULL}, - }; - // Validate arguments - if (hWnd == NULL || id == 0) - { - return; - } - - // Select the type of secure object - type = CmSecureType(hWnd); - - switch (type) - { - case SEC_DATA: - // Data - tmp = OpenDlg(hWnd, _UU("DLG_ALL_FILES"), _UU("SEC_IMPORT_DATA")); - if (tmp == NULL) - { - return; - } - - filename = CopyUniStr(tmp); - Free(tmp); - - // Read the file - b = ReadDumpW(filename); - if (b == NULL) - { - // Read failure - MsgBox(hWnd, MB_ICONSTOP, _UU("SEC_READ_FAILED")); - } - else - { - if (b->Size > MAX_SEC_DATA_SIZE) - { - // File size is too large - MsgBoxEx(hWnd, MB_ICONEXCLAMATION, _UU("SEC_DATA_TOO_BIG"), MAX_SEC_DATA_SIZE); - } - else - { - // Generate the default name - char default_name[MAX_SIZE]; - wchar_t default_name_w[MAX_SIZE]; - char *object_name; - GetFileNameFromFilePathW(default_name_w, sizeof(default_name_w), filename); - UniToStr(default_name, sizeof(default_name), default_name_w); - ConvertSafeFileName(default_name, sizeof(default_name), default_name); - - object_name = StringDlgA(hWnd, _UU("SEC_OBJECT_NAME_TITLE"), - _UU("SEC_OBJECT_NAME_INFO"), default_name, ICO_LOG2, false, false); - - if (object_name != NULL) - { - // Enumerate and write - batch[0].InputData = b; - batch[0].Name = object_name; - - if (SecureDeviceWindow(hWnd, batch, sizeof(batch) / sizeof(batch[0]), id, 0) == false) - { - // Failure - } - else - { - ok = true; - } - - Free(object_name); - } - } - - FreeBuf(b); - } - - Free(filename); - break; - - case SEC_X: - // Read a certificate - if (CmLoadXExW(hWnd, &x, tmp2, sizeof(tmp2))) - { - // Generate the default name - char default_name[MAX_SIZE]; - wchar_t default_name_w[MAX_PATH]; - char *object_name; - GetFileNameFromFilePathW(default_name_w, sizeof(default_name_w), tmp2); - UniToStr(default_name, sizeof(default_name), default_name_w); - ConvertSafeFileName(default_name, sizeof(default_name), default_name); - - object_name = StringDlgA(hWnd, _UU("SEC_OBJECT_NAME_TITLE"), - _UU("SEC_OBJECT_NAME_INFO"), default_name, ICO_CERT, false, false); - - if (object_name != NULL) - { - // Enumerate and write - batch[0].Type = WINUI_SECURE_WRITE_CERT; - batch[0].InputX = x; - batch[0].Name = object_name; - - if (SecureDeviceWindow(hWnd, batch, sizeof(batch) / sizeof(batch[0]), id, 0) == false) - { - // Failure - } - else - { - ok = true; - } - - Free(object_name); - } - - FreeX(x); - } - - break; - - case SEC_K: - // Secret key - if (CmLoadKExW(hWnd, &k, tmp2, sizeof(tmp2))) - { - // Generate the default name - char default_name[MAX_SIZE]; - wchar_t default_name_w[MAX_PATH]; - char *object_name; - GetFileNameFromFilePathW(default_name_w, sizeof(default_name_w), tmp2); - UniToStr(default_name, sizeof(default_name), default_name_w); - ConvertSafeFileName(default_name, sizeof(default_name), default_name); - - object_name = StringDlgA(hWnd, _UU("SEC_OBJECT_NAME_TITLE"), - _UU("SEC_OBJECT_NAME_INFO"), default_name, ICO_KEY, false, false); - - if (object_name != NULL) - { - // Enumerate and write - batch[0].Type = WINUI_SECURE_WRITE_KEY; - batch[0].InputK = k; - batch[0].Name = object_name; - - if (SecureDeviceWindow(hWnd, batch, sizeof(batch) / sizeof(batch[0]), id, 0) == false) - { - // Failure - } - else - { - ok = true; - } - - Free(object_name); - } - - FreeK(k); - } - break; - - default: - // Invalid - return; - } - - if (ok) - { - LIST *o = batch[1].EnumList; - - CmSecureManagerDlgPrintList(hWnd, o); - - FreeEnumSecObject(o); - - MsgBox(hWnd, MB_ICONINFORMATION, _UU("SEC_OBJECT_IMPORT_OK")); - } -} - -// Export the object -void CmSecureManagerDlgExport(HWND hWnd, UINT id) -{ - char name[MAX_SIZE]; - UINT method = WINUI_SECURE_READ_DATA; - char *tmp; - UINT type; - wchar_t filename[MAX_PATH]; - wchar_t *uni_tmp; - X *x; - BUF *b; - wchar_t default_name[128]; - WINUI_SECURE_BATCH batch[] = - { - {WINUI_SECURE_READ_DATA, name, true, NULL, NULL, NULL, NULL, NULL, NULL}, - }; - UINT i; - // Validate arguments - if (hWnd == NULL || id == 0) - { - return; - } - - i = LvGetSelected(hWnd, L_LIST); - if (i == INFINITE) - { - return; - } - - tmp = LvGetStrA(hWnd, L_LIST, i, 0); - StrCpy(name, sizeof(name), tmp); - Free(tmp); - - type = (UINT)LvGetParam(hWnd, L_LIST, i); - - switch (type) - { - case SEC_X: - method = WINUI_SECURE_READ_CERT; - break; - - default: - method = WINUI_SECURE_READ_DATA; - break; - } - - batch[0].Type = method; - - // Operate the smart card - if (SecureDeviceWindow(hWnd, batch, sizeof(batch) / sizeof(batch[0]), id, 0) == false) - { - return; - } - - switch (type) - { - case SEC_X: - // Certificate - x = batch[0].OutputX; - - CertDlg(hWnd, x, NULL, true); - - FreeX(x); - break; - - default: - // File - b = batch[0].OutputData; - StrToUni(default_name, sizeof(default_name), name); - uni_tmp = SaveDlg(hWnd, _UU("DLG_ALL_FILES"), _UU("DLG_SAVE_FILE"), default_name, NULL); - - if (uni_tmp != NULL) - { - UniStrCpy(filename, sizeof(filename), uni_tmp); - - DumpBufW(b, filename); - - Free(uni_tmp); - - MsgBox(hWnd, MB_ICONINFORMATION, _UU("SEC_OBJECT_EXPORT_OK")); - } - - - FreeBuf(b); - break; - } -} - -// Delete the object -void CmSecureManagerDlgDelete(HWND hWnd, UINT id) -{ - char name[MAX_SIZE]; - UINT method = WINUI_SECURE_DELETE_DATA; - char *tmp; - UINT type; - LIST *o; - WINUI_SECURE_BATCH batch[] = - { - {WINUI_SECURE_DELETE_OBJECT, name, false, NULL, NULL, NULL, NULL, NULL, NULL}, - {WINUI_SECURE_ENUM_OBJECTS, NULL, false, NULL, NULL, NULL, NULL, NULL, NULL}, - }; - UINT i; - // Validate arguments - if (hWnd == NULL || id == 0) - { - return; - } - - i = LvGetSelected(hWnd, L_LIST); - if (i == INFINITE) - { - return; - } - - tmp = LvGetStrA(hWnd, L_LIST, i, 0); - StrCpy(name, sizeof(name), tmp); - Free(tmp); - - type = (UINT)LvGetParam(hWnd, L_LIST, i); - - switch (type) - { - case SEC_X: - method = WINUI_SECURE_DELETE_CERT; - break; - - case SEC_K: - method = WINUI_SECURE_DELETE_KEY; - break; - - default: - method = WINUI_SECURE_DELETE_DATA; - break; - } - - batch[0].Type = method; - - if (SecureDeviceWindow(hWnd, batch, sizeof(batch) / sizeof(batch[0]), id, 0) == false) - { - return; - } - - o = batch[1].EnumList; - - CmSecureManagerDlgPrintList(hWnd, o); - - FreeEnumSecObject(o); -} - -static bool cm_secure_manager_no_new_cert = false; - -// Smart Card Manager dialog -UINT CmSecureManagerDlg(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param) -{ - NMHDR *n; - UINT id = (UINT)param; - // Validate arguments - if (hWnd == NULL) - { - return 0; - } - - switch (msg) - { - case WM_INITDIALOG: - CmSecureManagerDlgInit(hWnd, id); - - if (cm_secure_manager_no_new_cert) - { - Hide(hWnd, B_NEW_CERT); - } - - SetTimer(hWnd, 1, 1, NULL); - break; - - case WM_COMMAND: - switch (wParam) - { - case B_REFRESH: - CmSecureManagerDlgRefresh(hWnd, id); - break; - - case B_IMPORT: - CmSecureManagerDlgImport(hWnd, id); - break; - - case B_EXPORT: - CmSecureManagerDlgExport(hWnd, id); - break; - - case B_DELETE: - if (MsgBox(hWnd, MB_YESNO | MB_ICONEXCLAMATION | MB_DEFBUTTON2, - _UU("SEC_DELETE_MSG")) == IDYES) - { - CmSecureManagerDlgDelete(hWnd, id); - } - break; - - case B_NEW_CERT: - CmSecureManagerDlgNewCert(hWnd, id); - break; - - case B_PIN: - CmSecurePin(hWnd, id); - break; - - case IDCANCEL: - Close(hWnd); - break; - } - break; - - case WM_TIMER: - switch (wParam) - { - case 1: - KillTimer(hWnd, 1); - - CmSecureManagerDlgRefresh(hWnd, id); - break; - } - break; - - case WM_CLOSE: - EndDialog(hWnd, 0); - break; - - case WM_NOTIFY: - n = (NMHDR *)lParam; - switch (n->idFrom) - { - case L_LIST: - switch (n->code) - { - case LVN_ITEMCHANGED: - CmSecureManagerDlgUpdate(hWnd, id); - break; - } - break; - } - break; - } - - return 0; -} - -// Smart Card Manager -void CmSecureManager(HWND hWnd, UINT id) -{ - CmSecureManagerEx(hWnd, id, false); -} -void CmSecureManagerEx(HWND hWnd, UINT id, bool no_new_cert) -{ - // Validate arguments - if (hWnd == NULL || id == 0) - { - return; - } - - // ID check - if (CheckSecureDeviceId(id) == false) - { - MsgBox(hWnd, MB_ICONEXCLAMATION, _UU("SEC_INVALID_ID")); - return; - } - - if (no_new_cert) - { - cm_secure_manager_no_new_cert = true; - } - else - { - cm_secure_manager_no_new_cert = false; - } - - Dialog(hWnd, D_CM_SECURE_MANAGER, CmSecureManagerDlg, (void *)id); -} - -// Smart Card Manager for Client -void CmClientSecureManager(HWND hWnd) -{ - RPC_USE_SECURE t; - UINT id; - - Zero(&t, sizeof(t)); - CcGetUseSecure(cm->Client, &t); - - id = t.DeviceId; - - if (id == 0 || CheckSecureDeviceId(id) == false) - { - id = CmClientSelectSecure(hWnd); - } - - if (id == 0) - { - return; - } - - CmSecureManager(hWnd, id); -} - -// Initialize the dialog -void CmSelectSecureDlgInit(HWND hWnd, UINT default_id) -{ - UINT i; - LIST *o; - LVB *v; - - SetIcon(hWnd, 0, ICO_SECURE); - - o = GetSecureDeviceList(); - - LvInit(hWnd, L_LIST); - LvInsertColumn(hWnd, L_LIST, 0, _UU("SEC_COLUMN1"), 150); - LvInsertColumn(hWnd, L_LIST, 1, _UU("SEC_COLUMN2"), 100); - LvInsertColumn(hWnd, L_LIST, 2, _UU("SEC_COLUMN3"), 130); - LvInsertColumn(hWnd, L_LIST, 3, _UU("SEC_COLUMN4"), 100); - - v = LvInsertStart(); - - for (i = 0;i < LIST_NUM(o);i++) - { - wchar_t tmp1[MAX_SIZE]; - wchar_t *tmp2; - wchar_t tmp3[MAX_SIZE]; - wchar_t tmp4[MAX_SIZE]; - SECURE_DEVICE *dev = LIST_DATA(o, i); - - StrToUni(tmp1, sizeof(tmp1), dev->DeviceName); - tmp2 = (dev->Type == SECURE_IC_CARD) ? _UU("SEC_SMART_CARD") : _UU("SEC_USB_TOKEN"); - StrToUni(tmp3, sizeof(tmp3), dev->Manufacturer); - StrToUni(tmp4, sizeof(tmp4), dev->ModuleName); - - LvInsertAdd(v, ICO_SECURE, (void *)dev->Id, 4, tmp1, tmp2, tmp3, tmp4); - } - - LvInsertEnd(v, hWnd, L_LIST); - - if (default_id != 0) - { - LvSelect(hWnd, L_LIST, LvSearchParam(hWnd, L_LIST, (void *)default_id)); - } - - ReleaseList(o); - - // Control update - CmSelectSecureDlgUpdate(hWnd); -} - -// Update controls of the dialog -void CmSelectSecureDlgUpdate(HWND hWnd) -{ - SetEnable(hWnd, IDOK, LvIsSingleSelected(hWnd, L_LIST)); -} - -// Smart card selection dialog -UINT CmSelectSecureDlg(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param) -{ - UINT default_id = (UINT)param; - NMHDR *n = NULL; - static UINT old_id; - // Validate arguments - if (hWnd == NULL) - { - return 0; - } - - switch (msg) - { - case WM_INITDIALOG: - old_id = default_id; - CmSelectSecureDlgInit(hWnd, default_id); - - if (LvNum(hWnd, L_LIST) == 0) - { - // There is no smart card - SetTimer(hWnd, 1, 100, NULL); - } - break; - - case WM_TIMER: - switch (wParam) - { - case 1: - KillTimer(hWnd, 1); - - Disable(hWnd, L_LIST); - MsgBox(hWnd, MB_ICONINFORMATION, _UU("SEC_NO_SECURE_DEVICE")); - break; - } - break; - - case WM_COMMAND: - switch (wParam) - { - case IDOK: - if (IsEnable(hWnd, IDOK)) - { - UINT i = LvGetSelected(hWnd, L_LIST); - if (i != INFINITE) - { - UINT id = (UINT)LvGetParam(hWnd, L_LIST, i); - - if (old_id != id) - { - if (CmCheckPkcsEula(hWnd, id) == false) - { - break; - } - } - EndDialog(hWnd, id); - } - } - break; - - case IDCANCEL: - Close(hWnd); - break; - } - break; - - case WM_CLOSE: - EndDialog(hWnd, 0); - break; - - case WM_NOTIFY: - n = (NMHDR *)lParam; - switch (n->idFrom) - { - case L_LIST: - switch (n->code) - { - case LVN_ITEMCHANGED: - CmSelectSecureDlgUpdate(hWnd); - break; - case NM_DBLCLK: - Command(hWnd, IDOK); - break; - } - break; - } - break; - } - - return 0; -} - -// Select the smart card device to be used -UINT CmSelectSecure(HWND hWnd, UINT current_id) -{ - return Dialog(hWnd, D_CM_SELECT_SECURE, CmSelectSecureDlg, (void *)current_id); -} - -// Select the smart card device to be used (client) -UINT CmClientSelectSecure(HWND hWnd) -{ - UINT id; - RPC_USE_SECURE t; - - if (cm->server_name != NULL) - { - MsgBox(hWnd, MB_ICONEXCLAMATION, _UU("CM_SECURE_MUST_LOCAL")); - return 0; - } - - Zero(&t, sizeof(t)); - CcGetUseSecure(cm->Client, &t); - - id = t.DeviceId; - - id = CmSelectSecure(hWnd, id); - if (id != 0) - { - Zero(&t, sizeof(t)); - t.DeviceId = id; - - CALL(hWnd, CcUseSecure(cm->Client, &t)); - - SmWriteSelectSecureIdReg(id); - } - - return id; -} - -// Shortcut connection -void CmConnectShortcut(UCHAR *key) -{ - UINT ret; - // Validate arguments - if (key == NULL) - { - return; - } - - // Attempt to connect - ret = CcShortcut(key); - - if (ret != ERR_NO_ERROR) - { - if (ret == ERR_ACCOUNT_ACTIVE) - { - // Because it is currently connected, to query whether or not to disconnect - if (MsgBox(NULL, MB_ICONQUESTION | MB_YESNO | MB_DEFBUTTON2, _UU("CM_SHORTCUT_DISCONNECT")) == IDYES) - { - // Try to disconnect - ret = CcShortcutDisconnect(key); - - if (ret != ERR_NO_ERROR) - { - // Error - MsgBox(NULL, MB_ICONEXCLAMATION, GetUniErrorStr(ret)); - } - } - } - else - { - // Other errors - MsgBox(NULL, MB_ICONEXCLAMATION, GetUniErrorStr(ret)); - } - } -} - -// Play the audio guide -void CmVoice(char *name) -{ - UINT i; - // Validate arguments - if (name == NULL) - { - return; - } - - // Voice guidance features disappeared!! - return; - - if (cm->DisableVoice) - { - return; - } - - for (i = 0;i < sizeof(cm_voice) / sizeof(CM_VOICE);i++) - { - if (cm_voice[i].voice_id == cm->VoiceId) - { - char tmp[MAX_SIZE]; - Format(tmp, sizeof(tmp), "%s_%s.wav", cm_voice[i].perfix, name); - MsPlaySound(tmp); - return; - } - } -} - -// Update the password changing dialog -void CmChangePasswordUpdate(HWND hWnd, CM_CHANGE_PASSWORD *p) -{ - bool ok = true; - char *s1, *s2; - // Validate arguments - if (hWnd == NULL || p == NULL) - { - return; - } - - if (IsEmpty(hWnd, E_USERNAME)) - { - ok = false; - } - - s1 = GetTextA(hWnd, E_NEW_PASSWORD1); - s2 = GetTextA(hWnd, E_NEW_PASSWORD2); - - if (StrCmp(s1, s2) != 0) - { - ok = false; - } - - Free(s1); - Free(s2); - - SetEnable(hWnd, IDOK, ok); -} - -// Password changing dialog procedure -UINT CmChangePasswordProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param) -{ - CM_CHANGE_PASSWORD *p = (CM_CHANGE_PASSWORD *)param; - char username[MAX_USERNAME_LEN + 1]; - char old_pass[MAX_PASSWORD_LEN + 1]; - char new_pass[MAX_PASSWORD_LEN + 1]; - UINT ret; - // Validate arguments - if (hWnd == NULL) - { - return 0; - } - - switch (msg) - { - case WM_INITDIALOG: - SetTextA(hWnd, E_HUBNAME, p->HubName); - SetTextA(hWnd, E_USERNAME, p->Username); - FormatText(hWnd, S_TITLE, p->ClientOption->Hostname); - - if (IsEmpty(hWnd, E_USERNAME)) - { - FocusEx(hWnd, E_USERNAME); - } - else - { - FocusEx(hWnd, E_OLD_PASSWORD); - } - - CmChangePasswordUpdate(hWnd, p); - break; - - case WM_COMMAND: - switch (LOWORD(wParam)) - { - case E_USERNAME: - case E_OLD_PASSWORD: - case E_NEW_PASSWORD1: - case E_NEW_PASSWORD2: - CmChangePasswordUpdate(hWnd, p); - break; - } - - switch (wParam) - { - case IDOK: - GetTxtA(hWnd, E_USERNAME, username, sizeof(username)); - GetTxtA(hWnd, E_OLD_PASSWORD, old_pass, sizeof(old_pass)); - GetTxtA(hWnd, E_NEW_PASSWORD1, new_pass, sizeof(new_pass)); - - Disable(hWnd, E_USERNAME); - Disable(hWnd, E_OLD_PASSWORD); - Disable(hWnd, E_NEW_PASSWORD1); - Disable(hWnd, E_NEW_PASSWORD2); - Disable(hWnd, IDOK); - Disable(hWnd, IDCANCEL); - - ret = ChangePassword(cm->Cedar, p->ClientOption, p->HubName, username, old_pass, new_pass); - - if (ret == ERR_NO_ERROR) - { - MsgBox(hWnd, MB_ICONINFORMATION, _UU("CM_PASSWORD_CHANGED")); - EndDialog(hWnd, true); - } - else - { - MsgBox(hWnd, MB_ICONSTOP, _E(ret)); - Enable(hWnd, E_USERNAME); - Enable(hWnd, E_OLD_PASSWORD); - Enable(hWnd, E_NEW_PASSWORD1); - Enable(hWnd, E_NEW_PASSWORD2); - Enable(hWnd, IDOK); - Enable(hWnd, IDCANCEL); - - SetTextA(hWnd, E_OLD_PASSWORD, ""); - SetTextA(hWnd, E_NEW_PASSWORD1, ""); - SetTextA(hWnd, E_NEW_PASSWORD2, ""); - - Focus(hWnd, E_OLD_PASSWORD); - } - - break; - - case IDCANCEL: - Close(hWnd); - break; - - } - - break; - - case WM_CLOSE: - EndDialog(hWnd, false); - break; - } - - return 0; -} - -// Show the password changing dialog -void CmChangePassword(HWND hWnd, CLIENT_OPTION *o, char *hubname, char *username) -{ - CM_CHANGE_PASSWORD p; - // Validate arguments - if (hWnd == NULL || o == NULL || hubname == NULL || username == NULL) - { - return; - } - - Zero(&p, sizeof(p)); - StrCpy(p.Username, sizeof(p.Username), username); - StrCpy(p.HubName, sizeof(p.HubName), hubname); - p.ClientOption = o; - - CmVoice("password"); - - Dialog(hWnd, D_CM_CHANGE_PASSWORD, CmChangePasswordProc, &p); -} - -// Prohibit the installation of the virtual LAN card -bool CmStopInstallVLan(HWND hWnd) -{ - if (cm->Client->Unix) - { - // There is no need to be prohibited if the client is an UNIX - return true; - } - if (cm->Client->Win9x) - { - // There is no need to prohibit if the client is a Win9x - return true; - } - - return true; - - if (MsIsTerminalServiceInstalled() || MsIsUserSwitchingInstalled()) - { - if (MsGetCurrentTerminalSessionId() == 0) - { - // There is no need to prohibit - return true; - } - else - { - // Prohibit to install the device drivers since - // the user logged in other than the console session - wchar_t *user = MsGetSessionUserName(0); - - if (user == NULL) - { - MsgBoxEx(hWnd, MB_ICONEXCLAMATION, _UU("CM_STOP_INST_VLAN_2"), - MsIsTerminalServiceInstalled() ? _UU("CM_DESKTOP_MSG_LOCAL_TS") : _UU("CM_DESKTOP_MSG_LOCAL_SW"), - MsGetCurrentTerminalSessionId()); - } - else - { - MsgBoxEx(hWnd, MB_ICONEXCLAMATION, _UU("CM_STOP_INST_VLAN_1"), - MsIsTerminalServiceInstalled() ? _UU("CM_DESKTOP_MSG_LOCAL_TS") : _UU("CM_DESKTOP_MSG_LOCAL_SW"), - MsGetCurrentTerminalSessionId(), 0, user); - } - - if (user != NULL) - { - Free(user); - } - return false; - } - } - else - { - // There is no need to prohibit - return true; - } -} - -// Desktop difference warning message dialog initialization -void CmDesktopDlgInit(HWND hWnd, wchar_t *account_name) -{ - wchar_t tmp[2048]; - bool remote = false; - bool user_switching = false; - bool console_active = false; - wchar_t *console_user = NULL; - // Validate arguments - if (hWnd == NULL) - { - return; - } - - FormatText(hWnd, 0, account_name); - FormatText(hWnd, S_TITLE, account_name); - DlgFont(hWnd, S_TITLE, 11, true); - DlgFont(hWnd, S_INFO, 11, true); - if (cm->server_name == NULL) - { - UniStrCpy(tmp, sizeof(tmp), _UU("CM_DESKTOP_LOCAL_PC")); - } - else - { - UniFormat(tmp, sizeof(tmp), _UU("CM_DESKTOP_REMOTE_PC"), cm->server_name); - } - FormatText(hWnd, S_WARNING, tmp); - - if (cm->server_name != NULL) - { - remote = true; - } - else - { - if (MsIsTerminalServiceInstalled()) - { - user_switching = false; - } - else - { - user_switching = true; - } - - console_user = MsGetSessionUserName(0); - - if (console_user == NULL) - { - console_active = false; - } - else - { - console_active = true; - } - } - - // MSG1 - if (remote == false) - { - UniFormat(tmp, sizeof(tmp), _UU("CM_DESKTOP_MSG_LOCAL_1"), - user_switching ? _UU("CM_DESKTOP_MSG_LOCAL_SW") : _UU("CM_DESKTOP_MSG_LOCAL_TS")); - } - else - { - UniFormat(tmp, sizeof(tmp), _UU("CM_DESKTOP_MSG_REMOTE_1"), - cm->server_name); - } - SetText(hWnd, S_MSG_1, tmp); - - // MSG2 - if (remote == false) - { - if (console_active) - { - UniFormat(tmp, sizeof(tmp), _UU("CM_DESKTOP_MSG_LOCAL_21"), - console_user, MsGetCurrentTerminalSessionId()); - } - else - { - UniFormat(tmp, sizeof(tmp), _UU("CM_DESKTOP_MSG_LOCAL_22"), - MsGetCurrentTerminalSessionId()); - } - } - else - { - UniFormat(tmp, sizeof(tmp), _UU("CM_DESKTOP_MSG_REMOTE_2"), cm->server_name); - } - SetText(hWnd, S_MSG_2, tmp); - - // MSG3 - if (remote == false) - { - if (console_active) - { - UniFormat(tmp, sizeof(tmp), _UU("CM_DESKTOP_MSG_LOCAL_31"), - console_user, account_name); - } - else - { - UniFormat(tmp, sizeof(tmp), _UU("CM_DESKTOP_MSG_LOCAL_32"), - account_name); - } - } - else - { - UniFormat(tmp, sizeof(tmp), _UU("CM_DESKTOP_MSG_REMOTE_3"), cm->server_name, - account_name); - } - SetText(hWnd, S_MSG_3, tmp); - - if (console_user != NULL) - { - Free(console_user); - } -} - -// Desktop difference warning message dialog -UINT CmDesktopDlgProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param) -{ - wchar_t *account_name = (wchar_t *)param; - // Validate arguments - if (hWnd == NULL) - { - return 0; - } - - switch (msg) - { - case WM_INITDIALOG: - CmDesktopDlgInit(hWnd, account_name); - break; - case WM_COMMAND: - switch (wParam) - { - case IDOK: - EndDialog(hWnd, true); - break; - case IDCANCEL: - Close(hWnd); - break; - } - break; - case WM_CLOSE: - EndDialog(hWnd, false); - break; - } - - return 0; -} - -// Show a warning message that the desktop is different, if necessary -bool CmWarningDesktop(HWND hWnd, wchar_t *account_name) -{ - // Validate arguments - if (hWnd == NULL || account_name == NULL) - { - return false; - } - - if (cm->Client->Unix) - { - //There is no need for warning if the client is an UNIX - return true; - } - - if (/*MsIsTerminalServiceInstalled() || MsIsUserSwitchingInstalled() ||*/ (cm->server_name != NULL)) - { - if (cm->server_name == NULL) - { - //if (MsGetCurrentTerminalSessionId() == 0) - { - // No need for warning - return true; - } - } - // There is a need for warning - return Dialog(hWnd, D_CM_DESKTOP, CmDesktopDlgProc, account_name); - } - else - { - // No need for warning - return true; - } -} - -// Update the password setting dialog -void CmPasswordRefresh(HWND hWnd) -{ - bool ok = true; - // Validate arguments - if (hWnd == NULL) - { - return; - } - - SetEnable(hWnd, E_PASSWORD, IsChecked(hWnd, R_USE_PASSWORD)); - SetEnable(hWnd, E_PASSWORD2, IsChecked(hWnd, R_USE_PASSWORD)); - SetEnable(hWnd, IDC_STATIC1, IsChecked(hWnd, R_USE_PASSWORD)); - SetEnable(hWnd, IDC_STATIC2, IsChecked(hWnd, R_USE_PASSWORD)); - SetEnable(hWnd, R_REMOTE_ONLY, IsChecked(hWnd, R_USE_PASSWORD)); - - if (IsChecked(hWnd, R_USE_PASSWORD)) - { - char tmp1[MAX_SIZE]; - char tmp2[MAX_SIZE]; - if (IsEmpty(hWnd, E_PASSWORD)) - { - ok = false; - } - GetTxtA(hWnd, E_PASSWORD, tmp1, sizeof(tmp1)); - GetTxtA(hWnd, E_PASSWORD2, tmp2, sizeof(tmp2)); - if (StrCmp(tmp1, tmp2) != 0) - { - ok = false; - } - if (StrCmp(tmp1, HIDDEN_PASSWORD) == 0) - { - ok = false; - } - } - - SetEnable(hWnd, IDOK, ok); -} - -// Password setting procedure -UINT CmPasswordProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param) -{ - RPC_CLIENT_PASSWORD_SETTING c; - RPC_CLIENT_PASSWORD p; - char tmp[MAX_SIZE]; - // Validate arguments - if (hWnd == NULL) - { - return 0; - } - - switch (msg) - { - case WM_INITDIALOG: - // Get the password setting - if (CALL(hWnd, CcGetPasswordSetting(cm->Client, &c))) - { - Check(hWnd, R_USE_PASSWORD, c.IsPasswordPresented); - if (c.IsPasswordPresented) - { - SetTextA(hWnd, E_PASSWORD, HIDDEN_PASSWORD); - SetTextA(hWnd, E_PASSWORD2, HIDDEN_PASSWORD); - FocusEx(hWnd, E_PASSWORD); - Check(hWnd, R_REMOTE_ONLY, c.PasswordRemoteOnly); - } - else - { - Focus(hWnd, R_USE_PASSWORD); - } - } - CmPasswordRefresh(hWnd); - break; - case WM_COMMAND: - switch (wParam) - { - case R_USE_PASSWORD: - if (IsChecked(hWnd, R_USE_PASSWORD)) - { - FocusEx(hWnd, E_PASSWORD); - } - break; - case IDOK: - GetTxtA(hWnd, E_PASSWORD, tmp, sizeof(tmp)); - Zero(&p, sizeof(p)); - if (IsChecked(hWnd, R_USE_PASSWORD)) - { - StrCpy(p.Password, sizeof(p.Password), tmp); - p.PasswordRemoteOnly = IsChecked(hWnd, R_REMOTE_ONLY); - } - - if (CALL(hWnd, CcSetPassword(cm->Client, &p))) - { - if (StrLen(p.Password) > 0) - { - MsgBox(hWnd, MB_ICONINFORMATION, _UU("CM_PASSWORD_SET")); - } - else - { - MsgBox(hWnd, MB_ICONINFORMATION, _UU("CM_PASSWORD_REMOVE")); - } - EndDialog(hWnd, true); - } - break; - case IDCANCEL: - Close(hWnd); - break; - } - switch (LOWORD(wParam)) - { - case R_USE_PASSWORD: - case R_REMOTE_ONLY: - case E_PASSWORD: - case E_PASSWORD2: - CmPasswordRefresh(hWnd); - break; - } - switch (wParam) - { - case R_REMOTE_ONLY: - case R_USE_PASSWORD: - if (IsChecked(hWnd, R_USE_PASSWORD)) - { - FocusEx(hWnd, E_PASSWORD); - } - break; - } - break; - case WM_CLOSE: - EndDialog(hWnd, false); - break; - } - - return 0; -} - -// Set the password -void CmPassword(HWND hWnd) -{ - // Validate arguments - if (hWnd == NULL) - { - return; - } - - Dialog(hWnd, D_CM_PASSWORD, CmPasswordProc, NULL); -} - -// CA dialog update -void CmTrustDlgUpdate(HWND hWnd) -{ - // Validate arguments - if (hWnd == NULL) - { - return; - } - - SetEnable(hWnd, B_EXPORT, LvIsSelected(hWnd, L_CERT)); - SetEnable(hWnd, B_DELETE, LvIsSelected(hWnd, L_CERT) && cm->CmSetting.LockMode == false); - SetEnable(hWnd, IDOK, LvIsSelected(hWnd, L_CERT)); - SetEnable(hWnd, B_IMPORT, cm->CmSetting.LockMode == false); -} - -// Update the list of certificates -void CmTrustDlgRefresh(HWND hWnd) -{ - RPC_CLIENT_ENUM_CA c; - // Validate arguments - if (hWnd == NULL) - { - return; - } - - if (CALL(hWnd, CcEnumCa(cm->Client, &c))) - { - UINT i; - LVB *b = LvInsertStart(); - for (i = 0;i < c.NumItem;i++) - { - RPC_CLIENT_ENUM_CA_ITEM *cert = c.Items[i]; - wchar_t tmp[MAX_SIZE]; - - GetDateStrEx64(tmp, sizeof(tmp), SystemToLocal64(cert->Expires), NULL); - LvInsertAdd(b, ICO_CERT, (void *)cert->Key, 3, - cert->SubjectName, cert->IssuerName, tmp); - } - LvInsertEnd(b, hWnd, L_CERT); - CiFreeClientEnumCa(&c); - } - - CmTrustDlgUpdate(hWnd); -} - -// Import -void CmTrustImport(HWND hWnd) -{ - X *x; - RPC_CERT c; - if (CmLoadXFromFileOrSecureCard(hWnd, &x) == false) - { - return; - } - - Zero(&c, sizeof(c)); - c.x = x; - - CALL(hWnd, CcAddCa(cm->Client, &c)); - CmVoice("new_cert"); - - FreeX(c.x); - CmTrustDlgRefresh(hWnd); -} - -// Export -void CmTrustExport(HWND hWnd) -{ - UINT key; - // Validate arguments - if (hWnd == NULL) - { - return; - } - - key = (UINT)LvGetParam(hWnd, L_CERT, LvGetSelected(hWnd, L_CERT)); - if (key != INFINITE) - { - RPC_GET_CA a; - Zero(&a, sizeof(a)); - a.Key = key; - - if (CALL(hWnd, CcGetCa(cm->Client, &a))) - { - wchar_t *name; - X *x = CloneX(a.x); - CiFreeGetCa(&a); - - // Save - name = SaveDlg(hWnd, _UU("DLG_CERT_FILES"), _UU("DLG_SAVE_CERT"), NULL, L".cer"); - if (name != NULL) - { - wchar_t str[MAX_SIZE]; - UniStrCpy(str, sizeof(str), name); - if (XToFileW(x, str, true)) - { - MsgBox(hWnd, MB_ICONINFORMATION, _UU("DLG_CERT_SAVE_OK")); - } - else - { - MsgBox(hWnd, MB_ICONSTOP, _UU("DLG_CERT_SAVE_ERROR")); - } - Free(name); - } - FreeX(x); - } - } -} - -// Display -void CmTrustView(HWND hWnd) -{ - UINT key; - // Validate arguments - if (hWnd == NULL) - { - return; - } - - key = (UINT)LvGetParam(hWnd, L_CERT, LvGetSelected(hWnd, L_CERT)); - if (key != INFINITE) - { - RPC_GET_CA a; - Zero(&a, sizeof(a)); - a.Key = key; - - if (CALL(hWnd, CcGetCa(cm->Client, &a))) - { - X *x = CloneX(a.x); - X *x_issuer; - CiFreeGetCa(&a); - - x_issuer = CmGetIssuer(x); - CertDlg(hWnd, x, x_issuer, true); - FreeX(x); - FreeX(x_issuer); - } - } -} - -// CA dialog procedure -UINT CmTrustDlgProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param) -{ - NMHDR *n; - UINT index; - // Validate arguments - if (hWnd == NULL) - { - return 0; - } - - switch (msg) - { - case WM_INITDIALOG: - LvInit(hWnd, L_CERT); - LvInsertColumn(hWnd, L_CERT, 0, _UU("CM_CERT_COLUMN_1"), 190); - LvInsertColumn(hWnd, L_CERT, 1, _UU("CM_CERT_COLUMN_2"), 190); - LvInsertColumn(hWnd, L_CERT, 2, _UU("CM_CERT_COLUMN_3"), 160); - CmTrustDlgRefresh(hWnd); - break; - case WM_COMMAND: - switch (wParam) - { - case B_IMPORT: - CmTrustImport(hWnd); - break; - case B_EXPORT: - CmTrustExport(hWnd); - break; - case B_DELETE: - index = LvGetSelected(hWnd, L_CERT); - if (index != INFINITE) - { - UINT key = (UINT)LvGetParam(hWnd, L_CERT, index); - if (key != INFINITE) - { - if (MsgBox(hWnd, MB_ICONQUESTION | MB_YESNO | MB_DEFBUTTON2, _UU("CM_CERT_DELETE_MSG")) == IDYES) - { - RPC_CLIENT_DELETE_CA c; - Zero(&c, sizeof(c)); - c.Key = key; - if (CALL(hWnd, CcDeleteCa(cm->Client, &c))) - { - CmTrustDlgRefresh(hWnd); - } - } - } - } - break; - case IDOK: - if (IsEnable(hWnd, IDOK)) - { - CmTrustView(hWnd); - } - break; - case IDCANCEL: - Close(hWnd); - break; - } - break; - case WM_CLOSE: - EndDialog(hWnd, 0); - break; - case WM_NOTIFY: - n = (NMHDR *)lParam; - switch (n->idFrom) - { - case L_CERT: - switch (n->code) - { - case LVN_ITEMCHANGED: - CmTrustDlgUpdate(hWnd); - break; - case NM_DBLCLK: - Command(hWnd, IDOK); - break; - } - break; - } - break; - } - - LvSortHander(hWnd, msg, wParam, lParam, L_CERT); - - return 0; -} - -// Show the CA dialog -void CmTrustDlg(HWND hWnd) -{ - Dialog(hWnd, D_CM_TRUST, CmTrustDlgProc, NULL); -} - -// Main window procedure -UINT CmMainWindowProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param) -{ - NMHDR *n; - static UINT taskbar_msg = 0; - COPYDATASTRUCT *cpy; - // Validate arguments - if (hWnd == NULL) - { - return 0; - } - - if (taskbar_msg != 0 && msg == taskbar_msg) - { - // The task-bar is regenerated - if (cm->TrayInited) - { - MsRestoreIconOnTray(); - } - } - - // CmSetForegroundProcessToCnService(); - - switch (msg) - { - case WM_CM_SETTING_CHANGED_MESSAGE: - // CM_SETTING has changed - CmApplyCmSetting(); - break; - case WM_INITDIALOG: - CmMainWindowOnInit(hWnd); - taskbar_msg = RegisterWindowMessage("TaskbarCreated"); - CmEndStartupMutex(); - break; - case WM_CM_SHOW: - // Received a display request from another process - if (cm->CmSetting.EasyMode == false) - { - ShowWindow(hWnd, SW_SHOWNORMAL); - } - else - { - if (cm->hEasyWnd == NULL) - { - CmShowEasy(); - } - else - { - SetForegroundWindow(cm->hEasyWnd); - SetActiveWindow(cm->hEasyWnd); - } - } - break; - case WM_COMMAND: - CmMainWindowOnCommand(hWnd, wParam, lParam); - break; - case WM_SIZE: - CmMainWindowOnSize(hWnd); - break; - case WM_CLOSE: - if (cm->CmSetting.EasyMode == false) - { - CmShowOrHideWindow(hWnd); - } - else - { - if (cm->hEasyWnd == NULL) - { - CmShowEasy(); - } - else - { - SetForegroundWindow(cm->hEasyWnd); - SetActiveWindow(cm->hEasyWnd); - } - } - return 1; - case WM_INITMENUPOPUP: - if (HIWORD(lParam) == false) - { - CmMainWindowOnPopupMenu(hWnd, (HMENU)wParam, LOWORD(lParam)); - } - break; - case WM_NOTIFY: - n = (NMHDR *)lParam; - if (n->idFrom == L_ACCOUNT && (n->code == LVN_BEGINLABELEDITW || n->code == LVN_BEGINLABELEDITA)) - { - wchar_t *tmp = LvGetSelectedStr(hWnd, L_ACCOUNT, 0); - if (tmp != NULL) - { - if (UniStrCmpi(tmp, _UU("CM_NEW_ICON")) == 0 || UniStrCmpi(tmp, _UU("CM_VGC_ICON")) == 0 || UniStrCmpi(tmp, _UU("CM_VGC_LINK")) == 0 - ) - { - SendMsg(hWnd, L_ACCOUNT, LVM_CANCELEDITLABEL, 0, 0); - Free(tmp); - return true; - } - Free(tmp); - } - } - CmMainWindowOnNotify(hWnd, (NMHDR *)lParam); - break; - case WM_CM_NOTIFY: - CmRefreshVLanList(hWnd); - CmRefreshAccountList(hWnd); - CmRefreshStatusBar(hWnd); - break; - case WM_TIMER: - switch (wParam) - { - case 1: - CmSetForegroundProcessToCnService(); - break; - case 2: - CmPollingTray(hWnd); - break; - case 3: - KillTimer(hWnd, 3); - Hide(hWnd, 0); - break; - case 4: - KillTimer(hWnd, 4); - CmMainWindowOnShowEasy(hWnd); - break; - case 6: - if (cm->Update == NULL) - { - if (cm->server_name == NULL) - { - if (CmGetNumConnected(hWnd) == 0) - { - cm->Update = InitUpdateUi(_UU("PRODUCT_NAME_VPN_CMGR"), NAME_OF_VPN_CLIENT_MANAGER, NULL, - GetCurrentBuildDate(), CEDAR_VERSION_BUILD, GetCedarVersionNumber(), ((cm->Client == NULL) ? NULL : cm->Client->ClientId), - true); - } - } - } - break; - } - break; - case WM_CM_TRAY_MESSAGE: - // Message from the icon in the task tray - CmMainWindowOnTrayClicked(hWnd, wParam, lParam); - break; - case WM_COPYDATA: - cpy = (COPYDATASTRUCT *)lParam; - if (cpy != NULL) - { - if (cpy->dwData == CM_IMPORT_FILENAME_MSG || cpy->dwData == CM_IMPORT_FILENAME_MSG_OVERWRITE) - { - char *filename = (char *)cpy->lpData; - - if (cm->CmSetting.LockMode == false || cpy->dwData == CM_IMPORT_FILENAME_MSG_OVERWRITE) - { - wchar_t fullpath[MAX_PATH]; - - if (StrLen(filename) >= 2 && IsFileExists(filename)) - { - StrToUni(fullpath, sizeof(fullpath), filename); - } - else - { - UniStrCpy(fullpath, sizeof(fullpath), (wchar_t *)filename); - } - - CmImportAccountMainEx(cm->hEasyWnd ? cm->hEasyWnd : hWnd, fullpath, cpy->dwData == CM_IMPORT_FILENAME_MSG_OVERWRITE); - } - else - { - MsgBox(cm->hEasyWnd ? cm->hEasyWnd : hWnd, MB_ICONEXCLAMATION | MB_SETFOREGROUND | MB_TOPMOST, _UU("CM_VPN_FILE_IMPORT_NG")); - } - } - } - break; - case WM_QUERYENDSESSION: - // Windows is about to terminate - cm->WindowsShutdowning = true; - CmSaveMainWindowPos(hWnd); - SleepThread(256); - break; - case WM_ENDSESSION: - // Windows has terminated - _exit(0); - break; - } - - LvSortHander(hWnd, msg, wParam, lParam, L_ACCOUNT); - LvSortHander(hWnd, msg, wParam, lParam, L_VLAN); - - return 0; -} - -// Specify the notification service to the foreground process -void CmSetForegroundProcessToCnService() -{ - if (cm->PopupMenuOpen) - { - return; - } - if (cm->server_name == NULL) - { - if (CnCheckAlreadyExists(false)) - { - AllowFGWindow(MsRegReadInt(REG_CURRENT_USER, - CM_REG_KEY, "NotifyServerProcessId")); - } - } -} - -// Show the [recent destination] sub-menu -HMENU CmCreateRecentSubMenu(HWND hWnd, UINT start_id) -{ - HMENU h = NULL; - UINT i; - RPC_CLIENT_ENUM_ACCOUNT a; - LIST *o; - - Zero(&a, sizeof(a)); - - if (CcEnumAccount(cm->Client, &a) == ERR_NO_ERROR) - { - o = NewListFast(CiCompareClientAccountEnumItemByLastConnectDateTime); - - for (i = 0;i < a.NumItem;i++) - { - RPC_CLIENT_ENUM_ACCOUNT_ITEM *item = a.Items[i]; - - item->tmp1 = i; - - if (item->LastConnectDateTime != 0) - { - Add(o, item); - } - } - - Sort(o); - - for (i = 0;i < MIN(LIST_NUM(o), CM_NUM_RECENT);i++) - { - RPC_CLIENT_ENUM_ACCOUNT_ITEM *item = (RPC_CLIENT_ENUM_ACCOUNT_ITEM *)LIST_DATA(o, i); - wchar_t tmp[MAX_PATH]; - wchar_t *account_name; - char *server_name; - UINT pos; - - if (h == NULL) - { - h = CreatePopupMenu(); - } - - account_name = item->AccountName; - server_name = item->ServerName; - - UniStrCpy(tmp, sizeof(tmp), account_name); - - pos = LvSearchStr(hWnd, L_ACCOUNT, 0, account_name); - if (pos != INFINITE) - { - MsAppendMenu(h, MF_STRING, start_id + pos, tmp); - } - } - - ReleaseList(o); - - CiFreeClientEnumAccount(&a); - } - - return h; -} - -// Show the sub-menu of the right-click menu in the task tray -HMENU CmCreateTraySubMenu(HWND hWnd, bool flag, UINT start_id) -{ - HMENU h = NULL; - UINT i, num; - bool easy; - // Validate arguments - if (hWnd == NULL) - { - return NULL; - } - - easy = cm->CmSetting.EasyMode; - - num = LvNum(hWnd, L_ACCOUNT); - - for (i = 0;i < num;i++) - { - wchar_t *status_str = LvGetStr(hWnd, L_ACCOUNT, i, 1); - - if (status_str != NULL) - { - bool b = false; - - if (UniStrCmpi(status_str, _UU("CM_ACCOUNT_OFFLINE")) == 0) - { - if (flag == false) - { - b = true; - } - } - - if (UniStrCmpi(status_str, _UU("CM_ACCOUNT_ONLINE")) == 0 || - UniStrCmpi(status_str, _UU("CM_ACCOUNT_CONNECTING")) == 0) - { - if (flag == true) - { - b = true; - } - } - - if (b) - { - wchar_t tmp[MAX_PATH]; - wchar_t *account_name, *server_name; - wchar_t *hub_name; - if (h == NULL) - { - h = CreatePopupMenu(); - } - - account_name = LvGetStr(hWnd, L_ACCOUNT, i, 0); - server_name = LvGetStr(hWnd, L_ACCOUNT, i, 2); - hub_name = LvGetStr(hWnd, L_ACCOUNT, i, 3); - - if (easy == false) - { - UniFormat(tmp, sizeof(tmp), L"%s\t- %s [%s]", account_name, server_name, hub_name); - } - else - { - UniStrCpy(tmp, sizeof(tmp), account_name); - } - - MsAppendMenu(h, MF_STRING, start_id + i, tmp); - - Free(account_name); - Free(server_name); - Free(hub_name); - } - - Free(status_str); - } - } - - return h; -} - -// Display the right-click menu of the task tray -void CmShowTrayMenu(HWND hWnd) -{ - HMENU h; - POINT p; - HMENU sub1, sub2, sub3, sub4; - bool locked; - bool easy; - // Validate arguments - if (hWnd == NULL) - { - return; - } - - cm->PopupMenuOpen = true; - - locked = cm->CmSetting.LockMode; - easy = cm->CmSetting.EasyMode; - - // Create a menu - h = CreatePopupMenu(); - - // Cancel - MsAppendMenu(h, MF_ENABLED | MF_STRING, 100007, _UU("CM_TRAY_MENU_CANCEL")); - - // Separator - MsAppendMenu(h, MF_SEPARATOR, 10006, NULL); - - if (locked == false && easy == false) - { - // Creating a new connection settings - MsAppendMenu(h, MF_ENABLED | MF_STRING, CMD_NEW, _UU("CM_TRAY_MENU_NEW")); - - // Separator - MsAppendMenu(h, MF_SEPARATOR, 10005, NULL); - } - - // Connection menu - sub1 = CmCreateTraySubMenu(hWnd, false, CM_TRAY_MENU_CONNECT_ID_START); - if (sub1 != NULL) - { - MsAppendMenu(h, MF_BYPOSITION | MF_ENABLED | MF_POPUP | MF_STRING, - (UINT_PTR)sub1, _UU("CM_TRAY_MENU_CONNECT")); - } - - // Disconnection menu - sub2 = CmCreateTraySubMenu(hWnd, true, CM_TRAY_MENU_DISCONNECT_ID_START); - if (sub2 != NULL) - { - MsAppendMenu(h, MF_BYPOSITION | MF_ENABLED | MF_POPUP | MF_STRING, - (UINT_PTR)sub2, _UU("CM_TRAY_MENU_DISCONNECT")); - } - - // Status Display menu - sub3 = CmCreateTraySubMenu(hWnd, true, CM_TRAY_MENU_STATUS_ID_START); - if (sub3 != NULL) - { - MsAppendMenu(h, MF_BYPOSITION | MF_ENABLED | MF_POPUP | MF_STRING, - (UINT_PTR)sub3, _UU("CM_TRAY_MENU_STATUS")); - } - - if (sub3 != NULL) - { - // Disconnect all connections - MsAppendMenu(h, MF_ENABLED | MF_STRING, CMD_DISCONNECT_ALL, _UU("CM_TRAY_MENU_DISCONNECT_ALL")); - } - - if (sub1 != NULL || sub2 != NULL || sub3 != NULL) - { - // Separator - MsAppendMenu(h, MF_SEPARATOR, 10003, NULL); - } - - // Connect to the recently connected VPN server - sub4 = CmCreateRecentSubMenu(hWnd, CM_TRAY_MENU_RECENT_ID_START); - if (sub4 != NULL) - { - MsAppendMenu(h, MF_BYPOSITION | MF_ENABLED | MF_POPUP | MF_STRING, - (UINT_PTR)sub4, _UU("CM_TRAY_MENU_RECENT")); - MsAppendMenu(h, MF_SEPARATOR, 10008, NULL); - } - - if (locked == false && easy == false) - { - // Communication throughput measurement - MsAppendMenu(h, MF_ENABLED | MF_STRING, CMD_TRAFFIC, _UU("CM_TRAY_MENU_TRAFFIC")); - } - - if (easy == false) - { - // Network device status - MsAppendMenu(h, MF_ENABLED | MF_STRING, CMD_NETIF, _UU("CM_TRAY_MENU_NETIF")); - } - - // Version information - MsAppendMenu(h, MF_ENABLED | MF_STRING, CMD_ABOUT, _UU("CM_TRAY_MENU_ABOUT")); - - // Separator - MsAppendMenu(h, MF_SEPARATOR, 10001, NULL); - - // Change the operating mode - MsAppendMenu(h, MF_ENABLED | MF_STRING, CMD_CM_SETTING, _UU("CM_TRAY_MENU_SETTING")); - - // Separator - MsAppendMenu(h, MF_SEPARATOR, 10001, NULL); - - // Hide the icon - MsAppendMenu(h, MF_ENABLED | MF_STRING, CMD_TRAYICON, _UU("CM_MENU@CMD_TRAYICON")); - - // Separator - MsAppendMenu(h, MF_SEPARATOR, 10001, NULL); - - // Show or hide - MsAppendMenu(h, MF_ENABLED | MF_STRING, CMD_EXIT, - IsHide(hWnd, 0) ? _UU("CM_TRAY_MENU_1_SHOW") : _UU("CM_TRAY_MENU_1_HIDE")); - - // Quit - MsAppendMenu(h, MF_ENABLED | MF_STRING, CMD_QUIT, _UU("CM_TRAY_MENU_2_QUIT")); - - // Show the menu - GetCursorPos(&p); - - SetForegroundWindow(hWnd); - TrackPopupMenu(h, TPM_LEFTALIGN, p.x, p.y, 0, hWnd, NULL); - PostMessage(hWnd, WM_NULL, 0, 0); - - if (sub1 != NULL) - { - DestroyMenu(sub1); - } - - if (sub2 != NULL) - { - DestroyMenu(sub2); - } - - if (sub3 != NULL) - { - DestroyMenu(sub3); - } - - DestroyMenu(h); - - cm->PopupMenuOpen = false; -} - -// Hide or show the main window -void CmShowOrHideWindow(HWND hWnd) -{ - // Validate arguments - if (hWnd == NULL) - { - return; - } - - if (IsHide(hWnd, 0)) - { - Show(hWnd, 0); - if (IsIconic(hWnd)) - { - ShowWindow(hWnd, SW_SHOWNORMAL); - } - SetForegroundWindow(hWnd); - SetActiveWindow(hWnd); - } - else - { - CmSaveMainWindowPos(hWnd); - Hide(hWnd, 0); - - if (cm->TrayInited == false) - { - Command(hWnd, CMD_QUIT); - return; - } - } -} - -// Right-clicked on the account list -void CmAccountListRightClick(HWND hWnd) -{ - HMENU h; - HMENU parent; - UINT i; - // Validate arguments - if (hWnd == NULL) - { - return; - } - - // Load the menu - h = LoadSubMenu(M_MAIN, 0, &parent); - if (h == NULL) - { - return; - } - - InitMenuInternational(h, "CM_MENU"); - - // Remove the shortcut key - RemoveShortcutKeyStrFromMenu(h); - - // Delete the exit menu - i = GetMenuItemPos(h, CMD_QUIT); - if (i != INFINITE) - { - DeleteMenuItem(h, i); - DeleteMenuItem(h, i - 1); - DeleteMenuItem(h, i - 2); - DeleteMenuItem(h, i - 3); - } - - // Set enable / disable - CmMainWindowOnPopupMenu(hWnd, h, INFINITE); - - if (h != NULL) - { - // Determine whether the selected account is under connecting - UINT i = LvGetSelected(hWnd, L_ACCOUNT); - wchar_t *str; - bool is_connected = false; - if (i != INFINITE) - { - str = LvGetStr(hWnd, L_ACCOUNT, i, 1); - if (str != NULL) - { - if (UniStrCmpi(str, _UU("CM_ACCOUNT_ONLINE")) == 0 || UniStrCmpi(str, _UU("CM_ACCOUNT_CONNECTING")) == 0) - { - // Connecting - is_connected = true; - } - Free(str); - } - } - - if (i == INFINITE) - { - // Bold the New menu - SetMenuItemBold(h, GetMenuItemPos(h, CMD_NEW), true); - } - else - { - if (is_connected == false) - { - // Bold the connection menu - SetMenuItemBold(h, GetMenuItemPos(h, CMD_CONNECT), true); - } - else - { - // Bold the status menu - SetMenuItemBold(h, GetMenuItemPos(h, CMD_STATUS), true); - } - } - } - - // Show the menu - PrintMenu(hWnd, h); - - DestroyMenu(parent); -} - -// Right-clicked on the virtual LAN card list -void CmVLanListRightClick(HWND hWnd) -{ - HMENU h; - HMENU parent; - // Validate arguments - if (hWnd == NULL) - { - return; - } - - // Load the menu - h = LoadSubMenu(M_MAIN, 3, &parent); - if (h == NULL) - { - return; - } - - InitMenuInternational(h, "CM_MENU"); - - // Remove the shortcut key - RemoveShortcutKeyStrFromMenu(h); - - // Set enable / disable - CmMainWindowOnPopupMenu(hWnd, h, INFINITE); - - if (h != NULL) - { - // Examine whether the selected device is enabled - UINT i = LvGetSelected(hWnd, L_VLAN); - wchar_t *str; - bool is_active = false; - if (i != INFINITE) - { - str = LvGetStr(hWnd, L_VLAN, i, 1); - if (str != NULL) - { - if (UniStrCmpi(str, _UU("CM_VLAN_ENABLED")) == 0) - { - // Enabled - is_active = true; - } - Free(str); - } - } - - if (i == INFINITE) - { - // Bold the New menu - SetMenuItemBold(h, GetMenuItemPos(h, CMD_NEW_VLAN), true); - } - else - { - if (is_active == false) - { - // Bold the enable menu - SetMenuItemBold(h, GetMenuItemPos(h, CMD_ENABLE_VLAN), true); - } - else - { - // Bold the Windows Network Setup menu - SetMenuItemBold(h, GetMenuItemPos(h, CMD_WINNET), true); - } - } - } - - // Show the menu - PrintMenu(hWnd, h); - - DestroyMenu(parent); -} - -// Notify to the main window -void CmMainWindowOnNotify(HWND hWnd, NMHDR *n) -{ - bool item_vlan; - NMLVDISPINFOW *disp_info; - NMLVKEYDOWN *key; - - // Validate arguments - if (hWnd == NULL || n == NULL) - { - return; - } - - switch (n->idFrom) - { - case L_ACCOUNT: - case L_VLAN: - if (n->idFrom == L_ACCOUNT) - { - item_vlan = false; - } - else - { - item_vlan = true; - } - - switch (n->code) - { - case NM_DBLCLK: - // Double click - CmOnKey(hWnd, false, false, VK_RETURN); - break; - case NM_RCLICK: - // Right click - if (item_vlan == false) - { - CmAccountListRightClick(hWnd); - } - else - { - CmVLanListRightClick(hWnd); - } - break; - case LVN_ENDLABELEDITW: - // Change the name - disp_info = (NMLVDISPINFOW *)n; - if (disp_info->item.pszText != NULL) - { - wchar_t *new_name = disp_info->item.pszText; - wchar_t *old_name = LvGetStr(hWnd, L_ACCOUNT, disp_info->item.iItem, 0); - - if (old_name != NULL) - { - if (UniStrCmp(new_name, old_name) != 0 && UniIsEmptyStr(new_name) == false) - { - RPC_RENAME_ACCOUNT a; - Zero(&a, sizeof(a)); - UniStrCpy(a.OldName, sizeof(a.OldName), old_name); - UniStrCpy(a.NewName, sizeof(a.NewName), new_name); - if (CALL(hWnd, CcRenameAccount(cm->Client, &a))) - { - LvSetItem(hWnd, L_ACCOUNT, disp_info->item.iItem, 0, new_name); - } - } - - Free(old_name); - } - } - break; - case LVN_KEYDOWN: - // Key pressed - key = (NMLVKEYDOWN *)n; - if (key != NULL) - { - bool ctrl, alt; - UINT code = key->wVKey; - ctrl = (GetKeyState(VK_CONTROL) & 0x8000) == 0 ? false : true; - alt = (GetKeyState(VK_MENU) & 0x8000) == 0 ? false : true; - CmOnKey(hWnd, ctrl, alt, code); - } - break; - } - break; - } -} - -// Keyboard pressed -void CmOnKey(HWND hWnd, bool ctrl, bool alt, UINT key) -{ - // Validate arguments - if (hWnd == NULL) - { - return; - } - - // Single key - switch (key) - { - case VK_RETURN: - Command(hWnd, IDOK); - break; - case VK_DELETE: - // Delete - if (IsFocus(hWnd, L_ACCOUNT)) - { - // Operation on the account list - Command(hWnd, CMD_DELETE); - } - else - { - // Operation on the virtual LAN card list - Command(hWnd, CMD_DELETE_VLAN); - } - break; - case VK_F2: - // Change the name - Command(hWnd, CMD_RENAME); - break; - case VK_F5: - // Update the status - Command(hWnd, CMD_REFRESH); - break; - } - - if (alt) - { - switch (key) - { - case 'Q': - // Close - Command(hWnd, CMD_QUIT); - break; - } - } - - if (ctrl) - { - switch (key) - { - case 'G': - // Smart Card Manager - Command(hWnd, CMD_SECURE_MANAGER); - break; - case 'S': - // Show the state - Command(hWnd, CMD_STATUS); - break; - case 'I': - // Disconnect all connections - Command(hWnd, CMD_DISCONNECT_ALL); - break; - case 'D': - // Disconnect - Command(hWnd, CMD_DISCONNECT); - break; - case 'N': - // Create a new connection settings - Command(hWnd, CMD_NEW); - break; - case 'C': - // Creating a copy - Command(hWnd, CMD_CLONE); - break; - case 'T': - // Set to start-up connection - Command(hWnd, CMD_STARTUP); - break; - case 'A': - // Select all - Command(hWnd, CMD_SELECT_ALL); - break; - case 'L': - // Create a new virtual LAN card - Command(hWnd, CMD_NEW_VLAN); - break; - case 'E': - // Enable the virtual LAN card - Command(hWnd, CMD_ENABLE_VLAN); - break; - case 'B': - // Disable the virtual LAN card - Command(hWnd, CMD_DISABLE_VLAN); - break; - case 'U': - // Reinstall the driver - Command(hWnd, CMD_REINSTALL); - break; - case 'W': - // Configure Windows network connection - Command(hWnd, CMD_WINNET); - break; - case 'P': - // Set the password - Command(hWnd, CMD_PASSWORD); - break; - case 'O': - // Option settings - Command(hWnd, CMD_TRAFFIC); - break; - case 'R': - // Certificate management - Command(hWnd, CMD_TRUST); - break; - case 'Q': - // Throughput - Command(hWnd, CMD_TRAFFIC); - break; - } - } -} - -// Command of the main window -void CmMainWindowOnCommand(HWND hWnd, WPARAM wParam, LPARAM lParam) -{ - CmMainWindowOnCommandEx(hWnd, wParam, lParam, false); -} -void CmMainWindowOnCommandEx(HWND hWnd, WPARAM wParam, LPARAM lParam, bool easy) -{ - wchar_t *tmp; - char *name; - UINT index; - UINT id; - bool ctrl, alt; - UINT flag = 0; - // Validate arguments - wchar_t *selected_name = NULL; - UINT starter_id = 0; - if (hWnd == NULL) - { - return; - } - - ctrl = (GetKeyState(VK_CONTROL) & 0x8000) == 0 ? false : true; - alt = (GetKeyState(VK_MENU) & 0x8000) == 0 ? false : true; - - if (wParam == IDOK) - { - tmp = LvGetSelectedStr(hWnd, L_ACCOUNT, 0); - if (tmp != NULL) - { - if (UniStrCmpi(tmp, _UU("CM_NEW_ICON")) == 0) - { - Free(tmp); - Command(hWnd, CMD_NEW); - return; - } - if (UniStrCmpi(tmp, _UU("CM_VGC_ICON")) == 0 || UniStrCmpi(tmp, _UU("CM_VGC_LINK")) == 0) - { - Free(tmp); - Command(hWnd, CMD_VGC_CONNECT); - return; - } - Free(tmp); - } - } - - if (CmIsEnabled(hWnd, (UINT)wParam) == false) - { - return; - } - - if (CM_TRAY_IS_CONNECT_ID(wParam)) - { - // Connection request - starter_id = CM_TRAY_MENU_CONNECT_ID_START; - flag = 1; - } - - if (CM_TRAY_IS_STATUS_ID(wParam)) - { - // Information display request - starter_id = CM_TRAY_MENU_STATUS_ID_START; - flag = 2; - } - - if (CM_TRAY_IS_DISCONNECT_ID(wParam)) - { - // Disconnect request - starter_id = CM_TRAY_MENU_DISCONNECT_ID_START; - flag = 3; - } - - if (CM_TRAY_IS_RECENT_ID(wParam)) - { - // Recent destinations - starter_id = CM_TRAY_MENU_RECENT_ID_START; - flag = 1; - } - - if (starter_id != 0) - { - UINT num; - - id = (UINT)wParam - starter_id; - - num = LvNum(hWnd, L_ACCOUNT); - - if (id < num) - { - selected_name = LvGetStr(hWnd, L_ACCOUNT, id, 0); - - if (selected_name != NULL) - { - if (UniStrCmpi(selected_name, _UU("CM_NEW_ICON")) != 0 && - UniStrCmpi(selected_name, _UU("CM_VGC_ICON")) != 0 && - UniStrCmpi(selected_name, _UU("CM_VGC_LINK")) != 0) - { - switch (flag) - { - case 1: - CmConnect(hWnd, selected_name); - break; - - case 2: - CmStatus(hWnd, selected_name); - break; - - case 3: - CmDisconnect(hWnd, selected_name); - break; - } - } - } - - Free(selected_name); - } - } - - switch (wParam) - { - case IDOK: - case CMD_EASY_DBLCLICK: - // Property or connection - if (IsFocus(hWnd, L_ACCOUNT) || (hWnd == cm->hEasyWnd)) - { - // Operation about the account list - if (alt == false) - { - UINT index = LvGetSelected(hWnd, L_ACCOUNT); - bool b = false; - if (index != INFINITE) - { - wchar_t *s = LvGetStr(hWnd, L_ACCOUNT, index, 1); - if (s != NULL) - { - if (UniStrCmpi(s, _UU("CM_ACCOUNT_ONLINE")) == 0 || UniStrCmpi(s, _UU("CM_ACCOUNT_CONNECTING")) == 0) - { - b = true; - } - Free(s); - } - } - - if (b == false) - { - // Connection - Command(hWnd, CMD_CONNECT); - } - else - { - if (hWnd != cm->hEasyWnd || wParam == CMD_EASY_DBLCLICK) - { - // Display status - Command(hWnd, CMD_STATUS); - } - else - { - // Disconnect - Command(hWnd, CMD_DISCONNECT); - } - } - } - else - { - // Property - Command(hWnd, CMD_PROPERTY); - } - } - else - { - // Configure Windows network connection - Command(hWnd, CMD_WINNET); - } - break; - case CMD_CONNECT: - // Connection - tmp = LvGetStr(hWnd, L_ACCOUNT, LvGetSelected(hWnd, L_ACCOUNT), 0); - if (tmp != NULL) - { - CmConnect(hWnd, tmp); - Free(tmp); - } - break; - case CMD_STATUS: - // Show the status - tmp = LvGetStr(hWnd, L_ACCOUNT, LvGetSelected(hWnd, L_ACCOUNT), 0); - if (tmp != NULL) - { - CmStatus(hWnd, tmp); - Free(tmp); - } - break; - case CMD_DISCONNECT_ALL: - // Disconnect all connections - CmDisconnectAll(hWnd); - break; - case CMD_DISCONNECT: - // Disconnect - tmp = LvGetStr(hWnd, L_ACCOUNT, LvGetSelected(hWnd, L_ACCOUNT), 0); - if (tmp != NULL) - { - CmDisconnect(hWnd, tmp); - Free(tmp); - } - break; - case CMD_NEW: - // Create new - CmNewAccount(hWnd); - break; - - - case CMD_CLONE: - // Copy - tmp = LvGetStr(hWnd, L_ACCOUNT, LvGetSelected(hWnd, L_ACCOUNT), 0); - if (tmp != NULL) - { - CmCopyAccount(hWnd, tmp); - Free(tmp); - } - break; - case CMD_SHORTCUT: - // Create a shortcut - tmp = LvGetStr(hWnd, L_ACCOUNT, LvGetSelected(hWnd, L_ACCOUNT), 0); - if (tmp != NULL) - { - CmSortcut(hWnd, tmp); - Free(tmp); - } - break; - case CMD_EXPORT_ACCOUNT: - // Export settings - tmp = LvGetStr(hWnd, L_ACCOUNT, LvGetSelected(hWnd, L_ACCOUNT), 0); - if (tmp != NULL) - { - CmExportAccount(hWnd, tmp); - Free(tmp); - } - break; - case CMD_IMPORT_ACCOUNT: - // Import settings - CmImportAccount(hWnd); - break; - case CMD_STARTUP: - // Set to start-up connection - tmp = LvGetStr(hWnd, L_ACCOUNT, LvGetSelected(hWnd, L_ACCOUNT), 0); - if (tmp != NULL) - { - RPC_CLIENT_DELETE_ACCOUNT c; - Zero(&c, sizeof(c)); - UniStrCpy(c.AccountName, sizeof(c.AccountName), tmp); - CALL(hWnd, CcSetStartupAccount(cm->Client, &c)); - CmVoice("set_startup"); - MsgBoxEx(hWnd, MB_ICONINFORMATION, _UU("CM_SET_STARTUP"), tmp); - Free(tmp); - } - break; - case CMD_NOSTARTUP: - // Unset the start-up connection - tmp = LvGetStr(hWnd, L_ACCOUNT, LvGetSelected(hWnd, L_ACCOUNT), 0); - if (tmp != NULL) - { - if (MsgBoxEx(hWnd, MB_ICONQUESTION | MB_YESNO | MB_DEFBUTTON2, - _UU("CM_REMOVE_STARTUP"), tmp) == IDYES) - { - RPC_CLIENT_DELETE_ACCOUNT c; - Zero(&c, sizeof(c)); - UniStrCpy(c.AccountName, sizeof(c.AccountName), tmp); - CALL(hWnd, CcRemoveStartupAccount(cm->Client, &c)); - CmVoice("remove_startup"); - } - Free(tmp); - } - break; - case CMD_DELETE: - // Delete - tmp = LvGetStr(hWnd, L_ACCOUNT, LvGetSelected(hWnd, L_ACCOUNT), 0); - if (tmp != NULL) - { - CmDeleteAccount(hWnd, tmp); - Free(tmp); - } - break; - case CMD_RENAME: - // Change the name - Focus(hWnd, L_ACCOUNT); - LvRename(hWnd, L_ACCOUNT, LvGetSelected(hWnd, L_ACCOUNT)); - break; - case CMD_PROPERTY: - // Property - tmp = LvGetStr(hWnd, L_ACCOUNT, LvGetSelected(hWnd, L_ACCOUNT), 0); - if (tmp != NULL) - { - CmEditAccount(hWnd, tmp); - Free(tmp); - } - break; - case IDCANCEL: - case CMD_EXIT: - // Close - Close(hWnd); - break; - case CMD_QUIT: - // Exit - CmMainWindowOnQuit(hWnd); - break; - case CMD_SELECT_ALL: - // Select all - LvSelectAll(hWnd, L_ACCOUNT); - LvSelectAll(hWnd, L_VLAN); - break; - case CMD_SWITCH_SELECT: - // Invert selection - LvSwitchSelect(hWnd, L_ACCOUNT); - LvSwitchSelect(hWnd, L_VLAN); - break; - case CMD_GRID: - // Show grid - cm->ShowGrid = !cm->ShowGrid; - CmRefreshVLanListEx(hWnd, true); - CmRefreshAccountListEx2(hWnd, false, true); - break; - case CMD_STATUSBAR: - // Show the status bar - if (cm->HideStatusBar == false) - { - cm->HideStatusBar = true; - Hide(hWnd, S_STATUSBAR); - CmMainWindowOnSize(hWnd); - } - else - { - cm->HideStatusBar = false; - Show(hWnd, S_STATUSBAR); - CmMainWindowOnSize(hWnd); - } - CmSaveMainWindowPos(hWnd); - break; - case CMD_VISTASTYLE: - cm->VistaStyle = !cm->VistaStyle; - CmRefreshEx(hWnd, true); - CmSaveMainWindowPos(hWnd); - break; - case CMD_TRAYICON: - // Tray icon display - if (cm->HideTrayIcon == false) - { - cm->HideTrayIcon = true; - CmFreeTray(hWnd); - - if (IsHide(hWnd, 0)) - { - MsgBox(hWnd, MB_ICONINFORMATION, _UU("CM_TRAY_ICON_RESTORE")); - } - } - else - { - cm->HideTrayIcon = false; - if (cm->server_name == NULL) - { - CmInitTray(hWnd); - } - } - break; - case CMD_SHOWPORT: - // Show the port number - cm->ShowPort = !cm->ShowPort; - CmRefresh(hWnd); - break; - case CMD_ICON: - // Show the icon - if (cm->IconView == false) - { - cm->IconView = true; - CmRefresh(hWnd); - } - break; - case CMD_DETAIL: - // Show details - if (cm->IconView) - { - cm->IconView = false; - CmRefresh(hWnd); - } - break; - case CMD_REFRESH: - if (easy == false) - { - // Display update - LvReset(hWnd, L_ACCOUNT); - LvReset(hWnd, L_VLAN); - CmRefresh(hWnd); - } - break; - case CMD_NEW_VLAN: - // Create a Virtual LAN card - if (CmStopInstallVLan(hWnd) == false) - { - // Installation is prohibited - break; - } - name = CmNewVLanDlg(hWnd); - if (name != NULL) - { - wchar_t tmp[MAX_SIZE]; - void *helper = NULL; - RPC_CLIENT_CREATE_VLAN c; - Zero(&c, sizeof(c)); - StrCpy(c.DeviceName, sizeof(c.DeviceName), name); - if (MsIsNt() == false) - { - // Change the title of the window - GetTxt(hWnd, 0, tmp, sizeof(tmp)); - SetText(hWnd, 0, _UU("CM_VLAN_INSTALLING")); - } - // Minimize - if (MsIsVista() == false) - { - ShowWindow(hWnd, SW_SHOWMINIMIZED); - } - - if (MsIsVista()) - { - helper = CmStartUacHelper(); - } - - if (CALL(hWnd, CcCreateVLan(cm->Client, &c))) - { - CmVoice("new_vlan"); - } - - CmStopUacHelper(helper); - - if (MsIsNt() == false) - { - // Restore the title of the window - SetText(hWnd, 0, tmp); - } - // Restore - if (MsIsVista() == false) - { - ShowWindow(hWnd, SW_SHOWNORMAL); - } - Free(name); - } - break; - case CMD_DELETE_VLAN: - // Delete the Virtual LAN card - index = LvGetSelected(hWnd, L_VLAN); - if (index != INFINITE) - { - if (cm->Client->Win9x == false) - { - // Windows 2000 or later - wchar_t *s = LvGetStr(hWnd, L_VLAN, index, 0); - if (s != NULL) - { - RPC_CLIENT_CREATE_VLAN c; - char str[MAX_SIZE]; - CmVoice("delete_vlan_1"); - if (MsgBoxEx(hWnd, MB_ICONQUESTION | MB_YESNO | MB_DEFBUTTON2, _UU("CM_DELETE_VLAN"), s) == IDYES) - { - Zero(&c, sizeof(c)); - UniToStr(str, sizeof(str), s); - if (CmPrintNameToVLanName(c.DeviceName, sizeof(c.DeviceName), str)) - { - if (CALL(hWnd, CcDeleteVLan(cm->Client, &c))) - { - CmVoice("delete_vlan_2"); - } - } - } - Free(s); - } - } - else - { - // Windows 9x - if (MsgBox(hWnd, MB_ICONQUESTION | MB_YESNO, _UU("CM_9X_VLAN_UNINSTALL")) == IDYES) - { - Run("rundll32.exe", "shell32.dll,Control_RunDLL NETCPL.CPL", - false, false); - } - } - } - break; - case CMD_ENABLE_VLAN: - // Enable the virtual LAN card - index = LvGetSelected(hWnd, L_VLAN); - if (index != INFINITE) - { - wchar_t *s = LvGetStr(hWnd, L_VLAN, index, 0); - if (s != NULL) - { - RPC_CLIENT_CREATE_VLAN c; - char str[MAX_SIZE]; - Zero(&c, sizeof(c)); - UniToStr(str, sizeof(str), s); - if (CmPrintNameToVLanName(c.DeviceName, sizeof(c.DeviceName), str)) - { - CALL(hWnd, CcEnableVLan(cm->Client, &c)); - } - Free(s); - } - } - break; - case CMD_DISABLE_VLAN: - // Disable the virtual LAN card - index = LvGetSelected(hWnd, L_VLAN); - if (index != INFINITE) - { - wchar_t *s = LvGetStr(hWnd, L_VLAN, index, 0); - if (s != NULL) - { - RPC_CLIENT_CREATE_VLAN c; - char str[MAX_SIZE]; - Zero(&c, sizeof(c)); - UniToStr(str, sizeof(str), s); - if (CmPrintNameToVLanName(c.DeviceName, sizeof(c.DeviceName), str)) - { - CALL(hWnd, CcDisableVLan(cm->Client, &c)); - } - Free(s); - } - } - break; - case CMD_REINSTALL: - // Reinstall the virtual LAN card - if (CmStopInstallVLan(hWnd) == false) - { - // Installation is prohibited - break; - } - // Warning message - if (MsgBox(hWnd, MB_ICONINFORMATION | MB_OKCANCEL, _UU("CM_VLAN_REINSTALL_MSG")) == IDCANCEL) - { - // Cancel - break; - } - index = LvGetSelected(hWnd, L_VLAN); - if (index != INFINITE) - { - wchar_t *s = LvGetStr(hWnd, L_VLAN, index, 0); - if (s != NULL) - { - RPC_CLIENT_CREATE_VLAN c; - char str[MAX_SIZE]; - Zero(&c, sizeof(c)); - UniToStr(str, sizeof(str), s); - if (CmPrintNameToVLanName(c.DeviceName, sizeof(c.DeviceName), str)) - { - void *helper = NULL; - - if (MsIsVista() == false) - { - ShowWindow(hWnd, SW_SHOWMINIMIZED); - } - - if (MsIsVista()) - { - helper = CmStartUacHelper(); - } - - CALL(hWnd, CcUpgradeVLan(cm->Client, &c)); - - CmStopUacHelper(helper); - - if (MsIsVista() == false) - { - ShowWindow(hWnd, SW_SHOWNORMAL); - } - } - Free(s); - } - } - break; - case CMD_PASSWORD: - // Password setting - CmPassword(hWnd); - break; - case CMD_OPTION: - // Option - CmConfigDlg(hWnd); - break; - case CMD_LANGUAGE: - // Language settings - if (true) - { - wchar_t path[MAX_SIZE]; - - CombinePathW(path, sizeof(path), MsGetExeDirNameW(), L"vpnsetup.exe"); - - if (MsExecuteW(path, L"/language:yes") == false) - { - MsgBox(hWnd, MB_ICONEXCLAMATION, _UU("SW_CHILD_PROCESS_ERROR")); - } - } - break; - case CMD_TRUST: - // Certificate management - CmTrustDlg(hWnd); - break; - case CMD_ABOUT: - // Version information - if (IsEnable(hWnd, 0)) - { - AboutEx(hWnd, cm->Cedar, _UU("PRODUCT_NAME_VPN_CMGR"), cm->Update); - } - break; - case CMD_VOIDE_NONE: - cm->DisableVoice = true; - break; - case CMD_VOICE_NORMAL: - cm->DisableVoice = false; - cm->VoiceId = VOICE_SSK; - break; - case CMD_VOICE_ODD: - if (MsgBox(hWnd, MB_ICONQUESTION | MB_YESNO, _UU("CM_EXT_VOICE_MSG")) == IDYES) - { - cm->DisableVoice = false; - cm->VoiceId = VOICE_AHO; - } - break; - case CMD_SECURE_MANAGER: - // Smart Card Manager - CmClientSecureManager(hWnd); - break; - case CMD_SECURE_SELECT: - // Select a smart card - CmClientSelectSecure(hWnd); - break; - case CMD_NETIF: - // State of the network device - if (IsEnable(hWnd, 0)) - { - UtSpeedMeterEx(hWnd); - } - break; - case CMD_MMCSS: - // Optimization utility for Windows Vista - if (MsIsVista() == false) - { - MsgBox(hWnd, MB_ICONINFORMATION, _UU("VISTA_MMCSS_MSG_4")); - } - else - { - if (MsIsAdmin() == false) - { - MsgBox(hWnd, MB_ICONEXCLAMATION, _UU("VISTA_MMCSS_MSG_4")); - } - else - { - if (MsIsMMCSSNetworkThrottlingEnabled()) - { - if (MsgBox(hWnd, MB_ICONQUESTION | MB_YESNO, _UU("VISTA_MMCSS_MSG")) == IDYES) - { - MsSetMMCSSNetworkThrottlingEnable(false); - MsgBox(hWnd, MB_ICONINFORMATION, _UU("VISTA_MMCSS_MSG_5")); - } - } - else - { - if (MsgBox(hWnd, MB_ICONQUESTION | MB_YESNO | MB_DEFBUTTON2, _UU("VISTA_MMCSS_MSG_2")) == IDYES) - { - MsSetMMCSSNetworkThrottlingEnable(true); - MsgBox(hWnd, MB_ICONINFORMATION, _UU("VISTA_MMCSS_MSG_6")); - } - } - } - } - break; - case CMD_TRAFFIC: - // Communication traffic measurement - if (IsEnable(hWnd, 0)) - { - CmTraffic(hWnd); - } - break; - case CMD_CM_SETTING: - // Operation mode setting - if (IsEnable(hWnd, 0)) - { - if (CmSetting(hWnd)) - { - CmApplyCmSetting(); - } - } - break; - case CMD_WINNET: - // Windows network settings - ShowWindowsNetworkConnectionDialog(); - break; - } -} - -// Option dialog -void CmConfigDlg(HWND hWnd) -{ - // Validate arguments - if (hWnd == NULL) - { - return; - } - - Dialog(hWnd, D_CM_CONFIG, CmConfigDlgProc, NULL); -} - -// Initialize the option dialog -void CmConfigDlgInit(HWND hWnd) -{ - bool use_alpha; - UINT alpha_value; - UINT os; - CLIENT_CONFIG c; - // Validate arguments - if (hWnd == NULL) - { - return; - } - - DlgFont(hWnd, S_WARNING, 10, true); - DlgFont(hWnd, S_INFO, 10, false); - - Zero(&c, sizeof(c)); - if (CALL(hWnd, CcGetClientConfig(cm->Client, &c)) == false) - { - EndDialog(hWnd, 0); - return; - } - - Check(hWnd, R_ALLOW_REMOTE_CONFIG, c.AllowRemoteConfig); - - Check(hWnd, R_USE_KEEP_CONNECT, c.UseKeepConnect); - SetTextA(hWnd, E_HOSTNAME, c.KeepConnectHost); - SetIntEx(hWnd, E_PORT, c.KeepConnectPort); - SetIntEx(hWnd, E_INTERVAL, c.KeepConnectInterval); - - Check(hWnd, R_TCP, c.KeepConnectProtocol == CONNECTION_TCP); - Check(hWnd, R_UDP, c.KeepConnectProtocol == CONNECTION_UDP); - - use_alpha = MsRegReadInt(REG_CURRENT_USER, CM_REG_KEY, "UseAlpha") == 0 ? false : true; - alpha_value = MsRegReadInt(REG_CURRENT_USER, CM_REG_KEY, "AlphaValue"); - alpha_value = MAKESURE(alpha_value, 0, 100); - - SetInt(hWnd, E_ALPHA_VALUE, alpha_value == 0 ? 50 : alpha_value); - Check(hWnd, R_ALPHA, use_alpha); - - os = GetOsInfo()->OsType; - if (OS_IS_WINDOWS_NT(os) && GET_KETA(os, 100) >= 2) - { - Enable(hWnd, R_ALPHA); - } - else - { - Disable(hWnd, R_ALPHA); - } - - CmConfigDlgRefresh(hWnd); -} - -// Update the option dialog -void CmConfigDlgRefresh(HWND hWnd) -{ - bool ok = true; - bool use_keep_connect; - // Validate arguments - if (hWnd == NULL) - { - return; - } - - use_keep_connect = IsChecked(hWnd, R_USE_KEEP_CONNECT); - SetEnable(hWnd, S_HOSTNAME, use_keep_connect); - SetEnable(hWnd, S_PORT, use_keep_connect); - SetEnable(hWnd, S_INTERVAL, use_keep_connect); - SetEnable(hWnd, S_INTERVAL2, use_keep_connect); - SetEnable(hWnd, S_PROTOCOL, use_keep_connect); - SetEnable(hWnd, S_INFO, use_keep_connect); - SetEnable(hWnd, S_INFO2, use_keep_connect); - SetEnable(hWnd, E_HOSTNAME, use_keep_connect); - SetEnable(hWnd, E_PORT, use_keep_connect); - SetEnable(hWnd, E_INTERVAL, use_keep_connect); - SetEnable(hWnd, R_TCP, use_keep_connect); - SetEnable(hWnd, R_UDP, use_keep_connect); - - SetEnable(hWnd, S_WARNING, IsChecked(hWnd, R_ALLOW_REMOTE_CONFIG)); - - if (IsChecked(hWnd, R_USE_KEEP_CONNECT)) - { - if (IsEmpty(hWnd, E_HOSTNAME)) - { - ok = false; - } - if (IsChecked(hWnd, R_TCP) == false && IsChecked(hWnd, R_UDP) == false) - { - ok = false; - } - if (GetInt(hWnd, E_PORT) == 0 || GetInt(hWnd, E_PORT) >= 65536) - { - ok = false; - } - if (GetInt(hWnd, E_INTERVAL) == 0) - { - ok = false; - } - } - - if (IsChecked(hWnd, R_ALPHA)) - { - UINT i = GetInt(hWnd, E_ALPHA_VALUE); - if (i < 20 || i >= 100) - { - ok = false; - } - Enable(hWnd, E_ALPHA_VALUE); - } - else - { - Disable(hWnd, E_ALPHA_VALUE); - } - - SetEnable(hWnd, IDOK, ok); -} - -// Save the setting of the option dialog -void CmConfigDlgOnOk(HWND hWnd) -{ - CLIENT_CONFIG c; - // Validate arguments - if (hWnd == NULL) - { - return; - } - - Zero(&c, sizeof(c)); - c.AllowRemoteConfig = IsChecked(hWnd, R_ALLOW_REMOTE_CONFIG); - c.UseKeepConnect = IsChecked(hWnd, R_USE_KEEP_CONNECT); - GetTxtA(hWnd, E_HOSTNAME, c.KeepConnectHost, sizeof(c.KeepConnectHost)); - c.KeepConnectPort = GetInt(hWnd, E_PORT); - c.KeepConnectInterval = GetInt(hWnd, E_INTERVAL); - if (IsChecked(hWnd, R_TCP)) - { - c.KeepConnectProtocol = CONNECTION_TCP; - } - else if (IsChecked(hWnd, R_UDP)) - { - c.KeepConnectProtocol = CONNECTION_UDP; - } - else - { - return; - } - - if (c.UseKeepConnect) - { - if (c.KeepConnectInterval < KEEP_INTERVAL_MIN || c.KeepConnectInterval > KEEP_INTERVAL_MAX) - { - MsgBoxEx(hWnd, MB_ICONINFORMATION, _UU("CM_KEEP_INTERVAL_MSG"), - KEEP_INTERVAL_MIN, KEEP_INTERVAL_MAX); - FocusEx(hWnd, E_INTERVAL); - return; - } - } - - if (CALL(hWnd, CcSetClientConfig(cm->Client, &c)) == false) - { - return; - } - - MsRegWriteInt(REG_CURRENT_USER, CM_REG_KEY, "AlphaValue", GetInt(hWnd, E_ALPHA_VALUE)); - MsRegWriteInt(REG_CURRENT_USER, CM_REG_KEY, "UseAlpha", IsChecked(hWnd, R_ALPHA)); - - EndDialog(hWnd, true); -} - -// Option setting dialog procedure -UINT CmConfigDlgProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param) -{ - // Validate arguments - if (hWnd == NULL) - { - return 0; - } - - switch (msg) - { - case WM_INITDIALOG: - CmConfigDlgInit(hWnd); - break; - case WM_COMMAND: - switch (LOWORD(wParam)) - { - case R_ALLOW_REMOTE_CONFIG: - case R_USE_KEEP_CONNECT: - case E_HOSTNAME: - case E_PORT: - case E_INTERVAL: - case R_ALPHA: - case E_ALPHA_VALUE: - CmConfigDlgRefresh(hWnd); - break; - } - - switch (wParam) - { - case IDOK: - CmConfigDlgRefresh(hWnd); - CmConfigDlgOnOk(hWnd); - break; - case IDCANCEL: - Close(hWnd); - break; - case R_ALLOW_REMOTE_CONFIG: - if (IsChecked(hWnd, R_ALLOW_REMOTE_CONFIG) == false) - { - if (cm->server_name != NULL) - { - // If the current user is remotely connected, show a warning - // when the user choose to disable the remote management - if (MsgBoxEx(hWnd, MB_ICONEXCLAMATION | MB_DEFBUTTON2 | MB_YESNO, _UU("CM_REMOTE_WARNING"), - cm->server_name, cm->server_name) == IDNO) - { - Check(hWnd, R_ALLOW_REMOTE_CONFIG, true); - } - } - } - break; - case R_USE_KEEP_CONNECT: - if (IsChecked(hWnd, R_USE_KEEP_CONNECT)) - { - FocusEx(hWnd, E_HOSTNAME); - } - break; - case R_ALPHA: - if (IsChecked(hWnd, R_ALPHA)) - { - FocusEx(hWnd, E_ALPHA_VALUE); - } - break; - } - break; - case WM_CLOSE: - EndDialog(hWnd, false); - break; - } - - return 0; -} - -// Create a shortcut -void CmSortcut(HWND hWnd, wchar_t *account_name) -{ - wchar_t tmp[MAX_SIZE]; - CM_ACCOUNT *a; - wchar_t *filename; - UCHAR key[SHA1_SIZE]; - // Validate arguments - if (hWnd == NULL || account_name == NULL) - { - return; - } - - // Get the account information - a = CmGetExistAccountObject(hWnd, account_name); - if (a == NULL) - { - return; - } - - Copy(key, a->ShortcutKey, SHA1_SIZE); - - if (IsZero(key, SHA1_SIZE)) - { - MsgBox(hWnd, MB_ICONINFORMATION, _UU("CM_SHORTCUT_UNSUPPORTED")); - } - else - { - // Determine the file name - UniFormat(tmp, sizeof(tmp), L"%s.lnk", account_name); - UniSafeFileName(tmp); - - filename = SaveDlg(hWnd, _UU("CM_SHORTCUT_FILE"), - _UU("CM_SHORTCUT_SAVE_TITLE"), tmp, L".vpn"); - - if (filename != NULL) - { - char key_str[64]; - wchar_t target[MAX_PATH]; - wchar_t workdir[MAX_PATH]; - wchar_t args[MAX_PATH]; - wchar_t comment[MAX_SIZE]; - wchar_t icon[MAX_PATH]; - - BinToStr(key_str, sizeof(key_str), key, SHA1_SIZE); - - // Create a shortcut - UniStrCpy(target, sizeof(target), MsGetExeFileNameW()); - UniStrCpy(workdir, sizeof(workdir), MsGetExeDirNameW()); - StrToUni(args, sizeof(args), key_str); - UniFormat(comment, sizeof(comment), _UU("CM_SHORTCUT_COMMENT"), account_name); - UniStrCpy(icon, sizeof(icon), MsGetExeFileNameW()); - - if (CreateLink(filename, target, workdir, args, comment, icon, 1) == false) - { - MsgBox(hWnd, MB_ICONSTOP, _UU("CM_SHORTCUT_ERROR")); - } - - Free(filename); - } - } - - CmFreeAccountObject(hWnd, a); -} - -// Export the account -void CmExportAccount(HWND hWnd, wchar_t *account_name) -{ - wchar_t tmp[MAX_SIZE]; - CM_ACCOUNT *a; - wchar_t *filename; - // Validate arguments - if (hWnd == NULL || account_name == NULL) - { - return; - } - - // Get the account information - a = CmGetExistAccountObject(hWnd, account_name); - if (a == NULL) - { - return; - } - - // Determine the file name - UniFormat(tmp, sizeof(tmp), L"%s.vpn", account_name); - UniSafeFileName(tmp); - - filename = SaveDlg(hWnd, _UU("CM_ACCOUNT_SETTING_FILE"), - _UU("CM_ACCOUNT_SAVE_TITLE"), tmp, L".vpn"); - - if (filename != NULL) - { - RPC_CLIENT_CREATE_ACCOUNT t; - BUF *b; - BUF *b2; - wchar_t tmp[MAX_SIZE]; - UCHAR *buf; - UINT buf_size; - UCHAR bom[] = {0xef, 0xbb, 0xbf, }; - - Zero(&t, sizeof(t)); - t.ClientOption = a->ClientOption; - t.ClientAuth = a->ClientAuth; - t.StartupAccount = a->Startup; - t.CheckServerCert = a->CheckServerCert; - t.RetryOnServerCert = a->RetryOnServerCert; - t.ServerCert = a->ServerCert; - t.ClientOption->FromAdminPack = false; - - b = CiAccountToCfg(&t); - - SeekBuf(b, 0, 0); - - // Check whether the password is contained - if (CiHasAccountSensitiveInformation(b)) - { - SeekBuf(b, 0, 0); - - // Confirm that the user want to clear the password - if (MsgBox(hWnd, MB_YESNO | MB_ICONQUESTION, _UU("CM_ACCOUNT_MSG_SENSITIVE")) == IDYES) - { - // Erase - CiEraseSensitiveInAccount(b); - } - } - - UniStrCpy(tmp, sizeof(tmp), filename); - b2 = NewBuf(); - - WriteBuf(b2, bom, sizeof(bom)); - - // Add a header part - buf_size = CalcUniToUtf8(_UU("CM_ACCOUNT_FILE_BANNER")); - buf = ZeroMalloc(buf_size + 32); - UniToUtf8(buf, buf_size, _UU("CM_ACCOUNT_FILE_BANNER")); - - WriteBuf(b2, buf, StrLen((char *)buf)); - WriteBuf(b2, b->Buf, b->Size); - SeekBuf(b2, 0, 0); - - FreeBuf(b); - - if (DumpBufW(b2, tmp) == false) - { - MsgBox(hWnd, MB_ICONSTOP, _UU("CM_FAILED_TO_SAVE_FILE")); - } - - Free(filename); - FreeBuf(b2); - Free(buf); - } - - CmFreeAccountObject(hWnd, a); -} - -// Main process of importing account -void CmImportAccountMain(HWND hWnd, wchar_t *filename) -{ - CmImportAccountMainEx(hWnd, filename, false); -} -void CmImportAccountMainEx(HWND hWnd, wchar_t *filename, bool overwrite) -{ - wchar_t name[MAX_SIZE]; - wchar_t tmp[MAX_SIZE]; - BUF *b; - RPC_CLIENT_CREATE_ACCOUNT *t; - // Validate arguments - if (hWnd == NULL || filename == NULL) - { - return; - } - - UniStrCpy(tmp, sizeof(tmp), filename); - - b = ReadDumpW(tmp); - if (b == NULL) - { - MsgBox(hWnd, MB_ICONSTOP, _UU("CM_FAILED_TO_OPEN_FILE")); - return; - } - - t = CiCfgToAccount(b); - if (t == NULL) - { - FreeBuf(b); - MsgBox(hWnd, MB_ICONEXCLAMATION, _UU("CM_ACCOUNT_PARSE_FAILED")); - return; - } - - if (overwrite) - { - // If the same name already exists, remove it - if (LvSearchStr(hWnd, L_ACCOUNT, 0, t->ClientOption->AccountName) != INFINITE) - { - RPC_CLIENT_DELETE_ACCOUNT d; - RPC_CLIENT_GET_ACCOUNT get; - HWND h = cm->hEasyWnd == NULL ? hWnd : cm->hEasyWnd; - - Zero(&d, sizeof(d)); - UniStrCpy(d.AccountName, sizeof(d.AccountName), t->ClientOption->AccountName); - - Zero(&get, sizeof(get)); - UniStrCpy(get.AccountName, sizeof(get.AccountName), t->ClientOption->AccountName); - if (CcGetAccount(cm->Client, &get) == ERR_NO_ERROR) - { - // Inherit the information of some of the client option by getting - // the account information of the same name that already exists - if (get.ClientOption != NULL && get.ClientAuth != NULL) - { - CLIENT_OPTION *old_option = get.ClientOption; - CLIENT_AUTH *old_auth = get.ClientAuth; - - // Inherit the connection parameters - t->ClientOption->ProxyType = old_option->ProxyType; - StrCpy(t->ClientOption->ProxyName, sizeof(t->ClientOption->ProxyName), - old_option->ProxyName); - t->ClientOption->ProxyPort = old_option->ProxyPort; - StrCpy(t->ClientOption->ProxyUsername, sizeof(t->ClientOption->ProxyUsername), - old_option->ProxyUsername); - StrCpy(t->ClientOption->ProxyPassword, sizeof(t->ClientOption->ProxyPassword), - old_option->ProxyPassword); - t->ClientOption->NumRetry = old_option->NumRetry; - t->ClientOption->RetryInterval = old_option->RetryInterval; - t->ClientOption->MaxConnection = old_option->MaxConnection; - t->ClientOption->UseEncrypt = old_option->UseEncrypt; - t->ClientOption->UseCompress = old_option->UseCompress; - t->ClientOption->HalfConnection = old_option->HalfConnection; - t->ClientOption->NoRoutingTracking = old_option->NoRoutingTracking; - StrCpy(t->ClientOption->DeviceName, sizeof(t->ClientOption->DeviceName), - old_option->DeviceName); - t->ClientOption->AdditionalConnectionInterval = old_option->AdditionalConnectionInterval; - t->ClientOption->ConnectionDisconnectSpan = old_option->ConnectionDisconnectSpan; - t->ClientOption->HideStatusWindow = old_option->HideStatusWindow; - t->ClientOption->RequireMonitorMode = old_option->RequireMonitorMode; - t->ClientOption->RequireBridgeRoutingMode = old_option->RequireBridgeRoutingMode; - t->ClientOption->DisableQoS = old_option->DisableQoS; - - // Inherit the authentication data - CiFreeClientAuth(t->ClientAuth); - t->ClientAuth = CopyClientAuth(old_auth); - - // Other Settings - t->StartupAccount = get.StartupAccount; - t->CheckServerCert = get.CheckServerCert; - t->RetryOnServerCert = get.RetryOnServerCert; - if (t->ServerCert != NULL) - { - FreeX(t->ServerCert); - } - t->ServerCert = NULL; - if (get.ServerCert != NULL) - { - t->ServerCert = CloneX(get.ServerCert); - } - Copy(t->ShortcutKey, get.ShortcutKey, sizeof(t->ShortcutKey)); - } - - CiFreeClientGetAccount(&get); - } - - if (CALL(h, CcDeleteAccount(cm->Client, &d)) == false) - { - CiFreeClientCreateAccount(t); - Free(t); - return; - } - - CmRefreshAccountList(hWnd); - } - } - - CmGenerateImportName(hWnd, name, sizeof(name), t->ClientOption->AccountName); - UniStrCpy(t->ClientOption->AccountName, sizeof(t->ClientOption->AccountName), name); - - if (overwrite) - { - t->ClientOption->FromAdminPack = true; - } - - CALL(hWnd, CcCreateAccount(cm->Client, t)); - - CiFreeClientCreateAccount(t); - Free(t); - - FreeBuf(b); - - if (overwrite) - { - // Start to connect the VPN - CmConnect(hWnd, name); - } - - //MsgBoxEx(hWnd, MB_ICONINFORMATION, _UU("CM_IMPORT_MESSAGE"), filename, name); -} - -// Import an account -void CmImportAccount(HWND hWnd) -{ - wchar_t *filename; - wchar_t tmp[MAX_SIZE]; - // Validate arguments - if (hWnd == NULL) - { - return; - } - - // Open the file - filename = OpenDlg(hWnd, _UU("CM_ACCOUNT_SETTING_FILE"), _UU("CM_ACCOUNT_OPEN_TITLE")); - if (filename == NULL) - { - return; - } - - UniStrCpy(tmp, sizeof(tmp), filename); - Free(filename); - - CmImportAccountMain(hWnd, tmp); -} - -// Create a copy of the account -void CmCopyAccount(HWND hWnd, wchar_t *account_name) -{ - wchar_t tmp[MAX_SIZE]; - CM_ACCOUNT *a; - RPC_CLIENT_CREATE_ACCOUNT c; - // Validate arguments - if (hWnd == NULL || account_name == NULL) - { - return; - } - - CmGenerateCopyName(hWnd, tmp, sizeof(tmp), account_name); - - // Get an account information - a = CmGetExistAccountObject(hWnd, account_name); - if (a == NULL) - { - return; - } - - // Change the account name - UniStrCpy(a->ClientOption->AccountName, sizeof(a->ClientOption->AccountName), tmp); - - // Write - Zero(&c, sizeof(c)); - c.ClientOption = ZeroMalloc(sizeof(CLIENT_OPTION)); - Copy(c.ClientOption, a->ClientOption, sizeof(CLIENT_OPTION)); - c.ClientAuth = CopyClientAuth(a->ClientAuth); - if (a->ServerCert) - { - c.ServerCert = CloneX(a->ServerCert); - } - c.CheckServerCert = a->CheckServerCert; - c.RetryOnServerCert = a->RetryOnServerCert; - c.StartupAccount = false; // Don't copy the startup attribute - - CALL(hWnd, CcCreateAccount(cm->Client, &c)); - CiFreeClientCreateAccount(&c); - - CmFreeAccountObject(hWnd, a); -} - -// Update the Virtual LAN Card Name dialog -void CmNewVLanDlgUpdate(HWND hWnd) -{ - bool ok = true; - char tmp[MAX_SIZE]; - // Validate arguments - if (hWnd == NULL) - { - return; - } - - GetTxtA(hWnd, E_NAME, tmp, sizeof(tmp)); - if (IsSafeStr(tmp) == false) - { - ok = false; - } - if (SearchStrEx(tmp, " ", 0, false) != INFINITE) - { - ok = false; - } - - Trim(tmp); - if (StrLen(tmp) == 0) - { - ok = false; - } - - SetEnable(hWnd, IDOK, ok); -} - -// Virtual LAN card name decision dialog procedure -UINT CmNewVLanDlgProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param) -{ - char *tmp = (char *)param; - char default_name[MAX_SIZE]; - RPC_CLIENT_VERSION ver; - // Validate arguments - if (hWnd == NULL) - { - return 0; - } - - switch (msg) - { - case WM_INITDIALOG: - LimitText(hWnd, E_NAME, cm->Client->Win9x ? MAX_DEVICE_NAME_LEN_9X : MAX_DEVICE_NAME_LEN); - FormatText(hWnd, S_INFO, cm->Client->Win9x ? MAX_DEVICE_NAME_LEN_9X : MAX_DEVICE_NAME_LEN); - - Zero(&ver, sizeof(ver)); - - if (CcGetClientVersion(cm->Client, &ver) == ERR_NO_ERROR) - { - if (ver.IsVLanNameRegulated) - { - Show(hWnd, S_WIN8); - } - } - - if (CiGetNextRecommendedVLanName(cm->Client, default_name, sizeof(default_name))) - { - // Show a default virtual LAN card name candidate - SetTextA(hWnd, E_NAME, default_name); - } - - CmNewVLanDlgUpdate(hWnd); - break; - - case WM_COMMAND: - switch (wParam) - { - case IDOK: - if (cm->Client->Win9x) - { - // For Windows 9x, show a confirmation message - if (MsgBox(hWnd, MB_ICONQUESTION | MB_OKCANCEL, _UU("CM_9X_VLAN_INSTALL")) == IDCANCEL) - { - break; - } - } - GetTxtA(hWnd, E_NAME, tmp, (cm->Client->Win9x ? MAX_DEVICE_NAME_LEN_9X : MAX_DEVICE_NAME_LEN) + 1); - Trim(tmp); - - if (CcGetClientVersion(cm->Client, &ver) == ERR_NO_ERROR) - { - if (ver.IsVLanNameRegulated) - { - if (CiIsValidVLanRegulatedName(tmp) == false) - { - // Virtual LAN card name isn't meeting the format - MsgBox(hWnd, MB_ICONEXCLAMATION, _UU("D_CM_NEW_VLAN@S_WIN8")); - - FocusEx(hWnd, E_NAME); - break; - } - } - } - - EndDialog(hWnd, true); - break; - case IDCANCEL: - Close(hWnd); - break; - } - switch (LOWORD(wParam)) - { - case E_NAME: - CmNewVLanDlgUpdate(hWnd); - break; - - case R_USE_DISCONNECT: - if (IsChecked(hWnd, R_USE_DISCONNECT)) - { - FocusEx(hWnd, E_DISCONNECT_SPAN); - } - break; - } - break; - - case WM_CLOSE: - EndDialog(hWnd, false); - break; - } - - return 0; -} - -// Dialog to determine the new virtual LAN card name -char *CmNewVLanDlg(HWND hWnd) -{ - char tmp[MAX_DEVICE_NAME_LEN + 1]; - - if (Dialog(hWnd, D_CM_NEW_VLAN, CmNewVLanDlgProc, tmp) == false) - { - return NULL; - } - - return CopyStr(tmp); -} - -// Update the advanced settings dialog -void CmDetailDlgUpdate(HWND hWnd, CM_ACCOUNT *a) -{ - bool ok = true; - bool locked; - // Validate arguments - if (hWnd == NULL || a == NULL) - { - return; - } - - locked = a->LockMode; - - if (a->LinkMode || a->NatMode) - { - Disable(hWnd, R_NO_ROUTING); - } - else - { - if (cm->Client->Unix) - { - Disable(hWnd, R_NO_ROUTING); - } - } - - SetEnable(hWnd, E_DISCONNECT_SPAN, IsChecked(hWnd, R_USE_DISCONNECT)); - - SetEnable(hWnd, IDOK, ok); - - if (locked) - { - Disable(hWnd, C_NUM_TCP); - Disable(hWnd, S_STATIC5); - Disable(hWnd, S_STATIC8); - Disable(hWnd, E_INTERVAL); - Disable(hWnd, S_STATIC9); - Disable(hWnd, E_DISCONNECT_SPAN); - Disable(hWnd, S_STATIC10); - Disable(hWnd, S_STATIC11); - Disable(hWnd, R_USE_DISCONNECT); - Disable(hWnd, R_USE_HALF_CONNECTION); - Disable(hWnd, R_DISABLE_QOS); - Disable(hWnd, R_USE_ENCRYPT); - Disable(hWnd, R_USE_COMPRESS); - Disable(hWnd, R_BRIDGE); - Disable(hWnd, R_MONITOR); - Disable(hWnd, R_NO_ROUTING); - } -} - -// Advanced Settings dialog procedure -UINT CmDetailDlgProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param) -{ - CM_ACCOUNT *a = (CM_ACCOUNT *)param; - UINT i; - UINT num; - wchar_t tmp[MAX_SIZE]; - // Validate arguments - if (hWnd == NULL) - { - return 0; - } - - switch (msg) - { - case WM_INITDIALOG: - // Number of TCP connections - for (i = 1;i <= MAX_TCP_CONNECTION;i++) - { - UniFormat(tmp, sizeof(tmp), L"%u", i); - CbAddStr(hWnd, C_NUM_TCP, tmp, i); - } - CbSelect(hWnd, C_NUM_TCP, a->ClientOption->MaxConnection); - - // Connection establishment interval - SetInt(hWnd, E_INTERVAL, a->ClientOption->AdditionalConnectionInterval); - - // Lifetime - SetIntEx(hWnd, E_DISCONNECT_SPAN, a->ClientOption->ConnectionDisconnectSpan); - Check(hWnd, R_USE_DISCONNECT, a->ClientOption->ConnectionDisconnectSpan != 0); - Check(hWnd, R_USE_HALF_CONNECTION, a->ClientOption->HalfConnection); - Check(hWnd, R_USE_ENCRYPT, a->ClientOption->UseEncrypt); - Check(hWnd, R_USE_COMPRESS, a->ClientOption->UseCompress); - Check(hWnd, R_NO_ROUTING, a->ClientOption->NoRoutingTracking); - Check(hWnd, R_DISABLE_QOS, a->ClientOption->DisableQoS); - Check(hWnd, R_DISABLE_UDP, a->ClientOption->NoUdpAcceleration); - - // Select the Connection Mode - if (a->LinkMode == false) - { - Check(hWnd, R_BRIDGE, a->ClientOption->RequireBridgeRoutingMode); - Check(hWnd, R_MONITOR, a->ClientOption->RequireMonitorMode); - } - else - { - Check(hWnd, R_BRIDGE, true); - Check(hWnd, R_MONITOR, false); - - SetText(hWnd, S_MODE, _UU("CM_DETAIL_MODE_LINK_STR")); - Disable(hWnd, R_BRIDGE); - Disable(hWnd, R_MONITOR); - } - - CmDetailDlgUpdate(hWnd, a); - Focus(hWnd, IDOK); - break; - case WM_COMMAND: - switch (wParam) - { - case IDOK: - if (IsChecked(hWnd, R_USE_DISCONNECT) && GetInt(hWnd, E_DISCONNECT_SPAN) == 0) - { - MsgBox(hWnd, MB_ICONINFORMATION, _UU("CM_NO_DISCONNECT_SPAN")); - FocusEx(hWnd, E_DISCONNECT_SPAN); - break; - } - num = GetInt(hWnd, C_NUM_TCP); - if (num == 0) - { - break; - } - if (num == 1 && IsChecked(hWnd, R_USE_HALF_CONNECTION)) - { - MsgBox(hWnd, MB_ICONINFORMATION, _UU("CM_HALF_MSG")); - Focus(hWnd, C_NUM_TCP); - break; - } - if (GetInt(hWnd, E_INTERVAL) < 1) - { - MsgBox(hWnd, MB_ICONINFORMATION, _UU("CM_TOO_SMALL_INTERVAL")); - Focus(hWnd, E_INTERVAL); - break; - } - - a->ClientOption->MaxConnection = num; - a->ClientOption->AdditionalConnectionInterval = GetInt(hWnd, E_INTERVAL); - if (IsChecked(hWnd, R_USE_DISCONNECT) == false) - { - a->ClientOption->ConnectionDisconnectSpan = 0; - } - else - { - a->ClientOption->ConnectionDisconnectSpan = GetInt(hWnd, E_DISCONNECT_SPAN); - } - a->ClientOption->HalfConnection = IsChecked(hWnd, R_USE_HALF_CONNECTION); - a->ClientOption->UseEncrypt = IsChecked(hWnd, R_USE_ENCRYPT); - a->ClientOption->UseCompress = IsChecked(hWnd, R_USE_COMPRESS); - a->ClientOption->NoRoutingTracking = IsChecked(hWnd, R_NO_ROUTING); - a->ClientOption->DisableQoS = IsChecked(hWnd, R_DISABLE_QOS); - a->ClientOption->NoUdpAcceleration = IsChecked(hWnd, R_DISABLE_UDP); - - if (a->LinkMode) - { - a->ClientOption->RequireBridgeRoutingMode = true; - a->ClientOption->RequireMonitorMode = false; - } - else - { - a->ClientOption->RequireBridgeRoutingMode = IsChecked(hWnd, R_BRIDGE); - a->ClientOption->RequireMonitorMode = IsChecked(hWnd, R_MONITOR); - } - - EndDialog(hWnd, true); - - break; - case IDCANCEL: - Close(hWnd); - break; - } - switch (LOWORD(wParam)) - { - case C_NUM_TCP: - case E_INTERVAL: - case E_DISCONNECT_SPAN: - case R_USE_DISCONNECT: - case R_USE_HALF_CONNECTION: - CmDetailDlgUpdate(hWnd, a); - break; - } - switch (wParam) - { - case R_USE_DISCONNECT: - if (IsChecked(hWnd, R_USE_DISCONNECT)) - { - FocusEx(hWnd, E_DISCONNECT_SPAN); - } - break; - } - break; - case WM_CLOSE: - EndDialog(hWnd, false); - break; - } - - return 0; -} - -// Advanced Settings dialog -bool CmDetailDlg(HWND hWnd, CM_ACCOUNT *a) -{ - // Validate arguments - if (hWnd == NULL || a == NULL) - { - return false; - } - - return Dialog(hWnd, D_CM_DETAIL, CmDetailDlgProc, a); -} - -// Update the account editing dialog procedure -void CmEditAccountDlgUpdate(HWND hWnd, CM_ACCOUNT *a) -{ - bool ok = true; - char str[MAX_SIZE]; - bool locked; - // Validate arguments - if (hWnd == NULL || a == NULL) - { - return; - } - - locked = a->LockMode; - - if (a->Inited == false) - { - return; - } - - if (a->EditMode) - { - Disable(hWnd, E_ACCOUNT_NAME); - } - - // The name of connection settings - GetTxt(hWnd, E_ACCOUNT_NAME, a->ClientOption->AccountName, sizeof(a->ClientOption->AccountName)); - UniTrim(a->ClientOption->AccountName); - - // Host name - GetTxtA(hWnd, E_HOSTNAME, a->ClientOption->Hostname, sizeof(a->ClientOption->Hostname)); - Trim(a->ClientOption->Hostname); - - if (InStr(a->ClientOption->Hostname, "/tcp")) - { - Check(hWnd, R_DISABLE_NATT, true); - } - else - { - Check(hWnd, R_DISABLE_NATT, false); - } - - SetEnable(hWnd, R_DISABLE_NATT, !IsEmptyStr(a->ClientOption->Hostname)); - - // Port number - a->ClientOption->Port = GetInt(hWnd, C_PORT); - - // HUB name - GetTxtA(hWnd,C_HUBNAME, a->ClientOption->HubName, sizeof(a->ClientOption->HubName)); - - // Type of proxy - a->ClientOption->ProxyType = PROXY_DIRECT; - if (IsChecked(hWnd, R_HTTPS)) - { - a->ClientOption->ProxyType = PROXY_HTTP; - } - if (IsChecked(hWnd, R_SOCKS)) - { - a->ClientOption->ProxyType = PROXY_SOCKS; - } - if (IsChecked(hWnd, R_SOCKS5)) - { - a->ClientOption->ProxyType = PROXY_SOCKS5; - } - - // To validate the server certificate - a->CheckServerCert = IsChecked(hWnd, R_CHECK_CERT); - - if (a->NatMode) - { - Disable(hWnd, R_CHECK_CERT); - Disable(hWnd, B_TRUST); - } - - if (a->HideTrustCert) - { - Disable(hWnd, B_TRUST); - } - - // Device name - StrCpy(a->ClientOption->DeviceName, sizeof(a->ClientOption->DeviceName), ""); - if (LvIsSelected(hWnd, L_VLAN)) - { - wchar_t *s = LvGetStr(hWnd, L_VLAN, LvGetSelected(hWnd, L_VLAN), 0); - if (s != NULL) - { - char str[MAX_SIZE]; - UniToStr(str, sizeof(str), s); - CmPrintNameToVLanName(a->ClientOption->DeviceName, sizeof(a->ClientOption->DeviceName), str); - Free(s); - } - } - - // User authentication - a->ClientAuth->AuthType = CbGetSelect(hWnd, C_TYPE); - GetTxtA(hWnd, E_USERNAME, a->ClientAuth->Username, sizeof(a->ClientAuth->Username)); - Trim(a->ClientAuth->Username); - switch (a->ClientAuth->AuthType) - { - case CLIENT_AUTHTYPE_PASSWORD: - // Password authentication - GetTxtA(hWnd, E_PASSWORD, str, sizeof(str)); - if (StrCmp(str, HIDDEN_PASSWORD) != 0) - { - HashPassword(a->ClientAuth->HashedPassword, a->ClientAuth->Username, str); - } - break; - case CLIENT_AUTHTYPE_PLAIN_PASSWORD: - // Plaintext password authentication - GetTxtA(hWnd, E_PASSWORD, str, sizeof(str)); - if (StrCmp(str, HIDDEN_PASSWORD) != 0) - { - StrCpy(a->ClientAuth->PlainPassword, sizeof(a->ClientAuth->PlainPassword), str); - } - break; - } - - // Reconnection option - if ((a->LinkMode || a->NatMode) || a->ClientAuth->AuthType == CLIENT_AUTHTYPE_SECURE) - { - Disable(hWnd, R_RETRY); - } - else - { - Enable(hWnd, R_RETRY); - } - - if (IsChecked(hWnd, R_RETRY) == false) - { - a->ClientOption->NumRetry = 0; - } - else - { - if (IsChecked(hWnd, R_INFINITE)) - { - a->ClientOption->NumRetry = INFINITE; - } - else - { - a->ClientOption->NumRetry = GetInt(hWnd, E_RETRY_NUM); - } - } - a->ClientOption->RetryInterval = GetInt(hWnd, E_RETRY_SPAN); - - // Information determining - if (UniStrLen(a->ClientOption->AccountName) == 0 && a->NatMode == false) - { - ok = false; - } - if (StrLen(a->ClientOption->Hostname) == 0) - { - ok = false; - } - if (a->ClientOption->Port == 0 || a->ClientOption->Port >= 65536) - { - ok = false; - } - if (StrLen(a->ClientOption->HubName) == 0) - { - ok = false; - } - if (StrLen(a->ClientAuth->Username) == 0) - { - ok = false; - } - if (a->ClientAuth->AuthType == CLIENT_AUTHTYPE_CERT) - { - if (a->ClientAuth->ClientK == NULL || a->ClientAuth->ClientX == NULL) - { - ok = false; - } - } - if (a->ClientAuth->AuthType == CLIENT_AUTHTYPE_SECURE) - { - if (IsEmptyStr(a->ClientAuth->SecurePrivateKeyName) || IsEmptyStr(a->ClientAuth->SecurePublicCertName)) - { - ok = false; - } - } - - // Display update - if (IsChecked(hWnd, R_RETRY) && IsEnable(hWnd, R_RETRY)) - { - if (a->LinkMode == false && a->NatMode == false) - { - Enable(hWnd, R_INFINITE); - Enable(hWnd, E_RETRY_SPAN); - Enable(hWnd, S_RETRY_SPAN_1); - Enable(hWnd, S_RETRY_SPAN_2); - } - else - { - Disable(hWnd, R_INFINITE); - Disable(hWnd, E_RETRY_SPAN); - Disable(hWnd, S_RETRY_SPAN_1); - Disable(hWnd, S_RETRY_SPAN_2); - } - if (IsChecked(hWnd, R_INFINITE) == false) - { - Enable(hWnd, E_RETRY_NUM); - Enable(hWnd, S_RETRY_NUM_1); - Enable(hWnd, S_RETRY_NUM_2); - if (GetInt(hWnd, E_RETRY_NUM) == 0) - { - ok = false; - } - } - else - { - Disable(hWnd, E_RETRY_NUM); - Disable(hWnd, S_RETRY_NUM_1); - Disable(hWnd, S_RETRY_NUM_2); - } - } - else - { - Disable(hWnd, E_RETRY_NUM); - Disable(hWnd, E_RETRY_SPAN); - Disable(hWnd, R_INFINITE); - Disable(hWnd, S_RETRY_NUM_1); - Disable(hWnd, S_RETRY_NUM_2); - Disable(hWnd, S_RETRY_SPAN_1); - Disable(hWnd, S_RETRY_SPAN_2); - } - - if (a->NatMode == false) - { - if (a->ServerCert == NULL) - { - SetText(hWnd, B_SERVER_CERT, _UU("CM_SERVER_CERT_1")); - Disable(hWnd, B_VIEW_SERVER_CERT); - } - else - { - SetText(hWnd, B_SERVER_CERT, _UU("CM_SERVER_CERT_2")); - Enable(hWnd, B_VIEW_SERVER_CERT); - } - } - else - { - Disable(hWnd, B_VIEW_SERVER_CERT); - Disable(hWnd, B_SERVER_CERT); - } - - if (a->ClientAuth->AuthType == CLIENT_AUTHTYPE_CERT || a->ClientAuth->AuthType == CLIENT_AUTHTYPE_SECURE) - { - wchar_t tmp[MAX_SIZE * 2]; - wchar_t issuer[MAX_SIZE]; - wchar_t subject[MAX_SIZE]; - wchar_t expires[MAX_SIZE]; - - SetIcon(hWnd, S_CERT, (a->ClientAuth->AuthType == CLIENT_AUTHTYPE_CERT) ? ICO_CERT : ICO_SECURE); - - Hide(hWnd, S_PASSWORD); - Hide(hWnd, E_PASSWORD); - if (a->ClientAuth->AuthType == CLIENT_AUTHTYPE_CERT) - { - if (a->ClientAuth->ClientX != NULL) - { - Enable(hWnd, B_VIEW_CLIENT_CERT); - SetText(hWnd, B_REGIST_CLIENT_CERT, _UU("CM_CLIENT_CERT_2")); - GetPrintNameFromName(issuer, sizeof(issuer), a->ClientAuth->ClientX->issuer_name); - GetPrintNameFromName(subject, sizeof(subject), a->ClientAuth->ClientX->subject_name); - GetDateStrEx64(expires, sizeof(expires), SystemToLocal64(a->ClientAuth->ClientX->notAfter), NULL); - UniFormat(tmp, sizeof(tmp), _UU("CM_CERT_INFO"), subject, issuer, expires); - } - else - { - Disable(hWnd, B_VIEW_CLIENT_CERT); - SetText(hWnd, B_REGIST_CLIENT_CERT, _UU("CM_CLIENT_CERT_1")); - UniStrCpy(tmp, sizeof(tmp), _UU("CM_NO_CERT")); - } - SetText(hWnd, B_VIEW_CLIENT_CERT, _UU("CM_VIEW_CLIENT_CERT")); - - Enable(hWnd, B_REGIST_CLIENT_CERT); - } - else - { - if (IsEmptyStr(a->ClientAuth->SecurePrivateKeyName) || IsEmptyStr(a->ClientAuth->SecurePublicCertName)) - { - UniStrCpy(tmp, sizeof(tmp), _UU("CM_NO_SECURE")); - } - else - { - UniFormat(tmp, sizeof(tmp), _UU("CM_CERT_SECURE_INFO"), - a->ClientAuth->SecurePublicCertName, a->ClientAuth->SecurePrivateKeyName); - } - - SetText(hWnd, B_VIEW_CLIENT_CERT, _UU("CM_SELECT_SECURE_DEVICE")); - SetText(hWnd, B_REGIST_CLIENT_CERT, _UU("CM_SELECT_CERT_INCARD")); - Enable(hWnd, B_VIEW_CLIENT_CERT); - - if (SmGetCurrentSecureIdFromReg() == 0) - { - Disable(hWnd, B_REGIST_CLIENT_CERT); - } - else - { - Enable(hWnd, B_REGIST_CLIENT_CERT); - } - } - SetText(hWnd, S_CERT_INFO, tmp); - Show(hWnd, S_CERT); - Show(hWnd, S_CERT_INFO); - Show(hWnd, B_VIEW_CLIENT_CERT); - Show(hWnd, B_REGIST_CLIENT_CERT); - } - else - { - if (a->ClientAuth->AuthType == CLIENT_AUTHTYPE_ANONYMOUS) - { - Hide(hWnd, S_PASSWORD); - Hide(hWnd, E_PASSWORD); - } - else - { - Show(hWnd, S_PASSWORD); - Show(hWnd, E_PASSWORD); - } - Hide(hWnd, S_CERT); - Hide(hWnd, S_CERT_INFO); - Hide(hWnd, B_VIEW_CLIENT_CERT); - Hide(hWnd, B_REGIST_CLIENT_CERT); - } - - if (a->ClientOption->ProxyType != PROXY_DIRECT) - { - Enable(hWnd, B_PROXY_CONFIG); - if (StrLen(a->ClientOption->ProxyName) == 0) - { - ok = false; - } - if (a->ClientOption->ProxyPort == 0) - { - ok = false; - } - } - else - { - Disable(hWnd, B_PROXY_CONFIG); - } - - if (a->ClientAuth->AuthType == CLIENT_AUTHTYPE_PASSWORD) - { - bool b = true; - - if (ok == false) - { - b = false; - } - - if (a->LinkMode == false && a->NatMode == false) - { - SetEnable(hWnd, B_CHANGE_PASSWORD, b); - SetEnable(hWnd, S_CHANGE_PASSWORD, b); - Show(hWnd, B_CHANGE_PASSWORD); - Show(hWnd, S_CHANGE_PASSWORD); - } - else - { - Hide(hWnd, B_CHANGE_PASSWORD); - Hide(hWnd, S_CHANGE_PASSWORD); - } - } - else - { - Hide(hWnd, B_CHANGE_PASSWORD); - Hide(hWnd, S_CHANGE_PASSWORD); - } - - if ((StrLen(a->ClientOption->DeviceName) == 0) && (a->LinkMode == false && a->NatMode == false)) - { - ok = false; - } - - if (a->LinkMode || a->NatMode) - { - Disable(hWnd, L_VLAN); - } - - if (a->EditMode == false) - { - char tmp[MAX_SIZE]; - GetTxtA(hWnd, E_HOSTNAME, tmp, sizeof(tmp)); - Trim(tmp); - - if (StartWith(tmp, "127.") || (StrCmpi(tmp, "localhost") == 0)) - { - if (a->Flag1 == false) - { - a->Flag1 = true; - a->ClientOption->UseEncrypt = a->ClientOption->UseCompress = false; - a->ClientOption->MaxConnection = 1; - } - } - } - - a->ClientOption->HideStatusWindow = IsChecked(hWnd, R_HIDE); - a->ClientOption->HideNicInfoWindow = IsChecked(hWnd, R_HIDE2); - - if (locked) - { - SetEnable(hWnd, E_HOSTNAME, false); - SetEnable(hWnd, C_PORT, false); - SetEnable(hWnd, C_HUBNAME, false); - SetEnable(hWnd, S_STATIC2, false); - SetEnable(hWnd, S_STATIC3, false); - SetEnable(hWnd, S_STATIC4, false); - SetEnable(hWnd, S_STATIC5, false); - SetEnable(hWnd, S_STATIC66, false); - SetEnable(hWnd, S_STATIC7, false); - SetEnable(hWnd, S_STATIC11, false); - SetEnable(hWnd, R_CHECK_CERT, false); - SetEnable(hWnd, B_TRUST, false); - SetEnable(hWnd, B_SERVER_CERT, false); - SetEnable(hWnd, B_VIEW_SERVER_CERT, false); - SetEnable(hWnd, R_RETRY, false); - SetEnable(hWnd, S_RETRY_NUM_1, false); - SetEnable(hWnd, E_RETRY_NUM, false); - SetEnable(hWnd, S_RETRY_NUM_2, false); - SetEnable(hWnd, S_RETRY_SPAN_1, false); - SetEnable(hWnd, E_RETRY_SPAN, false); - SetEnable(hWnd, S_RETRY_SPAN_2, false); - SetEnable(hWnd, R_INFINITE, false); - } - - SetEnable(hWnd, IDOK, ok); -} - -// Initialize the account editing dialog -void CmEditAccountDlgInit(HWND hWnd, CM_ACCOUNT *a) -{ - RPC_CLIENT_ENUM_VLAN v; - UINT i; - // Validate arguments - if (hWnd == NULL || a == NULL) - { - return; - } - - if (a->LockMode) - { - SetText(hWnd, S_STATIC1, _UU("CM_EASY_ACCOUNT_WARNING")); - } - - // Connection settings name - if (a->EditMode || a->NatMode) - { - Disable(hWnd, E_ACCOUNT_NAME); - } - - if (a->NatMode || a->LinkMode) - { - Hide(hWnd, R_HIDE); - Hide(hWnd, R_HIDE2); - } - - Check(hWnd, R_HIDE, a->ClientOption->HideStatusWindow); - Check(hWnd, R_HIDE2, a->ClientOption->HideNicInfoWindow); - - if (a->NatMode) - { - Hide(hWnd, E_ACCOUNT_NAME); - Hide(hWnd, S_ACCOUNT_NAME); - } - - if ((cm != NULL && cm->server_name != NULL) || a->LinkMode) - { - Hide(hWnd, B_IE); - } - - SetText(hWnd, E_ACCOUNT_NAME, a->ClientOption->AccountName); - - // Host name - SetTextA(hWnd, E_HOSTNAME, a->ClientOption->Hostname); - StrCpy(a->old_server_name, sizeof(a->old_server_name), a->ClientOption->Hostname); - - if (InStr(a->ClientOption->Hostname, "/tcp")) - { - Check(hWnd, R_DISABLE_NATT, true); - } - else - { - Check(hWnd, R_DISABLE_NATT, false); - } - - // Port number - CbSetHeight(hWnd, C_PORT, 18); - CbAddStr(hWnd, C_PORT, _UU("CM_PORT_1"), 0); - CbAddStr(hWnd, C_PORT, _UU("CM_PORT_2"), 0); - CbAddStr(hWnd, C_PORT, _UU("CM_PORT_3"), 0); - CbAddStr(hWnd, C_PORT, _UU("CM_PORT_4"), 0); - SetInt(hWnd, C_PORT, a->ClientOption->Port); - - // Virtual HUB name - CbSetHeight(hWnd, C_HUBNAME, 18); - SetTextA(hWnd, C_HUBNAME, a->ClientOption->HubName); - - // Type of proxy - Check(hWnd, R_DIRECT_TCP, a->ClientOption->ProxyType == PROXY_DIRECT); - Check(hWnd, R_HTTPS, a->ClientOption->ProxyType == PROXY_HTTP); - Check(hWnd, R_SOCKS, a->ClientOption->ProxyType == PROXY_SOCKS); - Check(hWnd, R_SOCKS5, a->ClientOption->ProxyType == PROXY_SOCKS5); - - // Verify the server certificate - Check(hWnd, R_CHECK_CERT, a->CheckServerCert); - - // LAN card list - if (a->NatMode == false && a->LinkMode == false) - { - Zero(&v, sizeof(v)); - CcEnumVLan(cm->Client, &v); - LvInit(hWnd, L_VLAN); - LvInsertColumn(hWnd, L_VLAN, 0, L"DeviceName", 345); - for (i = 0;i < v.NumItem;i++) - { - wchar_t tmp[MAX_SIZE]; - char str[MAX_SIZE]; - CmVLanNameToPrintName(str, sizeof(str), v.Items[i]->DeviceName); - StrToUni(tmp, sizeof(tmp), str); - LvInsert(hWnd, L_VLAN, ICO_NIC_ONLINE, NULL, 1, tmp); - } -// LvAutoSize(hWnd, L_VLAN); - - if (v.NumItem == 1) - { - // If only one virtual LAN card exists, initially select it - LvSelect(hWnd, L_VLAN, 0); - } - - CiFreeClientEnumVLan(&v); - } - - // Select the LAN card - if (StrLen(a->ClientOption->DeviceName) != 0) - { - char str[MAX_SIZE]; - wchar_t tmp[MAX_SIZE]; - UINT index; - CmVLanNameToPrintName(str, sizeof(str), a->ClientOption->DeviceName); - StrToUni(tmp, sizeof(tmp), str); - index = LvSearchStr(hWnd, L_VLAN, 0, tmp); - if (index != INFINITE) - { - LvSelect(hWnd, L_VLAN, index); - } - } - - // Authentication type - CbSetHeight(hWnd, C_TYPE, 18); - CbAddStr(hWnd, C_TYPE, _UU("PW_TYPE_0"), CLIENT_AUTHTYPE_ANONYMOUS); - CbAddStr(hWnd, C_TYPE, _UU("PW_TYPE_1"), CLIENT_AUTHTYPE_PASSWORD); - CbAddStr(hWnd, C_TYPE, _UU("PW_TYPE_2"), CLIENT_AUTHTYPE_PLAIN_PASSWORD); - - if (a->HideClientCertAuth == false) - { - // Certificate authentication is not available when HideClientCertAuth is true - CbAddStr(hWnd, C_TYPE, _UU("PW_TYPE_3"), CLIENT_AUTHTYPE_CERT); - } - - if (a->HideSecureAuth == false) - { - // Authentication using a smart card - CbAddStr(hWnd, C_TYPE, _UU("PW_TYPE_4"), CLIENT_AUTHTYPE_SECURE); - } - - // Select an authentication - CbSelect(hWnd, C_TYPE, a->ClientAuth->AuthType); - - // User name - SetTextA(hWnd, E_USERNAME, a->ClientAuth->Username); - - // Password - if (a->EditMode) - { - SetTextA(hWnd, E_PASSWORD, HIDDEN_PASSWORD); - } - - // Reconnection times - if (a->ClientOption->NumRetry == 0) - { - Check(hWnd, R_RETRY, false); - } - else - { - Check(hWnd, R_RETRY, true); - if (a->ClientOption->NumRetry == INFINITE) - { - Check(hWnd, R_INFINITE, true); - } - else - { - Check(hWnd, R_INFINITE, false); - SetInt(hWnd, E_RETRY_NUM, a->ClientOption->NumRetry); - } - } - SetIntEx(hWnd, E_RETRY_SPAN, a->ClientOption->RetryInterval); - - // Title - if (a->NatMode == false) - { - if (a->EditMode == false) - { - SetText(hWnd, 0, _UU("CM_ACCOUNT_TITLE_1")); - FocusEx(hWnd, E_ACCOUNT_NAME); - } - else - { - SetText(hWnd, 0, _UU("CM_ACCOUNT_TITLE_2")); - FormatText(hWnd, 0, a->ClientOption->AccountName); - FocusEx(hWnd, E_HOSTNAME); - } - } - else - { - SetText(hWnd, 0, _UU("NM_ACCOUNT_TITLE")); - FocusEx(hWnd, E_HOSTNAME); - } - - if (a->LinkMode || a->NatMode) - { - Hide(hWnd, L_VLAN); - - if (a->NatMode == false) - { - SetText(hWnd, S_VLAN_GROUP, _UU("SM_LINK_POLICY_GROUP")); - Show(hWnd, S_POLICY_1); - Show(hWnd, S_POLICY_2); - Show(hWnd, B_POLICY); - } - else - { - Hide(hWnd, S_VLAN_GROUP); - Show(hWnd, S_ROUTER_LOGO); - } - } - - // Display update - a->Inited = true; - CmEditAccountDlgUpdate(hWnd, a); -} - -// Account editing dialog procedure -UINT CmEditAccountDlgProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param) -{ - CM_ACCOUNT *a = (CM_ACCOUNT *)param; - NMHDR *n; - X *x; - K *k; - char tmp[MAX_PATH]; - bool no_update_natt_check = false; - // Validate arguments - if (hWnd == NULL) - { - return 0; - } - - switch (msg) - { - case WM_INITDIALOG: - CmEditAccountDlgInit(hWnd, a); - if (a->EditMode == false && a->LinkMode == false && a->NatMode == false) - { - SetTimer(hWnd, 1, 100, NULL); - } - break; - case WM_TIMER: - switch (wParam) - { - case 1: - { - CM_INTERNET_SETTING s; - - KillTimer(hWnd, 1); - - Zero(&s, sizeof(s)); - CmGetSystemInternetSetting(&s); - - if (s.ProxyType != PROXY_DIRECT) - { - if (MsgBoxEx(hWnd, MB_ICONQUESTION | MB_YESNO, - _UU("CM_WOULDYOULOAD_IE_PROXY"), - s.ProxyHostName) == IDYES) - { - Command(hWnd, B_IE); - } - } - } - break; - } - break; - case WM_COMMAND: - switch (wParam) - { - case R_DISABLE_NATT: - Zero(tmp, sizeof(tmp)); - GetTxtA(hWnd, E_HOSTNAME, tmp, sizeof(tmp)); - - if (IsChecked(hWnd, R_DISABLE_NATT)) - { - if (InStr(tmp, "/tcp") == false) - { - Trim(tmp); - - StrCat(tmp, sizeof(tmp), "/tcp"); - - SetTextA(hWnd, E_HOSTNAME, tmp); - } - } - else - { - if (InStr(tmp, "/tcp")) - { - UINT i = SearchStrEx(tmp, "/tcp", 0, false); - - if (i != INFINITE) - { - tmp[i] = 0; - - Trim(tmp); - - SetTextA(hWnd, E_HOSTNAME, tmp); - } - } - } - - CmEditAccountDlgStartEnumHub(hWnd, a); - break; - } - switch (LOWORD(wParam)) - { - case E_ACCOUNT_NAME: - case E_HOSTNAME: - case C_PORT: - case C_HUBNAME: - case R_DIRECT_TCP: - case R_HTTPS: - case R_SOCKS: - case R_CHECK_CERT: - case C_TYPE: - case E_USERNAME: - case E_PASSWORD: - case R_RETRY: - case E_RETRY_NUM: - case E_RETRY_SPAN: - case R_INFINITE: - CmEditAccountDlgUpdate(hWnd, a); - break; - } - switch (HIWORD(wParam)) - { - case EN_KILLFOCUS: - switch (LOWORD(wParam)) - { - case E_HOSTNAME: - CmEditAccountDlgStartEnumHub(hWnd, a); - break; - } - break; - case BN_KILLFOCUS: - switch (LOWORD(wParam)) - { - case R_DIRECT_TCP: - case R_HTTPS: - case R_SOCKS: - CmEditAccountDlgStartEnumHub(hWnd, a); - break; - } - break; - case CBN_KILLFOCUS: - switch (LOWORD(wParam)) - { - case C_PORT: - CmEditAccountDlgStartEnumHub(hWnd, a); - break; - } - break; - case BN_PUSHED: - switch (LOWORD(wParam)) - { - case R_DISABLE_NATT: - break; - } - break; - } - if (HIWORD(wParam) == 0) - { - CmEditAccountDlgUpdate(hWnd, a); - } - switch (wParam) - { - case B_POLICY: - // Policy - if (a->LinkMode || a->NatMode) - { - a->Policy.Access = true; - a->Policy.MonitorPort = false; - SmPolicyDlgEx2(hWnd, &a->Policy, _UU("SM_LINK_POLICY_CAPTION"), true, a->PolicyVer); - a->Policy.Access = true; - a->Policy.MonitorPort = false; - } - break; - case IDOK: - CmEditAccountDlgUpdate(hWnd, a); - CmEditAccountDlgOnOk(hWnd, a); - break; - case IDCANCEL: - Close(hWnd); - break; - case B_PROXY_CONFIG: - // Proxy Settings - if (CmProxyDlg(hWnd, a->ClientOption)) - { - UINT n = GetInt(hWnd, C_PORT); - if (a->ClientOption->ProxyType == PROXY_HTTP && - n != 443) - { - // Show a warning message if the destination port is - // other than 443 and HTTP proxy is used - if (MsgBoxEx(hWnd, MB_ICONQUESTION | MB_YESNO, _UU("CM_HTTP_PROXY_WARNING"), n) == IDYES) - { - // Change the port number to 443 - SetText(hWnd, C_PORT, _UU("CM_PORT_2")); - } - } - CmEditAccountDlgStartEnumHub(hWnd, a); - CmEditAccountDlgUpdate(hWnd, a); - } - break; - case B_IE: - // Use the IE settings - if(cm->server_name == NULL) - { - CmProxyDlgUseForIE(hWnd, a->ClientOption); - CmEditAccountDlgUpdate(hWnd, a); - MsgBox(hWnd, MB_ICONINFORMATION, _UU("CM_PROXY_FROM_IE")); - } - break; - case B_TRUST: - // CA - if (a->LinkMode == false) - { - CmTrustDlg(hWnd); - } - else - { - SmCaDlg(hWnd, a->Hub); - } - break; - case B_SERVER_CERT: - // Server certificate registration / delete - if (a->ServerCert == NULL) - { - if (CmLoadXFromFileOrSecureCard(hWnd, &x)) - { - a->ServerCert = x; - CmEditAccountDlgUpdate(hWnd, a); - } - } - else - { - if (MsgBox(hWnd, MB_ICONQUESTION | MB_YESNO | MB_DEFBUTTON2, _UU("CM_DELETE_SERVER_CERT")) == IDYES) - { - FreeX(a->ServerCert); - a->ServerCert = NULL; - CmEditAccountDlgUpdate(hWnd, a); - } - } - break; - case B_VIEW_SERVER_CERT: - // Show the server certificate - if (a->ServerCert != NULL) - { - X *issuer = CmGetIssuer(a->ServerCert); - CertDlg(hWnd, a->ServerCert, issuer, true); - FreeX(issuer); - } - break; - case B_VIEW_CLIENT_CERT: - if (a->ClientAuth->AuthType != CLIENT_AUTHTYPE_SECURE) - { - // Show the client certificate - if (a->ClientAuth->ClientX != NULL) - { - X *issuer = CmGetIssuer(a->ClientAuth->ClientX); - CertDlg(hWnd, a->ClientAuth->ClientX, issuer, true); - FreeX(issuer); - } - } - else - { - UINT id; - // Select the type of smart card - SmSelectSecureId(hWnd); - id = SmGetCurrentSecureIdFromReg(); - if (id != 0) - { - if (cm->server_name == NULL) - { - RPC_USE_SECURE t; - - Zero(&t, sizeof(t)); - t.DeviceId = id; - CcUseSecure(cm->Client, &t); - } - } - CmEditAccountDlgUpdate(hWnd, a); - } - break; - case B_REGIST_CLIENT_CERT: - if (a->ClientAuth->AuthType != CLIENT_AUTHTYPE_SECURE) - { - // Client certificate registration / deletion - if (a->ClientAuth->ClientX == NULL) - { - if (CmLoadXAndK(hWnd, &x, &k)) - { - a->ClientAuth->ClientX = x; - a->ClientAuth->ClientK = k; - CmEditAccountDlgUpdate(hWnd, a); - } - } - else - { - if (MsgBox(hWnd, MB_ICONQUESTION | MB_YESNO | MB_DEFBUTTON2, _UU("CM_DELETE_CLIENT_CERT")) == IDYES) - { - FreeX(a->ClientAuth->ClientX); - FreeK(a->ClientAuth->ClientK); - a->ClientAuth->ClientX = NULL; - a->ClientAuth->ClientK = NULL; - CmEditAccountDlgUpdate(hWnd, a); - } - } - } - else - { - char cert[MAX_SECURE_DEVICE_FILE_LEN + 1], priv[MAX_SECURE_DEVICE_FILE_LEN + 1]; - - // Select a certificate in the smart card - if (SmSelectKeyPairEx(hWnd, cert, sizeof(cert), priv, sizeof(priv), CmGetSecureBitmapId(a->ClientOption->Hostname))) - { - StrCpy(a->ClientAuth->SecurePublicCertName, sizeof(a->ClientAuth->SecurePublicCertName), cert); - StrCpy(a->ClientAuth->SecurePrivateKeyName, sizeof(a->ClientAuth->SecurePrivateKeyName), priv); - CmEditAccountDlgUpdate(hWnd, a); - } - } - break; - case B_DETAIL: - // Advanced communication settings - if (CmDetailDlg(hWnd, a)) - { - CmEditAccountDlgUpdate(hWnd, a); - } - break; - case B_CHANGE_PASSWORD: - // Change the password - CmChangePassword(hWnd, a->ClientOption, a->ClientOption->HubName, - a->ClientAuth->Username); - break; - } - break; - case WM_CLOSE: - EndDialog(hWnd, false); - break; - case WM_NOTIFY: - n = (NMHDR *)lParam; - switch (n->idFrom) - { - case L_VLAN: - switch (n->code) - { - case LVN_ITEMCHANGED: - CmEditAccountDlgUpdate(hWnd, a); - break; - } - break; - } - break; - } - - return 0; -} - -// Update the custom proxy HTTP header dialog -void CmProxyHttpHeaderDlgUpdate(HWND hWnd) -{ - UINT i = 0; - bool ok = true; - LIST *names_list; - // Validate arguments - if (hWnd == NULL) - { - return; - } - - names_list = NewList(NULL); - - for (; i < LvNum(hWnd, L_VALUES_LIST); i++) - { - wchar_t *str = LvGetStr(hWnd, L_VALUES_LIST, i, 0); - UniTrim(str); - if (IsEmptyUniStr(str) || IsInListUniStr(names_list, str)) - { - Free(str); - ok = false; - break; - } - - Add(names_list, str); - } - - FreeStrList(names_list); - SetEnable(hWnd, IDOK, ok); -} - -// Update the custom proxy HTTP header dialog content -void CmProxyHttpHeaderDlgRefresh(HWND hWnd, CM_PROXY_HTTP_HEADER_DLG *d) -{ - UINT i = 0; - LIST *list; - LVB *b; - CLIENT_OPTION *a; - // Validate arguments - if (hWnd == NULL || d == NULL) - { - return; - } - - a = (CLIENT_OPTION *)d->ClientOption; - - list = NewEntryList(a->CustomHttpHeader, "\r\n", ":"); - - b = LvInsertStart(); - - for (; i < LIST_NUM(list); i++) - { - INI_ENTRY *e = LIST_DATA(list, i); - wchar_t *name = CopyStrToUni(e->Key); - wchar_t *value = CopyStrToUni(e->Value); - UniTrimLeft(value); - - LvInsertAdd(b, 0, NULL, 2, name, value); - - Free(name); - Free(value); - } - - LvInsertEnd(b, hWnd, L_VALUES_LIST); - FreeEntryList(list); -} - -// Initialize the custom proxy HTTP header dialog -void CmProxyHttpHeaderDlgInit(HWND hWnd, CM_PROXY_HTTP_HEADER_DLG *d) -{ - // Validate arguments - if (hWnd == NULL || d == NULL) - { - return; - } - - LvSetEnhanced(hWnd, L_VALUES_LIST, true); - LvInitEx(hWnd, L_VALUES_LIST, true); - LvInsertColumn(hWnd, L_VALUES_LIST, 0, _UU("CM_HTTP_HEADER_COLUMN_0"), 150); - LvInsertColumn(hWnd, L_VALUES_LIST, 1, _UU("CM_HTTP_HEADER_COLUMN_1"), 150); - - LvSetStyle(hWnd, L_VALUES_LIST, LVS_EX_GRIDLINES); - - CmProxyHttpHeaderDlgRefresh(hWnd, d); -} - -// Custom proxy HTTP header dialog control -UINT CmProxyHttpHeaderDlgProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param) -{ - CM_PROXY_HTTP_HEADER_DLG *d = (CM_PROXY_HTTP_HEADER_DLG *)param; - CLIENT_OPTION *a = (d == NULL ? NULL : d->ClientOption); - UINT i = INFINITE; - // Validate arguments - if (hWnd == NULL || d == NULL || a == NULL) - { - return 0; - } - - switch (msg) - { - case WM_INITDIALOG: - CmProxyHttpHeaderDlgInit(hWnd, d); - break; - case WM_CLOSE: - EndDialog(hWnd, false); - break; - case WM_NOTIFY: - { - switch (((LPNMHDR)lParam)->code) - { - // Header divider being dragged (resizing columns) - case HDN_ITEMCHANGINGA: - case HDN_ITEMCHANGINGW: - if (d->EditBox != NULL) - { - RECT rect; - ListView_GetSubItemRect(DlgItem(hWnd, L_VALUES_LIST), d->CurrentItem, d->CurrentSubItem, LVIR_LABEL, &rect); - MoveWindow(d->EditBox, rect.left, rect.top, rect.right - rect.left, rect.bottom - rect.top, true); - RedrawWindow(d->EditBox, NULL, NULL, RDW_ERASE | RDW_INVALIDATE | RDW_UPDATENOW); - } - break; - case LVN_ITEMCHANGED: - if (((LPNMHDR)lParam)->idFrom == L_VALUES_LIST) - { - CmProxyHttpHeaderDlgUpdate(hWnd); - } - break; - case NM_DBLCLK: - { - RECT rect; - LPNMLISTVIEW list_view = (LPNMLISTVIEW)lParam; - wchar_t *str; - - d->CurrentItem = list_view->iItem; - d->CurrentSubItem = list_view->iSubItem; - str = LvGetStr(DlgItem(hWnd, L_VALUES_LIST), 0, d->CurrentItem, d->CurrentSubItem); - ListView_GetSubItemRect(DlgItem(hWnd, L_VALUES_LIST), d->CurrentItem, d->CurrentSubItem, LVIR_LABEL, &rect); - - d->EditBox = CreateWindowExW(0, L"EDIT", str, WS_BORDER | WS_CHILD | WS_VISIBLE | ES_AUTOHSCROLL | ES_LEFT | ES_MULTILINE | ES_WANTRETURN, rect.left, rect.top, rect.right - rect.left, rect.bottom - rect.top, DlgItem(hWnd, L_VALUES_LIST), NULL, GetModuleHandle(NULL), NULL); - Free(str); - - DlgFont(d->EditBox, 0, 8, false); - EditBoxSetEnhanced(d->EditBox, 0, true); - FocusEx(d->EditBox, 0); - break; - } - case NM_CLICK: - case NM_RETURN: - if (d->EditBox != NULL) - { - wchar_t *new_name = GetText(d->EditBox, 0); - wchar_t *old_name = LvGetStr(hWnd, L_VALUES_LIST, d->CurrentItem, d->CurrentSubItem); - - if (old_name != NULL) - { - if (UniStrCmp(new_name, old_name) != 0) - { - LvSetItem(hWnd, L_VALUES_LIST, d->CurrentItem, d->CurrentSubItem, new_name); - } - - Free(old_name); - } - - Free(new_name); - - DestroyWindow(d->EditBox); - d->EditBox = NULL; - } - } - break; - } - case WM_COMMAND: - switch (wParam) - { - case B_NEW: - { - NMLISTVIEW lv; - - if (d->EditBox != NULL) - { - DestroyWindow(d->EditBox); - } - - i = LvInsertItem(hWnd, L_VALUES_LIST, 0, NULL, L""); - LvSelect(hWnd, L_VALUES_LIST, i); - - Zero(&lv, sizeof(lv)); - lv.hdr.code = NM_DBLCLK; - lv.iItem = i; - lv.iSubItem = 0; - - SendMsg(hWnd, 0, WM_NOTIFY, 0, (LPARAM)&lv); - } - break; - case B_DELETE: - if (d->EditBox != NULL) - { - DestroyWindow(d->EditBox); - } - - i = LvGetSelected(hWnd, L_VALUES_LIST); - if (i != INFINITE) - { - LvDeleteItem(hWnd, L_VALUES_LIST, i); - } - CmProxyHttpHeaderDlgUpdate(hWnd); - break; - case B_CLEAR: - if (d->EditBox != NULL) - { - DestroyWindow(d->EditBox); - } - - LvReset(hWnd, L_VALUES_LIST); - CmProxyHttpHeaderDlgUpdate(hWnd); - break; - case IDOK: - { - UINT index = 0; - char *name = NULL; - char *value = NULL; - char http_header[HTTP_CUSTOM_HEADER_MAX_SIZE]; - - Zero(http_header, sizeof(http_header)); - i = LvNum(hWnd, L_VALUES_LIST); - - for (; index < i; index++) - { - char str[HTTP_CUSTOM_HEADER_MAX_SIZE]; - name = LvGetStrA(hWnd, L_VALUES_LIST, index, 0); - value = LvGetStrA(hWnd, L_VALUES_LIST, index, 1); - - Trim(name); - TrimLeft(value); - - Format(str, sizeof(str), "%s: %s\r\n", name, value); - EnSafeHttpHeaderValueStr(str, ' '); - - Free(name); - Free(value); - - if ((StrLen(http_header) + StrLen(str)) < sizeof(a->CustomHttpHeader)) - { - StrCat(http_header, sizeof(str), str); - } - else - { - MsgBox(hWnd, MB_ICONEXCLAMATION | MB_OK, _E(ERR_TOO_MANT_ITEMS)); - return 1; - } - } - - Zero(a->CustomHttpHeader, sizeof(a->CustomHttpHeader)); - StrCpy(a->CustomHttpHeader, sizeof(a->CustomHttpHeader), http_header); - - EndDialog(hWnd, true); - break; - } - case IDCANCEL: - Close(hWnd); - } - } - - return 0; -} - -// Custom proxy HTTP header dialog -bool CmProxyHttpHeaderDlg(HWND hWnd, CLIENT_OPTION *a) -{ - CM_PROXY_HTTP_HEADER_DLG d; - // Validate arguments - if (a == NULL) - { - return false; - } - - Zero(&d, sizeof(d)); - - d.ClientOption = a; - - return Dialog(hWnd, D_CM_PROXY_HTTP_HEADER, CmProxyHttpHeaderDlgProc, &d); -} - -// Update the proxy server settings -void CmProxyDlgUpdate(HWND hWnd, CLIENT_OPTION *a) -{ - bool ok = true; - // Validate arguments - if (hWnd == NULL || a == NULL) - { - return; - } - - SetEnable(hWnd, B_HTTP_HEADER, a->ProxyType == PROXY_HTTP); - - if (IsEmpty(hWnd, E_HOSTNAME)) - { - ok = false; - } - if (GetInt(hWnd, C_PORT) == 0) - { - ok = false; - } - - SetEnable(hWnd, IDOK, ok); -} - -// Proxy server settings dialog c -UINT CmProxyDlgProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param) -{ - CLIENT_OPTION *a = (CLIENT_OPTION *)param; - // Validate arguments - if (hWnd == NULL) - { - return 0; - } - - switch (msg) - { - case WM_INITDIALOG: - SetTextA(hWnd, E_HOSTNAME, a->ProxyName); - CbSetHeight(hWnd, C_PORT, 18); - CbAddStr(hWnd, C_PORT, L"8080", 0); - CbAddStr(hWnd, C_PORT, L"1080", 0); - CbAddStr(hWnd, C_PORT, L"80", 0); - CbAddStr(hWnd, C_PORT, L"3128", 0); - CbAddStr(hWnd, C_PORT, L"443", 0); - CbAddStr(hWnd, C_PORT, L"9821", 0); - CbAddStr(hWnd, C_PORT, L"9801", 0); - SetIntEx(hWnd, C_PORT, a->ProxyPort); - SetTextA(hWnd, E_USERNAME, a->ProxyUsername); - SetTextA(hWnd, E_PASSWORD, a->ProxyPassword); - if (a->ProxyPort == 0) - { - if (a->ProxyType == PROXY_HTTP) - { - SetInt(hWnd, C_PORT, 8080); - } - else - { - SetInt(hWnd, C_PORT, 1080); - } - } - CmProxyDlgUpdate(hWnd, a); - break; - case WM_COMMAND: - switch (LOWORD(wParam)) - { - case E_HOSTNAME: - case C_PORT: - case E_USERNAME: - case E_PASSWORD: - CmProxyDlgUpdate(hWnd, a); - break; - } - - switch (wParam) - { - case B_HTTP_HEADER: - CmProxyHttpHeaderDlg(hWnd, a); - break; - case IDOK: - GetTxtA(hWnd, E_HOSTNAME, a->ProxyName, sizeof(a->ProxyName)); - GetTxtA(hWnd, E_USERNAME, a->ProxyUsername, sizeof(a->ProxyUsername)); - GetTxtA(hWnd, E_PASSWORD, a->ProxyPassword, sizeof(a->ProxyPassword)); - a->ProxyPort = GetInt(hWnd, C_PORT); - EndDialog(hWnd, true); - break; - case IDCANCEL: - Close(hWnd); - break; - } - break; - case WM_CLOSE: - EndDialog(hWnd, false); - break; - } - - return 0; -} - -// Proxy server settings -bool CmProxyDlg(HWND hWnd, CLIENT_OPTION *a) -{ - // Validate arguments - if (a == NULL) - { - return false; - } - - return Dialog(hWnd, D_CM_PROXY, CmProxyDlgProc, a); -} - -// Get issuer of the specified certificate if it is known -X *CmGetIssuer(X *x) -{ - RPC_GET_ISSUER a; - X *ret; - // Validate arguments - if (x == NULL) - { - return NULL; - } - - Zero(&a, sizeof(a)); - a.x = CloneX(x); - if (CALLEX(cm->hMainWnd, CcGetIssuer(cm->Client, &a)) == 0) - { - ret = CloneX(a.issuer_x); - } - else - { - ret = NULL; - } - - CiFreeGetIssuer(&a); - - return ret; -} - -// Initialize the dialog -void CmLoadXFromFileOrSecureCardDlgInit(HWND hWnd, CM_LOADX *p) -{ - UINT current; - // Validate arguments - if (hWnd == NULL || p == NULL) - { - return; - } - - current = MsRegReadInt(REG_CURRENT_USER, SECURE_MANAGER_KEY, "CertLoadSource"); - - Check(hWnd, R_FROM_FILE, current == 0); - Check(hWnd, R_FROM_SECURE, current != 0); - - SetFont(hWnd, S_INFO, Font(0, true)); - - CmLoadXFromFileOrSecureCardDlgUpdate(hWnd, p); -} - -// Update the dialog control -void CmLoadXFromFileOrSecureCardDlgUpdate(HWND hWnd, CM_LOADX *p) -{ - SECURE_DEVICE *dev; - wchar_t tmp[MAX_SIZE]; - bool ok = true; - // Validate arguments - if (hWnd == NULL || p == NULL) - { - return; - } - - dev = GetSecureDevice(SmGetCurrentSecureIdFromReg()); - if (dev == NULL) - { - UniStrCpy(tmp, sizeof(tmp), _UU("SEC_CURRENT_NO_DEVICE")); - } - else - { - UniFormat(tmp, sizeof(tmp), _UU("SEC_CURRENT_DEVICE"), dev->DeviceName); - } - - SetText(hWnd, S_INFO, tmp); - - if (IsChecked(hWnd, R_FROM_SECURE)) - { - if (dev == NULL) - { - ok = false; - } - } - - SetEnable(hWnd, IDOK, ok); - SetEnable(hWnd, B_SELECT, IsChecked(hWnd, R_FROM_SECURE)); - SetEnable(hWnd, S_CERT, IsChecked(hWnd, R_FROM_SECURE)); - SetEnable(hWnd, S_FILE, IsChecked(hWnd, R_FROM_FILE)); -} - -// Certificate reading selection dialog procedure -UINT CmLoadXFromFileOrSecureCardDlgProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param) -{ - CM_LOADX *p = (CM_LOADX *)param; - X *x; - UINT current; - // Validate arguments - if (hWnd == NULL) - { - return 0; - } - - switch (msg) - { - case WM_INITDIALOG: - CmLoadXFromFileOrSecureCardDlgInit(hWnd, p); - break; - - case WM_COMMAND: - switch (wParam) - { - case IDOK: - current = (IsChecked(hWnd, R_FROM_FILE)) ? 0 : 1; - MsRegWriteInt(REG_CURRENT_USER, SECURE_MANAGER_KEY, "CertLoadSource", current); - - if (current == 0) - { - // From file - if (CmLoadX(hWnd, &x)) - { - p->x = x; - EndDialog(hWnd, true); - } - } - else - { - // From the smart card - char name[MAX_SIZE]; - - // Select the certificate name in the card - if (SmSelectKeyPair(hWnd, name, sizeof(name), NULL, 0)) - { - // Read - WINUI_SECURE_BATCH batch[] = - { - {WINUI_SECURE_READ_CERT, name, true, NULL, NULL, NULL, NULL, NULL, NULL}, - }; - - // Do reading - if (SecureDeviceWindow(hWnd, batch, sizeof(batch) / sizeof(batch[0]), SmGetCurrentSecureIdFromReg(), 0)) - { - // Success - p->x = batch[0].OutputX; - EndDialog(hWnd, true); - } - } - } - break; - - case IDCANCEL: - Close(hWnd); - break; - - case R_FROM_FILE: - CmLoadXFromFileOrSecureCardDlgUpdate(hWnd, p); - break; - - case R_FROM_SECURE: - CmLoadXFromFileOrSecureCardDlgUpdate(hWnd, p); - break; - - case B_SELECT: - SmSelectSecureId(hWnd); - CmLoadXFromFileOrSecureCardDlgUpdate(hWnd, p); - break; - } - break; - - case WM_CLOSE: - EndDialog(hWnd, false); - break; - } - - return 0; -} - -// Read certificate from a file or a smart card -bool CmLoadXFromFileOrSecureCard(HWND hWnd, X **x) -{ - CM_LOADX p; - // Validate arguments - if (x == NULL) - { - return false; - } - - Zero(&p, sizeof(p)); - if (Dialog(hWnd, D_CM_LOAD_X, CmLoadXFromFileOrSecureCardDlgProc, &p) == false) - { - return false; - } - - *x = p.x; - - return true; -} - -// Read the certificate -bool CmLoadX(HWND hWnd, X **x) -{ - return CmLoadXEx(hWnd, x, NULL, 0); -} -bool CmLoadXEx(HWND hWnd, X **x, char *filename, UINT size) -{ - wchar_t *filename_w = CopyStrToUni(filename); - bool ret; - - ret = CmLoadXExW(hWnd, x, filename_w, size); - - Free(filename_w); - - return ret; -} -bool CmLoadXExW(HWND hWnd, X **x, wchar_t *filename, UINT size) -{ - wchar_t *s; - bool is_p12; - wchar_t tmp[MAX_SIZE]; - K *k; - // Validate arguments - if (x == NULL) - { - return false; - } - - // Read the certificate - s = OpenDlg(hWnd, _UU("DLG_CERT_OR_P12_FILTER"), _UU("DLG_OPEN_CERT")); - if (s == NULL) - { - return false; - } - UniStrCpy(tmp, sizeof(tmp), s); - if (filename != NULL) - { - UniStrCpy(filename, size, tmp); - } - Free(s); - if (UniEndWith(tmp, L".p12") || UniEndWith(tmp, L".pfx")) - { - is_p12 = true; - } - else - { - is_p12 = false; - } - - if (is_p12) - { - // Processing of PKCS#12 - BUF *b = ReadDumpW(tmp); - P12 *p12; - if (b == NULL) - { - MsgBoxEx(hWnd, MB_ICONSTOP, _UU("DLG_OPEN_FILE_ERROR_W"), tmp); - return false; - } - p12 = BufToP12(b); - if (p12 == NULL) - { - MsgBoxEx(hWnd, MB_ICONSTOP, _UU("DLG_BAD_P12_W"), tmp); - FreeBuf(b); - return false; - } - if (IsEncryptedP12(p12) == false) - { - if (ParseP12(p12, x, &k, NULL) == false) - { - MsgBoxEx(hWnd, MB_ICONSTOP, _UU("DLG_BAD_P12_W"), tmp); - FreeP12(p12); - FreeBuf(b); - return false; - } - } - else - { - char password[MAX_SIZE]; - if (PassphraseDlg(hWnd, password, sizeof(password), b, true) == false) - { - FreeP12(p12); - FreeBuf(b); - return false; - } - else - { - if (ParseP12(p12, x, &k, password) == false) - { - MsgBoxEx(hWnd, MB_ICONSTOP, _UU("DLG_BAD_P12_W"), tmp); - FreeP12(p12); - FreeBuf(b); - return false; - } - } - } - FreeP12(p12); - FreeBuf(b); - FreeK(k); - return true; - } - else - { - // Processing of X509 - BUF *b = ReadDumpW(tmp); - X *x509; - if (b == NULL) - { - MsgBoxEx(hWnd, MB_ICONSTOP, _UU("DLG_OPEN_FILE_ERROR_W"), tmp); - return false; - } - - x509 = BufToX(b, IsBase64(b)); - FreeBuf(b); - if (x509 == NULL) - { - MsgBoxEx(hWnd, MB_ICONSTOP, _UU("DLG_BAD_X509_W"), tmp); - return false; - } - - *x = x509; - return true; - } -} - -// Read the secret key -bool CmLoadKEx(HWND hWnd, K **k, char *filename, UINT size) -{ - wchar_t *filename_w = CopyStrToUni(filename); - bool ret; - - ret = CmLoadKExW(hWnd, k, filename_w, size); - - Free(filename_w); - - return ret; -} -bool CmLoadKExW(HWND hWnd, K **k, wchar_t *filename, UINT size) -{ - wchar_t *s; - bool is_p12; - wchar_t tmp[MAX_SIZE]; - // Validate arguments - if (k == NULL) - { - return false; - } - - // Read the certificate - s = OpenDlg(hWnd, _UU("DLG_KEY_OR_P12_FILTER"), _UU("DLG_OPEN_KEY")); - if (s == NULL) - { - return false; - } - UniStrCpy(tmp, sizeof(tmp), s); - Free(s); - if (filename != NULL) - { - UniStrCpy(filename, size, tmp); - } - if (UniEndWith(tmp, L".p12") || UniEndWith(tmp, L".pfx")) - { - is_p12 = true; - } - else - { - is_p12 = false; - } - - if (is_p12) - { - // Processing of PKCS#12 - BUF *b = ReadDumpW(tmp); - P12 *p12; - if (b == NULL) - { - MsgBoxEx(hWnd, MB_ICONSTOP, _UU("DLG_OPEN_FILE_ERROR_W"), tmp); - return false; - } - p12 = BufToP12(b); - if (p12 == NULL) - { - MsgBoxEx(hWnd, MB_ICONSTOP, _UU("DLG_BAD_P12_W"), tmp); - FreeBuf(b); - return false; - } - if (IsEncryptedP12(p12) == false) - { - X *x; - if (ParseP12(p12, &x, k, NULL) == false) - { - MsgBoxEx(hWnd, MB_ICONSTOP, _UU("DLG_BAD_P12_W"), tmp); - FreeP12(p12); - FreeBuf(b); - return false; - } - - FreeX(x); - } - else - { - char password[MAX_SIZE]; - if (PassphraseDlg(hWnd, password, sizeof(password), b, true) == false) - { - FreeP12(p12); - FreeBuf(b); - return false; - } - else - { - X *x; - if (ParseP12(p12, &x, k, password) == false) - { - MsgBoxEx(hWnd, MB_ICONSTOP, _UU("DLG_BAD_P12_W"), tmp); - FreeP12(p12); - FreeBuf(b); - return false; - } - - FreeX(x); - } - } - FreeP12(p12); - FreeBuf(b); - return true; - } - else - { - // Processing of private key - BUF *b = ReadDumpW(tmp); - K *key; - if (b == NULL) - { - MsgBoxEx(hWnd, MB_ICONSTOP, _UU("DLG_OPEN_FILE_ERROR_W"), tmp); - return false; - } - - if (IsEncryptedK(b, true) == false) - { - key = BufToK(b, true, IsBase64(b), NULL); - } - else - { - char pass[MAX_SIZE]; - if (PassphraseDlg(hWnd, pass, sizeof(pass), b, false) == false) - { - FreeBuf(b); - return false; - } - key = BufToK(b, true, IsBase64(b), pass); - } - - if (key == NULL) - { - FreeBuf(b); - MsgBoxEx(hWnd, MB_ICONSTOP, _UU("DLG_BAD_KEY_W"), tmp); - return false; - } - - FreeBuf(b); - *k = key; - return true; - } -} - -// Read a set of certificate and private key -bool CmLoadXAndK(HWND hWnd, X **x, K **k) -{ - wchar_t *s; - bool is_p12; - wchar_t tmp[MAX_SIZE]; - // Validate arguments - if (x == NULL || k == NULL) - { - return false; - } -START_FIRST: - - // Read the certificate - s = OpenDlg(hWnd, _UU("DLG_CERT_OR_P12_FILTER"), _UU("DLG_OPEN_CERT")); - if (s == NULL) - { - return false; - } - UniStrCpy(tmp, sizeof(tmp), s); - Free(s); - if (UniEndWith(tmp, L".p12") || UniEndWith(tmp, L".pfx")) - { - is_p12 = true; - } - else - { - is_p12 = false; - } - - if (is_p12) - { - // Processing of PKCS#12 - BUF *b = ReadDumpW(tmp); - P12 *p12; - if (b == NULL) - { - MsgBoxEx(hWnd, MB_ICONSTOP, _UU("DLG_OPEN_FILE_ERROR_W"), tmp); - return false; - } - p12 = BufToP12(b); - if (p12 == NULL) - { - MsgBoxEx(hWnd, MB_ICONSTOP, _UU("DLG_BAD_P12_W"), tmp); - FreeBuf(b); - return false; - } - if (IsEncryptedP12(p12) == false) - { - if (ParseP12(p12, x, k, NULL) == false) - { - MsgBoxEx(hWnd, MB_ICONSTOP, _UU("DLG_BAD_P12_W"), tmp); - FreeP12(p12); - FreeBuf(b); - return false; - } - } - else - { - char password[MAX_SIZE]; - if (PassphraseDlg(hWnd, password, sizeof(password), b, true) == false) - { - FreeP12(p12); - FreeBuf(b); - return false; - } - else - { - if (ParseP12(p12, x, k, password) == false) - { - MsgBoxEx(hWnd, MB_ICONSTOP, _UU("DLG_BAD_P12_W"), tmp); - FreeP12(p12); - FreeBuf(b); - return false; - } - } - } - if (CheckXandK(*x, *k) == false) - { - FreeX(*x); - FreeK(*k); - FreeP12(p12); - FreeBuf(b); - if (MsgBox(hWnd, MB_ICONEXCLAMATION | MB_RETRYCANCEL, _UU("DLG_BAD_SIGNATURE")) == IDRETRY) - { - goto START_FIRST; - } - return false; - } - FreeP12(p12); - FreeBuf(b); - return true; - } - else - { - // Processing of X509 - BUF *b = ReadDumpW(tmp); - X *x509; - K *key; - if (b == NULL) - { - MsgBoxEx(hWnd, MB_ICONSTOP, _UU("DLG_OPEN_FILE_ERROR_W"), tmp); - return false; - } - - x509 = BufToX(b, IsBase64(b)); - FreeBuf(b); - if (x509 == NULL) - { - MsgBoxEx(hWnd, MB_ICONSTOP, _UU("DLG_BAD_X509_W"), tmp); - return false; - } - - // Read the secret key - s = OpenDlg(hWnd, _UU("DLG_KEY_FILTER"), _UU("DLG_OPEN_KEY_WITH_CERT")); - if (s == NULL) - { - FreeX(x509); - return false; - } - UniStrCpy(tmp, sizeof(tmp), s); - Free(s); - - b = ReadDumpW(tmp); - if (b == NULL) - { - MsgBoxEx(hWnd, MB_ICONSTOP, _UU("DLG_OPEN_FILE_ERROR_W"), tmp); - FreeX(x509); - return false; - } - - if (IsEncryptedK(b, true) == false) - { - key = BufToK(b, true, IsBase64(b), NULL); - } - else - { - char pass[MAX_SIZE]; - if (PassphraseDlg(hWnd, pass, sizeof(pass), b, false) == false) - { - FreeBuf(b); - FreeX(x509); - return false; - } - key = BufToK(b, true, IsBase64(b), pass); - } - - if (key == NULL) - { - FreeBuf(b); - FreeX(x509); - MsgBoxEx(hWnd, MB_ICONSTOP, _UU("DLG_BAD_KEY_W"), tmp); - return false; - } - - if (CheckXandK(x509, key) == false) - { - FreeBuf(b); - FreeX(x509); - FreeK(key); - if (MsgBox(hWnd, MB_ICONEXCLAMATION | MB_RETRYCANCEL, _UU("DLG_BAD_SIGNATURE")) == IDRETRY) - { - goto START_FIRST; - } - return false; - } - - FreeBuf(b); - *x = x509; - *k = key; - return true; - } -} - -// Virtual HUB enumeration start -void CmEditAccountDlgStartEnumHub(HWND hWnd, CM_ACCOUNT *a) -{ - char server_name[MAX_HOST_NAME_LEN + 1]; - UINT old_proxy_type; - // Validate arguments - if (hWnd == NULL || a == NULL) - { - return; - } - - - if (StrLen(a->ClientOption->Hostname) == 0) - { - return; - } - if (a->ClientOption->Port == 0) - { - return; - } - if (a->ClientOption->ProxyType != PROXY_DIRECT && - (StrLen(a->ClientOption->ProxyName) == 0 || - a->ClientOption->ProxyPort == 0)) - { - return; - } - - GetTxtA(hWnd, E_HOSTNAME, server_name, sizeof(server_name)); - - if (StrCmpi(server_name, a->old_server_name) == 0) - { - if (CbNum(hWnd, C_HUBNAME) != 0) - { - return; - } - } - else - { - StrCpy(a->old_server_name, sizeof(a->old_server_name), server_name); - CbReset(hWnd, C_HUBNAME); - } - - old_proxy_type = a->ClientOption->ProxyType; - - if (IsChecked(hWnd, R_DIRECT_TCP)) - { - a->ClientOption->ProxyType = PROXY_DIRECT; - } - if (IsChecked(hWnd, R_HTTPS)) - { - a->ClientOption->ProxyType = PROXY_HTTP; - } - if (IsChecked(hWnd, R_SOCKS)) - { - a->ClientOption->ProxyType = PROXY_SOCKS; - } - if (IsChecked(hWnd, R_SOCKS5)) - { - a->ClientOption->ProxyType = PROXY_SOCKS5; - } - - CmEnumHubStart(hWnd, a->ClientOption); - - a->ClientOption->ProxyType = old_proxy_type; -} - -// [OK] button -void CmEditAccountDlgOnOk(HWND hWnd, CM_ACCOUNT *a) -{ - RPC_CLIENT_CREATE_ACCOUNT c; - bool b; - // Validate arguments - if (hWnd == NULL || a == NULL) - { - return; - } - if (a->ClientOption->NumRetry != 0 && a->ClientOption->RetryInterval < 5) - { - MsgBox(hWnd, MB_ICONINFORMATION, _UU("CM_RETRY_INTERVAL_ERROR")); - FocusEx(hWnd, E_RETRY_SPAN); - return; - } - - CmEditAccountDlgUpdate(hWnd, a); - - if (a->LinkMode == false && a->NatMode == false) - { - // Save the account - Zero(&c, sizeof(c)); - c.ClientOption = ZeroMalloc(sizeof(CLIENT_OPTION)); - Copy(c.ClientOption, a->ClientOption, sizeof(CLIENT_OPTION)); - c.ClientAuth = CopyClientAuth(a->ClientAuth); - c.CheckServerCert = a->CheckServerCert; - if (a->ServerCert != NULL) - { - c.ServerCert = CloneX(a->ServerCert); - } - c.StartupAccount = a->Startup; - - if (a->EditMode == false) - { - b = CALL(hWnd, CcCreateAccount(cm->Client, &c)); - } - else - { - b = CALL(hWnd, CcSetAccount(cm->Client, &c)); - } - - CiFreeClientCreateAccount(&c); - - // Check whether this account is currently running - if (b) - { - RPC_CLIENT_GET_CONNECTION_STATUS st; - Zero(&st, sizeof(st)); - UniStrCpy(st.AccountName, sizeof(st.AccountName), a->ClientOption->AccountName); - if (CALL(hWnd, CcGetAccountStatus(cm->Client, &st))) - { - if (st.Active) - { - MsgBoxEx(hWnd, MB_ICONINFORMATION, _UU("CM_CURRENT_ACTIVE"), - st.AccountName); - } - } - } - - if (b) - { - EndDialog(hWnd, true); - } - } - else - { - if (a->LinkMode) - { - // Link mode - RPC_CREATE_LINK t; - - Zero(&t, sizeof(t)); - StrCpy(t.HubName, sizeof(t.HubName), a->Hub->HubName); - t.Online = a->OnlineFlag; - Copy(&t.Policy, &a->Policy, sizeof(POLICY)); - t.ClientOption = ZeroMalloc(sizeof(CLIENT_OPTION)); - Copy(t.ClientOption, a->ClientOption, sizeof(CLIENT_OPTION)); - t.ClientAuth = CopyClientAuth(a->ClientAuth); - t.CheckServerCert = a->CheckServerCert; - t.ServerCert = CloneX(a->ServerCert); - - // Save the settings for cascade connection - if (a->EditMode) - { - if (CALL(hWnd, ScSetLink(a->Hub->Rpc, &t))) - { - if (a->OnlineFlag) - { - MsgBoxEx(hWnd, MB_ICONINFORMATION, _UU("SM_LINK_SAVE_ONLINE"), a->ClientOption->AccountName); - } - EndDialog(hWnd, true); - } - } - else - { - if (CALL(hWnd, ScCreateLink(a->Hub->Rpc, &t))) - { - if (a->Link_ConnectNow) - { - RPC_LINK tt; - - Zero(&tt, sizeof(tt)); - UniStrCpy(tt.AccountName, sizeof(tt.AccountName), a->ClientOption->AccountName); - StrCpy(tt.HubName, sizeof(tt.HubName), a->Hub->HubName); - - CALL(hWnd, ScSetLinkOnline(a->Hub->Rpc, &tt)); - } - EndDialog(hWnd, true); - } - } - - FreeRpcCreateLink(&t); - } - else - { - // NAT mode - RPC_CREATE_LINK t; - Zero(&t, sizeof(t)); - - t.ClientOption = ZeroMalloc(sizeof(CLIENT_OPTION)); - Copy(t.ClientOption, a->ClientOption, sizeof(CLIENT_OPTION)); - t.ClientAuth = CopyClientAuth(a->ClientAuth); - - if (CALL(hWnd, NcSetClientConfig(a->Rpc, &t))) - { - EndDialog(hWnd, true); - } - - FreeRpcCreateLink(&t); - } - } -} - -// Show the account editing dialog -bool CmEditAccountDlg(HWND hWnd, CM_ACCOUNT *a) -{ - // Validate arguments - if (hWnd == NULL || a == NULL) - { - return false; - } - - return Dialog(hWnd, D_CM_ACCOUNT, CmEditAccountDlgProc, a); -} - -// Edit the account -void CmEditAccount(HWND hWnd, wchar_t *account_name) -{ - CM_ACCOUNT *a; - // Validate arguments - if (hWnd == NULL || account_name == NULL) - { - return; - } - - a = CmGetExistAccountObject(hWnd, account_name); - if (a == NULL) - { - return; - } - - CmVoice("input_config"); - if (CmEditAccountDlg(hWnd, a)) - { - CmVoice("set_config"); - } - - CmFreeAccountObject(hWnd, a); -} - -// Create an account -void CmNewAccount(HWND hWnd) -{ - CM_ACCOUNT *a; - RPC_CLIENT_ENUM_VLAN t; - UINT num_vlan = 0; - // Validate arguments - if (hWnd == NULL) - { - return; - } - - if (IsEnable(hWnd, 0) == false) - { - return; - } - - Zero(&t, sizeof(t)); - if (CcEnumVLan(cm->Client, &t) == ERR_NO_ERROR) - { - num_vlan = t.NumItem; - - CiFreeClientEnumVLan(&t); - } - - if (num_vlan == 0) - { - if (MsgBox(hWnd, MB_ICONINFORMATION | MB_YESNO, _UU("CM_NO_VLAN")) == IDNO) - { - return; - } - else - { - if (cm->server_name == NULL || cm->Client->Unix) - { - Command(hWnd, CMD_NEW_VLAN); - return; - } - else - { - MsgBox(hWnd, MB_ICONINFORMATION, _UU("CM_VLAN_REMOTE_ERROR")); - } - return; - } - } - - a = CmCreateNewAccountObject(hWnd); - if (a == NULL) - { - return; - } - - CmVoice("input_config"); - if (CmEditAccountDlg(hWnd, a)) - { - CmVoice("new_config"); - } - - CmFreeAccountObject(hWnd, a); -} - -// Release the account object -void CmFreeAccountObject(HWND hWnd, CM_ACCOUNT *a) -{ - // Validate arguments - if (hWnd == NULL || a == NULL) - { - return; - } - - Free(a->ClientOption); - CiFreeClientAuth(a->ClientAuth); - if (a->ServerCert != NULL) - { - FreeX(a->ServerCert); - } - Free(a); -} - -// Get an existing account object -CM_ACCOUNT *CmGetExistAccountObject(HWND hWnd, wchar_t *account_name) -{ - RPC_CLIENT_GET_ACCOUNT c; - CM_ACCOUNT *a; - // Validate arguments - if (hWnd == NULL) - { - return NULL; - } - - Zero(&c, sizeof(c)); - UniStrCpy(c.AccountName, sizeof(c.AccountName), account_name); - if (CALL(hWnd, CcGetAccount(cm->Client, &c)) == false) - { - return NULL; - } - - a = ZeroMalloc(sizeof(CM_ACCOUNT)); - a->EditMode = true; - a->CheckServerCert = c.CheckServerCert; - a->RetryOnServerCert = c.RetryOnServerCert; - a->Startup = c.StartupAccount; - if (c.ServerCert != NULL) - { - a->ServerCert = CloneX(c.ServerCert); - } - a->ClientOption = ZeroMalloc(sizeof(CLIENT_OPTION)); - Copy(a->ClientOption, c.ClientOption, sizeof(CLIENT_OPTION)); - a->ClientAuth = CopyClientAuth(c.ClientAuth); - Copy(a->ShortcutKey, c.ShortcutKey, SHA1_SIZE); - CiFreeClientGetAccount(&c); - - a->LockMode = cm->CmSetting.LockMode; - - return a; -} - -// Create a new account object -CM_ACCOUNT *CmCreateNewAccountObject(HWND hWnd) -{ - CM_ACCOUNT *a; - // Validate arguments - if (hWnd == NULL) - { - return NULL; - } - - a = ZeroMalloc(sizeof(CM_ACCOUNT)); - a->EditMode = false; - a->CheckServerCert = false; - a->RetryOnServerCert = false; - a->Startup = false; - a->ClientOption = ZeroMalloc(sizeof(CLIENT_OPTION)); - - // Initialize the client options - CmGenerateNewAccountName(hWnd, a->ClientOption->AccountName, sizeof(a->ClientOption->AccountName)); - a->ClientOption->Port = 443; // Default port number - a->ClientOption->NumRetry = INFINITE; - a->ClientOption->RetryInterval = 15; - a->ClientOption->MaxConnection = 1; - a->ClientOption->HalfConnection = false; - a->ClientOption->UseEncrypt = true; - a->ClientOption->AdditionalConnectionInterval = 1; - - if (cm->Client->Unix) - { - a->ClientOption->NoRoutingTracking = true; - } - - a->ClientAuth = ZeroMalloc(sizeof(CLIENT_AUTH)); - - // Password authentication - a->ClientAuth->AuthType = CLIENT_AUTHTYPE_PASSWORD; - - return a; -} - -// Create an imported account name -void CmGenerateImportName(HWND hWnd, wchar_t *name, UINT size, wchar_t *old_name) -{ - UINT i; - // Validate arguments - if (name == NULL || hWnd == NULL) - { - return; - } - - for (i = 1;;i++) - { - wchar_t tmp[MAX_SIZE]; - if (i == 1) - { - UniFormat(tmp, sizeof(tmp), _UU("CM_IMPORT_NAME_1"), old_name); - } - else - { - UniFormat(tmp, sizeof(tmp), _UU("CM_IMPORT_NAME_2"), old_name, i); - } - - if (LvSearchStr(hWnd, L_ACCOUNT, 0, tmp) == INFINITE) - { - UniStrCpy(name, size, tmp); - return; - } - } -} - -// Create a copy name -void CmGenerateCopyName(HWND hWnd, wchar_t *name, UINT size, wchar_t *old_name) -{ - UINT i; - // Validate arguments - if (name == NULL || hWnd == NULL) - { - return; - } - - for (i = 1;;i++) - { - wchar_t tmp[MAX_SIZE]; - if (i == 1) - { - UniFormat(tmp, sizeof(tmp), _UU("CM_COPY_NAME_1"), old_name); - } - else - { - UniFormat(tmp, sizeof(tmp), _UU("CM_COPY_NAME_2"), i, old_name); - } - - if (LvSearchStr(hWnd, L_ACCOUNT, 0, tmp) == INFINITE) - { - UniStrCpy(name, size, tmp); - return; - } - } -} - -// Create a new account name -void CmGenerateNewAccountName(HWND hWnd, wchar_t *name, UINT size) -{ - UINT i; - // Validate arguments - if (name == NULL || hWnd == NULL) - { - return; - } - - for (i = 1;;i++) - { - wchar_t tmp[MAX_SIZE]; - if (i == 1) - { - UniFormat(tmp, sizeof(tmp), _UU("CM_NEW_ACCOUNT_NAME_1")); - } - else - { - UniFormat(tmp, sizeof(tmp), _UU("CM_NEW_ACCOUNT_NAME_2"), i); - } - - if (LvSearchStr(hWnd, L_ACCOUNT, 0, tmp) == INFINITE) - { - UniStrCpy(name, size, tmp); - return; - } - } -} - -// Show the policy list -void CmPolicyDlgPrint(HWND hWnd, CM_POLICY *p) -{ - CmPolicyDlgPrintEx(hWnd, p, false); -} -void CmPolicyDlgPrintEx(HWND hWnd, CM_POLICY *p, bool cascade_mode) -{ - CmPolicyDlgPrintEx2(hWnd, p, cascade_mode, POLICY_CURRENT_VERSION); -} -void CmPolicyDlgPrintEx2(HWND hWnd, CM_POLICY *p, bool cascade_mode, UINT ver) -{ - POLICY *pol; - UINT i; - LVB *b; - // Validate arguments - if (hWnd == NULL || p == NULL) - { - return; - } - - pol = p->Policy; - - b = LvInsertStart(); - - for (i = 0;i < NUM_POLICY_ITEM;i++) - { - wchar_t tmp[MAX_SIZE]; - - if (cascade_mode) - { - if (PolicyIsSupportedForCascade(i) == false) - { - continue; - } - } - - if (IS_POLICY_FOR_CURRENT_VER(i, ver)) - { - if (policy_item[i].TypeInt == false) - { - // bool type - UniStrCpy(tmp, sizeof(tmp), POLICY_BOOL(pol, i) ? _UU("POL_BOOL_ENABLE") : (p->Extension ? _UU("POL_BOOL_DISABLE_EX") : _UU("POL_BOOL_DISABLE"))); - } - else - { - // int type - if (policy_item[i].AllowZero && POLICY_INT(pol, i) == 0) - { - UniStrCpy(tmp, sizeof(tmp), _UU("POL_INT_ZERO")); - } - else - { - UniFormat(tmp, sizeof(tmp), _UU(policy_item[i].FormatStr), POLICY_INT(pol, i)); - } - } - - LvInsertAdd(b, ICO_MACHINE, (void *)i, 2, GetPolicyTitle(i), tmp); - } - } - - LvInsertEnd(b, hWnd, L_POLICY); -} - -// Policy list dialog box -UINT CmPolicyDlgProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param) -{ - CM_POLICY *p = (CM_POLICY *)param; - NMHDR *n; - // Validate arguments - if (hWnd == NULL) - { - return 0; - } - - switch (msg) - { - case WM_INITDIALOG: - FormatText(hWnd, 0, p->AccountName); - FormatText(hWnd, S_TITLE, p->AccountName); - p->hWnd = hWnd; - if (p->CmStatus != NULL) - { - p->CmStatus->hWndPolicy = hWnd; - } - - // Initialize the column - LvInit(hWnd, L_POLICY); - LvInsertColumn(hWnd, L_POLICY, 0, _UU("POL_TITLE_STR"), 375); - LvInsertColumn(hWnd, L_POLICY, 1, _UU("POL_VALUE_STR"), 100); - - // Display - CmPolicyDlgPrint(hWnd, p); - - // Select the first - LvSelect(hWnd, L_POLICY, 0); - break; - - case WM_COMMAND: - switch (wParam) - { - case IDOK: - case IDCANCEL: - Close(hWnd); - break; - } - break; - - case WM_NOTIFY: - n = (NMHDR *)lParam; - switch (n->idFrom) - { - case L_POLICY: - switch (n->code) - { - case LVN_ITEMCHANGED: - // Change selection - if (LvIsSelected(hWnd, L_POLICY) == false) - { - SetText(hWnd, S_DESCRIPTION, L""); - } - else - { - UINT index = LvGetSelected(hWnd, L_POLICY); - UINT id = (UINT)LvGetParam(hWnd, L_POLICY, index); - if (id < NUM_POLICY_ITEM) - { - SetText(hWnd, S_DESCRIPTION, GetPolicyDescription(id)); - } - } - break; - } - break; - } - break; - - case WM_CLOSE: - EndDialog(hWnd, 0); - break; - } - - LvSortHander(hWnd, msg, wParam, lParam, L_POLICY); - - return 0; -} - -// Show the policy list dialog -void CmPolicyDlg(HWND hWnd, CM_STATUS *st) -{ - RPC_CLIENT_GET_CONNECTION_STATUS s; - POLICY *policy; - CM_POLICY cp; - // Validate arguments - if (hWnd == NULL || st == NULL) - { - return; - } - - // Get the policy - Zero(&s, sizeof(s)); - UniStrCpy(s.AccountName, sizeof(s.AccountName), st->AccountName); - if (CALL(hWnd, CcGetAccountStatus(cm->Client, &s)) == false) - { - return; - } - if (s.Active == false) - { - return; - } - - policy = &s.Policy; - - Zero(&cp, sizeof(cp)); - UniStrCpy(cp.AccountName, sizeof(cp.AccountName), st->AccountName); - cp.Policy = policy; - cp.CmStatus = st; - - Dialog(hWnd, D_CM_POLICY, CmPolicyDlgProc, &cp); - - st->hWndPolicy = NULL; - - CiFreeClientGetConnectionStatus(&s); -} - -// Show the certificate -void CmStatusDlgPrintCert(HWND hWnd, CM_STATUS *st, bool server) -{ - RPC_CLIENT_GET_CONNECTION_STATUS s; - X *x, *issuer; - // Validate arguments - if (hWnd == NULL || st == NULL) - { - return; - } - - // Get the latest information - Zero(&s, sizeof(s)); - UniStrCpy(s.AccountName, sizeof(s.AccountName), st->AccountName); - if (CALL(hWnd, CcGetAccountStatus(cm->Client, &s)) == false) - { - Close(hWnd); - return; - } - - if (s.Active == false) - { - // Disconnect - Close(hWnd); - return; - } - - if (server == false) - { - // Show the client certificate - x = s.ClientX; - } - else - { - // Show the server certificate - x = s.ServerX; - } - - cm->WindowCount++; - issuer = CmGetIssuer(x); - CertDlg(hWnd, x, issuer, true); - FreeX(issuer); - cm->WindowCount--; - - CiFreeClientGetConnectionStatus(&s); -} - -// Show the information of the status dialog -void CmStatusDlgPrint(HWND hWnd, CM_STATUS *cmst) -{ - RPC_CLIENT_GET_CONNECTION_STATUS s; - LVB *b; - // Validate arguments - if (hWnd == NULL || cmst == NULL) - { - return; - } - - // Get the latest information - Zero(&s, sizeof(s)); - UniStrCpy(s.AccountName, sizeof(s.AccountName), cmst->AccountName); - if (CALL(hWnd, CcGetAccountStatus(cm->Client, &s)) == false) - { - Close(hWnd); - return; - } - - if (s.Active == false) - { - // Disconnect - Close(hWnd); - return; - } - - // Show the status in the list box in the status dialog - b = LvInsertStart(); - CmPrintStatusToListView(b, &s); - LvInsertEnd(b, hWnd, L_STATUS); - - LvAutoSize(hWnd, L_STATUS); - - SetEnable(hWnd, B_POLICY, s.Connected); - - SetEnable(hWnd, B_SERVER_CERT, s.ServerX != NULL); - SetEnable(hWnd, B_CLIENT_CERT, s.ClientX != NULL); - - CiFreeClientGetConnectionStatus(&s); -} - -// Show the status in the list box in the status dialog -void CmPrintStatusToListView(LVB *b, RPC_CLIENT_GET_CONNECTION_STATUS *s) -{ - CmPrintStatusToListViewEx(b, s, false); -} -void CmPrintStatusToListViewEx(LVB *b, RPC_CLIENT_GET_CONNECTION_STATUS *s, bool server_mode) -{ - wchar_t tmp[MAX_SIZE]; - char str[MAX_SIZE]; - char vv[128]; - // Validate arguments - if (b == NULL || s == NULL) - { - return; - } - - if (server_mode == false) - { - LvInsertAdd(b, 0, NULL, 2, _UU("CM_ST_ACCOUNT_NAME"), s->AccountName); - - if (s->Connected == false) - { - wchar_t *st = _UU("CM_ST_CONNECTED_FALSE"); - switch (s->SessionStatus) - { - case CLIENT_STATUS_CONNECTING: - st = _UU("CM_ST_CONNECTING"); - break; - case CLIENT_STATUS_NEGOTIATION: - st = _UU("CM_ST_NEGOTIATION"); - break; - case CLIENT_STATUS_AUTH: - st = _UU("CM_ST_AUTH"); - break; - case CLIENT_STATUS_ESTABLISHED: - st = _UU("CM_ST_ESTABLISHED"); - break; - case CLIENT_STATUS_RETRY: - st = _UU("CM_ST_RETRY"); - break; - case CLIENT_STATUS_IDLE: - st = _UU("CM_ST_IDLE"); - break; - } - LvInsertAdd(b, 0, NULL, 2, _UU("CM_ST_CONNECTED"), st); - } - else - { - LvInsertAdd(b, 0, NULL, 2, _UU("CM_ST_CONNECTED"), _UU("CM_ST_CONNECTED_TRUE")); - } - } - - if (s->Connected) - { - if (s->VLanId == 0) - { - UniStrCpy(tmp, sizeof(tmp), _UU("CM_ST_NO_VLAN")); - } - else - { - UniToStru(tmp, s->VLanId); - } - - LvInsertAdd(b, 0, NULL, 2, _UU("CM_ST_VLAN_ID"), tmp); - - if (server_mode == false) - { - StrToUni(tmp, sizeof(tmp), s->ServerName); - LvInsertAdd(b, 0, NULL, 2, _UU("CM_ST_SERVER_NAME"), tmp); - - UniFormat(tmp, sizeof(tmp), _UU("CM_ST_PORT_TCP"), s->ServerPort); - LvInsertAdd(b, 0, NULL, 2, _UU("CM_ST_SERVER_PORT"), tmp); - } - - StrToUni(tmp, sizeof(tmp), s->ServerProductName); - LvInsertAdd(b, 0, NULL, 2, _UU("CM_ST_SERVER_P_NAME"), tmp); - - UniFormat(tmp, sizeof(tmp), L"%u.%02u", s->ServerProductVer / 100, s->ServerProductVer % 100); - LvInsertAdd(b, 0, NULL, 2, _UU("CM_ST_SERVER_P_VER"), tmp); - UniFormat(tmp, sizeof(tmp), L"Build %u", s->ServerProductBuild); - LvInsertAdd(b, 0, NULL, 2, _UU("CM_ST_SERVER_P_BUILD"), tmp); - } - - GetDateTimeStrEx64(tmp, sizeof(tmp), SystemToLocal64(s->StartTime), NULL); - LvInsertAdd(b, 0, NULL, 2, _UU("CM_ST_START_TIME"), tmp); - GetDateTimeStrEx64(tmp, sizeof(tmp), SystemToLocal64(s->FirstConnectionEstablisiedTime), NULL); - /* !!! Do not correct the spelling to keep the backward protocol compatibility !!! */ - LvInsertAdd(b, 0, NULL, 2, _UU("CM_ST_FIRST_ESTAB_TIME"), s->FirstConnectionEstablisiedTime == 0 ? _UU("CM_ST_NONE") : tmp); - - if (s->Connected) - { - GetDateTimeStrEx64(tmp, sizeof(tmp), SystemToLocal64(s->CurrentConnectionEstablishTime), NULL); - LvInsertAdd(b, 0, NULL, 2, _UU("CM_ST_CURR_ESTAB_TIME"), tmp); - } - - if (server_mode == false) - { - UniFormat(tmp, sizeof(tmp), _UU("CM_ST_NUM_STR"), s->NumConnectionsEstablished); - LvInsertAdd(b, 0, NULL, 2, _UU("CM_ST_NUM_ESTABLISHED"), tmp); - } - - if (s->Connected) - { - LvInsertAdd(b, 0, NULL, 2, _UU("CM_ST_HALF_CONNECTION"), s->HalfConnection ? _UU("CM_ST_HALF_TRUE") : _UU("CM_ST_HALF_FALSE")); - - LvInsertAdd(b, 0, NULL, 2, _UU("CM_ST_QOS"), s->QoS ? _UU("CM_ST_QOS_TRUE") : _UU("CM_ST_QOS_FALSE")); - - UniFormat(tmp, sizeof(tmp), L"%u", s->NumTcpConnections); - LvInsertAdd(b, 0, NULL, 2, _UU("CM_ST_NUM_TCP"), tmp); - - if (s->HalfConnection) - { - UniFormat(tmp, sizeof(tmp), L"%u", s->NumTcpConnectionsUpload); - LvInsertAdd(b, 0, NULL, 2, _UU("CM_ST_NUM_TCP_UPLOAD"), tmp); - UniFormat(tmp, sizeof(tmp), L"%u", s->NumTcpConnectionsDownload); - LvInsertAdd(b, 0, NULL, 2, _UU("CM_ST_NUM_TCP_DOWNLOAD"), tmp); - } - - UniFormat(tmp, sizeof(tmp), L"%u", s->MaxTcpConnections); - LvInsertAdd(b, 0, NULL, 2, _UU("CM_ST_MAX_TCP"), tmp); - - if (s->UseEncrypt == false) - { - UniStrCpy(tmp, sizeof(tmp), _UU("CM_ST_USE_ENCRYPT_FALSE")); - } - else - { - if (StrLen(s->CipherName) != 0) - { - UniFormat(tmp, sizeof(tmp), _UU("CM_ST_USE_ENCRYPT_TRUE"), s->CipherName); - } - else - { - UniFormat(tmp, sizeof(tmp), _UU("CM_ST_USE_ENCRYPT_TRUE2")); - } - } - LvInsertAdd(b, 0, NULL, 2, _UU("CM_ST_USE_ENCRYPT"), tmp); - - if (s->UseCompress) - { - UINT percent = 0; - if ((s->TotalRecvSize + s->TotalSendSize) > 0) - { - percent = (UINT)((UINT64)100 - (UINT64)(s->TotalRecvSizeReal + s->TotalSendSizeReal) * (UINT64)100 / - (s->TotalRecvSize + s->TotalSendSize)); - percent = MAKESURE(percent, 0, 100); - } - - UniFormat(tmp, sizeof(tmp), _UU("CM_ST_COMPRESS_TRUE"), percent); - } - else - { - UniStrCpy(tmp, sizeof(tmp), _UU("CM_ST_COMPRESS_FALSE")); - } - LvInsertAdd(b, 0, NULL, 2, _UU("CM_ST_USE_COMPRESS"), tmp); - - if (IsEmptyStr(s->UnderlayProtocol) == false) - { - StrToUni(tmp, sizeof(tmp), s->UnderlayProtocol); - LvInsertAdd(b, 0, NULL, 2, _UU("CM_ST_UNDERLAY_PROTOCOL"), tmp); - } - - if (IsEmptyStr(s->ProtocolDetails) == false) - { - StrToUni(tmp, sizeof(tmp), s->ProtocolDetails); - LvInsertAdd(b, 0, NULL, 2, _UU("CM_ST_PROTOCOL_DETAILS"), tmp); - } - - LvInsertAdd(b, 0, NULL, 2, _UU("CM_ST_UDP_ACCEL_ENABLED"), (s->IsUdpAccelerationEnabled ? _UU("CM_ST_YES") : _UU("CM_ST_NO"))); - LvInsertAdd(b, 0, NULL, 2, _UU("CM_ST_UDP_ACCEL_USING"), (s->IsUsingUdpAcceleration ? _UU("CM_ST_YES") : _UU("CM_ST_NO"))); - - StrToUni(tmp, sizeof(tmp), s->SessionName); - LvInsertAdd(b, 0, NULL, 2, _UU("CM_ST_SESSION_NAME"), tmp); - - StrToUni(tmp, sizeof(tmp), s->ConnectionName); - if (UniStrCmpi(tmp, L"INITING") != 0) - { - LvInsertAdd(b, 0, NULL, 2, _UU("CM_ST_CONNECTION_NAME"), tmp); - } - - BinToStr(str, sizeof(str), s->SessionKey, sizeof(s->SessionKey)); - StrToUni(tmp, sizeof(tmp), str); - LvInsertAdd(b, 0, NULL, 2, _UU("CM_ST_SESSION_KEY"), tmp); - - LvInsertAdd(b, 0, NULL, 2, _UU("CM_ST_BRIDGE_MODE"), s->IsBridgeMode ? _UU("CM_ST_YES") : _UU("CM_ST_NO")); - - LvInsertAdd(b, 0, NULL, 2, _UU("CM_ST_MONITOR_MODE"), s->IsMonitorMode ? _UU("CM_ST_YES") : _UU("CM_ST_NO")); - - ToStr3(vv, sizeof(vv), s->TotalSendSize); - UniFormat(tmp, sizeof(tmp), _UU("CM_ST_SIZE_BYTE_STR"), vv); - LvInsertAdd(b, 0, NULL, 2, _UU("CM_ST_SEND_SIZE"), tmp); - - ToStr3(vv, sizeof(vv), s->TotalRecvSize); - UniFormat(tmp, sizeof(tmp), _UU("CM_ST_SIZE_BYTE_STR"), vv); - LvInsertAdd(b, 0, NULL, 2, _UU("CM_ST_RECV_SIZE"), tmp); - - ToStr3(vv, sizeof(vv), s->Traffic.Send.UnicastCount); - UniFormat(tmp, sizeof(tmp), _UU("CM_ST_NUM_PACKET_STR"), vv); - LvInsertAdd(b, 0, NULL, 2, _UU("CM_ST_SEND_UCAST_NUM"), tmp); - - ToStr3(vv, sizeof(vv), s->Traffic.Send.UnicastBytes); - UniFormat(tmp, sizeof(tmp), _UU("CM_ST_SIZE_BYTE_STR"), vv); - LvInsertAdd(b, 0, NULL, 2, _UU("CM_ST_SEND_UCAST_SIZE"), tmp); - - ToStr3(vv, sizeof(vv), s->Traffic.Send.BroadcastCount); - UniFormat(tmp, sizeof(tmp), _UU("CM_ST_NUM_PACKET_STR"), vv); - LvInsertAdd(b, 0, NULL, 2, _UU("CM_ST_SEND_BCAST_NUM"), tmp); - - ToStr3(vv, sizeof(vv), s->Traffic.Send.BroadcastBytes); - UniFormat(tmp, sizeof(tmp), _UU("CM_ST_SIZE_BYTE_STR"), vv); - LvInsertAdd(b, 0, NULL, 2, _UU("CM_ST_SEND_BCAST_SIZE"), tmp); - - ToStr3(vv, sizeof(vv), s->Traffic.Recv.UnicastCount); - UniFormat(tmp, sizeof(tmp), _UU("CM_ST_NUM_PACKET_STR"), vv); - LvInsertAdd(b, 0, NULL, 2, _UU("CM_ST_RECV_UCAST_NUM"), tmp); - - ToStr3(vv, sizeof(vv), s->Traffic.Recv.UnicastBytes); - UniFormat(tmp, sizeof(tmp), _UU("CM_ST_SIZE_BYTE_STR"), vv); - LvInsertAdd(b, 0, NULL, 2, _UU("CM_ST_RECV_UCAST_SIZE"), tmp); - - ToStr3(vv, sizeof(vv), s->Traffic.Recv.BroadcastCount); - UniFormat(tmp, sizeof(tmp), _UU("CM_ST_NUM_PACKET_STR"), vv); - LvInsertAdd(b, 0, NULL, 2, _UU("CM_ST_RECV_BCAST_NUM"), tmp); - - ToStr3(vv, sizeof(vv), s->Traffic.Recv.BroadcastBytes); - UniFormat(tmp, sizeof(tmp), _UU("CM_ST_SIZE_BYTE_STR"), vv); - LvInsertAdd(b, 0, NULL, 2, _UU("CM_ST_RECV_BCAST_SIZE"), tmp); - } -} - -// Status dialog procedure -UINT CmStatusDlgProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param) -{ - wchar_t tmp[MAX_SIZE]; - CM_STATUS *s = (CM_STATUS *)param; - // Validate arguments - if (hWnd == NULL) - { - return 0; - } - - switch (msg) - { - case WM_INITDIALOG: - SetIcon(hWnd, 0, ICO_TOWER); - UniFormat(tmp, sizeof(tmp), _UU("CM_ST_TITLE"), s->AccountName); - SetText(hWnd, 0, tmp); - FormatText(hWnd, S_TITLE, s->AccountName); - DlgFont(hWnd, S_TITLE, 0, 1); - - Add(cm->StatusWindowList, hWnd); - - SetTimer(hWnd, 1, 500, NULL); - - LvInitEx(hWnd, L_STATUS, true); - ListView_SetImageList(DlgItem(hWnd, L_STATUS), NULL, LVSIL_NORMAL); - ListView_SetImageList(DlgItem(hWnd, L_STATUS), NULL, LVSIL_SMALL); - LvInsertColumn(hWnd, L_STATUS, 0, _UU("CM_ST_COLUMN_1"), 160); - LvInsertColumn(hWnd, L_STATUS, 1, _UU("CM_ST_COLUMN_2"), 270); - - CmStatusDlgPrint(hWnd, s); - - break; - case WM_TIMER: - switch (wParam) - { - case 1: - KillTimer(hWnd, 1); - CmStatusDlgPrint(hWnd, s); - SetTimer(hWnd, 1, 500, NULL); - break; - } - break; - case WM_COMMAND: - switch (wParam) - { - case IDOK: - case IDCANCEL: - // Close - Close(hWnd); - break; - case B_POLICY: - // Show the policy - CmPolicyDlg(hWnd, s); - break; - case B_SERVER_CERT: - CmStatusDlgPrintCert(hWnd, s, true); - break; - case B_CLIENT_CERT: - CmStatusDlgPrintCert(hWnd, s, false); - break; - } - break; - case WM_CLOSE: - Delete(cm->StatusWindowList, hWnd); - if (s->hWndPolicy != NULL) - { - EndDialog(s->hWndPolicy, false); - s->hWndPolicy = NULL; - } - EndDialog(hWnd, false); - break; - } - - return 0; -} - -// Show the status dialog -void CmStatusDlg(HWND hWnd, wchar_t *account_name) -{ - CM_STATUS *s; - // Validate arguments - if (hWnd == NULL || account_name == NULL) - { - return; - } - - s = ZeroMalloc(sizeof(CM_STATUS)); - UniStrCpy(s->AccountName, sizeof(s->AccountName), account_name); - - Dialog(hWnd, D_CONNECTION_STATUS, CmStatusDlgProc, s); - - Free(s); -} - -// Show the status -void CmStatus(HWND hWnd, wchar_t *account_name) -{ - UINT i; - wchar_t tmp[MAX_SIZE]; - // Validate arguments - if (hWnd == NULL || account_name == NULL) - { - return; - } - - UniFormat(tmp, sizeof(tmp), _UU("CM_ST_TITLE"), account_name); - - for (i = 0;i < LIST_NUM(cm->StatusWindowList);i++) - { - HWND h = LIST_DATA(cm->StatusWindowList, i); - if (h != NULL) - { - wchar_t tmp2[MAX_SIZE]; - if (GetTxt(h, 0, tmp2, sizeof(tmp2))) - { - if (UniStrCmpi(tmp2, tmp) == 0) - { - SetActiveWindow(h); - return; - } - } - } - } - - CmStatusDlg(hWnd, account_name); -} - -// Delete -void CmDeleteAccount(HWND hWnd, wchar_t *account_name) -{ - RPC_CLIENT_DELETE_ACCOUNT c; - // Validate arguments - if (hWnd == NULL || account_name == NULL) - { - return; - } - Zero(&c, sizeof(c)); - UniStrCpy(c.AccountName, sizeof(c.AccountName), account_name); - - CmVoice("delete_config_1"); - if (MsgBoxEx(hWnd, MB_ICONQUESTION | MB_YESNO | MB_DEFBUTTON2, _UU("CM_DELETE_ACCOUNT_MSG"), account_name) - == IDNO) - { - return; - } - - CALL(hWnd, CcDeleteAccount(cm->Client, &c)); - CmVoice("delete_config_2"); -} - -// Disconnect -void CmDisconnect(HWND hWnd, wchar_t *account_name) -{ - RPC_CLIENT_CONNECT c; - // Validate arguments - if (hWnd == NULL || account_name == NULL) - { - return; - } - - Zero(&c, sizeof(c)); - UniStrCpy(c.AccountName, sizeof(c.AccountName), account_name); - - cm->PositiveDisconnectFlag = true; - - CALL(hWnd, CcDisconnect(cm->Client, &c)); -} - -// Show the promotional window -void SmShowPublicVpnServerHtml(HWND hWnd) -{ - char *langstr = _SS("LANGSTR"); - - if(StrCmpi(langstr, "Japanese") == 0) - { - ShowHtml(hWnd, PUBLIC_SERVER_HTML, PUBLIC_SERVER_TAG); - } - else - { - ShowHtml(hWnd, PUBLIC_SERVER_HTML_EN, PUBLIC_SERVER_TAG); - } -} - -// Connection -void CmConnect(HWND hWnd, wchar_t *account_name) -{ - RPC_CLIENT_CONNECT c; - UINT i; - // Validate arguments - if (hWnd == NULL || account_name == NULL) - { - return; - } - - if (IsEnable(hWnd, 0) == false) - { - return; - } - - if (hWnd == cm->hMainWnd) - { - if (LvNum(hWnd, L_VLAN) == 0 && cm->Client->Win9x) - { - if (MsgBox(hWnd, MB_ICONINFORMATION | MB_YESNO, _UU("CM_NO_VLAN_2")) == IDNO) - { - return; - } - else - { - if (cm->server_name == NULL || cm->Client->Unix) - { - Command(hWnd, CMD_NEW_VLAN); - return; - } - else - { - MsgBox(hWnd, MB_ICONINFORMATION, _UU("CM_VLAN_REMOTE_ERROR")); - } - return; - } - } - } - - // (If necessary) display a warning - if (CmWarningDesktop(hWnd, account_name) == false) - { - return; - } - - if (cm->server_name == NULL) - { - if (cm->BadProcessChecked == false) - { - cm->BadProcessChecked = true; - - CheckBadProcesses(hWnd); - } - } - - if (cm->server_name == NULL) - { - // Check the Windows version - RPC_WINVER winver; - wchar_t winver_msg_client[3800]; - - GetWinVer(&winver); - Zero(winver_msg_client, sizeof(winver_msg_client)); - - if (IsSupportedWinVer(&winver) == false) - { - SYSTEMTIME st; - - LocalTime(&st); - - UniFormat(winver_msg_client, sizeof(winver_msg_client), _UU("WINVER_ERROR_FORMAT"), - _UU("WINVER_ERROR_PC_LOCAL"), - winver.Title, - _UU("WINVER_ERROR_VPNCLIENT"), - SUPPORTED_WINDOWS_LIST, - _UU("WINVER_ERROR_PC_LOCAL"), - _UU("WINVER_ERROR_VPNCLIENT"), - _UU("WINVER_ERROR_VPNCLIENT"), - _UU("WINVER_ERROR_VPNCLIENT"), - st.wYear, st.wMonth); - } - - if (UniIsEmptyStr(winver_msg_client) == false) - { - OnceMsgEx(hWnd, _UU("WINVER_TITLE"), winver_msg_client, - true, ICO_WARNING, NULL); - } - } - - i = LvSearchStr(hWnd, L_ACCOUNT, 0, account_name); - if (i != INFINITE) - { - wchar_t *tmp = LvGetStr(hWnd, L_ACCOUNT, i, 2); - if (tmp != NULL) - { - wchar_t tag[MAX_SIZE]; - StrToUni(tag, sizeof(tag), PUBLIC_SERVER_NAME); - - if (UniSearchStrEx(tmp, tag, 0, false) != INFINITE) - { - SmShowPublicVpnServerHtml(hWnd); - } - - Free(tmp); - } - } - - if (cm->CheckedAndShowedAdminPackMessage == false) - { - cm->CheckedAndShowedAdminPackMessage = true; - //CmCheckAndShowAdminPackTrialVersionNoticeMessage(NULL); - } - - Zero(&c, sizeof(c)); - UniStrCpy(c.AccountName, sizeof(c.AccountName), account_name); - - CmSetForegroundProcessToCnService(); - - if (CALL(hWnd, CcConnect(cm->Client, &c))) - { - cm->ConnectStartedFlag = true; - } -} - -// Determine whether to bold the specified menu item -bool CmIsBold(UINT id) -{ - return false; -} - -// Determine whether to enable the specified menu item -bool CmIsEnabled(HWND hWnd, UINT id) -{ - UINT index; - wchar_t *name; - bool locked = false; - // Validate arguments - if (hWnd == NULL) - { - return false; - } - - locked = cm->CmSetting.LockMode; - - if (locked) - { - switch (id) - { - case CMD_NEW: - case CMD_CLONE: - case CMD_IMPORT_ACCOUNT: - case CMD_DELETE: - case CMD_OPTION: - case CMD_VOIDE_NONE: - case CMD_VOICE_NORMAL: - case CMD_VOICE_ODD: - case CMD_STARTUP: - case CMD_NOSTARTUP: - case CMD_TRAFFIC: - case CMD_MMCSS: - return false; - case CMD_NEW_VLAN: - case CMD_ENABLE_VLAN: - case CMD_DISABLE_VLAN: - case CMD_DELETE_VLAN: - case CMD_REINSTALL: - case CMD_WINNET: - if (cm->CmEasyModeSupported) - { - return false; - } - } - } - - switch (id) - { - case CMD_LANGUAGE: - return MsIsNt(); - case CMD_SHOWPORT: - case CMD_GRID: - if (cm->IconView) - { - return false; - } - return true; - case CMD_MMCSS: - if (MsIsVista() == false || IsEmptyStr(cm->server_name) == false) - { - return false; - } - if (OS_IS_SERVER(GetOsType())) - { - return false; - } - return true; - case CMD_TRAYICON: - case CMD_TRAFFIC: - return (cm->server_name == NULL); - case CMD_NETIF: - if (MsIsNt() == false) - { - return false; - } - return (cm->server_name == NULL); - case CMD_CM_SETTING: - return cm->CmSettingSupported; - case CMD_CONNECT: - case CMD_DISCONNECT: - case CMD_STATUS: - case CMD_RENAME: - case CMD_DELETE: - if (LvIsMultiMasked(hWnd, L_ACCOUNT)) - { - return false; - } - if (LvIsSelected(hWnd, L_ACCOUNT) == false) - { - return false; - } - else - { - // Determine whether the selected account is under connecting - UINT i = LvGetSelected(hWnd, L_ACCOUNT); - wchar_t *str = LvGetStr(hWnd, L_ACCOUNT, i, 1); - wchar_t *name = LvGetStr(hWnd, L_ACCOUNT, i, 0); - bool is_connected = false; - if (str != NULL) - { - if (UniStrCmpi(str, _UU("CM_ACCOUNT_ONLINE")) == 0 || UniStrCmpi(str, _UU("CM_ACCOUNT_CONNECTING")) == 0) - { - is_connected = true; - } - Free(str); - } - if (name != NULL) - { - if (UniStrCmpi(name, _UU("CM_NEW_ICON")) == 0 || UniStrCmpi(name, _UU("CM_VGC_ICON")) == 0 || UniStrCmpi(name, _UU("CM_VGC_LINK")) == 0) - { - Free(name); - return false; - } - Free(name); - } - if (id == CMD_CONNECT || id == CMD_RENAME || id == CMD_DELETE) - { - return !is_connected; - } - else - { - return is_connected; - } - } - break; - case CMD_DISCONNECT_ALL: - if (CmGetNumConnected(hWnd) == 0) - { - return false; - } - else - { - return true; - } - case CMD_SHORTCUT: - // Create a shortcut - if (cm->Client->Rpc->Sock->RemoteIP.addr[0] != 127) - { - return false; - } - case CMD_EXPORT_ACCOUNT: - if (LvIsMultiMasked(hWnd, L_ACCOUNT)) - { - return false; - } - name = LvGetSelectedStr(hWnd, L_ACCOUNT, 0); - if (name != NULL) - { - if (UniStrCmpi(name, _UU("CM_NEW_ICON")) == 0 || UniStrCmpi(name, _UU("CM_VGC_ICON")) == 0 || UniStrCmpi(name, _UU("CM_VGC_LINK")) == 0 - ) - { - Free(name); - return false; - } - Free(name); - } - return LvIsSelected(hWnd, L_ACCOUNT); - case CMD_CLONE: - if (LvIsMultiMasked(hWnd, L_ACCOUNT)) - { - return false; - } - name = LvGetSelectedStr(hWnd, L_ACCOUNT, 0); - if (name != NULL) - { - if (UniStrCmpi(name, _UU("CM_NEW_ICON")) == 0 || UniStrCmpi(name, _UU("CM_VGC_ICON")) == 0 || UniStrCmpi(name, _UU("CM_VGC_LINK")) == 0 - ) - { - Free(name); - return false; - } - Free(name); - } - return LvIsSelected(hWnd, L_ACCOUNT); - case CMD_STARTUP: - case CMD_NOSTARTUP: - name = LvGetSelectedStr(hWnd, L_ACCOUNT, 0); - if (name != NULL) - { - if (UniStrCmpi(name, _UU("CM_NEW_ICON")) == 0 || UniStrCmpi(name, _UU("CM_VGC_ICON")) == 0 || UniStrCmpi(name, _UU("CM_VGC_LINK")) == 0 - ) - { - Free(name); - return false; - } - Free(name); - } - if (LvIsMultiMasked(hWnd, L_ACCOUNT)) - { - return false; - } - if (LvIsSelected(hWnd, L_ACCOUNT) == false) - { - return false; - } - else - { - // Determine whether the selected account is a startup account - UINT i = LvGetSelected(hWnd, L_ACCOUNT); - bool is_startup = (bool)LvGetParam(hWnd, L_ACCOUNT, i); - if (id == CMD_STARTUP) - { - return !is_startup; - } - else - { - return is_startup; - } - } - break; - case CMD_NEW_VLAN: - if (cm->Client->Unix == false && cm->Client->Win9x == false) - { - if (cm->server_name != NULL) - { - return false; - } - } - if (cm->Client->Win9x) - { - if (LvNum(hWnd, L_VLAN) >= 1) - { - // You can not install two or more virtual LAN cards in Win9x - return false; - } - } - break; - case CMD_PROPERTY: - name = LvGetSelectedStr(hWnd, L_ACCOUNT, 0); - if (name != NULL) - { - if (UniStrCmpi(name, _UU("CM_NEW_ICON")) == 0 || UniStrCmpi(name, _UU("CM_VGC_ICON")) == 0 || UniStrCmpi(name, _UU("CM_VGC_LINK")) == 0) - { - Free(name); - return false; - } - Free(name); - } - if (LvIsMultiMasked(hWnd, L_ACCOUNT)) - { - return false; - } - return LvIsSelected(hWnd, L_ACCOUNT); - case CMD_DELETE_VLAN: - if (LvIsMultiMasked(hWnd, L_VLAN)) - { - return false; - } - return LvIsSelected(hWnd, L_VLAN); - case CMD_ENABLE_VLAN: - if (cm->Client->Win9x) - { - return false; - } - if (LvIsMultiMasked(hWnd, L_VLAN)) - { - return false; - } - index = LvGetSelected(hWnd, L_VLAN); - if (index == INFINITE) - { - return false; - } - else - { - wchar_t *s = LvGetStr(hWnd, L_VLAN, index, 1); - if (s != NULL) - { - if (UniStrCmpi(s, _UU("CM_VLAN_DISABLED")) == 0) - { - Free(s); - return true; - } - Free(s); - } - return false; - } - break; - case CMD_DISABLE_VLAN: - if (cm->Client->Win9x) - { - return false; - } - if (LvIsMultiMasked(hWnd, L_VLAN)) - { - return false; - } - index = LvGetSelected(hWnd, L_VLAN); - if (index == INFINITE) - { - return false; - } - else - { - wchar_t *s = LvGetStr(hWnd, L_VLAN, index, 1); - if (s != NULL) - { - if (UniStrCmpi(s, _UU("CM_VLAN_ENABLED")) == 0) - { - Free(s); - return true; - } - Free(s); - } - return false; - } - break; - case CMD_REINSTALL: - if (cm->server_name != NULL) - { - return false; - } - if (cm->Client->Win9x || cm->Client->Unix) - { - // Upgrading the virtual LAN card on a UNIX system or Win9x is unavailable - return false; - } - if (LvIsMultiMasked(hWnd, L_VLAN)) - { - return false; - } - return LvIsSelected(hWnd, L_VLAN); - case CMD_WINNET: - { - UINT os_type = GetOsInfo()->OsType; - - if (OS_IS_WINDOWS_NT(os_type) && GET_KETA(os_type, 100) >= 2) - { - if (cm->server_name != NULL) - { - return false; - } - - return true; - } - else - { - return false; - } - } - break; - case CMD_EXIT: - return cm->TrayInited; - } - return true; -} - -// Convert a VLAN device name to the display name -void CmVLanNameToPrintName(char *str, UINT size, char *name) -{ - // Validate arguments - if (str == NULL || name == NULL) - { - return; - } - - Format(str, size, VLAN_ADAPTER_NAME_TAG, name); -} - -// Convert a display name to a VLAN device name -bool CmPrintNameToVLanName(char *name, UINT size, char *str) -{ - // Validate arguments - if (name == NULL || str == NULL) - { - return false; - } - - if (StartWith(str, VLAN_ADAPTER_NAME)) - { - if (StrLen(str) < (StrLen(VLAN_ADAPTER_NAME) + 3)) - { - return false; - } - - StrCpy(name, size, str + StrLen(VLAN_ADAPTER_NAME) + 3); - - return true; - } - - if (StartWith(str, VLAN_ADAPTER_NAME_OLD)) - { - if (StrLen(str) < (StrLen(VLAN_ADAPTER_NAME_OLD) + 3)) - { - return false; - } - - StrCpy(name, size, str + StrLen(VLAN_ADAPTER_NAME_OLD) + 3); - - return true; - } - - return false; -} - -// Initialize the account list -void CmInitAccountList(HWND hWnd) -{ - CmInitAccountListEx(hWnd, false); -} -void CmInitAccountListEx(HWND hWnd, bool easy) -{ - UINT width[5]; - BUF *b; - // Validate arguments - if (hWnd == NULL) - { - return; - } - - // Read the setting - b = MsRegReadBin(REG_CURRENT_USER, CM_REG_KEY, "AccountListColumnWidth"); - if ((b != NULL) && (b->Size == sizeof(width))) - { - Copy(width, b->Buf, sizeof(width)); - } - else if ((b != NULL) && (b->Size == (sizeof(width) - sizeof(UINT)))) - { - // Migrating from previous versions - Zero(width, sizeof(width)); - Copy(width, b->Buf, sizeof(width) - sizeof(UINT)); - width[4] = width[3]; - width[3] = 0; - } - else - { - Zero(width, sizeof(width)); - } - FreeBuf(b); - - LvInitEx2(hWnd, L_ACCOUNT, false, easy); - -// LvSetStyle(hWnd, L_ACCOUNT, LVS_EX_TRACKSELECT); - - // Initialize the column - if (easy == false) - { - LvInsertColumn(hWnd, L_ACCOUNT, 0, _UU("CM_ACCOUNT_COLUMN_1"), width[0] == 0 ? 215 : width[0]); - LvInsertColumn(hWnd, L_ACCOUNT, 1, _UU("CM_ACCOUNT_COLUMN_2"), width[1] == 0 ? 80 : width[1]); - LvInsertColumn(hWnd, L_ACCOUNT, 2, _UU("CM_ACCOUNT_COLUMN_3"), width[2] == 0 ? 220 : width[2]); - LvInsertColumn(hWnd, L_ACCOUNT, 3, _UU("CM_ACCOUNT_COLUMN_3_2"), width[3] == 0 ? 90 : width[3]); - LvInsertColumn(hWnd, L_ACCOUNT, 4, _UU("CM_ACCOUNT_COLUMN_4"), (width[4] == 0 || width[4] == 250) ? 120 : width[4]); - } - else - { - LvInsertColumn(hWnd, L_ACCOUNT, 0, _UU("CM_ACCOUNT_COLUMN_1"), 345); - LvInsertColumn(hWnd, L_ACCOUNT, 1, _UU("CM_ACCOUNT_COLUMN_2"), 140); - LvInsertColumn(hWnd, L_ACCOUNT, 2, _UU("CM_ACCOUNT_COLUMN_3"), 0); - LvInsertColumn(hWnd, L_ACCOUNT, 3, _UU("CM_ACCOUNT_COLUMN_3_2"), 0); - LvInsertColumn(hWnd, L_ACCOUNT, 4, _UU("CM_ACCOUNT_COLUMN_4"), 0); - } -} - -// Release the account list -void CmSaveAccountListPos(HWND hWnd) -{ - UINT width[5]; - UINT i; - // Validate arguments - if (hWnd == NULL) - { - return; - } - - for (i = 0;i < 5;i++) - { - width[i] = LvGetColumnWidth(hWnd, L_ACCOUNT, i); - } - - MsRegWriteBin(REG_CURRENT_USER, CM_REG_KEY, "AccountListColumnWidth", width, sizeof(width)); -} - -// Initialize the VLAN list -void CmInitVLanList(HWND hWnd) -{ - UINT width[4]; - BUF *b; - // Validate arguments - if (hWnd == NULL) - { - return; - } - - // Read the setting - b = MsRegReadBin(REG_CURRENT_USER, CM_REG_KEY, "VLanListColumnWidth"); - if ((b != NULL) && (b->Size == sizeof(width))) - { - Copy(width, b->Buf, sizeof(width)); - } - else - { - Zero(width, sizeof(width)); - } - FreeBuf(b); - - LvInit(hWnd, L_VLAN); - -// LvSetStyle(hWnd, L_ACCOUNT, LVS_EX_TRACKSELECT); - - // Initialize the column - LvInsertColumn(hWnd, L_VLAN, 0, _UU("CM_VLAN_COLUMN_1"), width[0] == 0 ? 310 : width[0]); - LvInsertColumn(hWnd, L_VLAN, 1, _UU("CM_VLAN_COLUMN_2"), width[1] == 0 ? 120 : width[1]); - LvInsertColumn(hWnd, L_VLAN, 2, _UU("CM_VLAN_COLUMN_3"), width[2] == 0 ? 175 : width[2]); - LvInsertColumn(hWnd, L_VLAN, 3, _UU("CM_VLAN_COLUMN_4"), width[3] == 0 ? 120 : width[3]); -} - -// Release the VLAN list -void CmSaveVLanListPos(HWND hWnd) -{ - UINT width[4]; - UINT i; - // Validate arguments - if (hWnd == NULL) - { - return; - } - - for (i = 0;i < 4;i++) - { - width[i] = LvGetColumnWidth(hWnd, L_VLAN, i); - } - - MsRegWriteBin(REG_CURRENT_USER, CM_REG_KEY, "VLanListColumnWidth", width, sizeof(width)); -} - -// Update the account list -void CmRefreshAccountList(HWND hWnd) -{ - CmRefreshAccountListEx(hWnd, false); - CmRefreshEasy(); -} -void CmRefreshAccountListEx(HWND hWnd, bool easy) -{ - CmRefreshAccountListEx2(hWnd, easy, false); -} -void CmRefreshAccountListEx2(HWND hWnd, bool easy, bool style_changed) -{ - UINT num = 0; - RPC_CLIENT_ENUM_ACCOUNT a; - UINT num_connecting = 0, num_connected = 0; - wchar_t tmp[MAX_SIZE]; - wchar_t new_inserted_item[MAX_ACCOUNT_NAME_LEN + 1]; - bool select_new_inserted_item = true; - // Validate arguments - if (hWnd == NULL) - { - return; - } - - // Switching of icon / detail view - LvSetView(hWnd, L_ACCOUNT, cm->IconView == false || easy); - - // Show grid - if (cm->ShowGrid || easy) - { - LvSetStyle(hWnd, L_ACCOUNT, LVS_EX_GRIDLINES); - } - else - { - LvRemoveStyle(hWnd, L_ACCOUNT, LVS_EX_GRIDLINES); - } - - if (style_changed) - { - // Change the font - if (easy == false) - { - if (cm->VistaStyle) - { - SetFontMeiryo(hWnd, L_ACCOUNT, 9); - } - else - { - SetFontDefault(hWnd, L_ACCOUNT); - } - - if (cm->VistaStyle && (cm->IconView == false)) - { - LvSetStyle(hWnd, L_ACCOUNT, LVS_EX_FULLROWSELECT); - } - else - { - LvRemoveStyle(hWnd, L_ACCOUNT, LVS_EX_FULLROWSELECT); - } - } - } - - Zero(new_inserted_item, sizeof(new_inserted_item)); - - if (LvNum(hWnd, L_ACCOUNT) == 0) - { - select_new_inserted_item = false; - } - - // Enumerate the account list - if (CALL(hWnd, CcEnumAccount(cm->Client, &a))) - { - UINT i; - LVB *b = LvInsertStart(); - - if (cm->CmSetting.LockMode == false && (easy == false)) - { - // Creating a new connection - LvInsertAdd(b, ICO_NEW, NULL, 4, _UU("CM_NEW_ICON"), L"", L"", L""); - - if (cm->Client->IsVgcSupported) - { - // VPN Gate - LvInsertAdd(b, ICO_RESEARCH, NULL, 4, _UU("CM_VGC_ICON"), L"", L"", L""); - } - else if (cm->Client->ShowVgcLink) - { - // VPN Gate Link - LvInsertAdd(b, ICO_INTERNET, NULL, 4, _UU("CM_VGC_LINK"), L"", L"", L""); - } - } - - for (i = 0;i < a.NumItem;i++) - { - RPC_CLIENT_ENUM_ACCOUNT_ITEM *t = a.Items[i]; - UINT icon; - wchar_t tmp[MAX_SIZE]; - wchar_t tmp2[MAX_SIZE]; - char tmp3[MAX_SIZE]; - wchar_t tmp4[MAX_SIZE]; - IP ip; - char ip_str[MAX_SIZE]; - - // Special treatment in the case of IPv6 address - if (StrToIP6(&ip, t->ServerName) && StartWith(t->ServerName, "[") == false) - { - Format(ip_str, sizeof(ip_str), - "[%s]", t->ServerName); - } - else - { - StrCpy(ip_str, sizeof(ip_str), t->ServerName); - } - - // Determine the icon - if (t->Active == false) - { - if (t->StartupAccount == false) - { - icon = ICO_SERVER_OFFLINE; - } - else - { - icon = ICO_SERVER_OFFLINE_EX; - } - } - else - { - num++; - if (t->StartupAccount == false) - { - icon = ICO_SERVER_ONLINE; - } - else - { - icon = ICO_SERVER_ONLINE_EX; - } - } - - // Adding - if (easy == false) - { - //CmVLanNameToPrintName(tmp3, sizeof(tmp3), t->DeviceName); - StrCpy(tmp3, sizeof(tmp3), t->DeviceName); - StrToUni(tmp, sizeof(tmp), tmp3); - } - else - { - StrToUni(tmp, sizeof(tmp), t->DeviceName); - } - - if (t->Port == 0 || cm->ShowPort == false) - { - // Port number is unknown - UniFormat(tmp2, sizeof(tmp2), L"%S (%s)", ip_str, CmGetProtocolName(t->ProxyType)); - } - else - { - // Port number are also shown - UniFormat(tmp2, sizeof(tmp2), L"%S:%u (%s)", ip_str, t->Port, CmGetProtocolName(t->ProxyType)); - } - - if (LvSearchStr(hWnd, L_ACCOUNT, 0, t->AccountName) == INFINITE) - { - UniStrCpy(new_inserted_item, sizeof(new_inserted_item), t->AccountName); - } - - // Virtual HUB name - StrToUni(tmp4, sizeof(tmp4), t->HubName); - - if (easy == false) - { - LvInsertAdd(b, icon, (void *)t->StartupAccount, 5, t->AccountName, - t->Active == false ? _UU("CM_ACCOUNT_OFFLINE") : - (t->Connected ? _UU("CM_ACCOUNT_ONLINE") : _UU("CM_ACCOUNT_CONNECTING")), - tmp2, tmp4, - tmp); - } - else - { - LvInsertAdd(b, icon, (void *)t->StartupAccount, 5, t->AccountName, - t->Active == false ? _UU("CM_ACCOUNT_OFFLINE") : - (t->Connected ? _UU("CM_ACCOUNT_ONLINE") : _UU("CM_ACCOUNT_CONNECTING")), - tmp2, tmp4, - tmp); - } - - if (t->Active) - { - if (t->Connected) - { - num_connected++; - } - else - { - num_connecting++; - } - } - } - - LvInsertEnd(b, hWnd, L_ACCOUNT); - - CiFreeClientEnumAccount(&a); - - if (select_new_inserted_item) - { - if (UniStrLen(new_inserted_item) >= 1) - { - LvSelect(hWnd, L_ACCOUNT, INFINITE); - LvSelect(hWnd, L_ACCOUNT, LvSearchStr(hWnd, L_ACCOUNT, 0, new_inserted_item)); - } - } - } - - if (easy == false) - { - // For voice guidance, detect new connection and connection lost - if (cm->UpdateConnectedNumFlag == false) - { - cm->UpdateConnectedNumFlag = true; - cm->OldConnectedNum = num; - } - else - { - if (cm->OldConnectedNum != num) - { - if (cm->OldConnectedNum < num) - { - CmVoice("connect"); - } - else - { - CmVoice("disconnect"); - - if (cm->CmSetting.EasyMode && cm->PositiveDisconnectFlag == false) - { - CmShowEasy(); - } - - cm->PositiveDisconnectFlag = false; - } - cm->OldConnectedNum = num; - } - } - - if (num_connecting == 0 && num_connected == 0) - { - // There is no connecting or connected account - UniStrCpy(tmp, sizeof(tmp), _UU("CM_TRAY_NOT_CONNECTED")); - } - else if (num_connected == 0) - { - // There is only connecting account - UniFormat(tmp, sizeof(tmp), _UU("CM_TRAY_CONNECTED_1"), num_connecting); - } - else if (num_connecting == 0) - { - // There is only connected account - UniFormat(tmp, sizeof(tmp), _UU("CM_TRAY_CONNECTED_2"), num_connected); - } - else - { - // There are both - UniFormat(tmp, sizeof(tmp), _UU("CM_TRAY_CONNECTED_0"), num_connected, num_connecting); - } - - if (num_connecting == 0 && num_connected == 0) - { - cm->TrayAnimation = false; - cm->TraySpeedAnimation = false; - } - else - { - cm->TrayAnimation = true; - - if (num_connecting == 0) - { - cm->TraySpeedAnimation = false; - } - else - { - cm->TraySpeedAnimation = true; - } - } - - CmChangeTrayString(hWnd, tmp); - } - - Refresh(hWnd); - - //Updated the Jump List - CmUpdateJumpList(0); -} - -// Updating the VLAN list -void CmRefreshVLanList(HWND hWnd) -{ - CmRefreshVLanListEx(hWnd, false); -} -void CmRefreshVLanListEx(HWND hWnd, bool style_changed) -{ - RPC_CLIENT_ENUM_VLAN e; - // Validate arguments - if (hWnd == NULL) - { - return; - } - - LvSetView(hWnd, L_VLAN, cm->IconView == false); - - // Show grid - if (cm->ShowGrid) - { - LvSetStyle(hWnd, L_VLAN, LVS_EX_GRIDLINES); - } - else - { - LvRemoveStyle(hWnd, L_VLAN, LVS_EX_GRIDLINES); - } - - if (style_changed) - { - // Change the font - if (cm->VistaStyle) - { - SetFontMeiryo(hWnd, L_VLAN, 9); - } - else - { - SetFontDefault(hWnd, L_VLAN); - } - - if (cm->VistaStyle && (cm->IconView == false)) - { - LvSetStyle(hWnd, L_VLAN, LVS_EX_FULLROWSELECT); - } - else - { - LvRemoveStyle(hWnd, L_VLAN, LVS_EX_FULLROWSELECT); - } - } - - // Enumeration - Zero(&e, sizeof(e)); - if (CALL(hWnd, CcEnumVLan(cm->Client, &e))) - { - LVB *b = LvInsertStart(); - UINT i; - for (i = 0;i < e.NumItem;i++) - { - wchar_t name[MAX_SIZE]; - wchar_t mac[MAX_SIZE]; - wchar_t ver[MAX_SIZE]; - char str[MAX_SIZE]; - wchar_t *status; - RPC_CLIENT_ENUM_VLAN_ITEM *v = e.Items[i]; - - // Device name - CmVLanNameToPrintName(str, sizeof(str), v->DeviceName); - StrToUni(name, sizeof(name), str); - - // Status - status = v->Enabled ? _UU("CM_VLAN_ENABLED") : _UU("CM_VLAN_DISABLED"); - - // MAC address - StrToUni(mac, sizeof(mac), v->MacAddress); - - // Version - StrToUni(ver, sizeof(ver), v->Version); - - LvInsertAdd(b, v->Enabled ? ICO_NIC_ONLINE : ICO_NIC_OFFLINE, NULL, 4, - name, status, mac, ver); - } - LvInsertEnd(b, hWnd, L_VLAN); - - CiFreeClientEnumVLan(&e); - } -} - -// Get a protocol name string -wchar_t *CmGetProtocolName(UINT n) -{ - return GetProtocolName(n); -} - -// Display update -void CmRefresh(HWND hWnd) -{ - CmRefreshEx(hWnd, false); -} -void CmRefreshEx(HWND hWnd, bool style_changed) -{ - // Validate arguments - if (hWnd == NULL) - { - return; - } - - // Update size - CmMainWindowOnSize(hWnd); - - // Updating the VLAN list - CmRefreshVLanListEx(hWnd, style_changed); - - // Update the account list - CmRefreshAccountListEx2(hWnd, false, style_changed); - - // Update the status bar - CmRefreshStatusBar(hWnd); -} - -// Determine whether to check the specified menu item -bool CmIsChecked(UINT id) -{ - switch (id) - { - case CMD_TRAYICON: - return cm->HideTrayIcon == false; - case CMD_STATUSBAR: - return cm->HideStatusBar == false; - case CMD_VISTASTYLE: - return cm->VistaStyle; - case CMD_ICON: - return cm->IconView; - case CMD_DETAIL: - return cm->IconView == false; - case CMD_GRID: - return cm->ShowGrid; - case CMD_VOIDE_NONE: - return cm->DisableVoice; - case CMD_SHOWPORT: - return cm->ShowPort; - case CMD_VOICE_NORMAL: - if (cm->DisableVoice) - { - return false; - } - else - { - return cm->VoiceId == VOICE_SSK; - } - case CMD_VOICE_ODD: - if (cm->DisableVoice) - { - return false; - } - else - { - return cm->VoiceId == VOICE_AHO; - } - } - return false; -} - -// The menu popped-up -void CmMainWindowOnPopupMenu(HWND hWnd, HMENU hMenu, UINT pos) -{ - UINT num_menu, i, id; - // Validate arguments - if (hWnd == NULL || hMenu == NULL) - { - return; - } - - num_menu = GetMenuItemCount(hMenu); - for (i = 0;i < num_menu;i++) - { - id = GetMenuItemID(hMenu, i); - - if (id != INFINITE) - { - bool enable_flag = CmIsEnabled(hWnd, id); - bool checked_flag = CmIsChecked(id); - bool bold_flag = CmIsBold(id); - MENUITEMINFO info; - - Zero(&info, sizeof(info)); - info.cbSize = sizeof(info); - info.fMask = MIIM_STATE; - info.fState = (enable_flag ? MFS_ENABLED : MFS_DISABLED) | - (checked_flag ? MFS_CHECKED : MFS_UNCHECKED) | - (bold_flag ? MFS_DEFAULT : 0); - - if (id == CMD_ICON || id == CMD_DETAIL || id == CMD_VOIDE_NONE || - id == CMD_VOICE_NORMAL || id == CMD_VOICE_ODD) - { - info.fMask |= MIIM_FTYPE; - info.fType = MFT_RADIOCHECK; - } - - SetMenuItemInfo(hMenu, id, false, &info); - } - - if (id == CMD_RECENT) - { - HMENU sub = CmCreateRecentSubMenu(hWnd, CM_TRAY_MENU_RECENT_ID_START); - - if (sub != NULL) - { - DeleteMenu(hMenu, i, MF_BYPOSITION); - MsInsertMenu(hMenu, i, MF_BYPOSITION | MF_ENABLED | MF_POPUP | MF_STRING, - (UINT_PTR)sub, _UU("CM_TRAY_MENU_RECENT")); - } - else - { - MENUITEMINFO info; - - Zero(&info, sizeof(info)); - info.cbSize = sizeof(info); - info.fMask = MIIM_STATE; - info.fState = MFS_DISABLED; - - SetMenuItemInfo(hMenu, id, false, &info); - } - } - } -} - -// Set the main window title -wchar_t *CmGenerateMainWindowTitle() -{ - wchar_t tmp[MAX_SIZE]; - if (cm->server_name == NULL) - { - UniFormat(tmp, sizeof(tmp), L"%s", _UU("CM_TITLE")); - } - else - { - UniFormat(tmp, sizeof(tmp), L"%s - %S", _UU("CM_TITLE"), cm->server_name); - } - - return CopyUniStr(tmp); -} - -// Initialize the task tray -void CmInitTray(HWND hWnd) -{ - bool ret; - // Validate arguments - if (hWnd == NULL) - { - return; - } - - if (cm->server_name != NULL) - { - return; - } - - if (cm->TrayInited) - { - return; - } - - ret = MsShowIconOnTray(hWnd, LoadSmallIcon(CmGetTrayIconId(false, 0)), _UU("CM_TRAY_INITING"), WM_CM_TRAY_MESSAGE); - - cm->TrayInited = true; - cm->TrayAnimation = false; - cm->TraySucceed = ret; - - SetTimer(hWnd, 2, CM_TRAY_ANIMATION_INTERVAL / 4, NULL); -} - -// Change the string in the task tray -void CmChangeTrayString(HWND hWnd, wchar_t *str) -{ - // Validate arguments - if (hWnd == NULL || str == NULL) - { - return; - } - if (cm->TrayInited == false) - { - return; - } - - MsChangeIconOnTray(NULL, str); -} - -// Release the task tray -void CmFreeTray(HWND hWnd) -{ - // Validate arguments - if (hWnd == NULL) - { - return; - } - - if (cm->TrayInited == false) - { - return; - } - - MsHideIconOnTray(); - - cm->TrayInited = false; -} -void CmFreeTrayExternal(void *hWnd) -{ - CmFreeTray((HWND)hWnd); -} - -// Periodical processing to the task tray -void CmPollingTray(HWND hWnd) -{ - UINT interval; - bool ret; - // Validate arguments - if (hWnd == NULL) - { - return; - } - - if (cm->TrayInited == false) - { - return; - } - - ret = MsChangeIconOnTrayEx(LoadSmallIcon(CmGetTrayIconId(cm->TrayAnimation, cm->TrayAnimationCounter)), - NULL, NULL, NULL, NIIF_NONE, !cm->TraySucceed); - - if (cm->TraySucceed == false) - { - cm->TraySucceed = ret; - } - - cm->TrayAnimationCounter++; - - KillTimer(hWnd, 2); - interval = CM_TRAY_ANIMATION_INTERVAL / 4; - if (cm->TraySpeedAnimation) - { - interval /= 4; - } - SetTimer(hWnd, 2, interval, NULL); -} - -// Get the icon ID of the task tray for animation -UINT CmGetTrayIconId(bool animation, UINT animation_counter) -{ - if (animation == false) - { - return ICO_TRAY0; - } - else - { - switch (animation_counter % 4) - { - case 0: - return ICO_TRAY1; - - case 1: - return ICO_TRAY2; - - case 2: - return ICO_TRAY3; - - default: - return ICO_TRAY4; - } - } -} - -// Initialize the main window -void CmMainWindowOnInit(HWND hWnd) -{ - wchar_t *s; - BUF *b; - bool startup_mode = cm->StartupMode; - CM_SETTING a; - bool fake = false; - // Validate arguments - if (hWnd == NULL) - { - return; - } - - // Font settings of list - SetFontMeiryo(hWnd, L_ACCOUNT, 9); - SetFontMeiryo(hWnd, L_VLAN, 9); - - // Get the configuration of the current vpnclient - Zero(&a, sizeof(a)); - CcGetCmSetting(cm->Client, &a); - - if (a.EasyMode) - { - fake = true; - } - - InitMenuInternational(GetMenu(hWnd), "CM_MENU"); - - cm->HideStatusBar = MsRegReadInt(REG_CURRENT_USER, CM_REG_KEY, "HideStatusBar"); - cm->HideTrayIcon = MsRegReadInt(REG_CURRENT_USER, CM_REG_KEY, "HideTrayIcon"); - cm->IconView = MsRegReadInt(REG_CURRENT_USER, CM_REG_KEY, "IconView"); - cm->ShowGrid = MsRegReadInt(REG_CURRENT_USER, CM_REG_KEY, "ShowGrid"); - - if (MsRegIsValue(REG_CURRENT_USER, CM_REG_KEY, "VistaStyle")) - { - cm->VistaStyle = MsRegReadInt(REG_CURRENT_USER, CM_REG_KEY, "VistaStyle"); - } - else - { - cm->VistaStyle = MsIsVista(); - } - - if (MsRegIsValue(REG_CURRENT_USER, CM_REG_KEY, "ShowPort")) - { - cm->ShowPort = MsRegReadInt(REG_CURRENT_USER, CM_REG_KEY, "ShowPort"); - } - else - { - cm->ShowPort = false; - } - - if (MsRegIsValue(REG_CURRENT_USER, CM_REG_KEY, "DisableVoice")) - { - cm->DisableVoice = MsRegReadInt(REG_CURRENT_USER, CM_REG_KEY, "DisableVoice"); - } - else - { - cm->DisableVoice = true; - } - cm->VoiceId = MsRegReadInt(REG_CURRENT_USER, CM_REG_KEY, "VoiceId"); - - cm->StatusWindowList = NewList(NULL); - - SetIcon(hWnd, 0, ICO_VPN); - - s = CmGenerateMainWindowTitle(); - SetText(hWnd, 0, s); - Free(s); - - // Initialize the window position - b = MsRegReadBin(REG_CURRENT_USER, CM_REG_KEY, "WindowPlacement"); - if (b != NULL && b->Size == sizeof(WINDOWPLACEMENT)) - { - // Restore the window position - WINDOWPLACEMENT *p; - p = ZeroMalloc(b->Size); - Copy(p, b->Buf, b->Size); - - if (startup_mode) - { - p->showCmd = SW_SHOWMINIMIZED; - } - - if (fake) - { - Copy(&cm->FakeWindowPlacement, p, sizeof(WINDOWPLACEMENT)); - } - else - { - SetWindowPlacement(hWnd, p); - } - Free(p); - } - else - { - // Initialize the window position - SetWindowPos(hWnd, NULL, 0, 0, CM_DEFAULT_WIDTH, CM_DEFAULT_HEIGHT, SWP_NOREDRAW); - Center(hWnd); - if (startup_mode) - { - ShowWindow(hWnd, SW_SHOWMINIMIZED); - } - - if (fake) - { - WINDOWPLACEMENT p; - - Zero(&p, sizeof(p)); - p.length = sizeof(p); - GetWindowPlacement(hWnd, &p); - Copy(&cm->FakeWindowPlacement, &p, sizeof(WINDOWPLACEMENT)); - } - } - FreeBuf(b); - - if (fake) - { - SetWindowPos(hWnd, NULL, -200, -200, 100, 100, - SWP_NOREDRAW | SWP_SHOWWINDOW); - } - - // Initialize the status bar related items - cm->hMainWnd = hWnd; - cm->hStatusBar = CreateStatusWindowW(WS_CHILD | - (cm->HideStatusBar == false ? WS_VISIBLE : 0), - _UU("CM_TITLE"), - hWnd, S_STATUSBAR); - - UniStrCpy(cm->StatudBar1, sizeof(cm->StatudBar1), _UU("CM_TITLE")); - UniStrCpy(cm->StatudBar2, sizeof(cm->StatudBar2), _UU("CM_CONN_NO")); - UniFormat(cm->StatudBar3, sizeof(cm->StatudBar3), _UU("CM_PRODUCT_NAME"), CEDAR_VERSION_BUILD); - - cm->Icon2 = LoadSmallIcon(ICO_SERVER_OFFLINE); - cm->Icon3 = LoadSmallIcon(ICO_VPN); - - // Initialize the account list - CmInitAccountList(hWnd); - - // Initialize the VLAN list - CmInitVLanList(hWnd); - - // Display update - CmRefreshEx(hWnd, true); - - // Start a thread of notification client - CmInitNotifyClientThread(); - - // Timer setting - SetTimer(hWnd, 1, 128, NULL); - SetTimer(hWnd, 6, 5000, NULL); - - // Initialize the task tray - if (cm->server_name == NULL) - { - if (cm->HideTrayIcon == false) - { - CmInitTray(hWnd); - } - } - - CmVoice("start"); - - if (startup_mode || a.EasyMode) - { - SetTimer(hWnd, 3, 1, NULL); - } - - if (cm->import_file_name != NULL) - { - // Import a file specified as an argument - CmSendImportMessage(hWnd, cm->import_file_name, cm->CmSettingInitialFlag == CM_SETTING_INIT_NONE ? CM_IMPORT_FILENAME_MSG : CM_IMPORT_FILENAME_MSG_OVERWRITE); - /*if (a.LockMode == false) - { - CmImportAccountMainEx(hWnd, cm->import_file_name, cm->CmSettingInitialFlag != CM_SETTING_INIT_NONE); - } - else - { - MsgBox(cm->hEasyWnd ? cm->hEasyWnd : hWnd, MB_ICONEXCLAMATION, _UU("CM_VPN_FILE_IMPORT_NG")); - }*/ - } - - // Apply the CM_SETTING - CmApplyCmSetting(); - - cm->StartupFinished = true; -} - -// Start a thread of notification client -void CmInitNotifyClientThread() -{ - cm->NotifyClient = CcConnectNotify(cm->Client); - if (cm->NotifyClient == false) - { - Close(cm->hMainWnd); - exit(0); - } - cm->NotifyClientThread = NewThread(CmNotifyClientThread, NULL); -} - -// Notification client thread -void CmNotifyClientThread(THREAD *thread, void *param) -{ - NOTIFY_CLIENT *nc; - // Validate arguments - if (thread == NULL) - { - return; - } - - nc = cm->NotifyClient; - - // Wait for the next notification - while (cm->Halt == false) - { - if (CcWaitNotify(nc)) - { - // Send a message - PostMessage(cm->hMainWnd, WM_CM_NOTIFY, 0, 0); - } - else - { - // Disconnected - if (cm->Halt == false) - { - if (cm != NULL) - { - CmFreeTrayExternal((void *)cm->hMainWnd); - } - CncExit(); - exit(0); - } - break; - } - } -} - -// Stop the thread of the notification client -void CmFreeNotifyClientThread() -{ - cm->Halt = true; - - // Disconnect - CcStopNotify(cm->NotifyClient); - - // Wait for the termination of the thread - WaitThread(cm->NotifyClientThread, INFINITE); - - // Connection termination - CcDisconnectNotify(cm->NotifyClient); - ReleaseThread(cm->NotifyClientThread); -} - -// Resize the main window -void CmMainWindowOnSize(HWND hWnd) -{ - RECT r; - UINT client_width, client_height; - UINT status_height; - // Validate arguments - if (hWnd == NULL) - { - return; - } - - // Get the size of the client area of the main window - GetClientRect(hWnd, &r); - client_width = MAX(r.right - r.left, 0); - client_height = MAX(r.bottom - r.top, 0); - - SendMsg(hWnd, S_STATUSBAR, WM_SIZE, 0, 0); - - // Get the size of the status bar - GetWindowRect(DlgItem(hWnd, S_STATUSBAR), &r); - status_height = MAX(r.bottom - r.top, 0); - - if (cm->HideStatusBar == false) - { - client_height = MAX(client_height - status_height, 0); - } - - MoveWindow(DlgItem(hWnd, L_ACCOUNT), 0, 0, client_width, client_height * 3 / 5 - 3, true); - MoveWindow(DlgItem(hWnd, L_VLAN), 0, client_height * 3 / 5, client_width, client_height * 2 / 5, true); - - // Re-draw the status bar - CmRedrawStatusBar(hWnd); -} - -// Disconnect all accounts currently connected -void CmDisconnectAll(HWND hWnd) -{ - UINT i, num; - LIST *o; - // Validate arguments - if (hWnd == NULL) - { - return; - } - - // Display a warning - num = CmGetNumConnected(hWnd); - if (num == 0) - { - return; - } - - if (MsgBoxEx(hWnd, MB_ICONEXCLAMATION | MB_YESNO | MB_DEFBUTTON2, _UU("CM_DISCONNECT_ALL"), num) == IDNO) - { - return; - } - - cm->PositiveDisconnectFlag = true; - - // Create a list of connected items - o = NewListFast(NULL); - - num = LvNum(hWnd, L_ACCOUNT); - for (i = 0;i < num;i++) - { - wchar_t *s = LvGetStr(hWnd, L_ACCOUNT, i, 1); - if (s != NULL) - { - if (UniStrCmpi(s, _UU("CM_ACCOUNT_ONLINE")) == 0 || UniStrCmpi(s, _UU("CM_ACCOUNT_CONNECTING")) == 0) - { - Add(o, LvGetStr(hWnd, L_ACCOUNT, i, 0)); - } - Free(s); - } - } - - for (i = 0;i < LIST_NUM(o);i++) - { - wchar_t *s = LIST_DATA(o, i); - if (s != NULL) - { - CmDisconnect(hWnd, s); - Free(s); - } - } - - ReleaseList(o); -} - -// Get a number of currently connected connection settings -UINT CmGetNumConnected(HWND hWnd) -{ - UINT i, num, num_active; - // Validate arguments - if (hWnd == NULL) - { - return 0; - } - - num_active = 0; - num = LvNum(hWnd, L_ACCOUNT); - for (i = 0;i < num;i++) - { - wchar_t *s = LvGetStr(hWnd, L_ACCOUNT, i, 1); - if (s != NULL) - { - if (UniStrCmpi(s, _UU("CM_ACCOUNT_ONLINE")) == 0 || UniStrCmpi(s, _UU("CM_ACCOUNT_CONNECTING")) == 0) - { - num_active++; - } - Free(s); - } - } - - return num_active; -} - -// Update the status bar information -void CmRefreshStatusBar(HWND hWnd) -{ - UINT num_active = CmGetNumConnected(hWnd); - // Validate arguments - if (hWnd == NULL) - { - return; - } - - if (num_active == 0) - { - UniStrCpy(cm->StatudBar2, sizeof(cm->StatudBar2), _UU("CM_CONN_NO")); - cm->Icon2 = LoadSmallIcon(ICO_SERVER_OFFLINE); - } - else - { - UniFormat(cm->StatudBar2, sizeof(cm->StatudBar2), _UU("CM_NUM_CONN_COUNT"), num_active); - cm->Icon2 = LoadSmallIcon(ICO_SERVER_ONLINE); - } - - CmRedrawStatusBar(hWnd); -} - -// Re-draw the status bar -void CmRedrawStatusBar(HWND hWnd) -{ - HWND h; - RECT r; - int width; - int x1, x2, x3; - int xx[3]; - wchar_t tmp[MAX_SIZE]; - HICON icon; - // Validate arguments - if (hWnd == NULL) - { - return; - } - - h = cm->hStatusBar; - - // Get the width of the status bar - GetWindowRect(h, &r); - width = MAX(r.right - r.left, 0); - x2 = (UINT)(180.0 * GetTextScalingFactor()); - x3 = (UINT)(245.0 * GetTextScalingFactor()); - x1 = MAX(width - x2 - x3, 0); - - // Divide into three parts - xx[0] = x1; - xx[1] = x2 + x1; - xx[2] = x3 + x2 + x1; - SendMsg(h, 0, SB_SETPARTS, 3, (LPARAM)xx); - - // Set an icon - icon = (HICON)SendMsg(h, 0, SB_GETICON, 1, 0); - if (icon != cm->Icon2) - { - SendMsg(h, 0, SB_SETICON, 1, (LPARAM)cm->Icon2); - } - - icon = (HICON)SendMsg(h, 0, SB_GETICON, 2, 0); - if (icon != cm->Icon3) - { - SendMsg(h, 0, SB_SETICON, 2, (LPARAM)cm->Icon3); - } - - // Set a string - SendMsg(h, 0, SB_GETTEXTW, 0, (LPARAM)tmp); - if (UniStrCmp(tmp, cm->StatudBar1)) - { - SendMsg(h, 0, SB_SETTEXTW, 0, (LPARAM)cm->StatudBar1); - } - - SendMsg(h, 0, SB_GETTEXTW, 1, (LPARAM)tmp); - if (UniStrCmp(tmp, cm->StatudBar2)) - { - SendMsg(h, 0, SB_SETTEXTW, 1, (LPARAM)cm->StatudBar2); - } - - SendMsg(h, 0, SB_GETTEXTW, 2, (LPARAM)tmp); - if (UniStrCmp(tmp, cm->StatudBar3)) - { - SendMsg(h, 0, SB_SETTEXTW, 2, (LPARAM)cm->StatudBar3); - } -} - -// Save the position information of the main window -void CmSaveMainWindowPos(HWND hWnd) -{ - WINDOWPLACEMENT p; - // Validate arguments - if (hWnd == NULL) - { - return; - } - - // Save settings - MsRegWriteInt(REG_CURRENT_USER, CM_REG_KEY, "HideStatusBar", cm->HideStatusBar); - MsRegWriteInt(REG_CURRENT_USER, CM_REG_KEY, "HideTrayIcon", cm->HideTrayIcon); - MsRegWriteInt(REG_CURRENT_USER, CM_REG_KEY, "IconView", cm->IconView); - MsRegWriteInt(REG_CURRENT_USER, CM_REG_KEY, "ShowGrid", cm->ShowGrid); - MsRegWriteInt(REG_CURRENT_USER, CM_REG_KEY, "DisableVoice", cm->DisableVoice); - MsRegWriteInt(REG_CURRENT_USER, CM_REG_KEY, "VoiceId", cm->VoiceId); - MsRegWriteInt(REG_CURRENT_USER, CM_REG_KEY, "VistaStyle", cm->VistaStyle); - MsRegWriteInt(REG_CURRENT_USER, CM_REG_KEY, "ShowPort", cm->ShowPort); - - // Save the window position - Zero(&p, sizeof(p)); - p.length = sizeof(p); - GetWindowPlacement(hWnd, &p); - - if (IsZero(&cm->FakeWindowPlacement, sizeof(cm->FakeWindowPlacement)) == false) - { - Copy(&p, &cm->FakeWindowPlacement, sizeof(cm->FakeWindowPlacement)); - } - - MsRegWriteBin(REG_CURRENT_USER, CM_REG_KEY, "WindowPlacement", &p, sizeof(p)); - - CmSaveAccountListPos(hWnd); - CmSaveVLanListPos(hWnd); -} - -// Close the main window -void CmMainWindowOnQuit(HWND hWnd) -{ - UINT i; - // Validate arguments - if (hWnd == NULL) - { - return; - } - - if (cm->TrayInited) - { - if (MsgBox(hWnd, MB_YESNO | MB_ICONQUESTION, - _UU("CM_EXIT_MESSAGE")) == IDNO) - { - return; - } - } - - if (cm->OnCloseDispatched) - { - return; - } - cm->OnCloseDispatched = true; - - CmCloseEasy(); - - // Release the tray icon - CmFreeTray(hWnd); - - // Save the position information of the main window - CmSaveMainWindowPos(hWnd); - - // Close the status window - for (i = 0;i < LIST_NUM(cm->StatusWindowList);i++) - { - HWND h = LIST_DATA(cm->StatusWindowList, i); - //EndDialog(h, 0); - PostMessage(h, WM_CLOSE, 0, 0); - } - - ReleaseList(cm->StatusWindowList); - cm->StatusWindowList = NULL; - - if (cm->WindowCount != 0) - { - // Abort - exit(0); - } - - // Close - CmFreeNotifyClientThread(); - - EndDialog(hWnd, false); -} - -// Start the mutex to be used in starting -bool CmStartStartupMutex() -{ - INSTANCE *o = NewSingleInstance(STARTUP_MUTEX_NAME); - - if (o == NULL) - { - return false; - } - - cm->StartupMutex = o; - - return true; -} - -// Release the mutex to be used in starting -void CmEndStartupMutex() -{ - if (cm->StartupMutex != NULL) - { - FreeSingleInstance(cm->StartupMutex); - - cm->StartupMutex = NULL; - } -} - -// Main window -void MainCMWindow() -{ - HWND h; - wchar_t *s; - CM_SETTING a; - - if (CmStartStartupMutex() == false) - { - return; - } - - s = CmGenerateMainWindowTitle(); - h = SearchWindow(s); - Free(s); - - Zero(&a, sizeof(a)); - CcGetCmSetting(cm->Client, &a); - if (cm->server_name != NULL && a.EasyMode) - { - CmEndStartupMutex(); - MsgBox(NULL, MB_ICONEXCLAMATION, _UU("CM_EASY_MODE_NOT_ON_REMOTE")); - return; - } - - // Change the operating mode - if (cm->CmSettingSupported) - { - if (cm->CmSettingInitialFlag == CM_SETTING_INIT_SELECT) - { - if (h != NULL) - { - CmEndStartupMutex(); - } - - // Show the selection screen - CmSetting(NULL); - - if (h != NULL) - { - goto SEND_MESSAGES; - } - else - { - return; - } - } - else if ((cm->CmSettingInitialFlag == CM_SETTING_INIT_EASY && cm->CmEasyModeSupported) || cm->CmSettingInitialFlag == CM_SETTING_INIT_NORMAL) - { - // State transition - CM_SETTING a; - - Zero(&a, sizeof(a)); - CcGetCmSetting(cm->Client, &a); - - if (cm->CmSettingInitialFlag == CM_SETTING_INIT_EASY) - { - a.EasyMode = true; - } - else - { - a.EasyMode = false; - } - - CcSetCmSetting(cm->Client, &a); - } - } - - if (h == NULL) - { - // Create a window because there is no window of the same title - if (cm->server_name == NULL) - { - CmInitTryToExecUiHelper(); - - if (IsDebug() == false) - { - CnWaitForCnServiceReady(); - } - } - Dialog(NULL, D_CM_MAIN, CmMainWindowProc, NULL); - CmFreeTryToExecUiHelper(); - } - else - { -SEND_MESSAGES: - CmEndStartupMutex(); - - // If a window of the same title already exists, activate it and exit itself - SetForegroundWindow(h); - SendMessage(h, WM_CM_SHOW, 0, 0); - SetForegroundWindow(h); - - if (cm->CmSettingInitialFlag != CM_SETTING_INIT_NONE && cm->CmSettingInitialFlag != CM_SETTING_INIT_CONNECT) - { - // Notify since CM_SETTING has been changed - SendMessage(h, WM_CM_SETTING_CHANGED_MESSAGE, 0, 0); - } - - if (cm->import_file_name != NULL) - { - UINT msg; - if (cm->CmSettingInitialFlag == CM_SETTING_INIT_NONE) - { - msg = CM_IMPORT_FILENAME_MSG; - } - else - { - msg = CM_IMPORT_FILENAME_MSG_OVERWRITE; - } - - CmSendImportMessage(h, cm->import_file_name, msg); - } - } - - CmEndStartupMutex(); -} - -// Send an import message -void CmSendImportMessage(HWND hWnd, wchar_t *filename, UINT msg) -{ - COPYDATASTRUCT cpy; - // Validate arguments - if (hWnd == NULL || filename == NULL) - { - return; - } - - // Specify the file to be imported - Zero(&cpy, sizeof(cpy)); - - cpy.cbData = UniStrSize(filename); - cpy.lpData = filename; - cpy.dwData = msg; - - SendMessage(hWnd, WM_COPYDATA, 0, (LPARAM)&cpy); -} - -// Login dialog -UINT CmLoginDlgProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param) -{ - // Validate arguments - wchar_t server_name[MAX_SIZE]; - char password[MAX_PASSWORD_LEN + 1]; - bool bad_pass; - if (hWnd == NULL) - { - return 0; - } - - switch (msg) - { - case WM_INITDIALOG: - if (cm->server_name != NULL) - { - StrToUni(server_name, sizeof(server_name), cm->server_name); - } - else - { - UniStrCpy(server_name, sizeof(server_name), _UU("CM_PW_LOCALMACHINE")); - } - FormatText(hWnd, S_TITLE, server_name); - break; - - case WM_COMMAND: - switch (wParam) - { - case IDOK: - if (cm->server_name != NULL) - { - StrToUni(server_name, sizeof(server_name), cm->server_name); - } - else - { - UniStrCpy(server_name, sizeof(server_name), _UU("CM_PW_LOCALMACHINE")); - } - GetTxtA(hWnd, E_PASSWORD, password, sizeof(password)); - cm->Client = CcConnectRpc(cm->server_name == NULL ? "127.0.0.1" : cm->server_name, - password, &bad_pass, NULL, 0); - if (cm->Client == NULL) - { - MsgBox(hWnd, MB_ICONSTOP, _UU("CM_BAD_PASSWORD")); - FocusEx(hWnd, E_PASSWORD); - } - else - { - EndDialog(hWnd, true); - } - break; - case IDCANCEL: - Close(hWnd); - break; - } - break; - - case WM_CLOSE: - EndDialog(hWnd, false); - break; - } - - return 0; -} - -// Login -bool LoginCM() -{ - // Try to login with an empty password first - bool bad_pass, no_remote; - wchar_t server_name[MAX_SIZE]; - RPC_CLIENT_VERSION a; - -RETRY: - if (cm->server_name != NULL) - { - StrToUni(server_name, sizeof(server_name), cm->server_name); - } - else - { - UniStrCpy(server_name, sizeof(server_name), _UU("CM_PW_LOCALMACHINE")); - } - - // Attempt to connect - if ((cm->Client = CcConnectRpc( - cm->server_name == NULL ? "localhost" : cm->server_name, - cm->password == NULL ? "" : cm->password, &bad_pass, &no_remote, cm->StartupMode == false ? 0 : 60000)) == NULL) - { - if (no_remote) - { - // Remote connection was denied - if (MsgBoxEx(NULL, MB_ICONEXCLAMATION | MB_RETRYCANCEL, _UU("CM_NO_REMOTE"), server_name) == IDRETRY) - { - // Retry - goto RETRY; - } - else - { - return false; - } - } - else if (bad_pass) - { - if (Dialog(NULL, D_CM_LOGIN, CmLoginDlgProc, NULL) == false) - { - return false; - } - } - else - { - // Connection failure - if (cm->StartupMode == false && MsgBoxEx(NULL, MB_ICONEXCLAMATION | MB_RETRYCANCEL, _UU("CM_CONNECT_FAILED"), server_name) == IDRETRY) - { - // Retry - goto RETRY; - } - else - { - return false; - } - } - } - - Zero(&a, sizeof(a)); - CcGetClientVersion(cm->Client, &a); - if (a.ClientBuildInt >= 5192) - { - cm->CmSettingSupported = true; - cm->CmEasyModeSupported = true; - if (OS_IS_WINDOWS_9X(a.OsType)) - { - cm->CmEasyModeSupported = false; - } - } - - return true; -} - -// Main process -void MainCM() -{ - // If there is /remote in the argument, show the screen of the remote connection - TOKEN_LIST *cmdline = GetCommandLineToken(); - - UINT i = 0; - bool isRemote = false; - - if (cm->server_name != NULL) - { - Free(cm->server_name); - } - cm->server_name = NULL; - - if (cm->password != NULL) - { - Free(cm->password); - } - cm->password = NULL; - - for(i = 0; i < cmdline->NumTokens; ++i) - { - if (StrCmpi(cmdline->Token[i], "/remote") == 0) - { - isRemote = true; - } - else if (StrCmpi(cmdline->Token[i], "/hostname") == 0 && i + 1 < cmdline->NumTokens) - { - isRemote = true; - if (cm->server_name != NULL) - { - Free(cm->server_name); - } - cm->server_name = CopyStr(cmdline->Token[++i]); - } - else if (StrCmpi(cmdline->Token[i], "/password") == 0 && i + 1 < cmdline->NumTokens) - { - if (cm->password != NULL) - { - Free(cm->password); - } - cm->password = CopyStr(cmdline->Token[++i]); - } - else if (StrCmpi(cmdline->Token[i], "/startup") == 0) - { - // Startup mode - cm->StartupMode = true; - } - } - - if (isRemote && cm->server_name == NULL) - { - char *hostname = RemoteDlg(NULL, CM_REG_KEY, ICO_VPN, _UU("CM_TITLE"), _UU("CM_REMOTE_TITLE"), NULL); - if (hostname == NULL) - { - return; - } - if (cm->server_name != NULL) - { - Free(cm->server_name); - } - cm->server_name = NULL; - if (StrCmpi(hostname, "localhost") != 0 && StrCmpi(hostname, "127.0.0.1") != 0 ) - { - cm->server_name = hostname; - } - } - - FreeToken(cmdline); - - if (IsZero(cm->ShortcutKey, SHA1_SIZE) == false) - { - //if (MsGetCurrentTerminalSessionId() == 0) - { - // Start the shortcut connection - CmConnectShortcut(cm->ShortcutKey); - }/* - else - { - MsgBoxEx(NULL, MB_ICONEXCLAMATION, _UU("CM_SHORTCUT_DESKTOP_MSG"), - MsGetCurrentTerminalSessionId()); - }*/ - return; - } - - // Login - if (LoginCM() == false) - { - return; - } - - //Update the jump list - CmUpdateJumpList(0); - - // Main window - MainCMWindow(); - - // Log out - LogoutCM(); - - if (cm->Update != NULL) - { - FreeUpdateUi(cm->Update); - cm->Update = NULL; - } -} - -// Log out -void LogoutCM() -{ - if (cm->Client != NULL) - { - CcDisconnectRpc(cm->Client); - } -} - -// Client Connection Manager start function -void CMExec() -{ - // Initialize - InitCM(true); - - // Main process - MainCM(); - - // Release - FreeCM(); -} - -// HUB enumeration thread -void CmEnumHubThread(THREAD *t, void *param) -{ - CM_ENUM_HUB *e = (CM_ENUM_HUB *)param; - HWND hWnd; - // Validate arguments - if (t == NULL || param == NULL) - { - return; - } - - e->Thread = t; - hWnd = e->hWnd; - LockList(cm->EnumHubList); - { - Add(cm->EnumHubList, e); - } - UnlockList(cm->EnumHubList); - - // Thread initialization is completed - NoticeThreadInit(t); - - // Create a session - e->Session = NewRpcSession(cm->Cedar, e->ClientOption); - if (e->Session) - { - // Enumeration of HUB - e->Hub = EnumHub(e->Session); - - if (e->Hub != NULL) - { - // Enumeration completed - // Add to the combo box - if (CbNum(hWnd, C_HUBNAME) == 0) - { - UINT i; - wchar_t tmp[MAX_SIZE]; - for (i = 0;i < e->Hub->NumTokens;i++) - { - StrToUni(tmp, sizeof(tmp), e->Hub->Token[i]); - CbAddStr(hWnd, C_HUBNAME, tmp, 0); - } - } - - // Release the memory - FreeToken(e->Hub); - } - - // Release the session - ReleaseSession(e->Session); - } - - LockList(cm->EnumHubList); - { - Delete(cm->EnumHubList, e); - } - UnlockList(cm->EnumHubList); - - Free(e->ClientOption); - Free(e); -} - -// The start of the HUB enumeration -void CmEnumHubStart(HWND hWnd, CLIENT_OPTION *o) -{ - CM_ENUM_HUB *e; - THREAD *t; - // Validate arguments - if (hWnd == NULL || o == NULL) - { - return; - } - - if (StrLen(o->Hostname) == 0 || - o->Port == 0) - { - return; - } - - if (o->ProxyType != PROXY_DIRECT) - { - if (StrLen(o->ProxyName) == 0 || - o->ProxyPort == 0) - { - return; - } - } - - if (LvNum(hWnd, C_HUBNAME) != 0) - { - return; - } - - e = ZeroMalloc(sizeof(CM_ENUM_HUB)); - e->ClientOption = ZeroMalloc(sizeof(CLIENT_OPTION)); - e->hWnd = hWnd; - Copy(e->ClientOption, o, sizeof(CLIENT_OPTION)); - - t = NewThread(CmEnumHubThread, e); - WaitThreadInit(t); - ReleaseThread(t); -} - -// Initialize the HUB enumeration process -void CmInitEnumHub() -{ - cm->EnumHubList = NewList(NULL); -} - -// Release the HUB enumeration process -void CmFreeEnumHub() -{ - LIST *o; - UINT i; - if (cm->EnumHubList == NULL) - { - return; - } - - o = NewList(NULL); - LockList(cm->EnumHubList); - { - UINT i; - for (i = 0;i < LIST_NUM(cm->EnumHubList);i++) - { - CM_ENUM_HUB *e = LIST_DATA(cm->EnumHubList, i); - Add(o, e->Thread); - AddRef(e->Thread->ref); - } - } - UnlockList(cm->EnumHubList); - - for (i = 0;i < LIST_NUM(o);i++) - { - THREAD *t = LIST_DATA(o, i); - WaitThread(t, INFINITE); - ReleaseThread(t); - } - ReleaseList(o); - - ReleaseList(cm->EnumHubList); -} - -// Initialize the Client Connection Manager - -void InitCM(bool set_app_id) -{ - UNI_TOKEN_LIST *ut; - if (cm != NULL) - { - return; - } - - if (set_app_id) - { - if(JL_SetCurrentProcessExplicitAppUserModelID(APPID_CM) != S_OK) - { - } - } - - CmDeleteOldStartupTrayFile(); - - MsSetShutdownParameters(0x4ff, SHUTDOWN_NORETRY); - - // Memory allocation - cm = ZeroMalloc(sizeof(CM)); - - // If the command line argument is set treat it as a server name - ut = GetCommandLineUniToken(); - - if (ut->NumTokens >= 1) - { - if (UniStrLen(ut->Token[0]) != 0) - { - if (UniStrCmpi(ut->Token[0], L"cm") != 0 && ut->Token[0][0] != L'/') - { - BUF *b = UniStrToBin(ut->Token[0]); - if (b->Size == SHA1_SIZE) - { - // Treated as a shortcut key for the connection settings - Copy(cm->ShortcutKey, b->Buf, SHA1_SIZE); - } - else - { - if (UniEndWith(ut->Token[0], L".vpn") == false) - { - // Treated as a server name - cm->server_name = CopyUniToStr(ut->Token[0]); - } - else - { - // Treated as import file name - cm->import_file_name = CopyUniStr(ut->Token[0]); - } - } - FreeBuf(b); - } - else if (UniStrCmpi(ut->Token[0], L"/easy") == 0) - { - // Simple mode - if (ut->NumTokens >= 2) - { - // Connection settings to be imported is specified - cm->import_file_name = CopyUniStr(ut->Token[1]); - } - - cm->CmSettingInitialFlag = CM_SETTING_INIT_EASY; - } - else if (UniStrCmpi(ut->Token[0], L"/normal") == 0) - { - // Normal mode - if (ut->NumTokens >= 2) - { - // Connection settings to be imported is specified - cm->import_file_name = CopyUniStr(ut->Token[1]); - } - - cm->CmSettingInitialFlag = CM_SETTING_INIT_NORMAL; - } - else if (UniStrCmpi(ut->Token[0], L"/connect") == 0) - { - // Import process by the simple installer - if (ut->NumTokens >= 2) - { - // Connection settings to be imported is specified - cm->import_file_name = CopyUniStr(ut->Token[1]); - } - - cm->CmSettingInitialFlag = CM_SETTING_INIT_CONNECT; - } - else if (UniStrCmpi(ut->Token[0], L"/select") == 0) - { - // Selection screen - cm->CmSettingInitialFlag = CM_SETTING_INIT_SELECT; - } - } - } - - UniFreeToken(ut); - - InitWinUi(_UU("CM_TITLE"), _SS("DEFAULT_FONT"), _II("DEFAULT_FONT_SIZE")); - - // Alpha blending related - UseAlpha = MsRegReadInt(REG_CURRENT_USER, CM_REG_KEY, "UseAlpha"); - AlphaValue = MsRegReadInt(REG_CURRENT_USER, CM_REG_KEY, "AlphaValue"); - - cm->Cedar = NewCedar(NULL, NULL); - CmInitEnumHub(); -} - -// Stop the Client Connection Manager -void FreeCM() -{ - if (cm == NULL) - { - return; - } - - CmFreeEnumHub(); - ReleaseCedar(cm->Cedar); - - FreeWinUi(); - - // Release the memory - if (cm->server_name != NULL) - { - Free(cm->server_name); - } - Free(cm); - cm = NULL; -} - - - -////////////////////////////////////////////////////////////////////////// -//JumpList ToDo -// By Takao Ito -void *CmUpdateJumpList(UINT start_id) -{ - HMENU h = NULL; - UINT i; - RPC_CLIENT_ENUM_ACCOUNT a; - LIST *o; - bool easy; - - JL_PCustomDestinationList pcdl; - JL_PObjectCollection poc; - JL_PShellLink shell; - JL_PObjectArray poaRemoved; - - HRESULT hr; - - if (cm->server_name != NULL) - { - // Is not used in the case of an external PC - return NULL; - } - - //Try to add - if(SUCCEEDED(JL_CreateCustomDestinationList(&pcdl,APPID_CM))) - { - - JL_DeleteJumpList(pcdl,APPID_CM); - - easy = cm->CmSetting.EasyMode; - - Zero(&a, sizeof(a)); - - - if (CcEnumAccount(cm->Client, &a) == ERR_NO_ERROR) - { - o = NewListFast(CiCompareClientAccountEnumItemByLastConnectDateTime); - - for (i = 0;i < a.NumItem;i++) - { - RPC_CLIENT_ENUM_ACCOUNT_ITEM *item = a.Items[i]; - - item->tmp1 = i; - - if (item->LastConnectDateTime != 0) - { - Add(o, item); - } - } - - Sort(o); - - if(LIST_NUM(o) > 0) - { - - if(SUCCEEDED(JL_BeginList(pcdl, &poaRemoved))) - { - - - //Create a collection - if(SUCCEEDED(JL_CreateObjectCollection(&poc))) - { - - for (i = 0;i < MIN(LIST_NUM(o), CM_NUM_RECENT);i++) - { - - RPC_CLIENT_ENUM_ACCOUNT_ITEM *item = (RPC_CLIENT_ENUM_ACCOUNT_ITEM *)LIST_DATA(o, i); -// wchar_t tmp[MAX_PATH]; - wchar_t *account_name; - char *server_name; - char *hub_name; -// CM_ACCOUNT *a; - UCHAR key[SHA1_SIZE]; - RPC_CLIENT_GET_ACCOUNT c; - - - account_name = item->AccountName; - server_name = item->ServerName; - hub_name = item->HubName; - - - - // - //a = CmGetExistAccountObject(hWnd, account_name); - - - //if (a == NULL) - //{ - //continue; - //} - - //Copy(key, a->ShortcutKey, SHA1_SIZE); - // - - Zero(&c, sizeof(c)); - UniStrCpy(c.AccountName, sizeof(c.AccountName), account_name); - if (CALL(NULL, CcGetAccount(cm->Client, &c)) == false) - { - break; - } - - Copy(key, c.ShortcutKey, SHA1_SIZE); - - if (IsZero(key, SHA1_SIZE)) - { - //MsgBox(hWnd, MB_ICONINFORMATION, _UU("CM_SHORTCUT_UNSUPPORTED")); - } - else - { - - //wchar_t target[MAX_PATH]; - ////wchar_t workdir[MAX_PATH]; - //wchar_t args[MAX_PATH]; - ////wchar_t comment[MAX_SIZE]; - //wchar_t icon[MAX_PATH]; - - char key_str[64]; - wchar_t target[MAX_PATH]; - //wchar_t workdir[MAX_PATH]; - wchar_t args[MAX_PATH]; - wchar_t commentW[MAX_SIZE]; - wchar_t icon[MAX_PATH]; - int iconNum; - - //char icon = "C:\\Server.ico"; - - BinToStr(key_str, sizeof(key_str), key, SHA1_SIZE); - UniStrCpy(target, sizeof(target), MsGetExeFileNameW()); - StrToUni(args, sizeof(args), key_str); - UniStrCpy(icon, sizeof(icon), MsGetExeFileNameW()); - UniFormat(commentW, sizeof(commentW), _UU("CM_SHORTCUT_COMMENT"), account_name); - - if(item->Connected) - { - iconNum = 1; - } - else - { - iconNum = 2; - } - - hr = JL_CreateShellLink( - target, - args, - account_name, - icon,iconNum, - commentW, - &shell); - - if(SUCCEEDED(hr)) - { - - if(SUCCEEDED(JL_ObjectCollectionAddShellLink(poc, shell))) - { - //Print("Add JumpList %d c:%s\n",i, comment); - //wprintf(comment); - } - JL_ReleaseShellLink(shell); - } - } - - CiFreeClientGetAccount(&c); - } - - hr = JL_AddCategoryToList(pcdl,poc,_UU("CM_JUMPLIST_RCCONNECT"),poaRemoved); - - if(SUCCEEDED(hr)) - { - //wprintf(L"AddCategory\n"); - - hr = JL_CommitList(pcdl); - if(SUCCEEDED(hr)) - { - //wprintf(L"JumpList Commit\n"); - } - } - else - { - //wprintf(L"Erro JumpList AddCategory %x\n", hr); - } - - //Release - JL_ReleaseObjectCollection(poc); - } - } - - } - - - ReleaseList(o); - - CiFreeClientEnumAccount(&a); - } - - - - - /* - JL_BeginList(pcdl, &poaRemoved); - - JL_CreateObjectCollection(&poc); - - // Tesht - for (i = 0; i < 5; i++) - { - - JL_CreateShellLink( - "", - "", - L"Connect", - NULL,0, - NULL, - &shell); - JL_ObjectCollectionAddShellLink(poc, shell); - - JL_ReleaseShellLink(shell); - - } - - JL_AddCategoryToList(pcdl,poc,_UU("CM_JUMPLIST_RCCONNECT"),poaRemoved); - JL_CommitList(pcdl); - JL_ReleaseObjectCollection(poc); - - JL_ReleaseCustomDestinationList(pcdl); - */ - - } - - return h; -} - - - -#endif // WIN32 - - +// SoftEther VPN Source Code - Developer Edition Master Branch +// Cedar Communication Module + + +// CM.c +// VPN Client Connection Manager for Win32 + +#include + +#ifdef WIN32 + +#define CM_C +#define SM_C +#define MICROSOFT_C + +#define _WIN32_WINNT 0x0502 +#define WINVER 0x0502 +#define SECURITY_WIN32 +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "CMInner.h" +#include "SMInner.h" +#include "NMInner.h" +#include "EMInner.h" +#include "../PenCore/resource.h" + + +// Get the proxy server settings from the registry string of IE +bool CmGetProxyServerNameAndPortFromIeProxyRegStr(char *name, UINT name_size, UINT *port, char *str, char *server_type) +{ + TOKEN_LIST *t; + UINT i; + bool ret = false; + // Validate arguments + if (name == NULL || port == NULL || str == NULL || server_type == NULL) + { + return false; + } + + t = ParseToken(str, ";"); + + for (i = 0;i < t->NumTokens;i++) + { + char *s = t->Token[i]; + UINT i; + + Trim(s); + + i = SearchStrEx(s, "=", 0, false); + if (i != INFINITE) + { + char tmp[MAX_PATH]; + + StrCpy(name, name_size, s); + name[i] = 0; + + if (StrCmpi(name, server_type) == 0) + { + char *host; + StrCpy(tmp, sizeof(tmp), s + i + 1); + + if (ParseHostPort(tmp, &host, port, 0)) + { + StrCpy(name, name_size, host); + Free(host); + + if (*port != 0) + { + ret = true; + } + break; + } + } + } + } + + FreeToken(t); + + return ret; +} + + +// Reflect the contents of the proxy settings to the connection settings +void CmProxyDlgSet(HWND hWnd, CLIENT_OPTION *o, CM_INTERNET_SETTING *setting) +{ + // Validate arguments + if(hWnd == NULL || setting == NULL) + { + return; + } + + // Make check in check-box + Check(hWnd, R_DIRECT_TCP, setting->ProxyType == PROXY_DIRECT); + Check(hWnd, R_HTTPS, setting->ProxyType == PROXY_HTTP); + Check(hWnd, R_SOCKS, setting->ProxyType == PROXY_SOCKS); + Check(hWnd, R_SOCKS5, setting->ProxyType == PROXY_SOCKS5); + + // Proxy Settings + if(setting->ProxyType != PROXY_DIRECT) + { + StrCpy(o->ProxyName, sizeof(setting->ProxyHostName), setting->ProxyHostName); + o->ProxyPort = setting->ProxyPort; + } +} + +// Get the proxy settings of IE +void CmGetSystemInternetSetting(CM_INTERNET_SETTING *setting) +{ + bool use_proxy; + // Validate arguments + if (setting == NULL) + { + return; + } + + Zero(setting, sizeof(CM_INTERNET_SETTING)); + + use_proxy = MsRegReadInt(REG_CURRENT_USER, + "Software\\Microsoft\\Windows\\CurrentVersion\\Internet Settings", + "ProxyEnable"); + + if (use_proxy) + { + char *str = MsRegReadStr(REG_CURRENT_USER, + "Software\\Microsoft\\Windows\\CurrentVersion\\Internet Settings", + "ProxyServer"); + if (str != NULL) + { + char name[MAX_HOST_NAME_LEN + 1]; + UINT port; + + if (CmGetProxyServerNameAndPortFromIeProxyRegStr(name, sizeof(name), + &port, str, "https")) + { + setting->ProxyType = PROXY_HTTP; + StrCpy(setting->ProxyHostName, sizeof(setting->ProxyHostName), name); + setting->ProxyPort = port; + } + else if (CmGetProxyServerNameAndPortFromIeProxyRegStr(name, sizeof(name), + &port, str, "http")) + { + setting->ProxyType = PROXY_HTTP; + StrCpy(setting->ProxyHostName, sizeof(setting->ProxyHostName), name); + setting->ProxyPort = port; + } + else if (CmGetProxyServerNameAndPortFromIeProxyRegStr(name, sizeof(name), + &port, str, "socks")) + { + setting->ProxyType = PROXY_SOCKS; + StrCpy(setting->ProxyHostName, sizeof(setting->ProxyHostName), name); + setting->ProxyPort = port; + } + else + { + if (SearchStrEx(str, "=", 0, false) == INFINITE) + { + char *host; + UINT port; + if (ParseHostPort(str, &host, &port, 0)) + { + if (port != 0) + { + setting->ProxyType = PROXY_HTTP; + StrCpy(setting->ProxyHostName, sizeof(setting->ProxyHostName), host); + setting->ProxyPort = port; + } + Free(host); + } + } + } + + Free(str); + } + } +} + +// For the proxy settings to go through, use the IE settings +void CmProxyDlgUseForIE(HWND hWnd, CLIENT_OPTION *o) +{ + CM_INTERNET_SETTING s; + + // Validate arguments + if(hWnd == NULL) + { + return; + } + + Zero(&s, sizeof(s)); + CmGetSystemInternetSetting(&s); + + CmProxyDlgSet(hWnd, o, &s); +} + +// Determine the bitmap ID of the smart card authentication screen +UINT CmGetSecureBitmapId(char *dest_hostname) +{ + // Validate arguments + if (dest_hostname == NULL) + { + return 0; + } + + if (EndWith(dest_hostname, ".cc.tsukuba.ac.jp")) + { + return BMP_TSUKUBA; + } + + return 0; +} + +// Activate the window of UAC +void CmSetUacWindowActive() +{ + HWND hWnd; + + if (MsIsVista() == false) + { + return; + } + + hWnd = FindWindowA("$$$Secure UAP Dummy Window Class For Interim Dialog", NULL); + if (hWnd == NULL) + { + return; + } + + SwitchToThisWindow(hWnd, true); +} + +// UAC helper thread +void CmUacHelperThread(THREAD *thread, void *param) +{ + CM_UAC_HELPER *c = (CM_UAC_HELPER *)param; + // Validate arguments + if (c == NULL) + { + return; + } + + while (c->Halt == false) + { + CmSetUacWindowActive(); + + Wait(c->HaltEvent, 200); + } +} + +// Start the UAC helper +void *CmStartUacHelper() +{ + CM_UAC_HELPER *c = ZeroMalloc(sizeof(CM_UAC_HELPER)); + + c->HaltEvent = NewEvent(); + c->Thread = NewThread(CmUacHelperThread, c); + + return (void *)c; +} + +// Stop the UAC helper +void CmStopUacHelper(void *p) +{ + CM_UAC_HELPER *c = (CM_UAC_HELPER *)p; + // Validate arguments + if (c == NULL) + { + return; + } + + c->Halt = true; + Set(c->HaltEvent); + WaitThread(c->Thread, INFINITE); + ReleaseEvent(c->HaltEvent); + ReleaseThread(c->Thread); + + Free(c); +} + +// Command invocation of the simple connection manager +void CmEasyDlgOnCommand(HWND hWnd, CM_EASY_DLG *d, WPARAM wParam, LPARAM lParam) +{ + // Validate arguments + if (hWnd == NULL || d == NULL) + { + return; + } + + switch (wParam) + { + case B_MODE: + Command(hWnd, CMD_CM_SETTING); + return; + + case B_STATUS: + Command(hWnd, CMD_STATUS); + return; + + case IDCANCEL: + Close(hWnd); + return; + + } + + if (wParam == CMD_CONNECT) + { + cm->ConnectStartedFlag = false; + } + + CmMainWindowOnCommandEx(hWnd, wParam, lParam, true); + + if (wParam == CMD_CONNECT && cm->ConnectStartedFlag) + { + // Close the window when the connection started successfully + Close(hWnd); + } +} + +// Keyboard pressing of the simple connection manager +void CmEasyDlgOnKey(HWND hWnd, CM_EASY_DLG *d, bool ctrl, bool alt, UINT key) +{ + // Validate arguments + if (hWnd == NULL) + { + return; + } + + // Single key + switch (key) + { + case VK_RETURN: + Command(hWnd, IDOK); + break; + case VK_DELETE: + // Delete + if (IsFocus(hWnd, L_ACCOUNT)) + { + // Operation on the account list + Command(hWnd, CMD_DELETE); + } + else + { + // Operation on the virtual LAN card list + Command(hWnd, CMD_DELETE_VLAN); + } + break; + case VK_F2: + // Change the name + Command(hWnd, CMD_RENAME); + break; + case VK_F5: + // Update the status + Command(hWnd, CMD_REFRESH); + break; + } + + if (alt) + { + switch (key) + { + case 'Q': + // Close + Command(hWnd, CMD_QUIT); + break; + } + } + + if (ctrl) + { + switch (key) + { + case 'G': + // Smart Card Manager + Command(hWnd, CMD_SECURE_MANAGER); + break; + case 'S': + // Show the status + Command(hWnd, CMD_STATUS); + break; + case 'I': + // Disconnect all connections + Command(hWnd, CMD_DISCONNECT_ALL); + break; + case 'D': + // Disconnect + Command(hWnd, CMD_DISCONNECT); + break; + case 'N': + // Create a new connection setting + Command(hWnd, CMD_NEW); + break; + case 'C': + // Creating a copy + Command(hWnd, CMD_CLONE); + break; + case 'T': + // Set to start-up connection + Command(hWnd, CMD_STARTUP); + break; + case 'A': + // Select all + Command(hWnd, CMD_SELECT_ALL); + break; + case 'L': + // Create a new virtual LAN card + Command(hWnd, CMD_NEW_VLAN); + break; + case 'P': + // Set the password + Command(hWnd, CMD_PASSWORD); + break; + case 'O': + // Option settings + Command(hWnd, CMD_TRAFFIC); + break; + case 'R': + // Certificate management + Command(hWnd, CMD_TRUST); + break; + case 'Q': + // Throughput + Command(hWnd, CMD_TRAFFIC); + break; + } + } +} + +// Operation on the list view of the simple connection manager +void CmEasyDlgOnNotify(HWND hWnd, CM_EASY_DLG *d, NMHDR *n) +{ + NMLVDISPINFOW *disp_info; + NMLVKEYDOWN *key; + + // Validate arguments + if (hWnd == NULL || n == NULL) + { + return; + } + + switch (n->idFrom) + { + case L_ACCOUNT: + switch (n->code) + { + case LVN_ITEMCHANGED: + CmEasyDlgUpdate(hWnd, d); + break; + case NM_DBLCLK: + // Double click + Command(hWnd, CMD_EASY_DBLCLICK); + break; + case NM_RCLICK: + // Right click + CmAccountListRightClick(hWnd); + break; + case LVN_ENDLABELEDITW: + // Change the name + disp_info = (NMLVDISPINFOW *)n; + if (disp_info->item.pszText != NULL) + { + wchar_t *new_name = disp_info->item.pszText; + wchar_t *old_name = LvGetStr(hWnd, L_ACCOUNT, disp_info->item.iItem, 0); + + if (old_name != NULL) + { + if (UniStrCmp(new_name, old_name) != 0 && UniIsEmptyStr(new_name) == false) + { + RPC_RENAME_ACCOUNT a; + Zero(&a, sizeof(a)); + UniStrCpy(a.OldName, sizeof(a.OldName), old_name); + UniStrCpy(a.NewName, sizeof(a.NewName), new_name); + if (CALL(hWnd, CcRenameAccount(cm->Client, &a))) + { + LvSetItem(hWnd, L_ACCOUNT, disp_info->item.iItem, 0, new_name); + } + } + + Free(old_name); + } + } + break; + case LVN_KEYDOWN: + // Key-press + key = (NMLVKEYDOWN *)n; + if (key != NULL) + { + bool ctrl, alt; + UINT code = key->wVKey; + ctrl = (GetKeyState(VK_CONTROL) & 0x8000) == 0 ? false : true; + alt = (GetKeyState(VK_MENU) & 0x8000) == 0 ? false : true; + CmEasyDlgOnKey(hWnd, d, ctrl, alt, code); + } + break; + } + break; + } +} + +// Send an update notification to the Simple Connection Manager +void CmRefreshEasy() +{ + if (cm->hEasyWnd == NULL) + { + return; + } + + SendMessage(cm->hEasyWnd, WM_CM_EASY_REFRESH, 0, 0); +} + +// Initialize the Simple Connect Manager +void CmEasyDlgInit(HWND hWnd, CM_EASY_DLG *d) +{ + HFONT hFontForList; + HFONT hFontButton; + HFONT hFontTitle; + HFONT hFontInfo; + HFONT hFontOther; + UINT i, num, num2, j; + bool b = false; + char *font_name = NULL; + bool font_bold = true; + // Validate arguments + if (hWnd == NULL || d == NULL) + { + return; + } + + SetIcon(hWnd, 0, ICO_VPN); + + // Window handle registration + cm->hEasyWnd = hWnd; + + // Show in the center + Center(hWnd); + + // Update the account list + CmInitAccountListEx(hWnd, true); + + // Font settings of the list + if (cm->VistaStyle) + { + if (_GETLANG() == 0) + { + font_name = "Meiryo"; + font_bold = false; + } + else if (_GETLANG() == 2) + { + font_name = "Microsoft YaHei"; + font_bold = false; + } + } + + hFontForList = GetFont(font_name, 14, font_bold, false, false, false); + hFontButton = GetFont(font_name, 13, font_bold, false, false, false); + hFontTitle = GetFont(font_name, 14, font_bold, false, false, false); + hFontInfo = GetFont(font_name, 11, font_bold, false, false, false); + hFontOther = GetDialogDefaultFont(); + + if (cm->VistaStyle) + { + hFontOther = GetMeiryoFont(); + } + + SetFont(hWnd, L_ACCOUNT, hFontForList); + SetFont(hWnd, IDOK, hFontButton); + SetFont(hWnd, S_TITLE, hFontTitle); + SetFont(hWnd, S_INFO, hFontInfo); + SetFont(hWnd, B_MODE, hFontOther); + SetFont(hWnd, IDCANCEL, hFontOther); + SetFont(hWnd, B_VGC, hFontOther); + + SetShow(hWnd, B_VGC, cm->Client->IsVgcSupported); + + CmEasyDlgRefresh(hWnd, d); + + num = LvNum(hWnd, L_ACCOUNT); + num2 = 0; + j = 0; + for (i = 0;i < num;i++) + { + wchar_t *str = LvGetStr(hWnd, L_ACCOUNT, i, 1); + + if (str != NULL) + { + if (UniStrCmpi(str, _UU("CM_ACCOUNT_ONLINE")) == 0 || UniStrCmpi(str, _UU("CM_ACCOUNT_CONNECTING")) == 0) + { + num2++; + j = i; + } + Free(str); + } + } + + if (num2 == 1) + { + LvSelect(hWnd, L_ACCOUNT, j); + b = true; + } + + if (b == false) + { + if (UniIsEmptyStr(cm->EasyLastSelectedAccountName) == false) + { + i = LvSearchStr(hWnd, L_ACCOUNT, 0, cm->EasyLastSelectedAccountName); + if (i != INFINITE) + { + LvSelect(hWnd, L_ACCOUNT, i); + b = true; + } + } + } + + if (b == false) + { + if (LvNum(hWnd, L_ACCOUNT) != 0) + { + LvSelect(hWnd, L_ACCOUNT, 0); + } + } + + Focus(hWnd, L_ACCOUNT); + + CmEasyDlgUpdate(hWnd, d); +} + +// Update the Simple Connection Manager control +void CmEasyDlgUpdate(HWND hWnd, CM_EASY_DLG *d) +{ + bool ok = true; + bool show_status = false; + wchar_t *button_str = _UU("CM_EASY_CONNECT_BUTTON_1"); + wchar_t *info_str = _UU("CM_EASY_INFO_1"); + wchar_t *title_str = _UU("CM_EASY_TITLE"); + // Validate arguments + if (hWnd == NULL || d == NULL) + { + return; + } + + if (LvIsSingleSelected(hWnd, L_ACCOUNT) == false) + { + ok = false; + } + + if (ok) + { + UINT i = LvGetSelected(hWnd, L_ACCOUNT); + wchar_t *str = LvGetStr(hWnd, L_ACCOUNT, i, 1); + + info_str = _UU("CM_EASY_INFO_2"); + + if (str != NULL) + { + if (UniStrCmpi(str, _UU("CM_ACCOUNT_ONLINE")) == 0 || UniStrCmpi(str, _UU("CM_ACCOUNT_CONNECTING")) == 0) + { + button_str = _UU("CM_EASY_CONNECT_BUTTON_2"); + show_status = true; + info_str = _UU("CM_EASY_INFO_3"); + + if (UniStrCmpi(str, _UU("CM_ACCOUNT_ONLINE")) == 0) + { + title_str = _UU("CM_EASY_CONNECTED"); + } + else + { + title_str = _UU("CM_EASY_CONNECTING"); + } + } + Free(str); + } + } + + SetShow(hWnd, B_STATUS, show_status); + + SetText(hWnd, IDOK, button_str); + SetText(hWnd, S_INFO, info_str); + SetText(hWnd, S_TITLE, title_str); + + SetShow(hWnd, IDOK, ok); +} + +// Update the Simple Connect Manager content +void CmEasyDlgRefresh(HWND hWnd, CM_EASY_DLG *d) +{ + // Validate arguments + if (hWnd == NULL || d == NULL) + { + return; + } + + // Update the account list + CmRefreshAccountListEx(hWnd, true); + + CmEasyDlgUpdate(hWnd, d); +} + +// Dialog procedure of the simple connection manager +UINT CmEasyDlg(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param) +{ + CM_EASY_DLG *d = (CM_EASY_DLG *)param; + NMHDR *n; + UINT i; + // Validate arguments + if (hWnd == NULL) + { + return 0; + } + + switch (msg) + { + case WM_INITDIALOG: + CmEasyDlgInit(hWnd, d); + SetTimer(hWnd, 1, 10, NULL); + break; + + case WM_TIMER: + switch (wParam) + { + case 1: + KillTimer(hWnd, 1); + SetForegroundWindow(hWnd); + SetActiveWindow(hWnd); + break; + } + break; + + case WM_CM_EASY_REFRESH: + CmEasyDlgRefresh(hWnd, d); + break; + + case WM_COMMAND: + CmEasyDlgOnCommand(hWnd, d, wParam, lParam); + break; + + case WM_NOTIFY: + n = (NMHDR *)lParam; + CmEasyDlgOnNotify(hWnd, d, n); + break; + + case WM_CLOSE: + i = LvGetSelected(hWnd, L_ACCOUNT); + if (i != INFINITE) + { + wchar_t *s = LvGetStr(hWnd, L_ACCOUNT, i, 0); + if (s != NULL) + { + UniStrCpy(cm->EasyLastSelectedAccountName, sizeof(cm->EasyLastSelectedAccountName), + s); + Free(s); + } + } + else + { + Zero(cm->EasyLastSelectedAccountName, sizeof(cm->EasyLastSelectedAccountName)); + } + EndDialog(hWnd, false); + break; + } + + return 0; +} + +// Show the window of the simple connection manager (This is called by a delaying timer) +void CmMainWindowOnShowEasy(HWND hWnd) +{ + CM_EASY_DLG d; + + Zero(&d, sizeof(d)); + + if (cm->CmSetting.EasyMode == false) + { + // Not in simple mode + return; + } + + if (cm->hEasyWnd != NULL) + { + // It is shown already + SetForegroundWindow(cm->hEasyWnd); + SetActiveWindow(cm->hEasyWnd); + return; + } + + Dialog(NULL, D_CM_EASY, CmEasyDlg, &d); + + cm->hEasyWnd = NULL; +} + +// Show the window of the simple connection manager +void CmShowEasy() +{ + SetTimer(cm->hMainWnd, 4, 2, NULL); +} + +// Close the window of the simple connection manager +void CmCloseEasy() +{ + if (cm->hEasyWnd == NULL) + { + return; + } + + SendMessage(cm->hEasyWnd, WM_CLOSE, 0, 0); +} + +// Message processing for such as clicking on the tray icon +void CmMainWindowOnTrayClicked(HWND hWnd, WPARAM wParam, LPARAM lParam) +{ + bool easymode = cm->CmSetting.EasyMode; + + switch (wParam) + { + case 1: + switch (lParam) + { + case WM_LBUTTONDOWN: + case WM_RBUTTONDOWN: + // Click + if (easymode == false) + { + if (IsEnable(hWnd, 0)) + { + CmShowTrayMenu(hWnd); + } + else + { + CmShowOrHideWindow(hWnd); + } + } + else + { + if (cm->hEasyWnd == NULL || IsEnable(cm->hEasyWnd, 0)) + { + CmShowTrayMenu(hWnd); + } + else + { + //CmShowOrHideWindow(hWnd); + } + } + break; + case WM_LBUTTONDBLCLK: + case WM_RBUTTONDBLCLK: + // Double click + if (easymode == false) + { + if (IsEnable(hWnd, 0)) + { + CmShowOrHideWindow(hWnd); + } + } + else + { + if (cm->hEasyWnd == NULL) + { + CmShowEasy(); + } + else + { + SetForegroundWindow(cm->hEasyWnd); + SetActiveWindow(cm->hEasyWnd); + } + } + break; + } + break; + } +} + +// Apply the setting of the operation mode +void CmApplyCmSetting() +{ + CM_SETTING a; + bool changed = false; + + if (cm->CmSettingSupported == false) + { + return; + } + + // Get the configuration of the current vpnclient + Zero(&a, sizeof(a)); + CcGetCmSetting(cm->Client, &a); + + // Check whether there is change point as compared to the previous CM_SETTING + if (cm->CmSetting.EasyMode != a.EasyMode) + { + changed = true; + } + if (cm->CmSetting.LockMode != a.LockMode) + { + changed = true; + } + + Copy(&cm->CmSetting, &a, sizeof(CM_SETTING)); + + if (changed == false) + { + return; + } + + if (cm->StartupFinished) + { + if (IsShow(cm->hMainWnd, 0) && cm->CmSetting.EasyMode) + { + // Close the main window if it is shown + Hide(cm->hMainWnd, 0); + } + else + { + WINDOWPLACEMENT current_pos; + if (cm->CmSetting.EasyMode == false && IsShow(cm->hMainWnd, 0) == false) + { + // When restored to normal mode, restore the main window + if (IsZero(&cm->FakeWindowPlacement, sizeof(cm->FakeWindowPlacement)) == false) + { + cm->FakeWindowPlacement.flags = cm->FakeWindowPlacement.flags & ~SW_MINIMIZE; + SetWindowPlacement(cm->hMainWnd, &cm->FakeWindowPlacement); + Zero(&cm->FakeWindowPlacement, sizeof(cm->FakeWindowPlacement)); + Hide(cm->hMainWnd, 0); + } + CmShowOrHideWindow(cm->hMainWnd); + } + + if (cm->CmSetting.EasyMode == false) + { + if (GetWindowPlacement(cm->hMainWnd, ¤t_pos)) + { + if (current_pos.rcNormalPosition.right < 0 || + current_pos.rcNormalPosition.bottom < 0) + { + // If the window is off the screen for some reason, + // return it in a visible place + SetWindowPos(cm->hMainWnd, NULL, 0, 0, CM_DEFAULT_WIDTH, CM_DEFAULT_HEIGHT, SWP_NOREDRAW | SWP_SHOWWINDOW); + Center(cm->hMainWnd); + } + } + } + } + + Command(cm->hMainWnd, CMD_REFRESH); + } + + if (cm->CmSetting.EasyMode) + { + if (cm->StartupFinished == false && cm->StartupMode) + { + // Don't show in the case of /startup + } + else + { + CmShowEasy(); + } + } + else + { + CmCloseEasy(); + } +} + +// Initialize the operation mode changing dialog +void CmSettingDlgInit(HWND hWnd, CM_SETTING_DLG *d) +{ + CM_SETTING a; + // Validate arguments + if (hWnd == NULL || d == NULL) + { + return; + } + + // Get the configuration of the current vpnclient + Zero(&a, sizeof(a)); + CcGetCmSetting(cm->Client, &a); + + Check(hWnd, R_EASY, a.EasyMode); + Check(hWnd, R_NORMAL, a.EasyMode == false); + + if (a.EasyMode == false) + { + Focus(hWnd, R_NORMAL); + } + else + { + Focus(hWnd, R_EASY); + } + + Check(hWnd, R_LOCK, a.LockMode); + + SetEnable(hWnd, R_EASY, cm->CmEasyModeSupported); + + if (a.LockMode) + { + if (IsZero(a.HashedPassword, sizeof(a.HashedPassword)) == false) + { + // Password is set + SetText(hWnd, S_PASSWORD1, _UU("CM_SETTING_PASSWORD")); + Hide(hWnd, S_PASSWORD3); + Hide(hWnd, E_PASSWORD2); + + d->CheckPassword = true; + Copy(d->HashedPassword, a.HashedPassword, sizeof(d->HashedPassword)); + } + } + + SetShow(hWnd, S_VGS1, cm->Client->IsVgcSupported); + SetShow(hWnd, S_VGS2, cm->Client->IsVgcSupported); + SetShow(hWnd, S_VGS3, cm->Client->IsVgcSupported); + SetShow(hWnd, B_VGS, cm->Client->IsVgcSupported); + + CmSettingDlgUpdate(hWnd, d); +} + +// Update the operation mode changing dialog +void CmSettingDlgUpdate(HWND hWnd, CM_SETTING_DLG *d) +{ + bool ok = true; + char tmp1[MAX_SIZE], tmp2[MAX_SIZE]; + // Validate arguments + if (hWnd == NULL || d == NULL) + { + return; + } + + GetTxtA(hWnd, E_PASSWORD1, tmp1, sizeof(tmp1)); + GetTxtA(hWnd, E_PASSWORD2, tmp2, sizeof(tmp2)); + + if (d->CheckPassword == false) + { + if (IsChecked(hWnd, R_LOCK)) + { + if (StrCmp(tmp1, tmp2) != 0) + { + ok = false; + } + } + } + else + { + bool password_ok = false; + UCHAR hash[SHA1_SIZE]; + + Sha0(hash, tmp1, StrLen(tmp1)); + if (Cmp(hash, d->HashedPassword, sizeof(hash)) == 0) + { + password_ok = true; + } + + if (password_ok == false) + { + Check(hWnd, R_LOCK, true); + Disable(hWnd, R_LOCK); + } + else + { + Enable(hWnd, R_LOCK); + } + } + + SetEnable(hWnd, S_PASSWORD1, IsChecked(hWnd, R_LOCK)); + SetEnable(hWnd, S_PASSWORD2, IsChecked(hWnd, R_LOCK)); + SetEnable(hWnd, S_PASSWORD3, IsChecked(hWnd, R_LOCK)); + SetEnable(hWnd, E_PASSWORD1, IsChecked(hWnd, R_LOCK)); + SetEnable(hWnd, E_PASSWORD2, IsChecked(hWnd, R_LOCK)); + + SetEnable(hWnd, IDOK, ok); +} + +// Operation mode changing dialog OK +void CmSettingDlgOnOk(HWND hWnd, CM_SETTING_DLG *d) +{ + CM_SETTING a; + char tmp1[MAX_SIZE], tmp2[MAX_SIZE]; + // Validate arguments + if (hWnd == NULL || d == NULL) + { + return; + } + + GetTxtA(hWnd, E_PASSWORD1, tmp1, sizeof(tmp1)); + GetTxtA(hWnd, E_PASSWORD2, tmp2, sizeof(tmp2)); + + Zero(&a, sizeof(a)); + + a.EasyMode = IsChecked(hWnd, R_EASY); + a.LockMode = IsChecked(hWnd, R_LOCK); + + if (a.LockMode) + { + if (d->CheckPassword && IsEnable(hWnd, R_LOCK) == false) + { + Copy(a.HashedPassword, d->HashedPassword, sizeof(a.HashedPassword)); + } + else + { + if (StrLen(tmp1) >= 1) + { + Sha0(a.HashedPassword, tmp1, StrLen(tmp1)); + } + } + } + + CcSetCmSetting(cm->Client, &a); + + EndDialog(hWnd, true); +} + +// Operation mode changing dialog +UINT CmSettingDlg(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param) +{ + CM_SETTING_DLG *d = (CM_SETTING_DLG *)param; + // Validate arguments + if (hWnd == NULL) + { + return 0; + } + + switch (msg) + { + case WM_INITDIALOG: + CmSettingDlgInit(hWnd, d); + break; + + case WM_COMMAND: + switch (LOWORD(wParam)) + { + case R_EASY: + case R_NORMAL: + case R_LOCK: + case E_PASSWORD1: + case E_PASSWORD2: + case IDOK: + case IDCANCEL: + CmSettingDlgUpdate(hWnd, d); + break; + } + switch (wParam) + { + case IDOK: + CmSettingDlgOnOk(hWnd, d); + break; + + case IDCANCEL: + Close(hWnd); + break; + + case R_LOCK: + if (IsChecked(hWnd, R_LOCK)) + { + if (IsEmpty(hWnd, E_PASSWORD1)) + { + Focus(hWnd, E_PASSWORD1); + } + } + break; + + } + break; + + case WM_CLOSE: + EndDialog(hWnd, false); + break; + } + + return 0; +} + + +// Change operation mode +bool CmSetting(HWND hWnd) +{ + CM_SETTING_DLG d; + + Zero(&d, sizeof(d)); + + return Dialog(hWnd, D_CM_SETTING, CmSettingDlg, &d); +} + + +// Attempting thread for starting the UI Helper +void CmTryToExecUiHelperThread(THREAD *thread, void *param) +{ + bool first_flag = true; + + while (cm->TryExecUiHelperHalt == false && cm->WindowsShutdowning == false) + { + if (first_flag == false) + { + // Wait a little for other than the first time + Wait(cm->TryExecUiHelperHaltEvent, CM_TRY_EXEC_UI_HELPER_INTERVAL * 2); + + if (cm->TryExecUiHelperHalt || cm->WindowsShutdowning) + { + break; + } + } + first_flag = false; + + if (cm->TryExecUiHelperHalt == false && cm->WindowsShutdowning == false) + { + if (cm->TryExecUiHelperProcessHandle == NULL) + { + CmTryToExecUiHelper(); + } + } + + if (cm->TryExecUiHelperHalt || cm->WindowsShutdowning) + { + break; + } + + if (cm->TryExecUiHelperProcessHandle == NULL) + { + Wait(cm->TryExecUiHelperHaltEvent, CM_TRY_EXEC_UI_HELPER_INTERVAL); + } + else + { + HANDLE handles[2]; + handles[0] = cm->TryExecUiHelperProcessHandle; + handles[1] = (HANDLE)cm->TryExecUiHelperHaltEvent->pData; + WaitForMultipleObjects(2, handles, false, CM_TRY_EXEC_UI_HELPER_INTERVAL); + + if (WaitForSingleObject(cm->TryExecUiHelperProcessHandle, 0) != WAIT_TIMEOUT) + { + CloseHandle(cm->TryExecUiHelperProcessHandle); + cm->TryExecUiHelperProcessHandle = NULL; + if (cm->TryExecUiHelperHalt || cm->WindowsShutdowning) + { + break; + } + Wait(cm->TryExecUiHelperHaltEvent, CM_TRY_EXEC_UI_HELPER_INTERVAL * 2); + } + } + } +} + +// Stop the UI Helper +void CmFreeTryToExecUiHelper() +{ + cm->TryExecUiHelperHalt = true; + Set(cm->TryExecUiHelperHaltEvent); + + WaitThread(cm->TryExecUiHelperThread, INFINITE); + + ReleaseThread(cm->TryExecUiHelperThread); + cm->TryExecUiHelperThread = NULL; + + ReleaseEvent(cm->TryExecUiHelperHaltEvent); + cm->TryExecUiHelperHaltEvent = NULL; + + cm->TryExecUiHelperHalt = false; + cm->TryExecUiHelperProcessHandle = NULL; +} + +// Initialize the UI Helper starting +void CmInitTryToExecUiHelper() +{ + cm->TryExecUiHelperProcessHandle = NULL; + cm->TryExecUiHelperHalt = false; + cm->TryExecUiHelperHaltEvent = NewEvent(); + cm->TryExecUiHelperThread = NewThread(CmTryToExecUiHelperThread, NULL); +} + +// Start the UI Helper +void *CmExecUiHelperMain() +{ + HANDLE h; + wchar_t tmp[MAX_SIZE]; + + UniFormat(tmp, sizeof(tmp), L"%s\\%S", MsGetExeDirNameW(), CLIENT_WIN32_EXE_FILENAME); + + // Start + h = Win32RunExW(tmp, SVC_ARG_UIHELP_W, false); + + return (void *)h; +} + +// Attempt to start the UI Helper +void CmTryToExecUiHelper() +{ + HANDLE h; + // Check that it isn't already running + if (CnCheckAlreadyExists(false)) + { + // It have already started + return; + } + + h = (HANDLE)CmExecUiHelperMain(); + + if (h != NULL) + { + cm->TryExecUiHelperProcessHandle = h; + } +} + +// Initialize the dialog +void CmTrafficResultDlgInit(HWND hWnd, TT_RESULT *res) +{ + LVB *ct; + wchar_t tmp[MAX_SIZE]; + wchar_t tmp1[MAX_SIZE]; + wchar_t tmp2[MAX_SIZE]; + char str[MAX_SIZE]; + // Validate arguments + if (hWnd == NULL || res == NULL) + { + return; + } + + SetIcon(hWnd, 0, ICO_SWITCH); + + SetFont(hWnd, L_STATUS, GetFont(_SS("DEFAULT_FONT_2"), 10, false, false, false, false)); + + LvInit(hWnd, L_STATUS); + LvSetStyle(hWnd, L_STATUS, LVS_EX_GRIDLINES); + LvInsertColumn(hWnd, L_STATUS, 0, _UU("TTC_RES_COLUMN_1"), 100); + LvInsertColumn(hWnd, L_STATUS, 1, _UU("TTC_RES_COLUMN_2"), 100); + LvInsertColumn(hWnd, L_STATUS, 2, _UU("TTC_RES_COLUMN_3"), 100); + + ct = LvInsertStart(); + + // Time that was used to measure + GetSpanStrMilli(str, sizeof(str), res->Span); + StrToUni(tmp, sizeof(tmp), str); + LvInsertAdd(ct, ICO_DATETIME, NULL, 3, _UU("TTC_RES_SPAN"), tmp, L""); + + // Correct the data for Ethernet frame + LvInsertAdd(ct, ICO_INFORMATION, NULL, 3, _UU("TTC_RES_ETHER"), res->Raw ? _UU("SEC_NO") : _UU("SEC_YES"), L""); + + // Amount of communication data of download direction + ToStr3(str, sizeof(str), res->NumBytesDownload); + UniFormat(tmp1, sizeof(tmp1), L"%S Bytes", str); + ToStrByte1000(str, sizeof(str), res->NumBytesDownload); + StrToUni(tmp2, sizeof(tmp2), str); + LvInsertAdd(ct, ICO_INFORMATION, NULL, 3, _UU("TTC_RES_BYTES_DOWNLOAD"), tmp1, tmp2); + + // Amount of communication data of upload direction + ToStr3(str, sizeof(str), res->NumBytesUpload); + UniFormat(tmp1, sizeof(tmp1), L"%S Bytes", str); + ToStrByte1000(str, sizeof(str), res->NumBytesUpload); + StrToUni(tmp2, sizeof(tmp2), str); + LvInsertAdd(ct, ICO_INFORMATION, NULL, 3, _UU("TTC_RES_BYTES_UPLOAD"), tmp1, tmp2); + + // Total amount of communication data + ToStr3(str, sizeof(str), res->NumBytesTotal); + UniFormat(tmp1, sizeof(tmp1), L"%S Bytes", str); + ToStrByte1000(str, sizeof(str), res->NumBytesTotal); + StrToUni(tmp2, sizeof(tmp2), str); + LvInsertAdd(ct, ICO_INFORMATION, NULL, 3, _UU("TTC_RES_BYTES_TOTAL"), tmp1, tmp2); + + // Calculate the total throughput of input and output of the relay equipment + LvInsertAdd(ct, ICO_INFORMATION, NULL, 3, _UU("TTC_RES_DOUBLE"), (res->Double == false) ? _UU("SEC_NO") : _UU("SEC_YES"), L""); + + // Average throughput of download direction + ToStr3(str, sizeof(str), res->BpsDownload); + UniFormat(tmp1, sizeof(tmp1), L"%S bps", str); + ToStrByte1000(str, sizeof(str), res->BpsDownload); + ReplaceStr(str, sizeof(str), str, "Bytes", "bps"); + StrToUni(tmp2, sizeof(tmp2), str); + LvInsertAdd(ct, ICO_INFORMATION, NULL, 3, _UU("TTC_RES_BPS_DOWNLOAD"), tmp1, tmp2); + + // Average throughput of upload direction + ToStr3(str, sizeof(str), res->BpsUpload); + UniFormat(tmp1, sizeof(tmp1), L"%S bps", str); + ToStrByte1000(str, sizeof(str), res->BpsUpload); + ReplaceStr(str, sizeof(str), str, "Bytes", "bps"); + StrToUni(tmp2, sizeof(tmp2), str); + LvInsertAdd(ct, ICO_INFORMATION, NULL, 3, _UU("TTC_RES_BPS_UPLOAD"), tmp1, tmp2); + + // Total average throughput + ToStr3(str, sizeof(str), res->BpsTotal); + UniFormat(tmp1, sizeof(tmp1), L"%S bps", str); + ToStrByte1000(str, sizeof(str), res->BpsTotal); + ReplaceStr(str, sizeof(str), str, "Bytes", "bps"); + StrToUni(tmp2, sizeof(tmp2), str); + LvInsertAdd(ct, ICO_INFORMATION, NULL, 3, _UU("TTC_RES_BPS_TOTAL"), tmp1, tmp2); + + LvInsertEnd(ct, hWnd, L_STATUS); + + LvAutoSize(hWnd, L_STATUS); +} + +// Dialog procedure to display results of traffic measurements +UINT CmTrafficResultDlg(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param) +{ + TT_RESULT *r = (TT_RESULT *)param; + // Validate arguments + if (hWnd == NULL) + { + return 0; + } + + switch (msg) + { + case WM_INITDIALOG: + CmTrafficResultDlgInit(hWnd, r); + break; + + case WM_COMMAND: + switch (wParam) + { + case IDOK: + case IDCANCEL: + Close(hWnd); + break; + } + break; + + case WM_CLOSE: + EndDialog(hWnd, 0); + break; + } + + return 0; +} + +// Display results of traffic measurement +void CmTrafficResult(HWND hWnd, TT_RESULT *r) +{ + // Validate arguments + if (r == NULL) + { + return; + } + + Dialog(hWnd, D_CM_TRAFFIC_RESULT, CmTrafficResultDlg, r); +} + +// Thread to wait for the termination of the client +void CmTrafficRunDlgClientWaitThread(THREAD *t, void *param) +{ + CM_TRAFFIC_DLG *d = (CM_TRAFFIC_DLG *)param; + TT_RESULT result; + UINT ret; + // Validate arguments + if (t == NULL || param == NULL) + { + return; + } + + Zero(&result, sizeof(result)); + ret = FreeTtc(d->Ttc, &result); + d->Ttc = NULL; + + d->RetCode = ret; + Copy(&d->Result, &result, sizeof(TT_RESULT)); + + PostMessage(d->hWnd, WM_APP + 66, 0, 0); +} + +// Append the string +void CmTrafficRunDlgAddStr(HWND hWnd, wchar_t *str) +{ + wchar_t *tmp; + UINT tmp_size; + + tmp_size = UniStrSize(str) + 32; + tmp = Malloc(tmp_size); + UniStrCpy(tmp, tmp_size, str); + if (UniEndWith(str, L"\n") == false) + { + UniStrCat(tmp, tmp_size, L"\n"); + } + + UniReplaceStrEx(tmp, tmp_size, tmp, L"\r\n", L"\n", false); + UniReplaceStrEx(tmp, tmp_size, tmp, L"\n", L"\r\n", false); + + if (MsIsNt()) + { + SendMsg(hWnd, E_EDIT, EM_SETSEL, 0x7fffffff, 0x7fffffff); + SendMsg(hWnd, E_EDIT, EM_REPLACESEL, false, (LPARAM)tmp); + } + else + { + char *s = CopyUniToStr(tmp); + UINT len; + + len = GetWindowTextLength(DlgItem(hWnd, E_EDIT)); + SendMsg(hWnd, E_EDIT, EM_SETSEL, 0x7fffffff, 0x7fffffff); + SendMsg(hWnd, E_EDIT, EM_SETSEL, len, len); + SendMsg(hWnd, E_EDIT, EM_REPLACESEL, false, (LPARAM)s); + Free(s); + } + + Free(tmp); +} + +// Show the string +void CmTrafficRunDlgPrintProc(void *param, wchar_t *str) +{ + CM_TRAFFIC_DLG *d = (CM_TRAFFIC_DLG *)param; + HWND hWnd; + // Validate arguments + if (param == NULL || str == NULL) + { + return; + } + + hWnd = d->hWnd; + + PostMessage(hWnd, WM_APP + 64, 0, (LPARAM)UniCopyStr(str)); +} + +// Thread for stop the measurement program +void CmTrafficRunDlgHaltThread(THREAD *t, void *param) +{ + CM_TRAFFIC_DLG *d = (CM_TRAFFIC_DLG *)param; + // Validate arguments + if (t == NULL || param == NULL) + { + return; + } + + if (d->Setting->ServerMode) + { + // Stop the server + d->RetCode = FreeTts(d->Tts); + + PostMessage(d->hWnd, WM_APP + 65, 0, 0); + } +} + +// Stop the measurement program +void CmTrafficRunDlgHalt(HWND hWnd, CM_TRAFFIC_DLG *d) +{ + // Validate arguments + if (hWnd == NULL || d == NULL) + { + return; + } + + if (d->Started == false) + { + return; + } + + if (d->Setting->ServerMode) + { + if (d->HaltThread == NULL) + { + Disable(hWnd, IDCANCEL); + d->HaltThread = NewThread(CmTrafficRunDlgHaltThread, d); + } + } + else + { + if (d->ClientEndWaitThread != NULL) + { + StopTtc(d->Ttc); + } + else + { + EndDialog(hWnd, 0); + } + } +} + +// Start the operation of traffic measurement +void CmTrafficRunDlgStart(HWND hWnd, CM_TRAFFIC_DLG *d) +{ + // Validate arguments + if (hWnd == NULL || d == NULL) + { + return; + } + + if (d->Setting->ServerMode) + { + // Start the measurement server + d->Tts = NewTts(d->Setting->Port, d, CmTrafficRunDlgPrintProc); + } + else + { + // Start the measurement client + d->Ttc = NewTtc(d->Setting->Host, d->Setting->Port, + d->Setting->NumTcp, d->Setting->Type, d->Setting->Span * 1000ULL, + d->Setting->Double, d->Setting->Raw, CmTrafficRunDlgPrintProc, d); + + d->ClientEndWaitThread = NewThread(CmTrafficRunDlgClientWaitThread, d); + } + + d->Started = true; +} + +// Traffic measurement operation dialog initialization +void CmTrafficRunDlgInit(HWND hWnd, CM_TRAFFIC_DLG *d) +{ + // Validate arguments + if (hWnd == NULL || d == NULL) + { + return; + } + + d->hWnd = hWnd; + + SetIcon(hWnd, 0, ICO_SWITCH); + DlgFont(hWnd, S_INFO, 11, false); + SetFont(hWnd, E_EDIT, GetFont(_SS("DEFAULT_FONT_2"), 0, false, false, + false, false)); + + Focus(hWnd, IDCANCEL); +} + +// Traffic measurement operation dialog procedure +UINT CmTrafficRunDlg(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param) +{ + CM_TRAFFIC_DLG *d = (CM_TRAFFIC_DLG *)param; + wchar_t *s; + // Validate arguments + if (hWnd == NULL) + { + return 0; + } + + switch (msg) + { + case WM_INITDIALOG: + CmTrafficRunDlgInit(hWnd, d); + + SetTimer(hWnd, 1, 10, NULL); + break; + + case WM_APP + 64: + // Add a string + s = (wchar_t *)lParam; + if (s != NULL) + { + CmTrafficRunDlgAddStr(hWnd, s); + Free(s); + } + break; + + case WM_APP + 65: + // Stopping complete + if (d->HaltThread != NULL) + { + WaitThread(d->HaltThread, INFINITE); + ReleaseThread(d->HaltThread); + d->HaltThread = NULL; + EndDialog(hWnd, 0); + } + break; + + case WM_APP + 66: + // Show results + if (d->RetCode == ERR_NO_ERROR) + { + CmTrafficResult(hWnd, &d->Result); + } + + if (d->ClientEndWaitThread != NULL) + { + WaitThread(d->ClientEndWaitThread, INFINITE); + ReleaseThread(d->ClientEndWaitThread); + d->ClientEndWaitThread = NULL; + } + + if (d->CloseDialogAfter) + { + EndDialog(hWnd, 0); + } + break; + + case WM_TIMER: + switch (wParam) + { + case 1: + KillTimer(hWnd, 1); + + CmTrafficRunDlgStart(hWnd, d); + break; + } + break; + + case WM_COMMAND: + switch (wParam) + { + case IDOK: + case IDCANCEL: + Close(hWnd); + break; + } + break; + + case WM_CLOSE: + d->CloseDialogAfter = true; + CmTrafficRunDlgHalt(hWnd, d); + return 1; + } + + return 0; +} + +// Execute a traffic measurement +void CmExecTraffic(HWND hWnd, CM_TRAFFIC *t) +{ + CM_TRAFFIC_DLG d; + // Validate arguments + if (t == NULL) + { + return; + } + + Zero(&d, sizeof(d)); + d.Setting = t; + d.ResultShowEvent = NewEvent(); + + MsSetThreadPriorityHigh(); + Dialog(hWnd, D_CM_TRAFFIC_RUN, CmTrafficRunDlg, &d); + MsRestoreThreadPriority(); + + ReleaseEvent(d.ResultShowEvent); +} + +// Write the settings to the registry +void CmTrafficSaveToReg(CM_TRAFFIC *t) +{ + // Validate arguments + if (t == NULL) + { + return; + } + + MsRegWriteInt(REG_CURRENT_USER, CM_TRAFFIC_REG_KEY, "ServerMode", t->ServerMode ? 1 : 0); + MsRegWriteInt(REG_CURRENT_USER, CM_TRAFFIC_REG_KEY, "Double", t->Double ? 1 : 0); + MsRegWriteInt(REG_CURRENT_USER, CM_TRAFFIC_REG_KEY, "Raw", t->Raw ? 1 : 0); + MsRegWriteInt(REG_CURRENT_USER, CM_TRAFFIC_REG_KEY, "Port", t->Port); + MsRegWriteInt(REG_CURRENT_USER, CM_TRAFFIC_REG_KEY, "NumTcp", t->NumTcp); + MsRegWriteInt(REG_CURRENT_USER, CM_TRAFFIC_REG_KEY, "Type", t->Type); + MsRegWriteInt(REG_CURRENT_USER, CM_TRAFFIC_REG_KEY, "Span", t->Span); + MsRegWriteStr(REG_CURRENT_USER, CM_TRAFFIC_REG_KEY, "Host", t->Host); +} + +// Read the settings from the registry +bool CmTrafficLoadFromReg(CM_TRAFFIC *t) +{ + char *s; + // Validate arguments + if (t == NULL) + { + return false; + } + + Zero(t, sizeof(CM_TRAFFIC)); + + if (MsRegIsKey(REG_CURRENT_USER, CM_TRAFFIC_REG_KEY) == false) + { + return false; + } + + t->Double = MsRegReadInt(REG_CURRENT_USER, CM_TRAFFIC_REG_KEY, "Double") == 0 ? false : true; + t->Raw = MsRegReadInt(REG_CURRENT_USER, CM_TRAFFIC_REG_KEY, "Raw") == 0 ? false : true; + t->Port = MsRegReadInt(REG_CURRENT_USER, CM_TRAFFIC_REG_KEY, "Port"); + if (t->Port == 0) + { + t->Port = TRAFFIC_DEFAULT_PORT; + } + + s = MsRegReadStr(REG_CURRENT_USER, CM_TRAFFIC_REG_KEY, "Host"); + + if (IsEmptyStr(s) == false) + { + Trim(s); + StrCpy(t->Host, sizeof(t->Host), s); + } + + Free(s); + + t->NumTcp = MsRegReadInt(REG_CURRENT_USER, CM_TRAFFIC_REG_KEY, "NumTcp"); + t->NumTcp = MAKESURE(t->NumTcp, 1, TRAFFIC_NUMTCP_MAX); + t->Type = MsRegReadInt(REG_CURRENT_USER, CM_TRAFFIC_REG_KEY, "Type"); + + if (t->Type != TRAFFIC_TYPE_DOWNLOAD && t->Type != TRAFFIC_TYPE_UPLOAD && + t->Type != TRAFFIC_TYPE_FULL) + { + t->Type = TRAFFIC_TYPE_FULL; + } + + t->Span = MsRegReadInt(REG_CURRENT_USER, CM_TRAFFIC_REG_KEY, "Span"); + if (t->Span == 0) + { + t->Span = TRAFFIC_SPAN_DEFAULT; + } + + t->ServerMode = MsRegReadInt(REG_CURRENT_USER, CM_TRAFFIC_REG_KEY, "ServerMode") == 0 ? false : true; + + return true; +} + +// Get the default settings +void CmTrafficGetDefaultSetting(CM_TRAFFIC *t) +{ + // Validate arguments + if (t == NULL) + { + return; + } + + Zero(t, sizeof(CM_TRAFFIC)); + + t->Double = false; + t->Raw = false; + t->Port = TRAFFIC_DEFAULT_PORT; + t->NumTcp = TRAFFIC_NUMTCP_DEFAULT; + t->Type = TRAFFIC_TYPE_FULL; + t->Span = TRAFFIC_SPAN_DEFAULT; + t->ServerMode = false; +} + +// Communication throughput measurement tool dialog initialization +void CmTrafficDlgInit(HWND hWnd) +{ + CM_TRAFFIC t; + LIST *c1, *c2; + UINT i; + // Validate arguments + if (hWnd == NULL) + { + return; + } + + DlgFont(hWnd, S_8, 9, true); + DlgFont(hWnd, S_3, 9, true); + + Zero(&t, sizeof(t)); + if (CmTrafficLoadFromReg(&t) == false) + { + CmTrafficGetDefaultSetting(&t); + } + + // Write the settings to the dialog + Check(hWnd, R_SERVER, t.ServerMode); + Check(hWnd, R_CLIENT, t.ServerMode == false); + + c1 = ReadCandidateFromReg(REG_CURRENT_USER, CM_TRAFFIC_REG_KEY, "HostCandidate"); + if (c1 != NULL) + { + UINT i; + + CbReset(hWnd, C_HOST); + + for (i = 0;i < LIST_NUM(c1);i++) + { + CANDIDATE *c = LIST_DATA(c1, i); + + CbAddStr(hWnd, C_HOST, c->Str, 0); + } + + FreeCandidateList(c1); + } + + if (CbNum(hWnd, C_HOST) == 0) + { + CbAddStr(hWnd, C_HOST, L"speed.softether.com", 0); + } + + if (IsEmptyStr(t.Host) == false) + { + SetTextA(hWnd, C_HOST, t.Host); + } + + c2 = ReadCandidateFromReg(REG_CURRENT_USER, CM_TRAFFIC_REG_KEY, "PortCandidate"); + if (c2 != NULL) + { + UINT i; + + if (t.Port != 0) + { + wchar_t tmp[32]; + + UniToStru(tmp, t.Port); + + AddCandidate(c2, tmp, 0); + } + + CbReset(hWnd, C_PORT); + + for (i = 0;i < LIST_NUM(c2);i++) + { + CANDIDATE *c = LIST_DATA(c2, i); + + CbAddStr(hWnd, C_PORT, c->Str, 0); + } + + FreeCandidateList(c2); + } + + CbReset(hWnd, C_NUM); + + for (i = 1;i <= TRAFFIC_NUMTCP_MAX;i++) + { + wchar_t tmp[32]; + + UniToStru(tmp, i); + + CbAddStr(hWnd, C_NUM, tmp, i); + } + + CbSelect(hWnd, C_NUM, t.NumTcp); + + Check(hWnd, R_DOWNLOAD, t.Type == TRAFFIC_TYPE_DOWNLOAD); + Check(hWnd, R_UPLOAD, t.Type == TRAFFIC_TYPE_UPLOAD); + Check(hWnd, R_FULL, t.Type == TRAFFIC_TYPE_FULL); + + Check(hWnd, R_ETHERNET, t.Raw ? false : true); + Check(hWnd, R_DOUBLE, t.Double); + + SetIntEx(hWnd, E_SPAN, t.Span); + + CmTrafficDlgUpdate(hWnd); +} + +// Put the contents of the dialog to structure +void CmTrafficDlgToStruct(HWND hWnd, CM_TRAFFIC *t) +{ + // Validate arguments + if (hWnd == NULL || t == NULL) + { + return; + } + + Zero(t, sizeof(CM_TRAFFIC)); + t->ServerMode = IsChecked(hWnd, R_SERVER); + GetTxtA(hWnd, C_HOST, t->Host, sizeof(t->Host)); + Trim(t->Host); + + t->Port = GetInt(hWnd, C_PORT); + t->NumTcp = CbGetSelect(hWnd, C_NUM); + t->Span = GetInt(hWnd, E_SPAN); + t->Raw = IsChecked(hWnd, R_ETHERNET) ? false : true; + t->Double = IsChecked(hWnd, R_DOUBLE); + + if (IsChecked(hWnd, R_DOWNLOAD)) + { + t->Type = TRAFFIC_TYPE_DOWNLOAD; + } + else if (IsChecked(hWnd, R_UPLOAD)) + { + t->Type = TRAFFIC_TYPE_UPLOAD; + } + else + { + t->Type = TRAFFIC_TYPE_FULL; + } +} + +// Communication throughput measurement tool dialog update +bool CmTrafficDlgUpdate(HWND hWnd) +{ + CM_TRAFFIC t; + bool ok = true; + bool client_only; + // Validate arguments + if (hWnd == NULL) + { + return false; + } + + CmTrafficDlgToStruct(hWnd, &t); + + client_only = t.ServerMode ? false : true; + + SetEnable(hWnd, C_HOST, client_only); + SetEnable(hWnd, S_5, client_only); + SetEnable(hWnd, S_8, client_only); + SetEnable(hWnd, S_9, client_only); + SetEnable(hWnd, R_DOWNLOAD, client_only); + SetEnable(hWnd, R_UPLOAD, client_only); + SetEnable(hWnd, R_FULL, client_only); + SetEnable(hWnd, S_10, client_only); + SetEnable(hWnd, S_11, client_only); + SetEnable(hWnd, C_NUM, client_only); + SetEnable(hWnd, S_14, client_only); + SetEnable(hWnd, S_12, client_only); + SetEnable(hWnd, E_SPAN, client_only); + SetEnable(hWnd, S_13, client_only); + SetEnable(hWnd, R_ETHERNET, client_only); + SetEnable(hWnd, R_DOUBLE, client_only); + + if (t.Port == 0 || t.Port >= 65536) + { + ok = false; + } + + if (t.ServerMode == false) + { + if (IsEmptyStr(t.Host)) + { + ok = false; + } + + if (t.NumTcp == 0 || t.NumTcp >= 33) + { + ok = false; + } + + if (t.Span == 0) + { + ok = false; + } + + if (t.Type == TRAFFIC_TYPE_FULL && ((t.NumTcp % 2) != 0)) + { + ok = false; + } + } + + SetEnable(hWnd, IDOK, ok); + + return ok; +} + +// Communication throughput measurement tool dialog OK button +void CmTrafficDlgOnOk(HWND hWnd) +{ + CM_TRAFFIC t; + LIST *c; + // Validate arguments + if (hWnd == NULL) + { + return; + } + + // Get the basic data + CmTrafficDlgToStruct(hWnd, &t); + + // Save to registry + CmTrafficSaveToReg(&t); + + // Retrieve and save the server name candidate + if (IsEmptyStr(t.Host) == false) + { + c = ReadCandidateFromReg(REG_CURRENT_USER, CM_TRAFFIC_REG_KEY, "HostCandidate"); + if (c != NULL) + { + wchar_t tmp[MAX_SIZE]; + + StrToUni(tmp, sizeof(tmp), t.Host); + AddCandidate(c, tmp, 0); + + WriteCandidateToReg(REG_CURRENT_USER, CM_TRAFFIC_REG_KEY, c, "HostCandidate"); + + FreeCandidateList(c); + } + } + + if (t.Port != 0 && t.Port <= 65536) + { + // Retrieve and store the port number candidate + c = ReadCandidateFromReg(REG_CURRENT_USER, CM_TRAFFIC_REG_KEY, "PortCandidate"); + if (c != NULL) + { + wchar_t tmp[MAX_SIZE]; + + UniToStru(tmp, t.Port); + AddCandidate(c, tmp, 0); + + WriteCandidateToReg(REG_CURRENT_USER, CM_TRAFFIC_REG_KEY, c, "PortCandidate"); + + FreeCandidateList(c); + } + } + + // Execute + CmExecTraffic(hWnd, &t); + + // Update the dialog + CmTrafficDlgInit(hWnd); +} + +// Communication throughput measurement tool dialog procedure +UINT CmTrafficDlgProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param) +{ + // Validate arguments + if (hWnd == NULL) + { + return 0; + } + + switch (msg) + { + case WM_INITDIALOG: + SetIcon(hWnd, 0, ICO_SWITCH); + CmTrafficDlgInit(hWnd); + break; + + case WM_COMMAND: + switch (LOWORD(wParam)) + { + case R_SERVER: + case R_CLIENT: + case C_HOST: + case C_PORT: + case R_DOWNLOAD: + case R_UPLOAD: + case R_FULL: + case C_NUM: + case E_SPAN: + case R_ETHERNET: + case R_DOUBLE: + CmTrafficDlgUpdate(hWnd); + break; + } + + switch (wParam) + { + case IDOK: + CmTrafficDlgOnOk(hWnd); + break; + + case IDCANCEL: + Close(hWnd); + break; + } + break; + + case WM_CLOSE: + EndDialog(hWnd, 0); + break; + } + + return 0; +} + +// Communication throughput measurement tool +void CmTraffic(HWND hWnd) +{ + Dialog(hWnd, D_CM_TRAFFIC, CmTrafficDlgProc, NULL); +} + +// Delete old startup file +void CmDeleteOldStartupTrayFile() +{ + char tmp[MAX_SIZE]; + char *tag = _SS("CM_JAPANESE_ONLY_OLD_STARTUP"); + if (IsEmptyStr(tag)) + { + return; + } + + Format(tmp, sizeof(tmp), tag, MsGetCommonStartupDir()); + + FileDelete(tmp); +} + +// PKCS license confirmation dialog +UINT CmPkcsEulaDlg(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param) +{ + UINT id; + SECURE_DEVICE *dev; + char *name; + // Validate arguments + if (hWnd == NULL) + { + return 0; + } + + switch (msg) + { + case WM_INITDIALOG: + id = (UINT)param; + dev = GetSecureDevice(id); + if (dev == NULL) + { + EndDialog(hWnd, 0); + return 0; + } + + name = dev->ModuleName; + + FormatText(hWnd, S_INFO_1, name); + FormatText(hWnd, S_INFO_2, name, name); + FormatText(hWnd, S_INFO_3, name); + + break; + + case WM_COMMAND: + switch (wParam) + { + case IDOK: + EndDialog(hWnd, 1); + break; + + case IDCANCEL: + Close(hWnd); + break; + } + break; + + case WM_CLOSE: + EndDialog(hWnd, 0); + break; + } + + return 0; +} + +// Confirmation screen of whether the user accepts the EULA of the PKCS DLL +bool CmCheckPkcsEula(HWND hWnd, UINT id) +{ + return (Dialog(hWnd, D_CM_PKCSEULA, CmPkcsEulaDlg, (void *)id) == 0) ? false : true; +} + +// Update controls +void CmSecurePinDlgUpdate(HWND hWnd) +{ + char *tmp1, *tmp2, *tmp3; + bool ok = true; + // Validate arguments + if (hWnd == NULL) + { + return; + } + + tmp1 = GetTextA(hWnd, E_PIN1); + tmp2 = GetTextA(hWnd, E_PIN2); + tmp3 = GetTextA(hWnd, E_PIN3); + if (IsEmptyStr(tmp1)) + { + ok = false; + } + if (IsEmptyStr(tmp2)) + { + ok = false; + } + if (IsEmptyStr(tmp3)) + { + ok = false; + } + if (StrCmp(tmp2, tmp3) != 0) + { + ok = false; + } + Free(tmp1); + Free(tmp2); + Free(tmp3); + SetEnable(hWnd, IDOK, ok); +} + +// PIN code changing dialog +UINT CmSecurePinDlg(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param) +{ + UINT id = (UINT)param; + char *src, *dst; + SECURE *s; + // Validate arguments + if (hWnd == NULL) + { + return 0; + } + + switch (msg) + { + case WM_INITDIALOG: + CmSecurePinDlgUpdate(hWnd); + break; + + case WM_COMMAND: + switch (LOWORD(wParam)) + { + case E_PIN1: + case E_PIN2: + case E_PIN3: + CmSecurePinDlgUpdate(hWnd); + break; + } + + switch (wParam) + { + case IDOK: + src = GetTextA(hWnd, E_PIN1); + dst = GetTextA(hWnd, E_PIN3); + + Disable(hWnd, IDOK); + Disable(hWnd, IDCANCEL); + + s = OpenSec(id); + if (s == NULL) + { + if (GetSecureDevice(id) != NULL) + { + MsgBoxEx(hWnd, MB_ICONEXCLAMATION, _UU("SEC_PIN_DEVICE_OPEN_ERR"), + GetSecureDevice(id)->DeviceName); + } + else + { + MsgBoxEx(hWnd, MB_ICONEXCLAMATION, _UU("SEC_PIN_DEVICE_OPEN_ERR"), + "Unknown"); + } + } + else + { + if (OpenSecSession(s, 0) == false) + { + if (GetSecureDevice(id) != NULL) + { + MsgBoxEx(hWnd, MB_ICONEXCLAMATION, _UU("SEC_PIN_DEVICE_OPEN_ERR"), + GetSecureDevice(id)->DeviceName); + } + else + { + MsgBoxEx(hWnd, MB_ICONEXCLAMATION, _UU("SEC_PIN_DEVICE_OPEN_ERR"), + "Unknown"); + } + } + else + { + if (LoginSec(s, src) == false) + { + MsgBox(hWnd, MB_ICONEXCLAMATION, _UU("SEC_PIN_CURRENT_BAD")); + FocusEx(hWnd, E_PIN1); + } + else + { + if (ChangePin(s, src, dst) == false) + { + MsgBox(hWnd, MB_ICONEXCLAMATION, _UU("SEC_PIN_CHANGE_FAILED")); + FocusEx(hWnd, E_PIN1); + } + else + { + // Clear the cache for PIN code + cached_pin_code_expires = 0; + cached_pin_code[0] = 0; + MsgBox(hWnd, MB_ICONINFORMATION, _UU("SEC_PIN_OK")); + EndDialog(hWnd, true); + } + + LogoutSec(s); + } + + CloseSecSession(s); + } + CloseSec(s); + } + + Enable(hWnd, IDOK); + Enable(hWnd, IDCANCEL); + + Free(src); + Free(dst); + break; + + case IDCANCEL: + Close(hWnd); + break; + } + break; + + case WM_CLOSE: + EndDialog(hWnd, false); + break; + } + + return 0; +} + +// Change the PIN code +void CmSecurePin(HWND hWnd, UINT id) +{ + // Validate arguments + if (hWnd == NULL || id == 0 || CheckSecureDeviceId(id) == false) + { + return; + } + + Dialog(hWnd, D_CM_SECURE_PIN, CmSecurePinDlg, (void *)id); +} + +// Object type selection dialog +UINT CmSecureTypeDlg(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param) +{ + UINT type; + // Validate arguments + if (hWnd == NULL) + { + return 0; + } + + switch (msg) + { + case WM_INITDIALOG: + type = MsRegReadInt(REG_CURRENT_USER, SECURE_MANAGER_KEY, "DefaultImportType"); + Check(hWnd, R_DATA, type == SEC_DATA); + Check(hWnd, R_CERT, type == SEC_X); + Check(hWnd, R_KEY, type == SEC_K); + goto UPDATE_CONTROL; + + case WM_COMMAND: + switch (wParam) + { + case IDOK: + type = SEC_DATA; + if (IsChecked(hWnd, R_CERT)) + { + type = SEC_X; + } + else if (IsChecked(hWnd, R_KEY)) + { + type = SEC_K; + } + + MsRegWriteInt(REG_CURRENT_USER, SECURE_MANAGER_KEY, "DefaultImportType", type); + + EndDialog(hWnd, type); + break; + + case IDCANCEL: + Close(hWnd); + break; + case R_CERT: + case R_KEY: + case R_DATA: +UPDATE_CONTROL: + SetEnable(hWnd, IDOK, IsChecked(hWnd, R_CERT) || + IsChecked(hWnd, R_KEY) || + IsChecked(hWnd, R_DATA)); + break; + } + break; + + case WM_CLOSE: + EndDialog(hWnd, INFINITE); + break; + } + + return 0; +} + +// Object type selection +UINT CmSecureType(HWND hWnd) +{ + return Dialog(hWnd, D_CM_SECURE_TYPE, CmSecureTypeDlg, NULL); +} + +// Initialize the dialog +void CmSecureManagerDlgInit(HWND hWnd, UINT id) +{ + SECURE_DEVICE *dev; + // Validate arguments + if (hWnd == NULL || id == 0) + { + return; + } + + SetIcon(hWnd, 0, ICO_SECURE); + + dev = GetSecureDevice(id); + if (dev != NULL) + { + FormatText(hWnd, S_INFO, dev->DeviceName); + } + + SetFont(hWnd, B_BOLD, Font(0, true)); + + LvInit(hWnd, L_LIST); + LvInsertColumn(hWnd, L_LIST, 0, _UU("SEC_MGR_COLUMN1"), 200); + LvInsertColumn(hWnd, L_LIST, 1, _UU("SEC_MGR_COLUMN2"), 110); + + CmSecureManagerDlgUpdate(hWnd, id); +} + +// Update controls +void CmSecureManagerDlgUpdate(HWND hWnd, UINT id) +{ + bool b = true; + bool read_only = IsJPKI(id); + // Validate arguments + if (hWnd == NULL) + { + return; + } + + if (LvIsSingleSelected(hWnd, L_LIST) == false) + { + b = false; + } + + SetEnable(hWnd, B_EXPORT, b && ((UINT)LvGetParam(hWnd, L_LIST, LvGetSelected(hWnd, L_LIST)) != SEC_K)); + SetEnable(hWnd, B_DELETE, b && (read_only == false)); + SetEnable(hWnd, B_PIN, (read_only == false)); + SetEnable(hWnd, B_IMPORT, (read_only == false)); + SetEnable(hWnd, B_NEW_CERT, (read_only == false)); +} + +// Content update +void CmSecureManagerDlgRefresh(HWND hWnd, UINT id) +{ + bool ret; + LIST *o; + WINUI_SECURE_BATCH batch[] = + { + {WINUI_SECURE_ENUM_OBJECTS, NULL, false, NULL, NULL, NULL, NULL, NULL, NULL}, + }; + // Validate arguments + if (hWnd == NULL || id == 0) + { + return; + } + + ret = SecureDeviceWindow(hWnd, batch, sizeof(batch) / sizeof(batch[0]), id, 0); + + if (ret == false) + { + return; + } + + o = batch[0].EnumList; + if (o != NULL) + { + CmSecureManagerDlgPrintList(hWnd, o); + + FreeEnumSecObject(o); + } + + // update controls + CmSecureManagerDlgUpdate(hWnd, id); +} + +// Show the list of secure objects +void CmSecureManagerDlgPrintList(HWND hWnd, LIST *o) +{ + CmSecureManagerDlgPrintListEx(hWnd, L_LIST, o, INFINITE); +} +void CmSecureManagerDlgPrintListEx(HWND hWnd, UINT id, LIST *o, UINT type) +{ + UINT i; + LVB *v; + // Validate arguments + if (hWnd == NULL || o == NULL) + { + return; + } + + LvReset(hWnd, id); + + v = LvInsertStart(); + + for (i = 0;i < LIST_NUM(o);i++) + { + UINT icon = ICO_LOG2; + wchar_t tmp1[MAX_SIZE], *tmp2, *tmp3; + SEC_OBJ *obj = LIST_DATA(o, i); + + if (type == INFINITE || obj->Type == type) + { + StrToUni(tmp1, sizeof(tmp1), obj->Name); + tmp2 = CmSecureObjTypeToStr(obj->Type); + tmp3 = obj->Private ? _UU("SEC_YES") : _UU("SEC_NO"); + + if (obj->Type == SEC_X) + { + icon = ICO_CERT; + } + else if (obj->Type == SEC_K || obj->Type == SEC_P) + { + icon = ICO_KEY; + } + + LvInsertAdd(v, icon, (void *)obj->Type, 2, tmp1, tmp2); + } + } + + LvInsertEnd(v, hWnd, id); +} + +// Convert the type of secure object to a string +wchar_t *CmSecureObjTypeToStr(UINT type) +{ + wchar_t *ret = _UU("SEC_TYPE_DATA"); + + if (type == SEC_X) + { + ret = _UU("SEC_TYPE_CERT"); + } + else if (type == SEC_K) + { + ret = _UU("SEC_TYPE_KEY"); + } + else if (type == SEC_P) + { + ret = _UU("SEC_TYPE_PUB"); + } + + return ret; +} + +// Write by creating a new certificate +void CmSecureManagerDlgNewCert(HWND hWnd, UINT id) +{ + X *x; + K *k; + char default_name[MAX_SIZE]; + char *object_name; + bool ok = false; + WINUI_SECURE_BATCH batch[] = + { + {WINUI_SECURE_WRITE_CERT, NULL, true, NULL, NULL, NULL, NULL, NULL, NULL}, + {WINUI_SECURE_WRITE_KEY, NULL, true, NULL, NULL, NULL, NULL, NULL, NULL}, + {WINUI_SECURE_ENUM_OBJECTS, NULL, false, NULL, NULL, NULL, NULL, NULL, NULL}, + }; + // Validate arguments + if (hWnd == NULL || id == 0) + { + return; + } + + // Dialog for creating certificate + if (SmCreateCert(hWnd, &x, &k, true, NULL, false) == false) + { + return; + } + // Generate the default name + GetPrintNameFromXA(default_name, sizeof(default_name), x); + ConvertSafeFileName(default_name, sizeof(default_name), default_name); + + object_name = StringDlgA(hWnd, _UU("SEC_OBJECT_NAME_TITLE"), + _UU("SEC_OBJECT_NAME_INFO"), default_name, ICO_CERT, false, false); + + if (object_name != NULL) + { + // Enumerate and write + batch[0].InputX = x; + batch[0].Name = object_name; + batch[1].InputK = k; + batch[1].Name = object_name; + + if (SecureDeviceWindow(hWnd, batch, sizeof(batch) / sizeof(batch[0]), id, 0) == false) + { + // Failure + } + else + { + ok = true; + } + + Free(object_name); + } + + if (ok) + { + LIST *o = batch[2].EnumList; + + CmSecureManagerDlgPrintList(hWnd, o); + + FreeEnumSecObject(o); + + MsgBox(hWnd, MB_ICONINFORMATION, _UU("SEC_NEW_CERT_IMPORT_OK")); + } + + FreeX(x); + FreeK(k); +} + +// Import +void CmSecureManagerDlgImport(HWND hWnd, UINT id) +{ + UINT type; + char name[MAX_SIZE]; + wchar_t tmp2[MAX_SIZE]; + wchar_t *tmp; + wchar_t *filename; + BUF *b; + K *k; + bool ok = false; + X *x; + WINUI_SECURE_BATCH batch[] = + { + {WINUI_SECURE_WRITE_DATA, name, true, NULL, NULL, NULL, NULL, NULL, NULL}, + {WINUI_SECURE_ENUM_OBJECTS, NULL, false, NULL, NULL, NULL, NULL, NULL, NULL}, + }; + // Validate arguments + if (hWnd == NULL || id == 0) + { + return; + } + + // Select the type of secure object + type = CmSecureType(hWnd); + + switch (type) + { + case SEC_DATA: + // Data + tmp = OpenDlg(hWnd, _UU("DLG_ALL_FILES"), _UU("SEC_IMPORT_DATA")); + if (tmp == NULL) + { + return; + } + + filename = CopyUniStr(tmp); + Free(tmp); + + // Read the file + b = ReadDumpW(filename); + if (b == NULL) + { + // Read failure + MsgBox(hWnd, MB_ICONSTOP, _UU("SEC_READ_FAILED")); + } + else + { + if (b->Size > MAX_SEC_DATA_SIZE) + { + // File size is too large + MsgBoxEx(hWnd, MB_ICONEXCLAMATION, _UU("SEC_DATA_TOO_BIG"), MAX_SEC_DATA_SIZE); + } + else + { + // Generate the default name + char default_name[MAX_SIZE]; + wchar_t default_name_w[MAX_SIZE]; + char *object_name; + GetFileNameFromFilePathW(default_name_w, sizeof(default_name_w), filename); + UniToStr(default_name, sizeof(default_name), default_name_w); + ConvertSafeFileName(default_name, sizeof(default_name), default_name); + + object_name = StringDlgA(hWnd, _UU("SEC_OBJECT_NAME_TITLE"), + _UU("SEC_OBJECT_NAME_INFO"), default_name, ICO_LOG2, false, false); + + if (object_name != NULL) + { + // Enumerate and write + batch[0].InputData = b; + batch[0].Name = object_name; + + if (SecureDeviceWindow(hWnd, batch, sizeof(batch) / sizeof(batch[0]), id, 0) == false) + { + // Failure + } + else + { + ok = true; + } + + Free(object_name); + } + } + + FreeBuf(b); + } + + Free(filename); + break; + + case SEC_X: + // Read a certificate + if (CmLoadXExW(hWnd, &x, tmp2, sizeof(tmp2))) + { + // Generate the default name + char default_name[MAX_SIZE]; + wchar_t default_name_w[MAX_PATH]; + char *object_name; + GetFileNameFromFilePathW(default_name_w, sizeof(default_name_w), tmp2); + UniToStr(default_name, sizeof(default_name), default_name_w); + ConvertSafeFileName(default_name, sizeof(default_name), default_name); + + object_name = StringDlgA(hWnd, _UU("SEC_OBJECT_NAME_TITLE"), + _UU("SEC_OBJECT_NAME_INFO"), default_name, ICO_CERT, false, false); + + if (object_name != NULL) + { + // Enumerate and write + batch[0].Type = WINUI_SECURE_WRITE_CERT; + batch[0].InputX = x; + batch[0].Name = object_name; + + if (SecureDeviceWindow(hWnd, batch, sizeof(batch) / sizeof(batch[0]), id, 0) == false) + { + // Failure + } + else + { + ok = true; + } + + Free(object_name); + } + + FreeX(x); + } + + break; + + case SEC_K: + // Secret key + if (CmLoadKExW(hWnd, &k, tmp2, sizeof(tmp2))) + { + // Generate the default name + char default_name[MAX_SIZE]; + wchar_t default_name_w[MAX_PATH]; + char *object_name; + GetFileNameFromFilePathW(default_name_w, sizeof(default_name_w), tmp2); + UniToStr(default_name, sizeof(default_name), default_name_w); + ConvertSafeFileName(default_name, sizeof(default_name), default_name); + + object_name = StringDlgA(hWnd, _UU("SEC_OBJECT_NAME_TITLE"), + _UU("SEC_OBJECT_NAME_INFO"), default_name, ICO_KEY, false, false); + + if (object_name != NULL) + { + // Enumerate and write + batch[0].Type = WINUI_SECURE_WRITE_KEY; + batch[0].InputK = k; + batch[0].Name = object_name; + + if (SecureDeviceWindow(hWnd, batch, sizeof(batch) / sizeof(batch[0]), id, 0) == false) + { + // Failure + } + else + { + ok = true; + } + + Free(object_name); + } + + FreeK(k); + } + break; + + default: + // Invalid + return; + } + + if (ok) + { + LIST *o = batch[1].EnumList; + + CmSecureManagerDlgPrintList(hWnd, o); + + FreeEnumSecObject(o); + + MsgBox(hWnd, MB_ICONINFORMATION, _UU("SEC_OBJECT_IMPORT_OK")); + } +} + +// Export the object +void CmSecureManagerDlgExport(HWND hWnd, UINT id) +{ + char name[MAX_SIZE]; + UINT method = WINUI_SECURE_READ_DATA; + char *tmp; + UINT type; + wchar_t filename[MAX_PATH]; + wchar_t *uni_tmp; + X *x; + BUF *b; + wchar_t default_name[128]; + WINUI_SECURE_BATCH batch[] = + { + {WINUI_SECURE_READ_DATA, name, true, NULL, NULL, NULL, NULL, NULL, NULL}, + }; + UINT i; + // Validate arguments + if (hWnd == NULL || id == 0) + { + return; + } + + i = LvGetSelected(hWnd, L_LIST); + if (i == INFINITE) + { + return; + } + + tmp = LvGetStrA(hWnd, L_LIST, i, 0); + StrCpy(name, sizeof(name), tmp); + Free(tmp); + + type = (UINT)LvGetParam(hWnd, L_LIST, i); + + switch (type) + { + case SEC_X: + method = WINUI_SECURE_READ_CERT; + break; + + default: + method = WINUI_SECURE_READ_DATA; + break; + } + + batch[0].Type = method; + + // Operate the smart card + if (SecureDeviceWindow(hWnd, batch, sizeof(batch) / sizeof(batch[0]), id, 0) == false) + { + return; + } + + switch (type) + { + case SEC_X: + // Certificate + x = batch[0].OutputX; + + CertDlg(hWnd, x, NULL, true); + + FreeX(x); + break; + + default: + // File + b = batch[0].OutputData; + StrToUni(default_name, sizeof(default_name), name); + uni_tmp = SaveDlg(hWnd, _UU("DLG_ALL_FILES"), _UU("DLG_SAVE_FILE"), default_name, NULL); + + if (uni_tmp != NULL) + { + UniStrCpy(filename, sizeof(filename), uni_tmp); + + DumpBufW(b, filename); + + Free(uni_tmp); + + MsgBox(hWnd, MB_ICONINFORMATION, _UU("SEC_OBJECT_EXPORT_OK")); + } + + + FreeBuf(b); + break; + } +} + +// Delete the object +void CmSecureManagerDlgDelete(HWND hWnd, UINT id) +{ + char name[MAX_SIZE]; + UINT method = WINUI_SECURE_DELETE_DATA; + char *tmp; + UINT type; + LIST *o; + WINUI_SECURE_BATCH batch[] = + { + {WINUI_SECURE_DELETE_OBJECT, name, false, NULL, NULL, NULL, NULL, NULL, NULL}, + {WINUI_SECURE_ENUM_OBJECTS, NULL, false, NULL, NULL, NULL, NULL, NULL, NULL}, + }; + UINT i; + // Validate arguments + if (hWnd == NULL || id == 0) + { + return; + } + + i = LvGetSelected(hWnd, L_LIST); + if (i == INFINITE) + { + return; + } + + tmp = LvGetStrA(hWnd, L_LIST, i, 0); + StrCpy(name, sizeof(name), tmp); + Free(tmp); + + type = (UINT)LvGetParam(hWnd, L_LIST, i); + + switch (type) + { + case SEC_X: + method = WINUI_SECURE_DELETE_CERT; + break; + + case SEC_K: + method = WINUI_SECURE_DELETE_KEY; + break; + + default: + method = WINUI_SECURE_DELETE_DATA; + break; + } + + batch[0].Type = method; + + if (SecureDeviceWindow(hWnd, batch, sizeof(batch) / sizeof(batch[0]), id, 0) == false) + { + return; + } + + o = batch[1].EnumList; + + CmSecureManagerDlgPrintList(hWnd, o); + + FreeEnumSecObject(o); +} + +static bool cm_secure_manager_no_new_cert = false; + +// Smart Card Manager dialog +UINT CmSecureManagerDlg(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param) +{ + NMHDR *n; + UINT id = (UINT)param; + // Validate arguments + if (hWnd == NULL) + { + return 0; + } + + switch (msg) + { + case WM_INITDIALOG: + CmSecureManagerDlgInit(hWnd, id); + + if (cm_secure_manager_no_new_cert) + { + Hide(hWnd, B_NEW_CERT); + } + + SetTimer(hWnd, 1, 1, NULL); + break; + + case WM_COMMAND: + switch (wParam) + { + case B_REFRESH: + CmSecureManagerDlgRefresh(hWnd, id); + break; + + case B_IMPORT: + CmSecureManagerDlgImport(hWnd, id); + break; + + case B_EXPORT: + CmSecureManagerDlgExport(hWnd, id); + break; + + case B_DELETE: + if (MsgBox(hWnd, MB_YESNO | MB_ICONEXCLAMATION | MB_DEFBUTTON2, + _UU("SEC_DELETE_MSG")) == IDYES) + { + CmSecureManagerDlgDelete(hWnd, id); + } + break; + + case B_NEW_CERT: + CmSecureManagerDlgNewCert(hWnd, id); + break; + + case B_PIN: + CmSecurePin(hWnd, id); + break; + + case IDCANCEL: + Close(hWnd); + break; + } + break; + + case WM_TIMER: + switch (wParam) + { + case 1: + KillTimer(hWnd, 1); + + CmSecureManagerDlgRefresh(hWnd, id); + break; + } + break; + + case WM_CLOSE: + EndDialog(hWnd, 0); + break; + + case WM_NOTIFY: + n = (NMHDR *)lParam; + switch (n->idFrom) + { + case L_LIST: + switch (n->code) + { + case LVN_ITEMCHANGED: + CmSecureManagerDlgUpdate(hWnd, id); + break; + } + break; + } + break; + } + + return 0; +} + +// Smart Card Manager +void CmSecureManager(HWND hWnd, UINT id) +{ + CmSecureManagerEx(hWnd, id, false); +} +void CmSecureManagerEx(HWND hWnd, UINT id, bool no_new_cert) +{ + // Validate arguments + if (hWnd == NULL || id == 0) + { + return; + } + + // ID check + if (CheckSecureDeviceId(id) == false) + { + MsgBox(hWnd, MB_ICONEXCLAMATION, _UU("SEC_INVALID_ID")); + return; + } + + if (no_new_cert) + { + cm_secure_manager_no_new_cert = true; + } + else + { + cm_secure_manager_no_new_cert = false; + } + + Dialog(hWnd, D_CM_SECURE_MANAGER, CmSecureManagerDlg, (void *)id); +} + +// Smart Card Manager for Client +void CmClientSecureManager(HWND hWnd) +{ + RPC_USE_SECURE t; + UINT id; + + Zero(&t, sizeof(t)); + CcGetUseSecure(cm->Client, &t); + + id = t.DeviceId; + + if (id == 0 || CheckSecureDeviceId(id) == false) + { + id = CmClientSelectSecure(hWnd); + } + + if (id == 0) + { + return; + } + + CmSecureManager(hWnd, id); +} + +// Initialize the dialog +void CmSelectSecureDlgInit(HWND hWnd, UINT default_id) +{ + UINT i; + LIST *o; + LVB *v; + + SetIcon(hWnd, 0, ICO_SECURE); + + o = GetSecureDeviceList(); + + LvInit(hWnd, L_LIST); + LvInsertColumn(hWnd, L_LIST, 0, _UU("SEC_COLUMN1"), 150); + LvInsertColumn(hWnd, L_LIST, 1, _UU("SEC_COLUMN2"), 100); + LvInsertColumn(hWnd, L_LIST, 2, _UU("SEC_COLUMN3"), 130); + LvInsertColumn(hWnd, L_LIST, 3, _UU("SEC_COLUMN4"), 100); + + v = LvInsertStart(); + + for (i = 0;i < LIST_NUM(o);i++) + { + wchar_t tmp1[MAX_SIZE]; + wchar_t *tmp2; + wchar_t tmp3[MAX_SIZE]; + wchar_t tmp4[MAX_SIZE]; + SECURE_DEVICE *dev = LIST_DATA(o, i); + + StrToUni(tmp1, sizeof(tmp1), dev->DeviceName); + tmp2 = (dev->Type == SECURE_IC_CARD) ? _UU("SEC_SMART_CARD") : _UU("SEC_USB_TOKEN"); + StrToUni(tmp3, sizeof(tmp3), dev->Manufacturer); + StrToUni(tmp4, sizeof(tmp4), dev->ModuleName); + + LvInsertAdd(v, ICO_SECURE, (void *)dev->Id, 4, tmp1, tmp2, tmp3, tmp4); + } + + LvInsertEnd(v, hWnd, L_LIST); + + if (default_id != 0) + { + LvSelect(hWnd, L_LIST, LvSearchParam(hWnd, L_LIST, (void *)default_id)); + } + + ReleaseList(o); + + // Control update + CmSelectSecureDlgUpdate(hWnd); +} + +// Update controls of the dialog +void CmSelectSecureDlgUpdate(HWND hWnd) +{ + SetEnable(hWnd, IDOK, LvIsSingleSelected(hWnd, L_LIST)); +} + +// Smart card selection dialog +UINT CmSelectSecureDlg(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param) +{ + UINT default_id = (UINT)param; + NMHDR *n = NULL; + static UINT old_id; + // Validate arguments + if (hWnd == NULL) + { + return 0; + } + + switch (msg) + { + case WM_INITDIALOG: + old_id = default_id; + CmSelectSecureDlgInit(hWnd, default_id); + + if (LvNum(hWnd, L_LIST) == 0) + { + // There is no smart card + SetTimer(hWnd, 1, 100, NULL); + } + break; + + case WM_TIMER: + switch (wParam) + { + case 1: + KillTimer(hWnd, 1); + + Disable(hWnd, L_LIST); + MsgBox(hWnd, MB_ICONINFORMATION, _UU("SEC_NO_SECURE_DEVICE")); + break; + } + break; + + case WM_COMMAND: + switch (wParam) + { + case IDOK: + if (IsEnable(hWnd, IDOK)) + { + UINT i = LvGetSelected(hWnd, L_LIST); + if (i != INFINITE) + { + UINT id = (UINT)LvGetParam(hWnd, L_LIST, i); + + if (old_id != id) + { + if (CmCheckPkcsEula(hWnd, id) == false) + { + break; + } + } + EndDialog(hWnd, id); + } + } + break; + + case IDCANCEL: + Close(hWnd); + break; + } + break; + + case WM_CLOSE: + EndDialog(hWnd, 0); + break; + + case WM_NOTIFY: + n = (NMHDR *)lParam; + switch (n->idFrom) + { + case L_LIST: + switch (n->code) + { + case LVN_ITEMCHANGED: + CmSelectSecureDlgUpdate(hWnd); + break; + case NM_DBLCLK: + Command(hWnd, IDOK); + break; + } + break; + } + break; + } + + return 0; +} + +// Select the smart card device to be used +UINT CmSelectSecure(HWND hWnd, UINT current_id) +{ + return Dialog(hWnd, D_CM_SELECT_SECURE, CmSelectSecureDlg, (void *)current_id); +} + +// Select the smart card device to be used (client) +UINT CmClientSelectSecure(HWND hWnd) +{ + UINT id; + RPC_USE_SECURE t; + + if (cm->server_name != NULL) + { + MsgBox(hWnd, MB_ICONEXCLAMATION, _UU("CM_SECURE_MUST_LOCAL")); + return 0; + } + + Zero(&t, sizeof(t)); + CcGetUseSecure(cm->Client, &t); + + id = t.DeviceId; + + id = CmSelectSecure(hWnd, id); + if (id != 0) + { + Zero(&t, sizeof(t)); + t.DeviceId = id; + + CALL(hWnd, CcUseSecure(cm->Client, &t)); + + SmWriteSelectSecureIdReg(id); + } + + return id; +} + +// Shortcut connection +void CmConnectShortcut(UCHAR *key) +{ + UINT ret; + // Validate arguments + if (key == NULL) + { + return; + } + + // Attempt to connect + ret = CcShortcut(key); + + if (ret != ERR_NO_ERROR) + { + if (ret == ERR_ACCOUNT_ACTIVE) + { + // Because it is currently connected, to query whether or not to disconnect + if (MsgBox(NULL, MB_ICONQUESTION | MB_YESNO | MB_DEFBUTTON2, _UU("CM_SHORTCUT_DISCONNECT")) == IDYES) + { + // Try to disconnect + ret = CcShortcutDisconnect(key); + + if (ret != ERR_NO_ERROR) + { + // Error + MsgBox(NULL, MB_ICONEXCLAMATION, GetUniErrorStr(ret)); + } + } + } + else + { + // Other errors + MsgBox(NULL, MB_ICONEXCLAMATION, GetUniErrorStr(ret)); + } + } +} + +// Play the audio guide +void CmVoice(char *name) +{ + UINT i; + // Validate arguments + if (name == NULL) + { + return; + } + + // Voice guidance features disappeared!! + return; + + if (cm->DisableVoice) + { + return; + } + + for (i = 0;i < sizeof(cm_voice) / sizeof(CM_VOICE);i++) + { + if (cm_voice[i].voice_id == cm->VoiceId) + { + char tmp[MAX_SIZE]; + Format(tmp, sizeof(tmp), "%s_%s.wav", cm_voice[i].perfix, name); + MsPlaySound(tmp); + return; + } + } +} + +// Update the password changing dialog +void CmChangePasswordUpdate(HWND hWnd, CM_CHANGE_PASSWORD *p) +{ + bool ok = true; + char *s1, *s2; + // Validate arguments + if (hWnd == NULL || p == NULL) + { + return; + } + + if (IsEmpty(hWnd, E_USERNAME)) + { + ok = false; + } + + s1 = GetTextA(hWnd, E_NEW_PASSWORD1); + s2 = GetTextA(hWnd, E_NEW_PASSWORD2); + + if (StrCmp(s1, s2) != 0) + { + ok = false; + } + + Free(s1); + Free(s2); + + SetEnable(hWnd, IDOK, ok); +} + +// Password changing dialog procedure +UINT CmChangePasswordProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param) +{ + CM_CHANGE_PASSWORD *p = (CM_CHANGE_PASSWORD *)param; + char username[MAX_USERNAME_LEN + 1]; + char old_pass[MAX_PASSWORD_LEN + 1]; + char new_pass[MAX_PASSWORD_LEN + 1]; + UINT ret; + // Validate arguments + if (hWnd == NULL) + { + return 0; + } + + switch (msg) + { + case WM_INITDIALOG: + SetTextA(hWnd, E_HUBNAME, p->HubName); + SetTextA(hWnd, E_USERNAME, p->Username); + FormatText(hWnd, S_TITLE, p->ClientOption->Hostname); + + if (IsEmpty(hWnd, E_USERNAME)) + { + FocusEx(hWnd, E_USERNAME); + } + else + { + FocusEx(hWnd, E_OLD_PASSWORD); + } + + CmChangePasswordUpdate(hWnd, p); + break; + + case WM_COMMAND: + switch (LOWORD(wParam)) + { + case E_USERNAME: + case E_OLD_PASSWORD: + case E_NEW_PASSWORD1: + case E_NEW_PASSWORD2: + CmChangePasswordUpdate(hWnd, p); + break; + } + + switch (wParam) + { + case IDOK: + GetTxtA(hWnd, E_USERNAME, username, sizeof(username)); + GetTxtA(hWnd, E_OLD_PASSWORD, old_pass, sizeof(old_pass)); + GetTxtA(hWnd, E_NEW_PASSWORD1, new_pass, sizeof(new_pass)); + + Disable(hWnd, E_USERNAME); + Disable(hWnd, E_OLD_PASSWORD); + Disable(hWnd, E_NEW_PASSWORD1); + Disable(hWnd, E_NEW_PASSWORD2); + Disable(hWnd, IDOK); + Disable(hWnd, IDCANCEL); + + ret = ChangePassword(cm->Cedar, p->ClientOption, p->HubName, username, old_pass, new_pass); + + if (ret == ERR_NO_ERROR) + { + MsgBox(hWnd, MB_ICONINFORMATION, _UU("CM_PASSWORD_CHANGED")); + EndDialog(hWnd, true); + } + else + { + MsgBox(hWnd, MB_ICONSTOP, _E(ret)); + Enable(hWnd, E_USERNAME); + Enable(hWnd, E_OLD_PASSWORD); + Enable(hWnd, E_NEW_PASSWORD1); + Enable(hWnd, E_NEW_PASSWORD2); + Enable(hWnd, IDOK); + Enable(hWnd, IDCANCEL); + + SetTextA(hWnd, E_OLD_PASSWORD, ""); + SetTextA(hWnd, E_NEW_PASSWORD1, ""); + SetTextA(hWnd, E_NEW_PASSWORD2, ""); + + Focus(hWnd, E_OLD_PASSWORD); + } + + break; + + case IDCANCEL: + Close(hWnd); + break; + + } + + break; + + case WM_CLOSE: + EndDialog(hWnd, false); + break; + } + + return 0; +} + +// Show the password changing dialog +void CmChangePassword(HWND hWnd, CLIENT_OPTION *o, char *hubname, char *username) +{ + CM_CHANGE_PASSWORD p; + // Validate arguments + if (hWnd == NULL || o == NULL || hubname == NULL || username == NULL) + { + return; + } + + Zero(&p, sizeof(p)); + StrCpy(p.Username, sizeof(p.Username), username); + StrCpy(p.HubName, sizeof(p.HubName), hubname); + p.ClientOption = o; + + CmVoice("password"); + + Dialog(hWnd, D_CM_CHANGE_PASSWORD, CmChangePasswordProc, &p); +} + +// Prohibit the installation of the virtual LAN card +bool CmStopInstallVLan(HWND hWnd) +{ + if (cm->Client->Unix) + { + // There is no need to be prohibited if the client is an UNIX + return true; + } + if (cm->Client->Win9x) + { + // There is no need to prohibit if the client is a Win9x + return true; + } + + return true; + + if (MsIsTerminalServiceInstalled() || MsIsUserSwitchingInstalled()) + { + if (MsGetCurrentTerminalSessionId() == 0) + { + // There is no need to prohibit + return true; + } + else + { + // Prohibit to install the device drivers since + // the user logged in other than the console session + wchar_t *user = MsGetSessionUserName(0); + + if (user == NULL) + { + MsgBoxEx(hWnd, MB_ICONEXCLAMATION, _UU("CM_STOP_INST_VLAN_2"), + MsIsTerminalServiceInstalled() ? _UU("CM_DESKTOP_MSG_LOCAL_TS") : _UU("CM_DESKTOP_MSG_LOCAL_SW"), + MsGetCurrentTerminalSessionId()); + } + else + { + MsgBoxEx(hWnd, MB_ICONEXCLAMATION, _UU("CM_STOP_INST_VLAN_1"), + MsIsTerminalServiceInstalled() ? _UU("CM_DESKTOP_MSG_LOCAL_TS") : _UU("CM_DESKTOP_MSG_LOCAL_SW"), + MsGetCurrentTerminalSessionId(), 0, user); + } + + if (user != NULL) + { + Free(user); + } + return false; + } + } + else + { + // There is no need to prohibit + return true; + } +} + +// Desktop difference warning message dialog initialization +void CmDesktopDlgInit(HWND hWnd, wchar_t *account_name) +{ + wchar_t tmp[2048]; + bool remote = false; + bool user_switching = false; + bool console_active = false; + wchar_t *console_user = NULL; + // Validate arguments + if (hWnd == NULL) + { + return; + } + + FormatText(hWnd, 0, account_name); + FormatText(hWnd, S_TITLE, account_name); + DlgFont(hWnd, S_TITLE, 11, true); + DlgFont(hWnd, S_INFO, 11, true); + if (cm->server_name == NULL) + { + UniStrCpy(tmp, sizeof(tmp), _UU("CM_DESKTOP_LOCAL_PC")); + } + else + { + UniFormat(tmp, sizeof(tmp), _UU("CM_DESKTOP_REMOTE_PC"), cm->server_name); + } + FormatText(hWnd, S_WARNING, tmp); + + if (cm->server_name != NULL) + { + remote = true; + } + else + { + if (MsIsTerminalServiceInstalled()) + { + user_switching = false; + } + else + { + user_switching = true; + } + + console_user = MsGetSessionUserName(0); + + if (console_user == NULL) + { + console_active = false; + } + else + { + console_active = true; + } + } + + // MSG1 + if (remote == false) + { + UniFormat(tmp, sizeof(tmp), _UU("CM_DESKTOP_MSG_LOCAL_1"), + user_switching ? _UU("CM_DESKTOP_MSG_LOCAL_SW") : _UU("CM_DESKTOP_MSG_LOCAL_TS")); + } + else + { + UniFormat(tmp, sizeof(tmp), _UU("CM_DESKTOP_MSG_REMOTE_1"), + cm->server_name); + } + SetText(hWnd, S_MSG_1, tmp); + + // MSG2 + if (remote == false) + { + if (console_active) + { + UniFormat(tmp, sizeof(tmp), _UU("CM_DESKTOP_MSG_LOCAL_21"), + console_user, MsGetCurrentTerminalSessionId()); + } + else + { + UniFormat(tmp, sizeof(tmp), _UU("CM_DESKTOP_MSG_LOCAL_22"), + MsGetCurrentTerminalSessionId()); + } + } + else + { + UniFormat(tmp, sizeof(tmp), _UU("CM_DESKTOP_MSG_REMOTE_2"), cm->server_name); + } + SetText(hWnd, S_MSG_2, tmp); + + // MSG3 + if (remote == false) + { + if (console_active) + { + UniFormat(tmp, sizeof(tmp), _UU("CM_DESKTOP_MSG_LOCAL_31"), + console_user, account_name); + } + else + { + UniFormat(tmp, sizeof(tmp), _UU("CM_DESKTOP_MSG_LOCAL_32"), + account_name); + } + } + else + { + UniFormat(tmp, sizeof(tmp), _UU("CM_DESKTOP_MSG_REMOTE_3"), cm->server_name, + account_name); + } + SetText(hWnd, S_MSG_3, tmp); + + if (console_user != NULL) + { + Free(console_user); + } +} + +// Desktop difference warning message dialog +UINT CmDesktopDlgProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param) +{ + wchar_t *account_name = (wchar_t *)param; + // Validate arguments + if (hWnd == NULL) + { + return 0; + } + + switch (msg) + { + case WM_INITDIALOG: + CmDesktopDlgInit(hWnd, account_name); + break; + case WM_COMMAND: + switch (wParam) + { + case IDOK: + EndDialog(hWnd, true); + break; + case IDCANCEL: + Close(hWnd); + break; + } + break; + case WM_CLOSE: + EndDialog(hWnd, false); + break; + } + + return 0; +} + +// Show a warning message that the desktop is different, if necessary +bool CmWarningDesktop(HWND hWnd, wchar_t *account_name) +{ + // Validate arguments + if (hWnd == NULL || account_name == NULL) + { + return false; + } + + if (cm->Client->Unix) + { + //There is no need for warning if the client is an UNIX + return true; + } + + if (/*MsIsTerminalServiceInstalled() || MsIsUserSwitchingInstalled() ||*/ (cm->server_name != NULL)) + { + if (cm->server_name == NULL) + { + //if (MsGetCurrentTerminalSessionId() == 0) + { + // No need for warning + return true; + } + } + // There is a need for warning + return Dialog(hWnd, D_CM_DESKTOP, CmDesktopDlgProc, account_name); + } + else + { + // No need for warning + return true; + } +} + +// Update the password setting dialog +void CmPasswordRefresh(HWND hWnd) +{ + bool ok = true; + // Validate arguments + if (hWnd == NULL) + { + return; + } + + SetEnable(hWnd, E_PASSWORD, IsChecked(hWnd, R_USE_PASSWORD)); + SetEnable(hWnd, E_PASSWORD2, IsChecked(hWnd, R_USE_PASSWORD)); + SetEnable(hWnd, IDC_STATIC1, IsChecked(hWnd, R_USE_PASSWORD)); + SetEnable(hWnd, IDC_STATIC2, IsChecked(hWnd, R_USE_PASSWORD)); + SetEnable(hWnd, R_REMOTE_ONLY, IsChecked(hWnd, R_USE_PASSWORD)); + + if (IsChecked(hWnd, R_USE_PASSWORD)) + { + char tmp1[MAX_SIZE]; + char tmp2[MAX_SIZE]; + if (IsEmpty(hWnd, E_PASSWORD)) + { + ok = false; + } + GetTxtA(hWnd, E_PASSWORD, tmp1, sizeof(tmp1)); + GetTxtA(hWnd, E_PASSWORD2, tmp2, sizeof(tmp2)); + if (StrCmp(tmp1, tmp2) != 0) + { + ok = false; + } + if (StrCmp(tmp1, HIDDEN_PASSWORD) == 0) + { + ok = false; + } + } + + SetEnable(hWnd, IDOK, ok); +} + +// Password setting procedure +UINT CmPasswordProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param) +{ + RPC_CLIENT_PASSWORD_SETTING c; + RPC_CLIENT_PASSWORD p; + char tmp[MAX_SIZE]; + // Validate arguments + if (hWnd == NULL) + { + return 0; + } + + switch (msg) + { + case WM_INITDIALOG: + // Get the password setting + if (CALL(hWnd, CcGetPasswordSetting(cm->Client, &c))) + { + Check(hWnd, R_USE_PASSWORD, c.IsPasswordPresented); + if (c.IsPasswordPresented) + { + SetTextA(hWnd, E_PASSWORD, HIDDEN_PASSWORD); + SetTextA(hWnd, E_PASSWORD2, HIDDEN_PASSWORD); + FocusEx(hWnd, E_PASSWORD); + Check(hWnd, R_REMOTE_ONLY, c.PasswordRemoteOnly); + } + else + { + Focus(hWnd, R_USE_PASSWORD); + } + } + CmPasswordRefresh(hWnd); + break; + case WM_COMMAND: + switch (wParam) + { + case R_USE_PASSWORD: + if (IsChecked(hWnd, R_USE_PASSWORD)) + { + FocusEx(hWnd, E_PASSWORD); + } + break; + case IDOK: + GetTxtA(hWnd, E_PASSWORD, tmp, sizeof(tmp)); + Zero(&p, sizeof(p)); + if (IsChecked(hWnd, R_USE_PASSWORD)) + { + StrCpy(p.Password, sizeof(p.Password), tmp); + p.PasswordRemoteOnly = IsChecked(hWnd, R_REMOTE_ONLY); + } + + if (CALL(hWnd, CcSetPassword(cm->Client, &p))) + { + if (StrLen(p.Password) > 0) + { + MsgBox(hWnd, MB_ICONINFORMATION, _UU("CM_PASSWORD_SET")); + } + else + { + MsgBox(hWnd, MB_ICONINFORMATION, _UU("CM_PASSWORD_REMOVE")); + } + EndDialog(hWnd, true); + } + break; + case IDCANCEL: + Close(hWnd); + break; + } + switch (LOWORD(wParam)) + { + case R_USE_PASSWORD: + case R_REMOTE_ONLY: + case E_PASSWORD: + case E_PASSWORD2: + CmPasswordRefresh(hWnd); + break; + } + switch (wParam) + { + case R_REMOTE_ONLY: + case R_USE_PASSWORD: + if (IsChecked(hWnd, R_USE_PASSWORD)) + { + FocusEx(hWnd, E_PASSWORD); + } + break; + } + break; + case WM_CLOSE: + EndDialog(hWnd, false); + break; + } + + return 0; +} + +// Set the password +void CmPassword(HWND hWnd) +{ + // Validate arguments + if (hWnd == NULL) + { + return; + } + + Dialog(hWnd, D_CM_PASSWORD, CmPasswordProc, NULL); +} + +// CA dialog update +void CmTrustDlgUpdate(HWND hWnd) +{ + // Validate arguments + if (hWnd == NULL) + { + return; + } + + SetEnable(hWnd, B_EXPORT, LvIsSelected(hWnd, L_CERT)); + SetEnable(hWnd, B_DELETE, LvIsSelected(hWnd, L_CERT) && cm->CmSetting.LockMode == false); + SetEnable(hWnd, IDOK, LvIsSelected(hWnd, L_CERT)); + SetEnable(hWnd, B_IMPORT, cm->CmSetting.LockMode == false); +} + +// Update the list of certificates +void CmTrustDlgRefresh(HWND hWnd) +{ + RPC_CLIENT_ENUM_CA c; + // Validate arguments + if (hWnd == NULL) + { + return; + } + + if (CALL(hWnd, CcEnumCa(cm->Client, &c))) + { + UINT i; + LVB *b = LvInsertStart(); + for (i = 0;i < c.NumItem;i++) + { + RPC_CLIENT_ENUM_CA_ITEM *cert = c.Items[i]; + wchar_t tmp[MAX_SIZE]; + + GetDateStrEx64(tmp, sizeof(tmp), SystemToLocal64(cert->Expires), NULL); + LvInsertAdd(b, ICO_CERT, (void *)cert->Key, 3, + cert->SubjectName, cert->IssuerName, tmp); + } + LvInsertEnd(b, hWnd, L_CERT); + CiFreeClientEnumCa(&c); + } + + CmTrustDlgUpdate(hWnd); +} + +// Import +void CmTrustImport(HWND hWnd) +{ + X *x; + RPC_CERT c; + if (CmLoadXFromFileOrSecureCard(hWnd, &x) == false) + { + return; + } + + Zero(&c, sizeof(c)); + c.x = x; + + CALL(hWnd, CcAddCa(cm->Client, &c)); + CmVoice("new_cert"); + + FreeX(c.x); + CmTrustDlgRefresh(hWnd); +} + +// Export +void CmTrustExport(HWND hWnd) +{ + UINT key; + // Validate arguments + if (hWnd == NULL) + { + return; + } + + key = (UINT)LvGetParam(hWnd, L_CERT, LvGetSelected(hWnd, L_CERT)); + if (key != INFINITE) + { + RPC_GET_CA a; + Zero(&a, sizeof(a)); + a.Key = key; + + if (CALL(hWnd, CcGetCa(cm->Client, &a))) + { + wchar_t *name; + X *x = CloneX(a.x); + CiFreeGetCa(&a); + + // Save + name = SaveDlg(hWnd, _UU("DLG_CERT_FILES"), _UU("DLG_SAVE_CERT"), NULL, L".cer"); + if (name != NULL) + { + wchar_t str[MAX_SIZE]; + UniStrCpy(str, sizeof(str), name); + if (XToFileW(x, str, true)) + { + MsgBox(hWnd, MB_ICONINFORMATION, _UU("DLG_CERT_SAVE_OK")); + } + else + { + MsgBox(hWnd, MB_ICONSTOP, _UU("DLG_CERT_SAVE_ERROR")); + } + Free(name); + } + FreeX(x); + } + } +} + +// Display +void CmTrustView(HWND hWnd) +{ + UINT key; + // Validate arguments + if (hWnd == NULL) + { + return; + } + + key = (UINT)LvGetParam(hWnd, L_CERT, LvGetSelected(hWnd, L_CERT)); + if (key != INFINITE) + { + RPC_GET_CA a; + Zero(&a, sizeof(a)); + a.Key = key; + + if (CALL(hWnd, CcGetCa(cm->Client, &a))) + { + X *x = CloneX(a.x); + X *x_issuer; + CiFreeGetCa(&a); + + x_issuer = CmGetIssuer(x); + CertDlg(hWnd, x, x_issuer, true); + FreeX(x); + FreeX(x_issuer); + } + } +} + +// CA dialog procedure +UINT CmTrustDlgProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param) +{ + NMHDR *n; + UINT index; + // Validate arguments + if (hWnd == NULL) + { + return 0; + } + + switch (msg) + { + case WM_INITDIALOG: + LvInit(hWnd, L_CERT); + LvInsertColumn(hWnd, L_CERT, 0, _UU("CM_CERT_COLUMN_1"), 190); + LvInsertColumn(hWnd, L_CERT, 1, _UU("CM_CERT_COLUMN_2"), 190); + LvInsertColumn(hWnd, L_CERT, 2, _UU("CM_CERT_COLUMN_3"), 160); + CmTrustDlgRefresh(hWnd); + break; + case WM_COMMAND: + switch (wParam) + { + case B_IMPORT: + CmTrustImport(hWnd); + break; + case B_EXPORT: + CmTrustExport(hWnd); + break; + case B_DELETE: + index = LvGetSelected(hWnd, L_CERT); + if (index != INFINITE) + { + UINT key = (UINT)LvGetParam(hWnd, L_CERT, index); + if (key != INFINITE) + { + if (MsgBox(hWnd, MB_ICONQUESTION | MB_YESNO | MB_DEFBUTTON2, _UU("CM_CERT_DELETE_MSG")) == IDYES) + { + RPC_CLIENT_DELETE_CA c; + Zero(&c, sizeof(c)); + c.Key = key; + if (CALL(hWnd, CcDeleteCa(cm->Client, &c))) + { + CmTrustDlgRefresh(hWnd); + } + } + } + } + break; + case IDOK: + if (IsEnable(hWnd, IDOK)) + { + CmTrustView(hWnd); + } + break; + case IDCANCEL: + Close(hWnd); + break; + } + break; + case WM_CLOSE: + EndDialog(hWnd, 0); + break; + case WM_NOTIFY: + n = (NMHDR *)lParam; + switch (n->idFrom) + { + case L_CERT: + switch (n->code) + { + case LVN_ITEMCHANGED: + CmTrustDlgUpdate(hWnd); + break; + case NM_DBLCLK: + Command(hWnd, IDOK); + break; + } + break; + } + break; + } + + LvSortHander(hWnd, msg, wParam, lParam, L_CERT); + + return 0; +} + +// Show the CA dialog +void CmTrustDlg(HWND hWnd) +{ + Dialog(hWnd, D_CM_TRUST, CmTrustDlgProc, NULL); +} + +// Main window procedure +UINT CmMainWindowProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param) +{ + NMHDR *n; + static UINT taskbar_msg = 0; + COPYDATASTRUCT *cpy; + // Validate arguments + if (hWnd == NULL) + { + return 0; + } + + if (taskbar_msg != 0 && msg == taskbar_msg) + { + // The task-bar is regenerated + if (cm->TrayInited) + { + MsRestoreIconOnTray(); + } + } + + // CmSetForegroundProcessToCnService(); + + switch (msg) + { + case WM_CM_SETTING_CHANGED_MESSAGE: + // CM_SETTING has changed + CmApplyCmSetting(); + break; + case WM_INITDIALOG: + CmMainWindowOnInit(hWnd); + taskbar_msg = RegisterWindowMessage("TaskbarCreated"); + CmEndStartupMutex(); + break; + case WM_CM_SHOW: + // Received a display request from another process + if (cm->CmSetting.EasyMode == false) + { + ShowWindow(hWnd, SW_SHOWNORMAL); + } + else + { + if (cm->hEasyWnd == NULL) + { + CmShowEasy(); + } + else + { + SetForegroundWindow(cm->hEasyWnd); + SetActiveWindow(cm->hEasyWnd); + } + } + break; + case WM_COMMAND: + CmMainWindowOnCommand(hWnd, wParam, lParam); + break; + case WM_SIZE: + CmMainWindowOnSize(hWnd); + break; + case WM_CLOSE: + if (cm->CmSetting.EasyMode == false) + { + CmShowOrHideWindow(hWnd); + } + else + { + if (cm->hEasyWnd == NULL) + { + CmShowEasy(); + } + else + { + SetForegroundWindow(cm->hEasyWnd); + SetActiveWindow(cm->hEasyWnd); + } + } + return 1; + case WM_INITMENUPOPUP: + if (HIWORD(lParam) == false) + { + CmMainWindowOnPopupMenu(hWnd, (HMENU)wParam, LOWORD(lParam)); + } + break; + case WM_NOTIFY: + n = (NMHDR *)lParam; + if (n->idFrom == L_ACCOUNT && (n->code == LVN_BEGINLABELEDITW || n->code == LVN_BEGINLABELEDITA)) + { + wchar_t *tmp = LvGetSelectedStr(hWnd, L_ACCOUNT, 0); + if (tmp != NULL) + { + if (UniStrCmpi(tmp, _UU("CM_NEW_ICON")) == 0 || UniStrCmpi(tmp, _UU("CM_VGC_ICON")) == 0 || UniStrCmpi(tmp, _UU("CM_VGC_LINK")) == 0 + ) + { + SendMsg(hWnd, L_ACCOUNT, LVM_CANCELEDITLABEL, 0, 0); + Free(tmp); + return true; + } + Free(tmp); + } + } + CmMainWindowOnNotify(hWnd, (NMHDR *)lParam); + break; + case WM_CM_NOTIFY: + CmRefreshVLanList(hWnd); + CmRefreshAccountList(hWnd); + CmRefreshStatusBar(hWnd); + break; + case WM_TIMER: + switch (wParam) + { + case 1: + CmSetForegroundProcessToCnService(); + break; + case 2: + CmPollingTray(hWnd); + break; + case 3: + KillTimer(hWnd, 3); + Hide(hWnd, 0); + break; + case 4: + KillTimer(hWnd, 4); + CmMainWindowOnShowEasy(hWnd); + break; + case 6: + if (cm->Update == NULL) + { + if (cm->server_name == NULL) + { + if (CmGetNumConnected(hWnd) == 0) + { + cm->Update = InitUpdateUi(_UU("PRODUCT_NAME_VPN_CMGR"), NAME_OF_VPN_CLIENT_MANAGER, NULL, + GetCurrentBuildDate(), CEDAR_VERSION_BUILD, GetCedarVersionNumber(), ((cm->Client == NULL) ? NULL : cm->Client->ClientId), + true); + } + } + } + break; + } + break; + case WM_CM_TRAY_MESSAGE: + // Message from the icon in the task tray + CmMainWindowOnTrayClicked(hWnd, wParam, lParam); + break; + case WM_COPYDATA: + cpy = (COPYDATASTRUCT *)lParam; + if (cpy != NULL) + { + if (cpy->dwData == CM_IMPORT_FILENAME_MSG || cpy->dwData == CM_IMPORT_FILENAME_MSG_OVERWRITE) + { + char *filename = (char *)cpy->lpData; + + if (cm->CmSetting.LockMode == false || cpy->dwData == CM_IMPORT_FILENAME_MSG_OVERWRITE) + { + wchar_t fullpath[MAX_PATH]; + + if (StrLen(filename) >= 2 && IsFileExists(filename)) + { + StrToUni(fullpath, sizeof(fullpath), filename); + } + else + { + UniStrCpy(fullpath, sizeof(fullpath), (wchar_t *)filename); + } + + CmImportAccountMainEx(cm->hEasyWnd ? cm->hEasyWnd : hWnd, fullpath, cpy->dwData == CM_IMPORT_FILENAME_MSG_OVERWRITE); + } + else + { + MsgBox(cm->hEasyWnd ? cm->hEasyWnd : hWnd, MB_ICONEXCLAMATION | MB_SETFOREGROUND | MB_TOPMOST, _UU("CM_VPN_FILE_IMPORT_NG")); + } + } + } + break; + case WM_QUERYENDSESSION: + // Windows is about to terminate + cm->WindowsShutdowning = true; + CmSaveMainWindowPos(hWnd); + SleepThread(256); + break; + case WM_ENDSESSION: + // Windows has terminated + _exit(0); + break; + } + + LvSortHander(hWnd, msg, wParam, lParam, L_ACCOUNT); + LvSortHander(hWnd, msg, wParam, lParam, L_VLAN); + + return 0; +} + +// Specify the notification service to the foreground process +void CmSetForegroundProcessToCnService() +{ + if (cm->PopupMenuOpen) + { + return; + } + if (cm->server_name == NULL) + { + if (CnCheckAlreadyExists(false)) + { + AllowFGWindow(MsRegReadInt(REG_CURRENT_USER, + CM_REG_KEY, "NotifyServerProcessId")); + } + } +} + +// Show the [recent destination] sub-menu +HMENU CmCreateRecentSubMenu(HWND hWnd, UINT start_id) +{ + HMENU h = NULL; + UINT i; + RPC_CLIENT_ENUM_ACCOUNT a; + LIST *o; + + Zero(&a, sizeof(a)); + + if (CcEnumAccount(cm->Client, &a) == ERR_NO_ERROR) + { + o = NewListFast(CiCompareClientAccountEnumItemByLastConnectDateTime); + + for (i = 0;i < a.NumItem;i++) + { + RPC_CLIENT_ENUM_ACCOUNT_ITEM *item = a.Items[i]; + + item->tmp1 = i; + + if (item->LastConnectDateTime != 0) + { + Add(o, item); + } + } + + Sort(o); + + for (i = 0;i < MIN(LIST_NUM(o), CM_NUM_RECENT);i++) + { + RPC_CLIENT_ENUM_ACCOUNT_ITEM *item = (RPC_CLIENT_ENUM_ACCOUNT_ITEM *)LIST_DATA(o, i); + wchar_t tmp[MAX_PATH]; + wchar_t *account_name; + char *server_name; + UINT pos; + + if (h == NULL) + { + h = CreatePopupMenu(); + } + + account_name = item->AccountName; + server_name = item->ServerName; + + UniStrCpy(tmp, sizeof(tmp), account_name); + + pos = LvSearchStr(hWnd, L_ACCOUNT, 0, account_name); + if (pos != INFINITE) + { + MsAppendMenu(h, MF_STRING, start_id + pos, tmp); + } + } + + ReleaseList(o); + + CiFreeClientEnumAccount(&a); + } + + return h; +} + +// Show the sub-menu of the right-click menu in the task tray +HMENU CmCreateTraySubMenu(HWND hWnd, bool flag, UINT start_id) +{ + HMENU h = NULL; + UINT i, num; + bool easy; + // Validate arguments + if (hWnd == NULL) + { + return NULL; + } + + easy = cm->CmSetting.EasyMode; + + num = LvNum(hWnd, L_ACCOUNT); + + for (i = 0;i < num;i++) + { + wchar_t *status_str = LvGetStr(hWnd, L_ACCOUNT, i, 1); + + if (status_str != NULL) + { + bool b = false; + + if (UniStrCmpi(status_str, _UU("CM_ACCOUNT_OFFLINE")) == 0) + { + if (flag == false) + { + b = true; + } + } + + if (UniStrCmpi(status_str, _UU("CM_ACCOUNT_ONLINE")) == 0 || + UniStrCmpi(status_str, _UU("CM_ACCOUNT_CONNECTING")) == 0) + { + if (flag == true) + { + b = true; + } + } + + if (b) + { + wchar_t tmp[MAX_PATH]; + wchar_t *account_name, *server_name; + wchar_t *hub_name; + if (h == NULL) + { + h = CreatePopupMenu(); + } + + account_name = LvGetStr(hWnd, L_ACCOUNT, i, 0); + server_name = LvGetStr(hWnd, L_ACCOUNT, i, 2); + hub_name = LvGetStr(hWnd, L_ACCOUNT, i, 3); + + if (easy == false) + { + UniFormat(tmp, sizeof(tmp), L"%s\t- %s [%s]", account_name, server_name, hub_name); + } + else + { + UniStrCpy(tmp, sizeof(tmp), account_name); + } + + MsAppendMenu(h, MF_STRING, start_id + i, tmp); + + Free(account_name); + Free(server_name); + Free(hub_name); + } + + Free(status_str); + } + } + + return h; +} + +// Display the right-click menu of the task tray +void CmShowTrayMenu(HWND hWnd) +{ + HMENU h; + POINT p; + HMENU sub1, sub2, sub3, sub4; + bool locked; + bool easy; + // Validate arguments + if (hWnd == NULL) + { + return; + } + + cm->PopupMenuOpen = true; + + locked = cm->CmSetting.LockMode; + easy = cm->CmSetting.EasyMode; + + // Create a menu + h = CreatePopupMenu(); + + // Cancel + MsAppendMenu(h, MF_ENABLED | MF_STRING, 100007, _UU("CM_TRAY_MENU_CANCEL")); + + // Separator + MsAppendMenu(h, MF_SEPARATOR, 10006, NULL); + + if (locked == false && easy == false) + { + // Creating a new connection settings + MsAppendMenu(h, MF_ENABLED | MF_STRING, CMD_NEW, _UU("CM_TRAY_MENU_NEW")); + + // Separator + MsAppendMenu(h, MF_SEPARATOR, 10005, NULL); + } + + // Connection menu + sub1 = CmCreateTraySubMenu(hWnd, false, CM_TRAY_MENU_CONNECT_ID_START); + if (sub1 != NULL) + { + MsAppendMenu(h, MF_BYPOSITION | MF_ENABLED | MF_POPUP | MF_STRING, + (UINT_PTR)sub1, _UU("CM_TRAY_MENU_CONNECT")); + } + + // Disconnection menu + sub2 = CmCreateTraySubMenu(hWnd, true, CM_TRAY_MENU_DISCONNECT_ID_START); + if (sub2 != NULL) + { + MsAppendMenu(h, MF_BYPOSITION | MF_ENABLED | MF_POPUP | MF_STRING, + (UINT_PTR)sub2, _UU("CM_TRAY_MENU_DISCONNECT")); + } + + // Status Display menu + sub3 = CmCreateTraySubMenu(hWnd, true, CM_TRAY_MENU_STATUS_ID_START); + if (sub3 != NULL) + { + MsAppendMenu(h, MF_BYPOSITION | MF_ENABLED | MF_POPUP | MF_STRING, + (UINT_PTR)sub3, _UU("CM_TRAY_MENU_STATUS")); + } + + if (sub3 != NULL) + { + // Disconnect all connections + MsAppendMenu(h, MF_ENABLED | MF_STRING, CMD_DISCONNECT_ALL, _UU("CM_TRAY_MENU_DISCONNECT_ALL")); + } + + if (sub1 != NULL || sub2 != NULL || sub3 != NULL) + { + // Separator + MsAppendMenu(h, MF_SEPARATOR, 10003, NULL); + } + + // Connect to the recently connected VPN server + sub4 = CmCreateRecentSubMenu(hWnd, CM_TRAY_MENU_RECENT_ID_START); + if (sub4 != NULL) + { + MsAppendMenu(h, MF_BYPOSITION | MF_ENABLED | MF_POPUP | MF_STRING, + (UINT_PTR)sub4, _UU("CM_TRAY_MENU_RECENT")); + MsAppendMenu(h, MF_SEPARATOR, 10008, NULL); + } + + if (locked == false && easy == false) + { + // Communication throughput measurement + MsAppendMenu(h, MF_ENABLED | MF_STRING, CMD_TRAFFIC, _UU("CM_TRAY_MENU_TRAFFIC")); + } + + if (easy == false) + { + // Network device status + MsAppendMenu(h, MF_ENABLED | MF_STRING, CMD_NETIF, _UU("CM_TRAY_MENU_NETIF")); + } + + // Version information + MsAppendMenu(h, MF_ENABLED | MF_STRING, CMD_ABOUT, _UU("CM_TRAY_MENU_ABOUT")); + + // Separator + MsAppendMenu(h, MF_SEPARATOR, 10001, NULL); + + // Change the operating mode + MsAppendMenu(h, MF_ENABLED | MF_STRING, CMD_CM_SETTING, _UU("CM_TRAY_MENU_SETTING")); + + // Separator + MsAppendMenu(h, MF_SEPARATOR, 10001, NULL); + + // Hide the icon + MsAppendMenu(h, MF_ENABLED | MF_STRING, CMD_TRAYICON, _UU("CM_MENU@CMD_TRAYICON")); + + // Separator + MsAppendMenu(h, MF_SEPARATOR, 10001, NULL); + + // Show or hide + MsAppendMenu(h, MF_ENABLED | MF_STRING, CMD_EXIT, + IsHide(hWnd, 0) ? _UU("CM_TRAY_MENU_1_SHOW") : _UU("CM_TRAY_MENU_1_HIDE")); + + // Quit + MsAppendMenu(h, MF_ENABLED | MF_STRING, CMD_QUIT, _UU("CM_TRAY_MENU_2_QUIT")); + + // Show the menu + GetCursorPos(&p); + + SetForegroundWindow(hWnd); + TrackPopupMenu(h, TPM_LEFTALIGN, p.x, p.y, 0, hWnd, NULL); + PostMessage(hWnd, WM_NULL, 0, 0); + + if (sub1 != NULL) + { + DestroyMenu(sub1); + } + + if (sub2 != NULL) + { + DestroyMenu(sub2); + } + + if (sub3 != NULL) + { + DestroyMenu(sub3); + } + + DestroyMenu(h); + + cm->PopupMenuOpen = false; +} + +// Hide or show the main window +void CmShowOrHideWindow(HWND hWnd) +{ + // Validate arguments + if (hWnd == NULL) + { + return; + } + + if (IsHide(hWnd, 0)) + { + Show(hWnd, 0); + if (IsIconic(hWnd)) + { + ShowWindow(hWnd, SW_SHOWNORMAL); + } + SetForegroundWindow(hWnd); + SetActiveWindow(hWnd); + } + else + { + CmSaveMainWindowPos(hWnd); + Hide(hWnd, 0); + + if (cm->TrayInited == false) + { + Command(hWnd, CMD_QUIT); + return; + } + } +} + +// Right-clicked on the account list +void CmAccountListRightClick(HWND hWnd) +{ + HMENU h; + HMENU parent; + UINT i; + // Validate arguments + if (hWnd == NULL) + { + return; + } + + // Load the menu + h = LoadSubMenu(M_MAIN, 0, &parent); + if (h == NULL) + { + return; + } + + InitMenuInternational(h, "CM_MENU"); + + // Remove the shortcut key + RemoveShortcutKeyStrFromMenu(h); + + // Delete the exit menu + i = GetMenuItemPos(h, CMD_QUIT); + if (i != INFINITE) + { + DeleteMenuItem(h, i); + DeleteMenuItem(h, i - 1); + DeleteMenuItem(h, i - 2); + DeleteMenuItem(h, i - 3); + } + + // Set enable / disable + CmMainWindowOnPopupMenu(hWnd, h, INFINITE); + + if (h != NULL) + { + // Determine whether the selected account is under connecting + UINT i = LvGetSelected(hWnd, L_ACCOUNT); + wchar_t *str; + bool is_connected = false; + if (i != INFINITE) + { + str = LvGetStr(hWnd, L_ACCOUNT, i, 1); + if (str != NULL) + { + if (UniStrCmpi(str, _UU("CM_ACCOUNT_ONLINE")) == 0 || UniStrCmpi(str, _UU("CM_ACCOUNT_CONNECTING")) == 0) + { + // Connecting + is_connected = true; + } + Free(str); + } + } + + if (i == INFINITE) + { + // Bold the New menu + SetMenuItemBold(h, GetMenuItemPos(h, CMD_NEW), true); + } + else + { + if (is_connected == false) + { + // Bold the connection menu + SetMenuItemBold(h, GetMenuItemPos(h, CMD_CONNECT), true); + } + else + { + // Bold the status menu + SetMenuItemBold(h, GetMenuItemPos(h, CMD_STATUS), true); + } + } + } + + // Show the menu + PrintMenu(hWnd, h); + + DestroyMenu(parent); +} + +// Right-clicked on the virtual LAN card list +void CmVLanListRightClick(HWND hWnd) +{ + HMENU h; + HMENU parent; + // Validate arguments + if (hWnd == NULL) + { + return; + } + + // Load the menu + h = LoadSubMenu(M_MAIN, 3, &parent); + if (h == NULL) + { + return; + } + + InitMenuInternational(h, "CM_MENU"); + + // Remove the shortcut key + RemoveShortcutKeyStrFromMenu(h); + + // Set enable / disable + CmMainWindowOnPopupMenu(hWnd, h, INFINITE); + + if (h != NULL) + { + // Examine whether the selected device is enabled + UINT i = LvGetSelected(hWnd, L_VLAN); + wchar_t *str; + bool is_active = false; + if (i != INFINITE) + { + str = LvGetStr(hWnd, L_VLAN, i, 1); + if (str != NULL) + { + if (UniStrCmpi(str, _UU("CM_VLAN_ENABLED")) == 0) + { + // Enabled + is_active = true; + } + Free(str); + } + } + + if (i == INFINITE) + { + // Bold the New menu + SetMenuItemBold(h, GetMenuItemPos(h, CMD_NEW_VLAN), true); + } + else + { + if (is_active == false) + { + // Bold the enable menu + SetMenuItemBold(h, GetMenuItemPos(h, CMD_ENABLE_VLAN), true); + } + else + { + // Bold the Windows Network Setup menu + SetMenuItemBold(h, GetMenuItemPos(h, CMD_WINNET), true); + } + } + } + + // Show the menu + PrintMenu(hWnd, h); + + DestroyMenu(parent); +} + +// Notify to the main window +void CmMainWindowOnNotify(HWND hWnd, NMHDR *n) +{ + bool item_vlan; + NMLVDISPINFOW *disp_info; + NMLVKEYDOWN *key; + + // Validate arguments + if (hWnd == NULL || n == NULL) + { + return; + } + + switch (n->idFrom) + { + case L_ACCOUNT: + case L_VLAN: + if (n->idFrom == L_ACCOUNT) + { + item_vlan = false; + } + else + { + item_vlan = true; + } + + switch (n->code) + { + case NM_DBLCLK: + // Double click + CmOnKey(hWnd, false, false, VK_RETURN); + break; + case NM_RCLICK: + // Right click + if (item_vlan == false) + { + CmAccountListRightClick(hWnd); + } + else + { + CmVLanListRightClick(hWnd); + } + break; + case LVN_ENDLABELEDITW: + // Change the name + disp_info = (NMLVDISPINFOW *)n; + if (disp_info->item.pszText != NULL) + { + wchar_t *new_name = disp_info->item.pszText; + wchar_t *old_name = LvGetStr(hWnd, L_ACCOUNT, disp_info->item.iItem, 0); + + if (old_name != NULL) + { + if (UniStrCmp(new_name, old_name) != 0 && UniIsEmptyStr(new_name) == false) + { + RPC_RENAME_ACCOUNT a; + Zero(&a, sizeof(a)); + UniStrCpy(a.OldName, sizeof(a.OldName), old_name); + UniStrCpy(a.NewName, sizeof(a.NewName), new_name); + if (CALL(hWnd, CcRenameAccount(cm->Client, &a))) + { + LvSetItem(hWnd, L_ACCOUNT, disp_info->item.iItem, 0, new_name); + } + } + + Free(old_name); + } + } + break; + case LVN_KEYDOWN: + // Key pressed + key = (NMLVKEYDOWN *)n; + if (key != NULL) + { + bool ctrl, alt; + UINT code = key->wVKey; + ctrl = (GetKeyState(VK_CONTROL) & 0x8000) == 0 ? false : true; + alt = (GetKeyState(VK_MENU) & 0x8000) == 0 ? false : true; + CmOnKey(hWnd, ctrl, alt, code); + } + break; + } + break; + } +} + +// Keyboard pressed +void CmOnKey(HWND hWnd, bool ctrl, bool alt, UINT key) +{ + // Validate arguments + if (hWnd == NULL) + { + return; + } + + // Single key + switch (key) + { + case VK_RETURN: + Command(hWnd, IDOK); + break; + case VK_DELETE: + // Delete + if (IsFocus(hWnd, L_ACCOUNT)) + { + // Operation on the account list + Command(hWnd, CMD_DELETE); + } + else + { + // Operation on the virtual LAN card list + Command(hWnd, CMD_DELETE_VLAN); + } + break; + case VK_F2: + // Change the name + Command(hWnd, CMD_RENAME); + break; + case VK_F5: + // Update the status + Command(hWnd, CMD_REFRESH); + break; + } + + if (alt) + { + switch (key) + { + case 'Q': + // Close + Command(hWnd, CMD_QUIT); + break; + } + } + + if (ctrl) + { + switch (key) + { + case 'G': + // Smart Card Manager + Command(hWnd, CMD_SECURE_MANAGER); + break; + case 'S': + // Show the state + Command(hWnd, CMD_STATUS); + break; + case 'I': + // Disconnect all connections + Command(hWnd, CMD_DISCONNECT_ALL); + break; + case 'D': + // Disconnect + Command(hWnd, CMD_DISCONNECT); + break; + case 'N': + // Create a new connection settings + Command(hWnd, CMD_NEW); + break; + case 'C': + // Creating a copy + Command(hWnd, CMD_CLONE); + break; + case 'T': + // Set to start-up connection + Command(hWnd, CMD_STARTUP); + break; + case 'A': + // Select all + Command(hWnd, CMD_SELECT_ALL); + break; + case 'L': + // Create a new virtual LAN card + Command(hWnd, CMD_NEW_VLAN); + break; + case 'E': + // Enable the virtual LAN card + Command(hWnd, CMD_ENABLE_VLAN); + break; + case 'B': + // Disable the virtual LAN card + Command(hWnd, CMD_DISABLE_VLAN); + break; + case 'U': + // Reinstall the driver + Command(hWnd, CMD_REINSTALL); + break; + case 'W': + // Configure Windows network connection + Command(hWnd, CMD_WINNET); + break; + case 'P': + // Set the password + Command(hWnd, CMD_PASSWORD); + break; + case 'O': + // Option settings + Command(hWnd, CMD_TRAFFIC); + break; + case 'R': + // Certificate management + Command(hWnd, CMD_TRUST); + break; + case 'Q': + // Throughput + Command(hWnd, CMD_TRAFFIC); + break; + } + } +} + +// Command of the main window +void CmMainWindowOnCommand(HWND hWnd, WPARAM wParam, LPARAM lParam) +{ + CmMainWindowOnCommandEx(hWnd, wParam, lParam, false); +} +void CmMainWindowOnCommandEx(HWND hWnd, WPARAM wParam, LPARAM lParam, bool easy) +{ + wchar_t *tmp; + char *name; + UINT index; + UINT id; + bool ctrl, alt; + UINT flag = 0; + // Validate arguments + wchar_t *selected_name = NULL; + UINT starter_id = 0; + if (hWnd == NULL) + { + return; + } + + ctrl = (GetKeyState(VK_CONTROL) & 0x8000) == 0 ? false : true; + alt = (GetKeyState(VK_MENU) & 0x8000) == 0 ? false : true; + + if (wParam == IDOK) + { + tmp = LvGetSelectedStr(hWnd, L_ACCOUNT, 0); + if (tmp != NULL) + { + if (UniStrCmpi(tmp, _UU("CM_NEW_ICON")) == 0) + { + Free(tmp); + Command(hWnd, CMD_NEW); + return; + } + if (UniStrCmpi(tmp, _UU("CM_VGC_ICON")) == 0 || UniStrCmpi(tmp, _UU("CM_VGC_LINK")) == 0) + { + Free(tmp); + Command(hWnd, CMD_VGC_CONNECT); + return; + } + Free(tmp); + } + } + + if (CmIsEnabled(hWnd, (UINT)wParam) == false) + { + return; + } + + if (CM_TRAY_IS_CONNECT_ID(wParam)) + { + // Connection request + starter_id = CM_TRAY_MENU_CONNECT_ID_START; + flag = 1; + } + + if (CM_TRAY_IS_STATUS_ID(wParam)) + { + // Information display request + starter_id = CM_TRAY_MENU_STATUS_ID_START; + flag = 2; + } + + if (CM_TRAY_IS_DISCONNECT_ID(wParam)) + { + // Disconnect request + starter_id = CM_TRAY_MENU_DISCONNECT_ID_START; + flag = 3; + } + + if (CM_TRAY_IS_RECENT_ID(wParam)) + { + // Recent destinations + starter_id = CM_TRAY_MENU_RECENT_ID_START; + flag = 1; + } + + if (starter_id != 0) + { + UINT num; + + id = (UINT)wParam - starter_id; + + num = LvNum(hWnd, L_ACCOUNT); + + if (id < num) + { + selected_name = LvGetStr(hWnd, L_ACCOUNT, id, 0); + + if (selected_name != NULL) + { + if (UniStrCmpi(selected_name, _UU("CM_NEW_ICON")) != 0 && + UniStrCmpi(selected_name, _UU("CM_VGC_ICON")) != 0 && + UniStrCmpi(selected_name, _UU("CM_VGC_LINK")) != 0) + { + switch (flag) + { + case 1: + CmConnect(hWnd, selected_name); + break; + + case 2: + CmStatus(hWnd, selected_name); + break; + + case 3: + CmDisconnect(hWnd, selected_name); + break; + } + } + } + + Free(selected_name); + } + } + + switch (wParam) + { + case IDOK: + case CMD_EASY_DBLCLICK: + // Property or connection + if (IsFocus(hWnd, L_ACCOUNT) || (hWnd == cm->hEasyWnd)) + { + // Operation about the account list + if (alt == false) + { + UINT index = LvGetSelected(hWnd, L_ACCOUNT); + bool b = false; + if (index != INFINITE) + { + wchar_t *s = LvGetStr(hWnd, L_ACCOUNT, index, 1); + if (s != NULL) + { + if (UniStrCmpi(s, _UU("CM_ACCOUNT_ONLINE")) == 0 || UniStrCmpi(s, _UU("CM_ACCOUNT_CONNECTING")) == 0) + { + b = true; + } + Free(s); + } + } + + if (b == false) + { + // Connection + Command(hWnd, CMD_CONNECT); + } + else + { + if (hWnd != cm->hEasyWnd || wParam == CMD_EASY_DBLCLICK) + { + // Display status + Command(hWnd, CMD_STATUS); + } + else + { + // Disconnect + Command(hWnd, CMD_DISCONNECT); + } + } + } + else + { + // Property + Command(hWnd, CMD_PROPERTY); + } + } + else + { + // Configure Windows network connection + Command(hWnd, CMD_WINNET); + } + break; + case CMD_CONNECT: + // Connection + tmp = LvGetStr(hWnd, L_ACCOUNT, LvGetSelected(hWnd, L_ACCOUNT), 0); + if (tmp != NULL) + { + CmConnect(hWnd, tmp); + Free(tmp); + } + break; + case CMD_STATUS: + // Show the status + tmp = LvGetStr(hWnd, L_ACCOUNT, LvGetSelected(hWnd, L_ACCOUNT), 0); + if (tmp != NULL) + { + CmStatus(hWnd, tmp); + Free(tmp); + } + break; + case CMD_DISCONNECT_ALL: + // Disconnect all connections + CmDisconnectAll(hWnd); + break; + case CMD_DISCONNECT: + // Disconnect + tmp = LvGetStr(hWnd, L_ACCOUNT, LvGetSelected(hWnd, L_ACCOUNT), 0); + if (tmp != NULL) + { + CmDisconnect(hWnd, tmp); + Free(tmp); + } + break; + case CMD_NEW: + // Create new + CmNewAccount(hWnd); + break; + + + case CMD_CLONE: + // Copy + tmp = LvGetStr(hWnd, L_ACCOUNT, LvGetSelected(hWnd, L_ACCOUNT), 0); + if (tmp != NULL) + { + CmCopyAccount(hWnd, tmp); + Free(tmp); + } + break; + case CMD_SHORTCUT: + // Create a shortcut + tmp = LvGetStr(hWnd, L_ACCOUNT, LvGetSelected(hWnd, L_ACCOUNT), 0); + if (tmp != NULL) + { + CmSortcut(hWnd, tmp); + Free(tmp); + } + break; + case CMD_EXPORT_ACCOUNT: + // Export settings + tmp = LvGetStr(hWnd, L_ACCOUNT, LvGetSelected(hWnd, L_ACCOUNT), 0); + if (tmp != NULL) + { + CmExportAccount(hWnd, tmp); + Free(tmp); + } + break; + case CMD_IMPORT_ACCOUNT: + // Import settings + CmImportAccount(hWnd); + break; + case CMD_STARTUP: + // Set to start-up connection + tmp = LvGetStr(hWnd, L_ACCOUNT, LvGetSelected(hWnd, L_ACCOUNT), 0); + if (tmp != NULL) + { + RPC_CLIENT_DELETE_ACCOUNT c; + Zero(&c, sizeof(c)); + UniStrCpy(c.AccountName, sizeof(c.AccountName), tmp); + CALL(hWnd, CcSetStartupAccount(cm->Client, &c)); + CmVoice("set_startup"); + MsgBoxEx(hWnd, MB_ICONINFORMATION, _UU("CM_SET_STARTUP"), tmp); + Free(tmp); + } + break; + case CMD_NOSTARTUP: + // Unset the start-up connection + tmp = LvGetStr(hWnd, L_ACCOUNT, LvGetSelected(hWnd, L_ACCOUNT), 0); + if (tmp != NULL) + { + if (MsgBoxEx(hWnd, MB_ICONQUESTION | MB_YESNO | MB_DEFBUTTON2, + _UU("CM_REMOVE_STARTUP"), tmp) == IDYES) + { + RPC_CLIENT_DELETE_ACCOUNT c; + Zero(&c, sizeof(c)); + UniStrCpy(c.AccountName, sizeof(c.AccountName), tmp); + CALL(hWnd, CcRemoveStartupAccount(cm->Client, &c)); + CmVoice("remove_startup"); + } + Free(tmp); + } + break; + case CMD_DELETE: + // Delete + tmp = LvGetStr(hWnd, L_ACCOUNT, LvGetSelected(hWnd, L_ACCOUNT), 0); + if (tmp != NULL) + { + CmDeleteAccount(hWnd, tmp); + Free(tmp); + } + break; + case CMD_RENAME: + // Change the name + Focus(hWnd, L_ACCOUNT); + LvRename(hWnd, L_ACCOUNT, LvGetSelected(hWnd, L_ACCOUNT)); + break; + case CMD_PROPERTY: + // Property + tmp = LvGetStr(hWnd, L_ACCOUNT, LvGetSelected(hWnd, L_ACCOUNT), 0); + if (tmp != NULL) + { + CmEditAccount(hWnd, tmp); + Free(tmp); + } + break; + case IDCANCEL: + case CMD_EXIT: + // Close + Close(hWnd); + break; + case CMD_QUIT: + // Exit + CmMainWindowOnQuit(hWnd); + break; + case CMD_SELECT_ALL: + // Select all + LvSelectAll(hWnd, L_ACCOUNT); + LvSelectAll(hWnd, L_VLAN); + break; + case CMD_SWITCH_SELECT: + // Invert selection + LvSwitchSelect(hWnd, L_ACCOUNT); + LvSwitchSelect(hWnd, L_VLAN); + break; + case CMD_GRID: + // Show grid + cm->ShowGrid = !cm->ShowGrid; + CmRefreshVLanListEx(hWnd, true); + CmRefreshAccountListEx2(hWnd, false, true); + break; + case CMD_STATUSBAR: + // Show the status bar + if (cm->HideStatusBar == false) + { + cm->HideStatusBar = true; + Hide(hWnd, S_STATUSBAR); + CmMainWindowOnSize(hWnd); + } + else + { + cm->HideStatusBar = false; + Show(hWnd, S_STATUSBAR); + CmMainWindowOnSize(hWnd); + } + CmSaveMainWindowPos(hWnd); + break; + case CMD_VISTASTYLE: + cm->VistaStyle = !cm->VistaStyle; + CmRefreshEx(hWnd, true); + CmSaveMainWindowPos(hWnd); + break; + case CMD_TRAYICON: + // Tray icon display + if (cm->HideTrayIcon == false) + { + cm->HideTrayIcon = true; + CmFreeTray(hWnd); + + if (IsHide(hWnd, 0)) + { + MsgBox(hWnd, MB_ICONINFORMATION, _UU("CM_TRAY_ICON_RESTORE")); + } + } + else + { + cm->HideTrayIcon = false; + if (cm->server_name == NULL) + { + CmInitTray(hWnd); + } + } + break; + case CMD_SHOWPORT: + // Show the port number + cm->ShowPort = !cm->ShowPort; + CmRefresh(hWnd); + break; + case CMD_ICON: + // Show the icon + if (cm->IconView == false) + { + cm->IconView = true; + CmRefresh(hWnd); + } + break; + case CMD_DETAIL: + // Show details + if (cm->IconView) + { + cm->IconView = false; + CmRefresh(hWnd); + } + break; + case CMD_REFRESH: + if (easy == false) + { + // Display update + LvReset(hWnd, L_ACCOUNT); + LvReset(hWnd, L_VLAN); + CmRefresh(hWnd); + } + break; + case CMD_NEW_VLAN: + // Create a Virtual LAN card + if (CmStopInstallVLan(hWnd) == false) + { + // Installation is prohibited + break; + } + name = CmNewVLanDlg(hWnd); + if (name != NULL) + { + wchar_t tmp[MAX_SIZE]; + void *helper = NULL; + RPC_CLIENT_CREATE_VLAN c; + Zero(&c, sizeof(c)); + StrCpy(c.DeviceName, sizeof(c.DeviceName), name); + if (MsIsNt() == false) + { + // Change the title of the window + GetTxt(hWnd, 0, tmp, sizeof(tmp)); + SetText(hWnd, 0, _UU("CM_VLAN_INSTALLING")); + } + // Minimize + if (MsIsVista() == false) + { + ShowWindow(hWnd, SW_SHOWMINIMIZED); + } + + if (MsIsVista()) + { + helper = CmStartUacHelper(); + } + + if (CALL(hWnd, CcCreateVLan(cm->Client, &c))) + { + CmVoice("new_vlan"); + } + + CmStopUacHelper(helper); + + if (MsIsNt() == false) + { + // Restore the title of the window + SetText(hWnd, 0, tmp); + } + // Restore + if (MsIsVista() == false) + { + ShowWindow(hWnd, SW_SHOWNORMAL); + } + Free(name); + } + break; + case CMD_DELETE_VLAN: + // Delete the Virtual LAN card + index = LvGetSelected(hWnd, L_VLAN); + if (index != INFINITE) + { + if (cm->Client->Win9x == false) + { + // Windows 2000 or later + wchar_t *s = LvGetStr(hWnd, L_VLAN, index, 0); + if (s != NULL) + { + RPC_CLIENT_CREATE_VLAN c; + char str[MAX_SIZE]; + CmVoice("delete_vlan_1"); + if (MsgBoxEx(hWnd, MB_ICONQUESTION | MB_YESNO | MB_DEFBUTTON2, _UU("CM_DELETE_VLAN"), s) == IDYES) + { + Zero(&c, sizeof(c)); + UniToStr(str, sizeof(str), s); + if (CmPrintNameToVLanName(c.DeviceName, sizeof(c.DeviceName), str)) + { + if (CALL(hWnd, CcDeleteVLan(cm->Client, &c))) + { + CmVoice("delete_vlan_2"); + } + } + } + Free(s); + } + } + else + { + // Windows 9x + if (MsgBox(hWnd, MB_ICONQUESTION | MB_YESNO, _UU("CM_9X_VLAN_UNINSTALL")) == IDYES) + { + Run("rundll32.exe", "shell32.dll,Control_RunDLL NETCPL.CPL", + false, false); + } + } + } + break; + case CMD_ENABLE_VLAN: + // Enable the virtual LAN card + index = LvGetSelected(hWnd, L_VLAN); + if (index != INFINITE) + { + wchar_t *s = LvGetStr(hWnd, L_VLAN, index, 0); + if (s != NULL) + { + RPC_CLIENT_CREATE_VLAN c; + char str[MAX_SIZE]; + Zero(&c, sizeof(c)); + UniToStr(str, sizeof(str), s); + if (CmPrintNameToVLanName(c.DeviceName, sizeof(c.DeviceName), str)) + { + CALL(hWnd, CcEnableVLan(cm->Client, &c)); + } + Free(s); + } + } + break; + case CMD_DISABLE_VLAN: + // Disable the virtual LAN card + index = LvGetSelected(hWnd, L_VLAN); + if (index != INFINITE) + { + wchar_t *s = LvGetStr(hWnd, L_VLAN, index, 0); + if (s != NULL) + { + RPC_CLIENT_CREATE_VLAN c; + char str[MAX_SIZE]; + Zero(&c, sizeof(c)); + UniToStr(str, sizeof(str), s); + if (CmPrintNameToVLanName(c.DeviceName, sizeof(c.DeviceName), str)) + { + CALL(hWnd, CcDisableVLan(cm->Client, &c)); + } + Free(s); + } + } + break; + case CMD_REINSTALL: + // Reinstall the virtual LAN card + if (CmStopInstallVLan(hWnd) == false) + { + // Installation is prohibited + break; + } + // Warning message + if (MsgBox(hWnd, MB_ICONINFORMATION | MB_OKCANCEL, _UU("CM_VLAN_REINSTALL_MSG")) == IDCANCEL) + { + // Cancel + break; + } + index = LvGetSelected(hWnd, L_VLAN); + if (index != INFINITE) + { + wchar_t *s = LvGetStr(hWnd, L_VLAN, index, 0); + if (s != NULL) + { + RPC_CLIENT_CREATE_VLAN c; + char str[MAX_SIZE]; + Zero(&c, sizeof(c)); + UniToStr(str, sizeof(str), s); + if (CmPrintNameToVLanName(c.DeviceName, sizeof(c.DeviceName), str)) + { + void *helper = NULL; + + if (MsIsVista() == false) + { + ShowWindow(hWnd, SW_SHOWMINIMIZED); + } + + if (MsIsVista()) + { + helper = CmStartUacHelper(); + } + + CALL(hWnd, CcUpgradeVLan(cm->Client, &c)); + + CmStopUacHelper(helper); + + if (MsIsVista() == false) + { + ShowWindow(hWnd, SW_SHOWNORMAL); + } + } + Free(s); + } + } + break; + case CMD_PASSWORD: + // Password setting + CmPassword(hWnd); + break; + case CMD_OPTION: + // Option + CmConfigDlg(hWnd); + break; + case CMD_LANGUAGE: + // Language settings + if (true) + { + wchar_t path[MAX_SIZE]; + + CombinePathW(path, sizeof(path), MsGetExeDirNameW(), L"vpnsetup.exe"); + + if (MsExecuteW(path, L"/language:yes") == false) + { + MsgBox(hWnd, MB_ICONEXCLAMATION, _UU("SW_CHILD_PROCESS_ERROR")); + } + } + break; + case CMD_TRUST: + // Certificate management + CmTrustDlg(hWnd); + break; + case CMD_ABOUT: + // Version information + if (IsEnable(hWnd, 0)) + { + AboutEx(hWnd, cm->Cedar, _UU("PRODUCT_NAME_VPN_CMGR"), cm->Update); + } + break; + case CMD_VOIDE_NONE: + cm->DisableVoice = true; + break; + case CMD_VOICE_NORMAL: + cm->DisableVoice = false; + cm->VoiceId = VOICE_SSK; + break; + case CMD_VOICE_ODD: + if (MsgBox(hWnd, MB_ICONQUESTION | MB_YESNO, _UU("CM_EXT_VOICE_MSG")) == IDYES) + { + cm->DisableVoice = false; + cm->VoiceId = VOICE_AHO; + } + break; + case CMD_SECURE_MANAGER: + // Smart Card Manager + CmClientSecureManager(hWnd); + break; + case CMD_SECURE_SELECT: + // Select a smart card + CmClientSelectSecure(hWnd); + break; + case CMD_NETIF: + // State of the network device + if (IsEnable(hWnd, 0)) + { + UtSpeedMeterEx(hWnd); + } + break; + case CMD_MMCSS: + // Optimization utility for Windows Vista + if (MsIsVista() == false) + { + MsgBox(hWnd, MB_ICONINFORMATION, _UU("VISTA_MMCSS_MSG_4")); + } + else + { + if (MsIsAdmin() == false) + { + MsgBox(hWnd, MB_ICONEXCLAMATION, _UU("VISTA_MMCSS_MSG_4")); + } + else + { + if (MsIsMMCSSNetworkThrottlingEnabled()) + { + if (MsgBox(hWnd, MB_ICONQUESTION | MB_YESNO, _UU("VISTA_MMCSS_MSG")) == IDYES) + { + MsSetMMCSSNetworkThrottlingEnable(false); + MsgBox(hWnd, MB_ICONINFORMATION, _UU("VISTA_MMCSS_MSG_5")); + } + } + else + { + if (MsgBox(hWnd, MB_ICONQUESTION | MB_YESNO | MB_DEFBUTTON2, _UU("VISTA_MMCSS_MSG_2")) == IDYES) + { + MsSetMMCSSNetworkThrottlingEnable(true); + MsgBox(hWnd, MB_ICONINFORMATION, _UU("VISTA_MMCSS_MSG_6")); + } + } + } + } + break; + case CMD_TRAFFIC: + // Communication traffic measurement + if (IsEnable(hWnd, 0)) + { + CmTraffic(hWnd); + } + break; + case CMD_CM_SETTING: + // Operation mode setting + if (IsEnable(hWnd, 0)) + { + if (CmSetting(hWnd)) + { + CmApplyCmSetting(); + } + } + break; + case CMD_WINNET: + // Windows network settings + ShowWindowsNetworkConnectionDialog(); + break; + } +} + +// Option dialog +void CmConfigDlg(HWND hWnd) +{ + // Validate arguments + if (hWnd == NULL) + { + return; + } + + Dialog(hWnd, D_CM_CONFIG, CmConfigDlgProc, NULL); +} + +// Initialize the option dialog +void CmConfigDlgInit(HWND hWnd) +{ + bool use_alpha; + UINT alpha_value; + UINT os; + CLIENT_CONFIG c; + // Validate arguments + if (hWnd == NULL) + { + return; + } + + DlgFont(hWnd, S_WARNING, 10, true); + DlgFont(hWnd, S_INFO, 10, false); + + Zero(&c, sizeof(c)); + if (CALL(hWnd, CcGetClientConfig(cm->Client, &c)) == false) + { + EndDialog(hWnd, 0); + return; + } + + Check(hWnd, R_ALLOW_REMOTE_CONFIG, c.AllowRemoteConfig); + + Check(hWnd, R_USE_KEEP_CONNECT, c.UseKeepConnect); + SetTextA(hWnd, E_HOSTNAME, c.KeepConnectHost); + SetIntEx(hWnd, E_PORT, c.KeepConnectPort); + SetIntEx(hWnd, E_INTERVAL, c.KeepConnectInterval); + + Check(hWnd, R_TCP, c.KeepConnectProtocol == CONNECTION_TCP); + Check(hWnd, R_UDP, c.KeepConnectProtocol == CONNECTION_UDP); + + use_alpha = MsRegReadInt(REG_CURRENT_USER, CM_REG_KEY, "UseAlpha") == 0 ? false : true; + alpha_value = MsRegReadInt(REG_CURRENT_USER, CM_REG_KEY, "AlphaValue"); + alpha_value = MAKESURE(alpha_value, 0, 100); + + SetInt(hWnd, E_ALPHA_VALUE, alpha_value == 0 ? 50 : alpha_value); + Check(hWnd, R_ALPHA, use_alpha); + + os = GetOsInfo()->OsType; + if (OS_IS_WINDOWS_NT(os) && GET_KETA(os, 100) >= 2) + { + Enable(hWnd, R_ALPHA); + } + else + { + Disable(hWnd, R_ALPHA); + } + + CmConfigDlgRefresh(hWnd); +} + +// Update the option dialog +void CmConfigDlgRefresh(HWND hWnd) +{ + bool ok = true; + bool use_keep_connect; + // Validate arguments + if (hWnd == NULL) + { + return; + } + + use_keep_connect = IsChecked(hWnd, R_USE_KEEP_CONNECT); + SetEnable(hWnd, S_HOSTNAME, use_keep_connect); + SetEnable(hWnd, S_PORT, use_keep_connect); + SetEnable(hWnd, S_INTERVAL, use_keep_connect); + SetEnable(hWnd, S_INTERVAL2, use_keep_connect); + SetEnable(hWnd, S_PROTOCOL, use_keep_connect); + SetEnable(hWnd, S_INFO, use_keep_connect); + SetEnable(hWnd, S_INFO2, use_keep_connect); + SetEnable(hWnd, E_HOSTNAME, use_keep_connect); + SetEnable(hWnd, E_PORT, use_keep_connect); + SetEnable(hWnd, E_INTERVAL, use_keep_connect); + SetEnable(hWnd, R_TCP, use_keep_connect); + SetEnable(hWnd, R_UDP, use_keep_connect); + + SetEnable(hWnd, S_WARNING, IsChecked(hWnd, R_ALLOW_REMOTE_CONFIG)); + + if (IsChecked(hWnd, R_USE_KEEP_CONNECT)) + { + if (IsEmpty(hWnd, E_HOSTNAME)) + { + ok = false; + } + if (IsChecked(hWnd, R_TCP) == false && IsChecked(hWnd, R_UDP) == false) + { + ok = false; + } + if (GetInt(hWnd, E_PORT) == 0 || GetInt(hWnd, E_PORT) >= 65536) + { + ok = false; + } + if (GetInt(hWnd, E_INTERVAL) == 0) + { + ok = false; + } + } + + if (IsChecked(hWnd, R_ALPHA)) + { + UINT i = GetInt(hWnd, E_ALPHA_VALUE); + if (i < 20 || i >= 100) + { + ok = false; + } + Enable(hWnd, E_ALPHA_VALUE); + } + else + { + Disable(hWnd, E_ALPHA_VALUE); + } + + SetEnable(hWnd, IDOK, ok); +} + +// Save the setting of the option dialog +void CmConfigDlgOnOk(HWND hWnd) +{ + CLIENT_CONFIG c; + // Validate arguments + if (hWnd == NULL) + { + return; + } + + Zero(&c, sizeof(c)); + c.AllowRemoteConfig = IsChecked(hWnd, R_ALLOW_REMOTE_CONFIG); + c.UseKeepConnect = IsChecked(hWnd, R_USE_KEEP_CONNECT); + GetTxtA(hWnd, E_HOSTNAME, c.KeepConnectHost, sizeof(c.KeepConnectHost)); + c.KeepConnectPort = GetInt(hWnd, E_PORT); + c.KeepConnectInterval = GetInt(hWnd, E_INTERVAL); + if (IsChecked(hWnd, R_TCP)) + { + c.KeepConnectProtocol = CONNECTION_TCP; + } + else if (IsChecked(hWnd, R_UDP)) + { + c.KeepConnectProtocol = CONNECTION_UDP; + } + else + { + return; + } + + if (c.UseKeepConnect) + { + if (c.KeepConnectInterval < KEEP_INTERVAL_MIN || c.KeepConnectInterval > KEEP_INTERVAL_MAX) + { + MsgBoxEx(hWnd, MB_ICONINFORMATION, _UU("CM_KEEP_INTERVAL_MSG"), + KEEP_INTERVAL_MIN, KEEP_INTERVAL_MAX); + FocusEx(hWnd, E_INTERVAL); + return; + } + } + + if (CALL(hWnd, CcSetClientConfig(cm->Client, &c)) == false) + { + return; + } + + MsRegWriteInt(REG_CURRENT_USER, CM_REG_KEY, "AlphaValue", GetInt(hWnd, E_ALPHA_VALUE)); + MsRegWriteInt(REG_CURRENT_USER, CM_REG_KEY, "UseAlpha", IsChecked(hWnd, R_ALPHA)); + + EndDialog(hWnd, true); +} + +// Option setting dialog procedure +UINT CmConfigDlgProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param) +{ + // Validate arguments + if (hWnd == NULL) + { + return 0; + } + + switch (msg) + { + case WM_INITDIALOG: + CmConfigDlgInit(hWnd); + break; + case WM_COMMAND: + switch (LOWORD(wParam)) + { + case R_ALLOW_REMOTE_CONFIG: + case R_USE_KEEP_CONNECT: + case E_HOSTNAME: + case E_PORT: + case E_INTERVAL: + case R_ALPHA: + case E_ALPHA_VALUE: + CmConfigDlgRefresh(hWnd); + break; + } + + switch (wParam) + { + case IDOK: + CmConfigDlgRefresh(hWnd); + CmConfigDlgOnOk(hWnd); + break; + case IDCANCEL: + Close(hWnd); + break; + case R_ALLOW_REMOTE_CONFIG: + if (IsChecked(hWnd, R_ALLOW_REMOTE_CONFIG) == false) + { + if (cm->server_name != NULL) + { + // If the current user is remotely connected, show a warning + // when the user choose to disable the remote management + if (MsgBoxEx(hWnd, MB_ICONEXCLAMATION | MB_DEFBUTTON2 | MB_YESNO, _UU("CM_REMOTE_WARNING"), + cm->server_name, cm->server_name) == IDNO) + { + Check(hWnd, R_ALLOW_REMOTE_CONFIG, true); + } + } + } + break; + case R_USE_KEEP_CONNECT: + if (IsChecked(hWnd, R_USE_KEEP_CONNECT)) + { + FocusEx(hWnd, E_HOSTNAME); + } + break; + case R_ALPHA: + if (IsChecked(hWnd, R_ALPHA)) + { + FocusEx(hWnd, E_ALPHA_VALUE); + } + break; + } + break; + case WM_CLOSE: + EndDialog(hWnd, false); + break; + } + + return 0; +} + +// Create a shortcut +void CmSortcut(HWND hWnd, wchar_t *account_name) +{ + wchar_t tmp[MAX_SIZE]; + CM_ACCOUNT *a; + wchar_t *filename; + UCHAR key[SHA1_SIZE]; + // Validate arguments + if (hWnd == NULL || account_name == NULL) + { + return; + } + + // Get the account information + a = CmGetExistAccountObject(hWnd, account_name); + if (a == NULL) + { + return; + } + + Copy(key, a->ShortcutKey, SHA1_SIZE); + + if (IsZero(key, SHA1_SIZE)) + { + MsgBox(hWnd, MB_ICONINFORMATION, _UU("CM_SHORTCUT_UNSUPPORTED")); + } + else + { + // Determine the file name + UniFormat(tmp, sizeof(tmp), L"%s.lnk", account_name); + UniSafeFileName(tmp); + + filename = SaveDlg(hWnd, _UU("CM_SHORTCUT_FILE"), + _UU("CM_SHORTCUT_SAVE_TITLE"), tmp, L".vpn"); + + if (filename != NULL) + { + char key_str[64]; + wchar_t target[MAX_PATH]; + wchar_t workdir[MAX_PATH]; + wchar_t args[MAX_PATH]; + wchar_t comment[MAX_SIZE]; + wchar_t icon[MAX_PATH]; + + BinToStr(key_str, sizeof(key_str), key, SHA1_SIZE); + + // Create a shortcut + UniStrCpy(target, sizeof(target), MsGetExeFileNameW()); + UniStrCpy(workdir, sizeof(workdir), MsGetExeDirNameW()); + StrToUni(args, sizeof(args), key_str); + UniFormat(comment, sizeof(comment), _UU("CM_SHORTCUT_COMMENT"), account_name); + UniStrCpy(icon, sizeof(icon), MsGetExeFileNameW()); + + if (CreateLink(filename, target, workdir, args, comment, icon, 1) == false) + { + MsgBox(hWnd, MB_ICONSTOP, _UU("CM_SHORTCUT_ERROR")); + } + + Free(filename); + } + } + + CmFreeAccountObject(hWnd, a); +} + +// Export the account +void CmExportAccount(HWND hWnd, wchar_t *account_name) +{ + wchar_t tmp[MAX_SIZE]; + CM_ACCOUNT *a; + wchar_t *filename; + // Validate arguments + if (hWnd == NULL || account_name == NULL) + { + return; + } + + // Get the account information + a = CmGetExistAccountObject(hWnd, account_name); + if (a == NULL) + { + return; + } + + // Determine the file name + UniFormat(tmp, sizeof(tmp), L"%s.vpn", account_name); + UniSafeFileName(tmp); + + filename = SaveDlg(hWnd, _UU("CM_ACCOUNT_SETTING_FILE"), + _UU("CM_ACCOUNT_SAVE_TITLE"), tmp, L".vpn"); + + if (filename != NULL) + { + RPC_CLIENT_CREATE_ACCOUNT t; + BUF *b; + BUF *b2; + wchar_t tmp[MAX_SIZE]; + UCHAR *buf; + UINT buf_size; + UCHAR bom[] = {0xef, 0xbb, 0xbf, }; + + Zero(&t, sizeof(t)); + t.ClientOption = a->ClientOption; + t.ClientAuth = a->ClientAuth; + t.StartupAccount = a->Startup; + t.CheckServerCert = a->CheckServerCert; + t.RetryOnServerCert = a->RetryOnServerCert; + t.ServerCert = a->ServerCert; + t.ClientOption->FromAdminPack = false; + + b = CiAccountToCfg(&t); + + SeekBuf(b, 0, 0); + + // Check whether the password is contained + if (CiHasAccountSensitiveInformation(b)) + { + SeekBuf(b, 0, 0); + + // Confirm that the user want to clear the password + if (MsgBox(hWnd, MB_YESNO | MB_ICONQUESTION, _UU("CM_ACCOUNT_MSG_SENSITIVE")) == IDYES) + { + // Erase + CiEraseSensitiveInAccount(b); + } + } + + UniStrCpy(tmp, sizeof(tmp), filename); + b2 = NewBuf(); + + WriteBuf(b2, bom, sizeof(bom)); + + // Add a header part + buf_size = CalcUniToUtf8(_UU("CM_ACCOUNT_FILE_BANNER")); + buf = ZeroMalloc(buf_size + 32); + UniToUtf8(buf, buf_size, _UU("CM_ACCOUNT_FILE_BANNER")); + + WriteBuf(b2, buf, StrLen((char *)buf)); + WriteBuf(b2, b->Buf, b->Size); + SeekBuf(b2, 0, 0); + + FreeBuf(b); + + if (DumpBufW(b2, tmp) == false) + { + MsgBox(hWnd, MB_ICONSTOP, _UU("CM_FAILED_TO_SAVE_FILE")); + } + + Free(filename); + FreeBuf(b2); + Free(buf); + } + + CmFreeAccountObject(hWnd, a); +} + +// Main process of importing account +void CmImportAccountMain(HWND hWnd, wchar_t *filename) +{ + CmImportAccountMainEx(hWnd, filename, false); +} +void CmImportAccountMainEx(HWND hWnd, wchar_t *filename, bool overwrite) +{ + wchar_t name[MAX_SIZE]; + wchar_t tmp[MAX_SIZE]; + BUF *b; + RPC_CLIENT_CREATE_ACCOUNT *t; + // Validate arguments + if (hWnd == NULL || filename == NULL) + { + return; + } + + UniStrCpy(tmp, sizeof(tmp), filename); + + b = ReadDumpW(tmp); + if (b == NULL) + { + MsgBox(hWnd, MB_ICONSTOP, _UU("CM_FAILED_TO_OPEN_FILE")); + return; + } + + t = CiCfgToAccount(b); + if (t == NULL) + { + FreeBuf(b); + MsgBox(hWnd, MB_ICONEXCLAMATION, _UU("CM_ACCOUNT_PARSE_FAILED")); + return; + } + + if (overwrite) + { + // If the same name already exists, remove it + if (LvSearchStr(hWnd, L_ACCOUNT, 0, t->ClientOption->AccountName) != INFINITE) + { + RPC_CLIENT_DELETE_ACCOUNT d; + RPC_CLIENT_GET_ACCOUNT get; + HWND h = cm->hEasyWnd == NULL ? hWnd : cm->hEasyWnd; + + Zero(&d, sizeof(d)); + UniStrCpy(d.AccountName, sizeof(d.AccountName), t->ClientOption->AccountName); + + Zero(&get, sizeof(get)); + UniStrCpy(get.AccountName, sizeof(get.AccountName), t->ClientOption->AccountName); + if (CcGetAccount(cm->Client, &get) == ERR_NO_ERROR) + { + // Inherit the information of some of the client option by getting + // the account information of the same name that already exists + if (get.ClientOption != NULL && get.ClientAuth != NULL) + { + CLIENT_OPTION *old_option = get.ClientOption; + CLIENT_AUTH *old_auth = get.ClientAuth; + + // Inherit the connection parameters + t->ClientOption->ProxyType = old_option->ProxyType; + StrCpy(t->ClientOption->ProxyName, sizeof(t->ClientOption->ProxyName), + old_option->ProxyName); + t->ClientOption->ProxyPort = old_option->ProxyPort; + StrCpy(t->ClientOption->ProxyUsername, sizeof(t->ClientOption->ProxyUsername), + old_option->ProxyUsername); + StrCpy(t->ClientOption->ProxyPassword, sizeof(t->ClientOption->ProxyPassword), + old_option->ProxyPassword); + t->ClientOption->NumRetry = old_option->NumRetry; + t->ClientOption->RetryInterval = old_option->RetryInterval; + t->ClientOption->MaxConnection = old_option->MaxConnection; + t->ClientOption->UseEncrypt = old_option->UseEncrypt; + t->ClientOption->UseCompress = old_option->UseCompress; + t->ClientOption->HalfConnection = old_option->HalfConnection; + t->ClientOption->NoRoutingTracking = old_option->NoRoutingTracking; + StrCpy(t->ClientOption->DeviceName, sizeof(t->ClientOption->DeviceName), + old_option->DeviceName); + t->ClientOption->AdditionalConnectionInterval = old_option->AdditionalConnectionInterval; + t->ClientOption->ConnectionDisconnectSpan = old_option->ConnectionDisconnectSpan; + t->ClientOption->HideStatusWindow = old_option->HideStatusWindow; + t->ClientOption->RequireMonitorMode = old_option->RequireMonitorMode; + t->ClientOption->RequireBridgeRoutingMode = old_option->RequireBridgeRoutingMode; + t->ClientOption->DisableQoS = old_option->DisableQoS; + + // Inherit the authentication data + CiFreeClientAuth(t->ClientAuth); + t->ClientAuth = CopyClientAuth(old_auth); + + // Other Settings + t->StartupAccount = get.StartupAccount; + t->CheckServerCert = get.CheckServerCert; + t->RetryOnServerCert = get.RetryOnServerCert; + if (t->ServerCert != NULL) + { + FreeX(t->ServerCert); + } + t->ServerCert = NULL; + if (get.ServerCert != NULL) + { + t->ServerCert = CloneX(get.ServerCert); + } + Copy(t->ShortcutKey, get.ShortcutKey, sizeof(t->ShortcutKey)); + } + + CiFreeClientGetAccount(&get); + } + + if (CALL(h, CcDeleteAccount(cm->Client, &d)) == false) + { + CiFreeClientCreateAccount(t); + Free(t); + return; + } + + CmRefreshAccountList(hWnd); + } + } + + CmGenerateImportName(hWnd, name, sizeof(name), t->ClientOption->AccountName); + UniStrCpy(t->ClientOption->AccountName, sizeof(t->ClientOption->AccountName), name); + + if (overwrite) + { + t->ClientOption->FromAdminPack = true; + } + + CALL(hWnd, CcCreateAccount(cm->Client, t)); + + CiFreeClientCreateAccount(t); + Free(t); + + FreeBuf(b); + + if (overwrite) + { + // Start to connect the VPN + CmConnect(hWnd, name); + } + + //MsgBoxEx(hWnd, MB_ICONINFORMATION, _UU("CM_IMPORT_MESSAGE"), filename, name); +} + +// Import an account +void CmImportAccount(HWND hWnd) +{ + wchar_t *filename; + wchar_t tmp[MAX_SIZE]; + // Validate arguments + if (hWnd == NULL) + { + return; + } + + // Open the file + filename = OpenDlg(hWnd, _UU("CM_ACCOUNT_SETTING_FILE"), _UU("CM_ACCOUNT_OPEN_TITLE")); + if (filename == NULL) + { + return; + } + + UniStrCpy(tmp, sizeof(tmp), filename); + Free(filename); + + CmImportAccountMain(hWnd, tmp); +} + +// Create a copy of the account +void CmCopyAccount(HWND hWnd, wchar_t *account_name) +{ + wchar_t tmp[MAX_SIZE]; + CM_ACCOUNT *a; + RPC_CLIENT_CREATE_ACCOUNT c; + // Validate arguments + if (hWnd == NULL || account_name == NULL) + { + return; + } + + CmGenerateCopyName(hWnd, tmp, sizeof(tmp), account_name); + + // Get an account information + a = CmGetExistAccountObject(hWnd, account_name); + if (a == NULL) + { + return; + } + + // Change the account name + UniStrCpy(a->ClientOption->AccountName, sizeof(a->ClientOption->AccountName), tmp); + + // Write + Zero(&c, sizeof(c)); + c.ClientOption = ZeroMalloc(sizeof(CLIENT_OPTION)); + Copy(c.ClientOption, a->ClientOption, sizeof(CLIENT_OPTION)); + c.ClientAuth = CopyClientAuth(a->ClientAuth); + if (a->ServerCert) + { + c.ServerCert = CloneX(a->ServerCert); + } + c.CheckServerCert = a->CheckServerCert; + c.RetryOnServerCert = a->RetryOnServerCert; + c.StartupAccount = false; // Don't copy the startup attribute + + CALL(hWnd, CcCreateAccount(cm->Client, &c)); + CiFreeClientCreateAccount(&c); + + CmFreeAccountObject(hWnd, a); +} + +// Update the Virtual LAN Card Name dialog +void CmNewVLanDlgUpdate(HWND hWnd) +{ + bool ok = true; + char tmp[MAX_SIZE]; + // Validate arguments + if (hWnd == NULL) + { + return; + } + + GetTxtA(hWnd, E_NAME, tmp, sizeof(tmp)); + if (IsSafeStr(tmp) == false) + { + ok = false; + } + if (SearchStrEx(tmp, " ", 0, false) != INFINITE) + { + ok = false; + } + + Trim(tmp); + if (StrLen(tmp) == 0) + { + ok = false; + } + + SetEnable(hWnd, IDOK, ok); +} + +// Virtual LAN card name decision dialog procedure +UINT CmNewVLanDlgProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param) +{ + char *tmp = (char *)param; + char default_name[MAX_SIZE]; + RPC_CLIENT_VERSION ver; + // Validate arguments + if (hWnd == NULL) + { + return 0; + } + + switch (msg) + { + case WM_INITDIALOG: + LimitText(hWnd, E_NAME, cm->Client->Win9x ? MAX_DEVICE_NAME_LEN_9X : MAX_DEVICE_NAME_LEN); + FormatText(hWnd, S_INFO, cm->Client->Win9x ? MAX_DEVICE_NAME_LEN_9X : MAX_DEVICE_NAME_LEN); + + Zero(&ver, sizeof(ver)); + + if (CcGetClientVersion(cm->Client, &ver) == ERR_NO_ERROR) + { + if (ver.IsVLanNameRegulated) + { + Show(hWnd, S_WIN8); + } + } + + if (CiGetNextRecommendedVLanName(cm->Client, default_name, sizeof(default_name))) + { + // Show a default virtual LAN card name candidate + SetTextA(hWnd, E_NAME, default_name); + } + + CmNewVLanDlgUpdate(hWnd); + break; + + case WM_COMMAND: + switch (wParam) + { + case IDOK: + if (cm->Client->Win9x) + { + // For Windows 9x, show a confirmation message + if (MsgBox(hWnd, MB_ICONQUESTION | MB_OKCANCEL, _UU("CM_9X_VLAN_INSTALL")) == IDCANCEL) + { + break; + } + } + GetTxtA(hWnd, E_NAME, tmp, (cm->Client->Win9x ? MAX_DEVICE_NAME_LEN_9X : MAX_DEVICE_NAME_LEN) + 1); + Trim(tmp); + + if (CcGetClientVersion(cm->Client, &ver) == ERR_NO_ERROR) + { + if (ver.IsVLanNameRegulated) + { + if (CiIsValidVLanRegulatedName(tmp) == false) + { + // Virtual LAN card name isn't meeting the format + MsgBox(hWnd, MB_ICONEXCLAMATION, _UU("D_CM_NEW_VLAN@S_WIN8")); + + FocusEx(hWnd, E_NAME); + break; + } + } + } + + EndDialog(hWnd, true); + break; + case IDCANCEL: + Close(hWnd); + break; + } + switch (LOWORD(wParam)) + { + case E_NAME: + CmNewVLanDlgUpdate(hWnd); + break; + + case R_USE_DISCONNECT: + if (IsChecked(hWnd, R_USE_DISCONNECT)) + { + FocusEx(hWnd, E_DISCONNECT_SPAN); + } + break; + } + break; + + case WM_CLOSE: + EndDialog(hWnd, false); + break; + } + + return 0; +} + +// Dialog to determine the new virtual LAN card name +char *CmNewVLanDlg(HWND hWnd) +{ + char tmp[MAX_DEVICE_NAME_LEN + 1]; + + if (Dialog(hWnd, D_CM_NEW_VLAN, CmNewVLanDlgProc, tmp) == false) + { + return NULL; + } + + return CopyStr(tmp); +} + +// Update the advanced settings dialog +void CmDetailDlgUpdate(HWND hWnd, CM_ACCOUNT *a) +{ + bool ok = true; + bool locked; + // Validate arguments + if (hWnd == NULL || a == NULL) + { + return; + } + + locked = a->LockMode; + + if (a->LinkMode || a->NatMode) + { + Disable(hWnd, R_NO_ROUTING); + } + else + { + if (cm->Client->Unix) + { + Disable(hWnd, R_NO_ROUTING); + } + } + + SetEnable(hWnd, E_DISCONNECT_SPAN, IsChecked(hWnd, R_USE_DISCONNECT)); + + SetEnable(hWnd, IDOK, ok); + + if (locked) + { + Disable(hWnd, C_NUM_TCP); + Disable(hWnd, S_STATIC5); + Disable(hWnd, S_STATIC8); + Disable(hWnd, E_INTERVAL); + Disable(hWnd, S_STATIC9); + Disable(hWnd, E_DISCONNECT_SPAN); + Disable(hWnd, S_STATIC10); + Disable(hWnd, S_STATIC11); + Disable(hWnd, R_USE_DISCONNECT); + Disable(hWnd, R_USE_HALF_CONNECTION); + Disable(hWnd, R_DISABLE_QOS); + Disable(hWnd, R_USE_ENCRYPT); + Disable(hWnd, R_USE_COMPRESS); + Disable(hWnd, R_BRIDGE); + Disable(hWnd, R_MONITOR); + Disable(hWnd, R_NO_ROUTING); + } +} + +// Advanced Settings dialog procedure +UINT CmDetailDlgProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param) +{ + CM_ACCOUNT *a = (CM_ACCOUNT *)param; + UINT i; + UINT num; + wchar_t tmp[MAX_SIZE]; + // Validate arguments + if (hWnd == NULL) + { + return 0; + } + + switch (msg) + { + case WM_INITDIALOG: + // Number of TCP connections + for (i = 1;i <= MAX_TCP_CONNECTION;i++) + { + UniFormat(tmp, sizeof(tmp), L"%u", i); + CbAddStr(hWnd, C_NUM_TCP, tmp, i); + } + CbSelect(hWnd, C_NUM_TCP, a->ClientOption->MaxConnection); + + // Connection establishment interval + SetInt(hWnd, E_INTERVAL, a->ClientOption->AdditionalConnectionInterval); + + // Lifetime + SetIntEx(hWnd, E_DISCONNECT_SPAN, a->ClientOption->ConnectionDisconnectSpan); + Check(hWnd, R_USE_DISCONNECT, a->ClientOption->ConnectionDisconnectSpan != 0); + Check(hWnd, R_USE_HALF_CONNECTION, a->ClientOption->HalfConnection); + Check(hWnd, R_USE_ENCRYPT, a->ClientOption->UseEncrypt); + Check(hWnd, R_USE_COMPRESS, a->ClientOption->UseCompress); + Check(hWnd, R_NO_ROUTING, a->ClientOption->NoRoutingTracking); + Check(hWnd, R_DISABLE_QOS, a->ClientOption->DisableQoS); + Check(hWnd, R_DISABLE_UDP, a->ClientOption->NoUdpAcceleration); + + // Select the Connection Mode + if (a->LinkMode == false) + { + Check(hWnd, R_BRIDGE, a->ClientOption->RequireBridgeRoutingMode); + Check(hWnd, R_MONITOR, a->ClientOption->RequireMonitorMode); + } + else + { + Check(hWnd, R_BRIDGE, true); + Check(hWnd, R_MONITOR, false); + + SetText(hWnd, S_MODE, _UU("CM_DETAIL_MODE_LINK_STR")); + Disable(hWnd, R_BRIDGE); + Disable(hWnd, R_MONITOR); + } + + CmDetailDlgUpdate(hWnd, a); + Focus(hWnd, IDOK); + break; + case WM_COMMAND: + switch (wParam) + { + case IDOK: + if (IsChecked(hWnd, R_USE_DISCONNECT) && GetInt(hWnd, E_DISCONNECT_SPAN) == 0) + { + MsgBox(hWnd, MB_ICONINFORMATION, _UU("CM_NO_DISCONNECT_SPAN")); + FocusEx(hWnd, E_DISCONNECT_SPAN); + break; + } + num = GetInt(hWnd, C_NUM_TCP); + if (num == 0) + { + break; + } + if (num == 1 && IsChecked(hWnd, R_USE_HALF_CONNECTION)) + { + MsgBox(hWnd, MB_ICONINFORMATION, _UU("CM_HALF_MSG")); + Focus(hWnd, C_NUM_TCP); + break; + } + if (GetInt(hWnd, E_INTERVAL) < 1) + { + MsgBox(hWnd, MB_ICONINFORMATION, _UU("CM_TOO_SMALL_INTERVAL")); + Focus(hWnd, E_INTERVAL); + break; + } + + a->ClientOption->MaxConnection = num; + a->ClientOption->AdditionalConnectionInterval = GetInt(hWnd, E_INTERVAL); + if (IsChecked(hWnd, R_USE_DISCONNECT) == false) + { + a->ClientOption->ConnectionDisconnectSpan = 0; + } + else + { + a->ClientOption->ConnectionDisconnectSpan = GetInt(hWnd, E_DISCONNECT_SPAN); + } + a->ClientOption->HalfConnection = IsChecked(hWnd, R_USE_HALF_CONNECTION); + a->ClientOption->UseEncrypt = IsChecked(hWnd, R_USE_ENCRYPT); + a->ClientOption->UseCompress = IsChecked(hWnd, R_USE_COMPRESS); + a->ClientOption->NoRoutingTracking = IsChecked(hWnd, R_NO_ROUTING); + a->ClientOption->DisableQoS = IsChecked(hWnd, R_DISABLE_QOS); + a->ClientOption->NoUdpAcceleration = IsChecked(hWnd, R_DISABLE_UDP); + + if (a->LinkMode) + { + a->ClientOption->RequireBridgeRoutingMode = true; + a->ClientOption->RequireMonitorMode = false; + } + else + { + a->ClientOption->RequireBridgeRoutingMode = IsChecked(hWnd, R_BRIDGE); + a->ClientOption->RequireMonitorMode = IsChecked(hWnd, R_MONITOR); + } + + EndDialog(hWnd, true); + + break; + case IDCANCEL: + Close(hWnd); + break; + } + switch (LOWORD(wParam)) + { + case C_NUM_TCP: + case E_INTERVAL: + case E_DISCONNECT_SPAN: + case R_USE_DISCONNECT: + case R_USE_HALF_CONNECTION: + CmDetailDlgUpdate(hWnd, a); + break; + } + switch (wParam) + { + case R_USE_DISCONNECT: + if (IsChecked(hWnd, R_USE_DISCONNECT)) + { + FocusEx(hWnd, E_DISCONNECT_SPAN); + } + break; + } + break; + case WM_CLOSE: + EndDialog(hWnd, false); + break; + } + + return 0; +} + +// Advanced Settings dialog +bool CmDetailDlg(HWND hWnd, CM_ACCOUNT *a) +{ + // Validate arguments + if (hWnd == NULL || a == NULL) + { + return false; + } + + return Dialog(hWnd, D_CM_DETAIL, CmDetailDlgProc, a); +} + +// Update the account editing dialog procedure +void CmEditAccountDlgUpdate(HWND hWnd, CM_ACCOUNT *a) +{ + bool ok = true; + char str[MAX_SIZE]; + bool locked; + // Validate arguments + if (hWnd == NULL || a == NULL) + { + return; + } + + locked = a->LockMode; + + if (a->Inited == false) + { + return; + } + + if (a->EditMode) + { + Disable(hWnd, E_ACCOUNT_NAME); + } + + // The name of connection settings + GetTxt(hWnd, E_ACCOUNT_NAME, a->ClientOption->AccountName, sizeof(a->ClientOption->AccountName)); + UniTrim(a->ClientOption->AccountName); + + // Host name + GetTxtA(hWnd, E_HOSTNAME, a->ClientOption->Hostname, sizeof(a->ClientOption->Hostname)); + Trim(a->ClientOption->Hostname); + + if (InStr(a->ClientOption->Hostname, "/tcp")) + { + Check(hWnd, R_DISABLE_NATT, true); + } + else + { + Check(hWnd, R_DISABLE_NATT, false); + } + + SetEnable(hWnd, R_DISABLE_NATT, !IsEmptyStr(a->ClientOption->Hostname)); + + // Port number + a->ClientOption->Port = GetInt(hWnd, C_PORT); + + // HUB name + GetTxtA(hWnd,C_HUBNAME, a->ClientOption->HubName, sizeof(a->ClientOption->HubName)); + + // Type of proxy + a->ClientOption->ProxyType = PROXY_DIRECT; + if (IsChecked(hWnd, R_HTTPS)) + { + a->ClientOption->ProxyType = PROXY_HTTP; + } + if (IsChecked(hWnd, R_SOCKS)) + { + a->ClientOption->ProxyType = PROXY_SOCKS; + } + if (IsChecked(hWnd, R_SOCKS5)) + { + a->ClientOption->ProxyType = PROXY_SOCKS5; + } + + // To validate the server certificate + a->CheckServerCert = IsChecked(hWnd, R_CHECK_CERT); + + if (a->NatMode) + { + Disable(hWnd, R_CHECK_CERT); + Disable(hWnd, B_TRUST); + } + + if (a->HideTrustCert) + { + Disable(hWnd, B_TRUST); + } + + // Device name + StrCpy(a->ClientOption->DeviceName, sizeof(a->ClientOption->DeviceName), ""); + if (LvIsSelected(hWnd, L_VLAN)) + { + wchar_t *s = LvGetStr(hWnd, L_VLAN, LvGetSelected(hWnd, L_VLAN), 0); + if (s != NULL) + { + char str[MAX_SIZE]; + UniToStr(str, sizeof(str), s); + CmPrintNameToVLanName(a->ClientOption->DeviceName, sizeof(a->ClientOption->DeviceName), str); + Free(s); + } + } + + // User authentication + a->ClientAuth->AuthType = CbGetSelect(hWnd, C_TYPE); + GetTxtA(hWnd, E_USERNAME, a->ClientAuth->Username, sizeof(a->ClientAuth->Username)); + Trim(a->ClientAuth->Username); + switch (a->ClientAuth->AuthType) + { + case CLIENT_AUTHTYPE_PASSWORD: + // Password authentication + GetTxtA(hWnd, E_PASSWORD, str, sizeof(str)); + if (StrCmp(str, HIDDEN_PASSWORD) != 0) + { + HashPassword(a->ClientAuth->HashedPassword, a->ClientAuth->Username, str); + } + break; + case CLIENT_AUTHTYPE_PLAIN_PASSWORD: + // Plaintext password authentication + GetTxtA(hWnd, E_PASSWORD, str, sizeof(str)); + if (StrCmp(str, HIDDEN_PASSWORD) != 0) + { + StrCpy(a->ClientAuth->PlainPassword, sizeof(a->ClientAuth->PlainPassword), str); + } + break; + } + + // Reconnection option + if ((a->LinkMode || a->NatMode) || a->ClientAuth->AuthType == CLIENT_AUTHTYPE_SECURE) + { + Disable(hWnd, R_RETRY); + } + else + { + Enable(hWnd, R_RETRY); + } + + if (IsChecked(hWnd, R_RETRY) == false) + { + a->ClientOption->NumRetry = 0; + } + else + { + if (IsChecked(hWnd, R_INFINITE)) + { + a->ClientOption->NumRetry = INFINITE; + } + else + { + a->ClientOption->NumRetry = GetInt(hWnd, E_RETRY_NUM); + } + } + a->ClientOption->RetryInterval = GetInt(hWnd, E_RETRY_SPAN); + + // Information determining + if (UniStrLen(a->ClientOption->AccountName) == 0 && a->NatMode == false) + { + ok = false; + } + if (StrLen(a->ClientOption->Hostname) == 0) + { + ok = false; + } + if (a->ClientOption->Port == 0 || a->ClientOption->Port >= 65536) + { + ok = false; + } + if (StrLen(a->ClientOption->HubName) == 0) + { + ok = false; + } + if (StrLen(a->ClientAuth->Username) == 0) + { + ok = false; + } + if (a->ClientAuth->AuthType == CLIENT_AUTHTYPE_CERT) + { + if (a->ClientAuth->ClientK == NULL || a->ClientAuth->ClientX == NULL) + { + ok = false; + } + } + if (a->ClientAuth->AuthType == CLIENT_AUTHTYPE_SECURE) + { + if (IsEmptyStr(a->ClientAuth->SecurePrivateKeyName) || IsEmptyStr(a->ClientAuth->SecurePublicCertName)) + { + ok = false; + } + } + + // Display update + if (IsChecked(hWnd, R_RETRY) && IsEnable(hWnd, R_RETRY)) + { + if (a->LinkMode == false && a->NatMode == false) + { + Enable(hWnd, R_INFINITE); + Enable(hWnd, E_RETRY_SPAN); + Enable(hWnd, S_RETRY_SPAN_1); + Enable(hWnd, S_RETRY_SPAN_2); + } + else + { + Disable(hWnd, R_INFINITE); + Disable(hWnd, E_RETRY_SPAN); + Disable(hWnd, S_RETRY_SPAN_1); + Disable(hWnd, S_RETRY_SPAN_2); + } + if (IsChecked(hWnd, R_INFINITE) == false) + { + Enable(hWnd, E_RETRY_NUM); + Enable(hWnd, S_RETRY_NUM_1); + Enable(hWnd, S_RETRY_NUM_2); + if (GetInt(hWnd, E_RETRY_NUM) == 0) + { + ok = false; + } + } + else + { + Disable(hWnd, E_RETRY_NUM); + Disable(hWnd, S_RETRY_NUM_1); + Disable(hWnd, S_RETRY_NUM_2); + } + } + else + { + Disable(hWnd, E_RETRY_NUM); + Disable(hWnd, E_RETRY_SPAN); + Disable(hWnd, R_INFINITE); + Disable(hWnd, S_RETRY_NUM_1); + Disable(hWnd, S_RETRY_NUM_2); + Disable(hWnd, S_RETRY_SPAN_1); + Disable(hWnd, S_RETRY_SPAN_2); + } + + if (a->NatMode == false) + { + if (a->ServerCert == NULL) + { + SetText(hWnd, B_SERVER_CERT, _UU("CM_SERVER_CERT_1")); + Disable(hWnd, B_VIEW_SERVER_CERT); + } + else + { + SetText(hWnd, B_SERVER_CERT, _UU("CM_SERVER_CERT_2")); + Enable(hWnd, B_VIEW_SERVER_CERT); + } + } + else + { + Disable(hWnd, B_VIEW_SERVER_CERT); + Disable(hWnd, B_SERVER_CERT); + } + + if (a->ClientAuth->AuthType == CLIENT_AUTHTYPE_CERT || a->ClientAuth->AuthType == CLIENT_AUTHTYPE_SECURE) + { + wchar_t tmp[MAX_SIZE * 2]; + wchar_t issuer[MAX_SIZE]; + wchar_t subject[MAX_SIZE]; + wchar_t expires[MAX_SIZE]; + + SetIcon(hWnd, S_CERT, (a->ClientAuth->AuthType == CLIENT_AUTHTYPE_CERT) ? ICO_CERT : ICO_SECURE); + + Hide(hWnd, S_PASSWORD); + Hide(hWnd, E_PASSWORD); + if (a->ClientAuth->AuthType == CLIENT_AUTHTYPE_CERT) + { + if (a->ClientAuth->ClientX != NULL) + { + Enable(hWnd, B_VIEW_CLIENT_CERT); + SetText(hWnd, B_REGIST_CLIENT_CERT, _UU("CM_CLIENT_CERT_2")); + GetPrintNameFromName(issuer, sizeof(issuer), a->ClientAuth->ClientX->issuer_name); + GetPrintNameFromName(subject, sizeof(subject), a->ClientAuth->ClientX->subject_name); + GetDateStrEx64(expires, sizeof(expires), SystemToLocal64(a->ClientAuth->ClientX->notAfter), NULL); + UniFormat(tmp, sizeof(tmp), _UU("CM_CERT_INFO"), subject, issuer, expires); + } + else + { + Disable(hWnd, B_VIEW_CLIENT_CERT); + SetText(hWnd, B_REGIST_CLIENT_CERT, _UU("CM_CLIENT_CERT_1")); + UniStrCpy(tmp, sizeof(tmp), _UU("CM_NO_CERT")); + } + SetText(hWnd, B_VIEW_CLIENT_CERT, _UU("CM_VIEW_CLIENT_CERT")); + + Enable(hWnd, B_REGIST_CLIENT_CERT); + } + else + { + if (IsEmptyStr(a->ClientAuth->SecurePrivateKeyName) || IsEmptyStr(a->ClientAuth->SecurePublicCertName)) + { + UniStrCpy(tmp, sizeof(tmp), _UU("CM_NO_SECURE")); + } + else + { + UniFormat(tmp, sizeof(tmp), _UU("CM_CERT_SECURE_INFO"), + a->ClientAuth->SecurePublicCertName, a->ClientAuth->SecurePrivateKeyName); + } + + SetText(hWnd, B_VIEW_CLIENT_CERT, _UU("CM_SELECT_SECURE_DEVICE")); + SetText(hWnd, B_REGIST_CLIENT_CERT, _UU("CM_SELECT_CERT_INCARD")); + Enable(hWnd, B_VIEW_CLIENT_CERT); + + if (SmGetCurrentSecureIdFromReg() == 0) + { + Disable(hWnd, B_REGIST_CLIENT_CERT); + } + else + { + Enable(hWnd, B_REGIST_CLIENT_CERT); + } + } + SetText(hWnd, S_CERT_INFO, tmp); + Show(hWnd, S_CERT); + Show(hWnd, S_CERT_INFO); + Show(hWnd, B_VIEW_CLIENT_CERT); + Show(hWnd, B_REGIST_CLIENT_CERT); + } + else + { + if (a->ClientAuth->AuthType == CLIENT_AUTHTYPE_ANONYMOUS) + { + Hide(hWnd, S_PASSWORD); + Hide(hWnd, E_PASSWORD); + } + else + { + Show(hWnd, S_PASSWORD); + Show(hWnd, E_PASSWORD); + } + Hide(hWnd, S_CERT); + Hide(hWnd, S_CERT_INFO); + Hide(hWnd, B_VIEW_CLIENT_CERT); + Hide(hWnd, B_REGIST_CLIENT_CERT); + } + + if (a->ClientOption->ProxyType != PROXY_DIRECT) + { + Enable(hWnd, B_PROXY_CONFIG); + if (StrLen(a->ClientOption->ProxyName) == 0) + { + ok = false; + } + if (a->ClientOption->ProxyPort == 0) + { + ok = false; + } + } + else + { + Disable(hWnd, B_PROXY_CONFIG); + } + + if (a->ClientAuth->AuthType == CLIENT_AUTHTYPE_PASSWORD) + { + bool b = true; + + if (ok == false) + { + b = false; + } + + if (a->LinkMode == false && a->NatMode == false) + { + SetEnable(hWnd, B_CHANGE_PASSWORD, b); + SetEnable(hWnd, S_CHANGE_PASSWORD, b); + Show(hWnd, B_CHANGE_PASSWORD); + Show(hWnd, S_CHANGE_PASSWORD); + } + else + { + Hide(hWnd, B_CHANGE_PASSWORD); + Hide(hWnd, S_CHANGE_PASSWORD); + } + } + else + { + Hide(hWnd, B_CHANGE_PASSWORD); + Hide(hWnd, S_CHANGE_PASSWORD); + } + + if ((StrLen(a->ClientOption->DeviceName) == 0) && (a->LinkMode == false && a->NatMode == false)) + { + ok = false; + } + + if (a->LinkMode || a->NatMode) + { + Disable(hWnd, L_VLAN); + } + + if (a->EditMode == false) + { + char tmp[MAX_SIZE]; + GetTxtA(hWnd, E_HOSTNAME, tmp, sizeof(tmp)); + Trim(tmp); + + if (StartWith(tmp, "127.") || (StrCmpi(tmp, "localhost") == 0)) + { + if (a->Flag1 == false) + { + a->Flag1 = true; + a->ClientOption->UseEncrypt = a->ClientOption->UseCompress = false; + a->ClientOption->MaxConnection = 1; + } + } + } + + a->ClientOption->HideStatusWindow = IsChecked(hWnd, R_HIDE); + a->ClientOption->HideNicInfoWindow = IsChecked(hWnd, R_HIDE2); + + if (locked) + { + SetEnable(hWnd, E_HOSTNAME, false); + SetEnable(hWnd, C_PORT, false); + SetEnable(hWnd, C_HUBNAME, false); + SetEnable(hWnd, S_STATIC2, false); + SetEnable(hWnd, S_STATIC3, false); + SetEnable(hWnd, S_STATIC4, false); + SetEnable(hWnd, S_STATIC5, false); + SetEnable(hWnd, S_STATIC66, false); + SetEnable(hWnd, S_STATIC7, false); + SetEnable(hWnd, S_STATIC11, false); + SetEnable(hWnd, R_CHECK_CERT, false); + SetEnable(hWnd, B_TRUST, false); + SetEnable(hWnd, B_SERVER_CERT, false); + SetEnable(hWnd, B_VIEW_SERVER_CERT, false); + SetEnable(hWnd, R_RETRY, false); + SetEnable(hWnd, S_RETRY_NUM_1, false); + SetEnable(hWnd, E_RETRY_NUM, false); + SetEnable(hWnd, S_RETRY_NUM_2, false); + SetEnable(hWnd, S_RETRY_SPAN_1, false); + SetEnable(hWnd, E_RETRY_SPAN, false); + SetEnable(hWnd, S_RETRY_SPAN_2, false); + SetEnable(hWnd, R_INFINITE, false); + } + + SetEnable(hWnd, IDOK, ok); +} + +// Initialize the account editing dialog +void CmEditAccountDlgInit(HWND hWnd, CM_ACCOUNT *a) +{ + RPC_CLIENT_ENUM_VLAN v; + UINT i; + // Validate arguments + if (hWnd == NULL || a == NULL) + { + return; + } + + if (a->LockMode) + { + SetText(hWnd, S_STATIC1, _UU("CM_EASY_ACCOUNT_WARNING")); + } + + // Connection settings name + if (a->EditMode || a->NatMode) + { + Disable(hWnd, E_ACCOUNT_NAME); + } + + if (a->NatMode || a->LinkMode) + { + Hide(hWnd, R_HIDE); + Hide(hWnd, R_HIDE2); + } + + Check(hWnd, R_HIDE, a->ClientOption->HideStatusWindow); + Check(hWnd, R_HIDE2, a->ClientOption->HideNicInfoWindow); + + if (a->NatMode) + { + Hide(hWnd, E_ACCOUNT_NAME); + Hide(hWnd, S_ACCOUNT_NAME); + } + + if ((cm != NULL && cm->server_name != NULL) || a->LinkMode) + { + Hide(hWnd, B_IE); + } + + SetText(hWnd, E_ACCOUNT_NAME, a->ClientOption->AccountName); + + // Host name + SetTextA(hWnd, E_HOSTNAME, a->ClientOption->Hostname); + StrCpy(a->old_server_name, sizeof(a->old_server_name), a->ClientOption->Hostname); + + if (InStr(a->ClientOption->Hostname, "/tcp")) + { + Check(hWnd, R_DISABLE_NATT, true); + } + else + { + Check(hWnd, R_DISABLE_NATT, false); + } + + // Port number + CbSetHeight(hWnd, C_PORT, 18); + CbAddStr(hWnd, C_PORT, _UU("CM_PORT_1"), 0); + CbAddStr(hWnd, C_PORT, _UU("CM_PORT_2"), 0); + CbAddStr(hWnd, C_PORT, _UU("CM_PORT_3"), 0); + CbAddStr(hWnd, C_PORT, _UU("CM_PORT_4"), 0); + SetInt(hWnd, C_PORT, a->ClientOption->Port); + + // Virtual HUB name + CbSetHeight(hWnd, C_HUBNAME, 18); + SetTextA(hWnd, C_HUBNAME, a->ClientOption->HubName); + + // Type of proxy + Check(hWnd, R_DIRECT_TCP, a->ClientOption->ProxyType == PROXY_DIRECT); + Check(hWnd, R_HTTPS, a->ClientOption->ProxyType == PROXY_HTTP); + Check(hWnd, R_SOCKS, a->ClientOption->ProxyType == PROXY_SOCKS); + Check(hWnd, R_SOCKS5, a->ClientOption->ProxyType == PROXY_SOCKS5); + + // Verify the server certificate + Check(hWnd, R_CHECK_CERT, a->CheckServerCert); + + // LAN card list + if (a->NatMode == false && a->LinkMode == false) + { + Zero(&v, sizeof(v)); + CcEnumVLan(cm->Client, &v); + LvInit(hWnd, L_VLAN); + LvInsertColumn(hWnd, L_VLAN, 0, L"DeviceName", 345); + for (i = 0;i < v.NumItem;i++) + { + wchar_t tmp[MAX_SIZE]; + char str[MAX_SIZE]; + CmVLanNameToPrintName(str, sizeof(str), v.Items[i]->DeviceName); + StrToUni(tmp, sizeof(tmp), str); + LvInsert(hWnd, L_VLAN, ICO_NIC_ONLINE, NULL, 1, tmp); + } +// LvAutoSize(hWnd, L_VLAN); + + if (v.NumItem == 1) + { + // If only one virtual LAN card exists, initially select it + LvSelect(hWnd, L_VLAN, 0); + } + + CiFreeClientEnumVLan(&v); + } + + // Select the LAN card + if (StrLen(a->ClientOption->DeviceName) != 0) + { + char str[MAX_SIZE]; + wchar_t tmp[MAX_SIZE]; + UINT index; + CmVLanNameToPrintName(str, sizeof(str), a->ClientOption->DeviceName); + StrToUni(tmp, sizeof(tmp), str); + index = LvSearchStr(hWnd, L_VLAN, 0, tmp); + if (index != INFINITE) + { + LvSelect(hWnd, L_VLAN, index); + } + } + + // Authentication type + CbSetHeight(hWnd, C_TYPE, 18); + CbAddStr(hWnd, C_TYPE, _UU("PW_TYPE_0"), CLIENT_AUTHTYPE_ANONYMOUS); + CbAddStr(hWnd, C_TYPE, _UU("PW_TYPE_1"), CLIENT_AUTHTYPE_PASSWORD); + CbAddStr(hWnd, C_TYPE, _UU("PW_TYPE_2"), CLIENT_AUTHTYPE_PLAIN_PASSWORD); + + if (a->HideClientCertAuth == false) + { + // Certificate authentication is not available when HideClientCertAuth is true + CbAddStr(hWnd, C_TYPE, _UU("PW_TYPE_3"), CLIENT_AUTHTYPE_CERT); + } + + if (a->HideSecureAuth == false) + { + // Authentication using a smart card + CbAddStr(hWnd, C_TYPE, _UU("PW_TYPE_4"), CLIENT_AUTHTYPE_SECURE); + } + + // Select an authentication + CbSelect(hWnd, C_TYPE, a->ClientAuth->AuthType); + + // User name + SetTextA(hWnd, E_USERNAME, a->ClientAuth->Username); + + // Password + if (a->EditMode) + { + SetTextA(hWnd, E_PASSWORD, HIDDEN_PASSWORD); + } + + // Reconnection times + if (a->ClientOption->NumRetry == 0) + { + Check(hWnd, R_RETRY, false); + } + else + { + Check(hWnd, R_RETRY, true); + if (a->ClientOption->NumRetry == INFINITE) + { + Check(hWnd, R_INFINITE, true); + } + else + { + Check(hWnd, R_INFINITE, false); + SetInt(hWnd, E_RETRY_NUM, a->ClientOption->NumRetry); + } + } + SetIntEx(hWnd, E_RETRY_SPAN, a->ClientOption->RetryInterval); + + // Title + if (a->NatMode == false) + { + if (a->EditMode == false) + { + SetText(hWnd, 0, _UU("CM_ACCOUNT_TITLE_1")); + FocusEx(hWnd, E_ACCOUNT_NAME); + } + else + { + SetText(hWnd, 0, _UU("CM_ACCOUNT_TITLE_2")); + FormatText(hWnd, 0, a->ClientOption->AccountName); + FocusEx(hWnd, E_HOSTNAME); + } + } + else + { + SetText(hWnd, 0, _UU("NM_ACCOUNT_TITLE")); + FocusEx(hWnd, E_HOSTNAME); + } + + if (a->LinkMode || a->NatMode) + { + Hide(hWnd, L_VLAN); + + if (a->NatMode == false) + { + SetText(hWnd, S_VLAN_GROUP, _UU("SM_LINK_POLICY_GROUP")); + Show(hWnd, S_POLICY_1); + Show(hWnd, S_POLICY_2); + Show(hWnd, B_POLICY); + } + else + { + Hide(hWnd, S_VLAN_GROUP); + Show(hWnd, S_ROUTER_LOGO); + } + } + + // Display update + a->Inited = true; + CmEditAccountDlgUpdate(hWnd, a); +} + +// Account editing dialog procedure +UINT CmEditAccountDlgProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param) +{ + CM_ACCOUNT *a = (CM_ACCOUNT *)param; + NMHDR *n; + X *x; + K *k; + char tmp[MAX_PATH]; + bool no_update_natt_check = false; + // Validate arguments + if (hWnd == NULL) + { + return 0; + } + + switch (msg) + { + case WM_INITDIALOG: + CmEditAccountDlgInit(hWnd, a); + if (a->EditMode == false && a->LinkMode == false && a->NatMode == false) + { + SetTimer(hWnd, 1, 100, NULL); + } + break; + case WM_TIMER: + switch (wParam) + { + case 1: + { + CM_INTERNET_SETTING s; + + KillTimer(hWnd, 1); + + Zero(&s, sizeof(s)); + CmGetSystemInternetSetting(&s); + + if (s.ProxyType != PROXY_DIRECT) + { + if (MsgBoxEx(hWnd, MB_ICONQUESTION | MB_YESNO, + _UU("CM_WOULDYOULOAD_IE_PROXY"), + s.ProxyHostName) == IDYES) + { + Command(hWnd, B_IE); + } + } + } + break; + } + break; + case WM_COMMAND: + switch (wParam) + { + case R_DISABLE_NATT: + Zero(tmp, sizeof(tmp)); + GetTxtA(hWnd, E_HOSTNAME, tmp, sizeof(tmp)); + + if (IsChecked(hWnd, R_DISABLE_NATT)) + { + if (InStr(tmp, "/tcp") == false) + { + Trim(tmp); + + StrCat(tmp, sizeof(tmp), "/tcp"); + + SetTextA(hWnd, E_HOSTNAME, tmp); + } + } + else + { + if (InStr(tmp, "/tcp")) + { + UINT i = SearchStrEx(tmp, "/tcp", 0, false); + + if (i != INFINITE) + { + tmp[i] = 0; + + Trim(tmp); + + SetTextA(hWnd, E_HOSTNAME, tmp); + } + } + } + + CmEditAccountDlgStartEnumHub(hWnd, a); + break; + } + switch (LOWORD(wParam)) + { + case E_ACCOUNT_NAME: + case E_HOSTNAME: + case C_PORT: + case C_HUBNAME: + case R_DIRECT_TCP: + case R_HTTPS: + case R_SOCKS: + case R_CHECK_CERT: + case C_TYPE: + case E_USERNAME: + case E_PASSWORD: + case R_RETRY: + case E_RETRY_NUM: + case E_RETRY_SPAN: + case R_INFINITE: + CmEditAccountDlgUpdate(hWnd, a); + break; + } + switch (HIWORD(wParam)) + { + case EN_KILLFOCUS: + switch (LOWORD(wParam)) + { + case E_HOSTNAME: + CmEditAccountDlgStartEnumHub(hWnd, a); + break; + } + break; + case BN_KILLFOCUS: + switch (LOWORD(wParam)) + { + case R_DIRECT_TCP: + case R_HTTPS: + case R_SOCKS: + CmEditAccountDlgStartEnumHub(hWnd, a); + break; + } + break; + case CBN_KILLFOCUS: + switch (LOWORD(wParam)) + { + case C_PORT: + CmEditAccountDlgStartEnumHub(hWnd, a); + break; + } + break; + case BN_PUSHED: + switch (LOWORD(wParam)) + { + case R_DISABLE_NATT: + break; + } + break; + } + if (HIWORD(wParam) == 0) + { + CmEditAccountDlgUpdate(hWnd, a); + } + switch (wParam) + { + case B_POLICY: + // Policy + if (a->LinkMode || a->NatMode) + { + a->Policy.Access = true; + a->Policy.MonitorPort = false; + SmPolicyDlgEx2(hWnd, &a->Policy, _UU("SM_LINK_POLICY_CAPTION"), true, a->PolicyVer); + a->Policy.Access = true; + a->Policy.MonitorPort = false; + } + break; + case IDOK: + CmEditAccountDlgUpdate(hWnd, a); + CmEditAccountDlgOnOk(hWnd, a); + break; + case IDCANCEL: + Close(hWnd); + break; + case B_PROXY_CONFIG: + // Proxy Settings + if (CmProxyDlg(hWnd, a->ClientOption)) + { + UINT n = GetInt(hWnd, C_PORT); + if (a->ClientOption->ProxyType == PROXY_HTTP && + n != 443) + { + // Show a warning message if the destination port is + // other than 443 and HTTP proxy is used + if (MsgBoxEx(hWnd, MB_ICONQUESTION | MB_YESNO, _UU("CM_HTTP_PROXY_WARNING"), n) == IDYES) + { + // Change the port number to 443 + SetText(hWnd, C_PORT, _UU("CM_PORT_2")); + } + } + CmEditAccountDlgStartEnumHub(hWnd, a); + CmEditAccountDlgUpdate(hWnd, a); + } + break; + case B_IE: + // Use the IE settings + if(cm->server_name == NULL) + { + CmProxyDlgUseForIE(hWnd, a->ClientOption); + CmEditAccountDlgUpdate(hWnd, a); + MsgBox(hWnd, MB_ICONINFORMATION, _UU("CM_PROXY_FROM_IE")); + } + break; + case B_TRUST: + // CA + if (a->LinkMode == false) + { + CmTrustDlg(hWnd); + } + else + { + SmCaDlg(hWnd, a->Hub); + } + break; + case B_SERVER_CERT: + // Server certificate registration / delete + if (a->ServerCert == NULL) + { + if (CmLoadXFromFileOrSecureCard(hWnd, &x)) + { + a->ServerCert = x; + CmEditAccountDlgUpdate(hWnd, a); + } + } + else + { + if (MsgBox(hWnd, MB_ICONQUESTION | MB_YESNO | MB_DEFBUTTON2, _UU("CM_DELETE_SERVER_CERT")) == IDYES) + { + FreeX(a->ServerCert); + a->ServerCert = NULL; + CmEditAccountDlgUpdate(hWnd, a); + } + } + break; + case B_VIEW_SERVER_CERT: + // Show the server certificate + if (a->ServerCert != NULL) + { + X *issuer = CmGetIssuer(a->ServerCert); + CertDlg(hWnd, a->ServerCert, issuer, true); + FreeX(issuer); + } + break; + case B_VIEW_CLIENT_CERT: + if (a->ClientAuth->AuthType != CLIENT_AUTHTYPE_SECURE) + { + // Show the client certificate + if (a->ClientAuth->ClientX != NULL) + { + X *issuer = CmGetIssuer(a->ClientAuth->ClientX); + CertDlg(hWnd, a->ClientAuth->ClientX, issuer, true); + FreeX(issuer); + } + } + else + { + UINT id; + // Select the type of smart card + SmSelectSecureId(hWnd); + id = SmGetCurrentSecureIdFromReg(); + if (id != 0) + { + if (cm->server_name == NULL) + { + RPC_USE_SECURE t; + + Zero(&t, sizeof(t)); + t.DeviceId = id; + CcUseSecure(cm->Client, &t); + } + } + CmEditAccountDlgUpdate(hWnd, a); + } + break; + case B_REGIST_CLIENT_CERT: + if (a->ClientAuth->AuthType != CLIENT_AUTHTYPE_SECURE) + { + // Client certificate registration / deletion + if (a->ClientAuth->ClientX == NULL) + { + if (CmLoadXAndK(hWnd, &x, &k)) + { + a->ClientAuth->ClientX = x; + a->ClientAuth->ClientK = k; + CmEditAccountDlgUpdate(hWnd, a); + } + } + else + { + if (MsgBox(hWnd, MB_ICONQUESTION | MB_YESNO | MB_DEFBUTTON2, _UU("CM_DELETE_CLIENT_CERT")) == IDYES) + { + FreeX(a->ClientAuth->ClientX); + FreeK(a->ClientAuth->ClientK); + a->ClientAuth->ClientX = NULL; + a->ClientAuth->ClientK = NULL; + CmEditAccountDlgUpdate(hWnd, a); + } + } + } + else + { + char cert[MAX_SECURE_DEVICE_FILE_LEN + 1], priv[MAX_SECURE_DEVICE_FILE_LEN + 1]; + + // Select a certificate in the smart card + if (SmSelectKeyPairEx(hWnd, cert, sizeof(cert), priv, sizeof(priv), CmGetSecureBitmapId(a->ClientOption->Hostname))) + { + StrCpy(a->ClientAuth->SecurePublicCertName, sizeof(a->ClientAuth->SecurePublicCertName), cert); + StrCpy(a->ClientAuth->SecurePrivateKeyName, sizeof(a->ClientAuth->SecurePrivateKeyName), priv); + CmEditAccountDlgUpdate(hWnd, a); + } + } + break; + case B_DETAIL: + // Advanced communication settings + if (CmDetailDlg(hWnd, a)) + { + CmEditAccountDlgUpdate(hWnd, a); + } + break; + case B_CHANGE_PASSWORD: + // Change the password + CmChangePassword(hWnd, a->ClientOption, a->ClientOption->HubName, + a->ClientAuth->Username); + break; + } + break; + case WM_CLOSE: + EndDialog(hWnd, false); + break; + case WM_NOTIFY: + n = (NMHDR *)lParam; + switch (n->idFrom) + { + case L_VLAN: + switch (n->code) + { + case LVN_ITEMCHANGED: + CmEditAccountDlgUpdate(hWnd, a); + break; + } + break; + } + break; + } + + return 0; +} + +// Update the custom proxy HTTP header dialog +void CmProxyHttpHeaderDlgUpdate(HWND hWnd) +{ + UINT i = 0; + bool ok = true; + LIST *names_list; + // Validate arguments + if (hWnd == NULL) + { + return; + } + + names_list = NewList(NULL); + + for (; i < LvNum(hWnd, L_VALUES_LIST); i++) + { + wchar_t *str = LvGetStr(hWnd, L_VALUES_LIST, i, 0); + UniTrim(str); + if (IsEmptyUniStr(str) || IsInListUniStr(names_list, str)) + { + Free(str); + ok = false; + break; + } + + Add(names_list, str); + } + + FreeStrList(names_list); + SetEnable(hWnd, IDOK, ok); +} + +// Update the custom proxy HTTP header dialog content +void CmProxyHttpHeaderDlgRefresh(HWND hWnd, CM_PROXY_HTTP_HEADER_DLG *d) +{ + UINT i = 0; + LIST *list; + LVB *b; + CLIENT_OPTION *a; + // Validate arguments + if (hWnd == NULL || d == NULL) + { + return; + } + + a = (CLIENT_OPTION *)d->ClientOption; + + list = NewEntryList(a->CustomHttpHeader, "\r\n", ":"); + + b = LvInsertStart(); + + for (; i < LIST_NUM(list); i++) + { + INI_ENTRY *e = LIST_DATA(list, i); + wchar_t *name = CopyStrToUni(e->Key); + wchar_t *value = CopyStrToUni(e->Value); + UniTrimLeft(value); + + LvInsertAdd(b, 0, NULL, 2, name, value); + + Free(name); + Free(value); + } + + LvInsertEnd(b, hWnd, L_VALUES_LIST); + FreeEntryList(list); +} + +// Initialize the custom proxy HTTP header dialog +void CmProxyHttpHeaderDlgInit(HWND hWnd, CM_PROXY_HTTP_HEADER_DLG *d) +{ + // Validate arguments + if (hWnd == NULL || d == NULL) + { + return; + } + + LvSetEnhanced(hWnd, L_VALUES_LIST, true); + LvInitEx(hWnd, L_VALUES_LIST, true); + LvInsertColumn(hWnd, L_VALUES_LIST, 0, _UU("CM_HTTP_HEADER_COLUMN_0"), 150); + LvInsertColumn(hWnd, L_VALUES_LIST, 1, _UU("CM_HTTP_HEADER_COLUMN_1"), 150); + + LvSetStyle(hWnd, L_VALUES_LIST, LVS_EX_GRIDLINES); + + CmProxyHttpHeaderDlgRefresh(hWnd, d); +} + +// Custom proxy HTTP header dialog control +UINT CmProxyHttpHeaderDlgProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param) +{ + CM_PROXY_HTTP_HEADER_DLG *d = (CM_PROXY_HTTP_HEADER_DLG *)param; + CLIENT_OPTION *a = (d == NULL ? NULL : d->ClientOption); + UINT i = INFINITE; + // Validate arguments + if (hWnd == NULL || d == NULL || a == NULL) + { + return 0; + } + + switch (msg) + { + case WM_INITDIALOG: + CmProxyHttpHeaderDlgInit(hWnd, d); + break; + case WM_CLOSE: + EndDialog(hWnd, false); + break; + case WM_NOTIFY: + { + switch (((LPNMHDR)lParam)->code) + { + // Header divider being dragged (resizing columns) + case HDN_ITEMCHANGINGA: + case HDN_ITEMCHANGINGW: + if (d->EditBox != NULL) + { + RECT rect; + ListView_GetSubItemRect(DlgItem(hWnd, L_VALUES_LIST), d->CurrentItem, d->CurrentSubItem, LVIR_LABEL, &rect); + MoveWindow(d->EditBox, rect.left, rect.top, rect.right - rect.left, rect.bottom - rect.top, true); + RedrawWindow(d->EditBox, NULL, NULL, RDW_ERASE | RDW_INVALIDATE | RDW_UPDATENOW); + } + break; + case LVN_ITEMCHANGED: + if (((LPNMHDR)lParam)->idFrom == L_VALUES_LIST) + { + CmProxyHttpHeaderDlgUpdate(hWnd); + } + break; + case NM_DBLCLK: + { + RECT rect; + LPNMLISTVIEW list_view = (LPNMLISTVIEW)lParam; + wchar_t *str; + + d->CurrentItem = list_view->iItem; + d->CurrentSubItem = list_view->iSubItem; + str = LvGetStr(DlgItem(hWnd, L_VALUES_LIST), 0, d->CurrentItem, d->CurrentSubItem); + ListView_GetSubItemRect(DlgItem(hWnd, L_VALUES_LIST), d->CurrentItem, d->CurrentSubItem, LVIR_LABEL, &rect); + + d->EditBox = CreateWindowExW(0, L"EDIT", str, WS_BORDER | WS_CHILD | WS_VISIBLE | ES_AUTOHSCROLL | ES_LEFT | ES_MULTILINE | ES_WANTRETURN, rect.left, rect.top, rect.right - rect.left, rect.bottom - rect.top, DlgItem(hWnd, L_VALUES_LIST), NULL, GetModuleHandle(NULL), NULL); + Free(str); + + DlgFont(d->EditBox, 0, 8, false); + EditBoxSetEnhanced(d->EditBox, 0, true); + FocusEx(d->EditBox, 0); + break; + } + case NM_CLICK: + case NM_RETURN: + if (d->EditBox != NULL) + { + wchar_t *new_name = GetText(d->EditBox, 0); + wchar_t *old_name = LvGetStr(hWnd, L_VALUES_LIST, d->CurrentItem, d->CurrentSubItem); + + if (old_name != NULL) + { + if (UniStrCmp(new_name, old_name) != 0) + { + LvSetItem(hWnd, L_VALUES_LIST, d->CurrentItem, d->CurrentSubItem, new_name); + } + + Free(old_name); + } + + Free(new_name); + + DestroyWindow(d->EditBox); + d->EditBox = NULL; + } + } + break; + } + case WM_COMMAND: + switch (wParam) + { + case B_NEW: + { + NMLISTVIEW lv; + + if (d->EditBox != NULL) + { + DestroyWindow(d->EditBox); + } + + i = LvInsertItem(hWnd, L_VALUES_LIST, 0, NULL, L""); + LvSelect(hWnd, L_VALUES_LIST, i); + + Zero(&lv, sizeof(lv)); + lv.hdr.code = NM_DBLCLK; + lv.iItem = i; + lv.iSubItem = 0; + + SendMsg(hWnd, 0, WM_NOTIFY, 0, (LPARAM)&lv); + } + break; + case B_DELETE: + if (d->EditBox != NULL) + { + DestroyWindow(d->EditBox); + } + + i = LvGetSelected(hWnd, L_VALUES_LIST); + if (i != INFINITE) + { + LvDeleteItem(hWnd, L_VALUES_LIST, i); + } + CmProxyHttpHeaderDlgUpdate(hWnd); + break; + case B_CLEAR: + if (d->EditBox != NULL) + { + DestroyWindow(d->EditBox); + } + + LvReset(hWnd, L_VALUES_LIST); + CmProxyHttpHeaderDlgUpdate(hWnd); + break; + case IDOK: + { + UINT index = 0; + char *name = NULL; + char *value = NULL; + char http_header[HTTP_CUSTOM_HEADER_MAX_SIZE]; + + Zero(http_header, sizeof(http_header)); + i = LvNum(hWnd, L_VALUES_LIST); + + for (; index < i; index++) + { + char str[HTTP_CUSTOM_HEADER_MAX_SIZE]; + name = LvGetStrA(hWnd, L_VALUES_LIST, index, 0); + value = LvGetStrA(hWnd, L_VALUES_LIST, index, 1); + + Trim(name); + TrimLeft(value); + + Format(str, sizeof(str), "%s: %s\r\n", name, value); + EnSafeHttpHeaderValueStr(str, ' '); + + Free(name); + Free(value); + + if ((StrLen(http_header) + StrLen(str)) < sizeof(a->CustomHttpHeader)) + { + StrCat(http_header, sizeof(str), str); + } + else + { + MsgBox(hWnd, MB_ICONEXCLAMATION | MB_OK, _E(ERR_TOO_MANT_ITEMS)); + return 1; + } + } + + Zero(a->CustomHttpHeader, sizeof(a->CustomHttpHeader)); + StrCpy(a->CustomHttpHeader, sizeof(a->CustomHttpHeader), http_header); + + EndDialog(hWnd, true); + break; + } + case IDCANCEL: + Close(hWnd); + } + } + + return 0; +} + +// Custom proxy HTTP header dialog +bool CmProxyHttpHeaderDlg(HWND hWnd, CLIENT_OPTION *a) +{ + CM_PROXY_HTTP_HEADER_DLG d; + // Validate arguments + if (a == NULL) + { + return false; + } + + Zero(&d, sizeof(d)); + + d.ClientOption = a; + + return Dialog(hWnd, D_CM_PROXY_HTTP_HEADER, CmProxyHttpHeaderDlgProc, &d); +} + +// Update the proxy server settings +void CmProxyDlgUpdate(HWND hWnd, CLIENT_OPTION *a) +{ + bool ok = true; + // Validate arguments + if (hWnd == NULL || a == NULL) + { + return; + } + + SetEnable(hWnd, B_HTTP_HEADER, a->ProxyType == PROXY_HTTP); + + if (IsEmpty(hWnd, E_HOSTNAME)) + { + ok = false; + } + if (GetInt(hWnd, C_PORT) == 0) + { + ok = false; + } + + SetEnable(hWnd, IDOK, ok); +} + +// Proxy server settings dialog c +UINT CmProxyDlgProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param) +{ + CLIENT_OPTION *a = (CLIENT_OPTION *)param; + // Validate arguments + if (hWnd == NULL) + { + return 0; + } + + switch (msg) + { + case WM_INITDIALOG: + SetTextA(hWnd, E_HOSTNAME, a->ProxyName); + CbSetHeight(hWnd, C_PORT, 18); + CbAddStr(hWnd, C_PORT, L"8080", 0); + CbAddStr(hWnd, C_PORT, L"1080", 0); + CbAddStr(hWnd, C_PORT, L"80", 0); + CbAddStr(hWnd, C_PORT, L"3128", 0); + CbAddStr(hWnd, C_PORT, L"443", 0); + CbAddStr(hWnd, C_PORT, L"9821", 0); + CbAddStr(hWnd, C_PORT, L"9801", 0); + SetIntEx(hWnd, C_PORT, a->ProxyPort); + SetTextA(hWnd, E_USERNAME, a->ProxyUsername); + SetTextA(hWnd, E_PASSWORD, a->ProxyPassword); + if (a->ProxyPort == 0) + { + if (a->ProxyType == PROXY_HTTP) + { + SetInt(hWnd, C_PORT, 8080); + } + else + { + SetInt(hWnd, C_PORT, 1080); + } + } + CmProxyDlgUpdate(hWnd, a); + break; + case WM_COMMAND: + switch (LOWORD(wParam)) + { + case E_HOSTNAME: + case C_PORT: + case E_USERNAME: + case E_PASSWORD: + CmProxyDlgUpdate(hWnd, a); + break; + } + + switch (wParam) + { + case B_HTTP_HEADER: + CmProxyHttpHeaderDlg(hWnd, a); + break; + case IDOK: + GetTxtA(hWnd, E_HOSTNAME, a->ProxyName, sizeof(a->ProxyName)); + GetTxtA(hWnd, E_USERNAME, a->ProxyUsername, sizeof(a->ProxyUsername)); + GetTxtA(hWnd, E_PASSWORD, a->ProxyPassword, sizeof(a->ProxyPassword)); + a->ProxyPort = GetInt(hWnd, C_PORT); + EndDialog(hWnd, true); + break; + case IDCANCEL: + Close(hWnd); + break; + } + break; + case WM_CLOSE: + EndDialog(hWnd, false); + break; + } + + return 0; +} + +// Proxy server settings +bool CmProxyDlg(HWND hWnd, CLIENT_OPTION *a) +{ + // Validate arguments + if (a == NULL) + { + return false; + } + + return Dialog(hWnd, D_CM_PROXY, CmProxyDlgProc, a); +} + +// Get issuer of the specified certificate if it is known +X *CmGetIssuer(X *x) +{ + RPC_GET_ISSUER a; + X *ret; + // Validate arguments + if (x == NULL) + { + return NULL; + } + + Zero(&a, sizeof(a)); + a.x = CloneX(x); + if (CALLEX(cm->hMainWnd, CcGetIssuer(cm->Client, &a)) == 0) + { + ret = CloneX(a.issuer_x); + } + else + { + ret = NULL; + } + + CiFreeGetIssuer(&a); + + return ret; +} + +// Initialize the dialog +void CmLoadXFromFileOrSecureCardDlgInit(HWND hWnd, CM_LOADX *p) +{ + UINT current; + // Validate arguments + if (hWnd == NULL || p == NULL) + { + return; + } + + current = MsRegReadInt(REG_CURRENT_USER, SECURE_MANAGER_KEY, "CertLoadSource"); + + Check(hWnd, R_FROM_FILE, current == 0); + Check(hWnd, R_FROM_SECURE, current != 0); + + SetFont(hWnd, S_INFO, Font(0, true)); + + CmLoadXFromFileOrSecureCardDlgUpdate(hWnd, p); +} + +// Update the dialog control +void CmLoadXFromFileOrSecureCardDlgUpdate(HWND hWnd, CM_LOADX *p) +{ + SECURE_DEVICE *dev; + wchar_t tmp[MAX_SIZE]; + bool ok = true; + // Validate arguments + if (hWnd == NULL || p == NULL) + { + return; + } + + dev = GetSecureDevice(SmGetCurrentSecureIdFromReg()); + if (dev == NULL) + { + UniStrCpy(tmp, sizeof(tmp), _UU("SEC_CURRENT_NO_DEVICE")); + } + else + { + UniFormat(tmp, sizeof(tmp), _UU("SEC_CURRENT_DEVICE"), dev->DeviceName); + } + + SetText(hWnd, S_INFO, tmp); + + if (IsChecked(hWnd, R_FROM_SECURE)) + { + if (dev == NULL) + { + ok = false; + } + } + + SetEnable(hWnd, IDOK, ok); + SetEnable(hWnd, B_SELECT, IsChecked(hWnd, R_FROM_SECURE)); + SetEnable(hWnd, S_CERT, IsChecked(hWnd, R_FROM_SECURE)); + SetEnable(hWnd, S_FILE, IsChecked(hWnd, R_FROM_FILE)); +} + +// Certificate reading selection dialog procedure +UINT CmLoadXFromFileOrSecureCardDlgProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param) +{ + CM_LOADX *p = (CM_LOADX *)param; + X *x; + UINT current; + // Validate arguments + if (hWnd == NULL) + { + return 0; + } + + switch (msg) + { + case WM_INITDIALOG: + CmLoadXFromFileOrSecureCardDlgInit(hWnd, p); + break; + + case WM_COMMAND: + switch (wParam) + { + case IDOK: + current = (IsChecked(hWnd, R_FROM_FILE)) ? 0 : 1; + MsRegWriteInt(REG_CURRENT_USER, SECURE_MANAGER_KEY, "CertLoadSource", current); + + if (current == 0) + { + // From file + if (CmLoadX(hWnd, &x)) + { + p->x = x; + EndDialog(hWnd, true); + } + } + else + { + // From the smart card + char name[MAX_SIZE]; + + // Select the certificate name in the card + if (SmSelectKeyPair(hWnd, name, sizeof(name), NULL, 0)) + { + // Read + WINUI_SECURE_BATCH batch[] = + { + {WINUI_SECURE_READ_CERT, name, true, NULL, NULL, NULL, NULL, NULL, NULL}, + }; + + // Do reading + if (SecureDeviceWindow(hWnd, batch, sizeof(batch) / sizeof(batch[0]), SmGetCurrentSecureIdFromReg(), 0)) + { + // Success + p->x = batch[0].OutputX; + EndDialog(hWnd, true); + } + } + } + break; + + case IDCANCEL: + Close(hWnd); + break; + + case R_FROM_FILE: + CmLoadXFromFileOrSecureCardDlgUpdate(hWnd, p); + break; + + case R_FROM_SECURE: + CmLoadXFromFileOrSecureCardDlgUpdate(hWnd, p); + break; + + case B_SELECT: + SmSelectSecureId(hWnd); + CmLoadXFromFileOrSecureCardDlgUpdate(hWnd, p); + break; + } + break; + + case WM_CLOSE: + EndDialog(hWnd, false); + break; + } + + return 0; +} + +// Read certificate from a file or a smart card +bool CmLoadXFromFileOrSecureCard(HWND hWnd, X **x) +{ + CM_LOADX p; + // Validate arguments + if (x == NULL) + { + return false; + } + + Zero(&p, sizeof(p)); + if (Dialog(hWnd, D_CM_LOAD_X, CmLoadXFromFileOrSecureCardDlgProc, &p) == false) + { + return false; + } + + *x = p.x; + + return true; +} + +// Read the certificate +bool CmLoadX(HWND hWnd, X **x) +{ + return CmLoadXEx(hWnd, x, NULL, 0); +} +bool CmLoadXEx(HWND hWnd, X **x, char *filename, UINT size) +{ + wchar_t *filename_w = CopyStrToUni(filename); + bool ret; + + ret = CmLoadXExW(hWnd, x, filename_w, size); + + Free(filename_w); + + return ret; +} +bool CmLoadXExW(HWND hWnd, X **x, wchar_t *filename, UINT size) +{ + wchar_t *s; + bool is_p12; + wchar_t tmp[MAX_SIZE]; + K *k; + // Validate arguments + if (x == NULL) + { + return false; + } + + // Read the certificate + s = OpenDlg(hWnd, _UU("DLG_CERT_OR_P12_FILTER"), _UU("DLG_OPEN_CERT")); + if (s == NULL) + { + return false; + } + UniStrCpy(tmp, sizeof(tmp), s); + if (filename != NULL) + { + UniStrCpy(filename, size, tmp); + } + Free(s); + if (UniEndWith(tmp, L".p12") || UniEndWith(tmp, L".pfx")) + { + is_p12 = true; + } + else + { + is_p12 = false; + } + + if (is_p12) + { + // Processing of PKCS#12 + BUF *b = ReadDumpW(tmp); + P12 *p12; + if (b == NULL) + { + MsgBoxEx(hWnd, MB_ICONSTOP, _UU("DLG_OPEN_FILE_ERROR_W"), tmp); + return false; + } + p12 = BufToP12(b); + if (p12 == NULL) + { + MsgBoxEx(hWnd, MB_ICONSTOP, _UU("DLG_BAD_P12_W"), tmp); + FreeBuf(b); + return false; + } + if (IsEncryptedP12(p12) == false) + { + if (ParseP12(p12, x, &k, NULL) == false) + { + MsgBoxEx(hWnd, MB_ICONSTOP, _UU("DLG_BAD_P12_W"), tmp); + FreeP12(p12); + FreeBuf(b); + return false; + } + } + else + { + char password[MAX_SIZE]; + if (PassphraseDlg(hWnd, password, sizeof(password), b, true) == false) + { + FreeP12(p12); + FreeBuf(b); + return false; + } + else + { + if (ParseP12(p12, x, &k, password) == false) + { + MsgBoxEx(hWnd, MB_ICONSTOP, _UU("DLG_BAD_P12_W"), tmp); + FreeP12(p12); + FreeBuf(b); + return false; + } + } + } + FreeP12(p12); + FreeBuf(b); + FreeK(k); + return true; + } + else + { + // Processing of X509 + BUF *b = ReadDumpW(tmp); + X *x509; + if (b == NULL) + { + MsgBoxEx(hWnd, MB_ICONSTOP, _UU("DLG_OPEN_FILE_ERROR_W"), tmp); + return false; + } + + x509 = BufToX(b, IsBase64(b)); + FreeBuf(b); + if (x509 == NULL) + { + MsgBoxEx(hWnd, MB_ICONSTOP, _UU("DLG_BAD_X509_W"), tmp); + return false; + } + + *x = x509; + return true; + } +} + +// Read the secret key +bool CmLoadKEx(HWND hWnd, K **k, char *filename, UINT size) +{ + wchar_t *filename_w = CopyStrToUni(filename); + bool ret; + + ret = CmLoadKExW(hWnd, k, filename_w, size); + + Free(filename_w); + + return ret; +} +bool CmLoadKExW(HWND hWnd, K **k, wchar_t *filename, UINT size) +{ + wchar_t *s; + bool is_p12; + wchar_t tmp[MAX_SIZE]; + // Validate arguments + if (k == NULL) + { + return false; + } + + // Read the certificate + s = OpenDlg(hWnd, _UU("DLG_KEY_OR_P12_FILTER"), _UU("DLG_OPEN_KEY")); + if (s == NULL) + { + return false; + } + UniStrCpy(tmp, sizeof(tmp), s); + Free(s); + if (filename != NULL) + { + UniStrCpy(filename, size, tmp); + } + if (UniEndWith(tmp, L".p12") || UniEndWith(tmp, L".pfx")) + { + is_p12 = true; + } + else + { + is_p12 = false; + } + + if (is_p12) + { + // Processing of PKCS#12 + BUF *b = ReadDumpW(tmp); + P12 *p12; + if (b == NULL) + { + MsgBoxEx(hWnd, MB_ICONSTOP, _UU("DLG_OPEN_FILE_ERROR_W"), tmp); + return false; + } + p12 = BufToP12(b); + if (p12 == NULL) + { + MsgBoxEx(hWnd, MB_ICONSTOP, _UU("DLG_BAD_P12_W"), tmp); + FreeBuf(b); + return false; + } + if (IsEncryptedP12(p12) == false) + { + X *x; + if (ParseP12(p12, &x, k, NULL) == false) + { + MsgBoxEx(hWnd, MB_ICONSTOP, _UU("DLG_BAD_P12_W"), tmp); + FreeP12(p12); + FreeBuf(b); + return false; + } + + FreeX(x); + } + else + { + char password[MAX_SIZE]; + if (PassphraseDlg(hWnd, password, sizeof(password), b, true) == false) + { + FreeP12(p12); + FreeBuf(b); + return false; + } + else + { + X *x; + if (ParseP12(p12, &x, k, password) == false) + { + MsgBoxEx(hWnd, MB_ICONSTOP, _UU("DLG_BAD_P12_W"), tmp); + FreeP12(p12); + FreeBuf(b); + return false; + } + + FreeX(x); + } + } + FreeP12(p12); + FreeBuf(b); + return true; + } + else + { + // Processing of private key + BUF *b = ReadDumpW(tmp); + K *key; + if (b == NULL) + { + MsgBoxEx(hWnd, MB_ICONSTOP, _UU("DLG_OPEN_FILE_ERROR_W"), tmp); + return false; + } + + if (IsEncryptedK(b, true) == false) + { + key = BufToK(b, true, IsBase64(b), NULL); + } + else + { + char pass[MAX_SIZE]; + if (PassphraseDlg(hWnd, pass, sizeof(pass), b, false) == false) + { + FreeBuf(b); + return false; + } + key = BufToK(b, true, IsBase64(b), pass); + } + + if (key == NULL) + { + FreeBuf(b); + MsgBoxEx(hWnd, MB_ICONSTOP, _UU("DLG_BAD_KEY_W"), tmp); + return false; + } + + FreeBuf(b); + *k = key; + return true; + } +} + +// Read a set of certificate and private key +bool CmLoadXAndK(HWND hWnd, X **x, K **k) +{ + wchar_t *s; + bool is_p12; + wchar_t tmp[MAX_SIZE]; + // Validate arguments + if (x == NULL || k == NULL) + { + return false; + } +START_FIRST: + + // Read the certificate + s = OpenDlg(hWnd, _UU("DLG_CERT_OR_P12_FILTER"), _UU("DLG_OPEN_CERT")); + if (s == NULL) + { + return false; + } + UniStrCpy(tmp, sizeof(tmp), s); + Free(s); + if (UniEndWith(tmp, L".p12") || UniEndWith(tmp, L".pfx")) + { + is_p12 = true; + } + else + { + is_p12 = false; + } + + if (is_p12) + { + // Processing of PKCS#12 + BUF *b = ReadDumpW(tmp); + P12 *p12; + if (b == NULL) + { + MsgBoxEx(hWnd, MB_ICONSTOP, _UU("DLG_OPEN_FILE_ERROR_W"), tmp); + return false; + } + p12 = BufToP12(b); + if (p12 == NULL) + { + MsgBoxEx(hWnd, MB_ICONSTOP, _UU("DLG_BAD_P12_W"), tmp); + FreeBuf(b); + return false; + } + if (IsEncryptedP12(p12) == false) + { + if (ParseP12(p12, x, k, NULL) == false) + { + MsgBoxEx(hWnd, MB_ICONSTOP, _UU("DLG_BAD_P12_W"), tmp); + FreeP12(p12); + FreeBuf(b); + return false; + } + } + else + { + char password[MAX_SIZE]; + if (PassphraseDlg(hWnd, password, sizeof(password), b, true) == false) + { + FreeP12(p12); + FreeBuf(b); + return false; + } + else + { + if (ParseP12(p12, x, k, password) == false) + { + MsgBoxEx(hWnd, MB_ICONSTOP, _UU("DLG_BAD_P12_W"), tmp); + FreeP12(p12); + FreeBuf(b); + return false; + } + } + } + if (CheckXandK(*x, *k) == false) + { + FreeX(*x); + FreeK(*k); + FreeP12(p12); + FreeBuf(b); + if (MsgBox(hWnd, MB_ICONEXCLAMATION | MB_RETRYCANCEL, _UU("DLG_BAD_SIGNATURE")) == IDRETRY) + { + goto START_FIRST; + } + return false; + } + FreeP12(p12); + FreeBuf(b); + return true; + } + else + { + // Processing of X509 + BUF *b = ReadDumpW(tmp); + X *x509; + K *key; + if (b == NULL) + { + MsgBoxEx(hWnd, MB_ICONSTOP, _UU("DLG_OPEN_FILE_ERROR_W"), tmp); + return false; + } + + x509 = BufToX(b, IsBase64(b)); + FreeBuf(b); + if (x509 == NULL) + { + MsgBoxEx(hWnd, MB_ICONSTOP, _UU("DLG_BAD_X509_W"), tmp); + return false; + } + + // Read the secret key + s = OpenDlg(hWnd, _UU("DLG_KEY_FILTER"), _UU("DLG_OPEN_KEY_WITH_CERT")); + if (s == NULL) + { + FreeX(x509); + return false; + } + UniStrCpy(tmp, sizeof(tmp), s); + Free(s); + + b = ReadDumpW(tmp); + if (b == NULL) + { + MsgBoxEx(hWnd, MB_ICONSTOP, _UU("DLG_OPEN_FILE_ERROR_W"), tmp); + FreeX(x509); + return false; + } + + if (IsEncryptedK(b, true) == false) + { + key = BufToK(b, true, IsBase64(b), NULL); + } + else + { + char pass[MAX_SIZE]; + if (PassphraseDlg(hWnd, pass, sizeof(pass), b, false) == false) + { + FreeBuf(b); + FreeX(x509); + return false; + } + key = BufToK(b, true, IsBase64(b), pass); + } + + if (key == NULL) + { + FreeBuf(b); + FreeX(x509); + MsgBoxEx(hWnd, MB_ICONSTOP, _UU("DLG_BAD_KEY_W"), tmp); + return false; + } + + if (CheckXandK(x509, key) == false) + { + FreeBuf(b); + FreeX(x509); + FreeK(key); + if (MsgBox(hWnd, MB_ICONEXCLAMATION | MB_RETRYCANCEL, _UU("DLG_BAD_SIGNATURE")) == IDRETRY) + { + goto START_FIRST; + } + return false; + } + + FreeBuf(b); + *x = x509; + *k = key; + return true; + } +} + +// Virtual HUB enumeration start +void CmEditAccountDlgStartEnumHub(HWND hWnd, CM_ACCOUNT *a) +{ + char server_name[MAX_HOST_NAME_LEN + 1]; + UINT old_proxy_type; + // Validate arguments + if (hWnd == NULL || a == NULL) + { + return; + } + + + if (StrLen(a->ClientOption->Hostname) == 0) + { + return; + } + if (a->ClientOption->Port == 0) + { + return; + } + if (a->ClientOption->ProxyType != PROXY_DIRECT && + (StrLen(a->ClientOption->ProxyName) == 0 || + a->ClientOption->ProxyPort == 0)) + { + return; + } + + GetTxtA(hWnd, E_HOSTNAME, server_name, sizeof(server_name)); + + if (StrCmpi(server_name, a->old_server_name) == 0) + { + if (CbNum(hWnd, C_HUBNAME) != 0) + { + return; + } + } + else + { + StrCpy(a->old_server_name, sizeof(a->old_server_name), server_name); + CbReset(hWnd, C_HUBNAME); + } + + old_proxy_type = a->ClientOption->ProxyType; + + if (IsChecked(hWnd, R_DIRECT_TCP)) + { + a->ClientOption->ProxyType = PROXY_DIRECT; + } + if (IsChecked(hWnd, R_HTTPS)) + { + a->ClientOption->ProxyType = PROXY_HTTP; + } + if (IsChecked(hWnd, R_SOCKS)) + { + a->ClientOption->ProxyType = PROXY_SOCKS; + } + if (IsChecked(hWnd, R_SOCKS5)) + { + a->ClientOption->ProxyType = PROXY_SOCKS5; + } + + CmEnumHubStart(hWnd, a->ClientOption); + + a->ClientOption->ProxyType = old_proxy_type; +} + +// [OK] button +void CmEditAccountDlgOnOk(HWND hWnd, CM_ACCOUNT *a) +{ + RPC_CLIENT_CREATE_ACCOUNT c; + bool b; + // Validate arguments + if (hWnd == NULL || a == NULL) + { + return; + } + if (a->ClientOption->NumRetry != 0 && a->ClientOption->RetryInterval < 5) + { + MsgBox(hWnd, MB_ICONINFORMATION, _UU("CM_RETRY_INTERVAL_ERROR")); + FocusEx(hWnd, E_RETRY_SPAN); + return; + } + + CmEditAccountDlgUpdate(hWnd, a); + + if (a->LinkMode == false && a->NatMode == false) + { + // Save the account + Zero(&c, sizeof(c)); + c.ClientOption = ZeroMalloc(sizeof(CLIENT_OPTION)); + Copy(c.ClientOption, a->ClientOption, sizeof(CLIENT_OPTION)); + c.ClientAuth = CopyClientAuth(a->ClientAuth); + c.CheckServerCert = a->CheckServerCert; + if (a->ServerCert != NULL) + { + c.ServerCert = CloneX(a->ServerCert); + } + c.StartupAccount = a->Startup; + + if (a->EditMode == false) + { + b = CALL(hWnd, CcCreateAccount(cm->Client, &c)); + } + else + { + b = CALL(hWnd, CcSetAccount(cm->Client, &c)); + } + + CiFreeClientCreateAccount(&c); + + // Check whether this account is currently running + if (b) + { + RPC_CLIENT_GET_CONNECTION_STATUS st; + Zero(&st, sizeof(st)); + UniStrCpy(st.AccountName, sizeof(st.AccountName), a->ClientOption->AccountName); + if (CALL(hWnd, CcGetAccountStatus(cm->Client, &st))) + { + if (st.Active) + { + MsgBoxEx(hWnd, MB_ICONINFORMATION, _UU("CM_CURRENT_ACTIVE"), + st.AccountName); + } + } + } + + if (b) + { + EndDialog(hWnd, true); + } + } + else + { + if (a->LinkMode) + { + // Link mode + RPC_CREATE_LINK t; + + Zero(&t, sizeof(t)); + StrCpy(t.HubName, sizeof(t.HubName), a->Hub->HubName); + t.Online = a->OnlineFlag; + Copy(&t.Policy, &a->Policy, sizeof(POLICY)); + t.ClientOption = ZeroMalloc(sizeof(CLIENT_OPTION)); + Copy(t.ClientOption, a->ClientOption, sizeof(CLIENT_OPTION)); + t.ClientAuth = CopyClientAuth(a->ClientAuth); + t.CheckServerCert = a->CheckServerCert; + t.ServerCert = CloneX(a->ServerCert); + + // Save the settings for cascade connection + if (a->EditMode) + { + if (CALL(hWnd, ScSetLink(a->Hub->Rpc, &t))) + { + if (a->OnlineFlag) + { + MsgBoxEx(hWnd, MB_ICONINFORMATION, _UU("SM_LINK_SAVE_ONLINE"), a->ClientOption->AccountName); + } + EndDialog(hWnd, true); + } + } + else + { + if (CALL(hWnd, ScCreateLink(a->Hub->Rpc, &t))) + { + if (a->Link_ConnectNow) + { + RPC_LINK tt; + + Zero(&tt, sizeof(tt)); + UniStrCpy(tt.AccountName, sizeof(tt.AccountName), a->ClientOption->AccountName); + StrCpy(tt.HubName, sizeof(tt.HubName), a->Hub->HubName); + + CALL(hWnd, ScSetLinkOnline(a->Hub->Rpc, &tt)); + } + EndDialog(hWnd, true); + } + } + + FreeRpcCreateLink(&t); + } + else + { + // NAT mode + RPC_CREATE_LINK t; + Zero(&t, sizeof(t)); + + t.ClientOption = ZeroMalloc(sizeof(CLIENT_OPTION)); + Copy(t.ClientOption, a->ClientOption, sizeof(CLIENT_OPTION)); + t.ClientAuth = CopyClientAuth(a->ClientAuth); + + if (CALL(hWnd, NcSetClientConfig(a->Rpc, &t))) + { + EndDialog(hWnd, true); + } + + FreeRpcCreateLink(&t); + } + } +} + +// Show the account editing dialog +bool CmEditAccountDlg(HWND hWnd, CM_ACCOUNT *a) +{ + // Validate arguments + if (hWnd == NULL || a == NULL) + { + return false; + } + + return Dialog(hWnd, D_CM_ACCOUNT, CmEditAccountDlgProc, a); +} + +// Edit the account +void CmEditAccount(HWND hWnd, wchar_t *account_name) +{ + CM_ACCOUNT *a; + // Validate arguments + if (hWnd == NULL || account_name == NULL) + { + return; + } + + a = CmGetExistAccountObject(hWnd, account_name); + if (a == NULL) + { + return; + } + + CmVoice("input_config"); + if (CmEditAccountDlg(hWnd, a)) + { + CmVoice("set_config"); + } + + CmFreeAccountObject(hWnd, a); +} + +// Create an account +void CmNewAccount(HWND hWnd) +{ + CM_ACCOUNT *a; + RPC_CLIENT_ENUM_VLAN t; + UINT num_vlan = 0; + // Validate arguments + if (hWnd == NULL) + { + return; + } + + if (IsEnable(hWnd, 0) == false) + { + return; + } + + Zero(&t, sizeof(t)); + if (CcEnumVLan(cm->Client, &t) == ERR_NO_ERROR) + { + num_vlan = t.NumItem; + + CiFreeClientEnumVLan(&t); + } + + if (num_vlan == 0) + { + if (MsgBox(hWnd, MB_ICONINFORMATION | MB_YESNO, _UU("CM_NO_VLAN")) == IDNO) + { + return; + } + else + { + if (cm->server_name == NULL || cm->Client->Unix) + { + Command(hWnd, CMD_NEW_VLAN); + return; + } + else + { + MsgBox(hWnd, MB_ICONINFORMATION, _UU("CM_VLAN_REMOTE_ERROR")); + } + return; + } + } + + a = CmCreateNewAccountObject(hWnd); + if (a == NULL) + { + return; + } + + CmVoice("input_config"); + if (CmEditAccountDlg(hWnd, a)) + { + CmVoice("new_config"); + } + + CmFreeAccountObject(hWnd, a); +} + +// Release the account object +void CmFreeAccountObject(HWND hWnd, CM_ACCOUNT *a) +{ + // Validate arguments + if (hWnd == NULL || a == NULL) + { + return; + } + + Free(a->ClientOption); + CiFreeClientAuth(a->ClientAuth); + if (a->ServerCert != NULL) + { + FreeX(a->ServerCert); + } + Free(a); +} + +// Get an existing account object +CM_ACCOUNT *CmGetExistAccountObject(HWND hWnd, wchar_t *account_name) +{ + RPC_CLIENT_GET_ACCOUNT c; + CM_ACCOUNT *a; + // Validate arguments + if (hWnd == NULL) + { + return NULL; + } + + Zero(&c, sizeof(c)); + UniStrCpy(c.AccountName, sizeof(c.AccountName), account_name); + if (CALL(hWnd, CcGetAccount(cm->Client, &c)) == false) + { + return NULL; + } + + a = ZeroMalloc(sizeof(CM_ACCOUNT)); + a->EditMode = true; + a->CheckServerCert = c.CheckServerCert; + a->RetryOnServerCert = c.RetryOnServerCert; + a->Startup = c.StartupAccount; + if (c.ServerCert != NULL) + { + a->ServerCert = CloneX(c.ServerCert); + } + a->ClientOption = ZeroMalloc(sizeof(CLIENT_OPTION)); + Copy(a->ClientOption, c.ClientOption, sizeof(CLIENT_OPTION)); + a->ClientAuth = CopyClientAuth(c.ClientAuth); + Copy(a->ShortcutKey, c.ShortcutKey, SHA1_SIZE); + CiFreeClientGetAccount(&c); + + a->LockMode = cm->CmSetting.LockMode; + + return a; +} + +// Create a new account object +CM_ACCOUNT *CmCreateNewAccountObject(HWND hWnd) +{ + CM_ACCOUNT *a; + // Validate arguments + if (hWnd == NULL) + { + return NULL; + } + + a = ZeroMalloc(sizeof(CM_ACCOUNT)); + a->EditMode = false; + a->CheckServerCert = false; + a->RetryOnServerCert = false; + a->Startup = false; + a->ClientOption = ZeroMalloc(sizeof(CLIENT_OPTION)); + + // Initialize the client options + CmGenerateNewAccountName(hWnd, a->ClientOption->AccountName, sizeof(a->ClientOption->AccountName)); + a->ClientOption->Port = 443; // Default port number + a->ClientOption->NumRetry = INFINITE; + a->ClientOption->RetryInterval = 15; + a->ClientOption->MaxConnection = 1; + a->ClientOption->HalfConnection = false; + a->ClientOption->UseEncrypt = true; + a->ClientOption->AdditionalConnectionInterval = 1; + + if (cm->Client->Unix) + { + a->ClientOption->NoRoutingTracking = true; + } + + a->ClientAuth = ZeroMalloc(sizeof(CLIENT_AUTH)); + + // Password authentication + a->ClientAuth->AuthType = CLIENT_AUTHTYPE_PASSWORD; + + return a; +} + +// Create an imported account name +void CmGenerateImportName(HWND hWnd, wchar_t *name, UINT size, wchar_t *old_name) +{ + UINT i; + // Validate arguments + if (name == NULL || hWnd == NULL) + { + return; + } + + for (i = 1;;i++) + { + wchar_t tmp[MAX_SIZE]; + if (i == 1) + { + UniFormat(tmp, sizeof(tmp), _UU("CM_IMPORT_NAME_1"), old_name); + } + else + { + UniFormat(tmp, sizeof(tmp), _UU("CM_IMPORT_NAME_2"), old_name, i); + } + + if (LvSearchStr(hWnd, L_ACCOUNT, 0, tmp) == INFINITE) + { + UniStrCpy(name, size, tmp); + return; + } + } +} + +// Create a copy name +void CmGenerateCopyName(HWND hWnd, wchar_t *name, UINT size, wchar_t *old_name) +{ + UINT i; + // Validate arguments + if (name == NULL || hWnd == NULL) + { + return; + } + + for (i = 1;;i++) + { + wchar_t tmp[MAX_SIZE]; + if (i == 1) + { + UniFormat(tmp, sizeof(tmp), _UU("CM_COPY_NAME_1"), old_name); + } + else + { + UniFormat(tmp, sizeof(tmp), _UU("CM_COPY_NAME_2"), i, old_name); + } + + if (LvSearchStr(hWnd, L_ACCOUNT, 0, tmp) == INFINITE) + { + UniStrCpy(name, size, tmp); + return; + } + } +} + +// Create a new account name +void CmGenerateNewAccountName(HWND hWnd, wchar_t *name, UINT size) +{ + UINT i; + // Validate arguments + if (name == NULL || hWnd == NULL) + { + return; + } + + for (i = 1;;i++) + { + wchar_t tmp[MAX_SIZE]; + if (i == 1) + { + UniFormat(tmp, sizeof(tmp), _UU("CM_NEW_ACCOUNT_NAME_1")); + } + else + { + UniFormat(tmp, sizeof(tmp), _UU("CM_NEW_ACCOUNT_NAME_2"), i); + } + + if (LvSearchStr(hWnd, L_ACCOUNT, 0, tmp) == INFINITE) + { + UniStrCpy(name, size, tmp); + return; + } + } +} + +// Show the policy list +void CmPolicyDlgPrint(HWND hWnd, CM_POLICY *p) +{ + CmPolicyDlgPrintEx(hWnd, p, false); +} +void CmPolicyDlgPrintEx(HWND hWnd, CM_POLICY *p, bool cascade_mode) +{ + CmPolicyDlgPrintEx2(hWnd, p, cascade_mode, POLICY_CURRENT_VERSION); +} +void CmPolicyDlgPrintEx2(HWND hWnd, CM_POLICY *p, bool cascade_mode, UINT ver) +{ + POLICY *pol; + UINT i; + LVB *b; + // Validate arguments + if (hWnd == NULL || p == NULL) + { + return; + } + + pol = p->Policy; + + b = LvInsertStart(); + + for (i = 0;i < NUM_POLICY_ITEM;i++) + { + wchar_t tmp[MAX_SIZE]; + + if (cascade_mode) + { + if (PolicyIsSupportedForCascade(i) == false) + { + continue; + } + } + + if (IS_POLICY_FOR_CURRENT_VER(i, ver)) + { + if (policy_item[i].TypeInt == false) + { + // bool type + UniStrCpy(tmp, sizeof(tmp), POLICY_BOOL(pol, i) ? _UU("POL_BOOL_ENABLE") : (p->Extension ? _UU("POL_BOOL_DISABLE_EX") : _UU("POL_BOOL_DISABLE"))); + } + else + { + // int type + if (policy_item[i].AllowZero && POLICY_INT(pol, i) == 0) + { + UniStrCpy(tmp, sizeof(tmp), _UU("POL_INT_ZERO")); + } + else + { + UniFormat(tmp, sizeof(tmp), _UU(policy_item[i].FormatStr), POLICY_INT(pol, i)); + } + } + + LvInsertAdd(b, ICO_MACHINE, (void *)i, 2, GetPolicyTitle(i), tmp); + } + } + + LvInsertEnd(b, hWnd, L_POLICY); +} + +// Policy list dialog box +UINT CmPolicyDlgProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param) +{ + CM_POLICY *p = (CM_POLICY *)param; + NMHDR *n; + // Validate arguments + if (hWnd == NULL) + { + return 0; + } + + switch (msg) + { + case WM_INITDIALOG: + FormatText(hWnd, 0, p->AccountName); + FormatText(hWnd, S_TITLE, p->AccountName); + p->hWnd = hWnd; + if (p->CmStatus != NULL) + { + p->CmStatus->hWndPolicy = hWnd; + } + + // Initialize the column + LvInit(hWnd, L_POLICY); + LvInsertColumn(hWnd, L_POLICY, 0, _UU("POL_TITLE_STR"), 375); + LvInsertColumn(hWnd, L_POLICY, 1, _UU("POL_VALUE_STR"), 100); + + // Display + CmPolicyDlgPrint(hWnd, p); + + // Select the first + LvSelect(hWnd, L_POLICY, 0); + break; + + case WM_COMMAND: + switch (wParam) + { + case IDOK: + case IDCANCEL: + Close(hWnd); + break; + } + break; + + case WM_NOTIFY: + n = (NMHDR *)lParam; + switch (n->idFrom) + { + case L_POLICY: + switch (n->code) + { + case LVN_ITEMCHANGED: + // Change selection + if (LvIsSelected(hWnd, L_POLICY) == false) + { + SetText(hWnd, S_DESCRIPTION, L""); + } + else + { + UINT index = LvGetSelected(hWnd, L_POLICY); + UINT id = (UINT)LvGetParam(hWnd, L_POLICY, index); + if (id < NUM_POLICY_ITEM) + { + SetText(hWnd, S_DESCRIPTION, GetPolicyDescription(id)); + } + } + break; + } + break; + } + break; + + case WM_CLOSE: + EndDialog(hWnd, 0); + break; + } + + LvSortHander(hWnd, msg, wParam, lParam, L_POLICY); + + return 0; +} + +// Show the policy list dialog +void CmPolicyDlg(HWND hWnd, CM_STATUS *st) +{ + RPC_CLIENT_GET_CONNECTION_STATUS s; + POLICY *policy; + CM_POLICY cp; + // Validate arguments + if (hWnd == NULL || st == NULL) + { + return; + } + + // Get the policy + Zero(&s, sizeof(s)); + UniStrCpy(s.AccountName, sizeof(s.AccountName), st->AccountName); + if (CALL(hWnd, CcGetAccountStatus(cm->Client, &s)) == false) + { + return; + } + if (s.Active == false) + { + return; + } + + policy = &s.Policy; + + Zero(&cp, sizeof(cp)); + UniStrCpy(cp.AccountName, sizeof(cp.AccountName), st->AccountName); + cp.Policy = policy; + cp.CmStatus = st; + + Dialog(hWnd, D_CM_POLICY, CmPolicyDlgProc, &cp); + + st->hWndPolicy = NULL; + + CiFreeClientGetConnectionStatus(&s); +} + +// Show the certificate +void CmStatusDlgPrintCert(HWND hWnd, CM_STATUS *st, bool server) +{ + RPC_CLIENT_GET_CONNECTION_STATUS s; + X *x, *issuer; + // Validate arguments + if (hWnd == NULL || st == NULL) + { + return; + } + + // Get the latest information + Zero(&s, sizeof(s)); + UniStrCpy(s.AccountName, sizeof(s.AccountName), st->AccountName); + if (CALL(hWnd, CcGetAccountStatus(cm->Client, &s)) == false) + { + Close(hWnd); + return; + } + + if (s.Active == false) + { + // Disconnect + Close(hWnd); + return; + } + + if (server == false) + { + // Show the client certificate + x = s.ClientX; + } + else + { + // Show the server certificate + x = s.ServerX; + } + + cm->WindowCount++; + issuer = CmGetIssuer(x); + CertDlg(hWnd, x, issuer, true); + FreeX(issuer); + cm->WindowCount--; + + CiFreeClientGetConnectionStatus(&s); +} + +// Show the information of the status dialog +void CmStatusDlgPrint(HWND hWnd, CM_STATUS *cmst) +{ + RPC_CLIENT_GET_CONNECTION_STATUS s; + LVB *b; + // Validate arguments + if (hWnd == NULL || cmst == NULL) + { + return; + } + + // Get the latest information + Zero(&s, sizeof(s)); + UniStrCpy(s.AccountName, sizeof(s.AccountName), cmst->AccountName); + if (CALL(hWnd, CcGetAccountStatus(cm->Client, &s)) == false) + { + Close(hWnd); + return; + } + + if (s.Active == false) + { + // Disconnect + Close(hWnd); + return; + } + + // Show the status in the list box in the status dialog + b = LvInsertStart(); + CmPrintStatusToListView(b, &s); + LvInsertEnd(b, hWnd, L_STATUS); + + LvAutoSize(hWnd, L_STATUS); + + SetEnable(hWnd, B_POLICY, s.Connected); + + SetEnable(hWnd, B_SERVER_CERT, s.ServerX != NULL); + SetEnable(hWnd, B_CLIENT_CERT, s.ClientX != NULL); + + CiFreeClientGetConnectionStatus(&s); +} + +// Show the status in the list box in the status dialog +void CmPrintStatusToListView(LVB *b, RPC_CLIENT_GET_CONNECTION_STATUS *s) +{ + CmPrintStatusToListViewEx(b, s, false); +} +void CmPrintStatusToListViewEx(LVB *b, RPC_CLIENT_GET_CONNECTION_STATUS *s, bool server_mode) +{ + wchar_t tmp[MAX_SIZE]; + char str[MAX_SIZE]; + char vv[128]; + // Validate arguments + if (b == NULL || s == NULL) + { + return; + } + + if (server_mode == false) + { + LvInsertAdd(b, 0, NULL, 2, _UU("CM_ST_ACCOUNT_NAME"), s->AccountName); + + if (s->Connected == false) + { + wchar_t *st = _UU("CM_ST_CONNECTED_FALSE"); + switch (s->SessionStatus) + { + case CLIENT_STATUS_CONNECTING: + st = _UU("CM_ST_CONNECTING"); + break; + case CLIENT_STATUS_NEGOTIATION: + st = _UU("CM_ST_NEGOTIATION"); + break; + case CLIENT_STATUS_AUTH: + st = _UU("CM_ST_AUTH"); + break; + case CLIENT_STATUS_ESTABLISHED: + st = _UU("CM_ST_ESTABLISHED"); + break; + case CLIENT_STATUS_RETRY: + st = _UU("CM_ST_RETRY"); + break; + case CLIENT_STATUS_IDLE: + st = _UU("CM_ST_IDLE"); + break; + } + LvInsertAdd(b, 0, NULL, 2, _UU("CM_ST_CONNECTED"), st); + } + else + { + LvInsertAdd(b, 0, NULL, 2, _UU("CM_ST_CONNECTED"), _UU("CM_ST_CONNECTED_TRUE")); + } + } + + if (s->Connected) + { + if (s->VLanId == 0) + { + UniStrCpy(tmp, sizeof(tmp), _UU("CM_ST_NO_VLAN")); + } + else + { + UniToStru(tmp, s->VLanId); + } + + LvInsertAdd(b, 0, NULL, 2, _UU("CM_ST_VLAN_ID"), tmp); + + if (server_mode == false) + { + StrToUni(tmp, sizeof(tmp), s->ServerName); + LvInsertAdd(b, 0, NULL, 2, _UU("CM_ST_SERVER_NAME"), tmp); + + UniFormat(tmp, sizeof(tmp), _UU("CM_ST_PORT_TCP"), s->ServerPort); + LvInsertAdd(b, 0, NULL, 2, _UU("CM_ST_SERVER_PORT"), tmp); + } + + StrToUni(tmp, sizeof(tmp), s->ServerProductName); + LvInsertAdd(b, 0, NULL, 2, _UU("CM_ST_SERVER_P_NAME"), tmp); + + UniFormat(tmp, sizeof(tmp), L"%u.%02u", s->ServerProductVer / 100, s->ServerProductVer % 100); + LvInsertAdd(b, 0, NULL, 2, _UU("CM_ST_SERVER_P_VER"), tmp); + UniFormat(tmp, sizeof(tmp), L"Build %u", s->ServerProductBuild); + LvInsertAdd(b, 0, NULL, 2, _UU("CM_ST_SERVER_P_BUILD"), tmp); + } + + GetDateTimeStrEx64(tmp, sizeof(tmp), SystemToLocal64(s->StartTime), NULL); + LvInsertAdd(b, 0, NULL, 2, _UU("CM_ST_START_TIME"), tmp); + GetDateTimeStrEx64(tmp, sizeof(tmp), SystemToLocal64(s->FirstConnectionEstablisiedTime), NULL); + /* !!! Do not correct the spelling to keep the backward protocol compatibility !!! */ + LvInsertAdd(b, 0, NULL, 2, _UU("CM_ST_FIRST_ESTAB_TIME"), s->FirstConnectionEstablisiedTime == 0 ? _UU("CM_ST_NONE") : tmp); + + if (s->Connected) + { + GetDateTimeStrEx64(tmp, sizeof(tmp), SystemToLocal64(s->CurrentConnectionEstablishTime), NULL); + LvInsertAdd(b, 0, NULL, 2, _UU("CM_ST_CURR_ESTAB_TIME"), tmp); + } + + if (server_mode == false) + { + UniFormat(tmp, sizeof(tmp), _UU("CM_ST_NUM_STR"), s->NumConnectionsEstablished); + LvInsertAdd(b, 0, NULL, 2, _UU("CM_ST_NUM_ESTABLISHED"), tmp); + } + + if (s->Connected) + { + LvInsertAdd(b, 0, NULL, 2, _UU("CM_ST_HALF_CONNECTION"), s->HalfConnection ? _UU("CM_ST_HALF_TRUE") : _UU("CM_ST_HALF_FALSE")); + + LvInsertAdd(b, 0, NULL, 2, _UU("CM_ST_QOS"), s->QoS ? _UU("CM_ST_QOS_TRUE") : _UU("CM_ST_QOS_FALSE")); + + UniFormat(tmp, sizeof(tmp), L"%u", s->NumTcpConnections); + LvInsertAdd(b, 0, NULL, 2, _UU("CM_ST_NUM_TCP"), tmp); + + if (s->HalfConnection) + { + UniFormat(tmp, sizeof(tmp), L"%u", s->NumTcpConnectionsUpload); + LvInsertAdd(b, 0, NULL, 2, _UU("CM_ST_NUM_TCP_UPLOAD"), tmp); + UniFormat(tmp, sizeof(tmp), L"%u", s->NumTcpConnectionsDownload); + LvInsertAdd(b, 0, NULL, 2, _UU("CM_ST_NUM_TCP_DOWNLOAD"), tmp); + } + + UniFormat(tmp, sizeof(tmp), L"%u", s->MaxTcpConnections); + LvInsertAdd(b, 0, NULL, 2, _UU("CM_ST_MAX_TCP"), tmp); + + if (s->UseEncrypt == false) + { + UniStrCpy(tmp, sizeof(tmp), _UU("CM_ST_USE_ENCRYPT_FALSE")); + } + else + { + if (StrLen(s->CipherName) != 0) + { + UniFormat(tmp, sizeof(tmp), _UU("CM_ST_USE_ENCRYPT_TRUE"), s->CipherName); + } + else + { + UniFormat(tmp, sizeof(tmp), _UU("CM_ST_USE_ENCRYPT_TRUE2")); + } + } + LvInsertAdd(b, 0, NULL, 2, _UU("CM_ST_USE_ENCRYPT"), tmp); + + if (s->UseCompress) + { + UINT percent = 0; + if ((s->TotalRecvSize + s->TotalSendSize) > 0) + { + percent = (UINT)((UINT64)100 - (UINT64)(s->TotalRecvSizeReal + s->TotalSendSizeReal) * (UINT64)100 / + (s->TotalRecvSize + s->TotalSendSize)); + percent = MAKESURE(percent, 0, 100); + } + + UniFormat(tmp, sizeof(tmp), _UU("CM_ST_COMPRESS_TRUE"), percent); + } + else + { + UniStrCpy(tmp, sizeof(tmp), _UU("CM_ST_COMPRESS_FALSE")); + } + LvInsertAdd(b, 0, NULL, 2, _UU("CM_ST_USE_COMPRESS"), tmp); + + if (IsEmptyStr(s->UnderlayProtocol) == false) + { + StrToUni(tmp, sizeof(tmp), s->UnderlayProtocol); + LvInsertAdd(b, 0, NULL, 2, _UU("CM_ST_UNDERLAY_PROTOCOL"), tmp); + } + + if (IsEmptyStr(s->ProtocolDetails) == false) + { + StrToUni(tmp, sizeof(tmp), s->ProtocolDetails); + LvInsertAdd(b, 0, NULL, 2, _UU("CM_ST_PROTOCOL_DETAILS"), tmp); + } + + LvInsertAdd(b, 0, NULL, 2, _UU("CM_ST_UDP_ACCEL_ENABLED"), (s->IsUdpAccelerationEnabled ? _UU("CM_ST_YES") : _UU("CM_ST_NO"))); + LvInsertAdd(b, 0, NULL, 2, _UU("CM_ST_UDP_ACCEL_USING"), (s->IsUsingUdpAcceleration ? _UU("CM_ST_YES") : _UU("CM_ST_NO"))); + + StrToUni(tmp, sizeof(tmp), s->SessionName); + LvInsertAdd(b, 0, NULL, 2, _UU("CM_ST_SESSION_NAME"), tmp); + + StrToUni(tmp, sizeof(tmp), s->ConnectionName); + if (UniStrCmpi(tmp, L"INITING") != 0) + { + LvInsertAdd(b, 0, NULL, 2, _UU("CM_ST_CONNECTION_NAME"), tmp); + } + + BinToStr(str, sizeof(str), s->SessionKey, sizeof(s->SessionKey)); + StrToUni(tmp, sizeof(tmp), str); + LvInsertAdd(b, 0, NULL, 2, _UU("CM_ST_SESSION_KEY"), tmp); + + LvInsertAdd(b, 0, NULL, 2, _UU("CM_ST_BRIDGE_MODE"), s->IsBridgeMode ? _UU("CM_ST_YES") : _UU("CM_ST_NO")); + + LvInsertAdd(b, 0, NULL, 2, _UU("CM_ST_MONITOR_MODE"), s->IsMonitorMode ? _UU("CM_ST_YES") : _UU("CM_ST_NO")); + + ToStr3(vv, sizeof(vv), s->TotalSendSize); + UniFormat(tmp, sizeof(tmp), _UU("CM_ST_SIZE_BYTE_STR"), vv); + LvInsertAdd(b, 0, NULL, 2, _UU("CM_ST_SEND_SIZE"), tmp); + + ToStr3(vv, sizeof(vv), s->TotalRecvSize); + UniFormat(tmp, sizeof(tmp), _UU("CM_ST_SIZE_BYTE_STR"), vv); + LvInsertAdd(b, 0, NULL, 2, _UU("CM_ST_RECV_SIZE"), tmp); + + ToStr3(vv, sizeof(vv), s->Traffic.Send.UnicastCount); + UniFormat(tmp, sizeof(tmp), _UU("CM_ST_NUM_PACKET_STR"), vv); + LvInsertAdd(b, 0, NULL, 2, _UU("CM_ST_SEND_UCAST_NUM"), tmp); + + ToStr3(vv, sizeof(vv), s->Traffic.Send.UnicastBytes); + UniFormat(tmp, sizeof(tmp), _UU("CM_ST_SIZE_BYTE_STR"), vv); + LvInsertAdd(b, 0, NULL, 2, _UU("CM_ST_SEND_UCAST_SIZE"), tmp); + + ToStr3(vv, sizeof(vv), s->Traffic.Send.BroadcastCount); + UniFormat(tmp, sizeof(tmp), _UU("CM_ST_NUM_PACKET_STR"), vv); + LvInsertAdd(b, 0, NULL, 2, _UU("CM_ST_SEND_BCAST_NUM"), tmp); + + ToStr3(vv, sizeof(vv), s->Traffic.Send.BroadcastBytes); + UniFormat(tmp, sizeof(tmp), _UU("CM_ST_SIZE_BYTE_STR"), vv); + LvInsertAdd(b, 0, NULL, 2, _UU("CM_ST_SEND_BCAST_SIZE"), tmp); + + ToStr3(vv, sizeof(vv), s->Traffic.Recv.UnicastCount); + UniFormat(tmp, sizeof(tmp), _UU("CM_ST_NUM_PACKET_STR"), vv); + LvInsertAdd(b, 0, NULL, 2, _UU("CM_ST_RECV_UCAST_NUM"), tmp); + + ToStr3(vv, sizeof(vv), s->Traffic.Recv.UnicastBytes); + UniFormat(tmp, sizeof(tmp), _UU("CM_ST_SIZE_BYTE_STR"), vv); + LvInsertAdd(b, 0, NULL, 2, _UU("CM_ST_RECV_UCAST_SIZE"), tmp); + + ToStr3(vv, sizeof(vv), s->Traffic.Recv.BroadcastCount); + UniFormat(tmp, sizeof(tmp), _UU("CM_ST_NUM_PACKET_STR"), vv); + LvInsertAdd(b, 0, NULL, 2, _UU("CM_ST_RECV_BCAST_NUM"), tmp); + + ToStr3(vv, sizeof(vv), s->Traffic.Recv.BroadcastBytes); + UniFormat(tmp, sizeof(tmp), _UU("CM_ST_SIZE_BYTE_STR"), vv); + LvInsertAdd(b, 0, NULL, 2, _UU("CM_ST_RECV_BCAST_SIZE"), tmp); + } +} + +// Status dialog procedure +UINT CmStatusDlgProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param) +{ + wchar_t tmp[MAX_SIZE]; + CM_STATUS *s = (CM_STATUS *)param; + // Validate arguments + if (hWnd == NULL) + { + return 0; + } + + switch (msg) + { + case WM_INITDIALOG: + SetIcon(hWnd, 0, ICO_TOWER); + UniFormat(tmp, sizeof(tmp), _UU("CM_ST_TITLE"), s->AccountName); + SetText(hWnd, 0, tmp); + FormatText(hWnd, S_TITLE, s->AccountName); + DlgFont(hWnd, S_TITLE, 0, 1); + + Add(cm->StatusWindowList, hWnd); + + SetTimer(hWnd, 1, 500, NULL); + + LvInitEx(hWnd, L_STATUS, true); + ListView_SetImageList(DlgItem(hWnd, L_STATUS), NULL, LVSIL_NORMAL); + ListView_SetImageList(DlgItem(hWnd, L_STATUS), NULL, LVSIL_SMALL); + LvInsertColumn(hWnd, L_STATUS, 0, _UU("CM_ST_COLUMN_1"), 160); + LvInsertColumn(hWnd, L_STATUS, 1, _UU("CM_ST_COLUMN_2"), 270); + + CmStatusDlgPrint(hWnd, s); + + break; + case WM_TIMER: + switch (wParam) + { + case 1: + KillTimer(hWnd, 1); + CmStatusDlgPrint(hWnd, s); + SetTimer(hWnd, 1, 500, NULL); + break; + } + break; + case WM_COMMAND: + switch (wParam) + { + case IDOK: + case IDCANCEL: + // Close + Close(hWnd); + break; + case B_POLICY: + // Show the policy + CmPolicyDlg(hWnd, s); + break; + case B_SERVER_CERT: + CmStatusDlgPrintCert(hWnd, s, true); + break; + case B_CLIENT_CERT: + CmStatusDlgPrintCert(hWnd, s, false); + break; + } + break; + case WM_CLOSE: + Delete(cm->StatusWindowList, hWnd); + if (s->hWndPolicy != NULL) + { + EndDialog(s->hWndPolicy, false); + s->hWndPolicy = NULL; + } + EndDialog(hWnd, false); + break; + } + + return 0; +} + +// Show the status dialog +void CmStatusDlg(HWND hWnd, wchar_t *account_name) +{ + CM_STATUS *s; + // Validate arguments + if (hWnd == NULL || account_name == NULL) + { + return; + } + + s = ZeroMalloc(sizeof(CM_STATUS)); + UniStrCpy(s->AccountName, sizeof(s->AccountName), account_name); + + Dialog(hWnd, D_CONNECTION_STATUS, CmStatusDlgProc, s); + + Free(s); +} + +// Show the status +void CmStatus(HWND hWnd, wchar_t *account_name) +{ + UINT i; + wchar_t tmp[MAX_SIZE]; + // Validate arguments + if (hWnd == NULL || account_name == NULL) + { + return; + } + + UniFormat(tmp, sizeof(tmp), _UU("CM_ST_TITLE"), account_name); + + for (i = 0;i < LIST_NUM(cm->StatusWindowList);i++) + { + HWND h = LIST_DATA(cm->StatusWindowList, i); + if (h != NULL) + { + wchar_t tmp2[MAX_SIZE]; + if (GetTxt(h, 0, tmp2, sizeof(tmp2))) + { + if (UniStrCmpi(tmp2, tmp) == 0) + { + SetActiveWindow(h); + return; + } + } + } + } + + CmStatusDlg(hWnd, account_name); +} + +// Delete +void CmDeleteAccount(HWND hWnd, wchar_t *account_name) +{ + RPC_CLIENT_DELETE_ACCOUNT c; + // Validate arguments + if (hWnd == NULL || account_name == NULL) + { + return; + } + Zero(&c, sizeof(c)); + UniStrCpy(c.AccountName, sizeof(c.AccountName), account_name); + + CmVoice("delete_config_1"); + if (MsgBoxEx(hWnd, MB_ICONQUESTION | MB_YESNO | MB_DEFBUTTON2, _UU("CM_DELETE_ACCOUNT_MSG"), account_name) + == IDNO) + { + return; + } + + CALL(hWnd, CcDeleteAccount(cm->Client, &c)); + CmVoice("delete_config_2"); +} + +// Disconnect +void CmDisconnect(HWND hWnd, wchar_t *account_name) +{ + RPC_CLIENT_CONNECT c; + // Validate arguments + if (hWnd == NULL || account_name == NULL) + { + return; + } + + Zero(&c, sizeof(c)); + UniStrCpy(c.AccountName, sizeof(c.AccountName), account_name); + + cm->PositiveDisconnectFlag = true; + + CALL(hWnd, CcDisconnect(cm->Client, &c)); +} + +// Show the promotional window +void SmShowPublicVpnServerHtml(HWND hWnd) +{ + char *langstr = _SS("LANGSTR"); + + if(StrCmpi(langstr, "Japanese") == 0) + { + ShowHtml(hWnd, PUBLIC_SERVER_HTML, PUBLIC_SERVER_TAG); + } + else + { + ShowHtml(hWnd, PUBLIC_SERVER_HTML_EN, PUBLIC_SERVER_TAG); + } +} + +// Connection +void CmConnect(HWND hWnd, wchar_t *account_name) +{ + RPC_CLIENT_CONNECT c; + UINT i; + // Validate arguments + if (hWnd == NULL || account_name == NULL) + { + return; + } + + if (IsEnable(hWnd, 0) == false) + { + return; + } + + if (hWnd == cm->hMainWnd) + { + if (LvNum(hWnd, L_VLAN) == 0 && cm->Client->Win9x) + { + if (MsgBox(hWnd, MB_ICONINFORMATION | MB_YESNO, _UU("CM_NO_VLAN_2")) == IDNO) + { + return; + } + else + { + if (cm->server_name == NULL || cm->Client->Unix) + { + Command(hWnd, CMD_NEW_VLAN); + return; + } + else + { + MsgBox(hWnd, MB_ICONINFORMATION, _UU("CM_VLAN_REMOTE_ERROR")); + } + return; + } + } + } + + // (If necessary) display a warning + if (CmWarningDesktop(hWnd, account_name) == false) + { + return; + } + + if (cm->server_name == NULL) + { + if (cm->BadProcessChecked == false) + { + cm->BadProcessChecked = true; + + CheckBadProcesses(hWnd); + } + } + + if (cm->server_name == NULL) + { + // Check the Windows version + RPC_WINVER winver; + wchar_t winver_msg_client[3800]; + + GetWinVer(&winver); + Zero(winver_msg_client, sizeof(winver_msg_client)); + + if (IsSupportedWinVer(&winver) == false) + { + SYSTEMTIME st; + + LocalTime(&st); + + UniFormat(winver_msg_client, sizeof(winver_msg_client), _UU("WINVER_ERROR_FORMAT"), + _UU("WINVER_ERROR_PC_LOCAL"), + winver.Title, + _UU("WINVER_ERROR_VPNCLIENT"), + SUPPORTED_WINDOWS_LIST, + _UU("WINVER_ERROR_PC_LOCAL"), + _UU("WINVER_ERROR_VPNCLIENT"), + _UU("WINVER_ERROR_VPNCLIENT"), + _UU("WINVER_ERROR_VPNCLIENT"), + st.wYear, st.wMonth); + } + + if (UniIsEmptyStr(winver_msg_client) == false) + { + OnceMsgEx(hWnd, _UU("WINVER_TITLE"), winver_msg_client, + true, ICO_WARNING, NULL); + } + } + + i = LvSearchStr(hWnd, L_ACCOUNT, 0, account_name); + if (i != INFINITE) + { + wchar_t *tmp = LvGetStr(hWnd, L_ACCOUNT, i, 2); + if (tmp != NULL) + { + wchar_t tag[MAX_SIZE]; + StrToUni(tag, sizeof(tag), PUBLIC_SERVER_NAME); + + if (UniSearchStrEx(tmp, tag, 0, false) != INFINITE) + { + SmShowPublicVpnServerHtml(hWnd); + } + + Free(tmp); + } + } + + if (cm->CheckedAndShowedAdminPackMessage == false) + { + cm->CheckedAndShowedAdminPackMessage = true; + //CmCheckAndShowAdminPackTrialVersionNoticeMessage(NULL); + } + + Zero(&c, sizeof(c)); + UniStrCpy(c.AccountName, sizeof(c.AccountName), account_name); + + CmSetForegroundProcessToCnService(); + + if (CALL(hWnd, CcConnect(cm->Client, &c))) + { + cm->ConnectStartedFlag = true; + } +} + +// Determine whether to bold the specified menu item +bool CmIsBold(UINT id) +{ + return false; +} + +// Determine whether to enable the specified menu item +bool CmIsEnabled(HWND hWnd, UINT id) +{ + UINT index; + wchar_t *name; + bool locked = false; + // Validate arguments + if (hWnd == NULL) + { + return false; + } + + locked = cm->CmSetting.LockMode; + + if (locked) + { + switch (id) + { + case CMD_NEW: + case CMD_CLONE: + case CMD_IMPORT_ACCOUNT: + case CMD_DELETE: + case CMD_OPTION: + case CMD_VOIDE_NONE: + case CMD_VOICE_NORMAL: + case CMD_VOICE_ODD: + case CMD_STARTUP: + case CMD_NOSTARTUP: + case CMD_TRAFFIC: + case CMD_MMCSS: + return false; + case CMD_NEW_VLAN: + case CMD_ENABLE_VLAN: + case CMD_DISABLE_VLAN: + case CMD_DELETE_VLAN: + case CMD_REINSTALL: + case CMD_WINNET: + if (cm->CmEasyModeSupported) + { + return false; + } + } + } + + switch (id) + { + case CMD_LANGUAGE: + return MsIsNt(); + case CMD_SHOWPORT: + case CMD_GRID: + if (cm->IconView) + { + return false; + } + return true; + case CMD_MMCSS: + if (MsIsVista() == false || IsEmptyStr(cm->server_name) == false) + { + return false; + } + if (OS_IS_SERVER(GetOsType())) + { + return false; + } + return true; + case CMD_TRAYICON: + case CMD_TRAFFIC: + return (cm->server_name == NULL); + case CMD_NETIF: + if (MsIsNt() == false) + { + return false; + } + return (cm->server_name == NULL); + case CMD_CM_SETTING: + return cm->CmSettingSupported; + case CMD_CONNECT: + case CMD_DISCONNECT: + case CMD_STATUS: + case CMD_RENAME: + case CMD_DELETE: + if (LvIsMultiMasked(hWnd, L_ACCOUNT)) + { + return false; + } + if (LvIsSelected(hWnd, L_ACCOUNT) == false) + { + return false; + } + else + { + // Determine whether the selected account is under connecting + UINT i = LvGetSelected(hWnd, L_ACCOUNT); + wchar_t *str = LvGetStr(hWnd, L_ACCOUNT, i, 1); + wchar_t *name = LvGetStr(hWnd, L_ACCOUNT, i, 0); + bool is_connected = false; + if (str != NULL) + { + if (UniStrCmpi(str, _UU("CM_ACCOUNT_ONLINE")) == 0 || UniStrCmpi(str, _UU("CM_ACCOUNT_CONNECTING")) == 0) + { + is_connected = true; + } + Free(str); + } + if (name != NULL) + { + if (UniStrCmpi(name, _UU("CM_NEW_ICON")) == 0 || UniStrCmpi(name, _UU("CM_VGC_ICON")) == 0 || UniStrCmpi(name, _UU("CM_VGC_LINK")) == 0) + { + Free(name); + return false; + } + Free(name); + } + if (id == CMD_CONNECT || id == CMD_RENAME || id == CMD_DELETE) + { + return !is_connected; + } + else + { + return is_connected; + } + } + break; + case CMD_DISCONNECT_ALL: + if (CmGetNumConnected(hWnd) == 0) + { + return false; + } + else + { + return true; + } + case CMD_SHORTCUT: + // Create a shortcut + if (cm->Client->Rpc->Sock->RemoteIP.addr[0] != 127) + { + return false; + } + case CMD_EXPORT_ACCOUNT: + if (LvIsMultiMasked(hWnd, L_ACCOUNT)) + { + return false; + } + name = LvGetSelectedStr(hWnd, L_ACCOUNT, 0); + if (name != NULL) + { + if (UniStrCmpi(name, _UU("CM_NEW_ICON")) == 0 || UniStrCmpi(name, _UU("CM_VGC_ICON")) == 0 || UniStrCmpi(name, _UU("CM_VGC_LINK")) == 0 + ) + { + Free(name); + return false; + } + Free(name); + } + return LvIsSelected(hWnd, L_ACCOUNT); + case CMD_CLONE: + if (LvIsMultiMasked(hWnd, L_ACCOUNT)) + { + return false; + } + name = LvGetSelectedStr(hWnd, L_ACCOUNT, 0); + if (name != NULL) + { + if (UniStrCmpi(name, _UU("CM_NEW_ICON")) == 0 || UniStrCmpi(name, _UU("CM_VGC_ICON")) == 0 || UniStrCmpi(name, _UU("CM_VGC_LINK")) == 0 + ) + { + Free(name); + return false; + } + Free(name); + } + return LvIsSelected(hWnd, L_ACCOUNT); + case CMD_STARTUP: + case CMD_NOSTARTUP: + name = LvGetSelectedStr(hWnd, L_ACCOUNT, 0); + if (name != NULL) + { + if (UniStrCmpi(name, _UU("CM_NEW_ICON")) == 0 || UniStrCmpi(name, _UU("CM_VGC_ICON")) == 0 || UniStrCmpi(name, _UU("CM_VGC_LINK")) == 0 + ) + { + Free(name); + return false; + } + Free(name); + } + if (LvIsMultiMasked(hWnd, L_ACCOUNT)) + { + return false; + } + if (LvIsSelected(hWnd, L_ACCOUNT) == false) + { + return false; + } + else + { + // Determine whether the selected account is a startup account + UINT i = LvGetSelected(hWnd, L_ACCOUNT); + bool is_startup = (bool)LvGetParam(hWnd, L_ACCOUNT, i); + if (id == CMD_STARTUP) + { + return !is_startup; + } + else + { + return is_startup; + } + } + break; + case CMD_NEW_VLAN: + if (cm->Client->Unix == false && cm->Client->Win9x == false) + { + if (cm->server_name != NULL) + { + return false; + } + } + if (cm->Client->Win9x) + { + if (LvNum(hWnd, L_VLAN) >= 1) + { + // You can not install two or more virtual LAN cards in Win9x + return false; + } + } + break; + case CMD_PROPERTY: + name = LvGetSelectedStr(hWnd, L_ACCOUNT, 0); + if (name != NULL) + { + if (UniStrCmpi(name, _UU("CM_NEW_ICON")) == 0 || UniStrCmpi(name, _UU("CM_VGC_ICON")) == 0 || UniStrCmpi(name, _UU("CM_VGC_LINK")) == 0) + { + Free(name); + return false; + } + Free(name); + } + if (LvIsMultiMasked(hWnd, L_ACCOUNT)) + { + return false; + } + return LvIsSelected(hWnd, L_ACCOUNT); + case CMD_DELETE_VLAN: + if (LvIsMultiMasked(hWnd, L_VLAN)) + { + return false; + } + return LvIsSelected(hWnd, L_VLAN); + case CMD_ENABLE_VLAN: + if (cm->Client->Win9x) + { + return false; + } + if (LvIsMultiMasked(hWnd, L_VLAN)) + { + return false; + } + index = LvGetSelected(hWnd, L_VLAN); + if (index == INFINITE) + { + return false; + } + else + { + wchar_t *s = LvGetStr(hWnd, L_VLAN, index, 1); + if (s != NULL) + { + if (UniStrCmpi(s, _UU("CM_VLAN_DISABLED")) == 0) + { + Free(s); + return true; + } + Free(s); + } + return false; + } + break; + case CMD_DISABLE_VLAN: + if (cm->Client->Win9x) + { + return false; + } + if (LvIsMultiMasked(hWnd, L_VLAN)) + { + return false; + } + index = LvGetSelected(hWnd, L_VLAN); + if (index == INFINITE) + { + return false; + } + else + { + wchar_t *s = LvGetStr(hWnd, L_VLAN, index, 1); + if (s != NULL) + { + if (UniStrCmpi(s, _UU("CM_VLAN_ENABLED")) == 0) + { + Free(s); + return true; + } + Free(s); + } + return false; + } + break; + case CMD_REINSTALL: + if (cm->server_name != NULL) + { + return false; + } + if (cm->Client->Win9x || cm->Client->Unix) + { + // Upgrading the virtual LAN card on a UNIX system or Win9x is unavailable + return false; + } + if (LvIsMultiMasked(hWnd, L_VLAN)) + { + return false; + } + return LvIsSelected(hWnd, L_VLAN); + case CMD_WINNET: + { + UINT os_type = GetOsInfo()->OsType; + + if (OS_IS_WINDOWS_NT(os_type) && GET_KETA(os_type, 100) >= 2) + { + if (cm->server_name != NULL) + { + return false; + } + + return true; + } + else + { + return false; + } + } + break; + case CMD_EXIT: + return cm->TrayInited; + } + return true; +} + +// Convert a VLAN device name to the display name +void CmVLanNameToPrintName(char *str, UINT size, char *name) +{ + // Validate arguments + if (str == NULL || name == NULL) + { + return; + } + + Format(str, size, VLAN_ADAPTER_NAME_TAG, name); +} + +// Convert a display name to a VLAN device name +bool CmPrintNameToVLanName(char *name, UINT size, char *str) +{ + // Validate arguments + if (name == NULL || str == NULL) + { + return false; + } + + if (StartWith(str, VLAN_ADAPTER_NAME)) + { + if (StrLen(str) < (StrLen(VLAN_ADAPTER_NAME) + 3)) + { + return false; + } + + StrCpy(name, size, str + StrLen(VLAN_ADAPTER_NAME) + 3); + + return true; + } + + if (StartWith(str, VLAN_ADAPTER_NAME_OLD)) + { + if (StrLen(str) < (StrLen(VLAN_ADAPTER_NAME_OLD) + 3)) + { + return false; + } + + StrCpy(name, size, str + StrLen(VLAN_ADAPTER_NAME_OLD) + 3); + + return true; + } + + return false; +} + +// Initialize the account list +void CmInitAccountList(HWND hWnd) +{ + CmInitAccountListEx(hWnd, false); +} +void CmInitAccountListEx(HWND hWnd, bool easy) +{ + UINT width[5]; + BUF *b; + // Validate arguments + if (hWnd == NULL) + { + return; + } + + // Read the setting + b = MsRegReadBin(REG_CURRENT_USER, CM_REG_KEY, "AccountListColumnWidth"); + if ((b != NULL) && (b->Size == sizeof(width))) + { + Copy(width, b->Buf, sizeof(width)); + } + else if ((b != NULL) && (b->Size == (sizeof(width) - sizeof(UINT)))) + { + // Migrating from previous versions + Zero(width, sizeof(width)); + Copy(width, b->Buf, sizeof(width) - sizeof(UINT)); + width[4] = width[3]; + width[3] = 0; + } + else + { + Zero(width, sizeof(width)); + } + FreeBuf(b); + + LvInitEx2(hWnd, L_ACCOUNT, false, easy); + +// LvSetStyle(hWnd, L_ACCOUNT, LVS_EX_TRACKSELECT); + + // Initialize the column + if (easy == false) + { + LvInsertColumn(hWnd, L_ACCOUNT, 0, _UU("CM_ACCOUNT_COLUMN_1"), width[0] == 0 ? 215 : width[0]); + LvInsertColumn(hWnd, L_ACCOUNT, 1, _UU("CM_ACCOUNT_COLUMN_2"), width[1] == 0 ? 80 : width[1]); + LvInsertColumn(hWnd, L_ACCOUNT, 2, _UU("CM_ACCOUNT_COLUMN_3"), width[2] == 0 ? 220 : width[2]); + LvInsertColumn(hWnd, L_ACCOUNT, 3, _UU("CM_ACCOUNT_COLUMN_3_2"), width[3] == 0 ? 90 : width[3]); + LvInsertColumn(hWnd, L_ACCOUNT, 4, _UU("CM_ACCOUNT_COLUMN_4"), (width[4] == 0 || width[4] == 250) ? 120 : width[4]); + } + else + { + LvInsertColumn(hWnd, L_ACCOUNT, 0, _UU("CM_ACCOUNT_COLUMN_1"), 345); + LvInsertColumn(hWnd, L_ACCOUNT, 1, _UU("CM_ACCOUNT_COLUMN_2"), 140); + LvInsertColumn(hWnd, L_ACCOUNT, 2, _UU("CM_ACCOUNT_COLUMN_3"), 0); + LvInsertColumn(hWnd, L_ACCOUNT, 3, _UU("CM_ACCOUNT_COLUMN_3_2"), 0); + LvInsertColumn(hWnd, L_ACCOUNT, 4, _UU("CM_ACCOUNT_COLUMN_4"), 0); + } +} + +// Release the account list +void CmSaveAccountListPos(HWND hWnd) +{ + UINT width[5]; + UINT i; + // Validate arguments + if (hWnd == NULL) + { + return; + } + + for (i = 0;i < 5;i++) + { + width[i] = LvGetColumnWidth(hWnd, L_ACCOUNT, i); + } + + MsRegWriteBin(REG_CURRENT_USER, CM_REG_KEY, "AccountListColumnWidth", width, sizeof(width)); +} + +// Initialize the VLAN list +void CmInitVLanList(HWND hWnd) +{ + UINT width[4]; + BUF *b; + // Validate arguments + if (hWnd == NULL) + { + return; + } + + // Read the setting + b = MsRegReadBin(REG_CURRENT_USER, CM_REG_KEY, "VLanListColumnWidth"); + if ((b != NULL) && (b->Size == sizeof(width))) + { + Copy(width, b->Buf, sizeof(width)); + } + else + { + Zero(width, sizeof(width)); + } + FreeBuf(b); + + LvInit(hWnd, L_VLAN); + +// LvSetStyle(hWnd, L_ACCOUNT, LVS_EX_TRACKSELECT); + + // Initialize the column + LvInsertColumn(hWnd, L_VLAN, 0, _UU("CM_VLAN_COLUMN_1"), width[0] == 0 ? 310 : width[0]); + LvInsertColumn(hWnd, L_VLAN, 1, _UU("CM_VLAN_COLUMN_2"), width[1] == 0 ? 120 : width[1]); + LvInsertColumn(hWnd, L_VLAN, 2, _UU("CM_VLAN_COLUMN_3"), width[2] == 0 ? 175 : width[2]); + LvInsertColumn(hWnd, L_VLAN, 3, _UU("CM_VLAN_COLUMN_4"), width[3] == 0 ? 120 : width[3]); +} + +// Release the VLAN list +void CmSaveVLanListPos(HWND hWnd) +{ + UINT width[4]; + UINT i; + // Validate arguments + if (hWnd == NULL) + { + return; + } + + for (i = 0;i < 4;i++) + { + width[i] = LvGetColumnWidth(hWnd, L_VLAN, i); + } + + MsRegWriteBin(REG_CURRENT_USER, CM_REG_KEY, "VLanListColumnWidth", width, sizeof(width)); +} + +// Update the account list +void CmRefreshAccountList(HWND hWnd) +{ + CmRefreshAccountListEx(hWnd, false); + CmRefreshEasy(); +} +void CmRefreshAccountListEx(HWND hWnd, bool easy) +{ + CmRefreshAccountListEx2(hWnd, easy, false); +} +void CmRefreshAccountListEx2(HWND hWnd, bool easy, bool style_changed) +{ + UINT num = 0; + RPC_CLIENT_ENUM_ACCOUNT a; + UINT num_connecting = 0, num_connected = 0; + wchar_t tmp[MAX_SIZE]; + wchar_t new_inserted_item[MAX_ACCOUNT_NAME_LEN + 1]; + bool select_new_inserted_item = true; + // Validate arguments + if (hWnd == NULL) + { + return; + } + + // Switching of icon / detail view + LvSetView(hWnd, L_ACCOUNT, cm->IconView == false || easy); + + // Show grid + if (cm->ShowGrid || easy) + { + LvSetStyle(hWnd, L_ACCOUNT, LVS_EX_GRIDLINES); + } + else + { + LvRemoveStyle(hWnd, L_ACCOUNT, LVS_EX_GRIDLINES); + } + + if (style_changed) + { + // Change the font + if (easy == false) + { + if (cm->VistaStyle) + { + SetFontMeiryo(hWnd, L_ACCOUNT, 9); + } + else + { + SetFontDefault(hWnd, L_ACCOUNT); + } + + if (cm->VistaStyle && (cm->IconView == false)) + { + LvSetStyle(hWnd, L_ACCOUNT, LVS_EX_FULLROWSELECT); + } + else + { + LvRemoveStyle(hWnd, L_ACCOUNT, LVS_EX_FULLROWSELECT); + } + } + } + + Zero(new_inserted_item, sizeof(new_inserted_item)); + + if (LvNum(hWnd, L_ACCOUNT) == 0) + { + select_new_inserted_item = false; + } + + // Enumerate the account list + if (CALL(hWnd, CcEnumAccount(cm->Client, &a))) + { + UINT i; + LVB *b = LvInsertStart(); + + if (cm->CmSetting.LockMode == false && (easy == false)) + { + // Creating a new connection + LvInsertAdd(b, ICO_NEW, NULL, 4, _UU("CM_NEW_ICON"), L"", L"", L""); + + if (cm->Client->IsVgcSupported) + { + // VPN Gate + LvInsertAdd(b, ICO_RESEARCH, NULL, 4, _UU("CM_VGC_ICON"), L"", L"", L""); + } + else if (cm->Client->ShowVgcLink) + { + // VPN Gate Link + LvInsertAdd(b, ICO_INTERNET, NULL, 4, _UU("CM_VGC_LINK"), L"", L"", L""); + } + } + + for (i = 0;i < a.NumItem;i++) + { + RPC_CLIENT_ENUM_ACCOUNT_ITEM *t = a.Items[i]; + UINT icon; + wchar_t tmp[MAX_SIZE]; + wchar_t tmp2[MAX_SIZE]; + char tmp3[MAX_SIZE]; + wchar_t tmp4[MAX_SIZE]; + IP ip; + char ip_str[MAX_SIZE]; + + // Special treatment in the case of IPv6 address + if (StrToIP6(&ip, t->ServerName) && StartWith(t->ServerName, "[") == false) + { + Format(ip_str, sizeof(ip_str), + "[%s]", t->ServerName); + } + else + { + StrCpy(ip_str, sizeof(ip_str), t->ServerName); + } + + // Determine the icon + if (t->Active == false) + { + if (t->StartupAccount == false) + { + icon = ICO_SERVER_OFFLINE; + } + else + { + icon = ICO_SERVER_OFFLINE_EX; + } + } + else + { + num++; + if (t->StartupAccount == false) + { + icon = ICO_SERVER_ONLINE; + } + else + { + icon = ICO_SERVER_ONLINE_EX; + } + } + + // Adding + if (easy == false) + { + //CmVLanNameToPrintName(tmp3, sizeof(tmp3), t->DeviceName); + StrCpy(tmp3, sizeof(tmp3), t->DeviceName); + StrToUni(tmp, sizeof(tmp), tmp3); + } + else + { + StrToUni(tmp, sizeof(tmp), t->DeviceName); + } + + if (t->Port == 0 || cm->ShowPort == false) + { + // Port number is unknown + UniFormat(tmp2, sizeof(tmp2), L"%S (%s)", ip_str, CmGetProtocolName(t->ProxyType)); + } + else + { + // Port number are also shown + UniFormat(tmp2, sizeof(tmp2), L"%S:%u (%s)", ip_str, t->Port, CmGetProtocolName(t->ProxyType)); + } + + if (LvSearchStr(hWnd, L_ACCOUNT, 0, t->AccountName) == INFINITE) + { + UniStrCpy(new_inserted_item, sizeof(new_inserted_item), t->AccountName); + } + + // Virtual HUB name + StrToUni(tmp4, sizeof(tmp4), t->HubName); + + if (easy == false) + { + LvInsertAdd(b, icon, (void *)t->StartupAccount, 5, t->AccountName, + t->Active == false ? _UU("CM_ACCOUNT_OFFLINE") : + (t->Connected ? _UU("CM_ACCOUNT_ONLINE") : _UU("CM_ACCOUNT_CONNECTING")), + tmp2, tmp4, + tmp); + } + else + { + LvInsertAdd(b, icon, (void *)t->StartupAccount, 5, t->AccountName, + t->Active == false ? _UU("CM_ACCOUNT_OFFLINE") : + (t->Connected ? _UU("CM_ACCOUNT_ONLINE") : _UU("CM_ACCOUNT_CONNECTING")), + tmp2, tmp4, + tmp); + } + + if (t->Active) + { + if (t->Connected) + { + num_connected++; + } + else + { + num_connecting++; + } + } + } + + LvInsertEnd(b, hWnd, L_ACCOUNT); + + CiFreeClientEnumAccount(&a); + + if (select_new_inserted_item) + { + if (UniStrLen(new_inserted_item) >= 1) + { + LvSelect(hWnd, L_ACCOUNT, INFINITE); + LvSelect(hWnd, L_ACCOUNT, LvSearchStr(hWnd, L_ACCOUNT, 0, new_inserted_item)); + } + } + } + + if (easy == false) + { + // For voice guidance, detect new connection and connection lost + if (cm->UpdateConnectedNumFlag == false) + { + cm->UpdateConnectedNumFlag = true; + cm->OldConnectedNum = num; + } + else + { + if (cm->OldConnectedNum != num) + { + if (cm->OldConnectedNum < num) + { + CmVoice("connect"); + } + else + { + CmVoice("disconnect"); + + if (cm->CmSetting.EasyMode && cm->PositiveDisconnectFlag == false) + { + CmShowEasy(); + } + + cm->PositiveDisconnectFlag = false; + } + cm->OldConnectedNum = num; + } + } + + if (num_connecting == 0 && num_connected == 0) + { + // There is no connecting or connected account + UniStrCpy(tmp, sizeof(tmp), _UU("CM_TRAY_NOT_CONNECTED")); + } + else if (num_connected == 0) + { + // There is only connecting account + UniFormat(tmp, sizeof(tmp), _UU("CM_TRAY_CONNECTED_1"), num_connecting); + } + else if (num_connecting == 0) + { + // There is only connected account + UniFormat(tmp, sizeof(tmp), _UU("CM_TRAY_CONNECTED_2"), num_connected); + } + else + { + // There are both + UniFormat(tmp, sizeof(tmp), _UU("CM_TRAY_CONNECTED_0"), num_connected, num_connecting); + } + + if (num_connecting == 0 && num_connected == 0) + { + cm->TrayAnimation = false; + cm->TraySpeedAnimation = false; + } + else + { + cm->TrayAnimation = true; + + if (num_connecting == 0) + { + cm->TraySpeedAnimation = false; + } + else + { + cm->TraySpeedAnimation = true; + } + } + + CmChangeTrayString(hWnd, tmp); + } + + Refresh(hWnd); + + //Updated the Jump List + CmUpdateJumpList(0); +} + +// Updating the VLAN list +void CmRefreshVLanList(HWND hWnd) +{ + CmRefreshVLanListEx(hWnd, false); +} +void CmRefreshVLanListEx(HWND hWnd, bool style_changed) +{ + RPC_CLIENT_ENUM_VLAN e; + // Validate arguments + if (hWnd == NULL) + { + return; + } + + LvSetView(hWnd, L_VLAN, cm->IconView == false); + + // Show grid + if (cm->ShowGrid) + { + LvSetStyle(hWnd, L_VLAN, LVS_EX_GRIDLINES); + } + else + { + LvRemoveStyle(hWnd, L_VLAN, LVS_EX_GRIDLINES); + } + + if (style_changed) + { + // Change the font + if (cm->VistaStyle) + { + SetFontMeiryo(hWnd, L_VLAN, 9); + } + else + { + SetFontDefault(hWnd, L_VLAN); + } + + if (cm->VistaStyle && (cm->IconView == false)) + { + LvSetStyle(hWnd, L_VLAN, LVS_EX_FULLROWSELECT); + } + else + { + LvRemoveStyle(hWnd, L_VLAN, LVS_EX_FULLROWSELECT); + } + } + + // Enumeration + Zero(&e, sizeof(e)); + if (CALL(hWnd, CcEnumVLan(cm->Client, &e))) + { + LVB *b = LvInsertStart(); + UINT i; + for (i = 0;i < e.NumItem;i++) + { + wchar_t name[MAX_SIZE]; + wchar_t mac[MAX_SIZE]; + wchar_t ver[MAX_SIZE]; + char str[MAX_SIZE]; + wchar_t *status; + RPC_CLIENT_ENUM_VLAN_ITEM *v = e.Items[i]; + + // Device name + CmVLanNameToPrintName(str, sizeof(str), v->DeviceName); + StrToUni(name, sizeof(name), str); + + // Status + status = v->Enabled ? _UU("CM_VLAN_ENABLED") : _UU("CM_VLAN_DISABLED"); + + // MAC address + StrToUni(mac, sizeof(mac), v->MacAddress); + + // Version + StrToUni(ver, sizeof(ver), v->Version); + + LvInsertAdd(b, v->Enabled ? ICO_NIC_ONLINE : ICO_NIC_OFFLINE, NULL, 4, + name, status, mac, ver); + } + LvInsertEnd(b, hWnd, L_VLAN); + + CiFreeClientEnumVLan(&e); + } +} + +// Get a protocol name string +wchar_t *CmGetProtocolName(UINT n) +{ + return GetProtocolName(n); +} + +// Display update +void CmRefresh(HWND hWnd) +{ + CmRefreshEx(hWnd, false); +} +void CmRefreshEx(HWND hWnd, bool style_changed) +{ + // Validate arguments + if (hWnd == NULL) + { + return; + } + + // Update size + CmMainWindowOnSize(hWnd); + + // Updating the VLAN list + CmRefreshVLanListEx(hWnd, style_changed); + + // Update the account list + CmRefreshAccountListEx2(hWnd, false, style_changed); + + // Update the status bar + CmRefreshStatusBar(hWnd); +} + +// Determine whether to check the specified menu item +bool CmIsChecked(UINT id) +{ + switch (id) + { + case CMD_TRAYICON: + return cm->HideTrayIcon == false; + case CMD_STATUSBAR: + return cm->HideStatusBar == false; + case CMD_VISTASTYLE: + return cm->VistaStyle; + case CMD_ICON: + return cm->IconView; + case CMD_DETAIL: + return cm->IconView == false; + case CMD_GRID: + return cm->ShowGrid; + case CMD_VOIDE_NONE: + return cm->DisableVoice; + case CMD_SHOWPORT: + return cm->ShowPort; + case CMD_VOICE_NORMAL: + if (cm->DisableVoice) + { + return false; + } + else + { + return cm->VoiceId == VOICE_SSK; + } + case CMD_VOICE_ODD: + if (cm->DisableVoice) + { + return false; + } + else + { + return cm->VoiceId == VOICE_AHO; + } + } + return false; +} + +// The menu popped-up +void CmMainWindowOnPopupMenu(HWND hWnd, HMENU hMenu, UINT pos) +{ + UINT num_menu, i, id; + // Validate arguments + if (hWnd == NULL || hMenu == NULL) + { + return; + } + + num_menu = GetMenuItemCount(hMenu); + for (i = 0;i < num_menu;i++) + { + id = GetMenuItemID(hMenu, i); + + if (id != INFINITE) + { + bool enable_flag = CmIsEnabled(hWnd, id); + bool checked_flag = CmIsChecked(id); + bool bold_flag = CmIsBold(id); + MENUITEMINFO info; + + Zero(&info, sizeof(info)); + info.cbSize = sizeof(info); + info.fMask = MIIM_STATE; + info.fState = (enable_flag ? MFS_ENABLED : MFS_DISABLED) | + (checked_flag ? MFS_CHECKED : MFS_UNCHECKED) | + (bold_flag ? MFS_DEFAULT : 0); + + if (id == CMD_ICON || id == CMD_DETAIL || id == CMD_VOIDE_NONE || + id == CMD_VOICE_NORMAL || id == CMD_VOICE_ODD) + { + info.fMask |= MIIM_FTYPE; + info.fType = MFT_RADIOCHECK; + } + + SetMenuItemInfo(hMenu, id, false, &info); + } + + if (id == CMD_RECENT) + { + HMENU sub = CmCreateRecentSubMenu(hWnd, CM_TRAY_MENU_RECENT_ID_START); + + if (sub != NULL) + { + DeleteMenu(hMenu, i, MF_BYPOSITION); + MsInsertMenu(hMenu, i, MF_BYPOSITION | MF_ENABLED | MF_POPUP | MF_STRING, + (UINT_PTR)sub, _UU("CM_TRAY_MENU_RECENT")); + } + else + { + MENUITEMINFO info; + + Zero(&info, sizeof(info)); + info.cbSize = sizeof(info); + info.fMask = MIIM_STATE; + info.fState = MFS_DISABLED; + + SetMenuItemInfo(hMenu, id, false, &info); + } + } + } +} + +// Set the main window title +wchar_t *CmGenerateMainWindowTitle() +{ + wchar_t tmp[MAX_SIZE]; + if (cm->server_name == NULL) + { + UniFormat(tmp, sizeof(tmp), L"%s", _UU("CM_TITLE")); + } + else + { + UniFormat(tmp, sizeof(tmp), L"%s - %S", _UU("CM_TITLE"), cm->server_name); + } + + return CopyUniStr(tmp); +} + +// Initialize the task tray +void CmInitTray(HWND hWnd) +{ + bool ret; + // Validate arguments + if (hWnd == NULL) + { + return; + } + + if (cm->server_name != NULL) + { + return; + } + + if (cm->TrayInited) + { + return; + } + + ret = MsShowIconOnTray(hWnd, LoadSmallIcon(CmGetTrayIconId(false, 0)), _UU("CM_TRAY_INITING"), WM_CM_TRAY_MESSAGE); + + cm->TrayInited = true; + cm->TrayAnimation = false; + cm->TraySucceed = ret; + + SetTimer(hWnd, 2, CM_TRAY_ANIMATION_INTERVAL / 4, NULL); +} + +// Change the string in the task tray +void CmChangeTrayString(HWND hWnd, wchar_t *str) +{ + // Validate arguments + if (hWnd == NULL || str == NULL) + { + return; + } + if (cm->TrayInited == false) + { + return; + } + + MsChangeIconOnTray(NULL, str); +} + +// Release the task tray +void CmFreeTray(HWND hWnd) +{ + // Validate arguments + if (hWnd == NULL) + { + return; + } + + if (cm->TrayInited == false) + { + return; + } + + MsHideIconOnTray(); + + cm->TrayInited = false; +} +void CmFreeTrayExternal(void *hWnd) +{ + CmFreeTray((HWND)hWnd); +} + +// Periodical processing to the task tray +void CmPollingTray(HWND hWnd) +{ + UINT interval; + bool ret; + // Validate arguments + if (hWnd == NULL) + { + return; + } + + if (cm->TrayInited == false) + { + return; + } + + ret = MsChangeIconOnTrayEx(LoadSmallIcon(CmGetTrayIconId(cm->TrayAnimation, cm->TrayAnimationCounter)), + NULL, NULL, NULL, NIIF_NONE, !cm->TraySucceed); + + if (cm->TraySucceed == false) + { + cm->TraySucceed = ret; + } + + cm->TrayAnimationCounter++; + + KillTimer(hWnd, 2); + interval = CM_TRAY_ANIMATION_INTERVAL / 4; + if (cm->TraySpeedAnimation) + { + interval /= 4; + } + SetTimer(hWnd, 2, interval, NULL); +} + +// Get the icon ID of the task tray for animation +UINT CmGetTrayIconId(bool animation, UINT animation_counter) +{ + if (animation == false) + { + return ICO_TRAY0; + } + else + { + switch (animation_counter % 4) + { + case 0: + return ICO_TRAY1; + + case 1: + return ICO_TRAY2; + + case 2: + return ICO_TRAY3; + + default: + return ICO_TRAY4; + } + } +} + +// Initialize the main window +void CmMainWindowOnInit(HWND hWnd) +{ + wchar_t *s; + BUF *b; + bool startup_mode = cm->StartupMode; + CM_SETTING a; + bool fake = false; + // Validate arguments + if (hWnd == NULL) + { + return; + } + + // Font settings of list + SetFontMeiryo(hWnd, L_ACCOUNT, 9); + SetFontMeiryo(hWnd, L_VLAN, 9); + + // Get the configuration of the current vpnclient + Zero(&a, sizeof(a)); + CcGetCmSetting(cm->Client, &a); + + if (a.EasyMode) + { + fake = true; + } + + InitMenuInternational(GetMenu(hWnd), "CM_MENU"); + + cm->HideStatusBar = MsRegReadInt(REG_CURRENT_USER, CM_REG_KEY, "HideStatusBar"); + cm->HideTrayIcon = MsRegReadInt(REG_CURRENT_USER, CM_REG_KEY, "HideTrayIcon"); + cm->IconView = MsRegReadInt(REG_CURRENT_USER, CM_REG_KEY, "IconView"); + cm->ShowGrid = MsRegReadInt(REG_CURRENT_USER, CM_REG_KEY, "ShowGrid"); + + if (MsRegIsValue(REG_CURRENT_USER, CM_REG_KEY, "VistaStyle")) + { + cm->VistaStyle = MsRegReadInt(REG_CURRENT_USER, CM_REG_KEY, "VistaStyle"); + } + else + { + cm->VistaStyle = MsIsVista(); + } + + if (MsRegIsValue(REG_CURRENT_USER, CM_REG_KEY, "ShowPort")) + { + cm->ShowPort = MsRegReadInt(REG_CURRENT_USER, CM_REG_KEY, "ShowPort"); + } + else + { + cm->ShowPort = false; + } + + if (MsRegIsValue(REG_CURRENT_USER, CM_REG_KEY, "DisableVoice")) + { + cm->DisableVoice = MsRegReadInt(REG_CURRENT_USER, CM_REG_KEY, "DisableVoice"); + } + else + { + cm->DisableVoice = true; + } + cm->VoiceId = MsRegReadInt(REG_CURRENT_USER, CM_REG_KEY, "VoiceId"); + + cm->StatusWindowList = NewList(NULL); + + SetIcon(hWnd, 0, ICO_VPN); + + s = CmGenerateMainWindowTitle(); + SetText(hWnd, 0, s); + Free(s); + + // Initialize the window position + b = MsRegReadBin(REG_CURRENT_USER, CM_REG_KEY, "WindowPlacement"); + if (b != NULL && b->Size == sizeof(WINDOWPLACEMENT)) + { + // Restore the window position + WINDOWPLACEMENT *p; + p = ZeroMalloc(b->Size); + Copy(p, b->Buf, b->Size); + + if (startup_mode) + { + p->showCmd = SW_SHOWMINIMIZED; + } + + if (fake) + { + Copy(&cm->FakeWindowPlacement, p, sizeof(WINDOWPLACEMENT)); + } + else + { + SetWindowPlacement(hWnd, p); + } + Free(p); + } + else + { + // Initialize the window position + SetWindowPos(hWnd, NULL, 0, 0, CM_DEFAULT_WIDTH, CM_DEFAULT_HEIGHT, SWP_NOREDRAW); + Center(hWnd); + if (startup_mode) + { + ShowWindow(hWnd, SW_SHOWMINIMIZED); + } + + if (fake) + { + WINDOWPLACEMENT p; + + Zero(&p, sizeof(p)); + p.length = sizeof(p); + GetWindowPlacement(hWnd, &p); + Copy(&cm->FakeWindowPlacement, &p, sizeof(WINDOWPLACEMENT)); + } + } + FreeBuf(b); + + if (fake) + { + SetWindowPos(hWnd, NULL, -200, -200, 100, 100, + SWP_NOREDRAW | SWP_SHOWWINDOW); + } + + // Initialize the status bar related items + cm->hMainWnd = hWnd; + cm->hStatusBar = CreateStatusWindowW(WS_CHILD | + (cm->HideStatusBar == false ? WS_VISIBLE : 0), + _UU("CM_TITLE"), + hWnd, S_STATUSBAR); + + UniStrCpy(cm->StatudBar1, sizeof(cm->StatudBar1), _UU("CM_TITLE")); + UniStrCpy(cm->StatudBar2, sizeof(cm->StatudBar2), _UU("CM_CONN_NO")); + UniFormat(cm->StatudBar3, sizeof(cm->StatudBar3), _UU("CM_PRODUCT_NAME"), CEDAR_VERSION_BUILD); + + cm->Icon2 = LoadSmallIcon(ICO_SERVER_OFFLINE); + cm->Icon3 = LoadSmallIcon(ICO_VPN); + + // Initialize the account list + CmInitAccountList(hWnd); + + // Initialize the VLAN list + CmInitVLanList(hWnd); + + // Display update + CmRefreshEx(hWnd, true); + + // Start a thread of notification client + CmInitNotifyClientThread(); + + // Timer setting + SetTimer(hWnd, 1, 128, NULL); + SetTimer(hWnd, 6, 5000, NULL); + + // Initialize the task tray + if (cm->server_name == NULL) + { + if (cm->HideTrayIcon == false) + { + CmInitTray(hWnd); + } + } + + CmVoice("start"); + + if (startup_mode || a.EasyMode) + { + SetTimer(hWnd, 3, 1, NULL); + } + + if (cm->import_file_name != NULL) + { + // Import a file specified as an argument + CmSendImportMessage(hWnd, cm->import_file_name, cm->CmSettingInitialFlag == CM_SETTING_INIT_NONE ? CM_IMPORT_FILENAME_MSG : CM_IMPORT_FILENAME_MSG_OVERWRITE); + /*if (a.LockMode == false) + { + CmImportAccountMainEx(hWnd, cm->import_file_name, cm->CmSettingInitialFlag != CM_SETTING_INIT_NONE); + } + else + { + MsgBox(cm->hEasyWnd ? cm->hEasyWnd : hWnd, MB_ICONEXCLAMATION, _UU("CM_VPN_FILE_IMPORT_NG")); + }*/ + } + + // Apply the CM_SETTING + CmApplyCmSetting(); + + cm->StartupFinished = true; +} + +// Start a thread of notification client +void CmInitNotifyClientThread() +{ + cm->NotifyClient = CcConnectNotify(cm->Client); + if (cm->NotifyClient == false) + { + Close(cm->hMainWnd); + exit(0); + } + cm->NotifyClientThread = NewThread(CmNotifyClientThread, NULL); +} + +// Notification client thread +void CmNotifyClientThread(THREAD *thread, void *param) +{ + NOTIFY_CLIENT *nc; + // Validate arguments + if (thread == NULL) + { + return; + } + + nc = cm->NotifyClient; + + // Wait for the next notification + while (cm->Halt == false) + { + if (CcWaitNotify(nc)) + { + // Send a message + PostMessage(cm->hMainWnd, WM_CM_NOTIFY, 0, 0); + } + else + { + // Disconnected + if (cm->Halt == false) + { + if (cm != NULL) + { + CmFreeTrayExternal((void *)cm->hMainWnd); + } + CncExit(); + exit(0); + } + break; + } + } +} + +// Stop the thread of the notification client +void CmFreeNotifyClientThread() +{ + cm->Halt = true; + + // Disconnect + CcStopNotify(cm->NotifyClient); + + // Wait for the termination of the thread + WaitThread(cm->NotifyClientThread, INFINITE); + + // Connection termination + CcDisconnectNotify(cm->NotifyClient); + ReleaseThread(cm->NotifyClientThread); +} + +// Resize the main window +void CmMainWindowOnSize(HWND hWnd) +{ + RECT r; + UINT client_width, client_height; + UINT status_height; + // Validate arguments + if (hWnd == NULL) + { + return; + } + + // Get the size of the client area of the main window + GetClientRect(hWnd, &r); + client_width = MAX(r.right - r.left, 0); + client_height = MAX(r.bottom - r.top, 0); + + SendMsg(hWnd, S_STATUSBAR, WM_SIZE, 0, 0); + + // Get the size of the status bar + GetWindowRect(DlgItem(hWnd, S_STATUSBAR), &r); + status_height = MAX(r.bottom - r.top, 0); + + if (cm->HideStatusBar == false) + { + client_height = MAX(client_height - status_height, 0); + } + + MoveWindow(DlgItem(hWnd, L_ACCOUNT), 0, 0, client_width, client_height * 3 / 5 - 3, true); + MoveWindow(DlgItem(hWnd, L_VLAN), 0, client_height * 3 / 5, client_width, client_height * 2 / 5, true); + + // Re-draw the status bar + CmRedrawStatusBar(hWnd); +} + +// Disconnect all accounts currently connected +void CmDisconnectAll(HWND hWnd) +{ + UINT i, num; + LIST *o; + // Validate arguments + if (hWnd == NULL) + { + return; + } + + // Display a warning + num = CmGetNumConnected(hWnd); + if (num == 0) + { + return; + } + + if (MsgBoxEx(hWnd, MB_ICONEXCLAMATION | MB_YESNO | MB_DEFBUTTON2, _UU("CM_DISCONNECT_ALL"), num) == IDNO) + { + return; + } + + cm->PositiveDisconnectFlag = true; + + // Create a list of connected items + o = NewListFast(NULL); + + num = LvNum(hWnd, L_ACCOUNT); + for (i = 0;i < num;i++) + { + wchar_t *s = LvGetStr(hWnd, L_ACCOUNT, i, 1); + if (s != NULL) + { + if (UniStrCmpi(s, _UU("CM_ACCOUNT_ONLINE")) == 0 || UniStrCmpi(s, _UU("CM_ACCOUNT_CONNECTING")) == 0) + { + Add(o, LvGetStr(hWnd, L_ACCOUNT, i, 0)); + } + Free(s); + } + } + + for (i = 0;i < LIST_NUM(o);i++) + { + wchar_t *s = LIST_DATA(o, i); + if (s != NULL) + { + CmDisconnect(hWnd, s); + Free(s); + } + } + + ReleaseList(o); +} + +// Get a number of currently connected connection settings +UINT CmGetNumConnected(HWND hWnd) +{ + UINT i, num, num_active; + // Validate arguments + if (hWnd == NULL) + { + return 0; + } + + num_active = 0; + num = LvNum(hWnd, L_ACCOUNT); + for (i = 0;i < num;i++) + { + wchar_t *s = LvGetStr(hWnd, L_ACCOUNT, i, 1); + if (s != NULL) + { + if (UniStrCmpi(s, _UU("CM_ACCOUNT_ONLINE")) == 0 || UniStrCmpi(s, _UU("CM_ACCOUNT_CONNECTING")) == 0) + { + num_active++; + } + Free(s); + } + } + + return num_active; +} + +// Update the status bar information +void CmRefreshStatusBar(HWND hWnd) +{ + UINT num_active = CmGetNumConnected(hWnd); + // Validate arguments + if (hWnd == NULL) + { + return; + } + + if (num_active == 0) + { + UniStrCpy(cm->StatudBar2, sizeof(cm->StatudBar2), _UU("CM_CONN_NO")); + cm->Icon2 = LoadSmallIcon(ICO_SERVER_OFFLINE); + } + else + { + UniFormat(cm->StatudBar2, sizeof(cm->StatudBar2), _UU("CM_NUM_CONN_COUNT"), num_active); + cm->Icon2 = LoadSmallIcon(ICO_SERVER_ONLINE); + } + + CmRedrawStatusBar(hWnd); +} + +// Re-draw the status bar +void CmRedrawStatusBar(HWND hWnd) +{ + HWND h; + RECT r; + int width; + int x1, x2, x3; + int xx[3]; + wchar_t tmp[MAX_SIZE]; + HICON icon; + // Validate arguments + if (hWnd == NULL) + { + return; + } + + h = cm->hStatusBar; + + // Get the width of the status bar + GetWindowRect(h, &r); + width = MAX(r.right - r.left, 0); + x2 = (UINT)(180.0 * GetTextScalingFactor()); + x3 = (UINT)(245.0 * GetTextScalingFactor()); + x1 = MAX(width - x2 - x3, 0); + + // Divide into three parts + xx[0] = x1; + xx[1] = x2 + x1; + xx[2] = x3 + x2 + x1; + SendMsg(h, 0, SB_SETPARTS, 3, (LPARAM)xx); + + // Set an icon + icon = (HICON)SendMsg(h, 0, SB_GETICON, 1, 0); + if (icon != cm->Icon2) + { + SendMsg(h, 0, SB_SETICON, 1, (LPARAM)cm->Icon2); + } + + icon = (HICON)SendMsg(h, 0, SB_GETICON, 2, 0); + if (icon != cm->Icon3) + { + SendMsg(h, 0, SB_SETICON, 2, (LPARAM)cm->Icon3); + } + + // Set a string + SendMsg(h, 0, SB_GETTEXTW, 0, (LPARAM)tmp); + if (UniStrCmp(tmp, cm->StatudBar1)) + { + SendMsg(h, 0, SB_SETTEXTW, 0, (LPARAM)cm->StatudBar1); + } + + SendMsg(h, 0, SB_GETTEXTW, 1, (LPARAM)tmp); + if (UniStrCmp(tmp, cm->StatudBar2)) + { + SendMsg(h, 0, SB_SETTEXTW, 1, (LPARAM)cm->StatudBar2); + } + + SendMsg(h, 0, SB_GETTEXTW, 2, (LPARAM)tmp); + if (UniStrCmp(tmp, cm->StatudBar3)) + { + SendMsg(h, 0, SB_SETTEXTW, 2, (LPARAM)cm->StatudBar3); + } +} + +// Save the position information of the main window +void CmSaveMainWindowPos(HWND hWnd) +{ + WINDOWPLACEMENT p; + // Validate arguments + if (hWnd == NULL) + { + return; + } + + // Save settings + MsRegWriteInt(REG_CURRENT_USER, CM_REG_KEY, "HideStatusBar", cm->HideStatusBar); + MsRegWriteInt(REG_CURRENT_USER, CM_REG_KEY, "HideTrayIcon", cm->HideTrayIcon); + MsRegWriteInt(REG_CURRENT_USER, CM_REG_KEY, "IconView", cm->IconView); + MsRegWriteInt(REG_CURRENT_USER, CM_REG_KEY, "ShowGrid", cm->ShowGrid); + MsRegWriteInt(REG_CURRENT_USER, CM_REG_KEY, "DisableVoice", cm->DisableVoice); + MsRegWriteInt(REG_CURRENT_USER, CM_REG_KEY, "VoiceId", cm->VoiceId); + MsRegWriteInt(REG_CURRENT_USER, CM_REG_KEY, "VistaStyle", cm->VistaStyle); + MsRegWriteInt(REG_CURRENT_USER, CM_REG_KEY, "ShowPort", cm->ShowPort); + + // Save the window position + Zero(&p, sizeof(p)); + p.length = sizeof(p); + GetWindowPlacement(hWnd, &p); + + if (IsZero(&cm->FakeWindowPlacement, sizeof(cm->FakeWindowPlacement)) == false) + { + Copy(&p, &cm->FakeWindowPlacement, sizeof(cm->FakeWindowPlacement)); + } + + MsRegWriteBin(REG_CURRENT_USER, CM_REG_KEY, "WindowPlacement", &p, sizeof(p)); + + CmSaveAccountListPos(hWnd); + CmSaveVLanListPos(hWnd); +} + +// Close the main window +void CmMainWindowOnQuit(HWND hWnd) +{ + UINT i; + // Validate arguments + if (hWnd == NULL) + { + return; + } + + if (cm->TrayInited) + { + if (MsgBox(hWnd, MB_YESNO | MB_ICONQUESTION, + _UU("CM_EXIT_MESSAGE")) == IDNO) + { + return; + } + } + + if (cm->OnCloseDispatched) + { + return; + } + cm->OnCloseDispatched = true; + + CmCloseEasy(); + + // Release the tray icon + CmFreeTray(hWnd); + + // Save the position information of the main window + CmSaveMainWindowPos(hWnd); + + // Close the status window + for (i = 0;i < LIST_NUM(cm->StatusWindowList);i++) + { + HWND h = LIST_DATA(cm->StatusWindowList, i); + //EndDialog(h, 0); + PostMessage(h, WM_CLOSE, 0, 0); + } + + ReleaseList(cm->StatusWindowList); + cm->StatusWindowList = NULL; + + if (cm->WindowCount != 0) + { + // Abort + exit(0); + } + + // Close + CmFreeNotifyClientThread(); + + EndDialog(hWnd, false); +} + +// Start the mutex to be used in starting +bool CmStartStartupMutex() +{ + INSTANCE *o = NewSingleInstance(STARTUP_MUTEX_NAME); + + if (o == NULL) + { + return false; + } + + cm->StartupMutex = o; + + return true; +} + +// Release the mutex to be used in starting +void CmEndStartupMutex() +{ + if (cm->StartupMutex != NULL) + { + FreeSingleInstance(cm->StartupMutex); + + cm->StartupMutex = NULL; + } +} + +// Main window +void MainCMWindow() +{ + HWND h; + wchar_t *s; + CM_SETTING a; + + if (CmStartStartupMutex() == false) + { + return; + } + + s = CmGenerateMainWindowTitle(); + h = SearchWindow(s); + Free(s); + + Zero(&a, sizeof(a)); + CcGetCmSetting(cm->Client, &a); + if (cm->server_name != NULL && a.EasyMode) + { + CmEndStartupMutex(); + MsgBox(NULL, MB_ICONEXCLAMATION, _UU("CM_EASY_MODE_NOT_ON_REMOTE")); + return; + } + + // Change the operating mode + if (cm->CmSettingSupported) + { + if (cm->CmSettingInitialFlag == CM_SETTING_INIT_SELECT) + { + if (h != NULL) + { + CmEndStartupMutex(); + } + + // Show the selection screen + CmSetting(NULL); + + if (h != NULL) + { + goto SEND_MESSAGES; + } + else + { + return; + } + } + else if ((cm->CmSettingInitialFlag == CM_SETTING_INIT_EASY && cm->CmEasyModeSupported) || cm->CmSettingInitialFlag == CM_SETTING_INIT_NORMAL) + { + // State transition + CM_SETTING a; + + Zero(&a, sizeof(a)); + CcGetCmSetting(cm->Client, &a); + + if (cm->CmSettingInitialFlag == CM_SETTING_INIT_EASY) + { + a.EasyMode = true; + } + else + { + a.EasyMode = false; + } + + CcSetCmSetting(cm->Client, &a); + } + } + + if (h == NULL) + { + // Create a window because there is no window of the same title + if (cm->server_name == NULL) + { + CmInitTryToExecUiHelper(); + + if (IsDebug() == false) + { + CnWaitForCnServiceReady(); + } + } + Dialog(NULL, D_CM_MAIN, CmMainWindowProc, NULL); + CmFreeTryToExecUiHelper(); + } + else + { +SEND_MESSAGES: + CmEndStartupMutex(); + + // If a window of the same title already exists, activate it and exit itself + SetForegroundWindow(h); + SendMessage(h, WM_CM_SHOW, 0, 0); + SetForegroundWindow(h); + + if (cm->CmSettingInitialFlag != CM_SETTING_INIT_NONE && cm->CmSettingInitialFlag != CM_SETTING_INIT_CONNECT) + { + // Notify since CM_SETTING has been changed + SendMessage(h, WM_CM_SETTING_CHANGED_MESSAGE, 0, 0); + } + + if (cm->import_file_name != NULL) + { + UINT msg; + if (cm->CmSettingInitialFlag == CM_SETTING_INIT_NONE) + { + msg = CM_IMPORT_FILENAME_MSG; + } + else + { + msg = CM_IMPORT_FILENAME_MSG_OVERWRITE; + } + + CmSendImportMessage(h, cm->import_file_name, msg); + } + } + + CmEndStartupMutex(); +} + +// Send an import message +void CmSendImportMessage(HWND hWnd, wchar_t *filename, UINT msg) +{ + COPYDATASTRUCT cpy; + // Validate arguments + if (hWnd == NULL || filename == NULL) + { + return; + } + + // Specify the file to be imported + Zero(&cpy, sizeof(cpy)); + + cpy.cbData = UniStrSize(filename); + cpy.lpData = filename; + cpy.dwData = msg; + + SendMessage(hWnd, WM_COPYDATA, 0, (LPARAM)&cpy); +} + +// Login dialog +UINT CmLoginDlgProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param) +{ + // Validate arguments + wchar_t server_name[MAX_SIZE]; + char password[MAX_PASSWORD_LEN + 1]; + bool bad_pass; + if (hWnd == NULL) + { + return 0; + } + + switch (msg) + { + case WM_INITDIALOG: + if (cm->server_name != NULL) + { + StrToUni(server_name, sizeof(server_name), cm->server_name); + } + else + { + UniStrCpy(server_name, sizeof(server_name), _UU("CM_PW_LOCALMACHINE")); + } + FormatText(hWnd, S_TITLE, server_name); + break; + + case WM_COMMAND: + switch (wParam) + { + case IDOK: + if (cm->server_name != NULL) + { + StrToUni(server_name, sizeof(server_name), cm->server_name); + } + else + { + UniStrCpy(server_name, sizeof(server_name), _UU("CM_PW_LOCALMACHINE")); + } + GetTxtA(hWnd, E_PASSWORD, password, sizeof(password)); + cm->Client = CcConnectRpc(cm->server_name == NULL ? "127.0.0.1" : cm->server_name, + password, &bad_pass, NULL, 0); + if (cm->Client == NULL) + { + MsgBox(hWnd, MB_ICONSTOP, _UU("CM_BAD_PASSWORD")); + FocusEx(hWnd, E_PASSWORD); + } + else + { + EndDialog(hWnd, true); + } + break; + case IDCANCEL: + Close(hWnd); + break; + } + break; + + case WM_CLOSE: + EndDialog(hWnd, false); + break; + } + + return 0; +} + +// Login +bool LoginCM() +{ + // Try to login with an empty password first + bool bad_pass, no_remote; + wchar_t server_name[MAX_SIZE]; + RPC_CLIENT_VERSION a; + +RETRY: + if (cm->server_name != NULL) + { + StrToUni(server_name, sizeof(server_name), cm->server_name); + } + else + { + UniStrCpy(server_name, sizeof(server_name), _UU("CM_PW_LOCALMACHINE")); + } + + // Attempt to connect + if ((cm->Client = CcConnectRpc( + cm->server_name == NULL ? "localhost" : cm->server_name, + cm->password == NULL ? "" : cm->password, &bad_pass, &no_remote, cm->StartupMode == false ? 0 : 60000)) == NULL) + { + if (no_remote) + { + // Remote connection was denied + if (MsgBoxEx(NULL, MB_ICONEXCLAMATION | MB_RETRYCANCEL, _UU("CM_NO_REMOTE"), server_name) == IDRETRY) + { + // Retry + goto RETRY; + } + else + { + return false; + } + } + else if (bad_pass) + { + if (Dialog(NULL, D_CM_LOGIN, CmLoginDlgProc, NULL) == false) + { + return false; + } + } + else + { + // Connection failure + if (cm->StartupMode == false && MsgBoxEx(NULL, MB_ICONEXCLAMATION | MB_RETRYCANCEL, _UU("CM_CONNECT_FAILED"), server_name) == IDRETRY) + { + // Retry + goto RETRY; + } + else + { + return false; + } + } + } + + Zero(&a, sizeof(a)); + CcGetClientVersion(cm->Client, &a); + if (a.ClientBuildInt >= 5192) + { + cm->CmSettingSupported = true; + cm->CmEasyModeSupported = true; + if (OS_IS_WINDOWS_9X(a.OsType)) + { + cm->CmEasyModeSupported = false; + } + } + + return true; +} + +// Main process +void MainCM() +{ + // If there is /remote in the argument, show the screen of the remote connection + TOKEN_LIST *cmdline = GetCommandLineToken(); + + UINT i = 0; + bool isRemote = false; + + if (cm->server_name != NULL) + { + Free(cm->server_name); + } + cm->server_name = NULL; + + if (cm->password != NULL) + { + Free(cm->password); + } + cm->password = NULL; + + for(i = 0; i < cmdline->NumTokens; ++i) + { + if (StrCmpi(cmdline->Token[i], "/remote") == 0) + { + isRemote = true; + } + else if (StrCmpi(cmdline->Token[i], "/hostname") == 0 && i + 1 < cmdline->NumTokens) + { + isRemote = true; + if (cm->server_name != NULL) + { + Free(cm->server_name); + } + cm->server_name = CopyStr(cmdline->Token[++i]); + } + else if (StrCmpi(cmdline->Token[i], "/password") == 0 && i + 1 < cmdline->NumTokens) + { + if (cm->password != NULL) + { + Free(cm->password); + } + cm->password = CopyStr(cmdline->Token[++i]); + } + else if (StrCmpi(cmdline->Token[i], "/startup") == 0) + { + // Startup mode + cm->StartupMode = true; + } + } + + if (isRemote && cm->server_name == NULL) + { + char *hostname = RemoteDlg(NULL, CM_REG_KEY, ICO_VPN, _UU("CM_TITLE"), _UU("CM_REMOTE_TITLE"), NULL); + if (hostname == NULL) + { + return; + } + if (cm->server_name != NULL) + { + Free(cm->server_name); + } + cm->server_name = NULL; + if (StrCmpi(hostname, "localhost") != 0 && StrCmpi(hostname, "127.0.0.1") != 0 ) + { + cm->server_name = hostname; + } + } + + FreeToken(cmdline); + + if (IsZero(cm->ShortcutKey, SHA1_SIZE) == false) + { + //if (MsGetCurrentTerminalSessionId() == 0) + { + // Start the shortcut connection + CmConnectShortcut(cm->ShortcutKey); + }/* + else + { + MsgBoxEx(NULL, MB_ICONEXCLAMATION, _UU("CM_SHORTCUT_DESKTOP_MSG"), + MsGetCurrentTerminalSessionId()); + }*/ + return; + } + + // Login + if (LoginCM() == false) + { + return; + } + + //Update the jump list + CmUpdateJumpList(0); + + // Main window + MainCMWindow(); + + // Log out + LogoutCM(); + + if (cm->Update != NULL) + { + FreeUpdateUi(cm->Update); + cm->Update = NULL; + } +} + +// Log out +void LogoutCM() +{ + if (cm->Client != NULL) + { + CcDisconnectRpc(cm->Client); + } +} + +// Client Connection Manager start function +void CMExec() +{ + // Initialize + InitCM(true); + + // Main process + MainCM(); + + // Release + FreeCM(); +} + +// HUB enumeration thread +void CmEnumHubThread(THREAD *t, void *param) +{ + CM_ENUM_HUB *e = (CM_ENUM_HUB *)param; + HWND hWnd; + // Validate arguments + if (t == NULL || param == NULL) + { + return; + } + + e->Thread = t; + hWnd = e->hWnd; + LockList(cm->EnumHubList); + { + Add(cm->EnumHubList, e); + } + UnlockList(cm->EnumHubList); + + // Thread initialization is completed + NoticeThreadInit(t); + + // Create a session + e->Session = NewRpcSession(cm->Cedar, e->ClientOption); + if (e->Session) + { + // Enumeration of HUB + e->Hub = EnumHub(e->Session); + + if (e->Hub != NULL) + { + // Enumeration completed + // Add to the combo box + if (CbNum(hWnd, C_HUBNAME) == 0) + { + UINT i; + wchar_t tmp[MAX_SIZE]; + for (i = 0;i < e->Hub->NumTokens;i++) + { + StrToUni(tmp, sizeof(tmp), e->Hub->Token[i]); + CbAddStr(hWnd, C_HUBNAME, tmp, 0); + } + } + + // Release the memory + FreeToken(e->Hub); + } + + // Release the session + ReleaseSession(e->Session); + } + + LockList(cm->EnumHubList); + { + Delete(cm->EnumHubList, e); + } + UnlockList(cm->EnumHubList); + + Free(e->ClientOption); + Free(e); +} + +// The start of the HUB enumeration +void CmEnumHubStart(HWND hWnd, CLIENT_OPTION *o) +{ + CM_ENUM_HUB *e; + THREAD *t; + // Validate arguments + if (hWnd == NULL || o == NULL) + { + return; + } + + if (StrLen(o->Hostname) == 0 || + o->Port == 0) + { + return; + } + + if (o->ProxyType != PROXY_DIRECT) + { + if (StrLen(o->ProxyName) == 0 || + o->ProxyPort == 0) + { + return; + } + } + + if (LvNum(hWnd, C_HUBNAME) != 0) + { + return; + } + + e = ZeroMalloc(sizeof(CM_ENUM_HUB)); + e->ClientOption = ZeroMalloc(sizeof(CLIENT_OPTION)); + e->hWnd = hWnd; + Copy(e->ClientOption, o, sizeof(CLIENT_OPTION)); + + t = NewThread(CmEnumHubThread, e); + WaitThreadInit(t); + ReleaseThread(t); +} + +// Initialize the HUB enumeration process +void CmInitEnumHub() +{ + cm->EnumHubList = NewList(NULL); +} + +// Release the HUB enumeration process +void CmFreeEnumHub() +{ + LIST *o; + UINT i; + if (cm->EnumHubList == NULL) + { + return; + } + + o = NewList(NULL); + LockList(cm->EnumHubList); + { + UINT i; + for (i = 0;i < LIST_NUM(cm->EnumHubList);i++) + { + CM_ENUM_HUB *e = LIST_DATA(cm->EnumHubList, i); + Add(o, e->Thread); + AddRef(e->Thread->ref); + } + } + UnlockList(cm->EnumHubList); + + for (i = 0;i < LIST_NUM(o);i++) + { + THREAD *t = LIST_DATA(o, i); + WaitThread(t, INFINITE); + ReleaseThread(t); + } + ReleaseList(o); + + ReleaseList(cm->EnumHubList); +} + +// Initialize the Client Connection Manager + +void InitCM(bool set_app_id) +{ + UNI_TOKEN_LIST *ut; + if (cm != NULL) + { + return; + } + + if (set_app_id) + { + if(JL_SetCurrentProcessExplicitAppUserModelID(APPID_CM) != S_OK) + { + } + } + + CmDeleteOldStartupTrayFile(); + + MsSetShutdownParameters(0x4ff, SHUTDOWN_NORETRY); + + // Memory allocation + cm = ZeroMalloc(sizeof(CM)); + + // If the command line argument is set treat it as a server name + ut = GetCommandLineUniToken(); + + if (ut->NumTokens >= 1) + { + if (UniStrLen(ut->Token[0]) != 0) + { + if (UniStrCmpi(ut->Token[0], L"cm") != 0 && ut->Token[0][0] != L'/') + { + BUF *b = UniStrToBin(ut->Token[0]); + if (b->Size == SHA1_SIZE) + { + // Treated as a shortcut key for the connection settings + Copy(cm->ShortcutKey, b->Buf, SHA1_SIZE); + } + else + { + if (UniEndWith(ut->Token[0], L".vpn") == false) + { + // Treated as a server name + cm->server_name = CopyUniToStr(ut->Token[0]); + } + else + { + // Treated as import file name + cm->import_file_name = CopyUniStr(ut->Token[0]); + } + } + FreeBuf(b); + } + else if (UniStrCmpi(ut->Token[0], L"/easy") == 0) + { + // Simple mode + if (ut->NumTokens >= 2) + { + // Connection settings to be imported is specified + cm->import_file_name = CopyUniStr(ut->Token[1]); + } + + cm->CmSettingInitialFlag = CM_SETTING_INIT_EASY; + } + else if (UniStrCmpi(ut->Token[0], L"/normal") == 0) + { + // Normal mode + if (ut->NumTokens >= 2) + { + // Connection settings to be imported is specified + cm->import_file_name = CopyUniStr(ut->Token[1]); + } + + cm->CmSettingInitialFlag = CM_SETTING_INIT_NORMAL; + } + else if (UniStrCmpi(ut->Token[0], L"/connect") == 0) + { + // Import process by the simple installer + if (ut->NumTokens >= 2) + { + // Connection settings to be imported is specified + cm->import_file_name = CopyUniStr(ut->Token[1]); + } + + cm->CmSettingInitialFlag = CM_SETTING_INIT_CONNECT; + } + else if (UniStrCmpi(ut->Token[0], L"/select") == 0) + { + // Selection screen + cm->CmSettingInitialFlag = CM_SETTING_INIT_SELECT; + } + } + } + + UniFreeToken(ut); + + InitWinUi(_UU("CM_TITLE"), _SS("DEFAULT_FONT"), _II("DEFAULT_FONT_SIZE")); + + // Alpha blending related + UseAlpha = MsRegReadInt(REG_CURRENT_USER, CM_REG_KEY, "UseAlpha"); + AlphaValue = MsRegReadInt(REG_CURRENT_USER, CM_REG_KEY, "AlphaValue"); + + cm->Cedar = NewCedar(NULL, NULL); + CmInitEnumHub(); +} + +// Stop the Client Connection Manager +void FreeCM() +{ + if (cm == NULL) + { + return; + } + + CmFreeEnumHub(); + ReleaseCedar(cm->Cedar); + + FreeWinUi(); + + // Release the memory + if (cm->server_name != NULL) + { + Free(cm->server_name); + } + Free(cm); + cm = NULL; +} + + + +////////////////////////////////////////////////////////////////////////// +//JumpList ToDo +// By Takao Ito +void *CmUpdateJumpList(UINT start_id) +{ + HMENU h = NULL; + UINT i; + RPC_CLIENT_ENUM_ACCOUNT a; + LIST *o; + bool easy; + + JL_PCustomDestinationList pcdl; + JL_PObjectCollection poc; + JL_PShellLink shell; + JL_PObjectArray poaRemoved; + + HRESULT hr; + + if (cm->server_name != NULL) + { + // Is not used in the case of an external PC + return NULL; + } + + //Try to add + if(SUCCEEDED(JL_CreateCustomDestinationList(&pcdl,APPID_CM))) + { + + JL_DeleteJumpList(pcdl,APPID_CM); + + easy = cm->CmSetting.EasyMode; + + Zero(&a, sizeof(a)); + + + if (CcEnumAccount(cm->Client, &a) == ERR_NO_ERROR) + { + o = NewListFast(CiCompareClientAccountEnumItemByLastConnectDateTime); + + for (i = 0;i < a.NumItem;i++) + { + RPC_CLIENT_ENUM_ACCOUNT_ITEM *item = a.Items[i]; + + item->tmp1 = i; + + if (item->LastConnectDateTime != 0) + { + Add(o, item); + } + } + + Sort(o); + + if(LIST_NUM(o) > 0) + { + + if(SUCCEEDED(JL_BeginList(pcdl, &poaRemoved))) + { + + + //Create a collection + if(SUCCEEDED(JL_CreateObjectCollection(&poc))) + { + + for (i = 0;i < MIN(LIST_NUM(o), CM_NUM_RECENT);i++) + { + + RPC_CLIENT_ENUM_ACCOUNT_ITEM *item = (RPC_CLIENT_ENUM_ACCOUNT_ITEM *)LIST_DATA(o, i); +// wchar_t tmp[MAX_PATH]; + wchar_t *account_name; + char *server_name; + char *hub_name; +// CM_ACCOUNT *a; + UCHAR key[SHA1_SIZE]; + RPC_CLIENT_GET_ACCOUNT c; + + + account_name = item->AccountName; + server_name = item->ServerName; + hub_name = item->HubName; + + + + // + //a = CmGetExistAccountObject(hWnd, account_name); + + + //if (a == NULL) + //{ + //continue; + //} + + //Copy(key, a->ShortcutKey, SHA1_SIZE); + // + + Zero(&c, sizeof(c)); + UniStrCpy(c.AccountName, sizeof(c.AccountName), account_name); + if (CALL(NULL, CcGetAccount(cm->Client, &c)) == false) + { + break; + } + + Copy(key, c.ShortcutKey, SHA1_SIZE); + + if (IsZero(key, SHA1_SIZE)) + { + //MsgBox(hWnd, MB_ICONINFORMATION, _UU("CM_SHORTCUT_UNSUPPORTED")); + } + else + { + + //wchar_t target[MAX_PATH]; + ////wchar_t workdir[MAX_PATH]; + //wchar_t args[MAX_PATH]; + ////wchar_t comment[MAX_SIZE]; + //wchar_t icon[MAX_PATH]; + + char key_str[64]; + wchar_t target[MAX_PATH]; + //wchar_t workdir[MAX_PATH]; + wchar_t args[MAX_PATH]; + wchar_t commentW[MAX_SIZE]; + wchar_t icon[MAX_PATH]; + int iconNum; + + //char icon = "C:\\Server.ico"; + + BinToStr(key_str, sizeof(key_str), key, SHA1_SIZE); + UniStrCpy(target, sizeof(target), MsGetExeFileNameW()); + StrToUni(args, sizeof(args), key_str); + UniStrCpy(icon, sizeof(icon), MsGetExeFileNameW()); + UniFormat(commentW, sizeof(commentW), _UU("CM_SHORTCUT_COMMENT"), account_name); + + if(item->Connected) + { + iconNum = 1; + } + else + { + iconNum = 2; + } + + hr = JL_CreateShellLink( + target, + args, + account_name, + icon,iconNum, + commentW, + &shell); + + if(SUCCEEDED(hr)) + { + + if(SUCCEEDED(JL_ObjectCollectionAddShellLink(poc, shell))) + { + //Print("Add JumpList %d c:%s\n",i, comment); + //wprintf(comment); + } + JL_ReleaseShellLink(shell); + } + } + + CiFreeClientGetAccount(&c); + } + + hr = JL_AddCategoryToList(pcdl,poc,_UU("CM_JUMPLIST_RCCONNECT"),poaRemoved); + + if(SUCCEEDED(hr)) + { + //wprintf(L"AddCategory\n"); + + hr = JL_CommitList(pcdl); + if(SUCCEEDED(hr)) + { + //wprintf(L"JumpList Commit\n"); + } + } + else + { + //wprintf(L"Erro JumpList AddCategory %x\n", hr); + } + + //Release + JL_ReleaseObjectCollection(poc); + } + } + + } + + + ReleaseList(o); + + CiFreeClientEnumAccount(&a); + } + + + + + /* + JL_BeginList(pcdl, &poaRemoved); + + JL_CreateObjectCollection(&poc); + + // Tesht + for (i = 0; i < 5; i++) + { + + JL_CreateShellLink( + "", + "", + L"Connect", + NULL,0, + NULL, + &shell); + JL_ObjectCollectionAddShellLink(poc, shell); + + JL_ReleaseShellLink(shell); + + } + + JL_AddCategoryToList(pcdl,poc,_UU("CM_JUMPLIST_RCCONNECT"),poaRemoved); + JL_CommitList(pcdl); + JL_ReleaseObjectCollection(poc); + + JL_ReleaseCustomDestinationList(pcdl); + */ + + } + + return h; +} + + + +#endif // WIN32 + + diff --git a/src/Cedar/CM.h b/src/Cedar/CM.h index f4124f30..3be0f9bc 100644 --- a/src/Cedar/CM.h +++ b/src/Cedar/CM.h @@ -1,52 +1,52 @@ -// SoftEther VPN Source Code - Developer Edition Master Branch -// Cedar Communication Module - - -// CM.h -// Header of CM.c - -#ifndef CM_H -#define CM_H - -// Constants -#define CM_REG_KEY "Software\\" GC_REG_COMPANY_NAME "\\" CEDAR_PRODUCT_STR " VPN\\Client Manager" -#define SECURE_MANAGER_KEY "Software\\" GC_REG_COMPANY_NAME "\\" CEDAR_PRODUCT_STR " VPN\\SmartCard Manager" -#define CM_TRAFFIC_REG_KEY "Software\\" GC_REG_COMPANY_NAME "\\" CEDAR_PRODUCT_STR " VPN\\Traffic Test Tool" -#define CM_VGC_REG_KEY "Software\\University of Tsukuba\\VPN Gate Client Plugin" - - -#define CM_TRY_EXEC_UI_HELPER_INTERVAL 5000 - -#define CM_DEFAULT_WIDTH 800 -#define CM_DEFAULT_HEIGHT 600 - -#define WM_CM_NOTIFY (WM_APP + 999) - -#define CM_IMPORT_FILENAME_MSG 1267 -#define CM_IMPORT_FILENAME_MSG_OVERWRITE 1268 - -#define CM_NUM_RECENT 8 - -#define PUBLIC_SERVER_HTML "http://www.softether.com/jp/special/se2hub.aspx" -#define PUBLIC_SERVER_HTML_EN "http://www.softether.com/jp/special/se2hub_en.aspx" -#define PUBLIC_SERVER_TAG L"help:no; status:no; DialogWidth:600px; dialogHeight=700px" -#define PUBLIC_SERVER_NAME "public.softether.com" - -#define VOICE_SSK 0 // ssk -#define VOICE_AHO 1 // aho - -// The code for external export - -// Structure - -// Function prototype -void CMExec(); -void CmTraffic(HWND hWnd); -void *CmStartUacHelper(); -void CmStopUacHelper(void *p); -void *CmExecUiHelperMain(); -UINT CmGetSecureBitmapId(char *dest_hostname); - -#endif // CM_H - - +// SoftEther VPN Source Code - Developer Edition Master Branch +// Cedar Communication Module + + +// CM.h +// Header of CM.c + +#ifndef CM_H +#define CM_H + +// Constants +#define CM_REG_KEY "Software\\" GC_REG_COMPANY_NAME "\\" CEDAR_PRODUCT_STR " VPN\\Client Manager" +#define SECURE_MANAGER_KEY "Software\\" GC_REG_COMPANY_NAME "\\" CEDAR_PRODUCT_STR " VPN\\SmartCard Manager" +#define CM_TRAFFIC_REG_KEY "Software\\" GC_REG_COMPANY_NAME "\\" CEDAR_PRODUCT_STR " VPN\\Traffic Test Tool" +#define CM_VGC_REG_KEY "Software\\University of Tsukuba\\VPN Gate Client Plugin" + + +#define CM_TRY_EXEC_UI_HELPER_INTERVAL 5000 + +#define CM_DEFAULT_WIDTH 800 +#define CM_DEFAULT_HEIGHT 600 + +#define WM_CM_NOTIFY (WM_APP + 999) + +#define CM_IMPORT_FILENAME_MSG 1267 +#define CM_IMPORT_FILENAME_MSG_OVERWRITE 1268 + +#define CM_NUM_RECENT 8 + +#define PUBLIC_SERVER_HTML "http://www.softether.com/jp/special/se2hub.aspx" +#define PUBLIC_SERVER_HTML_EN "http://www.softether.com/jp/special/se2hub_en.aspx" +#define PUBLIC_SERVER_TAG L"help:no; status:no; DialogWidth:600px; dialogHeight=700px" +#define PUBLIC_SERVER_NAME "public.softether.com" + +#define VOICE_SSK 0 // ssk +#define VOICE_AHO 1 // aho + +// The code for external export + +// Structure + +// Function prototype +void CMExec(); +void CmTraffic(HWND hWnd); +void *CmStartUacHelper(); +void CmStopUacHelper(void *p); +void *CmExecUiHelperMain(); +UINT CmGetSecureBitmapId(char *dest_hostname); + +#endif // CM_H + + diff --git a/src/Cedar/CMInner.h b/src/Cedar/CMInner.h index 90fec6d5..ed79356d 100644 --- a/src/Cedar/CMInner.h +++ b/src/Cedar/CMInner.h @@ -1,545 +1,545 @@ -// SoftEther VPN Source Code - Developer Edition Master Branch -// Cedar Communication Module - - -// CMInner.h -// Internal header for the CM.c - -#define STARTUP_MUTEX_NAME GC_SW_SOFTETHER_PREFIX "vpncmgr_startup_mutex" - -#define NAME_OF_VPN_CLIENT_MANAGER "vpncmgr" - -void CmVoice(char *name); - -typedef struct CM_UAC_HELPER -{ - THREAD *Thread; - volatile bool Halt; - EVENT *HaltEvent; -} CM_UAC_HELPER; - -typedef struct CM_VOICE -{ - UINT voice_id; - char *perfix; -} CM_VOICE; - -static CM_VOICE cm_voice[] = -{ - {VOICE_SSK, "ssk" }, - {VOICE_AHO, "aho" }, -}; - -typedef struct CM_ENUM_HUB -{ - HWND hWnd; - THREAD *Thread; - SESSION *Session; - CLIENT_OPTION *ClientOption; - TOKEN_LIST *Hub; -} CM_ENUM_HUB; - -#define CM_SETTING_INIT_NONE 0 -#define CM_SETTING_INIT_EASY 1 // Transition to the simple mode -#define CM_SETTING_INIT_NORMAL 2 // Transition to the normal mode -#define CM_SETTING_INIT_SELECT 3 // Show a selection screen -#define CM_SETTING_INIT_CONNECT 4 // Import process by the simple installer - -typedef struct CM -{ - HWND hMainWnd; - HWND hStatusBar; - REMOTE_CLIENT *Client; - char *server_name; - char *password; - wchar_t *import_file_name; - bool HideStatusBar; - bool HideTrayIcon; - bool ShowGrid; - bool VistaStyle; - bool ShowPort; - wchar_t StatudBar1[MAX_SIZE]; - wchar_t StatudBar2[MAX_SIZE]; - wchar_t StatudBar3[MAX_SIZE]; - HICON Icon2, Icon3; - bool IconView; - THREAD *NotifyClientThread; - NOTIFY_CLIENT *NotifyClient; - volatile bool Halt; - bool OnCloseDispatched; - LIST *StatusWindowList; - CEDAR *Cedar; - LIST *EnumHubList; - UINT WindowCount; - bool DisableVoice; - UINT VoiceId; - UINT OldConnectedNum; - bool UpdateConnectedNumFlag; - UCHAR ShortcutKey[SHA1_SIZE]; - bool TrayInited; - bool TraySucceed; - bool TrayAnimation; - bool TraySpeedAnimation; - UINT TrayAnimationCounter; - bool StartupMode; - THREAD *TryExecUiHelperThread; - volatile bool TryExecUiHelperHalt; - HANDLE TryExecUiHelperProcessHandle; - EVENT *TryExecUiHelperHaltEvent; - bool WindowsShutdowning; - bool CmSettingSupported; - bool CmEasyModeSupported; - bool CmSettingInitialFlag; - CM_SETTING CmSetting; - HWND hEasyWnd; - bool StartupFinished; - bool ConnectStartedFlag; - bool PositiveDisconnectFlag; - wchar_t EasyLastSelectedAccountName[MAX_ACCOUNT_NAME_LEN + 1]; - WINDOWPLACEMENT FakeWindowPlacement; - bool CheckedAndShowedAdminPackMessage; - INSTANCE *StartupMutex; - bool BadProcessChecked; - bool PopupMenuOpen; - WINUI_UPDATE *Update; -} CM; - -typedef struct CM_STATUS -{ - wchar_t AccountName[MAX_ACCOUNT_NAME_LEN + 1]; // Account name - HWND hWndPolicy; // Policy dialog -} CM_STATUS; - -typedef struct CM_POLICY -{ - HWND hWnd; - wchar_t AccountName[MAX_ACCOUNT_NAME_LEN + 1]; // Account name - POLICY *Policy; // Policy dialog - CM_STATUS *CmStatus; // CM_STATUS - bool Extension; // Extension -} CM_POLICY; - -typedef struct CM_ACCOUNT -{ - bool EditMode; // Edit mode (false: New mode) - bool LinkMode; // Link mode - bool NatMode; // NAT mode - CLIENT_OPTION *ClientOption; // Client option - CLIENT_AUTH *ClientAuth; // Authentication data - bool Startup; // Startup account - bool CheckServerCert; // Check the server certificate - bool RetryOnServerCert; // Retry on invalid server certificate - X *ServerCert; // Server certificate - char old_server_name[MAX_HOST_NAME_LEN + 1]; // Old server name - bool Inited; // Initialization flag - POLICY Policy; // Policy (only link mode) - struct SM_HUB *Hub; // HUB - RPC *Rpc; // RPC - bool OnlineFlag; // Online flag - bool Flag1; // Flag 1 - bool HideClientCertAuth; // Hide the client authentication - bool HideSecureAuth; // Hide the smart card authentication - bool HideTrustCert; // Hide the trusted certificate authority button - UCHAR ShortcutKey[SHA1_SIZE]; // Shortcut key - bool LockMode; // Setting lock mode - bool Link_ConnectNow; // Start the connection immediately - UINT PolicyVer; // Policy version -} CM_ACCOUNT; - -typedef struct CM_CHANGE_PASSWORD -{ - CLIENT_OPTION *ClientOption; // Client Option - char Username[MAX_USERNAME_LEN + 1]; // User name - char HubName[MAX_HUBNAME_LEN + 1]; // HUB name -} CM_CHANGE_PASSWORD; - -typedef struct CM_TRAFFIC -{ - bool ServerMode; // Server mode - bool Double; // 2x mode - bool Raw; // Raw data mode - UINT Port; // Port number - char Host[MAX_HOST_NAME_LEN + 1]; // Host name - UINT NumTcp; // Number of TCP connections - UINT Type; // Type - UINT Span; // Period -} CM_TRAFFIC; - -typedef struct CM_TRAFFIC_DLG -{ - HWND hWnd; // Window handle - CM_TRAFFIC *Setting; // Setting - TTS *Tts; // Measurement server - TTC *Ttc; // Measurement client - THREAD *HaltThread; // Thread for stopping - THREAD *ClientEndWaitThread; // Thread to wait for the client to finish - bool Started; // Started flag - bool Stopping; // Stopping - UINT RetCode; // Return value - TT_RESULT Result; // Result - EVENT *ResultShowEvent; // Display result event - bool CloseDialogAfter; // Flag of whether or not to close the dialog -} CM_TRAFFIC_DLG; - -typedef struct CM_PROXY_HTTP_HEADER_DLG -{ - CLIENT_OPTION *ClientOption; - HWND EditBox; - UINT CurrentItem; - UINT CurrentSubItem; -} CM_PROXY_HTTP_HEADER_DLG; - -// Internet connection settings -typedef struct CM_INTERNET_SETTING -{ - UINT ProxyType; // Type of proxy server - char ProxyHostName[MAX_HOST_NAME_LEN + 1]; // Proxy server host name - UINT ProxyPort; // Proxy server port number - char ProxyUsername[MAX_USERNAME_LEN + 1]; // Proxy server user name - char ProxyPassword[MAX_USERNAME_LEN + 1]; // Proxy server password -} CM_INTERNET_SETTING; - -static CM *cm = NULL; - -void CmFreeTrayExternal(void *hWnd); - -// Normal RPC call macro -__forceinline static bool CALL(HWND hWnd, UINT code) -{ - UINT ret = code; - if (ret != ERR_NO_ERROR) - { - if (ret == ERR_DISCONNECTED) - { - if (cm != NULL) - { - Close(cm->hMainWnd); - } - else - { - MsgBox(hWnd, MB_ICONSTOP, _UU("SM_DISCONNECTED")); - } - - if (cm != NULL) - { - CmFreeTrayExternal((void *)cm->hMainWnd); - } - exit(0); - } - else - { - UINT flag = MB_ICONEXCLAMATION; - if (ret == ERR_VLAN_IS_USED) - { - CmVoice("using_vlan"); - } - if (hWnd != NULL && cm != NULL && cm->hEasyWnd != NULL) - { - hWnd = cm->hEasyWnd; - } - if (hWnd != NULL && cm != NULL && hWnd == cm->hEasyWnd) - { - flag |= MB_SETFOREGROUND | MB_TOPMOST; - } - MsgBox(hWnd, flag, _E(ret)); - } - } - - if (ret == ERR_NO_ERROR) - { - return true; - } - else - { - return false; - } -} - -// Extended RPC call macro (get an error value) -__forceinline static UINT CALLEX(HWND hWnd, UINT code) -{ - UINT ret = code; - if (ret != ERR_NO_ERROR) - { - if (ret == ERR_DISCONNECTED) - { - if (cm != NULL) - { - Close(cm->hMainWnd); - } - else - { - MsgBox(hWnd, MB_ICONSTOP, _UU("SM_DISCONNECTED")); - } - if (cm != NULL) - { - CmFreeTrayExternal((void *)cm->hMainWnd); - } - exit(0); - } - } - - return ret; -} - -typedef struct CM_LOADX -{ - X *x; -} CM_LOADX; - -typedef struct CM_SETTING_DLG -{ - bool CheckPassword; - UCHAR HashedPassword[SHA1_SIZE]; -} CM_SETTING_DLG; - -typedef struct CM_EASY_DLG -{ - bool EndDialogCalled; -} CM_EASY_DLG; - - - -// Task tray related -#define WM_CM_TRAY_MESSAGE (WM_APP + 44) -#define WM_CM_SETTING_CHANGED_MESSAGE (WM_APP + 45) -#define WM_CM_EASY_REFRESH (WM_APP + 46) -#define WM_CM_SHOW (WM_APP + 47) -#define CMD_EASY_DBLCLICK 40697 -#define CMD_VGC_CONNECT 40698 -#define CM_TRAY_ANIMATION_INTERVAL 3000 -#define CM_TRAY_MAX_ITEMS 4096 -#define CM_TRAY_MENU_ID_START 12000 -#define CM_TRAY_MENU_CONNECT_ID_START (CM_TRAY_MENU_ID_START + CM_TRAY_MAX_ITEMS) -#define CM_TRAY_MENU_STATUS_ID_START (CM_TRAY_MENU_CONNECT_ID_START + CM_TRAY_MAX_ITEMS) -#define CM_TRAY_MENU_DISCONNECT_ID_START (CM_TRAY_MENU_STATUS_ID_START + CM_TRAY_MAX_ITEMS) -#define CM_TRAY_MENU_RECENT_ID_START (CM_TRAY_MENU_DISCONNECT_ID_START + CM_TRAY_MAX_ITEMS) -#define CM_TRAY_IS_CONNECT_ID(id) (((id) >= CM_TRAY_MENU_CONNECT_ID_START) && (id) < CM_TRAY_MENU_STATUS_ID_START) -#define CM_TRAY_IS_STATUS_ID(id) (((id) >= CM_TRAY_MENU_STATUS_ID_START) && (id) < CM_TRAY_MENU_DISCONNECT_ID_START) -#define CM_TRAY_IS_DISCONNECT_ID(id) (((id) >= CM_TRAY_MENU_DISCONNECT_ID_START) && (id) < (CM_TRAY_MENU_DISCONNECT_ID_START + CM_TRAY_MAX_ITEMS)) -#define CM_TRAY_IS_RECENT_ID(id) (((id) >= CM_TRAY_MENU_RECENT_ID_START) && (id) < (CM_TRAY_MENU_RECENT_ID_START + CM_TRAY_MAX_ITEMS)) - - -// Function prototype -void InitCM(bool set_app_id); -void FreeCM(); -void MainCM(); -bool LoginCM(); -void LogoutCM(); -UINT CmLoginDlgProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param); -void MainCMWindow(); -void CmSendImportMessage(HWND hWnd, wchar_t *filename, UINT msg); -UINT CmMainWindowProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param); -void CmMainWindowOnSize(HWND hWnd); -void CmMainWindowOnInit(HWND hWnd); -void CmMainWindowOnQuit(HWND hWnd); -void CmSaveMainWindowPos(HWND hWnd); -void CmMainWindowOnCommand(HWND hWnd, WPARAM wParam, LPARAM lParam); -void CmMainWindowOnCommandEx(HWND hWnd, WPARAM wParam, LPARAM lParam, bool easy); -bool CmIsEnabled(HWND hWnd, UINT id); -bool CmIsChecked(UINT id); -bool CmIsBold(UINT id); -void CmMainWindowOnPopupMenu(HWND hWnd, HMENU hMenu, UINT pos); -void CmSaveMainWindowPos(HWND hWnd); -void CmRedrawStatusBar(HWND hWnd); -void CmRefresh(HWND hWnd); -void CmRefreshEx(HWND hWnd, bool style_changed); -void CmSetForegroundProcessToCnService(); -void CmInitAccountList(HWND hWnd); -void CmInitAccountListEx(HWND hWnd, bool easy); -void CmInitVLanList(HWND hWnd); -void CmRefreshAccountList(HWND hWnd); -void CmRefreshAccountListEx(HWND hWnd, bool easy); -void CmRefreshAccountListEx2(HWND hWnd, bool easy, bool style_changed); -void CmRefreshVLanList(HWND hWnd); -void CmRefreshVLanListEx(HWND hWnd, bool style_changed); -void CmSaveAccountListPos(HWND hWnd); -void CmSaveVLanListPos(HWND hWnd); -wchar_t *CmGetProtocolName(UINT n); -void CmVLanNameToPrintName(char *str, UINT size, char *name); -bool CmPrintNameToVLanName(char *name, UINT size, char *str); -void CmMainWindowOnNotify(HWND hWnd, NMHDR *n); -void CmOnKey(HWND hWnd, bool ctrl, bool alt, UINT key); -void CmAccountListRightClick(HWND hWnd); -void CmVLanListRightClick(HWND hWnd); -void CmConnect(HWND hWnd, wchar_t *account_name); -void CmDisconnect(HWND hWnd, wchar_t *account_name); -void CmInitNotifyClientThread(); -void CmFreeNotifyClientThread(); -void CmNotifyClientThread(THREAD *thread, void *param); -void CmDeleteAccount(HWND hWnd, wchar_t *account_name); -void CmStatus(HWND hWnd, wchar_t *account_name); -void CmStatusDlg(HWND hWnd, wchar_t *account_name); -UINT CmStatusDlgProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param); -void CmStatusDlgPrint(HWND hWnd, CM_STATUS *cmst); -void CmPrintStatusToListView(LVB *b, RPC_CLIENT_GET_CONNECTION_STATUS *s); -void CmPrintStatusToListViewEx(LVB *b, RPC_CLIENT_GET_CONNECTION_STATUS *s, bool server_mode); -void CmStatusDlgPrintCert(HWND hWnd, CM_STATUS *st, bool server); -void CmPolicyDlg(HWND hWnd, CM_STATUS *st); -UINT CmPolicyDlgProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param); -void CmPolicyDlgPrint(HWND hWnd, CM_POLICY *p); -void CmPolicyDlgPrintEx(HWND hWnd, CM_POLICY *p, bool cascade_mode); -void CmPolicyDlgPrintEx2(HWND hWnd, CM_POLICY *p, bool cascade_mode, bool ver); -void CmNewAccount(HWND hWnd); -void CmEditAccount(HWND hWnd, wchar_t *account_name); -void CmGenerateNewAccountName(HWND hWnd, wchar_t *name, UINT size); -void CmGenerateCopyName(HWND hWnd, wchar_t *name, UINT size, wchar_t *old_name); -void CmGenerateImportName(HWND hWnd, wchar_t *name, UINT size, wchar_t *old_name); -CM_ACCOUNT *CmCreateNewAccountObject(HWND hWnd); -CM_ACCOUNT *CmGetExistAccountObject(HWND hWnd, wchar_t *account_name); -void CmEnumHubStart(HWND hWnd, CLIENT_OPTION *o); -void CmInitEnumHub(); -void CmFreeEnumHub(); -void CmFreeAccountObject(HWND hWnd, CM_ACCOUNT *a); -bool CmEditAccountDlg(HWND hWnd, CM_ACCOUNT *a); -UINT CmEditAccountDlgProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param); -void CmEditAccountDlgUpdate(HWND hWnd, CM_ACCOUNT *a); -void CmEditAccountDlgInit(HWND hWnd, CM_ACCOUNT *a); -void CmEditAccountDlgOnOk(HWND hWnd, CM_ACCOUNT *a); -void CmEditAccountDlgStartEnumHub(HWND hWnd, CM_ACCOUNT *a); -bool CmLoadXAndK(HWND hWnd, X **x, K **k); -bool CmLoadKEx(HWND hWnd, K **k, char *filename, UINT size); -bool CmLoadKExW(HWND hWnd, K **k, wchar_t *filename, UINT size); -bool CmLoadXFromFileOrSecureCard(HWND hWnd, X **x); -void CmLoadXFromFileOrSecureCardDlgInit(HWND hWnd, CM_LOADX *p); -void CmLoadXFromFileOrSecureCardDlgUpdate(HWND hWnd, CM_LOADX *p); -UINT CmLoadXFromFileOrSecureCardDlgProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param); -bool CmLoadX(HWND hWnd, X **x); -bool CmLoadXEx(HWND hWnd, X **x, char *filename, UINT size); -bool CmLoadXExW(HWND hWnd, X **x, wchar_t *filename, UINT size); -X *CmGetIssuer(X *x); -bool CmProxyDlg(HWND hWnd, CLIENT_OPTION *a); -void CmProxyDlgUpdate(HWND hWnd, CLIENT_OPTION *a); -UINT CmProxyDlgProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param); -bool CmDetailDlg(HWND hWnd, CM_ACCOUNT *a); -UINT CmDetailDlgProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param); -char *CmNewVLanDlg(HWND hWnd); -UINT CmNewVLanDlgProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param); -void CmCopyAccount(HWND hWnd, wchar_t *account_name); -void CmExportAccount(HWND hWnd, wchar_t *account_name); -void CmSortcut(HWND hWnd, wchar_t *account_name); -void CmImportAccount(HWND hWnd); -void CmImportAccountMain(HWND hWnd, wchar_t *filename); -void CmImportAccountMainEx(HWND hWnd, wchar_t *filename, bool overwrite); -void CmTrustDlg(HWND hWnd); -UINT CmTrustDlgProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param); -void CmTrustDlgUpdate(HWND hWnd); -void CmTrustDlgRefresh(HWND hWnd); -void CmTrustImport(HWND hWnd); -void CmTrustExport(HWND hWnd); -void CmTrustView(HWND hWnd); -void CmPassword(HWND hWnd); -UINT CmPasswordProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param); -void CmPasswordRefresh(HWND hWnd); -void CmRefreshStatusBar(HWND hWnd); -UINT CmGetNumConnected(HWND hWnd); -void CmDisconnectAll(HWND hWnd); -wchar_t *CmGenerateMainWindowTitle(); -void CmConfigDlg(HWND hWnd); -UINT CmConfigDlgProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param); -void CmConfigDlgInit(HWND hWnd); -void CmConfigDlgRefresh(HWND hWnd); -void CmConfigDlgOnOk(HWND hWnd); -bool CmWarningDesktop(HWND hWnd, wchar_t *account_name); -UINT CmDesktopDlgProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param); -void CmDesktopDlgInit(HWND hWnd, wchar_t *account_name); -bool CmStopInstallVLan(HWND hWnd); -void CmChangePassword(HWND hWnd, CLIENT_OPTION *o, char *hubname, char *username); -UINT CmChangePasswordProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param); -void CmChangePasswordUpdate(HWND hWnd, CM_CHANGE_PASSWORD *p); -void SmShowPublicVpnServerHtml(HWND hWnd); -void CmConnectShortcut(UCHAR *key); -UINT CmSelectSecure(HWND hWnd, UINT current_id); -void CmClientSecureManager(HWND hWnd); -UINT CmClientSelectSecure(HWND hWnd); -UINT CmSelectSecureDlg(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param); -void CmSelectSecureDlgInit(HWND hWnd, UINT default_id); -void CmSelectSecureDlgUpdate(HWND hWnd); -void CmSecureManager(HWND hWnd, UINT id); -void CmSecureManagerEx(HWND hWnd, UINT id, bool no_new_cert); -UINT CmSecureManagerDlg(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param); -void CmSecureManagerDlgInit(HWND hWnd, UINT id); -void CmSecureManagerDlgUpdate(HWND hWnd, UINT id); -void CmSecureManagerDlgRefresh(HWND hWnd, UINT id); -void CmSecureManagerDlgPrintList(HWND hWnd, LIST *o); -void CmSecureManagerDlgPrintListEx(HWND hWnd, UINT id, LIST *o, UINT type); -wchar_t *CmSecureObjTypeToStr(UINT type); -UINT CmSecureType(HWND hWnd); -UINT CmSecureTypeDlg(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param); -void CmSecureManagerDlgImport(HWND hWnd, UINT id); -void CmSecureManagerDlgDelete(HWND hWnd, UINT id); -void CmSecureManagerDlgExport(HWND hWnd, UINT id); -void CmSecureManagerDlgNewCert(HWND hWnd, UINT id); -void CmSecurePin(HWND hWnd, UINT id); -UINT CmSecurePinDlg(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param); -void CmSecurePinDlgUpdate(HWND hWnd); -void CmInitTray(HWND hWnd); -void CmPollingTray(HWND hWnd); -void CmFreeTray(HWND hWnd); -void CmChangeTrayString(HWND hWnd, wchar_t *str); -UINT CmGetTrayIconId(bool animation, UINT animation_counter); -void CmShowOrHideWindow(HWND hWnd); -void CmShowTrayMenu(HWND hWnd); -HMENU CmCreateTraySubMenu(HWND hWnd, bool flag, UINT start_id); -HMENU CmCreateRecentSubMenu(HWND hWnd, UINT start_id); -bool CmCheckPkcsEula(HWND hWnd, UINT id); -UINT CmPkcsEulaDlg(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param); -void CmDeleteOldStartupTrayFile(); -UINT CmTrafficDlgProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param); -void CmTrafficDlgInit(HWND hWnd); -bool CmTrafficDlgUpdate(HWND hWnd); -void CmTrafficDlgOnOk(HWND hWnd); -bool CmTrafficLoadFromReg(CM_TRAFFIC *t); -void CmTrafficGetDefaultSetting(CM_TRAFFIC *t); -void CmTrafficSaveToReg(CM_TRAFFIC *t); -void CmTrafficDlgToStruct(HWND hWnd, CM_TRAFFIC *t); -void CmExecTraffic(HWND hWnd, CM_TRAFFIC *t); -UINT CmTrafficRunDlg(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param); -void CmTrafficRunDlgInit(HWND hWnd, CM_TRAFFIC_DLG *d); -void CmTrafficRunDlgStart(HWND hWnd, CM_TRAFFIC_DLG *d); -void CmTrafficRunDlgPrintProc(void *param, wchar_t *str); -void CmTrafficRunDlgAddStr(HWND hWnd, wchar_t *str); -void CmTrafficRunDlgHalt(HWND hWnd, CM_TRAFFIC_DLG *d); -void CmTrafficRunDlgHaltThread(THREAD *t, void *param); -void CmTrafficRunDlgClientWaitThread(THREAD *t, void *param); -void CmTrafficResult(HWND hWnd, TT_RESULT *r); -UINT CmTrafficResultDlg(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param); -void CmTrafficResultDlgInit(HWND hWnd, TT_RESULT *res); -void CmTryToExecUiHelper(); -void CmInitTryToExecUiHelper(); -void CmFreeTryToExecUiHelper(); -void CmTryToExecUiHelperThread(THREAD *thread, void *param); -bool CmSetting(HWND hWnd); -UINT CmSettingDlg(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param); -void CmSettingDlgInit(HWND hWnd, CM_SETTING_DLG *d); -void CmSettingDlgUpdate(HWND hWnd, CM_SETTING_DLG *d); -void CmSettingDlgOnOk(HWND hWnd, CM_SETTING_DLG *d); -void CmApplyCmSetting(); -void CmMainWindowOnTrayClicked(HWND hWnd, WPARAM wParam, LPARAM lParam); -void CmShowEasy(); -void CmCloseEasy(); -void CmMainWindowOnShowEasy(HWND hWnd); -UINT CmEasyDlg(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param); -void CmEasyDlgInit(HWND hWnd, CM_EASY_DLG *d); -void CmEasyDlgUpdate(HWND hWnd, CM_EASY_DLG *d); -void CmEasyDlgRefresh(HWND hWnd, CM_EASY_DLG *d); -void CmRefreshEasy(); -void CmEasyDlgOnNotify(HWND hWnd, CM_EASY_DLG *d, NMHDR *n); -void CmEasyDlgOnKey(HWND hWnd, CM_EASY_DLG *d, bool ctrl, bool alt, UINT key); -void CmEasyDlgOnCommand(HWND hWnd, CM_EASY_DLG *d, WPARAM wParam, LPARAM lParam); - -bool CmStartStartupMutex(); -void CmEndStartupMutex(); -void CmSetUacWindowActive(); -void CmUacHelperThread(THREAD *thread, void *param); -void CmProxyDlgUseForIE(HWND hWnd, CLIENT_OPTION *o); -void CmGetSystemInternetSetting(CM_INTERNET_SETTING *setting); -void CmProxyDlgSet(HWND hWnd, CLIENT_OPTION *o, CM_INTERNET_SETTING *setting); -bool CmGetProxyServerNameAndPortFromIeProxyRegStr(char *name, UINT name_size, UINT *port, char *str, char *server_type); -void *CmUpdateJumpList(UINT start_id); - -void CmProxyHttpHeaderDlgUpdate(HWND hWnd); -void CmProxyHttpHeaderDlgRefresh(HWND hWnd, CM_PROXY_HTTP_HEADER_DLG *d); -void CmProxyHttpHeaderDlgInit(HWND hWnd, CM_PROXY_HTTP_HEADER_DLG *d); -UINT CmProxyHttpHeaderDlgProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param); -bool CmProxyHttpHeaderDlg(HWND hWnd, CLIENT_OPTION *a); +// SoftEther VPN Source Code - Developer Edition Master Branch +// Cedar Communication Module + + +// CMInner.h +// Internal header for the CM.c + +#define STARTUP_MUTEX_NAME GC_SW_SOFTETHER_PREFIX "vpncmgr_startup_mutex" + +#define NAME_OF_VPN_CLIENT_MANAGER "vpncmgr" + +void CmVoice(char *name); + +typedef struct CM_UAC_HELPER +{ + THREAD *Thread; + volatile bool Halt; + EVENT *HaltEvent; +} CM_UAC_HELPER; + +typedef struct CM_VOICE +{ + UINT voice_id; + char *perfix; +} CM_VOICE; + +static CM_VOICE cm_voice[] = +{ + {VOICE_SSK, "ssk" }, + {VOICE_AHO, "aho" }, +}; + +typedef struct CM_ENUM_HUB +{ + HWND hWnd; + THREAD *Thread; + SESSION *Session; + CLIENT_OPTION *ClientOption; + TOKEN_LIST *Hub; +} CM_ENUM_HUB; + +#define CM_SETTING_INIT_NONE 0 +#define CM_SETTING_INIT_EASY 1 // Transition to the simple mode +#define CM_SETTING_INIT_NORMAL 2 // Transition to the normal mode +#define CM_SETTING_INIT_SELECT 3 // Show a selection screen +#define CM_SETTING_INIT_CONNECT 4 // Import process by the simple installer + +typedef struct CM +{ + HWND hMainWnd; + HWND hStatusBar; + REMOTE_CLIENT *Client; + char *server_name; + char *password; + wchar_t *import_file_name; + bool HideStatusBar; + bool HideTrayIcon; + bool ShowGrid; + bool VistaStyle; + bool ShowPort; + wchar_t StatudBar1[MAX_SIZE]; + wchar_t StatudBar2[MAX_SIZE]; + wchar_t StatudBar3[MAX_SIZE]; + HICON Icon2, Icon3; + bool IconView; + THREAD *NotifyClientThread; + NOTIFY_CLIENT *NotifyClient; + volatile bool Halt; + bool OnCloseDispatched; + LIST *StatusWindowList; + CEDAR *Cedar; + LIST *EnumHubList; + UINT WindowCount; + bool DisableVoice; + UINT VoiceId; + UINT OldConnectedNum; + bool UpdateConnectedNumFlag; + UCHAR ShortcutKey[SHA1_SIZE]; + bool TrayInited; + bool TraySucceed; + bool TrayAnimation; + bool TraySpeedAnimation; + UINT TrayAnimationCounter; + bool StartupMode; + THREAD *TryExecUiHelperThread; + volatile bool TryExecUiHelperHalt; + HANDLE TryExecUiHelperProcessHandle; + EVENT *TryExecUiHelperHaltEvent; + bool WindowsShutdowning; + bool CmSettingSupported; + bool CmEasyModeSupported; + bool CmSettingInitialFlag; + CM_SETTING CmSetting; + HWND hEasyWnd; + bool StartupFinished; + bool ConnectStartedFlag; + bool PositiveDisconnectFlag; + wchar_t EasyLastSelectedAccountName[MAX_ACCOUNT_NAME_LEN + 1]; + WINDOWPLACEMENT FakeWindowPlacement; + bool CheckedAndShowedAdminPackMessage; + INSTANCE *StartupMutex; + bool BadProcessChecked; + bool PopupMenuOpen; + WINUI_UPDATE *Update; +} CM; + +typedef struct CM_STATUS +{ + wchar_t AccountName[MAX_ACCOUNT_NAME_LEN + 1]; // Account name + HWND hWndPolicy; // Policy dialog +} CM_STATUS; + +typedef struct CM_POLICY +{ + HWND hWnd; + wchar_t AccountName[MAX_ACCOUNT_NAME_LEN + 1]; // Account name + POLICY *Policy; // Policy dialog + CM_STATUS *CmStatus; // CM_STATUS + bool Extension; // Extension +} CM_POLICY; + +typedef struct CM_ACCOUNT +{ + bool EditMode; // Edit mode (false: New mode) + bool LinkMode; // Link mode + bool NatMode; // NAT mode + CLIENT_OPTION *ClientOption; // Client option + CLIENT_AUTH *ClientAuth; // Authentication data + bool Startup; // Startup account + bool CheckServerCert; // Check the server certificate + bool RetryOnServerCert; // Retry on invalid server certificate + X *ServerCert; // Server certificate + char old_server_name[MAX_HOST_NAME_LEN + 1]; // Old server name + bool Inited; // Initialization flag + POLICY Policy; // Policy (only link mode) + struct SM_HUB *Hub; // HUB + RPC *Rpc; // RPC + bool OnlineFlag; // Online flag + bool Flag1; // Flag 1 + bool HideClientCertAuth; // Hide the client authentication + bool HideSecureAuth; // Hide the smart card authentication + bool HideTrustCert; // Hide the trusted certificate authority button + UCHAR ShortcutKey[SHA1_SIZE]; // Shortcut key + bool LockMode; // Setting lock mode + bool Link_ConnectNow; // Start the connection immediately + UINT PolicyVer; // Policy version +} CM_ACCOUNT; + +typedef struct CM_CHANGE_PASSWORD +{ + CLIENT_OPTION *ClientOption; // Client Option + char Username[MAX_USERNAME_LEN + 1]; // User name + char HubName[MAX_HUBNAME_LEN + 1]; // HUB name +} CM_CHANGE_PASSWORD; + +typedef struct CM_TRAFFIC +{ + bool ServerMode; // Server mode + bool Double; // 2x mode + bool Raw; // Raw data mode + UINT Port; // Port number + char Host[MAX_HOST_NAME_LEN + 1]; // Host name + UINT NumTcp; // Number of TCP connections + UINT Type; // Type + UINT Span; // Period +} CM_TRAFFIC; + +typedef struct CM_TRAFFIC_DLG +{ + HWND hWnd; // Window handle + CM_TRAFFIC *Setting; // Setting + TTS *Tts; // Measurement server + TTC *Ttc; // Measurement client + THREAD *HaltThread; // Thread for stopping + THREAD *ClientEndWaitThread; // Thread to wait for the client to finish + bool Started; // Started flag + bool Stopping; // Stopping + UINT RetCode; // Return value + TT_RESULT Result; // Result + EVENT *ResultShowEvent; // Display result event + bool CloseDialogAfter; // Flag of whether or not to close the dialog +} CM_TRAFFIC_DLG; + +typedef struct CM_PROXY_HTTP_HEADER_DLG +{ + CLIENT_OPTION *ClientOption; + HWND EditBox; + UINT CurrentItem; + UINT CurrentSubItem; +} CM_PROXY_HTTP_HEADER_DLG; + +// Internet connection settings +typedef struct CM_INTERNET_SETTING +{ + UINT ProxyType; // Type of proxy server + char ProxyHostName[MAX_HOST_NAME_LEN + 1]; // Proxy server host name + UINT ProxyPort; // Proxy server port number + char ProxyUsername[MAX_USERNAME_LEN + 1]; // Proxy server user name + char ProxyPassword[MAX_USERNAME_LEN + 1]; // Proxy server password +} CM_INTERNET_SETTING; + +static CM *cm = NULL; + +void CmFreeTrayExternal(void *hWnd); + +// Normal RPC call macro +__forceinline static bool CALL(HWND hWnd, UINT code) +{ + UINT ret = code; + if (ret != ERR_NO_ERROR) + { + if (ret == ERR_DISCONNECTED) + { + if (cm != NULL) + { + Close(cm->hMainWnd); + } + else + { + MsgBox(hWnd, MB_ICONSTOP, _UU("SM_DISCONNECTED")); + } + + if (cm != NULL) + { + CmFreeTrayExternal((void *)cm->hMainWnd); + } + exit(0); + } + else + { + UINT flag = MB_ICONEXCLAMATION; + if (ret == ERR_VLAN_IS_USED) + { + CmVoice("using_vlan"); + } + if (hWnd != NULL && cm != NULL && cm->hEasyWnd != NULL) + { + hWnd = cm->hEasyWnd; + } + if (hWnd != NULL && cm != NULL && hWnd == cm->hEasyWnd) + { + flag |= MB_SETFOREGROUND | MB_TOPMOST; + } + MsgBox(hWnd, flag, _E(ret)); + } + } + + if (ret == ERR_NO_ERROR) + { + return true; + } + else + { + return false; + } +} + +// Extended RPC call macro (get an error value) +__forceinline static UINT CALLEX(HWND hWnd, UINT code) +{ + UINT ret = code; + if (ret != ERR_NO_ERROR) + { + if (ret == ERR_DISCONNECTED) + { + if (cm != NULL) + { + Close(cm->hMainWnd); + } + else + { + MsgBox(hWnd, MB_ICONSTOP, _UU("SM_DISCONNECTED")); + } + if (cm != NULL) + { + CmFreeTrayExternal((void *)cm->hMainWnd); + } + exit(0); + } + } + + return ret; +} + +typedef struct CM_LOADX +{ + X *x; +} CM_LOADX; + +typedef struct CM_SETTING_DLG +{ + bool CheckPassword; + UCHAR HashedPassword[SHA1_SIZE]; +} CM_SETTING_DLG; + +typedef struct CM_EASY_DLG +{ + bool EndDialogCalled; +} CM_EASY_DLG; + + + +// Task tray related +#define WM_CM_TRAY_MESSAGE (WM_APP + 44) +#define WM_CM_SETTING_CHANGED_MESSAGE (WM_APP + 45) +#define WM_CM_EASY_REFRESH (WM_APP + 46) +#define WM_CM_SHOW (WM_APP + 47) +#define CMD_EASY_DBLCLICK 40697 +#define CMD_VGC_CONNECT 40698 +#define CM_TRAY_ANIMATION_INTERVAL 3000 +#define CM_TRAY_MAX_ITEMS 4096 +#define CM_TRAY_MENU_ID_START 12000 +#define CM_TRAY_MENU_CONNECT_ID_START (CM_TRAY_MENU_ID_START + CM_TRAY_MAX_ITEMS) +#define CM_TRAY_MENU_STATUS_ID_START (CM_TRAY_MENU_CONNECT_ID_START + CM_TRAY_MAX_ITEMS) +#define CM_TRAY_MENU_DISCONNECT_ID_START (CM_TRAY_MENU_STATUS_ID_START + CM_TRAY_MAX_ITEMS) +#define CM_TRAY_MENU_RECENT_ID_START (CM_TRAY_MENU_DISCONNECT_ID_START + CM_TRAY_MAX_ITEMS) +#define CM_TRAY_IS_CONNECT_ID(id) (((id) >= CM_TRAY_MENU_CONNECT_ID_START) && (id) < CM_TRAY_MENU_STATUS_ID_START) +#define CM_TRAY_IS_STATUS_ID(id) (((id) >= CM_TRAY_MENU_STATUS_ID_START) && (id) < CM_TRAY_MENU_DISCONNECT_ID_START) +#define CM_TRAY_IS_DISCONNECT_ID(id) (((id) >= CM_TRAY_MENU_DISCONNECT_ID_START) && (id) < (CM_TRAY_MENU_DISCONNECT_ID_START + CM_TRAY_MAX_ITEMS)) +#define CM_TRAY_IS_RECENT_ID(id) (((id) >= CM_TRAY_MENU_RECENT_ID_START) && (id) < (CM_TRAY_MENU_RECENT_ID_START + CM_TRAY_MAX_ITEMS)) + + +// Function prototype +void InitCM(bool set_app_id); +void FreeCM(); +void MainCM(); +bool LoginCM(); +void LogoutCM(); +UINT CmLoginDlgProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param); +void MainCMWindow(); +void CmSendImportMessage(HWND hWnd, wchar_t *filename, UINT msg); +UINT CmMainWindowProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param); +void CmMainWindowOnSize(HWND hWnd); +void CmMainWindowOnInit(HWND hWnd); +void CmMainWindowOnQuit(HWND hWnd); +void CmSaveMainWindowPos(HWND hWnd); +void CmMainWindowOnCommand(HWND hWnd, WPARAM wParam, LPARAM lParam); +void CmMainWindowOnCommandEx(HWND hWnd, WPARAM wParam, LPARAM lParam, bool easy); +bool CmIsEnabled(HWND hWnd, UINT id); +bool CmIsChecked(UINT id); +bool CmIsBold(UINT id); +void CmMainWindowOnPopupMenu(HWND hWnd, HMENU hMenu, UINT pos); +void CmSaveMainWindowPos(HWND hWnd); +void CmRedrawStatusBar(HWND hWnd); +void CmRefresh(HWND hWnd); +void CmRefreshEx(HWND hWnd, bool style_changed); +void CmSetForegroundProcessToCnService(); +void CmInitAccountList(HWND hWnd); +void CmInitAccountListEx(HWND hWnd, bool easy); +void CmInitVLanList(HWND hWnd); +void CmRefreshAccountList(HWND hWnd); +void CmRefreshAccountListEx(HWND hWnd, bool easy); +void CmRefreshAccountListEx2(HWND hWnd, bool easy, bool style_changed); +void CmRefreshVLanList(HWND hWnd); +void CmRefreshVLanListEx(HWND hWnd, bool style_changed); +void CmSaveAccountListPos(HWND hWnd); +void CmSaveVLanListPos(HWND hWnd); +wchar_t *CmGetProtocolName(UINT n); +void CmVLanNameToPrintName(char *str, UINT size, char *name); +bool CmPrintNameToVLanName(char *name, UINT size, char *str); +void CmMainWindowOnNotify(HWND hWnd, NMHDR *n); +void CmOnKey(HWND hWnd, bool ctrl, bool alt, UINT key); +void CmAccountListRightClick(HWND hWnd); +void CmVLanListRightClick(HWND hWnd); +void CmConnect(HWND hWnd, wchar_t *account_name); +void CmDisconnect(HWND hWnd, wchar_t *account_name); +void CmInitNotifyClientThread(); +void CmFreeNotifyClientThread(); +void CmNotifyClientThread(THREAD *thread, void *param); +void CmDeleteAccount(HWND hWnd, wchar_t *account_name); +void CmStatus(HWND hWnd, wchar_t *account_name); +void CmStatusDlg(HWND hWnd, wchar_t *account_name); +UINT CmStatusDlgProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param); +void CmStatusDlgPrint(HWND hWnd, CM_STATUS *cmst); +void CmPrintStatusToListView(LVB *b, RPC_CLIENT_GET_CONNECTION_STATUS *s); +void CmPrintStatusToListViewEx(LVB *b, RPC_CLIENT_GET_CONNECTION_STATUS *s, bool server_mode); +void CmStatusDlgPrintCert(HWND hWnd, CM_STATUS *st, bool server); +void CmPolicyDlg(HWND hWnd, CM_STATUS *st); +UINT CmPolicyDlgProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param); +void CmPolicyDlgPrint(HWND hWnd, CM_POLICY *p); +void CmPolicyDlgPrintEx(HWND hWnd, CM_POLICY *p, bool cascade_mode); +void CmPolicyDlgPrintEx2(HWND hWnd, CM_POLICY *p, bool cascade_mode, bool ver); +void CmNewAccount(HWND hWnd); +void CmEditAccount(HWND hWnd, wchar_t *account_name); +void CmGenerateNewAccountName(HWND hWnd, wchar_t *name, UINT size); +void CmGenerateCopyName(HWND hWnd, wchar_t *name, UINT size, wchar_t *old_name); +void CmGenerateImportName(HWND hWnd, wchar_t *name, UINT size, wchar_t *old_name); +CM_ACCOUNT *CmCreateNewAccountObject(HWND hWnd); +CM_ACCOUNT *CmGetExistAccountObject(HWND hWnd, wchar_t *account_name); +void CmEnumHubStart(HWND hWnd, CLIENT_OPTION *o); +void CmInitEnumHub(); +void CmFreeEnumHub(); +void CmFreeAccountObject(HWND hWnd, CM_ACCOUNT *a); +bool CmEditAccountDlg(HWND hWnd, CM_ACCOUNT *a); +UINT CmEditAccountDlgProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param); +void CmEditAccountDlgUpdate(HWND hWnd, CM_ACCOUNT *a); +void CmEditAccountDlgInit(HWND hWnd, CM_ACCOUNT *a); +void CmEditAccountDlgOnOk(HWND hWnd, CM_ACCOUNT *a); +void CmEditAccountDlgStartEnumHub(HWND hWnd, CM_ACCOUNT *a); +bool CmLoadXAndK(HWND hWnd, X **x, K **k); +bool CmLoadKEx(HWND hWnd, K **k, char *filename, UINT size); +bool CmLoadKExW(HWND hWnd, K **k, wchar_t *filename, UINT size); +bool CmLoadXFromFileOrSecureCard(HWND hWnd, X **x); +void CmLoadXFromFileOrSecureCardDlgInit(HWND hWnd, CM_LOADX *p); +void CmLoadXFromFileOrSecureCardDlgUpdate(HWND hWnd, CM_LOADX *p); +UINT CmLoadXFromFileOrSecureCardDlgProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param); +bool CmLoadX(HWND hWnd, X **x); +bool CmLoadXEx(HWND hWnd, X **x, char *filename, UINT size); +bool CmLoadXExW(HWND hWnd, X **x, wchar_t *filename, UINT size); +X *CmGetIssuer(X *x); +bool CmProxyDlg(HWND hWnd, CLIENT_OPTION *a); +void CmProxyDlgUpdate(HWND hWnd, CLIENT_OPTION *a); +UINT CmProxyDlgProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param); +bool CmDetailDlg(HWND hWnd, CM_ACCOUNT *a); +UINT CmDetailDlgProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param); +char *CmNewVLanDlg(HWND hWnd); +UINT CmNewVLanDlgProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param); +void CmCopyAccount(HWND hWnd, wchar_t *account_name); +void CmExportAccount(HWND hWnd, wchar_t *account_name); +void CmSortcut(HWND hWnd, wchar_t *account_name); +void CmImportAccount(HWND hWnd); +void CmImportAccountMain(HWND hWnd, wchar_t *filename); +void CmImportAccountMainEx(HWND hWnd, wchar_t *filename, bool overwrite); +void CmTrustDlg(HWND hWnd); +UINT CmTrustDlgProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param); +void CmTrustDlgUpdate(HWND hWnd); +void CmTrustDlgRefresh(HWND hWnd); +void CmTrustImport(HWND hWnd); +void CmTrustExport(HWND hWnd); +void CmTrustView(HWND hWnd); +void CmPassword(HWND hWnd); +UINT CmPasswordProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param); +void CmPasswordRefresh(HWND hWnd); +void CmRefreshStatusBar(HWND hWnd); +UINT CmGetNumConnected(HWND hWnd); +void CmDisconnectAll(HWND hWnd); +wchar_t *CmGenerateMainWindowTitle(); +void CmConfigDlg(HWND hWnd); +UINT CmConfigDlgProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param); +void CmConfigDlgInit(HWND hWnd); +void CmConfigDlgRefresh(HWND hWnd); +void CmConfigDlgOnOk(HWND hWnd); +bool CmWarningDesktop(HWND hWnd, wchar_t *account_name); +UINT CmDesktopDlgProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param); +void CmDesktopDlgInit(HWND hWnd, wchar_t *account_name); +bool CmStopInstallVLan(HWND hWnd); +void CmChangePassword(HWND hWnd, CLIENT_OPTION *o, char *hubname, char *username); +UINT CmChangePasswordProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param); +void CmChangePasswordUpdate(HWND hWnd, CM_CHANGE_PASSWORD *p); +void SmShowPublicVpnServerHtml(HWND hWnd); +void CmConnectShortcut(UCHAR *key); +UINT CmSelectSecure(HWND hWnd, UINT current_id); +void CmClientSecureManager(HWND hWnd); +UINT CmClientSelectSecure(HWND hWnd); +UINT CmSelectSecureDlg(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param); +void CmSelectSecureDlgInit(HWND hWnd, UINT default_id); +void CmSelectSecureDlgUpdate(HWND hWnd); +void CmSecureManager(HWND hWnd, UINT id); +void CmSecureManagerEx(HWND hWnd, UINT id, bool no_new_cert); +UINT CmSecureManagerDlg(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param); +void CmSecureManagerDlgInit(HWND hWnd, UINT id); +void CmSecureManagerDlgUpdate(HWND hWnd, UINT id); +void CmSecureManagerDlgRefresh(HWND hWnd, UINT id); +void CmSecureManagerDlgPrintList(HWND hWnd, LIST *o); +void CmSecureManagerDlgPrintListEx(HWND hWnd, UINT id, LIST *o, UINT type); +wchar_t *CmSecureObjTypeToStr(UINT type); +UINT CmSecureType(HWND hWnd); +UINT CmSecureTypeDlg(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param); +void CmSecureManagerDlgImport(HWND hWnd, UINT id); +void CmSecureManagerDlgDelete(HWND hWnd, UINT id); +void CmSecureManagerDlgExport(HWND hWnd, UINT id); +void CmSecureManagerDlgNewCert(HWND hWnd, UINT id); +void CmSecurePin(HWND hWnd, UINT id); +UINT CmSecurePinDlg(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param); +void CmSecurePinDlgUpdate(HWND hWnd); +void CmInitTray(HWND hWnd); +void CmPollingTray(HWND hWnd); +void CmFreeTray(HWND hWnd); +void CmChangeTrayString(HWND hWnd, wchar_t *str); +UINT CmGetTrayIconId(bool animation, UINT animation_counter); +void CmShowOrHideWindow(HWND hWnd); +void CmShowTrayMenu(HWND hWnd); +HMENU CmCreateTraySubMenu(HWND hWnd, bool flag, UINT start_id); +HMENU CmCreateRecentSubMenu(HWND hWnd, UINT start_id); +bool CmCheckPkcsEula(HWND hWnd, UINT id); +UINT CmPkcsEulaDlg(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param); +void CmDeleteOldStartupTrayFile(); +UINT CmTrafficDlgProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param); +void CmTrafficDlgInit(HWND hWnd); +bool CmTrafficDlgUpdate(HWND hWnd); +void CmTrafficDlgOnOk(HWND hWnd); +bool CmTrafficLoadFromReg(CM_TRAFFIC *t); +void CmTrafficGetDefaultSetting(CM_TRAFFIC *t); +void CmTrafficSaveToReg(CM_TRAFFIC *t); +void CmTrafficDlgToStruct(HWND hWnd, CM_TRAFFIC *t); +void CmExecTraffic(HWND hWnd, CM_TRAFFIC *t); +UINT CmTrafficRunDlg(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param); +void CmTrafficRunDlgInit(HWND hWnd, CM_TRAFFIC_DLG *d); +void CmTrafficRunDlgStart(HWND hWnd, CM_TRAFFIC_DLG *d); +void CmTrafficRunDlgPrintProc(void *param, wchar_t *str); +void CmTrafficRunDlgAddStr(HWND hWnd, wchar_t *str); +void CmTrafficRunDlgHalt(HWND hWnd, CM_TRAFFIC_DLG *d); +void CmTrafficRunDlgHaltThread(THREAD *t, void *param); +void CmTrafficRunDlgClientWaitThread(THREAD *t, void *param); +void CmTrafficResult(HWND hWnd, TT_RESULT *r); +UINT CmTrafficResultDlg(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param); +void CmTrafficResultDlgInit(HWND hWnd, TT_RESULT *res); +void CmTryToExecUiHelper(); +void CmInitTryToExecUiHelper(); +void CmFreeTryToExecUiHelper(); +void CmTryToExecUiHelperThread(THREAD *thread, void *param); +bool CmSetting(HWND hWnd); +UINT CmSettingDlg(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param); +void CmSettingDlgInit(HWND hWnd, CM_SETTING_DLG *d); +void CmSettingDlgUpdate(HWND hWnd, CM_SETTING_DLG *d); +void CmSettingDlgOnOk(HWND hWnd, CM_SETTING_DLG *d); +void CmApplyCmSetting(); +void CmMainWindowOnTrayClicked(HWND hWnd, WPARAM wParam, LPARAM lParam); +void CmShowEasy(); +void CmCloseEasy(); +void CmMainWindowOnShowEasy(HWND hWnd); +UINT CmEasyDlg(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param); +void CmEasyDlgInit(HWND hWnd, CM_EASY_DLG *d); +void CmEasyDlgUpdate(HWND hWnd, CM_EASY_DLG *d); +void CmEasyDlgRefresh(HWND hWnd, CM_EASY_DLG *d); +void CmRefreshEasy(); +void CmEasyDlgOnNotify(HWND hWnd, CM_EASY_DLG *d, NMHDR *n); +void CmEasyDlgOnKey(HWND hWnd, CM_EASY_DLG *d, bool ctrl, bool alt, UINT key); +void CmEasyDlgOnCommand(HWND hWnd, CM_EASY_DLG *d, WPARAM wParam, LPARAM lParam); + +bool CmStartStartupMutex(); +void CmEndStartupMutex(); +void CmSetUacWindowActive(); +void CmUacHelperThread(THREAD *thread, void *param); +void CmProxyDlgUseForIE(HWND hWnd, CLIENT_OPTION *o); +void CmGetSystemInternetSetting(CM_INTERNET_SETTING *setting); +void CmProxyDlgSet(HWND hWnd, CLIENT_OPTION *o, CM_INTERNET_SETTING *setting); +bool CmGetProxyServerNameAndPortFromIeProxyRegStr(char *name, UINT name_size, UINT *port, char *str, char *server_type); +void *CmUpdateJumpList(UINT start_id); + +void CmProxyHttpHeaderDlgUpdate(HWND hWnd); +void CmProxyHttpHeaderDlgRefresh(HWND hWnd, CM_PROXY_HTTP_HEADER_DLG *d); +void CmProxyHttpHeaderDlgInit(HWND hWnd, CM_PROXY_HTTP_HEADER_DLG *d); +UINT CmProxyHttpHeaderDlgProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param); +bool CmProxyHttpHeaderDlg(HWND hWnd, CLIENT_OPTION *a); diff --git a/src/Cedar/Cedar.c b/src/Cedar/Cedar.c index a1d23ecd..da47188a 100644 --- a/src/Cedar/Cedar.c +++ b/src/Cedar/Cedar.c @@ -1,1618 +1,1618 @@ -// SoftEther VPN Source Code - Developer Edition Master Branch -// Cedar Communication Module - - -// Cedar.c -// Cedar Communication Module - - -#include "CedarPch.h" - -static UINT init_cedar_counter = 0; -static REF *cedar_log_ref = NULL; -static LOG *cedar_log; - -// Check whether there is any EAP-enabled RADIUS configuration -bool CedarIsThereAnyEapEnabledRadiusConfig(CEDAR *c) -{ - bool ret = false; - UINT i; - if (c == NULL) - { - return false; - } - - LockHubList(c); - { - for (i = 0;i < LIST_NUM(c->HubList);i++) - { - HUB *hub = LIST_DATA(c->HubList, i); - - if (hub->RadiusConvertAllMsChapv2AuthRequestToEap) - { - ret = true; - break; - } - } - } - UnlockHubList(c); - - return ret; -} - -// Get build date of current code -UINT64 GetCurrentBuildDate() -{ - SYSTEMTIME st; - - Zero(&st, sizeof(st)); - - st.wYear = BUILD_DATE_Y; - st.wMonth = BUILD_DATE_M; - st.wDay = BUILD_DATE_D; - st.wHour = BUILD_DATE_HO; - st.wMinute = BUILD_DATE_MI; - st.wSecond = BUILD_DATE_SE; - - return SystemToUINT64(&st); -} - -// Check current windows version is supported -bool IsSupportedWinVer(RPC_WINVER *v) -{ - // Validate arguments - if (v == NULL) - { - return false; - } - - if (v->IsWindows == false) - { - return true; - } - - if (v->IsNT == false) - { - return true; - } - - if (v->IsBeta) - { - return true; - } - - if (v->VerMajor <= 4) - { - // Windows NT - return true; - } - - if (v->VerMajor == 5 && v->VerMinor == 0) - { - // Windows 2000 - if (v->ServicePack <= 4) - { - // SP4 or earlier - return true; - } - } - - if (v->VerMajor == 5 && v->VerMinor == 1) - { - // Windows XP x86 - if (v->ServicePack <= 3) - { - // SP3 or earlier - return true; - } - } - - if (v->VerMajor == 5 && v->VerMinor == 2) - { - // Windows XP x64, Windows Server 2003 - if (v->ServicePack <= 2) - { - // SP2 or earlier - return true; - } - } - - if (v->VerMajor == 6 && v->VerMinor == 0) - { - // Windows Vista, Server 2008 - if (v->ServicePack <= 2) - { - // SP2 or earlier - return true; - } - } - - if (v->VerMajor == 6 && v->VerMinor == 1) - { - // Windows 7, Server 2008 R2 - if (v->ServicePack <= 1) - { - // SP1 or earlier - return true; - } - } - - if (v->VerMajor == 6 && v->VerMinor == 2) - { - // Windows 8, Server 2012 - if (v->ServicePack <= 0) - { - // SP0 only - return true; - } - } - - if (v->VerMajor == 6 && v->VerMinor == 3) - { - // Windows 8.1, Server 2012 R2 - if (v->ServicePack <= 0) - { - // SP0 only - return true; - } - } - - if ((v->VerMajor == 6 && v->VerMinor == 4) || (v->VerMajor == 10 && v->VerMinor == 0)) - { - // Windows 10 or Windows Server 2016 - if (v->ServicePack <= 0) - { - // SP0 only - return true; - } - } - - return false; -} - -// Get version of Windows -void GetWinVer(RPC_WINVER *v) -{ - // Validate arguments - if (v == NULL) - { - return; - } - -#ifdef OS_WIN32 - Win32GetWinVer(v); -#else // OS_WIN32 - Zero(v, sizeof(RPC_WINVER)); - StrCpy(v->Title, sizeof(v->Title), GetOsInfo()->OsProductName); -#endif // OS_WIN32 -} - -// Close tiny log -void FreeTinyLog(TINY_LOG *t) -{ - // Validate arguments - if (t == NULL) - { - return; - } - - FileClose(t->io); - DeleteLock(t->Lock); - Free(t); -} - -// Write to tiny log -void WriteTinyLog(TINY_LOG *t, char *str) -{ - BUF *b; - char dt[MAX_PATH]; - // Validate arguments - if (t == NULL) - { - return; - } - - GetDateTimeStrMilli64(dt, sizeof(dt), LocalTime64()); - StrCat(dt, sizeof(dt), ": "); - - b = NewBuf(); - - WriteBuf(b, dt, StrLen(dt)); - WriteBuf(b, str, StrLen(str)); - WriteBuf(b, "\r\n", 2); - - Lock(t->Lock); - { - FileWrite(t->io, b->Buf, b->Size); - //FileFlush(t->io); - } - Unlock(t->Lock); - - FreeBuf(b); -} - -// Initialize tiny log -TINY_LOG *NewTinyLog() -{ - char name[MAX_PATH]; - SYSTEMTIME st; - TINY_LOG *t; - - LocalTime(&st); - - MakeDir(TINY_LOG_DIRNAME); - - Format(name, sizeof(name), TINY_LOG_FILENAME, - st.wYear, st.wMonth, st.wDay, st.wHour, st.wMinute, st.wSecond); - - t = ZeroMalloc(sizeof(TINY_LOG)); - - StrCpy(t->FileName, sizeof(t->FileName), name); - t->io = FileCreate(name); - t->Lock = NewLock(); - - return t; -} - -// Compare entries of No-SSL connection list -int CompareNoSslList(void *p1, void *p2) -{ - NON_SSL *n1, *n2; - if (p1 == NULL || p2 == NULL) - { - return 0; - } - n1 = *(NON_SSL **)p1; - n2 = *(NON_SSL **)p2; - if (n1 == NULL || n2 == NULL) - { - return 0; - } - return CmpIpAddr(&n1->IpAddress, &n2->IpAddress); -} - -// Decrement connection count of Non-SSL connection list entry -void DecrementNoSsl(CEDAR *c, IP *ip, UINT num_dec) -{ - // Validate arguments - if (c == NULL || ip == NULL) - { - return; - } - - LockList(c->NonSslList); - { - NON_SSL *n = SearchNoSslList(c, ip); - - if (n != NULL) - { - if (n->Count >= num_dec) - { - n->Count -= num_dec; - } - } - } - UnlockList(c->NonSslList); -} - -// Add new entry to Non-SSL connection list -bool AddNoSsl(CEDAR *c, IP *ip) -{ - NON_SSL *n; - bool ret = true; - // Validate arguments - if (c == NULL || ip == NULL) - { - return true; - } - - LockList(c->NonSslList); - { - DeleteOldNoSsl(c); - - n = SearchNoSslList(c, ip); - - if (n == NULL) - { - n = ZeroMalloc(sizeof(NON_SSL)); - Copy(&n->IpAddress, ip, sizeof(IP)); - n->Count = 0; - - Add(c->NonSslList, n); - } - - n->EntryExpires = Tick64() + (UINT64)NON_SSL_ENTRY_EXPIRES; - - n->Count++; - - if (n->Count > NON_SSL_MIN_COUNT) - { - ret = false; - } - } - UnlockList(c->NonSslList); - - return ret; -} - -// Delete old entries in Non-SSL connection list -void DeleteOldNoSsl(CEDAR *c) -{ - UINT i; - LIST *o; - // Validate arguments - if (c == NULL) - { - return; - } - - o = NewListFast(NULL); - - for (i = 0;i < LIST_NUM(c->NonSslList);i++) - { - NON_SSL *n = LIST_DATA(c->NonSslList, i); - - if (n->EntryExpires <= Tick64()) - { - Add(o, n); - } - } - - for (i = 0;i < LIST_NUM(o);i++) - { - NON_SSL *n = LIST_DATA(o, i); - - Delete(c->NonSslList, n); - Free(n); - } - - ReleaseList(o); -} - -// Search entry in Non-SSL connection list -NON_SSL *SearchNoSslList(CEDAR *c, IP *ip) -{ - NON_SSL *n, t; - // Validate arguments - if (c == NULL || ip == NULL) - { - return NULL; - } - - Zero(&t, sizeof(t)); - Copy(&t.IpAddress, ip, sizeof(IP)); - - n = Search(c->NonSslList, &t); - - if (n == NULL) - { - return NULL; - } - - return n; -} - -// Initialize Non-SSL connection list -void InitNoSslList(CEDAR *c) -{ - // Validate arguments - if (c == NULL) - { - return; - } - - c->NonSslList = NewList(CompareNoSslList); -} - -// Free Non-SSL connection list -void FreeNoSslList(CEDAR *c) -{ - UINT i; - // Validate arguments - if (c == NULL) - { - return; - } - - for (i = 0;i < LIST_NUM(c->NonSslList);i++) - { - NON_SSL *n = LIST_DATA(c->NonSslList, i); - - Free(n); - } - - ReleaseList(c->NonSslList); - c->NonSslList = NULL; -} - -// Start Cedar log -void StartCedarLog() -{ - if (cedar_log_ref == NULL) - { - cedar_log_ref = NewRef(); - } - else - { - AddRef(cedar_log_ref); - } - - cedar_log = NewLog("debug_log", "debug", LOG_SWITCH_DAY); -} - -// Stop Cedar log -void StopCedarLog() -{ - if (cedar_log_ref == NULL) - { - return; - } - - if (Release(cedar_log_ref) == 0) - { - FreeLog(cedar_log); - cedar_log = NULL; - cedar_log_ref = NULL; - } -} - - -// Get sum of traffic data size -UINT64 GetTrafficPacketSize(TRAFFIC *t) -{ - // Validate arguments - if (t == NULL) - { - return 0; - } - - return t->Recv.BroadcastBytes + t->Recv.UnicastBytes + - t->Send.BroadcastBytes + t->Send.UnicastBytes; -} - -// Get sum of the number of packets in traffic -UINT64 GetTrafficPacketNum(TRAFFIC *t) -{ - // Validate arguments - if (t == NULL) - { - return 0; - } - - return t->Recv.BroadcastCount + t->Recv.UnicastCount + - t->Send.BroadcastCount + t->Send.UnicastCount; -} - -// Check whether the certificate is signed by CA which is trusted by the hub -bool CheckSignatureByCaLinkMode(SESSION *s, X *x) -{ - LINK *k; - HUB *h; - bool ret = false; - // Validate arguments - if (s == NULL || x == NULL) - { - return false; - } - - if (s->LinkModeClient == false || (k = s->Link) == NULL) - { - return false; - } - - h = k->Hub; - - if (h->HubDb != NULL) - { - LockList(h->HubDb->RootCertList); - { - X *root_cert; - root_cert = GetIssuerFromList(h->HubDb->RootCertList, x); - if (root_cert != NULL) - { - ret = true; - } - } - UnlockList(h->HubDb->RootCertList); - } - - return ret; -} - -// Check whether the certificate is signed by CA which is trusted by Cedar -bool CheckSignatureByCa(CEDAR *cedar, X *x) -{ - X *ca; - // Validate arguments - if (cedar == NULL || x == NULL) - { - return false; - } - - // Get the CA which signed the certificate - ca = FindCaSignedX(cedar->CaList, x); - if (ca == NULL) - { - // Not found - return false; - } - - // Found - FreeX(ca); - return true; -} - -// Get the CA which signed the certificate -X *FindCaSignedX(LIST *o, X *x) -{ - X *ret; - // Validate arguments - if (o == NULL || x == NULL) - { - return NULL; - } - - ret = NULL; - - LockList(o); - { - UINT i; - for (i = 0;i < LIST_NUM(o);i++) - { - X *ca = LIST_DATA(o, i); - if (CheckXDateNow(ca)) - { - if (CompareName(ca->subject_name, x->issuer_name)) - { - K *k = GetKFromX(ca); - if (k != NULL) - { - if (CheckSignature(x, k)) - { - ret = CloneX(ca); - } - FreeK(k); - } - } - else if (CompareX(ca, x)) - { - ret = CloneX(ca); - } - } - - if (ret != NULL) - { - break; - } - } - } - UnlockList(o); - - return ret; -} - -// Delete trusted CA from Cedar -bool DeleteCa(CEDAR *cedar, UINT ptr) -{ - bool b = false; - // Validate arguments - if (cedar == NULL || ptr == 0) - { - return false; - } - - LockList(cedar->CaList); - { - UINT i; - - for (i = 0;i < LIST_NUM(cedar->CaList);i++) - { - X *x = LIST_DATA(cedar->CaList, i); - - if (POINTER_TO_KEY(x) == ptr) - { - Delete(cedar->CaList, x); - FreeX(x); - - b = true; - - break; - } - } - } - UnlockList(cedar->CaList); - - return b; -} - -// Add trusted CA to Cedar -void AddCa(CEDAR *cedar, X *x) -{ - // Validate arguments - if (cedar == NULL || x == NULL) - { - return; - } - - LockList(cedar->CaList); - { - UINT i; - bool ok = true; - - for (i = 0;i < LIST_NUM(cedar->CaList);i++) - { - X *exist_x = LIST_DATA(cedar->CaList, i); - if (CompareX(exist_x, x)) - { - ok = false; - break; - } - } - - if (ok) - { - Insert(cedar->CaList, CloneX(x)); - } - } - UnlockList(cedar->CaList); -} - -// Delete connection from Cedar -void DelConnection(CEDAR *cedar, CONNECTION *c) -{ - // Validate arguments - if (cedar == NULL || c == NULL) - { - return; - } - - LockList(cedar->ConnectionList); - { - Debug("Connection %s Deleted from Cedar.\n", c->Name); - if (Delete(cedar->ConnectionList, c)) - { - ReleaseConnection(c); - } - } - UnlockList(cedar->ConnectionList); -} - -// Add connection to Cedar -void AddConnection(CEDAR *cedar, CONNECTION *c) -{ - char tmp[MAX_SIZE]; - UINT i; - // Validate arguments - if (cedar == NULL || c == NULL) - { - return; - } - - // Determine the name of the connection - i = Inc(cedar->ConnectionIncrement); - Format(tmp, sizeof(tmp), "CID-%u", i); - - - Lock(c->lock); - { - Free(c->Name); - c->Name = CopyStr(tmp); - } - Unlock(c->lock); - - LockList(cedar->ConnectionList); - { - Add(cedar->ConnectionList, c); - AddRef(c->ref); - Debug("Connection %s Inserted to Cedar.\n", c->Name); - } - UnlockList(cedar->ConnectionList); -} - -// Stop all connections -void StopAllConnection(CEDAR *c) -{ - UINT num; - UINT i; - CONNECTION **connections; - // Validate arguments - if (c == NULL) - { - return; - } - - LockList(c->ConnectionList); - { - connections = ToArray(c->ConnectionList); - num = LIST_NUM(c->ConnectionList); - DeleteAll(c->ConnectionList); - } - UnlockList(c->ConnectionList); - - for (i = 0;i < num;i++) - { - StopConnection(connections[i], false); - ReleaseConnection(connections[i]); - } - Free(connections); -} - -// Delete a hub in Cedar -void DelHub(CEDAR *c, HUB *h) -{ - DelHubEx(c, h, false); -} -void DelHubEx(CEDAR *c, HUB *h, bool no_lock) -{ - // Validate arguments - if (c == NULL || h == NULL) - { - return; - } - - if (no_lock == false) - { - LockHubList(c); - } - - if (Delete(c->HubList, h)) - { - ReleaseHub(h); - } - - if (no_lock == false) - { - UnlockHubList(c); - } -} - -// Add a new hub to Cedar -void AddHub(CEDAR *c, HUB *h) -{ - // Validate arguments - if (c == NULL || h == NULL) - { - return; - } - - LockHubList(c); - { -#if 0 - // We shall not check here the number of hub - if (LIST_NUM(c->HubList) >= MAX_HUBS) - { - // over limit - UnlockHubList(c); - return; - } -#endif - - // Confirm there is no hub which have same name - if (IsHub(c, h->Name)) - { - // exist - UnlockHubList(c); - return; - } - - // Register the hub - Insert(c->HubList, h); - AddRef(h->ref); - } - UnlockHubList(c); -} - -// Stop all hubs in Cedar -void StopAllHub(CEDAR *c) -{ - HUB **hubs; - UINT i, num; - // Validate arguments - if (c == NULL) - { - return; - } - - LockHubList(c); - { - hubs = ToArray(c->HubList); - num = LIST_NUM(c->HubList); - DeleteAll(c->HubList); - } - UnlockHubList(c); - - for (i = 0;i < num;i++) - { - StopHub(hubs[i]); - ReleaseHub(hubs[i]); - } - - Free(hubs); -} - -// Get reverse listener socket in Cedar -SOCK *GetReverseListeningSock(CEDAR *c) -{ - SOCK *s = NULL; - // Validate arguments - if (c == NULL) - { - return NULL; - } - - LockList(c->ListenerList); - { - UINT i; - for (i = 0;i < LIST_NUM(c->ListenerList);i++) - { - LISTENER *r = LIST_DATA(c->ListenerList, i); - - if (r->Protocol == LISTENER_REVERSE) - { - Lock(r->lock); - { - s = r->Sock; - - AddRef(s->ref); - } - Unlock(r->lock); - break; - } - } - } - UnlockList(c->ListenerList); - - return s; -} - -// Get in-process listener socket in Cedar -SOCK *GetInProcListeningSock(CEDAR *c) -{ - SOCK *s = NULL; - // Validate arguments - if (c == NULL) - { - return NULL; - } - - LockList(c->ListenerList); - { - UINT i; - for (i = 0;i < LIST_NUM(c->ListenerList);i++) - { - LISTENER *r = LIST_DATA(c->ListenerList, i); - - if (r->Protocol == LISTENER_INPROC) - { - Lock(r->lock); - { - s = r->Sock; - - if (s != NULL) - { - AddRef(s->ref); - } - } - Unlock(r->lock); - break; - } - } - } - UnlockList(c->ListenerList); - - return s; -} - -// Add a new listener to Cedar -void AddListener(CEDAR *c, LISTENER *r) -{ - // Validate arguments - if (c == NULL || r == NULL) - { - return; - } - - LockList(c->ListenerList); - { - Add(c->ListenerList, r); - AddRef(r->ref); - } - UnlockList(c->ListenerList); -} - -// Stop all listener in Cedar -void StopAllListener(CEDAR *c) -{ - LISTENER **array; - UINT i, num; - // Validate arguments - if (c == NULL) - { - return; - } - - LockList(c->ListenerList); - { - array = ToArray(c->ListenerList); - num = LIST_NUM(c->ListenerList); - DeleteAll(c->ListenerList); - } - UnlockList(c->ListenerList); - - for (i = 0;i < num;i++) - { - StopListener(array[i]); - ReleaseListener(array[i]); - } - Free(array); -} - -// Budget management functions -void CedarAddQueueBudget(CEDAR *c, int diff) -{ - // Validate arguments - if (c == NULL || diff == 0) - { - return; - } - - Lock(c->QueueBudgetLock); - { - int v = (int)c->QueueBudget; - v += diff; - c->QueueBudget = (UINT)v; - } - Unlock(c->QueueBudgetLock); -} -void CedarAddFifoBudget(CEDAR *c, int diff) -{ - // Validate arguments - if (c == NULL || diff == 0) - { - return; - } - - Lock(c->FifoBudgetLock); - { - int v = (int)c->FifoBudget; - v += diff; - c->FifoBudget = (UINT)v; - } - Unlock(c->FifoBudgetLock); -} -UINT CedarGetQueueBudgetConsuming(CEDAR *c) -{ - // Validate arguments - if (c == NULL) - { - return 0; - } - - return c->QueueBudget; -} -UINT CedarGetFifoBudgetConsuming(CEDAR *c) -{ - // Validate arguments - if (c == NULL) - { - return 0; - } - - return c->FifoBudget; -} -UINT CedarGetQueueBudgetBalance(CEDAR *c) -{ - UINT current = CedarGetQueueBudgetConsuming(c); - UINT budget = QUEUE_BUDGET; - - if (current <= budget) - { - return budget - current; - } - else - { - return 0; - } -} -UINT CedarGetFifoBudgetBalance(CEDAR *c) -{ - UINT current = CedarGetFifoBudgetConsuming(c); - UINT budget = FIFO_BUDGET; - - if (current <= budget) - { - return budget - current; - } - else - { - return 0; - } -} - -// Add the current TCP queue size -void CedarAddCurrentTcpQueueSize(CEDAR *c, int diff) -{ - // Validate arguments - if (c == NULL || diff == 0) - { - return; - } - - Lock(c->CurrentTcpQueueSizeLock); - { - int v = (int)c->CurrentTcpQueueSize; - v += diff; - c->CurrentTcpQueueSize = (UINT)v; - } - Unlock(c->CurrentTcpQueueSizeLock); -} - -// Get the current TCP queue size -UINT CedarGetCurrentTcpQueueSize(CEDAR *c) -{ - // Validate arguments - if (c == NULL) - { - return 0; - } - - return c->CurrentTcpQueueSize; -} - -// Stop Cedar -void StopCedar(CEDAR *c) -{ - // Validate arguments - if (c == NULL) - { - return; - } - - // Stop flag - c->Halt = true; - - // Stop all listener - StopAllListener(c); - // Stop all connections - StopAllConnection(c); - // Stop all hubs - StopAllHub(c); - // Free all virtual L3 switch - L3FreeAllSw(c); -} - -// Clean up Cedar -void CleanupCedar(CEDAR *c) -{ - UINT i; - // Validate arguments - if (c == NULL) - { - return; - } - - WuFreeWebUI(c->WebUI); - FreeCedarLayer3(c); - -/* - for (i = 0;i < LIST_NUM(c->HubList);i++) - { - HUB *h = LIST_DATA(c->HubList, i); - } -*/ - for (i = 0;i < LIST_NUM(c->CaList);i++) - { - X *x = LIST_DATA(c->CaList, i); - FreeX(x); - } - ReleaseList(c->CaList); - - ReleaseList(c->ListenerList); - ReleaseList(c->HubList); - ReleaseList(c->ConnectionList); - //CleanupUDPEntry(c); - ReleaseList(c->UDPEntryList); - DeleteLock(c->lock); - DeleteCounter(c->ConnectionIncrement); - DeleteCounter(c->CurrentSessions); - - if (c->DebugLog != NULL) - { - FreeLog(c->DebugLog); - } - - if (c->ServerX) - { - FreeX(c->ServerX); - } - if (c->ServerK) - { - FreeK(c->ServerK); - } - - if (c->CipherList) - { - Free(c->CipherList); - } - - for (i = 0;i < LIST_NUM(c->TrafficDiffList);i++) - { - TRAFFIC_DIFF *d = LIST_DATA(c->TrafficDiffList, i); - Free(d->Name); - Free(d->HubName); - Free(d); - } - - ReleaseList(c->TrafficDiffList); - - Free(c->ServerStr); - Free(c->MachineName); - - Free(c->HttpUserAgent); - Free(c->HttpAccept); - Free(c->HttpAcceptLanguage); - Free(c->HttpAcceptEncoding); - - FreeTraffic(c->Traffic); - - DeleteLock(c->TrafficLock); - - FreeNetSvcList(c); - - Free(c->VerString); - Free(c->BuildInfo); - - FreeLocalBridgeList(c); - - DeleteCounter(c->AssignedBridgeLicense); - DeleteCounter(c->AssignedClientLicense); - - FreeNoSslList(c); - - DeleteLock(c->CedarSuperLock); - - DeleteCounter(c->AcceptingSockets); - - ReleaseIntList(c->UdpPortList); - - DeleteLock(c->OpenVPNPublicPortsLock); - - DeleteLock(c->CurrentRegionLock); - - DeleteLock(c->CurrentTcpQueueSizeLock); - DeleteLock(c->QueueBudgetLock); - DeleteLock(c->FifoBudgetLock); - - DeleteCounter(c->CurrentActiveLinks); - - Free(c); -} - -// Release reference of the Cedar -void ReleaseCedar(CEDAR *c) -{ - // Validate arguments - if (c == NULL) - { - return; - } - - if (Release(c->ref) == 0) - { - CleanupCedar(c); - } -} - -// Set cipher list entry -void SetCedarCipherList(CEDAR *cedar, char *name) -{ - // Validate arguments - if (cedar == NULL) - { - return; - } - - if (cedar->CipherList != NULL) - { - Free(cedar->CipherList); - } - if (name != NULL) - { - cedar->CipherList = CopyStr(name); - } - else - { - cedar->CipherList = NULL; - } -} - -// Compare net service list entries -int CompareNetSvc(void *p1, void *p2) -{ - NETSVC *n1, *n2; - if (p1 == NULL || p2 == NULL) - { - return 0; - } - n1 = *(NETSVC **)p1; - n2 = *(NETSVC **)p2; - if (n1 == NULL || n2 == NULL) - { - return 0; - } - if (n1->Port > n2->Port) - { - return 1; - } - else if (n1->Port < n2->Port) - { - return -1; - } - else if (n1->Udp > n2->Udp) - { - return 1; - } - else if (n1->Udp < n2->Udp) - { - return -1; - } - return 0; -} - -// Initialize net service list -void InitNetSvcList(CEDAR *cedar) -{ - char filename[MAX_PATH] = "/etc/services"; - BUF *b; - // Validate arguments - if (cedar == NULL) - { - return; - } - -#ifdef OS_WIN32 - Format(filename, sizeof(filename), "%s\\drivers\\etc\\services", MsGetSystem32Dir()); -#endif - - cedar->NetSvcList = NewList(CompareNetSvc); - - b = ReadDump(filename); - if (b == NULL) - { - return; - } - - while (true) - { - char *s = CfgReadNextLine(b); - if (s == NULL) - { - break; - } - - Trim(s); - if (s[0] != '#') - { - TOKEN_LIST *t = ParseToken(s, " \t/"); - if (t->NumTokens >= 3) - { - NETSVC *n = ZeroMalloc(sizeof(NETSVC)); - n->Name = CopyStr(t->Token[0]); - n->Udp = (StrCmpi(t->Token[2], "udp") == 0 ? true : false); - n->Port = ToInt(t->Token[1]); - Add(cedar->NetSvcList, n); - } - FreeToken(t); - } - Free(s); - } - - FreeBuf(b); -} - -// Get net service name -char *GetSvcName(CEDAR *cedar, bool udp, UINT port) -{ - char *ret = NULL; - NETSVC t; - // Validate arguments - if (cedar == NULL) - { - return NULL; - } - - t.Udp = (udp == 0 ? false : true); - t.Port = port; - - LockList(cedar->NetSvcList); - { - NETSVC *n = Search(cedar->NetSvcList, &t); - if (n != NULL) - { - ret = n->Name; - } - } - UnlockList(cedar->NetSvcList); - - return ret; -} - -// Free net service list -void FreeNetSvcList(CEDAR *cedar) -{ - UINT i; - // Validate arguments - if (cedar == NULL) - { - return; - } - - for (i = 0;i < LIST_NUM(cedar->NetSvcList);i++) - { - NETSVC *n = LIST_DATA(cedar->NetSvcList, i); - Free(n->Name); - Free(n); - } - ReleaseList(cedar->NetSvcList); -} - -// Change certificate of Cedar -void SetCedarCert(CEDAR *c, X *server_x, K *server_k) -{ - // Validate arguments - if (server_x == NULL || server_k == NULL) - { - return; - } - - Lock(c->lock); - { - if (c->ServerX != NULL) - { - FreeX(c->ServerX); - } - - if (c->ServerK != NULL) - { - FreeK(c->ServerK); - } - - c->ServerX = CloneX(server_x); - c->ServerK = CloneK(server_k); - } - Unlock(c->lock); -} - -// Set the Cedar into VPN Bridge mode -void SetCedarVpnBridge(CEDAR *c) -{ - // Validate arguments - if (c == NULL) - { - return; - } - - c->Bridge = true; - - Free(c->ServerStr); - c->ServerStr = CopyStr(CEDAR_BRIDGE_STR); -} - -void CedarForceLink() -{ -} - -// Get version of the Cedar -void GetCedarVersion(char *tmp, UINT size) -{ - // Validate arguments - if (tmp == NULL) - { - return; - } - - Format(tmp, size, "%u.%02u.%u", CEDAR_VERSION_MAJOR, CEDAR_VERSION_MINOR, CEDAR_VERSION_BUILD); -} - -UINT GetCedarVersionNumber() -{ - return CEDAR_VERSION_MAJOR * 100 + CEDAR_VERSION_MINOR; -} - -// Create Cedar object -CEDAR *NewCedar(X *server_x, K *server_k) -{ - CEDAR *c; - char tmp[MAX_SIZE]; - char tmp2[MAX_SIZE]; - char *beta_str; - - CedarForceLink(); - - c = ZeroMalloc(sizeof(CEDAR)); - - c->CurrentActiveLinks = NewCounter(); - - c->AcceptingSockets = NewCounter(); - - c->CedarSuperLock = NewLock(); - - c->CurrentRegionLock = NewLock(); - -#ifdef BETA_NUMBER - c->Beta = BETA_NUMBER; -#endif // BETA_NUMBER - - InitNoSslList(c); - - c->AssignedBridgeLicense = NewCounter(); - c->AssignedClientLicense = NewCounter(); - - c->CurrentTcpQueueSizeLock = NewLock(); - c->QueueBudgetLock = NewLock(); - c->FifoBudgetLock = NewLock(); - - Rand(c->UniqueId, sizeof(c->UniqueId)); - - c->CreatedTick = Tick64(); - - c->lock = NewLock(); - c->ref = NewRef(); - - c->OpenVPNPublicPortsLock = NewLock(); - c->CurrentTcpConnections = GetNumTcpConnectionsCounter(); - - c->ListenerList = NewList(CompareListener); - c->UDPEntryList = NewList(CompareUDPEntry); - c->HubList = NewList(CompareHub); - c->ConnectionList = NewList(CompareConnection); - - c->ConnectionIncrement = NewCounter(); - c->CurrentSessions = NewCounter(); - - if (server_k && server_x) - { - c->ServerK = CloneK(server_k); - c->ServerX = CloneX(server_x); - } - - c->Version = GetCedarVersionNumber(); - c->Build = CEDAR_VERSION_BUILD; - c->ServerStr = CopyStr(CEDAR_SERVER_STR); - - GetMachineName(tmp, sizeof(tmp)); - c->MachineName = CopyStr(tmp); - - c->HttpUserAgent = CopyStr(DEFAULT_USER_AGENT); - c->HttpAccept = CopyStr(DEFAULT_ACCEPT); - c->HttpAcceptLanguage = CopyStr("ja"); - c->HttpAcceptEncoding = CopyStr(DEFAULT_ENCODING); - - c->Traffic = NewTraffic(); - c->TrafficLock = NewLock(); - c->CaList = NewList(CompareCert); - - c->TrafficDiffList = NewList(NULL); - - SetCedarCipherList(c, SERVER_DEFAULT_CIPHER_NAME); - - c->ClientId = _II("CLIENT_ID"); - - c->UdpPortList = NewIntList(false); - - c->DhParamBits = DH_PARAM_BITS_DEFAULT; - - InitNetSvcList(c); - - InitLocalBridgeList(c); - - InitCedarLayer3(c); - - c->WebUI = WuNewWebUI(c); - -#ifdef ALPHA_VERSION - beta_str = "Alpha"; -#else // ALPHA_VERSION -#ifndef RELEASE_CANDIDATE - beta_str = "Beta"; -#else // RELEASE_CANDIDATE - beta_str = "Release Candidate"; -#endif // RELEASE_CANDIDATE -#endif // ALPHA_VERSION - - ToStr(tmp2, c->Beta); - - Format(tmp, sizeof(tmp), "Version %u.%02u Build %u %s %s (%s)", - CEDAR_VERSION_MAJOR, CEDAR_VERSION_MINOR, CEDAR_VERSION_BUILD, - c->Beta == 0 ? "" : beta_str, - c->Beta == 0 ? "" : tmp2, - _SS("LANGSTR")); - Trim(tmp); - - if (true) - { - SYSTEMTIME st; - Zero(&st, sizeof(st)); - - st.wYear = BUILD_DATE_Y; - st.wMonth = BUILD_DATE_M; - st.wDay = BUILD_DATE_D; - - c->BuiltDate = SystemToUINT64(&st); - } - - c->VerString = CopyStr(tmp); - - Format(tmp, sizeof(tmp), "Compiled %04u/%02u/%02u %02u:%02u:%02u by %s at %s", - BUILD_DATE_Y, BUILD_DATE_M, BUILD_DATE_D, BUILD_DATE_HO, BUILD_DATE_MI, BUILD_DATE_SE, BUILDER_NAME, BUILD_PLACE); - - c->BuildInfo = CopyStr(tmp); - - return c; -} - -// Cumulate traffic size -void AddTraffic(TRAFFIC *dst, TRAFFIC *diff) -{ - // Validate arguments - if (dst == NULL || diff == NULL) - { - return; - } - - dst->Recv.BroadcastBytes += diff->Recv.BroadcastBytes; - dst->Recv.BroadcastCount += diff->Recv.BroadcastCount; - dst->Recv.UnicastBytes += diff->Recv.UnicastBytes; - dst->Recv.UnicastCount += diff->Recv.UnicastCount; - - dst->Send.BroadcastBytes += diff->Send.BroadcastBytes; - dst->Send.BroadcastCount += diff->Send.BroadcastCount; - dst->Send.UnicastBytes += diff->Send.UnicastBytes; - dst->Send.UnicastCount += diff->Send.UnicastCount; -} - -// Create new traffic size object -TRAFFIC *NewTraffic() -{ - TRAFFIC *t; - - t = ZeroMalloc(sizeof(TRAFFIC)); - return t; -} - -// Free traffic size object -void FreeTraffic(TRAFFIC *t) -{ - // Validate arguments - if (t == NULL) - { - return; - } - - Free(t); -} - -// Initialize Cedar communication module -void InitCedar() -{ - if ((init_cedar_counter++) > 0) - { - return; - } - - // Initialize protocol module - InitProtocol(); -} - -// Free Cedar communication module -void FreeCedar() -{ - if ((--init_cedar_counter) > 0) - { - return; - } - - // Free protocol module - FreeProtocol(); -} - +// SoftEther VPN Source Code - Developer Edition Master Branch +// Cedar Communication Module + + +// Cedar.c +// Cedar Communication Module + + +#include "CedarPch.h" + +static UINT init_cedar_counter = 0; +static REF *cedar_log_ref = NULL; +static LOG *cedar_log; + +// Check whether there is any EAP-enabled RADIUS configuration +bool CedarIsThereAnyEapEnabledRadiusConfig(CEDAR *c) +{ + bool ret = false; + UINT i; + if (c == NULL) + { + return false; + } + + LockHubList(c); + { + for (i = 0;i < LIST_NUM(c->HubList);i++) + { + HUB *hub = LIST_DATA(c->HubList, i); + + if (hub->RadiusConvertAllMsChapv2AuthRequestToEap) + { + ret = true; + break; + } + } + } + UnlockHubList(c); + + return ret; +} + +// Get build date of current code +UINT64 GetCurrentBuildDate() +{ + SYSTEMTIME st; + + Zero(&st, sizeof(st)); + + st.wYear = BUILD_DATE_Y; + st.wMonth = BUILD_DATE_M; + st.wDay = BUILD_DATE_D; + st.wHour = BUILD_DATE_HO; + st.wMinute = BUILD_DATE_MI; + st.wSecond = BUILD_DATE_SE; + + return SystemToUINT64(&st); +} + +// Check current windows version is supported +bool IsSupportedWinVer(RPC_WINVER *v) +{ + // Validate arguments + if (v == NULL) + { + return false; + } + + if (v->IsWindows == false) + { + return true; + } + + if (v->IsNT == false) + { + return true; + } + + if (v->IsBeta) + { + return true; + } + + if (v->VerMajor <= 4) + { + // Windows NT + return true; + } + + if (v->VerMajor == 5 && v->VerMinor == 0) + { + // Windows 2000 + if (v->ServicePack <= 4) + { + // SP4 or earlier + return true; + } + } + + if (v->VerMajor == 5 && v->VerMinor == 1) + { + // Windows XP x86 + if (v->ServicePack <= 3) + { + // SP3 or earlier + return true; + } + } + + if (v->VerMajor == 5 && v->VerMinor == 2) + { + // Windows XP x64, Windows Server 2003 + if (v->ServicePack <= 2) + { + // SP2 or earlier + return true; + } + } + + if (v->VerMajor == 6 && v->VerMinor == 0) + { + // Windows Vista, Server 2008 + if (v->ServicePack <= 2) + { + // SP2 or earlier + return true; + } + } + + if (v->VerMajor == 6 && v->VerMinor == 1) + { + // Windows 7, Server 2008 R2 + if (v->ServicePack <= 1) + { + // SP1 or earlier + return true; + } + } + + if (v->VerMajor == 6 && v->VerMinor == 2) + { + // Windows 8, Server 2012 + if (v->ServicePack <= 0) + { + // SP0 only + return true; + } + } + + if (v->VerMajor == 6 && v->VerMinor == 3) + { + // Windows 8.1, Server 2012 R2 + if (v->ServicePack <= 0) + { + // SP0 only + return true; + } + } + + if ((v->VerMajor == 6 && v->VerMinor == 4) || (v->VerMajor == 10 && v->VerMinor == 0)) + { + // Windows 10 or Windows Server 2016 + if (v->ServicePack <= 0) + { + // SP0 only + return true; + } + } + + return false; +} + +// Get version of Windows +void GetWinVer(RPC_WINVER *v) +{ + // Validate arguments + if (v == NULL) + { + return; + } + +#ifdef OS_WIN32 + Win32GetWinVer(v); +#else // OS_WIN32 + Zero(v, sizeof(RPC_WINVER)); + StrCpy(v->Title, sizeof(v->Title), GetOsInfo()->OsProductName); +#endif // OS_WIN32 +} + +// Close tiny log +void FreeTinyLog(TINY_LOG *t) +{ + // Validate arguments + if (t == NULL) + { + return; + } + + FileClose(t->io); + DeleteLock(t->Lock); + Free(t); +} + +// Write to tiny log +void WriteTinyLog(TINY_LOG *t, char *str) +{ + BUF *b; + char dt[MAX_PATH]; + // Validate arguments + if (t == NULL) + { + return; + } + + GetDateTimeStrMilli64(dt, sizeof(dt), LocalTime64()); + StrCat(dt, sizeof(dt), ": "); + + b = NewBuf(); + + WriteBuf(b, dt, StrLen(dt)); + WriteBuf(b, str, StrLen(str)); + WriteBuf(b, "\r\n", 2); + + Lock(t->Lock); + { + FileWrite(t->io, b->Buf, b->Size); + //FileFlush(t->io); + } + Unlock(t->Lock); + + FreeBuf(b); +} + +// Initialize tiny log +TINY_LOG *NewTinyLog() +{ + char name[MAX_PATH]; + SYSTEMTIME st; + TINY_LOG *t; + + LocalTime(&st); + + MakeDir(TINY_LOG_DIRNAME); + + Format(name, sizeof(name), TINY_LOG_FILENAME, + st.wYear, st.wMonth, st.wDay, st.wHour, st.wMinute, st.wSecond); + + t = ZeroMalloc(sizeof(TINY_LOG)); + + StrCpy(t->FileName, sizeof(t->FileName), name); + t->io = FileCreate(name); + t->Lock = NewLock(); + + return t; +} + +// Compare entries of No-SSL connection list +int CompareNoSslList(void *p1, void *p2) +{ + NON_SSL *n1, *n2; + if (p1 == NULL || p2 == NULL) + { + return 0; + } + n1 = *(NON_SSL **)p1; + n2 = *(NON_SSL **)p2; + if (n1 == NULL || n2 == NULL) + { + return 0; + } + return CmpIpAddr(&n1->IpAddress, &n2->IpAddress); +} + +// Decrement connection count of Non-SSL connection list entry +void DecrementNoSsl(CEDAR *c, IP *ip, UINT num_dec) +{ + // Validate arguments + if (c == NULL || ip == NULL) + { + return; + } + + LockList(c->NonSslList); + { + NON_SSL *n = SearchNoSslList(c, ip); + + if (n != NULL) + { + if (n->Count >= num_dec) + { + n->Count -= num_dec; + } + } + } + UnlockList(c->NonSslList); +} + +// Add new entry to Non-SSL connection list +bool AddNoSsl(CEDAR *c, IP *ip) +{ + NON_SSL *n; + bool ret = true; + // Validate arguments + if (c == NULL || ip == NULL) + { + return true; + } + + LockList(c->NonSslList); + { + DeleteOldNoSsl(c); + + n = SearchNoSslList(c, ip); + + if (n == NULL) + { + n = ZeroMalloc(sizeof(NON_SSL)); + Copy(&n->IpAddress, ip, sizeof(IP)); + n->Count = 0; + + Add(c->NonSslList, n); + } + + n->EntryExpires = Tick64() + (UINT64)NON_SSL_ENTRY_EXPIRES; + + n->Count++; + + if (n->Count > NON_SSL_MIN_COUNT) + { + ret = false; + } + } + UnlockList(c->NonSslList); + + return ret; +} + +// Delete old entries in Non-SSL connection list +void DeleteOldNoSsl(CEDAR *c) +{ + UINT i; + LIST *o; + // Validate arguments + if (c == NULL) + { + return; + } + + o = NewListFast(NULL); + + for (i = 0;i < LIST_NUM(c->NonSslList);i++) + { + NON_SSL *n = LIST_DATA(c->NonSslList, i); + + if (n->EntryExpires <= Tick64()) + { + Add(o, n); + } + } + + for (i = 0;i < LIST_NUM(o);i++) + { + NON_SSL *n = LIST_DATA(o, i); + + Delete(c->NonSslList, n); + Free(n); + } + + ReleaseList(o); +} + +// Search entry in Non-SSL connection list +NON_SSL *SearchNoSslList(CEDAR *c, IP *ip) +{ + NON_SSL *n, t; + // Validate arguments + if (c == NULL || ip == NULL) + { + return NULL; + } + + Zero(&t, sizeof(t)); + Copy(&t.IpAddress, ip, sizeof(IP)); + + n = Search(c->NonSslList, &t); + + if (n == NULL) + { + return NULL; + } + + return n; +} + +// Initialize Non-SSL connection list +void InitNoSslList(CEDAR *c) +{ + // Validate arguments + if (c == NULL) + { + return; + } + + c->NonSslList = NewList(CompareNoSslList); +} + +// Free Non-SSL connection list +void FreeNoSslList(CEDAR *c) +{ + UINT i; + // Validate arguments + if (c == NULL) + { + return; + } + + for (i = 0;i < LIST_NUM(c->NonSslList);i++) + { + NON_SSL *n = LIST_DATA(c->NonSslList, i); + + Free(n); + } + + ReleaseList(c->NonSslList); + c->NonSslList = NULL; +} + +// Start Cedar log +void StartCedarLog() +{ + if (cedar_log_ref == NULL) + { + cedar_log_ref = NewRef(); + } + else + { + AddRef(cedar_log_ref); + } + + cedar_log = NewLog("debug_log", "debug", LOG_SWITCH_DAY); +} + +// Stop Cedar log +void StopCedarLog() +{ + if (cedar_log_ref == NULL) + { + return; + } + + if (Release(cedar_log_ref) == 0) + { + FreeLog(cedar_log); + cedar_log = NULL; + cedar_log_ref = NULL; + } +} + + +// Get sum of traffic data size +UINT64 GetTrafficPacketSize(TRAFFIC *t) +{ + // Validate arguments + if (t == NULL) + { + return 0; + } + + return t->Recv.BroadcastBytes + t->Recv.UnicastBytes + + t->Send.BroadcastBytes + t->Send.UnicastBytes; +} + +// Get sum of the number of packets in traffic +UINT64 GetTrafficPacketNum(TRAFFIC *t) +{ + // Validate arguments + if (t == NULL) + { + return 0; + } + + return t->Recv.BroadcastCount + t->Recv.UnicastCount + + t->Send.BroadcastCount + t->Send.UnicastCount; +} + +// Check whether the certificate is signed by CA which is trusted by the hub +bool CheckSignatureByCaLinkMode(SESSION *s, X *x) +{ + LINK *k; + HUB *h; + bool ret = false; + // Validate arguments + if (s == NULL || x == NULL) + { + return false; + } + + if (s->LinkModeClient == false || (k = s->Link) == NULL) + { + return false; + } + + h = k->Hub; + + if (h->HubDb != NULL) + { + LockList(h->HubDb->RootCertList); + { + X *root_cert; + root_cert = GetIssuerFromList(h->HubDb->RootCertList, x); + if (root_cert != NULL) + { + ret = true; + } + } + UnlockList(h->HubDb->RootCertList); + } + + return ret; +} + +// Check whether the certificate is signed by CA which is trusted by Cedar +bool CheckSignatureByCa(CEDAR *cedar, X *x) +{ + X *ca; + // Validate arguments + if (cedar == NULL || x == NULL) + { + return false; + } + + // Get the CA which signed the certificate + ca = FindCaSignedX(cedar->CaList, x); + if (ca == NULL) + { + // Not found + return false; + } + + // Found + FreeX(ca); + return true; +} + +// Get the CA which signed the certificate +X *FindCaSignedX(LIST *o, X *x) +{ + X *ret; + // Validate arguments + if (o == NULL || x == NULL) + { + return NULL; + } + + ret = NULL; + + LockList(o); + { + UINT i; + for (i = 0;i < LIST_NUM(o);i++) + { + X *ca = LIST_DATA(o, i); + if (CheckXDateNow(ca)) + { + if (CompareName(ca->subject_name, x->issuer_name)) + { + K *k = GetKFromX(ca); + if (k != NULL) + { + if (CheckSignature(x, k)) + { + ret = CloneX(ca); + } + FreeK(k); + } + } + else if (CompareX(ca, x)) + { + ret = CloneX(ca); + } + } + + if (ret != NULL) + { + break; + } + } + } + UnlockList(o); + + return ret; +} + +// Delete trusted CA from Cedar +bool DeleteCa(CEDAR *cedar, UINT ptr) +{ + bool b = false; + // Validate arguments + if (cedar == NULL || ptr == 0) + { + return false; + } + + LockList(cedar->CaList); + { + UINT i; + + for (i = 0;i < LIST_NUM(cedar->CaList);i++) + { + X *x = LIST_DATA(cedar->CaList, i); + + if (POINTER_TO_KEY(x) == ptr) + { + Delete(cedar->CaList, x); + FreeX(x); + + b = true; + + break; + } + } + } + UnlockList(cedar->CaList); + + return b; +} + +// Add trusted CA to Cedar +void AddCa(CEDAR *cedar, X *x) +{ + // Validate arguments + if (cedar == NULL || x == NULL) + { + return; + } + + LockList(cedar->CaList); + { + UINT i; + bool ok = true; + + for (i = 0;i < LIST_NUM(cedar->CaList);i++) + { + X *exist_x = LIST_DATA(cedar->CaList, i); + if (CompareX(exist_x, x)) + { + ok = false; + break; + } + } + + if (ok) + { + Insert(cedar->CaList, CloneX(x)); + } + } + UnlockList(cedar->CaList); +} + +// Delete connection from Cedar +void DelConnection(CEDAR *cedar, CONNECTION *c) +{ + // Validate arguments + if (cedar == NULL || c == NULL) + { + return; + } + + LockList(cedar->ConnectionList); + { + Debug("Connection %s Deleted from Cedar.\n", c->Name); + if (Delete(cedar->ConnectionList, c)) + { + ReleaseConnection(c); + } + } + UnlockList(cedar->ConnectionList); +} + +// Add connection to Cedar +void AddConnection(CEDAR *cedar, CONNECTION *c) +{ + char tmp[MAX_SIZE]; + UINT i; + // Validate arguments + if (cedar == NULL || c == NULL) + { + return; + } + + // Determine the name of the connection + i = Inc(cedar->ConnectionIncrement); + Format(tmp, sizeof(tmp), "CID-%u", i); + + + Lock(c->lock); + { + Free(c->Name); + c->Name = CopyStr(tmp); + } + Unlock(c->lock); + + LockList(cedar->ConnectionList); + { + Add(cedar->ConnectionList, c); + AddRef(c->ref); + Debug("Connection %s Inserted to Cedar.\n", c->Name); + } + UnlockList(cedar->ConnectionList); +} + +// Stop all connections +void StopAllConnection(CEDAR *c) +{ + UINT num; + UINT i; + CONNECTION **connections; + // Validate arguments + if (c == NULL) + { + return; + } + + LockList(c->ConnectionList); + { + connections = ToArray(c->ConnectionList); + num = LIST_NUM(c->ConnectionList); + DeleteAll(c->ConnectionList); + } + UnlockList(c->ConnectionList); + + for (i = 0;i < num;i++) + { + StopConnection(connections[i], false); + ReleaseConnection(connections[i]); + } + Free(connections); +} + +// Delete a hub in Cedar +void DelHub(CEDAR *c, HUB *h) +{ + DelHubEx(c, h, false); +} +void DelHubEx(CEDAR *c, HUB *h, bool no_lock) +{ + // Validate arguments + if (c == NULL || h == NULL) + { + return; + } + + if (no_lock == false) + { + LockHubList(c); + } + + if (Delete(c->HubList, h)) + { + ReleaseHub(h); + } + + if (no_lock == false) + { + UnlockHubList(c); + } +} + +// Add a new hub to Cedar +void AddHub(CEDAR *c, HUB *h) +{ + // Validate arguments + if (c == NULL || h == NULL) + { + return; + } + + LockHubList(c); + { +#if 0 + // We shall not check here the number of hub + if (LIST_NUM(c->HubList) >= MAX_HUBS) + { + // over limit + UnlockHubList(c); + return; + } +#endif + + // Confirm there is no hub which have same name + if (IsHub(c, h->Name)) + { + // exist + UnlockHubList(c); + return; + } + + // Register the hub + Insert(c->HubList, h); + AddRef(h->ref); + } + UnlockHubList(c); +} + +// Stop all hubs in Cedar +void StopAllHub(CEDAR *c) +{ + HUB **hubs; + UINT i, num; + // Validate arguments + if (c == NULL) + { + return; + } + + LockHubList(c); + { + hubs = ToArray(c->HubList); + num = LIST_NUM(c->HubList); + DeleteAll(c->HubList); + } + UnlockHubList(c); + + for (i = 0;i < num;i++) + { + StopHub(hubs[i]); + ReleaseHub(hubs[i]); + } + + Free(hubs); +} + +// Get reverse listener socket in Cedar +SOCK *GetReverseListeningSock(CEDAR *c) +{ + SOCK *s = NULL; + // Validate arguments + if (c == NULL) + { + return NULL; + } + + LockList(c->ListenerList); + { + UINT i; + for (i = 0;i < LIST_NUM(c->ListenerList);i++) + { + LISTENER *r = LIST_DATA(c->ListenerList, i); + + if (r->Protocol == LISTENER_REVERSE) + { + Lock(r->lock); + { + s = r->Sock; + + AddRef(s->ref); + } + Unlock(r->lock); + break; + } + } + } + UnlockList(c->ListenerList); + + return s; +} + +// Get in-process listener socket in Cedar +SOCK *GetInProcListeningSock(CEDAR *c) +{ + SOCK *s = NULL; + // Validate arguments + if (c == NULL) + { + return NULL; + } + + LockList(c->ListenerList); + { + UINT i; + for (i = 0;i < LIST_NUM(c->ListenerList);i++) + { + LISTENER *r = LIST_DATA(c->ListenerList, i); + + if (r->Protocol == LISTENER_INPROC) + { + Lock(r->lock); + { + s = r->Sock; + + if (s != NULL) + { + AddRef(s->ref); + } + } + Unlock(r->lock); + break; + } + } + } + UnlockList(c->ListenerList); + + return s; +} + +// Add a new listener to Cedar +void AddListener(CEDAR *c, LISTENER *r) +{ + // Validate arguments + if (c == NULL || r == NULL) + { + return; + } + + LockList(c->ListenerList); + { + Add(c->ListenerList, r); + AddRef(r->ref); + } + UnlockList(c->ListenerList); +} + +// Stop all listener in Cedar +void StopAllListener(CEDAR *c) +{ + LISTENER **array; + UINT i, num; + // Validate arguments + if (c == NULL) + { + return; + } + + LockList(c->ListenerList); + { + array = ToArray(c->ListenerList); + num = LIST_NUM(c->ListenerList); + DeleteAll(c->ListenerList); + } + UnlockList(c->ListenerList); + + for (i = 0;i < num;i++) + { + StopListener(array[i]); + ReleaseListener(array[i]); + } + Free(array); +} + +// Budget management functions +void CedarAddQueueBudget(CEDAR *c, int diff) +{ + // Validate arguments + if (c == NULL || diff == 0) + { + return; + } + + Lock(c->QueueBudgetLock); + { + int v = (int)c->QueueBudget; + v += diff; + c->QueueBudget = (UINT)v; + } + Unlock(c->QueueBudgetLock); +} +void CedarAddFifoBudget(CEDAR *c, int diff) +{ + // Validate arguments + if (c == NULL || diff == 0) + { + return; + } + + Lock(c->FifoBudgetLock); + { + int v = (int)c->FifoBudget; + v += diff; + c->FifoBudget = (UINT)v; + } + Unlock(c->FifoBudgetLock); +} +UINT CedarGetQueueBudgetConsuming(CEDAR *c) +{ + // Validate arguments + if (c == NULL) + { + return 0; + } + + return c->QueueBudget; +} +UINT CedarGetFifoBudgetConsuming(CEDAR *c) +{ + // Validate arguments + if (c == NULL) + { + return 0; + } + + return c->FifoBudget; +} +UINT CedarGetQueueBudgetBalance(CEDAR *c) +{ + UINT current = CedarGetQueueBudgetConsuming(c); + UINT budget = QUEUE_BUDGET; + + if (current <= budget) + { + return budget - current; + } + else + { + return 0; + } +} +UINT CedarGetFifoBudgetBalance(CEDAR *c) +{ + UINT current = CedarGetFifoBudgetConsuming(c); + UINT budget = FIFO_BUDGET; + + if (current <= budget) + { + return budget - current; + } + else + { + return 0; + } +} + +// Add the current TCP queue size +void CedarAddCurrentTcpQueueSize(CEDAR *c, int diff) +{ + // Validate arguments + if (c == NULL || diff == 0) + { + return; + } + + Lock(c->CurrentTcpQueueSizeLock); + { + int v = (int)c->CurrentTcpQueueSize; + v += diff; + c->CurrentTcpQueueSize = (UINT)v; + } + Unlock(c->CurrentTcpQueueSizeLock); +} + +// Get the current TCP queue size +UINT CedarGetCurrentTcpQueueSize(CEDAR *c) +{ + // Validate arguments + if (c == NULL) + { + return 0; + } + + return c->CurrentTcpQueueSize; +} + +// Stop Cedar +void StopCedar(CEDAR *c) +{ + // Validate arguments + if (c == NULL) + { + return; + } + + // Stop flag + c->Halt = true; + + // Stop all listener + StopAllListener(c); + // Stop all connections + StopAllConnection(c); + // Stop all hubs + StopAllHub(c); + // Free all virtual L3 switch + L3FreeAllSw(c); +} + +// Clean up Cedar +void CleanupCedar(CEDAR *c) +{ + UINT i; + // Validate arguments + if (c == NULL) + { + return; + } + + WuFreeWebUI(c->WebUI); + FreeCedarLayer3(c); + +/* + for (i = 0;i < LIST_NUM(c->HubList);i++) + { + HUB *h = LIST_DATA(c->HubList, i); + } +*/ + for (i = 0;i < LIST_NUM(c->CaList);i++) + { + X *x = LIST_DATA(c->CaList, i); + FreeX(x); + } + ReleaseList(c->CaList); + + ReleaseList(c->ListenerList); + ReleaseList(c->HubList); + ReleaseList(c->ConnectionList); + //CleanupUDPEntry(c); + ReleaseList(c->UDPEntryList); + DeleteLock(c->lock); + DeleteCounter(c->ConnectionIncrement); + DeleteCounter(c->CurrentSessions); + + if (c->DebugLog != NULL) + { + FreeLog(c->DebugLog); + } + + if (c->ServerX) + { + FreeX(c->ServerX); + } + if (c->ServerK) + { + FreeK(c->ServerK); + } + + if (c->CipherList) + { + Free(c->CipherList); + } + + for (i = 0;i < LIST_NUM(c->TrafficDiffList);i++) + { + TRAFFIC_DIFF *d = LIST_DATA(c->TrafficDiffList, i); + Free(d->Name); + Free(d->HubName); + Free(d); + } + + ReleaseList(c->TrafficDiffList); + + Free(c->ServerStr); + Free(c->MachineName); + + Free(c->HttpUserAgent); + Free(c->HttpAccept); + Free(c->HttpAcceptLanguage); + Free(c->HttpAcceptEncoding); + + FreeTraffic(c->Traffic); + + DeleteLock(c->TrafficLock); + + FreeNetSvcList(c); + + Free(c->VerString); + Free(c->BuildInfo); + + FreeLocalBridgeList(c); + + DeleteCounter(c->AssignedBridgeLicense); + DeleteCounter(c->AssignedClientLicense); + + FreeNoSslList(c); + + DeleteLock(c->CedarSuperLock); + + DeleteCounter(c->AcceptingSockets); + + ReleaseIntList(c->UdpPortList); + + DeleteLock(c->OpenVPNPublicPortsLock); + + DeleteLock(c->CurrentRegionLock); + + DeleteLock(c->CurrentTcpQueueSizeLock); + DeleteLock(c->QueueBudgetLock); + DeleteLock(c->FifoBudgetLock); + + DeleteCounter(c->CurrentActiveLinks); + + Free(c); +} + +// Release reference of the Cedar +void ReleaseCedar(CEDAR *c) +{ + // Validate arguments + if (c == NULL) + { + return; + } + + if (Release(c->ref) == 0) + { + CleanupCedar(c); + } +} + +// Set cipher list entry +void SetCedarCipherList(CEDAR *cedar, char *name) +{ + // Validate arguments + if (cedar == NULL) + { + return; + } + + if (cedar->CipherList != NULL) + { + Free(cedar->CipherList); + } + if (name != NULL) + { + cedar->CipherList = CopyStr(name); + } + else + { + cedar->CipherList = NULL; + } +} + +// Compare net service list entries +int CompareNetSvc(void *p1, void *p2) +{ + NETSVC *n1, *n2; + if (p1 == NULL || p2 == NULL) + { + return 0; + } + n1 = *(NETSVC **)p1; + n2 = *(NETSVC **)p2; + if (n1 == NULL || n2 == NULL) + { + return 0; + } + if (n1->Port > n2->Port) + { + return 1; + } + else if (n1->Port < n2->Port) + { + return -1; + } + else if (n1->Udp > n2->Udp) + { + return 1; + } + else if (n1->Udp < n2->Udp) + { + return -1; + } + return 0; +} + +// Initialize net service list +void InitNetSvcList(CEDAR *cedar) +{ + char filename[MAX_PATH] = "/etc/services"; + BUF *b; + // Validate arguments + if (cedar == NULL) + { + return; + } + +#ifdef OS_WIN32 + Format(filename, sizeof(filename), "%s\\drivers\\etc\\services", MsGetSystem32Dir()); +#endif + + cedar->NetSvcList = NewList(CompareNetSvc); + + b = ReadDump(filename); + if (b == NULL) + { + return; + } + + while (true) + { + char *s = CfgReadNextLine(b); + if (s == NULL) + { + break; + } + + Trim(s); + if (s[0] != '#') + { + TOKEN_LIST *t = ParseToken(s, " \t/"); + if (t->NumTokens >= 3) + { + NETSVC *n = ZeroMalloc(sizeof(NETSVC)); + n->Name = CopyStr(t->Token[0]); + n->Udp = (StrCmpi(t->Token[2], "udp") == 0 ? true : false); + n->Port = ToInt(t->Token[1]); + Add(cedar->NetSvcList, n); + } + FreeToken(t); + } + Free(s); + } + + FreeBuf(b); +} + +// Get net service name +char *GetSvcName(CEDAR *cedar, bool udp, UINT port) +{ + char *ret = NULL; + NETSVC t; + // Validate arguments + if (cedar == NULL) + { + return NULL; + } + + t.Udp = (udp == 0 ? false : true); + t.Port = port; + + LockList(cedar->NetSvcList); + { + NETSVC *n = Search(cedar->NetSvcList, &t); + if (n != NULL) + { + ret = n->Name; + } + } + UnlockList(cedar->NetSvcList); + + return ret; +} + +// Free net service list +void FreeNetSvcList(CEDAR *cedar) +{ + UINT i; + // Validate arguments + if (cedar == NULL) + { + return; + } + + for (i = 0;i < LIST_NUM(cedar->NetSvcList);i++) + { + NETSVC *n = LIST_DATA(cedar->NetSvcList, i); + Free(n->Name); + Free(n); + } + ReleaseList(cedar->NetSvcList); +} + +// Change certificate of Cedar +void SetCedarCert(CEDAR *c, X *server_x, K *server_k) +{ + // Validate arguments + if (server_x == NULL || server_k == NULL) + { + return; + } + + Lock(c->lock); + { + if (c->ServerX != NULL) + { + FreeX(c->ServerX); + } + + if (c->ServerK != NULL) + { + FreeK(c->ServerK); + } + + c->ServerX = CloneX(server_x); + c->ServerK = CloneK(server_k); + } + Unlock(c->lock); +} + +// Set the Cedar into VPN Bridge mode +void SetCedarVpnBridge(CEDAR *c) +{ + // Validate arguments + if (c == NULL) + { + return; + } + + c->Bridge = true; + + Free(c->ServerStr); + c->ServerStr = CopyStr(CEDAR_BRIDGE_STR); +} + +void CedarForceLink() +{ +} + +// Get version of the Cedar +void GetCedarVersion(char *tmp, UINT size) +{ + // Validate arguments + if (tmp == NULL) + { + return; + } + + Format(tmp, size, "%u.%02u.%u", CEDAR_VERSION_MAJOR, CEDAR_VERSION_MINOR, CEDAR_VERSION_BUILD); +} + +UINT GetCedarVersionNumber() +{ + return CEDAR_VERSION_MAJOR * 100 + CEDAR_VERSION_MINOR; +} + +// Create Cedar object +CEDAR *NewCedar(X *server_x, K *server_k) +{ + CEDAR *c; + char tmp[MAX_SIZE]; + char tmp2[MAX_SIZE]; + char *beta_str; + + CedarForceLink(); + + c = ZeroMalloc(sizeof(CEDAR)); + + c->CurrentActiveLinks = NewCounter(); + + c->AcceptingSockets = NewCounter(); + + c->CedarSuperLock = NewLock(); + + c->CurrentRegionLock = NewLock(); + +#ifdef BETA_NUMBER + c->Beta = BETA_NUMBER; +#endif // BETA_NUMBER + + InitNoSslList(c); + + c->AssignedBridgeLicense = NewCounter(); + c->AssignedClientLicense = NewCounter(); + + c->CurrentTcpQueueSizeLock = NewLock(); + c->QueueBudgetLock = NewLock(); + c->FifoBudgetLock = NewLock(); + + Rand(c->UniqueId, sizeof(c->UniqueId)); + + c->CreatedTick = Tick64(); + + c->lock = NewLock(); + c->ref = NewRef(); + + c->OpenVPNPublicPortsLock = NewLock(); + c->CurrentTcpConnections = GetNumTcpConnectionsCounter(); + + c->ListenerList = NewList(CompareListener); + c->UDPEntryList = NewList(CompareUDPEntry); + c->HubList = NewList(CompareHub); + c->ConnectionList = NewList(CompareConnection); + + c->ConnectionIncrement = NewCounter(); + c->CurrentSessions = NewCounter(); + + if (server_k && server_x) + { + c->ServerK = CloneK(server_k); + c->ServerX = CloneX(server_x); + } + + c->Version = GetCedarVersionNumber(); + c->Build = CEDAR_VERSION_BUILD; + c->ServerStr = CopyStr(CEDAR_SERVER_STR); + + GetMachineName(tmp, sizeof(tmp)); + c->MachineName = CopyStr(tmp); + + c->HttpUserAgent = CopyStr(DEFAULT_USER_AGENT); + c->HttpAccept = CopyStr(DEFAULT_ACCEPT); + c->HttpAcceptLanguage = CopyStr("ja"); + c->HttpAcceptEncoding = CopyStr(DEFAULT_ENCODING); + + c->Traffic = NewTraffic(); + c->TrafficLock = NewLock(); + c->CaList = NewList(CompareCert); + + c->TrafficDiffList = NewList(NULL); + + SetCedarCipherList(c, SERVER_DEFAULT_CIPHER_NAME); + + c->ClientId = _II("CLIENT_ID"); + + c->UdpPortList = NewIntList(false); + + c->DhParamBits = DH_PARAM_BITS_DEFAULT; + + InitNetSvcList(c); + + InitLocalBridgeList(c); + + InitCedarLayer3(c); + + c->WebUI = WuNewWebUI(c); + +#ifdef ALPHA_VERSION + beta_str = "Alpha"; +#else // ALPHA_VERSION +#ifndef RELEASE_CANDIDATE + beta_str = "Beta"; +#else // RELEASE_CANDIDATE + beta_str = "Release Candidate"; +#endif // RELEASE_CANDIDATE +#endif // ALPHA_VERSION + + ToStr(tmp2, c->Beta); + + Format(tmp, sizeof(tmp), "Version %u.%02u Build %u %s %s (%s)", + CEDAR_VERSION_MAJOR, CEDAR_VERSION_MINOR, CEDAR_VERSION_BUILD, + c->Beta == 0 ? "" : beta_str, + c->Beta == 0 ? "" : tmp2, + _SS("LANGSTR")); + Trim(tmp); + + if (true) + { + SYSTEMTIME st; + Zero(&st, sizeof(st)); + + st.wYear = BUILD_DATE_Y; + st.wMonth = BUILD_DATE_M; + st.wDay = BUILD_DATE_D; + + c->BuiltDate = SystemToUINT64(&st); + } + + c->VerString = CopyStr(tmp); + + Format(tmp, sizeof(tmp), "Compiled %04u/%02u/%02u %02u:%02u:%02u by %s at %s", + BUILD_DATE_Y, BUILD_DATE_M, BUILD_DATE_D, BUILD_DATE_HO, BUILD_DATE_MI, BUILD_DATE_SE, BUILDER_NAME, BUILD_PLACE); + + c->BuildInfo = CopyStr(tmp); + + return c; +} + +// Cumulate traffic size +void AddTraffic(TRAFFIC *dst, TRAFFIC *diff) +{ + // Validate arguments + if (dst == NULL || diff == NULL) + { + return; + } + + dst->Recv.BroadcastBytes += diff->Recv.BroadcastBytes; + dst->Recv.BroadcastCount += diff->Recv.BroadcastCount; + dst->Recv.UnicastBytes += diff->Recv.UnicastBytes; + dst->Recv.UnicastCount += diff->Recv.UnicastCount; + + dst->Send.BroadcastBytes += diff->Send.BroadcastBytes; + dst->Send.BroadcastCount += diff->Send.BroadcastCount; + dst->Send.UnicastBytes += diff->Send.UnicastBytes; + dst->Send.UnicastCount += diff->Send.UnicastCount; +} + +// Create new traffic size object +TRAFFIC *NewTraffic() +{ + TRAFFIC *t; + + t = ZeroMalloc(sizeof(TRAFFIC)); + return t; +} + +// Free traffic size object +void FreeTraffic(TRAFFIC *t) +{ + // Validate arguments + if (t == NULL) + { + return; + } + + Free(t); +} + +// Initialize Cedar communication module +void InitCedar() +{ + if ((init_cedar_counter++) > 0) + { + return; + } + + // Initialize protocol module + InitProtocol(); +} + +// Free Cedar communication module +void FreeCedar() +{ + if ((--init_cedar_counter) > 0) + { + return; + } + + // Free protocol module + FreeProtocol(); +} + diff --git a/src/Cedar/Cedar.h b/src/Cedar/Cedar.h index 6d2f6b23..cea87611 100644 --- a/src/Cedar/Cedar.h +++ b/src/Cedar/Cedar.h @@ -1,1186 +1,1186 @@ -// SoftEther VPN Source Code - Developer Edition Master Branch -// Cedar Communication Module -// © 2020 Nokia - -// Cedar.h -// Header of Cedar.c - -#ifndef CEDAR_H -#define CEDAR_H - - -////////////////////////////////////////////////////////////////////// -// -// Products related constants -// -////////////////////////////////////////////////////////////////////// - -// Replace the function name -#ifdef VPN_SPEED - -#define DecryptSecurePacket __dsp -#define CreateSecurePacket __csp -#define GetSecureRandomSize __gsrs - -#endif // VPN_SPEED - -#define bool UINT -#define BOOL UINT - - -// Version number -#ifndef CEDAR_VERSION_MAJOR -#define CEDAR_VERSION_MAJOR 0 -#endif // CEDAR_VERSION_MAJOR - -#ifndef CEDAR_VERSION_MINOR -#define CEDAR_VERSION_MINOR 0 -#endif // CEDAR_VER_MINOR - -// Build number -#ifndef CEDAR_VERSION_BUILD -#define CEDAR_VERSION_BUILD 0 -#endif // CEDAR_VERSION_BUILD - -// Beta number -//#define BETA_NUMBER 3 - -// RC or not -#define RELEASE_CANDIDATE - -// Specify the name of the person in charge building -#ifndef BUILDER_NAME -#define BUILDER_NAME "Unknown" -#endif // BUILDER_NAME - -// Specify the location to build -#ifndef BUILD_PLACE -#define BUILD_PLACE "Unknown" -#endif // BUILD_PLACE - -// Specifies the build date -#ifndef BUILD_DATE_Y -#define BUILD_DATE_Y 1970 -#endif // BUILD_DATE_Y - -#ifndef BUILD_DATE_M -#define BUILD_DATE_M 1 -#endif // BUILD_DATE_M - -#ifndef BUILD_DATE_D -#define BUILD_DATE_D 1 -#endif // BUILD_DATE_D - -#ifndef BUILD_DATE_HO -#define BUILD_DATE_HO 0 -#endif // BUILD_DATE_HO - -#ifndef BUILD_DATE_MI -#define BUILD_DATE_MI 0 -#endif // BUILD_DATE_MI - -#ifndef BUILD_DATE_SE -#define BUILD_DATE_SE 0 -#endif // BUILD_DATE_SE - -// Tolerable time difference -#define ALLOW_TIMESTAMP_DIFF (UINT64)(3 * 24 * 60 * 60 * 1000) - - -// Configuration of communication related control switch -#define USE_DOS_ATTACK_DETECTION // Enable the DOS attack detection -//#define USE_SECURE_PACKET // Enable the scrambled packet - -// Designate the IDS detection signatures -#define CEDAR_SIGNATURE_STR "SE-VPN4-PROTOCOL" - -// Default RSA certificate name of the smart card -#define SECURE_DEFAULT_CERT_NAME "VPN_RSA_CERT" - -// Default RSA private key name of the smart card -#define SECURE_DEFAULT_KEY_NAME "VPN_RSA_KEY" - -// Hidden password string of 8 characters -#define HIDDEN_PASSWORD "********" - -// Default separator character for the hub name in the username -#define DEFAULT_USERNAME_HUB_SEPARATOR '@' - - -////////////////////////////////////////////////////////////////////// -// -// Definition of the maximum length of various string -// -////////////////////////////////////////////////////////////////////// - -#define MAX_ACCOUNT_NAME_LEN 255 // Maximum account name length -#define MAX_USERNAME_LEN 255 // User name maximum length -#define MAX_PASSWORD_LEN 255 // Password name maximum length -#define MAX_SERVER_STR_LEN 255 // Maximum length of server string -#define MAX_CLIENT_STR_LEN 255 // Maximum length of client string -#define MAX_HUBNAME_LEN 255 // Maximum length of HUB name -#define MAX_SESSION_NAME_LEN 255 // Session name maximum length -#define MAX_CONNECTION_NAME_LEN 255 // Maximum length of connection name -#define MAX_DEVICE_NAME_LEN 31 // Device name maximum length -#define MAX_DEVICE_NAME_LEN_9X 4 // Maximum length of Virtual LAN card name in Win9x -#define MAX_ACCESSLIST_NOTE_LEN 255 // Maximum length of the note of access list entry -#define MAX_SECURE_DEVICE_FILE_LEN 255 // Secure device file name maximum length -#define MAX_ADMIN_OPTION_NAME_LEN 63 // Management option name -#define MAX_REDIRECT_URL_LEN 255 // URL length to redirect - - -////////////////////////////////////////////////////////////////////// -// -// Server and session management related constants -// -////////////////////////////////////////////////////////////////////// - -#define SERVER_MAX_SESSIONS 4096 // Maximum number of sessions that the server supports -#define SERVER_MAX_SESSIONS_FOR_CARRIER_EDITION 100000 // Maximum number of sessions that the server supports (Carrier Edition) -#define NAT_MAX_SESSIONS 4096 // Maximum number of sessions that are supported by NAT -#define NAT_MAX_SESSIONS_KERNEL 65536 // Maximum number of sessions that are supported by NAT (In the case of kernel-mode NAT) -#define MAX_HUBS 4096 // The maximum number of virtual HUB -#define MAX_HUBS_FOR_CARRIER_EDITION 100000 // The maximum number of virtual HUB (Carrier Edition) -#define MAX_ACCESSLISTS (4096 * 8) // Maximum number of access list entries -#define MAX_USERS 10000 // The maximum number of users -#define MAX_GROUPS 10000 // Maximum number of groups -#define MAX_MAC_TABLES VPN_GP(GP_MAX_MAC_TABLES, 65536) // Maximum number of MAC address table entries -#define MAX_IP_TABLES VPN_GP(GP_MAX_IP_TABLES, 65536) // Maximum number of IP address table entries -#define MAX_HUB_CERTS 4096 // Maximum number of Root CA that can be registered -#define MAX_HUB_CRLS 4096 // Maximum number of CRL that can be registered -#define MAX_HUB_ACS 4096 // Maximum number of AC that can be registered -#define MAX_HUB_LINKS VPN_GP(GP_MAX_HUB_LINKS, 1024) // Maximum number of Cascade that can be registered -#define MAX_HUB_ADMIN_OPTIONS 4096 // Maximum number of Virtual HUB management options that can be registered - -#ifndef USE_STRATEGY_LOW_MEMORY -#define MEM_FIFO_REALLOC_MEM_SIZE VPN_GP(GP_MEM_FIFO_REALLOC_MEM_SIZE, (65536 * 10)) -#define QUEUE_BUDGET VPN_GP(GP_QUEUE_BUDGET, 2048) -#define FIFO_BUDGET VPN_GP(GP_FIFO_BUDGET, 1600 * 1600 * 4) -#else // USE_STRATEGY_LOW_MEMORY -#define MEM_FIFO_REALLOC_MEM_SIZE VPN_GP(GP_MEM_FIFO_REALLOC_MEM_SIZE, (65536)) -#define QUEUE_BUDGET VPN_GP(GP_QUEUE_BUDGET, 1024) -#define FIFO_BUDGET VPN_GP(GP_FIFO_BUDGET, 1000000) -#endif // USE_STRATEGY_LOW_MEMORY - -#define MAX_PACKET_SIZE 1600 // Maximum packet size -#define UDP_BUF_SIZE (32 * 1024) // Aim of the UDP packet size - -#ifndef USE_STRATEGY_LOW_MEMORY -#define MAX_SEND_SOCKET_QUEUE_SIZE VPN_GP(GP_MAX_SEND_SOCKET_QUEUE_SIZE, (1600 * 1600 * 1)) // Maximum transmit queue size -#define MIN_SEND_SOCKET_QUEUE_SIZE VPN_GP(GP_MIN_SEND_SOCKET_QUEUE_SIZE, (1600 * 200 * 1)) // Minimum transmit queue size -#define MAX_STORED_QUEUE_NUM VPN_GP(GP_MAX_STORED_QUEUE_NUM, 1024) // The number of queues that can be stored in each session -#define MAX_BUFFERING_PACKET_SIZE VPN_GP(GP_MAX_BUFFERING_PACKET_SIZE, (1600 * 1600)) // Maximum packet size can be buffered -#else // USE_STRATEGY_LOW_MEMORY -#define MAX_SEND_SOCKET_QUEUE_SIZE VPN_GP(GP_MAX_SEND_SOCKET_QUEUE_SIZE, (1600 * 200 * 1)) // Maximum transmit queue size -#define MIN_SEND_SOCKET_QUEUE_SIZE VPN_GP(GP_MIN_SEND_SOCKET_QUEUE_SIZE, (1600 * 50 * 1)) // Minimum transmit queue size -#define MAX_STORED_QUEUE_NUM VPN_GP(GP_MAX_STORED_QUEUE_NUM, 384) // The number of queues that can be stored in each session -#define MAX_BUFFERING_PACKET_SIZE VPN_GP(GP_MAX_BUFFERING_PACKET_SIZE, (1600 * 300 * 1)) // Maximum packet size can be buffered -#endif // USE_STRATEGY_LOW_MEMORY - -#define MAX_SEND_SOCKET_QUEUE_NUM VPN_GP(GP_MAX_SEND_SOCKET_QUEUE_NUM, 128) // Maximum number of transmission queue items per processing -#define MAX_TCP_CONNECTION 32 // The maximum number of TCP connections -#define NUM_TCP_CONNECTION_FOR_UDP_RECOVERY 2 // Maximum number of connections when using UDP recovery -#define SELECT_TIME VPN_GP(GP_SELECT_TIME, 256) -#define SELECT_TIME_FOR_NAT VPN_GP(GP_SELECT_TIME_FOR_NAT, 30) -#define SELECT_TIME_FOR_DELAYED_PKT 1 // If there is a delayed packet - -#define TIMEOUT_MIN (5 * 1000) // Minimum timeout in seconds -#define TIMEOUT_MAX (60 * 1000) // Maximum timeout in seconds -#define TIMEOUT_DEFAULT (30 * 1000) // Default number of seconds to timeout -#define CONNECTING_TIMEOUT (15 * 1000) // Timeout in seconds of being connected -#define CONNECTING_POOLING_SPAN (3 * 1000) // Polling interval of connected -#define MIN_RETRY_INTERVAL (5 * 1000) // Minimum retry interval -#define MAX_RETRY_INTERVAL (300 * 1000) // Maximum retry interval -#define RETRY_INTERVAL_SPECIAL (60 * 1000) // Reconnection interval of a special case - -#define MAX_ADDITIONAL_CONNECTION_FAILED_COUNTER 16 // Allowable number that can be serially failed to additional connection -#define ADDITIONAL_CONNECTION_COUNTER_RESET_INTERVAL (30 * 60 * 1000) // Reset period of additional connection failure counter - -#define MAC_MIN_LIMIT_COUNT 3 // Minimum number of MAC addresses -#define IP_MIN_LIMIT_COUNT 4 // Number of IPv4 addresses minimum -#define IP_MIN_LIMIT_COUNT_V6 5 // Number of IPv6 addresses minimum -#define IP_LIMIT_WHEN_NO_ROUTING_V6 15 // Maximum number of IPv6 addresses when NoRouting policy is enabled - -#define MAC_TABLE_EXCLUSIVE_TIME (13 * 1000) // Period that can occupy the MAC address -#define IP_TABLE_EXCLUSIVE_TIME (13 * 1000) // Period that can occupy the IP address -#define MAC_TABLE_EXPIRE_TIME VPN_GP(GP_MAC_TABLE_EXPIRE_TIME, (600 * 1000)) // MAC address table expiration time -#define IP_TABLE_EXPIRE_TIME VPN_GP(GP_IP_TABLE_EXPIRE_TIME, (60 * 1000)) // IP address table expiration time -#define IP_TABLE_EXPIRE_TIME_DHCP VPN_GP(GP_IP_TABLE_EXPIRE_TIME_DHCP, (5 * 60 * 1000)) // IP address table expiration time (In the case of DHCP) -#define HUB_ARP_SEND_INTERVAL VPN_GP(GP_HUB_ARP_SEND_INTERVAL, (5 * 1000)) // ARP packet transmission interval (alive check) - -#define LIMITER_SAMPLING_SPAN 1000 // Sampling interval of the traffic limiting device - -#define STORM_CHECK_SPAN VPN_GP(GP_STORM_CHECK_SPAN, 500) // Broadcast storm check interval -#define STORM_DISCARD_VALUE_START VPN_GP(GP_STORM_DISCARD_VALUE_START, 3) // Broadcast packet discard value start value -#define STORM_DISCARD_VALUE_END VPN_GP(GP_STORM_DISCARD_VALUE_END, 1024) // Broadcast packet discard value end value - -#define KEEP_INTERVAL_MIN 5 // Packet transmission interval minimum value -#define KEEP_INTERVAL_DEFAULT 50 // Packet transmission interval default value -#define KEEP_INTERVAL_MAX 600 // Packet transmission interval maximum value -#define KEEP_TCP_TIMEOUT 1000 // TCP time-out value - -#define TICKET_EXPIRES (60 * 1000) // Expiration date of ticket - -#define SEND_KILL_NUM_X 256 // Number of 'X' characters to send the Kill - - -#define FARM_BASE_POINT 100000 // Reference value of the cluster score -#define FARM_DEFAULT_WEIGHT 100 // Standard performance ratio - -#define DH_PARAM_BITS_DEFAULT 2048 // Bits of Diffie-Hellman Parameters - - -#define SE_UDP_SIGN "SE2P" // Not used (only old UDP mode) - -// R-UDP service name -#define VPN_RUDP_SVC_NAME "SoftEther_VPN" - -// Traffic information update interval -#define INCREMENT_TRAFFIC_INTERVAL (10 * 1000) - -// State of the client session -#define CLIENT_STATUS_CONNECTING 0 // Connecting -#define CLIENT_STATUS_NEGOTIATION 1 // Negotiating -#define CLIENT_STATUS_AUTH 2 // During user authentication -#define CLIENT_STATUS_ESTABLISHED 3 // Connection complete -#define CLIENT_STATUS_RETRY 4 // Wait to retry -#define CLIENT_STATUS_IDLE 5 // Idle state - -// Expiration date of the black list -#define BLACK_LIST_EXPIRES (30 * 10000) - -// Number Blacklist entries -#define MAX_BLACK_LIST 4096 -#define BLACK_LIST_CHECK_SPAN 1000 - -// Blocks to be transmitted at one during the file transfer -#define FTP_BLOCK_SIZE (640 * 1024) - -// Syslog configuration -#define SYSLOG_NONE 0 // Do not use syslog -#define SYSLOG_SERVER_LOG 1 // Only server log -#define SYSLOG_SERVER_AND_HUB_SECURITY_LOG 2 // Server and Virtual HUB security log -#define SYSLOG_SERVER_AND_HUB_ALL_LOG 3 // Server, Virtual HUB security, and packet log - -#define SYSLOG_PORT 514 // Syslog port number -#define SYSLOG_POLL_IP_INTERVAL (UINT64)(3600 * 1000) // Interval to examine the IP address -#define SYSLOG_POLL_IP_INTERVAL_NG (UINT64)(60 * 1000) // Interval to examine the IP address (previous failure) - -////////////////////////////////////////////////////////////////////// -// -// Connection-related constant -// -////////////////////////////////////////////////////////////////////// - -// Internet connection maintenance function (KeepAlive) - -#define KEEP_RETRY_INTERVAL (60 * 1000) // Reconnection interval on connection failure -#define KEEP_MIN_PACKET_SIZE 1 // Minimum packet size -#define KEEP_MAX_PACKET_SIZE 128 // Maximum packet size -#define KEEP_POLLING_INTERVAL 250 // KEEP polling interval - -// Constants -#define RECV_BUF_SIZE 65536 // Buffer size to be received at a time - -// Type of proxy -#define PROXY_DIRECT 0 // Direct TCP connection -#define PROXY_HTTP 1 // Connection via HTTP proxy server -#define PROXY_SOCKS 2 // Connection via SOCKS4 proxy server -#define PROXY_SOCKS5 3 // Connection via SOCKS5 proxy server - -// Direction of data flow -#define TCP_BOTH 0 // Bi-directional -#define TCP_SERVER_TO_CLIENT 1 // Only server -> client direction -#define TCP_CLIENT_TO_SERVER 2 // Only client -> server direction - -// Type of connection -#define CONNECTION_TYPE_CLIENT 0 // Client -#define CONNECTION_TYPE_INIT 1 // During initialization -#define CONNECTION_TYPE_LOGIN 2 // Login connection -#define CONNECTION_TYPE_ADDITIONAL 3 // Additional connection -#define CONNECTION_TYPE_FARM_RPC 4 // RPC for server farm -#define CONNECTION_TYPE_ADMIN_RPC 5 // RPC for Management -#define CONNECTION_TYPE_ENUM_HUB 6 // HUB enumeration -#define CONNECTION_TYPE_PASSWORD 7 // Password change -#define CONNECTION_TYPE_OTHER 0xffffffff // E.g. Third-party protocol - -// Protocol -#define CONNECTION_TCP 0 // TCP protocol -#define CONNECTION_UDP 1 // UDP protocol -#define CONNECTION_HUB_LAYER3 6 // Layer-3 switch session -#define CONNECTION_HUB_BRIDGE 7 // Bridge session -#define CONNECTION_HUB_SECURE_NAT 8 // Secure NAT session -#define CONNECTION_HUB_LINK_SERVER 9 // HUB link session - - -// Status -#define CONNECTION_STATUS_ACCEPTED 0 // The connection is accepted (client side) -#define CONNECTION_STATUS_NEGOTIATION 1 // Negotiating -#define CONNECTION_STATUS_USERAUTH 2 // During user authentication -#define CONNECTION_STATUS_ESTABLISHED 3 // Connection has been established -#define CONNECTION_STATUS_CONNECTING 0 // Connecting (client side) - -// Magic number of KeepAlive packet -#define KEEP_ALIVE_MAGIC 0xffffffff -#define MAX_KEEPALIVE_SIZE 512 - - - -////////////////////////////////////////////////////////////////////// -// -// Virtual HUB-related constant -// -////////////////////////////////////////////////////////////////////// - -#define SE_HUB_MAC_ADDR_SIGN 0xAE // Sign virtual HUB MAC address - -// Traffic difference value -#define TRAFFIC_DIFF_USER 0 // User -#define TRAFFIC_DIFF_HUB 1 // Virtual HUB -#define MAX_TRAFFIC_DIFF 30000 // Maximum number of items - -// Type of HUB -#define HUB_TYPE_STANDALONE 0 // Stand-alone HUB -#define HUB_TYPE_FARM_STATIC 1 // Static HUB -#define HUB_TYPE_FARM_DYNAMIC 2 // Dynamic HUB - -// Related to delay, jitter, packet loss in the access list -#define HUB_ACCESSLIST_DELAY_MAX 10000 // Maximum delay -#define HUB_ACCESSLIST_JITTER_MAX 100 // Maximum jitter -#define HUB_ACCESSLIST_LOSS_MAX 100 // Maximum packet loss - -// Message related -#define HUB_MAXMSG_LEN 20000 // The maximum number of characters in a message - - - -////////////////////////////////////////////////////////////////////// -// -// Type of user authentication -// -////////////////////////////////////////////////////////////////////// - -// Constant in the server-side -#define AUTHTYPE_ANONYMOUS 0 // Anonymous authentication -#define AUTHTYPE_PASSWORD 1 // Password authentication -#define AUTHTYPE_USERCERT 2 // User certificate authentication -#define AUTHTYPE_ROOTCERT 3 // Root certificate which is issued by trusted Certificate Authority -#define AUTHTYPE_RADIUS 4 // Radius authentication -#define AUTHTYPE_NT 5 // Windows NT authentication -#define AUTHTYPE_OPENVPN_CERT 98 // TLS client certificate authentication -#define AUTHTYPE_TICKET 99 // Ticket authentication - -// Constant of the client side -#define CLIENT_AUTHTYPE_ANONYMOUS 0 // Anonymous authentication -#define CLIENT_AUTHTYPE_PASSWORD 1 // Password authentication -#define CLIENT_AUTHTYPE_PLAIN_PASSWORD 2 // Plain password authentication -#define CLIENT_AUTHTYPE_CERT 3 // Certificate authentication -#define CLIENT_AUTHTYPE_SECURE 4 // Secure device authentication -#define CLIENT_AUTHTYPE_OPENSSLENGINE 5 // Openssl engine authentication - - - -////////////////////////////////////////////////////////////////////// -// -// TCP listener related constants -// -////////////////////////////////////////////////////////////////////// - -// Retries in case it fails to Listen -#define LISTEN_RETRY_TIME (2 * 1000) // If fail to Listen normally -#define LISTEN_RETRY_TIME_NOIPV6 (60 * 1000) // If IPv6 support is disabled - -#define DOS_TABLE_EXPIRES_FIRST 250 // Initial value of the expiration date of DOS attack list -#define DOS_TABLE_EXPIRES_MAX 1000 // Maximum value of the expiration date of DOS attack list -#define DOS_TABLE_REFRESH_INTERVAL (10 * 1000) // Interval to update the DOS attack list -#define DOS_TABLE_MAX_LIMIT_PER_IP 16 // Accessible number per an IP -#define DOS_TABLE_EXPIRES_TOTAL (3000 * 1000) // Time to force delete the entry - - -// Protocol to be used for the listener -#define LISTENER_TCP 0 // TCP/IP -#define LISTENER_UDP 1 // UDP/IP (not being used) -#define LISTENER_INPROC 2 // In-process communication -#define LISTENER_RUDP 3 // R-UDP with NAT-T -#define LISTENER_ICMP 4 // VPN over ICMP -#define LISTENER_DNS 5 // VPN over DNS -#define LISTENER_REVERSE 6 // Reverse socket - -// Status of the listener -#define LISTENER_STATUS_TRYING 0 // While attempting -#define LISTENER_STATUS_LISTENING 1 // Listening - -// Largest packet size of UDP -#define UDP_PACKET_SIZE 65536 - -// Number of standard connections per IP address -#define DEFAULT_MAX_CONNECTIONS_PER_IP 256 -#define MIN_MAX_CONNECTIONS_PER_IP 10 // Minimum value - -// Allowed number of outstanding connections -#define DEFAULT_MAX_UNESTABLISHED_CONNECTIONS 1000 -#define MIN_MAX_UNESTABLISHED_CONNECTIONS 30 // Minimum value - - -////////////////////////////////////////////////////////////////////// -// -// Log related constant -// -////////////////////////////////////////////////////////////////////// - -#define LOG_ENGINE_SAVE_START_CACHE_COUNT 100000 // Number to start saving forcibly -#define LOG_ENGINE_BUFFER_CACHE_SIZE_MAX (10 * 1024 * 1024) // Write cache size - -// Constant such as a file name -// -// These placeholders will be replaced in InnerFilePathW(). -// -// @ - placeholder for LogDir -// $ - placeholder for DbDir (config directory) -// -#define SERVER_LOG_DIR "server_log" -#define SERVER_LOG_DIR_NAME "@"SERVER_LOG_DIR -#define BRIDGE_LOG_DIR_NAME SERVER_LOG_DIR_NAME -#define SERVER_LOG_PERFIX "vpn" - -#define HUB_SECURITY_LOG_DIR "security_log" -#define HUB_SECURITY_LOG_DIR_NAME "@"HUB_SECURITY_LOG_DIR -#define HUB_SECURITY_LOG_FILE_NAME HUB_SECURITY_LOG_DIR_NAME"/%s" -#define HUB_SECURITY_LOG_PREFIX "sec" -#define HUB_PACKET_LOG_DIR "packet_log" -#define HUB_PACKET_LOG_DIR_NAME "@"HUB_PACKET_LOG_DIR -#define HUB_PACKET_LOG_FILE_NAME HUB_PACKET_LOG_DIR_NAME"/%s" -#define HUB_PACKET_LOG_PREFIX "pkt" - -#define NAT_LOG_DIR "secure_nat_log" -#define NAT_LOG_DIR_NAME "@"NAT_LOG_DIR -#define NAT_LOG_FILE_NAME NAT_LOG_DIR_NAME"/%s" -#define NAT_LOG_PREFIX "snat" - -#define CLIENT_LOG_DIR_NAME "@client_log" -#define CLIENT_LOG_PREFIX "client" - -// Packet log settings -#define NUM_PACKET_LOG 16 -#define PACKET_LOG_TCP_CONN 0 // TCP connection log -#define PACKET_LOG_TCP 1 // TCP packet log -#define PACKET_LOG_DHCP 2 // DHCP Log -#define PACKET_LOG_UDP 3 // UDP log -#define PACKET_LOG_ICMP 4 // ICMP log -#define PACKET_LOG_IP 5 // IP log -#define PACKET_LOG_ARP 6 // ARP log -#define PACKET_LOG_ETHERNET 7 // Ethernet log - -#define PACKET_LOG_NONE 0 // Not save -#define PACKET_LOG_HEADER 1 // Only header -#define PACKET_LOG_ALL 2 // Store also data - -// Timing of log switching -#define LOG_SWITCH_NO 0 // No switching -#define LOG_SWITCH_SECOND 1 // Secondly basis -#define LOG_SWITCH_MINUTE 2 // Minutely basis -#define LOG_SWITCH_HOUR 3 // Hourly basis -#define LOG_SWITCH_DAY 4 // Daily basis -#define LOG_SWITCH_MONTH 5 // Monthly basis - -// Minimum amount of free disk space -#define DISK_FREE_SPACE_MIN 1048576 // 1 MBytes -#define DISK_FREE_SPACE_DEFAULT (DISK_FREE_SPACE_MIN * 100) // 100 Mbytes -#define DISK_FREE_SPACE_DEFAULT_WINDOWS ((UINT64)(8ULL * 1024ULL * 1024ULL * 1024ULL)) // 8GBytes - -// Interval to check the free space -#define DISK_FREE_CHECK_INTERVAL_DEFAULT (5 * 60 * 1000) - -// Simple log -#define TINY_LOG_DIRNAME "@tiny_log" -#define TINY_LOG_FILENAME "@tiny_log/%04u%02u%02u_%02u%02u%02u.log" - - -////////////////////////////////////////////////////////////////////// -// -// Constant related to Carrier Edition -// -////////////////////////////////////////////////////////////////////// - -#define CE_SNAPSHOT_INTERVAL ((UINT64)(3600 * 1000)) -//#define CE_SNAPSHOT_INTERVAL ((UINT64)(3000)) -#define CE_SNAPSHOT_POLLING_INTERVAL (1 * 1000) -#define CE_SNAPSHOT_POLLING_INTERVAL_LICENSE (30 * 1000) -#define CE_SNAPSHOT_DIR_NAME "@carrier_log" -#define CE_SNAPSHOT_PREFIX "carrier" - - -////////////////////////////////////////////////////////////////////// -// -// Communication protocol related constant -// -////////////////////////////////////////////////////////////////////// - -// Administrator Username -#define ADMINISTRATOR_USERNAME "administrator" -// Maximum value of random size -#define RAND_SIZE_MAX 4096 -// Expiration date of random size cache -#define RAND_SIZE_CACHE_EXPIRE (24 * 60 * 60 * 1000) -// Management allowed IP address list file name -#define ADMINIP_TXT "$adminip.txt" - -#define NON_SSL_MIN_COUNT 60 -#define NON_SSL_ENTRY_EXPIRES (10 * 60 * 1000) - -////////////////////////////////////////////////////////////////////// -// -// The cascade related constants -// -////////////////////////////////////////////////////////////////////// - -#define LINK_DEVICE_NAME "_SEHUBLINKCLI_" -#define LINK_USER_NAME "link" -#define LINK_USER_NAME_PRINT "Cascade" - - - -////////////////////////////////////////////////////////////////////// -// -// Constant related to SecureNAT connection -// -////////////////////////////////////////////////////////////////////// - -#define SNAT_DEVICE_NAME "_SEHUBSECURENAT_" -#define SNAT_USER_NAME "securenat" -#define SNAT_USER_NAME_PRINT "SecureNAT" - - - -////////////////////////////////////////////////////////////////////// -// -// Constant related to bridge connection -// -////////////////////////////////////////////////////////////////////// - -#define BRIDGE_DEVICE_NAME "_SEHUBBRIDGE_" -#define BRIDGE_USER_NAME "localbridge" -#define BRIDGE_USER_NAME_PRINT "Local Bridge" -#define BRIDGE_TRY_SPAN 1000 -#define BRIDGE_NUM_DEVICE_CHECK_SPAN (5 * 60 * 1000) -#define BRIDGE_NETWORK_CONNECTION_STR L"%s [%S]" - - - -////////////////////////////////////////////////////////////////////// -// -// EtherLogger related constants -// -////////////////////////////////////////////////////////////////////// - -#define EL_ADMIN_PORT 22888 -#define EL_CONFIG_FILENAME "$etherlogger.config" -#define EL_PACKET_LOG_DIR "etherlogger_log" -#define EL_PACKET_LOG_DIR_NAME "@"EL_PACKET_LOG_DIR -#define EL_PACKET_LOG_FILE_NAME EL_PACKET_LOG_DIR_NAME"/%s" -#define EL_PACKET_LOG_PREFIX "pkt" -#define EL_LICENSE_CHECK_SPAN (10 * 1000) - - - -////////////////////////////////////////////////////////////////////// -// -// Layer-3 Switch related constants -// -////////////////////////////////////////////////////////////////////// - -#define MAX_NUM_L3_SWITCH 4096 -#define MAX_NUM_L3_IF 4096 -#define MAX_NUM_L3_TABLE 4096 - - - -////////////////////////////////////////////////////////////////////// -// -// Constant related to User-mode Router -// -////////////////////////////////////////////////////////////////////// - -#define ARP_ENTRY_EXPIRES (30 * 1000) // ARP table expiration date -#define ARP_ENTRY_POLLING_TIME (1 * 1000) // ARP table cleaning timer -#define ARP_REQUEST_TIMEOUT (1000) // ARP request time-out period -#define ARP_REQUEST_GIVEUP (5 * 1000) // Time to give up sending the ARP request -#define IP_WAIT_FOR_ARP_TIMEOUT (5 * 1000) // Total time that an IP packet waiting for ARP table -#define IP_COMBINE_TIMEOUT (10 * 1000) // Time-out of IP packet combining -#define NAT_TCP_MAX_TIMEOUT (2000000 * 1000) // Maximum TCP session timeout in seconds -#define NAT_UDP_MAX_TIMEOUT (2000000 * 1000) // Maximum UDP session timeout in seconds -#define NAT_TCP_MIN_TIMEOUT (1 * 60 * 1000) // Minimum TCP session timeout in seconds -#define NAT_UDP_MIN_TIMEOUT (10 * 1000) // Minimum UDP session timeout in seconds -#define NAT_TCP_RECV_WINDOW_SIZE 64512 // TCP receive window size -#define NAT_TCP_SYNACK_SEND_TIMEOUT 250 // Sending TCP SYN+ACK interval -#define NAT_ICMP_TIMEOUT (10 * 1000) // ICMP timeout in seconds -#define NAT_ICMP_TIMEOUT_WITH_API (3 * 1000) // Timeout in seconds in the case of using the ICMP API -#define NAT_SEND_BUF_SIZE (64 * 1024) // TCP send buffer size -#define NAT_RECV_BUF_SIZE (64 * 1024) // TCP receive buffer size -#define NAT_TMPBUF_SIZE (128 * 1024) // TCP temporally memory area size -#define NAT_ACK_KEEPALIVE_SPAN (5 * 1000) // ACK transmission interval for TCP keep alive -#define NAT_INITIAL_RTT_VALUE 500 // Initial RTT value -#define NAT_FIN_SEND_INTERVAL 1000 // FIN transmission interval -#define NAT_FIN_SEND_MAX_COUNT 5 // Total number of FIN transmissions -#define NAT_DNS_PROXY_PORT 53 // DNS proxy port number -#define NAT_DNS_RESPONSE_TTL (20 * 60) // TTL of the DNS response -#define NAT_DHCP_SERVER_PORT 67 // DHCP server port number -#define NAT_DHCP_CLIENT_PORT 68 // DHCP client port number -#define DHCP_MIN_EXPIRE_TIMESPAN (15 * 1000) // DHCP minimum expiration date -#define DHCP_POLLING_INTERVAL 1000 // DHCP polling interval -#define X32 ((UINT64)4294967296ULL) // 32bit + 1 -#define NAT_DNS_QUERY_TIMEOUT (512) // Time-out value of DNS queries - -// Beacon transmission interval -#define BEACON_SEND_INTERVAL (5 * 1000) - -// Total size quota allowed in the queue for the combining the IP packet -#define IP_COMBINE_WAIT_QUEUE_SIZE_QUOTA (50 * 1024 * 1024) - -// Header size constant -#define MAC_HEADER_SIZE (sizeof(MAC_HEADER)) -#define ARP_HEADER_SIZE (sizeof(ARP_HEADER)) -#define IP_HEADER_SIZE (sizeof(IPV4_HEADER)) -#define TCP_HEADER_SIZE (sizeof(TCP_HEADER)) -#define UDP_HEADER_SIZE (sizeof(UDP_HEADER)) - -// Data maximum size constant -#define MAX_L3_DATA_SIZE (1500) -#define MAX_IP_DATA_SIZE (MAX_L3_DATA_SIZE - IP_HEADER_SIZE) -#define MAX_TCP_DATA_SIZE (MAX_IP_DATA_SIZE - TCP_HEADER_SIZE) -#define MAX_UDP_DATA_SIZE (MAX_IP_DATA_SIZE - UDP_HEADER_SIZE) -#define MAX_IP_DATA_SIZE_TOTAL (65535) - -// IP packet option constant -#define DEFAULT_IP_TOS 0 // TOS in the IP header -#define DEFAULT_IP_TTL 128 // TTL in the IP header - -// Type of NAT session -#define NAT_TCP 0 // TCP NAT -#define NAT_UDP 1 // UDP NAT -#define NAT_DNS 2 // DNS NAT -#define NAT_ICMP 3 // ICMP NAT - -// State of NAT session -#define NAT_TCP_CONNECTING 0 // Connecting -#define NAT_TCP_SEND_RESET 1 // Send the RST (Connection failure or disconnected) -#define NAT_TCP_CONNECTED 2 // Connection complete -#define NAT_TCP_ESTABLISHED 3 // Connection established -#define NAT_TCP_WAIT_DISCONNECT 4 // Wait for socket disconnection - - -////////////////////////////////////////////////////////////////////// -// -// For UNIX virtual LAN card related constant -// -////////////////////////////////////////////////////////////////////// - -#ifndef UNIX_BSD -#define TAP_FILENAME_1 "/dev/net/tun" -#define TAP_FILENAME_2 "/dev/tun" -#else // UNIX_BSD -#define TAP_NAME "tap" -#define TAP_DIR "/dev/" -#define TAP_MAX (512) -#endif // UNIX_BSD - - -#define LICENSE_EDITION_VPN3_NO_LICENSE 0 // Without license - -#define LICENSE_MAX_PRODUCT_NAME_LEN 255 // Maximum length of license product name -#define LICENSE_NUM_SHA 10000 // Number of times to hash with SHA -#define LICENSE_SYSTEM_KEY_NUM 2048 // Key number for system -#define LICENSE_SYSTEM_KEYSIZE_BIT 144 // Number of key bits for system -#define LICENSE_PRODUCT_KEY_NUM 16384 // Number of keys for product -#define LICENSE_PRODUCT_KEYSIZE_BIT 56 // Number of key bits for product -#define LICENSE_PRODUCT_COMMON_KEYSIZE_BIT 48 // Number of common key bits for product -#define LICENSE_MASTER_KEYSIZE_BIT 1024 // Number of master key bits -#define LICENSE_SYSTEM_ID_MIN 0ULL // System ID minimum value -#define LICENSE_SYSTEM_ID_MAX 549755813887ULL // System ID maximum value -#define LICENSE_SERIAL_ID_MIN 0 // Serial ID minimum value -#define LICENSE_SERIAL_ID_MAX 65535 // Serial ID maximum value -#define LICENSE_EXPIRES_MIN 0 // Expiration date minimum -#define LICENSE_EXPIRES_MAX 16383 // Expiration date maximum -#define LICENSE_KEYSTR_LEN 41 // Length of the license key -#define LICENSE_LICENSEID_STR_LEN 33 // Length of the license ID - -#define LICENSE_STATUS_OK 0 // Enabled -#define LICENSE_STATUS_EXPIRED 1 // Invalid (expired) -#define LICENSE_STATUS_ID_DIFF 2 // Invalid (System ID mismatch) -#define LICENSE_STATUS_DUP 3 // Invalid (duplicated) -#define LICENSE_STATUS_INSUFFICIENT 4 // Invalid (other necessary license shortage) -#define LICENSE_STATUS_COMPETITION 5 // Invalid (conflict with other licenses) -#define LICENSE_STATUS_NONSENSE 6 // Invalid (meaningless in the current edition) -#define LICENSE_STATUS_CPU 7 // Invalid (CPU type mismatch) - -#define BIT_TO_BYTE(x) (((x) + 7) / 8) -#define BYTE_TO_BIT(x) ((x) * 8) - - -////////////////////////////////////////////////////////////////////// -// -// Error code -// -////////////////////////////////////////////////////////////////////// - -#define ERR_NO_ERROR 0 // No error -#define ERR_CONNECT_FAILED 1 // Connection to the server has failed -#define ERR_SERVER_IS_NOT_VPN 2 // The destination server is not a VPN server -#define ERR_DISCONNECTED 3 // The connection has been interrupted -#define ERR_PROTOCOL_ERROR 4 // Protocol error -#define ERR_CLIENT_IS_NOT_VPN 5 // Connecting client is not a VPN client -#define ERR_USER_CANCEL 6 // User cancel -#define ERR_AUTHTYPE_NOT_SUPPORTED 7 // Specified authentication method is not supported -#define ERR_HUB_NOT_FOUND 8 // The HUB does not exist -#define ERR_AUTH_FAILED 9 // Authentication failure -#define ERR_HUB_STOPPING 10 // HUB is stopped -#define ERR_SESSION_REMOVED 11 // Session has been deleted -#define ERR_ACCESS_DENIED 12 // Access denied -#define ERR_SESSION_TIMEOUT 13 // Session times out -#define ERR_INVALID_PROTOCOL 14 // Protocol is invalid -#define ERR_TOO_MANY_CONNECTION 15 // Too many connections -#define ERR_HUB_IS_BUSY 16 // Too many sessions of the HUB -#define ERR_PROXY_CONNECT_FAILED 17 // Connection to the proxy server fails -#define ERR_PROXY_ERROR 18 // Proxy Error -#define ERR_PROXY_AUTH_FAILED 19 // Failed to authenticate on the proxy server -#define ERR_TOO_MANY_USER_SESSION 20 // Too many sessions of the same user -#define ERR_LICENSE_ERROR 21 // License error -#define ERR_DEVICE_DRIVER_ERROR 22 // Device driver error -#define ERR_INTERNAL_ERROR 23 // Internal error -#define ERR_SECURE_DEVICE_OPEN_FAILED 24 // The secure device cannot be opened -#define ERR_SECURE_PIN_LOGIN_FAILED 25 // PIN code is incorrect -#define ERR_SECURE_NO_CERT 26 // Specified certificate is not stored -#define ERR_SECURE_NO_PRIVATE_KEY 27 // Specified private key is not stored -#define ERR_SECURE_CANT_WRITE 28 // Write failure -#define ERR_OBJECT_NOT_FOUND 29 // Specified object can not be found -#define ERR_VLAN_ALREADY_EXISTS 30 // Virtual LAN card with the specified name already exists -#define ERR_VLAN_INSTALL_ERROR 31 // Specified virtual LAN card cannot be created -#define ERR_VLAN_INVALID_NAME 32 // Specified name of the virtual LAN card is invalid -#define ERR_NOT_SUPPORTED 33 // Unsupported -#define ERR_ACCOUNT_ALREADY_EXISTS 34 // Account already exists -#define ERR_ACCOUNT_ACTIVE 35 // Account is operating -#define ERR_ACCOUNT_NOT_FOUND 36 // Specified account doesn't exist -#define ERR_ACCOUNT_INACTIVE 37 // Account is offline -#define ERR_INVALID_PARAMETER 38 // Parameter is invalid -#define ERR_SECURE_DEVICE_ERROR 39 // Error has occurred in the operation of the secure device -#define ERR_NO_SECURE_DEVICE_SPECIFIED 40 // Secure device is not specified -#define ERR_VLAN_IS_USED 41 // Virtual LAN card in use by account -#define ERR_VLAN_FOR_ACCOUNT_NOT_FOUND 42 // Virtual LAN card of the account can not be found -#define ERR_VLAN_FOR_ACCOUNT_USED 43 // Virtual LAN card of the account is already in use -#define ERR_VLAN_FOR_ACCOUNT_DISABLED 44 // Virtual LAN card of the account is disabled -#define ERR_INVALID_VALUE 45 // Value is invalid -#define ERR_NOT_FARM_CONTROLLER 46 // Not a farm controller -#define ERR_TRYING_TO_CONNECT 47 // Attempting to connect -#define ERR_CONNECT_TO_FARM_CONTROLLER 48 // Failed to connect to the farm controller -#define ERR_COULD_NOT_HOST_HUB_ON_FARM 49 // A virtual HUB on farm could not be created -#define ERR_FARM_MEMBER_HUB_ADMIN 50 // HUB cannot be managed on a farm member -#define ERR_NULL_PASSWORD_LOCAL_ONLY 51 // Accepting only local connections for an empty password -#define ERR_NOT_ENOUGH_RIGHT 52 // Right is insufficient -#define ERR_LISTENER_NOT_FOUND 53 // Listener can not be found -#define ERR_LISTENER_ALREADY_EXISTS 54 // Listener already exists -#define ERR_NOT_FARM_MEMBER 55 // Not a farm member -#define ERR_CIPHER_NOT_SUPPORTED 56 // Encryption algorithm is not supported -#define ERR_HUB_ALREADY_EXISTS 57 // HUB already exists -#define ERR_TOO_MANY_HUBS 58 // Too many HUBs -#define ERR_LINK_ALREADY_EXISTS 59 // Link already exists -#define ERR_LINK_CANT_CREATE_ON_FARM 60 // The link can not be created on the server farm -#define ERR_LINK_IS_OFFLINE 61 // Link is off-line -#define ERR_TOO_MANY_ACCESS_LIST 62 // Too many access list -#define ERR_TOO_MANY_USER 63 // Too many users -#define ERR_TOO_MANY_GROUP 64 // Too many Groups -#define ERR_GROUP_NOT_FOUND 65 // Group can not be found -#define ERR_USER_ALREADY_EXISTS 66 // User already exists -#define ERR_GROUP_ALREADY_EXISTS 67 // Group already exists -#define ERR_USER_AUTHTYPE_NOT_PASSWORD 68 // Authentication method of the user is not a password authentication -#define ERR_OLD_PASSWORD_WRONG 69 // The user does not exist or the old password is wrong -#define ERR_LINK_CANT_DISCONNECT 73 // Cascade session cannot be disconnected -#define ERR_ACCOUNT_NOT_PRESENT 74 // Not completed configure the connection to the VPN server -#define ERR_ALREADY_ONLINE 75 // It is already online -#define ERR_OFFLINE 76 // It is offline -#define ERR_NOT_RSA_1024 77 // The certificate is not RSA 1024bit -#define ERR_SNAT_CANT_DISCONNECT 78 // SecureNAT session cannot be disconnected -#define ERR_SNAT_NEED_STANDALONE 79 // SecureNAT works only in stand-alone HUB -#define ERR_SNAT_NOT_RUNNING 80 // SecureNAT function is not working -#define ERR_SE_VPN_BLOCK 81 // Stopped by PacketiX VPN Block -#define ERR_BRIDGE_CANT_DISCONNECT 82 // Bridge session can not be disconnected -#define ERR_LOCAL_BRIDGE_STOPPING 83 // Bridge function is stopped -#define ERR_LOCAL_BRIDGE_UNSUPPORTED 84 // Bridge feature is not supported -#define ERR_CERT_NOT_TRUSTED 85 // Certificate of the destination server can not be trusted -#define ERR_PRODUCT_CODE_INVALID 86 // Product code is different -#define ERR_VERSION_INVALID 87 // Version is different -#define ERR_CAPTURE_DEVICE_ADD_ERROR 88 // Adding capture device failure -#define ERR_VPN_CODE_INVALID 89 // VPN code is different -#define ERR_CAPTURE_NOT_FOUND 90 // Capture device can not be found -#define ERR_LAYER3_CANT_DISCONNECT 91 // Layer-3 session cannot be disconnected -#define ERR_LAYER3_SW_EXISTS 92 // L3 switch of the same already exists -#define ERR_LAYER3_SW_NOT_FOUND 93 // Layer-3 switch can not be found -#define ERR_INVALID_NAME 94 // Name is invalid -#define ERR_LAYER3_IF_ADD_FAILED 95 // Failed to add interface -#define ERR_LAYER3_IF_DEL_FAILED 96 // Failed to delete the interface -#define ERR_LAYER3_IF_EXISTS 97 // Interface that you specified already exists -#define ERR_LAYER3_TABLE_ADD_FAILED 98 // Failed to add routing table -#define ERR_LAYER3_TABLE_DEL_FAILED 99 // Failed to delete the routing table -#define ERR_LAYER3_TABLE_EXISTS 100 // Routing table entry that you specified already exists -#define ERR_BAD_CLOCK 101 // Time is queer -#define ERR_LAYER3_CANT_START_SWITCH 102 // The Virtual Layer 3 Switch can not be started -#define ERR_CLIENT_LICENSE_NOT_ENOUGH 103 // Client connection licenses shortage -#define ERR_BRIDGE_LICENSE_NOT_ENOUGH 104 // Bridge connection licenses shortage -#define ERR_SERVER_CANT_ACCEPT 105 // Not Accept on the technical issues -#define ERR_SERVER_CERT_EXPIRES 106 // Destination VPN server has expired -#define ERR_MONITOR_MODE_DENIED 107 // Monitor port mode was rejected -#define ERR_BRIDGE_MODE_DENIED 108 // Bridge-mode or Routing-mode was rejected -#define ERR_IP_ADDRESS_DENIED 109 // Client IP address is denied -#define ERR_TOO_MANT_ITEMS 110 // Too many items -#define ERR_MEMORY_NOT_ENOUGH 111 // Out of memory -#define ERR_OBJECT_EXISTS 112 // Object already exists -#define ERR_FATAL 113 // A fatal error occurred -#define ERR_SERVER_LICENSE_FAILED 114 // License violation has occurred on the server side -#define ERR_SERVER_INTERNET_FAILED 115 // Server side is not connected to the Internet -#define ERR_CLIENT_LICENSE_FAILED 116 // License violation occurs on the client side -#define ERR_BAD_COMMAND_OR_PARAM 117 // Command or parameter is invalid -#define ERR_INVALID_LICENSE_KEY 118 // License key is invalid -#define ERR_NO_VPN_SERVER_LICENSE 119 // There is no valid license for the VPN Server -#define ERR_NO_VPN_CLUSTER_LICENSE 120 // There is no cluster license -#define ERR_NOT_ADMINPACK_SERVER 121 // Not trying to connect to a server with the Administrator Pack license -#define ERR_NOT_ADMINPACK_SERVER_NET 122 // Not trying to connect to a server with the Administrator Pack license (for .NET) -#define ERR_BETA_EXPIRES 123 // Destination Beta VPN Server has expired -#define ERR_BRANDED_C_TO_S 124 // Branding string of connection limit is different (Authentication on the server side) -#define ERR_BRANDED_C_FROM_S 125 // Branding string of connection limit is different (Authentication for client-side) -#define ERR_AUTO_DISCONNECTED 126 // VPN session is disconnected for a certain period of time has elapsed -#define ERR_CLIENT_ID_REQUIRED 127 // Client ID does not match -#define ERR_TOO_MANY_USERS_CREATED 128 // Too many created users -#define ERR_SUBSCRIPTION_IS_OLDER 129 // Subscription expiration date Is earlier than the build date of the VPN Server -#define ERR_ILLEGAL_TRIAL_VERSION 130 // Many trial license is used continuously -#define ERR_NAT_T_TWO_OR_MORE 131 // There are multiple servers in the back of a global IP address in the NAT-T connection -#define ERR_DUPLICATE_DDNS_KEY 132 // DDNS host key duplicate -#define ERR_DDNS_HOSTNAME_EXISTS 133 // Specified DDNS host name already exists -#define ERR_DDNS_HOSTNAME_INVALID_CHAR 134 // Characters that can not be used for the host name is included -#define ERR_DDNS_HOSTNAME_TOO_LONG 135 // Host name is too long -#define ERR_DDNS_HOSTNAME_IS_EMPTY 136 // Host name is not specified -#define ERR_DDNS_HOSTNAME_TOO_SHORT 137 // Host name is too short -#define ERR_MSCHAP2_PASSWORD_NEED_RESET 138 // Necessary that password is changed -#define ERR_DDNS_DISCONNECTED 139 // Communication to the dynamic DNS server is disconnected -#define ERR_SPECIAL_LISTENER_ICMP_ERROR 140 // The ICMP socket can not be opened -#define ERR_SPECIAL_LISTENER_DNS_ERROR 141 // Socket for DNS port can not be opened -#define ERR_OPENVPN_IS_NOT_ENABLED 142 // OpenVPN server feature is not enabled -#define ERR_NOT_SUPPORTED_AUTH_ON_OPENSOURCE 143 // It is the type of user authentication that are not supported in the open source version -#define ERR_VPNGATE 144 // Operation on VPN Gate Server is not available -#define ERR_VPNGATE_CLIENT 145 // Operation on VPN Gate Client is not available -#define ERR_VPNGATE_INCLIENT_CANT_STOP 146 // Can not be stopped if operating within VPN Client mode -#define ERR_NOT_SUPPORTED_FUNCTION_ON_OPENSOURCE 147 // It is a feature that is not supported in the open source version -#define ERR_SUSPENDING 148 // System is suspending - - -//////////////////////////// -// Generally used structure - -// Network Services -typedef struct NETSVC -{ - bool Udp; // false=TCP, true=UDP - UINT Port; // Port number - char *Name; // Name -} NETSVC; - -// Traffic data entry -typedef struct TRAFFIC_ENTRY -{ - UINT64 BroadcastCount; // Number of broadcast packets - UINT64 BroadcastBytes; // Broadcast bytes - UINT64 UnicastCount; // Unicast count - UINT64 UnicastBytes; // Unicast bytes -} TRAFFIC_ENTRY; - -// Traffic data -typedef struct TRAFFIC -{ - TRAFFIC_ENTRY Send; // Transmitted data - TRAFFIC_ENTRY Recv; // Received data -} TRAFFIC; - -// Non-SSL connection source -typedef struct NON_SSL -{ - IP IpAddress; // IP address - UINT64 EntryExpires; // Expiration date of entry - UINT Count; // Number of connection count -} NON_SSL; - -// Simple log storage -typedef struct TINY_LOG -{ - char FileName[MAX_PATH]; // File name - IO *io; // File - LOCK *Lock; // Lock -} TINY_LOG; - -// CEDAR structure -typedef struct CEDAR -{ - LOCK *lock; // Lock - REF *ref; // Reference counter - COUNTER *AcceptingSockets; // Number of sockets in Accept - UINT Type; // Type - LIST *ListenerList; // Listener list - LIST *HubList; // HUB list - LIST *ConnectionList; // Negotiating connection list - LIST *CaList; // List of CA - volatile bool Halt; // Halt flag - COUNTER *ConnectionIncrement; // Connection increment counter - X *ServerX; // Server certificate - K *ServerK; // Private key of the server certificate - char UsernameHubSeparator; // Character which separates the username from the hub name - char *CipherList; // List of encryption algorithms - UINT Version; // Version information - UINT Build; // Build Number - char *ServerStr; // Server string - char *MachineName; // Computer name - char *HttpUserAgent; // HTTP user agent - char *HttpAccept; // HTTP Accept - char *HttpAcceptLanguage; // HTTP Accept Language - char *HttpAcceptEncoding; // HTTP Accept Encoding - TRAFFIC *Traffic; // Traffic information - LOCK *TrafficLock; // Traffic information lock - LIST *UDPEntryList; // UDP entry list - COUNTER *CurrentSessions; // The current number of sessions - COUNTER *CurrentTcpConnections; // Number of current TCP connections - LIST *NetSvcList; // Network service list - char *VerString; // Version string - char *BuildInfo; // Build Information - struct CLIENT *Client; // Client - struct SERVER *Server; // Server - UINT64 CreatedTick; // Generation date and time - bool CheckExpires; // Check the expiration date - LIST *TrafficDiffList; // Traffic difference list - struct LOG *DebugLog; // Debug log - UCHAR UniqueId[16]; // Unique ID - LIST *LocalBridgeList; // Local bridge list - bool Bridge; // Bridge version - LIST *L3SwList; // Layer-3 switch list - COUNTER *AssignedClientLicense; // Number of assigned client licenses - COUNTER *AssignedBridgeLicense; // Number of assigned bridge licenses - UINT64 LicenseViolationTick; // License violation occurs - LIST *NonSslList; // Non-SSL connection list - struct WEBUI *WebUI; // Data for WebUI service - UINT Beta; // Beta number - LOCK *CedarSuperLock; // Cedar super lock! - bool DisableIPv6Listener; // Disable IPv6 listener - UINT ClientId; // Client ID - UINT64 BuiltDate; // Build Date - LIST *UdpPortList; // UDP port list in use - char CurrentDDnsFqdn[MAX_SIZE]; // FQDN of the current DDNS - char OpenVPNPublicPorts[MAX_SIZE]; // OpenVPN public UDP port list - LOCK *OpenVPNPublicPortsLock; // Lock of OpenVPN public UDP port list - LOCK *CurrentRegionLock; // Current region lock - char CurrentRegion[128]; // Current region - LOCK *CurrentTcpQueueSizeLock; // Current TCP send queue size lock - UINT CurrentTcpQueueSize; // Current TCP send queue size - COUNTER *CurrentActiveLinks; // Current active cascade connections - LOCK *QueueBudgetLock; // Queue budget lock - UINT QueueBudget; // Queue budget - LOCK *FifoBudgetLock; // Fifo budget lock - UINT FifoBudget; // Fifo budget - SSL_ACCEPT_SETTINGS SslAcceptSettings; // SSL Accept Settings - UINT DhParamBits; // Bits of Diffie-Hellman parameters -} CEDAR; - -// Type of CEDAR -#define CEDAR_CLIENT 0 // Client -#define CEDAR_STANDALONE_SERVER 1 // Stand-alone server -#define CEDAR_FARM_CONTROLLER 2 // Server farm controller -#define CEDAR_FARM_MEMBER 3 // Server farm member - - -//////////////////////////// -// Read the header file - -// Type -#include -// Account Manager -#include -// Listener module -#include -// Log storage module -#include -// Connection management -#include -// Session Management -#include -// RPC -#include -// HUB management -#include -// Security Accounts Manager -#include -// Radius authentication module -#include -// Native protocol -#include -// Inter-HUB link -#include -// User-mode virtual host -#include -// SecureNAT -#include -// Digital watermark -#include -// Secure data -#include -// Console service -#include -// Vpncmd utility -#include -// RPC over HTTP -#include -// Layer-2/Layer-3 converter -#include -// Third party protocols -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -// UDP Acceleration -#include -// DDNS Client -#include -// VPN Azure Client -#include -// VPN Azure Server -#include -// Native IP Stack -#include - -#ifdef OS_WIN32 -// Neo device driver -#include -// SeLow User-mode -#include -#endif // OS_WIN32 - -// Neo device driver manipulation library -#include -// Bridge -#include -// Layer-3 switch -#include -// Virtual LAN card for test -#include -// Client -#include -// Server -#include -// License database -#include -// EtherLogger -#include -// Management RPC -#include -// User-mode Router -#include - -// Web UI -#include - -// VPN Gate Main Implementation -#include - - -#ifdef OS_WIN32 - -// Win32 user interface -#include -// Win32 Client Connection Manager -#include -// Win32 Server Manager -#include -// Win32 User-mode Router Manager -#include -// Win32 EtherLogger Manager -#include -// Win32 Network Utility -#include -// Win32 Setup Wizard -#include -// Win32 COM calling module -#include - -#endif - - - - -//////////////////////////// -// Function prototype - -TRAFFIC *NewTraffic(); -void FreeTraffic(TRAFFIC *t); -CEDAR *NewCedar(X *server_x, K *server_k); -void CedarForceLink(); -void SetCedarVpnBridge(CEDAR *c); -void SetCedarCert(CEDAR *c, X *server_x, K *server_k); -void ReleaseCedar(CEDAR *c); -void CleanupCedar(CEDAR *c); -void StopCedar(CEDAR *c); -void AddListener(CEDAR *c, LISTENER *r); -void StopAllListener(CEDAR *c); -void AddTraffic(TRAFFIC *dst, TRAFFIC *diff); -void AddHub(CEDAR *c, HUB *h); -void DelHub(CEDAR *c, HUB *h); -void DelHubEx(CEDAR *c, HUB *h, bool no_lock); -void StopAllHub(CEDAR *c); -void StopAllConnection(CEDAR *c); -void AddConnection(CEDAR *cedar, CONNECTION *c); -void DelConnection(CEDAR *cedar, CONNECTION *c); -void SetCedarCipherList(CEDAR *cedar, char *name); -void InitCedar(); -void FreeCedar(); -void AddCa(CEDAR *cedar, X *x); -bool DeleteCa(CEDAR *cedar, UINT ptr); -bool CheckSignatureByCa(CEDAR *cedar, X *x); -bool CheckSignatureByCaLinkMode(SESSION *s, X *x); -X *FindCaSignedX(LIST *o, X *x); -void InitNetSvcList(CEDAR *cedar); -void FreeNetSvcList(CEDAR *cedar); -int CompareNetSvc(void *p1, void *p2); -char *GetSvcName(CEDAR *cedar, bool udp, UINT port); -UINT64 GetTrafficPacketSize(TRAFFIC *t); -UINT64 GetTrafficPacketNum(TRAFFIC *t); -void StartCedarLog(); -void StopCedarLog(); -int CompareNoSslList(void *p1, void *p2); -void InitNoSslList(CEDAR *c); -void FreeNoSslList(CEDAR *c); -bool AddNoSsl(CEDAR *c, IP *ip); -void DecrementNoSsl(CEDAR *c, IP *ip, UINT num_dec); -void DeleteOldNoSsl(CEDAR *c); -NON_SSL *SearchNoSslList(CEDAR *c, IP *ip); -void FreeTinyLog(TINY_LOG *t); -void WriteTinyLog(TINY_LOG *t, char *str); -TINY_LOG *NewTinyLog(); -void GetWinVer(RPC_WINVER *v); -bool IsSupportedWinVer(RPC_WINVER *v); -SOCK *GetInProcListeningSock(CEDAR *c); -SOCK *GetReverseListeningSock(CEDAR *c); -void GetCedarVersion(char *tmp, UINT size); -UINT GetCedarVersionNumber(); -UINT64 GetCurrentBuildDate(); -void CedarAddCurrentTcpQueueSize(CEDAR *c, int diff); -UINT CedarGetCurrentTcpQueueSize(CEDAR *c); -void CedarAddQueueBudget(CEDAR *c, int diff); -void CedarAddFifoBudget(CEDAR *c, int diff); -UINT CedarGetQueueBudgetConsuming(CEDAR *c); -UINT CedarGetFifoBudgetConsuming(CEDAR *c); -UINT CedarGetQueueBudgetBalance(CEDAR *c); -UINT CedarGetFifoBudgetBalance(CEDAR *c); -bool CedarIsThereAnyEapEnabledRadiusConfig(CEDAR *c); - - - -#endif // CEDAR_H - +// SoftEther VPN Source Code - Developer Edition Master Branch +// Cedar Communication Module +// © 2020 Nokia + +// Cedar.h +// Header of Cedar.c + +#ifndef CEDAR_H +#define CEDAR_H + + +////////////////////////////////////////////////////////////////////// +// +// Products related constants +// +////////////////////////////////////////////////////////////////////// + +// Replace the function name +#ifdef VPN_SPEED + +#define DecryptSecurePacket __dsp +#define CreateSecurePacket __csp +#define GetSecureRandomSize __gsrs + +#endif // VPN_SPEED + +#define bool UINT +#define BOOL UINT + + +// Version number +#ifndef CEDAR_VERSION_MAJOR +#define CEDAR_VERSION_MAJOR 0 +#endif // CEDAR_VERSION_MAJOR + +#ifndef CEDAR_VERSION_MINOR +#define CEDAR_VERSION_MINOR 0 +#endif // CEDAR_VER_MINOR + +// Build number +#ifndef CEDAR_VERSION_BUILD +#define CEDAR_VERSION_BUILD 0 +#endif // CEDAR_VERSION_BUILD + +// Beta number +//#define BETA_NUMBER 3 + +// RC or not +#define RELEASE_CANDIDATE + +// Specify the name of the person in charge building +#ifndef BUILDER_NAME +#define BUILDER_NAME "Unknown" +#endif // BUILDER_NAME + +// Specify the location to build +#ifndef BUILD_PLACE +#define BUILD_PLACE "Unknown" +#endif // BUILD_PLACE + +// Specifies the build date +#ifndef BUILD_DATE_Y +#define BUILD_DATE_Y 1970 +#endif // BUILD_DATE_Y + +#ifndef BUILD_DATE_M +#define BUILD_DATE_M 1 +#endif // BUILD_DATE_M + +#ifndef BUILD_DATE_D +#define BUILD_DATE_D 1 +#endif // BUILD_DATE_D + +#ifndef BUILD_DATE_HO +#define BUILD_DATE_HO 0 +#endif // BUILD_DATE_HO + +#ifndef BUILD_DATE_MI +#define BUILD_DATE_MI 0 +#endif // BUILD_DATE_MI + +#ifndef BUILD_DATE_SE +#define BUILD_DATE_SE 0 +#endif // BUILD_DATE_SE + +// Tolerable time difference +#define ALLOW_TIMESTAMP_DIFF (UINT64)(3 * 24 * 60 * 60 * 1000) + + +// Configuration of communication related control switch +#define USE_DOS_ATTACK_DETECTION // Enable the DOS attack detection +//#define USE_SECURE_PACKET // Enable the scrambled packet + +// Designate the IDS detection signatures +#define CEDAR_SIGNATURE_STR "SE-VPN4-PROTOCOL" + +// Default RSA certificate name of the smart card +#define SECURE_DEFAULT_CERT_NAME "VPN_RSA_CERT" + +// Default RSA private key name of the smart card +#define SECURE_DEFAULT_KEY_NAME "VPN_RSA_KEY" + +// Hidden password string of 8 characters +#define HIDDEN_PASSWORD "********" + +// Default separator character for the hub name in the username +#define DEFAULT_USERNAME_HUB_SEPARATOR '@' + + +////////////////////////////////////////////////////////////////////// +// +// Definition of the maximum length of various string +// +////////////////////////////////////////////////////////////////////// + +#define MAX_ACCOUNT_NAME_LEN 255 // Maximum account name length +#define MAX_USERNAME_LEN 255 // User name maximum length +#define MAX_PASSWORD_LEN 255 // Password name maximum length +#define MAX_SERVER_STR_LEN 255 // Maximum length of server string +#define MAX_CLIENT_STR_LEN 255 // Maximum length of client string +#define MAX_HUBNAME_LEN 255 // Maximum length of HUB name +#define MAX_SESSION_NAME_LEN 255 // Session name maximum length +#define MAX_CONNECTION_NAME_LEN 255 // Maximum length of connection name +#define MAX_DEVICE_NAME_LEN 31 // Device name maximum length +#define MAX_DEVICE_NAME_LEN_9X 4 // Maximum length of Virtual LAN card name in Win9x +#define MAX_ACCESSLIST_NOTE_LEN 255 // Maximum length of the note of access list entry +#define MAX_SECURE_DEVICE_FILE_LEN 255 // Secure device file name maximum length +#define MAX_ADMIN_OPTION_NAME_LEN 63 // Management option name +#define MAX_REDIRECT_URL_LEN 255 // URL length to redirect + + +////////////////////////////////////////////////////////////////////// +// +// Server and session management related constants +// +////////////////////////////////////////////////////////////////////// + +#define SERVER_MAX_SESSIONS 4096 // Maximum number of sessions that the server supports +#define SERVER_MAX_SESSIONS_FOR_CARRIER_EDITION 100000 // Maximum number of sessions that the server supports (Carrier Edition) +#define NAT_MAX_SESSIONS 4096 // Maximum number of sessions that are supported by NAT +#define NAT_MAX_SESSIONS_KERNEL 65536 // Maximum number of sessions that are supported by NAT (In the case of kernel-mode NAT) +#define MAX_HUBS 4096 // The maximum number of virtual HUB +#define MAX_HUBS_FOR_CARRIER_EDITION 100000 // The maximum number of virtual HUB (Carrier Edition) +#define MAX_ACCESSLISTS (4096 * 8) // Maximum number of access list entries +#define MAX_USERS 10000 // The maximum number of users +#define MAX_GROUPS 10000 // Maximum number of groups +#define MAX_MAC_TABLES VPN_GP(GP_MAX_MAC_TABLES, 65536) // Maximum number of MAC address table entries +#define MAX_IP_TABLES VPN_GP(GP_MAX_IP_TABLES, 65536) // Maximum number of IP address table entries +#define MAX_HUB_CERTS 4096 // Maximum number of Root CA that can be registered +#define MAX_HUB_CRLS 4096 // Maximum number of CRL that can be registered +#define MAX_HUB_ACS 4096 // Maximum number of AC that can be registered +#define MAX_HUB_LINKS VPN_GP(GP_MAX_HUB_LINKS, 1024) // Maximum number of Cascade that can be registered +#define MAX_HUB_ADMIN_OPTIONS 4096 // Maximum number of Virtual HUB management options that can be registered + +#ifndef USE_STRATEGY_LOW_MEMORY +#define MEM_FIFO_REALLOC_MEM_SIZE VPN_GP(GP_MEM_FIFO_REALLOC_MEM_SIZE, (65536 * 10)) +#define QUEUE_BUDGET VPN_GP(GP_QUEUE_BUDGET, 2048) +#define FIFO_BUDGET VPN_GP(GP_FIFO_BUDGET, 1600 * 1600 * 4) +#else // USE_STRATEGY_LOW_MEMORY +#define MEM_FIFO_REALLOC_MEM_SIZE VPN_GP(GP_MEM_FIFO_REALLOC_MEM_SIZE, (65536)) +#define QUEUE_BUDGET VPN_GP(GP_QUEUE_BUDGET, 1024) +#define FIFO_BUDGET VPN_GP(GP_FIFO_BUDGET, 1000000) +#endif // USE_STRATEGY_LOW_MEMORY + +#define MAX_PACKET_SIZE 1600 // Maximum packet size +#define UDP_BUF_SIZE (32 * 1024) // Aim of the UDP packet size + +#ifndef USE_STRATEGY_LOW_MEMORY +#define MAX_SEND_SOCKET_QUEUE_SIZE VPN_GP(GP_MAX_SEND_SOCKET_QUEUE_SIZE, (1600 * 1600 * 1)) // Maximum transmit queue size +#define MIN_SEND_SOCKET_QUEUE_SIZE VPN_GP(GP_MIN_SEND_SOCKET_QUEUE_SIZE, (1600 * 200 * 1)) // Minimum transmit queue size +#define MAX_STORED_QUEUE_NUM VPN_GP(GP_MAX_STORED_QUEUE_NUM, 1024) // The number of queues that can be stored in each session +#define MAX_BUFFERING_PACKET_SIZE VPN_GP(GP_MAX_BUFFERING_PACKET_SIZE, (1600 * 1600)) // Maximum packet size can be buffered +#else // USE_STRATEGY_LOW_MEMORY +#define MAX_SEND_SOCKET_QUEUE_SIZE VPN_GP(GP_MAX_SEND_SOCKET_QUEUE_SIZE, (1600 * 200 * 1)) // Maximum transmit queue size +#define MIN_SEND_SOCKET_QUEUE_SIZE VPN_GP(GP_MIN_SEND_SOCKET_QUEUE_SIZE, (1600 * 50 * 1)) // Minimum transmit queue size +#define MAX_STORED_QUEUE_NUM VPN_GP(GP_MAX_STORED_QUEUE_NUM, 384) // The number of queues that can be stored in each session +#define MAX_BUFFERING_PACKET_SIZE VPN_GP(GP_MAX_BUFFERING_PACKET_SIZE, (1600 * 300 * 1)) // Maximum packet size can be buffered +#endif // USE_STRATEGY_LOW_MEMORY + +#define MAX_SEND_SOCKET_QUEUE_NUM VPN_GP(GP_MAX_SEND_SOCKET_QUEUE_NUM, 128) // Maximum number of transmission queue items per processing +#define MAX_TCP_CONNECTION 32 // The maximum number of TCP connections +#define NUM_TCP_CONNECTION_FOR_UDP_RECOVERY 2 // Maximum number of connections when using UDP recovery +#define SELECT_TIME VPN_GP(GP_SELECT_TIME, 256) +#define SELECT_TIME_FOR_NAT VPN_GP(GP_SELECT_TIME_FOR_NAT, 30) +#define SELECT_TIME_FOR_DELAYED_PKT 1 // If there is a delayed packet + +#define TIMEOUT_MIN (5 * 1000) // Minimum timeout in seconds +#define TIMEOUT_MAX (60 * 1000) // Maximum timeout in seconds +#define TIMEOUT_DEFAULT (30 * 1000) // Default number of seconds to timeout +#define CONNECTING_TIMEOUT (15 * 1000) // Timeout in seconds of being connected +#define CONNECTING_POOLING_SPAN (3 * 1000) // Polling interval of connected +#define MIN_RETRY_INTERVAL (5 * 1000) // Minimum retry interval +#define MAX_RETRY_INTERVAL (300 * 1000) // Maximum retry interval +#define RETRY_INTERVAL_SPECIAL (60 * 1000) // Reconnection interval of a special case + +#define MAX_ADDITIONAL_CONNECTION_FAILED_COUNTER 16 // Allowable number that can be serially failed to additional connection +#define ADDITIONAL_CONNECTION_COUNTER_RESET_INTERVAL (30 * 60 * 1000) // Reset period of additional connection failure counter + +#define MAC_MIN_LIMIT_COUNT 3 // Minimum number of MAC addresses +#define IP_MIN_LIMIT_COUNT 4 // Number of IPv4 addresses minimum +#define IP_MIN_LIMIT_COUNT_V6 5 // Number of IPv6 addresses minimum +#define IP_LIMIT_WHEN_NO_ROUTING_V6 15 // Maximum number of IPv6 addresses when NoRouting policy is enabled + +#define MAC_TABLE_EXCLUSIVE_TIME (13 * 1000) // Period that can occupy the MAC address +#define IP_TABLE_EXCLUSIVE_TIME (13 * 1000) // Period that can occupy the IP address +#define MAC_TABLE_EXPIRE_TIME VPN_GP(GP_MAC_TABLE_EXPIRE_TIME, (600 * 1000)) // MAC address table expiration time +#define IP_TABLE_EXPIRE_TIME VPN_GP(GP_IP_TABLE_EXPIRE_TIME, (60 * 1000)) // IP address table expiration time +#define IP_TABLE_EXPIRE_TIME_DHCP VPN_GP(GP_IP_TABLE_EXPIRE_TIME_DHCP, (5 * 60 * 1000)) // IP address table expiration time (In the case of DHCP) +#define HUB_ARP_SEND_INTERVAL VPN_GP(GP_HUB_ARP_SEND_INTERVAL, (5 * 1000)) // ARP packet transmission interval (alive check) + +#define LIMITER_SAMPLING_SPAN 1000 // Sampling interval of the traffic limiting device + +#define STORM_CHECK_SPAN VPN_GP(GP_STORM_CHECK_SPAN, 500) // Broadcast storm check interval +#define STORM_DISCARD_VALUE_START VPN_GP(GP_STORM_DISCARD_VALUE_START, 3) // Broadcast packet discard value start value +#define STORM_DISCARD_VALUE_END VPN_GP(GP_STORM_DISCARD_VALUE_END, 1024) // Broadcast packet discard value end value + +#define KEEP_INTERVAL_MIN 5 // Packet transmission interval minimum value +#define KEEP_INTERVAL_DEFAULT 50 // Packet transmission interval default value +#define KEEP_INTERVAL_MAX 600 // Packet transmission interval maximum value +#define KEEP_TCP_TIMEOUT 1000 // TCP time-out value + +#define TICKET_EXPIRES (60 * 1000) // Expiration date of ticket + +#define SEND_KILL_NUM_X 256 // Number of 'X' characters to send the Kill + + +#define FARM_BASE_POINT 100000 // Reference value of the cluster score +#define FARM_DEFAULT_WEIGHT 100 // Standard performance ratio + +#define DH_PARAM_BITS_DEFAULT 2048 // Bits of Diffie-Hellman Parameters + + +#define SE_UDP_SIGN "SE2P" // Not used (only old UDP mode) + +// R-UDP service name +#define VPN_RUDP_SVC_NAME "SoftEther_VPN" + +// Traffic information update interval +#define INCREMENT_TRAFFIC_INTERVAL (10 * 1000) + +// State of the client session +#define CLIENT_STATUS_CONNECTING 0 // Connecting +#define CLIENT_STATUS_NEGOTIATION 1 // Negotiating +#define CLIENT_STATUS_AUTH 2 // During user authentication +#define CLIENT_STATUS_ESTABLISHED 3 // Connection complete +#define CLIENT_STATUS_RETRY 4 // Wait to retry +#define CLIENT_STATUS_IDLE 5 // Idle state + +// Expiration date of the black list +#define BLACK_LIST_EXPIRES (30 * 10000) + +// Number Blacklist entries +#define MAX_BLACK_LIST 4096 +#define BLACK_LIST_CHECK_SPAN 1000 + +// Blocks to be transmitted at one during the file transfer +#define FTP_BLOCK_SIZE (640 * 1024) + +// Syslog configuration +#define SYSLOG_NONE 0 // Do not use syslog +#define SYSLOG_SERVER_LOG 1 // Only server log +#define SYSLOG_SERVER_AND_HUB_SECURITY_LOG 2 // Server and Virtual HUB security log +#define SYSLOG_SERVER_AND_HUB_ALL_LOG 3 // Server, Virtual HUB security, and packet log + +#define SYSLOG_PORT 514 // Syslog port number +#define SYSLOG_POLL_IP_INTERVAL (UINT64)(3600 * 1000) // Interval to examine the IP address +#define SYSLOG_POLL_IP_INTERVAL_NG (UINT64)(60 * 1000) // Interval to examine the IP address (previous failure) + +////////////////////////////////////////////////////////////////////// +// +// Connection-related constant +// +////////////////////////////////////////////////////////////////////// + +// Internet connection maintenance function (KeepAlive) + +#define KEEP_RETRY_INTERVAL (60 * 1000) // Reconnection interval on connection failure +#define KEEP_MIN_PACKET_SIZE 1 // Minimum packet size +#define KEEP_MAX_PACKET_SIZE 128 // Maximum packet size +#define KEEP_POLLING_INTERVAL 250 // KEEP polling interval + +// Constants +#define RECV_BUF_SIZE 65536 // Buffer size to be received at a time + +// Type of proxy +#define PROXY_DIRECT 0 // Direct TCP connection +#define PROXY_HTTP 1 // Connection via HTTP proxy server +#define PROXY_SOCKS 2 // Connection via SOCKS4 proxy server +#define PROXY_SOCKS5 3 // Connection via SOCKS5 proxy server + +// Direction of data flow +#define TCP_BOTH 0 // Bi-directional +#define TCP_SERVER_TO_CLIENT 1 // Only server -> client direction +#define TCP_CLIENT_TO_SERVER 2 // Only client -> server direction + +// Type of connection +#define CONNECTION_TYPE_CLIENT 0 // Client +#define CONNECTION_TYPE_INIT 1 // During initialization +#define CONNECTION_TYPE_LOGIN 2 // Login connection +#define CONNECTION_TYPE_ADDITIONAL 3 // Additional connection +#define CONNECTION_TYPE_FARM_RPC 4 // RPC for server farm +#define CONNECTION_TYPE_ADMIN_RPC 5 // RPC for Management +#define CONNECTION_TYPE_ENUM_HUB 6 // HUB enumeration +#define CONNECTION_TYPE_PASSWORD 7 // Password change +#define CONNECTION_TYPE_OTHER 0xffffffff // E.g. Third-party protocol + +// Protocol +#define CONNECTION_TCP 0 // TCP protocol +#define CONNECTION_UDP 1 // UDP protocol +#define CONNECTION_HUB_LAYER3 6 // Layer-3 switch session +#define CONNECTION_HUB_BRIDGE 7 // Bridge session +#define CONNECTION_HUB_SECURE_NAT 8 // Secure NAT session +#define CONNECTION_HUB_LINK_SERVER 9 // HUB link session + + +// Status +#define CONNECTION_STATUS_ACCEPTED 0 // The connection is accepted (client side) +#define CONNECTION_STATUS_NEGOTIATION 1 // Negotiating +#define CONNECTION_STATUS_USERAUTH 2 // During user authentication +#define CONNECTION_STATUS_ESTABLISHED 3 // Connection has been established +#define CONNECTION_STATUS_CONNECTING 0 // Connecting (client side) + +// Magic number of KeepAlive packet +#define KEEP_ALIVE_MAGIC 0xffffffff +#define MAX_KEEPALIVE_SIZE 512 + + + +////////////////////////////////////////////////////////////////////// +// +// Virtual HUB-related constant +// +////////////////////////////////////////////////////////////////////// + +#define SE_HUB_MAC_ADDR_SIGN 0xAE // Sign virtual HUB MAC address + +// Traffic difference value +#define TRAFFIC_DIFF_USER 0 // User +#define TRAFFIC_DIFF_HUB 1 // Virtual HUB +#define MAX_TRAFFIC_DIFF 30000 // Maximum number of items + +// Type of HUB +#define HUB_TYPE_STANDALONE 0 // Stand-alone HUB +#define HUB_TYPE_FARM_STATIC 1 // Static HUB +#define HUB_TYPE_FARM_DYNAMIC 2 // Dynamic HUB + +// Related to delay, jitter, packet loss in the access list +#define HUB_ACCESSLIST_DELAY_MAX 10000 // Maximum delay +#define HUB_ACCESSLIST_JITTER_MAX 100 // Maximum jitter +#define HUB_ACCESSLIST_LOSS_MAX 100 // Maximum packet loss + +// Message related +#define HUB_MAXMSG_LEN 20000 // The maximum number of characters in a message + + + +////////////////////////////////////////////////////////////////////// +// +// Type of user authentication +// +////////////////////////////////////////////////////////////////////// + +// Constant in the server-side +#define AUTHTYPE_ANONYMOUS 0 // Anonymous authentication +#define AUTHTYPE_PASSWORD 1 // Password authentication +#define AUTHTYPE_USERCERT 2 // User certificate authentication +#define AUTHTYPE_ROOTCERT 3 // Root certificate which is issued by trusted Certificate Authority +#define AUTHTYPE_RADIUS 4 // Radius authentication +#define AUTHTYPE_NT 5 // Windows NT authentication +#define AUTHTYPE_OPENVPN_CERT 98 // TLS client certificate authentication +#define AUTHTYPE_TICKET 99 // Ticket authentication + +// Constant of the client side +#define CLIENT_AUTHTYPE_ANONYMOUS 0 // Anonymous authentication +#define CLIENT_AUTHTYPE_PASSWORD 1 // Password authentication +#define CLIENT_AUTHTYPE_PLAIN_PASSWORD 2 // Plain password authentication +#define CLIENT_AUTHTYPE_CERT 3 // Certificate authentication +#define CLIENT_AUTHTYPE_SECURE 4 // Secure device authentication +#define CLIENT_AUTHTYPE_OPENSSLENGINE 5 // Openssl engine authentication + + + +////////////////////////////////////////////////////////////////////// +// +// TCP listener related constants +// +////////////////////////////////////////////////////////////////////// + +// Retries in case it fails to Listen +#define LISTEN_RETRY_TIME (2 * 1000) // If fail to Listen normally +#define LISTEN_RETRY_TIME_NOIPV6 (60 * 1000) // If IPv6 support is disabled + +#define DOS_TABLE_EXPIRES_FIRST 250 // Initial value of the expiration date of DOS attack list +#define DOS_TABLE_EXPIRES_MAX 1000 // Maximum value of the expiration date of DOS attack list +#define DOS_TABLE_REFRESH_INTERVAL (10 * 1000) // Interval to update the DOS attack list +#define DOS_TABLE_MAX_LIMIT_PER_IP 16 // Accessible number per an IP +#define DOS_TABLE_EXPIRES_TOTAL (3000 * 1000) // Time to force delete the entry + + +// Protocol to be used for the listener +#define LISTENER_TCP 0 // TCP/IP +#define LISTENER_UDP 1 // UDP/IP (not being used) +#define LISTENER_INPROC 2 // In-process communication +#define LISTENER_RUDP 3 // R-UDP with NAT-T +#define LISTENER_ICMP 4 // VPN over ICMP +#define LISTENER_DNS 5 // VPN over DNS +#define LISTENER_REVERSE 6 // Reverse socket + +// Status of the listener +#define LISTENER_STATUS_TRYING 0 // While attempting +#define LISTENER_STATUS_LISTENING 1 // Listening + +// Largest packet size of UDP +#define UDP_PACKET_SIZE 65536 + +// Number of standard connections per IP address +#define DEFAULT_MAX_CONNECTIONS_PER_IP 256 +#define MIN_MAX_CONNECTIONS_PER_IP 10 // Minimum value + +// Allowed number of outstanding connections +#define DEFAULT_MAX_UNESTABLISHED_CONNECTIONS 1000 +#define MIN_MAX_UNESTABLISHED_CONNECTIONS 30 // Minimum value + + +////////////////////////////////////////////////////////////////////// +// +// Log related constant +// +////////////////////////////////////////////////////////////////////// + +#define LOG_ENGINE_SAVE_START_CACHE_COUNT 100000 // Number to start saving forcibly +#define LOG_ENGINE_BUFFER_CACHE_SIZE_MAX (10 * 1024 * 1024) // Write cache size + +// Constant such as a file name +// +// These placeholders will be replaced in InnerFilePathW(). +// +// @ - placeholder for LogDir +// $ - placeholder for DbDir (config directory) +// +#define SERVER_LOG_DIR "server_log" +#define SERVER_LOG_DIR_NAME "@"SERVER_LOG_DIR +#define BRIDGE_LOG_DIR_NAME SERVER_LOG_DIR_NAME +#define SERVER_LOG_PERFIX "vpn" + +#define HUB_SECURITY_LOG_DIR "security_log" +#define HUB_SECURITY_LOG_DIR_NAME "@"HUB_SECURITY_LOG_DIR +#define HUB_SECURITY_LOG_FILE_NAME HUB_SECURITY_LOG_DIR_NAME"/%s" +#define HUB_SECURITY_LOG_PREFIX "sec" +#define HUB_PACKET_LOG_DIR "packet_log" +#define HUB_PACKET_LOG_DIR_NAME "@"HUB_PACKET_LOG_DIR +#define HUB_PACKET_LOG_FILE_NAME HUB_PACKET_LOG_DIR_NAME"/%s" +#define HUB_PACKET_LOG_PREFIX "pkt" + +#define NAT_LOG_DIR "secure_nat_log" +#define NAT_LOG_DIR_NAME "@"NAT_LOG_DIR +#define NAT_LOG_FILE_NAME NAT_LOG_DIR_NAME"/%s" +#define NAT_LOG_PREFIX "snat" + +#define CLIENT_LOG_DIR_NAME "@client_log" +#define CLIENT_LOG_PREFIX "client" + +// Packet log settings +#define NUM_PACKET_LOG 16 +#define PACKET_LOG_TCP_CONN 0 // TCP connection log +#define PACKET_LOG_TCP 1 // TCP packet log +#define PACKET_LOG_DHCP 2 // DHCP Log +#define PACKET_LOG_UDP 3 // UDP log +#define PACKET_LOG_ICMP 4 // ICMP log +#define PACKET_LOG_IP 5 // IP log +#define PACKET_LOG_ARP 6 // ARP log +#define PACKET_LOG_ETHERNET 7 // Ethernet log + +#define PACKET_LOG_NONE 0 // Not save +#define PACKET_LOG_HEADER 1 // Only header +#define PACKET_LOG_ALL 2 // Store also data + +// Timing of log switching +#define LOG_SWITCH_NO 0 // No switching +#define LOG_SWITCH_SECOND 1 // Secondly basis +#define LOG_SWITCH_MINUTE 2 // Minutely basis +#define LOG_SWITCH_HOUR 3 // Hourly basis +#define LOG_SWITCH_DAY 4 // Daily basis +#define LOG_SWITCH_MONTH 5 // Monthly basis + +// Minimum amount of free disk space +#define DISK_FREE_SPACE_MIN 1048576 // 1 MBytes +#define DISK_FREE_SPACE_DEFAULT (DISK_FREE_SPACE_MIN * 100) // 100 Mbytes +#define DISK_FREE_SPACE_DEFAULT_WINDOWS ((UINT64)(8ULL * 1024ULL * 1024ULL * 1024ULL)) // 8GBytes + +// Interval to check the free space +#define DISK_FREE_CHECK_INTERVAL_DEFAULT (5 * 60 * 1000) + +// Simple log +#define TINY_LOG_DIRNAME "@tiny_log" +#define TINY_LOG_FILENAME "@tiny_log/%04u%02u%02u_%02u%02u%02u.log" + + +////////////////////////////////////////////////////////////////////// +// +// Constant related to Carrier Edition +// +////////////////////////////////////////////////////////////////////// + +#define CE_SNAPSHOT_INTERVAL ((UINT64)(3600 * 1000)) +//#define CE_SNAPSHOT_INTERVAL ((UINT64)(3000)) +#define CE_SNAPSHOT_POLLING_INTERVAL (1 * 1000) +#define CE_SNAPSHOT_POLLING_INTERVAL_LICENSE (30 * 1000) +#define CE_SNAPSHOT_DIR_NAME "@carrier_log" +#define CE_SNAPSHOT_PREFIX "carrier" + + +////////////////////////////////////////////////////////////////////// +// +// Communication protocol related constant +// +////////////////////////////////////////////////////////////////////// + +// Administrator Username +#define ADMINISTRATOR_USERNAME "administrator" +// Maximum value of random size +#define RAND_SIZE_MAX 4096 +// Expiration date of random size cache +#define RAND_SIZE_CACHE_EXPIRE (24 * 60 * 60 * 1000) +// Management allowed IP address list file name +#define ADMINIP_TXT "$adminip.txt" + +#define NON_SSL_MIN_COUNT 60 +#define NON_SSL_ENTRY_EXPIRES (10 * 60 * 1000) + +////////////////////////////////////////////////////////////////////// +// +// The cascade related constants +// +////////////////////////////////////////////////////////////////////// + +#define LINK_DEVICE_NAME "_SEHUBLINKCLI_" +#define LINK_USER_NAME "link" +#define LINK_USER_NAME_PRINT "Cascade" + + + +////////////////////////////////////////////////////////////////////// +// +// Constant related to SecureNAT connection +// +////////////////////////////////////////////////////////////////////// + +#define SNAT_DEVICE_NAME "_SEHUBSECURENAT_" +#define SNAT_USER_NAME "securenat" +#define SNAT_USER_NAME_PRINT "SecureNAT" + + + +////////////////////////////////////////////////////////////////////// +// +// Constant related to bridge connection +// +////////////////////////////////////////////////////////////////////// + +#define BRIDGE_DEVICE_NAME "_SEHUBBRIDGE_" +#define BRIDGE_USER_NAME "localbridge" +#define BRIDGE_USER_NAME_PRINT "Local Bridge" +#define BRIDGE_TRY_SPAN 1000 +#define BRIDGE_NUM_DEVICE_CHECK_SPAN (5 * 60 * 1000) +#define BRIDGE_NETWORK_CONNECTION_STR L"%s [%S]" + + + +////////////////////////////////////////////////////////////////////// +// +// EtherLogger related constants +// +////////////////////////////////////////////////////////////////////// + +#define EL_ADMIN_PORT 22888 +#define EL_CONFIG_FILENAME "$etherlogger.config" +#define EL_PACKET_LOG_DIR "etherlogger_log" +#define EL_PACKET_LOG_DIR_NAME "@"EL_PACKET_LOG_DIR +#define EL_PACKET_LOG_FILE_NAME EL_PACKET_LOG_DIR_NAME"/%s" +#define EL_PACKET_LOG_PREFIX "pkt" +#define EL_LICENSE_CHECK_SPAN (10 * 1000) + + + +////////////////////////////////////////////////////////////////////// +// +// Layer-3 Switch related constants +// +////////////////////////////////////////////////////////////////////// + +#define MAX_NUM_L3_SWITCH 4096 +#define MAX_NUM_L3_IF 4096 +#define MAX_NUM_L3_TABLE 4096 + + + +////////////////////////////////////////////////////////////////////// +// +// Constant related to User-mode Router +// +////////////////////////////////////////////////////////////////////// + +#define ARP_ENTRY_EXPIRES (30 * 1000) // ARP table expiration date +#define ARP_ENTRY_POLLING_TIME (1 * 1000) // ARP table cleaning timer +#define ARP_REQUEST_TIMEOUT (1000) // ARP request time-out period +#define ARP_REQUEST_GIVEUP (5 * 1000) // Time to give up sending the ARP request +#define IP_WAIT_FOR_ARP_TIMEOUT (5 * 1000) // Total time that an IP packet waiting for ARP table +#define IP_COMBINE_TIMEOUT (10 * 1000) // Time-out of IP packet combining +#define NAT_TCP_MAX_TIMEOUT (2000000 * 1000) // Maximum TCP session timeout in seconds +#define NAT_UDP_MAX_TIMEOUT (2000000 * 1000) // Maximum UDP session timeout in seconds +#define NAT_TCP_MIN_TIMEOUT (1 * 60 * 1000) // Minimum TCP session timeout in seconds +#define NAT_UDP_MIN_TIMEOUT (10 * 1000) // Minimum UDP session timeout in seconds +#define NAT_TCP_RECV_WINDOW_SIZE 64512 // TCP receive window size +#define NAT_TCP_SYNACK_SEND_TIMEOUT 250 // Sending TCP SYN+ACK interval +#define NAT_ICMP_TIMEOUT (10 * 1000) // ICMP timeout in seconds +#define NAT_ICMP_TIMEOUT_WITH_API (3 * 1000) // Timeout in seconds in the case of using the ICMP API +#define NAT_SEND_BUF_SIZE (64 * 1024) // TCP send buffer size +#define NAT_RECV_BUF_SIZE (64 * 1024) // TCP receive buffer size +#define NAT_TMPBUF_SIZE (128 * 1024) // TCP temporally memory area size +#define NAT_ACK_KEEPALIVE_SPAN (5 * 1000) // ACK transmission interval for TCP keep alive +#define NAT_INITIAL_RTT_VALUE 500 // Initial RTT value +#define NAT_FIN_SEND_INTERVAL 1000 // FIN transmission interval +#define NAT_FIN_SEND_MAX_COUNT 5 // Total number of FIN transmissions +#define NAT_DNS_PROXY_PORT 53 // DNS proxy port number +#define NAT_DNS_RESPONSE_TTL (20 * 60) // TTL of the DNS response +#define NAT_DHCP_SERVER_PORT 67 // DHCP server port number +#define NAT_DHCP_CLIENT_PORT 68 // DHCP client port number +#define DHCP_MIN_EXPIRE_TIMESPAN (15 * 1000) // DHCP minimum expiration date +#define DHCP_POLLING_INTERVAL 1000 // DHCP polling interval +#define X32 ((UINT64)4294967296ULL) // 32bit + 1 +#define NAT_DNS_QUERY_TIMEOUT (512) // Time-out value of DNS queries + +// Beacon transmission interval +#define BEACON_SEND_INTERVAL (5 * 1000) + +// Total size quota allowed in the queue for the combining the IP packet +#define IP_COMBINE_WAIT_QUEUE_SIZE_QUOTA (50 * 1024 * 1024) + +// Header size constant +#define MAC_HEADER_SIZE (sizeof(MAC_HEADER)) +#define ARP_HEADER_SIZE (sizeof(ARP_HEADER)) +#define IP_HEADER_SIZE (sizeof(IPV4_HEADER)) +#define TCP_HEADER_SIZE (sizeof(TCP_HEADER)) +#define UDP_HEADER_SIZE (sizeof(UDP_HEADER)) + +// Data maximum size constant +#define MAX_L3_DATA_SIZE (1500) +#define MAX_IP_DATA_SIZE (MAX_L3_DATA_SIZE - IP_HEADER_SIZE) +#define MAX_TCP_DATA_SIZE (MAX_IP_DATA_SIZE - TCP_HEADER_SIZE) +#define MAX_UDP_DATA_SIZE (MAX_IP_DATA_SIZE - UDP_HEADER_SIZE) +#define MAX_IP_DATA_SIZE_TOTAL (65535) + +// IP packet option constant +#define DEFAULT_IP_TOS 0 // TOS in the IP header +#define DEFAULT_IP_TTL 128 // TTL in the IP header + +// Type of NAT session +#define NAT_TCP 0 // TCP NAT +#define NAT_UDP 1 // UDP NAT +#define NAT_DNS 2 // DNS NAT +#define NAT_ICMP 3 // ICMP NAT + +// State of NAT session +#define NAT_TCP_CONNECTING 0 // Connecting +#define NAT_TCP_SEND_RESET 1 // Send the RST (Connection failure or disconnected) +#define NAT_TCP_CONNECTED 2 // Connection complete +#define NAT_TCP_ESTABLISHED 3 // Connection established +#define NAT_TCP_WAIT_DISCONNECT 4 // Wait for socket disconnection + + +////////////////////////////////////////////////////////////////////// +// +// For UNIX virtual LAN card related constant +// +////////////////////////////////////////////////////////////////////// + +#ifndef UNIX_BSD +#define TAP_FILENAME_1 "/dev/net/tun" +#define TAP_FILENAME_2 "/dev/tun" +#else // UNIX_BSD +#define TAP_NAME "tap" +#define TAP_DIR "/dev/" +#define TAP_MAX (512) +#endif // UNIX_BSD + + +#define LICENSE_EDITION_VPN3_NO_LICENSE 0 // Without license + +#define LICENSE_MAX_PRODUCT_NAME_LEN 255 // Maximum length of license product name +#define LICENSE_NUM_SHA 10000 // Number of times to hash with SHA +#define LICENSE_SYSTEM_KEY_NUM 2048 // Key number for system +#define LICENSE_SYSTEM_KEYSIZE_BIT 144 // Number of key bits for system +#define LICENSE_PRODUCT_KEY_NUM 16384 // Number of keys for product +#define LICENSE_PRODUCT_KEYSIZE_BIT 56 // Number of key bits for product +#define LICENSE_PRODUCT_COMMON_KEYSIZE_BIT 48 // Number of common key bits for product +#define LICENSE_MASTER_KEYSIZE_BIT 1024 // Number of master key bits +#define LICENSE_SYSTEM_ID_MIN 0ULL // System ID minimum value +#define LICENSE_SYSTEM_ID_MAX 549755813887ULL // System ID maximum value +#define LICENSE_SERIAL_ID_MIN 0 // Serial ID minimum value +#define LICENSE_SERIAL_ID_MAX 65535 // Serial ID maximum value +#define LICENSE_EXPIRES_MIN 0 // Expiration date minimum +#define LICENSE_EXPIRES_MAX 16383 // Expiration date maximum +#define LICENSE_KEYSTR_LEN 41 // Length of the license key +#define LICENSE_LICENSEID_STR_LEN 33 // Length of the license ID + +#define LICENSE_STATUS_OK 0 // Enabled +#define LICENSE_STATUS_EXPIRED 1 // Invalid (expired) +#define LICENSE_STATUS_ID_DIFF 2 // Invalid (System ID mismatch) +#define LICENSE_STATUS_DUP 3 // Invalid (duplicated) +#define LICENSE_STATUS_INSUFFICIENT 4 // Invalid (other necessary license shortage) +#define LICENSE_STATUS_COMPETITION 5 // Invalid (conflict with other licenses) +#define LICENSE_STATUS_NONSENSE 6 // Invalid (meaningless in the current edition) +#define LICENSE_STATUS_CPU 7 // Invalid (CPU type mismatch) + +#define BIT_TO_BYTE(x) (((x) + 7) / 8) +#define BYTE_TO_BIT(x) ((x) * 8) + + +////////////////////////////////////////////////////////////////////// +// +// Error code +// +////////////////////////////////////////////////////////////////////// + +#define ERR_NO_ERROR 0 // No error +#define ERR_CONNECT_FAILED 1 // Connection to the server has failed +#define ERR_SERVER_IS_NOT_VPN 2 // The destination server is not a VPN server +#define ERR_DISCONNECTED 3 // The connection has been interrupted +#define ERR_PROTOCOL_ERROR 4 // Protocol error +#define ERR_CLIENT_IS_NOT_VPN 5 // Connecting client is not a VPN client +#define ERR_USER_CANCEL 6 // User cancel +#define ERR_AUTHTYPE_NOT_SUPPORTED 7 // Specified authentication method is not supported +#define ERR_HUB_NOT_FOUND 8 // The HUB does not exist +#define ERR_AUTH_FAILED 9 // Authentication failure +#define ERR_HUB_STOPPING 10 // HUB is stopped +#define ERR_SESSION_REMOVED 11 // Session has been deleted +#define ERR_ACCESS_DENIED 12 // Access denied +#define ERR_SESSION_TIMEOUT 13 // Session times out +#define ERR_INVALID_PROTOCOL 14 // Protocol is invalid +#define ERR_TOO_MANY_CONNECTION 15 // Too many connections +#define ERR_HUB_IS_BUSY 16 // Too many sessions of the HUB +#define ERR_PROXY_CONNECT_FAILED 17 // Connection to the proxy server fails +#define ERR_PROXY_ERROR 18 // Proxy Error +#define ERR_PROXY_AUTH_FAILED 19 // Failed to authenticate on the proxy server +#define ERR_TOO_MANY_USER_SESSION 20 // Too many sessions of the same user +#define ERR_LICENSE_ERROR 21 // License error +#define ERR_DEVICE_DRIVER_ERROR 22 // Device driver error +#define ERR_INTERNAL_ERROR 23 // Internal error +#define ERR_SECURE_DEVICE_OPEN_FAILED 24 // The secure device cannot be opened +#define ERR_SECURE_PIN_LOGIN_FAILED 25 // PIN code is incorrect +#define ERR_SECURE_NO_CERT 26 // Specified certificate is not stored +#define ERR_SECURE_NO_PRIVATE_KEY 27 // Specified private key is not stored +#define ERR_SECURE_CANT_WRITE 28 // Write failure +#define ERR_OBJECT_NOT_FOUND 29 // Specified object can not be found +#define ERR_VLAN_ALREADY_EXISTS 30 // Virtual LAN card with the specified name already exists +#define ERR_VLAN_INSTALL_ERROR 31 // Specified virtual LAN card cannot be created +#define ERR_VLAN_INVALID_NAME 32 // Specified name of the virtual LAN card is invalid +#define ERR_NOT_SUPPORTED 33 // Unsupported +#define ERR_ACCOUNT_ALREADY_EXISTS 34 // Account already exists +#define ERR_ACCOUNT_ACTIVE 35 // Account is operating +#define ERR_ACCOUNT_NOT_FOUND 36 // Specified account doesn't exist +#define ERR_ACCOUNT_INACTIVE 37 // Account is offline +#define ERR_INVALID_PARAMETER 38 // Parameter is invalid +#define ERR_SECURE_DEVICE_ERROR 39 // Error has occurred in the operation of the secure device +#define ERR_NO_SECURE_DEVICE_SPECIFIED 40 // Secure device is not specified +#define ERR_VLAN_IS_USED 41 // Virtual LAN card in use by account +#define ERR_VLAN_FOR_ACCOUNT_NOT_FOUND 42 // Virtual LAN card of the account can not be found +#define ERR_VLAN_FOR_ACCOUNT_USED 43 // Virtual LAN card of the account is already in use +#define ERR_VLAN_FOR_ACCOUNT_DISABLED 44 // Virtual LAN card of the account is disabled +#define ERR_INVALID_VALUE 45 // Value is invalid +#define ERR_NOT_FARM_CONTROLLER 46 // Not a farm controller +#define ERR_TRYING_TO_CONNECT 47 // Attempting to connect +#define ERR_CONNECT_TO_FARM_CONTROLLER 48 // Failed to connect to the farm controller +#define ERR_COULD_NOT_HOST_HUB_ON_FARM 49 // A virtual HUB on farm could not be created +#define ERR_FARM_MEMBER_HUB_ADMIN 50 // HUB cannot be managed on a farm member +#define ERR_NULL_PASSWORD_LOCAL_ONLY 51 // Accepting only local connections for an empty password +#define ERR_NOT_ENOUGH_RIGHT 52 // Right is insufficient +#define ERR_LISTENER_NOT_FOUND 53 // Listener can not be found +#define ERR_LISTENER_ALREADY_EXISTS 54 // Listener already exists +#define ERR_NOT_FARM_MEMBER 55 // Not a farm member +#define ERR_CIPHER_NOT_SUPPORTED 56 // Encryption algorithm is not supported +#define ERR_HUB_ALREADY_EXISTS 57 // HUB already exists +#define ERR_TOO_MANY_HUBS 58 // Too many HUBs +#define ERR_LINK_ALREADY_EXISTS 59 // Link already exists +#define ERR_LINK_CANT_CREATE_ON_FARM 60 // The link can not be created on the server farm +#define ERR_LINK_IS_OFFLINE 61 // Link is off-line +#define ERR_TOO_MANY_ACCESS_LIST 62 // Too many access list +#define ERR_TOO_MANY_USER 63 // Too many users +#define ERR_TOO_MANY_GROUP 64 // Too many Groups +#define ERR_GROUP_NOT_FOUND 65 // Group can not be found +#define ERR_USER_ALREADY_EXISTS 66 // User already exists +#define ERR_GROUP_ALREADY_EXISTS 67 // Group already exists +#define ERR_USER_AUTHTYPE_NOT_PASSWORD 68 // Authentication method of the user is not a password authentication +#define ERR_OLD_PASSWORD_WRONG 69 // The user does not exist or the old password is wrong +#define ERR_LINK_CANT_DISCONNECT 73 // Cascade session cannot be disconnected +#define ERR_ACCOUNT_NOT_PRESENT 74 // Not completed configure the connection to the VPN server +#define ERR_ALREADY_ONLINE 75 // It is already online +#define ERR_OFFLINE 76 // It is offline +#define ERR_NOT_RSA_1024 77 // The certificate is not RSA 1024bit +#define ERR_SNAT_CANT_DISCONNECT 78 // SecureNAT session cannot be disconnected +#define ERR_SNAT_NEED_STANDALONE 79 // SecureNAT works only in stand-alone HUB +#define ERR_SNAT_NOT_RUNNING 80 // SecureNAT function is not working +#define ERR_SE_VPN_BLOCK 81 // Stopped by PacketiX VPN Block +#define ERR_BRIDGE_CANT_DISCONNECT 82 // Bridge session can not be disconnected +#define ERR_LOCAL_BRIDGE_STOPPING 83 // Bridge function is stopped +#define ERR_LOCAL_BRIDGE_UNSUPPORTED 84 // Bridge feature is not supported +#define ERR_CERT_NOT_TRUSTED 85 // Certificate of the destination server can not be trusted +#define ERR_PRODUCT_CODE_INVALID 86 // Product code is different +#define ERR_VERSION_INVALID 87 // Version is different +#define ERR_CAPTURE_DEVICE_ADD_ERROR 88 // Adding capture device failure +#define ERR_VPN_CODE_INVALID 89 // VPN code is different +#define ERR_CAPTURE_NOT_FOUND 90 // Capture device can not be found +#define ERR_LAYER3_CANT_DISCONNECT 91 // Layer-3 session cannot be disconnected +#define ERR_LAYER3_SW_EXISTS 92 // L3 switch of the same already exists +#define ERR_LAYER3_SW_NOT_FOUND 93 // Layer-3 switch can not be found +#define ERR_INVALID_NAME 94 // Name is invalid +#define ERR_LAYER3_IF_ADD_FAILED 95 // Failed to add interface +#define ERR_LAYER3_IF_DEL_FAILED 96 // Failed to delete the interface +#define ERR_LAYER3_IF_EXISTS 97 // Interface that you specified already exists +#define ERR_LAYER3_TABLE_ADD_FAILED 98 // Failed to add routing table +#define ERR_LAYER3_TABLE_DEL_FAILED 99 // Failed to delete the routing table +#define ERR_LAYER3_TABLE_EXISTS 100 // Routing table entry that you specified already exists +#define ERR_BAD_CLOCK 101 // Time is queer +#define ERR_LAYER3_CANT_START_SWITCH 102 // The Virtual Layer 3 Switch can not be started +#define ERR_CLIENT_LICENSE_NOT_ENOUGH 103 // Client connection licenses shortage +#define ERR_BRIDGE_LICENSE_NOT_ENOUGH 104 // Bridge connection licenses shortage +#define ERR_SERVER_CANT_ACCEPT 105 // Not Accept on the technical issues +#define ERR_SERVER_CERT_EXPIRES 106 // Destination VPN server has expired +#define ERR_MONITOR_MODE_DENIED 107 // Monitor port mode was rejected +#define ERR_BRIDGE_MODE_DENIED 108 // Bridge-mode or Routing-mode was rejected +#define ERR_IP_ADDRESS_DENIED 109 // Client IP address is denied +#define ERR_TOO_MANT_ITEMS 110 // Too many items +#define ERR_MEMORY_NOT_ENOUGH 111 // Out of memory +#define ERR_OBJECT_EXISTS 112 // Object already exists +#define ERR_FATAL 113 // A fatal error occurred +#define ERR_SERVER_LICENSE_FAILED 114 // License violation has occurred on the server side +#define ERR_SERVER_INTERNET_FAILED 115 // Server side is not connected to the Internet +#define ERR_CLIENT_LICENSE_FAILED 116 // License violation occurs on the client side +#define ERR_BAD_COMMAND_OR_PARAM 117 // Command or parameter is invalid +#define ERR_INVALID_LICENSE_KEY 118 // License key is invalid +#define ERR_NO_VPN_SERVER_LICENSE 119 // There is no valid license for the VPN Server +#define ERR_NO_VPN_CLUSTER_LICENSE 120 // There is no cluster license +#define ERR_NOT_ADMINPACK_SERVER 121 // Not trying to connect to a server with the Administrator Pack license +#define ERR_NOT_ADMINPACK_SERVER_NET 122 // Not trying to connect to a server with the Administrator Pack license (for .NET) +#define ERR_BETA_EXPIRES 123 // Destination Beta VPN Server has expired +#define ERR_BRANDED_C_TO_S 124 // Branding string of connection limit is different (Authentication on the server side) +#define ERR_BRANDED_C_FROM_S 125 // Branding string of connection limit is different (Authentication for client-side) +#define ERR_AUTO_DISCONNECTED 126 // VPN session is disconnected for a certain period of time has elapsed +#define ERR_CLIENT_ID_REQUIRED 127 // Client ID does not match +#define ERR_TOO_MANY_USERS_CREATED 128 // Too many created users +#define ERR_SUBSCRIPTION_IS_OLDER 129 // Subscription expiration date Is earlier than the build date of the VPN Server +#define ERR_ILLEGAL_TRIAL_VERSION 130 // Many trial license is used continuously +#define ERR_NAT_T_TWO_OR_MORE 131 // There are multiple servers in the back of a global IP address in the NAT-T connection +#define ERR_DUPLICATE_DDNS_KEY 132 // DDNS host key duplicate +#define ERR_DDNS_HOSTNAME_EXISTS 133 // Specified DDNS host name already exists +#define ERR_DDNS_HOSTNAME_INVALID_CHAR 134 // Characters that can not be used for the host name is included +#define ERR_DDNS_HOSTNAME_TOO_LONG 135 // Host name is too long +#define ERR_DDNS_HOSTNAME_IS_EMPTY 136 // Host name is not specified +#define ERR_DDNS_HOSTNAME_TOO_SHORT 137 // Host name is too short +#define ERR_MSCHAP2_PASSWORD_NEED_RESET 138 // Necessary that password is changed +#define ERR_DDNS_DISCONNECTED 139 // Communication to the dynamic DNS server is disconnected +#define ERR_SPECIAL_LISTENER_ICMP_ERROR 140 // The ICMP socket can not be opened +#define ERR_SPECIAL_LISTENER_DNS_ERROR 141 // Socket for DNS port can not be opened +#define ERR_OPENVPN_IS_NOT_ENABLED 142 // OpenVPN server feature is not enabled +#define ERR_NOT_SUPPORTED_AUTH_ON_OPENSOURCE 143 // It is the type of user authentication that are not supported in the open source version +#define ERR_VPNGATE 144 // Operation on VPN Gate Server is not available +#define ERR_VPNGATE_CLIENT 145 // Operation on VPN Gate Client is not available +#define ERR_VPNGATE_INCLIENT_CANT_STOP 146 // Can not be stopped if operating within VPN Client mode +#define ERR_NOT_SUPPORTED_FUNCTION_ON_OPENSOURCE 147 // It is a feature that is not supported in the open source version +#define ERR_SUSPENDING 148 // System is suspending + + +//////////////////////////// +// Generally used structure + +// Network Services +typedef struct NETSVC +{ + bool Udp; // false=TCP, true=UDP + UINT Port; // Port number + char *Name; // Name +} NETSVC; + +// Traffic data entry +typedef struct TRAFFIC_ENTRY +{ + UINT64 BroadcastCount; // Number of broadcast packets + UINT64 BroadcastBytes; // Broadcast bytes + UINT64 UnicastCount; // Unicast count + UINT64 UnicastBytes; // Unicast bytes +} TRAFFIC_ENTRY; + +// Traffic data +typedef struct TRAFFIC +{ + TRAFFIC_ENTRY Send; // Transmitted data + TRAFFIC_ENTRY Recv; // Received data +} TRAFFIC; + +// Non-SSL connection source +typedef struct NON_SSL +{ + IP IpAddress; // IP address + UINT64 EntryExpires; // Expiration date of entry + UINT Count; // Number of connection count +} NON_SSL; + +// Simple log storage +typedef struct TINY_LOG +{ + char FileName[MAX_PATH]; // File name + IO *io; // File + LOCK *Lock; // Lock +} TINY_LOG; + +// CEDAR structure +typedef struct CEDAR +{ + LOCK *lock; // Lock + REF *ref; // Reference counter + COUNTER *AcceptingSockets; // Number of sockets in Accept + UINT Type; // Type + LIST *ListenerList; // Listener list + LIST *HubList; // HUB list + LIST *ConnectionList; // Negotiating connection list + LIST *CaList; // List of CA + volatile bool Halt; // Halt flag + COUNTER *ConnectionIncrement; // Connection increment counter + X *ServerX; // Server certificate + K *ServerK; // Private key of the server certificate + char UsernameHubSeparator; // Character which separates the username from the hub name + char *CipherList; // List of encryption algorithms + UINT Version; // Version information + UINT Build; // Build Number + char *ServerStr; // Server string + char *MachineName; // Computer name + char *HttpUserAgent; // HTTP user agent + char *HttpAccept; // HTTP Accept + char *HttpAcceptLanguage; // HTTP Accept Language + char *HttpAcceptEncoding; // HTTP Accept Encoding + TRAFFIC *Traffic; // Traffic information + LOCK *TrafficLock; // Traffic information lock + LIST *UDPEntryList; // UDP entry list + COUNTER *CurrentSessions; // The current number of sessions + COUNTER *CurrentTcpConnections; // Number of current TCP connections + LIST *NetSvcList; // Network service list + char *VerString; // Version string + char *BuildInfo; // Build Information + struct CLIENT *Client; // Client + struct SERVER *Server; // Server + UINT64 CreatedTick; // Generation date and time + bool CheckExpires; // Check the expiration date + LIST *TrafficDiffList; // Traffic difference list + struct LOG *DebugLog; // Debug log + UCHAR UniqueId[16]; // Unique ID + LIST *LocalBridgeList; // Local bridge list + bool Bridge; // Bridge version + LIST *L3SwList; // Layer-3 switch list + COUNTER *AssignedClientLicense; // Number of assigned client licenses + COUNTER *AssignedBridgeLicense; // Number of assigned bridge licenses + UINT64 LicenseViolationTick; // License violation occurs + LIST *NonSslList; // Non-SSL connection list + struct WEBUI *WebUI; // Data for WebUI service + UINT Beta; // Beta number + LOCK *CedarSuperLock; // Cedar super lock! + bool DisableIPv6Listener; // Disable IPv6 listener + UINT ClientId; // Client ID + UINT64 BuiltDate; // Build Date + LIST *UdpPortList; // UDP port list in use + char CurrentDDnsFqdn[MAX_SIZE]; // FQDN of the current DDNS + char OpenVPNPublicPorts[MAX_SIZE]; // OpenVPN public UDP port list + LOCK *OpenVPNPublicPortsLock; // Lock of OpenVPN public UDP port list + LOCK *CurrentRegionLock; // Current region lock + char CurrentRegion[128]; // Current region + LOCK *CurrentTcpQueueSizeLock; // Current TCP send queue size lock + UINT CurrentTcpQueueSize; // Current TCP send queue size + COUNTER *CurrentActiveLinks; // Current active cascade connections + LOCK *QueueBudgetLock; // Queue budget lock + UINT QueueBudget; // Queue budget + LOCK *FifoBudgetLock; // Fifo budget lock + UINT FifoBudget; // Fifo budget + SSL_ACCEPT_SETTINGS SslAcceptSettings; // SSL Accept Settings + UINT DhParamBits; // Bits of Diffie-Hellman parameters +} CEDAR; + +// Type of CEDAR +#define CEDAR_CLIENT 0 // Client +#define CEDAR_STANDALONE_SERVER 1 // Stand-alone server +#define CEDAR_FARM_CONTROLLER 2 // Server farm controller +#define CEDAR_FARM_MEMBER 3 // Server farm member + + +//////////////////////////// +// Read the header file + +// Type +#include +// Account Manager +#include +// Listener module +#include +// Log storage module +#include +// Connection management +#include +// Session Management +#include +// RPC +#include +// HUB management +#include +// Security Accounts Manager +#include +// Radius authentication module +#include +// Native protocol +#include +// Inter-HUB link +#include +// User-mode virtual host +#include +// SecureNAT +#include +// Digital watermark +#include +// Secure data +#include +// Console service +#include +// Vpncmd utility +#include +// RPC over HTTP +#include +// Layer-2/Layer-3 converter +#include +// Third party protocols +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +// UDP Acceleration +#include +// DDNS Client +#include +// VPN Azure Client +#include +// VPN Azure Server +#include +// Native IP Stack +#include + +#ifdef OS_WIN32 +// Neo device driver +#include +// SeLow User-mode +#include +#endif // OS_WIN32 + +// Neo device driver manipulation library +#include +// Bridge +#include +// Layer-3 switch +#include +// Virtual LAN card for test +#include +// Client +#include +// Server +#include +// License database +#include +// EtherLogger +#include +// Management RPC +#include +// User-mode Router +#include + +// Web UI +#include + +// VPN Gate Main Implementation +#include + + +#ifdef OS_WIN32 + +// Win32 user interface +#include +// Win32 Client Connection Manager +#include +// Win32 Server Manager +#include +// Win32 User-mode Router Manager +#include +// Win32 EtherLogger Manager +#include +// Win32 Network Utility +#include +// Win32 Setup Wizard +#include +// Win32 COM calling module +#include + +#endif + + + + +//////////////////////////// +// Function prototype + +TRAFFIC *NewTraffic(); +void FreeTraffic(TRAFFIC *t); +CEDAR *NewCedar(X *server_x, K *server_k); +void CedarForceLink(); +void SetCedarVpnBridge(CEDAR *c); +void SetCedarCert(CEDAR *c, X *server_x, K *server_k); +void ReleaseCedar(CEDAR *c); +void CleanupCedar(CEDAR *c); +void StopCedar(CEDAR *c); +void AddListener(CEDAR *c, LISTENER *r); +void StopAllListener(CEDAR *c); +void AddTraffic(TRAFFIC *dst, TRAFFIC *diff); +void AddHub(CEDAR *c, HUB *h); +void DelHub(CEDAR *c, HUB *h); +void DelHubEx(CEDAR *c, HUB *h, bool no_lock); +void StopAllHub(CEDAR *c); +void StopAllConnection(CEDAR *c); +void AddConnection(CEDAR *cedar, CONNECTION *c); +void DelConnection(CEDAR *cedar, CONNECTION *c); +void SetCedarCipherList(CEDAR *cedar, char *name); +void InitCedar(); +void FreeCedar(); +void AddCa(CEDAR *cedar, X *x); +bool DeleteCa(CEDAR *cedar, UINT ptr); +bool CheckSignatureByCa(CEDAR *cedar, X *x); +bool CheckSignatureByCaLinkMode(SESSION *s, X *x); +X *FindCaSignedX(LIST *o, X *x); +void InitNetSvcList(CEDAR *cedar); +void FreeNetSvcList(CEDAR *cedar); +int CompareNetSvc(void *p1, void *p2); +char *GetSvcName(CEDAR *cedar, bool udp, UINT port); +UINT64 GetTrafficPacketSize(TRAFFIC *t); +UINT64 GetTrafficPacketNum(TRAFFIC *t); +void StartCedarLog(); +void StopCedarLog(); +int CompareNoSslList(void *p1, void *p2); +void InitNoSslList(CEDAR *c); +void FreeNoSslList(CEDAR *c); +bool AddNoSsl(CEDAR *c, IP *ip); +void DecrementNoSsl(CEDAR *c, IP *ip, UINT num_dec); +void DeleteOldNoSsl(CEDAR *c); +NON_SSL *SearchNoSslList(CEDAR *c, IP *ip); +void FreeTinyLog(TINY_LOG *t); +void WriteTinyLog(TINY_LOG *t, char *str); +TINY_LOG *NewTinyLog(); +void GetWinVer(RPC_WINVER *v); +bool IsSupportedWinVer(RPC_WINVER *v); +SOCK *GetInProcListeningSock(CEDAR *c); +SOCK *GetReverseListeningSock(CEDAR *c); +void GetCedarVersion(char *tmp, UINT size); +UINT GetCedarVersionNumber(); +UINT64 GetCurrentBuildDate(); +void CedarAddCurrentTcpQueueSize(CEDAR *c, int diff); +UINT CedarGetCurrentTcpQueueSize(CEDAR *c); +void CedarAddQueueBudget(CEDAR *c, int diff); +void CedarAddFifoBudget(CEDAR *c, int diff); +UINT CedarGetQueueBudgetConsuming(CEDAR *c); +UINT CedarGetFifoBudgetConsuming(CEDAR *c); +UINT CedarGetQueueBudgetBalance(CEDAR *c); +UINT CedarGetFifoBudgetBalance(CEDAR *c); +bool CedarIsThereAnyEapEnabledRadiusConfig(CEDAR *c); + + + +#endif // CEDAR_H + diff --git a/src/Cedar/CedarPch.c b/src/Cedar/CedarPch.c index 722c7afa..b8e517f4 100644 --- a/src/Cedar/CedarPch.c +++ b/src/Cedar/CedarPch.c @@ -1,9 +1,9 @@ -// SoftEther VPN Source Code - Developer Edition Master Branch -// Cedar Communication Module - - -// CedarPch.c -// Cedar Pre-compile Header Generating Code - -#include "CedarPch.h" - +// SoftEther VPN Source Code - Developer Edition Master Branch +// Cedar Communication Module + + +// CedarPch.c +// Cedar Pre-compile Header Generating Code + +#include "CedarPch.h" + diff --git a/src/Cedar/CedarPch.h b/src/Cedar/CedarPch.h index a3eac0f6..10cdd745 100644 --- a/src/Cedar/CedarPch.h +++ b/src/Cedar/CedarPch.h @@ -1,20 +1,20 @@ -// SoftEther VPN Source Code - Developer Edition Master Branch -// Cedar Communication Module - - -// CedarPch.h -// Header file for grecompile header generation for Cedar - -#include - -#include -#include -#include -#include -#include -#include -#include - -#include -#include - +// SoftEther VPN Source Code - Developer Edition Master Branch +// Cedar Communication Module + + +// CedarPch.h +// Header file for grecompile header generation for Cedar + +#include + +#include +#include +#include +#include +#include +#include +#include + +#include +#include + diff --git a/src/Cedar/CedarType.h b/src/Cedar/CedarType.h index 74fa5798..c50184ee 100644 --- a/src/Cedar/CedarType.h +++ b/src/Cedar/CedarType.h @@ -1,671 +1,671 @@ -// SoftEther VPN Source Code - Developer Edition Master Branch -// Cedar Communication Module - - -// CedarType.h -// List of types that Cedar using - -#ifndef CEDARTYPE_H -#define CEDARTYPE_H - - -// ============================================================== -// Remote Procedure Call -// ============================================================== - -typedef struct RPC RPC; - - -// ============================================================== -// Account -// ============================================================== - -typedef struct POLICY_ITEM POLICY_ITEM; -typedef struct POLICY POLICY; -typedef struct USERGROUP USERGROUP; -typedef struct USER USER; -typedef struct AUTHPASSWORD AUTHPASSWORD; -typedef struct AUTHUSERCERT AUTHUSERCERT; -typedef struct AUTHROOTCERT AUTHROOTCERT; -typedef struct AUTHRADIUS AUTHRADIUS; -typedef struct AUTHNT AUTHNT; - - -// ============================================================== -// RADIUS -// ============================================================== - -typedef struct RADIUS_LOGIN_OPTION RADIUS_LOGIN_OPTION; -typedef struct RADIUS_PACKET RADIUS_PACKET; -typedef struct RADIUS_AVP RADIUS_AVP; -typedef struct EAP_CLIENT EAP_CLIENT; -typedef struct EAP_MESSAGE EAP_MESSAGE; -typedef struct EAP_MSCHAPV2_GENERAL EAP_MSCHAPV2_GENERAL; -typedef struct EAP_MSCHAPV2_CHALLENGE EAP_MSCHAPV2_CHALLENGE; -typedef struct EAP_MSCHAPV2_RESPONSE EAP_MSCHAPV2_RESPONSE; -typedef struct EAP_MSCHAPV2_SUCCESS_SERVER EAP_MSCHAPV2_SUCCESS_SERVER; -typedef struct EAP_MSCHAPV2_SUCCESS_CLIENT EAP_MSCHAPV2_SUCCESS_CLIENT; -typedef struct EAP_PEAP EAP_PEAP; - - -// ============================================================== -// Listener -// ============================================================== - -typedef struct DOS DOS; -typedef struct LISTENER LISTENER; -typedef struct TCP_ACCEPTED_PARAM TCP_ACCEPTED_PARAM; -typedef struct UDP_ENTRY UDP_ENTRY; -typedef struct DYNAMIC_LISTENER DYNAMIC_LISTENER; - - -// ============================================================== -// Logging -// ============================================================== - -typedef struct PACKET_LOG PACKET_LOG; -typedef struct HUB_LOG HUB_LOG; -typedef struct RECORD RECORD; -typedef struct LOG LOG; -typedef struct ERASER ERASER; -typedef struct SLOG SLOG; - - -// ============================================================== -// Connection -// ============================================================== - -typedef struct KEEP KEEP; -typedef struct SECURE_SIGN SECURE_SIGN; -typedef struct RC4_KEY_PAIR RC4_KEY_PAIR; -typedef struct CLIENT_OPTION CLIENT_OPTION; -typedef struct CLIENT_AUTH CLIENT_AUTH; -typedef struct TCPSOCK TCPSOCK; -typedef struct TCP TCP; -typedef struct UDP UDP; -typedef struct BLOCK BLOCK; -typedef struct CONNECTION CONNECTION; - - -// ============================================================== -// Session -// ============================================================== - -typedef struct NODE_INFO NODE_INFO; -typedef struct PACKET_ADAPTER PACKET_ADAPTER; -typedef struct SESSION SESSION; -typedef struct UI_PASSWORD_DLG UI_PASSWORD_DLG; -typedef struct UI_MSG_DLG UI_MSG_DLG; -typedef struct UI_NICINFO UI_NICINFO; -typedef struct UI_CONNECTERROR_DLG UI_CONNECTERROR_DLG; -typedef struct UI_CHECKCERT UI_CHECKCERT; - - -// ============================================================== -// Hub -// ============================================================== - -typedef struct SE_LINK SE_LINK; -typedef struct TEST_HISTORY TEST_HISTORY; -typedef struct SE_TEST SE_TEST; -typedef struct HUBDB HUBDB; -typedef struct TRAFFIC_LIMITER TRAFFIC_LIMITER; -typedef struct STORM STORM; -typedef struct HUB_PA HUB_PA; -typedef struct HUB_OPTION HUB_OPTION; -typedef struct MAC_TABLE_ENTRY MAC_TABLE_ENTRY; -typedef struct IP_TABLE_ENTRY IP_TABLE_ENTRY; -typedef struct LOOP_LIST LOOP_LIST; -typedef struct ACCESS ACCESS; -typedef struct TICKET TICKET; -typedef struct TRAFFIC_DIFF TRAFFIC_DIFF; -typedef struct HUB HUB; -typedef struct ADMIN_OPTION ADMIN_OPTION; -typedef struct CRL CRL; -typedef struct AC AC; -typedef struct USERLIST USERLIST; - - -// ============================================================== -// Protocol -// ============================================================== - -typedef struct CHECK_CERT_THREAD_PROC CHECK_CERT_THREAD_PROC; -typedef struct SECURE_SIGN_THREAD_PROC SECURE_SIGN_THREAD_PROC; -typedef struct RAND_CACHE RAND_CACHE; -typedef struct BLACK BLACK; -typedef struct SEND_SIGNATURE_PARAM SEND_SIGNATURE_PARAM; -typedef struct UPDATE_CLIENT UPDATE_CLIENT; -typedef struct UPDATE_CLIENT_SETTING UPDATE_CLIENT_SETTING; - - -// ============================================================== -// Link -// ============================================================== - -typedef struct LINK LINK; - - -// ============================================================== -// Virtual -// ============================================================== - -typedef struct ARP_ENTRY ARP_ENTRY; -typedef struct ARP_WAIT ARP_WAIT; -typedef struct IP_WAIT IP_WAIT; -typedef struct IP_PART IP_PART; -typedef struct IP_COMBINE IP_COMBINE; -typedef struct NAT_ENTRY NAT_ENTRY; -typedef struct TCP_OPTION TCP_OPTION; -typedef struct VH VH; -typedef struct VH_OPTION VH_OPTION; -typedef struct DHCP_LEASE DHCP_LEASE; -typedef struct NATIVE_NAT NATIVE_NAT; -typedef struct NATIVE_NAT_ENTRY NATIVE_NAT_ENTRY; -typedef struct DNS_PARSED_PACKET DNS_PARSED_PACKET; - - -// ============================================================== -// WPC -// ============================================================== - -typedef struct INTERNET_SETTING INTERNET_SETTING; -typedef struct URL_DATA URL_DATA; -typedef struct WPC_ENTRY WPC_ENTRY; -typedef struct WPC_PACKET WPC_PACKET; -typedef struct WPC_CONNECT WPC_CONNECT; - -// ============================================================== -// VLAN -// ============================================================== - -typedef struct ROUTE_TRACKING ROUTE_TRACKING; -typedef struct VLAN VLAN; -typedef struct INSTANCE_LIST INSTANCE_LIST; -typedef struct VLAN_PARAM VLAN_PARAM; - -#ifdef OS_UNIX -typedef struct UNIX_VLAN_LIST UNIX_VLAN_LIST; -#endif // OS_UNIX - -// ============================================================== -// Null LAN -// ============================================================== - -typedef struct NULL_LAN NULL_LAN; - - -// ============================================================== -// Bridge -// ============================================================== - -typedef struct ETH ETH; -typedef struct BRIDGE BRIDGE; -typedef struct LOCALBRIDGE LOCALBRIDGE; - - -// ============================================================== -// Layer-3 Switch -// ============================================================== - -typedef struct L3IF L3IF; -typedef struct L3SW L3SW; -typedef struct L3TABLE L3TABLE; -typedef struct L3ARPENTRY L3ARPENTRY; -typedef struct L3ARPWAIT L3ARPWAIT; -typedef struct L3PACKET L3PACKET; - - -// ============================================================== -// Client -// ============================================================== - -typedef struct ACCOUNT ACCOUNT; -typedef struct CLIENT_CONFIG CLIENT_CONFIG; -typedef struct RPC_CLIENT_VERSION RPC_CLIENT_VERSION; -typedef struct RPC_CLIENT_PASSWORD RPC_CLIENT_PASSWORD; -typedef struct RPC_CLIENT_PASSWORD_SETTING RPC_CLIENT_PASSWORD_SETTING; -typedef struct RPC_CLIENT_ENUM_CA_ITEM RPC_CLIENT_ENUM_CA_ITEM; -typedef struct RPC_CLIENT_ENUM_CA RPC_CLIENT_ENUM_CA; -typedef struct RPC_CERT RPC_CERT; -typedef struct RPC_CLIENT_DELETE_CA RPC_CLIENT_DELETE_CA; -typedef struct RPC_GET_CA RPC_GET_CA; -typedef struct RPC_GET_ISSUER RPC_GET_ISSUER; -typedef struct RPC_CLIENT_ENUM_SECURE_ITEM RPC_CLIENT_ENUM_SECURE_ITEM; -typedef struct RPC_CLIENT_ENUM_SECURE RPC_CLIENT_ENUM_SECURE; -typedef struct RPC_USE_SECURE RPC_USE_SECURE; -typedef struct RPC_ENUM_OBJECT_IN_SECURE RPC_ENUM_OBJECT_IN_SECURE; -typedef struct RPC_CLIENT_CREATE_VLAN RPC_CLIENT_CREATE_VLAN; -typedef struct RPC_CLIENT_GET_VLAN RPC_CLIENT_GET_VLAN; -typedef struct RPC_CLIENT_SET_VLAN RPC_CLIENT_SET_VLAN; -typedef struct RPC_CLIENT_ENUM_VLAN_ITEM RPC_CLIENT_ENUM_VLAN_ITEM; -typedef struct RPC_CLIENT_ENUM_VLAN RPC_CLIENT_ENUM_VLAN; -typedef struct RPC_CLIENT_CREATE_ACCOUNT RPC_CLIENT_CREATE_ACCOUNT; -typedef struct RPC_CLIENT_ENUM_ACCOUNT_ITEM RPC_CLIENT_ENUM_ACCOUNT_ITEM; -typedef struct RPC_CLIENT_ENUM_ACCOUNT RPC_CLIENT_ENUM_ACCOUNT; -typedef struct RPC_CLIENT_DELETE_ACCOUNT RPC_CLIENT_DELETE_ACCOUNT; -typedef struct RPC_RENAME_ACCOUNT RPC_RENAME_ACCOUNT; -typedef struct RPC_CLIENT_GET_ACCOUNT RPC_CLIENT_GET_ACCOUNT; -typedef struct RPC_CLIENT_CONNECT RPC_CLIENT_CONNECT; -typedef struct RPC_CLIENT_GET_CONNECTION_STATUS RPC_CLIENT_GET_CONNECTION_STATUS; -typedef struct CLIENT_RPC_CONNECTION CLIENT_RPC_CONNECTION; -typedef struct CLIENT CLIENT; -typedef struct RPC_CLIENT_NOTIFY RPC_CLIENT_NOTIFY; -typedef struct REMOTE_CLIENT REMOTE_CLIENT; -typedef struct NOTIFY_CLIENT NOTIFY_CLIENT; -typedef struct UNIX_VLAN UNIX_VLAN; -typedef struct CM_SETTING CM_SETTING; - - -// ============================================================== -// Server -// ============================================================== - -typedef struct HUB_LIST HUB_LIST; -typedef struct FARM_TASK FARM_TASK; -typedef struct FARM_MEMBER FARM_MEMBER; -typedef struct FARM_CONTROLLER FARM_CONTROLLER; -typedef struct SERVER_LISTENER SERVER_LISTENER; -typedef struct SERVER SERVER; -typedef struct RPC_ENUM_SESSION RPC_ENUM_SESSION; -typedef struct RPC_SESSION_STATUS RPC_SESSION_STATUS; -typedef struct CAPS CAPS; -typedef struct CAPSLIST CAPSLIST; -typedef struct LOG_FILE LOG_FILE; -typedef struct SYSLOG_SETTING SYSLOG_SETTING; -typedef struct HUB_SNAPSHOT HUB_SNAPSHOT; -typedef struct SERVER_SNAPSHOT SERVER_SNAPSHOT; -typedef struct SERVER_HUB_CREATE_HISTORY SERVER_HUB_CREATE_HISTORY; -typedef struct OPENVPN_SSTP_CONFIG OPENVPN_SSTP_CONFIG; - -// ============================================================== -// Server Admin Tool -// ============================================================== - -typedef struct ADMIN ADMIN; -typedef struct RPC_TEST RPC_TEST; -typedef struct RPC_SERVER_INFO RPC_SERVER_INFO; -typedef struct RPC_SERVER_STATUS RPC_SERVER_STATUS; -typedef struct RPC_LISTENER RPC_LISTENER; -typedef struct RPC_LISTENER_LIST RPC_LISTENER_LIST; -typedef struct RPC_PORTS RPC_PORTS; -typedef struct RPC_STR RPC_STR; -typedef struct RPC_PROTO_OPTIONS RPC_PROTO_OPTIONS; -typedef struct RPC_SET_PASSWORD RPC_SET_PASSWORD; -typedef struct RPC_FARM RPC_FARM; -typedef struct RPC_FARM_HUB RPC_FARM_HUB; -typedef struct RPC_FARM_INFO RPC_FARM_INFO; -typedef struct RPC_ENUM_FARM_ITEM RPC_ENUM_FARM_ITEM; -typedef struct RPC_ENUM_FARM RPC_ENUM_FARM; -typedef struct RPC_FARM_CONNECTION_STATUS RPC_FARM_CONNECTION_STATUS; -typedef struct RPC_KEY_PAIR RPC_KEY_PAIR; -typedef struct RPC_HUB_OPTION RPC_HUB_OPTION; -typedef struct RPC_RADIUS RPC_RADIUS; -typedef struct RPC_HUB RPC_HUB; -typedef struct RPC_CREATE_HUB RPC_CREATE_HUB; -typedef struct RPC_ENUM_HUB_ITEM RPC_ENUM_HUB_ITEM; -typedef struct RPC_ENUM_HUB RPC_ENUM_HUB; -typedef struct RPC_DELETE_HUB RPC_DELETE_HUB; -typedef struct RPC_ENUM_CONNECTION_ITEM RPC_ENUM_CONNECTION_ITEM; -typedef struct RPC_ENUM_CONNECTION RPC_ENUM_CONNECTION; -typedef struct RPC_DISCONNECT_CONNECTION RPC_DISCONNECT_CONNECTION; -typedef struct RPC_CONNECTION_INFO RPC_CONNECTION_INFO; -typedef struct RPC_SET_HUB_ONLINE RPC_SET_HUB_ONLINE; -typedef struct RPC_HUB_STATUS RPC_HUB_STATUS; -typedef struct RPC_HUB_LOG RPC_HUB_LOG; -typedef struct RPC_HUB_ADD_CA RPC_HUB_ADD_CA; -typedef struct RPC_HUB_ENUM_CA_ITEM RPC_HUB_ENUM_CA_ITEM; -typedef struct RPC_HUB_ENUM_CA RPC_HUB_ENUM_CA; -typedef struct RPC_HUB_GET_CA RPC_HUB_GET_CA; -typedef struct RPC_HUB_DELETE_CA RPC_HUB_DELETE_CA; -typedef struct RPC_CREATE_LINK RPC_CREATE_LINK; -typedef struct RPC_ENUM_LINK_ITEM RPC_ENUM_LINK_ITEM; -typedef struct RPC_ENUM_LINK RPC_ENUM_LINK; -typedef struct RPC_LINK_STATUS RPC_LINK_STATUS; -typedef struct RPC_LINK RPC_LINK; -typedef struct RPC_ENUM_ACCESS_LIST RPC_ENUM_ACCESS_LIST; -typedef struct RPC_ADD_ACCESS RPC_ADD_ACCESS; -typedef struct RPC_DELETE_ACCESS RPC_DELETE_ACCESS; -typedef struct RPC_SET_USER RPC_SET_USER; -typedef struct RPC_ENUM_USER_ITEM RPC_ENUM_USER_ITEM; -typedef struct RPC_ENUM_USER RPC_ENUM_USER; -typedef struct RPC_SET_GROUP RPC_SET_GROUP; -typedef struct RPC_ENUM_GROUP_ITEM RPC_ENUM_GROUP_ITEM; -typedef struct RPC_ENUM_GROUP RPC_ENUM_GROUP; -typedef struct RPC_DELETE_USER RPC_DELETE_USER; -typedef struct RPC_ENUM_SESSION_ITEM RPC_ENUM_SESSION_ITEM; -typedef struct RPC_DELETE_SESSION RPC_DELETE_SESSION; -typedef struct RPC_ENUM_MAC_TABLE_ITEM RPC_ENUM_MAC_TABLE_ITEM; -typedef struct RPC_ENUM_MAC_TABLE RPC_ENUM_MAC_TABLE; -typedef struct RPC_ENUM_IP_TABLE_ITEM RPC_ENUM_IP_TABLE_ITEM; -typedef struct RPC_ENUM_IP_TABLE RPC_ENUM_IP_TABLE; -typedef struct RPC_DELETE_TABLE RPC_DELETE_TABLE; -typedef struct RPC_KEEP RPC_KEEP; -typedef struct RPC_ENUM_ETH_ITEM RPC_ENUM_ETH_ITEM; -typedef struct RPC_ENUM_ETH RPC_ENUM_ETH; -typedef struct RPC_LOCALBRIDGE RPC_LOCALBRIDGE; -typedef struct RPC_ENUM_LOCALBRIDGE RPC_ENUM_LOCALBRIDGE; -typedef struct RPC_BRIDGE_SUPPORT RPC_BRIDGE_SUPPORT; -typedef struct RPC_CONFIG RPC_CONFIG; -typedef struct RPC_ADMIN_OPTION RPC_ADMIN_OPTION; -typedef struct RPC_L3SW RPC_L3SW; -typedef struct RPC_L3IF RPC_L3IF; -typedef struct RPC_L3TABLE RPC_L3TABLE; -typedef struct RPC_ENUM_L3SW_ITEM RPC_ENUM_L3SW_ITEM; -typedef struct RPC_ENUM_L3SW RPC_ENUM_L3SW; -typedef struct RPC_ENUM_L3IF RPC_ENUM_L3IF; -typedef struct RPC_ENUM_L3TABLE RPC_ENUM_L3TABLE; -typedef struct RPC_CRL RPC_CRL; -typedef struct RPC_ENUM_CRL_ITEM RPC_ENUM_CRL_ITEM; -typedef struct RPC_ENUM_CRL RPC_ENUM_CRL; -typedef struct RPC_INT RPC_INT; -typedef struct RPC_AC_LIST RPC_AC_LIST; -typedef struct RPC_ENUM_LOG_FILE_ITEM RPC_ENUM_LOG_FILE_ITEM; -typedef struct RPC_ENUM_LOG_FILE RPC_ENUM_LOG_FILE; -typedef struct RPC_READ_LOG_FILE RPC_READ_LOG_FILE; -typedef struct DOWNLOAD_PROGRESS DOWNLOAD_PROGRESS; -typedef struct RPC_RENAME_LINK RPC_RENAME_LINK; -typedef struct RPC_ENUM_LICENSE_KEY RPC_ENUM_LICENSE_KEY; -typedef struct RPC_ENUM_LICENSE_KEY_ITEM RPC_ENUM_LICENSE_KEY_ITEM; -typedef struct RPC_LICENSE_STATUS RPC_LICENSE_STATUS; -typedef struct RPC_ENUM_ETH_VLAN_ITEM RPC_ENUM_ETH_VLAN_ITEM; -typedef struct RPC_ENUM_ETH_VLAN RPC_ENUM_ETH_VLAN; -typedef struct RPC_MSG RPC_MSG; -typedef struct RPC_WINVER RPC_WINVER; -typedef struct RPC_ENUM_ETHERIP_ID RPC_ENUM_ETHERIP_ID; -typedef struct RPC_SPECIAL_LISTENER RPC_SPECIAL_LISTENER; -typedef struct RPC_AZURE_STATUS RPC_AZURE_STATUS; - - -// ============================================================== -// NAT -// ============================================================== - -typedef struct NAT NAT; -typedef struct NAT_ADMIN NAT_ADMIN; -typedef struct RPC_DUMMY RPC_DUMMY; -typedef struct RPC_NAT_STATUS RPC_NAT_STATUS; -typedef struct RPC_NAT_INFO RPC_NAT_INFO; -typedef struct RPC_ENUM_NAT_ITEM RPC_ENUM_NAT_ITEM; -typedef struct RPC_ENUM_NAT RPC_ENUM_NAT; -typedef struct RPC_ENUM_DHCP_ITEM RPC_ENUM_DHCP_ITEM; -typedef struct RPC_ENUM_DHCP RPC_ENUM_DHCP; - - -// ============================================================== -// SecureNAT -// ============================================================== - -typedef struct SNAT SNAT; - - -// ============================================================== -// WinUI -// ============================================================== - -typedef struct LED LED; -typedef struct WIZARD WIZARD; -typedef struct WIZARD_PAGE WIZARD_PAGE; -typedef struct WINUI_UPDATE WINUI_UPDATE; -typedef struct WINUI_UPDATE_DLG_PARAM WINUI_UPDATE_DLG_PARAM; - - - -// ============================================================== -// Console -// ============================================================== - -typedef struct PARAM PARAM; -typedef struct PARAM_VALUE PARAM_VALUE; -typedef struct CONSOLE CONSOLE; -typedef struct LOCAL_CONSOLE_PARAM LOCAL_CONSOLE_PARAM; -typedef struct CMD CMD; -typedef struct CMD_EVAL_MIN_MAX CMD_EVAL_MIN_MAX; - - -// ============================================================== -// Command -// ============================================================== - -typedef struct PS PS; -typedef struct PC PC; -typedef struct CT CT; -typedef struct CTC CTC; -typedef struct CTR CTR; -typedef struct TTC TTC; -typedef struct TTS TTS; -typedef struct TTS_WORKER TTS_WORKER; -typedef struct TTC_WORKER TTC_WORKER; -typedef struct TT_RESULT TT_RESULT; -typedef struct TTS_SOCK TTS_SOCK; -typedef struct TTC_SOCK TTC_SOCK; -typedef struct PT PT; - -// ============================================================== -// EtherLogger -// ============================================================== - -typedef struct EL EL; -typedef struct EL_DEVICE EL_DEVICE; -typedef struct EL_LICENSE_STATUS EL_LICENSE_STATUS; -typedef struct RPC_ADD_DEVICE RPC_ADD_DEVICE; -typedef struct RPC_DELETE_DEVICE RPC_DELETE_DEVICE; -typedef struct RPC_ENUM_DEVICE_ITEM RPC_ENUM_DEVICE_ITEM; -typedef struct RPC_ENUM_DEVICE RPC_ENUM_DEVICE; -typedef struct RPC_EL_LICENSE_STATUS RPC_EL_LICENSE_STATUS; - - -// ============================================================== -// Database -// ============================================================== - -typedef struct LICENSE_PRODUCT LICENSE_PRODUCT; -typedef struct LICENSE_SYSTEM LICENSE_SYSTEM; -typedef struct LICENSE_DATA LICENSE_DATA; -typedef struct LICENSE LICENSE; -typedef struct LICENSE_STATUS LICENSE_STATUS; -typedef struct SECURE_PACK_FOLDER SECURE_PACK_FOLDER; -typedef struct WIDE_MACHINE_ID WIDE_MACHINE_ID; -typedef struct TRIAL_INFO TRIAL_INFO; - - -// ============================================================== -// IPsec -// ============================================================== - -typedef struct IPSEC_SERVER IPSEC_SERVER; -typedef struct IPSEC_SERVICES IPSEC_SERVICES; -typedef struct ETHERIP_ID ETHERIP_ID; - - -// ============================================================== -// L2TP -// ============================================================== - -typedef struct L2TP_SERVER L2TP_SERVER; -typedef struct L2TP_TUNNEL L2TP_TUNNEL; -typedef struct L2TP_SESSION L2TP_SESSION; -typedef struct L2TP_PACKET L2TP_PACKET; -typedef struct L2TP_AVP L2TP_AVP; -typedef struct L2TP_QUEUE L2TP_QUEUE; - - -// ============================================================== -// PPP -// ============================================================== - -typedef struct PPP_SESSION PPP_SESSION; -typedef struct PPP_OPTION PPP_OPTION; -typedef struct PPP_LCP PPP_LCP; -typedef struct PPP_PACKET PPP_PACKET; -typedef struct PPP_IPOPTION PPP_IPOPTION; -typedef struct PPP_IPV6OPTION PPP_IPV6OPTION; -typedef struct PPP_REQUEST_RESEND PPP_REQUEST_RESEND; -typedef struct PPP_DELAYED_PACKET PPP_DELAYED_PACKET; -typedef struct PPP_EAP PPP_EAP; -typedef struct PPP_EAP_TLS_CONTEXT PPP_EAP_TLS_CONTEXT; - - -// ============================================================== -// EtherIP -// ============================================================== - -typedef struct ETHERIP_SERVER ETHERIP_SERVER; - - -// ============================================================== -// IKE -// ============================================================== - -typedef struct IKE_SERVER IKE_SERVER; -typedef struct IKE_SA IKE_SA; -typedef struct IKE_SA_TRANSFORM_SETTING IKE_SA_TRANSFORM_SETTING; -typedef struct IKE_CLIENT IKE_CLIENT; -typedef struct IPSECSA IPSECSA; -typedef struct IKE_CAPS IKE_CAPS; - -// ============================================================== -// IPSec Packet -// ============================================================== - -typedef struct IKE_COMMON_HEADER IKE_COMMON_HEADER; -typedef struct IKE_SA_HEADER IKE_SA_HEADER; -typedef struct IKE_PROPOSAL_HEADER IKE_PROPOSAL_HEADER; -typedef struct IKE_TRANSFORM_HEADER IKE_TRANSFORM_HEADER; -typedef struct IKE_TRANSFORM_VALUE IKE_TRANSFORM_VALUE; -typedef struct IKE_ID_HEADER IKE_ID_HEADER; -typedef struct IKE_CERT_HEADER IKE_CERT_HEADER; -typedef struct IKE_CERT_REQUEST_HEADER IKE_CERT_REQUEST_HEADER; -typedef struct IKE_NOTICE_HEADER IKE_NOTICE_HEADER; -typedef struct IKE_DELETE_HEADER IKE_DELETE_HEADER; -typedef struct IKE_NAT_OA_HEADER IKE_NAT_OA_HEADER; -typedef struct IPSEC_SA_TRANSFORM_SETTING IPSEC_SA_TRANSFORM_SETTING; - -typedef struct IKE_PACKET_SA_PAYLOAD IKE_PACKET_SA_PAYLOAD; -typedef struct IKE_PACKET_PROPOSAL_PAYLOAD IKE_PACKET_PROPOSAL_PAYLOAD; -typedef struct IKE_PACKET_TRANSFORM_PAYLOAD IKE_PACKET_TRANSFORM_PAYLOAD; -typedef struct IKE_PACKET_TRANSFORM_VALUE IKE_PACKET_TRANSFORM_VALUE; -typedef struct IKE_PACKET_DATA_PAYLOAD IKE_PACKET_DATA_PAYLOAD; -typedef struct IKE_PACKET_ID_PAYLOAD IKE_PACKET_ID_PAYLOAD; -typedef struct IKE_PACKET_CERT_PAYLOAD IKE_PACKET_CERT_PAYLOAD; -typedef struct IKE_PACKET_CERT_REQUEST_PAYLOAD IKE_PACKET_CERT_REQUEST_PAYLOAD; -typedef struct IKE_PACKET_NOTICE_PAYLOAD IKE_PACKET_NOTICE_PAYLOAD; -typedef struct IKE_PACKET_DELETE_PAYLOAD IKE_PACKET_DELETE_PAYLOAD; -typedef struct IKE_PACKET_NAT_OA_PAYLOAD IKE_PACKET_NAT_OA_PAYLOAD; - -typedef struct IKE_PACKET_PAYLOAD IKE_PACKET_PAYLOAD; -typedef struct IKE_PACKET IKE_PACKET; - -typedef struct IKE_P1_KEYSET IKE_P1_KEYSET; - -typedef struct IKE_CRYPTO IKE_CRYPTO; -typedef struct IKE_HASH IKE_HASH; -typedef struct IKE_DH IKE_DH; -typedef struct IKE_ENGINE IKE_ENGINE; -typedef struct IKE_CRYPTO_KEY IKE_CRYPTO_KEY; -typedef struct IKE_CRYPTO_PARAM IKE_CRYPTO_PARAM; - - -// ============================================================== -// IPSec for Windows 7 / Vista / 2008 / 2008 R2 -// ============================================================== - -typedef struct IPSEC_WIN7 IPSEC_WIN7; - - -// ============================================================== -// In-Process VPN Client -// ============================================================== - -typedef struct IPC IPC; -typedef struct IPC_ARP IPC_ARP; -typedef struct IPC_ASYNC IPC_ASYNC; -typedef struct IPC_PARAM IPC_PARAM; -typedef struct IPC_DHCP_RELEASE_QUEUE IPC_DHCP_RELEASE_QUEUE; -typedef struct IPC_MSCHAP_V2_AUTHINFO IPC_MSCHAP_V2_AUTHINFO; -typedef struct IPC_SESSION_SHARED_BUFFER_DATA IPC_SESSION_SHARED_BUFFER_DATA; -typedef struct IPC_IPV6_ROUTER_ADVERTISEMENT IPC_IPV6_ROUTER_ADVERTISEMENT; -typedef struct IPC_DHCPV4_AWAIT IPC_DHCPV4_AWAIT; - - -// ============================================================== -// UDP Acceleration -// ============================================================== - -typedef struct UDP_ACCEL UDP_ACCEL; - - -// ============================================================== -// SSTP (Microsoft Secure Socket Tunneling Protocol) Stack -// ============================================================== - -typedef struct SSTP_SERVER SSTP_SERVER; -typedef struct SSTP_PACKET SSTP_PACKET; -typedef struct SSTP_ATTRIBUTE SSTP_ATTRIBUTE; - - -// ============================================================== -// OpenVPN Protocol Stack -// ============================================================== - -typedef struct OPENVPN_SERVER OPENVPN_SERVER; -typedef struct OPENVPN_SERVER_UDP OPENVPN_SERVER_UDP; -typedef struct OPENVPN_SESSION OPENVPN_SESSION; -typedef struct OPENVPN_CHANNEL OPENVPN_CHANNEL; -typedef struct OPENVPN_PACKET OPENVPN_PACKET; -typedef struct OPENVPN_CONTROL_PACKET OPENVPN_CONTROL_PACKET; -typedef struct OPENVPN_KEY_METHOD_2 OPENVPN_KEY_METHOD_2; - - -// ============================================================== -// Dynamic DNS Client -// ============================================================== - -typedef struct DDNS_CLIENT DDNS_CLIENT; -typedef struct DDNS_REGISTER_PARAM DDNS_REGISTER_PARAM; -typedef struct DDNS_CLIENT_STATUS DDNS_CLIENT_STATUS; - - -// ============================================================== -// VPN Azure Client -// ============================================================== -typedef struct AZURE_CLIENT AZURE_CLIENT; -typedef struct AZURE_PARAM AZURE_PARAM; - - -// ============================================================== -// VPN Gate Service -// ============================================================== - -typedef struct VGS VGS; -typedef struct VGS_CONFIG VGS_CONFIG; -typedef struct VGC VGC; -typedef struct VGHOST VGHOST; -typedef struct VGHOSTLIST VGHOSTLIST; -typedef struct VGHOSTDAT VGHOSTDAT; -typedef struct VGCPOLLTASK VGCPOLLTASK; -typedef struct VGS_LOG VGS_LOG; -typedef struct VGC_UDPHOST VGC_UDPHOST; -typedef struct MIRROR_SERVER MIRROR_SERVER; - - -// ============================================================== -// Native Stack -// ============================================================== - -typedef struct NATIVE_STACK NATIVE_STACK; -typedef struct IPTABLES_STATE IPTABLES_STATE; -typedef struct IPTABLES_ENTRY IPTABLES_ENTRY; - - -// ============================================================== -// SeLow User-mode -// ============================================================== - -typedef struct SU SU; -typedef struct SU_ADAPTER SU_ADAPTER; -typedef struct SU_ADAPTER_LIST SU_ADAPTER_LIST; - - - -#endif // CEDARTYPE_H +// SoftEther VPN Source Code - Developer Edition Master Branch +// Cedar Communication Module + + +// CedarType.h +// List of types that Cedar using + +#ifndef CEDARTYPE_H +#define CEDARTYPE_H + + +// ============================================================== +// Remote Procedure Call +// ============================================================== + +typedef struct RPC RPC; + + +// ============================================================== +// Account +// ============================================================== + +typedef struct POLICY_ITEM POLICY_ITEM; +typedef struct POLICY POLICY; +typedef struct USERGROUP USERGROUP; +typedef struct USER USER; +typedef struct AUTHPASSWORD AUTHPASSWORD; +typedef struct AUTHUSERCERT AUTHUSERCERT; +typedef struct AUTHROOTCERT AUTHROOTCERT; +typedef struct AUTHRADIUS AUTHRADIUS; +typedef struct AUTHNT AUTHNT; + + +// ============================================================== +// RADIUS +// ============================================================== + +typedef struct RADIUS_LOGIN_OPTION RADIUS_LOGIN_OPTION; +typedef struct RADIUS_PACKET RADIUS_PACKET; +typedef struct RADIUS_AVP RADIUS_AVP; +typedef struct EAP_CLIENT EAP_CLIENT; +typedef struct EAP_MESSAGE EAP_MESSAGE; +typedef struct EAP_MSCHAPV2_GENERAL EAP_MSCHAPV2_GENERAL; +typedef struct EAP_MSCHAPV2_CHALLENGE EAP_MSCHAPV2_CHALLENGE; +typedef struct EAP_MSCHAPV2_RESPONSE EAP_MSCHAPV2_RESPONSE; +typedef struct EAP_MSCHAPV2_SUCCESS_SERVER EAP_MSCHAPV2_SUCCESS_SERVER; +typedef struct EAP_MSCHAPV2_SUCCESS_CLIENT EAP_MSCHAPV2_SUCCESS_CLIENT; +typedef struct EAP_PEAP EAP_PEAP; + + +// ============================================================== +// Listener +// ============================================================== + +typedef struct DOS DOS; +typedef struct LISTENER LISTENER; +typedef struct TCP_ACCEPTED_PARAM TCP_ACCEPTED_PARAM; +typedef struct UDP_ENTRY UDP_ENTRY; +typedef struct DYNAMIC_LISTENER DYNAMIC_LISTENER; + + +// ============================================================== +// Logging +// ============================================================== + +typedef struct PACKET_LOG PACKET_LOG; +typedef struct HUB_LOG HUB_LOG; +typedef struct RECORD RECORD; +typedef struct LOG LOG; +typedef struct ERASER ERASER; +typedef struct SLOG SLOG; + + +// ============================================================== +// Connection +// ============================================================== + +typedef struct KEEP KEEP; +typedef struct SECURE_SIGN SECURE_SIGN; +typedef struct RC4_KEY_PAIR RC4_KEY_PAIR; +typedef struct CLIENT_OPTION CLIENT_OPTION; +typedef struct CLIENT_AUTH CLIENT_AUTH; +typedef struct TCPSOCK TCPSOCK; +typedef struct TCP TCP; +typedef struct UDP UDP; +typedef struct BLOCK BLOCK; +typedef struct CONNECTION CONNECTION; + + +// ============================================================== +// Session +// ============================================================== + +typedef struct NODE_INFO NODE_INFO; +typedef struct PACKET_ADAPTER PACKET_ADAPTER; +typedef struct SESSION SESSION; +typedef struct UI_PASSWORD_DLG UI_PASSWORD_DLG; +typedef struct UI_MSG_DLG UI_MSG_DLG; +typedef struct UI_NICINFO UI_NICINFO; +typedef struct UI_CONNECTERROR_DLG UI_CONNECTERROR_DLG; +typedef struct UI_CHECKCERT UI_CHECKCERT; + + +// ============================================================== +// Hub +// ============================================================== + +typedef struct SE_LINK SE_LINK; +typedef struct TEST_HISTORY TEST_HISTORY; +typedef struct SE_TEST SE_TEST; +typedef struct HUBDB HUBDB; +typedef struct TRAFFIC_LIMITER TRAFFIC_LIMITER; +typedef struct STORM STORM; +typedef struct HUB_PA HUB_PA; +typedef struct HUB_OPTION HUB_OPTION; +typedef struct MAC_TABLE_ENTRY MAC_TABLE_ENTRY; +typedef struct IP_TABLE_ENTRY IP_TABLE_ENTRY; +typedef struct LOOP_LIST LOOP_LIST; +typedef struct ACCESS ACCESS; +typedef struct TICKET TICKET; +typedef struct TRAFFIC_DIFF TRAFFIC_DIFF; +typedef struct HUB HUB; +typedef struct ADMIN_OPTION ADMIN_OPTION; +typedef struct CRL CRL; +typedef struct AC AC; +typedef struct USERLIST USERLIST; + + +// ============================================================== +// Protocol +// ============================================================== + +typedef struct CHECK_CERT_THREAD_PROC CHECK_CERT_THREAD_PROC; +typedef struct SECURE_SIGN_THREAD_PROC SECURE_SIGN_THREAD_PROC; +typedef struct RAND_CACHE RAND_CACHE; +typedef struct BLACK BLACK; +typedef struct SEND_SIGNATURE_PARAM SEND_SIGNATURE_PARAM; +typedef struct UPDATE_CLIENT UPDATE_CLIENT; +typedef struct UPDATE_CLIENT_SETTING UPDATE_CLIENT_SETTING; + + +// ============================================================== +// Link +// ============================================================== + +typedef struct LINK LINK; + + +// ============================================================== +// Virtual +// ============================================================== + +typedef struct ARP_ENTRY ARP_ENTRY; +typedef struct ARP_WAIT ARP_WAIT; +typedef struct IP_WAIT IP_WAIT; +typedef struct IP_PART IP_PART; +typedef struct IP_COMBINE IP_COMBINE; +typedef struct NAT_ENTRY NAT_ENTRY; +typedef struct TCP_OPTION TCP_OPTION; +typedef struct VH VH; +typedef struct VH_OPTION VH_OPTION; +typedef struct DHCP_LEASE DHCP_LEASE; +typedef struct NATIVE_NAT NATIVE_NAT; +typedef struct NATIVE_NAT_ENTRY NATIVE_NAT_ENTRY; +typedef struct DNS_PARSED_PACKET DNS_PARSED_PACKET; + + +// ============================================================== +// WPC +// ============================================================== + +typedef struct INTERNET_SETTING INTERNET_SETTING; +typedef struct URL_DATA URL_DATA; +typedef struct WPC_ENTRY WPC_ENTRY; +typedef struct WPC_PACKET WPC_PACKET; +typedef struct WPC_CONNECT WPC_CONNECT; + +// ============================================================== +// VLAN +// ============================================================== + +typedef struct ROUTE_TRACKING ROUTE_TRACKING; +typedef struct VLAN VLAN; +typedef struct INSTANCE_LIST INSTANCE_LIST; +typedef struct VLAN_PARAM VLAN_PARAM; + +#ifdef OS_UNIX +typedef struct UNIX_VLAN_LIST UNIX_VLAN_LIST; +#endif // OS_UNIX + +// ============================================================== +// Null LAN +// ============================================================== + +typedef struct NULL_LAN NULL_LAN; + + +// ============================================================== +// Bridge +// ============================================================== + +typedef struct ETH ETH; +typedef struct BRIDGE BRIDGE; +typedef struct LOCALBRIDGE LOCALBRIDGE; + + +// ============================================================== +// Layer-3 Switch +// ============================================================== + +typedef struct L3IF L3IF; +typedef struct L3SW L3SW; +typedef struct L3TABLE L3TABLE; +typedef struct L3ARPENTRY L3ARPENTRY; +typedef struct L3ARPWAIT L3ARPWAIT; +typedef struct L3PACKET L3PACKET; + + +// ============================================================== +// Client +// ============================================================== + +typedef struct ACCOUNT ACCOUNT; +typedef struct CLIENT_CONFIG CLIENT_CONFIG; +typedef struct RPC_CLIENT_VERSION RPC_CLIENT_VERSION; +typedef struct RPC_CLIENT_PASSWORD RPC_CLIENT_PASSWORD; +typedef struct RPC_CLIENT_PASSWORD_SETTING RPC_CLIENT_PASSWORD_SETTING; +typedef struct RPC_CLIENT_ENUM_CA_ITEM RPC_CLIENT_ENUM_CA_ITEM; +typedef struct RPC_CLIENT_ENUM_CA RPC_CLIENT_ENUM_CA; +typedef struct RPC_CERT RPC_CERT; +typedef struct RPC_CLIENT_DELETE_CA RPC_CLIENT_DELETE_CA; +typedef struct RPC_GET_CA RPC_GET_CA; +typedef struct RPC_GET_ISSUER RPC_GET_ISSUER; +typedef struct RPC_CLIENT_ENUM_SECURE_ITEM RPC_CLIENT_ENUM_SECURE_ITEM; +typedef struct RPC_CLIENT_ENUM_SECURE RPC_CLIENT_ENUM_SECURE; +typedef struct RPC_USE_SECURE RPC_USE_SECURE; +typedef struct RPC_ENUM_OBJECT_IN_SECURE RPC_ENUM_OBJECT_IN_SECURE; +typedef struct RPC_CLIENT_CREATE_VLAN RPC_CLIENT_CREATE_VLAN; +typedef struct RPC_CLIENT_GET_VLAN RPC_CLIENT_GET_VLAN; +typedef struct RPC_CLIENT_SET_VLAN RPC_CLIENT_SET_VLAN; +typedef struct RPC_CLIENT_ENUM_VLAN_ITEM RPC_CLIENT_ENUM_VLAN_ITEM; +typedef struct RPC_CLIENT_ENUM_VLAN RPC_CLIENT_ENUM_VLAN; +typedef struct RPC_CLIENT_CREATE_ACCOUNT RPC_CLIENT_CREATE_ACCOUNT; +typedef struct RPC_CLIENT_ENUM_ACCOUNT_ITEM RPC_CLIENT_ENUM_ACCOUNT_ITEM; +typedef struct RPC_CLIENT_ENUM_ACCOUNT RPC_CLIENT_ENUM_ACCOUNT; +typedef struct RPC_CLIENT_DELETE_ACCOUNT RPC_CLIENT_DELETE_ACCOUNT; +typedef struct RPC_RENAME_ACCOUNT RPC_RENAME_ACCOUNT; +typedef struct RPC_CLIENT_GET_ACCOUNT RPC_CLIENT_GET_ACCOUNT; +typedef struct RPC_CLIENT_CONNECT RPC_CLIENT_CONNECT; +typedef struct RPC_CLIENT_GET_CONNECTION_STATUS RPC_CLIENT_GET_CONNECTION_STATUS; +typedef struct CLIENT_RPC_CONNECTION CLIENT_RPC_CONNECTION; +typedef struct CLIENT CLIENT; +typedef struct RPC_CLIENT_NOTIFY RPC_CLIENT_NOTIFY; +typedef struct REMOTE_CLIENT REMOTE_CLIENT; +typedef struct NOTIFY_CLIENT NOTIFY_CLIENT; +typedef struct UNIX_VLAN UNIX_VLAN; +typedef struct CM_SETTING CM_SETTING; + + +// ============================================================== +// Server +// ============================================================== + +typedef struct HUB_LIST HUB_LIST; +typedef struct FARM_TASK FARM_TASK; +typedef struct FARM_MEMBER FARM_MEMBER; +typedef struct FARM_CONTROLLER FARM_CONTROLLER; +typedef struct SERVER_LISTENER SERVER_LISTENER; +typedef struct SERVER SERVER; +typedef struct RPC_ENUM_SESSION RPC_ENUM_SESSION; +typedef struct RPC_SESSION_STATUS RPC_SESSION_STATUS; +typedef struct CAPS CAPS; +typedef struct CAPSLIST CAPSLIST; +typedef struct LOG_FILE LOG_FILE; +typedef struct SYSLOG_SETTING SYSLOG_SETTING; +typedef struct HUB_SNAPSHOT HUB_SNAPSHOT; +typedef struct SERVER_SNAPSHOT SERVER_SNAPSHOT; +typedef struct SERVER_HUB_CREATE_HISTORY SERVER_HUB_CREATE_HISTORY; +typedef struct OPENVPN_SSTP_CONFIG OPENVPN_SSTP_CONFIG; + +// ============================================================== +// Server Admin Tool +// ============================================================== + +typedef struct ADMIN ADMIN; +typedef struct RPC_TEST RPC_TEST; +typedef struct RPC_SERVER_INFO RPC_SERVER_INFO; +typedef struct RPC_SERVER_STATUS RPC_SERVER_STATUS; +typedef struct RPC_LISTENER RPC_LISTENER; +typedef struct RPC_LISTENER_LIST RPC_LISTENER_LIST; +typedef struct RPC_PORTS RPC_PORTS; +typedef struct RPC_STR RPC_STR; +typedef struct RPC_PROTO_OPTIONS RPC_PROTO_OPTIONS; +typedef struct RPC_SET_PASSWORD RPC_SET_PASSWORD; +typedef struct RPC_FARM RPC_FARM; +typedef struct RPC_FARM_HUB RPC_FARM_HUB; +typedef struct RPC_FARM_INFO RPC_FARM_INFO; +typedef struct RPC_ENUM_FARM_ITEM RPC_ENUM_FARM_ITEM; +typedef struct RPC_ENUM_FARM RPC_ENUM_FARM; +typedef struct RPC_FARM_CONNECTION_STATUS RPC_FARM_CONNECTION_STATUS; +typedef struct RPC_KEY_PAIR RPC_KEY_PAIR; +typedef struct RPC_HUB_OPTION RPC_HUB_OPTION; +typedef struct RPC_RADIUS RPC_RADIUS; +typedef struct RPC_HUB RPC_HUB; +typedef struct RPC_CREATE_HUB RPC_CREATE_HUB; +typedef struct RPC_ENUM_HUB_ITEM RPC_ENUM_HUB_ITEM; +typedef struct RPC_ENUM_HUB RPC_ENUM_HUB; +typedef struct RPC_DELETE_HUB RPC_DELETE_HUB; +typedef struct RPC_ENUM_CONNECTION_ITEM RPC_ENUM_CONNECTION_ITEM; +typedef struct RPC_ENUM_CONNECTION RPC_ENUM_CONNECTION; +typedef struct RPC_DISCONNECT_CONNECTION RPC_DISCONNECT_CONNECTION; +typedef struct RPC_CONNECTION_INFO RPC_CONNECTION_INFO; +typedef struct RPC_SET_HUB_ONLINE RPC_SET_HUB_ONLINE; +typedef struct RPC_HUB_STATUS RPC_HUB_STATUS; +typedef struct RPC_HUB_LOG RPC_HUB_LOG; +typedef struct RPC_HUB_ADD_CA RPC_HUB_ADD_CA; +typedef struct RPC_HUB_ENUM_CA_ITEM RPC_HUB_ENUM_CA_ITEM; +typedef struct RPC_HUB_ENUM_CA RPC_HUB_ENUM_CA; +typedef struct RPC_HUB_GET_CA RPC_HUB_GET_CA; +typedef struct RPC_HUB_DELETE_CA RPC_HUB_DELETE_CA; +typedef struct RPC_CREATE_LINK RPC_CREATE_LINK; +typedef struct RPC_ENUM_LINK_ITEM RPC_ENUM_LINK_ITEM; +typedef struct RPC_ENUM_LINK RPC_ENUM_LINK; +typedef struct RPC_LINK_STATUS RPC_LINK_STATUS; +typedef struct RPC_LINK RPC_LINK; +typedef struct RPC_ENUM_ACCESS_LIST RPC_ENUM_ACCESS_LIST; +typedef struct RPC_ADD_ACCESS RPC_ADD_ACCESS; +typedef struct RPC_DELETE_ACCESS RPC_DELETE_ACCESS; +typedef struct RPC_SET_USER RPC_SET_USER; +typedef struct RPC_ENUM_USER_ITEM RPC_ENUM_USER_ITEM; +typedef struct RPC_ENUM_USER RPC_ENUM_USER; +typedef struct RPC_SET_GROUP RPC_SET_GROUP; +typedef struct RPC_ENUM_GROUP_ITEM RPC_ENUM_GROUP_ITEM; +typedef struct RPC_ENUM_GROUP RPC_ENUM_GROUP; +typedef struct RPC_DELETE_USER RPC_DELETE_USER; +typedef struct RPC_ENUM_SESSION_ITEM RPC_ENUM_SESSION_ITEM; +typedef struct RPC_DELETE_SESSION RPC_DELETE_SESSION; +typedef struct RPC_ENUM_MAC_TABLE_ITEM RPC_ENUM_MAC_TABLE_ITEM; +typedef struct RPC_ENUM_MAC_TABLE RPC_ENUM_MAC_TABLE; +typedef struct RPC_ENUM_IP_TABLE_ITEM RPC_ENUM_IP_TABLE_ITEM; +typedef struct RPC_ENUM_IP_TABLE RPC_ENUM_IP_TABLE; +typedef struct RPC_DELETE_TABLE RPC_DELETE_TABLE; +typedef struct RPC_KEEP RPC_KEEP; +typedef struct RPC_ENUM_ETH_ITEM RPC_ENUM_ETH_ITEM; +typedef struct RPC_ENUM_ETH RPC_ENUM_ETH; +typedef struct RPC_LOCALBRIDGE RPC_LOCALBRIDGE; +typedef struct RPC_ENUM_LOCALBRIDGE RPC_ENUM_LOCALBRIDGE; +typedef struct RPC_BRIDGE_SUPPORT RPC_BRIDGE_SUPPORT; +typedef struct RPC_CONFIG RPC_CONFIG; +typedef struct RPC_ADMIN_OPTION RPC_ADMIN_OPTION; +typedef struct RPC_L3SW RPC_L3SW; +typedef struct RPC_L3IF RPC_L3IF; +typedef struct RPC_L3TABLE RPC_L3TABLE; +typedef struct RPC_ENUM_L3SW_ITEM RPC_ENUM_L3SW_ITEM; +typedef struct RPC_ENUM_L3SW RPC_ENUM_L3SW; +typedef struct RPC_ENUM_L3IF RPC_ENUM_L3IF; +typedef struct RPC_ENUM_L3TABLE RPC_ENUM_L3TABLE; +typedef struct RPC_CRL RPC_CRL; +typedef struct RPC_ENUM_CRL_ITEM RPC_ENUM_CRL_ITEM; +typedef struct RPC_ENUM_CRL RPC_ENUM_CRL; +typedef struct RPC_INT RPC_INT; +typedef struct RPC_AC_LIST RPC_AC_LIST; +typedef struct RPC_ENUM_LOG_FILE_ITEM RPC_ENUM_LOG_FILE_ITEM; +typedef struct RPC_ENUM_LOG_FILE RPC_ENUM_LOG_FILE; +typedef struct RPC_READ_LOG_FILE RPC_READ_LOG_FILE; +typedef struct DOWNLOAD_PROGRESS DOWNLOAD_PROGRESS; +typedef struct RPC_RENAME_LINK RPC_RENAME_LINK; +typedef struct RPC_ENUM_LICENSE_KEY RPC_ENUM_LICENSE_KEY; +typedef struct RPC_ENUM_LICENSE_KEY_ITEM RPC_ENUM_LICENSE_KEY_ITEM; +typedef struct RPC_LICENSE_STATUS RPC_LICENSE_STATUS; +typedef struct RPC_ENUM_ETH_VLAN_ITEM RPC_ENUM_ETH_VLAN_ITEM; +typedef struct RPC_ENUM_ETH_VLAN RPC_ENUM_ETH_VLAN; +typedef struct RPC_MSG RPC_MSG; +typedef struct RPC_WINVER RPC_WINVER; +typedef struct RPC_ENUM_ETHERIP_ID RPC_ENUM_ETHERIP_ID; +typedef struct RPC_SPECIAL_LISTENER RPC_SPECIAL_LISTENER; +typedef struct RPC_AZURE_STATUS RPC_AZURE_STATUS; + + +// ============================================================== +// NAT +// ============================================================== + +typedef struct NAT NAT; +typedef struct NAT_ADMIN NAT_ADMIN; +typedef struct RPC_DUMMY RPC_DUMMY; +typedef struct RPC_NAT_STATUS RPC_NAT_STATUS; +typedef struct RPC_NAT_INFO RPC_NAT_INFO; +typedef struct RPC_ENUM_NAT_ITEM RPC_ENUM_NAT_ITEM; +typedef struct RPC_ENUM_NAT RPC_ENUM_NAT; +typedef struct RPC_ENUM_DHCP_ITEM RPC_ENUM_DHCP_ITEM; +typedef struct RPC_ENUM_DHCP RPC_ENUM_DHCP; + + +// ============================================================== +// SecureNAT +// ============================================================== + +typedef struct SNAT SNAT; + + +// ============================================================== +// WinUI +// ============================================================== + +typedef struct LED LED; +typedef struct WIZARD WIZARD; +typedef struct WIZARD_PAGE WIZARD_PAGE; +typedef struct WINUI_UPDATE WINUI_UPDATE; +typedef struct WINUI_UPDATE_DLG_PARAM WINUI_UPDATE_DLG_PARAM; + + + +// ============================================================== +// Console +// ============================================================== + +typedef struct PARAM PARAM; +typedef struct PARAM_VALUE PARAM_VALUE; +typedef struct CONSOLE CONSOLE; +typedef struct LOCAL_CONSOLE_PARAM LOCAL_CONSOLE_PARAM; +typedef struct CMD CMD; +typedef struct CMD_EVAL_MIN_MAX CMD_EVAL_MIN_MAX; + + +// ============================================================== +// Command +// ============================================================== + +typedef struct PS PS; +typedef struct PC PC; +typedef struct CT CT; +typedef struct CTC CTC; +typedef struct CTR CTR; +typedef struct TTC TTC; +typedef struct TTS TTS; +typedef struct TTS_WORKER TTS_WORKER; +typedef struct TTC_WORKER TTC_WORKER; +typedef struct TT_RESULT TT_RESULT; +typedef struct TTS_SOCK TTS_SOCK; +typedef struct TTC_SOCK TTC_SOCK; +typedef struct PT PT; + +// ============================================================== +// EtherLogger +// ============================================================== + +typedef struct EL EL; +typedef struct EL_DEVICE EL_DEVICE; +typedef struct EL_LICENSE_STATUS EL_LICENSE_STATUS; +typedef struct RPC_ADD_DEVICE RPC_ADD_DEVICE; +typedef struct RPC_DELETE_DEVICE RPC_DELETE_DEVICE; +typedef struct RPC_ENUM_DEVICE_ITEM RPC_ENUM_DEVICE_ITEM; +typedef struct RPC_ENUM_DEVICE RPC_ENUM_DEVICE; +typedef struct RPC_EL_LICENSE_STATUS RPC_EL_LICENSE_STATUS; + + +// ============================================================== +// Database +// ============================================================== + +typedef struct LICENSE_PRODUCT LICENSE_PRODUCT; +typedef struct LICENSE_SYSTEM LICENSE_SYSTEM; +typedef struct LICENSE_DATA LICENSE_DATA; +typedef struct LICENSE LICENSE; +typedef struct LICENSE_STATUS LICENSE_STATUS; +typedef struct SECURE_PACK_FOLDER SECURE_PACK_FOLDER; +typedef struct WIDE_MACHINE_ID WIDE_MACHINE_ID; +typedef struct TRIAL_INFO TRIAL_INFO; + + +// ============================================================== +// IPsec +// ============================================================== + +typedef struct IPSEC_SERVER IPSEC_SERVER; +typedef struct IPSEC_SERVICES IPSEC_SERVICES; +typedef struct ETHERIP_ID ETHERIP_ID; + + +// ============================================================== +// L2TP +// ============================================================== + +typedef struct L2TP_SERVER L2TP_SERVER; +typedef struct L2TP_TUNNEL L2TP_TUNNEL; +typedef struct L2TP_SESSION L2TP_SESSION; +typedef struct L2TP_PACKET L2TP_PACKET; +typedef struct L2TP_AVP L2TP_AVP; +typedef struct L2TP_QUEUE L2TP_QUEUE; + + +// ============================================================== +// PPP +// ============================================================== + +typedef struct PPP_SESSION PPP_SESSION; +typedef struct PPP_OPTION PPP_OPTION; +typedef struct PPP_LCP PPP_LCP; +typedef struct PPP_PACKET PPP_PACKET; +typedef struct PPP_IPOPTION PPP_IPOPTION; +typedef struct PPP_IPV6OPTION PPP_IPV6OPTION; +typedef struct PPP_REQUEST_RESEND PPP_REQUEST_RESEND; +typedef struct PPP_DELAYED_PACKET PPP_DELAYED_PACKET; +typedef struct PPP_EAP PPP_EAP; +typedef struct PPP_EAP_TLS_CONTEXT PPP_EAP_TLS_CONTEXT; + + +// ============================================================== +// EtherIP +// ============================================================== + +typedef struct ETHERIP_SERVER ETHERIP_SERVER; + + +// ============================================================== +// IKE +// ============================================================== + +typedef struct IKE_SERVER IKE_SERVER; +typedef struct IKE_SA IKE_SA; +typedef struct IKE_SA_TRANSFORM_SETTING IKE_SA_TRANSFORM_SETTING; +typedef struct IKE_CLIENT IKE_CLIENT; +typedef struct IPSECSA IPSECSA; +typedef struct IKE_CAPS IKE_CAPS; + +// ============================================================== +// IPSec Packet +// ============================================================== + +typedef struct IKE_COMMON_HEADER IKE_COMMON_HEADER; +typedef struct IKE_SA_HEADER IKE_SA_HEADER; +typedef struct IKE_PROPOSAL_HEADER IKE_PROPOSAL_HEADER; +typedef struct IKE_TRANSFORM_HEADER IKE_TRANSFORM_HEADER; +typedef struct IKE_TRANSFORM_VALUE IKE_TRANSFORM_VALUE; +typedef struct IKE_ID_HEADER IKE_ID_HEADER; +typedef struct IKE_CERT_HEADER IKE_CERT_HEADER; +typedef struct IKE_CERT_REQUEST_HEADER IKE_CERT_REQUEST_HEADER; +typedef struct IKE_NOTICE_HEADER IKE_NOTICE_HEADER; +typedef struct IKE_DELETE_HEADER IKE_DELETE_HEADER; +typedef struct IKE_NAT_OA_HEADER IKE_NAT_OA_HEADER; +typedef struct IPSEC_SA_TRANSFORM_SETTING IPSEC_SA_TRANSFORM_SETTING; + +typedef struct IKE_PACKET_SA_PAYLOAD IKE_PACKET_SA_PAYLOAD; +typedef struct IKE_PACKET_PROPOSAL_PAYLOAD IKE_PACKET_PROPOSAL_PAYLOAD; +typedef struct IKE_PACKET_TRANSFORM_PAYLOAD IKE_PACKET_TRANSFORM_PAYLOAD; +typedef struct IKE_PACKET_TRANSFORM_VALUE IKE_PACKET_TRANSFORM_VALUE; +typedef struct IKE_PACKET_DATA_PAYLOAD IKE_PACKET_DATA_PAYLOAD; +typedef struct IKE_PACKET_ID_PAYLOAD IKE_PACKET_ID_PAYLOAD; +typedef struct IKE_PACKET_CERT_PAYLOAD IKE_PACKET_CERT_PAYLOAD; +typedef struct IKE_PACKET_CERT_REQUEST_PAYLOAD IKE_PACKET_CERT_REQUEST_PAYLOAD; +typedef struct IKE_PACKET_NOTICE_PAYLOAD IKE_PACKET_NOTICE_PAYLOAD; +typedef struct IKE_PACKET_DELETE_PAYLOAD IKE_PACKET_DELETE_PAYLOAD; +typedef struct IKE_PACKET_NAT_OA_PAYLOAD IKE_PACKET_NAT_OA_PAYLOAD; + +typedef struct IKE_PACKET_PAYLOAD IKE_PACKET_PAYLOAD; +typedef struct IKE_PACKET IKE_PACKET; + +typedef struct IKE_P1_KEYSET IKE_P1_KEYSET; + +typedef struct IKE_CRYPTO IKE_CRYPTO; +typedef struct IKE_HASH IKE_HASH; +typedef struct IKE_DH IKE_DH; +typedef struct IKE_ENGINE IKE_ENGINE; +typedef struct IKE_CRYPTO_KEY IKE_CRYPTO_KEY; +typedef struct IKE_CRYPTO_PARAM IKE_CRYPTO_PARAM; + + +// ============================================================== +// IPSec for Windows 7 / Vista / 2008 / 2008 R2 +// ============================================================== + +typedef struct IPSEC_WIN7 IPSEC_WIN7; + + +// ============================================================== +// In-Process VPN Client +// ============================================================== + +typedef struct IPC IPC; +typedef struct IPC_ARP IPC_ARP; +typedef struct IPC_ASYNC IPC_ASYNC; +typedef struct IPC_PARAM IPC_PARAM; +typedef struct IPC_DHCP_RELEASE_QUEUE IPC_DHCP_RELEASE_QUEUE; +typedef struct IPC_MSCHAP_V2_AUTHINFO IPC_MSCHAP_V2_AUTHINFO; +typedef struct IPC_SESSION_SHARED_BUFFER_DATA IPC_SESSION_SHARED_BUFFER_DATA; +typedef struct IPC_IPV6_ROUTER_ADVERTISEMENT IPC_IPV6_ROUTER_ADVERTISEMENT; +typedef struct IPC_DHCPV4_AWAIT IPC_DHCPV4_AWAIT; + + +// ============================================================== +// UDP Acceleration +// ============================================================== + +typedef struct UDP_ACCEL UDP_ACCEL; + + +// ============================================================== +// SSTP (Microsoft Secure Socket Tunneling Protocol) Stack +// ============================================================== + +typedef struct SSTP_SERVER SSTP_SERVER; +typedef struct SSTP_PACKET SSTP_PACKET; +typedef struct SSTP_ATTRIBUTE SSTP_ATTRIBUTE; + + +// ============================================================== +// OpenVPN Protocol Stack +// ============================================================== + +typedef struct OPENVPN_SERVER OPENVPN_SERVER; +typedef struct OPENVPN_SERVER_UDP OPENVPN_SERVER_UDP; +typedef struct OPENVPN_SESSION OPENVPN_SESSION; +typedef struct OPENVPN_CHANNEL OPENVPN_CHANNEL; +typedef struct OPENVPN_PACKET OPENVPN_PACKET; +typedef struct OPENVPN_CONTROL_PACKET OPENVPN_CONTROL_PACKET; +typedef struct OPENVPN_KEY_METHOD_2 OPENVPN_KEY_METHOD_2; + + +// ============================================================== +// Dynamic DNS Client +// ============================================================== + +typedef struct DDNS_CLIENT DDNS_CLIENT; +typedef struct DDNS_REGISTER_PARAM DDNS_REGISTER_PARAM; +typedef struct DDNS_CLIENT_STATUS DDNS_CLIENT_STATUS; + + +// ============================================================== +// VPN Azure Client +// ============================================================== +typedef struct AZURE_CLIENT AZURE_CLIENT; +typedef struct AZURE_PARAM AZURE_PARAM; + + +// ============================================================== +// VPN Gate Service +// ============================================================== + +typedef struct VGS VGS; +typedef struct VGS_CONFIG VGS_CONFIG; +typedef struct VGC VGC; +typedef struct VGHOST VGHOST; +typedef struct VGHOSTLIST VGHOSTLIST; +typedef struct VGHOSTDAT VGHOSTDAT; +typedef struct VGCPOLLTASK VGCPOLLTASK; +typedef struct VGS_LOG VGS_LOG; +typedef struct VGC_UDPHOST VGC_UDPHOST; +typedef struct MIRROR_SERVER MIRROR_SERVER; + + +// ============================================================== +// Native Stack +// ============================================================== + +typedef struct NATIVE_STACK NATIVE_STACK; +typedef struct IPTABLES_STATE IPTABLES_STATE; +typedef struct IPTABLES_ENTRY IPTABLES_ENTRY; + + +// ============================================================== +// SeLow User-mode +// ============================================================== + +typedef struct SU SU; +typedef struct SU_ADAPTER SU_ADAPTER; +typedef struct SU_ADAPTER_LIST SU_ADAPTER_LIST; + + + +#endif // CEDARTYPE_H diff --git a/src/Cedar/Client.c b/src/Cedar/Client.c index 3acf9423..30637724 100644 --- a/src/Cedar/Client.c +++ b/src/Cedar/Client.c @@ -1,10822 +1,10822 @@ -// SoftEther VPN Source Code - Developer Edition Master Branch -// Cedar Communication Module -// © 2020 Nokia - -// Client.c -// Client Manager - -#include "CedarPch.h" - -static CLIENT *client = NULL; -static LISTENER *cn_listener = NULL; -static LOCK *cn_listener_lock = NULL; -static UINT64 cn_next_allow = 0; -static LOCK *ci_active_sessions_lock = NULL; -static UINT ci_num_active_sessions = 0; - - -// In Windows 8 or later, change unreasonable setting of WCM to ensure normal VPN communication -void CiDisableWcmNetworkMinimize(CLIENT *c) -{ -#ifdef OS_WIN32 - // Validate arguments - if (c == NULL) - { - return; - } - - if (c->Config.NoChangeWcmNetworkSettingOnWindows8) - { - return; - } - - MsDisableWcmNetworkMinimize(); -#endif // OS_WIN32 -} - -// Compare RPC_CLIENT_ENUM_ACCOUNT_ITEM items by last connected date (Reverse) -int CiCompareClientAccountEnumItemByLastConnectDateTime(void *p1, void *p2) -{ - RPC_CLIENT_ENUM_ACCOUNT_ITEM *a1, *a2; - if (p1 == NULL || p2 == NULL) - { - return 0; - } - a1 = *(RPC_CLIENT_ENUM_ACCOUNT_ITEM **)p1; - a2 = *(RPC_CLIENT_ENUM_ACCOUNT_ITEM **)p2; - if (a1 == NULL || a2 == NULL) - { - return 0; - } - if (a1->LastConnectDateTime > a2->LastConnectDateTime) - { - return -1; - } - else if (a1->LastConnectDateTime < a2->LastConnectDateTime) - { - return 1; - } - - return 0; -} - -// If machine changed, reshuffle MAC address for all virtual NIC -void CiChangeAllVLanMacAddressIfMachineChanged(CLIENT *c) -{ - UCHAR current_hash_new[SHA1_SIZE]; - UCHAR current_hash[SHA1_SIZE]; - UCHAR current_hash_old[SHA1_SIZE]; - UCHAR saved_hash[SHA1_SIZE]; - // Validate arguments - if (c == NULL) - { - return; - } - -#ifdef OS_WIN32 - if (MsIsAdmin() == false) - { - return; - } -#endif - - CiGetCurrentMachineHashNew(current_hash_new); - CiGetCurrentMachineHash(current_hash); - CiGetCurrentMachineHashOld(current_hash_old); - - if (CiReadLastMachineHash(saved_hash) == false) - { - CiWriteLastMachineHash(current_hash_new); - return; - } - - if (Cmp(saved_hash, current_hash_old, SHA1_SIZE) == 0) - { - CiWriteLastMachineHash(current_hash_new); - return; - } - - if (Cmp(saved_hash, current_hash, SHA1_SIZE) == 0) - { - CiWriteLastMachineHash(current_hash_new); - return; - } - - if (Cmp(saved_hash, current_hash_new, SHA1_SIZE) == 0) - { - return; - } - - if (CiWriteLastMachineHash(current_hash_new) == false) - { - return; - } - - CiChangeAllVLanMacAddress(c); -} - -// Get current machine hash (Old) -void CiGetCurrentMachineHashOld(void *data) -{ - char name[MAX_PATH]; - char *product_id = NULL; - // Validate arguments - if (data == NULL) - { - return; - } - -#ifdef OS_WIN32 - // Product ID - product_id = MsRegReadStr(REG_LOCAL_MACHINE, "SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion", "ProductId"); - if (product_id == NULL) - { - product_id = MsRegReadStr(REG_LOCAL_MACHINE, "SOFTWARE\\Microsoft\\Windows\\CurrentVersion", "ProductId"); - } - - StrCpy(name, sizeof(name), product_id); - - Free(product_id); - -#else // OS_WIN32 - GetMachineName(name, sizeof(name)); -#endif // OS_WIN32 - - Trim(name); - StrUpper(name); - - Sha0(data, name, StrLen(name)); -} - -// Get current machine hash -void CiGetCurrentMachineHash(void *data) -{ - char name[MAX_PATH]; - char *product_id = NULL; - // Validate arguments - if (data == NULL) - { - return; - } - - GetMachineName(name, sizeof(name)); - - Trim(name); - StrUpper(name); - - Sha0(data, name, StrLen(name)); -} - -// Get current machine hash (without using domain name) -void CiGetCurrentMachineHashNew(void *data) -{ - char name[MAX_PATH]; - char *p; - - // Validate arguments - if (data == NULL) - { - return; - } - - GetMachineName(name, sizeof(name)); - - // Ignore after first period(.) - for(p=name; *p; p++) - if(*p == '.') - *p = 0; - - Trim(name); - StrUpper(name); - - Sha0(data, name, StrLen(name)); -} - - -// Write machine hash -bool CiWriteLastMachineHash(void *data) -{ - // Validate arguments - if (data == NULL) - { - return false; - } - -#ifdef OS_WIN32 - if (MsRegWriteBinEx(REG_LOCAL_MACHINE, MS_REG_TCP_SETTING_KEY, "LastMachineHash", data, SHA1_SIZE, true) == false) - { - return false; - } - - return true; -#else // OS_WIN32 - return false; -#endif // OS_WIN32 -} - -// Get previous machine hash -bool CiReadLastMachineHash(void *data) -{ - BUF *b = NULL; - // Validate arguments - if (data == NULL) - { - return false; - } - -#ifdef OS_WIN32 - b = MsRegReadBinEx(REG_LOCAL_MACHINE, MS_REG_TCP_SETTING_KEY, "LastMachineHash", true); - if (b == NULL) - { - return false; - } - if (b->Size == SHA1_SIZE) - { - Copy(data, b->Buf, b->Size); - FreeBuf(b); - - return true; - } - - FreeBuf(b); - return false; -#else // OS_WIN32 - return false; -#endif // OS_WIN32 -} - -// If the MAC address of each virtual LAN card has been eliminated, set it to random numbers -// (measures for Windows 8 -> 8.1 upgrade problem) -void CiChangeAllVLanMacAddressIfCleared(CLIENT *c) -{ -#ifdef OS_WIN32 - RPC_CLIENT_ENUM_VLAN t; - // Validate arguments - if (c == NULL) - { - return; - } - - if (MsIsInfCatalogRequired() == false) - { - // Not required for other than Windows 8 - return; - } - - Zero(&t, sizeof(t)); - if (CtEnumVLan(c, &t)) - { - UINT i; - - for (i = 0;i < t.NumItem;i++) - { - RPC_CLIENT_ENUM_VLAN_ITEM *e = t.Items[i]; - UCHAR mac[6]; - - if (StrToMac(mac, e->MacAddress)) - { - if (mac[0] == 0x00 && - mac[1] == 0x00 && - mac[2] == 0x01 && - mac[3] == 0x00 && - mac[4] == 0x00 && - mac[5] == 0x01) - { - char *name = e->DeviceName; - RPC_CLIENT_SET_VLAN s; - UCHAR mac[6]; - - GenMacAddress(mac); - - Zero(&s, sizeof(s)); - StrCpy(s.DeviceName, sizeof(s.DeviceName), name); - - MacToStr(s.MacAddress, sizeof(s.MacAddress), mac); - - CtSetVLan(c, &s); - } - } - } - - CiFreeClientEnumVLan(&t); - } -#endif // OS_WIN32 -} - -// Set the MAC address of all virtual LAN cards to random number -void CiChangeAllVLanMacAddress(CLIENT *c) -{ - RPC_CLIENT_ENUM_VLAN t; - // Validate arguments - if (c == NULL) - { - return; - } - - Zero(&t, sizeof(t)); - if (CtEnumVLan(c, &t)) - { - UINT i; - - for (i = 0;i < t.NumItem;i++) - { - RPC_CLIENT_ENUM_VLAN_ITEM *e = t.Items[i]; - UCHAR mac[6]; - - if (StrToMac(mac, e->MacAddress) && ((mac[0] == 0x00 && mac[1] == 0xAC) || (mac[0] == 0x5E))) - { - char *name = e->DeviceName; - RPC_CLIENT_SET_VLAN s; - UCHAR mac[6]; - - GenMacAddress(mac); - - Zero(&s, sizeof(s)); - StrCpy(s.DeviceName, sizeof(s.DeviceName), name); - - MacToStr(s.MacAddress, sizeof(s.MacAddress), mac); - - CtSetVLan(c, &s); - } - } - - CiFreeClientEnumVLan(&t); - } -} - -// Wait for preparation of notification service to complete -void CnWaitForCnServiceReady() -{ - UINT64 start_time = Tick64(); - - while ((start_time + (UINT64)CLIENT_WAIT_CN_READY_TIMEOUT) >= Tick64()) - { - if (CnIsCnServiceReady()) - { - break; - } - - SleepThread(100); - } -} - -// Check whether preparation of notification service completed -bool CnIsCnServiceReady() -{ - SOCK *s; - // Confirm running the notification service - if (CnCheckAlreadyExists(false) == false) - { - // Not running - return false; - } - - // Try to connect to the TCP port - s = ConnectEx("localhost", CLIENT_NOTIFY_PORT, 500); - if (s == NULL) - { - // The TCP port is not opened - return false; - } - - Disconnect(s); - ReleaseSock(s); - - // Running - return true; -} - -// Check whether the notification service is already running -bool CnCheckAlreadyExists(bool lock) -{ -#ifdef OS_WIN32 - return Win32CnCheckAlreadyExists(lock); -#else - return false; -#endif -} - -typedef struct CNC_STATUS_PRINTER_WINDOW_PARAM -{ - THREAD *Thread; - SESSION *Session; - SOCK *Sock; -} CNC_STATUS_PRINTER_WINDOW_PARAM; - -typedef struct CNC_CONNECT_ERROR_DLG_THREAD_PARAM -{ - SESSION *Session; - SOCK *Sock; - bool HaltThread; - EVENT *Event; -} CNC_CONNECT_ERROR_DLG_THREAD_PARAM; - -// Thread to stop forcibly the Certificate check dialog client -void CncCheckCertHaltThread(THREAD *thread, void *param) -{ - CNC_CONNECT_ERROR_DLG_THREAD_PARAM *dp = (CNC_CONNECT_ERROR_DLG_THREAD_PARAM *)param; - // Validate arguments - if (thread == NULL || param == NULL) - { - return; - } - - while (true) - { - if (dp->Session->Halt || dp->HaltThread) - { - break; - } - - Wait(dp->Event, 100); - } - - Disconnect(dp->Sock); -} - -// Show the certification check dialog -void CncCheckCert(SESSION *session, UI_CHECKCERT *dlg) -{ - SOCK *s; - PACK *p; - CNC_CONNECT_ERROR_DLG_THREAD_PARAM *dp; - THREAD *t; - // Validate arguments - if (dlg == NULL || session == NULL) - { - return; - } - - s = CncConnect(); - if (s == NULL) - { - return; - } - - p = NewPack(); - PackAddStr(p, "function", "check_cert"); - PackAddUniStr(p, "AccountName", dlg->AccountName); - PackAddStr(p, "ServerName", dlg->ServerName); - PackAddX(p, "x", dlg->x); - PackAddX(p, "parent_x", dlg->parent_x); - PackAddX(p, "old_x", dlg->old_x); - PackAddBool(p, "DiffWarning", dlg->DiffWarning); - PackAddBool(p, "Ok", dlg->Ok); - PackAddBool(p, "SaveServerCert", dlg->SaveServerCert); - - SendPack(s, p); - FreePack(p); - - dp = ZeroMalloc(sizeof(CNC_CONNECT_ERROR_DLG_THREAD_PARAM)); - dp->Sock = s; - dp->Event = NewEvent(); - dp->Session = session; - - t = NewThread(CncCheckCertHaltThread, dp); - - p = RecvPack(s); - if (p != NULL) - { - dlg->Ok = PackGetBool(p, "Ok"); - dlg->DiffWarning = PackGetBool(p, "DiffWarning"); - dlg->SaveServerCert = PackGetBool(p, "SaveServerCert"); - - FreePack(p); - } - - dp->HaltThread = true; - Set(dp->Event); - - WaitThread(t, INFINITE); - - ReleaseEvent(dp->Event); - Free(dp); - ReleaseThread(t); - - Disconnect(s); - ReleaseSock(s); -} - -// Smart card signature dialog -bool CncSecureSignDlg(SECURE_SIGN *sign) -{ - SOCK *s; - PACK *p; - bool ret = false; - // Validate arguments - if (sign == NULL) - { - return false; - } - - s = CncConnect(); - if (s == NULL) - { - return false; - } - - p = NewPack(); - PackAddStr(p, "function", "secure_sign"); - OutRpcSecureSign(p, sign); - - SendPack(s, p); - FreePack(p); - - p = RecvPack(s); - if (p != NULL) - { - ret = PackGetBool(p, "ret"); - - if (ret) - { - FreeRpcSecureSign(sign); - - Zero(sign, sizeof(SECURE_SIGN)); - InRpcSecureSign(sign, p); - } - - FreePack(p); - } - - Disconnect(s); - ReleaseSock(s); - - return ret; -} - -// Show the NIC information dialog -SOCK *CncNicInfo(UI_NICINFO *info) -{ - SOCK *s; - PACK *p; - // Validate arguments - if (info == NULL) - { - return NULL; - } - - s = CncConnectEx(200); - if (s == NULL) - { - return NULL; - } - - p = NewPack(); - PackAddStr(p, "function", "nicinfo"); - PackAddStr(p, "NicName", info->NicName); - PackAddUniStr(p, "AccountName", info->AccountName); - - SendPack(s, p); - FreePack(p); - - return s; -} - -// Close the NIC information dialog -void CncNicInfoFree(SOCK *s) -{ - // Validate arguments - if (s == NULL) - { - return; - } - - Disconnect(s); - ReleaseSock(s); -} - -// Show the message dialog -SOCK *CncMsgDlg(UI_MSG_DLG *dlg) -{ - SOCK *s; - PACK *p; - char *utf; - // Validate arguments - if (dlg == NULL) - { - return NULL; - } - - s = CncConnectEx(200); - if (s == NULL) - { - return NULL; - } - - p = NewPack(); - PackAddStr(p, "function", "msg_dialog"); - PackAddStr(p, "ServerName", dlg->ServerName); - PackAddStr(p, "HubName", dlg->HubName); - utf = CopyUniToUtf(dlg->Msg); - PackAddData(p, "Msg", utf, StrLen(utf)); - Free(utf); - - SendPack(s, p); - FreePack(p); - - return s; -} - -// Close the message dialog -void CndMsgDlgFree(SOCK *s) -{ - // Validate arguments - if (s == NULL) - { - return; - } - - Disconnect(s); - ReleaseSock(s); -} - -// Show the password input dialog -bool CncPasswordDlg(SESSION *session, UI_PASSWORD_DLG *dlg) -{ - SOCK *s; - PACK *p; - CNC_CONNECT_ERROR_DLG_THREAD_PARAM *dp; - THREAD *t; - bool ret = false; - // Validate arguments - if (dlg == NULL || session == NULL) - { - return false; - } - - s = CncConnect(); - if (s == NULL) - { - Wait(session->HaltEvent, session->RetryInterval); - return true; - } - - p = NewPack(); - PackAddStr(p, "function", "password_dialog"); - PackAddInt(p, "Type", dlg->Type); - PackAddStr(p, "Username", dlg->Username); - PackAddStr(p, "Password", dlg->Password); - PackAddStr(p, "ServerName", dlg->ServerName); - PackAddInt(p, "RetryIntervalSec", dlg->RetryIntervalSec); - PackAddBool(p, "ProxyServer", dlg->ProxyServer); - PackAddBool(p, "AdminMode", dlg->AdminMode); - PackAddBool(p, "ShowNoSavePassword", dlg->ShowNoSavePassword); - PackAddBool(p, "NoSavePassword", dlg->NoSavePassword); - - SendPack(s, p); - FreePack(p); - - dp = ZeroMalloc(sizeof(CNC_CONNECT_ERROR_DLG_THREAD_PARAM)); - dp->Session = session; - dp->Sock = s; - dp->Event = NewEvent(); - - t = NewThread(CncConnectErrorDlgHaltThread, dp); - - p = RecvPack(s); - if (p != NULL) - { - ret = PackGetBool(p, "ok"); - dlg->NoSavePassword = PackGetBool(p, "NoSavePassword"); - dlg->ProxyServer = PackGetBool(p, "ProxyServer"); - dlg->Type = PackGetInt(p, "Type"); - PackGetStr(p, "Username", dlg->Username, sizeof(dlg->Username)); - PackGetStr(p, "Password", dlg->Password, sizeof(dlg->Password)); - - FreePack(p); - } - - dp->HaltThread = true; - Set(dp->Event); - - WaitThread(t, INFINITE); - - ReleaseEvent(dp->Event); - Free(dp); - ReleaseThread(t); - - Disconnect(s); - ReleaseSock(s); - - return ret; -} - -// Thread to stop the connection error dialog client forcibly -void CncConnectErrorDlgHaltThread(THREAD *thread, void *param) -{ - CNC_CONNECT_ERROR_DLG_THREAD_PARAM *dp = (CNC_CONNECT_ERROR_DLG_THREAD_PARAM *)param; - // Validate arguments - if (thread == NULL || param == NULL) - { - return; - } - - while (true) - { - if (dp->Session->Halt || dp->HaltThread) - { - break; - } - - Wait(dp->Event, 100); - } - - Disconnect(dp->Sock); -} - -// Show the connection error dialog -bool CncConnectErrorDlg(SESSION *session, UI_CONNECTERROR_DLG *dlg) -{ - SOCK *s; - PACK *p; - CNC_CONNECT_ERROR_DLG_THREAD_PARAM *dp; - THREAD *t; - bool ret = false; - // Validate arguments - if (dlg == NULL || session == NULL) - { - return false; - } - - s = CncConnect(); - if (s == NULL) - { - Wait(session->HaltEvent, session->RetryInterval); - return true; - } - - p = NewPack(); - PackAddStr(p, "function", "connecterror_dialog"); - PackAddUniStr(p, "AccountName", dlg->AccountName); - PackAddStr(p, "ServerName", dlg->ServerName); - PackAddInt(p, "Err", dlg->Err); - PackAddInt(p, "CurrentRetryCount", dlg->CurrentRetryCount); - PackAddInt(p, "RetryLimit", dlg->RetryLimit); - PackAddInt(p, "RetryIntervalSec", dlg->RetryIntervalSec); - PackAddBool(p, "HideWindow", dlg->HideWindow); - - SendPack(s, p); - FreePack(p); - - dp = ZeroMalloc(sizeof(CNC_CONNECT_ERROR_DLG_THREAD_PARAM)); - dp->Session = session; - dp->Sock = s; - dp->Event = NewEvent(); - - t = NewThread(CncConnectErrorDlgHaltThread, dp); - - p = RecvPack(s); - if (p != NULL) - { - ret = PackGetBool(p, "ok"); - dlg->HideWindow = PackGetBool(p, "HideWindow"); - - FreePack(p); - } - - dp->HaltThread = true; - Set(dp->Event); - - WaitThread(t, INFINITE); - - ReleaseEvent(dp->Event); - Free(dp); - ReleaseThread(t); - - Disconnect(s); - ReleaseSock(s); - - return ret; -} - -// Thread for the status indicator client -void CncStatusPrinterWindowThreadProc(THREAD *thread, void *param) -{ - CNC_STATUS_PRINTER_WINDOW_PARAM *pp; - SOCK *sock; - PACK *p; - // Validate arguments - if (thread == NULL || param == NULL) - { - return; - } - - pp = (CNC_STATUS_PRINTER_WINDOW_PARAM *)param; - sock = pp->Sock; - pp->Thread = thread; - AddRef(pp->Thread->ref); - - NoticeThreadInit(thread); - - p = RecvPack(sock); - if (p != NULL) - { - // Stop the session - StopSessionEx(pp->Session, true); - - FreePack(p); - } -} - -// Create a status indicator client -SOCK *CncStatusPrinterWindowStart(SESSION *s) -{ - SOCK *sock; - PACK *p; - THREAD *t; - CNC_STATUS_PRINTER_WINDOW_PARAM *param; - // Validate arguments - if (s == NULL) - { - return NULL; - } - - sock = CncConnect(); - - if (sock == NULL) - { - return NULL; - } - - p = NewPack(); - PackAddStr(p, "function", "status_printer"); - PackAddUniStr(p, "account_name", s->Account->ClientOption->AccountName); - - if (SendPack(sock, p) == false) - { - FreePack(p); - ReleaseSock(sock); - - return NULL; - } - - FreePack(p); - - param = ZeroMalloc(sizeof(CNC_STATUS_PRINTER_WINDOW_PARAM)); - param->Sock = sock; - param->Session = s; - - sock->Param = param; - - t = NewThread(CncStatusPrinterWindowThreadProc, param); - WaitThreadInit(t); - - ReleaseThread(t); - - return sock; -} - -// Send a string to the status indicator -void CncStatusPrinterWindowPrint(SOCK *s, wchar_t *str) -{ - PACK *p; - // Validate arguments - if (s == NULL || str == NULL) - { - return; - } - - p = NewPack(); - PackAddUniStr(p, "string", str); - SendPack(s, p); - FreePack(p); -} - -// Stop the status indicator client -void CncStatusPrinterWindowStop(SOCK *s) -{ - CNC_STATUS_PRINTER_WINDOW_PARAM *param; - // Validate arguments - if (s == NULL) - { - return; - } - - param = (CNC_STATUS_PRINTER_WINDOW_PARAM *)s->Param; - - // Disconnect the client socket - Disconnect(s); - - // Terminate the thread - WaitThread(param->Thread, INFINITE); - ReleaseThread(param->Thread); - - Free(param); - ReleaseSock(s); -} - -// Start the driver installer for Windows Vista -bool CncExecDriverInstaller(char *arg) -{ - SOCK *s = CncConnect(); - PACK *p; - bool ret; - if (s == NULL) - { - return false; - } - - p = NewPack(); - PackAddStr(p, "function", "exec_driver_installer"); - PackAddStr(p, "arg", arg); - - SendPack(s, p); - FreePack(p); - - p = RecvPack(s); - if (p == NULL) - { - Disconnect(s); - ReleaseSock(s); - return false; - } - - ret = PackGetBool(p, "ret"); - - FreePack(p); - - Disconnect(s); - ReleaseSock(s); - - return ret; -} - -// Let the current running client notification services releasing the socket -void CncReleaseSocket() -{ - SOCK *s = CncConnect(); - PACK *p; - if (s == NULL) - { - return; - } - - p = NewPack(); - PackAddStr(p, "function", "release_socket"); - -#ifdef OS_WIN32 - PackAddInt(p, "pid", MsGetProcessId()); -#endif // OS_WIN32 - - SendPack(s, p); - FreePack(p); - - Disconnect(s); - ReleaseSock(s); -} - -// Terminate the process of the client notification service -void CncExit() -{ - SOCK *s = CncConnectEx(256); - PACK *p; - if (s != NULL) - { - p = NewPack(); - PackAddStr(p, "function", "exit"); - - SendPack(s, p); - - FreePack(p); - - FreePack(RecvPack(s)); - - Disconnect(s); - ReleaseSock(s); - } - -#ifdef OS_WIN32 - MsKillOtherInstanceEx("vpnclient"); -#endif // OS_WIN32 -} - -// Connect to the client notification service -SOCK *CncConnect() -{ - return CncConnectEx(0); -} -SOCK *CncConnectEx(UINT timeout) -{ - SOCK *s = ConnectEx("localhost", CLIENT_NOTIFY_PORT, timeout); - - return s; -} - -#ifdef OS_WIN32 - -// Thread for the certificate check dialog -void Win32CnCheckCertThreadProc(THREAD *thread, void *param) -{ - UI_CHECKCERT *dlg; - // Validate arguments - if (thread == NULL || param == NULL) - { - return; - } - - dlg = (UI_CHECKCERT *)param; - - CheckCertDlg(dlg); - { - PACK *p = NewPack(); - - PackAddBool(p, "Ok", dlg->Ok); - PackAddBool(p, "SaveServerCert", dlg->SaveServerCert); - - SendPack(dlg->Sock, p); - FreePack(p); - - FreePack(RecvPack(dlg->Sock)); - } - - Disconnect(dlg->Sock); -} - -// Certificate check dialog -void Win32CnCheckCert(SOCK *s, PACK *p) -{ - UI_CHECKCERT dlg; - THREAD *t; - Zero(&dlg, sizeof(dlg)); - // Validate arguments - if (s == NULL || p == NULL) - { - return; - } - - PackGetUniStr(p, "AccountName", dlg.AccountName, sizeof(dlg.AccountName)); - PackGetStr(p, "ServerName", dlg.ServerName, sizeof(dlg.ServerName)); - dlg.x = PackGetX(p, "x"); - dlg.parent_x = PackGetX(p, "parent_x"); - dlg.old_x = PackGetX(p, "old_x"); - dlg.DiffWarning = PackGetBool(p, "DiffWarning"); - dlg.Ok = PackGetBool(p, "Ok"); - dlg.SaveServerCert = PackGetBool(p, "SaveServerCert"); - dlg.Sock = s; - - t = NewThread(Win32CnCheckCertThreadProc, &dlg); - - FreePack(RecvPack(s)); - - dlg.Halt = true; - - WaitThread(t, INFINITE); - ReleaseThread(t); - - FreeX(dlg.parent_x); - FreeX(dlg.old_x); - FreeX(dlg.x); -} - -// Message display dialog thread procedure -void Win32CnMsgDlgThreadProc(THREAD *thread, void *param) -{ - UI_MSG_DLG *dlg = (UI_MSG_DLG *)param; - wchar_t tmp[MAX_SIZE]; - char url[MAX_SIZE]; - // Validate arguments - if (thread == NULL || dlg == NULL) - { - return; - } - - UniFormat(tmp, sizeof(tmp), _UU("CM_MSG_TITLE"), - dlg->ServerName, dlg->HubName); - - if (IsURLMsg(dlg->Msg, url, sizeof(url)) == false) - { - OnceMsgEx(NULL, tmp, dlg->Msg, true, 167, &dlg->Halt); - } - else - { - if (MsExecute(url, NULL) == false) - { - OnceMsgEx(NULL, tmp, dlg->Msg, true, 167, &dlg->Halt); - } - } - - Disconnect(dlg->Sock); -} - -// NIC information dialog thread procedure -void Win32CnNicInfoThreadProc(THREAD *thread, void *param) -{ - UI_NICINFO *info = (UI_NICINFO *)param; - // Validate arguments - if (thread == NULL || info == NULL) - { - return; - } - - if (MsIsNt()) - { - // Do not show a dialog on Windows 9x system - NicInfo(info); - } - - Disconnect(info->Sock); -} - -// NIC information dialog -void Win32CnNicInfo(SOCK *s, PACK *p) -{ - UI_NICINFO info; - THREAD *t; - Zero(&info, sizeof(info)); - // Validate arguments - if (s == NULL || p == NULL) - { - return; - } - - PackGetStr(p, "NicName", info.NicName, sizeof(info.NicName)); - PackGetUniStr(p, "AccountName", info.AccountName, sizeof(info.AccountName)); - - info.Sock = s; - - t = NewThread(Win32CnNicInfoThreadProc, &info); - - FreePack(RecvPack(s)); - - info.Halt = true; - - WaitThread(t, INFINITE); - ReleaseThread(t); -} - -// Message display dialog -void Win32CnMsgDlg(SOCK *s, PACK *p) -{ - UI_MSG_DLG dlg; - THREAD *t; - UINT utf_size; - char *utf; - wchar_t *msg; - Zero(&dlg, sizeof(dlg)); - // Validate arguments - if (s == NULL || p == NULL) - { - return; - } - - PackGetStr(p, "ServerName", dlg.ServerName, sizeof(dlg.ServerName)); - PackGetStr(p, "HubName", dlg.HubName, sizeof(dlg.HubName)); - - utf_size = PackGetDataSize(p, "Msg"); - utf = ZeroMalloc(utf_size + 8); - - PackGetData(p, "Msg", utf); - - msg = CopyUtfToUni(utf); - Free(utf); - - dlg.Sock = s; - dlg.Msg = msg; - - t = NewThread(Win32CnMsgDlgThreadProc, &dlg); - - FreePack(RecvPack(s)); - - dlg.Halt = true; - - WaitThread(t, INFINITE); - ReleaseThread(t); - - Free(msg); -} - -// Thread for Password input dialog -void Win32CnPasswordDlgThreadProc(THREAD *thread, void *param) -{ - UI_PASSWORD_DLG *dlg; - // Validate arguments - if (thread == NULL || param == NULL) - { - return; - } - - dlg = (UI_PASSWORD_DLG *)param; - - if (PasswordDlg(NULL, dlg)) - { - PACK *p = NewPack(); - - PackAddBool(p, "ok", true); - PackAddStr(p, "Username", dlg->Username); - PackAddStr(p, "Password", dlg->Password); - PackAddInt(p, "Type", dlg->Type); - PackAddBool(p, "ProxyServer", dlg->ProxyServer); - PackAddBool(p, "NoSavePassword", dlg->NoSavePassword); - - SendPack(dlg->Sock, p); - FreePack(p); - - FreePack(RecvPack(dlg->Sock)); - } - - Disconnect(dlg->Sock); -} - -// Password input dialog -void Win32CnPasswordDlg(SOCK *s, PACK *p) -{ - UI_PASSWORD_DLG dlg; - THREAD *t = NULL; - Zero(&dlg, sizeof(dlg)); - // Validate arguments - if (s == NULL || p == NULL) - { - return; - } - - dlg.Type = PackGetInt(p, "Type"); - PackGetStr(p, "Username", dlg.Username, sizeof(dlg.Username)); - PackGetStr(p, "Password", dlg.Password, sizeof(dlg.Password)); - PackGetStr(p, "ServerName", dlg.ServerName, sizeof(dlg.ServerName)); - dlg.RetryIntervalSec = PackGetInt(p, "RetryIntervalSec"); - dlg.ProxyServer = PackGetBool(p, "ProxyServer"); - dlg.AdminMode = PackGetBool(p, "AdminMode"); - dlg.ShowNoSavePassword = PackGetBool(p, "ShowNoSavePassword"); - dlg.NoSavePassword = PackGetBool(p, "NoSavePassword"); - dlg.CancelEvent = NewEvent(); - dlg.Sock = s; - - t = NewThread(Win32CnPasswordDlgThreadProc, &dlg); - - FreePack(RecvPack(s)); - - Set(dlg.CancelEvent); - - WaitThread(t, INFINITE); - ReleaseEvent(dlg.CancelEvent); - ReleaseThread(t); -} - -// Thread for the connection error dialog -void Win32CnConnectErrorDlgThreadProc(THREAD *thread, void *param) -{ - UI_CONNECTERROR_DLG *dlg; - // Validate arguments - if (thread == NULL || param == NULL) - { - return; - } - - dlg = (UI_CONNECTERROR_DLG *)param; - - if (ConnectErrorDlg(dlg)) - { - PACK *p = NewPack(); - - PackAddBool(p, "ok", true); - PackAddBool(p, "HideWindow", dlg->HideWindow); - - SendPack(dlg->Sock, p); - FreePack(p); - - FreePack(RecvPack(dlg->Sock)); - } - - Disconnect(dlg->Sock); -} - -// Connection Error dialog (Win32) -void Win32CnConnectErrorDlg(SOCK *s, PACK *p) -{ - UI_CONNECTERROR_DLG dlg; - THREAD *t; - Zero(&dlg, sizeof(dlg)); - // Validate arguments - if (s == NULL || p == NULL) - { - return; - } - - PackGetUniStr(p, "AccountName", dlg.AccountName, sizeof(dlg.AccountName)); - PackGetStr(p, "ServerName", dlg.ServerName, sizeof(dlg.ServerName)); - dlg.Err = PackGetInt(p, "Err"); - dlg.CurrentRetryCount = PackGetInt(p, "CurrentRetryCount"); - dlg.RetryLimit = PackGetInt(p, "RetryLimit"); - dlg.RetryIntervalSec = PackGetInt(p, "RetryIntervalSec"); - dlg.HideWindow = PackGetBool(p, "HideWindow"); - dlg.CancelEvent = NewEvent(); - dlg.Sock = s; - - t = NewThread(Win32CnConnectErrorDlgThreadProc, &dlg); - - FreePack(RecvPack(s)); - - Set(dlg.CancelEvent); - - WaitThread(t, INFINITE); - ReleaseEvent(dlg.CancelEvent); - ReleaseThread(t); -} - -// Status indicator (Win32) -void Win32CnStatusPrinter(SOCK *s, PACK *p) -{ - STATUS_WINDOW *w; - wchar_t account_name[MAX_ACCOUNT_NAME_LEN + 1]; - // Validate arguments - if (s == NULL || p == NULL) - { - return; - } - - PackGetUniStr(p, "account_name", account_name, sizeof(account_name)); - - w = StatusPrinterWindowStart(s, account_name); - - while (true) - { - PACK *p = RecvPack(s); - - if (p == NULL) - { - // Exit the dialog because it is disconnected - break; - } - else - { - wchar_t tmp[MAX_SIZE]; - - // Rewrite the string - PackGetUniStr(p, "string", tmp, sizeof(tmp)); - - StatusPrinterWindowPrint(w, tmp); - - FreePack(p); - } - } - - StatusPrinterWindowStop(w); -} - -// Start the driver installer (for Windows Vista) -void Win32CnExecDriverInstaller(SOCK *s, PACK *p) -{ - char arg[MAX_SIZE]; - bool ret; - void *helper = NULL; - // Validate arguments - if (s == NULL || p == NULL) - { - return; - } - - if (PackGetStr(p, "arg", arg, sizeof(arg)) == false) - { - return; - } - - if (MsIsVista()) - { - helper = CmStartUacHelper(); - } - - ret = MsExecDriverInstaller(arg); - - CmStopUacHelper(helper); - - p = NewPack(); - PackAddBool(p, "ret", ret); - SendPack(s, p); - - FreePack(p); -} - -#endif // OS_WIN32 - -// Start the driver installer -void CnExecDriverInstaller(SOCK *s, PACK *p) -{ - // Validate arguments - if (s == NULL || p == NULL) - { - return; - } - -#ifdef OS_WIN32 - Win32CnExecDriverInstaller(s, p); -#endif // OS_WIN32 -} - -// Certificate confirmation dialog -void CnCheckCert(SOCK *s, PACK *p) -{ - // Validate arguments - if (s == NULL || p == NULL) - { - return; - } - -#ifdef OS_WIN32 - Win32CnCheckCert(s, p); -#endif // OS_WIN32 -} - -// NIC information dialog -void CnNicInfo(SOCK *s, PACK *p) -{ - // Validate arguments - if (s == NULL || p == NULL) - { - return; - } - -#ifdef OS_WIN32 - Win32CnNicInfo(s, p); -#endif // OS_WIN32 -} - -// Message display dialog -void CnMsgDlg(SOCK *s, PACK *p) -{ - // Validate arguments - if (s == NULL || p == NULL) - { - return; - } - -#ifdef OS_WIN32 - Win32CnMsgDlg(s, p); -#endif // OS_WIN32 -} - -// Password input dialog -void CnPasswordDlg(SOCK *s, PACK *p) -{ - // Validate arguments - if (s == NULL || p == NULL) - { - return; - } - -#ifdef OS_WIN32 - Win32CnPasswordDlg(s, p); -#endif // OS_WIN32 -} - -// Connection Error dialog -void CnConnectErrorDlg(SOCK *s, PACK *p) -{ - // Validate arguments - if (s == NULL || p == NULL) - { - return; - } - -#ifdef OS_WIN32 - Win32CnConnectErrorDlg(s, p); -#endif // OS_WIN32 -} - -// Status indicator -void CnStatusPrinter(SOCK *s, PACK *p) -{ - // Validate arguments - if (s == NULL || p == NULL) - { - return; - } - -#ifdef OS_WIN32 - Win32CnStatusPrinter(s, p); -#endif // OS_WIN32 -} -// Client notification service listener thread -void CnListenerProc(THREAD *thread, void *param) -{ - TCP_ACCEPTED_PARAM *data = (TCP_ACCEPTED_PARAM *)param; - SOCK *s; - PACK *p; - // Validate arguments - if (data == NULL || thread == NULL) - { - return; - } - -#ifdef OS_WIN32 - //Set Application ID - JL_SetCurrentProcessExplicitAppUserModelID(APPID_CM); -#endif // OS_WIN32 - - s = data->s; - AddRef(s->ref); - NoticeThreadInit(thread); - - if (s->LocalIP.addr[0] == 127) - { - p = RecvPack(s); - - if (p != NULL) - { - char function[MAX_SIZE]; - - if (PackGetStr(p, "function", function, sizeof(function))) - { - if (StrCmpi(function, "status_printer") == 0) - { - CnStatusPrinter(s, p); - } - else if (StrCmpi(function, "connecterror_dialog") == 0) - { - CnConnectErrorDlg(s, p); - } - else if (StrCmpi(function, "msg_dialog") == 0) - { - CnMsgDlg(s, p); - } - else if (StrCmpi(function, "nicinfo") == 0) - { - CnNicInfo(s, p); - } - else if (StrCmpi(function, "password_dialog") == 0) - { - CnPasswordDlg(s, p); - } - else if (StrCmpi(function, "secure_sign") == 0) - { - CnSecureSign(s, p); - } - else if (StrCmpi(function, "check_cert") == 0) - { - CnCheckCert(s, p); - } - else if (StrCmpi(function, "exit") == 0) - { -#ifdef OS_WIN32 - MsTerminateProcess(); -#else // OS_WIN32 - _exit(0); -#endif // OS_WIN32 - } - else if (StrCmpi(function, "get_session_id") == 0) - { - PACK *p = NewPack(); -#ifdef OS_WIN32 - PackAddInt(p, "session_id", MsGetCurrentTerminalSessionId()); -#endif // OS_WIN32 - SendPack(s, p); - FreePack(p); - } - else if (StrCmpi(function, "exec_driver_installer") == 0) - { - CnExecDriverInstaller(s, p); - } - else if (StrCmpi(function, "release_socket") == 0) - { - // Stop the listener - CnReleaseSocket(s, p); - } - } - - FreePack(p); - } - } - - Disconnect(s); - ReleaseSock(s); -} - -// Do the Secure Sign -void CnSecureSign(SOCK *s, PACK *p) -{ - SECURE_SIGN sign; - bool ret = false; - // Validate arguments - if (s == NULL || p == NULL) - { - return; - } - - Zero(&sign, sizeof(sign)); - InRpcSecureSign(&sign, p); - -#ifdef OS_WIN32 - // Win32: Show dialog - ret = Win32CiSecureSign(&sign); -#else // OS_WIN32 - // UNIX: not implemented - ret = false; -#endif // OS_WIN32 - - p = NewPack(); - - OutRpcSecureSign(p, &sign); - FreeRpcSecureSign(&sign); - - PackAddBool(p, "ret", ret); - - SendPack(s, p); - FreePack(p); -} - -// Stop the listener -void CnReleaseSocket(SOCK *s, PACK *p) -{ - UINT pid = 0; - UINT current_pid = 0; - // Validate arguments - if (s == NULL || p == NULL) - { - return; - } - - pid = PackGetInt(p, "pid"); - -#ifdef OS_WIN32 - current_pid = MsGetProcessId(); -#endif // OS_WIN32 - - if (current_pid == pid) - { - return; - } - - Lock(cn_listener_lock); - { - if (cn_listener != NULL) - { - if (cn_listener->Halt == false) - { - StopListener(cn_listener); - - cn_next_allow = Tick64() + (6 * 1000); - } - } - } - Unlock(cn_listener_lock); -} - -// Start the client notification service -void CnStart() -{ - CEDAR *cedar; - LISTENER *o; - UINT last_cursor_hash = 0; - bool last_session_active = false; - - cn_next_allow = 0; - cn_listener_lock = NewLock(); - -#ifdef OS_WIN32 - MsSetShutdownParameters(0xff, 0x00000001); - InitWinUi(_UU("CN_TITLE"), _SS("DEFAULT_FONT"), _II("DEFAULT_FONT_SIZE")); -#endif // OS_WIN32 - - cedar = NewCedar(NULL, NULL); - - if (CnCheckAlreadyExists(true)) - { - // Already started - ReleaseCedar(cedar); -#ifdef OS_WIN32 - FreeWinUi(); -#endif // OS_WIN32 - return; - } - -#ifdef OS_WIN32 - MsRegWriteInt(REG_CURRENT_USER, CM_REG_KEY, - "NotifyServerProcessId", MsGetProcessId()); -#endif // OS_WIN32 - - DisableDosProtect(); - -BEGIN_LISTENER: - Lock(cn_listener_lock); - cn_listener = o = NewListenerEx2(cedar, LISTENER_TCP, CLIENT_NOTIFY_PORT, CnListenerProc, NULL, true); - Unlock(cn_listener_lock); - - while (true) - { - UINT current_cursor_hash = 0; - bool cursor_changed = false; - -#ifdef OS_WIN32 - // Get the current cursor position - current_cursor_hash = MsGetCursorPosHash(); -#endif // OS_WIN32 - - if (last_cursor_hash != current_cursor_hash) - { - // Check the cursor position - cursor_changed = true; - last_cursor_hash = current_cursor_hash; - } - - Lock(cn_listener_lock); - - // Check the status periodically after that the listener has started - if (cn_listener->Status == LISTENER_STATUS_TRYING || cn_listener->Halt) - { - bool session_active = false; -#ifdef OS_WIN32 - session_active = MsIsCurrentTerminalSessionActive(); - if (cursor_changed) - { - // If the cursor position is changed but the terminal session is - // not active, the cursor position is regarded as not changed. - if (session_active == false) - { - cursor_changed = false; - } - } - if (last_session_active != session_active) - { - //If the cursor position doesn't changed but the terminal session - // became active than previous, the cursor position is regarded as changed. - last_session_active = session_active; - - if (session_active) - { - cursor_changed = true; - } - } -#endif // OS_WIN32 - - // If the port cannot be opened - if (cn_next_allow <= Tick64()) - { -#ifdef OS_WIN32 - if (cursor_changed) - { - // It can be judged to have the rights to open the port - // since the mouse cursor is moving. - // So, take over the port which is owned by other process forcibly - CncReleaseSocket(); - } -#endif // OS_WIN32 - - if (cn_listener->Halt) - { - ReleaseListener(cn_listener); - cn_listener = NULL; - - Unlock(cn_listener_lock); - goto BEGIN_LISTENER; - } - } - } - - Unlock(cn_listener_lock); - - SleepThread(1000); - } -} - -// Confirm whether the account file is parsed successfully -bool CiTryToParseAccount(BUF *b) -{ - RPC_CLIENT_CREATE_ACCOUNT *a; - // Validate arguments - if (b == NULL) - { - return false; - } - - a = CiCfgToAccount(b); - if (a != NULL) - { - CiFreeClientCreateAccount(a); - Free(a); - - return true; - } - else - { - return false; - } -} -bool CiTryToParseAccountFile(wchar_t *name) -{ - bool ret; - BUF *b; - // Validate arguments - if (name == NULL) - { - return false; - } - - b = ReadDumpW(name); - if (b == NULL) - { - return false; - } - - ret = CiTryToParseAccount(b); - - FreeBuf(b); - - return ret; -} - -// Confirm whether the account information includes sensitive information -bool CiHasAccountSensitiveInformation(BUF *b) -{ - RPC_CLIENT_CREATE_ACCOUNT *a; - bool ret = false; - // Validate arguments - if (b == NULL) - { - return false; - } - - a = CiCfgToAccount(b); - if (a == NULL) - { - return false; - } - - if (a->ClientAuth->AuthType == CLIENT_AUTHTYPE_PASSWORD) - { - ret = true; - } - else if (a->ClientAuth->AuthType == CLIENT_AUTHTYPE_PLAIN_PASSWORD) - { - ret = true; - } - - CiFreeClientCreateAccount(a); - Free(a); - - return ret; -} - -// Delete the sensitive information in the account information -bool CiEraseSensitiveInAccount(BUF *b) -{ - RPC_CLIENT_CREATE_ACCOUNT *a; - BUF *b2; - bool ret = false; - // Validate arguments - if (b == NULL) - { - return false; - } - - a = CiCfgToAccount(b); - if (a == NULL) - { - return false; - } - - if (a->ClientAuth->AuthType == CLIENT_AUTHTYPE_PASSWORD) - { - Zero(a->ClientAuth->HashedPassword, sizeof(a->ClientAuth->HashedPassword)); - ClearStr(a->ClientAuth->Username, sizeof(a->ClientAuth->Username)); - } - else if (a->ClientAuth->AuthType == CLIENT_AUTHTYPE_PLAIN_PASSWORD) - { - ClearStr(a->ClientAuth->PlainPassword, sizeof(a->ClientAuth->PlainPassword)); - ClearStr(a->ClientAuth->Username, sizeof(a->ClientAuth->Username)); - } - - b2 = CiAccountToCfg(a); - if (b2 != NULL) - { - ret = true; - - ClearBuf(b); - - WriteBuf(b, b2->Buf, b2->Size); - SeekBuf(b, 0, 0); - - FreeBuf(b2); - } - - CiFreeClientCreateAccount(a); - Free(a); - - return ret; -} - -// Read the account information from the buffer -RPC_CLIENT_CREATE_ACCOUNT *CiCfgToAccount(BUF *b) -{ - RPC_CLIENT_CREATE_ACCOUNT *t; - FOLDER *f; - ACCOUNT *a; - // Validate arguments - if (b == NULL) - { - return NULL; - } - - f = CfgBufTextToFolder(b); - if (f == NULL) - { - return NULL; - } - - a = CiLoadClientAccount(f); - - CfgDeleteFolder(f); - - if (a == NULL) - { - return NULL; - } - - DeleteLock(a->lock); - - t = ZeroMalloc(sizeof(RPC_CLIENT_CREATE_ACCOUNT)); - t->ClientOption = a->ClientOption; - t->ClientAuth = a->ClientAuth; - t->StartupAccount = a->StartupAccount; - t->CheckServerCert = a->CheckServerCert; - t->RetryOnServerCert = a->RetryOnServerCert; - t->ServerCert = a->ServerCert; - Free(a); - - return t; -} - -// Write the account information to a buffer -BUF *CiAccountToCfg(RPC_CLIENT_CREATE_ACCOUNT *t) -{ - BUF *b; - FOLDER *root; - ACCOUNT a; - // Validate arguments - if (t == NULL) - { - return NULL; - } - - root = CfgCreateFolder(NULL, TAG_ROOT); - Zero(&a, sizeof(a)); - a.ClientOption = t->ClientOption; - a.ClientAuth = t->ClientAuth; - a.CheckServerCert = t->CheckServerCert; - a.RetryOnServerCert = t->RetryOnServerCert; - a.ServerCert = t->ServerCert; - a.StartupAccount = t->StartupAccount; - - CiWriteAccountData(root, &a); - - b = CfgFolderToBufEx(root, true, true); - CfgDeleteFolder(root); - - return b; -} - -// RPC dispatch routine -PACK *CiRpcDispatch(RPC *rpc, char *name, PACK *p) -{ - PACK *ret; - CLIENT *c; - // Validate arguments - if (rpc == NULL || name == NULL || p == NULL) - { - return NULL; - } - c = rpc->Param; - - ret = NewPack(); - - if (StrCmpi(name, "GetClientVersion") == 0) - { - RPC_CLIENT_VERSION a; - if (CtGetClientVersion(c, &a) == false) - { - RpcError(ret, c->Err); - } - else - { - OutRpcClientVersion(ret, &a); - } - } - else if (StrCmpi(name, "GetCmSetting") == 0) - { - CM_SETTING a; - if (CtGetCmSetting(c, &a) == false) - { - RpcError(ret, c->Err); - } - else - { - OutRpcCmSetting(ret, &a); - } - } - else if (StrCmpi(name, "SetCmSetting") == 0) - { - CM_SETTING a; - Zero(&a, sizeof(a)); - InRpcCmSetting(&a, p); - if (CtSetCmSetting(c, &a) == false) - { - RpcError(ret, c->Err); - } - } - else if (StrCmpi(name, "SetPassword") == 0) - { - RPC_CLIENT_PASSWORD a; - InRpcClientPassword(&a, p); - if (CtSetPassword(c, &a) == false) - { - RpcError(ret, c->Err); - } - } - else if (StrCmpi(name, "GetPasswordSetting") == 0) - { - RPC_CLIENT_PASSWORD_SETTING a; - if (CtGetPasswordSetting(c, &a) == false) - { - RpcError(ret, c->Err); - } - else - { - OutRpcClientPasswordSetting(ret, &a); - } - } - else if (StrCmpi(name, "EnumCa") == 0) - { - RPC_CLIENT_ENUM_CA a; - if (CtEnumCa(c, &a) == false) - { - RpcError(ret, c->Err); - } - else - { - OutRpcClientEnumCa(ret, &a); - CiFreeClientEnumCa(&a); - } - } - else if (StrCmpi(name, "AddCa") == 0) - { - RPC_CERT a; - InRpcCert(&a, p); - if (CtAddCa(c, &a) == false) - { - RpcError(ret, c->Err); - } - FreeX(a.x); - } - else if (StrCmpi(name, "DeleteCa") == 0) - { - RPC_CLIENT_DELETE_CA a; - InRpcClientDeleteCa(&a, p); - if (CtDeleteCa(c, &a) == false) - { - RpcError(ret, c->Err); - } - } - else if (StrCmpi(name, "GetCa") == 0) - { - RPC_GET_CA a; - InRpcGetCa(&a, p); - if (CtGetCa(c, &a) == false) - { - RpcError(ret, c->Err); - } - else - { - OutRpcGetCa(ret, &a); - } - CiFreeGetCa(&a); - } - else if (StrCmpi(name, "EnumSecure") == 0) - { - RPC_CLIENT_ENUM_SECURE a; - if (CtEnumSecure(c, &a) == false) - { - RpcError(ret, c->Err); - } - else - { - OutRpcClientEnumSecure(ret, &a); - CiFreeClientEnumSecure(&a); - } - } - else if (StrCmpi(name, "UseSecure") == 0) - { - RPC_USE_SECURE a; - InRpcUseSecure(&a, p); - if (CtUseSecure(c, &a) == false) - { - RpcError(ret, c->Err); - } - } - else if (StrCmpi(name, "GetUseSecure") == 0) - { - RPC_USE_SECURE a; - Zero(&a, sizeof(a)); - if (CtGetUseSecure(c, &a) == false) - { - RpcError(ret, c->Err); - } - else - { - OutRpcUseSecure(ret, &a); - } - } - else if (StrCmpi(name, "EnumObjectInSecure") == 0) - { - RPC_ENUM_OBJECT_IN_SECURE a; - if (CtEnumObjectInSecure(c, &a) == false) - { - RpcError(ret, c->Err); - } - else - { - OutRpcEnumObjectInSecure(ret, &a); - CiFreeEnumObjectInSecure(&a); - } - } - else if (StrCmpi(name, "CreateVLan") == 0) - { - RPC_CLIENT_CREATE_VLAN a; - InRpcCreateVLan(&a, p); - if (CtCreateVLan(c, &a) == false) - { - RpcError(ret, c->Err); - } - } - else if (StrCmpi(name, "UpgradeVLan") == 0) - { - RPC_CLIENT_CREATE_VLAN a; - InRpcCreateVLan(&a, p); - if (CtUpgradeVLan(c, &a) == false) - { - RpcError(ret, c->Err); - } - } - else if (StrCmpi(name, "GetVLan") == 0) - { - RPC_CLIENT_GET_VLAN a; - InRpcClientGetVLan(&a, p); - if (CtGetVLan(c, &a) == false) - { - RpcError(ret, c->Err); - } - else - { - OutRpcClientGetVLan(ret, &a); - } - } - else if (StrCmpi(name, "SetVLan") == 0) - { - RPC_CLIENT_SET_VLAN a; - InRpcClientSetVLan(&a, p); - if (CtSetVLan(c, &a) == false) - { - RpcError(ret, c->Err); - } - } - else if (StrCmpi(name, "EnumVLan") == 0) - { - RPC_CLIENT_ENUM_VLAN a; - if (CtEnumVLan(c, &a) == false) - { - RpcError(ret, c->Err); - } - else - { - OutRpcClientEnumVLan(ret, &a); - CiFreeClientEnumVLan(&a); - } - } - else if (StrCmpi(name, "DeleteVLan") == 0) - { - RPC_CLIENT_CREATE_VLAN a; - InRpcCreateVLan(&a, p); - if (CtDeleteVLan(c, &a) == false) - { - RpcError(ret, c->Err); - } - } - else if (StrCmpi(name, "EnableVLan") == 0) - { - RPC_CLIENT_CREATE_VLAN a; - InRpcCreateVLan(&a, p); - if (CtEnableVLan(c, &a) == false) - { - RpcError(ret, c->Err); - } - } - else if (StrCmpi(name, "DisableVLan") == 0) - { - RPC_CLIENT_CREATE_VLAN a; - InRpcCreateVLan(&a, p); - if (CtDisableVLan(c, &a) == false) - { - RpcError(ret, c->Err); - } - } - else if (StrCmpi(name, "CreateAccount") == 0) - { - RPC_CLIENT_CREATE_ACCOUNT a; - InRpcClientCreateAccount(&a, p); - if (CtCreateAccount(c, &a, false) == false) - { - RpcError(ret, c->Err); - } - CiFreeClientCreateAccount(&a); - } - else if (StrCmpi(name, "EnumAccount") == 0) - { - RPC_CLIENT_ENUM_ACCOUNT a; - if (CtEnumAccount(c, &a) == false) - { - RpcError(ret, c->Err); - } - else - { - OutRpcClientEnumAccount(ret, &a); - CiFreeClientEnumAccount(&a); - } - } - else if (StrCmpi(name, "DeleteAccount") == 0) - { - RPC_CLIENT_DELETE_ACCOUNT a; - InRpcClientDeleteAccount(&a, p); - if (CtDeleteAccount(c, &a, false) == false) - { - RpcError(ret, c->Err); - } - } - else if (StrCmpi(name, "SetStartupAccount") == 0) - { - RPC_CLIENT_DELETE_ACCOUNT a; - InRpcClientDeleteAccount(&a, p); - if (CtSetStartupAccount(c, &a, false) == false) - { - RpcError(ret, c->Err); - } - } - else if (StrCmpi(name, "RemoveStartupAccount") == 0) - { - RPC_CLIENT_DELETE_ACCOUNT a; - InRpcClientDeleteAccount(&a, p); - if (CtRemoveStartupAccount(c, &a) == false) - { - RpcError(ret, c->Err); - } - } - else if (StrCmpi(name, "GetIssuer") == 0) - { - RPC_GET_ISSUER a; - InRpcGetIssuer(&a, p); - if (CtGetIssuer(c, &a)) - { - OutRpcGetIssuer(ret, &a); - } - else - { - RpcError(ret, c->Err); - } - CiFreeGetIssuer(&a); - } - else if (StrCmpi(name, "GetCommonProxySetting") == 0) - { - INTERNET_SETTING t; - InRpcInternetSetting(&t, p); - if (CtGetCommonProxySetting(c, &t)) - { - OutRpcInternetSetting(ret, &t); - } - else - { - RpcError(ret, c->Err); - } - } - else if (StrCmpi(name, "SetCommonProxySetting") == 0) - { - INTERNET_SETTING t; - InRpcInternetSetting(&t, p); - if (CtSetCommonProxySetting(c, &t)) - { - OutRpcInternetSetting(ret, &t); - } - else - { - RpcError(ret, c->Err); - } - } - else if (StrCmpi(name, "SetAccount") == 0) - { - RPC_CLIENT_CREATE_ACCOUNT a; - InRpcClientCreateAccount(&a, p); - if (CtSetAccount(c, &a, false) == false) - { - RpcError(ret, c->Err); - } - CiFreeClientCreateAccount(&a); - } - else if (StrCmpi(name, "GetAccount") == 0) - { - RPC_CLIENT_GET_ACCOUNT a; - InRpcClientGetAccount(&a, p); - if (CtGetAccount(c, &a) == false) - { - RpcError(ret, c->Err); - } - else - { - OutRpcClientGetAccount(ret, &a); - } - CiFreeClientGetAccount(&a); - } - else if (StrCmpi(name, "RenameAccount") == 0) - { - RPC_RENAME_ACCOUNT a; - InRpcRenameAccount(&a, p); - if (CtRenameAccount(c, &a, false) == false) - { - RpcError(ret, c->Err); - } - } - else if (StrCmpi(name, "SetClientConfig") == 0) - { - CLIENT_CONFIG a; - InRpcClientConfig(&a, p); - if (CtSetClientConfig(c, &a) == false) - { - RpcError(ret, c->Err); - } - } - else if (StrCmpi(name, "GetClientConfig") == 0) - { - CLIENT_CONFIG a; - if (CtGetClientConfig(c, &a) == false) - { - RpcError(ret, c->Err); - } - else - { - OutRpcClientConfig(ret, &a); - } - } - else if (StrCmpi(name, "Connect") == 0) - { - RPC_CLIENT_CONNECT a; - InRpcClientConnect(&a, p); - if (CtConnect(c, &a) == false) - { - RpcError(ret, c->Err); - } - } - else if (StrCmpi(name, "Disconnect") == 0) - { - RPC_CLIENT_CONNECT a; - InRpcClientConnect(&a, p); - if (CtDisconnect(c, &a, false) == false) - { - RpcError(ret, c->Err); - } - } - else if (StrCmpi(name, "GetAccountStatus") == 0) - { - RPC_CLIENT_GET_CONNECTION_STATUS a; - InRpcClientGetConnectionStatus(&a, p); - if (CtGetAccountStatus(c, &a) == false) - { - RpcError(ret, c->Err); - } - else - { - OutRpcClientGetConnectionStatus(ret, &a); - } - CiFreeClientGetConnectionStatus(&a); - } - else - { - FreePack(ret); - ret = NULL; - } - - return ret; -} - -// Set the CM_SETTING -UINT CcSetCmSetting(REMOTE_CLIENT *r, CM_SETTING *a) -{ - PACK *ret, *p; - UINT err; - // Validate arguments - if (r == NULL || a == NULL) - { - return ERR_INTERNAL_ERROR; - } - - p = NewPack(); - OutRpcCmSetting(p, a); - - ret = RpcCall(r->Rpc, "SetCmSetting", p); - - if (RpcIsOk(ret)) - { - FreePack(ret); - return 0; - } - else - { - err = RpcGetError(ret); - FreePack(ret); - return err; - } -} - -// Get the CM_SETTING -UINT CcGetCmSetting(REMOTE_CLIENT *r, CM_SETTING *a) -{ - PACK *ret; - // Validate arguments - if (r == NULL || a == NULL) - { - return ERR_INTERNAL_ERROR; - } - - ret = RpcCall(r->Rpc, "GetCmSetting", NULL); - - if (RpcIsOk(ret)) - { - InRpcCmSetting(a, ret); - FreePack(ret); - return 0; - } - else - { - UINT err = RpcGetError(ret); - FreePack(ret); - return err; - } -} - -// Get the client version -UINT CcGetClientVersion(REMOTE_CLIENT *r, RPC_CLIENT_VERSION *a) -{ - PACK *ret; - // Validate arguments - if (r == NULL || a == NULL) - { - return ERR_INTERNAL_ERROR; - } - - ret = RpcCall(r->Rpc, "GetClientVersion", NULL); - - if (RpcIsOk(ret)) - { - InRpcClientVersion(a, ret); - FreePack(ret); - return 0; - } - else - { - UINT err = RpcGetError(ret); - FreePack(ret); - return err; - } -} - -// Set the password -UINT CcSetPassword(REMOTE_CLIENT *r, RPC_CLIENT_PASSWORD *pass) -{ - PACK *ret, *p; - // Validate arguments - if (r == NULL || pass == NULL) - { - return ERR_INTERNAL_ERROR; - } - - p = NewPack(); - - OutRpcClientPassword(p, pass); - - ret = RpcCall(r->Rpc, "SetPassword", p); - - if (RpcIsOk(ret)) - { - FreePack(ret); - return 0; - } - else - { - UINT err = RpcGetError(ret); - FreePack(ret); - return err; - } -} - -// Get the password setting -UINT CcGetPasswordSetting(REMOTE_CLIENT *r, RPC_CLIENT_PASSWORD_SETTING *a) -{ - PACK *ret; - UINT err = 0; - // Validate arguments - if (r == NULL || a == NULL) - { - return ERR_INTERNAL_ERROR; - } - - ret = RpcCall(r->Rpc, "GetPasswordSetting", NULL); - - if (RpcIsOk(ret)) - { - InRpcClientPasswordSetting(a, ret); - } - else - { - err = RpcGetError(ret); - } - - FreePack(ret); - return err; -} - -// Enumerate the CA -UINT CcEnumCa(REMOTE_CLIENT *r, RPC_CLIENT_ENUM_CA *e) -{ - PACK *ret; - UINT err = 0; - // Validate arguments - if (r == NULL || e == NULL) - { - return ERR_INTERNAL_ERROR; - } - - ret = RpcCall(r->Rpc, "EnumCa", NULL); - - if (RpcIsOk(ret)) - { - InRpcClientEnumCa(e, ret); - } - else - { - err = RpcGetError(ret); - } - - FreePack(ret); - - return err; -} - -// Add the CA -UINT CcAddCa(REMOTE_CLIENT *r, RPC_CERT *cert) -{ - PACK *p, *ret; - UINT err = 0; - // Validate arguments - if (r == NULL || cert == NULL) - { - return ERR_INTERNAL_ERROR; - } - - p = NewPack(); - OutRpcCert(p, cert); - - ret = RpcCall(r->Rpc, "AddCa", p); - - if (RpcIsOk(ret) == false) - { - err = RpcGetError(ret); - } - - FreePack(ret); - - return err; -} - -// Delete the CA -UINT CcDeleteCa(REMOTE_CLIENT *r, RPC_CLIENT_DELETE_CA *c) -{ - PACK *p, *ret; - UINT err = 0; - // Validate arguments - if (r == NULL || c == NULL) - { - return ERR_INTERNAL_ERROR; - } - - p = NewPack(); - OutRpcClientDeleteCa(p, c); - - ret = RpcCall(r->Rpc, "DeleteCa", p); - - if (RpcIsOk(ret) == false) - { - err = RpcGetError(ret); - } - - FreePack(ret); - - return err; -} - -// Get the issuer -UINT CcGetIssuer(REMOTE_CLIENT *r, RPC_GET_ISSUER *a) -{ - PACK *p, *ret; - UINT err = 0; - // Validate arguments - if (r == NULL || a == NULL) - { - return ERR_INTERNAL_ERROR; - } - - p = NewPack(); - OutRpcGetIssuer(p, a); - - ret = RpcCall(r->Rpc, "GetIssuer", p); - - if (RpcIsOk(ret)) - { - if (a->x != NULL) - { - FreeX(a->x); - a->x = NULL; - } - InRpcGetIssuer(a, ret); - } - else - { - err = RpcGetError(ret); - } - - FreePack(ret); - - return err; -} - -// Get the CA -UINT CcGetCa(REMOTE_CLIENT *r, RPC_GET_CA *get) -{ - PACK *p, *ret; - UINT err = 0; - // Validate arguments - if (r == NULL || get == NULL) - { - return ERR_INTERNAL_ERROR; - } - - p = NewPack(); - OutRpcGetCa(p, get); - - ret = RpcCall(r->Rpc, "GetCa", p); - - if (RpcIsOk(ret)) - { - InRpcGetCa(get, ret); - } - else - { - err = RpcGetError(ret); - } - - FreePack(ret); - - return err; -} - -// Enumeration of the secure devices -UINT CcEnumSecure(REMOTE_CLIENT *r, RPC_CLIENT_ENUM_SECURE *e) -{ - PACK *ret; - UINT err = 0; - // Validate arguments - if (r == NULL || e == NULL) - { - return ERR_INTERNAL_ERROR; - } - - ret = RpcCall(r->Rpc, "EnumSecure", NULL); - - if (RpcIsOk(ret)) - { - InRpcClientEnumSecure(e, ret); - } - else - { - err = RpcGetError(ret); - } - - FreePack(ret); - - return err; -} - -// Get the secure device that the user is using -UINT CcGetUseSecure(REMOTE_CLIENT *r, RPC_USE_SECURE *sec) -{ - PACK *p, *ret; - UINT err = 0; - // Validate arguments - if (r == NULL || sec == NULL) - { - return ERR_INTERNAL_ERROR; - } - - p = NewPack(); - - ret = RpcCall(r->Rpc, "GetUseSecure", p); - - if (RpcIsOk(ret) == false) - { - err = RpcGetError(ret); - } - else - { - InRpcUseSecure(sec, ret); - } - - FreePack(ret); - - return err; -} - -// Use the secure device -UINT CcUseSecure(REMOTE_CLIENT *r, RPC_USE_SECURE *sec) -{ - PACK *p, *ret; - UINT err = 0; - // Validate arguments - if (r == NULL || sec == NULL) - { - return ERR_INTERNAL_ERROR; - } - - p = NewPack(); - OutRpcUseSecure(p, sec); - - ret = RpcCall(r->Rpc, "UseSecure", p); - - if (RpcIsOk(ret) == false) - { - err = RpcGetError(ret); - } - - FreePack(ret); - - return err; -} - -// Get a next recommended virtual LAN card name -bool CiGetNextRecommendedVLanName(REMOTE_CLIENT *r, char *name, UINT size) -{ - RPC_CLIENT_ENUM_VLAN t; - UINT i; - bool b; - UINT j; - bool ok = false; - // Validate arguments - if (r == NULL || name == NULL) - { - return false; - } - - Zero(&t, sizeof(t)); - - if (CcEnumVLan(r, &t) != ERR_NO_ERROR) - { - return false; - } - - for (i = 1;i < 128;i++) - { - char tmp[MAX_SIZE]; - - CiGenerateVLanRegulatedName(tmp, sizeof(tmp), i); - - b = false; - - for (j = 0;j < t.NumItem;j++) - { - if (StrCmpi(t.Items[j]->DeviceName, tmp) == 0) - { - b = true; - break; - } - } - - if (b == false) - { - ok = true; - - StrCpy(name, size, tmp); - break; - } - } - - if (ok) - { - CiFreeClientEnumVLan(&t); - } - - return true; -} - -// Generate a virtual LAN card name automatically -void CiGenerateVLanRegulatedName(char *name, UINT size, UINT i) -{ - // Validate arguments - if (name == NULL) - { - return; - } - - if (i == 1) - { - StrCpy(name, size, "VPN"); - } - else - { - Format(name, size, "VPN%u", i); - } -} - -// Examine whether the specified name is valid as a virtual LAN card name of Windows 8 and later? -bool CiIsValidVLanRegulatedName(char *name) -{ - UINT i; - // Validate arguments - if (name == NULL) - { - return false; - } - - for (i = 1;i < 128;i++) - { - char tmp[MAX_SIZE]; - - CiGenerateVLanRegulatedName(tmp, sizeof(tmp), i); - - if (StrCmpi(name, tmp) == 0) - { - return true; - } - } - - return false; -} - -// Create a VLAN -UINT CcCreateVLan(REMOTE_CLIENT *r, RPC_CLIENT_CREATE_VLAN *create) -{ - PACK *ret, *p; - UINT err = 0; - char *s = NULL; - // Validate arguments - if (r == NULL || create == NULL) - { - return ERR_INTERNAL_ERROR; - } - - p = NewPack(); - OutRpcCreateVLan(p, create); - -#ifdef OS_WIN32 - s = MsNoWarningSoundInit(); -#endif // OS_WIN32 - - ret = RpcCall(r->Rpc, "CreateVLan", p); - -#ifdef OS_WIN32 - MsNoWarningSoundFree(s); -#endif // OS_WIN32 - - if (RpcIsOk(ret) == false) - { - err = RpcGetError(ret); - } - - FreePack(ret); - - return err; -} - -// Upgrade the VLAN -UINT CcUpgradeVLan(REMOTE_CLIENT *r, RPC_CLIENT_CREATE_VLAN *create) -{ - PACK *ret, *p; - UINT err = 0; - char *s = NULL; - // Validate arguments - if (r == NULL || create == NULL) - { - return ERR_INTERNAL_ERROR; - } - - p = NewPack(); - OutRpcCreateVLan(p, create); - -#ifdef OS_WIN32 - s = MsNoWarningSoundInit(); -#endif // OS_WIN32 - - ret = RpcCall(r->Rpc, "UpgradeVLan", p); - -#ifdef OS_WIN32 - MsNoWarningSoundFree(s); -#endif // OS_WIN32 - - - if (RpcIsOk(ret) == false) - { - err = RpcGetError(ret); - } - - FreePack(ret); - - return err; -} - -// Get the VLAN -UINT CcGetVLan(REMOTE_CLIENT *r, RPC_CLIENT_GET_VLAN *get) -{ - PACK *ret, *p; - UINT err = 0; - // Validate arguments - if (r == NULL || get == NULL) - { - return ERR_INTERNAL_ERROR; - } - - p = NewPack(); - OutRpcClientGetVLan(p, get); - - ret = RpcCall(r->Rpc, "GetVLan", p); - - if (RpcIsOk(ret)) - { - InRpcClientGetVLan(get, ret); - } - else - { - err = RpcGetError(ret); - } - - FreePack(ret); - - return err; -} - -// VLAN configuration -UINT CcSetVLan(REMOTE_CLIENT *r, RPC_CLIENT_SET_VLAN *set) -{ - PACK *ret, *p; - UINT err = 0; - // Validate arguments - if (r == NULL || set == NULL) - { - return ERR_INTERNAL_ERROR; - } - - p = NewPack(); - OutRpcClientSetVLan(p, set); - - ret = RpcCall(r->Rpc, "SetVLan", p); - - if (RpcIsOk(ret) == false) - { - err = RpcGetError(ret); - } - - FreePack(ret); - - return err; -} - -// Enumeration of VLAN -UINT CcEnumVLan(REMOTE_CLIENT *r, RPC_CLIENT_ENUM_VLAN *e) -{ - PACK *ret; - UINT err = 0; - // Validate arguments - if (r == NULL || e == NULL) - { - return ERR_INTERNAL_ERROR; - } - - ret = RpcCall(r->Rpc, "EnumVLan", NULL); - - if (RpcIsOk(ret)) - { - InRpcClientEnumVLan(e, ret); - } - else - { - err = RpcGetError(ret); - } - - FreePack(ret); - - return err; -} - -// Delete the VLAN -UINT CcDeleteVLan(REMOTE_CLIENT *r, RPC_CLIENT_CREATE_VLAN *d) -{ - PACK *ret, *p; - UINT err = 0; - // Validate arguments - if (r == NULL || d == NULL) - { - return ERR_INTERNAL_ERROR; - } - - p = NewPack(); - OutRpcCreateVLan(p, d); - - ret = RpcCall(r->Rpc, "DeleteVLan", p); - - if (RpcIsOk(ret) == false) - { - err = RpcGetError(ret); - } - - FreePack(ret); - - return err; -} - -// Enable the VLAN -UINT CcEnableVLan(REMOTE_CLIENT *r, RPC_CLIENT_CREATE_VLAN *vlan) -{ - PACK *ret, *p; - UINT err = 0; - // Validate arguments - if (r == NULL || vlan == NULL) - { - return ERR_INTERNAL_ERROR; - } - - p = NewPack(); - OutRpcCreateVLan(p, vlan); - - ret = RpcCall(r->Rpc, "EnableVLan", p); - - if (RpcIsOk(ret) == false) - { - err = RpcGetError(ret); - } - - FreePack(ret); - - return err; -} - -// Disable the VLAN -UINT CcDisableVLan(REMOTE_CLIENT *r, RPC_CLIENT_CREATE_VLAN *vlan) -{ - PACK *ret, *p; - UINT err = 0; - // Validate arguments - if (r == NULL || vlan == NULL) - { - return ERR_INTERNAL_ERROR; - } - - p = NewPack(); - OutRpcCreateVLan(p, vlan); - - ret = RpcCall(r->Rpc, "DisableVLan", p); - - if (RpcIsOk(ret) == false) - { - err = RpcGetError(ret); - } - - FreePack(ret); - - return err; -} - -// Create an Account -UINT CcCreateAccount(REMOTE_CLIENT *r, RPC_CLIENT_CREATE_ACCOUNT *a) -{ - PACK *ret, *p; - UINT err = 0; - // Validate arguments - if (r == NULL || a == NULL) - { - return ERR_INTERNAL_ERROR; - } - - p = NewPack(); - OutRpcClientCreateAccount(p, a); - - ret = RpcCall(r->Rpc, "CreateAccount", p); - - if (RpcIsOk(ret) == false) - { - err = RpcGetError(ret); - } - - FreePack(ret); - - return err; -} - -// Enumeration of accounts -UINT CcEnumAccount(REMOTE_CLIENT *r, RPC_CLIENT_ENUM_ACCOUNT *e) -{ - PACK *ret; - UINT err = 0; - // Validate arguments - if (r == NULL || e == NULL) - { - return ERR_INTERNAL_ERROR; - } - - ret = RpcCall(r->Rpc, "EnumAccount", NULL); - - if (RpcIsOk(ret)) - { - UINT i; - InRpcClientEnumAccount(e, ret); - - for (i = 0;i < e->NumItem;i++) - { - RPC_CLIENT_ENUM_ACCOUNT_ITEM *t = e->Items[i]; - - if (IsEmptyStr(t->HubName) && t->Port == 0) - { - UINT err2; - RPC_CLIENT_GET_ACCOUNT a; - - // Because the Client Manager can not get the port number and HUB name - // when enumerating in the VPN Client of the old version, get these separately. - Zero(&a, sizeof(a)); - UniStrCpy(a.AccountName, sizeof(a.AccountName), t->AccountName); - err2 = CcGetAccount(r, &a); - if (err2 == ERR_NO_ERROR) - { - StrCpy(t->HubName, sizeof(t->HubName), a.ClientOption->HubName); - t->Port = a.ClientOption->Port; - - CiFreeClientGetAccount(&a); - } - } - } - } - else - { - err = RpcGetError(ret); - } - - FreePack(ret); - - return err; -} - -// Unset the startup flag of the account -UINT CcRemoveStartupAccount(REMOTE_CLIENT *r, RPC_CLIENT_DELETE_ACCOUNT *a) -{ - PACK *ret, *p; - UINT err = 0; - // Validate arguments - if (r == NULL || a == NULL) - { - return ERR_INTERNAL_ERROR; - } - - p = NewPack(); - OutRpcClientDeleteAccount(p, a); - - ret = RpcCall(r->Rpc, "RemoveStartupAccount", p); - - if (RpcIsOk(ret) == false) - { - err = RpcGetError(ret); - } - - FreePack(ret); - - return err; -} - -// Set to start-up flag of the account -UINT CcSetStartupAccount(REMOTE_CLIENT *r, RPC_CLIENT_DELETE_ACCOUNT *a) -{ - PACK *ret, *p; - UINT err = 0; - // Validate arguments - if (r == NULL || a == NULL) - { - return ERR_INTERNAL_ERROR; - } - - p = NewPack(); - OutRpcClientDeleteAccount(p, a); - - ret = RpcCall(r->Rpc, "SetStartupAccount", p); - - if (RpcIsOk(ret) == false) - { - err = RpcGetError(ret); - } - - FreePack(ret); - - return err; -} - -// Delete the account -UINT CcDeleteAccount(REMOTE_CLIENT *r, RPC_CLIENT_DELETE_ACCOUNT *a) -{ - PACK *ret, *p; - UINT err = 0; - // Validate arguments - if (r == NULL || a == NULL) - { - return ERR_INTERNAL_ERROR; - } - - p = NewPack(); - OutRpcClientDeleteAccount(p, a); - - ret = RpcCall(r->Rpc, "DeleteAccount", p); - - if (RpcIsOk(ret) == false) - { - err = RpcGetError(ret); - } - - FreePack(ret); - - return err; -} - -// Account setting -UINT CcSetAccount(REMOTE_CLIENT *r, RPC_CLIENT_CREATE_ACCOUNT *a) -{ - PACK *ret, *p; - UINT err = 0; - // Validate arguments - if (r == NULL || a == NULL) - { - return ERR_INTERNAL_ERROR; - } - - p = NewPack(); - OutRpcClientCreateAccount(p, a); - - ret = RpcCall(r->Rpc, "SetAccount", p); - - if (RpcIsOk(ret) == false) - { - err = RpcGetError(ret); - } - - FreePack(ret); - - return err; -} - -// Get the account -UINT CcGetAccount(REMOTE_CLIENT *r, RPC_CLIENT_GET_ACCOUNT *a) -{ - PACK *ret, *p; - UINT err = 0; - // Validate arguments - if (r == NULL || a == NULL) - { - return ERR_INTERNAL_ERROR; - } - - p = NewPack(); - OutRpcClientGetAccount(p, a); - - ret = RpcCall(r->Rpc, "GetAccount", p); - - if (RpcIsOk(ret)) - { - InRpcClientGetAccount(a, ret); - } - else - { - err = RpcGetError(ret); - } - - FreePack(ret); - - return err; -} - -// Change the account name -UINT CcRenameAccount(REMOTE_CLIENT *r, RPC_RENAME_ACCOUNT *rename) -{ - PACK *p, *ret; - UINT err = 0; - // Validate arguments - if (r == NULL || rename == NULL) - { - return ERR_INTERNAL_ERROR; - } - - p = NewPack(); - OutRpcRenameAccount(p, rename); - - ret = RpcCall(r->Rpc, "RenameAccount", p); - - if (RpcIsOk(ret) == false) - { - err = RpcGetError(ret); - } - - FreePack(ret); - - return err; -} - -// Set the Client configuration -UINT CcSetClientConfig(REMOTE_CLIENT *r, CLIENT_CONFIG *o) -{ - PACK *p, *ret; - UINT err = 0; - // Validate arguments - if (r == NULL || o == NULL) - { - return ERR_INTERNAL_ERROR; - } - - p = NewPack(); - OutRpcClientConfig(p, o); - - ret = RpcCall(r->Rpc, "SetClientConfig", p); - - if (RpcIsOk(ret) == false) - { - err = RpcGetError(ret); - } - - FreePack(ret); - - return err; -} - -// Get the client configuration -UINT CcGetClientConfig(REMOTE_CLIENT *r, CLIENT_CONFIG *o) -{ - PACK *ret; - UINT err = 0; - // Validate arguments - if (r == NULL || o == NULL) - { - return ERR_INTERNAL_ERROR; - } - - ret = RpcCall(r->Rpc, "GetClientConfig", NULL); - - if (RpcIsOk(ret)) - { - InRpcClientConfig(o, ret); - } - else - { - err = RpcGetError(ret); - } - - FreePack(ret); - - return err; -} - -// Set the service to foreground process -void CcSetServiceToForegroundProcess(REMOTE_CLIENT *r) -{ - // Validate arguments - if (r == NULL) - { - return; - } - // Abolition -/* - if (r->Rpc != NULL && r->Rpc->Sock != NULL && r->Rpc->Sock->RemoteIP.addr[0] == 127) - { - if (OS_IS_WINDOWS_NT(GetOsInfo()->OsType) && - GET_KETA(GetOsInfo()->OsType, 100) >= 2) - { - // Only on a Windows 2000 or later - RPC_CLIENT_VERSION v; - Zero(&v, sizeof(v)); - - if (r->ClientBuildInt == 0) - { - CcGetClientVersion(r, &v); - r->ClientBuildInt = v.ClientBuildInt; - r->ProcessId = v.ProcessId; - } - if (r->ProcessId != 0 && r->ClientBuildInt <= 5080) - { -#ifdef OS_WIN32 - // Set the service process as a foreground window - AllowFGWindow(v.ProcessId); -#endif // OS_WIN32 - } - } - }*/ -} - -// Connect -UINT CcConnect(REMOTE_CLIENT *r, RPC_CLIENT_CONNECT *connect) -{ - PACK *ret, *p; - UINT err = 0; - // Validate arguments - if (r == NULL || connect == NULL) - { - return ERR_INTERNAL_ERROR; - } - - CcSetServiceToForegroundProcess(r); - - p = NewPack(); - OutRpcClientConnect(p, connect); - - ret = RpcCall(r->Rpc, "Connect", p); - - if (RpcIsOk(ret) == false) - { - err = RpcGetError(ret); - } - - FreePack(ret); - - return err; -} - -// Disconnect -UINT CcDisconnect(REMOTE_CLIENT *r, RPC_CLIENT_CONNECT *connect) -{ - PACK *ret, *p; - UINT err = 0; - // Validate arguments - if (r == NULL || connect == NULL) - { - return ERR_INTERNAL_ERROR; - } - - CcSetServiceToForegroundProcess(r); - - p = NewPack(); - OutRpcClientConnect(p, connect); - - ret = RpcCall(r->Rpc, "Disconnect", p); - - if (RpcIsOk(ret) == false) - { - err = RpcGetError(ret); - } - - FreePack(ret); - - return err; -} - -// Get the account status -UINT CcGetAccountStatus(REMOTE_CLIENT *r, RPC_CLIENT_GET_CONNECTION_STATUS *st) -{ - PACK *ret, *p; - UINT err = 0; - // Validate arguments - if (r == NULL || st == NULL) - { - return ERR_INTERNAL_ERROR; - } - - p = NewPack(); - OutRpcClientGetConnectionStatus(p, st); - - ret = RpcCall(r->Rpc, "GetAccountStatus", p); - - if (RpcIsOk(ret)) - { - InRpcClientGetConnectionStatus(st, ret); - } - else - { - err = RpcGetError(ret); - } - - FreePack(ret); - - return err; -} - - -// Client service sends a notification to the connection manager -void CiNotify(CLIENT *c) -{ - CiNotifyInternal(c); -} -void CiNotifyInternal(CLIENT *c) -{ - // Validate arguments - if (c == NULL) - { - return; - } - - // Set all the notification event - LockList(c->NotifyCancelList); - { - UINT i; - for (i = 0;i < LIST_NUM(c->NotifyCancelList);i++) - { - CANCEL *cancel = LIST_DATA(c->NotifyCancelList, i); - Cancel(cancel); - } - } - UnlockList(c->NotifyCancelList); -} - -// Release the RPC_CLIENT_ENUM_ACCOUNT -void CiFreeClientEnumAccount(RPC_CLIENT_ENUM_ACCOUNT *a) -{ - UINT i; - // Validate arguments - if (a == NULL) - { - return; - } - - for (i = 0;i < a->NumItem;i++) - { - RPC_CLIENT_ENUM_ACCOUNT_ITEM *e = a->Items[i]; - Free(e); - } - Free(a->Items); -} - - -// Thread to save the configuration file periodically -void CiSaverThread(THREAD *t, void *param) -{ - CLIENT *c = (CLIENT *)param; - // Validate arguments - if (t == NULL || param == NULL) - { - return; - } - - NoticeThreadInit(t); - - // Wait for a certain period of time - while (c->Halt == false) - { - Wait(c->SaverHalter, CLIENT_SAVER_INTERVAL); - - // Save - CiSaveConfigurationFile(c); - } -} - -// Initialize the Saver -void CiInitSaver(CLIENT *c) -{ - // Validate arguments - if (c == NULL) - { - return; - } - - c->SaverHalter = NewEvent(); - - c->SaverThread = NewThread(CiSaverThread, c); - WaitThreadInit(c->SaverThread); -} - -// Release the Saver -void CiFreeSaver(CLIENT *c) -{ - // Validate arguments - if (c == NULL) - { - return; - } - - c->Halt = true; - Set(c->SaverHalter); - WaitThread(c->SaverThread, INFINITE); - ReleaseThread(c->SaverThread); - - ReleaseEvent(c->SaverHalter); -} - -// CM_SETTING -void InRpcCmSetting(CM_SETTING *c, PACK *p) -{ - // Validate arguments - if (c == NULL || p == NULL) - { - return; - } - - Zero(c, sizeof(CM_SETTING)); - c->EasyMode = PackGetBool(p, "EasyMode"); - c->LockMode = PackGetBool(p, "LockMode"); - PackGetData2(p, "HashedPassword", c->HashedPassword, sizeof(c->HashedPassword)); -} -void OutRpcCmSetting(PACK *p, CM_SETTING *c) -{ - // Validate arguments - if (c == NULL || p == NULL) - { - return; - } - - PackAddBool(p, "EasyMode", c->EasyMode); - PackAddBool(p, "LockMode", c->LockMode); - PackAddData(p, "HashedPassword", c->HashedPassword, sizeof(c->HashedPassword)); -} - -// CLIENT_CONFIG -void InRpcClientConfig(CLIENT_CONFIG *c, PACK *p) -{ - // Validate arguments - if (c == NULL || p == NULL) - { - return; - } - - Zero(c, sizeof(CLIENT_CONFIG)); - c->UseKeepConnect = PackGetInt(p, "UseKeepConnect") == 0 ? false : true; - c->KeepConnectPort = PackGetInt(p, "KeepConnectPort"); - c->KeepConnectProtocol = PackGetInt(p, "KeepConnectProtocol"); - c->KeepConnectInterval = PackGetInt(p, "KeepConnectInterval"); - c->AllowRemoteConfig = PackGetInt(p, "AllowRemoteConfig") == 0 ? false : true; - PackGetStr(p, "KeepConnectHost", c->KeepConnectHost, sizeof(c->KeepConnectHost)); -} -void OutRpcClientConfig(PACK *p, CLIENT_CONFIG *c) -{ - // Validate arguments - if (c == NULL || p == NULL) - { - return; - } - - PackAddInt(p, "UseKeepConnect", c->UseKeepConnect); - PackAddInt(p, "KeepConnectPort", c->KeepConnectPort); - PackAddInt(p, "KeepConnectProtocol", c->KeepConnectProtocol); - PackAddInt(p, "KeepConnectInterval", c->KeepConnectInterval); - PackAddInt(p, "AllowRemoteConfig", c->AllowRemoteConfig); - PackAddStr(p, "KeepConnectHost", c->KeepConnectHost); -} - -// RPC_CLIENT_VERSION -void InRpcClientVersion(RPC_CLIENT_VERSION *ver, PACK *p) -{ - // Validate arguments - if (ver == NULL || p == NULL) - { - return; - } - - Zero(ver, sizeof(RPC_CLIENT_VERSION)); - PackGetStr(p, "ClientProductName", ver->ClientProductName, sizeof(ver->ClientProductName)); - PackGetStr(p, "ClientVersionString", ver->ClientVersionString, sizeof(ver->ClientVersionString)); - PackGetStr(p, "ClientBuildInfoString", ver->ClientBuildInfoString, sizeof(ver->ClientBuildInfoString)); - ver->ClientVerInt = PackGetInt(p, "ClientVerInt"); - ver->ClientBuildInt = PackGetInt(p, "ClientBuildInt"); - ver->ProcessId = PackGetInt(p, "ProcessId"); - ver->OsType = PackGetInt(p, "OsType"); - ver->IsVLanNameRegulated = PackGetBool(p, "IsVLanNameRegulated"); - ver->IsVgcSupported = PackGetBool(p, "IsVgcSupported"); - ver->ShowVgcLink = PackGetBool(p, "ShowVgcLink"); - PackGetStr(p, "ClientId", ver->ClientId, sizeof(ver->ClientId)); -} -void OutRpcClientVersion(PACK *p, RPC_CLIENT_VERSION *ver) -{ - // Validate arguments - if (ver == NULL || p == NULL) - { - return; - } - - PackAddStr(p, "ClientProductName", ver->ClientProductName); - PackAddStr(p, "ClientVersionString", ver->ClientVersionString); - PackAddStr(p, "ClientBuildInfoString", ver->ClientBuildInfoString); - PackAddInt(p, "ClientVerInt", ver->ClientVerInt); - PackAddInt(p, "ClientBuildInt", ver->ClientBuildInt); - PackAddInt(p, "ProcessId", ver->ProcessId); - PackAddInt(p, "OsType", ver->OsType); - PackAddBool(p, "IsVLanNameRegulated", ver->IsVLanNameRegulated); - PackAddBool(p, "IsVgcSupported", ver->IsVgcSupported); - PackAddBool(p, "ShowVgcLink", ver->ShowVgcLink); - PackAddStr(p, "ClientId", ver->ClientId); -} - -// RPC_CLIENT_PASSWORD -void InRpcClientPassword(RPC_CLIENT_PASSWORD *pw, PACK *p) -{ - // Validate arguments - if (pw == NULL || p == NULL) - { - return; - } - - Zero(pw, sizeof(RPC_CLIENT_PASSWORD)); - PackGetStr(p, "Password", pw->Password, sizeof(pw->Password)); - pw->PasswordRemoteOnly = PackGetInt(p, "PasswordRemoteOnly"); -} -void OutRpcClientPassword(PACK *p, RPC_CLIENT_PASSWORD *pw) -{ - // Validate arguments - if (pw == NULL || p == NULL) - { - return; - } - - PackAddStr(p, "Password", pw->Password); - PackAddInt(p, "PasswordRemoteOnly", pw->PasswordRemoteOnly); -} - -// RPC_CLIENT_PASSWORD_SETTING -void InRpcClientPasswordSetting(RPC_CLIENT_PASSWORD_SETTING *a, PACK *p) -{ - // Validate arguments - if (a == NULL || p == NULL) - { - return; - } - - Zero(a, sizeof(RPC_CLIENT_PASSWORD_SETTING)); - - a->IsPasswordPresented = PackGetInt(p, "IsPasswordPresented") == 0 ? false : true; - a->PasswordRemoteOnly = PackGetInt(p, "PasswordRemoteOnly") == 0 ? false : true; -} -void OutRpcClientPasswordSetting(PACK *p, RPC_CLIENT_PASSWORD_SETTING *a) -{ - // Validate arguments - if (a == NULL || p == NULL) - { - return; - } - - PackAddInt(p, "IsPasswordPresented", a->IsPasswordPresented); - PackAddInt(p, "PasswordRemoteOnly", a->PasswordRemoteOnly); -} - -// RPC_CLIENT_ENUM_CA -void InRpcClientEnumCa(RPC_CLIENT_ENUM_CA *e, PACK *p) -{ - UINT i; - // Validate arguments - if (e == NULL || p == NULL) - { - return; - } - - Zero(e, sizeof(RPC_CLIENT_ENUM_CA)); - e->NumItem = PackGetNum(p, "NumItem"); - - e->Items = ZeroMalloc(sizeof(RPC_CLIENT_ENUM_CA_ITEM *) * e->NumItem); - for (i = 0;i < e->NumItem;i++) - { - RPC_CLIENT_ENUM_CA_ITEM *item = ZeroMalloc(sizeof(RPC_CLIENT_ENUM_CA_ITEM)); - e->Items[i] = item; - - item->Key = PackGetIntEx(p, "Key", i); - PackGetUniStrEx(p, "SubjectName", item->SubjectName, sizeof(item->SubjectName), i); - PackGetUniStrEx(p, "IssuerName", item->IssuerName, sizeof(item->IssuerName), i); - item->Expires = PackGetInt64Ex(p, "Expires", i); - } -} -void OutRpcClientEnumCa(PACK *p, RPC_CLIENT_ENUM_CA *e) -{ - UINT i; - // Validate arguments - if (e == NULL || p == NULL) - { - return; - } - - PackAddNum(p, "NumItem", e->NumItem); - - PackSetCurrentJsonGroupName(p, "CAList"); - for (i = 0;i < e->NumItem;i++) - { - RPC_CLIENT_ENUM_CA_ITEM *item = e->Items[i]; - PackAddIntEx(p, "Key", item->Key, i, e->NumItem); - PackAddUniStrEx(p, "SubjectName", item->SubjectName, i, e->NumItem); - PackAddUniStrEx(p, "IssuerName", item->IssuerName, i, e->NumItem); - PackAddTime64Ex(p, "Expires", item->Expires, i, e->NumItem); - } - PackSetCurrentJsonGroupName(p, NULL); -} - -// RPC_GET_ISSUER -void InRpcGetIssuer(RPC_GET_ISSUER *c, PACK *p) -{ - BUF *b; - // Validate arguments - if (c == NULL || p == NULL) - { - return; - } - - Zero(c, sizeof(RPC_GET_ISSUER)); - b = PackGetBuf(p, "x"); - if (b != NULL) - { - if (c->x != NULL) - { - FreeX(c->x); - } - c->x = BufToX(b, false); - FreeBuf(b); - } - - b = PackGetBuf(p, "issuer_x"); - if (b != NULL) - { - c->issuer_x = BufToX(b, false); - FreeBuf(b); - } -} -void OutRpcGetIssuer(PACK *p, RPC_GET_ISSUER *c) -{ - BUF *b; - // Validate arguments - if (p == NULL || c == NULL) - { - return; - } - - if (c->x != NULL) - { - b = XToBuf(c->x, false); - - PackAddBuf(p, "x", b); - FreeBuf(b); - } - - if (c->issuer_x != NULL) - { - b = XToBuf(c->issuer_x, false); - - PackAddBuf(p, "issuer_x", b); - FreeBuf(b); - } -} - -// TRAFFIC_EX -void InRpcTrafficEx(TRAFFIC *t, PACK *p, UINT i) -{ - // Validate arguments - if (t == NULL || p == NULL) - { - return; - } - - Zero(t, sizeof(TRAFFIC)); - t->Recv.BroadcastBytes = PackGetInt64Ex(p, "Ex.Recv.BroadcastBytes", i); - t->Recv.BroadcastCount = PackGetInt64Ex(p, "Ex.Recv.BroadcastCount", i); - t->Recv.UnicastBytes = PackGetInt64Ex(p, "Ex.Recv.UnicastBytes", i); - t->Recv.UnicastCount = PackGetInt64Ex(p, "Ex.Recv.UnicastCount", i); - t->Send.BroadcastBytes = PackGetInt64Ex(p, "Ex.Send.BroadcastBytes", i); - t->Send.BroadcastCount = PackGetInt64Ex(p, "Ex.Send.BroadcastCount", i); - t->Send.UnicastBytes = PackGetInt64Ex(p, "Ex.Send.UnicastBytes", i); - t->Send.UnicastCount = PackGetInt64Ex(p, "Ex.Send.UnicastCount", i); -} -void OutRpcTrafficEx(TRAFFIC *t, PACK *p, UINT i, UINT num) -{ - // Validate arguments - if (t == NULL || p == NULL) - { - return; - } - - PackAddInt64Ex(p, "Ex.Recv.BroadcastBytes", t->Recv.BroadcastBytes, i, num); - PackAddInt64Ex(p, "Ex.Recv.BroadcastCount", t->Recv.BroadcastCount, i, num); - PackAddInt64Ex(p, "Ex.Recv.UnicastBytes", t->Recv.UnicastBytes, i, num); - PackAddInt64Ex(p, "Ex.Recv.UnicastCount", t->Recv.UnicastCount, i, num); - PackAddInt64Ex(p, "Ex.Send.BroadcastBytes", t->Send.BroadcastBytes, i, num); - PackAddInt64Ex(p, "Ex.Send.BroadcastCount", t->Send.BroadcastCount, i, num); - PackAddInt64Ex(p, "Ex.Send.UnicastBytes", t->Send.UnicastBytes, i, num); - PackAddInt64Ex(p, "Ex.Send.UnicastCount", t->Send.UnicastCount, i, num); -} - -// TRAFFIC -void InRpcTraffic(TRAFFIC *t, PACK *p) -{ - // Validate arguments - if (t == NULL || p == NULL) - { - return; - } - - Zero(t, sizeof(TRAFFIC)); - t->Recv.BroadcastBytes = PackGetInt64(p, "Recv.BroadcastBytes"); - t->Recv.BroadcastCount = PackGetInt64(p, "Recv.BroadcastCount"); - t->Recv.UnicastBytes = PackGetInt64(p, "Recv.UnicastBytes"); - t->Recv.UnicastCount = PackGetInt64(p, "Recv.UnicastCount"); - t->Send.BroadcastBytes = PackGetInt64(p, "Send.BroadcastBytes"); - t->Send.BroadcastCount = PackGetInt64(p, "Send.BroadcastCount"); - t->Send.UnicastBytes = PackGetInt64(p, "Send.UnicastBytes"); - t->Send.UnicastCount = PackGetInt64(p, "Send.UnicastCount"); -} -void OutRpcTraffic(PACK *p, TRAFFIC *t) -{ - // Validate arguments - if (t == NULL || p == NULL) - { - return; - } - - PackAddInt64(p, "Recv.BroadcastBytes", t->Recv.BroadcastBytes); - PackAddInt64(p, "Recv.BroadcastCount", t->Recv.BroadcastCount); - PackAddInt64(p, "Recv.UnicastBytes", t->Recv.UnicastBytes); - PackAddInt64(p, "Recv.UnicastCount", t->Recv.UnicastCount); - PackAddInt64(p, "Send.BroadcastBytes", t->Send.BroadcastBytes); - PackAddInt64(p, "Send.BroadcastCount", t->Send.BroadcastCount); - PackAddInt64(p, "Send.UnicastBytes", t->Send.UnicastBytes); - PackAddInt64(p, "Send.UnicastCount", t->Send.UnicastCount); -} - -// RPC_CERT -void InRpcCert(RPC_CERT *c, PACK *p) -{ - BUF *b; - // Validate arguments - if (c == NULL || p == NULL) - { - return; - } - - Zero(c, sizeof(RPC_CERT)); - b = PackGetBuf(p, "x"); - if (b == NULL) - { - return; - } - - c->x = BufToX(b, false); - FreeBuf(b); -} -void OutRpcCert(PACK *p, RPC_CERT *c) -{ - BUF *b; - // Validate arguments - if (p == NULL || c == NULL) - { - return; - } - - if (c->x != NULL) - { - b = XToBuf(c->x, false); - - PackAddBuf(p, "x", b); - - FreeBuf(b); - } -} - -// RPC_CLIENT_DELETE_CA -void InRpcClientDeleteCa(RPC_CLIENT_DELETE_CA *c, PACK *p) -{ - // Validate arguments - if (c == NULL || p == NULL) - { - return; - } - - Zero(c, sizeof(RPC_CLIENT_DELETE_CA)); - c->Key = PackGetInt(p, "Key"); -} -void OutRpcClientDeleteCa(PACK *p, RPC_CLIENT_DELETE_CA *c) -{ - // Validate arguments - if (c == NULL || p == NULL) - { - return; - } - - PackAddInt(p, "Key", c->Key); -} - -// RPC_GET_CA -void InRpcGetCa(RPC_GET_CA *c, PACK *p) -{ - BUF *b; - // Validate arguments - if (c == NULL || p == NULL) - { - return; - } - - Zero(c, sizeof(RPC_GET_CA)); - - c->Key = PackGetInt(p, "Key"); - - b = PackGetBuf(p, "x"); - if (b != NULL) - { - c->x = BufToX(b, false); - - FreeBuf(b); - } -} -void OutRpcGetCa(PACK *p, RPC_GET_CA *c) -{ - // Validate arguments - if (c == NULL || p == NULL) - { - return; - } - - PackAddInt(p, "Key", c->Key); - - if (c->x != NULL) - { - BUF *b = XToBuf(c->x, false); - - PackAddBuf(p, "x", b); - - FreeBuf(b); - } -} - -// RPC_CLIENT_ENUM_SECURE -void InRpcClientEnumSecure(RPC_CLIENT_ENUM_SECURE *e, PACK *p) -{ - UINT i; - // Validate arguments - if (e == NULL || p == NULL) - { - return; - } - - Zero(e, sizeof(RPC_CLIENT_ENUM_SECURE)); - - e->NumItem = PackGetNum(p, "NumItem"); - e->Items = ZeroMalloc(sizeof(RPC_CLIENT_ENUM_SECURE_ITEM *) * e->NumItem); - for (i = 0;i < e->NumItem;i++) - { - RPC_CLIENT_ENUM_SECURE_ITEM *item = e->Items[i] = ZeroMalloc(sizeof(RPC_CLIENT_ENUM_SECURE_ITEM)); - - item->DeviceId = PackGetIntEx(p, "DeviceId", i); - item->Type = PackGetIntEx(p, "Type", i); - PackGetStrEx(p, "DeviceName", item->DeviceName, sizeof(item->DeviceName), i); - PackGetStrEx(p, "Manufacturer", item->Manufacturer, sizeof(item->Manufacturer), i); - } -} -void OutRpcClientEnumSecure(PACK *p, RPC_CLIENT_ENUM_SECURE *e) -{ - UINT i; - // Validate arguments - if (e == NULL || p == NULL) - { - return; - } - - PackAddNum(p, "NumItem", e->NumItem); - - PackSetCurrentJsonGroupName(p, "SecureDeviceList"); - for (i = 0;i < e->NumItem;i++) - { - RPC_CLIENT_ENUM_SECURE_ITEM *item = e->Items[i]; - - PackAddIntEx(p, "DeviceId", item->DeviceId, i, e->NumItem); - PackAddIntEx(p, "Type", item->Type, i, e->NumItem); - PackAddStrEx(p, "DeviceName", item->DeviceName, i, e->NumItem); - PackAddStrEx(p, "Manufacturer", item->Manufacturer, i, e->NumItem); - } - PackSetCurrentJsonGroupName(p, NULL); -} - -// RPC_USE_SECURE -void InRpcUseSecure(RPC_USE_SECURE *u, PACK *p) -{ - // Validate arguments - if (u == NULL || p == NULL) - { - return; - } - - Zero(u, sizeof(RPC_USE_SECURE)); - u->DeviceId = PackGetInt(p, "DeviceId"); -} -void OutRpcUseSecure(PACK *p, RPC_USE_SECURE *u) -{ - // Validate arguments - if (u == NULL || p == NULL) - { - return; - } - - PackAddInt(p, "DeviceId", u->DeviceId); -} - -// Release the RPC_ENUM_OBJECT_IN_SECURE -void CiFreeEnumObjectInSecure(RPC_ENUM_OBJECT_IN_SECURE *a) -{ - UINT i; - // Validate arguments - if (a == NULL) - { - return; - } - - for (i = 0;i < a->NumItem;i++) - { - Free(a->ItemName[i]); - } - Free(a->ItemName); - Free(a->ItemType); -} - -// RPC_ENUM_OBJECT_IN_SECURE -void OutRpcEnumObjectInSecure(PACK *p, RPC_ENUM_OBJECT_IN_SECURE *e) -{ - UINT i; - // Validate arguments - if (e == NULL || p == NULL) - { - return; - } - - PackAddNum(p, "NumItem", e->NumItem); - PackAddInt(p, "hWnd", e->hWnd); - - PackSetCurrentJsonGroupName(p, "ObjectList"); - for (i = 0;i < e->NumItem;i++) - { - PackAddStrEx(p, "ItemName", e->ItemName[i], i, e->NumItem); - PackAddIntEx(p, "ItemType", e->ItemType[i], i, e->NumItem); - } - PackSetCurrentJsonGroupName(p, NULL); -} - -// RPC_CLIENT_CREATE_VLAN -void InRpcCreateVLan(RPC_CLIENT_CREATE_VLAN *v, PACK *p) -{ - // Validate arguments - if (v == NULL || p == NULL) - { - return; - } - - Zero(v, sizeof(RPC_CLIENT_CREATE_VLAN)); - PackGetStr(p, "DeviceName", v->DeviceName, sizeof(v->DeviceName)); -} -void OutRpcCreateVLan(PACK *p, RPC_CLIENT_CREATE_VLAN *v) -{ - // Validate arguments - if (v == NULL || p == NULL) - { - return; - } - - PackAddStr(p, "DeviceName", v->DeviceName); -} - -// RPC_CLIENT_GET_VLAN -void InRpcClientGetVLan(RPC_CLIENT_GET_VLAN *v, PACK *p) -{ - // Validate arguments - if (v == NULL || p == NULL) - { - return; - } - - Zero(v, sizeof(RPC_CLIENT_GET_VLAN)); - PackGetStr(p, "DeviceName", v->DeviceName, sizeof(v->DeviceName)); - v->Enabled = PackGetInt(p, "Enabled") ? true : false; - PackGetStr(p, "MacAddress", v->MacAddress, sizeof(v->MacAddress)); - PackGetStr(p, "Version", v->Version, sizeof(v->Version)); - PackGetStr(p, "FileName", v->FileName, sizeof(v->FileName)); - PackGetStr(p, "Guid", v->Guid, sizeof(v->Guid)); -} -void OutRpcClientGetVLan(PACK *p, RPC_CLIENT_GET_VLAN *v) -{ - // Validate arguments - if (v == NULL || p == NULL) - { - return; - } - - PackAddStr(p, "DeviceName", v->DeviceName); - PackAddInt(p, "Enabled", v->Enabled); - PackAddStr(p, "MacAddress", v->MacAddress); - PackAddStr(p, "Version", v->Version); - PackAddStr(p, "FileName", v->FileName); - PackAddStr(p, "Guid", v->Guid); -} - -// RPC_CLIENT_SET_VLAN -void InRpcClientSetVLan(RPC_CLIENT_SET_VLAN *v, PACK *p) -{ - // Validate arguments - if (v == NULL || p == NULL) - { - return; - } - - Zero(v, sizeof(RPC_CLIENT_SET_VLAN)); - PackGetStr(p, "DeviceName", v->DeviceName, sizeof(v->DeviceName)); - PackGetStr(p, "MacAddress", v->MacAddress, sizeof(v->MacAddress)); -} -void OutRpcClientSetVLan(PACK *p, RPC_CLIENT_SET_VLAN *v) -{ - // Validate arguments - if (v == NULL || p == NULL) - { - return; - } - - PackAddStr(p, "DeviceName", v->DeviceName); - PackAddStr(p, "MacAddress", v->MacAddress); -} - -// RPC_CLIENT_ENUM_VLAN -void InRpcClientEnumVLan(RPC_CLIENT_ENUM_VLAN *v, PACK *p) -{ - UINT i; - // Validate arguments - if (v == NULL || p == NULL) - { - return; - } - - Zero(v, sizeof(RPC_CLIENT_ENUM_VLAN)); - v->NumItem = PackGetNum(p, "NumItem"); - v->Items = ZeroMalloc(sizeof(RPC_CLIENT_ENUM_VLAN_ITEM *) * v->NumItem); - - for (i = 0;i < v->NumItem;i++) - { - RPC_CLIENT_ENUM_VLAN_ITEM *item = v->Items[i] = - ZeroMalloc(sizeof(RPC_CLIENT_ENUM_VLAN_ITEM)); - - PackGetStrEx(p, "DeviceName", item->DeviceName, sizeof(item->DeviceName), i); - item->Enabled = PackGetIntEx(p, "Enabled", i) ? true : false; - PackGetStrEx(p, "MacAddress", item->MacAddress, sizeof(item->MacAddress), i); - PackGetStrEx(p, "Version", item->Version, sizeof(item->Version), i); - } -} -void OutRpcClientEnumVLan(PACK *p, RPC_CLIENT_ENUM_VLAN *v) -{ - UINT i; - // Validate arguments - if (v == NULL || p == NULL) - { - return; - } - - PackAddNum(p, "NumItem", v->NumItem); - - PackSetCurrentJsonGroupName(p, "VLanList"); - for (i = 0;i < v->NumItem;i++) - { - RPC_CLIENT_ENUM_VLAN_ITEM *item = v->Items[i]; - - PackAddStrEx(p, "DeviceName", item->DeviceName, i, v->NumItem); - PackAddIntEx(p, "Enabled", item->Enabled, i, v->NumItem); - PackAddStrEx(p, "MacAddress", item->MacAddress, i, v->NumItem); - PackAddStrEx(p, "Version", item->Version, i, v->NumItem); - } - PackSetCurrentJsonGroupName(p, NULL); -} - -// CLIENT_OPTION -void InRpcClientOption(CLIENT_OPTION *c, PACK *p) -{ - // Validate arguments - if (c == NULL || p == NULL) - { - return; - } - - Zero(c, sizeof(CLIENT_OPTION)); - - PackGetUniStr(p, "AccountName", c->AccountName, sizeof(c->AccountName)); - PackGetStr(p, "Hostname", c->Hostname, sizeof(c->Hostname)); - c->Port = PackGetInt(p, "Port"); - c->PortUDP = PackGetInt(p, "PortUDP"); - c->ProxyType = PackGetInt(p, "ProxyType"); - c->ProxyPort = PackGetInt(p, "ProxyPort"); - c->NumRetry = PackGetInt(p, "NumRetry"); - c->RetryInterval = PackGetInt(p, "RetryInterval"); - c->MaxConnection = PackGetInt(p, "MaxConnection"); - c->AdditionalConnectionInterval = PackGetInt(p, "AdditionalConnectionInterval"); - c->ConnectionDisconnectSpan = PackGetInt(p, "ConnectionDisconnectSpan"); - c->HideStatusWindow = PackGetBool(p, "HideStatusWindow"); - c->HideNicInfoWindow = PackGetBool(p, "HideNicInfoWindow"); - c->DisableQoS = PackGetBool(p, "DisableQoS"); - PackGetStr(p, "ProxyName", c->ProxyName, sizeof(c->ProxyName)); - PackGetStr(p, "ProxyUsername", c->ProxyUsername, sizeof(c->ProxyUsername)); - PackGetStr(p, "ProxyPassword", c->ProxyPassword, sizeof(c->ProxyPassword)); - PackGetStr(p, "CustomHttpHeader", c->CustomHttpHeader, sizeof(c->CustomHttpHeader)); - PackGetStr(p, "HubName", c->HubName, sizeof(c->HubName)); - PackGetStr(p, "DeviceName", c->DeviceName, sizeof(c->DeviceName)); - c->UseEncrypt = PackGetInt(p, "UseEncrypt") ? true : false; - c->UseCompress = PackGetInt(p, "UseCompress") ? true : false; - c->HalfConnection = PackGetInt(p, "HalfConnection") ? true : false; - c->NoRoutingTracking = PackGetInt(p, "NoRoutingTracking") ? true : false; - c->RequireMonitorMode = PackGetBool(p, "RequireMonitorMode"); - c->RequireBridgeRoutingMode = PackGetBool(p, "RequireBridgeRoutingMode"); - c->FromAdminPack = PackGetBool(p, "FromAdminPack"); - c->NoUdpAcceleration = PackGetBool(p, "NoUdpAcceleration"); - PackGetData2(p, "HostUniqueKey", c->HostUniqueKey, SHA1_SIZE); -} -void OutRpcClientOption(PACK *p, CLIENT_OPTION *c) -{ - // Validate arguments - if (c == NULL || p == NULL) - { - return; - } - - PackAddUniStr(p, "AccountName", c->AccountName); - PackAddStr(p, "Hostname", c->Hostname); - PackAddStr(p, "ProxyName", c->ProxyName); - PackAddStr(p, "ProxyUsername", c->ProxyUsername); - PackAddStr(p, "ProxyPassword", c->ProxyPassword); - PackAddStr(p, "CustomHttpHeader", c->CustomHttpHeader); - PackAddStr(p, "HubName", c->HubName); - PackAddStr(p, "DeviceName", c->DeviceName); - PackAddInt(p, "Port", c->Port); - PackAddInt(p, "PortUDP", c->PortUDP); - PackAddInt(p, "ProxyType", c->ProxyType); - PackAddInt(p, "ProxyPort", c->ProxyPort); - PackAddInt(p, "NumRetry", c->NumRetry); - PackAddInt(p, "RetryInterval", c->RetryInterval); - PackAddInt(p, "MaxConnection", c->MaxConnection); - PackAddBool(p, "UseEncrypt", c->UseEncrypt); - PackAddBool(p, "UseCompress", c->UseCompress); - PackAddBool(p, "HalfConnection", c->HalfConnection); - PackAddBool(p, "NoRoutingTracking", c->NoRoutingTracking); - PackAddInt(p, "AdditionalConnectionInterval", c->AdditionalConnectionInterval); - PackAddInt(p, "ConnectionDisconnectSpan", c->ConnectionDisconnectSpan); - PackAddBool(p, "HideStatusWindow", c->HideStatusWindow); - PackAddBool(p, "HideNicInfoWindow", c->HideNicInfoWindow); - PackAddBool(p, "RequireMonitorMode", c->RequireMonitorMode); - PackAddBool(p, "RequireBridgeRoutingMode", c->RequireBridgeRoutingMode); - PackAddBool(p, "DisableQoS", c->DisableQoS); - PackAddBool(p, "FromAdminPack", c->FromAdminPack); - PackAddBool(p, "NoUdpAcceleration", c->NoUdpAcceleration); - PackAddData(p, "HostUniqueKey", c->HostUniqueKey, SHA1_SIZE); -} - -// CLIENT_AUTH -void InRpcClientAuth(CLIENT_AUTH *c, PACK *p) -{ - BUF *b; - // Validate arguments - if (c == NULL || p == NULL) - { - return; - } - - Zero(c, sizeof(CLIENT_AUTH)); - c->AuthType = PackGetInt(p, "AuthType"); - PackGetStr(p, "Username", c->Username, sizeof(c->Username)); - - switch (c->AuthType) - { - case CLIENT_AUTHTYPE_ANONYMOUS: - break; - - case CLIENT_AUTHTYPE_PASSWORD: - if (PackGetDataSize(p, "HashedPassword") == SHA1_SIZE) - { - PackGetData(p, "HashedPassword", c->HashedPassword); - } - break; - - case CLIENT_AUTHTYPE_PLAIN_PASSWORD: - PackGetStr(p, "PlainPassword", c->PlainPassword, sizeof(c->PlainPassword)); - break; - - case CLIENT_AUTHTYPE_CERT: - b = PackGetBuf(p, "ClientX"); - if (b != NULL) - { - c->ClientX = BufToX(b, false); - FreeBuf(b); - } - b = PackGetBuf(p, "ClientK"); - if (b != NULL) - { - c->ClientK = BufToK(b, true, false, NULL); - FreeBuf(b); - } - break; - - case CLIENT_AUTHTYPE_SECURE: - PackGetStr(p, "SecurePublicCertName", c->SecurePublicCertName, sizeof(c->SecurePublicCertName)); - PackGetStr(p, "SecurePrivateKeyName", c->SecurePrivateKeyName, sizeof(c->SecurePrivateKeyName)); - break; - - case CLIENT_AUTHTYPE_OPENSSLENGINE: - b = PackGetBuf(p, "ClientX"); - if (b != NULL) - { - c->ClientX = BufToX(b, false); - FreeBuf(b); - } - PackGetStr(p, "OpensslEnginePrivateKeyName", c->OpensslEnginePrivateKeyName, sizeof(c->OpensslEnginePrivateKeyName)); - PackGetStr(p, "OpensslEngineName", c->OpensslEngineName, sizeof(c->OpensslEngineName)); - break; - } -} -void OutRpcClientAuth(PACK *p, CLIENT_AUTH *c) -{ - BUF *b; - // Validate arguments - if (c == NULL || p == NULL) - { - return; - } - - PackAddInt(p, "AuthType", c->AuthType); - PackAddStr(p, "Username", c->Username); - - switch (c->AuthType) - { - case CLIENT_AUTHTYPE_ANONYMOUS: - break; - - case CLIENT_AUTHTYPE_PASSWORD: - PackAddData(p, "HashedPassword", c->HashedPassword, SHA1_SIZE); - break; - - case CLIENT_AUTHTYPE_PLAIN_PASSWORD: - PackAddStr(p, "PlainPassword", c->PlainPassword); - break; - - case CLIENT_AUTHTYPE_CERT: - b = XToBuf(c->ClientX, false); - if (b != NULL) - { - PackAddBuf(p, "ClientX", b); - FreeBuf(b); - } - b = KToBuf(c->ClientK, false, NULL); - if (b != NULL) - { - PackAddBuf(p, "ClientK", b); - FreeBuf(b); - } - break; - - case CLIENT_AUTHTYPE_SECURE: - PackAddStr(p, "SecurePublicCertName", c->SecurePublicCertName); - PackAddStr(p, "SecurePrivateKeyName", c->SecurePrivateKeyName); - break; - - case CLIENT_AUTHTYPE_OPENSSLENGINE: - b = XToBuf(c->ClientX, false); - if (b != NULL) - { - PackAddBuf(p, "ClientX", b); - FreeBuf(b); - } - PackAddStr(p, "OpensslEnginePrivateKeyName", c->OpensslEnginePrivateKeyName); - PackAddStr(p, "OpensslEngineName", c->OpensslEngineName); - break; - } -} - -// RPC_CLIENT_CREATE_ACCOUNT -void InRpcClientCreateAccount(RPC_CLIENT_CREATE_ACCOUNT *c, PACK *p) -{ - BUF *b; - // Validate arguments - if (c == NULL || p == NULL) - { - return; - } - - Zero(c, sizeof(RPC_CLIENT_CREATE_ACCOUNT)); - c->ClientOption = ZeroMalloc(sizeof(CLIENT_OPTION)); - c->ClientAuth = ZeroMalloc(sizeof(CLIENT_AUTH)); - - InRpcClientOption(c->ClientOption, p); - InRpcClientAuth(c->ClientAuth, p); - - c->StartupAccount = PackGetInt(p, "StartupAccount") ? true : false; - c->CheckServerCert = PackGetInt(p, "CheckServerCert") ? true : false; - c->RetryOnServerCert = PackGetInt(p, "RetryOnServerCert") ? true : false; - b = PackGetBuf(p, "ServerCert"); - if (b != NULL) - { - c->ServerCert = BufToX(b, false); - FreeBuf(b); - } - PackGetData2(p, "ShortcutKey", c->ShortcutKey, sizeof(c->ShortcutKey)); -} -void OutRpcClientCreateAccount(PACK *p, RPC_CLIENT_CREATE_ACCOUNT *c) -{ - BUF *b; - // Validate arguments - if (c == NULL || p == NULL) - { - return; - } - - OutRpcClientOption(p, c->ClientOption); - OutRpcClientAuth(p, c->ClientAuth); - - PackAddInt(p, "StartupAccount", c->StartupAccount); - PackAddInt(p, "CheckServerCert", c->CheckServerCert); - PackAddInt(p, "RetryOnServerCert", c->RetryOnServerCert); - if (c->ServerCert != NULL) - { - b = XToBuf(c->ServerCert, false); - if (b != NULL) - { - PackAddBuf(p, "ServerCert", b); - FreeBuf(b); - } - } - PackAddData(p, "ShortcutKey", c->ShortcutKey, sizeof(c->ShortcutKey)); -} - -// RPC_CLIENT_ENUM_ACCOUNT -void InRpcClientEnumAccount(RPC_CLIENT_ENUM_ACCOUNT *e, PACK *p) -{ - UINT i; - // Validate arguments - if (e == NULL || p == NULL) - { - return; - } - - Zero(e, sizeof(RPC_CLIENT_ENUM_ACCOUNT)); - - e->NumItem = PackGetNum(p, "NumItem"); - e->Items = ZeroMalloc(sizeof(RPC_CLIENT_ENUM_ACCOUNT_ITEM *) * e->NumItem); - - for (i = 0;i < e->NumItem;i++) - { - RPC_CLIENT_ENUM_ACCOUNT_ITEM *item = e->Items[i] = - ZeroMalloc(sizeof(RPC_CLIENT_ENUM_ACCOUNT_ITEM)); - - PackGetUniStrEx(p, "AccountName", item->AccountName, sizeof(item->AccountName), i); - PackGetStrEx(p, "UserName", item->UserName, sizeof(item->UserName), i); - PackGetStrEx(p, "ServerName", item->ServerName, sizeof(item->ServerName), i); - PackGetStrEx(p, "ProxyName", item->ProxyName, sizeof(item->ProxyName), i); - PackGetStrEx(p, "DeviceName", item->DeviceName, sizeof(item->DeviceName), i); - item->ProxyType = PackGetIntEx(p, "ProxyType", i); - item->Active = PackGetIntEx(p, "Active", i) ? true : false; - item->StartupAccount = PackGetIntEx(p, "StartupAccount", i) ? true : false; - item->Connected = PackGetBoolEx(p, "Connected", i); - item->Port = PackGetIntEx(p, "Port", i); - PackGetStrEx(p, "HubName", item->HubName, sizeof(item->HubName), i); - item->CreateDateTime = PackGetInt64Ex(p, "CreateDateTime", i); - item->UpdateDateTime = PackGetInt64Ex(p, "UpdateDateTime", i); - item->LastConnectDateTime = PackGetInt64Ex(p, "LastConnectDateTime", i); - } -} -void OutRpcClientEnumAccount(PACK *p, RPC_CLIENT_ENUM_ACCOUNT *e) -{ - UINT i; - // Validate arguments - if (e == NULL || p == NULL) - { - return; - } - - PackAddNum(p, "NumItem", e->NumItem); - - PackSetCurrentJsonGroupName(p, "AccountList"); - for (i = 0;i < e->NumItem;i++) - { - RPC_CLIENT_ENUM_ACCOUNT_ITEM *item = e->Items[i]; - - PackAddUniStrEx(p, "AccountName", item->AccountName, i, e->NumItem); - PackAddStrEx(p, "UserName", item->UserName, i, e->NumItem); - PackAddStrEx(p, "ServerName", item->ServerName, i, e->NumItem); - PackAddStrEx(p, "ProxyName", item->ProxyName, i, e->NumItem); - PackAddStrEx(p, "DeviceName", item->DeviceName, i, e->NumItem); - PackAddIntEx(p, "ProxyType", item->ProxyType, i, e->NumItem); - PackAddIntEx(p, "Active", item->Active, i, e->NumItem); - PackAddIntEx(p, "StartupAccount", item->StartupAccount, i, e->NumItem); - PackAddBoolEx(p, "Connected", item->Connected, i, e->NumItem); - PackAddIntEx(p, "Port", item->Port, i, e->NumItem); - PackAddStrEx(p, "HubName", item->HubName, i, e->NumItem); - PackAddTime64Ex(p, "CreateDateTime", item->CreateDateTime, i, e->NumItem); - PackAddTime64Ex(p, "UpdateDateTime", item->UpdateDateTime, i, e->NumItem); - PackAddTime64Ex(p, "LastConnectDateTime", item->LastConnectDateTime, i, e->NumItem); - } - PackSetCurrentJsonGroupName(p, NULL); -} - -// RPC_CLIENT_DELETE_ACCOUNT -void InRpcClientDeleteAccount(RPC_CLIENT_DELETE_ACCOUNT *a, PACK *p) -{ - // Validate arguments - if (a == NULL || p == NULL) - { - return; - } - - Zero(a, sizeof(RPC_CLIENT_DELETE_ACCOUNT)); - PackGetUniStr(p, "AccountName", a->AccountName, sizeof(a->AccountName)); -} -void OutRpcClientDeleteAccount(PACK *p, RPC_CLIENT_DELETE_ACCOUNT *a) -{ - // Validate arguments - if (a == NULL || p == NULL) - { - return; - } - - PackAddUniStr(p, "AccountName", a->AccountName); -} - -// RPC_RENAME_ACCOUNT -void InRpcRenameAccount(RPC_RENAME_ACCOUNT *a, PACK *p) -{ - // Validate arguments - if (a == NULL || p == NULL) - { - return; - } - - Zero(a, sizeof(RPC_RENAME_ACCOUNT)); - - PackGetUniStr(p, "OldName", a->OldName, sizeof(a->OldName)); - PackGetUniStr(p, "NewName", a->NewName, sizeof(a->NewName)); -} -void OutRpcRenameAccount(PACK *p, RPC_RENAME_ACCOUNT *a) -{ - // Validate arguments - if (a == NULL || p == NULL) - { - return; - } - - PackAddUniStr(p, "OldName", a->OldName); - PackAddUniStr(p, "NewName", a->NewName); -} - -// RPC_CLIENT_GET_ACCOUNT -void InRpcClientGetAccount(RPC_CLIENT_GET_ACCOUNT *c, PACK *p) -{ - BUF *b; - // Validate arguments - if (c == NULL || p == NULL) - { - return; - } - - Zero(c, sizeof(RPC_CLIENT_GET_ACCOUNT)); - - c->ClientOption = ZeroMalloc(sizeof(CLIENT_OPTION)); - c->ClientAuth = ZeroMalloc(sizeof(CLIENT_AUTH)); - - PackGetUniStr(p, "AccountName", c->AccountName, sizeof(c->AccountName)); - c->StartupAccount = PackGetInt(p, "StartupAccount") ? true : false; - c->CheckServerCert = PackGetInt(p, "CheckServerCert") ? true : false; - c->RetryOnServerCert = PackGetInt(p, "RetryOnServerCert") ? true : false; - b = PackGetBuf(p, "ServerCert"); - if (b != NULL) - { - c->ServerCert = BufToX(b, false); - FreeBuf(b); - } - - InRpcClientOption(c->ClientOption, p); - InRpcClientAuth(c->ClientAuth, p); - - c->CreateDateTime = PackGetInt64(p, "CreateDateTime"); - c->UpdateDateTime = PackGetInt64(p, "UpdateDateTime"); - c->LastConnectDateTime = PackGetInt64(p, "LastConnectDateTime"); - - PackGetData2(p, "ShortcutKey", c->ShortcutKey, SHA1_SIZE); -} -void OutRpcClientGetAccount(PACK *p, RPC_CLIENT_GET_ACCOUNT *c) -{ - BUF *b; - // Validate arguments - if (c == NULL || p == NULL) - { - return; - } - - PackAddUniStr(p, "AccountName", c->AccountName); - PackAddInt(p, "StartupAccount", c->StartupAccount); - PackAddInt(p, "CheckServerCert", c->CheckServerCert); - PackAddInt(p, "RetryOnServerCert", c->RetryOnServerCert); - - if (c->ServerCert != NULL) - { - b = XToBuf(c->ServerCert, false); - if (b != NULL) - { - PackAddBuf(p, "ServerCert", b); - FreeBuf(b); - } - } - - OutRpcClientOption(p, c->ClientOption); - OutRpcClientAuth(p, c->ClientAuth); - - PackAddData(p, "ShortcutKey", c->ShortcutKey, SHA1_SIZE); - - PackAddTime64(p, "CreateDateTime", c->CreateDateTime); - PackAddTime64(p, "UpdateDateTime", c->UpdateDateTime); - PackAddTime64(p, "LastConnectDateTime", c->LastConnectDateTime); -} - -// RPC_CLIENT_CONNECT -void InRpcClientConnect(RPC_CLIENT_CONNECT *c, PACK *p) -{ - // Validate arguments - if (c == NULL || p == NULL) - { - return; - } - - Zero(c, sizeof(RPC_CLIENT_CONNECT)); - - PackGetUniStr(p, "AccountName", c->AccountName, sizeof(c->AccountName)); -} -void OutRpcClientConnect(PACK *p, RPC_CLIENT_CONNECT *c) -{ - // Validate arguments - if (c == NULL || p == NULL) - { - return; - } - - PackAddUniStr(p, "AccountName", c->AccountName); -} - -// POLICY -void InRpcPolicy(POLICY *o, PACK *p) -{ - POLICY *pol; - // Validate arguments - if (o == NULL || p == NULL) - { - return; - } - - pol = PackGetPolicy(p); - Copy(o, pol, sizeof(POLICY)); - Free(pol); -} -void OutRpcPolicy(PACK *p, POLICY *o) -{ - // Validate arguments - if (o == NULL || p == NULL) - { - return; - } - - PackAddPolicy(p, o); -} - -// RPC_CLIENT_GET_CONNECTION_STATUS -void InRpcClientGetConnectionStatus(RPC_CLIENT_GET_CONNECTION_STATUS *s, PACK *p) -{ - BUF *b; - // Validate arguments - if (s == NULL || p == NULL) - { - return; - } - - Zero(s, sizeof(RPC_CLIENT_GET_CONNECTION_STATUS)); - - PackGetUniStr(p, "AccountName", s->AccountName, sizeof(s->AccountName)); - - PackGetStr(p, "ServerName", s->ServerName, sizeof(s->ServerName)); - PackGetStr(p, "ServerProductName", s->ServerProductName, sizeof(s->ServerProductName)); - PackGetStr(p, "CipherName", s->CipherName, sizeof(s->CipherName)); - PackGetStr(p, "SessionName", s->SessionName, sizeof(s->SessionName)); - PackGetStr(p, "ConnectionName", s->ConnectionName, sizeof(s->ConnectionName)); - - if (PackGetDataSize(p, "SessionKey") == SHA1_SIZE) - { - PackGetData(p, "SessionKey", s->SessionKey); - } - - s->SessionStatus = PackGetInt(p, "SessionStatus"); - s->ServerPort = PackGetInt(p, "ServerPort"); - s->ServerProductVer = PackGetInt(p, "ServerProductVer"); - s->ServerProductBuild = PackGetInt(p, "ServerProductBuild"); - s->NumConnectionsEstablished = PackGetInt(p, "NumConnectionsEstablished"); - s->MaxTcpConnections = PackGetInt(p, "MaxTcpConnections"); - s->NumTcpConnections = PackGetInt(p, "NumTcpConnections"); - s->NumTcpConnectionsUpload = PackGetInt(p, "NumTcpConnectionsUpload"); - s->NumTcpConnectionsDownload = PackGetInt(p, "NumTcpConnectionsDownload"); - - s->StartTime = PackGetInt64(p, "StartTime"); - /* !!! Do not correct the spelling to keep the backward protocol compatibility !!! */ - s->FirstConnectionEstablisiedTime = PackGetInt64(p, "FirstConnectionEstablisiedTime"); - s->CurrentConnectionEstablishTime = PackGetInt64(p, "CurrentConnectionEstablishTime"); - s->TotalSendSize = PackGetInt64(p, "TotalSendSize"); - s->TotalRecvSize = PackGetInt64(p, "TotalRecvSize"); - s->TotalSendSizeReal = PackGetInt64(p, "TotalSendSizeReal"); - s->TotalRecvSizeReal = PackGetInt64(p, "TotalRecvSizeReal"); - - s->Active = PackGetInt(p, "Active") ? true : false; - s->Connected = PackGetInt(p, "Connected") ? true : false; - s->HalfConnection = PackGetInt(p, "HalfConnection") ? true : false; - s->QoS = PackGetInt(p, "QoS") ? true : false; - s->UseEncrypt = PackGetInt(p, "UseEncrypt") ? true : false; - s->UseCompress = PackGetInt(p, "UseCompress") ? true : false; - s->IsRUDPSession = PackGetInt(p, "IsRUDPSession") ? true : false; - PackGetStr(p, "UnderlayProtocol", s->UnderlayProtocol, sizeof(s->UnderlayProtocol)); - s->IsUdpAccelerationEnabled = PackGetInt(p, "IsUdpAccelerationEnabled") ? true : false; - s->IsUsingUdpAcceleration = PackGetInt(p, "IsUsingUdpAcceleration") ? true : false; - - s->IsBridgeMode = PackGetBool(p, "IsBridgeMode"); - s->IsMonitorMode = PackGetBool(p, "IsMonitorMode"); - - s->VLanId = PackGetInt(p, "VLanId"); - - b = PackGetBuf(p, "ServerX"); - if (b != NULL) - { - s->ServerX = BufToX(b, false); - FreeBuf(b); - } - - b = PackGetBuf(p, "ClientX"); - if (b != NULL) - { - s->ClientX = BufToX(b, false); - FreeBuf(b); - } - - InRpcPolicy(&s->Policy, p); - - InRpcTraffic(&s->Traffic, p); -} -void OutRpcClientGetConnectionStatus(PACK *p, RPC_CLIENT_GET_CONNECTION_STATUS *c) -{ - BUF *b; - // Validate arguments - if (p == NULL || c == NULL) - { - return; - } - - PackAddUniStr(p, "AccountName", c->AccountName); - - PackAddStr(p, "ServerName", c->ServerName); - PackAddStr(p, "ServerProductName", c->ServerProductName); - PackAddStr(p, "CipherName", c->CipherName); - PackAddStr(p, "SessionName", c->SessionName); - PackAddStr(p, "ConnectionName", c->ConnectionName); - - PackAddData(p, "SessionKey", c->SessionKey, SHA1_SIZE); - - PackAddBool(p, "Active", c->Active); - PackAddBool(p, "Connected", c->Connected); - PackAddInt(p, "SessionStatus", c->SessionStatus); - PackAddInt(p, "ServerPort", c->ServerPort); - PackAddInt(p, "ServerProductVer", c->ServerProductVer); - PackAddInt(p, "ServerProductBuild", c->ServerProductBuild); - PackAddInt(p, "NumConnectionsEstablished", c->NumConnectionsEstablished); - PackAddBool(p, "HalfConnection", c->HalfConnection); - PackAddBool(p, "QoS", c->QoS); - PackAddInt(p, "MaxTcpConnections", c->MaxTcpConnections); - PackAddInt(p, "NumTcpConnections", c->NumTcpConnections); - PackAddInt(p, "NumTcpConnectionsUpload", c->NumTcpConnectionsUpload); - PackAddInt(p, "NumTcpConnectionsDownload", c->NumTcpConnectionsDownload); - PackAddBool(p, "UseEncrypt", c->UseEncrypt); - PackAddBool(p, "UseCompress", c->UseCompress); - PackAddBool(p, "IsRUDPSession", c->IsRUDPSession); - PackAddStr(p, "UnderlayProtocol", c->UnderlayProtocol); - PackAddBool(p, "IsUdpAccelerationEnabled", c->IsUdpAccelerationEnabled); - PackAddBool(p, "IsUsingUdpAcceleration", c->IsUsingUdpAcceleration); - - PackAddBool(p, "IsBridgeMode", c->IsBridgeMode); - PackAddBool(p, "IsMonitorMode", c->IsMonitorMode); - - PackAddTime64(p, "StartTime", c->StartTime); - PackAddTime64(p, "FirstConnectionEstablisiedTime", c->FirstConnectionEstablisiedTime); - PackAddTime64(p, "CurrentConnectionEstablishTime", c->CurrentConnectionEstablishTime); - PackAddInt64(p, "TotalSendSize", c->TotalSendSize); - PackAddInt64(p, "TotalRecvSize", c->TotalRecvSize); - PackAddInt64(p, "TotalSendSizeReal", c->TotalSendSizeReal); - PackAddInt64(p, "TotalRecvSizeReal", c->TotalRecvSizeReal); - - PackAddInt(p, "VLanId", c->VLanId); - - OutRpcPolicy(p, &c->Policy); - - OutRpcTraffic(p, &c->Traffic); - - if (c->ServerX != NULL) - { - b = XToBuf(c->ServerX, false); - PackAddBuf(p, "ServerX", b); - FreeBuf(b); - } - - if (c->ClientX != NULL) - { - b = XToBuf(c->ClientX, false); - PackAddBuf(p, "ClientX", b); - FreeBuf(b); - } -} - -// Notification main -void CiNotifyMain(CLIENT *c, SOCK *s) -{ - CANCEL *cancel; - // Validate arguments - if (c == NULL || s == NULL) - { - return; - } - - // Register a Cancel - cancel = NewCancel(); - LockList(c->NotifyCancelList); - { - Add(c->NotifyCancelList, cancel); - } - UnlockList(c->NotifyCancelList); - - // Wait - while (true) - { - char ch = '@'; - SOCKSET set; - InitSockSet(&set); - AddSockSet(&set, s); - Select(&set, INFINITE, cancel, NULL); - - if (c->Halt) - { - // Abort - break; - } - - // 1 byte transmission - if (Send(s, &ch, 1, false) == 0) - { - // Disconnected - break; - } - } - - // Disconnect - Disconnect(s); - - // Unregister the Cancel - LockList(c->NotifyCancelList); - { - Delete(c->NotifyCancelList, cancel); - } - UnlockList(c->NotifyCancelList); - - ReleaseCancel(cancel); -} - -// RPC acceptance code -void CiRpcAccepted(CLIENT *c, SOCK *s) -{ - UCHAR hashed_password[SHA1_SIZE]; - UINT rpc_mode; - UINT retcode; - RPC *rpc; - // Validate arguments - if (c == NULL || s == NULL) - { - return; - } - - // Receive the RPC mode - if (RecvAll(s, &rpc_mode, sizeof(UINT), false) == false) - { - return; - } - - rpc_mode = Endian32(rpc_mode); - - if (rpc_mode == CLIENT_RPC_MODE_NOTIFY) - { - // Notification mode - CiNotifyMain(c, s); - return; - } - else if (rpc_mode == CLIENT_RPC_MODE_SHORTCUT || rpc_mode == CLIENT_RPC_MODE_SHORTCUT_DISCONNECT) - { - // Shortcut key received - UCHAR key[SHA1_SIZE]; - UINT err = ERR_NO_ERROR; - if (RecvAll(s, key, SHA1_SIZE, false)) - { - UINT i; - wchar_t title[MAX_ACCOUNT_NAME_LEN + 1]; - bool ok = false; - // Connect to the specified setting - LockList(c->AccountList); - { - for (i = 0;i < LIST_NUM(c->AccountList);i++) - { - ACCOUNT *a = LIST_DATA(c->AccountList, i); - Lock(a->lock); - { - if (Cmp(a->ShortcutKey, key, SHA1_SIZE) == 0) - { - ok = true; - UniStrCpy(title, sizeof(title), a->ClientOption->AccountName); - } - } - Unlock(a->lock); - } - } - UnlockList(c->AccountList); - - if (ok == false) - { - err = ERR_ACCOUNT_NOT_FOUND; - } - else - { - RPC_CLIENT_CONNECT t; - Zero(&t, sizeof(t)); - UniStrCpy(t.AccountName, sizeof(t.AccountName), title); - - if (rpc_mode == CLIENT_RPC_MODE_SHORTCUT) - { - // Connect - if (CtConnect(c, &t)) - { - err = ERR_NO_ERROR; - } - else - { - err = c->Err; - } - } - else - { - // Connect - if (CtDisconnect(c, &t, false)) - { - err = ERR_NO_ERROR; - } - else - { - err = c->Err; - } - } - } - - err = Endian32(err); - SendAll(s, &err, sizeof(UINT), false); - (void)RecvAll(s, &err, sizeof(UINT), false); - } - return; - } - - // Password reception - if (RecvAll(s, hashed_password, SHA1_SIZE, false) == false) - { - return; - } - - retcode = 0; - - // Password comparison - if (Cmp(hashed_password, c->EncryptedPassword, SHA1_SIZE) != 0) - { - retcode = 1; - } - - if (c->PasswordRemoteOnly && s->RemoteIP.addr[0] == 127) - { - // If in a mode that requires a password only remote, - // the password sent from localhost is considered to be always correct - retcode = 0; - } - - Lock(c->lock); - { - if (c->Config.AllowRemoteConfig == false) - { - // If the remote control is prohibited, - // identify whether this connection is from remote - if (s->RemoteIP.addr[0] != 127) - { - retcode = 2; - } - } - } - Unlock(c->lock); - - retcode = Endian32(retcode); - // Error code transmission - if (SendAll(s, &retcode, sizeof(UINT), false) == false) - { - return; - } - - - - if (retcode != 0) - { - // Disconnect due to an error - return; - } - - // Create a RPC server - rpc = StartRpcServer(s, CiRpcDispatch, c); - - // RPC server operation - RpcServer(rpc); - - // Release the RPC server - EndRpc(rpc); -} - -// RPC acceptance thread -void CiRpcAcceptThread(THREAD *thread, void *param) -{ - CLIENT_RPC_CONNECTION *conn; - CLIENT *c; - SOCK *s; - // Validate arguments - if (thread == NULL || param == NULL) - { - return; - } - - conn = (CLIENT_RPC_CONNECTION *)param; - s = conn->Sock; - c = conn->Client; - AddRef(s->ref); - - // Add to the RPC connection list - LockList(c->RpcConnectionList); - { - Add(c->RpcConnectionList, conn); - } - UnlockList(c->RpcConnectionList); - - NoticeThreadInit(thread); - - // Main process - CiRpcAccepted(c, s); - - // Release from the connection list - LockList(c->RpcConnectionList); - { - Delete(c->RpcConnectionList, conn); - } - UnlockList(c->RpcConnectionList); - - ReleaseSock(conn->Sock); - ReleaseThread(conn->Thread); - Free(conn); - - Disconnect(s); - ReleaseSock(s); -} - -// RPC server thread -void CiRpcServerThread(THREAD *thread, void *param) -{ - CLIENT *c; - SOCK *listener; - UINT i; - LIST *thread_list; - // Validate arguments - if (thread == NULL || param == NULL) - { - return; - } - - c = (CLIENT *)param; - - // RPC connection list - c->RpcConnectionList = NewList(NULL); - - // Open the port - listener = NULL; - for (i = CLIENT_CONFIG_PORT;i < (CLIENT_CONFIG_PORT + 5);i++) - { - listener = Listen(i); - if (listener != NULL) - { - break; - } - } - - if (listener == NULL) - { - // Error - Alert(CEDAR_PRODUCT_STR " VPN Client RPC Port Open Failed.", CEDAR_CLIENT_STR); - return; - } - -#ifdef OS_WIN32 - MsRegWriteIntEx2(REG_LOCAL_MACHINE, CLIENT_WIN32_REGKEYNAME, CLIENT_WIN32_REGVALUE_PORT, i, false, true); - MsRegWriteIntEx2(REG_LOCAL_MACHINE, CLIENT_WIN32_REGKEYNAME, CLIENT_WIN32_REGVALUE_PID, MsGetCurrentProcessId(), false, true); -#endif // OS_WIN32 - - c->RpcListener = listener; - AddRef(listener->ref); - - NoticeThreadInit(thread); - - while (true) - { - // Wait for client connection - CLIENT_RPC_CONNECTION *conn; - SOCK *s = Accept(listener); - if (s == NULL) - { - // Stop - break; - } - - // Create a client processing thread - conn = ZeroMalloc(sizeof(CLIENT_RPC_CONNECTION)); - conn->Client = c; - conn->Sock = s; - AddRef(s->ref); - - conn->Thread = NewThread(CiRpcAcceptThread, (void *)conn); - WaitThreadInit(conn->Thread); - - ReleaseSock(s); - } - - // Release the listener - ReleaseSock(listener); - - thread_list = NewListFast(NULL); - - // Set all the event notification - LockList(c->NotifyCancelList); - { - UINT i; - for (i = 0;i < LIST_NUM(c->NotifyCancelList);i++) - { - CANCEL *cancel = LIST_DATA(c->NotifyCancelList, i); - Cancel(cancel); - } - } - UnlockList(c->NotifyCancelList); - - // Disconnect all the connections of connected yet - LockList(c->RpcConnectionList); - { - for (i = 0;i < LIST_NUM(c->RpcConnectionList);i++) - { - CLIENT_RPC_CONNECTION *cc = LIST_DATA(c->RpcConnectionList, i); - AddRef(cc->Thread->ref); - Add(thread_list, cc->Thread); - Disconnect(cc->Sock); - } - } - UnlockList(c->RpcConnectionList); - - for (i = 0;i < LIST_NUM(thread_list);i++) - { - THREAD *t = LIST_DATA(thread_list, i); - WaitThread(t, INFINITE); - ReleaseThread(t); - } - - ReleaseList(c->RpcConnectionList); - ReleaseList(thread_list); - -#ifdef OS_WIN32 - MsRegDeleteValueEx2(REG_LOCAL_MACHINE, CLIENT_WIN32_REGKEYNAME, CLIENT_WIN32_REGVALUE_PORT, false, true); - MsRegDeleteValueEx2(REG_LOCAL_MACHINE, CLIENT_WIN32_REGKEYNAME, CLIENT_WIN32_REGVALUE_PID, false, true); -#endif // OS_WIN32 -} - -// Start the Keep -void CiInitKeep(CLIENT *c) -{ - // Validate arguments - if (c == NULL) - { - return; - } - - c->Keep = StartKeep(); - - // Apply settings - if (c->Config.UseKeepConnect) - { - KEEP *k = c->Keep; - Lock(k->lock); - { - StrCpy(k->ServerName, sizeof(k->ServerName), c->Config.KeepConnectHost); - k->ServerPort = c->Config.KeepConnectPort; - k->Interval = c->Config.KeepConnectInterval * 1000; - k->UdpMode = (c->Config.KeepConnectProtocol == CONNECTION_UDP) ? true : false; - k->Enable = true; - } - Unlock(k->lock); - } -} - -// Stop the Keep -void CiFreeKeep(CLIENT *c) -{ - // Validate arguments - if (c == NULL) - { - return; - } - - StopKeep(c->Keep); - c->Keep = NULL; -} - -// Start the RPC -void CiStartRpcServer(CLIENT *c) -{ - // Validate arguments - if (c == NULL) - { - return; - } - - c->RpcThread = NewThread(CiRpcServerThread, (void *)c); - WaitThreadInit(c->RpcThread); -} - -// Stop the RPC -void CiStopRpcServer(CLIENT *c) -{ - // Validate arguments - if (c == NULL) - { - return; - } - - Disconnect(c->RpcListener); - ReleaseSock(c->RpcListener); - - WaitThread(c->RpcThread, INFINITE); - ReleaseThread(c->RpcThread); -} - -// Wait for the next notification -bool CcWaitNotify(NOTIFY_CLIENT *n) -{ - UCHAR c; - // Validate arguments - if (n == NULL) - { - return false; - } - - // 1 character reception - if (RecvAll(n->Sock, &c, 1, false) == false) - { - // Disconnected - return false; - } - - return true; -} - -// Connect as a notification client -NOTIFY_CLIENT *CcConnectNotify(REMOTE_CLIENT *rc) -{ - NOTIFY_CLIENT *n; - SOCK *s; - char tmp[MAX_SIZE]; - bool rpc_mode = false; - UINT port; - // Validate arguments - if (rc == NULL || rc->Rpc == NULL || rc->Rpc->Sock == NULL) - { - return NULL; - } - - // Connect - IPToStr(tmp, sizeof(tmp), &rc->Rpc->Sock->RemoteIP); - port = rc->Rpc->Sock->RemotePort; - - s = Connect(tmp, port); - if (s == NULL) - { - return NULL; - } - - rpc_mode = Endian32(rpc_mode); - if (SendAll(s, &rpc_mode, sizeof(rpc_mode), false) == false) - { - ReleaseSock(s); - return NULL; - } - - n = ZeroMalloc(sizeof(NOTIFY_CLIENT)); - n->Sock = s; - - return n; -} - -// Stop the notification client -void CcStopNotify(NOTIFY_CLIENT *n) -{ - // Validate arguments - if (n == NULL) - { - return; - } - - Disconnect(n->Sock); -} - -// Delete the notification client -void CcDisconnectNotify(NOTIFY_CLIENT *n) -{ - // Validate arguments - if (n == NULL) - { - return; - } - - // Disconnect - Disconnect(n->Sock); - ReleaseSock(n->Sock); - - // Memory release - Free(n); -} - -// Disconnect the remote connection -void CcDisconnectRpc(REMOTE_CLIENT *rc) -{ - // Validate arguments - if (rc == NULL) - { - return; - } - - RpcFree(rc->Rpc); - Free(rc); -} - -// Connect to the client to start the shortcut connection setting -UINT CcShortcut(UCHAR *key) -{ - UINT ret; - // Validate arguments - if (key == NULL) - { - return ERR_INVALID_PARAMETER; - } - - CcConnectRpcEx("localhost", NULL, NULL, NULL, key, &ret, false, 0); - - return ret; -} - -// Disconnect the connected shortcut connection -UINT CcShortcutDisconnect(UCHAR *key) -{ - UINT ret; - // Validate arguments - if (key == NULL) - { - return ERR_INVALID_PARAMETER; - } - - CcConnectRpcEx("localhost", NULL, NULL, NULL, key, &ret, true, 0); - - return ret; -} - -// Connect to the remote client -REMOTE_CLIENT *CcConnectRpc(char *server_name, char *password, bool *bad_pass, bool *no_remote, UINT wait_retry) -{ - return CcConnectRpcEx(server_name, password, bad_pass, no_remote, NULL, NULL, false, wait_retry); -} -REMOTE_CLIENT *CcConnectRpcEx(char *server_name, char *password, bool *bad_pass, bool *no_remote, UCHAR *key, UINT *key_error_code, bool shortcut_disconnect, UINT wait_retry) -{ - SOCK *s = NULL; - UINT i; - UINT retcode; - UINT rpc_mode = CLIENT_RPC_MODE_MANAGEMENT; - RPC *rpc; - REMOTE_CLIENT *ret; - UCHAR hash_password[SHA1_SIZE]; - UINT port_start; - UINT64 try_started = 0; - bool ok; - UINT reg_port = 0; - UINT reg_pid = 0; - // Validate arguments - if (server_name == NULL) - { - return NULL; - } - if (password == NULL) - { - password = ""; - } - - if (key_error_code != NULL) - { - *key_error_code = ERR_NO_ERROR; - } - - if (bad_pass != NULL) - { - *bad_pass = false; - } - - if (no_remote != NULL) - { - *no_remote = false; - } - -#ifdef OS_WIN32 - // read the current port number from the registry of the localhost - if (StrCmpi(server_name, "localhost") == 0) - { - reg_port = MsRegReadIntEx2(REG_LOCAL_MACHINE, CLIENT_WIN32_REGKEYNAME, CLIENT_WIN32_REGVALUE_PORT, false, true); - reg_pid = MsRegReadIntEx2(REG_LOCAL_MACHINE, CLIENT_WIN32_REGKEYNAME, CLIENT_WIN32_REGVALUE_PID, false, true); - - if (reg_pid != 0) - { - if (MsIsServiceRunning(GC_SVC_NAME_VPNCLIENT) == false) - { - reg_port = 0; - } - } - else - { - reg_port = 0; - } - } - - if (reg_port != 0) - { - s = Connect(server_name, reg_port); - - if (s != NULL) - { - goto L_TRY; - } - } - -#endif // OS_WIN32 - - port_start = CLIENT_CONFIG_PORT - 1; - -RETRY: - port_start++; - - if (port_start >= (CLIENT_CONFIG_PORT + 5)) - { - return NULL; - } - - ok = false; - - while (true) - { - for (i = port_start;i < (CLIENT_CONFIG_PORT + 5);i++) - { - if (CheckTCPPort(server_name, i)) - { - ok = true; - break; - } - } - - if (ok) - { - break; - } - - if (wait_retry == 0) - { - break; - } - - if (try_started == 0) - { - try_started = Tick64(); - } - - if ((try_started + (UINT64)wait_retry) <= Tick64()) - { - break; - } - } - - if (ok == false) - { - if (key_error_code) - { - *key_error_code = ERR_CONNECT_FAILED; - } - return NULL; - } - - port_start = i; - - s = Connect(server_name, i); - if (s == NULL) - { - if (key_error_code) - { - *key_error_code = ERR_CONNECT_FAILED; - } - goto RETRY; - } -L_TRY: - - SetTimeout(s, 10000); - - Sha0(hash_password, password, StrLen(password)); - - if (key != NULL) - { - if (shortcut_disconnect == false) - { - rpc_mode = CLIENT_RPC_MODE_SHORTCUT; - } - else - { - rpc_mode = CLIENT_RPC_MODE_SHORTCUT_DISCONNECT; - } - } - - rpc_mode = Endian32(rpc_mode); - SendAdd(s, &rpc_mode, sizeof(UINT)); - - if (key != NULL) - { - SendAdd(s, key, SHA1_SIZE); - } - else - { - SendAdd(s, hash_password, SHA1_SIZE); - } - - if (SendNow(s, false) == false) - { - ReleaseSock(s); - goto RETRY; - } - - if (RecvAll(s, &retcode, sizeof(UINT), false) == false) - { - ReleaseSock(s); - goto RETRY; - } - - retcode = Endian32(retcode); - - if (retcode >= 1024) - { - ReleaseSock(s); - goto RETRY; - } - - if (key != NULL) - { - if (key_error_code) - { - *key_error_code = retcode; - } - SendAll(s, &retcode, sizeof(UINT), false); - ReleaseSock(s); - return NULL; - } - - switch (retcode) - { - case 1: - if (bad_pass != NULL) - { - *bad_pass = true; - } - break; - case 2: - if (no_remote != NULL) - { - *no_remote = true; - } - break; - } - - if (retcode != 0) - { - ReleaseSock(s); - return NULL; - } - - SetTimeout(s, INFINITE); - - rpc = StartRpcClient(s, NULL); - - ReleaseSock(s); - - ret = ZeroMalloc(sizeof(REMOTE_CLIENT)); - rpc->Param = ret; - - if (ret != NULL) - { - RPC_CLIENT_VERSION t; - - ret->Rpc = rpc; - Zero(&t, sizeof(t)); - CcGetClientVersion(ret, &t); - ret->OsType = t.OsType; - ret->Unix = OS_IS_UNIX(ret->OsType); - ret->Win9x = OS_IS_WINDOWS_9X(ret->OsType); - ret->IsVgcSupported = t.IsVgcSupported; - ret->ShowVgcLink = t.ShowVgcLink; - StrCpy(ret->ClientId, sizeof(ret->ClientId), t.ClientId); - } - - return ret; -} - -// Get a RPC_CLIENT_GET_CONNECTION_STATUS from the session -void CiGetSessionStatus(RPC_CLIENT_GET_CONNECTION_STATUS *st, SESSION *s) -{ - // Validate arguments - if (st == NULL || s == NULL) - { - return; - } - - Lock(s->lock); - { - // Operation flag - st->Active = true; - - // Session status - st->SessionStatus = s->ClientStatus; - - // Account name - UniStrCpy(st->AccountName, sizeof(st->AccountName), s->ClientOption->AccountName); - - if (s->ClientStatus == CLIENT_STATUS_ESTABLISHED && s->Connection != NULL) - { - Lock(s->Connection->lock); - { - // Connected flag - st->Connected = true; - // Product name - StrCpy(st->ServerProductName, sizeof(st->ServerProductName), s->Connection->ServerStr); - // Version - st->ServerProductVer = s->Connection->ServerVer; - // Build Number - st->ServerProductBuild = s->Connection->ServerBuild; - // Server certificate - st->ServerX = CloneX(s->Connection->ServerX); - // Client certificate - st->ClientX = CloneX(s->Connection->ClientX); - // Connection completion time of this connection - st->CurrentConnectionEstablishTime = TickToTime(s->CurrentConnectionEstablishTime); - // Maximum number of the TCP connections - st->MaxTcpConnections = s->MaxConnection; - // Half-connection - st->HalfConnection = s->HalfConnection; - // VLAN - st->VLanId = s->VLanId; - // VoIP / QoS - st->QoS = s->QoS; - if (s->Connection->Protocol == CONNECTION_TCP) - { - UINT i; - // Number of current TCP connections - LockList(s->Connection->Tcp->TcpSockList); - { - st->NumTcpConnections = LIST_NUM(s->Connection->Tcp->TcpSockList); - if (st->HalfConnection) - { - for (i = 0;i < st->NumTcpConnections;i++) - { - TCPSOCK *ts = LIST_DATA(s->Connection->Tcp->TcpSockList, i); - if (ts->Direction & TCP_SERVER_TO_CLIENT) - { - st->NumTcpConnectionsDownload++; - } - else - { - st->NumTcpConnectionsUpload++; - } - } - } - } - UnlockList(s->Connection->Tcp->TcpSockList); - } - // Use of encryption - st->UseEncrypt = s->UseEncrypt; - if (st->UseEncrypt) - { - StrCpy(st->CipherName, sizeof(st->CipherName), s->Connection->CipherName); - } - // Use of compression - st->UseCompress = s->UseCompress; - // R-UDP - st->IsRUDPSession = s->IsRUDPSession; - // Physical communication protocol - StrCpy(st->UnderlayProtocol, sizeof(st->UnderlayProtocol), s->UnderlayProtocol); - // Protocol details - StrCpy(st->ProtocolDetails, sizeof(st->ProtocolDetails), s->ProtocolDetails); - Trim(st->ProtocolDetails); - // UDP acceleration function - if (s->IpcSessionShared != NULL && IsEmptyStr(s->IpcSessionShared->ProtocolDetails) == false) - { - char tmp[sizeof(s->IpcSessionShared->ProtocolDetails)]; - StrCpy(tmp, sizeof(tmp), s->IpcSessionShared->ProtocolDetails); - Trim(tmp); - StrCat(st->ProtocolDetails, sizeof(st->ProtocolDetails), " "); - StrCat(st->ProtocolDetails, sizeof(st->ProtocolDetails), tmp); - - st->IsUdpAccelerationEnabled = s->IpcSessionShared->EnableUdpAccel; - st->IsUsingUdpAcceleration = s->IpcSessionShared->UsingUdpAccel; - } - else - { - st->IsUdpAccelerationEnabled = s->UseUdpAcceleration; - st->IsUsingUdpAcceleration = s->IsUsingUdpAcceleration; - } - // Session key - Copy(st->SessionKey, s->SessionKey, SHA1_SIZE); - // Policy - Copy(&st->Policy, s->Policy, sizeof(POLICY)); - // Data size - if (s->ServerMode == false) - { - st->TotalSendSize = s->TotalSendSize; - st->TotalRecvSize = s->TotalRecvSize; - st->TotalRecvSizeReal = s->TotalRecvSizeReal; - st->TotalSendSizeReal = s->TotalSendSizeReal; - } - else - { - st->TotalSendSize = s->TotalRecvSize; - st->TotalRecvSize = s->TotalSendSize; - st->TotalRecvSizeReal = s->TotalSendSizeReal; - st->TotalSendSizeReal = s->TotalRecvSizeReal; - } - // Session name - StrCpy(st->SessionName, sizeof(st->SessionName), s->Name); - // Connection name - StrCpy(st->ConnectionName, sizeof(st->ConnectionName), s->Connection->Name); - // Server name - StrCpy(st->ServerName, sizeof(st->ServerName), s->Connection->ServerName); - // Port number - st->ServerPort = s->Connection->ServerPort; - // Traffic data - Lock(s->TrafficLock); - { - Copy(&st->Traffic, s->Traffic, sizeof(TRAFFIC)); - } - Unlock(s->TrafficLock); - - st->IsBridgeMode = s->IsBridgeMode; - st->IsMonitorMode = s->IsMonitorMode; - } - Unlock(s->Connection->lock); - } - // Connection start time - st->StartTime = TickToTime(s->CreatedTime); - // Connection completion time of the first connection - /* !!! Do not correct the spelling to keep the backward protocol compatibility !!! */ - st->FirstConnectionEstablisiedTime = TickToTime(s->FirstConnectionEstablisiedTime); - // Number of connections have been established so far - st->NumConnectionsEstablished = s->NumConnectionsEstablished; - } - Unlock(s->lock); -} - -// Get the connection status -bool CtGetAccountStatus(CLIENT *c, RPC_CLIENT_GET_CONNECTION_STATUS *st) -{ - // Validate arguments - if (c == NULL || st == NULL) - { - return false; - } - - LockList(c->AccountList); - { - ACCOUNT t, *r; - - // Search for account - t.ClientOption = ZeroMalloc(sizeof(CLIENT_OPTION)); - UniStrCpy(t.ClientOption->AccountName, sizeof(t.ClientOption->AccountName), st->AccountName); - - r = Search(c->AccountList, &t); - if (r == NULL) - { - // Specified account is not found - UnlockList(c->AccountList); - - Free(t.ClientOption); - CiSetError(c, ERR_ACCOUNT_NOT_FOUND); - return false; - } - - Free(t.ClientOption); - - Lock(r->lock); - { - Zero(st, sizeof(RPC_CLIENT_GET_CONNECTION_STATUS)); - if (r->ClientSession != NULL) - { - SESSION *s = r->ClientSession; - CiGetSessionStatus(st, s); - } - } - Unlock(r->lock); - } - UnlockList(c->AccountList); - - return true; -} - -// Release the connection status -void CiFreeClientGetConnectionStatus(RPC_CLIENT_GET_CONNECTION_STATUS *st) -{ - // Validate arguments - if (st == NULL) - { - return; - } - - if (st->ServerX != NULL) - { - FreeX(st->ServerX); - } - - if (st->ClientX != NULL) - { - FreeX(st->ClientX); - } -} - -// Verification procedure of the server certificate -bool CiCheckCertProc(SESSION *s, CONNECTION *c, X *server_x, bool *expired) -{ -#ifdef OS_WIN32 - ACCOUNT *a; - X *old_x = NULL; - UI_CHECKCERT dlg; - // Validate arguments - if (s == NULL || c == NULL || server_x == NULL) - { - return false; - } - - if (expired != NULL) - { - *expired = false; - } - - Zero(&dlg, sizeof(dlg)); - - a = s->Account; - if (a == NULL) - { - return false; - } - - Lock(a->lock); - { - if (a->CheckServerCert == false) - { - // Not to validate the server certificate - Unlock(a->lock); - return true; - } - - if (a->ServerCert != NULL) - { - old_x = CloneX(a->ServerCert); - } - } - Unlock(a->lock); - - if (CheckXDateNow(server_x) == false) - { - // Expired - if (old_x != NULL) - { - FreeX(old_x); - } - - if (expired != NULL) - { - *expired = true; - } - - return false; - } - - if (old_x != NULL) - { - if (CompareX(old_x, server_x)) - { - // Matched exactly to the certificate that is already registered - if (old_x != NULL) - { - FreeX(old_x); - } - return true; - } - else - { - dlg.DiffWarning = true; - } - } - - // Because this certificate can not be trusted, confirm to be trusted by showing a dialog box - UniStrCpy(dlg.AccountName, sizeof(dlg.AccountName), a->ClientOption->AccountName); - StrCpy(dlg.ServerName, sizeof(dlg.ServerName), a->ClientOption->Hostname); - dlg.x = server_x; - dlg.old_x = old_x; - - dlg.Session = s; - AddRef(s->ref); - - CncCheckCert(s, &dlg); - - ReleaseSession(s); - - if (old_x != NULL) - { - FreeX(old_x); - } - - if (dlg.Ok && dlg.SaveServerCert) - { - // Save the server certificate and trust it from the next time - Lock(a->lock); - { - if (a->ServerCert != NULL) - { - FreeX(a->ServerCert); - } - - a->ServerCert = CloneX(server_x); - } - Unlock(a->lock); - CiSaveConfigurationFile(s->Cedar->Client); - } - - return dlg.Ok; -#else // OS_WIN32 - ACCOUNT *a; - X *old_x = NULL; - // Validate arguments - if (s == NULL || c == NULL || server_x == NULL) - { - return false; - } - - if (expired != NULL) - { - *expired = false; - } - - a = s->Account; - if (a == NULL) - { - return false; - } - - Lock(a->lock); - { - if (a->CheckServerCert == false) - { - // Not to validate the server certificate - Unlock(a->lock); - return true; - } - - if (a->ServerCert != NULL) - { - old_x = CloneX(a->ServerCert); - } - } - Unlock(a->lock); - - if (CheckXDateNow(server_x) == false) - { - // Expired - if (old_x != NULL) - { - FreeX(old_x); - } - - if (expired != NULL) - { - *expired = true; - } - - return false; - } - - if (old_x != NULL) - { - if (CompareX(old_x, server_x)) - { - // Exactly matched to the certificate that is already registered - if (old_x != NULL) - { - FreeX(old_x); - } - return true; - } - else - { - // Mismatch - if (old_x != NULL) - { - FreeX(old_x); - } - return false; - } - } - - return false; -#endif // OS_WIN32 -} - -// Signature procedure with a secure device -bool CiSecureSignProc(SESSION *s, CONNECTION *c, SECURE_SIGN *sign) -{ - // The UI is available in Win32 - return CncSecureSignDlg(sign); -} - -#ifdef OS_WIN32 -// Signing procedure (for Win32) -bool Win32CiSecureSign(SECURE_SIGN *sign) -{ - bool ret = false; - BUF *random; - // Validate arguments - if (sign == NULL) - { - return false; - } - - random = NewBuf(); - WriteBuf(random, sign->Random, SHA1_SIZE); - - // Batch processing - { - WINUI_SECURE_BATCH batch[] = - { - {WINUI_SECURE_READ_CERT, sign->SecurePublicCertName, true, NULL, NULL, NULL, NULL, NULL, NULL}, - {WINUI_SECURE_SIGN_WITH_KEY, sign->SecurePrivateKeyName, true, random, NULL, NULL, NULL, NULL, NULL} - }; - - if (SecureDeviceWindow(NULL, batch, sizeof(batch) / sizeof(batch[0]), - sign->UseSecureDeviceId, sign->BitmapId) == false) - { - // Failure - if (batch[0].OutputX != 0) - { - FreeX(batch[0].OutputX); - } - ret = false; - } - else - { - // Success - ret = true; - sign->ClientCert = batch[0].OutputX; - Copy(sign->Signature, batch[1].OutputSign, MIN(sizeof(sign->Signature),sizeof(batch[1].OutputSign))); - } - } - - FreeBuf(random); - - return ret; -} -#endif // OS_WIN32 - -// Disconnect -bool CtDisconnect(CLIENT *c, RPC_CLIENT_CONNECT *connect, bool inner) -{ - bool ret = false; - ACCOUNT t, *r; - SESSION *s = NULL; - // Validate arguments - if (c == NULL || connect == NULL) - { - return false; - } - - LockList(c->AccountList); - { - // Search for account - t.ClientOption = ZeroMalloc(sizeof(CLIENT_OPTION)); - UniStrCpy(t.ClientOption->AccountName, sizeof(t.ClientOption->AccountName), connect->AccountName); - - r = Search(c->AccountList, &t); - if (r == NULL) - { - // Specified account isn't found - UnlockList(c->AccountList); - - Free(t.ClientOption); - CiSetError(c, ERR_ACCOUNT_NOT_FOUND); - return false; - } - - Free(t.ClientOption); - - Lock(r->lock); - { - if (r->ClientSession == NULL) - { - // Not connected - CiSetError(c, ERR_ACCOUNT_INACTIVE); - } - else - { - s = r->ClientSession; - AddRef(s->ref); - // Disconnect complete - r->ClientSession = NULL; - ret = true; - } - } - Unlock(r->lock); - } - UnlockList(c->AccountList); - - if (s != NULL) - { - // Disconnect the connection (Wait until the disconnection is complete) - CLog(c, "LC_DISCONNECT", connect->AccountName); - StopSession(s); - ReleaseSession(s); - } - - - if (ret != false) - { - CiNotify(c); - } - - return ret; -} - -// Connect -bool CtConnect(CLIENT *c, RPC_CLIENT_CONNECT *connect) -{ - bool ret = false; - RPC_CLIENT_ENUM_VLAN t; - // Validate arguments - if (c == NULL || connect == NULL) - { - return false; - } - - Lock(c->lockForConnect); - { - Zero(&t, sizeof(t)); - if (CtEnumVLan(c, &t)) - { - if (t.NumItem == 0) - { - // There are no virtual LAN cards in the system - if (OS_IS_WINDOWS_NT(GetOsInfo()->OsType) || OS_IS_UNIX(GetOsInfo()->OsType)) - { - // Only in Linux system or Windows NT system, - // create a new virtual LAN card which named as "VPN" automatically - RPC_CLIENT_CREATE_VLAN t; - - Zero(&t, sizeof(t)); - StrCpy(t.DeviceName, sizeof(t.DeviceName), "VPN"); - CtCreateVLan(c, &t); - } - } - - CiFreeClientEnumVLan(&t); - } - } - Unlock(c->lockForConnect); - - CiNormalizeAccountVLan(c); - - // Ensure successfully VPN communication by changing the irrational WCM settings in the case of Windows 8 or later - CiDisableWcmNetworkMinimize(c); - - LockList(c->AccountList); - { - ACCOUNT t, *r; - bool unix_disabled = false; - - // Search for account - t.ClientOption = ZeroMalloc(sizeof(CLIENT_OPTION)); - UniStrCpy(t.ClientOption->AccountName, sizeof(t.ClientOption->AccountName), connect->AccountName); - - r = Search(c->AccountList, &t); - if (r == NULL) - { - // Specified account isn't found - UnlockList(c->AccountList); - - Free(t.ClientOption); - CiSetError(c, ERR_ACCOUNT_NOT_FOUND); - return false; - } - - Free(t.ClientOption); - -#ifndef OS_WIN32 - // Search for the virtual LAN card - LockList(c->UnixVLanList); - { - UNIX_VLAN *v, t; - - Zero(&t, sizeof(t)); - StrCpy(t.Name, sizeof(t.Name), r->ClientOption->DeviceName); - - v = Search(c->UnixVLanList, &t); - if (v == NULL) - { - UnlockList(c->UnixVLanList); - CiSetError(c, ERR_OBJECT_NOT_FOUND); - return false; - } - - unix_disabled = v->Enabled ? false : true; - } - UnlockList(c->UnixVLanList); -#endif // OS_WIN32 - - Lock(r->lock); - { - bool already_used = false; - UINT i; - - if (r->ClientSession != NULL) - { - // Already in connecting - CiSetError(c, ERR_ACCOUNT_ACTIVE); - } - else if (r->ClientAuth->AuthType == CLIENT_AUTHTYPE_SECURE && - c->UseSecureDeviceId == 0) - { - // Secure device is not specified - CiSetError(c, ERR_NO_SECURE_DEVICE_SPECIFIED); - } -#ifdef OS_WIN32 - else if (MsIsVLanExists(VLAN_ADAPTER_NAME_TAG, r->ClientOption->DeviceName) == false && - MsIsVLanExists(VLAN_ADAPTER_NAME_TAG_OLD, r->ClientOption->DeviceName) == false) - { - // Virtual LAN card can not be found - CiSetError(c, ERR_VLAN_FOR_ACCOUNT_NOT_FOUND); - CiNotify(c); - CiSendGlobalPulse(c); - } - else if (MsIsVLanEnabled(r->ClientOption->DeviceName) == false) - { - // The virtual LAN card is disabled - CiSetError(c, ERR_VLAN_FOR_ACCOUNT_DISABLED); - CiNotify(c); - CiSendGlobalPulse(c); - } -#else // OS_WIN32 - else if (unix_disabled) - { - // The virtual LAN card is disabled - CiSetError(c, ERR_VLAN_FOR_ACCOUNT_DISABLED); - CiNotify(c); - CiSendGlobalPulse(c); - } -#endif // OS_WIN32 - else - { - // Check whether the virtual LAN card is being used by a different account already - for (i = 0;i < LIST_NUM(c->AccountList);i++) - { - ACCOUNT *a = LIST_DATA(c->AccountList, i); - if (a != r) - { - if (StrCmpi(a->ClientOption->DeviceName, - r->ClientOption->DeviceName) == 0) - { - if (a->ClientSession != NULL) - { - already_used = true; - break; - } - } - } - } - - if (already_used) - { - CiSetError(c, ERR_VLAN_FOR_ACCOUNT_USED); - } - else - { - // Start the connection - PACKET_ADAPTER *pa = VLanGetPacketAdapter(); - - if (r->ClientAuth->AuthType == CLIENT_AUTHTYPE_SECURE) - { - // Register a procedure for secure device authentication - r->ClientAuth->SecureSignProc = CiSecureSignProc; - } - else if (r->ClientAuth->AuthType == CLIENT_AUTHTYPE_OPENSSLENGINE) - { - /* r->ClientAuth->ClientK = OpensslEngineToK("asdf"); */ - r->ClientAuth->SecureSignProc = NULL; - } - else - { - r->ClientAuth->SecureSignProc = NULL; - } - - if (r->CheckServerCert) - { - // Register a procedure to validate the server certificate - r->ClientAuth->CheckCertProc = CiCheckCertProc; - } - else - { - r->ClientAuth->CheckCertProc = NULL; - } - - r->StatusPrinter = CiClientStatusPrinter; - r->LastConnectDateTime = SystemTime64(); - - CLog(c, "LC_CONNECT", connect->AccountName); - - r->ClientSession = NewClientSessionEx(c->Cedar, r->ClientOption, r->ClientAuth, pa, r); - Notify(r->ClientSession, CLIENT_NOTIFY_ACCOUNT_CHANGED); - - ret = true; - } - } - } - Unlock(r->lock); - - } - UnlockList(c->AccountList); - - CiSaveConfigurationFile(c); - - return ret; -} - -// Put all unused TUN interfaces down -// Requires account and VLan lists of the CLIENT argument to be already locked -bool CtVLansDown(CLIENT *c) -{ -#ifndef UNIX_LINUX - return true; -#else - int i; - LIST *tmpVLanList; - UNIX_VLAN t, *r; - bool result = true; - - if (c == NULL) - { - return false; - } - - tmpVLanList = CloneList(c->UnixVLanList); - if (tmpVLanList == NULL) - { - return false; - } - - // Remove from tmpVLanList all VLans corresponding to active sessions - for (i = 0; i < LIST_NUM(c->AccountList); ++i) - { - ACCOUNT *a = LIST_DATA(c->AccountList, i); - if (a->ClientSession == NULL) - { - continue; - } - - Zero(&t, sizeof(t)); - StrCpy(t.Name, sizeof(t.Name), a->ClientOption->DeviceName); - r = Search(tmpVLanList, &t); - Delete(tmpVLanList, r); - } - - // Set down every VLan in tmpVLanList - for (i = 0; i < LIST_NUM(tmpVLanList) && result; ++i) - { - r = LIST_DATA(tmpVLanList, i); - result = UnixVLanSetState(r->Name, false); - // [MP:] Should we report *critical* error on failure? - } - - ReleaseList(tmpVLanList); - return result; -#endif -} - -// Put all TUN interfaces up -// Requires VLan list of the CLIENT argument to be already locked -bool CtVLansUp(CLIENT *c) -{ -#ifndef UNIX_LINUX - return true; -#else - int i; - UNIX_VLAN *r; - - if (c == NULL) - { - return false; - } - - for (i = 0; i < LIST_NUM(c->UnixVLanList); ++i) - { - r = LIST_DATA(c->UnixVLanList, i); - UnixVLanSetState(r->Name, true); - } - - return true; -#endif -} - -// Get the account information -bool CtGetAccount(CLIENT *c, RPC_CLIENT_GET_ACCOUNT *a) -{ - // Validate arguments - if (c == NULL || a == NULL) - { - return false; - } - - LockList(c->AccountList); - { - ACCOUNT t, *r; - - // Search for account - t.ClientOption = ZeroMalloc(sizeof(CLIENT_OPTION)); - UniStrCpy(t.ClientOption->AccountName, sizeof(t.ClientOption->AccountName), a->AccountName); - - r = Search(c->AccountList, &t); - if (r == NULL) - { - // Specified account can not be found - UnlockList(c->AccountList); - - Free(t.ClientOption); - CiSetError(c, ERR_ACCOUNT_NOT_FOUND); - return false; - } - - Free(t.ClientOption); - - Lock(r->lock); - { - // Copy the client option - if (a->ClientOption != NULL) - { - Free(a->ClientOption); - } - a->ClientOption = ZeroMalloc(sizeof(CLIENT_OPTION)); - Copy(a->ClientOption, r->ClientOption, sizeof(CLIENT_OPTION)); - - // Copy the authentication data - if (a->ClientAuth != NULL) - { - CiFreeClientAuth(a->ClientAuth); - } - a->ClientAuth = CopyClientAuth(r->ClientAuth); - - a->StartupAccount = r->StartupAccount; - - a->CheckServerCert = r->CheckServerCert; - a->RetryOnServerCert = r->RetryOnServerCert; - a->ServerCert = NULL; - if (r->ServerCert != NULL) - { - a->ServerCert = CloneX(r->ServerCert); - } - - // Shortcut Key - Copy(a->ShortcutKey, r->ShortcutKey, SHA1_SIZE); - - a->CreateDateTime = r->CreateDateTime; - a->LastConnectDateTime = r->LastConnectDateTime; - a->UpdateDateTime = r->UpdateDateTime; - } - Unlock(r->lock); - - } - UnlockList(c->AccountList); - - return true; -} - -// Change the account name -bool CtRenameAccount(CLIENT *c, RPC_RENAME_ACCOUNT *rename, bool inner) -{ - bool ret; - // Validate arguments - if (c == NULL || rename == NULL) - { - return false; - } - - - ret = false; - - if (UniStrCmp(rename->NewName, rename->OldName) == 0) - { - // The name has not been changed - return true; - } - - LockList(c->AccountList); - { - ACCOUNT t, *r, *r2; - - if (UniStrLen(rename->NewName) == 0) - { - // Name is invalid - CiSetError(c, ERR_INVALID_VALUE); - UnlockList(c->AccountList); - return false; - } - - // Search for old account name - t.ClientOption = ZeroMalloc(sizeof(CLIENT_OPTION)); - UniStrCpy(t.ClientOption->AccountName, sizeof(t.ClientOption->AccountName), rename->OldName); - - r = Search(c->AccountList, &t); - if (r == NULL) - { - // Specified account can not be found - UnlockList(c->AccountList); - - Free(t.ClientOption); - CiSetError(c, ERR_ACCOUNT_NOT_FOUND); - return false; - } - - Free(t.ClientOption); - - // Search for a new account name - t.ClientOption = ZeroMalloc(sizeof(CLIENT_OPTION)); - UniStrCpy(t.ClientOption->AccountName, sizeof(t.ClientOption->AccountName), rename->NewName); - - r2 = Search(c->AccountList, &t); - if (r2 != NULL) - { - // Account with the specified name already exists - UnlockList(c->AccountList); - - Free(t.ClientOption); - CiSetError(c, ERR_ACCOUNT_ALREADY_EXISTS); - return false; - } - - Free(t.ClientOption); - - Lock(r->lock); - { - // Check the operating state of the account - if (r->ClientSession != NULL) - { - // The Account is working - Unlock(r->lock); - UnlockList(c->AccountList); - CiSetError(c, ERR_ACCOUNT_ACTIVE); - - return false; - } - - // Update the account name - UniStrCpy(r->ClientOption->AccountName, sizeof(r->ClientOption->AccountName), - rename->NewName); - - CLog(c, "LC_RENAME_ACCOUNT", rename->OldName, rename->NewName); - - ret = true; - } - Unlock(r->lock); - - Sort(c->AccountList); - - } - UnlockList(c->AccountList); - - CiSaveConfigurationFile(c); - - CiNotify(c); - - return ret; -} - -// Set the client configuration -bool CtSetClientConfig(CLIENT *c, CLIENT_CONFIG *o) -{ - KEEP *k; - // Validate arguments - if (c == NULL || o == NULL) - { - return false; - } - - if (o->UseKeepConnect) - { - if (IsEmptyStr(o->KeepConnectHost) || - o->KeepConnectPort == 0 || - o->KeepConnectPort >= 65536) - { - CiSetError(c, ERR_INVALID_PARAMETER); - return false; - } - } - - Lock(c->lock); - { - Copy(&c->Config, o, sizeof(CLIENT_CONFIG)); - } - Unlock(c->lock); - - // Save the settings - CiSaveConfigurationFile(c); - - // Apply the Keep Connect - k = c->Keep; - Lock(k->lock); - { - if (o->UseKeepConnect) - { - StrCpy(k->ServerName, sizeof(k->ServerName), c->Config.KeepConnectHost); - k->ServerPort = c->Config.KeepConnectPort; - k->Interval = c->Config.KeepConnectInterval * 1000; - k->UdpMode = (c->Config.KeepConnectProtocol == CONNECTION_UDP) ? true : false; - k->Enable = true; - } - else - { - k->Enable = false; - } - } - Unlock(k->lock); - - // Apply TAP state - LockList(c->AccountList); - LockList(c->UnixVLanList); - - CtVLansDown(c); - - UnlockList(c->UnixVLanList); - UnlockList(c->AccountList); - - return true; -} - -// Get the network client configuration -bool CtGetClientConfig(CLIENT *c, CLIENT_CONFIG *o) -{ - // Validate arguments - if (c == NULL || o == NULL) - { - return false; - } - - Lock(c->lock); - { - Copy(o, &c->Config, sizeof(CLIENT_CONFIG)); - } - Unlock(c->lock); - - return true; -} - -// Unset the startup attribute of the account -bool CtRemoveStartupAccount(CLIENT *c, RPC_CLIENT_DELETE_ACCOUNT *a) -{ - bool ret; - // Validate arguments - if (c == NULL || a == NULL) - { - return false; - } - - ret = false; - - LockList(c->AccountList); - { - ACCOUNT t, *r; - // Search for an Account - - t.ClientOption = ZeroMalloc(sizeof(CLIENT_OPTION)); - UniStrCpy(t.ClientOption->AccountName, sizeof(t.ClientOption->AccountName), a->AccountName); - - r = Search(c->AccountList, &t); - if (r == NULL) - { - // Specified account can not be found - UnlockList(c->AccountList); - - Free(t.ClientOption); - CiSetError(c, ERR_ACCOUNT_NOT_FOUND); - return false; - } - - Free(t.ClientOption); - - Lock(r->lock); - { - // Unset the startup account - ret = true; - r->StartupAccount = false; - } - Unlock(r->lock); - } - UnlockList(c->AccountList); - - if (ret) - { - CiSaveConfigurationFile(c); - CiNotify(c); - } - - return ret; -} - -// Set the account as a start-up account -bool CtSetStartupAccount(CLIENT *c, RPC_CLIENT_DELETE_ACCOUNT *a, bool inner) -{ - bool ret; - // Validate arguments - if (c == NULL || a == NULL) - { - return false; - } - - - ret = false; - - LockList(c->AccountList); - { - ACCOUNT t, *r; - // Search for an account - - t.ClientOption = ZeroMalloc(sizeof(CLIENT_OPTION)); - UniStrCpy(t.ClientOption->AccountName, sizeof(t.ClientOption->AccountName), a->AccountName); - - r = Search(c->AccountList, &t); - if (r == NULL) - { - // Specified account can not be found - UnlockList(c->AccountList); - - Free(t.ClientOption); - CiSetError(c, ERR_ACCOUNT_NOT_FOUND); - return false; - } - - Free(t.ClientOption); - - Lock(r->lock); - { - // Set to a start-up account - ret = true; - r->StartupAccount = true; - } - Unlock(r->lock); - } - UnlockList(c->AccountList); - - if (ret) - { - CiSaveConfigurationFile(c); - CiNotify(c); - } - - return ret; -} - -// Delete the account -bool CtDeleteAccount(CLIENT *c, RPC_CLIENT_DELETE_ACCOUNT *a, bool inner) -{ - bool ret; - // Validate arguments - if (c == NULL || a == NULL) - { - return false; - } - - ret = false; - - if (c->Halt) - { - // Don't allow the removal of the account in the process of stopping - CiSetError(c, ERR_INTERNAL_ERROR); - return false; - } - - LockList(c->AccountList); - { - ACCOUNT t, *r; - // Search for an Account - - t.ClientOption = ZeroMalloc(sizeof(CLIENT_OPTION)); - UniStrCpy(t.ClientOption->AccountName, sizeof(t.ClientOption->AccountName), a->AccountName); - - r = Search(c->AccountList, &t); - if (r == NULL) - { - // Specified account can not be found - UnlockList(c->AccountList); - - Free(t.ClientOption); - CiSetError(c, ERR_ACCOUNT_NOT_FOUND); - return false; - } - - Free(t.ClientOption); - - Lock(r->lock); - { - // Check the operating state of the account - if (r->ClientSession != NULL) - { - // The account is active - Unlock(r->lock); - UnlockList(c->AccountList); - CiSetError(c, ERR_ACCOUNT_ACTIVE); - - return false; - } - - // Remove this account from the list - Delete(c->AccountList, r); - } - Unlock(r->lock); - - // Free the memory of this account - CiFreeAccount(r); - - CLog(c, "LC_DELETE_ACCOUNT", a->AccountName); - ret = true; - - } - UnlockList(c->AccountList); - - if (ret) - { - CiSaveConfigurationFile(c); - CiNotify(c); - } - - return ret; -} - -// Enumeration of accounts -bool CtEnumAccount(CLIENT *c, RPC_CLIENT_ENUM_ACCOUNT *e) -{ - // Validate arguments - if (c == NULL || e == NULL) - { - return false; - } - - LockList(c->AccountList); - { - UINT i; - // Number of accounts - e->NumItem = LIST_NUM(c->AccountList); - e->Items = ZeroMalloc(sizeof(RPC_CLIENT_ENUM_ACCOUNT_ITEM *) * e->NumItem); - - for (i = 0;i < e->NumItem;i++) - { - ACCOUNT *a = LIST_DATA(c->AccountList, i); - RPC_CLIENT_ENUM_ACCOUNT_ITEM *item = ZeroMalloc(sizeof(RPC_CLIENT_ENUM_ACCOUNT_ITEM)); - e->Items[i] = item; - - // Account name - UniStrCpy(item->AccountName, sizeof(item->AccountName), a->ClientOption->AccountName); - - // User name - StrCpy(item->UserName, sizeof(item->UserName), a->ClientAuth->Username); - - // Server name - StrCpy(item->ServerName, sizeof(item->ServerName), a->ClientOption->Hostname); - - // Proxy type - item->ProxyType = a->ClientOption->ProxyType; - - // Device name - StrCpy(item->DeviceName, sizeof(item->DeviceName), a->ClientOption->DeviceName); - - // Proxy information - if (item->ProxyType != PROXY_DIRECT) - { - StrCpy(item->ProxyName, sizeof(item->ProxyName), a->ClientOption->ProxyName); - } - - // Startup - item->StartupAccount = a->StartupAccount; - - // Active flag - item->Active = (a->ClientSession == NULL ? false : true); - - // Connection flag - item->Connected = (item->Active == false) ? false : a->ClientSession->ConnectSucceed; - - // Port number - item->Port = a->ClientOption->Port; - - // Virtual HUB name - StrCpy(item->HubName, sizeof(item->HubName), a->ClientOption->HubName); - - item->CreateDateTime = a->CreateDateTime; - item->LastConnectDateTime = a->LastConnectDateTime; - item->UpdateDateTime = a->UpdateDateTime; - } - } - UnlockList(c->AccountList); - - return true; -} - -// Configure the account -bool CtSetAccount(CLIENT *c, RPC_CLIENT_CREATE_ACCOUNT *a, bool inner) -{ - // Validate arguments - if (c == NULL || a == NULL) - { - return false; - } - - - // Check whether an account already exists - LockList(c->AccountList); - { - ACCOUNT t, *ret; - t.ClientOption = ZeroMalloc(sizeof(CLIENT_OPTION)); - UniStrCpy(t.ClientOption->AccountName, sizeof(t.ClientOption->AccountName), - a->ClientOption->AccountName); - - ret = Search(c->AccountList, &t); - if (ret == NULL) - { - // Not exist - UnlockList(c->AccountList); - Free(t.ClientOption); - - CiSetError(c, ERR_ACCOUNT_NOT_FOUND); - - return false; - } - Free(t.ClientOption); - - if (a->ClientAuth->AuthType == CLIENT_AUTHTYPE_CERT) - { - if (a->ClientAuth->ClientX == NULL || - a->ClientAuth->ClientX->is_compatible_bit == false || - a->ClientAuth->ClientK == NULL) - { - // Client certificate is invalid - UnlockList(c->AccountList); - CiSetError(c, ERR_NOT_RSA_1024); - return false; - } - } - - if (a->ServerCert != NULL && a->ServerCert->is_compatible_bit == false) - { - // Server certificate is invalid - UnlockList(c->AccountList); - CiSetError(c, ERR_NOT_RSA_1024); - return false; - } - - Lock(ret->lock); - { - -#if 0 - // Rewriting of the configuration is done even account running in the current version - // (New setting isn't applied until connecting next time) - if (ret->ClientSession != NULL) - { - // The account is operating - Unlock(ret->lock); - UnlockList(c->AccountList); - - CiSetError(c, ERR_ACCOUNT_ACTIVE); - - return false; - } -#endif - - // Delete the client authentication data - CiFreeClientAuth(ret->ClientAuth); - - // Copy the client authentication data - ret->ClientAuth = CopyClientAuth(a->ClientAuth); - - // Delete the client option - Free(ret->ClientOption); - - // Copy the client option - ret->ClientOption = ZeroMalloc(sizeof(CLIENT_OPTION)); - Copy(ret->ClientOption, a->ClientOption, sizeof(CLIENT_OPTION)); - - ret->StartupAccount = a->StartupAccount; - - ret->CheckServerCert = a->CheckServerCert; - ret->RetryOnServerCert = a->RetryOnServerCert; - - if (a->ServerCert != NULL) - { - if (ret->ServerCert != NULL) - { - FreeX(ret->ServerCert); - } - ret->ServerCert = CloneX(a->ServerCert); - } - else - { - if (ret->ServerCert != NULL) - { - FreeX(ret->ServerCert); - } - ret->ServerCert = false; - } - - ret->UpdateDateTime = SystemTime64(); - } - Unlock(ret->lock); - } - UnlockList(c->AccountList); - - CiSaveConfigurationFile(c); - - CiNotify(c); - - return true; -} - -// Create an account -bool CtCreateAccount(CLIENT *c, RPC_CLIENT_CREATE_ACCOUNT *a, bool inner) -{ - // Validate arguments - if (c == NULL || a == NULL) - { - return false; - } - - - // Check whether an account already exists - LockList(c->AccountList); - { - ACCOUNT t, *ret, *new_account; - t.ClientOption = ZeroMalloc(sizeof(CLIENT_OPTION)); - UniStrCpy(t.ClientOption->AccountName, sizeof(t.ClientOption->AccountName), - a->ClientOption->AccountName); - - ret = Search(c->AccountList, &t); - if (ret != NULL) - { - // Already exist - UnlockList(c->AccountList); - Free(t.ClientOption); - - CiSetError(c, ERR_ACCOUNT_ALREADY_EXISTS); - - return false; - } - - Free(t.ClientOption); - - if (UniStrLen(a->ClientOption->AccountName) == 0) - { - // The name is invalid - UnlockList(c->AccountList); - CiSetError(c, ERR_INVALID_VALUE); - return false; - } - - if (a->ClientAuth->AuthType == CLIENT_AUTHTYPE_CERT) - { - if (a->ClientAuth->ClientX == NULL || - a->ClientAuth->ClientX->is_compatible_bit == false || - a->ClientAuth->ClientK == NULL) - { - // The client certificate is invalid - UnlockList(c->AccountList); - CiSetError(c, ERR_NOT_RSA_1024); - return false; - } - } - - if (a->ServerCert != NULL && a->ServerCert->is_compatible_bit == false) - { - // The server certificate is invalid - UnlockList(c->AccountList); - CiSetError(c, ERR_NOT_RSA_1024); - return false; - } - - // Add a new account - new_account = ZeroMalloc(sizeof(ACCOUNT)); - new_account->lock = NewLock(); - - // Copy the client authentication data - new_account->ClientAuth = CopyClientAuth(a->ClientAuth); - - // Copy the client option - new_account->ClientOption = ZeroMalloc(sizeof(CLIENT_OPTION)); - Copy(new_account->ClientOption, a->ClientOption, sizeof(CLIENT_OPTION)); - - new_account->StartupAccount = a->StartupAccount; - - new_account->CheckServerCert = a->CheckServerCert; - new_account->RetryOnServerCert = a->RetryOnServerCert; - if (a->ServerCert != NULL) - { - new_account->ServerCert = CloneX(a->ServerCert); - } - - // Shortcut Key - if (IsZero(a->ShortcutKey, SHA1_SIZE)) - { - Rand(new_account->ShortcutKey, SHA1_SIZE); - } - else - { - Copy(new_account->ShortcutKey, a->ShortcutKey, SHA1_SIZE); - } - - new_account->CreateDateTime = new_account->UpdateDateTime = SystemTime64(); - - // Insert into the list - Insert(c->AccountList, new_account); - - CLog(c, "LC_NEW_ACCOUNT", a->ClientOption->AccountName); - } - UnlockList(c->AccountList); - - CiNormalizeAccountVLan(c); - - CiSaveConfigurationFile(c); - - CiNotify(c); - - return true; -} - -// Release the account acquisition structure -void CiFreeClientGetAccount(RPC_CLIENT_GET_ACCOUNT *a) -{ - // Validate arguments - if (a == NULL) - { - return; - } - - // Release the account information - if (a->ServerCert != NULL) - { - FreeX(a->ServerCert); - } - CiFreeClientAuth(a->ClientAuth); - Free(a->ClientOption); -} - -// Release the account creation structure -void CiFreeClientCreateAccount(RPC_CLIENT_CREATE_ACCOUNT *a) -{ - // Validate arguments - if (a == NULL) - { - return; - } - - // Release the account information - if (a->ServerCert != NULL) - { - FreeX(a->ServerCert); - } - CiFreeClientAuth(a->ClientAuth); - Free(a->ClientOption); -} - -// Stop the virtual LAN card -bool CtDisableVLan(CLIENT *c, RPC_CLIENT_CREATE_VLAN *vlan) -{ - UINT i; - bool used; - // Validate arguments - if (c == NULL || vlan == NULL) - { - return false; - } - -#ifndef OS_WIN32 - -#ifdef NO_VLAN - if (GetOsInfo()->OsType == OSTYPE_MACOS_X) - { - // Can not be added or removed the virtual LAN card in MacOS X - CiSetError(c, ERR_NOT_SUPPORTED); - return false; - } -#endif // NO_VLAN - - // Check whether the virtual LAN card with the specified name is not - // being used by one or more accounts - used = false; - LockList(c->AccountList); - { - for (i = 0;i < LIST_NUM(c->AccountList);i++) - { - ACCOUNT *a = LIST_DATA(c->AccountList, i); - if (StrCmpi(a->ClientOption->DeviceName, vlan->DeviceName) == 0) - { - Lock(a->lock); - { - if (a->ClientSession != NULL) - { - used = true; - } - } - Unlock(a->lock); - } - } - } - UnlockList(c->AccountList); - - // Search for the virtual LAN card - LockList(c->UnixVLanList); - { - UNIX_VLAN *v, t; - - Zero(&t, sizeof(t)); - StrCpy(t.Name, sizeof(t.Name), vlan->DeviceName); - - v = Search(c->UnixVLanList, &t); - if (v == NULL) - { - UnlockList(c->UnixVLanList); - CiSetError(c, ERR_OBJECT_NOT_FOUND); - return false; - } - - // Stop - v->Enabled = false; - } - UnlockList(c->UnixVLanList); - - CiSaveConfigurationFile(c); - CiNotify(c); - CiSendGlobalPulse(c); - - return true; - -#else // OS_WIN32 - - // Check whether the virtual LAN card with the specified name is not - // being used by one or more accounts - used = false; - LockList(c->AccountList); - { - for (i = 0;i < LIST_NUM(c->AccountList);i++) - { - ACCOUNT *a = LIST_DATA(c->AccountList, i); - if (StrCmpi(a->ClientOption->DeviceName, vlan->DeviceName) == 0) - { - Lock(a->lock); - { - if (a->ClientSession != NULL) - { - used = true; - } - } - Unlock(a->lock); - } - } - } - UnlockList(c->AccountList); - -#if 0 - if (used) - { - // In using - CiSetError(c, ERR_VLAN_IS_USED); - return false; - } -#endif - - - // Check whether the virtual LAN card are present - if (MsIsVLanExists(VLAN_ADAPTER_NAME_TAG, vlan->DeviceName) == false && - MsIsVLanExists(VLAN_ADAPTER_NAME_TAG_OLD, vlan->DeviceName) == false) - { - CiSetError(c, ERR_OBJECT_NOT_FOUND); - CiNotify(c); - CiSendGlobalPulse(c); - return false; - } - - - if (MsIs64BitWindows() && Is32() && MsIsAdmin()) - { - // Execute the driver_installer to process since this Windows is 64 bit - // but this code is 32 bit - char tmp[MAX_SIZE]; - - Format(tmp, sizeof(tmp), "disablevlan %s", vlan->DeviceName); - - if (MsExecDriverInstaller(tmp) == false) - { - CiSetError(c, ERR_VLAN_INSTALL_ERROR); - CiNotify(c); - CiSendGlobalPulse(c); - return false; - } - } - else - { - // Stop the virtual LAN card - if (MsDisableVLan(vlan->DeviceName) == false) - { - CiSetError(c, ERR_VLAN_INSTALL_ERROR); - CiNotify(c); - CiSendGlobalPulse(c); - return false; - } - } - - CiNotify(c); - CiSendGlobalPulse(c); - - return true; - -#endif // OS_WIN32 - -} - -// Start the virtual LAN card -bool CtEnableVLan(CLIENT *c, RPC_CLIENT_CREATE_VLAN *vlan) -{ - // Validate arguments - if (c == NULL || vlan == NULL) - { - return false; - } - -#ifndef OS_WIN32 - -#ifdef NO_VLAN - if (GetOsInfo()->OsType == OSTYPE_MACOS_X) - { - // Can not be added or removed the virtual LAN card in MacOS X - CiSetError(c, ERR_NOT_SUPPORTED); - return false; - } -#endif // NO_VLAN - - // Search the virtual LAN card - LockList(c->UnixVLanList); - { - UNIX_VLAN *v, t; - - Zero(&t, sizeof(t)); - StrCpy(t.Name, sizeof(t.Name), vlan->DeviceName); - - v = Search(c->UnixVLanList, &t); - if (v == NULL) - { - UnlockList(c->UnixVLanList); - CiSetError(c, ERR_OBJECT_NOT_FOUND); - return false; - } - - // Enable - v->Enabled = true; - } - UnlockList(c->UnixVLanList); - - CiSaveConfigurationFile(c); - CiNotify(c); - CiSendGlobalPulse(c); - - return true; - -#else // OS_WIN32 - - // Check whether the virtual LAN card are present - if (MsIsVLanExists(VLAN_ADAPTER_NAME_TAG, vlan->DeviceName) == false && - MsIsVLanExists(VLAN_ADAPTER_NAME_TAG_OLD, vlan->DeviceName) == false) - { - CiSetError(c, ERR_OBJECT_NOT_FOUND); - CiNotify(c); - CiSendGlobalPulse(c); - return false; - } - - if (MsIs64BitWindows() && Is32() && MsIsAdmin()) - { - // Execute the driver_installer to process since this Windows is 64 bit - // but this code is 32 bit - char tmp[MAX_SIZE]; - - Format(tmp, sizeof(tmp), "enablevlan %s", vlan->DeviceName); - - if (MsExecDriverInstaller(tmp) == false) - { - CiSetError(c, ERR_VLAN_INSTALL_ERROR); - CiNotify(c); - CiSendGlobalPulse(c); - return false; - } - } - else - { - // Start the virtual LAN card - if (MsEnableVLan(vlan->DeviceName) == false) - { - CiSetError(c, ERR_VLAN_INSTALL_ERROR); - CiNotify(c); - CiSendGlobalPulse(c); - return false; - } - } - - CiNotify(c); - CiSendGlobalPulse(c); - - return true; - -#endif // OS_WIN32 - -} - -// Delete the virtual LAN card -bool CtDeleteVLan(CLIENT *c, RPC_CLIENT_CREATE_VLAN *d) -{ - UINT i; - bool used; - // Validate arguments - if (c == NULL || d == NULL) - { - return false; - } - -#ifndef OS_WIN32 - -#ifdef NO_VLAN - if (GetOsInfo()->OsType == OSTYPE_MACOS_X) - { - // Can not be added or removed the virtual LAN card in MacOS X - CiSetError(c, ERR_NOT_SUPPORTED); - return false; - } -#endif // NO_VLAN - - // Check whether the virtual LAN card with the specified name is not - // being used by one or more accounts - used = false; - LockList(c->AccountList); - { - for (i = 0;i < LIST_NUM(c->AccountList);i++) - { - ACCOUNT *a = LIST_DATA(c->AccountList, i); - if (StrCmpi(a->ClientOption->DeviceName, d->DeviceName) == 0) - { - used = true; - } - } - } - UnlockList(c->AccountList); - -#if 0 - if (used) - { - // In using - CiSetError(c, ERR_VLAN_IS_USED); - return false; - } -#endif - - // Search for the virtual LAN card - LockList(c->UnixVLanList); - { - UNIX_VLAN *v, t; - - Zero(&t, sizeof(t)); - StrCpy(t.Name, sizeof(t.Name), d->DeviceName); - - v = Search(c->UnixVLanList, &t); - if (v == NULL) - { - UnlockList(c->UnixVLanList); - CiSetError(c, ERR_OBJECT_NOT_FOUND); - return false; - } - - // Remove - if (Delete(c->UnixVLanList, v)) - { - Free(v); - } - - CLog(c, "LC_DELETE_VLAN", d->DeviceName); - - UnixVLanDelete(d->DeviceName); - } - UnlockList(c->UnixVLanList); - - CiNormalizeAccountVLan(c); - - CiSaveConfigurationFile(c); - CiNotify(c); - CiSendGlobalPulse(c); - - return true; - -#else // OS_WIN32 - - if (MsIsNt() == false) - { - // Not available in Win9x - CiSetError(c, ERR_NOT_SUPPORTED); - return false; - } - - // Check whether the virtual LAN card are present - if (MsIsVLanExists(VLAN_ADAPTER_NAME_TAG, d->DeviceName) == false && - MsIsVLanExists(VLAN_ADAPTER_NAME_TAG_OLD, d->DeviceName) == false) - { - CiSetError(c, ERR_OBJECT_NOT_FOUND); - return false; - } - - // Check whether the virtual LAN card with the specified name is not - // being used by one or more accounts - used = false; - LockList(c->AccountList); - { - for (i = 0;i < LIST_NUM(c->AccountList);i++) - { - ACCOUNT *a = LIST_DATA(c->AccountList, i); - if (StrCmpi(a->ClientOption->DeviceName, d->DeviceName) == 0) - { - used = true; - } - } - } - UnlockList(c->AccountList); - -#if 0 - if (used) - { - // In using - CiSetError(c, ERR_VLAN_IS_USED); - return false; - } -#endif - - if (MsIs64BitWindows() && Is32() && MsIsAdmin()) - { - // Execute the driver_installer to process since this Windows is 64 bit - // but this code is 32 bit - char tmp[MAX_SIZE]; - - Format(tmp, sizeof(tmp), "uninstvlan %s", d->DeviceName); - - if (MsExecDriverInstaller(tmp) == false) - { - CiSetError(c, ERR_VLAN_INSTALL_ERROR); - return false; - } - } - else - { - // Delete the virtual LAN card directly - if (MsUninstallVLan(d->DeviceName) == false) - { - CiSetError(c, ERR_VLAN_INSTALL_ERROR); - CiNotify(c); - CiSendGlobalPulse(c); - return false; - } - } - - CLog(c, "LC_DELETE_VLAN", d->DeviceName); - - CiNormalizeAccountVLan(c); - - CiNotify(c); - CiSendGlobalPulse(c); - - return true; - -#endif // OS_WIN32 - -} - -// Get the name of the first VLAN -char *CiGetFirstVLan(CLIENT *c) -{ - char *ret = NULL; - RPC_CLIENT_ENUM_VLAN t; - // Validate arguments - if (c == NULL) - { - return NULL; - } - - Zero(&t, sizeof(t)); - if (CtEnumVLan(c, &t) == false) - { - return NULL; - } - - if (t.NumItem >= 1) - { - UINT i; - char *tmp = t.Items[0]->DeviceName; - - for (i = 0;i < t.NumItem;i++) - { - if (t.Items[i]->Enabled) - { - tmp = t.Items[i]->DeviceName; - } - } - - ret = CopyStr(tmp); - } - - CiFreeClientEnumVLan(&t); - - return ret; -} - -// Enumerate virtual LAN cards -bool CtEnumVLan(CLIENT *c, RPC_CLIENT_ENUM_VLAN *e) -{ - UINT i; - TOKEN_LIST *t; - // Validate arguments - if (c == NULL || e == NULL) - { - return false; - } - -#ifndef OS_WIN32 - - LockList(c->UnixVLanList); - { - e->NumItem = LIST_NUM(c->UnixVLanList); - e->Items = ZeroMalloc(sizeof(RPC_CLIENT_ENUM_VLAN_ITEM *) * e->NumItem); - - for (i = 0;i < e->NumItem;i++) - { - RPC_CLIENT_ENUM_VLAN_ITEM *item; - UNIX_VLAN *v; - - v = LIST_DATA(c->UnixVLanList, i); - e->Items[i] = ZeroMalloc(sizeof(RPC_CLIENT_ENUM_VLAN_ITEM)); - item = e->Items[i]; - - item->Enabled = v->Enabled; - BinToStr(item->MacAddress, sizeof(item->MacAddress), v->MacAddress, 6); - StrCpy(item->DeviceName, sizeof(item->DeviceName), v->Name); - StrCpy(item->Version, sizeof(item->Version), c->Cedar->VerString); - } - } - UnlockList(c->UnixVLanList); - - return true; - -#else // OS_WIN32 - - // Enumeration - t = MsEnumNetworkAdapters(VLAN_ADAPTER_NAME, VLAN_ADAPTER_NAME_OLD); - if (t == NULL) - { - // Enumeration failure - e->NumItem = 0; - e->Items = ZeroMalloc(0); - } - else - { - // Enumeration success - e->NumItem = t->NumTokens; - e->Items = ZeroMalloc(sizeof(RPC_CLIENT_ENUM_VLAN_ITEM *) * e->NumItem); - - for (i = 0;i < e->NumItem;i++) - { - char *tmp; - RPC_CLIENT_ENUM_VLAN_ITEM *item; - e->Items[i] = ZeroMalloc(sizeof(RPC_CLIENT_ENUM_VLAN_ITEM)); - item = e->Items[i]; - - StrCpy(item->DeviceName, sizeof(item->DeviceName), t->Token[i]); - item->Enabled = MsIsVLanEnabled(item->DeviceName); - - tmp = MsGetMacAddress(VLAN_ADAPTER_NAME_TAG, item->DeviceName); - if (tmp == NULL) - { - tmp = MsGetMacAddress(VLAN_ADAPTER_NAME_TAG_OLD, item->DeviceName); - } - - StrCpy(item->MacAddress, sizeof(item->MacAddress), tmp); - Free(tmp); - - tmp = MsGetDriverVersion(VLAN_ADAPTER_NAME_TAG, item->DeviceName); - if (tmp == NULL) - { - tmp = MsGetDriverVersion(VLAN_ADAPTER_NAME_TAG_OLD, item->DeviceName); - } - - StrCpy(item->Version, sizeof(item->Version), tmp); - Free(tmp); - } - - FreeToken(t); - } - - return true; - -#endif // OS_WIN32 -} - -// Release the virtual LAN card enumeration -void CiFreeClientEnumVLan(RPC_CLIENT_ENUM_VLAN *e) -{ - UINT i; - // Validate arguments - if (e == NULL) - { - return; - } - - for (i = 0;i < e->NumItem;i++) - { - Free(e->Items[i]); - } - Free(e->Items); -} - -// Set the information about the virtual LAN card -bool CtSetVLan(CLIENT *c, RPC_CLIENT_SET_VLAN *set) -{ - // Validate arguments - if (c == NULL || set == NULL) - { - return false; - } - -#ifndef OS_WIN32 - - LockList(c->UnixVLanList); - { - UNIX_VLAN t, *r; - Zero(&t, sizeof(t)); - StrCpy(t.Name, sizeof(t.Name), set->DeviceName); - - r = Search(c->UnixVLanList, &t); - if (r == NULL) - { - // Not exist - CiSetError(c, ERR_VLAN_ALREADY_EXISTS); - UnlockList(c->UnixVLanList); - return false; - } - - StrToMac(r->MacAddress, set->MacAddress); - } - UnlockList(c->UnixVLanList); - - CiSaveConfigurationFile(c); - CiNotify(c); - CiSendGlobalPulse(c); - - return true; - -#else // OS_WIN32 - - // Check whether the virtual LAN card with the specified name already exists - if (MsIsVLanExists(VLAN_ADAPTER_NAME_TAG, set->DeviceName) == false && - MsIsVLanExists(VLAN_ADAPTER_NAME_TAG_OLD, set->DeviceName) == false) - { - // Not exist - CiSetError(c, ERR_OBJECT_NOT_FOUND); - return false; - } - - // Configuring MAC address - MsSetMacAddress(VLAN_ADAPTER_NAME_TAG, set->DeviceName, set->MacAddress); - MsSetMacAddress(VLAN_ADAPTER_NAME_TAG_OLD, set->DeviceName, set->MacAddress); - - CiNotify(c); - CiSendGlobalPulse(c); - - return true; - -#endif // OS_WIN32 -} - -// Get the information about the virtual LAN card -bool CtGetVLan(CLIENT *c, RPC_CLIENT_GET_VLAN *get) -{ - char *tmp; - // Validate arguments - if (c == NULL || get == NULL) - { - return false; - } - -#ifndef OS_WIN32 - - // Unsupported - CiSetError(c, ERR_NOT_SUPPORTED); - return false; - -#else // OS_WIN32 - - // Check whether the virtual LAN card with the specified name already exists - if (MsIsVLanExists(VLAN_ADAPTER_NAME_TAG, get->DeviceName) == false && - MsIsVLanExists(VLAN_ADAPTER_NAME_TAG_OLD, get->DeviceName) == false) - { - // Not exist - CiSetError(c, ERR_OBJECT_NOT_FOUND); - return false; - } - - // Activity - get->Enabled = MsIsVLanEnabled(get->DeviceName); - - // MAC address - tmp = MsGetMacAddress(VLAN_ADAPTER_NAME_TAG, get->DeviceName); - if (tmp == NULL) - { - tmp = MsGetMacAddress(VLAN_ADAPTER_NAME_TAG_OLD, get->DeviceName); - } - StrCpy(get->MacAddress, sizeof(get->MacAddress), tmp); - Free(tmp); - - // Version - tmp = MsGetDriverVersion(VLAN_ADAPTER_NAME_TAG, get->DeviceName); - if (tmp == NULL) - { - tmp = MsGetDriverVersion(VLAN_ADAPTER_NAME_TAG_OLD, get->DeviceName); - } - StrCpy(get->Version, sizeof(get->Version), tmp); - Free(tmp); - - // File name - tmp = MsGetDriverFileName(VLAN_ADAPTER_NAME_TAG, get->DeviceName); - if (tmp == NULL) - { - tmp = MsGetDriverFileName(VLAN_ADAPTER_NAME_TAG_OLD, get->DeviceName); - } - StrCpy(get->FileName, sizeof(get->FileName), tmp); - Free(tmp); - - // GUID - tmp = MsGetNetworkAdapterGuid(VLAN_ADAPTER_NAME_TAG, get->DeviceName); - if (tmp == NULL) - { - tmp = MsGetNetworkAdapterGuid(VLAN_ADAPTER_NAME_TAG_OLD, get->DeviceName); - } - StrCpy(get->Guid, sizeof(get->Guid), tmp); - Free(tmp); - - return true; - -#endif // OS_WIN32 -} - -#ifdef OS_WIN32 -// Initialize the driver version information structure -void CiInitDriverVerStruct(MS_DRIVER_VER *ver) -{ - // Validate arguments - if (ver == NULL) - { - return; - } - - Zero(ver, sizeof(MS_DRIVER_VER)); - - ver->Year = BUILD_DATE_Y; - ver->Month = BUILD_DATE_M; - ver->Day = BUILD_DATE_D; - ver->Major = CEDAR_VERSION_MAJOR; - ver->Minor = CEDAR_VERSION_MINOR; - ver->Build = CEDAR_VERSION_BUILD; -} -#endif // OS_WIN32 - -// Upgrade the virtual LAN card -bool CtUpgradeVLan(CLIENT *c, RPC_CLIENT_CREATE_VLAN *create) -{ - bool use_old_name = false; - -#ifdef OS_WIN32 - KAKUSHI *k = NULL; - MS_DRIVER_VER ver; -#endif // OS_WIN32 - - // Validate arguments - if (c == NULL || create == NULL) - { - return false; - } - - -#ifndef OS_WIN32 - - // Always succeed - return true; - -#else // OS_WIN32 - - CiInitDriverVerStruct(&ver); - - if (MsIsNt() == false) - { - // Not available in Win9x - CiSetError(c, ERR_NOT_SUPPORTED); - return false; - } - - // Check whether the LAN card with the specified name already exists - if (MsIsVLanExists(VLAN_ADAPTER_NAME_TAG, create->DeviceName) == false && - MsIsVLanExists(VLAN_ADAPTER_NAME_TAG_OLD, create->DeviceName) == false) - { - // Not exist - CiSetError(c, ERR_OBJECT_NOT_FOUND); - CiNotify(c); - CiSendGlobalPulse(c); - return false; - } - - if (MsIsVLanExists(VLAN_ADAPTER_NAME_TAG_OLD, create->DeviceName)) - { - use_old_name = true; - } - - if (MsIsVista() == false) - { - k = InitKakushi(); - } - - - if (MsIsVista() == false) - { - // Perform the installation (other than Windows Vista) - if (MsUpgradeVLan(use_old_name ? VLAN_ADAPTER_NAME_TAG_OLD : VLAN_ADAPTER_NAME_TAG, - use_old_name ? VLAN_CONNECTION_NAME_OLD : VLAN_CONNECTION_NAME, - create->DeviceName, &ver) == false) - { - // Installation Failed - FreeKakushi(k); - CiSetError(c, ERR_VLAN_INSTALL_ERROR); - CiNotify(c); - CiSendGlobalPulse(c); - return false; - } - } - else - { - // Perform the installation (Windows Vista) - char tmp[MAX_SIZE]; - - Format(tmp, sizeof(tmp), "upgradevlan %s", create->DeviceName); - - if (CncExecDriverInstaller(tmp) == false) - { - // Installation Failed - FreeKakushi(k); - CiSetError(c, ERR_VLAN_INSTALL_ERROR); - CiNotify(c); - CiSendGlobalPulse(c); - return false; - } - } - - FreeKakushi(k); - - CLog(c, "LC_UPDATE_VLAN", create->DeviceName); - - CiNotify(c); - CiSendGlobalPulse(c); - - return true; - -#endif // OS_WIN32 -} - -// Create a virtual LAN card -bool CtCreateVLan(CLIENT *c, RPC_CLIENT_CREATE_VLAN *create) -{ - TOKEN_LIST *t; - UINT max_len; - -#ifdef OS_WIN32 - KAKUSHI *k = NULL; -#endif // OS_WIN32 - - // Validate arguments - if (c == NULL || create == NULL) - { - return false; - } - - if (SearchStrEx(create->DeviceName, " ", 0, false) != INFINITE) - { - // Spaces in the name is not allowed - CiSetError(c, ERR_INVALID_PARAMETER); - return false; - } - -#ifndef OS_WIN32 - - // Non-Win32 -#ifdef NO_VLAN - if (GetOsInfo()->OsType == OSTYPE_MACOS_X) - { - // A virtual LAN card can not be added or removed in MacOS X - CiSetError(c, ERR_NOT_SUPPORTED); - return false; - } -#endif // NO_VLAN - - // Check whether the specified name is valid or not - if (IsSafeStr(create->DeviceName) == false) - { - // Name is invalid - CiSetError(c, ERR_VLAN_INVALID_NAME); - return false; - } - - // Check whether the LAN card of the specified name already exists - LockList(c->UnixVLanList); - { - UNIX_VLAN t, *r; - Zero(&t, sizeof(t)); - StrCpy(t.Name, sizeof(t.Name), create->DeviceName); - - r = Search(c->UnixVLanList, &t); - if (r != NULL) - { - // Already exist - CiSetError(c, ERR_VLAN_ALREADY_EXISTS); - UnlockList(c->UnixVLanList); - return false; - } - - // Register - r = ZeroMalloc(sizeof(UNIX_VLAN)); - r->Enabled = true; - GenMacAddress(r->MacAddress); - StrCpy(r->Name, sizeof(r->Name), create->DeviceName); - - // Create a TUN - if (UnixVLanCreate(r->Name, r->MacAddress, false) == false) - { - // Failure - Free(r); - CiSetError(c, ERR_VLAN_INSTALL_ERROR); - UnlockList(c->UnixVLanList); - return false; - } - - CLog(c, "LC_CREATE_VLAN", create->DeviceName); - - Add(c->UnixVLanList, r); - } - UnlockList(c->UnixVLanList); - - CiNormalizeAccountVLan(c); - - CiNotify(c); - CiSendGlobalPulse(c); - CiSaveConfigurationFile(c); - - return true; - -#else // OS_WIN32 - - if (OS_IS_WINDOWS_9X(GetOsInfo()->OsType)) - { - // Only one LAN card is available in the Win9x - TOKEN_LIST *t; - - t = MsEnumNetworkAdapters(VLAN_ADAPTER_NAME, VLAN_ADAPTER_NAME_OLD); - if (t != NULL) - { - if (t->NumTokens >= 1) - { - FreeToken(t); - CiSetError(c, ERR_NOT_SUPPORTED); - return false; - } - FreeToken(t); - } - } - - // Check whether the specified name is valid or not - if (IsSafeStr(create->DeviceName) == false) - { - // Name is invalid - CiSetError(c, ERR_VLAN_INVALID_NAME); - return false; - } - - max_len = MsIsNt() ? MAX_DEVICE_NAME_LEN : MAX_DEVICE_NAME_LEN_9X; - if (StrLen(create->DeviceName) > max_len) - { - // Name is too long - CiSetError(c, ERR_VLAN_INVALID_NAME); - return false; - } - - // Regulation in Windows 8 / 10 - if (MsIsInfCatalogRequired()) - { - if (CiIsValidVLanRegulatedName(create->DeviceName) == false) - { - // Name is invalid - CiSetError(c, ERR_VLAN_INVALID_NAME); - return false; - } - } - - // Check whether the LAN card with the specified name already exists - if (MsIsVLanExists(VLAN_ADAPTER_NAME_TAG, create->DeviceName) || - MsIsVLanExists(VLAN_ADAPTER_NAME_TAG_OLD, create->DeviceName)) - { - // Already exist - CiSetError(c, ERR_VLAN_ALREADY_EXISTS); - return false; - } - - if (MsIsNt()) - { - if (MsIsVista() == false) - { - k = InitKakushi(); - } - } - - if (MsIsVista() == false) - { - MS_DRIVER_VER ver; - - CiInitDriverVerStruct(&ver); - - // Perform the installation (other than Windows Vista) - if (MsInstallVLan(VLAN_ADAPTER_NAME_TAG, VLAN_CONNECTION_NAME, create->DeviceName, &ver) == false) - { - // Installation Failed - FreeKakushi(k); - CiSetError(c, ERR_VLAN_INSTALL_ERROR); - CiNotify(c); - CiSendGlobalPulse(c); - return false; - } - } - else - { - // Perform the installation (Windows Vista) - char tmp[MAX_SIZE]; - - Format(tmp, sizeof(tmp), "instvlan %s", create->DeviceName); - - if (CncExecDriverInstaller(tmp) == false) - { - // Installation Failed - FreeKakushi(k); - CiSetError(c, ERR_VLAN_INSTALL_ERROR); - CiNotify(c); - CiSendGlobalPulse(c); - return false; - } - } - - FreeKakushi(k); - - t = MsEnumNetworkAdapters(VLAN_ADAPTER_NAME, VLAN_ADAPTER_NAME_OLD); - if (t->NumTokens == 1) - { - UINT i; - // If the result of the installation, virtual LAN card is only one, - // set virtual LAN card setting of all existing accounts to this virtual LAN card - LockList(c->AccountList); - { - for (i = 0;i < LIST_NUM(c->AccountList);i++) - { - ACCOUNT *a = LIST_DATA(c->AccountList, i); - Lock(a->lock); - { - if (a->ClientOption != NULL) - { - StrCpy(a->ClientOption->DeviceName, sizeof(a->ClientOption->DeviceName), create->DeviceName); - } - } - Unlock(a->lock); - } - } - UnlockList(c->AccountList); - } - FreeToken(t); - - CLog(c, "LC_CREATE_VLAN", create->DeviceName); - - CiNormalizeAccountVLan(c); - - CiNotify(c); - CiSendGlobalPulse(c); - - CiSaveConfigurationFile(c); - - if (MsIsNt() == false) - { - if (GetOsInfo()->OsType == OSTYPE_WINDOWS_ME) - { - // Show the warning in the case of Windows Me - MsgBox(NULL, 0x00000040L, _UU("CM_9X_VLAN_ME_MESSAGE")); - } - - ReleaseThread(NewThread(Win9xRebootThread, NULL)); - } - - return true; - -#endif // OS_WIN32 -} - -// Enumerate objects in the secure device -bool CtEnumObjectInSecure(CLIENT *c, RPC_ENUM_OBJECT_IN_SECURE *e) -{ - UINT i; - // Validate arguments - if (c == NULL || e == NULL) - { - return false; - } - - e->NumItem = 5; - e->ItemName = ZeroMalloc(sizeof(char *) * e->NumItem); - e->ItemType = ZeroMalloc(sizeof(bool) * e->NumItem); - - for (i = 0;i < e->NumItem;i++) - { - char tmp[MAX_SIZE]; - Format(tmp, sizeof(tmp), "Test Object %u", i); - e->ItemName[i] = CopyStr(tmp); - e->ItemType[i] = (i % 2 == 0) ? false : true; - } - - return true; -} - -// Get the secure device to be used -bool CtGetUseSecure(CLIENT *c, RPC_USE_SECURE *sec) -{ - // Validate arguments - if (c == NULL || sec == NULL) - { - return false; - } - - sec->DeviceId = c->UseSecureDeviceId; - - return true; -} - -// Specifying a secure device to be used -bool CtUseSecure(CLIENT *c, RPC_USE_SECURE *sec) -{ - // Validate arguments - if (c == NULL || sec == NULL) - { - return false; - } - -// Do not check whether there is the specified device on the client manager -/* if (CheckSecureDeviceId(sec->DeviceId)) - { - c->UseSecureDeviceId = sec->DeviceId; - } - else - { - CiSetError(c, ERR_OBJECT_NOT_FOUND); - return false; - } -*/ - c->UseSecureDeviceId = sec->DeviceId; - - CiSaveConfigurationFile(c); - - return true; -} - -// Enumeration of secure devices -bool CtEnumSecure(CLIENT *c, RPC_CLIENT_ENUM_SECURE *e) -{ - LIST *o; - UINT i; - // Validate arguments - if (c == NULL || e == NULL) - { - return false; - } - - o = GetSecureDeviceList(); - - e->NumItem = LIST_NUM(o); - e->Items = ZeroMalloc(sizeof(RPC_CLIENT_ENUM_SECURE_ITEM *) * e->NumItem); - - for (i = 0;i < LIST_NUM(o);i++) - { - RPC_CLIENT_ENUM_SECURE_ITEM *item = ZeroMalloc(sizeof(RPC_CLIENT_ENUM_SECURE_ITEM)); - SECURE_DEVICE *s = LIST_DATA(o, i); - - item->DeviceId = s->Id; - StrCpy(item->DeviceName, sizeof(item->DeviceName), s->DeviceName); - StrCpy(item->Manufacturer, sizeof(item->Manufacturer), s->Manufacturer); - item->Type = s->Type; - - e->Items[i] = item; - } - - return true; -} - -// Release the secure device enumeration -void CiFreeClientEnumSecure(RPC_CLIENT_ENUM_SECURE *e) -{ - UINT i; - // Validate arguments - if (e == NULL) - { - return; - } - - for (i = 0;i < e->NumItem;i++) - { - Free(e->Items[i]); - } - Free(e->Items); -} - -// Release the RPC_GET_ISSUER -void CiFreeGetIssuer(RPC_GET_ISSUER *a) -{ - // Validate arguments - if (a == NULL) - { - return; - } - - if (a->issuer_x != NULL) - { - FreeX(a->issuer_x); - } - if (a->x != NULL) - { - FreeX(a->x); - } -} - -// Get the common proxy settings -bool CtGetCommonProxySetting(CLIENT *c, INTERNET_SETTING *a) -{ - // Validate arguments - if (c == NULL || a == NULL) - { - return false; - } - - Copy(a, &c->CommonProxySetting, sizeof(INTERNET_SETTING)); - - return true; -} - -// Set the common proxy settings -bool CtSetCommonProxySetting(CLIENT *c, INTERNET_SETTING *a) -{ - // Validate arguments - if (c == NULL || a == NULL) - { - return false; - } - - Copy(&c->CommonProxySetting, a, sizeof(INTERNET_SETTING)); - - - CiSaveConfigurationFile(c); - - return true; -} - -// Get the issuer -bool CtGetIssuer(CLIENT *c, RPC_GET_ISSUER *a) -{ - X *x; - // Validate arguments - if (c == NULL || a == NULL) - { - return false; - } - - x = FindCaSignedX(c->Cedar->CaList, a->x); - if (x == NULL) - { - CiSetError(c, ERR_OBJECT_NOT_FOUND);; - return false; - } - else - { - a->issuer_x = x; - if (a->x != NULL) - { - FreeX(a->x); - a->x = NULL; - } - return true; - } -} - -// Get the CA certificate -bool CtGetCa(CLIENT *c, RPC_GET_CA *get) -{ - bool ret = true; - X *cert = NULL; - // Validate arguments - if (c == NULL || get == NULL) - { - return false; - } - - LockList(c->Cedar->CaList); - { - UINT i; - - for (i = 0;i < LIST_NUM(c->Cedar->CaList);i++) - { - X *x = LIST_DATA(c->Cedar->CaList, i); - - if (POINTER_TO_KEY(x) == get->Key) - { - cert = CloneX(x); - break; - } - } - } - UnlockList(c->Cedar->CaList); - - if (cert == NULL) - { - // Certificate does not exist - ret = false; - CiSetError(c, ERR_OBJECT_NOT_FOUND); - } - else - { - ret = true; - get->x = cert; - } - - return ret; -} - -// Delete the CA certificate -bool CtDeleteCa(CLIENT *c, RPC_CLIENT_DELETE_CA *p) -{ - bool ret; - // Validate arguments - if (c == NULL || p == NULL) - { - return false; - } - - ret = DeleteCa(c->Cedar, p->Key); - - if (ret == false) - { - CiSetError(c, ERR_OBJECT_NOT_FOUND); - } - - CiSaveConfigurationFile(c); - - return ret; -} - -// Add a CA certificate -bool CtAddCa(CLIENT *c, RPC_CERT *cert) -{ - // Validate arguments - if (c == NULL || cert == NULL) - { - return false; - } - - if (cert->x->is_compatible_bit == false) - { - CiSetError(c, ERR_NOT_RSA_1024); - return false; - } - - AddCa(c->Cedar, cert->x); - - CiSaveConfigurationFile(c); - - return true; -} - -// Enumerate the trusted CA -bool CtEnumCa(CLIENT *c, RPC_CLIENT_ENUM_CA *e) -{ - // Validate arguments - if (c == NULL || e == NULL) - { - return false; - } - - Zero(e, sizeof(RPC_CLIENT_ENUM_CA)); - - LockList(c->Cedar->CaList); - { - UINT i; - e->NumItem = LIST_NUM(c->Cedar->CaList); - e->Items = ZeroMalloc(sizeof(RPC_CLIENT_ENUM_CA_ITEM *) * e->NumItem); - - for (i = 0;i < e->NumItem;i++) - { - X *x = LIST_DATA(c->Cedar->CaList, i); - e->Items[i] = ZeroMalloc(sizeof(RPC_CLIENT_ENUM_CA_ITEM)); - GetAllNameFromNameEx(e->Items[i]->SubjectName, sizeof(e->Items[i]->SubjectName), x->subject_name); - GetAllNameFromNameEx(e->Items[i]->IssuerName, sizeof(e->Items[i]->IssuerName), x->issuer_name); - e->Items[i]->Expires = x->notAfter; - e->Items[i]->Key = POINTER_TO_KEY(x); - } - } - UnlockList(c->Cedar->CaList); - - return true; -} - -// Release the CA enumeration -void CiFreeClientEnumCa(RPC_CLIENT_ENUM_CA *e) -{ - UINT i; - // Validate arguments - if (e == NULL) - { - return; - } - - for (i = 0;i < e->NumItem;i++) - { - RPC_CLIENT_ENUM_CA_ITEM *ca = e->Items[i]; - Free(ca); - } - Free(e->Items); -} - -// Get the password setting -bool CtGetPasswordSetting(CLIENT *c, RPC_CLIENT_PASSWORD_SETTING *a) -{ - UCHAR hash[SHA1_SIZE]; - // Validate arguments - if (c == NULL || a == NULL) - { - return false; - } - - Sha0(hash, "", 0); - if (Cmp(hash, c->EncryptedPassword, SHA1_SIZE) == 0) - { - a->IsPasswordPresented = false; - } - else - { - a->IsPasswordPresented = true; - } - - a->PasswordRemoteOnly = c->PasswordRemoteOnly; - - return true; -} - -// Set the password -bool CtSetPassword(CLIENT *c, RPC_CLIENT_PASSWORD *pass) -{ - char *str; - if (c == NULL) - { - return false; - } - - str = pass->Password; - - if (StrCmp(str, "********") != 0) - { - // Hash the password - Sha0(c->EncryptedPassword, str, StrLen(str)); - } - - c->PasswordRemoteOnly = pass->PasswordRemoteOnly; - - CLog(c, "LC_SET_PASSWORD"); - - CiSaveConfigurationFile(c); - - return true; -} - -void CiFreeIni(LIST *o) -{ - // Validate arguments - if (o == NULL) - { - return; - } - - FreeIni(o); -} - -// Read the custom.ini file -LIST *CiLoadIni() -{ - BUF *b = ReadDump(CLIENT_CUSTOM_INI_FILENAME); - LIST *ini; - if (b == NULL) - { - return NULL; - } - - ini = ReadIni(b); - - FreeBuf(b); - - return ini; - -} - -// Reflect the settings of the custom.ini -void CiLoadIniSettings(CLIENT *c) -{ - LIST *o; - //char *log; - //char *config; - - if (c == NULL) - { - return; - } - - o = CiLoadIni(); - - if (o == NULL) - { - return; - } - - /*log = IniStrValue(o, "NoSaveLog"); - config = IniStrValue(o, "NoSaveConfig"); - - if(StrCmpi(log, "true") == 0) - { - c->NoSaveLog = true; - } - if(StrCmpi(config, "true") == 0) - { - c->NoSaveConfig = true; - }*/ - - c->NoSaveLog = ToBool(IniStrValue(o, "NoSaveLog")); - c->NoSaveConfig = ToBool(IniStrValue(o, "NoSaveConfig")); - - CiFreeIni(o); - -} - -bool CiLoadConfigFilePathFromIni(char *path, UINT size) -{ - char *tmp; - LIST *o; - bool ret = false; - - // Validate arguments - if (path == NULL) - { - return false; - } - - o = CiLoadIni(); - - if (o == NULL) - { - return false; - } - - StrCpy(path, size, ""); - - tmp = IniStrValue(o, "ConfigPath"); - NormalizePath(path, size, tmp); - - if (IsEmptyStr(path) == false) - { - ret = true; - } - else - { - ret = false; - } - - CiFreeIni(o); - - return ret; -} - -// Set the client error code -void CiSetError(CLIENT *c, UINT err) -{ - // Validate arguments - if (c == NULL) - { - return; - } - - c->Err = err; -} - -// UNIX virtual LAN card comparison function -int CiCompareUnixVLan(void *p1, void *p2) -{ - UNIX_VLAN *v1, *v2; - if (p1 == NULL || p2 == NULL) - { - return 0; - } - v1 = *(UNIX_VLAN **)p1; - v2 = *(UNIX_VLAN **)p2; - if (v1 == NULL || v2 == NULL) - { - return 0; - } - - return StrCmpi(v1->Name, v2->Name); -} - -// Modify the account settings that an incorrect VLAN name is specified -void CiNormalizeAccountVLan(CLIENT *c) -{ - bool b = false; - char *name; - UINT i; - // Validate arguments - if (c == NULL) - { - return; - } - - name = CiGetFirstVLan(c); - - if (name != NULL) - { - LockList(c->AccountList); - { - for (i = 0;i < LIST_NUM(c->AccountList);i++) - { - ACCOUNT *a = LIST_DATA(c->AccountList, i); - - Lock(a->lock); - { - if (a->ClientOption != NULL) - { - if (CiIsVLan(c, a->ClientOption->DeviceName) == false) - { - StrCpy(a->ClientOption->DeviceName, sizeof(a->ClientOption->DeviceName), - name); - b = true; - } - } - } - Unlock(a->lock); - } - } - UnlockList(c->AccountList); - - Free(name); - } - - if (b) - { - CiNotify(c); - CiSendGlobalPulse(c); - CiSaveConfigurationFile(c); - } -} - -// Check whether a virtual LAN card of the specified name exists -bool CiIsVLan(CLIENT *c, char *name) -{ - // Validate arguments - if (c == NULL || name == NULL) - { - return false; - } - -#ifdef OS_WIN32 - { - TOKEN_LIST *t; - UINT i; - - t = MsEnumNetworkAdapters(VLAN_ADAPTER_NAME, VLAN_ADAPTER_NAME_OLD); - if (t == NULL) - { - return false; - } - - for (i = 0;i < t->NumTokens;i++) - { - if (StrCmpi(t->Token[i], name) == 0) - { - FreeToken(t); - return true; - } - } - - FreeToken(t); - - return false; - } -#else // OS_WIN32 - { - UNIX_VLAN *v; - UINT i; - bool ret = false; - - LockList(c->UnixVLanList); - { - for (i = 0;i < LIST_NUM(c->UnixVLanList);i++) - { - v = (UNIX_VLAN *)LIST_DATA(c->UnixVLanList, i); - if (StrCmpi(v->Name, name) == 0) - { - ret = true; - } - } - } - UnlockList(c->UnixVLanList); - - return ret; - } -#endif // OS_WIN32 -} - -// If a non-existent virtual LAN card is specified in any Account, and only -// one virtual LAN card is installed, set the virtual LAN card to the account -void CiSetVLanToDefault(CLIENT *c) -{ - char device_name[MAX_SIZE]; - // Validate arguments - if (c == NULL) - { - return; - } - -#ifdef OS_WIN32 - { - TOKEN_LIST *t; - - t = MsEnumNetworkAdapters(VLAN_ADAPTER_NAME, VLAN_ADAPTER_NAME_OLD); - if (t == NULL) - { - return; - } - if (t->NumTokens != 1) - { - FreeToken(t); - return; - } - StrCpy(device_name, sizeof(device_name), t->Token[0]); - FreeToken(t); - } -#else // OS_WIN32 - { - UNIX_VLAN *v; - - LockList(c->UnixVLanList); - - if (LIST_NUM(c->UnixVLanList) != 1) - { - UnlockList(c->UnixVLanList); - return; - } - v = LIST_DATA(c->UnixVLanList, 0); - StrCpy(device_name, sizeof(device_name), v->Name); - - UnlockList(c->UnixVLanList); - } -#endif // OS_WIN32 - - { - UINT i; - LockList(c->AccountList); - { - for (i = 0;i < LIST_NUM(c->AccountList);i++) - { - ACCOUNT *a = LIST_DATA(c->AccountList, i); - - Lock(a->lock); - { - if (CiIsVLan(c, a->ClientOption->DeviceName) == false) - { - StrCpy(a->ClientOption->DeviceName, sizeof(a->ClientOption->DeviceName), - device_name); - } - } - Unlock(a->lock); - } - } - UnlockList(c->AccountList); - } -} - -// Initialize the settings -void CiInitConfiguration(CLIENT *c) -{ - // Validate arguments - if (c == NULL) - { - return; - } - -#ifdef OS_UNIX - // Initialize the VLAN - UnixVLanInit(); -#endif // OS_UNIX - - // Account list - c->AccountList = NewList(CiCompareAccount); - - // Unix version VLAN list - if (OS_IS_UNIX(GetOsInfo()->OsType)) - { - c->UnixVLanList = NewList(CiCompareUnixVLan); - } - - // Read the configuration file - CLog(c, "LC_LOAD_CONFIG_1"); - if (CiLoadConfigurationFile(c) == false) - { - CLog(c, "LC_LOAD_CONFIG_3"); - // Do the initial setup because the configuration file does not exist - // Clear the password - Sha0(c->EncryptedPassword, "", 0); - // Initialize the client configuration - // Disable remote management - c->Config.AllowRemoteConfig = false; - StrCpy(c->Config.KeepConnectHost, sizeof(c->Config.KeepConnectHost), CLIENT_DEFAULT_KEEPALIVE_HOST); - c->Config.KeepConnectPort = CLIENT_DEFAULT_KEEPALIVE_PORT; - c->Config.KeepConnectProtocol = CONNECTION_UDP; - c->Config.KeepConnectInterval = CLIENT_DEFAULT_KEEPALIVE_INTERVAL; - c->Config.UseKeepConnect = false; // Don't use the connection maintenance function by default in the Client - // Eraser - c->Eraser = NewEraser(c->Logger, 0); - } - else - { - CLog(c, "LC_LOAD_CONFIG_2"); - } - - // Appropriate setting for virtual LAN card - CiSetVLanToDefault(c); -} - -// Release the settings -void CiFreeConfiguration(CLIENT *c) -{ - UINT i; - // Validate arguments - if (c == NULL) - { - return; - } - - // Write to the configuration file - CiSaveConfigurationFile(c); - - // Release the configuration file - FreeCfgRw(c->CfgRw); - - // Release the account list - for (i = 0;i < LIST_NUM(c->AccountList);i++) - { - ACCOUNT *a = LIST_DATA(c->AccountList, i); - - CiFreeAccount(a); - } - ReleaseList(c->AccountList); - - if (c->UnixVLanList != NULL) - { - // Release of UNIX version VLAN list - for (i = 0;i < LIST_NUM(c->UnixVLanList);i++) - { - UNIX_VLAN *v = LIST_DATA(c->UnixVLanList, i); - Free(v); - } - ReleaseList(c->UnixVLanList); - } - c->UnixVLanList = NULL; - -#ifdef OS_UNIX - // Release the VLAN - UnixVLanFree(); -#endif // OS_UNIX -} - -// Release the certificate data acquisition -void CiFreeGetCa(RPC_GET_CA *a) -{ - // Validate arguments - if (a == NULL) - { - return; - } - - FreeX(a->x); -} - -// Release the client authentication data -void CiFreeClientAuth(CLIENT_AUTH *auth) -{ - // Validate arguments - if (auth == NULL) - { - return; - } - - if (auth->ClientX != NULL) - { - FreeX(auth->ClientX); - } - if (auth->ClientK != NULL) - { - FreeK(auth->ClientK); - } - - Free(auth); -} - -// Release the account -void CiFreeAccount(ACCOUNT *a) -{ - // Validate arguments - if (a == NULL) - { - return; - } - - // Release the lock - DeleteLock(a->lock); - - // Release the client option - Free(a->ClientOption); - - // Release the client authentication data - CiFreeClientAuth(a->ClientAuth); - - if (a->ServerCert != NULL) - { - FreeX(a->ServerCert); - } - - Free(a); -} - -// Sort accounts -int CiCompareAccount(void *p1, void *p2) -{ - ACCOUNT *a1, *a2; - if (p1 == NULL || p2 == NULL) - { - return 0; - } - a1 = *(ACCOUNT **)p1; - a2 = *(ACCOUNT **)p2; - if (a1 == NULL || a2 == NULL) - { - return 0; - } - - return UniStrCmpi(a1->ClientOption->AccountName, a2->ClientOption->AccountName); -} - -// Read the client configuration -void CiLoadClientConfig(CLIENT_CONFIG *c, FOLDER *f) -{ - // Validate arguments - if (c == NULL || f == NULL) - { - return; - } - - c->UseKeepConnect = CfgGetBool(f, "UseKeepConnect"); - CfgGetStr(f, "KeepConnectHost", c->KeepConnectHost, sizeof(c->KeepConnectHost)); - c->KeepConnectPort = CfgGetInt(f, "KeepConnectPort"); - c->KeepConnectProtocol = CfgGetInt(f, "KeepConnectProtocol"); - c->AllowRemoteConfig = CfgGetBool(f, "AllowRemoteConfig"); - c->KeepConnectInterval = MAKESURE(CfgGetInt(f, "KeepConnectInterval"), KEEP_INTERVAL_MIN, KEEP_INTERVAL_MAX); - c->NoChangeWcmNetworkSettingOnWindows8 = CfgGetBool(f, "NoChangeWcmNetworkSettingOnWindows8"); -} - -// Read the client authentication data -CLIENT_AUTH *CiLoadClientAuth(FOLDER *f) -{ - CLIENT_AUTH *a; - char *s; - BUF *b; - // Validate arguments - if (f == NULL) - { - return NULL; - } - - a = ZeroMalloc(sizeof(CLIENT_AUTH)); - - a->AuthType = CfgGetInt(f, "AuthType"); - CfgGetStr(f, "Username", a->Username, sizeof(a->Username)); - - switch (a->AuthType) - { - case CLIENT_AUTHTYPE_ANONYMOUS: - break; - - case CLIENT_AUTHTYPE_PASSWORD: - CfgGetByte(f, "HashedPassword", a->HashedPassword, SHA1_SIZE); - break; - - case CLIENT_AUTHTYPE_PLAIN_PASSWORD: - b = CfgGetBuf(f, "EncryptedPassword"); - if (b != NULL) - { - s = DecryptPassword(b); - StrCpy(a->PlainPassword, sizeof(a->PlainPassword), s); - Free(s); - FreeBuf(b); - } - break; - - case CLIENT_AUTHTYPE_CERT: - b = CfgGetBuf(f, "ClientCert"); - if (b != NULL) - { - a->ClientX = BufToX(b, false); - } - FreeBuf(b); - b = CfgGetBuf(f, "ClientKey"); - if (b != NULL) - { - a->ClientK = BufToK(b, true, false, NULL); - } - FreeBuf(b); - break; - - case CLIENT_AUTHTYPE_SECURE: - CfgGetStr(f, "SecurePublicCertName", a->SecurePublicCertName, sizeof(a->SecurePublicCertName)); - CfgGetStr(f, "SecurePrivateKeyName", a->SecurePrivateKeyName, sizeof(a->SecurePrivateKeyName)); - break; - - case CLIENT_AUTHTYPE_OPENSSLENGINE: - b = CfgGetBuf(f, "ClientCert"); - if (b != NULL) - { - a->ClientX = BufToX(b, false); - } - FreeBuf(b); - if (CfgGetStr(f, "OpensslEnginePrivateKeyName", a->OpensslEnginePrivateKeyName, sizeof(a->OpensslEnginePrivateKeyName))) - { - a->ClientK = OpensslEngineToK(a->OpensslEnginePrivateKeyName, a->OpensslEngineName); - } - CfgGetStr(f, "OpensslEngineName", a->OpensslEngineName, sizeof(a->OpensslEngineName)); - break; - } - - return a; -} - -// Read the client option -CLIENT_OPTION *CiLoadClientOption(FOLDER *f) -{ - CLIENT_OPTION *o; - char *s; - BUF *b; - // Validate arguments - if (f == NULL) - { - return NULL; - } - - o = ZeroMalloc(sizeof(CLIENT_OPTION)); - - CfgGetUniStr(f, "AccountName", o->AccountName, sizeof(o->AccountName)); - CfgGetStr(f, "Hostname", o->Hostname, sizeof(o->Hostname)); - o->Port = CfgGetInt(f, "Port"); - o->PortUDP = CfgGetInt(f, "PortUDP"); - o->ProxyType = CfgGetInt(f, "ProxyType"); - CfgGetStr(f, "ProxyName", o->ProxyName, sizeof(o->ProxyName)); - o->ProxyPort = CfgGetInt(f, "ProxyPort"); - CfgGetStr(f, "ProxyUsername", o->ProxyUsername, sizeof(o->ProxyUsername)); - b = CfgGetBuf(f, "ProxyPassword"); - s = DecryptPassword(b); - StrCpy(o->ProxyPassword, sizeof(o->ProxyPassword), s); - Free(s); - FreeBuf(b); - CfgGetStr(f, "CustomHttpHeader", o->CustomHttpHeader, sizeof(o->CustomHttpHeader)); - o->NumRetry = CfgGetInt(f, "NumRetry"); - o->RetryInterval = CfgGetInt(f, "RetryInterval"); - CfgGetStr(f, "HubName", o->HubName, sizeof(o->HubName)); - o->MaxConnection = CfgGetInt(f, "MaxConnection"); - o->UseEncrypt = CfgGetBool(f, "UseEncrypt"); - o->UseCompress = CfgGetBool(f, "UseCompress"); - o->HalfConnection = CfgGetBool(f, "HalfConnection"); - o->NoRoutingTracking = CfgGetBool(f, "NoRoutingTracking"); - CfgGetStr(f, "DeviceName", o->DeviceName, sizeof(o->DeviceName)); - o->AdditionalConnectionInterval = CfgGetInt(f, "AdditionalConnectionInterval"); - o->HideStatusWindow = CfgGetBool(f, "HideStatusWindow"); - o->HideNicInfoWindow = CfgGetBool(f, "HideNicInfoWindow"); - o->ConnectionDisconnectSpan = CfgGetInt(f, "ConnectionDisconnectSpan"); - o->RequireMonitorMode = CfgGetBool(f, "RequireMonitorMode"); - o->RequireBridgeRoutingMode = CfgGetBool(f, "RequireBridgeRoutingMode"); - o->DisableQoS = CfgGetBool(f, "DisableQoS"); - o->FromAdminPack = CfgGetBool(f, "FromAdminPack"); - o->NoUdpAcceleration = CfgGetBool(f, "NoUdpAcceleration"); - - b = CfgGetBuf(f, "HostUniqueKey"); - if (b != NULL) - { - if (b->Size == SHA1_SIZE) - { - Copy(o->HostUniqueKey, b->Buf, SHA1_SIZE); - } - - FreeBuf(b); - } - - return o; -} - -// Read the account data -ACCOUNT *CiLoadClientAccount(FOLDER *f) -{ - ACCOUNT *a; - FOLDER *client_option_folder, *client_auth_folder; - BUF *b; - char tmp[64]; - // Validate arguments - if (f == NULL) - { - return NULL; - } - - client_option_folder = CfgGetFolder(f, "ClientOption"); - - if (client_option_folder != NULL) - { - // Compare whether it matches to the account name that is already registered - } - - client_auth_folder = CfgGetFolder(f, "ClientAuth"); - - if (client_option_folder == NULL || client_auth_folder == NULL) - { - return NULL; - } - - a = ZeroMalloc(sizeof(ACCOUNT)); - a->lock = NewLock(); - - a->ClientOption = CiLoadClientOption(client_option_folder); - a->ClientAuth = CiLoadClientAuth(client_auth_folder); - - a->StartupAccount = CfgGetBool(f, "StartupAccount"); - a->CheckServerCert = CfgGetBool(f, "CheckServerCert"); - a->RetryOnServerCert = CfgGetBool(f, "RetryOnServerCert"); - a->CreateDateTime = CfgGetInt64(f, "CreateDateTime"); - a->UpdateDateTime = CfgGetInt64(f, "UpdateDateTime"); - a->LastConnectDateTime = CfgGetInt64(f, "LastConnectDateTime"); - - b = CfgGetBuf(f, "ServerCert"); - if (b != NULL) - { - a->ServerCert = BufToX(b, false); - FreeBuf(b); - } - - if (CfgGetStr(f, "ShortcutKey", tmp, sizeof(tmp))) - { - BUF *b = StrToBin(tmp); - if (b->Size == SHA1_SIZE) - { - Copy(a->ShortcutKey, b->Buf, SHA1_SIZE); - } - FreeBuf(b); - } - - if (IsZero(a->ShortcutKey, SHA1_SIZE)) - { - Rand(a->ShortcutKey, SHA1_SIZE); - } - - return a; -} - -// Read the account database -void CiLoadAccountDatabase(CLIENT *c, FOLDER *f) -{ - TOKEN_LIST *t; - UINT i; - // Validate arguments - if (c == NULL || f == NULL) - { - return; - } - - t = CfgEnumFolderToTokenList(f); - if (t == NULL) - { - return; - } - - for (i = 0;i < t->NumTokens;i++) - { - FOLDER *ff = CfgGetFolder(f, t->Token[i]); - - if (ff != NULL) - { - ACCOUNT *a = CiLoadClientAccount(ff); - if (a != NULL) - { - { - Add(c->AccountList, a); - } - } - } - } - - Sort(c->AccountList); - - FreeToken(t); -} - -// Read the root CA certificate -void CiLoadCACert(CLIENT *c, FOLDER *f) -{ - BUF *b; - X *x; - // Validate arguments - if (c == NULL || f == NULL) - { - return; - } - - b = CfgGetBuf(f, "X509"); - if (b == NULL) - { - return; - } - - x = BufToX(b, false); - - AddCa(c->Cedar, x); - - FreeX(x); - - FreeBuf(b); -} - -// Read the root CA list -void CiLoadCAList(CLIENT *c, FOLDER *f) -{ - CEDAR *cedar; - TOKEN_LIST *t; - // Validate arguments - if (c == NULL || f == NULL) - { - return; - } - - t = CfgEnumFolderToTokenList(f); - - cedar = c->Cedar; - - LockList(cedar->CaList); - { - UINT i; - for (i = 0;i < t->NumTokens;i++) - { - FOLDER *folder = CfgGetFolder(f, t->Token[i]); - CiLoadCACert(c, folder); - } - } - UnlockList(cedar->CaList); - - FreeToken(t); -} - -// Read a VLAN -void CiLoadVLan(CLIENT *c, FOLDER *f) -{ - char tmp[MAX_SIZE]; - UCHAR addr[6]; - BUF *b; - UNIX_VLAN *v; - // Validate arguments - if (c == NULL || f == NULL) - { - return; - } - - if (CfgGetStr(f, "MacAddress", tmp, sizeof(tmp)) == false) - { - return; - } - - b = StrToBin(tmp); - if (b == NULL) - { - return; - } - - if (b->Size != 6) - { - FreeBuf(b); - return; - } - - Copy(addr, b->Buf, 6); - - FreeBuf(b); - - if (IsZero(addr, 6)) - { - return; - } - - v = ZeroMalloc(sizeof(UNIX_VLAN)); - Copy(v->MacAddress, addr, 6); - StrCpy(v->Name, sizeof(v->Name), f->Name); - v->Enabled = CfgGetBool(f, "Enabled"); - - Add(c->UnixVLanList, v); - -#ifdef OS_UNIX - UnixVLanCreate(v->Name, v->MacAddress, false); -#endif // OS_UNIX -} - -// Read a VLAN list -void CiLoadVLanList(CLIENT *c, FOLDER *f) -{ - TOKEN_LIST *t; - // Validate arguments - if (c == NULL || f == NULL) - { - return; - } - - t = CfgEnumFolderToTokenList(f); - - LockList(c->UnixVLanList); - { - UINT i; - for (i = 0;i < t->NumTokens;i++) - { - FOLDER *folder = CfgGetFolder(f, t->Token[i]); - CiLoadVLan(c, folder); - } - } - UnlockList(c->UnixVLanList); - - FreeToken(t); -} - -// Read the configuration from the configuration file -bool CiReadSettingFromCfg(CLIENT *c, FOLDER *root) -{ - FOLDER *config; - FOLDER *cert; - FOLDER *db; - FOLDER *vlan; - FOLDER *cmsetting; - FOLDER *proxy; - char user_agent[MAX_SIZE]; - // Validate arguments - if (c == NULL || root == NULL) - { - return false; - } - - // Initialize the setting if there isn't either of AccountDatabase and Config - config = CfgGetFolder(root, "Config"); - if (config == NULL) - { - return false; - } - - db = CfgGetFolder(root, "AccountDatabase"); - if (db == NULL) - { - return false; - } - - cmsetting = CfgGetFolder(root, "ClientManagerSetting"); - - CiLoadClientConfig(&c->Config, config); - - - proxy = CfgGetFolder(root, "CommonProxySetting"); - - if (proxy != NULL) - { - INTERNET_SETTING t; - BUF *pw; - - // Proxy Setting - Zero(&t, sizeof(t)); - t.ProxyType = CfgGetInt(proxy, "ProxyType"); - CfgGetStr(proxy, "ProxyHostName", t.ProxyHostName, sizeof(t.ProxyHostName)); - t.ProxyPort = CfgGetInt(proxy, "ProxyPort"); - CfgGetStr(proxy, "ProxyUsername", t.ProxyUsername, sizeof(t.ProxyUsername)); - pw = CfgGetBuf(proxy, "ProxyPassword"); - if (pw != NULL) - { - char *pw_str = DecryptPassword(pw); - StrCpy(t.ProxyPassword, sizeof(t.ProxyPassword), pw_str); - - Free(pw_str); - FreeBuf(pw); - } - - CfgGetStr(proxy, "CustomHttpHeader", t.CustomHttpHeader, sizeof(t.CustomHttpHeader)); - - Copy(&c->CommonProxySetting, &t, sizeof(INTERNET_SETTING)); - } - - // Eraser - c->Eraser = NewEraser(c->Logger, CfgGetInt64(config, "AutoDeleteCheckDiskFreeSpaceMin")); - - if (OS_IS_UNIX(GetOsInfo()->OsType) -#ifdef NO_VLAN - && GetOsInfo()->OsType != OSTYPE_MACOS_X -#endif // NO_VLAN - ) - { - // Read the UNIX version virtual LAN card list (except MacOS) - vlan = CfgGetFolder(root, "UnixVLan"); - if (vlan != NULL) - { - CiLoadVLanList(c, vlan); - } - } - -#ifdef NO_VLAN - if (GetOsInfo()->OsType == OSTYPE_MACOS_X) - { -#ifdef OS_UNIX - UNIX_VLAN *uv; - - // Create a Tap for MacOS X - if (UnixVLanCreate(CLIENT_MACOS_TAP_NAME, NULL, false) == false) - { - // Fail (abort) - CLog(c, "LC_TAP_NOT_FOUND"); - Alert("tun/tap driver not found.", NULL); - exit(0); - } - - uv = ZeroMalloc(sizeof(UNIX_VLAN)); - uv->Enabled = true; - StrCpy(uv->Name, sizeof(uv->Name), CLIENT_MACOS_TAP_NAME); - Add(c->UnixVLanList, uv); -#endif // OS_UNIX - } -#endif // NO_VLAN - CiLoadAccountDatabase(c, db); - - if (CfgGetByte(root, "EncryptedPassword", c->EncryptedPassword, SHA1_SIZE) == false) - { - Sha0(c->EncryptedPassword, "", 0); - } - - c->PasswordRemoteOnly = CfgGetBool(root, "PasswordRemoteOnly"); - c->UseSecureDeviceId = CfgGetInt(root, "UseSecureDeviceId"); - - if (CfgGetStr(root, "UserAgent", user_agent, sizeof(user_agent))) - { - if (IsEmptyStr(user_agent) == false) - { - Free(c->Cedar->HttpUserAgent); - c->Cedar->HttpUserAgent = CopyStr(user_agent); - } - } - - cert = CfgGetFolder(root, "RootCA"); - if (cert != NULL) - { - CiLoadCAList(c, cert); - } - - c->DontSavePassword = CfgGetBool(root, "DontSavePassword"); - - if (cmsetting != NULL) - { - UINT ostype = GetOsInfo()->OsType; - // CM_SETTING - CM_SETTING *s = c->CmSetting; - - if (OS_IS_UNIX(ostype) || OS_IS_WINDOWS_NT(ostype)) - { - s->EasyMode = CfgGetBool(cmsetting, "EasyMode"); - } - - s->LockMode = CfgGetBool(cmsetting, "LockMode"); - CfgGetByte(cmsetting, "HashedPassword", s->HashedPassword, sizeof(s->HashedPassword)); - } - - return true; -} - -// Read the configuration file -bool CiLoadConfigurationFile(CLIENT *c) -{ - bool ret; - FOLDER *root; - char path[MAX_SIZE]; - // Validate arguments - if (c == NULL) - { - return false; - } - - // Read the configuration file - if (CiLoadConfigFilePathFromIni(path, sizeof(path))) - { - c->CfgRw = NewCfgRw(&root, path); - } - else - { - c->CfgRw = NewCfgRw(&root, CLIENT_CONFIG_FILE_NAME); - } - - if (root == NULL) - { - return false; - } - - ret = CiReadSettingFromCfg(c, root); - - CfgDeleteFolder(root); - - return ret; -} - -// Write the CLIENT_CONFIG -void CiWriteClientConfig(FOLDER *cc, CLIENT_CONFIG *config) -{ - // Validate arguments - if (cc == NULL || config == NULL) - { - return; - } - - CfgAddBool(cc, "UseKeepConnect", config->UseKeepConnect); - CfgAddStr(cc, "KeepConnectHost", config->KeepConnectHost); - CfgAddInt(cc, "KeepConnectPort", config->KeepConnectPort); - CfgAddInt(cc, "KeepConnectProtocol", config->KeepConnectProtocol); - CfgAddBool(cc, "AllowRemoteConfig", config->AllowRemoteConfig); - CfgAddInt(cc, "KeepConnectInterval", config->KeepConnectInterval); - CfgAddBool(cc, "NoChangeWcmNetworkSettingOnWindows8", config->NoChangeWcmNetworkSettingOnWindows8); -} - -// Write the client authentication data -void CiWriteClientAuth(FOLDER *f, CLIENT_AUTH *a) -{ - BUF *b; - // Validate arguments - if (f == NULL || a == NULL) - { - return; - } - - CfgAddInt(f, "AuthType", a->AuthType); - CfgAddStr(f, "Username", a->Username); - - switch (a->AuthType) - { - case CLIENT_AUTHTYPE_ANONYMOUS: - break; - - case CLIENT_AUTHTYPE_PASSWORD: - CfgAddByte(f, "HashedPassword", a->HashedPassword, SHA1_SIZE); - break; - - case CLIENT_AUTHTYPE_PLAIN_PASSWORD: - b = EncryptPassword(a->PlainPassword); - CfgAddByte(f, "EncryptedPassword", b->Buf, b->Size); - FreeBuf(b); - break; - - case CLIENT_AUTHTYPE_CERT: - if (a->ClientK != NULL && a->ClientX != NULL) - { - b = XToBuf(a->ClientX, false); - CfgAddByte(f, "ClientCert", b->Buf, b->Size); - FreeBuf(b); - - b = KToBuf(a->ClientK, false, NULL); - CfgAddByte(f, "ClientKey", b->Buf, b->Size); - FreeBuf(b); - } - break; - - case CLIENT_AUTHTYPE_SECURE: - CfgAddStr(f, "SecurePublicCertName", a->SecurePublicCertName); - CfgAddStr(f, "SecurePrivateKeyName", a->SecurePrivateKeyName); - break; - - case CLIENT_AUTHTYPE_OPENSSLENGINE: - if (a->ClientX != NULL) { - b = XToBuf(a->ClientX, false); - CfgAddByte(f, "ClientCert", b->Buf, b->Size); - FreeBuf(b); - } - CfgAddStr(f, "OpensslEnginePrivateKeyName", a->OpensslEnginePrivateKeyName); - CfgAddStr(f, "OpensslEngineName", a->OpensslEngineName); - break; - } -} - -// Write the client option -void CiWriteClientOption(FOLDER *f, CLIENT_OPTION *o) -{ - BUF *b; - // Validate arguments - if (f == NULL || o == NULL) - { - return; - } - - CfgAddUniStr(f, "AccountName", o->AccountName); - CfgAddStr(f, "Hostname", o->Hostname); - CfgAddInt(f, "Port", o->Port); - CfgAddInt(f, "PortUDP", o->PortUDP); - CfgAddInt(f, "ProxyType", o->ProxyType); - CfgAddStr(f, "ProxyName", o->ProxyName); - CfgAddInt(f, "ProxyPort", o->ProxyPort); - CfgAddStr(f, "ProxyUsername", o->ProxyUsername); - b = EncryptPassword(o->ProxyPassword); - CfgAddByte(f, "ProxyPassword", b->Buf, b->Size); - FreeBuf(b); - CfgAddStr(f, "CustomHttpHeader", o->CustomHttpHeader); - CfgAddInt(f, "NumRetry", o->NumRetry); - CfgAddInt(f, "RetryInterval", o->RetryInterval); - CfgAddStr(f, "HubName", o->HubName); - CfgAddInt(f, "MaxConnection", o->MaxConnection); - CfgAddBool(f, "UseEncrypt", o->UseEncrypt); - CfgAddBool(f, "UseCompress", o->UseCompress); - CfgAddBool(f, "HalfConnection", o->HalfConnection); - CfgAddBool(f, "NoRoutingTracking", o->NoRoutingTracking); - CfgAddStr(f, "DeviceName", o->DeviceName); - CfgAddInt(f, "AdditionalConnectionInterval", o->AdditionalConnectionInterval); - CfgAddBool(f, "HideStatusWindow", o->HideStatusWindow); - CfgAddBool(f, "HideNicInfoWindow", o->HideNicInfoWindow); - CfgAddInt(f, "ConnectionDisconnectSpan", o->ConnectionDisconnectSpan); - CfgAddBool(f, "RequireMonitorMode", o->RequireMonitorMode); - CfgAddBool(f, "RequireBridgeRoutingMode", o->RequireBridgeRoutingMode); - CfgAddBool(f, "DisableQoS", o->DisableQoS); - CfgAddBool(f, "NoUdpAcceleration", o->NoUdpAcceleration); - - if (o->FromAdminPack) - { - CfgAddBool(f, "FromAdminPack", o->FromAdminPack); - } - - if (IsZero(o->HostUniqueKey, SHA1_SIZE) == false) - { - BUF *b = MemToBuf(o->HostUniqueKey, SHA1_SIZE); - CfgAddBuf(f, "HostUniqueKey", b); - FreeBuf(b); - } -} - -// Decrypt the password -char *DecryptPassword(BUF *b) -{ - char *str; - char *key = "EncryptPassword"; - CRYPT *c; - // Validate arguments - if (b == NULL) - { - return CopyStr(""); - } - - str = ZeroMalloc(b->Size + 1); - c = NewCrypt(key, sizeof(key)); // NOTE by Daiyuu Nobori 2018-09-28: This is not a bug! Do not try to fix it!! - Encrypt(c, str, b->Buf, b->Size); - FreeCrypt(c); - - str[b->Size] = 0; - - return str; -} -char *DecryptPassword2(BUF *b) -{ - char *str; - char *key = "EncryptPassword2"; - CRYPT *c; - // Validate arguments - if (b == NULL) - { - return CopyStr(""); - } - - str = ZeroMalloc(b->Size + 1); - c = NewCrypt(key, StrLen(key)); - Encrypt(c, str, b->Buf, b->Size); - FreeCrypt(c); - - str[b->Size] = 0; - - return str; -} - -// Encrypt the password -BUF *EncryptPassword(char *password) -{ - UCHAR *tmp; - UINT size; - char *key = "EncryptPassword"; - CRYPT *c; - BUF *b; - // Validate arguments - if (password == NULL) - { - password = ""; - } - - size = StrLen(password) + 1; - tmp = ZeroMalloc(size); - - c = NewCrypt(key, sizeof(key)); // NOTE by Daiyuu Nobori 2018-09-28: This is not a bug! Do not try to fix it!! - Encrypt(c, tmp, password, size - 1); - FreeCrypt(c); - - b = NewBuf(); - WriteBuf(b, tmp, size - 1); - SeekBuf(b, 0, 0); - Free(tmp); - - return b; -} -BUF *EncryptPassword2(char *password) -{ - UCHAR *tmp; - UINT size; - char *key = "EncryptPassword2"; - CRYPT *c; - BUF *b; - // Validate arguments - if (password == NULL) - { - password = ""; - } - - size = StrLen(password) + 1; - tmp = ZeroMalloc(size); - - c = NewCrypt(key, StrLen(key)); - Encrypt(c, tmp, password, size - 1); - FreeCrypt(c); - - b = NewBuf(); - WriteBuf(b, tmp, size - 1); - SeekBuf(b, 0, 0); - Free(tmp); - - return b; -} - -// Write the account data -void CiWriteAccountData(FOLDER *f, ACCOUNT *a) -{ - // Validate arguments - if (f == NULL || a == NULL) - { - return; - } - - // Client Option - CiWriteClientOption(CfgCreateFolder(f, "ClientOption"), a->ClientOption); - - // Client authentication data - CiWriteClientAuth(CfgCreateFolder(f, "ClientAuth"), a->ClientAuth); - - // Startup account - CfgAddBool(f, "StartupAccount", a->StartupAccount); - - // Server certificate check flag - CfgAddBool(f, "CheckServerCert", a->CheckServerCert); - - // Retry on invalid server certificate flag - CfgAddBool(f, "RetryOnServerCert", a->RetryOnServerCert); - - // Date and time - CfgAddInt64(f, "CreateDateTime", a->CreateDateTime); - CfgAddInt64(f, "UpdateDateTime", a->UpdateDateTime); - CfgAddInt64(f, "LastConnectDateTime", a->LastConnectDateTime); - - // Server certificate body - if (a->ServerCert != NULL) - { - BUF *b = XToBuf(a->ServerCert, false); - if (b != NULL) - { - CfgAddBuf(f, "ServerCert", b); - FreeBuf(b); - } - } - - // Shortcut Key - if (IsZero(a->ShortcutKey, SHA1_SIZE) == false) - { - char tmp[64]; - BinToStr(tmp, sizeof(tmp), a->ShortcutKey, SHA1_SIZE); - CfgAddStr(f, "ShortcutKey", tmp); - } -} - -// Write the account database -void CiWriteAccountDatabase(CLIENT *c, FOLDER *f) -{ - char name[MAX_SIZE]; - // Validate arguments - if (c == NULL || f == NULL) - { - return; - } - - LockList(c->AccountList); - { - UINT i; - for (i = 0;i < LIST_NUM(c->AccountList);i++) - { - ACCOUNT *a = LIST_DATA(c->AccountList, i); - - { - Format(name, sizeof(name), "Account%u", i); - Lock(a->lock); - { - CiWriteAccountData(CfgCreateFolder(f, name), a); - } - Unlock(a->lock); - } - } - } - UnlockList(c->AccountList); -} - -// Write the CA certificate -void CiWriteCACert(CLIENT *c, FOLDER *f, X *x) -{ - BUF *b; - // Validate arguments - if (c == NULL || f == NULL || x == NULL) - { - return; - } - - b = XToBuf(x, false); - CfgAddBuf(f, "X509", b); - FreeBuf(b); -} - -// Write a VLAN -void CiWriteVLan(CLIENT *c, FOLDER *f, UNIX_VLAN *v) -{ - char tmp[MAX_SIZE]; - // Validate arguments - if (c == NULL || f == NULL || v == NULL) - { - return; - } - - MacToStr(tmp, sizeof(tmp), v->MacAddress); - CfgAddStr(f, "MacAddress", tmp); - CfgAddBool(f, "Enabled", v->Enabled); -} - -// Write a VLAN list -void CiWriteVLanList(CLIENT *c, FOLDER *f) -{ - // Validate arguments - if (c == NULL || f == NULL) - { - return; - } - - LockList(c->UnixVLanList); - { - UINT i; - for (i = 0;i < LIST_NUM(c->UnixVLanList);i++) - { - UNIX_VLAN *v = LIST_DATA(c->UnixVLanList, i); - CiWriteVLan(c, CfgCreateFolder(f, v->Name), v); - } - } - UnlockList(c->UnixVLanList); -} - -// Write the CA list -void CiWriteCAList(CLIENT *c, FOLDER *f) -{ - CEDAR *cedar; - // Validate arguments - if (c == NULL || f == NULL) - { - return; - } - - cedar = c->Cedar; - - LockList(cedar->CaList); - { - UINT i; - for (i = 0;i < LIST_NUM(cedar->CaList);i++) - { - char tmp[MAX_SIZE]; - X *x = LIST_DATA(cedar->CaList, i); - Format(tmp, sizeof(tmp), "Certificate%u", i); - CiWriteCACert(c, CfgCreateFolder(f, tmp), x); - } - } - UnlockList(cedar->CaList); -} - -// Write the current settings to ROOT -void CiWriteSettingToCfg(CLIENT *c, FOLDER *root) -{ - FOLDER *cc; - FOLDER *account_database; - FOLDER *ca; - FOLDER *vlan; - FOLDER *cmsetting; - FOLDER *proxy; - // Validate arguments - if (c == NULL || root == NULL) - { - return; - } - - cmsetting = CfgCreateFolder(root, "ClientManagerSetting"); - - // CLIENT_CONFIG - cc = CfgCreateFolder(root, "Config"); - CiWriteClientConfig(cc, &c->Config); - - - // Eraser - CfgAddInt64(cc, "AutoDeleteCheckDiskFreeSpaceMin", c->Eraser->MinFreeSpace); - - // Account Database - account_database = CfgCreateFolder(root, "AccountDatabase"); - CiWriteAccountDatabase(c, account_database); - - // Proxy - proxy = CfgCreateFolder(root, "CommonProxySetting"); - if (proxy != NULL) - { - INTERNET_SETTING *t = &c->CommonProxySetting; - BUF *pw; - - CfgAddInt(proxy, "ProxyType", t->ProxyType); - CfgAddStr(proxy, "ProxyHostName", t->ProxyHostName); - CfgAddInt(proxy, "ProxyPort", t->ProxyPort); - CfgAddStr(proxy, "ProxyUsername", t->ProxyUsername); - - if (IsEmptyStr(t->ProxyPassword) == false) - { - pw = EncryptPassword(t->ProxyPassword); - - CfgAddBuf(proxy, "ProxyPassword", pw); - - FreeBuf(pw); - } - - CfgAddStr(proxy, "CustomHttpHeader", t->CustomHttpHeader); - } - - // CA - ca = CfgCreateFolder(root, "RootCA"); - CiWriteCAList(c, ca); - - // VLAN - if (OS_IS_UNIX(GetOsInfo()->OsType) -#ifdef NO_VLAN - && GetOsInfo()->OsType != OSTYPE_MACOS_X -#endif // NO_VLAN - ) - { - vlan = CfgCreateFolder(root, "UnixVLan"); - CiWriteVLanList(c, vlan); - } - - // Password - CfgAddByte(root, "EncryptedPassword", c->EncryptedPassword, SHA1_SIZE); - CfgAddBool(root, "PasswordRemoteOnly", c->PasswordRemoteOnly); - - // UseSecureDeviceId - CfgAddInt(root, "UseSecureDeviceId", c->UseSecureDeviceId); - - // DontSavePassword - CfgAddBool(root, "DontSavePassword", c->DontSavePassword); - - // UserAgent - if (c->Cedar != NULL) - { - CfgAddStr(root, "UserAgent", c->Cedar->HttpUserAgent); - } - - if (cmsetting != NULL) - { - CM_SETTING *s = c->CmSetting; - - CfgAddBool(cmsetting, "EasyMode", s->EasyMode); - CfgAddBool(cmsetting, "LockMode", s->LockMode); - - if (IsZero(s->HashedPassword, sizeof(s->HashedPassword)) == false) - { - CfgAddByte(cmsetting, "HashedPassword", s->HashedPassword, sizeof(s->HashedPassword)); - } - } -} - -// Apply settings of Inner VPN Server -void CiApplyInnerVPNServerConfig(CLIENT *c) -{ -} - -// Write to the configuration file -void CiSaveConfigurationFile(CLIENT *c) -{ - FOLDER *root; - // Validate arguments - if (c == NULL) - { - return; - } - - // Do not save the configuration file - if(c->NoSaveConfig) - { - return; - } - - root = CfgCreateFolder(NULL, TAG_ROOT); - CiWriteSettingToCfg(c, root); - - SaveCfgRw(c->CfgRw, root); - - CfgDeleteFolder(root); -} - -// Set the CM_SETTING -bool CtSetCmSetting(CLIENT *c, CM_SETTING *s) -{ - // Validate arguments - if (c == NULL || s == NULL) - { - return false; - } - - Copy(c->CmSetting, s, sizeof(CM_SETTING)); - - CiSaveConfigurationFile(c); - - return true; -} - -// Get the CM_SETTING -bool CtGetCmSetting(CLIENT *c, CM_SETTING *s) -{ - // Validate arguments - if (c == NULL || s == NULL) - { - return false; - } - - Copy(s, c->CmSetting, sizeof(CM_SETTING)); - - return true; -} - -// Get the client version -bool CtGetClientVersion(CLIENT *c, RPC_CLIENT_VERSION *ver) -{ - // Validate arguments - if (ver == NULL) - { - return false; - } - - Zero(ver, sizeof(RPC_CLIENT_VERSION)); - StrCpy(ver->ClientProductName, sizeof(ver->ClientProductName), CEDAR_CLIENT_STR); - StrCpy(ver->ClientVersionString, sizeof(ver->ClientVersionString), c->Cedar->VerString); - StrCpy(ver->ClientBuildInfoString, sizeof(ver->ClientBuildInfoString), c->Cedar->BuildInfo); - ver->ClientVerInt = c->Cedar->Version; - ver->ClientBuildInt = c->Cedar->Build; - - -#ifdef OS_WIN32 - ver->ProcessId = MsGetProcessId(); - ver->IsVLanNameRegulated = MsIsInfCatalogRequired(); - -#endif // OS_WIN32 - - ver->OsType = GetOsInfo()->OsType; - - return true; -} - -// Creating a Client object -CLIENT *CiNewClient() -{ - CLIENT *c = ZeroMalloc(sizeof(CLIENT)); - -// StartCedarLog(); - - if (ci_active_sessions_lock == NULL) - { - ci_active_sessions_lock = NewLock(); - ci_num_active_sessions = 0; - } - -#ifdef OS_WIN32 - if (MsIsWindows7()) - { - c->MsSuspendHandler = MsNewSuspendHandler(); - } -#endif // OS_WIN32 - - - c->CmSetting = ZeroMalloc(sizeof(CM_SETTING)); - - c->SockList = NewSockList(); - - c->lock = NewLock(); - c->lockForConnect = NewLock(); - c->ref = NewRef(); - - c->Cedar = NewCedar(NULL, NULL); - - c->Cedar->Client = c; - - c->NotifyCancelList = NewList(NULL); - - Sha0(c->EncryptedPassword, "", 0); - -#ifdef OS_WIN32 - c->GlobalPulse = MsOpenOrCreateGlobalPulse(CLIENT_GLOBAL_PULSE_NAME); -#endif // OS_WIN32 - - if (c->GlobalPulse != NULL) - { - c->PulseRecvThread = NewThread(CiPulseRecvThread, c); - } - - CiLoadIniSettings(c); - - // Log Settings - if(c->NoSaveLog == false) - { - MakeDir(CLIENT_LOG_DIR_NAME); - c->Logger = NewLog(CLIENT_LOG_DIR_NAME, CLIENT_LOG_PREFIX, LOG_SWITCH_DAY); - } - - CLog(c, "L_LINE"); - CLog(c, "LC_START_2", CEDAR_CLIENT_STR, c->Cedar->VerString); - CLog(c, "LC_START_3", c->Cedar->BuildInfo); - CLog(c, "LC_START_1"); - -#ifdef OS_WIN32 - { - // Initialize the Win32 UI - wchar_t tmp[MAX_SIZE]; - StrToUni(tmp, sizeof(tmp), CEDAR_CLIENT_STR); - - InitWinUi(tmp, _SS("DEFAULT_FONT"), _II("DEFAULT_FONT_SIZE")); - } -#endif // OS_WIN32 - - // Initialize the settings - CiInitConfiguration(c); - - // Raise the priority - OSSetHighPriority(); - - - -#ifdef OS_WIN32 - // For Win9x, release the DHCP address of all the virtual LAN card - if (MsIsNt() == false) - { - Win32ReleaseAllDhcp9x(true); - } -#endif // OS_WIN32 - - CiChangeAllVLanMacAddressIfMachineChanged(c); - - CiChangeAllVLanMacAddressIfCleared(c); - - // Initialize the internal VPN server - CiApplyInnerVPNServerConfig(c); - - return c; -} - -// Send a global pulse -void CiSendGlobalPulse(CLIENT *c) -{ - // Validate arguments - if (c == NULL) - { - return; - } - -#ifdef OS_WIN32 - MsSendGlobalPulse(c->GlobalPulse); -#endif // OS_WIN32 -} - -// Pulse reception thread -void CiPulseRecvThread(THREAD *thread, void *param) -{ -#ifdef OS_WIN32 - CLIENT *c = (CLIENT *)param; - - if (c == NULL) - { - return; - } - - while (true) - { - if (c->HaltPulseThread) - { - break; - } - - MsWaitForGlobalPulse(c->GlobalPulse, INFINITE); - - if (c->HaltPulseThread) - { - break; - } - - CiNotifyInternal(c); - } -#endif // OS_WIN32 -} - -// Clean-up the client -void CiCleanupClient(CLIENT *c) -{ - // Validate arguments - if (c == NULL) - { - return; - } - - - // Release the settings - CiFreeConfiguration(c); - -#ifdef OS_WIN32 - // Release the Win32 UI - FreeWinUi(); -#endif // OS_WIN32 - - CLog(c, "LC_END"); - CLog(c, "L_LINE"); - FreeEraser(c->Eraser); - FreeLog(c->Logger); - c->Logger = NULL; - - - ReleaseCedar(c->Cedar); - - DeleteLock(c->lockForConnect); - DeleteLock(c->lock); - - c->HaltPulseThread = true; - - if (c->GlobalPulse != NULL) - { -#ifdef OS_WIN32 - MsSendGlobalPulse(c->GlobalPulse); -#endif // OS_WIN32 - } - - if (c->PulseRecvThread != NULL) - { - WaitThread(c->PulseRecvThread, INFINITE); - ReleaseThread(c->PulseRecvThread); - } - - if (c->GlobalPulse != NULL) - { -#ifdef OS_WIN32 - MsCloseGlobalPulse(c->GlobalPulse); -#endif // OS_WIN32 - } - - ReleaseList(c->NotifyCancelList); - - FreeSockList(c->SockList); - - Free(c->CmSetting); - - -#ifdef OS_WIN32 - if (c->MsSuspendHandler != NULL) - { - MsFreeSuspendHandler(c->MsSuspendHandler); - } -#endif // OS_WIN32 - - Free(c); - -#ifdef OS_WIN32 - // For Win9x, release the DHCP address of all the virtual LAN card - if (MsIsNt() == false) - { - Win32ReleaseAllDhcp9x(true); - } -#endif // OS_WIN32 - - StopCedarLog(); - - if (ci_active_sessions_lock != NULL) - { - DeleteLock(ci_active_sessions_lock); - ci_active_sessions_lock = NULL; - - ci_num_active_sessions = 0; - } -} - -// Increment of the number of active sessions -void CiIncrementNumActiveSessions() -{ - Lock(ci_active_sessions_lock); - { - ci_num_active_sessions++; - } - Unlock(ci_active_sessions_lock); -} - -// Decrement of the number of active sessions -void CiDecrementNumActiveSessions() -{ - Lock(ci_active_sessions_lock); - { - if (ci_num_active_sessions >= 1) - { - ci_num_active_sessions--; - } - } - Unlock(ci_active_sessions_lock); -} - -// Release the client -void CtReleaseClient(CLIENT *c) -{ - // Validate arguments - if (c == NULL) - { - return; - } - - if (Release(c->ref) == 0) - { - CiCleanupClient(c); - } -} - -// Start the operation of the client program -void CtStartClient() -{ - UINT i; - LIST *o; - if (client != NULL) - { - // It is already in running - return; - } - - // OS check - CiCheckOs(); - -#ifdef OS_WIN32 - RegistWindowsFirewallAll(); -#endif - - // Creating a client - client = CiNewClient(); - - // Start the Keep - CiInitKeep(client); - - // Start the RPC server - CiStartRpcServer(client); - - // Start the Saver - CiInitSaver(client); - - // Start the startup connection - o = NewListFast(NULL); - LockList(client->AccountList); - { - for (i = 0;i < LIST_NUM(client->AccountList);i++) - { - ACCOUNT *a = LIST_DATA(client->AccountList, i); - Lock(a->lock); - { - if (a->StartupAccount) - { - Add(o, CopyUniStr(a->ClientOption->AccountName)); - } - } - Unlock(a->lock); - } - } - UnlockList(client->AccountList); - - for (i = 0;i < LIST_NUM(o);i++) - { - wchar_t *s = LIST_DATA(o, i); - RPC_CLIENT_CONNECT c; - Zero(&c, sizeof(c)); - UniStrCpy(c.AccountName, sizeof(c.AccountName), s); - CtConnect(client, &c); - Free(s); - } - ReleaseList(o); -} - -// Stop the operation of the client program -void CtStopClient() -{ - UINT i, num; - ACCOUNT **account_list; - if (client == NULL) - { - // It is not running yet - return; - } - - // Halting flag - client->Halt = true; - - // Disconnect all the RPC - CiStopRpcServer(client); - - // Exit the client notification service - CncExit(); - - // Exit the Keep - CiFreeKeep(client); - - // Disconnect all accounts connected - LockList(client->AccountList); - { - num = LIST_NUM(client->AccountList); - account_list = ToArray(client->AccountList); - } - UnlockList(client->AccountList); - - for (i = 0;i < num;i++) - { - ACCOUNT *a = account_list[i]; - SESSION *s = NULL; - - Lock(a->lock); - { - if (a->ClientSession != NULL) - { - s = a->ClientSession; - AddRef(s->ref); - } - } - Unlock(a->lock); - - if (s != NULL) - { - StopSession(s); - ReleaseSession(s); - Lock(a->lock); - { - if (a->ClientSession != NULL) - { - ReleaseSession(a->ClientSession); - a->ClientSession = NULL; - } - } - Unlock(a->lock); - } - } - - Free(account_list); - - // Stop the Saver - CiFreeSaver(client); - - // Release the client - CtReleaseClient(client); - client = NULL; -} - -// OS check -void CiCheckOs() -{ - // Get the OS type - OS_INFO *info = GetOsInfo(); - - if (OS_IS_WINDOWS(info->OsType)) - { - bool ok = IS_CLIENT_SUPPORTED_OS(info->OsType); - - if (ok == false) - { - Alert( - CEDAR_PRODUCT_STR " VPN Client doesn't support this Windows Operating System.\n" - CEDAR_PRODUCT_STR " VPN Client requires Windows 98, Windows Me, Windows 2000, Windows XP, Windows Server 2003 or Greater.\n\n" - "Please contact your system administrator.", CEDAR_PRODUCT_STR " VPN Client"); - exit(0); - } - } -} - -// Client status indicator -void CiClientStatusPrinter(SESSION *s, wchar_t *status) -{ -#ifdef OS_WIN32 - ACCOUNT *a; - // Validate arguments - if (s == NULL || status == NULL) - { - return; - } - - a = s->Account; - if (a == NULL) - { - return; - } - - if (UniStrCmpi(status, L"init") == 0) - { - if (a->StatusWindow == NULL && s->Win32HideConnectWindow == false) - { - a->StatusWindow = CncStatusPrinterWindowStart(s); - } - } - else if (UniStrCmpi(status, L"free") == 0) - { - if (a->StatusWindow != NULL) - { - CncStatusPrinterWindowStop(a->StatusWindow); - a->StatusWindow = NULL; - } - } - else - { - if (a->StatusWindow != NULL) - { - CncStatusPrinterWindowPrint(a->StatusWindow, status); - } - } -#else // OS_WIN32 - UniPrint(L"Status: %s\n", status); -#endif // OS_WIN32 -} - - +// SoftEther VPN Source Code - Developer Edition Master Branch +// Cedar Communication Module +// © 2020 Nokia + +// Client.c +// Client Manager + +#include "CedarPch.h" + +static CLIENT *client = NULL; +static LISTENER *cn_listener = NULL; +static LOCK *cn_listener_lock = NULL; +static UINT64 cn_next_allow = 0; +static LOCK *ci_active_sessions_lock = NULL; +static UINT ci_num_active_sessions = 0; + + +// In Windows 8 or later, change unreasonable setting of WCM to ensure normal VPN communication +void CiDisableWcmNetworkMinimize(CLIENT *c) +{ +#ifdef OS_WIN32 + // Validate arguments + if (c == NULL) + { + return; + } + + if (c->Config.NoChangeWcmNetworkSettingOnWindows8) + { + return; + } + + MsDisableWcmNetworkMinimize(); +#endif // OS_WIN32 +} + +// Compare RPC_CLIENT_ENUM_ACCOUNT_ITEM items by last connected date (Reverse) +int CiCompareClientAccountEnumItemByLastConnectDateTime(void *p1, void *p2) +{ + RPC_CLIENT_ENUM_ACCOUNT_ITEM *a1, *a2; + if (p1 == NULL || p2 == NULL) + { + return 0; + } + a1 = *(RPC_CLIENT_ENUM_ACCOUNT_ITEM **)p1; + a2 = *(RPC_CLIENT_ENUM_ACCOUNT_ITEM **)p2; + if (a1 == NULL || a2 == NULL) + { + return 0; + } + if (a1->LastConnectDateTime > a2->LastConnectDateTime) + { + return -1; + } + else if (a1->LastConnectDateTime < a2->LastConnectDateTime) + { + return 1; + } + + return 0; +} + +// If machine changed, reshuffle MAC address for all virtual NIC +void CiChangeAllVLanMacAddressIfMachineChanged(CLIENT *c) +{ + UCHAR current_hash_new[SHA1_SIZE]; + UCHAR current_hash[SHA1_SIZE]; + UCHAR current_hash_old[SHA1_SIZE]; + UCHAR saved_hash[SHA1_SIZE]; + // Validate arguments + if (c == NULL) + { + return; + } + +#ifdef OS_WIN32 + if (MsIsAdmin() == false) + { + return; + } +#endif + + CiGetCurrentMachineHashNew(current_hash_new); + CiGetCurrentMachineHash(current_hash); + CiGetCurrentMachineHashOld(current_hash_old); + + if (CiReadLastMachineHash(saved_hash) == false) + { + CiWriteLastMachineHash(current_hash_new); + return; + } + + if (Cmp(saved_hash, current_hash_old, SHA1_SIZE) == 0) + { + CiWriteLastMachineHash(current_hash_new); + return; + } + + if (Cmp(saved_hash, current_hash, SHA1_SIZE) == 0) + { + CiWriteLastMachineHash(current_hash_new); + return; + } + + if (Cmp(saved_hash, current_hash_new, SHA1_SIZE) == 0) + { + return; + } + + if (CiWriteLastMachineHash(current_hash_new) == false) + { + return; + } + + CiChangeAllVLanMacAddress(c); +} + +// Get current machine hash (Old) +void CiGetCurrentMachineHashOld(void *data) +{ + char name[MAX_PATH]; + char *product_id = NULL; + // Validate arguments + if (data == NULL) + { + return; + } + +#ifdef OS_WIN32 + // Product ID + product_id = MsRegReadStr(REG_LOCAL_MACHINE, "SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion", "ProductId"); + if (product_id == NULL) + { + product_id = MsRegReadStr(REG_LOCAL_MACHINE, "SOFTWARE\\Microsoft\\Windows\\CurrentVersion", "ProductId"); + } + + StrCpy(name, sizeof(name), product_id); + + Free(product_id); + +#else // OS_WIN32 + GetMachineName(name, sizeof(name)); +#endif // OS_WIN32 + + Trim(name); + StrUpper(name); + + Sha0(data, name, StrLen(name)); +} + +// Get current machine hash +void CiGetCurrentMachineHash(void *data) +{ + char name[MAX_PATH]; + char *product_id = NULL; + // Validate arguments + if (data == NULL) + { + return; + } + + GetMachineName(name, sizeof(name)); + + Trim(name); + StrUpper(name); + + Sha0(data, name, StrLen(name)); +} + +// Get current machine hash (without using domain name) +void CiGetCurrentMachineHashNew(void *data) +{ + char name[MAX_PATH]; + char *p; + + // Validate arguments + if (data == NULL) + { + return; + } + + GetMachineName(name, sizeof(name)); + + // Ignore after first period(.) + for(p=name; *p; p++) + if(*p == '.') + *p = 0; + + Trim(name); + StrUpper(name); + + Sha0(data, name, StrLen(name)); +} + + +// Write machine hash +bool CiWriteLastMachineHash(void *data) +{ + // Validate arguments + if (data == NULL) + { + return false; + } + +#ifdef OS_WIN32 + if (MsRegWriteBinEx(REG_LOCAL_MACHINE, MS_REG_TCP_SETTING_KEY, "LastMachineHash", data, SHA1_SIZE, true) == false) + { + return false; + } + + return true; +#else // OS_WIN32 + return false; +#endif // OS_WIN32 +} + +// Get previous machine hash +bool CiReadLastMachineHash(void *data) +{ + BUF *b = NULL; + // Validate arguments + if (data == NULL) + { + return false; + } + +#ifdef OS_WIN32 + b = MsRegReadBinEx(REG_LOCAL_MACHINE, MS_REG_TCP_SETTING_KEY, "LastMachineHash", true); + if (b == NULL) + { + return false; + } + if (b->Size == SHA1_SIZE) + { + Copy(data, b->Buf, b->Size); + FreeBuf(b); + + return true; + } + + FreeBuf(b); + return false; +#else // OS_WIN32 + return false; +#endif // OS_WIN32 +} + +// If the MAC address of each virtual LAN card has been eliminated, set it to random numbers +// (measures for Windows 8 -> 8.1 upgrade problem) +void CiChangeAllVLanMacAddressIfCleared(CLIENT *c) +{ +#ifdef OS_WIN32 + RPC_CLIENT_ENUM_VLAN t; + // Validate arguments + if (c == NULL) + { + return; + } + + if (MsIsInfCatalogRequired() == false) + { + // Not required for other than Windows 8 + return; + } + + Zero(&t, sizeof(t)); + if (CtEnumVLan(c, &t)) + { + UINT i; + + for (i = 0;i < t.NumItem;i++) + { + RPC_CLIENT_ENUM_VLAN_ITEM *e = t.Items[i]; + UCHAR mac[6]; + + if (StrToMac(mac, e->MacAddress)) + { + if (mac[0] == 0x00 && + mac[1] == 0x00 && + mac[2] == 0x01 && + mac[3] == 0x00 && + mac[4] == 0x00 && + mac[5] == 0x01) + { + char *name = e->DeviceName; + RPC_CLIENT_SET_VLAN s; + UCHAR mac[6]; + + GenMacAddress(mac); + + Zero(&s, sizeof(s)); + StrCpy(s.DeviceName, sizeof(s.DeviceName), name); + + MacToStr(s.MacAddress, sizeof(s.MacAddress), mac); + + CtSetVLan(c, &s); + } + } + } + + CiFreeClientEnumVLan(&t); + } +#endif // OS_WIN32 +} + +// Set the MAC address of all virtual LAN cards to random number +void CiChangeAllVLanMacAddress(CLIENT *c) +{ + RPC_CLIENT_ENUM_VLAN t; + // Validate arguments + if (c == NULL) + { + return; + } + + Zero(&t, sizeof(t)); + if (CtEnumVLan(c, &t)) + { + UINT i; + + for (i = 0;i < t.NumItem;i++) + { + RPC_CLIENT_ENUM_VLAN_ITEM *e = t.Items[i]; + UCHAR mac[6]; + + if (StrToMac(mac, e->MacAddress) && ((mac[0] == 0x00 && mac[1] == 0xAC) || (mac[0] == 0x5E))) + { + char *name = e->DeviceName; + RPC_CLIENT_SET_VLAN s; + UCHAR mac[6]; + + GenMacAddress(mac); + + Zero(&s, sizeof(s)); + StrCpy(s.DeviceName, sizeof(s.DeviceName), name); + + MacToStr(s.MacAddress, sizeof(s.MacAddress), mac); + + CtSetVLan(c, &s); + } + } + + CiFreeClientEnumVLan(&t); + } +} + +// Wait for preparation of notification service to complete +void CnWaitForCnServiceReady() +{ + UINT64 start_time = Tick64(); + + while ((start_time + (UINT64)CLIENT_WAIT_CN_READY_TIMEOUT) >= Tick64()) + { + if (CnIsCnServiceReady()) + { + break; + } + + SleepThread(100); + } +} + +// Check whether preparation of notification service completed +bool CnIsCnServiceReady() +{ + SOCK *s; + // Confirm running the notification service + if (CnCheckAlreadyExists(false) == false) + { + // Not running + return false; + } + + // Try to connect to the TCP port + s = ConnectEx("localhost", CLIENT_NOTIFY_PORT, 500); + if (s == NULL) + { + // The TCP port is not opened + return false; + } + + Disconnect(s); + ReleaseSock(s); + + // Running + return true; +} + +// Check whether the notification service is already running +bool CnCheckAlreadyExists(bool lock) +{ +#ifdef OS_WIN32 + return Win32CnCheckAlreadyExists(lock); +#else + return false; +#endif +} + +typedef struct CNC_STATUS_PRINTER_WINDOW_PARAM +{ + THREAD *Thread; + SESSION *Session; + SOCK *Sock; +} CNC_STATUS_PRINTER_WINDOW_PARAM; + +typedef struct CNC_CONNECT_ERROR_DLG_THREAD_PARAM +{ + SESSION *Session; + SOCK *Sock; + bool HaltThread; + EVENT *Event; +} CNC_CONNECT_ERROR_DLG_THREAD_PARAM; + +// Thread to stop forcibly the Certificate check dialog client +void CncCheckCertHaltThread(THREAD *thread, void *param) +{ + CNC_CONNECT_ERROR_DLG_THREAD_PARAM *dp = (CNC_CONNECT_ERROR_DLG_THREAD_PARAM *)param; + // Validate arguments + if (thread == NULL || param == NULL) + { + return; + } + + while (true) + { + if (dp->Session->Halt || dp->HaltThread) + { + break; + } + + Wait(dp->Event, 100); + } + + Disconnect(dp->Sock); +} + +// Show the certification check dialog +void CncCheckCert(SESSION *session, UI_CHECKCERT *dlg) +{ + SOCK *s; + PACK *p; + CNC_CONNECT_ERROR_DLG_THREAD_PARAM *dp; + THREAD *t; + // Validate arguments + if (dlg == NULL || session == NULL) + { + return; + } + + s = CncConnect(); + if (s == NULL) + { + return; + } + + p = NewPack(); + PackAddStr(p, "function", "check_cert"); + PackAddUniStr(p, "AccountName", dlg->AccountName); + PackAddStr(p, "ServerName", dlg->ServerName); + PackAddX(p, "x", dlg->x); + PackAddX(p, "parent_x", dlg->parent_x); + PackAddX(p, "old_x", dlg->old_x); + PackAddBool(p, "DiffWarning", dlg->DiffWarning); + PackAddBool(p, "Ok", dlg->Ok); + PackAddBool(p, "SaveServerCert", dlg->SaveServerCert); + + SendPack(s, p); + FreePack(p); + + dp = ZeroMalloc(sizeof(CNC_CONNECT_ERROR_DLG_THREAD_PARAM)); + dp->Sock = s; + dp->Event = NewEvent(); + dp->Session = session; + + t = NewThread(CncCheckCertHaltThread, dp); + + p = RecvPack(s); + if (p != NULL) + { + dlg->Ok = PackGetBool(p, "Ok"); + dlg->DiffWarning = PackGetBool(p, "DiffWarning"); + dlg->SaveServerCert = PackGetBool(p, "SaveServerCert"); + + FreePack(p); + } + + dp->HaltThread = true; + Set(dp->Event); + + WaitThread(t, INFINITE); + + ReleaseEvent(dp->Event); + Free(dp); + ReleaseThread(t); + + Disconnect(s); + ReleaseSock(s); +} + +// Smart card signature dialog +bool CncSecureSignDlg(SECURE_SIGN *sign) +{ + SOCK *s; + PACK *p; + bool ret = false; + // Validate arguments + if (sign == NULL) + { + return false; + } + + s = CncConnect(); + if (s == NULL) + { + return false; + } + + p = NewPack(); + PackAddStr(p, "function", "secure_sign"); + OutRpcSecureSign(p, sign); + + SendPack(s, p); + FreePack(p); + + p = RecvPack(s); + if (p != NULL) + { + ret = PackGetBool(p, "ret"); + + if (ret) + { + FreeRpcSecureSign(sign); + + Zero(sign, sizeof(SECURE_SIGN)); + InRpcSecureSign(sign, p); + } + + FreePack(p); + } + + Disconnect(s); + ReleaseSock(s); + + return ret; +} + +// Show the NIC information dialog +SOCK *CncNicInfo(UI_NICINFO *info) +{ + SOCK *s; + PACK *p; + // Validate arguments + if (info == NULL) + { + return NULL; + } + + s = CncConnectEx(200); + if (s == NULL) + { + return NULL; + } + + p = NewPack(); + PackAddStr(p, "function", "nicinfo"); + PackAddStr(p, "NicName", info->NicName); + PackAddUniStr(p, "AccountName", info->AccountName); + + SendPack(s, p); + FreePack(p); + + return s; +} + +// Close the NIC information dialog +void CncNicInfoFree(SOCK *s) +{ + // Validate arguments + if (s == NULL) + { + return; + } + + Disconnect(s); + ReleaseSock(s); +} + +// Show the message dialog +SOCK *CncMsgDlg(UI_MSG_DLG *dlg) +{ + SOCK *s; + PACK *p; + char *utf; + // Validate arguments + if (dlg == NULL) + { + return NULL; + } + + s = CncConnectEx(200); + if (s == NULL) + { + return NULL; + } + + p = NewPack(); + PackAddStr(p, "function", "msg_dialog"); + PackAddStr(p, "ServerName", dlg->ServerName); + PackAddStr(p, "HubName", dlg->HubName); + utf = CopyUniToUtf(dlg->Msg); + PackAddData(p, "Msg", utf, StrLen(utf)); + Free(utf); + + SendPack(s, p); + FreePack(p); + + return s; +} + +// Close the message dialog +void CndMsgDlgFree(SOCK *s) +{ + // Validate arguments + if (s == NULL) + { + return; + } + + Disconnect(s); + ReleaseSock(s); +} + +// Show the password input dialog +bool CncPasswordDlg(SESSION *session, UI_PASSWORD_DLG *dlg) +{ + SOCK *s; + PACK *p; + CNC_CONNECT_ERROR_DLG_THREAD_PARAM *dp; + THREAD *t; + bool ret = false; + // Validate arguments + if (dlg == NULL || session == NULL) + { + return false; + } + + s = CncConnect(); + if (s == NULL) + { + Wait(session->HaltEvent, session->RetryInterval); + return true; + } + + p = NewPack(); + PackAddStr(p, "function", "password_dialog"); + PackAddInt(p, "Type", dlg->Type); + PackAddStr(p, "Username", dlg->Username); + PackAddStr(p, "Password", dlg->Password); + PackAddStr(p, "ServerName", dlg->ServerName); + PackAddInt(p, "RetryIntervalSec", dlg->RetryIntervalSec); + PackAddBool(p, "ProxyServer", dlg->ProxyServer); + PackAddBool(p, "AdminMode", dlg->AdminMode); + PackAddBool(p, "ShowNoSavePassword", dlg->ShowNoSavePassword); + PackAddBool(p, "NoSavePassword", dlg->NoSavePassword); + + SendPack(s, p); + FreePack(p); + + dp = ZeroMalloc(sizeof(CNC_CONNECT_ERROR_DLG_THREAD_PARAM)); + dp->Session = session; + dp->Sock = s; + dp->Event = NewEvent(); + + t = NewThread(CncConnectErrorDlgHaltThread, dp); + + p = RecvPack(s); + if (p != NULL) + { + ret = PackGetBool(p, "ok"); + dlg->NoSavePassword = PackGetBool(p, "NoSavePassword"); + dlg->ProxyServer = PackGetBool(p, "ProxyServer"); + dlg->Type = PackGetInt(p, "Type"); + PackGetStr(p, "Username", dlg->Username, sizeof(dlg->Username)); + PackGetStr(p, "Password", dlg->Password, sizeof(dlg->Password)); + + FreePack(p); + } + + dp->HaltThread = true; + Set(dp->Event); + + WaitThread(t, INFINITE); + + ReleaseEvent(dp->Event); + Free(dp); + ReleaseThread(t); + + Disconnect(s); + ReleaseSock(s); + + return ret; +} + +// Thread to stop the connection error dialog client forcibly +void CncConnectErrorDlgHaltThread(THREAD *thread, void *param) +{ + CNC_CONNECT_ERROR_DLG_THREAD_PARAM *dp = (CNC_CONNECT_ERROR_DLG_THREAD_PARAM *)param; + // Validate arguments + if (thread == NULL || param == NULL) + { + return; + } + + while (true) + { + if (dp->Session->Halt || dp->HaltThread) + { + break; + } + + Wait(dp->Event, 100); + } + + Disconnect(dp->Sock); +} + +// Show the connection error dialog +bool CncConnectErrorDlg(SESSION *session, UI_CONNECTERROR_DLG *dlg) +{ + SOCK *s; + PACK *p; + CNC_CONNECT_ERROR_DLG_THREAD_PARAM *dp; + THREAD *t; + bool ret = false; + // Validate arguments + if (dlg == NULL || session == NULL) + { + return false; + } + + s = CncConnect(); + if (s == NULL) + { + Wait(session->HaltEvent, session->RetryInterval); + return true; + } + + p = NewPack(); + PackAddStr(p, "function", "connecterror_dialog"); + PackAddUniStr(p, "AccountName", dlg->AccountName); + PackAddStr(p, "ServerName", dlg->ServerName); + PackAddInt(p, "Err", dlg->Err); + PackAddInt(p, "CurrentRetryCount", dlg->CurrentRetryCount); + PackAddInt(p, "RetryLimit", dlg->RetryLimit); + PackAddInt(p, "RetryIntervalSec", dlg->RetryIntervalSec); + PackAddBool(p, "HideWindow", dlg->HideWindow); + + SendPack(s, p); + FreePack(p); + + dp = ZeroMalloc(sizeof(CNC_CONNECT_ERROR_DLG_THREAD_PARAM)); + dp->Session = session; + dp->Sock = s; + dp->Event = NewEvent(); + + t = NewThread(CncConnectErrorDlgHaltThread, dp); + + p = RecvPack(s); + if (p != NULL) + { + ret = PackGetBool(p, "ok"); + dlg->HideWindow = PackGetBool(p, "HideWindow"); + + FreePack(p); + } + + dp->HaltThread = true; + Set(dp->Event); + + WaitThread(t, INFINITE); + + ReleaseEvent(dp->Event); + Free(dp); + ReleaseThread(t); + + Disconnect(s); + ReleaseSock(s); + + return ret; +} + +// Thread for the status indicator client +void CncStatusPrinterWindowThreadProc(THREAD *thread, void *param) +{ + CNC_STATUS_PRINTER_WINDOW_PARAM *pp; + SOCK *sock; + PACK *p; + // Validate arguments + if (thread == NULL || param == NULL) + { + return; + } + + pp = (CNC_STATUS_PRINTER_WINDOW_PARAM *)param; + sock = pp->Sock; + pp->Thread = thread; + AddRef(pp->Thread->ref); + + NoticeThreadInit(thread); + + p = RecvPack(sock); + if (p != NULL) + { + // Stop the session + StopSessionEx(pp->Session, true); + + FreePack(p); + } +} + +// Create a status indicator client +SOCK *CncStatusPrinterWindowStart(SESSION *s) +{ + SOCK *sock; + PACK *p; + THREAD *t; + CNC_STATUS_PRINTER_WINDOW_PARAM *param; + // Validate arguments + if (s == NULL) + { + return NULL; + } + + sock = CncConnect(); + + if (sock == NULL) + { + return NULL; + } + + p = NewPack(); + PackAddStr(p, "function", "status_printer"); + PackAddUniStr(p, "account_name", s->Account->ClientOption->AccountName); + + if (SendPack(sock, p) == false) + { + FreePack(p); + ReleaseSock(sock); + + return NULL; + } + + FreePack(p); + + param = ZeroMalloc(sizeof(CNC_STATUS_PRINTER_WINDOW_PARAM)); + param->Sock = sock; + param->Session = s; + + sock->Param = param; + + t = NewThread(CncStatusPrinterWindowThreadProc, param); + WaitThreadInit(t); + + ReleaseThread(t); + + return sock; +} + +// Send a string to the status indicator +void CncStatusPrinterWindowPrint(SOCK *s, wchar_t *str) +{ + PACK *p; + // Validate arguments + if (s == NULL || str == NULL) + { + return; + } + + p = NewPack(); + PackAddUniStr(p, "string", str); + SendPack(s, p); + FreePack(p); +} + +// Stop the status indicator client +void CncStatusPrinterWindowStop(SOCK *s) +{ + CNC_STATUS_PRINTER_WINDOW_PARAM *param; + // Validate arguments + if (s == NULL) + { + return; + } + + param = (CNC_STATUS_PRINTER_WINDOW_PARAM *)s->Param; + + // Disconnect the client socket + Disconnect(s); + + // Terminate the thread + WaitThread(param->Thread, INFINITE); + ReleaseThread(param->Thread); + + Free(param); + ReleaseSock(s); +} + +// Start the driver installer for Windows Vista +bool CncExecDriverInstaller(char *arg) +{ + SOCK *s = CncConnect(); + PACK *p; + bool ret; + if (s == NULL) + { + return false; + } + + p = NewPack(); + PackAddStr(p, "function", "exec_driver_installer"); + PackAddStr(p, "arg", arg); + + SendPack(s, p); + FreePack(p); + + p = RecvPack(s); + if (p == NULL) + { + Disconnect(s); + ReleaseSock(s); + return false; + } + + ret = PackGetBool(p, "ret"); + + FreePack(p); + + Disconnect(s); + ReleaseSock(s); + + return ret; +} + +// Let the current running client notification services releasing the socket +void CncReleaseSocket() +{ + SOCK *s = CncConnect(); + PACK *p; + if (s == NULL) + { + return; + } + + p = NewPack(); + PackAddStr(p, "function", "release_socket"); + +#ifdef OS_WIN32 + PackAddInt(p, "pid", MsGetProcessId()); +#endif // OS_WIN32 + + SendPack(s, p); + FreePack(p); + + Disconnect(s); + ReleaseSock(s); +} + +// Terminate the process of the client notification service +void CncExit() +{ + SOCK *s = CncConnectEx(256); + PACK *p; + if (s != NULL) + { + p = NewPack(); + PackAddStr(p, "function", "exit"); + + SendPack(s, p); + + FreePack(p); + + FreePack(RecvPack(s)); + + Disconnect(s); + ReleaseSock(s); + } + +#ifdef OS_WIN32 + MsKillOtherInstanceEx("vpnclient"); +#endif // OS_WIN32 +} + +// Connect to the client notification service +SOCK *CncConnect() +{ + return CncConnectEx(0); +} +SOCK *CncConnectEx(UINT timeout) +{ + SOCK *s = ConnectEx("localhost", CLIENT_NOTIFY_PORT, timeout); + + return s; +} + +#ifdef OS_WIN32 + +// Thread for the certificate check dialog +void Win32CnCheckCertThreadProc(THREAD *thread, void *param) +{ + UI_CHECKCERT *dlg; + // Validate arguments + if (thread == NULL || param == NULL) + { + return; + } + + dlg = (UI_CHECKCERT *)param; + + CheckCertDlg(dlg); + { + PACK *p = NewPack(); + + PackAddBool(p, "Ok", dlg->Ok); + PackAddBool(p, "SaveServerCert", dlg->SaveServerCert); + + SendPack(dlg->Sock, p); + FreePack(p); + + FreePack(RecvPack(dlg->Sock)); + } + + Disconnect(dlg->Sock); +} + +// Certificate check dialog +void Win32CnCheckCert(SOCK *s, PACK *p) +{ + UI_CHECKCERT dlg; + THREAD *t; + Zero(&dlg, sizeof(dlg)); + // Validate arguments + if (s == NULL || p == NULL) + { + return; + } + + PackGetUniStr(p, "AccountName", dlg.AccountName, sizeof(dlg.AccountName)); + PackGetStr(p, "ServerName", dlg.ServerName, sizeof(dlg.ServerName)); + dlg.x = PackGetX(p, "x"); + dlg.parent_x = PackGetX(p, "parent_x"); + dlg.old_x = PackGetX(p, "old_x"); + dlg.DiffWarning = PackGetBool(p, "DiffWarning"); + dlg.Ok = PackGetBool(p, "Ok"); + dlg.SaveServerCert = PackGetBool(p, "SaveServerCert"); + dlg.Sock = s; + + t = NewThread(Win32CnCheckCertThreadProc, &dlg); + + FreePack(RecvPack(s)); + + dlg.Halt = true; + + WaitThread(t, INFINITE); + ReleaseThread(t); + + FreeX(dlg.parent_x); + FreeX(dlg.old_x); + FreeX(dlg.x); +} + +// Message display dialog thread procedure +void Win32CnMsgDlgThreadProc(THREAD *thread, void *param) +{ + UI_MSG_DLG *dlg = (UI_MSG_DLG *)param; + wchar_t tmp[MAX_SIZE]; + char url[MAX_SIZE]; + // Validate arguments + if (thread == NULL || dlg == NULL) + { + return; + } + + UniFormat(tmp, sizeof(tmp), _UU("CM_MSG_TITLE"), + dlg->ServerName, dlg->HubName); + + if (IsURLMsg(dlg->Msg, url, sizeof(url)) == false) + { + OnceMsgEx(NULL, tmp, dlg->Msg, true, 167, &dlg->Halt); + } + else + { + if (MsExecute(url, NULL) == false) + { + OnceMsgEx(NULL, tmp, dlg->Msg, true, 167, &dlg->Halt); + } + } + + Disconnect(dlg->Sock); +} + +// NIC information dialog thread procedure +void Win32CnNicInfoThreadProc(THREAD *thread, void *param) +{ + UI_NICINFO *info = (UI_NICINFO *)param; + // Validate arguments + if (thread == NULL || info == NULL) + { + return; + } + + if (MsIsNt()) + { + // Do not show a dialog on Windows 9x system + NicInfo(info); + } + + Disconnect(info->Sock); +} + +// NIC information dialog +void Win32CnNicInfo(SOCK *s, PACK *p) +{ + UI_NICINFO info; + THREAD *t; + Zero(&info, sizeof(info)); + // Validate arguments + if (s == NULL || p == NULL) + { + return; + } + + PackGetStr(p, "NicName", info.NicName, sizeof(info.NicName)); + PackGetUniStr(p, "AccountName", info.AccountName, sizeof(info.AccountName)); + + info.Sock = s; + + t = NewThread(Win32CnNicInfoThreadProc, &info); + + FreePack(RecvPack(s)); + + info.Halt = true; + + WaitThread(t, INFINITE); + ReleaseThread(t); +} + +// Message display dialog +void Win32CnMsgDlg(SOCK *s, PACK *p) +{ + UI_MSG_DLG dlg; + THREAD *t; + UINT utf_size; + char *utf; + wchar_t *msg; + Zero(&dlg, sizeof(dlg)); + // Validate arguments + if (s == NULL || p == NULL) + { + return; + } + + PackGetStr(p, "ServerName", dlg.ServerName, sizeof(dlg.ServerName)); + PackGetStr(p, "HubName", dlg.HubName, sizeof(dlg.HubName)); + + utf_size = PackGetDataSize(p, "Msg"); + utf = ZeroMalloc(utf_size + 8); + + PackGetData(p, "Msg", utf); + + msg = CopyUtfToUni(utf); + Free(utf); + + dlg.Sock = s; + dlg.Msg = msg; + + t = NewThread(Win32CnMsgDlgThreadProc, &dlg); + + FreePack(RecvPack(s)); + + dlg.Halt = true; + + WaitThread(t, INFINITE); + ReleaseThread(t); + + Free(msg); +} + +// Thread for Password input dialog +void Win32CnPasswordDlgThreadProc(THREAD *thread, void *param) +{ + UI_PASSWORD_DLG *dlg; + // Validate arguments + if (thread == NULL || param == NULL) + { + return; + } + + dlg = (UI_PASSWORD_DLG *)param; + + if (PasswordDlg(NULL, dlg)) + { + PACK *p = NewPack(); + + PackAddBool(p, "ok", true); + PackAddStr(p, "Username", dlg->Username); + PackAddStr(p, "Password", dlg->Password); + PackAddInt(p, "Type", dlg->Type); + PackAddBool(p, "ProxyServer", dlg->ProxyServer); + PackAddBool(p, "NoSavePassword", dlg->NoSavePassword); + + SendPack(dlg->Sock, p); + FreePack(p); + + FreePack(RecvPack(dlg->Sock)); + } + + Disconnect(dlg->Sock); +} + +// Password input dialog +void Win32CnPasswordDlg(SOCK *s, PACK *p) +{ + UI_PASSWORD_DLG dlg; + THREAD *t = NULL; + Zero(&dlg, sizeof(dlg)); + // Validate arguments + if (s == NULL || p == NULL) + { + return; + } + + dlg.Type = PackGetInt(p, "Type"); + PackGetStr(p, "Username", dlg.Username, sizeof(dlg.Username)); + PackGetStr(p, "Password", dlg.Password, sizeof(dlg.Password)); + PackGetStr(p, "ServerName", dlg.ServerName, sizeof(dlg.ServerName)); + dlg.RetryIntervalSec = PackGetInt(p, "RetryIntervalSec"); + dlg.ProxyServer = PackGetBool(p, "ProxyServer"); + dlg.AdminMode = PackGetBool(p, "AdminMode"); + dlg.ShowNoSavePassword = PackGetBool(p, "ShowNoSavePassword"); + dlg.NoSavePassword = PackGetBool(p, "NoSavePassword"); + dlg.CancelEvent = NewEvent(); + dlg.Sock = s; + + t = NewThread(Win32CnPasswordDlgThreadProc, &dlg); + + FreePack(RecvPack(s)); + + Set(dlg.CancelEvent); + + WaitThread(t, INFINITE); + ReleaseEvent(dlg.CancelEvent); + ReleaseThread(t); +} + +// Thread for the connection error dialog +void Win32CnConnectErrorDlgThreadProc(THREAD *thread, void *param) +{ + UI_CONNECTERROR_DLG *dlg; + // Validate arguments + if (thread == NULL || param == NULL) + { + return; + } + + dlg = (UI_CONNECTERROR_DLG *)param; + + if (ConnectErrorDlg(dlg)) + { + PACK *p = NewPack(); + + PackAddBool(p, "ok", true); + PackAddBool(p, "HideWindow", dlg->HideWindow); + + SendPack(dlg->Sock, p); + FreePack(p); + + FreePack(RecvPack(dlg->Sock)); + } + + Disconnect(dlg->Sock); +} + +// Connection Error dialog (Win32) +void Win32CnConnectErrorDlg(SOCK *s, PACK *p) +{ + UI_CONNECTERROR_DLG dlg; + THREAD *t; + Zero(&dlg, sizeof(dlg)); + // Validate arguments + if (s == NULL || p == NULL) + { + return; + } + + PackGetUniStr(p, "AccountName", dlg.AccountName, sizeof(dlg.AccountName)); + PackGetStr(p, "ServerName", dlg.ServerName, sizeof(dlg.ServerName)); + dlg.Err = PackGetInt(p, "Err"); + dlg.CurrentRetryCount = PackGetInt(p, "CurrentRetryCount"); + dlg.RetryLimit = PackGetInt(p, "RetryLimit"); + dlg.RetryIntervalSec = PackGetInt(p, "RetryIntervalSec"); + dlg.HideWindow = PackGetBool(p, "HideWindow"); + dlg.CancelEvent = NewEvent(); + dlg.Sock = s; + + t = NewThread(Win32CnConnectErrorDlgThreadProc, &dlg); + + FreePack(RecvPack(s)); + + Set(dlg.CancelEvent); + + WaitThread(t, INFINITE); + ReleaseEvent(dlg.CancelEvent); + ReleaseThread(t); +} + +// Status indicator (Win32) +void Win32CnStatusPrinter(SOCK *s, PACK *p) +{ + STATUS_WINDOW *w; + wchar_t account_name[MAX_ACCOUNT_NAME_LEN + 1]; + // Validate arguments + if (s == NULL || p == NULL) + { + return; + } + + PackGetUniStr(p, "account_name", account_name, sizeof(account_name)); + + w = StatusPrinterWindowStart(s, account_name); + + while (true) + { + PACK *p = RecvPack(s); + + if (p == NULL) + { + // Exit the dialog because it is disconnected + break; + } + else + { + wchar_t tmp[MAX_SIZE]; + + // Rewrite the string + PackGetUniStr(p, "string", tmp, sizeof(tmp)); + + StatusPrinterWindowPrint(w, tmp); + + FreePack(p); + } + } + + StatusPrinterWindowStop(w); +} + +// Start the driver installer (for Windows Vista) +void Win32CnExecDriverInstaller(SOCK *s, PACK *p) +{ + char arg[MAX_SIZE]; + bool ret; + void *helper = NULL; + // Validate arguments + if (s == NULL || p == NULL) + { + return; + } + + if (PackGetStr(p, "arg", arg, sizeof(arg)) == false) + { + return; + } + + if (MsIsVista()) + { + helper = CmStartUacHelper(); + } + + ret = MsExecDriverInstaller(arg); + + CmStopUacHelper(helper); + + p = NewPack(); + PackAddBool(p, "ret", ret); + SendPack(s, p); + + FreePack(p); +} + +#endif // OS_WIN32 + +// Start the driver installer +void CnExecDriverInstaller(SOCK *s, PACK *p) +{ + // Validate arguments + if (s == NULL || p == NULL) + { + return; + } + +#ifdef OS_WIN32 + Win32CnExecDriverInstaller(s, p); +#endif // OS_WIN32 +} + +// Certificate confirmation dialog +void CnCheckCert(SOCK *s, PACK *p) +{ + // Validate arguments + if (s == NULL || p == NULL) + { + return; + } + +#ifdef OS_WIN32 + Win32CnCheckCert(s, p); +#endif // OS_WIN32 +} + +// NIC information dialog +void CnNicInfo(SOCK *s, PACK *p) +{ + // Validate arguments + if (s == NULL || p == NULL) + { + return; + } + +#ifdef OS_WIN32 + Win32CnNicInfo(s, p); +#endif // OS_WIN32 +} + +// Message display dialog +void CnMsgDlg(SOCK *s, PACK *p) +{ + // Validate arguments + if (s == NULL || p == NULL) + { + return; + } + +#ifdef OS_WIN32 + Win32CnMsgDlg(s, p); +#endif // OS_WIN32 +} + +// Password input dialog +void CnPasswordDlg(SOCK *s, PACK *p) +{ + // Validate arguments + if (s == NULL || p == NULL) + { + return; + } + +#ifdef OS_WIN32 + Win32CnPasswordDlg(s, p); +#endif // OS_WIN32 +} + +// Connection Error dialog +void CnConnectErrorDlg(SOCK *s, PACK *p) +{ + // Validate arguments + if (s == NULL || p == NULL) + { + return; + } + +#ifdef OS_WIN32 + Win32CnConnectErrorDlg(s, p); +#endif // OS_WIN32 +} + +// Status indicator +void CnStatusPrinter(SOCK *s, PACK *p) +{ + // Validate arguments + if (s == NULL || p == NULL) + { + return; + } + +#ifdef OS_WIN32 + Win32CnStatusPrinter(s, p); +#endif // OS_WIN32 +} +// Client notification service listener thread +void CnListenerProc(THREAD *thread, void *param) +{ + TCP_ACCEPTED_PARAM *data = (TCP_ACCEPTED_PARAM *)param; + SOCK *s; + PACK *p; + // Validate arguments + if (data == NULL || thread == NULL) + { + return; + } + +#ifdef OS_WIN32 + //Set Application ID + JL_SetCurrentProcessExplicitAppUserModelID(APPID_CM); +#endif // OS_WIN32 + + s = data->s; + AddRef(s->ref); + NoticeThreadInit(thread); + + if (s->LocalIP.addr[0] == 127) + { + p = RecvPack(s); + + if (p != NULL) + { + char function[MAX_SIZE]; + + if (PackGetStr(p, "function", function, sizeof(function))) + { + if (StrCmpi(function, "status_printer") == 0) + { + CnStatusPrinter(s, p); + } + else if (StrCmpi(function, "connecterror_dialog") == 0) + { + CnConnectErrorDlg(s, p); + } + else if (StrCmpi(function, "msg_dialog") == 0) + { + CnMsgDlg(s, p); + } + else if (StrCmpi(function, "nicinfo") == 0) + { + CnNicInfo(s, p); + } + else if (StrCmpi(function, "password_dialog") == 0) + { + CnPasswordDlg(s, p); + } + else if (StrCmpi(function, "secure_sign") == 0) + { + CnSecureSign(s, p); + } + else if (StrCmpi(function, "check_cert") == 0) + { + CnCheckCert(s, p); + } + else if (StrCmpi(function, "exit") == 0) + { +#ifdef OS_WIN32 + MsTerminateProcess(); +#else // OS_WIN32 + _exit(0); +#endif // OS_WIN32 + } + else if (StrCmpi(function, "get_session_id") == 0) + { + PACK *p = NewPack(); +#ifdef OS_WIN32 + PackAddInt(p, "session_id", MsGetCurrentTerminalSessionId()); +#endif // OS_WIN32 + SendPack(s, p); + FreePack(p); + } + else if (StrCmpi(function, "exec_driver_installer") == 0) + { + CnExecDriverInstaller(s, p); + } + else if (StrCmpi(function, "release_socket") == 0) + { + // Stop the listener + CnReleaseSocket(s, p); + } + } + + FreePack(p); + } + } + + Disconnect(s); + ReleaseSock(s); +} + +// Do the Secure Sign +void CnSecureSign(SOCK *s, PACK *p) +{ + SECURE_SIGN sign; + bool ret = false; + // Validate arguments + if (s == NULL || p == NULL) + { + return; + } + + Zero(&sign, sizeof(sign)); + InRpcSecureSign(&sign, p); + +#ifdef OS_WIN32 + // Win32: Show dialog + ret = Win32CiSecureSign(&sign); +#else // OS_WIN32 + // UNIX: not implemented + ret = false; +#endif // OS_WIN32 + + p = NewPack(); + + OutRpcSecureSign(p, &sign); + FreeRpcSecureSign(&sign); + + PackAddBool(p, "ret", ret); + + SendPack(s, p); + FreePack(p); +} + +// Stop the listener +void CnReleaseSocket(SOCK *s, PACK *p) +{ + UINT pid = 0; + UINT current_pid = 0; + // Validate arguments + if (s == NULL || p == NULL) + { + return; + } + + pid = PackGetInt(p, "pid"); + +#ifdef OS_WIN32 + current_pid = MsGetProcessId(); +#endif // OS_WIN32 + + if (current_pid == pid) + { + return; + } + + Lock(cn_listener_lock); + { + if (cn_listener != NULL) + { + if (cn_listener->Halt == false) + { + StopListener(cn_listener); + + cn_next_allow = Tick64() + (6 * 1000); + } + } + } + Unlock(cn_listener_lock); +} + +// Start the client notification service +void CnStart() +{ + CEDAR *cedar; + LISTENER *o; + UINT last_cursor_hash = 0; + bool last_session_active = false; + + cn_next_allow = 0; + cn_listener_lock = NewLock(); + +#ifdef OS_WIN32 + MsSetShutdownParameters(0xff, 0x00000001); + InitWinUi(_UU("CN_TITLE"), _SS("DEFAULT_FONT"), _II("DEFAULT_FONT_SIZE")); +#endif // OS_WIN32 + + cedar = NewCedar(NULL, NULL); + + if (CnCheckAlreadyExists(true)) + { + // Already started + ReleaseCedar(cedar); +#ifdef OS_WIN32 + FreeWinUi(); +#endif // OS_WIN32 + return; + } + +#ifdef OS_WIN32 + MsRegWriteInt(REG_CURRENT_USER, CM_REG_KEY, + "NotifyServerProcessId", MsGetProcessId()); +#endif // OS_WIN32 + + DisableDosProtect(); + +BEGIN_LISTENER: + Lock(cn_listener_lock); + cn_listener = o = NewListenerEx2(cedar, LISTENER_TCP, CLIENT_NOTIFY_PORT, CnListenerProc, NULL, true); + Unlock(cn_listener_lock); + + while (true) + { + UINT current_cursor_hash = 0; + bool cursor_changed = false; + +#ifdef OS_WIN32 + // Get the current cursor position + current_cursor_hash = MsGetCursorPosHash(); +#endif // OS_WIN32 + + if (last_cursor_hash != current_cursor_hash) + { + // Check the cursor position + cursor_changed = true; + last_cursor_hash = current_cursor_hash; + } + + Lock(cn_listener_lock); + + // Check the status periodically after that the listener has started + if (cn_listener->Status == LISTENER_STATUS_TRYING || cn_listener->Halt) + { + bool session_active = false; +#ifdef OS_WIN32 + session_active = MsIsCurrentTerminalSessionActive(); + if (cursor_changed) + { + // If the cursor position is changed but the terminal session is + // not active, the cursor position is regarded as not changed. + if (session_active == false) + { + cursor_changed = false; + } + } + if (last_session_active != session_active) + { + //If the cursor position doesn't changed but the terminal session + // became active than previous, the cursor position is regarded as changed. + last_session_active = session_active; + + if (session_active) + { + cursor_changed = true; + } + } +#endif // OS_WIN32 + + // If the port cannot be opened + if (cn_next_allow <= Tick64()) + { +#ifdef OS_WIN32 + if (cursor_changed) + { + // It can be judged to have the rights to open the port + // since the mouse cursor is moving. + // So, take over the port which is owned by other process forcibly + CncReleaseSocket(); + } +#endif // OS_WIN32 + + if (cn_listener->Halt) + { + ReleaseListener(cn_listener); + cn_listener = NULL; + + Unlock(cn_listener_lock); + goto BEGIN_LISTENER; + } + } + } + + Unlock(cn_listener_lock); + + SleepThread(1000); + } +} + +// Confirm whether the account file is parsed successfully +bool CiTryToParseAccount(BUF *b) +{ + RPC_CLIENT_CREATE_ACCOUNT *a; + // Validate arguments + if (b == NULL) + { + return false; + } + + a = CiCfgToAccount(b); + if (a != NULL) + { + CiFreeClientCreateAccount(a); + Free(a); + + return true; + } + else + { + return false; + } +} +bool CiTryToParseAccountFile(wchar_t *name) +{ + bool ret; + BUF *b; + // Validate arguments + if (name == NULL) + { + return false; + } + + b = ReadDumpW(name); + if (b == NULL) + { + return false; + } + + ret = CiTryToParseAccount(b); + + FreeBuf(b); + + return ret; +} + +// Confirm whether the account information includes sensitive information +bool CiHasAccountSensitiveInformation(BUF *b) +{ + RPC_CLIENT_CREATE_ACCOUNT *a; + bool ret = false; + // Validate arguments + if (b == NULL) + { + return false; + } + + a = CiCfgToAccount(b); + if (a == NULL) + { + return false; + } + + if (a->ClientAuth->AuthType == CLIENT_AUTHTYPE_PASSWORD) + { + ret = true; + } + else if (a->ClientAuth->AuthType == CLIENT_AUTHTYPE_PLAIN_PASSWORD) + { + ret = true; + } + + CiFreeClientCreateAccount(a); + Free(a); + + return ret; +} + +// Delete the sensitive information in the account information +bool CiEraseSensitiveInAccount(BUF *b) +{ + RPC_CLIENT_CREATE_ACCOUNT *a; + BUF *b2; + bool ret = false; + // Validate arguments + if (b == NULL) + { + return false; + } + + a = CiCfgToAccount(b); + if (a == NULL) + { + return false; + } + + if (a->ClientAuth->AuthType == CLIENT_AUTHTYPE_PASSWORD) + { + Zero(a->ClientAuth->HashedPassword, sizeof(a->ClientAuth->HashedPassword)); + ClearStr(a->ClientAuth->Username, sizeof(a->ClientAuth->Username)); + } + else if (a->ClientAuth->AuthType == CLIENT_AUTHTYPE_PLAIN_PASSWORD) + { + ClearStr(a->ClientAuth->PlainPassword, sizeof(a->ClientAuth->PlainPassword)); + ClearStr(a->ClientAuth->Username, sizeof(a->ClientAuth->Username)); + } + + b2 = CiAccountToCfg(a); + if (b2 != NULL) + { + ret = true; + + ClearBuf(b); + + WriteBuf(b, b2->Buf, b2->Size); + SeekBuf(b, 0, 0); + + FreeBuf(b2); + } + + CiFreeClientCreateAccount(a); + Free(a); + + return ret; +} + +// Read the account information from the buffer +RPC_CLIENT_CREATE_ACCOUNT *CiCfgToAccount(BUF *b) +{ + RPC_CLIENT_CREATE_ACCOUNT *t; + FOLDER *f; + ACCOUNT *a; + // Validate arguments + if (b == NULL) + { + return NULL; + } + + f = CfgBufTextToFolder(b); + if (f == NULL) + { + return NULL; + } + + a = CiLoadClientAccount(f); + + CfgDeleteFolder(f); + + if (a == NULL) + { + return NULL; + } + + DeleteLock(a->lock); + + t = ZeroMalloc(sizeof(RPC_CLIENT_CREATE_ACCOUNT)); + t->ClientOption = a->ClientOption; + t->ClientAuth = a->ClientAuth; + t->StartupAccount = a->StartupAccount; + t->CheckServerCert = a->CheckServerCert; + t->RetryOnServerCert = a->RetryOnServerCert; + t->ServerCert = a->ServerCert; + Free(a); + + return t; +} + +// Write the account information to a buffer +BUF *CiAccountToCfg(RPC_CLIENT_CREATE_ACCOUNT *t) +{ + BUF *b; + FOLDER *root; + ACCOUNT a; + // Validate arguments + if (t == NULL) + { + return NULL; + } + + root = CfgCreateFolder(NULL, TAG_ROOT); + Zero(&a, sizeof(a)); + a.ClientOption = t->ClientOption; + a.ClientAuth = t->ClientAuth; + a.CheckServerCert = t->CheckServerCert; + a.RetryOnServerCert = t->RetryOnServerCert; + a.ServerCert = t->ServerCert; + a.StartupAccount = t->StartupAccount; + + CiWriteAccountData(root, &a); + + b = CfgFolderToBufEx(root, true, true); + CfgDeleteFolder(root); + + return b; +} + +// RPC dispatch routine +PACK *CiRpcDispatch(RPC *rpc, char *name, PACK *p) +{ + PACK *ret; + CLIENT *c; + // Validate arguments + if (rpc == NULL || name == NULL || p == NULL) + { + return NULL; + } + c = rpc->Param; + + ret = NewPack(); + + if (StrCmpi(name, "GetClientVersion") == 0) + { + RPC_CLIENT_VERSION a; + if (CtGetClientVersion(c, &a) == false) + { + RpcError(ret, c->Err); + } + else + { + OutRpcClientVersion(ret, &a); + } + } + else if (StrCmpi(name, "GetCmSetting") == 0) + { + CM_SETTING a; + if (CtGetCmSetting(c, &a) == false) + { + RpcError(ret, c->Err); + } + else + { + OutRpcCmSetting(ret, &a); + } + } + else if (StrCmpi(name, "SetCmSetting") == 0) + { + CM_SETTING a; + Zero(&a, sizeof(a)); + InRpcCmSetting(&a, p); + if (CtSetCmSetting(c, &a) == false) + { + RpcError(ret, c->Err); + } + } + else if (StrCmpi(name, "SetPassword") == 0) + { + RPC_CLIENT_PASSWORD a; + InRpcClientPassword(&a, p); + if (CtSetPassword(c, &a) == false) + { + RpcError(ret, c->Err); + } + } + else if (StrCmpi(name, "GetPasswordSetting") == 0) + { + RPC_CLIENT_PASSWORD_SETTING a; + if (CtGetPasswordSetting(c, &a) == false) + { + RpcError(ret, c->Err); + } + else + { + OutRpcClientPasswordSetting(ret, &a); + } + } + else if (StrCmpi(name, "EnumCa") == 0) + { + RPC_CLIENT_ENUM_CA a; + if (CtEnumCa(c, &a) == false) + { + RpcError(ret, c->Err); + } + else + { + OutRpcClientEnumCa(ret, &a); + CiFreeClientEnumCa(&a); + } + } + else if (StrCmpi(name, "AddCa") == 0) + { + RPC_CERT a; + InRpcCert(&a, p); + if (CtAddCa(c, &a) == false) + { + RpcError(ret, c->Err); + } + FreeX(a.x); + } + else if (StrCmpi(name, "DeleteCa") == 0) + { + RPC_CLIENT_DELETE_CA a; + InRpcClientDeleteCa(&a, p); + if (CtDeleteCa(c, &a) == false) + { + RpcError(ret, c->Err); + } + } + else if (StrCmpi(name, "GetCa") == 0) + { + RPC_GET_CA a; + InRpcGetCa(&a, p); + if (CtGetCa(c, &a) == false) + { + RpcError(ret, c->Err); + } + else + { + OutRpcGetCa(ret, &a); + } + CiFreeGetCa(&a); + } + else if (StrCmpi(name, "EnumSecure") == 0) + { + RPC_CLIENT_ENUM_SECURE a; + if (CtEnumSecure(c, &a) == false) + { + RpcError(ret, c->Err); + } + else + { + OutRpcClientEnumSecure(ret, &a); + CiFreeClientEnumSecure(&a); + } + } + else if (StrCmpi(name, "UseSecure") == 0) + { + RPC_USE_SECURE a; + InRpcUseSecure(&a, p); + if (CtUseSecure(c, &a) == false) + { + RpcError(ret, c->Err); + } + } + else if (StrCmpi(name, "GetUseSecure") == 0) + { + RPC_USE_SECURE a; + Zero(&a, sizeof(a)); + if (CtGetUseSecure(c, &a) == false) + { + RpcError(ret, c->Err); + } + else + { + OutRpcUseSecure(ret, &a); + } + } + else if (StrCmpi(name, "EnumObjectInSecure") == 0) + { + RPC_ENUM_OBJECT_IN_SECURE a; + if (CtEnumObjectInSecure(c, &a) == false) + { + RpcError(ret, c->Err); + } + else + { + OutRpcEnumObjectInSecure(ret, &a); + CiFreeEnumObjectInSecure(&a); + } + } + else if (StrCmpi(name, "CreateVLan") == 0) + { + RPC_CLIENT_CREATE_VLAN a; + InRpcCreateVLan(&a, p); + if (CtCreateVLan(c, &a) == false) + { + RpcError(ret, c->Err); + } + } + else if (StrCmpi(name, "UpgradeVLan") == 0) + { + RPC_CLIENT_CREATE_VLAN a; + InRpcCreateVLan(&a, p); + if (CtUpgradeVLan(c, &a) == false) + { + RpcError(ret, c->Err); + } + } + else if (StrCmpi(name, "GetVLan") == 0) + { + RPC_CLIENT_GET_VLAN a; + InRpcClientGetVLan(&a, p); + if (CtGetVLan(c, &a) == false) + { + RpcError(ret, c->Err); + } + else + { + OutRpcClientGetVLan(ret, &a); + } + } + else if (StrCmpi(name, "SetVLan") == 0) + { + RPC_CLIENT_SET_VLAN a; + InRpcClientSetVLan(&a, p); + if (CtSetVLan(c, &a) == false) + { + RpcError(ret, c->Err); + } + } + else if (StrCmpi(name, "EnumVLan") == 0) + { + RPC_CLIENT_ENUM_VLAN a; + if (CtEnumVLan(c, &a) == false) + { + RpcError(ret, c->Err); + } + else + { + OutRpcClientEnumVLan(ret, &a); + CiFreeClientEnumVLan(&a); + } + } + else if (StrCmpi(name, "DeleteVLan") == 0) + { + RPC_CLIENT_CREATE_VLAN a; + InRpcCreateVLan(&a, p); + if (CtDeleteVLan(c, &a) == false) + { + RpcError(ret, c->Err); + } + } + else if (StrCmpi(name, "EnableVLan") == 0) + { + RPC_CLIENT_CREATE_VLAN a; + InRpcCreateVLan(&a, p); + if (CtEnableVLan(c, &a) == false) + { + RpcError(ret, c->Err); + } + } + else if (StrCmpi(name, "DisableVLan") == 0) + { + RPC_CLIENT_CREATE_VLAN a; + InRpcCreateVLan(&a, p); + if (CtDisableVLan(c, &a) == false) + { + RpcError(ret, c->Err); + } + } + else if (StrCmpi(name, "CreateAccount") == 0) + { + RPC_CLIENT_CREATE_ACCOUNT a; + InRpcClientCreateAccount(&a, p); + if (CtCreateAccount(c, &a, false) == false) + { + RpcError(ret, c->Err); + } + CiFreeClientCreateAccount(&a); + } + else if (StrCmpi(name, "EnumAccount") == 0) + { + RPC_CLIENT_ENUM_ACCOUNT a; + if (CtEnumAccount(c, &a) == false) + { + RpcError(ret, c->Err); + } + else + { + OutRpcClientEnumAccount(ret, &a); + CiFreeClientEnumAccount(&a); + } + } + else if (StrCmpi(name, "DeleteAccount") == 0) + { + RPC_CLIENT_DELETE_ACCOUNT a; + InRpcClientDeleteAccount(&a, p); + if (CtDeleteAccount(c, &a, false) == false) + { + RpcError(ret, c->Err); + } + } + else if (StrCmpi(name, "SetStartupAccount") == 0) + { + RPC_CLIENT_DELETE_ACCOUNT a; + InRpcClientDeleteAccount(&a, p); + if (CtSetStartupAccount(c, &a, false) == false) + { + RpcError(ret, c->Err); + } + } + else if (StrCmpi(name, "RemoveStartupAccount") == 0) + { + RPC_CLIENT_DELETE_ACCOUNT a; + InRpcClientDeleteAccount(&a, p); + if (CtRemoveStartupAccount(c, &a) == false) + { + RpcError(ret, c->Err); + } + } + else if (StrCmpi(name, "GetIssuer") == 0) + { + RPC_GET_ISSUER a; + InRpcGetIssuer(&a, p); + if (CtGetIssuer(c, &a)) + { + OutRpcGetIssuer(ret, &a); + } + else + { + RpcError(ret, c->Err); + } + CiFreeGetIssuer(&a); + } + else if (StrCmpi(name, "GetCommonProxySetting") == 0) + { + INTERNET_SETTING t; + InRpcInternetSetting(&t, p); + if (CtGetCommonProxySetting(c, &t)) + { + OutRpcInternetSetting(ret, &t); + } + else + { + RpcError(ret, c->Err); + } + } + else if (StrCmpi(name, "SetCommonProxySetting") == 0) + { + INTERNET_SETTING t; + InRpcInternetSetting(&t, p); + if (CtSetCommonProxySetting(c, &t)) + { + OutRpcInternetSetting(ret, &t); + } + else + { + RpcError(ret, c->Err); + } + } + else if (StrCmpi(name, "SetAccount") == 0) + { + RPC_CLIENT_CREATE_ACCOUNT a; + InRpcClientCreateAccount(&a, p); + if (CtSetAccount(c, &a, false) == false) + { + RpcError(ret, c->Err); + } + CiFreeClientCreateAccount(&a); + } + else if (StrCmpi(name, "GetAccount") == 0) + { + RPC_CLIENT_GET_ACCOUNT a; + InRpcClientGetAccount(&a, p); + if (CtGetAccount(c, &a) == false) + { + RpcError(ret, c->Err); + } + else + { + OutRpcClientGetAccount(ret, &a); + } + CiFreeClientGetAccount(&a); + } + else if (StrCmpi(name, "RenameAccount") == 0) + { + RPC_RENAME_ACCOUNT a; + InRpcRenameAccount(&a, p); + if (CtRenameAccount(c, &a, false) == false) + { + RpcError(ret, c->Err); + } + } + else if (StrCmpi(name, "SetClientConfig") == 0) + { + CLIENT_CONFIG a; + InRpcClientConfig(&a, p); + if (CtSetClientConfig(c, &a) == false) + { + RpcError(ret, c->Err); + } + } + else if (StrCmpi(name, "GetClientConfig") == 0) + { + CLIENT_CONFIG a; + if (CtGetClientConfig(c, &a) == false) + { + RpcError(ret, c->Err); + } + else + { + OutRpcClientConfig(ret, &a); + } + } + else if (StrCmpi(name, "Connect") == 0) + { + RPC_CLIENT_CONNECT a; + InRpcClientConnect(&a, p); + if (CtConnect(c, &a) == false) + { + RpcError(ret, c->Err); + } + } + else if (StrCmpi(name, "Disconnect") == 0) + { + RPC_CLIENT_CONNECT a; + InRpcClientConnect(&a, p); + if (CtDisconnect(c, &a, false) == false) + { + RpcError(ret, c->Err); + } + } + else if (StrCmpi(name, "GetAccountStatus") == 0) + { + RPC_CLIENT_GET_CONNECTION_STATUS a; + InRpcClientGetConnectionStatus(&a, p); + if (CtGetAccountStatus(c, &a) == false) + { + RpcError(ret, c->Err); + } + else + { + OutRpcClientGetConnectionStatus(ret, &a); + } + CiFreeClientGetConnectionStatus(&a); + } + else + { + FreePack(ret); + ret = NULL; + } + + return ret; +} + +// Set the CM_SETTING +UINT CcSetCmSetting(REMOTE_CLIENT *r, CM_SETTING *a) +{ + PACK *ret, *p; + UINT err; + // Validate arguments + if (r == NULL || a == NULL) + { + return ERR_INTERNAL_ERROR; + } + + p = NewPack(); + OutRpcCmSetting(p, a); + + ret = RpcCall(r->Rpc, "SetCmSetting", p); + + if (RpcIsOk(ret)) + { + FreePack(ret); + return 0; + } + else + { + err = RpcGetError(ret); + FreePack(ret); + return err; + } +} + +// Get the CM_SETTING +UINT CcGetCmSetting(REMOTE_CLIENT *r, CM_SETTING *a) +{ + PACK *ret; + // Validate arguments + if (r == NULL || a == NULL) + { + return ERR_INTERNAL_ERROR; + } + + ret = RpcCall(r->Rpc, "GetCmSetting", NULL); + + if (RpcIsOk(ret)) + { + InRpcCmSetting(a, ret); + FreePack(ret); + return 0; + } + else + { + UINT err = RpcGetError(ret); + FreePack(ret); + return err; + } +} + +// Get the client version +UINT CcGetClientVersion(REMOTE_CLIENT *r, RPC_CLIENT_VERSION *a) +{ + PACK *ret; + // Validate arguments + if (r == NULL || a == NULL) + { + return ERR_INTERNAL_ERROR; + } + + ret = RpcCall(r->Rpc, "GetClientVersion", NULL); + + if (RpcIsOk(ret)) + { + InRpcClientVersion(a, ret); + FreePack(ret); + return 0; + } + else + { + UINT err = RpcGetError(ret); + FreePack(ret); + return err; + } +} + +// Set the password +UINT CcSetPassword(REMOTE_CLIENT *r, RPC_CLIENT_PASSWORD *pass) +{ + PACK *ret, *p; + // Validate arguments + if (r == NULL || pass == NULL) + { + return ERR_INTERNAL_ERROR; + } + + p = NewPack(); + + OutRpcClientPassword(p, pass); + + ret = RpcCall(r->Rpc, "SetPassword", p); + + if (RpcIsOk(ret)) + { + FreePack(ret); + return 0; + } + else + { + UINT err = RpcGetError(ret); + FreePack(ret); + return err; + } +} + +// Get the password setting +UINT CcGetPasswordSetting(REMOTE_CLIENT *r, RPC_CLIENT_PASSWORD_SETTING *a) +{ + PACK *ret; + UINT err = 0; + // Validate arguments + if (r == NULL || a == NULL) + { + return ERR_INTERNAL_ERROR; + } + + ret = RpcCall(r->Rpc, "GetPasswordSetting", NULL); + + if (RpcIsOk(ret)) + { + InRpcClientPasswordSetting(a, ret); + } + else + { + err = RpcGetError(ret); + } + + FreePack(ret); + return err; +} + +// Enumerate the CA +UINT CcEnumCa(REMOTE_CLIENT *r, RPC_CLIENT_ENUM_CA *e) +{ + PACK *ret; + UINT err = 0; + // Validate arguments + if (r == NULL || e == NULL) + { + return ERR_INTERNAL_ERROR; + } + + ret = RpcCall(r->Rpc, "EnumCa", NULL); + + if (RpcIsOk(ret)) + { + InRpcClientEnumCa(e, ret); + } + else + { + err = RpcGetError(ret); + } + + FreePack(ret); + + return err; +} + +// Add the CA +UINT CcAddCa(REMOTE_CLIENT *r, RPC_CERT *cert) +{ + PACK *p, *ret; + UINT err = 0; + // Validate arguments + if (r == NULL || cert == NULL) + { + return ERR_INTERNAL_ERROR; + } + + p = NewPack(); + OutRpcCert(p, cert); + + ret = RpcCall(r->Rpc, "AddCa", p); + + if (RpcIsOk(ret) == false) + { + err = RpcGetError(ret); + } + + FreePack(ret); + + return err; +} + +// Delete the CA +UINT CcDeleteCa(REMOTE_CLIENT *r, RPC_CLIENT_DELETE_CA *c) +{ + PACK *p, *ret; + UINT err = 0; + // Validate arguments + if (r == NULL || c == NULL) + { + return ERR_INTERNAL_ERROR; + } + + p = NewPack(); + OutRpcClientDeleteCa(p, c); + + ret = RpcCall(r->Rpc, "DeleteCa", p); + + if (RpcIsOk(ret) == false) + { + err = RpcGetError(ret); + } + + FreePack(ret); + + return err; +} + +// Get the issuer +UINT CcGetIssuer(REMOTE_CLIENT *r, RPC_GET_ISSUER *a) +{ + PACK *p, *ret; + UINT err = 0; + // Validate arguments + if (r == NULL || a == NULL) + { + return ERR_INTERNAL_ERROR; + } + + p = NewPack(); + OutRpcGetIssuer(p, a); + + ret = RpcCall(r->Rpc, "GetIssuer", p); + + if (RpcIsOk(ret)) + { + if (a->x != NULL) + { + FreeX(a->x); + a->x = NULL; + } + InRpcGetIssuer(a, ret); + } + else + { + err = RpcGetError(ret); + } + + FreePack(ret); + + return err; +} + +// Get the CA +UINT CcGetCa(REMOTE_CLIENT *r, RPC_GET_CA *get) +{ + PACK *p, *ret; + UINT err = 0; + // Validate arguments + if (r == NULL || get == NULL) + { + return ERR_INTERNAL_ERROR; + } + + p = NewPack(); + OutRpcGetCa(p, get); + + ret = RpcCall(r->Rpc, "GetCa", p); + + if (RpcIsOk(ret)) + { + InRpcGetCa(get, ret); + } + else + { + err = RpcGetError(ret); + } + + FreePack(ret); + + return err; +} + +// Enumeration of the secure devices +UINT CcEnumSecure(REMOTE_CLIENT *r, RPC_CLIENT_ENUM_SECURE *e) +{ + PACK *ret; + UINT err = 0; + // Validate arguments + if (r == NULL || e == NULL) + { + return ERR_INTERNAL_ERROR; + } + + ret = RpcCall(r->Rpc, "EnumSecure", NULL); + + if (RpcIsOk(ret)) + { + InRpcClientEnumSecure(e, ret); + } + else + { + err = RpcGetError(ret); + } + + FreePack(ret); + + return err; +} + +// Get the secure device that the user is using +UINT CcGetUseSecure(REMOTE_CLIENT *r, RPC_USE_SECURE *sec) +{ + PACK *p, *ret; + UINT err = 0; + // Validate arguments + if (r == NULL || sec == NULL) + { + return ERR_INTERNAL_ERROR; + } + + p = NewPack(); + + ret = RpcCall(r->Rpc, "GetUseSecure", p); + + if (RpcIsOk(ret) == false) + { + err = RpcGetError(ret); + } + else + { + InRpcUseSecure(sec, ret); + } + + FreePack(ret); + + return err; +} + +// Use the secure device +UINT CcUseSecure(REMOTE_CLIENT *r, RPC_USE_SECURE *sec) +{ + PACK *p, *ret; + UINT err = 0; + // Validate arguments + if (r == NULL || sec == NULL) + { + return ERR_INTERNAL_ERROR; + } + + p = NewPack(); + OutRpcUseSecure(p, sec); + + ret = RpcCall(r->Rpc, "UseSecure", p); + + if (RpcIsOk(ret) == false) + { + err = RpcGetError(ret); + } + + FreePack(ret); + + return err; +} + +// Get a next recommended virtual LAN card name +bool CiGetNextRecommendedVLanName(REMOTE_CLIENT *r, char *name, UINT size) +{ + RPC_CLIENT_ENUM_VLAN t; + UINT i; + bool b; + UINT j; + bool ok = false; + // Validate arguments + if (r == NULL || name == NULL) + { + return false; + } + + Zero(&t, sizeof(t)); + + if (CcEnumVLan(r, &t) != ERR_NO_ERROR) + { + return false; + } + + for (i = 1;i < 128;i++) + { + char tmp[MAX_SIZE]; + + CiGenerateVLanRegulatedName(tmp, sizeof(tmp), i); + + b = false; + + for (j = 0;j < t.NumItem;j++) + { + if (StrCmpi(t.Items[j]->DeviceName, tmp) == 0) + { + b = true; + break; + } + } + + if (b == false) + { + ok = true; + + StrCpy(name, size, tmp); + break; + } + } + + if (ok) + { + CiFreeClientEnumVLan(&t); + } + + return true; +} + +// Generate a virtual LAN card name automatically +void CiGenerateVLanRegulatedName(char *name, UINT size, UINT i) +{ + // Validate arguments + if (name == NULL) + { + return; + } + + if (i == 1) + { + StrCpy(name, size, "VPN"); + } + else + { + Format(name, size, "VPN%u", i); + } +} + +// Examine whether the specified name is valid as a virtual LAN card name of Windows 8 and later? +bool CiIsValidVLanRegulatedName(char *name) +{ + UINT i; + // Validate arguments + if (name == NULL) + { + return false; + } + + for (i = 1;i < 128;i++) + { + char tmp[MAX_SIZE]; + + CiGenerateVLanRegulatedName(tmp, sizeof(tmp), i); + + if (StrCmpi(name, tmp) == 0) + { + return true; + } + } + + return false; +} + +// Create a VLAN +UINT CcCreateVLan(REMOTE_CLIENT *r, RPC_CLIENT_CREATE_VLAN *create) +{ + PACK *ret, *p; + UINT err = 0; + char *s = NULL; + // Validate arguments + if (r == NULL || create == NULL) + { + return ERR_INTERNAL_ERROR; + } + + p = NewPack(); + OutRpcCreateVLan(p, create); + +#ifdef OS_WIN32 + s = MsNoWarningSoundInit(); +#endif // OS_WIN32 + + ret = RpcCall(r->Rpc, "CreateVLan", p); + +#ifdef OS_WIN32 + MsNoWarningSoundFree(s); +#endif // OS_WIN32 + + if (RpcIsOk(ret) == false) + { + err = RpcGetError(ret); + } + + FreePack(ret); + + return err; +} + +// Upgrade the VLAN +UINT CcUpgradeVLan(REMOTE_CLIENT *r, RPC_CLIENT_CREATE_VLAN *create) +{ + PACK *ret, *p; + UINT err = 0; + char *s = NULL; + // Validate arguments + if (r == NULL || create == NULL) + { + return ERR_INTERNAL_ERROR; + } + + p = NewPack(); + OutRpcCreateVLan(p, create); + +#ifdef OS_WIN32 + s = MsNoWarningSoundInit(); +#endif // OS_WIN32 + + ret = RpcCall(r->Rpc, "UpgradeVLan", p); + +#ifdef OS_WIN32 + MsNoWarningSoundFree(s); +#endif // OS_WIN32 + + + if (RpcIsOk(ret) == false) + { + err = RpcGetError(ret); + } + + FreePack(ret); + + return err; +} + +// Get the VLAN +UINT CcGetVLan(REMOTE_CLIENT *r, RPC_CLIENT_GET_VLAN *get) +{ + PACK *ret, *p; + UINT err = 0; + // Validate arguments + if (r == NULL || get == NULL) + { + return ERR_INTERNAL_ERROR; + } + + p = NewPack(); + OutRpcClientGetVLan(p, get); + + ret = RpcCall(r->Rpc, "GetVLan", p); + + if (RpcIsOk(ret)) + { + InRpcClientGetVLan(get, ret); + } + else + { + err = RpcGetError(ret); + } + + FreePack(ret); + + return err; +} + +// VLAN configuration +UINT CcSetVLan(REMOTE_CLIENT *r, RPC_CLIENT_SET_VLAN *set) +{ + PACK *ret, *p; + UINT err = 0; + // Validate arguments + if (r == NULL || set == NULL) + { + return ERR_INTERNAL_ERROR; + } + + p = NewPack(); + OutRpcClientSetVLan(p, set); + + ret = RpcCall(r->Rpc, "SetVLan", p); + + if (RpcIsOk(ret) == false) + { + err = RpcGetError(ret); + } + + FreePack(ret); + + return err; +} + +// Enumeration of VLAN +UINT CcEnumVLan(REMOTE_CLIENT *r, RPC_CLIENT_ENUM_VLAN *e) +{ + PACK *ret; + UINT err = 0; + // Validate arguments + if (r == NULL || e == NULL) + { + return ERR_INTERNAL_ERROR; + } + + ret = RpcCall(r->Rpc, "EnumVLan", NULL); + + if (RpcIsOk(ret)) + { + InRpcClientEnumVLan(e, ret); + } + else + { + err = RpcGetError(ret); + } + + FreePack(ret); + + return err; +} + +// Delete the VLAN +UINT CcDeleteVLan(REMOTE_CLIENT *r, RPC_CLIENT_CREATE_VLAN *d) +{ + PACK *ret, *p; + UINT err = 0; + // Validate arguments + if (r == NULL || d == NULL) + { + return ERR_INTERNAL_ERROR; + } + + p = NewPack(); + OutRpcCreateVLan(p, d); + + ret = RpcCall(r->Rpc, "DeleteVLan", p); + + if (RpcIsOk(ret) == false) + { + err = RpcGetError(ret); + } + + FreePack(ret); + + return err; +} + +// Enable the VLAN +UINT CcEnableVLan(REMOTE_CLIENT *r, RPC_CLIENT_CREATE_VLAN *vlan) +{ + PACK *ret, *p; + UINT err = 0; + // Validate arguments + if (r == NULL || vlan == NULL) + { + return ERR_INTERNAL_ERROR; + } + + p = NewPack(); + OutRpcCreateVLan(p, vlan); + + ret = RpcCall(r->Rpc, "EnableVLan", p); + + if (RpcIsOk(ret) == false) + { + err = RpcGetError(ret); + } + + FreePack(ret); + + return err; +} + +// Disable the VLAN +UINT CcDisableVLan(REMOTE_CLIENT *r, RPC_CLIENT_CREATE_VLAN *vlan) +{ + PACK *ret, *p; + UINT err = 0; + // Validate arguments + if (r == NULL || vlan == NULL) + { + return ERR_INTERNAL_ERROR; + } + + p = NewPack(); + OutRpcCreateVLan(p, vlan); + + ret = RpcCall(r->Rpc, "DisableVLan", p); + + if (RpcIsOk(ret) == false) + { + err = RpcGetError(ret); + } + + FreePack(ret); + + return err; +} + +// Create an Account +UINT CcCreateAccount(REMOTE_CLIENT *r, RPC_CLIENT_CREATE_ACCOUNT *a) +{ + PACK *ret, *p; + UINT err = 0; + // Validate arguments + if (r == NULL || a == NULL) + { + return ERR_INTERNAL_ERROR; + } + + p = NewPack(); + OutRpcClientCreateAccount(p, a); + + ret = RpcCall(r->Rpc, "CreateAccount", p); + + if (RpcIsOk(ret) == false) + { + err = RpcGetError(ret); + } + + FreePack(ret); + + return err; +} + +// Enumeration of accounts +UINT CcEnumAccount(REMOTE_CLIENT *r, RPC_CLIENT_ENUM_ACCOUNT *e) +{ + PACK *ret; + UINT err = 0; + // Validate arguments + if (r == NULL || e == NULL) + { + return ERR_INTERNAL_ERROR; + } + + ret = RpcCall(r->Rpc, "EnumAccount", NULL); + + if (RpcIsOk(ret)) + { + UINT i; + InRpcClientEnumAccount(e, ret); + + for (i = 0;i < e->NumItem;i++) + { + RPC_CLIENT_ENUM_ACCOUNT_ITEM *t = e->Items[i]; + + if (IsEmptyStr(t->HubName) && t->Port == 0) + { + UINT err2; + RPC_CLIENT_GET_ACCOUNT a; + + // Because the Client Manager can not get the port number and HUB name + // when enumerating in the VPN Client of the old version, get these separately. + Zero(&a, sizeof(a)); + UniStrCpy(a.AccountName, sizeof(a.AccountName), t->AccountName); + err2 = CcGetAccount(r, &a); + if (err2 == ERR_NO_ERROR) + { + StrCpy(t->HubName, sizeof(t->HubName), a.ClientOption->HubName); + t->Port = a.ClientOption->Port; + + CiFreeClientGetAccount(&a); + } + } + } + } + else + { + err = RpcGetError(ret); + } + + FreePack(ret); + + return err; +} + +// Unset the startup flag of the account +UINT CcRemoveStartupAccount(REMOTE_CLIENT *r, RPC_CLIENT_DELETE_ACCOUNT *a) +{ + PACK *ret, *p; + UINT err = 0; + // Validate arguments + if (r == NULL || a == NULL) + { + return ERR_INTERNAL_ERROR; + } + + p = NewPack(); + OutRpcClientDeleteAccount(p, a); + + ret = RpcCall(r->Rpc, "RemoveStartupAccount", p); + + if (RpcIsOk(ret) == false) + { + err = RpcGetError(ret); + } + + FreePack(ret); + + return err; +} + +// Set to start-up flag of the account +UINT CcSetStartupAccount(REMOTE_CLIENT *r, RPC_CLIENT_DELETE_ACCOUNT *a) +{ + PACK *ret, *p; + UINT err = 0; + // Validate arguments + if (r == NULL || a == NULL) + { + return ERR_INTERNAL_ERROR; + } + + p = NewPack(); + OutRpcClientDeleteAccount(p, a); + + ret = RpcCall(r->Rpc, "SetStartupAccount", p); + + if (RpcIsOk(ret) == false) + { + err = RpcGetError(ret); + } + + FreePack(ret); + + return err; +} + +// Delete the account +UINT CcDeleteAccount(REMOTE_CLIENT *r, RPC_CLIENT_DELETE_ACCOUNT *a) +{ + PACK *ret, *p; + UINT err = 0; + // Validate arguments + if (r == NULL || a == NULL) + { + return ERR_INTERNAL_ERROR; + } + + p = NewPack(); + OutRpcClientDeleteAccount(p, a); + + ret = RpcCall(r->Rpc, "DeleteAccount", p); + + if (RpcIsOk(ret) == false) + { + err = RpcGetError(ret); + } + + FreePack(ret); + + return err; +} + +// Account setting +UINT CcSetAccount(REMOTE_CLIENT *r, RPC_CLIENT_CREATE_ACCOUNT *a) +{ + PACK *ret, *p; + UINT err = 0; + // Validate arguments + if (r == NULL || a == NULL) + { + return ERR_INTERNAL_ERROR; + } + + p = NewPack(); + OutRpcClientCreateAccount(p, a); + + ret = RpcCall(r->Rpc, "SetAccount", p); + + if (RpcIsOk(ret) == false) + { + err = RpcGetError(ret); + } + + FreePack(ret); + + return err; +} + +// Get the account +UINT CcGetAccount(REMOTE_CLIENT *r, RPC_CLIENT_GET_ACCOUNT *a) +{ + PACK *ret, *p; + UINT err = 0; + // Validate arguments + if (r == NULL || a == NULL) + { + return ERR_INTERNAL_ERROR; + } + + p = NewPack(); + OutRpcClientGetAccount(p, a); + + ret = RpcCall(r->Rpc, "GetAccount", p); + + if (RpcIsOk(ret)) + { + InRpcClientGetAccount(a, ret); + } + else + { + err = RpcGetError(ret); + } + + FreePack(ret); + + return err; +} + +// Change the account name +UINT CcRenameAccount(REMOTE_CLIENT *r, RPC_RENAME_ACCOUNT *rename) +{ + PACK *p, *ret; + UINT err = 0; + // Validate arguments + if (r == NULL || rename == NULL) + { + return ERR_INTERNAL_ERROR; + } + + p = NewPack(); + OutRpcRenameAccount(p, rename); + + ret = RpcCall(r->Rpc, "RenameAccount", p); + + if (RpcIsOk(ret) == false) + { + err = RpcGetError(ret); + } + + FreePack(ret); + + return err; +} + +// Set the Client configuration +UINT CcSetClientConfig(REMOTE_CLIENT *r, CLIENT_CONFIG *o) +{ + PACK *p, *ret; + UINT err = 0; + // Validate arguments + if (r == NULL || o == NULL) + { + return ERR_INTERNAL_ERROR; + } + + p = NewPack(); + OutRpcClientConfig(p, o); + + ret = RpcCall(r->Rpc, "SetClientConfig", p); + + if (RpcIsOk(ret) == false) + { + err = RpcGetError(ret); + } + + FreePack(ret); + + return err; +} + +// Get the client configuration +UINT CcGetClientConfig(REMOTE_CLIENT *r, CLIENT_CONFIG *o) +{ + PACK *ret; + UINT err = 0; + // Validate arguments + if (r == NULL || o == NULL) + { + return ERR_INTERNAL_ERROR; + } + + ret = RpcCall(r->Rpc, "GetClientConfig", NULL); + + if (RpcIsOk(ret)) + { + InRpcClientConfig(o, ret); + } + else + { + err = RpcGetError(ret); + } + + FreePack(ret); + + return err; +} + +// Set the service to foreground process +void CcSetServiceToForegroundProcess(REMOTE_CLIENT *r) +{ + // Validate arguments + if (r == NULL) + { + return; + } + // Abolition +/* + if (r->Rpc != NULL && r->Rpc->Sock != NULL && r->Rpc->Sock->RemoteIP.addr[0] == 127) + { + if (OS_IS_WINDOWS_NT(GetOsInfo()->OsType) && + GET_KETA(GetOsInfo()->OsType, 100) >= 2) + { + // Only on a Windows 2000 or later + RPC_CLIENT_VERSION v; + Zero(&v, sizeof(v)); + + if (r->ClientBuildInt == 0) + { + CcGetClientVersion(r, &v); + r->ClientBuildInt = v.ClientBuildInt; + r->ProcessId = v.ProcessId; + } + if (r->ProcessId != 0 && r->ClientBuildInt <= 5080) + { +#ifdef OS_WIN32 + // Set the service process as a foreground window + AllowFGWindow(v.ProcessId); +#endif // OS_WIN32 + } + } + }*/ +} + +// Connect +UINT CcConnect(REMOTE_CLIENT *r, RPC_CLIENT_CONNECT *connect) +{ + PACK *ret, *p; + UINT err = 0; + // Validate arguments + if (r == NULL || connect == NULL) + { + return ERR_INTERNAL_ERROR; + } + + CcSetServiceToForegroundProcess(r); + + p = NewPack(); + OutRpcClientConnect(p, connect); + + ret = RpcCall(r->Rpc, "Connect", p); + + if (RpcIsOk(ret) == false) + { + err = RpcGetError(ret); + } + + FreePack(ret); + + return err; +} + +// Disconnect +UINT CcDisconnect(REMOTE_CLIENT *r, RPC_CLIENT_CONNECT *connect) +{ + PACK *ret, *p; + UINT err = 0; + // Validate arguments + if (r == NULL || connect == NULL) + { + return ERR_INTERNAL_ERROR; + } + + CcSetServiceToForegroundProcess(r); + + p = NewPack(); + OutRpcClientConnect(p, connect); + + ret = RpcCall(r->Rpc, "Disconnect", p); + + if (RpcIsOk(ret) == false) + { + err = RpcGetError(ret); + } + + FreePack(ret); + + return err; +} + +// Get the account status +UINT CcGetAccountStatus(REMOTE_CLIENT *r, RPC_CLIENT_GET_CONNECTION_STATUS *st) +{ + PACK *ret, *p; + UINT err = 0; + // Validate arguments + if (r == NULL || st == NULL) + { + return ERR_INTERNAL_ERROR; + } + + p = NewPack(); + OutRpcClientGetConnectionStatus(p, st); + + ret = RpcCall(r->Rpc, "GetAccountStatus", p); + + if (RpcIsOk(ret)) + { + InRpcClientGetConnectionStatus(st, ret); + } + else + { + err = RpcGetError(ret); + } + + FreePack(ret); + + return err; +} + + +// Client service sends a notification to the connection manager +void CiNotify(CLIENT *c) +{ + CiNotifyInternal(c); +} +void CiNotifyInternal(CLIENT *c) +{ + // Validate arguments + if (c == NULL) + { + return; + } + + // Set all the notification event + LockList(c->NotifyCancelList); + { + UINT i; + for (i = 0;i < LIST_NUM(c->NotifyCancelList);i++) + { + CANCEL *cancel = LIST_DATA(c->NotifyCancelList, i); + Cancel(cancel); + } + } + UnlockList(c->NotifyCancelList); +} + +// Release the RPC_CLIENT_ENUM_ACCOUNT +void CiFreeClientEnumAccount(RPC_CLIENT_ENUM_ACCOUNT *a) +{ + UINT i; + // Validate arguments + if (a == NULL) + { + return; + } + + for (i = 0;i < a->NumItem;i++) + { + RPC_CLIENT_ENUM_ACCOUNT_ITEM *e = a->Items[i]; + Free(e); + } + Free(a->Items); +} + + +// Thread to save the configuration file periodically +void CiSaverThread(THREAD *t, void *param) +{ + CLIENT *c = (CLIENT *)param; + // Validate arguments + if (t == NULL || param == NULL) + { + return; + } + + NoticeThreadInit(t); + + // Wait for a certain period of time + while (c->Halt == false) + { + Wait(c->SaverHalter, CLIENT_SAVER_INTERVAL); + + // Save + CiSaveConfigurationFile(c); + } +} + +// Initialize the Saver +void CiInitSaver(CLIENT *c) +{ + // Validate arguments + if (c == NULL) + { + return; + } + + c->SaverHalter = NewEvent(); + + c->SaverThread = NewThread(CiSaverThread, c); + WaitThreadInit(c->SaverThread); +} + +// Release the Saver +void CiFreeSaver(CLIENT *c) +{ + // Validate arguments + if (c == NULL) + { + return; + } + + c->Halt = true; + Set(c->SaverHalter); + WaitThread(c->SaverThread, INFINITE); + ReleaseThread(c->SaverThread); + + ReleaseEvent(c->SaverHalter); +} + +// CM_SETTING +void InRpcCmSetting(CM_SETTING *c, PACK *p) +{ + // Validate arguments + if (c == NULL || p == NULL) + { + return; + } + + Zero(c, sizeof(CM_SETTING)); + c->EasyMode = PackGetBool(p, "EasyMode"); + c->LockMode = PackGetBool(p, "LockMode"); + PackGetData2(p, "HashedPassword", c->HashedPassword, sizeof(c->HashedPassword)); +} +void OutRpcCmSetting(PACK *p, CM_SETTING *c) +{ + // Validate arguments + if (c == NULL || p == NULL) + { + return; + } + + PackAddBool(p, "EasyMode", c->EasyMode); + PackAddBool(p, "LockMode", c->LockMode); + PackAddData(p, "HashedPassword", c->HashedPassword, sizeof(c->HashedPassword)); +} + +// CLIENT_CONFIG +void InRpcClientConfig(CLIENT_CONFIG *c, PACK *p) +{ + // Validate arguments + if (c == NULL || p == NULL) + { + return; + } + + Zero(c, sizeof(CLIENT_CONFIG)); + c->UseKeepConnect = PackGetInt(p, "UseKeepConnect") == 0 ? false : true; + c->KeepConnectPort = PackGetInt(p, "KeepConnectPort"); + c->KeepConnectProtocol = PackGetInt(p, "KeepConnectProtocol"); + c->KeepConnectInterval = PackGetInt(p, "KeepConnectInterval"); + c->AllowRemoteConfig = PackGetInt(p, "AllowRemoteConfig") == 0 ? false : true; + PackGetStr(p, "KeepConnectHost", c->KeepConnectHost, sizeof(c->KeepConnectHost)); +} +void OutRpcClientConfig(PACK *p, CLIENT_CONFIG *c) +{ + // Validate arguments + if (c == NULL || p == NULL) + { + return; + } + + PackAddInt(p, "UseKeepConnect", c->UseKeepConnect); + PackAddInt(p, "KeepConnectPort", c->KeepConnectPort); + PackAddInt(p, "KeepConnectProtocol", c->KeepConnectProtocol); + PackAddInt(p, "KeepConnectInterval", c->KeepConnectInterval); + PackAddInt(p, "AllowRemoteConfig", c->AllowRemoteConfig); + PackAddStr(p, "KeepConnectHost", c->KeepConnectHost); +} + +// RPC_CLIENT_VERSION +void InRpcClientVersion(RPC_CLIENT_VERSION *ver, PACK *p) +{ + // Validate arguments + if (ver == NULL || p == NULL) + { + return; + } + + Zero(ver, sizeof(RPC_CLIENT_VERSION)); + PackGetStr(p, "ClientProductName", ver->ClientProductName, sizeof(ver->ClientProductName)); + PackGetStr(p, "ClientVersionString", ver->ClientVersionString, sizeof(ver->ClientVersionString)); + PackGetStr(p, "ClientBuildInfoString", ver->ClientBuildInfoString, sizeof(ver->ClientBuildInfoString)); + ver->ClientVerInt = PackGetInt(p, "ClientVerInt"); + ver->ClientBuildInt = PackGetInt(p, "ClientBuildInt"); + ver->ProcessId = PackGetInt(p, "ProcessId"); + ver->OsType = PackGetInt(p, "OsType"); + ver->IsVLanNameRegulated = PackGetBool(p, "IsVLanNameRegulated"); + ver->IsVgcSupported = PackGetBool(p, "IsVgcSupported"); + ver->ShowVgcLink = PackGetBool(p, "ShowVgcLink"); + PackGetStr(p, "ClientId", ver->ClientId, sizeof(ver->ClientId)); +} +void OutRpcClientVersion(PACK *p, RPC_CLIENT_VERSION *ver) +{ + // Validate arguments + if (ver == NULL || p == NULL) + { + return; + } + + PackAddStr(p, "ClientProductName", ver->ClientProductName); + PackAddStr(p, "ClientVersionString", ver->ClientVersionString); + PackAddStr(p, "ClientBuildInfoString", ver->ClientBuildInfoString); + PackAddInt(p, "ClientVerInt", ver->ClientVerInt); + PackAddInt(p, "ClientBuildInt", ver->ClientBuildInt); + PackAddInt(p, "ProcessId", ver->ProcessId); + PackAddInt(p, "OsType", ver->OsType); + PackAddBool(p, "IsVLanNameRegulated", ver->IsVLanNameRegulated); + PackAddBool(p, "IsVgcSupported", ver->IsVgcSupported); + PackAddBool(p, "ShowVgcLink", ver->ShowVgcLink); + PackAddStr(p, "ClientId", ver->ClientId); +} + +// RPC_CLIENT_PASSWORD +void InRpcClientPassword(RPC_CLIENT_PASSWORD *pw, PACK *p) +{ + // Validate arguments + if (pw == NULL || p == NULL) + { + return; + } + + Zero(pw, sizeof(RPC_CLIENT_PASSWORD)); + PackGetStr(p, "Password", pw->Password, sizeof(pw->Password)); + pw->PasswordRemoteOnly = PackGetInt(p, "PasswordRemoteOnly"); +} +void OutRpcClientPassword(PACK *p, RPC_CLIENT_PASSWORD *pw) +{ + // Validate arguments + if (pw == NULL || p == NULL) + { + return; + } + + PackAddStr(p, "Password", pw->Password); + PackAddInt(p, "PasswordRemoteOnly", pw->PasswordRemoteOnly); +} + +// RPC_CLIENT_PASSWORD_SETTING +void InRpcClientPasswordSetting(RPC_CLIENT_PASSWORD_SETTING *a, PACK *p) +{ + // Validate arguments + if (a == NULL || p == NULL) + { + return; + } + + Zero(a, sizeof(RPC_CLIENT_PASSWORD_SETTING)); + + a->IsPasswordPresented = PackGetInt(p, "IsPasswordPresented") == 0 ? false : true; + a->PasswordRemoteOnly = PackGetInt(p, "PasswordRemoteOnly") == 0 ? false : true; +} +void OutRpcClientPasswordSetting(PACK *p, RPC_CLIENT_PASSWORD_SETTING *a) +{ + // Validate arguments + if (a == NULL || p == NULL) + { + return; + } + + PackAddInt(p, "IsPasswordPresented", a->IsPasswordPresented); + PackAddInt(p, "PasswordRemoteOnly", a->PasswordRemoteOnly); +} + +// RPC_CLIENT_ENUM_CA +void InRpcClientEnumCa(RPC_CLIENT_ENUM_CA *e, PACK *p) +{ + UINT i; + // Validate arguments + if (e == NULL || p == NULL) + { + return; + } + + Zero(e, sizeof(RPC_CLIENT_ENUM_CA)); + e->NumItem = PackGetNum(p, "NumItem"); + + e->Items = ZeroMalloc(sizeof(RPC_CLIENT_ENUM_CA_ITEM *) * e->NumItem); + for (i = 0;i < e->NumItem;i++) + { + RPC_CLIENT_ENUM_CA_ITEM *item = ZeroMalloc(sizeof(RPC_CLIENT_ENUM_CA_ITEM)); + e->Items[i] = item; + + item->Key = PackGetIntEx(p, "Key", i); + PackGetUniStrEx(p, "SubjectName", item->SubjectName, sizeof(item->SubjectName), i); + PackGetUniStrEx(p, "IssuerName", item->IssuerName, sizeof(item->IssuerName), i); + item->Expires = PackGetInt64Ex(p, "Expires", i); + } +} +void OutRpcClientEnumCa(PACK *p, RPC_CLIENT_ENUM_CA *e) +{ + UINT i; + // Validate arguments + if (e == NULL || p == NULL) + { + return; + } + + PackAddNum(p, "NumItem", e->NumItem); + + PackSetCurrentJsonGroupName(p, "CAList"); + for (i = 0;i < e->NumItem;i++) + { + RPC_CLIENT_ENUM_CA_ITEM *item = e->Items[i]; + PackAddIntEx(p, "Key", item->Key, i, e->NumItem); + PackAddUniStrEx(p, "SubjectName", item->SubjectName, i, e->NumItem); + PackAddUniStrEx(p, "IssuerName", item->IssuerName, i, e->NumItem); + PackAddTime64Ex(p, "Expires", item->Expires, i, e->NumItem); + } + PackSetCurrentJsonGroupName(p, NULL); +} + +// RPC_GET_ISSUER +void InRpcGetIssuer(RPC_GET_ISSUER *c, PACK *p) +{ + BUF *b; + // Validate arguments + if (c == NULL || p == NULL) + { + return; + } + + Zero(c, sizeof(RPC_GET_ISSUER)); + b = PackGetBuf(p, "x"); + if (b != NULL) + { + if (c->x != NULL) + { + FreeX(c->x); + } + c->x = BufToX(b, false); + FreeBuf(b); + } + + b = PackGetBuf(p, "issuer_x"); + if (b != NULL) + { + c->issuer_x = BufToX(b, false); + FreeBuf(b); + } +} +void OutRpcGetIssuer(PACK *p, RPC_GET_ISSUER *c) +{ + BUF *b; + // Validate arguments + if (p == NULL || c == NULL) + { + return; + } + + if (c->x != NULL) + { + b = XToBuf(c->x, false); + + PackAddBuf(p, "x", b); + FreeBuf(b); + } + + if (c->issuer_x != NULL) + { + b = XToBuf(c->issuer_x, false); + + PackAddBuf(p, "issuer_x", b); + FreeBuf(b); + } +} + +// TRAFFIC_EX +void InRpcTrafficEx(TRAFFIC *t, PACK *p, UINT i) +{ + // Validate arguments + if (t == NULL || p == NULL) + { + return; + } + + Zero(t, sizeof(TRAFFIC)); + t->Recv.BroadcastBytes = PackGetInt64Ex(p, "Ex.Recv.BroadcastBytes", i); + t->Recv.BroadcastCount = PackGetInt64Ex(p, "Ex.Recv.BroadcastCount", i); + t->Recv.UnicastBytes = PackGetInt64Ex(p, "Ex.Recv.UnicastBytes", i); + t->Recv.UnicastCount = PackGetInt64Ex(p, "Ex.Recv.UnicastCount", i); + t->Send.BroadcastBytes = PackGetInt64Ex(p, "Ex.Send.BroadcastBytes", i); + t->Send.BroadcastCount = PackGetInt64Ex(p, "Ex.Send.BroadcastCount", i); + t->Send.UnicastBytes = PackGetInt64Ex(p, "Ex.Send.UnicastBytes", i); + t->Send.UnicastCount = PackGetInt64Ex(p, "Ex.Send.UnicastCount", i); +} +void OutRpcTrafficEx(TRAFFIC *t, PACK *p, UINT i, UINT num) +{ + // Validate arguments + if (t == NULL || p == NULL) + { + return; + } + + PackAddInt64Ex(p, "Ex.Recv.BroadcastBytes", t->Recv.BroadcastBytes, i, num); + PackAddInt64Ex(p, "Ex.Recv.BroadcastCount", t->Recv.BroadcastCount, i, num); + PackAddInt64Ex(p, "Ex.Recv.UnicastBytes", t->Recv.UnicastBytes, i, num); + PackAddInt64Ex(p, "Ex.Recv.UnicastCount", t->Recv.UnicastCount, i, num); + PackAddInt64Ex(p, "Ex.Send.BroadcastBytes", t->Send.BroadcastBytes, i, num); + PackAddInt64Ex(p, "Ex.Send.BroadcastCount", t->Send.BroadcastCount, i, num); + PackAddInt64Ex(p, "Ex.Send.UnicastBytes", t->Send.UnicastBytes, i, num); + PackAddInt64Ex(p, "Ex.Send.UnicastCount", t->Send.UnicastCount, i, num); +} + +// TRAFFIC +void InRpcTraffic(TRAFFIC *t, PACK *p) +{ + // Validate arguments + if (t == NULL || p == NULL) + { + return; + } + + Zero(t, sizeof(TRAFFIC)); + t->Recv.BroadcastBytes = PackGetInt64(p, "Recv.BroadcastBytes"); + t->Recv.BroadcastCount = PackGetInt64(p, "Recv.BroadcastCount"); + t->Recv.UnicastBytes = PackGetInt64(p, "Recv.UnicastBytes"); + t->Recv.UnicastCount = PackGetInt64(p, "Recv.UnicastCount"); + t->Send.BroadcastBytes = PackGetInt64(p, "Send.BroadcastBytes"); + t->Send.BroadcastCount = PackGetInt64(p, "Send.BroadcastCount"); + t->Send.UnicastBytes = PackGetInt64(p, "Send.UnicastBytes"); + t->Send.UnicastCount = PackGetInt64(p, "Send.UnicastCount"); +} +void OutRpcTraffic(PACK *p, TRAFFIC *t) +{ + // Validate arguments + if (t == NULL || p == NULL) + { + return; + } + + PackAddInt64(p, "Recv.BroadcastBytes", t->Recv.BroadcastBytes); + PackAddInt64(p, "Recv.BroadcastCount", t->Recv.BroadcastCount); + PackAddInt64(p, "Recv.UnicastBytes", t->Recv.UnicastBytes); + PackAddInt64(p, "Recv.UnicastCount", t->Recv.UnicastCount); + PackAddInt64(p, "Send.BroadcastBytes", t->Send.BroadcastBytes); + PackAddInt64(p, "Send.BroadcastCount", t->Send.BroadcastCount); + PackAddInt64(p, "Send.UnicastBytes", t->Send.UnicastBytes); + PackAddInt64(p, "Send.UnicastCount", t->Send.UnicastCount); +} + +// RPC_CERT +void InRpcCert(RPC_CERT *c, PACK *p) +{ + BUF *b; + // Validate arguments + if (c == NULL || p == NULL) + { + return; + } + + Zero(c, sizeof(RPC_CERT)); + b = PackGetBuf(p, "x"); + if (b == NULL) + { + return; + } + + c->x = BufToX(b, false); + FreeBuf(b); +} +void OutRpcCert(PACK *p, RPC_CERT *c) +{ + BUF *b; + // Validate arguments + if (p == NULL || c == NULL) + { + return; + } + + if (c->x != NULL) + { + b = XToBuf(c->x, false); + + PackAddBuf(p, "x", b); + + FreeBuf(b); + } +} + +// RPC_CLIENT_DELETE_CA +void InRpcClientDeleteCa(RPC_CLIENT_DELETE_CA *c, PACK *p) +{ + // Validate arguments + if (c == NULL || p == NULL) + { + return; + } + + Zero(c, sizeof(RPC_CLIENT_DELETE_CA)); + c->Key = PackGetInt(p, "Key"); +} +void OutRpcClientDeleteCa(PACK *p, RPC_CLIENT_DELETE_CA *c) +{ + // Validate arguments + if (c == NULL || p == NULL) + { + return; + } + + PackAddInt(p, "Key", c->Key); +} + +// RPC_GET_CA +void InRpcGetCa(RPC_GET_CA *c, PACK *p) +{ + BUF *b; + // Validate arguments + if (c == NULL || p == NULL) + { + return; + } + + Zero(c, sizeof(RPC_GET_CA)); + + c->Key = PackGetInt(p, "Key"); + + b = PackGetBuf(p, "x"); + if (b != NULL) + { + c->x = BufToX(b, false); + + FreeBuf(b); + } +} +void OutRpcGetCa(PACK *p, RPC_GET_CA *c) +{ + // Validate arguments + if (c == NULL || p == NULL) + { + return; + } + + PackAddInt(p, "Key", c->Key); + + if (c->x != NULL) + { + BUF *b = XToBuf(c->x, false); + + PackAddBuf(p, "x", b); + + FreeBuf(b); + } +} + +// RPC_CLIENT_ENUM_SECURE +void InRpcClientEnumSecure(RPC_CLIENT_ENUM_SECURE *e, PACK *p) +{ + UINT i; + // Validate arguments + if (e == NULL || p == NULL) + { + return; + } + + Zero(e, sizeof(RPC_CLIENT_ENUM_SECURE)); + + e->NumItem = PackGetNum(p, "NumItem"); + e->Items = ZeroMalloc(sizeof(RPC_CLIENT_ENUM_SECURE_ITEM *) * e->NumItem); + for (i = 0;i < e->NumItem;i++) + { + RPC_CLIENT_ENUM_SECURE_ITEM *item = e->Items[i] = ZeroMalloc(sizeof(RPC_CLIENT_ENUM_SECURE_ITEM)); + + item->DeviceId = PackGetIntEx(p, "DeviceId", i); + item->Type = PackGetIntEx(p, "Type", i); + PackGetStrEx(p, "DeviceName", item->DeviceName, sizeof(item->DeviceName), i); + PackGetStrEx(p, "Manufacturer", item->Manufacturer, sizeof(item->Manufacturer), i); + } +} +void OutRpcClientEnumSecure(PACK *p, RPC_CLIENT_ENUM_SECURE *e) +{ + UINT i; + // Validate arguments + if (e == NULL || p == NULL) + { + return; + } + + PackAddNum(p, "NumItem", e->NumItem); + + PackSetCurrentJsonGroupName(p, "SecureDeviceList"); + for (i = 0;i < e->NumItem;i++) + { + RPC_CLIENT_ENUM_SECURE_ITEM *item = e->Items[i]; + + PackAddIntEx(p, "DeviceId", item->DeviceId, i, e->NumItem); + PackAddIntEx(p, "Type", item->Type, i, e->NumItem); + PackAddStrEx(p, "DeviceName", item->DeviceName, i, e->NumItem); + PackAddStrEx(p, "Manufacturer", item->Manufacturer, i, e->NumItem); + } + PackSetCurrentJsonGroupName(p, NULL); +} + +// RPC_USE_SECURE +void InRpcUseSecure(RPC_USE_SECURE *u, PACK *p) +{ + // Validate arguments + if (u == NULL || p == NULL) + { + return; + } + + Zero(u, sizeof(RPC_USE_SECURE)); + u->DeviceId = PackGetInt(p, "DeviceId"); +} +void OutRpcUseSecure(PACK *p, RPC_USE_SECURE *u) +{ + // Validate arguments + if (u == NULL || p == NULL) + { + return; + } + + PackAddInt(p, "DeviceId", u->DeviceId); +} + +// Release the RPC_ENUM_OBJECT_IN_SECURE +void CiFreeEnumObjectInSecure(RPC_ENUM_OBJECT_IN_SECURE *a) +{ + UINT i; + // Validate arguments + if (a == NULL) + { + return; + } + + for (i = 0;i < a->NumItem;i++) + { + Free(a->ItemName[i]); + } + Free(a->ItemName); + Free(a->ItemType); +} + +// RPC_ENUM_OBJECT_IN_SECURE +void OutRpcEnumObjectInSecure(PACK *p, RPC_ENUM_OBJECT_IN_SECURE *e) +{ + UINT i; + // Validate arguments + if (e == NULL || p == NULL) + { + return; + } + + PackAddNum(p, "NumItem", e->NumItem); + PackAddInt(p, "hWnd", e->hWnd); + + PackSetCurrentJsonGroupName(p, "ObjectList"); + for (i = 0;i < e->NumItem;i++) + { + PackAddStrEx(p, "ItemName", e->ItemName[i], i, e->NumItem); + PackAddIntEx(p, "ItemType", e->ItemType[i], i, e->NumItem); + } + PackSetCurrentJsonGroupName(p, NULL); +} + +// RPC_CLIENT_CREATE_VLAN +void InRpcCreateVLan(RPC_CLIENT_CREATE_VLAN *v, PACK *p) +{ + // Validate arguments + if (v == NULL || p == NULL) + { + return; + } + + Zero(v, sizeof(RPC_CLIENT_CREATE_VLAN)); + PackGetStr(p, "DeviceName", v->DeviceName, sizeof(v->DeviceName)); +} +void OutRpcCreateVLan(PACK *p, RPC_CLIENT_CREATE_VLAN *v) +{ + // Validate arguments + if (v == NULL || p == NULL) + { + return; + } + + PackAddStr(p, "DeviceName", v->DeviceName); +} + +// RPC_CLIENT_GET_VLAN +void InRpcClientGetVLan(RPC_CLIENT_GET_VLAN *v, PACK *p) +{ + // Validate arguments + if (v == NULL || p == NULL) + { + return; + } + + Zero(v, sizeof(RPC_CLIENT_GET_VLAN)); + PackGetStr(p, "DeviceName", v->DeviceName, sizeof(v->DeviceName)); + v->Enabled = PackGetInt(p, "Enabled") ? true : false; + PackGetStr(p, "MacAddress", v->MacAddress, sizeof(v->MacAddress)); + PackGetStr(p, "Version", v->Version, sizeof(v->Version)); + PackGetStr(p, "FileName", v->FileName, sizeof(v->FileName)); + PackGetStr(p, "Guid", v->Guid, sizeof(v->Guid)); +} +void OutRpcClientGetVLan(PACK *p, RPC_CLIENT_GET_VLAN *v) +{ + // Validate arguments + if (v == NULL || p == NULL) + { + return; + } + + PackAddStr(p, "DeviceName", v->DeviceName); + PackAddInt(p, "Enabled", v->Enabled); + PackAddStr(p, "MacAddress", v->MacAddress); + PackAddStr(p, "Version", v->Version); + PackAddStr(p, "FileName", v->FileName); + PackAddStr(p, "Guid", v->Guid); +} + +// RPC_CLIENT_SET_VLAN +void InRpcClientSetVLan(RPC_CLIENT_SET_VLAN *v, PACK *p) +{ + // Validate arguments + if (v == NULL || p == NULL) + { + return; + } + + Zero(v, sizeof(RPC_CLIENT_SET_VLAN)); + PackGetStr(p, "DeviceName", v->DeviceName, sizeof(v->DeviceName)); + PackGetStr(p, "MacAddress", v->MacAddress, sizeof(v->MacAddress)); +} +void OutRpcClientSetVLan(PACK *p, RPC_CLIENT_SET_VLAN *v) +{ + // Validate arguments + if (v == NULL || p == NULL) + { + return; + } + + PackAddStr(p, "DeviceName", v->DeviceName); + PackAddStr(p, "MacAddress", v->MacAddress); +} + +// RPC_CLIENT_ENUM_VLAN +void InRpcClientEnumVLan(RPC_CLIENT_ENUM_VLAN *v, PACK *p) +{ + UINT i; + // Validate arguments + if (v == NULL || p == NULL) + { + return; + } + + Zero(v, sizeof(RPC_CLIENT_ENUM_VLAN)); + v->NumItem = PackGetNum(p, "NumItem"); + v->Items = ZeroMalloc(sizeof(RPC_CLIENT_ENUM_VLAN_ITEM *) * v->NumItem); + + for (i = 0;i < v->NumItem;i++) + { + RPC_CLIENT_ENUM_VLAN_ITEM *item = v->Items[i] = + ZeroMalloc(sizeof(RPC_CLIENT_ENUM_VLAN_ITEM)); + + PackGetStrEx(p, "DeviceName", item->DeviceName, sizeof(item->DeviceName), i); + item->Enabled = PackGetIntEx(p, "Enabled", i) ? true : false; + PackGetStrEx(p, "MacAddress", item->MacAddress, sizeof(item->MacAddress), i); + PackGetStrEx(p, "Version", item->Version, sizeof(item->Version), i); + } +} +void OutRpcClientEnumVLan(PACK *p, RPC_CLIENT_ENUM_VLAN *v) +{ + UINT i; + // Validate arguments + if (v == NULL || p == NULL) + { + return; + } + + PackAddNum(p, "NumItem", v->NumItem); + + PackSetCurrentJsonGroupName(p, "VLanList"); + for (i = 0;i < v->NumItem;i++) + { + RPC_CLIENT_ENUM_VLAN_ITEM *item = v->Items[i]; + + PackAddStrEx(p, "DeviceName", item->DeviceName, i, v->NumItem); + PackAddIntEx(p, "Enabled", item->Enabled, i, v->NumItem); + PackAddStrEx(p, "MacAddress", item->MacAddress, i, v->NumItem); + PackAddStrEx(p, "Version", item->Version, i, v->NumItem); + } + PackSetCurrentJsonGroupName(p, NULL); +} + +// CLIENT_OPTION +void InRpcClientOption(CLIENT_OPTION *c, PACK *p) +{ + // Validate arguments + if (c == NULL || p == NULL) + { + return; + } + + Zero(c, sizeof(CLIENT_OPTION)); + + PackGetUniStr(p, "AccountName", c->AccountName, sizeof(c->AccountName)); + PackGetStr(p, "Hostname", c->Hostname, sizeof(c->Hostname)); + c->Port = PackGetInt(p, "Port"); + c->PortUDP = PackGetInt(p, "PortUDP"); + c->ProxyType = PackGetInt(p, "ProxyType"); + c->ProxyPort = PackGetInt(p, "ProxyPort"); + c->NumRetry = PackGetInt(p, "NumRetry"); + c->RetryInterval = PackGetInt(p, "RetryInterval"); + c->MaxConnection = PackGetInt(p, "MaxConnection"); + c->AdditionalConnectionInterval = PackGetInt(p, "AdditionalConnectionInterval"); + c->ConnectionDisconnectSpan = PackGetInt(p, "ConnectionDisconnectSpan"); + c->HideStatusWindow = PackGetBool(p, "HideStatusWindow"); + c->HideNicInfoWindow = PackGetBool(p, "HideNicInfoWindow"); + c->DisableQoS = PackGetBool(p, "DisableQoS"); + PackGetStr(p, "ProxyName", c->ProxyName, sizeof(c->ProxyName)); + PackGetStr(p, "ProxyUsername", c->ProxyUsername, sizeof(c->ProxyUsername)); + PackGetStr(p, "ProxyPassword", c->ProxyPassword, sizeof(c->ProxyPassword)); + PackGetStr(p, "CustomHttpHeader", c->CustomHttpHeader, sizeof(c->CustomHttpHeader)); + PackGetStr(p, "HubName", c->HubName, sizeof(c->HubName)); + PackGetStr(p, "DeviceName", c->DeviceName, sizeof(c->DeviceName)); + c->UseEncrypt = PackGetInt(p, "UseEncrypt") ? true : false; + c->UseCompress = PackGetInt(p, "UseCompress") ? true : false; + c->HalfConnection = PackGetInt(p, "HalfConnection") ? true : false; + c->NoRoutingTracking = PackGetInt(p, "NoRoutingTracking") ? true : false; + c->RequireMonitorMode = PackGetBool(p, "RequireMonitorMode"); + c->RequireBridgeRoutingMode = PackGetBool(p, "RequireBridgeRoutingMode"); + c->FromAdminPack = PackGetBool(p, "FromAdminPack"); + c->NoUdpAcceleration = PackGetBool(p, "NoUdpAcceleration"); + PackGetData2(p, "HostUniqueKey", c->HostUniqueKey, SHA1_SIZE); +} +void OutRpcClientOption(PACK *p, CLIENT_OPTION *c) +{ + // Validate arguments + if (c == NULL || p == NULL) + { + return; + } + + PackAddUniStr(p, "AccountName", c->AccountName); + PackAddStr(p, "Hostname", c->Hostname); + PackAddStr(p, "ProxyName", c->ProxyName); + PackAddStr(p, "ProxyUsername", c->ProxyUsername); + PackAddStr(p, "ProxyPassword", c->ProxyPassword); + PackAddStr(p, "CustomHttpHeader", c->CustomHttpHeader); + PackAddStr(p, "HubName", c->HubName); + PackAddStr(p, "DeviceName", c->DeviceName); + PackAddInt(p, "Port", c->Port); + PackAddInt(p, "PortUDP", c->PortUDP); + PackAddInt(p, "ProxyType", c->ProxyType); + PackAddInt(p, "ProxyPort", c->ProxyPort); + PackAddInt(p, "NumRetry", c->NumRetry); + PackAddInt(p, "RetryInterval", c->RetryInterval); + PackAddInt(p, "MaxConnection", c->MaxConnection); + PackAddBool(p, "UseEncrypt", c->UseEncrypt); + PackAddBool(p, "UseCompress", c->UseCompress); + PackAddBool(p, "HalfConnection", c->HalfConnection); + PackAddBool(p, "NoRoutingTracking", c->NoRoutingTracking); + PackAddInt(p, "AdditionalConnectionInterval", c->AdditionalConnectionInterval); + PackAddInt(p, "ConnectionDisconnectSpan", c->ConnectionDisconnectSpan); + PackAddBool(p, "HideStatusWindow", c->HideStatusWindow); + PackAddBool(p, "HideNicInfoWindow", c->HideNicInfoWindow); + PackAddBool(p, "RequireMonitorMode", c->RequireMonitorMode); + PackAddBool(p, "RequireBridgeRoutingMode", c->RequireBridgeRoutingMode); + PackAddBool(p, "DisableQoS", c->DisableQoS); + PackAddBool(p, "FromAdminPack", c->FromAdminPack); + PackAddBool(p, "NoUdpAcceleration", c->NoUdpAcceleration); + PackAddData(p, "HostUniqueKey", c->HostUniqueKey, SHA1_SIZE); +} + +// CLIENT_AUTH +void InRpcClientAuth(CLIENT_AUTH *c, PACK *p) +{ + BUF *b; + // Validate arguments + if (c == NULL || p == NULL) + { + return; + } + + Zero(c, sizeof(CLIENT_AUTH)); + c->AuthType = PackGetInt(p, "AuthType"); + PackGetStr(p, "Username", c->Username, sizeof(c->Username)); + + switch (c->AuthType) + { + case CLIENT_AUTHTYPE_ANONYMOUS: + break; + + case CLIENT_AUTHTYPE_PASSWORD: + if (PackGetDataSize(p, "HashedPassword") == SHA1_SIZE) + { + PackGetData(p, "HashedPassword", c->HashedPassword); + } + break; + + case CLIENT_AUTHTYPE_PLAIN_PASSWORD: + PackGetStr(p, "PlainPassword", c->PlainPassword, sizeof(c->PlainPassword)); + break; + + case CLIENT_AUTHTYPE_CERT: + b = PackGetBuf(p, "ClientX"); + if (b != NULL) + { + c->ClientX = BufToX(b, false); + FreeBuf(b); + } + b = PackGetBuf(p, "ClientK"); + if (b != NULL) + { + c->ClientK = BufToK(b, true, false, NULL); + FreeBuf(b); + } + break; + + case CLIENT_AUTHTYPE_SECURE: + PackGetStr(p, "SecurePublicCertName", c->SecurePublicCertName, sizeof(c->SecurePublicCertName)); + PackGetStr(p, "SecurePrivateKeyName", c->SecurePrivateKeyName, sizeof(c->SecurePrivateKeyName)); + break; + + case CLIENT_AUTHTYPE_OPENSSLENGINE: + b = PackGetBuf(p, "ClientX"); + if (b != NULL) + { + c->ClientX = BufToX(b, false); + FreeBuf(b); + } + PackGetStr(p, "OpensslEnginePrivateKeyName", c->OpensslEnginePrivateKeyName, sizeof(c->OpensslEnginePrivateKeyName)); + PackGetStr(p, "OpensslEngineName", c->OpensslEngineName, sizeof(c->OpensslEngineName)); + break; + } +} +void OutRpcClientAuth(PACK *p, CLIENT_AUTH *c) +{ + BUF *b; + // Validate arguments + if (c == NULL || p == NULL) + { + return; + } + + PackAddInt(p, "AuthType", c->AuthType); + PackAddStr(p, "Username", c->Username); + + switch (c->AuthType) + { + case CLIENT_AUTHTYPE_ANONYMOUS: + break; + + case CLIENT_AUTHTYPE_PASSWORD: + PackAddData(p, "HashedPassword", c->HashedPassword, SHA1_SIZE); + break; + + case CLIENT_AUTHTYPE_PLAIN_PASSWORD: + PackAddStr(p, "PlainPassword", c->PlainPassword); + break; + + case CLIENT_AUTHTYPE_CERT: + b = XToBuf(c->ClientX, false); + if (b != NULL) + { + PackAddBuf(p, "ClientX", b); + FreeBuf(b); + } + b = KToBuf(c->ClientK, false, NULL); + if (b != NULL) + { + PackAddBuf(p, "ClientK", b); + FreeBuf(b); + } + break; + + case CLIENT_AUTHTYPE_SECURE: + PackAddStr(p, "SecurePublicCertName", c->SecurePublicCertName); + PackAddStr(p, "SecurePrivateKeyName", c->SecurePrivateKeyName); + break; + + case CLIENT_AUTHTYPE_OPENSSLENGINE: + b = XToBuf(c->ClientX, false); + if (b != NULL) + { + PackAddBuf(p, "ClientX", b); + FreeBuf(b); + } + PackAddStr(p, "OpensslEnginePrivateKeyName", c->OpensslEnginePrivateKeyName); + PackAddStr(p, "OpensslEngineName", c->OpensslEngineName); + break; + } +} + +// RPC_CLIENT_CREATE_ACCOUNT +void InRpcClientCreateAccount(RPC_CLIENT_CREATE_ACCOUNT *c, PACK *p) +{ + BUF *b; + // Validate arguments + if (c == NULL || p == NULL) + { + return; + } + + Zero(c, sizeof(RPC_CLIENT_CREATE_ACCOUNT)); + c->ClientOption = ZeroMalloc(sizeof(CLIENT_OPTION)); + c->ClientAuth = ZeroMalloc(sizeof(CLIENT_AUTH)); + + InRpcClientOption(c->ClientOption, p); + InRpcClientAuth(c->ClientAuth, p); + + c->StartupAccount = PackGetInt(p, "StartupAccount") ? true : false; + c->CheckServerCert = PackGetInt(p, "CheckServerCert") ? true : false; + c->RetryOnServerCert = PackGetInt(p, "RetryOnServerCert") ? true : false; + b = PackGetBuf(p, "ServerCert"); + if (b != NULL) + { + c->ServerCert = BufToX(b, false); + FreeBuf(b); + } + PackGetData2(p, "ShortcutKey", c->ShortcutKey, sizeof(c->ShortcutKey)); +} +void OutRpcClientCreateAccount(PACK *p, RPC_CLIENT_CREATE_ACCOUNT *c) +{ + BUF *b; + // Validate arguments + if (c == NULL || p == NULL) + { + return; + } + + OutRpcClientOption(p, c->ClientOption); + OutRpcClientAuth(p, c->ClientAuth); + + PackAddInt(p, "StartupAccount", c->StartupAccount); + PackAddInt(p, "CheckServerCert", c->CheckServerCert); + PackAddInt(p, "RetryOnServerCert", c->RetryOnServerCert); + if (c->ServerCert != NULL) + { + b = XToBuf(c->ServerCert, false); + if (b != NULL) + { + PackAddBuf(p, "ServerCert", b); + FreeBuf(b); + } + } + PackAddData(p, "ShortcutKey", c->ShortcutKey, sizeof(c->ShortcutKey)); +} + +// RPC_CLIENT_ENUM_ACCOUNT +void InRpcClientEnumAccount(RPC_CLIENT_ENUM_ACCOUNT *e, PACK *p) +{ + UINT i; + // Validate arguments + if (e == NULL || p == NULL) + { + return; + } + + Zero(e, sizeof(RPC_CLIENT_ENUM_ACCOUNT)); + + e->NumItem = PackGetNum(p, "NumItem"); + e->Items = ZeroMalloc(sizeof(RPC_CLIENT_ENUM_ACCOUNT_ITEM *) * e->NumItem); + + for (i = 0;i < e->NumItem;i++) + { + RPC_CLIENT_ENUM_ACCOUNT_ITEM *item = e->Items[i] = + ZeroMalloc(sizeof(RPC_CLIENT_ENUM_ACCOUNT_ITEM)); + + PackGetUniStrEx(p, "AccountName", item->AccountName, sizeof(item->AccountName), i); + PackGetStrEx(p, "UserName", item->UserName, sizeof(item->UserName), i); + PackGetStrEx(p, "ServerName", item->ServerName, sizeof(item->ServerName), i); + PackGetStrEx(p, "ProxyName", item->ProxyName, sizeof(item->ProxyName), i); + PackGetStrEx(p, "DeviceName", item->DeviceName, sizeof(item->DeviceName), i); + item->ProxyType = PackGetIntEx(p, "ProxyType", i); + item->Active = PackGetIntEx(p, "Active", i) ? true : false; + item->StartupAccount = PackGetIntEx(p, "StartupAccount", i) ? true : false; + item->Connected = PackGetBoolEx(p, "Connected", i); + item->Port = PackGetIntEx(p, "Port", i); + PackGetStrEx(p, "HubName", item->HubName, sizeof(item->HubName), i); + item->CreateDateTime = PackGetInt64Ex(p, "CreateDateTime", i); + item->UpdateDateTime = PackGetInt64Ex(p, "UpdateDateTime", i); + item->LastConnectDateTime = PackGetInt64Ex(p, "LastConnectDateTime", i); + } +} +void OutRpcClientEnumAccount(PACK *p, RPC_CLIENT_ENUM_ACCOUNT *e) +{ + UINT i; + // Validate arguments + if (e == NULL || p == NULL) + { + return; + } + + PackAddNum(p, "NumItem", e->NumItem); + + PackSetCurrentJsonGroupName(p, "AccountList"); + for (i = 0;i < e->NumItem;i++) + { + RPC_CLIENT_ENUM_ACCOUNT_ITEM *item = e->Items[i]; + + PackAddUniStrEx(p, "AccountName", item->AccountName, i, e->NumItem); + PackAddStrEx(p, "UserName", item->UserName, i, e->NumItem); + PackAddStrEx(p, "ServerName", item->ServerName, i, e->NumItem); + PackAddStrEx(p, "ProxyName", item->ProxyName, i, e->NumItem); + PackAddStrEx(p, "DeviceName", item->DeviceName, i, e->NumItem); + PackAddIntEx(p, "ProxyType", item->ProxyType, i, e->NumItem); + PackAddIntEx(p, "Active", item->Active, i, e->NumItem); + PackAddIntEx(p, "StartupAccount", item->StartupAccount, i, e->NumItem); + PackAddBoolEx(p, "Connected", item->Connected, i, e->NumItem); + PackAddIntEx(p, "Port", item->Port, i, e->NumItem); + PackAddStrEx(p, "HubName", item->HubName, i, e->NumItem); + PackAddTime64Ex(p, "CreateDateTime", item->CreateDateTime, i, e->NumItem); + PackAddTime64Ex(p, "UpdateDateTime", item->UpdateDateTime, i, e->NumItem); + PackAddTime64Ex(p, "LastConnectDateTime", item->LastConnectDateTime, i, e->NumItem); + } + PackSetCurrentJsonGroupName(p, NULL); +} + +// RPC_CLIENT_DELETE_ACCOUNT +void InRpcClientDeleteAccount(RPC_CLIENT_DELETE_ACCOUNT *a, PACK *p) +{ + // Validate arguments + if (a == NULL || p == NULL) + { + return; + } + + Zero(a, sizeof(RPC_CLIENT_DELETE_ACCOUNT)); + PackGetUniStr(p, "AccountName", a->AccountName, sizeof(a->AccountName)); +} +void OutRpcClientDeleteAccount(PACK *p, RPC_CLIENT_DELETE_ACCOUNT *a) +{ + // Validate arguments + if (a == NULL || p == NULL) + { + return; + } + + PackAddUniStr(p, "AccountName", a->AccountName); +} + +// RPC_RENAME_ACCOUNT +void InRpcRenameAccount(RPC_RENAME_ACCOUNT *a, PACK *p) +{ + // Validate arguments + if (a == NULL || p == NULL) + { + return; + } + + Zero(a, sizeof(RPC_RENAME_ACCOUNT)); + + PackGetUniStr(p, "OldName", a->OldName, sizeof(a->OldName)); + PackGetUniStr(p, "NewName", a->NewName, sizeof(a->NewName)); +} +void OutRpcRenameAccount(PACK *p, RPC_RENAME_ACCOUNT *a) +{ + // Validate arguments + if (a == NULL || p == NULL) + { + return; + } + + PackAddUniStr(p, "OldName", a->OldName); + PackAddUniStr(p, "NewName", a->NewName); +} + +// RPC_CLIENT_GET_ACCOUNT +void InRpcClientGetAccount(RPC_CLIENT_GET_ACCOUNT *c, PACK *p) +{ + BUF *b; + // Validate arguments + if (c == NULL || p == NULL) + { + return; + } + + Zero(c, sizeof(RPC_CLIENT_GET_ACCOUNT)); + + c->ClientOption = ZeroMalloc(sizeof(CLIENT_OPTION)); + c->ClientAuth = ZeroMalloc(sizeof(CLIENT_AUTH)); + + PackGetUniStr(p, "AccountName", c->AccountName, sizeof(c->AccountName)); + c->StartupAccount = PackGetInt(p, "StartupAccount") ? true : false; + c->CheckServerCert = PackGetInt(p, "CheckServerCert") ? true : false; + c->RetryOnServerCert = PackGetInt(p, "RetryOnServerCert") ? true : false; + b = PackGetBuf(p, "ServerCert"); + if (b != NULL) + { + c->ServerCert = BufToX(b, false); + FreeBuf(b); + } + + InRpcClientOption(c->ClientOption, p); + InRpcClientAuth(c->ClientAuth, p); + + c->CreateDateTime = PackGetInt64(p, "CreateDateTime"); + c->UpdateDateTime = PackGetInt64(p, "UpdateDateTime"); + c->LastConnectDateTime = PackGetInt64(p, "LastConnectDateTime"); + + PackGetData2(p, "ShortcutKey", c->ShortcutKey, SHA1_SIZE); +} +void OutRpcClientGetAccount(PACK *p, RPC_CLIENT_GET_ACCOUNT *c) +{ + BUF *b; + // Validate arguments + if (c == NULL || p == NULL) + { + return; + } + + PackAddUniStr(p, "AccountName", c->AccountName); + PackAddInt(p, "StartupAccount", c->StartupAccount); + PackAddInt(p, "CheckServerCert", c->CheckServerCert); + PackAddInt(p, "RetryOnServerCert", c->RetryOnServerCert); + + if (c->ServerCert != NULL) + { + b = XToBuf(c->ServerCert, false); + if (b != NULL) + { + PackAddBuf(p, "ServerCert", b); + FreeBuf(b); + } + } + + OutRpcClientOption(p, c->ClientOption); + OutRpcClientAuth(p, c->ClientAuth); + + PackAddData(p, "ShortcutKey", c->ShortcutKey, SHA1_SIZE); + + PackAddTime64(p, "CreateDateTime", c->CreateDateTime); + PackAddTime64(p, "UpdateDateTime", c->UpdateDateTime); + PackAddTime64(p, "LastConnectDateTime", c->LastConnectDateTime); +} + +// RPC_CLIENT_CONNECT +void InRpcClientConnect(RPC_CLIENT_CONNECT *c, PACK *p) +{ + // Validate arguments + if (c == NULL || p == NULL) + { + return; + } + + Zero(c, sizeof(RPC_CLIENT_CONNECT)); + + PackGetUniStr(p, "AccountName", c->AccountName, sizeof(c->AccountName)); +} +void OutRpcClientConnect(PACK *p, RPC_CLIENT_CONNECT *c) +{ + // Validate arguments + if (c == NULL || p == NULL) + { + return; + } + + PackAddUniStr(p, "AccountName", c->AccountName); +} + +// POLICY +void InRpcPolicy(POLICY *o, PACK *p) +{ + POLICY *pol; + // Validate arguments + if (o == NULL || p == NULL) + { + return; + } + + pol = PackGetPolicy(p); + Copy(o, pol, sizeof(POLICY)); + Free(pol); +} +void OutRpcPolicy(PACK *p, POLICY *o) +{ + // Validate arguments + if (o == NULL || p == NULL) + { + return; + } + + PackAddPolicy(p, o); +} + +// RPC_CLIENT_GET_CONNECTION_STATUS +void InRpcClientGetConnectionStatus(RPC_CLIENT_GET_CONNECTION_STATUS *s, PACK *p) +{ + BUF *b; + // Validate arguments + if (s == NULL || p == NULL) + { + return; + } + + Zero(s, sizeof(RPC_CLIENT_GET_CONNECTION_STATUS)); + + PackGetUniStr(p, "AccountName", s->AccountName, sizeof(s->AccountName)); + + PackGetStr(p, "ServerName", s->ServerName, sizeof(s->ServerName)); + PackGetStr(p, "ServerProductName", s->ServerProductName, sizeof(s->ServerProductName)); + PackGetStr(p, "CipherName", s->CipherName, sizeof(s->CipherName)); + PackGetStr(p, "SessionName", s->SessionName, sizeof(s->SessionName)); + PackGetStr(p, "ConnectionName", s->ConnectionName, sizeof(s->ConnectionName)); + + if (PackGetDataSize(p, "SessionKey") == SHA1_SIZE) + { + PackGetData(p, "SessionKey", s->SessionKey); + } + + s->SessionStatus = PackGetInt(p, "SessionStatus"); + s->ServerPort = PackGetInt(p, "ServerPort"); + s->ServerProductVer = PackGetInt(p, "ServerProductVer"); + s->ServerProductBuild = PackGetInt(p, "ServerProductBuild"); + s->NumConnectionsEstablished = PackGetInt(p, "NumConnectionsEstablished"); + s->MaxTcpConnections = PackGetInt(p, "MaxTcpConnections"); + s->NumTcpConnections = PackGetInt(p, "NumTcpConnections"); + s->NumTcpConnectionsUpload = PackGetInt(p, "NumTcpConnectionsUpload"); + s->NumTcpConnectionsDownload = PackGetInt(p, "NumTcpConnectionsDownload"); + + s->StartTime = PackGetInt64(p, "StartTime"); + /* !!! Do not correct the spelling to keep the backward protocol compatibility !!! */ + s->FirstConnectionEstablisiedTime = PackGetInt64(p, "FirstConnectionEstablisiedTime"); + s->CurrentConnectionEstablishTime = PackGetInt64(p, "CurrentConnectionEstablishTime"); + s->TotalSendSize = PackGetInt64(p, "TotalSendSize"); + s->TotalRecvSize = PackGetInt64(p, "TotalRecvSize"); + s->TotalSendSizeReal = PackGetInt64(p, "TotalSendSizeReal"); + s->TotalRecvSizeReal = PackGetInt64(p, "TotalRecvSizeReal"); + + s->Active = PackGetInt(p, "Active") ? true : false; + s->Connected = PackGetInt(p, "Connected") ? true : false; + s->HalfConnection = PackGetInt(p, "HalfConnection") ? true : false; + s->QoS = PackGetInt(p, "QoS") ? true : false; + s->UseEncrypt = PackGetInt(p, "UseEncrypt") ? true : false; + s->UseCompress = PackGetInt(p, "UseCompress") ? true : false; + s->IsRUDPSession = PackGetInt(p, "IsRUDPSession") ? true : false; + PackGetStr(p, "UnderlayProtocol", s->UnderlayProtocol, sizeof(s->UnderlayProtocol)); + s->IsUdpAccelerationEnabled = PackGetInt(p, "IsUdpAccelerationEnabled") ? true : false; + s->IsUsingUdpAcceleration = PackGetInt(p, "IsUsingUdpAcceleration") ? true : false; + + s->IsBridgeMode = PackGetBool(p, "IsBridgeMode"); + s->IsMonitorMode = PackGetBool(p, "IsMonitorMode"); + + s->VLanId = PackGetInt(p, "VLanId"); + + b = PackGetBuf(p, "ServerX"); + if (b != NULL) + { + s->ServerX = BufToX(b, false); + FreeBuf(b); + } + + b = PackGetBuf(p, "ClientX"); + if (b != NULL) + { + s->ClientX = BufToX(b, false); + FreeBuf(b); + } + + InRpcPolicy(&s->Policy, p); + + InRpcTraffic(&s->Traffic, p); +} +void OutRpcClientGetConnectionStatus(PACK *p, RPC_CLIENT_GET_CONNECTION_STATUS *c) +{ + BUF *b; + // Validate arguments + if (p == NULL || c == NULL) + { + return; + } + + PackAddUniStr(p, "AccountName", c->AccountName); + + PackAddStr(p, "ServerName", c->ServerName); + PackAddStr(p, "ServerProductName", c->ServerProductName); + PackAddStr(p, "CipherName", c->CipherName); + PackAddStr(p, "SessionName", c->SessionName); + PackAddStr(p, "ConnectionName", c->ConnectionName); + + PackAddData(p, "SessionKey", c->SessionKey, SHA1_SIZE); + + PackAddBool(p, "Active", c->Active); + PackAddBool(p, "Connected", c->Connected); + PackAddInt(p, "SessionStatus", c->SessionStatus); + PackAddInt(p, "ServerPort", c->ServerPort); + PackAddInt(p, "ServerProductVer", c->ServerProductVer); + PackAddInt(p, "ServerProductBuild", c->ServerProductBuild); + PackAddInt(p, "NumConnectionsEstablished", c->NumConnectionsEstablished); + PackAddBool(p, "HalfConnection", c->HalfConnection); + PackAddBool(p, "QoS", c->QoS); + PackAddInt(p, "MaxTcpConnections", c->MaxTcpConnections); + PackAddInt(p, "NumTcpConnections", c->NumTcpConnections); + PackAddInt(p, "NumTcpConnectionsUpload", c->NumTcpConnectionsUpload); + PackAddInt(p, "NumTcpConnectionsDownload", c->NumTcpConnectionsDownload); + PackAddBool(p, "UseEncrypt", c->UseEncrypt); + PackAddBool(p, "UseCompress", c->UseCompress); + PackAddBool(p, "IsRUDPSession", c->IsRUDPSession); + PackAddStr(p, "UnderlayProtocol", c->UnderlayProtocol); + PackAddBool(p, "IsUdpAccelerationEnabled", c->IsUdpAccelerationEnabled); + PackAddBool(p, "IsUsingUdpAcceleration", c->IsUsingUdpAcceleration); + + PackAddBool(p, "IsBridgeMode", c->IsBridgeMode); + PackAddBool(p, "IsMonitorMode", c->IsMonitorMode); + + PackAddTime64(p, "StartTime", c->StartTime); + PackAddTime64(p, "FirstConnectionEstablisiedTime", c->FirstConnectionEstablisiedTime); + PackAddTime64(p, "CurrentConnectionEstablishTime", c->CurrentConnectionEstablishTime); + PackAddInt64(p, "TotalSendSize", c->TotalSendSize); + PackAddInt64(p, "TotalRecvSize", c->TotalRecvSize); + PackAddInt64(p, "TotalSendSizeReal", c->TotalSendSizeReal); + PackAddInt64(p, "TotalRecvSizeReal", c->TotalRecvSizeReal); + + PackAddInt(p, "VLanId", c->VLanId); + + OutRpcPolicy(p, &c->Policy); + + OutRpcTraffic(p, &c->Traffic); + + if (c->ServerX != NULL) + { + b = XToBuf(c->ServerX, false); + PackAddBuf(p, "ServerX", b); + FreeBuf(b); + } + + if (c->ClientX != NULL) + { + b = XToBuf(c->ClientX, false); + PackAddBuf(p, "ClientX", b); + FreeBuf(b); + } +} + +// Notification main +void CiNotifyMain(CLIENT *c, SOCK *s) +{ + CANCEL *cancel; + // Validate arguments + if (c == NULL || s == NULL) + { + return; + } + + // Register a Cancel + cancel = NewCancel(); + LockList(c->NotifyCancelList); + { + Add(c->NotifyCancelList, cancel); + } + UnlockList(c->NotifyCancelList); + + // Wait + while (true) + { + char ch = '@'; + SOCKSET set; + InitSockSet(&set); + AddSockSet(&set, s); + Select(&set, INFINITE, cancel, NULL); + + if (c->Halt) + { + // Abort + break; + } + + // 1 byte transmission + if (Send(s, &ch, 1, false) == 0) + { + // Disconnected + break; + } + } + + // Disconnect + Disconnect(s); + + // Unregister the Cancel + LockList(c->NotifyCancelList); + { + Delete(c->NotifyCancelList, cancel); + } + UnlockList(c->NotifyCancelList); + + ReleaseCancel(cancel); +} + +// RPC acceptance code +void CiRpcAccepted(CLIENT *c, SOCK *s) +{ + UCHAR hashed_password[SHA1_SIZE]; + UINT rpc_mode; + UINT retcode; + RPC *rpc; + // Validate arguments + if (c == NULL || s == NULL) + { + return; + } + + // Receive the RPC mode + if (RecvAll(s, &rpc_mode, sizeof(UINT), false) == false) + { + return; + } + + rpc_mode = Endian32(rpc_mode); + + if (rpc_mode == CLIENT_RPC_MODE_NOTIFY) + { + // Notification mode + CiNotifyMain(c, s); + return; + } + else if (rpc_mode == CLIENT_RPC_MODE_SHORTCUT || rpc_mode == CLIENT_RPC_MODE_SHORTCUT_DISCONNECT) + { + // Shortcut key received + UCHAR key[SHA1_SIZE]; + UINT err = ERR_NO_ERROR; + if (RecvAll(s, key, SHA1_SIZE, false)) + { + UINT i; + wchar_t title[MAX_ACCOUNT_NAME_LEN + 1]; + bool ok = false; + // Connect to the specified setting + LockList(c->AccountList); + { + for (i = 0;i < LIST_NUM(c->AccountList);i++) + { + ACCOUNT *a = LIST_DATA(c->AccountList, i); + Lock(a->lock); + { + if (Cmp(a->ShortcutKey, key, SHA1_SIZE) == 0) + { + ok = true; + UniStrCpy(title, sizeof(title), a->ClientOption->AccountName); + } + } + Unlock(a->lock); + } + } + UnlockList(c->AccountList); + + if (ok == false) + { + err = ERR_ACCOUNT_NOT_FOUND; + } + else + { + RPC_CLIENT_CONNECT t; + Zero(&t, sizeof(t)); + UniStrCpy(t.AccountName, sizeof(t.AccountName), title); + + if (rpc_mode == CLIENT_RPC_MODE_SHORTCUT) + { + // Connect + if (CtConnect(c, &t)) + { + err = ERR_NO_ERROR; + } + else + { + err = c->Err; + } + } + else + { + // Connect + if (CtDisconnect(c, &t, false)) + { + err = ERR_NO_ERROR; + } + else + { + err = c->Err; + } + } + } + + err = Endian32(err); + SendAll(s, &err, sizeof(UINT), false); + (void)RecvAll(s, &err, sizeof(UINT), false); + } + return; + } + + // Password reception + if (RecvAll(s, hashed_password, SHA1_SIZE, false) == false) + { + return; + } + + retcode = 0; + + // Password comparison + if (Cmp(hashed_password, c->EncryptedPassword, SHA1_SIZE) != 0) + { + retcode = 1; + } + + if (c->PasswordRemoteOnly && s->RemoteIP.addr[0] == 127) + { + // If in a mode that requires a password only remote, + // the password sent from localhost is considered to be always correct + retcode = 0; + } + + Lock(c->lock); + { + if (c->Config.AllowRemoteConfig == false) + { + // If the remote control is prohibited, + // identify whether this connection is from remote + if (s->RemoteIP.addr[0] != 127) + { + retcode = 2; + } + } + } + Unlock(c->lock); + + retcode = Endian32(retcode); + // Error code transmission + if (SendAll(s, &retcode, sizeof(UINT), false) == false) + { + return; + } + + + + if (retcode != 0) + { + // Disconnect due to an error + return; + } + + // Create a RPC server + rpc = StartRpcServer(s, CiRpcDispatch, c); + + // RPC server operation + RpcServer(rpc); + + // Release the RPC server + EndRpc(rpc); +} + +// RPC acceptance thread +void CiRpcAcceptThread(THREAD *thread, void *param) +{ + CLIENT_RPC_CONNECTION *conn; + CLIENT *c; + SOCK *s; + // Validate arguments + if (thread == NULL || param == NULL) + { + return; + } + + conn = (CLIENT_RPC_CONNECTION *)param; + s = conn->Sock; + c = conn->Client; + AddRef(s->ref); + + // Add to the RPC connection list + LockList(c->RpcConnectionList); + { + Add(c->RpcConnectionList, conn); + } + UnlockList(c->RpcConnectionList); + + NoticeThreadInit(thread); + + // Main process + CiRpcAccepted(c, s); + + // Release from the connection list + LockList(c->RpcConnectionList); + { + Delete(c->RpcConnectionList, conn); + } + UnlockList(c->RpcConnectionList); + + ReleaseSock(conn->Sock); + ReleaseThread(conn->Thread); + Free(conn); + + Disconnect(s); + ReleaseSock(s); +} + +// RPC server thread +void CiRpcServerThread(THREAD *thread, void *param) +{ + CLIENT *c; + SOCK *listener; + UINT i; + LIST *thread_list; + // Validate arguments + if (thread == NULL || param == NULL) + { + return; + } + + c = (CLIENT *)param; + + // RPC connection list + c->RpcConnectionList = NewList(NULL); + + // Open the port + listener = NULL; + for (i = CLIENT_CONFIG_PORT;i < (CLIENT_CONFIG_PORT + 5);i++) + { + listener = Listen(i); + if (listener != NULL) + { + break; + } + } + + if (listener == NULL) + { + // Error + Alert(CEDAR_PRODUCT_STR " VPN Client RPC Port Open Failed.", CEDAR_CLIENT_STR); + return; + } + +#ifdef OS_WIN32 + MsRegWriteIntEx2(REG_LOCAL_MACHINE, CLIENT_WIN32_REGKEYNAME, CLIENT_WIN32_REGVALUE_PORT, i, false, true); + MsRegWriteIntEx2(REG_LOCAL_MACHINE, CLIENT_WIN32_REGKEYNAME, CLIENT_WIN32_REGVALUE_PID, MsGetCurrentProcessId(), false, true); +#endif // OS_WIN32 + + c->RpcListener = listener; + AddRef(listener->ref); + + NoticeThreadInit(thread); + + while (true) + { + // Wait for client connection + CLIENT_RPC_CONNECTION *conn; + SOCK *s = Accept(listener); + if (s == NULL) + { + // Stop + break; + } + + // Create a client processing thread + conn = ZeroMalloc(sizeof(CLIENT_RPC_CONNECTION)); + conn->Client = c; + conn->Sock = s; + AddRef(s->ref); + + conn->Thread = NewThread(CiRpcAcceptThread, (void *)conn); + WaitThreadInit(conn->Thread); + + ReleaseSock(s); + } + + // Release the listener + ReleaseSock(listener); + + thread_list = NewListFast(NULL); + + // Set all the event notification + LockList(c->NotifyCancelList); + { + UINT i; + for (i = 0;i < LIST_NUM(c->NotifyCancelList);i++) + { + CANCEL *cancel = LIST_DATA(c->NotifyCancelList, i); + Cancel(cancel); + } + } + UnlockList(c->NotifyCancelList); + + // Disconnect all the connections of connected yet + LockList(c->RpcConnectionList); + { + for (i = 0;i < LIST_NUM(c->RpcConnectionList);i++) + { + CLIENT_RPC_CONNECTION *cc = LIST_DATA(c->RpcConnectionList, i); + AddRef(cc->Thread->ref); + Add(thread_list, cc->Thread); + Disconnect(cc->Sock); + } + } + UnlockList(c->RpcConnectionList); + + for (i = 0;i < LIST_NUM(thread_list);i++) + { + THREAD *t = LIST_DATA(thread_list, i); + WaitThread(t, INFINITE); + ReleaseThread(t); + } + + ReleaseList(c->RpcConnectionList); + ReleaseList(thread_list); + +#ifdef OS_WIN32 + MsRegDeleteValueEx2(REG_LOCAL_MACHINE, CLIENT_WIN32_REGKEYNAME, CLIENT_WIN32_REGVALUE_PORT, false, true); + MsRegDeleteValueEx2(REG_LOCAL_MACHINE, CLIENT_WIN32_REGKEYNAME, CLIENT_WIN32_REGVALUE_PID, false, true); +#endif // OS_WIN32 +} + +// Start the Keep +void CiInitKeep(CLIENT *c) +{ + // Validate arguments + if (c == NULL) + { + return; + } + + c->Keep = StartKeep(); + + // Apply settings + if (c->Config.UseKeepConnect) + { + KEEP *k = c->Keep; + Lock(k->lock); + { + StrCpy(k->ServerName, sizeof(k->ServerName), c->Config.KeepConnectHost); + k->ServerPort = c->Config.KeepConnectPort; + k->Interval = c->Config.KeepConnectInterval * 1000; + k->UdpMode = (c->Config.KeepConnectProtocol == CONNECTION_UDP) ? true : false; + k->Enable = true; + } + Unlock(k->lock); + } +} + +// Stop the Keep +void CiFreeKeep(CLIENT *c) +{ + // Validate arguments + if (c == NULL) + { + return; + } + + StopKeep(c->Keep); + c->Keep = NULL; +} + +// Start the RPC +void CiStartRpcServer(CLIENT *c) +{ + // Validate arguments + if (c == NULL) + { + return; + } + + c->RpcThread = NewThread(CiRpcServerThread, (void *)c); + WaitThreadInit(c->RpcThread); +} + +// Stop the RPC +void CiStopRpcServer(CLIENT *c) +{ + // Validate arguments + if (c == NULL) + { + return; + } + + Disconnect(c->RpcListener); + ReleaseSock(c->RpcListener); + + WaitThread(c->RpcThread, INFINITE); + ReleaseThread(c->RpcThread); +} + +// Wait for the next notification +bool CcWaitNotify(NOTIFY_CLIENT *n) +{ + UCHAR c; + // Validate arguments + if (n == NULL) + { + return false; + } + + // 1 character reception + if (RecvAll(n->Sock, &c, 1, false) == false) + { + // Disconnected + return false; + } + + return true; +} + +// Connect as a notification client +NOTIFY_CLIENT *CcConnectNotify(REMOTE_CLIENT *rc) +{ + NOTIFY_CLIENT *n; + SOCK *s; + char tmp[MAX_SIZE]; + bool rpc_mode = false; + UINT port; + // Validate arguments + if (rc == NULL || rc->Rpc == NULL || rc->Rpc->Sock == NULL) + { + return NULL; + } + + // Connect + IPToStr(tmp, sizeof(tmp), &rc->Rpc->Sock->RemoteIP); + port = rc->Rpc->Sock->RemotePort; + + s = Connect(tmp, port); + if (s == NULL) + { + return NULL; + } + + rpc_mode = Endian32(rpc_mode); + if (SendAll(s, &rpc_mode, sizeof(rpc_mode), false) == false) + { + ReleaseSock(s); + return NULL; + } + + n = ZeroMalloc(sizeof(NOTIFY_CLIENT)); + n->Sock = s; + + return n; +} + +// Stop the notification client +void CcStopNotify(NOTIFY_CLIENT *n) +{ + // Validate arguments + if (n == NULL) + { + return; + } + + Disconnect(n->Sock); +} + +// Delete the notification client +void CcDisconnectNotify(NOTIFY_CLIENT *n) +{ + // Validate arguments + if (n == NULL) + { + return; + } + + // Disconnect + Disconnect(n->Sock); + ReleaseSock(n->Sock); + + // Memory release + Free(n); +} + +// Disconnect the remote connection +void CcDisconnectRpc(REMOTE_CLIENT *rc) +{ + // Validate arguments + if (rc == NULL) + { + return; + } + + RpcFree(rc->Rpc); + Free(rc); +} + +// Connect to the client to start the shortcut connection setting +UINT CcShortcut(UCHAR *key) +{ + UINT ret; + // Validate arguments + if (key == NULL) + { + return ERR_INVALID_PARAMETER; + } + + CcConnectRpcEx("localhost", NULL, NULL, NULL, key, &ret, false, 0); + + return ret; +} + +// Disconnect the connected shortcut connection +UINT CcShortcutDisconnect(UCHAR *key) +{ + UINT ret; + // Validate arguments + if (key == NULL) + { + return ERR_INVALID_PARAMETER; + } + + CcConnectRpcEx("localhost", NULL, NULL, NULL, key, &ret, true, 0); + + return ret; +} + +// Connect to the remote client +REMOTE_CLIENT *CcConnectRpc(char *server_name, char *password, bool *bad_pass, bool *no_remote, UINT wait_retry) +{ + return CcConnectRpcEx(server_name, password, bad_pass, no_remote, NULL, NULL, false, wait_retry); +} +REMOTE_CLIENT *CcConnectRpcEx(char *server_name, char *password, bool *bad_pass, bool *no_remote, UCHAR *key, UINT *key_error_code, bool shortcut_disconnect, UINT wait_retry) +{ + SOCK *s = NULL; + UINT i; + UINT retcode; + UINT rpc_mode = CLIENT_RPC_MODE_MANAGEMENT; + RPC *rpc; + REMOTE_CLIENT *ret; + UCHAR hash_password[SHA1_SIZE]; + UINT port_start; + UINT64 try_started = 0; + bool ok; + UINT reg_port = 0; + UINT reg_pid = 0; + // Validate arguments + if (server_name == NULL) + { + return NULL; + } + if (password == NULL) + { + password = ""; + } + + if (key_error_code != NULL) + { + *key_error_code = ERR_NO_ERROR; + } + + if (bad_pass != NULL) + { + *bad_pass = false; + } + + if (no_remote != NULL) + { + *no_remote = false; + } + +#ifdef OS_WIN32 + // read the current port number from the registry of the localhost + if (StrCmpi(server_name, "localhost") == 0) + { + reg_port = MsRegReadIntEx2(REG_LOCAL_MACHINE, CLIENT_WIN32_REGKEYNAME, CLIENT_WIN32_REGVALUE_PORT, false, true); + reg_pid = MsRegReadIntEx2(REG_LOCAL_MACHINE, CLIENT_WIN32_REGKEYNAME, CLIENT_WIN32_REGVALUE_PID, false, true); + + if (reg_pid != 0) + { + if (MsIsServiceRunning(GC_SVC_NAME_VPNCLIENT) == false) + { + reg_port = 0; + } + } + else + { + reg_port = 0; + } + } + + if (reg_port != 0) + { + s = Connect(server_name, reg_port); + + if (s != NULL) + { + goto L_TRY; + } + } + +#endif // OS_WIN32 + + port_start = CLIENT_CONFIG_PORT - 1; + +RETRY: + port_start++; + + if (port_start >= (CLIENT_CONFIG_PORT + 5)) + { + return NULL; + } + + ok = false; + + while (true) + { + for (i = port_start;i < (CLIENT_CONFIG_PORT + 5);i++) + { + if (CheckTCPPort(server_name, i)) + { + ok = true; + break; + } + } + + if (ok) + { + break; + } + + if (wait_retry == 0) + { + break; + } + + if (try_started == 0) + { + try_started = Tick64(); + } + + if ((try_started + (UINT64)wait_retry) <= Tick64()) + { + break; + } + } + + if (ok == false) + { + if (key_error_code) + { + *key_error_code = ERR_CONNECT_FAILED; + } + return NULL; + } + + port_start = i; + + s = Connect(server_name, i); + if (s == NULL) + { + if (key_error_code) + { + *key_error_code = ERR_CONNECT_FAILED; + } + goto RETRY; + } +L_TRY: + + SetTimeout(s, 10000); + + Sha0(hash_password, password, StrLen(password)); + + if (key != NULL) + { + if (shortcut_disconnect == false) + { + rpc_mode = CLIENT_RPC_MODE_SHORTCUT; + } + else + { + rpc_mode = CLIENT_RPC_MODE_SHORTCUT_DISCONNECT; + } + } + + rpc_mode = Endian32(rpc_mode); + SendAdd(s, &rpc_mode, sizeof(UINT)); + + if (key != NULL) + { + SendAdd(s, key, SHA1_SIZE); + } + else + { + SendAdd(s, hash_password, SHA1_SIZE); + } + + if (SendNow(s, false) == false) + { + ReleaseSock(s); + goto RETRY; + } + + if (RecvAll(s, &retcode, sizeof(UINT), false) == false) + { + ReleaseSock(s); + goto RETRY; + } + + retcode = Endian32(retcode); + + if (retcode >= 1024) + { + ReleaseSock(s); + goto RETRY; + } + + if (key != NULL) + { + if (key_error_code) + { + *key_error_code = retcode; + } + SendAll(s, &retcode, sizeof(UINT), false); + ReleaseSock(s); + return NULL; + } + + switch (retcode) + { + case 1: + if (bad_pass != NULL) + { + *bad_pass = true; + } + break; + case 2: + if (no_remote != NULL) + { + *no_remote = true; + } + break; + } + + if (retcode != 0) + { + ReleaseSock(s); + return NULL; + } + + SetTimeout(s, INFINITE); + + rpc = StartRpcClient(s, NULL); + + ReleaseSock(s); + + ret = ZeroMalloc(sizeof(REMOTE_CLIENT)); + rpc->Param = ret; + + if (ret != NULL) + { + RPC_CLIENT_VERSION t; + + ret->Rpc = rpc; + Zero(&t, sizeof(t)); + CcGetClientVersion(ret, &t); + ret->OsType = t.OsType; + ret->Unix = OS_IS_UNIX(ret->OsType); + ret->Win9x = OS_IS_WINDOWS_9X(ret->OsType); + ret->IsVgcSupported = t.IsVgcSupported; + ret->ShowVgcLink = t.ShowVgcLink; + StrCpy(ret->ClientId, sizeof(ret->ClientId), t.ClientId); + } + + return ret; +} + +// Get a RPC_CLIENT_GET_CONNECTION_STATUS from the session +void CiGetSessionStatus(RPC_CLIENT_GET_CONNECTION_STATUS *st, SESSION *s) +{ + // Validate arguments + if (st == NULL || s == NULL) + { + return; + } + + Lock(s->lock); + { + // Operation flag + st->Active = true; + + // Session status + st->SessionStatus = s->ClientStatus; + + // Account name + UniStrCpy(st->AccountName, sizeof(st->AccountName), s->ClientOption->AccountName); + + if (s->ClientStatus == CLIENT_STATUS_ESTABLISHED && s->Connection != NULL) + { + Lock(s->Connection->lock); + { + // Connected flag + st->Connected = true; + // Product name + StrCpy(st->ServerProductName, sizeof(st->ServerProductName), s->Connection->ServerStr); + // Version + st->ServerProductVer = s->Connection->ServerVer; + // Build Number + st->ServerProductBuild = s->Connection->ServerBuild; + // Server certificate + st->ServerX = CloneX(s->Connection->ServerX); + // Client certificate + st->ClientX = CloneX(s->Connection->ClientX); + // Connection completion time of this connection + st->CurrentConnectionEstablishTime = TickToTime(s->CurrentConnectionEstablishTime); + // Maximum number of the TCP connections + st->MaxTcpConnections = s->MaxConnection; + // Half-connection + st->HalfConnection = s->HalfConnection; + // VLAN + st->VLanId = s->VLanId; + // VoIP / QoS + st->QoS = s->QoS; + if (s->Connection->Protocol == CONNECTION_TCP) + { + UINT i; + // Number of current TCP connections + LockList(s->Connection->Tcp->TcpSockList); + { + st->NumTcpConnections = LIST_NUM(s->Connection->Tcp->TcpSockList); + if (st->HalfConnection) + { + for (i = 0;i < st->NumTcpConnections;i++) + { + TCPSOCK *ts = LIST_DATA(s->Connection->Tcp->TcpSockList, i); + if (ts->Direction & TCP_SERVER_TO_CLIENT) + { + st->NumTcpConnectionsDownload++; + } + else + { + st->NumTcpConnectionsUpload++; + } + } + } + } + UnlockList(s->Connection->Tcp->TcpSockList); + } + // Use of encryption + st->UseEncrypt = s->UseEncrypt; + if (st->UseEncrypt) + { + StrCpy(st->CipherName, sizeof(st->CipherName), s->Connection->CipherName); + } + // Use of compression + st->UseCompress = s->UseCompress; + // R-UDP + st->IsRUDPSession = s->IsRUDPSession; + // Physical communication protocol + StrCpy(st->UnderlayProtocol, sizeof(st->UnderlayProtocol), s->UnderlayProtocol); + // Protocol details + StrCpy(st->ProtocolDetails, sizeof(st->ProtocolDetails), s->ProtocolDetails); + Trim(st->ProtocolDetails); + // UDP acceleration function + if (s->IpcSessionShared != NULL && IsEmptyStr(s->IpcSessionShared->ProtocolDetails) == false) + { + char tmp[sizeof(s->IpcSessionShared->ProtocolDetails)]; + StrCpy(tmp, sizeof(tmp), s->IpcSessionShared->ProtocolDetails); + Trim(tmp); + StrCat(st->ProtocolDetails, sizeof(st->ProtocolDetails), " "); + StrCat(st->ProtocolDetails, sizeof(st->ProtocolDetails), tmp); + + st->IsUdpAccelerationEnabled = s->IpcSessionShared->EnableUdpAccel; + st->IsUsingUdpAcceleration = s->IpcSessionShared->UsingUdpAccel; + } + else + { + st->IsUdpAccelerationEnabled = s->UseUdpAcceleration; + st->IsUsingUdpAcceleration = s->IsUsingUdpAcceleration; + } + // Session key + Copy(st->SessionKey, s->SessionKey, SHA1_SIZE); + // Policy + Copy(&st->Policy, s->Policy, sizeof(POLICY)); + // Data size + if (s->ServerMode == false) + { + st->TotalSendSize = s->TotalSendSize; + st->TotalRecvSize = s->TotalRecvSize; + st->TotalRecvSizeReal = s->TotalRecvSizeReal; + st->TotalSendSizeReal = s->TotalSendSizeReal; + } + else + { + st->TotalSendSize = s->TotalRecvSize; + st->TotalRecvSize = s->TotalSendSize; + st->TotalRecvSizeReal = s->TotalSendSizeReal; + st->TotalSendSizeReal = s->TotalRecvSizeReal; + } + // Session name + StrCpy(st->SessionName, sizeof(st->SessionName), s->Name); + // Connection name + StrCpy(st->ConnectionName, sizeof(st->ConnectionName), s->Connection->Name); + // Server name + StrCpy(st->ServerName, sizeof(st->ServerName), s->Connection->ServerName); + // Port number + st->ServerPort = s->Connection->ServerPort; + // Traffic data + Lock(s->TrafficLock); + { + Copy(&st->Traffic, s->Traffic, sizeof(TRAFFIC)); + } + Unlock(s->TrafficLock); + + st->IsBridgeMode = s->IsBridgeMode; + st->IsMonitorMode = s->IsMonitorMode; + } + Unlock(s->Connection->lock); + } + // Connection start time + st->StartTime = TickToTime(s->CreatedTime); + // Connection completion time of the first connection + /* !!! Do not correct the spelling to keep the backward protocol compatibility !!! */ + st->FirstConnectionEstablisiedTime = TickToTime(s->FirstConnectionEstablisiedTime); + // Number of connections have been established so far + st->NumConnectionsEstablished = s->NumConnectionsEstablished; + } + Unlock(s->lock); +} + +// Get the connection status +bool CtGetAccountStatus(CLIENT *c, RPC_CLIENT_GET_CONNECTION_STATUS *st) +{ + // Validate arguments + if (c == NULL || st == NULL) + { + return false; + } + + LockList(c->AccountList); + { + ACCOUNT t, *r; + + // Search for account + t.ClientOption = ZeroMalloc(sizeof(CLIENT_OPTION)); + UniStrCpy(t.ClientOption->AccountName, sizeof(t.ClientOption->AccountName), st->AccountName); + + r = Search(c->AccountList, &t); + if (r == NULL) + { + // Specified account is not found + UnlockList(c->AccountList); + + Free(t.ClientOption); + CiSetError(c, ERR_ACCOUNT_NOT_FOUND); + return false; + } + + Free(t.ClientOption); + + Lock(r->lock); + { + Zero(st, sizeof(RPC_CLIENT_GET_CONNECTION_STATUS)); + if (r->ClientSession != NULL) + { + SESSION *s = r->ClientSession; + CiGetSessionStatus(st, s); + } + } + Unlock(r->lock); + } + UnlockList(c->AccountList); + + return true; +} + +// Release the connection status +void CiFreeClientGetConnectionStatus(RPC_CLIENT_GET_CONNECTION_STATUS *st) +{ + // Validate arguments + if (st == NULL) + { + return; + } + + if (st->ServerX != NULL) + { + FreeX(st->ServerX); + } + + if (st->ClientX != NULL) + { + FreeX(st->ClientX); + } +} + +// Verification procedure of the server certificate +bool CiCheckCertProc(SESSION *s, CONNECTION *c, X *server_x, bool *expired) +{ +#ifdef OS_WIN32 + ACCOUNT *a; + X *old_x = NULL; + UI_CHECKCERT dlg; + // Validate arguments + if (s == NULL || c == NULL || server_x == NULL) + { + return false; + } + + if (expired != NULL) + { + *expired = false; + } + + Zero(&dlg, sizeof(dlg)); + + a = s->Account; + if (a == NULL) + { + return false; + } + + Lock(a->lock); + { + if (a->CheckServerCert == false) + { + // Not to validate the server certificate + Unlock(a->lock); + return true; + } + + if (a->ServerCert != NULL) + { + old_x = CloneX(a->ServerCert); + } + } + Unlock(a->lock); + + if (CheckXDateNow(server_x) == false) + { + // Expired + if (old_x != NULL) + { + FreeX(old_x); + } + + if (expired != NULL) + { + *expired = true; + } + + return false; + } + + if (old_x != NULL) + { + if (CompareX(old_x, server_x)) + { + // Matched exactly to the certificate that is already registered + if (old_x != NULL) + { + FreeX(old_x); + } + return true; + } + else + { + dlg.DiffWarning = true; + } + } + + // Because this certificate can not be trusted, confirm to be trusted by showing a dialog box + UniStrCpy(dlg.AccountName, sizeof(dlg.AccountName), a->ClientOption->AccountName); + StrCpy(dlg.ServerName, sizeof(dlg.ServerName), a->ClientOption->Hostname); + dlg.x = server_x; + dlg.old_x = old_x; + + dlg.Session = s; + AddRef(s->ref); + + CncCheckCert(s, &dlg); + + ReleaseSession(s); + + if (old_x != NULL) + { + FreeX(old_x); + } + + if (dlg.Ok && dlg.SaveServerCert) + { + // Save the server certificate and trust it from the next time + Lock(a->lock); + { + if (a->ServerCert != NULL) + { + FreeX(a->ServerCert); + } + + a->ServerCert = CloneX(server_x); + } + Unlock(a->lock); + CiSaveConfigurationFile(s->Cedar->Client); + } + + return dlg.Ok; +#else // OS_WIN32 + ACCOUNT *a; + X *old_x = NULL; + // Validate arguments + if (s == NULL || c == NULL || server_x == NULL) + { + return false; + } + + if (expired != NULL) + { + *expired = false; + } + + a = s->Account; + if (a == NULL) + { + return false; + } + + Lock(a->lock); + { + if (a->CheckServerCert == false) + { + // Not to validate the server certificate + Unlock(a->lock); + return true; + } + + if (a->ServerCert != NULL) + { + old_x = CloneX(a->ServerCert); + } + } + Unlock(a->lock); + + if (CheckXDateNow(server_x) == false) + { + // Expired + if (old_x != NULL) + { + FreeX(old_x); + } + + if (expired != NULL) + { + *expired = true; + } + + return false; + } + + if (old_x != NULL) + { + if (CompareX(old_x, server_x)) + { + // Exactly matched to the certificate that is already registered + if (old_x != NULL) + { + FreeX(old_x); + } + return true; + } + else + { + // Mismatch + if (old_x != NULL) + { + FreeX(old_x); + } + return false; + } + } + + return false; +#endif // OS_WIN32 +} + +// Signature procedure with a secure device +bool CiSecureSignProc(SESSION *s, CONNECTION *c, SECURE_SIGN *sign) +{ + // The UI is available in Win32 + return CncSecureSignDlg(sign); +} + +#ifdef OS_WIN32 +// Signing procedure (for Win32) +bool Win32CiSecureSign(SECURE_SIGN *sign) +{ + bool ret = false; + BUF *random; + // Validate arguments + if (sign == NULL) + { + return false; + } + + random = NewBuf(); + WriteBuf(random, sign->Random, SHA1_SIZE); + + // Batch processing + { + WINUI_SECURE_BATCH batch[] = + { + {WINUI_SECURE_READ_CERT, sign->SecurePublicCertName, true, NULL, NULL, NULL, NULL, NULL, NULL}, + {WINUI_SECURE_SIGN_WITH_KEY, sign->SecurePrivateKeyName, true, random, NULL, NULL, NULL, NULL, NULL} + }; + + if (SecureDeviceWindow(NULL, batch, sizeof(batch) / sizeof(batch[0]), + sign->UseSecureDeviceId, sign->BitmapId) == false) + { + // Failure + if (batch[0].OutputX != 0) + { + FreeX(batch[0].OutputX); + } + ret = false; + } + else + { + // Success + ret = true; + sign->ClientCert = batch[0].OutputX; + Copy(sign->Signature, batch[1].OutputSign, MIN(sizeof(sign->Signature),sizeof(batch[1].OutputSign))); + } + } + + FreeBuf(random); + + return ret; +} +#endif // OS_WIN32 + +// Disconnect +bool CtDisconnect(CLIENT *c, RPC_CLIENT_CONNECT *connect, bool inner) +{ + bool ret = false; + ACCOUNT t, *r; + SESSION *s = NULL; + // Validate arguments + if (c == NULL || connect == NULL) + { + return false; + } + + LockList(c->AccountList); + { + // Search for account + t.ClientOption = ZeroMalloc(sizeof(CLIENT_OPTION)); + UniStrCpy(t.ClientOption->AccountName, sizeof(t.ClientOption->AccountName), connect->AccountName); + + r = Search(c->AccountList, &t); + if (r == NULL) + { + // Specified account isn't found + UnlockList(c->AccountList); + + Free(t.ClientOption); + CiSetError(c, ERR_ACCOUNT_NOT_FOUND); + return false; + } + + Free(t.ClientOption); + + Lock(r->lock); + { + if (r->ClientSession == NULL) + { + // Not connected + CiSetError(c, ERR_ACCOUNT_INACTIVE); + } + else + { + s = r->ClientSession; + AddRef(s->ref); + // Disconnect complete + r->ClientSession = NULL; + ret = true; + } + } + Unlock(r->lock); + } + UnlockList(c->AccountList); + + if (s != NULL) + { + // Disconnect the connection (Wait until the disconnection is complete) + CLog(c, "LC_DISCONNECT", connect->AccountName); + StopSession(s); + ReleaseSession(s); + } + + + if (ret != false) + { + CiNotify(c); + } + + return ret; +} + +// Connect +bool CtConnect(CLIENT *c, RPC_CLIENT_CONNECT *connect) +{ + bool ret = false; + RPC_CLIENT_ENUM_VLAN t; + // Validate arguments + if (c == NULL || connect == NULL) + { + return false; + } + + Lock(c->lockForConnect); + { + Zero(&t, sizeof(t)); + if (CtEnumVLan(c, &t)) + { + if (t.NumItem == 0) + { + // There are no virtual LAN cards in the system + if (OS_IS_WINDOWS_NT(GetOsInfo()->OsType) || OS_IS_UNIX(GetOsInfo()->OsType)) + { + // Only in Linux system or Windows NT system, + // create a new virtual LAN card which named as "VPN" automatically + RPC_CLIENT_CREATE_VLAN t; + + Zero(&t, sizeof(t)); + StrCpy(t.DeviceName, sizeof(t.DeviceName), "VPN"); + CtCreateVLan(c, &t); + } + } + + CiFreeClientEnumVLan(&t); + } + } + Unlock(c->lockForConnect); + + CiNormalizeAccountVLan(c); + + // Ensure successfully VPN communication by changing the irrational WCM settings in the case of Windows 8 or later + CiDisableWcmNetworkMinimize(c); + + LockList(c->AccountList); + { + ACCOUNT t, *r; + bool unix_disabled = false; + + // Search for account + t.ClientOption = ZeroMalloc(sizeof(CLIENT_OPTION)); + UniStrCpy(t.ClientOption->AccountName, sizeof(t.ClientOption->AccountName), connect->AccountName); + + r = Search(c->AccountList, &t); + if (r == NULL) + { + // Specified account isn't found + UnlockList(c->AccountList); + + Free(t.ClientOption); + CiSetError(c, ERR_ACCOUNT_NOT_FOUND); + return false; + } + + Free(t.ClientOption); + +#ifndef OS_WIN32 + // Search for the virtual LAN card + LockList(c->UnixVLanList); + { + UNIX_VLAN *v, t; + + Zero(&t, sizeof(t)); + StrCpy(t.Name, sizeof(t.Name), r->ClientOption->DeviceName); + + v = Search(c->UnixVLanList, &t); + if (v == NULL) + { + UnlockList(c->UnixVLanList); + CiSetError(c, ERR_OBJECT_NOT_FOUND); + return false; + } + + unix_disabled = v->Enabled ? false : true; + } + UnlockList(c->UnixVLanList); +#endif // OS_WIN32 + + Lock(r->lock); + { + bool already_used = false; + UINT i; + + if (r->ClientSession != NULL) + { + // Already in connecting + CiSetError(c, ERR_ACCOUNT_ACTIVE); + } + else if (r->ClientAuth->AuthType == CLIENT_AUTHTYPE_SECURE && + c->UseSecureDeviceId == 0) + { + // Secure device is not specified + CiSetError(c, ERR_NO_SECURE_DEVICE_SPECIFIED); + } +#ifdef OS_WIN32 + else if (MsIsVLanExists(VLAN_ADAPTER_NAME_TAG, r->ClientOption->DeviceName) == false && + MsIsVLanExists(VLAN_ADAPTER_NAME_TAG_OLD, r->ClientOption->DeviceName) == false) + { + // Virtual LAN card can not be found + CiSetError(c, ERR_VLAN_FOR_ACCOUNT_NOT_FOUND); + CiNotify(c); + CiSendGlobalPulse(c); + } + else if (MsIsVLanEnabled(r->ClientOption->DeviceName) == false) + { + // The virtual LAN card is disabled + CiSetError(c, ERR_VLAN_FOR_ACCOUNT_DISABLED); + CiNotify(c); + CiSendGlobalPulse(c); + } +#else // OS_WIN32 + else if (unix_disabled) + { + // The virtual LAN card is disabled + CiSetError(c, ERR_VLAN_FOR_ACCOUNT_DISABLED); + CiNotify(c); + CiSendGlobalPulse(c); + } +#endif // OS_WIN32 + else + { + // Check whether the virtual LAN card is being used by a different account already + for (i = 0;i < LIST_NUM(c->AccountList);i++) + { + ACCOUNT *a = LIST_DATA(c->AccountList, i); + if (a != r) + { + if (StrCmpi(a->ClientOption->DeviceName, + r->ClientOption->DeviceName) == 0) + { + if (a->ClientSession != NULL) + { + already_used = true; + break; + } + } + } + } + + if (already_used) + { + CiSetError(c, ERR_VLAN_FOR_ACCOUNT_USED); + } + else + { + // Start the connection + PACKET_ADAPTER *pa = VLanGetPacketAdapter(); + + if (r->ClientAuth->AuthType == CLIENT_AUTHTYPE_SECURE) + { + // Register a procedure for secure device authentication + r->ClientAuth->SecureSignProc = CiSecureSignProc; + } + else if (r->ClientAuth->AuthType == CLIENT_AUTHTYPE_OPENSSLENGINE) + { + /* r->ClientAuth->ClientK = OpensslEngineToK("asdf"); */ + r->ClientAuth->SecureSignProc = NULL; + } + else + { + r->ClientAuth->SecureSignProc = NULL; + } + + if (r->CheckServerCert) + { + // Register a procedure to validate the server certificate + r->ClientAuth->CheckCertProc = CiCheckCertProc; + } + else + { + r->ClientAuth->CheckCertProc = NULL; + } + + r->StatusPrinter = CiClientStatusPrinter; + r->LastConnectDateTime = SystemTime64(); + + CLog(c, "LC_CONNECT", connect->AccountName); + + r->ClientSession = NewClientSessionEx(c->Cedar, r->ClientOption, r->ClientAuth, pa, r); + Notify(r->ClientSession, CLIENT_NOTIFY_ACCOUNT_CHANGED); + + ret = true; + } + } + } + Unlock(r->lock); + + } + UnlockList(c->AccountList); + + CiSaveConfigurationFile(c); + + return ret; +} + +// Put all unused TUN interfaces down +// Requires account and VLan lists of the CLIENT argument to be already locked +bool CtVLansDown(CLIENT *c) +{ +#ifndef UNIX_LINUX + return true; +#else + int i; + LIST *tmpVLanList; + UNIX_VLAN t, *r; + bool result = true; + + if (c == NULL) + { + return false; + } + + tmpVLanList = CloneList(c->UnixVLanList); + if (tmpVLanList == NULL) + { + return false; + } + + // Remove from tmpVLanList all VLans corresponding to active sessions + for (i = 0; i < LIST_NUM(c->AccountList); ++i) + { + ACCOUNT *a = LIST_DATA(c->AccountList, i); + if (a->ClientSession == NULL) + { + continue; + } + + Zero(&t, sizeof(t)); + StrCpy(t.Name, sizeof(t.Name), a->ClientOption->DeviceName); + r = Search(tmpVLanList, &t); + Delete(tmpVLanList, r); + } + + // Set down every VLan in tmpVLanList + for (i = 0; i < LIST_NUM(tmpVLanList) && result; ++i) + { + r = LIST_DATA(tmpVLanList, i); + result = UnixVLanSetState(r->Name, false); + // [MP:] Should we report *critical* error on failure? + } + + ReleaseList(tmpVLanList); + return result; +#endif +} + +// Put all TUN interfaces up +// Requires VLan list of the CLIENT argument to be already locked +bool CtVLansUp(CLIENT *c) +{ +#ifndef UNIX_LINUX + return true; +#else + int i; + UNIX_VLAN *r; + + if (c == NULL) + { + return false; + } + + for (i = 0; i < LIST_NUM(c->UnixVLanList); ++i) + { + r = LIST_DATA(c->UnixVLanList, i); + UnixVLanSetState(r->Name, true); + } + + return true; +#endif +} + +// Get the account information +bool CtGetAccount(CLIENT *c, RPC_CLIENT_GET_ACCOUNT *a) +{ + // Validate arguments + if (c == NULL || a == NULL) + { + return false; + } + + LockList(c->AccountList); + { + ACCOUNT t, *r; + + // Search for account + t.ClientOption = ZeroMalloc(sizeof(CLIENT_OPTION)); + UniStrCpy(t.ClientOption->AccountName, sizeof(t.ClientOption->AccountName), a->AccountName); + + r = Search(c->AccountList, &t); + if (r == NULL) + { + // Specified account can not be found + UnlockList(c->AccountList); + + Free(t.ClientOption); + CiSetError(c, ERR_ACCOUNT_NOT_FOUND); + return false; + } + + Free(t.ClientOption); + + Lock(r->lock); + { + // Copy the client option + if (a->ClientOption != NULL) + { + Free(a->ClientOption); + } + a->ClientOption = ZeroMalloc(sizeof(CLIENT_OPTION)); + Copy(a->ClientOption, r->ClientOption, sizeof(CLIENT_OPTION)); + + // Copy the authentication data + if (a->ClientAuth != NULL) + { + CiFreeClientAuth(a->ClientAuth); + } + a->ClientAuth = CopyClientAuth(r->ClientAuth); + + a->StartupAccount = r->StartupAccount; + + a->CheckServerCert = r->CheckServerCert; + a->RetryOnServerCert = r->RetryOnServerCert; + a->ServerCert = NULL; + if (r->ServerCert != NULL) + { + a->ServerCert = CloneX(r->ServerCert); + } + + // Shortcut Key + Copy(a->ShortcutKey, r->ShortcutKey, SHA1_SIZE); + + a->CreateDateTime = r->CreateDateTime; + a->LastConnectDateTime = r->LastConnectDateTime; + a->UpdateDateTime = r->UpdateDateTime; + } + Unlock(r->lock); + + } + UnlockList(c->AccountList); + + return true; +} + +// Change the account name +bool CtRenameAccount(CLIENT *c, RPC_RENAME_ACCOUNT *rename, bool inner) +{ + bool ret; + // Validate arguments + if (c == NULL || rename == NULL) + { + return false; + } + + + ret = false; + + if (UniStrCmp(rename->NewName, rename->OldName) == 0) + { + // The name has not been changed + return true; + } + + LockList(c->AccountList); + { + ACCOUNT t, *r, *r2; + + if (UniStrLen(rename->NewName) == 0) + { + // Name is invalid + CiSetError(c, ERR_INVALID_VALUE); + UnlockList(c->AccountList); + return false; + } + + // Search for old account name + t.ClientOption = ZeroMalloc(sizeof(CLIENT_OPTION)); + UniStrCpy(t.ClientOption->AccountName, sizeof(t.ClientOption->AccountName), rename->OldName); + + r = Search(c->AccountList, &t); + if (r == NULL) + { + // Specified account can not be found + UnlockList(c->AccountList); + + Free(t.ClientOption); + CiSetError(c, ERR_ACCOUNT_NOT_FOUND); + return false; + } + + Free(t.ClientOption); + + // Search for a new account name + t.ClientOption = ZeroMalloc(sizeof(CLIENT_OPTION)); + UniStrCpy(t.ClientOption->AccountName, sizeof(t.ClientOption->AccountName), rename->NewName); + + r2 = Search(c->AccountList, &t); + if (r2 != NULL) + { + // Account with the specified name already exists + UnlockList(c->AccountList); + + Free(t.ClientOption); + CiSetError(c, ERR_ACCOUNT_ALREADY_EXISTS); + return false; + } + + Free(t.ClientOption); + + Lock(r->lock); + { + // Check the operating state of the account + if (r->ClientSession != NULL) + { + // The Account is working + Unlock(r->lock); + UnlockList(c->AccountList); + CiSetError(c, ERR_ACCOUNT_ACTIVE); + + return false; + } + + // Update the account name + UniStrCpy(r->ClientOption->AccountName, sizeof(r->ClientOption->AccountName), + rename->NewName); + + CLog(c, "LC_RENAME_ACCOUNT", rename->OldName, rename->NewName); + + ret = true; + } + Unlock(r->lock); + + Sort(c->AccountList); + + } + UnlockList(c->AccountList); + + CiSaveConfigurationFile(c); + + CiNotify(c); + + return ret; +} + +// Set the client configuration +bool CtSetClientConfig(CLIENT *c, CLIENT_CONFIG *o) +{ + KEEP *k; + // Validate arguments + if (c == NULL || o == NULL) + { + return false; + } + + if (o->UseKeepConnect) + { + if (IsEmptyStr(o->KeepConnectHost) || + o->KeepConnectPort == 0 || + o->KeepConnectPort >= 65536) + { + CiSetError(c, ERR_INVALID_PARAMETER); + return false; + } + } + + Lock(c->lock); + { + Copy(&c->Config, o, sizeof(CLIENT_CONFIG)); + } + Unlock(c->lock); + + // Save the settings + CiSaveConfigurationFile(c); + + // Apply the Keep Connect + k = c->Keep; + Lock(k->lock); + { + if (o->UseKeepConnect) + { + StrCpy(k->ServerName, sizeof(k->ServerName), c->Config.KeepConnectHost); + k->ServerPort = c->Config.KeepConnectPort; + k->Interval = c->Config.KeepConnectInterval * 1000; + k->UdpMode = (c->Config.KeepConnectProtocol == CONNECTION_UDP) ? true : false; + k->Enable = true; + } + else + { + k->Enable = false; + } + } + Unlock(k->lock); + + // Apply TAP state + LockList(c->AccountList); + LockList(c->UnixVLanList); + + CtVLansDown(c); + + UnlockList(c->UnixVLanList); + UnlockList(c->AccountList); + + return true; +} + +// Get the network client configuration +bool CtGetClientConfig(CLIENT *c, CLIENT_CONFIG *o) +{ + // Validate arguments + if (c == NULL || o == NULL) + { + return false; + } + + Lock(c->lock); + { + Copy(o, &c->Config, sizeof(CLIENT_CONFIG)); + } + Unlock(c->lock); + + return true; +} + +// Unset the startup attribute of the account +bool CtRemoveStartupAccount(CLIENT *c, RPC_CLIENT_DELETE_ACCOUNT *a) +{ + bool ret; + // Validate arguments + if (c == NULL || a == NULL) + { + return false; + } + + ret = false; + + LockList(c->AccountList); + { + ACCOUNT t, *r; + // Search for an Account + + t.ClientOption = ZeroMalloc(sizeof(CLIENT_OPTION)); + UniStrCpy(t.ClientOption->AccountName, sizeof(t.ClientOption->AccountName), a->AccountName); + + r = Search(c->AccountList, &t); + if (r == NULL) + { + // Specified account can not be found + UnlockList(c->AccountList); + + Free(t.ClientOption); + CiSetError(c, ERR_ACCOUNT_NOT_FOUND); + return false; + } + + Free(t.ClientOption); + + Lock(r->lock); + { + // Unset the startup account + ret = true; + r->StartupAccount = false; + } + Unlock(r->lock); + } + UnlockList(c->AccountList); + + if (ret) + { + CiSaveConfigurationFile(c); + CiNotify(c); + } + + return ret; +} + +// Set the account as a start-up account +bool CtSetStartupAccount(CLIENT *c, RPC_CLIENT_DELETE_ACCOUNT *a, bool inner) +{ + bool ret; + // Validate arguments + if (c == NULL || a == NULL) + { + return false; + } + + + ret = false; + + LockList(c->AccountList); + { + ACCOUNT t, *r; + // Search for an account + + t.ClientOption = ZeroMalloc(sizeof(CLIENT_OPTION)); + UniStrCpy(t.ClientOption->AccountName, sizeof(t.ClientOption->AccountName), a->AccountName); + + r = Search(c->AccountList, &t); + if (r == NULL) + { + // Specified account can not be found + UnlockList(c->AccountList); + + Free(t.ClientOption); + CiSetError(c, ERR_ACCOUNT_NOT_FOUND); + return false; + } + + Free(t.ClientOption); + + Lock(r->lock); + { + // Set to a start-up account + ret = true; + r->StartupAccount = true; + } + Unlock(r->lock); + } + UnlockList(c->AccountList); + + if (ret) + { + CiSaveConfigurationFile(c); + CiNotify(c); + } + + return ret; +} + +// Delete the account +bool CtDeleteAccount(CLIENT *c, RPC_CLIENT_DELETE_ACCOUNT *a, bool inner) +{ + bool ret; + // Validate arguments + if (c == NULL || a == NULL) + { + return false; + } + + ret = false; + + if (c->Halt) + { + // Don't allow the removal of the account in the process of stopping + CiSetError(c, ERR_INTERNAL_ERROR); + return false; + } + + LockList(c->AccountList); + { + ACCOUNT t, *r; + // Search for an Account + + t.ClientOption = ZeroMalloc(sizeof(CLIENT_OPTION)); + UniStrCpy(t.ClientOption->AccountName, sizeof(t.ClientOption->AccountName), a->AccountName); + + r = Search(c->AccountList, &t); + if (r == NULL) + { + // Specified account can not be found + UnlockList(c->AccountList); + + Free(t.ClientOption); + CiSetError(c, ERR_ACCOUNT_NOT_FOUND); + return false; + } + + Free(t.ClientOption); + + Lock(r->lock); + { + // Check the operating state of the account + if (r->ClientSession != NULL) + { + // The account is active + Unlock(r->lock); + UnlockList(c->AccountList); + CiSetError(c, ERR_ACCOUNT_ACTIVE); + + return false; + } + + // Remove this account from the list + Delete(c->AccountList, r); + } + Unlock(r->lock); + + // Free the memory of this account + CiFreeAccount(r); + + CLog(c, "LC_DELETE_ACCOUNT", a->AccountName); + ret = true; + + } + UnlockList(c->AccountList); + + if (ret) + { + CiSaveConfigurationFile(c); + CiNotify(c); + } + + return ret; +} + +// Enumeration of accounts +bool CtEnumAccount(CLIENT *c, RPC_CLIENT_ENUM_ACCOUNT *e) +{ + // Validate arguments + if (c == NULL || e == NULL) + { + return false; + } + + LockList(c->AccountList); + { + UINT i; + // Number of accounts + e->NumItem = LIST_NUM(c->AccountList); + e->Items = ZeroMalloc(sizeof(RPC_CLIENT_ENUM_ACCOUNT_ITEM *) * e->NumItem); + + for (i = 0;i < e->NumItem;i++) + { + ACCOUNT *a = LIST_DATA(c->AccountList, i); + RPC_CLIENT_ENUM_ACCOUNT_ITEM *item = ZeroMalloc(sizeof(RPC_CLIENT_ENUM_ACCOUNT_ITEM)); + e->Items[i] = item; + + // Account name + UniStrCpy(item->AccountName, sizeof(item->AccountName), a->ClientOption->AccountName); + + // User name + StrCpy(item->UserName, sizeof(item->UserName), a->ClientAuth->Username); + + // Server name + StrCpy(item->ServerName, sizeof(item->ServerName), a->ClientOption->Hostname); + + // Proxy type + item->ProxyType = a->ClientOption->ProxyType; + + // Device name + StrCpy(item->DeviceName, sizeof(item->DeviceName), a->ClientOption->DeviceName); + + // Proxy information + if (item->ProxyType != PROXY_DIRECT) + { + StrCpy(item->ProxyName, sizeof(item->ProxyName), a->ClientOption->ProxyName); + } + + // Startup + item->StartupAccount = a->StartupAccount; + + // Active flag + item->Active = (a->ClientSession == NULL ? false : true); + + // Connection flag + item->Connected = (item->Active == false) ? false : a->ClientSession->ConnectSucceed; + + // Port number + item->Port = a->ClientOption->Port; + + // Virtual HUB name + StrCpy(item->HubName, sizeof(item->HubName), a->ClientOption->HubName); + + item->CreateDateTime = a->CreateDateTime; + item->LastConnectDateTime = a->LastConnectDateTime; + item->UpdateDateTime = a->UpdateDateTime; + } + } + UnlockList(c->AccountList); + + return true; +} + +// Configure the account +bool CtSetAccount(CLIENT *c, RPC_CLIENT_CREATE_ACCOUNT *a, bool inner) +{ + // Validate arguments + if (c == NULL || a == NULL) + { + return false; + } + + + // Check whether an account already exists + LockList(c->AccountList); + { + ACCOUNT t, *ret; + t.ClientOption = ZeroMalloc(sizeof(CLIENT_OPTION)); + UniStrCpy(t.ClientOption->AccountName, sizeof(t.ClientOption->AccountName), + a->ClientOption->AccountName); + + ret = Search(c->AccountList, &t); + if (ret == NULL) + { + // Not exist + UnlockList(c->AccountList); + Free(t.ClientOption); + + CiSetError(c, ERR_ACCOUNT_NOT_FOUND); + + return false; + } + Free(t.ClientOption); + + if (a->ClientAuth->AuthType == CLIENT_AUTHTYPE_CERT) + { + if (a->ClientAuth->ClientX == NULL || + a->ClientAuth->ClientX->is_compatible_bit == false || + a->ClientAuth->ClientK == NULL) + { + // Client certificate is invalid + UnlockList(c->AccountList); + CiSetError(c, ERR_NOT_RSA_1024); + return false; + } + } + + if (a->ServerCert != NULL && a->ServerCert->is_compatible_bit == false) + { + // Server certificate is invalid + UnlockList(c->AccountList); + CiSetError(c, ERR_NOT_RSA_1024); + return false; + } + + Lock(ret->lock); + { + +#if 0 + // Rewriting of the configuration is done even account running in the current version + // (New setting isn't applied until connecting next time) + if (ret->ClientSession != NULL) + { + // The account is operating + Unlock(ret->lock); + UnlockList(c->AccountList); + + CiSetError(c, ERR_ACCOUNT_ACTIVE); + + return false; + } +#endif + + // Delete the client authentication data + CiFreeClientAuth(ret->ClientAuth); + + // Copy the client authentication data + ret->ClientAuth = CopyClientAuth(a->ClientAuth); + + // Delete the client option + Free(ret->ClientOption); + + // Copy the client option + ret->ClientOption = ZeroMalloc(sizeof(CLIENT_OPTION)); + Copy(ret->ClientOption, a->ClientOption, sizeof(CLIENT_OPTION)); + + ret->StartupAccount = a->StartupAccount; + + ret->CheckServerCert = a->CheckServerCert; + ret->RetryOnServerCert = a->RetryOnServerCert; + + if (a->ServerCert != NULL) + { + if (ret->ServerCert != NULL) + { + FreeX(ret->ServerCert); + } + ret->ServerCert = CloneX(a->ServerCert); + } + else + { + if (ret->ServerCert != NULL) + { + FreeX(ret->ServerCert); + } + ret->ServerCert = false; + } + + ret->UpdateDateTime = SystemTime64(); + } + Unlock(ret->lock); + } + UnlockList(c->AccountList); + + CiSaveConfigurationFile(c); + + CiNotify(c); + + return true; +} + +// Create an account +bool CtCreateAccount(CLIENT *c, RPC_CLIENT_CREATE_ACCOUNT *a, bool inner) +{ + // Validate arguments + if (c == NULL || a == NULL) + { + return false; + } + + + // Check whether an account already exists + LockList(c->AccountList); + { + ACCOUNT t, *ret, *new_account; + t.ClientOption = ZeroMalloc(sizeof(CLIENT_OPTION)); + UniStrCpy(t.ClientOption->AccountName, sizeof(t.ClientOption->AccountName), + a->ClientOption->AccountName); + + ret = Search(c->AccountList, &t); + if (ret != NULL) + { + // Already exist + UnlockList(c->AccountList); + Free(t.ClientOption); + + CiSetError(c, ERR_ACCOUNT_ALREADY_EXISTS); + + return false; + } + + Free(t.ClientOption); + + if (UniStrLen(a->ClientOption->AccountName) == 0) + { + // The name is invalid + UnlockList(c->AccountList); + CiSetError(c, ERR_INVALID_VALUE); + return false; + } + + if (a->ClientAuth->AuthType == CLIENT_AUTHTYPE_CERT) + { + if (a->ClientAuth->ClientX == NULL || + a->ClientAuth->ClientX->is_compatible_bit == false || + a->ClientAuth->ClientK == NULL) + { + // The client certificate is invalid + UnlockList(c->AccountList); + CiSetError(c, ERR_NOT_RSA_1024); + return false; + } + } + + if (a->ServerCert != NULL && a->ServerCert->is_compatible_bit == false) + { + // The server certificate is invalid + UnlockList(c->AccountList); + CiSetError(c, ERR_NOT_RSA_1024); + return false; + } + + // Add a new account + new_account = ZeroMalloc(sizeof(ACCOUNT)); + new_account->lock = NewLock(); + + // Copy the client authentication data + new_account->ClientAuth = CopyClientAuth(a->ClientAuth); + + // Copy the client option + new_account->ClientOption = ZeroMalloc(sizeof(CLIENT_OPTION)); + Copy(new_account->ClientOption, a->ClientOption, sizeof(CLIENT_OPTION)); + + new_account->StartupAccount = a->StartupAccount; + + new_account->CheckServerCert = a->CheckServerCert; + new_account->RetryOnServerCert = a->RetryOnServerCert; + if (a->ServerCert != NULL) + { + new_account->ServerCert = CloneX(a->ServerCert); + } + + // Shortcut Key + if (IsZero(a->ShortcutKey, SHA1_SIZE)) + { + Rand(new_account->ShortcutKey, SHA1_SIZE); + } + else + { + Copy(new_account->ShortcutKey, a->ShortcutKey, SHA1_SIZE); + } + + new_account->CreateDateTime = new_account->UpdateDateTime = SystemTime64(); + + // Insert into the list + Insert(c->AccountList, new_account); + + CLog(c, "LC_NEW_ACCOUNT", a->ClientOption->AccountName); + } + UnlockList(c->AccountList); + + CiNormalizeAccountVLan(c); + + CiSaveConfigurationFile(c); + + CiNotify(c); + + return true; +} + +// Release the account acquisition structure +void CiFreeClientGetAccount(RPC_CLIENT_GET_ACCOUNT *a) +{ + // Validate arguments + if (a == NULL) + { + return; + } + + // Release the account information + if (a->ServerCert != NULL) + { + FreeX(a->ServerCert); + } + CiFreeClientAuth(a->ClientAuth); + Free(a->ClientOption); +} + +// Release the account creation structure +void CiFreeClientCreateAccount(RPC_CLIENT_CREATE_ACCOUNT *a) +{ + // Validate arguments + if (a == NULL) + { + return; + } + + // Release the account information + if (a->ServerCert != NULL) + { + FreeX(a->ServerCert); + } + CiFreeClientAuth(a->ClientAuth); + Free(a->ClientOption); +} + +// Stop the virtual LAN card +bool CtDisableVLan(CLIENT *c, RPC_CLIENT_CREATE_VLAN *vlan) +{ + UINT i; + bool used; + // Validate arguments + if (c == NULL || vlan == NULL) + { + return false; + } + +#ifndef OS_WIN32 + +#ifdef NO_VLAN + if (GetOsInfo()->OsType == OSTYPE_MACOS_X) + { + // Can not be added or removed the virtual LAN card in MacOS X + CiSetError(c, ERR_NOT_SUPPORTED); + return false; + } +#endif // NO_VLAN + + // Check whether the virtual LAN card with the specified name is not + // being used by one or more accounts + used = false; + LockList(c->AccountList); + { + for (i = 0;i < LIST_NUM(c->AccountList);i++) + { + ACCOUNT *a = LIST_DATA(c->AccountList, i); + if (StrCmpi(a->ClientOption->DeviceName, vlan->DeviceName) == 0) + { + Lock(a->lock); + { + if (a->ClientSession != NULL) + { + used = true; + } + } + Unlock(a->lock); + } + } + } + UnlockList(c->AccountList); + + // Search for the virtual LAN card + LockList(c->UnixVLanList); + { + UNIX_VLAN *v, t; + + Zero(&t, sizeof(t)); + StrCpy(t.Name, sizeof(t.Name), vlan->DeviceName); + + v = Search(c->UnixVLanList, &t); + if (v == NULL) + { + UnlockList(c->UnixVLanList); + CiSetError(c, ERR_OBJECT_NOT_FOUND); + return false; + } + + // Stop + v->Enabled = false; + } + UnlockList(c->UnixVLanList); + + CiSaveConfigurationFile(c); + CiNotify(c); + CiSendGlobalPulse(c); + + return true; + +#else // OS_WIN32 + + // Check whether the virtual LAN card with the specified name is not + // being used by one or more accounts + used = false; + LockList(c->AccountList); + { + for (i = 0;i < LIST_NUM(c->AccountList);i++) + { + ACCOUNT *a = LIST_DATA(c->AccountList, i); + if (StrCmpi(a->ClientOption->DeviceName, vlan->DeviceName) == 0) + { + Lock(a->lock); + { + if (a->ClientSession != NULL) + { + used = true; + } + } + Unlock(a->lock); + } + } + } + UnlockList(c->AccountList); + +#if 0 + if (used) + { + // In using + CiSetError(c, ERR_VLAN_IS_USED); + return false; + } +#endif + + + // Check whether the virtual LAN card are present + if (MsIsVLanExists(VLAN_ADAPTER_NAME_TAG, vlan->DeviceName) == false && + MsIsVLanExists(VLAN_ADAPTER_NAME_TAG_OLD, vlan->DeviceName) == false) + { + CiSetError(c, ERR_OBJECT_NOT_FOUND); + CiNotify(c); + CiSendGlobalPulse(c); + return false; + } + + + if (MsIs64BitWindows() && Is32() && MsIsAdmin()) + { + // Execute the driver_installer to process since this Windows is 64 bit + // but this code is 32 bit + char tmp[MAX_SIZE]; + + Format(tmp, sizeof(tmp), "disablevlan %s", vlan->DeviceName); + + if (MsExecDriverInstaller(tmp) == false) + { + CiSetError(c, ERR_VLAN_INSTALL_ERROR); + CiNotify(c); + CiSendGlobalPulse(c); + return false; + } + } + else + { + // Stop the virtual LAN card + if (MsDisableVLan(vlan->DeviceName) == false) + { + CiSetError(c, ERR_VLAN_INSTALL_ERROR); + CiNotify(c); + CiSendGlobalPulse(c); + return false; + } + } + + CiNotify(c); + CiSendGlobalPulse(c); + + return true; + +#endif // OS_WIN32 + +} + +// Start the virtual LAN card +bool CtEnableVLan(CLIENT *c, RPC_CLIENT_CREATE_VLAN *vlan) +{ + // Validate arguments + if (c == NULL || vlan == NULL) + { + return false; + } + +#ifndef OS_WIN32 + +#ifdef NO_VLAN + if (GetOsInfo()->OsType == OSTYPE_MACOS_X) + { + // Can not be added or removed the virtual LAN card in MacOS X + CiSetError(c, ERR_NOT_SUPPORTED); + return false; + } +#endif // NO_VLAN + + // Search the virtual LAN card + LockList(c->UnixVLanList); + { + UNIX_VLAN *v, t; + + Zero(&t, sizeof(t)); + StrCpy(t.Name, sizeof(t.Name), vlan->DeviceName); + + v = Search(c->UnixVLanList, &t); + if (v == NULL) + { + UnlockList(c->UnixVLanList); + CiSetError(c, ERR_OBJECT_NOT_FOUND); + return false; + } + + // Enable + v->Enabled = true; + } + UnlockList(c->UnixVLanList); + + CiSaveConfigurationFile(c); + CiNotify(c); + CiSendGlobalPulse(c); + + return true; + +#else // OS_WIN32 + + // Check whether the virtual LAN card are present + if (MsIsVLanExists(VLAN_ADAPTER_NAME_TAG, vlan->DeviceName) == false && + MsIsVLanExists(VLAN_ADAPTER_NAME_TAG_OLD, vlan->DeviceName) == false) + { + CiSetError(c, ERR_OBJECT_NOT_FOUND); + CiNotify(c); + CiSendGlobalPulse(c); + return false; + } + + if (MsIs64BitWindows() && Is32() && MsIsAdmin()) + { + // Execute the driver_installer to process since this Windows is 64 bit + // but this code is 32 bit + char tmp[MAX_SIZE]; + + Format(tmp, sizeof(tmp), "enablevlan %s", vlan->DeviceName); + + if (MsExecDriverInstaller(tmp) == false) + { + CiSetError(c, ERR_VLAN_INSTALL_ERROR); + CiNotify(c); + CiSendGlobalPulse(c); + return false; + } + } + else + { + // Start the virtual LAN card + if (MsEnableVLan(vlan->DeviceName) == false) + { + CiSetError(c, ERR_VLAN_INSTALL_ERROR); + CiNotify(c); + CiSendGlobalPulse(c); + return false; + } + } + + CiNotify(c); + CiSendGlobalPulse(c); + + return true; + +#endif // OS_WIN32 + +} + +// Delete the virtual LAN card +bool CtDeleteVLan(CLIENT *c, RPC_CLIENT_CREATE_VLAN *d) +{ + UINT i; + bool used; + // Validate arguments + if (c == NULL || d == NULL) + { + return false; + } + +#ifndef OS_WIN32 + +#ifdef NO_VLAN + if (GetOsInfo()->OsType == OSTYPE_MACOS_X) + { + // Can not be added or removed the virtual LAN card in MacOS X + CiSetError(c, ERR_NOT_SUPPORTED); + return false; + } +#endif // NO_VLAN + + // Check whether the virtual LAN card with the specified name is not + // being used by one or more accounts + used = false; + LockList(c->AccountList); + { + for (i = 0;i < LIST_NUM(c->AccountList);i++) + { + ACCOUNT *a = LIST_DATA(c->AccountList, i); + if (StrCmpi(a->ClientOption->DeviceName, d->DeviceName) == 0) + { + used = true; + } + } + } + UnlockList(c->AccountList); + +#if 0 + if (used) + { + // In using + CiSetError(c, ERR_VLAN_IS_USED); + return false; + } +#endif + + // Search for the virtual LAN card + LockList(c->UnixVLanList); + { + UNIX_VLAN *v, t; + + Zero(&t, sizeof(t)); + StrCpy(t.Name, sizeof(t.Name), d->DeviceName); + + v = Search(c->UnixVLanList, &t); + if (v == NULL) + { + UnlockList(c->UnixVLanList); + CiSetError(c, ERR_OBJECT_NOT_FOUND); + return false; + } + + // Remove + if (Delete(c->UnixVLanList, v)) + { + Free(v); + } + + CLog(c, "LC_DELETE_VLAN", d->DeviceName); + + UnixVLanDelete(d->DeviceName); + } + UnlockList(c->UnixVLanList); + + CiNormalizeAccountVLan(c); + + CiSaveConfigurationFile(c); + CiNotify(c); + CiSendGlobalPulse(c); + + return true; + +#else // OS_WIN32 + + if (MsIsNt() == false) + { + // Not available in Win9x + CiSetError(c, ERR_NOT_SUPPORTED); + return false; + } + + // Check whether the virtual LAN card are present + if (MsIsVLanExists(VLAN_ADAPTER_NAME_TAG, d->DeviceName) == false && + MsIsVLanExists(VLAN_ADAPTER_NAME_TAG_OLD, d->DeviceName) == false) + { + CiSetError(c, ERR_OBJECT_NOT_FOUND); + return false; + } + + // Check whether the virtual LAN card with the specified name is not + // being used by one or more accounts + used = false; + LockList(c->AccountList); + { + for (i = 0;i < LIST_NUM(c->AccountList);i++) + { + ACCOUNT *a = LIST_DATA(c->AccountList, i); + if (StrCmpi(a->ClientOption->DeviceName, d->DeviceName) == 0) + { + used = true; + } + } + } + UnlockList(c->AccountList); + +#if 0 + if (used) + { + // In using + CiSetError(c, ERR_VLAN_IS_USED); + return false; + } +#endif + + if (MsIs64BitWindows() && Is32() && MsIsAdmin()) + { + // Execute the driver_installer to process since this Windows is 64 bit + // but this code is 32 bit + char tmp[MAX_SIZE]; + + Format(tmp, sizeof(tmp), "uninstvlan %s", d->DeviceName); + + if (MsExecDriverInstaller(tmp) == false) + { + CiSetError(c, ERR_VLAN_INSTALL_ERROR); + return false; + } + } + else + { + // Delete the virtual LAN card directly + if (MsUninstallVLan(d->DeviceName) == false) + { + CiSetError(c, ERR_VLAN_INSTALL_ERROR); + CiNotify(c); + CiSendGlobalPulse(c); + return false; + } + } + + CLog(c, "LC_DELETE_VLAN", d->DeviceName); + + CiNormalizeAccountVLan(c); + + CiNotify(c); + CiSendGlobalPulse(c); + + return true; + +#endif // OS_WIN32 + +} + +// Get the name of the first VLAN +char *CiGetFirstVLan(CLIENT *c) +{ + char *ret = NULL; + RPC_CLIENT_ENUM_VLAN t; + // Validate arguments + if (c == NULL) + { + return NULL; + } + + Zero(&t, sizeof(t)); + if (CtEnumVLan(c, &t) == false) + { + return NULL; + } + + if (t.NumItem >= 1) + { + UINT i; + char *tmp = t.Items[0]->DeviceName; + + for (i = 0;i < t.NumItem;i++) + { + if (t.Items[i]->Enabled) + { + tmp = t.Items[i]->DeviceName; + } + } + + ret = CopyStr(tmp); + } + + CiFreeClientEnumVLan(&t); + + return ret; +} + +// Enumerate virtual LAN cards +bool CtEnumVLan(CLIENT *c, RPC_CLIENT_ENUM_VLAN *e) +{ + UINT i; + TOKEN_LIST *t; + // Validate arguments + if (c == NULL || e == NULL) + { + return false; + } + +#ifndef OS_WIN32 + + LockList(c->UnixVLanList); + { + e->NumItem = LIST_NUM(c->UnixVLanList); + e->Items = ZeroMalloc(sizeof(RPC_CLIENT_ENUM_VLAN_ITEM *) * e->NumItem); + + for (i = 0;i < e->NumItem;i++) + { + RPC_CLIENT_ENUM_VLAN_ITEM *item; + UNIX_VLAN *v; + + v = LIST_DATA(c->UnixVLanList, i); + e->Items[i] = ZeroMalloc(sizeof(RPC_CLIENT_ENUM_VLAN_ITEM)); + item = e->Items[i]; + + item->Enabled = v->Enabled; + BinToStr(item->MacAddress, sizeof(item->MacAddress), v->MacAddress, 6); + StrCpy(item->DeviceName, sizeof(item->DeviceName), v->Name); + StrCpy(item->Version, sizeof(item->Version), c->Cedar->VerString); + } + } + UnlockList(c->UnixVLanList); + + return true; + +#else // OS_WIN32 + + // Enumeration + t = MsEnumNetworkAdapters(VLAN_ADAPTER_NAME, VLAN_ADAPTER_NAME_OLD); + if (t == NULL) + { + // Enumeration failure + e->NumItem = 0; + e->Items = ZeroMalloc(0); + } + else + { + // Enumeration success + e->NumItem = t->NumTokens; + e->Items = ZeroMalloc(sizeof(RPC_CLIENT_ENUM_VLAN_ITEM *) * e->NumItem); + + for (i = 0;i < e->NumItem;i++) + { + char *tmp; + RPC_CLIENT_ENUM_VLAN_ITEM *item; + e->Items[i] = ZeroMalloc(sizeof(RPC_CLIENT_ENUM_VLAN_ITEM)); + item = e->Items[i]; + + StrCpy(item->DeviceName, sizeof(item->DeviceName), t->Token[i]); + item->Enabled = MsIsVLanEnabled(item->DeviceName); + + tmp = MsGetMacAddress(VLAN_ADAPTER_NAME_TAG, item->DeviceName); + if (tmp == NULL) + { + tmp = MsGetMacAddress(VLAN_ADAPTER_NAME_TAG_OLD, item->DeviceName); + } + + StrCpy(item->MacAddress, sizeof(item->MacAddress), tmp); + Free(tmp); + + tmp = MsGetDriverVersion(VLAN_ADAPTER_NAME_TAG, item->DeviceName); + if (tmp == NULL) + { + tmp = MsGetDriverVersion(VLAN_ADAPTER_NAME_TAG_OLD, item->DeviceName); + } + + StrCpy(item->Version, sizeof(item->Version), tmp); + Free(tmp); + } + + FreeToken(t); + } + + return true; + +#endif // OS_WIN32 +} + +// Release the virtual LAN card enumeration +void CiFreeClientEnumVLan(RPC_CLIENT_ENUM_VLAN *e) +{ + UINT i; + // Validate arguments + if (e == NULL) + { + return; + } + + for (i = 0;i < e->NumItem;i++) + { + Free(e->Items[i]); + } + Free(e->Items); +} + +// Set the information about the virtual LAN card +bool CtSetVLan(CLIENT *c, RPC_CLIENT_SET_VLAN *set) +{ + // Validate arguments + if (c == NULL || set == NULL) + { + return false; + } + +#ifndef OS_WIN32 + + LockList(c->UnixVLanList); + { + UNIX_VLAN t, *r; + Zero(&t, sizeof(t)); + StrCpy(t.Name, sizeof(t.Name), set->DeviceName); + + r = Search(c->UnixVLanList, &t); + if (r == NULL) + { + // Not exist + CiSetError(c, ERR_VLAN_ALREADY_EXISTS); + UnlockList(c->UnixVLanList); + return false; + } + + StrToMac(r->MacAddress, set->MacAddress); + } + UnlockList(c->UnixVLanList); + + CiSaveConfigurationFile(c); + CiNotify(c); + CiSendGlobalPulse(c); + + return true; + +#else // OS_WIN32 + + // Check whether the virtual LAN card with the specified name already exists + if (MsIsVLanExists(VLAN_ADAPTER_NAME_TAG, set->DeviceName) == false && + MsIsVLanExists(VLAN_ADAPTER_NAME_TAG_OLD, set->DeviceName) == false) + { + // Not exist + CiSetError(c, ERR_OBJECT_NOT_FOUND); + return false; + } + + // Configuring MAC address + MsSetMacAddress(VLAN_ADAPTER_NAME_TAG, set->DeviceName, set->MacAddress); + MsSetMacAddress(VLAN_ADAPTER_NAME_TAG_OLD, set->DeviceName, set->MacAddress); + + CiNotify(c); + CiSendGlobalPulse(c); + + return true; + +#endif // OS_WIN32 +} + +// Get the information about the virtual LAN card +bool CtGetVLan(CLIENT *c, RPC_CLIENT_GET_VLAN *get) +{ + char *tmp; + // Validate arguments + if (c == NULL || get == NULL) + { + return false; + } + +#ifndef OS_WIN32 + + // Unsupported + CiSetError(c, ERR_NOT_SUPPORTED); + return false; + +#else // OS_WIN32 + + // Check whether the virtual LAN card with the specified name already exists + if (MsIsVLanExists(VLAN_ADAPTER_NAME_TAG, get->DeviceName) == false && + MsIsVLanExists(VLAN_ADAPTER_NAME_TAG_OLD, get->DeviceName) == false) + { + // Not exist + CiSetError(c, ERR_OBJECT_NOT_FOUND); + return false; + } + + // Activity + get->Enabled = MsIsVLanEnabled(get->DeviceName); + + // MAC address + tmp = MsGetMacAddress(VLAN_ADAPTER_NAME_TAG, get->DeviceName); + if (tmp == NULL) + { + tmp = MsGetMacAddress(VLAN_ADAPTER_NAME_TAG_OLD, get->DeviceName); + } + StrCpy(get->MacAddress, sizeof(get->MacAddress), tmp); + Free(tmp); + + // Version + tmp = MsGetDriverVersion(VLAN_ADAPTER_NAME_TAG, get->DeviceName); + if (tmp == NULL) + { + tmp = MsGetDriverVersion(VLAN_ADAPTER_NAME_TAG_OLD, get->DeviceName); + } + StrCpy(get->Version, sizeof(get->Version), tmp); + Free(tmp); + + // File name + tmp = MsGetDriverFileName(VLAN_ADAPTER_NAME_TAG, get->DeviceName); + if (tmp == NULL) + { + tmp = MsGetDriverFileName(VLAN_ADAPTER_NAME_TAG_OLD, get->DeviceName); + } + StrCpy(get->FileName, sizeof(get->FileName), tmp); + Free(tmp); + + // GUID + tmp = MsGetNetworkAdapterGuid(VLAN_ADAPTER_NAME_TAG, get->DeviceName); + if (tmp == NULL) + { + tmp = MsGetNetworkAdapterGuid(VLAN_ADAPTER_NAME_TAG_OLD, get->DeviceName); + } + StrCpy(get->Guid, sizeof(get->Guid), tmp); + Free(tmp); + + return true; + +#endif // OS_WIN32 +} + +#ifdef OS_WIN32 +// Initialize the driver version information structure +void CiInitDriverVerStruct(MS_DRIVER_VER *ver) +{ + // Validate arguments + if (ver == NULL) + { + return; + } + + Zero(ver, sizeof(MS_DRIVER_VER)); + + ver->Year = BUILD_DATE_Y; + ver->Month = BUILD_DATE_M; + ver->Day = BUILD_DATE_D; + ver->Major = CEDAR_VERSION_MAJOR; + ver->Minor = CEDAR_VERSION_MINOR; + ver->Build = CEDAR_VERSION_BUILD; +} +#endif // OS_WIN32 + +// Upgrade the virtual LAN card +bool CtUpgradeVLan(CLIENT *c, RPC_CLIENT_CREATE_VLAN *create) +{ + bool use_old_name = false; + +#ifdef OS_WIN32 + KAKUSHI *k = NULL; + MS_DRIVER_VER ver; +#endif // OS_WIN32 + + // Validate arguments + if (c == NULL || create == NULL) + { + return false; + } + + +#ifndef OS_WIN32 + + // Always succeed + return true; + +#else // OS_WIN32 + + CiInitDriverVerStruct(&ver); + + if (MsIsNt() == false) + { + // Not available in Win9x + CiSetError(c, ERR_NOT_SUPPORTED); + return false; + } + + // Check whether the LAN card with the specified name already exists + if (MsIsVLanExists(VLAN_ADAPTER_NAME_TAG, create->DeviceName) == false && + MsIsVLanExists(VLAN_ADAPTER_NAME_TAG_OLD, create->DeviceName) == false) + { + // Not exist + CiSetError(c, ERR_OBJECT_NOT_FOUND); + CiNotify(c); + CiSendGlobalPulse(c); + return false; + } + + if (MsIsVLanExists(VLAN_ADAPTER_NAME_TAG_OLD, create->DeviceName)) + { + use_old_name = true; + } + + if (MsIsVista() == false) + { + k = InitKakushi(); + } + + + if (MsIsVista() == false) + { + // Perform the installation (other than Windows Vista) + if (MsUpgradeVLan(use_old_name ? VLAN_ADAPTER_NAME_TAG_OLD : VLAN_ADAPTER_NAME_TAG, + use_old_name ? VLAN_CONNECTION_NAME_OLD : VLAN_CONNECTION_NAME, + create->DeviceName, &ver) == false) + { + // Installation Failed + FreeKakushi(k); + CiSetError(c, ERR_VLAN_INSTALL_ERROR); + CiNotify(c); + CiSendGlobalPulse(c); + return false; + } + } + else + { + // Perform the installation (Windows Vista) + char tmp[MAX_SIZE]; + + Format(tmp, sizeof(tmp), "upgradevlan %s", create->DeviceName); + + if (CncExecDriverInstaller(tmp) == false) + { + // Installation Failed + FreeKakushi(k); + CiSetError(c, ERR_VLAN_INSTALL_ERROR); + CiNotify(c); + CiSendGlobalPulse(c); + return false; + } + } + + FreeKakushi(k); + + CLog(c, "LC_UPDATE_VLAN", create->DeviceName); + + CiNotify(c); + CiSendGlobalPulse(c); + + return true; + +#endif // OS_WIN32 +} + +// Create a virtual LAN card +bool CtCreateVLan(CLIENT *c, RPC_CLIENT_CREATE_VLAN *create) +{ + TOKEN_LIST *t; + UINT max_len; + +#ifdef OS_WIN32 + KAKUSHI *k = NULL; +#endif // OS_WIN32 + + // Validate arguments + if (c == NULL || create == NULL) + { + return false; + } + + if (SearchStrEx(create->DeviceName, " ", 0, false) != INFINITE) + { + // Spaces in the name is not allowed + CiSetError(c, ERR_INVALID_PARAMETER); + return false; + } + +#ifndef OS_WIN32 + + // Non-Win32 +#ifdef NO_VLAN + if (GetOsInfo()->OsType == OSTYPE_MACOS_X) + { + // A virtual LAN card can not be added or removed in MacOS X + CiSetError(c, ERR_NOT_SUPPORTED); + return false; + } +#endif // NO_VLAN + + // Check whether the specified name is valid or not + if (IsSafeStr(create->DeviceName) == false) + { + // Name is invalid + CiSetError(c, ERR_VLAN_INVALID_NAME); + return false; + } + + // Check whether the LAN card of the specified name already exists + LockList(c->UnixVLanList); + { + UNIX_VLAN t, *r; + Zero(&t, sizeof(t)); + StrCpy(t.Name, sizeof(t.Name), create->DeviceName); + + r = Search(c->UnixVLanList, &t); + if (r != NULL) + { + // Already exist + CiSetError(c, ERR_VLAN_ALREADY_EXISTS); + UnlockList(c->UnixVLanList); + return false; + } + + // Register + r = ZeroMalloc(sizeof(UNIX_VLAN)); + r->Enabled = true; + GenMacAddress(r->MacAddress); + StrCpy(r->Name, sizeof(r->Name), create->DeviceName); + + // Create a TUN + if (UnixVLanCreate(r->Name, r->MacAddress, false) == false) + { + // Failure + Free(r); + CiSetError(c, ERR_VLAN_INSTALL_ERROR); + UnlockList(c->UnixVLanList); + return false; + } + + CLog(c, "LC_CREATE_VLAN", create->DeviceName); + + Add(c->UnixVLanList, r); + } + UnlockList(c->UnixVLanList); + + CiNormalizeAccountVLan(c); + + CiNotify(c); + CiSendGlobalPulse(c); + CiSaveConfigurationFile(c); + + return true; + +#else // OS_WIN32 + + if (OS_IS_WINDOWS_9X(GetOsInfo()->OsType)) + { + // Only one LAN card is available in the Win9x + TOKEN_LIST *t; + + t = MsEnumNetworkAdapters(VLAN_ADAPTER_NAME, VLAN_ADAPTER_NAME_OLD); + if (t != NULL) + { + if (t->NumTokens >= 1) + { + FreeToken(t); + CiSetError(c, ERR_NOT_SUPPORTED); + return false; + } + FreeToken(t); + } + } + + // Check whether the specified name is valid or not + if (IsSafeStr(create->DeviceName) == false) + { + // Name is invalid + CiSetError(c, ERR_VLAN_INVALID_NAME); + return false; + } + + max_len = MsIsNt() ? MAX_DEVICE_NAME_LEN : MAX_DEVICE_NAME_LEN_9X; + if (StrLen(create->DeviceName) > max_len) + { + // Name is too long + CiSetError(c, ERR_VLAN_INVALID_NAME); + return false; + } + + // Regulation in Windows 8 / 10 + if (MsIsInfCatalogRequired()) + { + if (CiIsValidVLanRegulatedName(create->DeviceName) == false) + { + // Name is invalid + CiSetError(c, ERR_VLAN_INVALID_NAME); + return false; + } + } + + // Check whether the LAN card with the specified name already exists + if (MsIsVLanExists(VLAN_ADAPTER_NAME_TAG, create->DeviceName) || + MsIsVLanExists(VLAN_ADAPTER_NAME_TAG_OLD, create->DeviceName)) + { + // Already exist + CiSetError(c, ERR_VLAN_ALREADY_EXISTS); + return false; + } + + if (MsIsNt()) + { + if (MsIsVista() == false) + { + k = InitKakushi(); + } + } + + if (MsIsVista() == false) + { + MS_DRIVER_VER ver; + + CiInitDriverVerStruct(&ver); + + // Perform the installation (other than Windows Vista) + if (MsInstallVLan(VLAN_ADAPTER_NAME_TAG, VLAN_CONNECTION_NAME, create->DeviceName, &ver) == false) + { + // Installation Failed + FreeKakushi(k); + CiSetError(c, ERR_VLAN_INSTALL_ERROR); + CiNotify(c); + CiSendGlobalPulse(c); + return false; + } + } + else + { + // Perform the installation (Windows Vista) + char tmp[MAX_SIZE]; + + Format(tmp, sizeof(tmp), "instvlan %s", create->DeviceName); + + if (CncExecDriverInstaller(tmp) == false) + { + // Installation Failed + FreeKakushi(k); + CiSetError(c, ERR_VLAN_INSTALL_ERROR); + CiNotify(c); + CiSendGlobalPulse(c); + return false; + } + } + + FreeKakushi(k); + + t = MsEnumNetworkAdapters(VLAN_ADAPTER_NAME, VLAN_ADAPTER_NAME_OLD); + if (t->NumTokens == 1) + { + UINT i; + // If the result of the installation, virtual LAN card is only one, + // set virtual LAN card setting of all existing accounts to this virtual LAN card + LockList(c->AccountList); + { + for (i = 0;i < LIST_NUM(c->AccountList);i++) + { + ACCOUNT *a = LIST_DATA(c->AccountList, i); + Lock(a->lock); + { + if (a->ClientOption != NULL) + { + StrCpy(a->ClientOption->DeviceName, sizeof(a->ClientOption->DeviceName), create->DeviceName); + } + } + Unlock(a->lock); + } + } + UnlockList(c->AccountList); + } + FreeToken(t); + + CLog(c, "LC_CREATE_VLAN", create->DeviceName); + + CiNormalizeAccountVLan(c); + + CiNotify(c); + CiSendGlobalPulse(c); + + CiSaveConfigurationFile(c); + + if (MsIsNt() == false) + { + if (GetOsInfo()->OsType == OSTYPE_WINDOWS_ME) + { + // Show the warning in the case of Windows Me + MsgBox(NULL, 0x00000040L, _UU("CM_9X_VLAN_ME_MESSAGE")); + } + + ReleaseThread(NewThread(Win9xRebootThread, NULL)); + } + + return true; + +#endif // OS_WIN32 +} + +// Enumerate objects in the secure device +bool CtEnumObjectInSecure(CLIENT *c, RPC_ENUM_OBJECT_IN_SECURE *e) +{ + UINT i; + // Validate arguments + if (c == NULL || e == NULL) + { + return false; + } + + e->NumItem = 5; + e->ItemName = ZeroMalloc(sizeof(char *) * e->NumItem); + e->ItemType = ZeroMalloc(sizeof(bool) * e->NumItem); + + for (i = 0;i < e->NumItem;i++) + { + char tmp[MAX_SIZE]; + Format(tmp, sizeof(tmp), "Test Object %u", i); + e->ItemName[i] = CopyStr(tmp); + e->ItemType[i] = (i % 2 == 0) ? false : true; + } + + return true; +} + +// Get the secure device to be used +bool CtGetUseSecure(CLIENT *c, RPC_USE_SECURE *sec) +{ + // Validate arguments + if (c == NULL || sec == NULL) + { + return false; + } + + sec->DeviceId = c->UseSecureDeviceId; + + return true; +} + +// Specifying a secure device to be used +bool CtUseSecure(CLIENT *c, RPC_USE_SECURE *sec) +{ + // Validate arguments + if (c == NULL || sec == NULL) + { + return false; + } + +// Do not check whether there is the specified device on the client manager +/* if (CheckSecureDeviceId(sec->DeviceId)) + { + c->UseSecureDeviceId = sec->DeviceId; + } + else + { + CiSetError(c, ERR_OBJECT_NOT_FOUND); + return false; + } +*/ + c->UseSecureDeviceId = sec->DeviceId; + + CiSaveConfigurationFile(c); + + return true; +} + +// Enumeration of secure devices +bool CtEnumSecure(CLIENT *c, RPC_CLIENT_ENUM_SECURE *e) +{ + LIST *o; + UINT i; + // Validate arguments + if (c == NULL || e == NULL) + { + return false; + } + + o = GetSecureDeviceList(); + + e->NumItem = LIST_NUM(o); + e->Items = ZeroMalloc(sizeof(RPC_CLIENT_ENUM_SECURE_ITEM *) * e->NumItem); + + for (i = 0;i < LIST_NUM(o);i++) + { + RPC_CLIENT_ENUM_SECURE_ITEM *item = ZeroMalloc(sizeof(RPC_CLIENT_ENUM_SECURE_ITEM)); + SECURE_DEVICE *s = LIST_DATA(o, i); + + item->DeviceId = s->Id; + StrCpy(item->DeviceName, sizeof(item->DeviceName), s->DeviceName); + StrCpy(item->Manufacturer, sizeof(item->Manufacturer), s->Manufacturer); + item->Type = s->Type; + + e->Items[i] = item; + } + + return true; +} + +// Release the secure device enumeration +void CiFreeClientEnumSecure(RPC_CLIENT_ENUM_SECURE *e) +{ + UINT i; + // Validate arguments + if (e == NULL) + { + return; + } + + for (i = 0;i < e->NumItem;i++) + { + Free(e->Items[i]); + } + Free(e->Items); +} + +// Release the RPC_GET_ISSUER +void CiFreeGetIssuer(RPC_GET_ISSUER *a) +{ + // Validate arguments + if (a == NULL) + { + return; + } + + if (a->issuer_x != NULL) + { + FreeX(a->issuer_x); + } + if (a->x != NULL) + { + FreeX(a->x); + } +} + +// Get the common proxy settings +bool CtGetCommonProxySetting(CLIENT *c, INTERNET_SETTING *a) +{ + // Validate arguments + if (c == NULL || a == NULL) + { + return false; + } + + Copy(a, &c->CommonProxySetting, sizeof(INTERNET_SETTING)); + + return true; +} + +// Set the common proxy settings +bool CtSetCommonProxySetting(CLIENT *c, INTERNET_SETTING *a) +{ + // Validate arguments + if (c == NULL || a == NULL) + { + return false; + } + + Copy(&c->CommonProxySetting, a, sizeof(INTERNET_SETTING)); + + + CiSaveConfigurationFile(c); + + return true; +} + +// Get the issuer +bool CtGetIssuer(CLIENT *c, RPC_GET_ISSUER *a) +{ + X *x; + // Validate arguments + if (c == NULL || a == NULL) + { + return false; + } + + x = FindCaSignedX(c->Cedar->CaList, a->x); + if (x == NULL) + { + CiSetError(c, ERR_OBJECT_NOT_FOUND);; + return false; + } + else + { + a->issuer_x = x; + if (a->x != NULL) + { + FreeX(a->x); + a->x = NULL; + } + return true; + } +} + +// Get the CA certificate +bool CtGetCa(CLIENT *c, RPC_GET_CA *get) +{ + bool ret = true; + X *cert = NULL; + // Validate arguments + if (c == NULL || get == NULL) + { + return false; + } + + LockList(c->Cedar->CaList); + { + UINT i; + + for (i = 0;i < LIST_NUM(c->Cedar->CaList);i++) + { + X *x = LIST_DATA(c->Cedar->CaList, i); + + if (POINTER_TO_KEY(x) == get->Key) + { + cert = CloneX(x); + break; + } + } + } + UnlockList(c->Cedar->CaList); + + if (cert == NULL) + { + // Certificate does not exist + ret = false; + CiSetError(c, ERR_OBJECT_NOT_FOUND); + } + else + { + ret = true; + get->x = cert; + } + + return ret; +} + +// Delete the CA certificate +bool CtDeleteCa(CLIENT *c, RPC_CLIENT_DELETE_CA *p) +{ + bool ret; + // Validate arguments + if (c == NULL || p == NULL) + { + return false; + } + + ret = DeleteCa(c->Cedar, p->Key); + + if (ret == false) + { + CiSetError(c, ERR_OBJECT_NOT_FOUND); + } + + CiSaveConfigurationFile(c); + + return ret; +} + +// Add a CA certificate +bool CtAddCa(CLIENT *c, RPC_CERT *cert) +{ + // Validate arguments + if (c == NULL || cert == NULL) + { + return false; + } + + if (cert->x->is_compatible_bit == false) + { + CiSetError(c, ERR_NOT_RSA_1024); + return false; + } + + AddCa(c->Cedar, cert->x); + + CiSaveConfigurationFile(c); + + return true; +} + +// Enumerate the trusted CA +bool CtEnumCa(CLIENT *c, RPC_CLIENT_ENUM_CA *e) +{ + // Validate arguments + if (c == NULL || e == NULL) + { + return false; + } + + Zero(e, sizeof(RPC_CLIENT_ENUM_CA)); + + LockList(c->Cedar->CaList); + { + UINT i; + e->NumItem = LIST_NUM(c->Cedar->CaList); + e->Items = ZeroMalloc(sizeof(RPC_CLIENT_ENUM_CA_ITEM *) * e->NumItem); + + for (i = 0;i < e->NumItem;i++) + { + X *x = LIST_DATA(c->Cedar->CaList, i); + e->Items[i] = ZeroMalloc(sizeof(RPC_CLIENT_ENUM_CA_ITEM)); + GetAllNameFromNameEx(e->Items[i]->SubjectName, sizeof(e->Items[i]->SubjectName), x->subject_name); + GetAllNameFromNameEx(e->Items[i]->IssuerName, sizeof(e->Items[i]->IssuerName), x->issuer_name); + e->Items[i]->Expires = x->notAfter; + e->Items[i]->Key = POINTER_TO_KEY(x); + } + } + UnlockList(c->Cedar->CaList); + + return true; +} + +// Release the CA enumeration +void CiFreeClientEnumCa(RPC_CLIENT_ENUM_CA *e) +{ + UINT i; + // Validate arguments + if (e == NULL) + { + return; + } + + for (i = 0;i < e->NumItem;i++) + { + RPC_CLIENT_ENUM_CA_ITEM *ca = e->Items[i]; + Free(ca); + } + Free(e->Items); +} + +// Get the password setting +bool CtGetPasswordSetting(CLIENT *c, RPC_CLIENT_PASSWORD_SETTING *a) +{ + UCHAR hash[SHA1_SIZE]; + // Validate arguments + if (c == NULL || a == NULL) + { + return false; + } + + Sha0(hash, "", 0); + if (Cmp(hash, c->EncryptedPassword, SHA1_SIZE) == 0) + { + a->IsPasswordPresented = false; + } + else + { + a->IsPasswordPresented = true; + } + + a->PasswordRemoteOnly = c->PasswordRemoteOnly; + + return true; +} + +// Set the password +bool CtSetPassword(CLIENT *c, RPC_CLIENT_PASSWORD *pass) +{ + char *str; + if (c == NULL) + { + return false; + } + + str = pass->Password; + + if (StrCmp(str, "********") != 0) + { + // Hash the password + Sha0(c->EncryptedPassword, str, StrLen(str)); + } + + c->PasswordRemoteOnly = pass->PasswordRemoteOnly; + + CLog(c, "LC_SET_PASSWORD"); + + CiSaveConfigurationFile(c); + + return true; +} + +void CiFreeIni(LIST *o) +{ + // Validate arguments + if (o == NULL) + { + return; + } + + FreeIni(o); +} + +// Read the custom.ini file +LIST *CiLoadIni() +{ + BUF *b = ReadDump(CLIENT_CUSTOM_INI_FILENAME); + LIST *ini; + if (b == NULL) + { + return NULL; + } + + ini = ReadIni(b); + + FreeBuf(b); + + return ini; + +} + +// Reflect the settings of the custom.ini +void CiLoadIniSettings(CLIENT *c) +{ + LIST *o; + //char *log; + //char *config; + + if (c == NULL) + { + return; + } + + o = CiLoadIni(); + + if (o == NULL) + { + return; + } + + /*log = IniStrValue(o, "NoSaveLog"); + config = IniStrValue(o, "NoSaveConfig"); + + if(StrCmpi(log, "true") == 0) + { + c->NoSaveLog = true; + } + if(StrCmpi(config, "true") == 0) + { + c->NoSaveConfig = true; + }*/ + + c->NoSaveLog = ToBool(IniStrValue(o, "NoSaveLog")); + c->NoSaveConfig = ToBool(IniStrValue(o, "NoSaveConfig")); + + CiFreeIni(o); + +} + +bool CiLoadConfigFilePathFromIni(char *path, UINT size) +{ + char *tmp; + LIST *o; + bool ret = false; + + // Validate arguments + if (path == NULL) + { + return false; + } + + o = CiLoadIni(); + + if (o == NULL) + { + return false; + } + + StrCpy(path, size, ""); + + tmp = IniStrValue(o, "ConfigPath"); + NormalizePath(path, size, tmp); + + if (IsEmptyStr(path) == false) + { + ret = true; + } + else + { + ret = false; + } + + CiFreeIni(o); + + return ret; +} + +// Set the client error code +void CiSetError(CLIENT *c, UINT err) +{ + // Validate arguments + if (c == NULL) + { + return; + } + + c->Err = err; +} + +// UNIX virtual LAN card comparison function +int CiCompareUnixVLan(void *p1, void *p2) +{ + UNIX_VLAN *v1, *v2; + if (p1 == NULL || p2 == NULL) + { + return 0; + } + v1 = *(UNIX_VLAN **)p1; + v2 = *(UNIX_VLAN **)p2; + if (v1 == NULL || v2 == NULL) + { + return 0; + } + + return StrCmpi(v1->Name, v2->Name); +} + +// Modify the account settings that an incorrect VLAN name is specified +void CiNormalizeAccountVLan(CLIENT *c) +{ + bool b = false; + char *name; + UINT i; + // Validate arguments + if (c == NULL) + { + return; + } + + name = CiGetFirstVLan(c); + + if (name != NULL) + { + LockList(c->AccountList); + { + for (i = 0;i < LIST_NUM(c->AccountList);i++) + { + ACCOUNT *a = LIST_DATA(c->AccountList, i); + + Lock(a->lock); + { + if (a->ClientOption != NULL) + { + if (CiIsVLan(c, a->ClientOption->DeviceName) == false) + { + StrCpy(a->ClientOption->DeviceName, sizeof(a->ClientOption->DeviceName), + name); + b = true; + } + } + } + Unlock(a->lock); + } + } + UnlockList(c->AccountList); + + Free(name); + } + + if (b) + { + CiNotify(c); + CiSendGlobalPulse(c); + CiSaveConfigurationFile(c); + } +} + +// Check whether a virtual LAN card of the specified name exists +bool CiIsVLan(CLIENT *c, char *name) +{ + // Validate arguments + if (c == NULL || name == NULL) + { + return false; + } + +#ifdef OS_WIN32 + { + TOKEN_LIST *t; + UINT i; + + t = MsEnumNetworkAdapters(VLAN_ADAPTER_NAME, VLAN_ADAPTER_NAME_OLD); + if (t == NULL) + { + return false; + } + + for (i = 0;i < t->NumTokens;i++) + { + if (StrCmpi(t->Token[i], name) == 0) + { + FreeToken(t); + return true; + } + } + + FreeToken(t); + + return false; + } +#else // OS_WIN32 + { + UNIX_VLAN *v; + UINT i; + bool ret = false; + + LockList(c->UnixVLanList); + { + for (i = 0;i < LIST_NUM(c->UnixVLanList);i++) + { + v = (UNIX_VLAN *)LIST_DATA(c->UnixVLanList, i); + if (StrCmpi(v->Name, name) == 0) + { + ret = true; + } + } + } + UnlockList(c->UnixVLanList); + + return ret; + } +#endif // OS_WIN32 +} + +// If a non-existent virtual LAN card is specified in any Account, and only +// one virtual LAN card is installed, set the virtual LAN card to the account +void CiSetVLanToDefault(CLIENT *c) +{ + char device_name[MAX_SIZE]; + // Validate arguments + if (c == NULL) + { + return; + } + +#ifdef OS_WIN32 + { + TOKEN_LIST *t; + + t = MsEnumNetworkAdapters(VLAN_ADAPTER_NAME, VLAN_ADAPTER_NAME_OLD); + if (t == NULL) + { + return; + } + if (t->NumTokens != 1) + { + FreeToken(t); + return; + } + StrCpy(device_name, sizeof(device_name), t->Token[0]); + FreeToken(t); + } +#else // OS_WIN32 + { + UNIX_VLAN *v; + + LockList(c->UnixVLanList); + + if (LIST_NUM(c->UnixVLanList) != 1) + { + UnlockList(c->UnixVLanList); + return; + } + v = LIST_DATA(c->UnixVLanList, 0); + StrCpy(device_name, sizeof(device_name), v->Name); + + UnlockList(c->UnixVLanList); + } +#endif // OS_WIN32 + + { + UINT i; + LockList(c->AccountList); + { + for (i = 0;i < LIST_NUM(c->AccountList);i++) + { + ACCOUNT *a = LIST_DATA(c->AccountList, i); + + Lock(a->lock); + { + if (CiIsVLan(c, a->ClientOption->DeviceName) == false) + { + StrCpy(a->ClientOption->DeviceName, sizeof(a->ClientOption->DeviceName), + device_name); + } + } + Unlock(a->lock); + } + } + UnlockList(c->AccountList); + } +} + +// Initialize the settings +void CiInitConfiguration(CLIENT *c) +{ + // Validate arguments + if (c == NULL) + { + return; + } + +#ifdef OS_UNIX + // Initialize the VLAN + UnixVLanInit(); +#endif // OS_UNIX + + // Account list + c->AccountList = NewList(CiCompareAccount); + + // Unix version VLAN list + if (OS_IS_UNIX(GetOsInfo()->OsType)) + { + c->UnixVLanList = NewList(CiCompareUnixVLan); + } + + // Read the configuration file + CLog(c, "LC_LOAD_CONFIG_1"); + if (CiLoadConfigurationFile(c) == false) + { + CLog(c, "LC_LOAD_CONFIG_3"); + // Do the initial setup because the configuration file does not exist + // Clear the password + Sha0(c->EncryptedPassword, "", 0); + // Initialize the client configuration + // Disable remote management + c->Config.AllowRemoteConfig = false; + StrCpy(c->Config.KeepConnectHost, sizeof(c->Config.KeepConnectHost), CLIENT_DEFAULT_KEEPALIVE_HOST); + c->Config.KeepConnectPort = CLIENT_DEFAULT_KEEPALIVE_PORT; + c->Config.KeepConnectProtocol = CONNECTION_UDP; + c->Config.KeepConnectInterval = CLIENT_DEFAULT_KEEPALIVE_INTERVAL; + c->Config.UseKeepConnect = false; // Don't use the connection maintenance function by default in the Client + // Eraser + c->Eraser = NewEraser(c->Logger, 0); + } + else + { + CLog(c, "LC_LOAD_CONFIG_2"); + } + + // Appropriate setting for virtual LAN card + CiSetVLanToDefault(c); +} + +// Release the settings +void CiFreeConfiguration(CLIENT *c) +{ + UINT i; + // Validate arguments + if (c == NULL) + { + return; + } + + // Write to the configuration file + CiSaveConfigurationFile(c); + + // Release the configuration file + FreeCfgRw(c->CfgRw); + + // Release the account list + for (i = 0;i < LIST_NUM(c->AccountList);i++) + { + ACCOUNT *a = LIST_DATA(c->AccountList, i); + + CiFreeAccount(a); + } + ReleaseList(c->AccountList); + + if (c->UnixVLanList != NULL) + { + // Release of UNIX version VLAN list + for (i = 0;i < LIST_NUM(c->UnixVLanList);i++) + { + UNIX_VLAN *v = LIST_DATA(c->UnixVLanList, i); + Free(v); + } + ReleaseList(c->UnixVLanList); + } + c->UnixVLanList = NULL; + +#ifdef OS_UNIX + // Release the VLAN + UnixVLanFree(); +#endif // OS_UNIX +} + +// Release the certificate data acquisition +void CiFreeGetCa(RPC_GET_CA *a) +{ + // Validate arguments + if (a == NULL) + { + return; + } + + FreeX(a->x); +} + +// Release the client authentication data +void CiFreeClientAuth(CLIENT_AUTH *auth) +{ + // Validate arguments + if (auth == NULL) + { + return; + } + + if (auth->ClientX != NULL) + { + FreeX(auth->ClientX); + } + if (auth->ClientK != NULL) + { + FreeK(auth->ClientK); + } + + Free(auth); +} + +// Release the account +void CiFreeAccount(ACCOUNT *a) +{ + // Validate arguments + if (a == NULL) + { + return; + } + + // Release the lock + DeleteLock(a->lock); + + // Release the client option + Free(a->ClientOption); + + // Release the client authentication data + CiFreeClientAuth(a->ClientAuth); + + if (a->ServerCert != NULL) + { + FreeX(a->ServerCert); + } + + Free(a); +} + +// Sort accounts +int CiCompareAccount(void *p1, void *p2) +{ + ACCOUNT *a1, *a2; + if (p1 == NULL || p2 == NULL) + { + return 0; + } + a1 = *(ACCOUNT **)p1; + a2 = *(ACCOUNT **)p2; + if (a1 == NULL || a2 == NULL) + { + return 0; + } + + return UniStrCmpi(a1->ClientOption->AccountName, a2->ClientOption->AccountName); +} + +// Read the client configuration +void CiLoadClientConfig(CLIENT_CONFIG *c, FOLDER *f) +{ + // Validate arguments + if (c == NULL || f == NULL) + { + return; + } + + c->UseKeepConnect = CfgGetBool(f, "UseKeepConnect"); + CfgGetStr(f, "KeepConnectHost", c->KeepConnectHost, sizeof(c->KeepConnectHost)); + c->KeepConnectPort = CfgGetInt(f, "KeepConnectPort"); + c->KeepConnectProtocol = CfgGetInt(f, "KeepConnectProtocol"); + c->AllowRemoteConfig = CfgGetBool(f, "AllowRemoteConfig"); + c->KeepConnectInterval = MAKESURE(CfgGetInt(f, "KeepConnectInterval"), KEEP_INTERVAL_MIN, KEEP_INTERVAL_MAX); + c->NoChangeWcmNetworkSettingOnWindows8 = CfgGetBool(f, "NoChangeWcmNetworkSettingOnWindows8"); +} + +// Read the client authentication data +CLIENT_AUTH *CiLoadClientAuth(FOLDER *f) +{ + CLIENT_AUTH *a; + char *s; + BUF *b; + // Validate arguments + if (f == NULL) + { + return NULL; + } + + a = ZeroMalloc(sizeof(CLIENT_AUTH)); + + a->AuthType = CfgGetInt(f, "AuthType"); + CfgGetStr(f, "Username", a->Username, sizeof(a->Username)); + + switch (a->AuthType) + { + case CLIENT_AUTHTYPE_ANONYMOUS: + break; + + case CLIENT_AUTHTYPE_PASSWORD: + CfgGetByte(f, "HashedPassword", a->HashedPassword, SHA1_SIZE); + break; + + case CLIENT_AUTHTYPE_PLAIN_PASSWORD: + b = CfgGetBuf(f, "EncryptedPassword"); + if (b != NULL) + { + s = DecryptPassword(b); + StrCpy(a->PlainPassword, sizeof(a->PlainPassword), s); + Free(s); + FreeBuf(b); + } + break; + + case CLIENT_AUTHTYPE_CERT: + b = CfgGetBuf(f, "ClientCert"); + if (b != NULL) + { + a->ClientX = BufToX(b, false); + } + FreeBuf(b); + b = CfgGetBuf(f, "ClientKey"); + if (b != NULL) + { + a->ClientK = BufToK(b, true, false, NULL); + } + FreeBuf(b); + break; + + case CLIENT_AUTHTYPE_SECURE: + CfgGetStr(f, "SecurePublicCertName", a->SecurePublicCertName, sizeof(a->SecurePublicCertName)); + CfgGetStr(f, "SecurePrivateKeyName", a->SecurePrivateKeyName, sizeof(a->SecurePrivateKeyName)); + break; + + case CLIENT_AUTHTYPE_OPENSSLENGINE: + b = CfgGetBuf(f, "ClientCert"); + if (b != NULL) + { + a->ClientX = BufToX(b, false); + } + FreeBuf(b); + if (CfgGetStr(f, "OpensslEnginePrivateKeyName", a->OpensslEnginePrivateKeyName, sizeof(a->OpensslEnginePrivateKeyName))) + { + a->ClientK = OpensslEngineToK(a->OpensslEnginePrivateKeyName, a->OpensslEngineName); + } + CfgGetStr(f, "OpensslEngineName", a->OpensslEngineName, sizeof(a->OpensslEngineName)); + break; + } + + return a; +} + +// Read the client option +CLIENT_OPTION *CiLoadClientOption(FOLDER *f) +{ + CLIENT_OPTION *o; + char *s; + BUF *b; + // Validate arguments + if (f == NULL) + { + return NULL; + } + + o = ZeroMalloc(sizeof(CLIENT_OPTION)); + + CfgGetUniStr(f, "AccountName", o->AccountName, sizeof(o->AccountName)); + CfgGetStr(f, "Hostname", o->Hostname, sizeof(o->Hostname)); + o->Port = CfgGetInt(f, "Port"); + o->PortUDP = CfgGetInt(f, "PortUDP"); + o->ProxyType = CfgGetInt(f, "ProxyType"); + CfgGetStr(f, "ProxyName", o->ProxyName, sizeof(o->ProxyName)); + o->ProxyPort = CfgGetInt(f, "ProxyPort"); + CfgGetStr(f, "ProxyUsername", o->ProxyUsername, sizeof(o->ProxyUsername)); + b = CfgGetBuf(f, "ProxyPassword"); + s = DecryptPassword(b); + StrCpy(o->ProxyPassword, sizeof(o->ProxyPassword), s); + Free(s); + FreeBuf(b); + CfgGetStr(f, "CustomHttpHeader", o->CustomHttpHeader, sizeof(o->CustomHttpHeader)); + o->NumRetry = CfgGetInt(f, "NumRetry"); + o->RetryInterval = CfgGetInt(f, "RetryInterval"); + CfgGetStr(f, "HubName", o->HubName, sizeof(o->HubName)); + o->MaxConnection = CfgGetInt(f, "MaxConnection"); + o->UseEncrypt = CfgGetBool(f, "UseEncrypt"); + o->UseCompress = CfgGetBool(f, "UseCompress"); + o->HalfConnection = CfgGetBool(f, "HalfConnection"); + o->NoRoutingTracking = CfgGetBool(f, "NoRoutingTracking"); + CfgGetStr(f, "DeviceName", o->DeviceName, sizeof(o->DeviceName)); + o->AdditionalConnectionInterval = CfgGetInt(f, "AdditionalConnectionInterval"); + o->HideStatusWindow = CfgGetBool(f, "HideStatusWindow"); + o->HideNicInfoWindow = CfgGetBool(f, "HideNicInfoWindow"); + o->ConnectionDisconnectSpan = CfgGetInt(f, "ConnectionDisconnectSpan"); + o->RequireMonitorMode = CfgGetBool(f, "RequireMonitorMode"); + o->RequireBridgeRoutingMode = CfgGetBool(f, "RequireBridgeRoutingMode"); + o->DisableQoS = CfgGetBool(f, "DisableQoS"); + o->FromAdminPack = CfgGetBool(f, "FromAdminPack"); + o->NoUdpAcceleration = CfgGetBool(f, "NoUdpAcceleration"); + + b = CfgGetBuf(f, "HostUniqueKey"); + if (b != NULL) + { + if (b->Size == SHA1_SIZE) + { + Copy(o->HostUniqueKey, b->Buf, SHA1_SIZE); + } + + FreeBuf(b); + } + + return o; +} + +// Read the account data +ACCOUNT *CiLoadClientAccount(FOLDER *f) +{ + ACCOUNT *a; + FOLDER *client_option_folder, *client_auth_folder; + BUF *b; + char tmp[64]; + // Validate arguments + if (f == NULL) + { + return NULL; + } + + client_option_folder = CfgGetFolder(f, "ClientOption"); + + if (client_option_folder != NULL) + { + // Compare whether it matches to the account name that is already registered + } + + client_auth_folder = CfgGetFolder(f, "ClientAuth"); + + if (client_option_folder == NULL || client_auth_folder == NULL) + { + return NULL; + } + + a = ZeroMalloc(sizeof(ACCOUNT)); + a->lock = NewLock(); + + a->ClientOption = CiLoadClientOption(client_option_folder); + a->ClientAuth = CiLoadClientAuth(client_auth_folder); + + a->StartupAccount = CfgGetBool(f, "StartupAccount"); + a->CheckServerCert = CfgGetBool(f, "CheckServerCert"); + a->RetryOnServerCert = CfgGetBool(f, "RetryOnServerCert"); + a->CreateDateTime = CfgGetInt64(f, "CreateDateTime"); + a->UpdateDateTime = CfgGetInt64(f, "UpdateDateTime"); + a->LastConnectDateTime = CfgGetInt64(f, "LastConnectDateTime"); + + b = CfgGetBuf(f, "ServerCert"); + if (b != NULL) + { + a->ServerCert = BufToX(b, false); + FreeBuf(b); + } + + if (CfgGetStr(f, "ShortcutKey", tmp, sizeof(tmp))) + { + BUF *b = StrToBin(tmp); + if (b->Size == SHA1_SIZE) + { + Copy(a->ShortcutKey, b->Buf, SHA1_SIZE); + } + FreeBuf(b); + } + + if (IsZero(a->ShortcutKey, SHA1_SIZE)) + { + Rand(a->ShortcutKey, SHA1_SIZE); + } + + return a; +} + +// Read the account database +void CiLoadAccountDatabase(CLIENT *c, FOLDER *f) +{ + TOKEN_LIST *t; + UINT i; + // Validate arguments + if (c == NULL || f == NULL) + { + return; + } + + t = CfgEnumFolderToTokenList(f); + if (t == NULL) + { + return; + } + + for (i = 0;i < t->NumTokens;i++) + { + FOLDER *ff = CfgGetFolder(f, t->Token[i]); + + if (ff != NULL) + { + ACCOUNT *a = CiLoadClientAccount(ff); + if (a != NULL) + { + { + Add(c->AccountList, a); + } + } + } + } + + Sort(c->AccountList); + + FreeToken(t); +} + +// Read the root CA certificate +void CiLoadCACert(CLIENT *c, FOLDER *f) +{ + BUF *b; + X *x; + // Validate arguments + if (c == NULL || f == NULL) + { + return; + } + + b = CfgGetBuf(f, "X509"); + if (b == NULL) + { + return; + } + + x = BufToX(b, false); + + AddCa(c->Cedar, x); + + FreeX(x); + + FreeBuf(b); +} + +// Read the root CA list +void CiLoadCAList(CLIENT *c, FOLDER *f) +{ + CEDAR *cedar; + TOKEN_LIST *t; + // Validate arguments + if (c == NULL || f == NULL) + { + return; + } + + t = CfgEnumFolderToTokenList(f); + + cedar = c->Cedar; + + LockList(cedar->CaList); + { + UINT i; + for (i = 0;i < t->NumTokens;i++) + { + FOLDER *folder = CfgGetFolder(f, t->Token[i]); + CiLoadCACert(c, folder); + } + } + UnlockList(cedar->CaList); + + FreeToken(t); +} + +// Read a VLAN +void CiLoadVLan(CLIENT *c, FOLDER *f) +{ + char tmp[MAX_SIZE]; + UCHAR addr[6]; + BUF *b; + UNIX_VLAN *v; + // Validate arguments + if (c == NULL || f == NULL) + { + return; + } + + if (CfgGetStr(f, "MacAddress", tmp, sizeof(tmp)) == false) + { + return; + } + + b = StrToBin(tmp); + if (b == NULL) + { + return; + } + + if (b->Size != 6) + { + FreeBuf(b); + return; + } + + Copy(addr, b->Buf, 6); + + FreeBuf(b); + + if (IsZero(addr, 6)) + { + return; + } + + v = ZeroMalloc(sizeof(UNIX_VLAN)); + Copy(v->MacAddress, addr, 6); + StrCpy(v->Name, sizeof(v->Name), f->Name); + v->Enabled = CfgGetBool(f, "Enabled"); + + Add(c->UnixVLanList, v); + +#ifdef OS_UNIX + UnixVLanCreate(v->Name, v->MacAddress, false); +#endif // OS_UNIX +} + +// Read a VLAN list +void CiLoadVLanList(CLIENT *c, FOLDER *f) +{ + TOKEN_LIST *t; + // Validate arguments + if (c == NULL || f == NULL) + { + return; + } + + t = CfgEnumFolderToTokenList(f); + + LockList(c->UnixVLanList); + { + UINT i; + for (i = 0;i < t->NumTokens;i++) + { + FOLDER *folder = CfgGetFolder(f, t->Token[i]); + CiLoadVLan(c, folder); + } + } + UnlockList(c->UnixVLanList); + + FreeToken(t); +} + +// Read the configuration from the configuration file +bool CiReadSettingFromCfg(CLIENT *c, FOLDER *root) +{ + FOLDER *config; + FOLDER *cert; + FOLDER *db; + FOLDER *vlan; + FOLDER *cmsetting; + FOLDER *proxy; + char user_agent[MAX_SIZE]; + // Validate arguments + if (c == NULL || root == NULL) + { + return false; + } + + // Initialize the setting if there isn't either of AccountDatabase and Config + config = CfgGetFolder(root, "Config"); + if (config == NULL) + { + return false; + } + + db = CfgGetFolder(root, "AccountDatabase"); + if (db == NULL) + { + return false; + } + + cmsetting = CfgGetFolder(root, "ClientManagerSetting"); + + CiLoadClientConfig(&c->Config, config); + + + proxy = CfgGetFolder(root, "CommonProxySetting"); + + if (proxy != NULL) + { + INTERNET_SETTING t; + BUF *pw; + + // Proxy Setting + Zero(&t, sizeof(t)); + t.ProxyType = CfgGetInt(proxy, "ProxyType"); + CfgGetStr(proxy, "ProxyHostName", t.ProxyHostName, sizeof(t.ProxyHostName)); + t.ProxyPort = CfgGetInt(proxy, "ProxyPort"); + CfgGetStr(proxy, "ProxyUsername", t.ProxyUsername, sizeof(t.ProxyUsername)); + pw = CfgGetBuf(proxy, "ProxyPassword"); + if (pw != NULL) + { + char *pw_str = DecryptPassword(pw); + StrCpy(t.ProxyPassword, sizeof(t.ProxyPassword), pw_str); + + Free(pw_str); + FreeBuf(pw); + } + + CfgGetStr(proxy, "CustomHttpHeader", t.CustomHttpHeader, sizeof(t.CustomHttpHeader)); + + Copy(&c->CommonProxySetting, &t, sizeof(INTERNET_SETTING)); + } + + // Eraser + c->Eraser = NewEraser(c->Logger, CfgGetInt64(config, "AutoDeleteCheckDiskFreeSpaceMin")); + + if (OS_IS_UNIX(GetOsInfo()->OsType) +#ifdef NO_VLAN + && GetOsInfo()->OsType != OSTYPE_MACOS_X +#endif // NO_VLAN + ) + { + // Read the UNIX version virtual LAN card list (except MacOS) + vlan = CfgGetFolder(root, "UnixVLan"); + if (vlan != NULL) + { + CiLoadVLanList(c, vlan); + } + } + +#ifdef NO_VLAN + if (GetOsInfo()->OsType == OSTYPE_MACOS_X) + { +#ifdef OS_UNIX + UNIX_VLAN *uv; + + // Create a Tap for MacOS X + if (UnixVLanCreate(CLIENT_MACOS_TAP_NAME, NULL, false) == false) + { + // Fail (abort) + CLog(c, "LC_TAP_NOT_FOUND"); + Alert("tun/tap driver not found.", NULL); + exit(0); + } + + uv = ZeroMalloc(sizeof(UNIX_VLAN)); + uv->Enabled = true; + StrCpy(uv->Name, sizeof(uv->Name), CLIENT_MACOS_TAP_NAME); + Add(c->UnixVLanList, uv); +#endif // OS_UNIX + } +#endif // NO_VLAN + CiLoadAccountDatabase(c, db); + + if (CfgGetByte(root, "EncryptedPassword", c->EncryptedPassword, SHA1_SIZE) == false) + { + Sha0(c->EncryptedPassword, "", 0); + } + + c->PasswordRemoteOnly = CfgGetBool(root, "PasswordRemoteOnly"); + c->UseSecureDeviceId = CfgGetInt(root, "UseSecureDeviceId"); + + if (CfgGetStr(root, "UserAgent", user_agent, sizeof(user_agent))) + { + if (IsEmptyStr(user_agent) == false) + { + Free(c->Cedar->HttpUserAgent); + c->Cedar->HttpUserAgent = CopyStr(user_agent); + } + } + + cert = CfgGetFolder(root, "RootCA"); + if (cert != NULL) + { + CiLoadCAList(c, cert); + } + + c->DontSavePassword = CfgGetBool(root, "DontSavePassword"); + + if (cmsetting != NULL) + { + UINT ostype = GetOsInfo()->OsType; + // CM_SETTING + CM_SETTING *s = c->CmSetting; + + if (OS_IS_UNIX(ostype) || OS_IS_WINDOWS_NT(ostype)) + { + s->EasyMode = CfgGetBool(cmsetting, "EasyMode"); + } + + s->LockMode = CfgGetBool(cmsetting, "LockMode"); + CfgGetByte(cmsetting, "HashedPassword", s->HashedPassword, sizeof(s->HashedPassword)); + } + + return true; +} + +// Read the configuration file +bool CiLoadConfigurationFile(CLIENT *c) +{ + bool ret; + FOLDER *root; + char path[MAX_SIZE]; + // Validate arguments + if (c == NULL) + { + return false; + } + + // Read the configuration file + if (CiLoadConfigFilePathFromIni(path, sizeof(path))) + { + c->CfgRw = NewCfgRw(&root, path); + } + else + { + c->CfgRw = NewCfgRw(&root, CLIENT_CONFIG_FILE_NAME); + } + + if (root == NULL) + { + return false; + } + + ret = CiReadSettingFromCfg(c, root); + + CfgDeleteFolder(root); + + return ret; +} + +// Write the CLIENT_CONFIG +void CiWriteClientConfig(FOLDER *cc, CLIENT_CONFIG *config) +{ + // Validate arguments + if (cc == NULL || config == NULL) + { + return; + } + + CfgAddBool(cc, "UseKeepConnect", config->UseKeepConnect); + CfgAddStr(cc, "KeepConnectHost", config->KeepConnectHost); + CfgAddInt(cc, "KeepConnectPort", config->KeepConnectPort); + CfgAddInt(cc, "KeepConnectProtocol", config->KeepConnectProtocol); + CfgAddBool(cc, "AllowRemoteConfig", config->AllowRemoteConfig); + CfgAddInt(cc, "KeepConnectInterval", config->KeepConnectInterval); + CfgAddBool(cc, "NoChangeWcmNetworkSettingOnWindows8", config->NoChangeWcmNetworkSettingOnWindows8); +} + +// Write the client authentication data +void CiWriteClientAuth(FOLDER *f, CLIENT_AUTH *a) +{ + BUF *b; + // Validate arguments + if (f == NULL || a == NULL) + { + return; + } + + CfgAddInt(f, "AuthType", a->AuthType); + CfgAddStr(f, "Username", a->Username); + + switch (a->AuthType) + { + case CLIENT_AUTHTYPE_ANONYMOUS: + break; + + case CLIENT_AUTHTYPE_PASSWORD: + CfgAddByte(f, "HashedPassword", a->HashedPassword, SHA1_SIZE); + break; + + case CLIENT_AUTHTYPE_PLAIN_PASSWORD: + b = EncryptPassword(a->PlainPassword); + CfgAddByte(f, "EncryptedPassword", b->Buf, b->Size); + FreeBuf(b); + break; + + case CLIENT_AUTHTYPE_CERT: + if (a->ClientK != NULL && a->ClientX != NULL) + { + b = XToBuf(a->ClientX, false); + CfgAddByte(f, "ClientCert", b->Buf, b->Size); + FreeBuf(b); + + b = KToBuf(a->ClientK, false, NULL); + CfgAddByte(f, "ClientKey", b->Buf, b->Size); + FreeBuf(b); + } + break; + + case CLIENT_AUTHTYPE_SECURE: + CfgAddStr(f, "SecurePublicCertName", a->SecurePublicCertName); + CfgAddStr(f, "SecurePrivateKeyName", a->SecurePrivateKeyName); + break; + + case CLIENT_AUTHTYPE_OPENSSLENGINE: + if (a->ClientX != NULL) { + b = XToBuf(a->ClientX, false); + CfgAddByte(f, "ClientCert", b->Buf, b->Size); + FreeBuf(b); + } + CfgAddStr(f, "OpensslEnginePrivateKeyName", a->OpensslEnginePrivateKeyName); + CfgAddStr(f, "OpensslEngineName", a->OpensslEngineName); + break; + } +} + +// Write the client option +void CiWriteClientOption(FOLDER *f, CLIENT_OPTION *o) +{ + BUF *b; + // Validate arguments + if (f == NULL || o == NULL) + { + return; + } + + CfgAddUniStr(f, "AccountName", o->AccountName); + CfgAddStr(f, "Hostname", o->Hostname); + CfgAddInt(f, "Port", o->Port); + CfgAddInt(f, "PortUDP", o->PortUDP); + CfgAddInt(f, "ProxyType", o->ProxyType); + CfgAddStr(f, "ProxyName", o->ProxyName); + CfgAddInt(f, "ProxyPort", o->ProxyPort); + CfgAddStr(f, "ProxyUsername", o->ProxyUsername); + b = EncryptPassword(o->ProxyPassword); + CfgAddByte(f, "ProxyPassword", b->Buf, b->Size); + FreeBuf(b); + CfgAddStr(f, "CustomHttpHeader", o->CustomHttpHeader); + CfgAddInt(f, "NumRetry", o->NumRetry); + CfgAddInt(f, "RetryInterval", o->RetryInterval); + CfgAddStr(f, "HubName", o->HubName); + CfgAddInt(f, "MaxConnection", o->MaxConnection); + CfgAddBool(f, "UseEncrypt", o->UseEncrypt); + CfgAddBool(f, "UseCompress", o->UseCompress); + CfgAddBool(f, "HalfConnection", o->HalfConnection); + CfgAddBool(f, "NoRoutingTracking", o->NoRoutingTracking); + CfgAddStr(f, "DeviceName", o->DeviceName); + CfgAddInt(f, "AdditionalConnectionInterval", o->AdditionalConnectionInterval); + CfgAddBool(f, "HideStatusWindow", o->HideStatusWindow); + CfgAddBool(f, "HideNicInfoWindow", o->HideNicInfoWindow); + CfgAddInt(f, "ConnectionDisconnectSpan", o->ConnectionDisconnectSpan); + CfgAddBool(f, "RequireMonitorMode", o->RequireMonitorMode); + CfgAddBool(f, "RequireBridgeRoutingMode", o->RequireBridgeRoutingMode); + CfgAddBool(f, "DisableQoS", o->DisableQoS); + CfgAddBool(f, "NoUdpAcceleration", o->NoUdpAcceleration); + + if (o->FromAdminPack) + { + CfgAddBool(f, "FromAdminPack", o->FromAdminPack); + } + + if (IsZero(o->HostUniqueKey, SHA1_SIZE) == false) + { + BUF *b = MemToBuf(o->HostUniqueKey, SHA1_SIZE); + CfgAddBuf(f, "HostUniqueKey", b); + FreeBuf(b); + } +} + +// Decrypt the password +char *DecryptPassword(BUF *b) +{ + char *str; + char *key = "EncryptPassword"; + CRYPT *c; + // Validate arguments + if (b == NULL) + { + return CopyStr(""); + } + + str = ZeroMalloc(b->Size + 1); + c = NewCrypt(key, sizeof(key)); // NOTE by Daiyuu Nobori 2018-09-28: This is not a bug! Do not try to fix it!! + Encrypt(c, str, b->Buf, b->Size); + FreeCrypt(c); + + str[b->Size] = 0; + + return str; +} +char *DecryptPassword2(BUF *b) +{ + char *str; + char *key = "EncryptPassword2"; + CRYPT *c; + // Validate arguments + if (b == NULL) + { + return CopyStr(""); + } + + str = ZeroMalloc(b->Size + 1); + c = NewCrypt(key, StrLen(key)); + Encrypt(c, str, b->Buf, b->Size); + FreeCrypt(c); + + str[b->Size] = 0; + + return str; +} + +// Encrypt the password +BUF *EncryptPassword(char *password) +{ + UCHAR *tmp; + UINT size; + char *key = "EncryptPassword"; + CRYPT *c; + BUF *b; + // Validate arguments + if (password == NULL) + { + password = ""; + } + + size = StrLen(password) + 1; + tmp = ZeroMalloc(size); + + c = NewCrypt(key, sizeof(key)); // NOTE by Daiyuu Nobori 2018-09-28: This is not a bug! Do not try to fix it!! + Encrypt(c, tmp, password, size - 1); + FreeCrypt(c); + + b = NewBuf(); + WriteBuf(b, tmp, size - 1); + SeekBuf(b, 0, 0); + Free(tmp); + + return b; +} +BUF *EncryptPassword2(char *password) +{ + UCHAR *tmp; + UINT size; + char *key = "EncryptPassword2"; + CRYPT *c; + BUF *b; + // Validate arguments + if (password == NULL) + { + password = ""; + } + + size = StrLen(password) + 1; + tmp = ZeroMalloc(size); + + c = NewCrypt(key, StrLen(key)); + Encrypt(c, tmp, password, size - 1); + FreeCrypt(c); + + b = NewBuf(); + WriteBuf(b, tmp, size - 1); + SeekBuf(b, 0, 0); + Free(tmp); + + return b; +} + +// Write the account data +void CiWriteAccountData(FOLDER *f, ACCOUNT *a) +{ + // Validate arguments + if (f == NULL || a == NULL) + { + return; + } + + // Client Option + CiWriteClientOption(CfgCreateFolder(f, "ClientOption"), a->ClientOption); + + // Client authentication data + CiWriteClientAuth(CfgCreateFolder(f, "ClientAuth"), a->ClientAuth); + + // Startup account + CfgAddBool(f, "StartupAccount", a->StartupAccount); + + // Server certificate check flag + CfgAddBool(f, "CheckServerCert", a->CheckServerCert); + + // Retry on invalid server certificate flag + CfgAddBool(f, "RetryOnServerCert", a->RetryOnServerCert); + + // Date and time + CfgAddInt64(f, "CreateDateTime", a->CreateDateTime); + CfgAddInt64(f, "UpdateDateTime", a->UpdateDateTime); + CfgAddInt64(f, "LastConnectDateTime", a->LastConnectDateTime); + + // Server certificate body + if (a->ServerCert != NULL) + { + BUF *b = XToBuf(a->ServerCert, false); + if (b != NULL) + { + CfgAddBuf(f, "ServerCert", b); + FreeBuf(b); + } + } + + // Shortcut Key + if (IsZero(a->ShortcutKey, SHA1_SIZE) == false) + { + char tmp[64]; + BinToStr(tmp, sizeof(tmp), a->ShortcutKey, SHA1_SIZE); + CfgAddStr(f, "ShortcutKey", tmp); + } +} + +// Write the account database +void CiWriteAccountDatabase(CLIENT *c, FOLDER *f) +{ + char name[MAX_SIZE]; + // Validate arguments + if (c == NULL || f == NULL) + { + return; + } + + LockList(c->AccountList); + { + UINT i; + for (i = 0;i < LIST_NUM(c->AccountList);i++) + { + ACCOUNT *a = LIST_DATA(c->AccountList, i); + + { + Format(name, sizeof(name), "Account%u", i); + Lock(a->lock); + { + CiWriteAccountData(CfgCreateFolder(f, name), a); + } + Unlock(a->lock); + } + } + } + UnlockList(c->AccountList); +} + +// Write the CA certificate +void CiWriteCACert(CLIENT *c, FOLDER *f, X *x) +{ + BUF *b; + // Validate arguments + if (c == NULL || f == NULL || x == NULL) + { + return; + } + + b = XToBuf(x, false); + CfgAddBuf(f, "X509", b); + FreeBuf(b); +} + +// Write a VLAN +void CiWriteVLan(CLIENT *c, FOLDER *f, UNIX_VLAN *v) +{ + char tmp[MAX_SIZE]; + // Validate arguments + if (c == NULL || f == NULL || v == NULL) + { + return; + } + + MacToStr(tmp, sizeof(tmp), v->MacAddress); + CfgAddStr(f, "MacAddress", tmp); + CfgAddBool(f, "Enabled", v->Enabled); +} + +// Write a VLAN list +void CiWriteVLanList(CLIENT *c, FOLDER *f) +{ + // Validate arguments + if (c == NULL || f == NULL) + { + return; + } + + LockList(c->UnixVLanList); + { + UINT i; + for (i = 0;i < LIST_NUM(c->UnixVLanList);i++) + { + UNIX_VLAN *v = LIST_DATA(c->UnixVLanList, i); + CiWriteVLan(c, CfgCreateFolder(f, v->Name), v); + } + } + UnlockList(c->UnixVLanList); +} + +// Write the CA list +void CiWriteCAList(CLIENT *c, FOLDER *f) +{ + CEDAR *cedar; + // Validate arguments + if (c == NULL || f == NULL) + { + return; + } + + cedar = c->Cedar; + + LockList(cedar->CaList); + { + UINT i; + for (i = 0;i < LIST_NUM(cedar->CaList);i++) + { + char tmp[MAX_SIZE]; + X *x = LIST_DATA(cedar->CaList, i); + Format(tmp, sizeof(tmp), "Certificate%u", i); + CiWriteCACert(c, CfgCreateFolder(f, tmp), x); + } + } + UnlockList(cedar->CaList); +} + +// Write the current settings to ROOT +void CiWriteSettingToCfg(CLIENT *c, FOLDER *root) +{ + FOLDER *cc; + FOLDER *account_database; + FOLDER *ca; + FOLDER *vlan; + FOLDER *cmsetting; + FOLDER *proxy; + // Validate arguments + if (c == NULL || root == NULL) + { + return; + } + + cmsetting = CfgCreateFolder(root, "ClientManagerSetting"); + + // CLIENT_CONFIG + cc = CfgCreateFolder(root, "Config"); + CiWriteClientConfig(cc, &c->Config); + + + // Eraser + CfgAddInt64(cc, "AutoDeleteCheckDiskFreeSpaceMin", c->Eraser->MinFreeSpace); + + // Account Database + account_database = CfgCreateFolder(root, "AccountDatabase"); + CiWriteAccountDatabase(c, account_database); + + // Proxy + proxy = CfgCreateFolder(root, "CommonProxySetting"); + if (proxy != NULL) + { + INTERNET_SETTING *t = &c->CommonProxySetting; + BUF *pw; + + CfgAddInt(proxy, "ProxyType", t->ProxyType); + CfgAddStr(proxy, "ProxyHostName", t->ProxyHostName); + CfgAddInt(proxy, "ProxyPort", t->ProxyPort); + CfgAddStr(proxy, "ProxyUsername", t->ProxyUsername); + + if (IsEmptyStr(t->ProxyPassword) == false) + { + pw = EncryptPassword(t->ProxyPassword); + + CfgAddBuf(proxy, "ProxyPassword", pw); + + FreeBuf(pw); + } + + CfgAddStr(proxy, "CustomHttpHeader", t->CustomHttpHeader); + } + + // CA + ca = CfgCreateFolder(root, "RootCA"); + CiWriteCAList(c, ca); + + // VLAN + if (OS_IS_UNIX(GetOsInfo()->OsType) +#ifdef NO_VLAN + && GetOsInfo()->OsType != OSTYPE_MACOS_X +#endif // NO_VLAN + ) + { + vlan = CfgCreateFolder(root, "UnixVLan"); + CiWriteVLanList(c, vlan); + } + + // Password + CfgAddByte(root, "EncryptedPassword", c->EncryptedPassword, SHA1_SIZE); + CfgAddBool(root, "PasswordRemoteOnly", c->PasswordRemoteOnly); + + // UseSecureDeviceId + CfgAddInt(root, "UseSecureDeviceId", c->UseSecureDeviceId); + + // DontSavePassword + CfgAddBool(root, "DontSavePassword", c->DontSavePassword); + + // UserAgent + if (c->Cedar != NULL) + { + CfgAddStr(root, "UserAgent", c->Cedar->HttpUserAgent); + } + + if (cmsetting != NULL) + { + CM_SETTING *s = c->CmSetting; + + CfgAddBool(cmsetting, "EasyMode", s->EasyMode); + CfgAddBool(cmsetting, "LockMode", s->LockMode); + + if (IsZero(s->HashedPassword, sizeof(s->HashedPassword)) == false) + { + CfgAddByte(cmsetting, "HashedPassword", s->HashedPassword, sizeof(s->HashedPassword)); + } + } +} + +// Apply settings of Inner VPN Server +void CiApplyInnerVPNServerConfig(CLIENT *c) +{ +} + +// Write to the configuration file +void CiSaveConfigurationFile(CLIENT *c) +{ + FOLDER *root; + // Validate arguments + if (c == NULL) + { + return; + } + + // Do not save the configuration file + if(c->NoSaveConfig) + { + return; + } + + root = CfgCreateFolder(NULL, TAG_ROOT); + CiWriteSettingToCfg(c, root); + + SaveCfgRw(c->CfgRw, root); + + CfgDeleteFolder(root); +} + +// Set the CM_SETTING +bool CtSetCmSetting(CLIENT *c, CM_SETTING *s) +{ + // Validate arguments + if (c == NULL || s == NULL) + { + return false; + } + + Copy(c->CmSetting, s, sizeof(CM_SETTING)); + + CiSaveConfigurationFile(c); + + return true; +} + +// Get the CM_SETTING +bool CtGetCmSetting(CLIENT *c, CM_SETTING *s) +{ + // Validate arguments + if (c == NULL || s == NULL) + { + return false; + } + + Copy(s, c->CmSetting, sizeof(CM_SETTING)); + + return true; +} + +// Get the client version +bool CtGetClientVersion(CLIENT *c, RPC_CLIENT_VERSION *ver) +{ + // Validate arguments + if (ver == NULL) + { + return false; + } + + Zero(ver, sizeof(RPC_CLIENT_VERSION)); + StrCpy(ver->ClientProductName, sizeof(ver->ClientProductName), CEDAR_CLIENT_STR); + StrCpy(ver->ClientVersionString, sizeof(ver->ClientVersionString), c->Cedar->VerString); + StrCpy(ver->ClientBuildInfoString, sizeof(ver->ClientBuildInfoString), c->Cedar->BuildInfo); + ver->ClientVerInt = c->Cedar->Version; + ver->ClientBuildInt = c->Cedar->Build; + + +#ifdef OS_WIN32 + ver->ProcessId = MsGetProcessId(); + ver->IsVLanNameRegulated = MsIsInfCatalogRequired(); + +#endif // OS_WIN32 + + ver->OsType = GetOsInfo()->OsType; + + return true; +} + +// Creating a Client object +CLIENT *CiNewClient() +{ + CLIENT *c = ZeroMalloc(sizeof(CLIENT)); + +// StartCedarLog(); + + if (ci_active_sessions_lock == NULL) + { + ci_active_sessions_lock = NewLock(); + ci_num_active_sessions = 0; + } + +#ifdef OS_WIN32 + if (MsIsWindows7()) + { + c->MsSuspendHandler = MsNewSuspendHandler(); + } +#endif // OS_WIN32 + + + c->CmSetting = ZeroMalloc(sizeof(CM_SETTING)); + + c->SockList = NewSockList(); + + c->lock = NewLock(); + c->lockForConnect = NewLock(); + c->ref = NewRef(); + + c->Cedar = NewCedar(NULL, NULL); + + c->Cedar->Client = c; + + c->NotifyCancelList = NewList(NULL); + + Sha0(c->EncryptedPassword, "", 0); + +#ifdef OS_WIN32 + c->GlobalPulse = MsOpenOrCreateGlobalPulse(CLIENT_GLOBAL_PULSE_NAME); +#endif // OS_WIN32 + + if (c->GlobalPulse != NULL) + { + c->PulseRecvThread = NewThread(CiPulseRecvThread, c); + } + + CiLoadIniSettings(c); + + // Log Settings + if(c->NoSaveLog == false) + { + MakeDir(CLIENT_LOG_DIR_NAME); + c->Logger = NewLog(CLIENT_LOG_DIR_NAME, CLIENT_LOG_PREFIX, LOG_SWITCH_DAY); + } + + CLog(c, "L_LINE"); + CLog(c, "LC_START_2", CEDAR_CLIENT_STR, c->Cedar->VerString); + CLog(c, "LC_START_3", c->Cedar->BuildInfo); + CLog(c, "LC_START_1"); + +#ifdef OS_WIN32 + { + // Initialize the Win32 UI + wchar_t tmp[MAX_SIZE]; + StrToUni(tmp, sizeof(tmp), CEDAR_CLIENT_STR); + + InitWinUi(tmp, _SS("DEFAULT_FONT"), _II("DEFAULT_FONT_SIZE")); + } +#endif // OS_WIN32 + + // Initialize the settings + CiInitConfiguration(c); + + // Raise the priority + OSSetHighPriority(); + + + +#ifdef OS_WIN32 + // For Win9x, release the DHCP address of all the virtual LAN card + if (MsIsNt() == false) + { + Win32ReleaseAllDhcp9x(true); + } +#endif // OS_WIN32 + + CiChangeAllVLanMacAddressIfMachineChanged(c); + + CiChangeAllVLanMacAddressIfCleared(c); + + // Initialize the internal VPN server + CiApplyInnerVPNServerConfig(c); + + return c; +} + +// Send a global pulse +void CiSendGlobalPulse(CLIENT *c) +{ + // Validate arguments + if (c == NULL) + { + return; + } + +#ifdef OS_WIN32 + MsSendGlobalPulse(c->GlobalPulse); +#endif // OS_WIN32 +} + +// Pulse reception thread +void CiPulseRecvThread(THREAD *thread, void *param) +{ +#ifdef OS_WIN32 + CLIENT *c = (CLIENT *)param; + + if (c == NULL) + { + return; + } + + while (true) + { + if (c->HaltPulseThread) + { + break; + } + + MsWaitForGlobalPulse(c->GlobalPulse, INFINITE); + + if (c->HaltPulseThread) + { + break; + } + + CiNotifyInternal(c); + } +#endif // OS_WIN32 +} + +// Clean-up the client +void CiCleanupClient(CLIENT *c) +{ + // Validate arguments + if (c == NULL) + { + return; + } + + + // Release the settings + CiFreeConfiguration(c); + +#ifdef OS_WIN32 + // Release the Win32 UI + FreeWinUi(); +#endif // OS_WIN32 + + CLog(c, "LC_END"); + CLog(c, "L_LINE"); + FreeEraser(c->Eraser); + FreeLog(c->Logger); + c->Logger = NULL; + + + ReleaseCedar(c->Cedar); + + DeleteLock(c->lockForConnect); + DeleteLock(c->lock); + + c->HaltPulseThread = true; + + if (c->GlobalPulse != NULL) + { +#ifdef OS_WIN32 + MsSendGlobalPulse(c->GlobalPulse); +#endif // OS_WIN32 + } + + if (c->PulseRecvThread != NULL) + { + WaitThread(c->PulseRecvThread, INFINITE); + ReleaseThread(c->PulseRecvThread); + } + + if (c->GlobalPulse != NULL) + { +#ifdef OS_WIN32 + MsCloseGlobalPulse(c->GlobalPulse); +#endif // OS_WIN32 + } + + ReleaseList(c->NotifyCancelList); + + FreeSockList(c->SockList); + + Free(c->CmSetting); + + +#ifdef OS_WIN32 + if (c->MsSuspendHandler != NULL) + { + MsFreeSuspendHandler(c->MsSuspendHandler); + } +#endif // OS_WIN32 + + Free(c); + +#ifdef OS_WIN32 + // For Win9x, release the DHCP address of all the virtual LAN card + if (MsIsNt() == false) + { + Win32ReleaseAllDhcp9x(true); + } +#endif // OS_WIN32 + + StopCedarLog(); + + if (ci_active_sessions_lock != NULL) + { + DeleteLock(ci_active_sessions_lock); + ci_active_sessions_lock = NULL; + + ci_num_active_sessions = 0; + } +} + +// Increment of the number of active sessions +void CiIncrementNumActiveSessions() +{ + Lock(ci_active_sessions_lock); + { + ci_num_active_sessions++; + } + Unlock(ci_active_sessions_lock); +} + +// Decrement of the number of active sessions +void CiDecrementNumActiveSessions() +{ + Lock(ci_active_sessions_lock); + { + if (ci_num_active_sessions >= 1) + { + ci_num_active_sessions--; + } + } + Unlock(ci_active_sessions_lock); +} + +// Release the client +void CtReleaseClient(CLIENT *c) +{ + // Validate arguments + if (c == NULL) + { + return; + } + + if (Release(c->ref) == 0) + { + CiCleanupClient(c); + } +} + +// Start the operation of the client program +void CtStartClient() +{ + UINT i; + LIST *o; + if (client != NULL) + { + // It is already in running + return; + } + + // OS check + CiCheckOs(); + +#ifdef OS_WIN32 + RegistWindowsFirewallAll(); +#endif + + // Creating a client + client = CiNewClient(); + + // Start the Keep + CiInitKeep(client); + + // Start the RPC server + CiStartRpcServer(client); + + // Start the Saver + CiInitSaver(client); + + // Start the startup connection + o = NewListFast(NULL); + LockList(client->AccountList); + { + for (i = 0;i < LIST_NUM(client->AccountList);i++) + { + ACCOUNT *a = LIST_DATA(client->AccountList, i); + Lock(a->lock); + { + if (a->StartupAccount) + { + Add(o, CopyUniStr(a->ClientOption->AccountName)); + } + } + Unlock(a->lock); + } + } + UnlockList(client->AccountList); + + for (i = 0;i < LIST_NUM(o);i++) + { + wchar_t *s = LIST_DATA(o, i); + RPC_CLIENT_CONNECT c; + Zero(&c, sizeof(c)); + UniStrCpy(c.AccountName, sizeof(c.AccountName), s); + CtConnect(client, &c); + Free(s); + } + ReleaseList(o); +} + +// Stop the operation of the client program +void CtStopClient() +{ + UINT i, num; + ACCOUNT **account_list; + if (client == NULL) + { + // It is not running yet + return; + } + + // Halting flag + client->Halt = true; + + // Disconnect all the RPC + CiStopRpcServer(client); + + // Exit the client notification service + CncExit(); + + // Exit the Keep + CiFreeKeep(client); + + // Disconnect all accounts connected + LockList(client->AccountList); + { + num = LIST_NUM(client->AccountList); + account_list = ToArray(client->AccountList); + } + UnlockList(client->AccountList); + + for (i = 0;i < num;i++) + { + ACCOUNT *a = account_list[i]; + SESSION *s = NULL; + + Lock(a->lock); + { + if (a->ClientSession != NULL) + { + s = a->ClientSession; + AddRef(s->ref); + } + } + Unlock(a->lock); + + if (s != NULL) + { + StopSession(s); + ReleaseSession(s); + Lock(a->lock); + { + if (a->ClientSession != NULL) + { + ReleaseSession(a->ClientSession); + a->ClientSession = NULL; + } + } + Unlock(a->lock); + } + } + + Free(account_list); + + // Stop the Saver + CiFreeSaver(client); + + // Release the client + CtReleaseClient(client); + client = NULL; +} + +// OS check +void CiCheckOs() +{ + // Get the OS type + OS_INFO *info = GetOsInfo(); + + if (OS_IS_WINDOWS(info->OsType)) + { + bool ok = IS_CLIENT_SUPPORTED_OS(info->OsType); + + if (ok == false) + { + Alert( + CEDAR_PRODUCT_STR " VPN Client doesn't support this Windows Operating System.\n" + CEDAR_PRODUCT_STR " VPN Client requires Windows 98, Windows Me, Windows 2000, Windows XP, Windows Server 2003 or Greater.\n\n" + "Please contact your system administrator.", CEDAR_PRODUCT_STR " VPN Client"); + exit(0); + } + } +} + +// Client status indicator +void CiClientStatusPrinter(SESSION *s, wchar_t *status) +{ +#ifdef OS_WIN32 + ACCOUNT *a; + // Validate arguments + if (s == NULL || status == NULL) + { + return; + } + + a = s->Account; + if (a == NULL) + { + return; + } + + if (UniStrCmpi(status, L"init") == 0) + { + if (a->StatusWindow == NULL && s->Win32HideConnectWindow == false) + { + a->StatusWindow = CncStatusPrinterWindowStart(s); + } + } + else if (UniStrCmpi(status, L"free") == 0) + { + if (a->StatusWindow != NULL) + { + CncStatusPrinterWindowStop(a->StatusWindow); + a->StatusWindow = NULL; + } + } + else + { + if (a->StatusWindow != NULL) + { + CncStatusPrinterWindowPrint(a->StatusWindow, status); + } + } +#else // OS_WIN32 + UniPrint(L"Status: %s\n", status); +#endif // OS_WIN32 +} + + diff --git a/src/Cedar/Client.h b/src/Cedar/Client.h index 96b5fe07..141ef15f 100644 --- a/src/Cedar/Client.h +++ b/src/Cedar/Client.h @@ -1,760 +1,760 @@ -// SoftEther VPN Source Code - Developer Edition Master Branch -// Cedar Communication Module -// © 2020 Nokia - -// Client.h -// Header of Client.c - -#ifndef CLIENT_H -#define CLIENT_H - -#define CLIENT_CONFIG_PORT GC_CLIENT_CONFIG_PORT // Client port number -#define CLIENT_NOTIFY_PORT GC_CLIENT_NOTIFY_PORT // Client notification port number -#define CLIENT_WAIT_CN_READY_TIMEOUT (10 * 1000) // Standby time to start the client notification service - - -// Check whether the client can run on the specified OS_TYPE -#define IS_CLIENT_SUPPORTED_OS(t) \ - ((OS_IS_WINDOWS_NT(t) && GET_KETA(t, 100) >= 2) || (OS_IS_WINDOWS_9X(t))) - - -// Constants -#define CLIENT_CONFIG_FILE_NAME "$vpn_client.config" -#define CLIENT_DEFAULT_KEEPALIVE_HOST "keepalive.softether.org" -#define CLIENT_DEFAULT_KEEPALIVE_PORT 80 -#define CLIENT_DEFAULT_KEEPALIVE_INTERVAL KEEP_INTERVAL_DEFAULT - -#define CLIENT_RPC_MODE_NOTIFY 0 -#define CLIENT_RPC_MODE_MANAGEMENT 1 -#define CLIENT_RPC_MODE_SHORTCUT 2 -#define CLIENT_RPC_MODE_SHORTCUT_DISCONNECT 3 - -#define CLIENT_MACOS_TAP_NAME "tap0" - -#define CLIENT_SAVER_INTERVAL (30 * 1000) - -#define CLIENT_NOTIFY_SERVICE_INSTANCENAME GC_SW_SOFTETHER_PREFIX "vpnclient_uihelper" - -#define CLIENT_WIN32_EXE_FILENAME "vpnclient.exe" - -#define CLIENT_CUSTOM_INI_FILENAME "$custom.ini" - -#define CLIENT_GLOBAL_PULSE_NAME "clientglobalpulse" - -#define CLIENT_WIN32_REGKEYNAME "Software\\" GC_REG_COMPANY_NAME "\\" CEDAR_PRODUCT_STR " VPN\\Client" -#define CLIENT_WIN32_REGVALUE_PORT "RpcPort" -#define CLIENT_WIN32_REGVALUE_PID "RpcPid" - - -// List of virtual LAN cards in UNIX -struct UNIX_VLAN -{ - bool Enabled; // Enable flag - char Name[MAX_SIZE]; // Name - UCHAR MacAddress[6]; // MAC address - UCHAR Padding[2]; -}; - -// Account -struct ACCOUNT -{ - // Static data - CLIENT_OPTION *ClientOption; // Client Option - CLIENT_AUTH *ClientAuth; // Client authentication data - bool CheckServerCert; // Check the server certificate - bool RetryOnServerCert; // Retry on invalid server certificate - X *ServerCert; // Server certificate - bool StartupAccount; // Start-up account - UCHAR ShortcutKey[SHA1_SIZE]; // Key - UINT64 CreateDateTime; // Creation date and time - UINT64 UpdateDateTime; // Updating date - UINT64 LastConnectDateTime; // Last connection date and time - - // Dynamic data - LOCK *lock; // Lock - SESSION *ClientSession; // Client session - CLIENT_STATUS_PRINTER *StatusPrinter; // Status indicator - - SOCK *StatusWindow; // Status window -}; - -// Client Settings -struct CLIENT_CONFIG -{ - bool AllowRemoteConfig; // Allow the remote configuration - bool UseKeepConnect; // Keep connected to the Internet - char KeepConnectHost[MAX_HOST_NAME_LEN + 1]; // Host name - UINT KeepConnectPort; // Port number - UINT KeepConnectProtocol; // Protocol - UINT KeepConnectInterval; // Interval - bool NoChangeWcmNetworkSettingOnWindows8; // Don't change the WCM network settings on Windows 8 -}; - -// Version acquisition -struct RPC_CLIENT_VERSION -{ - char ClientProductName[128]; // Client product name - char ClientVersionString[128]; // Client version string - char ClientBuildInfoString[128]; // Build client information string - UINT ClientVerInt; // Client version integer value - UINT ClientBuildInt; // Client build number integer value - UINT ProcessId; // Process ID - UINT OsType; // OS type - bool IsVLanNameRegulated; // Whether a virtual LAN card name must be "VLAN" + number - bool IsVgcSupported; // Whether the VPN Gate Client is supported - bool ShowVgcLink; // Display a VPN Gate Client link - char ClientId[128]; // Client OD -}; - -// Password Setting -struct RPC_CLIENT_PASSWORD -{ - char Password[MAX_PASSWORD_LEN + 1]; // Password - bool PasswordRemoteOnly; // The password is required only remote access -}; - -// Get the password setting -struct RPC_CLIENT_PASSWORD_SETTING -{ - bool IsPasswordPresented; // Password exists - bool PasswordRemoteOnly; // The password is required only remote access -}; - -// Certificate enumeration item -struct RPC_CLIENT_ENUM_CA_ITEM -{ - UINT Key; // Certificate key - wchar_t SubjectName[MAX_SIZE]; // Issued to - wchar_t IssuerName[MAX_SIZE]; // Issuer - UINT64 Expires; // Expiration date -}; - -// Certificate enumeration -struct RPC_CLIENT_ENUM_CA -{ - UINT NumItem; // Number of items - RPC_CLIENT_ENUM_CA_ITEM **Items; // Item -}; - -// Certificate item -struct RPC_CERT -{ - X *x; // Certificate -}; - -// Delete the certificate -struct RPC_CLIENT_DELETE_CA -{ - UINT Key; // Certificate key -}; - -// Get the certificate -struct RPC_GET_CA -{ - UINT Key; // Certificate key - X *x; // Certificate -}; - -// Get the issuer -struct RPC_GET_ISSUER -{ - X *x; // Certificate - X *issuer_x; // Issuer -}; - -// Secure device enumeration item -struct RPC_CLIENT_ENUM_SECURE_ITEM -{ - UINT DeviceId; // Device ID - UINT Type; // Type - char DeviceName[MAX_SIZE]; // Device name - char Manufacturer[MAX_SIZE]; // Manufacturer -}; - -// Enumeration of secure devices -struct RPC_CLIENT_ENUM_SECURE -{ - UINT NumItem; // Number of items - RPC_CLIENT_ENUM_SECURE_ITEM **Items; // Item -}; - -// Specify a secure device -struct RPC_USE_SECURE -{ - UINT DeviceId; // Device ID -}; - -// Enumerate objects in the secure device -struct RPC_ENUM_OBJECT_IN_SECURE -{ - UINT hWnd; // Window handle - UINT NumItem; // Number of items - char **ItemName; // Item name - bool *ItemType; // Type (true = secret key, false = public key) -}; - -// Create a virtual LAN -struct RPC_CLIENT_CREATE_VLAN -{ - char DeviceName[MAX_SIZE]; // Device name -}; - -// Get a Virtual LAN information -struct RPC_CLIENT_GET_VLAN -{ - char DeviceName[MAX_SIZE]; // Device name - bool Enabled; // Flag of whether it works or not - char MacAddress[MAX_SIZE]; // MAC address - char Version[MAX_SIZE]; // Version - char FileName[MAX_SIZE]; // Driver file name - char Guid[MAX_SIZE]; // GUID -}; - -// Set the virtual LAN information -struct RPC_CLIENT_SET_VLAN -{ - char DeviceName[MAX_SIZE]; // Device name - char MacAddress[MAX_SIZE]; // MAC address -}; - -// Virtual LAN enumeration item -struct RPC_CLIENT_ENUM_VLAN_ITEM -{ - char DeviceName[MAX_SIZE]; // Device name - bool Enabled; // Operation flag - char MacAddress[MAX_SIZE]; // MAC address - char Version[MAX_SIZE]; // Version -}; - -// Enumerate the virtual LANs -struct RPC_CLIENT_ENUM_VLAN -{ - UINT NumItem; // Item count - RPC_CLIENT_ENUM_VLAN_ITEM **Items; // Item -}; - -// Create an account -struct RPC_CLIENT_CREATE_ACCOUNT -{ - CLIENT_OPTION *ClientOption; // Client Option - CLIENT_AUTH *ClientAuth; // Client authentication data - bool StartupAccount; // Startup account - bool CheckServerCert; // Checking of the server certificate - bool RetryOnServerCert; // Retry on invalid server certificate - X *ServerCert; // Server certificate - UCHAR ShortcutKey[SHA1_SIZE]; // Shortcut Key -}; - -// Enumeration item of account -struct RPC_CLIENT_ENUM_ACCOUNT_ITEM -{ - wchar_t AccountName[MAX_ACCOUNT_NAME_LEN + 1]; // Account name - char UserName[MAX_USERNAME_LEN + 1]; // User name - char ServerName[MAX_HOST_NAME_LEN + 1]; // Server name - char DeviceName[MAX_DEVICE_NAME_LEN + 1]; // Device name - UINT ProxyType; // Type of proxy connection - char ProxyName[MAX_HOST_NAME_LEN + 1]; // Host name - bool Active; // Operation flag - bool Connected; // Connection completion flag - bool StartupAccount; // Startup account - UINT Port; // Port number (Ver 3.0 or later) - char HubName[MAX_HUBNAME_LEN + 1]; // Virtual HUB name (Ver 3.0 or later) - UINT64 CreateDateTime; // Creation date and time (Ver 3.0 or later) - UINT64 UpdateDateTime; // Modified date (Ver 3.0 or later) - UINT64 LastConnectDateTime; // Last connection date and time (Ver 3.0 or later) - UINT tmp1; // Temporary data -}; - -// Enumeration of accounts -struct RPC_CLIENT_ENUM_ACCOUNT -{ - UINT NumItem; // Item count - RPC_CLIENT_ENUM_ACCOUNT_ITEM **Items; // Items -}; - -// Delete the Account -struct RPC_CLIENT_DELETE_ACCOUNT -{ - wchar_t AccountName[MAX_ACCOUNT_NAME_LEN + 1]; // Account name -}; - -// Change the account name -struct RPC_RENAME_ACCOUNT -{ - wchar_t OldName[MAX_ACCOUNT_NAME_LEN + 1]; // Old name - wchar_t NewName[MAX_ACCOUNT_NAME_LEN + 1]; // New Name -}; - -// Get the account -struct RPC_CLIENT_GET_ACCOUNT -{ - wchar_t AccountName[MAX_ACCOUNT_NAME_LEN + 1]; // Account name - CLIENT_OPTION *ClientOption; // Client Option - CLIENT_AUTH *ClientAuth; // Client authentication data - bool StartupAccount; // Startup account - bool CheckServerCert; // Check the server certificate - bool RetryOnServerCert; // Retry on invalid server certificate - X *ServerCert; // Server certificate - UCHAR ShortcutKey[SHA1_SIZE]; // Shortcut Key - UINT64 CreateDateTime; // Creation date and time (Ver 3.0 or later) - UINT64 UpdateDateTime; // Modified date (Ver 3.0 or later) - UINT64 LastConnectDateTime; // Last connection date and time (Ver 3.0 or later) -}; - -// Connection -struct RPC_CLIENT_CONNECT -{ - wchar_t AccountName[MAX_ACCOUNT_NAME_LEN + 1]; // Account name -}; - -// Get the Connection status -struct RPC_CLIENT_GET_CONNECTION_STATUS -{ - wchar_t AccountName[MAX_ACCOUNT_NAME_LEN + 1]; // Account name - bool Active; // Operation flag - bool Connected; // Connected flag - UINT SessionStatus; // Session status - char ServerName[MAX_HOST_NAME_LEN + 1]; // Server name - UINT ServerPort; // Port number of the server - char ServerProductName[MAX_SIZE]; // Server product name - UINT ServerProductVer; // Server product version - UINT ServerProductBuild; // Server product build number - X *ServerX; // Server certificate - X *ClientX; // Client certificate - UINT64 StartTime; // Connection start time - /* !!! Do not correct the spelling to keep the backward protocol compatibility !!! */ - UINT64 FirstConnectionEstablisiedTime; // Connection completion time of the first connection - UINT64 CurrentConnectionEstablishTime; // Connection completion time of this connection - UINT NumConnectionsEstablished; // Number of connections have been established so far - bool HalfConnection; // Half-connection - bool QoS; // VoIP / QoS - UINT MaxTcpConnections; // Maximum number of the TCP connections - UINT NumTcpConnections; // Number of current TCP connections - UINT NumTcpConnectionsUpload; // Number of inbound connections - UINT NumTcpConnectionsDownload; // Number of outbound connections - bool UseEncrypt; // Use of encryption - char CipherName[32]; // Cipher algorithm name - char ProtocolName[64]; // Protocol name - bool UseCompress; // Use of compression - bool IsRUDPSession; // R-UDP session - char UnderlayProtocol[64]; // Physical communication protocol - char ProtocolDetails[256]; // Protocol details - bool IsUdpAccelerationEnabled; // The UDP acceleration is enabled - bool IsUsingUdpAcceleration; // Using the UDP acceleration function - char SessionName[MAX_SESSION_NAME_LEN + 1]; // Session name - char ConnectionName[MAX_CONNECTION_NAME_LEN + 1]; // Connection name - UCHAR SessionKey[SHA1_SIZE]; // Session key - POLICY Policy; // Policy - UINT64 TotalSendSize; // Total transmitted data size - UINT64 TotalRecvSize; // Total received data size - UINT64 TotalSendSizeReal; // Total transmitted data size (no compression) - UINT64 TotalRecvSizeReal; // Total received data size (no compression) - TRAFFIC Traffic; // Traffic data - bool IsBridgeMode; // Bridge Mode - bool IsMonitorMode; // Monitor mode - UINT VLanId; // VLAN ID -}; - - -// RPC connection -struct CLIENT_RPC_CONNECTION -{ - struct CLIENT *Client; // Client - bool RpcMode; // True: RPC mode, false: notification mode - THREAD *Thread; // Processing thread - SOCK *Sock; // Socket -}; - -// Client object -struct CLIENT -{ - LOCK *lock; // Lock - LOCK *lockForConnect; // Lock to be used in the CtConnect - REF *ref; // Reference counter - CEDAR *Cedar; // Cedar - volatile bool Halt; // Halting flag - UINT Err; // Error code - CFG_RW *CfgRw; // Configuration file R/W - LIST *AccountList; // Account list - UCHAR EncryptedPassword[SHA1_SIZE]; // Password - bool PasswordRemoteOnly; // Password is required only remote access - UINT UseSecureDeviceId; // Secure device ID to be used - CLIENT_CONFIG Config; // Client Settings - LIST *RpcConnectionList; // RPC connection list - SOCK *RpcListener; // RPC listener - THREAD *RpcThread; // RPC thread - LOCK *HelperLock; // Auxiliary lock - THREAD *SaverThread; // Saver thread - EVENT *SaverHalter; // The event to stop the Saver thread - LIST *NotifyCancelList; // Notification event list - KEEP *Keep; // Keep Connection - LIST *UnixVLanList; // List of virtual LAN cards in UNIX - LOG *Logger; // Logger - bool DontSavePassword; // Flag for not to save the password - ERASER *Eraser; // Eraser - SOCKLIST *SockList; // Socket list - CM_SETTING *CmSetting; // CM configuration - void *GlobalPulse; // Global pulse - THREAD *PulseRecvThread; // Pulse reception thread - volatile bool HaltPulseThread; // Stop flag for the pulse reception thread - bool NoSaveLog; // Do not save the log - bool NoSaveConfig; // Do not save the settings - INTERNET_SETTING CommonProxySetting; // Common proxy settings - void *MsSuspendHandler; // MS suspend handler - -}; - -// Notification to the remote client -struct RPC_CLIENT_NOTIFY -{ - UINT NotifyCode; // Code -}; - -// Type of notification -#define CLIENT_NOTIFY_ACCOUNT_CHANGED 1 // Account change notification -#define CLIENT_NOTIFY_VLAN_CHANGED 2 // Virtual LAN card change notification - -// Remote client -struct REMOTE_CLIENT -{ - RPC *Rpc; - UINT OsType; - bool Unix; - bool Win9x; - UINT ProcessId; - UINT ClientBuildInt; - bool IsVgcSupported; - bool ShowVgcLink; - char ClientId[128]; -}; - -// Notification client -struct NOTIFY_CLIENT -{ - SOCK *Sock; -}; - -// CM configuration -struct CM_SETTING -{ - bool EasyMode; // Simple mode - bool LockMode; // Setting lock mode - UCHAR HashedPassword[SHA1_SIZE]; // Password -}; - - - - -// Function prototype -REMOTE_CLIENT *CcConnectRpc(char *server_name, char *password, bool *bad_pass, bool *no_remote, UINT wait_retry); -REMOTE_CLIENT *CcConnectRpcEx(char *server_name, char *password, bool *bad_pass, bool *no_remote, UCHAR *key, UINT *key_error_code, bool shortcut_disconnect, UINT wait_retry); -UINT CcShortcut(UCHAR *key); -UINT CcShortcutDisconnect(UCHAR *key); -void CcDisconnectRpc(REMOTE_CLIENT *rc); -NOTIFY_CLIENT *CcConnectNotify(REMOTE_CLIENT *rc); -void CcDisconnectNotify(NOTIFY_CLIENT *n); -void CcStopNotify(NOTIFY_CLIENT *n); -bool CcWaitNotify(NOTIFY_CLIENT *n); -UINT CcGetClientVersion(REMOTE_CLIENT *r, RPC_CLIENT_VERSION *a); -UINT CcSetCmSetting(REMOTE_CLIENT *r, CM_SETTING *a); -UINT CcGetCmSetting(REMOTE_CLIENT *r, CM_SETTING *a); -UINT CcSetPassword(REMOTE_CLIENT *r, RPC_CLIENT_PASSWORD *pass); -UINT CcGetPasswordSetting(REMOTE_CLIENT *r, RPC_CLIENT_PASSWORD_SETTING *a); -UINT CcEnumCa(REMOTE_CLIENT *r, RPC_CLIENT_ENUM_CA *e); -UINT CcAddCa(REMOTE_CLIENT *r, RPC_CERT *cert); -UINT CcDeleteCa(REMOTE_CLIENT *r, RPC_CLIENT_DELETE_CA *p); -UINT CcGetCa(REMOTE_CLIENT *r, RPC_GET_CA *get); -UINT CcEnumSecure(REMOTE_CLIENT *r, RPC_CLIENT_ENUM_SECURE *e); -UINT CcUseSecure(REMOTE_CLIENT *r, RPC_USE_SECURE *sec); -UINT CcGetUseSecure(REMOTE_CLIENT *r, RPC_USE_SECURE *sec); -UINT CcCreateVLan(REMOTE_CLIENT *r, RPC_CLIENT_CREATE_VLAN *create); -UINT CcUpgradeVLan(REMOTE_CLIENT *r, RPC_CLIENT_CREATE_VLAN *create); -UINT CcGetVLan(REMOTE_CLIENT *r, RPC_CLIENT_GET_VLAN *get); -UINT CcSetVLan(REMOTE_CLIENT *r, RPC_CLIENT_SET_VLAN *set); -UINT CcEnumVLan(REMOTE_CLIENT *r, RPC_CLIENT_ENUM_VLAN *e); -UINT CcDeleteVLan(REMOTE_CLIENT *r, RPC_CLIENT_CREATE_VLAN *d); -UINT CcEnableVLan(REMOTE_CLIENT *r, RPC_CLIENT_CREATE_VLAN *vlan); -UINT CcDisableVLan(REMOTE_CLIENT *r, RPC_CLIENT_CREATE_VLAN *vlan); -UINT CcCreateAccount(REMOTE_CLIENT *r, RPC_CLIENT_CREATE_ACCOUNT *a); -UINT CcEnumAccount(REMOTE_CLIENT *r, RPC_CLIENT_ENUM_ACCOUNT *e); -UINT CcDeleteAccount(REMOTE_CLIENT *r, RPC_CLIENT_DELETE_ACCOUNT *a); -UINT CcSetAccount(REMOTE_CLIENT *r, RPC_CLIENT_CREATE_ACCOUNT *a); -UINT CcGetAccount(REMOTE_CLIENT *r, RPC_CLIENT_GET_ACCOUNT *a); -UINT CcRenameAccount(REMOTE_CLIENT *r, RPC_RENAME_ACCOUNT *rename); -UINT CcSetClientConfig(REMOTE_CLIENT *r, CLIENT_CONFIG *o); -UINT CcGetClientConfig(REMOTE_CLIENT *r, CLIENT_CONFIG *o); -UINT CcConnect(REMOTE_CLIENT *r, RPC_CLIENT_CONNECT *connect); -UINT CcDisconnect(REMOTE_CLIENT *r, RPC_CLIENT_CONNECT *connect); -UINT CcGetAccountStatus(REMOTE_CLIENT *r, RPC_CLIENT_GET_CONNECTION_STATUS *st); -UINT CcSetStartupAccount(REMOTE_CLIENT *r, RPC_CLIENT_DELETE_ACCOUNT *a); -UINT CcRemoveStartupAccount(REMOTE_CLIENT *r, RPC_CLIENT_DELETE_ACCOUNT *a); -UINT CcGetIssuer(REMOTE_CLIENT *r, RPC_GET_ISSUER *a); - - -void CcSetServiceToForegroundProcess(REMOTE_CLIENT *r); -char *CiGetFirstVLan(CLIENT *c); -void CiNormalizeAccountVLan(CLIENT *c); - -void CnStart(); -void CnListenerProc(THREAD *thread, void *param); - -void CnReleaseSocket(SOCK *s, PACK *p); - -void CnStatusPrinter(SOCK *s, PACK *p); -void Win32CnStatusPrinter(SOCK *s, PACK *p); - -void CnConnectErrorDlg(SOCK *s, PACK *p); -void Win32CnConnectErrorDlg(SOCK *s, PACK *p); -void Win32CnConnectErrorDlgThreadProc(THREAD *thread, void *param); - -void CnPasswordDlg(SOCK *s, PACK *p); -void Win32CnPasswordDlg(SOCK *s, PACK *p); -void Win32CnPasswordDlgThreadProc(THREAD *thread, void *param); - -void CnMsgDlg(SOCK *s, PACK *p); -void Win32CnMsgDlg(SOCK *s, PACK *p); -void Win32CnMsgDlgThreadProc(THREAD *thread, void *param); - -void CnNicInfo(SOCK *s, PACK *p); -void Win32CnNicInfo(SOCK *s, PACK *p); -void Win32CnNicInfoThreadProc(THREAD *thread, void *param); - -void CnCheckCert(SOCK *s, PACK *p); -void Win32CnCheckCert(SOCK *s, PACK *p); -void Win32CnCheckCertThreadProc(THREAD *thread, void *param); - -void CnExecDriverInstaller(SOCK *s, PACK *p); -void Win32CnExecDriverInstaller(SOCK *s, PACK *p); - -bool CnCheckAlreadyExists(bool lock); -bool CnIsCnServiceReady(); -void CnWaitForCnServiceReady(); - -void CnSecureSign(SOCK *s, PACK *p); - -SOCK *CncConnect(); -SOCK *CncConnectEx(UINT timeout); -void CncReleaseSocket(); -void CncExit(); -bool CncExecDriverInstaller(char *arg); -SOCK *CncStatusPrinterWindowStart(SESSION *s); -void CncStatusPrinterWindowPrint(SOCK *s, wchar_t *str); -void CncStatusPrinterWindowStop(SOCK *s); -void CncStatusPrinterWindowThreadProc(THREAD *thread, void *param); -bool CncConnectErrorDlg(SESSION *session, UI_CONNECTERROR_DLG *dlg); -void CncConnectErrorDlgHaltThread(THREAD *thread, void *param); -bool CncPasswordDlg(SESSION *session, UI_PASSWORD_DLG *dlg); -void CncCheckCert(SESSION *session, UI_CHECKCERT *dlg); -void CncCheckCertHaltThread(THREAD *thread, void *param); -bool CncSecureSignDlg(SECURE_SIGN *sign); -SOCK *CncMsgDlg(UI_MSG_DLG *dlg); -void CndMsgDlgFree(SOCK *s); -SOCK *CncNicInfo(UI_NICINFO *info); -void CncNicInfoFree(SOCK *s); - -void CtStartClient(); -void CtStopClient(); -void CtReleaseClient(CLIENT *c); -bool CtGetClientVersion(CLIENT *c, RPC_CLIENT_VERSION *ver); -bool CtGetCmSetting(CLIENT *c, CM_SETTING *s); -bool CtSetCmSetting(CLIENT *c, CM_SETTING *s); -bool CtSetPassword(CLIENT *c, RPC_CLIENT_PASSWORD *pass); -bool CtGetPasswordSetting(CLIENT *c, RPC_CLIENT_PASSWORD_SETTING *a); -bool CtEnumCa(CLIENT *c, RPC_CLIENT_ENUM_CA *e); -bool CtAddCa(CLIENT *c, RPC_CERT *cert); -bool CtDeleteCa(CLIENT *c, RPC_CLIENT_DELETE_CA *p); -bool CtGetCa(CLIENT *c, RPC_GET_CA *get); -bool CtEnumSecure(CLIENT *c, RPC_CLIENT_ENUM_SECURE *e); -bool CtUseSecure(CLIENT *c, RPC_USE_SECURE *sec); -bool CtGetUseSecure(CLIENT *c, RPC_USE_SECURE *sec); -bool CtEnumObjectInSecure(CLIENT *c, RPC_ENUM_OBJECT_IN_SECURE *e); -bool CtCreateVLan(CLIENT *c, RPC_CLIENT_CREATE_VLAN *create); -bool CtUpgradeVLan(CLIENT *c, RPC_CLIENT_CREATE_VLAN *create); -bool CtGetVLan(CLIENT *c, RPC_CLIENT_GET_VLAN *get); -bool CtSetVLan(CLIENT *c, RPC_CLIENT_SET_VLAN *set); -bool CtEnumVLan(CLIENT *c, RPC_CLIENT_ENUM_VLAN *e); -bool CtDeleteVLan(CLIENT *c, RPC_CLIENT_CREATE_VLAN *d); -bool CtEnableVLan(CLIENT *c, RPC_CLIENT_CREATE_VLAN *vlan); -bool CtDisableVLan(CLIENT *c, RPC_CLIENT_CREATE_VLAN *vlan); -bool CtCreateAccount(CLIENT *c, RPC_CLIENT_CREATE_ACCOUNT *a, bool inner); -bool CtEnumAccount(CLIENT *c, RPC_CLIENT_ENUM_ACCOUNT *e); -bool CtDeleteAccount(CLIENT *c, RPC_CLIENT_DELETE_ACCOUNT *a, bool inner); -bool CtSetAccount(CLIENT *c, RPC_CLIENT_CREATE_ACCOUNT *a, bool inner); -bool CtGetAccount(CLIENT *c, RPC_CLIENT_GET_ACCOUNT *a); -bool CtRenameAccount(CLIENT *c, RPC_RENAME_ACCOUNT *rename, bool inner); -bool CtSetClientConfig(CLIENT *c, CLIENT_CONFIG *o); -bool CtGetClientConfig(CLIENT *c, CLIENT_CONFIG *o); -bool CtConnect(CLIENT *c, RPC_CLIENT_CONNECT *connect); -bool CtDisconnect(CLIENT *c, RPC_CLIENT_CONNECT *connect, bool inner); -bool CtGetAccountStatus(CLIENT *c, RPC_CLIENT_GET_CONNECTION_STATUS *st); -bool CtSetStartupAccount(CLIENT *c, RPC_CLIENT_DELETE_ACCOUNT *a, bool inner); -bool CtRemoveStartupAccount(CLIENT *c, RPC_CLIENT_DELETE_ACCOUNT *a); -bool CtGetIssuer(CLIENT *c, RPC_GET_ISSUER *a); -bool CtGetCommonProxySetting(CLIENT *c, INTERNET_SETTING *a); -bool CtSetCommonProxySetting(CLIENT *c, INTERNET_SETTING *a); - - -// Internal function prototype -void CiSendGlobalPulse(CLIENT *c); -void CiPulseRecvThread(THREAD *thread, void *param); -void CiServerThread(THREAD *t, void *param); -void CiInitSaver(CLIENT *c); -void CiFreeSaver(CLIENT *c); -void CiGetSessionStatus(RPC_CLIENT_GET_CONNECTION_STATUS *st, SESSION *s); -PACK *CiRpcDispatch(RPC *rpc, char *name, PACK *p); -void CiRpcAccepted(CLIENT *c, SOCK *s); -void CiNotifyMain(CLIENT *c, SOCK *s); -void CiRpcAcceptThread(THREAD *thread, void *param); -void CiRpcServerThread(THREAD *thread, void *param); -void CiStartRpcServer(CLIENT *c); -void CiStopRpcServer(CLIENT *c); -CLIENT_OPTION *CiLoadClientOption(FOLDER *f); -CLIENT_AUTH *CiLoadClientAuth(FOLDER *f); -ACCOUNT *CiLoadClientAccount(FOLDER *f); -void CiLoadClientConfig(CLIENT_CONFIG *c, FOLDER *f); -void CiLoadAccountDatabase(CLIENT *c, FOLDER *f); -void CiLoadCAList(CLIENT *c, FOLDER *f); -void CiLoadCACert(CLIENT *c, FOLDER *f); -void CiLoadVLanList(CLIENT *c, FOLDER *f); -void CiLoadVLan(CLIENT *c, FOLDER *f); -bool CiReadSettingFromCfg(CLIENT *c, FOLDER *root); -void CiWriteAccountDatabase(CLIENT *c, FOLDER *f); -void CiWriteAccountData(FOLDER *f, ACCOUNT *a); -void CiWriteClientOption(FOLDER *f, CLIENT_OPTION *o); -void CiWriteClientAuth(FOLDER *f, CLIENT_AUTH *a); -void CiWriteClientConfig(FOLDER *cc, CLIENT_CONFIG *config); -void CiWriteSettingToCfg(CLIENT *c, FOLDER *root); -void CiWriteCAList(CLIENT *c, FOLDER *f); -void CiWriteCACert(CLIENT *c, FOLDER *f, X *x); -void CiWriteVLanList(CLIENT *c, FOLDER *f); -void CiWriteVLan(CLIENT *c, FOLDER *f, UNIX_VLAN *v); -void CiFreeClientGetConnectionStatus(RPC_CLIENT_GET_CONNECTION_STATUS *st); -bool CiCheckCertProc(SESSION *s, CONNECTION *c, X *server_x, bool *expired); -bool CiSecureSignProc(SESSION *s, CONNECTION *c, SECURE_SIGN *sign); -bool Win32CiSecureSign(SECURE_SIGN *sign); -void CiFreeClientAuth(CLIENT_AUTH *auth); -void CiFreeClientCreateAccount(RPC_CLIENT_CREATE_ACCOUNT *a); -void CiFreeClientGetAccount(RPC_CLIENT_GET_ACCOUNT *a); -void CiFreeClientEnumVLan(RPC_CLIENT_ENUM_VLAN *e); -void CiFreeClientEnumSecure(RPC_CLIENT_ENUM_SECURE *e); -void CiFreeClientEnumCa(RPC_CLIENT_ENUM_CA *e); -void CiFreeEnumObjectInSecure(RPC_ENUM_OBJECT_IN_SECURE *a); -void CiFreeGetCa(RPC_GET_CA *a); -void CiFreeGetIssuer(RPC_GET_ISSUER *a); -void CiFreeClientEnumAccount(RPC_CLIENT_ENUM_ACCOUNT *a); -void CiSetError(CLIENT *c, UINT err); -void CiCheckOs(); -CLIENT *CiNewClient(); -void CiCleanupClient(CLIENT *c); -bool CiLoadConfigurationFile(CLIENT *c); -void CiSaveConfigurationFile(CLIENT *c); -void CiInitConfiguration(CLIENT *c); -void CiSetVLanToDefault(CLIENT *c); -bool CiIsVLan(CLIENT *c, char *name); -void CiFreeConfiguration(CLIENT *c); -int CiCompareAccount(void *p1, void *p2); -void CiFreeAccount(ACCOUNT *a); -void CiNotify(CLIENT *c); -void CiNotifyInternal(CLIENT *c); -void CiClientStatusPrinter(SESSION *s, wchar_t *status); -void CiInitKeep(CLIENT *c); -void CiFreeKeep(CLIENT *c); -int CiCompareUnixVLan(void *p1, void *p2); -BUF *CiAccountToCfg(RPC_CLIENT_CREATE_ACCOUNT *t); -RPC_CLIENT_CREATE_ACCOUNT *CiCfgToAccount(BUF *b); -void CiChangeAllVLanMacAddressIfCleared(CLIENT *c); -void CiChangeAllVLanMacAddress(CLIENT *c); -void CiChangeAllVLanMacAddressIfMachineChanged(CLIENT *c); -bool CiReadLastMachineHash(void *data); -bool CiWriteLastMachineHash(void *data); -void CiGetCurrentMachineHash(void *data); -void CiGetCurrentMachineHashOld(void *data); -void CiGetCurrentMachineHashNew(void *data); -LIST *CiLoadIni(); -void CiFreeIni(LIST *o); -void CiLoadIniSettings(CLIENT *c); -bool CiLoadConfigFilePathFromIni(char *path, UINT size); -int CiCompareClientAccountEnumItemByLastConnectDateTime(void *p1, void *p2); -bool CiIsValidVLanRegulatedName(char *name); -void CiGenerateVLanRegulatedName(char *name, UINT size, UINT i); -bool CiGetNextRecommendedVLanName(REMOTE_CLIENT *r, char *name, UINT size); -void CiDisableWcmNetworkMinimize(CLIENT *c); -bool CiTryToParseAccount(BUF *b); -bool CiTryToParseAccountFile(wchar_t *name); -bool CiEraseSensitiveInAccount(BUF *b); -bool CiHasAccountSensitiveInformation(BUF *b); -void CiApplyInnerVPNServerConfig(CLIENT *c); -void CiIncrementNumActiveSessions(); -void CiDecrementNumActiveSessions(); - -BUF *EncryptPassword(char *password); -BUF *EncryptPassword2(char *password); -char *DecryptPassword(BUF *b); -char *DecryptPassword2(BUF *b); - -void InRpcGetIssuer(RPC_GET_ISSUER *c, PACK *p); -void OutRpcGetIssuer(PACK *p, RPC_GET_ISSUER *c); -void InRpcClientVersion(RPC_CLIENT_VERSION *ver, PACK *p); -void OutRpcClientVersion(PACK *p, RPC_CLIENT_VERSION *ver); -void InRpcClientPassword(RPC_CLIENT_PASSWORD *pw, PACK *p); -void OutRpcClientPassword(PACK *p, RPC_CLIENT_PASSWORD *pw); -void InRpcClientEnumCa(RPC_CLIENT_ENUM_CA *e, PACK *p); -void OutRpcClientEnumCa(PACK *p, RPC_CLIENT_ENUM_CA *e); -void InRpcCert(RPC_CERT *c, PACK *p); -void OutRpcCert(PACK *p, RPC_CERT *c); -void InRpcClientDeleteCa(RPC_CLIENT_DELETE_CA *c, PACK *p); -void OutRpcClientDeleteCa(PACK *p, RPC_CLIENT_DELETE_CA *c); -void InRpcGetCa(RPC_GET_CA *c, PACK *p); -void OutRpcGetCa(PACK *p, RPC_GET_CA *c); -void InRpcClientEnumSecure(RPC_CLIENT_ENUM_SECURE *e, PACK *p); -void OutRpcClientEnumSecure(PACK *p, RPC_CLIENT_ENUM_SECURE *e); -void InRpcUseSecure(RPC_USE_SECURE *u, PACK *p); -void OutRpcUseSecure(PACK *p, RPC_USE_SECURE *u); -void OutRpcEnumObjectInSecure(PACK *p, RPC_ENUM_OBJECT_IN_SECURE *e); -void InRpcCreateVLan(RPC_CLIENT_CREATE_VLAN *v, PACK *p); -void OutRpcCreateVLan(PACK *p, RPC_CLIENT_CREATE_VLAN *v); -void InRpcClientGetVLan(RPC_CLIENT_GET_VLAN *v, PACK *p); -void OutRpcClientGetVLan(PACK *p, RPC_CLIENT_GET_VLAN *v); -void InRpcClientSetVLan(RPC_CLIENT_SET_VLAN *v, PACK *p); -void OutRpcClientSetVLan(PACK *p, RPC_CLIENT_SET_VLAN *v); -void InRpcClientEnumVLan(RPC_CLIENT_ENUM_VLAN *v, PACK *p); -void OutRpcClientEnumVLan(PACK *p, RPC_CLIENT_ENUM_VLAN *v); -void InRpcClientOption(CLIENT_OPTION *c, PACK *p); -void OutRpcClientOption(PACK *p, CLIENT_OPTION *c); -void InRpcClientAuth(CLIENT_AUTH *c, PACK *p); -void OutRpcClientAuth(PACK *p, CLIENT_AUTH *c); -void InRpcClientCreateAccount(RPC_CLIENT_CREATE_ACCOUNT *c, PACK *p); -void OutRpcClientCreateAccount(PACK *p, RPC_CLIENT_CREATE_ACCOUNT *c); -void InRpcClientEnumAccount(RPC_CLIENT_ENUM_ACCOUNT *e, PACK *p); -void OutRpcClientEnumAccount(PACK *p, RPC_CLIENT_ENUM_ACCOUNT *e); -void InRpcClientDeleteAccount(RPC_CLIENT_DELETE_ACCOUNT *a, PACK *p); -void OutRpcClientDeleteAccount(PACK *p, RPC_CLIENT_DELETE_ACCOUNT *a); -void InRpcRenameAccount(RPC_RENAME_ACCOUNT *a, PACK *p); -void OutRpcRenameAccount(PACK *p, RPC_RENAME_ACCOUNT *a); -void InRpcClientGetAccount(RPC_CLIENT_GET_ACCOUNT *c, PACK *p); -void OutRpcClientGetAccount(PACK *p, RPC_CLIENT_GET_ACCOUNT *c); -void InRpcClientConnect(RPC_CLIENT_CONNECT *c, PACK *p); -void OutRpcClientConnect(PACK *p, RPC_CLIENT_CONNECT *c); -void InRpcPolicy(POLICY *o, PACK *p); -void OutRpcPolicy(PACK *p, POLICY *o); -void InRpcClientGetConnectionStatus(RPC_CLIENT_GET_CONNECTION_STATUS *s, PACK *p); -void OutRpcClientGetConnectionStatus(PACK *p, RPC_CLIENT_GET_CONNECTION_STATUS *c); -void InRpcClientConfig(CLIENT_CONFIG *c, PACK *p); -void OutRpcClientConfig(PACK *p, CLIENT_CONFIG *c); -void InRpcClientPasswordSetting(RPC_CLIENT_PASSWORD_SETTING *a, PACK *p); -void OutRpcClientPasswordSetting(PACK *p, RPC_CLIENT_PASSWORD_SETTING *a); -void InRpcTraffic(TRAFFIC *t, PACK *p); -void OutRpcTraffic(PACK *p, TRAFFIC *t); -void InRpcTrafficEx(TRAFFIC *t, PACK *p, UINT i); -void OutRpcTrafficEx(TRAFFIC *t, PACK *p, UINT i, UINT num); -void OutRpcCmSetting(PACK *p, CM_SETTING *c); -void InRpcCmSetting(CM_SETTING *c, PACK *p); - - -#ifdef OS_WIN32 -void CiInitDriverVerStruct(MS_DRIVER_VER *ver); -#endif // OS_EIN32 - -#endif // CLIENT_H - - +// SoftEther VPN Source Code - Developer Edition Master Branch +// Cedar Communication Module +// © 2020 Nokia + +// Client.h +// Header of Client.c + +#ifndef CLIENT_H +#define CLIENT_H + +#define CLIENT_CONFIG_PORT GC_CLIENT_CONFIG_PORT // Client port number +#define CLIENT_NOTIFY_PORT GC_CLIENT_NOTIFY_PORT // Client notification port number +#define CLIENT_WAIT_CN_READY_TIMEOUT (10 * 1000) // Standby time to start the client notification service + + +// Check whether the client can run on the specified OS_TYPE +#define IS_CLIENT_SUPPORTED_OS(t) \ + ((OS_IS_WINDOWS_NT(t) && GET_KETA(t, 100) >= 2) || (OS_IS_WINDOWS_9X(t))) + + +// Constants +#define CLIENT_CONFIG_FILE_NAME "$vpn_client.config" +#define CLIENT_DEFAULT_KEEPALIVE_HOST "keepalive.softether.org" +#define CLIENT_DEFAULT_KEEPALIVE_PORT 80 +#define CLIENT_DEFAULT_KEEPALIVE_INTERVAL KEEP_INTERVAL_DEFAULT + +#define CLIENT_RPC_MODE_NOTIFY 0 +#define CLIENT_RPC_MODE_MANAGEMENT 1 +#define CLIENT_RPC_MODE_SHORTCUT 2 +#define CLIENT_RPC_MODE_SHORTCUT_DISCONNECT 3 + +#define CLIENT_MACOS_TAP_NAME "tap0" + +#define CLIENT_SAVER_INTERVAL (30 * 1000) + +#define CLIENT_NOTIFY_SERVICE_INSTANCENAME GC_SW_SOFTETHER_PREFIX "vpnclient_uihelper" + +#define CLIENT_WIN32_EXE_FILENAME "vpnclient.exe" + +#define CLIENT_CUSTOM_INI_FILENAME "$custom.ini" + +#define CLIENT_GLOBAL_PULSE_NAME "clientglobalpulse" + +#define CLIENT_WIN32_REGKEYNAME "Software\\" GC_REG_COMPANY_NAME "\\" CEDAR_PRODUCT_STR " VPN\\Client" +#define CLIENT_WIN32_REGVALUE_PORT "RpcPort" +#define CLIENT_WIN32_REGVALUE_PID "RpcPid" + + +// List of virtual LAN cards in UNIX +struct UNIX_VLAN +{ + bool Enabled; // Enable flag + char Name[MAX_SIZE]; // Name + UCHAR MacAddress[6]; // MAC address + UCHAR Padding[2]; +}; + +// Account +struct ACCOUNT +{ + // Static data + CLIENT_OPTION *ClientOption; // Client Option + CLIENT_AUTH *ClientAuth; // Client authentication data + bool CheckServerCert; // Check the server certificate + bool RetryOnServerCert; // Retry on invalid server certificate + X *ServerCert; // Server certificate + bool StartupAccount; // Start-up account + UCHAR ShortcutKey[SHA1_SIZE]; // Key + UINT64 CreateDateTime; // Creation date and time + UINT64 UpdateDateTime; // Updating date + UINT64 LastConnectDateTime; // Last connection date and time + + // Dynamic data + LOCK *lock; // Lock + SESSION *ClientSession; // Client session + CLIENT_STATUS_PRINTER *StatusPrinter; // Status indicator + + SOCK *StatusWindow; // Status window +}; + +// Client Settings +struct CLIENT_CONFIG +{ + bool AllowRemoteConfig; // Allow the remote configuration + bool UseKeepConnect; // Keep connected to the Internet + char KeepConnectHost[MAX_HOST_NAME_LEN + 1]; // Host name + UINT KeepConnectPort; // Port number + UINT KeepConnectProtocol; // Protocol + UINT KeepConnectInterval; // Interval + bool NoChangeWcmNetworkSettingOnWindows8; // Don't change the WCM network settings on Windows 8 +}; + +// Version acquisition +struct RPC_CLIENT_VERSION +{ + char ClientProductName[128]; // Client product name + char ClientVersionString[128]; // Client version string + char ClientBuildInfoString[128]; // Build client information string + UINT ClientVerInt; // Client version integer value + UINT ClientBuildInt; // Client build number integer value + UINT ProcessId; // Process ID + UINT OsType; // OS type + bool IsVLanNameRegulated; // Whether a virtual LAN card name must be "VLAN" + number + bool IsVgcSupported; // Whether the VPN Gate Client is supported + bool ShowVgcLink; // Display a VPN Gate Client link + char ClientId[128]; // Client OD +}; + +// Password Setting +struct RPC_CLIENT_PASSWORD +{ + char Password[MAX_PASSWORD_LEN + 1]; // Password + bool PasswordRemoteOnly; // The password is required only remote access +}; + +// Get the password setting +struct RPC_CLIENT_PASSWORD_SETTING +{ + bool IsPasswordPresented; // Password exists + bool PasswordRemoteOnly; // The password is required only remote access +}; + +// Certificate enumeration item +struct RPC_CLIENT_ENUM_CA_ITEM +{ + UINT Key; // Certificate key + wchar_t SubjectName[MAX_SIZE]; // Issued to + wchar_t IssuerName[MAX_SIZE]; // Issuer + UINT64 Expires; // Expiration date +}; + +// Certificate enumeration +struct RPC_CLIENT_ENUM_CA +{ + UINT NumItem; // Number of items + RPC_CLIENT_ENUM_CA_ITEM **Items; // Item +}; + +// Certificate item +struct RPC_CERT +{ + X *x; // Certificate +}; + +// Delete the certificate +struct RPC_CLIENT_DELETE_CA +{ + UINT Key; // Certificate key +}; + +// Get the certificate +struct RPC_GET_CA +{ + UINT Key; // Certificate key + X *x; // Certificate +}; + +// Get the issuer +struct RPC_GET_ISSUER +{ + X *x; // Certificate + X *issuer_x; // Issuer +}; + +// Secure device enumeration item +struct RPC_CLIENT_ENUM_SECURE_ITEM +{ + UINT DeviceId; // Device ID + UINT Type; // Type + char DeviceName[MAX_SIZE]; // Device name + char Manufacturer[MAX_SIZE]; // Manufacturer +}; + +// Enumeration of secure devices +struct RPC_CLIENT_ENUM_SECURE +{ + UINT NumItem; // Number of items + RPC_CLIENT_ENUM_SECURE_ITEM **Items; // Item +}; + +// Specify a secure device +struct RPC_USE_SECURE +{ + UINT DeviceId; // Device ID +}; + +// Enumerate objects in the secure device +struct RPC_ENUM_OBJECT_IN_SECURE +{ + UINT hWnd; // Window handle + UINT NumItem; // Number of items + char **ItemName; // Item name + bool *ItemType; // Type (true = secret key, false = public key) +}; + +// Create a virtual LAN +struct RPC_CLIENT_CREATE_VLAN +{ + char DeviceName[MAX_SIZE]; // Device name +}; + +// Get a Virtual LAN information +struct RPC_CLIENT_GET_VLAN +{ + char DeviceName[MAX_SIZE]; // Device name + bool Enabled; // Flag of whether it works or not + char MacAddress[MAX_SIZE]; // MAC address + char Version[MAX_SIZE]; // Version + char FileName[MAX_SIZE]; // Driver file name + char Guid[MAX_SIZE]; // GUID +}; + +// Set the virtual LAN information +struct RPC_CLIENT_SET_VLAN +{ + char DeviceName[MAX_SIZE]; // Device name + char MacAddress[MAX_SIZE]; // MAC address +}; + +// Virtual LAN enumeration item +struct RPC_CLIENT_ENUM_VLAN_ITEM +{ + char DeviceName[MAX_SIZE]; // Device name + bool Enabled; // Operation flag + char MacAddress[MAX_SIZE]; // MAC address + char Version[MAX_SIZE]; // Version +}; + +// Enumerate the virtual LANs +struct RPC_CLIENT_ENUM_VLAN +{ + UINT NumItem; // Item count + RPC_CLIENT_ENUM_VLAN_ITEM **Items; // Item +}; + +// Create an account +struct RPC_CLIENT_CREATE_ACCOUNT +{ + CLIENT_OPTION *ClientOption; // Client Option + CLIENT_AUTH *ClientAuth; // Client authentication data + bool StartupAccount; // Startup account + bool CheckServerCert; // Checking of the server certificate + bool RetryOnServerCert; // Retry on invalid server certificate + X *ServerCert; // Server certificate + UCHAR ShortcutKey[SHA1_SIZE]; // Shortcut Key +}; + +// Enumeration item of account +struct RPC_CLIENT_ENUM_ACCOUNT_ITEM +{ + wchar_t AccountName[MAX_ACCOUNT_NAME_LEN + 1]; // Account name + char UserName[MAX_USERNAME_LEN + 1]; // User name + char ServerName[MAX_HOST_NAME_LEN + 1]; // Server name + char DeviceName[MAX_DEVICE_NAME_LEN + 1]; // Device name + UINT ProxyType; // Type of proxy connection + char ProxyName[MAX_HOST_NAME_LEN + 1]; // Host name + bool Active; // Operation flag + bool Connected; // Connection completion flag + bool StartupAccount; // Startup account + UINT Port; // Port number (Ver 3.0 or later) + char HubName[MAX_HUBNAME_LEN + 1]; // Virtual HUB name (Ver 3.0 or later) + UINT64 CreateDateTime; // Creation date and time (Ver 3.0 or later) + UINT64 UpdateDateTime; // Modified date (Ver 3.0 or later) + UINT64 LastConnectDateTime; // Last connection date and time (Ver 3.0 or later) + UINT tmp1; // Temporary data +}; + +// Enumeration of accounts +struct RPC_CLIENT_ENUM_ACCOUNT +{ + UINT NumItem; // Item count + RPC_CLIENT_ENUM_ACCOUNT_ITEM **Items; // Items +}; + +// Delete the Account +struct RPC_CLIENT_DELETE_ACCOUNT +{ + wchar_t AccountName[MAX_ACCOUNT_NAME_LEN + 1]; // Account name +}; + +// Change the account name +struct RPC_RENAME_ACCOUNT +{ + wchar_t OldName[MAX_ACCOUNT_NAME_LEN + 1]; // Old name + wchar_t NewName[MAX_ACCOUNT_NAME_LEN + 1]; // New Name +}; + +// Get the account +struct RPC_CLIENT_GET_ACCOUNT +{ + wchar_t AccountName[MAX_ACCOUNT_NAME_LEN + 1]; // Account name + CLIENT_OPTION *ClientOption; // Client Option + CLIENT_AUTH *ClientAuth; // Client authentication data + bool StartupAccount; // Startup account + bool CheckServerCert; // Check the server certificate + bool RetryOnServerCert; // Retry on invalid server certificate + X *ServerCert; // Server certificate + UCHAR ShortcutKey[SHA1_SIZE]; // Shortcut Key + UINT64 CreateDateTime; // Creation date and time (Ver 3.0 or later) + UINT64 UpdateDateTime; // Modified date (Ver 3.0 or later) + UINT64 LastConnectDateTime; // Last connection date and time (Ver 3.0 or later) +}; + +// Connection +struct RPC_CLIENT_CONNECT +{ + wchar_t AccountName[MAX_ACCOUNT_NAME_LEN + 1]; // Account name +}; + +// Get the Connection status +struct RPC_CLIENT_GET_CONNECTION_STATUS +{ + wchar_t AccountName[MAX_ACCOUNT_NAME_LEN + 1]; // Account name + bool Active; // Operation flag + bool Connected; // Connected flag + UINT SessionStatus; // Session status + char ServerName[MAX_HOST_NAME_LEN + 1]; // Server name + UINT ServerPort; // Port number of the server + char ServerProductName[MAX_SIZE]; // Server product name + UINT ServerProductVer; // Server product version + UINT ServerProductBuild; // Server product build number + X *ServerX; // Server certificate + X *ClientX; // Client certificate + UINT64 StartTime; // Connection start time + /* !!! Do not correct the spelling to keep the backward protocol compatibility !!! */ + UINT64 FirstConnectionEstablisiedTime; // Connection completion time of the first connection + UINT64 CurrentConnectionEstablishTime; // Connection completion time of this connection + UINT NumConnectionsEstablished; // Number of connections have been established so far + bool HalfConnection; // Half-connection + bool QoS; // VoIP / QoS + UINT MaxTcpConnections; // Maximum number of the TCP connections + UINT NumTcpConnections; // Number of current TCP connections + UINT NumTcpConnectionsUpload; // Number of inbound connections + UINT NumTcpConnectionsDownload; // Number of outbound connections + bool UseEncrypt; // Use of encryption + char CipherName[32]; // Cipher algorithm name + char ProtocolName[64]; // Protocol name + bool UseCompress; // Use of compression + bool IsRUDPSession; // R-UDP session + char UnderlayProtocol[64]; // Physical communication protocol + char ProtocolDetails[256]; // Protocol details + bool IsUdpAccelerationEnabled; // The UDP acceleration is enabled + bool IsUsingUdpAcceleration; // Using the UDP acceleration function + char SessionName[MAX_SESSION_NAME_LEN + 1]; // Session name + char ConnectionName[MAX_CONNECTION_NAME_LEN + 1]; // Connection name + UCHAR SessionKey[SHA1_SIZE]; // Session key + POLICY Policy; // Policy + UINT64 TotalSendSize; // Total transmitted data size + UINT64 TotalRecvSize; // Total received data size + UINT64 TotalSendSizeReal; // Total transmitted data size (no compression) + UINT64 TotalRecvSizeReal; // Total received data size (no compression) + TRAFFIC Traffic; // Traffic data + bool IsBridgeMode; // Bridge Mode + bool IsMonitorMode; // Monitor mode + UINT VLanId; // VLAN ID +}; + + +// RPC connection +struct CLIENT_RPC_CONNECTION +{ + struct CLIENT *Client; // Client + bool RpcMode; // True: RPC mode, false: notification mode + THREAD *Thread; // Processing thread + SOCK *Sock; // Socket +}; + +// Client object +struct CLIENT +{ + LOCK *lock; // Lock + LOCK *lockForConnect; // Lock to be used in the CtConnect + REF *ref; // Reference counter + CEDAR *Cedar; // Cedar + volatile bool Halt; // Halting flag + UINT Err; // Error code + CFG_RW *CfgRw; // Configuration file R/W + LIST *AccountList; // Account list + UCHAR EncryptedPassword[SHA1_SIZE]; // Password + bool PasswordRemoteOnly; // Password is required only remote access + UINT UseSecureDeviceId; // Secure device ID to be used + CLIENT_CONFIG Config; // Client Settings + LIST *RpcConnectionList; // RPC connection list + SOCK *RpcListener; // RPC listener + THREAD *RpcThread; // RPC thread + LOCK *HelperLock; // Auxiliary lock + THREAD *SaverThread; // Saver thread + EVENT *SaverHalter; // The event to stop the Saver thread + LIST *NotifyCancelList; // Notification event list + KEEP *Keep; // Keep Connection + LIST *UnixVLanList; // List of virtual LAN cards in UNIX + LOG *Logger; // Logger + bool DontSavePassword; // Flag for not to save the password + ERASER *Eraser; // Eraser + SOCKLIST *SockList; // Socket list + CM_SETTING *CmSetting; // CM configuration + void *GlobalPulse; // Global pulse + THREAD *PulseRecvThread; // Pulse reception thread + volatile bool HaltPulseThread; // Stop flag for the pulse reception thread + bool NoSaveLog; // Do not save the log + bool NoSaveConfig; // Do not save the settings + INTERNET_SETTING CommonProxySetting; // Common proxy settings + void *MsSuspendHandler; // MS suspend handler + +}; + +// Notification to the remote client +struct RPC_CLIENT_NOTIFY +{ + UINT NotifyCode; // Code +}; + +// Type of notification +#define CLIENT_NOTIFY_ACCOUNT_CHANGED 1 // Account change notification +#define CLIENT_NOTIFY_VLAN_CHANGED 2 // Virtual LAN card change notification + +// Remote client +struct REMOTE_CLIENT +{ + RPC *Rpc; + UINT OsType; + bool Unix; + bool Win9x; + UINT ProcessId; + UINT ClientBuildInt; + bool IsVgcSupported; + bool ShowVgcLink; + char ClientId[128]; +}; + +// Notification client +struct NOTIFY_CLIENT +{ + SOCK *Sock; +}; + +// CM configuration +struct CM_SETTING +{ + bool EasyMode; // Simple mode + bool LockMode; // Setting lock mode + UCHAR HashedPassword[SHA1_SIZE]; // Password +}; + + + + +// Function prototype +REMOTE_CLIENT *CcConnectRpc(char *server_name, char *password, bool *bad_pass, bool *no_remote, UINT wait_retry); +REMOTE_CLIENT *CcConnectRpcEx(char *server_name, char *password, bool *bad_pass, bool *no_remote, UCHAR *key, UINT *key_error_code, bool shortcut_disconnect, UINT wait_retry); +UINT CcShortcut(UCHAR *key); +UINT CcShortcutDisconnect(UCHAR *key); +void CcDisconnectRpc(REMOTE_CLIENT *rc); +NOTIFY_CLIENT *CcConnectNotify(REMOTE_CLIENT *rc); +void CcDisconnectNotify(NOTIFY_CLIENT *n); +void CcStopNotify(NOTIFY_CLIENT *n); +bool CcWaitNotify(NOTIFY_CLIENT *n); +UINT CcGetClientVersion(REMOTE_CLIENT *r, RPC_CLIENT_VERSION *a); +UINT CcSetCmSetting(REMOTE_CLIENT *r, CM_SETTING *a); +UINT CcGetCmSetting(REMOTE_CLIENT *r, CM_SETTING *a); +UINT CcSetPassword(REMOTE_CLIENT *r, RPC_CLIENT_PASSWORD *pass); +UINT CcGetPasswordSetting(REMOTE_CLIENT *r, RPC_CLIENT_PASSWORD_SETTING *a); +UINT CcEnumCa(REMOTE_CLIENT *r, RPC_CLIENT_ENUM_CA *e); +UINT CcAddCa(REMOTE_CLIENT *r, RPC_CERT *cert); +UINT CcDeleteCa(REMOTE_CLIENT *r, RPC_CLIENT_DELETE_CA *p); +UINT CcGetCa(REMOTE_CLIENT *r, RPC_GET_CA *get); +UINT CcEnumSecure(REMOTE_CLIENT *r, RPC_CLIENT_ENUM_SECURE *e); +UINT CcUseSecure(REMOTE_CLIENT *r, RPC_USE_SECURE *sec); +UINT CcGetUseSecure(REMOTE_CLIENT *r, RPC_USE_SECURE *sec); +UINT CcCreateVLan(REMOTE_CLIENT *r, RPC_CLIENT_CREATE_VLAN *create); +UINT CcUpgradeVLan(REMOTE_CLIENT *r, RPC_CLIENT_CREATE_VLAN *create); +UINT CcGetVLan(REMOTE_CLIENT *r, RPC_CLIENT_GET_VLAN *get); +UINT CcSetVLan(REMOTE_CLIENT *r, RPC_CLIENT_SET_VLAN *set); +UINT CcEnumVLan(REMOTE_CLIENT *r, RPC_CLIENT_ENUM_VLAN *e); +UINT CcDeleteVLan(REMOTE_CLIENT *r, RPC_CLIENT_CREATE_VLAN *d); +UINT CcEnableVLan(REMOTE_CLIENT *r, RPC_CLIENT_CREATE_VLAN *vlan); +UINT CcDisableVLan(REMOTE_CLIENT *r, RPC_CLIENT_CREATE_VLAN *vlan); +UINT CcCreateAccount(REMOTE_CLIENT *r, RPC_CLIENT_CREATE_ACCOUNT *a); +UINT CcEnumAccount(REMOTE_CLIENT *r, RPC_CLIENT_ENUM_ACCOUNT *e); +UINT CcDeleteAccount(REMOTE_CLIENT *r, RPC_CLIENT_DELETE_ACCOUNT *a); +UINT CcSetAccount(REMOTE_CLIENT *r, RPC_CLIENT_CREATE_ACCOUNT *a); +UINT CcGetAccount(REMOTE_CLIENT *r, RPC_CLIENT_GET_ACCOUNT *a); +UINT CcRenameAccount(REMOTE_CLIENT *r, RPC_RENAME_ACCOUNT *rename); +UINT CcSetClientConfig(REMOTE_CLIENT *r, CLIENT_CONFIG *o); +UINT CcGetClientConfig(REMOTE_CLIENT *r, CLIENT_CONFIG *o); +UINT CcConnect(REMOTE_CLIENT *r, RPC_CLIENT_CONNECT *connect); +UINT CcDisconnect(REMOTE_CLIENT *r, RPC_CLIENT_CONNECT *connect); +UINT CcGetAccountStatus(REMOTE_CLIENT *r, RPC_CLIENT_GET_CONNECTION_STATUS *st); +UINT CcSetStartupAccount(REMOTE_CLIENT *r, RPC_CLIENT_DELETE_ACCOUNT *a); +UINT CcRemoveStartupAccount(REMOTE_CLIENT *r, RPC_CLIENT_DELETE_ACCOUNT *a); +UINT CcGetIssuer(REMOTE_CLIENT *r, RPC_GET_ISSUER *a); + + +void CcSetServiceToForegroundProcess(REMOTE_CLIENT *r); +char *CiGetFirstVLan(CLIENT *c); +void CiNormalizeAccountVLan(CLIENT *c); + +void CnStart(); +void CnListenerProc(THREAD *thread, void *param); + +void CnReleaseSocket(SOCK *s, PACK *p); + +void CnStatusPrinter(SOCK *s, PACK *p); +void Win32CnStatusPrinter(SOCK *s, PACK *p); + +void CnConnectErrorDlg(SOCK *s, PACK *p); +void Win32CnConnectErrorDlg(SOCK *s, PACK *p); +void Win32CnConnectErrorDlgThreadProc(THREAD *thread, void *param); + +void CnPasswordDlg(SOCK *s, PACK *p); +void Win32CnPasswordDlg(SOCK *s, PACK *p); +void Win32CnPasswordDlgThreadProc(THREAD *thread, void *param); + +void CnMsgDlg(SOCK *s, PACK *p); +void Win32CnMsgDlg(SOCK *s, PACK *p); +void Win32CnMsgDlgThreadProc(THREAD *thread, void *param); + +void CnNicInfo(SOCK *s, PACK *p); +void Win32CnNicInfo(SOCK *s, PACK *p); +void Win32CnNicInfoThreadProc(THREAD *thread, void *param); + +void CnCheckCert(SOCK *s, PACK *p); +void Win32CnCheckCert(SOCK *s, PACK *p); +void Win32CnCheckCertThreadProc(THREAD *thread, void *param); + +void CnExecDriverInstaller(SOCK *s, PACK *p); +void Win32CnExecDriverInstaller(SOCK *s, PACK *p); + +bool CnCheckAlreadyExists(bool lock); +bool CnIsCnServiceReady(); +void CnWaitForCnServiceReady(); + +void CnSecureSign(SOCK *s, PACK *p); + +SOCK *CncConnect(); +SOCK *CncConnectEx(UINT timeout); +void CncReleaseSocket(); +void CncExit(); +bool CncExecDriverInstaller(char *arg); +SOCK *CncStatusPrinterWindowStart(SESSION *s); +void CncStatusPrinterWindowPrint(SOCK *s, wchar_t *str); +void CncStatusPrinterWindowStop(SOCK *s); +void CncStatusPrinterWindowThreadProc(THREAD *thread, void *param); +bool CncConnectErrorDlg(SESSION *session, UI_CONNECTERROR_DLG *dlg); +void CncConnectErrorDlgHaltThread(THREAD *thread, void *param); +bool CncPasswordDlg(SESSION *session, UI_PASSWORD_DLG *dlg); +void CncCheckCert(SESSION *session, UI_CHECKCERT *dlg); +void CncCheckCertHaltThread(THREAD *thread, void *param); +bool CncSecureSignDlg(SECURE_SIGN *sign); +SOCK *CncMsgDlg(UI_MSG_DLG *dlg); +void CndMsgDlgFree(SOCK *s); +SOCK *CncNicInfo(UI_NICINFO *info); +void CncNicInfoFree(SOCK *s); + +void CtStartClient(); +void CtStopClient(); +void CtReleaseClient(CLIENT *c); +bool CtGetClientVersion(CLIENT *c, RPC_CLIENT_VERSION *ver); +bool CtGetCmSetting(CLIENT *c, CM_SETTING *s); +bool CtSetCmSetting(CLIENT *c, CM_SETTING *s); +bool CtSetPassword(CLIENT *c, RPC_CLIENT_PASSWORD *pass); +bool CtGetPasswordSetting(CLIENT *c, RPC_CLIENT_PASSWORD_SETTING *a); +bool CtEnumCa(CLIENT *c, RPC_CLIENT_ENUM_CA *e); +bool CtAddCa(CLIENT *c, RPC_CERT *cert); +bool CtDeleteCa(CLIENT *c, RPC_CLIENT_DELETE_CA *p); +bool CtGetCa(CLIENT *c, RPC_GET_CA *get); +bool CtEnumSecure(CLIENT *c, RPC_CLIENT_ENUM_SECURE *e); +bool CtUseSecure(CLIENT *c, RPC_USE_SECURE *sec); +bool CtGetUseSecure(CLIENT *c, RPC_USE_SECURE *sec); +bool CtEnumObjectInSecure(CLIENT *c, RPC_ENUM_OBJECT_IN_SECURE *e); +bool CtCreateVLan(CLIENT *c, RPC_CLIENT_CREATE_VLAN *create); +bool CtUpgradeVLan(CLIENT *c, RPC_CLIENT_CREATE_VLAN *create); +bool CtGetVLan(CLIENT *c, RPC_CLIENT_GET_VLAN *get); +bool CtSetVLan(CLIENT *c, RPC_CLIENT_SET_VLAN *set); +bool CtEnumVLan(CLIENT *c, RPC_CLIENT_ENUM_VLAN *e); +bool CtDeleteVLan(CLIENT *c, RPC_CLIENT_CREATE_VLAN *d); +bool CtEnableVLan(CLIENT *c, RPC_CLIENT_CREATE_VLAN *vlan); +bool CtDisableVLan(CLIENT *c, RPC_CLIENT_CREATE_VLAN *vlan); +bool CtCreateAccount(CLIENT *c, RPC_CLIENT_CREATE_ACCOUNT *a, bool inner); +bool CtEnumAccount(CLIENT *c, RPC_CLIENT_ENUM_ACCOUNT *e); +bool CtDeleteAccount(CLIENT *c, RPC_CLIENT_DELETE_ACCOUNT *a, bool inner); +bool CtSetAccount(CLIENT *c, RPC_CLIENT_CREATE_ACCOUNT *a, bool inner); +bool CtGetAccount(CLIENT *c, RPC_CLIENT_GET_ACCOUNT *a); +bool CtRenameAccount(CLIENT *c, RPC_RENAME_ACCOUNT *rename, bool inner); +bool CtSetClientConfig(CLIENT *c, CLIENT_CONFIG *o); +bool CtGetClientConfig(CLIENT *c, CLIENT_CONFIG *o); +bool CtConnect(CLIENT *c, RPC_CLIENT_CONNECT *connect); +bool CtDisconnect(CLIENT *c, RPC_CLIENT_CONNECT *connect, bool inner); +bool CtGetAccountStatus(CLIENT *c, RPC_CLIENT_GET_CONNECTION_STATUS *st); +bool CtSetStartupAccount(CLIENT *c, RPC_CLIENT_DELETE_ACCOUNT *a, bool inner); +bool CtRemoveStartupAccount(CLIENT *c, RPC_CLIENT_DELETE_ACCOUNT *a); +bool CtGetIssuer(CLIENT *c, RPC_GET_ISSUER *a); +bool CtGetCommonProxySetting(CLIENT *c, INTERNET_SETTING *a); +bool CtSetCommonProxySetting(CLIENT *c, INTERNET_SETTING *a); + + +// Internal function prototype +void CiSendGlobalPulse(CLIENT *c); +void CiPulseRecvThread(THREAD *thread, void *param); +void CiServerThread(THREAD *t, void *param); +void CiInitSaver(CLIENT *c); +void CiFreeSaver(CLIENT *c); +void CiGetSessionStatus(RPC_CLIENT_GET_CONNECTION_STATUS *st, SESSION *s); +PACK *CiRpcDispatch(RPC *rpc, char *name, PACK *p); +void CiRpcAccepted(CLIENT *c, SOCK *s); +void CiNotifyMain(CLIENT *c, SOCK *s); +void CiRpcAcceptThread(THREAD *thread, void *param); +void CiRpcServerThread(THREAD *thread, void *param); +void CiStartRpcServer(CLIENT *c); +void CiStopRpcServer(CLIENT *c); +CLIENT_OPTION *CiLoadClientOption(FOLDER *f); +CLIENT_AUTH *CiLoadClientAuth(FOLDER *f); +ACCOUNT *CiLoadClientAccount(FOLDER *f); +void CiLoadClientConfig(CLIENT_CONFIG *c, FOLDER *f); +void CiLoadAccountDatabase(CLIENT *c, FOLDER *f); +void CiLoadCAList(CLIENT *c, FOLDER *f); +void CiLoadCACert(CLIENT *c, FOLDER *f); +void CiLoadVLanList(CLIENT *c, FOLDER *f); +void CiLoadVLan(CLIENT *c, FOLDER *f); +bool CiReadSettingFromCfg(CLIENT *c, FOLDER *root); +void CiWriteAccountDatabase(CLIENT *c, FOLDER *f); +void CiWriteAccountData(FOLDER *f, ACCOUNT *a); +void CiWriteClientOption(FOLDER *f, CLIENT_OPTION *o); +void CiWriteClientAuth(FOLDER *f, CLIENT_AUTH *a); +void CiWriteClientConfig(FOLDER *cc, CLIENT_CONFIG *config); +void CiWriteSettingToCfg(CLIENT *c, FOLDER *root); +void CiWriteCAList(CLIENT *c, FOLDER *f); +void CiWriteCACert(CLIENT *c, FOLDER *f, X *x); +void CiWriteVLanList(CLIENT *c, FOLDER *f); +void CiWriteVLan(CLIENT *c, FOLDER *f, UNIX_VLAN *v); +void CiFreeClientGetConnectionStatus(RPC_CLIENT_GET_CONNECTION_STATUS *st); +bool CiCheckCertProc(SESSION *s, CONNECTION *c, X *server_x, bool *expired); +bool CiSecureSignProc(SESSION *s, CONNECTION *c, SECURE_SIGN *sign); +bool Win32CiSecureSign(SECURE_SIGN *sign); +void CiFreeClientAuth(CLIENT_AUTH *auth); +void CiFreeClientCreateAccount(RPC_CLIENT_CREATE_ACCOUNT *a); +void CiFreeClientGetAccount(RPC_CLIENT_GET_ACCOUNT *a); +void CiFreeClientEnumVLan(RPC_CLIENT_ENUM_VLAN *e); +void CiFreeClientEnumSecure(RPC_CLIENT_ENUM_SECURE *e); +void CiFreeClientEnumCa(RPC_CLIENT_ENUM_CA *e); +void CiFreeEnumObjectInSecure(RPC_ENUM_OBJECT_IN_SECURE *a); +void CiFreeGetCa(RPC_GET_CA *a); +void CiFreeGetIssuer(RPC_GET_ISSUER *a); +void CiFreeClientEnumAccount(RPC_CLIENT_ENUM_ACCOUNT *a); +void CiSetError(CLIENT *c, UINT err); +void CiCheckOs(); +CLIENT *CiNewClient(); +void CiCleanupClient(CLIENT *c); +bool CiLoadConfigurationFile(CLIENT *c); +void CiSaveConfigurationFile(CLIENT *c); +void CiInitConfiguration(CLIENT *c); +void CiSetVLanToDefault(CLIENT *c); +bool CiIsVLan(CLIENT *c, char *name); +void CiFreeConfiguration(CLIENT *c); +int CiCompareAccount(void *p1, void *p2); +void CiFreeAccount(ACCOUNT *a); +void CiNotify(CLIENT *c); +void CiNotifyInternal(CLIENT *c); +void CiClientStatusPrinter(SESSION *s, wchar_t *status); +void CiInitKeep(CLIENT *c); +void CiFreeKeep(CLIENT *c); +int CiCompareUnixVLan(void *p1, void *p2); +BUF *CiAccountToCfg(RPC_CLIENT_CREATE_ACCOUNT *t); +RPC_CLIENT_CREATE_ACCOUNT *CiCfgToAccount(BUF *b); +void CiChangeAllVLanMacAddressIfCleared(CLIENT *c); +void CiChangeAllVLanMacAddress(CLIENT *c); +void CiChangeAllVLanMacAddressIfMachineChanged(CLIENT *c); +bool CiReadLastMachineHash(void *data); +bool CiWriteLastMachineHash(void *data); +void CiGetCurrentMachineHash(void *data); +void CiGetCurrentMachineHashOld(void *data); +void CiGetCurrentMachineHashNew(void *data); +LIST *CiLoadIni(); +void CiFreeIni(LIST *o); +void CiLoadIniSettings(CLIENT *c); +bool CiLoadConfigFilePathFromIni(char *path, UINT size); +int CiCompareClientAccountEnumItemByLastConnectDateTime(void *p1, void *p2); +bool CiIsValidVLanRegulatedName(char *name); +void CiGenerateVLanRegulatedName(char *name, UINT size, UINT i); +bool CiGetNextRecommendedVLanName(REMOTE_CLIENT *r, char *name, UINT size); +void CiDisableWcmNetworkMinimize(CLIENT *c); +bool CiTryToParseAccount(BUF *b); +bool CiTryToParseAccountFile(wchar_t *name); +bool CiEraseSensitiveInAccount(BUF *b); +bool CiHasAccountSensitiveInformation(BUF *b); +void CiApplyInnerVPNServerConfig(CLIENT *c); +void CiIncrementNumActiveSessions(); +void CiDecrementNumActiveSessions(); + +BUF *EncryptPassword(char *password); +BUF *EncryptPassword2(char *password); +char *DecryptPassword(BUF *b); +char *DecryptPassword2(BUF *b); + +void InRpcGetIssuer(RPC_GET_ISSUER *c, PACK *p); +void OutRpcGetIssuer(PACK *p, RPC_GET_ISSUER *c); +void InRpcClientVersion(RPC_CLIENT_VERSION *ver, PACK *p); +void OutRpcClientVersion(PACK *p, RPC_CLIENT_VERSION *ver); +void InRpcClientPassword(RPC_CLIENT_PASSWORD *pw, PACK *p); +void OutRpcClientPassword(PACK *p, RPC_CLIENT_PASSWORD *pw); +void InRpcClientEnumCa(RPC_CLIENT_ENUM_CA *e, PACK *p); +void OutRpcClientEnumCa(PACK *p, RPC_CLIENT_ENUM_CA *e); +void InRpcCert(RPC_CERT *c, PACK *p); +void OutRpcCert(PACK *p, RPC_CERT *c); +void InRpcClientDeleteCa(RPC_CLIENT_DELETE_CA *c, PACK *p); +void OutRpcClientDeleteCa(PACK *p, RPC_CLIENT_DELETE_CA *c); +void InRpcGetCa(RPC_GET_CA *c, PACK *p); +void OutRpcGetCa(PACK *p, RPC_GET_CA *c); +void InRpcClientEnumSecure(RPC_CLIENT_ENUM_SECURE *e, PACK *p); +void OutRpcClientEnumSecure(PACK *p, RPC_CLIENT_ENUM_SECURE *e); +void InRpcUseSecure(RPC_USE_SECURE *u, PACK *p); +void OutRpcUseSecure(PACK *p, RPC_USE_SECURE *u); +void OutRpcEnumObjectInSecure(PACK *p, RPC_ENUM_OBJECT_IN_SECURE *e); +void InRpcCreateVLan(RPC_CLIENT_CREATE_VLAN *v, PACK *p); +void OutRpcCreateVLan(PACK *p, RPC_CLIENT_CREATE_VLAN *v); +void InRpcClientGetVLan(RPC_CLIENT_GET_VLAN *v, PACK *p); +void OutRpcClientGetVLan(PACK *p, RPC_CLIENT_GET_VLAN *v); +void InRpcClientSetVLan(RPC_CLIENT_SET_VLAN *v, PACK *p); +void OutRpcClientSetVLan(PACK *p, RPC_CLIENT_SET_VLAN *v); +void InRpcClientEnumVLan(RPC_CLIENT_ENUM_VLAN *v, PACK *p); +void OutRpcClientEnumVLan(PACK *p, RPC_CLIENT_ENUM_VLAN *v); +void InRpcClientOption(CLIENT_OPTION *c, PACK *p); +void OutRpcClientOption(PACK *p, CLIENT_OPTION *c); +void InRpcClientAuth(CLIENT_AUTH *c, PACK *p); +void OutRpcClientAuth(PACK *p, CLIENT_AUTH *c); +void InRpcClientCreateAccount(RPC_CLIENT_CREATE_ACCOUNT *c, PACK *p); +void OutRpcClientCreateAccount(PACK *p, RPC_CLIENT_CREATE_ACCOUNT *c); +void InRpcClientEnumAccount(RPC_CLIENT_ENUM_ACCOUNT *e, PACK *p); +void OutRpcClientEnumAccount(PACK *p, RPC_CLIENT_ENUM_ACCOUNT *e); +void InRpcClientDeleteAccount(RPC_CLIENT_DELETE_ACCOUNT *a, PACK *p); +void OutRpcClientDeleteAccount(PACK *p, RPC_CLIENT_DELETE_ACCOUNT *a); +void InRpcRenameAccount(RPC_RENAME_ACCOUNT *a, PACK *p); +void OutRpcRenameAccount(PACK *p, RPC_RENAME_ACCOUNT *a); +void InRpcClientGetAccount(RPC_CLIENT_GET_ACCOUNT *c, PACK *p); +void OutRpcClientGetAccount(PACK *p, RPC_CLIENT_GET_ACCOUNT *c); +void InRpcClientConnect(RPC_CLIENT_CONNECT *c, PACK *p); +void OutRpcClientConnect(PACK *p, RPC_CLIENT_CONNECT *c); +void InRpcPolicy(POLICY *o, PACK *p); +void OutRpcPolicy(PACK *p, POLICY *o); +void InRpcClientGetConnectionStatus(RPC_CLIENT_GET_CONNECTION_STATUS *s, PACK *p); +void OutRpcClientGetConnectionStatus(PACK *p, RPC_CLIENT_GET_CONNECTION_STATUS *c); +void InRpcClientConfig(CLIENT_CONFIG *c, PACK *p); +void OutRpcClientConfig(PACK *p, CLIENT_CONFIG *c); +void InRpcClientPasswordSetting(RPC_CLIENT_PASSWORD_SETTING *a, PACK *p); +void OutRpcClientPasswordSetting(PACK *p, RPC_CLIENT_PASSWORD_SETTING *a); +void InRpcTraffic(TRAFFIC *t, PACK *p); +void OutRpcTraffic(PACK *p, TRAFFIC *t); +void InRpcTrafficEx(TRAFFIC *t, PACK *p, UINT i); +void OutRpcTrafficEx(TRAFFIC *t, PACK *p, UINT i, UINT num); +void OutRpcCmSetting(PACK *p, CM_SETTING *c); +void InRpcCmSetting(CM_SETTING *c, PACK *p); + + +#ifdef OS_WIN32 +void CiInitDriverVerStruct(MS_DRIVER_VER *ver); +#endif // OS_EIN32 + +#endif // CLIENT_H + + diff --git a/src/Cedar/Command.c b/src/Cedar/Command.c index c11455cc..4e83c556 100644 --- a/src/Cedar/Command.c +++ b/src/Cedar/Command.c @@ -1,24570 +1,24570 @@ -// SoftEther VPN Source Code - Developer Edition Master Branch -// Cedar Communication Module -// © 2020 Nokia - -// Command.c -// vpncmd Command Line Management Utility - -#include "CedarPch.h" - -// System checker definition -typedef bool (CHECKER_PROC_DEF)(); -typedef struct CHECKER_PROC -{ - char *Title; - CHECKER_PROC_DEF *Proc; -} CHECKER_PROC; - -static CHECKER_PROC checker_procs[] = -{ - {"CHECK_PROC_KERNEL", CheckKernel}, - {"CHECK_PROC_MEMORY", CheckMemory}, - {"CHECK_PROC_STRINGS", CheckStrings}, - {"CHECK_PROC_FILESYSTEM", CheckFileSystem}, - {"CHECK_PROC_THREAD", CheckThread}, - {"CHECK_PROC_NETWORK", CheckNetwork}, -}; - -typedef struct CHECK_NETWORK_1 -{ - SOCK *ListenSocket; -} CHECK_NETWORK_1; - -typedef struct CHECK_NETWORK_2 -{ - SOCK *s; - X *x; - K *k; -} CHECK_NETWORK_2; - - -// Accept thread -void CheckNetworkAcceptThread(THREAD *thread, void *param) -{ - CHECK_NETWORK_2 *c = (CHECK_NETWORK_2 *)param; - SOCK *s = c->s; - UINT i = 0; - - if (StartSSL(s, c->x, c->k)) - { - while (true) - { - i++; - if (Send(s, &i, sizeof(UINT), true) == 0) - { - break; - } - } - } - - Disconnect(s); - ReleaseSock(s); -} - - -// Listen thread -void CheckNetworkListenThread(THREAD *thread, void *param) -{ - CHECK_NETWORK_1 *c = (CHECK_NETWORK_1 *)param; - SOCK *s; - UINT i, rsa_bits = 1024; - K *pub, *pri; - X *x; - LIST *o = NewList(NULL); - NAME *name = NewName(L"Test", L"Test", L"Test", L"JP", L"Ibaraki", L"Tsukuba"); - - // Set RSA bits considering OpenSSL security Level - // Security level 4 needs 7680 bits - switch (GetOSSecurityLevel()) - { - case 2: - rsa_bits = 2048; - break; - case 3: - rsa_bits = 4096; - break; - default: - break; - } - RsaGen(&pri, &pub, rsa_bits); - x = NewRootX(pub, pri, name, 1000, NULL); - - FreeName(name); - - for (i = 1025;;i++) - { - s = Listen(i); - if (s != NULL) - { - break; - } - } - - c->ListenSocket = s; - AddRef(s->ref); - - NoticeThreadInit(thread); - - while (true) - { - SOCK *new_sock = Accept(s); - - if (new_sock == NULL) - { - break; - } - else - { - CHECK_NETWORK_2 c; - THREAD *t; - - Zero(&c, sizeof(c)); - c.s = new_sock; - c.k = pri; - c.x = x; - - t = NewThread(CheckNetworkAcceptThread, &c); - Insert(o, t); - } - } - - for (i = 0;i < LIST_NUM(o);i++) - { - THREAD *t = LIST_DATA(o, i); - WaitThread(t, INFINITE); - ReleaseThread(t); - } - - FreeK(pri); - FreeK(pub); - - FreeX(x); - - ReleaseSock(s); - ReleaseList(o); -} - -// Network function check -bool CheckNetwork() -{ - CHECK_NETWORK_1 c; - THREAD *t; - SOCK *listen_socket; - UINT port; - UINT i, num; - bool ok = true; - SOCK **socks; - SOCK_EVENT *se = NewSockEvent(); - - Zero(&c, sizeof(c)); - t = NewThread(CheckNetworkListenThread, &c); - WaitThreadInit(t); - - listen_socket = c.ListenSocket; - - port = listen_socket->LocalPort; - - num = 8; - socks = ZeroMalloc(sizeof(SOCK *) * num); - for (i = 0;i < num;i++) - { - socks[i] = Connect("localhost", port); - if (socks[i] == NULL) - { - Print("Connect Failed. (%u)\n", i); - ok = false; - num = i; - break; - } - if (StartSSL(socks[i], NULL, NULL) == false) - { - ReleaseSock(socks[i]); - Print("Connect Failed. (%u)\n", i); - ok = false; - num = i; - break; - } - - JoinSockToSockEvent(socks[i], se); - } - - if (ok) - { - while (true) - { - UINT i; - bool end = false; - bool all_blocked = true; - - for (i = 0;i < num;i++) - { - UINT n; - UINT ret; - - n = 0; - ret = Recv(socks[i], &n, sizeof(UINT), true); - if (ret == 0) - { - Print("Recv Failed (Disconnected).\n", ret); - end = true; - ok = false; - } - if (ret != SOCK_LATER) - { - all_blocked = false; - } - - if (n >= 128) - { - end = true; - } - } - - if (end) - { - break; - } - - if (all_blocked) - { - WaitSockEvent(se, INFINITE); - } - } - } - - for (i = 0;i < num;i++) - { - Disconnect(socks[i]); - ReleaseSock(socks[i]); - } - Free(socks); - - Disconnect(listen_socket); - - WaitThread(t, INFINITE); - ReleaseThread(t); - - ReleaseSock(listen_socket); - - ReleaseSockEvent(se); - - return ok; -} - -typedef struct CHECK_THREAD_1 -{ - UINT num; - LOCK *lock; - THREAD *wait_thread; -} CHECK_THREAD_1; - -static UINT check_thread_global_1 = 0; - -#define CHECK_THREAD_INCREMENT_COUNT 32 - -// Test thread 1 -void CheckThread1(THREAD *thread, void *param) -{ - CHECK_THREAD_1 *ct1 = (CHECK_THREAD_1 *)param; - UINT i; - UINT num = CHECK_THREAD_INCREMENT_COUNT; - - WaitThread(ct1->wait_thread, INFINITE); - - for (i = 0;i < num;i++) - { - Lock(ct1->lock); - check_thread_global_1 = ct1->num; - InputToNull((void *)check_thread_global_1); - check_thread_global_1 = check_thread_global_1 + 1 + RetZero(); - ct1->num = check_thread_global_1; - Unlock(ct1->lock); - } -} - -// Test thread 2 -void CheckThread2(THREAD *thread, void *param) -{ - EVENT *e = (EVENT *)param; - Wait(e, INFINITE); -} - -typedef struct CHECK_THREAD_3 -{ - UINT num, a; -} CHECK_THREAD_3; - -// Test thread 3 -void CheckThread3(THREAD *thread, void *param) -{ - CHECK_THREAD_3 *c = (CHECK_THREAD_3 *)param; - THREAD *t; - - if (c->num == 0) - { - return; - } - c->num--; - c->a++; - - t = NewThread(CheckThread3, c); - WaitThread(t, INFINITE); - ReleaseThread(t); -} - -// Thread check -bool CheckThread() -{ - bool ok = true; - CHECK_THREAD_1 ct1; - UINT num = 32; - UINT i; - THREAD **threads; - EVENT *e; - THREAD *t2; - THREAD *t; - CHECK_THREAD_3 c; - - e = NewEvent(); - - Zero(&ct1, sizeof(ct1)); - ct1.lock = NewLock(); - - t2 = NewThread(CheckThread2, e); - ct1.wait_thread = t2; - - threads = ZeroMalloc(sizeof(THREAD *) * num); - for (i = 0;i < num;i++) - { - threads[i] = NewThread(CheckThread1, &ct1); - if (threads[i] == NULL) - { - Print("Thread %u Create Failed.\n", i); - ok = false; - } - } - - Set(e); - - for (i = 0;i < num;i++) - { - WaitThread(threads[i], INFINITE); - ReleaseThread(threads[i]); - } - - Free(threads); - - if (ct1.num != (num * CHECK_THREAD_INCREMENT_COUNT)) - { - Print("Threading: %u != %u\n", ct1.num, num * CHECK_THREAD_INCREMENT_COUNT); - ok = false; - } - - DeleteLock(ct1.lock); - - WaitThread(t2, INFINITE); - ReleaseThread(t2); - - ReleaseEvent(e); - - num = 32; - - Zero(&c, sizeof(c)); - c.num = num; - t = NewThread(CheckThread3, &c); - WaitThread(t, INFINITE); - ReleaseThread(t); - - if (c.a != num) - { - Print("Threading: %u != %u\n", c.a, num); - ok = false; - } - - return ok; -} - -// File system check -bool CheckFileSystem() -{ - bool ok = false; - char exe[MAX_PATH]; - char exe_dir[MAX_PATH]; - DIRLIST *dirs; - UINT i; - - GetExeName(exe, sizeof(exe)); - GetExeDir(exe_dir, sizeof(exe_dir)); - - dirs = EnumDir(exe_dir); - for (i = 0;i < dirs->NumFiles;i++) - { - if (EndWith(exe, dirs->File[i]->FileName)) - { - ok = true; - break; - } - } - FreeDir(dirs); - - if (ok == false) - { - Print("EnumDir Failed.\n"); - return false; - } - else - { - UINT size = 1234567; - UCHAR *buf; - IO *io; -#ifndef OS_WIN32 - wchar_t *filename = L"/tmp/vpn_checker_tmp"; -#else // OS_WIN32 - wchar_t filename[MAX_PATH]; - CombinePathW(filename, sizeof(filename), MsGetMyTempDirW(), L"vpn_checker_tmp"); -#endif // OS_WIN32 - - buf = Malloc(size); - for (i = 0;i < size;i++) - { - buf[i] = i % 256; - } - - io = FileCreateW(filename); - if (io == NULL) - { - Print("FileCreate Failed.\n"); - Free(buf); - return false; - } - else - { - FileWrite(io, buf, size); - Free(buf); - FileClose(io); - - io = FileOpenW(filename, false); - if (FileSize(io) != 1234567) - { - Print("FileSize Failed.\n"); - FileClose(io); - return false; - } - else - { - BUF *b; - - FileClose(io); - b = ReadDumpW(filename); - if(b == NULL) - { - return false; - } - - for (i = 0;i < b->Size;i++) - { - UCHAR c = ((UCHAR *)b->Buf)[i]; - - if (c != (i % 256)) - { - Print("FileToBuf Failed.\n"); - FreeBuf(b); - return false; - } - } - - FreeBuf(b); - } - } - - FileDeleteW(filename); - } - - return ok; -} - -// String check -bool CheckStrings() -{ - wchar_t *numstr = _UU("CHECK_TEST_123456789"); - char tmp[MAX_SIZE]; - wchar_t tmp2[MAX_SIZE]; - UINT i; - UINT sum, sum2; - UNI_TOKEN_LIST *t; - - UniStrCpy(tmp2, sizeof(tmp2), L""); - - sum2 = 0; - for (i = 0;i < 64;i++) - { - sum2 += i; - UniFormat(tmp2, sizeof(tmp2), L"%s,%u", tmp2, i); - } - - t = UniParseToken(tmp2, L","); - - sum = 0; - - for (i = 0;i < t->NumTokens;i++) - { - wchar_t *s = t->Token[i]; - UINT n = UniToInt(s); - - sum += n; - } - - UniFreeToken(t); - - if (sum != sum2) - { - Print("UniParseToken Failed.\n"); - return false; - } - - if (UniToInt(numstr) != 123456789) - { - Print("UniToInt Failed.\n"); - return false; - } - - UniToStr(tmp, sizeof(tmp), numstr); - if (ToInt(tmp) != 123456789) - { - Print("UniToStr Failed.\n"); - return false; - } - - return true; -} - -// Memory check -bool CheckMemory() -{ - UINT i, num, size, j; - void **pp; - bool ok = true; - UINT old_size; - - num = 2000; - size = 1000; - pp = ZeroMalloc(sizeof(void *) * num); - for (i = 0;i < num;i++) - { - pp[i] = ZeroMalloc(size); - InputToNull(pp[i]); - for (j = 0;j < size;j++) - { - ((UCHAR *)pp[i])[j] = j % 256; - } - } - old_size = size; - size = size * 3; - for (i = 0;i < num;i++) - { - pp[i] = ReAlloc(pp[i], size); - for (j = old_size;j < size;j++) - { - InputToNull((void *)(UINT)(((UCHAR *)pp[i])[j] = j % 256)); - } - } - for (i = 0;i < num;i++) - { - for (j = 0;j < size;j++) - { - if (((UCHAR *)pp[i])[j] != (j % 256)) - { - ok = false; - } - } - Free(pp[i]); - } - Free(pp); - - return ok; -} - -// Function that do not do anything -void InputToNull(void *p) -{ - if (RetZero() == 1) - { - UCHAR *c = (UCHAR *)p; - c[0] = 0x32; - } -} - -// Function that returns 0 -UINT RetZero() -{ - if (g_debug == 0x123455) - { - return 1; - } - else - { - return 0; - } -} - - -// Kernel check -bool CheckKernel() -{ - UINT num = 10, i; - UINT64 s = Tick64(); - UINT64 t = Tick64(); - - for (i = 0;i < num;i++) - { - UINT64 q = Tick64(); - if (t > q) - { - Print("Tick64 #1 Failed.\n"); - return false; - } - - t = q; - - SleepThread(100); - } - - t = (Tick64() - s); - if (t <= 500 || t >= 2000) - { - Print("Tick64 #2 Failed.\n"); - return false; - } - else if (false) - { - UINT64 tick1 = Tick64(); - UINT64 time1; - UINT64 time2; - - SleepThread(1000); - - time2 = LocalTime64(); - time1 = SystemToLocal64(TickToTime(tick1)); - - if (time2 > time1) - { - s = time2 - time1; - } - else - { - s = time1 - time2; - } - - if (s <= 500 || s >= 2000) - { - Print("TickToTime Failed.\n"); - return false; - } - } - -#ifdef OS_UNIX - { - // Test of child process - UINT pid; - char exe[MAX_SIZE]; - - GetExeName(exe, sizeof(exe)); - - pid = fork(); - - if (pid == -1) - { - Print("fork Failed.\n"); - return false; - } - - if (pid == 0) - { - char *param = UNIX_ARG_EXIT; - char **args; - - args = ZeroMalloc(sizeof(char *) * 3); - args[0] = exe; - args[1] = param; - args[2] = NULL; - - setsid(); - - // Close the standard I/O - UnixCloseIO(); - - // Stop unwanted signals - signal(SIGHUP, SIG_IGN); - - execvp(exe, args); - AbortExit(); - } - else - { - int status = 0, ret; - - // Wait for the termination of the child process - ret = waitpid(pid, &status, 0); - - if (WIFEXITED(status) == 0) - { - // Aborted - Print("waitpid Failed: 0x%x\n", ret); - return false; - } - } - } -#endif // OS_UNIX - - return true; -} - -// System checker -bool SystemCheck() -{ - UINT i; - bool ng = false; - - UniPrint(_UU("CHECK_TITLE")); - UniPrint(_UU("CHECK_NOTE")); - for (i = 0;i < sizeof(checker_procs) / sizeof(checker_procs[0]);i++) - { - wchar_t *title; - bool ret = false; - CHECKER_PROC *p = &checker_procs[i]; - - title = _UU(p->Title); - - UniPrint(_UU("CHECK_EXEC_TAG"), title); - - ret = p->Proc(); - - if (ret == false) - { - ng = true; - } - - UniPrint(L" %s\n", ret ? _UU("CHECK_PASS") : _UU("CHECK_FAIL")); - } - - UniPrint(L"\n"); - if (ng == false) - { - UniPrint(L"%s\n\n", _UU("CHECK_RESULT_1")); - } - else - { - UniPrint(L"%s\n\n", _UU("CHECK_RESULT_2")); - } - - return true; -} - - -// Behavior checker -UINT PtCheck(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) -{ - LIST *o; - UINT ret = ERR_NO_ERROR; - // Get the parameter list - o = ParseCommandList(c, cmd_name, str, NULL, 0); - if (o == NULL) - { - return ERR_INVALID_PARAMETER; - } - - if (SystemCheck() == false) - { - ret = ERR_INTERNAL_ERROR; - } - - FreeParamValueList(o); - - return ret; -} - -// VPN Tools main function -void PtMain(PT *pt) -{ - char prompt[MAX_SIZE]; - wchar_t tmp[MAX_SIZE]; - // Validate arguments - if (pt == NULL) - { - return; - } - - // Display a message that start-up is complete - UniFormat(tmp, sizeof(tmp), _UU("CMD_VPNCMD_TOOLS_CONNECTED")); - pt->Console->Write(pt->Console, tmp); - pt->Console->Write(pt->Console, L""); - - while (true) - { - // Definition of command - CMD cmd[] = - { - {"About", PsAbout}, - {"MakeCert", PtMakeCert}, - {"MakeCert2048", PtMakeCert2048}, - {"TrafficClient", PtTrafficClient}, - {"TrafficServer", PtTrafficServer}, - {"Check", PtCheck}, - }; - - // Generate a prompt - StrCpy(prompt, sizeof(prompt), "VPN Tools>"); - - if (DispatchNextCmdEx(pt->Console, pt->CmdLine, prompt, cmd, sizeof(cmd) / sizeof(cmd[0]), pt) == false) - { - break; - } - pt->LastError = pt->Console->RetCode; - - if (pt->LastError == ERR_NO_ERROR && pt->Console->ConsoleType != CONSOLE_CSV) - { - pt->Console->Write(pt->Console, _UU("CMD_MSG_OK")); - pt->Console->Write(pt->Console, L""); - } - - if (pt->CmdLine != NULL) - { - break; - } - } -} - -// Create a VPN Tools context -PT *NewPt(CONSOLE *c, wchar_t *cmdline) -{ - PT *pt; - // Validate arguments - if (c == NULL) - { - return NULL; - } - - if (UniIsEmptyStr(cmdline)) - { - cmdline = NULL; - } - - pt = ZeroMalloc(sizeof(PT)); - pt->Console = c; - pt->CmdLine = CopyUniStr(cmdline); - - return pt; -} - -// Release the VPN Tools context -void FreePt(PT *pt) -{ - // Validate arguments - if (pt == NULL) - { - return; - } - - Free(pt->CmdLine); - Free(pt); -} - -// Start VPN Tools -UINT PtConnect(CONSOLE *c, wchar_t *cmdline) -{ - PT *pt; - UINT ret = 0; - // Validate arguments - if (c == NULL) - { - return ERR_INTERNAL_ERROR; - } - - pt = NewPt(c, cmdline); - - PtMain(pt); - - ret = pt->LastError; - - FreePt(pt); - - return ret; -} - -// Initialize the execution path information of vpncmd command -void VpnCmdInitBootPath() -{ -#ifdef OS_WIN32 - char exe_path[MAX_PATH]; - char tmp[MAX_PATH]; - GetExeName(exe_path, sizeof(exe_path)); - - if (SearchStrEx(exe_path, "ham.exe", 0, false) != INFINITE) - { - return; - } - - if (MsIsAdmin()) - { - UINT current_ver; - - // Get the version of vpncmd that is currently installed - current_ver = MsRegReadInt(REG_LOCAL_MACHINE, VPNCMD_BOOTSTRAP_REG_KEYNAME, VPNCMD_BOOTSTRAP_REG_VALUENAME_VER); - - if ((CEDAR_VERSION_BUILD >= current_ver) || - MsRegIsValue(REG_LOCAL_MACHINE, VPNCMD_BOOTSTRAP_REG_KEYNAME, VPNCMD_BOOTSTRAP_REG_VALUENAME_PATH) == false) - { - bool b = false; - // Copy the vpncmdsys.exe to system32 - if (MsIsNt()) - { - Format(tmp, sizeof(tmp), "%s\\vpncmd.exe", MsGetSystem32Dir()); - } - else - { - Format(tmp, sizeof(tmp), "%s\\vpncmd.exe", MsGetWindowsDir()); - } - - if (MsIs64BitWindows() == false || Is64()) - { - if (IsFile(tmp) == false || (CEDAR_VERSION_BUILD > current_ver) || MsRegIsValue(REG_LOCAL_MACHINE, VPNCMD_BOOTSTRAP_REG_KEYNAME, VPNCMD_BOOTSTRAP_REG_VALUENAME_PATH) == false) - { - b = FileCopy(VPNCMD_BOOTSTRAP_FILENAME, tmp); - } - } - else - { - void *wow = MsDisableWow64FileSystemRedirection(); - - if (IsFile(tmp) == false || (CEDAR_VERSION_BUILD > current_ver) || MsRegIsValue(REG_LOCAL_MACHINE, VPNCMD_BOOTSTRAP_REG_KEYNAME, VPNCMD_BOOTSTRAP_REG_VALUENAME_PATH) == false) - { - b = FileCopy(VPNCMD_BOOTSTRAP_FILENAME, tmp); - } - - MsRestoreWow64FileSystemRedirection(wow); - - if (IsFile(tmp) == false || (CEDAR_VERSION_BUILD > current_ver) || MsRegIsValue(REG_LOCAL_MACHINE, VPNCMD_BOOTSTRAP_REG_KEYNAME, VPNCMD_BOOTSTRAP_REG_VALUENAME_PATH) == false) - { - b = FileCopy(VPNCMD_BOOTSTRAP_FILENAME, tmp); - } - } - - // Because the currently running prompt is newer version, overwrite the registry - if (MsIs64BitWindows() == false) - { - MsRegWriteStr(REG_LOCAL_MACHINE, VPNCMD_BOOTSTRAP_REG_KEYNAME, VPNCMD_BOOTSTRAP_REG_VALUENAME_PATH, exe_path); - MsRegWriteInt(REG_LOCAL_MACHINE, VPNCMD_BOOTSTRAP_REG_KEYNAME, VPNCMD_BOOTSTRAP_REG_VALUENAME_VER, CEDAR_VERSION_BUILD); - } - else - { - MsRegWriteStrEx2(REG_LOCAL_MACHINE, VPNCMD_BOOTSTRAP_REG_KEYNAME, VPNCMD_BOOTSTRAP_REG_VALUENAME_PATH, exe_path, true, false); - MsRegWriteIntEx2(REG_LOCAL_MACHINE, VPNCMD_BOOTSTRAP_REG_KEYNAME, VPNCMD_BOOTSTRAP_REG_VALUENAME_VER, CEDAR_VERSION_BUILD, true, false); - - MsRegWriteStrEx2(REG_LOCAL_MACHINE, VPNCMD_BOOTSTRAP_REG_KEYNAME, VPNCMD_BOOTSTRAP_REG_VALUENAME_PATH, exe_path, false, true); - MsRegWriteIntEx2(REG_LOCAL_MACHINE, VPNCMD_BOOTSTRAP_REG_KEYNAME, VPNCMD_BOOTSTRAP_REG_VALUENAME_VER, CEDAR_VERSION_BUILD, false, true); - } - } - } -#endif // OS_WIN32 -} - -// Show the string -void TtPrint(void *param, TT_PRINT_PROC *print_proc, wchar_t *str) -{ - // Validate arguments - if (print_proc == NULL || str == NULL) - { - return; - } - - print_proc(param, str); -} - -// Generate new random data -void TtGenerateRandomData(UCHAR **buf, UINT *size) -{ - UCHAR *tmp; - UINT sz; - UINT i; - // Validate arguments - if (buf == NULL || size == NULL) - { - return; - } - - sz = TRAFFIC_BUF_SIZE; - tmp = Malloc(sz); - for (i = 0;i < sz;i++) - { - tmp[i] = rand() % 256; - - if (tmp[i] == '!') - { - tmp[i] = '_'; - } - } - - *buf = tmp; - *size = sz; -} - -// Communication throughput measurement server worker thread -void TtsWorkerThread(THREAD *thread, void *param) -{ - TTS *tts; - TTS_WORKER *w; - UINT buf_size; - UCHAR *send_buf_data, *recv_buf_data; - bool all_sockets_blocked = false; - UINT64 tmp64; - LIST *o; - UINT i; - wchar_t tmp[MAX_SIZE]; - bool dont_block_next_time = false; - char *ver_str = TRAFFIC_VER_STR; - // Validate arguments - if (thread == NULL || param == NULL) - { - return; - } - - // Allocate the data area - TtGenerateRandomData(&send_buf_data, &buf_size); - TtGenerateRandomData(&recv_buf_data, &buf_size); - - w = (TTS_WORKER *)param; - tts = (TTS *)w->Tts; - - // Preparation of socket events - w->SockEvent = NewSockEvent(); - AddRef(w->SockEvent->ref); - - // Preparing the Server socket list - w->TtsSockList = NewList(NULL); - - // Notify completion of preparation to parent thread - NoticeThreadInit(thread); - - o = NewList(NULL); - - while (tts->Halt == false) - { - UINT64 now = Tick64(); - - // Wait for all sockets - if (dont_block_next_time == false) - { - WaitSockEvent(w->SockEvent, 50); - } - dont_block_next_time = false; - - // Process for sockets that are currently registered - LockList(w->TtsSockList); - { - UINT i; - - all_sockets_blocked = false; - - // Continue to send and receive data - // until all sockets become block state - while (all_sockets_blocked == false) - { - all_sockets_blocked = true; - - for (i = 0;i < LIST_NUM(w->TtsSockList);i++) - { - UINT ret = SOCK_LATER; - UCHAR *send_data = NULL, *recv_data = NULL; - UINT send_size = 0, recv_size = 0; - TTS_SOCK *ts = LIST_DATA(w->TtsSockList, i); - bool blocked_for_this_socket = false; - - if (ts->SockJoined == false) - { - JoinSockToSockEvent(ts->Sock, w->SockEvent); - ts->SockJoined = true; - } - - switch (ts->State) - { - case 0: - // Return the version string - ret = Send(ts->Sock, ver_str, TRAFFIC_VER_STR_SIZE, false); - if (ret != 0 && ret != SOCK_LATER) - { - ts->State = 5; - ts->LastCommTime = now; - } - break; - - case 5: - // Receive the direction from the client - ret = Recv(ts->Sock, recv_buf_data, buf_size, false); - if (ret != 0 && ret != SOCK_LATER) - { - UCHAR c; - - ts->LastCommTime = now; - - // Direction of the data is in the first byte that is received - c = recv_buf_data[0]; - - if (c == 0) - { - // In the case of 0, Client -> Server - ts->State = 1; - } - else - { - // Otherwise Server -> Client - ts->State = 2; - } - - if (ret >= (sizeof(UINT64) + sizeof(UINT64) + 1)) - { - // Session ID - ts->SessionId = READ_UINT64(recv_buf_data + 1); - - // Span - ts->Span = READ_UINT64(recv_buf_data + sizeof(UINT64) + 1); - - ts->GiveupSpan = ts->Span * 3ULL + 180000ULL; - } - } - break; - - case 1: - // Client -> Server - ret = Recv(ts->Sock, recv_buf_data, buf_size, false); - - if (ret != 0 && ret != SOCK_LATER) - { - // Checking the first byte of received - UCHAR c = recv_buf_data[0]; - - ts->LastCommTime = now; - - if (ts->FirstRecvTick == 0) - { - // Record the time at which the data has been received for the first - ts->FirstRecvTick = now; - } - else - { - // Check whether the span didn't finish yet - if (ts->FirstRecvTick <= now) - { - if (ts->Span != 0) - { - UINT64 giveup_tick = ts->FirstRecvTick + ts->Span; - - if (now > giveup_tick) - { - // Span has expired - c = '!'; - } - } - } - } - - if (c == '!') - { - // Notice the size information from the server to the client - ts->State = 3; - Debug("!"); - } - } - break; - - case 2: - // Server -> Client - if (ts->NoMoreSendData == false) - { - ret = Send(ts->Sock, send_buf_data, buf_size, false); - - if (ret != 0 && ret != SOCK_LATER) - { - ts->LastCommTime = now; - } - } - else - { - ret = Recv(ts->Sock, recv_buf_data, buf_size, false); - - if (ret != 0 && ret != SOCK_LATER) - { - ts->LastCommTime = now; - } - } - - if (ts->FirstSendTick == 0) - { - ts->FirstSendTick = now; - } - else - { - if (ts->FirstSendTick <= now) - { - if (ts->Span != 0) - { - UINT64 giveup_tick = ts->FirstSendTick + ts->Span * 3ULL + 180000ULL; - - if (now > giveup_tick) - { - ret = 0; - } - } - } - } - - break; - - case 3: - // Notice the size information from the server to the client - tmp64 = Endian64(ts->NumBytes); - - (void)Recv(ts->Sock, recv_buf_data, buf_size, false); - - if (ts->LastWaitTick == 0 || ts->LastWaitTick <= Tick64()) - { - ret = Send(ts->Sock, &tmp64, sizeof(tmp64), false); - - if (ret != 0 && ret != SOCK_LATER) - { - ts->LastCommTime = now; - } - - if (ret != SOCK_LATER) - { - UINT j; - - ts->LastWaitTick = Tick64() + 100; - - if (ts->SessionId != 0) - { - // Not to send more data to the socket of the - // transmission direction in the same session ID - for (j = 0;j < LIST_NUM(w->TtsSockList);j++) - { - TTS_SOCK *ts2 = LIST_DATA(w->TtsSockList, j); - - if (ts2->SessionId == ts->SessionId && - ts2 != ts) - { - ts2->NoMoreSendData = true; - } - } - } - } - } - break; - } - - if (now > (ts->LastCommTime + ts->GiveupSpan)) - { - // Timeout: disconnect orphan sessions - ret = 0; - } - - if (ret == 0) - { - // Mark as deleting the socket because it is disconnected - Insert(o, ts); - } - else if (ret == SOCK_LATER) - { - // Delay has occurred - blocked_for_this_socket = true; - dont_block_next_time = false; - } - else - { - if (ts->State == 1) - { - ts->NumBytes += (UINT64)ret; - } - } - - if (blocked_for_this_socket == false) - { - all_sockets_blocked = false; - } - } - - if (LIST_NUM(o) != 0) - { - UINT i; - // One or more sockets is disconnected - for (i = 0;i < LIST_NUM(o);i++) - { - TTS_SOCK *ts = LIST_DATA(o, i); - - UniFormat(tmp, sizeof(tmp), _UU("TTS_DISCONNECTED"), ts->Id, ts->Sock->RemoteHostname); - TtPrint(tts->Param, tts->Print, tmp); - - Disconnect(ts->Sock); - ReleaseSock(ts->Sock); - - Delete(w->TtsSockList, ts); - - Free(ts); - } - - DeleteAll(o); - } - - if (w->NewSocketArrived || tts->Halt) - { - w->NewSocketArrived = false; - all_sockets_blocked = true; - dont_block_next_time = true; - } - } - } - UnlockList(w->TtsSockList); - } - - LockList(w->TtsSockList); - { - // Release the sockets of all remaining - for (i = 0;i < LIST_NUM(w->TtsSockList);i++) - { - TTS_SOCK *ts = LIST_DATA(w->TtsSockList, i); - - UniFormat(tmp, sizeof(tmp), _UU("TTS_DISCONNECT"), ts->Id, ts->Sock->RemoteHostname); - TtPrint(tts->Param, tts->Print, tmp); - - Disconnect(ts->Sock); - ReleaseSock(ts->Sock); - - Free(ts); - } - } - UnlockList(w->TtsSockList); - - // Cleanup - ReleaseList(o); - ReleaseList(w->TtsSockList); - ReleaseSockEvent(w->SockEvent); - Free(send_buf_data); - Free(recv_buf_data); -} - -// Accept thread for IPv6 -void TtsIPv6AcceptThread(THREAD *thread, void *param) -{ - TTS *tts = (TTS *)param; - // Validate arguments - if (tts == NULL || param == NULL) - { - return; - } - - TtsAcceptProc(tts, tts->ListenSocketV6); -} - -// Accept procedure -void TtsAcceptProc(TTS *tts, SOCK *listen_socket) -{ - wchar_t tmp[MAX_SIZE]; - UINT seed = 0; - // Validate arguments - if (tts == NULL || listen_socket == NULL) - { - return; - } - - while (tts->Halt == false) - { - SOCK *s; - // Accept - s = Accept(listen_socket); - - if (s == NULL) - { - if (tts->Halt == false) - { - SleepThread(10); - } - continue; - } - else - { - UINT num, i; - TTS_WORKER *w; - - // Connected from the client - AcceptInitEx(s, true); - - // Choose a worker thread - num = LIST_NUM(tts->WorkerList); - - i = seed % num; - - seed++; - - w = LIST_DATA(tts->WorkerList, i); - - w->NewSocketArrived = true; - LockList(w->TtsSockList); - { - TTS_SOCK *ts = ZeroMalloc(sizeof(TTS_SOCK)); - - ts->Id = (++tts->IdSeed); - ts->Sock = s; - - ts->GiveupSpan = (UINT64)(10 * 60 * 1000); - ts->LastCommTime = Tick64(); - - UniFormat(tmp, sizeof(tmp), _UU("TTS_ACCEPTED"), ts->Id, - s->RemoteHostname, s->RemotePort); - TtPrint(tts->Param, tts->Print, tmp); - - Insert(w->TtsSockList, ts); - w->NewSocketArrived = true; - } - UnlockList(w->TtsSockList); - - SetSockEvent(w->SockEvent); - } - } -} - -// Communication throughput measurement server wait thread -void TtsListenThread(THREAD *thread, void *param) -{ - TTS *tts; - wchar_t tmp[MAX_SIZE]; - // Validate arguments - if (thread == NULL || param == NULL) - { - return; - } - - tts = (TTS *)param; - - tts->ListenSocket = NULL; - tts->ListenSocket = ListenEx(tts->Port, false); - tts->ListenSocketV6 = ListenEx6(tts->Port, false); - - if (tts->ListenSocket == NULL && tts->ListenSocketV6 == NULL) - { - // Failed to Listen - UniFormat(tmp, sizeof(tmp), _UU("TT_LISTEN_FAILED"), tts->Port); - TtPrint(tts->Param, tts->Print, tmp); - - // Notify completion of preparation to parent thread - NoticeThreadInit(thread); - - tts->ErrorCode = ERR_INTERNAL_ERROR; - } - else - { - UINT i, num_worker_threads; - - UniFormat(tmp, sizeof(tmp), _UU("TTS_LISTEN_STARTED"), tts->Port); - TtPrint(tts->Param, tts->Print, tmp); - - if (tts->ListenSocketV6 != NULL) - { - UniFormat(tmp, sizeof(tmp), _UU("TTS_LISTEN_STARTED_V6"), tts->Port); - TtPrint(tts->Param, tts->Print, tmp); - } - else - { - UniFormat(tmp, sizeof(tmp), _UU("TTS_LISTEN_FAILED_V6"), tts->Port); - TtPrint(tts->Param, tts->Print, tmp); - } - - if (tts->ListenSocket != NULL) - { - AddRef(tts->ListenSocket->ref); - } - if (tts->ListenSocketV6 != NULL) - { - AddRef(tts->ListenSocketV6->ref); - } - - num_worker_threads = GetNumberOfCpu(); - - // Start the worker threads - for (i = 0;i < num_worker_threads;i++) - { - TTS_WORKER *w = ZeroMalloc(sizeof(TTS_WORKER)); - - w->Tts = tts; - w->WorkThread = NewThread(TtsWorkerThread, w); - WaitThreadInit(w->WorkThread); - - Add(tts->WorkerList, w); - } - - // Notify completion of preparation to parent thread - NoticeThreadInit(thread); - - // Prepare for IPv6 Accept thread - tts->IPv6AcceptThread = NULL; - if (tts->ListenSocketV6 != NULL) - { - tts->IPv6AcceptThread = NewThread(TtsIPv6AcceptThread, tts); - } - - TtsAcceptProc(tts, tts->ListenSocket); - - if (tts->IPv6AcceptThread != NULL) - { - WaitThread(tts->IPv6AcceptThread, INFINITE); - ReleaseThread(tts->IPv6AcceptThread); - } - - TtPrint(tts->Param, tts->Print, _UU("TTS_LISTEN_STOP")); - - ReleaseSock(tts->ListenSocket); - ReleaseSock(tts->ListenSocketV6); - - for (i = 0;i < LIST_NUM(tts->WorkerList);i++) - { - TTS_WORKER *w = LIST_DATA(tts->WorkerList, i); - - SetSockEvent(w->SockEvent); - - // Wait for stopping the worker thread - WaitThread(w->WorkThread, INFINITE); - ReleaseThread(w->WorkThread); - ReleaseSockEvent(w->SockEvent); - - Free(w); - } - } -} - -// String of the direction in which data flows -wchar_t *GetTtcTypeStr(UINT type) -{ - switch (type) - { - case TRAFFIC_TYPE_DOWNLOAD: - return _UU("TTC_TYPE_DOWNLOAD"); - - case TRAFFIC_TYPE_UPLOAD: - return _UU("TTC_TYPE_UPLOAD"); - - default: - return _UU("TTC_TYPE_FULL"); - } -} - -// Show a Summary -void TtcPrintSummary(TTC *ttc) -{ - wchar_t tmp[MAX_SIZE]; - wchar_t tmp2[MAX_SIZE]; - wchar_t *tag = L"%-35s %s"; - // Validate arguments - if (ttc == NULL) - { - return; - } - - TtPrint(ttc->Param, ttc->Print, L""); - TtPrint(ttc->Param, ttc->Print, _UU("TTC_SUMMARY_BAR")); - TtPrint(ttc->Param, ttc->Print, _UU("TTC_SUMMARY_TITLE")); - TtPrint(ttc->Param, ttc->Print, L""); - - // Destination host name - StrToUni(tmp2, sizeof(tmp2), ttc->Host); - UniFormat(tmp, sizeof(tmp), tag, _UU("TTC_SUMMARY_HOST"), tmp2); - TtPrint(ttc->Param, ttc->Print, tmp); - - // Destination TCP port number - UniToStru(tmp2, ttc->Port); - UniFormat(tmp, sizeof(tmp), tag, _UU("TTC_SUMMARY_PORT"), tmp2); - TtPrint(ttc->Param, ttc->Print, tmp); - - // Number of TCP connections to establish - UniToStru(tmp2, ttc->NumTcp); - UniFormat(tmp, sizeof(tmp), tag, _UU("TTC_SUMMARY_NUMTCP"), tmp2); - TtPrint(ttc->Param, ttc->Print, tmp); - - // Data transmission direction - UniFormat(tmp, sizeof(tmp), tag, _UU("TTC_SUMMARY_TYPE"), GetTtcTypeStr(ttc->Type)); - TtPrint(ttc->Param, ttc->Print, tmp); - - // Data transmission span - UniFormat(tmp2, sizeof(tmp2), _UU("TTC_SPAN_STR"), (double)(ttc->Span) / 1000.0); - UniFormat(tmp, sizeof(tmp), tag, _UU("TTC_SUMMARY_SPAN"), tmp2); - TtPrint(ttc->Param, ttc->Print, tmp); - - // Correct the data for Ethernet frame - UniFormat(tmp, sizeof(tmp), tag, _UU("TTC_SUMMARY_ETHER"), ttc->Raw ? _UU("SEC_NO") : _UU("SEC_YES")); - TtPrint(ttc->Param, ttc->Print, tmp); - - // Measure the total amount of input and output throughput of relay equipment - UniFormat(tmp, sizeof(tmp), tag, _UU("TTC_SUMMARY_DOUBLE"), ttc->Double ? _UU("SEC_YES") : _UU("SEC_NO")); - TtPrint(ttc->Param, ttc->Print, tmp); - - TtPrint(ttc->Param, ttc->Print, _UU("TTC_SUMMARY_BAR")); - TtPrint(ttc->Param, ttc->Print, L""); -} - -// Stop the communication throughput measurement client -void StopTtc(TTC *ttc) -{ - // Validate arguments - if (ttc == NULL) - { - return; - } - - TtPrint(ttc->Param, ttc->Print, _UU("TTC_STOPPING")); - - ttc->Halt = true; -} - -// Generate a result -void TtcGenerateResult(TTC *ttc) -{ - TT_RESULT *res; - UINT i; - // Validate arguments - if (ttc == NULL) - { - return; - } - - res = &ttc->Result; - - Zero(res, sizeof(TT_RESULT)); - - res->Raw = ttc->Raw; - res->Double = ttc->Double; - res->Span = ttc->RealSpan; - - for (i = 0;i < LIST_NUM(ttc->ItcSockList);i++) - { - TTC_SOCK *ts = LIST_DATA(ttc->ItcSockList, i); - - if (ts->Download == false) - { - // Upload - res->NumBytesUpload += ts->NumBytes; - } - else - { - // Download - res->NumBytesDownload += ts->NumBytes; - } - } - - if (res->Raw == false) - { - // Correct to match the Ethernet - res->NumBytesDownload = (UINT64)((double)res->NumBytesDownload * 1514.0 / 1460.0); - res->NumBytesUpload = (UINT64)((double)res->NumBytesUpload * 1514.0 / 1460.0); - } - - res->NumBytesTotal = res->NumBytesDownload + res->NumBytesUpload; - - // Measure the throughput - if (res->Span != 0) - { - res->BpsUpload = (UINT64)((double)res->NumBytesUpload * 8.0 / ((double)res->Span / 1000.0)); - res->BpsDownload = (UINT64)((double)res->NumBytesDownload * 8.0 / ((double)res->Span / 1000.0)); - } - - if (res->Double) - { - res->BpsUpload *= 2ULL; - res->BpsDownload *= 2ULL; - } - - res->BpsTotal = res->BpsUpload + res->BpsDownload; -} - -// Client worker thread -void TtcWorkerThread(THREAD *thread, void *param) -{ - TTC_WORKER *w; - TTC *ttc; - bool dont_block_next_time = false; - bool halting = false; - UINT64 halt_timeout = 0; - bool all_sockets_blocked; - wchar_t tmp[MAX_SIZE]; - UCHAR *send_buf_data, *recv_buf_data; - UINT buf_size; - UINT64 tmp64; - - if (thread == NULL || param == NULL) - { - return; - } - - w = (TTC_WORKER *)param; - ttc = w->Ttc; - - // Allocate the data area - TtGenerateRandomData(&send_buf_data, &buf_size); - TtGenerateRandomData(&recv_buf_data, &buf_size); - - NoticeThreadInit(thread); - - // Wait for start - Wait(w->StartEvent, INFINITE); - - // Main loop - while (true) - { - UINT i; - - if (dont_block_next_time == false) - { - WaitSockEvent(w->SockEvent, 50); - } - - dont_block_next_time = false; - - if (ttc->AbnormalTerminated) - { - // Abnormal termination occured - break; - } - - if (ttc->Halt || ttc->end_tick <= Tick64() || (ttc->Cancel != NULL && (*ttc->Cancel))) - { - // End measurement - if (halting == false) - { - if (ttc->Halt || (ttc->Cancel != NULL && (*ttc->Cancel))) - { - if ((ttc->flag1++) == 0) - { - // User cancel - TtPrint(ttc->Param, ttc->Print, _UU("TTC_COMM_USER_CANCEL")); - } - } - else - { - // Time elapsed - if ((ttc->flag2++) == 0) - { - UniFormat(tmp, sizeof(tmp), _UU("TTC_COMM_END"), - (double)ttc->Span / 1000.0); - TtPrint(ttc->Param, ttc->Print, tmp); - } - } - - if (ttc->RealSpan == 0) - { - ttc->RealSpan = Tick64() - ttc->start_tick; - } - - halting = true; - - // Wait for reporting data from the server - halt_timeout = Tick64() + 60000ULL; - } - } - - if (halt_timeout != 0) - { - bool ok = true; - - // Wait that all TCP connections to finish processing - for (i = 0;i < LIST_NUM(w->SockList);i++) - { - TTC_SOCK *ts = LIST_DATA(w->SockList, i); - - if (ts->Download == false) - { - if (ts->ServerUploadReportReceived == false) - { - ok = false; - } - } - } - - if (ok) - { - // Measurement completed - w->Ok = true; - break; - } - else - { - if (halt_timeout <= Tick64()) - { - // An error occured - ttc->AbnormalTerminated = true; - ttc->ErrorCode = ERR_PROTOCOL_ERROR; - break; - } - } - } - - all_sockets_blocked = false; - - // Continue to send and receive data - // until all sockets become block state - while (all_sockets_blocked == false) - { - all_sockets_blocked = true; - - for (i = 0;i < LIST_NUM(w->SockList);i++) - { - UINT ret = SOCK_LATER; - TTC_SOCK *ts = LIST_DATA(w->SockList, i); - bool blocked_for_this_socket = false; - UCHAR c = 0; - UCHAR c_and_session_id[1 + sizeof(UINT64) + sizeof(UINT64)]; - - if (halt_timeout != 0) - { - if (ts->State != 3 && ts->State != 4) - { - if (ts->Download == false) - { - if (ts->State != 0) - { - ts->State = 3; - } - else - { - ts->ServerUploadReportReceived = true; - ts->State = 4; - } - } - else - { - ts->State = 4; - } - } - } - - switch (ts->State) - { - case 0: - // Initial state: Specify the direction of - // the data flow between client-server - if (ts->Download) - { - c = 1; - } - else - { - c = 0; - } - - c_and_session_id[0] = c; - WRITE_UINT64(c_and_session_id + 1, ttc->session_id); - WRITE_UINT64(c_and_session_id + sizeof(UINT64) + 1, ttc->Span); - - ret = Send(ts->Sock, c_and_session_id, 1 + sizeof(UINT64) + sizeof(UINT64), false); - - if (ret != 0 && ret != SOCK_LATER) - { - if (ts->Download) - { - ts->State = 1; - } - else - { - ts->State = 2; - } - } - break; - - case 1: - // Server -> Client (download) - ret = Recv(ts->Sock, recv_buf_data, buf_size, false); - break; - - case 2: - // Client -> Server (upload) - ret = Send(ts->Sock, send_buf_data, buf_size, false); - break; - - case 3: - // Transmission completion client -> server (upload) - // Request the data size - if (ts->NextSendRequestReportTick == 0 || - (Tick64() >= ts->NextSendRequestReportTick)) - { - UCHAR suprise[MAX_SIZE]; - UINT i; - - ts->NextSendRequestReportTick = Tick64() + 200ULL; - - for (i = 0;i < sizeof(suprise);i++) - { - suprise[i] = '!'; - } - - (void)Send(ts->Sock, suprise, sizeof(suprise), false); - } - - ret = Recv(ts->Sock, &tmp64, sizeof(tmp64), false); - if (ret != 0 && ret != SOCK_LATER && ret == sizeof(tmp64)) - { - ts->NumBytes = Endian64(tmp64); - - ts->ServerUploadReportReceived = true; - - ts->State = 4; - } - break; - - case 4: - // Do Nothing - if (Recv(ts->Sock, recv_buf_data, buf_size, false) == SOCK_LATER) - { - ret = SOCK_LATER; - } - break; - } - - if (ret == 0) - { - // The socket is disconnected - ttc->AbnormalTerminated = true; - ttc->ErrorCode = ERR_PROTOCOL_ERROR; - blocked_for_this_socket = true; - dont_block_next_time = false; - - if (ts->HideErrMsg == false) - { - UniFormat(tmp, sizeof(tmp), _UU("TTC_COMM_DISCONNECTED"), ts->Id); - TtPrint(ttc->Param, ttc->Print, tmp); - ts->HideErrMsg = true; - } - } - else if (ret == SOCK_LATER) - { - // Delay has occurred - blocked_for_this_socket = true; - dont_block_next_time = false; - } - else - { - if (ts->Download) - { - ts->NumBytes += (UINT64)ret; - } - } - - if (blocked_for_this_socket == false) - { - all_sockets_blocked = false; - } - } - - if (ttc->Halt || (ttc->Cancel != NULL && (*ttc->Cancel))) - { - all_sockets_blocked = true; - dont_block_next_time = true; - } - - if (ttc->end_tick <= Tick64()) - { - all_sockets_blocked = true; - dont_block_next_time = true; - } - } - } - - Free(send_buf_data); - Free(recv_buf_data); -} - -// Client thread -void TtcThread(THREAD *thread, void *param) -{ - TTC *ttc; - UINT i; - wchar_t tmp[MAX_SIZE]; - bool ok = false; - IP ip_ret; - // Validate arguments - if (thread == NULL || param == NULL) - { - return; - } - - ttc = (TTC *)param; - - // Ready - NoticeThreadInit(thread); - - TtcPrintSummary(ttc); - - UniFormat(tmp, sizeof(tmp), _UU("TTC_CONNECT_START"), - ttc->Host, ttc->Port, ttc->NumTcp); - TtPrint(ttc->Param, ttc->Print, tmp); - - // Establish all connections to the client - ttc->ItcSockList = NewList(NULL); - - ok = true; - - Zero(&ip_ret, sizeof(ip_ret)); - - for (i = 0;i < ttc->NumTcp;i++) - { - SOCK *s; - TTC_SOCK *ts = ZeroMalloc(sizeof(TTC_SOCK)); - char target_host[MAX_SIZE]; - - ts->Id = i + 1; - - if (ttc->Type == TRAFFIC_TYPE_DOWNLOAD) - { - ts->Download = true; - } - else if (ttc->Type == TRAFFIC_TYPE_UPLOAD) - { - ts->Download = false; - } - else - { - ts->Download = ((i % 2) == 0) ? true : false; - } - - StrCpy(target_host, sizeof(target_host), ttc->Host); - - if (IsZeroIp(&ip_ret) == false) - { - IPToStr(target_host, sizeof(target_host), &ip_ret); - } - - s = ConnectEx4(target_host, ttc->Port, 0, ttc->Cancel, NULL, NULL, false, true, &ip_ret); - - if (s == NULL) - { - UniFormat(tmp, sizeof(tmp), _UU("TTC_CONNECT_FAILED"), i + 1); - TtPrint(ttc->Param, ttc->Print, tmp); - ok = false; - Free(ts); - break; - } - else - { - char buffer[TRAFFIC_VER_STR_SIZE]; - - SetTimeout(s, 5000); - - Zero(buffer, sizeof(buffer)); - if (Recv(s, buffer, sizeof(buffer), false) != sizeof(buffer) || Cmp(buffer, TRAFFIC_VER_STR, TRAFFIC_VER_STR_SIZE) != 0) - { - TtPrint(ttc->Param, ttc->Print, _UU("TTC_CONNECT_NOT_SERVER")); - ok = false; - ReleaseSock(s); - Free(ts); - break; - } - - UniFormat(tmp, sizeof(tmp), _UU("TTC_CONNECT_OK"), i + 1); - TtPrint(ttc->Param, ttc->Print, tmp); - - UniFormat(tmp, sizeof(tmp), _UU("TTC_CONNECT_OK_2"), GetTtcTypeStr(ts->Download ? TRAFFIC_TYPE_DOWNLOAD : TRAFFIC_TYPE_UPLOAD)); - TtPrint(ttc->Param, ttc->Print, tmp); - - ts->Sock = s; - - SetTimeout(s, TIMEOUT_INFINITE); - } - - Insert(ttc->ItcSockList, ts); - } - - Set(ttc->InitedEvent); - - if (ttc->StartEvent != NULL) - { - Wait(ttc->StartEvent, INFINITE); - SleepThread(500); - } - - if (ok) - { - UINT64 start_tick, end_tick; - wchar_t tmp1[MAX_SIZE], tmp2[MAX_SIZE]; - UINT64 session_id = Rand64(); - UINT i, num_cpu; - bool all_ok = false; - - ttc->session_id = session_id; - - num_cpu = GetNumberOfCpu(); - - ttc->WorkerThreadList = NewList(NULL); - - for (i = 0;i < num_cpu;i++) - { - TTC_WORKER *w = ZeroMalloc(sizeof(TTC_WORKER)); - - w->Ttc = ttc; - w->SockList = NewList(NULL); - w->StartEvent = NewEvent(); - w->SockEvent = NewSockEvent(); - - w->WorkerThread = NewThread(TtcWorkerThread, w); - - WaitThreadInit(w->WorkerThread); - - Add(ttc->WorkerThreadList, w); - } - - // Assign each of sockets to each of worker threads - for (i = 0;i < LIST_NUM(ttc->ItcSockList);i++) - { - TTC_SOCK *ts = LIST_DATA(ttc->ItcSockList, i); - UINT num = LIST_NUM(ttc->WorkerThreadList); - UINT j = i % num; - TTC_WORKER *w = LIST_DATA(ttc->WorkerThreadList, j); - - Add(w->SockList, ts); - - JoinSockToSockEvent(ts->Sock, w->SockEvent); - } - - // Record the current time - start_tick = Tick64(); - end_tick = start_tick + ttc->Span; - - ttc->start_tick = start_tick; - ttc->end_tick = end_tick; - - // Set the start event for all worker threads - for (i = 0;i < LIST_NUM(ttc->WorkerThreadList);i++) - { - TTC_WORKER *w = LIST_DATA(ttc->WorkerThreadList, i); - - Set(w->StartEvent); - } - - // Show start message - GetDateTimeStrEx64(tmp1, sizeof(tmp1), SystemToLocal64(TickToTime(start_tick)), NULL); - GetDateTimeStrEx64(tmp2, sizeof(tmp2), SystemToLocal64(TickToTime(end_tick)), NULL); - UniFormat(tmp, sizeof(tmp), _UU("TTC_COMM_START"), tmp1, tmp2); - TtPrint(ttc->Param, ttc->Print, tmp); - - // Wait for all worker threads finish - all_ok = true; - for (i = 0;i < LIST_NUM(ttc->WorkerThreadList);i++) - { - TTC_WORKER *w = LIST_DATA(ttc->WorkerThreadList, i); - - WaitThread(w->WorkerThread, INFINITE); - - if (w->Ok == false) - { - all_ok = false; - } - } - - if (all_ok) - { - // Measurement completed - // Show the result - TtcGenerateResult(ttc); - } - - // Release worker threads - for (i = 0;i < LIST_NUM(ttc->WorkerThreadList);i++) - { - TTC_WORKER *w = LIST_DATA(ttc->WorkerThreadList, i); - - ReleaseThread(w->WorkerThread); - - ReleaseEvent(w->StartEvent); - ReleaseList(w->SockList); - - ReleaseSockEvent(w->SockEvent); - - Free(w); - } - - ReleaseList(ttc->WorkerThreadList); - ttc->WorkerThreadList = NULL; - } - else - { - // Abort - TtPrint(ttc->Param, ttc->Print, _UU("TTC_ERROR_ABORTED")); - ttc->ErrorCode = ERR_CONNECT_FAILED; - } - - // Cleanup - for (i = 0;i < LIST_NUM(ttc->ItcSockList);i++) - { - TTC_SOCK *ts = LIST_DATA(ttc->ItcSockList, i); - - Disconnect(ts->Sock); - ReleaseSock(ts->Sock); - Free(ts); - } - - ReleaseList(ttc->ItcSockList); -} - -// Start the communication throughput measurement client -TTC *NewTtc(char *host, UINT port, UINT numtcp, UINT type, UINT64 span, bool dbl, bool raw, TT_PRINT_PROC *print_proc, void *param) -{ - return NewTtcEx(host, port, numtcp, type, span, dbl, raw, print_proc, param, NULL, NULL); -} -TTC *NewTtcEx(char *host, UINT port, UINT numtcp, UINT type, UINT64 span, bool dbl, bool raw, TT_PRINT_PROC *print_proc, void *param, EVENT *start_event, bool *cancel) -{ - TTC *ttc; - - ttc = ZeroMalloc(sizeof(TTC)); - ttc->InitedEvent = NewEvent(); - ttc->Port = port; - StrCpy(ttc->Host, sizeof(ttc->Host), host); - ttc->NumTcp = numtcp; - ttc->Type = type; - ttc->Span = span; - ttc->Double = dbl; - ttc->Raw = raw; - ttc->StartEvent = start_event; - ttc->Cancel = cancel; - - if (ttc->Type == TRAFFIC_TYPE_FULL && ttc->NumTcp < 2) - { - ttc->NumTcp = 2; - } - - ttc->Print = print_proc; - ttc->Param = param; - ttc->ErrorCode = ERR_NO_ERROR; - - TtPrint(ttc->Param, ttc->Print, _UU("TTC_INIT")); - - ttc->Thread = NewThread(TtcThread, ttc); - WaitThreadInit(ttc->Thread); - - return ttc; -} - -// Wait for stopping the communication throughput measurement client -UINT FreeTtc(TTC *ttc, TT_RESULT *result) -{ - UINT ret; - // Validate arguments - if (ttc == NULL) - { - return ERR_INVALID_PARAMETER; - } - - WaitThread(ttc->Thread, INFINITE); - ReleaseThread(ttc->Thread); - - TtPrint(ttc->Param, ttc->Print, _UU("TTC_FREE")); - - ret = ttc->ErrorCode; - - if (ret == ERR_NO_ERROR) - { - if (result != NULL) - { - Copy(result, &ttc->Result, sizeof(TT_RESULT)); - } - } - - ReleaseEvent(ttc->InitedEvent); - - Free(ttc); - - return ret; -} - -// Start the communication throughput measurement server -TTS *NewTts(UINT port, void *param, TT_PRINT_PROC *print_proc) -{ - TTS *tts; - THREAD *t; - - tts = ZeroMalloc(sizeof(TTS)); - tts->Port = port; - tts->Param = param; - tts->Print = print_proc; - - TtPrint(param, print_proc, _UU("TTS_INIT")); - - tts->WorkerList = NewList(NULL); - - // Creating a thread - t = NewThread(TtsListenThread, tts); - WaitThreadInit(t); - - tts->Thread = t; - - return tts; -} - -// Wait for stopping the communication throughput measurement server -UINT FreeTts(TTS *tts) -{ - UINT ret; - // Validate arguments - if (tts == NULL) - { - return ERR_INVALID_PARAMETER; - } - - TtPrint(tts->Param, tts->Print, _UU("TTS_STOP_INIT")); - - tts->Halt = true; - Disconnect(tts->ListenSocket); - ReleaseSock(tts->ListenSocket); - Disconnect(tts->ListenSocketV6); - ReleaseSock(tts->ListenSocketV6); - - // Wait for the termination of the thread - WaitThread(tts->Thread, INFINITE); - - ReleaseThread(tts->Thread); - - TtPrint(tts->Param, tts->Print, _UU("TTS_STOP_FINISHED")); - - ret = tts->ErrorCode; - - ReleaseList(tts->WorkerList); - - Free(tts); - - return ret; -} - -// Show the measurement tools prompt -void PtTrafficPrintProc(void *param, wchar_t *str) -{ - CONSOLE *c; - // Validate arguments - if (param == NULL || str == NULL) - { - return; - } - - c = (CONSOLE *)param; - - if (c->ConsoleType == CONSOLE_LOCAL) - { - Lock(c->OutputLock); - { - wchar_t tmp[MAX_SIZE]; - - // Display only if the local console - // (Can not be displayed because threads aren't synchronized otherwise?) - UniStrCpy(tmp, sizeof(tmp), str); - if (UniEndWith(str, L"\n") == false) - { - UniStrCat(tmp, sizeof(tmp), L"\n"); - } - UniPrint(L"%s", tmp); - } - Unlock(c->OutputLock); - } -} - -// Display the communication throughput results -void TtcPrintResult(CONSOLE *c, TT_RESULT *res) -{ - CT *ct; - wchar_t tmp[MAX_SIZE]; - wchar_t tmp1[MAX_SIZE]; - wchar_t tmp2[MAX_SIZE]; - char str[MAX_SIZE]; - // Validate arguments - if (c == NULL || res == NULL) - { - return; - } - - c->Write(c, _UU("TTC_RES_TITLE")); - - ct = CtNew(); - CtInsertColumn(ct, _UU("TTC_RES_COLUMN_1"), false); - CtInsertColumn(ct, _UU("TTC_RES_COLUMN_2"), true); - CtInsertColumn(ct, _UU("TTC_RES_COLUMN_3"), true); - - // Time that was used to measure - GetSpanStrMilli(str, sizeof(str), res->Span); - StrToUni(tmp, sizeof(tmp), str); - CtInsert(ct, _UU("TTC_RES_SPAN"), tmp, L""); - - // Correct the data for Ethernet frame - CtInsert(ct, _UU("TTC_RES_ETHER"), res->Raw ? _UU("SEC_NO") : _UU("SEC_YES"), L""); - - // Amount of communication data of download direction - ToStr3(str, sizeof(str), res->NumBytesDownload); - UniFormat(tmp1, sizeof(tmp1), L"%S Bytes", str); - ToStrByte1000(str, sizeof(str), res->NumBytesDownload); - StrToUni(tmp2, sizeof(tmp2), str); - CtInsert(ct, _UU("TTC_RES_BYTES_DOWNLOAD"), tmp1, tmp2); - - // Amount of communication data of upload direction - ToStr3(str, sizeof(str), res->NumBytesUpload); - UniFormat(tmp1, sizeof(tmp1), L"%S Bytes", str); - ToStrByte1000(str, sizeof(str), res->NumBytesUpload); - StrToUni(tmp2, sizeof(tmp2), str); - CtInsert(ct, _UU("TTC_RES_BYTES_UPLOAD"), tmp1, tmp2); - - // Total amount of communication data - ToStr3(str, sizeof(str), res->NumBytesTotal); - UniFormat(tmp1, sizeof(tmp1), L"%S Bytes", str); - ToStrByte1000(str, sizeof(str), res->NumBytesTotal); - StrToUni(tmp2, sizeof(tmp2), str); - CtInsert(ct, _UU("TTC_RES_BYTES_TOTAL"), tmp1, tmp2); - - // Calculate the total throughput of input and output of the relay equipment - CtInsert(ct, _UU("TTC_RES_DOUBLE"), (res->Double == false) ? _UU("SEC_NO") : _UU("SEC_YES"), L""); - - // Average throughput of download direction - ToStr3(str, sizeof(str), res->BpsDownload); - UniFormat(tmp1, sizeof(tmp1), L"%S bps", str); - ToStrByte1000(str, sizeof(str), res->BpsDownload); - ReplaceStr(str, sizeof(str), str, "Bytes", "bps"); - StrToUni(tmp2, sizeof(tmp2), str); - CtInsert(ct, _UU("TTC_RES_BPS_DOWNLOAD"), tmp1, tmp2); - - // Average throughput of upload direction - ToStr3(str, sizeof(str), res->BpsUpload); - UniFormat(tmp1, sizeof(tmp1), L"%S bps", str); - ToStrByte1000(str, sizeof(str), res->BpsUpload); - ReplaceStr(str, sizeof(str), str, "Bytes", "bps"); - StrToUni(tmp2, sizeof(tmp2), str); - CtInsert(ct, _UU("TTC_RES_BPS_UPLOAD"), tmp1, tmp2); - - // Total average throughput - ToStr3(str, sizeof(str), res->BpsTotal); - UniFormat(tmp1, sizeof(tmp1), L"%S bps", str); - ToStrByte1000(str, sizeof(str), res->BpsTotal); - ReplaceStr(str, sizeof(str), str, "Bytes", "bps"); - StrToUni(tmp2, sizeof(tmp2), str); - CtInsert(ct, _UU("TTC_RES_BPS_TOTAL"), tmp1, tmp2); - - CtFree(ct, c); -} - -// Execute the communication throughput measurement tool server -UINT PtTrafficServer(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) -{ - LIST *o; - UINT ret = ERR_NO_ERROR; - UINT port; - bool nohup; - TTS *tts; - PARAM args[] = - { - {"[port]", NULL, NULL, NULL, NULL}, - {"NOHUP", NULL, NULL, NULL, NULL}, - }; - - // Get the parameter list - o = ParseCommandList(c, cmd_name, str, args, sizeof(args) / sizeof(args[0])); - if (o == NULL) - { - return ERR_INVALID_PARAMETER; - } - - port = GetParamInt(o, "[port]"); - if (port == 0) - { - port = TRAFFIC_DEFAULT_PORT; - } - - nohup = GetParamYes(o, "nohup"); - - tts = NewTts(port, c, PtTrafficPrintProc); - - if (nohup) - { - while (true) - { - SleepThread(10000); - } - } - - c->Write(c, _UU("TTS_ENTER_TO_EXIT")); - - Free(c->ReadLine(c, L"", true)); - - ret = tts->ErrorCode; - - FreeTts(tts); - - if (ret != ERR_NO_ERROR) - { - CmdPrintError(c, ret); - } - - // Release of the parameter list - FreeParamValueList(o); - - return ret; -} - -// Execute the communication throughput measurement tool client -UINT PtTrafficClient(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) -{ - TTC *ttc; - LIST *o; - UINT ret = ERR_NO_ERROR; - char *host = NULL; - UINT port; - UINT num, type; - bool dbl = false, raw = false; - UINT64 span; - // Parameter list that can be specified - CMD_EVAL_MIN_MAX minmax = - { - "CMD_TrafficClient_EVAL_NUMTCP", - 0, TRAFFIC_NUMTCP_MAX, - }; - PARAM args[] = - { - {"[host:port]", CmdPrompt, _UU("CMD_TrafficClient_PROMPT_HOST"), CmdEvalNotEmpty, NULL}, - {"NUMTCP", NULL, NULL, CmdEvalMinMax, &minmax}, - {"TYPE", NULL, NULL, NULL, NULL}, - {"SPAN", NULL, NULL, NULL, NULL}, - {"DOUBLE", NULL, NULL, NULL, NULL}, - {"RAW", NULL, NULL, NULL, NULL}, - }; - - // Get the parameter list - o = ParseCommandList(c, cmd_name, str, args, sizeof(args) / sizeof(args[0])); - if (o == NULL) - { - return ERR_INVALID_PARAMETER; - } - - if (ParseHostPort(GetParamStr(o, "[host:port]"), &host, &port, TRAFFIC_DEFAULT_PORT) == false) - { - c->Write(c, _UU("CMD_TrafficClient_ERROR_HOSTPORT")); - ret = ERR_INVALID_PARAMETER; - } - else - { - char *s; - UINT i; - - Trim(host); - - num = GetParamInt(o, "NUMTCP"); - if (num == 0) - { - num = TRAFFIC_NUMTCP_DEFAULT; - } - s = GetParamStr(o, "TYPE"); - - if (StartWith("download", s)) - { - type = TRAFFIC_TYPE_DOWNLOAD; - } - else if (StartWith("upload", s)) - { - type = TRAFFIC_TYPE_UPLOAD; - } - else - { - type = TRAFFIC_TYPE_FULL; - } - - i = GetParamInt(o, "SPAN"); - - if (i == 0) - { - i = TRAFFIC_SPAN_DEFAULT; - } - - span = (UINT64)i * 1000ULL; - - dbl = GetParamYes(o, "DOUBLE"); - raw = GetParamYes(o, "RAW"); - - if (type == TRAFFIC_TYPE_FULL) - { - if ((num % 2) != 0) - { - ret = ERR_INVALID_PARAMETER; - c->Write(c, _UU("CMD_TrafficClient_ERROR_NUMTCP")); - } - } - - if (ret == ERR_NO_ERROR) - { - TT_RESULT result; - ttc = NewTtc(host, port, num, type, span, dbl, raw, PtTrafficPrintProc, c); - - if (c->ConsoleType == CONSOLE_LOCAL) - { - if (c->Param != NULL && (((LOCAL_CONSOLE_PARAM *)c->Param)->InBuf == NULL)) - { -// c->Write(c, _UU("TTC_ENTER_TO_EXIT")); -// GetLine(NULL, 0); -// StopTtc(ttc); - } - } - - - Zero(&result, sizeof(result)); - ret = FreeTtc(ttc, &result); - - if (ret == ERR_NO_ERROR) - { - TtcPrintResult(c, &result); - } - } - } - - if (ret != ERR_NO_ERROR) - { - CmdPrintError(c, ret); - } - - // Release of the parameter list - FreeParamValueList(o); - - Free(host); - - return ret; -} - -// Certificate easy creation tool (1024 bit) -UINT PtMakeCert(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) -{ - LIST *o; - UINT ret = ERR_NO_ERROR; - X *x = NULL; - K *pub = NULL; - K *pri = NULL; - NAME *n; - X_SERIAL *x_serial = NULL; - BUF *buf; - UINT days; - X *root_x = NULL; - K *root_k = NULL; - // Parameter list that can be specified - CMD_EVAL_MIN_MAX minmax = - { - "CMD_MakeCert_EVAL_EXPIRES", - 0, - 10950, - }; - PARAM args[] = - { - {"CN", CmdPrompt, _UU("CMD_MakeCert_PROMPT_CN"), NULL, NULL}, - {"O", CmdPrompt, _UU("CMD_MakeCert_PROMPT_O"), NULL, NULL}, - {"OU", CmdPrompt, _UU("CMD_MakeCert_PROMPT_OU"), NULL, NULL}, - {"C", CmdPrompt, _UU("CMD_MakeCert_PROMPT_C"), NULL, NULL}, - {"ST", CmdPrompt, _UU("CMD_MakeCert_PROMPT_ST"), NULL, NULL}, - {"L", CmdPrompt, _UU("CMD_MakeCert_PROMPT_L"), NULL, NULL}, - {"SERIAL", CmdPrompt, _UU("CMD_MakeCert_PROMPT_SERIAL"), NULL, NULL}, - {"EXPIRES", CmdPrompt, _UU("CMD_MakeCert_PROMPT_EXPIRES"), CmdEvalMinMax, &minmax}, - {"SIGNCERT", NULL, NULL, CmdEvalIsFile, NULL}, - {"SIGNKEY", NULL, NULL, CmdEvalIsFile, NULL}, - {"SAVECERT", CmdPrompt, _UU("CMD_MakeCert_PROMPT_SAVECERT"), CmdEvalNotEmpty, NULL}, - {"SAVEKEY", CmdPrompt, _UU("CMD_MakeCert_PROMPT_SAVEKEY"), CmdEvalNotEmpty, NULL}, - }; - - // Get the parameter list - o = ParseCommandList(c, cmd_name, str, args, sizeof(args) / sizeof(args[0])); - if (o == NULL) - { - return ERR_INVALID_PARAMETER; - } - - if (IsEmptyStr(GetParamStr(o, "SIGNCERT")) == false && IsEmptyStr(GetParamStr(o, "SIGNKEY")) == false) - { - root_x = FileToXW(GetParamUniStr(o, "SIGNCERT")); - root_k = FileToKW(GetParamUniStr(o, "SIGNKEY"), true, NULL); - - if (root_x == NULL || root_k == NULL || CheckXandK(root_x, root_k) == false) - { - ret = ERR_INTERNAL_ERROR; - - c->Write(c, _UU("CMD_MakeCert_ERROR_SIGNKEY")); - } - } - - if (ret == ERR_NO_ERROR) - { - buf = StrToBin(GetParamStr(o, "SERIAL")); - if (buf != NULL && buf->Size >= 1) - { - x_serial = NewXSerial(buf->Buf, buf->Size); - } - FreeBuf(buf); - - n = NewName(GetParamUniStr(o, "CN"), GetParamUniStr(o, "O"), GetParamUniStr(o, "OU"), - GetParamUniStr(o, "C"), GetParamUniStr(o, "ST"), GetParamUniStr(o, "L")); - - days = GetParamInt(o, "EXPIRES"); - if (days == 0) - { - days = 3650; - } - - RsaGen(&pri, &pub, 1024); - - if (root_x == NULL) - { - x = NewRootX(pub, pri, n, days, x_serial); - } - else - { - x = NewX(pub, root_k, root_x, n, days, x_serial); - } - - FreeXSerial(x_serial); - FreeName(n); - - if (x == NULL) - { - ret = ERR_INTERNAL_ERROR; - c->Write(c, _UU("CMD_MakeCert_ERROR_GEN_FAILED")); - } - else - { - if (XToFileW(x, GetParamUniStr(o, "SAVECERT"), true) == false) - { - c->Write(c, _UU("CMD_SAVECERT_FAILED")); - } - else if (KToFileW(pri, GetParamUniStr(o, "SAVEKEY"), true, NULL) == false) - { - c->Write(c, _UU("CMD_SAVEKEY_FAILED")); - } - } - } - - if (ret != ERR_NO_ERROR) - { - // Error has occurred - CmdPrintError(c, ret); - } - - // Release of the parameter list - FreeParamValueList(o); - - FreeX(root_x); - FreeK(root_k); - - FreeX(x); - FreeK(pri); - FreeK(pub); - - return ret; -} - -// Certificate easy creation tool (2048 bit) -UINT PtMakeCert2048(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) -{ - LIST *o; - UINT ret = ERR_NO_ERROR; - X *x = NULL; - K *pub = NULL; - K *pri = NULL; - NAME *n; - X_SERIAL *x_serial = NULL; - BUF *buf; - UINT days; - X *root_x = NULL; - K *root_k = NULL; - // Parameter list that can be specified - CMD_EVAL_MIN_MAX minmax = - { - "CMD_MakeCert_EVAL_EXPIRES", - 0, - 10950, - }; - PARAM args[] = - { - {"CN", CmdPrompt, _UU("CMD_MakeCert_PROMPT_CN"), NULL, NULL}, - {"O", CmdPrompt, _UU("CMD_MakeCert_PROMPT_O"), NULL, NULL}, - {"OU", CmdPrompt, _UU("CMD_MakeCert_PROMPT_OU"), NULL, NULL}, - {"C", CmdPrompt, _UU("CMD_MakeCert_PROMPT_C"), NULL, NULL}, - {"ST", CmdPrompt, _UU("CMD_MakeCert_PROMPT_ST"), NULL, NULL}, - {"L", CmdPrompt, _UU("CMD_MakeCert_PROMPT_L"), NULL, NULL}, - {"SERIAL", CmdPrompt, _UU("CMD_MakeCert_PROMPT_SERIAL"), NULL, NULL}, - {"EXPIRES", CmdPrompt, _UU("CMD_MakeCert_PROMPT_EXPIRES"), CmdEvalMinMax, &minmax}, - {"SIGNCERT", NULL, NULL, CmdEvalIsFile, NULL}, - {"SIGNKEY", NULL, NULL, CmdEvalIsFile, NULL}, - {"SAVECERT", CmdPrompt, _UU("CMD_MakeCert_PROMPT_SAVECERT"), CmdEvalNotEmpty, NULL}, - {"SAVEKEY", CmdPrompt, _UU("CMD_MakeCert_PROMPT_SAVEKEY"), CmdEvalNotEmpty, NULL}, - }; - - // Get the parameter list - o = ParseCommandList(c, cmd_name, str, args, sizeof(args) / sizeof(args[0])); - if (o == NULL) - { - return ERR_INVALID_PARAMETER; - } - - if (IsEmptyStr(GetParamStr(o, "SIGNCERT")) == false && IsEmptyStr(GetParamStr(o, "SIGNKEY")) == false) - { - root_x = FileToXW(GetParamUniStr(o, "SIGNCERT")); - root_k = FileToKW(GetParamUniStr(o, "SIGNKEY"), true, NULL); - - if (root_x == NULL || root_k == NULL || CheckXandK(root_x, root_k) == false) - { - ret = ERR_INTERNAL_ERROR; - - c->Write(c, _UU("CMD_MakeCert_ERROR_SIGNKEY")); - } - } - - if (ret == ERR_NO_ERROR) - { - buf = StrToBin(GetParamStr(o, "SERIAL")); - if (buf != NULL && buf->Size >= 1) - { - x_serial = NewXSerial(buf->Buf, buf->Size); - } - FreeBuf(buf); - - n = NewName(GetParamUniStr(o, "CN"), GetParamUniStr(o, "O"), GetParamUniStr(o, "OU"), - GetParamUniStr(o, "C"), GetParamUniStr(o, "ST"), GetParamUniStr(o, "L")); - - days = GetParamInt(o, "EXPIRES"); - if (days == 0) - { - days = 3650; - } - - RsaGen(&pri, &pub, 2048); - - if (root_x == NULL) - { - x = NewRootX(pub, pri, n, days, x_serial); - } - else - { - x = NewX(pub, root_k, root_x, n, days, x_serial); - } - - FreeXSerial(x_serial); - FreeName(n); - - if (x == NULL) - { - ret = ERR_INTERNAL_ERROR; - c->Write(c, _UU("CMD_MakeCert_ERROR_GEN_FAILED")); - } - else - { - if (XToFileW(x, GetParamUniStr(o, "SAVECERT"), true) == false) - { - c->Write(c, _UU("CMD_SAVECERT_FAILED")); - } - else if (KToFileW(pri, GetParamUniStr(o, "SAVEKEY"), true, NULL) == false) - { - c->Write(c, _UU("CMD_SAVEKEY_FAILED")); - } - } - } - - if (ret != ERR_NO_ERROR) - { - // Error has occurred - CmdPrintError(c, ret); - } - - // Release of the parameter list - FreeParamValueList(o); - - FreeX(root_x); - FreeK(root_k); - - FreeX(x); - FreeK(pri); - FreeK(pub); - - return ret; -} - -// Client management tool main -void PcMain(PC *pc) -{ - char prompt[MAX_SIZE]; - wchar_t tmp[MAX_SIZE]; - // Validate arguments - if (pc == NULL) - { - return; - } - - // Display a message that the connection has been made - UniFormat(tmp, sizeof(tmp), _UU("CMD_VPNCMD_CLIENT_CONNECTED"), - pc->ServerName); - pc->Console->Write(pc->Console, tmp); - pc->Console->Write(pc->Console, L""); - - while (true) - { - // Definition of command - CMD cmd[] = - { - {"About", PsAbout}, - {"Check", PtCheck}, - {"VersionGet", PcVersionGet}, - {"PasswordSet", PcPasswordSet}, - {"PasswordGet", PcPasswordGet}, - {"CertList", PcCertList}, - {"CertAdd", PcCertAdd}, - {"CertDelete", PcCertDelete}, - {"CertGet", PcCertGet}, - {"SecureList", PcSecureList}, - {"SecureSelect", PcSecureSelect}, - {"SecureGet", PcSecureGet}, - {"NicCreate", PcNicCreate}, - {"NicDelete", PcNicDelete}, - {"NicUpgrade", PcNicUpgrade}, - {"NicGetSetting", PcNicGetSetting}, - {"NicSetSetting", PcNicSetSetting}, - {"NicEnable", PcNicEnable}, - {"NicDisable", PcNicDisable}, - {"NicList", PcNicList}, - {"AccountList", PcAccountList}, - {"AccountCreate", PcAccountCreate}, - {"AccountSet", PcAccountSet}, - {"AccountGet", PcAccountGet}, - {"AccountDelete", PcAccountDelete}, - {"AccountUsernameSet", PcAccountUsernameSet}, - {"AccountAnonymousSet", PcAccountAnonymousSet}, - {"AccountPasswordSet", PcAccountPasswordSet}, - {"AccountCertSet", PcAccountCertSet}, - {"AccountCertGet", PcAccountCertGet}, - {"AccountEncryptDisable", PcAccountEncryptDisable}, - {"AccountEncryptEnable", PcAccountEncryptEnable}, - {"AccountCompressEnable", PcAccountCompressEnable}, - {"AccountCompressDisable", PcAccountCompressDisable}, - {"AccountHttpHeaderAdd", PcAccountHttpHeaderAdd}, - {"AccountHttpHeaderDelete", PcAccountHttpHeaderDelete}, - {"AccountHttpHeaderGet", PcAccountHttpHeaderGet}, - {"AccountProxyNone", PcAccountProxyNone}, - {"AccountProxyHttp", PcAccountProxyHttp}, - {"AccountProxySocks", PcAccountProxySocks}, - {"AccountProxySocks5", PcAccountProxySocks5}, - {"AccountServerCertEnable", PcAccountServerCertEnable}, - {"AccountServerCertDisable", PcAccountServerCertDisable}, - {"AccountRetryOnServerCertEnable", PcAccountRetryOnServerCertEnable}, - {"AccountRetryOnServerCertDisable", PcAccountRetryOnServerCertDisable}, - {"AccountServerCertSet", PcAccountServerCertSet}, - {"AccountServerCertDelete", PcAccountServerCertDelete}, - {"AccountServerCertGet", PcAccountServerCertGet}, - {"AccountDetailSet", PcAccountDetailSet}, - {"AccountRename", PcAccountRename}, - {"AccountConnect", PcAccountConnect}, - {"AccountDisconnect", PcAccountDisconnect}, - {"AccountStatusGet", PcAccountStatusGet}, - {"AccountNicSet", PcAccountNicSet}, - {"AccountStatusShow", PcAccountStatusShow}, - {"AccountStatusHide", PcAccountStatusHide}, - {"AccountSecureCertSet", PcAccountSecureCertSet}, - {"AccountOpensslEngineCertSet", PcAccountOpensslEngineCertSet}, - {"AccountRetrySet", PcAccountRetrySet}, - {"AccountStartupSet", PcAccountStartupSet}, - {"AccountStartupRemove", PcAccountStartupRemove}, - {"AccountExport", PcAccountExport}, - {"AccountImport", PcAccountImport}, - {"RemoteEnable", PcRemoteEnable}, - {"RemoteDisable", PcRemoteDisable}, - {"KeepEnable", PcKeepEnable}, - {"KeepDisable", PcKeepDisable}, - {"KeepSet", PcKeepSet}, - {"KeepGet", PcKeepGet}, - {"MakeCert", PtMakeCert}, - {"MakeCert2048", PtMakeCert2048}, - {"TrafficClient", PtTrafficClient}, - {"TrafficServer", PtTrafficServer}, - }; - - // Generate a prompt - StrCpy(prompt, sizeof(prompt), "VPN Client>"); - - if (DispatchNextCmdEx(pc->Console, pc->CmdLine, prompt, cmd, sizeof(cmd) / sizeof(cmd[0]), pc) == false) - { - break; - } - pc->LastError = pc->Console->RetCode; - - if (pc->LastError == ERR_NO_ERROR && pc->Console->ConsoleType != CONSOLE_CSV) - { - pc->Console->Write(pc->Console, _UU("CMD_MSG_OK")); - pc->Console->Write(pc->Console, L""); - } - - if (pc->CmdLine != NULL) - { - break; - } - } -} - -// Retrieve the version information of VPN Client service -UINT PcVersionGet(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) -{ - LIST *o; - PC *pc = (PC *)param; - UINT ret = ERR_NO_ERROR; - RPC_CLIENT_VERSION t; - - // Get the parameter list - o = ParseCommandList(c, cmd_name, str, NULL, 0); - if (o == NULL) - { - return ERR_INVALID_PARAMETER; - } - - // RPC call - Zero(&t, sizeof(t)); - - ret = CcGetClientVersion(pc->RemoteClient, &t); - - if (ret == ERR_NO_ERROR) - { - wchar_t tmp[MAX_SIZE]; - CT *ct; - - // Success - ct = CtNewStandard(); - - StrToUni(tmp, sizeof(tmp), t.ClientProductName); - CtInsert(ct, _UU("CMD_VersionGet_1"), tmp); - - StrToUni(tmp, sizeof(tmp), t.ClientVersionString); - CtInsert(ct, _UU("CMD_VersionGet_2"), tmp); - - StrToUni(tmp, sizeof(tmp), t.ClientBuildInfoString); - CtInsert(ct, _UU("CMD_VersionGet_3"), tmp); - - UniToStru(tmp, t.ProcessId); - CtInsert(ct, _UU("CMD_VersionGet_4"), tmp); - - StrToUni(tmp, sizeof(tmp), OsTypeToStr(t.OsType)); - CtInsert(ct, _UU("CMD_VersionGet_5"), tmp); - - CtFree(ct, c); - } - - if (ret != ERR_NO_ERROR) - { - // Error has occurred - CmdPrintError(c, ret); - } - - // Release the parameter list - FreeParamValueList(o); - - return ret; -} - -// Set a password to connect to the VPN Client Service -UINT PcPasswordSet(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) -{ - LIST *o; - PC *pc = (PC *)param; - UINT ret = ERR_NO_ERROR; - RPC_CLIENT_PASSWORD t; - // Parameter list that can be specified - PARAM args[] = - { - {"[password]", CmdPromptChoosePassword, NULL, NULL, NULL}, - {"REMOTEONLY", NULL, NULL, NULL, NULL}, - }; - - // Get the parameter list - o = ParseCommandList(c, cmd_name, str, args, sizeof(args) / sizeof(args[0])); - if (o == NULL) - { - return ERR_INVALID_PARAMETER; - } - - // RPC call - Zero(&t, sizeof(t)); - StrCpy(t.Password, sizeof(t.Password), GetParamStr(o, "[password]")); - t.PasswordRemoteOnly = GetParamYes(o, "REMOTEONLY"); - - ret = CcSetPassword(pc->RemoteClient, &t); - - if (ret == ERR_NO_ERROR) - { - // Success - } - - if (ret != ERR_NO_ERROR) - { - // Error has occurred - CmdPrintError(c, ret); - } - - // Release of the parameter list - FreeParamValueList(o); - - return ret; -} - -// Get the settings of the password to connect to the VPN Client service -UINT PcPasswordGet(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) -{ - LIST *o; - PC *pc = (PC *)param; - UINT ret = ERR_NO_ERROR; - RPC_CLIENT_PASSWORD_SETTING t; - - // Get the parameter list - o = ParseCommandList(c, cmd_name, str, NULL, 0); - if (o == NULL) - { - return ERR_INVALID_PARAMETER; - } - - // RPC call - Zero(&t, sizeof(t)); - - ret = CcGetPasswordSetting(pc->RemoteClient, &t); - - if (ret == ERR_NO_ERROR) - { - // Success - CT *ct = CtNewStandard(); - - CtInsert(ct, _UU("CMD_PasswordGet_1"), - t.IsPasswordPresented ? _UU("CMD_MSG_ENABLE") : _UU("CMD_MSG_DISABLE")); - - CtInsert(ct, _UU("CMD_PasswordGet_2"), - t.PasswordRemoteOnly ? _UU("CMD_MSG_ENABLE") : _UU("CMD_MSG_DISABLE")); - - CtFree(ct, c); - } - - if (ret != ERR_NO_ERROR) - { - // Error has occurred - CmdPrintError(c, ret); - } - - // Release the parameter list - FreeParamValueList(o); - - return ret; -} - -// Get the list of certificates of the trusted certification authority -UINT PcCertList(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) -{ - LIST *o; - PC *pc = (PC *)param; - UINT ret = ERR_NO_ERROR; - RPC_CLIENT_ENUM_CA t; - - // Get the parameter list - o = ParseCommandList(c, cmd_name, str, NULL, 0); - if (o == NULL) - { - return ERR_INVALID_PARAMETER; - } - - // RPC call - Zero(&t, sizeof(t)); - - ret = CcEnumCa(pc->RemoteClient, &t); - - if (ret == ERR_NO_ERROR) - { - // Success - UINT i; - CT *ct = CtNewStandard(); - - for (i = 0;i < t.NumItem;i++) - { - wchar_t tmp[MAX_SIZE]; - wchar_t tmp2[64]; - RPC_CLIENT_ENUM_CA_ITEM *e = t.Items[i]; - - GetDateStrEx64(tmp, sizeof(tmp), SystemToLocal64(e->Expires), NULL); - - UniToStru(tmp2, e->Key); - - CtInsert(ct, _UU("CMD_CAList_COLUMN_ID"), tmp2); - CtInsert(ct, _UU("CM_CERT_COLUMN_1"), e->SubjectName); - CtInsert(ct, _UU("CM_CERT_COLUMN_2"), e->IssuerName); - CtInsert(ct, _UU("CM_CERT_COLUMN_3"), tmp); - - if (i != (t.NumItem - 1)) - { - CtInsert(ct, L"---", L"---"); - } - } - - CtFree(ct, c); - - CiFreeClientEnumCa(&t); - } - - if (ret != ERR_NO_ERROR) - { - // Error has occurred - CmdPrintError(c, ret); - } - - - // Release of the parameter list - FreeParamValueList(o); - - return ret; -} - -// Add a certificate of the trusted certification authority -UINT PcCertAdd(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) -{ - LIST *o; - PC *pc = (PC *)param; - UINT ret = ERR_NO_ERROR; - RPC_CERT t; - X *x; - // Parameter list that can be specified - PARAM args[] = - { - {"[path]", CmdPrompt, _UU("CMD_CAAdd_PROMPT_PATH"), CmdEvalIsFile, NULL}, - }; - - // Get the parameter list - o = ParseCommandList(c, cmd_name, str, args, sizeof(args) / sizeof(args[0])); - if (o == NULL) - { - return ERR_INVALID_PARAMETER; - } - - - x = FileToXW(GetParamUniStr(o, "[path]")); - - if (x == NULL) - { - FreeParamValueList(o); - c->Write(c, _UU("CMD_MSG_LOAD_CERT_FAILED")); - return ERR_INVALID_PARAMETER; - } - - // RPC call - Zero(&t, sizeof(t)); - t.x = x; - - ret = CcAddCa(pc->RemoteClient, &t); - - if (ret == ERR_NO_ERROR) - { - // Success - } - - if (ret != ERR_NO_ERROR) - { - // Error has occurred - CmdPrintError(c, ret); - } - - FreeX(x); - - // Release of the parameter list - FreeParamValueList(o); - - return ret; -} - -// Delete the certificate of the trusted certification authority -UINT PcCertDelete(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) -{ - LIST *o; - PC *pc = (PC *)param; - UINT ret = ERR_NO_ERROR; - RPC_CLIENT_DELETE_CA t; - // Parameter list that can be specified - PARAM args[] = - { - {"[id]", CmdPrompt, _UU("CMD_CADelete_PROMPT_ID"), CmdEvalNotEmpty, NULL}, - }; - - // Get the parameter list - o = ParseCommandList(c, cmd_name, str, args, sizeof(args) / sizeof(args[0])); - if (o == NULL) - { - return ERR_INVALID_PARAMETER; - } - - // RPC call - Zero(&t, sizeof(t)); - t.Key = GetParamInt(o, "[id]"); - - ret = CcDeleteCa(pc->RemoteClient, &t); - - if (ret == ERR_NO_ERROR) - { - // Success - } - - if (ret != ERR_NO_ERROR) - { - // Error has occurred - CmdPrintError(c, ret); - } - - // Release of the parameter list - FreeParamValueList(o); - - return ret; -} - -// Get the certificate of the trusted certification authority -UINT PcCertGet(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) -{ - LIST *o; - PC *pc = (PC *)param; - UINT ret = ERR_NO_ERROR; - RPC_GET_CA t; - // Parameter list that can be specified - PARAM args[] = - { - {"[id]", CmdPrompt, _UU("CMD_CAGet_PROMPT_ID"), CmdEvalNotEmpty, NULL}, - {"SAVECERT", CmdPrompt, _UU("CMD_CAGet_PROMPT_SAVECERT"), CmdEvalNotEmpty, NULL}, - }; - - // Get the parameter list - o = ParseCommandList(c, cmd_name, str, args, sizeof(args) / sizeof(args[0])); - if (o == NULL) - { - return ERR_INVALID_PARAMETER; - } - - // RPC call - Zero(&t, sizeof(t)); - t.Key = GetParamInt(o, "[id]"); - - ret = CcGetCa(pc->RemoteClient, &t); - - if (ret == ERR_NO_ERROR) - { - // Success - if (XToFileW(t.x, GetParamUniStr(o, "SAVECERT"), true)) - { - // Success - } - else - { - // Failure - ret = ERR_INTERNAL_ERROR; - c->Write(c, _UU("CMD_MSG_SAVE_CERT_FAILED")); - } - - CiFreeGetCa(&t); - } - - if (ret != ERR_NO_ERROR) - { - // Error has occurred - CmdPrintError(c, ret); - } - - // Release of the parameter list - FreeParamValueList(o); - - return ret; -} - -// Get the list of the type of smart card that can be used -UINT PcSecureList(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) -{ - LIST *o; - PC *pc = (PC *)param; - UINT ret = ERR_NO_ERROR; - RPC_CLIENT_ENUM_SECURE t; - - // Get the parameter list - o = ParseCommandList(c, cmd_name, str, NULL, 0); - if (o == NULL) - { - return ERR_INVALID_PARAMETER; - } - - // RPC call - Zero(&t, sizeof(t)); - - ret = CcEnumSecure(pc->RemoteClient, &t); - - if (ret == ERR_NO_ERROR) - { - CT *ct; - UINT i; - wchar_t tmp1[MAX_SIZE]; - wchar_t tmp2[MAX_SIZE]; - wchar_t tmp4[MAX_SIZE]; - wchar_t *tmp3; - - // Success - ct = CtNew(); - CtInsertColumn(ct, _UU("SEC_COLUMN1"), false); - CtInsertColumn(ct, _UU("SEC_COLUMN2"), false); - CtInsertColumn(ct, _UU("SEC_COLUMN3"), false); - CtInsertColumn(ct, _UU("SEC_COLUMN4"), false); - - for (i = 0;i < t.NumItem;i++) - { - RPC_CLIENT_ENUM_SECURE_ITEM *e = t.Items[i]; - - // ID - UniToStru(tmp1, e->DeviceId); - - // Device name - StrToUni(tmp2, sizeof(tmp2), e->DeviceName); - - // Type - tmp3 = (e->Type == SECURE_IC_CARD) ? _UU("SEC_SMART_CARD") : _UU("SEC_USB_TOKEN"); - - // Manufacturer - StrToUni(tmp4, sizeof(tmp4), e->Manufacturer); - - CtInsert(ct, tmp1, tmp2, tmp3, tmp4); - } - - CtFreeEx(ct, c, true); - - CiFreeClientEnumSecure(&t); - } - - if (ret != ERR_NO_ERROR) - { - // Error has occurred - CmdPrintError(c, ret); - } - - // Release of the parameter list - FreeParamValueList(o); - - return ret; -} - -// Select the type of smart card to be used -UINT PcSecureSelect(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) -{ - LIST *o; - PC *pc = (PC *)param; - UINT ret = ERR_NO_ERROR; - RPC_USE_SECURE t; - // Parameter list that can be specified - PARAM args[] = - { - {"[id]", CmdPrompt, _UU("CMD_SecureSelect_PROMPT_ID"), NULL, NULL}, - }; - - // Get the parameter list - o = ParseCommandList(c, cmd_name, str, args, sizeof(args) / sizeof(args[0])); - if (o == NULL) - { - return ERR_INVALID_PARAMETER; - } - - // RPC call - Zero(&t, sizeof(t)); - t.DeviceId = GetParamInt(o, "[id]"); - - ret = CcUseSecure(pc->RemoteClient, &t); - - if (ret == ERR_NO_ERROR) - { - // Success - } - - if (ret != ERR_NO_ERROR) - { - // Error has occurred - CmdPrintError(c, ret); - } - - // Release of the parameter list - FreeParamValueList(o); - - return ret; -} - -// Get the type ID of smart card to be used -UINT PcSecureGet(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) -{ - LIST *o; - PC *pc = (PC *)param; - UINT ret = ERR_NO_ERROR; - RPC_USE_SECURE t; - - // Get the parameter list - o = ParseCommandList(c, cmd_name, str, NULL, 0); - if (o == NULL) - { - return ERR_INVALID_PARAMETER; - } - - // RPC call - Zero(&t, sizeof(t)); - - ret = CcGetUseSecure(pc->RemoteClient, &t); - - if (ret == ERR_NO_ERROR) - { - // Success - wchar_t tmp[MAX_SIZE]; - - if (t.DeviceId != 0) - { - UniFormat(tmp, sizeof(tmp), _UU("CMD_SecureGet_Print"), t.DeviceId); - } - else - { - UniStrCpy(tmp, sizeof(tmp), _UU("CMD_SecureGet_NoPrint")); - } - c->Write(c, tmp); - } - - if (ret != ERR_NO_ERROR) - { - // Error has occurred - CmdPrintError(c, ret); - } - - // Release of the parameter list - FreeParamValueList(o); - - return ret; -} - -// Create a new virtual LAN card -UINT PcNicCreate(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) -{ - LIST *o; - PC *pc = (PC *)param; - UINT ret = ERR_NO_ERROR; - RPC_CLIENT_CREATE_VLAN t; - // Parameter list that can be specified - PARAM args[] = - { - {"[name]", CmdPrompt, _UU("CMD_NicCreate_PROMPT_NAME"), CmdEvalNotEmpty, NULL}, - }; - - // Get the parameter list - o = ParseCommandList(c, cmd_name, str, args, sizeof(args) / sizeof(args[0])); - if (o == NULL) - { - return ERR_INVALID_PARAMETER; - } - - // RPC call - Zero(&t, sizeof(t)); - StrCpy(t.DeviceName, sizeof(t.DeviceName), GetParamStr(o, "[name]")); - - ret = CcCreateVLan(pc->RemoteClient, &t); - - if (ret == ERR_NO_ERROR) - { - // Success - } - - if (ret != ERR_NO_ERROR) - { - // Error has occurred - CmdPrintError(c, ret); - } - - // Release of the parameter list - FreeParamValueList(o); - - return ret; -} - -// Delete the virtual LAN card -UINT PcNicDelete(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) -{ - LIST *o; - PC *pc = (PC *)param; - UINT ret = ERR_NO_ERROR; - RPC_CLIENT_CREATE_VLAN t; - // Parameter list that can be specified - PARAM args[] = - { - {"[name]", CmdPrompt, _UU("CMD_NicCreate_PROMPT_NAME"), CmdEvalNotEmpty, NULL}, - }; - - // Get the parameter list - o = ParseCommandList(c, cmd_name, str, args, sizeof(args) / sizeof(args[0])); - if (o == NULL) - { - return ERR_INVALID_PARAMETER; - } - - // RPC call - Zero(&t, sizeof(t)); - StrCpy(t.DeviceName, sizeof(t.DeviceName), GetParamStr(o, "[name]")); - - ret = CcDeleteVLan(pc->RemoteClient, &t); - - if (ret == ERR_NO_ERROR) - { - // Success - } - - if (ret != ERR_NO_ERROR) - { - // Error has occurred - CmdPrintError(c, ret); - } - - // Release of the parameter list - FreeParamValueList(o); - - return ret; -} - -// Upgrading the device driver of the virtual LAN card -UINT PcNicUpgrade(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) -{ - LIST *o; - PC *pc = (PC *)param; - UINT ret = ERR_NO_ERROR; - RPC_CLIENT_CREATE_VLAN t; - // Parameter list that can be specified - PARAM args[] = - { - {"[name]", CmdPrompt, _UU("CMD_NicCreate_PROMPT_NAME"), CmdEvalNotEmpty, NULL}, - }; - - // Get the parameter list - o = ParseCommandList(c, cmd_name, str, args, sizeof(args) / sizeof(args[0])); - if (o == NULL) - { - return ERR_INVALID_PARAMETER; - } - - // RPC call - Zero(&t, sizeof(t)); - StrCpy(t.DeviceName, sizeof(t.DeviceName), GetParamStr(o, "[name]")); - - ret = CcUpgradeVLan(pc->RemoteClient, &t); - - if (ret == ERR_NO_ERROR) - { - // Success - } - - if (ret != ERR_NO_ERROR) - { - // Error has occurred - CmdPrintError(c, ret); - } - - // Release of the parameter list - FreeParamValueList(o); - - return ret; -} - -// Get the settings of the virtual LAN card -UINT PcNicGetSetting(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) -{ - LIST *o; - PC *pc = (PC *)param; - UINT ret = ERR_NO_ERROR; - RPC_CLIENT_GET_VLAN t; - // Parameter list that can be specified - PARAM args[] = - { - {"[name]", CmdPrompt, _UU("CMD_NicCreate_PROMPT_NAME"), CmdEvalNotEmpty, NULL}, - }; - - // Get the parameter list - o = ParseCommandList(c, cmd_name, str, args, sizeof(args) / sizeof(args[0])); - if (o == NULL) - { - return ERR_INVALID_PARAMETER; - } - - // RPC call - Zero(&t, sizeof(t)); - StrCpy(t.DeviceName, sizeof(t.DeviceName), GetParamStr(o, "[name]")); - - ret = CcGetVLan(pc->RemoteClient, &t); - - if (ret == ERR_NO_ERROR) - { - // Success - CT *ct = CtNewStandard(); - wchar_t tmp[MAX_SIZE]; - - StrToUni(tmp, sizeof(tmp), t.DeviceName); - CtInsert(ct, _UU("CMD_NicGetSetting_1"), tmp); - - CtInsert(ct, _UU("CMD_NicGetSetting_2"), t.Enabled ? _UU("CMD_MSG_ENABLE") : _UU("CMD_MSG_DISABLE")); - - StrToUni(tmp, sizeof(tmp), t.MacAddress); - CtInsert(ct, _UU("CMD_NicGetSetting_3"), tmp); - - StrToUni(tmp, sizeof(tmp), t.Version); - CtInsert(ct, _UU("CMD_NicGetSetting_4"), tmp); - - StrToUni(tmp, sizeof(tmp), t.FileName); - CtInsert(ct, _UU("CMD_NicGetSetting_5"), tmp); - - StrToUni(tmp, sizeof(tmp), t.Guid); - CtInsert(ct, _UU("CMD_NicGetSetting_6"), tmp); - - CtFree(ct, c); - } - - if (ret != ERR_NO_ERROR) - { - // Error has occurred - CmdPrintError(c, ret); - } - - // Release of the parameter list - FreeParamValueList(o); - - return ret; -} - -// Change the settings for the virtual LAN card -UINT PcNicSetSetting(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) -{ - LIST *o; - PC *pc = (PC *)param; - UINT ret = ERR_NO_ERROR; - RPC_CLIENT_SET_VLAN t; - UCHAR mac_address[6]; - BUF *b; - // Parameter list that can be specified - PARAM args[] = - { - {"[name]", CmdPrompt, _UU("CMD_NicCreate_PROMPT_NAME"), CmdEvalNotEmpty, NULL}, - {"MAC", CmdPrompt, _UU("CMD_NicSetSetting_PROMPT_MAC"), CmdEvalNotEmpty, NULL}, - }; - - // Get the parameter list - o = ParseCommandList(c, cmd_name, str, args, sizeof(args) / sizeof(args[0])); - if (o == NULL) - { - return ERR_INVALID_PARAMETER; - } - - // Inspect the MAC address - Zero(mac_address, sizeof(mac_address)); - b = StrToBin(GetParamStr(o, "MAC")); - if (b != NULL && b->Size == 6) - { - Copy(mac_address, b->Buf, 6); - } - FreeBuf(b); - - if (IsZero(mac_address, 6)) - { - // MAC address is invalid - FreeParamValueList(o); - - CmdPrintError(c, ERR_INVALID_PARAMETER); - return ERR_INVALID_PARAMETER; - } - - // RPC call - Zero(&t, sizeof(t)); - StrCpy(t.DeviceName, sizeof(t.DeviceName), GetParamStr(o, "[name]")); - NormalizeMacAddress(t.MacAddress, sizeof(t.MacAddress), GetParamStr(o, "MAC")); - - ret = CcSetVLan(pc->RemoteClient, &t); - - if (ret == ERR_NO_ERROR) - { - // Success - } - - if (ret != ERR_NO_ERROR) - { - // Error has occurred - CmdPrintError(c, ret); - } - - // Release of the parameter list - FreeParamValueList(o); - - return ret; -} - -// Enable the virtual LAN card -UINT PcNicEnable(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) -{ - LIST *o; - PC *pc = (PC *)param; - UINT ret = ERR_NO_ERROR; - RPC_CLIENT_CREATE_VLAN t; - // Parameter list that can be specified - PARAM args[] = - { - {"[name]", CmdPrompt, _UU("CMD_NicCreate_PROMPT_NAME"), CmdEvalNotEmpty, NULL}, - }; - - // Get the parameter list - o = ParseCommandList(c, cmd_name, str, args, sizeof(args) / sizeof(args[0])); - if (o == NULL) - { - return ERR_INVALID_PARAMETER; - } - - // RPC call - Zero(&t, sizeof(t)); - StrCpy(t.DeviceName, sizeof(t.DeviceName), GetParamStr(o, "[name]")); - - ret = CcEnableVLan(pc->RemoteClient, &t); - - if (ret == ERR_NO_ERROR) - { - // Success - } - - if (ret != ERR_NO_ERROR) - { - // Error has occurred - CmdPrintError(c, ret); - } - - // Release of the parameter list - FreeParamValueList(o); - - return ret; -} - -// Disable the virtual LAN card -UINT PcNicDisable(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) -{ - LIST *o; - PC *pc = (PC *)param; - UINT ret = ERR_NO_ERROR; - RPC_CLIENT_CREATE_VLAN t; - // Parameter list that can be specified - PARAM args[] = - { - {"[name]", CmdPrompt, _UU("CMD_NicCreate_PROMPT_NAME"), CmdEvalNotEmpty, NULL}, - }; - - // Get the parameter list - o = ParseCommandList(c, cmd_name, str, args, sizeof(args) / sizeof(args[0])); - if (o == NULL) - { - return ERR_INVALID_PARAMETER; - } - - // RPC call - Zero(&t, sizeof(t)); - StrCpy(t.DeviceName, sizeof(t.DeviceName), GetParamStr(o, "[name]")); - - ret = CcDisableVLan(pc->RemoteClient, &t); - - if (ret == ERR_NO_ERROR) - { - // Success - } - - if (ret != ERR_NO_ERROR) - { - // Error has occurred - CmdPrintError(c, ret); - } - - // Release of the parameter list - FreeParamValueList(o); - - return ret; -} - -// Get the Virtual LAN card list -UINT PcNicList(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) -{ - LIST *o; - PC *pc = (PC *)param; - UINT ret = ERR_NO_ERROR; - RPC_CLIENT_ENUM_VLAN t; - - // Get the parameter list - o = ParseCommandList(c, cmd_name, str, NULL, 0); - if (o == NULL) - { - return ERR_INVALID_PARAMETER; - } - - // RPC call - Zero(&t, sizeof(t)); - - ret = CcEnumVLan(pc->RemoteClient, &t); - - if (ret == ERR_NO_ERROR) - { - CT *ct; - UINT i; - - // Success - ct = CtNew(); - CtInsertColumn(ct, _UU("CM_VLAN_COLUMN_1"), false); - CtInsertColumn(ct, _UU("CM_VLAN_COLUMN_2"), false); - CtInsertColumn(ct, _UU("CM_VLAN_COLUMN_3"), false); - CtInsertColumn(ct, _UU("CM_VLAN_COLUMN_4"), false); - - for (i = 0;i < t.NumItem;i++) - { - wchar_t name[MAX_SIZE]; - wchar_t mac[MAX_SIZE]; - wchar_t ver[MAX_SIZE]; - wchar_t *status; - RPC_CLIENT_ENUM_VLAN_ITEM *v = t.Items[i]; - - // Device name - StrToUni(name, sizeof(name), v->DeviceName); - - // State - status = v->Enabled ? _UU("CM_VLAN_ENABLED") : _UU("CM_VLAN_DISABLED"); - - // MAC address - StrToUni(mac, sizeof(mac), v->MacAddress); - - // Version - StrToUni(ver, sizeof(ver), v->Version); - - CtInsert(ct, - name, status, mac, ver); - } - - CtFreeEx(ct, c, true); - } - - if (ret != ERR_NO_ERROR) - { - // Error has occurred - CmdPrintError(c, ret); - } - - CiFreeClientEnumVLan(&t); - - // Release of the parameter list - FreeParamValueList(o); - - return ret; -} - -// Get the protocol name string from ID -wchar_t *GetProtocolName(UINT n) -{ - switch (n) - { - case PROXY_DIRECT: - return _UU("PROTO_DIRECT_TCP"); - case PROXY_HTTP: - return _UU("PROTO_HTTP_PROXY"); - case PROXY_SOCKS: - return _UU("PROTO_SOCKS_PROXY"); - case PROXY_SOCKS5: - return _UU("PROTO_SOCKS5_PROXY"); - } - - return _UU("PROTO_UNKNOWN"); -} - -// Get the connection settings list -UINT PcAccountList(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) -{ - LIST *o; - PC *pc = (PC *)param; - UINT ret = ERR_NO_ERROR; - RPC_CLIENT_ENUM_ACCOUNT t; - - // Get the parameter list - o = ParseCommandList(c, cmd_name, str, NULL, 0); - if (o == NULL) - { - return ERR_INVALID_PARAMETER; - } - - // RPC call - Zero(&t, sizeof(t)); - - ret = CcEnumAccount(pc->RemoteClient, &t); - - if (ret == ERR_NO_ERROR) - { - UINT i; - CT *ct; - - // Success - ct = CtNew(); - CtInsertColumn(ct, _UU("CM_ACCOUNT_COLUMN_1"), false); - CtInsertColumn(ct, _UU("CM_ACCOUNT_COLUMN_2"), false); - CtInsertColumn(ct, _UU("CM_ACCOUNT_COLUMN_3"), false); - CtInsertColumn(ct, _UU("CM_ACCOUNT_COLUMN_3_2"), false); - CtInsertColumn(ct, _UU("CM_ACCOUNT_COLUMN_4"), false); - - for (i = 0;i < t.NumItem;i++) - { - RPC_CLIENT_ENUM_ACCOUNT_ITEM *e = t.Items[i]; - wchar_t tmp[MAX_SIZE]; - wchar_t tmp2[MAX_SIZE]; - wchar_t tmp4[MAX_SIZE]; - IP ip; - char ip_str[MAX_SIZE]; - - // Special treatment for IPv6 addresses - if (StrToIP6(&ip, e->ServerName) && StartWith(e->ServerName, "[") == false) - { - Format(ip_str, sizeof(ip_str), - "[%s]", e->ServerName); - } - else - { - StrCpy(ip_str, sizeof(ip_str), e->ServerName); - } - - if (e->Port == 0) - { - // Port number unknown - UniFormat(tmp2, sizeof(tmp2), L"%S (%s)", ip_str, GetProtocolName(e->ProxyType)); - } - else - { - // Port number are also shown - UniFormat(tmp2, sizeof(tmp2), L"%S:%u (%s)", ip_str, e->Port, GetProtocolName(e->ProxyType)); - } - - // Virtual HUB name - StrToUni(tmp4, sizeof(tmp4), e->HubName); - - // Add - StrToUni(tmp, sizeof(tmp), e->DeviceName); - - CtInsert(ct, - e->AccountName, - e->Active == false ? _UU("CM_ACCOUNT_OFFLINE") : - (e->Connected ? _UU("CM_ACCOUNT_ONLINE") : _UU("CM_ACCOUNT_CONNECTING")), - tmp2, tmp4, - tmp); - } - - CtFreeEx(ct, c, true); - } - - CiFreeClientEnumAccount(&t); - - if (ret != ERR_NO_ERROR) - { - // Error has occurred - CmdPrintError(c, ret); - } - - // Release of the parameter list - FreeParamValueList(o); - - return ret; -} - -// Create new connection settings -UINT PcAccountCreate(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) -{ - LIST *o; - PC *pc = (PC *)param; - UINT ret = ERR_NO_ERROR; - RPC_CLIENT_CREATE_ACCOUNT t; - UINT port = 443; - char *host = NULL; - // Parameter list that can be specified - PARAM args[] = - { - {"[name]", CmdPrompt, _UU("CMD_AccountCreate_Prompt_Name"), CmdEvalNotEmpty, NULL}, - {"SERVER", CmdPrompt, _UU("CMD_AccountCreate_Prompt_Server"), CmdEvalHostAndPort, NULL}, - {"HUB", CmdPrompt, _UU("CMD_AccountCreate_Prompt_Hub"), CmdEvalSafe, NULL}, - {"USERNAME", CmdPrompt, _UU("CMD_AccountCreate_Prompt_Username"), CmdEvalNotEmpty, NULL}, - {"NICNAME", CmdPrompt, _UU("CMD_AccountCreate_Prompt_Nicname"), CmdEvalNotEmpty, NULL}, - }; - - // Get the parameter list - o = ParseCommandList(c, cmd_name, str, args, sizeof(args) / sizeof(args[0])); - if (o == NULL) - { - return ERR_INVALID_PARAMETER; - } - - ParseHostPort(GetParamStr(o, "SERVER"), &host, &port, 443); - - // RPC call - Zero(&t, sizeof(t)); - - t.ClientOption = ZeroMalloc(sizeof(CLIENT_OPTION)); - UniStrCpy(t.ClientOption->AccountName, sizeof(t.ClientOption->AccountName), GetParamUniStr(o, "[name]")); - t.ClientOption->Port = port; - StrCpy(t.ClientOption->Hostname, sizeof(t.ClientOption->Hostname), host); - StrCpy(t.ClientOption->HubName, sizeof(t.ClientOption->HubName), GetParamStr(o, "HUB")); - t.ClientOption->NumRetry = INFINITE; - t.ClientOption->RetryInterval = 15; - t.ClientOption->MaxConnection = 1; - t.ClientOption->UseEncrypt = true; - t.ClientOption->AdditionalConnectionInterval = 1; - StrCpy(t.ClientOption->DeviceName, sizeof(t.ClientOption->DeviceName), GetParamStr(o, "NICNAME")); - - t.ClientAuth = ZeroMalloc(sizeof(CLIENT_AUTH)); - t.ClientAuth->AuthType = CLIENT_AUTHTYPE_ANONYMOUS; - StrCpy(t.ClientAuth->Username, sizeof(t.ClientAuth->Username), GetParamStr(o, "USERNAME")); - - Free(host); - - ret = CcCreateAccount(pc->RemoteClient, &t); - - if (ret == ERR_NO_ERROR) - { - // Success - } - - CiFreeClientCreateAccount(&t); - - if (ret != ERR_NO_ERROR) - { - // Error has occurred - CmdPrintError(c, ret); - } - - // Release of the parameter list - FreeParamValueList(o); - - return ret; -} - -// Set the destination of the connection settings -UINT PcAccountSet(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) -{ - LIST *o; - PC *pc = (PC *)param; - UINT ret = ERR_NO_ERROR; - RPC_CLIENT_GET_ACCOUNT t; - char *host = NULL; - UINT port = 443; - // Parameter list that can be specified - PARAM args[] = - { - {"[name]", CmdPrompt, _UU("CMD_AccountCreate_Prompt_Name"), CmdEvalNotEmpty, NULL}, - {"SERVER", CmdPrompt, _UU("CMD_AccountCreate_Prompt_Server"), CmdEvalHostAndPort, NULL}, - {"HUB", CmdPrompt, _UU("CMD_AccountCreate_Prompt_Hub"), CmdEvalSafe, NULL}, - }; - - // Get the parameter list - o = ParseCommandList(c, cmd_name, str, args, sizeof(args) / sizeof(args[0])); - if (o == NULL) - { - return ERR_INVALID_PARAMETER; - } - - // RPC call - Zero(&t, sizeof(t)); - - ParseHostPort(GetParamStr(o, "SERVER"), &host, &port, 443); - - Zero(&t, sizeof(t)); - UniStrCpy(t.AccountName, sizeof(t.AccountName), GetParamUniStr(o, "[name]")); - - ret = CcGetAccount(pc->RemoteClient, &t); - - if (ret == ERR_NO_ERROR) - { - RPC_CLIENT_CREATE_ACCOUNT c; - // Success - t.ClientOption->Port = port; - StrCpy(t.ClientOption->Hostname, sizeof(t.ClientOption->Hostname), host); - StrCpy(t.ClientOption->HubName, sizeof(t.ClientOption->HubName), GetParamStr(o, "HUB")); - - Zero(&c, sizeof(c)); - - c.ClientAuth = t.ClientAuth; - c.ClientOption = t.ClientOption; - c.CheckServerCert = t.CheckServerCert; - c.RetryOnServerCert = t.RetryOnServerCert; - c.ServerCert = t.ServerCert; - c.StartupAccount = t.StartupAccount; - - ret = CcSetAccount(pc->RemoteClient, &c); - } - - if (ret != ERR_NO_ERROR) - { - // Error has occurred - CmdPrintError(c, ret); - } - - CiFreeClientGetAccount(&t); - - // Release of the parameter list - FreeParamValueList(o); - - Free(host); - - return ret; -} - -// Get the configuration of the connection settings -UINT PcAccountGet(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) -{ - LIST *o; - PC *pc = (PC *)param; - UINT ret = ERR_NO_ERROR; - RPC_CLIENT_GET_ACCOUNT t; - // Parameter list that can be specified - PARAM args[] = - { - {"[name]", CmdPrompt, _UU("CMD_AccountCreate_Prompt_Name"), CmdEvalNotEmpty, NULL}, - }; - - // Get the parameter list - o = ParseCommandList(c, cmd_name, str, args, sizeof(args) / sizeof(args[0])); - if (o == NULL) - { - return ERR_INVALID_PARAMETER; - } - - // RPC call - Zero(&t, sizeof(t)); - UniStrCpy(t.AccountName, sizeof(t.AccountName), GetParamUniStr(o, "[name]")); - - ret = CcGetAccount(pc->RemoteClient, &t); - - if (ret == ERR_NO_ERROR) - { - // Show the contents of the connection settings - wchar_t tmp[MAX_SIZE]; - - CT *ct = CtNewStandard(); - - // Connection settings name - CtInsert(ct, _UU("CMD_ACCOUNT_COLUMN_NAME"), t.ClientOption->AccountName); - - // Host name of the destination VPN Server - StrToUni(tmp, sizeof(tmp), t.ClientOption->Hostname); - CtInsert(ct, _UU("CMD_ACCOUNT_COLUMN_HOSTNAME"), tmp); - - // The port number to connect to VPN Server - UniToStru(tmp, t.ClientOption->Port); - CtInsert(ct, _UU("CMD_ACCOUNT_COLUMN_PORT"), tmp); - - // Virtual HUB name of the destination VPN Server - StrToUni(tmp, sizeof(tmp), t.ClientOption->HubName); - CtInsert(ct, _UU("CMD_ACCOUNT_COLUMN_HUBNAME"), tmp); - - // Type of proxy server to go through - CtInsert(ct, _UU("CMD_ACCOUNT_COLUMN_PROXY_TYPE"), GetProxyTypeStr(t.ClientOption->ProxyType)); - - if (t.ClientOption->ProxyType != PROXY_DIRECT) - { - // Host name of the proxy server - StrToUni(tmp, sizeof(tmp), t.ClientOption->ProxyName); - CtInsert(ct, _UU("CMD_ACCOUNT_COLUMN_PROXY_HOSTNAME"), tmp); - - // Port number of the proxy server - UniToStru(tmp, t.ClientOption->ProxyPort); - CtInsert(ct, _UU("CMD_ACCOUNT_COLUMN_PROXY_PORT"), tmp); - - // User name of the proxy server - StrToUni(tmp, sizeof(tmp), t.ClientOption->ProxyUsername); - CtInsert(ct, _UU("CMD_ACCOUNT_COLUMN_PROXY_USERNAME"), tmp); - } - - // Verify the server certificate - CtInsert(ct, _UU("CMD_ACCOUNT_COLUMN_SERVER_CERT_USE"), - t.CheckServerCert ? _UU("CMD_MSG_ENABLE") : _UU("CMD_MSG_DISABLE")); - - // Registered specific certificate - if (t.ServerCert != NULL) - { - GetAllNameFromX(tmp, sizeof(tmp), t.ServerCert); - CtInsert(ct, _UU("CMD_ACCOUNT_COLUMN_SERVER_CERT_NAME"), tmp); - } - - if (t.CheckServerCert) - { - CtInsert(ct, _UU("CMD_ACCOUNT_COLUMN_RETRY_ON_SERVER_CERT"), - t.RetryOnServerCert ? _UU("CMD_MSG_ENABLE") : _UU("CMD_MSG_DISABLE")); - } - - // Device name to be used for the connection - StrToUni(tmp, sizeof(tmp), t.ClientOption->DeviceName); - CtInsert(ct, _UU("CMD_ACCOUNT_COLUMN_DEVICE_NAME"), tmp); - - // Authentication type - CtInsert(ct, _UU("CMD_ACCOUNT_COLUMN_AUTH_TYPE"), GetClientAuthTypeStr(t.ClientAuth->AuthType)); - - // User name - StrToUni(tmp, sizeof(tmp), t.ClientAuth->Username); - CtInsert(ct, _UU("CMD_ACCOUNT_COLUMN_AUTH_USERNAME"), tmp); - - if (t.ClientAuth->AuthType == CLIENT_AUTHTYPE_CERT) - { - if (t.ClientAuth->ClientX != NULL) - { - // Client certificate name - GetAllNameFromX(tmp, sizeof(tmp), t.ClientAuth->ClientX); - CtInsert(ct, _UU("CMD_ACCOUNT_COLUMN_AUTH_CERT_NAME"), tmp); - } - } - - // Number of TCP connections to be used for VPN communication - UniToStru(tmp, t.ClientOption->MaxConnection); - CtInsert(ct, _UU("CMD_ACCOUNT_COLUMN_NUMTCP"), tmp); - - // Establishment interval of each TCP connection - UniToStru(tmp, t.ClientOption->AdditionalConnectionInterval); - CtInsert(ct, _UU("CMD_ACCOUNT_COLUMN_TCP_INTERVAL"), tmp); - - // Life span of each TCP connection - if (t.ClientOption->ConnectionDisconnectSpan != 0) - { - UniToStru(tmp, t.ClientOption->ConnectionDisconnectSpan); - } - else - { - UniStrCpy(tmp, sizeof(tmp), _UU("CMD_MSG_INFINITE")); - } - CtInsert(ct, _UU("CMD_ACCOUNT_COLUMN_TCP_TTL"), tmp); - - // Use of half-duplex mode - CtInsert(ct, _UU("CMD_ACCOUNT_COLUMN_TCP_HALF"), - t.ClientOption->HalfConnection ? _UU("CMD_MSG_ENABLE") : _UU("CMD_MSG_DISABLE")); - - // Encryption by SSL - CtInsert(ct, _UU("CMD_ACCOUNT_COLUMN_ENCRYPT"), - t.ClientOption->UseEncrypt ? _UU("CMD_MSG_ENABLE") : _UU("CMD_MSG_DISABLE")); - - // Data compression - CtInsert(ct, _UU("CMD_ACCOUNT_COLUMN_COMPRESS"), - t.ClientOption->UseCompress ? _UU("CMD_MSG_ENABLE") : _UU("CMD_MSG_DISABLE")); - - // Connect in bridge / router mode - CtInsert(ct, _UU("CMD_ACCOUNT_COLUMN_BRIDGE_ROUTER"), - t.ClientOption->RequireBridgeRoutingMode ? _UU("CMD_MSG_ENABLE") : _UU("CMD_MSG_DISABLE")); - - // Connect in monitoring mode - CtInsert(ct, _UU("CMD_ACCOUNT_COLUMN_MONITOR"), - t.ClientOption->RequireMonitorMode ? _UU("CMD_MSG_ENABLE") : _UU("CMD_MSG_DISABLE")); - - // Not to rewrite the routing table - CtInsert(ct, _UU("CMD_ACCOUNT_COLUMN_NO_TRACKING"), - t.ClientOption->NoRoutingTracking ? _UU("CMD_MSG_ENABLE") : _UU("CMD_MSG_DISABLE")); - - // Disable the QoS control - CtInsert(ct, _UU("CMD_ACCOUNT_COLUMN_QOS_DISABLE"), - t.ClientOption->DisableQoS ? _UU("CMD_MSG_ENABLE") : _UU("CMD_MSG_DISABLE")); - - // Disable UDP Acceleration - CtInsert(ct, _UU("CMD_ACCOUNT_COLUMN_DISABLEUDP"), - t.ClientOption->NoUdpAcceleration ? _UU("CMD_MSG_ENABLE") : _UU("CMD_MSG_DISABLE")); - - CtFree(ct, c); - } - - if (ret != ERR_NO_ERROR) - { - // Error has occurred - CmdPrintError(c, ret); - } - - CiFreeClientGetAccount(&t); - - // Release of the parameter list - FreeParamValueList(o); - - return ret; -} - -// Delete the connection settings -UINT PcAccountDelete(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) -{ - LIST *o; - PC *pc = (PC *)param; - UINT ret = ERR_NO_ERROR; - RPC_CLIENT_DELETE_ACCOUNT t; - // Parameter list that can be specified - PARAM args[] = - { - {"[name]", CmdPrompt, _UU("CMD_AccountCreate_Prompt_Name"), CmdEvalNotEmpty, NULL}, - }; - - // Get the parameter list - o = ParseCommandList(c, cmd_name, str, args, sizeof(args) / sizeof(args[0])); - if (o == NULL) - { - return ERR_INVALID_PARAMETER; - } - - // RPC call - Zero(&t, sizeof(t)); - - UniStrCpy(t.AccountName, sizeof(t.AccountName), GetParamUniStr(o, "[name]")); - - ret = CcDeleteAccount(pc->RemoteClient, &t); - - if (ret == ERR_NO_ERROR) - { - // Success - } - - if (ret != ERR_NO_ERROR) - { - // Error has occurred - CmdPrintError(c, ret); - } - - // Release of the parameter list - FreeParamValueList(o); - - return ret; -} - -// Set the user name used to connect with connection settings -UINT PcAccountUsernameSet(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) -{ - LIST *o; - PC *pc = (PC *)param; - UINT ret = ERR_NO_ERROR; - RPC_CLIENT_GET_ACCOUNT t; - // Parameter list that can be specified - PARAM args[] = - { - {"[name]", CmdPrompt, _UU("CMD_AccountCreate_Prompt_Name"), CmdEvalNotEmpty, NULL}, - {"USERNAME", CmdPrompt, _UU("CMD_AccountCreate_Prompt_Username"), CmdEvalNotEmpty, NULL}, - }; - - // Get the parameter list - o = ParseCommandList(c, cmd_name, str, args, sizeof(args) / sizeof(args[0])); - if (o == NULL) - { - return ERR_INVALID_PARAMETER; - } - - // RPC call - Zero(&t, sizeof(t)); - - UniStrCpy(t.AccountName, sizeof(t.AccountName), GetParamUniStr(o, "[name]")); - - ret = CcGetAccount(pc->RemoteClient, &t); - - if (ret == ERR_NO_ERROR) - { - RPC_CLIENT_CREATE_ACCOUNT z; - // Change the settings - StrCpy(t.ClientAuth->Username, sizeof(t.ClientAuth->Username), GetParamStr(o, "USERNAME")); - - if (t.ClientAuth->AuthType == CLIENT_AUTHTYPE_PASSWORD) - { - c->Write(c, _UU("CMD_AccountUsername_Notice")); - } - - Zero(&z, sizeof(z)); - z.CheckServerCert = t.CheckServerCert; - z.RetryOnServerCert = t.RetryOnServerCert; - z.ClientAuth = t.ClientAuth; - z.ClientOption = t.ClientOption; - z.ServerCert = t.ServerCert; - z.StartupAccount = t.StartupAccount; - - ret = CcSetAccount(pc->RemoteClient, &z); - } - - if (ret != ERR_NO_ERROR) - { - // Error has occurred - CmdPrintError(c, ret); - } - - CiFreeClientGetAccount(&t); - - // Release of the parameter list - FreeParamValueList(o); - - return ret; -} - -// Set the type of user authentication of connection settings to anonymous authentication -UINT PcAccountAnonymousSet(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) -{ - LIST *o; - PC *pc = (PC *)param; - UINT ret = ERR_NO_ERROR; - RPC_CLIENT_GET_ACCOUNT t; - // Parameter list that can be specified - PARAM args[] = - { - {"[name]", CmdPrompt, _UU("CMD_AccountCreate_Prompt_Name"), CmdEvalNotEmpty, NULL}, - }; - - // Get the parameter list - o = ParseCommandList(c, cmd_name, str, args, sizeof(args) / sizeof(args[0])); - if (o == NULL) - { - return ERR_INVALID_PARAMETER; - } - - // RPC call - Zero(&t, sizeof(t)); - - UniStrCpy(t.AccountName, sizeof(t.AccountName), GetParamUniStr(o, "[name]")); - - ret = CcGetAccount(pc->RemoteClient, &t); - - if (ret == ERR_NO_ERROR) - { - RPC_CLIENT_CREATE_ACCOUNT z; - // Change the settings - t.ClientAuth->AuthType = CLIENT_AUTHTYPE_ANONYMOUS; - - Zero(&z, sizeof(z)); - z.CheckServerCert = t.CheckServerCert; - z.RetryOnServerCert = t.RetryOnServerCert; - z.ClientAuth = t.ClientAuth; - z.ClientOption = t.ClientOption; - z.ServerCert = t.ServerCert; - z.StartupAccount = t.StartupAccount; - - ret = CcSetAccount(pc->RemoteClient, &z); - } - - if (ret != ERR_NO_ERROR) - { - // Error has occurred - CmdPrintError(c, ret); - } - - CiFreeClientGetAccount(&t); - - // Release of the parameter list - FreeParamValueList(o); - - return ret; -} - -// Set the type of user authentication of connection settings to the password authentication -UINT PcAccountPasswordSet(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) -{ - LIST *o; - PC *pc = (PC *)param; - UINT ret = ERR_NO_ERROR; - RPC_CLIENT_GET_ACCOUNT t; - // Parameter list that can be specified - PARAM args[] = - { - {"[name]", CmdPrompt, _UU("CMD_AccountCreate_Prompt_Name"), CmdEvalNotEmpty, NULL}, - {"PASSWORD", CmdPromptChoosePassword, NULL, NULL, NULL}, - {"TYPE", CmdPrompt, _UU("CMD_CascadePasswordSet_Prompt_Type"), CmdEvalNotEmpty, NULL}, - }; - - // Get the parameter list - o = ParseCommandList(c, cmd_name, str, args, sizeof(args) / sizeof(args[0])); - if (o == NULL) - { - return ERR_INVALID_PARAMETER; - } - - // RPC call - Zero(&t, sizeof(t)); - - UniStrCpy(t.AccountName, sizeof(t.AccountName), GetParamUniStr(o, "[name]")); - - ret = CcGetAccount(pc->RemoteClient, &t); - - if (ret == ERR_NO_ERROR) - { - char *typestr = GetParamStr(o, "TYPE"); - RPC_CLIENT_CREATE_ACCOUNT z; - - // Change the settings - if (StartWith("standard", typestr)) - { - t.ClientAuth->AuthType = CLIENT_AUTHTYPE_PASSWORD; - HashPassword(t.ClientAuth->HashedPassword, t.ClientAuth->Username, - GetParamStr(o, "PASSWORD")); - } - else if (StartWith("radius", typestr) || StartWith("ntdomain", typestr)) - { - t.ClientAuth->AuthType = CLIENT_AUTHTYPE_PLAIN_PASSWORD; - - StrCpy(t.ClientAuth->PlainPassword, sizeof(t.ClientAuth->PlainPassword), - GetParamStr(o, "PASSWORD")); - } - else - { - // Error has occured - c->Write(c, _UU("CMD_CascadePasswordSet_Type_Invalid")); - ret = ERR_INVALID_PARAMETER; - } - - if (ret == ERR_NO_ERROR) - { - Zero(&z, sizeof(z)); - z.CheckServerCert = t.CheckServerCert; - z.RetryOnServerCert = t.RetryOnServerCert; - z.ClientAuth = t.ClientAuth; - z.ClientOption = t.ClientOption; - z.ServerCert = t.ServerCert; - z.StartupAccount = t.StartupAccount; - - ret = CcSetAccount(pc->RemoteClient, &z); - } - } - - if (ret != ERR_NO_ERROR) - { - // Error has occurred - CmdPrintError(c, ret); - } - - CiFreeClientGetAccount(&t); - - // Release of the parameter list - FreeParamValueList(o); - - return ret; -} - -// Set the type of user authentication of connection settings to the client certificate authentication -UINT PcAccountCertSet(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) -{ - LIST *o; - PC *pc = (PC *)param; - UINT ret = ERR_NO_ERROR; - RPC_CLIENT_GET_ACCOUNT t; - X *x; - K *k; - // Parameter list that can be specified - PARAM args[] = - { - {"[name]", CmdPrompt, _UU("CMD_CascadeCreate_Prompt_Name"), CmdEvalNotEmpty, NULL}, - {"LOADCERT", CmdPrompt, _UU("CMD_LOADCERTPATH"), CmdEvalIsFile, NULL}, - {"LOADKEY", CmdPrompt, _UU("CMD_LOADKEYPATH"), CmdEvalIsFile, NULL}, - }; - - // Get the parameter list - o = ParseCommandList(c, cmd_name, str, args, sizeof(args) / sizeof(args[0])); - if (o == NULL) - { - return ERR_INVALID_PARAMETER; - } - - if (CmdLoadCertAndKey(c, &x, &k, GetParamUniStr(o, "LOADCERT"), GetParamUniStr(o, "LOADKEY")) == false) - { - return ERR_INTERNAL_ERROR; - } - - // RPC call - Zero(&t, sizeof(t)); - - UniStrCpy(t.AccountName, sizeof(t.AccountName), GetParamUniStr(o, "[name]")); - - ret = CcGetAccount(pc->RemoteClient, &t); - - if (ret == ERR_NO_ERROR) - { - RPC_CLIENT_CREATE_ACCOUNT z; - - t.ClientAuth->AuthType = CLIENT_AUTHTYPE_CERT; - if (t.ClientAuth->ClientX != NULL) - { - FreeX(t.ClientAuth->ClientX); - } - if (t.ClientAuth->ClientK != NULL) - { - FreeK(t.ClientAuth->ClientK); - } - - t.ClientAuth->ClientX = CloneX(x); - t.ClientAuth->ClientK = CloneK(k); - - Zero(&z, sizeof(z)); - z.CheckServerCert = t.CheckServerCert; - z.RetryOnServerCert = t.RetryOnServerCert; - z.ClientAuth = t.ClientAuth; - z.ClientOption = t.ClientOption; - z.ServerCert = t.ServerCert; - z.StartupAccount = t.StartupAccount; - - ret = CcSetAccount(pc->RemoteClient, &z); - } - - if (ret != ERR_NO_ERROR) - { - // Error has occurred - CmdPrintError(c, ret); - } - - FreeX(x); - FreeK(k); - - CiFreeClientGetAccount(&t); - - // Release of the parameter list - FreeParamValueList(o); - - return ret; -} - -// Get the client certificate to be used for the connection settings -UINT PcAccountCertGet(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) -{ - LIST *o; - PC *pc = (PC *)param; - UINT ret = ERR_NO_ERROR; - RPC_CLIENT_GET_ACCOUNT t; - // Parameter list that can be specified - PARAM args[] = - { - {"[name]", CmdPrompt, _UU("CMD_CascadeCreate_Prompt_Name"), CmdEvalNotEmpty, NULL}, - {"SAVECERT", CmdPrompt, _UU("CMD_SAVECERTPATH"), CmdEvalNotEmpty, NULL}, - }; - - // Get the parameter list - o = ParseCommandList(c, cmd_name, str, args, sizeof(args) / sizeof(args[0])); - if (o == NULL) - { - return ERR_INVALID_PARAMETER; - } - - // RPC call - Zero(&t, sizeof(t)); - - UniStrCpy(t.AccountName, sizeof(t.AccountName), GetParamUniStr(o, "[name]")); - - ret = CcGetAccount(pc->RemoteClient, &t); - - if (ret == ERR_NO_ERROR) - { - if (t.ClientAuth->AuthType != CLIENT_AUTHTYPE_CERT && t.ClientAuth->AuthType != CLIENT_AUTHTYPE_OPENSSLENGINE) - { - c->Write(c, _UU("CMD_CascadeCertSet_Not_Auth_Cert")); - ret = ERR_INTERNAL_ERROR; - } - else if (t.ClientAuth->ClientX == NULL) - { - c->Write(c, _UU("CMD_CascadeCertSet_Cert_Not_Exists")); - ret = ERR_INTERNAL_ERROR; - } - else - { - XToFileW(t.ClientAuth->ClientX, GetParamUniStr(o, "SAVECERT"), true); - } - } - - CiFreeClientGetAccount(&t); - - if (ret != ERR_NO_ERROR) - { - // Error has occurred - CmdPrintError(c, ret); - } - - // Release of the parameter list - FreeParamValueList(o); - - return ret; -} - -// Disable communication encryption with the connection settings -UINT PcAccountEncryptDisable(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) -{ - LIST *o; - PC *pc = (PC *)param; - UINT ret = ERR_NO_ERROR; - RPC_CLIENT_GET_ACCOUNT t; - // Parameter list that can be specified - PARAM args[] = - { - {"[name]", CmdPrompt, _UU("CMD_AccountCreate_Prompt_Name"), CmdEvalNotEmpty, NULL}, - }; - - // Get the parameter list - o = ParseCommandList(c, cmd_name, str, args, sizeof(args) / sizeof(args[0])); - if (o == NULL) - { - return ERR_INVALID_PARAMETER; - } - - // RPC call - Zero(&t, sizeof(t)); - - UniStrCpy(t.AccountName, sizeof(t.AccountName), GetParamUniStr(o, "[name]")); - - ret = CcGetAccount(pc->RemoteClient, &t); - - if (ret == ERR_NO_ERROR) - { - RPC_CLIENT_CREATE_ACCOUNT z; - // Change the settings - t.ClientOption->UseEncrypt = false; - - Zero(&z, sizeof(z)); - z.CheckServerCert = t.CheckServerCert; - z.RetryOnServerCert = t.RetryOnServerCert; - z.ClientAuth = t.ClientAuth; - z.ClientOption = t.ClientOption; - z.ServerCert = t.ServerCert; - z.StartupAccount = t.StartupAccount; - - ret = CcSetAccount(pc->RemoteClient, &z); - } - - if (ret != ERR_NO_ERROR) - { - // Error has occurred - CmdPrintError(c, ret); - } - - CiFreeClientGetAccount(&t); - - // Release of the parameter list - FreeParamValueList(o); - - return ret; -} - -// Enable communication encryption with the connection settings -UINT PcAccountEncryptEnable(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) -{ - LIST *o; - PC *pc = (PC *)param; - UINT ret = ERR_NO_ERROR; - RPC_CLIENT_GET_ACCOUNT t; - // Parameter list that can be specified - PARAM args[] = - { - {"[name]", CmdPrompt, _UU("CMD_AccountCreate_Prompt_Name"), CmdEvalNotEmpty, NULL}, - }; - - // Get the parameter list - o = ParseCommandList(c, cmd_name, str, args, sizeof(args) / sizeof(args[0])); - if (o == NULL) - { - return ERR_INVALID_PARAMETER; - } - - // RPC call - Zero(&t, sizeof(t)); - - UniStrCpy(t.AccountName, sizeof(t.AccountName), GetParamUniStr(o, "[name]")); - - ret = CcGetAccount(pc->RemoteClient, &t); - - if (ret == ERR_NO_ERROR) - { - RPC_CLIENT_CREATE_ACCOUNT z; - // Change the settings - t.ClientOption->UseEncrypt = true; - - Zero(&z, sizeof(z)); - z.CheckServerCert = t.CheckServerCert; - z.RetryOnServerCert = t.RetryOnServerCert; - z.ClientAuth = t.ClientAuth; - z.ClientOption = t.ClientOption; - z.ServerCert = t.ServerCert; - z.StartupAccount = t.StartupAccount; - - ret = CcSetAccount(pc->RemoteClient, &z); - } - - if (ret != ERR_NO_ERROR) - { - // Error has occurred - CmdPrintError(c, ret); - } - - CiFreeClientGetAccount(&t); - - // Release of the parameter list - FreeParamValueList(o); - - return ret; -} - -// Enable communication data compression with the connection settings -UINT PcAccountCompressEnable(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) -{ - LIST *o; - PC *pc = (PC *)param; - UINT ret = ERR_NO_ERROR; - RPC_CLIENT_GET_ACCOUNT t; - // Parameter list that can be specified - PARAM args[] = - { - {"[name]", CmdPrompt, _UU("CMD_AccountCreate_Prompt_Name"), CmdEvalNotEmpty, NULL}, - }; - - // Get the parameter list - o = ParseCommandList(c, cmd_name, str, args, sizeof(args) / sizeof(args[0])); - if (o == NULL) - { - return ERR_INVALID_PARAMETER; - } - - // RPC call - Zero(&t, sizeof(t)); - - UniStrCpy(t.AccountName, sizeof(t.AccountName), GetParamUniStr(o, "[name]")); - - ret = CcGetAccount(pc->RemoteClient, &t); - - if (ret == ERR_NO_ERROR) - { - RPC_CLIENT_CREATE_ACCOUNT z; - // Change the settings - t.ClientOption->UseCompress = true; - - Zero(&z, sizeof(z)); - z.CheckServerCert = t.CheckServerCert; - z.RetryOnServerCert = t.RetryOnServerCert; - z.ClientAuth = t.ClientAuth; - z.ClientOption = t.ClientOption; - z.ServerCert = t.ServerCert; - z.StartupAccount = t.StartupAccount; - - ret = CcSetAccount(pc->RemoteClient, &z); - } - - if (ret != ERR_NO_ERROR) - { - // Error has occurred - CmdPrintError(c, ret); - } - - CiFreeClientGetAccount(&t); - - // Release of the parameter list - FreeParamValueList(o); - - return ret; -} - -// Disable communication data compression with the connection settings -UINT PcAccountCompressDisable(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) -{ - LIST *o; - PC *pc = (PC *)param; - UINT ret = ERR_NO_ERROR; - RPC_CLIENT_GET_ACCOUNT t; - // Parameter list that can be specified - PARAM args[] = - { - {"[name]", CmdPrompt, _UU("CMD_AccountCreate_Prompt_Name"), CmdEvalNotEmpty, NULL}, - }; - - // Get the parameter list - o = ParseCommandList(c, cmd_name, str, args, sizeof(args) / sizeof(args[0])); - if (o == NULL) - { - return ERR_INVALID_PARAMETER; - } - - // RPC call - Zero(&t, sizeof(t)); - - UniStrCpy(t.AccountName, sizeof(t.AccountName), GetParamUniStr(o, "[name]")); - - ret = CcGetAccount(pc->RemoteClient, &t); - - if (ret == ERR_NO_ERROR) - { - RPC_CLIENT_CREATE_ACCOUNT z; - // Change the settings - t.ClientOption->UseCompress = false; - - Zero(&z, sizeof(z)); - z.CheckServerCert = t.CheckServerCert; - z.RetryOnServerCert = t.RetryOnServerCert; - z.ClientAuth = t.ClientAuth; - z.ClientOption = t.ClientOption; - z.ServerCert = t.ServerCert; - z.StartupAccount = t.StartupAccount; - - ret = CcSetAccount(pc->RemoteClient, &z); - } - - if (ret != ERR_NO_ERROR) - { - // Error has occurred - CmdPrintError(c, ret); - } - - CiFreeClientGetAccount(&t); - - // Release of the parameter list - FreeParamValueList(o); - - return ret; -} - -UINT PcAccountHttpHeaderAdd(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) -{ - LIST *o; - PC *pc = (PC *)param; - UINT ret = ERR_NO_ERROR; - RPC_CLIENT_GET_ACCOUNT t; - - // Parameter list that can be specified - PARAM args[] = - { - {"[name]", CmdPrompt, _UU("CMD_AccountCreate_Prompt_Name"), CmdEvalNotEmpty, NULL}, - {"NAME", CmdPrompt, _UU("CMD_AccountHttpHeader_Prompt_Name"), CmdEvalNotEmpty, NULL}, - {"DATA", CmdPrompt, _UU("CMD_AccountHttpHeader_Prompt_Data"), NULL, NULL}, - }; - - // Get the parameter list - o = ParseCommandList(c, cmd_name, str, args, sizeof(args) / sizeof(args[0])); - if (o == NULL) - { - return ERR_INVALID_PARAMETER; - } - - // RPC call - Zero(&t, sizeof(t)); - UniStrCpy(t.AccountName, sizeof(t.AccountName), GetParamUniStr(o, "[name]")); - ret = CcGetAccount(pc->RemoteClient, &t); - - if (ret == ERR_NO_ERROR) - { - UINT i = 0; - TOKEN_LIST *tokens = NULL; - HTTP_HEADER *header = NULL; - char *name = GetParamStr(o, "NAME"); - - Trim(name); - - header = NewHttpHeader("", "", ""); - - tokens = ParseToken(t.ClientOption->CustomHttpHeader, "\r\n"); - for (i = 0; i < tokens->NumTokens; i++) - { - AddHttpValueStr(header, tokens->Token[i]); - } - FreeToken(tokens); - - if (GetHttpValue(header, name) == NULL) - { - RPC_CLIENT_CREATE_ACCOUNT z; - char s[HTTP_CUSTOM_HEADER_MAX_SIZE]; - - Format(s, sizeof(s), "%s: %s\r\n", name, GetParamStr(o, "DATA")); - EnSafeHttpHeaderValueStr(s, ' '); - - if ((StrLen(s) + StrLen(t.ClientOption->CustomHttpHeader)) < sizeof(t.ClientOption->CustomHttpHeader)) { - StrCat(t.ClientOption->CustomHttpHeader, sizeof(s), s); - - Zero(&z, sizeof(z)); - z.CheckServerCert = t.CheckServerCert; - z.RetryOnServerCert = t.RetryOnServerCert; - z.ClientAuth = t.ClientAuth; - z.ClientOption = t.ClientOption; - z.ServerCert = t.ServerCert; - z.StartupAccount = t.StartupAccount; - - ret = CcSetAccount(pc->RemoteClient, &z); - } - else - { - // Error has occurred - ret = ERR_TOO_MANT_ITEMS; - } - } - else - { - // Error has occurred - ret = ERR_OBJECT_EXISTS; - } - - FreeHttpHeader(header); - } - - if (ret != ERR_NO_ERROR) - { - // Error has occurred - CmdPrintError(c, ret); - } - - CiFreeClientGetAccount(&t); - - // Release of the parameter list - FreeParamValueList(o); - - return ret; -} - -UINT PcAccountHttpHeaderDelete(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) -{ - PC *pc = (PC *)param; - UINT ret = ERR_NO_ERROR; - RPC_CLIENT_GET_ACCOUNT t; - - // Parameter list that can be specified - PARAM args[] = - { - {"[name]", CmdPrompt, _UU("CMD_AccountCreate_Prompt_Name"), CmdEvalNotEmpty, NULL}, - {"NAME", CmdPrompt, _UU("CMD_AccountHttpHeader_Prompt_Name"), CmdEvalNotEmpty, NULL}, - }; - - // Get the parameter list - LIST *o = ParseCommandList(c, cmd_name, str, args, sizeof(args) / sizeof(args[0])); - if (o == NULL) - { - return ERR_INVALID_PARAMETER; - } - - // RPC call - Zero(&t, sizeof(t)); - UniStrCpy(t.AccountName, sizeof(t.AccountName), GetParamUniStr(o, "[name]")); - ret = CcGetAccount(pc->RemoteClient, &t); - - if (ret == ERR_NO_ERROR) - { - UINT i = 0; - TOKEN_LIST *tokens = NULL; - RPC_CLIENT_CREATE_ACCOUNT z; - char *value = GetParamStr(o, "NAME"); - - Zero(&z, sizeof(z)); - z.CheckServerCert = t.CheckServerCert; - z.RetryOnServerCert = t.RetryOnServerCert; - z.ClientAuth = t.ClientAuth; - z.ClientOption = t.ClientOption; - z.ServerCert = t.ServerCert; - z.StartupAccount = t.StartupAccount; - - Zero(z.ClientOption->CustomHttpHeader, sizeof(z.ClientOption->CustomHttpHeader)); - - tokens = ParseToken(t.ClientOption->CustomHttpHeader, "\r\n"); - - for (i = 0; i < tokens->NumTokens; i++) - { - if (StartWith(tokens->Token[i], value) == false) - { - StrCat(z.ClientOption->CustomHttpHeader, sizeof(z.ClientOption->CustomHttpHeader), tokens->Token[i]); - StrCat(z.ClientOption->CustomHttpHeader, 1, "\r\n"); - } - } - - ret = CcSetAccount(pc->RemoteClient, &z); - } - else - { - // Error has occurred - CmdPrintError(c, ret); - } - - CiFreeClientGetAccount(&t); - - // Release of the parameter list - FreeParamValueList(o); - - return ret; -} - -UINT PcAccountHttpHeaderGet(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) -{ - PC *pc = (PC *)param; - UINT ret = ERR_NO_ERROR; - RPC_CLIENT_GET_ACCOUNT t; - - // Parameter list that can be specified - PARAM args[] = - { - {"[name]", CmdPrompt, _UU("CMD_AccountCreate_Prompt_Name"), CmdEvalNotEmpty, NULL}, - }; - - // Get the parameter list - LIST *o = ParseCommandList(c, cmd_name, str, args, sizeof(args) / sizeof(args[0])); - if (o == NULL) - { - return ERR_INVALID_PARAMETER; - } - - // RPC call - Zero(&t, sizeof(t)); - UniStrCpy(t.AccountName, sizeof(t.AccountName), GetParamUniStr(o, "[name]")); - ret = CcGetAccount(pc->RemoteClient, &t); - - // Release of the parameter list - FreeParamValueList(o); - - if (ret == ERR_NO_ERROR) - { - wchar_t unistr[HTTP_CUSTOM_HEADER_MAX_SIZE]; - TOKEN_LIST *tokens = NULL; - UINT i = 0; - CT *ct = CtNew(); - CtInsertColumn(ct, _UU("CMD_CT_STD_COLUMN_1"), false); - - tokens = ParseToken(t.ClientOption->CustomHttpHeader, "\r\n"); - - for (i = 0; i < tokens->NumTokens; i++) - { - StrToUni(unistr, sizeof(unistr), tokens->Token[i]); - CtInsert(ct, unistr); - } - - CtFreeEx(ct, c, false); - } - else - { - // Error has occurred - CmdPrintError(c, ret); - } - - CiFreeClientGetAccount(&t); - - return ret; -} - -// Set the connection method of the connection settings to the direct TCP/IP connection -UINT PcAccountProxyNone(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) -{ - LIST *o; - PC *pc = (PC *)param; - UINT ret = ERR_NO_ERROR; - RPC_CLIENT_GET_ACCOUNT t; - // Parameter list that can be specified - PARAM args[] = - { - {"[name]", CmdPrompt, _UU("CMD_AccountCreate_Prompt_Name"), CmdEvalNotEmpty, NULL}, - }; - - // Get the parameter list - o = ParseCommandList(c, cmd_name, str, args, sizeof(args) / sizeof(args[0])); - if (o == NULL) - { - return ERR_INVALID_PARAMETER; - } - - // RPC call - Zero(&t, sizeof(t)); - - UniStrCpy(t.AccountName, sizeof(t.AccountName), GetParamUniStr(o, "[name]")); - - ret = CcGetAccount(pc->RemoteClient, &t); - - if (ret == ERR_NO_ERROR) - { - RPC_CLIENT_CREATE_ACCOUNT z; - // Change the settings - t.ClientOption->ProxyType = PROXY_DIRECT; - - Zero(&z, sizeof(z)); - z.CheckServerCert = t.CheckServerCert; - z.RetryOnServerCert = t.RetryOnServerCert; - z.ClientAuth = t.ClientAuth; - z.ClientOption = t.ClientOption; - z.ServerCert = t.ServerCert; - z.StartupAccount = t.StartupAccount; - - ret = CcSetAccount(pc->RemoteClient, &z); - } - - if (ret != ERR_NO_ERROR) - { - // Error has occurred - CmdPrintError(c, ret); - } - - CiFreeClientGetAccount(&t); - - // Release of the parameter list - FreeParamValueList(o); - - return ret; -} - -// Set the connection method of the connection settings to the HTTP proxy server connection -UINT PcAccountProxyHttp(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) -{ - LIST *o; - PC *pc = (PC *)param; - UINT ret = ERR_NO_ERROR; - RPC_CLIENT_GET_ACCOUNT t; - // Parameter list that can be specified - PARAM args[] = - { - {"[name]", CmdPrompt, _UU("CMD_AccountCreate_Prompt_Name"), CmdEvalNotEmpty, NULL}, - {"SERVER", CmdPrompt, _UU("CMD_AccountProxyHttp_Prompt_Server"), CmdEvalHostAndPort, NULL}, - {"USERNAME", NULL, NULL, NULL, NULL}, - {"PASSWORD", NULL, NULL, NULL, NULL}, - }; - - // Get the parameter list - o = ParseCommandList(c, cmd_name, str, args, sizeof(args) / sizeof(args[0])); - if (o == NULL) - { - return ERR_INVALID_PARAMETER; - } - - // RPC call - Zero(&t, sizeof(t)); - - UniStrCpy(t.AccountName, sizeof(t.AccountName), GetParamUniStr(o, "[name]")); - - ret = CcGetAccount(pc->RemoteClient, &t); - - if (ret == ERR_NO_ERROR) - { - RPC_CLIENT_CREATE_ACCOUNT z; - char *host; - UINT port; - - // Data change - if (ParseHostPort(GetParamStr(o, "SERVER"), &host, &port, 8080)) - { - t.ClientOption->ProxyType = PROXY_HTTP; - StrCpy(t.ClientOption->ProxyName, sizeof(t.ClientOption->ProxyName), host); - t.ClientOption->ProxyPort = port; - StrCpy(t.ClientOption->ProxyUsername, sizeof(t.ClientOption->ProxyName), GetParamStr(o, "USERNAME")); - StrCpy(t.ClientOption->ProxyPassword, sizeof(t.ClientOption->ProxyName), GetParamStr(o, "PASSWORD")); - Free(host); - } - - Zero(&z, sizeof(z)); - z.CheckServerCert = t.CheckServerCert; - z.RetryOnServerCert = t.RetryOnServerCert; - z.ClientAuth = t.ClientAuth; - z.ClientOption = t.ClientOption; - z.ServerCert = t.ServerCert; - z.StartupAccount = t.StartupAccount; - - ret = CcSetAccount(pc->RemoteClient, &z); - } - - if (ret != ERR_NO_ERROR) - { - // Error has occurred - CmdPrintError(c, ret); - } - - CiFreeClientGetAccount(&t); - - // Release of the parameter list - FreeParamValueList(o); - - return ret; -} - -// Set the connection method of the connection settings to the SOCKS4 proxy server connection -UINT PcAccountProxySocks(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) -{ - LIST *o; - PC *pc = (PC *)param; - UINT ret = ERR_NO_ERROR; - RPC_CLIENT_GET_ACCOUNT t; - // Parameter list that can be specified - PARAM args[] = - { - {"[name]", CmdPrompt, _UU("CMD_AccountCreate_Prompt_Name"), CmdEvalNotEmpty, NULL}, - {"SERVER", CmdPrompt, _UU("CMD_AccountProxyHttp_Prompt_Server"), CmdEvalHostAndPort, NULL}, - {"USERNAME", NULL, NULL, NULL, NULL}, - {"PASSWORD", NULL, NULL, NULL, NULL}, - }; - - // Get the parameter list - o = ParseCommandList(c, cmd_name, str, args, sizeof(args) / sizeof(args[0])); - if (o == NULL) - { - return ERR_INVALID_PARAMETER; - } - - // RPC call - Zero(&t, sizeof(t)); - - UniStrCpy(t.AccountName, sizeof(t.AccountName), GetParamUniStr(o, "[name]")); - - ret = CcGetAccount(pc->RemoteClient, &t); - - if (ret == ERR_NO_ERROR) - { - RPC_CLIENT_CREATE_ACCOUNT z; - char *host; - UINT port; - - // Data change - if (ParseHostPort(GetParamStr(o, "SERVER"), &host, &port, 1080)) - { - t.ClientOption->ProxyType = PROXY_SOCKS; - StrCpy(t.ClientOption->ProxyName, sizeof(t.ClientOption->ProxyName), host); - t.ClientOption->ProxyPort = port; - StrCpy(t.ClientOption->ProxyUsername, sizeof(t.ClientOption->ProxyName), GetParamStr(o, "USERNAME")); - StrCpy(t.ClientOption->ProxyPassword, sizeof(t.ClientOption->ProxyName), GetParamStr(o, "PASSWORD")); - Free(host); - } - - Zero(&z, sizeof(z)); - z.CheckServerCert = t.CheckServerCert; - z.RetryOnServerCert = t.RetryOnServerCert; - z.ClientAuth = t.ClientAuth; - z.ClientOption = t.ClientOption; - z.ServerCert = t.ServerCert; - z.StartupAccount = t.StartupAccount; - - ret = CcSetAccount(pc->RemoteClient, &z); - } - - if (ret != ERR_NO_ERROR) - { - // Error has occurred - CmdPrintError(c, ret); - } - - CiFreeClientGetAccount(&t); - - // Release of the parameter list - FreeParamValueList(o); - - return ret; -} - -// Set the connection method of the connection settings to the SOCKS5 proxy server connection -UINT PcAccountProxySocks5(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) -{ - LIST *o; - PC *pc = (PC *)param; - UINT ret = ERR_NO_ERROR; - RPC_CLIENT_GET_ACCOUNT t; - // Parameter list that can be specified - PARAM args[] = - { - {"[name]", CmdPrompt, _UU("CMD_AccountCreate_Prompt_Name"), CmdEvalNotEmpty, NULL}, - {"SERVER", CmdPrompt, _UU("CMD_AccountProxyHttp_Prompt_Server"), CmdEvalHostAndPort, NULL}, - {"USERNAME", CmdPrompt, NULL, NULL, NULL}, - {"PASSWORD", CmdPrompt, NULL, NULL, NULL}, - }; - - // Get the parameter list - o = ParseCommandList(c, cmd_name, str, args, sizeof(args) / sizeof(args[0])); - if (o == NULL) - { - return ERR_INVALID_PARAMETER; - } - - // RPC call - Zero(&t, sizeof(t)); - - UniStrCpy(t.AccountName, sizeof(t.AccountName), GetParamUniStr(o, "[name]")); - - ret = CcGetAccount(pc->RemoteClient, &t); - - if (ret == ERR_NO_ERROR) - { - RPC_CLIENT_CREATE_ACCOUNT z; - char *host; - UINT port; - - // Data change - if (ParseHostPort(GetParamStr(o, "SERVER"), &host, &port, 1080)) - { - t.ClientOption->ProxyType = PROXY_SOCKS5; - StrCpy(t.ClientOption->ProxyName, sizeof(t.ClientOption->ProxyName), host); - t.ClientOption->ProxyPort = port; - StrCpy(t.ClientOption->ProxyUsername, sizeof(t.ClientOption->ProxyName), GetParamStr(o, "USERNAME")); - StrCpy(t.ClientOption->ProxyPassword, sizeof(t.ClientOption->ProxyName), GetParamStr(o, "PASSWORD")); - Free(host); - } - - Zero(&z, sizeof(z)); - z.CheckServerCert = t.CheckServerCert; - z.RetryOnServerCert = t.RetryOnServerCert; - z.ClientAuth = t.ClientAuth; - z.ClientOption = t.ClientOption; - z.ServerCert = t.ServerCert; - z.StartupAccount = t.StartupAccount; - - ret = CcSetAccount(pc->RemoteClient, &z); - } - - if (ret != ERR_NO_ERROR) - { - // Error has occurred - CmdPrintError(c, ret); - } - - CiFreeClientGetAccount(&t); - - // Release of the parameter list - FreeParamValueList(o); - - return ret; -} - -// Enable validation option for server certificate of connection settings -UINT PcAccountServerCertEnable(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) -{ - LIST *o; - PC *pc = (PC *)param; - UINT ret = ERR_NO_ERROR; - RPC_CLIENT_GET_ACCOUNT t; - // Parameter list that can be specified - PARAM args[] = - { - {"[name]", CmdPrompt, _UU("CMD_AccountCreate_Prompt_Name"), CmdEvalNotEmpty, NULL}, - }; - - // Get the parameter list - o = ParseCommandList(c, cmd_name, str, args, sizeof(args) / sizeof(args[0])); - if (o == NULL) - { - return ERR_INVALID_PARAMETER; - } - - // RPC call - Zero(&t, sizeof(t)); - - UniStrCpy(t.AccountName, sizeof(t.AccountName), GetParamUniStr(o, "[name]")); - - ret = CcGetAccount(pc->RemoteClient, &t); - - if (ret == ERR_NO_ERROR) - { - RPC_CLIENT_CREATE_ACCOUNT z; - // Change the settings - t.CheckServerCert = true; - - Zero(&z, sizeof(z)); - z.CheckServerCert = t.CheckServerCert; - z.RetryOnServerCert = t.RetryOnServerCert; - z.ClientAuth = t.ClientAuth; - z.ClientOption = t.ClientOption; - z.ServerCert = t.ServerCert; - z.StartupAccount = t.StartupAccount; - - ret = CcSetAccount(pc->RemoteClient, &z); - } - - if (ret != ERR_NO_ERROR) - { - // Error has occurred - CmdPrintError(c, ret); - } - - CiFreeClientGetAccount(&t); - - // Release of the parameter list - FreeParamValueList(o); - - return ret; -} - -// Disable validation option of the server certificate of connection settings -UINT PcAccountServerCertDisable(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) -{ - LIST *o; - PC *pc = (PC *)param; - UINT ret = ERR_NO_ERROR; - RPC_CLIENT_GET_ACCOUNT t; - // Parameter list that can be specified - PARAM args[] = - { - {"[name]", CmdPrompt, _UU("CMD_AccountCreate_Prompt_Name"), CmdEvalNotEmpty, NULL}, - }; - - // Get the parameter list - o = ParseCommandList(c, cmd_name, str, args, sizeof(args) / sizeof(args[0])); - if (o == NULL) - { - return ERR_INVALID_PARAMETER; - } - - // RPC call - Zero(&t, sizeof(t)); - - UniStrCpy(t.AccountName, sizeof(t.AccountName), GetParamUniStr(o, "[name]")); - - ret = CcGetAccount(pc->RemoteClient, &t); - - if (ret == ERR_NO_ERROR) - { - RPC_CLIENT_CREATE_ACCOUNT z; - // Change the settings - t.CheckServerCert = false; - - Zero(&z, sizeof(z)); - z.CheckServerCert = t.CheckServerCert; - z.RetryOnServerCert = t.RetryOnServerCert; - z.ClientAuth = t.ClientAuth; - z.ClientOption = t.ClientOption; - z.ServerCert = t.ServerCert; - z.StartupAccount = t.StartupAccount; - - ret = CcSetAccount(pc->RemoteClient, &z); - } - - if (ret != ERR_NO_ERROR) - { - // Error has occurred - CmdPrintError(c, ret); - } - - CiFreeClientGetAccount(&t); - - // Release of the parameter list - FreeParamValueList(o); - - return ret; -} - -// Enable retry option of the invalid server certificate of connection settings -UINT PcAccountRetryOnServerCertEnable(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) -{ - LIST *o; - PC *pc = (PC *)param; - UINT ret = ERR_NO_ERROR; - RPC_CLIENT_GET_ACCOUNT t; - // Parameter list that can be specified - PARAM args[] = - { - {"[name]", CmdPrompt, _UU("CMD_AccountCreate_Prompt_Name"), CmdEvalNotEmpty, NULL}, - }; - - // Get the parameter list - o = ParseCommandList(c, cmd_name, str, args, sizeof(args) / sizeof(args[0])); - if (o == NULL) - { - return ERR_INVALID_PARAMETER; - } - - // RPC call - Zero(&t, sizeof(t)); - - UniStrCpy(t.AccountName, sizeof(t.AccountName), GetParamUniStr(o, "[name]")); - - ret = CcGetAccount(pc->RemoteClient, &t); - - if (ret == ERR_NO_ERROR) - { - RPC_CLIENT_CREATE_ACCOUNT z; - // Change the settings - t.RetryOnServerCert = true; - - Zero(&z, sizeof(z)); - z.CheckServerCert = t.CheckServerCert; - z.RetryOnServerCert = t.RetryOnServerCert; - z.ClientAuth = t.ClientAuth; - z.ClientOption = t.ClientOption; - z.ServerCert = t.ServerCert; - z.StartupAccount = t.StartupAccount; - - ret = CcSetAccount(pc->RemoteClient, &z); - } - - if (ret != ERR_NO_ERROR) - { - // Error has occurred - CmdPrintError(c, ret); - } - - CiFreeClientGetAccount(&t); - - // Release of the parameter list - FreeParamValueList(o); - - return ret; -} - -// Disable retry option of the invalid server certificate of connection settings -UINT PcAccountRetryOnServerCertDisable(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) -{ - LIST *o; - PC *pc = (PC *)param; - UINT ret = ERR_NO_ERROR; - RPC_CLIENT_GET_ACCOUNT t; - // Parameter list that can be specified - PARAM args[] = - { - {"[name]", CmdPrompt, _UU("CMD_AccountCreate_Prompt_Name"), CmdEvalNotEmpty, NULL}, - }; - - // Get the parameter list - o = ParseCommandList(c, cmd_name, str, args, sizeof(args) / sizeof(args[0])); - if (o == NULL) - { - return ERR_INVALID_PARAMETER; - } - - // RPC call - Zero(&t, sizeof(t)); - - UniStrCpy(t.AccountName, sizeof(t.AccountName), GetParamUniStr(o, "[name]")); - - ret = CcGetAccount(pc->RemoteClient, &t); - - if (ret == ERR_NO_ERROR) - { - RPC_CLIENT_CREATE_ACCOUNT z; - // Change the settings - t.RetryOnServerCert = false; - - Zero(&z, sizeof(z)); - z.CheckServerCert = t.CheckServerCert; - z.RetryOnServerCert = t.RetryOnServerCert; - z.ClientAuth = t.ClientAuth; - z.ClientOption = t.ClientOption; - z.ServerCert = t.ServerCert; - z.StartupAccount = t.StartupAccount; - - ret = CcSetAccount(pc->RemoteClient, &z); - } - - if (ret != ERR_NO_ERROR) - { - // Error has occurred - CmdPrintError(c, ret); - } - - CiFreeClientGetAccount(&t); - - // Release of the parameter list - FreeParamValueList(o); - - return ret; -} - -// Set the server-specific certificate of connection settings -UINT PcAccountServerCertSet(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) -{ - LIST *o; - PC *pc = (PC *)param; - UINT ret = ERR_NO_ERROR; - RPC_CLIENT_GET_ACCOUNT t; - X *x; - // Parameter list that can be specified - PARAM args[] = - { - {"[name]", CmdPrompt, _UU("CMD_AccountCreate_Prompt_Name"), CmdEvalNotEmpty, NULL}, - {"LOADCERT", CmdPrompt, _UU("CMD_LOADCERTPATH"), CmdEvalIsFile, NULL}, - }; - - // Get the parameter list - o = ParseCommandList(c, cmd_name, str, args, sizeof(args) / sizeof(args[0])); - if (o == NULL) - { - return ERR_INVALID_PARAMETER; - } - - x = FileToXW(GetParamUniStr(o, "LOADCERT")); - if (x == NULL) - { - FreeParamValueList(o); - c->Write(c, _UU("CMD_LOADCERT_FAILED")); - return ERR_INTERNAL_ERROR; - } - - // RPC call - Zero(&t, sizeof(t)); - - UniStrCpy(t.AccountName, sizeof(t.AccountName), GetParamUniStr(o, "[name]")); - - ret = CcGetAccount(pc->RemoteClient, &t); - - if (ret == ERR_NO_ERROR) - { - RPC_CLIENT_CREATE_ACCOUNT z; - // Change the settings - if (t.ServerCert != NULL) - { - FreeX(t.ServerCert); - } - t.ServerCert = CloneX(x); - - Zero(&z, sizeof(z)); - z.CheckServerCert = t.CheckServerCert; - z.RetryOnServerCert = t.RetryOnServerCert; - z.ClientAuth = t.ClientAuth; - z.ClientOption = t.ClientOption; - z.ServerCert = t.ServerCert; - z.StartupAccount = t.StartupAccount; - - ret = CcSetAccount(pc->RemoteClient, &z); - } - - if (ret != ERR_NO_ERROR) - { - // Error has occurred - CmdPrintError(c, ret); - } - - CiFreeClientGetAccount(&t); - - // Release of the parameter list - FreeParamValueList(o); - - FreeX(x); - - return ret; -} - -// Delete a server-specific certificate of connection settings -UINT PcAccountServerCertDelete(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) -{ - LIST *o; - PC *pc = (PC *)param; - UINT ret = ERR_NO_ERROR; - RPC_CLIENT_GET_ACCOUNT t; - // Parameter list that can be specified - PARAM args[] = - { - {"[name]", CmdPrompt, _UU("CMD_AccountCreate_Prompt_Name"), CmdEvalNotEmpty, NULL}, - }; - - // Get the parameter list - o = ParseCommandList(c, cmd_name, str, args, sizeof(args) / sizeof(args[0])); - if (o == NULL) - { - return ERR_INVALID_PARAMETER; - } - - // RPC call - Zero(&t, sizeof(t)); - - UniStrCpy(t.AccountName, sizeof(t.AccountName), GetParamUniStr(o, "[name]")); - - ret = CcGetAccount(pc->RemoteClient, &t); - - if (ret == ERR_NO_ERROR) - { - RPC_CLIENT_CREATE_ACCOUNT z; - // Change the settings - if (t.ServerCert != NULL) - { - FreeX(t.ServerCert); - } - t.ServerCert = NULL; - - Zero(&z, sizeof(z)); - z.CheckServerCert = t.CheckServerCert; - z.RetryOnServerCert = t.RetryOnServerCert; - z.ClientAuth = t.ClientAuth; - z.ClientOption = t.ClientOption; - z.ServerCert = t.ServerCert; - z.StartupAccount = t.StartupAccount; - - ret = CcSetAccount(pc->RemoteClient, &z); - } - - if (ret != ERR_NO_ERROR) - { - // Error has occurred - CmdPrintError(c, ret); - } - - CiFreeClientGetAccount(&t); - - // Release of the parameter list - FreeParamValueList(o); - - return ret; -} - -// Get a server-specific certificate of connection settings -UINT PcAccountServerCertGet(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) -{ - LIST *o; - PC *pc = (PC *)param; - UINT ret = ERR_NO_ERROR; - RPC_CLIENT_GET_ACCOUNT t; - // Parameter list that can be specified - PARAM args[] = - { - {"[name]", CmdPrompt, _UU("CMD_AccountCreate_Prompt_Name"), CmdEvalNotEmpty, NULL}, - {"SAVECERT", CmdPrompt, _UU("CMD_SAVECERTPATH"), CmdEvalNotEmpty, NULL}, - }; - - // Get the parameter list - o = ParseCommandList(c, cmd_name, str, args, sizeof(args) / sizeof(args[0])); - if (o == NULL) - { - return ERR_INVALID_PARAMETER; - } - - // RPC call - Zero(&t, sizeof(t)); - - UniStrCpy(t.AccountName, sizeof(t.AccountName), GetParamUniStr(o, "[name]")); - - ret = CcGetAccount(pc->RemoteClient, &t); - - if (ret == ERR_NO_ERROR) - { - RPC_CLIENT_CREATE_ACCOUNT z; - // Change the settings - if (t.ServerCert != NULL) - { - FreeX(t.ServerCert); - } - t.ServerCert = NULL; - - Zero(&z, sizeof(z)); - z.CheckServerCert = t.CheckServerCert; - z.RetryOnServerCert = t.RetryOnServerCert; - z.ClientAuth = t.ClientAuth; - z.ClientOption = t.ClientOption; - z.ServerCert = t.ServerCert; - z.StartupAccount = t.StartupAccount; - - ret = CcSetAccount(pc->RemoteClient, &z); - } - - if (ret != ERR_NO_ERROR) - { - // Error has occurred - CmdPrintError(c, ret); - } - - CiFreeClientGetAccount(&t); - - // Release of the parameter list - FreeParamValueList(o); - - return ret; -} - -// Set the advanced settings of connection settings -UINT PcAccountDetailSet(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) -{ - LIST *o; - PC *pc = (PC *)param; - UINT ret = ERR_NO_ERROR; - RPC_CLIENT_GET_ACCOUNT t; - CMD_EVAL_MIN_MAX mm_maxtcp = - { - "CMD_CascadeDetailSet_Eval_MaxTcp", 1, 32 - }; - CMD_EVAL_MIN_MAX mm_interval = - { - "CMD_CascadeDetailSet_Eval_Interval", 1, 4294967295UL - }; - // Parameter list that can be specified - PARAM args[] = - { - {"[name]", CmdPrompt, _UU("CMD_AccountCreate_Prompt_Name"), CmdEvalNotEmpty, NULL}, - {"MAXTCP", CmdPrompt, _UU("CMD_AccountDetailSet_Prompt_MaxTcp"), CmdEvalMinMax, &mm_maxtcp}, - {"INTERVAL", CmdPrompt, _UU("CMD_AccountDetailSet_Prompt_Interval"), CmdEvalMinMax, &mm_interval}, - {"TTL", CmdPrompt, _UU("CMD_AccountDetailSet_Prompt_TTL"), NULL, NULL}, - {"HALF", CmdPrompt, _UU("CMD_AccountDetailSet_Prompt_HALF"), NULL, NULL}, - {"BRIDGE", CmdPrompt, _UU("CMD_AccountDetailSet_Prompt_BRIDGE"), NULL, NULL}, - {"MONITOR", CmdPrompt, _UU("CMD_AccountDetailSet_Prompt_MONITOR"), NULL, NULL}, - {"NOTRACK", CmdPrompt, _UU("CMD_AccountDetailSet_Prompt_NOTRACK"), NULL, NULL}, - {"NOQOS", CmdPrompt, _UU("CMD_AccountDetailSet_Prompt_NOQOS"), NULL, NULL}, - {"DISABLEUDP", CmdPrompt, _UU("CMD_AccountDetailSet_Prompt_DISABLEUDP"), NULL, NULL}, - }; - - // Get the parameter list - o = ParseCommandList(c, cmd_name, str, args, sizeof(args) / sizeof(args[0])); - if (o == NULL) - { - return ERR_INVALID_PARAMETER; - } - - // RPC call - Zero(&t, sizeof(t)); - - UniStrCpy(t.AccountName, sizeof(t.AccountName), GetParamUniStr(o, "[name]")); - - ret = CcGetAccount(pc->RemoteClient, &t); - - if (ret == ERR_NO_ERROR) - { - RPC_CLIENT_CREATE_ACCOUNT z; - // Data change - t.ClientOption->MaxConnection = GetParamInt(o, "MAXTCP"); - t.ClientOption->AdditionalConnectionInterval = GetParamInt(o, "INTERVAL"); - t.ClientOption->ConnectionDisconnectSpan = GetParamInt(o, "TTL"); - t.ClientOption->HalfConnection = GetParamYes(o, "HALF"); - t.ClientOption->RequireBridgeRoutingMode = GetParamYes(o, "BRIDGE"); - t.ClientOption->RequireMonitorMode = GetParamYes(o, "MONITOR"); - t.ClientOption->NoRoutingTracking = GetParamYes(o, "NOTRACK"); - t.ClientOption->DisableQoS = GetParamYes(o, "NOQOS"); - t.ClientOption->NoUdpAcceleration = GetParamYes(o, "DISABLEUDP"); - - Zero(&z, sizeof(z)); - z.CheckServerCert = t.CheckServerCert; - z.ClientAuth = t.ClientAuth; - z.ClientOption = t.ClientOption; - z.ServerCert = t.ServerCert; - z.StartupAccount = t.StartupAccount; - - ret = CcSetAccount(pc->RemoteClient, &z); - } - - if (ret != ERR_NO_ERROR) - { - // Error has occurred - CmdPrintError(c, ret); - } - - CiFreeClientGetAccount(&t); - - // Release of the parameter list - FreeParamValueList(o); - - return ret; -} - -// Change the name of the connection settings -UINT PcAccountRename(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) -{ - LIST *o; - PC *pc = (PC *)param; - UINT ret = ERR_NO_ERROR; - RPC_RENAME_ACCOUNT t; - // Parameter list that can be specified - PARAM args[] = - { - {"[name]", CmdPrompt, _UU("CMD_AccountRename_PROMPT_OLD"), CmdEvalNotEmpty, NULL}, - {"NEW", CmdPrompt, _UU("CMD_AccountRename_PROMPT_NEW"), CmdEvalNotEmpty, NULL}, - }; - - // Get the parameter list - o = ParseCommandList(c, cmd_name, str, args, sizeof(args) / sizeof(args[0])); - if (o == NULL) - { - return ERR_INVALID_PARAMETER; - } - - // RPC call - Zero(&t, sizeof(t)); - UniStrCpy(t.NewName, sizeof(t.NewName), GetParamUniStr(o, "NEW")); - UniStrCpy(t.OldName, sizeof(t.OldName), GetParamUniStr(o, "[name]")); - - ret = CcRenameAccount(pc->RemoteClient, &t); - - if (ret == ERR_NO_ERROR) - { - // Success - } - - if (ret != ERR_NO_ERROR) - { - // Error has occurred - CmdPrintError(c, ret); - } - - // Release of the parameter list - FreeParamValueList(o); - - return ret; -} - -// Start to connect to the VPN Server using the connection settings -UINT PcAccountConnect(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) -{ - LIST *o; - PC *pc = (PC *)param; - UINT ret = ERR_NO_ERROR; - RPC_CLIENT_CONNECT t; - // Parameter list that can be specified - PARAM args[] = - { - {"[name]", CmdPrompt, _UU("CMD_AccountCreate_Prompt_Name"), CmdEvalNotEmpty, NULL}, - }; - - // Get the parameter list - o = ParseCommandList(c, cmd_name, str, args, sizeof(args) / sizeof(args[0])); - if (o == NULL) - { - return ERR_INVALID_PARAMETER; - } - - // RPC call - Zero(&t, sizeof(t)); - UniStrCpy(t.AccountName, sizeof(t.AccountName), GetParamUniStr(o, "[name]")); - - ret = CcConnect(pc->RemoteClient, &t); - - if (ret == ERR_NO_ERROR) - { - // Success - } - - if (ret != ERR_NO_ERROR) - { - // Error has occurred - CmdPrintError(c, ret); - } - - // Release of the parameter list - FreeParamValueList(o); - - return ret; -} - -// Disconnect the connection settings of connected -UINT PcAccountDisconnect(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) -{ - LIST *o; - PC *pc = (PC *)param; - UINT ret = ERR_NO_ERROR; - RPC_CLIENT_CONNECT t; - // Parameter list that can be specified - PARAM args[] = - { - {"[name]", CmdPrompt, _UU("CMD_AccountCreate_Prompt_Name"), CmdEvalNotEmpty, NULL}, - }; - - // Get the parameter list - o = ParseCommandList(c, cmd_name, str, args, sizeof(args) / sizeof(args[0])); - if (o == NULL) - { - return ERR_INVALID_PARAMETER; - } - - // RPC call - Zero(&t, sizeof(t)); - UniStrCpy(t.AccountName, sizeof(t.AccountName), GetParamUniStr(o, "[name]")); - - ret = CcDisconnect(pc->RemoteClient, &t); - - if (ret == ERR_NO_ERROR) - { - // Success - } - - if (ret != ERR_NO_ERROR) - { - // Error has occurred - CmdPrintError(c, ret); - } - - // Release of the parameter list - FreeParamValueList(o); - - return ret; -} - -// Get the current state of the connection settings -UINT PcAccountStatusGet(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) -{ - LIST *o; - PC *pc = (PC *)param; - UINT ret = ERR_NO_ERROR; - RPC_CLIENT_GET_CONNECTION_STATUS t; - // Parameter list that can be specified - PARAM args[] = - { - {"[name]", CmdPrompt, _UU("CMD_AccountCreate_Prompt_Name"), CmdEvalNotEmpty, NULL}, - }; - - // Get the parameter list - o = ParseCommandList(c, cmd_name, str, args, sizeof(args) / sizeof(args[0])); - if (o == NULL) - { - return ERR_INVALID_PARAMETER; - } - - // RPC call - Zero(&t, sizeof(t)); - UniStrCpy(t.AccountName, sizeof(t.AccountName), GetParamUniStr(o, "[name]")); - - ret = CcGetAccountStatus(pc->RemoteClient, &t); - - if (ret == ERR_NO_ERROR) - { - if (t.Active == false) - { - // Has been disconnected - ret = ERR_ACCOUNT_INACTIVE; - } - else - { - CT *ct = CtNewStandard(); - - CmdPrintStatusToListView(ct, &t); - - CtFree(ct, c); - } - } - - if (ret != ERR_NO_ERROR) - { - // Error has occurred - CmdPrintError(c, ret); - } - - CiFreeClientGetConnectionStatus(&t); - - // Release of the parameter list - FreeParamValueList(o); - - return ret; -} - -// Set a virtual LAN card to be used in the connection settings -UINT PcAccountNicSet(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) -{ - LIST *o; - PC *pc = (PC *)param; - UINT ret = ERR_NO_ERROR; - RPC_CLIENT_GET_ACCOUNT t; - // Parameter list that can be specified - PARAM args[] = - { - {"[name]", CmdPrompt, _UU("CMD_AccountCreate_Prompt_Name"), CmdEvalNotEmpty, NULL}, - {"NICNAME", CmdPrompt, _UU("CMD_AccountCreate_Prompt_Nicname"), CmdEvalNotEmpty, NULL}, - }; - - // Get the parameter list - o = ParseCommandList(c, cmd_name, str, args, sizeof(args) / sizeof(args[0])); - if (o == NULL) - { - return ERR_INVALID_PARAMETER; - } - - // RPC call - Zero(&t, sizeof(t)); - - Zero(&t, sizeof(t)); - UniStrCpy(t.AccountName, sizeof(t.AccountName), GetParamUniStr(o, "[name]")); - - ret = CcGetAccount(pc->RemoteClient, &t); - - if (ret == ERR_NO_ERROR) - { - RPC_CLIENT_CREATE_ACCOUNT c; - // Success - StrCpy(t.ClientOption->DeviceName, sizeof(t.ClientOption->DeviceName), - GetParamStr(o, "NICNAME")); - - Zero(&c, sizeof(c)); - - c.ClientAuth = t.ClientAuth; - c.ClientOption = t.ClientOption; - c.CheckServerCert = t.CheckServerCert; - c.RetryOnServerCert = t.RetryOnServerCert; - c.ServerCert = t.ServerCert; - c.StartupAccount = t.StartupAccount; - - ret = CcSetAccount(pc->RemoteClient, &c); - } - - if (ret != ERR_NO_ERROR) - { - // Error has occurred - CmdPrintError(c, ret); - } - - CiFreeClientGetAccount(&t); - - // Release of the parameter list - FreeParamValueList(o); - - return ret; -} - -// Set to display error screens and connection status while connecting to the VPN Server -UINT PcAccountStatusShow(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) -{ - LIST *o; - PC *pc = (PC *)param; - UINT ret = ERR_NO_ERROR; - RPC_CLIENT_GET_ACCOUNT t; - // Parameter list that can be specified - PARAM args[] = - { - {"[name]", CmdPrompt, _UU("CMD_AccountCreate_Prompt_Name"), CmdEvalNotEmpty, NULL}, - }; - - // Get the parameter list - o = ParseCommandList(c, cmd_name, str, args, sizeof(args) / sizeof(args[0])); - if (o == NULL) - { - return ERR_INVALID_PARAMETER; - } - - // RPC call - Zero(&t, sizeof(t)); - - UniStrCpy(t.AccountName, sizeof(t.AccountName), GetParamUniStr(o, "[name]")); - - ret = CcGetAccount(pc->RemoteClient, &t); - - if (ret == ERR_NO_ERROR) - { - RPC_CLIENT_CREATE_ACCOUNT z; - // Change the settings - t.ClientOption->HideStatusWindow = false; - - Zero(&z, sizeof(z)); - z.CheckServerCert = t.CheckServerCert; - z.RetryOnServerCert = t.RetryOnServerCert; - z.ClientAuth = t.ClientAuth; - z.ClientOption = t.ClientOption; - z.ServerCert = t.ServerCert; - z.StartupAccount = t.StartupAccount; - - ret = CcSetAccount(pc->RemoteClient, &z); - } - - if (ret != ERR_NO_ERROR) - { - // Error has occurred - CmdPrintError(c, ret); - } - - CiFreeClientGetAccount(&t); - - // Release of the parameter list - FreeParamValueList(o); - - return ret; -} - -// Configure not to display error screens and connection status while connecting to the VPN Server -UINT PcAccountStatusHide(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) -{ - LIST *o; - PC *pc = (PC *)param; - UINT ret = ERR_NO_ERROR; - RPC_CLIENT_GET_ACCOUNT t; - // Parameter list that can be specified - PARAM args[] = - { - {"[name]", CmdPrompt, _UU("CMD_AccountCreate_Prompt_Name"), CmdEvalNotEmpty, NULL}, - }; - - // Get the parameter list - o = ParseCommandList(c, cmd_name, str, args, sizeof(args) / sizeof(args[0])); - if (o == NULL) - { - return ERR_INVALID_PARAMETER; - } - - // RPC call - Zero(&t, sizeof(t)); - - UniStrCpy(t.AccountName, sizeof(t.AccountName), GetParamUniStr(o, "[name]")); - - ret = CcGetAccount(pc->RemoteClient, &t); - - if (ret == ERR_NO_ERROR) - { - RPC_CLIENT_CREATE_ACCOUNT z; - // Change the settings - t.ClientOption->HideStatusWindow = true; - - Zero(&z, sizeof(z)); - z.CheckServerCert = t.CheckServerCert; - z.RetryOnServerCert = t.RetryOnServerCert; - z.ClientAuth = t.ClientAuth; - z.ClientOption = t.ClientOption; - z.ServerCert = t.ServerCert; - z.StartupAccount = t.StartupAccount; - - ret = CcSetAccount(pc->RemoteClient, &z); - } - - if (ret != ERR_NO_ERROR) - { - // Error has occurred - CmdPrintError(c, ret); - } - - CiFreeClientGetAccount(&t); - - // Release of the parameter list - FreeParamValueList(o); - - return ret; -} - -// Set the type of user authentication of connection settings to the smart card authentication -UINT PcAccountSecureCertSet(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) -{ - LIST *o; - PC *pc = (PC *)param; - UINT ret = ERR_NO_ERROR; - RPC_CLIENT_GET_ACCOUNT t; - // Parameter list that can be specified - PARAM args[] = - { - {"[name]", CmdPrompt, _UU("CMD_AccountCreate_Prompt_Name"), CmdEvalNotEmpty, NULL}, - {"CERTNAME", CmdPrompt, _UU("CMD_AccountSecureCertSet_PROMPT_CERTNAME"), CmdEvalNotEmpty, NULL}, - {"KEYNAME", CmdPrompt, _UU("CMD_AccountSecureCertSet_PROMPT_KEYNAME"), CmdEvalNotEmpty, NULL}, - }; - - // Get the parameter list - o = ParseCommandList(c, cmd_name, str, args, sizeof(args) / sizeof(args[0])); - if (o == NULL) - { - return ERR_INVALID_PARAMETER; - } - - // RPC call - Zero(&t, sizeof(t)); - - UniStrCpy(t.AccountName, sizeof(t.AccountName), GetParamUniStr(o, "[name]")); - - ret = CcGetAccount(pc->RemoteClient, &t); - - if (ret == ERR_NO_ERROR) - { - RPC_CLIENT_CREATE_ACCOUNT z; - // Change the settings - t.ClientAuth->AuthType = CLIENT_AUTHTYPE_SECURE; - StrCpy(t.ClientAuth->SecurePublicCertName, sizeof(t.ClientAuth->SecurePublicCertName), - GetParamStr(o, "CERTNAME")); - StrCpy(t.ClientAuth->SecurePrivateKeyName, sizeof(t.ClientAuth->SecurePrivateKeyName), - GetParamStr(o, "KEYNAME")); - - Zero(&z, sizeof(z)); - z.CheckServerCert = t.CheckServerCert; - z.RetryOnServerCert = t.RetryOnServerCert; - z.ClientAuth = t.ClientAuth; - z.ClientOption = t.ClientOption; - z.ServerCert = t.ServerCert; - z.StartupAccount = t.StartupAccount; - - ret = CcSetAccount(pc->RemoteClient, &z); - } - - if (ret != ERR_NO_ERROR) - { - // Error has occurred - CmdPrintError(c, ret); - } - - CiFreeClientGetAccount(&t); - - // Release of the parameter list - FreeParamValueList(o); - - return ret; -} - -UINT PcAccountOpensslEngineCertSet(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) -{ - LIST *o; - PC *pc = (PC *)param; - UINT ret = ERR_NO_ERROR; - RPC_CLIENT_GET_ACCOUNT t; - // Parameter list that can be specified - PARAM args[] = - { - {"[name]", CmdPrompt, _UU("CMD_AccountCreate_Prompt_Name"), CmdEvalNotEmpty, NULL}, - {"LOADCERT", CmdPrompt, _UU("CMD_LOADCERTPATH"), CmdEvalIsFile, NULL}, - {"KEYNAME", CmdPrompt, _UU("CMD_AccountOpensslCertSet_PROMPT_KEYNAME"), CmdEvalNotEmpty, NULL}, - {"ENGINENAME", CmdPrompt, _UU("CMD_AccountOpensslCertSet_PROMPT_ENGINENAME"), CmdEvalNotEmpty, NULL}, - }; - - // Get the parameter list - o = ParseCommandList(c, cmd_name, str, args, sizeof(args) / sizeof(args[0])); - if (o == NULL) - { - return ERR_INVALID_PARAMETER; - } - - // RPC call - Zero(&t, sizeof(t)); - - UniStrCpy(t.AccountName, sizeof(t.AccountName), GetParamUniStr(o, "[name]")); - - ret = CcGetAccount(pc->RemoteClient, &t); - - if (ret == ERR_NO_ERROR) - { - RPC_CLIENT_CREATE_ACCOUNT z; - t.ClientAuth->AuthType = CLIENT_AUTHTYPE_OPENSSLENGINE; - X *x; - x = FileToXW(GetParamUniStr(o, "LOADCERT")); - if (x == NULL) - { - c->Write(c, _UU("CMD_LOADCERT_FAILED")); - } - StrCpy(t.ClientAuth->OpensslEnginePrivateKeyName, sizeof(t.ClientAuth->OpensslEnginePrivateKeyName), - GetParamStr(o, "KEYNAME")); - StrCpy(t.ClientAuth->OpensslEngineName, sizeof(t.ClientAuth->OpensslEngineName), - GetParamStr(o, "ENGINENAME")); - t.ClientAuth->ClientX = CloneX(x); - Zero(&z, sizeof(z)); - z.CheckServerCert = t.CheckServerCert; - z.RetryOnServerCert = t.RetryOnServerCert; - z.ClientAuth = t.ClientAuth; - z.ClientOption = t.ClientOption; - z.ServerCert = t.ServerCert; - z.StartupAccount = t.StartupAccount; - - ret = CcSetAccount(pc->RemoteClient, &z); - } - - if (ret != ERR_NO_ERROR) - { - // Error has occurred - CmdPrintError(c, ret); - } - - CiFreeClientGetAccount(&t); - - // Release of the parameter list - FreeParamValueList(o); - - return ret; -} - - -// Set the retry interval and number of retries when disconnect or connection failure of connection settings -UINT PcAccountRetrySet(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) -{ - LIST *o; - PC *pc = (PC *)param; - UINT ret = ERR_NO_ERROR; - RPC_CLIENT_GET_ACCOUNT t; - // Parameter list that can be specified - CMD_EVAL_MIN_MAX minmax = - { - "CMD_AccountRetrySet_EVAL_INTERVAL", - 5, - 4294967295UL, - }; - PARAM args[] = - { - {"[name]", CmdPrompt, _UU("CMD_AccountCreate_Prompt_Name"), CmdEvalNotEmpty, NULL}, - {"NUM", CmdPrompt, _UU("CMD_AccountRetrySet_PROMPT_NUM"), CmdEvalNotEmpty, NULL}, - {"INTERVAL", CmdPrompt, _UU("CMD_AccountRetrySet_PROMPT_INTERVAL"), CmdEvalMinMax, &minmax}, - }; - - // Get the parameter list - o = ParseCommandList(c, cmd_name, str, args, sizeof(args) / sizeof(args[0])); - if (o == NULL) - { - return ERR_INVALID_PARAMETER; - } - - // RPC call - Zero(&t, sizeof(t)); - - UniStrCpy(t.AccountName, sizeof(t.AccountName), GetParamUniStr(o, "[name]")); - - ret = CcGetAccount(pc->RemoteClient, &t); - - if (ret == ERR_NO_ERROR) - { - RPC_CLIENT_CREATE_ACCOUNT z; - // Change the settings - UINT num = GetParamInt(o, "NUM"); - UINT interval = GetParamInt(o, "INTERVAL"); - - t.ClientOption->NumRetry = (num == 999) ? INFINITE : num; - t.ClientOption->RetryInterval = interval; - - Zero(&z, sizeof(z)); - z.CheckServerCert = t.CheckServerCert; - z.RetryOnServerCert = t.RetryOnServerCert; - z.ClientAuth = t.ClientAuth; - z.ClientOption = t.ClientOption; - z.ServerCert = t.ServerCert; - z.StartupAccount = t.StartupAccount; - - ret = CcSetAccount(pc->RemoteClient, &z); - } - - if (ret != ERR_NO_ERROR) - { - // Error has occurred - CmdPrintError(c, ret); - } - - CiFreeClientGetAccount(&t); - - // Release of the parameter list - FreeParamValueList(o); - - return ret; -} - - -// Set to start-up connection the connection settings -UINT PcAccountStartupSet(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) -{ - LIST *o; - PC *pc = (PC *)param; - UINT ret = ERR_NO_ERROR; - RPC_CLIENT_GET_ACCOUNT t; - // Parameter list that can be specified - PARAM args[] = - { - {"[name]", CmdPrompt, _UU("CMD_AccountCreate_Prompt_Name"), CmdEvalNotEmpty, NULL}, - }; - - // Get the parameter list - o = ParseCommandList(c, cmd_name, str, args, sizeof(args) / sizeof(args[0])); - if (o == NULL) - { - return ERR_INVALID_PARAMETER; - } - - // RPC call - Zero(&t, sizeof(t)); - - UniStrCpy(t.AccountName, sizeof(t.AccountName), GetParamUniStr(o, "[name]")); - - ret = CcGetAccount(pc->RemoteClient, &t); - - if (ret == ERR_NO_ERROR) - { - RPC_CLIENT_CREATE_ACCOUNT z; - // Change the settings - t.StartupAccount = true; - - Zero(&z, sizeof(z)); - z.CheckServerCert = t.CheckServerCert; - z.RetryOnServerCert = t.RetryOnServerCert; - z.ClientAuth = t.ClientAuth; - z.ClientOption = t.ClientOption; - z.ServerCert = t.ServerCert; - z.StartupAccount = t.StartupAccount; - - ret = CcSetAccount(pc->RemoteClient, &z); - } - - if (ret != ERR_NO_ERROR) - { - // Error has occurred - CmdPrintError(c, ret); - } - - CiFreeClientGetAccount(&t); - - // Release of the parameter list - FreeParamValueList(o); - - return ret; -} - -// Unset the start-up connection of the connection settings -UINT PcAccountStartupRemove(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) -{ - LIST *o; - PC *pc = (PC *)param; - UINT ret = ERR_NO_ERROR; - RPC_CLIENT_GET_ACCOUNT t; - // Parameter list that can be specified - PARAM args[] = - { - {"[name]", CmdPrompt, _UU("CMD_AccountCreate_Prompt_Name"), CmdEvalNotEmpty, NULL}, - }; - - // Get the parameter list - o = ParseCommandList(c, cmd_name, str, args, sizeof(args) / sizeof(args[0])); - if (o == NULL) - { - return ERR_INVALID_PARAMETER; - } - - // RPC call - Zero(&t, sizeof(t)); - - UniStrCpy(t.AccountName, sizeof(t.AccountName), GetParamUniStr(o, "[name]")); - - ret = CcGetAccount(pc->RemoteClient, &t); - - if (ret == ERR_NO_ERROR) - { - RPC_CLIENT_CREATE_ACCOUNT z; - // Change the settings - t.StartupAccount = false; - - Zero(&z, sizeof(z)); - z.CheckServerCert = t.CheckServerCert; - z.RetryOnServerCert = t.RetryOnServerCert; - z.ClientAuth = t.ClientAuth; - z.ClientOption = t.ClientOption; - z.ServerCert = t.ServerCert; - z.StartupAccount = t.StartupAccount; - - ret = CcSetAccount(pc->RemoteClient, &z); - } - - if (ret != ERR_NO_ERROR) - { - // Error has occurred - CmdPrintError(c, ret); - } - - CiFreeClientGetAccount(&t); - - // Release of the parameter list - FreeParamValueList(o); - - return ret; -} - -// Export the connection settings -UINT PcAccountExport(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) -{ - LIST *o; - PC *pc = (PC *)param; - UINT ret = ERR_NO_ERROR; - RPC_CLIENT_GET_ACCOUNT t; - // Parameter list that can be specified - PARAM args[] = - { - {"[name]", CmdPrompt, _UU("CMD_AccountCreate_Prompt_Name"), CmdEvalNotEmpty, NULL}, - {"SAVEPATH", CmdPrompt, _UU("CMD_AccountExport_PROMPT_SAVEPATH"), CmdEvalNotEmpty, NULL}, - }; - - // Get the parameter list - o = ParseCommandList(c, cmd_name, str, args, sizeof(args) / sizeof(args[0])); - if (o == NULL) - { - return ERR_INVALID_PARAMETER; - } - - // RPC call - Zero(&t, sizeof(t)); - - UniStrCpy(t.AccountName, sizeof(t.AccountName), GetParamUniStr(o, "[name]")); - - ret = CcGetAccount(pc->RemoteClient, &t); - - if (ret == ERR_NO_ERROR) - { - RPC_CLIENT_CREATE_ACCOUNT z; - BUF *b; - BUF *b2; - char tmp[MAX_SIZE]; - UCHAR *buf; - UINT buf_size; - UCHAR bom[] = {0xef, 0xbb, 0xbf, }; - - Zero(&z, sizeof(z)); - z.CheckServerCert = t.CheckServerCert; - z.ClientAuth = t.ClientAuth; - z.ClientOption = t.ClientOption; - z.ServerCert = t.ServerCert; - z.StartupAccount = t.StartupAccount; - - b = CiAccountToCfg(&z); - - StrCpy(tmp, sizeof(tmp), GetParamStr(o, "SAVEPATH")); - b2 = NewBuf(); - - WriteBuf(b2, bom, sizeof(bom)); - - // Add the header part - buf_size = CalcUniToUtf8(_UU("CM_ACCOUNT_FILE_BANNER")); - buf = ZeroMalloc(buf_size + 32); - UniToUtf8(buf, buf_size, _UU("CM_ACCOUNT_FILE_BANNER")); - - WriteBuf(b2, buf, StrLen((char *)buf)); - WriteBuf(b2, b->Buf, b->Size); - SeekBuf(b2, 0, 0); - - FreeBuf(b); - - if (DumpBuf(b2, tmp) == false) - { - c->Write(c, _UU("CMD_SAVEFILE_FAILED")); - ret = ERR_INTERNAL_ERROR; - } - - FreeBuf(b2); - Free(buf); - } - - if (ret != ERR_NO_ERROR) - { - // Error has occurred - CmdPrintError(c, ret); - } - - CiFreeClientGetAccount(&t); - - // Release of the parameter list - FreeParamValueList(o); - - return ret; -} - -// Check whether the specified account name exists -bool CmdIsAccountName(REMOTE_CLIENT *r, wchar_t *name) -{ - UINT i; - RPC_CLIENT_ENUM_ACCOUNT t; - wchar_t tmp[MAX_SIZE]; - bool b = false; - // Validate arguments - if (r == NULL || name == NULL) - { - return false; - } - - if (CcEnumAccount(r, &t) != ERR_NO_ERROR) - { - return false; - } - - UniStrCpy(tmp, sizeof(tmp), name); - UniTrim(tmp); - - for (i = 0;i < t.NumItem;i++) - { - if (UniStrCmpi(t.Items[i]->AccountName, tmp) == 0) - { - b = true; - break; - } - } - - CiFreeClientEnumAccount(&t); - - return b; -} - -// Generate an import name -void CmdGenerateImportName(REMOTE_CLIENT *r, wchar_t *name, UINT size, wchar_t *old_name) -{ - UINT i; - // Validate arguments - if (r == NULL || name == NULL || old_name == NULL) - { - return; - } - - for (i = 1;;i++) - { - wchar_t tmp[MAX_SIZE]; - if (i == 1) - { - UniFormat(tmp, sizeof(tmp), _UU("CM_IMPORT_NAME_1"), old_name); - } - else - { - UniFormat(tmp, sizeof(tmp), _UU("CM_IMPORT_NAME_2"), old_name, i); - } - - if (CmdIsAccountName(r, tmp) == false) - { - UniStrCpy(name, size, tmp); - return; - } - } -} - -// Import a connection setting -UINT PcAccountImport(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) -{ - LIST *o; - PC *pc = (PC *)param; - UINT ret = ERR_NO_ERROR; - BUF *b; - wchar_t name[MAX_SIZE]; - // Parameter list that can be specified - PARAM args[] = - { - {"[path]", CmdPrompt, _UU("CMD_AccountImport_PROMPT_PATH"), CmdEvalIsFile, NULL}, - }; - - // Get the parameter list - o = ParseCommandList(c, cmd_name, str, args, sizeof(args) / sizeof(args[0])); - if (o == NULL) - { - return ERR_INVALID_PARAMETER; - } - - // Read the file - b = ReadDumpW(GetParamUniStr(o, "[path]")); - - if (b == NULL) - { - // Read failure - c->Write(c, _UU("CMD_LOADFILE_FAILED")); - ret = ERR_INTERNAL_ERROR; - } - else - { - RPC_CLIENT_CREATE_ACCOUNT *t; - - t = CiCfgToAccount(b); - - if (t == NULL) - { - // Failed to parse - c->Write(c, _UU("CMD_AccountImport_FAILED_PARSE")); - ret = ERR_INTERNAL_ERROR; - } - else - { - CmdGenerateImportName(pc->RemoteClient, name, sizeof(name), t->ClientOption->AccountName); - UniStrCpy(t->ClientOption->AccountName, sizeof(t->ClientOption->AccountName), name); - - ret = CcCreateAccount(pc->RemoteClient, t); - - if (ret == ERR_NO_ERROR) - { - wchar_t tmp[MAX_SIZE]; - - UniFormat(tmp, sizeof(tmp), _UU("CMD_AccountImport_OK"), name); - c->Write(c, tmp); - } - - CiFreeClientCreateAccount(t); - Free(t); - } - - FreeBuf(b); - } - - if (ret != ERR_NO_ERROR) - { - // Error has occurred - CmdPrintError(c, ret); - } - - // Release of the parameter list - FreeParamValueList(o); - - return ret; -} - -// Allow remote management of the VPN Client Service -UINT PcRemoteEnable(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) -{ - LIST *o; - PC *pc = (PC *)param; - UINT ret = ERR_NO_ERROR; - CLIENT_CONFIG t; - - // Get the parameter list - o = ParseCommandList(c, cmd_name, str, NULL, 0); - if (o == NULL) - { - return ERR_INVALID_PARAMETER; - } - - // RPC call - Zero(&t, sizeof(t)); - - ret = CcGetClientConfig(pc->RemoteClient, &t); - - if (ret == ERR_NO_ERROR) - { - t.AllowRemoteConfig = true; - ret = CcSetClientConfig(pc->RemoteClient, &t); - } - - if (ret == ERR_NO_ERROR) - { - // Success - } - - if (ret != ERR_NO_ERROR) - { - // Error has occurred - CmdPrintError(c, ret); - } - - // Release of the parameter list - FreeParamValueList(o); - - return ret; -} - -// Prohibit remote management of the VPN Client Service -UINT PcRemoteDisable(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) -{ - LIST *o; - PC *pc = (PC *)param; - UINT ret = ERR_NO_ERROR; - CLIENT_CONFIG t; - - // Get the parameter list - o = ParseCommandList(c, cmd_name, str, NULL, 0); - if (o == NULL) - { - return ERR_INVALID_PARAMETER; - } - - // RPC call - Zero(&t, sizeof(t)); - - ret = CcGetClientConfig(pc->RemoteClient, &t); - - if (ret == ERR_NO_ERROR) - { - t.AllowRemoteConfig = false; - ret = CcSetClientConfig(pc->RemoteClient, &t); - } - - if (ret == ERR_NO_ERROR) - { - // Success - } - - if (ret != ERR_NO_ERROR) - { - // Error has occurred - CmdPrintError(c, ret); - } - - // Release of the parameter list - FreeParamValueList(o); - - return ret; -} - -// Enable the maintenance function of the Internet connection -UINT PcKeepEnable(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) -{ - LIST *o; - PC *pc = (PC *)param; - UINT ret = ERR_NO_ERROR; - CLIENT_CONFIG t; - - // Get the parameter list - o = ParseCommandList(c, cmd_name, str, NULL, 0); - if (o == NULL) - { - return ERR_INVALID_PARAMETER; - } - - // RPC call - Zero(&t, sizeof(t)); - - ret = CcGetClientConfig(pc->RemoteClient, &t); - - if (ret == ERR_NO_ERROR) - { - // Change the settings - t.UseKeepConnect = true; - ret = CcSetClientConfig(pc->RemoteClient, &t); - } - - if (ret == ERR_NO_ERROR) - { - // Success - } - - if (ret != ERR_NO_ERROR) - { - // Error has occurred - CmdPrintError(c, ret); - } - - // Release of the parameter list - FreeParamValueList(o); - - return ret; -} - -// Disable the maintenance function of the Internet connection -UINT PcKeepDisable(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) -{ - LIST *o; - PC *pc = (PC *)param; - UINT ret = ERR_NO_ERROR; - CLIENT_CONFIG t; - - // Get the parameter list - o = ParseCommandList(c, cmd_name, str, NULL, 0); - if (o == NULL) - { - return ERR_INVALID_PARAMETER; - } - - // RPC call - Zero(&t, sizeof(t)); - - ret = CcGetClientConfig(pc->RemoteClient, &t); - - if (ret == ERR_NO_ERROR) - { - // Change the settings - t.UseKeepConnect = false; - ret = CcSetClientConfig(pc->RemoteClient, &t); - } - - if (ret == ERR_NO_ERROR) - { - // Success - } - - if (ret != ERR_NO_ERROR) - { - // Error has occurred - CmdPrintError(c, ret); - } - - // Release of the parameter list - FreeParamValueList(o); - - return ret; -} - -// Set the maintenance function of the Internet connection -UINT PcKeepSet(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) -{ - LIST *o; - PC *pc = (PC *)param; - UINT ret = ERR_NO_ERROR; - CLIENT_CONFIG t; - char *host; - UINT port; - // Parameter list that can be specified - PARAM args[] = - { - // "name", prompt_proc, prompt_param, eval_proc, eval_param - {"HOST", CmdPrompt, _UU("CMD_KeepSet_PROMPT_HOST"), CmdEvalHostAndPort, NULL}, - {"PROTOCOL", CmdPrompt, _UU("CMD_KeepSet_PROMPT_PROTOCOL"), CmdEvalTcpOrUdp, NULL}, - {"INTERVAL", CmdPrompt, _UU("CMD_KeepSet_PROMPT_INTERVAL"), NULL, NULL}, - }; - - o = ParseCommandList(c, cmd_name, str, args, sizeof(args) / sizeof(args[0])); - if (o == NULL) - { - return ERR_INVALID_PARAMETER; - } - - // RPC call - Zero(&t, sizeof(t)); - - ret = CcGetClientConfig(pc->RemoteClient, &t); - - if (ret == ERR_NO_ERROR) - { - if (ParseHostPort(GetParamStr(o, "HOST"), &host, &port, 0)) - { - StrCpy(t.KeepConnectHost, sizeof(t.KeepConnectHost), host); - t.KeepConnectPort = port; - t.KeepConnectInterval = GetParamInt(o, "INTERVAL"); - t.KeepConnectProtocol = (StrCmpi(GetParamStr(o, "PROTOCOL"), "tcp") == 0) ? 0 : 1; - Free(host); - - ret = CcSetClientConfig(pc->RemoteClient, &t); - } - } - - if (ret != ERR_NO_ERROR) - { - // Error has occurred - CmdPrintError(c, ret); - } - - // Release of the parameter list - FreeParamValueList(o); - - return ret; -} - -// Get the maintenance function of the Internet connection -UINT PcKeepGet(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) -{ - LIST *o; - PC *pc = (PC *)param; - UINT ret = ERR_NO_ERROR; - CLIENT_CONFIG t; - - o = ParseCommandList(c, cmd_name, str, NULL, 0); - if (o == NULL) - { - return ERR_INVALID_PARAMETER; - } - - // RPC call - Zero(&t, sizeof(t)); - - ret = CcGetClientConfig(pc->RemoteClient, &t); - - if (ret == ERR_NO_ERROR) - { - wchar_t tmp[MAX_SIZE]; - CT *ct = CtNewStandard(); - - StrToUni(tmp, sizeof(tmp), t.KeepConnectHost); - CtInsert(ct, _UU("CMD_KeepGet_COLUMN_1"), tmp); - - UniToStru(tmp, t.KeepConnectPort); - CtInsert(ct, _UU("CMD_KeepGet_COLUMN_2"), tmp); - - UniToStru(tmp, t.KeepConnectInterval); - CtInsert(ct, _UU("CMD_KeepGet_COLUMN_3"), tmp); - - CtInsert(ct, _UU("CMD_KeepGet_COLUMN_4"), - t.KeepConnectProtocol == 0 ? L"TCP/IP" : L"UDP/IP"); - - CtInsert(ct, _UU("CMD_KeepGet_COLUMN_5"), - t.UseKeepConnect ? _UU("SM_ACCESS_ENABLE") : _UU("SM_ACCESS_DISABLE")); - - CtFree(ct, c); - } - - if (ret != ERR_NO_ERROR) - { - // Error has occurred - CmdPrintError(c, ret); - } - - // Release of the parameter list - FreeParamValueList(o); - - return ret; -} - - -// Creat a new client management tool context -PC *NewPc(CONSOLE *c, REMOTE_CLIENT *remote_client, char *servername, wchar_t *cmdline) -{ - PC *pc; - // Validate arguments - if (c == NULL || remote_client == NULL || servername == NULL) - { - return NULL; - } - if (UniIsEmptyStr(cmdline)) - { - cmdline = NULL; - } - - pc = ZeroMalloc(sizeof(PC)); - pc->ConsoleForServer = false; - pc->ServerName = CopyStr(servername); - pc->Console = c; - pc->LastError = 0; - pc->RemoteClient = remote_client; - pc->CmdLine = CopyUniStr(cmdline); - - return pc; -} - -// Release the client management tools context -void FreePc(PC *pc) -{ - // Validate arguments - if (pc == NULL) - { - return; - } - - Free(pc->ServerName); - Free(pc->CmdLine); - Free(pc); -} - -// Client management tool -UINT PcConnect(CONSOLE *c, char *target, wchar_t *cmdline, char *password) -{ - CEDAR *cedar; - REMOTE_CLIENT *client; - bool bad_pass; - bool no_remote; - char pass[MAX_SIZE]; - UINT ret = 0; - // Validate arguments - if (c == NULL || target == NULL) - { - return ERR_INTERNAL_ERROR; - } - - StrCpy(pass, sizeof(pass), password); - - cedar = NewCedar(NULL, NULL); - -RETRY: - client = CcConnectRpc(target, pass, &bad_pass, &no_remote, 0); - - if (client == NULL) - { - if (no_remote) - { - // Remote connection refusal - c->Write(c, _UU("CMD_VPNCMD_CLIENT_NO_REMODE")); - ReleaseCedar(cedar); - return ERR_INTERNAL_ERROR; - } - else if (bad_pass) - { - char *tmp; - // Password is different - c->Write(c, _UU("CMD_VPNCMD_PASSWORD_1")); - tmp = c->ReadPassword(c, _UU("CMD_VPNCMD_PASSWORD_2")); - c->Write(c, L""); - - if (tmp == NULL) - { - // Cancel - ReleaseCedar(cedar); - return ERR_ACCESS_DENIED; - } - else - { - StrCpy(pass, sizeof(pass), tmp); - Free(tmp); - } - - goto RETRY; - } - else - { - // Connection failure - CmdPrintError(c, ERR_CONNECT_FAILED); - ReleaseCedar(cedar); - return ERR_CONNECT_FAILED; - } - } - else - { - // Connection complete - PC *pc = NewPc(c, client, target, cmdline); - PcMain(pc); - ret = pc->LastError; - FreePc(pc); - } - - CcDisconnectRpc(client); - - ReleaseCedar(cedar); - - return ret; -} - - -// Server Administration Tool Processor Main -void PsMain(PS *ps) -{ - char prompt[MAX_SIZE]; - wchar_t tmp[MAX_SIZE]; - // Validate arguments - if (ps == NULL) - { - return; - } - - // If it's not in CSV mode, to display a message that the connection has been made - if(ps->Console->ConsoleType != CONSOLE_CSV) - { - UniFormat(tmp, sizeof(tmp), _UU("CMD_VPNCMD_SERVER_CONNECTED"), - ps->ServerName, ps->ServerPort); - ps->Console->Write(ps->Console, tmp); - ps->Console->Write(ps->Console, L""); - - if (ps->HubName == NULL) - { - // Server management mode - ps->Console->Write(ps->Console, _UU("CMD_VPNCMD_SERVER_CONNECTED_1")); - } - else - { - // Virtual HUB management mode - UniFormat(tmp, sizeof(tmp), _UU("CMD_VPNCMD_SERVER_CONNECTED_2"), - ps->HubName); - ps->Console->Write(ps->Console, tmp); - } - ps->Console->Write(ps->Console, L""); - } - - // Get the Caps - ps->CapsList = ScGetCapsEx(ps->Rpc); - - if (ps->AdminHub != NULL) - { - RPC_HUB_STATUS t; - UINT ret; - wchar_t tmp[MAX_SIZE]; - - // Choose the Virtual HUB that is specified in the ADMINHUB - Zero(&t, sizeof(t)); - - StrCpy(t.HubName, sizeof(t.HubName), ps->AdminHub); - - ret = ScGetHubStatus(ps->Rpc, &t); - if (ret == ERR_NO_ERROR) - { - // Success - UniFormat(tmp, sizeof(tmp), _UU("CMD_Hub_Selected"), t.HubName); - - if (ps->HubName != NULL) - { - Free(ps->HubName); - } - ps->HubName = CopyStr(t.HubName); - - if( ps->Console->ConsoleType != CONSOLE_CSV) - { - ps->Console->Write(ps->Console, tmp); - } - } - else - { - // Failure - UniFormat(tmp, sizeof(tmp), _UU("CMD_Hub_Select_Failed"), ps->AdminHub); - - ps->Console->Write(ps->Console, tmp); - CmdPrintError(ps->Console, ret); - } - } - - if (ps->HubName == NULL) - { - RPC_KEY_PAIR t; - - Zero(&t, sizeof(t)); - - if (ScGetServerCert(ps->Rpc, &t) == ERR_NO_ERROR) - { - if (t.Cert != NULL && t.Cert->has_basic_constraints == false) - { - if (t.Cert->root_cert) - { - ps->Console->Write(ps->Console, L""); - ps->Console->Write(ps->Console, _UU("SM_CERT_MESSAGE_CLI")); - ps->Console->Write(ps->Console, L""); - } - } - - FreeRpcKeyPair(&t); - } - } - - while (true) - { - // Definition of command - CMD cmd[] = - { - {"About", PsAbout}, - {"Check", PtCheck}, - {"Crash", PsCrash}, - {"Flush", PsFlush}, - {"Debug", PsDebug}, - {"ServerInfoGet", PsServerInfoGet}, - {"ServerStatusGet", PsServerStatusGet}, - {"ListenerCreate", PsListenerCreate}, - {"ListenerDelete", PsListenerDelete}, - {"ListenerList", PsListenerList}, - {"ListenerEnable", PsListenerEnable}, - {"ListenerDisable", PsListenerDisable}, - {"PortsUDPGet", PsPortsUDPGet}, - {"PortsUDPSet", PsPortsUDPSet}, - {"ProtoOptionsGet", PsProtoOptionsGet}, - {"ProtoOptionsSet", PsProtoOptionsSet}, - {"ServerPasswordSet", PsServerPasswordSet}, - {"ClusterSettingGet", PsClusterSettingGet}, - {"ClusterSettingStandalone", PsClusterSettingStandalone}, - {"ClusterSettingController", PsClusterSettingController}, - {"ClusterSettingMember", PsClusterSettingMember}, - {"ClusterMemberList", PsClusterMemberList}, - {"ClusterMemberInfoGet", PsClusterMemberInfoGet}, - {"ClusterMemberCertGet", PsClusterMemberCertGet}, - {"ClusterConnectionStatusGet", PsClusterConnectionStatusGet}, - {"ServerCertGet", PsServerCertGet}, - {"ServerKeyGet", PsServerKeyGet}, - {"ServerCertSet", PsServerCertSet}, - {"ServerCipherGet", PsServerCipherGet}, - {"ServerCipherSet", PsServerCipherSet}, - {"KeepEnable", PsKeepEnable}, - {"KeepDisable", PsKeepDisable}, - {"KeepSet", PsKeepSet}, - {"KeepGet", PsKeepGet}, - {"SyslogGet", PsSyslogGet}, - {"SyslogDisable", PsSyslogDisable}, - {"SyslogEnable", PsSyslogEnable}, - {"ConnectionList", PsConnectionList}, - {"ConnectionGet", PsConnectionGet}, - {"ConnectionDisconnect", PsConnectionDisconnect}, - {"BridgeDeviceList", PsBridgeDeviceList}, - {"BridgeList", PsBridgeList}, - {"BridgeCreate", PsBridgeCreate}, - {"BridgeDelete", PsBridgeDelete}, - {"Caps", PsCaps}, - {"Reboot", PsReboot}, - {"ConfigGet", PsConfigGet}, - {"ConfigSet", PsConfigSet}, - {"RouterList", PsRouterList}, - {"RouterAdd", PsRouterAdd}, - {"RouterDelete", PsRouterDelete}, - {"RouterStart", PsRouterStart}, - {"RouterStop", PsRouterStop}, - {"RouterIfList", PsRouterIfList}, - {"RouterIfAdd", PsRouterIfAdd}, - {"RouterIfDel", PsRouterIfDel}, - {"RouterTableList", PsRouterTableList}, - {"RouterTableAdd", PsRouterTableAdd}, - {"RouterTableDel", PsRouterTableDel}, - {"LogFileList", PsLogFileList}, - {"LogFileGet", PsLogFileGet}, - {"HubCreate", PsHubCreate}, - {"HubCreateDynamic", PsHubCreateDynamic}, - {"HubCreateStatic", PsHubCreateStatic}, - {"HubDelete", PsHubDelete}, - {"HubSetStatic", PsHubSetStatic}, - {"HubSetDynamic", PsHubSetDynamic}, - {"HubList", PsHubList}, - {"Hub", PsHub}, - {"Online", PsOnline}, - {"Offline", PsOffline}, - {"SetMaxSession", PsSetMaxSession}, - {"SetHubPassword", PsSetHubPassword}, - {"SetEnumAllow", PsSetEnumAllow}, - {"SetEnumDeny", PsSetEnumDeny}, - {"OptionsGet", PsOptionsGet}, - {"RadiusServerSet", PsRadiusServerSet}, - {"RadiusServerDelete", PsRadiusServerDelete}, - {"RadiusServerGet", PsRadiusServerGet}, - {"StatusGet", PsStatusGet}, - {"LogGet", PsLogGet}, - {"LogEnable", PsLogEnable}, - {"LogDisable", PsLogDisable}, - {"LogSwitchSet", PsLogSwitchSet}, - {"LogPacketSaveType", PsLogPacketSaveType}, - {"CAList", PsCAList}, - {"CAAdd", PsCAAdd}, - {"CADelete", PsCADelete}, - {"CAGet", PsCAGet}, - {"CascadeList", PsCascadeList}, - {"CascadeCreate", PsCascadeCreate}, - {"CascadeSet", PsCascadeSet}, - {"CascadeGet", PsCascadeGet}, - {"CascadeDelete", PsCascadeDelete}, - {"CascadeUsernameSet", PsCascadeUsernameSet}, - {"CascadeAnonymousSet", PsCascadeAnonymousSet}, - {"CascadePasswordSet", PsCascadePasswordSet}, - {"CascadeCertSet", PsCascadeCertSet}, - {"CascadeCertGet", PsCascadeCertGet}, - {"CascadeEncryptEnable", PsCascadeEncryptEnable}, - {"CascadeEncryptDisable", PsCascadeEncryptDisable}, - {"CascadeCompressEnable", PsCascadeCompressEnable}, - {"CascadeCompressDisable", PsCascadeCompressDisable}, - {"CascadeProxyNone", PsCascadeProxyNone}, - {"CascadeHttpHeaderAdd", PsCascadeHttpHeaderAdd}, - {"CascadeHttpHeaderDelete", PsCascadeHttpHeaderDelete}, - {"CascadeHttpHeaderGet", PsCascadeHttpHeaderGet}, - {"CascadeProxyHttp", PsCascadeProxyHttp}, - {"CascadeProxySocks", PsCascadeProxySocks}, - {"CascadeProxySocks5", PsCascadeProxySocks5}, - {"CascadeServerCertEnable", PsCascadeServerCertEnable}, - {"CascadeServerCertDisable", PsCascadeServerCertDisable}, - {"CascadeServerCertSet", PsCascadeServerCertSet}, - {"CascadeServerCertDelete", PsCascadeServerCertDelete}, - {"CascadeServerCertGet", PsCascadeServerCertGet}, - {"CascadeDetailSet", PsCascadeDetailSet}, - {"CascadePolicySet", PsCascadePolicySet}, - {"PolicyList", PsPolicyList}, - {"CascadeStatusGet", PsCascadeStatusGet}, - {"CascadeRename", PsCascadeRename}, - {"CascadeOnline", PsCascadeOnline}, - {"CascadeOffline", PsCascadeOffline}, - {"AccessAdd", PsAccessAdd}, - {"AccessAddEx", PsAccessAddEx}, - {"AccessAdd6", PsAccessAdd6}, - {"AccessAddEx6", PsAccessAddEx6}, - {"AccessList", PsAccessList}, - {"AccessDelete", PsAccessDelete}, - {"AccessEnable", PsAccessEnable}, - {"AccessDisable", PsAccessDisable}, - {"UserList", PsUserList}, - {"UserCreate", PsUserCreate}, - {"UserSet", PsUserSet}, - {"UserDelete", PsUserDelete}, - {"UserGet", PsUserGet}, - {"UserAnonymousSet", PsUserAnonymousSet}, - {"UserPasswordSet", PsUserPasswordSet}, - {"UserCertSet", PsUserCertSet}, - {"UserCertGet", PsUserCertGet}, - {"UserSignedSet", PsUserSignedSet}, - {"UserRadiusSet", PsUserRadiusSet}, - {"UserNTLMSet", PsUserNTLMSet}, - {"UserPolicyRemove", PsUserPolicyRemove}, - {"UserPolicySet", PsUserPolicySet}, - {"UserExpiresSet", PsUserExpiresSet}, - {"GroupList", PsGroupList}, - {"GroupCreate", PsGroupCreate}, - {"GroupSet", PsGroupSet}, - {"GroupDelete", PsGroupDelete}, - {"GroupGet", PsGroupGet}, - {"GroupJoin", PsGroupJoin}, - {"GroupUnjoin", PsGroupUnjoin}, - {"GroupPolicyRemove", PsGroupPolicyRemove}, - {"GroupPolicySet", PsGroupPolicySet}, - {"SessionList", PsSessionList}, - {"SessionGet", PsSessionGet}, - {"SessionDisconnect", PsSessionDisconnect}, - {"MacTable", PsMacTable}, - {"MacDelete", PsMacDelete}, - {"IpTable", PsIpTable}, - {"IpDelete", PsIpDelete}, - {"SecureNatEnable", PsSecureNatEnable}, - {"SecureNatDisable", PsSecureNatDisable}, - {"SecureNatStatusGet", PsSecureNatStatusGet}, - {"SecureNatHostGet", PsSecureNatHostGet}, - {"SecureNatHostSet", PsSecureNatHostSet}, - {"NatGet", PsNatGet}, - {"NatEnable", PsNatEnable}, - {"NatDisable", PsNatDisable}, - {"NatSet", PsNatSet}, - {"NatTable", PsNatTable}, - {"DhcpGet", PsDhcpGet}, - {"DhcpEnable", PsDhcpEnable}, - {"DhcpDisable", PsDhcpDisable}, - {"DhcpSet", PsDhcpSet}, - {"DhcpTable", PsDhcpTable}, - {"AdminOptionList", PsAdminOptionList}, - {"AdminOptionSet", PsAdminOptionSet}, - {"ExtOptionList", PsExtOptionList}, - {"ExtOptionSet", PsExtOptionSet}, - {"CrlList", PsCrlList}, - {"CrlAdd", PsCrlAdd}, - {"CrlDel", PsCrlDel}, - {"CrlGet", PsCrlGet}, - {"AcList", PsAcList}, - {"AcAdd", PsAcAdd}, - {"AcAdd6", PsAcAdd6}, - {"AcDel", PsAcDel}, - {"MakeCert", PtMakeCert}, - {"MakeCert2048", PtMakeCert2048}, - {"TrafficClient", PtTrafficClient}, - {"TrafficServer", PtTrafficServer}, - {"LicenseAdd", PsLicenseAdd}, - {"LicenseDel", PsLicenseDel}, - {"LicenseList", PsLicenseList}, - {"LicenseStatus", PsLicenseStatus}, - {"IPsecEnable", PsIPsecEnable}, - {"IPsecGet", PsIPsecGet}, - {"EtherIpClientAdd", PsEtherIpClientAdd}, - {"EtherIpClientDelete", PsEtherIpClientDelete}, - {"EtherIpClientList", PsEtherIpClientList}, - {"OpenVpnMakeConfig", PsOpenVpnMakeConfig}, - {"ServerCertRegenerate", PsServerCertRegenerate}, - {"VpnOverIcmpDnsEnable", PsVpnOverIcmpDnsEnable}, - {"VpnOverIcmpDnsGet", PsVpnOverIcmpDnsGet}, - {"DynamicDnsGetStatus", PsDynamicDnsGetStatus}, - {"DynamicDnsSetHostname", PsDynamicDnsSetHostname}, - {"VpnAzureGetStatus", PsVpnAzureGetStatus}, - {"VpnAzureSetEnable", PsVpnAzureSetEnable}, - }; - - // Generate a prompt - if (ps->HubName == NULL) - { - Format(prompt, sizeof(prompt), "VPN Server>"); - } - else - { - Format(prompt, sizeof(prompt), "VPN Server/%s>", ps->HubName); - } - - if (DispatchNextCmdEx(ps->Console, ps->CmdLine, prompt, cmd, sizeof(cmd) / sizeof(cmd[0]), ps) == false) - { - break; - } - ps->LastError = ps->Console->RetCode; - - if (ps->LastError == ERR_NO_ERROR && ps->Console->ConsoleType != CONSOLE_CSV) - { - ps->Console->Write(ps->Console, _UU("CMD_MSG_OK")); - ps->Console->Write(ps->Console, L""); - } - - if (ps->CmdLine != NULL) - { - break; - } - } - - // Release the Caps - FreeCapsList(ps->CapsList); - ps->CapsList = NULL; -} - -// A template for a new command function -UINT PsXxx(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) -{ - LIST *o; - PS *ps = (PS *)param; - UINT ret; - RPC_LISTENER t; - PARAM args[] = - { - {"[port]", CmdPromptPort, _UU("CMD_ListenerCreate_PortPrompt"), CmdEvalPort, NULL}, - }; - - o = ParseCommandList(c, cmd_name, str, args, sizeof(args) / sizeof(args[0])); - if (o == NULL) - { - return ERR_INVALID_PARAMETER; - } - - Zero(&t, sizeof(t)); - t.Enable = true; - t.Port = ToInt(GetParamStr(o, "[port]")); - - ret = ScCreateListener(ps->Rpc, &t); - - if (ret != ERR_NO_ERROR) - { - CmdPrintError(c, ret); - FreeParamValueList(o); - return ret; - } - - FreeParamValueList(o); - - return 0; -} - -// Set to the stand-alone mode -UINT PsClusterSettingStandalone(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) -{ - LIST *o; - PS *ps = (PS *)param; - UINT ret = 0; - RPC_FARM t; - - o = ParseCommandList(c, cmd_name, str, NULL, 0); - if (o == NULL) - { - return ERR_INVALID_PARAMETER; - } - - Zero(&t, sizeof(t)); - t.ServerType = SERVER_TYPE_STANDALONE; - - // RPC call - ret = ScSetFarmSetting(ps->Rpc, &t); - - if (ret != ERR_NO_ERROR) - { - // An error has occured - CmdPrintError(c, ret); - FreeParamValueList(o); - return ret; - } - - FreeParamValueList(o); - - return 0; -} - -// Set to the cluster controller mode -UINT PsClusterSettingController(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) -{ - LIST *o; - PS *ps = (PS *)param; - UINT ret = 0; - RPC_FARM t; - UINT weight; - PARAM args[] = - { - {"WEIGHT", NULL, NULL, NULL, NULL}, - {"ONLY", NULL, NULL, NULL, NULL}, - }; - - o = ParseCommandList(c, cmd_name, str, args, sizeof(args) / sizeof(args[0])); - if (o == NULL) - { - return ERR_INVALID_PARAMETER; - } - - weight = GetParamInt(o, "WEIGHT"); - if (weight == 0) - { - weight = FARM_DEFAULT_WEIGHT; - } - - Zero(&t, sizeof(t)); - t.ServerType = SERVER_TYPE_FARM_CONTROLLER; - t.Weight = weight; - t.ControllerOnly = GetParamYes(o, "ONLY"); - - // RPC call - ret = ScSetFarmSetting(ps->Rpc, &t); - - if (ret != ERR_NO_ERROR) - { - // An error has occured - CmdPrintError(c, ret); - FreeParamValueList(o); - return ret; - } - - FreeParamValueList(o); - - return 0; -} - -// Evaluate the IP address -bool CmdEvalIp(CONSOLE *c, wchar_t *str, void *param) -{ - // Validate arguments - if (c == NULL || str == NULL) - { - return false; - } - - if (UniIsEmptyStr(str)) - { - return true; - } - - if (UniStrToIP32(str) == 0 && UniStrCmpi(str, L"0.0.0.0") != 0) - { - wchar_t *msg = (param == NULL) ? _UU("CMD_IP_EVAL_FAILED") : (wchar_t *)param; - c->Write(c, msg); - return false; - } - - return true; -} - -// Convert a string to port list -LIST *StrToPortList(char *str, bool limit_range) -{ - LIST *o; - TOKEN_LIST *t; - UINT i; - if (str == NULL) - { - return NULL; - } - - // Convert to token - t = ParseToken(str, ", "); - if (t == NULL) - { - return NULL; - } - if (t->NumTokens == 0) - { - FreeToken(t); - return NULL; - } - - o = NewListFast(NULL); - - for (i = 0;i < t->NumTokens;i++) - { - char *s = t->Token[i]; - UINT n; - if (IsNum(s) == false) - { - ReleaseList(o); - FreeToken(t); - return NULL; - } - n = ToInt(s); - if (limit_range && (n == 0 || n >= 65536)) - { - ReleaseList(o); - FreeToken(t); - return NULL; - } - if (IsInList(o, (void *)n)) - { - ReleaseList(o); - FreeToken(t); - return NULL; - } - Add(o, (void *)n); - } - - FreeToken(t); - - if (LIST_NUM(o) > MAX_PUBLIC_PORT_NUM) - { - ReleaseList(o); - return NULL; - } - - return o; -} - -// Set to the cluster member mode -UINT PsClusterSettingMember(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) -{ - LIST *o; - PS *ps = (PS *)param; - UINT ret = 0; - RPC_FARM t; - char *host_and_port; - char *host; - UINT port; - UINT weight; - // Parameter list that can be specified - PARAM args[] = - { - // "name", prompt_proc, prompt_param, eval_proc, eval_param - {"[server:port]", CmdPrompt, _UU("CMD_ClusterSettingMember_Prompt_HOST_1"), CmdEvalHostAndPort, NULL}, - {"IP", PsClusterSettingMemberPromptIp, NULL, CmdEvalIp, NULL}, - {"PORTS", PsClusterSettingMemberPromptPorts, NULL, CmdEvalPortList, (void *)true}, - {"PASSWORD", CmdPromptChoosePassword, NULL, NULL, NULL}, - {"WEIGHT", NULL, NULL, NULL, NULL}, - }; - - o = ParseCommandList(c, cmd_name, str, args, sizeof(args) / sizeof(args[0])); - if (o == NULL) - { - return ERR_INVALID_PARAMETER; - } - - weight = GetParamInt(o, "WEIGHT"); - - if (weight == 0) - { - weight = FARM_DEFAULT_WEIGHT; - } - - Zero(&t, sizeof(t)); - host_and_port = GetParamStr(o, "[server:port]"); - if (ParseHostPort(host_and_port, &host, &port, 0)) - { - char *pw; - char *ports_str; - LIST *ports; - UINT i; - - StrCpy(t.ControllerName, sizeof(t.ControllerName), host); - t.ControllerPort = port; - Free(host); - - pw = GetParamStr(o, "PASSWORD"); - - Sha0(t.MemberPassword, pw, StrLen(pw)); - t.PublicIp = StrToIP32(GetParamStr(o, "IP")); - t.ServerType = SERVER_TYPE_FARM_MEMBER; - - ports_str = GetParamStr(o, "PORTS"); - - ports = StrToPortList(ports_str, true); - - t.NumPort = LIST_NUM(ports); - t.Ports = ZeroMalloc(sizeof(UINT) * t.NumPort); - - for (i = 0;i < t.NumPort;i++) - { - t.Ports[i] = (UINT)LIST_DATA(ports, i); - } - - t.Weight = weight; - - ReleaseList(ports); - - // RPC call - ret = ScSetFarmSetting(ps->Rpc, &t); - - if (ret != ERR_NO_ERROR) - { - // An error has occured - CmdPrintError(c, ret); - FreeParamValueList(o); - return ret; - } - - FreeRpcFarm(&t); - } - - FreeParamValueList(o); - - return 0; -} - -// Evaluate the port list -bool CmdEvalPortList(CONSOLE *c, wchar_t *str, void *param) -{ - char *s; - bool ret = false; - LIST *o; - // Validate arguments - if (c == NULL || str == NULL) - { - return false; - } - - s = CopyUniToStr(str); - - o = StrToPortList(s, (bool)param); - - if (o != NULL) - { - ret = true; - } - - ReleaseList(o); - - Free(s); - - if (ret == false) - { - c->Write(c, _UU("CMD_PORTLIST_EVAL_FAILED")); - } - - return ret; -} - -// Check the string of the form of the host name and port number -bool CmdEvalHostAndPort(CONSOLE *c, wchar_t *str, void *param) -{ - char *tmp; - bool ret = false; - // Validate arguments - if (c == NULL || str == NULL) - { - return false; - } - - tmp = CopyUniToStr(str); - - ret = ParseHostPort(tmp, NULL, NULL, (UINT)param); - - if (ret == false) - { - c->Write(c, param == NULL ? _UU("CMD_HOSTPORT_EVAL_FAILED") : (wchar_t *)param); - } - - Free(tmp); - - return ret; -} - -// Input the public port number -wchar_t *PsClusterSettingMemberPromptPorts(CONSOLE *c, void *param) -{ - wchar_t *ret; - // Validate arguments - if (c == NULL) - { - return NULL; - } - - c->Write(c, _UU("CMD_ClusterSettingMember_Prompt_PORT_1")); - c->Write(c, L""); - - ret = c->ReadLine(c, _UU("CMD_ClusterSettingMember_Prompt_PORT_2"), true); - - return ret; -} - -// Input the public IP address -wchar_t *PsClusterSettingMemberPromptIp(CONSOLE *c, void *param) -{ - wchar_t *ret; - // Validate arguments - if (c == NULL) - { - return NULL; - } - - c->Write(c, _UU("CMD_ClusterSettingMember_Prompt_IP_1")); - c->Write(c, L""); - - ret = c->ReadLine(c, _UU("CMD_ClusterSettingMember_Prompt_IP_2"), true); - - return ret; -} - -// Show the cluster members list -UINT PsClusterMemberList(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) -{ - LIST *o; - PS *ps = (PS *)param; - UINT ret = 0; - RPC_ENUM_FARM t; - CT *ct; - UINT i; - - o = ParseCommandList(c, cmd_name, str, NULL, 0); - if (o == NULL) - { - return ERR_INVALID_PARAMETER; - } - - Zero(&t, sizeof(t)); - - // RPC call - ret = ScEnumFarmMember(ps->Rpc, &t); - - if (ret != ERR_NO_ERROR) - { - // An error has occured - CmdPrintError(c, ret); - FreeParamValueList(o); - return ret; - } - - ct = CtNew(); - - CtInsertColumn(ct, _UU("CMD_ID"), true); - CtInsertColumn(ct, _UU("SM_FM_COLUMN_1"), false); - CtInsertColumn(ct, _UU("SM_FM_COLUMN_2"), false); - CtInsertColumn(ct, _UU("SM_FM_COLUMN_3"), false); - CtInsertColumn(ct, _UU("SM_FM_COLUMN_4"), true); - CtInsertColumn(ct, _UU("SM_FM_COLUMN_5"), true); - CtInsertColumn(ct, _UU("SM_FM_COLUMN_6"), true); - CtInsertColumn(ct, _UU("SM_FM_COLUMN_7"), true); - CtInsertColumn(ct, _UU("SM_FM_COLUMN_8"), true); - CtInsertColumn(ct, _UU("SM_FM_COLUMN_9"), true); - - for (i = 0;i < t.NumFarm;i++) - { - RPC_ENUM_FARM_ITEM *e = &t.Farms[i]; - wchar_t tmp0[64]; - wchar_t tmp1[MAX_SIZE]; - wchar_t tmp2[MAX_SIZE]; - wchar_t tmp3[64]; - wchar_t tmp4[64]; - wchar_t tmp5[64]; - wchar_t tmp6[64]; - wchar_t tmp7[64]; - wchar_t tmp8[64]; - - GetDateTimeStrEx64(tmp1, sizeof(tmp1), SystemToLocal64(e->ConnectedTime), NULL); - StrToUni(tmp2, sizeof(tmp2), e->Hostname); - UniToStru(tmp3, e->Point); - UniToStru(tmp4, e->NumSessions); - UniToStru(tmp5, e->NumTcpConnections); - UniToStru(tmp6, e->NumHubs); - UniToStru(tmp7, e->AssignedClientLicense); - UniToStru(tmp8, e->AssignedBridgeLicense); - - UniToStru(tmp0, e->Id); - - CtInsert(ct, tmp0, - e->Controller ? _UU("SM_FM_CONTROLLER") : _UU("SM_FM_MEMBER"), - tmp1, tmp2, tmp3, tmp4, tmp5, tmp6, tmp7, tmp8); - } - - CtFree(ct, c); - - FreeRpcEnumFarm(&t); - - FreeParamValueList(o); - - return 0; -} - -// Get information of cluster members -UINT PsClusterMemberInfoGet(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) -{ - LIST *o; - PS *ps = (PS *)param; - UINT ret = 0; - RPC_FARM_INFO t; - CT *ct; - // Parameter list that can be specified - PARAM args[] = - { - // "name", prompt_proc, prompt_param, eval_proc, eval_param - {"[id]", CmdPrompt, _UU("CMD_ClusterMemberInfoGet_PROMPT_ID"), NULL, NULL}, - }; - - o = ParseCommandList(c, cmd_name, str, args, sizeof(args) / sizeof(args[0])); - if (o == NULL) - { - return ERR_INVALID_PARAMETER; - } - - Zero(&t, sizeof(t)); - t.Id = UniToInt(GetParamUniStr(o, "[id]")); - - // RPC call - ret = ScGetFarmInfo(ps->Rpc, &t); - - if (ret != ERR_NO_ERROR) - { - // An error has occured - CmdPrintError(c, ret); - FreeParamValueList(o); - return ret; - } - - ct = CtNewStandard(); - - { - wchar_t tmp[MAX_SIZE]; - char str[MAX_SIZE]; - UINT i; - - CtInsert(ct, _UU("SM_FMINFO_TYPE"), - t.Controller ? _UU("SM_FARM_CONTROLLER") : _UU("SM_FARM_MEMBER")); - - GetDateTimeStrEx64(tmp, sizeof(tmp), SystemToLocal64(t.ConnectedTime), NULL); - CtInsert(ct, _UU("SM_FMINFO_CONNECT_TIME"), tmp); - - IPToStr32(str, sizeof(str), t.Ip); - StrToUni(tmp, sizeof(tmp), str); - CtInsert(ct, _UU("SM_FMINFO_IP"), tmp); - - StrToUni(tmp, sizeof(tmp), t.Hostname); - CtInsert(ct, _UU("SM_FMINFO_HOSTNAME"), tmp); - - UniToStru(tmp, t.Point); - CtInsert(ct, _UU("SM_FMINFO_POINT"), tmp); - - UniToStru(tmp, t.Weight); - CtInsert(ct, _UU("SM_FMINFO_WEIGHT"), tmp); - - UniToStru(tmp, t.NumPort); - CtInsert(ct, _UU("SM_FMINFO_NUM_PORT"), tmp); - - for (i = 0;i < t.NumPort;i++) - { - wchar_t tmp2[MAX_SIZE]; - UniFormat(tmp, sizeof(tmp), _UU("SM_FMINFO_PORT"), i + 1); - UniToStru(tmp2, t.Ports[i]); - CtInsert(ct, tmp, tmp2); - } - - UniToStru(tmp, t.NumFarmHub); - CtInsert(ct, _UU("SM_FMINFO_NUM_HUB"), tmp); - - for (i = 0;i < t.NumFarmHub;i++) - { - wchar_t tmp2[MAX_SIZE]; - UniFormat(tmp, sizeof(tmp), _UU("SM_FMINFO_HUB"), i + 1); - UniFormat(tmp2, sizeof(tmp2), - t.FarmHubs[i].DynamicHub ? _UU("SM_FMINFO_HUB_TAG_2") : _UU("SM_FMINFO_HUB_TAG_1"), - t.FarmHubs[i].HubName); - CtInsert(ct, tmp, tmp2); - } - - UniToStru(tmp, t.NumSessions); - CtInsert(ct, _UU("SM_FMINFO_NUM_SESSION"), tmp); - - UniToStru(tmp, t.NumTcpConnections); - CtInsert(ct, _UU("SM_FMINFO_NUN_CONNECTION"), tmp); - } - - CtFree(ct, c); - - FreeRpcFarmInfo(&t); - - FreeParamValueList(o); - - return 0; -} - -// Get certificates of cluster members -UINT PsClusterMemberCertGet(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) -{ - LIST *o; - PS *ps = (PS *)param; - UINT ret = 0; - RPC_FARM_INFO t; - // Parameter list that can be specified - PARAM args[] = - { - // "name", prompt_proc, prompt_param, eval_proc, eval_param - {"[id]", CmdPrompt, _UU("CMD_ClusterMemberCertGet_PROMPT_ID"), NULL, NULL}, - {"SAVECERT", CmdPrompt, _UU("CMD_SAVECERTPATH"), CmdEvalNotEmpty, NULL}, - }; - - o = ParseCommandList(c, cmd_name, str, args, sizeof(args) / sizeof(args[0])); - if (o == NULL) - { - return ERR_INVALID_PARAMETER; - } - - Zero(&t, sizeof(t)); - - t.Id = UniToInt(GetParamUniStr(o, "[id]")); - - // RPC call - ret = ScGetFarmInfo(ps->Rpc, &t); - - if (ret != ERR_NO_ERROR) - { - // An error has occured - CmdPrintError(c, ret); - FreeParamValueList(o); - return ret; - } - else - { - X *x = t.ServerCert; - wchar_t *filename = GetParamUniStr(o, "SAVECERT"); - - if (XToFileW(x, filename, true) == false) - { - c->Write(c, _UU("CMD_SAVECERT_FAILED")); - - ret = ERR_INTERNAL_ERROR; - } - } - - FreeRpcFarmInfo(&t); - - FreeParamValueList(o); - - return ret; -} - -// Get the status of the connection to the cluster controller -UINT PsClusterConnectionStatusGet(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) -{ - LIST *o; - PS *ps = (PS *)param; - UINT ret = 0; - RPC_FARM_CONNECTION_STATUS t; - wchar_t tmp[MAX_SIZE]; - - o = ParseCommandList(c, cmd_name, str, NULL, 0); - if (o == NULL) - { - return ERR_INVALID_PARAMETER; - } - - Zero(&t, sizeof(t)); - - // RPC call - ret = ScGetFarmConnectionStatus(ps->Rpc, &t); - - if (ret != ERR_NO_ERROR) - { - // An error has occured - CmdPrintError(c, ret); - FreeParamValueList(o); - return ret; - } - else - { - CT *ct = CtNewStandard(); - char str[MAX_SIZE]; - - if (t.Online == false) - { - CtInsert(ct, _UU("SM_FC_IP"), _UU("SM_FC_NOT_CONNECTED")); - - CtInsert(ct, _UU("SM_FC_PORT"), _UU("SM_FC_NOT_CONNECTED")); - } - else - { - IPToStr32(str, sizeof(str), t.Ip); - StrToUni(tmp, sizeof(tmp), str); - CtInsert(ct, _UU("SM_FC_IP"), tmp); - - UniToStru(tmp, t.Port); - CtInsert(ct, _UU("SM_FC_PORT"), tmp); - } - - CtInsert(ct, - _UU("SM_FC_STATUS"), - t.Online ? _UU("SM_FC_ONLINE") : _UU("SM_FC_OFFLINE")); - - if (t.Online == false) - { - UniFormat(tmp, sizeof(tmp), _UU("SM_FC_ERROR_TAG"), _E(t.LastError), t.LastError); - CtInsert(ct, - _UU("SM_FC_LAST_ERROR"), tmp); - } - - GetDateTimeStrEx64(tmp, sizeof(tmp), SystemToLocal64(t.StartedTime), NULL); - CtInsert(ct, _UU("SM_FC_START_TIME"), tmp); - - GetDateTimeStrEx64(tmp, sizeof(tmp), SystemToLocal64(t.FirstConnectedTime), NULL); - CtInsert(ct, _UU("SM_FC_FIRST_TIME"), tmp); - - //if (t.Online == false) - { - GetDateTimeStrEx64(tmp, sizeof(tmp), SystemToLocal64(t.CurrentConnectedTime), NULL); - CtInsert(ct, _UU("SM_FC_CURRENT_TIME"), tmp); - } - - UniToStru(tmp, t.NumTry); - CtInsert(ct, _UU("SM_FC_NUM_TRY"), tmp); - - UniToStru(tmp, t.NumConnected); - CtInsert(ct, _UU("SM_FC_NUM_CONNECTED"), tmp); - - UniToStru(tmp, t.NumFailed); - CtInsert(ct, _UU("SM_FC_NUM_FAILED"), tmp); - - CtFree(ct, c); - } - - FreeParamValueList(o); - - return 0; -} - -// Get the SSL certificate of the VPN Server -UINT PsServerCertGet(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) -{ - LIST *o; - PS *ps = (PS *)param; - UINT ret = 0; - RPC_KEY_PAIR t; - // Parameter list that can be specified - PARAM args[] = - { - {"[cert]", CmdPrompt, _UU("CMD_SAVECERTPATH"), CmdEvalNotEmpty, NULL}, - }; - - o = ParseCommandList(c, cmd_name, str, args, sizeof(args) / sizeof(args[0])); - if (o == NULL) - { - return ERR_INVALID_PARAMETER; - } - - Zero(&t, sizeof(t)); - - // RPC call - ret = ScGetServerCert(ps->Rpc, &t); - - if (ret != ERR_NO_ERROR) - { - // An error has occured - CmdPrintError(c, ret); - FreeParamValueList(o); - return ret; - } - - if (XToFileW(t.Cert, GetParamUniStr(o, "[cert]"), true) == false) - { - c->Write(c, _UU("CMD_SAVECERT_FAILED")); - } - - FreeRpcKeyPair(&t); - - FreeParamValueList(o); - - return 0; -} - -// Get the private key of the SSL certificate of the VPN Server -UINT PsServerKeyGet(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) -{ - LIST *o; - PS *ps = (PS *)param; - UINT ret = 0; - RPC_KEY_PAIR t; - // Parameter list that can be specified - PARAM args[] = - { - {"[key]", CmdPrompt, _UU("CMD_SAVEKEYPATH"), CmdEvalNotEmpty, NULL}, - }; - - o = ParseCommandList(c, cmd_name, str, args, sizeof(args) / sizeof(args[0])); - if (o == NULL) - { - return ERR_INVALID_PARAMETER; - } - - Zero(&t, sizeof(t)); - - // RPC call - ret = ScGetServerCert(ps->Rpc, &t); - - if (ret != ERR_NO_ERROR) - { - // An error has occured - CmdPrintError(c, ret); - FreeParamValueList(o); - return ret; - } - - if (t.Key != NULL) - { - if (KToFileW(t.Key, GetParamUniStr(o, "[key]"), true, NULL) == false) - { - c->Write(c, _UU("CMD_SAVEKEY_FAILED")); - } - } - else - { - ret = ERR_NOT_ENOUGH_RIGHT; - CmdPrintError(c, ret); - } - - FreeRpcKeyPair(&t); - - FreeParamValueList(o); - - return ret; -} - -// Read the certificate and the private key -bool CmdLoadCertAndKey(CONSOLE *c, X **xx, K **kk, wchar_t *cert_filename, wchar_t *key_filename) -{ - X *x; - K *k; - // Validate arguments - if (c == NULL || cert_filename == NULL || key_filename == NULL || xx == NULL || kk == NULL) - { - return false; - } - - x = FileToXW(cert_filename); - if (x == NULL) - { - c->Write(c, _UU("CMD_LOADCERT_FAILED")); - return false; - } - - k = CmdLoadKey(c, key_filename); - if (k == NULL) - { - c->Write(c, _UU("CMD_LOADKEY_FAILED")); - FreeX(x); - return false; - } - - if (CheckXandK(x, k) == false) - { - c->Write(c, _UU("CMD_KEYPAIR_FAILED")); - FreeX(x); - FreeK(k); - - return false; - } - - *xx = x; - *kk = k; - - return true; -} - -// Read the secret key -K *CmdLoadKey(CONSOLE *c, wchar_t *filename) -{ - BUF *b; - // Validate arguments - if (c == NULL || filename == NULL) - { - return NULL; - } - - b = ReadDumpW(filename); - if (b == NULL) - { - c->Write(c, _UU("CMD_LOADCERT_FAILED")); - return NULL; - } - else - { - K *key; - if (IsEncryptedK(b, true) == false) - { - key = BufToK(b, true, IsBase64(b), NULL); - } - else - { - c->Write(c, _UU("CMD_LOADKEY_ENCRYPTED_1")); - - while (true) - { - char *pass = c->ReadPassword(c, _UU("CMD_LOADKEY_ENCRYPTED_2")); - - if (pass == NULL) - { - FreeBuf(b); - return NULL; - } - - key = BufToK(b, true, IsBase64(b), pass); - Free(pass); - - if (key != NULL) - { - break; - } - - c->Write(c, _UU("CMD_LOADKEY_ENCRYPTED_3")); - } - } - - FreeBuf(b); - - return key; - } -} - -// Set the SSL certificate and the private key of the VPN Server -UINT PsServerCertSet(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) -{ - LIST *o; - PS *ps = (PS *)param; - UINT ret = 0; - RPC_KEY_PAIR t; - // Parameter list that can be specified - PARAM args[] = - { - // "name", prompt_proc, prompt_param, eval_proc, eval_param - {"LOADCERT", CmdPrompt, _UU("CMD_LOADCERTPATH"), CmdEvalIsFile, NULL}, - {"LOADKEY", CmdPrompt, _UU("CMD_LOADKEYPATH"), CmdEvalIsFile, NULL}, - }; - - o = ParseCommandList(c, cmd_name, str, args, sizeof(args) / sizeof(args[0])); - if (o == NULL) - { - return ERR_INVALID_PARAMETER; - } - - Zero(&t, sizeof(t)); - - if (CmdLoadCertAndKey(c, &t.Cert, &t.Key, - GetParamUniStr(o, "LOADCERT"), - GetParamUniStr(o, "LOADKEY"))) - { - // RPC call - ret = ScSetServerCert(ps->Rpc, &t); - - if (ret != ERR_NO_ERROR) - { - // An error has occured - CmdPrintError(c, ret); - FreeParamValueList(o); - return ret; - } - - if (t.Flag1 == 0) - { - // Show the warning message - c->Write(c, L""); - c->Write(c, _UU("SM_CERT_NEED_ROOT")); - c->Write(c, L""); - } - - FreeRpcKeyPair(&t); - } - else - { - ret = ERR_INTERNAL_ERROR; - } - - FreeParamValueList(o); - - return ret; -} - -// Get the encryption algorithm used for the VPN communication -UINT PsServerCipherGet(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) -{ - LIST *o; - PS *ps = (PS *)param; - UINT ret = 0; - RPC_STR t; - TOKEN_LIST *ciphers; - UINT i; - wchar_t tmp[4096]; - - o = ParseCommandList(c, cmd_name, str, NULL, 0); - if (o == NULL) - { - return ERR_INVALID_PARAMETER; - } - - Zero(&t, sizeof(t)); - - // RPC call - ret = ScGetServerCipher(ps->Rpc, &t); - - if (ret != ERR_NO_ERROR) - { - // An error has occured - CmdPrintError(c, ret); - FreeParamValueList(o); - return ret; - } - - UniFormat(tmp, sizeof(tmp), L" %S", t.String); - FreeRpcStr(&t); - Zero(&t, sizeof(RPC_STR)); - - c->Write(c, _UU("CMD_ServerCipherGet_SERVER")); - c->Write(c, tmp); - - ret = ScGetServerCipherList(ps->Rpc, &t); - - if (ret == ERR_NO_ERROR) - { - ciphers = ParseToken(t.String, ";"); - - FreeRpcStr(&t); - - c->Write(c, L""); - c->Write(c, _UU("CMD_ServerCipherGet_CIPHERS")); - - for (i = 0; i < ciphers->NumTokens; i++) - { - UniFormat(tmp, sizeof(tmp), L" %S", ciphers->Token[i]); - c->Write(c, tmp); - } - - FreeToken(ciphers); - } - - FreeParamValueList(o); - - return 0; -} - -// Set the encryption algorithm used for the VPN communication -UINT PsServerCipherSet(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) -{ - LIST *o; - PS *ps = (PS *)param; - UINT ret = 0; - RPC_STR t; - // Parameter list that can be specified - PARAM args[] = - { - {"[name]", CmdPrompt, _UU("CMD_ServerCipherSet_PROMPT_NAME"), CmdEvalNotEmpty, NULL}, - }; - - o = ParseCommandList(c, cmd_name, str, args, sizeof(args) / sizeof(args[0])); - if (o == NULL) - { - return ERR_INVALID_PARAMETER; - } - - Zero(&t, sizeof(t)); - t.String = CopyStr(GetParamStr(o, "[name]")); - - // RPC call - ret = ScSetServerCipher(ps->Rpc, &t); - - if (ret != ERR_NO_ERROR) - { - // An error has occured - CmdPrintError(c, ret); - FreeParamValueList(o); - return ret; - } - - FreeRpcStr(&t); - - FreeParamValueList(o); - - return 0; -} - -// Enabling the maintenance function of the Internet connection -UINT PsKeepEnable(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) -{ - LIST *o; - PS *ps = (PS *)param; - UINT ret = 0; - RPC_KEEP t; - - o = ParseCommandList(c, cmd_name, str, NULL, 0); - if (o == NULL) - { - return ERR_INVALID_PARAMETER; - } - - Zero(&t, sizeof(t)); - - // RPC call - ret = ScGetKeep(ps->Rpc, &t); - - if (ret != ERR_NO_ERROR) - { - // An error has occured - CmdPrintError(c, ret); - FreeParamValueList(o); - return ret; - } - - t.UseKeepConnect = true; - - ret = ScSetKeep(ps->Rpc, &t); - - if (ret != ERR_NO_ERROR) - { - // An error has occured - CmdPrintError(c, ret); - FreeParamValueList(o); - return ret; - } - - FreeParamValueList(o); - - return 0; -} - -// Disabling the maintenance function of the Internet connection -UINT PsKeepDisable(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) -{ - LIST *o; - PS *ps = (PS *)param; - UINT ret = 0; - RPC_KEEP t; - - o = ParseCommandList(c, cmd_name, str, NULL, 0); - if (o == NULL) - { - return ERR_INVALID_PARAMETER; - } - - Zero(&t, sizeof(t)); - - // RPC call - ret = ScGetKeep(ps->Rpc, &t); - - if (ret != ERR_NO_ERROR) - { - // An error has occured - CmdPrintError(c, ret); - FreeParamValueList(o); - return ret; - } - - t.UseKeepConnect = false; - - ret = ScSetKeep(ps->Rpc, &t); - - if (ret != ERR_NO_ERROR) - { - // An error has occured - CmdPrintError(c, ret); - FreeParamValueList(o); - return ret; - } - - FreeParamValueList(o); - - return 0; -} - -// Evaluate the UDP or the TCP -bool CmdEvalTcpOrUdp(CONSOLE *c, wchar_t *str, void *param) -{ - // Validate arguments - if (c == NULL || str == NULL) - { - return false; - } - - if (UniStrCmpi(str, L"tcp") == 0 || UniStrCmpi(str, L"udp") == 0) - { - return true; - } - - c->Write(c, _UU("CMD_KeepSet_EVAL_TCP_UDP")); - - return false; -} - -// Enable the syslog configuration -UINT PsSyslogEnable(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) -{ - LIST *o; - PS *ps = (PS *)param; - UINT ret = 0; - SYSLOG_SETTING t; - CMD_EVAL_MIN_MAX minmax = {"CMD_SyslogEnable_MINMAX", 1, 3}; - char *host; - UINT port; - - // Parameter list that can be specified - PARAM args[] = - { - // "name", prompt_proc, prompt_param, eval_proc, eval_param - {"[1|2|3]", CmdPrompt, _UU("CMD_SyslogEnable_Prompt_123"), CmdEvalMinMax, &minmax}, - {"HOST", CmdPrompt, _UU("CMD_SyslogEnable_Prompt_HOST"), CmdEvalHostAndPort, (void *)SYSLOG_PORT}, - }; - - o = ParseCommandList(c, cmd_name, str, args, sizeof(args) / sizeof(args[0])); - if (o == NULL) - { - return ERR_INVALID_PARAMETER; - } - - Zero(&t, sizeof(t)); - - if (ParseHostPort(GetParamStr(o, "HOST"), &host, &port, SYSLOG_PORT)) - { - StrCpy(t.Hostname, sizeof(t.Hostname), host); - t.Port = port; - t.SaveType = GetParamInt(o, "[1|2|3]"); - - Free(host); - - // RPC call - ret = ScSetSysLog(ps->Rpc, &t); - - if (ret != ERR_NO_ERROR) - { - // An error has occured - CmdPrintError(c, ret); - FreeParamValueList(o); - return ret; - } - } - - FreeParamValueList(o); - - return 0; -} - -// Disable the syslog configuration -UINT PsSyslogDisable(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) -{ - LIST *o; - PS *ps = (PS *)param; - UINT ret = 0; - SYSLOG_SETTING t; - - o = ParseCommandList(c, cmd_name, str, NULL, 0); - if (o == NULL) - { - return ERR_INVALID_PARAMETER; - } - - Zero(&t, sizeof(t)); - - // RPC call - ret = ScGetSysLog(ps->Rpc, &t); - - if (ret != ERR_NO_ERROR) - { - // An error has occured - CmdPrintError(c, ret); - FreeParamValueList(o); - return ret; - } - - t.SaveType = SYSLOG_NONE; - - // RPC call - ret = ScSetSysLog(ps->Rpc, &t); - - if (ret != ERR_NO_ERROR) - { - // An error has occured - CmdPrintError(c, ret); - FreeParamValueList(o); - return ret; - } - - FreeParamValueList(o); - - return 0; -} - -// Get the syslog configuration -UINT PsSyslogGet(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) -{ - LIST *o; - PS *ps = (PS *)param; - UINT ret = 0; - SYSLOG_SETTING t; - - o = ParseCommandList(c, cmd_name, str, NULL, 0); - if (o == NULL) - { - return ERR_INVALID_PARAMETER; - } - - Zero(&t, sizeof(t)); - - // RPC call - ret = ScGetSysLog(ps->Rpc, &t); - - if (ret != ERR_NO_ERROR) - { - // An error has occured - CmdPrintError(c, ret); - FreeParamValueList(o); - return ret; - } - else - { - wchar_t tmp[MAX_SIZE]; - CT *ct = CtNewStandard(); - - CtInsert(ct, _UU("CMD_SyslogGet_COLUMN_1"), GetSyslogSettingName(t.SaveType)); - - if (t.SaveType != SYSLOG_NONE) - { - StrToUni(tmp, sizeof(tmp), t.Hostname); - CtInsert(ct, _UU("CMD_SyslogGet_COLUMN_2"), tmp); - - UniToStru(tmp, t.Port); - CtInsert(ct, _UU("CMD_SyslogGet_COLUMN_3"), tmp); - } - - CtFree(ct, c); - } - - FreeParamValueList(o); - - return 0; -} - -// Get the syslog configuration name -wchar_t *GetSyslogSettingName(UINT n) -{ - char tmp[MAX_PATH]; - - Format(tmp, sizeof(tmp), "SM_SYSLOG_%u", n); - - return _UU(tmp); -} - -// Setting of maintenance function of the Internet connection -UINT PsKeepSet(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) -{ - LIST *o; - PS *ps = (PS *)param; - UINT ret = 0; - RPC_KEEP t; - char *host; - UINT port; - // Parameter list that can be specified - PARAM args[] = - { - // "name", prompt_proc, prompt_param, eval_proc, eval_param - {"HOST", CmdPrompt, _UU("CMD_KeepSet_PROMPT_HOST"), CmdEvalHostAndPort, NULL}, - {"PROTOCOL", CmdPrompt, _UU("CMD_KeepSet_PROMPT_PROTOCOL"), CmdEvalTcpOrUdp, NULL}, - {"INTERVAL", CmdPrompt, _UU("CMD_KeepSet_PROMPT_INTERVAL"), NULL, NULL}, - }; - - o = ParseCommandList(c, cmd_name, str, args, sizeof(args) / sizeof(args[0])); - if (o == NULL) - { - return ERR_INVALID_PARAMETER; - } - - Zero(&t, sizeof(t)); - - // RPC call - ret = ScGetKeep(ps->Rpc, &t); - - if (ret != ERR_NO_ERROR) - { - // An error has occured - CmdPrintError(c, ret); - FreeParamValueList(o); - return ret; - } - - if (ParseHostPort(GetParamStr(o, "HOST"), &host, &port, 0)) - { - StrCpy(t.KeepConnectHost, sizeof(t.KeepConnectHost), host); - t.KeepConnectPort = port; - t.KeepConnectInterval = GetParamInt(o, "INTERVAL"); - t.KeepConnectProtocol = (StrCmpi(GetParamStr(o, "PROTOCOL"), "tcp") == 0) ? 0 : 1; - Free(host); - - // RPC call - ret = ScSetKeep(ps->Rpc, &t); - - if (ret != ERR_NO_ERROR) - { - // An error has occured - CmdPrintError(c, ret); - FreeParamValueList(o); - return ret; - } - } - - FreeParamValueList(o); - - return 0; -} - -// Get the maintenance function of the Internet connection -UINT PsKeepGet(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) -{ - LIST *o; - PS *ps = (PS *)param; - UINT ret = 0; - RPC_KEEP t; - - o = ParseCommandList(c, cmd_name, str, NULL, 0); - if (o == NULL) - { - return ERR_INVALID_PARAMETER; - } - - Zero(&t, sizeof(t)); - - // RPC call - ret = ScGetKeep(ps->Rpc, &t); - - if (ret != ERR_NO_ERROR) - { - // An error has occured - CmdPrintError(c, ret); - FreeParamValueList(o); - return ret; - } - else - { - wchar_t tmp[MAX_SIZE]; - CT *ct = CtNewStandard(); - - StrToUni(tmp, sizeof(tmp), t.KeepConnectHost); - CtInsert(ct, _UU("CMD_KeepGet_COLUMN_1"), tmp); - - UniToStru(tmp, t.KeepConnectPort); - CtInsert(ct, _UU("CMD_KeepGet_COLUMN_2"), tmp); - - UniToStru(tmp, t.KeepConnectInterval); - CtInsert(ct, _UU("CMD_KeepGet_COLUMN_3"), tmp); - - CtInsert(ct, _UU("CMD_KeepGet_COLUMN_4"), - t.KeepConnectProtocol == 0 ? L"TCP/IP" : L"UDP/IP"); - - CtInsert(ct, _UU("CMD_KeepGet_COLUMN_5"), - t.UseKeepConnect ? _UU("SM_ACCESS_ENABLE") : _UU("SM_ACCESS_DISABLE")); - - CtFree(ct, c); - } - - FreeParamValueList(o); - - return 0; -} - -// Get the connection type string -wchar_t *GetConnectionTypeStr(UINT type) -{ - char tmp[MAX_SIZE]; - Format(tmp, sizeof(tmp), "SM_CONNECTION_TYPE_%u", type); - - return _UU(tmp); -} - -// Get the list of TCP connections connected to VPN Server -UINT PsConnectionList(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) -{ - LIST *o; - PS *ps = (PS *)param; - UINT ret = 0; - RPC_ENUM_CONNECTION t; - UINT i; - CT *ct; - - o = ParseCommandList(c, cmd_name, str, NULL, 0); - if (o == NULL) - { - return ERR_INVALID_PARAMETER; - } - - Zero(&t, sizeof(t)); - - // RPC call - ret = ScEnumConnection(ps->Rpc, &t); - - if (ret != ERR_NO_ERROR) - { - // An error has occured - CmdPrintError(c, ret); - FreeParamValueList(o); - return ret; - } - - ct = CtNew(); - CtInsertColumn(ct, _UU("SM_CONN_COLUMN_1"), false); - CtInsertColumn(ct, _UU("SM_CONN_COLUMN_2"), false); - CtInsertColumn(ct, _UU("SM_CONN_COLUMN_3"), false); - CtInsertColumn(ct, _UU("SM_CONN_COLUMN_4"), false); - - for (i = 0;i < t.NumConnection;i++) - { - wchar_t tmp[MAX_SIZE]; - wchar_t name[MAX_SIZE]; - wchar_t datetime[MAX_SIZE]; - RPC_ENUM_CONNECTION_ITEM *e = &t.Connections[i]; - - StrToUni(name, sizeof(name), e->Name); - UniFormat(tmp, sizeof(tmp), _UU("SM_HOSTNAME_AND_PORT"), e->Hostname, e->Port); - GetDateTimeStrEx64(datetime, sizeof(datetime), SystemToLocal64(e->ConnectedTime), NULL); - - CtInsert(ct, name, tmp, datetime, - GetConnectionTypeStr(e->Type)); - } - - CtFree(ct, c); - - FreeRpcEnumConnection(&t); - - FreeParamValueList(o); - - return 0; -} - -// Get the TCP connection information currently connected to the VPN Server -UINT PsConnectionGet(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) -{ - LIST *o; - PS *ps = (PS *)param; - UINT ret = 0; - RPC_CONNECTION_INFO t; - CT *ct; - wchar_t tmp[MAX_SIZE]; - // Parameter list that can be specified - PARAM args[] = - { - {"[name]", CmdPrompt, _UU("CMD_ConnectionGet_PROMPT_NAME"), CmdEvalNotEmpty, NULL}, - }; - - o = ParseCommandList(c, cmd_name, str, args, sizeof(args) / sizeof(args[0])); - if (o == NULL) - { - return ERR_INVALID_PARAMETER; - } - - Zero(&t, sizeof(t)); - - StrCpy(t.Name, sizeof(t.Name), GetParamStr(o, "[name]")); - - // RPC call - ret = ScGetConnectionInfo(ps->Rpc, &t); - - if (ret != ERR_NO_ERROR) - { - // An error has occured - CmdPrintError(c, ret); - FreeParamValueList(o); - return ret; - } - else - { - ct = CtNewStandard(); - - StrToUni(tmp, sizeof(tmp), t.Name); - CtInsert(ct, _UU("SM_CONNINFO_NAME"), tmp); - - CtInsert(ct, _UU("SM_CONNINFO_TYPE"), GetConnectionTypeStr(t.Type)); - - StrToUni(tmp, sizeof(tmp), t.Hostname); - CtInsert(ct, _UU("SM_CONNINFO_HOSTNAME"), tmp); - - UniToStru(tmp, t.Port); - CtInsert(ct, _UU("SM_CONNINFO_PORT"), tmp); - - GetDateTimeStrEx64(tmp, sizeof(tmp), SystemToLocal64(t.ConnectedTime), NULL); - CtInsert(ct, _UU("SM_CONNINFO_TIME"), tmp); - - StrToUni(tmp, sizeof(tmp), t.ServerStr); - CtInsert(ct, _UU("SM_CONNINFO_SERVER_STR"), tmp); - - UniFormat(tmp, sizeof(tmp), L"%u.%02u", t.ServerVer / 100, t.ServerVer % 100); - CtInsert(ct, _UU("SM_CONNINFO_SERVER_VER"), tmp); - - UniToStru(tmp, t.ServerBuild); - CtInsert(ct, _UU("SM_CONNINFO_SERVER_BUILD"), tmp); - - if (StrLen(t.ClientStr) != 0) - { - StrToUni(tmp, sizeof(tmp), t.ClientStr); - CtInsert(ct, _UU("SM_CONNINFO_CLIENT_STR"), tmp); - - UniFormat(tmp, sizeof(tmp), L"%u.%02u", t.ClientVer / 100, t.ClientVer % 100); - CtInsert(ct, _UU("SM_CONNINFO_CLIENT_VER"), tmp); - - UniToStru(tmp, t.ClientBuild); - CtInsert(ct, _UU("SM_CONNINFO_CLIENT_BUILD"), tmp); - } - - CtFree(ct, c); - } - - FreeParamValueList(o); - - return 0; -} - -// Disconnect the TCP connection connected to the VPN Server -UINT PsConnectionDisconnect(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) -{ - LIST *o; - PS *ps = (PS *)param; - UINT ret = 0; - RPC_DISCONNECT_CONNECTION t; - // Parameter list that can be specified - PARAM args[] = - { - {"[name]", CmdPrompt, _UU("CMD_ConnectionDisconnect_PROMPT_NAME"), CmdEvalNotEmpty, NULL}, - }; - - o = ParseCommandList(c, cmd_name, str, args, sizeof(args) / sizeof(args[0])); - if (o == NULL) - { - return ERR_INVALID_PARAMETER; - } - - Zero(&t, sizeof(t)); - - StrCpy(t.Name, sizeof(t.Name), GetParamStr(o, "[name]")); - - // RPC call - ret = ScDisconnectConnection(ps->Rpc, &t); - - if (ret != ERR_NO_ERROR) - { - // An error has occured - CmdPrintError(c, ret); - FreeParamValueList(o); - return ret; - } - - FreeParamValueList(o); - - return 0; -} - -// Get the LAN card list that can be used for local bridge -UINT PsBridgeDeviceList(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) -{ - LIST *o; - PS *ps = (PS *)param; - UINT ret = 0; - RPC_ENUM_ETH t; - UINT i; - - o = ParseCommandList(c, cmd_name, str, NULL, 0); - if (o == NULL) - { - return ERR_INVALID_PARAMETER; - } - - Zero(&t, sizeof(t)); - - // RPC call - ret = ScEnumEthernet(ps->Rpc, &t); - - if (ret != ERR_NO_ERROR) - { - // An error has occured - CmdPrintError(c, ret); - FreeParamValueList(o); - return ret; - } - - for (i = 0;i < t.NumItem;i++) - { - RPC_ENUM_ETH_ITEM *item = &t.Items[i]; - wchar_t tmp[MAX_SIZE * 2]; - - StrToUni(tmp, sizeof(tmp), item->DeviceName); - c->Write(c, tmp); - } - - FreeRpcEnumEth(&t); - - FreeParamValueList(o); - - return 0; -} - -// Get the list of local bridge connection -UINT PsBridgeList(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) -{ - LIST *o; - PS *ps = (PS *)param; - UINT ret = 0; - RPC_ENUM_LOCALBRIDGE t; - UINT i; - CT *ct; - - o = ParseCommandList(c, cmd_name, str, NULL, 0); - if (o == NULL) - { - return ERR_INVALID_PARAMETER; - } - - Zero(&t, sizeof(t)); - - // RPC call - ret = ScEnumLocalBridge(ps->Rpc, &t); - - if (ret != ERR_NO_ERROR) - { - // An error has occured - CmdPrintError(c, ret); - FreeParamValueList(o); - return ret; - } - - ct = CtNew(); - - CtInsertColumn(ct, _UU("SM_BRIDGE_COLUMN_1"), false); - CtInsertColumn(ct, _UU("SM_BRIDGE_COLUMN_2"), false); - CtInsertColumn(ct, _UU("SM_BRIDGE_COLUMN_3"), false); - CtInsertColumn(ct, _UU("SM_BRIDGE_COLUMN_4"), false); - - for (i = 0;i < t.NumItem;i++) - { - RPC_LOCALBRIDGE *e = &t.Items[i]; - wchar_t name[MAX_SIZE]; - wchar_t nic[MAX_SIZE]; - wchar_t hub[MAX_SIZE]; - wchar_t *status = _UU("SM_BRIDGE_OFFLINE"); - - UniToStru(name, i + 1); - StrToUni(nic, sizeof(nic), e->DeviceName); - StrToUni(hub, sizeof(hub), e->HubName); - - if (e->Online) - { - status = e->Active ? _UU("SM_BRIDGE_ONLINE") : _UU("SM_BRIDGE_ERROR"); - } - - CtInsert(ct, name, hub, nic, status); - } - - CtFree(ct, c); - - FreeRpcEnumLocalBridge(&t); - - FreeParamValueList(o); - - return 0; -} - -// Create a local bridge connection -UINT PsBridgeCreate(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) -{ - LIST *o; - PS *ps = (PS *)param; - UINT ret = 0; - RPC_LOCALBRIDGE t; - // Parameter list that can be specified - PARAM args[] = - { - // "name", prompt_proc, prompt_param, eval_proc, eval_param - {"[hubname]", CmdPrompt, _UU("CMD_BridgeCreate_PROMPT_HUBNAME"), CmdEvalNotEmpty, NULL}, - {"DEVICE", CmdPrompt, _UU("CMD_BridgeCreate_PROMPT_DEVICE"), CmdEvalNotEmpty, NULL}, - {"TAP", NULL, NULL, NULL, NULL}, - }; - - o = ParseCommandList(c, cmd_name, str, args, sizeof(args) / sizeof(args[0])); - if (o == NULL) - { - return ERR_INVALID_PARAMETER; - } - - Zero(&t, sizeof(t)); - - t.Active = true; - StrCpy(t.DeviceName, sizeof(t.DeviceName), GetParamStr(o, "DEVICE")); - StrCpy(t.HubName, sizeof(t.HubName), GetParamStr(o, "[hubname]")); - t.Online = true; - t.TapMode = GetParamYes(o, "TAP"); - - // RPC call - ret = ScAddLocalBridge(ps->Rpc, &t); - - if (ret != ERR_NO_ERROR) - { - // An error has occured - CmdPrintError(c, ret); - FreeParamValueList(o); - return ret; - } - else - { - c->Write(c, _UU("SM_BRIDGE_INTEL")); - c->Write(c, L""); - - if (GetCapsBool(ps->CapsList, "b_is_in_vm")) - { - // Message in the case of operating in a VM - c->Write(c, _UU("D_SM_VMBRIDGE@CAPTION")); - c->Write(c, _UU("D_SM_VMBRIDGE@S_1")); - c->Write(c, _UU("D_SM_VMBRIDGE@S_2")); - c->Write(c, L""); - } - } - - FreeParamValueList(o); - - return 0; -} - -// Delete the local bridge connection -UINT PsBridgeDelete(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) -{ - LIST *o; - PS *ps = (PS *)param; - UINT ret = 0; - RPC_LOCALBRIDGE t; - // Parameter list that can be specified - PARAM args[] = - { - // "name", prompt_proc, prompt_param, eval_proc, eval_param - {"[hubname]", CmdPrompt, _UU("CMD_BridgeDelete_PROMPT_HUBNAME"), CmdEvalNotEmpty, NULL}, - {"DEVICE", CmdPrompt, _UU("CMD_BridgeDelete_PROMPT_DEVICE"), CmdEvalNotEmpty, NULL}, - }; - - o = ParseCommandList(c, cmd_name, str, args, sizeof(args) / sizeof(args[0])); - if (o == NULL) - { - return ERR_INVALID_PARAMETER; - } - - Zero(&t, sizeof(t)); - - StrCpy(t.DeviceName, sizeof(t.DeviceName), GetParamStr(o, "DEVICE")); - StrCpy(t.HubName, sizeof(t.HubName), GetParamStr(o, "[hubname]")); - - // RPC call - ret = ScDeleteLocalBridge(ps->Rpc, &t); - - if (ret != ERR_NO_ERROR) - { - // An error has occured - CmdPrintError(c, ret); - FreeParamValueList(o); - return ret; - } - - FreeParamValueList(o); - - return 0; -} - -// Get the list of features and capabilities of the server -UINT PsCaps(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) -{ - LIST *o; - PS *ps = (PS *)param; - CAPSLIST *t; - UINT i; - CT *ct; - - - o = ParseCommandList(c, cmd_name, str, NULL, 0); - if (o == NULL) - { - return ERR_INVALID_PARAMETER; - } - - // RPC call - t = ScGetCapsEx(ps->Rpc); - - ct = CtNewStandard(); - - for (i = 0;i < LIST_NUM(t->CapsList);i++) - { - CAPS *c = LIST_DATA(t->CapsList, i); - wchar_t title[MAX_SIZE]; - char name[256]; - - Format(name, sizeof(name), "CT_%s", c->Name); - - UniStrCpy(title, sizeof(title), _UU(name)); - - if (UniIsEmptyStr(title)) - { - UniFormat(title, sizeof(title), L"%S", (StrLen(c->Name) >= 2) ? c->Name + 2 : c->Name); - } - - if (StartWith(c->Name, "b_")) - { - bool icon_pass = c->Value == 0 ? false : true; - if (StrCmpi(c->Name, "b_must_install_pcap") == 0) - { - // Reverse only item of WinPcap - icon_pass = !icon_pass; - } - CtInsert(ct, title, c->Value == 0 ? _UU("CAPS_NO") : _UU("CAPS_YES")); - } - else - { - wchar_t str[64]; - UniToStru(str, c->Value); - CtInsert(ct, title, str); - } - } - - CtFree(ct, c); - - FreeCapsList(t); - - FreeParamValueList(o); - - return 0; -} - -// Restart the VPN Server service -UINT PsReboot(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) -{ - LIST *o; - PS *ps = (PS *)param; - UINT ret = 0; - RPC_TEST t; - // Parameter list that can be specified - PARAM args[] = - { - {"RESETCONFIG", NULL, NULL, NULL, NULL}, - }; - - o = ParseCommandList(c, cmd_name, str, args, sizeof(args) / sizeof(args[0])); - if (o == NULL) - { - return ERR_INVALID_PARAMETER; - } - - Zero(&t, sizeof(t)); - - t.IntValue = GetParamYes(o, "RESETCONFIG") ? 1 : 0; - - // RPC call - ret = ScRebootServer(ps->Rpc, &t); - - if (ret != ERR_NO_ERROR) - { - // An error has occured - CmdPrintError(c, ret); - FreeParamValueList(o); - return ret; - } - - FreeRpcTest(&t); - - FreeParamValueList(o); - - return 0; -} - -// Get the current configuration of the VPN Server -UINT PsConfigGet(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) -{ - LIST *o; - PS *ps = (PS *)param; - UINT ret = 0; - RPC_CONFIG t; - // Parameter list that can be specified - PARAM args[] = - { - // "name", prompt_proc, prompt_param, eval_proc, eval_param - {"[path]", NULL, NULL, NULL, NULL}, - }; - - o = ParseCommandList(c, cmd_name, str, args, sizeof(args) / sizeof(args[0])); - if (o == NULL) - { - return ERR_INVALID_PARAMETER; - } - - Zero(&t, sizeof(t)); - - // RPC call - ret = ScGetConfig(ps->Rpc, &t); - - if (ret != ERR_NO_ERROR) - { - // An error has occured - CmdPrintError(c, ret); - FreeParamValueList(o); - return ret; - } - else - { - wchar_t *filename = GetParamUniStr(o, "[path]"); - - if (IsEmptyUniStr(filename)) - { - // Display on the screen - wchar_t tmp[MAX_SIZE]; - UINT buf_size; - wchar_t *buf; - UNI_TOKEN_LIST *lines; - - UniFormat(tmp, sizeof(tmp), _UU("CMD_ConfigGet_FILENAME"), t.FileName, - StrLen(t.FileData)); - c->Write(c, tmp); - c->Write(c, L""); - - buf_size = CalcUtf8ToUni((BYTE *)t.FileData, StrLen(t.FileData)); - buf = ZeroMalloc(buf_size + 32); - - Utf8ToUni(buf, buf_size, (BYTE *)t.FileData, StrLen(t.FileData)); - - lines = UniGetLines(buf); - if (lines != NULL) - { - UINT i; - - for (i = 0;i < lines->NumTokens;i++) - { - c->Write(c, lines->Token[i]); - } - - UniFreeToken(lines); - } - - c->Write(c, L""); - - Free(buf); - } - else - { - // Save to the file - IO *io = FileCreateW(filename); - - if (io == NULL) - { - c->Write(c, _UU("CMD_ConfigGet_FILE_SAVE_FAILED")); - - ret = ERR_INTERNAL_ERROR; - } - else - { - FileWrite(io, t.FileData, StrLen(t.FileData)); - FileClose(io); - } - } - } - - FreeRpcConfig(&t); - - FreeParamValueList(o); - - return ret; -} - -// Write the configuration to the VPN Server -UINT PsConfigSet(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) -{ - LIST *o; - PS *ps = (PS *)param; - UINT ret = 0; - RPC_CONFIG t; - wchar_t *filename; - BUF *buf; - // Parameter list that can be specified - PARAM args[] = - { - // "name", prompt_proc, prompt_param, eval_proc, eval_param - {"[path]", CmdPrompt, _UU("CMD_ConfigSet_PROMPT_PATH"), CmdEvalIsFile, NULL}, - }; - - o = ParseCommandList(c, cmd_name, str, args, sizeof(args) / sizeof(args[0])); - if (o == NULL) - { - return ERR_INVALID_PARAMETER; - } - - filename = GetParamUniStr(o, "[path]"); - - buf = ReadDumpW(filename); - if (buf == NULL) - { - c->Write(c, _UU("CMD_ConfigSet_FILE_LOAD_FAILED")); - } - else - { - Zero(&t, sizeof(t)); - - t.FileData = ZeroMalloc(buf->Size + 1); - Copy(t.FileData, buf->Buf, buf->Size); - FreeBuf(buf); - - // RPC call - ret = ScSetConfig(ps->Rpc, &t); - - if (ret != ERR_NO_ERROR) - { - // An error has occured - CmdPrintError(c, ret); - FreeParamValueList(o); - return ret; - } - - FreeRpcConfig(&t); - } - - FreeParamValueList(o); - - return 0; -} - -// Get the Virtual Layer 3 switch list -UINT PsRouterList(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) -{ - LIST *o; - PS *ps = (PS *)param; - UINT ret = 0; - RPC_ENUM_L3SW t; - - o = ParseCommandList(c, cmd_name, str, NULL, 0); - if (o == NULL) - { - return ERR_INVALID_PARAMETER; - } - - Zero(&t, sizeof(t)); - - // RPC call - ret = ScEnumL3Switch(ps->Rpc, &t); - - if (ret != ERR_NO_ERROR) - { - // An error has occured - CmdPrintError(c, ret); - FreeParamValueList(o); - return ret; - } - else - { - CT *ct = CtNew(); - UINT i; - - CtInsertColumn(ct, _UU("SM_L3_SW_COLUMN1"), false); - CtInsertColumn(ct, _UU("SM_L3_SW_COLUMN2"), false); - CtInsertColumn(ct, _UU("SM_L3_SW_COLUMN3"), true); - CtInsertColumn(ct, _UU("SM_L3_SW_COLUMN4"), true); - - for (i = 0;i < t.NumItem;i++) - { - RPC_ENUM_L3SW_ITEM *e = &t.Items[i]; - wchar_t tmp1[MAX_SIZE], *tmp2, tmp3[64], tmp4[64]; - - StrToUni(tmp1, sizeof(tmp1), e->Name); - if (e->Active == false) - { - tmp2 = _UU("SM_L3_SW_ST_F_F"); - } - else if (e->Online == false) - { - tmp2 = _UU("SM_L3_SW_ST_T_F"); - } - else - { - tmp2 = _UU("SM_L3_SW_ST_T_T"); - } - UniToStru(tmp3, e->NumInterfaces); - UniToStru(tmp4, e->NumTables); - - CtInsert(ct, - tmp1, tmp2, tmp3, tmp4); - } - - CtFree(ct, c); - } - - FreeRpcEnumL3Sw(&t); - - FreeParamValueList(o); - - return 0; -} - -// Define a new virtual layer 3 switch -UINT PsRouterAdd(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) -{ - LIST *o; - PS *ps = (PS *)param; - UINT ret = 0; - RPC_L3SW t; - // Parameter list that can be specified - PARAM args[] = - { - // "name", prompt_proc, prompt_param, eval_proc, eval_param - {"[name]", CmdPrompt, _UU("CMD_RouterAdd_PROMPT_NAME"), CmdEvalNotEmpty, NULL}, - }; - - o = ParseCommandList(c, cmd_name, str, args, sizeof(args) / sizeof(args[0])); - if (o == NULL) - { - return ERR_INVALID_PARAMETER; - } - - Zero(&t, sizeof(t)); - - StrCpy(t.Name, sizeof(t.Name), GetParamStr(o, "[name]")); - - // RPC call - ret = ScAddL3Switch(ps->Rpc, &t); - - if (ret != ERR_NO_ERROR) - { - // An error has occured - CmdPrintError(c, ret); - FreeParamValueList(o); - return ret; - } - - FreeParamValueList(o); - - return 0; -} - -// Delete the Virtual Layer 3 Switch -UINT PsRouterDelete(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) -{ - LIST *o; - PS *ps = (PS *)param; - UINT ret = 0; - RPC_L3SW t; - // Parameter list that can be specified - PARAM args[] = - { - // "name", prompt_proc, prompt_param, eval_proc, eval_param - {"[name]", CmdPrompt, _UU("CMD_RouterDelete_PROMPT_NAME"), CmdEvalNotEmpty, NULL}, - }; - - o = ParseCommandList(c, cmd_name, str, args, sizeof(args) / sizeof(args[0])); - if (o == NULL) - { - return ERR_INVALID_PARAMETER; - } - - Zero(&t, sizeof(t)); - - StrCpy(t.Name, sizeof(t.Name), GetParamStr(o, "[name]")); - - // RPC call - ret = ScDelL3Switch(ps->Rpc, &t); - - if (ret != ERR_NO_ERROR) - { - // An error has occured - CmdPrintError(c, ret); - FreeParamValueList(o); - return ret; - } - - FreeParamValueList(o); - - return 0; -} - -// Start the Virtual Layer 3 Switch -UINT PsRouterStart(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) -{ - LIST *o; - PS *ps = (PS *)param; - UINT ret = 0; - RPC_L3SW t; - // Parameter list that can be specified - PARAM args[] = - { - // "name", prompt_proc, prompt_param, eval_proc, eval_param - {"[name]", CmdPrompt, _UU("CMD_RouterStart_PROMPT_NAME"), CmdEvalNotEmpty, NULL}, - }; - - o = ParseCommandList(c, cmd_name, str, args, sizeof(args) / sizeof(args[0])); - if (o == NULL) - { - return ERR_INVALID_PARAMETER; - } - - Zero(&t, sizeof(t)); - - StrCpy(t.Name, sizeof(t.Name), GetParamStr(o, "[name]")); - - // RPC call - ret = ScStartL3Switch(ps->Rpc, &t); - - if (ret != ERR_NO_ERROR) - { - // An error has occured - CmdPrintError(c, ret); - FreeParamValueList(o); - return ret; - } - - FreeParamValueList(o); - - return 0; -} - -// Stop the Virtual Layer 3 Switch -UINT PsRouterStop(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) -{ - LIST *o; - PS *ps = (PS *)param; - UINT ret = 0; - RPC_L3SW t; - // Parameter list that can be specified - PARAM args[] = - { - // "name", prompt_proc, prompt_param, eval_proc, eval_param - {"[name]", CmdPrompt, _UU("CMD_RouterStop_PROMPT_NAME"), CmdEvalNotEmpty, NULL}, - }; - - o = ParseCommandList(c, cmd_name, str, args, sizeof(args) / sizeof(args[0])); - if (o == NULL) - { - return ERR_INVALID_PARAMETER; - } - - Zero(&t, sizeof(t)); - - StrCpy(t.Name, sizeof(t.Name), GetParamStr(o, "[name]")); - - // RPC call - ret = ScStopL3Switch(ps->Rpc, &t); - - if (ret != ERR_NO_ERROR) - { - // An error has occured - CmdPrintError(c, ret); - FreeParamValueList(o); - return ret; - } - - FreeParamValueList(o); - - return 0; -} - -// Get the interface list registered on Virtual Layer 3 Switch -UINT PsRouterIfList(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) -{ - LIST *o; - PS *ps = (PS *)param; - UINT ret = 0; - RPC_ENUM_L3IF t; - // Parameter list that can be specified - PARAM args[] = - { - // "name", prompt_proc, prompt_param, eval_proc, eval_param - {"[name]", CmdPrompt, _UU("CMD_RouterIfList_PROMPT_NAME"), CmdEvalNotEmpty, NULL}, - }; - - o = ParseCommandList(c, cmd_name, str, args, sizeof(args) / sizeof(args[0])); - if (o == NULL) - { - return ERR_INVALID_PARAMETER; - } - - Zero(&t, sizeof(t)); - - StrCpy(t.Name, sizeof(t.Name), GetParamStr(o, "[name]")); - - // RPC call - ret = ScEnumL3If(ps->Rpc, &t); - - if (ret != ERR_NO_ERROR) - { - // An error has occured - CmdPrintError(c, ret); - FreeParamValueList(o); - return ret; - } - else - { - UINT i; - wchar_t tmp1[MAX_SIZE]; - wchar_t tmp2[MAX_SIZE]; - wchar_t tmp3[MAX_SIZE]; - CT *ct = CtNew(); - - CtInsertColumn(ct, _UU("SM_L3_SW_IF_COLUMN1"), false); - CtInsertColumn(ct, _UU("SM_L3_SW_IF_COLUMN2"), false); - CtInsertColumn(ct, _UU("SM_L3_SW_IF_COLUMN3"), false); - - for (i = 0;i < t.NumItem;i++) - { - RPC_L3IF *e = &t.Items[i]; - - IPToUniStr32(tmp1, sizeof(tmp1), e->IpAddress); - IPToUniStr32(tmp2, sizeof(tmp2), e->SubnetMask); - StrToUni(tmp3, sizeof(tmp3), e->HubName); - - CtInsert(ct, tmp1, tmp2, tmp3); - } - - - CtFree(ct, c); - } - - FreeRpcEnumL3If(&t); - - FreeParamValueList(o); - - return 0; -} - -// Evaluate the IP address and mask -bool CmdEvalIpAndMask4(CONSOLE *c, wchar_t *str, void *param) -{ - char tmp[MAX_SIZE]; - UINT ip, mask; - // Validate arguments - if (c == NULL || str == NULL) - { - return false; - } - - UniToStr(tmp, sizeof(tmp), str); - - if (ParseIpAndMask4(tmp, &ip, &mask) == false) - { - c->Write(c, _UU("CMD_PARSE_IP_MASK_ERROR_1")); - return false; - } - - return true; -} -bool CmdEvalIpAndMask6(CONSOLE *c, wchar_t *str, void *param) -{ - char tmp[MAX_SIZE]; - IP ip, mask; - // Validate arguments - if (c == NULL || str == NULL) - { - return false; - } - - UniToStr(tmp, sizeof(tmp), str); - - if (ParseIpAndMask6(tmp, &ip, &mask) == false) - { - c->Write(c, _UU("CMD_PARSE_IP_MASK_ERROR_1_6")); - return false; - } - - return true; -} - -// Evaluate the network address and the subnet mask -bool CmdEvalNetworkAndSubnetMask4(CONSOLE *c, wchar_t *str, void *param) -{ - char tmp[MAX_SIZE]; - UINT ip, mask; - // Validate arguments - if (c == NULL || str == NULL) - { - return false; - } - - UniToStr(tmp, sizeof(tmp), str); - - if (ParseIpAndSubnetMask4(tmp, &ip, &mask) == false) - { - c->Write(c, _UU("CMD_PARSE_IP_SUBNET_ERROR_1")); - return false; - } - - if (IsNetworkAddress32(ip, mask) == false) - { - c->Write(c, _UU("CMD_PARSE_IP_SUBNET_ERROR_2")); - return false; - } - - return true; -} - -// Evaluate the IP address and subnet mask -bool CmdEvalHostAndSubnetMask4(CONSOLE *c, wchar_t *str, void *param) -{ - char tmp[MAX_SIZE]; - // Validate arguments - if (c == NULL || str == NULL) - { - return false; - } - - UniToStr(tmp, sizeof(tmp), str); - - if (ParseIpAndSubnetMask4(tmp, NULL, NULL) == false) - { - c->Write(c, _UU("CMD_PARSE_IP_SUBNET_ERROR_1")); - return false; - } - - return true; -} - -// Add a virtual interface to the virtual layer 3 switch -UINT PsRouterIfAdd(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) -{ - LIST *o; - PS *ps = (PS *)param; - UINT ret = 0; - RPC_L3IF t; - // Parameter list that can be specified - PARAM args[] = - { - // "name", prompt_proc, prompt_param, eval_proc, eval_param - {"[name]", CmdPrompt, _UU("CMD_RouterIfAdd_PROMPT_NAME"), CmdEvalNotEmpty, NULL}, - {"HUB", CmdPrompt, _UU("CMD_RouterIfAdd_PROMPT_HUB"), CmdEvalNotEmpty, NULL}, - {"IP", CmdPrompt, _UU("CMD_RouterIfAdd_PROMPT_IP"), CmdEvalHostAndSubnetMask4, NULL}, - }; - - o = ParseCommandList(c, cmd_name, str, args, sizeof(args) / sizeof(args[0])); - if (o == NULL) - { - return ERR_INVALID_PARAMETER; - } - - Zero(&t, sizeof(t)); - - StrCpy(t.Name, sizeof(t.Name), GetParamStr(o, "[name]")); - ParseIpAndSubnetMask4(GetParamStr(o, "IP"), &t.IpAddress, &t.SubnetMask); - StrCpy(t.HubName, sizeof(t.HubName), GetParamStr(o, "HUB")); - - // RPC call - ret = ScAddL3If(ps->Rpc, &t); - - if (ret != ERR_NO_ERROR) - { - // An error has occured - CmdPrintError(c, ret); - FreeParamValueList(o); - return ret; - } - - FreeParamValueList(o); - - return 0; -} - -// Delete the virtual interface of the virtual layer 3 switch -UINT PsRouterIfDel(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) -{ - LIST *o; - PS *ps = (PS *)param; - UINT ret = 0; - RPC_L3IF t; - // Parameter list that can be specified - PARAM args[] = - { - // "name", prompt_proc, prompt_param, eval_proc, eval_param - {"[name]", CmdPrompt, _UU("CMD_RouterIfAdd_PROMPT_NAME"), CmdEvalNotEmpty, NULL}, - {"HUB", CmdPrompt, _UU("CMD_RouterIfAdd_PROMPT_HUB"), CmdEvalNotEmpty, NULL}, - }; - - o = ParseCommandList(c, cmd_name, str, args, sizeof(args) / sizeof(args[0])); - if (o == NULL) - { - return ERR_INVALID_PARAMETER; - } - - Zero(&t, sizeof(t)); - - StrCpy(t.Name, sizeof(t.Name), GetParamStr(o, "[name]")); - StrCpy(t.HubName, sizeof(t.HubName), GetParamStr(o, "HUB")); - - // RPC call - ret = ScDelL3If(ps->Rpc, &t); - - if (ret != ERR_NO_ERROR) - { - // An error has occured - CmdPrintError(c, ret); - FreeParamValueList(o); - return ret; - } - - FreeParamValueList(o); - - return 0; -} - -// Get the routing table of the Virtual Layer 3 Switch -UINT PsRouterTableList(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) -{ - LIST *o; - PS *ps = (PS *)param; - UINT ret = 0; - RPC_ENUM_L3TABLE t; - CT *ct; - wchar_t tmp1[MAX_SIZE]; - wchar_t tmp2[MAX_SIZE]; - wchar_t tmp3[MAX_SIZE]; - wchar_t tmp4[MAX_SIZE]; - // Parameter list that can be specified - PARAM args[] = - { - {"[name]", CmdPrompt, _UU("CMD_RouterTableList_PROMPT_NAME"), CmdEvalNotEmpty, NULL}, - }; - - o = ParseCommandList(c, cmd_name, str, args, sizeof(args) / sizeof(args[0])); - if (o == NULL) - { - return ERR_INVALID_PARAMETER; - } - - Zero(&t, sizeof(t)); - - StrCpy(t.Name, sizeof(t.Name), GetParamStr(o, "[name]")); - - // RPC call - ret = ScEnumL3Table(ps->Rpc, &t); - - if (ret != ERR_NO_ERROR) - { - // An error has occured - CmdPrintError(c, ret); - FreeParamValueList(o); - return ret; - } - else - { - UINT i; - - ct = CtNew(); - - CtInsertColumn(ct, _UU("SM_L3_SW_TABLE_COLUMN1"), false); - CtInsertColumn(ct, _UU("SM_L3_SW_TABLE_COLUMN2"), false); - CtInsertColumn(ct, _UU("SM_L3_SW_TABLE_COLUMN3"), false); - CtInsertColumn(ct, _UU("SM_L3_SW_TABLE_COLUMN4"), true); - - for (i = 0;i < t.NumItem;i++) - { - RPC_L3TABLE *e = &t.Items[i]; - - IPToUniStr32(tmp1, sizeof(tmp1), e->NetworkAddress); - IPToUniStr32(tmp2, sizeof(tmp2), e->SubnetMask); - IPToUniStr32(tmp3, sizeof(tmp3), e->GatewayAddress); - UniToStru(tmp4, e->Metric); - - CtInsert(ct, tmp1, tmp2, tmp3, tmp4); - } - - CtFree(ct, c); - } - - FreeRpcEnumL3Table(&t); - - FreeParamValueList(o); - - return 0; -} - -// Add a routing table entry to the Virtual Layer 3 Switch -UINT PsRouterTableAdd(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) -{ - LIST *o; - PS *ps = (PS *)param; - UINT ret = 0; - RPC_L3TABLE t; - // Parameter list that can be specified - PARAM args[] = - { - // "name", prompt_proc, prompt_param, eval_proc, eval_param - {"[name]", CmdPrompt, _UU("CMD_RouterTableAdd_PROMPT_NAME"), CmdEvalNotEmpty, NULL}, - {"NETWORK", CmdPrompt, _UU("CMD_RouterTableAdd_PROMPT_NETWORK"), CmdEvalNetworkAndSubnetMask4, NULL}, - {"GATEWAY", CmdPrompt, _UU("CMD_RouterTableAdd_PROMPT_GATEWAY"), CmdEvalIp, NULL}, - {"METRIC", CmdPrompt, _UU("CMD_RouterTableAdd_PROMPT_METRIC"), CmdEvalInt1, NULL}, - }; - - o = ParseCommandList(c, cmd_name, str, args, sizeof(args) / sizeof(args[0])); - if (o == NULL) - { - return ERR_INVALID_PARAMETER; - } - - Zero(&t, sizeof(t)); - - StrCpy(t.Name, sizeof(t.Name), GetParamStr(o, "[name]")); - ParseIpAndSubnetMask4(GetParamStr(o, "NETWORK"), &t.NetworkAddress, &t.SubnetMask); - t.Metric = GetParamInt(o, "METRIC"); - t.GatewayAddress = StrToIP32(GetParamStr(o, "GATEWAY")); - - // RPC call - ret = ScAddL3Table(ps->Rpc, &t); - - if (ret != ERR_NO_ERROR) - { - // An error has occured - CmdPrintError(c, ret); - FreeParamValueList(o); - return ret; - } - - FreeParamValueList(o); - - return 0; -} - -// Delete the routing table entry of the Virtual Layer 3 Switch -UINT PsRouterTableDel(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) -{ - LIST *o; - PS *ps = (PS *)param; - UINT ret = 0; - RPC_L3TABLE t; - // Parameter list that can be specified - PARAM args[] = - { - // "name", prompt_proc, prompt_param, eval_proc, eval_param - {"[name]", CmdPrompt, _UU("CMD_RouterTableAdd_PROMPT_NAME"), CmdEvalNotEmpty, NULL}, - {"NETWORK", CmdPrompt, _UU("CMD_RouterTableAdd_PROMPT_NETWORK"), CmdEvalNetworkAndSubnetMask4, NULL}, - {"GATEWAY", CmdPrompt, _UU("CMD_RouterTableAdd_PROMPT_GATEWAY"), CmdEvalIp, NULL}, - {"METRIC", CmdPrompt, _UU("CMD_RouterTableAdd_PROMPT_METRIC"), CmdEvalInt1, NULL}, - }; - - o = ParseCommandList(c, cmd_name, str, args, sizeof(args) / sizeof(args[0])); - if (o == NULL) - { - return ERR_INVALID_PARAMETER; - } - - Zero(&t, sizeof(t)); - - StrCpy(t.Name, sizeof(t.Name), GetParamStr(o, "[name]")); - ParseIpAndSubnetMask4(GetParamStr(o, "NETWORK"), &t.NetworkAddress, &t.SubnetMask); - t.Metric = GetParamInt(o, "METRIC"); - t.GatewayAddress = StrToIP32(GetParamStr(o, "GATEWAY")); - - // RPC call - ret = ScDelL3Table(ps->Rpc, &t); - - if (ret != ERR_NO_ERROR) - { - // An error has occured - CmdPrintError(c, ret); - FreeParamValueList(o); - return ret; - } - - FreeParamValueList(o); - - return 0; -} - -// Get the log files list -UINT PsLogFileList(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) -{ - LIST *o; - PS *ps = (PS *)param; - UINT ret = 0; - RPC_ENUM_LOG_FILE t; - - o = ParseCommandList(c, cmd_name, str, NULL, 0); - if (o == NULL) - { - return ERR_INVALID_PARAMETER; - } - - Zero(&t, sizeof(t)); - - c->Write(c, _UU("CMD_LogFileList_START")); - c->Write(c, L""); - - // RPC call - ret = ScEnumLogFile(ps->Rpc, &t); - - if (ret != ERR_NO_ERROR) - { - // An error has occured - CmdPrintError(c, ret); - FreeParamValueList(o); - return ret; - } - else - { - UINT i; - wchar_t tmp[MAX_SIZE]; - CT *ct; - - UniFormat(tmp, sizeof(tmp), _UU("CMD_LogFileList_NUM_LOGS"), t.NumItem); - c->Write(c, tmp); - - ct = CtNew(); - - CtInsertColumn(ct, _UU("SM_LOG_FILE_COLUMN_1"), false); - CtInsertColumn(ct, _UU("SM_LOG_FILE_COLUMN_2"), true); - CtInsertColumn(ct, _UU("SM_LOG_FILE_COLUMN_3"), false); - CtInsertColumn(ct, _UU("SM_LOG_FILE_COLUMN_4"), false); - - for (i = 0;i < t.NumItem;i++) - { - RPC_ENUM_LOG_FILE_ITEM *e = &t.Items[i]; - wchar_t tmp1[MAX_PATH], tmp2[128], tmp3[128], tmp4[MAX_HOST_NAME_LEN + 1]; - char tmp[MAX_SIZE]; - - StrToUni(tmp1, sizeof(tmp1), e->FilePath); - - ToStrByte(tmp, sizeof(tmp), e->FileSize); - StrToUni(tmp2, sizeof(tmp2), tmp); - - GetDateTimeStr64Uni(tmp3, sizeof(tmp3), SystemToLocal64(e->UpdatedTime)); - - StrToUni(tmp4, sizeof(tmp4), e->ServerName); - - CtInsert(ct, tmp1, tmp2, tmp3, tmp4); - } - - CtFreeEx(ct, c, true); - } - - FreeRpcEnumLogFile(&t); - - FreeParamValueList(o); - - return 0; -} - -// Download a log file -UINT PsLogFileGet(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) -{ - LIST *o; - PS *ps = (PS *)param; - UINT ret = 0; - BUF *buf; - char *filename = NULL; - char *server_name; - // Parameter list that can be specified - PARAM args[] = - { - // "name", prompt_proc, prompt_param, eval_proc, eval_param - {"[name]", CmdPrompt, _UU("CMD_LogFileGet_PROMPT_NAME"), CmdEvalNotEmpty, NULL}, - {"SERVER", NULL, NULL, NULL, NULL}, - {"SAVEPATH", NULL, NULL, NULL, NULL}, - }; - - o = ParseCommandList(c, cmd_name, str, args, sizeof(args) / sizeof(args[0])); - if (o == NULL) - { - return ERR_INVALID_PARAMETER; - } - - filename = GetParamStr(o, "SAVE"); - if (IsEmptyStr(filename)) - { - filename = GetParamStr(o, "SAVEPATH"); - } - - c->Write(c, _UU("CMD_LogFileGet_START")); - - server_name = GetParamStr(o, "SERVER"); - - buf = DownloadFileFromServer(ps->Rpc, server_name, - GetParamStr(o, "[name]"), 0, NULL, NULL); - - if (buf == NULL) - { - c->Write(c, _UU("CMD_LogFileGet_FAILED")); - - ret = ERR_INTERNAL_ERROR; - } - else - { - if (IsEmptyStr(filename) == false) - { - // Save to the file - if (DumpBuf(buf, filename) == false) - { - ret = ERR_INTERNAL_ERROR; - c->Write(c, _UU("CMD_LogFileGet_SAVE_FAILED")); - } - } - else - { - // Display on the screen - wchar_t tmp[MAX_SIZE]; - UINT buf_size; - wchar_t *uni_buf; - - UniFormat(tmp, sizeof(tmp), _UU("CMD_LogFileGet_FILESIZE"), - buf->Size); - c->Write(c, tmp); - c->Write(c, L""); - - buf_size = CalcUtf8ToUni((BYTE *)buf->Buf, buf->Size); - uni_buf = ZeroMalloc(buf_size + 32); - - Utf8ToUni(uni_buf, buf_size, (BYTE *)buf->Buf, buf->Size); - - c->Write(c, uni_buf); - c->Write(c, L""); - - Free(uni_buf); - } - - FreeBuf(buf); - } - - FreeParamValueList(o); - - return ret; -} - -// Create a New Virtual HUB -UINT PsHubCreate(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) -{ - LIST *o; - PS *ps = (PS *)param; - UINT ret = 0; - RPC_CREATE_HUB t; - char *pass = ""; - UINT hub_type = HUB_TYPE_STANDALONE; - // Parameter list that can be specified - PARAM args[] = - { - {"[name]", CmdPrompt, _UU("CMD_HubCreate_PROMPT_NAME"), CmdEvalNotEmpty, NULL}, - {"PASSWORD", CmdPromptChoosePassword, NULL, NULL, NULL}, - }; - - o = ParseCommandList(c, cmd_name, str, args, sizeof(args) / sizeof(args[0])); - if (o == NULL) - { - return ERR_INVALID_PARAMETER; - } - else - { - RPC_SERVER_INFO t; - Zero(&t, sizeof(t)); - if (ScGetServerInfo(ps->Rpc, &t) == ERR_NO_ERROR) - { - if (t.ServerType == SERVER_TYPE_FARM_CONTROLLER) - { - hub_type = HUB_TYPE_FARM_DYNAMIC; - } - FreeRpcServerInfo(&t); - } - } - - Zero(&t, sizeof(t)); - - StrCpy(t.HubName, sizeof(t.HubName), GetParamStr(o, "[name]")); - t.HubType = hub_type; - - if (IsEmptyStr(GetParamStr(o, "PASSWORD")) == false) - { - pass = GetParamStr(o, "PASSWORD"); - } - - Sha0(t.HashedPassword, pass, StrLen(pass)); - HashPassword(t.SecurePassword, ADMINISTRATOR_USERNAME, pass); - t.Online = true; - - // RPC call - ret = ScCreateHub(ps->Rpc, &t); - - if (ret != ERR_NO_ERROR) - { - // An error has occured - CmdPrintError(c, ret); - FreeParamValueList(o); - return ret; - } - - FreeParamValueList(o); - - return 0; -} - -// Create a New Virtual HUB (dynamic mode) -UINT PsHubCreateDynamic(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) -{ - LIST *o; - PS *ps = (PS *)param; - UINT ret = 0; - RPC_CREATE_HUB t; - char *pass = ""; - UINT hub_type = HUB_TYPE_FARM_DYNAMIC; - // Parameter list that can be specified - PARAM args[] = - { - {"[name]", CmdPrompt, _UU("CMD_HubCreate_PROMPT_NAME"), CmdEvalNotEmpty, NULL}, - {"PASSWORD", CmdPromptChoosePassword, NULL, NULL, NULL}, - }; - - o = ParseCommandList(c, cmd_name, str, args, sizeof(args) / sizeof(args[0])); - if (o == NULL) - { - return ERR_INVALID_PARAMETER; - } - - Zero(&t, sizeof(t)); - - StrCpy(t.HubName, sizeof(t.HubName), GetParamStr(o, "[name]")); - t.HubType = hub_type; - - if (IsEmptyStr(GetParamStr(o, "PASSWORD")) == false) - { - pass = GetParamStr(o, "PASSWORD"); - } - - Sha0(t.HashedPassword, pass, StrLen(pass)); - HashPassword(t.SecurePassword, ADMINISTRATOR_USERNAME, pass); - t.Online = true; - - // RPC call - ret = ScCreateHub(ps->Rpc, &t); - - if (ret != ERR_NO_ERROR) - { - // An error has occured - CmdPrintError(c, ret); - FreeParamValueList(o); - return ret; - } - - FreeParamValueList(o); - - return 0; -} - -// Create a New Virtual HUB (static mode) -UINT PsHubCreateStatic(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) -{ - LIST *o; - PS *ps = (PS *)param; - UINT ret = 0; - RPC_CREATE_HUB t; - char *pass = ""; - UINT hub_type = HUB_TYPE_FARM_STATIC; - // Parameter list that can be specified - PARAM args[] = - { - {"[name]", CmdPrompt, _UU("CMD_HubCreate_PROMPT_NAME"), CmdEvalNotEmpty, NULL}, - {"PASSWORD", CmdPromptChoosePassword, NULL, NULL, NULL}, - }; - - o = ParseCommandList(c, cmd_name, str, args, sizeof(args) / sizeof(args[0])); - if (o == NULL) - { - return ERR_INVALID_PARAMETER; - } - - Zero(&t, sizeof(t)); - - StrCpy(t.HubName, sizeof(t.HubName), GetParamStr(o, "[name]")); - t.HubType = hub_type; - - if (IsEmptyStr(GetParamStr(o, "PASSWORD")) == false) - { - pass = GetParamStr(o, "PASSWORD"); - } - - Sha0(t.HashedPassword, pass, StrLen(pass)); - HashPassword(t.SecurePassword, ADMINISTRATOR_USERNAME, pass); - t.Online = true; - - // RPC call - ret = ScCreateHub(ps->Rpc, &t); - - if (ret != ERR_NO_ERROR) - { - // An error has occured - CmdPrintError(c, ret); - FreeParamValueList(o); - return ret; - } - - FreeParamValueList(o); - - return 0; -} - -// Delete a Virtual HUB -UINT PsHubDelete(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) -{ - LIST *o; - PS *ps = (PS *)param; - UINT ret = 0; - RPC_DELETE_HUB t; - // Parameter list that can be specified - PARAM args[] = - { - // "name", prompt_proc, prompt_param, eval_proc, eval_param - {"[name]", CmdPrompt, _UU("CMD_HubDelete_PROMPT_NAME"), CmdEvalNotEmpty, NULL}, - }; - - o = ParseCommandList(c, cmd_name, str, args, sizeof(args) / sizeof(args[0])); - if (o == NULL) - { - return ERR_INVALID_PARAMETER; - } - - Zero(&t, sizeof(t)); - - StrCpy(t.HubName, sizeof(t.HubName), GetParamStr(o, "[name]")); - - // RPC call - ret = ScDeleteHub(ps->Rpc, &t); - - if (ret != ERR_NO_ERROR) - { - // An error has occured - CmdPrintError(c, ret); - FreeParamValueList(o); - return ret; - } - - FreeParamValueList(o); - - return 0; -} - -// Set the Virtual HUB to static -UINT PsHubSetStatic(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) -{ - LIST *o; - PS *ps = (PS *)param; - UINT ret = 0; - RPC_CREATE_HUB t; - // Parameter list that can be specified - PARAM args[] = - { - // "name", prompt_proc, prompt_param, eval_proc, eval_param - {"[name]", CmdPrompt, _UU("CMD_HubChange_PROMPT_NAME"), CmdEvalNotEmpty, NULL}, - }; - - o = ParseCommandList(c, cmd_name, str, args, sizeof(args) / sizeof(args[0])); - if (o == NULL) - { - return ERR_INVALID_PARAMETER; - } - - Zero(&t, sizeof(t)); - - StrCpy(t.HubName, sizeof(t.HubName), GetParamStr(o, "[name]")); - - // Retrieve the current setting first - ret = ScGetHub(ps->Rpc, &t); - - if (ret != ERR_NO_ERROR) - { - // An error has occured - CmdPrintError(c, ret); - FreeParamValueList(o); - return ret; - } - - // Change the settings - StrCpy(t.HubName, sizeof(t.HubName), GetParamStr(o, "[name]")); - t.HubType = HUB_TYPE_FARM_STATIC; - - // Write - ret = ScSetHub(ps->Rpc, &t); - - if (ret != ERR_NO_ERROR) - { - // An error has occured - CmdPrintError(c, ret); - FreeParamValueList(o); - return ret; - } - - FreeParamValueList(o); - - return 0; -} - -// Change the type of Virtual HUB to dynamic Virtual HUB -UINT PsHubSetDynamic(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) -{ - LIST *o; - PS *ps = (PS *)param; - UINT ret = 0; - RPC_CREATE_HUB t; - // Parameter list that can be specified - PARAM args[] = - { - // "name", prompt_proc, prompt_param, eval_proc, eval_param - {"[name]", CmdPrompt, _UU("CMD_HubChange_PROMPT_NAME"), CmdEvalNotEmpty, NULL}, - }; - - o = ParseCommandList(c, cmd_name, str, args, sizeof(args) / sizeof(args[0])); - if (o == NULL) - { - return ERR_INVALID_PARAMETER; - } - - Zero(&t, sizeof(t)); - - StrCpy(t.HubName, sizeof(t.HubName), GetParamStr(o, "[name]")); - - // Retrieve the current setting first - ret = ScGetHub(ps->Rpc, &t); - - if (ret != ERR_NO_ERROR) - { - // An error has occured - CmdPrintError(c, ret); - FreeParamValueList(o); - return ret; - } - - // Change the settings - StrCpy(t.HubName, sizeof(t.HubName), GetParamStr(o, "[name]")); - t.HubType = HUB_TYPE_FARM_DYNAMIC; - - // Write - ret = ScSetHub(ps->Rpc, &t); - - if (ret != ERR_NO_ERROR) - { - // An error has occured - CmdPrintError(c, ret); - FreeParamValueList(o); - return ret; - } - - FreeParamValueList(o); - - return 0; -} - -// Get the list of Virtual HUB -UINT PsHubList(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) -{ - LIST *o; - PS *ps = (PS *)param; - UINT ret = 0; - RPC_ENUM_HUB t; - UINT i; - - o = ParseCommandList(c, cmd_name, str, NULL, 0); - if (o == NULL) - { - return ERR_INVALID_PARAMETER; - } - - Zero(&t, sizeof(t)); - - // RPC call - ret = ScEnumHub(ps->Rpc, &t); - - if (ret != ERR_NO_ERROR) - { - // An error has occured - CmdPrintError(c, ret); - FreeParamValueList(o); - return ret; - } - else - { - CT *ct = CtNew(); - - CtInsertColumn(ct, _UU("SM_HUB_COLUMN_1"), false); - CtInsertColumn(ct, _UU("SM_HUB_COLUMN_2"), false); - CtInsertColumn(ct, _UU("SM_HUB_COLUMN_3"), false); - CtInsertColumn(ct, _UU("SM_HUB_COLUMN_4"), false); - CtInsertColumn(ct, _UU("SM_HUB_COLUMN_5"), false); - CtInsertColumn(ct, _UU("SM_HUB_COLUMN_6"), false); - CtInsertColumn(ct, _UU("SM_HUB_COLUMN_7"), false); - CtInsertColumn(ct, _UU("SM_HUB_COLUMN_8"), false); - CtInsertColumn(ct, _UU("SM_HUB_COLUMN_9"), false); - CtInsertColumn(ct, _UU("SM_HUB_COLUMN_10"), false); - CtInsertColumn(ct, _UU("SM_HUB_COLUMN_11"), false); - CtInsertColumn(ct, _UU("SM_SESS_COLUMN_6"), false); - CtInsertColumn(ct, _UU("SM_SESS_COLUMN_7"), false); - - for (i = 0;i < t.NumHub;i++) - { - RPC_ENUM_HUB_ITEM *e = &t.Hubs[i]; - wchar_t name[MAX_HUBNAME_LEN + 1]; - wchar_t s1[64], s2[64], s3[64], s4[64], s5[64]; - wchar_t s6[64], s7[128], s8[128]; - wchar_t s9[64], s10[64]; - - UniToStru(s1, e->NumUsers); - UniToStru(s2, e->NumGroups); - UniToStru(s3, e->NumSessions); - UniToStru(s4, e->NumMacTables); - UniToStru(s5, e->NumIpTables); - - UniToStru(s6, e->NumLogin); - - if (e->LastLoginTime != 0) - { - GetDateTimeStr64Uni(s7, sizeof(s7), SystemToLocal64(e->LastLoginTime)); - } - else - { - UniStrCpy(s7, sizeof(s7), _UU("COMMON_UNKNOWN")); - } - - if (e->LastCommTime != 0) - { - GetDateTimeStr64Uni(s8, sizeof(s8), SystemToLocal64(e->LastCommTime)); - } - else - { - UniStrCpy(s8, sizeof(s8), _UU("COMMON_UNKNOWN")); - } - - if (e->IsTrafficFilled == false) - { - UniStrCpy(s9, sizeof(s9), _UU("CM_ST_NONE")); - UniStrCpy(s10, sizeof(s10), _UU("CM_ST_NONE")); - } - else - { - UniToStr3(s9, sizeof(s9), - e->Traffic.Recv.BroadcastBytes + e->Traffic.Recv.UnicastBytes + - e->Traffic.Send.BroadcastBytes + e->Traffic.Send.UnicastBytes); - - UniToStr3(s10, sizeof(s10), - e->Traffic.Recv.BroadcastCount + e->Traffic.Recv.UnicastCount + - e->Traffic.Send.BroadcastCount + e->Traffic.Send.UnicastCount); - } - - StrToUni(name, sizeof(name), e->HubName); - - CtInsert(ct, - name, - e->Online ? _UU("SM_HUB_ONLINE") : _UU("SM_HUB_OFFLINE"), - GetHubTypeStr(e->HubType), - s1, s2, s3, s4, s5, s6, s7, s8, s9, s10); - } - - CtFreeEx(ct, c, true); - } - - FreeRpcEnumHub(&t); - - FreeParamValueList(o); - - return 0; -} - -// Select a Virtual HUB to manage -UINT PsHub(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) -{ - LIST *o; - PS *ps = (PS *)param; - UINT ret = 0; - RPC_HUB_STATUS t; - // Parameter list that can be specified - PARAM args[] = - { - // "name", prompt_proc, prompt_param, eval_proc, eval_param - {"[name]", NULL, NULL, NULL, NULL}, - }; - - o = ParseCommandList(c, cmd_name, str, args, sizeof(args) / sizeof(args[0])); - if (o == NULL) - { - return ERR_INVALID_PARAMETER; - } - - if (IsEmptyStr(GetParamStr(o, "[name]")) == false) - { - wchar_t tmp[MAX_SIZE]; - Zero(&t, sizeof(t)); - - // Examine whether the specified Virtual HUB is accessible - StrCpy(t.HubName, sizeof(t.HubName), GetParamStr(o, "[name]")); - - // RPC call - ret = ScGetHubStatus(ps->Rpc, &t); - - if (ret != ERR_NO_ERROR) - { - // An error has occured - CmdPrintError(c, ret); - FreeParamValueList(o); - return ret; - } - - // Change the selection - if (ps->HubName != NULL) - { - Free(ps->HubName); - } - ps->HubName = CopyStr(t.HubName); - - UniFormat(tmp, sizeof(tmp), _UU("CMD_Hub_Selected"), t.HubName); - c->Write(c, tmp); - } - else - { - // Deselect - if (ps->HubName != NULL) - { - c->Write(c, _UU("CMD_Hub_Unselected")); - Free(ps->HubName); - } - ps->HubName = NULL; - } - - FreeParamValueList(o); - - return 0; -} - -// Set the Virtual HUB to online -UINT PsOnline(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) -{ - LIST *o; - PS *ps = (PS *)param; - UINT ret = 0; - RPC_SET_HUB_ONLINE t; - - // If virtual HUB is not selected, it's an error - if (ps->HubName == NULL) - { - c->Write(c, _UU("CMD_Hub_Not_Selected")); - return ERR_INVALID_PARAMETER; - } - - o = ParseCommandList(c, cmd_name, str, NULL, 0); - if (o == NULL) - { - return ERR_INVALID_PARAMETER; - } - - Zero(&t, sizeof(t)); - - StrCpy(t.HubName, sizeof(t.HubName), ps->HubName); - t.Online = true; - - // RPC call - ret = ScSetHubOnline(ps->Rpc, &t); - - if (ret != ERR_NO_ERROR) - { - // An error has occured - CmdPrintError(c, ret); - FreeParamValueList(o); - return ret; - } - - FreeParamValueList(o); - - return 0; -} - -// Set the Virtual HUB to offline -UINT PsOffline(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) -{ - LIST *o; - PS *ps = (PS *)param; - UINT ret = 0; - RPC_SET_HUB_ONLINE t; - - // If virtual HUB is not selected, it's an error - if (ps->HubName == NULL) - { - c->Write(c, _UU("CMD_Hub_Not_Selected")); - return ERR_INVALID_PARAMETER; - } - - o = ParseCommandList(c, cmd_name, str, NULL, 0); - if (o == NULL) - { - return ERR_INVALID_PARAMETER; - } - - Zero(&t, sizeof(t)); - - StrCpy(t.HubName, sizeof(t.HubName), ps->HubName); - t.Online = false; - - // RPC call - ret = ScSetHubOnline(ps->Rpc, &t); - - if (ret != ERR_NO_ERROR) - { - // An error has occured - CmdPrintError(c, ret); - FreeParamValueList(o); - return ret; - } - - FreeParamValueList(o); - - return 0; -} - -// Set the maximum number of concurrent connecting sessions of the Virtual HUB -UINT PsSetMaxSession(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) -{ - LIST *o; - PS *ps = (PS *)param; - UINT ret = 0; - RPC_CREATE_HUB t; - // Parameter list that can be specified - PARAM args[] = - { - {"[max_session]", CmdPrompt, _UU("CMD_SetMaxSession_Prompt"), CmdEvalNotEmpty, NULL}, - }; - - // If virtual HUB is not selected, it's an error - if (ps->HubName == NULL) - { - c->Write(c, _UU("CMD_Hub_Not_Selected")); - return ERR_INVALID_PARAMETER; - } - - o = ParseCommandList(c, cmd_name, str, args, sizeof(args) / sizeof(args[0])); - if (o == NULL) - { - return ERR_INVALID_PARAMETER; - } - - // Get current settings of Virtual HUB - Zero(&t, sizeof(t)); - StrCpy(t.HubName, sizeof(t.HubName), ps->HubName); - ret = ScGetHub(ps->Rpc, &t); - if (ret != ERR_NO_ERROR) - { - // An error has occured - CmdPrintError(c, ret); - FreeParamValueList(o); - return ret; - } - - t.HubOption.MaxSession = GetParamInt(o, "[max_session]"); - - // Write the configuration of Virtual HUB - ret = ScSetHub(ps->Rpc, &t); - if (ret != ERR_NO_ERROR) - { - // An error has occured - CmdPrintError(c, ret); - FreeParamValueList(o); - return ret; - } - - FreeParamValueList(o); - - return 0; -} - -// Set the administrative password of the Virtual HUB -UINT PsSetHubPassword(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) -{ - LIST *o; - PS *ps = (PS *)param; - UINT ret = 0; - RPC_CREATE_HUB t; - char *pw; - // Parameter list that can be specified - PARAM args[] = - { - {"[password]", CmdPromptChoosePassword, NULL, NULL, NULL}, - }; - - // If virtual HUB is not selected, it's an error - if (ps->HubName == NULL) - { - c->Write(c, _UU("CMD_Hub_Not_Selected")); - return ERR_INVALID_PARAMETER; - } - - o = ParseCommandList(c, cmd_name, str, args, sizeof(args) / sizeof(args[0])); - if (o == NULL) - { - return ERR_INVALID_PARAMETER; - } - - // Get current settings of Virtual HUB - Zero(&t, sizeof(t)); - StrCpy(t.HubName, sizeof(t.HubName), ps->HubName); - ret = ScGetHub(ps->Rpc, &t); - if (ret != ERR_NO_ERROR) - { - // An error has occured - CmdPrintError(c, ret); - FreeParamValueList(o); - return ret; - } - - // Change the settings - pw = GetParamStr(o, "[password]"); - HashPassword(t.SecurePassword, ADMINISTRATOR_USERNAME, pw); - Sha0(t.HashedPassword, pw, StrLen(pw)); - - // Write the configuration of Virtual HUB - ret = ScSetHub(ps->Rpc, &t); - if (ret != ERR_NO_ERROR) - { - // An error has occured - CmdPrintError(c, ret); - FreeParamValueList(o); - return ret; - } - - FreeParamValueList(o); - - return 0; -} - -// Set the Virtual HUB to permit to be enumerated for anonymous users -UINT PsSetEnumAllow(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) -{ - LIST *o; - PS *ps = (PS *)param; - UINT ret = 0; - RPC_CREATE_HUB t; - - // If virtual HUB is not selected, it's an error - if (ps->HubName == NULL) - { - c->Write(c, _UU("CMD_Hub_Not_Selected")); - return ERR_INVALID_PARAMETER; - } - - o = ParseCommandList(c, cmd_name, str, NULL, 0); - if (o == NULL) - { - return ERR_INVALID_PARAMETER; - } - - // Get current settings of Virtual HUB - Zero(&t, sizeof(t)); - StrCpy(t.HubName, sizeof(t.HubName), ps->HubName); - ret = ScGetHub(ps->Rpc, &t); - if (ret != ERR_NO_ERROR) - { - // An error has occured - CmdPrintError(c, ret); - FreeParamValueList(o); - return ret; - } - - t.HubOption.NoEnum = false; - - // Write the configuration of Virtual HUB - ret = ScSetHub(ps->Rpc, &t); - if (ret != ERR_NO_ERROR) - { - // An error has occured - CmdPrintError(c, ret); - FreeParamValueList(o); - return ret; - } - - FreeParamValueList(o); - - return 0; -} - -// Set the Virtual HUB to deny to be enumerated for anonymous users -UINT PsSetEnumDeny(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) -{ - LIST *o; - PS *ps = (PS *)param; - UINT ret = 0; - RPC_CREATE_HUB t; - - // If virtual HUB is not selected, it's an error - if (ps->HubName == NULL) - { - c->Write(c, _UU("CMD_Hub_Not_Selected")); - return ERR_INVALID_PARAMETER; - } - - o = ParseCommandList(c, cmd_name, str, NULL, 0); - if (o == NULL) - { - return ERR_INVALID_PARAMETER; - } - - // Get current settings of Virtual HUB - Zero(&t, sizeof(t)); - StrCpy(t.HubName, sizeof(t.HubName), ps->HubName); - ret = ScGetHub(ps->Rpc, &t); - if (ret != ERR_NO_ERROR) - { - // An error has occured - CmdPrintError(c, ret); - FreeParamValueList(o); - return ret; - } - - t.HubOption.NoEnum = true; - - // Write the configuration of Virtual HUB - ret = ScSetHub(ps->Rpc, &t); - if (ret != ERR_NO_ERROR) - { - // An error has occured - CmdPrintError(c, ret); - FreeParamValueList(o); - return ret; - } - - FreeParamValueList(o); - - return 0; -} - -// Get the option settings for the virtual HUB -UINT PsOptionsGet(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) -{ - LIST *o; - PS *ps = (PS *)param; - UINT ret = 0; - RPC_CREATE_HUB t; - - // If virtual HUB is not selected, it's an error - if (ps->HubName == NULL) - { - c->Write(c, _UU("CMD_Hub_Not_Selected")); - return ERR_INVALID_PARAMETER; - } - - o = ParseCommandList(c, cmd_name, str, NULL, 0); - if (o == NULL) - { - return ERR_INVALID_PARAMETER; - } - - Zero(&t, sizeof(t)); - - StrCpy(t.HubName, sizeof(t.HubName), ps->HubName); - - // RPC call - ret = ScGetHub(ps->Rpc, &t); - - if (ret != ERR_NO_ERROR) - { - // An error has occured - CmdPrintError(c, ret); - FreeParamValueList(o); - return ret; - } - else - { - CT *ct; - wchar_t tmp[MAX_SIZE]; - - UniFormat(tmp, sizeof(tmp), _UU("CMD_OptionsGet_TITLE"), ps->HubName); - c->Write(c, tmp); - - // Display settings - ct = CtNewStandard(); - - CtInsert(ct, _UU("CMD_OptionsGet_ENUM"), - t.HubOption.NoEnum ? _UU("CMD_MSG_DENY") : _UU("CMD_MSG_ALLOW")); - - if (t.HubOption.MaxSession == 0) - { - UniStrCpy(tmp, sizeof(tmp), _UU("CMD_MSG_INFINITE")); - } - else - { - UniToStru(tmp, t.HubOption.MaxSession); - } - CtInsert(ct, _UU("CMD_OptionsGet_MAXSESSIONS"), tmp); - - CtInsert(ct, _UU("CMD_OptionsGet_STATUS"), t.Online ? _UU("SM_HUB_ONLINE") : _UU("SM_HUB_OFFLINE")); - - CtInsert(ct, _UU("CMD_OptionsGet_TYPE"), GetHubTypeStr(t.HubType)); - - CtFree(ct, c); - } - - FreeParamValueList(o); - - return 0; -} - -// Setting the Radius server to use for user authentication -UINT PsRadiusServerSet(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) -{ - LIST *o; - PS *ps = (PS *)param; - UINT ret = 0; - RPC_RADIUS t; - char *host; - UINT port; - // Parameter list that can be specified - CMD_EVAL_MIN_MAX minmax = - { - "CMD_RadiusServerSet_EVAL_NUMINTERVAL", RADIUS_RETRY_INTERVAL, RADIUS_RETRY_TIMEOUT, - }; - PARAM args[] = - { - // "name", prompt_proc, prompt_param, eval_proc, eval_param - {"[server_name:port]", CmdPrompt, _UU("CMD_RadiusServerSet_Prompt_Host"), CmdEvalNotEmpty, NULL}, - {"SECRET", CmdPromptChoosePassword, _UU("CMD_RadiusServerSet_Prompt_Secret"), NULL, NULL}, - {"RETRY_INTERVAL", CmdPrompt, _UU("CMD_RadiusServerSet_Prompt_RetryInterval"), CmdEvalMinMax, &minmax}, - }; - - // If virtual HUB is not selected, it's an error - if (ps->HubName == NULL) - { - c->Write(c, _UU("CMD_Hub_Not_Selected")); - return ERR_INVALID_PARAMETER; - } - - o = ParseCommandList(c, cmd_name, str, args, sizeof(args) / sizeof(args[0])); - if (o == NULL) - { - return ERR_INVALID_PARAMETER; - } - - if (ParseHostPort(GetParamStr(o, "[server_name:port]"), &host, &port, 1812)) - { - Zero(&t, sizeof(t)); - - StrCpy(t.HubName, sizeof(t.HubName), ps->HubName); - t.RadiusPort = port; - StrCpy(t.RadiusServerName, sizeof(t.RadiusServerName), host); - StrCpy(t.RadiusSecret, sizeof(t.RadiusSecret), GetParamStr(o, "SECRET")); - t.RadiusRetryInterval = GetParamInt(o, "RETRY_INTERVAL"); - - Free(host); - - // RPC call - ret = ScSetHubRadius(ps->Rpc, &t); - - if (ret != ERR_NO_ERROR) - { - // An error has occured - CmdPrintError(c, ret); - FreeParamValueList(o); - return ret; - } - } - - FreeParamValueList(o); - - return 0; -} - -// Delete the Radius server configuration to be used for user authentication -UINT PsRadiusServerDelete(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) -{ - LIST *o; - PS *ps = (PS *)param; - UINT ret = 0; - RPC_RADIUS t; - - // If virtual HUB is not selected, it's an error - if (ps->HubName == NULL) - { - c->Write(c, _UU("CMD_Hub_Not_Selected")); - return ERR_INVALID_PARAMETER; - } - - o = ParseCommandList(c, cmd_name, str, NULL, 0); - if (o == NULL) - { - return ERR_INVALID_PARAMETER; - } - - Zero(&t, sizeof(t)); - - StrCpy(t.HubName, sizeof(t.HubName), ps->HubName); - t.RadiusPort = 1812; - - // RPC call - ret = ScSetHubRadius(ps->Rpc, &t); - - if (ret != ERR_NO_ERROR) - { - // An error has occured - CmdPrintError(c, ret); - FreeParamValueList(o); - return ret; - } - - FreeParamValueList(o); - - return 0; -} - -// Get the Radius server settings to use for user authentication -UINT PsRadiusServerGet(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) -{ - LIST *o; - PS *ps = (PS *)param; - UINT ret = 0; - RPC_RADIUS t; - - // If virtual HUB is not selected, it's an error - if (ps->HubName == NULL) - { - c->Write(c, _UU("CMD_Hub_Not_Selected")); - return ERR_INVALID_PARAMETER; - } - - o = ParseCommandList(c, cmd_name, str, NULL, 0); - if (o == NULL) - { - return ERR_INVALID_PARAMETER; - } - - Zero(&t, sizeof(t)); - - StrCpy(t.HubName, sizeof(t.HubName), ps->HubName); - - // RPC call - ret = ScGetHubRadius(ps->Rpc, &t); - - if (ret != ERR_NO_ERROR) - { - // An error has occured - CmdPrintError(c, ret); - FreeParamValueList(o); - return ret; - } - else - { - CT *ct; - wchar_t tmp[MAX_SIZE]; - - ct = CtNewStandard(); - - if (IsEmptyStr(t.RadiusServerName)) - { - CtInsert(ct, _UU("CMD_RadiusServerGet_STATUS"), _UU("CMD_MSG_DISABLE")); - } - else - { - CtInsert(ct, _UU("CMD_RadiusServerGet_STATUS"), _UU("CMD_MSG_ENABLE")); - - StrToUni(tmp, sizeof(tmp), t.RadiusServerName); - CtInsert(ct, _UU("CMD_RadiusServerGet_HOST"), tmp); - - UniToStri(tmp, t.RadiusPort); - CtInsert(ct, _UU("CMD_RadiusServerGet_PORT"), tmp); - - StrToUni(tmp, sizeof(tmp), t.RadiusSecret); - CtInsert(ct, _UU("CMD_RadiusServerGet_SECRET"), tmp); - - UniToStri(tmp, t.RadiusRetryInterval); - CtInsert(ct, _UU("CMD_RadiusServerGet_RetryInterval"), tmp); - } - - CtFree(ct, c); - } - - FreeParamValueList(o); - - return 0; -} - -// Get the current status of the Virtual HUB -UINT PsStatusGet(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) -{ - LIST *o; - PS *ps = (PS *)param; - UINT ret = 0; - RPC_HUB_STATUS t; - - o = ParseCommandList(c, cmd_name, str, NULL, 0); - if (o == NULL) - { - return ERR_INVALID_PARAMETER; - } - - // If virtual HUB is not selected, it's an error - if (ps->HubName == NULL) - { - c->Write(c, _UU("CMD_Hub_Not_Selected")); - return ERR_INVALID_PARAMETER; - } - - Zero(&t, sizeof(t)); - - StrCpy(t.HubName, sizeof(t.HubName), ps->HubName); - - // RPC call - ret = ScGetHubStatus(ps->Rpc, &t); - - if (ret != ERR_NO_ERROR) - { - // An error has occured - CmdPrintError(c, ret); - FreeParamValueList(o); - return ret; - } - else - { - CT *ct = CtNewStandard(); - wchar_t *s; - wchar_t tmp[MAX_SIZE]; - - // HUB name - s = CopyStrToUni(t.HubName); - CtInsert(ct, _UU("SM_HUB_STATUS_HUBNAME"), s); - Free(s); - - // Online - CtInsert(ct, _UU("SM_HUB_STATUS_ONLINE"), - t.Online ? _UU("SM_HUB_ONLINE") : _UU("SM_HUB_OFFLINE")); - - // Type of HUB - CtInsert(ct, _UU("SM_HUB_TYPE"), - GetHubTypeStr(t.HubType)); - - if (t.HubType == HUB_TYPE_STANDALONE) - { - // Enable / Disable the SecureNAT - CtInsert(ct, _UU("SM_HUB_SECURE_NAT"), - t.SecureNATEnabled ? _UU("SM_HUB_SECURE_NAT_YES") : _UU("SM_HUB_SECURE_NAT_NO")); - } - - // Other values - UniToStru(tmp, t.NumSessions); - CtInsert(ct, _UU("SM_HUB_NUM_SESSIONS"), tmp); - - if (t.NumSessionsClient != 0 || t.NumSessionsBridge != 0) - { - UniToStru(tmp, t.NumSessionsClient); - CtInsert(ct, _UU("SM_HUB_NUM_SESSIONS_CLIENT"), tmp); - UniToStru(tmp, t.NumSessionsBridge); - CtInsert(ct, _UU("SM_HUB_NUM_SESSIONS_BRIDGE"), tmp); - } - - UniToStru(tmp, t.NumAccessLists); - CtInsert(ct, _UU("SM_HUB_NUM_ACCESSES"), tmp); - - UniToStru(tmp, t.NumUsers); - CtInsert(ct, _UU("SM_HUB_NUM_USERS"), tmp); - UniToStru(tmp, t.NumGroups); - CtInsert(ct, _UU("SM_HUB_NUM_GROUPS"), tmp); - - UniToStru(tmp, t.NumMacTables); - CtInsert(ct, _UU("SM_HUB_NUM_MAC_TABLES"), tmp); - UniToStru(tmp, t.NumIpTables); - CtInsert(ct, _UU("SM_HUB_NUM_IP_TABLES"), tmp); - - // Usage status - UniToStru(tmp, t.NumLogin); - CtInsert(ct, _UU("SM_HUB_NUM_LOGIN"), tmp); - - if (t.LastLoginTime != 0) - { - GetDateTimeStr64Uni(tmp, sizeof(tmp), SystemToLocal64(t.LastLoginTime)); - } - else - { - UniStrCpy(tmp, sizeof(tmp), _UU("COMMON_UNKNOWN")); - } - CtInsert(ct, _UU("SM_HUB_LAST_LOGIN_TIME"), tmp); - - if (t.LastCommTime != 0) - { - GetDateTimeStr64Uni(tmp, sizeof(tmp), SystemToLocal64(t.LastCommTime)); - } - else - { - UniStrCpy(tmp, sizeof(tmp), _UU("COMMON_UNKNOWN")); - } - CtInsert(ct, _UU("SM_HUB_LAST_COMM_TIME"), tmp); - - if (t.CreatedTime != 0) - { - GetDateTimeStr64Uni(tmp, sizeof(tmp), SystemToLocal64(t.CreatedTime)); - } - else - { - UniStrCpy(tmp, sizeof(tmp), _UU("COMMON_UNKNOWN")); - } - CtInsert(ct, _UU("SM_HUB_CREATED_TIME"), tmp); - - // Traffic information - CmdInsertTrafficInfo(ct, &t.Traffic); - - CtFree(ct, c); - } - - FreeParamValueList(o); - - return 0; -} - -// Get the log switching string -wchar_t *GetLogSwitchStr(UINT i) -{ - char tmp[64]; - - Format(tmp, sizeof(tmp), "SM_LOG_SWITCH_%u", i); - - return _UU(tmp); -} - -// Get the packet log name string -wchar_t *GetPacketLogNameStr(UINT i) -{ - char tmp[64]; - - Format(tmp, sizeof(tmp), "CMD_Log_%u", i); - - return _UU(tmp); -} - -// Get the log storage settings for the virtual HUB -UINT PsLogGet(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) -{ - LIST *o; - PS *ps = (PS *)param; - UINT ret = 0; - RPC_HUB_LOG t; - - // If virtual HUB is not selected, it's an error - if (ps->HubName == NULL) - { - c->Write(c, _UU("CMD_Hub_Not_Selected")); - return ERR_INVALID_PARAMETER; - } - - o = ParseCommandList(c, cmd_name, str, NULL, 0); - if (o == NULL) - { - return ERR_INVALID_PARAMETER; - } - - Zero(&t, sizeof(t)); - - StrCpy(t.HubName, sizeof(t.HubName), ps->HubName); - - // RPC call - ret = ScGetHubLog(ps->Rpc, &t); - - if (ret != ERR_NO_ERROR) - { - // An error has occured - CmdPrintError(c, ret); - FreeParamValueList(o); - return ret; - } - else - { - CT *ct = CtNewStandard(); - - CtInsert(ct, _UU("CMD_Log_SecurityLog"), - t.LogSetting.SaveSecurityLog ? _UU("CMD_MSG_ENABLE") : _UU("CMD_MSG_DISABLE")); - if (t.LogSetting.SaveSecurityLog) - { - CtInsert(ct, _UU("CMD_Log_SwitchType"), GetLogSwitchStr(t.LogSetting.SecurityLogSwitchType)); - } - - CtInsert(ct, L"", L""); - - CtInsert(ct, _UU("CMD_Log_PacketLog"), - t.LogSetting.SavePacketLog ? _UU("CMD_MSG_ENABLE") : _UU("CMD_MSG_DISABLE")); - if (t.LogSetting.SavePacketLog) - { - UINT i; - - CtInsert(ct, _UU("CMD_Log_SwitchType"), GetLogSwitchStr(t.LogSetting.PacketLogSwitchType)); - - for (i = 0;i <= 7;i++) - { - wchar_t *tmp = NULL; - - switch (t.LogSetting.PacketLogConfig[i]) - { - case PACKET_LOG_NONE: - tmp = _UU("D_SM_LOG@B_PACKET_0_0"); - break; - - case PACKET_LOG_HEADER: - tmp = _UU("D_SM_LOG@B_PACKET_0_1"); - break; - - case PACKET_LOG_ALL: - tmp = _UU("D_SM_LOG@B_PACKET_0_2"); - break; - } - - CtInsert(ct, GetPacketLogNameStr(i), - tmp); - } - } - - CtFree(ct, c); - } - - FreeParamValueList(o); - - return 0; -} - -// LogEnable command -UINT PsLogEnable(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) -{ - LIST *o; - PS *ps = (PS *)param; - UINT ret = 0; - RPC_HUB_LOG t; - bool packet_log = false; - char *tmp; - // Parameter list that can be specified - PARAM args[] = - { - {"[security|packet]", CmdPrompt, _UU("CMD_LogEnable_Prompt"), CmdEvalNotEmpty, NULL}, - }; - - // If virtual HUB is not selected, it's an error - if (ps->HubName == NULL) - { - c->Write(c, _UU("CMD_Hub_Not_Selected")); - return ERR_INVALID_PARAMETER; - } - - o = ParseCommandList(c, cmd_name, str, args, sizeof(args) / sizeof(args[0])); - if (o == NULL) - { - return ERR_INVALID_PARAMETER; - } - - tmp = GetParamStr(o, "[security|packet]"); - - if (StartWith(tmp, "p")) - { - packet_log = true; - } - else if (StartWith(tmp, "s") == false) - { - c->Write(c, _UU("CMD_LogEnable_Prompt_Error")); - FreeParamValueList(o); - return ret; - } - - Zero(&t, sizeof(t)); - - StrCpy(t.HubName, sizeof(t.HubName), ps->HubName); - - // RPC call - ret = ScGetHubLog(ps->Rpc, &t); - if (ret != ERR_NO_ERROR) - { - // An error has occured - CmdPrintError(c, ret); - FreeParamValueList(o); - return ret; - } - - if (packet_log == false) - { - t.LogSetting.SaveSecurityLog = true; - } - else - { - t.LogSetting.SavePacketLog = true; - } - - // RPC call - ret = ScSetHubLog(ps->Rpc, &t); - if (ret != ERR_NO_ERROR) - { - // An error has occured - CmdPrintError(c, ret); - FreeParamValueList(o); - return ret; - } - - FreeParamValueList(o); - - return 0; -} - -// Disable the packet log or the security log -UINT PsLogDisable(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) -{ - LIST *o; - PS *ps = (PS *)param; - UINT ret = 0; - RPC_HUB_LOG t; - bool packet_log = false; - char *tmp; - // Parameter list that can be specified - PARAM args[] = - { - {"[security|packet]", CmdPrompt, _UU("CMD_LogEnable_Prompt"), CmdEvalNotEmpty, NULL}, - }; - - // If virtual HUB is not selected, it's an error - if (ps->HubName == NULL) - { - c->Write(c, _UU("CMD_Hub_Not_Selected")); - return ERR_INVALID_PARAMETER; - } - - o = ParseCommandList(c, cmd_name, str, args, sizeof(args) / sizeof(args[0])); - if (o == NULL) - { - return ERR_INVALID_PARAMETER; - } - - tmp = GetParamStr(o, "[security|packet]"); - - if (StartWith(tmp, "p")) - { - packet_log = true; - } - else if (StartWith(tmp, "s") == false) - { - c->Write(c, _UU("CMD_LogEnable_Prompt_Error")); - FreeParamValueList(o); - return ERR_INVALID_PARAMETER; - } - - Zero(&t, sizeof(t)); - - StrCpy(t.HubName, sizeof(t.HubName), ps->HubName); - - // RPC call - ret = ScGetHubLog(ps->Rpc, &t); - if (ret != ERR_NO_ERROR) - { - // An error has occured - CmdPrintError(c, ret); - FreeParamValueList(o); - return ret; - } - - if (packet_log == false) - { - t.LogSetting.SaveSecurityLog = false; - } - else - { - t.LogSetting.SavePacketLog = false; - } - - // RPC call - ret = ScSetHubLog(ps->Rpc, &t); - if (ret != ERR_NO_ERROR) - { - // An error has occured - CmdPrintError(c, ret); - FreeParamValueList(o); - return ret; - } - - FreeParamValueList(o); - - return 0; -} - -// Convert the string to log switching type -UINT StrToLogSwitchType(char *str) -{ - UINT ret = INFINITE; - // Validate arguments - if (str == NULL) - { - return INFINITE; - } - - if (IsEmptyStr(str) || StartWith("none", str)) - { - ret = LOG_SWITCH_NO; - } - else if (StartWith("second", str)) - { - ret = LOG_SWITCH_SECOND; - } - else if (StartWith("minute", str)) - { - ret = LOG_SWITCH_MINUTE; - } - else if (StartWith("hour", str)) - { - ret = LOG_SWITCH_HOUR; - } - else if (StartWith("day", str)) - { - ret = LOG_SWITCH_DAY; - } - else if (StartWith("month", str)) - { - ret = LOG_SWITCH_MONTH; - } - - return ret; -} - -// Set the switching period of the log file -UINT PsLogSwitchSet(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) -{ - LIST *o; - PS *ps = (PS *)param; - UINT ret = 0; - RPC_HUB_LOG t; - bool packet_log = false; - char *tmp; - UINT new_switch_type = 0; - // Parameter list that can be specified - PARAM args[] = - { - {"[security|packet]", CmdPrompt, _UU("CMD_LogEnable_Prompt"), CmdEvalNotEmpty, NULL}, - {"SWITCH", CmdPrompt, _UU("CMD_LogSwitchSet_Prompt"), NULL, NULL}, - }; - - // If virtual HUB is not selected, it's an error - if (ps->HubName == NULL) - { - c->Write(c, _UU("CMD_Hub_Not_Selected")); - return ERR_INVALID_PARAMETER; - } - - o = ParseCommandList(c, cmd_name, str, args, sizeof(args) / sizeof(args[0])); - if (o == NULL) - { - return ERR_INVALID_PARAMETER; - } - - tmp = GetParamStr(o, "[security|packet]"); - - if (StartWith(tmp, "p")) - { - packet_log = true; - } - else if (StartWith(tmp, "s") == false) - { - c->Write(c, _UU("CMD_LogEnable_Prompt_Error")); - FreeParamValueList(o); - return ERR_INVALID_PARAMETER; - } - - new_switch_type = StrToLogSwitchType(GetParamStr(o, "SWITCH")); - - if (new_switch_type == INFINITE) - { - c->Write(c, _UU("CMD_LogEnable_Prompt_Error")); - FreeParamValueList(o); - return ERR_INVALID_PARAMETER; - } - - Zero(&t, sizeof(t)); - - StrCpy(t.HubName, sizeof(t.HubName), ps->HubName); - - // RPC call - ret = ScGetHubLog(ps->Rpc, &t); - if (ret != ERR_NO_ERROR) - { - // An error has occured - CmdPrintError(c, ret); - FreeParamValueList(o); - return ret; - } - - if (packet_log == false) - { - t.LogSetting.SecurityLogSwitchType = new_switch_type; - } - else - { - t.LogSetting.PacketLogSwitchType = new_switch_type; - } - - // RPC call - ret = ScSetHubLog(ps->Rpc, &t); - if (ret != ERR_NO_ERROR) - { - // An error has occured - CmdPrintError(c, ret); - FreeParamValueList(o); - return ret; - } - - FreeParamValueList(o); - - return 0; -} - -// Convert the type string of the packet log contents to an integer -UINT StrToPacketLogSaveInfoType(char *str) -{ - UINT ret = INFINITE; - if (str == NULL) - { - return INFINITE; - } - - if (StartWith("none", str) || IsEmptyStr(str)) - { - ret = PACKET_LOG_NONE; - } - else if (StartWith("header", str)) - { - ret = PACKET_LOG_HEADER; - } - else if (StartWith("full", str) || StartWith("all", str)) - { - ret = PACKET_LOG_ALL; - } - - return ret; -} - -// Convert a packet type string of the packet log to an integer -UINT StrToPacketLogType(char *str) -{ - UINT ret = INFINITE; - if (str == NULL || IsEmptyStr(str)) - { - return INFINITE; - } - - if (StartWith("tcpconn", str)) - { - ret = PACKET_LOG_TCP_CONN; - } - else if (StartWith("tcpdata", str)) - { - ret = PACKET_LOG_TCP; - } - else if (StartWith("dhcp", str)) - { - ret = PACKET_LOG_DHCP; - } - else if (StartWith("udp", str)) - { - ret = PACKET_LOG_UDP; - } - else if (StartWith("icmp", str)) - { - ret = PACKET_LOG_ICMP; - } - else if (StartWith("ip", str)) - { - ret = PACKET_LOG_IP; - } - else if (StartWith("arp", str)) - { - ret = PACKET_LOG_ARP; - } - else if (StartWith("ethernet", str)) - { - ret = PACKET_LOG_ETHERNET; - } - - return ret; -} - -// Set the detail level and type of packet to be stored in the packet log -UINT PsLogPacketSaveType(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) -{ - LIST *o; - PS *ps = (PS *)param; - UINT ret = 0; - RPC_HUB_LOG t; - UINT packet_type = INFINITE; - UINT packet_save_info_type = INFINITE; - // Parameter list that can be specified - PARAM args[] = - { - {"TYPE", CmdPrompt, _UU("CMD_LogPacketSaveType_Prompt_TYPE"), NULL, NULL}, - {"SAVE", CmdPrompt, _UU("CMD_LogPacketSaveType_Prompt_SAVE"), NULL, NULL}, - }; - - // If virtual HUB is not selected, it's an error - if (ps->HubName == NULL) - { - c->Write(c, _UU("CMD_Hub_Not_Selected")); - return ERR_INVALID_PARAMETER; - } - - o = ParseCommandList(c, cmd_name, str, args, sizeof(args) / sizeof(args[0])); - if (o == NULL) - { - return ERR_INVALID_PARAMETER; - } - - packet_type = StrToPacketLogType(GetParamStr(o, "TYPE")); - packet_save_info_type = StrToPacketLogSaveInfoType(GetParamStr(o, "SAVE")); - - if (packet_type == INFINITE || packet_save_info_type == INFINITE) - { - c->Write(c, _UU("CMD_LogEnable_Prompt_Error")); - FreeParamValueList(o); - return ERR_INVALID_PARAMETER; - } - - Zero(&t, sizeof(t)); - - StrCpy(t.HubName, sizeof(t.HubName), ps->HubName); - - // RPC call - ret = ScGetHubLog(ps->Rpc, &t); - if (ret != ERR_NO_ERROR) - { - // An error has occured - CmdPrintError(c, ret); - FreeParamValueList(o); - return ret; - } - - t.LogSetting.PacketLogConfig[packet_type] = packet_save_info_type; - - // RPC call - ret = ScSetHubLog(ps->Rpc, &t); - if (ret != ERR_NO_ERROR) - { - // An error has occured - CmdPrintError(c, ret); - FreeParamValueList(o); - return ret; - } - - FreeParamValueList(o); - - return 0; -} - -// Get the list of certificates of the trusted certification authority -UINT PsCAList(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) -{ - LIST *o; - PS *ps = (PS *)param; - UINT ret = 0; - RPC_HUB_ENUM_CA t; - - // If virtual HUB is not selected, it's an error - if (ps->HubName == NULL) - { - c->Write(c, _UU("CMD_Hub_Not_Selected")); - return ERR_INVALID_PARAMETER; - } - - o = ParseCommandList(c, cmd_name, str, NULL, 0); - if (o == NULL) - { - return ERR_INVALID_PARAMETER; - } - - Zero(&t, sizeof(t)); - - StrCpy(t.HubName, sizeof(t.HubName), ps->HubName); - - // RPC call - ret = ScEnumCa(ps->Rpc, &t); - - if (ret != ERR_NO_ERROR) - { - // An error has occured - CmdPrintError(c, ret); - FreeParamValueList(o); - return ret; - } - else - { - UINT i; - CT *ct = CtNewStandard(); - - for (i = 0;i < t.NumCa;i++) - { - wchar_t tmp[MAX_SIZE]; - wchar_t tmp2[64]; - RPC_HUB_ENUM_CA_ITEM *e = &t.Ca[i]; - - GetDateStrEx64(tmp, sizeof(tmp), SystemToLocal64(e->Expires), NULL); - - UniToStru(tmp2, e->Key); - - CtInsert(ct, _UU("CMD_CAList_COLUMN_ID"), tmp2); - CtInsert(ct, _UU("CM_CERT_COLUMN_1"), e->SubjectName); - CtInsert(ct, _UU("CM_CERT_COLUMN_2"), e->IssuerName); - CtInsert(ct, _UU("CM_CERT_COLUMN_3"), tmp); - - if (i != (t.NumCa - 1)) - { - CtInsert(ct, L"---", L"---"); - } - } - - CtFree(ct, c); - } - - FreeRpcHubEnumCa(&t); - - FreeParamValueList(o); - - return 0; -} - -// Add a certificate to the trusted certification authority -UINT PsCAAdd(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) -{ - LIST *o; - PS *ps = (PS *)param; - UINT ret = 0; - RPC_HUB_ADD_CA t; - X *x; - // Parameter list that can be specified - PARAM args[] = - { - // "name", prompt_proc, prompt_param, eval_proc, eval_param - {"[path]", CmdPrompt, _UU("CMD_CAAdd_PROMPT_PATH"), CmdEvalIsFile, NULL}, - }; - - // If virtual HUB is not selected, it's an error - if (ps->HubName == NULL) - { - c->Write(c, _UU("CMD_Hub_Not_Selected")); - return ERR_INVALID_PARAMETER; - } - - o = ParseCommandList(c, cmd_name, str, args, sizeof(args) / sizeof(args[0])); - if (o == NULL) - { - return ERR_INVALID_PARAMETER; - } - - x = FileToXW(GetParamUniStr(o, "[path]")); - - if (x == NULL) - { - FreeParamValueList(o); - c->Write(c, _UU("CMD_MSG_LOAD_CERT_FAILED")); - return ERR_INVALID_PARAMETER; - } - - Zero(&t, sizeof(t)); - StrCpy(t.HubName, sizeof(t.HubName), ps->HubName); - t.Cert = x; - - // RPC call - ret = ScAddCa(ps->Rpc, &t); - - if (ret != ERR_NO_ERROR) - { - // An error has occured - CmdPrintError(c, ret); - FreeParamValueList(o); - return ret; - } - - FreeRpcHubAddCa(&t); - - FreeParamValueList(o); - - return 0; -} - -// Delete the certificate of the trusted certification authority -UINT PsCADelete(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) -{ - LIST *o; - PS *ps = (PS *)param; - UINT ret = 0; - RPC_HUB_DELETE_CA t; - // Parameter list that can be specified - PARAM args[] = - { - // "name", prompt_proc, prompt_param, eval_proc, eval_param - {"[id]", CmdPrompt, _UU("CMD_CADelete_PROMPT_ID"), CmdEvalNotEmpty, NULL}, - }; - - // If virtual HUB is not selected, it's an error - if (ps->HubName == NULL) - { - c->Write(c, _UU("CMD_Hub_Not_Selected")); - return ERR_INVALID_PARAMETER; - } - - o = ParseCommandList(c, cmd_name, str, args, sizeof(args) / sizeof(args[0])); - if (o == NULL) - { - return ERR_INVALID_PARAMETER; - } - - Zero(&t, sizeof(t)); - StrCpy(t.HubName, sizeof(t.HubName), ps->HubName); - t.Key = GetParamInt(o, "[id]"); - - // RPC call - ret = ScDeleteCa(ps->Rpc, &t); - - if (ret != ERR_NO_ERROR) - { - // An error has occured - CmdPrintError(c, ret); - FreeParamValueList(o); - return ret; - } - - FreeParamValueList(o); - - return 0; -} - -// Get the certificate of the trusted certification authority -UINT PsCAGet(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) -{ - LIST *o; - PS *ps = (PS *)param; - UINT ret = 0; - RPC_HUB_GET_CA t; - // Parameter list that can be specified - PARAM args[] = - { - // "name", prompt_proc, prompt_param, eval_proc, eval_param - {"[id]", CmdPrompt, _UU("CMD_CAGet_PROMPT_ID"), CmdEvalNotEmpty, NULL}, - {"SAVECERT", CmdPrompt, _UU("CMD_CAGet_PROMPT_SAVECERT"), CmdEvalNotEmpty, NULL}, - }; - - // If virtual HUB is not selected, it's an error - if (ps->HubName == NULL) - { - c->Write(c, _UU("CMD_Hub_Not_Selected")); - return ERR_INVALID_PARAMETER; - } - - o = ParseCommandList(c, cmd_name, str, args, sizeof(args) / sizeof(args[0])); - if (o == NULL) - { - return ERR_INVALID_PARAMETER; - } - - Zero(&t, sizeof(t)); - StrCpy(t.HubName, sizeof(t.HubName), ps->HubName); - t.Key = GetParamInt(o, "[id]"); - - // RPC call - ret = ScGetCa(ps->Rpc, &t); - - if (ret != ERR_NO_ERROR) - { - // An error has occured - CmdPrintError(c, ret); - FreeParamValueList(o); - return ret; - } - else - { - if (XToFileW(t.Cert, GetParamUniStr(o, "SAVECERT"), true)) - { - // Success - } - else - { - ret = ERR_INTERNAL_ERROR; - c->Write(c, _UU("CMD_MSG_SAVE_CERT_FAILED")); - } - } - - FreeRpcHubGetCa(&t); - - FreeParamValueList(o); - - return ret; -} - -// Get the cascade connection list -UINT PsCascadeList(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) -{ - LIST *o; - PS *ps = (PS *)param; - UINT ret = 0; - RPC_ENUM_LINK t; - - // If virtual HUB is not selected, it's an error - if (ps->HubName == NULL) - { - c->Write(c, _UU("CMD_Hub_Not_Selected")); - return ERR_INVALID_PARAMETER; - } - - o = ParseCommandList(c, cmd_name, str, NULL, 0); - if (o == NULL) - { - return ERR_INVALID_PARAMETER; - } - - Zero(&t, sizeof(t)); - StrCpy(t.HubName, sizeof(t.HubName), ps->HubName); - - // RPC call - ret = ScEnumLink(ps->Rpc, &t); - - if (ret != ERR_NO_ERROR) - { - // An error has occured - CmdPrintError(c, ret); - FreeParamValueList(o); - return ret; - } - else - { - CT *ct = CtNew(); - UINT i; - - CtInsertColumn(ct, _UU("SM_LINK_COLUMN_1"), false); - CtInsertColumn(ct, _UU("SM_LINK_COLUMN_2"), false); - CtInsertColumn(ct, _UU("SM_LINK_COLUMN_3"), false); - CtInsertColumn(ct, _UU("SM_LINK_COLUMN_4"), false); - CtInsertColumn(ct, _UU("SM_LINK_COLUMN_5"), false); - - for (i = 0;i < t.NumLink;i++) - { - RPC_ENUM_LINK_ITEM *e = &t.Links[i]; - wchar_t tmp1[MAX_SIZE]; - wchar_t tmp2[MAX_SIZE]; - wchar_t tmp3[MAX_SIZE]; - wchar_t tmp4[MAX_SIZE]; - - GetDateTimeStrEx64(tmp1, sizeof(tmp1), SystemToLocal64(e->ConnectedTime), NULL); - StrToUni(tmp2, sizeof(tmp2), e->Hostname); - StrToUni(tmp3, sizeof(tmp3), e->HubName); - - if (e->Online == false) - { - UniStrCpy(tmp4, sizeof(tmp4), _UU("SM_LINK_STATUS_OFFLINE")); - } - else - { - if (e->Connected) - { - UniStrCpy(tmp4, sizeof(tmp4), _UU("SM_LINK_STATUS_ONLINE")); - } - else - { - if (e->LastError != 0) - { - UniFormat(tmp4, sizeof(tmp4), _UU("SM_LINK_STATUS_ERROR"), e->LastError, _E(e->LastError)); - } - else - { - UniStrCpy(tmp4, sizeof(tmp4), _UU("SM_LINK_CONNECTING")); - } - } - } - - CtInsert(ct, e->AccountName, tmp4, tmp1, tmp2, tmp3); - } - - CtFreeEx(ct, c, true); - } - - FreeRpcEnumLink(&t); - - FreeParamValueList(o); - - return 0; -} - -// Creat a new cascade -UINT PsCascadeCreate(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) -{ - LIST *o; - PS *ps = (PS *)param; - UINT ret = 0; - RPC_CREATE_LINK t; - char *host = NULL; - UINT port = 443; - // Parameter list that can be specified - PARAM args[] = - { - // "name", prompt_proc, prompt_param, eval_proc, eval_param - {"[name]", CmdPrompt, _UU("CMD_CascadeCreate_Prompt_Name"), CmdEvalNotEmpty, NULL}, - {"SERVER", CmdPrompt, _UU("CMD_CascadeCreate_Prompt_Server"), CmdEvalHostAndPort, NULL}, - {"HUB", CmdPrompt, _UU("CMD_CascadeCreate_Prompt_Hub"), CmdEvalSafe, NULL}, - {"USERNAME", CmdPrompt, _UU("CMD_CascadeCreate_Prompt_Username"), CmdEvalNotEmpty, NULL}, - }; - - // If virtual HUB is not selected, it's an error - if (ps->HubName == NULL) - { - c->Write(c, _UU("CMD_Hub_Not_Selected")); - return ERR_INVALID_PARAMETER; - } - - o = ParseCommandList(c, cmd_name, str, args, sizeof(args) / sizeof(args[0])); - if (o == NULL) - { - return ERR_INVALID_PARAMETER; - } - - ParseHostPort(GetParamStr(o, "SERVER"), &host, &port, 443); - - Zero(&t, sizeof(t)); - StrCpy(t.HubName, sizeof(t.HubName), ps->HubName); - - t.Online = false; - - Copy(&t.Policy, GetDefaultPolicy(), sizeof(POLICY)); - - t.ClientOption = ZeroMalloc(sizeof(CLIENT_OPTION)); - UniStrCpy(t.ClientOption->AccountName, sizeof(t.ClientOption->AccountName), GetParamUniStr(o, "[name]")); - t.ClientOption->Port = port; - StrCpy(t.ClientOption->Hostname, sizeof(t.ClientOption->Hostname), host); - StrCpy(t.ClientOption->HubName, sizeof(t.ClientOption->HubName), GetParamStr(o, "HUB")); - t.ClientOption->NumRetry = INFINITE; - t.ClientOption->RetryInterval = 15; - t.ClientOption->MaxConnection = 8; - t.ClientOption->UseEncrypt = true; - t.ClientOption->AdditionalConnectionInterval = 1; - t.ClientOption->RequireBridgeRoutingMode = true; - - t.ClientAuth = ZeroMalloc(sizeof(CLIENT_AUTH)); - t.ClientAuth->AuthType = CLIENT_AUTHTYPE_ANONYMOUS; - StrCpy(t.ClientAuth->Username, sizeof(t.ClientAuth->Username), GetParamStr(o, "USERNAME")); - - Free(host); - - // RPC call - ret = ScCreateLink(ps->Rpc, &t); - - if (ret != ERR_NO_ERROR) - { - // An error has occured - CmdPrintError(c, ret); - FreeParamValueList(o); - return ret; - } - - FreeRpcCreateLink(&t); - - FreeParamValueList(o); - - return 0; -} - -// Set the user name and destination of the cascade connection -UINT PsCascadeSet(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) -{ - LIST *o; - PS *ps = (PS *)param; - UINT ret = 0; - RPC_CREATE_LINK t; - char *host = NULL; - UINT port = 443; - // Parameter list that can be specified - PARAM args[] = - { - // "name", prompt_proc, prompt_param, eval_proc, eval_param - {"[name]", CmdPrompt, _UU("CMD_CascadeCreate_Prompt_Name"), CmdEvalNotEmpty, NULL}, - {"SERVER", CmdPrompt, _UU("CMD_CascadeCreate_Prompt_Server"), CmdEvalHostAndPort, NULL}, - {"HUB", CmdPrompt, _UU("CMD_CascadeCreate_Prompt_Hub"), CmdEvalSafe, NULL}, - }; - - // If virtual HUB is not selected, it's an error - if (ps->HubName == NULL) - { - c->Write(c, _UU("CMD_Hub_Not_Selected")); - return ERR_INVALID_PARAMETER; - } - - o = ParseCommandList(c, cmd_name, str, args, sizeof(args) / sizeof(args[0])); - if (o == NULL) - { - return ERR_INVALID_PARAMETER; - } - - ParseHostPort(GetParamStr(o, "SERVER"), &host, &port, 443); - - Zero(&t, sizeof(t)); - StrCpy(t.HubName, sizeof(t.HubName), ps->HubName); - - t.ClientOption = ZeroMalloc(sizeof(CLIENT_OPTION)); - UniStrCpy(t.ClientOption->AccountName, sizeof(t.ClientOption->AccountName), GetParamUniStr(o, "[name]")); - - ret = ScGetLink(ps->Rpc, &t); - if (ret != ERR_NO_ERROR) - { - // An error has occured - CmdPrintError(c, ret); - FreeParamValueList(o); - Free(host); - return ret; - } - - t.ClientOption->Port = port; - StrCpy(t.ClientOption->Hostname, sizeof(t.ClientOption->Hostname), host); - StrCpy(t.ClientOption->HubName, sizeof(t.ClientOption->HubName), GetParamStr(o, "HUB")); - - Free(host); - - // RPC call - ret = ScSetLink(ps->Rpc, &t); - - if (ret != ERR_NO_ERROR) - { - // An error has occured - CmdPrintError(c, ret); - FreeParamValueList(o); - return ret; - } - - FreeRpcCreateLink(&t); - - FreeParamValueList(o); - - return 0; -} - -// Get the type string of proxy -wchar_t *GetProxyTypeStr(UINT i) -{ - switch (i) - { - case PROXY_DIRECT: - - return _UU("PROTO_DIRECT_TCP"); - - case PROXY_HTTP: - return _UU("PROTO_HTTP_PROXY"); - - case PROXY_SOCKS: - return _UU("PROTO_SOCKS_PROXY"); - - default: - return _UU("PROTO_UNKNOWN"); - } -} - -// Get type string in user authentication for client -wchar_t *GetClientAuthTypeStr(UINT i) -{ - char tmp[MAX_SIZE]; - - Format(tmp, sizeof(tmp), "PW_TYPE_%u", i); - - return _UU(tmp); -} - -// Get the setting of cascade connection -UINT PsCascadeGet(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) -{ - LIST *o; - PS *ps = (PS *)param; - UINT ret = 0; - RPC_CREATE_LINK t; - // Parameter list that can be specified - PARAM args[] = - { - // "name", prompt_proc, prompt_param, eval_proc, eval_param - {"[name]", CmdPrompt, _UU("CMD_CascadeCreate_Prompt_Name"), CmdEvalNotEmpty, NULL}, - }; - - // If virtual HUB is not selected, it's an error - if (ps->HubName == NULL) - { - c->Write(c, _UU("CMD_Hub_Not_Selected")); - return ERR_INVALID_PARAMETER; - } - - o = ParseCommandList(c, cmd_name, str, args, sizeof(args) / sizeof(args[0])); - if (o == NULL) - { - return ERR_INVALID_PARAMETER; - } - - Zero(&t, sizeof(t)); - StrCpy(t.HubName, sizeof(t.HubName), ps->HubName); - t.ClientOption = ZeroMalloc(sizeof(CLIENT_OPTION)); - UniStrCpy(t.ClientOption->AccountName, sizeof(t.ClientOption->AccountName), - GetParamUniStr(o, "[name]")); - - // RPC call - ret = ScGetLink(ps->Rpc, &t); - - if (ret != ERR_NO_ERROR) - { - // An error has occured - CmdPrintError(c, ret); - FreeParamValueList(o); - return ret; - } - else - { - // Show the contents of the connection settings - wchar_t tmp[MAX_SIZE]; - - CT *ct = CtNewStandard(); - - // Connection settings name - CtInsert(ct, _UU("CMD_ACCOUNT_COLUMN_NAME"), t.ClientOption->AccountName); - - // Host name of the destination VPN Server - StrToUni(tmp, sizeof(tmp), t.ClientOption->Hostname); - CtInsert(ct, _UU("CMD_ACCOUNT_COLUMN_HOSTNAME"), tmp); - - // The port number to connect to VPN Server - UniToStru(tmp, t.ClientOption->Port); - CtInsert(ct, _UU("CMD_ACCOUNT_COLUMN_PORT"), tmp); - - // Virtual HUB name of the destination VPN Server - StrToUni(tmp, sizeof(tmp), t.ClientOption->HubName); - CtInsert(ct, _UU("CMD_ACCOUNT_COLUMN_HUBNAME"), tmp); - - // Type of proxy server to go through - CtInsert(ct, _UU("CMD_ACCOUNT_COLUMN_PROXY_TYPE"), GetProxyTypeStr(t.ClientOption->ProxyType)); - - if (t.ClientOption->ProxyType != PROXY_DIRECT) - { - // Host name of the proxy server - StrToUni(tmp, sizeof(tmp), t.ClientOption->ProxyName); - CtInsert(ct, _UU("CMD_ACCOUNT_COLUMN_PROXY_HOSTNAME"), tmp); - - // Port number of the proxy server - UniToStru(tmp, t.ClientOption->ProxyPort); - CtInsert(ct, _UU("CMD_ACCOUNT_COLUMN_PROXY_PORT"), tmp); - - // User name of the proxy server - StrToUni(tmp, sizeof(tmp), t.ClientOption->ProxyUsername); - CtInsert(ct, _UU("CMD_ACCOUNT_COLUMN_PROXY_USERNAME"), tmp); - } - - // To verify the server certificate - CtInsert(ct, _UU("CMD_ACCOUNT_COLUMN_SERVER_CERT_USE"), - t.CheckServerCert ? _UU("CMD_MSG_ENABLE") : _UU("CMD_MSG_DISABLE")); - - // Registered specific certificate - if (t.ServerCert != NULL) - { - GetAllNameFromX(tmp, sizeof(tmp), t.ServerCert); - CtInsert(ct, _UU("CMD_ACCOUNT_COLUMN_SERVER_CERT_NAME"), tmp); - } - - // Device name to be used for the connection - StrToUni(tmp, sizeof(tmp), t.ClientOption->DeviceName); - CtInsert(ct, _UU("CMD_ACCOUNT_COLUMN_DEVICE_NAME"), tmp); - - // Authentication type - CtInsert(ct, _UU("CMD_ACCOUNT_COLUMN_AUTH_TYPE"), GetClientAuthTypeStr(t.ClientAuth->AuthType)); - - // User name - StrToUni(tmp, sizeof(tmp), t.ClientAuth->Username); - CtInsert(ct, _UU("CMD_ACCOUNT_COLUMN_AUTH_USERNAME"), tmp); - - if (t.ClientAuth->AuthType == CLIENT_AUTHTYPE_CERT) - { - if (t.ClientAuth->ClientX != NULL) - { - // Client certificate name - GetAllNameFromX(tmp, sizeof(tmp), t.ClientAuth->ClientX); - CtInsert(ct, _UU("CMD_ACCOUNT_COLUMN_AUTH_CERT_NAME"), tmp); - } - } - - // Number of TCP connections to be used for VPN communication - UniToStru(tmp, t.ClientOption->MaxConnection); - CtInsert(ct, _UU("CMD_ACCOUNT_COLUMN_NUMTCP"), tmp); - - // Establishment interval of each TCP connection - UniToStru(tmp, t.ClientOption->AdditionalConnectionInterval); - CtInsert(ct, _UU("CMD_ACCOUNT_COLUMN_TCP_INTERVAL"), tmp); - - // Life span of each TCP connection - if (t.ClientOption->ConnectionDisconnectSpan != 0) - { - UniToStru(tmp, t.ClientOption->ConnectionDisconnectSpan); - } - else - { - UniStrCpy(tmp, sizeof(tmp), _UU("CMD_MSG_INFINITE")); - } - CtInsert(ct, _UU("CMD_ACCOUNT_COLUMN_TCP_TTL"), tmp); - - // Use of half-duplex mode - CtInsert(ct, _UU("CMD_ACCOUNT_COLUMN_TCP_HALF"), - t.ClientOption->HalfConnection ? _UU("CMD_MSG_ENABLE") : _UU("CMD_MSG_DISABLE")); - - // Encryption by SSL - CtInsert(ct, _UU("CMD_ACCOUNT_COLUMN_ENCRYPT"), - t.ClientOption->UseEncrypt ? _UU("CMD_MSG_ENABLE") : _UU("CMD_MSG_DISABLE")); - - // Data compression - CtInsert(ct, _UU("CMD_ACCOUNT_COLUMN_COMPRESS"), - t.ClientOption->UseCompress ? _UU("CMD_MSG_ENABLE") : _UU("CMD_MSG_DISABLE")); - - // Connect in bridge / router mode - CtInsert(ct, _UU("CMD_ACCOUNT_COLUMN_BRIDGE_ROUTER"), - t.ClientOption->RequireBridgeRoutingMode ? _UU("CMD_MSG_ENABLE") : _UU("CMD_MSG_DISABLE")); - - // Connect in monitoring mode - CtInsert(ct, _UU("CMD_ACCOUNT_COLUMN_MONITOR"), - t.ClientOption->RequireMonitorMode ? _UU("CMD_MSG_ENABLE") : _UU("CMD_MSG_DISABLE")); - - // Not to rewrite the routing table - CtInsert(ct, _UU("CMD_ACCOUNT_COLUMN_NO_TRACKING"), - t.ClientOption->NoRoutingTracking ? _UU("CMD_MSG_ENABLE") : _UU("CMD_MSG_DISABLE")); - - // Disable the QoS control - CtInsert(ct, _UU("CMD_ACCOUNT_COLUMN_QOS_DISABLE"), - t.ClientOption->DisableQoS ? _UU("CMD_MSG_ENABLE") : _UU("CMD_MSG_DISABLE")); - - CtFree(ct, c); - - // Security policy - c->Write(c, L""); - c->Write(c, _UU("CMD_CascadeGet_Policy")); - PrintPolicy(c, &t.Policy, true); - } - - FreeRpcCreateLink(&t); - - FreeParamValueList(o); - - return 0; -} - -// Delete the cascade connection -UINT PsCascadeDelete(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) -{ - LIST *o; - PS *ps = (PS *)param; - UINT ret = 0; - RPC_LINK t; - // Parameter list that can be specified - PARAM args[] = - { - {"[name]", CmdPrompt, _UU("CMD_CascadeCreate_Prompt_Name"), CmdEvalNotEmpty, NULL}, - }; - - // If virtual HUB is not selected, it's an error - if (ps->HubName == NULL) - { - c->Write(c, _UU("CMD_Hub_Not_Selected")); - return ERR_INVALID_PARAMETER; - } - - o = ParseCommandList(c, cmd_name, str, args, sizeof(args) / sizeof(args[0])); - if (o == NULL) - { - return ERR_INVALID_PARAMETER; - } - - Zero(&t, sizeof(t)); - UniStrCpy(t.AccountName, sizeof(t.AccountName), GetParamUniStr(o, "[name]")); - StrCpy(t.HubName, sizeof(t.HubName), ps->HubName); - - // RPC call - ret = ScDeleteLink(ps->Rpc, &t); - - if (ret != ERR_NO_ERROR) - { - // An error has occured - CmdPrintError(c, ret); - FreeParamValueList(o); - return ret; - } - - FreeParamValueList(o); - - return 0; -} - -// Set the user name to use for the cascade connection -UINT PsCascadeUsernameSet(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) -{ - LIST *o; - PS *ps = (PS *)param; - UINT ret = 0; - RPC_CREATE_LINK t; - // Parameter list that can be specified - PARAM args[] = - { - {"[name]", CmdPrompt, _UU("CMD_CascadeCreate_Prompt_Name"), CmdEvalNotEmpty, NULL}, - {"USERNAME", CmdPrompt, _UU("CMD_CascadeCreate_Prompt_Username"), CmdEvalNotEmpty, NULL}, - }; - - // If virtual HUB is not selected, it's an error - if (ps->HubName == NULL) - { - c->Write(c, _UU("CMD_Hub_Not_Selected")); - return ERR_INVALID_PARAMETER; - } - - o = ParseCommandList(c, cmd_name, str, args, sizeof(args) / sizeof(args[0])); - if (o == NULL) - { - return ERR_INVALID_PARAMETER; - } - - Zero(&t, sizeof(t)); - StrCpy(t.HubName, sizeof(t.HubName), ps->HubName); - t.ClientOption = ZeroMalloc(sizeof(CLIENT_OPTION)); - UniStrCpy(t.ClientOption->AccountName, sizeof(t.ClientOption->AccountName), GetParamUniStr(o, "[name]")); - - // RPC call - ret = ScGetLink(ps->Rpc, &t); - - if (ret != ERR_NO_ERROR) - { - // An error has occured - CmdPrintError(c, ret); - FreeParamValueList(o); - return ret; - } - else - { - // Change the settings for the cascade connection - StrCpy(t.ClientAuth->Username, sizeof(t.ClientAuth->Username), - GetParamStr(o, "USERNAME")); - - if (t.ClientAuth->AuthType == CLIENT_AUTHTYPE_PASSWORD) - { - c->Write(c, _UU("CMD_CascadeUsername_Notice")); - } - - ret = ScSetLink(ps->Rpc, &t); - if (ret != ERR_NO_ERROR) - { - // An error has occured - CmdPrintError(c, ret); - FreeParamValueList(o); - return ret; - } - - FreeRpcCreateLink(&t); - } - - FreeParamValueList(o); - - return 0; -} - -//Set the type of user authentication of cascade connection to the anonymous authentication -UINT PsCascadeAnonymousSet(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) -{ - LIST *o; - PS *ps = (PS *)param; - UINT ret = 0; - RPC_CREATE_LINK t; - // Parameter list that can be specified - PARAM args[] = - { - {"[name]", CmdPrompt, _UU("CMD_CascadeCreate_Prompt_Name"), CmdEvalNotEmpty, NULL}, - }; - - // If virtual HUB is not selected, it's an error - if (ps->HubName == NULL) - { - c->Write(c, _UU("CMD_Hub_Not_Selected")); - return ERR_INVALID_PARAMETER; - } - - o = ParseCommandList(c, cmd_name, str, args, sizeof(args) / sizeof(args[0])); - if (o == NULL) - { - return ERR_INVALID_PARAMETER; - } - - Zero(&t, sizeof(t)); - StrCpy(t.HubName, sizeof(t.HubName), ps->HubName); - t.ClientOption = ZeroMalloc(sizeof(CLIENT_OPTION)); - UniStrCpy(t.ClientOption->AccountName, sizeof(t.ClientOption->AccountName), GetParamUniStr(o, "[name]")); - - // RPC call - ret = ScGetLink(ps->Rpc, &t); - - if (ret != ERR_NO_ERROR) - { - // An error has occured - CmdPrintError(c, ret); - FreeParamValueList(o); - return ret; - } - else - { - // Change the settings for the cascade connection - t.ClientAuth->AuthType = CLIENT_AUTHTYPE_ANONYMOUS; - - ret = ScSetLink(ps->Rpc, &t); - if (ret != ERR_NO_ERROR) - { - // An error has occured - CmdPrintError(c, ret); - FreeParamValueList(o); - return ret; - } - - FreeRpcCreateLink(&t); - } - - FreeParamValueList(o); - - return 0; -} - -// Set the type of user authentication of cascade connection to the password authentication -UINT PsCascadePasswordSet(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) -{ - LIST *o; - PS *ps = (PS *)param; - UINT ret = 0; - RPC_CREATE_LINK t; - // Parameter list that can be specified - PARAM args[] = - { - {"[name]", CmdPrompt, _UU("CMD_CascadeCreate_Prompt_Name"), CmdEvalNotEmpty, NULL}, - {"PASSWORD", CmdPromptChoosePassword, NULL, NULL, NULL}, - {"TYPE", CmdPrompt, _UU("CMD_CascadePasswordSet_Prompt_Type"), CmdEvalNotEmpty, NULL}, - }; - - // If virtual HUB is not selected, it's an error - if (ps->HubName == NULL) - { - c->Write(c, _UU("CMD_Hub_Not_Selected")); - return ERR_INVALID_PARAMETER; - } - - o = ParseCommandList(c, cmd_name, str, args, sizeof(args) / sizeof(args[0])); - if (o == NULL) - { - return ERR_INVALID_PARAMETER; - } - - Zero(&t, sizeof(t)); - StrCpy(t.HubName, sizeof(t.HubName), ps->HubName); - t.ClientOption = ZeroMalloc(sizeof(CLIENT_OPTION)); - UniStrCpy(t.ClientOption->AccountName, sizeof(t.ClientOption->AccountName), GetParamUniStr(o, "[name]")); - - // RPC call - ret = ScGetLink(ps->Rpc, &t); - - if (ret != ERR_NO_ERROR) - { - // An error has occured - CmdPrintError(c, ret); - FreeParamValueList(o); - return ret; - } - else - { - // Change the settings for the cascade connection - char *typestr = GetParamStr(o, "TYPE"); - - if (StartWith("standard", typestr)) - { - t.ClientAuth->AuthType = CLIENT_AUTHTYPE_PASSWORD; - HashPassword(t.ClientAuth->HashedPassword, t.ClientAuth->Username, - GetParamStr(o, "PASSWORD")); - } - else if (StartWith("radius", typestr) || StartWith("ntdomain", typestr)) - { - t.ClientAuth->AuthType = CLIENT_AUTHTYPE_PLAIN_PASSWORD; - - StrCpy(t.ClientAuth->PlainPassword, sizeof(t.ClientAuth->PlainPassword), - GetParamStr(o, "PASSWORD")); - } - else - { - // An error has occured - c->Write(c, _UU("CMD_CascadePasswordSet_Type_Invalid")); - FreeRpcCreateLink(&t); - ret = ERR_INVALID_PARAMETER; - CmdPrintError(c, ret); - FreeParamValueList(o); - return ERR_INTERNAL_ERROR; - } - - ret = ScSetLink(ps->Rpc, &t); - if (ret != ERR_NO_ERROR) - { - // An error has occured - CmdPrintError(c, ret); - FreeParamValueList(o); - return ret; - } - - FreeRpcCreateLink(&t); - } - - FreeParamValueList(o); - - return 0; -} - -// Set the type of user authentication of cascade connection to the client certificate authentication -UINT PsCascadeCertSet(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) -{ - LIST *o; - PS *ps = (PS *)param; - UINT ret = 0; - RPC_CREATE_LINK t; - X *x; - K *k; - // Parameter list that can be specified - PARAM args[] = - { - // "name", prompt_proc, prompt_param, eval_proc, eval_param - {"[name]", CmdPrompt, _UU("CMD_CascadeCreate_Prompt_Name"), CmdEvalNotEmpty, NULL}, - {"LOADCERT", CmdPrompt, _UU("CMD_LOADCERTPATH"), CmdEvalIsFile, NULL}, - {"LOADKEY", CmdPrompt, _UU("CMD_LOADKEYPATH"), CmdEvalIsFile, NULL}, - }; - - // If virtual HUB is not selected, it's an error - if (ps->HubName == NULL) - { - c->Write(c, _UU("CMD_Hub_Not_Selected")); - return ERR_INVALID_PARAMETER; - } - - o = ParseCommandList(c, cmd_name, str, args, sizeof(args) / sizeof(args[0])); - if (o == NULL) - { - return ERR_INVALID_PARAMETER; - } - - if (CmdLoadCertAndKey(c, &x, &k, GetParamUniStr(o, "LOADCERT"), GetParamUniStr(o, "LOADKEY")) == false) - { - return ERR_INTERNAL_ERROR; - } - - Zero(&t, sizeof(t)); - StrCpy(t.HubName, sizeof(t.HubName), ps->HubName); - t.ClientOption = ZeroMalloc(sizeof(CLIENT_OPTION)); - UniStrCpy(t.ClientOption->AccountName, sizeof(t.ClientOption->AccountName), GetParamUniStr(o, "[name]")); - - // RPC call - ret = ScGetLink(ps->Rpc, &t); - - if (ret != ERR_NO_ERROR) - { - // An error has occured - FreeX(x); - FreeK(k); - CmdPrintError(c, ret); - FreeParamValueList(o); - return ret; - } - else - { - // Change authentication data - t.ClientAuth->AuthType = CLIENT_AUTHTYPE_CERT; - if (t.ClientAuth->ClientX != NULL) - { - FreeX(t.ClientAuth->ClientX); - } - if (t.ClientAuth->ClientK != NULL) - { - FreeK(t.ClientAuth->ClientK); - } - - t.ClientAuth->ClientX = x; - t.ClientAuth->ClientK = k; - - ret = ScSetLink(ps->Rpc, &t); - if (ret != ERR_NO_ERROR) - { - // An error has occured - CmdPrintError(c, ret); - FreeParamValueList(o); - return ret; - } - - FreeRpcCreateLink(&t); - } - - FreeParamValueList(o); - - return 0; -} - -// Get the client certificate to be used in the cascade connection -UINT PsCascadeCertGet(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) -{ - LIST *o; - PS *ps = (PS *)param; - UINT ret = 0; - RPC_CREATE_LINK t; - // Parameter list that can be specified - PARAM args[] = - { - // "name", prompt_proc, prompt_param, eval_proc, eval_param - {"[name]", CmdPrompt, _UU("CMD_CascadeCreate_Prompt_Name"), CmdEvalNotEmpty, NULL}, - {"SAVECERT", CmdPrompt, _UU("CMD_SAVECERTPATH"), CmdEvalNotEmpty, NULL}, - }; - - // If virtual HUB is not selected, it's an error - if (ps->HubName == NULL) - { - c->Write(c, _UU("CMD_Hub_Not_Selected")); - return ERR_INVALID_PARAMETER; - } - - o = ParseCommandList(c, cmd_name, str, args, sizeof(args) / sizeof(args[0])); - if (o == NULL) - { - return ERR_INVALID_PARAMETER; - } - - Zero(&t, sizeof(t)); - StrCpy(t.HubName, sizeof(t.HubName), ps->HubName); - t.ClientOption = ZeroMalloc(sizeof(CLIENT_OPTION)); - UniStrCpy(t.ClientOption->AccountName, sizeof(t.ClientOption->AccountName), GetParamUniStr(o, "[name]")); - - // RPC call - ret = ScGetLink(ps->Rpc, &t); - - if (ret != ERR_NO_ERROR) - { - // An error has occured - CmdPrintError(c, ret); - FreeParamValueList(o); - return ret; - } - else - { - if (t.ClientAuth->AuthType != CLIENT_AUTHTYPE_CERT) - { - c->Write(c, _UU("CMD_CascadeCertSet_Not_Auth_Cert")); - ret = ERR_INTERNAL_ERROR; - } - else if (t.ClientAuth->ClientX == NULL) - { - c->Write(c, _UU("CMD_CascadeCertSet_Cert_Not_Exists")); - ret = ERR_INTERNAL_ERROR; - } - else - { - XToFileW(t.ClientAuth->ClientX, GetParamUniStr(o, "SAVECERT"), true); - } - FreeRpcCreateLink(&t); - } - - FreeParamValueList(o); - - return ret; -} - -// Enable encryption of communication at the time of the cascade connection -UINT PsCascadeEncryptEnable(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) -{ - LIST *o; - PS *ps = (PS *)param; - UINT ret = 0; - RPC_CREATE_LINK t; - // Parameter list that can be specified - PARAM args[] = - { - // "name", prompt_proc, prompt_param, eval_proc, eval_param - {"[name]", CmdPrompt, _UU("CMD_CascadeCreate_Prompt_Name"), CmdEvalNotEmpty, NULL}, - }; - - // If virtual HUB is not selected, it's an error - if (ps->HubName == NULL) - { - c->Write(c, _UU("CMD_Hub_Not_Selected")); - return ERR_INVALID_PARAMETER; - } - - o = ParseCommandList(c, cmd_name, str, args, sizeof(args) / sizeof(args[0])); - if (o == NULL) - { - return ERR_INVALID_PARAMETER; - } - - Zero(&t, sizeof(t)); - StrCpy(t.HubName, sizeof(t.HubName), ps->HubName); - t.ClientOption = ZeroMalloc(sizeof(CLIENT_OPTION)); - UniStrCpy(t.ClientOption->AccountName, sizeof(t.ClientOption->AccountName), GetParamUniStr(o, "[name]")); - - // RPC call - ret = ScGetLink(ps->Rpc, &t); - - if (ret != ERR_NO_ERROR) - { - // An error has occured - CmdPrintError(c, ret); - FreeParamValueList(o); - return ret; - } - else - { - // Data change - t.ClientOption->UseEncrypt = true; - - ret = ScSetLink(ps->Rpc, &t); - if (ret != ERR_NO_ERROR) - { - // An error has occured - CmdPrintError(c, ret); - FreeParamValueList(o); - return ret; - } - - FreeRpcCreateLink(&t); - } - - FreeParamValueList(o); - - return 0; -} - -// Disable encryption of communication at the time of the cascade connection -UINT PsCascadeEncryptDisable(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) -{ - LIST *o; - PS *ps = (PS *)param; - UINT ret = 0; - RPC_CREATE_LINK t; - // Parameter list that can be specified - PARAM args[] = - { - // "name", prompt_proc, prompt_param, eval_proc, eval_param - {"[name]", CmdPrompt, _UU("CMD_CascadeCreate_Prompt_Name"), CmdEvalNotEmpty, NULL}, - }; - - // If virtual HUB is not selected, it's an error - if (ps->HubName == NULL) - { - c->Write(c, _UU("CMD_Hub_Not_Selected")); - return ERR_INVALID_PARAMETER; - } - - o = ParseCommandList(c, cmd_name, str, args, sizeof(args) / sizeof(args[0])); - if (o == NULL) - { - return ERR_INVALID_PARAMETER; - } - - Zero(&t, sizeof(t)); - StrCpy(t.HubName, sizeof(t.HubName), ps->HubName); - t.ClientOption = ZeroMalloc(sizeof(CLIENT_OPTION)); - UniStrCpy(t.ClientOption->AccountName, sizeof(t.ClientOption->AccountName), GetParamUniStr(o, "[name]")); - - // RPC call - ret = ScGetLink(ps->Rpc, &t); - - if (ret != ERR_NO_ERROR) - { - // An error has occured - CmdPrintError(c, ret); - FreeParamValueList(o); - return ret; - } - else - { - // Data change - t.ClientOption->UseEncrypt = false; - - ret = ScSetLink(ps->Rpc, &t); - if (ret != ERR_NO_ERROR) - { - // An error has occured - CmdPrintError(c, ret); - FreeParamValueList(o); - return ret; - } - - FreeRpcCreateLink(&t); - } - - FreeParamValueList(o); - - return 0; -} - -// Enable data compression at the time of communication of the cascade connection -UINT PsCascadeCompressEnable(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) -{ - LIST *o; - PS *ps = (PS *)param; - UINT ret = 0; - RPC_CREATE_LINK t; - // Parameter list that can be specified - PARAM args[] = - { - // "name", prompt_proc, prompt_param, eval_proc, eval_param - {"[name]", CmdPrompt, _UU("CMD_CascadeCreate_Prompt_Name"), CmdEvalNotEmpty, NULL}, - }; - - // If virtual HUB is not selected, it's an error - if (ps->HubName == NULL) - { - c->Write(c, _UU("CMD_Hub_Not_Selected")); - return ERR_INVALID_PARAMETER; - } - - o = ParseCommandList(c, cmd_name, str, args, sizeof(args) / sizeof(args[0])); - if (o == NULL) - { - return ERR_INVALID_PARAMETER; - } - - Zero(&t, sizeof(t)); - StrCpy(t.HubName, sizeof(t.HubName), ps->HubName); - t.ClientOption = ZeroMalloc(sizeof(CLIENT_OPTION)); - UniStrCpy(t.ClientOption->AccountName, sizeof(t.ClientOption->AccountName), GetParamUniStr(o, "[name]")); - - // RPC call - ret = ScGetLink(ps->Rpc, &t); - - if (ret != ERR_NO_ERROR) - { - // An error has occured - CmdPrintError(c, ret); - FreeParamValueList(o); - return ret; - } - else - { - // Data change - t.ClientOption->UseCompress = true; - - ret = ScSetLink(ps->Rpc, &t); - if (ret != ERR_NO_ERROR) - { - // An error has occured - CmdPrintError(c, ret); - FreeParamValueList(o); - return ret; - } - - FreeRpcCreateLink(&t); - } - - FreeParamValueList(o); - - return 0; -} - -// Disable data compression at the time of communication of the cascade connection -UINT PsCascadeCompressDisable(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) -{ - LIST *o; - PS *ps = (PS *)param; - UINT ret = 0; - RPC_CREATE_LINK t; - // Parameter list that can be specified - PARAM args[] = - { - // "name", prompt_proc, prompt_param, eval_proc, eval_param - {"[name]", CmdPrompt, _UU("CMD_CascadeCreate_Prompt_Name"), CmdEvalNotEmpty, NULL}, - }; - - // If virtual HUB is not selected, it's an error - if (ps->HubName == NULL) - { - c->Write(c, _UU("CMD_Hub_Not_Selected")); - return ERR_INVALID_PARAMETER; - } - - o = ParseCommandList(c, cmd_name, str, args, sizeof(args) / sizeof(args[0])); - if (o == NULL) - { - return ERR_INVALID_PARAMETER; - } - - Zero(&t, sizeof(t)); - StrCpy(t.HubName, sizeof(t.HubName), ps->HubName); - t.ClientOption = ZeroMalloc(sizeof(CLIENT_OPTION)); - UniStrCpy(t.ClientOption->AccountName, sizeof(t.ClientOption->AccountName), GetParamUniStr(o, "[name]")); - - // RPC call - ret = ScGetLink(ps->Rpc, &t); - - if (ret != ERR_NO_ERROR) - { - // An error has occured - CmdPrintError(c, ret); - FreeParamValueList(o); - return ret; - } - else - { - // Data change - t.ClientOption->UseCompress = false; - - ret = ScSetLink(ps->Rpc, &t); - if (ret != ERR_NO_ERROR) - { - // An error has occured - CmdPrintError(c, ret); - FreeParamValueList(o); - return ret; - } - - FreeRpcCreateLink(&t); - } - - FreeParamValueList(o); - - return 0; -} - -UINT PsCascadeHttpHeaderAdd(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) -{ - LIST *o; - PS *ps = (PS *)param; - UINT ret = ERR_NO_ERROR; - RPC_CREATE_LINK t; - - // Parameter list that can be specified - PARAM args[] = - { - // "name", prompt_proc, prompt_param, eval_proc, eval_param - {"[name]", CmdPrompt, _UU("CMD_CascadeCreate_Prompt_Name"), CmdEvalNotEmpty, NULL}, - {"NAME", CmdPrompt, _UU("CMD_CascadeHttpHeader_Prompt_Name"), CmdEvalNotEmpty, NULL}, - {"DATA", CmdPrompt, _UU("CMD_CascadeHttpHeader_Prompt_Data"), NULL, NULL}, - }; - - // If virtual HUB is not selected, it's an error - if (ps->HubName == NULL) - { - c->Write(c, _UU("CMD_Hub_Not_Selected")); - return ERR_INVALID_PARAMETER; - } - - // Get the parameter list - o = ParseCommandList(c, cmd_name, str, args, sizeof(args) / sizeof(args[0])); - if (o == NULL) - { - return ERR_INVALID_PARAMETER; - } - - // RPC call - Zero(&t, sizeof(t)); - StrCpy(t.HubName, sizeof(t.HubName), ps->HubName); - t.ClientOption = ZeroMalloc(sizeof(CLIENT_OPTION)); - UniStrCpy(t.ClientOption->AccountName, sizeof(t.ClientOption->AccountName), GetParamUniStr(o, "[name]")); - ret = ScGetLink(ps->Rpc, &t); - - if (ret == ERR_NO_ERROR) - { - UINT i = 0; - TOKEN_LIST *tokens = NULL; - HTTP_HEADER *header = NULL; - char *name = GetParamStr(o, "NAME"); - - Trim(name); - - header = NewHttpHeader("", "", ""); - - tokens = ParseToken(t.ClientOption->CustomHttpHeader, "\r\n"); - for (i = 0; i < tokens->NumTokens; i++) - { - AddHttpValueStr(header, tokens->Token[i]); - } - FreeToken(tokens); - - if (GetHttpValue(header, name) == NULL) - { - char s[HTTP_CUSTOM_HEADER_MAX_SIZE]; - Format(s, sizeof(s), "%s: %s\r\n", name, GetParamStr(o, "DATA")); - EnSafeHttpHeaderValueStr(s, ' '); - - if ((StrLen(s) + StrLen(t.ClientOption->CustomHttpHeader)) < sizeof(t.ClientOption->CustomHttpHeader)) { - StrCat(t.ClientOption->CustomHttpHeader, sizeof(s), s); - ret = ScSetLink(ps->Rpc, &t); - } - else - { - // Error has occurred - ret = ERR_TOO_MANT_ITEMS; - } - } - else - { - // Error has occurred - ret = ERR_OBJECT_EXISTS; - } - - FreeHttpHeader(header); - } - - if (ret != ERR_NO_ERROR) - { - // Error has occurred - CmdPrintError(c, ret); - } - - FreeRpcCreateLink(&t); - - // Release of the parameter list - FreeParamValueList(o); - - return ret; -} - -UINT PsCascadeHttpHeaderDelete(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) -{ - LIST *o; - PS *ps = (PS *)param; - UINT ret = ERR_NO_ERROR; - RPC_CREATE_LINK t; - - // Parameter list that can be specified - PARAM args[] = - { - // "name", prompt_proc, prompt_param, eval_proc, eval_param - {"[name]", CmdPrompt, _UU("CMD_CascadeCreate_Prompt_Name"), CmdEvalNotEmpty, NULL}, - {"NAME", CmdPrompt, _UU("CMD_CascadeHttpHeader_Prompt_Name"), CmdEvalNotEmpty, NULL}, - }; - - // If virtual HUB is not selected, it's an error - if (ps->HubName == NULL) - { - c->Write(c, _UU("CMD_Hub_Not_Selected")); - return ERR_INVALID_PARAMETER; - } - - // Get the parameter list - o = ParseCommandList(c, cmd_name, str, args, sizeof(args) / sizeof(args[0])); - if (o == NULL) - { - return ERR_INVALID_PARAMETER; - } - - // RPC call - Zero(&t, sizeof(t)); - StrCpy(t.HubName, sizeof(t.HubName), ps->HubName); - t.ClientOption = ZeroMalloc(sizeof(CLIENT_OPTION)); - UniStrCpy(t.ClientOption->AccountName, sizeof(t.ClientOption->AccountName), GetParamUniStr(o, "[name]")); - ret = ScGetLink(ps->Rpc, &t); - - if (ret == ERR_NO_ERROR) - { - UINT i = 0; - TOKEN_LIST *tokens = NULL; - char *value = GetParamStr(o, "NAME"); - - Zero(t.ClientOption->CustomHttpHeader, sizeof(t.ClientOption->CustomHttpHeader)); - - tokens = ParseToken(t.ClientOption->CustomHttpHeader, "\r\n"); - - for (i = 0; i < tokens->NumTokens; i++) - { - if (StartWith(tokens->Token[i], value) == false) - { - StrCat(t.ClientOption->CustomHttpHeader, sizeof(t.ClientOption->CustomHttpHeader), tokens->Token[i]); - StrCat(t.ClientOption->CustomHttpHeader, 1, "\r\n"); - } - } - - ret = ScSetLink(ps->Rpc, &t); - } - else - { - // Error has occurred - CmdPrintError(c, ret); - } - - FreeRpcCreateLink(&t); - - // Release of the parameter list - FreeParamValueList(o); - - return ret; -} - -UINT PsCascadeHttpHeaderGet(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) -{ - LIST *o; - PS *ps = (PS *)param; - UINT ret = ERR_NO_ERROR; - RPC_CREATE_LINK t; - - // Parameter list that can be specified - PARAM args[] = - { - // "name", prompt_proc, prompt_param, eval_proc, eval_param - {"[name]", CmdPrompt, _UU("CMD_CascadeCreate_Prompt_Name"), CmdEvalNotEmpty, NULL}, - }; - - // If virtual HUB is not selected, it's an error - if (ps->HubName == NULL) - { - c->Write(c, _UU("CMD_Hub_Not_Selected")); - return ERR_INVALID_PARAMETER; - } - - // Get the parameter list - o = ParseCommandList(c, cmd_name, str, args, sizeof(args) / sizeof(args[0])); - if (o == NULL) - { - return ERR_INVALID_PARAMETER; - } - - // RPC call - Zero(&t, sizeof(t)); - StrCpy(t.HubName, sizeof(t.HubName), ps->HubName); - t.ClientOption = ZeroMalloc(sizeof(CLIENT_OPTION)); - UniStrCpy(t.ClientOption->AccountName, sizeof(t.ClientOption->AccountName), GetParamUniStr(o, "[name]")); - ret = ScGetLink(ps->Rpc, &t); - - // Release of the parameter list - FreeParamValueList(o); - - if (ret == ERR_NO_ERROR) - { - wchar_t unistr[HTTP_CUSTOM_HEADER_MAX_SIZE]; - TOKEN_LIST *tokens = NULL; - UINT i = 0; - CT *ct = CtNew(); - CtInsertColumn(ct, _UU("CMD_CT_STD_COLUMN_1"), false); - - tokens = ParseToken(t.ClientOption->CustomHttpHeader, "\r\n"); - - for (i = 0; i < tokens->NumTokens; i++) - { - StrToUni(unistr, sizeof(unistr), tokens->Token[i]); - CtInsert(ct, unistr); - } - - CtFreeEx(ct, c, false); - } - else - { - // Error has occurred - CmdPrintError(c, ret); - } - - FreeRpcCreateLink(&t); - - return ret; -} - -// Set the cascade connection method to the TCP/IP direct connection mode -UINT PsCascadeProxyNone(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) -{ - LIST *o; - PS *ps = (PS *)param; - UINT ret = 0; - RPC_CREATE_LINK t; - // Parameter list that can be specified - PARAM args[] = - { - // "name", prompt_proc, prompt_param, eval_proc, eval_param - {"[name]", CmdPrompt, _UU("CMD_CascadeCreate_Prompt_Name"), CmdEvalNotEmpty, NULL}, - }; - - // If virtual HUB is not selected, it's an error - if (ps->HubName == NULL) - { - c->Write(c, _UU("CMD_Hub_Not_Selected")); - return ERR_INVALID_PARAMETER; - } - - o = ParseCommandList(c, cmd_name, str, args, sizeof(args) / sizeof(args[0])); - if (o == NULL) - { - return ERR_INVALID_PARAMETER; - } - - Zero(&t, sizeof(t)); - StrCpy(t.HubName, sizeof(t.HubName), ps->HubName); - t.ClientOption = ZeroMalloc(sizeof(CLIENT_OPTION)); - UniStrCpy(t.ClientOption->AccountName, sizeof(t.ClientOption->AccountName), GetParamUniStr(o, "[name]")); - - // RPC call - ret = ScGetLink(ps->Rpc, &t); - - if (ret != ERR_NO_ERROR) - { - // An error has occured - CmdPrintError(c, ret); - FreeParamValueList(o); - return ret; - } - else - { - // Data change - t.ClientOption->ProxyType = PROXY_DIRECT; - - ret = ScSetLink(ps->Rpc, &t); - if (ret != ERR_NO_ERROR) - { - // An error has occured - CmdPrintError(c, ret); - FreeParamValueList(o); - return ret; - } - - FreeRpcCreateLink(&t); - } - - FreeParamValueList(o); - - return 0; -} - -// Set the cascade connection method as the mode via HTTP proxy server -UINT PsCascadeProxyHttp(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) -{ - LIST *o; - PS *ps = (PS *)param; - UINT ret = 0; - RPC_CREATE_LINK t; - // Parameter list that can be specified - PARAM args[] = - { - // "name", prompt_proc, prompt_param, eval_proc, eval_param - {"[name]", CmdPrompt, _UU("CMD_CascadeCreate_Prompt_Name"), CmdEvalNotEmpty, NULL}, - {"SERVER", CmdPrompt, _UU("CMD_CascadeProxyHttp_Prompt_Server"), CmdEvalHostAndPort, NULL}, - {"USERNAME", NULL, NULL, NULL, NULL}, - {"PASSWORD", NULL, NULL, NULL, NULL}, - }; - - // If virtual HUB is not selected, it's an error - if (ps->HubName == NULL) - { - c->Write(c, _UU("CMD_Hub_Not_Selected")); - return ERR_INVALID_PARAMETER; - } - - o = ParseCommandList(c, cmd_name, str, args, sizeof(args) / sizeof(args[0])); - if (o == NULL) - { - return ERR_INVALID_PARAMETER; - } - - Zero(&t, sizeof(t)); - StrCpy(t.HubName, sizeof(t.HubName), ps->HubName); - t.ClientOption = ZeroMalloc(sizeof(CLIENT_OPTION)); - UniStrCpy(t.ClientOption->AccountName, sizeof(t.ClientOption->AccountName), GetParamUniStr(o, "[name]")); - - // RPC call - ret = ScGetLink(ps->Rpc, &t); - - if (ret != ERR_NO_ERROR) - { - // An error has occured - CmdPrintError(c, ret); - FreeParamValueList(o); - return ret; - } - else - { - char *host; - UINT port; - - // Data change - if (ParseHostPort(GetParamStr(o, "SERVER"), &host, &port, 8080)) - { - t.ClientOption->ProxyType = PROXY_HTTP; - StrCpy(t.ClientOption->ProxyName, sizeof(t.ClientOption->ProxyName), host); - t.ClientOption->ProxyPort = port; - StrCpy(t.ClientOption->ProxyUsername, sizeof(t.ClientOption->ProxyName), GetParamStr(o, "USERNAME")); - StrCpy(t.ClientOption->ProxyPassword, sizeof(t.ClientOption->ProxyName), GetParamStr(o, "PASSWORD")); - Free(host); - } - - ret = ScSetLink(ps->Rpc, &t); - if (ret != ERR_NO_ERROR) - { - // An error has occured - CmdPrintError(c, ret); - FreeParamValueList(o); - return ret; - } - - FreeRpcCreateLink(&t); - } - - FreeParamValueList(o); - - return 0; -} - -// Set the cascade connection method as the mode via SOCKS4 proxy server -UINT PsCascadeProxySocks(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) -{ - LIST *o; - PS *ps = (PS *)param; - UINT ret = 0; - RPC_CREATE_LINK t; - // Parameter list that can be specified - PARAM args[] = - { - // "name", prompt_proc, prompt_param, eval_proc, eval_param - {"[name]", CmdPrompt, _UU("CMD_CascadeCreate_Prompt_Name"), CmdEvalNotEmpty, NULL}, - {"SERVER", CmdPrompt, _UU("CMD_CascadeProxyHttp_Prompt_Server"), CmdEvalHostAndPort, NULL}, - {"USERNAME", NULL, NULL, NULL, NULL}, - {"PASSWORD", NULL, NULL, NULL, NULL}, - }; - - // If virtual HUB is not selected, it's an error - if (ps->HubName == NULL) - { - c->Write(c, _UU("CMD_Hub_Not_Selected")); - return ERR_INVALID_PARAMETER; - } - - o = ParseCommandList(c, cmd_name, str, args, sizeof(args) / sizeof(args[0])); - if (o == NULL) - { - return ERR_INVALID_PARAMETER; - } - - Zero(&t, sizeof(t)); - StrCpy(t.HubName, sizeof(t.HubName), ps->HubName); - t.ClientOption = ZeroMalloc(sizeof(CLIENT_OPTION)); - UniStrCpy(t.ClientOption->AccountName, sizeof(t.ClientOption->AccountName), GetParamUniStr(o, "[name]")); - - // RPC call - ret = ScGetLink(ps->Rpc, &t); - - if (ret != ERR_NO_ERROR) - { - // An error has occured - CmdPrintError(c, ret); - FreeParamValueList(o); - return ret; - } - else - { - char *host; - UINT port; - - // Data change - if (ParseHostPort(GetParamStr(o, "SERVER"), &host, &port, 1080)) - { - t.ClientOption->ProxyType = PROXY_SOCKS; - StrCpy(t.ClientOption->ProxyName, sizeof(t.ClientOption->ProxyName), host); - t.ClientOption->ProxyPort = port; - StrCpy(t.ClientOption->ProxyUsername, sizeof(t.ClientOption->ProxyName), GetParamStr(o, "USERNAME")); - StrCpy(t.ClientOption->ProxyPassword, sizeof(t.ClientOption->ProxyName), GetParamStr(o, "PASSWORD")); - Free(host); - } - - ret = ScSetLink(ps->Rpc, &t); - if (ret != ERR_NO_ERROR) - { - // An error has occured - CmdPrintError(c, ret); - FreeParamValueList(o); - return ret; - } - - FreeRpcCreateLink(&t); - } - - FreeParamValueList(o); - - return 0; -} - -// Set the cascade connection method as the mode via SOCKS5 proxy server -UINT PsCascadeProxySocks5(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) -{ - LIST *o; - PS *ps = (PS *)param; - UINT ret = 0; - RPC_CREATE_LINK t; - // Parameter list that can be specified - PARAM args[] = - { - // "name", prompt_proc, prompt_param, eval_proc, eval_param - {"[name]", CmdPrompt, _UU("CMD_CascadeCreate_Prompt_Name"), CmdEvalNotEmpty, NULL}, - {"SERVER", CmdPrompt, _UU("CMD_CascadeProxyHttp_Prompt_Server"), CmdEvalHostAndPort, NULL}, - {"USERNAME", NULL, NULL, NULL, NULL}, - {"PASSWORD", NULL, NULL, NULL, NULL}, - }; - - // If virtual HUB is not selected, it's an error - if (ps->HubName == NULL) - { - c->Write(c, _UU("CMD_Hub_Not_Selected")); - return ERR_INVALID_PARAMETER; - } - - o = ParseCommandList(c, cmd_name, str, args, sizeof(args) / sizeof(args[0])); - if (o == NULL) - { - return ERR_INVALID_PARAMETER; - } - - Zero(&t, sizeof(t)); - StrCpy(t.HubName, sizeof(t.HubName), ps->HubName); - t.ClientOption = ZeroMalloc(sizeof(CLIENT_OPTION)); - UniStrCpy(t.ClientOption->AccountName, sizeof(t.ClientOption->AccountName), GetParamUniStr(o, "[name]")); - - // RPC call - ret = ScGetLink(ps->Rpc, &t); - - if (ret != ERR_NO_ERROR) - { - // An error has occured - CmdPrintError(c, ret); - FreeParamValueList(o); - return ret; - } - else - { - char *host; - UINT port; - - // Data change - if (ParseHostPort(GetParamStr(o, "SERVER"), &host, &port, 1080)) - { - t.ClientOption->ProxyType = PROXY_SOCKS5; - StrCpy(t.ClientOption->ProxyName, sizeof(t.ClientOption->ProxyName), host); - t.ClientOption->ProxyPort = port; - StrCpy(t.ClientOption->ProxyUsername, sizeof(t.ClientOption->ProxyName), GetParamStr(o, "USERNAME")); - StrCpy(t.ClientOption->ProxyPassword, sizeof(t.ClientOption->ProxyName), GetParamStr(o, "PASSWORD")); - Free(host); - } - - ret = ScSetLink(ps->Rpc, &t); - if (ret != ERR_NO_ERROR) - { - // An error has occured - CmdPrintError(c, ret); - FreeParamValueList(o); - return ret; - } - - FreeRpcCreateLink(&t); - } - - FreeParamValueList(o); - - return 0; -} - -// Enable the validation options for the server certificate of cascade connection -UINT PsCascadeServerCertEnable(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) -{ - LIST *o; - PS *ps = (PS *)param; - UINT ret = 0; - RPC_CREATE_LINK t; - // Parameter list that can be specified - PARAM args[] = - { - // "name", prompt_proc, prompt_param, eval_proc, eval_param - {"[name]", CmdPrompt, _UU("CMD_CascadeCreate_Prompt_Name"), CmdEvalNotEmpty, NULL}, - }; - - // If virtual HUB is not selected, it's an error - if (ps->HubName == NULL) - { - c->Write(c, _UU("CMD_Hub_Not_Selected")); - return ERR_INVALID_PARAMETER; - } - - o = ParseCommandList(c, cmd_name, str, args, sizeof(args) / sizeof(args[0])); - if (o == NULL) - { - return ERR_INVALID_PARAMETER; - } - - Zero(&t, sizeof(t)); - StrCpy(t.HubName, sizeof(t.HubName), ps->HubName); - t.ClientOption = ZeroMalloc(sizeof(CLIENT_OPTION)); - UniStrCpy(t.ClientOption->AccountName, sizeof(t.ClientOption->AccountName), GetParamUniStr(o, "[name]")); - - // RPC call - ret = ScGetLink(ps->Rpc, &t); - - if (ret != ERR_NO_ERROR) - { - // An error has occured - CmdPrintError(c, ret); - FreeParamValueList(o); - return ret; - } - else - { - // Data change - t.CheckServerCert = true; - - ret = ScSetLink(ps->Rpc, &t); - if (ret != ERR_NO_ERROR) - { - // An error has occured - CmdPrintError(c, ret); - FreeParamValueList(o); - return ret; - } - - FreeRpcCreateLink(&t); - } - - FreeParamValueList(o); - - return 0; -} - -// Disable the validation options for the server certificate of cascade connection -UINT PsCascadeServerCertDisable(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) -{ - LIST *o; - PS *ps = (PS *)param; - UINT ret = 0; - RPC_CREATE_LINK t; - // Parameter list that can be specified - PARAM args[] = - { - // "name", prompt_proc, prompt_param, eval_proc, eval_param - {"[name]", CmdPrompt, _UU("CMD_CascadeCreate_Prompt_Name"), CmdEvalNotEmpty, NULL}, - }; - - // If virtual HUB is not selected, it's an error - if (ps->HubName == NULL) - { - c->Write(c, _UU("CMD_Hub_Not_Selected")); - return ERR_INVALID_PARAMETER; - } - - o = ParseCommandList(c, cmd_name, str, args, sizeof(args) / sizeof(args[0])); - if (o == NULL) - { - return ERR_INVALID_PARAMETER; - } - - Zero(&t, sizeof(t)); - StrCpy(t.HubName, sizeof(t.HubName), ps->HubName); - t.ClientOption = ZeroMalloc(sizeof(CLIENT_OPTION)); - UniStrCpy(t.ClientOption->AccountName, sizeof(t.ClientOption->AccountName), GetParamUniStr(o, "[name]")); - - // RPC call - ret = ScGetLink(ps->Rpc, &t); - - if (ret != ERR_NO_ERROR) - { - // An error has occured - CmdPrintError(c, ret); - FreeParamValueList(o); - return ret; - } - else - { - // Data change - t.CheckServerCert = false; - - ret = ScSetLink(ps->Rpc, &t); - if (ret != ERR_NO_ERROR) - { - // An error has occured - CmdPrintError(c, ret); - FreeParamValueList(o); - return ret; - } - - FreeRpcCreateLink(&t); - } - - FreeParamValueList(o); - - return 0; -} - -// Server-specific certificate settings of cascade connection -UINT PsCascadeServerCertSet(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) -{ - LIST *o; - PS *ps = (PS *)param; - UINT ret = 0; - RPC_CREATE_LINK t; - X *x; - // Parameter list that can be specified - PARAM args[] = - { - // "name", prompt_proc, prompt_param, eval_proc, eval_param - {"[name]", CmdPrompt, _UU("CMD_CascadeCreate_Prompt_Name"), CmdEvalNotEmpty, NULL}, - {"LOADCERT", CmdPrompt, _UU("CMD_LOADCERTPATH"), CmdEvalIsFile, NULL}, - }; - - // If virtual HUB is not selected, it's an error - if (ps->HubName == NULL) - { - c->Write(c, _UU("CMD_Hub_Not_Selected")); - return ERR_INVALID_PARAMETER; - } - - o = ParseCommandList(c, cmd_name, str, args, sizeof(args) / sizeof(args[0])); - if (o == NULL) - { - return ERR_INVALID_PARAMETER; - } - - x = FileToXW(GetParamUniStr(o, "LOADCERT")); - if (x == NULL) - { - FreeParamValueList(o); - c->Write(c, _UU("CMD_LOADCERT_FAILED")); - return ERR_INTERNAL_ERROR; - } - - Zero(&t, sizeof(t)); - StrCpy(t.HubName, sizeof(t.HubName), ps->HubName); - t.ClientOption = ZeroMalloc(sizeof(CLIENT_OPTION)); - UniStrCpy(t.ClientOption->AccountName, sizeof(t.ClientOption->AccountName), GetParamUniStr(o, "[name]")); - - // RPC call - ret = ScGetLink(ps->Rpc, &t); - - if (ret != ERR_NO_ERROR) - { - // An error has occured - CmdPrintError(c, ret); - FreeParamValueList(o); - FreeX(x); - return ret; - } - else - { - // Data change - if (t.ServerCert != NULL) - { - FreeX(t.ServerCert); - } - t.ServerCert = x; - - ret = ScSetLink(ps->Rpc, &t); - if (ret != ERR_NO_ERROR) - { - // An error has occured - CmdPrintError(c, ret); - FreeParamValueList(o); - return ret; - } - - FreeRpcCreateLink(&t); - } - - FreeParamValueList(o); - - return 0; -} - -// Delete the server-specific certificate of cascade connection -UINT PsCascadeServerCertDelete(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) -{ - LIST *o; - PS *ps = (PS *)param; - UINT ret = 0; - RPC_CREATE_LINK t; - // Parameter list that can be specified - PARAM args[] = - { - // "name", prompt_proc, prompt_param, eval_proc, eval_param - {"[name]", CmdPrompt, _UU("CMD_CascadeCreate_Prompt_Name"), CmdEvalNotEmpty, NULL}, - }; - - // If virtual HUB is not selected, it's an error - if (ps->HubName == NULL) - { - c->Write(c, _UU("CMD_Hub_Not_Selected")); - return ERR_INVALID_PARAMETER; - } - - o = ParseCommandList(c, cmd_name, str, args, sizeof(args) / sizeof(args[0])); - if (o == NULL) - { - return ERR_INVALID_PARAMETER; - } - - Zero(&t, sizeof(t)); - StrCpy(t.HubName, sizeof(t.HubName), ps->HubName); - t.ClientOption = ZeroMalloc(sizeof(CLIENT_OPTION)); - UniStrCpy(t.ClientOption->AccountName, sizeof(t.ClientOption->AccountName), GetParamUniStr(o, "[name]")); - - // RPC call - ret = ScGetLink(ps->Rpc, &t); - - if (ret != ERR_NO_ERROR) - { - // An error has occured - CmdPrintError(c, ret); - FreeParamValueList(o); - return ret; - } - else - { - // Data change - if (t.ServerCert != NULL) - { - FreeX(t.ServerCert); - } - t.ServerCert = NULL; - - ret = ScSetLink(ps->Rpc, &t); - if (ret != ERR_NO_ERROR) - { - // An error has occured - CmdPrintError(c, ret); - FreeParamValueList(o); - return ret; - } - - FreeRpcCreateLink(&t); - } - - FreeParamValueList(o); - - return 0; -} - -// Get the server-specific certificate of cascade connection -UINT PsCascadeServerCertGet(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) -{ - LIST *o; - PS *ps = (PS *)param; - UINT ret = 0; - RPC_CREATE_LINK t; - // Parameter list that can be specified - PARAM args[] = - { - // "name", prompt_proc, prompt_param, eval_proc, eval_param - {"[name]", CmdPrompt, _UU("CMD_CascadeCreate_Prompt_Name"), CmdEvalNotEmpty, NULL}, - {"SAVECERT", CmdPrompt, _UU("CMD_SAVECERTPATH"), CmdEvalNotEmpty, NULL}, - }; - - // If virtual HUB is not selected, it's an error - if (ps->HubName == NULL) - { - c->Write(c, _UU("CMD_Hub_Not_Selected")); - return ERR_INVALID_PARAMETER; - } - - o = ParseCommandList(c, cmd_name, str, args, sizeof(args) / sizeof(args[0])); - if (o == NULL) - { - return ERR_INVALID_PARAMETER; - } - - Zero(&t, sizeof(t)); - StrCpy(t.HubName, sizeof(t.HubName), ps->HubName); - t.ClientOption = ZeroMalloc(sizeof(CLIENT_OPTION)); - UniStrCpy(t.ClientOption->AccountName, sizeof(t.ClientOption->AccountName), GetParamUniStr(o, "[name]")); - - // RPC call - ret = ScGetLink(ps->Rpc, &t); - - if (ret != ERR_NO_ERROR) - { - // An error has occured - CmdPrintError(c, ret); - FreeParamValueList(o); - return ret; - } - else - { - // Save the certificate - if (t.ServerCert == NULL) - { - c->Write(c, _UU("CMD_CERT_NOT_EXISTS")); - ret = ERR_INTERNAL_ERROR; - } - else - { - if (XToFileW(t.ServerCert, GetParamUniStr(o, "SAVECERT"), true) == false) - { - c->Write(c, _UU("CMD_SAVECERT_FAILED")); - ret = ERR_INTERNAL_ERROR; - } - } - - FreeRpcCreateLink(&t); - } - - FreeParamValueList(o); - - return ret; -} - -// Set the advanced settings of the cascade connection -UINT PsCascadeDetailSet(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) -{ - LIST *o; - PS *ps = (PS *)param; - UINT ret = 0; - RPC_CREATE_LINK t; - CMD_EVAL_MIN_MAX mm_maxtcp = - { - "CMD_CascadeDetailSet_Eval_MaxTcp", 1, 32 - }; - CMD_EVAL_MIN_MAX mm_interval = - { - "CMD_CascadeDetailSet_Eval_Interval", 1, 4294967295UL - }; - // Parameter list that can be specified - PARAM args[] = - { - // "name", prompt_proc, prompt_param, eval_proc, eval_param - {"[name]", CmdPrompt, _UU("CMD_CascadeCreate_Prompt_Name"), CmdEvalNotEmpty, NULL}, - {"MAXTCP", CmdPrompt, _UU("CMD_CascadeDetailSet_Prompt_MaxTcp"), CmdEvalMinMax, &mm_maxtcp}, - {"INTERVAL", CmdPrompt, _UU("CMD_CascadeDetailSet_Prompt_Interval"), CmdEvalMinMax, &mm_interval}, - {"TTL", CmdPrompt, _UU("CMD_CascadeDetailSet_Prompt_TTL"), NULL, NULL}, - {"HALF", CmdPrompt, _UU("CMD_CascadeDetailSet_Prompt_HALF"), NULL, NULL}, - {"NOQOS", CmdPrompt, _UU("CMD_AccountDetailSet_Prompt_NOQOS"), NULL, NULL}, - }; - - // If virtual HUB is not selected, it's an error - if (ps->HubName == NULL) - { - c->Write(c, _UU("CMD_Hub_Not_Selected")); - return ERR_INVALID_PARAMETER; - } - - o = ParseCommandList(c, cmd_name, str, args, sizeof(args) / sizeof(args[0])); - if (o == NULL) - { - return ERR_INVALID_PARAMETER; - } - - Zero(&t, sizeof(t)); - StrCpy(t.HubName, sizeof(t.HubName), ps->HubName); - t.ClientOption = ZeroMalloc(sizeof(CLIENT_OPTION)); - UniStrCpy(t.ClientOption->AccountName, sizeof(t.ClientOption->AccountName), GetParamUniStr(o, "[name]")); - - // RPC call - ret = ScGetLink(ps->Rpc, &t); - - if (ret != ERR_NO_ERROR) - { - // An error has occured - CmdPrintError(c, ret); - FreeParamValueList(o); - return ret; - } - else - { - // Data change - t.ClientOption->MaxConnection = GetParamInt(o, "MAXTCP"); - t.ClientOption->AdditionalConnectionInterval = GetParamInt(o, "INTERVAL"); - t.ClientOption->ConnectionDisconnectSpan = GetParamInt(o, "TTL"); - t.ClientOption->HalfConnection = GetParamYes(o, "HALF"); - t.ClientOption->DisableQoS = GetParamYes(o, "NOQOS"); - - ret = ScSetLink(ps->Rpc, &t); - if (ret != ERR_NO_ERROR) - { - // An error has occured - CmdPrintError(c, ret); - FreeParamValueList(o); - return ret; - } - - FreeRpcCreateLink(&t); - } - - FreeParamValueList(o); - - return 0; -} - -// Show a security policy -void PrintPolicy(CONSOLE *c, POLICY *pol, bool cascade_mode) -{ - UINT i; - CT *ct; - PACK *p; - // Validate arguments - if (c == NULL || pol == NULL) - { - return; - } - - ct = CtNew(); - CtInsertColumn(ct, _UU("CMD_PolicyList_Column_1"), false); - CtInsertColumn(ct, _UU("CMD_PolicyList_Column_2"), false); - CtInsertColumn(ct, _UU("CMD_PolicyList_Column_3"), false); - - p = NewPack(); - OutRpcPolicy(p, pol); - - // Show the list of all policies - for (i = 0; i < PolicyNum();i++) - { - char name[64]; - wchar_t *tmp; - - if (cascade_mode == false || PolicyIsSupportedForCascade(i)) - { - wchar_t value_str[256]; - UINT value; - char tmp2[256]; - - Format(tmp2, sizeof(tmp2), "policy:%s", PolicyIdToStr(i)); - value = PackGetInt(p, tmp2); - - tmp = CopyStrToUni(PolicyIdToStr(i)); - - FormatPolicyValue(value_str, sizeof(value_str), - i, value); - - Format(name, sizeof(name), "POL_%u", i); - CtInsert(ct, tmp, _UU(name), value_str); - - Free(tmp); - } - } - - FreePack(p); - - CtFree(ct, c); -} - -// Show the security policy list -void PrintPolicyList(CONSOLE *c, char *name) -{ - UINT id; - // Validate arguments - if (c == NULL) - { - return; - } - if (IsEmptyStr(name)) - { - name = NULL; - } - - if (name != NULL) - { - id = PolicyStrToId(name); - if (id == INFINITE) - { - // Invalid ID - c->Write(c, _UU("CMD_PolicyList_Invalid_Name")); - } - else - { - wchar_t tmp[MAX_SIZE]; - wchar_t tmp2[MAX_SIZE]; - char name1[64], name2[64]; - wchar_t *title, *descript; - wchar_t policy_name[MAX_SIZE]; - - Format(name1, sizeof(name1), "POL_%u", id); - Format(name2, sizeof(name2), "POL_EX_%u", id); - - title = _UU(name1); - descript = _UU(name2); - - StrToUni(policy_name, sizeof(policy_name), PolicyIdToStr(id)); - - // Policy name - c->Write(c, _UU("CMD_PolicyList_Help_1")); - UniFormat(tmp2, sizeof(tmp2), L" %s", policy_name); - c->Write(c, tmp2); - c->Write(c, L""); - - // Simple description of the policy - c->Write(c, _UU("CMD_PolicyList_Help_2")); - UniFormat(tmp2, sizeof(tmp2), L" %s", title); - c->Write(c, tmp2); - c->Write(c, L""); - - // Range of the value that can be set - GetPolicyValueRangeStr(tmp, sizeof(tmp), id); - c->Write(c, _UU("CMD_PolicyList_Help_3")); - UniFormat(tmp2, sizeof(tmp2), L" %s", tmp); - c->Write(c, tmp2); - c->Write(c, L""); - - // Default value - FormatPolicyValue(tmp, sizeof(tmp), id, GetPolicyItem(id)->DefaultValue); - c->Write(c, _UU("CMD_PolicyList_Help_4")); - UniFormat(tmp2, sizeof(tmp2), L" %s", tmp); - c->Write(c, tmp2); - c->Write(c, L""); - - // Detailed description of the policy - c->Write(c, _UU("CMD_PolicyList_Help_5")); - c->Write(c, descript); - c->Write(c, L""); - } - } - else - { - UINT i; - CT *ct = CtNew(); - CtInsertColumn(ct, _UU("CMD_PolicyList_Column_1"), false); - CtInsertColumn(ct, _UU("CMD_PolicyList_Column_2"), false); - - // Show the list of all policies - for (i = 0; i < PolicyNum();i++) - { - char name[64]; - wchar_t *tmp; - - tmp = CopyStrToUni(PolicyIdToStr(i)); - - Format(name, sizeof(name), "POL_%u", i); - CtInsert(ct, tmp, _UU(name)); - - Free(tmp); - } - - CtFree(ct, c); - } -} - -// Editing the contents of the policy -bool EditPolicy(CONSOLE *c, POLICY *pol, char *name, char *value, bool cascade_mode) -{ - PACK *p; - ELEMENT *e; - POLICY_ITEM *item; - UINT id; - wchar_t tmp[MAX_SIZE]; - wchar_t tmp2[MAX_SIZE]; - char pack_name[128]; - // Validate arguments - if (c == NULL || pol == NULL || name == NULL || value == NULL) - { - return false; - } - - p = NewPack(); - - OutRpcPolicy(p, pol); - - Format(pack_name, sizeof(pack_name), "policy:%s", PolicyIdToStr(PolicyStrToId(name))); - - if ((e = GetElement(p, pack_name, VALUE_INT)) == NULL || (id = PolicyStrToId(name)) == INFINITE) - { - UniFormat(tmp, sizeof(tmp), _UU("CMD_CascadePolicySet_Invalid_Name"), name); - c->Write(c, tmp); - FreePack(p); - return false; - } - - if (cascade_mode && (PolicyIsSupportedForCascade(id) == false)) - { - UniFormat(tmp, sizeof(tmp), _UU("CMD_CascadePolicySet_Invalid_Name_For_Cascade"), name); - c->Write(c, tmp); - FreePack(p); - return false; - } - - item = GetPolicyItem(id); - - if (item->TypeInt == false) - { - // bool type - e->values[0]->IntValue = ( - StartWith(value, "y") || StartWith(value, "t") || - ToInt(value) != 0) ? 1 : 0; - } - else - { - UINT n = ToInt(value); - bool b = true; - - // int type - GetPolicyValueRangeStr(tmp, sizeof(tmp), id); - - if (item->AllowZero == false) - { - if (n == 0) - { - b = false; - } - } - - if (n != 0 && (n < item->MinValue || n > item->MaxValue)) - { - b = false; - } - - if (b == false) - { - UniFormat(tmp2, sizeof(tmp2), _UU("CMD_CascadePolicySet_Invalid_Range"), PolicyIdToStr(id), tmp); - c->Write(c, tmp2); - FreePack(p); - return false; - } - - e->values[0]->IntValue = n; - } - - Zero(pol, sizeof(POLICY)); - - InRpcPolicy(pol, p); - - FreePack(p); - - return true; -} - -// Show the list of the type of security policy and possible values -UINT PsPolicyList(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) -{ - LIST *o; - PARAM args[] = - { - // "name", prompt_proc, prompt_param, eval_proc, eval_param - {"[name]", NULL, NULL, NULL, NULL} - }; - - o = ParseCommandList(c, cmd_name, str, args, sizeof(args) / sizeof(args[0])); - if (o == NULL) - { - return ERR_INVALID_PARAMETER; - } - - PrintPolicyList(c, GetParamStr(o, "[name]")); - - FreeParamValueList(o); - - return ERR_NO_ERROR; -} - -// Set the security policy of the cascade session -UINT PsCascadePolicySet(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) -{ - LIST *o; - PS *ps = (PS *)param; - UINT ret = 0; - RPC_CREATE_LINK t; - // Parameter list that can be specified - PARAM args[] = - { - // "name", prompt_proc, prompt_param, eval_proc, eval_param - {"[name]", CmdPrompt, _UU("CMD_CascadeCreate_Prompt_Name"), CmdEvalNotEmpty, NULL}, - {"NAME", CmdPrompt, _UU("CMD_CascadePolicySet_PROMPT_POLNAME"), CmdEvalNotEmpty, NULL}, - {"VALUE", CmdPrompt, _UU("CMD_CascadePolicySet_PROMPT_POLVALUE"), CmdEvalNotEmpty, NULL}, - }; - - // If virtual HUB is not selected, it's an error - if (ps->HubName == NULL) - { - c->Write(c, _UU("CMD_Hub_Not_Selected")); - return ERR_INVALID_PARAMETER; - } - - o = ParseCommandList(c, cmd_name, str, args, sizeof(args) / sizeof(args[0])); - if (o == NULL) - { - return ERR_INVALID_PARAMETER; - } - - Zero(&t, sizeof(t)); - StrCpy(t.HubName, sizeof(t.HubName), ps->HubName); - t.ClientOption = ZeroMalloc(sizeof(CLIENT_OPTION)); - UniStrCpy(t.ClientOption->AccountName, sizeof(t.ClientOption->AccountName), GetParamUniStr(o, "[name]")); - - // RPC call - ret = ScGetLink(ps->Rpc, &t); - - if (ret != ERR_NO_ERROR) - { - // An error has occured - CmdPrintError(c, ret); - FreeParamValueList(o); - return ret; - } - else - { - if (EditPolicy(c, &t.Policy, GetParamStr(o, "NAME"), GetParamStr(o, "VALUE"), true) == false) - { - // An error has occured - FreeRpcCreateLink(&t); - FreeParamValueList(o); - return ERR_INTERNAL_ERROR; - } - - ret = ScSetLink(ps->Rpc, &t); - if (ret != ERR_NO_ERROR) - { - // An error has occured - CmdPrintError(c, ret); - FreeParamValueList(o); - return ret; - } - - FreeRpcCreateLink(&t); - } - - FreeParamValueList(o); - - return 0; -} - -// Display the status information of the session -void CmdPrintStatusToListView(CT *ct, RPC_CLIENT_GET_CONNECTION_STATUS *s) -{ - CmdPrintStatusToListViewEx(ct, s, false); -} -void CmdPrintStatusToListViewEx(CT *ct, RPC_CLIENT_GET_CONNECTION_STATUS *s, bool server_mode) -{ - wchar_t tmp[MAX_SIZE]; - char str[MAX_SIZE]; - char vv[128]; - // Validate arguments - if (s == NULL) - { - return; - } - - if (server_mode == false) - { - CtInsert(ct, _UU("CM_ST_ACCOUNT_NAME"), s->AccountName); - - if (s->Connected == false) - { - wchar_t *st = _UU("CM_ST_CONNECTED_FALSE"); - switch (s->SessionStatus) - { - case CLIENT_STATUS_CONNECTING: - st = _UU("CM_ST_CONNECTING"); - break; - case CLIENT_STATUS_NEGOTIATION: - st = _UU("CM_ST_NEGOTIATION"); - break; - case CLIENT_STATUS_AUTH: - st = _UU("CM_ST_AUTH"); - break; - case CLIENT_STATUS_ESTABLISHED: - st = _UU("CM_ST_ESTABLISHED"); - break; - case CLIENT_STATUS_RETRY: - st = _UU("CM_ST_RETRY"); - break; - case CLIENT_STATUS_IDLE: - st = _UU("CM_ST_IDLE"); - break; - } - CtInsert(ct, _UU("CM_ST_CONNECTED"), st); - } - else - { - CtInsert(ct, _UU("CM_ST_CONNECTED"), _UU("CM_ST_CONNECTED_TRUE")); - } - } - - if (s->Connected) - { - if (s->VLanId == 0) - { - UniStrCpy(tmp, sizeof(tmp), _UU("CM_ST_NO_VLAN")); - } - else - { - UniToStru(tmp, s->VLanId); - } - - CtInsert(ct, _UU("CM_ST_VLAN_ID"), tmp); - - if (server_mode == false) - { - StrToUni(tmp, sizeof(tmp), s->ServerName); - CtInsert(ct, _UU("CM_ST_SERVER_NAME"), tmp); - - UniFormat(tmp, sizeof(tmp), _UU("CM_ST_PORT_TCP"), s->ServerPort); - CtInsert(ct, _UU("CM_ST_SERVER_PORT"), tmp); - } - - StrToUni(tmp, sizeof(tmp), s->ServerProductName); - CtInsert(ct, _UU("CM_ST_SERVER_P_NAME"), tmp); - - UniFormat(tmp, sizeof(tmp), L"%u.%02u", s->ServerProductVer / 100, s->ServerProductVer % 100); - CtInsert(ct, _UU("CM_ST_SERVER_P_VER"), tmp); - UniFormat(tmp, sizeof(tmp), L"Build %u", s->ServerProductBuild); - CtInsert(ct, _UU("CM_ST_SERVER_P_BUILD"), tmp); - } - - GetDateTimeStrEx64(tmp, sizeof(tmp), SystemToLocal64(s->StartTime), NULL); - CtInsert(ct, _UU("CM_ST_START_TIME"), tmp); - /* !!! Do not correct the spelling to keep the backward protocol compatibility !!! */ - GetDateTimeStrEx64(tmp, sizeof(tmp), SystemToLocal64(s->FirstConnectionEstablisiedTime), NULL); - /* !!! Do not correct the spelling to keep the backward protocol compatibility !!! */ - CtInsert(ct, _UU("CM_ST_FIRST_ESTAB_TIME"), s->FirstConnectionEstablisiedTime == 0 ? _UU("CM_ST_NONE") : tmp); - - if (s->Connected) - { - GetDateTimeStrEx64(tmp, sizeof(tmp), SystemToLocal64(s->CurrentConnectionEstablishTime), NULL); - CtInsert(ct, _UU("CM_ST_CURR_ESTAB_TIME"), tmp); - } - - if (server_mode == false) - { - UniFormat(tmp, sizeof(tmp), _UU("CM_ST_NUM_STR"), s->NumConnectionsEstablished); - CtInsert(ct, _UU("CM_ST_NUM_ESTABLISHED"), tmp); - } - - if (s->Connected) - { - CtInsert(ct, _UU("CM_ST_HALF_CONNECTION"), s->HalfConnection ? _UU("CM_ST_HALF_TRUE") : _UU("CM_ST_HALF_FALSE")); - - CtInsert(ct, _UU("CM_ST_QOS"), s->QoS ? _UU("CM_ST_QOS_TRUE") : _UU("CM_ST_QOS_FALSE")); - - UniFormat(tmp, sizeof(tmp), L"%u", s->NumTcpConnections); - CtInsert(ct, _UU("CM_ST_NUM_TCP"), tmp); - - if (s->HalfConnection) - { - UniFormat(tmp, sizeof(tmp), L"%u", s->NumTcpConnectionsUpload); - CtInsert(ct, _UU("CM_ST_NUM_TCP_UPLOAD"), tmp); - UniFormat(tmp, sizeof(tmp), L"%u", s->NumTcpConnectionsDownload); - CtInsert(ct, _UU("CM_ST_NUM_TCP_DOWNLOAD"), tmp); - } - - UniFormat(tmp, sizeof(tmp), L"%u", s->MaxTcpConnections); - CtInsert(ct, _UU("CM_ST_MAX_TCP"), tmp); - - if (s->UseEncrypt == false) - { - UniStrCpy(tmp, sizeof(tmp), _UU("CM_ST_USE_ENCRYPT_FALSE")); - } - else - { - if (StrLen(s->CipherName) != 0) - { - UniFormat(tmp, sizeof(tmp), _UU("CM_ST_USE_ENCRYPT_TRUE"), s->CipherName); - } - else - { - UniFormat(tmp, sizeof(tmp), _UU("CM_ST_USE_ENCRYPT_TRUE2")); - } - } - CtInsert(ct, _UU("CM_ST_USE_ENCRYPT"), tmp); - - if (s->UseCompress) - { - UINT percent = 0; - if ((s->TotalRecvSize + s->TotalSendSize) > 0) - { - percent = (UINT)((UINT64)100 - (UINT64)(s->TotalRecvSizeReal + s->TotalSendSizeReal) * (UINT64)100 / - (s->TotalRecvSize + s->TotalSendSize)); - percent = MAKESURE(percent, 0, 100); - } - - UniFormat(tmp, sizeof(tmp), _UU("CM_ST_COMPRESS_TRUE"), percent); - } - else - { - UniStrCpy(tmp, sizeof(tmp), _UU("CM_ST_COMPRESS_FALSE")); - } - CtInsert(ct, _UU("CM_ST_USE_COMPRESS"), tmp); - - if (IsEmptyStr(s->UnderlayProtocol) == false) - { - StrToUni(tmp, sizeof(tmp), s->UnderlayProtocol); - CtInsert(ct, _UU("CM_ST_UNDERLAY_PROTOCOL"), tmp); - } - - if (IsEmptyStr(s->ProtocolDetails) == false) - { - StrToUni(tmp, sizeof(tmp), s->ProtocolDetails); - CtInsert(ct, _UU("CM_ST_PROTOCOL_DETAILS"), tmp); - } - - CtInsert(ct, _UU("CM_ST_UDP_ACCEL_ENABLED"), (s->IsUdpAccelerationEnabled ? _UU("CM_ST_YES") : _UU("CM_ST_NO"))); - CtInsert(ct, _UU("CM_ST_UDP_ACCEL_USING"), (s->IsUsingUdpAcceleration ? _UU("CM_ST_YES") : _UU("CM_ST_NO"))); - - StrToUni(tmp, sizeof(tmp), s->SessionName); - CtInsert(ct, _UU("CM_ST_SESSION_NAME"), tmp); - - StrToUni(tmp, sizeof(tmp), s->ConnectionName); - if (UniStrCmpi(tmp, L"INITING") != 0) - { - CtInsert(ct, _UU("CM_ST_CONNECTION_NAME"), tmp); - } - - BinToStr(str, sizeof(str), s->SessionKey, sizeof(s->SessionKey)); - StrToUni(tmp, sizeof(tmp), str); - CtInsert(ct, _UU("CM_ST_SESSION_KEY"), tmp); - - CtInsert(ct, _UU("CM_ST_BRIDGE_MODE"), s->IsBridgeMode ? _UU("CM_ST_YES") : _UU("CM_ST_NO")); - - CtInsert(ct, _UU("CM_ST_MONITOR_MODE"), s->IsMonitorMode ? _UU("CM_ST_YES") : _UU("CM_ST_NO")); - - ToStr3(vv, sizeof(vv), s->TotalSendSize); - UniFormat(tmp, sizeof(tmp), _UU("CM_ST_SIZE_BYTE_STR"), vv); - CtInsert(ct, _UU("CM_ST_SEND_SIZE"), tmp); - - ToStr3(vv, sizeof(vv), s->TotalRecvSize); - UniFormat(tmp, sizeof(tmp), _UU("CM_ST_SIZE_BYTE_STR"), vv); - CtInsert(ct, _UU("CM_ST_RECV_SIZE"), tmp); - - ToStr3(vv, sizeof(vv), s->Traffic.Send.UnicastCount); - UniFormat(tmp, sizeof(tmp), _UU("CM_ST_NUM_PACKET_STR"), vv); - CtInsert(ct, _UU("CM_ST_SEND_UCAST_NUM"), tmp); - - ToStr3(vv, sizeof(vv), s->Traffic.Send.UnicastBytes); - UniFormat(tmp, sizeof(tmp), _UU("CM_ST_SIZE_BYTE_STR"), vv); - CtInsert(ct, _UU("CM_ST_SEND_UCAST_SIZE"), tmp); - - ToStr3(vv, sizeof(vv), s->Traffic.Send.BroadcastCount); - UniFormat(tmp, sizeof(tmp), _UU("CM_ST_NUM_PACKET_STR"), vv); - CtInsert(ct, _UU("CM_ST_SEND_BCAST_NUM"), tmp); - - ToStr3(vv, sizeof(vv), s->Traffic.Send.BroadcastBytes); - UniFormat(tmp, sizeof(tmp), _UU("CM_ST_SIZE_BYTE_STR"), vv); - CtInsert(ct, _UU("CM_ST_SEND_BCAST_SIZE"), tmp); - - ToStr3(vv, sizeof(vv), s->Traffic.Recv.UnicastCount); - UniFormat(tmp, sizeof(tmp), _UU("CM_ST_NUM_PACKET_STR"), vv); - CtInsert(ct, _UU("CM_ST_RECV_UCAST_NUM"), tmp); - - ToStr3(vv, sizeof(vv), s->Traffic.Recv.UnicastBytes); - UniFormat(tmp, sizeof(tmp), _UU("CM_ST_SIZE_BYTE_STR"), vv); - CtInsert(ct, _UU("CM_ST_RECV_UCAST_SIZE"), tmp); - - ToStr3(vv, sizeof(vv), s->Traffic.Recv.BroadcastCount); - UniFormat(tmp, sizeof(tmp), _UU("CM_ST_NUM_PACKET_STR"), vv); - CtInsert(ct, _UU("CM_ST_RECV_BCAST_NUM"), tmp); - - ToStr3(vv, sizeof(vv), s->Traffic.Recv.BroadcastBytes); - UniFormat(tmp, sizeof(tmp), _UU("CM_ST_SIZE_BYTE_STR"), vv); - CtInsert(ct, _UU("CM_ST_RECV_BCAST_SIZE"), tmp); - } -} - -// Get the current state of the cascade connection -UINT PsCascadeStatusGet(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) -{ - LIST *o; - PS *ps = (PS *)param; - UINT ret = 0; - RPC_LINK_STATUS t; - // Parameter list that can be specified - PARAM args[] = - { - // "name", prompt_proc, prompt_param, eval_proc, eval_param - {"[name]", CmdPrompt, _UU("CMD_CascadeCreate_Prompt_Name"), CmdEvalNotEmpty, NULL}, - }; - - // If virtual HUB is not selected, it's an error - if (ps->HubName == NULL) - { - c->Write(c, _UU("CMD_Hub_Not_Selected")); - return ERR_INVALID_PARAMETER; - } - - o = ParseCommandList(c, cmd_name, str, args, sizeof(args) / sizeof(args[0])); - if (o == NULL) - { - return ERR_INVALID_PARAMETER; - } - - Zero(&t, sizeof(t)); - StrCpy(t.HubName, sizeof(t.HubName), ps->HubName); - UniStrCpy(t.AccountName, sizeof(t.AccountName), GetParamUniStr(o, "[name]")); - - // RPC call - ret = ScGetLinkStatus(ps->Rpc, &t); - - if (ret != ERR_NO_ERROR) - { - // An error has occured - CmdPrintError(c, ret); - FreeParamValueList(o); - return ret; - } - else - { - // Get the cascade connection state - CT *ct = CtNewStandard(); - - CmdPrintStatusToListView(ct, &t.Status); - - CtFree(ct, c); - - FreeRpcLinkStatus(&t); - } - - FreeParamValueList(o); - - return 0; -} - -// Rename the cascade connection -UINT PsCascadeRename(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) -{ - LIST *o; - PS *ps = (PS *)param; - UINT ret = 0; - RPC_RENAME_LINK t; - // Parameter list that can be specified - PARAM args[] = - { - // "name", prompt_proc, prompt_param, eval_proc, eval_param - {"[name]", CmdPrompt, _UU("CMD_CascadeRename_PROMPT_OLD"), CmdEvalNotEmpty, NULL}, - {"NEW", CmdPrompt, _UU("CMD_CascadeRename_PROMPT_NEW"), CmdEvalNotEmpty, NULL}, - }; - - // If virtual HUB is not selected, it's an error - if (ps->HubName == NULL) - { - c->Write(c, _UU("CMD_Hub_Not_Selected")); - return ERR_INVALID_PARAMETER; - } - - o = ParseCommandList(c, cmd_name, str, args, sizeof(args) / sizeof(args[0])); - if (o == NULL) - { - return ERR_INVALID_PARAMETER; - } - - Zero(&t, sizeof(t)); - StrCpy(t.HubName, sizeof(t.HubName), ps->HubName); - - UniStrCpy(t.NewAccountName, sizeof(t.NewAccountName), GetParamUniStr(o, "NEW")); - UniStrCpy(t.OldAccountName, sizeof(t.OldAccountName), GetParamUniStr(o, "[name]")); - - // RPC call - ret = ScRenameLink(ps->Rpc, &t); - - if (ret != ERR_NO_ERROR) - { - // An error has occured - CmdPrintError(c, ret); - FreeParamValueList(o); - return ret; - } - - FreeParamValueList(o); - - return 0; -} - -// Set the cascade connection to on-line state -UINT PsCascadeOnline(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) -{ - LIST *o; - PS *ps = (PS *)param; - UINT ret = 0; - RPC_LINK t; - // Parameter list that can be specified - PARAM args[] = - { - // "name", prompt_proc, prompt_param, eval_proc, eval_param - {"[name]", CmdPrompt, _UU("CMD_CascadeCreate_Prompt_Name"), CmdEvalNotEmpty, NULL}, - }; - - // If virtual HUB is not selected, it's an error - if (ps->HubName == NULL) - { - c->Write(c, _UU("CMD_Hub_Not_Selected")); - return ERR_INVALID_PARAMETER; - } - - o = ParseCommandList(c, cmd_name, str, args, sizeof(args) / sizeof(args[0])); - if (o == NULL) - { - return ERR_INVALID_PARAMETER; - } - - Zero(&t, sizeof(t)); - StrCpy(t.HubName, sizeof(t.HubName), ps->HubName); - UniStrCpy(t.AccountName, sizeof(t.AccountName), GetParamUniStr(o, "[name]")); - - // RPC call - ret = ScSetLinkOnline(ps->Rpc, &t); - - if (ret != ERR_NO_ERROR) - { - // An error has occured - CmdPrintError(c, ret); - FreeParamValueList(o); - return ret; - } - - FreeParamValueList(o); - - return 0; -} - -// Set the cascade connection to the off-line state -UINT PsCascadeOffline(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) -{ - LIST *o; - PS *ps = (PS *)param; - UINT ret = 0; - RPC_LINK t; - // Parameter list that can be specified - PARAM args[] = - { - // "name", prompt_proc, prompt_param, eval_proc, eval_param - {"[name]", CmdPrompt, _UU("CMD_CascadeCreate_Prompt_Name"), CmdEvalNotEmpty, NULL}, - }; - - // If virtual HUB is not selected, it's an error - if (ps->HubName == NULL) - { - c->Write(c, _UU("CMD_Hub_Not_Selected")); - return ERR_INVALID_PARAMETER; - } - - o = ParseCommandList(c, cmd_name, str, args, sizeof(args) / sizeof(args[0])); - if (o == NULL) - { - return ERR_INVALID_PARAMETER; - } - - Zero(&t, sizeof(t)); - StrCpy(t.HubName, sizeof(t.HubName), ps->HubName); - UniStrCpy(t.AccountName, sizeof(t.AccountName), GetParamUniStr(o, "[name]")); - - // RPC call - ret = ScSetLinkOffline(ps->Rpc, &t); - - if (ret != ERR_NO_ERROR) - { - // An error has occured - CmdPrintError(c, ret); - FreeParamValueList(o); - return ret; - } - - FreeParamValueList(o); - - return 0; -} - -// Convert the string to pass / discard flag -bool StrToPassOrDiscard(char *str) -{ - // Validate arguments - if (str == NULL) - { - return false; - } - - if (ToInt(str) != 0) - { - return true; - } - - if (StartWith(str, "p") || StartWith(str, "y") || StartWith(str, "t")) - { - return true; - } - - return false; -} - -// Convert the string to the protocol -UINT StrToProtocol(char *str) -{ - if (IsEmptyStr(str)) - { - return 0; - } - - if (StartWith("ip", str)) - { - return 0; - } - else if (StartWith("tcp", str)) - { - return IP_PROTO_TCP; - } - else if (StartWith("udp", str)) - { - return IP_PROTO_UDP; - } - else if (StartWith("icmpv4", str)) - { - return IP_PROTO_ICMPV4; - } - else if (StartWith("icmpv6", str)) - { - return IP_PROTO_ICMPV6; - } - - if (ToInt(str) == 0) - { - if (StrCmpi(str, "0") == 0) - { - return 0; - } - else - { - return INFINITE; - } - } - - if (ToInt(str) >= 256) - { - return INFINITE; - } - - return ToInt(str); -} - -// Check the protocol name -bool CmdEvalProtocol(CONSOLE *c, wchar_t *str, void *param) -{ - char tmp[64]; - // Validate arguments - if (c == NULL || str == NULL) - { - return false; - } - - UniToStr(tmp, sizeof(tmp), str); - - if (StrToProtocol(tmp) == INFINITE) - { - c->Write(c, _UU("CMD_PROTOCOL_EVAL_FAILED")); - return false; - } - - return true; -} - -// Parse the port range -bool ParsePortRange(char *str, UINT *start, UINT *end) -{ - UINT a = 0, b = 0; - TOKEN_LIST *t; - // Validate arguments - if (str == NULL) - { - return false; - } - - if (IsEmptyStr(str) == false) - { - - t = ParseToken(str, "\t -"); - - if (t->NumTokens == 1) - { - a = b = ToInt(t->Token[0]); - } - else if (t->NumTokens == 2) - { - a = ToInt(t->Token[0]); - b = ToInt(t->Token[1]); - } - - FreeToken(t); - - if (a > b) - { - return false; - } - - if (a >= 65536 || b >= 65536) - { - return false; - } - - if (a == 0 && b != 0) - { - return false; - } - } - - if (start != NULL) - { - *start = a; - } - if (end != NULL) - { - *end = b; - } - - return true; -} - -// Check the port range -bool CmdEvalPortRange(CONSOLE *c, wchar_t *str, void *param) -{ - char tmp[64]; - // Validate arguments - if (c == NULL || str == NULL) - { - return false; - } - - UniToStr(tmp, sizeof(tmp), str); - - if (ParsePortRange(tmp, NULL, NULL) == false) - { - c->Write(c, _UU("CMD_PORT_RANGE_EVAL_FAILED")); - return false; - } - - return true; -} - -// Parse the MAC address and the mask -bool ParseMacAddressAndMask(char *src, bool *check_mac, UCHAR *mac_bin, UCHAR *mask_bin) -{ - TOKEN_LIST *t; - char *macstr, *maskstr; - UCHAR mac[6], mask[6]; - bool ok = false; - - // Validate arguments - if (src == NULL) - { - return false; - } - - //Zero(mac, sizeof(mac)); - //Zero(mask, sizeof(mask)); - - if(check_mac != NULL && mac_bin != NULL && mask_bin != NULL) - { - ok = true; - } - if(IsEmptyStr(src) != false) - { - if(ok != false) - { - *check_mac = false; - Zero(mac_bin, 6); - Zero(mask_bin, 6); - } - return true; - } - - t = ParseToken(src, "/"); - if(t->NumTokens != 2) - { - FreeToken(t); - return false; - } - - macstr = t->Token[0]; - maskstr = t->Token[1]; - - Trim(macstr); - Trim(maskstr); - - if(StrToMac(mac, macstr) == false || StrToMac(mask, maskstr) == false) - { - FreeToken(t); - return false; - } - else - { - if(ok != false) - { - Copy(mac_bin, mac, 6); - Copy(mask_bin, mask, 6); - *check_mac = true; - } - } - FreeToken(t); - - return true; -} - -// Check the MAC address and mask -bool CmdEvalMacAddressAndMask(CONSOLE *c, wchar_t *str, void *param) -{ - char tmp[64]; - // Validate arguments - if(c == NULL || str == NULL) - { - return false; - } - - UniToStr(tmp, sizeof(tmp), str); - - - if(ParseMacAddressAndMask(tmp, NULL, NULL, NULL) == false) - { - c->Write(c, _UU("CMD_MAC_ADDRESS_AND_MASK_EVAL_FAILED")); - return false; - } - - return true; -} -// Parse the status of TCP connection -bool ParseTcpState(char *src, bool *check_tcp_state, bool *established) -{ - bool ok = false; - // Validate arguments - if(src == NULL) - { - return false; - } - - if(check_tcp_state != NULL && established != NULL) - { - ok = true; - } - - if (IsEmptyStr(src) == false) - { - if (StartWith("Established", src) == 0) - { - if(ok != false) - { - *check_tcp_state = true; - *established = true; - } - } - else if (StartWith("Unestablished", src) == 0) - { - if(ok != false) - { - *check_tcp_state = true; - *established = false; - } - } - else - { - // Illegal string - return false; - } - } - else - { - if(ok != false) - { - *check_tcp_state = false; - *established = false; - } - } - - return true; -} -// Check the status of the TCP connection -bool CmdEvalTcpState(CONSOLE *c, wchar_t *str, void *param) -{ - char tmp[64]; - // Validate arguments - if(c == NULL || str == NULL) - { - return false; - } - - UniToStr(tmp, sizeof(tmp), str); - - if(ParseTcpState(tmp, NULL, NULL) == false) - { - c->Write(c, _UU("CMD_TCP_CONNECTION_STATE_EVAL_FAILED")); - return false; - } - - return true; -} - -// Adding a rule to the access list (Standard, IPv4) -UINT PsAccessAdd(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) -{ - LIST *o; - PS *ps = (PS *)param; - UINT ret = 0; - RPC_ADD_ACCESS t; - ACCESS *a; - // Parameter list that can be specified - CMD_EVAL_MIN_MAX minmax = - { - "CMD_AccessAdd_Eval_PRIORITY", 1, 4294967295UL, - }; - PARAM args[] = - { - // "name", prompt_proc, prompt_param, eval_proc, eval_param - {"[pass|discard]", CmdPrompt, _UU("CMD_AccessAdd_Prompt_TYPE"), CmdEvalNotEmpty, NULL}, - {"MEMO", CmdPrompt, _UU("CMD_AccessAdd_Prompt_MEMO"), NULL, NULL}, - {"PRIORITY", CmdPrompt, _UU("CMD_AccessAdd_Prompt_PRIORITY"), CmdEvalMinMax, &minmax}, - {"SRCUSERNAME", CmdPrompt, _UU("CMD_AccessAdd_Prompt_SRCUSERNAME"), NULL, NULL}, - {"DESTUSERNAME", CmdPrompt, _UU("CMD_AccessAdd_Prompt_DESTUSERNAME"), NULL, NULL}, - {"SRCMAC", CmdPrompt, _UU("CMD_AccessAdd_Prompt_SRCMAC"), CmdEvalMacAddressAndMask, NULL}, - {"DESTMAC", CmdPrompt, _UU("CMD_AccessAdd_Prompt_DESTMAC"), CmdEvalMacAddressAndMask, NULL}, - {"SRCIP", CmdPrompt, _UU("CMD_AccessAdd_Prompt_SRCIP"), CmdEvalIpAndMask4, NULL}, - {"DESTIP", CmdPrompt, _UU("CMD_AccessAdd_Prompt_DESTIP"), CmdEvalIpAndMask4, NULL}, - {"PROTOCOL", CmdPrompt, _UU("CMD_AccessAdd_Prompt_PROTOCOL"), CmdEvalProtocol, NULL}, - {"SRCPORT", CmdPrompt, _UU("CMD_AccessAdd_Prompt_SRCPORT"), CmdEvalPortRange, NULL}, - {"DESTPORT", CmdPrompt, _UU("CMD_AccessAdd_Prompt_DESTPORT"), CmdEvalPortRange, NULL}, - {"TCPSTATE", CmdPrompt, _UU("CMD_AccessAdd_Prompt_TCPSTATE"), CmdEvalTcpState, NULL}, - }; - - // If virtual HUB is not selected, it's an error - if (ps->HubName == NULL) - { - c->Write(c, _UU("CMD_Hub_Not_Selected")); - return ERR_INVALID_PARAMETER; - } - - o = ParseCommandList(c, cmd_name, str, args, sizeof(args) / sizeof(args[0])); - if (o == NULL) - { - return ERR_INVALID_PARAMETER; - } - - Zero(&t, sizeof(t)); - a = &t.Access; - - StrCpy(t.HubName, sizeof(t.HubName), ps->HubName); - UniStrCpy(a->Note, sizeof(a->Note), GetParamUniStr(o, "MEMO")); - a->Active = true; - a->Priority = GetParamInt(o, "PRIORITY"); - a->Discard = StrToPassOrDiscard(GetParamStr(o, "[pass|discard]")) ? false : true; - StrCpy(a->SrcUsername, sizeof(a->SrcUsername), GetParamStr(o, "SRCUSERNAME")); - StrCpy(a->DestUsername, sizeof(a->DestUsername), GetParamStr(o, "DESTUSERNAME")); - ParseMacAddressAndMask(GetParamStr(o, "SRCMAC"), &a->CheckSrcMac, a->SrcMacAddress, a->SrcMacMask); - ParseMacAddressAndMask(GetParamStr(o, "DESTMAC"), &a->CheckDstMac, a->DstMacAddress, a->DstMacMask); - ParseIpAndMask4(GetParamStr(o, "SRCIP"), &a->SrcIpAddress, &a->SrcSubnetMask); - ParseIpAndMask4(GetParamStr(o, "DESTIP"), &a->DestIpAddress, &a->DestSubnetMask); - a->Protocol = StrToProtocol(GetParamStr(o, "PROTOCOL")); - ParsePortRange(GetParamStr(o, "SRCPORT"), &a->SrcPortStart, &a->SrcPortEnd); - ParsePortRange(GetParamStr(o, "DESTPORT"), &a->DestPortStart, &a->DestPortEnd); - ParseTcpState(GetParamStr(o, "TCPSTATE"), &a->CheckTcpState, &a->Established); - - // RPC call - ret = ScAddAccess(ps->Rpc, &t); - - if (ret != ERR_NO_ERROR) - { - // An error has occured - CmdPrintError(c, ret); - FreeParamValueList(o); - return ret; - } - - FreeParamValueList(o); - - return 0; -} - -// Adding a rule to the access list (Extended, IPv4) -UINT PsAccessAddEx(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) -{ - LIST *o; - PS *ps = (PS *)param; - UINT ret = 0; - RPC_ADD_ACCESS t; - ACCESS *a; - // Parameter list that can be specified - CMD_EVAL_MIN_MAX minmax = - { - "CMD_AccessAdd_Eval_PRIORITY", 1, 4294967295UL, - }; - CMD_EVAL_MIN_MAX minmax_delay = - { - "CMD_AccessAddEx_Eval_DELAY", 0, HUB_ACCESSLIST_DELAY_MAX, - }; - CMD_EVAL_MIN_MAX minmax_jitter = - { - "CMD_AccessAddEx_Eval_JITTER", 0, HUB_ACCESSLIST_JITTER_MAX, - }; - CMD_EVAL_MIN_MAX minmax_loss = - { - "CMD_AccessAddEx_Eval_LOSS", 0, HUB_ACCESSLIST_LOSS_MAX, - }; - PARAM args[] = - { - // "name", prompt_proc, prompt_param, eval_proc, eval_param - {"[pass|discard]", CmdPrompt, _UU("CMD_AccessAdd_Prompt_TYPE"), CmdEvalNotEmpty, NULL}, - {"MEMO", CmdPrompt, _UU("CMD_AccessAdd_Prompt_MEMO"), NULL, NULL}, - {"PRIORITY", CmdPrompt, _UU("CMD_AccessAdd_Prompt_PRIORITY"), CmdEvalMinMax, &minmax}, - {"SRCUSERNAME", CmdPrompt, _UU("CMD_AccessAdd_Prompt_SRCUSERNAME"), NULL, NULL}, - {"DESTUSERNAME", CmdPrompt, _UU("CMD_AccessAdd_Prompt_DESTUSERNAME"), NULL, NULL}, - {"SRCMAC", CmdPrompt, _UU("CMD_AccessAdd_Prompt_SRCMAC"), CmdEvalMacAddressAndMask, NULL}, - {"DESTMAC", CmdPrompt, _UU("CMD_AccessAdd_Prompt_DESTMAC"), CmdEvalMacAddressAndMask, NULL}, - {"SRCIP", CmdPrompt, _UU("CMD_AccessAdd_Prompt_SRCIP"), CmdEvalIpAndMask4, NULL}, - {"DESTIP", CmdPrompt, _UU("CMD_AccessAdd_Prompt_DESTIP"), CmdEvalIpAndMask4, NULL}, - {"PROTOCOL", CmdPrompt, _UU("CMD_AccessAdd_Prompt_PROTOCOL"), CmdEvalProtocol, NULL}, - {"SRCPORT", CmdPrompt, _UU("CMD_AccessAdd_Prompt_SRCPORT"), CmdEvalPortRange, NULL}, - {"DESTPORT", CmdPrompt, _UU("CMD_AccessAdd_Prompt_DESTPORT"), CmdEvalPortRange, NULL}, - {"TCPSTATE", CmdPrompt, _UU("CMD_AccessAdd_Prompt_TCPSTATE"), CmdEvalTcpState, NULL}, - {"DELAY", CmdPrompt, _UU("CMD_AccessAddEx_Prompt_DELAY"), CmdEvalMinMax, &minmax_delay}, - {"JITTER", CmdPrompt, _UU("CMD_AccessAddEx_Prompt_JITTER"), CmdEvalMinMax, &minmax_jitter}, - {"LOSS", CmdPrompt, _UU("CMD_AccessAddEx_Prompt_LOSS"), CmdEvalMinMax, &minmax_loss}, - {"REDIRECTURL", NULL, NULL, NULL, NULL}, - }; - - // If virtual HUB is not selected, it's an error - if (ps->HubName == NULL) - { - c->Write(c, _UU("CMD_Hub_Not_Selected")); - return ERR_INVALID_PARAMETER; - } - - // Check whether it is supported - if (GetCapsBool(ps->CapsList, "b_support_ex_acl") == false) - { - c->Write(c, _E(ERR_NOT_SUPPORTED)); - return ERR_NOT_SUPPORTED; - } - - o = ParseCommandList(c, cmd_name, str, args, sizeof(args) / sizeof(args[0])); - if (o == NULL) - { - return ERR_INVALID_PARAMETER; - } - - Zero(&t, sizeof(t)); - a = &t.Access; - - StrCpy(t.HubName, sizeof(t.HubName), ps->HubName); - UniStrCpy(a->Note, sizeof(a->Note), GetParamUniStr(o, "MEMO")); - a->Active = true; - a->Priority = GetParamInt(o, "PRIORITY"); - a->Discard = StrToPassOrDiscard(GetParamStr(o, "[pass|discard]")) ? false : true; - StrCpy(a->SrcUsername, sizeof(a->SrcUsername), GetParamStr(o, "SRCUSERNAME")); - StrCpy(a->DestUsername, sizeof(a->DestUsername), GetParamStr(o, "DESTUSERNAME")); - ParseMacAddressAndMask(GetParamStr(o, "SRCMAC"), &a->CheckSrcMac, a->SrcMacAddress, a->SrcMacMask); - ParseMacAddressAndMask(GetParamStr(o, "DESTMAC"), &a->CheckDstMac, a->DstMacAddress, a->DstMacMask); - ParseIpAndMask4(GetParamStr(o, "SRCIP"), &a->SrcIpAddress, &a->SrcSubnetMask); - ParseIpAndMask4(GetParamStr(o, "DESTIP"), &a->DestIpAddress, &a->DestSubnetMask); - a->Protocol = StrToProtocol(GetParamStr(o, "PROTOCOL")); - ParsePortRange(GetParamStr(o, "SRCPORT"), &a->SrcPortStart, &a->SrcPortEnd); - ParsePortRange(GetParamStr(o, "DESTPORT"), &a->DestPortStart, &a->DestPortEnd); - ParseTcpState(GetParamStr(o, "TCPSTATE"), &a->CheckTcpState, &a->Established); - a->Delay = GetParamInt(o, "DELAY"); - a->Jitter = GetParamInt(o, "JITTER"); - a->Loss = GetParamInt(o, "LOSS"); - StrCpy(a->RedirectUrl, sizeof(a->RedirectUrl), GetParamStr(o, "REDIRECTURL")); - - // RPC call - ret = ScAddAccess(ps->Rpc, &t); - - if (ret != ERR_NO_ERROR) - { - // An error has occured - CmdPrintError(c, ret); - FreeParamValueList(o); - return ret; - } - - FreeParamValueList(o); - - return 0; -} - -// Adding a rule to the access list (Standard, IPv6) -UINT PsAccessAdd6(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) -{ - LIST *o; - PS *ps = (PS *)param; - UINT ret = 0; - RPC_ADD_ACCESS t; - ACCESS *a; - IP ip, mask; - // Parameter list that can be specified - CMD_EVAL_MIN_MAX minmax = - { - "CMD_AccessAdd6_Eval_PRIORITY", 1, 4294967295UL, - }; - PARAM args[] = - { - // "name", prompt_proc, prompt_param, eval_proc, eval_param - {"[pass|discard]", CmdPrompt, _UU("CMD_AccessAdd6_Prompt_TYPE"), CmdEvalNotEmpty, NULL}, - {"MEMO", CmdPrompt, _UU("CMD_AccessAdd6_Prompt_MEMO"), NULL, NULL}, - {"PRIORITY", CmdPrompt, _UU("CMD_AccessAdd6_Prompt_PRIORITY"), CmdEvalMinMax, &minmax}, - {"SRCUSERNAME", CmdPrompt, _UU("CMD_AccessAdd6_Prompt_SRCUSERNAME"), NULL, NULL}, - {"DESTUSERNAME", CmdPrompt, _UU("CMD_AccessAdd6_Prompt_DESTUSERNAME"), NULL, NULL}, - {"SRCMAC", CmdPrompt, _UU("CMD_AccessAdd6_Prompt_SRCMAC"), CmdEvalMacAddressAndMask, NULL}, - {"DESTMAC", CmdPrompt, _UU("CMD_AccessAdd6_Prompt_DESTMAC"), CmdEvalMacAddressAndMask, NULL}, - {"SRCIP", CmdPrompt, _UU("CMD_AccessAdd6_Prompt_SRCIP"), CmdEvalIpAndMask6, NULL}, - {"DESTIP", CmdPrompt, _UU("CMD_AccessAdd6_Prompt_DESTIP"), CmdEvalIpAndMask6, NULL}, - {"PROTOCOL", CmdPrompt, _UU("CMD_AccessAdd6_Prompt_PROTOCOL"), CmdEvalProtocol, NULL}, - {"SRCPORT", CmdPrompt, _UU("CMD_AccessAdd6_Prompt_SRCPORT"), CmdEvalPortRange, NULL}, - {"DESTPORT", CmdPrompt, _UU("CMD_AccessAdd6_Prompt_DESTPORT"), CmdEvalPortRange, NULL}, - {"TCPSTATE", CmdPrompt, _UU("CMD_AccessAdd6_Prompt_TCPSTATE"), CmdEvalTcpState, NULL}, - }; - - // If virtual HUB is not selected, it's an error - if (ps->HubName == NULL) - { - c->Write(c, _UU("CMD_Hub_Not_Selected")); - return ERR_INVALID_PARAMETER; - } - - // Check whether it is supported - if (GetCapsBool(ps->CapsList, "b_support_ex_acl") == false) - { - c->Write(c, _E(ERR_NOT_SUPPORTED)); - return ERR_NOT_SUPPORTED; - } - - o = ParseCommandList(c, cmd_name, str, args, sizeof(args) / sizeof(args[0])); - if (o == NULL) - { - return ERR_INVALID_PARAMETER; - } - - Zero(&t, sizeof(t)); - a = &t.Access; - - a->IsIPv6 = true; - - StrCpy(t.HubName, sizeof(t.HubName), ps->HubName); - UniStrCpy(a->Note, sizeof(a->Note), GetParamUniStr(o, "MEMO")); - a->Active = true; - a->Priority = GetParamInt(o, "PRIORITY"); - a->Discard = StrToPassOrDiscard(GetParamStr(o, "[pass|discard]")) ? false : true; - StrCpy(a->SrcUsername, sizeof(a->SrcUsername), GetParamStr(o, "SRCUSERNAME")); - StrCpy(a->DestUsername, sizeof(a->DestUsername), GetParamStr(o, "DESTUSERNAME")); - ParseMacAddressAndMask(GetParamStr(o, "SRCMAC"), &a->CheckSrcMac, a->SrcMacAddress, a->SrcMacMask); - ParseMacAddressAndMask(GetParamStr(o, "DESTMAC"), &a->CheckDstMac, a->DstMacAddress, a->DstMacMask); - - Zero(&ip, sizeof(ip)); - Zero(&mask, sizeof(mask)); - - ParseIpAndMask6(GetParamStr(o, "SRCIP"), &ip, &mask); - IPToIPv6Addr(&a->SrcIpAddress6, &ip); - IPToIPv6Addr(&a->SrcSubnetMask6, &mask); - - ParseIpAndMask6(GetParamStr(o, "DESTIP"), &ip, &mask); - IPToIPv6Addr(&a->DestIpAddress6, &ip); - IPToIPv6Addr(&a->DestSubnetMask6, &mask); - - a->Protocol = StrToProtocol(GetParamStr(o, "PROTOCOL")); - ParsePortRange(GetParamStr(o, "SRCPORT"), &a->SrcPortStart, &a->SrcPortEnd); - ParsePortRange(GetParamStr(o, "DESTPORT"), &a->DestPortStart, &a->DestPortEnd); - ParseTcpState(GetParamStr(o, "TCPSTATE"), &a->CheckTcpState, &a->Established); - - // RPC call - ret = ScAddAccess(ps->Rpc, &t); - - if (ret != ERR_NO_ERROR) - { - // An error has occured - CmdPrintError(c, ret); - FreeParamValueList(o); - return ret; - } - - FreeParamValueList(o); - - return 0; -} - -// Adding a rule to the access list (Extended, IPv6) -UINT PsAccessAddEx6(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) -{ - LIST *o; - PS *ps = (PS *)param; - UINT ret = 0; - RPC_ADD_ACCESS t; - ACCESS *a; - IP ip, mask; - // Parameter list that can be specified - CMD_EVAL_MIN_MAX minmax = - { - "CMD_AccessAdd6_Eval_PRIORITY", 1, 4294967295UL, - }; - CMD_EVAL_MIN_MAX minmax_delay = - { - "CMD_AccessAddEx6_Eval_DELAY", 0, HUB_ACCESSLIST_DELAY_MAX, - }; - CMD_EVAL_MIN_MAX minmax_jitter = - { - "CMD_AccessAddEx6_Eval_JITTER", 0, HUB_ACCESSLIST_JITTER_MAX, - }; - CMD_EVAL_MIN_MAX minmax_loss = - { - "CMD_AccessAddEx6_Eval_LOSS", 0, HUB_ACCESSLIST_LOSS_MAX, - }; - PARAM args[] = - { - // "name", prompt_proc, prompt_param, eval_proc, eval_param - {"[pass|discard]", CmdPrompt, _UU("CMD_AccessAdd6_Prompt_TYPE"), CmdEvalNotEmpty, NULL}, - {"MEMO", CmdPrompt, _UU("CMD_AccessAdd6_Prompt_MEMO"), NULL, NULL}, - {"PRIORITY", CmdPrompt, _UU("CMD_AccessAdd6_Prompt_PRIORITY"), CmdEvalMinMax, &minmax}, - {"SRCUSERNAME", CmdPrompt, _UU("CMD_AccessAdd6_Prompt_SRCUSERNAME"), NULL, NULL}, - {"DESTUSERNAME", CmdPrompt, _UU("CMD_AccessAdd6_Prompt_DESTUSERNAME"), NULL, NULL}, - {"SRCMAC", CmdPrompt, _UU("CMD_AccessAdd6_Prompt_SRCMAC"), CmdEvalMacAddressAndMask, NULL}, - {"DESTMAC", CmdPrompt, _UU("CMD_AccessAdd6_Prompt_DESTMAC"), CmdEvalMacAddressAndMask, NULL}, - {"SRCIP", CmdPrompt, _UU("CMD_AccessAdd6_Prompt_SRCIP"), CmdEvalIpAndMask6, NULL}, - {"DESTIP", CmdPrompt, _UU("CMD_AccessAdd6_Prompt_DESTIP"), CmdEvalIpAndMask6, NULL}, - {"PROTOCOL", CmdPrompt, _UU("CMD_AccessAdd6_Prompt_PROTOCOL"), CmdEvalProtocol, NULL}, - {"SRCPORT", CmdPrompt, _UU("CMD_AccessAdd6_Prompt_SRCPORT"), CmdEvalPortRange, NULL}, - {"DESTPORT", CmdPrompt, _UU("CMD_AccessAdd6_Prompt_DESTPORT"), CmdEvalPortRange, NULL}, - {"TCPSTATE", CmdPrompt, _UU("CMD_AccessAdd6_Prompt_TCPSTATE"), CmdEvalTcpState, NULL}, - {"DELAY", CmdPrompt, _UU("CMD_AccessAddEx6_Prompt_DELAY"), CmdEvalMinMax, &minmax_delay}, - {"JITTER", CmdPrompt, _UU("CMD_AccessAddEx6_Prompt_JITTER"), CmdEvalMinMax, &minmax_jitter}, - {"LOSS", CmdPrompt, _UU("CMD_AccessAddEx6_Prompt_LOSS"), CmdEvalMinMax, &minmax_loss}, - {"REDIRECTURL", NULL, NULL, NULL, NULL}, - }; - - // If virtual HUB is not selected, it's an error - if (ps->HubName == NULL) - { - c->Write(c, _UU("CMD_Hub_Not_Selected")); - return ERR_INVALID_PARAMETER; - } - - // Check whether it is supported - if (GetCapsBool(ps->CapsList, "b_support_ex_acl") == false) - { - c->Write(c, _E(ERR_NOT_SUPPORTED)); - return ERR_NOT_SUPPORTED; - } - - o = ParseCommandList(c, cmd_name, str, args, sizeof(args) / sizeof(args[0])); - if (o == NULL) - { - return ERR_INVALID_PARAMETER; - } - - Zero(&t, sizeof(t)); - a = &t.Access; - - a->IsIPv6 = true; - - StrCpy(t.HubName, sizeof(t.HubName), ps->HubName); - UniStrCpy(a->Note, sizeof(a->Note), GetParamUniStr(o, "MEMO")); - a->Active = true; - a->Priority = GetParamInt(o, "PRIORITY"); - a->Discard = StrToPassOrDiscard(GetParamStr(o, "[pass|discard]")) ? false : true; - StrCpy(a->SrcUsername, sizeof(a->SrcUsername), GetParamStr(o, "SRCUSERNAME")); - StrCpy(a->DestUsername, sizeof(a->DestUsername), GetParamStr(o, "DESTUSERNAME")); - ParseMacAddressAndMask(GetParamStr(o, "SRCMAC"), &a->CheckSrcMac, a->SrcMacAddress, a->SrcMacMask); - ParseMacAddressAndMask(GetParamStr(o, "DESTMAC"), &a->CheckDstMac, a->DstMacAddress, a->DstMacMask); - - Zero(&ip, sizeof(ip)); - Zero(&mask, sizeof(mask)); - - ParseIpAndMask6(GetParamStr(o, "SRCIP"), &ip, &mask); - IPToIPv6Addr(&a->SrcIpAddress6, &ip); - IPToIPv6Addr(&a->SrcSubnetMask6, &mask); - - ParseIpAndMask6(GetParamStr(o, "DESTIP"), &ip, &mask); - IPToIPv6Addr(&a->DestIpAddress6, &ip); - IPToIPv6Addr(&a->DestSubnetMask6, &mask); - - a->Protocol = StrToProtocol(GetParamStr(o, "PROTOCOL")); - ParsePortRange(GetParamStr(o, "SRCPORT"), &a->SrcPortStart, &a->SrcPortEnd); - ParsePortRange(GetParamStr(o, "DESTPORT"), &a->DestPortStart, &a->DestPortEnd); - ParseTcpState(GetParamStr(o, "TCPSTATE"), &a->CheckTcpState, &a->Established); - a->Delay = GetParamInt(o, "DELAY"); - a->Jitter = GetParamInt(o, "JITTER"); - a->Loss = GetParamInt(o, "LOSS"); - StrCpy(a->RedirectUrl, sizeof(a->RedirectUrl), GetParamStr(o, "REDIRECTURL")); - - // RPC call - ret = ScAddAccess(ps->Rpc, &t); - - if (ret != ERR_NO_ERROR) - { - // An error has occured - CmdPrintError(c, ret); - FreeParamValueList(o); - return ret; - } - - FreeParamValueList(o); - - return 0; -} - - -// Get the list of rules in the access list -UINT PsAccessList(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) -{ - LIST *o; - PS *ps = (PS *)param; - UINT ret = 0; - RPC_ENUM_ACCESS_LIST t; - CT *ct; - UINT i; - - // If virtual HUB is not selected, it's an error - if (ps->HubName == NULL) - { - c->Write(c, _UU("CMD_Hub_Not_Selected")); - return ERR_INVALID_PARAMETER; - } - - o = ParseCommandList(c, cmd_name, str, NULL, 0); - if (o == NULL) - { - return ERR_INVALID_PARAMETER; - } - - Zero(&t, sizeof(t)); - StrCpy(t.HubName, sizeof(t.HubName), ps->HubName); - - // RPC call - ret = ScEnumAccess(ps->Rpc, &t); - - if (ret != ERR_NO_ERROR) - { - // An error has occured - CmdPrintError(c, ret); - FreeParamValueList(o); - return ret; - } - - ct = CtNew(); - CtInsertColumn(ct, _UU("SM_ACCESS_COLUMN_0"), true); - CtInsertColumn(ct, _UU("SM_ACCESS_COLUMN_1"), true); - CtInsertColumn(ct, _UU("SM_ACCESS_COLUMN_2"), true); - CtInsertColumn(ct, _UU("SM_ACCESS_COLUMN_3"), true); - CtInsertColumn(ct, _UU("SM_ACCESS_COLUMN_6"), true); - CtInsertColumn(ct, _UU("SM_ACCESS_COLUMN_5"), false); - CtInsertColumn(ct, _UU("SM_ACCESS_COLUMN_4"), false); - - for (i = 0;i < t.NumAccess;i++) - { - ACCESS *a = &t.Accesses[i]; - char tmp[MAX_SIZE]; - wchar_t tmp3[MAX_SIZE]; - wchar_t tmp1[MAX_SIZE]; - wchar_t tmp2[MAX_SIZE]; - wchar_t tmp4[MAX_SIZE]; - - GetAccessListStr(tmp, sizeof(tmp), a); - UniToStru(tmp1, a->Priority); - StrToUni(tmp2, sizeof(tmp2), tmp); - UniToStru(tmp4, a->UniqueId); - if (a->UniqueId == 0) - { - UniStrCpy(tmp4, sizeof(tmp4), _UU("SEC_NONE")); - } - - UniToStru(tmp3, a->Id); - - CtInsert(ct, - tmp3, - a->Discard ? _UU("SM_ACCESS_DISCARD") : _UU("SM_ACCESS_PASS"), - a->Active ? _UU("SM_ACCESS_ENABLE") : _UU("SM_ACCESS_DISABLE"), - tmp1, - tmp4, - tmp2, - a->Note); - } - - CtFreeEx(ct, c, true); - - FreeRpcEnumAccessList(&t); - - FreeParamValueList(o); - - return 0; -} - -// Remove a rule from the access list -UINT PsAccessDelete(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) -{ - LIST *o; - PS *ps = (PS *)param; - UINT ret = 0; - RPC_DELETE_ACCESS t; - // Parameter list that can be specified - PARAM args[] = - { - // "name", prompt_proc, prompt_param, eval_proc, eval_param - {"[id]", CmdPrompt, _UU("CMD_Access_Prompt_ID"), CmdEvalNotEmpty, NULL}, - }; - - // If virtual HUB is not selected, it's an error - if (ps->HubName == NULL) - { - c->Write(c, _UU("CMD_Hub_Not_Selected")); - return ERR_INVALID_PARAMETER; - } - - o = ParseCommandList(c, cmd_name, str, args, sizeof(args) / sizeof(args[0])); - if (o == NULL) - { - return ERR_INVALID_PARAMETER; - } - - Zero(&t, sizeof(t)); - StrCpy(t.HubName, sizeof(t.HubName), ps->HubName); - t.Id = GetParamInt(o, "[id]"); - - // RPC call - ret = ScDeleteAccess(ps->Rpc, &t); - - if (ret != ERR_NO_ERROR) - { - // An error has occured - CmdPrintError(c, ret); - FreeParamValueList(o); - return ret; - } - - FreeParamValueList(o); - - return 0; -} - -// Enable the rule of access list -UINT PsAccessEnable(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) -{ - LIST *o; - PS *ps = (PS *)param; - UINT ret = 0; - RPC_ENUM_ACCESS_LIST t; - // Parameter list that can be specified - PARAM args[] = - { - // "name", prompt_proc, prompt_param, eval_proc, eval_param - {"[id]", CmdPrompt, _UU("CMD_Access_Prompt_ID"), CmdEvalNotEmpty, NULL}, - }; - - // If virtual HUB is not selected, it's an error - if (ps->HubName == NULL) - { - c->Write(c, _UU("CMD_Hub_Not_Selected")); - return ERR_INVALID_PARAMETER; - } - - o = ParseCommandList(c, cmd_name, str, args, sizeof(args) / sizeof(args[0])); - if (o == NULL) - { - return ERR_INVALID_PARAMETER; - } - - Zero(&t, sizeof(t)); - StrCpy(t.HubName, sizeof(t.HubName), ps->HubName); - - // RPC call - ret = ScEnumAccess(ps->Rpc, &t); - - if (ret != ERR_NO_ERROR) - { - // An error has occured - CmdPrintError(c, ret); - FreeParamValueList(o); - return ret; - } - else - { - UINT i; - bool b = false; - for (i = 0;i < t.NumAccess;i++) - { - ACCESS *a = &t.Accesses[i]; - - if (a->Id == GetParamInt(o, "[id]")) - { - b = true; - - a->Active = true; - } - } - - if (b == false) - { - // The specified ID is not found - ret = ERR_OBJECT_NOT_FOUND; - CmdPrintError(c, ret); - FreeParamValueList(o); - FreeRpcEnumAccessList(&t); - return ret; - } - - ret = ScSetAccessList(ps->Rpc, &t); - if (ret != ERR_NO_ERROR) - { - // An error has occured - CmdPrintError(c, ret); - FreeParamValueList(o); - return ret; - } - - FreeRpcEnumAccessList(&t); - } - - FreeParamValueList(o); - - return ret; -} - -// Disable the rule of access list -UINT PsAccessDisable(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) -{ - LIST *o; - PS *ps = (PS *)param; - UINT ret = 0; - RPC_ENUM_ACCESS_LIST t; - // Parameter list that can be specified - PARAM args[] = - { - // "name", prompt_proc, prompt_param, eval_proc, eval_param - {"[id]", CmdPrompt, _UU("CMD_Access_Prompt_ID"), CmdEvalNotEmpty, NULL}, - }; - - // If virtual HUB is not selected, it's an error - if (ps->HubName == NULL) - { - c->Write(c, _UU("CMD_Hub_Not_Selected")); - return ERR_INVALID_PARAMETER; - } - - o = ParseCommandList(c, cmd_name, str, args, sizeof(args) / sizeof(args[0])); - if (o == NULL) - { - return ERR_INVALID_PARAMETER; - } - - Zero(&t, sizeof(t)); - StrCpy(t.HubName, sizeof(t.HubName), ps->HubName); - - // RPC call - ret = ScEnumAccess(ps->Rpc, &t); - - if (ret != ERR_NO_ERROR) - { - // An error has occured - CmdPrintError(c, ret); - FreeParamValueList(o); - return ret; - } - else - { - UINT i; - bool b = false; - for (i = 0;i < t.NumAccess;i++) - { - ACCESS *a = &t.Accesses[i]; - - if (a->Id == GetParamInt(o, "[id]")) - { - b = true; - - a->Active = false; - } - } - - if (b == false) - { - // The specified ID is not found - ret = ERR_OBJECT_NOT_FOUND; - CmdPrintError(c, ret); - FreeParamValueList(o); - FreeRpcEnumAccessList(&t); - return ret; - } - - ret = ScSetAccessList(ps->Rpc, &t); - if (ret != ERR_NO_ERROR) - { - // An error has occured - CmdPrintError(c, ret); - FreeParamValueList(o); - return ret; - } - - FreeRpcEnumAccessList(&t); - } - - FreeParamValueList(o); - - return ret; -} - -// Get the user list -UINT PsUserList(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) -{ - LIST *o; - PS *ps = (PS *)param; - UINT ret = 0; - RPC_ENUM_USER t; - - // If virtual HUB is not selected, it's an error - if (ps->HubName == NULL) - { - c->Write(c, _UU("CMD_Hub_Not_Selected")); - return ERR_INVALID_PARAMETER; - } - - o = ParseCommandList(c, cmd_name, str, NULL, 0); - if (o == NULL) - { - return ERR_INVALID_PARAMETER; - } - - Zero(&t, sizeof(t)); - StrCpy(t.HubName, sizeof(t.HubName), ps->HubName); - - // RPC call - ret = ScEnumUser(ps->Rpc, &t); - - if (ret != ERR_NO_ERROR) - { - // An error has occured - CmdPrintError(c, ret); - FreeParamValueList(o); - return ret; - } - else - { - UINT i; - CT *ct = CtNew(); - - CtInsertColumn(ct, _UU("SM_USER_COLUMN_1"), false); - CtInsertColumn(ct, _UU("SM_USER_COLUMN_2"), false); - CtInsertColumn(ct, _UU("SM_USER_COLUMN_3"), false); - CtInsertColumn(ct, _UU("SM_USER_COLUMN_4"), false); - CtInsertColumn(ct, _UU("SM_USER_COLUMN_5"), false); - CtInsertColumn(ct, _UU("SM_USER_COLUMN_6"), false); - CtInsertColumn(ct, _UU("SM_USER_COLUMN_7"), false); - CtInsertColumn(ct, _UU("SM_LICENSE_COLUMN_5"), false); - CtInsertColumn(ct, _UU("SM_SESS_COLUMN_6"), false); - CtInsertColumn(ct, _UU("SM_SESS_COLUMN_7"), false); - - for (i = 0;i < t.NumUser;i++) - { - RPC_ENUM_USER_ITEM *e = &t.Users[i]; - wchar_t name[MAX_SIZE]; - wchar_t group[MAX_SIZE]; - wchar_t num[MAX_SIZE]; - wchar_t time[MAX_SIZE]; - wchar_t exp[MAX_SIZE]; - wchar_t num1[64], num2[64]; - - StrToUni(name, sizeof(name), e->Name); - - if (StrLen(e->GroupName) != 0) - { - StrToUni(group, sizeof(group), e->GroupName); - } - else - { - UniStrCpy(group, sizeof(group), _UU("SM_NO_GROUP")); - } - - UniToStru(num, e->NumLogin); - - GetDateTimeStrEx64(time, sizeof(time), SystemToLocal64(e->LastLoginTime), NULL); - - if (e->IsExpiresFilled == false) - { - UniStrCpy(exp, sizeof(exp), _UU("CM_ST_NONE")); - } - else - { - if (e->Expires == 0) - { - UniStrCpy(exp, sizeof(exp), _UU("SM_LICENSE_NO_EXPIRES")); - } - else - { - GetDateTimeStrEx64(exp, sizeof(exp), SystemToLocal64(e->Expires), NULL); - } - } - - if (e->IsTrafficFilled == false) - { - UniStrCpy(num1, sizeof(num1), _UU("CM_ST_NONE")); - UniStrCpy(num2, sizeof(num2), _UU("CM_ST_NONE")); - } - else - { - UniToStr3(num1, sizeof(num1), - e->Traffic.Recv.BroadcastBytes + e->Traffic.Recv.UnicastBytes + - e->Traffic.Send.BroadcastBytes + e->Traffic.Send.UnicastBytes); - - UniToStr3(num2, sizeof(num2), - e->Traffic.Recv.BroadcastCount + e->Traffic.Recv.UnicastCount + - e->Traffic.Send.BroadcastBytes + e->Traffic.Send.UnicastCount); - } - - CtInsert(ct, - name, e->Realname, group, e->Note, GetAuthTypeStr(e->AuthType), - num, time, exp, num1, num2); - } - - CtFreeEx(ct, c, true); - } - - FreeRpcEnumUser(&t); - - FreeParamValueList(o); - - return 0; -} - -// Get a string of user authentication method -wchar_t *GetAuthTypeStr(UINT id) -{ - char tmp[MAX_SIZE]; - Format(tmp, sizeof(tmp), "SM_AUTHTYPE_%u", id); - - return _UU(tmp); -} - -// Creating a user -UINT PsUserCreate(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) -{ - LIST *o; - PS *ps = (PS *)param; - UINT ret = 0; - RPC_SET_USER t; - // Parameter list that can be specified - PARAM args[] = - { - // "name", prompt_proc, prompt_param, eval_proc, eval_param - {"[name]", CmdPrompt, _UU("CMD_UserCreate_Prompt_NAME"), CmdEvalNotEmpty, NULL}, - {"GROUP", CmdPrompt, _UU("CMD_UserCreate_Prompt_GROUP"), NULL, NULL}, - {"REALNAME", CmdPrompt, _UU("CMD_UserCreate_Prompt_REALNAME"), NULL, NULL}, - {"NOTE", CmdPrompt, _UU("CMD_UserCreate_Prompt_NOTE"), NULL, NULL}, - }; - - // If virtual HUB is not selected, it's an error - if (ps->HubName == NULL) - { - c->Write(c, _UU("CMD_Hub_Not_Selected")); - return ERR_INVALID_PARAMETER; - } - - o = ParseCommandList(c, cmd_name, str, args, sizeof(args) / sizeof(args[0])); - if (o == NULL) - { - return ERR_INVALID_PARAMETER; - } - - Zero(&t, sizeof(t)); - StrCpy(t.HubName, sizeof(t.HubName), ps->HubName); - StrCpy(t.Name, sizeof(t.Name), GetParamStr(o, "[name]")); - StrCpy(t.GroupName, sizeof(t.GroupName), GetParamStr(o, "GROUP")); - UniStrCpy(t.Realname, sizeof(t.Realname), GetParamUniStr(o, "REALNAME")); - UniStrCpy(t.Note, sizeof(t.Note), GetParamUniStr(o, "NOTE")); - - Trim(t.Name); - if (StrCmpi(t.Name, "*") == 0) - { - t.AuthType = AUTHTYPE_RADIUS; - t.AuthData = NewRadiusAuthData(NULL); - } - else - { - UCHAR random_pass[SHA1_SIZE]; - UCHAR random_pass2[MD5_SIZE]; - - Rand(random_pass, sizeof(random_pass)); - Rand(random_pass2, sizeof(random_pass2)); - t.AuthType = AUTHTYPE_PASSWORD; - t.AuthData = NewPasswordAuthDataRaw(random_pass, random_pass2); - } - - // RPC call - ret = ScCreateUser(ps->Rpc, &t); - - if (ret != ERR_NO_ERROR) - { - // An error has occured - CmdPrintError(c, ret); - FreeParamValueList(o); - return ret; - } - - FreeRpcSetUser(&t); - - FreeParamValueList(o); - - return 0; -} - -// Change the user information -UINT PsUserSet(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) -{ - LIST *o; - PS *ps = (PS *)param; - UINT ret = 0; - RPC_SET_USER t; - // Parameter list that can be specified - PARAM args[] = - { - // "name", prompt_proc, prompt_param, eval_proc, eval_param - {"[name]", CmdPrompt, _UU("CMD_UserCreate_Prompt_NAME"), CmdEvalNotEmpty, NULL}, - {"GROUP", CmdPrompt, _UU("CMD_UserCreate_Prompt_GROUP"), NULL, NULL}, - {"REALNAME", CmdPrompt, _UU("CMD_UserCreate_Prompt_REALNAME"), NULL, NULL}, - {"NOTE", CmdPrompt, _UU("CMD_UserCreate_Prompt_NOTE"), NULL, NULL}, - }; - - // If virtual HUB is not selected, it's an error - if (ps->HubName == NULL) - { - c->Write(c, _UU("CMD_Hub_Not_Selected")); - return ERR_INVALID_PARAMETER; - } - - o = ParseCommandList(c, cmd_name, str, args, sizeof(args) / sizeof(args[0])); - if (o == NULL) - { - return ERR_INVALID_PARAMETER; - } - - Zero(&t, sizeof(t)); - // Get the user object - StrCpy(t.HubName, sizeof(t.HubName), ps->HubName); - StrCpy(t.Name, sizeof(t.Name), GetParamStr(o, "[name]")); - - ret = ScGetUser(ps->Rpc, &t); - if (ret != ERR_NO_ERROR) - { - // An error has occured - CmdPrintError(c, ret); - FreeParamValueList(o); - return ret; - } - - // Update the information - StrCpy(t.GroupName, sizeof(t.GroupName), GetParamStr(o, "GROUP")); - UniStrCpy(t.Realname, sizeof(t.Realname), GetParamUniStr(o, "REALNAME")); - UniStrCpy(t.Note, sizeof(t.Note), GetParamUniStr(o, "NOTE")); - - // Write the user object - ret = ScSetUser(ps->Rpc, &t); - - if (ret != ERR_NO_ERROR) - { - // An error has occured - CmdPrintError(c, ret); - FreeParamValueList(o); - return ret; - } - - FreeRpcSetUser(&t); - - FreeParamValueList(o); - - return 0; -} - -// Delete the user -UINT PsUserDelete(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) -{ - LIST *o; - PS *ps = (PS *)param; - UINT ret = 0; - RPC_DELETE_USER t; - // Parameter list that can be specified - PARAM args[] = - { - {"[name]", CmdPrompt, _UU("CMD_UserCreate_Prompt_NAME"), CmdEvalNotEmpty, NULL}, - }; - - // If virtual HUB is not selected, it's an error - if (ps->HubName == NULL) - { - c->Write(c, _UU("CMD_Hub_Not_Selected")); - return ERR_INVALID_PARAMETER; - } - - o = ParseCommandList(c, cmd_name, str, args, sizeof(args) / sizeof(args[0])); - if (o == NULL) - { - return ERR_INVALID_PARAMETER; - } - - Zero(&t, sizeof(t)); - StrCpy(t.HubName, sizeof(t.HubName), ps->HubName); - StrCpy(t.Name, sizeof(t.Name), GetParamStr(o, "[name]")); - - // RPC call - ret = ScDeleteUser(ps->Rpc, &t); - - if (ret != ERR_NO_ERROR) - { - // An error has occured - CmdPrintError(c, ret); - FreeParamValueList(o); - return ret; - } - - FreeParamValueList(o); - - return 0; -} - -// Get the user information -UINT PsUserGet(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) -{ - LIST *o; - PS *ps = (PS *)param; - UINT ret = 0; - RPC_SET_USER t; - // Parameter list that can be specified - PARAM args[] = - { - // "name", prompt_proc, prompt_param, eval_proc, eval_param - {"[name]", CmdPrompt, _UU("CMD_UserCreate_Prompt_NAME"), CmdEvalNotEmpty, NULL}, - }; - - // If virtual HUB is not selected, it's an error - if (ps->HubName == NULL) - { - c->Write(c, _UU("CMD_Hub_Not_Selected")); - return ERR_INVALID_PARAMETER; - } - - o = ParseCommandList(c, cmd_name, str, args, sizeof(args) / sizeof(args[0])); - if (o == NULL) - { - return ERR_INVALID_PARAMETER; - } - - Zero(&t, sizeof(t)); - // Get the user object - StrCpy(t.HubName, sizeof(t.HubName), ps->HubName); - StrCpy(t.Name, sizeof(t.Name), GetParamStr(o, "[name]")); - - ret = ScGetUser(ps->Rpc, &t); - if (ret != ERR_NO_ERROR) - { - // An error has occured - CmdPrintError(c, ret); - FreeParamValueList(o); - return ret; - } - else - { - wchar_t tmp[MAX_SIZE]; - CT *ct; - - // Display the user's data - ct = CtNewStandard(); - - // User name - StrToUni(tmp, sizeof(tmp), t.Name); - CtInsert(ct, _UU("CMD_UserGet_Column_Name"), tmp); - - // Real name - CtInsert(ct, _UU("CMD_UserGet_Column_RealName"), t.Realname); - - // Description - CtInsert(ct, _UU("CMD_UserGet_Column_Note"), t.Note); - - // Group name - if (IsEmptyStr(t.GroupName) == false) - { - StrToUni(tmp, sizeof(tmp), t.GroupName); - CtInsert(ct, _UU("CMD_UserGet_Column_Group"), tmp); - } - - // Expiration date - GetDateTimeStrEx64(tmp, sizeof(tmp), SystemToLocal64(t.ExpireTime), NULL); - CtInsert(ct, _UU("CMD_UserGet_Column_Expires"), tmp); - - // Authentication method - CtInsert(ct, _UU("CMD_UserGet_Column_AuthType"), GetAuthTypeStr(t.AuthType)); - - switch (t.AuthType) - { - case AUTHTYPE_USERCERT: - if (t.AuthData != NULL) - { - AUTHUSERCERT *auc = (AUTHUSERCERT *)t.AuthData; - - if (auc != NULL && auc->UserX != NULL) - { - // Registered user-specific certificate - GetAllNameFromX(tmp, sizeof(tmp), auc->UserX); - CtInsert(ct, _UU("CMD_UserGet_Column_UserCert"), tmp); - } - } - break; - - case AUTHTYPE_ROOTCERT: - if (t.AuthData != NULL) - { - AUTHROOTCERT *arc = (AUTHROOTCERT *)t.AuthData; - - if (IsEmptyUniStr(arc->CommonName) == false) - { - // Limitation the value of the certificate's CN - CtInsert(ct, _UU("CMD_UserGet_Column_RootCert_CN"), arc->CommonName); - } - - if (arc->Serial != NULL && arc->Serial->size >= 1) - { - char tmp2[MAX_SIZE]; - - // Limitation the serial number of the certificate - BinToStrEx(tmp2, sizeof(tmp2), arc->Serial->data, arc->Serial->size); - StrToUni(tmp, sizeof(tmp), tmp2); - CtInsert(ct, _UU("CMD_UserGet_Column_RootCert_SERIAL"), tmp); - } - } - break; - - case AUTHTYPE_RADIUS: - case AUTHTYPE_NT: - if (t.AuthData != NULL) - { - AUTHRADIUS *ar = (AUTHRADIUS *)t.AuthData; - - // Authentication user name of the external authentication server - if (IsEmptyUniStr(ar->RadiusUsername) == false) - { - CtInsert(ct, _UU("CMD_UserGet_Column_RadiusAlias"), ar->RadiusUsername); - } - } - break; - } - - CtInsert(ct, L"---", L"---"); - - GetDateTimeStrEx64(tmp, sizeof(tmp), SystemToLocal64(t.CreatedTime), NULL); - CtInsert(ct, _UU("SM_USERINFO_CREATE"), tmp); - - GetDateTimeStrEx64(tmp, sizeof(tmp), SystemToLocal64(t.UpdatedTime), NULL); - CtInsert(ct, _UU("SM_USERINFO_UPDATE"), tmp); - - CmdInsertTrafficInfo(ct, &t.Traffic); - - UniToStru(tmp, t.NumLogin); - CtInsert(ct, _UU("SM_USERINFO_NUMLOGIN"), tmp); - - - CtFree(ct, c); - - if (t.Policy != NULL) - { - c->Write(c, L""); - c->Write(c, _UU("CMD_UserGet_Policy")); - PrintPolicy(c, t.Policy, false); - } - } - - FreeRpcSetUser(&t); - - FreeParamValueList(o); - - return 0; -} - -// Set the authentication method for the user to the anonymous authentication -UINT PsUserAnonymousSet(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) -{ - LIST *o; - PS *ps = (PS *)param; - UINT ret = 0; - RPC_SET_USER t; - // Parameter list that can be specified - PARAM args[] = - { - // "name", prompt_proc, prompt_param, eval_proc, eval_param - {"[name]", CmdPrompt, _UU("CMD_UserCreate_Prompt_NAME"), CmdEvalNotEmpty, NULL}, - }; - - // If virtual HUB is not selected, it's an error - if (ps->HubName == NULL) - { - c->Write(c, _UU("CMD_Hub_Not_Selected")); - return ERR_INVALID_PARAMETER; - } - - o = ParseCommandList(c, cmd_name, str, args, sizeof(args) / sizeof(args[0])); - if (o == NULL) - { - return ERR_INVALID_PARAMETER; - } - - Zero(&t, sizeof(t)); - // Get the user object - StrCpy(t.HubName, sizeof(t.HubName), ps->HubName); - StrCpy(t.Name, sizeof(t.Name), GetParamStr(o, "[name]")); - - ret = ScGetUser(ps->Rpc, &t); - if (ret != ERR_NO_ERROR) - { - // An error has occured - CmdPrintError(c, ret); - FreeParamValueList(o); - return ret; - } - - // Update the information - FreeAuthData(t.AuthType, t.AuthData); - - // Set to anonymous authentication - t.AuthType = AUTHTYPE_ANONYMOUS; - t.AuthData = NULL; - - // Write the user object - ret = ScSetUser(ps->Rpc, &t); - - if (ret != ERR_NO_ERROR) - { - // An error has occured - CmdPrintError(c, ret); - FreeParamValueList(o); - return ret; - } - - FreeRpcSetUser(&t); - - FreeParamValueList(o); - - return 0; -} - -// Set the authentication method for the user to the password authentication and set a password -UINT PsUserPasswordSet(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) -{ - LIST *o; - PS *ps = (PS *)param; - UINT ret = 0; - RPC_SET_USER t; - // Parameter list that can be specified - PARAM args[] = - { - // "name", prompt_proc, prompt_param, eval_proc, eval_param - {"[name]", CmdPrompt, _UU("CMD_UserCreate_Prompt_NAME"), CmdEvalNotEmpty, NULL}, - {"PASSWORD", CmdPromptChoosePassword, NULL, NULL, NULL}, - }; - - // If virtual HUB is not selected, it's an error - if (ps->HubName == NULL) - { - c->Write(c, _UU("CMD_Hub_Not_Selected")); - return ERR_INVALID_PARAMETER; - } - - o = ParseCommandList(c, cmd_name, str, args, sizeof(args) / sizeof(args[0])); - if (o == NULL) - { - return ERR_INVALID_PARAMETER; - } - - Zero(&t, sizeof(t)); - // Get the user object - StrCpy(t.HubName, sizeof(t.HubName), ps->HubName); - StrCpy(t.Name, sizeof(t.Name), GetParamStr(o, "[name]")); - - ret = ScGetUser(ps->Rpc, &t); - if (ret != ERR_NO_ERROR) - { - // An error has occured - CmdPrintError(c, ret); - FreeParamValueList(o); - return ret; - } - - // Update the information - FreeAuthData(t.AuthType, t.AuthData); - - { - AUTHPASSWORD *pw; - - pw = NewPasswordAuthData(t.Name, GetParamStr(o, "PASSWORD")); - - // Set to the password authentication - t.AuthType = AUTHTYPE_PASSWORD; - t.AuthData = pw; - } - - // Write the user object - ret = ScSetUser(ps->Rpc, &t); - - if (ret != ERR_NO_ERROR) - { - // An error has occured - CmdPrintError(c, ret); - FreeParamValueList(o); - return ret; - } - - FreeRpcSetUser(&t); - - FreeParamValueList(o); - - return 0; -} - -// Set the authentication method for the user to the specific certificate authentication and set a certificate -UINT PsUserCertSet(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) -{ - LIST *o; - PS *ps = (PS *)param; - UINT ret = 0; - RPC_SET_USER t; - X *x; - // Parameter list that can be specified - PARAM args[] = - { - // "name", prompt_proc, prompt_param, eval_proc, eval_param - {"[name]", CmdPrompt, _UU("CMD_UserCreate_Prompt_NAME"), CmdEvalNotEmpty, NULL}, - {"LOADCERT", CmdPrompt, _UU("CMD_LOADCERTPATH"), CmdEvalIsFile, NULL}, - }; - - // If virtual HUB is not selected, it's an error - if (ps->HubName == NULL) - { - c->Write(c, _UU("CMD_Hub_Not_Selected")); - return ERR_INVALID_PARAMETER; - } - - o = ParseCommandList(c, cmd_name, str, args, sizeof(args) / sizeof(args[0])); - if (o == NULL) - { - return ERR_INVALID_PARAMETER; - } - - // Read the certificate - x = FileToXW(GetParamUniStr(o, "LOADCERT")); - if (x == NULL) - { - c->Write(c, _UU("CMD_LOADCERT_FAILED")); - - FreeParamValueList(o); - - return ERR_INTERNAL_ERROR; - } - - Zero(&t, sizeof(t)); - // Get the user object - StrCpy(t.HubName, sizeof(t.HubName), ps->HubName); - StrCpy(t.Name, sizeof(t.Name), GetParamStr(o, "[name]")); - - ret = ScGetUser(ps->Rpc, &t); - if (ret != ERR_NO_ERROR) - { - // An error has occured - CmdPrintError(c, ret); - FreeParamValueList(o); - FreeX(x); - return ret; - } - - // Update the information - FreeAuthData(t.AuthType, t.AuthData); - - { - AUTHUSERCERT *c; - - c = NewUserCertAuthData(x); - - FreeX(x); - - // Set to the password authentication - t.AuthType = AUTHTYPE_USERCERT; - t.AuthData = c; - } - - // Write the user object - ret = ScSetUser(ps->Rpc, &t); - - if (ret != ERR_NO_ERROR) - { - // An error has occured - CmdPrintError(c, ret); - FreeParamValueList(o); - return ret; - } - - FreeRpcSetUser(&t); - - FreeParamValueList(o); - - return 0; -} - -// Get certificates that are registered in the user which uses certificate authentication -UINT PsUserCertGet(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) -{ - LIST *o; - PS *ps = (PS *)param; - UINT ret = 0; - RPC_SET_USER t; - AUTHUSERCERT *a; - // Parameter list that can be specified - PARAM args[] = - { - // "name", prompt_proc, prompt_param, eval_proc, eval_param - {"[name]", CmdPrompt, _UU("CMD_UserCreate_Prompt_NAME"), CmdEvalNotEmpty, NULL}, - {"SAVECERT", CmdPrompt, _UU("CMD_SAVECERTPATH"), NULL, NULL}, - }; - - // If virtual HUB is not selected, it's an error - if (ps->HubName == NULL) - { - c->Write(c, _UU("CMD_Hub_Not_Selected")); - return ERR_INVALID_PARAMETER; - } - - o = ParseCommandList(c, cmd_name, str, args, sizeof(args) / sizeof(args[0])); - if (o == NULL) - { - return ERR_INVALID_PARAMETER; - } - - Zero(&t, sizeof(t)); - // Get the user object - StrCpy(t.HubName, sizeof(t.HubName), ps->HubName); - StrCpy(t.Name, sizeof(t.Name), GetParamStr(o, "[name]")); - - ret = ScGetUser(ps->Rpc, &t); - if (ret != ERR_NO_ERROR) - { - // An error has occured - CmdPrintError(c, ret); - FreeParamValueList(o); - return ret; - } - - a = (AUTHUSERCERT *)t.AuthData; - - if (t.AuthType != AUTHTYPE_USERCERT || a == NULL || a->UserX == NULL) - { - // The user is not using specific certificate authentication - ret = ERR_INVALID_PARAMETER; - - c->Write(c, _UU("CMD_UserCertGet_Not_Cert")); - } - else - { - if (XToFileW(a->UserX, GetParamUniStr(o, "SAVECERT"), true) == false) - { - c->Write(c, _UU("CMD_SAVECERT_FAILED")); - } - } - - FreeRpcSetUser(&t); - - FreeParamValueList(o); - - return ret; -} - -// Set the authentication method for the user to the signed certificate authentication -UINT PsUserSignedSet(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) -{ - LIST *o; - PS *ps = (PS *)param; - UINT ret = 0; - RPC_SET_USER t; - // Parameter list that can be specified - PARAM args[] = - { - // "name", prompt_proc, prompt_param, eval_proc, eval_param - {"[name]", CmdPrompt, _UU("CMD_UserCreate_Prompt_NAME"), CmdEvalNotEmpty, NULL}, - {"CN", CmdPrompt, _UU("CMD_UserSignedSet_Prompt_CN"), NULL, NULL}, - {"SERIAL", CmdPrompt, _UU("CMD_UserSignedSet_Prompt_SERIAL"), NULL, NULL}, - }; - - // If virtual HUB is not selected, it's an error - if (ps->HubName == NULL) - { - c->Write(c, _UU("CMD_Hub_Not_Selected")); - return ERR_INVALID_PARAMETER; - } - - o = ParseCommandList(c, cmd_name, str, args, sizeof(args) / sizeof(args[0])); - if (o == NULL) - { - return ERR_INVALID_PARAMETER; - } - - Zero(&t, sizeof(t)); - // Get the user object - StrCpy(t.HubName, sizeof(t.HubName), ps->HubName); - StrCpy(t.Name, sizeof(t.Name), GetParamStr(o, "[name]")); - - ret = ScGetUser(ps->Rpc, &t); - if (ret != ERR_NO_ERROR) - { - // An error has occured - CmdPrintError(c, ret); - FreeParamValueList(o); - return ret; - } - - // Update the information - FreeAuthData(t.AuthType, t.AuthData); - - { - AUTHROOTCERT *c; - BUF *b; - X_SERIAL *serial = NULL; - - b = StrToBin(GetParamStr(o, "SERIAL")); - - if (b != NULL && b->Size >= 1) - { - serial = NewXSerial(b->Buf, b->Size); - } - - FreeBuf(b); - - c = NewRootCertAuthData(serial, GetParamUniStr(o, "CN")); - - FreeXSerial(serial); - - // Set to the signed certificate authentication - t.AuthType = AUTHTYPE_ROOTCERT; - t.AuthData = c; - } - - // Write the user object - ret = ScSetUser(ps->Rpc, &t); - - if (ret != ERR_NO_ERROR) - { - // An error has occured - CmdPrintError(c, ret); - FreeParamValueList(o); - return ret; - } - - FreeRpcSetUser(&t); - - FreeParamValueList(o); - - return 0; -} - -// Set the authentication method for the user to the Radius authentication -UINT PsUserRadiusSet(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) -{ - LIST *o; - PS *ps = (PS *)param; - UINT ret = 0; - RPC_SET_USER t; - // Parameter list that can be specified - PARAM args[] = - { - // "name", prompt_proc, prompt_param, eval_proc, eval_param - {"[name]", CmdPrompt, _UU("CMD_UserCreate_Prompt_NAME"), CmdEvalNotEmpty, NULL}, - {"ALIAS", CmdPrompt, _UU("CMD_UserRadiusSet_Prompt_ALIAS"), NULL, NULL}, - }; - - // If virtual HUB is not selected, it's an error - if (ps->HubName == NULL) - { - c->Write(c, _UU("CMD_Hub_Not_Selected")); - return ERR_INVALID_PARAMETER; - } - - o = ParseCommandList(c, cmd_name, str, args, sizeof(args) / sizeof(args[0])); - if (o == NULL) - { - return ERR_INVALID_PARAMETER; - } - - Zero(&t, sizeof(t)); - // Get the user object - StrCpy(t.HubName, sizeof(t.HubName), ps->HubName); - StrCpy(t.Name, sizeof(t.Name), GetParamStr(o, "[name]")); - - ret = ScGetUser(ps->Rpc, &t); - if (ret != ERR_NO_ERROR) - { - // An error has occured - CmdPrintError(c, ret); - FreeParamValueList(o); - return ret; - } - - // Update the information - FreeAuthData(t.AuthType, t.AuthData); - - { - AUTHRADIUS *a; - - a = NewRadiusAuthData(GetParamUniStr(o, "ALIAS")); - - // Set to Radius authentication - t.AuthType = AUTHTYPE_RADIUS; - t.AuthData = a; - } - - // Write the user object - ret = ScSetUser(ps->Rpc, &t); - - if (ret != ERR_NO_ERROR) - { - // An error has occured - CmdPrintError(c, ret); - FreeParamValueList(o); - return ret; - } - - FreeRpcSetUser(&t); - - FreeParamValueList(o); - - return 0; -} - -// Set the authentication method for the user to the NT domain authentication -UINT PsUserNTLMSet(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) -{ - LIST *o; - PS *ps = (PS *)param; - UINT ret = 0; - RPC_SET_USER t; - // Parameter list that can be specified - PARAM args[] = - { - // "name", prompt_proc, prompt_param, eval_proc, eval_param - {"[name]", CmdPrompt, _UU("CMD_UserCreate_Prompt_NAME"), CmdEvalNotEmpty, NULL}, - {"ALIAS", CmdPrompt, _UU("CMD_UserRadiusSet_Prompt_ALIAS"), NULL, NULL}, - }; - - // If virtual HUB is not selected, it's an error - if (ps->HubName == NULL) - { - c->Write(c, _UU("CMD_Hub_Not_Selected")); - return ERR_INVALID_PARAMETER; - } - - o = ParseCommandList(c, cmd_name, str, args, sizeof(args) / sizeof(args[0])); - if (o == NULL) - { - return ERR_INVALID_PARAMETER; - } - - Zero(&t, sizeof(t)); - // Get the user object - StrCpy(t.HubName, sizeof(t.HubName), ps->HubName); - StrCpy(t.Name, sizeof(t.Name), GetParamStr(o, "[name]")); - - ret = ScGetUser(ps->Rpc, &t); - if (ret != ERR_NO_ERROR) - { - // An error has occured - CmdPrintError(c, ret); - FreeParamValueList(o); - return ret; - } - - // Update the information - FreeAuthData(t.AuthType, t.AuthData); - - { - AUTHRADIUS *a; - - a = NewRadiusAuthData(GetParamUniStr(o, "ALIAS")); - - // Set to the NT domain authentication - t.AuthType = AUTHTYPE_NT; - t.AuthData = a; - } - - // Write the user object - ret = ScSetUser(ps->Rpc, &t); - - if (ret != ERR_NO_ERROR) - { - // An error has occured - CmdPrintError(c, ret); - FreeParamValueList(o); - return ret; - } - - FreeRpcSetUser(&t); - - FreeParamValueList(o); - - return 0; -} - -// Delete the security policy of the user -UINT PsUserPolicyRemove(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) -{ - LIST *o; - PS *ps = (PS *)param; - UINT ret = 0; - RPC_SET_USER t; - // Parameter list that can be specified - PARAM args[] = - { - // "name", prompt_proc, prompt_param, eval_proc, eval_param - {"[name]", CmdPrompt, _UU("CMD_UserCreate_Prompt_NAME"), CmdEvalNotEmpty, NULL}, - }; - - // If virtual HUB is not selected, it's an error - if (ps->HubName == NULL) - { - c->Write(c, _UU("CMD_Hub_Not_Selected")); - return ERR_INVALID_PARAMETER; - } - - o = ParseCommandList(c, cmd_name, str, args, sizeof(args) / sizeof(args[0])); - if (o == NULL) - { - return ERR_INVALID_PARAMETER; - } - - Zero(&t, sizeof(t)); - // Get the user object - StrCpy(t.HubName, sizeof(t.HubName), ps->HubName); - StrCpy(t.Name, sizeof(t.Name), GetParamStr(o, "[name]")); - - ret = ScGetUser(ps->Rpc, &t); - if (ret != ERR_NO_ERROR) - { - // An error has occured - CmdPrintError(c, ret); - FreeParamValueList(o); - return ret; - } - - // Update - if (t.Policy != NULL) - { - Free(t.Policy); - t.Policy = NULL; - } - - // Write the user object - ret = ScSetUser(ps->Rpc, &t); - - if (ret != ERR_NO_ERROR) - { - // An error has occured - CmdPrintError(c, ret); - FreeParamValueList(o); - return ret; - } - - FreeRpcSetUser(&t); - - FreeParamValueList(o); - - return 0; -} - -// Set a security policy of the user -UINT PsUserPolicySet(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) -{ - LIST *o; - PS *ps = (PS *)param; - UINT ret = 0; - RPC_SET_USER t; - // Parameter list that can be specified - PARAM args[] = - { - // "name", prompt_proc, prompt_param, eval_proc, eval_param - {"[name]", CmdPrompt, _UU("CMD_UserCreate_Prompt_NAME"), CmdEvalNotEmpty, NULL}, - {"NAME", CmdPrompt, _UU("CMD_CascadePolicySet_PROMPT_POLNAME"), CmdEvalNotEmpty, NULL}, - {"VALUE", CmdPrompt, _UU("CMD_CascadePolicySet_PROMPT_POLVALUE"), CmdEvalNotEmpty, NULL}, - }; - - // If virtual HUB is not selected, it's an error - if (ps->HubName == NULL) - { - c->Write(c, _UU("CMD_Hub_Not_Selected")); - return ERR_INVALID_PARAMETER; - } - - o = ParseCommandList(c, cmd_name, str, args, sizeof(args) / sizeof(args[0])); - if (o == NULL) - { - return ERR_INVALID_PARAMETER; - } - - Zero(&t, sizeof(t)); - // Get the user object - StrCpy(t.HubName, sizeof(t.HubName), ps->HubName); - StrCpy(t.Name, sizeof(t.Name), GetParamStr(o, "[name]")); - - ret = ScGetUser(ps->Rpc, &t); - if (ret != ERR_NO_ERROR) - { - // An error has occured - CmdPrintError(c, ret); - FreeParamValueList(o); - return ret; - } - - // Update - if (t.Policy == NULL) - { - t.Policy = ClonePolicy(GetDefaultPolicy()); - } - - // Edit - if (EditPolicy(c, t.Policy, GetParamStr(o, "NAME"), GetParamStr(o, "VALUE"), false) == false) - { - ret = ERR_INVALID_PARAMETER; - } - else - { - // Write the user object - ret = ScSetUser(ps->Rpc, &t); - - if (ret != ERR_NO_ERROR) - { - // An error has occured - CmdPrintError(c, ret); - FreeParamValueList(o); - return ret; - } - } - - FreeRpcSetUser(&t); - - FreeParamValueList(o); - - return ret; -} - -// Convert the string to a date and time -UINT64 StrToDateTime64(char *str) -{ - UINT64 ret = 0; - TOKEN_LIST *t; - UINT a, b, c, d, e, f; - // Validate arguments - if (str == NULL) - { - return INFINITE; - } - - if (IsEmptyStr(str) || StrCmpi(str, "none") == 0) - { - return 0; - } - - t = ParseToken(str, ":/,. \""); - if (t->NumTokens != 6) - { - FreeToken(t); - return INFINITE; - } - - a = ToInt(t->Token[0]); - b = ToInt(t->Token[1]); - c = ToInt(t->Token[2]); - d = ToInt(t->Token[3]); - e = ToInt(t->Token[4]); - f = ToInt(t->Token[5]); - - ret = INFINITE; - - if (a >= 1000 && a <= 9999 && b >= 1 && b <= 12 && c >= 1 && c <= 31 && - d <= 23 && e <= 59 && f <= 59) - { - SYSTEMTIME t; - - Zero(&t, sizeof(t)); - t.wYear = a; - t.wMonth = b; - t.wDay = c; - t.wHour = d; - t.wMinute = e; - t.wSecond = f; - - ret = SystemToUINT64(&t); - } - - FreeToken(t); - - return ret; -} - -// Evaluate the date and time string -bool CmdEvalDateTime(CONSOLE *c, wchar_t *str, void *param) -{ - UINT64 ret; - char tmp[MAX_SIZE]; - // Validate arguments - if (c == NULL || str == NULL) - { - return false; - } - - UniToStr(tmp, sizeof(tmp), str); - - ret = StrToDateTime64(tmp); - - if (ret == INFINITE) - { - c->Write(c, _UU("CMD_EVAL_DATE_TIME_FAILED")); - return false; - } - - return true; -} - -// Set the expiration date of the user -UINT PsUserExpiresSet(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) -{ - LIST *o; - PS *ps = (PS *)param; - UINT ret = 0; - RPC_SET_USER t; - UINT64 expires; - // Parameter list that can be specified - PARAM args[] = - { - // "name", prompt_proc, prompt_param, eval_proc, eval_param - {"[name]", CmdPrompt, _UU("CMD_UserCreate_Prompt_NAME"), CmdEvalNotEmpty, NULL}, - {"EXPIRES", CmdPrompt, _UU("CMD_UserExpiresSet_Prompt_EXPIRES"), CmdEvalDateTime, NULL}, - }; - - // If virtual HUB is not selected, it's an error - if (ps->HubName == NULL) - { - c->Write(c, _UU("CMD_Hub_Not_Selected")); - return ERR_INVALID_PARAMETER; - } - - o = ParseCommandList(c, cmd_name, str, args, sizeof(args) / sizeof(args[0])); - if (o == NULL) - { - return ERR_INVALID_PARAMETER; - } - - Zero(&t, sizeof(t)); - // Get the user object - StrCpy(t.HubName, sizeof(t.HubName), ps->HubName); - StrCpy(t.Name, sizeof(t.Name), GetParamStr(o, "[name]")); - - ret = ScGetUser(ps->Rpc, &t); - if (ret != ERR_NO_ERROR) - { - // An error has occured - CmdPrintError(c, ret); - FreeParamValueList(o); - return ret; - } - - // Update the information - expires = StrToDateTime64(GetParamStr(o, "EXPIRES")); - - if (expires != 0) - { - expires = LocalToSystem64(expires); - } - - t.ExpireTime = expires; - - // Write the user object - ret = ScSetUser(ps->Rpc, &t); - - if (ret != ERR_NO_ERROR) - { - // An error has occured - CmdPrintError(c, ret); - FreeParamValueList(o); - return ret; - } - - FreeRpcSetUser(&t); - - FreeParamValueList(o); - - return 0; -} - -// Get the group list -UINT PsGroupList(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) -{ - LIST *o; - PS *ps = (PS *)param; - UINT ret = 0; - RPC_ENUM_GROUP t; - - o = ParseCommandList(c, cmd_name, str, NULL, 0); - if (o == NULL) - { - return ERR_INVALID_PARAMETER; - } - - // If virtual HUB is not selected, it's an error - if (ps->HubName == NULL) - { - c->Write(c, _UU("CMD_Hub_Not_Selected")); - return ERR_INVALID_PARAMETER; - } - - Zero(&t, sizeof(t)); - StrCpy(t.HubName, sizeof(t.HubName), ps->HubName); - - // RPC call - ret = ScEnumGroup(ps->Rpc, &t); - - if (ret != ERR_NO_ERROR) - { - // An error has occured - CmdPrintError(c, ret); - FreeParamValueList(o); - return ret; - } - else - { - CT *ct = CtNew(); - UINT i; - - CtInsertColumn(ct, _UU("SM_GROUPLIST_NAME"), false); - CtInsertColumn(ct, _UU("SM_GROUPLIST_REALNAME"), false); - CtInsertColumn(ct, _UU("SM_GROUPLIST_NOTE"), false); - CtInsertColumn(ct, _UU("SM_GROUPLIST_NUMUSERS"), false); - - for (i = 0;i < t.NumGroup;i++) - { - wchar_t tmp1[MAX_SIZE]; - wchar_t tmp2[MAX_SIZE]; - RPC_ENUM_GROUP_ITEM *e = &t.Groups[i]; - - StrToUni(tmp1, sizeof(tmp1), e->Name); - UniToStru(tmp2, e->NumUsers); - - CtInsert(ct, tmp1, e->Realname, e->Note, tmp2); - } - - CtFreeEx(ct, c, true); - } - - FreeRpcEnumGroup(&t); - - FreeParamValueList(o); - - return 0; -} - -// Create a group -UINT PsGroupCreate(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) -{ - LIST *o; - PS *ps = (PS *)param; - UINT ret = 0; - RPC_SET_GROUP t; - // Parameter list that can be specified - PARAM args[] = - { - // "name", prompt_proc, prompt_param, eval_proc, eval_param - {"[name]", CmdPrompt, _UU("CMD_GroupCreate_Prompt_NAME"), CmdEvalNotEmpty, NULL}, - {"REALNAME", CmdPrompt, _UU("CMD_GroupCreate_Prompt_REALNAME"), NULL, NULL}, - {"NOTE", CmdPrompt, _UU("CMD_GroupCreate_Prompt_NOTE"), NULL, NULL}, - }; - - // If virtual HUB is not selected, it's an error - if (ps->HubName == NULL) - { - c->Write(c, _UU("CMD_Hub_Not_Selected")); - return ERR_INVALID_PARAMETER; - } - - o = ParseCommandList(c, cmd_name, str, args, sizeof(args) / sizeof(args[0])); - if (o == NULL) - { - return ERR_INVALID_PARAMETER; - } - - Zero(&t, sizeof(t)); - StrCpy(t.HubName, sizeof(t.HubName), ps->HubName); - StrCpy(t.Name, sizeof(t.Name), GetParamStr(o, "[name]")); - UniStrCpy(t.Realname, sizeof(t.Realname), GetParamUniStr(o, "REALNAME")); - UniStrCpy(t.Note, sizeof(t.Note), GetParamUniStr(o, "NOTE")); - - // RPC call - ret = ScCreateGroup(ps->Rpc, &t); - - if (ret != ERR_NO_ERROR) - { - // An error has occured - CmdPrintError(c, ret); - FreeParamValueList(o); - return ret; - } - - FreeRpcSetGroup(&t); - - FreeParamValueList(o); - - return 0; -} - -// Set the group information -UINT PsGroupSet(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) -{ - LIST *o; - PS *ps = (PS *)param; - UINT ret = 0; - RPC_SET_GROUP t; - // Parameter list that can be specified - PARAM args[] = - { - // "name", prompt_proc, prompt_param, eval_proc, eval_param - {"[name]", CmdPrompt, _UU("CMD_GroupCreate_Prompt_NAME"), CmdEvalNotEmpty, NULL}, - {"REALNAME", CmdPrompt, _UU("CMD_GroupCreate_Prompt_REALNAME"), NULL, NULL}, - {"NOTE", CmdPrompt, _UU("CMD_GroupCreate_Prompt_NOTE"), NULL, NULL}, - }; - - // If virtual HUB is not selected, it's an error - if (ps->HubName == NULL) - { - c->Write(c, _UU("CMD_Hub_Not_Selected")); - return ERR_INVALID_PARAMETER; - } - - o = ParseCommandList(c, cmd_name, str, args, sizeof(args) / sizeof(args[0])); - if (o == NULL) - { - return ERR_INVALID_PARAMETER; - } - - Zero(&t, sizeof(t)); - StrCpy(t.HubName, sizeof(t.HubName), ps->HubName); - StrCpy(t.Name, sizeof(t.Name), GetParamStr(o, "[name]")); - - // RPC call - ret = ScGetGroup(ps->Rpc, &t); - - if (ret != ERR_NO_ERROR) - { - // An error has occured - CmdPrintError(c, ret); - FreeParamValueList(o); - return ret; - } - - // Information update - UniStrCpy(t.Realname, sizeof(t.Realname), GetParamUniStr(o, "REALNAME")); - UniStrCpy(t.Note, sizeof(t.Note), GetParamUniStr(o, "NOTE")); - - // RPC call - ret = ScSetGroup(ps->Rpc, &t); - - if (ret != ERR_NO_ERROR) - { - // An error has occured - CmdPrintError(c, ret); - FreeParamValueList(o); - return ret; - } - - FreeRpcSetGroup(&t); - - FreeParamValueList(o); - - return 0; -} - -// Delete a group -UINT PsGroupDelete(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) -{ - LIST *o; - PS *ps = (PS *)param; - UINT ret = 0; - RPC_DELETE_USER t; - // Parameter list that can be specified - PARAM args[] = - { - // "name", prompt_proc, prompt_param, eval_proc, eval_param - {"[name]", CmdPrompt, _UU("CMD_GroupCreate_Prompt_NAME"), CmdEvalNotEmpty, NULL}, - }; - - // If virtual HUB is not selected, it's an error - if (ps->HubName == NULL) - { - c->Write(c, _UU("CMD_Hub_Not_Selected")); - return ERR_INVALID_PARAMETER; - } - - o = ParseCommandList(c, cmd_name, str, args, sizeof(args) / sizeof(args[0])); - if (o == NULL) - { - return ERR_INVALID_PARAMETER; - } - - Zero(&t, sizeof(t)); - StrCpy(t.HubName, sizeof(t.HubName), ps->HubName); - StrCpy(t.Name, sizeof(t.Name), GetParamStr(o, "[name]")); - - // RPC call - ret = ScDeleteGroup(ps->Rpc, &t); - - if (ret != ERR_NO_ERROR) - { - // An error has occured - CmdPrintError(c, ret); - FreeParamValueList(o); - return ret; - } - - FreeParamValueList(o); - - return 0; -} - -// Get the group information and the list of users who belong to the group -UINT PsGroupGet(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) -{ - LIST *o; - PS *ps = (PS *)param; - UINT ret = 0; - RPC_SET_GROUP t; - // Parameter list that can be specified - PARAM args[] = - { - // "name", prompt_proc, prompt_param, eval_proc, eval_param - {"[name]", CmdPrompt, _UU("CMD_GroupCreate_Prompt_NAME"), CmdEvalNotEmpty, NULL}, - }; - - // If virtual HUB is not selected, it's an error - if (ps->HubName == NULL) - { - c->Write(c, _UU("CMD_Hub_Not_Selected")); - return ERR_INVALID_PARAMETER; - } - - o = ParseCommandList(c, cmd_name, str, args, sizeof(args) / sizeof(args[0])); - if (o == NULL) - { - return ERR_INVALID_PARAMETER; - } - - Zero(&t, sizeof(t)); - StrCpy(t.HubName, sizeof(t.HubName), ps->HubName); - StrCpy(t.Name, sizeof(t.Name), GetParamStr(o, "[name]")); - - // RPC call - ret = ScGetGroup(ps->Rpc, &t); - - if (ret != ERR_NO_ERROR) - { - // An error has occured - CmdPrintError(c, ret); - FreeParamValueList(o); - return ret; - } - else - { - wchar_t tmp[MAX_SIZE]; - char groupname[MAX_USERNAME_LEN + 1]; - CT *ct = CtNewStandard(); - - StrCpy(groupname, sizeof(groupname), t.Name); - - StrToUni(tmp, sizeof(tmp), t.Name); - CtInsert(ct, _UU("CMD_GroupGet_Column_NAME"), tmp); - CtInsert(ct, _UU("CMD_GroupGet_Column_REALNAME"), t.Realname); - CtInsert(ct, _UU("CMD_GroupGet_Column_NOTE"), t.Note); - - CtFree(ct, c); - - if (t.Policy != NULL) - { - c->Write(c, L""); - c->Write(c, _UU("CMD_GroupGet_Column_POLICY")); - - PrintPolicy(c, t.Policy, false); - } - - { - RPC_ENUM_USER t; - bool b = false; - - Zero(&t, sizeof(t)); - - StrCpy(t.HubName, sizeof(t.HubName), ps->HubName); - - if (ScEnumUser(ps->Rpc, &t) == ERR_NO_ERROR) - { - UINT i; - - for (i = 0;i < t.NumUser;i++) - { - RPC_ENUM_USER_ITEM *u = &t.Users[i]; - - if (StrCmpi(u->GroupName, groupname) == 0) - { - if (b == false) - { - b = true; - c->Write(c, L""); - c->Write(c, _UU("CMD_GroupGet_Column_MEMBERS")); - } - - UniFormat(tmp, sizeof(tmp), L" %S", u->Name); - c->Write(c, tmp); - } - } - FreeRpcEnumUser(&t); - - if (b) - { - c->Write(c, L""); - } - } - } - - } - - FreeRpcSetGroup(&t); - - FreeParamValueList(o); - - return 0; -} - -// Add an user to the group -UINT PsGroupJoin(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) -{ - LIST *o; - PS *ps = (PS *)param; - UINT ret = 0; - RPC_SET_USER t; - // Parameter list that can be specified - PARAM args[] = - { - // "name", prompt_proc, prompt_param, eval_proc, eval_param - {"[name]", CmdPrompt, _UU("CMD_GroupCreate_Prompt_NAME"), CmdEvalNotEmpty, NULL}, - {"USERNAME", CmdPrompt, _UU("CMD_GroupJoin_Prompt_USERNAME"), CmdEvalNotEmpty, NULL}, - }; - - // If virtual HUB is not selected, it's an error - if (ps->HubName == NULL) - { - c->Write(c, _UU("CMD_Hub_Not_Selected")); - return ERR_INVALID_PARAMETER; - } - - o = ParseCommandList(c, cmd_name, str, args, sizeof(args) / sizeof(args[0])); - if (o == NULL) - { - return ERR_INVALID_PARAMETER; - } - - Zero(&t, sizeof(t)); - StrCpy(t.HubName, sizeof(t.HubName), ps->HubName); - StrCpy(t.Name, sizeof(t.Name), GetParamStr(o, "USERNAME")); - - // RPC call - ret = ScGetUser(ps->Rpc, &t); - - if (ret != ERR_NO_ERROR) - { - // An error has occured - CmdPrintError(c, ret); - FreeParamValueList(o); - return ret; - } - else - { - // Update the Group - StrCpy(t.GroupName, sizeof(t.GroupName), GetParamStr(o, "[name]")); - - ret = ScSetUser(ps->Rpc, &t); - - if (ret != ERR_NO_ERROR) - { - // An error has occured - CmdPrintError(c, ret); - FreeParamValueList(o); - return ret; - } - } - - FreeRpcSetUser(&t); - - FreeParamValueList(o); - - return 0; -} - -// Delete the user from a group -UINT PsGroupUnjoin(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) -{ - LIST *o; - PS *ps = (PS *)param; - UINT ret = 0; - RPC_SET_USER t; - // Parameter list that can be specified - PARAM args[] = - { - // "name", prompt_proc, prompt_param, eval_proc, eval_param - {"[name]", CmdPrompt, _UU("CMD_GroupUnjoin_Prompt_name"), CmdEvalNotEmpty, NULL}, - }; - - // If virtual HUB is not selected, it's an error - if (ps->HubName == NULL) - { - c->Write(c, _UU("CMD_Hub_Not_Selected")); - return ERR_INVALID_PARAMETER; - } - - o = ParseCommandList(c, cmd_name, str, args, sizeof(args) / sizeof(args[0])); - if (o == NULL) - { - return ERR_INVALID_PARAMETER; - } - - Zero(&t, sizeof(t)); - StrCpy(t.HubName, sizeof(t.HubName), ps->HubName); - StrCpy(t.Name, sizeof(t.Name), GetParamStr(o, "[name]")); - - // RPC call - ret = ScGetUser(ps->Rpc, &t); - - if (ret != ERR_NO_ERROR) - { - // An error has occured - CmdPrintError(c, ret); - FreeParamValueList(o); - return ret; - } - else - { - // Update the Group - StrCpy(t.GroupName, sizeof(t.GroupName), ""); - - ret = ScSetUser(ps->Rpc, &t); - - if (ret != ERR_NO_ERROR) - { - // An error has occured - CmdPrintError(c, ret); - FreeParamValueList(o); - return ret; - } - } - - FreeRpcSetUser(&t); - - FreeParamValueList(o); - - return 0; -} - -// Delete the security policy of the group -UINT PsGroupPolicyRemove(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) -{ - LIST *o; - PS *ps = (PS *)param; - UINT ret = 0; - RPC_SET_GROUP t; - // Parameter list that can be specified - PARAM args[] = - { - // "name", prompt_proc, prompt_param, eval_proc, eval_param - {"[name]", CmdPrompt, _UU("CMD_GroupCreate_Prompt_NAME"), CmdEvalNotEmpty, NULL}, - }; - - // If virtual HUB is not selected, it's an error - if (ps->HubName == NULL) - { - c->Write(c, _UU("CMD_Hub_Not_Selected")); - return ERR_INVALID_PARAMETER; - } - - o = ParseCommandList(c, cmd_name, str, args, sizeof(args) / sizeof(args[0])); - if (o == NULL) - { - return ERR_INVALID_PARAMETER; - } - - Zero(&t, sizeof(t)); - StrCpy(t.HubName, sizeof(t.HubName), ps->HubName); - StrCpy(t.Name, sizeof(t.Name), GetParamStr(o, "[name]")); - - // RPC call - ret = ScGetGroup(ps->Rpc, &t); - - if (ret != ERR_NO_ERROR) - { - // An error has occured - CmdPrintError(c, ret); - FreeParamValueList(o); - return ret; - } - else - { - // Update - if (t.Policy != NULL) - { - Free(t.Policy); - t.Policy = NULL; - } - - ret = ScSetGroup(ps->Rpc, &t); - - if (ret != ERR_NO_ERROR) - { - // An error has occured - CmdPrintError(c, ret); - FreeParamValueList(o); - return ret; - } - } - - FreeRpcSetGroup(&t); - - FreeParamValueList(o); - - return 0; -} - -// Set a security policy to a group -UINT PsGroupPolicySet(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) -{ - LIST *o; - PS *ps = (PS *)param; - UINT ret = 0; - RPC_SET_GROUP t; - // Parameter list that can be specified - PARAM args[] = - { - // "name", prompt_proc, prompt_param, eval_proc, eval_param - {"[name]", CmdPrompt, _UU("CMD_GroupCreate_Prompt_NAME"), CmdEvalNotEmpty, NULL}, - {"NAME", CmdPrompt, _UU("CMD_CascadePolicySet_PROMPT_POLNAME"), CmdEvalNotEmpty, NULL}, - {"VALUE", CmdPrompt, _UU("CMD_CascadePolicySet_PROMPT_POLVALUE"), CmdEvalNotEmpty, NULL}, - }; - - // If virtual HUB is not selected, it's an error - if (ps->HubName == NULL) - { - c->Write(c, _UU("CMD_Hub_Not_Selected")); - return ERR_INVALID_PARAMETER; - } - - o = ParseCommandList(c, cmd_name, str, args, sizeof(args) / sizeof(args[0])); - if (o == NULL) - { - return ERR_INVALID_PARAMETER; - } - - Zero(&t, sizeof(t)); - StrCpy(t.HubName, sizeof(t.HubName), ps->HubName); - StrCpy(t.Name, sizeof(t.Name), GetParamStr(o, "[name]")); - - // RPC call - ret = ScGetGroup(ps->Rpc, &t); - - if (ret != ERR_NO_ERROR) - { - // An error has occured - CmdPrintError(c, ret); - FreeParamValueList(o); - return ret; - } - else - { - // Update - if (t.Policy == NULL) - { - t.Policy = ClonePolicy(GetDefaultPolicy()); - } - - if (EditPolicy(c, t.Policy, GetParamStr(o, "NAME"), GetParamStr(o, "VALUE"), false) == false) - { - // An error has occured - FreeRpcSetGroup(&t); - CmdPrintError(c, ret); - FreeParamValueList(o); - return ERR_INTERNAL_ERROR; - } - - ret = ScSetGroup(ps->Rpc, &t); - - if (ret != ERR_NO_ERROR) - { - // An error has occured - CmdPrintError(c, ret); - FreeParamValueList(o); - return ret; - } - } - - FreeRpcSetGroup(&t); - - FreeParamValueList(o); - - return 0; -} - -// Get the connected session list -UINT PsSessionList(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) -{ - LIST *o; - PS *ps = (PS *)param; - UINT ret = 0; - RPC_ENUM_SESSION t; - UINT server_type = 0; - - o = ParseCommandList(c, cmd_name, str, NULL, 0); - if (o == NULL) - { - return ERR_INVALID_PARAMETER; - } - - // If virtual HUB is not selected, it's an error - if (ps->HubName == NULL) - { - c->Write(c, _UU("CMD_Hub_Not_Selected")); - return ERR_INVALID_PARAMETER; - } - - { - // Get the server type - RPC_SERVER_INFO t; - - Zero(&t, sizeof(t)); - - if (ScGetServerInfo(ps->Rpc, &t) == ERR_NO_ERROR) - { - server_type = t.ServerType; - - FreeRpcServerInfo(&t); - } - } - - Zero(&t, sizeof(t)); - StrCpy(t.HubName, sizeof(t.HubName), ps->HubName); - - // RPC call - ret = ScEnumSession(ps->Rpc, &t); - - if (ret != ERR_NO_ERROR) - { - // An error has occured - CmdPrintError(c, ret); - FreeParamValueList(o); - return ret; - } - else - { - CT *ct = CtNew(); - UINT i; - - CtInsertColumn(ct, _UU("SM_SESS_COLUMN_1"), false); - CtInsertColumn(ct, _UU("SM_SESS_COLUMN_8"), false); - CtInsertColumn(ct, _UU("SM_SESS_COLUMN_2"), false); - CtInsertColumn(ct, _UU("SM_SESS_COLUMN_3"), false); - CtInsertColumn(ct, _UU("SM_SESS_COLUMN_4"), false); - CtInsertColumn(ct, _UU("SM_SESS_COLUMN_5"), true); - CtInsertColumn(ct, _UU("SM_SESS_COLUMN_6"), true); - CtInsertColumn(ct, _UU("SM_SESS_COLUMN_7"), true); - - for (i = 0;i < t.NumSession;i++) - { - RPC_ENUM_SESSION_ITEM *e = &t.Sessions[i]; - wchar_t tmp1[MAX_SIZE]; - wchar_t *tmp2; - wchar_t tmp3[MAX_SIZE]; - wchar_t tmp4[MAX_SIZE]; - wchar_t tmp5[MAX_SIZE]; - wchar_t tmp6[MAX_SIZE]; - wchar_t tmp7[MAX_SIZE]; - wchar_t tmp8[MAX_SIZE]; - bool free_tmp2 = false; - - StrToUni(tmp1, sizeof(tmp1), e->Name); - - tmp2 = _UU("SM_SESS_NORMAL"); - if (server_type != SERVER_TYPE_STANDALONE) - { - if (e->RemoteSession) - { - tmp2 = ZeroMalloc(MAX_SIZE); - UniFormat(tmp2, MAX_SIZE, _UU("SM_SESS_REMOTE"), e->RemoteHostname); - free_tmp2 = true; - } - else - { - if (StrLen(e->RemoteHostname) == 0) - { - tmp2 = _UU("SM_SESS_LOCAL"); - } - else - { - tmp2 = ZeroMalloc(MAX_SIZE); - UniFormat(tmp2, MAX_SIZE, _UU("SM_SESS_LOCAL_2"), e->RemoteHostname); - free_tmp2 = true; - } - } - } - if (e->LinkMode) - { - if (free_tmp2) - { - Free(tmp2); - free_tmp2 = false; - } - tmp2 = _UU("SM_SESS_LINK"); - } - else if (e->SecureNATMode) - { - /*if (free_tmp2) - { - Free(tmp2); - free_tmp2 = false; - }*/ - tmp2 = _UU("SM_SESS_SNAT"); - } - - StrToUni(tmp3, sizeof(tmp3), e->Username); - - StrToUni(tmp4, sizeof(tmp4), e->Hostname); - if (e->LinkMode) - { - UniStrCpy(tmp4, sizeof(tmp4), _UU("SM_SESS_LINK_HOSTNAME")); - } - else if (e->SecureNATMode) - { - UniStrCpy(tmp4, sizeof(tmp4), _UU("SM_SESS_SNAT_HOSTNAME")); - } - else if (e->BridgeMode) - { - UniStrCpy(tmp4, sizeof(tmp4), _UU("SM_SESS_BRIDGE_HOSTNAME")); - } - else if (StartWith(e->Username, L3_USERNAME)) - { - UniStrCpy(tmp4, sizeof(tmp4), _UU("SM_SESS_LAYER3_HOSTNAME")); - } - - UniFormat(tmp5, sizeof(tmp5), L"%u / %u", e->CurrentNumTcp, e->MaxNumTcp); - if (e->LinkMode) - { - UniStrCpy(tmp5, sizeof(tmp5), _UU("SM_SESS_LINK_TCP")); - } - else if (e->SecureNATMode) - { - UniStrCpy(tmp5, sizeof(tmp5), _UU("SM_SESS_SNAT_TCP")); - } - else if (e->BridgeMode) - { - UniStrCpy(tmp5, sizeof(tmp5), _UU("SM_SESS_BRIDGE_TCP")); - } - - UniToStr3(tmp6, sizeof(tmp6), e->PacketSize); - UniToStr3(tmp7, sizeof(tmp7), e->PacketNum); - - if (e->VLanId == 0) - { - UniStrCpy(tmp8, sizeof(tmp8), _UU("CM_ST_NO_VLAN")); - } - else - { - UniToStru(tmp8, e->VLanId); - } - - CtInsert(ct, tmp1, tmp8, tmp2, tmp3, tmp4, tmp5, tmp6, tmp7); - - if (free_tmp2) - { - Free(tmp2); - } - } - - - CtFreeEx(ct, c, true); - } - - FreeRpcEnumSession(&t); - - FreeParamValueList(o); - - return 0; -} - -// Display the NODE_INFO -void CmdPrintNodeInfo(CT *ct, NODE_INFO *info) -{ - wchar_t tmp[MAX_SIZE]; - char str[MAX_SIZE]; - // Validate arguments - if (ct == NULL || info == NULL) - { - return; - } - - StrToUni(tmp, sizeof(tmp), info->ClientProductName); - CtInsert(ct, _UU("SM_NODE_CLIENT_NAME"), tmp); - - UniFormat(tmp, sizeof(tmp), L"%u.%02u", Endian32(info->ClientProductVer) / 100, Endian32(info->ClientProductVer) % 100); - CtInsert(ct, _UU("SM_NODE_CLIENT_VER"), tmp); - - UniFormat(tmp, sizeof(tmp), L"Build %u", Endian32(info->ClientProductBuild)); - CtInsert(ct, _UU("SM_NODE_CLIENT_BUILD"), tmp); - - StrToUni(tmp, sizeof(tmp), info->ClientOsName); - CtInsert(ct, _UU("SM_NODE_CLIENT_OS_NAME"), tmp); - - StrToUni(tmp, sizeof(tmp), info->ClientOsVer); - CtInsert(ct, _UU("SM_NODE_CLIENT_OS_VER"), tmp); - - StrToUni(tmp, sizeof(tmp), info->ClientOsProductId); - CtInsert(ct, _UU("SM_NODE_CLIENT_OS_PID"), tmp); - - StrToUni(tmp, sizeof(tmp), info->ClientHostname); - CtInsert(ct, _UU("SM_NODE_CLIENT_HOST"), tmp); - - IPToStr4or6(str, sizeof(str), info->ClientIpAddress, info->ClientIpAddress6); - StrToUni(tmp, sizeof(tmp), str); - CtInsert(ct, _UU("SM_NODE_CLIENT_IP"), tmp); - - UniToStru(tmp, Endian32(info->ClientPort)); - CtInsert(ct, _UU("SM_NODE_CLIENT_PORT"), tmp); - - StrToUni(tmp, sizeof(tmp), info->ServerHostname); - CtInsert(ct, _UU("SM_NODE_SERVER_HOST"), tmp); - - IPToStr4or6(str, sizeof(str), info->ServerIpAddress, info->ServerIpAddress6); - StrToUni(tmp, sizeof(tmp), str); - CtInsert(ct, _UU("SM_NODE_SERVER_IP"), tmp); - - UniToStru(tmp, Endian32(info->ServerPort)); - CtInsert(ct, _UU("SM_NODE_SERVER_PORT"), tmp); - - if (StrLen(info->ProxyHostname) != 0) - { - StrToUni(tmp, sizeof(tmp), info->ProxyHostname); - CtInsert(ct, _UU("SM_NODE_PROXY_HOSTNAME"), tmp); - - IPToStr4or6(str, sizeof(str), info->ProxyIpAddress, info->ProxyIpAddress6); - StrToUni(tmp, sizeof(tmp), str); - CtInsert(ct, _UU("SM_NODE_PROXY_IP"), tmp); - - UniToStru(tmp, Endian32(info->ProxyPort)); - CtInsert(ct, _UU("SM_NODE_PROXY_PORT"), tmp); - } -} - -// Get the session information -UINT PsSessionGet(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) -{ - LIST *o; - PS *ps = (PS *)param; - UINT ret = 0; - RPC_SESSION_STATUS t; - // Parameter list that can be specified - PARAM args[] = - { - // "name", prompt_proc, prompt_param, eval_proc, eval_param - {"[name]", CmdPrompt, _UU("CMD_SessionGet_Prompt_NAME"), CmdEvalNotEmpty, NULL}, - }; - - // If virtual HUB is not selected, it's an error - if (ps->HubName == NULL) - { - c->Write(c, _UU("CMD_Hub_Not_Selected")); - return ERR_INVALID_PARAMETER; - } - - o = ParseCommandList(c, cmd_name, str, args, sizeof(args) / sizeof(args[0])); - if (o == NULL) - { - return ERR_INVALID_PARAMETER; - } - - Zero(&t, sizeof(t)); - StrCpy(t.HubName, sizeof(t.HubName), ps->HubName); - StrCpy(t.Name, sizeof(t.Name), GetParamStr(o, "[name]")); - - // RPC call - ret = ScGetSessionStatus(ps->Rpc, &t); - - if (ret != ERR_NO_ERROR) - { - // An error has occured - CmdPrintError(c, ret); - FreeParamValueList(o); - return ret; - } - else - { - wchar_t tmp[MAX_SIZE]; - char str[MAX_SIZE]; - CT *ct = CtNewStandard(); - - if (t.ClientIp != 0) - { - IPToStr4or6(str, sizeof(str), t.ClientIp, t.ClientIp6); - StrToUni(tmp, sizeof(tmp), str); - CtInsert(ct, _UU("SM_CLIENT_IP"), tmp); - } - - if (StrLen(t.ClientHostName) != 0) - { - StrToUni(tmp, sizeof(tmp), t.ClientHostName); - CtInsert(ct, _UU("SM_CLIENT_HOSTNAME"), tmp); - } - - StrToUni(tmp, sizeof(tmp), t.Username); - CtInsert(ct, _UU("SM_SESS_STATUS_USERNAME"), tmp); - - if (StrCmpi(t.Username, LINK_USER_NAME_PRINT) != 0 && StrCmpi(t.Username, SNAT_USER_NAME_PRINT) != 0 && StrCmpi(t.Username, BRIDGE_USER_NAME_PRINT) != 0) - { - StrToUni(tmp, sizeof(tmp), t.RealUsername); - CtInsert(ct, _UU("SM_SESS_STATUS_REALUSER"), tmp); - } - - if (IsEmptyStr(t.GroupName) == false) - { - StrToUni(tmp, sizeof(tmp), t.GroupName); - CtInsert(ct, _UU("SM_SESS_STATUS_GROUPNAME"), tmp); - } - - - CmdPrintStatusToListViewEx(ct, &t.Status, true); - - if (StrCmpi(t.Username, LINK_USER_NAME_PRINT) != 0 && StrCmpi(t.Username, SNAT_USER_NAME_PRINT) != 0 && StrCmpi(t.Username, BRIDGE_USER_NAME_PRINT) != 0 && - StartWith(t.Username, L3_USERNAME) == false) - { - CmdPrintNodeInfo(ct, &t.NodeInfo); - } - - CtFree(ct, c); - } - - FreeRpcSessionStatus(&t); - - FreeParamValueList(o); - - return 0; -} - -// Disconnect the session -UINT PsSessionDisconnect(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) -{ - LIST *o; - PS *ps = (PS *)param; - UINT ret = 0; - RPC_DELETE_SESSION t; - // Parameter list that can be specified - PARAM args[] = - { - // "name", prompt_proc, prompt_param, eval_proc, eval_param - {"[name]", CmdPrompt, _UU("CMD_SessionGet_Prompt_NAME"), CmdEvalNotEmpty, NULL}, - }; - - // If virtual HUB is not selected, it's an error - if (ps->HubName == NULL) - { - c->Write(c, _UU("CMD_Hub_Not_Selected")); - return ERR_INVALID_PARAMETER; - } - - o = ParseCommandList(c, cmd_name, str, args, sizeof(args) / sizeof(args[0])); - if (o == NULL) - { - return ERR_INVALID_PARAMETER; - } - - Zero(&t, sizeof(t)); - StrCpy(t.HubName, sizeof(t.HubName), ps->HubName); - StrCpy(t.Name, sizeof(t.Name), GetParamStr(o, "[name]")); - - // RPC call - ret = ScDeleteSession(ps->Rpc, &t); - - if (ret != ERR_NO_ERROR) - { - // An error has occured - CmdPrintError(c, ret); - FreeParamValueList(o); - return ret; - } - - FreeParamValueList(o); - - return 0; -} - -// Get the MAC address table database -UINT PsMacTable(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) -{ - LIST *o; - PS *ps = (PS *)param; - UINT ret = 0; - RPC_ENUM_MAC_TABLE t; - UINT i; - - // Parameter list that can be specified - PARAM args[] = - { - // "name", prompt_proc, prompt_param, eval_proc, eval_param - {"[session_name]", NULL, NULL, NULL, NULL,} - }; - - // If virtual HUB is not selected, it's an error - if (ps->HubName == NULL) - { - c->Write(c, _UU("CMD_Hub_Not_Selected")); - return ERR_INVALID_PARAMETER; - } - - o = ParseCommandList(c, cmd_name, str, args, sizeof(args) / sizeof(args[0])); - if (o == NULL) - { - return ERR_INVALID_PARAMETER; - } - - Zero(&t, sizeof(t)); - StrCpy(t.HubName, sizeof(t.HubName), ps->HubName); - - // RPC call - ret = ScEnumMacTable(ps->Rpc, &t); - - if (ret != ERR_NO_ERROR) - { - // An error has occured - CmdPrintError(c, ret); - FreeParamValueList(o); - return ret; - } - else - { - CT *ct = CtNew(); - char *session_name = GetParamStr(o, "[session_name]"); - - if (IsEmptyStr(session_name)) - { - session_name = NULL; - } - - CtInsertColumn(ct, _UU("CMD_ID"), false); - CtInsertColumn(ct, _UU("SM_MAC_COLUMN_1"), false); - CtInsertColumn(ct, _UU("SM_MAC_COLUMN_1A"), false); - CtInsertColumn(ct, _UU("SM_MAC_COLUMN_2"), false); - CtInsertColumn(ct, _UU("SM_MAC_COLUMN_3"), false); - CtInsertColumn(ct, _UU("SM_MAC_COLUMN_4"), false); - CtInsertColumn(ct, _UU("SM_MAC_COLUMN_5"), false); - - for (i = 0;i < t.NumMacTable;i++) - { - char str[MAX_SIZE]; - wchar_t tmp0[128]; - wchar_t tmp1[MAX_SIZE]; - wchar_t tmp2[MAX_SIZE]; - wchar_t tmp3[MAX_SIZE]; - wchar_t tmp4[MAX_SIZE]; - wchar_t tmp5[MAX_SIZE]; - wchar_t tmp6[MAX_SIZE]; - - RPC_ENUM_MAC_TABLE_ITEM *e = &t.MacTables[i]; - - if (session_name == NULL || StrCmpi(e->SessionName, session_name) == 0) - { - UniToStru(tmp0, e->Key); - - StrToUni(tmp1, sizeof(tmp1), e->SessionName); - - MacToStr(str, sizeof(str), e->MacAddress); - StrToUni(tmp2, sizeof(tmp2), str); - - GetDateTimeStr64Uni(tmp3, sizeof(tmp3), SystemToLocal64(e->CreatedTime)); - - GetDateTimeStr64Uni(tmp4, sizeof(tmp4), SystemToLocal64(e->UpdatedTime)); - - if (StrLen(e->RemoteHostname) == 0) - { - UniStrCpy(tmp5, sizeof(tmp5), _UU("SM_MACIP_LOCAL")); - } - else - { - UniFormat(tmp5, sizeof(tmp5), _UU("SM_MACIP_SERVER"), e->RemoteHostname); - } - - UniToStru(tmp6, e->VlanId); - if (e->VlanId == 0) - { - UniStrCpy(tmp6, sizeof(tmp6), _UU("CM_ST_NONE")); - } - - CtInsert(ct, - tmp0, tmp1, tmp6, tmp2, tmp3, tmp4, tmp5); - } - } - - CtFreeEx(ct, c, true); - } - - FreeRpcEnumMacTable(&t); - - FreeParamValueList(o); - - return 0; -} - -// Delete a MAC address table entry -UINT PsMacDelete(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) -{ - LIST *o; - PS *ps = (PS *)param; - UINT ret = 0; - RPC_DELETE_TABLE t; - // Parameter list that can be specified - PARAM args[] = - { - // "name", prompt_proc, prompt_param, eval_proc, eval_param - {"[id]", CmdPrompt, _UU("CMD_MacDelete_Prompt"), CmdEvalNotEmpty, NULL}, - }; - - // If virtual HUB is not selected, it's an error - if (ps->HubName == NULL) - { - c->Write(c, _UU("CMD_Hub_Not_Selected")); - return ERR_INVALID_PARAMETER; - } - - o = ParseCommandList(c, cmd_name, str, args, sizeof(args) / sizeof(args[0])); - if (o == NULL) - { - return ERR_INVALID_PARAMETER; - } - - Zero(&t, sizeof(t)); - StrCpy(t.HubName, sizeof(t.HubName), ps->HubName); - t.Key = GetParamInt(o, "[id]"); - - // RPC call - ret = ScDeleteMacTable(ps->Rpc, &t); - - if (ret != ERR_NO_ERROR) - { - // An error has occured - CmdPrintError(c, ret); - FreeParamValueList(o); - return ret; - } - - FreeParamValueList(o); - - return 0; -} - -// Get the IP address table database -UINT PsIpTable(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) -{ - LIST *o; - PS *ps = (PS *)param; - UINT ret = 0; - RPC_ENUM_IP_TABLE t; - UINT i; - - // Parameter list that can be specified - PARAM args[] = - { - // "name", prompt_proc, prompt_param, eval_proc, eval_param - {"[session_name]", NULL, NULL, NULL, NULL,} - }; - - // If virtual HUB is not selected, it's an error - if (ps->HubName == NULL) - { - c->Write(c, _UU("CMD_Hub_Not_Selected")); - return ERR_INVALID_PARAMETER; - } - - o = ParseCommandList(c, cmd_name, str, args, sizeof(args) / sizeof(args[0])); - if (o == NULL) - { - return ERR_INVALID_PARAMETER; - } - - Zero(&t, sizeof(t)); - StrCpy(t.HubName, sizeof(t.HubName), ps->HubName); - - // RPC call - ret = ScEnumIpTable(ps->Rpc, &t); - - if (ret != ERR_NO_ERROR) - { - // An error has occured - CmdPrintError(c, ret); - FreeParamValueList(o); - return ret; - } - else - { - CT *ct = CtNew(); - char *session_name = GetParamStr(o, "[session_name]"); - - if (IsEmptyStr(session_name)) - { - session_name = NULL; - } - - CtInsertColumn(ct, _UU("CMD_ID"), false); - CtInsertColumn(ct, _UU("SM_IP_COLUMN_1"), false); - CtInsertColumn(ct, _UU("SM_IP_COLUMN_2"), false); - CtInsertColumn(ct, _UU("SM_IP_COLUMN_3"), false); - CtInsertColumn(ct, _UU("SM_IP_COLUMN_4"), false); - CtInsertColumn(ct, _UU("SM_IP_COLUMN_5"), false); - - for (i = 0;i < t.NumIpTable;i++) - { - char str[MAX_SIZE]; - wchar_t tmp0[128]; - wchar_t tmp1[MAX_SIZE]; - wchar_t tmp2[MAX_SIZE]; - wchar_t tmp3[MAX_SIZE]; - wchar_t tmp4[MAX_SIZE]; - wchar_t tmp5[MAX_SIZE]; - RPC_ENUM_IP_TABLE_ITEM *e = &t.IpTables[i]; - - if (session_name == NULL || StrCmpi(e->SessionName, session_name) == 0) - { - UniToStru(tmp0, e->Key); - - StrToUni(tmp1, sizeof(tmp1), e->SessionName); - - if (e->DhcpAllocated == false) - { - IPToStr(str, sizeof(str), &e->IpV6); - StrToUni(tmp2, sizeof(tmp2), str); - } - else - { - IPToStr(str, sizeof(str), &e->IpV6); - UniFormat(tmp2, sizeof(tmp2), _UU("SM_MAC_IP_DHCP"), str); - } - - GetDateTimeStr64Uni(tmp3, sizeof(tmp3), SystemToLocal64(e->CreatedTime)); - - GetDateTimeStr64Uni(tmp4, sizeof(tmp4), SystemToLocal64(e->UpdatedTime)); - - if (StrLen(e->RemoteHostname) == 0) - { - UniStrCpy(tmp5, sizeof(tmp5), _UU("SM_MACIP_LOCAL")); - } - else - { - UniFormat(tmp5, sizeof(tmp5), _UU("SM_MACIP_SERVER"), e->RemoteHostname); - } - - CtInsert(ct, - tmp0, tmp1, tmp2, tmp3, tmp4, tmp5); - } - } - - CtFreeEx(ct, c, true); - } - - FreeRpcEnumIpTable(&t); - - FreeParamValueList(o); - - return 0; -} - -// Delete the IP address table entry -UINT PsIpDelete(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) -{ - LIST *o; - PS *ps = (PS *)param; - UINT ret = 0; - RPC_DELETE_TABLE t; - // Parameter list that can be specified - PARAM args[] = - { - // "name", prompt_proc, prompt_param, eval_proc, eval_param - {"[id]", CmdPrompt, _UU("CMD_MacDelete_Prompt"), CmdEvalNotEmpty, NULL}, - }; - - // If virtual HUB is not selected, it's an error - if (ps->HubName == NULL) - { - c->Write(c, _UU("CMD_Hub_Not_Selected")); - return ERR_INVALID_PARAMETER; - } - - o = ParseCommandList(c, cmd_name, str, args, sizeof(args) / sizeof(args[0])); - if (o == NULL) - { - return ERR_INVALID_PARAMETER; - } - - Zero(&t, sizeof(t)); - StrCpy(t.HubName, sizeof(t.HubName), ps->HubName); - t.Key = GetParamInt(o, "[id]"); - - // RPC call - ret = ScDeleteIpTable(ps->Rpc, &t); - - if (ret != ERR_NO_ERROR) - { - // An error has occured - CmdPrintError(c, ret); - FreeParamValueList(o); - return ret; - } - - FreeParamValueList(o); - - return 0; -} - -// Enable the DHCP server function and the virtual NAT (SecureNAT function) -UINT PsSecureNatEnable(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) -{ - LIST *o; - PS *ps = (PS *)param; - UINT ret = 0; - RPC_HUB t; - - // If virtual HUB is not selected, it's an error - if (ps->HubName == NULL) - { - c->Write(c, _UU("CMD_Hub_Not_Selected")); - return ERR_INVALID_PARAMETER; - } - - o = ParseCommandList(c, cmd_name, str, NULL, 0); - if (o == NULL) - { - return ERR_INVALID_PARAMETER; - } - - Zero(&t, sizeof(t)); - StrCpy(t.HubName, sizeof(t.HubName), ps->HubName); - - // RPC call - ret = ScEnableSecureNAT(ps->Rpc, &t); - - if (ret != ERR_NO_ERROR) - { - // An error has occured - CmdPrintError(c, ret); - FreeParamValueList(o); - return ret; - } - - FreeParamValueList(o); - - return 0; -} - -// Disable the DHCP server function and the virtual NAT (SecureNAT function) -UINT PsSecureNatDisable(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) -{ - LIST *o; - PS *ps = (PS *)param; - UINT ret = 0; - RPC_HUB t; - - // If virtual HUB is not selected, it's an error - if (ps->HubName == NULL) - { - c->Write(c, _UU("CMD_Hub_Not_Selected")); - return ERR_INVALID_PARAMETER; - } - - o = ParseCommandList(c, cmd_name, str, NULL, 0); - if (o == NULL) - { - return ERR_INVALID_PARAMETER; - } - - Zero(&t, sizeof(t)); - StrCpy(t.HubName, sizeof(t.HubName), ps->HubName); - - // RPC call - ret = ScDisableSecureNAT(ps->Rpc, &t); - - if (ret != ERR_NO_ERROR) - { - // An error has occured - CmdPrintError(c, ret); - FreeParamValueList(o); - return ret; - } - - FreeParamValueList(o); - - return 0; -} - -// Get the operating status of the DHCP server function and the virtual NAT (SecureNAT function) -UINT PsSecureNatStatusGet(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) -{ - LIST *o; - PS *ps = (PS *)param; - UINT ret = 0; - RPC_NAT_STATUS t; - - // If virtual HUB is not selected, it's an error - if (ps->HubName == NULL) - { - c->Write(c, _UU("CMD_Hub_Not_Selected")); - return ERR_INVALID_PARAMETER; - } - - o = ParseCommandList(c, cmd_name, str, NULL, 0); - if (o == NULL) - { - return ERR_INVALID_PARAMETER; - } - - Zero(&t, sizeof(t)); - StrCpy(t.HubName, sizeof(t.HubName), ps->HubName); - - // RPC call - ret = ScGetSecureNATStatus(ps->Rpc, &t); - - if (ret != ERR_NO_ERROR) - { - // An error has occured - CmdPrintError(c, ret); - FreeParamValueList(o); - return ret; - } - else - { - wchar_t tmp[MAX_SIZE]; - CT *ct = CtNewStandard(); - - StrToUni(tmp, sizeof(tmp), ps->HubName); - CtInsert(ct, _UU("SM_HUB_COLUMN_1"), tmp); - - UniFormat(tmp, sizeof(tmp), _UU("SM_SNAT_NUM_SESSION"), t.NumTcpSessions); - CtInsert(ct, _UU("NM_STATUS_TCP"), tmp); - - UniFormat(tmp, sizeof(tmp), _UU("SM_SNAT_NUM_SESSION"), t.NumUdpSessions); - CtInsert(ct, _UU("NM_STATUS_UDP"), tmp); - - UniFormat(tmp, sizeof(tmp), _UU("SM_SNAT_NUM_SESSION"), t.NumIcmpSessions); - CtInsert(ct, _UU("NM_STATUS_ICMP"), tmp); - - UniFormat(tmp, sizeof(tmp), _UU("SM_SNAT_NUM_SESSION"), t.NumDnsSessions); - CtInsert(ct, _UU("NM_STATUS_DNS"), tmp); - - UniFormat(tmp, sizeof(tmp), _UU("SM_SNAT_NUM_CLIENT"), t.NumDhcpClients); - CtInsert(ct, _UU("NM_STATUS_DHCP"), tmp); - - CtInsert(ct, _UU("SM_SNAT_IS_KERNEL"), t.IsKernelMode ? _UU("SEC_YES") : _UU("SEC_NO")); - CtInsert(ct, _UU("SM_SNAT_IS_RAW"), t.IsRawIpMode ? _UU("SEC_YES") : _UU("SEC_NO")); - - CtFree(ct, c); - } - - FreeRpcNatStatus(&t); - - FreeParamValueList(o); - - return 0; -} - -// Get the network interface settings for a virtual host of SecureNAT function -UINT PsSecureNatHostGet(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) -{ - LIST *o; - PS *ps = (PS *)param; - UINT ret = 0; - VH_OPTION t; - - // If virtual HUB is not selected, it's an error - if (ps->HubName == NULL) - { - c->Write(c, _UU("CMD_Hub_Not_Selected")); - return ERR_INVALID_PARAMETER; - } - - o = ParseCommandList(c, cmd_name, str, NULL, 0); - if (o == NULL) - { - return ERR_INVALID_PARAMETER; - } - - Zero(&t, sizeof(t)); - StrCpy(t.HubName, sizeof(t.HubName), ps->HubName); - - // RPC call - ret = ScGetSecureNATOption(ps->Rpc, &t); - - if (ret != ERR_NO_ERROR) - { - // An error has occured - CmdPrintError(c, ret); - FreeParamValueList(o); - return ret; - } - else - { - wchar_t tmp[MAX_SIZE]; - char str[MAX_SIZE]; - CT *ct = CtNewStandard(); - - // Flags - // MAC Address - MacToStr(str, sizeof(str), t.MacAddress); - StrToUni(tmp, sizeof(tmp), str); - CtInsert(ct, _UU("CMD_SecureNatHostGet_Column_MAC"), tmp); - - // IP address - IPToUniStr(tmp, sizeof(tmp), &t.Ip); - CtInsert(ct, _UU("CMD_SecureNatHostGet_Column_IP"), tmp); - - // Subnet mask - IPToUniStr(tmp, sizeof(tmp), &t.Mask); - CtInsert(ct, _UU("CMD_SecureNatHostGet_Column_MASK"), tmp); - - CtFree(ct, c); - } - - FreeParamValueList(o); - - return 0; -} - -// Change the network interface settings for a virtual host of SecureNAT function -UINT PsSecureNatHostSet(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) -{ - LIST *o; - PS *ps = (PS *)param; - UINT ret = 0; - VH_OPTION t; - // Parameter list that can be specified - PARAM args[] = - { - // "name", prompt_proc, prompt_param, eval_proc, eval_param - {"MAC", CmdPrompt, _UU("CMD_SecureNatHostSet_Prompt_MAC"), NULL, NULL}, - {"IP", CmdPrompt, _UU("CMD_SecureNatHostSet_Prompt_IP"), CmdEvalIp, NULL}, - {"MASK", CmdPrompt, _UU("CMD_SecureNatHostSet_Prompt_MASK"), CmdEvalIp, NULL}, - }; - - // If virtual HUB is not selected, it's an error - if (ps->HubName == NULL) - { - c->Write(c, _UU("CMD_Hub_Not_Selected")); - return ERR_INVALID_PARAMETER; - } - - o = ParseCommandList(c, cmd_name, str, args, sizeof(args) / sizeof(args[0])); - if (o == NULL) - { - return ERR_INVALID_PARAMETER; - } - - Zero(&t, sizeof(t)); - StrCpy(t.HubName, sizeof(t.HubName), ps->HubName); - - // RPC call - ret = ScGetSecureNATOption(ps->Rpc, &t); - - if (ret != ERR_NO_ERROR) - { - // An error has occured - CmdPrintError(c, ret); - FreeParamValueList(o); - return ret; - } - else - { - char *mac, *ip, *mask; - bool ok = true; - - StrCpy(t.HubName, sizeof(t.HubName), ps->HubName); - - mac = GetParamStr(o, "MAC"); - ip = GetParamStr(o, "IP"); - mask = GetParamStr(o, "MASK"); - - if (IsEmptyStr(mac) == false) - { - BUF *b = StrToBin(mac); - - if (b == NULL || b->Size != 6) - { - ok = false; - } - else - { - Copy(t.MacAddress, b->Buf, 6); - } - - FreeBuf(b); - } - - if (IsEmptyStr(ip) == false) - { - if (IsIpStr4(ip) == false) - { - ok = false; - } - else - { - UINT u = StrToIP32(ip); - - if (u == 0 || u == 0xffffffff) - { - ok = false; - } - else - { - UINTToIP(&t.Ip, u); - } - } - } - - if (IsEmptyStr(mask) == false) - { - if (IsIpStr4(mask) == false) - { - ok = false; - } - else - { - StrToIP(&t.Mask, mask); - } - } - - if (ok == false) - { - // Parameter is invalid - ret = ERR_INVALID_PARAMETER; - CmdPrintError(c, ret); - FreeParamValueList(o); - return ret; - } - else - { - ret = ScSetSecureNATOption(ps->Rpc, &t); - - if (ret != ERR_NO_ERROR) - { - // An error has occured - CmdPrintError(c, ret); - FreeParamValueList(o); - return ret; - } - } - } - - FreeParamValueList(o); - - return 0; -} - -// Get the settings for the virtual NAT function of the SecureNAT function -UINT PsNatGet(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) -{ - LIST *o; - PS *ps = (PS *)param; - UINT ret = 0; - VH_OPTION t; - - // If virtual HUB is not selected, it's an error - if (ps->HubName == NULL) - { - c->Write(c, _UU("CMD_Hub_Not_Selected")); - return ERR_INVALID_PARAMETER; - } - - o = ParseCommandList(c, cmd_name, str, NULL, 0); - if (o == NULL) - { - return ERR_INVALID_PARAMETER; - } - - Zero(&t, sizeof(t)); - StrCpy(t.HubName, sizeof(t.HubName), ps->HubName); - - // RPC call - ret = ScGetSecureNATOption(ps->Rpc, &t); - - if (ret != ERR_NO_ERROR) - { - // An error has occured - CmdPrintError(c, ret); - FreeParamValueList(o); - return ret; - } - else - { - wchar_t tmp[MAX_SIZE]; - CT *ct = CtNewStandard(); - - // Use the virtual NAT function - CtInsert(ct, _UU("CMD_NatGet_Column_USE"), t.UseNat ? _UU("SEC_YES") : _UU("SEC_NO")); - - // MTU value - UniToStru(tmp, t.Mtu); - CtInsert(ct, _UU("CMD_NetGet_Column_MTU"), tmp); - - // TCP session timeout (in seconds) - UniToStru(tmp, t.NatTcpTimeout); - CtInsert(ct, _UU("CMD_NatGet_Column_TCP"), tmp); - - // UDP session timeout (in seconds) - UniToStru(tmp, t.NatUdpTimeout); - CtInsert(ct, _UU("CMD_NatGet_Column_UDP"), tmp); - - // To save the log - CtInsert(ct, _UU("CMD_SecureNatHostGet_Column_LOG"), t.SaveLog ? _UU("SEC_YES") : _UU("SEC_NO")); - - CtFree(ct, c); - } - - FreeParamValueList(o); - - return 0; -} - -// Enable the virtual NAT function of the SecureNAT function -UINT PsNatEnable(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) -{ - LIST *o; - PS *ps = (PS *)param; - UINT ret = 0; - VH_OPTION t; - - // If virtual HUB is not selected, it's an error - if (ps->HubName == NULL) - { - c->Write(c, _UU("CMD_Hub_Not_Selected")); - return ERR_INVALID_PARAMETER; - } - - o = ParseCommandList(c, cmd_name, str, NULL, 0); - if (o == NULL) - { - return ERR_INVALID_PARAMETER; - } - - Zero(&t, sizeof(t)); - StrCpy(t.HubName, sizeof(t.HubName), ps->HubName); - - // RPC call - ret = ScGetSecureNATOption(ps->Rpc, &t); - - if (ret != ERR_NO_ERROR) - { - // An error has occured - CmdPrintError(c, ret); - FreeParamValueList(o); - return ret; - } - else - { - t.UseNat = true; - - StrCpy(t.HubName, sizeof(t.HubName), ps->HubName); - ret = ScSetSecureNATOption(ps->Rpc, &t); - - if (ret != ERR_NO_ERROR) - { - // An error has occured - CmdPrintError(c, ret); - FreeParamValueList(o); - return ret; - } - } - - FreeParamValueList(o); - - return 0; -} - -// Disable the virtual NAT function of the SecureNAT function -UINT PsNatDisable(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) -{ - LIST *o; - PS *ps = (PS *)param; - UINT ret = 0; - VH_OPTION t; - - // If virtual HUB is not selected, it's an error - if (ps->HubName == NULL) - { - c->Write(c, _UU("CMD_Hub_Not_Selected")); - return ERR_INVALID_PARAMETER; - } - - o = ParseCommandList(c, cmd_name, str, NULL, 0); - if (o == NULL) - { - return ERR_INVALID_PARAMETER; - } - - Zero(&t, sizeof(t)); - StrCpy(t.HubName, sizeof(t.HubName), ps->HubName); - - // RPC call - ret = ScGetSecureNATOption(ps->Rpc, &t); - - if (ret != ERR_NO_ERROR) - { - // An error has occured - CmdPrintError(c, ret); - FreeParamValueList(o); - return ret; - } - else - { - t.UseNat = false; - - StrCpy(t.HubName, sizeof(t.HubName), ps->HubName); - ret = ScSetSecureNATOption(ps->Rpc, &t); - - if (ret != ERR_NO_ERROR) - { - // An error has occured - CmdPrintError(c, ret); - FreeParamValueList(o); - return ret; - } - } - - FreeParamValueList(o); - - return 0; -} - -// Change the settings for the virtual NAT function of the SecureNAT function -UINT PsNatSet(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) -{ - LIST *o; - PS *ps = (PS *)param; - UINT ret = 0; - VH_OPTION t; - // Parameter list that can be specified - CMD_EVAL_MIN_MAX mtu_mm = - { - "CMD_NatSet_Eval_MTU", TCP_HEADER_SIZE + IP_HEADER_SIZE + MAC_HEADER_SIZE + 8, MAX_L3_DATA_SIZE, - }; - CMD_EVAL_MIN_MAX tcp_mm = - { - "CMD_NatSet_Eval_TCP", NAT_TCP_MIN_TIMEOUT / 1000, NAT_TCP_MAX_TIMEOUT / 1000, - }; - CMD_EVAL_MIN_MAX udp_mm = - { - "CMD_NatSet_Eval_UDP", NAT_UDP_MIN_TIMEOUT / 1000, NAT_UDP_MAX_TIMEOUT / 1000, - }; - PARAM args[] = - { - // "name", prompt_proc, prompt_param, eval_proc, eval_param - {"MTU", CmdPrompt, _UU("CMD_NatSet_Prompt_MTU"), CmdEvalMinMax, &mtu_mm}, - {"TCPTIMEOUT", CmdPrompt, _UU("CMD_NatSet_Prompt_TCPTIMEOUT"), CmdEvalMinMax, &tcp_mm}, - {"UDPTIMEOUT", CmdPrompt, _UU("CMD_NatSet_Prompt_UDPTIMEOUT"), CmdEvalMinMax, &udp_mm}, - {"LOG", CmdPrompt, _UU("CMD_NatSet_Prompt_LOG"), CmdEvalNotEmpty, NULL}, - }; - - // If virtual HUB is not selected, it's an error - if (ps->HubName == NULL) - { - c->Write(c, _UU("CMD_Hub_Not_Selected")); - return ERR_INVALID_PARAMETER; - } - - o = ParseCommandList(c, cmd_name, str, args, sizeof(args) / sizeof(args[0])); - if (o == NULL) - { - return ERR_INVALID_PARAMETER; - } - - Zero(&t, sizeof(t)); - StrCpy(t.HubName, sizeof(t.HubName), ps->HubName); - - // RPC call - ret = ScGetSecureNATOption(ps->Rpc, &t); - - if (ret != ERR_NO_ERROR) - { - // An error has occured - CmdPrintError(c, ret); - FreeParamValueList(o); - return ret; - } - else - { - t.Mtu = GetParamInt(o, "MTU"); - t.NatTcpTimeout = GetParamInt(o, "TCPTIMEOUT"); - t.NatUdpTimeout = GetParamInt(o, "UDPTIMEOUT"); - t.SaveLog = GetParamYes(o, "LOG"); - - StrCpy(t.HubName, sizeof(t.HubName), ps->HubName); - ret = ScSetSecureNATOption(ps->Rpc, &t); - - if (ret != ERR_NO_ERROR) - { - // An error has occured - CmdPrintError(c, ret); - FreeParamValueList(o); - return ret; - } - } - - FreeParamValueList(o); - - return 0; -} - -// Get the session table of the virtual NAT function of the SecureNAT function -UINT PsNatTable(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) -{ - LIST *o; - PS *ps = (PS *)param; - UINT ret = 0; - RPC_ENUM_NAT t; - - // If virtual HUB is not selected, it's an error - if (ps->HubName == NULL) - { - c->Write(c, _UU("CMD_Hub_Not_Selected")); - return ERR_INVALID_PARAMETER; - } - - o = ParseCommandList(c, cmd_name, str, NULL, 0); - if (o == NULL) - { - return ERR_INVALID_PARAMETER; - } - - Zero(&t, sizeof(t)); - StrCpy(t.HubName, sizeof(t.HubName), ps->HubName); - - // RPC call - ret = ScEnumNAT(ps->Rpc, &t); - - if (ret != ERR_NO_ERROR) - { - // An error has occured - CmdPrintError(c, ret); - FreeParamValueList(o); - return ret; - } - else - { - CT *ct = CtNew(); - UINT i; - - CtInsertColumn(ct, _UU("NM_NAT_ID"), false); - CtInsertColumn(ct, _UU("NM_NAT_PROTOCOL"), false); - CtInsertColumn(ct, _UU("NM_NAT_SRC_HOST"), false); - CtInsertColumn(ct, _UU("NM_NAT_SRC_PORT"), false); - CtInsertColumn(ct, _UU("NM_NAT_DST_HOST"), false); - CtInsertColumn(ct, _UU("NM_NAT_DST_PORT"), false); - CtInsertColumn(ct, _UU("NM_NAT_CREATED"), false); - CtInsertColumn(ct, _UU("NM_NAT_LAST_COMM"), false); - CtInsertColumn(ct, _UU("NM_NAT_SIZE"), false); - CtInsertColumn(ct, _UU("NM_NAT_TCP_STATUS"), false); - - for (i = 0;i < t.NumItem;i++) - { - RPC_ENUM_NAT_ITEM *e = &t.Items[i]; - wchar_t tmp0[MAX_SIZE]; - wchar_t *tmp1 = L""; - wchar_t tmp2[MAX_SIZE]; - wchar_t tmp3[MAX_SIZE]; - wchar_t tmp4[MAX_SIZE]; - wchar_t tmp5[MAX_SIZE]; - wchar_t tmp6[MAX_SIZE]; - wchar_t tmp7[MAX_SIZE]; - wchar_t tmp8[MAX_SIZE]; - wchar_t *tmp9 = L""; - char v1[128], v2[128]; - - // ID - UniToStru(tmp0, e->Id); - - // Protocol - switch (e->Protocol) - { - case NAT_TCP: - tmp1 = _UU("NM_NAT_PROTO_TCP"); - break; - case NAT_UDP: - tmp1 = _UU("NM_NAT_PROTO_UDP"); - break; - case NAT_DNS: - tmp1 = _UU("NM_NAT_PROTO_DNS"); - break; - case NAT_ICMP: - tmp1 = _UU("NM_NAT_PROTO_ICMP"); - break; - } - - // Source host - StrToUni(tmp2, sizeof(tmp2), e->SrcHost); - - // Source port - UniToStru(tmp3, e->SrcPort); - - // Destination host - StrToUni(tmp4, sizeof(tmp4), e->DestHost); - - // Destination port - UniToStru(tmp5, e->DestPort); - - // Creation date and time of the session - GetDateTimeStrEx64(tmp6, sizeof(tmp6), SystemToLocal64(e->CreatedTime), NULL); - - // Last communication date and time - GetDateTimeStrEx64(tmp7, sizeof(tmp7), SystemToLocal64(e->LastCommTime), NULL); - - // Communication amount - ToStr3(v1, sizeof(v1), e->RecvSize); - ToStr3(v2, sizeof(v2), e->SendSize); - UniFormat(tmp8, sizeof(tmp8), L"%S / %S", v1, v2); - - // TCP state - if (e->Protocol == NAT_TCP) - { - switch (e->TcpStatus) - { - case NAT_TCP_CONNECTING: - tmp9 = _UU("NAT_TCP_CONNECTING"); - break; - case NAT_TCP_SEND_RESET: - tmp9 = _UU("NAT_TCP_SEND_RESET"); - break; - case NAT_TCP_CONNECTED: - tmp9 = _UU("NAT_TCP_CONNECTED"); - break; - case NAT_TCP_ESTABLISHED: - tmp9 = _UU("NAT_TCP_ESTABLISHED"); - break; - case NAT_TCP_WAIT_DISCONNECT: - tmp9 = _UU("NAT_TCP_WAIT_DISCONNECT"); - break; - } - } - - CtInsert(ct, - tmp0, tmp1, tmp2, tmp3, tmp4, tmp5, tmp6, tmp7, tmp8, tmp9); - } - - CtFreeEx(ct, c, true); - } - - FreeRpcEnumNat(&t); - - FreeParamValueList(o); - - return 0; -} - -// Get the settings for a virtual DHCP server function of the SecureNAT function -UINT PsDhcpGet(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) -{ - LIST *o; - PS *ps = (PS *)param; - UINT ret = 0; - VH_OPTION t; - - // If virtual HUB is not selected, it's an error - if (ps->HubName == NULL) - { - c->Write(c, _UU("CMD_Hub_Not_Selected")); - return ERR_INVALID_PARAMETER; - } - - o = ParseCommandList(c, cmd_name, str, NULL, 0); - if (o == NULL) - { - return ERR_INVALID_PARAMETER; - } - - Zero(&t, sizeof(t)); - StrCpy(t.HubName, sizeof(t.HubName), ps->HubName); - - // RPC call - ret = ScGetSecureNATOption(ps->Rpc, &t); - - if (ret != ERR_NO_ERROR) - { - // An error has occured - CmdPrintError(c, ret); - FreeParamValueList(o); - return ret; - } - else - { - wchar_t tmp[MAX_SIZE]; - CT *ct = CtNewStandard(); - - // To use the virtual DHCP function - CtInsert(ct, _UU("CMD_DhcpGet_Column_USE"), t.UseDhcp ? _UU("SEC_YES") : _UU("SEC_NO")); - - // Start address of the distributing address zone - IPToUniStr(tmp, sizeof(tmp), &t.DhcpLeaseIPStart); - CtInsert(ct, _UU("CMD_DhcpGet_Column_IP1"), tmp); - - // End address of the distributing address zone - IPToUniStr(tmp, sizeof(tmp), &t.DhcpLeaseIPEnd); - CtInsert(ct, _UU("CMD_DhcpGet_Column_IP2"), tmp); - - // Subnet mask - IPToUniStr(tmp, sizeof(tmp), &t.DhcpSubnetMask); - CtInsert(ct, _UU("CMD_DhcpGet_Column_MASK"), tmp); - - // Lease time (in seconds) - UniToStru(tmp, t.DhcpExpireTimeSpan); - CtInsert(ct, _UU("CMD_DhcpGet_Column_LEASE"), tmp); - - // Default gateway address - UniStrCpy(tmp, sizeof(tmp), _UU("SEC_NONE")); - if (IPToUINT(&t.DhcpGatewayAddress) != 0) - { - IPToUniStr(tmp, sizeof(tmp), &t.DhcpGatewayAddress); - } - CtInsert(ct, _UU("CMD_DhcpGet_Column_GW"), tmp); - - // DNS server address 1 - UniStrCpy(tmp, sizeof(tmp), _UU("SEC_NONE")); - if (IPToUINT(&t.DhcpDnsServerAddress) != 0) - { - IPToUniStr(tmp, sizeof(tmp), &t.DhcpDnsServerAddress); - } - CtInsert(ct, _UU("CMD_DhcpGet_Column_DNS"), tmp); - - // DNS server address 2 - UniStrCpy(tmp, sizeof(tmp), _UU("SEC_NONE")); - if (IPToUINT(&t.DhcpDnsServerAddress2) != 0) - { - IPToUniStr(tmp, sizeof(tmp), &t.DhcpDnsServerAddress2); - } - CtInsert(ct, _UU("CMD_DhcpGet_Column_DNS2"), tmp); - - // Domain name - StrToUni(tmp, sizeof(tmp), t.DhcpDomainName); - CtInsert(ct, _UU("CMD_DhcpGet_Column_DOMAIN"), tmp); - - // To save the log - CtInsert(ct, _UU("CMD_SecureNatHostGet_Column_LOG"), t.SaveLog ? _UU("SEC_YES") : _UU("SEC_NO")); - - // Push routing table - if (t.ApplyDhcpPushRoutes) - { - StrToUni(tmp, sizeof(tmp), t.DhcpPushRoutes); - CtInsert(ct, _UU("CMD_DhcpGet_Column_PUSHROUTE"), tmp); - } - - CtFree(ct, c); - } - - FreeParamValueList(o); - - return 0; -} - -// Enable the Virtual DHCP server function of SecureNAT function -UINT PsDhcpEnable(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) -{ - LIST *o; - PS *ps = (PS *)param; - UINT ret = 0; - VH_OPTION t; - - // If virtual HUB is not selected, it's an error - if (ps->HubName == NULL) - { - c->Write(c, _UU("CMD_Hub_Not_Selected")); - return ERR_INVALID_PARAMETER; - } - - o = ParseCommandList(c, cmd_name, str, NULL, 0); - if (o == NULL) - { - return ERR_INVALID_PARAMETER; - } - - Zero(&t, sizeof(t)); - StrCpy(t.HubName, sizeof(t.HubName), ps->HubName); - - // RPC call - ret = ScGetSecureNATOption(ps->Rpc, &t); - - if (ret != ERR_NO_ERROR) - { - // An error has occured - CmdPrintError(c, ret); - FreeParamValueList(o); - return ret; - } - else - { - t.UseDhcp = true; - - StrCpy(t.HubName, sizeof(t.HubName), ps->HubName); - ret = ScSetSecureNATOption(ps->Rpc, &t); - - if (ret != ERR_NO_ERROR) - { - // An error has occured - CmdPrintError(c, ret); - FreeParamValueList(o); - return ret; - } - } - - FreeParamValueList(o); - - return 0; -} - -// Disable the virtual DHCP server function of SecureNAT function -UINT PsDhcpDisable(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) -{ - LIST *o; - PS *ps = (PS *)param; - UINT ret = 0; - VH_OPTION t; - - // If virtual HUB is not selected, it's an error - if (ps->HubName == NULL) - { - c->Write(c, _UU("CMD_Hub_Not_Selected")); - return ERR_INVALID_PARAMETER; - } - - o = ParseCommandList(c, cmd_name, str, NULL, 0); - if (o == NULL) - { - return ERR_INVALID_PARAMETER; - } - - Zero(&t, sizeof(t)); - StrCpy(t.HubName, sizeof(t.HubName), ps->HubName); - - // RPC call - ret = ScGetSecureNATOption(ps->Rpc, &t); - - if (ret != ERR_NO_ERROR) - { - // An error has occured - CmdPrintError(c, ret); - FreeParamValueList(o); - return ret; - } - else - { - t.UseDhcp = false; - - ret = ScSetSecureNATOption(ps->Rpc, &t); - - if (ret != ERR_NO_ERROR) - { - // An error has occured - CmdPrintError(c, ret); - FreeParamValueList(o); - return ret; - } - } - - FreeParamValueList(o); - - return 0; -} - -// Change the settings for a virtual DHCP server function of the SecureNAT function -UINT PsDhcpSet(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) -{ - LIST *o; - PS *ps = (PS *)param; - UINT ret = 0; - VH_OPTION t; - // Parameter list that can be specified - CMD_EVAL_MIN_MAX mm = - { - "CMD_NatSet_Eval_UDP", NAT_UDP_MIN_TIMEOUT / 1000, NAT_UDP_MAX_TIMEOUT / 1000, - }; - PARAM args[] = - { - // "name", prompt_proc, prompt_param, eval_proc, eval_param - {"START", CmdPrompt, _UU("CMD_DhcpSet_Prompt_START"), CmdEvalIp, NULL}, - {"END", CmdPrompt, _UU("CMD_DhcpSet_Prompt_END"), CmdEvalIp, NULL}, - {"MASK", CmdPrompt, _UU("CMD_DhcpSet_Prompt_MASK"), CmdEvalIp, NULL}, - {"EXPIRE", CmdPrompt, _UU("CMD_DhcpSet_Prompt_EXPIRE"), CmdEvalMinMax, &mm}, - {"GW", CmdPrompt, _UU("CMD_DhcpSet_Prompt_GW"), CmdEvalIp, NULL}, - {"DNS", CmdPrompt, _UU("CMD_DhcpSet_Prompt_DNS"), CmdEvalIp, NULL}, - {"DNS2", CmdPrompt, _UU("CMD_DhcpSet_Prompt_DNS2"), CmdEvalIp, NULL}, - {"DOMAIN", CmdPrompt, _UU("CMD_DhcpSet_Prompt_DOMAIN"), NULL, NULL}, - {"LOG", CmdPrompt, _UU("CMD_NatSet_Prompt_LOG"), CmdEvalNotEmpty, NULL}, - {"PUSHROUTE", NULL, _UU("CMD_DhcpSet_PUSHROUTE"), NULL, NULL}, - }; - - // If virtual HUB is not selected, it's an error - if (ps->HubName == NULL) - { - c->Write(c, _UU("CMD_Hub_Not_Selected")); - return ERR_INVALID_PARAMETER; - } - - o = ParseCommandList(c, cmd_name, str, args, sizeof(args) / sizeof(args[0])); - if (o == NULL) - { - return ERR_INVALID_PARAMETER; - } - - Zero(&t, sizeof(t)); - StrCpy(t.HubName, sizeof(t.HubName), ps->HubName); - - // RPC call - ret = ScGetSecureNATOption(ps->Rpc, &t); - - if (ret != ERR_NO_ERROR) - { - // An error has occured - CmdPrintError(c, ret); - FreeParamValueList(o); - return ret; - } - else - { - - StrToIP(&t.DhcpLeaseIPStart, GetParamStr(o, "START")); - StrToIP(&t.DhcpLeaseIPEnd, GetParamStr(o, "END")); - StrToIP(&t.DhcpSubnetMask, GetParamStr(o, "MASK")); - t.DhcpExpireTimeSpan = GetParamInt(o, "EXPIRE"); - StrToIP(&t.DhcpGatewayAddress, GetParamStr(o, "GW")); - StrToIP(&t.DhcpDnsServerAddress, GetParamStr(o, "DNS")); - StrToIP(&t.DhcpDnsServerAddress2, GetParamStr(o, "DNS2")); - StrCpy(t.DhcpDomainName, sizeof(t.DhcpDomainName), GetParamStr(o, "DOMAIN")); - t.SaveLog = GetParamYes(o, "LOG"); - - StrCpy(t.DhcpPushRoutes, sizeof(t.DhcpPushRoutes), GetParamStr(o, "PUSHROUTE")); - t.ApplyDhcpPushRoutes = true; - - StrCpy(t.HubName, sizeof(t.HubName), ps->HubName); - ret = ScSetSecureNATOption(ps->Rpc, &t); - - if (ret != ERR_NO_ERROR) - { - // An error has occured - CmdPrintError(c, ret); - FreeParamValueList(o); - return ret; - } - - if (IsEmptyStr(GetParamStr(o, "PUSHROUTE")) == false) - { - if (GetCapsBool(ps->CapsList, "b_suppport_push_route") == false && - GetCapsBool(ps->CapsList, "b_suppport_push_route_config")) - { - CmdPrintError(c, ERR_NOT_SUPPORTED_FUNCTION_ON_OPENSOURCE); - } - } - } - - FreeParamValueList(o); - - return 0; -} - -// Get the lease table of virtual DHCP server function of the SecureNAT function -UINT PsDhcpTable(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) -{ - LIST *o; - PS *ps = (PS *)param; - UINT ret = 0; - RPC_ENUM_DHCP t; - - // If virtual HUB is not selected, it's an error - if (ps->HubName == NULL) - { - c->Write(c, _UU("CMD_Hub_Not_Selected")); - return ERR_INVALID_PARAMETER; - } - - o = ParseCommandList(c, cmd_name, str, NULL, 0); - if (o == NULL) - { - return ERR_INVALID_PARAMETER; - } - - Zero(&t, sizeof(t)); - StrCpy(t.HubName, sizeof(t.HubName), ps->HubName); - - // RPC call - ret = ScEnumDHCP(ps->Rpc, &t); - - if (ret != ERR_NO_ERROR) - { - // An error has occured - CmdPrintError(c, ret); - FreeParamValueList(o); - return ret; - } - else - { - CT *ct = CtNew(); - UINT i; - - CtInsertColumn(ct, _UU("DHCP_DHCP_ID"), false); - CtInsertColumn(ct, _UU("DHCP_LEASED_TIME"), false); - CtInsertColumn(ct, _UU("DHCP_EXPIRE_TIME"), false); - CtInsertColumn(ct, _UU("DHCP_MAC_ADDRESS"), false); - CtInsertColumn(ct, _UU("DHCP_IP_ADDRESS"), false); - CtInsertColumn(ct, _UU("DHCP_HOSTNAME"), false); - - for (i = 0;i < t.NumItem;i++) - { - RPC_ENUM_DHCP_ITEM *e = &t.Items[i]; - wchar_t tmp0[MAX_SIZE]; - wchar_t tmp1[MAX_SIZE]; - wchar_t tmp2[MAX_SIZE]; - wchar_t tmp3[MAX_SIZE]; - wchar_t tmp4[MAX_SIZE]; - wchar_t tmp5[MAX_SIZE]; - char str[MAX_SIZE]; - - // ID - UniToStru(tmp0, e->Id); - - // Time - GetDateTimeStrEx64(tmp1, sizeof(tmp1), SystemToLocal64(e->LeasedTime), NULL); - GetDateTimeStrEx64(tmp2, sizeof(tmp2), SystemToLocal64(e->ExpireTime), NULL); - - MacToStr(str, sizeof(str), e->MacAddress); - StrToUni(tmp3, sizeof(tmp3), str); - - IPToStr32(str, sizeof(str), e->IpAddress); - StrToUni(tmp4, sizeof(tmp4), str); - - StrToUni(tmp5, sizeof(tmp5), e->Hostname); - - CtInsert(ct, - tmp0, tmp1, tmp2, tmp3, tmp4, tmp5); - } - - CtFreeEx(ct, c, true); - } - - FreeRpcEnumDhcp(&t); - - FreeParamValueList(o); - - return 0; -} - -// Get the list of Virtual HUB management options -UINT PsAdminOptionList(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) -{ - LIST *o; - PS *ps = (PS *)param; - UINT ret = 0; - RPC_ADMIN_OPTION t; - - // If virtual HUB is not selected, it's an error - if (ps->HubName == NULL) - { - c->Write(c, _UU("CMD_Hub_Not_Selected")); - return ERR_INVALID_PARAMETER; - } - - o = ParseCommandList(c, cmd_name, str, NULL, 0); - if (o == NULL) - { - return ERR_INVALID_PARAMETER; - } - - Zero(&t, sizeof(t)); - StrCpy(t.HubName, sizeof(t.HubName), ps->HubName); - - // RPC call - ret = ScGetHubAdminOptions(ps->Rpc, &t); - - if (ret != ERR_NO_ERROR) - { - // An error has occured - CmdPrintError(c, ret); - FreeParamValueList(o); - return ret; - } - else - { - CT *ct = CtNewStandardEx(); - UINT i; - - for (i = 0;i < t.NumItem;i++) - { - ADMIN_OPTION *e = &t.Items[i]; - wchar_t tmp1[MAX_SIZE]; - wchar_t tmp2[MAX_SIZE]; - - StrToUni(tmp1, sizeof(tmp1), e->Name); - UniToStru(tmp2, e->Value); - - CtInsert(ct, tmp1, tmp2, GetHubAdminOptionHelpString(e->Name)); - - } - - CtFreeEx(ct, c, true); - } - - FreeRpcAdminOption(&t); - - FreeParamValueList(o); - - return 0; -} - -// Set the value of a Virtual HUB management option -UINT PsAdminOptionSet(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) -{ - LIST *o; - PS *ps = (PS *)param; - UINT ret = 0; - RPC_ADMIN_OPTION t; - // Parameter list that can be specified - PARAM args[] = - { - // "name", prompt_proc, prompt_param, eval_proc, eval_param - {"[name]", CmdPrompt, _UU("CMD_AdminOptionSet_Prompt_name"), CmdEvalNotEmpty, NULL}, - {"VALUE", CmdPrompt, _UU("CMD_AdminOptionSet_Prompt_VALUE"), CmdEvalNotEmpty, NULL}, - }; - - // If virtual HUB is not selected, it's an error - if (ps->HubName == NULL) - { - c->Write(c, _UU("CMD_Hub_Not_Selected")); - return ERR_INVALID_PARAMETER; - } - - o = ParseCommandList(c, cmd_name, str, args, sizeof(args) / sizeof(args[0])); - if (o == NULL) - { - return ERR_INVALID_PARAMETER; - } - - Zero(&t, sizeof(t)); - StrCpy(t.HubName, sizeof(t.HubName), ps->HubName); - - // RPC call - ret = ScGetHubAdminOptions(ps->Rpc, &t); - - if (ret != ERR_NO_ERROR) - { - // An error has occured - CmdPrintError(c, ret); - FreeParamValueList(o); - return ret; - } - else - { - UINT i; - bool b = false; - - for (i = 0;i < t.NumItem;i++) - { - if (StrCmpi(t.Items[i].Name, GetParamStr(o, "[name]")) == 0) - { - t.Items[i].Value = GetParamInt(o, "VALUE"); - b = true; - } - } - - if (b == false) - { - // An error has occured - ret = ERR_OBJECT_NOT_FOUND; - CmdPrintError(c, ret); - FreeParamValueList(o); - FreeRpcAdminOption(&t); - return ret; - } - else - { - StrCpy(t.HubName, sizeof(t.HubName), ps->HubName); - ret = ScSetHubAdminOptions(ps->Rpc, &t); - - if (ret != ERR_NO_ERROR) - { - // An error has occured - CmdPrintError(c, ret); - FreeParamValueList(o); - return ret; - } - } - } - - FreeRpcAdminOption(&t); - - FreeParamValueList(o); - - return 0; -} - -// Get the list of Virtual HUB extended options -UINT PsExtOptionList(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) -{ - LIST *o; - PS *ps = (PS *)param; - UINT ret = 0; - RPC_ADMIN_OPTION t; - - // If virtual HUB is not selected, it's an error - if (ps->HubName == NULL) - { - c->Write(c, _UU("CMD_Hub_Not_Selected")); - return ERR_INVALID_PARAMETER; - } - - o = ParseCommandList(c, cmd_name, str, NULL, 0); - if (o == NULL) - { - return ERR_INVALID_PARAMETER; - } - - Zero(&t, sizeof(t)); - StrCpy(t.HubName, sizeof(t.HubName), ps->HubName); - - // RPC call - ret = ScGetHubExtOptions(ps->Rpc, &t); - - if (ret != ERR_NO_ERROR) - { - // An error has occured - CmdPrintError(c, ret); - FreeParamValueList(o); - return ret; - } - else - { - CT *ct = CtNewStandardEx(); - UINT i; - - for (i = 0;i < t.NumItem;i++) - { - ADMIN_OPTION *e = &t.Items[i]; - wchar_t tmp1[MAX_SIZE]; - wchar_t tmp2[MAX_SIZE]; - - StrToUni(tmp1, sizeof(tmp1), e->Name); - UniToStru(tmp2, e->Value); - - CtInsert(ct, tmp1, tmp2, GetHubAdminOptionHelpString(e->Name)); - - } - - CtFreeEx(ct, c, true); - } - - FreeRpcAdminOption(&t); - - FreeParamValueList(o); - - return 0; -} - -// Set the value of a Virtual HUB extended option -UINT PsExtOptionSet(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) -{ - LIST *o; - PS *ps = (PS *)param; - UINT ret = 0; - RPC_ADMIN_OPTION t; - // Parameter list that can be specified - PARAM args[] = - { - // "name", prompt_proc, prompt_param, eval_proc, eval_param - {"[name]", CmdPrompt, _UU("CMD_AdminOptionSet_Prompt_name"), CmdEvalNotEmpty, NULL}, - {"VALUE", CmdPrompt, _UU("CMD_AdminOptionSet_Prompt_VALUE"), CmdEvalNotEmpty, NULL}, - }; - - // If virtual HUB is not selected, it's an error - if (ps->HubName == NULL) - { - c->Write(c, _UU("CMD_Hub_Not_Selected")); - return ERR_INVALID_PARAMETER; - } - - o = ParseCommandList(c, cmd_name, str, args, sizeof(args) / sizeof(args[0])); - if (o == NULL) - { - return ERR_INVALID_PARAMETER; - } - - Zero(&t, sizeof(t)); - StrCpy(t.HubName, sizeof(t.HubName), ps->HubName); - - // RPC call - ret = ScGetHubExtOptions(ps->Rpc, &t); - - if (ret != ERR_NO_ERROR) - { - // An error has occured - CmdPrintError(c, ret); - FreeParamValueList(o); - return ret; - } - else - { - UINT i; - bool b = false; - - for (i = 0;i < t.NumItem;i++) - { - if (StrCmpi(t.Items[i].Name, GetParamStr(o, "[name]")) == 0) - { - t.Items[i].Value = GetParamInt(o, "VALUE"); - b = true; - } - } - - if (b == false) - { - // An error has occured - ret = ERR_OBJECT_NOT_FOUND; - CmdPrintError(c, ret); - FreeParamValueList(o); - FreeRpcAdminOption(&t); - return ret; - } - else - { - StrCpy(t.HubName, sizeof(t.HubName), ps->HubName); - ret = ScSetHubExtOptions(ps->Rpc, &t); - - if (ret != ERR_NO_ERROR) - { - // An error has occured - CmdPrintError(c, ret); - FreeParamValueList(o); - return ret; - } - } - } - - FreeRpcAdminOption(&t); - - FreeParamValueList(o); - - return 0; -} - -// Get the list of revoked certificate list -UINT PsCrlList(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) -{ - LIST *o; - PS *ps = (PS *)param; - UINT ret = 0; - RPC_ENUM_CRL t; - - // If virtual HUB is not selected, it's an error - if (ps->HubName == NULL) - { - c->Write(c, _UU("CMD_Hub_Not_Selected")); - return ERR_INVALID_PARAMETER; - } - - o = ParseCommandList(c, cmd_name, str, NULL, 0); - if (o == NULL) - { - return ERR_INVALID_PARAMETER; - } - - Zero(&t, sizeof(t)); - StrCpy(t.HubName, sizeof(t.HubName), ps->HubName); - - // RPC call - ret = ScEnumCrl(ps->Rpc, &t); - - if (ret != ERR_NO_ERROR) - { - // An error has occured - CmdPrintError(c, ret); - FreeParamValueList(o); - return ret; - } - else - { - UINT i; - CT *ct = CtNew(); - - CtInsertColumn(ct, _UU("CMD_ID"), false); - CtInsertColumn(ct, _UU("SM_CRL_COLUMN_1"), false); - - for (i = 0;i < t.NumItem;i++) - { - wchar_t tmp[64]; - RPC_ENUM_CRL_ITEM *e = &t.Items[i]; - - UniToStru(tmp, e->Key); - CtInsert(ct, tmp, e->CrlInfo); - } - - CtFreeEx(ct, c, true); - } - - FreeRpcEnumCrl(&t); - - FreeParamValueList(o); - - return 0; -} - -// Add a revoked certificate -UINT PsCrlAdd(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) -{ - LIST *o; - PS *ps = (PS *)param; - UINT ret = 0; - RPC_CRL t; - // Parameter list that can be specified - PARAM args[] = - { - {"SERIAL", NULL, NULL, NULL, NULL}, - {"MD5", NULL, NULL, NULL, NULL}, - {"SHA1", NULL, NULL, NULL, NULL}, - {"CN", NULL, NULL, NULL, NULL}, - {"O", NULL, NULL, NULL, NULL}, - {"OU", NULL, NULL, NULL, NULL}, - {"C", NULL, NULL, NULL, NULL}, - {"ST", NULL, NULL, NULL, NULL}, - {"L", NULL, NULL, NULL, NULL}, - }; - - // If virtual HUB is not selected, it's an error - if (ps->HubName == NULL) - { - c->Write(c, _UU("CMD_Hub_Not_Selected")); - return ERR_INVALID_PARAMETER; - } - - o = ParseCommandList(c, cmd_name, str, args, sizeof(args) / sizeof(args[0])); - if (o == NULL) - { - return ERR_INVALID_PARAMETER; - } - - Zero(&t, sizeof(t)); - StrCpy(t.HubName, sizeof(t.HubName), ps->HubName); - - { - bool param_exists = false; - CRL *crl = ZeroMalloc(sizeof(CRL)); - NAME *n; - n = crl->Name = ZeroMalloc(sizeof(NAME)); - - if (IsEmptyStr(GetParamStr(o, "CN")) == false) - { - n->CommonName = CopyUniStr(GetParamUniStr(o, "CN")); - param_exists = true; - } - - if (IsEmptyStr(GetParamStr(o, "O")) == false) - { - n->CommonName = CopyUniStr(GetParamUniStr(o, "O")); - param_exists = true; - } - - if (IsEmptyStr(GetParamStr(o, "OU")) == false) - { - n->CommonName = CopyUniStr(GetParamUniStr(o, "OU")); - param_exists = true; - } - - if (IsEmptyStr(GetParamStr(o, "C")) == false) - { - n->CommonName = CopyUniStr(GetParamUniStr(o, "C")); - param_exists = true; - } - - if (IsEmptyStr(GetParamStr(o, "ST")) == false) - { - n->CommonName = CopyUniStr(GetParamUniStr(o, "ST")); - param_exists = true; - } - - if (IsEmptyStr(GetParamStr(o, "L")) == false) - { - n->CommonName = CopyUniStr(GetParamUniStr(o, "L")); - param_exists = true; - } - - if (IsEmptyStr(GetParamStr(o, "SERIAL")) == false) - { - BUF *b; - - b = StrToBin(GetParamStr(o, "SERIAL")); - - if (b != NULL && b->Size >= 1) - { - crl->Serial = NewXSerial(b->Buf, b->Size); - param_exists = true; - } - - FreeBuf(b); - } - - if (IsEmptyStr(GetParamStr(o, "MD5")) == false) - { - BUF *b; - - b = StrToBin(GetParamStr(o, "MD5")); - - if (b != NULL && b->Size == MD5_SIZE) - { - Copy(crl->DigestMD5, b->Buf, MD5_SIZE); - param_exists = true; - } - - FreeBuf(b); - } - - if (IsEmptyStr(GetParamStr(o, "SHA1")) == false) - { - BUF *b; - - b = StrToBin(GetParamStr(o, "SHA1")); - - if (b != NULL && b->Size == SHA1_SIZE) - { - Copy(crl->DigestSHA1, b->Buf, SHA1_SIZE); - param_exists = true; - } - - FreeBuf(b); - } - - t.Crl = crl; - - if (param_exists == false) - { - FreeRpcCrl(&t); - ret = ERR_INVALID_PARAMETER; - CmdPrintError(c, ret); - FreeParamValueList(o); - return ret; - } - } - - // RPC call - ret = ScAddCrl(ps->Rpc, &t); - - if (ret != ERR_NO_ERROR) - { - // An error has occured - CmdPrintError(c, ret); - FreeParamValueList(o); - return ret; - } - - FreeRpcCrl(&t); - - FreeParamValueList(o); - - return 0; -} - -// Delete the revoked certificate -UINT PsCrlDel(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) -{ - LIST *o; - PS *ps = (PS *)param; - UINT ret = 0; - RPC_CRL t; - // Parameter list that can be specified - PARAM args[] = - { - // "name", prompt_proc, prompt_param, eval_proc, eval_param - {"[id]", CmdPrompt, _UU("CMD_CrlDel_Prompt_ID"), CmdEvalNotEmpty, NULL}, - }; - - // If virtual HUB is not selected, it's an error - if (ps->HubName == NULL) - { - c->Write(c, _UU("CMD_Hub_Not_Selected")); - return ERR_INVALID_PARAMETER; - } - - o = ParseCommandList(c, cmd_name, str, args, sizeof(args) / sizeof(args[0])); - if (o == NULL) - { - return ERR_INVALID_PARAMETER; - } - - Zero(&t, sizeof(t)); - StrCpy(t.HubName, sizeof(t.HubName), ps->HubName); - t.Key = GetParamInt(o, "[id]"); - - // RPC call - ret = ScDelCrl(ps->Rpc, &t); - - if (ret != ERR_NO_ERROR) - { - // An error has occured - CmdPrintError(c, ret); - FreeParamValueList(o); - return ret; - } - - FreeRpcCrl(&t); - - FreeParamValueList(o); - - return 0; -} - -// Get the revoked certificate -UINT PsCrlGet(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) -{ - LIST *o; - PS *ps = (PS *)param; - UINT ret = 0; - RPC_CRL t; - // Parameter list that can be specified - PARAM args[] = - { - // "name", prompt_proc, prompt_param, eval_proc, eval_param - {"[id]", CmdPrompt, _UU("CMD_CrlGet_Prompt_ID"), CmdEvalNotEmpty, NULL}, - }; - - // If virtual HUB is not selected, it's an error - if (ps->HubName == NULL) - { - c->Write(c, _UU("CMD_Hub_Not_Selected")); - return ERR_INVALID_PARAMETER; - } - - o = ParseCommandList(c, cmd_name, str, args, sizeof(args) / sizeof(args[0])); - if (o == NULL) - { - return ERR_INVALID_PARAMETER; - } - - Zero(&t, sizeof(t)); - StrCpy(t.HubName, sizeof(t.HubName), ps->HubName); - t.Key = GetParamInt(o, "[id]"); - - // RPC call - ret = ScGetCrl(ps->Rpc, &t); - - if (ret != ERR_NO_ERROR) - { - // An error has occured - CmdPrintError(c, ret); - FreeParamValueList(o); - return ret; - } - else - { - // Show contents - CT *ct = CtNewStandard(); - CRL *crl = t.Crl; - NAME *n; - - if (crl != NULL) - { - n = crl->Name; - - if (n != NULL) - { - if (UniIsEmptyStr(n->CommonName) == false) - { - CtInsert(ct, _UU("CMD_CrlGet_CN"), n->CommonName); - } - if (UniIsEmptyStr(n->Organization) == false) - { - CtInsert(ct, _UU("CMD_CrlGet_O"), n->Organization); - } - if (UniIsEmptyStr(n->Unit) == false) - { - CtInsert(ct, _UU("CMD_CrlGet_OU"), n->Unit); - } - if (UniIsEmptyStr(n->Country) == false) - { - CtInsert(ct, _UU("CMD_CrlGet_C"), n->Country); - } - if (UniIsEmptyStr(n->State) == false) - { - CtInsert(ct, _UU("CMD_CrlGet_ST"), n->State); - } - if (UniIsEmptyStr(n->Local) == false) - { - CtInsert(ct, _UU("CMD_CrlGet_L"), n->Local); - } - } - - if (crl->Serial != NULL && crl->Serial->size >= 1) - { - wchar_t tmp[MAX_SIZE]; - char str[MAX_SIZE]; - - BinToStrEx(str, sizeof(str), crl->Serial->data, crl->Serial->size); - StrToUni(tmp, sizeof(tmp), str); - - CtInsert(ct, _UU("CMD_CrlGet_SERI"), tmp); - } - - if (IsZero(crl->DigestMD5, MD5_SIZE) == false) - { - wchar_t tmp[MAX_SIZE]; - char str[MAX_SIZE]; - - BinToStrEx(str, sizeof(str), crl->DigestMD5, MD5_SIZE); - StrToUni(tmp, sizeof(tmp), str); - - CtInsert(ct, _UU("CMD_CrlGet_MD5_HASH"), tmp); - } - - if (IsZero(crl->DigestSHA1, SHA1_SIZE) == false) - { - wchar_t tmp[MAX_SIZE]; - char str[MAX_SIZE]; - - BinToStrEx(str, sizeof(str), crl->DigestSHA1, SHA1_SIZE); - StrToUni(tmp, sizeof(tmp), str); - - CtInsert(ct, _UU("CMD_CrlGet_SHA1_HASH"), tmp); - } - } - CtFree(ct, c); - } - - FreeRpcCrl(&t); - - FreeParamValueList(o); - - return 0; -} - -// Get the rules of IP access control list -UINT PsAcList(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) -{ - LIST *o; - PS *ps = (PS *)param; - UINT ret = 0; - RPC_AC_LIST t; - - // If virtual HUB is not selected, it's an error - if (ps->HubName == NULL) - { - c->Write(c, _UU("CMD_Hub_Not_Selected")); - return ERR_INVALID_PARAMETER; - } - - o = ParseCommandList(c, cmd_name, str, NULL, 0); - if (o == NULL) - { - return ERR_INVALID_PARAMETER; - } - - Zero(&t, sizeof(t)); - StrCpy(t.HubName, sizeof(t.HubName), ps->HubName); - - // RPC call - ret = ScGetAcList(ps->Rpc, &t); - - if (ret != ERR_NO_ERROR) - { - // An error has occured - CmdPrintError(c, ret); - FreeParamValueList(o); - return ret; - } - else - { - UINT i; - CT *ct; - - ct = CtNew(); - CtInsertColumn(ct, _UU("SM_AC_COLUMN_1"), true); - CtInsertColumn(ct, _UU("SM_AC_COLUMN_2"), true); - CtInsertColumn(ct, _UU("SM_AC_COLUMN_3"), false); - CtInsertColumn(ct, _UU("SM_AC_COLUMN_4"), false); - - for (i = 0;i < LIST_NUM(t.o);i++) - { - wchar_t tmp1[32], *tmp2, tmp3[MAX_SIZE], tmp4[32]; - char *tmp_str; - AC *ac = LIST_DATA(t.o, i); - - UniToStru(tmp1, ac->Id); - tmp2 = ac->Deny ? _UU("SM_AC_DENY") : _UU("SM_AC_PASS"); - tmp_str = GenerateAcStr(ac); - StrToUni(tmp3, sizeof(tmp3), tmp_str); - - Free(tmp_str); - - UniToStru(tmp4, ac->Priority); - - CtInsert(ct, tmp1, tmp4, tmp2, tmp3); - } - - CtFree(ct, c); - } - - FreeRpcAcList(&t); - - FreeParamValueList(o); - - return 0; -} - -// Add a rule to the IP access control list (IPv4) -UINT PsAcAdd(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) -{ - LIST *o; - PS *ps = (PS *)param; - UINT ret = 0; - RPC_AC_LIST t; - // Parameter list that can be specified - CMD_EVAL_MIN_MAX mm = - { - "CMD_AcAdd_Eval_PRIORITY", 1, 4294967295UL, - }; - PARAM args[] = - { - // "name", prompt_proc, prompt_param, eval_proc, eval_param - {"[allow|deny]", CmdPrompt, _UU("CMD_AcAdd_Prompt_AD"), CmdEvalNotEmpty, NULL}, - {"PRIORITY", CmdPrompt, _UU("CMD_AcAdd_Prompt_PRIORITY"), CmdEvalMinMax, &mm}, - {"IP", CmdPrompt, _UU("CMD_AcAdd_Prompt_IP"), CmdEvalIpAndMask4, NULL}, - }; - - // If virtual HUB is not selected, it's an error - if (ps->HubName == NULL) - { - c->Write(c, _UU("CMD_Hub_Not_Selected")); - return ERR_INVALID_PARAMETER; - } - - o = ParseCommandList(c, cmd_name, str, args, sizeof(args) / sizeof(args[0])); - if (o == NULL) - { - return ERR_INVALID_PARAMETER; - } - - Zero(&t, sizeof(t)); - StrCpy(t.HubName, sizeof(t.HubName), ps->HubName); - - // RPC call - ret = ScGetAcList(ps->Rpc, &t); - - if (ret != ERR_NO_ERROR) - { - // An error has occured - CmdPrintError(c, ret); - FreeParamValueList(o); - return ret; - } - else - { - // Add a new item to the list - AC *ac = ZeroMalloc(sizeof(AC)); - char *test = GetParamStr(o, "[allow|deny]"); - UINT u_ip, u_mask; - - if (StartWith("deny", test)) - { - ac->Deny = true; - } - - ParseIpAndMask4(GetParamStr(o, "IP"), &u_ip, &u_mask); - UINTToIP(&ac->IpAddress, u_ip); - - if (u_mask == 0xffffffff) - { - ac->Masked = false; - } - else - { - ac->Masked = true; - UINTToIP(&ac->SubnetMask, u_mask); - } - - ac->Priority = GetParamInt(o, "PRIORITY"); - - Insert(t.o, ac); - - ret = ScSetAcList(ps->Rpc, &t); - if (ret != ERR_NO_ERROR) - { - // An error has occured - CmdPrintError(c, ret); - FreeParamValueList(o); - return ret; - } - } - - FreeRpcAcList(&t); - - FreeParamValueList(o); - - return 0; -} - -// Add a rule to the IP access control list (IPv6) -UINT PsAcAdd6(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) -{ - LIST *o; - PS *ps = (PS *)param; - UINT ret = 0; - RPC_AC_LIST t; - // Parameter list that can be specified - CMD_EVAL_MIN_MAX mm = - { - "CMD_AcAdd6_Eval_PRIORITY", 1, 4294967295UL, - }; - PARAM args[] = - { - // "name", prompt_proc, prompt_param, eval_proc, eval_param - {"[allow|deny]", CmdPrompt, _UU("CMD_AcAdd6_Prompt_AD"), CmdEvalNotEmpty, NULL}, - {"PRIORITY", CmdPrompt, _UU("CMD_AcAdd6_Prompt_PRIORITY"), CmdEvalMinMax, &mm}, - {"IP", CmdPrompt, _UU("CMD_AcAdd6_Prompt_IP"), CmdEvalIpAndMask6, NULL}, - }; - - // If virtual HUB is not selected, it's an error - if (ps->HubName == NULL) - { - c->Write(c, _UU("CMD_Hub_Not_Selected")); - return ERR_INVALID_PARAMETER; - } - - o = ParseCommandList(c, cmd_name, str, args, sizeof(args) / sizeof(args[0])); - if (o == NULL) - { - return ERR_INVALID_PARAMETER; - } - - Zero(&t, sizeof(t)); - StrCpy(t.HubName, sizeof(t.HubName), ps->HubName); - - // RPC call - ret = ScGetAcList(ps->Rpc, &t); - - if (ret != ERR_NO_ERROR) - { - // An error has occured - CmdPrintError(c, ret); - FreeParamValueList(o); - return ret; - } - else - { - // Add a new item to the list - AC *ac = ZeroMalloc(sizeof(AC)); - char *test = GetParamStr(o, "[allow|deny]"); - IP u_ip, u_mask; - - if (StartWith("deny", test)) - { - ac->Deny = true; - } - - ParseIpAndMask6(GetParamStr(o, "IP"), &u_ip, &u_mask); - Copy(&ac->IpAddress, &u_ip, sizeof(IP)); - - if (SubnetMaskToInt6(&u_mask) == 128) - { - ac->Masked = false; - } - else - { - ac->Masked = true; - Copy(&ac->SubnetMask, &u_mask, sizeof(IP)); - } - - ac->Priority = GetParamInt(o, "PRIORITY"); - - Insert(t.o, ac); - - ret = ScSetAcList(ps->Rpc, &t); - if (ret != ERR_NO_ERROR) - { - // An error has occured - CmdPrintError(c, ret); - FreeParamValueList(o); - return ret; - } - } - - FreeRpcAcList(&t); - - FreeParamValueList(o); - - return 0; -} - -// Run the debug command -UINT PsDebug(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) -{ - LIST *o; - PS *ps = (PS *)param; - UINT id; - // Parameter list that can be specified - PARAM args[] = - { - // "name", prompt_proc, prompt_param, eval_proc, eval_param - {"[id]", NULL, NULL, NULL, NULL}, - {"ARG", NULL, NULL, NULL, NULL}, - }; - - o = ParseCommandList(c, cmd_name, str, args, sizeof(args) / sizeof(args[0])); - if (o == NULL) - { - return ERR_INVALID_PARAMETER; - } - - id = GetParamInt(o, "[id]"); - - if (true) - { - RPC_TEST t; - UINT ret; - - c->Write(c, _UU("CMD_Debug_Msg1")); - - Zero(&t, sizeof(t)); - - t.IntValue = id; - StrCpy(t.StrValue, sizeof(t.StrValue), GetParamStr(o, "ARG")); - - ret = ScDebug(ps->Rpc, &t); - - if (ret != ERR_NO_ERROR) - { - // An error has occured - CmdPrintError(c, ret); - FreeParamValueList(o); - return ret; - } - else - { - wchar_t tmp[sizeof(t.StrValue)]; - - UniFormat(tmp, sizeof(tmp), _UU("CMD_Debug_Msg2"), t.StrValue); - c->Write(c, tmp); - } - } - - FreeParamValueList(o); - - return 0; -} - -// Flush the configuration file on the server -UINT PsFlush(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) -{ - LIST *o; - PS *ps = (PS *)param; - - o = ParseCommandList(c, cmd_name, str, NULL, 0); - if (o == NULL) - { - return ERR_INVALID_PARAMETER; - } - - if (true) - { - RPC_TEST t; - UINT ret; - wchar_t tmp[MAX_SIZE]; - char sizestr[MAX_SIZE]; - - c->Write(c, _UU("CMD_Flush_Msg1")); - - Zero(&t, sizeof(t)); - - ret = ScFlush(ps->Rpc, &t); - - if (ret != ERR_NO_ERROR) - { - // An error has occured - CmdPrintError(c, ret); - FreeParamValueList(o); - return ret; - } - - ToStr3(sizestr, sizeof(sizestr), (UINT64)t.IntValue); - UniFormat(tmp, sizeof(tmp), _UU("CMD_Flush_Msg2"), sizestr); - c->Write(c, tmp); - } - - FreeParamValueList(o); - - return 0; -} - -// Crash -UINT PsCrash(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) -{ - LIST *o; - PS *ps = (PS *)param; - char *yes; - // Parameter list that can be specified - PARAM args[] = - { - // "name", prompt_proc, prompt_param, eval_proc, eval_param - {"[yes]", CmdPrompt, _UU("CMD_Crash_Confirm"), NULL, NULL}, - }; - - o = ParseCommandList(c, cmd_name, str, args, sizeof(args) / sizeof(args[0])); - if (o == NULL) - { - return ERR_INVALID_PARAMETER; - } - - yes = GetParamStr(o, "[yes]"); - - if (StrCmpi(yes, "yes") != 0) - { - c->Write(c, _UU("CMD_Crash_Aborted")); - } - else - { - RPC_TEST t; - UINT ret; - - c->Write(c, _UU("CMD_Crash_Msg")); - - Zero(&t, sizeof(t)); - - ret = ScCrash(ps->Rpc, &t); - - if (ret != ERR_NO_ERROR) - { - // An error has occured - CmdPrintError(c, ret); - FreeParamValueList(o); - return ret; - } - } - - FreeParamValueList(o); - - return 0; -} - -// Remove a rule in the IP access control list -UINT PsAcDel(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) -{ - LIST *o; - PS *ps = (PS *)param; - UINT ret = 0; - RPC_AC_LIST t; - // Parameter list that can be specified - PARAM args[] = - { - // "name", prompt_proc, prompt_param, eval_proc, eval_param - {"[id]", CmdPrompt, _UU("CMD_AcDel_Prompt_ID"), CmdEvalNotEmpty, NULL}, - }; - - // If virtual HUB is not selected, it's an error - if (ps->HubName == NULL) - { - c->Write(c, _UU("CMD_Hub_Not_Selected")); - return ERR_INVALID_PARAMETER; - } - - o = ParseCommandList(c, cmd_name, str, args, sizeof(args) / sizeof(args[0])); - if (o == NULL) - { - return ERR_INVALID_PARAMETER; - } - - Zero(&t, sizeof(t)); - StrCpy(t.HubName, sizeof(t.HubName), ps->HubName); - - // RPC call - ret = ScGetAcList(ps->Rpc, &t); - - if (ret != ERR_NO_ERROR) - { - // An error has occured - CmdPrintError(c, ret); - FreeParamValueList(o); - return ret; - } - else - { - // Remove matched ID - UINT i; - bool b = false; - - for (i = 0;i < LIST_NUM(t.o);i++) - { - AC *ac = LIST_DATA(t.o, i); - - if (ac->Id == GetParamInt(o, "[id]")) - { - Delete(t.o, ac); - Free(ac); - b = true; - break; - } - } - - if (b == false) - { - ret = ERR_OBJECT_NOT_FOUND; - FreeRpcAcList(&t); - } - else - { - ret = ScSetAcList(ps->Rpc, &t); - } - if (ret != ERR_NO_ERROR) - { - // An error has occured - CmdPrintError(c, ret); - FreeParamValueList(o); - return ret; - } - } - - FreeRpcAcList(&t); - FreeParamValueList(o); - - return 0; -} - -// Enable / Disable the IPsec VPN server function -UINT PsIPsecEnable(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) -{ - LIST *o; - PS *ps = (PS *)param; - UINT ret = 0; - IPSEC_SERVICES t; - // Parameter list that can be specified - PARAM args[] = - { - // "name", prompt_proc, prompt_param, eval_proc, eval_param - {"L2TP", CmdPrompt, _UU("CMD_IPsecEnable_Prompt_L2TP"), CmdEvalNotEmpty, NULL}, - {"L2TPRAW", CmdPrompt, _UU("CMD_IPsecEnable_Prompt_L2TPRAW"), CmdEvalNotEmpty, NULL}, - {"ETHERIP", CmdPrompt, _UU("CMD_IPsecEnable_Prompt_ETHERIP"), CmdEvalNotEmpty, NULL}, - {"PSK", CmdPrompt, _UU("CMD_IPsecEnable_Prompt_PSK"), CmdEvalNotEmpty, NULL}, - {"DEFAULTHUB", CmdPrompt, _UU("CMD_IPsecEnable_Prompt_DEFAULTHUB"), CmdEvalNotEmpty, NULL}, - }; - - o = ParseCommandList(c, cmd_name, str, args, sizeof(args) / sizeof(args[0])); - if (o == NULL) - { - return ERR_INVALID_PARAMETER; - } - - Zero(&t, sizeof(t)); - t.L2TP_IPsec = GetParamYes(o, "L2TP"); - t.L2TP_Raw = GetParamYes(o, "L2TPRAW"); - t.EtherIP_IPsec = GetParamYes(o, "ETHERIP"); - StrCpy(t.IPsec_Secret, sizeof(t.IPsec_Secret), GetParamStr(o, "PSK")); - StrCpy(t.L2TP_DefaultHub, sizeof(t.L2TP_DefaultHub), GetParamStr(o, "DEFAULTHUB")); - - // RPC call - ret = ScSetIPsecServices(ps->Rpc, &t); - - if (ret != ERR_NO_ERROR) - { - // An error has occured - CmdPrintError(c, ret); - FreeParamValueList(o); - return ret; - } - - FreeParamValueList(o); - - return 0; -} - -// Get the current configuration of IPsec VPN server function -UINT PsIPsecGet(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) -{ - LIST *o; - PS *ps = (PS *)param; - UINT ret = 0; - IPSEC_SERVICES t; - - o = ParseCommandList(c, cmd_name, str, NULL, 0); - if (o == NULL) - { - return ERR_INVALID_PARAMETER; - } - - Zero(&t, sizeof(t)); - - // RPC call - ret = ScGetIPsecServices(ps->Rpc, &t); - - if (ret != ERR_NO_ERROR) - { - // An error has occured - CmdPrintError(c, ret); - FreeParamValueList(o); - return ret; - } - else - { - wchar_t tmp[MAX_PATH]; - CT *ct = CtNewStandard(); - - CtInsert(ct, _UU("CMD_IPsecGet_PRINT_L2TP"), _UU(t.L2TP_IPsec ? "SEC_YES" : "SEC_NO")); - CtInsert(ct, _UU("CMD_IPsecGet_PRINT_L2TPRAW"), _UU(t.L2TP_Raw ? "SEC_YES" : "SEC_NO")); - CtInsert(ct, _UU("CMD_IPsecGet_PRINT_ETHERIP"), _UU(t.EtherIP_IPsec ? "SEC_YES" : "SEC_NO")); - - StrToUni(tmp, sizeof(tmp), t.IPsec_Secret); - CtInsert(ct, _UU("CMD_IPsecGet_PRINT_PSK"), tmp); - - StrToUni(tmp, sizeof(tmp), t.L2TP_DefaultHub); - CtInsert(ct, _UU("CMD_IPsecGet_PRINT_DEFAULTHUB"), tmp); - - CtFree(ct, c); - } - - FreeParamValueList(o); - - return 0; -} - -// Add connection settings for accepting connections from client devices of EtherIP / L2TPv3 over IPsec server function -UINT PsEtherIpClientAdd(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) -{ - LIST *o; - PS *ps = (PS *)param; - UINT ret = 0; - ETHERIP_ID t; - // Parameter list that can be specified - PARAM args[] = - { - // "name", prompt_proc, prompt_param, eval_proc, eval_param - {"[ID]", CmdPrompt, _UU("CMD_EtherIpClientAdd_Prompt_ID"), CmdEvalNotEmpty, NULL}, - {"HUB", CmdPrompt, _UU("CMD_EtherIpClientAdd_Prompt_HUB"), CmdEvalNotEmpty, NULL}, - {"USERNAME", CmdPrompt, _UU("CMD_EtherIpClientAdd_Prompt_USERNAME"), CmdEvalNotEmpty, NULL}, - {"PASSWORD", CmdPrompt, _UU("CMD_EtherIpClientAdd_Prompt_PASSWORD"), CmdEvalNotEmpty, NULL}, - }; - - o = ParseCommandList(c, cmd_name, str, args, sizeof(args) / sizeof(args[0])); - if (o == NULL) - { - return ERR_INVALID_PARAMETER; - } - - Zero(&t, sizeof(t)); - StrCpy(t.Id, sizeof(t.Id), GetParamStr(o, "[ID]")); - StrCpy(t.HubName, sizeof(t.HubName), GetParamStr(o, "HUB")); - StrCpy(t.UserName, sizeof(t.UserName), GetParamStr(o, "USERNAME")); - StrCpy(t.Password, sizeof(t.Password), GetParamStr(o, "PASSWORD")); - - // RPC call - ret = ScAddEtherIpId(ps->Rpc, &t); - - if (ret != ERR_NO_ERROR) - { - // An error has occured - CmdPrintError(c, ret); - FreeParamValueList(o); - return ret; - } - - FreeParamValueList(o); - - return 0; -} - -// Delete the connection settings for accepting connections from client devices of EtherIP / L2TPv3 over IPsec server function -UINT PsEtherIpClientDelete(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) -{ - LIST *o; - PS *ps = (PS *)param; - UINT ret = 0; - ETHERIP_ID t; - // Parameter list that can be specified - PARAM args[] = - { - // "name", prompt_proc, prompt_param, eval_proc, eval_param - {"[ID]", CmdPrompt, _UU("CMD_EtherIpClientDelete_Prompt_ID"), CmdEvalNotEmpty, NULL}, - }; - - o = ParseCommandList(c, cmd_name, str, args, sizeof(args) / sizeof(args[0])); - if (o == NULL) - { - return ERR_INVALID_PARAMETER; - } - - Zero(&t, sizeof(t)); - StrCpy(t.Id, sizeof(t.Id), GetParamStr(o, "[ID]")); - - // RPC call - ret = ScDeleteEtherIpId(ps->Rpc, &t); - - if (ret != ERR_NO_ERROR) - { - // An error has occured - CmdPrintError(c, ret); - FreeParamValueList(o); - return ret; - } - - FreeParamValueList(o); - - return 0; -} - -// Show the list of connection settings for accepting connections from client devices of EtherIP / L2TPv3 over IPsec server function -UINT PsEtherIpClientList(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) -{ - LIST *o; - PS *ps = (PS *)param; - UINT ret = 0; - RPC_ENUM_ETHERIP_ID t; - UINT i; - CT *b; - - o = ParseCommandList(c, cmd_name, str, NULL, 0); - if (o == NULL) - { - return ERR_INVALID_PARAMETER; - } - - Zero(&t, sizeof(t)); - - // RPC call - ret = ScEnumEtherIpId(ps->Rpc, &t); - - if (ret != ERR_NO_ERROR) - { - // An error has occured - CmdPrintError(c, ret); - FreeParamValueList(o); - return ret; - } - else - { - b = CtNew(); - - CtInsertColumn(b, _UU("SM_ETHERIP_COLUMN_0"), false); - CtInsertColumn(b, _UU("SM_ETHERIP_COLUMN_1"), false); - CtInsertColumn(b, _UU("SM_ETHERIP_COLUMN_2"), false); - - for (i = 0;i < t.NumItem;i++) - { - ETHERIP_ID *d = &t.IdList[i]; - wchar_t id[MAX_SIZE], hubname[MAX_SIZE], username[MAX_SIZE]; - - StrToUni(id, sizeof(id), d->Id); - StrToUni(hubname, sizeof(hubname), d->HubName); - StrToUni(username, sizeof(username), d->UserName); - - CtInsert(b, id, hubname, username); - } - - CtFree(b, c); - - FreeRpcEnumEtherIpId(&t); - } - - FreeParamValueList(o); - - return 0; -} - -// Generate a OpenVPN sample configuration file that can connect to the OpenVPN compatible server function -UINT PsOpenVpnMakeConfig(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) -{ - LIST *o; - PS *ps = (PS *)param; - UINT ret = 0; - RPC_READ_LOG_FILE t; - // Parameter list that can be specified - PARAM args[] = - { - // "name", prompt_proc, prompt_param, eval_proc, eval_param - {"[ZIP_FileName]", CmdPrompt, _UU("CMD_OpenVpnMakeConfig_Prompt_ZIP"), CmdEvalNotEmpty, NULL}, - }; - - o = ParseCommandList(c, cmd_name, str, args, sizeof(args) / sizeof(args[0])); - if (o == NULL) - { - return ERR_INVALID_PARAMETER; - } - - Zero(&t, sizeof(t)); - - // RPC call - ret = ScMakeOpenVpnConfigFile(ps->Rpc, &t); - - if (ret != ERR_NO_ERROR) - { - // An error has occured - CmdPrintError(c, ret); - FreeParamValueList(o); - return ret; - } - else - { - // Determine the file name to save - wchar_t filename[MAX_SIZE]; - wchar_t tmp[MAX_SIZE]; - - UniStrCpy(filename, sizeof(filename), GetParamUniStr(o, "[ZIP_FileName]")); - - if (UniEndWith(filename, L".zip") == false) - { - UniStrCat(filename, sizeof(filename), L".zip"); - } - - if (DumpBufW(t.Buffer, filename) == false) - { - ret = ERR_INTERNAL_ERROR; - - UniFormat(tmp, sizeof(tmp), _UU("CMD_OpenVpnMakeConfig_ERROR"), filename); - } - else - { - UniFormat(tmp, sizeof(tmp), _UU("CMD_OpenVpnMakeConfig_OK"), filename); - } - - c->Write(c, tmp); - - FreeRpcReadLogFile(&t); - } - - FreeParamValueList(o); - - return ret; -} - -// Register to the VPN Server by creating a new self-signed certificate with the specified CN (Common Name) -UINT PsServerCertRegenerate(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) -{ - LIST *o; - PS *ps = (PS *)param; - UINT ret = 0; - RPC_TEST t; - // Parameter list that can be specified - PARAM args[] = - { - // "name", prompt_proc, prompt_param, eval_proc, eval_param - {"[CN]", CmdPrompt, _UU("CMD_ServerCertRegenerate_Prompt_CN"), CmdEvalNotEmpty, NULL}, - }; - - o = ParseCommandList(c, cmd_name, str, args, sizeof(args) / sizeof(args[0])); - if (o == NULL) - { - return ERR_INVALID_PARAMETER; - } - - Zero(&t, sizeof(t)); - StrCpy(t.StrValue, sizeof(t.StrValue), GetParamStr(o, "[CN]")); - - // RPC call - ret = ScRegenerateServerCert(ps->Rpc, &t); - - if (ret != ERR_NO_ERROR) - { - // An error has occured - CmdPrintError(c, ret); - FreeParamValueList(o); - return ret; - } - - c->Write(c, L""); - c->Write(c, _UU("CM_CERT_SET_MSG")); - c->Write(c, L""); - - FreeParamValueList(o); - - return 0; -} - -// Enable / disable the VPN over ICMP / VPN over DNS server function -UINT PsVpnOverIcmpDnsEnable(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) -{ - LIST *o; - PS *ps = (PS *)param; - UINT ret = 0; - RPC_SPECIAL_LISTENER t; - // Parameter list that can be specified - PARAM args[] = - { - // "name", prompt_proc, prompt_param, eval_proc, eval_param - {"ICMP", CmdPrompt, _UU("CMD_VpnOverIcmpDnsEnable_Prompt_ICMP"), CmdEvalNotEmpty, NULL}, - {"DNS", CmdPrompt, _UU("CMD_VpnOverIcmpDnsEnable_Prompt_DNS"), CmdEvalNotEmpty, NULL}, - }; - - o = ParseCommandList(c, cmd_name, str, args, sizeof(args) / sizeof(args[0])); - if (o == NULL) - { - return ERR_INVALID_PARAMETER; - } - - Zero(&t, sizeof(t)); - t.VpnOverIcmpListener = GetParamYes(o, "ICMP"); - t.VpnOverDnsListener = GetParamYes(o, "DNS"); - - // RPC call - ret = ScSetSpecialListener(ps->Rpc, &t); - - if (ret != ERR_NO_ERROR) - { - // An error has occured - CmdPrintError(c, ret); - FreeParamValueList(o); - return ret; - } - - FreeParamValueList(o); - - return 0; -} - -// Get current settings of VPN over ICMP / VPN over DNS server function -UINT PsVpnOverIcmpDnsGet(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) -{ - LIST *o; - PS *ps = (PS *)param; - UINT ret = 0; - RPC_SPECIAL_LISTENER t; - - o = ParseCommandList(c, cmd_name, str, NULL, 0); - if (o == NULL) - { - return ERR_INVALID_PARAMETER; - } - - Zero(&t, sizeof(t)); - - // RPC call - ret = ScGetSpecialListener(ps->Rpc, &t); - - if (ret != ERR_NO_ERROR) - { - // An error has occured - CmdPrintError(c, ret); - FreeParamValueList(o); - return ret; - } - else - { - CT *ct = CtNewStandard(); - - CtInsert(ct, _UU("CMD_VpnOverIcmpDnsGet_PRINT_ICMP"), _UU(t.VpnOverIcmpListener ? "SEC_YES" : "SEC_NO")); - CtInsert(ct, _UU("CMD_VpnOverIcmpDnsGet_PRINT_DNS"), _UU(t.VpnOverDnsListener ? "SEC_YES" : "SEC_NO")); - - CtFree(ct, c); - } - - FreeParamValueList(o); - - return 0; -} - -// Enable / disable the VPN Azure function -UINT PsVpnAzureSetEnable(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) -{ - LIST *o; - PS *ps = (PS *)param; - UINT ret = 0; - RPC_AZURE_STATUS t; - // Parameter list that can be specified - PARAM args[] = - { - // "name", prompt_proc, prompt_param, eval_proc, eval_param - {"[yes|no]", CmdPrompt, _UU("VpnAzureSetEnable_PROMPT"), CmdEvalNotEmpty, NULL}, - }; - - o = ParseCommandList(c, cmd_name, str, args, sizeof(args) / sizeof(args[0])); - if (o == NULL) - { - return ERR_INVALID_PARAMETER; - } - - Zero(&t, sizeof(t)); - t.IsEnabled = GetParamYes(o, "[yes|no]"); - - // RPC call - ret = ScSetAzureStatus(ps->Rpc, &t); - - if (ret != ERR_NO_ERROR) - { - // An error has occured - CmdPrintError(c, ret); - FreeParamValueList(o); - return ret; - } - - FreeParamValueList(o); - - return 0; -} - -// Get the current state of the VPN Azure function -UINT PsVpnAzureGetStatus(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) -{ - LIST *o; - PS *ps = (PS *)param; - UINT ret = 0; - RPC_AZURE_STATUS t; - DDNS_CLIENT_STATUS t2; - - o = ParseCommandList(c, cmd_name, str, NULL, 0); - if (o == NULL) - { - return ERR_INVALID_PARAMETER; - } - - Zero(&t, sizeof(t)); - Zero(&t2, sizeof(t2)); - - // RPC call - ret = ScGetAzureStatus(ps->Rpc, &t); - - if (ret == ERR_NO_ERROR) - { - ret = ScGetDDnsClientStatus(ps->Rpc, &t2); - } - - if (ret != ERR_NO_ERROR) - { - // An error has occured - CmdPrintError(c, ret); - FreeParamValueList(o); - return ret; - } - else - { - CT *ct = CtNewStandard(); - - CtInsert(ct, _UU("CMD_VpnAzureGetStatus_PRINT_ENABLED"), _UU(t.IsEnabled ? "SEC_YES" : "SEC_NO")); - - if (t.IsEnabled) - { - wchar_t tmp[MAX_SIZE]; - - UniFormat(tmp, sizeof(tmp), L"%S%S", t2.CurrentHostName, AZURE_DOMAIN_SUFFIX); - - CtInsert(ct, _UU("CMD_VpnAzureGetStatus_PRINT_CONNECTED"), _UU(t.IsConnected ? "SEC_YES" : "SEC_NO")); - CtInsert(ct, _UU("CMD_VpnAzureGetStatus_PRINT_HOSTNAME"), tmp); - } - - CtFree(ct, c); - } - - FreeParamValueList(o); - - return 0; -} - -// Get the current state of the dynamic DNS function -UINT PsDynamicDnsGetStatus(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) -{ - LIST *o; - PS *ps = (PS *)param; - UINT ret = 0; - DDNS_CLIENT_STATUS t; - - o = ParseCommandList(c, cmd_name, str, NULL, 0); - if (o == NULL) - { - return ERR_INVALID_PARAMETER; - } - - Zero(&t, sizeof(t)); - - // RPC call - ret = ScGetDDnsClientStatus(ps->Rpc, &t); - - if (ret != ERR_NO_ERROR) - { - // An error has occured - CmdPrintError(c, ret); - FreeParamValueList(o); - return ret; - } - else - { - CT *ct = CtNewStandard(); - wchar_t tmp[MAX_SIZE]; - - // FQDN - if (IsEmptyStr(t.CurrentFqdn) == false) - { - StrToUni(tmp, sizeof(tmp), t.CurrentFqdn); - } - else - { - UniStrCpy(tmp, sizeof(tmp), _UU("SM_DDNS_FQDN_EMPTY")); - } - CtInsert(ct, _UU("CMD_DynamicDnsGetStatus_PRINT_FQDN"), tmp); - - // Hostname - if (IsEmptyStr(t.CurrentHostName) == false) - { - StrToUni(tmp, sizeof(tmp), t.CurrentHostName); - } - else - { - UniStrCpy(tmp, sizeof(tmp), _UU("SM_DDNS_FQDN_EMPTY")); - } - CtInsert(ct, _UU("CMD_DynamicDnsGetStatus_PRINT_HOSTNAME"), tmp); - - // Suffix - if (IsEmptyStr(t.DnsSuffix) == false) - { - StrToUni(tmp, sizeof(tmp), t.DnsSuffix); - } - else - { - UniStrCpy(tmp, sizeof(tmp), _UU("SM_DDNS_FQDN_EMPTY")); - } - CtInsert(ct, _UU("CMD_DynamicDnsGetStatus_PRINT_SUFFIX"), tmp); - - // IPv4 - if (t.Err_IPv4 == ERR_NO_ERROR) - { - StrToUni(tmp, sizeof(tmp), t.CurrentIPv4); - } - else - { - UniStrCpy(tmp, sizeof(tmp), _E(t.Err_IPv4)); - } - CtInsert(ct, _UU("CMD_DynamicDnsGetStatus_PRINT_IPv4"), tmp); - - // IPv6 - if (t.Err_IPv6 == ERR_NO_ERROR) - { - StrToUni(tmp, sizeof(tmp), t.CurrentIPv6); - } - else - { - UniStrCpy(tmp, sizeof(tmp), _E(t.Err_IPv6)); - } - CtInsert(ct, _UU("CMD_DynamicDnsGetStatus_PRINT_IPv6"), tmp); - - CtFree(ct, c); - } - - FreeParamValueList(o); - - return 0; -} - -// Configure the dynamic DNS host name -UINT PsDynamicDnsSetHostname(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) -{ - LIST *o; - PS *ps = (PS *)param; - UINT ret = 0; - RPC_TEST t; - // Parameter list that can be specified - PARAM args[] = - { - // "name", prompt_proc, prompt_param, eval_proc, eval_param - {"[hostname]", CmdPrompt, _UU("CMD_DynamicDnsSetHostname_Prompt_hostname"), CmdEvalNotEmpty, NULL}, - }; - - o = ParseCommandList(c, cmd_name, str, args, sizeof(args) / sizeof(args[0])); - if (o == NULL) - { - return ERR_INVALID_PARAMETER; - } - - Zero(&t, sizeof(t)); - StrCpy(t.StrValue, sizeof(t.StrValue), GetParamStr(o, "[hostname]")); - - // RPC call - ret = ScChangeDDnsClientHostname(ps->Rpc, &t); - - if (ret != ERR_NO_ERROR) - { - // An error has occured - CmdPrintError(c, ret); - FreeParamValueList(o); - return ret; - } - - FreeParamValueList(o); - - return 0; -} - -// Register a new license key -UINT PsLicenseAdd(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) -{ - LIST *o; - PS *ps = (PS *)param; - UINT ret = 0; - RPC_TEST t; - // Parameter list that can be specified - PARAM args[] = - { - // "name", prompt_proc, prompt_param, eval_proc, eval_param - {"[key]", CmdPrompt, _UU("CMD_LicenseAdd_Prompt_Key"), CmdEvalNotEmpty, NULL}, - }; - - o = ParseCommandList(c, cmd_name, str, args, sizeof(args) / sizeof(args[0])); - if (o == NULL) - { - return ERR_INVALID_PARAMETER; - } - - Zero(&t, sizeof(t)); - StrCpy(t.StrValue, sizeof(t.StrValue), GetParamStr(o, "[key]")); - - // RPC call - ret = ScAddLicenseKey(ps->Rpc, &t); - - if (ret != ERR_NO_ERROR) - { - // An error has occured - CmdPrintError(c, ret); - FreeParamValueList(o); - return ret; - } - - FreeParamValueList(o); - - return 0; -} - -// Delete the registered license -UINT PsLicenseDel(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) -{ - LIST *o; - PS *ps = (PS *)param; - UINT ret = 0; - RPC_TEST t; - // Parameter list that can be specified - PARAM args[] = - { - // "name", prompt_proc, prompt_param, eval_proc, eval_param - {"[id]", CmdPrompt, _UU("CMD_LicenseDel_Prompt_ID"), CmdEvalNotEmpty, NULL}, - }; - - o = ParseCommandList(c, cmd_name, str, args, sizeof(args) / sizeof(args[0])); - if (o == NULL) - { - return ERR_INVALID_PARAMETER; - } - - Zero(&t, sizeof(t)); - t.IntValue = GetParamInt(o, "[id]"); - - // RPC call - ret = ScDelLicenseKey(ps->Rpc, &t); - - if (ret != ERR_NO_ERROR) - { - // An error has occured - CmdPrintError(c, ret); - FreeParamValueList(o); - return ret; - } - - FreeParamValueList(o); - - return 0; -} - - - -// Get the registered license list -UINT PsLicenseList(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) -{ - LIST *o; - PS *ps = (PS *)param; - UINT ret = 0; - RPC_ENUM_LICENSE_KEY t; - CT *ct; - UINT i; - - o = ParseCommandList(c, cmd_name, str, NULL, 0); - if (o == NULL) - { - return ERR_INVALID_PARAMETER; - } - - Zero(&t, sizeof(t)); - - // RPC call - ret = ScEnumLicenseKey(ps->Rpc, &t); - - if (ret != ERR_NO_ERROR) - { - // An error has occured - CmdPrintError(c, ret); - FreeParamValueList(o); - return ret; - } - - ct = CtNew(); - CtInsertColumn(ct, _UU("SM_LICENSE_COLUMN_1"), false); - CtInsertColumn(ct, _UU("SM_LICENSE_COLUMN_2"), false); - CtInsertColumn(ct, _UU("SM_LICENSE_COLUMN_3"), false); - CtInsertColumn(ct, _UU("SM_LICENSE_COLUMN_4"), false); - CtInsertColumn(ct, _UU("SM_LICENSE_COLUMN_5"), false); - CtInsertColumn(ct, _UU("SM_LICENSE_COLUMN_6"), false); - CtInsertColumn(ct, _UU("SM_LICENSE_COLUMN_7"), false); - CtInsertColumn(ct, _UU("SM_LICENSE_COLUMN_8"), false); - CtInsertColumn(ct, _UU("SM_LICENSE_COLUMN_9"), false); - - for (i = 0;i < t.NumItem;i++) - { - wchar_t tmp1[32], tmp2[LICENSE_KEYSTR_LEN + 1], tmp3[LICENSE_MAX_PRODUCT_NAME_LEN + 1], - *tmp4, tmp5[128], tmp6[LICENSE_LICENSEID_STR_LEN + 1], tmp7[64], - tmp8[64], tmp9[64]; - RPC_ENUM_LICENSE_KEY_ITEM *e = &t.Items[i]; - - UniToStru(tmp1, e->Id); - StrToUni(tmp2, sizeof(tmp2), e->LicenseKey); - StrToUni(tmp3, sizeof(tmp3), e->LicenseName); - tmp4 = LiGetLicenseStatusStr(e->Status); - if (e->Expires == 0) - { - UniStrCpy(tmp5, sizeof(tmp5), _UU("SM_LICENSE_NO_EXPIRES")); - } - else - { - GetDateStrEx64(tmp5, sizeof(tmp5), e->Expires, NULL); - } - StrToUni(tmp6, sizeof(tmp6), e->LicenseId); - UniToStru(tmp7, e->ProductId); - UniFormat(tmp8, sizeof(tmp8), L"%I64u", e->SystemId); - UniToStru(tmp9, e->SerialId); - - CtInsert(ct, - tmp1, tmp2, tmp3, tmp4, tmp5, tmp6, tmp7, tmp8, tmp9); - } - - CtFreeEx(ct, c, true); - - FreeRpcEnumLicenseKey(&t); - - FreeParamValueList(o); - - return 0; -} - -// Get the license status of the current VPN Server -UINT PsLicenseStatus(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) -{ - LIST *o; - PS *ps = (PS *)param; - UINT ret = 0; - RPC_LICENSE_STATUS st; - CT *ct; - wchar_t tmp[MAX_SIZE]; - - o = ParseCommandList(c, cmd_name, str, NULL, 0); - if (o == NULL) - { - return ERR_INVALID_PARAMETER; - } - - Zero(&st, sizeof(st)); - - // RPC call - ret = ScGetLicenseStatus(ps->Rpc, &st); - - if (ret != ERR_NO_ERROR) - { - // An error has occured - CmdPrintError(c, ret); - FreeParamValueList(o); - return ret; - } - - ct = CtNewStandard(); - - if (st.EditionId == LICENSE_EDITION_VPN3_NO_LICENSE) - { - CtInsert(ct, _UU("SM_NO_LICENSE_COLUMN"), _UU("SM_NO_LICENSE")); - } - else - { - // Product edition name - StrToUni(tmp, sizeof(tmp), st.EditionStr); - CtInsert(ct, _UU("SM_LICENSE_STATUS_EDITION"), tmp); - - // Release date - if (st.ReleaseDate != 0) - { - GetDateStrEx64(tmp, sizeof(tmp), st.ReleaseDate, NULL); - CtInsert(ct, _UU("SM_LICENSE_STATUS_RELEASE"), tmp); - } - - // Current system ID - UniFormat(tmp, sizeof(tmp), L"%I64u", st.SystemId); - CtInsert(ct, _UU("SM_LICENSE_STATUS_SYSTEM_ID"), tmp); - - // Expiration date of the current license product - if (st.SystemExpires == 0) - { - UniStrCpy(tmp, sizeof(tmp), _UU("SM_LICENSE_NO_EXPIRES")); - } - else - { - GetDateStrEx64(tmp, sizeof(tmp), st.SystemExpires, NULL); - } - CtInsert(ct, _UU("SM_LICENSE_STATUS_EXPIRES"), tmp); - - // Subscription (support) contract - if (st.NeedSubscription == false) - { - UniStrCpy(tmp, sizeof(tmp), _UU("SM_LICENSE_STATUS_SUBSCRIPTION_NONEED")); - } - else - { - if (st.SubscriptionExpires == 0) - { - UniStrCpy(tmp, sizeof(tmp), _UU("SM_LICENSE_STATUS_SUBSCRIPTION_NONE")); - } - else - { - wchar_t dtstr[MAX_PATH]; - - GetDateStrEx64(dtstr, sizeof(dtstr), st.SubscriptionExpires, NULL); - - UniFormat(tmp, sizeof(tmp), - st.IsSubscriptionExpired ? _UU("SM_LICENSE_STATUS_SUBSCRIPTION_EXPIRED") : _UU("SM_LICENSE_STATUS_SUBSCRIPTION_VALID"), - dtstr); - } - } - CtInsert(ct, _UU("SM_LICENSE_STATUS_SUBSCRIPTION"), tmp); - - if (st.NeedSubscription == false && st.SubscriptionExpires != 0) - { - wchar_t dtstr[MAX_PATH]; - - GetDateStrEx64(dtstr, sizeof(dtstr), st.SubscriptionExpires, NULL); - - CtInsert(ct, _UU("SM_LICENSE_STATUS_SUBSCRIPTION_BUILD_STR"), tmp); - } - - if (GetCapsBool(ps->CapsList, "b_vpn3")) - { - // Maximum creatable number of users - if (st.NumClientConnectLicense == INFINITE) - { - UniStrCpy(tmp, sizeof(tmp), _UU("SM_LICENSE_INFINITE")); - } - else - { - UniToStru(tmp, st.NumClientConnectLicense); - } - CtInsert(ct, _UU("SM_LICENSE_NUM_CLIENT"), tmp); - } - - // Available number of concurrent client connections - if (st.NumBridgeConnectLicense == INFINITE) - { - UniStrCpy(tmp, sizeof(tmp), _UU("SM_LICENSE_INFINITE")); - } - else - { - UniToStru(tmp, st.NumBridgeConnectLicense); - } - CtInsert(ct, _UU("SM_LICENSE_NUM_BRIDGE"), tmp); - - // Availability of enterprise features - CtInsert(ct, _UU("SM_LICENSE_STATUS_ENTERPRISE"), - st.AllowEnterpriseFunction ? _UU("SM_LICENSE_STATUS_ENTERPRISE_YES") : _UU("SM_LICENSE_STATUS_ENTERPRISE_NO")); - } - - CtFreeEx(ct, c, false); - - FreeParamValueList(o); - - return 0; -} - - -// Get the cluster configuration -UINT PsClusterSettingGet(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) -{ - LIST *o; - PS *ps = (PS *)param; - UINT ret; - RPC_FARM t; - CT *ct; - - o = ParseCommandList(c, cmd_name, str, NULL, 0); - if (o == NULL) - { - return ERR_INVALID_PARAMETER; - } - - Zero(&t, sizeof(t)); - - ret = ScGetFarmSetting(ps->Rpc, &t); - - if (ret != ERR_NO_ERROR) - { - CmdPrintError(c, ret); - FreeParamValueList(o); - return ret; - } - - if (t.Weight == 0) - { - t.Weight = FARM_DEFAULT_WEIGHT; - } - - // Show the cluster configuration - ct = CtNewStandard(); - - CtInsert(ct, _UU("CMD_ClusterSettingGet_Current"), - GetServerTypeStr(t.ServerType)); - - if (t.ServerType == SERVER_TYPE_FARM_CONTROLLER) - { - CtInsert(ct, _UU("CMD_ClusterSettingGet_ControllerOnly"), t.ControllerOnly ? _UU("SEC_YES") : _UU("SEC_NO")); - } - - if (t.ServerType != SERVER_TYPE_STANDALONE) - { - wchar_t tmp[MAX_SIZE]; - - UniToStru(tmp, t.Weight); - - CtInsert(ct, _UU("CMD_ClusterSettingGet_Weight"), tmp); - } - - if (t.ServerType == SERVER_TYPE_FARM_MEMBER) - { - wchar_t tmp[MAX_SIZE]; - UINT i; - - // Public IP address - if (t.PublicIp != 0) - { - IPToUniStr32(tmp, sizeof(tmp), t.PublicIp); - } - else - { - UniStrCpy(tmp, sizeof(tmp), _UU("CMD_ClusterSettingGet_None")); - } - - CtInsert(ct, _UU("CMD_ClusterSettingGet_PublicIp"), tmp); - - // Public port list - tmp[0] = 0; - for (i = 0;i < t.NumPort;i++) - { - wchar_t tmp2[64]; - - UniFormat(tmp2, sizeof(tmp2), L"%u, ", t.Ports[i]); - - UniStrCat(tmp, sizeof(tmp), tmp2); - } - - if (UniEndWith(tmp, L", ")) - { - tmp[UniStrLen(tmp) - 2] = 0; - } - - CtInsert(ct, _UU("CMD_ClusterSettingGet_PublicPorts"), tmp); - - // Controller to connect - UniFormat(tmp, sizeof(tmp), L"%S:%u", t.ControllerName, t.ControllerPort); - CtInsert(ct, _UU("CMD_ClusterSettingGet_Controller"), tmp); - } - - CtFree(ct, c); - - FreeRpcFarm(&t); - FreeParamValueList(o); - - return 0; -} - -// Set the server password -UINT PsServerPasswordSet(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) -{ - LIST *o; - PS *ps = (PS *)param; - UINT ret; - RPC_SET_PASSWORD t; - char *pw; - PARAM args[] = - { - {"[password]", CmdPromptChoosePassword, NULL, NULL, NULL}, - }; - - o = ParseCommandList(c, cmd_name, str, args, sizeof(args) / sizeof(args[0])); - if (o == NULL) - { - return ERR_INVALID_PARAMETER; - } - - pw = GetParamStr(o, "[password]"); - - Zero(&t, sizeof(t)); - Sha0(t.HashedPassword, pw, StrLen(pw)); - - ret = ScSetServerPassword(ps->Rpc, &t); - - if (ret != ERR_NO_ERROR) - { - CmdPrintError(c, ret); - FreeParamValueList(o); - return ret; - } - - FreeParamValueList(o); - - return 0; -} - -// Password decision prompt (for Prompt function) -wchar_t *CmdPromptChoosePassword(CONSOLE *c, void *param) -{ - char *s; - // Validate arguments - if (c == NULL) - { - return NULL; - } - - s = CmdPasswordPrompt(c); - - if (s == NULL) - { - return NULL; - } - else - { - wchar_t *ret = CopyStrToUni(s); - - Free(s); - - return ret; - } -} - -// Password input prompt (general-purpose) -char *CmdPasswordPrompt(CONSOLE *c) -{ - char *pw1, *pw2; - // Validate arguments - if (c == NULL) - { - return NULL; - } - - c->Write(c, _UU("CMD_VPNCMD_PWPROMPT_0")); - -RETRY: - c->Write(c, L""); - - - pw1 = c->ReadPassword(c, _UU("CMD_VPNCMD_PWPROMPT_1")); - if (pw1 == NULL) - { - return NULL; - } - - pw2 = c->ReadPassword(c, _UU("CMD_VPNCMD_PWPROMPT_2")); - if (pw2 == NULL) - { - Free(pw1); - return NULL; - } - - c->Write(c, L""); - - if (StrCmp(pw1, pw2) != 0) - { - Free(pw1); - Free(pw2); - c->Write(c, _UU("CMD_VPNCMD_PWPROMPT_3")); - goto RETRY; - } - - Free(pw1); - - return pw2; -} - -// Disable the listener -UINT PsListenerDisable(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) -{ - LIST *o; - PS *ps = (PS *)param; - UINT ret; - RPC_LISTENER t; - PARAM args[] = - { - {"[port]", CmdPromptPort, _UU("CMD_ListenerDisable_PortPrompt"), CmdEvalPort, NULL}, - }; - - o = ParseCommandList(c, cmd_name, str, args, sizeof(args) / sizeof(args[0])); - if (o == NULL) - { - return ERR_INVALID_PARAMETER; - } - - Zero(&t, sizeof(t)); - t.Enable = false; - t.Port = ToInt(GetParamStr(o, "[port]")); - - ret = ScEnableListener(ps->Rpc, &t); - - if (ret != ERR_NO_ERROR) - { - CmdPrintError(c, ret); - FreeParamValueList(o); - return ret; - } - - FreeParamValueList(o); - - return 0; -} - -// Enable the listener -UINT PsListenerEnable(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) -{ - LIST *o; - PS *ps = (PS *)param; - UINT ret; - RPC_LISTENER t; - PARAM args[] = - { - {"[port]", CmdPromptPort, _UU("CMD_ListenerEnable_PortPrompt"), CmdEvalPort, NULL}, - }; - - o = ParseCommandList(c, cmd_name, str, args, sizeof(args) / sizeof(args[0])); - if (o == NULL) - { - return ERR_INVALID_PARAMETER; - } - - Zero(&t, sizeof(t)); - t.Enable = true; - t.Port = ToInt(GetParamStr(o, "[port]")); - - ret = ScEnableListener(ps->Rpc, &t); - - if (ret != ERR_NO_ERROR) - { - CmdPrintError(c, ret); - FreeParamValueList(o); - return ret; - } - - FreeParamValueList(o); - - return 0; -} - -// Set UDP ports the server should listen on -UINT PsPortsUDPSet(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) -{ - LIST *o, *ports; - PS *ps = (PS *)param; - UINT ret; - RPC_PORTS t; - PARAM args[] = - { - {"[ports]", CmdPrompt, _UU("CMD_PortsUDPSet_[ports]"), CmdEvalPortList, (void *)false} - }; - - o = ParseCommandList(c, cmd_name, str, args, sizeof(args) / sizeof(args[0])); - if (o == NULL) - { - return ERR_INVALID_PARAMETER; - } - - ports = StrToPortList(GetParamStr(o, "[ports]"), false); - - FreeParamValueList(o); - - t.Num = LIST_NUM(ports); - if (t.Num > 0) - { - UINT i; - t.Ports = Malloc(sizeof(UINT) * t.Num); - - for (i = 0; i < t.Num; ++i) - { - t.Ports[i] = (UINT)LIST_DATA(ports, i); - } - } - else - { - t.Ports = NULL; - } - - ReleaseList(ports); - - ret = ScSetPortsUDP(ps->Rpc, &t); - if (ret != ERR_NO_ERROR) - { - CmdPrintError(c, ret); - } - - Free(t.Ports); - - return ret; -} - -// List UDP ports the server is listening on -UINT PsPortsUDPGet(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) -{ - LIST *o; - PS *ps = (PS *)param; - UINT ret; - RPC_PORTS t; - - o = ParseCommandList(c, cmd_name, str, NULL, 0); - if (o == NULL) - { - return ERR_INVALID_PARAMETER; - } - - FreeParamValueList(o); - - Zero(&t, sizeof(t)); - - ret = ScGetPortsUDP(ps->Rpc, &t); - if (ret == ERR_NO_ERROR) - { - wchar_t str[MAX_SIZE]; - CT *ct = CtNewStandard(); - - Zero(str, sizeof(str)); - - if (t.Num > 0) - { - UINT i; - wchar_t buf[MAX_SIZE]; - - UniFormat(buf, sizeof(buf), L"%u", t.Ports[0]); - UniStrCat(str, sizeof(str), buf); - - for (i = 1; i < t.Num; ++i) - { - UniFormat(buf, sizeof(buf), L", %u", t.Ports[i]); - UniStrCat(str, sizeof(str), buf); - } - } - - CtInsert(ct, _UU("CMD_PortsUDPGet_Ports"), str); - CtFree(ct, c); - } - else - { - CmdPrintError(c, ret); - } - - FreeRpcPorts(&t); - - return ret; -} - -// Configure an option for the specified protocol (TODO: ability to set multiple options in a single call) -UINT PsProtoOptionsSet(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) -{ - LIST *o; - PS *ps = (PS *)param; - UINT ret; - RPC_PROTO_OPTIONS t; - PARAM args[] = - { - {"[protocol]", CmdPrompt, _UU("CMD_ProtoOptionsSet_Prompt_[protocol]"), CmdEvalNotEmpty, NULL}, - {"NAME", CmdPrompt, _UU("CMD_ProtoOptionsSet_Prompt_NAME"), CmdEvalNotEmpty, NULL}, - {"VALUE", CmdPrompt, _UU("CMD_ProtoOptionsSet_Prompt_VALUE"), NULL, NULL} - }; - - o = ParseCommandList(c, cmd_name, str, args, sizeof(args) / sizeof(args[0])); - if (o == NULL) - { - return ERR_INVALID_PARAMETER; - } - - Zero(&t, sizeof(t)); - t.Protocol = CopyStr(GetParamStr(o, "[protocol]")); - - ret = ScGetProtoOptions(ps->Rpc, &t); - - if (ret == ERR_NO_ERROR) - { - UINT i; - bool found = false; - - for (i = 0; i < t.Num; ++i) - { - PROTO_OPTION *option = &t.Options[i]; - if (StrCmpi(option->Name, GetParamStr(o, "NAME")) != 0) - { - continue; - } - - found = true; - - switch (option->Type) - { - case PROTO_OPTION_STRING: - Free(option->String); - option->String = CopyStr(GetParamStr(o, "VALUE")); - break; - case PROTO_OPTION_BOOL: - option->Bool = GetParamYes(o, "VALUE"); - break; - default: - ret = ERR_INTERNAL_ERROR; - } - - if (ret == ERR_NO_ERROR) - { - ret = ScSetProtoOptions(ps->Rpc, &t); - } - - break; - } - - if (found == false) - { - ret = ERR_OBJECT_NOT_FOUND; - } - } - - if (ret != ERR_NO_ERROR) - { - CmdPrintError(c, ret); - } - - FreeRpcProtoOptions(&t); - FreeParamValueList(o); - - return ret; -} - -// List available options for the specified protocol -UINT PsProtoOptionsGet(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) -{ - LIST *o; - PS *ps = (PS *)param; - UINT ret; - RPC_PROTO_OPTIONS t; - PARAM args[] = - { - {"[protocol]", CmdPrompt, _UU("CMD_ProtoOptionsGet_Prompt_[protocol]"), CmdEvalNotEmpty, NULL} - }; - - o = ParseCommandList(c, cmd_name, str, args, sizeof(args) / sizeof(args[0])); - if (o == NULL) - { - return ERR_INVALID_PARAMETER; - } - - Zero(&t, sizeof(t)); - t.Protocol = CopyStr(GetParamStr(o, "[protocol]")); - - FreeParamValueList(o); - - ret = ScGetProtoOptions(ps->Rpc, &t); - if (ret == ERR_NO_ERROR) - { - UINT i; - CT *ct = CtNew(); - CtInsertColumn(ct, _UU("CMD_ProtoOptionsGet_Column_Name"), false); - CtInsertColumn(ct, _UU("CMD_ProtoOptionsGet_Column_Type"), false); - CtInsertColumn(ct, _UU("CMD_ProtoOptionsGet_Column_Value"), false); - CtInsertColumn(ct, _UU("CMD_ProtoOptionsGet_Column_Description"), false); - - for (i = 0; i < t.Num; ++i) - { - char description_str_key[MAX_SIZE]; - const PROTO_OPTION *option = &t.Options[i]; - wchar_t *value, *type, *name = CopyStrToUni(option->Name); - - switch (option->Type) - { - case PROTO_OPTION_BOOL: - type = L"Boolean"; - value = option->Bool ? L"True" : L"False"; - break; - case PROTO_OPTION_STRING: - type = L"String"; - value = CopyStrToUni(option->String); - break; - default: - Debug("StGetProtoOptions(): unhandled option type %u!\n", option->Type); - Free(name); - continue; - } - - Format(description_str_key, sizeof(description_str_key), "CMD_ProtoOptions_Description_%s_%s", t.Protocol, option->Name); - - CtInsert(ct, name, type, value, _UU(description_str_key)); - - if (option->Type == PROTO_OPTION_STRING) - { - Free(value); - } - - Free(name); - } - - CtFree(ct, c); - } - else - { - CmdPrintError(c, ret); - } - - FreeRpcProtoOptions(&t); - - return ret; -} - -// Draw a row of console table -void CtPrintRow(CONSOLE *c, UINT num, UINT *widths, wchar_t **strings, bool *rights, char separate_char) -{ - UINT i; - wchar_t *buf; - UINT buf_size; - bool is_sep_line = true; - // Validate arguments - if (c == NULL || num == 0 || widths == NULL || strings == NULL || rights == NULL) - { - return; - } - - buf_size = 32; - for (i = 0;i < num;i++) - { - buf_size += sizeof(wchar_t) * widths[i] + 6; - } - - buf = ZeroMalloc(buf_size); - - for (i = 0;i < num;i++) - { - char *tmp; - wchar_t *space_string; - UINT w; - UINT space = 0; - wchar_t *string = strings[i]; - wchar_t *tmp_line = NULL; - - if (UniStrCmpi(string, L"---") == 0) - { - char *s = MakeCharArray('-', widths[i]); - tmp_line = string = CopyStrToUni(s); - - Free(s); - } - else - { - is_sep_line = false; - } - - w = UniStrWidth(string); - - if (widths[i] >= w) - { - space = widths[i] - w; - } - - tmp = MakeCharArray(' ', space); - space_string = CopyStrToUni(tmp); - - if (rights[i] != false) - { - UniStrCat(buf, buf_size, space_string); - } - - UniStrCat(buf, buf_size, string); - - if (rights[i] == false) - { - UniStrCat(buf, buf_size, space_string); - } - - Free(space_string); - Free(tmp); - - if (i < (num - 1)) - { - wchar_t tmp[4]; - char str[2]; - - if (UniStrCmpi(strings[i], L"---") == 0) - { - str[0] = '+'; - } - else - { - str[0] = separate_char; - } - str[1] = 0; - - StrToUni(tmp, sizeof(tmp), str); - - UniStrCat(buf, buf_size, tmp); - } - - if (tmp_line != NULL) - { - Free(tmp_line); - } - } - - UniTrimRight(buf); - - if (is_sep_line) - { - if (UniStrLen(buf) > (c->GetWidth(c) - 1)) - { - buf[c->GetWidth(c) - 1] = 0; - } - } - - c->Write(c, buf); - - Free(buf); -} - -// Draw the console table in standard format -void CtPrintStandard(CT *ct, CONSOLE *c) -{ - CT *t; - UINT i, j; - // Validate arguments - if (ct == NULL || c == NULL) - { - return; - } - - t = CtNewStandard(); - for (i = 0;i < LIST_NUM(ct->Rows);i++) - { - CTR *row = LIST_DATA(ct->Rows, i); - - for (j = 0;j < LIST_NUM(ct->Columns);j++) - { - CTC *column = LIST_DATA(ct->Columns, j); - - CtInsert(t, column->String, row->Strings[j]); - } - - if (i != (LIST_NUM(ct->Rows) - 1)) - { - CtInsert(t, L"---", L"---"); - } - } - - CtFree(t, c); -} - -// Draw the console table -void CtPrint(CT *ct, CONSOLE *c) -{ - UINT *widths; - UINT num; - UINT i, j; - wchar_t **header_strings; - bool *rights; - // Validate arguments - if (ct == NULL || c == NULL) - { - return; - } - - num = LIST_NUM(ct->Columns); - widths = ZeroMalloc(sizeof(UINT) * num); - - // Calculate the maximum character width of each column - for (i = 0;i < num;i++) - { - CTC *ctc = LIST_DATA(ct->Columns, i); - UINT w; - - w = UniStrWidth(ctc->String); - widths[i] = MAX(widths[i], w); - } - for (j = 0;j < LIST_NUM(ct->Rows);j++) - { - CTR *ctr = LIST_DATA(ct->Rows, j); - - for (i = 0;i < num;i++) - { - UINT w; - - w = UniStrWidth(ctr->Strings[i]); - widths[i] = MAX(widths[i], w); - } - } - - // Display the header part - header_strings = ZeroMalloc(sizeof(wchar_t *) * num); - rights = ZeroMalloc(sizeof(bool) * num); - - for (i = 0;i < num;i++) - { - CTC *ctc = LIST_DATA(ct->Columns, i); - - header_strings[i] = ctc->String; - rights[i] = ctc->Right; - } - - CtPrintRow(c, num, widths, header_strings, rights, '|'); - - for (i = 0;i < num;i++) - { - char *s; - - s = MakeCharArray('-', widths[i]); - header_strings[i] = CopyStrToUni(s); - Free(s); - } - - CtPrintRow(c, num, widths, header_strings, rights, '+'); - - for (i = 0;i < num;i++) - { - Free(header_strings[i]); - } - - // Display the data part - for (j = 0;j < LIST_NUM(ct->Rows);j++) - { - CTR *ctr = LIST_DATA(ct->Rows, j); - - CtPrintRow(c, num, widths, ctr->Strings, rights, '|'); - } - - Free(rights); - Free(header_strings); - Free(widths); -} - -// Escape the meta-characters in CSV -void CtEscapeCsv(wchar_t *dst, UINT size, wchar_t *src){ - UINT i; - UINT len = UniStrLen(src); - UINT idx; - BOOL need_to_escape = false; - wchar_t tmp[2]=L"*"; - - // Check the input value - if (src==NULL || dst==NULL) - { - return; - } - - // If there is no character that need to be escaped in the input characters, copy it to the output - for (i=0; iColumns); - wchar_t buf[MAX_SIZE*4]; - wchar_t fmtbuf[MAX_SIZE*4]; - - // Show the heading row - buf[0] = 0; - for(i=0; iColumns, i); - CtEscapeCsv(fmtbuf, sizeof(fmtbuf), ctc->String); - UniStrCat(buf, sizeof(buf), fmtbuf); - if(i != num_columns-1) - UniStrCat(buf, sizeof(buf), L","); - } - c->Write(c, buf); - - // Show the table body - for(j=0; jRows); j++) - { - CTR *ctr = LIST_DATA(ct->Rows, j); - buf[0] = 0; - for(i=0; iStrings[i]); - UniStrCat(buf, sizeof(buf), fmtbuf); - if(i != num_columns-1) - UniStrCat(buf, sizeof(buf), L","); - } - c->Write(c, buf); - } -} - -// Delete the console table -void CtFreeEx(CT *ct, CONSOLE *c, bool standard_view) -{ - UINT i, num; - // Validate arguments - if (ct == NULL) - { - return; - } - - if (c != NULL) - { - if (c->ConsoleType == CONSOLE_CSV) - { - CtPrintCsv(ct, c); - } - else - { - if (standard_view == false) - { - CtPrint(ct, c); - } - else - { - CtPrintStandard(ct, c); - } - } - } - - num = LIST_NUM(ct->Columns); - - for (i = 0;i < LIST_NUM(ct->Rows);i++) - { - UINT j; - CTR *ctr = LIST_DATA(ct->Rows, i); - - for (j = 0;j < num;j++) - { - Free(ctr->Strings[j]); - } - - Free(ctr->Strings); - Free(ctr); - } - - for (i = 0;i < LIST_NUM(ct->Columns);i++) - { - CTC *ctc = LIST_DATA(ct->Columns, i); - - Free(ctc->String); - Free(ctc); - } - - ReleaseList(ct->Columns); - ReleaseList(ct->Rows); - - Free(ct); -} -void CtFree(CT *ct, CONSOLE *c) -{ - CtFreeEx(ct, c, false); -} - -// Add a row to the table -void CtInsert(CT *ct, ...) -{ - CTR *ctr; - UINT num, i; - va_list va; - // Validate arguments - if (ct == NULL) - { - return; - } - - num = LIST_NUM(ct->Columns); - - va_start(va, ct); - - ctr = ZeroMalloc(sizeof(CTR)); - ctr->Strings = ZeroMalloc(sizeof(wchar_t *) * num); - - for (i = 0;i < num;i++) - { - wchar_t *s = va_arg(va, wchar_t *); - - ctr->Strings[i] = CopyUniStr(s); - } - - va_end(va); - - Insert(ct->Rows, ctr); -} - -// Add a column to the table -void CtInsertColumn(CT *ct, wchar_t *str, bool right) -{ - CTC *ctc; - // Validate arguments - if (ct == NULL) - { - return; - } - if (str == NULL) - { - str = L""; - } - - ctc = ZeroMalloc(sizeof(CTC)); - ctc->String = CopyUniStr(str); - ctc->Right = right; - - Insert(ct->Columns, ctc); -} - -// Create a new console table -CT *CtNew() -{ - CT *ct; - - ct = ZeroMalloc(sizeof(CT)); - ct->Columns = NewList(NULL); - ct->Rows = NewList(NULL); - - return ct; -} - -// Add a standard column to a column in a table -CT *CtNewStandard() -{ - CT *ct = CtNew(); - - CtInsertColumn(ct, _UU("CMD_CT_STD_COLUMN_1"), false); - CtInsertColumn(ct, _UU("CMD_CT_STD_COLUMN_2"), false); - - return ct; -} -CT *CtNewStandardEx() -{ - CT *ct = CtNew(); - - CtInsertColumn(ct, _UU("CMD_CT_STD_COLUMN_1"), false); - CtInsertColumn(ct, _UU("CMD_CT_STD_COLUMN_2"), false); - CtInsertColumn(ct, _UU("CMD_CT_STD_COLUMN_3"), false); - - return ct; -} - -// Get the TCP listener list -UINT PsListenerList(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) -{ - LIST *o; - PS *ps = (PS *)param; - UINT ret; - RPC_LISTENER_LIST t; - UINT i; - CT *ct; - - o = ParseCommandList(c, cmd_name, str, NULL, 0); - if (o == NULL) - { - return ERR_INVALID_PARAMETER; - } - - Zero(&t, sizeof(t)); - - ret = ScEnumListener(ps->Rpc, &t); - - if (ret != ERR_NO_ERROR) - { - CmdPrintError(c, ret); - FreeParamValueList(o); - return ret; - } - - ct = CtNew(); - - CtInsertColumn(ct, _UU("CM_LISTENER_COLUMN_1"), false); - CtInsertColumn(ct, _UU("CM_LISTENER_COLUMN_2"), false); - - for (i = 0;i < t.NumPort;i++) - { - wchar_t *status = _UU("CM_LISTENER_OFFLINE"); - wchar_t tmp[128]; - - if (t.Errors[i]) - { - status = _UU("CM_LISTENER_ERROR"); - } - else if (t.Enables[i]) - { - status = _UU("CM_LISTENER_ONLINE"); - } - - UniFormat(tmp, sizeof(tmp), _UU("CM_LISTENER_TCP_PORT"), t.Ports[i]); - - CtInsert(ct, tmp, status); - } - - CtFree(ct, c); - - FreeRpcListenerList(&t); - - FreeParamValueList(o); - - return 0; -} - -// Delete the TCP listener -UINT PsListenerDelete(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) -{ - LIST *o; - PS *ps = (PS *)param; - UINT ret; - RPC_LISTENER t; - PARAM args[] = - { - {"[port]", CmdPromptPort, _UU("CMD_ListenerDelete_PortPrompt"), CmdEvalPort, NULL}, - }; - - o = ParseCommandList(c, cmd_name, str, args, sizeof(args) / sizeof(args[0])); - if (o == NULL) - { - return ERR_INVALID_PARAMETER; - } - - Zero(&t, sizeof(t)); - t.Enable = true; - t.Port = ToInt(GetParamStr(o, "[port]")); - - ret = ScDeleteListener(ps->Rpc, &t); - - if (ret != ERR_NO_ERROR) - { - CmdPrintError(c, ret); - FreeParamValueList(o); - return ret; - } - - FreeParamValueList(o); - - return 0; -} - -// ServerInfoGet command -UINT PsServerInfoGet(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) -{ - LIST *o; - PS *ps = (PS *)param; - UINT ret; - RPC_SERVER_INFO t; - CT *ct; - wchar_t tmp[MAX_SIZE]; - - o = ParseCommandList(c, cmd_name, str, NULL, 0); - if (o == NULL) - { - return ERR_INVALID_PARAMETER; - } - - Zero(&t, sizeof(t)); - ret = ScGetServerInfo(ps->Rpc, &t); - if (ret != ERR_NO_ERROR) - { - CmdPrintError(c, ret); - FreeParamValueList(o); - return ret; - } - - ct = CtNew(); - - CtInsertColumn(ct, _UU("SM_STATUS_COLUMN_1"), false); - CtInsertColumn(ct, _UU("SM_STATUS_COLUMN_2"), false); - - // Product name - StrToUni(tmp, sizeof(tmp), t.ServerProductName); - CtInsert(ct, _UU("SM_INFO_PRODUCT_NAME"), tmp); - - // Version - StrToUni(tmp, sizeof(tmp), t.ServerVersionString); - CtInsert(ct, _UU("SM_INFO_VERSION"), tmp); - - // Build - StrToUni(tmp, sizeof(tmp), t.ServerBuildInfoString); - CtInsert(ct, _UU("SM_INFO_BUILD"), tmp); - - // Host name - StrToUni(tmp, sizeof(tmp), t.ServerHostName); - CtInsert(ct, _UU("SM_INFO_HOSTNAME"), tmp); - - // Type - CtInsert(ct, _UU("SM_ST_SERVER_TYPE"), GetServerTypeStr(t.ServerType)); - - // OS - StrToUni(tmp, sizeof(tmp), t.OsInfo.OsSystemName); - CtInsert(ct, _UU("SM_OS_SYSTEM_NAME"), tmp); - - StrToUni(tmp, sizeof(tmp), t.OsInfo.OsProductName); - CtInsert(ct, _UU("SM_OS_PRODUCT_NAME"), tmp); - - if (t.OsInfo.OsServicePack != 0) - { - UniFormat(tmp, sizeof(tmp), _UU("SM_OS_SP_TAG"), t.OsInfo.OsServicePack); - CtInsert(ct, _UU("SM_OS_SERVICE_PACK"), tmp); - } - - StrToUni(tmp, sizeof(tmp), t.OsInfo.OsVendorName); - CtInsert(ct, _UU("SM_OS_VENDER_NAME"), tmp); - - StrToUni(tmp, sizeof(tmp), t.OsInfo.OsVersion); - CtInsert(ct, _UU("SM_OS_VERSION"), tmp); - - StrToUni(tmp, sizeof(tmp), t.OsInfo.KernelName); - CtInsert(ct, _UU("SM_OS_KERNEL_NAME"), tmp); - - StrToUni(tmp, sizeof(tmp), t.OsInfo.KernelVersion); - CtInsert(ct, _UU("SM_OS_KERNEL_VERSION"), tmp); - - CtFree(ct, c); - - FreeRpcServerInfo(&t); - - FreeParamValueList(o); - - return 0; -} - -// Get the string for type of the HUB -wchar_t *GetHubTypeStr(UINT type) -{ - if (type == HUB_TYPE_FARM_STATIC) - { - return _UU("SM_HUB_STATIC"); - } - else if (type == HUB_TYPE_FARM_DYNAMIC) - { - return _UU("SM_HUB_DYNAMIC"); - } - return _UU("SM_HUB_STANDALONE"); -} - -// Get a string of the type of server -wchar_t *GetServerTypeStr(UINT type) -{ - if (type == SERVER_TYPE_FARM_CONTROLLER) - { - return _UU("SM_FARM_CONTROLLER"); - } - else if (type == SERVER_TYPE_FARM_MEMBER) - { - return _UU("SM_FARM_MEMBER"); - } - return _UU("SM_SERVER_STANDALONE"); -} - -// ServerStatusGet command -UINT PsServerStatusGet(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) -{ - LIST *o; - PS *ps = (PS *)param; - UINT ret; - RPC_SERVER_STATUS t; - wchar_t tmp[MAX_PATH]; - char tmp2[MAX_PATH]; - CT *ct; - - o = ParseCommandList(c, cmd_name, str, NULL, 0); - if (o == NULL) - { - return ERR_INVALID_PARAMETER; - } - - Zero(&t, sizeof(t)); - ret = ScGetServerStatus(ps->Rpc, &t); - if (ret != ERR_NO_ERROR) - { - CmdPrintError(c, ret); - FreeParamValueList(o); - return ret; - } - - ct = CtNew(); - - CtInsertColumn(ct, _UU("SM_STATUS_COLUMN_1"), false); - CtInsertColumn(ct, _UU("SM_STATUS_COLUMN_2"), false); - - // Type of server - CtInsert(ct, _UU("SM_ST_SERVER_TYPE"), - t.ServerType == SERVER_TYPE_STANDALONE ? _UU("SM_SERVER_STANDALONE") : - t.ServerType == SERVER_TYPE_FARM_MEMBER ? _UU("SM_FARM_MEMBER") : _UU("SM_FARM_CONTROLLER")); - - // Number of TCP connections - UniToStru(tmp, t.NumTcpConnections); - CtInsert(ct, _UU("SM_ST_NUM_TCP"), tmp); - - if (t.ServerType == SERVER_TYPE_FARM_CONTROLLER) - { - // Number of local TCP connections - UniToStru(tmp, t.NumTcpConnectionsLocal); - CtInsert(ct, _UU("SM_ST_NUM_TCP_LOCAL"), tmp); - - // Number of remote TCP connections - UniToStru(tmp, t.NumTcpConnectionsRemote); - CtInsert(ct, _UU("SM_ST_NUM_TCP_REMOTE"), tmp); - } - - // Number of Virtual HUBs - UniToStru(tmp, t.NumHubTotal); - CtInsert(ct, _UU("SM_ST_NUM_HUB_TOTAL"), tmp); - - if (t.ServerType != SERVER_TYPE_STANDALONE) - { - // Number of static HUBs - UniToStru(tmp, t.NumHubStatic); - CtInsert(ct, _UU("SM_ST_NUM_HUB_STATIC"), tmp); - - // Number of dynamic HUBs - UniToStru(tmp, t.NumHubDynamic); - CtInsert(ct, _UU("SM_ST_NUM_HUB_DYNAMIC"), tmp); - } - - // Number of sessions - UniToStru(tmp, t.NumSessionsTotal); - CtInsert(ct, _UU("SM_ST_NUM_SESSION_TOTAL"), tmp); - - if (t.ServerType == SERVER_TYPE_FARM_CONTROLLER) - { - // Number of local sessions - UniToStru(tmp, t.NumSessionsLocal); - CtInsert(ct, _UU("SM_ST_NUM_SESSION_LOCAL"), tmp); - - // Number of remote sessions - UniToStru(tmp, t.NumSessionsRemote); - CtInsert(ct, _UU("SM_ST_NUM_SESSION_REMOTE"), tmp); - } - - // Number of MAC tables - UniToStru(tmp, t.NumMacTables); - CtInsert(ct, _UU("SM_ST_NUM_MAC_TABLE"), tmp); - - // Number of IP tables - UniToStru(tmp, t.NumIpTables); - CtInsert(ct, _UU("SM_ST_NUM_IP_TABLE"), tmp); - - // Number of users - UniToStru(tmp, t.NumUsers); - CtInsert(ct, _UU("SM_ST_NUM_USERS"), tmp); - - // Number of groups - UniToStru(tmp, t.NumGroups); - CtInsert(ct, _UU("SM_ST_NUM_GROUPS"), tmp); - - // Number of assigned licenses - UniToStru(tmp, t.AssignedClientLicenses); - CtInsert(ct, _UU("SM_ST_CLIENT_LICENSE"), tmp); - - UniToStru(tmp, t.AssignedBridgeLicenses); - CtInsert(ct, _UU("SM_ST_BRIDGE_LICENSE"), tmp); - - if (t.ServerType == SERVER_TYPE_FARM_CONTROLLER) - { - UniToStru(tmp, t.AssignedClientLicensesTotal); - CtInsert(ct, _UU("SM_ST_CLIENT_LICENSE_EX"), tmp); - - UniToStru(tmp, t.AssignedBridgeLicensesTotal); - CtInsert(ct, _UU("SM_ST_BRIDGE_LICENSE_EX"), tmp); - } - - // Traffic - CmdInsertTrafficInfo(ct, &t.Traffic); - - // Server start-up time - GetDateTimeStrEx64(tmp, sizeof(tmp), SystemToLocal64(t.StartTime), NULL); - CtInsert(ct, _UU("SM_ST_START_TIME"), tmp); - - // Current time - GetDateTimeStrMilli64(tmp2, sizeof(tmp2), SystemToLocal64(t.CurrentTime)); - StrToUni(tmp, sizeof(tmp), tmp2); - CtInsert(ct, _UU("SM_ST_CURRENT_TIME"), tmp); - - // Tick value - UniFormat(tmp, sizeof(tmp), L"%I64u", t.CurrentTick); - CtInsert(ct, _UU("SM_ST_CURRENT_TICK"), tmp); - - // Memory information - if (t.MemInfo.TotalMemory != 0) - { - char vv[128]; - - ToStr3(vv, sizeof(vv), t.MemInfo.TotalMemory); - UniFormat(tmp, sizeof(tmp), _UU("SM_ST_RAM_SIZE_KB"), vv); - CtInsert(ct, _UU("SM_ST_TOTAL_MEMORY"), tmp); - - ToStr3(vv, sizeof(vv), t.MemInfo.UsedMemory); - UniFormat(tmp, sizeof(tmp), _UU("SM_ST_RAM_SIZE_KB"), vv); - CtInsert(ct, _UU("SM_ST_USED_MEMORY"), tmp); - - ToStr3(vv, sizeof(vv), t.MemInfo.FreeMemory); - UniFormat(tmp, sizeof(tmp), _UU("SM_ST_RAM_SIZE_KB"), vv); - CtInsert(ct, _UU("SM_ST_FREE_MEMORY"), tmp); - - ToStr3(vv, sizeof(vv), t.MemInfo.TotalPhys); - UniFormat(tmp, sizeof(tmp), _UU("SM_ST_RAM_SIZE_KB"), vv); - CtInsert(ct, _UU("SM_ST_TOTAL_PHYS"), tmp); - - ToStr3(vv, sizeof(vv), t.MemInfo.UsedPhys); - UniFormat(tmp, sizeof(tmp), _UU("SM_ST_RAM_SIZE_KB"), vv); - CtInsert(ct, _UU("SM_ST_USED_PHYS"), tmp); - - ToStr3(vv, sizeof(vv), t.MemInfo.FreePhys); - UniFormat(tmp, sizeof(tmp), _UU("SM_ST_RAM_SIZE_KB"), vv); - CtInsert(ct, _UU("SM_ST_FREE_PHYS"), tmp); - } - - CtFree(ct, c); - - FreeParamValueList(o); - - return 0; -} - -// Add traffic information to LVB -void CmdInsertTrafficInfo(CT *ct, TRAFFIC *t) -{ - wchar_t tmp[MAX_SIZE]; - char vv[128]; - // Validate arguments - if (ct == NULL || t == NULL) - { - return; - } - - // Transmission information - ToStr3(vv, sizeof(vv), t->Send.UnicastCount); - UniFormat(tmp, sizeof(tmp), _UU("SM_ST_NUM_PACKET_STR"), vv); - CtInsert(ct, _UU("SM_ST_SEND_UCAST_NUM"), tmp); - - ToStr3(vv, sizeof(vv), t->Send.UnicastBytes); - UniFormat(tmp, sizeof(tmp), _UU("SM_ST_SIZE_BYTE_STR"), vv); - CtInsert(ct, _UU("SM_ST_SEND_UCAST_SIZE"), tmp); - - ToStr3(vv, sizeof(vv), t->Send.BroadcastCount); - UniFormat(tmp, sizeof(tmp), _UU("SM_ST_NUM_PACKET_STR"), vv); - CtInsert(ct, _UU("SM_ST_SEND_BCAST_NUM"), tmp); - - ToStr3(vv, sizeof(vv), t->Send.BroadcastBytes); - UniFormat(tmp, sizeof(tmp), _UU("SM_ST_SIZE_BYTE_STR"), vv); - CtInsert(ct, _UU("SM_ST_SEND_BCAST_SIZE"), tmp); - - // Reception information - ToStr3(vv, sizeof(vv), t->Recv.UnicastCount); - UniFormat(tmp, sizeof(tmp), _UU("SM_ST_NUM_PACKET_STR"), vv); - CtInsert(ct, _UU("SM_ST_RECV_UCAST_NUM"), tmp); - - ToStr3(vv, sizeof(vv), t->Recv.UnicastBytes); - UniFormat(tmp, sizeof(tmp), _UU("SM_ST_SIZE_BYTE_STR"), vv); - CtInsert(ct, _UU("SM_ST_RECV_UCAST_SIZE"), tmp); - - ToStr3(vv, sizeof(vv), t->Recv.BroadcastCount); - UniFormat(tmp, sizeof(tmp), _UU("SM_ST_NUM_PACKET_STR"), vv); - CtInsert(ct, _UU("SM_ST_RECV_BCAST_NUM"), tmp); - - ToStr3(vv, sizeof(vv), t->Recv.BroadcastBytes); - UniFormat(tmp, sizeof(tmp), _UU("SM_ST_SIZE_BYTE_STR"), vv); - CtInsert(ct, _UU("SM_ST_RECV_BCAST_SIZE"), tmp); -} - -// Input a port number -wchar_t *CmdPromptPort(CONSOLE *c, void *param) -{ - wchar_t *prompt_str; - - if (param != NULL) - { - prompt_str = (wchar_t *)param; - } - else - { - prompt_str = _UU("CMD_PROMPT_PORT"); - } - - return c->ReadLine(c, prompt_str, true); -} - -// Verify the port number -bool CmdEvalPort(CONSOLE *c, wchar_t *str, void *param) -{ - UINT i; - // Validate arguments - if (c == NULL || str == NULL) - { - return false; - } - - i = UniToInt(str); - - if (i >= 1 && i <= 65535) - { - return true; - } - - c->Write(c, _UU("CMD_EVAL_PORT")); - - return false; -} - -// ListenerCreate command -UINT PsListenerCreate(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) -{ - LIST *o; - PS *ps = (PS *)param; - UINT ret; - RPC_LISTENER t; - PARAM args[] = - { - {"[port]", CmdPromptPort, _UU("CMD_ListenerCreate_PortPrompt"), CmdEvalPort, NULL}, - }; - - o = ParseCommandList(c, cmd_name, str, args, sizeof(args) / sizeof(args[0])); - if (o == NULL) - { - return ERR_INVALID_PARAMETER; - } - - Zero(&t, sizeof(t)); - t.Enable = true; - t.Port = ToInt(GetParamStr(o, "[port]")); - - ret = ScCreateListener(ps->Rpc, &t); - - if (ret != ERR_NO_ERROR) - { - CmdPrintError(c, ret); - FreeParamValueList(o); - return ret; - } - - FreeParamValueList(o); - - return 0; -} - -// About command -UINT PsAbout(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) -{ - LIST *o; - BUF *b; - - o = ParseCommandList(c, cmd_name, str, NULL, 0); - if (o == NULL) - { - return ERR_INVALID_PARAMETER; - } - - b = ReadDump("|legal.txt"); - - CmdPrintAbout(c); - c->Write(c, L"\r\n"); - - if (b != NULL) - { - wchar_t *s; - - SeekBufToEnd(b); - WriteBufChar(b, 13); - WriteBufChar(b, 10); - WriteBufChar(b, 0); - - s = CopyUtfToUni(b->Buf); - - c->Write(c, s); - - Free(s); - } - - // Display the version information - c->Write(c, _UU("D_ABOUT@S_INFO3")); - c->Write(c, L"\r\n"); - c->Write(c, _UU("D_ABOUT@S_INFO4")); - c->Write(c, L"\r\n"); - CmdPrintAbout(c); - c->Write(c, L"\r\n"); - - FreeParamValueList(o); - - FreeBuf(b); - - return 0; -} - -// Creat a new server management context -PS *NewPs(CONSOLE *c, RPC *rpc, char *servername, UINT serverport, char *hubname, char *adminhub, wchar_t *cmdline) -{ - PS *ps; - // Validate arguments - if (c == NULL || rpc == NULL || servername == NULL) - { - return NULL; - } - - if (IsEmptyStr(hubname)) - { - hubname = NULL; - } - if (IsEmptyStr(adminhub)) - { - adminhub = NULL; - } - if (UniIsEmptyStr(cmdline)) - { - cmdline = NULL; - } - - ps = ZeroMalloc(sizeof(PS)); - ps->ConsoleForServer = true; - ps->ServerPort = serverport; - ps->ServerName = CopyStr(servername); - ps->Console = c; - ps->Rpc = rpc; - ps->HubName = CopyStr(hubname); - ps->LastError = 0; - ps->AdminHub = CopyStr(adminhub); - ps->CmdLine = CopyUniStr(cmdline); - - return ps; -} - -// Release the server management context -void FreePs(PS *ps) -{ - // Validate arguments - if (ps == NULL) - { - return; - } - - Free(ps->HubName); - Free(ps->AdminHub); - Free(ps->CmdLine); - Free(ps->ServerName); - - Free(ps); -} - -// Server Administration Tool -UINT PsConnect(CONSOLE *c, char *host, UINT port, char *hub, char *adminhub, wchar_t *cmdline, char *password) -{ - UINT retcode = 0; - RPC *rpc = NULL; - CEDAR *cedar; - CLIENT_OPTION o; - UCHAR hashed_password[SHA1_SIZE]; - bool b = false; - // Validate arguments - if (c == NULL || host == NULL) - { - return ERR_INVALID_PARAMETER; - } - if (port == 0) - { - port = 443; - } - if (hub != NULL) - { - adminhub = NULL; - } - - cedar = NewCedar(NULL, NULL); - - Zero(&o, sizeof(o)); - UniStrCpy(o.AccountName, sizeof(o.AccountName), L"VPNCMD"); - StrCpy(o.Hostname, sizeof(o.Hostname), host); - o.Port = port; - o.ProxyType = PROXY_DIRECT; - - Sha0(hashed_password, password, StrLen(password)); - - if (IsEmptyStr(password) == false) - { - b = true; - } - - // Connect - while (true) - { - UINT err; - - rpc = AdminConnectEx(cedar, &o, hub, hashed_password, &err, CEDAR_CUI_STR); - if (rpc == NULL) - { - // Failure - retcode = err; - - if (err == ERR_ACCESS_DENIED && c->ProgrammingMode == false) - { - char *pass; - // Password is incorrect - if (b) - { - // Input the password - c->Write(c, _UU("CMD_VPNCMD_PASSWORD_1")); - } - - b = true; - - pass = c->ReadPassword(c, _UU("CMD_VPNCMD_PASSWORD_2")); - c->Write(c, L""); - - if (pass != NULL) - { - Sha0(hashed_password, pass, StrLen(pass)); - Free(pass); - } - else - { - break; - } - } - else - { - // Other errors - CmdPrintError(c, err); - break; - } - } - else - { - PS *ps; - - // Success - ps = NewPs(c, rpc, host, port, hub, adminhub, cmdline); - PsMain(ps); - retcode = ps->LastError; - FreePs(ps); - AdminDisconnect(rpc); - break; - } - } - - ReleaseCedar(cedar); - - return retcode; -} - -// Display the error -void CmdPrintError(CONSOLE *c, UINT err) -{ - wchar_t tmp[MAX_SIZE]; - // Validate arguments - if (c == NULL) - { - return; - } - - UniFormat(tmp, sizeof(tmp), _UU("CMD_VPNCMD_ERROR"), - err, GetUniErrorStr(err)); - c->Write(c, tmp); - - if (err == ERR_DISCONNECTED) - { - c->Write(c, _UU("CMD_DISCONNECTED_MSG")); - } -} - -// Display the version information -void CmdPrintAbout(CONSOLE *c) -{ - CEDAR *cedar; - wchar_t tmp[MAX_SIZE]; - char exe[MAX_PATH]; - // Validate arguments - if (c == NULL) - { - return; - } - - cedar = NewCedar(NULL, NULL); - - GetExeName(exe, sizeof(exe)); - - UniFormat(tmp, sizeof(tmp), _UU("CMD_VPNCMD_ABOUT"), - cedar->VerString, cedar->BuildInfo); - - c->Write(c, tmp); - - ReleaseCedar(cedar); -} - -// Parse the host name and port number (Separated by @) -bool ParseHostPortAtmark(char *src, char **host, UINT *port, UINT default_port) -{ - TOKEN_LIST *t; - bool ret = false; - // Validate arguments - if (src == NULL) - { - return false; - } - - t = ParseToken(src, "@"); - if (t == NULL) - { - return false; - } - - if (port != NULL) - { - *port = 0; - } - - if (default_port == 0) - { - if (t->NumTokens < 2) - { - FreeToken(t); - return false; - } - - if (ToInt(t->Token[1]) == 0) - { - FreeToken(t); - return false; - } - } - - if (t->NumTokens >= 2 && ToInt(t->Token[1]) == 0) - { - FreeToken(t); - return false; - } - - if (t->NumTokens >= 1 && IsEmptyStr(t->Token[0]) == false) - { - ret = true; - - if (host != NULL) - { - *host = CopyStr(t->Token[0]); - Trim(*host); - } - - if (t->NumTokens >= 2) - { - if (port != NULL) - { - *port = ToInt(t->Token[1]); - } - } - } - - if (port != NULL) - { - if (*port == 0) - { - *port = default_port; - } - } - - FreeToken(t); - - return ret; -} - -// Parse the host name and port number -bool ParseHostPort(char *src, char **host, UINT *port, UINT default_port) -{ - TOKEN_LIST *t; - bool ret = false; - // Validate arguments - if (src == NULL) - { - return false; - } - - if (StartWith(src, "[")) - { - if (InStr(src, "]")) - { - // Format of [target]:port - UINT i, n; - char tmp[MAX_SIZE]; - - StrCpy(tmp, sizeof(tmp), src); - - n = SearchStrEx(tmp, "]", 0, false); - if (n != INFINITE) - { - UINT len = StrLen(tmp); - - for (i = n;i < len;i++) - { - if (tmp[i] == ':') - { - tmp[i] = '@'; - } - } - } - - return ParseHostPortAtmark(tmp, host, port, default_port); - } - } - - if (InStr(src, "@")) - { - // It is separated by @ - return ParseHostPortAtmark(src, host, port, default_port); - } - - t = ParseToken(src, ":"); - if (t == NULL) - { - return false; - } - - if (port != NULL) - { - *port = 0; - } - - if (default_port == 0) - { - if (t->NumTokens < 2) - { - FreeToken(t); - return false; - } - - if (ToInt(t->Token[1]) == 0) - { - FreeToken(t); - return false; - } - } - - if (t->NumTokens >= 2 && ToInt(t->Token[1]) == 0) - { - FreeToken(t); - return false; - } - - if (t->NumTokens >= 1 && IsEmptyStr(t->Token[0]) == false) - { - ret = true; - - if (host != NULL) - { - *host = CopyStr(t->Token[0]); - Trim(*host); - } - - if (t->NumTokens >= 2) - { - if (port != NULL) - { - *port = ToInt(t->Token[1]); - } - } - } - - if (port != NULL) - { - if (*port == 0) - { - *port = default_port; - } - } - - FreeToken(t); - - return ret; -} - -// Vpncmd command procedure -UINT VpnCmdProc(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) -{ - LIST *o; - char *target; - bool server = false; - bool client = false; - bool tools = false; - char *hostname = NULL; - char *password; - wchar_t *cmdline; - bool host_inputted = false; - UINT port = 0; - UINT retcode = 0; - PARAM args[] = - { - {"[host:port]", NULL, NULL, NULL, NULL}, - {"CLIENT", NULL, NULL, NULL, NULL}, - {"SERVER", NULL, NULL, NULL, NULL}, - {"TOOLS", NULL, NULL, NULL, NULL}, - {"HUB", NULL, NULL, NULL, NULL}, - {"ADMINHUB", NULL, NULL, NULL, NULL}, - {"PASSWORD", NULL, NULL, NULL, NULL}, - {"IN", NULL, NULL, NULL, NULL}, - {"OUT", NULL, NULL, NULL, NULL}, - {"CMD", NULL, NULL, NULL, NULL}, - {"CSV", NULL, NULL, NULL, NULL}, - {"PROGRAMMING", NULL, NULL, NULL, NULL}, - }; - -#ifdef OS_WIN32 - if (UniStrCmpi(str, L"/debug") == 0) - { - // Debug information write mode - Win32CmdDebug(false); - return 0; - } - if (UniStrCmpi(str, L"/debug_uac") == 0) - { - // Debug information write mode - Win32CmdDebug(true); - return 0; - } -#endif // OS_WIN32 - - if (c->ConsoleType == CONSOLE_LOCAL) - { - // Initialize the execute path information - VpnCmdInitBootPath(); - } - - if(c->ConsoleType != CONSOLE_CSV) - { - CmdPrintAbout(c); - c->Write(c, L""); - } - - o = ParseCommandList(c, cmd_name, str, args, sizeof(args) / sizeof(args[0])); - - if (o == NULL) - { - return ERR_INVALID_PARAMETER; - } - - // Specification of the mode of Tools or Server or Client - if ((GetParamStr(o, "CLIENT") == NULL && GetParamStr(o, "SERVER") == NULL && GetParamStr(o, "TOOLS") == NULL) || - (GetParamStr(o, "CLIENT") != NULL && GetParamStr(o, "SERVER") != NULL && GetParamStr(o, "TOOLS") != NULL)) - { - wchar_t *ret; - UINT code; - // The mode of Tools or Server or Client is not specified - c->Write(c, _UU("CMD_VPNCMD_CS_1")); - - ret = c->ReadLine(c, _UU("CMD_VPNCMD_CS_2"), true); - - code = UniToInt(ret); - Free(ret); - - switch (code) - { - case 1: - // Server - server = true; - break; - - case 2: - // Client - client = true; - break; - - case 3: - // Tools - tools = true; - break; - - default: - // Unspecified - FreeParamValueList(o); - return ERR_USER_CANCEL; - } - - c->Write(c, L""); - } - else - { - if (GetParamStr(o, "SERVER") != NULL) - { - server = true; - } - else if (GetParamStr(o, "CLIENT") != NULL) - { - client = true; - } - else - { - tools = true; - } - } - - // Destination host name - target = CopyStr(GetParamStr(o, "[host:port]")); - - if (target == NULL && tools == false) - { - wchar_t *str; - // Input a host name - if (server) - { - c->Write(c, _UU("CMD_VPNCMD_HOST_1")); - } - else if (client) - { - c->Write(c, _UU("CMD_VPNCMD_HOST_2")); - } - - str = c->ReadLine(c, _UU("CMD_VPNCMD_HOST_3"), true); - c->Write(c, L""); - target = CopyUniToStr(str); - Free(str); - - if (target == NULL) - { - // Cancel - FreeParamValueList(o); - return ERR_USER_CANCEL; - } - - if (IsEmptyStr(target)) - { - Free(target); - target = CopyStr("localhost"); - } - } - else - { - // User specifies a host name - host_inputted = true; - } - - if (tools == false) - { - if (ParseHostPort(target, &hostname, &port, 443) == false) - { - c->Write(c, _UU("CMD_MSG_INVALID_HOSTNAME")); - Free(target); - FreeParamValueList(o); - return ERR_INVALID_PARAMETER; - } - } - - // Password - password = GetParamStr(o, "PASSWORD"); - if (password == NULL) - { - password = ""; - } - - // Command line - cmdline = GetParamUniStr(o, "CMD"); - - if (server) - { - // Process as the server - char *hub; - char *adminhub = NULL; - - hub = CopyStr(GetParamStr(o, "HUB")); - adminhub = GetParamStr(o, "ADMINHUB"); - - // Decide the Virtual HUB to be specified in the Virtual HUB management mode - if (hub == NULL) - { - if (host_inputted == false) - { - wchar_t *s; - // If the user does not specify a host name on the command line, - // get also a Virtual HUB name by displaying the prompt - c->Write(c, _UU("CMD_VPNCMD_HUB_1")); - - s = c->ReadLine(c, _UU("CMD_VPNCMD_HUB_2"), true); - - hub = CopyUniToStr(s); - Free(s); - } - } - - if (IsEmptyStr(hub)) - { - Free(hub); - hub = NULL; - } - if (IsEmptyStr(adminhub)) - { - adminhub = NULL; - } - - retcode = PsConnect(c, hostname, port, hub, adminhub, cmdline, password); - - Free(hub); - } - else if (client) - { - // Treated as a client - Trim(target); - - retcode = PcConnect(c, target, cmdline, password); - } - else if (tools) - { - // Treated as a VPN Tools - retcode = PtConnect(c, cmdline); - } - - Free(hostname); - Free(target); - FreeParamValueList(o); - - return retcode; -} - -// Entry point of vpncmd -UINT CommandMain(wchar_t *command_line) -{ - UINT ret = 0; - wchar_t *infile, *outfile; - char *a_infile, *a_outfile; - wchar_t *csvmode; - wchar_t *programming_mode; - CONSOLE *c; - - // Validate arguments - if (command_line == NULL) - { - return ERR_INVALID_PARAMETER; - } - - // Look ahead only items of /in and /out - infile = ParseCommand(command_line, L"in"); - outfile = ParseCommand(command_line, L"out"); - if (UniIsEmptyStr(infile)) - { - Free(infile); - infile = NULL; - } - if (UniIsEmptyStr(outfile)) - { - Free(outfile); - outfile = NULL; - } - - a_infile = CopyUniToStr(infile); - a_outfile = CopyUniToStr(outfile); - - // Allocate the local console - c = NewLocalConsole(infile, outfile); - if (c != NULL) - { - // Definition of commands of vpncmd - CMD cmd[] = - { - {"vpncmd", VpnCmdProc}, - }; - - // Read ahead to check the CSV mode - csvmode = ParseCommand(command_line, L"csv"); - if(csvmode != NULL) - { - Free(csvmode); - c->ConsoleType = CONSOLE_CSV; - } - - programming_mode = ParseCommand(command_line, L"programming"); - if (programming_mode != NULL) - { - Free(programming_mode); - c->ProgrammingMode = true; - } - - if (DispatchNextCmdEx(c, command_line, ">", cmd, sizeof(cmd) / sizeof(cmd[0]), NULL) == false) - { - ret = ERR_INVALID_PARAMETER; - } - else - { - ret = c->RetCode; - } - - // Release the local console - c->Free(c); - } - else - { - Print("Error: Couldn't open local console.\n"); - } - - Free(a_infile); - Free(a_outfile); - Free(infile); - Free(outfile); - - return ret; -} - -#ifdef OS_WIN32 -// Debug information write mode -void Win32CmdDebug(bool is_uac) -{ - wchar_t *dst; - wchar_t def_filename[MAX_SIZE]; - SYSTEMTIME st; - - InitWinUi(_UU("CMD_DEBUG_SOFTNAME"), NULL, 0); - - UniPrint(_UU("CMD_DEBUG_PRINT")); - - if (MsIsWin2000OrGreater() == false) - { - MsgBox(NULL, 0x00000040L, _UU("CMD_DEBUG_NOT_2000")); - goto LABEL_CLEANUP; - } - - if ((MsIsVista() == false || is_uac) && MsIsAdmin() == false) - { - MsgBox(NULL, 0x00000040L, _UU("CMD_DEBUG_NOT_ADMIN")); - goto LABEL_CLEANUP; - } - - if (MsIsVista() && MsIsAdmin() == false) - { - void *process_handle = NULL; - - // Launch myself using the UAC - if (MsExecuteEx2W(MsGetExeFileNameW(), L"/debug_uac", &process_handle, true) == false) - { - MsgBox(NULL, 0x00000030L, _UU("CMD_DEBUG_UAC_FAILED")); - return; - } - - MsCloseHandle(process_handle); - goto LABEL_CLEANUP; - } - - LocalTime(&st); - - UniFormat(def_filename, sizeof(def_filename), L"vpn_debuginfo_%04u%02u%02u_%02u%02u%02u.zip", - st.wYear, st.wMonth, st.wDay, st.wHour, st.wMinute, st.wSecond); - - // Specify the destination - dst = SaveDlg(NULL, _UU("DLG_ZIP_FILER"), _UU("CMD_DEBUG_SAVE_TITLE"), def_filename, L".zip"); - if (dst != NULL) - { - if (MsSaveSystemInfo(dst) == false) - { - // Failure - MsgBoxEx(NULL, 0x00000030L, _UU("CMD_DEBUG_NG"), dst); - } - else - { - // Success - MsgBoxEx(NULL, 0x00000040L, _UU("CMD_DEBUG_OK"), dst); - } - - Free(dst); - } - -LABEL_CLEANUP: - FreeWinUi(); -} - -#endif // OS_WIN32 - +// SoftEther VPN Source Code - Developer Edition Master Branch +// Cedar Communication Module +// © 2020 Nokia + +// Command.c +// vpncmd Command Line Management Utility + +#include "CedarPch.h" + +// System checker definition +typedef bool (CHECKER_PROC_DEF)(); +typedef struct CHECKER_PROC +{ + char *Title; + CHECKER_PROC_DEF *Proc; +} CHECKER_PROC; + +static CHECKER_PROC checker_procs[] = +{ + {"CHECK_PROC_KERNEL", CheckKernel}, + {"CHECK_PROC_MEMORY", CheckMemory}, + {"CHECK_PROC_STRINGS", CheckStrings}, + {"CHECK_PROC_FILESYSTEM", CheckFileSystem}, + {"CHECK_PROC_THREAD", CheckThread}, + {"CHECK_PROC_NETWORK", CheckNetwork}, +}; + +typedef struct CHECK_NETWORK_1 +{ + SOCK *ListenSocket; +} CHECK_NETWORK_1; + +typedef struct CHECK_NETWORK_2 +{ + SOCK *s; + X *x; + K *k; +} CHECK_NETWORK_2; + + +// Accept thread +void CheckNetworkAcceptThread(THREAD *thread, void *param) +{ + CHECK_NETWORK_2 *c = (CHECK_NETWORK_2 *)param; + SOCK *s = c->s; + UINT i = 0; + + if (StartSSL(s, c->x, c->k)) + { + while (true) + { + i++; + if (Send(s, &i, sizeof(UINT), true) == 0) + { + break; + } + } + } + + Disconnect(s); + ReleaseSock(s); +} + + +// Listen thread +void CheckNetworkListenThread(THREAD *thread, void *param) +{ + CHECK_NETWORK_1 *c = (CHECK_NETWORK_1 *)param; + SOCK *s; + UINT i, rsa_bits = 1024; + K *pub, *pri; + X *x; + LIST *o = NewList(NULL); + NAME *name = NewName(L"Test", L"Test", L"Test", L"JP", L"Ibaraki", L"Tsukuba"); + + // Set RSA bits considering OpenSSL security Level + // Security level 4 needs 7680 bits + switch (GetOSSecurityLevel()) + { + case 2: + rsa_bits = 2048; + break; + case 3: + rsa_bits = 4096; + break; + default: + break; + } + RsaGen(&pri, &pub, rsa_bits); + x = NewRootX(pub, pri, name, 1000, NULL); + + FreeName(name); + + for (i = 1025;;i++) + { + s = Listen(i); + if (s != NULL) + { + break; + } + } + + c->ListenSocket = s; + AddRef(s->ref); + + NoticeThreadInit(thread); + + while (true) + { + SOCK *new_sock = Accept(s); + + if (new_sock == NULL) + { + break; + } + else + { + CHECK_NETWORK_2 c; + THREAD *t; + + Zero(&c, sizeof(c)); + c.s = new_sock; + c.k = pri; + c.x = x; + + t = NewThread(CheckNetworkAcceptThread, &c); + Insert(o, t); + } + } + + for (i = 0;i < LIST_NUM(o);i++) + { + THREAD *t = LIST_DATA(o, i); + WaitThread(t, INFINITE); + ReleaseThread(t); + } + + FreeK(pri); + FreeK(pub); + + FreeX(x); + + ReleaseSock(s); + ReleaseList(o); +} + +// Network function check +bool CheckNetwork() +{ + CHECK_NETWORK_1 c; + THREAD *t; + SOCK *listen_socket; + UINT port; + UINT i, num; + bool ok = true; + SOCK **socks; + SOCK_EVENT *se = NewSockEvent(); + + Zero(&c, sizeof(c)); + t = NewThread(CheckNetworkListenThread, &c); + WaitThreadInit(t); + + listen_socket = c.ListenSocket; + + port = listen_socket->LocalPort; + + num = 8; + socks = ZeroMalloc(sizeof(SOCK *) * num); + for (i = 0;i < num;i++) + { + socks[i] = Connect("localhost", port); + if (socks[i] == NULL) + { + Print("Connect Failed. (%u)\n", i); + ok = false; + num = i; + break; + } + if (StartSSL(socks[i], NULL, NULL) == false) + { + ReleaseSock(socks[i]); + Print("Connect Failed. (%u)\n", i); + ok = false; + num = i; + break; + } + + JoinSockToSockEvent(socks[i], se); + } + + if (ok) + { + while (true) + { + UINT i; + bool end = false; + bool all_blocked = true; + + for (i = 0;i < num;i++) + { + UINT n; + UINT ret; + + n = 0; + ret = Recv(socks[i], &n, sizeof(UINT), true); + if (ret == 0) + { + Print("Recv Failed (Disconnected).\n", ret); + end = true; + ok = false; + } + if (ret != SOCK_LATER) + { + all_blocked = false; + } + + if (n >= 128) + { + end = true; + } + } + + if (end) + { + break; + } + + if (all_blocked) + { + WaitSockEvent(se, INFINITE); + } + } + } + + for (i = 0;i < num;i++) + { + Disconnect(socks[i]); + ReleaseSock(socks[i]); + } + Free(socks); + + Disconnect(listen_socket); + + WaitThread(t, INFINITE); + ReleaseThread(t); + + ReleaseSock(listen_socket); + + ReleaseSockEvent(se); + + return ok; +} + +typedef struct CHECK_THREAD_1 +{ + UINT num; + LOCK *lock; + THREAD *wait_thread; +} CHECK_THREAD_1; + +static UINT check_thread_global_1 = 0; + +#define CHECK_THREAD_INCREMENT_COUNT 32 + +// Test thread 1 +void CheckThread1(THREAD *thread, void *param) +{ + CHECK_THREAD_1 *ct1 = (CHECK_THREAD_1 *)param; + UINT i; + UINT num = CHECK_THREAD_INCREMENT_COUNT; + + WaitThread(ct1->wait_thread, INFINITE); + + for (i = 0;i < num;i++) + { + Lock(ct1->lock); + check_thread_global_1 = ct1->num; + InputToNull((void *)check_thread_global_1); + check_thread_global_1 = check_thread_global_1 + 1 + RetZero(); + ct1->num = check_thread_global_1; + Unlock(ct1->lock); + } +} + +// Test thread 2 +void CheckThread2(THREAD *thread, void *param) +{ + EVENT *e = (EVENT *)param; + Wait(e, INFINITE); +} + +typedef struct CHECK_THREAD_3 +{ + UINT num, a; +} CHECK_THREAD_3; + +// Test thread 3 +void CheckThread3(THREAD *thread, void *param) +{ + CHECK_THREAD_3 *c = (CHECK_THREAD_3 *)param; + THREAD *t; + + if (c->num == 0) + { + return; + } + c->num--; + c->a++; + + t = NewThread(CheckThread3, c); + WaitThread(t, INFINITE); + ReleaseThread(t); +} + +// Thread check +bool CheckThread() +{ + bool ok = true; + CHECK_THREAD_1 ct1; + UINT num = 32; + UINT i; + THREAD **threads; + EVENT *e; + THREAD *t2; + THREAD *t; + CHECK_THREAD_3 c; + + e = NewEvent(); + + Zero(&ct1, sizeof(ct1)); + ct1.lock = NewLock(); + + t2 = NewThread(CheckThread2, e); + ct1.wait_thread = t2; + + threads = ZeroMalloc(sizeof(THREAD *) * num); + for (i = 0;i < num;i++) + { + threads[i] = NewThread(CheckThread1, &ct1); + if (threads[i] == NULL) + { + Print("Thread %u Create Failed.\n", i); + ok = false; + } + } + + Set(e); + + for (i = 0;i < num;i++) + { + WaitThread(threads[i], INFINITE); + ReleaseThread(threads[i]); + } + + Free(threads); + + if (ct1.num != (num * CHECK_THREAD_INCREMENT_COUNT)) + { + Print("Threading: %u != %u\n", ct1.num, num * CHECK_THREAD_INCREMENT_COUNT); + ok = false; + } + + DeleteLock(ct1.lock); + + WaitThread(t2, INFINITE); + ReleaseThread(t2); + + ReleaseEvent(e); + + num = 32; + + Zero(&c, sizeof(c)); + c.num = num; + t = NewThread(CheckThread3, &c); + WaitThread(t, INFINITE); + ReleaseThread(t); + + if (c.a != num) + { + Print("Threading: %u != %u\n", c.a, num); + ok = false; + } + + return ok; +} + +// File system check +bool CheckFileSystem() +{ + bool ok = false; + char exe[MAX_PATH]; + char exe_dir[MAX_PATH]; + DIRLIST *dirs; + UINT i; + + GetExeName(exe, sizeof(exe)); + GetExeDir(exe_dir, sizeof(exe_dir)); + + dirs = EnumDir(exe_dir); + for (i = 0;i < dirs->NumFiles;i++) + { + if (EndWith(exe, dirs->File[i]->FileName)) + { + ok = true; + break; + } + } + FreeDir(dirs); + + if (ok == false) + { + Print("EnumDir Failed.\n"); + return false; + } + else + { + UINT size = 1234567; + UCHAR *buf; + IO *io; +#ifndef OS_WIN32 + wchar_t *filename = L"/tmp/vpn_checker_tmp"; +#else // OS_WIN32 + wchar_t filename[MAX_PATH]; + CombinePathW(filename, sizeof(filename), MsGetMyTempDirW(), L"vpn_checker_tmp"); +#endif // OS_WIN32 + + buf = Malloc(size); + for (i = 0;i < size;i++) + { + buf[i] = i % 256; + } + + io = FileCreateW(filename); + if (io == NULL) + { + Print("FileCreate Failed.\n"); + Free(buf); + return false; + } + else + { + FileWrite(io, buf, size); + Free(buf); + FileClose(io); + + io = FileOpenW(filename, false); + if (FileSize(io) != 1234567) + { + Print("FileSize Failed.\n"); + FileClose(io); + return false; + } + else + { + BUF *b; + + FileClose(io); + b = ReadDumpW(filename); + if(b == NULL) + { + return false; + } + + for (i = 0;i < b->Size;i++) + { + UCHAR c = ((UCHAR *)b->Buf)[i]; + + if (c != (i % 256)) + { + Print("FileToBuf Failed.\n"); + FreeBuf(b); + return false; + } + } + + FreeBuf(b); + } + } + + FileDeleteW(filename); + } + + return ok; +} + +// String check +bool CheckStrings() +{ + wchar_t *numstr = _UU("CHECK_TEST_123456789"); + char tmp[MAX_SIZE]; + wchar_t tmp2[MAX_SIZE]; + UINT i; + UINT sum, sum2; + UNI_TOKEN_LIST *t; + + UniStrCpy(tmp2, sizeof(tmp2), L""); + + sum2 = 0; + for (i = 0;i < 64;i++) + { + sum2 += i; + UniFormat(tmp2, sizeof(tmp2), L"%s,%u", tmp2, i); + } + + t = UniParseToken(tmp2, L","); + + sum = 0; + + for (i = 0;i < t->NumTokens;i++) + { + wchar_t *s = t->Token[i]; + UINT n = UniToInt(s); + + sum += n; + } + + UniFreeToken(t); + + if (sum != sum2) + { + Print("UniParseToken Failed.\n"); + return false; + } + + if (UniToInt(numstr) != 123456789) + { + Print("UniToInt Failed.\n"); + return false; + } + + UniToStr(tmp, sizeof(tmp), numstr); + if (ToInt(tmp) != 123456789) + { + Print("UniToStr Failed.\n"); + return false; + } + + return true; +} + +// Memory check +bool CheckMemory() +{ + UINT i, num, size, j; + void **pp; + bool ok = true; + UINT old_size; + + num = 2000; + size = 1000; + pp = ZeroMalloc(sizeof(void *) * num); + for (i = 0;i < num;i++) + { + pp[i] = ZeroMalloc(size); + InputToNull(pp[i]); + for (j = 0;j < size;j++) + { + ((UCHAR *)pp[i])[j] = j % 256; + } + } + old_size = size; + size = size * 3; + for (i = 0;i < num;i++) + { + pp[i] = ReAlloc(pp[i], size); + for (j = old_size;j < size;j++) + { + InputToNull((void *)(UINT)(((UCHAR *)pp[i])[j] = j % 256)); + } + } + for (i = 0;i < num;i++) + { + for (j = 0;j < size;j++) + { + if (((UCHAR *)pp[i])[j] != (j % 256)) + { + ok = false; + } + } + Free(pp[i]); + } + Free(pp); + + return ok; +} + +// Function that do not do anything +void InputToNull(void *p) +{ + if (RetZero() == 1) + { + UCHAR *c = (UCHAR *)p; + c[0] = 0x32; + } +} + +// Function that returns 0 +UINT RetZero() +{ + if (g_debug == 0x123455) + { + return 1; + } + else + { + return 0; + } +} + + +// Kernel check +bool CheckKernel() +{ + UINT num = 10, i; + UINT64 s = Tick64(); + UINT64 t = Tick64(); + + for (i = 0;i < num;i++) + { + UINT64 q = Tick64(); + if (t > q) + { + Print("Tick64 #1 Failed.\n"); + return false; + } + + t = q; + + SleepThread(100); + } + + t = (Tick64() - s); + if (t <= 500 || t >= 2000) + { + Print("Tick64 #2 Failed.\n"); + return false; + } + else if (false) + { + UINT64 tick1 = Tick64(); + UINT64 time1; + UINT64 time2; + + SleepThread(1000); + + time2 = LocalTime64(); + time1 = SystemToLocal64(TickToTime(tick1)); + + if (time2 > time1) + { + s = time2 - time1; + } + else + { + s = time1 - time2; + } + + if (s <= 500 || s >= 2000) + { + Print("TickToTime Failed.\n"); + return false; + } + } + +#ifdef OS_UNIX + { + // Test of child process + UINT pid; + char exe[MAX_SIZE]; + + GetExeName(exe, sizeof(exe)); + + pid = fork(); + + if (pid == -1) + { + Print("fork Failed.\n"); + return false; + } + + if (pid == 0) + { + char *param = UNIX_ARG_EXIT; + char **args; + + args = ZeroMalloc(sizeof(char *) * 3); + args[0] = exe; + args[1] = param; + args[2] = NULL; + + setsid(); + + // Close the standard I/O + UnixCloseIO(); + + // Stop unwanted signals + signal(SIGHUP, SIG_IGN); + + execvp(exe, args); + AbortExit(); + } + else + { + int status = 0, ret; + + // Wait for the termination of the child process + ret = waitpid(pid, &status, 0); + + if (WIFEXITED(status) == 0) + { + // Aborted + Print("waitpid Failed: 0x%x\n", ret); + return false; + } + } + } +#endif // OS_UNIX + + return true; +} + +// System checker +bool SystemCheck() +{ + UINT i; + bool ng = false; + + UniPrint(_UU("CHECK_TITLE")); + UniPrint(_UU("CHECK_NOTE")); + for (i = 0;i < sizeof(checker_procs) / sizeof(checker_procs[0]);i++) + { + wchar_t *title; + bool ret = false; + CHECKER_PROC *p = &checker_procs[i]; + + title = _UU(p->Title); + + UniPrint(_UU("CHECK_EXEC_TAG"), title); + + ret = p->Proc(); + + if (ret == false) + { + ng = true; + } + + UniPrint(L" %s\n", ret ? _UU("CHECK_PASS") : _UU("CHECK_FAIL")); + } + + UniPrint(L"\n"); + if (ng == false) + { + UniPrint(L"%s\n\n", _UU("CHECK_RESULT_1")); + } + else + { + UniPrint(L"%s\n\n", _UU("CHECK_RESULT_2")); + } + + return true; +} + + +// Behavior checker +UINT PtCheck(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) +{ + LIST *o; + UINT ret = ERR_NO_ERROR; + // Get the parameter list + o = ParseCommandList(c, cmd_name, str, NULL, 0); + if (o == NULL) + { + return ERR_INVALID_PARAMETER; + } + + if (SystemCheck() == false) + { + ret = ERR_INTERNAL_ERROR; + } + + FreeParamValueList(o); + + return ret; +} + +// VPN Tools main function +void PtMain(PT *pt) +{ + char prompt[MAX_SIZE]; + wchar_t tmp[MAX_SIZE]; + // Validate arguments + if (pt == NULL) + { + return; + } + + // Display a message that start-up is complete + UniFormat(tmp, sizeof(tmp), _UU("CMD_VPNCMD_TOOLS_CONNECTED")); + pt->Console->Write(pt->Console, tmp); + pt->Console->Write(pt->Console, L""); + + while (true) + { + // Definition of command + CMD cmd[] = + { + {"About", PsAbout}, + {"MakeCert", PtMakeCert}, + {"MakeCert2048", PtMakeCert2048}, + {"TrafficClient", PtTrafficClient}, + {"TrafficServer", PtTrafficServer}, + {"Check", PtCheck}, + }; + + // Generate a prompt + StrCpy(prompt, sizeof(prompt), "VPN Tools>"); + + if (DispatchNextCmdEx(pt->Console, pt->CmdLine, prompt, cmd, sizeof(cmd) / sizeof(cmd[0]), pt) == false) + { + break; + } + pt->LastError = pt->Console->RetCode; + + if (pt->LastError == ERR_NO_ERROR && pt->Console->ConsoleType != CONSOLE_CSV) + { + pt->Console->Write(pt->Console, _UU("CMD_MSG_OK")); + pt->Console->Write(pt->Console, L""); + } + + if (pt->CmdLine != NULL) + { + break; + } + } +} + +// Create a VPN Tools context +PT *NewPt(CONSOLE *c, wchar_t *cmdline) +{ + PT *pt; + // Validate arguments + if (c == NULL) + { + return NULL; + } + + if (UniIsEmptyStr(cmdline)) + { + cmdline = NULL; + } + + pt = ZeroMalloc(sizeof(PT)); + pt->Console = c; + pt->CmdLine = CopyUniStr(cmdline); + + return pt; +} + +// Release the VPN Tools context +void FreePt(PT *pt) +{ + // Validate arguments + if (pt == NULL) + { + return; + } + + Free(pt->CmdLine); + Free(pt); +} + +// Start VPN Tools +UINT PtConnect(CONSOLE *c, wchar_t *cmdline) +{ + PT *pt; + UINT ret = 0; + // Validate arguments + if (c == NULL) + { + return ERR_INTERNAL_ERROR; + } + + pt = NewPt(c, cmdline); + + PtMain(pt); + + ret = pt->LastError; + + FreePt(pt); + + return ret; +} + +// Initialize the execution path information of vpncmd command +void VpnCmdInitBootPath() +{ +#ifdef OS_WIN32 + char exe_path[MAX_PATH]; + char tmp[MAX_PATH]; + GetExeName(exe_path, sizeof(exe_path)); + + if (SearchStrEx(exe_path, "ham.exe", 0, false) != INFINITE) + { + return; + } + + if (MsIsAdmin()) + { + UINT current_ver; + + // Get the version of vpncmd that is currently installed + current_ver = MsRegReadInt(REG_LOCAL_MACHINE, VPNCMD_BOOTSTRAP_REG_KEYNAME, VPNCMD_BOOTSTRAP_REG_VALUENAME_VER); + + if ((CEDAR_VERSION_BUILD >= current_ver) || + MsRegIsValue(REG_LOCAL_MACHINE, VPNCMD_BOOTSTRAP_REG_KEYNAME, VPNCMD_BOOTSTRAP_REG_VALUENAME_PATH) == false) + { + bool b = false; + // Copy the vpncmdsys.exe to system32 + if (MsIsNt()) + { + Format(tmp, sizeof(tmp), "%s\\vpncmd.exe", MsGetSystem32Dir()); + } + else + { + Format(tmp, sizeof(tmp), "%s\\vpncmd.exe", MsGetWindowsDir()); + } + + if (MsIs64BitWindows() == false || Is64()) + { + if (IsFile(tmp) == false || (CEDAR_VERSION_BUILD > current_ver) || MsRegIsValue(REG_LOCAL_MACHINE, VPNCMD_BOOTSTRAP_REG_KEYNAME, VPNCMD_BOOTSTRAP_REG_VALUENAME_PATH) == false) + { + b = FileCopy(VPNCMD_BOOTSTRAP_FILENAME, tmp); + } + } + else + { + void *wow = MsDisableWow64FileSystemRedirection(); + + if (IsFile(tmp) == false || (CEDAR_VERSION_BUILD > current_ver) || MsRegIsValue(REG_LOCAL_MACHINE, VPNCMD_BOOTSTRAP_REG_KEYNAME, VPNCMD_BOOTSTRAP_REG_VALUENAME_PATH) == false) + { + b = FileCopy(VPNCMD_BOOTSTRAP_FILENAME, tmp); + } + + MsRestoreWow64FileSystemRedirection(wow); + + if (IsFile(tmp) == false || (CEDAR_VERSION_BUILD > current_ver) || MsRegIsValue(REG_LOCAL_MACHINE, VPNCMD_BOOTSTRAP_REG_KEYNAME, VPNCMD_BOOTSTRAP_REG_VALUENAME_PATH) == false) + { + b = FileCopy(VPNCMD_BOOTSTRAP_FILENAME, tmp); + } + } + + // Because the currently running prompt is newer version, overwrite the registry + if (MsIs64BitWindows() == false) + { + MsRegWriteStr(REG_LOCAL_MACHINE, VPNCMD_BOOTSTRAP_REG_KEYNAME, VPNCMD_BOOTSTRAP_REG_VALUENAME_PATH, exe_path); + MsRegWriteInt(REG_LOCAL_MACHINE, VPNCMD_BOOTSTRAP_REG_KEYNAME, VPNCMD_BOOTSTRAP_REG_VALUENAME_VER, CEDAR_VERSION_BUILD); + } + else + { + MsRegWriteStrEx2(REG_LOCAL_MACHINE, VPNCMD_BOOTSTRAP_REG_KEYNAME, VPNCMD_BOOTSTRAP_REG_VALUENAME_PATH, exe_path, true, false); + MsRegWriteIntEx2(REG_LOCAL_MACHINE, VPNCMD_BOOTSTRAP_REG_KEYNAME, VPNCMD_BOOTSTRAP_REG_VALUENAME_VER, CEDAR_VERSION_BUILD, true, false); + + MsRegWriteStrEx2(REG_LOCAL_MACHINE, VPNCMD_BOOTSTRAP_REG_KEYNAME, VPNCMD_BOOTSTRAP_REG_VALUENAME_PATH, exe_path, false, true); + MsRegWriteIntEx2(REG_LOCAL_MACHINE, VPNCMD_BOOTSTRAP_REG_KEYNAME, VPNCMD_BOOTSTRAP_REG_VALUENAME_VER, CEDAR_VERSION_BUILD, false, true); + } + } + } +#endif // OS_WIN32 +} + +// Show the string +void TtPrint(void *param, TT_PRINT_PROC *print_proc, wchar_t *str) +{ + // Validate arguments + if (print_proc == NULL || str == NULL) + { + return; + } + + print_proc(param, str); +} + +// Generate new random data +void TtGenerateRandomData(UCHAR **buf, UINT *size) +{ + UCHAR *tmp; + UINT sz; + UINT i; + // Validate arguments + if (buf == NULL || size == NULL) + { + return; + } + + sz = TRAFFIC_BUF_SIZE; + tmp = Malloc(sz); + for (i = 0;i < sz;i++) + { + tmp[i] = rand() % 256; + + if (tmp[i] == '!') + { + tmp[i] = '_'; + } + } + + *buf = tmp; + *size = sz; +} + +// Communication throughput measurement server worker thread +void TtsWorkerThread(THREAD *thread, void *param) +{ + TTS *tts; + TTS_WORKER *w; + UINT buf_size; + UCHAR *send_buf_data, *recv_buf_data; + bool all_sockets_blocked = false; + UINT64 tmp64; + LIST *o; + UINT i; + wchar_t tmp[MAX_SIZE]; + bool dont_block_next_time = false; + char *ver_str = TRAFFIC_VER_STR; + // Validate arguments + if (thread == NULL || param == NULL) + { + return; + } + + // Allocate the data area + TtGenerateRandomData(&send_buf_data, &buf_size); + TtGenerateRandomData(&recv_buf_data, &buf_size); + + w = (TTS_WORKER *)param; + tts = (TTS *)w->Tts; + + // Preparation of socket events + w->SockEvent = NewSockEvent(); + AddRef(w->SockEvent->ref); + + // Preparing the Server socket list + w->TtsSockList = NewList(NULL); + + // Notify completion of preparation to parent thread + NoticeThreadInit(thread); + + o = NewList(NULL); + + while (tts->Halt == false) + { + UINT64 now = Tick64(); + + // Wait for all sockets + if (dont_block_next_time == false) + { + WaitSockEvent(w->SockEvent, 50); + } + dont_block_next_time = false; + + // Process for sockets that are currently registered + LockList(w->TtsSockList); + { + UINT i; + + all_sockets_blocked = false; + + // Continue to send and receive data + // until all sockets become block state + while (all_sockets_blocked == false) + { + all_sockets_blocked = true; + + for (i = 0;i < LIST_NUM(w->TtsSockList);i++) + { + UINT ret = SOCK_LATER; + UCHAR *send_data = NULL, *recv_data = NULL; + UINT send_size = 0, recv_size = 0; + TTS_SOCK *ts = LIST_DATA(w->TtsSockList, i); + bool blocked_for_this_socket = false; + + if (ts->SockJoined == false) + { + JoinSockToSockEvent(ts->Sock, w->SockEvent); + ts->SockJoined = true; + } + + switch (ts->State) + { + case 0: + // Return the version string + ret = Send(ts->Sock, ver_str, TRAFFIC_VER_STR_SIZE, false); + if (ret != 0 && ret != SOCK_LATER) + { + ts->State = 5; + ts->LastCommTime = now; + } + break; + + case 5: + // Receive the direction from the client + ret = Recv(ts->Sock, recv_buf_data, buf_size, false); + if (ret != 0 && ret != SOCK_LATER) + { + UCHAR c; + + ts->LastCommTime = now; + + // Direction of the data is in the first byte that is received + c = recv_buf_data[0]; + + if (c == 0) + { + // In the case of 0, Client -> Server + ts->State = 1; + } + else + { + // Otherwise Server -> Client + ts->State = 2; + } + + if (ret >= (sizeof(UINT64) + sizeof(UINT64) + 1)) + { + // Session ID + ts->SessionId = READ_UINT64(recv_buf_data + 1); + + // Span + ts->Span = READ_UINT64(recv_buf_data + sizeof(UINT64) + 1); + + ts->GiveupSpan = ts->Span * 3ULL + 180000ULL; + } + } + break; + + case 1: + // Client -> Server + ret = Recv(ts->Sock, recv_buf_data, buf_size, false); + + if (ret != 0 && ret != SOCK_LATER) + { + // Checking the first byte of received + UCHAR c = recv_buf_data[0]; + + ts->LastCommTime = now; + + if (ts->FirstRecvTick == 0) + { + // Record the time at which the data has been received for the first + ts->FirstRecvTick = now; + } + else + { + // Check whether the span didn't finish yet + if (ts->FirstRecvTick <= now) + { + if (ts->Span != 0) + { + UINT64 giveup_tick = ts->FirstRecvTick + ts->Span; + + if (now > giveup_tick) + { + // Span has expired + c = '!'; + } + } + } + } + + if (c == '!') + { + // Notice the size information from the server to the client + ts->State = 3; + Debug("!"); + } + } + break; + + case 2: + // Server -> Client + if (ts->NoMoreSendData == false) + { + ret = Send(ts->Sock, send_buf_data, buf_size, false); + + if (ret != 0 && ret != SOCK_LATER) + { + ts->LastCommTime = now; + } + } + else + { + ret = Recv(ts->Sock, recv_buf_data, buf_size, false); + + if (ret != 0 && ret != SOCK_LATER) + { + ts->LastCommTime = now; + } + } + + if (ts->FirstSendTick == 0) + { + ts->FirstSendTick = now; + } + else + { + if (ts->FirstSendTick <= now) + { + if (ts->Span != 0) + { + UINT64 giveup_tick = ts->FirstSendTick + ts->Span * 3ULL + 180000ULL; + + if (now > giveup_tick) + { + ret = 0; + } + } + } + } + + break; + + case 3: + // Notice the size information from the server to the client + tmp64 = Endian64(ts->NumBytes); + + (void)Recv(ts->Sock, recv_buf_data, buf_size, false); + + if (ts->LastWaitTick == 0 || ts->LastWaitTick <= Tick64()) + { + ret = Send(ts->Sock, &tmp64, sizeof(tmp64), false); + + if (ret != 0 && ret != SOCK_LATER) + { + ts->LastCommTime = now; + } + + if (ret != SOCK_LATER) + { + UINT j; + + ts->LastWaitTick = Tick64() + 100; + + if (ts->SessionId != 0) + { + // Not to send more data to the socket of the + // transmission direction in the same session ID + for (j = 0;j < LIST_NUM(w->TtsSockList);j++) + { + TTS_SOCK *ts2 = LIST_DATA(w->TtsSockList, j); + + if (ts2->SessionId == ts->SessionId && + ts2 != ts) + { + ts2->NoMoreSendData = true; + } + } + } + } + } + break; + } + + if (now > (ts->LastCommTime + ts->GiveupSpan)) + { + // Timeout: disconnect orphan sessions + ret = 0; + } + + if (ret == 0) + { + // Mark as deleting the socket because it is disconnected + Insert(o, ts); + } + else if (ret == SOCK_LATER) + { + // Delay has occurred + blocked_for_this_socket = true; + dont_block_next_time = false; + } + else + { + if (ts->State == 1) + { + ts->NumBytes += (UINT64)ret; + } + } + + if (blocked_for_this_socket == false) + { + all_sockets_blocked = false; + } + } + + if (LIST_NUM(o) != 0) + { + UINT i; + // One or more sockets is disconnected + for (i = 0;i < LIST_NUM(o);i++) + { + TTS_SOCK *ts = LIST_DATA(o, i); + + UniFormat(tmp, sizeof(tmp), _UU("TTS_DISCONNECTED"), ts->Id, ts->Sock->RemoteHostname); + TtPrint(tts->Param, tts->Print, tmp); + + Disconnect(ts->Sock); + ReleaseSock(ts->Sock); + + Delete(w->TtsSockList, ts); + + Free(ts); + } + + DeleteAll(o); + } + + if (w->NewSocketArrived || tts->Halt) + { + w->NewSocketArrived = false; + all_sockets_blocked = true; + dont_block_next_time = true; + } + } + } + UnlockList(w->TtsSockList); + } + + LockList(w->TtsSockList); + { + // Release the sockets of all remaining + for (i = 0;i < LIST_NUM(w->TtsSockList);i++) + { + TTS_SOCK *ts = LIST_DATA(w->TtsSockList, i); + + UniFormat(tmp, sizeof(tmp), _UU("TTS_DISCONNECT"), ts->Id, ts->Sock->RemoteHostname); + TtPrint(tts->Param, tts->Print, tmp); + + Disconnect(ts->Sock); + ReleaseSock(ts->Sock); + + Free(ts); + } + } + UnlockList(w->TtsSockList); + + // Cleanup + ReleaseList(o); + ReleaseList(w->TtsSockList); + ReleaseSockEvent(w->SockEvent); + Free(send_buf_data); + Free(recv_buf_data); +} + +// Accept thread for IPv6 +void TtsIPv6AcceptThread(THREAD *thread, void *param) +{ + TTS *tts = (TTS *)param; + // Validate arguments + if (tts == NULL || param == NULL) + { + return; + } + + TtsAcceptProc(tts, tts->ListenSocketV6); +} + +// Accept procedure +void TtsAcceptProc(TTS *tts, SOCK *listen_socket) +{ + wchar_t tmp[MAX_SIZE]; + UINT seed = 0; + // Validate arguments + if (tts == NULL || listen_socket == NULL) + { + return; + } + + while (tts->Halt == false) + { + SOCK *s; + // Accept + s = Accept(listen_socket); + + if (s == NULL) + { + if (tts->Halt == false) + { + SleepThread(10); + } + continue; + } + else + { + UINT num, i; + TTS_WORKER *w; + + // Connected from the client + AcceptInitEx(s, true); + + // Choose a worker thread + num = LIST_NUM(tts->WorkerList); + + i = seed % num; + + seed++; + + w = LIST_DATA(tts->WorkerList, i); + + w->NewSocketArrived = true; + LockList(w->TtsSockList); + { + TTS_SOCK *ts = ZeroMalloc(sizeof(TTS_SOCK)); + + ts->Id = (++tts->IdSeed); + ts->Sock = s; + + ts->GiveupSpan = (UINT64)(10 * 60 * 1000); + ts->LastCommTime = Tick64(); + + UniFormat(tmp, sizeof(tmp), _UU("TTS_ACCEPTED"), ts->Id, + s->RemoteHostname, s->RemotePort); + TtPrint(tts->Param, tts->Print, tmp); + + Insert(w->TtsSockList, ts); + w->NewSocketArrived = true; + } + UnlockList(w->TtsSockList); + + SetSockEvent(w->SockEvent); + } + } +} + +// Communication throughput measurement server wait thread +void TtsListenThread(THREAD *thread, void *param) +{ + TTS *tts; + wchar_t tmp[MAX_SIZE]; + // Validate arguments + if (thread == NULL || param == NULL) + { + return; + } + + tts = (TTS *)param; + + tts->ListenSocket = NULL; + tts->ListenSocket = ListenEx(tts->Port, false); + tts->ListenSocketV6 = ListenEx6(tts->Port, false); + + if (tts->ListenSocket == NULL && tts->ListenSocketV6 == NULL) + { + // Failed to Listen + UniFormat(tmp, sizeof(tmp), _UU("TT_LISTEN_FAILED"), tts->Port); + TtPrint(tts->Param, tts->Print, tmp); + + // Notify completion of preparation to parent thread + NoticeThreadInit(thread); + + tts->ErrorCode = ERR_INTERNAL_ERROR; + } + else + { + UINT i, num_worker_threads; + + UniFormat(tmp, sizeof(tmp), _UU("TTS_LISTEN_STARTED"), tts->Port); + TtPrint(tts->Param, tts->Print, tmp); + + if (tts->ListenSocketV6 != NULL) + { + UniFormat(tmp, sizeof(tmp), _UU("TTS_LISTEN_STARTED_V6"), tts->Port); + TtPrint(tts->Param, tts->Print, tmp); + } + else + { + UniFormat(tmp, sizeof(tmp), _UU("TTS_LISTEN_FAILED_V6"), tts->Port); + TtPrint(tts->Param, tts->Print, tmp); + } + + if (tts->ListenSocket != NULL) + { + AddRef(tts->ListenSocket->ref); + } + if (tts->ListenSocketV6 != NULL) + { + AddRef(tts->ListenSocketV6->ref); + } + + num_worker_threads = GetNumberOfCpu(); + + // Start the worker threads + for (i = 0;i < num_worker_threads;i++) + { + TTS_WORKER *w = ZeroMalloc(sizeof(TTS_WORKER)); + + w->Tts = tts; + w->WorkThread = NewThread(TtsWorkerThread, w); + WaitThreadInit(w->WorkThread); + + Add(tts->WorkerList, w); + } + + // Notify completion of preparation to parent thread + NoticeThreadInit(thread); + + // Prepare for IPv6 Accept thread + tts->IPv6AcceptThread = NULL; + if (tts->ListenSocketV6 != NULL) + { + tts->IPv6AcceptThread = NewThread(TtsIPv6AcceptThread, tts); + } + + TtsAcceptProc(tts, tts->ListenSocket); + + if (tts->IPv6AcceptThread != NULL) + { + WaitThread(tts->IPv6AcceptThread, INFINITE); + ReleaseThread(tts->IPv6AcceptThread); + } + + TtPrint(tts->Param, tts->Print, _UU("TTS_LISTEN_STOP")); + + ReleaseSock(tts->ListenSocket); + ReleaseSock(tts->ListenSocketV6); + + for (i = 0;i < LIST_NUM(tts->WorkerList);i++) + { + TTS_WORKER *w = LIST_DATA(tts->WorkerList, i); + + SetSockEvent(w->SockEvent); + + // Wait for stopping the worker thread + WaitThread(w->WorkThread, INFINITE); + ReleaseThread(w->WorkThread); + ReleaseSockEvent(w->SockEvent); + + Free(w); + } + } +} + +// String of the direction in which data flows +wchar_t *GetTtcTypeStr(UINT type) +{ + switch (type) + { + case TRAFFIC_TYPE_DOWNLOAD: + return _UU("TTC_TYPE_DOWNLOAD"); + + case TRAFFIC_TYPE_UPLOAD: + return _UU("TTC_TYPE_UPLOAD"); + + default: + return _UU("TTC_TYPE_FULL"); + } +} + +// Show a Summary +void TtcPrintSummary(TTC *ttc) +{ + wchar_t tmp[MAX_SIZE]; + wchar_t tmp2[MAX_SIZE]; + wchar_t *tag = L"%-35s %s"; + // Validate arguments + if (ttc == NULL) + { + return; + } + + TtPrint(ttc->Param, ttc->Print, L""); + TtPrint(ttc->Param, ttc->Print, _UU("TTC_SUMMARY_BAR")); + TtPrint(ttc->Param, ttc->Print, _UU("TTC_SUMMARY_TITLE")); + TtPrint(ttc->Param, ttc->Print, L""); + + // Destination host name + StrToUni(tmp2, sizeof(tmp2), ttc->Host); + UniFormat(tmp, sizeof(tmp), tag, _UU("TTC_SUMMARY_HOST"), tmp2); + TtPrint(ttc->Param, ttc->Print, tmp); + + // Destination TCP port number + UniToStru(tmp2, ttc->Port); + UniFormat(tmp, sizeof(tmp), tag, _UU("TTC_SUMMARY_PORT"), tmp2); + TtPrint(ttc->Param, ttc->Print, tmp); + + // Number of TCP connections to establish + UniToStru(tmp2, ttc->NumTcp); + UniFormat(tmp, sizeof(tmp), tag, _UU("TTC_SUMMARY_NUMTCP"), tmp2); + TtPrint(ttc->Param, ttc->Print, tmp); + + // Data transmission direction + UniFormat(tmp, sizeof(tmp), tag, _UU("TTC_SUMMARY_TYPE"), GetTtcTypeStr(ttc->Type)); + TtPrint(ttc->Param, ttc->Print, tmp); + + // Data transmission span + UniFormat(tmp2, sizeof(tmp2), _UU("TTC_SPAN_STR"), (double)(ttc->Span) / 1000.0); + UniFormat(tmp, sizeof(tmp), tag, _UU("TTC_SUMMARY_SPAN"), tmp2); + TtPrint(ttc->Param, ttc->Print, tmp); + + // Correct the data for Ethernet frame + UniFormat(tmp, sizeof(tmp), tag, _UU("TTC_SUMMARY_ETHER"), ttc->Raw ? _UU("SEC_NO") : _UU("SEC_YES")); + TtPrint(ttc->Param, ttc->Print, tmp); + + // Measure the total amount of input and output throughput of relay equipment + UniFormat(tmp, sizeof(tmp), tag, _UU("TTC_SUMMARY_DOUBLE"), ttc->Double ? _UU("SEC_YES") : _UU("SEC_NO")); + TtPrint(ttc->Param, ttc->Print, tmp); + + TtPrint(ttc->Param, ttc->Print, _UU("TTC_SUMMARY_BAR")); + TtPrint(ttc->Param, ttc->Print, L""); +} + +// Stop the communication throughput measurement client +void StopTtc(TTC *ttc) +{ + // Validate arguments + if (ttc == NULL) + { + return; + } + + TtPrint(ttc->Param, ttc->Print, _UU("TTC_STOPPING")); + + ttc->Halt = true; +} + +// Generate a result +void TtcGenerateResult(TTC *ttc) +{ + TT_RESULT *res; + UINT i; + // Validate arguments + if (ttc == NULL) + { + return; + } + + res = &ttc->Result; + + Zero(res, sizeof(TT_RESULT)); + + res->Raw = ttc->Raw; + res->Double = ttc->Double; + res->Span = ttc->RealSpan; + + for (i = 0;i < LIST_NUM(ttc->ItcSockList);i++) + { + TTC_SOCK *ts = LIST_DATA(ttc->ItcSockList, i); + + if (ts->Download == false) + { + // Upload + res->NumBytesUpload += ts->NumBytes; + } + else + { + // Download + res->NumBytesDownload += ts->NumBytes; + } + } + + if (res->Raw == false) + { + // Correct to match the Ethernet + res->NumBytesDownload = (UINT64)((double)res->NumBytesDownload * 1514.0 / 1460.0); + res->NumBytesUpload = (UINT64)((double)res->NumBytesUpload * 1514.0 / 1460.0); + } + + res->NumBytesTotal = res->NumBytesDownload + res->NumBytesUpload; + + // Measure the throughput + if (res->Span != 0) + { + res->BpsUpload = (UINT64)((double)res->NumBytesUpload * 8.0 / ((double)res->Span / 1000.0)); + res->BpsDownload = (UINT64)((double)res->NumBytesDownload * 8.0 / ((double)res->Span / 1000.0)); + } + + if (res->Double) + { + res->BpsUpload *= 2ULL; + res->BpsDownload *= 2ULL; + } + + res->BpsTotal = res->BpsUpload + res->BpsDownload; +} + +// Client worker thread +void TtcWorkerThread(THREAD *thread, void *param) +{ + TTC_WORKER *w; + TTC *ttc; + bool dont_block_next_time = false; + bool halting = false; + UINT64 halt_timeout = 0; + bool all_sockets_blocked; + wchar_t tmp[MAX_SIZE]; + UCHAR *send_buf_data, *recv_buf_data; + UINT buf_size; + UINT64 tmp64; + + if (thread == NULL || param == NULL) + { + return; + } + + w = (TTC_WORKER *)param; + ttc = w->Ttc; + + // Allocate the data area + TtGenerateRandomData(&send_buf_data, &buf_size); + TtGenerateRandomData(&recv_buf_data, &buf_size); + + NoticeThreadInit(thread); + + // Wait for start + Wait(w->StartEvent, INFINITE); + + // Main loop + while (true) + { + UINT i; + + if (dont_block_next_time == false) + { + WaitSockEvent(w->SockEvent, 50); + } + + dont_block_next_time = false; + + if (ttc->AbnormalTerminated) + { + // Abnormal termination occured + break; + } + + if (ttc->Halt || ttc->end_tick <= Tick64() || (ttc->Cancel != NULL && (*ttc->Cancel))) + { + // End measurement + if (halting == false) + { + if (ttc->Halt || (ttc->Cancel != NULL && (*ttc->Cancel))) + { + if ((ttc->flag1++) == 0) + { + // User cancel + TtPrint(ttc->Param, ttc->Print, _UU("TTC_COMM_USER_CANCEL")); + } + } + else + { + // Time elapsed + if ((ttc->flag2++) == 0) + { + UniFormat(tmp, sizeof(tmp), _UU("TTC_COMM_END"), + (double)ttc->Span / 1000.0); + TtPrint(ttc->Param, ttc->Print, tmp); + } + } + + if (ttc->RealSpan == 0) + { + ttc->RealSpan = Tick64() - ttc->start_tick; + } + + halting = true; + + // Wait for reporting data from the server + halt_timeout = Tick64() + 60000ULL; + } + } + + if (halt_timeout != 0) + { + bool ok = true; + + // Wait that all TCP connections to finish processing + for (i = 0;i < LIST_NUM(w->SockList);i++) + { + TTC_SOCK *ts = LIST_DATA(w->SockList, i); + + if (ts->Download == false) + { + if (ts->ServerUploadReportReceived == false) + { + ok = false; + } + } + } + + if (ok) + { + // Measurement completed + w->Ok = true; + break; + } + else + { + if (halt_timeout <= Tick64()) + { + // An error occured + ttc->AbnormalTerminated = true; + ttc->ErrorCode = ERR_PROTOCOL_ERROR; + break; + } + } + } + + all_sockets_blocked = false; + + // Continue to send and receive data + // until all sockets become block state + while (all_sockets_blocked == false) + { + all_sockets_blocked = true; + + for (i = 0;i < LIST_NUM(w->SockList);i++) + { + UINT ret = SOCK_LATER; + TTC_SOCK *ts = LIST_DATA(w->SockList, i); + bool blocked_for_this_socket = false; + UCHAR c = 0; + UCHAR c_and_session_id[1 + sizeof(UINT64) + sizeof(UINT64)]; + + if (halt_timeout != 0) + { + if (ts->State != 3 && ts->State != 4) + { + if (ts->Download == false) + { + if (ts->State != 0) + { + ts->State = 3; + } + else + { + ts->ServerUploadReportReceived = true; + ts->State = 4; + } + } + else + { + ts->State = 4; + } + } + } + + switch (ts->State) + { + case 0: + // Initial state: Specify the direction of + // the data flow between client-server + if (ts->Download) + { + c = 1; + } + else + { + c = 0; + } + + c_and_session_id[0] = c; + WRITE_UINT64(c_and_session_id + 1, ttc->session_id); + WRITE_UINT64(c_and_session_id + sizeof(UINT64) + 1, ttc->Span); + + ret = Send(ts->Sock, c_and_session_id, 1 + sizeof(UINT64) + sizeof(UINT64), false); + + if (ret != 0 && ret != SOCK_LATER) + { + if (ts->Download) + { + ts->State = 1; + } + else + { + ts->State = 2; + } + } + break; + + case 1: + // Server -> Client (download) + ret = Recv(ts->Sock, recv_buf_data, buf_size, false); + break; + + case 2: + // Client -> Server (upload) + ret = Send(ts->Sock, send_buf_data, buf_size, false); + break; + + case 3: + // Transmission completion client -> server (upload) + // Request the data size + if (ts->NextSendRequestReportTick == 0 || + (Tick64() >= ts->NextSendRequestReportTick)) + { + UCHAR suprise[MAX_SIZE]; + UINT i; + + ts->NextSendRequestReportTick = Tick64() + 200ULL; + + for (i = 0;i < sizeof(suprise);i++) + { + suprise[i] = '!'; + } + + (void)Send(ts->Sock, suprise, sizeof(suprise), false); + } + + ret = Recv(ts->Sock, &tmp64, sizeof(tmp64), false); + if (ret != 0 && ret != SOCK_LATER && ret == sizeof(tmp64)) + { + ts->NumBytes = Endian64(tmp64); + + ts->ServerUploadReportReceived = true; + + ts->State = 4; + } + break; + + case 4: + // Do Nothing + if (Recv(ts->Sock, recv_buf_data, buf_size, false) == SOCK_LATER) + { + ret = SOCK_LATER; + } + break; + } + + if (ret == 0) + { + // The socket is disconnected + ttc->AbnormalTerminated = true; + ttc->ErrorCode = ERR_PROTOCOL_ERROR; + blocked_for_this_socket = true; + dont_block_next_time = false; + + if (ts->HideErrMsg == false) + { + UniFormat(tmp, sizeof(tmp), _UU("TTC_COMM_DISCONNECTED"), ts->Id); + TtPrint(ttc->Param, ttc->Print, tmp); + ts->HideErrMsg = true; + } + } + else if (ret == SOCK_LATER) + { + // Delay has occurred + blocked_for_this_socket = true; + dont_block_next_time = false; + } + else + { + if (ts->Download) + { + ts->NumBytes += (UINT64)ret; + } + } + + if (blocked_for_this_socket == false) + { + all_sockets_blocked = false; + } + } + + if (ttc->Halt || (ttc->Cancel != NULL && (*ttc->Cancel))) + { + all_sockets_blocked = true; + dont_block_next_time = true; + } + + if (ttc->end_tick <= Tick64()) + { + all_sockets_blocked = true; + dont_block_next_time = true; + } + } + } + + Free(send_buf_data); + Free(recv_buf_data); +} + +// Client thread +void TtcThread(THREAD *thread, void *param) +{ + TTC *ttc; + UINT i; + wchar_t tmp[MAX_SIZE]; + bool ok = false; + IP ip_ret; + // Validate arguments + if (thread == NULL || param == NULL) + { + return; + } + + ttc = (TTC *)param; + + // Ready + NoticeThreadInit(thread); + + TtcPrintSummary(ttc); + + UniFormat(tmp, sizeof(tmp), _UU("TTC_CONNECT_START"), + ttc->Host, ttc->Port, ttc->NumTcp); + TtPrint(ttc->Param, ttc->Print, tmp); + + // Establish all connections to the client + ttc->ItcSockList = NewList(NULL); + + ok = true; + + Zero(&ip_ret, sizeof(ip_ret)); + + for (i = 0;i < ttc->NumTcp;i++) + { + SOCK *s; + TTC_SOCK *ts = ZeroMalloc(sizeof(TTC_SOCK)); + char target_host[MAX_SIZE]; + + ts->Id = i + 1; + + if (ttc->Type == TRAFFIC_TYPE_DOWNLOAD) + { + ts->Download = true; + } + else if (ttc->Type == TRAFFIC_TYPE_UPLOAD) + { + ts->Download = false; + } + else + { + ts->Download = ((i % 2) == 0) ? true : false; + } + + StrCpy(target_host, sizeof(target_host), ttc->Host); + + if (IsZeroIp(&ip_ret) == false) + { + IPToStr(target_host, sizeof(target_host), &ip_ret); + } + + s = ConnectEx4(target_host, ttc->Port, 0, ttc->Cancel, NULL, NULL, false, true, &ip_ret); + + if (s == NULL) + { + UniFormat(tmp, sizeof(tmp), _UU("TTC_CONNECT_FAILED"), i + 1); + TtPrint(ttc->Param, ttc->Print, tmp); + ok = false; + Free(ts); + break; + } + else + { + char buffer[TRAFFIC_VER_STR_SIZE]; + + SetTimeout(s, 5000); + + Zero(buffer, sizeof(buffer)); + if (Recv(s, buffer, sizeof(buffer), false) != sizeof(buffer) || Cmp(buffer, TRAFFIC_VER_STR, TRAFFIC_VER_STR_SIZE) != 0) + { + TtPrint(ttc->Param, ttc->Print, _UU("TTC_CONNECT_NOT_SERVER")); + ok = false; + ReleaseSock(s); + Free(ts); + break; + } + + UniFormat(tmp, sizeof(tmp), _UU("TTC_CONNECT_OK"), i + 1); + TtPrint(ttc->Param, ttc->Print, tmp); + + UniFormat(tmp, sizeof(tmp), _UU("TTC_CONNECT_OK_2"), GetTtcTypeStr(ts->Download ? TRAFFIC_TYPE_DOWNLOAD : TRAFFIC_TYPE_UPLOAD)); + TtPrint(ttc->Param, ttc->Print, tmp); + + ts->Sock = s; + + SetTimeout(s, TIMEOUT_INFINITE); + } + + Insert(ttc->ItcSockList, ts); + } + + Set(ttc->InitedEvent); + + if (ttc->StartEvent != NULL) + { + Wait(ttc->StartEvent, INFINITE); + SleepThread(500); + } + + if (ok) + { + UINT64 start_tick, end_tick; + wchar_t tmp1[MAX_SIZE], tmp2[MAX_SIZE]; + UINT64 session_id = Rand64(); + UINT i, num_cpu; + bool all_ok = false; + + ttc->session_id = session_id; + + num_cpu = GetNumberOfCpu(); + + ttc->WorkerThreadList = NewList(NULL); + + for (i = 0;i < num_cpu;i++) + { + TTC_WORKER *w = ZeroMalloc(sizeof(TTC_WORKER)); + + w->Ttc = ttc; + w->SockList = NewList(NULL); + w->StartEvent = NewEvent(); + w->SockEvent = NewSockEvent(); + + w->WorkerThread = NewThread(TtcWorkerThread, w); + + WaitThreadInit(w->WorkerThread); + + Add(ttc->WorkerThreadList, w); + } + + // Assign each of sockets to each of worker threads + for (i = 0;i < LIST_NUM(ttc->ItcSockList);i++) + { + TTC_SOCK *ts = LIST_DATA(ttc->ItcSockList, i); + UINT num = LIST_NUM(ttc->WorkerThreadList); + UINT j = i % num; + TTC_WORKER *w = LIST_DATA(ttc->WorkerThreadList, j); + + Add(w->SockList, ts); + + JoinSockToSockEvent(ts->Sock, w->SockEvent); + } + + // Record the current time + start_tick = Tick64(); + end_tick = start_tick + ttc->Span; + + ttc->start_tick = start_tick; + ttc->end_tick = end_tick; + + // Set the start event for all worker threads + for (i = 0;i < LIST_NUM(ttc->WorkerThreadList);i++) + { + TTC_WORKER *w = LIST_DATA(ttc->WorkerThreadList, i); + + Set(w->StartEvent); + } + + // Show start message + GetDateTimeStrEx64(tmp1, sizeof(tmp1), SystemToLocal64(TickToTime(start_tick)), NULL); + GetDateTimeStrEx64(tmp2, sizeof(tmp2), SystemToLocal64(TickToTime(end_tick)), NULL); + UniFormat(tmp, sizeof(tmp), _UU("TTC_COMM_START"), tmp1, tmp2); + TtPrint(ttc->Param, ttc->Print, tmp); + + // Wait for all worker threads finish + all_ok = true; + for (i = 0;i < LIST_NUM(ttc->WorkerThreadList);i++) + { + TTC_WORKER *w = LIST_DATA(ttc->WorkerThreadList, i); + + WaitThread(w->WorkerThread, INFINITE); + + if (w->Ok == false) + { + all_ok = false; + } + } + + if (all_ok) + { + // Measurement completed + // Show the result + TtcGenerateResult(ttc); + } + + // Release worker threads + for (i = 0;i < LIST_NUM(ttc->WorkerThreadList);i++) + { + TTC_WORKER *w = LIST_DATA(ttc->WorkerThreadList, i); + + ReleaseThread(w->WorkerThread); + + ReleaseEvent(w->StartEvent); + ReleaseList(w->SockList); + + ReleaseSockEvent(w->SockEvent); + + Free(w); + } + + ReleaseList(ttc->WorkerThreadList); + ttc->WorkerThreadList = NULL; + } + else + { + // Abort + TtPrint(ttc->Param, ttc->Print, _UU("TTC_ERROR_ABORTED")); + ttc->ErrorCode = ERR_CONNECT_FAILED; + } + + // Cleanup + for (i = 0;i < LIST_NUM(ttc->ItcSockList);i++) + { + TTC_SOCK *ts = LIST_DATA(ttc->ItcSockList, i); + + Disconnect(ts->Sock); + ReleaseSock(ts->Sock); + Free(ts); + } + + ReleaseList(ttc->ItcSockList); +} + +// Start the communication throughput measurement client +TTC *NewTtc(char *host, UINT port, UINT numtcp, UINT type, UINT64 span, bool dbl, bool raw, TT_PRINT_PROC *print_proc, void *param) +{ + return NewTtcEx(host, port, numtcp, type, span, dbl, raw, print_proc, param, NULL, NULL); +} +TTC *NewTtcEx(char *host, UINT port, UINT numtcp, UINT type, UINT64 span, bool dbl, bool raw, TT_PRINT_PROC *print_proc, void *param, EVENT *start_event, bool *cancel) +{ + TTC *ttc; + + ttc = ZeroMalloc(sizeof(TTC)); + ttc->InitedEvent = NewEvent(); + ttc->Port = port; + StrCpy(ttc->Host, sizeof(ttc->Host), host); + ttc->NumTcp = numtcp; + ttc->Type = type; + ttc->Span = span; + ttc->Double = dbl; + ttc->Raw = raw; + ttc->StartEvent = start_event; + ttc->Cancel = cancel; + + if (ttc->Type == TRAFFIC_TYPE_FULL && ttc->NumTcp < 2) + { + ttc->NumTcp = 2; + } + + ttc->Print = print_proc; + ttc->Param = param; + ttc->ErrorCode = ERR_NO_ERROR; + + TtPrint(ttc->Param, ttc->Print, _UU("TTC_INIT")); + + ttc->Thread = NewThread(TtcThread, ttc); + WaitThreadInit(ttc->Thread); + + return ttc; +} + +// Wait for stopping the communication throughput measurement client +UINT FreeTtc(TTC *ttc, TT_RESULT *result) +{ + UINT ret; + // Validate arguments + if (ttc == NULL) + { + return ERR_INVALID_PARAMETER; + } + + WaitThread(ttc->Thread, INFINITE); + ReleaseThread(ttc->Thread); + + TtPrint(ttc->Param, ttc->Print, _UU("TTC_FREE")); + + ret = ttc->ErrorCode; + + if (ret == ERR_NO_ERROR) + { + if (result != NULL) + { + Copy(result, &ttc->Result, sizeof(TT_RESULT)); + } + } + + ReleaseEvent(ttc->InitedEvent); + + Free(ttc); + + return ret; +} + +// Start the communication throughput measurement server +TTS *NewTts(UINT port, void *param, TT_PRINT_PROC *print_proc) +{ + TTS *tts; + THREAD *t; + + tts = ZeroMalloc(sizeof(TTS)); + tts->Port = port; + tts->Param = param; + tts->Print = print_proc; + + TtPrint(param, print_proc, _UU("TTS_INIT")); + + tts->WorkerList = NewList(NULL); + + // Creating a thread + t = NewThread(TtsListenThread, tts); + WaitThreadInit(t); + + tts->Thread = t; + + return tts; +} + +// Wait for stopping the communication throughput measurement server +UINT FreeTts(TTS *tts) +{ + UINT ret; + // Validate arguments + if (tts == NULL) + { + return ERR_INVALID_PARAMETER; + } + + TtPrint(tts->Param, tts->Print, _UU("TTS_STOP_INIT")); + + tts->Halt = true; + Disconnect(tts->ListenSocket); + ReleaseSock(tts->ListenSocket); + Disconnect(tts->ListenSocketV6); + ReleaseSock(tts->ListenSocketV6); + + // Wait for the termination of the thread + WaitThread(tts->Thread, INFINITE); + + ReleaseThread(tts->Thread); + + TtPrint(tts->Param, tts->Print, _UU("TTS_STOP_FINISHED")); + + ret = tts->ErrorCode; + + ReleaseList(tts->WorkerList); + + Free(tts); + + return ret; +} + +// Show the measurement tools prompt +void PtTrafficPrintProc(void *param, wchar_t *str) +{ + CONSOLE *c; + // Validate arguments + if (param == NULL || str == NULL) + { + return; + } + + c = (CONSOLE *)param; + + if (c->ConsoleType == CONSOLE_LOCAL) + { + Lock(c->OutputLock); + { + wchar_t tmp[MAX_SIZE]; + + // Display only if the local console + // (Can not be displayed because threads aren't synchronized otherwise?) + UniStrCpy(tmp, sizeof(tmp), str); + if (UniEndWith(str, L"\n") == false) + { + UniStrCat(tmp, sizeof(tmp), L"\n"); + } + UniPrint(L"%s", tmp); + } + Unlock(c->OutputLock); + } +} + +// Display the communication throughput results +void TtcPrintResult(CONSOLE *c, TT_RESULT *res) +{ + CT *ct; + wchar_t tmp[MAX_SIZE]; + wchar_t tmp1[MAX_SIZE]; + wchar_t tmp2[MAX_SIZE]; + char str[MAX_SIZE]; + // Validate arguments + if (c == NULL || res == NULL) + { + return; + } + + c->Write(c, _UU("TTC_RES_TITLE")); + + ct = CtNew(); + CtInsertColumn(ct, _UU("TTC_RES_COLUMN_1"), false); + CtInsertColumn(ct, _UU("TTC_RES_COLUMN_2"), true); + CtInsertColumn(ct, _UU("TTC_RES_COLUMN_3"), true); + + // Time that was used to measure + GetSpanStrMilli(str, sizeof(str), res->Span); + StrToUni(tmp, sizeof(tmp), str); + CtInsert(ct, _UU("TTC_RES_SPAN"), tmp, L""); + + // Correct the data for Ethernet frame + CtInsert(ct, _UU("TTC_RES_ETHER"), res->Raw ? _UU("SEC_NO") : _UU("SEC_YES"), L""); + + // Amount of communication data of download direction + ToStr3(str, sizeof(str), res->NumBytesDownload); + UniFormat(tmp1, sizeof(tmp1), L"%S Bytes", str); + ToStrByte1000(str, sizeof(str), res->NumBytesDownload); + StrToUni(tmp2, sizeof(tmp2), str); + CtInsert(ct, _UU("TTC_RES_BYTES_DOWNLOAD"), tmp1, tmp2); + + // Amount of communication data of upload direction + ToStr3(str, sizeof(str), res->NumBytesUpload); + UniFormat(tmp1, sizeof(tmp1), L"%S Bytes", str); + ToStrByte1000(str, sizeof(str), res->NumBytesUpload); + StrToUni(tmp2, sizeof(tmp2), str); + CtInsert(ct, _UU("TTC_RES_BYTES_UPLOAD"), tmp1, tmp2); + + // Total amount of communication data + ToStr3(str, sizeof(str), res->NumBytesTotal); + UniFormat(tmp1, sizeof(tmp1), L"%S Bytes", str); + ToStrByte1000(str, sizeof(str), res->NumBytesTotal); + StrToUni(tmp2, sizeof(tmp2), str); + CtInsert(ct, _UU("TTC_RES_BYTES_TOTAL"), tmp1, tmp2); + + // Calculate the total throughput of input and output of the relay equipment + CtInsert(ct, _UU("TTC_RES_DOUBLE"), (res->Double == false) ? _UU("SEC_NO") : _UU("SEC_YES"), L""); + + // Average throughput of download direction + ToStr3(str, sizeof(str), res->BpsDownload); + UniFormat(tmp1, sizeof(tmp1), L"%S bps", str); + ToStrByte1000(str, sizeof(str), res->BpsDownload); + ReplaceStr(str, sizeof(str), str, "Bytes", "bps"); + StrToUni(tmp2, sizeof(tmp2), str); + CtInsert(ct, _UU("TTC_RES_BPS_DOWNLOAD"), tmp1, tmp2); + + // Average throughput of upload direction + ToStr3(str, sizeof(str), res->BpsUpload); + UniFormat(tmp1, sizeof(tmp1), L"%S bps", str); + ToStrByte1000(str, sizeof(str), res->BpsUpload); + ReplaceStr(str, sizeof(str), str, "Bytes", "bps"); + StrToUni(tmp2, sizeof(tmp2), str); + CtInsert(ct, _UU("TTC_RES_BPS_UPLOAD"), tmp1, tmp2); + + // Total average throughput + ToStr3(str, sizeof(str), res->BpsTotal); + UniFormat(tmp1, sizeof(tmp1), L"%S bps", str); + ToStrByte1000(str, sizeof(str), res->BpsTotal); + ReplaceStr(str, sizeof(str), str, "Bytes", "bps"); + StrToUni(tmp2, sizeof(tmp2), str); + CtInsert(ct, _UU("TTC_RES_BPS_TOTAL"), tmp1, tmp2); + + CtFree(ct, c); +} + +// Execute the communication throughput measurement tool server +UINT PtTrafficServer(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) +{ + LIST *o; + UINT ret = ERR_NO_ERROR; + UINT port; + bool nohup; + TTS *tts; + PARAM args[] = + { + {"[port]", NULL, NULL, NULL, NULL}, + {"NOHUP", NULL, NULL, NULL, NULL}, + }; + + // Get the parameter list + o = ParseCommandList(c, cmd_name, str, args, sizeof(args) / sizeof(args[0])); + if (o == NULL) + { + return ERR_INVALID_PARAMETER; + } + + port = GetParamInt(o, "[port]"); + if (port == 0) + { + port = TRAFFIC_DEFAULT_PORT; + } + + nohup = GetParamYes(o, "nohup"); + + tts = NewTts(port, c, PtTrafficPrintProc); + + if (nohup) + { + while (true) + { + SleepThread(10000); + } + } + + c->Write(c, _UU("TTS_ENTER_TO_EXIT")); + + Free(c->ReadLine(c, L"", true)); + + ret = tts->ErrorCode; + + FreeTts(tts); + + if (ret != ERR_NO_ERROR) + { + CmdPrintError(c, ret); + } + + // Release of the parameter list + FreeParamValueList(o); + + return ret; +} + +// Execute the communication throughput measurement tool client +UINT PtTrafficClient(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) +{ + TTC *ttc; + LIST *o; + UINT ret = ERR_NO_ERROR; + char *host = NULL; + UINT port; + UINT num, type; + bool dbl = false, raw = false; + UINT64 span; + // Parameter list that can be specified + CMD_EVAL_MIN_MAX minmax = + { + "CMD_TrafficClient_EVAL_NUMTCP", + 0, TRAFFIC_NUMTCP_MAX, + }; + PARAM args[] = + { + {"[host:port]", CmdPrompt, _UU("CMD_TrafficClient_PROMPT_HOST"), CmdEvalNotEmpty, NULL}, + {"NUMTCP", NULL, NULL, CmdEvalMinMax, &minmax}, + {"TYPE", NULL, NULL, NULL, NULL}, + {"SPAN", NULL, NULL, NULL, NULL}, + {"DOUBLE", NULL, NULL, NULL, NULL}, + {"RAW", NULL, NULL, NULL, NULL}, + }; + + // Get the parameter list + o = ParseCommandList(c, cmd_name, str, args, sizeof(args) / sizeof(args[0])); + if (o == NULL) + { + return ERR_INVALID_PARAMETER; + } + + if (ParseHostPort(GetParamStr(o, "[host:port]"), &host, &port, TRAFFIC_DEFAULT_PORT) == false) + { + c->Write(c, _UU("CMD_TrafficClient_ERROR_HOSTPORT")); + ret = ERR_INVALID_PARAMETER; + } + else + { + char *s; + UINT i; + + Trim(host); + + num = GetParamInt(o, "NUMTCP"); + if (num == 0) + { + num = TRAFFIC_NUMTCP_DEFAULT; + } + s = GetParamStr(o, "TYPE"); + + if (StartWith("download", s)) + { + type = TRAFFIC_TYPE_DOWNLOAD; + } + else if (StartWith("upload", s)) + { + type = TRAFFIC_TYPE_UPLOAD; + } + else + { + type = TRAFFIC_TYPE_FULL; + } + + i = GetParamInt(o, "SPAN"); + + if (i == 0) + { + i = TRAFFIC_SPAN_DEFAULT; + } + + span = (UINT64)i * 1000ULL; + + dbl = GetParamYes(o, "DOUBLE"); + raw = GetParamYes(o, "RAW"); + + if (type == TRAFFIC_TYPE_FULL) + { + if ((num % 2) != 0) + { + ret = ERR_INVALID_PARAMETER; + c->Write(c, _UU("CMD_TrafficClient_ERROR_NUMTCP")); + } + } + + if (ret == ERR_NO_ERROR) + { + TT_RESULT result; + ttc = NewTtc(host, port, num, type, span, dbl, raw, PtTrafficPrintProc, c); + + if (c->ConsoleType == CONSOLE_LOCAL) + { + if (c->Param != NULL && (((LOCAL_CONSOLE_PARAM *)c->Param)->InBuf == NULL)) + { +// c->Write(c, _UU("TTC_ENTER_TO_EXIT")); +// GetLine(NULL, 0); +// StopTtc(ttc); + } + } + + + Zero(&result, sizeof(result)); + ret = FreeTtc(ttc, &result); + + if (ret == ERR_NO_ERROR) + { + TtcPrintResult(c, &result); + } + } + } + + if (ret != ERR_NO_ERROR) + { + CmdPrintError(c, ret); + } + + // Release of the parameter list + FreeParamValueList(o); + + Free(host); + + return ret; +} + +// Certificate easy creation tool (1024 bit) +UINT PtMakeCert(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) +{ + LIST *o; + UINT ret = ERR_NO_ERROR; + X *x = NULL; + K *pub = NULL; + K *pri = NULL; + NAME *n; + X_SERIAL *x_serial = NULL; + BUF *buf; + UINT days; + X *root_x = NULL; + K *root_k = NULL; + // Parameter list that can be specified + CMD_EVAL_MIN_MAX minmax = + { + "CMD_MakeCert_EVAL_EXPIRES", + 0, + 10950, + }; + PARAM args[] = + { + {"CN", CmdPrompt, _UU("CMD_MakeCert_PROMPT_CN"), NULL, NULL}, + {"O", CmdPrompt, _UU("CMD_MakeCert_PROMPT_O"), NULL, NULL}, + {"OU", CmdPrompt, _UU("CMD_MakeCert_PROMPT_OU"), NULL, NULL}, + {"C", CmdPrompt, _UU("CMD_MakeCert_PROMPT_C"), NULL, NULL}, + {"ST", CmdPrompt, _UU("CMD_MakeCert_PROMPT_ST"), NULL, NULL}, + {"L", CmdPrompt, _UU("CMD_MakeCert_PROMPT_L"), NULL, NULL}, + {"SERIAL", CmdPrompt, _UU("CMD_MakeCert_PROMPT_SERIAL"), NULL, NULL}, + {"EXPIRES", CmdPrompt, _UU("CMD_MakeCert_PROMPT_EXPIRES"), CmdEvalMinMax, &minmax}, + {"SIGNCERT", NULL, NULL, CmdEvalIsFile, NULL}, + {"SIGNKEY", NULL, NULL, CmdEvalIsFile, NULL}, + {"SAVECERT", CmdPrompt, _UU("CMD_MakeCert_PROMPT_SAVECERT"), CmdEvalNotEmpty, NULL}, + {"SAVEKEY", CmdPrompt, _UU("CMD_MakeCert_PROMPT_SAVEKEY"), CmdEvalNotEmpty, NULL}, + }; + + // Get the parameter list + o = ParseCommandList(c, cmd_name, str, args, sizeof(args) / sizeof(args[0])); + if (o == NULL) + { + return ERR_INVALID_PARAMETER; + } + + if (IsEmptyStr(GetParamStr(o, "SIGNCERT")) == false && IsEmptyStr(GetParamStr(o, "SIGNKEY")) == false) + { + root_x = FileToXW(GetParamUniStr(o, "SIGNCERT")); + root_k = FileToKW(GetParamUniStr(o, "SIGNKEY"), true, NULL); + + if (root_x == NULL || root_k == NULL || CheckXandK(root_x, root_k) == false) + { + ret = ERR_INTERNAL_ERROR; + + c->Write(c, _UU("CMD_MakeCert_ERROR_SIGNKEY")); + } + } + + if (ret == ERR_NO_ERROR) + { + buf = StrToBin(GetParamStr(o, "SERIAL")); + if (buf != NULL && buf->Size >= 1) + { + x_serial = NewXSerial(buf->Buf, buf->Size); + } + FreeBuf(buf); + + n = NewName(GetParamUniStr(o, "CN"), GetParamUniStr(o, "O"), GetParamUniStr(o, "OU"), + GetParamUniStr(o, "C"), GetParamUniStr(o, "ST"), GetParamUniStr(o, "L")); + + days = GetParamInt(o, "EXPIRES"); + if (days == 0) + { + days = 3650; + } + + RsaGen(&pri, &pub, 1024); + + if (root_x == NULL) + { + x = NewRootX(pub, pri, n, days, x_serial); + } + else + { + x = NewX(pub, root_k, root_x, n, days, x_serial); + } + + FreeXSerial(x_serial); + FreeName(n); + + if (x == NULL) + { + ret = ERR_INTERNAL_ERROR; + c->Write(c, _UU("CMD_MakeCert_ERROR_GEN_FAILED")); + } + else + { + if (XToFileW(x, GetParamUniStr(o, "SAVECERT"), true) == false) + { + c->Write(c, _UU("CMD_SAVECERT_FAILED")); + } + else if (KToFileW(pri, GetParamUniStr(o, "SAVEKEY"), true, NULL) == false) + { + c->Write(c, _UU("CMD_SAVEKEY_FAILED")); + } + } + } + + if (ret != ERR_NO_ERROR) + { + // Error has occurred + CmdPrintError(c, ret); + } + + // Release of the parameter list + FreeParamValueList(o); + + FreeX(root_x); + FreeK(root_k); + + FreeX(x); + FreeK(pri); + FreeK(pub); + + return ret; +} + +// Certificate easy creation tool (2048 bit) +UINT PtMakeCert2048(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) +{ + LIST *o; + UINT ret = ERR_NO_ERROR; + X *x = NULL; + K *pub = NULL; + K *pri = NULL; + NAME *n; + X_SERIAL *x_serial = NULL; + BUF *buf; + UINT days; + X *root_x = NULL; + K *root_k = NULL; + // Parameter list that can be specified + CMD_EVAL_MIN_MAX minmax = + { + "CMD_MakeCert_EVAL_EXPIRES", + 0, + 10950, + }; + PARAM args[] = + { + {"CN", CmdPrompt, _UU("CMD_MakeCert_PROMPT_CN"), NULL, NULL}, + {"O", CmdPrompt, _UU("CMD_MakeCert_PROMPT_O"), NULL, NULL}, + {"OU", CmdPrompt, _UU("CMD_MakeCert_PROMPT_OU"), NULL, NULL}, + {"C", CmdPrompt, _UU("CMD_MakeCert_PROMPT_C"), NULL, NULL}, + {"ST", CmdPrompt, _UU("CMD_MakeCert_PROMPT_ST"), NULL, NULL}, + {"L", CmdPrompt, _UU("CMD_MakeCert_PROMPT_L"), NULL, NULL}, + {"SERIAL", CmdPrompt, _UU("CMD_MakeCert_PROMPT_SERIAL"), NULL, NULL}, + {"EXPIRES", CmdPrompt, _UU("CMD_MakeCert_PROMPT_EXPIRES"), CmdEvalMinMax, &minmax}, + {"SIGNCERT", NULL, NULL, CmdEvalIsFile, NULL}, + {"SIGNKEY", NULL, NULL, CmdEvalIsFile, NULL}, + {"SAVECERT", CmdPrompt, _UU("CMD_MakeCert_PROMPT_SAVECERT"), CmdEvalNotEmpty, NULL}, + {"SAVEKEY", CmdPrompt, _UU("CMD_MakeCert_PROMPT_SAVEKEY"), CmdEvalNotEmpty, NULL}, + }; + + // Get the parameter list + o = ParseCommandList(c, cmd_name, str, args, sizeof(args) / sizeof(args[0])); + if (o == NULL) + { + return ERR_INVALID_PARAMETER; + } + + if (IsEmptyStr(GetParamStr(o, "SIGNCERT")) == false && IsEmptyStr(GetParamStr(o, "SIGNKEY")) == false) + { + root_x = FileToXW(GetParamUniStr(o, "SIGNCERT")); + root_k = FileToKW(GetParamUniStr(o, "SIGNKEY"), true, NULL); + + if (root_x == NULL || root_k == NULL || CheckXandK(root_x, root_k) == false) + { + ret = ERR_INTERNAL_ERROR; + + c->Write(c, _UU("CMD_MakeCert_ERROR_SIGNKEY")); + } + } + + if (ret == ERR_NO_ERROR) + { + buf = StrToBin(GetParamStr(o, "SERIAL")); + if (buf != NULL && buf->Size >= 1) + { + x_serial = NewXSerial(buf->Buf, buf->Size); + } + FreeBuf(buf); + + n = NewName(GetParamUniStr(o, "CN"), GetParamUniStr(o, "O"), GetParamUniStr(o, "OU"), + GetParamUniStr(o, "C"), GetParamUniStr(o, "ST"), GetParamUniStr(o, "L")); + + days = GetParamInt(o, "EXPIRES"); + if (days == 0) + { + days = 3650; + } + + RsaGen(&pri, &pub, 2048); + + if (root_x == NULL) + { + x = NewRootX(pub, pri, n, days, x_serial); + } + else + { + x = NewX(pub, root_k, root_x, n, days, x_serial); + } + + FreeXSerial(x_serial); + FreeName(n); + + if (x == NULL) + { + ret = ERR_INTERNAL_ERROR; + c->Write(c, _UU("CMD_MakeCert_ERROR_GEN_FAILED")); + } + else + { + if (XToFileW(x, GetParamUniStr(o, "SAVECERT"), true) == false) + { + c->Write(c, _UU("CMD_SAVECERT_FAILED")); + } + else if (KToFileW(pri, GetParamUniStr(o, "SAVEKEY"), true, NULL) == false) + { + c->Write(c, _UU("CMD_SAVEKEY_FAILED")); + } + } + } + + if (ret != ERR_NO_ERROR) + { + // Error has occurred + CmdPrintError(c, ret); + } + + // Release of the parameter list + FreeParamValueList(o); + + FreeX(root_x); + FreeK(root_k); + + FreeX(x); + FreeK(pri); + FreeK(pub); + + return ret; +} + +// Client management tool main +void PcMain(PC *pc) +{ + char prompt[MAX_SIZE]; + wchar_t tmp[MAX_SIZE]; + // Validate arguments + if (pc == NULL) + { + return; + } + + // Display a message that the connection has been made + UniFormat(tmp, sizeof(tmp), _UU("CMD_VPNCMD_CLIENT_CONNECTED"), + pc->ServerName); + pc->Console->Write(pc->Console, tmp); + pc->Console->Write(pc->Console, L""); + + while (true) + { + // Definition of command + CMD cmd[] = + { + {"About", PsAbout}, + {"Check", PtCheck}, + {"VersionGet", PcVersionGet}, + {"PasswordSet", PcPasswordSet}, + {"PasswordGet", PcPasswordGet}, + {"CertList", PcCertList}, + {"CertAdd", PcCertAdd}, + {"CertDelete", PcCertDelete}, + {"CertGet", PcCertGet}, + {"SecureList", PcSecureList}, + {"SecureSelect", PcSecureSelect}, + {"SecureGet", PcSecureGet}, + {"NicCreate", PcNicCreate}, + {"NicDelete", PcNicDelete}, + {"NicUpgrade", PcNicUpgrade}, + {"NicGetSetting", PcNicGetSetting}, + {"NicSetSetting", PcNicSetSetting}, + {"NicEnable", PcNicEnable}, + {"NicDisable", PcNicDisable}, + {"NicList", PcNicList}, + {"AccountList", PcAccountList}, + {"AccountCreate", PcAccountCreate}, + {"AccountSet", PcAccountSet}, + {"AccountGet", PcAccountGet}, + {"AccountDelete", PcAccountDelete}, + {"AccountUsernameSet", PcAccountUsernameSet}, + {"AccountAnonymousSet", PcAccountAnonymousSet}, + {"AccountPasswordSet", PcAccountPasswordSet}, + {"AccountCertSet", PcAccountCertSet}, + {"AccountCertGet", PcAccountCertGet}, + {"AccountEncryptDisable", PcAccountEncryptDisable}, + {"AccountEncryptEnable", PcAccountEncryptEnable}, + {"AccountCompressEnable", PcAccountCompressEnable}, + {"AccountCompressDisable", PcAccountCompressDisable}, + {"AccountHttpHeaderAdd", PcAccountHttpHeaderAdd}, + {"AccountHttpHeaderDelete", PcAccountHttpHeaderDelete}, + {"AccountHttpHeaderGet", PcAccountHttpHeaderGet}, + {"AccountProxyNone", PcAccountProxyNone}, + {"AccountProxyHttp", PcAccountProxyHttp}, + {"AccountProxySocks", PcAccountProxySocks}, + {"AccountProxySocks5", PcAccountProxySocks5}, + {"AccountServerCertEnable", PcAccountServerCertEnable}, + {"AccountServerCertDisable", PcAccountServerCertDisable}, + {"AccountRetryOnServerCertEnable", PcAccountRetryOnServerCertEnable}, + {"AccountRetryOnServerCertDisable", PcAccountRetryOnServerCertDisable}, + {"AccountServerCertSet", PcAccountServerCertSet}, + {"AccountServerCertDelete", PcAccountServerCertDelete}, + {"AccountServerCertGet", PcAccountServerCertGet}, + {"AccountDetailSet", PcAccountDetailSet}, + {"AccountRename", PcAccountRename}, + {"AccountConnect", PcAccountConnect}, + {"AccountDisconnect", PcAccountDisconnect}, + {"AccountStatusGet", PcAccountStatusGet}, + {"AccountNicSet", PcAccountNicSet}, + {"AccountStatusShow", PcAccountStatusShow}, + {"AccountStatusHide", PcAccountStatusHide}, + {"AccountSecureCertSet", PcAccountSecureCertSet}, + {"AccountOpensslEngineCertSet", PcAccountOpensslEngineCertSet}, + {"AccountRetrySet", PcAccountRetrySet}, + {"AccountStartupSet", PcAccountStartupSet}, + {"AccountStartupRemove", PcAccountStartupRemove}, + {"AccountExport", PcAccountExport}, + {"AccountImport", PcAccountImport}, + {"RemoteEnable", PcRemoteEnable}, + {"RemoteDisable", PcRemoteDisable}, + {"KeepEnable", PcKeepEnable}, + {"KeepDisable", PcKeepDisable}, + {"KeepSet", PcKeepSet}, + {"KeepGet", PcKeepGet}, + {"MakeCert", PtMakeCert}, + {"MakeCert2048", PtMakeCert2048}, + {"TrafficClient", PtTrafficClient}, + {"TrafficServer", PtTrafficServer}, + }; + + // Generate a prompt + StrCpy(prompt, sizeof(prompt), "VPN Client>"); + + if (DispatchNextCmdEx(pc->Console, pc->CmdLine, prompt, cmd, sizeof(cmd) / sizeof(cmd[0]), pc) == false) + { + break; + } + pc->LastError = pc->Console->RetCode; + + if (pc->LastError == ERR_NO_ERROR && pc->Console->ConsoleType != CONSOLE_CSV) + { + pc->Console->Write(pc->Console, _UU("CMD_MSG_OK")); + pc->Console->Write(pc->Console, L""); + } + + if (pc->CmdLine != NULL) + { + break; + } + } +} + +// Retrieve the version information of VPN Client service +UINT PcVersionGet(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) +{ + LIST *o; + PC *pc = (PC *)param; + UINT ret = ERR_NO_ERROR; + RPC_CLIENT_VERSION t; + + // Get the parameter list + o = ParseCommandList(c, cmd_name, str, NULL, 0); + if (o == NULL) + { + return ERR_INVALID_PARAMETER; + } + + // RPC call + Zero(&t, sizeof(t)); + + ret = CcGetClientVersion(pc->RemoteClient, &t); + + if (ret == ERR_NO_ERROR) + { + wchar_t tmp[MAX_SIZE]; + CT *ct; + + // Success + ct = CtNewStandard(); + + StrToUni(tmp, sizeof(tmp), t.ClientProductName); + CtInsert(ct, _UU("CMD_VersionGet_1"), tmp); + + StrToUni(tmp, sizeof(tmp), t.ClientVersionString); + CtInsert(ct, _UU("CMD_VersionGet_2"), tmp); + + StrToUni(tmp, sizeof(tmp), t.ClientBuildInfoString); + CtInsert(ct, _UU("CMD_VersionGet_3"), tmp); + + UniToStru(tmp, t.ProcessId); + CtInsert(ct, _UU("CMD_VersionGet_4"), tmp); + + StrToUni(tmp, sizeof(tmp), OsTypeToStr(t.OsType)); + CtInsert(ct, _UU("CMD_VersionGet_5"), tmp); + + CtFree(ct, c); + } + + if (ret != ERR_NO_ERROR) + { + // Error has occurred + CmdPrintError(c, ret); + } + + // Release the parameter list + FreeParamValueList(o); + + return ret; +} + +// Set a password to connect to the VPN Client Service +UINT PcPasswordSet(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) +{ + LIST *o; + PC *pc = (PC *)param; + UINT ret = ERR_NO_ERROR; + RPC_CLIENT_PASSWORD t; + // Parameter list that can be specified + PARAM args[] = + { + {"[password]", CmdPromptChoosePassword, NULL, NULL, NULL}, + {"REMOTEONLY", NULL, NULL, NULL, NULL}, + }; + + // Get the parameter list + o = ParseCommandList(c, cmd_name, str, args, sizeof(args) / sizeof(args[0])); + if (o == NULL) + { + return ERR_INVALID_PARAMETER; + } + + // RPC call + Zero(&t, sizeof(t)); + StrCpy(t.Password, sizeof(t.Password), GetParamStr(o, "[password]")); + t.PasswordRemoteOnly = GetParamYes(o, "REMOTEONLY"); + + ret = CcSetPassword(pc->RemoteClient, &t); + + if (ret == ERR_NO_ERROR) + { + // Success + } + + if (ret != ERR_NO_ERROR) + { + // Error has occurred + CmdPrintError(c, ret); + } + + // Release of the parameter list + FreeParamValueList(o); + + return ret; +} + +// Get the settings of the password to connect to the VPN Client service +UINT PcPasswordGet(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) +{ + LIST *o; + PC *pc = (PC *)param; + UINT ret = ERR_NO_ERROR; + RPC_CLIENT_PASSWORD_SETTING t; + + // Get the parameter list + o = ParseCommandList(c, cmd_name, str, NULL, 0); + if (o == NULL) + { + return ERR_INVALID_PARAMETER; + } + + // RPC call + Zero(&t, sizeof(t)); + + ret = CcGetPasswordSetting(pc->RemoteClient, &t); + + if (ret == ERR_NO_ERROR) + { + // Success + CT *ct = CtNewStandard(); + + CtInsert(ct, _UU("CMD_PasswordGet_1"), + t.IsPasswordPresented ? _UU("CMD_MSG_ENABLE") : _UU("CMD_MSG_DISABLE")); + + CtInsert(ct, _UU("CMD_PasswordGet_2"), + t.PasswordRemoteOnly ? _UU("CMD_MSG_ENABLE") : _UU("CMD_MSG_DISABLE")); + + CtFree(ct, c); + } + + if (ret != ERR_NO_ERROR) + { + // Error has occurred + CmdPrintError(c, ret); + } + + // Release the parameter list + FreeParamValueList(o); + + return ret; +} + +// Get the list of certificates of the trusted certification authority +UINT PcCertList(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) +{ + LIST *o; + PC *pc = (PC *)param; + UINT ret = ERR_NO_ERROR; + RPC_CLIENT_ENUM_CA t; + + // Get the parameter list + o = ParseCommandList(c, cmd_name, str, NULL, 0); + if (o == NULL) + { + return ERR_INVALID_PARAMETER; + } + + // RPC call + Zero(&t, sizeof(t)); + + ret = CcEnumCa(pc->RemoteClient, &t); + + if (ret == ERR_NO_ERROR) + { + // Success + UINT i; + CT *ct = CtNewStandard(); + + for (i = 0;i < t.NumItem;i++) + { + wchar_t tmp[MAX_SIZE]; + wchar_t tmp2[64]; + RPC_CLIENT_ENUM_CA_ITEM *e = t.Items[i]; + + GetDateStrEx64(tmp, sizeof(tmp), SystemToLocal64(e->Expires), NULL); + + UniToStru(tmp2, e->Key); + + CtInsert(ct, _UU("CMD_CAList_COLUMN_ID"), tmp2); + CtInsert(ct, _UU("CM_CERT_COLUMN_1"), e->SubjectName); + CtInsert(ct, _UU("CM_CERT_COLUMN_2"), e->IssuerName); + CtInsert(ct, _UU("CM_CERT_COLUMN_3"), tmp); + + if (i != (t.NumItem - 1)) + { + CtInsert(ct, L"---", L"---"); + } + } + + CtFree(ct, c); + + CiFreeClientEnumCa(&t); + } + + if (ret != ERR_NO_ERROR) + { + // Error has occurred + CmdPrintError(c, ret); + } + + + // Release of the parameter list + FreeParamValueList(o); + + return ret; +} + +// Add a certificate of the trusted certification authority +UINT PcCertAdd(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) +{ + LIST *o; + PC *pc = (PC *)param; + UINT ret = ERR_NO_ERROR; + RPC_CERT t; + X *x; + // Parameter list that can be specified + PARAM args[] = + { + {"[path]", CmdPrompt, _UU("CMD_CAAdd_PROMPT_PATH"), CmdEvalIsFile, NULL}, + }; + + // Get the parameter list + o = ParseCommandList(c, cmd_name, str, args, sizeof(args) / sizeof(args[0])); + if (o == NULL) + { + return ERR_INVALID_PARAMETER; + } + + + x = FileToXW(GetParamUniStr(o, "[path]")); + + if (x == NULL) + { + FreeParamValueList(o); + c->Write(c, _UU("CMD_MSG_LOAD_CERT_FAILED")); + return ERR_INVALID_PARAMETER; + } + + // RPC call + Zero(&t, sizeof(t)); + t.x = x; + + ret = CcAddCa(pc->RemoteClient, &t); + + if (ret == ERR_NO_ERROR) + { + // Success + } + + if (ret != ERR_NO_ERROR) + { + // Error has occurred + CmdPrintError(c, ret); + } + + FreeX(x); + + // Release of the parameter list + FreeParamValueList(o); + + return ret; +} + +// Delete the certificate of the trusted certification authority +UINT PcCertDelete(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) +{ + LIST *o; + PC *pc = (PC *)param; + UINT ret = ERR_NO_ERROR; + RPC_CLIENT_DELETE_CA t; + // Parameter list that can be specified + PARAM args[] = + { + {"[id]", CmdPrompt, _UU("CMD_CADelete_PROMPT_ID"), CmdEvalNotEmpty, NULL}, + }; + + // Get the parameter list + o = ParseCommandList(c, cmd_name, str, args, sizeof(args) / sizeof(args[0])); + if (o == NULL) + { + return ERR_INVALID_PARAMETER; + } + + // RPC call + Zero(&t, sizeof(t)); + t.Key = GetParamInt(o, "[id]"); + + ret = CcDeleteCa(pc->RemoteClient, &t); + + if (ret == ERR_NO_ERROR) + { + // Success + } + + if (ret != ERR_NO_ERROR) + { + // Error has occurred + CmdPrintError(c, ret); + } + + // Release of the parameter list + FreeParamValueList(o); + + return ret; +} + +// Get the certificate of the trusted certification authority +UINT PcCertGet(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) +{ + LIST *o; + PC *pc = (PC *)param; + UINT ret = ERR_NO_ERROR; + RPC_GET_CA t; + // Parameter list that can be specified + PARAM args[] = + { + {"[id]", CmdPrompt, _UU("CMD_CAGet_PROMPT_ID"), CmdEvalNotEmpty, NULL}, + {"SAVECERT", CmdPrompt, _UU("CMD_CAGet_PROMPT_SAVECERT"), CmdEvalNotEmpty, NULL}, + }; + + // Get the parameter list + o = ParseCommandList(c, cmd_name, str, args, sizeof(args) / sizeof(args[0])); + if (o == NULL) + { + return ERR_INVALID_PARAMETER; + } + + // RPC call + Zero(&t, sizeof(t)); + t.Key = GetParamInt(o, "[id]"); + + ret = CcGetCa(pc->RemoteClient, &t); + + if (ret == ERR_NO_ERROR) + { + // Success + if (XToFileW(t.x, GetParamUniStr(o, "SAVECERT"), true)) + { + // Success + } + else + { + // Failure + ret = ERR_INTERNAL_ERROR; + c->Write(c, _UU("CMD_MSG_SAVE_CERT_FAILED")); + } + + CiFreeGetCa(&t); + } + + if (ret != ERR_NO_ERROR) + { + // Error has occurred + CmdPrintError(c, ret); + } + + // Release of the parameter list + FreeParamValueList(o); + + return ret; +} + +// Get the list of the type of smart card that can be used +UINT PcSecureList(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) +{ + LIST *o; + PC *pc = (PC *)param; + UINT ret = ERR_NO_ERROR; + RPC_CLIENT_ENUM_SECURE t; + + // Get the parameter list + o = ParseCommandList(c, cmd_name, str, NULL, 0); + if (o == NULL) + { + return ERR_INVALID_PARAMETER; + } + + // RPC call + Zero(&t, sizeof(t)); + + ret = CcEnumSecure(pc->RemoteClient, &t); + + if (ret == ERR_NO_ERROR) + { + CT *ct; + UINT i; + wchar_t tmp1[MAX_SIZE]; + wchar_t tmp2[MAX_SIZE]; + wchar_t tmp4[MAX_SIZE]; + wchar_t *tmp3; + + // Success + ct = CtNew(); + CtInsertColumn(ct, _UU("SEC_COLUMN1"), false); + CtInsertColumn(ct, _UU("SEC_COLUMN2"), false); + CtInsertColumn(ct, _UU("SEC_COLUMN3"), false); + CtInsertColumn(ct, _UU("SEC_COLUMN4"), false); + + for (i = 0;i < t.NumItem;i++) + { + RPC_CLIENT_ENUM_SECURE_ITEM *e = t.Items[i]; + + // ID + UniToStru(tmp1, e->DeviceId); + + // Device name + StrToUni(tmp2, sizeof(tmp2), e->DeviceName); + + // Type + tmp3 = (e->Type == SECURE_IC_CARD) ? _UU("SEC_SMART_CARD") : _UU("SEC_USB_TOKEN"); + + // Manufacturer + StrToUni(tmp4, sizeof(tmp4), e->Manufacturer); + + CtInsert(ct, tmp1, tmp2, tmp3, tmp4); + } + + CtFreeEx(ct, c, true); + + CiFreeClientEnumSecure(&t); + } + + if (ret != ERR_NO_ERROR) + { + // Error has occurred + CmdPrintError(c, ret); + } + + // Release of the parameter list + FreeParamValueList(o); + + return ret; +} + +// Select the type of smart card to be used +UINT PcSecureSelect(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) +{ + LIST *o; + PC *pc = (PC *)param; + UINT ret = ERR_NO_ERROR; + RPC_USE_SECURE t; + // Parameter list that can be specified + PARAM args[] = + { + {"[id]", CmdPrompt, _UU("CMD_SecureSelect_PROMPT_ID"), NULL, NULL}, + }; + + // Get the parameter list + o = ParseCommandList(c, cmd_name, str, args, sizeof(args) / sizeof(args[0])); + if (o == NULL) + { + return ERR_INVALID_PARAMETER; + } + + // RPC call + Zero(&t, sizeof(t)); + t.DeviceId = GetParamInt(o, "[id]"); + + ret = CcUseSecure(pc->RemoteClient, &t); + + if (ret == ERR_NO_ERROR) + { + // Success + } + + if (ret != ERR_NO_ERROR) + { + // Error has occurred + CmdPrintError(c, ret); + } + + // Release of the parameter list + FreeParamValueList(o); + + return ret; +} + +// Get the type ID of smart card to be used +UINT PcSecureGet(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) +{ + LIST *o; + PC *pc = (PC *)param; + UINT ret = ERR_NO_ERROR; + RPC_USE_SECURE t; + + // Get the parameter list + o = ParseCommandList(c, cmd_name, str, NULL, 0); + if (o == NULL) + { + return ERR_INVALID_PARAMETER; + } + + // RPC call + Zero(&t, sizeof(t)); + + ret = CcGetUseSecure(pc->RemoteClient, &t); + + if (ret == ERR_NO_ERROR) + { + // Success + wchar_t tmp[MAX_SIZE]; + + if (t.DeviceId != 0) + { + UniFormat(tmp, sizeof(tmp), _UU("CMD_SecureGet_Print"), t.DeviceId); + } + else + { + UniStrCpy(tmp, sizeof(tmp), _UU("CMD_SecureGet_NoPrint")); + } + c->Write(c, tmp); + } + + if (ret != ERR_NO_ERROR) + { + // Error has occurred + CmdPrintError(c, ret); + } + + // Release of the parameter list + FreeParamValueList(o); + + return ret; +} + +// Create a new virtual LAN card +UINT PcNicCreate(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) +{ + LIST *o; + PC *pc = (PC *)param; + UINT ret = ERR_NO_ERROR; + RPC_CLIENT_CREATE_VLAN t; + // Parameter list that can be specified + PARAM args[] = + { + {"[name]", CmdPrompt, _UU("CMD_NicCreate_PROMPT_NAME"), CmdEvalNotEmpty, NULL}, + }; + + // Get the parameter list + o = ParseCommandList(c, cmd_name, str, args, sizeof(args) / sizeof(args[0])); + if (o == NULL) + { + return ERR_INVALID_PARAMETER; + } + + // RPC call + Zero(&t, sizeof(t)); + StrCpy(t.DeviceName, sizeof(t.DeviceName), GetParamStr(o, "[name]")); + + ret = CcCreateVLan(pc->RemoteClient, &t); + + if (ret == ERR_NO_ERROR) + { + // Success + } + + if (ret != ERR_NO_ERROR) + { + // Error has occurred + CmdPrintError(c, ret); + } + + // Release of the parameter list + FreeParamValueList(o); + + return ret; +} + +// Delete the virtual LAN card +UINT PcNicDelete(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) +{ + LIST *o; + PC *pc = (PC *)param; + UINT ret = ERR_NO_ERROR; + RPC_CLIENT_CREATE_VLAN t; + // Parameter list that can be specified + PARAM args[] = + { + {"[name]", CmdPrompt, _UU("CMD_NicCreate_PROMPT_NAME"), CmdEvalNotEmpty, NULL}, + }; + + // Get the parameter list + o = ParseCommandList(c, cmd_name, str, args, sizeof(args) / sizeof(args[0])); + if (o == NULL) + { + return ERR_INVALID_PARAMETER; + } + + // RPC call + Zero(&t, sizeof(t)); + StrCpy(t.DeviceName, sizeof(t.DeviceName), GetParamStr(o, "[name]")); + + ret = CcDeleteVLan(pc->RemoteClient, &t); + + if (ret == ERR_NO_ERROR) + { + // Success + } + + if (ret != ERR_NO_ERROR) + { + // Error has occurred + CmdPrintError(c, ret); + } + + // Release of the parameter list + FreeParamValueList(o); + + return ret; +} + +// Upgrading the device driver of the virtual LAN card +UINT PcNicUpgrade(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) +{ + LIST *o; + PC *pc = (PC *)param; + UINT ret = ERR_NO_ERROR; + RPC_CLIENT_CREATE_VLAN t; + // Parameter list that can be specified + PARAM args[] = + { + {"[name]", CmdPrompt, _UU("CMD_NicCreate_PROMPT_NAME"), CmdEvalNotEmpty, NULL}, + }; + + // Get the parameter list + o = ParseCommandList(c, cmd_name, str, args, sizeof(args) / sizeof(args[0])); + if (o == NULL) + { + return ERR_INVALID_PARAMETER; + } + + // RPC call + Zero(&t, sizeof(t)); + StrCpy(t.DeviceName, sizeof(t.DeviceName), GetParamStr(o, "[name]")); + + ret = CcUpgradeVLan(pc->RemoteClient, &t); + + if (ret == ERR_NO_ERROR) + { + // Success + } + + if (ret != ERR_NO_ERROR) + { + // Error has occurred + CmdPrintError(c, ret); + } + + // Release of the parameter list + FreeParamValueList(o); + + return ret; +} + +// Get the settings of the virtual LAN card +UINT PcNicGetSetting(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) +{ + LIST *o; + PC *pc = (PC *)param; + UINT ret = ERR_NO_ERROR; + RPC_CLIENT_GET_VLAN t; + // Parameter list that can be specified + PARAM args[] = + { + {"[name]", CmdPrompt, _UU("CMD_NicCreate_PROMPT_NAME"), CmdEvalNotEmpty, NULL}, + }; + + // Get the parameter list + o = ParseCommandList(c, cmd_name, str, args, sizeof(args) / sizeof(args[0])); + if (o == NULL) + { + return ERR_INVALID_PARAMETER; + } + + // RPC call + Zero(&t, sizeof(t)); + StrCpy(t.DeviceName, sizeof(t.DeviceName), GetParamStr(o, "[name]")); + + ret = CcGetVLan(pc->RemoteClient, &t); + + if (ret == ERR_NO_ERROR) + { + // Success + CT *ct = CtNewStandard(); + wchar_t tmp[MAX_SIZE]; + + StrToUni(tmp, sizeof(tmp), t.DeviceName); + CtInsert(ct, _UU("CMD_NicGetSetting_1"), tmp); + + CtInsert(ct, _UU("CMD_NicGetSetting_2"), t.Enabled ? _UU("CMD_MSG_ENABLE") : _UU("CMD_MSG_DISABLE")); + + StrToUni(tmp, sizeof(tmp), t.MacAddress); + CtInsert(ct, _UU("CMD_NicGetSetting_3"), tmp); + + StrToUni(tmp, sizeof(tmp), t.Version); + CtInsert(ct, _UU("CMD_NicGetSetting_4"), tmp); + + StrToUni(tmp, sizeof(tmp), t.FileName); + CtInsert(ct, _UU("CMD_NicGetSetting_5"), tmp); + + StrToUni(tmp, sizeof(tmp), t.Guid); + CtInsert(ct, _UU("CMD_NicGetSetting_6"), tmp); + + CtFree(ct, c); + } + + if (ret != ERR_NO_ERROR) + { + // Error has occurred + CmdPrintError(c, ret); + } + + // Release of the parameter list + FreeParamValueList(o); + + return ret; +} + +// Change the settings for the virtual LAN card +UINT PcNicSetSetting(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) +{ + LIST *o; + PC *pc = (PC *)param; + UINT ret = ERR_NO_ERROR; + RPC_CLIENT_SET_VLAN t; + UCHAR mac_address[6]; + BUF *b; + // Parameter list that can be specified + PARAM args[] = + { + {"[name]", CmdPrompt, _UU("CMD_NicCreate_PROMPT_NAME"), CmdEvalNotEmpty, NULL}, + {"MAC", CmdPrompt, _UU("CMD_NicSetSetting_PROMPT_MAC"), CmdEvalNotEmpty, NULL}, + }; + + // Get the parameter list + o = ParseCommandList(c, cmd_name, str, args, sizeof(args) / sizeof(args[0])); + if (o == NULL) + { + return ERR_INVALID_PARAMETER; + } + + // Inspect the MAC address + Zero(mac_address, sizeof(mac_address)); + b = StrToBin(GetParamStr(o, "MAC")); + if (b != NULL && b->Size == 6) + { + Copy(mac_address, b->Buf, 6); + } + FreeBuf(b); + + if (IsZero(mac_address, 6)) + { + // MAC address is invalid + FreeParamValueList(o); + + CmdPrintError(c, ERR_INVALID_PARAMETER); + return ERR_INVALID_PARAMETER; + } + + // RPC call + Zero(&t, sizeof(t)); + StrCpy(t.DeviceName, sizeof(t.DeviceName), GetParamStr(o, "[name]")); + NormalizeMacAddress(t.MacAddress, sizeof(t.MacAddress), GetParamStr(o, "MAC")); + + ret = CcSetVLan(pc->RemoteClient, &t); + + if (ret == ERR_NO_ERROR) + { + // Success + } + + if (ret != ERR_NO_ERROR) + { + // Error has occurred + CmdPrintError(c, ret); + } + + // Release of the parameter list + FreeParamValueList(o); + + return ret; +} + +// Enable the virtual LAN card +UINT PcNicEnable(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) +{ + LIST *o; + PC *pc = (PC *)param; + UINT ret = ERR_NO_ERROR; + RPC_CLIENT_CREATE_VLAN t; + // Parameter list that can be specified + PARAM args[] = + { + {"[name]", CmdPrompt, _UU("CMD_NicCreate_PROMPT_NAME"), CmdEvalNotEmpty, NULL}, + }; + + // Get the parameter list + o = ParseCommandList(c, cmd_name, str, args, sizeof(args) / sizeof(args[0])); + if (o == NULL) + { + return ERR_INVALID_PARAMETER; + } + + // RPC call + Zero(&t, sizeof(t)); + StrCpy(t.DeviceName, sizeof(t.DeviceName), GetParamStr(o, "[name]")); + + ret = CcEnableVLan(pc->RemoteClient, &t); + + if (ret == ERR_NO_ERROR) + { + // Success + } + + if (ret != ERR_NO_ERROR) + { + // Error has occurred + CmdPrintError(c, ret); + } + + // Release of the parameter list + FreeParamValueList(o); + + return ret; +} + +// Disable the virtual LAN card +UINT PcNicDisable(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) +{ + LIST *o; + PC *pc = (PC *)param; + UINT ret = ERR_NO_ERROR; + RPC_CLIENT_CREATE_VLAN t; + // Parameter list that can be specified + PARAM args[] = + { + {"[name]", CmdPrompt, _UU("CMD_NicCreate_PROMPT_NAME"), CmdEvalNotEmpty, NULL}, + }; + + // Get the parameter list + o = ParseCommandList(c, cmd_name, str, args, sizeof(args) / sizeof(args[0])); + if (o == NULL) + { + return ERR_INVALID_PARAMETER; + } + + // RPC call + Zero(&t, sizeof(t)); + StrCpy(t.DeviceName, sizeof(t.DeviceName), GetParamStr(o, "[name]")); + + ret = CcDisableVLan(pc->RemoteClient, &t); + + if (ret == ERR_NO_ERROR) + { + // Success + } + + if (ret != ERR_NO_ERROR) + { + // Error has occurred + CmdPrintError(c, ret); + } + + // Release of the parameter list + FreeParamValueList(o); + + return ret; +} + +// Get the Virtual LAN card list +UINT PcNicList(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) +{ + LIST *o; + PC *pc = (PC *)param; + UINT ret = ERR_NO_ERROR; + RPC_CLIENT_ENUM_VLAN t; + + // Get the parameter list + o = ParseCommandList(c, cmd_name, str, NULL, 0); + if (o == NULL) + { + return ERR_INVALID_PARAMETER; + } + + // RPC call + Zero(&t, sizeof(t)); + + ret = CcEnumVLan(pc->RemoteClient, &t); + + if (ret == ERR_NO_ERROR) + { + CT *ct; + UINT i; + + // Success + ct = CtNew(); + CtInsertColumn(ct, _UU("CM_VLAN_COLUMN_1"), false); + CtInsertColumn(ct, _UU("CM_VLAN_COLUMN_2"), false); + CtInsertColumn(ct, _UU("CM_VLAN_COLUMN_3"), false); + CtInsertColumn(ct, _UU("CM_VLAN_COLUMN_4"), false); + + for (i = 0;i < t.NumItem;i++) + { + wchar_t name[MAX_SIZE]; + wchar_t mac[MAX_SIZE]; + wchar_t ver[MAX_SIZE]; + wchar_t *status; + RPC_CLIENT_ENUM_VLAN_ITEM *v = t.Items[i]; + + // Device name + StrToUni(name, sizeof(name), v->DeviceName); + + // State + status = v->Enabled ? _UU("CM_VLAN_ENABLED") : _UU("CM_VLAN_DISABLED"); + + // MAC address + StrToUni(mac, sizeof(mac), v->MacAddress); + + // Version + StrToUni(ver, sizeof(ver), v->Version); + + CtInsert(ct, + name, status, mac, ver); + } + + CtFreeEx(ct, c, true); + } + + if (ret != ERR_NO_ERROR) + { + // Error has occurred + CmdPrintError(c, ret); + } + + CiFreeClientEnumVLan(&t); + + // Release of the parameter list + FreeParamValueList(o); + + return ret; +} + +// Get the protocol name string from ID +wchar_t *GetProtocolName(UINT n) +{ + switch (n) + { + case PROXY_DIRECT: + return _UU("PROTO_DIRECT_TCP"); + case PROXY_HTTP: + return _UU("PROTO_HTTP_PROXY"); + case PROXY_SOCKS: + return _UU("PROTO_SOCKS_PROXY"); + case PROXY_SOCKS5: + return _UU("PROTO_SOCKS5_PROXY"); + } + + return _UU("PROTO_UNKNOWN"); +} + +// Get the connection settings list +UINT PcAccountList(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) +{ + LIST *o; + PC *pc = (PC *)param; + UINT ret = ERR_NO_ERROR; + RPC_CLIENT_ENUM_ACCOUNT t; + + // Get the parameter list + o = ParseCommandList(c, cmd_name, str, NULL, 0); + if (o == NULL) + { + return ERR_INVALID_PARAMETER; + } + + // RPC call + Zero(&t, sizeof(t)); + + ret = CcEnumAccount(pc->RemoteClient, &t); + + if (ret == ERR_NO_ERROR) + { + UINT i; + CT *ct; + + // Success + ct = CtNew(); + CtInsertColumn(ct, _UU("CM_ACCOUNT_COLUMN_1"), false); + CtInsertColumn(ct, _UU("CM_ACCOUNT_COLUMN_2"), false); + CtInsertColumn(ct, _UU("CM_ACCOUNT_COLUMN_3"), false); + CtInsertColumn(ct, _UU("CM_ACCOUNT_COLUMN_3_2"), false); + CtInsertColumn(ct, _UU("CM_ACCOUNT_COLUMN_4"), false); + + for (i = 0;i < t.NumItem;i++) + { + RPC_CLIENT_ENUM_ACCOUNT_ITEM *e = t.Items[i]; + wchar_t tmp[MAX_SIZE]; + wchar_t tmp2[MAX_SIZE]; + wchar_t tmp4[MAX_SIZE]; + IP ip; + char ip_str[MAX_SIZE]; + + // Special treatment for IPv6 addresses + if (StrToIP6(&ip, e->ServerName) && StartWith(e->ServerName, "[") == false) + { + Format(ip_str, sizeof(ip_str), + "[%s]", e->ServerName); + } + else + { + StrCpy(ip_str, sizeof(ip_str), e->ServerName); + } + + if (e->Port == 0) + { + // Port number unknown + UniFormat(tmp2, sizeof(tmp2), L"%S (%s)", ip_str, GetProtocolName(e->ProxyType)); + } + else + { + // Port number are also shown + UniFormat(tmp2, sizeof(tmp2), L"%S:%u (%s)", ip_str, e->Port, GetProtocolName(e->ProxyType)); + } + + // Virtual HUB name + StrToUni(tmp4, sizeof(tmp4), e->HubName); + + // Add + StrToUni(tmp, sizeof(tmp), e->DeviceName); + + CtInsert(ct, + e->AccountName, + e->Active == false ? _UU("CM_ACCOUNT_OFFLINE") : + (e->Connected ? _UU("CM_ACCOUNT_ONLINE") : _UU("CM_ACCOUNT_CONNECTING")), + tmp2, tmp4, + tmp); + } + + CtFreeEx(ct, c, true); + } + + CiFreeClientEnumAccount(&t); + + if (ret != ERR_NO_ERROR) + { + // Error has occurred + CmdPrintError(c, ret); + } + + // Release of the parameter list + FreeParamValueList(o); + + return ret; +} + +// Create new connection settings +UINT PcAccountCreate(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) +{ + LIST *o; + PC *pc = (PC *)param; + UINT ret = ERR_NO_ERROR; + RPC_CLIENT_CREATE_ACCOUNT t; + UINT port = 443; + char *host = NULL; + // Parameter list that can be specified + PARAM args[] = + { + {"[name]", CmdPrompt, _UU("CMD_AccountCreate_Prompt_Name"), CmdEvalNotEmpty, NULL}, + {"SERVER", CmdPrompt, _UU("CMD_AccountCreate_Prompt_Server"), CmdEvalHostAndPort, NULL}, + {"HUB", CmdPrompt, _UU("CMD_AccountCreate_Prompt_Hub"), CmdEvalSafe, NULL}, + {"USERNAME", CmdPrompt, _UU("CMD_AccountCreate_Prompt_Username"), CmdEvalNotEmpty, NULL}, + {"NICNAME", CmdPrompt, _UU("CMD_AccountCreate_Prompt_Nicname"), CmdEvalNotEmpty, NULL}, + }; + + // Get the parameter list + o = ParseCommandList(c, cmd_name, str, args, sizeof(args) / sizeof(args[0])); + if (o == NULL) + { + return ERR_INVALID_PARAMETER; + } + + ParseHostPort(GetParamStr(o, "SERVER"), &host, &port, 443); + + // RPC call + Zero(&t, sizeof(t)); + + t.ClientOption = ZeroMalloc(sizeof(CLIENT_OPTION)); + UniStrCpy(t.ClientOption->AccountName, sizeof(t.ClientOption->AccountName), GetParamUniStr(o, "[name]")); + t.ClientOption->Port = port; + StrCpy(t.ClientOption->Hostname, sizeof(t.ClientOption->Hostname), host); + StrCpy(t.ClientOption->HubName, sizeof(t.ClientOption->HubName), GetParamStr(o, "HUB")); + t.ClientOption->NumRetry = INFINITE; + t.ClientOption->RetryInterval = 15; + t.ClientOption->MaxConnection = 1; + t.ClientOption->UseEncrypt = true; + t.ClientOption->AdditionalConnectionInterval = 1; + StrCpy(t.ClientOption->DeviceName, sizeof(t.ClientOption->DeviceName), GetParamStr(o, "NICNAME")); + + t.ClientAuth = ZeroMalloc(sizeof(CLIENT_AUTH)); + t.ClientAuth->AuthType = CLIENT_AUTHTYPE_ANONYMOUS; + StrCpy(t.ClientAuth->Username, sizeof(t.ClientAuth->Username), GetParamStr(o, "USERNAME")); + + Free(host); + + ret = CcCreateAccount(pc->RemoteClient, &t); + + if (ret == ERR_NO_ERROR) + { + // Success + } + + CiFreeClientCreateAccount(&t); + + if (ret != ERR_NO_ERROR) + { + // Error has occurred + CmdPrintError(c, ret); + } + + // Release of the parameter list + FreeParamValueList(o); + + return ret; +} + +// Set the destination of the connection settings +UINT PcAccountSet(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) +{ + LIST *o; + PC *pc = (PC *)param; + UINT ret = ERR_NO_ERROR; + RPC_CLIENT_GET_ACCOUNT t; + char *host = NULL; + UINT port = 443; + // Parameter list that can be specified + PARAM args[] = + { + {"[name]", CmdPrompt, _UU("CMD_AccountCreate_Prompt_Name"), CmdEvalNotEmpty, NULL}, + {"SERVER", CmdPrompt, _UU("CMD_AccountCreate_Prompt_Server"), CmdEvalHostAndPort, NULL}, + {"HUB", CmdPrompt, _UU("CMD_AccountCreate_Prompt_Hub"), CmdEvalSafe, NULL}, + }; + + // Get the parameter list + o = ParseCommandList(c, cmd_name, str, args, sizeof(args) / sizeof(args[0])); + if (o == NULL) + { + return ERR_INVALID_PARAMETER; + } + + // RPC call + Zero(&t, sizeof(t)); + + ParseHostPort(GetParamStr(o, "SERVER"), &host, &port, 443); + + Zero(&t, sizeof(t)); + UniStrCpy(t.AccountName, sizeof(t.AccountName), GetParamUniStr(o, "[name]")); + + ret = CcGetAccount(pc->RemoteClient, &t); + + if (ret == ERR_NO_ERROR) + { + RPC_CLIENT_CREATE_ACCOUNT c; + // Success + t.ClientOption->Port = port; + StrCpy(t.ClientOption->Hostname, sizeof(t.ClientOption->Hostname), host); + StrCpy(t.ClientOption->HubName, sizeof(t.ClientOption->HubName), GetParamStr(o, "HUB")); + + Zero(&c, sizeof(c)); + + c.ClientAuth = t.ClientAuth; + c.ClientOption = t.ClientOption; + c.CheckServerCert = t.CheckServerCert; + c.RetryOnServerCert = t.RetryOnServerCert; + c.ServerCert = t.ServerCert; + c.StartupAccount = t.StartupAccount; + + ret = CcSetAccount(pc->RemoteClient, &c); + } + + if (ret != ERR_NO_ERROR) + { + // Error has occurred + CmdPrintError(c, ret); + } + + CiFreeClientGetAccount(&t); + + // Release of the parameter list + FreeParamValueList(o); + + Free(host); + + return ret; +} + +// Get the configuration of the connection settings +UINT PcAccountGet(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) +{ + LIST *o; + PC *pc = (PC *)param; + UINT ret = ERR_NO_ERROR; + RPC_CLIENT_GET_ACCOUNT t; + // Parameter list that can be specified + PARAM args[] = + { + {"[name]", CmdPrompt, _UU("CMD_AccountCreate_Prompt_Name"), CmdEvalNotEmpty, NULL}, + }; + + // Get the parameter list + o = ParseCommandList(c, cmd_name, str, args, sizeof(args) / sizeof(args[0])); + if (o == NULL) + { + return ERR_INVALID_PARAMETER; + } + + // RPC call + Zero(&t, sizeof(t)); + UniStrCpy(t.AccountName, sizeof(t.AccountName), GetParamUniStr(o, "[name]")); + + ret = CcGetAccount(pc->RemoteClient, &t); + + if (ret == ERR_NO_ERROR) + { + // Show the contents of the connection settings + wchar_t tmp[MAX_SIZE]; + + CT *ct = CtNewStandard(); + + // Connection settings name + CtInsert(ct, _UU("CMD_ACCOUNT_COLUMN_NAME"), t.ClientOption->AccountName); + + // Host name of the destination VPN Server + StrToUni(tmp, sizeof(tmp), t.ClientOption->Hostname); + CtInsert(ct, _UU("CMD_ACCOUNT_COLUMN_HOSTNAME"), tmp); + + // The port number to connect to VPN Server + UniToStru(tmp, t.ClientOption->Port); + CtInsert(ct, _UU("CMD_ACCOUNT_COLUMN_PORT"), tmp); + + // Virtual HUB name of the destination VPN Server + StrToUni(tmp, sizeof(tmp), t.ClientOption->HubName); + CtInsert(ct, _UU("CMD_ACCOUNT_COLUMN_HUBNAME"), tmp); + + // Type of proxy server to go through + CtInsert(ct, _UU("CMD_ACCOUNT_COLUMN_PROXY_TYPE"), GetProxyTypeStr(t.ClientOption->ProxyType)); + + if (t.ClientOption->ProxyType != PROXY_DIRECT) + { + // Host name of the proxy server + StrToUni(tmp, sizeof(tmp), t.ClientOption->ProxyName); + CtInsert(ct, _UU("CMD_ACCOUNT_COLUMN_PROXY_HOSTNAME"), tmp); + + // Port number of the proxy server + UniToStru(tmp, t.ClientOption->ProxyPort); + CtInsert(ct, _UU("CMD_ACCOUNT_COLUMN_PROXY_PORT"), tmp); + + // User name of the proxy server + StrToUni(tmp, sizeof(tmp), t.ClientOption->ProxyUsername); + CtInsert(ct, _UU("CMD_ACCOUNT_COLUMN_PROXY_USERNAME"), tmp); + } + + // Verify the server certificate + CtInsert(ct, _UU("CMD_ACCOUNT_COLUMN_SERVER_CERT_USE"), + t.CheckServerCert ? _UU("CMD_MSG_ENABLE") : _UU("CMD_MSG_DISABLE")); + + // Registered specific certificate + if (t.ServerCert != NULL) + { + GetAllNameFromX(tmp, sizeof(tmp), t.ServerCert); + CtInsert(ct, _UU("CMD_ACCOUNT_COLUMN_SERVER_CERT_NAME"), tmp); + } + + if (t.CheckServerCert) + { + CtInsert(ct, _UU("CMD_ACCOUNT_COLUMN_RETRY_ON_SERVER_CERT"), + t.RetryOnServerCert ? _UU("CMD_MSG_ENABLE") : _UU("CMD_MSG_DISABLE")); + } + + // Device name to be used for the connection + StrToUni(tmp, sizeof(tmp), t.ClientOption->DeviceName); + CtInsert(ct, _UU("CMD_ACCOUNT_COLUMN_DEVICE_NAME"), tmp); + + // Authentication type + CtInsert(ct, _UU("CMD_ACCOUNT_COLUMN_AUTH_TYPE"), GetClientAuthTypeStr(t.ClientAuth->AuthType)); + + // User name + StrToUni(tmp, sizeof(tmp), t.ClientAuth->Username); + CtInsert(ct, _UU("CMD_ACCOUNT_COLUMN_AUTH_USERNAME"), tmp); + + if (t.ClientAuth->AuthType == CLIENT_AUTHTYPE_CERT) + { + if (t.ClientAuth->ClientX != NULL) + { + // Client certificate name + GetAllNameFromX(tmp, sizeof(tmp), t.ClientAuth->ClientX); + CtInsert(ct, _UU("CMD_ACCOUNT_COLUMN_AUTH_CERT_NAME"), tmp); + } + } + + // Number of TCP connections to be used for VPN communication + UniToStru(tmp, t.ClientOption->MaxConnection); + CtInsert(ct, _UU("CMD_ACCOUNT_COLUMN_NUMTCP"), tmp); + + // Establishment interval of each TCP connection + UniToStru(tmp, t.ClientOption->AdditionalConnectionInterval); + CtInsert(ct, _UU("CMD_ACCOUNT_COLUMN_TCP_INTERVAL"), tmp); + + // Life span of each TCP connection + if (t.ClientOption->ConnectionDisconnectSpan != 0) + { + UniToStru(tmp, t.ClientOption->ConnectionDisconnectSpan); + } + else + { + UniStrCpy(tmp, sizeof(tmp), _UU("CMD_MSG_INFINITE")); + } + CtInsert(ct, _UU("CMD_ACCOUNT_COLUMN_TCP_TTL"), tmp); + + // Use of half-duplex mode + CtInsert(ct, _UU("CMD_ACCOUNT_COLUMN_TCP_HALF"), + t.ClientOption->HalfConnection ? _UU("CMD_MSG_ENABLE") : _UU("CMD_MSG_DISABLE")); + + // Encryption by SSL + CtInsert(ct, _UU("CMD_ACCOUNT_COLUMN_ENCRYPT"), + t.ClientOption->UseEncrypt ? _UU("CMD_MSG_ENABLE") : _UU("CMD_MSG_DISABLE")); + + // Data compression + CtInsert(ct, _UU("CMD_ACCOUNT_COLUMN_COMPRESS"), + t.ClientOption->UseCompress ? _UU("CMD_MSG_ENABLE") : _UU("CMD_MSG_DISABLE")); + + // Connect in bridge / router mode + CtInsert(ct, _UU("CMD_ACCOUNT_COLUMN_BRIDGE_ROUTER"), + t.ClientOption->RequireBridgeRoutingMode ? _UU("CMD_MSG_ENABLE") : _UU("CMD_MSG_DISABLE")); + + // Connect in monitoring mode + CtInsert(ct, _UU("CMD_ACCOUNT_COLUMN_MONITOR"), + t.ClientOption->RequireMonitorMode ? _UU("CMD_MSG_ENABLE") : _UU("CMD_MSG_DISABLE")); + + // Not to rewrite the routing table + CtInsert(ct, _UU("CMD_ACCOUNT_COLUMN_NO_TRACKING"), + t.ClientOption->NoRoutingTracking ? _UU("CMD_MSG_ENABLE") : _UU("CMD_MSG_DISABLE")); + + // Disable the QoS control + CtInsert(ct, _UU("CMD_ACCOUNT_COLUMN_QOS_DISABLE"), + t.ClientOption->DisableQoS ? _UU("CMD_MSG_ENABLE") : _UU("CMD_MSG_DISABLE")); + + // Disable UDP Acceleration + CtInsert(ct, _UU("CMD_ACCOUNT_COLUMN_DISABLEUDP"), + t.ClientOption->NoUdpAcceleration ? _UU("CMD_MSG_ENABLE") : _UU("CMD_MSG_DISABLE")); + + CtFree(ct, c); + } + + if (ret != ERR_NO_ERROR) + { + // Error has occurred + CmdPrintError(c, ret); + } + + CiFreeClientGetAccount(&t); + + // Release of the parameter list + FreeParamValueList(o); + + return ret; +} + +// Delete the connection settings +UINT PcAccountDelete(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) +{ + LIST *o; + PC *pc = (PC *)param; + UINT ret = ERR_NO_ERROR; + RPC_CLIENT_DELETE_ACCOUNT t; + // Parameter list that can be specified + PARAM args[] = + { + {"[name]", CmdPrompt, _UU("CMD_AccountCreate_Prompt_Name"), CmdEvalNotEmpty, NULL}, + }; + + // Get the parameter list + o = ParseCommandList(c, cmd_name, str, args, sizeof(args) / sizeof(args[0])); + if (o == NULL) + { + return ERR_INVALID_PARAMETER; + } + + // RPC call + Zero(&t, sizeof(t)); + + UniStrCpy(t.AccountName, sizeof(t.AccountName), GetParamUniStr(o, "[name]")); + + ret = CcDeleteAccount(pc->RemoteClient, &t); + + if (ret == ERR_NO_ERROR) + { + // Success + } + + if (ret != ERR_NO_ERROR) + { + // Error has occurred + CmdPrintError(c, ret); + } + + // Release of the parameter list + FreeParamValueList(o); + + return ret; +} + +// Set the user name used to connect with connection settings +UINT PcAccountUsernameSet(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) +{ + LIST *o; + PC *pc = (PC *)param; + UINT ret = ERR_NO_ERROR; + RPC_CLIENT_GET_ACCOUNT t; + // Parameter list that can be specified + PARAM args[] = + { + {"[name]", CmdPrompt, _UU("CMD_AccountCreate_Prompt_Name"), CmdEvalNotEmpty, NULL}, + {"USERNAME", CmdPrompt, _UU("CMD_AccountCreate_Prompt_Username"), CmdEvalNotEmpty, NULL}, + }; + + // Get the parameter list + o = ParseCommandList(c, cmd_name, str, args, sizeof(args) / sizeof(args[0])); + if (o == NULL) + { + return ERR_INVALID_PARAMETER; + } + + // RPC call + Zero(&t, sizeof(t)); + + UniStrCpy(t.AccountName, sizeof(t.AccountName), GetParamUniStr(o, "[name]")); + + ret = CcGetAccount(pc->RemoteClient, &t); + + if (ret == ERR_NO_ERROR) + { + RPC_CLIENT_CREATE_ACCOUNT z; + // Change the settings + StrCpy(t.ClientAuth->Username, sizeof(t.ClientAuth->Username), GetParamStr(o, "USERNAME")); + + if (t.ClientAuth->AuthType == CLIENT_AUTHTYPE_PASSWORD) + { + c->Write(c, _UU("CMD_AccountUsername_Notice")); + } + + Zero(&z, sizeof(z)); + z.CheckServerCert = t.CheckServerCert; + z.RetryOnServerCert = t.RetryOnServerCert; + z.ClientAuth = t.ClientAuth; + z.ClientOption = t.ClientOption; + z.ServerCert = t.ServerCert; + z.StartupAccount = t.StartupAccount; + + ret = CcSetAccount(pc->RemoteClient, &z); + } + + if (ret != ERR_NO_ERROR) + { + // Error has occurred + CmdPrintError(c, ret); + } + + CiFreeClientGetAccount(&t); + + // Release of the parameter list + FreeParamValueList(o); + + return ret; +} + +// Set the type of user authentication of connection settings to anonymous authentication +UINT PcAccountAnonymousSet(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) +{ + LIST *o; + PC *pc = (PC *)param; + UINT ret = ERR_NO_ERROR; + RPC_CLIENT_GET_ACCOUNT t; + // Parameter list that can be specified + PARAM args[] = + { + {"[name]", CmdPrompt, _UU("CMD_AccountCreate_Prompt_Name"), CmdEvalNotEmpty, NULL}, + }; + + // Get the parameter list + o = ParseCommandList(c, cmd_name, str, args, sizeof(args) / sizeof(args[0])); + if (o == NULL) + { + return ERR_INVALID_PARAMETER; + } + + // RPC call + Zero(&t, sizeof(t)); + + UniStrCpy(t.AccountName, sizeof(t.AccountName), GetParamUniStr(o, "[name]")); + + ret = CcGetAccount(pc->RemoteClient, &t); + + if (ret == ERR_NO_ERROR) + { + RPC_CLIENT_CREATE_ACCOUNT z; + // Change the settings + t.ClientAuth->AuthType = CLIENT_AUTHTYPE_ANONYMOUS; + + Zero(&z, sizeof(z)); + z.CheckServerCert = t.CheckServerCert; + z.RetryOnServerCert = t.RetryOnServerCert; + z.ClientAuth = t.ClientAuth; + z.ClientOption = t.ClientOption; + z.ServerCert = t.ServerCert; + z.StartupAccount = t.StartupAccount; + + ret = CcSetAccount(pc->RemoteClient, &z); + } + + if (ret != ERR_NO_ERROR) + { + // Error has occurred + CmdPrintError(c, ret); + } + + CiFreeClientGetAccount(&t); + + // Release of the parameter list + FreeParamValueList(o); + + return ret; +} + +// Set the type of user authentication of connection settings to the password authentication +UINT PcAccountPasswordSet(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) +{ + LIST *o; + PC *pc = (PC *)param; + UINT ret = ERR_NO_ERROR; + RPC_CLIENT_GET_ACCOUNT t; + // Parameter list that can be specified + PARAM args[] = + { + {"[name]", CmdPrompt, _UU("CMD_AccountCreate_Prompt_Name"), CmdEvalNotEmpty, NULL}, + {"PASSWORD", CmdPromptChoosePassword, NULL, NULL, NULL}, + {"TYPE", CmdPrompt, _UU("CMD_CascadePasswordSet_Prompt_Type"), CmdEvalNotEmpty, NULL}, + }; + + // Get the parameter list + o = ParseCommandList(c, cmd_name, str, args, sizeof(args) / sizeof(args[0])); + if (o == NULL) + { + return ERR_INVALID_PARAMETER; + } + + // RPC call + Zero(&t, sizeof(t)); + + UniStrCpy(t.AccountName, sizeof(t.AccountName), GetParamUniStr(o, "[name]")); + + ret = CcGetAccount(pc->RemoteClient, &t); + + if (ret == ERR_NO_ERROR) + { + char *typestr = GetParamStr(o, "TYPE"); + RPC_CLIENT_CREATE_ACCOUNT z; + + // Change the settings + if (StartWith("standard", typestr)) + { + t.ClientAuth->AuthType = CLIENT_AUTHTYPE_PASSWORD; + HashPassword(t.ClientAuth->HashedPassword, t.ClientAuth->Username, + GetParamStr(o, "PASSWORD")); + } + else if (StartWith("radius", typestr) || StartWith("ntdomain", typestr)) + { + t.ClientAuth->AuthType = CLIENT_AUTHTYPE_PLAIN_PASSWORD; + + StrCpy(t.ClientAuth->PlainPassword, sizeof(t.ClientAuth->PlainPassword), + GetParamStr(o, "PASSWORD")); + } + else + { + // Error has occured + c->Write(c, _UU("CMD_CascadePasswordSet_Type_Invalid")); + ret = ERR_INVALID_PARAMETER; + } + + if (ret == ERR_NO_ERROR) + { + Zero(&z, sizeof(z)); + z.CheckServerCert = t.CheckServerCert; + z.RetryOnServerCert = t.RetryOnServerCert; + z.ClientAuth = t.ClientAuth; + z.ClientOption = t.ClientOption; + z.ServerCert = t.ServerCert; + z.StartupAccount = t.StartupAccount; + + ret = CcSetAccount(pc->RemoteClient, &z); + } + } + + if (ret != ERR_NO_ERROR) + { + // Error has occurred + CmdPrintError(c, ret); + } + + CiFreeClientGetAccount(&t); + + // Release of the parameter list + FreeParamValueList(o); + + return ret; +} + +// Set the type of user authentication of connection settings to the client certificate authentication +UINT PcAccountCertSet(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) +{ + LIST *o; + PC *pc = (PC *)param; + UINT ret = ERR_NO_ERROR; + RPC_CLIENT_GET_ACCOUNT t; + X *x; + K *k; + // Parameter list that can be specified + PARAM args[] = + { + {"[name]", CmdPrompt, _UU("CMD_CascadeCreate_Prompt_Name"), CmdEvalNotEmpty, NULL}, + {"LOADCERT", CmdPrompt, _UU("CMD_LOADCERTPATH"), CmdEvalIsFile, NULL}, + {"LOADKEY", CmdPrompt, _UU("CMD_LOADKEYPATH"), CmdEvalIsFile, NULL}, + }; + + // Get the parameter list + o = ParseCommandList(c, cmd_name, str, args, sizeof(args) / sizeof(args[0])); + if (o == NULL) + { + return ERR_INVALID_PARAMETER; + } + + if (CmdLoadCertAndKey(c, &x, &k, GetParamUniStr(o, "LOADCERT"), GetParamUniStr(o, "LOADKEY")) == false) + { + return ERR_INTERNAL_ERROR; + } + + // RPC call + Zero(&t, sizeof(t)); + + UniStrCpy(t.AccountName, sizeof(t.AccountName), GetParamUniStr(o, "[name]")); + + ret = CcGetAccount(pc->RemoteClient, &t); + + if (ret == ERR_NO_ERROR) + { + RPC_CLIENT_CREATE_ACCOUNT z; + + t.ClientAuth->AuthType = CLIENT_AUTHTYPE_CERT; + if (t.ClientAuth->ClientX != NULL) + { + FreeX(t.ClientAuth->ClientX); + } + if (t.ClientAuth->ClientK != NULL) + { + FreeK(t.ClientAuth->ClientK); + } + + t.ClientAuth->ClientX = CloneX(x); + t.ClientAuth->ClientK = CloneK(k); + + Zero(&z, sizeof(z)); + z.CheckServerCert = t.CheckServerCert; + z.RetryOnServerCert = t.RetryOnServerCert; + z.ClientAuth = t.ClientAuth; + z.ClientOption = t.ClientOption; + z.ServerCert = t.ServerCert; + z.StartupAccount = t.StartupAccount; + + ret = CcSetAccount(pc->RemoteClient, &z); + } + + if (ret != ERR_NO_ERROR) + { + // Error has occurred + CmdPrintError(c, ret); + } + + FreeX(x); + FreeK(k); + + CiFreeClientGetAccount(&t); + + // Release of the parameter list + FreeParamValueList(o); + + return ret; +} + +// Get the client certificate to be used for the connection settings +UINT PcAccountCertGet(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) +{ + LIST *o; + PC *pc = (PC *)param; + UINT ret = ERR_NO_ERROR; + RPC_CLIENT_GET_ACCOUNT t; + // Parameter list that can be specified + PARAM args[] = + { + {"[name]", CmdPrompt, _UU("CMD_CascadeCreate_Prompt_Name"), CmdEvalNotEmpty, NULL}, + {"SAVECERT", CmdPrompt, _UU("CMD_SAVECERTPATH"), CmdEvalNotEmpty, NULL}, + }; + + // Get the parameter list + o = ParseCommandList(c, cmd_name, str, args, sizeof(args) / sizeof(args[0])); + if (o == NULL) + { + return ERR_INVALID_PARAMETER; + } + + // RPC call + Zero(&t, sizeof(t)); + + UniStrCpy(t.AccountName, sizeof(t.AccountName), GetParamUniStr(o, "[name]")); + + ret = CcGetAccount(pc->RemoteClient, &t); + + if (ret == ERR_NO_ERROR) + { + if (t.ClientAuth->AuthType != CLIENT_AUTHTYPE_CERT && t.ClientAuth->AuthType != CLIENT_AUTHTYPE_OPENSSLENGINE) + { + c->Write(c, _UU("CMD_CascadeCertSet_Not_Auth_Cert")); + ret = ERR_INTERNAL_ERROR; + } + else if (t.ClientAuth->ClientX == NULL) + { + c->Write(c, _UU("CMD_CascadeCertSet_Cert_Not_Exists")); + ret = ERR_INTERNAL_ERROR; + } + else + { + XToFileW(t.ClientAuth->ClientX, GetParamUniStr(o, "SAVECERT"), true); + } + } + + CiFreeClientGetAccount(&t); + + if (ret != ERR_NO_ERROR) + { + // Error has occurred + CmdPrintError(c, ret); + } + + // Release of the parameter list + FreeParamValueList(o); + + return ret; +} + +// Disable communication encryption with the connection settings +UINT PcAccountEncryptDisable(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) +{ + LIST *o; + PC *pc = (PC *)param; + UINT ret = ERR_NO_ERROR; + RPC_CLIENT_GET_ACCOUNT t; + // Parameter list that can be specified + PARAM args[] = + { + {"[name]", CmdPrompt, _UU("CMD_AccountCreate_Prompt_Name"), CmdEvalNotEmpty, NULL}, + }; + + // Get the parameter list + o = ParseCommandList(c, cmd_name, str, args, sizeof(args) / sizeof(args[0])); + if (o == NULL) + { + return ERR_INVALID_PARAMETER; + } + + // RPC call + Zero(&t, sizeof(t)); + + UniStrCpy(t.AccountName, sizeof(t.AccountName), GetParamUniStr(o, "[name]")); + + ret = CcGetAccount(pc->RemoteClient, &t); + + if (ret == ERR_NO_ERROR) + { + RPC_CLIENT_CREATE_ACCOUNT z; + // Change the settings + t.ClientOption->UseEncrypt = false; + + Zero(&z, sizeof(z)); + z.CheckServerCert = t.CheckServerCert; + z.RetryOnServerCert = t.RetryOnServerCert; + z.ClientAuth = t.ClientAuth; + z.ClientOption = t.ClientOption; + z.ServerCert = t.ServerCert; + z.StartupAccount = t.StartupAccount; + + ret = CcSetAccount(pc->RemoteClient, &z); + } + + if (ret != ERR_NO_ERROR) + { + // Error has occurred + CmdPrintError(c, ret); + } + + CiFreeClientGetAccount(&t); + + // Release of the parameter list + FreeParamValueList(o); + + return ret; +} + +// Enable communication encryption with the connection settings +UINT PcAccountEncryptEnable(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) +{ + LIST *o; + PC *pc = (PC *)param; + UINT ret = ERR_NO_ERROR; + RPC_CLIENT_GET_ACCOUNT t; + // Parameter list that can be specified + PARAM args[] = + { + {"[name]", CmdPrompt, _UU("CMD_AccountCreate_Prompt_Name"), CmdEvalNotEmpty, NULL}, + }; + + // Get the parameter list + o = ParseCommandList(c, cmd_name, str, args, sizeof(args) / sizeof(args[0])); + if (o == NULL) + { + return ERR_INVALID_PARAMETER; + } + + // RPC call + Zero(&t, sizeof(t)); + + UniStrCpy(t.AccountName, sizeof(t.AccountName), GetParamUniStr(o, "[name]")); + + ret = CcGetAccount(pc->RemoteClient, &t); + + if (ret == ERR_NO_ERROR) + { + RPC_CLIENT_CREATE_ACCOUNT z; + // Change the settings + t.ClientOption->UseEncrypt = true; + + Zero(&z, sizeof(z)); + z.CheckServerCert = t.CheckServerCert; + z.RetryOnServerCert = t.RetryOnServerCert; + z.ClientAuth = t.ClientAuth; + z.ClientOption = t.ClientOption; + z.ServerCert = t.ServerCert; + z.StartupAccount = t.StartupAccount; + + ret = CcSetAccount(pc->RemoteClient, &z); + } + + if (ret != ERR_NO_ERROR) + { + // Error has occurred + CmdPrintError(c, ret); + } + + CiFreeClientGetAccount(&t); + + // Release of the parameter list + FreeParamValueList(o); + + return ret; +} + +// Enable communication data compression with the connection settings +UINT PcAccountCompressEnable(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) +{ + LIST *o; + PC *pc = (PC *)param; + UINT ret = ERR_NO_ERROR; + RPC_CLIENT_GET_ACCOUNT t; + // Parameter list that can be specified + PARAM args[] = + { + {"[name]", CmdPrompt, _UU("CMD_AccountCreate_Prompt_Name"), CmdEvalNotEmpty, NULL}, + }; + + // Get the parameter list + o = ParseCommandList(c, cmd_name, str, args, sizeof(args) / sizeof(args[0])); + if (o == NULL) + { + return ERR_INVALID_PARAMETER; + } + + // RPC call + Zero(&t, sizeof(t)); + + UniStrCpy(t.AccountName, sizeof(t.AccountName), GetParamUniStr(o, "[name]")); + + ret = CcGetAccount(pc->RemoteClient, &t); + + if (ret == ERR_NO_ERROR) + { + RPC_CLIENT_CREATE_ACCOUNT z; + // Change the settings + t.ClientOption->UseCompress = true; + + Zero(&z, sizeof(z)); + z.CheckServerCert = t.CheckServerCert; + z.RetryOnServerCert = t.RetryOnServerCert; + z.ClientAuth = t.ClientAuth; + z.ClientOption = t.ClientOption; + z.ServerCert = t.ServerCert; + z.StartupAccount = t.StartupAccount; + + ret = CcSetAccount(pc->RemoteClient, &z); + } + + if (ret != ERR_NO_ERROR) + { + // Error has occurred + CmdPrintError(c, ret); + } + + CiFreeClientGetAccount(&t); + + // Release of the parameter list + FreeParamValueList(o); + + return ret; +} + +// Disable communication data compression with the connection settings +UINT PcAccountCompressDisable(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) +{ + LIST *o; + PC *pc = (PC *)param; + UINT ret = ERR_NO_ERROR; + RPC_CLIENT_GET_ACCOUNT t; + // Parameter list that can be specified + PARAM args[] = + { + {"[name]", CmdPrompt, _UU("CMD_AccountCreate_Prompt_Name"), CmdEvalNotEmpty, NULL}, + }; + + // Get the parameter list + o = ParseCommandList(c, cmd_name, str, args, sizeof(args) / sizeof(args[0])); + if (o == NULL) + { + return ERR_INVALID_PARAMETER; + } + + // RPC call + Zero(&t, sizeof(t)); + + UniStrCpy(t.AccountName, sizeof(t.AccountName), GetParamUniStr(o, "[name]")); + + ret = CcGetAccount(pc->RemoteClient, &t); + + if (ret == ERR_NO_ERROR) + { + RPC_CLIENT_CREATE_ACCOUNT z; + // Change the settings + t.ClientOption->UseCompress = false; + + Zero(&z, sizeof(z)); + z.CheckServerCert = t.CheckServerCert; + z.RetryOnServerCert = t.RetryOnServerCert; + z.ClientAuth = t.ClientAuth; + z.ClientOption = t.ClientOption; + z.ServerCert = t.ServerCert; + z.StartupAccount = t.StartupAccount; + + ret = CcSetAccount(pc->RemoteClient, &z); + } + + if (ret != ERR_NO_ERROR) + { + // Error has occurred + CmdPrintError(c, ret); + } + + CiFreeClientGetAccount(&t); + + // Release of the parameter list + FreeParamValueList(o); + + return ret; +} + +UINT PcAccountHttpHeaderAdd(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) +{ + LIST *o; + PC *pc = (PC *)param; + UINT ret = ERR_NO_ERROR; + RPC_CLIENT_GET_ACCOUNT t; + + // Parameter list that can be specified + PARAM args[] = + { + {"[name]", CmdPrompt, _UU("CMD_AccountCreate_Prompt_Name"), CmdEvalNotEmpty, NULL}, + {"NAME", CmdPrompt, _UU("CMD_AccountHttpHeader_Prompt_Name"), CmdEvalNotEmpty, NULL}, + {"DATA", CmdPrompt, _UU("CMD_AccountHttpHeader_Prompt_Data"), NULL, NULL}, + }; + + // Get the parameter list + o = ParseCommandList(c, cmd_name, str, args, sizeof(args) / sizeof(args[0])); + if (o == NULL) + { + return ERR_INVALID_PARAMETER; + } + + // RPC call + Zero(&t, sizeof(t)); + UniStrCpy(t.AccountName, sizeof(t.AccountName), GetParamUniStr(o, "[name]")); + ret = CcGetAccount(pc->RemoteClient, &t); + + if (ret == ERR_NO_ERROR) + { + UINT i = 0; + TOKEN_LIST *tokens = NULL; + HTTP_HEADER *header = NULL; + char *name = GetParamStr(o, "NAME"); + + Trim(name); + + header = NewHttpHeader("", "", ""); + + tokens = ParseToken(t.ClientOption->CustomHttpHeader, "\r\n"); + for (i = 0; i < tokens->NumTokens; i++) + { + AddHttpValueStr(header, tokens->Token[i]); + } + FreeToken(tokens); + + if (GetHttpValue(header, name) == NULL) + { + RPC_CLIENT_CREATE_ACCOUNT z; + char s[HTTP_CUSTOM_HEADER_MAX_SIZE]; + + Format(s, sizeof(s), "%s: %s\r\n", name, GetParamStr(o, "DATA")); + EnSafeHttpHeaderValueStr(s, ' '); + + if ((StrLen(s) + StrLen(t.ClientOption->CustomHttpHeader)) < sizeof(t.ClientOption->CustomHttpHeader)) { + StrCat(t.ClientOption->CustomHttpHeader, sizeof(s), s); + + Zero(&z, sizeof(z)); + z.CheckServerCert = t.CheckServerCert; + z.RetryOnServerCert = t.RetryOnServerCert; + z.ClientAuth = t.ClientAuth; + z.ClientOption = t.ClientOption; + z.ServerCert = t.ServerCert; + z.StartupAccount = t.StartupAccount; + + ret = CcSetAccount(pc->RemoteClient, &z); + } + else + { + // Error has occurred + ret = ERR_TOO_MANT_ITEMS; + } + } + else + { + // Error has occurred + ret = ERR_OBJECT_EXISTS; + } + + FreeHttpHeader(header); + } + + if (ret != ERR_NO_ERROR) + { + // Error has occurred + CmdPrintError(c, ret); + } + + CiFreeClientGetAccount(&t); + + // Release of the parameter list + FreeParamValueList(o); + + return ret; +} + +UINT PcAccountHttpHeaderDelete(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) +{ + PC *pc = (PC *)param; + UINT ret = ERR_NO_ERROR; + RPC_CLIENT_GET_ACCOUNT t; + + // Parameter list that can be specified + PARAM args[] = + { + {"[name]", CmdPrompt, _UU("CMD_AccountCreate_Prompt_Name"), CmdEvalNotEmpty, NULL}, + {"NAME", CmdPrompt, _UU("CMD_AccountHttpHeader_Prompt_Name"), CmdEvalNotEmpty, NULL}, + }; + + // Get the parameter list + LIST *o = ParseCommandList(c, cmd_name, str, args, sizeof(args) / sizeof(args[0])); + if (o == NULL) + { + return ERR_INVALID_PARAMETER; + } + + // RPC call + Zero(&t, sizeof(t)); + UniStrCpy(t.AccountName, sizeof(t.AccountName), GetParamUniStr(o, "[name]")); + ret = CcGetAccount(pc->RemoteClient, &t); + + if (ret == ERR_NO_ERROR) + { + UINT i = 0; + TOKEN_LIST *tokens = NULL; + RPC_CLIENT_CREATE_ACCOUNT z; + char *value = GetParamStr(o, "NAME"); + + Zero(&z, sizeof(z)); + z.CheckServerCert = t.CheckServerCert; + z.RetryOnServerCert = t.RetryOnServerCert; + z.ClientAuth = t.ClientAuth; + z.ClientOption = t.ClientOption; + z.ServerCert = t.ServerCert; + z.StartupAccount = t.StartupAccount; + + Zero(z.ClientOption->CustomHttpHeader, sizeof(z.ClientOption->CustomHttpHeader)); + + tokens = ParseToken(t.ClientOption->CustomHttpHeader, "\r\n"); + + for (i = 0; i < tokens->NumTokens; i++) + { + if (StartWith(tokens->Token[i], value) == false) + { + StrCat(z.ClientOption->CustomHttpHeader, sizeof(z.ClientOption->CustomHttpHeader), tokens->Token[i]); + StrCat(z.ClientOption->CustomHttpHeader, 1, "\r\n"); + } + } + + ret = CcSetAccount(pc->RemoteClient, &z); + } + else + { + // Error has occurred + CmdPrintError(c, ret); + } + + CiFreeClientGetAccount(&t); + + // Release of the parameter list + FreeParamValueList(o); + + return ret; +} + +UINT PcAccountHttpHeaderGet(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) +{ + PC *pc = (PC *)param; + UINT ret = ERR_NO_ERROR; + RPC_CLIENT_GET_ACCOUNT t; + + // Parameter list that can be specified + PARAM args[] = + { + {"[name]", CmdPrompt, _UU("CMD_AccountCreate_Prompt_Name"), CmdEvalNotEmpty, NULL}, + }; + + // Get the parameter list + LIST *o = ParseCommandList(c, cmd_name, str, args, sizeof(args) / sizeof(args[0])); + if (o == NULL) + { + return ERR_INVALID_PARAMETER; + } + + // RPC call + Zero(&t, sizeof(t)); + UniStrCpy(t.AccountName, sizeof(t.AccountName), GetParamUniStr(o, "[name]")); + ret = CcGetAccount(pc->RemoteClient, &t); + + // Release of the parameter list + FreeParamValueList(o); + + if (ret == ERR_NO_ERROR) + { + wchar_t unistr[HTTP_CUSTOM_HEADER_MAX_SIZE]; + TOKEN_LIST *tokens = NULL; + UINT i = 0; + CT *ct = CtNew(); + CtInsertColumn(ct, _UU("CMD_CT_STD_COLUMN_1"), false); + + tokens = ParseToken(t.ClientOption->CustomHttpHeader, "\r\n"); + + for (i = 0; i < tokens->NumTokens; i++) + { + StrToUni(unistr, sizeof(unistr), tokens->Token[i]); + CtInsert(ct, unistr); + } + + CtFreeEx(ct, c, false); + } + else + { + // Error has occurred + CmdPrintError(c, ret); + } + + CiFreeClientGetAccount(&t); + + return ret; +} + +// Set the connection method of the connection settings to the direct TCP/IP connection +UINT PcAccountProxyNone(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) +{ + LIST *o; + PC *pc = (PC *)param; + UINT ret = ERR_NO_ERROR; + RPC_CLIENT_GET_ACCOUNT t; + // Parameter list that can be specified + PARAM args[] = + { + {"[name]", CmdPrompt, _UU("CMD_AccountCreate_Prompt_Name"), CmdEvalNotEmpty, NULL}, + }; + + // Get the parameter list + o = ParseCommandList(c, cmd_name, str, args, sizeof(args) / sizeof(args[0])); + if (o == NULL) + { + return ERR_INVALID_PARAMETER; + } + + // RPC call + Zero(&t, sizeof(t)); + + UniStrCpy(t.AccountName, sizeof(t.AccountName), GetParamUniStr(o, "[name]")); + + ret = CcGetAccount(pc->RemoteClient, &t); + + if (ret == ERR_NO_ERROR) + { + RPC_CLIENT_CREATE_ACCOUNT z; + // Change the settings + t.ClientOption->ProxyType = PROXY_DIRECT; + + Zero(&z, sizeof(z)); + z.CheckServerCert = t.CheckServerCert; + z.RetryOnServerCert = t.RetryOnServerCert; + z.ClientAuth = t.ClientAuth; + z.ClientOption = t.ClientOption; + z.ServerCert = t.ServerCert; + z.StartupAccount = t.StartupAccount; + + ret = CcSetAccount(pc->RemoteClient, &z); + } + + if (ret != ERR_NO_ERROR) + { + // Error has occurred + CmdPrintError(c, ret); + } + + CiFreeClientGetAccount(&t); + + // Release of the parameter list + FreeParamValueList(o); + + return ret; +} + +// Set the connection method of the connection settings to the HTTP proxy server connection +UINT PcAccountProxyHttp(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) +{ + LIST *o; + PC *pc = (PC *)param; + UINT ret = ERR_NO_ERROR; + RPC_CLIENT_GET_ACCOUNT t; + // Parameter list that can be specified + PARAM args[] = + { + {"[name]", CmdPrompt, _UU("CMD_AccountCreate_Prompt_Name"), CmdEvalNotEmpty, NULL}, + {"SERVER", CmdPrompt, _UU("CMD_AccountProxyHttp_Prompt_Server"), CmdEvalHostAndPort, NULL}, + {"USERNAME", NULL, NULL, NULL, NULL}, + {"PASSWORD", NULL, NULL, NULL, NULL}, + }; + + // Get the parameter list + o = ParseCommandList(c, cmd_name, str, args, sizeof(args) / sizeof(args[0])); + if (o == NULL) + { + return ERR_INVALID_PARAMETER; + } + + // RPC call + Zero(&t, sizeof(t)); + + UniStrCpy(t.AccountName, sizeof(t.AccountName), GetParamUniStr(o, "[name]")); + + ret = CcGetAccount(pc->RemoteClient, &t); + + if (ret == ERR_NO_ERROR) + { + RPC_CLIENT_CREATE_ACCOUNT z; + char *host; + UINT port; + + // Data change + if (ParseHostPort(GetParamStr(o, "SERVER"), &host, &port, 8080)) + { + t.ClientOption->ProxyType = PROXY_HTTP; + StrCpy(t.ClientOption->ProxyName, sizeof(t.ClientOption->ProxyName), host); + t.ClientOption->ProxyPort = port; + StrCpy(t.ClientOption->ProxyUsername, sizeof(t.ClientOption->ProxyName), GetParamStr(o, "USERNAME")); + StrCpy(t.ClientOption->ProxyPassword, sizeof(t.ClientOption->ProxyName), GetParamStr(o, "PASSWORD")); + Free(host); + } + + Zero(&z, sizeof(z)); + z.CheckServerCert = t.CheckServerCert; + z.RetryOnServerCert = t.RetryOnServerCert; + z.ClientAuth = t.ClientAuth; + z.ClientOption = t.ClientOption; + z.ServerCert = t.ServerCert; + z.StartupAccount = t.StartupAccount; + + ret = CcSetAccount(pc->RemoteClient, &z); + } + + if (ret != ERR_NO_ERROR) + { + // Error has occurred + CmdPrintError(c, ret); + } + + CiFreeClientGetAccount(&t); + + // Release of the parameter list + FreeParamValueList(o); + + return ret; +} + +// Set the connection method of the connection settings to the SOCKS4 proxy server connection +UINT PcAccountProxySocks(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) +{ + LIST *o; + PC *pc = (PC *)param; + UINT ret = ERR_NO_ERROR; + RPC_CLIENT_GET_ACCOUNT t; + // Parameter list that can be specified + PARAM args[] = + { + {"[name]", CmdPrompt, _UU("CMD_AccountCreate_Prompt_Name"), CmdEvalNotEmpty, NULL}, + {"SERVER", CmdPrompt, _UU("CMD_AccountProxyHttp_Prompt_Server"), CmdEvalHostAndPort, NULL}, + {"USERNAME", NULL, NULL, NULL, NULL}, + {"PASSWORD", NULL, NULL, NULL, NULL}, + }; + + // Get the parameter list + o = ParseCommandList(c, cmd_name, str, args, sizeof(args) / sizeof(args[0])); + if (o == NULL) + { + return ERR_INVALID_PARAMETER; + } + + // RPC call + Zero(&t, sizeof(t)); + + UniStrCpy(t.AccountName, sizeof(t.AccountName), GetParamUniStr(o, "[name]")); + + ret = CcGetAccount(pc->RemoteClient, &t); + + if (ret == ERR_NO_ERROR) + { + RPC_CLIENT_CREATE_ACCOUNT z; + char *host; + UINT port; + + // Data change + if (ParseHostPort(GetParamStr(o, "SERVER"), &host, &port, 1080)) + { + t.ClientOption->ProxyType = PROXY_SOCKS; + StrCpy(t.ClientOption->ProxyName, sizeof(t.ClientOption->ProxyName), host); + t.ClientOption->ProxyPort = port; + StrCpy(t.ClientOption->ProxyUsername, sizeof(t.ClientOption->ProxyName), GetParamStr(o, "USERNAME")); + StrCpy(t.ClientOption->ProxyPassword, sizeof(t.ClientOption->ProxyName), GetParamStr(o, "PASSWORD")); + Free(host); + } + + Zero(&z, sizeof(z)); + z.CheckServerCert = t.CheckServerCert; + z.RetryOnServerCert = t.RetryOnServerCert; + z.ClientAuth = t.ClientAuth; + z.ClientOption = t.ClientOption; + z.ServerCert = t.ServerCert; + z.StartupAccount = t.StartupAccount; + + ret = CcSetAccount(pc->RemoteClient, &z); + } + + if (ret != ERR_NO_ERROR) + { + // Error has occurred + CmdPrintError(c, ret); + } + + CiFreeClientGetAccount(&t); + + // Release of the parameter list + FreeParamValueList(o); + + return ret; +} + +// Set the connection method of the connection settings to the SOCKS5 proxy server connection +UINT PcAccountProxySocks5(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) +{ + LIST *o; + PC *pc = (PC *)param; + UINT ret = ERR_NO_ERROR; + RPC_CLIENT_GET_ACCOUNT t; + // Parameter list that can be specified + PARAM args[] = + { + {"[name]", CmdPrompt, _UU("CMD_AccountCreate_Prompt_Name"), CmdEvalNotEmpty, NULL}, + {"SERVER", CmdPrompt, _UU("CMD_AccountProxyHttp_Prompt_Server"), CmdEvalHostAndPort, NULL}, + {"USERNAME", CmdPrompt, NULL, NULL, NULL}, + {"PASSWORD", CmdPrompt, NULL, NULL, NULL}, + }; + + // Get the parameter list + o = ParseCommandList(c, cmd_name, str, args, sizeof(args) / sizeof(args[0])); + if (o == NULL) + { + return ERR_INVALID_PARAMETER; + } + + // RPC call + Zero(&t, sizeof(t)); + + UniStrCpy(t.AccountName, sizeof(t.AccountName), GetParamUniStr(o, "[name]")); + + ret = CcGetAccount(pc->RemoteClient, &t); + + if (ret == ERR_NO_ERROR) + { + RPC_CLIENT_CREATE_ACCOUNT z; + char *host; + UINT port; + + // Data change + if (ParseHostPort(GetParamStr(o, "SERVER"), &host, &port, 1080)) + { + t.ClientOption->ProxyType = PROXY_SOCKS5; + StrCpy(t.ClientOption->ProxyName, sizeof(t.ClientOption->ProxyName), host); + t.ClientOption->ProxyPort = port; + StrCpy(t.ClientOption->ProxyUsername, sizeof(t.ClientOption->ProxyName), GetParamStr(o, "USERNAME")); + StrCpy(t.ClientOption->ProxyPassword, sizeof(t.ClientOption->ProxyName), GetParamStr(o, "PASSWORD")); + Free(host); + } + + Zero(&z, sizeof(z)); + z.CheckServerCert = t.CheckServerCert; + z.RetryOnServerCert = t.RetryOnServerCert; + z.ClientAuth = t.ClientAuth; + z.ClientOption = t.ClientOption; + z.ServerCert = t.ServerCert; + z.StartupAccount = t.StartupAccount; + + ret = CcSetAccount(pc->RemoteClient, &z); + } + + if (ret != ERR_NO_ERROR) + { + // Error has occurred + CmdPrintError(c, ret); + } + + CiFreeClientGetAccount(&t); + + // Release of the parameter list + FreeParamValueList(o); + + return ret; +} + +// Enable validation option for server certificate of connection settings +UINT PcAccountServerCertEnable(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) +{ + LIST *o; + PC *pc = (PC *)param; + UINT ret = ERR_NO_ERROR; + RPC_CLIENT_GET_ACCOUNT t; + // Parameter list that can be specified + PARAM args[] = + { + {"[name]", CmdPrompt, _UU("CMD_AccountCreate_Prompt_Name"), CmdEvalNotEmpty, NULL}, + }; + + // Get the parameter list + o = ParseCommandList(c, cmd_name, str, args, sizeof(args) / sizeof(args[0])); + if (o == NULL) + { + return ERR_INVALID_PARAMETER; + } + + // RPC call + Zero(&t, sizeof(t)); + + UniStrCpy(t.AccountName, sizeof(t.AccountName), GetParamUniStr(o, "[name]")); + + ret = CcGetAccount(pc->RemoteClient, &t); + + if (ret == ERR_NO_ERROR) + { + RPC_CLIENT_CREATE_ACCOUNT z; + // Change the settings + t.CheckServerCert = true; + + Zero(&z, sizeof(z)); + z.CheckServerCert = t.CheckServerCert; + z.RetryOnServerCert = t.RetryOnServerCert; + z.ClientAuth = t.ClientAuth; + z.ClientOption = t.ClientOption; + z.ServerCert = t.ServerCert; + z.StartupAccount = t.StartupAccount; + + ret = CcSetAccount(pc->RemoteClient, &z); + } + + if (ret != ERR_NO_ERROR) + { + // Error has occurred + CmdPrintError(c, ret); + } + + CiFreeClientGetAccount(&t); + + // Release of the parameter list + FreeParamValueList(o); + + return ret; +} + +// Disable validation option of the server certificate of connection settings +UINT PcAccountServerCertDisable(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) +{ + LIST *o; + PC *pc = (PC *)param; + UINT ret = ERR_NO_ERROR; + RPC_CLIENT_GET_ACCOUNT t; + // Parameter list that can be specified + PARAM args[] = + { + {"[name]", CmdPrompt, _UU("CMD_AccountCreate_Prompt_Name"), CmdEvalNotEmpty, NULL}, + }; + + // Get the parameter list + o = ParseCommandList(c, cmd_name, str, args, sizeof(args) / sizeof(args[0])); + if (o == NULL) + { + return ERR_INVALID_PARAMETER; + } + + // RPC call + Zero(&t, sizeof(t)); + + UniStrCpy(t.AccountName, sizeof(t.AccountName), GetParamUniStr(o, "[name]")); + + ret = CcGetAccount(pc->RemoteClient, &t); + + if (ret == ERR_NO_ERROR) + { + RPC_CLIENT_CREATE_ACCOUNT z; + // Change the settings + t.CheckServerCert = false; + + Zero(&z, sizeof(z)); + z.CheckServerCert = t.CheckServerCert; + z.RetryOnServerCert = t.RetryOnServerCert; + z.ClientAuth = t.ClientAuth; + z.ClientOption = t.ClientOption; + z.ServerCert = t.ServerCert; + z.StartupAccount = t.StartupAccount; + + ret = CcSetAccount(pc->RemoteClient, &z); + } + + if (ret != ERR_NO_ERROR) + { + // Error has occurred + CmdPrintError(c, ret); + } + + CiFreeClientGetAccount(&t); + + // Release of the parameter list + FreeParamValueList(o); + + return ret; +} + +// Enable retry option of the invalid server certificate of connection settings +UINT PcAccountRetryOnServerCertEnable(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) +{ + LIST *o; + PC *pc = (PC *)param; + UINT ret = ERR_NO_ERROR; + RPC_CLIENT_GET_ACCOUNT t; + // Parameter list that can be specified + PARAM args[] = + { + {"[name]", CmdPrompt, _UU("CMD_AccountCreate_Prompt_Name"), CmdEvalNotEmpty, NULL}, + }; + + // Get the parameter list + o = ParseCommandList(c, cmd_name, str, args, sizeof(args) / sizeof(args[0])); + if (o == NULL) + { + return ERR_INVALID_PARAMETER; + } + + // RPC call + Zero(&t, sizeof(t)); + + UniStrCpy(t.AccountName, sizeof(t.AccountName), GetParamUniStr(o, "[name]")); + + ret = CcGetAccount(pc->RemoteClient, &t); + + if (ret == ERR_NO_ERROR) + { + RPC_CLIENT_CREATE_ACCOUNT z; + // Change the settings + t.RetryOnServerCert = true; + + Zero(&z, sizeof(z)); + z.CheckServerCert = t.CheckServerCert; + z.RetryOnServerCert = t.RetryOnServerCert; + z.ClientAuth = t.ClientAuth; + z.ClientOption = t.ClientOption; + z.ServerCert = t.ServerCert; + z.StartupAccount = t.StartupAccount; + + ret = CcSetAccount(pc->RemoteClient, &z); + } + + if (ret != ERR_NO_ERROR) + { + // Error has occurred + CmdPrintError(c, ret); + } + + CiFreeClientGetAccount(&t); + + // Release of the parameter list + FreeParamValueList(o); + + return ret; +} + +// Disable retry option of the invalid server certificate of connection settings +UINT PcAccountRetryOnServerCertDisable(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) +{ + LIST *o; + PC *pc = (PC *)param; + UINT ret = ERR_NO_ERROR; + RPC_CLIENT_GET_ACCOUNT t; + // Parameter list that can be specified + PARAM args[] = + { + {"[name]", CmdPrompt, _UU("CMD_AccountCreate_Prompt_Name"), CmdEvalNotEmpty, NULL}, + }; + + // Get the parameter list + o = ParseCommandList(c, cmd_name, str, args, sizeof(args) / sizeof(args[0])); + if (o == NULL) + { + return ERR_INVALID_PARAMETER; + } + + // RPC call + Zero(&t, sizeof(t)); + + UniStrCpy(t.AccountName, sizeof(t.AccountName), GetParamUniStr(o, "[name]")); + + ret = CcGetAccount(pc->RemoteClient, &t); + + if (ret == ERR_NO_ERROR) + { + RPC_CLIENT_CREATE_ACCOUNT z; + // Change the settings + t.RetryOnServerCert = false; + + Zero(&z, sizeof(z)); + z.CheckServerCert = t.CheckServerCert; + z.RetryOnServerCert = t.RetryOnServerCert; + z.ClientAuth = t.ClientAuth; + z.ClientOption = t.ClientOption; + z.ServerCert = t.ServerCert; + z.StartupAccount = t.StartupAccount; + + ret = CcSetAccount(pc->RemoteClient, &z); + } + + if (ret != ERR_NO_ERROR) + { + // Error has occurred + CmdPrintError(c, ret); + } + + CiFreeClientGetAccount(&t); + + // Release of the parameter list + FreeParamValueList(o); + + return ret; +} + +// Set the server-specific certificate of connection settings +UINT PcAccountServerCertSet(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) +{ + LIST *o; + PC *pc = (PC *)param; + UINT ret = ERR_NO_ERROR; + RPC_CLIENT_GET_ACCOUNT t; + X *x; + // Parameter list that can be specified + PARAM args[] = + { + {"[name]", CmdPrompt, _UU("CMD_AccountCreate_Prompt_Name"), CmdEvalNotEmpty, NULL}, + {"LOADCERT", CmdPrompt, _UU("CMD_LOADCERTPATH"), CmdEvalIsFile, NULL}, + }; + + // Get the parameter list + o = ParseCommandList(c, cmd_name, str, args, sizeof(args) / sizeof(args[0])); + if (o == NULL) + { + return ERR_INVALID_PARAMETER; + } + + x = FileToXW(GetParamUniStr(o, "LOADCERT")); + if (x == NULL) + { + FreeParamValueList(o); + c->Write(c, _UU("CMD_LOADCERT_FAILED")); + return ERR_INTERNAL_ERROR; + } + + // RPC call + Zero(&t, sizeof(t)); + + UniStrCpy(t.AccountName, sizeof(t.AccountName), GetParamUniStr(o, "[name]")); + + ret = CcGetAccount(pc->RemoteClient, &t); + + if (ret == ERR_NO_ERROR) + { + RPC_CLIENT_CREATE_ACCOUNT z; + // Change the settings + if (t.ServerCert != NULL) + { + FreeX(t.ServerCert); + } + t.ServerCert = CloneX(x); + + Zero(&z, sizeof(z)); + z.CheckServerCert = t.CheckServerCert; + z.RetryOnServerCert = t.RetryOnServerCert; + z.ClientAuth = t.ClientAuth; + z.ClientOption = t.ClientOption; + z.ServerCert = t.ServerCert; + z.StartupAccount = t.StartupAccount; + + ret = CcSetAccount(pc->RemoteClient, &z); + } + + if (ret != ERR_NO_ERROR) + { + // Error has occurred + CmdPrintError(c, ret); + } + + CiFreeClientGetAccount(&t); + + // Release of the parameter list + FreeParamValueList(o); + + FreeX(x); + + return ret; +} + +// Delete a server-specific certificate of connection settings +UINT PcAccountServerCertDelete(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) +{ + LIST *o; + PC *pc = (PC *)param; + UINT ret = ERR_NO_ERROR; + RPC_CLIENT_GET_ACCOUNT t; + // Parameter list that can be specified + PARAM args[] = + { + {"[name]", CmdPrompt, _UU("CMD_AccountCreate_Prompt_Name"), CmdEvalNotEmpty, NULL}, + }; + + // Get the parameter list + o = ParseCommandList(c, cmd_name, str, args, sizeof(args) / sizeof(args[0])); + if (o == NULL) + { + return ERR_INVALID_PARAMETER; + } + + // RPC call + Zero(&t, sizeof(t)); + + UniStrCpy(t.AccountName, sizeof(t.AccountName), GetParamUniStr(o, "[name]")); + + ret = CcGetAccount(pc->RemoteClient, &t); + + if (ret == ERR_NO_ERROR) + { + RPC_CLIENT_CREATE_ACCOUNT z; + // Change the settings + if (t.ServerCert != NULL) + { + FreeX(t.ServerCert); + } + t.ServerCert = NULL; + + Zero(&z, sizeof(z)); + z.CheckServerCert = t.CheckServerCert; + z.RetryOnServerCert = t.RetryOnServerCert; + z.ClientAuth = t.ClientAuth; + z.ClientOption = t.ClientOption; + z.ServerCert = t.ServerCert; + z.StartupAccount = t.StartupAccount; + + ret = CcSetAccount(pc->RemoteClient, &z); + } + + if (ret != ERR_NO_ERROR) + { + // Error has occurred + CmdPrintError(c, ret); + } + + CiFreeClientGetAccount(&t); + + // Release of the parameter list + FreeParamValueList(o); + + return ret; +} + +// Get a server-specific certificate of connection settings +UINT PcAccountServerCertGet(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) +{ + LIST *o; + PC *pc = (PC *)param; + UINT ret = ERR_NO_ERROR; + RPC_CLIENT_GET_ACCOUNT t; + // Parameter list that can be specified + PARAM args[] = + { + {"[name]", CmdPrompt, _UU("CMD_AccountCreate_Prompt_Name"), CmdEvalNotEmpty, NULL}, + {"SAVECERT", CmdPrompt, _UU("CMD_SAVECERTPATH"), CmdEvalNotEmpty, NULL}, + }; + + // Get the parameter list + o = ParseCommandList(c, cmd_name, str, args, sizeof(args) / sizeof(args[0])); + if (o == NULL) + { + return ERR_INVALID_PARAMETER; + } + + // RPC call + Zero(&t, sizeof(t)); + + UniStrCpy(t.AccountName, sizeof(t.AccountName), GetParamUniStr(o, "[name]")); + + ret = CcGetAccount(pc->RemoteClient, &t); + + if (ret == ERR_NO_ERROR) + { + RPC_CLIENT_CREATE_ACCOUNT z; + // Change the settings + if (t.ServerCert != NULL) + { + FreeX(t.ServerCert); + } + t.ServerCert = NULL; + + Zero(&z, sizeof(z)); + z.CheckServerCert = t.CheckServerCert; + z.RetryOnServerCert = t.RetryOnServerCert; + z.ClientAuth = t.ClientAuth; + z.ClientOption = t.ClientOption; + z.ServerCert = t.ServerCert; + z.StartupAccount = t.StartupAccount; + + ret = CcSetAccount(pc->RemoteClient, &z); + } + + if (ret != ERR_NO_ERROR) + { + // Error has occurred + CmdPrintError(c, ret); + } + + CiFreeClientGetAccount(&t); + + // Release of the parameter list + FreeParamValueList(o); + + return ret; +} + +// Set the advanced settings of connection settings +UINT PcAccountDetailSet(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) +{ + LIST *o; + PC *pc = (PC *)param; + UINT ret = ERR_NO_ERROR; + RPC_CLIENT_GET_ACCOUNT t; + CMD_EVAL_MIN_MAX mm_maxtcp = + { + "CMD_CascadeDetailSet_Eval_MaxTcp", 1, 32 + }; + CMD_EVAL_MIN_MAX mm_interval = + { + "CMD_CascadeDetailSet_Eval_Interval", 1, 4294967295UL + }; + // Parameter list that can be specified + PARAM args[] = + { + {"[name]", CmdPrompt, _UU("CMD_AccountCreate_Prompt_Name"), CmdEvalNotEmpty, NULL}, + {"MAXTCP", CmdPrompt, _UU("CMD_AccountDetailSet_Prompt_MaxTcp"), CmdEvalMinMax, &mm_maxtcp}, + {"INTERVAL", CmdPrompt, _UU("CMD_AccountDetailSet_Prompt_Interval"), CmdEvalMinMax, &mm_interval}, + {"TTL", CmdPrompt, _UU("CMD_AccountDetailSet_Prompt_TTL"), NULL, NULL}, + {"HALF", CmdPrompt, _UU("CMD_AccountDetailSet_Prompt_HALF"), NULL, NULL}, + {"BRIDGE", CmdPrompt, _UU("CMD_AccountDetailSet_Prompt_BRIDGE"), NULL, NULL}, + {"MONITOR", CmdPrompt, _UU("CMD_AccountDetailSet_Prompt_MONITOR"), NULL, NULL}, + {"NOTRACK", CmdPrompt, _UU("CMD_AccountDetailSet_Prompt_NOTRACK"), NULL, NULL}, + {"NOQOS", CmdPrompt, _UU("CMD_AccountDetailSet_Prompt_NOQOS"), NULL, NULL}, + {"DISABLEUDP", CmdPrompt, _UU("CMD_AccountDetailSet_Prompt_DISABLEUDP"), NULL, NULL}, + }; + + // Get the parameter list + o = ParseCommandList(c, cmd_name, str, args, sizeof(args) / sizeof(args[0])); + if (o == NULL) + { + return ERR_INVALID_PARAMETER; + } + + // RPC call + Zero(&t, sizeof(t)); + + UniStrCpy(t.AccountName, sizeof(t.AccountName), GetParamUniStr(o, "[name]")); + + ret = CcGetAccount(pc->RemoteClient, &t); + + if (ret == ERR_NO_ERROR) + { + RPC_CLIENT_CREATE_ACCOUNT z; + // Data change + t.ClientOption->MaxConnection = GetParamInt(o, "MAXTCP"); + t.ClientOption->AdditionalConnectionInterval = GetParamInt(o, "INTERVAL"); + t.ClientOption->ConnectionDisconnectSpan = GetParamInt(o, "TTL"); + t.ClientOption->HalfConnection = GetParamYes(o, "HALF"); + t.ClientOption->RequireBridgeRoutingMode = GetParamYes(o, "BRIDGE"); + t.ClientOption->RequireMonitorMode = GetParamYes(o, "MONITOR"); + t.ClientOption->NoRoutingTracking = GetParamYes(o, "NOTRACK"); + t.ClientOption->DisableQoS = GetParamYes(o, "NOQOS"); + t.ClientOption->NoUdpAcceleration = GetParamYes(o, "DISABLEUDP"); + + Zero(&z, sizeof(z)); + z.CheckServerCert = t.CheckServerCert; + z.ClientAuth = t.ClientAuth; + z.ClientOption = t.ClientOption; + z.ServerCert = t.ServerCert; + z.StartupAccount = t.StartupAccount; + + ret = CcSetAccount(pc->RemoteClient, &z); + } + + if (ret != ERR_NO_ERROR) + { + // Error has occurred + CmdPrintError(c, ret); + } + + CiFreeClientGetAccount(&t); + + // Release of the parameter list + FreeParamValueList(o); + + return ret; +} + +// Change the name of the connection settings +UINT PcAccountRename(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) +{ + LIST *o; + PC *pc = (PC *)param; + UINT ret = ERR_NO_ERROR; + RPC_RENAME_ACCOUNT t; + // Parameter list that can be specified + PARAM args[] = + { + {"[name]", CmdPrompt, _UU("CMD_AccountRename_PROMPT_OLD"), CmdEvalNotEmpty, NULL}, + {"NEW", CmdPrompt, _UU("CMD_AccountRename_PROMPT_NEW"), CmdEvalNotEmpty, NULL}, + }; + + // Get the parameter list + o = ParseCommandList(c, cmd_name, str, args, sizeof(args) / sizeof(args[0])); + if (o == NULL) + { + return ERR_INVALID_PARAMETER; + } + + // RPC call + Zero(&t, sizeof(t)); + UniStrCpy(t.NewName, sizeof(t.NewName), GetParamUniStr(o, "NEW")); + UniStrCpy(t.OldName, sizeof(t.OldName), GetParamUniStr(o, "[name]")); + + ret = CcRenameAccount(pc->RemoteClient, &t); + + if (ret == ERR_NO_ERROR) + { + // Success + } + + if (ret != ERR_NO_ERROR) + { + // Error has occurred + CmdPrintError(c, ret); + } + + // Release of the parameter list + FreeParamValueList(o); + + return ret; +} + +// Start to connect to the VPN Server using the connection settings +UINT PcAccountConnect(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) +{ + LIST *o; + PC *pc = (PC *)param; + UINT ret = ERR_NO_ERROR; + RPC_CLIENT_CONNECT t; + // Parameter list that can be specified + PARAM args[] = + { + {"[name]", CmdPrompt, _UU("CMD_AccountCreate_Prompt_Name"), CmdEvalNotEmpty, NULL}, + }; + + // Get the parameter list + o = ParseCommandList(c, cmd_name, str, args, sizeof(args) / sizeof(args[0])); + if (o == NULL) + { + return ERR_INVALID_PARAMETER; + } + + // RPC call + Zero(&t, sizeof(t)); + UniStrCpy(t.AccountName, sizeof(t.AccountName), GetParamUniStr(o, "[name]")); + + ret = CcConnect(pc->RemoteClient, &t); + + if (ret == ERR_NO_ERROR) + { + // Success + } + + if (ret != ERR_NO_ERROR) + { + // Error has occurred + CmdPrintError(c, ret); + } + + // Release of the parameter list + FreeParamValueList(o); + + return ret; +} + +// Disconnect the connection settings of connected +UINT PcAccountDisconnect(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) +{ + LIST *o; + PC *pc = (PC *)param; + UINT ret = ERR_NO_ERROR; + RPC_CLIENT_CONNECT t; + // Parameter list that can be specified + PARAM args[] = + { + {"[name]", CmdPrompt, _UU("CMD_AccountCreate_Prompt_Name"), CmdEvalNotEmpty, NULL}, + }; + + // Get the parameter list + o = ParseCommandList(c, cmd_name, str, args, sizeof(args) / sizeof(args[0])); + if (o == NULL) + { + return ERR_INVALID_PARAMETER; + } + + // RPC call + Zero(&t, sizeof(t)); + UniStrCpy(t.AccountName, sizeof(t.AccountName), GetParamUniStr(o, "[name]")); + + ret = CcDisconnect(pc->RemoteClient, &t); + + if (ret == ERR_NO_ERROR) + { + // Success + } + + if (ret != ERR_NO_ERROR) + { + // Error has occurred + CmdPrintError(c, ret); + } + + // Release of the parameter list + FreeParamValueList(o); + + return ret; +} + +// Get the current state of the connection settings +UINT PcAccountStatusGet(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) +{ + LIST *o; + PC *pc = (PC *)param; + UINT ret = ERR_NO_ERROR; + RPC_CLIENT_GET_CONNECTION_STATUS t; + // Parameter list that can be specified + PARAM args[] = + { + {"[name]", CmdPrompt, _UU("CMD_AccountCreate_Prompt_Name"), CmdEvalNotEmpty, NULL}, + }; + + // Get the parameter list + o = ParseCommandList(c, cmd_name, str, args, sizeof(args) / sizeof(args[0])); + if (o == NULL) + { + return ERR_INVALID_PARAMETER; + } + + // RPC call + Zero(&t, sizeof(t)); + UniStrCpy(t.AccountName, sizeof(t.AccountName), GetParamUniStr(o, "[name]")); + + ret = CcGetAccountStatus(pc->RemoteClient, &t); + + if (ret == ERR_NO_ERROR) + { + if (t.Active == false) + { + // Has been disconnected + ret = ERR_ACCOUNT_INACTIVE; + } + else + { + CT *ct = CtNewStandard(); + + CmdPrintStatusToListView(ct, &t); + + CtFree(ct, c); + } + } + + if (ret != ERR_NO_ERROR) + { + // Error has occurred + CmdPrintError(c, ret); + } + + CiFreeClientGetConnectionStatus(&t); + + // Release of the parameter list + FreeParamValueList(o); + + return ret; +} + +// Set a virtual LAN card to be used in the connection settings +UINT PcAccountNicSet(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) +{ + LIST *o; + PC *pc = (PC *)param; + UINT ret = ERR_NO_ERROR; + RPC_CLIENT_GET_ACCOUNT t; + // Parameter list that can be specified + PARAM args[] = + { + {"[name]", CmdPrompt, _UU("CMD_AccountCreate_Prompt_Name"), CmdEvalNotEmpty, NULL}, + {"NICNAME", CmdPrompt, _UU("CMD_AccountCreate_Prompt_Nicname"), CmdEvalNotEmpty, NULL}, + }; + + // Get the parameter list + o = ParseCommandList(c, cmd_name, str, args, sizeof(args) / sizeof(args[0])); + if (o == NULL) + { + return ERR_INVALID_PARAMETER; + } + + // RPC call + Zero(&t, sizeof(t)); + + Zero(&t, sizeof(t)); + UniStrCpy(t.AccountName, sizeof(t.AccountName), GetParamUniStr(o, "[name]")); + + ret = CcGetAccount(pc->RemoteClient, &t); + + if (ret == ERR_NO_ERROR) + { + RPC_CLIENT_CREATE_ACCOUNT c; + // Success + StrCpy(t.ClientOption->DeviceName, sizeof(t.ClientOption->DeviceName), + GetParamStr(o, "NICNAME")); + + Zero(&c, sizeof(c)); + + c.ClientAuth = t.ClientAuth; + c.ClientOption = t.ClientOption; + c.CheckServerCert = t.CheckServerCert; + c.RetryOnServerCert = t.RetryOnServerCert; + c.ServerCert = t.ServerCert; + c.StartupAccount = t.StartupAccount; + + ret = CcSetAccount(pc->RemoteClient, &c); + } + + if (ret != ERR_NO_ERROR) + { + // Error has occurred + CmdPrintError(c, ret); + } + + CiFreeClientGetAccount(&t); + + // Release of the parameter list + FreeParamValueList(o); + + return ret; +} + +// Set to display error screens and connection status while connecting to the VPN Server +UINT PcAccountStatusShow(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) +{ + LIST *o; + PC *pc = (PC *)param; + UINT ret = ERR_NO_ERROR; + RPC_CLIENT_GET_ACCOUNT t; + // Parameter list that can be specified + PARAM args[] = + { + {"[name]", CmdPrompt, _UU("CMD_AccountCreate_Prompt_Name"), CmdEvalNotEmpty, NULL}, + }; + + // Get the parameter list + o = ParseCommandList(c, cmd_name, str, args, sizeof(args) / sizeof(args[0])); + if (o == NULL) + { + return ERR_INVALID_PARAMETER; + } + + // RPC call + Zero(&t, sizeof(t)); + + UniStrCpy(t.AccountName, sizeof(t.AccountName), GetParamUniStr(o, "[name]")); + + ret = CcGetAccount(pc->RemoteClient, &t); + + if (ret == ERR_NO_ERROR) + { + RPC_CLIENT_CREATE_ACCOUNT z; + // Change the settings + t.ClientOption->HideStatusWindow = false; + + Zero(&z, sizeof(z)); + z.CheckServerCert = t.CheckServerCert; + z.RetryOnServerCert = t.RetryOnServerCert; + z.ClientAuth = t.ClientAuth; + z.ClientOption = t.ClientOption; + z.ServerCert = t.ServerCert; + z.StartupAccount = t.StartupAccount; + + ret = CcSetAccount(pc->RemoteClient, &z); + } + + if (ret != ERR_NO_ERROR) + { + // Error has occurred + CmdPrintError(c, ret); + } + + CiFreeClientGetAccount(&t); + + // Release of the parameter list + FreeParamValueList(o); + + return ret; +} + +// Configure not to display error screens and connection status while connecting to the VPN Server +UINT PcAccountStatusHide(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) +{ + LIST *o; + PC *pc = (PC *)param; + UINT ret = ERR_NO_ERROR; + RPC_CLIENT_GET_ACCOUNT t; + // Parameter list that can be specified + PARAM args[] = + { + {"[name]", CmdPrompt, _UU("CMD_AccountCreate_Prompt_Name"), CmdEvalNotEmpty, NULL}, + }; + + // Get the parameter list + o = ParseCommandList(c, cmd_name, str, args, sizeof(args) / sizeof(args[0])); + if (o == NULL) + { + return ERR_INVALID_PARAMETER; + } + + // RPC call + Zero(&t, sizeof(t)); + + UniStrCpy(t.AccountName, sizeof(t.AccountName), GetParamUniStr(o, "[name]")); + + ret = CcGetAccount(pc->RemoteClient, &t); + + if (ret == ERR_NO_ERROR) + { + RPC_CLIENT_CREATE_ACCOUNT z; + // Change the settings + t.ClientOption->HideStatusWindow = true; + + Zero(&z, sizeof(z)); + z.CheckServerCert = t.CheckServerCert; + z.RetryOnServerCert = t.RetryOnServerCert; + z.ClientAuth = t.ClientAuth; + z.ClientOption = t.ClientOption; + z.ServerCert = t.ServerCert; + z.StartupAccount = t.StartupAccount; + + ret = CcSetAccount(pc->RemoteClient, &z); + } + + if (ret != ERR_NO_ERROR) + { + // Error has occurred + CmdPrintError(c, ret); + } + + CiFreeClientGetAccount(&t); + + // Release of the parameter list + FreeParamValueList(o); + + return ret; +} + +// Set the type of user authentication of connection settings to the smart card authentication +UINT PcAccountSecureCertSet(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) +{ + LIST *o; + PC *pc = (PC *)param; + UINT ret = ERR_NO_ERROR; + RPC_CLIENT_GET_ACCOUNT t; + // Parameter list that can be specified + PARAM args[] = + { + {"[name]", CmdPrompt, _UU("CMD_AccountCreate_Prompt_Name"), CmdEvalNotEmpty, NULL}, + {"CERTNAME", CmdPrompt, _UU("CMD_AccountSecureCertSet_PROMPT_CERTNAME"), CmdEvalNotEmpty, NULL}, + {"KEYNAME", CmdPrompt, _UU("CMD_AccountSecureCertSet_PROMPT_KEYNAME"), CmdEvalNotEmpty, NULL}, + }; + + // Get the parameter list + o = ParseCommandList(c, cmd_name, str, args, sizeof(args) / sizeof(args[0])); + if (o == NULL) + { + return ERR_INVALID_PARAMETER; + } + + // RPC call + Zero(&t, sizeof(t)); + + UniStrCpy(t.AccountName, sizeof(t.AccountName), GetParamUniStr(o, "[name]")); + + ret = CcGetAccount(pc->RemoteClient, &t); + + if (ret == ERR_NO_ERROR) + { + RPC_CLIENT_CREATE_ACCOUNT z; + // Change the settings + t.ClientAuth->AuthType = CLIENT_AUTHTYPE_SECURE; + StrCpy(t.ClientAuth->SecurePublicCertName, sizeof(t.ClientAuth->SecurePublicCertName), + GetParamStr(o, "CERTNAME")); + StrCpy(t.ClientAuth->SecurePrivateKeyName, sizeof(t.ClientAuth->SecurePrivateKeyName), + GetParamStr(o, "KEYNAME")); + + Zero(&z, sizeof(z)); + z.CheckServerCert = t.CheckServerCert; + z.RetryOnServerCert = t.RetryOnServerCert; + z.ClientAuth = t.ClientAuth; + z.ClientOption = t.ClientOption; + z.ServerCert = t.ServerCert; + z.StartupAccount = t.StartupAccount; + + ret = CcSetAccount(pc->RemoteClient, &z); + } + + if (ret != ERR_NO_ERROR) + { + // Error has occurred + CmdPrintError(c, ret); + } + + CiFreeClientGetAccount(&t); + + // Release of the parameter list + FreeParamValueList(o); + + return ret; +} + +UINT PcAccountOpensslEngineCertSet(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) +{ + LIST *o; + PC *pc = (PC *)param; + UINT ret = ERR_NO_ERROR; + RPC_CLIENT_GET_ACCOUNT t; + // Parameter list that can be specified + PARAM args[] = + { + {"[name]", CmdPrompt, _UU("CMD_AccountCreate_Prompt_Name"), CmdEvalNotEmpty, NULL}, + {"LOADCERT", CmdPrompt, _UU("CMD_LOADCERTPATH"), CmdEvalIsFile, NULL}, + {"KEYNAME", CmdPrompt, _UU("CMD_AccountOpensslCertSet_PROMPT_KEYNAME"), CmdEvalNotEmpty, NULL}, + {"ENGINENAME", CmdPrompt, _UU("CMD_AccountOpensslCertSet_PROMPT_ENGINENAME"), CmdEvalNotEmpty, NULL}, + }; + + // Get the parameter list + o = ParseCommandList(c, cmd_name, str, args, sizeof(args) / sizeof(args[0])); + if (o == NULL) + { + return ERR_INVALID_PARAMETER; + } + + // RPC call + Zero(&t, sizeof(t)); + + UniStrCpy(t.AccountName, sizeof(t.AccountName), GetParamUniStr(o, "[name]")); + + ret = CcGetAccount(pc->RemoteClient, &t); + + if (ret == ERR_NO_ERROR) + { + RPC_CLIENT_CREATE_ACCOUNT z; + t.ClientAuth->AuthType = CLIENT_AUTHTYPE_OPENSSLENGINE; + X *x; + x = FileToXW(GetParamUniStr(o, "LOADCERT")); + if (x == NULL) + { + c->Write(c, _UU("CMD_LOADCERT_FAILED")); + } + StrCpy(t.ClientAuth->OpensslEnginePrivateKeyName, sizeof(t.ClientAuth->OpensslEnginePrivateKeyName), + GetParamStr(o, "KEYNAME")); + StrCpy(t.ClientAuth->OpensslEngineName, sizeof(t.ClientAuth->OpensslEngineName), + GetParamStr(o, "ENGINENAME")); + t.ClientAuth->ClientX = CloneX(x); + Zero(&z, sizeof(z)); + z.CheckServerCert = t.CheckServerCert; + z.RetryOnServerCert = t.RetryOnServerCert; + z.ClientAuth = t.ClientAuth; + z.ClientOption = t.ClientOption; + z.ServerCert = t.ServerCert; + z.StartupAccount = t.StartupAccount; + + ret = CcSetAccount(pc->RemoteClient, &z); + } + + if (ret != ERR_NO_ERROR) + { + // Error has occurred + CmdPrintError(c, ret); + } + + CiFreeClientGetAccount(&t); + + // Release of the parameter list + FreeParamValueList(o); + + return ret; +} + + +// Set the retry interval and number of retries when disconnect or connection failure of connection settings +UINT PcAccountRetrySet(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) +{ + LIST *o; + PC *pc = (PC *)param; + UINT ret = ERR_NO_ERROR; + RPC_CLIENT_GET_ACCOUNT t; + // Parameter list that can be specified + CMD_EVAL_MIN_MAX minmax = + { + "CMD_AccountRetrySet_EVAL_INTERVAL", + 5, + 4294967295UL, + }; + PARAM args[] = + { + {"[name]", CmdPrompt, _UU("CMD_AccountCreate_Prompt_Name"), CmdEvalNotEmpty, NULL}, + {"NUM", CmdPrompt, _UU("CMD_AccountRetrySet_PROMPT_NUM"), CmdEvalNotEmpty, NULL}, + {"INTERVAL", CmdPrompt, _UU("CMD_AccountRetrySet_PROMPT_INTERVAL"), CmdEvalMinMax, &minmax}, + }; + + // Get the parameter list + o = ParseCommandList(c, cmd_name, str, args, sizeof(args) / sizeof(args[0])); + if (o == NULL) + { + return ERR_INVALID_PARAMETER; + } + + // RPC call + Zero(&t, sizeof(t)); + + UniStrCpy(t.AccountName, sizeof(t.AccountName), GetParamUniStr(o, "[name]")); + + ret = CcGetAccount(pc->RemoteClient, &t); + + if (ret == ERR_NO_ERROR) + { + RPC_CLIENT_CREATE_ACCOUNT z; + // Change the settings + UINT num = GetParamInt(o, "NUM"); + UINT interval = GetParamInt(o, "INTERVAL"); + + t.ClientOption->NumRetry = (num == 999) ? INFINITE : num; + t.ClientOption->RetryInterval = interval; + + Zero(&z, sizeof(z)); + z.CheckServerCert = t.CheckServerCert; + z.RetryOnServerCert = t.RetryOnServerCert; + z.ClientAuth = t.ClientAuth; + z.ClientOption = t.ClientOption; + z.ServerCert = t.ServerCert; + z.StartupAccount = t.StartupAccount; + + ret = CcSetAccount(pc->RemoteClient, &z); + } + + if (ret != ERR_NO_ERROR) + { + // Error has occurred + CmdPrintError(c, ret); + } + + CiFreeClientGetAccount(&t); + + // Release of the parameter list + FreeParamValueList(o); + + return ret; +} + + +// Set to start-up connection the connection settings +UINT PcAccountStartupSet(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) +{ + LIST *o; + PC *pc = (PC *)param; + UINT ret = ERR_NO_ERROR; + RPC_CLIENT_GET_ACCOUNT t; + // Parameter list that can be specified + PARAM args[] = + { + {"[name]", CmdPrompt, _UU("CMD_AccountCreate_Prompt_Name"), CmdEvalNotEmpty, NULL}, + }; + + // Get the parameter list + o = ParseCommandList(c, cmd_name, str, args, sizeof(args) / sizeof(args[0])); + if (o == NULL) + { + return ERR_INVALID_PARAMETER; + } + + // RPC call + Zero(&t, sizeof(t)); + + UniStrCpy(t.AccountName, sizeof(t.AccountName), GetParamUniStr(o, "[name]")); + + ret = CcGetAccount(pc->RemoteClient, &t); + + if (ret == ERR_NO_ERROR) + { + RPC_CLIENT_CREATE_ACCOUNT z; + // Change the settings + t.StartupAccount = true; + + Zero(&z, sizeof(z)); + z.CheckServerCert = t.CheckServerCert; + z.RetryOnServerCert = t.RetryOnServerCert; + z.ClientAuth = t.ClientAuth; + z.ClientOption = t.ClientOption; + z.ServerCert = t.ServerCert; + z.StartupAccount = t.StartupAccount; + + ret = CcSetAccount(pc->RemoteClient, &z); + } + + if (ret != ERR_NO_ERROR) + { + // Error has occurred + CmdPrintError(c, ret); + } + + CiFreeClientGetAccount(&t); + + // Release of the parameter list + FreeParamValueList(o); + + return ret; +} + +// Unset the start-up connection of the connection settings +UINT PcAccountStartupRemove(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) +{ + LIST *o; + PC *pc = (PC *)param; + UINT ret = ERR_NO_ERROR; + RPC_CLIENT_GET_ACCOUNT t; + // Parameter list that can be specified + PARAM args[] = + { + {"[name]", CmdPrompt, _UU("CMD_AccountCreate_Prompt_Name"), CmdEvalNotEmpty, NULL}, + }; + + // Get the parameter list + o = ParseCommandList(c, cmd_name, str, args, sizeof(args) / sizeof(args[0])); + if (o == NULL) + { + return ERR_INVALID_PARAMETER; + } + + // RPC call + Zero(&t, sizeof(t)); + + UniStrCpy(t.AccountName, sizeof(t.AccountName), GetParamUniStr(o, "[name]")); + + ret = CcGetAccount(pc->RemoteClient, &t); + + if (ret == ERR_NO_ERROR) + { + RPC_CLIENT_CREATE_ACCOUNT z; + // Change the settings + t.StartupAccount = false; + + Zero(&z, sizeof(z)); + z.CheckServerCert = t.CheckServerCert; + z.RetryOnServerCert = t.RetryOnServerCert; + z.ClientAuth = t.ClientAuth; + z.ClientOption = t.ClientOption; + z.ServerCert = t.ServerCert; + z.StartupAccount = t.StartupAccount; + + ret = CcSetAccount(pc->RemoteClient, &z); + } + + if (ret != ERR_NO_ERROR) + { + // Error has occurred + CmdPrintError(c, ret); + } + + CiFreeClientGetAccount(&t); + + // Release of the parameter list + FreeParamValueList(o); + + return ret; +} + +// Export the connection settings +UINT PcAccountExport(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) +{ + LIST *o; + PC *pc = (PC *)param; + UINT ret = ERR_NO_ERROR; + RPC_CLIENT_GET_ACCOUNT t; + // Parameter list that can be specified + PARAM args[] = + { + {"[name]", CmdPrompt, _UU("CMD_AccountCreate_Prompt_Name"), CmdEvalNotEmpty, NULL}, + {"SAVEPATH", CmdPrompt, _UU("CMD_AccountExport_PROMPT_SAVEPATH"), CmdEvalNotEmpty, NULL}, + }; + + // Get the parameter list + o = ParseCommandList(c, cmd_name, str, args, sizeof(args) / sizeof(args[0])); + if (o == NULL) + { + return ERR_INVALID_PARAMETER; + } + + // RPC call + Zero(&t, sizeof(t)); + + UniStrCpy(t.AccountName, sizeof(t.AccountName), GetParamUniStr(o, "[name]")); + + ret = CcGetAccount(pc->RemoteClient, &t); + + if (ret == ERR_NO_ERROR) + { + RPC_CLIENT_CREATE_ACCOUNT z; + BUF *b; + BUF *b2; + char tmp[MAX_SIZE]; + UCHAR *buf; + UINT buf_size; + UCHAR bom[] = {0xef, 0xbb, 0xbf, }; + + Zero(&z, sizeof(z)); + z.CheckServerCert = t.CheckServerCert; + z.ClientAuth = t.ClientAuth; + z.ClientOption = t.ClientOption; + z.ServerCert = t.ServerCert; + z.StartupAccount = t.StartupAccount; + + b = CiAccountToCfg(&z); + + StrCpy(tmp, sizeof(tmp), GetParamStr(o, "SAVEPATH")); + b2 = NewBuf(); + + WriteBuf(b2, bom, sizeof(bom)); + + // Add the header part + buf_size = CalcUniToUtf8(_UU("CM_ACCOUNT_FILE_BANNER")); + buf = ZeroMalloc(buf_size + 32); + UniToUtf8(buf, buf_size, _UU("CM_ACCOUNT_FILE_BANNER")); + + WriteBuf(b2, buf, StrLen((char *)buf)); + WriteBuf(b2, b->Buf, b->Size); + SeekBuf(b2, 0, 0); + + FreeBuf(b); + + if (DumpBuf(b2, tmp) == false) + { + c->Write(c, _UU("CMD_SAVEFILE_FAILED")); + ret = ERR_INTERNAL_ERROR; + } + + FreeBuf(b2); + Free(buf); + } + + if (ret != ERR_NO_ERROR) + { + // Error has occurred + CmdPrintError(c, ret); + } + + CiFreeClientGetAccount(&t); + + // Release of the parameter list + FreeParamValueList(o); + + return ret; +} + +// Check whether the specified account name exists +bool CmdIsAccountName(REMOTE_CLIENT *r, wchar_t *name) +{ + UINT i; + RPC_CLIENT_ENUM_ACCOUNT t; + wchar_t tmp[MAX_SIZE]; + bool b = false; + // Validate arguments + if (r == NULL || name == NULL) + { + return false; + } + + if (CcEnumAccount(r, &t) != ERR_NO_ERROR) + { + return false; + } + + UniStrCpy(tmp, sizeof(tmp), name); + UniTrim(tmp); + + for (i = 0;i < t.NumItem;i++) + { + if (UniStrCmpi(t.Items[i]->AccountName, tmp) == 0) + { + b = true; + break; + } + } + + CiFreeClientEnumAccount(&t); + + return b; +} + +// Generate an import name +void CmdGenerateImportName(REMOTE_CLIENT *r, wchar_t *name, UINT size, wchar_t *old_name) +{ + UINT i; + // Validate arguments + if (r == NULL || name == NULL || old_name == NULL) + { + return; + } + + for (i = 1;;i++) + { + wchar_t tmp[MAX_SIZE]; + if (i == 1) + { + UniFormat(tmp, sizeof(tmp), _UU("CM_IMPORT_NAME_1"), old_name); + } + else + { + UniFormat(tmp, sizeof(tmp), _UU("CM_IMPORT_NAME_2"), old_name, i); + } + + if (CmdIsAccountName(r, tmp) == false) + { + UniStrCpy(name, size, tmp); + return; + } + } +} + +// Import a connection setting +UINT PcAccountImport(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) +{ + LIST *o; + PC *pc = (PC *)param; + UINT ret = ERR_NO_ERROR; + BUF *b; + wchar_t name[MAX_SIZE]; + // Parameter list that can be specified + PARAM args[] = + { + {"[path]", CmdPrompt, _UU("CMD_AccountImport_PROMPT_PATH"), CmdEvalIsFile, NULL}, + }; + + // Get the parameter list + o = ParseCommandList(c, cmd_name, str, args, sizeof(args) / sizeof(args[0])); + if (o == NULL) + { + return ERR_INVALID_PARAMETER; + } + + // Read the file + b = ReadDumpW(GetParamUniStr(o, "[path]")); + + if (b == NULL) + { + // Read failure + c->Write(c, _UU("CMD_LOADFILE_FAILED")); + ret = ERR_INTERNAL_ERROR; + } + else + { + RPC_CLIENT_CREATE_ACCOUNT *t; + + t = CiCfgToAccount(b); + + if (t == NULL) + { + // Failed to parse + c->Write(c, _UU("CMD_AccountImport_FAILED_PARSE")); + ret = ERR_INTERNAL_ERROR; + } + else + { + CmdGenerateImportName(pc->RemoteClient, name, sizeof(name), t->ClientOption->AccountName); + UniStrCpy(t->ClientOption->AccountName, sizeof(t->ClientOption->AccountName), name); + + ret = CcCreateAccount(pc->RemoteClient, t); + + if (ret == ERR_NO_ERROR) + { + wchar_t tmp[MAX_SIZE]; + + UniFormat(tmp, sizeof(tmp), _UU("CMD_AccountImport_OK"), name); + c->Write(c, tmp); + } + + CiFreeClientCreateAccount(t); + Free(t); + } + + FreeBuf(b); + } + + if (ret != ERR_NO_ERROR) + { + // Error has occurred + CmdPrintError(c, ret); + } + + // Release of the parameter list + FreeParamValueList(o); + + return ret; +} + +// Allow remote management of the VPN Client Service +UINT PcRemoteEnable(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) +{ + LIST *o; + PC *pc = (PC *)param; + UINT ret = ERR_NO_ERROR; + CLIENT_CONFIG t; + + // Get the parameter list + o = ParseCommandList(c, cmd_name, str, NULL, 0); + if (o == NULL) + { + return ERR_INVALID_PARAMETER; + } + + // RPC call + Zero(&t, sizeof(t)); + + ret = CcGetClientConfig(pc->RemoteClient, &t); + + if (ret == ERR_NO_ERROR) + { + t.AllowRemoteConfig = true; + ret = CcSetClientConfig(pc->RemoteClient, &t); + } + + if (ret == ERR_NO_ERROR) + { + // Success + } + + if (ret != ERR_NO_ERROR) + { + // Error has occurred + CmdPrintError(c, ret); + } + + // Release of the parameter list + FreeParamValueList(o); + + return ret; +} + +// Prohibit remote management of the VPN Client Service +UINT PcRemoteDisable(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) +{ + LIST *o; + PC *pc = (PC *)param; + UINT ret = ERR_NO_ERROR; + CLIENT_CONFIG t; + + // Get the parameter list + o = ParseCommandList(c, cmd_name, str, NULL, 0); + if (o == NULL) + { + return ERR_INVALID_PARAMETER; + } + + // RPC call + Zero(&t, sizeof(t)); + + ret = CcGetClientConfig(pc->RemoteClient, &t); + + if (ret == ERR_NO_ERROR) + { + t.AllowRemoteConfig = false; + ret = CcSetClientConfig(pc->RemoteClient, &t); + } + + if (ret == ERR_NO_ERROR) + { + // Success + } + + if (ret != ERR_NO_ERROR) + { + // Error has occurred + CmdPrintError(c, ret); + } + + // Release of the parameter list + FreeParamValueList(o); + + return ret; +} + +// Enable the maintenance function of the Internet connection +UINT PcKeepEnable(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) +{ + LIST *o; + PC *pc = (PC *)param; + UINT ret = ERR_NO_ERROR; + CLIENT_CONFIG t; + + // Get the parameter list + o = ParseCommandList(c, cmd_name, str, NULL, 0); + if (o == NULL) + { + return ERR_INVALID_PARAMETER; + } + + // RPC call + Zero(&t, sizeof(t)); + + ret = CcGetClientConfig(pc->RemoteClient, &t); + + if (ret == ERR_NO_ERROR) + { + // Change the settings + t.UseKeepConnect = true; + ret = CcSetClientConfig(pc->RemoteClient, &t); + } + + if (ret == ERR_NO_ERROR) + { + // Success + } + + if (ret != ERR_NO_ERROR) + { + // Error has occurred + CmdPrintError(c, ret); + } + + // Release of the parameter list + FreeParamValueList(o); + + return ret; +} + +// Disable the maintenance function of the Internet connection +UINT PcKeepDisable(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) +{ + LIST *o; + PC *pc = (PC *)param; + UINT ret = ERR_NO_ERROR; + CLIENT_CONFIG t; + + // Get the parameter list + o = ParseCommandList(c, cmd_name, str, NULL, 0); + if (o == NULL) + { + return ERR_INVALID_PARAMETER; + } + + // RPC call + Zero(&t, sizeof(t)); + + ret = CcGetClientConfig(pc->RemoteClient, &t); + + if (ret == ERR_NO_ERROR) + { + // Change the settings + t.UseKeepConnect = false; + ret = CcSetClientConfig(pc->RemoteClient, &t); + } + + if (ret == ERR_NO_ERROR) + { + // Success + } + + if (ret != ERR_NO_ERROR) + { + // Error has occurred + CmdPrintError(c, ret); + } + + // Release of the parameter list + FreeParamValueList(o); + + return ret; +} + +// Set the maintenance function of the Internet connection +UINT PcKeepSet(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) +{ + LIST *o; + PC *pc = (PC *)param; + UINT ret = ERR_NO_ERROR; + CLIENT_CONFIG t; + char *host; + UINT port; + // Parameter list that can be specified + PARAM args[] = + { + // "name", prompt_proc, prompt_param, eval_proc, eval_param + {"HOST", CmdPrompt, _UU("CMD_KeepSet_PROMPT_HOST"), CmdEvalHostAndPort, NULL}, + {"PROTOCOL", CmdPrompt, _UU("CMD_KeepSet_PROMPT_PROTOCOL"), CmdEvalTcpOrUdp, NULL}, + {"INTERVAL", CmdPrompt, _UU("CMD_KeepSet_PROMPT_INTERVAL"), NULL, NULL}, + }; + + o = ParseCommandList(c, cmd_name, str, args, sizeof(args) / sizeof(args[0])); + if (o == NULL) + { + return ERR_INVALID_PARAMETER; + } + + // RPC call + Zero(&t, sizeof(t)); + + ret = CcGetClientConfig(pc->RemoteClient, &t); + + if (ret == ERR_NO_ERROR) + { + if (ParseHostPort(GetParamStr(o, "HOST"), &host, &port, 0)) + { + StrCpy(t.KeepConnectHost, sizeof(t.KeepConnectHost), host); + t.KeepConnectPort = port; + t.KeepConnectInterval = GetParamInt(o, "INTERVAL"); + t.KeepConnectProtocol = (StrCmpi(GetParamStr(o, "PROTOCOL"), "tcp") == 0) ? 0 : 1; + Free(host); + + ret = CcSetClientConfig(pc->RemoteClient, &t); + } + } + + if (ret != ERR_NO_ERROR) + { + // Error has occurred + CmdPrintError(c, ret); + } + + // Release of the parameter list + FreeParamValueList(o); + + return ret; +} + +// Get the maintenance function of the Internet connection +UINT PcKeepGet(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) +{ + LIST *o; + PC *pc = (PC *)param; + UINT ret = ERR_NO_ERROR; + CLIENT_CONFIG t; + + o = ParseCommandList(c, cmd_name, str, NULL, 0); + if (o == NULL) + { + return ERR_INVALID_PARAMETER; + } + + // RPC call + Zero(&t, sizeof(t)); + + ret = CcGetClientConfig(pc->RemoteClient, &t); + + if (ret == ERR_NO_ERROR) + { + wchar_t tmp[MAX_SIZE]; + CT *ct = CtNewStandard(); + + StrToUni(tmp, sizeof(tmp), t.KeepConnectHost); + CtInsert(ct, _UU("CMD_KeepGet_COLUMN_1"), tmp); + + UniToStru(tmp, t.KeepConnectPort); + CtInsert(ct, _UU("CMD_KeepGet_COLUMN_2"), tmp); + + UniToStru(tmp, t.KeepConnectInterval); + CtInsert(ct, _UU("CMD_KeepGet_COLUMN_3"), tmp); + + CtInsert(ct, _UU("CMD_KeepGet_COLUMN_4"), + t.KeepConnectProtocol == 0 ? L"TCP/IP" : L"UDP/IP"); + + CtInsert(ct, _UU("CMD_KeepGet_COLUMN_5"), + t.UseKeepConnect ? _UU("SM_ACCESS_ENABLE") : _UU("SM_ACCESS_DISABLE")); + + CtFree(ct, c); + } + + if (ret != ERR_NO_ERROR) + { + // Error has occurred + CmdPrintError(c, ret); + } + + // Release of the parameter list + FreeParamValueList(o); + + return ret; +} + + +// Creat a new client management tool context +PC *NewPc(CONSOLE *c, REMOTE_CLIENT *remote_client, char *servername, wchar_t *cmdline) +{ + PC *pc; + // Validate arguments + if (c == NULL || remote_client == NULL || servername == NULL) + { + return NULL; + } + if (UniIsEmptyStr(cmdline)) + { + cmdline = NULL; + } + + pc = ZeroMalloc(sizeof(PC)); + pc->ConsoleForServer = false; + pc->ServerName = CopyStr(servername); + pc->Console = c; + pc->LastError = 0; + pc->RemoteClient = remote_client; + pc->CmdLine = CopyUniStr(cmdline); + + return pc; +} + +// Release the client management tools context +void FreePc(PC *pc) +{ + // Validate arguments + if (pc == NULL) + { + return; + } + + Free(pc->ServerName); + Free(pc->CmdLine); + Free(pc); +} + +// Client management tool +UINT PcConnect(CONSOLE *c, char *target, wchar_t *cmdline, char *password) +{ + CEDAR *cedar; + REMOTE_CLIENT *client; + bool bad_pass; + bool no_remote; + char pass[MAX_SIZE]; + UINT ret = 0; + // Validate arguments + if (c == NULL || target == NULL) + { + return ERR_INTERNAL_ERROR; + } + + StrCpy(pass, sizeof(pass), password); + + cedar = NewCedar(NULL, NULL); + +RETRY: + client = CcConnectRpc(target, pass, &bad_pass, &no_remote, 0); + + if (client == NULL) + { + if (no_remote) + { + // Remote connection refusal + c->Write(c, _UU("CMD_VPNCMD_CLIENT_NO_REMODE")); + ReleaseCedar(cedar); + return ERR_INTERNAL_ERROR; + } + else if (bad_pass) + { + char *tmp; + // Password is different + c->Write(c, _UU("CMD_VPNCMD_PASSWORD_1")); + tmp = c->ReadPassword(c, _UU("CMD_VPNCMD_PASSWORD_2")); + c->Write(c, L""); + + if (tmp == NULL) + { + // Cancel + ReleaseCedar(cedar); + return ERR_ACCESS_DENIED; + } + else + { + StrCpy(pass, sizeof(pass), tmp); + Free(tmp); + } + + goto RETRY; + } + else + { + // Connection failure + CmdPrintError(c, ERR_CONNECT_FAILED); + ReleaseCedar(cedar); + return ERR_CONNECT_FAILED; + } + } + else + { + // Connection complete + PC *pc = NewPc(c, client, target, cmdline); + PcMain(pc); + ret = pc->LastError; + FreePc(pc); + } + + CcDisconnectRpc(client); + + ReleaseCedar(cedar); + + return ret; +} + + +// Server Administration Tool Processor Main +void PsMain(PS *ps) +{ + char prompt[MAX_SIZE]; + wchar_t tmp[MAX_SIZE]; + // Validate arguments + if (ps == NULL) + { + return; + } + + // If it's not in CSV mode, to display a message that the connection has been made + if(ps->Console->ConsoleType != CONSOLE_CSV) + { + UniFormat(tmp, sizeof(tmp), _UU("CMD_VPNCMD_SERVER_CONNECTED"), + ps->ServerName, ps->ServerPort); + ps->Console->Write(ps->Console, tmp); + ps->Console->Write(ps->Console, L""); + + if (ps->HubName == NULL) + { + // Server management mode + ps->Console->Write(ps->Console, _UU("CMD_VPNCMD_SERVER_CONNECTED_1")); + } + else + { + // Virtual HUB management mode + UniFormat(tmp, sizeof(tmp), _UU("CMD_VPNCMD_SERVER_CONNECTED_2"), + ps->HubName); + ps->Console->Write(ps->Console, tmp); + } + ps->Console->Write(ps->Console, L""); + } + + // Get the Caps + ps->CapsList = ScGetCapsEx(ps->Rpc); + + if (ps->AdminHub != NULL) + { + RPC_HUB_STATUS t; + UINT ret; + wchar_t tmp[MAX_SIZE]; + + // Choose the Virtual HUB that is specified in the ADMINHUB + Zero(&t, sizeof(t)); + + StrCpy(t.HubName, sizeof(t.HubName), ps->AdminHub); + + ret = ScGetHubStatus(ps->Rpc, &t); + if (ret == ERR_NO_ERROR) + { + // Success + UniFormat(tmp, sizeof(tmp), _UU("CMD_Hub_Selected"), t.HubName); + + if (ps->HubName != NULL) + { + Free(ps->HubName); + } + ps->HubName = CopyStr(t.HubName); + + if( ps->Console->ConsoleType != CONSOLE_CSV) + { + ps->Console->Write(ps->Console, tmp); + } + } + else + { + // Failure + UniFormat(tmp, sizeof(tmp), _UU("CMD_Hub_Select_Failed"), ps->AdminHub); + + ps->Console->Write(ps->Console, tmp); + CmdPrintError(ps->Console, ret); + } + } + + if (ps->HubName == NULL) + { + RPC_KEY_PAIR t; + + Zero(&t, sizeof(t)); + + if (ScGetServerCert(ps->Rpc, &t) == ERR_NO_ERROR) + { + if (t.Cert != NULL && t.Cert->has_basic_constraints == false) + { + if (t.Cert->root_cert) + { + ps->Console->Write(ps->Console, L""); + ps->Console->Write(ps->Console, _UU("SM_CERT_MESSAGE_CLI")); + ps->Console->Write(ps->Console, L""); + } + } + + FreeRpcKeyPair(&t); + } + } + + while (true) + { + // Definition of command + CMD cmd[] = + { + {"About", PsAbout}, + {"Check", PtCheck}, + {"Crash", PsCrash}, + {"Flush", PsFlush}, + {"Debug", PsDebug}, + {"ServerInfoGet", PsServerInfoGet}, + {"ServerStatusGet", PsServerStatusGet}, + {"ListenerCreate", PsListenerCreate}, + {"ListenerDelete", PsListenerDelete}, + {"ListenerList", PsListenerList}, + {"ListenerEnable", PsListenerEnable}, + {"ListenerDisable", PsListenerDisable}, + {"PortsUDPGet", PsPortsUDPGet}, + {"PortsUDPSet", PsPortsUDPSet}, + {"ProtoOptionsGet", PsProtoOptionsGet}, + {"ProtoOptionsSet", PsProtoOptionsSet}, + {"ServerPasswordSet", PsServerPasswordSet}, + {"ClusterSettingGet", PsClusterSettingGet}, + {"ClusterSettingStandalone", PsClusterSettingStandalone}, + {"ClusterSettingController", PsClusterSettingController}, + {"ClusterSettingMember", PsClusterSettingMember}, + {"ClusterMemberList", PsClusterMemberList}, + {"ClusterMemberInfoGet", PsClusterMemberInfoGet}, + {"ClusterMemberCertGet", PsClusterMemberCertGet}, + {"ClusterConnectionStatusGet", PsClusterConnectionStatusGet}, + {"ServerCertGet", PsServerCertGet}, + {"ServerKeyGet", PsServerKeyGet}, + {"ServerCertSet", PsServerCertSet}, + {"ServerCipherGet", PsServerCipherGet}, + {"ServerCipherSet", PsServerCipherSet}, + {"KeepEnable", PsKeepEnable}, + {"KeepDisable", PsKeepDisable}, + {"KeepSet", PsKeepSet}, + {"KeepGet", PsKeepGet}, + {"SyslogGet", PsSyslogGet}, + {"SyslogDisable", PsSyslogDisable}, + {"SyslogEnable", PsSyslogEnable}, + {"ConnectionList", PsConnectionList}, + {"ConnectionGet", PsConnectionGet}, + {"ConnectionDisconnect", PsConnectionDisconnect}, + {"BridgeDeviceList", PsBridgeDeviceList}, + {"BridgeList", PsBridgeList}, + {"BridgeCreate", PsBridgeCreate}, + {"BridgeDelete", PsBridgeDelete}, + {"Caps", PsCaps}, + {"Reboot", PsReboot}, + {"ConfigGet", PsConfigGet}, + {"ConfigSet", PsConfigSet}, + {"RouterList", PsRouterList}, + {"RouterAdd", PsRouterAdd}, + {"RouterDelete", PsRouterDelete}, + {"RouterStart", PsRouterStart}, + {"RouterStop", PsRouterStop}, + {"RouterIfList", PsRouterIfList}, + {"RouterIfAdd", PsRouterIfAdd}, + {"RouterIfDel", PsRouterIfDel}, + {"RouterTableList", PsRouterTableList}, + {"RouterTableAdd", PsRouterTableAdd}, + {"RouterTableDel", PsRouterTableDel}, + {"LogFileList", PsLogFileList}, + {"LogFileGet", PsLogFileGet}, + {"HubCreate", PsHubCreate}, + {"HubCreateDynamic", PsHubCreateDynamic}, + {"HubCreateStatic", PsHubCreateStatic}, + {"HubDelete", PsHubDelete}, + {"HubSetStatic", PsHubSetStatic}, + {"HubSetDynamic", PsHubSetDynamic}, + {"HubList", PsHubList}, + {"Hub", PsHub}, + {"Online", PsOnline}, + {"Offline", PsOffline}, + {"SetMaxSession", PsSetMaxSession}, + {"SetHubPassword", PsSetHubPassword}, + {"SetEnumAllow", PsSetEnumAllow}, + {"SetEnumDeny", PsSetEnumDeny}, + {"OptionsGet", PsOptionsGet}, + {"RadiusServerSet", PsRadiusServerSet}, + {"RadiusServerDelete", PsRadiusServerDelete}, + {"RadiusServerGet", PsRadiusServerGet}, + {"StatusGet", PsStatusGet}, + {"LogGet", PsLogGet}, + {"LogEnable", PsLogEnable}, + {"LogDisable", PsLogDisable}, + {"LogSwitchSet", PsLogSwitchSet}, + {"LogPacketSaveType", PsLogPacketSaveType}, + {"CAList", PsCAList}, + {"CAAdd", PsCAAdd}, + {"CADelete", PsCADelete}, + {"CAGet", PsCAGet}, + {"CascadeList", PsCascadeList}, + {"CascadeCreate", PsCascadeCreate}, + {"CascadeSet", PsCascadeSet}, + {"CascadeGet", PsCascadeGet}, + {"CascadeDelete", PsCascadeDelete}, + {"CascadeUsernameSet", PsCascadeUsernameSet}, + {"CascadeAnonymousSet", PsCascadeAnonymousSet}, + {"CascadePasswordSet", PsCascadePasswordSet}, + {"CascadeCertSet", PsCascadeCertSet}, + {"CascadeCertGet", PsCascadeCertGet}, + {"CascadeEncryptEnable", PsCascadeEncryptEnable}, + {"CascadeEncryptDisable", PsCascadeEncryptDisable}, + {"CascadeCompressEnable", PsCascadeCompressEnable}, + {"CascadeCompressDisable", PsCascadeCompressDisable}, + {"CascadeProxyNone", PsCascadeProxyNone}, + {"CascadeHttpHeaderAdd", PsCascadeHttpHeaderAdd}, + {"CascadeHttpHeaderDelete", PsCascadeHttpHeaderDelete}, + {"CascadeHttpHeaderGet", PsCascadeHttpHeaderGet}, + {"CascadeProxyHttp", PsCascadeProxyHttp}, + {"CascadeProxySocks", PsCascadeProxySocks}, + {"CascadeProxySocks5", PsCascadeProxySocks5}, + {"CascadeServerCertEnable", PsCascadeServerCertEnable}, + {"CascadeServerCertDisable", PsCascadeServerCertDisable}, + {"CascadeServerCertSet", PsCascadeServerCertSet}, + {"CascadeServerCertDelete", PsCascadeServerCertDelete}, + {"CascadeServerCertGet", PsCascadeServerCertGet}, + {"CascadeDetailSet", PsCascadeDetailSet}, + {"CascadePolicySet", PsCascadePolicySet}, + {"PolicyList", PsPolicyList}, + {"CascadeStatusGet", PsCascadeStatusGet}, + {"CascadeRename", PsCascadeRename}, + {"CascadeOnline", PsCascadeOnline}, + {"CascadeOffline", PsCascadeOffline}, + {"AccessAdd", PsAccessAdd}, + {"AccessAddEx", PsAccessAddEx}, + {"AccessAdd6", PsAccessAdd6}, + {"AccessAddEx6", PsAccessAddEx6}, + {"AccessList", PsAccessList}, + {"AccessDelete", PsAccessDelete}, + {"AccessEnable", PsAccessEnable}, + {"AccessDisable", PsAccessDisable}, + {"UserList", PsUserList}, + {"UserCreate", PsUserCreate}, + {"UserSet", PsUserSet}, + {"UserDelete", PsUserDelete}, + {"UserGet", PsUserGet}, + {"UserAnonymousSet", PsUserAnonymousSet}, + {"UserPasswordSet", PsUserPasswordSet}, + {"UserCertSet", PsUserCertSet}, + {"UserCertGet", PsUserCertGet}, + {"UserSignedSet", PsUserSignedSet}, + {"UserRadiusSet", PsUserRadiusSet}, + {"UserNTLMSet", PsUserNTLMSet}, + {"UserPolicyRemove", PsUserPolicyRemove}, + {"UserPolicySet", PsUserPolicySet}, + {"UserExpiresSet", PsUserExpiresSet}, + {"GroupList", PsGroupList}, + {"GroupCreate", PsGroupCreate}, + {"GroupSet", PsGroupSet}, + {"GroupDelete", PsGroupDelete}, + {"GroupGet", PsGroupGet}, + {"GroupJoin", PsGroupJoin}, + {"GroupUnjoin", PsGroupUnjoin}, + {"GroupPolicyRemove", PsGroupPolicyRemove}, + {"GroupPolicySet", PsGroupPolicySet}, + {"SessionList", PsSessionList}, + {"SessionGet", PsSessionGet}, + {"SessionDisconnect", PsSessionDisconnect}, + {"MacTable", PsMacTable}, + {"MacDelete", PsMacDelete}, + {"IpTable", PsIpTable}, + {"IpDelete", PsIpDelete}, + {"SecureNatEnable", PsSecureNatEnable}, + {"SecureNatDisable", PsSecureNatDisable}, + {"SecureNatStatusGet", PsSecureNatStatusGet}, + {"SecureNatHostGet", PsSecureNatHostGet}, + {"SecureNatHostSet", PsSecureNatHostSet}, + {"NatGet", PsNatGet}, + {"NatEnable", PsNatEnable}, + {"NatDisable", PsNatDisable}, + {"NatSet", PsNatSet}, + {"NatTable", PsNatTable}, + {"DhcpGet", PsDhcpGet}, + {"DhcpEnable", PsDhcpEnable}, + {"DhcpDisable", PsDhcpDisable}, + {"DhcpSet", PsDhcpSet}, + {"DhcpTable", PsDhcpTable}, + {"AdminOptionList", PsAdminOptionList}, + {"AdminOptionSet", PsAdminOptionSet}, + {"ExtOptionList", PsExtOptionList}, + {"ExtOptionSet", PsExtOptionSet}, + {"CrlList", PsCrlList}, + {"CrlAdd", PsCrlAdd}, + {"CrlDel", PsCrlDel}, + {"CrlGet", PsCrlGet}, + {"AcList", PsAcList}, + {"AcAdd", PsAcAdd}, + {"AcAdd6", PsAcAdd6}, + {"AcDel", PsAcDel}, + {"MakeCert", PtMakeCert}, + {"MakeCert2048", PtMakeCert2048}, + {"TrafficClient", PtTrafficClient}, + {"TrafficServer", PtTrafficServer}, + {"LicenseAdd", PsLicenseAdd}, + {"LicenseDel", PsLicenseDel}, + {"LicenseList", PsLicenseList}, + {"LicenseStatus", PsLicenseStatus}, + {"IPsecEnable", PsIPsecEnable}, + {"IPsecGet", PsIPsecGet}, + {"EtherIpClientAdd", PsEtherIpClientAdd}, + {"EtherIpClientDelete", PsEtherIpClientDelete}, + {"EtherIpClientList", PsEtherIpClientList}, + {"OpenVpnMakeConfig", PsOpenVpnMakeConfig}, + {"ServerCertRegenerate", PsServerCertRegenerate}, + {"VpnOverIcmpDnsEnable", PsVpnOverIcmpDnsEnable}, + {"VpnOverIcmpDnsGet", PsVpnOverIcmpDnsGet}, + {"DynamicDnsGetStatus", PsDynamicDnsGetStatus}, + {"DynamicDnsSetHostname", PsDynamicDnsSetHostname}, + {"VpnAzureGetStatus", PsVpnAzureGetStatus}, + {"VpnAzureSetEnable", PsVpnAzureSetEnable}, + }; + + // Generate a prompt + if (ps->HubName == NULL) + { + Format(prompt, sizeof(prompt), "VPN Server>"); + } + else + { + Format(prompt, sizeof(prompt), "VPN Server/%s>", ps->HubName); + } + + if (DispatchNextCmdEx(ps->Console, ps->CmdLine, prompt, cmd, sizeof(cmd) / sizeof(cmd[0]), ps) == false) + { + break; + } + ps->LastError = ps->Console->RetCode; + + if (ps->LastError == ERR_NO_ERROR && ps->Console->ConsoleType != CONSOLE_CSV) + { + ps->Console->Write(ps->Console, _UU("CMD_MSG_OK")); + ps->Console->Write(ps->Console, L""); + } + + if (ps->CmdLine != NULL) + { + break; + } + } + + // Release the Caps + FreeCapsList(ps->CapsList); + ps->CapsList = NULL; +} + +// A template for a new command function +UINT PsXxx(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) +{ + LIST *o; + PS *ps = (PS *)param; + UINT ret; + RPC_LISTENER t; + PARAM args[] = + { + {"[port]", CmdPromptPort, _UU("CMD_ListenerCreate_PortPrompt"), CmdEvalPort, NULL}, + }; + + o = ParseCommandList(c, cmd_name, str, args, sizeof(args) / sizeof(args[0])); + if (o == NULL) + { + return ERR_INVALID_PARAMETER; + } + + Zero(&t, sizeof(t)); + t.Enable = true; + t.Port = ToInt(GetParamStr(o, "[port]")); + + ret = ScCreateListener(ps->Rpc, &t); + + if (ret != ERR_NO_ERROR) + { + CmdPrintError(c, ret); + FreeParamValueList(o); + return ret; + } + + FreeParamValueList(o); + + return 0; +} + +// Set to the stand-alone mode +UINT PsClusterSettingStandalone(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) +{ + LIST *o; + PS *ps = (PS *)param; + UINT ret = 0; + RPC_FARM t; + + o = ParseCommandList(c, cmd_name, str, NULL, 0); + if (o == NULL) + { + return ERR_INVALID_PARAMETER; + } + + Zero(&t, sizeof(t)); + t.ServerType = SERVER_TYPE_STANDALONE; + + // RPC call + ret = ScSetFarmSetting(ps->Rpc, &t); + + if (ret != ERR_NO_ERROR) + { + // An error has occured + CmdPrintError(c, ret); + FreeParamValueList(o); + return ret; + } + + FreeParamValueList(o); + + return 0; +} + +// Set to the cluster controller mode +UINT PsClusterSettingController(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) +{ + LIST *o; + PS *ps = (PS *)param; + UINT ret = 0; + RPC_FARM t; + UINT weight; + PARAM args[] = + { + {"WEIGHT", NULL, NULL, NULL, NULL}, + {"ONLY", NULL, NULL, NULL, NULL}, + }; + + o = ParseCommandList(c, cmd_name, str, args, sizeof(args) / sizeof(args[0])); + if (o == NULL) + { + return ERR_INVALID_PARAMETER; + } + + weight = GetParamInt(o, "WEIGHT"); + if (weight == 0) + { + weight = FARM_DEFAULT_WEIGHT; + } + + Zero(&t, sizeof(t)); + t.ServerType = SERVER_TYPE_FARM_CONTROLLER; + t.Weight = weight; + t.ControllerOnly = GetParamYes(o, "ONLY"); + + // RPC call + ret = ScSetFarmSetting(ps->Rpc, &t); + + if (ret != ERR_NO_ERROR) + { + // An error has occured + CmdPrintError(c, ret); + FreeParamValueList(o); + return ret; + } + + FreeParamValueList(o); + + return 0; +} + +// Evaluate the IP address +bool CmdEvalIp(CONSOLE *c, wchar_t *str, void *param) +{ + // Validate arguments + if (c == NULL || str == NULL) + { + return false; + } + + if (UniIsEmptyStr(str)) + { + return true; + } + + if (UniStrToIP32(str) == 0 && UniStrCmpi(str, L"0.0.0.0") != 0) + { + wchar_t *msg = (param == NULL) ? _UU("CMD_IP_EVAL_FAILED") : (wchar_t *)param; + c->Write(c, msg); + return false; + } + + return true; +} + +// Convert a string to port list +LIST *StrToPortList(char *str, bool limit_range) +{ + LIST *o; + TOKEN_LIST *t; + UINT i; + if (str == NULL) + { + return NULL; + } + + // Convert to token + t = ParseToken(str, ", "); + if (t == NULL) + { + return NULL; + } + if (t->NumTokens == 0) + { + FreeToken(t); + return NULL; + } + + o = NewListFast(NULL); + + for (i = 0;i < t->NumTokens;i++) + { + char *s = t->Token[i]; + UINT n; + if (IsNum(s) == false) + { + ReleaseList(o); + FreeToken(t); + return NULL; + } + n = ToInt(s); + if (limit_range && (n == 0 || n >= 65536)) + { + ReleaseList(o); + FreeToken(t); + return NULL; + } + if (IsInList(o, (void *)n)) + { + ReleaseList(o); + FreeToken(t); + return NULL; + } + Add(o, (void *)n); + } + + FreeToken(t); + + if (LIST_NUM(o) > MAX_PUBLIC_PORT_NUM) + { + ReleaseList(o); + return NULL; + } + + return o; +} + +// Set to the cluster member mode +UINT PsClusterSettingMember(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) +{ + LIST *o; + PS *ps = (PS *)param; + UINT ret = 0; + RPC_FARM t; + char *host_and_port; + char *host; + UINT port; + UINT weight; + // Parameter list that can be specified + PARAM args[] = + { + // "name", prompt_proc, prompt_param, eval_proc, eval_param + {"[server:port]", CmdPrompt, _UU("CMD_ClusterSettingMember_Prompt_HOST_1"), CmdEvalHostAndPort, NULL}, + {"IP", PsClusterSettingMemberPromptIp, NULL, CmdEvalIp, NULL}, + {"PORTS", PsClusterSettingMemberPromptPorts, NULL, CmdEvalPortList, (void *)true}, + {"PASSWORD", CmdPromptChoosePassword, NULL, NULL, NULL}, + {"WEIGHT", NULL, NULL, NULL, NULL}, + }; + + o = ParseCommandList(c, cmd_name, str, args, sizeof(args) / sizeof(args[0])); + if (o == NULL) + { + return ERR_INVALID_PARAMETER; + } + + weight = GetParamInt(o, "WEIGHT"); + + if (weight == 0) + { + weight = FARM_DEFAULT_WEIGHT; + } + + Zero(&t, sizeof(t)); + host_and_port = GetParamStr(o, "[server:port]"); + if (ParseHostPort(host_and_port, &host, &port, 0)) + { + char *pw; + char *ports_str; + LIST *ports; + UINT i; + + StrCpy(t.ControllerName, sizeof(t.ControllerName), host); + t.ControllerPort = port; + Free(host); + + pw = GetParamStr(o, "PASSWORD"); + + Sha0(t.MemberPassword, pw, StrLen(pw)); + t.PublicIp = StrToIP32(GetParamStr(o, "IP")); + t.ServerType = SERVER_TYPE_FARM_MEMBER; + + ports_str = GetParamStr(o, "PORTS"); + + ports = StrToPortList(ports_str, true); + + t.NumPort = LIST_NUM(ports); + t.Ports = ZeroMalloc(sizeof(UINT) * t.NumPort); + + for (i = 0;i < t.NumPort;i++) + { + t.Ports[i] = (UINT)LIST_DATA(ports, i); + } + + t.Weight = weight; + + ReleaseList(ports); + + // RPC call + ret = ScSetFarmSetting(ps->Rpc, &t); + + if (ret != ERR_NO_ERROR) + { + // An error has occured + CmdPrintError(c, ret); + FreeParamValueList(o); + return ret; + } + + FreeRpcFarm(&t); + } + + FreeParamValueList(o); + + return 0; +} + +// Evaluate the port list +bool CmdEvalPortList(CONSOLE *c, wchar_t *str, void *param) +{ + char *s; + bool ret = false; + LIST *o; + // Validate arguments + if (c == NULL || str == NULL) + { + return false; + } + + s = CopyUniToStr(str); + + o = StrToPortList(s, (bool)param); + + if (o != NULL) + { + ret = true; + } + + ReleaseList(o); + + Free(s); + + if (ret == false) + { + c->Write(c, _UU("CMD_PORTLIST_EVAL_FAILED")); + } + + return ret; +} + +// Check the string of the form of the host name and port number +bool CmdEvalHostAndPort(CONSOLE *c, wchar_t *str, void *param) +{ + char *tmp; + bool ret = false; + // Validate arguments + if (c == NULL || str == NULL) + { + return false; + } + + tmp = CopyUniToStr(str); + + ret = ParseHostPort(tmp, NULL, NULL, (UINT)param); + + if (ret == false) + { + c->Write(c, param == NULL ? _UU("CMD_HOSTPORT_EVAL_FAILED") : (wchar_t *)param); + } + + Free(tmp); + + return ret; +} + +// Input the public port number +wchar_t *PsClusterSettingMemberPromptPorts(CONSOLE *c, void *param) +{ + wchar_t *ret; + // Validate arguments + if (c == NULL) + { + return NULL; + } + + c->Write(c, _UU("CMD_ClusterSettingMember_Prompt_PORT_1")); + c->Write(c, L""); + + ret = c->ReadLine(c, _UU("CMD_ClusterSettingMember_Prompt_PORT_2"), true); + + return ret; +} + +// Input the public IP address +wchar_t *PsClusterSettingMemberPromptIp(CONSOLE *c, void *param) +{ + wchar_t *ret; + // Validate arguments + if (c == NULL) + { + return NULL; + } + + c->Write(c, _UU("CMD_ClusterSettingMember_Prompt_IP_1")); + c->Write(c, L""); + + ret = c->ReadLine(c, _UU("CMD_ClusterSettingMember_Prompt_IP_2"), true); + + return ret; +} + +// Show the cluster members list +UINT PsClusterMemberList(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) +{ + LIST *o; + PS *ps = (PS *)param; + UINT ret = 0; + RPC_ENUM_FARM t; + CT *ct; + UINT i; + + o = ParseCommandList(c, cmd_name, str, NULL, 0); + if (o == NULL) + { + return ERR_INVALID_PARAMETER; + } + + Zero(&t, sizeof(t)); + + // RPC call + ret = ScEnumFarmMember(ps->Rpc, &t); + + if (ret != ERR_NO_ERROR) + { + // An error has occured + CmdPrintError(c, ret); + FreeParamValueList(o); + return ret; + } + + ct = CtNew(); + + CtInsertColumn(ct, _UU("CMD_ID"), true); + CtInsertColumn(ct, _UU("SM_FM_COLUMN_1"), false); + CtInsertColumn(ct, _UU("SM_FM_COLUMN_2"), false); + CtInsertColumn(ct, _UU("SM_FM_COLUMN_3"), false); + CtInsertColumn(ct, _UU("SM_FM_COLUMN_4"), true); + CtInsertColumn(ct, _UU("SM_FM_COLUMN_5"), true); + CtInsertColumn(ct, _UU("SM_FM_COLUMN_6"), true); + CtInsertColumn(ct, _UU("SM_FM_COLUMN_7"), true); + CtInsertColumn(ct, _UU("SM_FM_COLUMN_8"), true); + CtInsertColumn(ct, _UU("SM_FM_COLUMN_9"), true); + + for (i = 0;i < t.NumFarm;i++) + { + RPC_ENUM_FARM_ITEM *e = &t.Farms[i]; + wchar_t tmp0[64]; + wchar_t tmp1[MAX_SIZE]; + wchar_t tmp2[MAX_SIZE]; + wchar_t tmp3[64]; + wchar_t tmp4[64]; + wchar_t tmp5[64]; + wchar_t tmp6[64]; + wchar_t tmp7[64]; + wchar_t tmp8[64]; + + GetDateTimeStrEx64(tmp1, sizeof(tmp1), SystemToLocal64(e->ConnectedTime), NULL); + StrToUni(tmp2, sizeof(tmp2), e->Hostname); + UniToStru(tmp3, e->Point); + UniToStru(tmp4, e->NumSessions); + UniToStru(tmp5, e->NumTcpConnections); + UniToStru(tmp6, e->NumHubs); + UniToStru(tmp7, e->AssignedClientLicense); + UniToStru(tmp8, e->AssignedBridgeLicense); + + UniToStru(tmp0, e->Id); + + CtInsert(ct, tmp0, + e->Controller ? _UU("SM_FM_CONTROLLER") : _UU("SM_FM_MEMBER"), + tmp1, tmp2, tmp3, tmp4, tmp5, tmp6, tmp7, tmp8); + } + + CtFree(ct, c); + + FreeRpcEnumFarm(&t); + + FreeParamValueList(o); + + return 0; +} + +// Get information of cluster members +UINT PsClusterMemberInfoGet(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) +{ + LIST *o; + PS *ps = (PS *)param; + UINT ret = 0; + RPC_FARM_INFO t; + CT *ct; + // Parameter list that can be specified + PARAM args[] = + { + // "name", prompt_proc, prompt_param, eval_proc, eval_param + {"[id]", CmdPrompt, _UU("CMD_ClusterMemberInfoGet_PROMPT_ID"), NULL, NULL}, + }; + + o = ParseCommandList(c, cmd_name, str, args, sizeof(args) / sizeof(args[0])); + if (o == NULL) + { + return ERR_INVALID_PARAMETER; + } + + Zero(&t, sizeof(t)); + t.Id = UniToInt(GetParamUniStr(o, "[id]")); + + // RPC call + ret = ScGetFarmInfo(ps->Rpc, &t); + + if (ret != ERR_NO_ERROR) + { + // An error has occured + CmdPrintError(c, ret); + FreeParamValueList(o); + return ret; + } + + ct = CtNewStandard(); + + { + wchar_t tmp[MAX_SIZE]; + char str[MAX_SIZE]; + UINT i; + + CtInsert(ct, _UU("SM_FMINFO_TYPE"), + t.Controller ? _UU("SM_FARM_CONTROLLER") : _UU("SM_FARM_MEMBER")); + + GetDateTimeStrEx64(tmp, sizeof(tmp), SystemToLocal64(t.ConnectedTime), NULL); + CtInsert(ct, _UU("SM_FMINFO_CONNECT_TIME"), tmp); + + IPToStr32(str, sizeof(str), t.Ip); + StrToUni(tmp, sizeof(tmp), str); + CtInsert(ct, _UU("SM_FMINFO_IP"), tmp); + + StrToUni(tmp, sizeof(tmp), t.Hostname); + CtInsert(ct, _UU("SM_FMINFO_HOSTNAME"), tmp); + + UniToStru(tmp, t.Point); + CtInsert(ct, _UU("SM_FMINFO_POINT"), tmp); + + UniToStru(tmp, t.Weight); + CtInsert(ct, _UU("SM_FMINFO_WEIGHT"), tmp); + + UniToStru(tmp, t.NumPort); + CtInsert(ct, _UU("SM_FMINFO_NUM_PORT"), tmp); + + for (i = 0;i < t.NumPort;i++) + { + wchar_t tmp2[MAX_SIZE]; + UniFormat(tmp, sizeof(tmp), _UU("SM_FMINFO_PORT"), i + 1); + UniToStru(tmp2, t.Ports[i]); + CtInsert(ct, tmp, tmp2); + } + + UniToStru(tmp, t.NumFarmHub); + CtInsert(ct, _UU("SM_FMINFO_NUM_HUB"), tmp); + + for (i = 0;i < t.NumFarmHub;i++) + { + wchar_t tmp2[MAX_SIZE]; + UniFormat(tmp, sizeof(tmp), _UU("SM_FMINFO_HUB"), i + 1); + UniFormat(tmp2, sizeof(tmp2), + t.FarmHubs[i].DynamicHub ? _UU("SM_FMINFO_HUB_TAG_2") : _UU("SM_FMINFO_HUB_TAG_1"), + t.FarmHubs[i].HubName); + CtInsert(ct, tmp, tmp2); + } + + UniToStru(tmp, t.NumSessions); + CtInsert(ct, _UU("SM_FMINFO_NUM_SESSION"), tmp); + + UniToStru(tmp, t.NumTcpConnections); + CtInsert(ct, _UU("SM_FMINFO_NUN_CONNECTION"), tmp); + } + + CtFree(ct, c); + + FreeRpcFarmInfo(&t); + + FreeParamValueList(o); + + return 0; +} + +// Get certificates of cluster members +UINT PsClusterMemberCertGet(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) +{ + LIST *o; + PS *ps = (PS *)param; + UINT ret = 0; + RPC_FARM_INFO t; + // Parameter list that can be specified + PARAM args[] = + { + // "name", prompt_proc, prompt_param, eval_proc, eval_param + {"[id]", CmdPrompt, _UU("CMD_ClusterMemberCertGet_PROMPT_ID"), NULL, NULL}, + {"SAVECERT", CmdPrompt, _UU("CMD_SAVECERTPATH"), CmdEvalNotEmpty, NULL}, + }; + + o = ParseCommandList(c, cmd_name, str, args, sizeof(args) / sizeof(args[0])); + if (o == NULL) + { + return ERR_INVALID_PARAMETER; + } + + Zero(&t, sizeof(t)); + + t.Id = UniToInt(GetParamUniStr(o, "[id]")); + + // RPC call + ret = ScGetFarmInfo(ps->Rpc, &t); + + if (ret != ERR_NO_ERROR) + { + // An error has occured + CmdPrintError(c, ret); + FreeParamValueList(o); + return ret; + } + else + { + X *x = t.ServerCert; + wchar_t *filename = GetParamUniStr(o, "SAVECERT"); + + if (XToFileW(x, filename, true) == false) + { + c->Write(c, _UU("CMD_SAVECERT_FAILED")); + + ret = ERR_INTERNAL_ERROR; + } + } + + FreeRpcFarmInfo(&t); + + FreeParamValueList(o); + + return ret; +} + +// Get the status of the connection to the cluster controller +UINT PsClusterConnectionStatusGet(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) +{ + LIST *o; + PS *ps = (PS *)param; + UINT ret = 0; + RPC_FARM_CONNECTION_STATUS t; + wchar_t tmp[MAX_SIZE]; + + o = ParseCommandList(c, cmd_name, str, NULL, 0); + if (o == NULL) + { + return ERR_INVALID_PARAMETER; + } + + Zero(&t, sizeof(t)); + + // RPC call + ret = ScGetFarmConnectionStatus(ps->Rpc, &t); + + if (ret != ERR_NO_ERROR) + { + // An error has occured + CmdPrintError(c, ret); + FreeParamValueList(o); + return ret; + } + else + { + CT *ct = CtNewStandard(); + char str[MAX_SIZE]; + + if (t.Online == false) + { + CtInsert(ct, _UU("SM_FC_IP"), _UU("SM_FC_NOT_CONNECTED")); + + CtInsert(ct, _UU("SM_FC_PORT"), _UU("SM_FC_NOT_CONNECTED")); + } + else + { + IPToStr32(str, sizeof(str), t.Ip); + StrToUni(tmp, sizeof(tmp), str); + CtInsert(ct, _UU("SM_FC_IP"), tmp); + + UniToStru(tmp, t.Port); + CtInsert(ct, _UU("SM_FC_PORT"), tmp); + } + + CtInsert(ct, + _UU("SM_FC_STATUS"), + t.Online ? _UU("SM_FC_ONLINE") : _UU("SM_FC_OFFLINE")); + + if (t.Online == false) + { + UniFormat(tmp, sizeof(tmp), _UU("SM_FC_ERROR_TAG"), _E(t.LastError), t.LastError); + CtInsert(ct, + _UU("SM_FC_LAST_ERROR"), tmp); + } + + GetDateTimeStrEx64(tmp, sizeof(tmp), SystemToLocal64(t.StartedTime), NULL); + CtInsert(ct, _UU("SM_FC_START_TIME"), tmp); + + GetDateTimeStrEx64(tmp, sizeof(tmp), SystemToLocal64(t.FirstConnectedTime), NULL); + CtInsert(ct, _UU("SM_FC_FIRST_TIME"), tmp); + + //if (t.Online == false) + { + GetDateTimeStrEx64(tmp, sizeof(tmp), SystemToLocal64(t.CurrentConnectedTime), NULL); + CtInsert(ct, _UU("SM_FC_CURRENT_TIME"), tmp); + } + + UniToStru(tmp, t.NumTry); + CtInsert(ct, _UU("SM_FC_NUM_TRY"), tmp); + + UniToStru(tmp, t.NumConnected); + CtInsert(ct, _UU("SM_FC_NUM_CONNECTED"), tmp); + + UniToStru(tmp, t.NumFailed); + CtInsert(ct, _UU("SM_FC_NUM_FAILED"), tmp); + + CtFree(ct, c); + } + + FreeParamValueList(o); + + return 0; +} + +// Get the SSL certificate of the VPN Server +UINT PsServerCertGet(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) +{ + LIST *o; + PS *ps = (PS *)param; + UINT ret = 0; + RPC_KEY_PAIR t; + // Parameter list that can be specified + PARAM args[] = + { + {"[cert]", CmdPrompt, _UU("CMD_SAVECERTPATH"), CmdEvalNotEmpty, NULL}, + }; + + o = ParseCommandList(c, cmd_name, str, args, sizeof(args) / sizeof(args[0])); + if (o == NULL) + { + return ERR_INVALID_PARAMETER; + } + + Zero(&t, sizeof(t)); + + // RPC call + ret = ScGetServerCert(ps->Rpc, &t); + + if (ret != ERR_NO_ERROR) + { + // An error has occured + CmdPrintError(c, ret); + FreeParamValueList(o); + return ret; + } + + if (XToFileW(t.Cert, GetParamUniStr(o, "[cert]"), true) == false) + { + c->Write(c, _UU("CMD_SAVECERT_FAILED")); + } + + FreeRpcKeyPair(&t); + + FreeParamValueList(o); + + return 0; +} + +// Get the private key of the SSL certificate of the VPN Server +UINT PsServerKeyGet(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) +{ + LIST *o; + PS *ps = (PS *)param; + UINT ret = 0; + RPC_KEY_PAIR t; + // Parameter list that can be specified + PARAM args[] = + { + {"[key]", CmdPrompt, _UU("CMD_SAVEKEYPATH"), CmdEvalNotEmpty, NULL}, + }; + + o = ParseCommandList(c, cmd_name, str, args, sizeof(args) / sizeof(args[0])); + if (o == NULL) + { + return ERR_INVALID_PARAMETER; + } + + Zero(&t, sizeof(t)); + + // RPC call + ret = ScGetServerCert(ps->Rpc, &t); + + if (ret != ERR_NO_ERROR) + { + // An error has occured + CmdPrintError(c, ret); + FreeParamValueList(o); + return ret; + } + + if (t.Key != NULL) + { + if (KToFileW(t.Key, GetParamUniStr(o, "[key]"), true, NULL) == false) + { + c->Write(c, _UU("CMD_SAVEKEY_FAILED")); + } + } + else + { + ret = ERR_NOT_ENOUGH_RIGHT; + CmdPrintError(c, ret); + } + + FreeRpcKeyPair(&t); + + FreeParamValueList(o); + + return ret; +} + +// Read the certificate and the private key +bool CmdLoadCertAndKey(CONSOLE *c, X **xx, K **kk, wchar_t *cert_filename, wchar_t *key_filename) +{ + X *x; + K *k; + // Validate arguments + if (c == NULL || cert_filename == NULL || key_filename == NULL || xx == NULL || kk == NULL) + { + return false; + } + + x = FileToXW(cert_filename); + if (x == NULL) + { + c->Write(c, _UU("CMD_LOADCERT_FAILED")); + return false; + } + + k = CmdLoadKey(c, key_filename); + if (k == NULL) + { + c->Write(c, _UU("CMD_LOADKEY_FAILED")); + FreeX(x); + return false; + } + + if (CheckXandK(x, k) == false) + { + c->Write(c, _UU("CMD_KEYPAIR_FAILED")); + FreeX(x); + FreeK(k); + + return false; + } + + *xx = x; + *kk = k; + + return true; +} + +// Read the secret key +K *CmdLoadKey(CONSOLE *c, wchar_t *filename) +{ + BUF *b; + // Validate arguments + if (c == NULL || filename == NULL) + { + return NULL; + } + + b = ReadDumpW(filename); + if (b == NULL) + { + c->Write(c, _UU("CMD_LOADCERT_FAILED")); + return NULL; + } + else + { + K *key; + if (IsEncryptedK(b, true) == false) + { + key = BufToK(b, true, IsBase64(b), NULL); + } + else + { + c->Write(c, _UU("CMD_LOADKEY_ENCRYPTED_1")); + + while (true) + { + char *pass = c->ReadPassword(c, _UU("CMD_LOADKEY_ENCRYPTED_2")); + + if (pass == NULL) + { + FreeBuf(b); + return NULL; + } + + key = BufToK(b, true, IsBase64(b), pass); + Free(pass); + + if (key != NULL) + { + break; + } + + c->Write(c, _UU("CMD_LOADKEY_ENCRYPTED_3")); + } + } + + FreeBuf(b); + + return key; + } +} + +// Set the SSL certificate and the private key of the VPN Server +UINT PsServerCertSet(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) +{ + LIST *o; + PS *ps = (PS *)param; + UINT ret = 0; + RPC_KEY_PAIR t; + // Parameter list that can be specified + PARAM args[] = + { + // "name", prompt_proc, prompt_param, eval_proc, eval_param + {"LOADCERT", CmdPrompt, _UU("CMD_LOADCERTPATH"), CmdEvalIsFile, NULL}, + {"LOADKEY", CmdPrompt, _UU("CMD_LOADKEYPATH"), CmdEvalIsFile, NULL}, + }; + + o = ParseCommandList(c, cmd_name, str, args, sizeof(args) / sizeof(args[0])); + if (o == NULL) + { + return ERR_INVALID_PARAMETER; + } + + Zero(&t, sizeof(t)); + + if (CmdLoadCertAndKey(c, &t.Cert, &t.Key, + GetParamUniStr(o, "LOADCERT"), + GetParamUniStr(o, "LOADKEY"))) + { + // RPC call + ret = ScSetServerCert(ps->Rpc, &t); + + if (ret != ERR_NO_ERROR) + { + // An error has occured + CmdPrintError(c, ret); + FreeParamValueList(o); + return ret; + } + + if (t.Flag1 == 0) + { + // Show the warning message + c->Write(c, L""); + c->Write(c, _UU("SM_CERT_NEED_ROOT")); + c->Write(c, L""); + } + + FreeRpcKeyPair(&t); + } + else + { + ret = ERR_INTERNAL_ERROR; + } + + FreeParamValueList(o); + + return ret; +} + +// Get the encryption algorithm used for the VPN communication +UINT PsServerCipherGet(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) +{ + LIST *o; + PS *ps = (PS *)param; + UINT ret = 0; + RPC_STR t; + TOKEN_LIST *ciphers; + UINT i; + wchar_t tmp[4096]; + + o = ParseCommandList(c, cmd_name, str, NULL, 0); + if (o == NULL) + { + return ERR_INVALID_PARAMETER; + } + + Zero(&t, sizeof(t)); + + // RPC call + ret = ScGetServerCipher(ps->Rpc, &t); + + if (ret != ERR_NO_ERROR) + { + // An error has occured + CmdPrintError(c, ret); + FreeParamValueList(o); + return ret; + } + + UniFormat(tmp, sizeof(tmp), L" %S", t.String); + FreeRpcStr(&t); + Zero(&t, sizeof(RPC_STR)); + + c->Write(c, _UU("CMD_ServerCipherGet_SERVER")); + c->Write(c, tmp); + + ret = ScGetServerCipherList(ps->Rpc, &t); + + if (ret == ERR_NO_ERROR) + { + ciphers = ParseToken(t.String, ";"); + + FreeRpcStr(&t); + + c->Write(c, L""); + c->Write(c, _UU("CMD_ServerCipherGet_CIPHERS")); + + for (i = 0; i < ciphers->NumTokens; i++) + { + UniFormat(tmp, sizeof(tmp), L" %S", ciphers->Token[i]); + c->Write(c, tmp); + } + + FreeToken(ciphers); + } + + FreeParamValueList(o); + + return 0; +} + +// Set the encryption algorithm used for the VPN communication +UINT PsServerCipherSet(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) +{ + LIST *o; + PS *ps = (PS *)param; + UINT ret = 0; + RPC_STR t; + // Parameter list that can be specified + PARAM args[] = + { + {"[name]", CmdPrompt, _UU("CMD_ServerCipherSet_PROMPT_NAME"), CmdEvalNotEmpty, NULL}, + }; + + o = ParseCommandList(c, cmd_name, str, args, sizeof(args) / sizeof(args[0])); + if (o == NULL) + { + return ERR_INVALID_PARAMETER; + } + + Zero(&t, sizeof(t)); + t.String = CopyStr(GetParamStr(o, "[name]")); + + // RPC call + ret = ScSetServerCipher(ps->Rpc, &t); + + if (ret != ERR_NO_ERROR) + { + // An error has occured + CmdPrintError(c, ret); + FreeParamValueList(o); + return ret; + } + + FreeRpcStr(&t); + + FreeParamValueList(o); + + return 0; +} + +// Enabling the maintenance function of the Internet connection +UINT PsKeepEnable(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) +{ + LIST *o; + PS *ps = (PS *)param; + UINT ret = 0; + RPC_KEEP t; + + o = ParseCommandList(c, cmd_name, str, NULL, 0); + if (o == NULL) + { + return ERR_INVALID_PARAMETER; + } + + Zero(&t, sizeof(t)); + + // RPC call + ret = ScGetKeep(ps->Rpc, &t); + + if (ret != ERR_NO_ERROR) + { + // An error has occured + CmdPrintError(c, ret); + FreeParamValueList(o); + return ret; + } + + t.UseKeepConnect = true; + + ret = ScSetKeep(ps->Rpc, &t); + + if (ret != ERR_NO_ERROR) + { + // An error has occured + CmdPrintError(c, ret); + FreeParamValueList(o); + return ret; + } + + FreeParamValueList(o); + + return 0; +} + +// Disabling the maintenance function of the Internet connection +UINT PsKeepDisable(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) +{ + LIST *o; + PS *ps = (PS *)param; + UINT ret = 0; + RPC_KEEP t; + + o = ParseCommandList(c, cmd_name, str, NULL, 0); + if (o == NULL) + { + return ERR_INVALID_PARAMETER; + } + + Zero(&t, sizeof(t)); + + // RPC call + ret = ScGetKeep(ps->Rpc, &t); + + if (ret != ERR_NO_ERROR) + { + // An error has occured + CmdPrintError(c, ret); + FreeParamValueList(o); + return ret; + } + + t.UseKeepConnect = false; + + ret = ScSetKeep(ps->Rpc, &t); + + if (ret != ERR_NO_ERROR) + { + // An error has occured + CmdPrintError(c, ret); + FreeParamValueList(o); + return ret; + } + + FreeParamValueList(o); + + return 0; +} + +// Evaluate the UDP or the TCP +bool CmdEvalTcpOrUdp(CONSOLE *c, wchar_t *str, void *param) +{ + // Validate arguments + if (c == NULL || str == NULL) + { + return false; + } + + if (UniStrCmpi(str, L"tcp") == 0 || UniStrCmpi(str, L"udp") == 0) + { + return true; + } + + c->Write(c, _UU("CMD_KeepSet_EVAL_TCP_UDP")); + + return false; +} + +// Enable the syslog configuration +UINT PsSyslogEnable(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) +{ + LIST *o; + PS *ps = (PS *)param; + UINT ret = 0; + SYSLOG_SETTING t; + CMD_EVAL_MIN_MAX minmax = {"CMD_SyslogEnable_MINMAX", 1, 3}; + char *host; + UINT port; + + // Parameter list that can be specified + PARAM args[] = + { + // "name", prompt_proc, prompt_param, eval_proc, eval_param + {"[1|2|3]", CmdPrompt, _UU("CMD_SyslogEnable_Prompt_123"), CmdEvalMinMax, &minmax}, + {"HOST", CmdPrompt, _UU("CMD_SyslogEnable_Prompt_HOST"), CmdEvalHostAndPort, (void *)SYSLOG_PORT}, + }; + + o = ParseCommandList(c, cmd_name, str, args, sizeof(args) / sizeof(args[0])); + if (o == NULL) + { + return ERR_INVALID_PARAMETER; + } + + Zero(&t, sizeof(t)); + + if (ParseHostPort(GetParamStr(o, "HOST"), &host, &port, SYSLOG_PORT)) + { + StrCpy(t.Hostname, sizeof(t.Hostname), host); + t.Port = port; + t.SaveType = GetParamInt(o, "[1|2|3]"); + + Free(host); + + // RPC call + ret = ScSetSysLog(ps->Rpc, &t); + + if (ret != ERR_NO_ERROR) + { + // An error has occured + CmdPrintError(c, ret); + FreeParamValueList(o); + return ret; + } + } + + FreeParamValueList(o); + + return 0; +} + +// Disable the syslog configuration +UINT PsSyslogDisable(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) +{ + LIST *o; + PS *ps = (PS *)param; + UINT ret = 0; + SYSLOG_SETTING t; + + o = ParseCommandList(c, cmd_name, str, NULL, 0); + if (o == NULL) + { + return ERR_INVALID_PARAMETER; + } + + Zero(&t, sizeof(t)); + + // RPC call + ret = ScGetSysLog(ps->Rpc, &t); + + if (ret != ERR_NO_ERROR) + { + // An error has occured + CmdPrintError(c, ret); + FreeParamValueList(o); + return ret; + } + + t.SaveType = SYSLOG_NONE; + + // RPC call + ret = ScSetSysLog(ps->Rpc, &t); + + if (ret != ERR_NO_ERROR) + { + // An error has occured + CmdPrintError(c, ret); + FreeParamValueList(o); + return ret; + } + + FreeParamValueList(o); + + return 0; +} + +// Get the syslog configuration +UINT PsSyslogGet(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) +{ + LIST *o; + PS *ps = (PS *)param; + UINT ret = 0; + SYSLOG_SETTING t; + + o = ParseCommandList(c, cmd_name, str, NULL, 0); + if (o == NULL) + { + return ERR_INVALID_PARAMETER; + } + + Zero(&t, sizeof(t)); + + // RPC call + ret = ScGetSysLog(ps->Rpc, &t); + + if (ret != ERR_NO_ERROR) + { + // An error has occured + CmdPrintError(c, ret); + FreeParamValueList(o); + return ret; + } + else + { + wchar_t tmp[MAX_SIZE]; + CT *ct = CtNewStandard(); + + CtInsert(ct, _UU("CMD_SyslogGet_COLUMN_1"), GetSyslogSettingName(t.SaveType)); + + if (t.SaveType != SYSLOG_NONE) + { + StrToUni(tmp, sizeof(tmp), t.Hostname); + CtInsert(ct, _UU("CMD_SyslogGet_COLUMN_2"), tmp); + + UniToStru(tmp, t.Port); + CtInsert(ct, _UU("CMD_SyslogGet_COLUMN_3"), tmp); + } + + CtFree(ct, c); + } + + FreeParamValueList(o); + + return 0; +} + +// Get the syslog configuration name +wchar_t *GetSyslogSettingName(UINT n) +{ + char tmp[MAX_PATH]; + + Format(tmp, sizeof(tmp), "SM_SYSLOG_%u", n); + + return _UU(tmp); +} + +// Setting of maintenance function of the Internet connection +UINT PsKeepSet(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) +{ + LIST *o; + PS *ps = (PS *)param; + UINT ret = 0; + RPC_KEEP t; + char *host; + UINT port; + // Parameter list that can be specified + PARAM args[] = + { + // "name", prompt_proc, prompt_param, eval_proc, eval_param + {"HOST", CmdPrompt, _UU("CMD_KeepSet_PROMPT_HOST"), CmdEvalHostAndPort, NULL}, + {"PROTOCOL", CmdPrompt, _UU("CMD_KeepSet_PROMPT_PROTOCOL"), CmdEvalTcpOrUdp, NULL}, + {"INTERVAL", CmdPrompt, _UU("CMD_KeepSet_PROMPT_INTERVAL"), NULL, NULL}, + }; + + o = ParseCommandList(c, cmd_name, str, args, sizeof(args) / sizeof(args[0])); + if (o == NULL) + { + return ERR_INVALID_PARAMETER; + } + + Zero(&t, sizeof(t)); + + // RPC call + ret = ScGetKeep(ps->Rpc, &t); + + if (ret != ERR_NO_ERROR) + { + // An error has occured + CmdPrintError(c, ret); + FreeParamValueList(o); + return ret; + } + + if (ParseHostPort(GetParamStr(o, "HOST"), &host, &port, 0)) + { + StrCpy(t.KeepConnectHost, sizeof(t.KeepConnectHost), host); + t.KeepConnectPort = port; + t.KeepConnectInterval = GetParamInt(o, "INTERVAL"); + t.KeepConnectProtocol = (StrCmpi(GetParamStr(o, "PROTOCOL"), "tcp") == 0) ? 0 : 1; + Free(host); + + // RPC call + ret = ScSetKeep(ps->Rpc, &t); + + if (ret != ERR_NO_ERROR) + { + // An error has occured + CmdPrintError(c, ret); + FreeParamValueList(o); + return ret; + } + } + + FreeParamValueList(o); + + return 0; +} + +// Get the maintenance function of the Internet connection +UINT PsKeepGet(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) +{ + LIST *o; + PS *ps = (PS *)param; + UINT ret = 0; + RPC_KEEP t; + + o = ParseCommandList(c, cmd_name, str, NULL, 0); + if (o == NULL) + { + return ERR_INVALID_PARAMETER; + } + + Zero(&t, sizeof(t)); + + // RPC call + ret = ScGetKeep(ps->Rpc, &t); + + if (ret != ERR_NO_ERROR) + { + // An error has occured + CmdPrintError(c, ret); + FreeParamValueList(o); + return ret; + } + else + { + wchar_t tmp[MAX_SIZE]; + CT *ct = CtNewStandard(); + + StrToUni(tmp, sizeof(tmp), t.KeepConnectHost); + CtInsert(ct, _UU("CMD_KeepGet_COLUMN_1"), tmp); + + UniToStru(tmp, t.KeepConnectPort); + CtInsert(ct, _UU("CMD_KeepGet_COLUMN_2"), tmp); + + UniToStru(tmp, t.KeepConnectInterval); + CtInsert(ct, _UU("CMD_KeepGet_COLUMN_3"), tmp); + + CtInsert(ct, _UU("CMD_KeepGet_COLUMN_4"), + t.KeepConnectProtocol == 0 ? L"TCP/IP" : L"UDP/IP"); + + CtInsert(ct, _UU("CMD_KeepGet_COLUMN_5"), + t.UseKeepConnect ? _UU("SM_ACCESS_ENABLE") : _UU("SM_ACCESS_DISABLE")); + + CtFree(ct, c); + } + + FreeParamValueList(o); + + return 0; +} + +// Get the connection type string +wchar_t *GetConnectionTypeStr(UINT type) +{ + char tmp[MAX_SIZE]; + Format(tmp, sizeof(tmp), "SM_CONNECTION_TYPE_%u", type); + + return _UU(tmp); +} + +// Get the list of TCP connections connected to VPN Server +UINT PsConnectionList(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) +{ + LIST *o; + PS *ps = (PS *)param; + UINT ret = 0; + RPC_ENUM_CONNECTION t; + UINT i; + CT *ct; + + o = ParseCommandList(c, cmd_name, str, NULL, 0); + if (o == NULL) + { + return ERR_INVALID_PARAMETER; + } + + Zero(&t, sizeof(t)); + + // RPC call + ret = ScEnumConnection(ps->Rpc, &t); + + if (ret != ERR_NO_ERROR) + { + // An error has occured + CmdPrintError(c, ret); + FreeParamValueList(o); + return ret; + } + + ct = CtNew(); + CtInsertColumn(ct, _UU("SM_CONN_COLUMN_1"), false); + CtInsertColumn(ct, _UU("SM_CONN_COLUMN_2"), false); + CtInsertColumn(ct, _UU("SM_CONN_COLUMN_3"), false); + CtInsertColumn(ct, _UU("SM_CONN_COLUMN_4"), false); + + for (i = 0;i < t.NumConnection;i++) + { + wchar_t tmp[MAX_SIZE]; + wchar_t name[MAX_SIZE]; + wchar_t datetime[MAX_SIZE]; + RPC_ENUM_CONNECTION_ITEM *e = &t.Connections[i]; + + StrToUni(name, sizeof(name), e->Name); + UniFormat(tmp, sizeof(tmp), _UU("SM_HOSTNAME_AND_PORT"), e->Hostname, e->Port); + GetDateTimeStrEx64(datetime, sizeof(datetime), SystemToLocal64(e->ConnectedTime), NULL); + + CtInsert(ct, name, tmp, datetime, + GetConnectionTypeStr(e->Type)); + } + + CtFree(ct, c); + + FreeRpcEnumConnection(&t); + + FreeParamValueList(o); + + return 0; +} + +// Get the TCP connection information currently connected to the VPN Server +UINT PsConnectionGet(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) +{ + LIST *o; + PS *ps = (PS *)param; + UINT ret = 0; + RPC_CONNECTION_INFO t; + CT *ct; + wchar_t tmp[MAX_SIZE]; + // Parameter list that can be specified + PARAM args[] = + { + {"[name]", CmdPrompt, _UU("CMD_ConnectionGet_PROMPT_NAME"), CmdEvalNotEmpty, NULL}, + }; + + o = ParseCommandList(c, cmd_name, str, args, sizeof(args) / sizeof(args[0])); + if (o == NULL) + { + return ERR_INVALID_PARAMETER; + } + + Zero(&t, sizeof(t)); + + StrCpy(t.Name, sizeof(t.Name), GetParamStr(o, "[name]")); + + // RPC call + ret = ScGetConnectionInfo(ps->Rpc, &t); + + if (ret != ERR_NO_ERROR) + { + // An error has occured + CmdPrintError(c, ret); + FreeParamValueList(o); + return ret; + } + else + { + ct = CtNewStandard(); + + StrToUni(tmp, sizeof(tmp), t.Name); + CtInsert(ct, _UU("SM_CONNINFO_NAME"), tmp); + + CtInsert(ct, _UU("SM_CONNINFO_TYPE"), GetConnectionTypeStr(t.Type)); + + StrToUni(tmp, sizeof(tmp), t.Hostname); + CtInsert(ct, _UU("SM_CONNINFO_HOSTNAME"), tmp); + + UniToStru(tmp, t.Port); + CtInsert(ct, _UU("SM_CONNINFO_PORT"), tmp); + + GetDateTimeStrEx64(tmp, sizeof(tmp), SystemToLocal64(t.ConnectedTime), NULL); + CtInsert(ct, _UU("SM_CONNINFO_TIME"), tmp); + + StrToUni(tmp, sizeof(tmp), t.ServerStr); + CtInsert(ct, _UU("SM_CONNINFO_SERVER_STR"), tmp); + + UniFormat(tmp, sizeof(tmp), L"%u.%02u", t.ServerVer / 100, t.ServerVer % 100); + CtInsert(ct, _UU("SM_CONNINFO_SERVER_VER"), tmp); + + UniToStru(tmp, t.ServerBuild); + CtInsert(ct, _UU("SM_CONNINFO_SERVER_BUILD"), tmp); + + if (StrLen(t.ClientStr) != 0) + { + StrToUni(tmp, sizeof(tmp), t.ClientStr); + CtInsert(ct, _UU("SM_CONNINFO_CLIENT_STR"), tmp); + + UniFormat(tmp, sizeof(tmp), L"%u.%02u", t.ClientVer / 100, t.ClientVer % 100); + CtInsert(ct, _UU("SM_CONNINFO_CLIENT_VER"), tmp); + + UniToStru(tmp, t.ClientBuild); + CtInsert(ct, _UU("SM_CONNINFO_CLIENT_BUILD"), tmp); + } + + CtFree(ct, c); + } + + FreeParamValueList(o); + + return 0; +} + +// Disconnect the TCP connection connected to the VPN Server +UINT PsConnectionDisconnect(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) +{ + LIST *o; + PS *ps = (PS *)param; + UINT ret = 0; + RPC_DISCONNECT_CONNECTION t; + // Parameter list that can be specified + PARAM args[] = + { + {"[name]", CmdPrompt, _UU("CMD_ConnectionDisconnect_PROMPT_NAME"), CmdEvalNotEmpty, NULL}, + }; + + o = ParseCommandList(c, cmd_name, str, args, sizeof(args) / sizeof(args[0])); + if (o == NULL) + { + return ERR_INVALID_PARAMETER; + } + + Zero(&t, sizeof(t)); + + StrCpy(t.Name, sizeof(t.Name), GetParamStr(o, "[name]")); + + // RPC call + ret = ScDisconnectConnection(ps->Rpc, &t); + + if (ret != ERR_NO_ERROR) + { + // An error has occured + CmdPrintError(c, ret); + FreeParamValueList(o); + return ret; + } + + FreeParamValueList(o); + + return 0; +} + +// Get the LAN card list that can be used for local bridge +UINT PsBridgeDeviceList(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) +{ + LIST *o; + PS *ps = (PS *)param; + UINT ret = 0; + RPC_ENUM_ETH t; + UINT i; + + o = ParseCommandList(c, cmd_name, str, NULL, 0); + if (o == NULL) + { + return ERR_INVALID_PARAMETER; + } + + Zero(&t, sizeof(t)); + + // RPC call + ret = ScEnumEthernet(ps->Rpc, &t); + + if (ret != ERR_NO_ERROR) + { + // An error has occured + CmdPrintError(c, ret); + FreeParamValueList(o); + return ret; + } + + for (i = 0;i < t.NumItem;i++) + { + RPC_ENUM_ETH_ITEM *item = &t.Items[i]; + wchar_t tmp[MAX_SIZE * 2]; + + StrToUni(tmp, sizeof(tmp), item->DeviceName); + c->Write(c, tmp); + } + + FreeRpcEnumEth(&t); + + FreeParamValueList(o); + + return 0; +} + +// Get the list of local bridge connection +UINT PsBridgeList(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) +{ + LIST *o; + PS *ps = (PS *)param; + UINT ret = 0; + RPC_ENUM_LOCALBRIDGE t; + UINT i; + CT *ct; + + o = ParseCommandList(c, cmd_name, str, NULL, 0); + if (o == NULL) + { + return ERR_INVALID_PARAMETER; + } + + Zero(&t, sizeof(t)); + + // RPC call + ret = ScEnumLocalBridge(ps->Rpc, &t); + + if (ret != ERR_NO_ERROR) + { + // An error has occured + CmdPrintError(c, ret); + FreeParamValueList(o); + return ret; + } + + ct = CtNew(); + + CtInsertColumn(ct, _UU("SM_BRIDGE_COLUMN_1"), false); + CtInsertColumn(ct, _UU("SM_BRIDGE_COLUMN_2"), false); + CtInsertColumn(ct, _UU("SM_BRIDGE_COLUMN_3"), false); + CtInsertColumn(ct, _UU("SM_BRIDGE_COLUMN_4"), false); + + for (i = 0;i < t.NumItem;i++) + { + RPC_LOCALBRIDGE *e = &t.Items[i]; + wchar_t name[MAX_SIZE]; + wchar_t nic[MAX_SIZE]; + wchar_t hub[MAX_SIZE]; + wchar_t *status = _UU("SM_BRIDGE_OFFLINE"); + + UniToStru(name, i + 1); + StrToUni(nic, sizeof(nic), e->DeviceName); + StrToUni(hub, sizeof(hub), e->HubName); + + if (e->Online) + { + status = e->Active ? _UU("SM_BRIDGE_ONLINE") : _UU("SM_BRIDGE_ERROR"); + } + + CtInsert(ct, name, hub, nic, status); + } + + CtFree(ct, c); + + FreeRpcEnumLocalBridge(&t); + + FreeParamValueList(o); + + return 0; +} + +// Create a local bridge connection +UINT PsBridgeCreate(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) +{ + LIST *o; + PS *ps = (PS *)param; + UINT ret = 0; + RPC_LOCALBRIDGE t; + // Parameter list that can be specified + PARAM args[] = + { + // "name", prompt_proc, prompt_param, eval_proc, eval_param + {"[hubname]", CmdPrompt, _UU("CMD_BridgeCreate_PROMPT_HUBNAME"), CmdEvalNotEmpty, NULL}, + {"DEVICE", CmdPrompt, _UU("CMD_BridgeCreate_PROMPT_DEVICE"), CmdEvalNotEmpty, NULL}, + {"TAP", NULL, NULL, NULL, NULL}, + }; + + o = ParseCommandList(c, cmd_name, str, args, sizeof(args) / sizeof(args[0])); + if (o == NULL) + { + return ERR_INVALID_PARAMETER; + } + + Zero(&t, sizeof(t)); + + t.Active = true; + StrCpy(t.DeviceName, sizeof(t.DeviceName), GetParamStr(o, "DEVICE")); + StrCpy(t.HubName, sizeof(t.HubName), GetParamStr(o, "[hubname]")); + t.Online = true; + t.TapMode = GetParamYes(o, "TAP"); + + // RPC call + ret = ScAddLocalBridge(ps->Rpc, &t); + + if (ret != ERR_NO_ERROR) + { + // An error has occured + CmdPrintError(c, ret); + FreeParamValueList(o); + return ret; + } + else + { + c->Write(c, _UU("SM_BRIDGE_INTEL")); + c->Write(c, L""); + + if (GetCapsBool(ps->CapsList, "b_is_in_vm")) + { + // Message in the case of operating in a VM + c->Write(c, _UU("D_SM_VMBRIDGE@CAPTION")); + c->Write(c, _UU("D_SM_VMBRIDGE@S_1")); + c->Write(c, _UU("D_SM_VMBRIDGE@S_2")); + c->Write(c, L""); + } + } + + FreeParamValueList(o); + + return 0; +} + +// Delete the local bridge connection +UINT PsBridgeDelete(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) +{ + LIST *o; + PS *ps = (PS *)param; + UINT ret = 0; + RPC_LOCALBRIDGE t; + // Parameter list that can be specified + PARAM args[] = + { + // "name", prompt_proc, prompt_param, eval_proc, eval_param + {"[hubname]", CmdPrompt, _UU("CMD_BridgeDelete_PROMPT_HUBNAME"), CmdEvalNotEmpty, NULL}, + {"DEVICE", CmdPrompt, _UU("CMD_BridgeDelete_PROMPT_DEVICE"), CmdEvalNotEmpty, NULL}, + }; + + o = ParseCommandList(c, cmd_name, str, args, sizeof(args) / sizeof(args[0])); + if (o == NULL) + { + return ERR_INVALID_PARAMETER; + } + + Zero(&t, sizeof(t)); + + StrCpy(t.DeviceName, sizeof(t.DeviceName), GetParamStr(o, "DEVICE")); + StrCpy(t.HubName, sizeof(t.HubName), GetParamStr(o, "[hubname]")); + + // RPC call + ret = ScDeleteLocalBridge(ps->Rpc, &t); + + if (ret != ERR_NO_ERROR) + { + // An error has occured + CmdPrintError(c, ret); + FreeParamValueList(o); + return ret; + } + + FreeParamValueList(o); + + return 0; +} + +// Get the list of features and capabilities of the server +UINT PsCaps(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) +{ + LIST *o; + PS *ps = (PS *)param; + CAPSLIST *t; + UINT i; + CT *ct; + + + o = ParseCommandList(c, cmd_name, str, NULL, 0); + if (o == NULL) + { + return ERR_INVALID_PARAMETER; + } + + // RPC call + t = ScGetCapsEx(ps->Rpc); + + ct = CtNewStandard(); + + for (i = 0;i < LIST_NUM(t->CapsList);i++) + { + CAPS *c = LIST_DATA(t->CapsList, i); + wchar_t title[MAX_SIZE]; + char name[256]; + + Format(name, sizeof(name), "CT_%s", c->Name); + + UniStrCpy(title, sizeof(title), _UU(name)); + + if (UniIsEmptyStr(title)) + { + UniFormat(title, sizeof(title), L"%S", (StrLen(c->Name) >= 2) ? c->Name + 2 : c->Name); + } + + if (StartWith(c->Name, "b_")) + { + bool icon_pass = c->Value == 0 ? false : true; + if (StrCmpi(c->Name, "b_must_install_pcap") == 0) + { + // Reverse only item of WinPcap + icon_pass = !icon_pass; + } + CtInsert(ct, title, c->Value == 0 ? _UU("CAPS_NO") : _UU("CAPS_YES")); + } + else + { + wchar_t str[64]; + UniToStru(str, c->Value); + CtInsert(ct, title, str); + } + } + + CtFree(ct, c); + + FreeCapsList(t); + + FreeParamValueList(o); + + return 0; +} + +// Restart the VPN Server service +UINT PsReboot(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) +{ + LIST *o; + PS *ps = (PS *)param; + UINT ret = 0; + RPC_TEST t; + // Parameter list that can be specified + PARAM args[] = + { + {"RESETCONFIG", NULL, NULL, NULL, NULL}, + }; + + o = ParseCommandList(c, cmd_name, str, args, sizeof(args) / sizeof(args[0])); + if (o == NULL) + { + return ERR_INVALID_PARAMETER; + } + + Zero(&t, sizeof(t)); + + t.IntValue = GetParamYes(o, "RESETCONFIG") ? 1 : 0; + + // RPC call + ret = ScRebootServer(ps->Rpc, &t); + + if (ret != ERR_NO_ERROR) + { + // An error has occured + CmdPrintError(c, ret); + FreeParamValueList(o); + return ret; + } + + FreeRpcTest(&t); + + FreeParamValueList(o); + + return 0; +} + +// Get the current configuration of the VPN Server +UINT PsConfigGet(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) +{ + LIST *o; + PS *ps = (PS *)param; + UINT ret = 0; + RPC_CONFIG t; + // Parameter list that can be specified + PARAM args[] = + { + // "name", prompt_proc, prompt_param, eval_proc, eval_param + {"[path]", NULL, NULL, NULL, NULL}, + }; + + o = ParseCommandList(c, cmd_name, str, args, sizeof(args) / sizeof(args[0])); + if (o == NULL) + { + return ERR_INVALID_PARAMETER; + } + + Zero(&t, sizeof(t)); + + // RPC call + ret = ScGetConfig(ps->Rpc, &t); + + if (ret != ERR_NO_ERROR) + { + // An error has occured + CmdPrintError(c, ret); + FreeParamValueList(o); + return ret; + } + else + { + wchar_t *filename = GetParamUniStr(o, "[path]"); + + if (IsEmptyUniStr(filename)) + { + // Display on the screen + wchar_t tmp[MAX_SIZE]; + UINT buf_size; + wchar_t *buf; + UNI_TOKEN_LIST *lines; + + UniFormat(tmp, sizeof(tmp), _UU("CMD_ConfigGet_FILENAME"), t.FileName, + StrLen(t.FileData)); + c->Write(c, tmp); + c->Write(c, L""); + + buf_size = CalcUtf8ToUni((BYTE *)t.FileData, StrLen(t.FileData)); + buf = ZeroMalloc(buf_size + 32); + + Utf8ToUni(buf, buf_size, (BYTE *)t.FileData, StrLen(t.FileData)); + + lines = UniGetLines(buf); + if (lines != NULL) + { + UINT i; + + for (i = 0;i < lines->NumTokens;i++) + { + c->Write(c, lines->Token[i]); + } + + UniFreeToken(lines); + } + + c->Write(c, L""); + + Free(buf); + } + else + { + // Save to the file + IO *io = FileCreateW(filename); + + if (io == NULL) + { + c->Write(c, _UU("CMD_ConfigGet_FILE_SAVE_FAILED")); + + ret = ERR_INTERNAL_ERROR; + } + else + { + FileWrite(io, t.FileData, StrLen(t.FileData)); + FileClose(io); + } + } + } + + FreeRpcConfig(&t); + + FreeParamValueList(o); + + return ret; +} + +// Write the configuration to the VPN Server +UINT PsConfigSet(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) +{ + LIST *o; + PS *ps = (PS *)param; + UINT ret = 0; + RPC_CONFIG t; + wchar_t *filename; + BUF *buf; + // Parameter list that can be specified + PARAM args[] = + { + // "name", prompt_proc, prompt_param, eval_proc, eval_param + {"[path]", CmdPrompt, _UU("CMD_ConfigSet_PROMPT_PATH"), CmdEvalIsFile, NULL}, + }; + + o = ParseCommandList(c, cmd_name, str, args, sizeof(args) / sizeof(args[0])); + if (o == NULL) + { + return ERR_INVALID_PARAMETER; + } + + filename = GetParamUniStr(o, "[path]"); + + buf = ReadDumpW(filename); + if (buf == NULL) + { + c->Write(c, _UU("CMD_ConfigSet_FILE_LOAD_FAILED")); + } + else + { + Zero(&t, sizeof(t)); + + t.FileData = ZeroMalloc(buf->Size + 1); + Copy(t.FileData, buf->Buf, buf->Size); + FreeBuf(buf); + + // RPC call + ret = ScSetConfig(ps->Rpc, &t); + + if (ret != ERR_NO_ERROR) + { + // An error has occured + CmdPrintError(c, ret); + FreeParamValueList(o); + return ret; + } + + FreeRpcConfig(&t); + } + + FreeParamValueList(o); + + return 0; +} + +// Get the Virtual Layer 3 switch list +UINT PsRouterList(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) +{ + LIST *o; + PS *ps = (PS *)param; + UINT ret = 0; + RPC_ENUM_L3SW t; + + o = ParseCommandList(c, cmd_name, str, NULL, 0); + if (o == NULL) + { + return ERR_INVALID_PARAMETER; + } + + Zero(&t, sizeof(t)); + + // RPC call + ret = ScEnumL3Switch(ps->Rpc, &t); + + if (ret != ERR_NO_ERROR) + { + // An error has occured + CmdPrintError(c, ret); + FreeParamValueList(o); + return ret; + } + else + { + CT *ct = CtNew(); + UINT i; + + CtInsertColumn(ct, _UU("SM_L3_SW_COLUMN1"), false); + CtInsertColumn(ct, _UU("SM_L3_SW_COLUMN2"), false); + CtInsertColumn(ct, _UU("SM_L3_SW_COLUMN3"), true); + CtInsertColumn(ct, _UU("SM_L3_SW_COLUMN4"), true); + + for (i = 0;i < t.NumItem;i++) + { + RPC_ENUM_L3SW_ITEM *e = &t.Items[i]; + wchar_t tmp1[MAX_SIZE], *tmp2, tmp3[64], tmp4[64]; + + StrToUni(tmp1, sizeof(tmp1), e->Name); + if (e->Active == false) + { + tmp2 = _UU("SM_L3_SW_ST_F_F"); + } + else if (e->Online == false) + { + tmp2 = _UU("SM_L3_SW_ST_T_F"); + } + else + { + tmp2 = _UU("SM_L3_SW_ST_T_T"); + } + UniToStru(tmp3, e->NumInterfaces); + UniToStru(tmp4, e->NumTables); + + CtInsert(ct, + tmp1, tmp2, tmp3, tmp4); + } + + CtFree(ct, c); + } + + FreeRpcEnumL3Sw(&t); + + FreeParamValueList(o); + + return 0; +} + +// Define a new virtual layer 3 switch +UINT PsRouterAdd(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) +{ + LIST *o; + PS *ps = (PS *)param; + UINT ret = 0; + RPC_L3SW t; + // Parameter list that can be specified + PARAM args[] = + { + // "name", prompt_proc, prompt_param, eval_proc, eval_param + {"[name]", CmdPrompt, _UU("CMD_RouterAdd_PROMPT_NAME"), CmdEvalNotEmpty, NULL}, + }; + + o = ParseCommandList(c, cmd_name, str, args, sizeof(args) / sizeof(args[0])); + if (o == NULL) + { + return ERR_INVALID_PARAMETER; + } + + Zero(&t, sizeof(t)); + + StrCpy(t.Name, sizeof(t.Name), GetParamStr(o, "[name]")); + + // RPC call + ret = ScAddL3Switch(ps->Rpc, &t); + + if (ret != ERR_NO_ERROR) + { + // An error has occured + CmdPrintError(c, ret); + FreeParamValueList(o); + return ret; + } + + FreeParamValueList(o); + + return 0; +} + +// Delete the Virtual Layer 3 Switch +UINT PsRouterDelete(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) +{ + LIST *o; + PS *ps = (PS *)param; + UINT ret = 0; + RPC_L3SW t; + // Parameter list that can be specified + PARAM args[] = + { + // "name", prompt_proc, prompt_param, eval_proc, eval_param + {"[name]", CmdPrompt, _UU("CMD_RouterDelete_PROMPT_NAME"), CmdEvalNotEmpty, NULL}, + }; + + o = ParseCommandList(c, cmd_name, str, args, sizeof(args) / sizeof(args[0])); + if (o == NULL) + { + return ERR_INVALID_PARAMETER; + } + + Zero(&t, sizeof(t)); + + StrCpy(t.Name, sizeof(t.Name), GetParamStr(o, "[name]")); + + // RPC call + ret = ScDelL3Switch(ps->Rpc, &t); + + if (ret != ERR_NO_ERROR) + { + // An error has occured + CmdPrintError(c, ret); + FreeParamValueList(o); + return ret; + } + + FreeParamValueList(o); + + return 0; +} + +// Start the Virtual Layer 3 Switch +UINT PsRouterStart(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) +{ + LIST *o; + PS *ps = (PS *)param; + UINT ret = 0; + RPC_L3SW t; + // Parameter list that can be specified + PARAM args[] = + { + // "name", prompt_proc, prompt_param, eval_proc, eval_param + {"[name]", CmdPrompt, _UU("CMD_RouterStart_PROMPT_NAME"), CmdEvalNotEmpty, NULL}, + }; + + o = ParseCommandList(c, cmd_name, str, args, sizeof(args) / sizeof(args[0])); + if (o == NULL) + { + return ERR_INVALID_PARAMETER; + } + + Zero(&t, sizeof(t)); + + StrCpy(t.Name, sizeof(t.Name), GetParamStr(o, "[name]")); + + // RPC call + ret = ScStartL3Switch(ps->Rpc, &t); + + if (ret != ERR_NO_ERROR) + { + // An error has occured + CmdPrintError(c, ret); + FreeParamValueList(o); + return ret; + } + + FreeParamValueList(o); + + return 0; +} + +// Stop the Virtual Layer 3 Switch +UINT PsRouterStop(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) +{ + LIST *o; + PS *ps = (PS *)param; + UINT ret = 0; + RPC_L3SW t; + // Parameter list that can be specified + PARAM args[] = + { + // "name", prompt_proc, prompt_param, eval_proc, eval_param + {"[name]", CmdPrompt, _UU("CMD_RouterStop_PROMPT_NAME"), CmdEvalNotEmpty, NULL}, + }; + + o = ParseCommandList(c, cmd_name, str, args, sizeof(args) / sizeof(args[0])); + if (o == NULL) + { + return ERR_INVALID_PARAMETER; + } + + Zero(&t, sizeof(t)); + + StrCpy(t.Name, sizeof(t.Name), GetParamStr(o, "[name]")); + + // RPC call + ret = ScStopL3Switch(ps->Rpc, &t); + + if (ret != ERR_NO_ERROR) + { + // An error has occured + CmdPrintError(c, ret); + FreeParamValueList(o); + return ret; + } + + FreeParamValueList(o); + + return 0; +} + +// Get the interface list registered on Virtual Layer 3 Switch +UINT PsRouterIfList(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) +{ + LIST *o; + PS *ps = (PS *)param; + UINT ret = 0; + RPC_ENUM_L3IF t; + // Parameter list that can be specified + PARAM args[] = + { + // "name", prompt_proc, prompt_param, eval_proc, eval_param + {"[name]", CmdPrompt, _UU("CMD_RouterIfList_PROMPT_NAME"), CmdEvalNotEmpty, NULL}, + }; + + o = ParseCommandList(c, cmd_name, str, args, sizeof(args) / sizeof(args[0])); + if (o == NULL) + { + return ERR_INVALID_PARAMETER; + } + + Zero(&t, sizeof(t)); + + StrCpy(t.Name, sizeof(t.Name), GetParamStr(o, "[name]")); + + // RPC call + ret = ScEnumL3If(ps->Rpc, &t); + + if (ret != ERR_NO_ERROR) + { + // An error has occured + CmdPrintError(c, ret); + FreeParamValueList(o); + return ret; + } + else + { + UINT i; + wchar_t tmp1[MAX_SIZE]; + wchar_t tmp2[MAX_SIZE]; + wchar_t tmp3[MAX_SIZE]; + CT *ct = CtNew(); + + CtInsertColumn(ct, _UU("SM_L3_SW_IF_COLUMN1"), false); + CtInsertColumn(ct, _UU("SM_L3_SW_IF_COLUMN2"), false); + CtInsertColumn(ct, _UU("SM_L3_SW_IF_COLUMN3"), false); + + for (i = 0;i < t.NumItem;i++) + { + RPC_L3IF *e = &t.Items[i]; + + IPToUniStr32(tmp1, sizeof(tmp1), e->IpAddress); + IPToUniStr32(tmp2, sizeof(tmp2), e->SubnetMask); + StrToUni(tmp3, sizeof(tmp3), e->HubName); + + CtInsert(ct, tmp1, tmp2, tmp3); + } + + + CtFree(ct, c); + } + + FreeRpcEnumL3If(&t); + + FreeParamValueList(o); + + return 0; +} + +// Evaluate the IP address and mask +bool CmdEvalIpAndMask4(CONSOLE *c, wchar_t *str, void *param) +{ + char tmp[MAX_SIZE]; + UINT ip, mask; + // Validate arguments + if (c == NULL || str == NULL) + { + return false; + } + + UniToStr(tmp, sizeof(tmp), str); + + if (ParseIpAndMask4(tmp, &ip, &mask) == false) + { + c->Write(c, _UU("CMD_PARSE_IP_MASK_ERROR_1")); + return false; + } + + return true; +} +bool CmdEvalIpAndMask6(CONSOLE *c, wchar_t *str, void *param) +{ + char tmp[MAX_SIZE]; + IP ip, mask; + // Validate arguments + if (c == NULL || str == NULL) + { + return false; + } + + UniToStr(tmp, sizeof(tmp), str); + + if (ParseIpAndMask6(tmp, &ip, &mask) == false) + { + c->Write(c, _UU("CMD_PARSE_IP_MASK_ERROR_1_6")); + return false; + } + + return true; +} + +// Evaluate the network address and the subnet mask +bool CmdEvalNetworkAndSubnetMask4(CONSOLE *c, wchar_t *str, void *param) +{ + char tmp[MAX_SIZE]; + UINT ip, mask; + // Validate arguments + if (c == NULL || str == NULL) + { + return false; + } + + UniToStr(tmp, sizeof(tmp), str); + + if (ParseIpAndSubnetMask4(tmp, &ip, &mask) == false) + { + c->Write(c, _UU("CMD_PARSE_IP_SUBNET_ERROR_1")); + return false; + } + + if (IsNetworkAddress32(ip, mask) == false) + { + c->Write(c, _UU("CMD_PARSE_IP_SUBNET_ERROR_2")); + return false; + } + + return true; +} + +// Evaluate the IP address and subnet mask +bool CmdEvalHostAndSubnetMask4(CONSOLE *c, wchar_t *str, void *param) +{ + char tmp[MAX_SIZE]; + // Validate arguments + if (c == NULL || str == NULL) + { + return false; + } + + UniToStr(tmp, sizeof(tmp), str); + + if (ParseIpAndSubnetMask4(tmp, NULL, NULL) == false) + { + c->Write(c, _UU("CMD_PARSE_IP_SUBNET_ERROR_1")); + return false; + } + + return true; +} + +// Add a virtual interface to the virtual layer 3 switch +UINT PsRouterIfAdd(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) +{ + LIST *o; + PS *ps = (PS *)param; + UINT ret = 0; + RPC_L3IF t; + // Parameter list that can be specified + PARAM args[] = + { + // "name", prompt_proc, prompt_param, eval_proc, eval_param + {"[name]", CmdPrompt, _UU("CMD_RouterIfAdd_PROMPT_NAME"), CmdEvalNotEmpty, NULL}, + {"HUB", CmdPrompt, _UU("CMD_RouterIfAdd_PROMPT_HUB"), CmdEvalNotEmpty, NULL}, + {"IP", CmdPrompt, _UU("CMD_RouterIfAdd_PROMPT_IP"), CmdEvalHostAndSubnetMask4, NULL}, + }; + + o = ParseCommandList(c, cmd_name, str, args, sizeof(args) / sizeof(args[0])); + if (o == NULL) + { + return ERR_INVALID_PARAMETER; + } + + Zero(&t, sizeof(t)); + + StrCpy(t.Name, sizeof(t.Name), GetParamStr(o, "[name]")); + ParseIpAndSubnetMask4(GetParamStr(o, "IP"), &t.IpAddress, &t.SubnetMask); + StrCpy(t.HubName, sizeof(t.HubName), GetParamStr(o, "HUB")); + + // RPC call + ret = ScAddL3If(ps->Rpc, &t); + + if (ret != ERR_NO_ERROR) + { + // An error has occured + CmdPrintError(c, ret); + FreeParamValueList(o); + return ret; + } + + FreeParamValueList(o); + + return 0; +} + +// Delete the virtual interface of the virtual layer 3 switch +UINT PsRouterIfDel(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) +{ + LIST *o; + PS *ps = (PS *)param; + UINT ret = 0; + RPC_L3IF t; + // Parameter list that can be specified + PARAM args[] = + { + // "name", prompt_proc, prompt_param, eval_proc, eval_param + {"[name]", CmdPrompt, _UU("CMD_RouterIfAdd_PROMPT_NAME"), CmdEvalNotEmpty, NULL}, + {"HUB", CmdPrompt, _UU("CMD_RouterIfAdd_PROMPT_HUB"), CmdEvalNotEmpty, NULL}, + }; + + o = ParseCommandList(c, cmd_name, str, args, sizeof(args) / sizeof(args[0])); + if (o == NULL) + { + return ERR_INVALID_PARAMETER; + } + + Zero(&t, sizeof(t)); + + StrCpy(t.Name, sizeof(t.Name), GetParamStr(o, "[name]")); + StrCpy(t.HubName, sizeof(t.HubName), GetParamStr(o, "HUB")); + + // RPC call + ret = ScDelL3If(ps->Rpc, &t); + + if (ret != ERR_NO_ERROR) + { + // An error has occured + CmdPrintError(c, ret); + FreeParamValueList(o); + return ret; + } + + FreeParamValueList(o); + + return 0; +} + +// Get the routing table of the Virtual Layer 3 Switch +UINT PsRouterTableList(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) +{ + LIST *o; + PS *ps = (PS *)param; + UINT ret = 0; + RPC_ENUM_L3TABLE t; + CT *ct; + wchar_t tmp1[MAX_SIZE]; + wchar_t tmp2[MAX_SIZE]; + wchar_t tmp3[MAX_SIZE]; + wchar_t tmp4[MAX_SIZE]; + // Parameter list that can be specified + PARAM args[] = + { + {"[name]", CmdPrompt, _UU("CMD_RouterTableList_PROMPT_NAME"), CmdEvalNotEmpty, NULL}, + }; + + o = ParseCommandList(c, cmd_name, str, args, sizeof(args) / sizeof(args[0])); + if (o == NULL) + { + return ERR_INVALID_PARAMETER; + } + + Zero(&t, sizeof(t)); + + StrCpy(t.Name, sizeof(t.Name), GetParamStr(o, "[name]")); + + // RPC call + ret = ScEnumL3Table(ps->Rpc, &t); + + if (ret != ERR_NO_ERROR) + { + // An error has occured + CmdPrintError(c, ret); + FreeParamValueList(o); + return ret; + } + else + { + UINT i; + + ct = CtNew(); + + CtInsertColumn(ct, _UU("SM_L3_SW_TABLE_COLUMN1"), false); + CtInsertColumn(ct, _UU("SM_L3_SW_TABLE_COLUMN2"), false); + CtInsertColumn(ct, _UU("SM_L3_SW_TABLE_COLUMN3"), false); + CtInsertColumn(ct, _UU("SM_L3_SW_TABLE_COLUMN4"), true); + + for (i = 0;i < t.NumItem;i++) + { + RPC_L3TABLE *e = &t.Items[i]; + + IPToUniStr32(tmp1, sizeof(tmp1), e->NetworkAddress); + IPToUniStr32(tmp2, sizeof(tmp2), e->SubnetMask); + IPToUniStr32(tmp3, sizeof(tmp3), e->GatewayAddress); + UniToStru(tmp4, e->Metric); + + CtInsert(ct, tmp1, tmp2, tmp3, tmp4); + } + + CtFree(ct, c); + } + + FreeRpcEnumL3Table(&t); + + FreeParamValueList(o); + + return 0; +} + +// Add a routing table entry to the Virtual Layer 3 Switch +UINT PsRouterTableAdd(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) +{ + LIST *o; + PS *ps = (PS *)param; + UINT ret = 0; + RPC_L3TABLE t; + // Parameter list that can be specified + PARAM args[] = + { + // "name", prompt_proc, prompt_param, eval_proc, eval_param + {"[name]", CmdPrompt, _UU("CMD_RouterTableAdd_PROMPT_NAME"), CmdEvalNotEmpty, NULL}, + {"NETWORK", CmdPrompt, _UU("CMD_RouterTableAdd_PROMPT_NETWORK"), CmdEvalNetworkAndSubnetMask4, NULL}, + {"GATEWAY", CmdPrompt, _UU("CMD_RouterTableAdd_PROMPT_GATEWAY"), CmdEvalIp, NULL}, + {"METRIC", CmdPrompt, _UU("CMD_RouterTableAdd_PROMPT_METRIC"), CmdEvalInt1, NULL}, + }; + + o = ParseCommandList(c, cmd_name, str, args, sizeof(args) / sizeof(args[0])); + if (o == NULL) + { + return ERR_INVALID_PARAMETER; + } + + Zero(&t, sizeof(t)); + + StrCpy(t.Name, sizeof(t.Name), GetParamStr(o, "[name]")); + ParseIpAndSubnetMask4(GetParamStr(o, "NETWORK"), &t.NetworkAddress, &t.SubnetMask); + t.Metric = GetParamInt(o, "METRIC"); + t.GatewayAddress = StrToIP32(GetParamStr(o, "GATEWAY")); + + // RPC call + ret = ScAddL3Table(ps->Rpc, &t); + + if (ret != ERR_NO_ERROR) + { + // An error has occured + CmdPrintError(c, ret); + FreeParamValueList(o); + return ret; + } + + FreeParamValueList(o); + + return 0; +} + +// Delete the routing table entry of the Virtual Layer 3 Switch +UINT PsRouterTableDel(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) +{ + LIST *o; + PS *ps = (PS *)param; + UINT ret = 0; + RPC_L3TABLE t; + // Parameter list that can be specified + PARAM args[] = + { + // "name", prompt_proc, prompt_param, eval_proc, eval_param + {"[name]", CmdPrompt, _UU("CMD_RouterTableAdd_PROMPT_NAME"), CmdEvalNotEmpty, NULL}, + {"NETWORK", CmdPrompt, _UU("CMD_RouterTableAdd_PROMPT_NETWORK"), CmdEvalNetworkAndSubnetMask4, NULL}, + {"GATEWAY", CmdPrompt, _UU("CMD_RouterTableAdd_PROMPT_GATEWAY"), CmdEvalIp, NULL}, + {"METRIC", CmdPrompt, _UU("CMD_RouterTableAdd_PROMPT_METRIC"), CmdEvalInt1, NULL}, + }; + + o = ParseCommandList(c, cmd_name, str, args, sizeof(args) / sizeof(args[0])); + if (o == NULL) + { + return ERR_INVALID_PARAMETER; + } + + Zero(&t, sizeof(t)); + + StrCpy(t.Name, sizeof(t.Name), GetParamStr(o, "[name]")); + ParseIpAndSubnetMask4(GetParamStr(o, "NETWORK"), &t.NetworkAddress, &t.SubnetMask); + t.Metric = GetParamInt(o, "METRIC"); + t.GatewayAddress = StrToIP32(GetParamStr(o, "GATEWAY")); + + // RPC call + ret = ScDelL3Table(ps->Rpc, &t); + + if (ret != ERR_NO_ERROR) + { + // An error has occured + CmdPrintError(c, ret); + FreeParamValueList(o); + return ret; + } + + FreeParamValueList(o); + + return 0; +} + +// Get the log files list +UINT PsLogFileList(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) +{ + LIST *o; + PS *ps = (PS *)param; + UINT ret = 0; + RPC_ENUM_LOG_FILE t; + + o = ParseCommandList(c, cmd_name, str, NULL, 0); + if (o == NULL) + { + return ERR_INVALID_PARAMETER; + } + + Zero(&t, sizeof(t)); + + c->Write(c, _UU("CMD_LogFileList_START")); + c->Write(c, L""); + + // RPC call + ret = ScEnumLogFile(ps->Rpc, &t); + + if (ret != ERR_NO_ERROR) + { + // An error has occured + CmdPrintError(c, ret); + FreeParamValueList(o); + return ret; + } + else + { + UINT i; + wchar_t tmp[MAX_SIZE]; + CT *ct; + + UniFormat(tmp, sizeof(tmp), _UU("CMD_LogFileList_NUM_LOGS"), t.NumItem); + c->Write(c, tmp); + + ct = CtNew(); + + CtInsertColumn(ct, _UU("SM_LOG_FILE_COLUMN_1"), false); + CtInsertColumn(ct, _UU("SM_LOG_FILE_COLUMN_2"), true); + CtInsertColumn(ct, _UU("SM_LOG_FILE_COLUMN_3"), false); + CtInsertColumn(ct, _UU("SM_LOG_FILE_COLUMN_4"), false); + + for (i = 0;i < t.NumItem;i++) + { + RPC_ENUM_LOG_FILE_ITEM *e = &t.Items[i]; + wchar_t tmp1[MAX_PATH], tmp2[128], tmp3[128], tmp4[MAX_HOST_NAME_LEN + 1]; + char tmp[MAX_SIZE]; + + StrToUni(tmp1, sizeof(tmp1), e->FilePath); + + ToStrByte(tmp, sizeof(tmp), e->FileSize); + StrToUni(tmp2, sizeof(tmp2), tmp); + + GetDateTimeStr64Uni(tmp3, sizeof(tmp3), SystemToLocal64(e->UpdatedTime)); + + StrToUni(tmp4, sizeof(tmp4), e->ServerName); + + CtInsert(ct, tmp1, tmp2, tmp3, tmp4); + } + + CtFreeEx(ct, c, true); + } + + FreeRpcEnumLogFile(&t); + + FreeParamValueList(o); + + return 0; +} + +// Download a log file +UINT PsLogFileGet(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) +{ + LIST *o; + PS *ps = (PS *)param; + UINT ret = 0; + BUF *buf; + char *filename = NULL; + char *server_name; + // Parameter list that can be specified + PARAM args[] = + { + // "name", prompt_proc, prompt_param, eval_proc, eval_param + {"[name]", CmdPrompt, _UU("CMD_LogFileGet_PROMPT_NAME"), CmdEvalNotEmpty, NULL}, + {"SERVER", NULL, NULL, NULL, NULL}, + {"SAVEPATH", NULL, NULL, NULL, NULL}, + }; + + o = ParseCommandList(c, cmd_name, str, args, sizeof(args) / sizeof(args[0])); + if (o == NULL) + { + return ERR_INVALID_PARAMETER; + } + + filename = GetParamStr(o, "SAVE"); + if (IsEmptyStr(filename)) + { + filename = GetParamStr(o, "SAVEPATH"); + } + + c->Write(c, _UU("CMD_LogFileGet_START")); + + server_name = GetParamStr(o, "SERVER"); + + buf = DownloadFileFromServer(ps->Rpc, server_name, + GetParamStr(o, "[name]"), 0, NULL, NULL); + + if (buf == NULL) + { + c->Write(c, _UU("CMD_LogFileGet_FAILED")); + + ret = ERR_INTERNAL_ERROR; + } + else + { + if (IsEmptyStr(filename) == false) + { + // Save to the file + if (DumpBuf(buf, filename) == false) + { + ret = ERR_INTERNAL_ERROR; + c->Write(c, _UU("CMD_LogFileGet_SAVE_FAILED")); + } + } + else + { + // Display on the screen + wchar_t tmp[MAX_SIZE]; + UINT buf_size; + wchar_t *uni_buf; + + UniFormat(tmp, sizeof(tmp), _UU("CMD_LogFileGet_FILESIZE"), + buf->Size); + c->Write(c, tmp); + c->Write(c, L""); + + buf_size = CalcUtf8ToUni((BYTE *)buf->Buf, buf->Size); + uni_buf = ZeroMalloc(buf_size + 32); + + Utf8ToUni(uni_buf, buf_size, (BYTE *)buf->Buf, buf->Size); + + c->Write(c, uni_buf); + c->Write(c, L""); + + Free(uni_buf); + } + + FreeBuf(buf); + } + + FreeParamValueList(o); + + return ret; +} + +// Create a New Virtual HUB +UINT PsHubCreate(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) +{ + LIST *o; + PS *ps = (PS *)param; + UINT ret = 0; + RPC_CREATE_HUB t; + char *pass = ""; + UINT hub_type = HUB_TYPE_STANDALONE; + // Parameter list that can be specified + PARAM args[] = + { + {"[name]", CmdPrompt, _UU("CMD_HubCreate_PROMPT_NAME"), CmdEvalNotEmpty, NULL}, + {"PASSWORD", CmdPromptChoosePassword, NULL, NULL, NULL}, + }; + + o = ParseCommandList(c, cmd_name, str, args, sizeof(args) / sizeof(args[0])); + if (o == NULL) + { + return ERR_INVALID_PARAMETER; + } + else + { + RPC_SERVER_INFO t; + Zero(&t, sizeof(t)); + if (ScGetServerInfo(ps->Rpc, &t) == ERR_NO_ERROR) + { + if (t.ServerType == SERVER_TYPE_FARM_CONTROLLER) + { + hub_type = HUB_TYPE_FARM_DYNAMIC; + } + FreeRpcServerInfo(&t); + } + } + + Zero(&t, sizeof(t)); + + StrCpy(t.HubName, sizeof(t.HubName), GetParamStr(o, "[name]")); + t.HubType = hub_type; + + if (IsEmptyStr(GetParamStr(o, "PASSWORD")) == false) + { + pass = GetParamStr(o, "PASSWORD"); + } + + Sha0(t.HashedPassword, pass, StrLen(pass)); + HashPassword(t.SecurePassword, ADMINISTRATOR_USERNAME, pass); + t.Online = true; + + // RPC call + ret = ScCreateHub(ps->Rpc, &t); + + if (ret != ERR_NO_ERROR) + { + // An error has occured + CmdPrintError(c, ret); + FreeParamValueList(o); + return ret; + } + + FreeParamValueList(o); + + return 0; +} + +// Create a New Virtual HUB (dynamic mode) +UINT PsHubCreateDynamic(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) +{ + LIST *o; + PS *ps = (PS *)param; + UINT ret = 0; + RPC_CREATE_HUB t; + char *pass = ""; + UINT hub_type = HUB_TYPE_FARM_DYNAMIC; + // Parameter list that can be specified + PARAM args[] = + { + {"[name]", CmdPrompt, _UU("CMD_HubCreate_PROMPT_NAME"), CmdEvalNotEmpty, NULL}, + {"PASSWORD", CmdPromptChoosePassword, NULL, NULL, NULL}, + }; + + o = ParseCommandList(c, cmd_name, str, args, sizeof(args) / sizeof(args[0])); + if (o == NULL) + { + return ERR_INVALID_PARAMETER; + } + + Zero(&t, sizeof(t)); + + StrCpy(t.HubName, sizeof(t.HubName), GetParamStr(o, "[name]")); + t.HubType = hub_type; + + if (IsEmptyStr(GetParamStr(o, "PASSWORD")) == false) + { + pass = GetParamStr(o, "PASSWORD"); + } + + Sha0(t.HashedPassword, pass, StrLen(pass)); + HashPassword(t.SecurePassword, ADMINISTRATOR_USERNAME, pass); + t.Online = true; + + // RPC call + ret = ScCreateHub(ps->Rpc, &t); + + if (ret != ERR_NO_ERROR) + { + // An error has occured + CmdPrintError(c, ret); + FreeParamValueList(o); + return ret; + } + + FreeParamValueList(o); + + return 0; +} + +// Create a New Virtual HUB (static mode) +UINT PsHubCreateStatic(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) +{ + LIST *o; + PS *ps = (PS *)param; + UINT ret = 0; + RPC_CREATE_HUB t; + char *pass = ""; + UINT hub_type = HUB_TYPE_FARM_STATIC; + // Parameter list that can be specified + PARAM args[] = + { + {"[name]", CmdPrompt, _UU("CMD_HubCreate_PROMPT_NAME"), CmdEvalNotEmpty, NULL}, + {"PASSWORD", CmdPromptChoosePassword, NULL, NULL, NULL}, + }; + + o = ParseCommandList(c, cmd_name, str, args, sizeof(args) / sizeof(args[0])); + if (o == NULL) + { + return ERR_INVALID_PARAMETER; + } + + Zero(&t, sizeof(t)); + + StrCpy(t.HubName, sizeof(t.HubName), GetParamStr(o, "[name]")); + t.HubType = hub_type; + + if (IsEmptyStr(GetParamStr(o, "PASSWORD")) == false) + { + pass = GetParamStr(o, "PASSWORD"); + } + + Sha0(t.HashedPassword, pass, StrLen(pass)); + HashPassword(t.SecurePassword, ADMINISTRATOR_USERNAME, pass); + t.Online = true; + + // RPC call + ret = ScCreateHub(ps->Rpc, &t); + + if (ret != ERR_NO_ERROR) + { + // An error has occured + CmdPrintError(c, ret); + FreeParamValueList(o); + return ret; + } + + FreeParamValueList(o); + + return 0; +} + +// Delete a Virtual HUB +UINT PsHubDelete(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) +{ + LIST *o; + PS *ps = (PS *)param; + UINT ret = 0; + RPC_DELETE_HUB t; + // Parameter list that can be specified + PARAM args[] = + { + // "name", prompt_proc, prompt_param, eval_proc, eval_param + {"[name]", CmdPrompt, _UU("CMD_HubDelete_PROMPT_NAME"), CmdEvalNotEmpty, NULL}, + }; + + o = ParseCommandList(c, cmd_name, str, args, sizeof(args) / sizeof(args[0])); + if (o == NULL) + { + return ERR_INVALID_PARAMETER; + } + + Zero(&t, sizeof(t)); + + StrCpy(t.HubName, sizeof(t.HubName), GetParamStr(o, "[name]")); + + // RPC call + ret = ScDeleteHub(ps->Rpc, &t); + + if (ret != ERR_NO_ERROR) + { + // An error has occured + CmdPrintError(c, ret); + FreeParamValueList(o); + return ret; + } + + FreeParamValueList(o); + + return 0; +} + +// Set the Virtual HUB to static +UINT PsHubSetStatic(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) +{ + LIST *o; + PS *ps = (PS *)param; + UINT ret = 0; + RPC_CREATE_HUB t; + // Parameter list that can be specified + PARAM args[] = + { + // "name", prompt_proc, prompt_param, eval_proc, eval_param + {"[name]", CmdPrompt, _UU("CMD_HubChange_PROMPT_NAME"), CmdEvalNotEmpty, NULL}, + }; + + o = ParseCommandList(c, cmd_name, str, args, sizeof(args) / sizeof(args[0])); + if (o == NULL) + { + return ERR_INVALID_PARAMETER; + } + + Zero(&t, sizeof(t)); + + StrCpy(t.HubName, sizeof(t.HubName), GetParamStr(o, "[name]")); + + // Retrieve the current setting first + ret = ScGetHub(ps->Rpc, &t); + + if (ret != ERR_NO_ERROR) + { + // An error has occured + CmdPrintError(c, ret); + FreeParamValueList(o); + return ret; + } + + // Change the settings + StrCpy(t.HubName, sizeof(t.HubName), GetParamStr(o, "[name]")); + t.HubType = HUB_TYPE_FARM_STATIC; + + // Write + ret = ScSetHub(ps->Rpc, &t); + + if (ret != ERR_NO_ERROR) + { + // An error has occured + CmdPrintError(c, ret); + FreeParamValueList(o); + return ret; + } + + FreeParamValueList(o); + + return 0; +} + +// Change the type of Virtual HUB to dynamic Virtual HUB +UINT PsHubSetDynamic(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) +{ + LIST *o; + PS *ps = (PS *)param; + UINT ret = 0; + RPC_CREATE_HUB t; + // Parameter list that can be specified + PARAM args[] = + { + // "name", prompt_proc, prompt_param, eval_proc, eval_param + {"[name]", CmdPrompt, _UU("CMD_HubChange_PROMPT_NAME"), CmdEvalNotEmpty, NULL}, + }; + + o = ParseCommandList(c, cmd_name, str, args, sizeof(args) / sizeof(args[0])); + if (o == NULL) + { + return ERR_INVALID_PARAMETER; + } + + Zero(&t, sizeof(t)); + + StrCpy(t.HubName, sizeof(t.HubName), GetParamStr(o, "[name]")); + + // Retrieve the current setting first + ret = ScGetHub(ps->Rpc, &t); + + if (ret != ERR_NO_ERROR) + { + // An error has occured + CmdPrintError(c, ret); + FreeParamValueList(o); + return ret; + } + + // Change the settings + StrCpy(t.HubName, sizeof(t.HubName), GetParamStr(o, "[name]")); + t.HubType = HUB_TYPE_FARM_DYNAMIC; + + // Write + ret = ScSetHub(ps->Rpc, &t); + + if (ret != ERR_NO_ERROR) + { + // An error has occured + CmdPrintError(c, ret); + FreeParamValueList(o); + return ret; + } + + FreeParamValueList(o); + + return 0; +} + +// Get the list of Virtual HUB +UINT PsHubList(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) +{ + LIST *o; + PS *ps = (PS *)param; + UINT ret = 0; + RPC_ENUM_HUB t; + UINT i; + + o = ParseCommandList(c, cmd_name, str, NULL, 0); + if (o == NULL) + { + return ERR_INVALID_PARAMETER; + } + + Zero(&t, sizeof(t)); + + // RPC call + ret = ScEnumHub(ps->Rpc, &t); + + if (ret != ERR_NO_ERROR) + { + // An error has occured + CmdPrintError(c, ret); + FreeParamValueList(o); + return ret; + } + else + { + CT *ct = CtNew(); + + CtInsertColumn(ct, _UU("SM_HUB_COLUMN_1"), false); + CtInsertColumn(ct, _UU("SM_HUB_COLUMN_2"), false); + CtInsertColumn(ct, _UU("SM_HUB_COLUMN_3"), false); + CtInsertColumn(ct, _UU("SM_HUB_COLUMN_4"), false); + CtInsertColumn(ct, _UU("SM_HUB_COLUMN_5"), false); + CtInsertColumn(ct, _UU("SM_HUB_COLUMN_6"), false); + CtInsertColumn(ct, _UU("SM_HUB_COLUMN_7"), false); + CtInsertColumn(ct, _UU("SM_HUB_COLUMN_8"), false); + CtInsertColumn(ct, _UU("SM_HUB_COLUMN_9"), false); + CtInsertColumn(ct, _UU("SM_HUB_COLUMN_10"), false); + CtInsertColumn(ct, _UU("SM_HUB_COLUMN_11"), false); + CtInsertColumn(ct, _UU("SM_SESS_COLUMN_6"), false); + CtInsertColumn(ct, _UU("SM_SESS_COLUMN_7"), false); + + for (i = 0;i < t.NumHub;i++) + { + RPC_ENUM_HUB_ITEM *e = &t.Hubs[i]; + wchar_t name[MAX_HUBNAME_LEN + 1]; + wchar_t s1[64], s2[64], s3[64], s4[64], s5[64]; + wchar_t s6[64], s7[128], s8[128]; + wchar_t s9[64], s10[64]; + + UniToStru(s1, e->NumUsers); + UniToStru(s2, e->NumGroups); + UniToStru(s3, e->NumSessions); + UniToStru(s4, e->NumMacTables); + UniToStru(s5, e->NumIpTables); + + UniToStru(s6, e->NumLogin); + + if (e->LastLoginTime != 0) + { + GetDateTimeStr64Uni(s7, sizeof(s7), SystemToLocal64(e->LastLoginTime)); + } + else + { + UniStrCpy(s7, sizeof(s7), _UU("COMMON_UNKNOWN")); + } + + if (e->LastCommTime != 0) + { + GetDateTimeStr64Uni(s8, sizeof(s8), SystemToLocal64(e->LastCommTime)); + } + else + { + UniStrCpy(s8, sizeof(s8), _UU("COMMON_UNKNOWN")); + } + + if (e->IsTrafficFilled == false) + { + UniStrCpy(s9, sizeof(s9), _UU("CM_ST_NONE")); + UniStrCpy(s10, sizeof(s10), _UU("CM_ST_NONE")); + } + else + { + UniToStr3(s9, sizeof(s9), + e->Traffic.Recv.BroadcastBytes + e->Traffic.Recv.UnicastBytes + + e->Traffic.Send.BroadcastBytes + e->Traffic.Send.UnicastBytes); + + UniToStr3(s10, sizeof(s10), + e->Traffic.Recv.BroadcastCount + e->Traffic.Recv.UnicastCount + + e->Traffic.Send.BroadcastCount + e->Traffic.Send.UnicastCount); + } + + StrToUni(name, sizeof(name), e->HubName); + + CtInsert(ct, + name, + e->Online ? _UU("SM_HUB_ONLINE") : _UU("SM_HUB_OFFLINE"), + GetHubTypeStr(e->HubType), + s1, s2, s3, s4, s5, s6, s7, s8, s9, s10); + } + + CtFreeEx(ct, c, true); + } + + FreeRpcEnumHub(&t); + + FreeParamValueList(o); + + return 0; +} + +// Select a Virtual HUB to manage +UINT PsHub(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) +{ + LIST *o; + PS *ps = (PS *)param; + UINT ret = 0; + RPC_HUB_STATUS t; + // Parameter list that can be specified + PARAM args[] = + { + // "name", prompt_proc, prompt_param, eval_proc, eval_param + {"[name]", NULL, NULL, NULL, NULL}, + }; + + o = ParseCommandList(c, cmd_name, str, args, sizeof(args) / sizeof(args[0])); + if (o == NULL) + { + return ERR_INVALID_PARAMETER; + } + + if (IsEmptyStr(GetParamStr(o, "[name]")) == false) + { + wchar_t tmp[MAX_SIZE]; + Zero(&t, sizeof(t)); + + // Examine whether the specified Virtual HUB is accessible + StrCpy(t.HubName, sizeof(t.HubName), GetParamStr(o, "[name]")); + + // RPC call + ret = ScGetHubStatus(ps->Rpc, &t); + + if (ret != ERR_NO_ERROR) + { + // An error has occured + CmdPrintError(c, ret); + FreeParamValueList(o); + return ret; + } + + // Change the selection + if (ps->HubName != NULL) + { + Free(ps->HubName); + } + ps->HubName = CopyStr(t.HubName); + + UniFormat(tmp, sizeof(tmp), _UU("CMD_Hub_Selected"), t.HubName); + c->Write(c, tmp); + } + else + { + // Deselect + if (ps->HubName != NULL) + { + c->Write(c, _UU("CMD_Hub_Unselected")); + Free(ps->HubName); + } + ps->HubName = NULL; + } + + FreeParamValueList(o); + + return 0; +} + +// Set the Virtual HUB to online +UINT PsOnline(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) +{ + LIST *o; + PS *ps = (PS *)param; + UINT ret = 0; + RPC_SET_HUB_ONLINE t; + + // If virtual HUB is not selected, it's an error + if (ps->HubName == NULL) + { + c->Write(c, _UU("CMD_Hub_Not_Selected")); + return ERR_INVALID_PARAMETER; + } + + o = ParseCommandList(c, cmd_name, str, NULL, 0); + if (o == NULL) + { + return ERR_INVALID_PARAMETER; + } + + Zero(&t, sizeof(t)); + + StrCpy(t.HubName, sizeof(t.HubName), ps->HubName); + t.Online = true; + + // RPC call + ret = ScSetHubOnline(ps->Rpc, &t); + + if (ret != ERR_NO_ERROR) + { + // An error has occured + CmdPrintError(c, ret); + FreeParamValueList(o); + return ret; + } + + FreeParamValueList(o); + + return 0; +} + +// Set the Virtual HUB to offline +UINT PsOffline(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) +{ + LIST *o; + PS *ps = (PS *)param; + UINT ret = 0; + RPC_SET_HUB_ONLINE t; + + // If virtual HUB is not selected, it's an error + if (ps->HubName == NULL) + { + c->Write(c, _UU("CMD_Hub_Not_Selected")); + return ERR_INVALID_PARAMETER; + } + + o = ParseCommandList(c, cmd_name, str, NULL, 0); + if (o == NULL) + { + return ERR_INVALID_PARAMETER; + } + + Zero(&t, sizeof(t)); + + StrCpy(t.HubName, sizeof(t.HubName), ps->HubName); + t.Online = false; + + // RPC call + ret = ScSetHubOnline(ps->Rpc, &t); + + if (ret != ERR_NO_ERROR) + { + // An error has occured + CmdPrintError(c, ret); + FreeParamValueList(o); + return ret; + } + + FreeParamValueList(o); + + return 0; +} + +// Set the maximum number of concurrent connecting sessions of the Virtual HUB +UINT PsSetMaxSession(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) +{ + LIST *o; + PS *ps = (PS *)param; + UINT ret = 0; + RPC_CREATE_HUB t; + // Parameter list that can be specified + PARAM args[] = + { + {"[max_session]", CmdPrompt, _UU("CMD_SetMaxSession_Prompt"), CmdEvalNotEmpty, NULL}, + }; + + // If virtual HUB is not selected, it's an error + if (ps->HubName == NULL) + { + c->Write(c, _UU("CMD_Hub_Not_Selected")); + return ERR_INVALID_PARAMETER; + } + + o = ParseCommandList(c, cmd_name, str, args, sizeof(args) / sizeof(args[0])); + if (o == NULL) + { + return ERR_INVALID_PARAMETER; + } + + // Get current settings of Virtual HUB + Zero(&t, sizeof(t)); + StrCpy(t.HubName, sizeof(t.HubName), ps->HubName); + ret = ScGetHub(ps->Rpc, &t); + if (ret != ERR_NO_ERROR) + { + // An error has occured + CmdPrintError(c, ret); + FreeParamValueList(o); + return ret; + } + + t.HubOption.MaxSession = GetParamInt(o, "[max_session]"); + + // Write the configuration of Virtual HUB + ret = ScSetHub(ps->Rpc, &t); + if (ret != ERR_NO_ERROR) + { + // An error has occured + CmdPrintError(c, ret); + FreeParamValueList(o); + return ret; + } + + FreeParamValueList(o); + + return 0; +} + +// Set the administrative password of the Virtual HUB +UINT PsSetHubPassword(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) +{ + LIST *o; + PS *ps = (PS *)param; + UINT ret = 0; + RPC_CREATE_HUB t; + char *pw; + // Parameter list that can be specified + PARAM args[] = + { + {"[password]", CmdPromptChoosePassword, NULL, NULL, NULL}, + }; + + // If virtual HUB is not selected, it's an error + if (ps->HubName == NULL) + { + c->Write(c, _UU("CMD_Hub_Not_Selected")); + return ERR_INVALID_PARAMETER; + } + + o = ParseCommandList(c, cmd_name, str, args, sizeof(args) / sizeof(args[0])); + if (o == NULL) + { + return ERR_INVALID_PARAMETER; + } + + // Get current settings of Virtual HUB + Zero(&t, sizeof(t)); + StrCpy(t.HubName, sizeof(t.HubName), ps->HubName); + ret = ScGetHub(ps->Rpc, &t); + if (ret != ERR_NO_ERROR) + { + // An error has occured + CmdPrintError(c, ret); + FreeParamValueList(o); + return ret; + } + + // Change the settings + pw = GetParamStr(o, "[password]"); + HashPassword(t.SecurePassword, ADMINISTRATOR_USERNAME, pw); + Sha0(t.HashedPassword, pw, StrLen(pw)); + + // Write the configuration of Virtual HUB + ret = ScSetHub(ps->Rpc, &t); + if (ret != ERR_NO_ERROR) + { + // An error has occured + CmdPrintError(c, ret); + FreeParamValueList(o); + return ret; + } + + FreeParamValueList(o); + + return 0; +} + +// Set the Virtual HUB to permit to be enumerated for anonymous users +UINT PsSetEnumAllow(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) +{ + LIST *o; + PS *ps = (PS *)param; + UINT ret = 0; + RPC_CREATE_HUB t; + + // If virtual HUB is not selected, it's an error + if (ps->HubName == NULL) + { + c->Write(c, _UU("CMD_Hub_Not_Selected")); + return ERR_INVALID_PARAMETER; + } + + o = ParseCommandList(c, cmd_name, str, NULL, 0); + if (o == NULL) + { + return ERR_INVALID_PARAMETER; + } + + // Get current settings of Virtual HUB + Zero(&t, sizeof(t)); + StrCpy(t.HubName, sizeof(t.HubName), ps->HubName); + ret = ScGetHub(ps->Rpc, &t); + if (ret != ERR_NO_ERROR) + { + // An error has occured + CmdPrintError(c, ret); + FreeParamValueList(o); + return ret; + } + + t.HubOption.NoEnum = false; + + // Write the configuration of Virtual HUB + ret = ScSetHub(ps->Rpc, &t); + if (ret != ERR_NO_ERROR) + { + // An error has occured + CmdPrintError(c, ret); + FreeParamValueList(o); + return ret; + } + + FreeParamValueList(o); + + return 0; +} + +// Set the Virtual HUB to deny to be enumerated for anonymous users +UINT PsSetEnumDeny(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) +{ + LIST *o; + PS *ps = (PS *)param; + UINT ret = 0; + RPC_CREATE_HUB t; + + // If virtual HUB is not selected, it's an error + if (ps->HubName == NULL) + { + c->Write(c, _UU("CMD_Hub_Not_Selected")); + return ERR_INVALID_PARAMETER; + } + + o = ParseCommandList(c, cmd_name, str, NULL, 0); + if (o == NULL) + { + return ERR_INVALID_PARAMETER; + } + + // Get current settings of Virtual HUB + Zero(&t, sizeof(t)); + StrCpy(t.HubName, sizeof(t.HubName), ps->HubName); + ret = ScGetHub(ps->Rpc, &t); + if (ret != ERR_NO_ERROR) + { + // An error has occured + CmdPrintError(c, ret); + FreeParamValueList(o); + return ret; + } + + t.HubOption.NoEnum = true; + + // Write the configuration of Virtual HUB + ret = ScSetHub(ps->Rpc, &t); + if (ret != ERR_NO_ERROR) + { + // An error has occured + CmdPrintError(c, ret); + FreeParamValueList(o); + return ret; + } + + FreeParamValueList(o); + + return 0; +} + +// Get the option settings for the virtual HUB +UINT PsOptionsGet(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) +{ + LIST *o; + PS *ps = (PS *)param; + UINT ret = 0; + RPC_CREATE_HUB t; + + // If virtual HUB is not selected, it's an error + if (ps->HubName == NULL) + { + c->Write(c, _UU("CMD_Hub_Not_Selected")); + return ERR_INVALID_PARAMETER; + } + + o = ParseCommandList(c, cmd_name, str, NULL, 0); + if (o == NULL) + { + return ERR_INVALID_PARAMETER; + } + + Zero(&t, sizeof(t)); + + StrCpy(t.HubName, sizeof(t.HubName), ps->HubName); + + // RPC call + ret = ScGetHub(ps->Rpc, &t); + + if (ret != ERR_NO_ERROR) + { + // An error has occured + CmdPrintError(c, ret); + FreeParamValueList(o); + return ret; + } + else + { + CT *ct; + wchar_t tmp[MAX_SIZE]; + + UniFormat(tmp, sizeof(tmp), _UU("CMD_OptionsGet_TITLE"), ps->HubName); + c->Write(c, tmp); + + // Display settings + ct = CtNewStandard(); + + CtInsert(ct, _UU("CMD_OptionsGet_ENUM"), + t.HubOption.NoEnum ? _UU("CMD_MSG_DENY") : _UU("CMD_MSG_ALLOW")); + + if (t.HubOption.MaxSession == 0) + { + UniStrCpy(tmp, sizeof(tmp), _UU("CMD_MSG_INFINITE")); + } + else + { + UniToStru(tmp, t.HubOption.MaxSession); + } + CtInsert(ct, _UU("CMD_OptionsGet_MAXSESSIONS"), tmp); + + CtInsert(ct, _UU("CMD_OptionsGet_STATUS"), t.Online ? _UU("SM_HUB_ONLINE") : _UU("SM_HUB_OFFLINE")); + + CtInsert(ct, _UU("CMD_OptionsGet_TYPE"), GetHubTypeStr(t.HubType)); + + CtFree(ct, c); + } + + FreeParamValueList(o); + + return 0; +} + +// Setting the Radius server to use for user authentication +UINT PsRadiusServerSet(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) +{ + LIST *o; + PS *ps = (PS *)param; + UINT ret = 0; + RPC_RADIUS t; + char *host; + UINT port; + // Parameter list that can be specified + CMD_EVAL_MIN_MAX minmax = + { + "CMD_RadiusServerSet_EVAL_NUMINTERVAL", RADIUS_RETRY_INTERVAL, RADIUS_RETRY_TIMEOUT, + }; + PARAM args[] = + { + // "name", prompt_proc, prompt_param, eval_proc, eval_param + {"[server_name:port]", CmdPrompt, _UU("CMD_RadiusServerSet_Prompt_Host"), CmdEvalNotEmpty, NULL}, + {"SECRET", CmdPromptChoosePassword, _UU("CMD_RadiusServerSet_Prompt_Secret"), NULL, NULL}, + {"RETRY_INTERVAL", CmdPrompt, _UU("CMD_RadiusServerSet_Prompt_RetryInterval"), CmdEvalMinMax, &minmax}, + }; + + // If virtual HUB is not selected, it's an error + if (ps->HubName == NULL) + { + c->Write(c, _UU("CMD_Hub_Not_Selected")); + return ERR_INVALID_PARAMETER; + } + + o = ParseCommandList(c, cmd_name, str, args, sizeof(args) / sizeof(args[0])); + if (o == NULL) + { + return ERR_INVALID_PARAMETER; + } + + if (ParseHostPort(GetParamStr(o, "[server_name:port]"), &host, &port, 1812)) + { + Zero(&t, sizeof(t)); + + StrCpy(t.HubName, sizeof(t.HubName), ps->HubName); + t.RadiusPort = port; + StrCpy(t.RadiusServerName, sizeof(t.RadiusServerName), host); + StrCpy(t.RadiusSecret, sizeof(t.RadiusSecret), GetParamStr(o, "SECRET")); + t.RadiusRetryInterval = GetParamInt(o, "RETRY_INTERVAL"); + + Free(host); + + // RPC call + ret = ScSetHubRadius(ps->Rpc, &t); + + if (ret != ERR_NO_ERROR) + { + // An error has occured + CmdPrintError(c, ret); + FreeParamValueList(o); + return ret; + } + } + + FreeParamValueList(o); + + return 0; +} + +// Delete the Radius server configuration to be used for user authentication +UINT PsRadiusServerDelete(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) +{ + LIST *o; + PS *ps = (PS *)param; + UINT ret = 0; + RPC_RADIUS t; + + // If virtual HUB is not selected, it's an error + if (ps->HubName == NULL) + { + c->Write(c, _UU("CMD_Hub_Not_Selected")); + return ERR_INVALID_PARAMETER; + } + + o = ParseCommandList(c, cmd_name, str, NULL, 0); + if (o == NULL) + { + return ERR_INVALID_PARAMETER; + } + + Zero(&t, sizeof(t)); + + StrCpy(t.HubName, sizeof(t.HubName), ps->HubName); + t.RadiusPort = 1812; + + // RPC call + ret = ScSetHubRadius(ps->Rpc, &t); + + if (ret != ERR_NO_ERROR) + { + // An error has occured + CmdPrintError(c, ret); + FreeParamValueList(o); + return ret; + } + + FreeParamValueList(o); + + return 0; +} + +// Get the Radius server settings to use for user authentication +UINT PsRadiusServerGet(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) +{ + LIST *o; + PS *ps = (PS *)param; + UINT ret = 0; + RPC_RADIUS t; + + // If virtual HUB is not selected, it's an error + if (ps->HubName == NULL) + { + c->Write(c, _UU("CMD_Hub_Not_Selected")); + return ERR_INVALID_PARAMETER; + } + + o = ParseCommandList(c, cmd_name, str, NULL, 0); + if (o == NULL) + { + return ERR_INVALID_PARAMETER; + } + + Zero(&t, sizeof(t)); + + StrCpy(t.HubName, sizeof(t.HubName), ps->HubName); + + // RPC call + ret = ScGetHubRadius(ps->Rpc, &t); + + if (ret != ERR_NO_ERROR) + { + // An error has occured + CmdPrintError(c, ret); + FreeParamValueList(o); + return ret; + } + else + { + CT *ct; + wchar_t tmp[MAX_SIZE]; + + ct = CtNewStandard(); + + if (IsEmptyStr(t.RadiusServerName)) + { + CtInsert(ct, _UU("CMD_RadiusServerGet_STATUS"), _UU("CMD_MSG_DISABLE")); + } + else + { + CtInsert(ct, _UU("CMD_RadiusServerGet_STATUS"), _UU("CMD_MSG_ENABLE")); + + StrToUni(tmp, sizeof(tmp), t.RadiusServerName); + CtInsert(ct, _UU("CMD_RadiusServerGet_HOST"), tmp); + + UniToStri(tmp, t.RadiusPort); + CtInsert(ct, _UU("CMD_RadiusServerGet_PORT"), tmp); + + StrToUni(tmp, sizeof(tmp), t.RadiusSecret); + CtInsert(ct, _UU("CMD_RadiusServerGet_SECRET"), tmp); + + UniToStri(tmp, t.RadiusRetryInterval); + CtInsert(ct, _UU("CMD_RadiusServerGet_RetryInterval"), tmp); + } + + CtFree(ct, c); + } + + FreeParamValueList(o); + + return 0; +} + +// Get the current status of the Virtual HUB +UINT PsStatusGet(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) +{ + LIST *o; + PS *ps = (PS *)param; + UINT ret = 0; + RPC_HUB_STATUS t; + + o = ParseCommandList(c, cmd_name, str, NULL, 0); + if (o == NULL) + { + return ERR_INVALID_PARAMETER; + } + + // If virtual HUB is not selected, it's an error + if (ps->HubName == NULL) + { + c->Write(c, _UU("CMD_Hub_Not_Selected")); + return ERR_INVALID_PARAMETER; + } + + Zero(&t, sizeof(t)); + + StrCpy(t.HubName, sizeof(t.HubName), ps->HubName); + + // RPC call + ret = ScGetHubStatus(ps->Rpc, &t); + + if (ret != ERR_NO_ERROR) + { + // An error has occured + CmdPrintError(c, ret); + FreeParamValueList(o); + return ret; + } + else + { + CT *ct = CtNewStandard(); + wchar_t *s; + wchar_t tmp[MAX_SIZE]; + + // HUB name + s = CopyStrToUni(t.HubName); + CtInsert(ct, _UU("SM_HUB_STATUS_HUBNAME"), s); + Free(s); + + // Online + CtInsert(ct, _UU("SM_HUB_STATUS_ONLINE"), + t.Online ? _UU("SM_HUB_ONLINE") : _UU("SM_HUB_OFFLINE")); + + // Type of HUB + CtInsert(ct, _UU("SM_HUB_TYPE"), + GetHubTypeStr(t.HubType)); + + if (t.HubType == HUB_TYPE_STANDALONE) + { + // Enable / Disable the SecureNAT + CtInsert(ct, _UU("SM_HUB_SECURE_NAT"), + t.SecureNATEnabled ? _UU("SM_HUB_SECURE_NAT_YES") : _UU("SM_HUB_SECURE_NAT_NO")); + } + + // Other values + UniToStru(tmp, t.NumSessions); + CtInsert(ct, _UU("SM_HUB_NUM_SESSIONS"), tmp); + + if (t.NumSessionsClient != 0 || t.NumSessionsBridge != 0) + { + UniToStru(tmp, t.NumSessionsClient); + CtInsert(ct, _UU("SM_HUB_NUM_SESSIONS_CLIENT"), tmp); + UniToStru(tmp, t.NumSessionsBridge); + CtInsert(ct, _UU("SM_HUB_NUM_SESSIONS_BRIDGE"), tmp); + } + + UniToStru(tmp, t.NumAccessLists); + CtInsert(ct, _UU("SM_HUB_NUM_ACCESSES"), tmp); + + UniToStru(tmp, t.NumUsers); + CtInsert(ct, _UU("SM_HUB_NUM_USERS"), tmp); + UniToStru(tmp, t.NumGroups); + CtInsert(ct, _UU("SM_HUB_NUM_GROUPS"), tmp); + + UniToStru(tmp, t.NumMacTables); + CtInsert(ct, _UU("SM_HUB_NUM_MAC_TABLES"), tmp); + UniToStru(tmp, t.NumIpTables); + CtInsert(ct, _UU("SM_HUB_NUM_IP_TABLES"), tmp); + + // Usage status + UniToStru(tmp, t.NumLogin); + CtInsert(ct, _UU("SM_HUB_NUM_LOGIN"), tmp); + + if (t.LastLoginTime != 0) + { + GetDateTimeStr64Uni(tmp, sizeof(tmp), SystemToLocal64(t.LastLoginTime)); + } + else + { + UniStrCpy(tmp, sizeof(tmp), _UU("COMMON_UNKNOWN")); + } + CtInsert(ct, _UU("SM_HUB_LAST_LOGIN_TIME"), tmp); + + if (t.LastCommTime != 0) + { + GetDateTimeStr64Uni(tmp, sizeof(tmp), SystemToLocal64(t.LastCommTime)); + } + else + { + UniStrCpy(tmp, sizeof(tmp), _UU("COMMON_UNKNOWN")); + } + CtInsert(ct, _UU("SM_HUB_LAST_COMM_TIME"), tmp); + + if (t.CreatedTime != 0) + { + GetDateTimeStr64Uni(tmp, sizeof(tmp), SystemToLocal64(t.CreatedTime)); + } + else + { + UniStrCpy(tmp, sizeof(tmp), _UU("COMMON_UNKNOWN")); + } + CtInsert(ct, _UU("SM_HUB_CREATED_TIME"), tmp); + + // Traffic information + CmdInsertTrafficInfo(ct, &t.Traffic); + + CtFree(ct, c); + } + + FreeParamValueList(o); + + return 0; +} + +// Get the log switching string +wchar_t *GetLogSwitchStr(UINT i) +{ + char tmp[64]; + + Format(tmp, sizeof(tmp), "SM_LOG_SWITCH_%u", i); + + return _UU(tmp); +} + +// Get the packet log name string +wchar_t *GetPacketLogNameStr(UINT i) +{ + char tmp[64]; + + Format(tmp, sizeof(tmp), "CMD_Log_%u", i); + + return _UU(tmp); +} + +// Get the log storage settings for the virtual HUB +UINT PsLogGet(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) +{ + LIST *o; + PS *ps = (PS *)param; + UINT ret = 0; + RPC_HUB_LOG t; + + // If virtual HUB is not selected, it's an error + if (ps->HubName == NULL) + { + c->Write(c, _UU("CMD_Hub_Not_Selected")); + return ERR_INVALID_PARAMETER; + } + + o = ParseCommandList(c, cmd_name, str, NULL, 0); + if (o == NULL) + { + return ERR_INVALID_PARAMETER; + } + + Zero(&t, sizeof(t)); + + StrCpy(t.HubName, sizeof(t.HubName), ps->HubName); + + // RPC call + ret = ScGetHubLog(ps->Rpc, &t); + + if (ret != ERR_NO_ERROR) + { + // An error has occured + CmdPrintError(c, ret); + FreeParamValueList(o); + return ret; + } + else + { + CT *ct = CtNewStandard(); + + CtInsert(ct, _UU("CMD_Log_SecurityLog"), + t.LogSetting.SaveSecurityLog ? _UU("CMD_MSG_ENABLE") : _UU("CMD_MSG_DISABLE")); + if (t.LogSetting.SaveSecurityLog) + { + CtInsert(ct, _UU("CMD_Log_SwitchType"), GetLogSwitchStr(t.LogSetting.SecurityLogSwitchType)); + } + + CtInsert(ct, L"", L""); + + CtInsert(ct, _UU("CMD_Log_PacketLog"), + t.LogSetting.SavePacketLog ? _UU("CMD_MSG_ENABLE") : _UU("CMD_MSG_DISABLE")); + if (t.LogSetting.SavePacketLog) + { + UINT i; + + CtInsert(ct, _UU("CMD_Log_SwitchType"), GetLogSwitchStr(t.LogSetting.PacketLogSwitchType)); + + for (i = 0;i <= 7;i++) + { + wchar_t *tmp = NULL; + + switch (t.LogSetting.PacketLogConfig[i]) + { + case PACKET_LOG_NONE: + tmp = _UU("D_SM_LOG@B_PACKET_0_0"); + break; + + case PACKET_LOG_HEADER: + tmp = _UU("D_SM_LOG@B_PACKET_0_1"); + break; + + case PACKET_LOG_ALL: + tmp = _UU("D_SM_LOG@B_PACKET_0_2"); + break; + } + + CtInsert(ct, GetPacketLogNameStr(i), + tmp); + } + } + + CtFree(ct, c); + } + + FreeParamValueList(o); + + return 0; +} + +// LogEnable command +UINT PsLogEnable(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) +{ + LIST *o; + PS *ps = (PS *)param; + UINT ret = 0; + RPC_HUB_LOG t; + bool packet_log = false; + char *tmp; + // Parameter list that can be specified + PARAM args[] = + { + {"[security|packet]", CmdPrompt, _UU("CMD_LogEnable_Prompt"), CmdEvalNotEmpty, NULL}, + }; + + // If virtual HUB is not selected, it's an error + if (ps->HubName == NULL) + { + c->Write(c, _UU("CMD_Hub_Not_Selected")); + return ERR_INVALID_PARAMETER; + } + + o = ParseCommandList(c, cmd_name, str, args, sizeof(args) / sizeof(args[0])); + if (o == NULL) + { + return ERR_INVALID_PARAMETER; + } + + tmp = GetParamStr(o, "[security|packet]"); + + if (StartWith(tmp, "p")) + { + packet_log = true; + } + else if (StartWith(tmp, "s") == false) + { + c->Write(c, _UU("CMD_LogEnable_Prompt_Error")); + FreeParamValueList(o); + return ret; + } + + Zero(&t, sizeof(t)); + + StrCpy(t.HubName, sizeof(t.HubName), ps->HubName); + + // RPC call + ret = ScGetHubLog(ps->Rpc, &t); + if (ret != ERR_NO_ERROR) + { + // An error has occured + CmdPrintError(c, ret); + FreeParamValueList(o); + return ret; + } + + if (packet_log == false) + { + t.LogSetting.SaveSecurityLog = true; + } + else + { + t.LogSetting.SavePacketLog = true; + } + + // RPC call + ret = ScSetHubLog(ps->Rpc, &t); + if (ret != ERR_NO_ERROR) + { + // An error has occured + CmdPrintError(c, ret); + FreeParamValueList(o); + return ret; + } + + FreeParamValueList(o); + + return 0; +} + +// Disable the packet log or the security log +UINT PsLogDisable(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) +{ + LIST *o; + PS *ps = (PS *)param; + UINT ret = 0; + RPC_HUB_LOG t; + bool packet_log = false; + char *tmp; + // Parameter list that can be specified + PARAM args[] = + { + {"[security|packet]", CmdPrompt, _UU("CMD_LogEnable_Prompt"), CmdEvalNotEmpty, NULL}, + }; + + // If virtual HUB is not selected, it's an error + if (ps->HubName == NULL) + { + c->Write(c, _UU("CMD_Hub_Not_Selected")); + return ERR_INVALID_PARAMETER; + } + + o = ParseCommandList(c, cmd_name, str, args, sizeof(args) / sizeof(args[0])); + if (o == NULL) + { + return ERR_INVALID_PARAMETER; + } + + tmp = GetParamStr(o, "[security|packet]"); + + if (StartWith(tmp, "p")) + { + packet_log = true; + } + else if (StartWith(tmp, "s") == false) + { + c->Write(c, _UU("CMD_LogEnable_Prompt_Error")); + FreeParamValueList(o); + return ERR_INVALID_PARAMETER; + } + + Zero(&t, sizeof(t)); + + StrCpy(t.HubName, sizeof(t.HubName), ps->HubName); + + // RPC call + ret = ScGetHubLog(ps->Rpc, &t); + if (ret != ERR_NO_ERROR) + { + // An error has occured + CmdPrintError(c, ret); + FreeParamValueList(o); + return ret; + } + + if (packet_log == false) + { + t.LogSetting.SaveSecurityLog = false; + } + else + { + t.LogSetting.SavePacketLog = false; + } + + // RPC call + ret = ScSetHubLog(ps->Rpc, &t); + if (ret != ERR_NO_ERROR) + { + // An error has occured + CmdPrintError(c, ret); + FreeParamValueList(o); + return ret; + } + + FreeParamValueList(o); + + return 0; +} + +// Convert the string to log switching type +UINT StrToLogSwitchType(char *str) +{ + UINT ret = INFINITE; + // Validate arguments + if (str == NULL) + { + return INFINITE; + } + + if (IsEmptyStr(str) || StartWith("none", str)) + { + ret = LOG_SWITCH_NO; + } + else if (StartWith("second", str)) + { + ret = LOG_SWITCH_SECOND; + } + else if (StartWith("minute", str)) + { + ret = LOG_SWITCH_MINUTE; + } + else if (StartWith("hour", str)) + { + ret = LOG_SWITCH_HOUR; + } + else if (StartWith("day", str)) + { + ret = LOG_SWITCH_DAY; + } + else if (StartWith("month", str)) + { + ret = LOG_SWITCH_MONTH; + } + + return ret; +} + +// Set the switching period of the log file +UINT PsLogSwitchSet(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) +{ + LIST *o; + PS *ps = (PS *)param; + UINT ret = 0; + RPC_HUB_LOG t; + bool packet_log = false; + char *tmp; + UINT new_switch_type = 0; + // Parameter list that can be specified + PARAM args[] = + { + {"[security|packet]", CmdPrompt, _UU("CMD_LogEnable_Prompt"), CmdEvalNotEmpty, NULL}, + {"SWITCH", CmdPrompt, _UU("CMD_LogSwitchSet_Prompt"), NULL, NULL}, + }; + + // If virtual HUB is not selected, it's an error + if (ps->HubName == NULL) + { + c->Write(c, _UU("CMD_Hub_Not_Selected")); + return ERR_INVALID_PARAMETER; + } + + o = ParseCommandList(c, cmd_name, str, args, sizeof(args) / sizeof(args[0])); + if (o == NULL) + { + return ERR_INVALID_PARAMETER; + } + + tmp = GetParamStr(o, "[security|packet]"); + + if (StartWith(tmp, "p")) + { + packet_log = true; + } + else if (StartWith(tmp, "s") == false) + { + c->Write(c, _UU("CMD_LogEnable_Prompt_Error")); + FreeParamValueList(o); + return ERR_INVALID_PARAMETER; + } + + new_switch_type = StrToLogSwitchType(GetParamStr(o, "SWITCH")); + + if (new_switch_type == INFINITE) + { + c->Write(c, _UU("CMD_LogEnable_Prompt_Error")); + FreeParamValueList(o); + return ERR_INVALID_PARAMETER; + } + + Zero(&t, sizeof(t)); + + StrCpy(t.HubName, sizeof(t.HubName), ps->HubName); + + // RPC call + ret = ScGetHubLog(ps->Rpc, &t); + if (ret != ERR_NO_ERROR) + { + // An error has occured + CmdPrintError(c, ret); + FreeParamValueList(o); + return ret; + } + + if (packet_log == false) + { + t.LogSetting.SecurityLogSwitchType = new_switch_type; + } + else + { + t.LogSetting.PacketLogSwitchType = new_switch_type; + } + + // RPC call + ret = ScSetHubLog(ps->Rpc, &t); + if (ret != ERR_NO_ERROR) + { + // An error has occured + CmdPrintError(c, ret); + FreeParamValueList(o); + return ret; + } + + FreeParamValueList(o); + + return 0; +} + +// Convert the type string of the packet log contents to an integer +UINT StrToPacketLogSaveInfoType(char *str) +{ + UINT ret = INFINITE; + if (str == NULL) + { + return INFINITE; + } + + if (StartWith("none", str) || IsEmptyStr(str)) + { + ret = PACKET_LOG_NONE; + } + else if (StartWith("header", str)) + { + ret = PACKET_LOG_HEADER; + } + else if (StartWith("full", str) || StartWith("all", str)) + { + ret = PACKET_LOG_ALL; + } + + return ret; +} + +// Convert a packet type string of the packet log to an integer +UINT StrToPacketLogType(char *str) +{ + UINT ret = INFINITE; + if (str == NULL || IsEmptyStr(str)) + { + return INFINITE; + } + + if (StartWith("tcpconn", str)) + { + ret = PACKET_LOG_TCP_CONN; + } + else if (StartWith("tcpdata", str)) + { + ret = PACKET_LOG_TCP; + } + else if (StartWith("dhcp", str)) + { + ret = PACKET_LOG_DHCP; + } + else if (StartWith("udp", str)) + { + ret = PACKET_LOG_UDP; + } + else if (StartWith("icmp", str)) + { + ret = PACKET_LOG_ICMP; + } + else if (StartWith("ip", str)) + { + ret = PACKET_LOG_IP; + } + else if (StartWith("arp", str)) + { + ret = PACKET_LOG_ARP; + } + else if (StartWith("ethernet", str)) + { + ret = PACKET_LOG_ETHERNET; + } + + return ret; +} + +// Set the detail level and type of packet to be stored in the packet log +UINT PsLogPacketSaveType(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) +{ + LIST *o; + PS *ps = (PS *)param; + UINT ret = 0; + RPC_HUB_LOG t; + UINT packet_type = INFINITE; + UINT packet_save_info_type = INFINITE; + // Parameter list that can be specified + PARAM args[] = + { + {"TYPE", CmdPrompt, _UU("CMD_LogPacketSaveType_Prompt_TYPE"), NULL, NULL}, + {"SAVE", CmdPrompt, _UU("CMD_LogPacketSaveType_Prompt_SAVE"), NULL, NULL}, + }; + + // If virtual HUB is not selected, it's an error + if (ps->HubName == NULL) + { + c->Write(c, _UU("CMD_Hub_Not_Selected")); + return ERR_INVALID_PARAMETER; + } + + o = ParseCommandList(c, cmd_name, str, args, sizeof(args) / sizeof(args[0])); + if (o == NULL) + { + return ERR_INVALID_PARAMETER; + } + + packet_type = StrToPacketLogType(GetParamStr(o, "TYPE")); + packet_save_info_type = StrToPacketLogSaveInfoType(GetParamStr(o, "SAVE")); + + if (packet_type == INFINITE || packet_save_info_type == INFINITE) + { + c->Write(c, _UU("CMD_LogEnable_Prompt_Error")); + FreeParamValueList(o); + return ERR_INVALID_PARAMETER; + } + + Zero(&t, sizeof(t)); + + StrCpy(t.HubName, sizeof(t.HubName), ps->HubName); + + // RPC call + ret = ScGetHubLog(ps->Rpc, &t); + if (ret != ERR_NO_ERROR) + { + // An error has occured + CmdPrintError(c, ret); + FreeParamValueList(o); + return ret; + } + + t.LogSetting.PacketLogConfig[packet_type] = packet_save_info_type; + + // RPC call + ret = ScSetHubLog(ps->Rpc, &t); + if (ret != ERR_NO_ERROR) + { + // An error has occured + CmdPrintError(c, ret); + FreeParamValueList(o); + return ret; + } + + FreeParamValueList(o); + + return 0; +} + +// Get the list of certificates of the trusted certification authority +UINT PsCAList(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) +{ + LIST *o; + PS *ps = (PS *)param; + UINT ret = 0; + RPC_HUB_ENUM_CA t; + + // If virtual HUB is not selected, it's an error + if (ps->HubName == NULL) + { + c->Write(c, _UU("CMD_Hub_Not_Selected")); + return ERR_INVALID_PARAMETER; + } + + o = ParseCommandList(c, cmd_name, str, NULL, 0); + if (o == NULL) + { + return ERR_INVALID_PARAMETER; + } + + Zero(&t, sizeof(t)); + + StrCpy(t.HubName, sizeof(t.HubName), ps->HubName); + + // RPC call + ret = ScEnumCa(ps->Rpc, &t); + + if (ret != ERR_NO_ERROR) + { + // An error has occured + CmdPrintError(c, ret); + FreeParamValueList(o); + return ret; + } + else + { + UINT i; + CT *ct = CtNewStandard(); + + for (i = 0;i < t.NumCa;i++) + { + wchar_t tmp[MAX_SIZE]; + wchar_t tmp2[64]; + RPC_HUB_ENUM_CA_ITEM *e = &t.Ca[i]; + + GetDateStrEx64(tmp, sizeof(tmp), SystemToLocal64(e->Expires), NULL); + + UniToStru(tmp2, e->Key); + + CtInsert(ct, _UU("CMD_CAList_COLUMN_ID"), tmp2); + CtInsert(ct, _UU("CM_CERT_COLUMN_1"), e->SubjectName); + CtInsert(ct, _UU("CM_CERT_COLUMN_2"), e->IssuerName); + CtInsert(ct, _UU("CM_CERT_COLUMN_3"), tmp); + + if (i != (t.NumCa - 1)) + { + CtInsert(ct, L"---", L"---"); + } + } + + CtFree(ct, c); + } + + FreeRpcHubEnumCa(&t); + + FreeParamValueList(o); + + return 0; +} + +// Add a certificate to the trusted certification authority +UINT PsCAAdd(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) +{ + LIST *o; + PS *ps = (PS *)param; + UINT ret = 0; + RPC_HUB_ADD_CA t; + X *x; + // Parameter list that can be specified + PARAM args[] = + { + // "name", prompt_proc, prompt_param, eval_proc, eval_param + {"[path]", CmdPrompt, _UU("CMD_CAAdd_PROMPT_PATH"), CmdEvalIsFile, NULL}, + }; + + // If virtual HUB is not selected, it's an error + if (ps->HubName == NULL) + { + c->Write(c, _UU("CMD_Hub_Not_Selected")); + return ERR_INVALID_PARAMETER; + } + + o = ParseCommandList(c, cmd_name, str, args, sizeof(args) / sizeof(args[0])); + if (o == NULL) + { + return ERR_INVALID_PARAMETER; + } + + x = FileToXW(GetParamUniStr(o, "[path]")); + + if (x == NULL) + { + FreeParamValueList(o); + c->Write(c, _UU("CMD_MSG_LOAD_CERT_FAILED")); + return ERR_INVALID_PARAMETER; + } + + Zero(&t, sizeof(t)); + StrCpy(t.HubName, sizeof(t.HubName), ps->HubName); + t.Cert = x; + + // RPC call + ret = ScAddCa(ps->Rpc, &t); + + if (ret != ERR_NO_ERROR) + { + // An error has occured + CmdPrintError(c, ret); + FreeParamValueList(o); + return ret; + } + + FreeRpcHubAddCa(&t); + + FreeParamValueList(o); + + return 0; +} + +// Delete the certificate of the trusted certification authority +UINT PsCADelete(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) +{ + LIST *o; + PS *ps = (PS *)param; + UINT ret = 0; + RPC_HUB_DELETE_CA t; + // Parameter list that can be specified + PARAM args[] = + { + // "name", prompt_proc, prompt_param, eval_proc, eval_param + {"[id]", CmdPrompt, _UU("CMD_CADelete_PROMPT_ID"), CmdEvalNotEmpty, NULL}, + }; + + // If virtual HUB is not selected, it's an error + if (ps->HubName == NULL) + { + c->Write(c, _UU("CMD_Hub_Not_Selected")); + return ERR_INVALID_PARAMETER; + } + + o = ParseCommandList(c, cmd_name, str, args, sizeof(args) / sizeof(args[0])); + if (o == NULL) + { + return ERR_INVALID_PARAMETER; + } + + Zero(&t, sizeof(t)); + StrCpy(t.HubName, sizeof(t.HubName), ps->HubName); + t.Key = GetParamInt(o, "[id]"); + + // RPC call + ret = ScDeleteCa(ps->Rpc, &t); + + if (ret != ERR_NO_ERROR) + { + // An error has occured + CmdPrintError(c, ret); + FreeParamValueList(o); + return ret; + } + + FreeParamValueList(o); + + return 0; +} + +// Get the certificate of the trusted certification authority +UINT PsCAGet(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) +{ + LIST *o; + PS *ps = (PS *)param; + UINT ret = 0; + RPC_HUB_GET_CA t; + // Parameter list that can be specified + PARAM args[] = + { + // "name", prompt_proc, prompt_param, eval_proc, eval_param + {"[id]", CmdPrompt, _UU("CMD_CAGet_PROMPT_ID"), CmdEvalNotEmpty, NULL}, + {"SAVECERT", CmdPrompt, _UU("CMD_CAGet_PROMPT_SAVECERT"), CmdEvalNotEmpty, NULL}, + }; + + // If virtual HUB is not selected, it's an error + if (ps->HubName == NULL) + { + c->Write(c, _UU("CMD_Hub_Not_Selected")); + return ERR_INVALID_PARAMETER; + } + + o = ParseCommandList(c, cmd_name, str, args, sizeof(args) / sizeof(args[0])); + if (o == NULL) + { + return ERR_INVALID_PARAMETER; + } + + Zero(&t, sizeof(t)); + StrCpy(t.HubName, sizeof(t.HubName), ps->HubName); + t.Key = GetParamInt(o, "[id]"); + + // RPC call + ret = ScGetCa(ps->Rpc, &t); + + if (ret != ERR_NO_ERROR) + { + // An error has occured + CmdPrintError(c, ret); + FreeParamValueList(o); + return ret; + } + else + { + if (XToFileW(t.Cert, GetParamUniStr(o, "SAVECERT"), true)) + { + // Success + } + else + { + ret = ERR_INTERNAL_ERROR; + c->Write(c, _UU("CMD_MSG_SAVE_CERT_FAILED")); + } + } + + FreeRpcHubGetCa(&t); + + FreeParamValueList(o); + + return ret; +} + +// Get the cascade connection list +UINT PsCascadeList(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) +{ + LIST *o; + PS *ps = (PS *)param; + UINT ret = 0; + RPC_ENUM_LINK t; + + // If virtual HUB is not selected, it's an error + if (ps->HubName == NULL) + { + c->Write(c, _UU("CMD_Hub_Not_Selected")); + return ERR_INVALID_PARAMETER; + } + + o = ParseCommandList(c, cmd_name, str, NULL, 0); + if (o == NULL) + { + return ERR_INVALID_PARAMETER; + } + + Zero(&t, sizeof(t)); + StrCpy(t.HubName, sizeof(t.HubName), ps->HubName); + + // RPC call + ret = ScEnumLink(ps->Rpc, &t); + + if (ret != ERR_NO_ERROR) + { + // An error has occured + CmdPrintError(c, ret); + FreeParamValueList(o); + return ret; + } + else + { + CT *ct = CtNew(); + UINT i; + + CtInsertColumn(ct, _UU("SM_LINK_COLUMN_1"), false); + CtInsertColumn(ct, _UU("SM_LINK_COLUMN_2"), false); + CtInsertColumn(ct, _UU("SM_LINK_COLUMN_3"), false); + CtInsertColumn(ct, _UU("SM_LINK_COLUMN_4"), false); + CtInsertColumn(ct, _UU("SM_LINK_COLUMN_5"), false); + + for (i = 0;i < t.NumLink;i++) + { + RPC_ENUM_LINK_ITEM *e = &t.Links[i]; + wchar_t tmp1[MAX_SIZE]; + wchar_t tmp2[MAX_SIZE]; + wchar_t tmp3[MAX_SIZE]; + wchar_t tmp4[MAX_SIZE]; + + GetDateTimeStrEx64(tmp1, sizeof(tmp1), SystemToLocal64(e->ConnectedTime), NULL); + StrToUni(tmp2, sizeof(tmp2), e->Hostname); + StrToUni(tmp3, sizeof(tmp3), e->HubName); + + if (e->Online == false) + { + UniStrCpy(tmp4, sizeof(tmp4), _UU("SM_LINK_STATUS_OFFLINE")); + } + else + { + if (e->Connected) + { + UniStrCpy(tmp4, sizeof(tmp4), _UU("SM_LINK_STATUS_ONLINE")); + } + else + { + if (e->LastError != 0) + { + UniFormat(tmp4, sizeof(tmp4), _UU("SM_LINK_STATUS_ERROR"), e->LastError, _E(e->LastError)); + } + else + { + UniStrCpy(tmp4, sizeof(tmp4), _UU("SM_LINK_CONNECTING")); + } + } + } + + CtInsert(ct, e->AccountName, tmp4, tmp1, tmp2, tmp3); + } + + CtFreeEx(ct, c, true); + } + + FreeRpcEnumLink(&t); + + FreeParamValueList(o); + + return 0; +} + +// Creat a new cascade +UINT PsCascadeCreate(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) +{ + LIST *o; + PS *ps = (PS *)param; + UINT ret = 0; + RPC_CREATE_LINK t; + char *host = NULL; + UINT port = 443; + // Parameter list that can be specified + PARAM args[] = + { + // "name", prompt_proc, prompt_param, eval_proc, eval_param + {"[name]", CmdPrompt, _UU("CMD_CascadeCreate_Prompt_Name"), CmdEvalNotEmpty, NULL}, + {"SERVER", CmdPrompt, _UU("CMD_CascadeCreate_Prompt_Server"), CmdEvalHostAndPort, NULL}, + {"HUB", CmdPrompt, _UU("CMD_CascadeCreate_Prompt_Hub"), CmdEvalSafe, NULL}, + {"USERNAME", CmdPrompt, _UU("CMD_CascadeCreate_Prompt_Username"), CmdEvalNotEmpty, NULL}, + }; + + // If virtual HUB is not selected, it's an error + if (ps->HubName == NULL) + { + c->Write(c, _UU("CMD_Hub_Not_Selected")); + return ERR_INVALID_PARAMETER; + } + + o = ParseCommandList(c, cmd_name, str, args, sizeof(args) / sizeof(args[0])); + if (o == NULL) + { + return ERR_INVALID_PARAMETER; + } + + ParseHostPort(GetParamStr(o, "SERVER"), &host, &port, 443); + + Zero(&t, sizeof(t)); + StrCpy(t.HubName, sizeof(t.HubName), ps->HubName); + + t.Online = false; + + Copy(&t.Policy, GetDefaultPolicy(), sizeof(POLICY)); + + t.ClientOption = ZeroMalloc(sizeof(CLIENT_OPTION)); + UniStrCpy(t.ClientOption->AccountName, sizeof(t.ClientOption->AccountName), GetParamUniStr(o, "[name]")); + t.ClientOption->Port = port; + StrCpy(t.ClientOption->Hostname, sizeof(t.ClientOption->Hostname), host); + StrCpy(t.ClientOption->HubName, sizeof(t.ClientOption->HubName), GetParamStr(o, "HUB")); + t.ClientOption->NumRetry = INFINITE; + t.ClientOption->RetryInterval = 15; + t.ClientOption->MaxConnection = 8; + t.ClientOption->UseEncrypt = true; + t.ClientOption->AdditionalConnectionInterval = 1; + t.ClientOption->RequireBridgeRoutingMode = true; + + t.ClientAuth = ZeroMalloc(sizeof(CLIENT_AUTH)); + t.ClientAuth->AuthType = CLIENT_AUTHTYPE_ANONYMOUS; + StrCpy(t.ClientAuth->Username, sizeof(t.ClientAuth->Username), GetParamStr(o, "USERNAME")); + + Free(host); + + // RPC call + ret = ScCreateLink(ps->Rpc, &t); + + if (ret != ERR_NO_ERROR) + { + // An error has occured + CmdPrintError(c, ret); + FreeParamValueList(o); + return ret; + } + + FreeRpcCreateLink(&t); + + FreeParamValueList(o); + + return 0; +} + +// Set the user name and destination of the cascade connection +UINT PsCascadeSet(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) +{ + LIST *o; + PS *ps = (PS *)param; + UINT ret = 0; + RPC_CREATE_LINK t; + char *host = NULL; + UINT port = 443; + // Parameter list that can be specified + PARAM args[] = + { + // "name", prompt_proc, prompt_param, eval_proc, eval_param + {"[name]", CmdPrompt, _UU("CMD_CascadeCreate_Prompt_Name"), CmdEvalNotEmpty, NULL}, + {"SERVER", CmdPrompt, _UU("CMD_CascadeCreate_Prompt_Server"), CmdEvalHostAndPort, NULL}, + {"HUB", CmdPrompt, _UU("CMD_CascadeCreate_Prompt_Hub"), CmdEvalSafe, NULL}, + }; + + // If virtual HUB is not selected, it's an error + if (ps->HubName == NULL) + { + c->Write(c, _UU("CMD_Hub_Not_Selected")); + return ERR_INVALID_PARAMETER; + } + + o = ParseCommandList(c, cmd_name, str, args, sizeof(args) / sizeof(args[0])); + if (o == NULL) + { + return ERR_INVALID_PARAMETER; + } + + ParseHostPort(GetParamStr(o, "SERVER"), &host, &port, 443); + + Zero(&t, sizeof(t)); + StrCpy(t.HubName, sizeof(t.HubName), ps->HubName); + + t.ClientOption = ZeroMalloc(sizeof(CLIENT_OPTION)); + UniStrCpy(t.ClientOption->AccountName, sizeof(t.ClientOption->AccountName), GetParamUniStr(o, "[name]")); + + ret = ScGetLink(ps->Rpc, &t); + if (ret != ERR_NO_ERROR) + { + // An error has occured + CmdPrintError(c, ret); + FreeParamValueList(o); + Free(host); + return ret; + } + + t.ClientOption->Port = port; + StrCpy(t.ClientOption->Hostname, sizeof(t.ClientOption->Hostname), host); + StrCpy(t.ClientOption->HubName, sizeof(t.ClientOption->HubName), GetParamStr(o, "HUB")); + + Free(host); + + // RPC call + ret = ScSetLink(ps->Rpc, &t); + + if (ret != ERR_NO_ERROR) + { + // An error has occured + CmdPrintError(c, ret); + FreeParamValueList(o); + return ret; + } + + FreeRpcCreateLink(&t); + + FreeParamValueList(o); + + return 0; +} + +// Get the type string of proxy +wchar_t *GetProxyTypeStr(UINT i) +{ + switch (i) + { + case PROXY_DIRECT: + + return _UU("PROTO_DIRECT_TCP"); + + case PROXY_HTTP: + return _UU("PROTO_HTTP_PROXY"); + + case PROXY_SOCKS: + return _UU("PROTO_SOCKS_PROXY"); + + default: + return _UU("PROTO_UNKNOWN"); + } +} + +// Get type string in user authentication for client +wchar_t *GetClientAuthTypeStr(UINT i) +{ + char tmp[MAX_SIZE]; + + Format(tmp, sizeof(tmp), "PW_TYPE_%u", i); + + return _UU(tmp); +} + +// Get the setting of cascade connection +UINT PsCascadeGet(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) +{ + LIST *o; + PS *ps = (PS *)param; + UINT ret = 0; + RPC_CREATE_LINK t; + // Parameter list that can be specified + PARAM args[] = + { + // "name", prompt_proc, prompt_param, eval_proc, eval_param + {"[name]", CmdPrompt, _UU("CMD_CascadeCreate_Prompt_Name"), CmdEvalNotEmpty, NULL}, + }; + + // If virtual HUB is not selected, it's an error + if (ps->HubName == NULL) + { + c->Write(c, _UU("CMD_Hub_Not_Selected")); + return ERR_INVALID_PARAMETER; + } + + o = ParseCommandList(c, cmd_name, str, args, sizeof(args) / sizeof(args[0])); + if (o == NULL) + { + return ERR_INVALID_PARAMETER; + } + + Zero(&t, sizeof(t)); + StrCpy(t.HubName, sizeof(t.HubName), ps->HubName); + t.ClientOption = ZeroMalloc(sizeof(CLIENT_OPTION)); + UniStrCpy(t.ClientOption->AccountName, sizeof(t.ClientOption->AccountName), + GetParamUniStr(o, "[name]")); + + // RPC call + ret = ScGetLink(ps->Rpc, &t); + + if (ret != ERR_NO_ERROR) + { + // An error has occured + CmdPrintError(c, ret); + FreeParamValueList(o); + return ret; + } + else + { + // Show the contents of the connection settings + wchar_t tmp[MAX_SIZE]; + + CT *ct = CtNewStandard(); + + // Connection settings name + CtInsert(ct, _UU("CMD_ACCOUNT_COLUMN_NAME"), t.ClientOption->AccountName); + + // Host name of the destination VPN Server + StrToUni(tmp, sizeof(tmp), t.ClientOption->Hostname); + CtInsert(ct, _UU("CMD_ACCOUNT_COLUMN_HOSTNAME"), tmp); + + // The port number to connect to VPN Server + UniToStru(tmp, t.ClientOption->Port); + CtInsert(ct, _UU("CMD_ACCOUNT_COLUMN_PORT"), tmp); + + // Virtual HUB name of the destination VPN Server + StrToUni(tmp, sizeof(tmp), t.ClientOption->HubName); + CtInsert(ct, _UU("CMD_ACCOUNT_COLUMN_HUBNAME"), tmp); + + // Type of proxy server to go through + CtInsert(ct, _UU("CMD_ACCOUNT_COLUMN_PROXY_TYPE"), GetProxyTypeStr(t.ClientOption->ProxyType)); + + if (t.ClientOption->ProxyType != PROXY_DIRECT) + { + // Host name of the proxy server + StrToUni(tmp, sizeof(tmp), t.ClientOption->ProxyName); + CtInsert(ct, _UU("CMD_ACCOUNT_COLUMN_PROXY_HOSTNAME"), tmp); + + // Port number of the proxy server + UniToStru(tmp, t.ClientOption->ProxyPort); + CtInsert(ct, _UU("CMD_ACCOUNT_COLUMN_PROXY_PORT"), tmp); + + // User name of the proxy server + StrToUni(tmp, sizeof(tmp), t.ClientOption->ProxyUsername); + CtInsert(ct, _UU("CMD_ACCOUNT_COLUMN_PROXY_USERNAME"), tmp); + } + + // To verify the server certificate + CtInsert(ct, _UU("CMD_ACCOUNT_COLUMN_SERVER_CERT_USE"), + t.CheckServerCert ? _UU("CMD_MSG_ENABLE") : _UU("CMD_MSG_DISABLE")); + + // Registered specific certificate + if (t.ServerCert != NULL) + { + GetAllNameFromX(tmp, sizeof(tmp), t.ServerCert); + CtInsert(ct, _UU("CMD_ACCOUNT_COLUMN_SERVER_CERT_NAME"), tmp); + } + + // Device name to be used for the connection + StrToUni(tmp, sizeof(tmp), t.ClientOption->DeviceName); + CtInsert(ct, _UU("CMD_ACCOUNT_COLUMN_DEVICE_NAME"), tmp); + + // Authentication type + CtInsert(ct, _UU("CMD_ACCOUNT_COLUMN_AUTH_TYPE"), GetClientAuthTypeStr(t.ClientAuth->AuthType)); + + // User name + StrToUni(tmp, sizeof(tmp), t.ClientAuth->Username); + CtInsert(ct, _UU("CMD_ACCOUNT_COLUMN_AUTH_USERNAME"), tmp); + + if (t.ClientAuth->AuthType == CLIENT_AUTHTYPE_CERT) + { + if (t.ClientAuth->ClientX != NULL) + { + // Client certificate name + GetAllNameFromX(tmp, sizeof(tmp), t.ClientAuth->ClientX); + CtInsert(ct, _UU("CMD_ACCOUNT_COLUMN_AUTH_CERT_NAME"), tmp); + } + } + + // Number of TCP connections to be used for VPN communication + UniToStru(tmp, t.ClientOption->MaxConnection); + CtInsert(ct, _UU("CMD_ACCOUNT_COLUMN_NUMTCP"), tmp); + + // Establishment interval of each TCP connection + UniToStru(tmp, t.ClientOption->AdditionalConnectionInterval); + CtInsert(ct, _UU("CMD_ACCOUNT_COLUMN_TCP_INTERVAL"), tmp); + + // Life span of each TCP connection + if (t.ClientOption->ConnectionDisconnectSpan != 0) + { + UniToStru(tmp, t.ClientOption->ConnectionDisconnectSpan); + } + else + { + UniStrCpy(tmp, sizeof(tmp), _UU("CMD_MSG_INFINITE")); + } + CtInsert(ct, _UU("CMD_ACCOUNT_COLUMN_TCP_TTL"), tmp); + + // Use of half-duplex mode + CtInsert(ct, _UU("CMD_ACCOUNT_COLUMN_TCP_HALF"), + t.ClientOption->HalfConnection ? _UU("CMD_MSG_ENABLE") : _UU("CMD_MSG_DISABLE")); + + // Encryption by SSL + CtInsert(ct, _UU("CMD_ACCOUNT_COLUMN_ENCRYPT"), + t.ClientOption->UseEncrypt ? _UU("CMD_MSG_ENABLE") : _UU("CMD_MSG_DISABLE")); + + // Data compression + CtInsert(ct, _UU("CMD_ACCOUNT_COLUMN_COMPRESS"), + t.ClientOption->UseCompress ? _UU("CMD_MSG_ENABLE") : _UU("CMD_MSG_DISABLE")); + + // Connect in bridge / router mode + CtInsert(ct, _UU("CMD_ACCOUNT_COLUMN_BRIDGE_ROUTER"), + t.ClientOption->RequireBridgeRoutingMode ? _UU("CMD_MSG_ENABLE") : _UU("CMD_MSG_DISABLE")); + + // Connect in monitoring mode + CtInsert(ct, _UU("CMD_ACCOUNT_COLUMN_MONITOR"), + t.ClientOption->RequireMonitorMode ? _UU("CMD_MSG_ENABLE") : _UU("CMD_MSG_DISABLE")); + + // Not to rewrite the routing table + CtInsert(ct, _UU("CMD_ACCOUNT_COLUMN_NO_TRACKING"), + t.ClientOption->NoRoutingTracking ? _UU("CMD_MSG_ENABLE") : _UU("CMD_MSG_DISABLE")); + + // Disable the QoS control + CtInsert(ct, _UU("CMD_ACCOUNT_COLUMN_QOS_DISABLE"), + t.ClientOption->DisableQoS ? _UU("CMD_MSG_ENABLE") : _UU("CMD_MSG_DISABLE")); + + CtFree(ct, c); + + // Security policy + c->Write(c, L""); + c->Write(c, _UU("CMD_CascadeGet_Policy")); + PrintPolicy(c, &t.Policy, true); + } + + FreeRpcCreateLink(&t); + + FreeParamValueList(o); + + return 0; +} + +// Delete the cascade connection +UINT PsCascadeDelete(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) +{ + LIST *o; + PS *ps = (PS *)param; + UINT ret = 0; + RPC_LINK t; + // Parameter list that can be specified + PARAM args[] = + { + {"[name]", CmdPrompt, _UU("CMD_CascadeCreate_Prompt_Name"), CmdEvalNotEmpty, NULL}, + }; + + // If virtual HUB is not selected, it's an error + if (ps->HubName == NULL) + { + c->Write(c, _UU("CMD_Hub_Not_Selected")); + return ERR_INVALID_PARAMETER; + } + + o = ParseCommandList(c, cmd_name, str, args, sizeof(args) / sizeof(args[0])); + if (o == NULL) + { + return ERR_INVALID_PARAMETER; + } + + Zero(&t, sizeof(t)); + UniStrCpy(t.AccountName, sizeof(t.AccountName), GetParamUniStr(o, "[name]")); + StrCpy(t.HubName, sizeof(t.HubName), ps->HubName); + + // RPC call + ret = ScDeleteLink(ps->Rpc, &t); + + if (ret != ERR_NO_ERROR) + { + // An error has occured + CmdPrintError(c, ret); + FreeParamValueList(o); + return ret; + } + + FreeParamValueList(o); + + return 0; +} + +// Set the user name to use for the cascade connection +UINT PsCascadeUsernameSet(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) +{ + LIST *o; + PS *ps = (PS *)param; + UINT ret = 0; + RPC_CREATE_LINK t; + // Parameter list that can be specified + PARAM args[] = + { + {"[name]", CmdPrompt, _UU("CMD_CascadeCreate_Prompt_Name"), CmdEvalNotEmpty, NULL}, + {"USERNAME", CmdPrompt, _UU("CMD_CascadeCreate_Prompt_Username"), CmdEvalNotEmpty, NULL}, + }; + + // If virtual HUB is not selected, it's an error + if (ps->HubName == NULL) + { + c->Write(c, _UU("CMD_Hub_Not_Selected")); + return ERR_INVALID_PARAMETER; + } + + o = ParseCommandList(c, cmd_name, str, args, sizeof(args) / sizeof(args[0])); + if (o == NULL) + { + return ERR_INVALID_PARAMETER; + } + + Zero(&t, sizeof(t)); + StrCpy(t.HubName, sizeof(t.HubName), ps->HubName); + t.ClientOption = ZeroMalloc(sizeof(CLIENT_OPTION)); + UniStrCpy(t.ClientOption->AccountName, sizeof(t.ClientOption->AccountName), GetParamUniStr(o, "[name]")); + + // RPC call + ret = ScGetLink(ps->Rpc, &t); + + if (ret != ERR_NO_ERROR) + { + // An error has occured + CmdPrintError(c, ret); + FreeParamValueList(o); + return ret; + } + else + { + // Change the settings for the cascade connection + StrCpy(t.ClientAuth->Username, sizeof(t.ClientAuth->Username), + GetParamStr(o, "USERNAME")); + + if (t.ClientAuth->AuthType == CLIENT_AUTHTYPE_PASSWORD) + { + c->Write(c, _UU("CMD_CascadeUsername_Notice")); + } + + ret = ScSetLink(ps->Rpc, &t); + if (ret != ERR_NO_ERROR) + { + // An error has occured + CmdPrintError(c, ret); + FreeParamValueList(o); + return ret; + } + + FreeRpcCreateLink(&t); + } + + FreeParamValueList(o); + + return 0; +} + +//Set the type of user authentication of cascade connection to the anonymous authentication +UINT PsCascadeAnonymousSet(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) +{ + LIST *o; + PS *ps = (PS *)param; + UINT ret = 0; + RPC_CREATE_LINK t; + // Parameter list that can be specified + PARAM args[] = + { + {"[name]", CmdPrompt, _UU("CMD_CascadeCreate_Prompt_Name"), CmdEvalNotEmpty, NULL}, + }; + + // If virtual HUB is not selected, it's an error + if (ps->HubName == NULL) + { + c->Write(c, _UU("CMD_Hub_Not_Selected")); + return ERR_INVALID_PARAMETER; + } + + o = ParseCommandList(c, cmd_name, str, args, sizeof(args) / sizeof(args[0])); + if (o == NULL) + { + return ERR_INVALID_PARAMETER; + } + + Zero(&t, sizeof(t)); + StrCpy(t.HubName, sizeof(t.HubName), ps->HubName); + t.ClientOption = ZeroMalloc(sizeof(CLIENT_OPTION)); + UniStrCpy(t.ClientOption->AccountName, sizeof(t.ClientOption->AccountName), GetParamUniStr(o, "[name]")); + + // RPC call + ret = ScGetLink(ps->Rpc, &t); + + if (ret != ERR_NO_ERROR) + { + // An error has occured + CmdPrintError(c, ret); + FreeParamValueList(o); + return ret; + } + else + { + // Change the settings for the cascade connection + t.ClientAuth->AuthType = CLIENT_AUTHTYPE_ANONYMOUS; + + ret = ScSetLink(ps->Rpc, &t); + if (ret != ERR_NO_ERROR) + { + // An error has occured + CmdPrintError(c, ret); + FreeParamValueList(o); + return ret; + } + + FreeRpcCreateLink(&t); + } + + FreeParamValueList(o); + + return 0; +} + +// Set the type of user authentication of cascade connection to the password authentication +UINT PsCascadePasswordSet(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) +{ + LIST *o; + PS *ps = (PS *)param; + UINT ret = 0; + RPC_CREATE_LINK t; + // Parameter list that can be specified + PARAM args[] = + { + {"[name]", CmdPrompt, _UU("CMD_CascadeCreate_Prompt_Name"), CmdEvalNotEmpty, NULL}, + {"PASSWORD", CmdPromptChoosePassword, NULL, NULL, NULL}, + {"TYPE", CmdPrompt, _UU("CMD_CascadePasswordSet_Prompt_Type"), CmdEvalNotEmpty, NULL}, + }; + + // If virtual HUB is not selected, it's an error + if (ps->HubName == NULL) + { + c->Write(c, _UU("CMD_Hub_Not_Selected")); + return ERR_INVALID_PARAMETER; + } + + o = ParseCommandList(c, cmd_name, str, args, sizeof(args) / sizeof(args[0])); + if (o == NULL) + { + return ERR_INVALID_PARAMETER; + } + + Zero(&t, sizeof(t)); + StrCpy(t.HubName, sizeof(t.HubName), ps->HubName); + t.ClientOption = ZeroMalloc(sizeof(CLIENT_OPTION)); + UniStrCpy(t.ClientOption->AccountName, sizeof(t.ClientOption->AccountName), GetParamUniStr(o, "[name]")); + + // RPC call + ret = ScGetLink(ps->Rpc, &t); + + if (ret != ERR_NO_ERROR) + { + // An error has occured + CmdPrintError(c, ret); + FreeParamValueList(o); + return ret; + } + else + { + // Change the settings for the cascade connection + char *typestr = GetParamStr(o, "TYPE"); + + if (StartWith("standard", typestr)) + { + t.ClientAuth->AuthType = CLIENT_AUTHTYPE_PASSWORD; + HashPassword(t.ClientAuth->HashedPassword, t.ClientAuth->Username, + GetParamStr(o, "PASSWORD")); + } + else if (StartWith("radius", typestr) || StartWith("ntdomain", typestr)) + { + t.ClientAuth->AuthType = CLIENT_AUTHTYPE_PLAIN_PASSWORD; + + StrCpy(t.ClientAuth->PlainPassword, sizeof(t.ClientAuth->PlainPassword), + GetParamStr(o, "PASSWORD")); + } + else + { + // An error has occured + c->Write(c, _UU("CMD_CascadePasswordSet_Type_Invalid")); + FreeRpcCreateLink(&t); + ret = ERR_INVALID_PARAMETER; + CmdPrintError(c, ret); + FreeParamValueList(o); + return ERR_INTERNAL_ERROR; + } + + ret = ScSetLink(ps->Rpc, &t); + if (ret != ERR_NO_ERROR) + { + // An error has occured + CmdPrintError(c, ret); + FreeParamValueList(o); + return ret; + } + + FreeRpcCreateLink(&t); + } + + FreeParamValueList(o); + + return 0; +} + +// Set the type of user authentication of cascade connection to the client certificate authentication +UINT PsCascadeCertSet(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) +{ + LIST *o; + PS *ps = (PS *)param; + UINT ret = 0; + RPC_CREATE_LINK t; + X *x; + K *k; + // Parameter list that can be specified + PARAM args[] = + { + // "name", prompt_proc, prompt_param, eval_proc, eval_param + {"[name]", CmdPrompt, _UU("CMD_CascadeCreate_Prompt_Name"), CmdEvalNotEmpty, NULL}, + {"LOADCERT", CmdPrompt, _UU("CMD_LOADCERTPATH"), CmdEvalIsFile, NULL}, + {"LOADKEY", CmdPrompt, _UU("CMD_LOADKEYPATH"), CmdEvalIsFile, NULL}, + }; + + // If virtual HUB is not selected, it's an error + if (ps->HubName == NULL) + { + c->Write(c, _UU("CMD_Hub_Not_Selected")); + return ERR_INVALID_PARAMETER; + } + + o = ParseCommandList(c, cmd_name, str, args, sizeof(args) / sizeof(args[0])); + if (o == NULL) + { + return ERR_INVALID_PARAMETER; + } + + if (CmdLoadCertAndKey(c, &x, &k, GetParamUniStr(o, "LOADCERT"), GetParamUniStr(o, "LOADKEY")) == false) + { + return ERR_INTERNAL_ERROR; + } + + Zero(&t, sizeof(t)); + StrCpy(t.HubName, sizeof(t.HubName), ps->HubName); + t.ClientOption = ZeroMalloc(sizeof(CLIENT_OPTION)); + UniStrCpy(t.ClientOption->AccountName, sizeof(t.ClientOption->AccountName), GetParamUniStr(o, "[name]")); + + // RPC call + ret = ScGetLink(ps->Rpc, &t); + + if (ret != ERR_NO_ERROR) + { + // An error has occured + FreeX(x); + FreeK(k); + CmdPrintError(c, ret); + FreeParamValueList(o); + return ret; + } + else + { + // Change authentication data + t.ClientAuth->AuthType = CLIENT_AUTHTYPE_CERT; + if (t.ClientAuth->ClientX != NULL) + { + FreeX(t.ClientAuth->ClientX); + } + if (t.ClientAuth->ClientK != NULL) + { + FreeK(t.ClientAuth->ClientK); + } + + t.ClientAuth->ClientX = x; + t.ClientAuth->ClientK = k; + + ret = ScSetLink(ps->Rpc, &t); + if (ret != ERR_NO_ERROR) + { + // An error has occured + CmdPrintError(c, ret); + FreeParamValueList(o); + return ret; + } + + FreeRpcCreateLink(&t); + } + + FreeParamValueList(o); + + return 0; +} + +// Get the client certificate to be used in the cascade connection +UINT PsCascadeCertGet(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) +{ + LIST *o; + PS *ps = (PS *)param; + UINT ret = 0; + RPC_CREATE_LINK t; + // Parameter list that can be specified + PARAM args[] = + { + // "name", prompt_proc, prompt_param, eval_proc, eval_param + {"[name]", CmdPrompt, _UU("CMD_CascadeCreate_Prompt_Name"), CmdEvalNotEmpty, NULL}, + {"SAVECERT", CmdPrompt, _UU("CMD_SAVECERTPATH"), CmdEvalNotEmpty, NULL}, + }; + + // If virtual HUB is not selected, it's an error + if (ps->HubName == NULL) + { + c->Write(c, _UU("CMD_Hub_Not_Selected")); + return ERR_INVALID_PARAMETER; + } + + o = ParseCommandList(c, cmd_name, str, args, sizeof(args) / sizeof(args[0])); + if (o == NULL) + { + return ERR_INVALID_PARAMETER; + } + + Zero(&t, sizeof(t)); + StrCpy(t.HubName, sizeof(t.HubName), ps->HubName); + t.ClientOption = ZeroMalloc(sizeof(CLIENT_OPTION)); + UniStrCpy(t.ClientOption->AccountName, sizeof(t.ClientOption->AccountName), GetParamUniStr(o, "[name]")); + + // RPC call + ret = ScGetLink(ps->Rpc, &t); + + if (ret != ERR_NO_ERROR) + { + // An error has occured + CmdPrintError(c, ret); + FreeParamValueList(o); + return ret; + } + else + { + if (t.ClientAuth->AuthType != CLIENT_AUTHTYPE_CERT) + { + c->Write(c, _UU("CMD_CascadeCertSet_Not_Auth_Cert")); + ret = ERR_INTERNAL_ERROR; + } + else if (t.ClientAuth->ClientX == NULL) + { + c->Write(c, _UU("CMD_CascadeCertSet_Cert_Not_Exists")); + ret = ERR_INTERNAL_ERROR; + } + else + { + XToFileW(t.ClientAuth->ClientX, GetParamUniStr(o, "SAVECERT"), true); + } + FreeRpcCreateLink(&t); + } + + FreeParamValueList(o); + + return ret; +} + +// Enable encryption of communication at the time of the cascade connection +UINT PsCascadeEncryptEnable(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) +{ + LIST *o; + PS *ps = (PS *)param; + UINT ret = 0; + RPC_CREATE_LINK t; + // Parameter list that can be specified + PARAM args[] = + { + // "name", prompt_proc, prompt_param, eval_proc, eval_param + {"[name]", CmdPrompt, _UU("CMD_CascadeCreate_Prompt_Name"), CmdEvalNotEmpty, NULL}, + }; + + // If virtual HUB is not selected, it's an error + if (ps->HubName == NULL) + { + c->Write(c, _UU("CMD_Hub_Not_Selected")); + return ERR_INVALID_PARAMETER; + } + + o = ParseCommandList(c, cmd_name, str, args, sizeof(args) / sizeof(args[0])); + if (o == NULL) + { + return ERR_INVALID_PARAMETER; + } + + Zero(&t, sizeof(t)); + StrCpy(t.HubName, sizeof(t.HubName), ps->HubName); + t.ClientOption = ZeroMalloc(sizeof(CLIENT_OPTION)); + UniStrCpy(t.ClientOption->AccountName, sizeof(t.ClientOption->AccountName), GetParamUniStr(o, "[name]")); + + // RPC call + ret = ScGetLink(ps->Rpc, &t); + + if (ret != ERR_NO_ERROR) + { + // An error has occured + CmdPrintError(c, ret); + FreeParamValueList(o); + return ret; + } + else + { + // Data change + t.ClientOption->UseEncrypt = true; + + ret = ScSetLink(ps->Rpc, &t); + if (ret != ERR_NO_ERROR) + { + // An error has occured + CmdPrintError(c, ret); + FreeParamValueList(o); + return ret; + } + + FreeRpcCreateLink(&t); + } + + FreeParamValueList(o); + + return 0; +} + +// Disable encryption of communication at the time of the cascade connection +UINT PsCascadeEncryptDisable(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) +{ + LIST *o; + PS *ps = (PS *)param; + UINT ret = 0; + RPC_CREATE_LINK t; + // Parameter list that can be specified + PARAM args[] = + { + // "name", prompt_proc, prompt_param, eval_proc, eval_param + {"[name]", CmdPrompt, _UU("CMD_CascadeCreate_Prompt_Name"), CmdEvalNotEmpty, NULL}, + }; + + // If virtual HUB is not selected, it's an error + if (ps->HubName == NULL) + { + c->Write(c, _UU("CMD_Hub_Not_Selected")); + return ERR_INVALID_PARAMETER; + } + + o = ParseCommandList(c, cmd_name, str, args, sizeof(args) / sizeof(args[0])); + if (o == NULL) + { + return ERR_INVALID_PARAMETER; + } + + Zero(&t, sizeof(t)); + StrCpy(t.HubName, sizeof(t.HubName), ps->HubName); + t.ClientOption = ZeroMalloc(sizeof(CLIENT_OPTION)); + UniStrCpy(t.ClientOption->AccountName, sizeof(t.ClientOption->AccountName), GetParamUniStr(o, "[name]")); + + // RPC call + ret = ScGetLink(ps->Rpc, &t); + + if (ret != ERR_NO_ERROR) + { + // An error has occured + CmdPrintError(c, ret); + FreeParamValueList(o); + return ret; + } + else + { + // Data change + t.ClientOption->UseEncrypt = false; + + ret = ScSetLink(ps->Rpc, &t); + if (ret != ERR_NO_ERROR) + { + // An error has occured + CmdPrintError(c, ret); + FreeParamValueList(o); + return ret; + } + + FreeRpcCreateLink(&t); + } + + FreeParamValueList(o); + + return 0; +} + +// Enable data compression at the time of communication of the cascade connection +UINT PsCascadeCompressEnable(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) +{ + LIST *o; + PS *ps = (PS *)param; + UINT ret = 0; + RPC_CREATE_LINK t; + // Parameter list that can be specified + PARAM args[] = + { + // "name", prompt_proc, prompt_param, eval_proc, eval_param + {"[name]", CmdPrompt, _UU("CMD_CascadeCreate_Prompt_Name"), CmdEvalNotEmpty, NULL}, + }; + + // If virtual HUB is not selected, it's an error + if (ps->HubName == NULL) + { + c->Write(c, _UU("CMD_Hub_Not_Selected")); + return ERR_INVALID_PARAMETER; + } + + o = ParseCommandList(c, cmd_name, str, args, sizeof(args) / sizeof(args[0])); + if (o == NULL) + { + return ERR_INVALID_PARAMETER; + } + + Zero(&t, sizeof(t)); + StrCpy(t.HubName, sizeof(t.HubName), ps->HubName); + t.ClientOption = ZeroMalloc(sizeof(CLIENT_OPTION)); + UniStrCpy(t.ClientOption->AccountName, sizeof(t.ClientOption->AccountName), GetParamUniStr(o, "[name]")); + + // RPC call + ret = ScGetLink(ps->Rpc, &t); + + if (ret != ERR_NO_ERROR) + { + // An error has occured + CmdPrintError(c, ret); + FreeParamValueList(o); + return ret; + } + else + { + // Data change + t.ClientOption->UseCompress = true; + + ret = ScSetLink(ps->Rpc, &t); + if (ret != ERR_NO_ERROR) + { + // An error has occured + CmdPrintError(c, ret); + FreeParamValueList(o); + return ret; + } + + FreeRpcCreateLink(&t); + } + + FreeParamValueList(o); + + return 0; +} + +// Disable data compression at the time of communication of the cascade connection +UINT PsCascadeCompressDisable(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) +{ + LIST *o; + PS *ps = (PS *)param; + UINT ret = 0; + RPC_CREATE_LINK t; + // Parameter list that can be specified + PARAM args[] = + { + // "name", prompt_proc, prompt_param, eval_proc, eval_param + {"[name]", CmdPrompt, _UU("CMD_CascadeCreate_Prompt_Name"), CmdEvalNotEmpty, NULL}, + }; + + // If virtual HUB is not selected, it's an error + if (ps->HubName == NULL) + { + c->Write(c, _UU("CMD_Hub_Not_Selected")); + return ERR_INVALID_PARAMETER; + } + + o = ParseCommandList(c, cmd_name, str, args, sizeof(args) / sizeof(args[0])); + if (o == NULL) + { + return ERR_INVALID_PARAMETER; + } + + Zero(&t, sizeof(t)); + StrCpy(t.HubName, sizeof(t.HubName), ps->HubName); + t.ClientOption = ZeroMalloc(sizeof(CLIENT_OPTION)); + UniStrCpy(t.ClientOption->AccountName, sizeof(t.ClientOption->AccountName), GetParamUniStr(o, "[name]")); + + // RPC call + ret = ScGetLink(ps->Rpc, &t); + + if (ret != ERR_NO_ERROR) + { + // An error has occured + CmdPrintError(c, ret); + FreeParamValueList(o); + return ret; + } + else + { + // Data change + t.ClientOption->UseCompress = false; + + ret = ScSetLink(ps->Rpc, &t); + if (ret != ERR_NO_ERROR) + { + // An error has occured + CmdPrintError(c, ret); + FreeParamValueList(o); + return ret; + } + + FreeRpcCreateLink(&t); + } + + FreeParamValueList(o); + + return 0; +} + +UINT PsCascadeHttpHeaderAdd(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) +{ + LIST *o; + PS *ps = (PS *)param; + UINT ret = ERR_NO_ERROR; + RPC_CREATE_LINK t; + + // Parameter list that can be specified + PARAM args[] = + { + // "name", prompt_proc, prompt_param, eval_proc, eval_param + {"[name]", CmdPrompt, _UU("CMD_CascadeCreate_Prompt_Name"), CmdEvalNotEmpty, NULL}, + {"NAME", CmdPrompt, _UU("CMD_CascadeHttpHeader_Prompt_Name"), CmdEvalNotEmpty, NULL}, + {"DATA", CmdPrompt, _UU("CMD_CascadeHttpHeader_Prompt_Data"), NULL, NULL}, + }; + + // If virtual HUB is not selected, it's an error + if (ps->HubName == NULL) + { + c->Write(c, _UU("CMD_Hub_Not_Selected")); + return ERR_INVALID_PARAMETER; + } + + // Get the parameter list + o = ParseCommandList(c, cmd_name, str, args, sizeof(args) / sizeof(args[0])); + if (o == NULL) + { + return ERR_INVALID_PARAMETER; + } + + // RPC call + Zero(&t, sizeof(t)); + StrCpy(t.HubName, sizeof(t.HubName), ps->HubName); + t.ClientOption = ZeroMalloc(sizeof(CLIENT_OPTION)); + UniStrCpy(t.ClientOption->AccountName, sizeof(t.ClientOption->AccountName), GetParamUniStr(o, "[name]")); + ret = ScGetLink(ps->Rpc, &t); + + if (ret == ERR_NO_ERROR) + { + UINT i = 0; + TOKEN_LIST *tokens = NULL; + HTTP_HEADER *header = NULL; + char *name = GetParamStr(o, "NAME"); + + Trim(name); + + header = NewHttpHeader("", "", ""); + + tokens = ParseToken(t.ClientOption->CustomHttpHeader, "\r\n"); + for (i = 0; i < tokens->NumTokens; i++) + { + AddHttpValueStr(header, tokens->Token[i]); + } + FreeToken(tokens); + + if (GetHttpValue(header, name) == NULL) + { + char s[HTTP_CUSTOM_HEADER_MAX_SIZE]; + Format(s, sizeof(s), "%s: %s\r\n", name, GetParamStr(o, "DATA")); + EnSafeHttpHeaderValueStr(s, ' '); + + if ((StrLen(s) + StrLen(t.ClientOption->CustomHttpHeader)) < sizeof(t.ClientOption->CustomHttpHeader)) { + StrCat(t.ClientOption->CustomHttpHeader, sizeof(s), s); + ret = ScSetLink(ps->Rpc, &t); + } + else + { + // Error has occurred + ret = ERR_TOO_MANT_ITEMS; + } + } + else + { + // Error has occurred + ret = ERR_OBJECT_EXISTS; + } + + FreeHttpHeader(header); + } + + if (ret != ERR_NO_ERROR) + { + // Error has occurred + CmdPrintError(c, ret); + } + + FreeRpcCreateLink(&t); + + // Release of the parameter list + FreeParamValueList(o); + + return ret; +} + +UINT PsCascadeHttpHeaderDelete(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) +{ + LIST *o; + PS *ps = (PS *)param; + UINT ret = ERR_NO_ERROR; + RPC_CREATE_LINK t; + + // Parameter list that can be specified + PARAM args[] = + { + // "name", prompt_proc, prompt_param, eval_proc, eval_param + {"[name]", CmdPrompt, _UU("CMD_CascadeCreate_Prompt_Name"), CmdEvalNotEmpty, NULL}, + {"NAME", CmdPrompt, _UU("CMD_CascadeHttpHeader_Prompt_Name"), CmdEvalNotEmpty, NULL}, + }; + + // If virtual HUB is not selected, it's an error + if (ps->HubName == NULL) + { + c->Write(c, _UU("CMD_Hub_Not_Selected")); + return ERR_INVALID_PARAMETER; + } + + // Get the parameter list + o = ParseCommandList(c, cmd_name, str, args, sizeof(args) / sizeof(args[0])); + if (o == NULL) + { + return ERR_INVALID_PARAMETER; + } + + // RPC call + Zero(&t, sizeof(t)); + StrCpy(t.HubName, sizeof(t.HubName), ps->HubName); + t.ClientOption = ZeroMalloc(sizeof(CLIENT_OPTION)); + UniStrCpy(t.ClientOption->AccountName, sizeof(t.ClientOption->AccountName), GetParamUniStr(o, "[name]")); + ret = ScGetLink(ps->Rpc, &t); + + if (ret == ERR_NO_ERROR) + { + UINT i = 0; + TOKEN_LIST *tokens = NULL; + char *value = GetParamStr(o, "NAME"); + + Zero(t.ClientOption->CustomHttpHeader, sizeof(t.ClientOption->CustomHttpHeader)); + + tokens = ParseToken(t.ClientOption->CustomHttpHeader, "\r\n"); + + for (i = 0; i < tokens->NumTokens; i++) + { + if (StartWith(tokens->Token[i], value) == false) + { + StrCat(t.ClientOption->CustomHttpHeader, sizeof(t.ClientOption->CustomHttpHeader), tokens->Token[i]); + StrCat(t.ClientOption->CustomHttpHeader, 1, "\r\n"); + } + } + + ret = ScSetLink(ps->Rpc, &t); + } + else + { + // Error has occurred + CmdPrintError(c, ret); + } + + FreeRpcCreateLink(&t); + + // Release of the parameter list + FreeParamValueList(o); + + return ret; +} + +UINT PsCascadeHttpHeaderGet(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) +{ + LIST *o; + PS *ps = (PS *)param; + UINT ret = ERR_NO_ERROR; + RPC_CREATE_LINK t; + + // Parameter list that can be specified + PARAM args[] = + { + // "name", prompt_proc, prompt_param, eval_proc, eval_param + {"[name]", CmdPrompt, _UU("CMD_CascadeCreate_Prompt_Name"), CmdEvalNotEmpty, NULL}, + }; + + // If virtual HUB is not selected, it's an error + if (ps->HubName == NULL) + { + c->Write(c, _UU("CMD_Hub_Not_Selected")); + return ERR_INVALID_PARAMETER; + } + + // Get the parameter list + o = ParseCommandList(c, cmd_name, str, args, sizeof(args) / sizeof(args[0])); + if (o == NULL) + { + return ERR_INVALID_PARAMETER; + } + + // RPC call + Zero(&t, sizeof(t)); + StrCpy(t.HubName, sizeof(t.HubName), ps->HubName); + t.ClientOption = ZeroMalloc(sizeof(CLIENT_OPTION)); + UniStrCpy(t.ClientOption->AccountName, sizeof(t.ClientOption->AccountName), GetParamUniStr(o, "[name]")); + ret = ScGetLink(ps->Rpc, &t); + + // Release of the parameter list + FreeParamValueList(o); + + if (ret == ERR_NO_ERROR) + { + wchar_t unistr[HTTP_CUSTOM_HEADER_MAX_SIZE]; + TOKEN_LIST *tokens = NULL; + UINT i = 0; + CT *ct = CtNew(); + CtInsertColumn(ct, _UU("CMD_CT_STD_COLUMN_1"), false); + + tokens = ParseToken(t.ClientOption->CustomHttpHeader, "\r\n"); + + for (i = 0; i < tokens->NumTokens; i++) + { + StrToUni(unistr, sizeof(unistr), tokens->Token[i]); + CtInsert(ct, unistr); + } + + CtFreeEx(ct, c, false); + } + else + { + // Error has occurred + CmdPrintError(c, ret); + } + + FreeRpcCreateLink(&t); + + return ret; +} + +// Set the cascade connection method to the TCP/IP direct connection mode +UINT PsCascadeProxyNone(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) +{ + LIST *o; + PS *ps = (PS *)param; + UINT ret = 0; + RPC_CREATE_LINK t; + // Parameter list that can be specified + PARAM args[] = + { + // "name", prompt_proc, prompt_param, eval_proc, eval_param + {"[name]", CmdPrompt, _UU("CMD_CascadeCreate_Prompt_Name"), CmdEvalNotEmpty, NULL}, + }; + + // If virtual HUB is not selected, it's an error + if (ps->HubName == NULL) + { + c->Write(c, _UU("CMD_Hub_Not_Selected")); + return ERR_INVALID_PARAMETER; + } + + o = ParseCommandList(c, cmd_name, str, args, sizeof(args) / sizeof(args[0])); + if (o == NULL) + { + return ERR_INVALID_PARAMETER; + } + + Zero(&t, sizeof(t)); + StrCpy(t.HubName, sizeof(t.HubName), ps->HubName); + t.ClientOption = ZeroMalloc(sizeof(CLIENT_OPTION)); + UniStrCpy(t.ClientOption->AccountName, sizeof(t.ClientOption->AccountName), GetParamUniStr(o, "[name]")); + + // RPC call + ret = ScGetLink(ps->Rpc, &t); + + if (ret != ERR_NO_ERROR) + { + // An error has occured + CmdPrintError(c, ret); + FreeParamValueList(o); + return ret; + } + else + { + // Data change + t.ClientOption->ProxyType = PROXY_DIRECT; + + ret = ScSetLink(ps->Rpc, &t); + if (ret != ERR_NO_ERROR) + { + // An error has occured + CmdPrintError(c, ret); + FreeParamValueList(o); + return ret; + } + + FreeRpcCreateLink(&t); + } + + FreeParamValueList(o); + + return 0; +} + +// Set the cascade connection method as the mode via HTTP proxy server +UINT PsCascadeProxyHttp(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) +{ + LIST *o; + PS *ps = (PS *)param; + UINT ret = 0; + RPC_CREATE_LINK t; + // Parameter list that can be specified + PARAM args[] = + { + // "name", prompt_proc, prompt_param, eval_proc, eval_param + {"[name]", CmdPrompt, _UU("CMD_CascadeCreate_Prompt_Name"), CmdEvalNotEmpty, NULL}, + {"SERVER", CmdPrompt, _UU("CMD_CascadeProxyHttp_Prompt_Server"), CmdEvalHostAndPort, NULL}, + {"USERNAME", NULL, NULL, NULL, NULL}, + {"PASSWORD", NULL, NULL, NULL, NULL}, + }; + + // If virtual HUB is not selected, it's an error + if (ps->HubName == NULL) + { + c->Write(c, _UU("CMD_Hub_Not_Selected")); + return ERR_INVALID_PARAMETER; + } + + o = ParseCommandList(c, cmd_name, str, args, sizeof(args) / sizeof(args[0])); + if (o == NULL) + { + return ERR_INVALID_PARAMETER; + } + + Zero(&t, sizeof(t)); + StrCpy(t.HubName, sizeof(t.HubName), ps->HubName); + t.ClientOption = ZeroMalloc(sizeof(CLIENT_OPTION)); + UniStrCpy(t.ClientOption->AccountName, sizeof(t.ClientOption->AccountName), GetParamUniStr(o, "[name]")); + + // RPC call + ret = ScGetLink(ps->Rpc, &t); + + if (ret != ERR_NO_ERROR) + { + // An error has occured + CmdPrintError(c, ret); + FreeParamValueList(o); + return ret; + } + else + { + char *host; + UINT port; + + // Data change + if (ParseHostPort(GetParamStr(o, "SERVER"), &host, &port, 8080)) + { + t.ClientOption->ProxyType = PROXY_HTTP; + StrCpy(t.ClientOption->ProxyName, sizeof(t.ClientOption->ProxyName), host); + t.ClientOption->ProxyPort = port; + StrCpy(t.ClientOption->ProxyUsername, sizeof(t.ClientOption->ProxyName), GetParamStr(o, "USERNAME")); + StrCpy(t.ClientOption->ProxyPassword, sizeof(t.ClientOption->ProxyName), GetParamStr(o, "PASSWORD")); + Free(host); + } + + ret = ScSetLink(ps->Rpc, &t); + if (ret != ERR_NO_ERROR) + { + // An error has occured + CmdPrintError(c, ret); + FreeParamValueList(o); + return ret; + } + + FreeRpcCreateLink(&t); + } + + FreeParamValueList(o); + + return 0; +} + +// Set the cascade connection method as the mode via SOCKS4 proxy server +UINT PsCascadeProxySocks(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) +{ + LIST *o; + PS *ps = (PS *)param; + UINT ret = 0; + RPC_CREATE_LINK t; + // Parameter list that can be specified + PARAM args[] = + { + // "name", prompt_proc, prompt_param, eval_proc, eval_param + {"[name]", CmdPrompt, _UU("CMD_CascadeCreate_Prompt_Name"), CmdEvalNotEmpty, NULL}, + {"SERVER", CmdPrompt, _UU("CMD_CascadeProxyHttp_Prompt_Server"), CmdEvalHostAndPort, NULL}, + {"USERNAME", NULL, NULL, NULL, NULL}, + {"PASSWORD", NULL, NULL, NULL, NULL}, + }; + + // If virtual HUB is not selected, it's an error + if (ps->HubName == NULL) + { + c->Write(c, _UU("CMD_Hub_Not_Selected")); + return ERR_INVALID_PARAMETER; + } + + o = ParseCommandList(c, cmd_name, str, args, sizeof(args) / sizeof(args[0])); + if (o == NULL) + { + return ERR_INVALID_PARAMETER; + } + + Zero(&t, sizeof(t)); + StrCpy(t.HubName, sizeof(t.HubName), ps->HubName); + t.ClientOption = ZeroMalloc(sizeof(CLIENT_OPTION)); + UniStrCpy(t.ClientOption->AccountName, sizeof(t.ClientOption->AccountName), GetParamUniStr(o, "[name]")); + + // RPC call + ret = ScGetLink(ps->Rpc, &t); + + if (ret != ERR_NO_ERROR) + { + // An error has occured + CmdPrintError(c, ret); + FreeParamValueList(o); + return ret; + } + else + { + char *host; + UINT port; + + // Data change + if (ParseHostPort(GetParamStr(o, "SERVER"), &host, &port, 1080)) + { + t.ClientOption->ProxyType = PROXY_SOCKS; + StrCpy(t.ClientOption->ProxyName, sizeof(t.ClientOption->ProxyName), host); + t.ClientOption->ProxyPort = port; + StrCpy(t.ClientOption->ProxyUsername, sizeof(t.ClientOption->ProxyName), GetParamStr(o, "USERNAME")); + StrCpy(t.ClientOption->ProxyPassword, sizeof(t.ClientOption->ProxyName), GetParamStr(o, "PASSWORD")); + Free(host); + } + + ret = ScSetLink(ps->Rpc, &t); + if (ret != ERR_NO_ERROR) + { + // An error has occured + CmdPrintError(c, ret); + FreeParamValueList(o); + return ret; + } + + FreeRpcCreateLink(&t); + } + + FreeParamValueList(o); + + return 0; +} + +// Set the cascade connection method as the mode via SOCKS5 proxy server +UINT PsCascadeProxySocks5(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) +{ + LIST *o; + PS *ps = (PS *)param; + UINT ret = 0; + RPC_CREATE_LINK t; + // Parameter list that can be specified + PARAM args[] = + { + // "name", prompt_proc, prompt_param, eval_proc, eval_param + {"[name]", CmdPrompt, _UU("CMD_CascadeCreate_Prompt_Name"), CmdEvalNotEmpty, NULL}, + {"SERVER", CmdPrompt, _UU("CMD_CascadeProxyHttp_Prompt_Server"), CmdEvalHostAndPort, NULL}, + {"USERNAME", NULL, NULL, NULL, NULL}, + {"PASSWORD", NULL, NULL, NULL, NULL}, + }; + + // If virtual HUB is not selected, it's an error + if (ps->HubName == NULL) + { + c->Write(c, _UU("CMD_Hub_Not_Selected")); + return ERR_INVALID_PARAMETER; + } + + o = ParseCommandList(c, cmd_name, str, args, sizeof(args) / sizeof(args[0])); + if (o == NULL) + { + return ERR_INVALID_PARAMETER; + } + + Zero(&t, sizeof(t)); + StrCpy(t.HubName, sizeof(t.HubName), ps->HubName); + t.ClientOption = ZeroMalloc(sizeof(CLIENT_OPTION)); + UniStrCpy(t.ClientOption->AccountName, sizeof(t.ClientOption->AccountName), GetParamUniStr(o, "[name]")); + + // RPC call + ret = ScGetLink(ps->Rpc, &t); + + if (ret != ERR_NO_ERROR) + { + // An error has occured + CmdPrintError(c, ret); + FreeParamValueList(o); + return ret; + } + else + { + char *host; + UINT port; + + // Data change + if (ParseHostPort(GetParamStr(o, "SERVER"), &host, &port, 1080)) + { + t.ClientOption->ProxyType = PROXY_SOCKS5; + StrCpy(t.ClientOption->ProxyName, sizeof(t.ClientOption->ProxyName), host); + t.ClientOption->ProxyPort = port; + StrCpy(t.ClientOption->ProxyUsername, sizeof(t.ClientOption->ProxyName), GetParamStr(o, "USERNAME")); + StrCpy(t.ClientOption->ProxyPassword, sizeof(t.ClientOption->ProxyName), GetParamStr(o, "PASSWORD")); + Free(host); + } + + ret = ScSetLink(ps->Rpc, &t); + if (ret != ERR_NO_ERROR) + { + // An error has occured + CmdPrintError(c, ret); + FreeParamValueList(o); + return ret; + } + + FreeRpcCreateLink(&t); + } + + FreeParamValueList(o); + + return 0; +} + +// Enable the validation options for the server certificate of cascade connection +UINT PsCascadeServerCertEnable(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) +{ + LIST *o; + PS *ps = (PS *)param; + UINT ret = 0; + RPC_CREATE_LINK t; + // Parameter list that can be specified + PARAM args[] = + { + // "name", prompt_proc, prompt_param, eval_proc, eval_param + {"[name]", CmdPrompt, _UU("CMD_CascadeCreate_Prompt_Name"), CmdEvalNotEmpty, NULL}, + }; + + // If virtual HUB is not selected, it's an error + if (ps->HubName == NULL) + { + c->Write(c, _UU("CMD_Hub_Not_Selected")); + return ERR_INVALID_PARAMETER; + } + + o = ParseCommandList(c, cmd_name, str, args, sizeof(args) / sizeof(args[0])); + if (o == NULL) + { + return ERR_INVALID_PARAMETER; + } + + Zero(&t, sizeof(t)); + StrCpy(t.HubName, sizeof(t.HubName), ps->HubName); + t.ClientOption = ZeroMalloc(sizeof(CLIENT_OPTION)); + UniStrCpy(t.ClientOption->AccountName, sizeof(t.ClientOption->AccountName), GetParamUniStr(o, "[name]")); + + // RPC call + ret = ScGetLink(ps->Rpc, &t); + + if (ret != ERR_NO_ERROR) + { + // An error has occured + CmdPrintError(c, ret); + FreeParamValueList(o); + return ret; + } + else + { + // Data change + t.CheckServerCert = true; + + ret = ScSetLink(ps->Rpc, &t); + if (ret != ERR_NO_ERROR) + { + // An error has occured + CmdPrintError(c, ret); + FreeParamValueList(o); + return ret; + } + + FreeRpcCreateLink(&t); + } + + FreeParamValueList(o); + + return 0; +} + +// Disable the validation options for the server certificate of cascade connection +UINT PsCascadeServerCertDisable(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) +{ + LIST *o; + PS *ps = (PS *)param; + UINT ret = 0; + RPC_CREATE_LINK t; + // Parameter list that can be specified + PARAM args[] = + { + // "name", prompt_proc, prompt_param, eval_proc, eval_param + {"[name]", CmdPrompt, _UU("CMD_CascadeCreate_Prompt_Name"), CmdEvalNotEmpty, NULL}, + }; + + // If virtual HUB is not selected, it's an error + if (ps->HubName == NULL) + { + c->Write(c, _UU("CMD_Hub_Not_Selected")); + return ERR_INVALID_PARAMETER; + } + + o = ParseCommandList(c, cmd_name, str, args, sizeof(args) / sizeof(args[0])); + if (o == NULL) + { + return ERR_INVALID_PARAMETER; + } + + Zero(&t, sizeof(t)); + StrCpy(t.HubName, sizeof(t.HubName), ps->HubName); + t.ClientOption = ZeroMalloc(sizeof(CLIENT_OPTION)); + UniStrCpy(t.ClientOption->AccountName, sizeof(t.ClientOption->AccountName), GetParamUniStr(o, "[name]")); + + // RPC call + ret = ScGetLink(ps->Rpc, &t); + + if (ret != ERR_NO_ERROR) + { + // An error has occured + CmdPrintError(c, ret); + FreeParamValueList(o); + return ret; + } + else + { + // Data change + t.CheckServerCert = false; + + ret = ScSetLink(ps->Rpc, &t); + if (ret != ERR_NO_ERROR) + { + // An error has occured + CmdPrintError(c, ret); + FreeParamValueList(o); + return ret; + } + + FreeRpcCreateLink(&t); + } + + FreeParamValueList(o); + + return 0; +} + +// Server-specific certificate settings of cascade connection +UINT PsCascadeServerCertSet(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) +{ + LIST *o; + PS *ps = (PS *)param; + UINT ret = 0; + RPC_CREATE_LINK t; + X *x; + // Parameter list that can be specified + PARAM args[] = + { + // "name", prompt_proc, prompt_param, eval_proc, eval_param + {"[name]", CmdPrompt, _UU("CMD_CascadeCreate_Prompt_Name"), CmdEvalNotEmpty, NULL}, + {"LOADCERT", CmdPrompt, _UU("CMD_LOADCERTPATH"), CmdEvalIsFile, NULL}, + }; + + // If virtual HUB is not selected, it's an error + if (ps->HubName == NULL) + { + c->Write(c, _UU("CMD_Hub_Not_Selected")); + return ERR_INVALID_PARAMETER; + } + + o = ParseCommandList(c, cmd_name, str, args, sizeof(args) / sizeof(args[0])); + if (o == NULL) + { + return ERR_INVALID_PARAMETER; + } + + x = FileToXW(GetParamUniStr(o, "LOADCERT")); + if (x == NULL) + { + FreeParamValueList(o); + c->Write(c, _UU("CMD_LOADCERT_FAILED")); + return ERR_INTERNAL_ERROR; + } + + Zero(&t, sizeof(t)); + StrCpy(t.HubName, sizeof(t.HubName), ps->HubName); + t.ClientOption = ZeroMalloc(sizeof(CLIENT_OPTION)); + UniStrCpy(t.ClientOption->AccountName, sizeof(t.ClientOption->AccountName), GetParamUniStr(o, "[name]")); + + // RPC call + ret = ScGetLink(ps->Rpc, &t); + + if (ret != ERR_NO_ERROR) + { + // An error has occured + CmdPrintError(c, ret); + FreeParamValueList(o); + FreeX(x); + return ret; + } + else + { + // Data change + if (t.ServerCert != NULL) + { + FreeX(t.ServerCert); + } + t.ServerCert = x; + + ret = ScSetLink(ps->Rpc, &t); + if (ret != ERR_NO_ERROR) + { + // An error has occured + CmdPrintError(c, ret); + FreeParamValueList(o); + return ret; + } + + FreeRpcCreateLink(&t); + } + + FreeParamValueList(o); + + return 0; +} + +// Delete the server-specific certificate of cascade connection +UINT PsCascadeServerCertDelete(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) +{ + LIST *o; + PS *ps = (PS *)param; + UINT ret = 0; + RPC_CREATE_LINK t; + // Parameter list that can be specified + PARAM args[] = + { + // "name", prompt_proc, prompt_param, eval_proc, eval_param + {"[name]", CmdPrompt, _UU("CMD_CascadeCreate_Prompt_Name"), CmdEvalNotEmpty, NULL}, + }; + + // If virtual HUB is not selected, it's an error + if (ps->HubName == NULL) + { + c->Write(c, _UU("CMD_Hub_Not_Selected")); + return ERR_INVALID_PARAMETER; + } + + o = ParseCommandList(c, cmd_name, str, args, sizeof(args) / sizeof(args[0])); + if (o == NULL) + { + return ERR_INVALID_PARAMETER; + } + + Zero(&t, sizeof(t)); + StrCpy(t.HubName, sizeof(t.HubName), ps->HubName); + t.ClientOption = ZeroMalloc(sizeof(CLIENT_OPTION)); + UniStrCpy(t.ClientOption->AccountName, sizeof(t.ClientOption->AccountName), GetParamUniStr(o, "[name]")); + + // RPC call + ret = ScGetLink(ps->Rpc, &t); + + if (ret != ERR_NO_ERROR) + { + // An error has occured + CmdPrintError(c, ret); + FreeParamValueList(o); + return ret; + } + else + { + // Data change + if (t.ServerCert != NULL) + { + FreeX(t.ServerCert); + } + t.ServerCert = NULL; + + ret = ScSetLink(ps->Rpc, &t); + if (ret != ERR_NO_ERROR) + { + // An error has occured + CmdPrintError(c, ret); + FreeParamValueList(o); + return ret; + } + + FreeRpcCreateLink(&t); + } + + FreeParamValueList(o); + + return 0; +} + +// Get the server-specific certificate of cascade connection +UINT PsCascadeServerCertGet(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) +{ + LIST *o; + PS *ps = (PS *)param; + UINT ret = 0; + RPC_CREATE_LINK t; + // Parameter list that can be specified + PARAM args[] = + { + // "name", prompt_proc, prompt_param, eval_proc, eval_param + {"[name]", CmdPrompt, _UU("CMD_CascadeCreate_Prompt_Name"), CmdEvalNotEmpty, NULL}, + {"SAVECERT", CmdPrompt, _UU("CMD_SAVECERTPATH"), CmdEvalNotEmpty, NULL}, + }; + + // If virtual HUB is not selected, it's an error + if (ps->HubName == NULL) + { + c->Write(c, _UU("CMD_Hub_Not_Selected")); + return ERR_INVALID_PARAMETER; + } + + o = ParseCommandList(c, cmd_name, str, args, sizeof(args) / sizeof(args[0])); + if (o == NULL) + { + return ERR_INVALID_PARAMETER; + } + + Zero(&t, sizeof(t)); + StrCpy(t.HubName, sizeof(t.HubName), ps->HubName); + t.ClientOption = ZeroMalloc(sizeof(CLIENT_OPTION)); + UniStrCpy(t.ClientOption->AccountName, sizeof(t.ClientOption->AccountName), GetParamUniStr(o, "[name]")); + + // RPC call + ret = ScGetLink(ps->Rpc, &t); + + if (ret != ERR_NO_ERROR) + { + // An error has occured + CmdPrintError(c, ret); + FreeParamValueList(o); + return ret; + } + else + { + // Save the certificate + if (t.ServerCert == NULL) + { + c->Write(c, _UU("CMD_CERT_NOT_EXISTS")); + ret = ERR_INTERNAL_ERROR; + } + else + { + if (XToFileW(t.ServerCert, GetParamUniStr(o, "SAVECERT"), true) == false) + { + c->Write(c, _UU("CMD_SAVECERT_FAILED")); + ret = ERR_INTERNAL_ERROR; + } + } + + FreeRpcCreateLink(&t); + } + + FreeParamValueList(o); + + return ret; +} + +// Set the advanced settings of the cascade connection +UINT PsCascadeDetailSet(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) +{ + LIST *o; + PS *ps = (PS *)param; + UINT ret = 0; + RPC_CREATE_LINK t; + CMD_EVAL_MIN_MAX mm_maxtcp = + { + "CMD_CascadeDetailSet_Eval_MaxTcp", 1, 32 + }; + CMD_EVAL_MIN_MAX mm_interval = + { + "CMD_CascadeDetailSet_Eval_Interval", 1, 4294967295UL + }; + // Parameter list that can be specified + PARAM args[] = + { + // "name", prompt_proc, prompt_param, eval_proc, eval_param + {"[name]", CmdPrompt, _UU("CMD_CascadeCreate_Prompt_Name"), CmdEvalNotEmpty, NULL}, + {"MAXTCP", CmdPrompt, _UU("CMD_CascadeDetailSet_Prompt_MaxTcp"), CmdEvalMinMax, &mm_maxtcp}, + {"INTERVAL", CmdPrompt, _UU("CMD_CascadeDetailSet_Prompt_Interval"), CmdEvalMinMax, &mm_interval}, + {"TTL", CmdPrompt, _UU("CMD_CascadeDetailSet_Prompt_TTL"), NULL, NULL}, + {"HALF", CmdPrompt, _UU("CMD_CascadeDetailSet_Prompt_HALF"), NULL, NULL}, + {"NOQOS", CmdPrompt, _UU("CMD_AccountDetailSet_Prompt_NOQOS"), NULL, NULL}, + }; + + // If virtual HUB is not selected, it's an error + if (ps->HubName == NULL) + { + c->Write(c, _UU("CMD_Hub_Not_Selected")); + return ERR_INVALID_PARAMETER; + } + + o = ParseCommandList(c, cmd_name, str, args, sizeof(args) / sizeof(args[0])); + if (o == NULL) + { + return ERR_INVALID_PARAMETER; + } + + Zero(&t, sizeof(t)); + StrCpy(t.HubName, sizeof(t.HubName), ps->HubName); + t.ClientOption = ZeroMalloc(sizeof(CLIENT_OPTION)); + UniStrCpy(t.ClientOption->AccountName, sizeof(t.ClientOption->AccountName), GetParamUniStr(o, "[name]")); + + // RPC call + ret = ScGetLink(ps->Rpc, &t); + + if (ret != ERR_NO_ERROR) + { + // An error has occured + CmdPrintError(c, ret); + FreeParamValueList(o); + return ret; + } + else + { + // Data change + t.ClientOption->MaxConnection = GetParamInt(o, "MAXTCP"); + t.ClientOption->AdditionalConnectionInterval = GetParamInt(o, "INTERVAL"); + t.ClientOption->ConnectionDisconnectSpan = GetParamInt(o, "TTL"); + t.ClientOption->HalfConnection = GetParamYes(o, "HALF"); + t.ClientOption->DisableQoS = GetParamYes(o, "NOQOS"); + + ret = ScSetLink(ps->Rpc, &t); + if (ret != ERR_NO_ERROR) + { + // An error has occured + CmdPrintError(c, ret); + FreeParamValueList(o); + return ret; + } + + FreeRpcCreateLink(&t); + } + + FreeParamValueList(o); + + return 0; +} + +// Show a security policy +void PrintPolicy(CONSOLE *c, POLICY *pol, bool cascade_mode) +{ + UINT i; + CT *ct; + PACK *p; + // Validate arguments + if (c == NULL || pol == NULL) + { + return; + } + + ct = CtNew(); + CtInsertColumn(ct, _UU("CMD_PolicyList_Column_1"), false); + CtInsertColumn(ct, _UU("CMD_PolicyList_Column_2"), false); + CtInsertColumn(ct, _UU("CMD_PolicyList_Column_3"), false); + + p = NewPack(); + OutRpcPolicy(p, pol); + + // Show the list of all policies + for (i = 0; i < PolicyNum();i++) + { + char name[64]; + wchar_t *tmp; + + if (cascade_mode == false || PolicyIsSupportedForCascade(i)) + { + wchar_t value_str[256]; + UINT value; + char tmp2[256]; + + Format(tmp2, sizeof(tmp2), "policy:%s", PolicyIdToStr(i)); + value = PackGetInt(p, tmp2); + + tmp = CopyStrToUni(PolicyIdToStr(i)); + + FormatPolicyValue(value_str, sizeof(value_str), + i, value); + + Format(name, sizeof(name), "POL_%u", i); + CtInsert(ct, tmp, _UU(name), value_str); + + Free(tmp); + } + } + + FreePack(p); + + CtFree(ct, c); +} + +// Show the security policy list +void PrintPolicyList(CONSOLE *c, char *name) +{ + UINT id; + // Validate arguments + if (c == NULL) + { + return; + } + if (IsEmptyStr(name)) + { + name = NULL; + } + + if (name != NULL) + { + id = PolicyStrToId(name); + if (id == INFINITE) + { + // Invalid ID + c->Write(c, _UU("CMD_PolicyList_Invalid_Name")); + } + else + { + wchar_t tmp[MAX_SIZE]; + wchar_t tmp2[MAX_SIZE]; + char name1[64], name2[64]; + wchar_t *title, *descript; + wchar_t policy_name[MAX_SIZE]; + + Format(name1, sizeof(name1), "POL_%u", id); + Format(name2, sizeof(name2), "POL_EX_%u", id); + + title = _UU(name1); + descript = _UU(name2); + + StrToUni(policy_name, sizeof(policy_name), PolicyIdToStr(id)); + + // Policy name + c->Write(c, _UU("CMD_PolicyList_Help_1")); + UniFormat(tmp2, sizeof(tmp2), L" %s", policy_name); + c->Write(c, tmp2); + c->Write(c, L""); + + // Simple description of the policy + c->Write(c, _UU("CMD_PolicyList_Help_2")); + UniFormat(tmp2, sizeof(tmp2), L" %s", title); + c->Write(c, tmp2); + c->Write(c, L""); + + // Range of the value that can be set + GetPolicyValueRangeStr(tmp, sizeof(tmp), id); + c->Write(c, _UU("CMD_PolicyList_Help_3")); + UniFormat(tmp2, sizeof(tmp2), L" %s", tmp); + c->Write(c, tmp2); + c->Write(c, L""); + + // Default value + FormatPolicyValue(tmp, sizeof(tmp), id, GetPolicyItem(id)->DefaultValue); + c->Write(c, _UU("CMD_PolicyList_Help_4")); + UniFormat(tmp2, sizeof(tmp2), L" %s", tmp); + c->Write(c, tmp2); + c->Write(c, L""); + + // Detailed description of the policy + c->Write(c, _UU("CMD_PolicyList_Help_5")); + c->Write(c, descript); + c->Write(c, L""); + } + } + else + { + UINT i; + CT *ct = CtNew(); + CtInsertColumn(ct, _UU("CMD_PolicyList_Column_1"), false); + CtInsertColumn(ct, _UU("CMD_PolicyList_Column_2"), false); + + // Show the list of all policies + for (i = 0; i < PolicyNum();i++) + { + char name[64]; + wchar_t *tmp; + + tmp = CopyStrToUni(PolicyIdToStr(i)); + + Format(name, sizeof(name), "POL_%u", i); + CtInsert(ct, tmp, _UU(name)); + + Free(tmp); + } + + CtFree(ct, c); + } +} + +// Editing the contents of the policy +bool EditPolicy(CONSOLE *c, POLICY *pol, char *name, char *value, bool cascade_mode) +{ + PACK *p; + ELEMENT *e; + POLICY_ITEM *item; + UINT id; + wchar_t tmp[MAX_SIZE]; + wchar_t tmp2[MAX_SIZE]; + char pack_name[128]; + // Validate arguments + if (c == NULL || pol == NULL || name == NULL || value == NULL) + { + return false; + } + + p = NewPack(); + + OutRpcPolicy(p, pol); + + Format(pack_name, sizeof(pack_name), "policy:%s", PolicyIdToStr(PolicyStrToId(name))); + + if ((e = GetElement(p, pack_name, VALUE_INT)) == NULL || (id = PolicyStrToId(name)) == INFINITE) + { + UniFormat(tmp, sizeof(tmp), _UU("CMD_CascadePolicySet_Invalid_Name"), name); + c->Write(c, tmp); + FreePack(p); + return false; + } + + if (cascade_mode && (PolicyIsSupportedForCascade(id) == false)) + { + UniFormat(tmp, sizeof(tmp), _UU("CMD_CascadePolicySet_Invalid_Name_For_Cascade"), name); + c->Write(c, tmp); + FreePack(p); + return false; + } + + item = GetPolicyItem(id); + + if (item->TypeInt == false) + { + // bool type + e->values[0]->IntValue = ( + StartWith(value, "y") || StartWith(value, "t") || + ToInt(value) != 0) ? 1 : 0; + } + else + { + UINT n = ToInt(value); + bool b = true; + + // int type + GetPolicyValueRangeStr(tmp, sizeof(tmp), id); + + if (item->AllowZero == false) + { + if (n == 0) + { + b = false; + } + } + + if (n != 0 && (n < item->MinValue || n > item->MaxValue)) + { + b = false; + } + + if (b == false) + { + UniFormat(tmp2, sizeof(tmp2), _UU("CMD_CascadePolicySet_Invalid_Range"), PolicyIdToStr(id), tmp); + c->Write(c, tmp2); + FreePack(p); + return false; + } + + e->values[0]->IntValue = n; + } + + Zero(pol, sizeof(POLICY)); + + InRpcPolicy(pol, p); + + FreePack(p); + + return true; +} + +// Show the list of the type of security policy and possible values +UINT PsPolicyList(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) +{ + LIST *o; + PARAM args[] = + { + // "name", prompt_proc, prompt_param, eval_proc, eval_param + {"[name]", NULL, NULL, NULL, NULL} + }; + + o = ParseCommandList(c, cmd_name, str, args, sizeof(args) / sizeof(args[0])); + if (o == NULL) + { + return ERR_INVALID_PARAMETER; + } + + PrintPolicyList(c, GetParamStr(o, "[name]")); + + FreeParamValueList(o); + + return ERR_NO_ERROR; +} + +// Set the security policy of the cascade session +UINT PsCascadePolicySet(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) +{ + LIST *o; + PS *ps = (PS *)param; + UINT ret = 0; + RPC_CREATE_LINK t; + // Parameter list that can be specified + PARAM args[] = + { + // "name", prompt_proc, prompt_param, eval_proc, eval_param + {"[name]", CmdPrompt, _UU("CMD_CascadeCreate_Prompt_Name"), CmdEvalNotEmpty, NULL}, + {"NAME", CmdPrompt, _UU("CMD_CascadePolicySet_PROMPT_POLNAME"), CmdEvalNotEmpty, NULL}, + {"VALUE", CmdPrompt, _UU("CMD_CascadePolicySet_PROMPT_POLVALUE"), CmdEvalNotEmpty, NULL}, + }; + + // If virtual HUB is not selected, it's an error + if (ps->HubName == NULL) + { + c->Write(c, _UU("CMD_Hub_Not_Selected")); + return ERR_INVALID_PARAMETER; + } + + o = ParseCommandList(c, cmd_name, str, args, sizeof(args) / sizeof(args[0])); + if (o == NULL) + { + return ERR_INVALID_PARAMETER; + } + + Zero(&t, sizeof(t)); + StrCpy(t.HubName, sizeof(t.HubName), ps->HubName); + t.ClientOption = ZeroMalloc(sizeof(CLIENT_OPTION)); + UniStrCpy(t.ClientOption->AccountName, sizeof(t.ClientOption->AccountName), GetParamUniStr(o, "[name]")); + + // RPC call + ret = ScGetLink(ps->Rpc, &t); + + if (ret != ERR_NO_ERROR) + { + // An error has occured + CmdPrintError(c, ret); + FreeParamValueList(o); + return ret; + } + else + { + if (EditPolicy(c, &t.Policy, GetParamStr(o, "NAME"), GetParamStr(o, "VALUE"), true) == false) + { + // An error has occured + FreeRpcCreateLink(&t); + FreeParamValueList(o); + return ERR_INTERNAL_ERROR; + } + + ret = ScSetLink(ps->Rpc, &t); + if (ret != ERR_NO_ERROR) + { + // An error has occured + CmdPrintError(c, ret); + FreeParamValueList(o); + return ret; + } + + FreeRpcCreateLink(&t); + } + + FreeParamValueList(o); + + return 0; +} + +// Display the status information of the session +void CmdPrintStatusToListView(CT *ct, RPC_CLIENT_GET_CONNECTION_STATUS *s) +{ + CmdPrintStatusToListViewEx(ct, s, false); +} +void CmdPrintStatusToListViewEx(CT *ct, RPC_CLIENT_GET_CONNECTION_STATUS *s, bool server_mode) +{ + wchar_t tmp[MAX_SIZE]; + char str[MAX_SIZE]; + char vv[128]; + // Validate arguments + if (s == NULL) + { + return; + } + + if (server_mode == false) + { + CtInsert(ct, _UU("CM_ST_ACCOUNT_NAME"), s->AccountName); + + if (s->Connected == false) + { + wchar_t *st = _UU("CM_ST_CONNECTED_FALSE"); + switch (s->SessionStatus) + { + case CLIENT_STATUS_CONNECTING: + st = _UU("CM_ST_CONNECTING"); + break; + case CLIENT_STATUS_NEGOTIATION: + st = _UU("CM_ST_NEGOTIATION"); + break; + case CLIENT_STATUS_AUTH: + st = _UU("CM_ST_AUTH"); + break; + case CLIENT_STATUS_ESTABLISHED: + st = _UU("CM_ST_ESTABLISHED"); + break; + case CLIENT_STATUS_RETRY: + st = _UU("CM_ST_RETRY"); + break; + case CLIENT_STATUS_IDLE: + st = _UU("CM_ST_IDLE"); + break; + } + CtInsert(ct, _UU("CM_ST_CONNECTED"), st); + } + else + { + CtInsert(ct, _UU("CM_ST_CONNECTED"), _UU("CM_ST_CONNECTED_TRUE")); + } + } + + if (s->Connected) + { + if (s->VLanId == 0) + { + UniStrCpy(tmp, sizeof(tmp), _UU("CM_ST_NO_VLAN")); + } + else + { + UniToStru(tmp, s->VLanId); + } + + CtInsert(ct, _UU("CM_ST_VLAN_ID"), tmp); + + if (server_mode == false) + { + StrToUni(tmp, sizeof(tmp), s->ServerName); + CtInsert(ct, _UU("CM_ST_SERVER_NAME"), tmp); + + UniFormat(tmp, sizeof(tmp), _UU("CM_ST_PORT_TCP"), s->ServerPort); + CtInsert(ct, _UU("CM_ST_SERVER_PORT"), tmp); + } + + StrToUni(tmp, sizeof(tmp), s->ServerProductName); + CtInsert(ct, _UU("CM_ST_SERVER_P_NAME"), tmp); + + UniFormat(tmp, sizeof(tmp), L"%u.%02u", s->ServerProductVer / 100, s->ServerProductVer % 100); + CtInsert(ct, _UU("CM_ST_SERVER_P_VER"), tmp); + UniFormat(tmp, sizeof(tmp), L"Build %u", s->ServerProductBuild); + CtInsert(ct, _UU("CM_ST_SERVER_P_BUILD"), tmp); + } + + GetDateTimeStrEx64(tmp, sizeof(tmp), SystemToLocal64(s->StartTime), NULL); + CtInsert(ct, _UU("CM_ST_START_TIME"), tmp); + /* !!! Do not correct the spelling to keep the backward protocol compatibility !!! */ + GetDateTimeStrEx64(tmp, sizeof(tmp), SystemToLocal64(s->FirstConnectionEstablisiedTime), NULL); + /* !!! Do not correct the spelling to keep the backward protocol compatibility !!! */ + CtInsert(ct, _UU("CM_ST_FIRST_ESTAB_TIME"), s->FirstConnectionEstablisiedTime == 0 ? _UU("CM_ST_NONE") : tmp); + + if (s->Connected) + { + GetDateTimeStrEx64(tmp, sizeof(tmp), SystemToLocal64(s->CurrentConnectionEstablishTime), NULL); + CtInsert(ct, _UU("CM_ST_CURR_ESTAB_TIME"), tmp); + } + + if (server_mode == false) + { + UniFormat(tmp, sizeof(tmp), _UU("CM_ST_NUM_STR"), s->NumConnectionsEstablished); + CtInsert(ct, _UU("CM_ST_NUM_ESTABLISHED"), tmp); + } + + if (s->Connected) + { + CtInsert(ct, _UU("CM_ST_HALF_CONNECTION"), s->HalfConnection ? _UU("CM_ST_HALF_TRUE") : _UU("CM_ST_HALF_FALSE")); + + CtInsert(ct, _UU("CM_ST_QOS"), s->QoS ? _UU("CM_ST_QOS_TRUE") : _UU("CM_ST_QOS_FALSE")); + + UniFormat(tmp, sizeof(tmp), L"%u", s->NumTcpConnections); + CtInsert(ct, _UU("CM_ST_NUM_TCP"), tmp); + + if (s->HalfConnection) + { + UniFormat(tmp, sizeof(tmp), L"%u", s->NumTcpConnectionsUpload); + CtInsert(ct, _UU("CM_ST_NUM_TCP_UPLOAD"), tmp); + UniFormat(tmp, sizeof(tmp), L"%u", s->NumTcpConnectionsDownload); + CtInsert(ct, _UU("CM_ST_NUM_TCP_DOWNLOAD"), tmp); + } + + UniFormat(tmp, sizeof(tmp), L"%u", s->MaxTcpConnections); + CtInsert(ct, _UU("CM_ST_MAX_TCP"), tmp); + + if (s->UseEncrypt == false) + { + UniStrCpy(tmp, sizeof(tmp), _UU("CM_ST_USE_ENCRYPT_FALSE")); + } + else + { + if (StrLen(s->CipherName) != 0) + { + UniFormat(tmp, sizeof(tmp), _UU("CM_ST_USE_ENCRYPT_TRUE"), s->CipherName); + } + else + { + UniFormat(tmp, sizeof(tmp), _UU("CM_ST_USE_ENCRYPT_TRUE2")); + } + } + CtInsert(ct, _UU("CM_ST_USE_ENCRYPT"), tmp); + + if (s->UseCompress) + { + UINT percent = 0; + if ((s->TotalRecvSize + s->TotalSendSize) > 0) + { + percent = (UINT)((UINT64)100 - (UINT64)(s->TotalRecvSizeReal + s->TotalSendSizeReal) * (UINT64)100 / + (s->TotalRecvSize + s->TotalSendSize)); + percent = MAKESURE(percent, 0, 100); + } + + UniFormat(tmp, sizeof(tmp), _UU("CM_ST_COMPRESS_TRUE"), percent); + } + else + { + UniStrCpy(tmp, sizeof(tmp), _UU("CM_ST_COMPRESS_FALSE")); + } + CtInsert(ct, _UU("CM_ST_USE_COMPRESS"), tmp); + + if (IsEmptyStr(s->UnderlayProtocol) == false) + { + StrToUni(tmp, sizeof(tmp), s->UnderlayProtocol); + CtInsert(ct, _UU("CM_ST_UNDERLAY_PROTOCOL"), tmp); + } + + if (IsEmptyStr(s->ProtocolDetails) == false) + { + StrToUni(tmp, sizeof(tmp), s->ProtocolDetails); + CtInsert(ct, _UU("CM_ST_PROTOCOL_DETAILS"), tmp); + } + + CtInsert(ct, _UU("CM_ST_UDP_ACCEL_ENABLED"), (s->IsUdpAccelerationEnabled ? _UU("CM_ST_YES") : _UU("CM_ST_NO"))); + CtInsert(ct, _UU("CM_ST_UDP_ACCEL_USING"), (s->IsUsingUdpAcceleration ? _UU("CM_ST_YES") : _UU("CM_ST_NO"))); + + StrToUni(tmp, sizeof(tmp), s->SessionName); + CtInsert(ct, _UU("CM_ST_SESSION_NAME"), tmp); + + StrToUni(tmp, sizeof(tmp), s->ConnectionName); + if (UniStrCmpi(tmp, L"INITING") != 0) + { + CtInsert(ct, _UU("CM_ST_CONNECTION_NAME"), tmp); + } + + BinToStr(str, sizeof(str), s->SessionKey, sizeof(s->SessionKey)); + StrToUni(tmp, sizeof(tmp), str); + CtInsert(ct, _UU("CM_ST_SESSION_KEY"), tmp); + + CtInsert(ct, _UU("CM_ST_BRIDGE_MODE"), s->IsBridgeMode ? _UU("CM_ST_YES") : _UU("CM_ST_NO")); + + CtInsert(ct, _UU("CM_ST_MONITOR_MODE"), s->IsMonitorMode ? _UU("CM_ST_YES") : _UU("CM_ST_NO")); + + ToStr3(vv, sizeof(vv), s->TotalSendSize); + UniFormat(tmp, sizeof(tmp), _UU("CM_ST_SIZE_BYTE_STR"), vv); + CtInsert(ct, _UU("CM_ST_SEND_SIZE"), tmp); + + ToStr3(vv, sizeof(vv), s->TotalRecvSize); + UniFormat(tmp, sizeof(tmp), _UU("CM_ST_SIZE_BYTE_STR"), vv); + CtInsert(ct, _UU("CM_ST_RECV_SIZE"), tmp); + + ToStr3(vv, sizeof(vv), s->Traffic.Send.UnicastCount); + UniFormat(tmp, sizeof(tmp), _UU("CM_ST_NUM_PACKET_STR"), vv); + CtInsert(ct, _UU("CM_ST_SEND_UCAST_NUM"), tmp); + + ToStr3(vv, sizeof(vv), s->Traffic.Send.UnicastBytes); + UniFormat(tmp, sizeof(tmp), _UU("CM_ST_SIZE_BYTE_STR"), vv); + CtInsert(ct, _UU("CM_ST_SEND_UCAST_SIZE"), tmp); + + ToStr3(vv, sizeof(vv), s->Traffic.Send.BroadcastCount); + UniFormat(tmp, sizeof(tmp), _UU("CM_ST_NUM_PACKET_STR"), vv); + CtInsert(ct, _UU("CM_ST_SEND_BCAST_NUM"), tmp); + + ToStr3(vv, sizeof(vv), s->Traffic.Send.BroadcastBytes); + UniFormat(tmp, sizeof(tmp), _UU("CM_ST_SIZE_BYTE_STR"), vv); + CtInsert(ct, _UU("CM_ST_SEND_BCAST_SIZE"), tmp); + + ToStr3(vv, sizeof(vv), s->Traffic.Recv.UnicastCount); + UniFormat(tmp, sizeof(tmp), _UU("CM_ST_NUM_PACKET_STR"), vv); + CtInsert(ct, _UU("CM_ST_RECV_UCAST_NUM"), tmp); + + ToStr3(vv, sizeof(vv), s->Traffic.Recv.UnicastBytes); + UniFormat(tmp, sizeof(tmp), _UU("CM_ST_SIZE_BYTE_STR"), vv); + CtInsert(ct, _UU("CM_ST_RECV_UCAST_SIZE"), tmp); + + ToStr3(vv, sizeof(vv), s->Traffic.Recv.BroadcastCount); + UniFormat(tmp, sizeof(tmp), _UU("CM_ST_NUM_PACKET_STR"), vv); + CtInsert(ct, _UU("CM_ST_RECV_BCAST_NUM"), tmp); + + ToStr3(vv, sizeof(vv), s->Traffic.Recv.BroadcastBytes); + UniFormat(tmp, sizeof(tmp), _UU("CM_ST_SIZE_BYTE_STR"), vv); + CtInsert(ct, _UU("CM_ST_RECV_BCAST_SIZE"), tmp); + } +} + +// Get the current state of the cascade connection +UINT PsCascadeStatusGet(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) +{ + LIST *o; + PS *ps = (PS *)param; + UINT ret = 0; + RPC_LINK_STATUS t; + // Parameter list that can be specified + PARAM args[] = + { + // "name", prompt_proc, prompt_param, eval_proc, eval_param + {"[name]", CmdPrompt, _UU("CMD_CascadeCreate_Prompt_Name"), CmdEvalNotEmpty, NULL}, + }; + + // If virtual HUB is not selected, it's an error + if (ps->HubName == NULL) + { + c->Write(c, _UU("CMD_Hub_Not_Selected")); + return ERR_INVALID_PARAMETER; + } + + o = ParseCommandList(c, cmd_name, str, args, sizeof(args) / sizeof(args[0])); + if (o == NULL) + { + return ERR_INVALID_PARAMETER; + } + + Zero(&t, sizeof(t)); + StrCpy(t.HubName, sizeof(t.HubName), ps->HubName); + UniStrCpy(t.AccountName, sizeof(t.AccountName), GetParamUniStr(o, "[name]")); + + // RPC call + ret = ScGetLinkStatus(ps->Rpc, &t); + + if (ret != ERR_NO_ERROR) + { + // An error has occured + CmdPrintError(c, ret); + FreeParamValueList(o); + return ret; + } + else + { + // Get the cascade connection state + CT *ct = CtNewStandard(); + + CmdPrintStatusToListView(ct, &t.Status); + + CtFree(ct, c); + + FreeRpcLinkStatus(&t); + } + + FreeParamValueList(o); + + return 0; +} + +// Rename the cascade connection +UINT PsCascadeRename(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) +{ + LIST *o; + PS *ps = (PS *)param; + UINT ret = 0; + RPC_RENAME_LINK t; + // Parameter list that can be specified + PARAM args[] = + { + // "name", prompt_proc, prompt_param, eval_proc, eval_param + {"[name]", CmdPrompt, _UU("CMD_CascadeRename_PROMPT_OLD"), CmdEvalNotEmpty, NULL}, + {"NEW", CmdPrompt, _UU("CMD_CascadeRename_PROMPT_NEW"), CmdEvalNotEmpty, NULL}, + }; + + // If virtual HUB is not selected, it's an error + if (ps->HubName == NULL) + { + c->Write(c, _UU("CMD_Hub_Not_Selected")); + return ERR_INVALID_PARAMETER; + } + + o = ParseCommandList(c, cmd_name, str, args, sizeof(args) / sizeof(args[0])); + if (o == NULL) + { + return ERR_INVALID_PARAMETER; + } + + Zero(&t, sizeof(t)); + StrCpy(t.HubName, sizeof(t.HubName), ps->HubName); + + UniStrCpy(t.NewAccountName, sizeof(t.NewAccountName), GetParamUniStr(o, "NEW")); + UniStrCpy(t.OldAccountName, sizeof(t.OldAccountName), GetParamUniStr(o, "[name]")); + + // RPC call + ret = ScRenameLink(ps->Rpc, &t); + + if (ret != ERR_NO_ERROR) + { + // An error has occured + CmdPrintError(c, ret); + FreeParamValueList(o); + return ret; + } + + FreeParamValueList(o); + + return 0; +} + +// Set the cascade connection to on-line state +UINT PsCascadeOnline(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) +{ + LIST *o; + PS *ps = (PS *)param; + UINT ret = 0; + RPC_LINK t; + // Parameter list that can be specified + PARAM args[] = + { + // "name", prompt_proc, prompt_param, eval_proc, eval_param + {"[name]", CmdPrompt, _UU("CMD_CascadeCreate_Prompt_Name"), CmdEvalNotEmpty, NULL}, + }; + + // If virtual HUB is not selected, it's an error + if (ps->HubName == NULL) + { + c->Write(c, _UU("CMD_Hub_Not_Selected")); + return ERR_INVALID_PARAMETER; + } + + o = ParseCommandList(c, cmd_name, str, args, sizeof(args) / sizeof(args[0])); + if (o == NULL) + { + return ERR_INVALID_PARAMETER; + } + + Zero(&t, sizeof(t)); + StrCpy(t.HubName, sizeof(t.HubName), ps->HubName); + UniStrCpy(t.AccountName, sizeof(t.AccountName), GetParamUniStr(o, "[name]")); + + // RPC call + ret = ScSetLinkOnline(ps->Rpc, &t); + + if (ret != ERR_NO_ERROR) + { + // An error has occured + CmdPrintError(c, ret); + FreeParamValueList(o); + return ret; + } + + FreeParamValueList(o); + + return 0; +} + +// Set the cascade connection to the off-line state +UINT PsCascadeOffline(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) +{ + LIST *o; + PS *ps = (PS *)param; + UINT ret = 0; + RPC_LINK t; + // Parameter list that can be specified + PARAM args[] = + { + // "name", prompt_proc, prompt_param, eval_proc, eval_param + {"[name]", CmdPrompt, _UU("CMD_CascadeCreate_Prompt_Name"), CmdEvalNotEmpty, NULL}, + }; + + // If virtual HUB is not selected, it's an error + if (ps->HubName == NULL) + { + c->Write(c, _UU("CMD_Hub_Not_Selected")); + return ERR_INVALID_PARAMETER; + } + + o = ParseCommandList(c, cmd_name, str, args, sizeof(args) / sizeof(args[0])); + if (o == NULL) + { + return ERR_INVALID_PARAMETER; + } + + Zero(&t, sizeof(t)); + StrCpy(t.HubName, sizeof(t.HubName), ps->HubName); + UniStrCpy(t.AccountName, sizeof(t.AccountName), GetParamUniStr(o, "[name]")); + + // RPC call + ret = ScSetLinkOffline(ps->Rpc, &t); + + if (ret != ERR_NO_ERROR) + { + // An error has occured + CmdPrintError(c, ret); + FreeParamValueList(o); + return ret; + } + + FreeParamValueList(o); + + return 0; +} + +// Convert the string to pass / discard flag +bool StrToPassOrDiscard(char *str) +{ + // Validate arguments + if (str == NULL) + { + return false; + } + + if (ToInt(str) != 0) + { + return true; + } + + if (StartWith(str, "p") || StartWith(str, "y") || StartWith(str, "t")) + { + return true; + } + + return false; +} + +// Convert the string to the protocol +UINT StrToProtocol(char *str) +{ + if (IsEmptyStr(str)) + { + return 0; + } + + if (StartWith("ip", str)) + { + return 0; + } + else if (StartWith("tcp", str)) + { + return IP_PROTO_TCP; + } + else if (StartWith("udp", str)) + { + return IP_PROTO_UDP; + } + else if (StartWith("icmpv4", str)) + { + return IP_PROTO_ICMPV4; + } + else if (StartWith("icmpv6", str)) + { + return IP_PROTO_ICMPV6; + } + + if (ToInt(str) == 0) + { + if (StrCmpi(str, "0") == 0) + { + return 0; + } + else + { + return INFINITE; + } + } + + if (ToInt(str) >= 256) + { + return INFINITE; + } + + return ToInt(str); +} + +// Check the protocol name +bool CmdEvalProtocol(CONSOLE *c, wchar_t *str, void *param) +{ + char tmp[64]; + // Validate arguments + if (c == NULL || str == NULL) + { + return false; + } + + UniToStr(tmp, sizeof(tmp), str); + + if (StrToProtocol(tmp) == INFINITE) + { + c->Write(c, _UU("CMD_PROTOCOL_EVAL_FAILED")); + return false; + } + + return true; +} + +// Parse the port range +bool ParsePortRange(char *str, UINT *start, UINT *end) +{ + UINT a = 0, b = 0; + TOKEN_LIST *t; + // Validate arguments + if (str == NULL) + { + return false; + } + + if (IsEmptyStr(str) == false) + { + + t = ParseToken(str, "\t -"); + + if (t->NumTokens == 1) + { + a = b = ToInt(t->Token[0]); + } + else if (t->NumTokens == 2) + { + a = ToInt(t->Token[0]); + b = ToInt(t->Token[1]); + } + + FreeToken(t); + + if (a > b) + { + return false; + } + + if (a >= 65536 || b >= 65536) + { + return false; + } + + if (a == 0 && b != 0) + { + return false; + } + } + + if (start != NULL) + { + *start = a; + } + if (end != NULL) + { + *end = b; + } + + return true; +} + +// Check the port range +bool CmdEvalPortRange(CONSOLE *c, wchar_t *str, void *param) +{ + char tmp[64]; + // Validate arguments + if (c == NULL || str == NULL) + { + return false; + } + + UniToStr(tmp, sizeof(tmp), str); + + if (ParsePortRange(tmp, NULL, NULL) == false) + { + c->Write(c, _UU("CMD_PORT_RANGE_EVAL_FAILED")); + return false; + } + + return true; +} + +// Parse the MAC address and the mask +bool ParseMacAddressAndMask(char *src, bool *check_mac, UCHAR *mac_bin, UCHAR *mask_bin) +{ + TOKEN_LIST *t; + char *macstr, *maskstr; + UCHAR mac[6], mask[6]; + bool ok = false; + + // Validate arguments + if (src == NULL) + { + return false; + } + + //Zero(mac, sizeof(mac)); + //Zero(mask, sizeof(mask)); + + if(check_mac != NULL && mac_bin != NULL && mask_bin != NULL) + { + ok = true; + } + if(IsEmptyStr(src) != false) + { + if(ok != false) + { + *check_mac = false; + Zero(mac_bin, 6); + Zero(mask_bin, 6); + } + return true; + } + + t = ParseToken(src, "/"); + if(t->NumTokens != 2) + { + FreeToken(t); + return false; + } + + macstr = t->Token[0]; + maskstr = t->Token[1]; + + Trim(macstr); + Trim(maskstr); + + if(StrToMac(mac, macstr) == false || StrToMac(mask, maskstr) == false) + { + FreeToken(t); + return false; + } + else + { + if(ok != false) + { + Copy(mac_bin, mac, 6); + Copy(mask_bin, mask, 6); + *check_mac = true; + } + } + FreeToken(t); + + return true; +} + +// Check the MAC address and mask +bool CmdEvalMacAddressAndMask(CONSOLE *c, wchar_t *str, void *param) +{ + char tmp[64]; + // Validate arguments + if(c == NULL || str == NULL) + { + return false; + } + + UniToStr(tmp, sizeof(tmp), str); + + + if(ParseMacAddressAndMask(tmp, NULL, NULL, NULL) == false) + { + c->Write(c, _UU("CMD_MAC_ADDRESS_AND_MASK_EVAL_FAILED")); + return false; + } + + return true; +} +// Parse the status of TCP connection +bool ParseTcpState(char *src, bool *check_tcp_state, bool *established) +{ + bool ok = false; + // Validate arguments + if(src == NULL) + { + return false; + } + + if(check_tcp_state != NULL && established != NULL) + { + ok = true; + } + + if (IsEmptyStr(src) == false) + { + if (StartWith("Established", src) == 0) + { + if(ok != false) + { + *check_tcp_state = true; + *established = true; + } + } + else if (StartWith("Unestablished", src) == 0) + { + if(ok != false) + { + *check_tcp_state = true; + *established = false; + } + } + else + { + // Illegal string + return false; + } + } + else + { + if(ok != false) + { + *check_tcp_state = false; + *established = false; + } + } + + return true; +} +// Check the status of the TCP connection +bool CmdEvalTcpState(CONSOLE *c, wchar_t *str, void *param) +{ + char tmp[64]; + // Validate arguments + if(c == NULL || str == NULL) + { + return false; + } + + UniToStr(tmp, sizeof(tmp), str); + + if(ParseTcpState(tmp, NULL, NULL) == false) + { + c->Write(c, _UU("CMD_TCP_CONNECTION_STATE_EVAL_FAILED")); + return false; + } + + return true; +} + +// Adding a rule to the access list (Standard, IPv4) +UINT PsAccessAdd(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) +{ + LIST *o; + PS *ps = (PS *)param; + UINT ret = 0; + RPC_ADD_ACCESS t; + ACCESS *a; + // Parameter list that can be specified + CMD_EVAL_MIN_MAX minmax = + { + "CMD_AccessAdd_Eval_PRIORITY", 1, 4294967295UL, + }; + PARAM args[] = + { + // "name", prompt_proc, prompt_param, eval_proc, eval_param + {"[pass|discard]", CmdPrompt, _UU("CMD_AccessAdd_Prompt_TYPE"), CmdEvalNotEmpty, NULL}, + {"MEMO", CmdPrompt, _UU("CMD_AccessAdd_Prompt_MEMO"), NULL, NULL}, + {"PRIORITY", CmdPrompt, _UU("CMD_AccessAdd_Prompt_PRIORITY"), CmdEvalMinMax, &minmax}, + {"SRCUSERNAME", CmdPrompt, _UU("CMD_AccessAdd_Prompt_SRCUSERNAME"), NULL, NULL}, + {"DESTUSERNAME", CmdPrompt, _UU("CMD_AccessAdd_Prompt_DESTUSERNAME"), NULL, NULL}, + {"SRCMAC", CmdPrompt, _UU("CMD_AccessAdd_Prompt_SRCMAC"), CmdEvalMacAddressAndMask, NULL}, + {"DESTMAC", CmdPrompt, _UU("CMD_AccessAdd_Prompt_DESTMAC"), CmdEvalMacAddressAndMask, NULL}, + {"SRCIP", CmdPrompt, _UU("CMD_AccessAdd_Prompt_SRCIP"), CmdEvalIpAndMask4, NULL}, + {"DESTIP", CmdPrompt, _UU("CMD_AccessAdd_Prompt_DESTIP"), CmdEvalIpAndMask4, NULL}, + {"PROTOCOL", CmdPrompt, _UU("CMD_AccessAdd_Prompt_PROTOCOL"), CmdEvalProtocol, NULL}, + {"SRCPORT", CmdPrompt, _UU("CMD_AccessAdd_Prompt_SRCPORT"), CmdEvalPortRange, NULL}, + {"DESTPORT", CmdPrompt, _UU("CMD_AccessAdd_Prompt_DESTPORT"), CmdEvalPortRange, NULL}, + {"TCPSTATE", CmdPrompt, _UU("CMD_AccessAdd_Prompt_TCPSTATE"), CmdEvalTcpState, NULL}, + }; + + // If virtual HUB is not selected, it's an error + if (ps->HubName == NULL) + { + c->Write(c, _UU("CMD_Hub_Not_Selected")); + return ERR_INVALID_PARAMETER; + } + + o = ParseCommandList(c, cmd_name, str, args, sizeof(args) / sizeof(args[0])); + if (o == NULL) + { + return ERR_INVALID_PARAMETER; + } + + Zero(&t, sizeof(t)); + a = &t.Access; + + StrCpy(t.HubName, sizeof(t.HubName), ps->HubName); + UniStrCpy(a->Note, sizeof(a->Note), GetParamUniStr(o, "MEMO")); + a->Active = true; + a->Priority = GetParamInt(o, "PRIORITY"); + a->Discard = StrToPassOrDiscard(GetParamStr(o, "[pass|discard]")) ? false : true; + StrCpy(a->SrcUsername, sizeof(a->SrcUsername), GetParamStr(o, "SRCUSERNAME")); + StrCpy(a->DestUsername, sizeof(a->DestUsername), GetParamStr(o, "DESTUSERNAME")); + ParseMacAddressAndMask(GetParamStr(o, "SRCMAC"), &a->CheckSrcMac, a->SrcMacAddress, a->SrcMacMask); + ParseMacAddressAndMask(GetParamStr(o, "DESTMAC"), &a->CheckDstMac, a->DstMacAddress, a->DstMacMask); + ParseIpAndMask4(GetParamStr(o, "SRCIP"), &a->SrcIpAddress, &a->SrcSubnetMask); + ParseIpAndMask4(GetParamStr(o, "DESTIP"), &a->DestIpAddress, &a->DestSubnetMask); + a->Protocol = StrToProtocol(GetParamStr(o, "PROTOCOL")); + ParsePortRange(GetParamStr(o, "SRCPORT"), &a->SrcPortStart, &a->SrcPortEnd); + ParsePortRange(GetParamStr(o, "DESTPORT"), &a->DestPortStart, &a->DestPortEnd); + ParseTcpState(GetParamStr(o, "TCPSTATE"), &a->CheckTcpState, &a->Established); + + // RPC call + ret = ScAddAccess(ps->Rpc, &t); + + if (ret != ERR_NO_ERROR) + { + // An error has occured + CmdPrintError(c, ret); + FreeParamValueList(o); + return ret; + } + + FreeParamValueList(o); + + return 0; +} + +// Adding a rule to the access list (Extended, IPv4) +UINT PsAccessAddEx(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) +{ + LIST *o; + PS *ps = (PS *)param; + UINT ret = 0; + RPC_ADD_ACCESS t; + ACCESS *a; + // Parameter list that can be specified + CMD_EVAL_MIN_MAX minmax = + { + "CMD_AccessAdd_Eval_PRIORITY", 1, 4294967295UL, + }; + CMD_EVAL_MIN_MAX minmax_delay = + { + "CMD_AccessAddEx_Eval_DELAY", 0, HUB_ACCESSLIST_DELAY_MAX, + }; + CMD_EVAL_MIN_MAX minmax_jitter = + { + "CMD_AccessAddEx_Eval_JITTER", 0, HUB_ACCESSLIST_JITTER_MAX, + }; + CMD_EVAL_MIN_MAX minmax_loss = + { + "CMD_AccessAddEx_Eval_LOSS", 0, HUB_ACCESSLIST_LOSS_MAX, + }; + PARAM args[] = + { + // "name", prompt_proc, prompt_param, eval_proc, eval_param + {"[pass|discard]", CmdPrompt, _UU("CMD_AccessAdd_Prompt_TYPE"), CmdEvalNotEmpty, NULL}, + {"MEMO", CmdPrompt, _UU("CMD_AccessAdd_Prompt_MEMO"), NULL, NULL}, + {"PRIORITY", CmdPrompt, _UU("CMD_AccessAdd_Prompt_PRIORITY"), CmdEvalMinMax, &minmax}, + {"SRCUSERNAME", CmdPrompt, _UU("CMD_AccessAdd_Prompt_SRCUSERNAME"), NULL, NULL}, + {"DESTUSERNAME", CmdPrompt, _UU("CMD_AccessAdd_Prompt_DESTUSERNAME"), NULL, NULL}, + {"SRCMAC", CmdPrompt, _UU("CMD_AccessAdd_Prompt_SRCMAC"), CmdEvalMacAddressAndMask, NULL}, + {"DESTMAC", CmdPrompt, _UU("CMD_AccessAdd_Prompt_DESTMAC"), CmdEvalMacAddressAndMask, NULL}, + {"SRCIP", CmdPrompt, _UU("CMD_AccessAdd_Prompt_SRCIP"), CmdEvalIpAndMask4, NULL}, + {"DESTIP", CmdPrompt, _UU("CMD_AccessAdd_Prompt_DESTIP"), CmdEvalIpAndMask4, NULL}, + {"PROTOCOL", CmdPrompt, _UU("CMD_AccessAdd_Prompt_PROTOCOL"), CmdEvalProtocol, NULL}, + {"SRCPORT", CmdPrompt, _UU("CMD_AccessAdd_Prompt_SRCPORT"), CmdEvalPortRange, NULL}, + {"DESTPORT", CmdPrompt, _UU("CMD_AccessAdd_Prompt_DESTPORT"), CmdEvalPortRange, NULL}, + {"TCPSTATE", CmdPrompt, _UU("CMD_AccessAdd_Prompt_TCPSTATE"), CmdEvalTcpState, NULL}, + {"DELAY", CmdPrompt, _UU("CMD_AccessAddEx_Prompt_DELAY"), CmdEvalMinMax, &minmax_delay}, + {"JITTER", CmdPrompt, _UU("CMD_AccessAddEx_Prompt_JITTER"), CmdEvalMinMax, &minmax_jitter}, + {"LOSS", CmdPrompt, _UU("CMD_AccessAddEx_Prompt_LOSS"), CmdEvalMinMax, &minmax_loss}, + {"REDIRECTURL", NULL, NULL, NULL, NULL}, + }; + + // If virtual HUB is not selected, it's an error + if (ps->HubName == NULL) + { + c->Write(c, _UU("CMD_Hub_Not_Selected")); + return ERR_INVALID_PARAMETER; + } + + // Check whether it is supported + if (GetCapsBool(ps->CapsList, "b_support_ex_acl") == false) + { + c->Write(c, _E(ERR_NOT_SUPPORTED)); + return ERR_NOT_SUPPORTED; + } + + o = ParseCommandList(c, cmd_name, str, args, sizeof(args) / sizeof(args[0])); + if (o == NULL) + { + return ERR_INVALID_PARAMETER; + } + + Zero(&t, sizeof(t)); + a = &t.Access; + + StrCpy(t.HubName, sizeof(t.HubName), ps->HubName); + UniStrCpy(a->Note, sizeof(a->Note), GetParamUniStr(o, "MEMO")); + a->Active = true; + a->Priority = GetParamInt(o, "PRIORITY"); + a->Discard = StrToPassOrDiscard(GetParamStr(o, "[pass|discard]")) ? false : true; + StrCpy(a->SrcUsername, sizeof(a->SrcUsername), GetParamStr(o, "SRCUSERNAME")); + StrCpy(a->DestUsername, sizeof(a->DestUsername), GetParamStr(o, "DESTUSERNAME")); + ParseMacAddressAndMask(GetParamStr(o, "SRCMAC"), &a->CheckSrcMac, a->SrcMacAddress, a->SrcMacMask); + ParseMacAddressAndMask(GetParamStr(o, "DESTMAC"), &a->CheckDstMac, a->DstMacAddress, a->DstMacMask); + ParseIpAndMask4(GetParamStr(o, "SRCIP"), &a->SrcIpAddress, &a->SrcSubnetMask); + ParseIpAndMask4(GetParamStr(o, "DESTIP"), &a->DestIpAddress, &a->DestSubnetMask); + a->Protocol = StrToProtocol(GetParamStr(o, "PROTOCOL")); + ParsePortRange(GetParamStr(o, "SRCPORT"), &a->SrcPortStart, &a->SrcPortEnd); + ParsePortRange(GetParamStr(o, "DESTPORT"), &a->DestPortStart, &a->DestPortEnd); + ParseTcpState(GetParamStr(o, "TCPSTATE"), &a->CheckTcpState, &a->Established); + a->Delay = GetParamInt(o, "DELAY"); + a->Jitter = GetParamInt(o, "JITTER"); + a->Loss = GetParamInt(o, "LOSS"); + StrCpy(a->RedirectUrl, sizeof(a->RedirectUrl), GetParamStr(o, "REDIRECTURL")); + + // RPC call + ret = ScAddAccess(ps->Rpc, &t); + + if (ret != ERR_NO_ERROR) + { + // An error has occured + CmdPrintError(c, ret); + FreeParamValueList(o); + return ret; + } + + FreeParamValueList(o); + + return 0; +} + +// Adding a rule to the access list (Standard, IPv6) +UINT PsAccessAdd6(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) +{ + LIST *o; + PS *ps = (PS *)param; + UINT ret = 0; + RPC_ADD_ACCESS t; + ACCESS *a; + IP ip, mask; + // Parameter list that can be specified + CMD_EVAL_MIN_MAX minmax = + { + "CMD_AccessAdd6_Eval_PRIORITY", 1, 4294967295UL, + }; + PARAM args[] = + { + // "name", prompt_proc, prompt_param, eval_proc, eval_param + {"[pass|discard]", CmdPrompt, _UU("CMD_AccessAdd6_Prompt_TYPE"), CmdEvalNotEmpty, NULL}, + {"MEMO", CmdPrompt, _UU("CMD_AccessAdd6_Prompt_MEMO"), NULL, NULL}, + {"PRIORITY", CmdPrompt, _UU("CMD_AccessAdd6_Prompt_PRIORITY"), CmdEvalMinMax, &minmax}, + {"SRCUSERNAME", CmdPrompt, _UU("CMD_AccessAdd6_Prompt_SRCUSERNAME"), NULL, NULL}, + {"DESTUSERNAME", CmdPrompt, _UU("CMD_AccessAdd6_Prompt_DESTUSERNAME"), NULL, NULL}, + {"SRCMAC", CmdPrompt, _UU("CMD_AccessAdd6_Prompt_SRCMAC"), CmdEvalMacAddressAndMask, NULL}, + {"DESTMAC", CmdPrompt, _UU("CMD_AccessAdd6_Prompt_DESTMAC"), CmdEvalMacAddressAndMask, NULL}, + {"SRCIP", CmdPrompt, _UU("CMD_AccessAdd6_Prompt_SRCIP"), CmdEvalIpAndMask6, NULL}, + {"DESTIP", CmdPrompt, _UU("CMD_AccessAdd6_Prompt_DESTIP"), CmdEvalIpAndMask6, NULL}, + {"PROTOCOL", CmdPrompt, _UU("CMD_AccessAdd6_Prompt_PROTOCOL"), CmdEvalProtocol, NULL}, + {"SRCPORT", CmdPrompt, _UU("CMD_AccessAdd6_Prompt_SRCPORT"), CmdEvalPortRange, NULL}, + {"DESTPORT", CmdPrompt, _UU("CMD_AccessAdd6_Prompt_DESTPORT"), CmdEvalPortRange, NULL}, + {"TCPSTATE", CmdPrompt, _UU("CMD_AccessAdd6_Prompt_TCPSTATE"), CmdEvalTcpState, NULL}, + }; + + // If virtual HUB is not selected, it's an error + if (ps->HubName == NULL) + { + c->Write(c, _UU("CMD_Hub_Not_Selected")); + return ERR_INVALID_PARAMETER; + } + + // Check whether it is supported + if (GetCapsBool(ps->CapsList, "b_support_ex_acl") == false) + { + c->Write(c, _E(ERR_NOT_SUPPORTED)); + return ERR_NOT_SUPPORTED; + } + + o = ParseCommandList(c, cmd_name, str, args, sizeof(args) / sizeof(args[0])); + if (o == NULL) + { + return ERR_INVALID_PARAMETER; + } + + Zero(&t, sizeof(t)); + a = &t.Access; + + a->IsIPv6 = true; + + StrCpy(t.HubName, sizeof(t.HubName), ps->HubName); + UniStrCpy(a->Note, sizeof(a->Note), GetParamUniStr(o, "MEMO")); + a->Active = true; + a->Priority = GetParamInt(o, "PRIORITY"); + a->Discard = StrToPassOrDiscard(GetParamStr(o, "[pass|discard]")) ? false : true; + StrCpy(a->SrcUsername, sizeof(a->SrcUsername), GetParamStr(o, "SRCUSERNAME")); + StrCpy(a->DestUsername, sizeof(a->DestUsername), GetParamStr(o, "DESTUSERNAME")); + ParseMacAddressAndMask(GetParamStr(o, "SRCMAC"), &a->CheckSrcMac, a->SrcMacAddress, a->SrcMacMask); + ParseMacAddressAndMask(GetParamStr(o, "DESTMAC"), &a->CheckDstMac, a->DstMacAddress, a->DstMacMask); + + Zero(&ip, sizeof(ip)); + Zero(&mask, sizeof(mask)); + + ParseIpAndMask6(GetParamStr(o, "SRCIP"), &ip, &mask); + IPToIPv6Addr(&a->SrcIpAddress6, &ip); + IPToIPv6Addr(&a->SrcSubnetMask6, &mask); + + ParseIpAndMask6(GetParamStr(o, "DESTIP"), &ip, &mask); + IPToIPv6Addr(&a->DestIpAddress6, &ip); + IPToIPv6Addr(&a->DestSubnetMask6, &mask); + + a->Protocol = StrToProtocol(GetParamStr(o, "PROTOCOL")); + ParsePortRange(GetParamStr(o, "SRCPORT"), &a->SrcPortStart, &a->SrcPortEnd); + ParsePortRange(GetParamStr(o, "DESTPORT"), &a->DestPortStart, &a->DestPortEnd); + ParseTcpState(GetParamStr(o, "TCPSTATE"), &a->CheckTcpState, &a->Established); + + // RPC call + ret = ScAddAccess(ps->Rpc, &t); + + if (ret != ERR_NO_ERROR) + { + // An error has occured + CmdPrintError(c, ret); + FreeParamValueList(o); + return ret; + } + + FreeParamValueList(o); + + return 0; +} + +// Adding a rule to the access list (Extended, IPv6) +UINT PsAccessAddEx6(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) +{ + LIST *o; + PS *ps = (PS *)param; + UINT ret = 0; + RPC_ADD_ACCESS t; + ACCESS *a; + IP ip, mask; + // Parameter list that can be specified + CMD_EVAL_MIN_MAX minmax = + { + "CMD_AccessAdd6_Eval_PRIORITY", 1, 4294967295UL, + }; + CMD_EVAL_MIN_MAX minmax_delay = + { + "CMD_AccessAddEx6_Eval_DELAY", 0, HUB_ACCESSLIST_DELAY_MAX, + }; + CMD_EVAL_MIN_MAX minmax_jitter = + { + "CMD_AccessAddEx6_Eval_JITTER", 0, HUB_ACCESSLIST_JITTER_MAX, + }; + CMD_EVAL_MIN_MAX minmax_loss = + { + "CMD_AccessAddEx6_Eval_LOSS", 0, HUB_ACCESSLIST_LOSS_MAX, + }; + PARAM args[] = + { + // "name", prompt_proc, prompt_param, eval_proc, eval_param + {"[pass|discard]", CmdPrompt, _UU("CMD_AccessAdd6_Prompt_TYPE"), CmdEvalNotEmpty, NULL}, + {"MEMO", CmdPrompt, _UU("CMD_AccessAdd6_Prompt_MEMO"), NULL, NULL}, + {"PRIORITY", CmdPrompt, _UU("CMD_AccessAdd6_Prompt_PRIORITY"), CmdEvalMinMax, &minmax}, + {"SRCUSERNAME", CmdPrompt, _UU("CMD_AccessAdd6_Prompt_SRCUSERNAME"), NULL, NULL}, + {"DESTUSERNAME", CmdPrompt, _UU("CMD_AccessAdd6_Prompt_DESTUSERNAME"), NULL, NULL}, + {"SRCMAC", CmdPrompt, _UU("CMD_AccessAdd6_Prompt_SRCMAC"), CmdEvalMacAddressAndMask, NULL}, + {"DESTMAC", CmdPrompt, _UU("CMD_AccessAdd6_Prompt_DESTMAC"), CmdEvalMacAddressAndMask, NULL}, + {"SRCIP", CmdPrompt, _UU("CMD_AccessAdd6_Prompt_SRCIP"), CmdEvalIpAndMask6, NULL}, + {"DESTIP", CmdPrompt, _UU("CMD_AccessAdd6_Prompt_DESTIP"), CmdEvalIpAndMask6, NULL}, + {"PROTOCOL", CmdPrompt, _UU("CMD_AccessAdd6_Prompt_PROTOCOL"), CmdEvalProtocol, NULL}, + {"SRCPORT", CmdPrompt, _UU("CMD_AccessAdd6_Prompt_SRCPORT"), CmdEvalPortRange, NULL}, + {"DESTPORT", CmdPrompt, _UU("CMD_AccessAdd6_Prompt_DESTPORT"), CmdEvalPortRange, NULL}, + {"TCPSTATE", CmdPrompt, _UU("CMD_AccessAdd6_Prompt_TCPSTATE"), CmdEvalTcpState, NULL}, + {"DELAY", CmdPrompt, _UU("CMD_AccessAddEx6_Prompt_DELAY"), CmdEvalMinMax, &minmax_delay}, + {"JITTER", CmdPrompt, _UU("CMD_AccessAddEx6_Prompt_JITTER"), CmdEvalMinMax, &minmax_jitter}, + {"LOSS", CmdPrompt, _UU("CMD_AccessAddEx6_Prompt_LOSS"), CmdEvalMinMax, &minmax_loss}, + {"REDIRECTURL", NULL, NULL, NULL, NULL}, + }; + + // If virtual HUB is not selected, it's an error + if (ps->HubName == NULL) + { + c->Write(c, _UU("CMD_Hub_Not_Selected")); + return ERR_INVALID_PARAMETER; + } + + // Check whether it is supported + if (GetCapsBool(ps->CapsList, "b_support_ex_acl") == false) + { + c->Write(c, _E(ERR_NOT_SUPPORTED)); + return ERR_NOT_SUPPORTED; + } + + o = ParseCommandList(c, cmd_name, str, args, sizeof(args) / sizeof(args[0])); + if (o == NULL) + { + return ERR_INVALID_PARAMETER; + } + + Zero(&t, sizeof(t)); + a = &t.Access; + + a->IsIPv6 = true; + + StrCpy(t.HubName, sizeof(t.HubName), ps->HubName); + UniStrCpy(a->Note, sizeof(a->Note), GetParamUniStr(o, "MEMO")); + a->Active = true; + a->Priority = GetParamInt(o, "PRIORITY"); + a->Discard = StrToPassOrDiscard(GetParamStr(o, "[pass|discard]")) ? false : true; + StrCpy(a->SrcUsername, sizeof(a->SrcUsername), GetParamStr(o, "SRCUSERNAME")); + StrCpy(a->DestUsername, sizeof(a->DestUsername), GetParamStr(o, "DESTUSERNAME")); + ParseMacAddressAndMask(GetParamStr(o, "SRCMAC"), &a->CheckSrcMac, a->SrcMacAddress, a->SrcMacMask); + ParseMacAddressAndMask(GetParamStr(o, "DESTMAC"), &a->CheckDstMac, a->DstMacAddress, a->DstMacMask); + + Zero(&ip, sizeof(ip)); + Zero(&mask, sizeof(mask)); + + ParseIpAndMask6(GetParamStr(o, "SRCIP"), &ip, &mask); + IPToIPv6Addr(&a->SrcIpAddress6, &ip); + IPToIPv6Addr(&a->SrcSubnetMask6, &mask); + + ParseIpAndMask6(GetParamStr(o, "DESTIP"), &ip, &mask); + IPToIPv6Addr(&a->DestIpAddress6, &ip); + IPToIPv6Addr(&a->DestSubnetMask6, &mask); + + a->Protocol = StrToProtocol(GetParamStr(o, "PROTOCOL")); + ParsePortRange(GetParamStr(o, "SRCPORT"), &a->SrcPortStart, &a->SrcPortEnd); + ParsePortRange(GetParamStr(o, "DESTPORT"), &a->DestPortStart, &a->DestPortEnd); + ParseTcpState(GetParamStr(o, "TCPSTATE"), &a->CheckTcpState, &a->Established); + a->Delay = GetParamInt(o, "DELAY"); + a->Jitter = GetParamInt(o, "JITTER"); + a->Loss = GetParamInt(o, "LOSS"); + StrCpy(a->RedirectUrl, sizeof(a->RedirectUrl), GetParamStr(o, "REDIRECTURL")); + + // RPC call + ret = ScAddAccess(ps->Rpc, &t); + + if (ret != ERR_NO_ERROR) + { + // An error has occured + CmdPrintError(c, ret); + FreeParamValueList(o); + return ret; + } + + FreeParamValueList(o); + + return 0; +} + + +// Get the list of rules in the access list +UINT PsAccessList(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) +{ + LIST *o; + PS *ps = (PS *)param; + UINT ret = 0; + RPC_ENUM_ACCESS_LIST t; + CT *ct; + UINT i; + + // If virtual HUB is not selected, it's an error + if (ps->HubName == NULL) + { + c->Write(c, _UU("CMD_Hub_Not_Selected")); + return ERR_INVALID_PARAMETER; + } + + o = ParseCommandList(c, cmd_name, str, NULL, 0); + if (o == NULL) + { + return ERR_INVALID_PARAMETER; + } + + Zero(&t, sizeof(t)); + StrCpy(t.HubName, sizeof(t.HubName), ps->HubName); + + // RPC call + ret = ScEnumAccess(ps->Rpc, &t); + + if (ret != ERR_NO_ERROR) + { + // An error has occured + CmdPrintError(c, ret); + FreeParamValueList(o); + return ret; + } + + ct = CtNew(); + CtInsertColumn(ct, _UU("SM_ACCESS_COLUMN_0"), true); + CtInsertColumn(ct, _UU("SM_ACCESS_COLUMN_1"), true); + CtInsertColumn(ct, _UU("SM_ACCESS_COLUMN_2"), true); + CtInsertColumn(ct, _UU("SM_ACCESS_COLUMN_3"), true); + CtInsertColumn(ct, _UU("SM_ACCESS_COLUMN_6"), true); + CtInsertColumn(ct, _UU("SM_ACCESS_COLUMN_5"), false); + CtInsertColumn(ct, _UU("SM_ACCESS_COLUMN_4"), false); + + for (i = 0;i < t.NumAccess;i++) + { + ACCESS *a = &t.Accesses[i]; + char tmp[MAX_SIZE]; + wchar_t tmp3[MAX_SIZE]; + wchar_t tmp1[MAX_SIZE]; + wchar_t tmp2[MAX_SIZE]; + wchar_t tmp4[MAX_SIZE]; + + GetAccessListStr(tmp, sizeof(tmp), a); + UniToStru(tmp1, a->Priority); + StrToUni(tmp2, sizeof(tmp2), tmp); + UniToStru(tmp4, a->UniqueId); + if (a->UniqueId == 0) + { + UniStrCpy(tmp4, sizeof(tmp4), _UU("SEC_NONE")); + } + + UniToStru(tmp3, a->Id); + + CtInsert(ct, + tmp3, + a->Discard ? _UU("SM_ACCESS_DISCARD") : _UU("SM_ACCESS_PASS"), + a->Active ? _UU("SM_ACCESS_ENABLE") : _UU("SM_ACCESS_DISABLE"), + tmp1, + tmp4, + tmp2, + a->Note); + } + + CtFreeEx(ct, c, true); + + FreeRpcEnumAccessList(&t); + + FreeParamValueList(o); + + return 0; +} + +// Remove a rule from the access list +UINT PsAccessDelete(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) +{ + LIST *o; + PS *ps = (PS *)param; + UINT ret = 0; + RPC_DELETE_ACCESS t; + // Parameter list that can be specified + PARAM args[] = + { + // "name", prompt_proc, prompt_param, eval_proc, eval_param + {"[id]", CmdPrompt, _UU("CMD_Access_Prompt_ID"), CmdEvalNotEmpty, NULL}, + }; + + // If virtual HUB is not selected, it's an error + if (ps->HubName == NULL) + { + c->Write(c, _UU("CMD_Hub_Not_Selected")); + return ERR_INVALID_PARAMETER; + } + + o = ParseCommandList(c, cmd_name, str, args, sizeof(args) / sizeof(args[0])); + if (o == NULL) + { + return ERR_INVALID_PARAMETER; + } + + Zero(&t, sizeof(t)); + StrCpy(t.HubName, sizeof(t.HubName), ps->HubName); + t.Id = GetParamInt(o, "[id]"); + + // RPC call + ret = ScDeleteAccess(ps->Rpc, &t); + + if (ret != ERR_NO_ERROR) + { + // An error has occured + CmdPrintError(c, ret); + FreeParamValueList(o); + return ret; + } + + FreeParamValueList(o); + + return 0; +} + +// Enable the rule of access list +UINT PsAccessEnable(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) +{ + LIST *o; + PS *ps = (PS *)param; + UINT ret = 0; + RPC_ENUM_ACCESS_LIST t; + // Parameter list that can be specified + PARAM args[] = + { + // "name", prompt_proc, prompt_param, eval_proc, eval_param + {"[id]", CmdPrompt, _UU("CMD_Access_Prompt_ID"), CmdEvalNotEmpty, NULL}, + }; + + // If virtual HUB is not selected, it's an error + if (ps->HubName == NULL) + { + c->Write(c, _UU("CMD_Hub_Not_Selected")); + return ERR_INVALID_PARAMETER; + } + + o = ParseCommandList(c, cmd_name, str, args, sizeof(args) / sizeof(args[0])); + if (o == NULL) + { + return ERR_INVALID_PARAMETER; + } + + Zero(&t, sizeof(t)); + StrCpy(t.HubName, sizeof(t.HubName), ps->HubName); + + // RPC call + ret = ScEnumAccess(ps->Rpc, &t); + + if (ret != ERR_NO_ERROR) + { + // An error has occured + CmdPrintError(c, ret); + FreeParamValueList(o); + return ret; + } + else + { + UINT i; + bool b = false; + for (i = 0;i < t.NumAccess;i++) + { + ACCESS *a = &t.Accesses[i]; + + if (a->Id == GetParamInt(o, "[id]")) + { + b = true; + + a->Active = true; + } + } + + if (b == false) + { + // The specified ID is not found + ret = ERR_OBJECT_NOT_FOUND; + CmdPrintError(c, ret); + FreeParamValueList(o); + FreeRpcEnumAccessList(&t); + return ret; + } + + ret = ScSetAccessList(ps->Rpc, &t); + if (ret != ERR_NO_ERROR) + { + // An error has occured + CmdPrintError(c, ret); + FreeParamValueList(o); + return ret; + } + + FreeRpcEnumAccessList(&t); + } + + FreeParamValueList(o); + + return ret; +} + +// Disable the rule of access list +UINT PsAccessDisable(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) +{ + LIST *o; + PS *ps = (PS *)param; + UINT ret = 0; + RPC_ENUM_ACCESS_LIST t; + // Parameter list that can be specified + PARAM args[] = + { + // "name", prompt_proc, prompt_param, eval_proc, eval_param + {"[id]", CmdPrompt, _UU("CMD_Access_Prompt_ID"), CmdEvalNotEmpty, NULL}, + }; + + // If virtual HUB is not selected, it's an error + if (ps->HubName == NULL) + { + c->Write(c, _UU("CMD_Hub_Not_Selected")); + return ERR_INVALID_PARAMETER; + } + + o = ParseCommandList(c, cmd_name, str, args, sizeof(args) / sizeof(args[0])); + if (o == NULL) + { + return ERR_INVALID_PARAMETER; + } + + Zero(&t, sizeof(t)); + StrCpy(t.HubName, sizeof(t.HubName), ps->HubName); + + // RPC call + ret = ScEnumAccess(ps->Rpc, &t); + + if (ret != ERR_NO_ERROR) + { + // An error has occured + CmdPrintError(c, ret); + FreeParamValueList(o); + return ret; + } + else + { + UINT i; + bool b = false; + for (i = 0;i < t.NumAccess;i++) + { + ACCESS *a = &t.Accesses[i]; + + if (a->Id == GetParamInt(o, "[id]")) + { + b = true; + + a->Active = false; + } + } + + if (b == false) + { + // The specified ID is not found + ret = ERR_OBJECT_NOT_FOUND; + CmdPrintError(c, ret); + FreeParamValueList(o); + FreeRpcEnumAccessList(&t); + return ret; + } + + ret = ScSetAccessList(ps->Rpc, &t); + if (ret != ERR_NO_ERROR) + { + // An error has occured + CmdPrintError(c, ret); + FreeParamValueList(o); + return ret; + } + + FreeRpcEnumAccessList(&t); + } + + FreeParamValueList(o); + + return ret; +} + +// Get the user list +UINT PsUserList(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) +{ + LIST *o; + PS *ps = (PS *)param; + UINT ret = 0; + RPC_ENUM_USER t; + + // If virtual HUB is not selected, it's an error + if (ps->HubName == NULL) + { + c->Write(c, _UU("CMD_Hub_Not_Selected")); + return ERR_INVALID_PARAMETER; + } + + o = ParseCommandList(c, cmd_name, str, NULL, 0); + if (o == NULL) + { + return ERR_INVALID_PARAMETER; + } + + Zero(&t, sizeof(t)); + StrCpy(t.HubName, sizeof(t.HubName), ps->HubName); + + // RPC call + ret = ScEnumUser(ps->Rpc, &t); + + if (ret != ERR_NO_ERROR) + { + // An error has occured + CmdPrintError(c, ret); + FreeParamValueList(o); + return ret; + } + else + { + UINT i; + CT *ct = CtNew(); + + CtInsertColumn(ct, _UU("SM_USER_COLUMN_1"), false); + CtInsertColumn(ct, _UU("SM_USER_COLUMN_2"), false); + CtInsertColumn(ct, _UU("SM_USER_COLUMN_3"), false); + CtInsertColumn(ct, _UU("SM_USER_COLUMN_4"), false); + CtInsertColumn(ct, _UU("SM_USER_COLUMN_5"), false); + CtInsertColumn(ct, _UU("SM_USER_COLUMN_6"), false); + CtInsertColumn(ct, _UU("SM_USER_COLUMN_7"), false); + CtInsertColumn(ct, _UU("SM_LICENSE_COLUMN_5"), false); + CtInsertColumn(ct, _UU("SM_SESS_COLUMN_6"), false); + CtInsertColumn(ct, _UU("SM_SESS_COLUMN_7"), false); + + for (i = 0;i < t.NumUser;i++) + { + RPC_ENUM_USER_ITEM *e = &t.Users[i]; + wchar_t name[MAX_SIZE]; + wchar_t group[MAX_SIZE]; + wchar_t num[MAX_SIZE]; + wchar_t time[MAX_SIZE]; + wchar_t exp[MAX_SIZE]; + wchar_t num1[64], num2[64]; + + StrToUni(name, sizeof(name), e->Name); + + if (StrLen(e->GroupName) != 0) + { + StrToUni(group, sizeof(group), e->GroupName); + } + else + { + UniStrCpy(group, sizeof(group), _UU("SM_NO_GROUP")); + } + + UniToStru(num, e->NumLogin); + + GetDateTimeStrEx64(time, sizeof(time), SystemToLocal64(e->LastLoginTime), NULL); + + if (e->IsExpiresFilled == false) + { + UniStrCpy(exp, sizeof(exp), _UU("CM_ST_NONE")); + } + else + { + if (e->Expires == 0) + { + UniStrCpy(exp, sizeof(exp), _UU("SM_LICENSE_NO_EXPIRES")); + } + else + { + GetDateTimeStrEx64(exp, sizeof(exp), SystemToLocal64(e->Expires), NULL); + } + } + + if (e->IsTrafficFilled == false) + { + UniStrCpy(num1, sizeof(num1), _UU("CM_ST_NONE")); + UniStrCpy(num2, sizeof(num2), _UU("CM_ST_NONE")); + } + else + { + UniToStr3(num1, sizeof(num1), + e->Traffic.Recv.BroadcastBytes + e->Traffic.Recv.UnicastBytes + + e->Traffic.Send.BroadcastBytes + e->Traffic.Send.UnicastBytes); + + UniToStr3(num2, sizeof(num2), + e->Traffic.Recv.BroadcastCount + e->Traffic.Recv.UnicastCount + + e->Traffic.Send.BroadcastBytes + e->Traffic.Send.UnicastCount); + } + + CtInsert(ct, + name, e->Realname, group, e->Note, GetAuthTypeStr(e->AuthType), + num, time, exp, num1, num2); + } + + CtFreeEx(ct, c, true); + } + + FreeRpcEnumUser(&t); + + FreeParamValueList(o); + + return 0; +} + +// Get a string of user authentication method +wchar_t *GetAuthTypeStr(UINT id) +{ + char tmp[MAX_SIZE]; + Format(tmp, sizeof(tmp), "SM_AUTHTYPE_%u", id); + + return _UU(tmp); +} + +// Creating a user +UINT PsUserCreate(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) +{ + LIST *o; + PS *ps = (PS *)param; + UINT ret = 0; + RPC_SET_USER t; + // Parameter list that can be specified + PARAM args[] = + { + // "name", prompt_proc, prompt_param, eval_proc, eval_param + {"[name]", CmdPrompt, _UU("CMD_UserCreate_Prompt_NAME"), CmdEvalNotEmpty, NULL}, + {"GROUP", CmdPrompt, _UU("CMD_UserCreate_Prompt_GROUP"), NULL, NULL}, + {"REALNAME", CmdPrompt, _UU("CMD_UserCreate_Prompt_REALNAME"), NULL, NULL}, + {"NOTE", CmdPrompt, _UU("CMD_UserCreate_Prompt_NOTE"), NULL, NULL}, + }; + + // If virtual HUB is not selected, it's an error + if (ps->HubName == NULL) + { + c->Write(c, _UU("CMD_Hub_Not_Selected")); + return ERR_INVALID_PARAMETER; + } + + o = ParseCommandList(c, cmd_name, str, args, sizeof(args) / sizeof(args[0])); + if (o == NULL) + { + return ERR_INVALID_PARAMETER; + } + + Zero(&t, sizeof(t)); + StrCpy(t.HubName, sizeof(t.HubName), ps->HubName); + StrCpy(t.Name, sizeof(t.Name), GetParamStr(o, "[name]")); + StrCpy(t.GroupName, sizeof(t.GroupName), GetParamStr(o, "GROUP")); + UniStrCpy(t.Realname, sizeof(t.Realname), GetParamUniStr(o, "REALNAME")); + UniStrCpy(t.Note, sizeof(t.Note), GetParamUniStr(o, "NOTE")); + + Trim(t.Name); + if (StrCmpi(t.Name, "*") == 0) + { + t.AuthType = AUTHTYPE_RADIUS; + t.AuthData = NewRadiusAuthData(NULL); + } + else + { + UCHAR random_pass[SHA1_SIZE]; + UCHAR random_pass2[MD5_SIZE]; + + Rand(random_pass, sizeof(random_pass)); + Rand(random_pass2, sizeof(random_pass2)); + t.AuthType = AUTHTYPE_PASSWORD; + t.AuthData = NewPasswordAuthDataRaw(random_pass, random_pass2); + } + + // RPC call + ret = ScCreateUser(ps->Rpc, &t); + + if (ret != ERR_NO_ERROR) + { + // An error has occured + CmdPrintError(c, ret); + FreeParamValueList(o); + return ret; + } + + FreeRpcSetUser(&t); + + FreeParamValueList(o); + + return 0; +} + +// Change the user information +UINT PsUserSet(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) +{ + LIST *o; + PS *ps = (PS *)param; + UINT ret = 0; + RPC_SET_USER t; + // Parameter list that can be specified + PARAM args[] = + { + // "name", prompt_proc, prompt_param, eval_proc, eval_param + {"[name]", CmdPrompt, _UU("CMD_UserCreate_Prompt_NAME"), CmdEvalNotEmpty, NULL}, + {"GROUP", CmdPrompt, _UU("CMD_UserCreate_Prompt_GROUP"), NULL, NULL}, + {"REALNAME", CmdPrompt, _UU("CMD_UserCreate_Prompt_REALNAME"), NULL, NULL}, + {"NOTE", CmdPrompt, _UU("CMD_UserCreate_Prompt_NOTE"), NULL, NULL}, + }; + + // If virtual HUB is not selected, it's an error + if (ps->HubName == NULL) + { + c->Write(c, _UU("CMD_Hub_Not_Selected")); + return ERR_INVALID_PARAMETER; + } + + o = ParseCommandList(c, cmd_name, str, args, sizeof(args) / sizeof(args[0])); + if (o == NULL) + { + return ERR_INVALID_PARAMETER; + } + + Zero(&t, sizeof(t)); + // Get the user object + StrCpy(t.HubName, sizeof(t.HubName), ps->HubName); + StrCpy(t.Name, sizeof(t.Name), GetParamStr(o, "[name]")); + + ret = ScGetUser(ps->Rpc, &t); + if (ret != ERR_NO_ERROR) + { + // An error has occured + CmdPrintError(c, ret); + FreeParamValueList(o); + return ret; + } + + // Update the information + StrCpy(t.GroupName, sizeof(t.GroupName), GetParamStr(o, "GROUP")); + UniStrCpy(t.Realname, sizeof(t.Realname), GetParamUniStr(o, "REALNAME")); + UniStrCpy(t.Note, sizeof(t.Note), GetParamUniStr(o, "NOTE")); + + // Write the user object + ret = ScSetUser(ps->Rpc, &t); + + if (ret != ERR_NO_ERROR) + { + // An error has occured + CmdPrintError(c, ret); + FreeParamValueList(o); + return ret; + } + + FreeRpcSetUser(&t); + + FreeParamValueList(o); + + return 0; +} + +// Delete the user +UINT PsUserDelete(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) +{ + LIST *o; + PS *ps = (PS *)param; + UINT ret = 0; + RPC_DELETE_USER t; + // Parameter list that can be specified + PARAM args[] = + { + {"[name]", CmdPrompt, _UU("CMD_UserCreate_Prompt_NAME"), CmdEvalNotEmpty, NULL}, + }; + + // If virtual HUB is not selected, it's an error + if (ps->HubName == NULL) + { + c->Write(c, _UU("CMD_Hub_Not_Selected")); + return ERR_INVALID_PARAMETER; + } + + o = ParseCommandList(c, cmd_name, str, args, sizeof(args) / sizeof(args[0])); + if (o == NULL) + { + return ERR_INVALID_PARAMETER; + } + + Zero(&t, sizeof(t)); + StrCpy(t.HubName, sizeof(t.HubName), ps->HubName); + StrCpy(t.Name, sizeof(t.Name), GetParamStr(o, "[name]")); + + // RPC call + ret = ScDeleteUser(ps->Rpc, &t); + + if (ret != ERR_NO_ERROR) + { + // An error has occured + CmdPrintError(c, ret); + FreeParamValueList(o); + return ret; + } + + FreeParamValueList(o); + + return 0; +} + +// Get the user information +UINT PsUserGet(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) +{ + LIST *o; + PS *ps = (PS *)param; + UINT ret = 0; + RPC_SET_USER t; + // Parameter list that can be specified + PARAM args[] = + { + // "name", prompt_proc, prompt_param, eval_proc, eval_param + {"[name]", CmdPrompt, _UU("CMD_UserCreate_Prompt_NAME"), CmdEvalNotEmpty, NULL}, + }; + + // If virtual HUB is not selected, it's an error + if (ps->HubName == NULL) + { + c->Write(c, _UU("CMD_Hub_Not_Selected")); + return ERR_INVALID_PARAMETER; + } + + o = ParseCommandList(c, cmd_name, str, args, sizeof(args) / sizeof(args[0])); + if (o == NULL) + { + return ERR_INVALID_PARAMETER; + } + + Zero(&t, sizeof(t)); + // Get the user object + StrCpy(t.HubName, sizeof(t.HubName), ps->HubName); + StrCpy(t.Name, sizeof(t.Name), GetParamStr(o, "[name]")); + + ret = ScGetUser(ps->Rpc, &t); + if (ret != ERR_NO_ERROR) + { + // An error has occured + CmdPrintError(c, ret); + FreeParamValueList(o); + return ret; + } + else + { + wchar_t tmp[MAX_SIZE]; + CT *ct; + + // Display the user's data + ct = CtNewStandard(); + + // User name + StrToUni(tmp, sizeof(tmp), t.Name); + CtInsert(ct, _UU("CMD_UserGet_Column_Name"), tmp); + + // Real name + CtInsert(ct, _UU("CMD_UserGet_Column_RealName"), t.Realname); + + // Description + CtInsert(ct, _UU("CMD_UserGet_Column_Note"), t.Note); + + // Group name + if (IsEmptyStr(t.GroupName) == false) + { + StrToUni(tmp, sizeof(tmp), t.GroupName); + CtInsert(ct, _UU("CMD_UserGet_Column_Group"), tmp); + } + + // Expiration date + GetDateTimeStrEx64(tmp, sizeof(tmp), SystemToLocal64(t.ExpireTime), NULL); + CtInsert(ct, _UU("CMD_UserGet_Column_Expires"), tmp); + + // Authentication method + CtInsert(ct, _UU("CMD_UserGet_Column_AuthType"), GetAuthTypeStr(t.AuthType)); + + switch (t.AuthType) + { + case AUTHTYPE_USERCERT: + if (t.AuthData != NULL) + { + AUTHUSERCERT *auc = (AUTHUSERCERT *)t.AuthData; + + if (auc != NULL && auc->UserX != NULL) + { + // Registered user-specific certificate + GetAllNameFromX(tmp, sizeof(tmp), auc->UserX); + CtInsert(ct, _UU("CMD_UserGet_Column_UserCert"), tmp); + } + } + break; + + case AUTHTYPE_ROOTCERT: + if (t.AuthData != NULL) + { + AUTHROOTCERT *arc = (AUTHROOTCERT *)t.AuthData; + + if (IsEmptyUniStr(arc->CommonName) == false) + { + // Limitation the value of the certificate's CN + CtInsert(ct, _UU("CMD_UserGet_Column_RootCert_CN"), arc->CommonName); + } + + if (arc->Serial != NULL && arc->Serial->size >= 1) + { + char tmp2[MAX_SIZE]; + + // Limitation the serial number of the certificate + BinToStrEx(tmp2, sizeof(tmp2), arc->Serial->data, arc->Serial->size); + StrToUni(tmp, sizeof(tmp), tmp2); + CtInsert(ct, _UU("CMD_UserGet_Column_RootCert_SERIAL"), tmp); + } + } + break; + + case AUTHTYPE_RADIUS: + case AUTHTYPE_NT: + if (t.AuthData != NULL) + { + AUTHRADIUS *ar = (AUTHRADIUS *)t.AuthData; + + // Authentication user name of the external authentication server + if (IsEmptyUniStr(ar->RadiusUsername) == false) + { + CtInsert(ct, _UU("CMD_UserGet_Column_RadiusAlias"), ar->RadiusUsername); + } + } + break; + } + + CtInsert(ct, L"---", L"---"); + + GetDateTimeStrEx64(tmp, sizeof(tmp), SystemToLocal64(t.CreatedTime), NULL); + CtInsert(ct, _UU("SM_USERINFO_CREATE"), tmp); + + GetDateTimeStrEx64(tmp, sizeof(tmp), SystemToLocal64(t.UpdatedTime), NULL); + CtInsert(ct, _UU("SM_USERINFO_UPDATE"), tmp); + + CmdInsertTrafficInfo(ct, &t.Traffic); + + UniToStru(tmp, t.NumLogin); + CtInsert(ct, _UU("SM_USERINFO_NUMLOGIN"), tmp); + + + CtFree(ct, c); + + if (t.Policy != NULL) + { + c->Write(c, L""); + c->Write(c, _UU("CMD_UserGet_Policy")); + PrintPolicy(c, t.Policy, false); + } + } + + FreeRpcSetUser(&t); + + FreeParamValueList(o); + + return 0; +} + +// Set the authentication method for the user to the anonymous authentication +UINT PsUserAnonymousSet(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) +{ + LIST *o; + PS *ps = (PS *)param; + UINT ret = 0; + RPC_SET_USER t; + // Parameter list that can be specified + PARAM args[] = + { + // "name", prompt_proc, prompt_param, eval_proc, eval_param + {"[name]", CmdPrompt, _UU("CMD_UserCreate_Prompt_NAME"), CmdEvalNotEmpty, NULL}, + }; + + // If virtual HUB is not selected, it's an error + if (ps->HubName == NULL) + { + c->Write(c, _UU("CMD_Hub_Not_Selected")); + return ERR_INVALID_PARAMETER; + } + + o = ParseCommandList(c, cmd_name, str, args, sizeof(args) / sizeof(args[0])); + if (o == NULL) + { + return ERR_INVALID_PARAMETER; + } + + Zero(&t, sizeof(t)); + // Get the user object + StrCpy(t.HubName, sizeof(t.HubName), ps->HubName); + StrCpy(t.Name, sizeof(t.Name), GetParamStr(o, "[name]")); + + ret = ScGetUser(ps->Rpc, &t); + if (ret != ERR_NO_ERROR) + { + // An error has occured + CmdPrintError(c, ret); + FreeParamValueList(o); + return ret; + } + + // Update the information + FreeAuthData(t.AuthType, t.AuthData); + + // Set to anonymous authentication + t.AuthType = AUTHTYPE_ANONYMOUS; + t.AuthData = NULL; + + // Write the user object + ret = ScSetUser(ps->Rpc, &t); + + if (ret != ERR_NO_ERROR) + { + // An error has occured + CmdPrintError(c, ret); + FreeParamValueList(o); + return ret; + } + + FreeRpcSetUser(&t); + + FreeParamValueList(o); + + return 0; +} + +// Set the authentication method for the user to the password authentication and set a password +UINT PsUserPasswordSet(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) +{ + LIST *o; + PS *ps = (PS *)param; + UINT ret = 0; + RPC_SET_USER t; + // Parameter list that can be specified + PARAM args[] = + { + // "name", prompt_proc, prompt_param, eval_proc, eval_param + {"[name]", CmdPrompt, _UU("CMD_UserCreate_Prompt_NAME"), CmdEvalNotEmpty, NULL}, + {"PASSWORD", CmdPromptChoosePassword, NULL, NULL, NULL}, + }; + + // If virtual HUB is not selected, it's an error + if (ps->HubName == NULL) + { + c->Write(c, _UU("CMD_Hub_Not_Selected")); + return ERR_INVALID_PARAMETER; + } + + o = ParseCommandList(c, cmd_name, str, args, sizeof(args) / sizeof(args[0])); + if (o == NULL) + { + return ERR_INVALID_PARAMETER; + } + + Zero(&t, sizeof(t)); + // Get the user object + StrCpy(t.HubName, sizeof(t.HubName), ps->HubName); + StrCpy(t.Name, sizeof(t.Name), GetParamStr(o, "[name]")); + + ret = ScGetUser(ps->Rpc, &t); + if (ret != ERR_NO_ERROR) + { + // An error has occured + CmdPrintError(c, ret); + FreeParamValueList(o); + return ret; + } + + // Update the information + FreeAuthData(t.AuthType, t.AuthData); + + { + AUTHPASSWORD *pw; + + pw = NewPasswordAuthData(t.Name, GetParamStr(o, "PASSWORD")); + + // Set to the password authentication + t.AuthType = AUTHTYPE_PASSWORD; + t.AuthData = pw; + } + + // Write the user object + ret = ScSetUser(ps->Rpc, &t); + + if (ret != ERR_NO_ERROR) + { + // An error has occured + CmdPrintError(c, ret); + FreeParamValueList(o); + return ret; + } + + FreeRpcSetUser(&t); + + FreeParamValueList(o); + + return 0; +} + +// Set the authentication method for the user to the specific certificate authentication and set a certificate +UINT PsUserCertSet(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) +{ + LIST *o; + PS *ps = (PS *)param; + UINT ret = 0; + RPC_SET_USER t; + X *x; + // Parameter list that can be specified + PARAM args[] = + { + // "name", prompt_proc, prompt_param, eval_proc, eval_param + {"[name]", CmdPrompt, _UU("CMD_UserCreate_Prompt_NAME"), CmdEvalNotEmpty, NULL}, + {"LOADCERT", CmdPrompt, _UU("CMD_LOADCERTPATH"), CmdEvalIsFile, NULL}, + }; + + // If virtual HUB is not selected, it's an error + if (ps->HubName == NULL) + { + c->Write(c, _UU("CMD_Hub_Not_Selected")); + return ERR_INVALID_PARAMETER; + } + + o = ParseCommandList(c, cmd_name, str, args, sizeof(args) / sizeof(args[0])); + if (o == NULL) + { + return ERR_INVALID_PARAMETER; + } + + // Read the certificate + x = FileToXW(GetParamUniStr(o, "LOADCERT")); + if (x == NULL) + { + c->Write(c, _UU("CMD_LOADCERT_FAILED")); + + FreeParamValueList(o); + + return ERR_INTERNAL_ERROR; + } + + Zero(&t, sizeof(t)); + // Get the user object + StrCpy(t.HubName, sizeof(t.HubName), ps->HubName); + StrCpy(t.Name, sizeof(t.Name), GetParamStr(o, "[name]")); + + ret = ScGetUser(ps->Rpc, &t); + if (ret != ERR_NO_ERROR) + { + // An error has occured + CmdPrintError(c, ret); + FreeParamValueList(o); + FreeX(x); + return ret; + } + + // Update the information + FreeAuthData(t.AuthType, t.AuthData); + + { + AUTHUSERCERT *c; + + c = NewUserCertAuthData(x); + + FreeX(x); + + // Set to the password authentication + t.AuthType = AUTHTYPE_USERCERT; + t.AuthData = c; + } + + // Write the user object + ret = ScSetUser(ps->Rpc, &t); + + if (ret != ERR_NO_ERROR) + { + // An error has occured + CmdPrintError(c, ret); + FreeParamValueList(o); + return ret; + } + + FreeRpcSetUser(&t); + + FreeParamValueList(o); + + return 0; +} + +// Get certificates that are registered in the user which uses certificate authentication +UINT PsUserCertGet(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) +{ + LIST *o; + PS *ps = (PS *)param; + UINT ret = 0; + RPC_SET_USER t; + AUTHUSERCERT *a; + // Parameter list that can be specified + PARAM args[] = + { + // "name", prompt_proc, prompt_param, eval_proc, eval_param + {"[name]", CmdPrompt, _UU("CMD_UserCreate_Prompt_NAME"), CmdEvalNotEmpty, NULL}, + {"SAVECERT", CmdPrompt, _UU("CMD_SAVECERTPATH"), NULL, NULL}, + }; + + // If virtual HUB is not selected, it's an error + if (ps->HubName == NULL) + { + c->Write(c, _UU("CMD_Hub_Not_Selected")); + return ERR_INVALID_PARAMETER; + } + + o = ParseCommandList(c, cmd_name, str, args, sizeof(args) / sizeof(args[0])); + if (o == NULL) + { + return ERR_INVALID_PARAMETER; + } + + Zero(&t, sizeof(t)); + // Get the user object + StrCpy(t.HubName, sizeof(t.HubName), ps->HubName); + StrCpy(t.Name, sizeof(t.Name), GetParamStr(o, "[name]")); + + ret = ScGetUser(ps->Rpc, &t); + if (ret != ERR_NO_ERROR) + { + // An error has occured + CmdPrintError(c, ret); + FreeParamValueList(o); + return ret; + } + + a = (AUTHUSERCERT *)t.AuthData; + + if (t.AuthType != AUTHTYPE_USERCERT || a == NULL || a->UserX == NULL) + { + // The user is not using specific certificate authentication + ret = ERR_INVALID_PARAMETER; + + c->Write(c, _UU("CMD_UserCertGet_Not_Cert")); + } + else + { + if (XToFileW(a->UserX, GetParamUniStr(o, "SAVECERT"), true) == false) + { + c->Write(c, _UU("CMD_SAVECERT_FAILED")); + } + } + + FreeRpcSetUser(&t); + + FreeParamValueList(o); + + return ret; +} + +// Set the authentication method for the user to the signed certificate authentication +UINT PsUserSignedSet(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) +{ + LIST *o; + PS *ps = (PS *)param; + UINT ret = 0; + RPC_SET_USER t; + // Parameter list that can be specified + PARAM args[] = + { + // "name", prompt_proc, prompt_param, eval_proc, eval_param + {"[name]", CmdPrompt, _UU("CMD_UserCreate_Prompt_NAME"), CmdEvalNotEmpty, NULL}, + {"CN", CmdPrompt, _UU("CMD_UserSignedSet_Prompt_CN"), NULL, NULL}, + {"SERIAL", CmdPrompt, _UU("CMD_UserSignedSet_Prompt_SERIAL"), NULL, NULL}, + }; + + // If virtual HUB is not selected, it's an error + if (ps->HubName == NULL) + { + c->Write(c, _UU("CMD_Hub_Not_Selected")); + return ERR_INVALID_PARAMETER; + } + + o = ParseCommandList(c, cmd_name, str, args, sizeof(args) / sizeof(args[0])); + if (o == NULL) + { + return ERR_INVALID_PARAMETER; + } + + Zero(&t, sizeof(t)); + // Get the user object + StrCpy(t.HubName, sizeof(t.HubName), ps->HubName); + StrCpy(t.Name, sizeof(t.Name), GetParamStr(o, "[name]")); + + ret = ScGetUser(ps->Rpc, &t); + if (ret != ERR_NO_ERROR) + { + // An error has occured + CmdPrintError(c, ret); + FreeParamValueList(o); + return ret; + } + + // Update the information + FreeAuthData(t.AuthType, t.AuthData); + + { + AUTHROOTCERT *c; + BUF *b; + X_SERIAL *serial = NULL; + + b = StrToBin(GetParamStr(o, "SERIAL")); + + if (b != NULL && b->Size >= 1) + { + serial = NewXSerial(b->Buf, b->Size); + } + + FreeBuf(b); + + c = NewRootCertAuthData(serial, GetParamUniStr(o, "CN")); + + FreeXSerial(serial); + + // Set to the signed certificate authentication + t.AuthType = AUTHTYPE_ROOTCERT; + t.AuthData = c; + } + + // Write the user object + ret = ScSetUser(ps->Rpc, &t); + + if (ret != ERR_NO_ERROR) + { + // An error has occured + CmdPrintError(c, ret); + FreeParamValueList(o); + return ret; + } + + FreeRpcSetUser(&t); + + FreeParamValueList(o); + + return 0; +} + +// Set the authentication method for the user to the Radius authentication +UINT PsUserRadiusSet(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) +{ + LIST *o; + PS *ps = (PS *)param; + UINT ret = 0; + RPC_SET_USER t; + // Parameter list that can be specified + PARAM args[] = + { + // "name", prompt_proc, prompt_param, eval_proc, eval_param + {"[name]", CmdPrompt, _UU("CMD_UserCreate_Prompt_NAME"), CmdEvalNotEmpty, NULL}, + {"ALIAS", CmdPrompt, _UU("CMD_UserRadiusSet_Prompt_ALIAS"), NULL, NULL}, + }; + + // If virtual HUB is not selected, it's an error + if (ps->HubName == NULL) + { + c->Write(c, _UU("CMD_Hub_Not_Selected")); + return ERR_INVALID_PARAMETER; + } + + o = ParseCommandList(c, cmd_name, str, args, sizeof(args) / sizeof(args[0])); + if (o == NULL) + { + return ERR_INVALID_PARAMETER; + } + + Zero(&t, sizeof(t)); + // Get the user object + StrCpy(t.HubName, sizeof(t.HubName), ps->HubName); + StrCpy(t.Name, sizeof(t.Name), GetParamStr(o, "[name]")); + + ret = ScGetUser(ps->Rpc, &t); + if (ret != ERR_NO_ERROR) + { + // An error has occured + CmdPrintError(c, ret); + FreeParamValueList(o); + return ret; + } + + // Update the information + FreeAuthData(t.AuthType, t.AuthData); + + { + AUTHRADIUS *a; + + a = NewRadiusAuthData(GetParamUniStr(o, "ALIAS")); + + // Set to Radius authentication + t.AuthType = AUTHTYPE_RADIUS; + t.AuthData = a; + } + + // Write the user object + ret = ScSetUser(ps->Rpc, &t); + + if (ret != ERR_NO_ERROR) + { + // An error has occured + CmdPrintError(c, ret); + FreeParamValueList(o); + return ret; + } + + FreeRpcSetUser(&t); + + FreeParamValueList(o); + + return 0; +} + +// Set the authentication method for the user to the NT domain authentication +UINT PsUserNTLMSet(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) +{ + LIST *o; + PS *ps = (PS *)param; + UINT ret = 0; + RPC_SET_USER t; + // Parameter list that can be specified + PARAM args[] = + { + // "name", prompt_proc, prompt_param, eval_proc, eval_param + {"[name]", CmdPrompt, _UU("CMD_UserCreate_Prompt_NAME"), CmdEvalNotEmpty, NULL}, + {"ALIAS", CmdPrompt, _UU("CMD_UserRadiusSet_Prompt_ALIAS"), NULL, NULL}, + }; + + // If virtual HUB is not selected, it's an error + if (ps->HubName == NULL) + { + c->Write(c, _UU("CMD_Hub_Not_Selected")); + return ERR_INVALID_PARAMETER; + } + + o = ParseCommandList(c, cmd_name, str, args, sizeof(args) / sizeof(args[0])); + if (o == NULL) + { + return ERR_INVALID_PARAMETER; + } + + Zero(&t, sizeof(t)); + // Get the user object + StrCpy(t.HubName, sizeof(t.HubName), ps->HubName); + StrCpy(t.Name, sizeof(t.Name), GetParamStr(o, "[name]")); + + ret = ScGetUser(ps->Rpc, &t); + if (ret != ERR_NO_ERROR) + { + // An error has occured + CmdPrintError(c, ret); + FreeParamValueList(o); + return ret; + } + + // Update the information + FreeAuthData(t.AuthType, t.AuthData); + + { + AUTHRADIUS *a; + + a = NewRadiusAuthData(GetParamUniStr(o, "ALIAS")); + + // Set to the NT domain authentication + t.AuthType = AUTHTYPE_NT; + t.AuthData = a; + } + + // Write the user object + ret = ScSetUser(ps->Rpc, &t); + + if (ret != ERR_NO_ERROR) + { + // An error has occured + CmdPrintError(c, ret); + FreeParamValueList(o); + return ret; + } + + FreeRpcSetUser(&t); + + FreeParamValueList(o); + + return 0; +} + +// Delete the security policy of the user +UINT PsUserPolicyRemove(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) +{ + LIST *o; + PS *ps = (PS *)param; + UINT ret = 0; + RPC_SET_USER t; + // Parameter list that can be specified + PARAM args[] = + { + // "name", prompt_proc, prompt_param, eval_proc, eval_param + {"[name]", CmdPrompt, _UU("CMD_UserCreate_Prompt_NAME"), CmdEvalNotEmpty, NULL}, + }; + + // If virtual HUB is not selected, it's an error + if (ps->HubName == NULL) + { + c->Write(c, _UU("CMD_Hub_Not_Selected")); + return ERR_INVALID_PARAMETER; + } + + o = ParseCommandList(c, cmd_name, str, args, sizeof(args) / sizeof(args[0])); + if (o == NULL) + { + return ERR_INVALID_PARAMETER; + } + + Zero(&t, sizeof(t)); + // Get the user object + StrCpy(t.HubName, sizeof(t.HubName), ps->HubName); + StrCpy(t.Name, sizeof(t.Name), GetParamStr(o, "[name]")); + + ret = ScGetUser(ps->Rpc, &t); + if (ret != ERR_NO_ERROR) + { + // An error has occured + CmdPrintError(c, ret); + FreeParamValueList(o); + return ret; + } + + // Update + if (t.Policy != NULL) + { + Free(t.Policy); + t.Policy = NULL; + } + + // Write the user object + ret = ScSetUser(ps->Rpc, &t); + + if (ret != ERR_NO_ERROR) + { + // An error has occured + CmdPrintError(c, ret); + FreeParamValueList(o); + return ret; + } + + FreeRpcSetUser(&t); + + FreeParamValueList(o); + + return 0; +} + +// Set a security policy of the user +UINT PsUserPolicySet(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) +{ + LIST *o; + PS *ps = (PS *)param; + UINT ret = 0; + RPC_SET_USER t; + // Parameter list that can be specified + PARAM args[] = + { + // "name", prompt_proc, prompt_param, eval_proc, eval_param + {"[name]", CmdPrompt, _UU("CMD_UserCreate_Prompt_NAME"), CmdEvalNotEmpty, NULL}, + {"NAME", CmdPrompt, _UU("CMD_CascadePolicySet_PROMPT_POLNAME"), CmdEvalNotEmpty, NULL}, + {"VALUE", CmdPrompt, _UU("CMD_CascadePolicySet_PROMPT_POLVALUE"), CmdEvalNotEmpty, NULL}, + }; + + // If virtual HUB is not selected, it's an error + if (ps->HubName == NULL) + { + c->Write(c, _UU("CMD_Hub_Not_Selected")); + return ERR_INVALID_PARAMETER; + } + + o = ParseCommandList(c, cmd_name, str, args, sizeof(args) / sizeof(args[0])); + if (o == NULL) + { + return ERR_INVALID_PARAMETER; + } + + Zero(&t, sizeof(t)); + // Get the user object + StrCpy(t.HubName, sizeof(t.HubName), ps->HubName); + StrCpy(t.Name, sizeof(t.Name), GetParamStr(o, "[name]")); + + ret = ScGetUser(ps->Rpc, &t); + if (ret != ERR_NO_ERROR) + { + // An error has occured + CmdPrintError(c, ret); + FreeParamValueList(o); + return ret; + } + + // Update + if (t.Policy == NULL) + { + t.Policy = ClonePolicy(GetDefaultPolicy()); + } + + // Edit + if (EditPolicy(c, t.Policy, GetParamStr(o, "NAME"), GetParamStr(o, "VALUE"), false) == false) + { + ret = ERR_INVALID_PARAMETER; + } + else + { + // Write the user object + ret = ScSetUser(ps->Rpc, &t); + + if (ret != ERR_NO_ERROR) + { + // An error has occured + CmdPrintError(c, ret); + FreeParamValueList(o); + return ret; + } + } + + FreeRpcSetUser(&t); + + FreeParamValueList(o); + + return ret; +} + +// Convert the string to a date and time +UINT64 StrToDateTime64(char *str) +{ + UINT64 ret = 0; + TOKEN_LIST *t; + UINT a, b, c, d, e, f; + // Validate arguments + if (str == NULL) + { + return INFINITE; + } + + if (IsEmptyStr(str) || StrCmpi(str, "none") == 0) + { + return 0; + } + + t = ParseToken(str, ":/,. \""); + if (t->NumTokens != 6) + { + FreeToken(t); + return INFINITE; + } + + a = ToInt(t->Token[0]); + b = ToInt(t->Token[1]); + c = ToInt(t->Token[2]); + d = ToInt(t->Token[3]); + e = ToInt(t->Token[4]); + f = ToInt(t->Token[5]); + + ret = INFINITE; + + if (a >= 1000 && a <= 9999 && b >= 1 && b <= 12 && c >= 1 && c <= 31 && + d <= 23 && e <= 59 && f <= 59) + { + SYSTEMTIME t; + + Zero(&t, sizeof(t)); + t.wYear = a; + t.wMonth = b; + t.wDay = c; + t.wHour = d; + t.wMinute = e; + t.wSecond = f; + + ret = SystemToUINT64(&t); + } + + FreeToken(t); + + return ret; +} + +// Evaluate the date and time string +bool CmdEvalDateTime(CONSOLE *c, wchar_t *str, void *param) +{ + UINT64 ret; + char tmp[MAX_SIZE]; + // Validate arguments + if (c == NULL || str == NULL) + { + return false; + } + + UniToStr(tmp, sizeof(tmp), str); + + ret = StrToDateTime64(tmp); + + if (ret == INFINITE) + { + c->Write(c, _UU("CMD_EVAL_DATE_TIME_FAILED")); + return false; + } + + return true; +} + +// Set the expiration date of the user +UINT PsUserExpiresSet(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) +{ + LIST *o; + PS *ps = (PS *)param; + UINT ret = 0; + RPC_SET_USER t; + UINT64 expires; + // Parameter list that can be specified + PARAM args[] = + { + // "name", prompt_proc, prompt_param, eval_proc, eval_param + {"[name]", CmdPrompt, _UU("CMD_UserCreate_Prompt_NAME"), CmdEvalNotEmpty, NULL}, + {"EXPIRES", CmdPrompt, _UU("CMD_UserExpiresSet_Prompt_EXPIRES"), CmdEvalDateTime, NULL}, + }; + + // If virtual HUB is not selected, it's an error + if (ps->HubName == NULL) + { + c->Write(c, _UU("CMD_Hub_Not_Selected")); + return ERR_INVALID_PARAMETER; + } + + o = ParseCommandList(c, cmd_name, str, args, sizeof(args) / sizeof(args[0])); + if (o == NULL) + { + return ERR_INVALID_PARAMETER; + } + + Zero(&t, sizeof(t)); + // Get the user object + StrCpy(t.HubName, sizeof(t.HubName), ps->HubName); + StrCpy(t.Name, sizeof(t.Name), GetParamStr(o, "[name]")); + + ret = ScGetUser(ps->Rpc, &t); + if (ret != ERR_NO_ERROR) + { + // An error has occured + CmdPrintError(c, ret); + FreeParamValueList(o); + return ret; + } + + // Update the information + expires = StrToDateTime64(GetParamStr(o, "EXPIRES")); + + if (expires != 0) + { + expires = LocalToSystem64(expires); + } + + t.ExpireTime = expires; + + // Write the user object + ret = ScSetUser(ps->Rpc, &t); + + if (ret != ERR_NO_ERROR) + { + // An error has occured + CmdPrintError(c, ret); + FreeParamValueList(o); + return ret; + } + + FreeRpcSetUser(&t); + + FreeParamValueList(o); + + return 0; +} + +// Get the group list +UINT PsGroupList(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) +{ + LIST *o; + PS *ps = (PS *)param; + UINT ret = 0; + RPC_ENUM_GROUP t; + + o = ParseCommandList(c, cmd_name, str, NULL, 0); + if (o == NULL) + { + return ERR_INVALID_PARAMETER; + } + + // If virtual HUB is not selected, it's an error + if (ps->HubName == NULL) + { + c->Write(c, _UU("CMD_Hub_Not_Selected")); + return ERR_INVALID_PARAMETER; + } + + Zero(&t, sizeof(t)); + StrCpy(t.HubName, sizeof(t.HubName), ps->HubName); + + // RPC call + ret = ScEnumGroup(ps->Rpc, &t); + + if (ret != ERR_NO_ERROR) + { + // An error has occured + CmdPrintError(c, ret); + FreeParamValueList(o); + return ret; + } + else + { + CT *ct = CtNew(); + UINT i; + + CtInsertColumn(ct, _UU("SM_GROUPLIST_NAME"), false); + CtInsertColumn(ct, _UU("SM_GROUPLIST_REALNAME"), false); + CtInsertColumn(ct, _UU("SM_GROUPLIST_NOTE"), false); + CtInsertColumn(ct, _UU("SM_GROUPLIST_NUMUSERS"), false); + + for (i = 0;i < t.NumGroup;i++) + { + wchar_t tmp1[MAX_SIZE]; + wchar_t tmp2[MAX_SIZE]; + RPC_ENUM_GROUP_ITEM *e = &t.Groups[i]; + + StrToUni(tmp1, sizeof(tmp1), e->Name); + UniToStru(tmp2, e->NumUsers); + + CtInsert(ct, tmp1, e->Realname, e->Note, tmp2); + } + + CtFreeEx(ct, c, true); + } + + FreeRpcEnumGroup(&t); + + FreeParamValueList(o); + + return 0; +} + +// Create a group +UINT PsGroupCreate(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) +{ + LIST *o; + PS *ps = (PS *)param; + UINT ret = 0; + RPC_SET_GROUP t; + // Parameter list that can be specified + PARAM args[] = + { + // "name", prompt_proc, prompt_param, eval_proc, eval_param + {"[name]", CmdPrompt, _UU("CMD_GroupCreate_Prompt_NAME"), CmdEvalNotEmpty, NULL}, + {"REALNAME", CmdPrompt, _UU("CMD_GroupCreate_Prompt_REALNAME"), NULL, NULL}, + {"NOTE", CmdPrompt, _UU("CMD_GroupCreate_Prompt_NOTE"), NULL, NULL}, + }; + + // If virtual HUB is not selected, it's an error + if (ps->HubName == NULL) + { + c->Write(c, _UU("CMD_Hub_Not_Selected")); + return ERR_INVALID_PARAMETER; + } + + o = ParseCommandList(c, cmd_name, str, args, sizeof(args) / sizeof(args[0])); + if (o == NULL) + { + return ERR_INVALID_PARAMETER; + } + + Zero(&t, sizeof(t)); + StrCpy(t.HubName, sizeof(t.HubName), ps->HubName); + StrCpy(t.Name, sizeof(t.Name), GetParamStr(o, "[name]")); + UniStrCpy(t.Realname, sizeof(t.Realname), GetParamUniStr(o, "REALNAME")); + UniStrCpy(t.Note, sizeof(t.Note), GetParamUniStr(o, "NOTE")); + + // RPC call + ret = ScCreateGroup(ps->Rpc, &t); + + if (ret != ERR_NO_ERROR) + { + // An error has occured + CmdPrintError(c, ret); + FreeParamValueList(o); + return ret; + } + + FreeRpcSetGroup(&t); + + FreeParamValueList(o); + + return 0; +} + +// Set the group information +UINT PsGroupSet(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) +{ + LIST *o; + PS *ps = (PS *)param; + UINT ret = 0; + RPC_SET_GROUP t; + // Parameter list that can be specified + PARAM args[] = + { + // "name", prompt_proc, prompt_param, eval_proc, eval_param + {"[name]", CmdPrompt, _UU("CMD_GroupCreate_Prompt_NAME"), CmdEvalNotEmpty, NULL}, + {"REALNAME", CmdPrompt, _UU("CMD_GroupCreate_Prompt_REALNAME"), NULL, NULL}, + {"NOTE", CmdPrompt, _UU("CMD_GroupCreate_Prompt_NOTE"), NULL, NULL}, + }; + + // If virtual HUB is not selected, it's an error + if (ps->HubName == NULL) + { + c->Write(c, _UU("CMD_Hub_Not_Selected")); + return ERR_INVALID_PARAMETER; + } + + o = ParseCommandList(c, cmd_name, str, args, sizeof(args) / sizeof(args[0])); + if (o == NULL) + { + return ERR_INVALID_PARAMETER; + } + + Zero(&t, sizeof(t)); + StrCpy(t.HubName, sizeof(t.HubName), ps->HubName); + StrCpy(t.Name, sizeof(t.Name), GetParamStr(o, "[name]")); + + // RPC call + ret = ScGetGroup(ps->Rpc, &t); + + if (ret != ERR_NO_ERROR) + { + // An error has occured + CmdPrintError(c, ret); + FreeParamValueList(o); + return ret; + } + + // Information update + UniStrCpy(t.Realname, sizeof(t.Realname), GetParamUniStr(o, "REALNAME")); + UniStrCpy(t.Note, sizeof(t.Note), GetParamUniStr(o, "NOTE")); + + // RPC call + ret = ScSetGroup(ps->Rpc, &t); + + if (ret != ERR_NO_ERROR) + { + // An error has occured + CmdPrintError(c, ret); + FreeParamValueList(o); + return ret; + } + + FreeRpcSetGroup(&t); + + FreeParamValueList(o); + + return 0; +} + +// Delete a group +UINT PsGroupDelete(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) +{ + LIST *o; + PS *ps = (PS *)param; + UINT ret = 0; + RPC_DELETE_USER t; + // Parameter list that can be specified + PARAM args[] = + { + // "name", prompt_proc, prompt_param, eval_proc, eval_param + {"[name]", CmdPrompt, _UU("CMD_GroupCreate_Prompt_NAME"), CmdEvalNotEmpty, NULL}, + }; + + // If virtual HUB is not selected, it's an error + if (ps->HubName == NULL) + { + c->Write(c, _UU("CMD_Hub_Not_Selected")); + return ERR_INVALID_PARAMETER; + } + + o = ParseCommandList(c, cmd_name, str, args, sizeof(args) / sizeof(args[0])); + if (o == NULL) + { + return ERR_INVALID_PARAMETER; + } + + Zero(&t, sizeof(t)); + StrCpy(t.HubName, sizeof(t.HubName), ps->HubName); + StrCpy(t.Name, sizeof(t.Name), GetParamStr(o, "[name]")); + + // RPC call + ret = ScDeleteGroup(ps->Rpc, &t); + + if (ret != ERR_NO_ERROR) + { + // An error has occured + CmdPrintError(c, ret); + FreeParamValueList(o); + return ret; + } + + FreeParamValueList(o); + + return 0; +} + +// Get the group information and the list of users who belong to the group +UINT PsGroupGet(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) +{ + LIST *o; + PS *ps = (PS *)param; + UINT ret = 0; + RPC_SET_GROUP t; + // Parameter list that can be specified + PARAM args[] = + { + // "name", prompt_proc, prompt_param, eval_proc, eval_param + {"[name]", CmdPrompt, _UU("CMD_GroupCreate_Prompt_NAME"), CmdEvalNotEmpty, NULL}, + }; + + // If virtual HUB is not selected, it's an error + if (ps->HubName == NULL) + { + c->Write(c, _UU("CMD_Hub_Not_Selected")); + return ERR_INVALID_PARAMETER; + } + + o = ParseCommandList(c, cmd_name, str, args, sizeof(args) / sizeof(args[0])); + if (o == NULL) + { + return ERR_INVALID_PARAMETER; + } + + Zero(&t, sizeof(t)); + StrCpy(t.HubName, sizeof(t.HubName), ps->HubName); + StrCpy(t.Name, sizeof(t.Name), GetParamStr(o, "[name]")); + + // RPC call + ret = ScGetGroup(ps->Rpc, &t); + + if (ret != ERR_NO_ERROR) + { + // An error has occured + CmdPrintError(c, ret); + FreeParamValueList(o); + return ret; + } + else + { + wchar_t tmp[MAX_SIZE]; + char groupname[MAX_USERNAME_LEN + 1]; + CT *ct = CtNewStandard(); + + StrCpy(groupname, sizeof(groupname), t.Name); + + StrToUni(tmp, sizeof(tmp), t.Name); + CtInsert(ct, _UU("CMD_GroupGet_Column_NAME"), tmp); + CtInsert(ct, _UU("CMD_GroupGet_Column_REALNAME"), t.Realname); + CtInsert(ct, _UU("CMD_GroupGet_Column_NOTE"), t.Note); + + CtFree(ct, c); + + if (t.Policy != NULL) + { + c->Write(c, L""); + c->Write(c, _UU("CMD_GroupGet_Column_POLICY")); + + PrintPolicy(c, t.Policy, false); + } + + { + RPC_ENUM_USER t; + bool b = false; + + Zero(&t, sizeof(t)); + + StrCpy(t.HubName, sizeof(t.HubName), ps->HubName); + + if (ScEnumUser(ps->Rpc, &t) == ERR_NO_ERROR) + { + UINT i; + + for (i = 0;i < t.NumUser;i++) + { + RPC_ENUM_USER_ITEM *u = &t.Users[i]; + + if (StrCmpi(u->GroupName, groupname) == 0) + { + if (b == false) + { + b = true; + c->Write(c, L""); + c->Write(c, _UU("CMD_GroupGet_Column_MEMBERS")); + } + + UniFormat(tmp, sizeof(tmp), L" %S", u->Name); + c->Write(c, tmp); + } + } + FreeRpcEnumUser(&t); + + if (b) + { + c->Write(c, L""); + } + } + } + + } + + FreeRpcSetGroup(&t); + + FreeParamValueList(o); + + return 0; +} + +// Add an user to the group +UINT PsGroupJoin(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) +{ + LIST *o; + PS *ps = (PS *)param; + UINT ret = 0; + RPC_SET_USER t; + // Parameter list that can be specified + PARAM args[] = + { + // "name", prompt_proc, prompt_param, eval_proc, eval_param + {"[name]", CmdPrompt, _UU("CMD_GroupCreate_Prompt_NAME"), CmdEvalNotEmpty, NULL}, + {"USERNAME", CmdPrompt, _UU("CMD_GroupJoin_Prompt_USERNAME"), CmdEvalNotEmpty, NULL}, + }; + + // If virtual HUB is not selected, it's an error + if (ps->HubName == NULL) + { + c->Write(c, _UU("CMD_Hub_Not_Selected")); + return ERR_INVALID_PARAMETER; + } + + o = ParseCommandList(c, cmd_name, str, args, sizeof(args) / sizeof(args[0])); + if (o == NULL) + { + return ERR_INVALID_PARAMETER; + } + + Zero(&t, sizeof(t)); + StrCpy(t.HubName, sizeof(t.HubName), ps->HubName); + StrCpy(t.Name, sizeof(t.Name), GetParamStr(o, "USERNAME")); + + // RPC call + ret = ScGetUser(ps->Rpc, &t); + + if (ret != ERR_NO_ERROR) + { + // An error has occured + CmdPrintError(c, ret); + FreeParamValueList(o); + return ret; + } + else + { + // Update the Group + StrCpy(t.GroupName, sizeof(t.GroupName), GetParamStr(o, "[name]")); + + ret = ScSetUser(ps->Rpc, &t); + + if (ret != ERR_NO_ERROR) + { + // An error has occured + CmdPrintError(c, ret); + FreeParamValueList(o); + return ret; + } + } + + FreeRpcSetUser(&t); + + FreeParamValueList(o); + + return 0; +} + +// Delete the user from a group +UINT PsGroupUnjoin(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) +{ + LIST *o; + PS *ps = (PS *)param; + UINT ret = 0; + RPC_SET_USER t; + // Parameter list that can be specified + PARAM args[] = + { + // "name", prompt_proc, prompt_param, eval_proc, eval_param + {"[name]", CmdPrompt, _UU("CMD_GroupUnjoin_Prompt_name"), CmdEvalNotEmpty, NULL}, + }; + + // If virtual HUB is not selected, it's an error + if (ps->HubName == NULL) + { + c->Write(c, _UU("CMD_Hub_Not_Selected")); + return ERR_INVALID_PARAMETER; + } + + o = ParseCommandList(c, cmd_name, str, args, sizeof(args) / sizeof(args[0])); + if (o == NULL) + { + return ERR_INVALID_PARAMETER; + } + + Zero(&t, sizeof(t)); + StrCpy(t.HubName, sizeof(t.HubName), ps->HubName); + StrCpy(t.Name, sizeof(t.Name), GetParamStr(o, "[name]")); + + // RPC call + ret = ScGetUser(ps->Rpc, &t); + + if (ret != ERR_NO_ERROR) + { + // An error has occured + CmdPrintError(c, ret); + FreeParamValueList(o); + return ret; + } + else + { + // Update the Group + StrCpy(t.GroupName, sizeof(t.GroupName), ""); + + ret = ScSetUser(ps->Rpc, &t); + + if (ret != ERR_NO_ERROR) + { + // An error has occured + CmdPrintError(c, ret); + FreeParamValueList(o); + return ret; + } + } + + FreeRpcSetUser(&t); + + FreeParamValueList(o); + + return 0; +} + +// Delete the security policy of the group +UINT PsGroupPolicyRemove(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) +{ + LIST *o; + PS *ps = (PS *)param; + UINT ret = 0; + RPC_SET_GROUP t; + // Parameter list that can be specified + PARAM args[] = + { + // "name", prompt_proc, prompt_param, eval_proc, eval_param + {"[name]", CmdPrompt, _UU("CMD_GroupCreate_Prompt_NAME"), CmdEvalNotEmpty, NULL}, + }; + + // If virtual HUB is not selected, it's an error + if (ps->HubName == NULL) + { + c->Write(c, _UU("CMD_Hub_Not_Selected")); + return ERR_INVALID_PARAMETER; + } + + o = ParseCommandList(c, cmd_name, str, args, sizeof(args) / sizeof(args[0])); + if (o == NULL) + { + return ERR_INVALID_PARAMETER; + } + + Zero(&t, sizeof(t)); + StrCpy(t.HubName, sizeof(t.HubName), ps->HubName); + StrCpy(t.Name, sizeof(t.Name), GetParamStr(o, "[name]")); + + // RPC call + ret = ScGetGroup(ps->Rpc, &t); + + if (ret != ERR_NO_ERROR) + { + // An error has occured + CmdPrintError(c, ret); + FreeParamValueList(o); + return ret; + } + else + { + // Update + if (t.Policy != NULL) + { + Free(t.Policy); + t.Policy = NULL; + } + + ret = ScSetGroup(ps->Rpc, &t); + + if (ret != ERR_NO_ERROR) + { + // An error has occured + CmdPrintError(c, ret); + FreeParamValueList(o); + return ret; + } + } + + FreeRpcSetGroup(&t); + + FreeParamValueList(o); + + return 0; +} + +// Set a security policy to a group +UINT PsGroupPolicySet(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) +{ + LIST *o; + PS *ps = (PS *)param; + UINT ret = 0; + RPC_SET_GROUP t; + // Parameter list that can be specified + PARAM args[] = + { + // "name", prompt_proc, prompt_param, eval_proc, eval_param + {"[name]", CmdPrompt, _UU("CMD_GroupCreate_Prompt_NAME"), CmdEvalNotEmpty, NULL}, + {"NAME", CmdPrompt, _UU("CMD_CascadePolicySet_PROMPT_POLNAME"), CmdEvalNotEmpty, NULL}, + {"VALUE", CmdPrompt, _UU("CMD_CascadePolicySet_PROMPT_POLVALUE"), CmdEvalNotEmpty, NULL}, + }; + + // If virtual HUB is not selected, it's an error + if (ps->HubName == NULL) + { + c->Write(c, _UU("CMD_Hub_Not_Selected")); + return ERR_INVALID_PARAMETER; + } + + o = ParseCommandList(c, cmd_name, str, args, sizeof(args) / sizeof(args[0])); + if (o == NULL) + { + return ERR_INVALID_PARAMETER; + } + + Zero(&t, sizeof(t)); + StrCpy(t.HubName, sizeof(t.HubName), ps->HubName); + StrCpy(t.Name, sizeof(t.Name), GetParamStr(o, "[name]")); + + // RPC call + ret = ScGetGroup(ps->Rpc, &t); + + if (ret != ERR_NO_ERROR) + { + // An error has occured + CmdPrintError(c, ret); + FreeParamValueList(o); + return ret; + } + else + { + // Update + if (t.Policy == NULL) + { + t.Policy = ClonePolicy(GetDefaultPolicy()); + } + + if (EditPolicy(c, t.Policy, GetParamStr(o, "NAME"), GetParamStr(o, "VALUE"), false) == false) + { + // An error has occured + FreeRpcSetGroup(&t); + CmdPrintError(c, ret); + FreeParamValueList(o); + return ERR_INTERNAL_ERROR; + } + + ret = ScSetGroup(ps->Rpc, &t); + + if (ret != ERR_NO_ERROR) + { + // An error has occured + CmdPrintError(c, ret); + FreeParamValueList(o); + return ret; + } + } + + FreeRpcSetGroup(&t); + + FreeParamValueList(o); + + return 0; +} + +// Get the connected session list +UINT PsSessionList(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) +{ + LIST *o; + PS *ps = (PS *)param; + UINT ret = 0; + RPC_ENUM_SESSION t; + UINT server_type = 0; + + o = ParseCommandList(c, cmd_name, str, NULL, 0); + if (o == NULL) + { + return ERR_INVALID_PARAMETER; + } + + // If virtual HUB is not selected, it's an error + if (ps->HubName == NULL) + { + c->Write(c, _UU("CMD_Hub_Not_Selected")); + return ERR_INVALID_PARAMETER; + } + + { + // Get the server type + RPC_SERVER_INFO t; + + Zero(&t, sizeof(t)); + + if (ScGetServerInfo(ps->Rpc, &t) == ERR_NO_ERROR) + { + server_type = t.ServerType; + + FreeRpcServerInfo(&t); + } + } + + Zero(&t, sizeof(t)); + StrCpy(t.HubName, sizeof(t.HubName), ps->HubName); + + // RPC call + ret = ScEnumSession(ps->Rpc, &t); + + if (ret != ERR_NO_ERROR) + { + // An error has occured + CmdPrintError(c, ret); + FreeParamValueList(o); + return ret; + } + else + { + CT *ct = CtNew(); + UINT i; + + CtInsertColumn(ct, _UU("SM_SESS_COLUMN_1"), false); + CtInsertColumn(ct, _UU("SM_SESS_COLUMN_8"), false); + CtInsertColumn(ct, _UU("SM_SESS_COLUMN_2"), false); + CtInsertColumn(ct, _UU("SM_SESS_COLUMN_3"), false); + CtInsertColumn(ct, _UU("SM_SESS_COLUMN_4"), false); + CtInsertColumn(ct, _UU("SM_SESS_COLUMN_5"), true); + CtInsertColumn(ct, _UU("SM_SESS_COLUMN_6"), true); + CtInsertColumn(ct, _UU("SM_SESS_COLUMN_7"), true); + + for (i = 0;i < t.NumSession;i++) + { + RPC_ENUM_SESSION_ITEM *e = &t.Sessions[i]; + wchar_t tmp1[MAX_SIZE]; + wchar_t *tmp2; + wchar_t tmp3[MAX_SIZE]; + wchar_t tmp4[MAX_SIZE]; + wchar_t tmp5[MAX_SIZE]; + wchar_t tmp6[MAX_SIZE]; + wchar_t tmp7[MAX_SIZE]; + wchar_t tmp8[MAX_SIZE]; + bool free_tmp2 = false; + + StrToUni(tmp1, sizeof(tmp1), e->Name); + + tmp2 = _UU("SM_SESS_NORMAL"); + if (server_type != SERVER_TYPE_STANDALONE) + { + if (e->RemoteSession) + { + tmp2 = ZeroMalloc(MAX_SIZE); + UniFormat(tmp2, MAX_SIZE, _UU("SM_SESS_REMOTE"), e->RemoteHostname); + free_tmp2 = true; + } + else + { + if (StrLen(e->RemoteHostname) == 0) + { + tmp2 = _UU("SM_SESS_LOCAL"); + } + else + { + tmp2 = ZeroMalloc(MAX_SIZE); + UniFormat(tmp2, MAX_SIZE, _UU("SM_SESS_LOCAL_2"), e->RemoteHostname); + free_tmp2 = true; + } + } + } + if (e->LinkMode) + { + if (free_tmp2) + { + Free(tmp2); + free_tmp2 = false; + } + tmp2 = _UU("SM_SESS_LINK"); + } + else if (e->SecureNATMode) + { + /*if (free_tmp2) + { + Free(tmp2); + free_tmp2 = false; + }*/ + tmp2 = _UU("SM_SESS_SNAT"); + } + + StrToUni(tmp3, sizeof(tmp3), e->Username); + + StrToUni(tmp4, sizeof(tmp4), e->Hostname); + if (e->LinkMode) + { + UniStrCpy(tmp4, sizeof(tmp4), _UU("SM_SESS_LINK_HOSTNAME")); + } + else if (e->SecureNATMode) + { + UniStrCpy(tmp4, sizeof(tmp4), _UU("SM_SESS_SNAT_HOSTNAME")); + } + else if (e->BridgeMode) + { + UniStrCpy(tmp4, sizeof(tmp4), _UU("SM_SESS_BRIDGE_HOSTNAME")); + } + else if (StartWith(e->Username, L3_USERNAME)) + { + UniStrCpy(tmp4, sizeof(tmp4), _UU("SM_SESS_LAYER3_HOSTNAME")); + } + + UniFormat(tmp5, sizeof(tmp5), L"%u / %u", e->CurrentNumTcp, e->MaxNumTcp); + if (e->LinkMode) + { + UniStrCpy(tmp5, sizeof(tmp5), _UU("SM_SESS_LINK_TCP")); + } + else if (e->SecureNATMode) + { + UniStrCpy(tmp5, sizeof(tmp5), _UU("SM_SESS_SNAT_TCP")); + } + else if (e->BridgeMode) + { + UniStrCpy(tmp5, sizeof(tmp5), _UU("SM_SESS_BRIDGE_TCP")); + } + + UniToStr3(tmp6, sizeof(tmp6), e->PacketSize); + UniToStr3(tmp7, sizeof(tmp7), e->PacketNum); + + if (e->VLanId == 0) + { + UniStrCpy(tmp8, sizeof(tmp8), _UU("CM_ST_NO_VLAN")); + } + else + { + UniToStru(tmp8, e->VLanId); + } + + CtInsert(ct, tmp1, tmp8, tmp2, tmp3, tmp4, tmp5, tmp6, tmp7); + + if (free_tmp2) + { + Free(tmp2); + } + } + + + CtFreeEx(ct, c, true); + } + + FreeRpcEnumSession(&t); + + FreeParamValueList(o); + + return 0; +} + +// Display the NODE_INFO +void CmdPrintNodeInfo(CT *ct, NODE_INFO *info) +{ + wchar_t tmp[MAX_SIZE]; + char str[MAX_SIZE]; + // Validate arguments + if (ct == NULL || info == NULL) + { + return; + } + + StrToUni(tmp, sizeof(tmp), info->ClientProductName); + CtInsert(ct, _UU("SM_NODE_CLIENT_NAME"), tmp); + + UniFormat(tmp, sizeof(tmp), L"%u.%02u", Endian32(info->ClientProductVer) / 100, Endian32(info->ClientProductVer) % 100); + CtInsert(ct, _UU("SM_NODE_CLIENT_VER"), tmp); + + UniFormat(tmp, sizeof(tmp), L"Build %u", Endian32(info->ClientProductBuild)); + CtInsert(ct, _UU("SM_NODE_CLIENT_BUILD"), tmp); + + StrToUni(tmp, sizeof(tmp), info->ClientOsName); + CtInsert(ct, _UU("SM_NODE_CLIENT_OS_NAME"), tmp); + + StrToUni(tmp, sizeof(tmp), info->ClientOsVer); + CtInsert(ct, _UU("SM_NODE_CLIENT_OS_VER"), tmp); + + StrToUni(tmp, sizeof(tmp), info->ClientOsProductId); + CtInsert(ct, _UU("SM_NODE_CLIENT_OS_PID"), tmp); + + StrToUni(tmp, sizeof(tmp), info->ClientHostname); + CtInsert(ct, _UU("SM_NODE_CLIENT_HOST"), tmp); + + IPToStr4or6(str, sizeof(str), info->ClientIpAddress, info->ClientIpAddress6); + StrToUni(tmp, sizeof(tmp), str); + CtInsert(ct, _UU("SM_NODE_CLIENT_IP"), tmp); + + UniToStru(tmp, Endian32(info->ClientPort)); + CtInsert(ct, _UU("SM_NODE_CLIENT_PORT"), tmp); + + StrToUni(tmp, sizeof(tmp), info->ServerHostname); + CtInsert(ct, _UU("SM_NODE_SERVER_HOST"), tmp); + + IPToStr4or6(str, sizeof(str), info->ServerIpAddress, info->ServerIpAddress6); + StrToUni(tmp, sizeof(tmp), str); + CtInsert(ct, _UU("SM_NODE_SERVER_IP"), tmp); + + UniToStru(tmp, Endian32(info->ServerPort)); + CtInsert(ct, _UU("SM_NODE_SERVER_PORT"), tmp); + + if (StrLen(info->ProxyHostname) != 0) + { + StrToUni(tmp, sizeof(tmp), info->ProxyHostname); + CtInsert(ct, _UU("SM_NODE_PROXY_HOSTNAME"), tmp); + + IPToStr4or6(str, sizeof(str), info->ProxyIpAddress, info->ProxyIpAddress6); + StrToUni(tmp, sizeof(tmp), str); + CtInsert(ct, _UU("SM_NODE_PROXY_IP"), tmp); + + UniToStru(tmp, Endian32(info->ProxyPort)); + CtInsert(ct, _UU("SM_NODE_PROXY_PORT"), tmp); + } +} + +// Get the session information +UINT PsSessionGet(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) +{ + LIST *o; + PS *ps = (PS *)param; + UINT ret = 0; + RPC_SESSION_STATUS t; + // Parameter list that can be specified + PARAM args[] = + { + // "name", prompt_proc, prompt_param, eval_proc, eval_param + {"[name]", CmdPrompt, _UU("CMD_SessionGet_Prompt_NAME"), CmdEvalNotEmpty, NULL}, + }; + + // If virtual HUB is not selected, it's an error + if (ps->HubName == NULL) + { + c->Write(c, _UU("CMD_Hub_Not_Selected")); + return ERR_INVALID_PARAMETER; + } + + o = ParseCommandList(c, cmd_name, str, args, sizeof(args) / sizeof(args[0])); + if (o == NULL) + { + return ERR_INVALID_PARAMETER; + } + + Zero(&t, sizeof(t)); + StrCpy(t.HubName, sizeof(t.HubName), ps->HubName); + StrCpy(t.Name, sizeof(t.Name), GetParamStr(o, "[name]")); + + // RPC call + ret = ScGetSessionStatus(ps->Rpc, &t); + + if (ret != ERR_NO_ERROR) + { + // An error has occured + CmdPrintError(c, ret); + FreeParamValueList(o); + return ret; + } + else + { + wchar_t tmp[MAX_SIZE]; + char str[MAX_SIZE]; + CT *ct = CtNewStandard(); + + if (t.ClientIp != 0) + { + IPToStr4or6(str, sizeof(str), t.ClientIp, t.ClientIp6); + StrToUni(tmp, sizeof(tmp), str); + CtInsert(ct, _UU("SM_CLIENT_IP"), tmp); + } + + if (StrLen(t.ClientHostName) != 0) + { + StrToUni(tmp, sizeof(tmp), t.ClientHostName); + CtInsert(ct, _UU("SM_CLIENT_HOSTNAME"), tmp); + } + + StrToUni(tmp, sizeof(tmp), t.Username); + CtInsert(ct, _UU("SM_SESS_STATUS_USERNAME"), tmp); + + if (StrCmpi(t.Username, LINK_USER_NAME_PRINT) != 0 && StrCmpi(t.Username, SNAT_USER_NAME_PRINT) != 0 && StrCmpi(t.Username, BRIDGE_USER_NAME_PRINT) != 0) + { + StrToUni(tmp, sizeof(tmp), t.RealUsername); + CtInsert(ct, _UU("SM_SESS_STATUS_REALUSER"), tmp); + } + + if (IsEmptyStr(t.GroupName) == false) + { + StrToUni(tmp, sizeof(tmp), t.GroupName); + CtInsert(ct, _UU("SM_SESS_STATUS_GROUPNAME"), tmp); + } + + + CmdPrintStatusToListViewEx(ct, &t.Status, true); + + if (StrCmpi(t.Username, LINK_USER_NAME_PRINT) != 0 && StrCmpi(t.Username, SNAT_USER_NAME_PRINT) != 0 && StrCmpi(t.Username, BRIDGE_USER_NAME_PRINT) != 0 && + StartWith(t.Username, L3_USERNAME) == false) + { + CmdPrintNodeInfo(ct, &t.NodeInfo); + } + + CtFree(ct, c); + } + + FreeRpcSessionStatus(&t); + + FreeParamValueList(o); + + return 0; +} + +// Disconnect the session +UINT PsSessionDisconnect(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) +{ + LIST *o; + PS *ps = (PS *)param; + UINT ret = 0; + RPC_DELETE_SESSION t; + // Parameter list that can be specified + PARAM args[] = + { + // "name", prompt_proc, prompt_param, eval_proc, eval_param + {"[name]", CmdPrompt, _UU("CMD_SessionGet_Prompt_NAME"), CmdEvalNotEmpty, NULL}, + }; + + // If virtual HUB is not selected, it's an error + if (ps->HubName == NULL) + { + c->Write(c, _UU("CMD_Hub_Not_Selected")); + return ERR_INVALID_PARAMETER; + } + + o = ParseCommandList(c, cmd_name, str, args, sizeof(args) / sizeof(args[0])); + if (o == NULL) + { + return ERR_INVALID_PARAMETER; + } + + Zero(&t, sizeof(t)); + StrCpy(t.HubName, sizeof(t.HubName), ps->HubName); + StrCpy(t.Name, sizeof(t.Name), GetParamStr(o, "[name]")); + + // RPC call + ret = ScDeleteSession(ps->Rpc, &t); + + if (ret != ERR_NO_ERROR) + { + // An error has occured + CmdPrintError(c, ret); + FreeParamValueList(o); + return ret; + } + + FreeParamValueList(o); + + return 0; +} + +// Get the MAC address table database +UINT PsMacTable(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) +{ + LIST *o; + PS *ps = (PS *)param; + UINT ret = 0; + RPC_ENUM_MAC_TABLE t; + UINT i; + + // Parameter list that can be specified + PARAM args[] = + { + // "name", prompt_proc, prompt_param, eval_proc, eval_param + {"[session_name]", NULL, NULL, NULL, NULL,} + }; + + // If virtual HUB is not selected, it's an error + if (ps->HubName == NULL) + { + c->Write(c, _UU("CMD_Hub_Not_Selected")); + return ERR_INVALID_PARAMETER; + } + + o = ParseCommandList(c, cmd_name, str, args, sizeof(args) / sizeof(args[0])); + if (o == NULL) + { + return ERR_INVALID_PARAMETER; + } + + Zero(&t, sizeof(t)); + StrCpy(t.HubName, sizeof(t.HubName), ps->HubName); + + // RPC call + ret = ScEnumMacTable(ps->Rpc, &t); + + if (ret != ERR_NO_ERROR) + { + // An error has occured + CmdPrintError(c, ret); + FreeParamValueList(o); + return ret; + } + else + { + CT *ct = CtNew(); + char *session_name = GetParamStr(o, "[session_name]"); + + if (IsEmptyStr(session_name)) + { + session_name = NULL; + } + + CtInsertColumn(ct, _UU("CMD_ID"), false); + CtInsertColumn(ct, _UU("SM_MAC_COLUMN_1"), false); + CtInsertColumn(ct, _UU("SM_MAC_COLUMN_1A"), false); + CtInsertColumn(ct, _UU("SM_MAC_COLUMN_2"), false); + CtInsertColumn(ct, _UU("SM_MAC_COLUMN_3"), false); + CtInsertColumn(ct, _UU("SM_MAC_COLUMN_4"), false); + CtInsertColumn(ct, _UU("SM_MAC_COLUMN_5"), false); + + for (i = 0;i < t.NumMacTable;i++) + { + char str[MAX_SIZE]; + wchar_t tmp0[128]; + wchar_t tmp1[MAX_SIZE]; + wchar_t tmp2[MAX_SIZE]; + wchar_t tmp3[MAX_SIZE]; + wchar_t tmp4[MAX_SIZE]; + wchar_t tmp5[MAX_SIZE]; + wchar_t tmp6[MAX_SIZE]; + + RPC_ENUM_MAC_TABLE_ITEM *e = &t.MacTables[i]; + + if (session_name == NULL || StrCmpi(e->SessionName, session_name) == 0) + { + UniToStru(tmp0, e->Key); + + StrToUni(tmp1, sizeof(tmp1), e->SessionName); + + MacToStr(str, sizeof(str), e->MacAddress); + StrToUni(tmp2, sizeof(tmp2), str); + + GetDateTimeStr64Uni(tmp3, sizeof(tmp3), SystemToLocal64(e->CreatedTime)); + + GetDateTimeStr64Uni(tmp4, sizeof(tmp4), SystemToLocal64(e->UpdatedTime)); + + if (StrLen(e->RemoteHostname) == 0) + { + UniStrCpy(tmp5, sizeof(tmp5), _UU("SM_MACIP_LOCAL")); + } + else + { + UniFormat(tmp5, sizeof(tmp5), _UU("SM_MACIP_SERVER"), e->RemoteHostname); + } + + UniToStru(tmp6, e->VlanId); + if (e->VlanId == 0) + { + UniStrCpy(tmp6, sizeof(tmp6), _UU("CM_ST_NONE")); + } + + CtInsert(ct, + tmp0, tmp1, tmp6, tmp2, tmp3, tmp4, tmp5); + } + } + + CtFreeEx(ct, c, true); + } + + FreeRpcEnumMacTable(&t); + + FreeParamValueList(o); + + return 0; +} + +// Delete a MAC address table entry +UINT PsMacDelete(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) +{ + LIST *o; + PS *ps = (PS *)param; + UINT ret = 0; + RPC_DELETE_TABLE t; + // Parameter list that can be specified + PARAM args[] = + { + // "name", prompt_proc, prompt_param, eval_proc, eval_param + {"[id]", CmdPrompt, _UU("CMD_MacDelete_Prompt"), CmdEvalNotEmpty, NULL}, + }; + + // If virtual HUB is not selected, it's an error + if (ps->HubName == NULL) + { + c->Write(c, _UU("CMD_Hub_Not_Selected")); + return ERR_INVALID_PARAMETER; + } + + o = ParseCommandList(c, cmd_name, str, args, sizeof(args) / sizeof(args[0])); + if (o == NULL) + { + return ERR_INVALID_PARAMETER; + } + + Zero(&t, sizeof(t)); + StrCpy(t.HubName, sizeof(t.HubName), ps->HubName); + t.Key = GetParamInt(o, "[id]"); + + // RPC call + ret = ScDeleteMacTable(ps->Rpc, &t); + + if (ret != ERR_NO_ERROR) + { + // An error has occured + CmdPrintError(c, ret); + FreeParamValueList(o); + return ret; + } + + FreeParamValueList(o); + + return 0; +} + +// Get the IP address table database +UINT PsIpTable(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) +{ + LIST *o; + PS *ps = (PS *)param; + UINT ret = 0; + RPC_ENUM_IP_TABLE t; + UINT i; + + // Parameter list that can be specified + PARAM args[] = + { + // "name", prompt_proc, prompt_param, eval_proc, eval_param + {"[session_name]", NULL, NULL, NULL, NULL,} + }; + + // If virtual HUB is not selected, it's an error + if (ps->HubName == NULL) + { + c->Write(c, _UU("CMD_Hub_Not_Selected")); + return ERR_INVALID_PARAMETER; + } + + o = ParseCommandList(c, cmd_name, str, args, sizeof(args) / sizeof(args[0])); + if (o == NULL) + { + return ERR_INVALID_PARAMETER; + } + + Zero(&t, sizeof(t)); + StrCpy(t.HubName, sizeof(t.HubName), ps->HubName); + + // RPC call + ret = ScEnumIpTable(ps->Rpc, &t); + + if (ret != ERR_NO_ERROR) + { + // An error has occured + CmdPrintError(c, ret); + FreeParamValueList(o); + return ret; + } + else + { + CT *ct = CtNew(); + char *session_name = GetParamStr(o, "[session_name]"); + + if (IsEmptyStr(session_name)) + { + session_name = NULL; + } + + CtInsertColumn(ct, _UU("CMD_ID"), false); + CtInsertColumn(ct, _UU("SM_IP_COLUMN_1"), false); + CtInsertColumn(ct, _UU("SM_IP_COLUMN_2"), false); + CtInsertColumn(ct, _UU("SM_IP_COLUMN_3"), false); + CtInsertColumn(ct, _UU("SM_IP_COLUMN_4"), false); + CtInsertColumn(ct, _UU("SM_IP_COLUMN_5"), false); + + for (i = 0;i < t.NumIpTable;i++) + { + char str[MAX_SIZE]; + wchar_t tmp0[128]; + wchar_t tmp1[MAX_SIZE]; + wchar_t tmp2[MAX_SIZE]; + wchar_t tmp3[MAX_SIZE]; + wchar_t tmp4[MAX_SIZE]; + wchar_t tmp5[MAX_SIZE]; + RPC_ENUM_IP_TABLE_ITEM *e = &t.IpTables[i]; + + if (session_name == NULL || StrCmpi(e->SessionName, session_name) == 0) + { + UniToStru(tmp0, e->Key); + + StrToUni(tmp1, sizeof(tmp1), e->SessionName); + + if (e->DhcpAllocated == false) + { + IPToStr(str, sizeof(str), &e->IpV6); + StrToUni(tmp2, sizeof(tmp2), str); + } + else + { + IPToStr(str, sizeof(str), &e->IpV6); + UniFormat(tmp2, sizeof(tmp2), _UU("SM_MAC_IP_DHCP"), str); + } + + GetDateTimeStr64Uni(tmp3, sizeof(tmp3), SystemToLocal64(e->CreatedTime)); + + GetDateTimeStr64Uni(tmp4, sizeof(tmp4), SystemToLocal64(e->UpdatedTime)); + + if (StrLen(e->RemoteHostname) == 0) + { + UniStrCpy(tmp5, sizeof(tmp5), _UU("SM_MACIP_LOCAL")); + } + else + { + UniFormat(tmp5, sizeof(tmp5), _UU("SM_MACIP_SERVER"), e->RemoteHostname); + } + + CtInsert(ct, + tmp0, tmp1, tmp2, tmp3, tmp4, tmp5); + } + } + + CtFreeEx(ct, c, true); + } + + FreeRpcEnumIpTable(&t); + + FreeParamValueList(o); + + return 0; +} + +// Delete the IP address table entry +UINT PsIpDelete(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) +{ + LIST *o; + PS *ps = (PS *)param; + UINT ret = 0; + RPC_DELETE_TABLE t; + // Parameter list that can be specified + PARAM args[] = + { + // "name", prompt_proc, prompt_param, eval_proc, eval_param + {"[id]", CmdPrompt, _UU("CMD_MacDelete_Prompt"), CmdEvalNotEmpty, NULL}, + }; + + // If virtual HUB is not selected, it's an error + if (ps->HubName == NULL) + { + c->Write(c, _UU("CMD_Hub_Not_Selected")); + return ERR_INVALID_PARAMETER; + } + + o = ParseCommandList(c, cmd_name, str, args, sizeof(args) / sizeof(args[0])); + if (o == NULL) + { + return ERR_INVALID_PARAMETER; + } + + Zero(&t, sizeof(t)); + StrCpy(t.HubName, sizeof(t.HubName), ps->HubName); + t.Key = GetParamInt(o, "[id]"); + + // RPC call + ret = ScDeleteIpTable(ps->Rpc, &t); + + if (ret != ERR_NO_ERROR) + { + // An error has occured + CmdPrintError(c, ret); + FreeParamValueList(o); + return ret; + } + + FreeParamValueList(o); + + return 0; +} + +// Enable the DHCP server function and the virtual NAT (SecureNAT function) +UINT PsSecureNatEnable(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) +{ + LIST *o; + PS *ps = (PS *)param; + UINT ret = 0; + RPC_HUB t; + + // If virtual HUB is not selected, it's an error + if (ps->HubName == NULL) + { + c->Write(c, _UU("CMD_Hub_Not_Selected")); + return ERR_INVALID_PARAMETER; + } + + o = ParseCommandList(c, cmd_name, str, NULL, 0); + if (o == NULL) + { + return ERR_INVALID_PARAMETER; + } + + Zero(&t, sizeof(t)); + StrCpy(t.HubName, sizeof(t.HubName), ps->HubName); + + // RPC call + ret = ScEnableSecureNAT(ps->Rpc, &t); + + if (ret != ERR_NO_ERROR) + { + // An error has occured + CmdPrintError(c, ret); + FreeParamValueList(o); + return ret; + } + + FreeParamValueList(o); + + return 0; +} + +// Disable the DHCP server function and the virtual NAT (SecureNAT function) +UINT PsSecureNatDisable(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) +{ + LIST *o; + PS *ps = (PS *)param; + UINT ret = 0; + RPC_HUB t; + + // If virtual HUB is not selected, it's an error + if (ps->HubName == NULL) + { + c->Write(c, _UU("CMD_Hub_Not_Selected")); + return ERR_INVALID_PARAMETER; + } + + o = ParseCommandList(c, cmd_name, str, NULL, 0); + if (o == NULL) + { + return ERR_INVALID_PARAMETER; + } + + Zero(&t, sizeof(t)); + StrCpy(t.HubName, sizeof(t.HubName), ps->HubName); + + // RPC call + ret = ScDisableSecureNAT(ps->Rpc, &t); + + if (ret != ERR_NO_ERROR) + { + // An error has occured + CmdPrintError(c, ret); + FreeParamValueList(o); + return ret; + } + + FreeParamValueList(o); + + return 0; +} + +// Get the operating status of the DHCP server function and the virtual NAT (SecureNAT function) +UINT PsSecureNatStatusGet(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) +{ + LIST *o; + PS *ps = (PS *)param; + UINT ret = 0; + RPC_NAT_STATUS t; + + // If virtual HUB is not selected, it's an error + if (ps->HubName == NULL) + { + c->Write(c, _UU("CMD_Hub_Not_Selected")); + return ERR_INVALID_PARAMETER; + } + + o = ParseCommandList(c, cmd_name, str, NULL, 0); + if (o == NULL) + { + return ERR_INVALID_PARAMETER; + } + + Zero(&t, sizeof(t)); + StrCpy(t.HubName, sizeof(t.HubName), ps->HubName); + + // RPC call + ret = ScGetSecureNATStatus(ps->Rpc, &t); + + if (ret != ERR_NO_ERROR) + { + // An error has occured + CmdPrintError(c, ret); + FreeParamValueList(o); + return ret; + } + else + { + wchar_t tmp[MAX_SIZE]; + CT *ct = CtNewStandard(); + + StrToUni(tmp, sizeof(tmp), ps->HubName); + CtInsert(ct, _UU("SM_HUB_COLUMN_1"), tmp); + + UniFormat(tmp, sizeof(tmp), _UU("SM_SNAT_NUM_SESSION"), t.NumTcpSessions); + CtInsert(ct, _UU("NM_STATUS_TCP"), tmp); + + UniFormat(tmp, sizeof(tmp), _UU("SM_SNAT_NUM_SESSION"), t.NumUdpSessions); + CtInsert(ct, _UU("NM_STATUS_UDP"), tmp); + + UniFormat(tmp, sizeof(tmp), _UU("SM_SNAT_NUM_SESSION"), t.NumIcmpSessions); + CtInsert(ct, _UU("NM_STATUS_ICMP"), tmp); + + UniFormat(tmp, sizeof(tmp), _UU("SM_SNAT_NUM_SESSION"), t.NumDnsSessions); + CtInsert(ct, _UU("NM_STATUS_DNS"), tmp); + + UniFormat(tmp, sizeof(tmp), _UU("SM_SNAT_NUM_CLIENT"), t.NumDhcpClients); + CtInsert(ct, _UU("NM_STATUS_DHCP"), tmp); + + CtInsert(ct, _UU("SM_SNAT_IS_KERNEL"), t.IsKernelMode ? _UU("SEC_YES") : _UU("SEC_NO")); + CtInsert(ct, _UU("SM_SNAT_IS_RAW"), t.IsRawIpMode ? _UU("SEC_YES") : _UU("SEC_NO")); + + CtFree(ct, c); + } + + FreeRpcNatStatus(&t); + + FreeParamValueList(o); + + return 0; +} + +// Get the network interface settings for a virtual host of SecureNAT function +UINT PsSecureNatHostGet(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) +{ + LIST *o; + PS *ps = (PS *)param; + UINT ret = 0; + VH_OPTION t; + + // If virtual HUB is not selected, it's an error + if (ps->HubName == NULL) + { + c->Write(c, _UU("CMD_Hub_Not_Selected")); + return ERR_INVALID_PARAMETER; + } + + o = ParseCommandList(c, cmd_name, str, NULL, 0); + if (o == NULL) + { + return ERR_INVALID_PARAMETER; + } + + Zero(&t, sizeof(t)); + StrCpy(t.HubName, sizeof(t.HubName), ps->HubName); + + // RPC call + ret = ScGetSecureNATOption(ps->Rpc, &t); + + if (ret != ERR_NO_ERROR) + { + // An error has occured + CmdPrintError(c, ret); + FreeParamValueList(o); + return ret; + } + else + { + wchar_t tmp[MAX_SIZE]; + char str[MAX_SIZE]; + CT *ct = CtNewStandard(); + + // Flags + // MAC Address + MacToStr(str, sizeof(str), t.MacAddress); + StrToUni(tmp, sizeof(tmp), str); + CtInsert(ct, _UU("CMD_SecureNatHostGet_Column_MAC"), tmp); + + // IP address + IPToUniStr(tmp, sizeof(tmp), &t.Ip); + CtInsert(ct, _UU("CMD_SecureNatHostGet_Column_IP"), tmp); + + // Subnet mask + IPToUniStr(tmp, sizeof(tmp), &t.Mask); + CtInsert(ct, _UU("CMD_SecureNatHostGet_Column_MASK"), tmp); + + CtFree(ct, c); + } + + FreeParamValueList(o); + + return 0; +} + +// Change the network interface settings for a virtual host of SecureNAT function +UINT PsSecureNatHostSet(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) +{ + LIST *o; + PS *ps = (PS *)param; + UINT ret = 0; + VH_OPTION t; + // Parameter list that can be specified + PARAM args[] = + { + // "name", prompt_proc, prompt_param, eval_proc, eval_param + {"MAC", CmdPrompt, _UU("CMD_SecureNatHostSet_Prompt_MAC"), NULL, NULL}, + {"IP", CmdPrompt, _UU("CMD_SecureNatHostSet_Prompt_IP"), CmdEvalIp, NULL}, + {"MASK", CmdPrompt, _UU("CMD_SecureNatHostSet_Prompt_MASK"), CmdEvalIp, NULL}, + }; + + // If virtual HUB is not selected, it's an error + if (ps->HubName == NULL) + { + c->Write(c, _UU("CMD_Hub_Not_Selected")); + return ERR_INVALID_PARAMETER; + } + + o = ParseCommandList(c, cmd_name, str, args, sizeof(args) / sizeof(args[0])); + if (o == NULL) + { + return ERR_INVALID_PARAMETER; + } + + Zero(&t, sizeof(t)); + StrCpy(t.HubName, sizeof(t.HubName), ps->HubName); + + // RPC call + ret = ScGetSecureNATOption(ps->Rpc, &t); + + if (ret != ERR_NO_ERROR) + { + // An error has occured + CmdPrintError(c, ret); + FreeParamValueList(o); + return ret; + } + else + { + char *mac, *ip, *mask; + bool ok = true; + + StrCpy(t.HubName, sizeof(t.HubName), ps->HubName); + + mac = GetParamStr(o, "MAC"); + ip = GetParamStr(o, "IP"); + mask = GetParamStr(o, "MASK"); + + if (IsEmptyStr(mac) == false) + { + BUF *b = StrToBin(mac); + + if (b == NULL || b->Size != 6) + { + ok = false; + } + else + { + Copy(t.MacAddress, b->Buf, 6); + } + + FreeBuf(b); + } + + if (IsEmptyStr(ip) == false) + { + if (IsIpStr4(ip) == false) + { + ok = false; + } + else + { + UINT u = StrToIP32(ip); + + if (u == 0 || u == 0xffffffff) + { + ok = false; + } + else + { + UINTToIP(&t.Ip, u); + } + } + } + + if (IsEmptyStr(mask) == false) + { + if (IsIpStr4(mask) == false) + { + ok = false; + } + else + { + StrToIP(&t.Mask, mask); + } + } + + if (ok == false) + { + // Parameter is invalid + ret = ERR_INVALID_PARAMETER; + CmdPrintError(c, ret); + FreeParamValueList(o); + return ret; + } + else + { + ret = ScSetSecureNATOption(ps->Rpc, &t); + + if (ret != ERR_NO_ERROR) + { + // An error has occured + CmdPrintError(c, ret); + FreeParamValueList(o); + return ret; + } + } + } + + FreeParamValueList(o); + + return 0; +} + +// Get the settings for the virtual NAT function of the SecureNAT function +UINT PsNatGet(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) +{ + LIST *o; + PS *ps = (PS *)param; + UINT ret = 0; + VH_OPTION t; + + // If virtual HUB is not selected, it's an error + if (ps->HubName == NULL) + { + c->Write(c, _UU("CMD_Hub_Not_Selected")); + return ERR_INVALID_PARAMETER; + } + + o = ParseCommandList(c, cmd_name, str, NULL, 0); + if (o == NULL) + { + return ERR_INVALID_PARAMETER; + } + + Zero(&t, sizeof(t)); + StrCpy(t.HubName, sizeof(t.HubName), ps->HubName); + + // RPC call + ret = ScGetSecureNATOption(ps->Rpc, &t); + + if (ret != ERR_NO_ERROR) + { + // An error has occured + CmdPrintError(c, ret); + FreeParamValueList(o); + return ret; + } + else + { + wchar_t tmp[MAX_SIZE]; + CT *ct = CtNewStandard(); + + // Use the virtual NAT function + CtInsert(ct, _UU("CMD_NatGet_Column_USE"), t.UseNat ? _UU("SEC_YES") : _UU("SEC_NO")); + + // MTU value + UniToStru(tmp, t.Mtu); + CtInsert(ct, _UU("CMD_NetGet_Column_MTU"), tmp); + + // TCP session timeout (in seconds) + UniToStru(tmp, t.NatTcpTimeout); + CtInsert(ct, _UU("CMD_NatGet_Column_TCP"), tmp); + + // UDP session timeout (in seconds) + UniToStru(tmp, t.NatUdpTimeout); + CtInsert(ct, _UU("CMD_NatGet_Column_UDP"), tmp); + + // To save the log + CtInsert(ct, _UU("CMD_SecureNatHostGet_Column_LOG"), t.SaveLog ? _UU("SEC_YES") : _UU("SEC_NO")); + + CtFree(ct, c); + } + + FreeParamValueList(o); + + return 0; +} + +// Enable the virtual NAT function of the SecureNAT function +UINT PsNatEnable(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) +{ + LIST *o; + PS *ps = (PS *)param; + UINT ret = 0; + VH_OPTION t; + + // If virtual HUB is not selected, it's an error + if (ps->HubName == NULL) + { + c->Write(c, _UU("CMD_Hub_Not_Selected")); + return ERR_INVALID_PARAMETER; + } + + o = ParseCommandList(c, cmd_name, str, NULL, 0); + if (o == NULL) + { + return ERR_INVALID_PARAMETER; + } + + Zero(&t, sizeof(t)); + StrCpy(t.HubName, sizeof(t.HubName), ps->HubName); + + // RPC call + ret = ScGetSecureNATOption(ps->Rpc, &t); + + if (ret != ERR_NO_ERROR) + { + // An error has occured + CmdPrintError(c, ret); + FreeParamValueList(o); + return ret; + } + else + { + t.UseNat = true; + + StrCpy(t.HubName, sizeof(t.HubName), ps->HubName); + ret = ScSetSecureNATOption(ps->Rpc, &t); + + if (ret != ERR_NO_ERROR) + { + // An error has occured + CmdPrintError(c, ret); + FreeParamValueList(o); + return ret; + } + } + + FreeParamValueList(o); + + return 0; +} + +// Disable the virtual NAT function of the SecureNAT function +UINT PsNatDisable(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) +{ + LIST *o; + PS *ps = (PS *)param; + UINT ret = 0; + VH_OPTION t; + + // If virtual HUB is not selected, it's an error + if (ps->HubName == NULL) + { + c->Write(c, _UU("CMD_Hub_Not_Selected")); + return ERR_INVALID_PARAMETER; + } + + o = ParseCommandList(c, cmd_name, str, NULL, 0); + if (o == NULL) + { + return ERR_INVALID_PARAMETER; + } + + Zero(&t, sizeof(t)); + StrCpy(t.HubName, sizeof(t.HubName), ps->HubName); + + // RPC call + ret = ScGetSecureNATOption(ps->Rpc, &t); + + if (ret != ERR_NO_ERROR) + { + // An error has occured + CmdPrintError(c, ret); + FreeParamValueList(o); + return ret; + } + else + { + t.UseNat = false; + + StrCpy(t.HubName, sizeof(t.HubName), ps->HubName); + ret = ScSetSecureNATOption(ps->Rpc, &t); + + if (ret != ERR_NO_ERROR) + { + // An error has occured + CmdPrintError(c, ret); + FreeParamValueList(o); + return ret; + } + } + + FreeParamValueList(o); + + return 0; +} + +// Change the settings for the virtual NAT function of the SecureNAT function +UINT PsNatSet(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) +{ + LIST *o; + PS *ps = (PS *)param; + UINT ret = 0; + VH_OPTION t; + // Parameter list that can be specified + CMD_EVAL_MIN_MAX mtu_mm = + { + "CMD_NatSet_Eval_MTU", TCP_HEADER_SIZE + IP_HEADER_SIZE + MAC_HEADER_SIZE + 8, MAX_L3_DATA_SIZE, + }; + CMD_EVAL_MIN_MAX tcp_mm = + { + "CMD_NatSet_Eval_TCP", NAT_TCP_MIN_TIMEOUT / 1000, NAT_TCP_MAX_TIMEOUT / 1000, + }; + CMD_EVAL_MIN_MAX udp_mm = + { + "CMD_NatSet_Eval_UDP", NAT_UDP_MIN_TIMEOUT / 1000, NAT_UDP_MAX_TIMEOUT / 1000, + }; + PARAM args[] = + { + // "name", prompt_proc, prompt_param, eval_proc, eval_param + {"MTU", CmdPrompt, _UU("CMD_NatSet_Prompt_MTU"), CmdEvalMinMax, &mtu_mm}, + {"TCPTIMEOUT", CmdPrompt, _UU("CMD_NatSet_Prompt_TCPTIMEOUT"), CmdEvalMinMax, &tcp_mm}, + {"UDPTIMEOUT", CmdPrompt, _UU("CMD_NatSet_Prompt_UDPTIMEOUT"), CmdEvalMinMax, &udp_mm}, + {"LOG", CmdPrompt, _UU("CMD_NatSet_Prompt_LOG"), CmdEvalNotEmpty, NULL}, + }; + + // If virtual HUB is not selected, it's an error + if (ps->HubName == NULL) + { + c->Write(c, _UU("CMD_Hub_Not_Selected")); + return ERR_INVALID_PARAMETER; + } + + o = ParseCommandList(c, cmd_name, str, args, sizeof(args) / sizeof(args[0])); + if (o == NULL) + { + return ERR_INVALID_PARAMETER; + } + + Zero(&t, sizeof(t)); + StrCpy(t.HubName, sizeof(t.HubName), ps->HubName); + + // RPC call + ret = ScGetSecureNATOption(ps->Rpc, &t); + + if (ret != ERR_NO_ERROR) + { + // An error has occured + CmdPrintError(c, ret); + FreeParamValueList(o); + return ret; + } + else + { + t.Mtu = GetParamInt(o, "MTU"); + t.NatTcpTimeout = GetParamInt(o, "TCPTIMEOUT"); + t.NatUdpTimeout = GetParamInt(o, "UDPTIMEOUT"); + t.SaveLog = GetParamYes(o, "LOG"); + + StrCpy(t.HubName, sizeof(t.HubName), ps->HubName); + ret = ScSetSecureNATOption(ps->Rpc, &t); + + if (ret != ERR_NO_ERROR) + { + // An error has occured + CmdPrintError(c, ret); + FreeParamValueList(o); + return ret; + } + } + + FreeParamValueList(o); + + return 0; +} + +// Get the session table of the virtual NAT function of the SecureNAT function +UINT PsNatTable(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) +{ + LIST *o; + PS *ps = (PS *)param; + UINT ret = 0; + RPC_ENUM_NAT t; + + // If virtual HUB is not selected, it's an error + if (ps->HubName == NULL) + { + c->Write(c, _UU("CMD_Hub_Not_Selected")); + return ERR_INVALID_PARAMETER; + } + + o = ParseCommandList(c, cmd_name, str, NULL, 0); + if (o == NULL) + { + return ERR_INVALID_PARAMETER; + } + + Zero(&t, sizeof(t)); + StrCpy(t.HubName, sizeof(t.HubName), ps->HubName); + + // RPC call + ret = ScEnumNAT(ps->Rpc, &t); + + if (ret != ERR_NO_ERROR) + { + // An error has occured + CmdPrintError(c, ret); + FreeParamValueList(o); + return ret; + } + else + { + CT *ct = CtNew(); + UINT i; + + CtInsertColumn(ct, _UU("NM_NAT_ID"), false); + CtInsertColumn(ct, _UU("NM_NAT_PROTOCOL"), false); + CtInsertColumn(ct, _UU("NM_NAT_SRC_HOST"), false); + CtInsertColumn(ct, _UU("NM_NAT_SRC_PORT"), false); + CtInsertColumn(ct, _UU("NM_NAT_DST_HOST"), false); + CtInsertColumn(ct, _UU("NM_NAT_DST_PORT"), false); + CtInsertColumn(ct, _UU("NM_NAT_CREATED"), false); + CtInsertColumn(ct, _UU("NM_NAT_LAST_COMM"), false); + CtInsertColumn(ct, _UU("NM_NAT_SIZE"), false); + CtInsertColumn(ct, _UU("NM_NAT_TCP_STATUS"), false); + + for (i = 0;i < t.NumItem;i++) + { + RPC_ENUM_NAT_ITEM *e = &t.Items[i]; + wchar_t tmp0[MAX_SIZE]; + wchar_t *tmp1 = L""; + wchar_t tmp2[MAX_SIZE]; + wchar_t tmp3[MAX_SIZE]; + wchar_t tmp4[MAX_SIZE]; + wchar_t tmp5[MAX_SIZE]; + wchar_t tmp6[MAX_SIZE]; + wchar_t tmp7[MAX_SIZE]; + wchar_t tmp8[MAX_SIZE]; + wchar_t *tmp9 = L""; + char v1[128], v2[128]; + + // ID + UniToStru(tmp0, e->Id); + + // Protocol + switch (e->Protocol) + { + case NAT_TCP: + tmp1 = _UU("NM_NAT_PROTO_TCP"); + break; + case NAT_UDP: + tmp1 = _UU("NM_NAT_PROTO_UDP"); + break; + case NAT_DNS: + tmp1 = _UU("NM_NAT_PROTO_DNS"); + break; + case NAT_ICMP: + tmp1 = _UU("NM_NAT_PROTO_ICMP"); + break; + } + + // Source host + StrToUni(tmp2, sizeof(tmp2), e->SrcHost); + + // Source port + UniToStru(tmp3, e->SrcPort); + + // Destination host + StrToUni(tmp4, sizeof(tmp4), e->DestHost); + + // Destination port + UniToStru(tmp5, e->DestPort); + + // Creation date and time of the session + GetDateTimeStrEx64(tmp6, sizeof(tmp6), SystemToLocal64(e->CreatedTime), NULL); + + // Last communication date and time + GetDateTimeStrEx64(tmp7, sizeof(tmp7), SystemToLocal64(e->LastCommTime), NULL); + + // Communication amount + ToStr3(v1, sizeof(v1), e->RecvSize); + ToStr3(v2, sizeof(v2), e->SendSize); + UniFormat(tmp8, sizeof(tmp8), L"%S / %S", v1, v2); + + // TCP state + if (e->Protocol == NAT_TCP) + { + switch (e->TcpStatus) + { + case NAT_TCP_CONNECTING: + tmp9 = _UU("NAT_TCP_CONNECTING"); + break; + case NAT_TCP_SEND_RESET: + tmp9 = _UU("NAT_TCP_SEND_RESET"); + break; + case NAT_TCP_CONNECTED: + tmp9 = _UU("NAT_TCP_CONNECTED"); + break; + case NAT_TCP_ESTABLISHED: + tmp9 = _UU("NAT_TCP_ESTABLISHED"); + break; + case NAT_TCP_WAIT_DISCONNECT: + tmp9 = _UU("NAT_TCP_WAIT_DISCONNECT"); + break; + } + } + + CtInsert(ct, + tmp0, tmp1, tmp2, tmp3, tmp4, tmp5, tmp6, tmp7, tmp8, tmp9); + } + + CtFreeEx(ct, c, true); + } + + FreeRpcEnumNat(&t); + + FreeParamValueList(o); + + return 0; +} + +// Get the settings for a virtual DHCP server function of the SecureNAT function +UINT PsDhcpGet(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) +{ + LIST *o; + PS *ps = (PS *)param; + UINT ret = 0; + VH_OPTION t; + + // If virtual HUB is not selected, it's an error + if (ps->HubName == NULL) + { + c->Write(c, _UU("CMD_Hub_Not_Selected")); + return ERR_INVALID_PARAMETER; + } + + o = ParseCommandList(c, cmd_name, str, NULL, 0); + if (o == NULL) + { + return ERR_INVALID_PARAMETER; + } + + Zero(&t, sizeof(t)); + StrCpy(t.HubName, sizeof(t.HubName), ps->HubName); + + // RPC call + ret = ScGetSecureNATOption(ps->Rpc, &t); + + if (ret != ERR_NO_ERROR) + { + // An error has occured + CmdPrintError(c, ret); + FreeParamValueList(o); + return ret; + } + else + { + wchar_t tmp[MAX_SIZE]; + CT *ct = CtNewStandard(); + + // To use the virtual DHCP function + CtInsert(ct, _UU("CMD_DhcpGet_Column_USE"), t.UseDhcp ? _UU("SEC_YES") : _UU("SEC_NO")); + + // Start address of the distributing address zone + IPToUniStr(tmp, sizeof(tmp), &t.DhcpLeaseIPStart); + CtInsert(ct, _UU("CMD_DhcpGet_Column_IP1"), tmp); + + // End address of the distributing address zone + IPToUniStr(tmp, sizeof(tmp), &t.DhcpLeaseIPEnd); + CtInsert(ct, _UU("CMD_DhcpGet_Column_IP2"), tmp); + + // Subnet mask + IPToUniStr(tmp, sizeof(tmp), &t.DhcpSubnetMask); + CtInsert(ct, _UU("CMD_DhcpGet_Column_MASK"), tmp); + + // Lease time (in seconds) + UniToStru(tmp, t.DhcpExpireTimeSpan); + CtInsert(ct, _UU("CMD_DhcpGet_Column_LEASE"), tmp); + + // Default gateway address + UniStrCpy(tmp, sizeof(tmp), _UU("SEC_NONE")); + if (IPToUINT(&t.DhcpGatewayAddress) != 0) + { + IPToUniStr(tmp, sizeof(tmp), &t.DhcpGatewayAddress); + } + CtInsert(ct, _UU("CMD_DhcpGet_Column_GW"), tmp); + + // DNS server address 1 + UniStrCpy(tmp, sizeof(tmp), _UU("SEC_NONE")); + if (IPToUINT(&t.DhcpDnsServerAddress) != 0) + { + IPToUniStr(tmp, sizeof(tmp), &t.DhcpDnsServerAddress); + } + CtInsert(ct, _UU("CMD_DhcpGet_Column_DNS"), tmp); + + // DNS server address 2 + UniStrCpy(tmp, sizeof(tmp), _UU("SEC_NONE")); + if (IPToUINT(&t.DhcpDnsServerAddress2) != 0) + { + IPToUniStr(tmp, sizeof(tmp), &t.DhcpDnsServerAddress2); + } + CtInsert(ct, _UU("CMD_DhcpGet_Column_DNS2"), tmp); + + // Domain name + StrToUni(tmp, sizeof(tmp), t.DhcpDomainName); + CtInsert(ct, _UU("CMD_DhcpGet_Column_DOMAIN"), tmp); + + // To save the log + CtInsert(ct, _UU("CMD_SecureNatHostGet_Column_LOG"), t.SaveLog ? _UU("SEC_YES") : _UU("SEC_NO")); + + // Push routing table + if (t.ApplyDhcpPushRoutes) + { + StrToUni(tmp, sizeof(tmp), t.DhcpPushRoutes); + CtInsert(ct, _UU("CMD_DhcpGet_Column_PUSHROUTE"), tmp); + } + + CtFree(ct, c); + } + + FreeParamValueList(o); + + return 0; +} + +// Enable the Virtual DHCP server function of SecureNAT function +UINT PsDhcpEnable(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) +{ + LIST *o; + PS *ps = (PS *)param; + UINT ret = 0; + VH_OPTION t; + + // If virtual HUB is not selected, it's an error + if (ps->HubName == NULL) + { + c->Write(c, _UU("CMD_Hub_Not_Selected")); + return ERR_INVALID_PARAMETER; + } + + o = ParseCommandList(c, cmd_name, str, NULL, 0); + if (o == NULL) + { + return ERR_INVALID_PARAMETER; + } + + Zero(&t, sizeof(t)); + StrCpy(t.HubName, sizeof(t.HubName), ps->HubName); + + // RPC call + ret = ScGetSecureNATOption(ps->Rpc, &t); + + if (ret != ERR_NO_ERROR) + { + // An error has occured + CmdPrintError(c, ret); + FreeParamValueList(o); + return ret; + } + else + { + t.UseDhcp = true; + + StrCpy(t.HubName, sizeof(t.HubName), ps->HubName); + ret = ScSetSecureNATOption(ps->Rpc, &t); + + if (ret != ERR_NO_ERROR) + { + // An error has occured + CmdPrintError(c, ret); + FreeParamValueList(o); + return ret; + } + } + + FreeParamValueList(o); + + return 0; +} + +// Disable the virtual DHCP server function of SecureNAT function +UINT PsDhcpDisable(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) +{ + LIST *o; + PS *ps = (PS *)param; + UINT ret = 0; + VH_OPTION t; + + // If virtual HUB is not selected, it's an error + if (ps->HubName == NULL) + { + c->Write(c, _UU("CMD_Hub_Not_Selected")); + return ERR_INVALID_PARAMETER; + } + + o = ParseCommandList(c, cmd_name, str, NULL, 0); + if (o == NULL) + { + return ERR_INVALID_PARAMETER; + } + + Zero(&t, sizeof(t)); + StrCpy(t.HubName, sizeof(t.HubName), ps->HubName); + + // RPC call + ret = ScGetSecureNATOption(ps->Rpc, &t); + + if (ret != ERR_NO_ERROR) + { + // An error has occured + CmdPrintError(c, ret); + FreeParamValueList(o); + return ret; + } + else + { + t.UseDhcp = false; + + ret = ScSetSecureNATOption(ps->Rpc, &t); + + if (ret != ERR_NO_ERROR) + { + // An error has occured + CmdPrintError(c, ret); + FreeParamValueList(o); + return ret; + } + } + + FreeParamValueList(o); + + return 0; +} + +// Change the settings for a virtual DHCP server function of the SecureNAT function +UINT PsDhcpSet(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) +{ + LIST *o; + PS *ps = (PS *)param; + UINT ret = 0; + VH_OPTION t; + // Parameter list that can be specified + CMD_EVAL_MIN_MAX mm = + { + "CMD_NatSet_Eval_UDP", NAT_UDP_MIN_TIMEOUT / 1000, NAT_UDP_MAX_TIMEOUT / 1000, + }; + PARAM args[] = + { + // "name", prompt_proc, prompt_param, eval_proc, eval_param + {"START", CmdPrompt, _UU("CMD_DhcpSet_Prompt_START"), CmdEvalIp, NULL}, + {"END", CmdPrompt, _UU("CMD_DhcpSet_Prompt_END"), CmdEvalIp, NULL}, + {"MASK", CmdPrompt, _UU("CMD_DhcpSet_Prompt_MASK"), CmdEvalIp, NULL}, + {"EXPIRE", CmdPrompt, _UU("CMD_DhcpSet_Prompt_EXPIRE"), CmdEvalMinMax, &mm}, + {"GW", CmdPrompt, _UU("CMD_DhcpSet_Prompt_GW"), CmdEvalIp, NULL}, + {"DNS", CmdPrompt, _UU("CMD_DhcpSet_Prompt_DNS"), CmdEvalIp, NULL}, + {"DNS2", CmdPrompt, _UU("CMD_DhcpSet_Prompt_DNS2"), CmdEvalIp, NULL}, + {"DOMAIN", CmdPrompt, _UU("CMD_DhcpSet_Prompt_DOMAIN"), NULL, NULL}, + {"LOG", CmdPrompt, _UU("CMD_NatSet_Prompt_LOG"), CmdEvalNotEmpty, NULL}, + {"PUSHROUTE", NULL, _UU("CMD_DhcpSet_PUSHROUTE"), NULL, NULL}, + }; + + // If virtual HUB is not selected, it's an error + if (ps->HubName == NULL) + { + c->Write(c, _UU("CMD_Hub_Not_Selected")); + return ERR_INVALID_PARAMETER; + } + + o = ParseCommandList(c, cmd_name, str, args, sizeof(args) / sizeof(args[0])); + if (o == NULL) + { + return ERR_INVALID_PARAMETER; + } + + Zero(&t, sizeof(t)); + StrCpy(t.HubName, sizeof(t.HubName), ps->HubName); + + // RPC call + ret = ScGetSecureNATOption(ps->Rpc, &t); + + if (ret != ERR_NO_ERROR) + { + // An error has occured + CmdPrintError(c, ret); + FreeParamValueList(o); + return ret; + } + else + { + + StrToIP(&t.DhcpLeaseIPStart, GetParamStr(o, "START")); + StrToIP(&t.DhcpLeaseIPEnd, GetParamStr(o, "END")); + StrToIP(&t.DhcpSubnetMask, GetParamStr(o, "MASK")); + t.DhcpExpireTimeSpan = GetParamInt(o, "EXPIRE"); + StrToIP(&t.DhcpGatewayAddress, GetParamStr(o, "GW")); + StrToIP(&t.DhcpDnsServerAddress, GetParamStr(o, "DNS")); + StrToIP(&t.DhcpDnsServerAddress2, GetParamStr(o, "DNS2")); + StrCpy(t.DhcpDomainName, sizeof(t.DhcpDomainName), GetParamStr(o, "DOMAIN")); + t.SaveLog = GetParamYes(o, "LOG"); + + StrCpy(t.DhcpPushRoutes, sizeof(t.DhcpPushRoutes), GetParamStr(o, "PUSHROUTE")); + t.ApplyDhcpPushRoutes = true; + + StrCpy(t.HubName, sizeof(t.HubName), ps->HubName); + ret = ScSetSecureNATOption(ps->Rpc, &t); + + if (ret != ERR_NO_ERROR) + { + // An error has occured + CmdPrintError(c, ret); + FreeParamValueList(o); + return ret; + } + + if (IsEmptyStr(GetParamStr(o, "PUSHROUTE")) == false) + { + if (GetCapsBool(ps->CapsList, "b_suppport_push_route") == false && + GetCapsBool(ps->CapsList, "b_suppport_push_route_config")) + { + CmdPrintError(c, ERR_NOT_SUPPORTED_FUNCTION_ON_OPENSOURCE); + } + } + } + + FreeParamValueList(o); + + return 0; +} + +// Get the lease table of virtual DHCP server function of the SecureNAT function +UINT PsDhcpTable(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) +{ + LIST *o; + PS *ps = (PS *)param; + UINT ret = 0; + RPC_ENUM_DHCP t; + + // If virtual HUB is not selected, it's an error + if (ps->HubName == NULL) + { + c->Write(c, _UU("CMD_Hub_Not_Selected")); + return ERR_INVALID_PARAMETER; + } + + o = ParseCommandList(c, cmd_name, str, NULL, 0); + if (o == NULL) + { + return ERR_INVALID_PARAMETER; + } + + Zero(&t, sizeof(t)); + StrCpy(t.HubName, sizeof(t.HubName), ps->HubName); + + // RPC call + ret = ScEnumDHCP(ps->Rpc, &t); + + if (ret != ERR_NO_ERROR) + { + // An error has occured + CmdPrintError(c, ret); + FreeParamValueList(o); + return ret; + } + else + { + CT *ct = CtNew(); + UINT i; + + CtInsertColumn(ct, _UU("DHCP_DHCP_ID"), false); + CtInsertColumn(ct, _UU("DHCP_LEASED_TIME"), false); + CtInsertColumn(ct, _UU("DHCP_EXPIRE_TIME"), false); + CtInsertColumn(ct, _UU("DHCP_MAC_ADDRESS"), false); + CtInsertColumn(ct, _UU("DHCP_IP_ADDRESS"), false); + CtInsertColumn(ct, _UU("DHCP_HOSTNAME"), false); + + for (i = 0;i < t.NumItem;i++) + { + RPC_ENUM_DHCP_ITEM *e = &t.Items[i]; + wchar_t tmp0[MAX_SIZE]; + wchar_t tmp1[MAX_SIZE]; + wchar_t tmp2[MAX_SIZE]; + wchar_t tmp3[MAX_SIZE]; + wchar_t tmp4[MAX_SIZE]; + wchar_t tmp5[MAX_SIZE]; + char str[MAX_SIZE]; + + // ID + UniToStru(tmp0, e->Id); + + // Time + GetDateTimeStrEx64(tmp1, sizeof(tmp1), SystemToLocal64(e->LeasedTime), NULL); + GetDateTimeStrEx64(tmp2, sizeof(tmp2), SystemToLocal64(e->ExpireTime), NULL); + + MacToStr(str, sizeof(str), e->MacAddress); + StrToUni(tmp3, sizeof(tmp3), str); + + IPToStr32(str, sizeof(str), e->IpAddress); + StrToUni(tmp4, sizeof(tmp4), str); + + StrToUni(tmp5, sizeof(tmp5), e->Hostname); + + CtInsert(ct, + tmp0, tmp1, tmp2, tmp3, tmp4, tmp5); + } + + CtFreeEx(ct, c, true); + } + + FreeRpcEnumDhcp(&t); + + FreeParamValueList(o); + + return 0; +} + +// Get the list of Virtual HUB management options +UINT PsAdminOptionList(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) +{ + LIST *o; + PS *ps = (PS *)param; + UINT ret = 0; + RPC_ADMIN_OPTION t; + + // If virtual HUB is not selected, it's an error + if (ps->HubName == NULL) + { + c->Write(c, _UU("CMD_Hub_Not_Selected")); + return ERR_INVALID_PARAMETER; + } + + o = ParseCommandList(c, cmd_name, str, NULL, 0); + if (o == NULL) + { + return ERR_INVALID_PARAMETER; + } + + Zero(&t, sizeof(t)); + StrCpy(t.HubName, sizeof(t.HubName), ps->HubName); + + // RPC call + ret = ScGetHubAdminOptions(ps->Rpc, &t); + + if (ret != ERR_NO_ERROR) + { + // An error has occured + CmdPrintError(c, ret); + FreeParamValueList(o); + return ret; + } + else + { + CT *ct = CtNewStandardEx(); + UINT i; + + for (i = 0;i < t.NumItem;i++) + { + ADMIN_OPTION *e = &t.Items[i]; + wchar_t tmp1[MAX_SIZE]; + wchar_t tmp2[MAX_SIZE]; + + StrToUni(tmp1, sizeof(tmp1), e->Name); + UniToStru(tmp2, e->Value); + + CtInsert(ct, tmp1, tmp2, GetHubAdminOptionHelpString(e->Name)); + + } + + CtFreeEx(ct, c, true); + } + + FreeRpcAdminOption(&t); + + FreeParamValueList(o); + + return 0; +} + +// Set the value of a Virtual HUB management option +UINT PsAdminOptionSet(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) +{ + LIST *o; + PS *ps = (PS *)param; + UINT ret = 0; + RPC_ADMIN_OPTION t; + // Parameter list that can be specified + PARAM args[] = + { + // "name", prompt_proc, prompt_param, eval_proc, eval_param + {"[name]", CmdPrompt, _UU("CMD_AdminOptionSet_Prompt_name"), CmdEvalNotEmpty, NULL}, + {"VALUE", CmdPrompt, _UU("CMD_AdminOptionSet_Prompt_VALUE"), CmdEvalNotEmpty, NULL}, + }; + + // If virtual HUB is not selected, it's an error + if (ps->HubName == NULL) + { + c->Write(c, _UU("CMD_Hub_Not_Selected")); + return ERR_INVALID_PARAMETER; + } + + o = ParseCommandList(c, cmd_name, str, args, sizeof(args) / sizeof(args[0])); + if (o == NULL) + { + return ERR_INVALID_PARAMETER; + } + + Zero(&t, sizeof(t)); + StrCpy(t.HubName, sizeof(t.HubName), ps->HubName); + + // RPC call + ret = ScGetHubAdminOptions(ps->Rpc, &t); + + if (ret != ERR_NO_ERROR) + { + // An error has occured + CmdPrintError(c, ret); + FreeParamValueList(o); + return ret; + } + else + { + UINT i; + bool b = false; + + for (i = 0;i < t.NumItem;i++) + { + if (StrCmpi(t.Items[i].Name, GetParamStr(o, "[name]")) == 0) + { + t.Items[i].Value = GetParamInt(o, "VALUE"); + b = true; + } + } + + if (b == false) + { + // An error has occured + ret = ERR_OBJECT_NOT_FOUND; + CmdPrintError(c, ret); + FreeParamValueList(o); + FreeRpcAdminOption(&t); + return ret; + } + else + { + StrCpy(t.HubName, sizeof(t.HubName), ps->HubName); + ret = ScSetHubAdminOptions(ps->Rpc, &t); + + if (ret != ERR_NO_ERROR) + { + // An error has occured + CmdPrintError(c, ret); + FreeParamValueList(o); + return ret; + } + } + } + + FreeRpcAdminOption(&t); + + FreeParamValueList(o); + + return 0; +} + +// Get the list of Virtual HUB extended options +UINT PsExtOptionList(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) +{ + LIST *o; + PS *ps = (PS *)param; + UINT ret = 0; + RPC_ADMIN_OPTION t; + + // If virtual HUB is not selected, it's an error + if (ps->HubName == NULL) + { + c->Write(c, _UU("CMD_Hub_Not_Selected")); + return ERR_INVALID_PARAMETER; + } + + o = ParseCommandList(c, cmd_name, str, NULL, 0); + if (o == NULL) + { + return ERR_INVALID_PARAMETER; + } + + Zero(&t, sizeof(t)); + StrCpy(t.HubName, sizeof(t.HubName), ps->HubName); + + // RPC call + ret = ScGetHubExtOptions(ps->Rpc, &t); + + if (ret != ERR_NO_ERROR) + { + // An error has occured + CmdPrintError(c, ret); + FreeParamValueList(o); + return ret; + } + else + { + CT *ct = CtNewStandardEx(); + UINT i; + + for (i = 0;i < t.NumItem;i++) + { + ADMIN_OPTION *e = &t.Items[i]; + wchar_t tmp1[MAX_SIZE]; + wchar_t tmp2[MAX_SIZE]; + + StrToUni(tmp1, sizeof(tmp1), e->Name); + UniToStru(tmp2, e->Value); + + CtInsert(ct, tmp1, tmp2, GetHubAdminOptionHelpString(e->Name)); + + } + + CtFreeEx(ct, c, true); + } + + FreeRpcAdminOption(&t); + + FreeParamValueList(o); + + return 0; +} + +// Set the value of a Virtual HUB extended option +UINT PsExtOptionSet(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) +{ + LIST *o; + PS *ps = (PS *)param; + UINT ret = 0; + RPC_ADMIN_OPTION t; + // Parameter list that can be specified + PARAM args[] = + { + // "name", prompt_proc, prompt_param, eval_proc, eval_param + {"[name]", CmdPrompt, _UU("CMD_AdminOptionSet_Prompt_name"), CmdEvalNotEmpty, NULL}, + {"VALUE", CmdPrompt, _UU("CMD_AdminOptionSet_Prompt_VALUE"), CmdEvalNotEmpty, NULL}, + }; + + // If virtual HUB is not selected, it's an error + if (ps->HubName == NULL) + { + c->Write(c, _UU("CMD_Hub_Not_Selected")); + return ERR_INVALID_PARAMETER; + } + + o = ParseCommandList(c, cmd_name, str, args, sizeof(args) / sizeof(args[0])); + if (o == NULL) + { + return ERR_INVALID_PARAMETER; + } + + Zero(&t, sizeof(t)); + StrCpy(t.HubName, sizeof(t.HubName), ps->HubName); + + // RPC call + ret = ScGetHubExtOptions(ps->Rpc, &t); + + if (ret != ERR_NO_ERROR) + { + // An error has occured + CmdPrintError(c, ret); + FreeParamValueList(o); + return ret; + } + else + { + UINT i; + bool b = false; + + for (i = 0;i < t.NumItem;i++) + { + if (StrCmpi(t.Items[i].Name, GetParamStr(o, "[name]")) == 0) + { + t.Items[i].Value = GetParamInt(o, "VALUE"); + b = true; + } + } + + if (b == false) + { + // An error has occured + ret = ERR_OBJECT_NOT_FOUND; + CmdPrintError(c, ret); + FreeParamValueList(o); + FreeRpcAdminOption(&t); + return ret; + } + else + { + StrCpy(t.HubName, sizeof(t.HubName), ps->HubName); + ret = ScSetHubExtOptions(ps->Rpc, &t); + + if (ret != ERR_NO_ERROR) + { + // An error has occured + CmdPrintError(c, ret); + FreeParamValueList(o); + return ret; + } + } + } + + FreeRpcAdminOption(&t); + + FreeParamValueList(o); + + return 0; +} + +// Get the list of revoked certificate list +UINT PsCrlList(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) +{ + LIST *o; + PS *ps = (PS *)param; + UINT ret = 0; + RPC_ENUM_CRL t; + + // If virtual HUB is not selected, it's an error + if (ps->HubName == NULL) + { + c->Write(c, _UU("CMD_Hub_Not_Selected")); + return ERR_INVALID_PARAMETER; + } + + o = ParseCommandList(c, cmd_name, str, NULL, 0); + if (o == NULL) + { + return ERR_INVALID_PARAMETER; + } + + Zero(&t, sizeof(t)); + StrCpy(t.HubName, sizeof(t.HubName), ps->HubName); + + // RPC call + ret = ScEnumCrl(ps->Rpc, &t); + + if (ret != ERR_NO_ERROR) + { + // An error has occured + CmdPrintError(c, ret); + FreeParamValueList(o); + return ret; + } + else + { + UINT i; + CT *ct = CtNew(); + + CtInsertColumn(ct, _UU("CMD_ID"), false); + CtInsertColumn(ct, _UU("SM_CRL_COLUMN_1"), false); + + for (i = 0;i < t.NumItem;i++) + { + wchar_t tmp[64]; + RPC_ENUM_CRL_ITEM *e = &t.Items[i]; + + UniToStru(tmp, e->Key); + CtInsert(ct, tmp, e->CrlInfo); + } + + CtFreeEx(ct, c, true); + } + + FreeRpcEnumCrl(&t); + + FreeParamValueList(o); + + return 0; +} + +// Add a revoked certificate +UINT PsCrlAdd(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) +{ + LIST *o; + PS *ps = (PS *)param; + UINT ret = 0; + RPC_CRL t; + // Parameter list that can be specified + PARAM args[] = + { + {"SERIAL", NULL, NULL, NULL, NULL}, + {"MD5", NULL, NULL, NULL, NULL}, + {"SHA1", NULL, NULL, NULL, NULL}, + {"CN", NULL, NULL, NULL, NULL}, + {"O", NULL, NULL, NULL, NULL}, + {"OU", NULL, NULL, NULL, NULL}, + {"C", NULL, NULL, NULL, NULL}, + {"ST", NULL, NULL, NULL, NULL}, + {"L", NULL, NULL, NULL, NULL}, + }; + + // If virtual HUB is not selected, it's an error + if (ps->HubName == NULL) + { + c->Write(c, _UU("CMD_Hub_Not_Selected")); + return ERR_INVALID_PARAMETER; + } + + o = ParseCommandList(c, cmd_name, str, args, sizeof(args) / sizeof(args[0])); + if (o == NULL) + { + return ERR_INVALID_PARAMETER; + } + + Zero(&t, sizeof(t)); + StrCpy(t.HubName, sizeof(t.HubName), ps->HubName); + + { + bool param_exists = false; + CRL *crl = ZeroMalloc(sizeof(CRL)); + NAME *n; + n = crl->Name = ZeroMalloc(sizeof(NAME)); + + if (IsEmptyStr(GetParamStr(o, "CN")) == false) + { + n->CommonName = CopyUniStr(GetParamUniStr(o, "CN")); + param_exists = true; + } + + if (IsEmptyStr(GetParamStr(o, "O")) == false) + { + n->CommonName = CopyUniStr(GetParamUniStr(o, "O")); + param_exists = true; + } + + if (IsEmptyStr(GetParamStr(o, "OU")) == false) + { + n->CommonName = CopyUniStr(GetParamUniStr(o, "OU")); + param_exists = true; + } + + if (IsEmptyStr(GetParamStr(o, "C")) == false) + { + n->CommonName = CopyUniStr(GetParamUniStr(o, "C")); + param_exists = true; + } + + if (IsEmptyStr(GetParamStr(o, "ST")) == false) + { + n->CommonName = CopyUniStr(GetParamUniStr(o, "ST")); + param_exists = true; + } + + if (IsEmptyStr(GetParamStr(o, "L")) == false) + { + n->CommonName = CopyUniStr(GetParamUniStr(o, "L")); + param_exists = true; + } + + if (IsEmptyStr(GetParamStr(o, "SERIAL")) == false) + { + BUF *b; + + b = StrToBin(GetParamStr(o, "SERIAL")); + + if (b != NULL && b->Size >= 1) + { + crl->Serial = NewXSerial(b->Buf, b->Size); + param_exists = true; + } + + FreeBuf(b); + } + + if (IsEmptyStr(GetParamStr(o, "MD5")) == false) + { + BUF *b; + + b = StrToBin(GetParamStr(o, "MD5")); + + if (b != NULL && b->Size == MD5_SIZE) + { + Copy(crl->DigestMD5, b->Buf, MD5_SIZE); + param_exists = true; + } + + FreeBuf(b); + } + + if (IsEmptyStr(GetParamStr(o, "SHA1")) == false) + { + BUF *b; + + b = StrToBin(GetParamStr(o, "SHA1")); + + if (b != NULL && b->Size == SHA1_SIZE) + { + Copy(crl->DigestSHA1, b->Buf, SHA1_SIZE); + param_exists = true; + } + + FreeBuf(b); + } + + t.Crl = crl; + + if (param_exists == false) + { + FreeRpcCrl(&t); + ret = ERR_INVALID_PARAMETER; + CmdPrintError(c, ret); + FreeParamValueList(o); + return ret; + } + } + + // RPC call + ret = ScAddCrl(ps->Rpc, &t); + + if (ret != ERR_NO_ERROR) + { + // An error has occured + CmdPrintError(c, ret); + FreeParamValueList(o); + return ret; + } + + FreeRpcCrl(&t); + + FreeParamValueList(o); + + return 0; +} + +// Delete the revoked certificate +UINT PsCrlDel(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) +{ + LIST *o; + PS *ps = (PS *)param; + UINT ret = 0; + RPC_CRL t; + // Parameter list that can be specified + PARAM args[] = + { + // "name", prompt_proc, prompt_param, eval_proc, eval_param + {"[id]", CmdPrompt, _UU("CMD_CrlDel_Prompt_ID"), CmdEvalNotEmpty, NULL}, + }; + + // If virtual HUB is not selected, it's an error + if (ps->HubName == NULL) + { + c->Write(c, _UU("CMD_Hub_Not_Selected")); + return ERR_INVALID_PARAMETER; + } + + o = ParseCommandList(c, cmd_name, str, args, sizeof(args) / sizeof(args[0])); + if (o == NULL) + { + return ERR_INVALID_PARAMETER; + } + + Zero(&t, sizeof(t)); + StrCpy(t.HubName, sizeof(t.HubName), ps->HubName); + t.Key = GetParamInt(o, "[id]"); + + // RPC call + ret = ScDelCrl(ps->Rpc, &t); + + if (ret != ERR_NO_ERROR) + { + // An error has occured + CmdPrintError(c, ret); + FreeParamValueList(o); + return ret; + } + + FreeRpcCrl(&t); + + FreeParamValueList(o); + + return 0; +} + +// Get the revoked certificate +UINT PsCrlGet(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) +{ + LIST *o; + PS *ps = (PS *)param; + UINT ret = 0; + RPC_CRL t; + // Parameter list that can be specified + PARAM args[] = + { + // "name", prompt_proc, prompt_param, eval_proc, eval_param + {"[id]", CmdPrompt, _UU("CMD_CrlGet_Prompt_ID"), CmdEvalNotEmpty, NULL}, + }; + + // If virtual HUB is not selected, it's an error + if (ps->HubName == NULL) + { + c->Write(c, _UU("CMD_Hub_Not_Selected")); + return ERR_INVALID_PARAMETER; + } + + o = ParseCommandList(c, cmd_name, str, args, sizeof(args) / sizeof(args[0])); + if (o == NULL) + { + return ERR_INVALID_PARAMETER; + } + + Zero(&t, sizeof(t)); + StrCpy(t.HubName, sizeof(t.HubName), ps->HubName); + t.Key = GetParamInt(o, "[id]"); + + // RPC call + ret = ScGetCrl(ps->Rpc, &t); + + if (ret != ERR_NO_ERROR) + { + // An error has occured + CmdPrintError(c, ret); + FreeParamValueList(o); + return ret; + } + else + { + // Show contents + CT *ct = CtNewStandard(); + CRL *crl = t.Crl; + NAME *n; + + if (crl != NULL) + { + n = crl->Name; + + if (n != NULL) + { + if (UniIsEmptyStr(n->CommonName) == false) + { + CtInsert(ct, _UU("CMD_CrlGet_CN"), n->CommonName); + } + if (UniIsEmptyStr(n->Organization) == false) + { + CtInsert(ct, _UU("CMD_CrlGet_O"), n->Organization); + } + if (UniIsEmptyStr(n->Unit) == false) + { + CtInsert(ct, _UU("CMD_CrlGet_OU"), n->Unit); + } + if (UniIsEmptyStr(n->Country) == false) + { + CtInsert(ct, _UU("CMD_CrlGet_C"), n->Country); + } + if (UniIsEmptyStr(n->State) == false) + { + CtInsert(ct, _UU("CMD_CrlGet_ST"), n->State); + } + if (UniIsEmptyStr(n->Local) == false) + { + CtInsert(ct, _UU("CMD_CrlGet_L"), n->Local); + } + } + + if (crl->Serial != NULL && crl->Serial->size >= 1) + { + wchar_t tmp[MAX_SIZE]; + char str[MAX_SIZE]; + + BinToStrEx(str, sizeof(str), crl->Serial->data, crl->Serial->size); + StrToUni(tmp, sizeof(tmp), str); + + CtInsert(ct, _UU("CMD_CrlGet_SERI"), tmp); + } + + if (IsZero(crl->DigestMD5, MD5_SIZE) == false) + { + wchar_t tmp[MAX_SIZE]; + char str[MAX_SIZE]; + + BinToStrEx(str, sizeof(str), crl->DigestMD5, MD5_SIZE); + StrToUni(tmp, sizeof(tmp), str); + + CtInsert(ct, _UU("CMD_CrlGet_MD5_HASH"), tmp); + } + + if (IsZero(crl->DigestSHA1, SHA1_SIZE) == false) + { + wchar_t tmp[MAX_SIZE]; + char str[MAX_SIZE]; + + BinToStrEx(str, sizeof(str), crl->DigestSHA1, SHA1_SIZE); + StrToUni(tmp, sizeof(tmp), str); + + CtInsert(ct, _UU("CMD_CrlGet_SHA1_HASH"), tmp); + } + } + CtFree(ct, c); + } + + FreeRpcCrl(&t); + + FreeParamValueList(o); + + return 0; +} + +// Get the rules of IP access control list +UINT PsAcList(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) +{ + LIST *o; + PS *ps = (PS *)param; + UINT ret = 0; + RPC_AC_LIST t; + + // If virtual HUB is not selected, it's an error + if (ps->HubName == NULL) + { + c->Write(c, _UU("CMD_Hub_Not_Selected")); + return ERR_INVALID_PARAMETER; + } + + o = ParseCommandList(c, cmd_name, str, NULL, 0); + if (o == NULL) + { + return ERR_INVALID_PARAMETER; + } + + Zero(&t, sizeof(t)); + StrCpy(t.HubName, sizeof(t.HubName), ps->HubName); + + // RPC call + ret = ScGetAcList(ps->Rpc, &t); + + if (ret != ERR_NO_ERROR) + { + // An error has occured + CmdPrintError(c, ret); + FreeParamValueList(o); + return ret; + } + else + { + UINT i; + CT *ct; + + ct = CtNew(); + CtInsertColumn(ct, _UU("SM_AC_COLUMN_1"), true); + CtInsertColumn(ct, _UU("SM_AC_COLUMN_2"), true); + CtInsertColumn(ct, _UU("SM_AC_COLUMN_3"), false); + CtInsertColumn(ct, _UU("SM_AC_COLUMN_4"), false); + + for (i = 0;i < LIST_NUM(t.o);i++) + { + wchar_t tmp1[32], *tmp2, tmp3[MAX_SIZE], tmp4[32]; + char *tmp_str; + AC *ac = LIST_DATA(t.o, i); + + UniToStru(tmp1, ac->Id); + tmp2 = ac->Deny ? _UU("SM_AC_DENY") : _UU("SM_AC_PASS"); + tmp_str = GenerateAcStr(ac); + StrToUni(tmp3, sizeof(tmp3), tmp_str); + + Free(tmp_str); + + UniToStru(tmp4, ac->Priority); + + CtInsert(ct, tmp1, tmp4, tmp2, tmp3); + } + + CtFree(ct, c); + } + + FreeRpcAcList(&t); + + FreeParamValueList(o); + + return 0; +} + +// Add a rule to the IP access control list (IPv4) +UINT PsAcAdd(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) +{ + LIST *o; + PS *ps = (PS *)param; + UINT ret = 0; + RPC_AC_LIST t; + // Parameter list that can be specified + CMD_EVAL_MIN_MAX mm = + { + "CMD_AcAdd_Eval_PRIORITY", 1, 4294967295UL, + }; + PARAM args[] = + { + // "name", prompt_proc, prompt_param, eval_proc, eval_param + {"[allow|deny]", CmdPrompt, _UU("CMD_AcAdd_Prompt_AD"), CmdEvalNotEmpty, NULL}, + {"PRIORITY", CmdPrompt, _UU("CMD_AcAdd_Prompt_PRIORITY"), CmdEvalMinMax, &mm}, + {"IP", CmdPrompt, _UU("CMD_AcAdd_Prompt_IP"), CmdEvalIpAndMask4, NULL}, + }; + + // If virtual HUB is not selected, it's an error + if (ps->HubName == NULL) + { + c->Write(c, _UU("CMD_Hub_Not_Selected")); + return ERR_INVALID_PARAMETER; + } + + o = ParseCommandList(c, cmd_name, str, args, sizeof(args) / sizeof(args[0])); + if (o == NULL) + { + return ERR_INVALID_PARAMETER; + } + + Zero(&t, sizeof(t)); + StrCpy(t.HubName, sizeof(t.HubName), ps->HubName); + + // RPC call + ret = ScGetAcList(ps->Rpc, &t); + + if (ret != ERR_NO_ERROR) + { + // An error has occured + CmdPrintError(c, ret); + FreeParamValueList(o); + return ret; + } + else + { + // Add a new item to the list + AC *ac = ZeroMalloc(sizeof(AC)); + char *test = GetParamStr(o, "[allow|deny]"); + UINT u_ip, u_mask; + + if (StartWith("deny", test)) + { + ac->Deny = true; + } + + ParseIpAndMask4(GetParamStr(o, "IP"), &u_ip, &u_mask); + UINTToIP(&ac->IpAddress, u_ip); + + if (u_mask == 0xffffffff) + { + ac->Masked = false; + } + else + { + ac->Masked = true; + UINTToIP(&ac->SubnetMask, u_mask); + } + + ac->Priority = GetParamInt(o, "PRIORITY"); + + Insert(t.o, ac); + + ret = ScSetAcList(ps->Rpc, &t); + if (ret != ERR_NO_ERROR) + { + // An error has occured + CmdPrintError(c, ret); + FreeParamValueList(o); + return ret; + } + } + + FreeRpcAcList(&t); + + FreeParamValueList(o); + + return 0; +} + +// Add a rule to the IP access control list (IPv6) +UINT PsAcAdd6(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) +{ + LIST *o; + PS *ps = (PS *)param; + UINT ret = 0; + RPC_AC_LIST t; + // Parameter list that can be specified + CMD_EVAL_MIN_MAX mm = + { + "CMD_AcAdd6_Eval_PRIORITY", 1, 4294967295UL, + }; + PARAM args[] = + { + // "name", prompt_proc, prompt_param, eval_proc, eval_param + {"[allow|deny]", CmdPrompt, _UU("CMD_AcAdd6_Prompt_AD"), CmdEvalNotEmpty, NULL}, + {"PRIORITY", CmdPrompt, _UU("CMD_AcAdd6_Prompt_PRIORITY"), CmdEvalMinMax, &mm}, + {"IP", CmdPrompt, _UU("CMD_AcAdd6_Prompt_IP"), CmdEvalIpAndMask6, NULL}, + }; + + // If virtual HUB is not selected, it's an error + if (ps->HubName == NULL) + { + c->Write(c, _UU("CMD_Hub_Not_Selected")); + return ERR_INVALID_PARAMETER; + } + + o = ParseCommandList(c, cmd_name, str, args, sizeof(args) / sizeof(args[0])); + if (o == NULL) + { + return ERR_INVALID_PARAMETER; + } + + Zero(&t, sizeof(t)); + StrCpy(t.HubName, sizeof(t.HubName), ps->HubName); + + // RPC call + ret = ScGetAcList(ps->Rpc, &t); + + if (ret != ERR_NO_ERROR) + { + // An error has occured + CmdPrintError(c, ret); + FreeParamValueList(o); + return ret; + } + else + { + // Add a new item to the list + AC *ac = ZeroMalloc(sizeof(AC)); + char *test = GetParamStr(o, "[allow|deny]"); + IP u_ip, u_mask; + + if (StartWith("deny", test)) + { + ac->Deny = true; + } + + ParseIpAndMask6(GetParamStr(o, "IP"), &u_ip, &u_mask); + Copy(&ac->IpAddress, &u_ip, sizeof(IP)); + + if (SubnetMaskToInt6(&u_mask) == 128) + { + ac->Masked = false; + } + else + { + ac->Masked = true; + Copy(&ac->SubnetMask, &u_mask, sizeof(IP)); + } + + ac->Priority = GetParamInt(o, "PRIORITY"); + + Insert(t.o, ac); + + ret = ScSetAcList(ps->Rpc, &t); + if (ret != ERR_NO_ERROR) + { + // An error has occured + CmdPrintError(c, ret); + FreeParamValueList(o); + return ret; + } + } + + FreeRpcAcList(&t); + + FreeParamValueList(o); + + return 0; +} + +// Run the debug command +UINT PsDebug(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) +{ + LIST *o; + PS *ps = (PS *)param; + UINT id; + // Parameter list that can be specified + PARAM args[] = + { + // "name", prompt_proc, prompt_param, eval_proc, eval_param + {"[id]", NULL, NULL, NULL, NULL}, + {"ARG", NULL, NULL, NULL, NULL}, + }; + + o = ParseCommandList(c, cmd_name, str, args, sizeof(args) / sizeof(args[0])); + if (o == NULL) + { + return ERR_INVALID_PARAMETER; + } + + id = GetParamInt(o, "[id]"); + + if (true) + { + RPC_TEST t; + UINT ret; + + c->Write(c, _UU("CMD_Debug_Msg1")); + + Zero(&t, sizeof(t)); + + t.IntValue = id; + StrCpy(t.StrValue, sizeof(t.StrValue), GetParamStr(o, "ARG")); + + ret = ScDebug(ps->Rpc, &t); + + if (ret != ERR_NO_ERROR) + { + // An error has occured + CmdPrintError(c, ret); + FreeParamValueList(o); + return ret; + } + else + { + wchar_t tmp[sizeof(t.StrValue)]; + + UniFormat(tmp, sizeof(tmp), _UU("CMD_Debug_Msg2"), t.StrValue); + c->Write(c, tmp); + } + } + + FreeParamValueList(o); + + return 0; +} + +// Flush the configuration file on the server +UINT PsFlush(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) +{ + LIST *o; + PS *ps = (PS *)param; + + o = ParseCommandList(c, cmd_name, str, NULL, 0); + if (o == NULL) + { + return ERR_INVALID_PARAMETER; + } + + if (true) + { + RPC_TEST t; + UINT ret; + wchar_t tmp[MAX_SIZE]; + char sizestr[MAX_SIZE]; + + c->Write(c, _UU("CMD_Flush_Msg1")); + + Zero(&t, sizeof(t)); + + ret = ScFlush(ps->Rpc, &t); + + if (ret != ERR_NO_ERROR) + { + // An error has occured + CmdPrintError(c, ret); + FreeParamValueList(o); + return ret; + } + + ToStr3(sizestr, sizeof(sizestr), (UINT64)t.IntValue); + UniFormat(tmp, sizeof(tmp), _UU("CMD_Flush_Msg2"), sizestr); + c->Write(c, tmp); + } + + FreeParamValueList(o); + + return 0; +} + +// Crash +UINT PsCrash(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) +{ + LIST *o; + PS *ps = (PS *)param; + char *yes; + // Parameter list that can be specified + PARAM args[] = + { + // "name", prompt_proc, prompt_param, eval_proc, eval_param + {"[yes]", CmdPrompt, _UU("CMD_Crash_Confirm"), NULL, NULL}, + }; + + o = ParseCommandList(c, cmd_name, str, args, sizeof(args) / sizeof(args[0])); + if (o == NULL) + { + return ERR_INVALID_PARAMETER; + } + + yes = GetParamStr(o, "[yes]"); + + if (StrCmpi(yes, "yes") != 0) + { + c->Write(c, _UU("CMD_Crash_Aborted")); + } + else + { + RPC_TEST t; + UINT ret; + + c->Write(c, _UU("CMD_Crash_Msg")); + + Zero(&t, sizeof(t)); + + ret = ScCrash(ps->Rpc, &t); + + if (ret != ERR_NO_ERROR) + { + // An error has occured + CmdPrintError(c, ret); + FreeParamValueList(o); + return ret; + } + } + + FreeParamValueList(o); + + return 0; +} + +// Remove a rule in the IP access control list +UINT PsAcDel(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) +{ + LIST *o; + PS *ps = (PS *)param; + UINT ret = 0; + RPC_AC_LIST t; + // Parameter list that can be specified + PARAM args[] = + { + // "name", prompt_proc, prompt_param, eval_proc, eval_param + {"[id]", CmdPrompt, _UU("CMD_AcDel_Prompt_ID"), CmdEvalNotEmpty, NULL}, + }; + + // If virtual HUB is not selected, it's an error + if (ps->HubName == NULL) + { + c->Write(c, _UU("CMD_Hub_Not_Selected")); + return ERR_INVALID_PARAMETER; + } + + o = ParseCommandList(c, cmd_name, str, args, sizeof(args) / sizeof(args[0])); + if (o == NULL) + { + return ERR_INVALID_PARAMETER; + } + + Zero(&t, sizeof(t)); + StrCpy(t.HubName, sizeof(t.HubName), ps->HubName); + + // RPC call + ret = ScGetAcList(ps->Rpc, &t); + + if (ret != ERR_NO_ERROR) + { + // An error has occured + CmdPrintError(c, ret); + FreeParamValueList(o); + return ret; + } + else + { + // Remove matched ID + UINT i; + bool b = false; + + for (i = 0;i < LIST_NUM(t.o);i++) + { + AC *ac = LIST_DATA(t.o, i); + + if (ac->Id == GetParamInt(o, "[id]")) + { + Delete(t.o, ac); + Free(ac); + b = true; + break; + } + } + + if (b == false) + { + ret = ERR_OBJECT_NOT_FOUND; + FreeRpcAcList(&t); + } + else + { + ret = ScSetAcList(ps->Rpc, &t); + } + if (ret != ERR_NO_ERROR) + { + // An error has occured + CmdPrintError(c, ret); + FreeParamValueList(o); + return ret; + } + } + + FreeRpcAcList(&t); + FreeParamValueList(o); + + return 0; +} + +// Enable / Disable the IPsec VPN server function +UINT PsIPsecEnable(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) +{ + LIST *o; + PS *ps = (PS *)param; + UINT ret = 0; + IPSEC_SERVICES t; + // Parameter list that can be specified + PARAM args[] = + { + // "name", prompt_proc, prompt_param, eval_proc, eval_param + {"L2TP", CmdPrompt, _UU("CMD_IPsecEnable_Prompt_L2TP"), CmdEvalNotEmpty, NULL}, + {"L2TPRAW", CmdPrompt, _UU("CMD_IPsecEnable_Prompt_L2TPRAW"), CmdEvalNotEmpty, NULL}, + {"ETHERIP", CmdPrompt, _UU("CMD_IPsecEnable_Prompt_ETHERIP"), CmdEvalNotEmpty, NULL}, + {"PSK", CmdPrompt, _UU("CMD_IPsecEnable_Prompt_PSK"), CmdEvalNotEmpty, NULL}, + {"DEFAULTHUB", CmdPrompt, _UU("CMD_IPsecEnable_Prompt_DEFAULTHUB"), CmdEvalNotEmpty, NULL}, + }; + + o = ParseCommandList(c, cmd_name, str, args, sizeof(args) / sizeof(args[0])); + if (o == NULL) + { + return ERR_INVALID_PARAMETER; + } + + Zero(&t, sizeof(t)); + t.L2TP_IPsec = GetParamYes(o, "L2TP"); + t.L2TP_Raw = GetParamYes(o, "L2TPRAW"); + t.EtherIP_IPsec = GetParamYes(o, "ETHERIP"); + StrCpy(t.IPsec_Secret, sizeof(t.IPsec_Secret), GetParamStr(o, "PSK")); + StrCpy(t.L2TP_DefaultHub, sizeof(t.L2TP_DefaultHub), GetParamStr(o, "DEFAULTHUB")); + + // RPC call + ret = ScSetIPsecServices(ps->Rpc, &t); + + if (ret != ERR_NO_ERROR) + { + // An error has occured + CmdPrintError(c, ret); + FreeParamValueList(o); + return ret; + } + + FreeParamValueList(o); + + return 0; +} + +// Get the current configuration of IPsec VPN server function +UINT PsIPsecGet(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) +{ + LIST *o; + PS *ps = (PS *)param; + UINT ret = 0; + IPSEC_SERVICES t; + + o = ParseCommandList(c, cmd_name, str, NULL, 0); + if (o == NULL) + { + return ERR_INVALID_PARAMETER; + } + + Zero(&t, sizeof(t)); + + // RPC call + ret = ScGetIPsecServices(ps->Rpc, &t); + + if (ret != ERR_NO_ERROR) + { + // An error has occured + CmdPrintError(c, ret); + FreeParamValueList(o); + return ret; + } + else + { + wchar_t tmp[MAX_PATH]; + CT *ct = CtNewStandard(); + + CtInsert(ct, _UU("CMD_IPsecGet_PRINT_L2TP"), _UU(t.L2TP_IPsec ? "SEC_YES" : "SEC_NO")); + CtInsert(ct, _UU("CMD_IPsecGet_PRINT_L2TPRAW"), _UU(t.L2TP_Raw ? "SEC_YES" : "SEC_NO")); + CtInsert(ct, _UU("CMD_IPsecGet_PRINT_ETHERIP"), _UU(t.EtherIP_IPsec ? "SEC_YES" : "SEC_NO")); + + StrToUni(tmp, sizeof(tmp), t.IPsec_Secret); + CtInsert(ct, _UU("CMD_IPsecGet_PRINT_PSK"), tmp); + + StrToUni(tmp, sizeof(tmp), t.L2TP_DefaultHub); + CtInsert(ct, _UU("CMD_IPsecGet_PRINT_DEFAULTHUB"), tmp); + + CtFree(ct, c); + } + + FreeParamValueList(o); + + return 0; +} + +// Add connection settings for accepting connections from client devices of EtherIP / L2TPv3 over IPsec server function +UINT PsEtherIpClientAdd(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) +{ + LIST *o; + PS *ps = (PS *)param; + UINT ret = 0; + ETHERIP_ID t; + // Parameter list that can be specified + PARAM args[] = + { + // "name", prompt_proc, prompt_param, eval_proc, eval_param + {"[ID]", CmdPrompt, _UU("CMD_EtherIpClientAdd_Prompt_ID"), CmdEvalNotEmpty, NULL}, + {"HUB", CmdPrompt, _UU("CMD_EtherIpClientAdd_Prompt_HUB"), CmdEvalNotEmpty, NULL}, + {"USERNAME", CmdPrompt, _UU("CMD_EtherIpClientAdd_Prompt_USERNAME"), CmdEvalNotEmpty, NULL}, + {"PASSWORD", CmdPrompt, _UU("CMD_EtherIpClientAdd_Prompt_PASSWORD"), CmdEvalNotEmpty, NULL}, + }; + + o = ParseCommandList(c, cmd_name, str, args, sizeof(args) / sizeof(args[0])); + if (o == NULL) + { + return ERR_INVALID_PARAMETER; + } + + Zero(&t, sizeof(t)); + StrCpy(t.Id, sizeof(t.Id), GetParamStr(o, "[ID]")); + StrCpy(t.HubName, sizeof(t.HubName), GetParamStr(o, "HUB")); + StrCpy(t.UserName, sizeof(t.UserName), GetParamStr(o, "USERNAME")); + StrCpy(t.Password, sizeof(t.Password), GetParamStr(o, "PASSWORD")); + + // RPC call + ret = ScAddEtherIpId(ps->Rpc, &t); + + if (ret != ERR_NO_ERROR) + { + // An error has occured + CmdPrintError(c, ret); + FreeParamValueList(o); + return ret; + } + + FreeParamValueList(o); + + return 0; +} + +// Delete the connection settings for accepting connections from client devices of EtherIP / L2TPv3 over IPsec server function +UINT PsEtherIpClientDelete(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) +{ + LIST *o; + PS *ps = (PS *)param; + UINT ret = 0; + ETHERIP_ID t; + // Parameter list that can be specified + PARAM args[] = + { + // "name", prompt_proc, prompt_param, eval_proc, eval_param + {"[ID]", CmdPrompt, _UU("CMD_EtherIpClientDelete_Prompt_ID"), CmdEvalNotEmpty, NULL}, + }; + + o = ParseCommandList(c, cmd_name, str, args, sizeof(args) / sizeof(args[0])); + if (o == NULL) + { + return ERR_INVALID_PARAMETER; + } + + Zero(&t, sizeof(t)); + StrCpy(t.Id, sizeof(t.Id), GetParamStr(o, "[ID]")); + + // RPC call + ret = ScDeleteEtherIpId(ps->Rpc, &t); + + if (ret != ERR_NO_ERROR) + { + // An error has occured + CmdPrintError(c, ret); + FreeParamValueList(o); + return ret; + } + + FreeParamValueList(o); + + return 0; +} + +// Show the list of connection settings for accepting connections from client devices of EtherIP / L2TPv3 over IPsec server function +UINT PsEtherIpClientList(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) +{ + LIST *o; + PS *ps = (PS *)param; + UINT ret = 0; + RPC_ENUM_ETHERIP_ID t; + UINT i; + CT *b; + + o = ParseCommandList(c, cmd_name, str, NULL, 0); + if (o == NULL) + { + return ERR_INVALID_PARAMETER; + } + + Zero(&t, sizeof(t)); + + // RPC call + ret = ScEnumEtherIpId(ps->Rpc, &t); + + if (ret != ERR_NO_ERROR) + { + // An error has occured + CmdPrintError(c, ret); + FreeParamValueList(o); + return ret; + } + else + { + b = CtNew(); + + CtInsertColumn(b, _UU("SM_ETHERIP_COLUMN_0"), false); + CtInsertColumn(b, _UU("SM_ETHERIP_COLUMN_1"), false); + CtInsertColumn(b, _UU("SM_ETHERIP_COLUMN_2"), false); + + for (i = 0;i < t.NumItem;i++) + { + ETHERIP_ID *d = &t.IdList[i]; + wchar_t id[MAX_SIZE], hubname[MAX_SIZE], username[MAX_SIZE]; + + StrToUni(id, sizeof(id), d->Id); + StrToUni(hubname, sizeof(hubname), d->HubName); + StrToUni(username, sizeof(username), d->UserName); + + CtInsert(b, id, hubname, username); + } + + CtFree(b, c); + + FreeRpcEnumEtherIpId(&t); + } + + FreeParamValueList(o); + + return 0; +} + +// Generate a OpenVPN sample configuration file that can connect to the OpenVPN compatible server function +UINT PsOpenVpnMakeConfig(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) +{ + LIST *o; + PS *ps = (PS *)param; + UINT ret = 0; + RPC_READ_LOG_FILE t; + // Parameter list that can be specified + PARAM args[] = + { + // "name", prompt_proc, prompt_param, eval_proc, eval_param + {"[ZIP_FileName]", CmdPrompt, _UU("CMD_OpenVpnMakeConfig_Prompt_ZIP"), CmdEvalNotEmpty, NULL}, + }; + + o = ParseCommandList(c, cmd_name, str, args, sizeof(args) / sizeof(args[0])); + if (o == NULL) + { + return ERR_INVALID_PARAMETER; + } + + Zero(&t, sizeof(t)); + + // RPC call + ret = ScMakeOpenVpnConfigFile(ps->Rpc, &t); + + if (ret != ERR_NO_ERROR) + { + // An error has occured + CmdPrintError(c, ret); + FreeParamValueList(o); + return ret; + } + else + { + // Determine the file name to save + wchar_t filename[MAX_SIZE]; + wchar_t tmp[MAX_SIZE]; + + UniStrCpy(filename, sizeof(filename), GetParamUniStr(o, "[ZIP_FileName]")); + + if (UniEndWith(filename, L".zip") == false) + { + UniStrCat(filename, sizeof(filename), L".zip"); + } + + if (DumpBufW(t.Buffer, filename) == false) + { + ret = ERR_INTERNAL_ERROR; + + UniFormat(tmp, sizeof(tmp), _UU("CMD_OpenVpnMakeConfig_ERROR"), filename); + } + else + { + UniFormat(tmp, sizeof(tmp), _UU("CMD_OpenVpnMakeConfig_OK"), filename); + } + + c->Write(c, tmp); + + FreeRpcReadLogFile(&t); + } + + FreeParamValueList(o); + + return ret; +} + +// Register to the VPN Server by creating a new self-signed certificate with the specified CN (Common Name) +UINT PsServerCertRegenerate(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) +{ + LIST *o; + PS *ps = (PS *)param; + UINT ret = 0; + RPC_TEST t; + // Parameter list that can be specified + PARAM args[] = + { + // "name", prompt_proc, prompt_param, eval_proc, eval_param + {"[CN]", CmdPrompt, _UU("CMD_ServerCertRegenerate_Prompt_CN"), CmdEvalNotEmpty, NULL}, + }; + + o = ParseCommandList(c, cmd_name, str, args, sizeof(args) / sizeof(args[0])); + if (o == NULL) + { + return ERR_INVALID_PARAMETER; + } + + Zero(&t, sizeof(t)); + StrCpy(t.StrValue, sizeof(t.StrValue), GetParamStr(o, "[CN]")); + + // RPC call + ret = ScRegenerateServerCert(ps->Rpc, &t); + + if (ret != ERR_NO_ERROR) + { + // An error has occured + CmdPrintError(c, ret); + FreeParamValueList(o); + return ret; + } + + c->Write(c, L""); + c->Write(c, _UU("CM_CERT_SET_MSG")); + c->Write(c, L""); + + FreeParamValueList(o); + + return 0; +} + +// Enable / disable the VPN over ICMP / VPN over DNS server function +UINT PsVpnOverIcmpDnsEnable(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) +{ + LIST *o; + PS *ps = (PS *)param; + UINT ret = 0; + RPC_SPECIAL_LISTENER t; + // Parameter list that can be specified + PARAM args[] = + { + // "name", prompt_proc, prompt_param, eval_proc, eval_param + {"ICMP", CmdPrompt, _UU("CMD_VpnOverIcmpDnsEnable_Prompt_ICMP"), CmdEvalNotEmpty, NULL}, + {"DNS", CmdPrompt, _UU("CMD_VpnOverIcmpDnsEnable_Prompt_DNS"), CmdEvalNotEmpty, NULL}, + }; + + o = ParseCommandList(c, cmd_name, str, args, sizeof(args) / sizeof(args[0])); + if (o == NULL) + { + return ERR_INVALID_PARAMETER; + } + + Zero(&t, sizeof(t)); + t.VpnOverIcmpListener = GetParamYes(o, "ICMP"); + t.VpnOverDnsListener = GetParamYes(o, "DNS"); + + // RPC call + ret = ScSetSpecialListener(ps->Rpc, &t); + + if (ret != ERR_NO_ERROR) + { + // An error has occured + CmdPrintError(c, ret); + FreeParamValueList(o); + return ret; + } + + FreeParamValueList(o); + + return 0; +} + +// Get current settings of VPN over ICMP / VPN over DNS server function +UINT PsVpnOverIcmpDnsGet(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) +{ + LIST *o; + PS *ps = (PS *)param; + UINT ret = 0; + RPC_SPECIAL_LISTENER t; + + o = ParseCommandList(c, cmd_name, str, NULL, 0); + if (o == NULL) + { + return ERR_INVALID_PARAMETER; + } + + Zero(&t, sizeof(t)); + + // RPC call + ret = ScGetSpecialListener(ps->Rpc, &t); + + if (ret != ERR_NO_ERROR) + { + // An error has occured + CmdPrintError(c, ret); + FreeParamValueList(o); + return ret; + } + else + { + CT *ct = CtNewStandard(); + + CtInsert(ct, _UU("CMD_VpnOverIcmpDnsGet_PRINT_ICMP"), _UU(t.VpnOverIcmpListener ? "SEC_YES" : "SEC_NO")); + CtInsert(ct, _UU("CMD_VpnOverIcmpDnsGet_PRINT_DNS"), _UU(t.VpnOverDnsListener ? "SEC_YES" : "SEC_NO")); + + CtFree(ct, c); + } + + FreeParamValueList(o); + + return 0; +} + +// Enable / disable the VPN Azure function +UINT PsVpnAzureSetEnable(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) +{ + LIST *o; + PS *ps = (PS *)param; + UINT ret = 0; + RPC_AZURE_STATUS t; + // Parameter list that can be specified + PARAM args[] = + { + // "name", prompt_proc, prompt_param, eval_proc, eval_param + {"[yes|no]", CmdPrompt, _UU("VpnAzureSetEnable_PROMPT"), CmdEvalNotEmpty, NULL}, + }; + + o = ParseCommandList(c, cmd_name, str, args, sizeof(args) / sizeof(args[0])); + if (o == NULL) + { + return ERR_INVALID_PARAMETER; + } + + Zero(&t, sizeof(t)); + t.IsEnabled = GetParamYes(o, "[yes|no]"); + + // RPC call + ret = ScSetAzureStatus(ps->Rpc, &t); + + if (ret != ERR_NO_ERROR) + { + // An error has occured + CmdPrintError(c, ret); + FreeParamValueList(o); + return ret; + } + + FreeParamValueList(o); + + return 0; +} + +// Get the current state of the VPN Azure function +UINT PsVpnAzureGetStatus(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) +{ + LIST *o; + PS *ps = (PS *)param; + UINT ret = 0; + RPC_AZURE_STATUS t; + DDNS_CLIENT_STATUS t2; + + o = ParseCommandList(c, cmd_name, str, NULL, 0); + if (o == NULL) + { + return ERR_INVALID_PARAMETER; + } + + Zero(&t, sizeof(t)); + Zero(&t2, sizeof(t2)); + + // RPC call + ret = ScGetAzureStatus(ps->Rpc, &t); + + if (ret == ERR_NO_ERROR) + { + ret = ScGetDDnsClientStatus(ps->Rpc, &t2); + } + + if (ret != ERR_NO_ERROR) + { + // An error has occured + CmdPrintError(c, ret); + FreeParamValueList(o); + return ret; + } + else + { + CT *ct = CtNewStandard(); + + CtInsert(ct, _UU("CMD_VpnAzureGetStatus_PRINT_ENABLED"), _UU(t.IsEnabled ? "SEC_YES" : "SEC_NO")); + + if (t.IsEnabled) + { + wchar_t tmp[MAX_SIZE]; + + UniFormat(tmp, sizeof(tmp), L"%S%S", t2.CurrentHostName, AZURE_DOMAIN_SUFFIX); + + CtInsert(ct, _UU("CMD_VpnAzureGetStatus_PRINT_CONNECTED"), _UU(t.IsConnected ? "SEC_YES" : "SEC_NO")); + CtInsert(ct, _UU("CMD_VpnAzureGetStatus_PRINT_HOSTNAME"), tmp); + } + + CtFree(ct, c); + } + + FreeParamValueList(o); + + return 0; +} + +// Get the current state of the dynamic DNS function +UINT PsDynamicDnsGetStatus(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) +{ + LIST *o; + PS *ps = (PS *)param; + UINT ret = 0; + DDNS_CLIENT_STATUS t; + + o = ParseCommandList(c, cmd_name, str, NULL, 0); + if (o == NULL) + { + return ERR_INVALID_PARAMETER; + } + + Zero(&t, sizeof(t)); + + // RPC call + ret = ScGetDDnsClientStatus(ps->Rpc, &t); + + if (ret != ERR_NO_ERROR) + { + // An error has occured + CmdPrintError(c, ret); + FreeParamValueList(o); + return ret; + } + else + { + CT *ct = CtNewStandard(); + wchar_t tmp[MAX_SIZE]; + + // FQDN + if (IsEmptyStr(t.CurrentFqdn) == false) + { + StrToUni(tmp, sizeof(tmp), t.CurrentFqdn); + } + else + { + UniStrCpy(tmp, sizeof(tmp), _UU("SM_DDNS_FQDN_EMPTY")); + } + CtInsert(ct, _UU("CMD_DynamicDnsGetStatus_PRINT_FQDN"), tmp); + + // Hostname + if (IsEmptyStr(t.CurrentHostName) == false) + { + StrToUni(tmp, sizeof(tmp), t.CurrentHostName); + } + else + { + UniStrCpy(tmp, sizeof(tmp), _UU("SM_DDNS_FQDN_EMPTY")); + } + CtInsert(ct, _UU("CMD_DynamicDnsGetStatus_PRINT_HOSTNAME"), tmp); + + // Suffix + if (IsEmptyStr(t.DnsSuffix) == false) + { + StrToUni(tmp, sizeof(tmp), t.DnsSuffix); + } + else + { + UniStrCpy(tmp, sizeof(tmp), _UU("SM_DDNS_FQDN_EMPTY")); + } + CtInsert(ct, _UU("CMD_DynamicDnsGetStatus_PRINT_SUFFIX"), tmp); + + // IPv4 + if (t.Err_IPv4 == ERR_NO_ERROR) + { + StrToUni(tmp, sizeof(tmp), t.CurrentIPv4); + } + else + { + UniStrCpy(tmp, sizeof(tmp), _E(t.Err_IPv4)); + } + CtInsert(ct, _UU("CMD_DynamicDnsGetStatus_PRINT_IPv4"), tmp); + + // IPv6 + if (t.Err_IPv6 == ERR_NO_ERROR) + { + StrToUni(tmp, sizeof(tmp), t.CurrentIPv6); + } + else + { + UniStrCpy(tmp, sizeof(tmp), _E(t.Err_IPv6)); + } + CtInsert(ct, _UU("CMD_DynamicDnsGetStatus_PRINT_IPv6"), tmp); + + CtFree(ct, c); + } + + FreeParamValueList(o); + + return 0; +} + +// Configure the dynamic DNS host name +UINT PsDynamicDnsSetHostname(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) +{ + LIST *o; + PS *ps = (PS *)param; + UINT ret = 0; + RPC_TEST t; + // Parameter list that can be specified + PARAM args[] = + { + // "name", prompt_proc, prompt_param, eval_proc, eval_param + {"[hostname]", CmdPrompt, _UU("CMD_DynamicDnsSetHostname_Prompt_hostname"), CmdEvalNotEmpty, NULL}, + }; + + o = ParseCommandList(c, cmd_name, str, args, sizeof(args) / sizeof(args[0])); + if (o == NULL) + { + return ERR_INVALID_PARAMETER; + } + + Zero(&t, sizeof(t)); + StrCpy(t.StrValue, sizeof(t.StrValue), GetParamStr(o, "[hostname]")); + + // RPC call + ret = ScChangeDDnsClientHostname(ps->Rpc, &t); + + if (ret != ERR_NO_ERROR) + { + // An error has occured + CmdPrintError(c, ret); + FreeParamValueList(o); + return ret; + } + + FreeParamValueList(o); + + return 0; +} + +// Register a new license key +UINT PsLicenseAdd(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) +{ + LIST *o; + PS *ps = (PS *)param; + UINT ret = 0; + RPC_TEST t; + // Parameter list that can be specified + PARAM args[] = + { + // "name", prompt_proc, prompt_param, eval_proc, eval_param + {"[key]", CmdPrompt, _UU("CMD_LicenseAdd_Prompt_Key"), CmdEvalNotEmpty, NULL}, + }; + + o = ParseCommandList(c, cmd_name, str, args, sizeof(args) / sizeof(args[0])); + if (o == NULL) + { + return ERR_INVALID_PARAMETER; + } + + Zero(&t, sizeof(t)); + StrCpy(t.StrValue, sizeof(t.StrValue), GetParamStr(o, "[key]")); + + // RPC call + ret = ScAddLicenseKey(ps->Rpc, &t); + + if (ret != ERR_NO_ERROR) + { + // An error has occured + CmdPrintError(c, ret); + FreeParamValueList(o); + return ret; + } + + FreeParamValueList(o); + + return 0; +} + +// Delete the registered license +UINT PsLicenseDel(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) +{ + LIST *o; + PS *ps = (PS *)param; + UINT ret = 0; + RPC_TEST t; + // Parameter list that can be specified + PARAM args[] = + { + // "name", prompt_proc, prompt_param, eval_proc, eval_param + {"[id]", CmdPrompt, _UU("CMD_LicenseDel_Prompt_ID"), CmdEvalNotEmpty, NULL}, + }; + + o = ParseCommandList(c, cmd_name, str, args, sizeof(args) / sizeof(args[0])); + if (o == NULL) + { + return ERR_INVALID_PARAMETER; + } + + Zero(&t, sizeof(t)); + t.IntValue = GetParamInt(o, "[id]"); + + // RPC call + ret = ScDelLicenseKey(ps->Rpc, &t); + + if (ret != ERR_NO_ERROR) + { + // An error has occured + CmdPrintError(c, ret); + FreeParamValueList(o); + return ret; + } + + FreeParamValueList(o); + + return 0; +} + + + +// Get the registered license list +UINT PsLicenseList(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) +{ + LIST *o; + PS *ps = (PS *)param; + UINT ret = 0; + RPC_ENUM_LICENSE_KEY t; + CT *ct; + UINT i; + + o = ParseCommandList(c, cmd_name, str, NULL, 0); + if (o == NULL) + { + return ERR_INVALID_PARAMETER; + } + + Zero(&t, sizeof(t)); + + // RPC call + ret = ScEnumLicenseKey(ps->Rpc, &t); + + if (ret != ERR_NO_ERROR) + { + // An error has occured + CmdPrintError(c, ret); + FreeParamValueList(o); + return ret; + } + + ct = CtNew(); + CtInsertColumn(ct, _UU("SM_LICENSE_COLUMN_1"), false); + CtInsertColumn(ct, _UU("SM_LICENSE_COLUMN_2"), false); + CtInsertColumn(ct, _UU("SM_LICENSE_COLUMN_3"), false); + CtInsertColumn(ct, _UU("SM_LICENSE_COLUMN_4"), false); + CtInsertColumn(ct, _UU("SM_LICENSE_COLUMN_5"), false); + CtInsertColumn(ct, _UU("SM_LICENSE_COLUMN_6"), false); + CtInsertColumn(ct, _UU("SM_LICENSE_COLUMN_7"), false); + CtInsertColumn(ct, _UU("SM_LICENSE_COLUMN_8"), false); + CtInsertColumn(ct, _UU("SM_LICENSE_COLUMN_9"), false); + + for (i = 0;i < t.NumItem;i++) + { + wchar_t tmp1[32], tmp2[LICENSE_KEYSTR_LEN + 1], tmp3[LICENSE_MAX_PRODUCT_NAME_LEN + 1], + *tmp4, tmp5[128], tmp6[LICENSE_LICENSEID_STR_LEN + 1], tmp7[64], + tmp8[64], tmp9[64]; + RPC_ENUM_LICENSE_KEY_ITEM *e = &t.Items[i]; + + UniToStru(tmp1, e->Id); + StrToUni(tmp2, sizeof(tmp2), e->LicenseKey); + StrToUni(tmp3, sizeof(tmp3), e->LicenseName); + tmp4 = LiGetLicenseStatusStr(e->Status); + if (e->Expires == 0) + { + UniStrCpy(tmp5, sizeof(tmp5), _UU("SM_LICENSE_NO_EXPIRES")); + } + else + { + GetDateStrEx64(tmp5, sizeof(tmp5), e->Expires, NULL); + } + StrToUni(tmp6, sizeof(tmp6), e->LicenseId); + UniToStru(tmp7, e->ProductId); + UniFormat(tmp8, sizeof(tmp8), L"%I64u", e->SystemId); + UniToStru(tmp9, e->SerialId); + + CtInsert(ct, + tmp1, tmp2, tmp3, tmp4, tmp5, tmp6, tmp7, tmp8, tmp9); + } + + CtFreeEx(ct, c, true); + + FreeRpcEnumLicenseKey(&t); + + FreeParamValueList(o); + + return 0; +} + +// Get the license status of the current VPN Server +UINT PsLicenseStatus(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) +{ + LIST *o; + PS *ps = (PS *)param; + UINT ret = 0; + RPC_LICENSE_STATUS st; + CT *ct; + wchar_t tmp[MAX_SIZE]; + + o = ParseCommandList(c, cmd_name, str, NULL, 0); + if (o == NULL) + { + return ERR_INVALID_PARAMETER; + } + + Zero(&st, sizeof(st)); + + // RPC call + ret = ScGetLicenseStatus(ps->Rpc, &st); + + if (ret != ERR_NO_ERROR) + { + // An error has occured + CmdPrintError(c, ret); + FreeParamValueList(o); + return ret; + } + + ct = CtNewStandard(); + + if (st.EditionId == LICENSE_EDITION_VPN3_NO_LICENSE) + { + CtInsert(ct, _UU("SM_NO_LICENSE_COLUMN"), _UU("SM_NO_LICENSE")); + } + else + { + // Product edition name + StrToUni(tmp, sizeof(tmp), st.EditionStr); + CtInsert(ct, _UU("SM_LICENSE_STATUS_EDITION"), tmp); + + // Release date + if (st.ReleaseDate != 0) + { + GetDateStrEx64(tmp, sizeof(tmp), st.ReleaseDate, NULL); + CtInsert(ct, _UU("SM_LICENSE_STATUS_RELEASE"), tmp); + } + + // Current system ID + UniFormat(tmp, sizeof(tmp), L"%I64u", st.SystemId); + CtInsert(ct, _UU("SM_LICENSE_STATUS_SYSTEM_ID"), tmp); + + // Expiration date of the current license product + if (st.SystemExpires == 0) + { + UniStrCpy(tmp, sizeof(tmp), _UU("SM_LICENSE_NO_EXPIRES")); + } + else + { + GetDateStrEx64(tmp, sizeof(tmp), st.SystemExpires, NULL); + } + CtInsert(ct, _UU("SM_LICENSE_STATUS_EXPIRES"), tmp); + + // Subscription (support) contract + if (st.NeedSubscription == false) + { + UniStrCpy(tmp, sizeof(tmp), _UU("SM_LICENSE_STATUS_SUBSCRIPTION_NONEED")); + } + else + { + if (st.SubscriptionExpires == 0) + { + UniStrCpy(tmp, sizeof(tmp), _UU("SM_LICENSE_STATUS_SUBSCRIPTION_NONE")); + } + else + { + wchar_t dtstr[MAX_PATH]; + + GetDateStrEx64(dtstr, sizeof(dtstr), st.SubscriptionExpires, NULL); + + UniFormat(tmp, sizeof(tmp), + st.IsSubscriptionExpired ? _UU("SM_LICENSE_STATUS_SUBSCRIPTION_EXPIRED") : _UU("SM_LICENSE_STATUS_SUBSCRIPTION_VALID"), + dtstr); + } + } + CtInsert(ct, _UU("SM_LICENSE_STATUS_SUBSCRIPTION"), tmp); + + if (st.NeedSubscription == false && st.SubscriptionExpires != 0) + { + wchar_t dtstr[MAX_PATH]; + + GetDateStrEx64(dtstr, sizeof(dtstr), st.SubscriptionExpires, NULL); + + CtInsert(ct, _UU("SM_LICENSE_STATUS_SUBSCRIPTION_BUILD_STR"), tmp); + } + + if (GetCapsBool(ps->CapsList, "b_vpn3")) + { + // Maximum creatable number of users + if (st.NumClientConnectLicense == INFINITE) + { + UniStrCpy(tmp, sizeof(tmp), _UU("SM_LICENSE_INFINITE")); + } + else + { + UniToStru(tmp, st.NumClientConnectLicense); + } + CtInsert(ct, _UU("SM_LICENSE_NUM_CLIENT"), tmp); + } + + // Available number of concurrent client connections + if (st.NumBridgeConnectLicense == INFINITE) + { + UniStrCpy(tmp, sizeof(tmp), _UU("SM_LICENSE_INFINITE")); + } + else + { + UniToStru(tmp, st.NumBridgeConnectLicense); + } + CtInsert(ct, _UU("SM_LICENSE_NUM_BRIDGE"), tmp); + + // Availability of enterprise features + CtInsert(ct, _UU("SM_LICENSE_STATUS_ENTERPRISE"), + st.AllowEnterpriseFunction ? _UU("SM_LICENSE_STATUS_ENTERPRISE_YES") : _UU("SM_LICENSE_STATUS_ENTERPRISE_NO")); + } + + CtFreeEx(ct, c, false); + + FreeParamValueList(o); + + return 0; +} + + +// Get the cluster configuration +UINT PsClusterSettingGet(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) +{ + LIST *o; + PS *ps = (PS *)param; + UINT ret; + RPC_FARM t; + CT *ct; + + o = ParseCommandList(c, cmd_name, str, NULL, 0); + if (o == NULL) + { + return ERR_INVALID_PARAMETER; + } + + Zero(&t, sizeof(t)); + + ret = ScGetFarmSetting(ps->Rpc, &t); + + if (ret != ERR_NO_ERROR) + { + CmdPrintError(c, ret); + FreeParamValueList(o); + return ret; + } + + if (t.Weight == 0) + { + t.Weight = FARM_DEFAULT_WEIGHT; + } + + // Show the cluster configuration + ct = CtNewStandard(); + + CtInsert(ct, _UU("CMD_ClusterSettingGet_Current"), + GetServerTypeStr(t.ServerType)); + + if (t.ServerType == SERVER_TYPE_FARM_CONTROLLER) + { + CtInsert(ct, _UU("CMD_ClusterSettingGet_ControllerOnly"), t.ControllerOnly ? _UU("SEC_YES") : _UU("SEC_NO")); + } + + if (t.ServerType != SERVER_TYPE_STANDALONE) + { + wchar_t tmp[MAX_SIZE]; + + UniToStru(tmp, t.Weight); + + CtInsert(ct, _UU("CMD_ClusterSettingGet_Weight"), tmp); + } + + if (t.ServerType == SERVER_TYPE_FARM_MEMBER) + { + wchar_t tmp[MAX_SIZE]; + UINT i; + + // Public IP address + if (t.PublicIp != 0) + { + IPToUniStr32(tmp, sizeof(tmp), t.PublicIp); + } + else + { + UniStrCpy(tmp, sizeof(tmp), _UU("CMD_ClusterSettingGet_None")); + } + + CtInsert(ct, _UU("CMD_ClusterSettingGet_PublicIp"), tmp); + + // Public port list + tmp[0] = 0; + for (i = 0;i < t.NumPort;i++) + { + wchar_t tmp2[64]; + + UniFormat(tmp2, sizeof(tmp2), L"%u, ", t.Ports[i]); + + UniStrCat(tmp, sizeof(tmp), tmp2); + } + + if (UniEndWith(tmp, L", ")) + { + tmp[UniStrLen(tmp) - 2] = 0; + } + + CtInsert(ct, _UU("CMD_ClusterSettingGet_PublicPorts"), tmp); + + // Controller to connect + UniFormat(tmp, sizeof(tmp), L"%S:%u", t.ControllerName, t.ControllerPort); + CtInsert(ct, _UU("CMD_ClusterSettingGet_Controller"), tmp); + } + + CtFree(ct, c); + + FreeRpcFarm(&t); + FreeParamValueList(o); + + return 0; +} + +// Set the server password +UINT PsServerPasswordSet(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) +{ + LIST *o; + PS *ps = (PS *)param; + UINT ret; + RPC_SET_PASSWORD t; + char *pw; + PARAM args[] = + { + {"[password]", CmdPromptChoosePassword, NULL, NULL, NULL}, + }; + + o = ParseCommandList(c, cmd_name, str, args, sizeof(args) / sizeof(args[0])); + if (o == NULL) + { + return ERR_INVALID_PARAMETER; + } + + pw = GetParamStr(o, "[password]"); + + Zero(&t, sizeof(t)); + Sha0(t.HashedPassword, pw, StrLen(pw)); + + ret = ScSetServerPassword(ps->Rpc, &t); + + if (ret != ERR_NO_ERROR) + { + CmdPrintError(c, ret); + FreeParamValueList(o); + return ret; + } + + FreeParamValueList(o); + + return 0; +} + +// Password decision prompt (for Prompt function) +wchar_t *CmdPromptChoosePassword(CONSOLE *c, void *param) +{ + char *s; + // Validate arguments + if (c == NULL) + { + return NULL; + } + + s = CmdPasswordPrompt(c); + + if (s == NULL) + { + return NULL; + } + else + { + wchar_t *ret = CopyStrToUni(s); + + Free(s); + + return ret; + } +} + +// Password input prompt (general-purpose) +char *CmdPasswordPrompt(CONSOLE *c) +{ + char *pw1, *pw2; + // Validate arguments + if (c == NULL) + { + return NULL; + } + + c->Write(c, _UU("CMD_VPNCMD_PWPROMPT_0")); + +RETRY: + c->Write(c, L""); + + + pw1 = c->ReadPassword(c, _UU("CMD_VPNCMD_PWPROMPT_1")); + if (pw1 == NULL) + { + return NULL; + } + + pw2 = c->ReadPassword(c, _UU("CMD_VPNCMD_PWPROMPT_2")); + if (pw2 == NULL) + { + Free(pw1); + return NULL; + } + + c->Write(c, L""); + + if (StrCmp(pw1, pw2) != 0) + { + Free(pw1); + Free(pw2); + c->Write(c, _UU("CMD_VPNCMD_PWPROMPT_3")); + goto RETRY; + } + + Free(pw1); + + return pw2; +} + +// Disable the listener +UINT PsListenerDisable(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) +{ + LIST *o; + PS *ps = (PS *)param; + UINT ret; + RPC_LISTENER t; + PARAM args[] = + { + {"[port]", CmdPromptPort, _UU("CMD_ListenerDisable_PortPrompt"), CmdEvalPort, NULL}, + }; + + o = ParseCommandList(c, cmd_name, str, args, sizeof(args) / sizeof(args[0])); + if (o == NULL) + { + return ERR_INVALID_PARAMETER; + } + + Zero(&t, sizeof(t)); + t.Enable = false; + t.Port = ToInt(GetParamStr(o, "[port]")); + + ret = ScEnableListener(ps->Rpc, &t); + + if (ret != ERR_NO_ERROR) + { + CmdPrintError(c, ret); + FreeParamValueList(o); + return ret; + } + + FreeParamValueList(o); + + return 0; +} + +// Enable the listener +UINT PsListenerEnable(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) +{ + LIST *o; + PS *ps = (PS *)param; + UINT ret; + RPC_LISTENER t; + PARAM args[] = + { + {"[port]", CmdPromptPort, _UU("CMD_ListenerEnable_PortPrompt"), CmdEvalPort, NULL}, + }; + + o = ParseCommandList(c, cmd_name, str, args, sizeof(args) / sizeof(args[0])); + if (o == NULL) + { + return ERR_INVALID_PARAMETER; + } + + Zero(&t, sizeof(t)); + t.Enable = true; + t.Port = ToInt(GetParamStr(o, "[port]")); + + ret = ScEnableListener(ps->Rpc, &t); + + if (ret != ERR_NO_ERROR) + { + CmdPrintError(c, ret); + FreeParamValueList(o); + return ret; + } + + FreeParamValueList(o); + + return 0; +} + +// Set UDP ports the server should listen on +UINT PsPortsUDPSet(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) +{ + LIST *o, *ports; + PS *ps = (PS *)param; + UINT ret; + RPC_PORTS t; + PARAM args[] = + { + {"[ports]", CmdPrompt, _UU("CMD_PortsUDPSet_[ports]"), CmdEvalPortList, (void *)false} + }; + + o = ParseCommandList(c, cmd_name, str, args, sizeof(args) / sizeof(args[0])); + if (o == NULL) + { + return ERR_INVALID_PARAMETER; + } + + ports = StrToPortList(GetParamStr(o, "[ports]"), false); + + FreeParamValueList(o); + + t.Num = LIST_NUM(ports); + if (t.Num > 0) + { + UINT i; + t.Ports = Malloc(sizeof(UINT) * t.Num); + + for (i = 0; i < t.Num; ++i) + { + t.Ports[i] = (UINT)LIST_DATA(ports, i); + } + } + else + { + t.Ports = NULL; + } + + ReleaseList(ports); + + ret = ScSetPortsUDP(ps->Rpc, &t); + if (ret != ERR_NO_ERROR) + { + CmdPrintError(c, ret); + } + + Free(t.Ports); + + return ret; +} + +// List UDP ports the server is listening on +UINT PsPortsUDPGet(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) +{ + LIST *o; + PS *ps = (PS *)param; + UINT ret; + RPC_PORTS t; + + o = ParseCommandList(c, cmd_name, str, NULL, 0); + if (o == NULL) + { + return ERR_INVALID_PARAMETER; + } + + FreeParamValueList(o); + + Zero(&t, sizeof(t)); + + ret = ScGetPortsUDP(ps->Rpc, &t); + if (ret == ERR_NO_ERROR) + { + wchar_t str[MAX_SIZE]; + CT *ct = CtNewStandard(); + + Zero(str, sizeof(str)); + + if (t.Num > 0) + { + UINT i; + wchar_t buf[MAX_SIZE]; + + UniFormat(buf, sizeof(buf), L"%u", t.Ports[0]); + UniStrCat(str, sizeof(str), buf); + + for (i = 1; i < t.Num; ++i) + { + UniFormat(buf, sizeof(buf), L", %u", t.Ports[i]); + UniStrCat(str, sizeof(str), buf); + } + } + + CtInsert(ct, _UU("CMD_PortsUDPGet_Ports"), str); + CtFree(ct, c); + } + else + { + CmdPrintError(c, ret); + } + + FreeRpcPorts(&t); + + return ret; +} + +// Configure an option for the specified protocol (TODO: ability to set multiple options in a single call) +UINT PsProtoOptionsSet(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) +{ + LIST *o; + PS *ps = (PS *)param; + UINT ret; + RPC_PROTO_OPTIONS t; + PARAM args[] = + { + {"[protocol]", CmdPrompt, _UU("CMD_ProtoOptionsSet_Prompt_[protocol]"), CmdEvalNotEmpty, NULL}, + {"NAME", CmdPrompt, _UU("CMD_ProtoOptionsSet_Prompt_NAME"), CmdEvalNotEmpty, NULL}, + {"VALUE", CmdPrompt, _UU("CMD_ProtoOptionsSet_Prompt_VALUE"), NULL, NULL} + }; + + o = ParseCommandList(c, cmd_name, str, args, sizeof(args) / sizeof(args[0])); + if (o == NULL) + { + return ERR_INVALID_PARAMETER; + } + + Zero(&t, sizeof(t)); + t.Protocol = CopyStr(GetParamStr(o, "[protocol]")); + + ret = ScGetProtoOptions(ps->Rpc, &t); + + if (ret == ERR_NO_ERROR) + { + UINT i; + bool found = false; + + for (i = 0; i < t.Num; ++i) + { + PROTO_OPTION *option = &t.Options[i]; + if (StrCmpi(option->Name, GetParamStr(o, "NAME")) != 0) + { + continue; + } + + found = true; + + switch (option->Type) + { + case PROTO_OPTION_STRING: + Free(option->String); + option->String = CopyStr(GetParamStr(o, "VALUE")); + break; + case PROTO_OPTION_BOOL: + option->Bool = GetParamYes(o, "VALUE"); + break; + default: + ret = ERR_INTERNAL_ERROR; + } + + if (ret == ERR_NO_ERROR) + { + ret = ScSetProtoOptions(ps->Rpc, &t); + } + + break; + } + + if (found == false) + { + ret = ERR_OBJECT_NOT_FOUND; + } + } + + if (ret != ERR_NO_ERROR) + { + CmdPrintError(c, ret); + } + + FreeRpcProtoOptions(&t); + FreeParamValueList(o); + + return ret; +} + +// List available options for the specified protocol +UINT PsProtoOptionsGet(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) +{ + LIST *o; + PS *ps = (PS *)param; + UINT ret; + RPC_PROTO_OPTIONS t; + PARAM args[] = + { + {"[protocol]", CmdPrompt, _UU("CMD_ProtoOptionsGet_Prompt_[protocol]"), CmdEvalNotEmpty, NULL} + }; + + o = ParseCommandList(c, cmd_name, str, args, sizeof(args) / sizeof(args[0])); + if (o == NULL) + { + return ERR_INVALID_PARAMETER; + } + + Zero(&t, sizeof(t)); + t.Protocol = CopyStr(GetParamStr(o, "[protocol]")); + + FreeParamValueList(o); + + ret = ScGetProtoOptions(ps->Rpc, &t); + if (ret == ERR_NO_ERROR) + { + UINT i; + CT *ct = CtNew(); + CtInsertColumn(ct, _UU("CMD_ProtoOptionsGet_Column_Name"), false); + CtInsertColumn(ct, _UU("CMD_ProtoOptionsGet_Column_Type"), false); + CtInsertColumn(ct, _UU("CMD_ProtoOptionsGet_Column_Value"), false); + CtInsertColumn(ct, _UU("CMD_ProtoOptionsGet_Column_Description"), false); + + for (i = 0; i < t.Num; ++i) + { + char description_str_key[MAX_SIZE]; + const PROTO_OPTION *option = &t.Options[i]; + wchar_t *value, *type, *name = CopyStrToUni(option->Name); + + switch (option->Type) + { + case PROTO_OPTION_BOOL: + type = L"Boolean"; + value = option->Bool ? L"True" : L"False"; + break; + case PROTO_OPTION_STRING: + type = L"String"; + value = CopyStrToUni(option->String); + break; + default: + Debug("StGetProtoOptions(): unhandled option type %u!\n", option->Type); + Free(name); + continue; + } + + Format(description_str_key, sizeof(description_str_key), "CMD_ProtoOptions_Description_%s_%s", t.Protocol, option->Name); + + CtInsert(ct, name, type, value, _UU(description_str_key)); + + if (option->Type == PROTO_OPTION_STRING) + { + Free(value); + } + + Free(name); + } + + CtFree(ct, c); + } + else + { + CmdPrintError(c, ret); + } + + FreeRpcProtoOptions(&t); + + return ret; +} + +// Draw a row of console table +void CtPrintRow(CONSOLE *c, UINT num, UINT *widths, wchar_t **strings, bool *rights, char separate_char) +{ + UINT i; + wchar_t *buf; + UINT buf_size; + bool is_sep_line = true; + // Validate arguments + if (c == NULL || num == 0 || widths == NULL || strings == NULL || rights == NULL) + { + return; + } + + buf_size = 32; + for (i = 0;i < num;i++) + { + buf_size += sizeof(wchar_t) * widths[i] + 6; + } + + buf = ZeroMalloc(buf_size); + + for (i = 0;i < num;i++) + { + char *tmp; + wchar_t *space_string; + UINT w; + UINT space = 0; + wchar_t *string = strings[i]; + wchar_t *tmp_line = NULL; + + if (UniStrCmpi(string, L"---") == 0) + { + char *s = MakeCharArray('-', widths[i]); + tmp_line = string = CopyStrToUni(s); + + Free(s); + } + else + { + is_sep_line = false; + } + + w = UniStrWidth(string); + + if (widths[i] >= w) + { + space = widths[i] - w; + } + + tmp = MakeCharArray(' ', space); + space_string = CopyStrToUni(tmp); + + if (rights[i] != false) + { + UniStrCat(buf, buf_size, space_string); + } + + UniStrCat(buf, buf_size, string); + + if (rights[i] == false) + { + UniStrCat(buf, buf_size, space_string); + } + + Free(space_string); + Free(tmp); + + if (i < (num - 1)) + { + wchar_t tmp[4]; + char str[2]; + + if (UniStrCmpi(strings[i], L"---") == 0) + { + str[0] = '+'; + } + else + { + str[0] = separate_char; + } + str[1] = 0; + + StrToUni(tmp, sizeof(tmp), str); + + UniStrCat(buf, buf_size, tmp); + } + + if (tmp_line != NULL) + { + Free(tmp_line); + } + } + + UniTrimRight(buf); + + if (is_sep_line) + { + if (UniStrLen(buf) > (c->GetWidth(c) - 1)) + { + buf[c->GetWidth(c) - 1] = 0; + } + } + + c->Write(c, buf); + + Free(buf); +} + +// Draw the console table in standard format +void CtPrintStandard(CT *ct, CONSOLE *c) +{ + CT *t; + UINT i, j; + // Validate arguments + if (ct == NULL || c == NULL) + { + return; + } + + t = CtNewStandard(); + for (i = 0;i < LIST_NUM(ct->Rows);i++) + { + CTR *row = LIST_DATA(ct->Rows, i); + + for (j = 0;j < LIST_NUM(ct->Columns);j++) + { + CTC *column = LIST_DATA(ct->Columns, j); + + CtInsert(t, column->String, row->Strings[j]); + } + + if (i != (LIST_NUM(ct->Rows) - 1)) + { + CtInsert(t, L"---", L"---"); + } + } + + CtFree(t, c); +} + +// Draw the console table +void CtPrint(CT *ct, CONSOLE *c) +{ + UINT *widths; + UINT num; + UINT i, j; + wchar_t **header_strings; + bool *rights; + // Validate arguments + if (ct == NULL || c == NULL) + { + return; + } + + num = LIST_NUM(ct->Columns); + widths = ZeroMalloc(sizeof(UINT) * num); + + // Calculate the maximum character width of each column + for (i = 0;i < num;i++) + { + CTC *ctc = LIST_DATA(ct->Columns, i); + UINT w; + + w = UniStrWidth(ctc->String); + widths[i] = MAX(widths[i], w); + } + for (j = 0;j < LIST_NUM(ct->Rows);j++) + { + CTR *ctr = LIST_DATA(ct->Rows, j); + + for (i = 0;i < num;i++) + { + UINT w; + + w = UniStrWidth(ctr->Strings[i]); + widths[i] = MAX(widths[i], w); + } + } + + // Display the header part + header_strings = ZeroMalloc(sizeof(wchar_t *) * num); + rights = ZeroMalloc(sizeof(bool) * num); + + for (i = 0;i < num;i++) + { + CTC *ctc = LIST_DATA(ct->Columns, i); + + header_strings[i] = ctc->String; + rights[i] = ctc->Right; + } + + CtPrintRow(c, num, widths, header_strings, rights, '|'); + + for (i = 0;i < num;i++) + { + char *s; + + s = MakeCharArray('-', widths[i]); + header_strings[i] = CopyStrToUni(s); + Free(s); + } + + CtPrintRow(c, num, widths, header_strings, rights, '+'); + + for (i = 0;i < num;i++) + { + Free(header_strings[i]); + } + + // Display the data part + for (j = 0;j < LIST_NUM(ct->Rows);j++) + { + CTR *ctr = LIST_DATA(ct->Rows, j); + + CtPrintRow(c, num, widths, ctr->Strings, rights, '|'); + } + + Free(rights); + Free(header_strings); + Free(widths); +} + +// Escape the meta-characters in CSV +void CtEscapeCsv(wchar_t *dst, UINT size, wchar_t *src){ + UINT i; + UINT len = UniStrLen(src); + UINT idx; + BOOL need_to_escape = false; + wchar_t tmp[2]=L"*"; + + // Check the input value + if (src==NULL || dst==NULL) + { + return; + } + + // If there is no character that need to be escaped in the input characters, copy it to the output + for (i=0; iColumns); + wchar_t buf[MAX_SIZE*4]; + wchar_t fmtbuf[MAX_SIZE*4]; + + // Show the heading row + buf[0] = 0; + for(i=0; iColumns, i); + CtEscapeCsv(fmtbuf, sizeof(fmtbuf), ctc->String); + UniStrCat(buf, sizeof(buf), fmtbuf); + if(i != num_columns-1) + UniStrCat(buf, sizeof(buf), L","); + } + c->Write(c, buf); + + // Show the table body + for(j=0; jRows); j++) + { + CTR *ctr = LIST_DATA(ct->Rows, j); + buf[0] = 0; + for(i=0; iStrings[i]); + UniStrCat(buf, sizeof(buf), fmtbuf); + if(i != num_columns-1) + UniStrCat(buf, sizeof(buf), L","); + } + c->Write(c, buf); + } +} + +// Delete the console table +void CtFreeEx(CT *ct, CONSOLE *c, bool standard_view) +{ + UINT i, num; + // Validate arguments + if (ct == NULL) + { + return; + } + + if (c != NULL) + { + if (c->ConsoleType == CONSOLE_CSV) + { + CtPrintCsv(ct, c); + } + else + { + if (standard_view == false) + { + CtPrint(ct, c); + } + else + { + CtPrintStandard(ct, c); + } + } + } + + num = LIST_NUM(ct->Columns); + + for (i = 0;i < LIST_NUM(ct->Rows);i++) + { + UINT j; + CTR *ctr = LIST_DATA(ct->Rows, i); + + for (j = 0;j < num;j++) + { + Free(ctr->Strings[j]); + } + + Free(ctr->Strings); + Free(ctr); + } + + for (i = 0;i < LIST_NUM(ct->Columns);i++) + { + CTC *ctc = LIST_DATA(ct->Columns, i); + + Free(ctc->String); + Free(ctc); + } + + ReleaseList(ct->Columns); + ReleaseList(ct->Rows); + + Free(ct); +} +void CtFree(CT *ct, CONSOLE *c) +{ + CtFreeEx(ct, c, false); +} + +// Add a row to the table +void CtInsert(CT *ct, ...) +{ + CTR *ctr; + UINT num, i; + va_list va; + // Validate arguments + if (ct == NULL) + { + return; + } + + num = LIST_NUM(ct->Columns); + + va_start(va, ct); + + ctr = ZeroMalloc(sizeof(CTR)); + ctr->Strings = ZeroMalloc(sizeof(wchar_t *) * num); + + for (i = 0;i < num;i++) + { + wchar_t *s = va_arg(va, wchar_t *); + + ctr->Strings[i] = CopyUniStr(s); + } + + va_end(va); + + Insert(ct->Rows, ctr); +} + +// Add a column to the table +void CtInsertColumn(CT *ct, wchar_t *str, bool right) +{ + CTC *ctc; + // Validate arguments + if (ct == NULL) + { + return; + } + if (str == NULL) + { + str = L""; + } + + ctc = ZeroMalloc(sizeof(CTC)); + ctc->String = CopyUniStr(str); + ctc->Right = right; + + Insert(ct->Columns, ctc); +} + +// Create a new console table +CT *CtNew() +{ + CT *ct; + + ct = ZeroMalloc(sizeof(CT)); + ct->Columns = NewList(NULL); + ct->Rows = NewList(NULL); + + return ct; +} + +// Add a standard column to a column in a table +CT *CtNewStandard() +{ + CT *ct = CtNew(); + + CtInsertColumn(ct, _UU("CMD_CT_STD_COLUMN_1"), false); + CtInsertColumn(ct, _UU("CMD_CT_STD_COLUMN_2"), false); + + return ct; +} +CT *CtNewStandardEx() +{ + CT *ct = CtNew(); + + CtInsertColumn(ct, _UU("CMD_CT_STD_COLUMN_1"), false); + CtInsertColumn(ct, _UU("CMD_CT_STD_COLUMN_2"), false); + CtInsertColumn(ct, _UU("CMD_CT_STD_COLUMN_3"), false); + + return ct; +} + +// Get the TCP listener list +UINT PsListenerList(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) +{ + LIST *o; + PS *ps = (PS *)param; + UINT ret; + RPC_LISTENER_LIST t; + UINT i; + CT *ct; + + o = ParseCommandList(c, cmd_name, str, NULL, 0); + if (o == NULL) + { + return ERR_INVALID_PARAMETER; + } + + Zero(&t, sizeof(t)); + + ret = ScEnumListener(ps->Rpc, &t); + + if (ret != ERR_NO_ERROR) + { + CmdPrintError(c, ret); + FreeParamValueList(o); + return ret; + } + + ct = CtNew(); + + CtInsertColumn(ct, _UU("CM_LISTENER_COLUMN_1"), false); + CtInsertColumn(ct, _UU("CM_LISTENER_COLUMN_2"), false); + + for (i = 0;i < t.NumPort;i++) + { + wchar_t *status = _UU("CM_LISTENER_OFFLINE"); + wchar_t tmp[128]; + + if (t.Errors[i]) + { + status = _UU("CM_LISTENER_ERROR"); + } + else if (t.Enables[i]) + { + status = _UU("CM_LISTENER_ONLINE"); + } + + UniFormat(tmp, sizeof(tmp), _UU("CM_LISTENER_TCP_PORT"), t.Ports[i]); + + CtInsert(ct, tmp, status); + } + + CtFree(ct, c); + + FreeRpcListenerList(&t); + + FreeParamValueList(o); + + return 0; +} + +// Delete the TCP listener +UINT PsListenerDelete(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) +{ + LIST *o; + PS *ps = (PS *)param; + UINT ret; + RPC_LISTENER t; + PARAM args[] = + { + {"[port]", CmdPromptPort, _UU("CMD_ListenerDelete_PortPrompt"), CmdEvalPort, NULL}, + }; + + o = ParseCommandList(c, cmd_name, str, args, sizeof(args) / sizeof(args[0])); + if (o == NULL) + { + return ERR_INVALID_PARAMETER; + } + + Zero(&t, sizeof(t)); + t.Enable = true; + t.Port = ToInt(GetParamStr(o, "[port]")); + + ret = ScDeleteListener(ps->Rpc, &t); + + if (ret != ERR_NO_ERROR) + { + CmdPrintError(c, ret); + FreeParamValueList(o); + return ret; + } + + FreeParamValueList(o); + + return 0; +} + +// ServerInfoGet command +UINT PsServerInfoGet(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) +{ + LIST *o; + PS *ps = (PS *)param; + UINT ret; + RPC_SERVER_INFO t; + CT *ct; + wchar_t tmp[MAX_SIZE]; + + o = ParseCommandList(c, cmd_name, str, NULL, 0); + if (o == NULL) + { + return ERR_INVALID_PARAMETER; + } + + Zero(&t, sizeof(t)); + ret = ScGetServerInfo(ps->Rpc, &t); + if (ret != ERR_NO_ERROR) + { + CmdPrintError(c, ret); + FreeParamValueList(o); + return ret; + } + + ct = CtNew(); + + CtInsertColumn(ct, _UU("SM_STATUS_COLUMN_1"), false); + CtInsertColumn(ct, _UU("SM_STATUS_COLUMN_2"), false); + + // Product name + StrToUni(tmp, sizeof(tmp), t.ServerProductName); + CtInsert(ct, _UU("SM_INFO_PRODUCT_NAME"), tmp); + + // Version + StrToUni(tmp, sizeof(tmp), t.ServerVersionString); + CtInsert(ct, _UU("SM_INFO_VERSION"), tmp); + + // Build + StrToUni(tmp, sizeof(tmp), t.ServerBuildInfoString); + CtInsert(ct, _UU("SM_INFO_BUILD"), tmp); + + // Host name + StrToUni(tmp, sizeof(tmp), t.ServerHostName); + CtInsert(ct, _UU("SM_INFO_HOSTNAME"), tmp); + + // Type + CtInsert(ct, _UU("SM_ST_SERVER_TYPE"), GetServerTypeStr(t.ServerType)); + + // OS + StrToUni(tmp, sizeof(tmp), t.OsInfo.OsSystemName); + CtInsert(ct, _UU("SM_OS_SYSTEM_NAME"), tmp); + + StrToUni(tmp, sizeof(tmp), t.OsInfo.OsProductName); + CtInsert(ct, _UU("SM_OS_PRODUCT_NAME"), tmp); + + if (t.OsInfo.OsServicePack != 0) + { + UniFormat(tmp, sizeof(tmp), _UU("SM_OS_SP_TAG"), t.OsInfo.OsServicePack); + CtInsert(ct, _UU("SM_OS_SERVICE_PACK"), tmp); + } + + StrToUni(tmp, sizeof(tmp), t.OsInfo.OsVendorName); + CtInsert(ct, _UU("SM_OS_VENDER_NAME"), tmp); + + StrToUni(tmp, sizeof(tmp), t.OsInfo.OsVersion); + CtInsert(ct, _UU("SM_OS_VERSION"), tmp); + + StrToUni(tmp, sizeof(tmp), t.OsInfo.KernelName); + CtInsert(ct, _UU("SM_OS_KERNEL_NAME"), tmp); + + StrToUni(tmp, sizeof(tmp), t.OsInfo.KernelVersion); + CtInsert(ct, _UU("SM_OS_KERNEL_VERSION"), tmp); + + CtFree(ct, c); + + FreeRpcServerInfo(&t); + + FreeParamValueList(o); + + return 0; +} + +// Get the string for type of the HUB +wchar_t *GetHubTypeStr(UINT type) +{ + if (type == HUB_TYPE_FARM_STATIC) + { + return _UU("SM_HUB_STATIC"); + } + else if (type == HUB_TYPE_FARM_DYNAMIC) + { + return _UU("SM_HUB_DYNAMIC"); + } + return _UU("SM_HUB_STANDALONE"); +} + +// Get a string of the type of server +wchar_t *GetServerTypeStr(UINT type) +{ + if (type == SERVER_TYPE_FARM_CONTROLLER) + { + return _UU("SM_FARM_CONTROLLER"); + } + else if (type == SERVER_TYPE_FARM_MEMBER) + { + return _UU("SM_FARM_MEMBER"); + } + return _UU("SM_SERVER_STANDALONE"); +} + +// ServerStatusGet command +UINT PsServerStatusGet(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) +{ + LIST *o; + PS *ps = (PS *)param; + UINT ret; + RPC_SERVER_STATUS t; + wchar_t tmp[MAX_PATH]; + char tmp2[MAX_PATH]; + CT *ct; + + o = ParseCommandList(c, cmd_name, str, NULL, 0); + if (o == NULL) + { + return ERR_INVALID_PARAMETER; + } + + Zero(&t, sizeof(t)); + ret = ScGetServerStatus(ps->Rpc, &t); + if (ret != ERR_NO_ERROR) + { + CmdPrintError(c, ret); + FreeParamValueList(o); + return ret; + } + + ct = CtNew(); + + CtInsertColumn(ct, _UU("SM_STATUS_COLUMN_1"), false); + CtInsertColumn(ct, _UU("SM_STATUS_COLUMN_2"), false); + + // Type of server + CtInsert(ct, _UU("SM_ST_SERVER_TYPE"), + t.ServerType == SERVER_TYPE_STANDALONE ? _UU("SM_SERVER_STANDALONE") : + t.ServerType == SERVER_TYPE_FARM_MEMBER ? _UU("SM_FARM_MEMBER") : _UU("SM_FARM_CONTROLLER")); + + // Number of TCP connections + UniToStru(tmp, t.NumTcpConnections); + CtInsert(ct, _UU("SM_ST_NUM_TCP"), tmp); + + if (t.ServerType == SERVER_TYPE_FARM_CONTROLLER) + { + // Number of local TCP connections + UniToStru(tmp, t.NumTcpConnectionsLocal); + CtInsert(ct, _UU("SM_ST_NUM_TCP_LOCAL"), tmp); + + // Number of remote TCP connections + UniToStru(tmp, t.NumTcpConnectionsRemote); + CtInsert(ct, _UU("SM_ST_NUM_TCP_REMOTE"), tmp); + } + + // Number of Virtual HUBs + UniToStru(tmp, t.NumHubTotal); + CtInsert(ct, _UU("SM_ST_NUM_HUB_TOTAL"), tmp); + + if (t.ServerType != SERVER_TYPE_STANDALONE) + { + // Number of static HUBs + UniToStru(tmp, t.NumHubStatic); + CtInsert(ct, _UU("SM_ST_NUM_HUB_STATIC"), tmp); + + // Number of dynamic HUBs + UniToStru(tmp, t.NumHubDynamic); + CtInsert(ct, _UU("SM_ST_NUM_HUB_DYNAMIC"), tmp); + } + + // Number of sessions + UniToStru(tmp, t.NumSessionsTotal); + CtInsert(ct, _UU("SM_ST_NUM_SESSION_TOTAL"), tmp); + + if (t.ServerType == SERVER_TYPE_FARM_CONTROLLER) + { + // Number of local sessions + UniToStru(tmp, t.NumSessionsLocal); + CtInsert(ct, _UU("SM_ST_NUM_SESSION_LOCAL"), tmp); + + // Number of remote sessions + UniToStru(tmp, t.NumSessionsRemote); + CtInsert(ct, _UU("SM_ST_NUM_SESSION_REMOTE"), tmp); + } + + // Number of MAC tables + UniToStru(tmp, t.NumMacTables); + CtInsert(ct, _UU("SM_ST_NUM_MAC_TABLE"), tmp); + + // Number of IP tables + UniToStru(tmp, t.NumIpTables); + CtInsert(ct, _UU("SM_ST_NUM_IP_TABLE"), tmp); + + // Number of users + UniToStru(tmp, t.NumUsers); + CtInsert(ct, _UU("SM_ST_NUM_USERS"), tmp); + + // Number of groups + UniToStru(tmp, t.NumGroups); + CtInsert(ct, _UU("SM_ST_NUM_GROUPS"), tmp); + + // Number of assigned licenses + UniToStru(tmp, t.AssignedClientLicenses); + CtInsert(ct, _UU("SM_ST_CLIENT_LICENSE"), tmp); + + UniToStru(tmp, t.AssignedBridgeLicenses); + CtInsert(ct, _UU("SM_ST_BRIDGE_LICENSE"), tmp); + + if (t.ServerType == SERVER_TYPE_FARM_CONTROLLER) + { + UniToStru(tmp, t.AssignedClientLicensesTotal); + CtInsert(ct, _UU("SM_ST_CLIENT_LICENSE_EX"), tmp); + + UniToStru(tmp, t.AssignedBridgeLicensesTotal); + CtInsert(ct, _UU("SM_ST_BRIDGE_LICENSE_EX"), tmp); + } + + // Traffic + CmdInsertTrafficInfo(ct, &t.Traffic); + + // Server start-up time + GetDateTimeStrEx64(tmp, sizeof(tmp), SystemToLocal64(t.StartTime), NULL); + CtInsert(ct, _UU("SM_ST_START_TIME"), tmp); + + // Current time + GetDateTimeStrMilli64(tmp2, sizeof(tmp2), SystemToLocal64(t.CurrentTime)); + StrToUni(tmp, sizeof(tmp), tmp2); + CtInsert(ct, _UU("SM_ST_CURRENT_TIME"), tmp); + + // Tick value + UniFormat(tmp, sizeof(tmp), L"%I64u", t.CurrentTick); + CtInsert(ct, _UU("SM_ST_CURRENT_TICK"), tmp); + + // Memory information + if (t.MemInfo.TotalMemory != 0) + { + char vv[128]; + + ToStr3(vv, sizeof(vv), t.MemInfo.TotalMemory); + UniFormat(tmp, sizeof(tmp), _UU("SM_ST_RAM_SIZE_KB"), vv); + CtInsert(ct, _UU("SM_ST_TOTAL_MEMORY"), tmp); + + ToStr3(vv, sizeof(vv), t.MemInfo.UsedMemory); + UniFormat(tmp, sizeof(tmp), _UU("SM_ST_RAM_SIZE_KB"), vv); + CtInsert(ct, _UU("SM_ST_USED_MEMORY"), tmp); + + ToStr3(vv, sizeof(vv), t.MemInfo.FreeMemory); + UniFormat(tmp, sizeof(tmp), _UU("SM_ST_RAM_SIZE_KB"), vv); + CtInsert(ct, _UU("SM_ST_FREE_MEMORY"), tmp); + + ToStr3(vv, sizeof(vv), t.MemInfo.TotalPhys); + UniFormat(tmp, sizeof(tmp), _UU("SM_ST_RAM_SIZE_KB"), vv); + CtInsert(ct, _UU("SM_ST_TOTAL_PHYS"), tmp); + + ToStr3(vv, sizeof(vv), t.MemInfo.UsedPhys); + UniFormat(tmp, sizeof(tmp), _UU("SM_ST_RAM_SIZE_KB"), vv); + CtInsert(ct, _UU("SM_ST_USED_PHYS"), tmp); + + ToStr3(vv, sizeof(vv), t.MemInfo.FreePhys); + UniFormat(tmp, sizeof(tmp), _UU("SM_ST_RAM_SIZE_KB"), vv); + CtInsert(ct, _UU("SM_ST_FREE_PHYS"), tmp); + } + + CtFree(ct, c); + + FreeParamValueList(o); + + return 0; +} + +// Add traffic information to LVB +void CmdInsertTrafficInfo(CT *ct, TRAFFIC *t) +{ + wchar_t tmp[MAX_SIZE]; + char vv[128]; + // Validate arguments + if (ct == NULL || t == NULL) + { + return; + } + + // Transmission information + ToStr3(vv, sizeof(vv), t->Send.UnicastCount); + UniFormat(tmp, sizeof(tmp), _UU("SM_ST_NUM_PACKET_STR"), vv); + CtInsert(ct, _UU("SM_ST_SEND_UCAST_NUM"), tmp); + + ToStr3(vv, sizeof(vv), t->Send.UnicastBytes); + UniFormat(tmp, sizeof(tmp), _UU("SM_ST_SIZE_BYTE_STR"), vv); + CtInsert(ct, _UU("SM_ST_SEND_UCAST_SIZE"), tmp); + + ToStr3(vv, sizeof(vv), t->Send.BroadcastCount); + UniFormat(tmp, sizeof(tmp), _UU("SM_ST_NUM_PACKET_STR"), vv); + CtInsert(ct, _UU("SM_ST_SEND_BCAST_NUM"), tmp); + + ToStr3(vv, sizeof(vv), t->Send.BroadcastBytes); + UniFormat(tmp, sizeof(tmp), _UU("SM_ST_SIZE_BYTE_STR"), vv); + CtInsert(ct, _UU("SM_ST_SEND_BCAST_SIZE"), tmp); + + // Reception information + ToStr3(vv, sizeof(vv), t->Recv.UnicastCount); + UniFormat(tmp, sizeof(tmp), _UU("SM_ST_NUM_PACKET_STR"), vv); + CtInsert(ct, _UU("SM_ST_RECV_UCAST_NUM"), tmp); + + ToStr3(vv, sizeof(vv), t->Recv.UnicastBytes); + UniFormat(tmp, sizeof(tmp), _UU("SM_ST_SIZE_BYTE_STR"), vv); + CtInsert(ct, _UU("SM_ST_RECV_UCAST_SIZE"), tmp); + + ToStr3(vv, sizeof(vv), t->Recv.BroadcastCount); + UniFormat(tmp, sizeof(tmp), _UU("SM_ST_NUM_PACKET_STR"), vv); + CtInsert(ct, _UU("SM_ST_RECV_BCAST_NUM"), tmp); + + ToStr3(vv, sizeof(vv), t->Recv.BroadcastBytes); + UniFormat(tmp, sizeof(tmp), _UU("SM_ST_SIZE_BYTE_STR"), vv); + CtInsert(ct, _UU("SM_ST_RECV_BCAST_SIZE"), tmp); +} + +// Input a port number +wchar_t *CmdPromptPort(CONSOLE *c, void *param) +{ + wchar_t *prompt_str; + + if (param != NULL) + { + prompt_str = (wchar_t *)param; + } + else + { + prompt_str = _UU("CMD_PROMPT_PORT"); + } + + return c->ReadLine(c, prompt_str, true); +} + +// Verify the port number +bool CmdEvalPort(CONSOLE *c, wchar_t *str, void *param) +{ + UINT i; + // Validate arguments + if (c == NULL || str == NULL) + { + return false; + } + + i = UniToInt(str); + + if (i >= 1 && i <= 65535) + { + return true; + } + + c->Write(c, _UU("CMD_EVAL_PORT")); + + return false; +} + +// ListenerCreate command +UINT PsListenerCreate(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) +{ + LIST *o; + PS *ps = (PS *)param; + UINT ret; + RPC_LISTENER t; + PARAM args[] = + { + {"[port]", CmdPromptPort, _UU("CMD_ListenerCreate_PortPrompt"), CmdEvalPort, NULL}, + }; + + o = ParseCommandList(c, cmd_name, str, args, sizeof(args) / sizeof(args[0])); + if (o == NULL) + { + return ERR_INVALID_PARAMETER; + } + + Zero(&t, sizeof(t)); + t.Enable = true; + t.Port = ToInt(GetParamStr(o, "[port]")); + + ret = ScCreateListener(ps->Rpc, &t); + + if (ret != ERR_NO_ERROR) + { + CmdPrintError(c, ret); + FreeParamValueList(o); + return ret; + } + + FreeParamValueList(o); + + return 0; +} + +// About command +UINT PsAbout(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) +{ + LIST *o; + BUF *b; + + o = ParseCommandList(c, cmd_name, str, NULL, 0); + if (o == NULL) + { + return ERR_INVALID_PARAMETER; + } + + b = ReadDump("|legal.txt"); + + CmdPrintAbout(c); + c->Write(c, L"\r\n"); + + if (b != NULL) + { + wchar_t *s; + + SeekBufToEnd(b); + WriteBufChar(b, 13); + WriteBufChar(b, 10); + WriteBufChar(b, 0); + + s = CopyUtfToUni(b->Buf); + + c->Write(c, s); + + Free(s); + } + + // Display the version information + c->Write(c, _UU("D_ABOUT@S_INFO3")); + c->Write(c, L"\r\n"); + c->Write(c, _UU("D_ABOUT@S_INFO4")); + c->Write(c, L"\r\n"); + CmdPrintAbout(c); + c->Write(c, L"\r\n"); + + FreeParamValueList(o); + + FreeBuf(b); + + return 0; +} + +// Creat a new server management context +PS *NewPs(CONSOLE *c, RPC *rpc, char *servername, UINT serverport, char *hubname, char *adminhub, wchar_t *cmdline) +{ + PS *ps; + // Validate arguments + if (c == NULL || rpc == NULL || servername == NULL) + { + return NULL; + } + + if (IsEmptyStr(hubname)) + { + hubname = NULL; + } + if (IsEmptyStr(adminhub)) + { + adminhub = NULL; + } + if (UniIsEmptyStr(cmdline)) + { + cmdline = NULL; + } + + ps = ZeroMalloc(sizeof(PS)); + ps->ConsoleForServer = true; + ps->ServerPort = serverport; + ps->ServerName = CopyStr(servername); + ps->Console = c; + ps->Rpc = rpc; + ps->HubName = CopyStr(hubname); + ps->LastError = 0; + ps->AdminHub = CopyStr(adminhub); + ps->CmdLine = CopyUniStr(cmdline); + + return ps; +} + +// Release the server management context +void FreePs(PS *ps) +{ + // Validate arguments + if (ps == NULL) + { + return; + } + + Free(ps->HubName); + Free(ps->AdminHub); + Free(ps->CmdLine); + Free(ps->ServerName); + + Free(ps); +} + +// Server Administration Tool +UINT PsConnect(CONSOLE *c, char *host, UINT port, char *hub, char *adminhub, wchar_t *cmdline, char *password) +{ + UINT retcode = 0; + RPC *rpc = NULL; + CEDAR *cedar; + CLIENT_OPTION o; + UCHAR hashed_password[SHA1_SIZE]; + bool b = false; + // Validate arguments + if (c == NULL || host == NULL) + { + return ERR_INVALID_PARAMETER; + } + if (port == 0) + { + port = 443; + } + if (hub != NULL) + { + adminhub = NULL; + } + + cedar = NewCedar(NULL, NULL); + + Zero(&o, sizeof(o)); + UniStrCpy(o.AccountName, sizeof(o.AccountName), L"VPNCMD"); + StrCpy(o.Hostname, sizeof(o.Hostname), host); + o.Port = port; + o.ProxyType = PROXY_DIRECT; + + Sha0(hashed_password, password, StrLen(password)); + + if (IsEmptyStr(password) == false) + { + b = true; + } + + // Connect + while (true) + { + UINT err; + + rpc = AdminConnectEx(cedar, &o, hub, hashed_password, &err, CEDAR_CUI_STR); + if (rpc == NULL) + { + // Failure + retcode = err; + + if (err == ERR_ACCESS_DENIED && c->ProgrammingMode == false) + { + char *pass; + // Password is incorrect + if (b) + { + // Input the password + c->Write(c, _UU("CMD_VPNCMD_PASSWORD_1")); + } + + b = true; + + pass = c->ReadPassword(c, _UU("CMD_VPNCMD_PASSWORD_2")); + c->Write(c, L""); + + if (pass != NULL) + { + Sha0(hashed_password, pass, StrLen(pass)); + Free(pass); + } + else + { + break; + } + } + else + { + // Other errors + CmdPrintError(c, err); + break; + } + } + else + { + PS *ps; + + // Success + ps = NewPs(c, rpc, host, port, hub, adminhub, cmdline); + PsMain(ps); + retcode = ps->LastError; + FreePs(ps); + AdminDisconnect(rpc); + break; + } + } + + ReleaseCedar(cedar); + + return retcode; +} + +// Display the error +void CmdPrintError(CONSOLE *c, UINT err) +{ + wchar_t tmp[MAX_SIZE]; + // Validate arguments + if (c == NULL) + { + return; + } + + UniFormat(tmp, sizeof(tmp), _UU("CMD_VPNCMD_ERROR"), + err, GetUniErrorStr(err)); + c->Write(c, tmp); + + if (err == ERR_DISCONNECTED) + { + c->Write(c, _UU("CMD_DISCONNECTED_MSG")); + } +} + +// Display the version information +void CmdPrintAbout(CONSOLE *c) +{ + CEDAR *cedar; + wchar_t tmp[MAX_SIZE]; + char exe[MAX_PATH]; + // Validate arguments + if (c == NULL) + { + return; + } + + cedar = NewCedar(NULL, NULL); + + GetExeName(exe, sizeof(exe)); + + UniFormat(tmp, sizeof(tmp), _UU("CMD_VPNCMD_ABOUT"), + cedar->VerString, cedar->BuildInfo); + + c->Write(c, tmp); + + ReleaseCedar(cedar); +} + +// Parse the host name and port number (Separated by @) +bool ParseHostPortAtmark(char *src, char **host, UINT *port, UINT default_port) +{ + TOKEN_LIST *t; + bool ret = false; + // Validate arguments + if (src == NULL) + { + return false; + } + + t = ParseToken(src, "@"); + if (t == NULL) + { + return false; + } + + if (port != NULL) + { + *port = 0; + } + + if (default_port == 0) + { + if (t->NumTokens < 2) + { + FreeToken(t); + return false; + } + + if (ToInt(t->Token[1]) == 0) + { + FreeToken(t); + return false; + } + } + + if (t->NumTokens >= 2 && ToInt(t->Token[1]) == 0) + { + FreeToken(t); + return false; + } + + if (t->NumTokens >= 1 && IsEmptyStr(t->Token[0]) == false) + { + ret = true; + + if (host != NULL) + { + *host = CopyStr(t->Token[0]); + Trim(*host); + } + + if (t->NumTokens >= 2) + { + if (port != NULL) + { + *port = ToInt(t->Token[1]); + } + } + } + + if (port != NULL) + { + if (*port == 0) + { + *port = default_port; + } + } + + FreeToken(t); + + return ret; +} + +// Parse the host name and port number +bool ParseHostPort(char *src, char **host, UINT *port, UINT default_port) +{ + TOKEN_LIST *t; + bool ret = false; + // Validate arguments + if (src == NULL) + { + return false; + } + + if (StartWith(src, "[")) + { + if (InStr(src, "]")) + { + // Format of [target]:port + UINT i, n; + char tmp[MAX_SIZE]; + + StrCpy(tmp, sizeof(tmp), src); + + n = SearchStrEx(tmp, "]", 0, false); + if (n != INFINITE) + { + UINT len = StrLen(tmp); + + for (i = n;i < len;i++) + { + if (tmp[i] == ':') + { + tmp[i] = '@'; + } + } + } + + return ParseHostPortAtmark(tmp, host, port, default_port); + } + } + + if (InStr(src, "@")) + { + // It is separated by @ + return ParseHostPortAtmark(src, host, port, default_port); + } + + t = ParseToken(src, ":"); + if (t == NULL) + { + return false; + } + + if (port != NULL) + { + *port = 0; + } + + if (default_port == 0) + { + if (t->NumTokens < 2) + { + FreeToken(t); + return false; + } + + if (ToInt(t->Token[1]) == 0) + { + FreeToken(t); + return false; + } + } + + if (t->NumTokens >= 2 && ToInt(t->Token[1]) == 0) + { + FreeToken(t); + return false; + } + + if (t->NumTokens >= 1 && IsEmptyStr(t->Token[0]) == false) + { + ret = true; + + if (host != NULL) + { + *host = CopyStr(t->Token[0]); + Trim(*host); + } + + if (t->NumTokens >= 2) + { + if (port != NULL) + { + *port = ToInt(t->Token[1]); + } + } + } + + if (port != NULL) + { + if (*port == 0) + { + *port = default_port; + } + } + + FreeToken(t); + + return ret; +} + +// Vpncmd command procedure +UINT VpnCmdProc(CONSOLE *c, char *cmd_name, wchar_t *str, void *param) +{ + LIST *o; + char *target; + bool server = false; + bool client = false; + bool tools = false; + char *hostname = NULL; + char *password; + wchar_t *cmdline; + bool host_inputted = false; + UINT port = 0; + UINT retcode = 0; + PARAM args[] = + { + {"[host:port]", NULL, NULL, NULL, NULL}, + {"CLIENT", NULL, NULL, NULL, NULL}, + {"SERVER", NULL, NULL, NULL, NULL}, + {"TOOLS", NULL, NULL, NULL, NULL}, + {"HUB", NULL, NULL, NULL, NULL}, + {"ADMINHUB", NULL, NULL, NULL, NULL}, + {"PASSWORD", NULL, NULL, NULL, NULL}, + {"IN", NULL, NULL, NULL, NULL}, + {"OUT", NULL, NULL, NULL, NULL}, + {"CMD", NULL, NULL, NULL, NULL}, + {"CSV", NULL, NULL, NULL, NULL}, + {"PROGRAMMING", NULL, NULL, NULL, NULL}, + }; + +#ifdef OS_WIN32 + if (UniStrCmpi(str, L"/debug") == 0) + { + // Debug information write mode + Win32CmdDebug(false); + return 0; + } + if (UniStrCmpi(str, L"/debug_uac") == 0) + { + // Debug information write mode + Win32CmdDebug(true); + return 0; + } +#endif // OS_WIN32 + + if (c->ConsoleType == CONSOLE_LOCAL) + { + // Initialize the execute path information + VpnCmdInitBootPath(); + } + + if(c->ConsoleType != CONSOLE_CSV) + { + CmdPrintAbout(c); + c->Write(c, L""); + } + + o = ParseCommandList(c, cmd_name, str, args, sizeof(args) / sizeof(args[0])); + + if (o == NULL) + { + return ERR_INVALID_PARAMETER; + } + + // Specification of the mode of Tools or Server or Client + if ((GetParamStr(o, "CLIENT") == NULL && GetParamStr(o, "SERVER") == NULL && GetParamStr(o, "TOOLS") == NULL) || + (GetParamStr(o, "CLIENT") != NULL && GetParamStr(o, "SERVER") != NULL && GetParamStr(o, "TOOLS") != NULL)) + { + wchar_t *ret; + UINT code; + // The mode of Tools or Server or Client is not specified + c->Write(c, _UU("CMD_VPNCMD_CS_1")); + + ret = c->ReadLine(c, _UU("CMD_VPNCMD_CS_2"), true); + + code = UniToInt(ret); + Free(ret); + + switch (code) + { + case 1: + // Server + server = true; + break; + + case 2: + // Client + client = true; + break; + + case 3: + // Tools + tools = true; + break; + + default: + // Unspecified + FreeParamValueList(o); + return ERR_USER_CANCEL; + } + + c->Write(c, L""); + } + else + { + if (GetParamStr(o, "SERVER") != NULL) + { + server = true; + } + else if (GetParamStr(o, "CLIENT") != NULL) + { + client = true; + } + else + { + tools = true; + } + } + + // Destination host name + target = CopyStr(GetParamStr(o, "[host:port]")); + + if (target == NULL && tools == false) + { + wchar_t *str; + // Input a host name + if (server) + { + c->Write(c, _UU("CMD_VPNCMD_HOST_1")); + } + else if (client) + { + c->Write(c, _UU("CMD_VPNCMD_HOST_2")); + } + + str = c->ReadLine(c, _UU("CMD_VPNCMD_HOST_3"), true); + c->Write(c, L""); + target = CopyUniToStr(str); + Free(str); + + if (target == NULL) + { + // Cancel + FreeParamValueList(o); + return ERR_USER_CANCEL; + } + + if (IsEmptyStr(target)) + { + Free(target); + target = CopyStr("localhost"); + } + } + else + { + // User specifies a host name + host_inputted = true; + } + + if (tools == false) + { + if (ParseHostPort(target, &hostname, &port, 443) == false) + { + c->Write(c, _UU("CMD_MSG_INVALID_HOSTNAME")); + Free(target); + FreeParamValueList(o); + return ERR_INVALID_PARAMETER; + } + } + + // Password + password = GetParamStr(o, "PASSWORD"); + if (password == NULL) + { + password = ""; + } + + // Command line + cmdline = GetParamUniStr(o, "CMD"); + + if (server) + { + // Process as the server + char *hub; + char *adminhub = NULL; + + hub = CopyStr(GetParamStr(o, "HUB")); + adminhub = GetParamStr(o, "ADMINHUB"); + + // Decide the Virtual HUB to be specified in the Virtual HUB management mode + if (hub == NULL) + { + if (host_inputted == false) + { + wchar_t *s; + // If the user does not specify a host name on the command line, + // get also a Virtual HUB name by displaying the prompt + c->Write(c, _UU("CMD_VPNCMD_HUB_1")); + + s = c->ReadLine(c, _UU("CMD_VPNCMD_HUB_2"), true); + + hub = CopyUniToStr(s); + Free(s); + } + } + + if (IsEmptyStr(hub)) + { + Free(hub); + hub = NULL; + } + if (IsEmptyStr(adminhub)) + { + adminhub = NULL; + } + + retcode = PsConnect(c, hostname, port, hub, adminhub, cmdline, password); + + Free(hub); + } + else if (client) + { + // Treated as a client + Trim(target); + + retcode = PcConnect(c, target, cmdline, password); + } + else if (tools) + { + // Treated as a VPN Tools + retcode = PtConnect(c, cmdline); + } + + Free(hostname); + Free(target); + FreeParamValueList(o); + + return retcode; +} + +// Entry point of vpncmd +UINT CommandMain(wchar_t *command_line) +{ + UINT ret = 0; + wchar_t *infile, *outfile; + char *a_infile, *a_outfile; + wchar_t *csvmode; + wchar_t *programming_mode; + CONSOLE *c; + + // Validate arguments + if (command_line == NULL) + { + return ERR_INVALID_PARAMETER; + } + + // Look ahead only items of /in and /out + infile = ParseCommand(command_line, L"in"); + outfile = ParseCommand(command_line, L"out"); + if (UniIsEmptyStr(infile)) + { + Free(infile); + infile = NULL; + } + if (UniIsEmptyStr(outfile)) + { + Free(outfile); + outfile = NULL; + } + + a_infile = CopyUniToStr(infile); + a_outfile = CopyUniToStr(outfile); + + // Allocate the local console + c = NewLocalConsole(infile, outfile); + if (c != NULL) + { + // Definition of commands of vpncmd + CMD cmd[] = + { + {"vpncmd", VpnCmdProc}, + }; + + // Read ahead to check the CSV mode + csvmode = ParseCommand(command_line, L"csv"); + if(csvmode != NULL) + { + Free(csvmode); + c->ConsoleType = CONSOLE_CSV; + } + + programming_mode = ParseCommand(command_line, L"programming"); + if (programming_mode != NULL) + { + Free(programming_mode); + c->ProgrammingMode = true; + } + + if (DispatchNextCmdEx(c, command_line, ">", cmd, sizeof(cmd) / sizeof(cmd[0]), NULL) == false) + { + ret = ERR_INVALID_PARAMETER; + } + else + { + ret = c->RetCode; + } + + // Release the local console + c->Free(c); + } + else + { + Print("Error: Couldn't open local console.\n"); + } + + Free(a_infile); + Free(a_outfile); + Free(infile); + Free(outfile); + + return ret; +} + +#ifdef OS_WIN32 +// Debug information write mode +void Win32CmdDebug(bool is_uac) +{ + wchar_t *dst; + wchar_t def_filename[MAX_SIZE]; + SYSTEMTIME st; + + InitWinUi(_UU("CMD_DEBUG_SOFTNAME"), NULL, 0); + + UniPrint(_UU("CMD_DEBUG_PRINT")); + + if (MsIsWin2000OrGreater() == false) + { + MsgBox(NULL, 0x00000040L, _UU("CMD_DEBUG_NOT_2000")); + goto LABEL_CLEANUP; + } + + if ((MsIsVista() == false || is_uac) && MsIsAdmin() == false) + { + MsgBox(NULL, 0x00000040L, _UU("CMD_DEBUG_NOT_ADMIN")); + goto LABEL_CLEANUP; + } + + if (MsIsVista() && MsIsAdmin() == false) + { + void *process_handle = NULL; + + // Launch myself using the UAC + if (MsExecuteEx2W(MsGetExeFileNameW(), L"/debug_uac", &process_handle, true) == false) + { + MsgBox(NULL, 0x00000030L, _UU("CMD_DEBUG_UAC_FAILED")); + return; + } + + MsCloseHandle(process_handle); + goto LABEL_CLEANUP; + } + + LocalTime(&st); + + UniFormat(def_filename, sizeof(def_filename), L"vpn_debuginfo_%04u%02u%02u_%02u%02u%02u.zip", + st.wYear, st.wMonth, st.wDay, st.wHour, st.wMinute, st.wSecond); + + // Specify the destination + dst = SaveDlg(NULL, _UU("DLG_ZIP_FILER"), _UU("CMD_DEBUG_SAVE_TITLE"), def_filename, L".zip"); + if (dst != NULL) + { + if (MsSaveSystemInfo(dst) == false) + { + // Failure + MsgBoxEx(NULL, 0x00000030L, _UU("CMD_DEBUG_NG"), dst); + } + else + { + // Success + MsgBoxEx(NULL, 0x00000040L, _UU("CMD_DEBUG_OK"), dst); + } + + Free(dst); + } + +LABEL_CLEANUP: + FreeWinUi(); +} + +#endif // OS_WIN32 + diff --git a/src/Cedar/Command.h b/src/Cedar/Command.h index 8e0b4943..01d7497e 100644 --- a/src/Cedar/Command.h +++ b/src/Cedar/Command.h @@ -1,599 +1,599 @@ -// SoftEther VPN Source Code - Developer Edition Master Branch -// Cedar Communication Module -// © 2020 Nokia - -// Command.h -// Header of Command.c - -#ifndef COMMAND_H -#define COMMAND_H - -// Constants -#define TRAFFIC_DEFAULT_PORT 9821 -#define TRAFFIC_NUMTCP_MAX 32 -#define TRAFFIC_NUMTCP_DEFAULT 32 -#define TRAFFIC_SPAN_DEFAULT 15 -#define TRAFFIC_TYPE_DOWNLOAD 1 -#define TRAFFIC_TYPE_UPLOAD 2 -#define TRAFFIC_TYPE_FULL 0 -#define TRAFFIC_BUF_SIZE 65535 -#define TRAFFIC_VER_STR_SIZE 16 -#define TRAFFIC_VER_STR "TrafficServer\r\n" - -// Constants for Win32 -#define VPNCMD_BOOTSTRAP_REG_KEYNAME "Software\\" GC_REG_COMPANY_NAME "\\VPN Command Line Utility" -#define VPNCMD_BOOTSTRAP_REG_VALUENAME_VER "InstalledVersion" -#define VPNCMD_BOOTSTRAP_REG_VALUENAME_PATH "InstalledPath" -#define VPNCMD_BOOTSTRAP_FILENAME "|vpncmdsys.exe" - - -// Traffic test results -struct TT_RESULT -{ - bool Raw; // Whether raw data - bool Double; // Whether it is doubled - UINT64 NumBytesUpload; // Uploaded size - UINT64 NumBytesDownload; // Downloaded size - UINT64 NumBytesTotal; // Total size - UINT64 Span; // Period (in milliseconds) - UINT64 BpsUpload; // Upload throughput - UINT64 BpsDownload; // Download throughput - UINT64 BpsTotal; // Total throughput -}; - -// Text display function -typedef void (TT_PRINT_PROC)(void *param, wchar_t *str); - -// Client side socket -struct TTC_SOCK -{ - SOCK *Sock; // Socket - UINT State; // State - UINT64 NumBytes; // Transmitted bytes - bool Download; // Download socket - bool ServerUploadReportReceived; // Complete to receive the report of upload amount from the server - UINT64 NextSendRequestReportTick; // Time to request a next report - UINT Id; - bool HideErrMsg; -}; - -// Traffic test Client -struct TTC -{ - TT_PRINT_PROC *Print; // Text display function - void *Param; // Any parameters - bool Double; // Double mode - bool Raw; // Raw data mode - UINT Port; // Port number - char Host[MAX_HOST_NAME_LEN + 1]; // Host name - UINT NumTcp; // Number of TCP connections - UINT Type; // Type - UINT64 Span; // Period - UINT64 RealSpan; // The actual span - THREAD *Thread; // Thread - volatile bool Halt; // Halting flag - bool *Cancel; // Halting flag 2 - LIST *ItcSockList; // Client socket list - TT_RESULT Result; // Result - UINT ErrorCode; // Error code - bool AbnormalTerminated; // Abnormal termination - EVENT *StartEvent; // Start event - EVENT *InitedEvent; // Initialize completion notification event - LIST *WorkerThreadList; // List of worker threads - - UINT flag1, flag2; - - UINT64 session_id; - UINT64 end_tick; - UINT64 start_tick; -}; - -// Traffic test worker thread -struct TTC_WORKER -{ - THREAD *WorkerThread; - TTC *Ttc; - LIST *SockList; // Client socket list - SOCK_EVENT *SockEvent; // Socket event - EVENT *StartEvent; // Start event - bool Ok; // The result -}; - -// Server side socket -struct TTS_SOCK -{ - SOCK *Sock; // Socket - UINT State; // State - UINT64 NumBytes; // Transmitted bytes - bool SockJoined; // Whether it has been added to the event - UINT Id; // ID - UINT64 LastWaitTick; // Retry waiting time to notify the size information to the client - UINT64 SessionId; // Session ID - bool NoMoreSendData; // Flag not to send more data - UINT64 FirstRecvTick; // Time which the data has been received last - UINT64 FirstSendTick; // Time which the data has been sent last - UINT64 Span; // Period - UINT64 GiveupSpan; - UINT64 LastCommTime; -}; - -// Traffic test server -struct TTS -{ - TT_PRINT_PROC *Print; // Text display function - void *Param; // Any parameters - volatile bool Halt; // Halting flag - UINT Port; // Port number - THREAD *Thread; // Thread - THREAD *IPv6AcceptThread; // IPv6 Accept thread - SOCK *ListenSocket; // Socket to wait - SOCK *ListenSocketV6; // Socket to wait (IPv6) - UINT ErrorCode; // Error code - UINT IdSeed; // ID value - LIST *WorkerList; // Worker threads list -}; - -// Traffic test worker thread -struct TTS_WORKER -{ - TTS *Tts; // TTS - THREAD *WorkThread; // Worker thread - SOCK_EVENT *SockEvent; // Socket event - LIST *TtsSockList; // Server socket list - bool NewSocketArrived; // New socket has arrived -}; - -// VPN Tools context -struct PT -{ - CONSOLE *Console; // Console - UINT LastError; // Last error - wchar_t *CmdLine; // Command line to execute -}; - -// Server management context -struct PS -{ - bool ConsoleForServer; // Console for the server (always true) - CONSOLE *Console; // Console - RPC *Rpc; // RPC - char *ServerName; // Server name - UINT ServerPort; // Port number - char *HubName; // Virtual HUB name in the currently managed - UINT LastError; // Last error - char *AdminHub; // Virtual HUB to be managed by default - wchar_t *CmdLine; // Command line to execute - CAPSLIST *CapsList; // Caps list -}; - -// Client management context -struct PC -{ - bool ConsoleForServer; // Console for the server (always false) - CONSOLE *Console; // Console - REMOTE_CLIENT *RemoteClient; // Remote client - char *ServerName; // Server name - UINT LastError; // Last error - wchar_t *CmdLine; // Command line -}; - -// A column of the table -struct CTC -{ - wchar_t *String; // String - bool Right; // Right justification -}; - -// A row of the table -struct CTR -{ - wchar_t **Strings; // String list -}; - -// Table for console -struct CT -{ - LIST *Columns; // Column list - LIST *Rows; // Row list -}; - -UINT CommandMain(wchar_t *command_line); -UINT VpnCmdProc(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); -bool ParseHostPort(char *src, char **host, UINT *port, UINT default_port); -bool ParseHostPortAtmark(char *src, char **host, UINT *port, UINT default_port); -CT *CtNew(); -void CtFree(CT *ct, CONSOLE *c); -void CtFreeEx(CT *ct, CONSOLE *c, bool standard_view); -void CtInsertColumn(CT *ct, wchar_t *str, bool right); -CT *CtNewStandard(); -CT *CtNewStandardEx(); -void CtInsert(CT *ct, ...); -void CtPrint(CT *ct, CONSOLE *c); -void CtPrintStandard(CT *ct, CONSOLE *c); -void CtPrintRow(CONSOLE *c, UINT num, UINT *widths, wchar_t **strings, bool *rights, char separate_char); -void VpnCmdInitBootPath(); - -void CmdPrintError(CONSOLE *c, UINT err); -void CmdPrintAbout(CONSOLE *c); -wchar_t *CmdPromptPort(CONSOLE *c, void *param); -wchar_t *CmdPromptChoosePassword(CONSOLE *c, void *param); -bool CmdEvalPort(CONSOLE *c, wchar_t *str, void *param); -void CmdInsertTrafficInfo(CT *ct, TRAFFIC *t); -wchar_t *GetHubTypeStr(UINT type); -wchar_t *GetServerTypeStr(UINT type); -char *CmdPasswordPrompt(CONSOLE *c); -bool CmdEvalIp(CONSOLE *c, wchar_t *str, void *param); -wchar_t *PsClusterSettingMemberPromptIp(CONSOLE *c, void *param); -bool CmdEvalHostAndPort(CONSOLE *c, wchar_t *str, void *param); -LIST *StrToPortList(char *str, bool limit_range); -bool CmdEvalPortList(CONSOLE *c, wchar_t *str, void *param); -wchar_t *PsClusterSettingMemberPromptPorts(CONSOLE *c, void *param); -K *CmdLoadKey(CONSOLE *c, wchar_t *filename); -bool CmdLoadCertAndKey(CONSOLE *c, X **xx, K **kk, wchar_t *cert_filename, wchar_t *key_filename); -bool CmdEvalTcpOrUdp(CONSOLE *c, wchar_t *str, void *param); -wchar_t *GetConnectionTypeStr(UINT type); -bool CmdEvalHostAndSubnetMask4(CONSOLE *c, wchar_t *str, void *param); -bool CmdEvalNetworkAndSubnetMask4(CONSOLE *c, wchar_t *str, void *param); -bool CmdEvalIpAndMask4(CONSOLE *c, wchar_t *str, void *param); -bool CmdEvalIpAndMask6(CONSOLE *c, wchar_t *str, void *param); -wchar_t *GetLogSwitchStr(UINT i); -wchar_t *GetPacketLogNameStr(UINT i); -UINT StrToLogSwitchType(char *str); -UINT StrToPacketLogType(char *str); -UINT StrToPacketLogSaveInfoType(char *str); -wchar_t *GetProxyTypeStr(UINT i); -wchar_t *GetClientAuthTypeStr(UINT i); -void PrintPolicyList(CONSOLE *c, char *name); -void PrintPolicy(CONSOLE *c, POLICY *pol, bool cascade_mode); -bool EditPolicy(CONSOLE *c, POLICY *pol, char *name, char *value, bool cascade_mode); -void CmdPrintStatusToListView(CT *ct, RPC_CLIENT_GET_CONNECTION_STATUS *s); -void CmdPrintStatusToListViewEx(CT *ct, RPC_CLIENT_GET_CONNECTION_STATUS *s, bool server_mode); -bool CmdEvalPassOrDiscard(CONSOLE *c, wchar_t *str, void *param); -bool StrToPassOrDiscard(char *str); -bool CmdEvalProtocol(CONSOLE *c, wchar_t *str, void *param); -UINT StrToProtocol(char *str); -bool CmdEvalPortRange(CONSOLE *c, wchar_t *str, void *param); -bool ParsePortRange(char *str, UINT *start, UINT *end); -wchar_t *GetAuthTypeStr(UINT id); -UINT64 StrToDateTime64(char *str); -bool CmdEvalDateTime(CONSOLE *c, wchar_t *str, void *param); -void CmdPrintNodeInfo(CT *ct, NODE_INFO *info); -wchar_t *GetProtocolName(UINT n); -void CmdGenerateImportName(REMOTE_CLIENT *r, wchar_t *name, UINT size, wchar_t *old_name); -bool CmdIsAccountName(REMOTE_CLIENT *r, wchar_t *name); -wchar_t *GetSyslogSettingName(UINT n); - - -void TtPrint(void *param, TT_PRINT_PROC *print_proc, wchar_t *str); -void TtGenerateRandomData(UCHAR **buf, UINT *size); -void TtsWorkerThread(THREAD *thread, void *param); -void TtsListenThread(THREAD *thread, void *param); -void TtsAcceptProc(TTS *tts, SOCK *listen_socket); -void TtsIPv6AcceptThread(THREAD *thread, void *param); -wchar_t *GetTtcTypeStr(UINT type); -void TtcPrintSummary(TTC *ttc); -void StopTtc(TTC *ttc); -void TtcGenerateResult(TTC *ttc); -void TtcThread(THREAD *thread, void *param); -TTC *NewTtcEx(char *host, UINT port, UINT numtcp, UINT type, UINT64 span, bool dbl, bool raw, TT_PRINT_PROC *print_proc, void *param, EVENT *start_event, bool *cancel); -TTC *NewTtc(char *host, UINT port, UINT numtcp, UINT type, UINT64 span, bool dbl, bool raw, TT_PRINT_PROC *print_proc, void *param); -UINT FreeTtc(TTC *ttc, TT_RESULT *result); -TTS *NewTts(UINT port, void *param, TT_PRINT_PROC *print_proc); -UINT FreeTts(TTS *tts); -void PtTrafficPrintProc(void *param, wchar_t *str); -void TtcPrintResult(CONSOLE *c, TT_RESULT *res); - - -bool SystemCheck(); -bool CheckKernel(); -bool CheckMemory(); -bool CheckStrings(); -bool CheckFileSystem(); -bool CheckThread(); -bool CheckNetwork(); -void InputToNull(void *p); -UINT RetZero(); - -void Win32CmdDebug(bool is_uac); - - -UINT PtConnect(CONSOLE *c, wchar_t *cmdline); -PT *NewPt(CONSOLE *c, wchar_t *cmdline); -void FreePt(PT *pt); -void PtMain(PT *pt); -UINT PtMakeCert(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); -UINT PtMakeCert2048(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); -UINT PtTrafficClient(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); -UINT PtTrafficServer(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); -UINT PtCheck(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); - - -UINT PcConnect(CONSOLE *c, char *target, wchar_t *cmdline, char *password); -PC *NewPc(CONSOLE *c, REMOTE_CLIENT *remote_client, char *servername, wchar_t *cmdline); -void FreePc(PC *pc); -void PcMain(PC *pc); -UINT PcAbout(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); -UINT PcVersionGet(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); -UINT PcPasswordSet(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); -UINT PcPasswordGet(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); -UINT PcCertList(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); -UINT PcCertAdd(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); -UINT PcCertDelete(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); -UINT PcCertGet(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); -UINT PcSecureList(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); -UINT PcSecureSelect(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); -UINT PcSecureGet(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); -UINT PcNicCreate(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); -UINT PcNicDelete(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); -UINT PcNicUpgrade(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); -UINT PcNicGetSetting(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); -UINT PcNicSetSetting(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); -UINT PcNicEnable(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); -UINT PcNicDisable(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); -UINT PcNicList(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); -UINT PcAccountList(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); -UINT PcAccountCreate(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); -UINT PcAccountSet(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); -UINT PcAccountGet(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); -UINT PcAccountDelete(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); -UINT PcAccountUsernameSet(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); -UINT PcAccountAnonymousSet(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); -UINT PcAccountPasswordSet(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); -UINT PcAccountCertSet(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); -UINT PcAccountCertGet(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); -UINT PcAccountEncryptDisable(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); -UINT PcAccountEncryptEnable(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); -UINT PcAccountCompressEnable(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); -UINT PcAccountCompressDisable(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); -UINT PcAccountHttpHeaderAdd(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); -UINT PcAccountHttpHeaderDelete(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); -UINT PcAccountHttpHeaderGet(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); -UINT PcAccountProxyNone(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); -UINT PcAccountProxyHttp(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); -UINT PcAccountProxySocks(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); -UINT PcAccountProxySocks5(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); -UINT PcAccountServerCertEnable(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); -UINT PcAccountServerCertDisable(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); -UINT PcAccountRetryOnServerCertEnable(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); -UINT PcAccountRetryOnServerCertDisable(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); -UINT PcAccountServerCertSet(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); -UINT PcAccountServerCertDelete(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); -UINT PcAccountServerCertGet(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); -UINT PcAccountDetailSet(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); -UINT PcAccountRename(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); -UINT PcAccountConnect(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); -UINT PcAccountDisconnect(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); -UINT PcAccountStatusGet(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); -UINT PcAccountNicSet(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); -UINT PcAccountStatusShow(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); -UINT PcAccountStatusHide(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); -UINT PcAccountSecureCertSet(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); -UINT PcAccountOpensslEngineCertSet(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); -UINT PcAccountRetrySet(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); -UINT PcAccountStartupSet(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); -UINT PcAccountStartupRemove(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); -UINT PcAccountExport(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); -UINT PcAccountImport(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); -UINT PcRemoteEnable(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); -UINT PcRemoteDisable(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); -UINT PcKeepEnable(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); -UINT PcKeepDisable(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); -UINT PcKeepSet(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); -UINT PcKeepGet(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); - - -PS *NewPs(CONSOLE *c, RPC *rpc, char *servername, UINT serverport, char *hubname, char *adminhub, wchar_t *cmdline); -void FreePs(PS *ps); -UINT PsConnect(CONSOLE *c, char *host, UINT port, char *hub, char *adminhub, wchar_t *cmdline, char *password); -void PsMain(PS *ps); -UINT PsAbout(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); -UINT PsServerInfoGet(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); -UINT PsServerStatusGet(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); -UINT PsListenerCreate(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); -UINT PsListenerDelete(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); -UINT PsListenerList(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); -UINT PsListenerEnable(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); -UINT PsListenerDisable(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); -UINT PsPortsUDPSet(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); -UINT PsPortsUDPGet(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); -UINT PsProtoOptionsSet(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); -UINT PsProtoOptionsGet(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); -UINT PsServerPasswordSet(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); -UINT PsClusterSettingGet(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); -UINT PsClusterSettingStandalone(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); -UINT PsClusterSettingController(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); -UINT PsClusterSettingMember(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); -UINT PsClusterMemberList(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); -UINT PsClusterMemberInfoGet(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); -UINT PsClusterMemberCertGet(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); -UINT PsClusterConnectionStatusGet(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); -UINT PsCrash(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); -UINT PsFlush(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); -UINT PsDebug(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); -UINT PsServerCertGet(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); -UINT PsServerKeyGet(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); -UINT PsServerCertSet(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); -UINT PsServerCipherGet(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); -UINT PsServerCipherSet(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); -UINT PsKeepEnable(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); -UINT PsKeepDisable(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); -UINT PsKeepSet(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); -UINT PsKeepGet(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); -UINT PsSyslogGet(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); -UINT PsSyslogDisable(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); -UINT PsSyslogEnable(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); -UINT PsConnectionList(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); -UINT PsConnectionGet(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); -UINT PsConnectionDisconnect(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); -UINT PsBridgeDeviceList(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); -UINT PsBridgeList(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); -UINT PsBridgeCreate(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); -UINT PsBridgeDelete(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); -UINT PsCaps(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); -UINT PsReboot(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); -UINT PsConfigGet(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); -UINT PsConfigSet(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); -UINT PsRouterList(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); -UINT PsRouterAdd(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); -UINT PsRouterDelete(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); -UINT PsRouterStart(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); -UINT PsRouterStop(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); -UINT PsRouterIfList(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); -UINT PsRouterIfAdd(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); -UINT PsRouterIfDel(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); -UINT PsRouterTableList(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); -UINT PsRouterTableAdd(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); -UINT PsRouterTableDel(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); -UINT PsLogFileList(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); -UINT PsLogFileGet(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); -UINT PsHubCreate(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); -UINT PsHubCreateDynamic(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); -UINT PsHubCreateStatic(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); -UINT PsHubDelete(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); -UINT PsHubSetStatic(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); -UINT PsHubSetDynamic(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); -UINT PsHubList(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); -UINT PsHub(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); -UINT PsOnline(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); -UINT PsOffline(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); -UINT PsSetMaxSession(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); -UINT PsSetHubPassword(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); -UINT PsSetEnumAllow(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); -UINT PsSetEnumDeny(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); -UINT PsOptionsGet(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); -UINT PsRadiusServerSet(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); -UINT PsRadiusServerDelete(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); -UINT PsRadiusServerGet(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); -UINT PsStatusGet(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); -UINT PsLogGet(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); -UINT PsLogEnable(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); -UINT PsLogDisable(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); -UINT PsLogSwitchSet(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); -UINT PsLogPacketSaveType(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); -UINT PsCAList(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); -UINT PsCAAdd(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); -UINT PsCADelete(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); -UINT PsCAGet(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); -UINT PsCascadeList(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); -UINT PsCascadeCreate(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); -UINT PsCascadeSet(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); -UINT PsCascadeGet(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); -UINT PsCascadeDelete(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); -UINT PsCascadeUsernameSet(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); -UINT PsCascadeAnonymousSet(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); -UINT PsCascadePasswordSet(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); -UINT PsCascadeCertSet(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); -UINT PsCascadeCertGet(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); -UINT PsCascadeEncryptEnable(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); -UINT PsCascadeEncryptDisable(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); -UINT PsCascadeCompressEnable(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); -UINT PsCascadeCompressDisable(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); -UINT PsCascadeHttpHeaderAdd(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); -UINT PsCascadeHttpHeaderDelete(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); -UINT PsCascadeHttpHeaderGet(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); -UINT PsCascadeProxyNone(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); -UINT PsCascadeProxyHttp(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); -UINT PsCascadeProxySocks(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); -UINT PsCascadeProxySocks5(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); -UINT PsCascadeServerCertEnable(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); -UINT PsCascadeServerCertDisable(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); -UINT PsCascadeServerCertSet(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); -UINT PsCascadeServerCertDelete(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); -UINT PsCascadeServerCertGet(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); -UINT PsCascadeDetailSet(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); -UINT PsCascadePolicyRemove(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); -UINT PsCascadePolicySet(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); -UINT PsPolicyList(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); -UINT PsCascadeStatusGet(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); -UINT PsCascadeRename(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); -UINT PsCascadeOnline(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); -UINT PsCascadeOffline(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); -UINT PsAccessAdd(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); -UINT PsAccessAddEx(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); -UINT PsAccessAdd6(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); -UINT PsAccessAddEx6(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); -UINT PsAccessList(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); -UINT PsAccessDelete(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); -UINT PsAccessEnable(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); -UINT PsAccessDisable(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); -UINT PsUserList(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); -UINT PsUserCreate(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); -UINT PsUserSet(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); -UINT PsUserDelete(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); -UINT PsUserGet(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); -UINT PsUserAnonymousSet(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); -UINT PsUserPasswordSet(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); -UINT PsUserCertSet(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); -UINT PsUserCertGet(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); -UINT PsUserSignedSet(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); -UINT PsUserRadiusSet(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); -UINT PsUserNTLMSet(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); -UINT PsUserPolicyRemove(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); -UINT PsUserPolicySet(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); -UINT PsUserExpiresSet(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); -UINT PsGroupList(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); -UINT PsGroupCreate(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); -UINT PsGroupSet(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); -UINT PsGroupDelete(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); -UINT PsGroupGet(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); -UINT PsGroupJoin(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); -UINT PsGroupUnjoin(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); -UINT PsGroupPolicyRemove(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); -UINT PsGroupPolicySet(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); -UINT PsSessionList(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); -UINT PsSessionGet(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); -UINT PsSessionDisconnect(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); -UINT PsMacTable(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); -UINT PsMacDelete(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); -UINT PsIpTable(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); -UINT PsIpDelete(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); -UINT PsSecureNatEnable(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); -UINT PsSecureNatDisable(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); -UINT PsSecureNatStatusGet(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); -UINT PsSecureNatHostGet(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); -UINT PsSecureNatHostSet(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); -UINT PsNatGet(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); -UINT PsNatEnable(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); -UINT PsNatDisable(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); -UINT PsNatSet(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); -UINT PsNatTable(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); -UINT PsDhcpGet(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); -UINT PsDhcpEnable(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); -UINT PsDhcpDisable(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); -UINT PsDhcpSet(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); -UINT PsDhcpTable(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); -UINT PsAdminOptionList(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); -UINT PsAdminOptionSet(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); -UINT PsExtOptionList(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); -UINT PsExtOptionSet(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); -UINT PsCrlList(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); -UINT PsCrlAdd(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); -UINT PsCrlDel(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); -UINT PsCrlGet(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); -UINT PsAcList(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); -UINT PsAcAdd(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); -UINT PsAcAdd6(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); -UINT PsAcGet(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); -UINT PsAcDel(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); -UINT PsLicenseAdd(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); -UINT PsLicenseDel(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); -UINT PsLicenseList(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); -UINT PsLicenseStatus(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); -UINT PsIPsecEnable(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); -UINT PsIPsecGet(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); -UINT PsEtherIpClientAdd(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); -UINT PsEtherIpClientDelete(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); -UINT PsEtherIpClientList(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); -UINT PsOpenVpnMakeConfig(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); -UINT PsServerCertRegenerate(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); -UINT PsVpnOverIcmpDnsEnable(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); -UINT PsVpnOverIcmpDnsGet(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); -UINT PsDynamicDnsGetStatus(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); -UINT PsDynamicDnsSetHostname(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); -UINT PsVpnAzureSetEnable(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); -UINT PsVpnAzureGetStatus(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); - - -#endif // COMMAND_H - - +// SoftEther VPN Source Code - Developer Edition Master Branch +// Cedar Communication Module +// © 2020 Nokia + +// Command.h +// Header of Command.c + +#ifndef COMMAND_H +#define COMMAND_H + +// Constants +#define TRAFFIC_DEFAULT_PORT 9821 +#define TRAFFIC_NUMTCP_MAX 32 +#define TRAFFIC_NUMTCP_DEFAULT 32 +#define TRAFFIC_SPAN_DEFAULT 15 +#define TRAFFIC_TYPE_DOWNLOAD 1 +#define TRAFFIC_TYPE_UPLOAD 2 +#define TRAFFIC_TYPE_FULL 0 +#define TRAFFIC_BUF_SIZE 65535 +#define TRAFFIC_VER_STR_SIZE 16 +#define TRAFFIC_VER_STR "TrafficServer\r\n" + +// Constants for Win32 +#define VPNCMD_BOOTSTRAP_REG_KEYNAME "Software\\" GC_REG_COMPANY_NAME "\\VPN Command Line Utility" +#define VPNCMD_BOOTSTRAP_REG_VALUENAME_VER "InstalledVersion" +#define VPNCMD_BOOTSTRAP_REG_VALUENAME_PATH "InstalledPath" +#define VPNCMD_BOOTSTRAP_FILENAME "|vpncmdsys.exe" + + +// Traffic test results +struct TT_RESULT +{ + bool Raw; // Whether raw data + bool Double; // Whether it is doubled + UINT64 NumBytesUpload; // Uploaded size + UINT64 NumBytesDownload; // Downloaded size + UINT64 NumBytesTotal; // Total size + UINT64 Span; // Period (in milliseconds) + UINT64 BpsUpload; // Upload throughput + UINT64 BpsDownload; // Download throughput + UINT64 BpsTotal; // Total throughput +}; + +// Text display function +typedef void (TT_PRINT_PROC)(void *param, wchar_t *str); + +// Client side socket +struct TTC_SOCK +{ + SOCK *Sock; // Socket + UINT State; // State + UINT64 NumBytes; // Transmitted bytes + bool Download; // Download socket + bool ServerUploadReportReceived; // Complete to receive the report of upload amount from the server + UINT64 NextSendRequestReportTick; // Time to request a next report + UINT Id; + bool HideErrMsg; +}; + +// Traffic test Client +struct TTC +{ + TT_PRINT_PROC *Print; // Text display function + void *Param; // Any parameters + bool Double; // Double mode + bool Raw; // Raw data mode + UINT Port; // Port number + char Host[MAX_HOST_NAME_LEN + 1]; // Host name + UINT NumTcp; // Number of TCP connections + UINT Type; // Type + UINT64 Span; // Period + UINT64 RealSpan; // The actual span + THREAD *Thread; // Thread + volatile bool Halt; // Halting flag + bool *Cancel; // Halting flag 2 + LIST *ItcSockList; // Client socket list + TT_RESULT Result; // Result + UINT ErrorCode; // Error code + bool AbnormalTerminated; // Abnormal termination + EVENT *StartEvent; // Start event + EVENT *InitedEvent; // Initialize completion notification event + LIST *WorkerThreadList; // List of worker threads + + UINT flag1, flag2; + + UINT64 session_id; + UINT64 end_tick; + UINT64 start_tick; +}; + +// Traffic test worker thread +struct TTC_WORKER +{ + THREAD *WorkerThread; + TTC *Ttc; + LIST *SockList; // Client socket list + SOCK_EVENT *SockEvent; // Socket event + EVENT *StartEvent; // Start event + bool Ok; // The result +}; + +// Server side socket +struct TTS_SOCK +{ + SOCK *Sock; // Socket + UINT State; // State + UINT64 NumBytes; // Transmitted bytes + bool SockJoined; // Whether it has been added to the event + UINT Id; // ID + UINT64 LastWaitTick; // Retry waiting time to notify the size information to the client + UINT64 SessionId; // Session ID + bool NoMoreSendData; // Flag not to send more data + UINT64 FirstRecvTick; // Time which the data has been received last + UINT64 FirstSendTick; // Time which the data has been sent last + UINT64 Span; // Period + UINT64 GiveupSpan; + UINT64 LastCommTime; +}; + +// Traffic test server +struct TTS +{ + TT_PRINT_PROC *Print; // Text display function + void *Param; // Any parameters + volatile bool Halt; // Halting flag + UINT Port; // Port number + THREAD *Thread; // Thread + THREAD *IPv6AcceptThread; // IPv6 Accept thread + SOCK *ListenSocket; // Socket to wait + SOCK *ListenSocketV6; // Socket to wait (IPv6) + UINT ErrorCode; // Error code + UINT IdSeed; // ID value + LIST *WorkerList; // Worker threads list +}; + +// Traffic test worker thread +struct TTS_WORKER +{ + TTS *Tts; // TTS + THREAD *WorkThread; // Worker thread + SOCK_EVENT *SockEvent; // Socket event + LIST *TtsSockList; // Server socket list + bool NewSocketArrived; // New socket has arrived +}; + +// VPN Tools context +struct PT +{ + CONSOLE *Console; // Console + UINT LastError; // Last error + wchar_t *CmdLine; // Command line to execute +}; + +// Server management context +struct PS +{ + bool ConsoleForServer; // Console for the server (always true) + CONSOLE *Console; // Console + RPC *Rpc; // RPC + char *ServerName; // Server name + UINT ServerPort; // Port number + char *HubName; // Virtual HUB name in the currently managed + UINT LastError; // Last error + char *AdminHub; // Virtual HUB to be managed by default + wchar_t *CmdLine; // Command line to execute + CAPSLIST *CapsList; // Caps list +}; + +// Client management context +struct PC +{ + bool ConsoleForServer; // Console for the server (always false) + CONSOLE *Console; // Console + REMOTE_CLIENT *RemoteClient; // Remote client + char *ServerName; // Server name + UINT LastError; // Last error + wchar_t *CmdLine; // Command line +}; + +// A column of the table +struct CTC +{ + wchar_t *String; // String + bool Right; // Right justification +}; + +// A row of the table +struct CTR +{ + wchar_t **Strings; // String list +}; + +// Table for console +struct CT +{ + LIST *Columns; // Column list + LIST *Rows; // Row list +}; + +UINT CommandMain(wchar_t *command_line); +UINT VpnCmdProc(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); +bool ParseHostPort(char *src, char **host, UINT *port, UINT default_port); +bool ParseHostPortAtmark(char *src, char **host, UINT *port, UINT default_port); +CT *CtNew(); +void CtFree(CT *ct, CONSOLE *c); +void CtFreeEx(CT *ct, CONSOLE *c, bool standard_view); +void CtInsertColumn(CT *ct, wchar_t *str, bool right); +CT *CtNewStandard(); +CT *CtNewStandardEx(); +void CtInsert(CT *ct, ...); +void CtPrint(CT *ct, CONSOLE *c); +void CtPrintStandard(CT *ct, CONSOLE *c); +void CtPrintRow(CONSOLE *c, UINT num, UINT *widths, wchar_t **strings, bool *rights, char separate_char); +void VpnCmdInitBootPath(); + +void CmdPrintError(CONSOLE *c, UINT err); +void CmdPrintAbout(CONSOLE *c); +wchar_t *CmdPromptPort(CONSOLE *c, void *param); +wchar_t *CmdPromptChoosePassword(CONSOLE *c, void *param); +bool CmdEvalPort(CONSOLE *c, wchar_t *str, void *param); +void CmdInsertTrafficInfo(CT *ct, TRAFFIC *t); +wchar_t *GetHubTypeStr(UINT type); +wchar_t *GetServerTypeStr(UINT type); +char *CmdPasswordPrompt(CONSOLE *c); +bool CmdEvalIp(CONSOLE *c, wchar_t *str, void *param); +wchar_t *PsClusterSettingMemberPromptIp(CONSOLE *c, void *param); +bool CmdEvalHostAndPort(CONSOLE *c, wchar_t *str, void *param); +LIST *StrToPortList(char *str, bool limit_range); +bool CmdEvalPortList(CONSOLE *c, wchar_t *str, void *param); +wchar_t *PsClusterSettingMemberPromptPorts(CONSOLE *c, void *param); +K *CmdLoadKey(CONSOLE *c, wchar_t *filename); +bool CmdLoadCertAndKey(CONSOLE *c, X **xx, K **kk, wchar_t *cert_filename, wchar_t *key_filename); +bool CmdEvalTcpOrUdp(CONSOLE *c, wchar_t *str, void *param); +wchar_t *GetConnectionTypeStr(UINT type); +bool CmdEvalHostAndSubnetMask4(CONSOLE *c, wchar_t *str, void *param); +bool CmdEvalNetworkAndSubnetMask4(CONSOLE *c, wchar_t *str, void *param); +bool CmdEvalIpAndMask4(CONSOLE *c, wchar_t *str, void *param); +bool CmdEvalIpAndMask6(CONSOLE *c, wchar_t *str, void *param); +wchar_t *GetLogSwitchStr(UINT i); +wchar_t *GetPacketLogNameStr(UINT i); +UINT StrToLogSwitchType(char *str); +UINT StrToPacketLogType(char *str); +UINT StrToPacketLogSaveInfoType(char *str); +wchar_t *GetProxyTypeStr(UINT i); +wchar_t *GetClientAuthTypeStr(UINT i); +void PrintPolicyList(CONSOLE *c, char *name); +void PrintPolicy(CONSOLE *c, POLICY *pol, bool cascade_mode); +bool EditPolicy(CONSOLE *c, POLICY *pol, char *name, char *value, bool cascade_mode); +void CmdPrintStatusToListView(CT *ct, RPC_CLIENT_GET_CONNECTION_STATUS *s); +void CmdPrintStatusToListViewEx(CT *ct, RPC_CLIENT_GET_CONNECTION_STATUS *s, bool server_mode); +bool CmdEvalPassOrDiscard(CONSOLE *c, wchar_t *str, void *param); +bool StrToPassOrDiscard(char *str); +bool CmdEvalProtocol(CONSOLE *c, wchar_t *str, void *param); +UINT StrToProtocol(char *str); +bool CmdEvalPortRange(CONSOLE *c, wchar_t *str, void *param); +bool ParsePortRange(char *str, UINT *start, UINT *end); +wchar_t *GetAuthTypeStr(UINT id); +UINT64 StrToDateTime64(char *str); +bool CmdEvalDateTime(CONSOLE *c, wchar_t *str, void *param); +void CmdPrintNodeInfo(CT *ct, NODE_INFO *info); +wchar_t *GetProtocolName(UINT n); +void CmdGenerateImportName(REMOTE_CLIENT *r, wchar_t *name, UINT size, wchar_t *old_name); +bool CmdIsAccountName(REMOTE_CLIENT *r, wchar_t *name); +wchar_t *GetSyslogSettingName(UINT n); + + +void TtPrint(void *param, TT_PRINT_PROC *print_proc, wchar_t *str); +void TtGenerateRandomData(UCHAR **buf, UINT *size); +void TtsWorkerThread(THREAD *thread, void *param); +void TtsListenThread(THREAD *thread, void *param); +void TtsAcceptProc(TTS *tts, SOCK *listen_socket); +void TtsIPv6AcceptThread(THREAD *thread, void *param); +wchar_t *GetTtcTypeStr(UINT type); +void TtcPrintSummary(TTC *ttc); +void StopTtc(TTC *ttc); +void TtcGenerateResult(TTC *ttc); +void TtcThread(THREAD *thread, void *param); +TTC *NewTtcEx(char *host, UINT port, UINT numtcp, UINT type, UINT64 span, bool dbl, bool raw, TT_PRINT_PROC *print_proc, void *param, EVENT *start_event, bool *cancel); +TTC *NewTtc(char *host, UINT port, UINT numtcp, UINT type, UINT64 span, bool dbl, bool raw, TT_PRINT_PROC *print_proc, void *param); +UINT FreeTtc(TTC *ttc, TT_RESULT *result); +TTS *NewTts(UINT port, void *param, TT_PRINT_PROC *print_proc); +UINT FreeTts(TTS *tts); +void PtTrafficPrintProc(void *param, wchar_t *str); +void TtcPrintResult(CONSOLE *c, TT_RESULT *res); + + +bool SystemCheck(); +bool CheckKernel(); +bool CheckMemory(); +bool CheckStrings(); +bool CheckFileSystem(); +bool CheckThread(); +bool CheckNetwork(); +void InputToNull(void *p); +UINT RetZero(); + +void Win32CmdDebug(bool is_uac); + + +UINT PtConnect(CONSOLE *c, wchar_t *cmdline); +PT *NewPt(CONSOLE *c, wchar_t *cmdline); +void FreePt(PT *pt); +void PtMain(PT *pt); +UINT PtMakeCert(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); +UINT PtMakeCert2048(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); +UINT PtTrafficClient(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); +UINT PtTrafficServer(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); +UINT PtCheck(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); + + +UINT PcConnect(CONSOLE *c, char *target, wchar_t *cmdline, char *password); +PC *NewPc(CONSOLE *c, REMOTE_CLIENT *remote_client, char *servername, wchar_t *cmdline); +void FreePc(PC *pc); +void PcMain(PC *pc); +UINT PcAbout(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); +UINT PcVersionGet(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); +UINT PcPasswordSet(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); +UINT PcPasswordGet(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); +UINT PcCertList(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); +UINT PcCertAdd(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); +UINT PcCertDelete(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); +UINT PcCertGet(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); +UINT PcSecureList(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); +UINT PcSecureSelect(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); +UINT PcSecureGet(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); +UINT PcNicCreate(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); +UINT PcNicDelete(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); +UINT PcNicUpgrade(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); +UINT PcNicGetSetting(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); +UINT PcNicSetSetting(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); +UINT PcNicEnable(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); +UINT PcNicDisable(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); +UINT PcNicList(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); +UINT PcAccountList(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); +UINT PcAccountCreate(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); +UINT PcAccountSet(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); +UINT PcAccountGet(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); +UINT PcAccountDelete(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); +UINT PcAccountUsernameSet(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); +UINT PcAccountAnonymousSet(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); +UINT PcAccountPasswordSet(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); +UINT PcAccountCertSet(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); +UINT PcAccountCertGet(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); +UINT PcAccountEncryptDisable(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); +UINT PcAccountEncryptEnable(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); +UINT PcAccountCompressEnable(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); +UINT PcAccountCompressDisable(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); +UINT PcAccountHttpHeaderAdd(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); +UINT PcAccountHttpHeaderDelete(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); +UINT PcAccountHttpHeaderGet(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); +UINT PcAccountProxyNone(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); +UINT PcAccountProxyHttp(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); +UINT PcAccountProxySocks(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); +UINT PcAccountProxySocks5(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); +UINT PcAccountServerCertEnable(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); +UINT PcAccountServerCertDisable(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); +UINT PcAccountRetryOnServerCertEnable(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); +UINT PcAccountRetryOnServerCertDisable(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); +UINT PcAccountServerCertSet(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); +UINT PcAccountServerCertDelete(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); +UINT PcAccountServerCertGet(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); +UINT PcAccountDetailSet(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); +UINT PcAccountRename(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); +UINT PcAccountConnect(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); +UINT PcAccountDisconnect(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); +UINT PcAccountStatusGet(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); +UINT PcAccountNicSet(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); +UINT PcAccountStatusShow(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); +UINT PcAccountStatusHide(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); +UINT PcAccountSecureCertSet(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); +UINT PcAccountOpensslEngineCertSet(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); +UINT PcAccountRetrySet(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); +UINT PcAccountStartupSet(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); +UINT PcAccountStartupRemove(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); +UINT PcAccountExport(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); +UINT PcAccountImport(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); +UINT PcRemoteEnable(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); +UINT PcRemoteDisable(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); +UINT PcKeepEnable(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); +UINT PcKeepDisable(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); +UINT PcKeepSet(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); +UINT PcKeepGet(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); + + +PS *NewPs(CONSOLE *c, RPC *rpc, char *servername, UINT serverport, char *hubname, char *adminhub, wchar_t *cmdline); +void FreePs(PS *ps); +UINT PsConnect(CONSOLE *c, char *host, UINT port, char *hub, char *adminhub, wchar_t *cmdline, char *password); +void PsMain(PS *ps); +UINT PsAbout(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); +UINT PsServerInfoGet(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); +UINT PsServerStatusGet(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); +UINT PsListenerCreate(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); +UINT PsListenerDelete(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); +UINT PsListenerList(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); +UINT PsListenerEnable(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); +UINT PsListenerDisable(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); +UINT PsPortsUDPSet(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); +UINT PsPortsUDPGet(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); +UINT PsProtoOptionsSet(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); +UINT PsProtoOptionsGet(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); +UINT PsServerPasswordSet(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); +UINT PsClusterSettingGet(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); +UINT PsClusterSettingStandalone(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); +UINT PsClusterSettingController(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); +UINT PsClusterSettingMember(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); +UINT PsClusterMemberList(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); +UINT PsClusterMemberInfoGet(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); +UINT PsClusterMemberCertGet(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); +UINT PsClusterConnectionStatusGet(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); +UINT PsCrash(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); +UINT PsFlush(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); +UINT PsDebug(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); +UINT PsServerCertGet(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); +UINT PsServerKeyGet(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); +UINT PsServerCertSet(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); +UINT PsServerCipherGet(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); +UINT PsServerCipherSet(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); +UINT PsKeepEnable(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); +UINT PsKeepDisable(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); +UINT PsKeepSet(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); +UINT PsKeepGet(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); +UINT PsSyslogGet(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); +UINT PsSyslogDisable(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); +UINT PsSyslogEnable(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); +UINT PsConnectionList(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); +UINT PsConnectionGet(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); +UINT PsConnectionDisconnect(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); +UINT PsBridgeDeviceList(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); +UINT PsBridgeList(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); +UINT PsBridgeCreate(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); +UINT PsBridgeDelete(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); +UINT PsCaps(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); +UINT PsReboot(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); +UINT PsConfigGet(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); +UINT PsConfigSet(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); +UINT PsRouterList(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); +UINT PsRouterAdd(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); +UINT PsRouterDelete(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); +UINT PsRouterStart(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); +UINT PsRouterStop(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); +UINT PsRouterIfList(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); +UINT PsRouterIfAdd(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); +UINT PsRouterIfDel(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); +UINT PsRouterTableList(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); +UINT PsRouterTableAdd(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); +UINT PsRouterTableDel(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); +UINT PsLogFileList(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); +UINT PsLogFileGet(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); +UINT PsHubCreate(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); +UINT PsHubCreateDynamic(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); +UINT PsHubCreateStatic(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); +UINT PsHubDelete(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); +UINT PsHubSetStatic(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); +UINT PsHubSetDynamic(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); +UINT PsHubList(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); +UINT PsHub(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); +UINT PsOnline(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); +UINT PsOffline(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); +UINT PsSetMaxSession(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); +UINT PsSetHubPassword(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); +UINT PsSetEnumAllow(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); +UINT PsSetEnumDeny(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); +UINT PsOptionsGet(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); +UINT PsRadiusServerSet(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); +UINT PsRadiusServerDelete(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); +UINT PsRadiusServerGet(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); +UINT PsStatusGet(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); +UINT PsLogGet(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); +UINT PsLogEnable(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); +UINT PsLogDisable(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); +UINT PsLogSwitchSet(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); +UINT PsLogPacketSaveType(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); +UINT PsCAList(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); +UINT PsCAAdd(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); +UINT PsCADelete(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); +UINT PsCAGet(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); +UINT PsCascadeList(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); +UINT PsCascadeCreate(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); +UINT PsCascadeSet(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); +UINT PsCascadeGet(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); +UINT PsCascadeDelete(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); +UINT PsCascadeUsernameSet(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); +UINT PsCascadeAnonymousSet(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); +UINT PsCascadePasswordSet(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); +UINT PsCascadeCertSet(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); +UINT PsCascadeCertGet(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); +UINT PsCascadeEncryptEnable(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); +UINT PsCascadeEncryptDisable(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); +UINT PsCascadeCompressEnable(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); +UINT PsCascadeCompressDisable(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); +UINT PsCascadeHttpHeaderAdd(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); +UINT PsCascadeHttpHeaderDelete(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); +UINT PsCascadeHttpHeaderGet(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); +UINT PsCascadeProxyNone(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); +UINT PsCascadeProxyHttp(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); +UINT PsCascadeProxySocks(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); +UINT PsCascadeProxySocks5(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); +UINT PsCascadeServerCertEnable(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); +UINT PsCascadeServerCertDisable(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); +UINT PsCascadeServerCertSet(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); +UINT PsCascadeServerCertDelete(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); +UINT PsCascadeServerCertGet(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); +UINT PsCascadeDetailSet(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); +UINT PsCascadePolicyRemove(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); +UINT PsCascadePolicySet(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); +UINT PsPolicyList(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); +UINT PsCascadeStatusGet(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); +UINT PsCascadeRename(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); +UINT PsCascadeOnline(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); +UINT PsCascadeOffline(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); +UINT PsAccessAdd(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); +UINT PsAccessAddEx(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); +UINT PsAccessAdd6(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); +UINT PsAccessAddEx6(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); +UINT PsAccessList(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); +UINT PsAccessDelete(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); +UINT PsAccessEnable(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); +UINT PsAccessDisable(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); +UINT PsUserList(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); +UINT PsUserCreate(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); +UINT PsUserSet(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); +UINT PsUserDelete(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); +UINT PsUserGet(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); +UINT PsUserAnonymousSet(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); +UINT PsUserPasswordSet(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); +UINT PsUserCertSet(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); +UINT PsUserCertGet(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); +UINT PsUserSignedSet(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); +UINT PsUserRadiusSet(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); +UINT PsUserNTLMSet(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); +UINT PsUserPolicyRemove(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); +UINT PsUserPolicySet(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); +UINT PsUserExpiresSet(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); +UINT PsGroupList(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); +UINT PsGroupCreate(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); +UINT PsGroupSet(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); +UINT PsGroupDelete(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); +UINT PsGroupGet(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); +UINT PsGroupJoin(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); +UINT PsGroupUnjoin(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); +UINT PsGroupPolicyRemove(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); +UINT PsGroupPolicySet(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); +UINT PsSessionList(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); +UINT PsSessionGet(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); +UINT PsSessionDisconnect(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); +UINT PsMacTable(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); +UINT PsMacDelete(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); +UINT PsIpTable(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); +UINT PsIpDelete(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); +UINT PsSecureNatEnable(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); +UINT PsSecureNatDisable(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); +UINT PsSecureNatStatusGet(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); +UINT PsSecureNatHostGet(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); +UINT PsSecureNatHostSet(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); +UINT PsNatGet(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); +UINT PsNatEnable(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); +UINT PsNatDisable(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); +UINT PsNatSet(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); +UINT PsNatTable(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); +UINT PsDhcpGet(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); +UINT PsDhcpEnable(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); +UINT PsDhcpDisable(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); +UINT PsDhcpSet(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); +UINT PsDhcpTable(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); +UINT PsAdminOptionList(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); +UINT PsAdminOptionSet(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); +UINT PsExtOptionList(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); +UINT PsExtOptionSet(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); +UINT PsCrlList(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); +UINT PsCrlAdd(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); +UINT PsCrlDel(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); +UINT PsCrlGet(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); +UINT PsAcList(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); +UINT PsAcAdd(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); +UINT PsAcAdd6(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); +UINT PsAcGet(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); +UINT PsAcDel(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); +UINT PsLicenseAdd(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); +UINT PsLicenseDel(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); +UINT PsLicenseList(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); +UINT PsLicenseStatus(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); +UINT PsIPsecEnable(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); +UINT PsIPsecGet(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); +UINT PsEtherIpClientAdd(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); +UINT PsEtherIpClientDelete(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); +UINT PsEtherIpClientList(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); +UINT PsOpenVpnMakeConfig(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); +UINT PsServerCertRegenerate(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); +UINT PsVpnOverIcmpDnsEnable(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); +UINT PsVpnOverIcmpDnsGet(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); +UINT PsDynamicDnsGetStatus(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); +UINT PsDynamicDnsSetHostname(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); +UINT PsVpnAzureSetEnable(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); +UINT PsVpnAzureGetStatus(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); + + +#endif // COMMAND_H + + diff --git a/src/Cedar/Connection.c b/src/Cedar/Connection.c index 64d0e01a..6f85c691 100644 --- a/src/Cedar/Connection.c +++ b/src/Cedar/Connection.c @@ -1,3483 +1,3483 @@ -// SoftEther VPN Source Code - Developer Edition Master Branch -// Cedar Communication Module -// © 2020 Nokia - -// Connection.c -// Connection Manager - -#include "CedarPch.h" - -// Determine whether the socket is to use to send -#define IS_SEND_TCP_SOCK(ts) \ - ((ts->Direction == TCP_BOTH) || ((ts->Direction == TCP_SERVER_TO_CLIENT) && (s->ServerMode)) || ((ts->Direction == TCP_CLIENT_TO_SERVER) && (s->ServerMode == false))) - -// Determine whether the socket is to use to receive -#define IS_RECV_TCP_SOCK(ts) \ - ((ts->Direction == TCP_BOTH) || ((ts->Direction == TCP_SERVER_TO_CLIENT) && (s->ServerMode == false)) || ((ts->Direction == TCP_CLIENT_TO_SERVER) && (s->ServerMode))) - -// Conversion of SECURE_SIGN -void InRpcSecureSign(SECURE_SIGN *t, PACK *p) -{ - // Validate arguments - if (t == NULL || p == NULL) - { - return; - } - - Zero(t, sizeof(SECURE_SIGN)); - PackGetStr(p, "SecurePublicCertName", t->SecurePublicCertName, sizeof(t->SecurePublicCertName)); - PackGetStr(p, "SecurePrivateKeyName", t->SecurePrivateKeyName, sizeof(t->SecurePrivateKeyName)); - t->ClientCert = PackGetX(p, "ClientCert"); - PackGetData2(p, "Random", t->Random, sizeof(t->Random)); - PackGetData2(p, "Signature", t->Signature, sizeof(t->Signature)); - t->UseSecureDeviceId = PackGetInt(p, "UseSecureDeviceId"); - t->BitmapId = PackGetInt(p, "BitmapId"); -} -void OutRpcSecureSign(PACK *p, SECURE_SIGN *t) -{ - // Validate arguments - if (p == NULL || t == NULL) - { - return; - } - - PackAddStr(p, "SecurePublicCertName", t->SecurePublicCertName); - PackAddStr(p, "SecurePrivateKeyName", t->SecurePrivateKeyName); - PackAddX(p, "ClientCert", t->ClientCert); - PackAddData(p, "Random", t->Random, sizeof(t->Random)); - PackAddData(p, "Signature", t->Signature, sizeof(t->Signature)); - PackAddInt(p, "UseSecureDeviceId", t->UseSecureDeviceId); - PackAddInt(p, "BitmapId", t->BitmapId); -} -void FreeRpcSecureSign(SECURE_SIGN *t) -{ - // Validate arguments - if (t == NULL) - { - return; - } - - FreeX(t->ClientCert); -} - -// Generate the next packet -BUF *NewKeepPacket(bool server_mode) -{ - BUF *b = NewBuf(); - char *string = KEEP_ALIVE_STRING; - - WriteBuf(b, string, StrLen(string)); - - SeekBuf(b, 0, 0); - - return b; -} - -// KEEP thread -void KeepThread(THREAD *thread, void *param) -{ - KEEP *k = (KEEP *)param; - SOCK *s; - char server_name[MAX_HOST_NAME_LEN + 1]; - UINT server_port; - bool udp_mode; - bool enabled; - // Validate arguments - if (thread == NULL || k == NULL) - { - return; - } - -WAIT_FOR_ENABLE: - Wait(k->HaltEvent, KEEP_POLLING_INTERVAL); - - // Wait until it becomes enabled - while (true) - { - enabled = false; - Lock(k->lock); - { - if (k->Enable) - { - if (StrLen(k->ServerName) != 0 && k->ServerPort != 0 && k->Interval != 0) - { - StrCpy(server_name, sizeof(server_name), k->ServerName); - server_port = k->ServerPort; - udp_mode = k->UdpMode; - enabled = true; - } - } - } - Unlock(k->lock); - if (enabled) - { - break; - } - if (k->Halt) - { - return; - } - Wait(k->HaltEvent, KEEP_POLLING_INTERVAL); - } - - if (udp_mode == false) - { - // TCP mode - // Try until a success to connection - while (true) - { - UINT64 connect_started_tick; - bool changed = false; - Lock(k->lock); - { - if (StrCmpi(k->ServerName, server_name) != 0 || - k->ServerPort != server_port || k->Enable == false || - k->UdpMode) - { - changed = true; - } - } - Unlock(k->lock); - if (changed) - { - // Settings are changed - goto WAIT_FOR_ENABLE; - } - - if (k->Halt) - { - // Stop - return; - } - - // Attempt to connect to the server - connect_started_tick = Tick64(); - s = ConnectEx2(server_name, server_port, KEEP_TCP_TIMEOUT, (bool *)&k->Halt); - if (s != NULL) - { - // Successful connection - break; - } - - // Connection failure: Wait until timeout or the setting is changed - while (true) - { - changed = false; - if (k->Halt) - { - // Stop - return; - } - Lock(k->lock); - { - if (StrCmpi(k->ServerName, server_name) != 0 || - k->ServerPort != server_port || k->Enable == false || - k->UdpMode) - { - changed = true; - } - } - Unlock(k->lock); - - if (changed) - { - // Settings are changed - goto WAIT_FOR_ENABLE; - } - - if ((Tick64() - connect_started_tick) >= KEEP_RETRY_INTERVAL) - { - break; - } - - Wait(k->HaltEvent, KEEP_POLLING_INTERVAL); - } - } - - // Success to connect the server - // Send and receive packet data periodically - if (s != NULL) - { - UINT64 last_packet_sent_time = 0; - while (true) - { - SOCKSET set; - UINT ret; - UCHAR buf[MAX_SIZE]; - bool changed; - - InitSockSet(&set); - AddSockSet(&set, s); - - Select(&set, KEEP_POLLING_INTERVAL, k->Cancel, NULL); - - ret = Recv(s, buf, sizeof(buf), false); - if (ret == 0) - { - // Disconnected - Disconnect(s); - ReleaseSock(s); - s = NULL; - } - - if (s != NULL) - { - if ((Tick64() - last_packet_sent_time) >= (UINT64)k->Interval) - { - BUF *b; - - // Send the next packet - last_packet_sent_time = Tick64(); - - b = NewKeepPacket(k->Server); - - ret = Send(s, b->Buf, b->Size, false); - FreeBuf(b); - - if (ret == 0) - { - // Disconnected - Disconnect(s); - ReleaseSock(s); - s = NULL; - } - } - } - - changed = false; - - Lock(k->lock); - { - if (StrCmpi(k->ServerName, server_name) != 0 || - k->ServerPort != server_port || k->Enable == false || - k->UdpMode) - { - changed = true; - } - } - Unlock(k->lock); - - if (changed || s == NULL) - { - // Setting has been changed or disconnected - Disconnect(s); - ReleaseSock(s); - s = NULL; - goto WAIT_FOR_ENABLE; - } - else - { - if (k->Halt) - { - // Stop - Disconnect(s); - ReleaseSock(s); - return; - } - } - } - } - } - else - { - IP dest_ip; - // UDP mode - // Try to create socket until it successes - while (true) - { - UINT64 connect_started_tick; - bool changed = false; - Lock(k->lock); - { - if (StrCmpi(k->ServerName, server_name) != 0 || - k->ServerPort != server_port || k->Enable == false || - k->UdpMode == false) - { - changed = true; - } - } - Unlock(k->lock); - if (changed) - { - // Settings are changed - goto WAIT_FOR_ENABLE; - } - - if (k->Halt) - { - // Stop - return; - } - - // Attempt to create a socket - connect_started_tick = Tick64(); - - // Attempt to resolve the name first - if (GetIP(&dest_ip, server_name)) - { - // After successful name resolution, create a socket - s = NewUDP(0); - if (s != NULL) - { - // Creating success - break; - } - } - - // Failure to create: wait until timeout or the setting is changed - while (true) - { - changed = false; - if (k->Halt) - { - // Stop - return; - } - Lock(k->lock); - { - if (StrCmpi(k->ServerName, server_name) != 0 || - k->ServerPort != server_port || k->Enable == false || - k->UdpMode == false) - { - changed = true; - } - } - Unlock(k->lock); - - if (changed) - { - // Settings are changed - goto WAIT_FOR_ENABLE; - } - - if ((Tick64() - connect_started_tick) >= KEEP_RETRY_INTERVAL) - { - break; - } - - Wait(k->HaltEvent, KEEP_POLLING_INTERVAL); - } - } - - // Send the packet data periodically - if (s != NULL) - { - UINT64 last_packet_sent_time = 0; - UINT num_ignore_errors = 0; - while (true) - { - SOCKSET set; - UINT ret; - UCHAR buf[MAX_SIZE]; - bool changed; - IP src_ip; - UINT src_port; - - InitSockSet(&set); - AddSockSet(&set, s); - - Select(&set, KEEP_POLLING_INTERVAL, k->Cancel, NULL); - - // Receive - ret = RecvFrom(s, &src_ip, &src_port, buf, sizeof(buf)); - if (ret == 0) - { - if (s->IgnoreRecvErr == false) - { -LABEL_DISCONNECTED: - // Disconnected - Disconnect(s); - ReleaseSock(s); - s = NULL; - } - else - { - if ((num_ignore_errors++) >= MAX_NUM_IGNORE_ERRORS) - { - goto LABEL_DISCONNECTED; - } - } - } - - if (s != NULL) - { - if ((Tick64() - last_packet_sent_time) >= (UINT64)k->Interval) - { - BUF *b; - - // Send the next packet - last_packet_sent_time = Tick64(); - - b = NewKeepPacket(k->Server); - - ret = SendTo(s, &dest_ip, server_port, b->Buf, b->Size); - FreeBuf(b); - - if (ret == 0 && s->IgnoreSendErr == false) - { - // Disconnected - Disconnect(s); - ReleaseSock(s); - s = NULL; - } - } - } - - changed = false; - - Lock(k->lock); - { - if (StrCmpi(k->ServerName, server_name) != 0 || - k->ServerPort != server_port || k->Enable == false || - k->UdpMode == false) - { - changed = true; - } - } - Unlock(k->lock); - - if (changed || s == NULL) - { - // Setting has been changed or disconnected - Disconnect(s); - ReleaseSock(s); - s = NULL; - goto WAIT_FOR_ENABLE; - } - else - { - if (k->Halt) - { - // Stop - Disconnect(s); - ReleaseSock(s); - return; - } - } - } - } - } -} - -// Stop the KEEP -void StopKeep(KEEP *k) -{ - // Validate arguments - if (k == NULL) - { - return; - } - - k->Halt = true; - Set(k->HaltEvent); - Cancel(k->Cancel); - - WaitThread(k->Thread, INFINITE); - ReleaseThread(k->Thread); - DeleteLock(k->lock); - - ReleaseCancel(k->Cancel); - ReleaseEvent(k->HaltEvent); - - Free(k); -} - -// Start the KEEP -KEEP *StartKeep() -{ - KEEP *k = ZeroMalloc(sizeof(KEEP)); - - k->lock = NewLock(); - k->HaltEvent = NewEvent(); - k->Cancel = NewCancel(); - - // Thread start - k->Thread = NewThread(KeepThread, k); - - return k; -} - -// Copy the client authentication data -CLIENT_AUTH *CopyClientAuth(CLIENT_AUTH *a) -{ - CLIENT_AUTH *ret; - // Validate arguments - if (a == NULL) - { - return NULL; - } - - ret = ZeroMallocEx(sizeof(CLIENT_AUTH), true); - - ret->AuthType = a->AuthType; - StrCpy(ret->Username, sizeof(ret->Username), a->Username); - - switch (a->AuthType) - { - case CLIENT_AUTHTYPE_ANONYMOUS: - // Anonymous authentication - break; - - case CLIENT_AUTHTYPE_PASSWORD: - // Password authentication - Copy(ret->HashedPassword, a->HashedPassword, SHA1_SIZE); - break; - - case CLIENT_AUTHTYPE_PLAIN_PASSWORD: - // Plaintext password authentication - StrCpy(ret->PlainPassword, sizeof(ret->PlainPassword), a->PlainPassword); - break; - - case CLIENT_AUTHTYPE_CERT: - // Certificate authentication - ret->ClientX = CloneX(a->ClientX); - ret->ClientK = CloneK(a->ClientK); - break; - - case CLIENT_AUTHTYPE_SECURE: - // Secure device authentication - StrCpy(ret->SecurePublicCertName, sizeof(ret->SecurePublicCertName), a->SecurePublicCertName); - StrCpy(ret->SecurePrivateKeyName, sizeof(ret->SecurePrivateKeyName), a->SecurePrivateKeyName); - break; - - case CLIENT_AUTHTYPE_OPENSSLENGINE: - // Secure device authentication - ret->ClientX = CloneX(a->ClientX); - StrCpy(ret->OpensslEnginePrivateKeyName, sizeof(ret->OpensslEnginePrivateKeyName), a->OpensslEnginePrivateKeyName); - StrCpy(ret->OpensslEngineName, sizeof(ret->OpensslEngineName), a->OpensslEngineName); - ret->ClientK = OpensslEngineToK(ret->OpensslEnginePrivateKeyName, ret->OpensslEngineName); - break; - } - - return ret; -} - -// Write data to the transmit FIFO (automatic encryption) -void WriteSendFifo(SESSION *s, TCPSOCK *ts, void *data, UINT size) -{ - // Validate arguments - if (s == NULL || ts == NULL || data == NULL) - { - return; - } - - WriteFifo(ts->SendFifo, data, size); -} - -// Write data to the reception FIFO (automatic decryption) -void WriteRecvFifo(SESSION *s, TCPSOCK *ts, void *data, UINT size) -{ - // Validate arguments - if (s == NULL || ts == NULL || data == NULL) - { - return; - } - - WriteFifo(ts->RecvFifo, data, size); -} - -// TCP socket receive -UINT TcpSockRecv(SESSION *s, TCPSOCK *ts, void *data, UINT size) -{ - // Receive - return Recv(ts->Sock, data, size, s->UseEncrypt); -} - -// TCP socket send -UINT TcpSockSend(SESSION *s, TCPSOCK *ts, void *data, UINT size) -{ - // Transmission - return Send(ts->Sock, data, size, s->UseEncrypt); -} - -// Send the data as UDP packet -void SendDataWithUDP(SOCK *s, CONNECTION *c) -{ - UCHAR *buf; - BUF *b; - UINT64 dummy_64 = 0; - UCHAR dummy_buf[16]; - UINT64 now = Tick64(); - UINT ret; - bool force_flag = false; - bool packet_sent = false; - // Validate arguments - if (s == NULL || c == NULL) - { - return; - } - - // Allocate the temporary buffer in heap - if (c->RecvBuf == NULL) - { - c->RecvBuf = Malloc(RECV_BUF_SIZE); - } - buf = c->RecvBuf; - - if (c->Udp->NextKeepAliveTime == 0 || c->Udp->NextKeepAliveTime <= now) - { - force_flag = true; - } - - // Creating a buffer - while ((c->SendBlocks->num_item > 0) || force_flag) - { - UINT *key32; - UINT64 *seq; - char *sign; - - force_flag = false; - - // Assemble a buffer from the current queue - b = NewBuf(); - - // Keep an area for packet header (16 bytes) - WriteBuf(b, dummy_buf, sizeof(dummy_buf)); - - // Pack the packets in transmission queue - while (true) - { - BLOCK *block; - - if (b->Size > UDP_BUF_SIZE) - { - break; - } - block = GetNext(c->SendBlocks); - if (block == NULL) - { - break; - } - - if (block->Size != 0) - { - WriteBufInt(b, block->Size); - WriteBuf(b, block->Buf, block->Size); - - c->Session->TotalSendSize += (UINT64)block->SizeofData; - c->Session->TotalSendSizeReal += (UINT64)block->Size; - } - - FreeBlock(block); - break; - } - - // Write sequence number and session key - sign = (char *)(((UCHAR *)b->Buf)); - key32 = (UINT *)(((UCHAR *)b->Buf + 4)); - seq = (UINT64 *)(((UCHAR *)b->Buf + 8)); - Copy(sign, SE_UDP_SIGN, 4); - *key32 = Endian32(c->Session->SessionKey32); - *seq = Endian64(c->Udp->Seq++); // Increment the sequence number - -// InsertQueue(c->Udp->BufferQueue, b); - - packet_sent = true; -/* } - - // Send a buffer - while (c->Udp->BufferQueue->num_item != 0) - { - FIFO *f = c->Udp->BufferQueue->fifo; - BUF **pb = (BUF**)(((UCHAR *)f->p) + f->pos); - BUF *b = *pb; - -*/ ret = SendTo(s, &c->Udp->ip, c->Udp->port, b->Buf, b->Size); - if (ret == SOCK_LATER) - { - // Blocking - Debug("."); -// break; - } - if (ret != b->Size) - { - if (s->IgnoreSendErr == false) - { - // Error - Debug("******* SendTo Error !!!\n"); - } - } - - // Memory release - FreeBuf(b); -// GetNext(c->Udp->BufferQueue); - } - - if (packet_sent) - { - // KeepAlive time update - c->Udp->NextKeepAliveTime = now + (UINT64)GenNextKeepAliveSpan(c); - } -} - -// Write the data of the UDP packet to the connection -void PutUDPPacketData(CONNECTION *c, void *data, UINT size) -{ - BUF *b; - char sign[4]; - // Validate arguments - if (c == NULL || data == NULL) - { - return; - } - - // Examine the protocol - if (c->Protocol != CONNECTION_UDP) - { - // UDP protocol is not used - return; - } - - // Buffer configuration - b = NewBuf(); - WriteBuf(b, data, size); - - SeekBuf(b, 0, 0); - ReadBuf(b, sign, 4); - - // Signature confirmation - if (Cmp(sign, SE_UDP_SIGN, 4) == 0) - { - UINT key32; - - // Session key number - key32 = ReadBufInt(b); - - if (c->Session->SessionKey32 == key32) - { - UINT64 seq; - - // Read the Sequence number - ReadBuf(b, &seq, sizeof(seq)); - seq = Endian64(seq); - - if ((UINT)(seq - c->Udp->RecvSeq - (UINT64)1)) - { - //Debug("** UDP Seq Lost %u\n", (UINT)(seq - c->Udp->RecvSeq - (UINT64)1)); - } - c->Udp->RecvSeq = seq; - - //Debug("SEQ: %I32u\n", seq); - - while (true) - { - UINT size; - - size = ReadBufInt(b); - if (size == 0) - { - break; - } - else if (size <= MAX_PACKET_SIZE) - { - void *tmp; - BLOCK *block; - - tmp = Malloc(size); - if (ReadBuf(b, tmp, size) != size) - { - Free(tmp); - break; - } - - // Block configuration - block = NewBlock(tmp, size, 0); - - // Insert Block - InsertReceivedBlockToQueue(c, block, false); - } - } - - // Update the last communication time - c->Session->LastCommTime = Tick64(); - } - else - { - Debug("Invalid SessionKey: 0x%X\n", key32); - } - } - - FreeBuf(b); -} - -// Add a block to the receive queue -void InsertReceivedBlockToQueue(CONNECTION *c, BLOCK *block, bool no_lock) -{ - SESSION *s; - // Validate arguments - if (c == NULL || block == NULL) - { - return; - } - - s = c->Session; - - if (c->Protocol == CONNECTION_TCP) - { - s->TotalRecvSizeReal += block->SizeofData; - s->TotalRecvSize += block->Size; - } - - if (no_lock == false) - { - LockQueue(c->ReceivedBlocks); - } - - if (c->ReceivedBlocks->num_item < MAX_STORED_QUEUE_NUM) - { - InsertQueue(c->ReceivedBlocks, block); - } - else - { - FreeBlock(block); - } - - if (no_lock == false) - { - UnlockQueue(c->ReceivedBlocks); - } -} - -// Generate the interval to the next Keep-Alive packet -// (This should be a random number for the network load reduction) -UINT GenNextKeepAliveSpan(CONNECTION *c) -{ - UINT a, b; - // Validate arguments - if (c == NULL) - { - return INFINITE; - } - - a = c->Session->Timeout; - b = rand() % (a / 2); - b = MAX(b, a / 5); - - return b; -} - -// send a Keep-Alive packet -void SendKeepAlive(CONNECTION *c, TCPSOCK *ts) -{ - UINT size, i, num; - UINT size_be; - SESSION *s; - UCHAR *buf; - bool insert_natt_port = false; - // Validate arguments - if (c == NULL || ts == NULL) - { - return; - } - - s = c->Session; - - size = rand() % MAX_KEEPALIVE_SIZE; - num = KEEP_ALIVE_MAGIC; - - if (s != NULL && s->UseUdpAcceleration && s->UdpAccel != NULL) - { - if (s->UdpAccel->MyPortByNatTServer != 0) - { - size = MAX(size, (StrLen(UDP_NAT_T_PORT_SIGNATURE_IN_KEEP_ALIVE) + sizeof(USHORT))); - - insert_natt_port = true; - } - } - - buf = MallocFast(size); - - for (i = 0;i < size;i++) - { - buf[i] = rand(); - } - - if (insert_natt_port) - { - USHORT myport = Endian16((USHORT)s->UdpAccel->MyPortByNatTServer); - - Copy(buf, UDP_NAT_T_PORT_SIGNATURE_IN_KEEP_ALIVE, StrLen(UDP_NAT_T_PORT_SIGNATURE_IN_KEEP_ALIVE)); - Copy(buf + StrLen(UDP_NAT_T_PORT_SIGNATURE_IN_KEEP_ALIVE), &myport, sizeof(USHORT)); - } - - num = Endian32(num); - size_be = Endian32(size); - WriteSendFifo(c->Session, ts, &num, sizeof(UINT)); - WriteSendFifo(c->Session, ts, &size_be, sizeof(UINT)); - WriteSendFifo(c->Session, ts, buf, size); - - c->Session->TotalSendSize += sizeof(UINT) * 2 + size; - c->Session->TotalSendSizeReal += sizeof(UINT) * 2 + size; - - Free(buf); -} - -// Transmission of block -void ConnectionSend(CONNECTION *c, UINT64 now) -{ - UINT i, num; - UINT min_count; - UINT64 max_recv_tick; - TCPSOCK **tcpsocks; - UINT size; - SESSION *s; - HUB *hub = NULL; - bool use_qos = false; - // Validate arguments - if (c == NULL) - { - return; - } - - s = c->Session; - - if (s != NULL) - { - hub = s->Hub; - use_qos = s->QoS; - } - - // Protocol - if (c->Protocol == CONNECTION_TCP) - { - // TCP - TCP *tcp = c->Tcp; - TCPSOCK *ts; - TCPSOCK *ts_hp; - UINT num_available; - bool is_rudp = false; - UINT tcp_queue_size = 0; - int tcp_queue_size_diff = 0; - LockList(tcp->TcpSockList); - { - num = LIST_NUM(tcp->TcpSockList); - tcpsocks = ToArrayEx(tcp->TcpSockList, true); - } - UnlockList(tcp->TcpSockList); - - if (s != NULL) - { - is_rudp = s->IsRUDPSession; - } - - // Select the socket that will be used to send - // Select a socket which have least delay count - min_count = INFINITE; - max_recv_tick = 0; - ts = NULL; - ts_hp = NULL; - - num_available = 0; - - if (c->IsInProc == false) - { - for (i = 0;i < num;i++) - { - TCPSOCK *tcpsock = tcpsocks[i]; - if (s != NULL && tcpsock->Sock->Connected && tcpsock->Sock->AsyncMode && - IS_SEND_TCP_SOCK(tcpsock)) - { - // Processing of KeepAlive - if (now >= tcpsock->NextKeepAliveTime || tcpsock->NextKeepAliveTime == 0 || - (s->UseUdpAcceleration && s->UdpAccel != NULL && s->UdpAccel->MyPortByNatTServerChanged)) - { - // Send the KeepAlive - SendKeepAlive(c, tcpsock); - tcpsock->NextKeepAliveTime = now + (UINT64)GenNextKeepAliveSpan(c); - - if (s->UseUdpAcceleration && s->UdpAccel != NULL) - { - s->UdpAccel->MyPortByNatTServerChanged = false; - } - } - - // Count the number of available sockets to send - num_available++; - - ts_hp = tcpsock; - } - } - } - - for (i = 0;i < num;i++) - { - TCPSOCK *tcpsock = tcpsocks[i]; - if (tcpsock->Sock->Connected && tcpsock->Sock->AsyncMode && - IS_SEND_TCP_SOCK(tcpsock)) - { - // Selection of the socket - bool b = false; - - if (use_qos == false) - { - b = true; - } - else if (num_available < 2) - { - b = true; - } - else if (tcpsock != ts_hp) - { - b = true; - } - - if (b) - { - if (is_rudp == false) - { - // Use a socket which have minimum delay occurrences in the case of such as a TCP socket - if (tcpsock->LateCount <= min_count) - { - min_count = tcpsock->LateCount; - ts = tcpsock; - } - } - else - { - // Use socket which have the largest last received time in the case of R-UDP socket - if (tcpsock->LastRecvTime >= max_recv_tick) - { - max_recv_tick = tcpsock->LastRecvTime; - ts = tcpsock; - } - } - } - } - - tcp_queue_size += tcpsock->SendFifo->size; - } - - tcp_queue_size_diff = ((int)tcp_queue_size) - ((int)c->LastTcpQueueSize); - - CedarAddCurrentTcpQueueSize(c->Cedar, tcp_queue_size_diff); - - c->LastTcpQueueSize = tcp_queue_size; - - if (ts_hp == NULL) - { - ts_hp = ts; - } - - if (use_qos == false) - { - ts_hp = ts; - } - - if (ts == NULL || ts_hp == NULL) - { - // The socket available to send doesn't currently exist - } - else - { - TCPSOCK *tss; - UINT j; - QUEUE *q; - - if (s != NULL && s->UdpAccel != NULL) - { - UdpAccelSetTick(s->UdpAccel, now); - } - - for (j = 0;j < 2;j++) - { - if (j == 0) - { - q = c->SendBlocks2; - tss = ts_hp; - } - else - { - q = c->SendBlocks; - tss = ts; - } - // I reserve the data to send on the selected socket ts - if (q->num_item != 0) - { - UINT num_data; - BLOCK *b; - UINT size_quota_v1 = MAX_SEND_SOCKET_QUEUE_SIZE / s->MaxConnection; - UINT size_quota_v2 = MIN_SEND_SOCKET_QUEUE_SIZE; - UINT size_quota = MAX(size_quota_v1, size_quota_v2); - - if (tss->SendFifo->size >= size_quota) - { - // The size of the socket send queue is exceeded - // Unable to send - while (b = GetNext(q)) - { - if (b != NULL) - { - c->CurrentSendQueueSize -= b->Size; - FreeBlock(b); - } - } - } - else - { - if (c->IsInProc == false) - { - if (s->UseUdpAcceleration && s->UdpAccel != NULL && UdpAccelIsSendReady(s->UdpAccel, true)) - { - // UDP acceleration mode - while (b = GetNext(q)) - { - UdpAccelSendBlock(s->UdpAccel, b); - - s->TotalSendSize += b->Size; - s->TotalSendSizeReal += b->Size; - - c->CurrentSendQueueSize -= b->Size; - - FreeBlock(b); - } - } - else if (s->IsRUDPSession && s->EnableBulkOnRUDP && ts->Sock != NULL && ts->Sock->BulkSendTube != NULL) - { - // R-UDP bulk transfer - TUBE *t = ts->Sock->BulkSendTube; - bool flush = false; - TCP_PAIR_HEADER h; - - Zero(&h, sizeof(h)); - h.EnableHMac = s->EnableHMacOnBulkOfRUDP; - - while (b = GetNext(q)) - { - if (b->Compressed == false) - { - // Uncompressed - TubeSendEx(t, b->Buf, b->Size, &h, true); - - s->TotalSendSize += b->Size; - s->TotalSendSizeReal += b->Size; - - c->CurrentSendQueueSize -= b->Size; - } - else - { - // Compressed - UCHAR *new_buf = Malloc(b->Size + sizeof(UINT64)); - - WRITE_UINT64(new_buf, CONNECTION_BULK_COMPRESS_SIGNATURE); - - Copy(new_buf + sizeof(UINT64), b->Buf, b->Size); - - TubeSendEx(t, new_buf, b->Size + sizeof(UINT64), &h, true); - - s->TotalSendSize += b->SizeofData; - s->TotalSendSizeReal += b->Size; - - c->CurrentSendQueueSize -= b->Size; - - Free(new_buf); - } - - FreeBlock(b); - - flush = true; - } - - if (flush) - { - TubeFlush(t); - } - } - else - { - // TCP/IP socket - bool update_keepalive_timer = false; - // Number of data - num_data = Endian32(q->num_item); - PROBE_DATA2("WriteSendFifo num", &num_data, sizeof(UINT)); - WriteSendFifo(s, tss, &num_data, sizeof(UINT)); - - s->TotalSendSize += sizeof(UINT); - s->TotalSendSizeReal += sizeof(UINT); - - while (b = GetNext(q)) - { - // Size data - UINT size_data; - size_data = Endian32(b->Size); - PROBE_DATA2("WriteSendFifo size", &size_data, sizeof(UINT)); - WriteSendFifo(s, tss, &size_data, sizeof(UINT)); - - c->CurrentSendQueueSize -= b->Size; - - s->TotalSendSize += sizeof(UINT); - s->TotalSendSizeReal += sizeof(UINT); - - // Data body - PROBE_DATA2("WriteSendFifo data", b->Buf, b->Size); - WriteSendFifo(s, tss, b->Buf, b->Size); - - s->TotalSendSize += b->SizeofData; - s->TotalSendSizeReal += b->Size; - - update_keepalive_timer = true; - - // Block release - FreeBlock(b); - } - - if (s->UseUdpAcceleration && s->UdpAccel != NULL && UdpAccelIsSendReady(s->UdpAccel, false)) - { - update_keepalive_timer = false; - } - - if (update_keepalive_timer) - { - // Increase the KeepAlive timer - tss->NextKeepAliveTime = now + (UINT64)GenNextKeepAliveSpan(c); - } - } - } - else - { - bool flush = false; - // In-process socket - while (b = GetNext(q)) - { - TubeSendEx(ts->Sock->SendTube, b->Buf, b->Size, NULL, true); - flush = true; - - s->TotalSendSize += b->Size; - s->TotalSendSizeReal += b->Size; - - c->CurrentSendQueueSize -= b->Size; - - FreeBlock(b); - } - - if (flush) - { - TubeFlush(ts->Sock->SendTube); - } - } - } - } - } - } - - // Send the reserved data to send registered in each socket now - if (c->IsInProc == false) - { - for (i = 0;i < num;i++) - { - ts = tcpsocks[i]; - -SEND_START: - if (ts->Sock->Connected == false) - { - s->LastTryAddConnectTime = Tick64(); - // Communication is disconnected - LockList(tcp->TcpSockList); - { - // Remove the socket from socket list - Delete(tcp->TcpSockList, ts); - // Release of TCPSOCK - FreeTcpSock(ts); - // Decrement the count - Dec(c->CurrentNumConnection); - Debug("--- TCP Connection Decremented: %u (%s Line %u)\n", Count(c->CurrentNumConnection), __FILE__, __LINE__); - Debug("LIST_NUM(tcp->TcpSockList): %u\n", LIST_NUM(tcp->TcpSockList)); - } - UnlockList(tcp->TcpSockList); - - continue; - } - - // Get Fifo size - if (ts->SendFifo->size != 0) - { - UCHAR *buf; - UINT want_send_size; - // Send only if the data to send exists by 1 byte or more - // Get the pointer to the buffer - buf = (UCHAR *)ts->SendFifo->p + ts->SendFifo->pos; - want_send_size = ts->SendFifo->size; - - PROBE_DATA2("TcpSockSend", buf, want_send_size); - size = TcpSockSend(s, ts, buf, want_send_size); - - if (size == 0) - { - // Disconnected - continue; - } - else if (size == SOCK_LATER) - { - // Packet is jammed - ts->LateCount++; // Increment of the delay counter - PROBE_STR("ts->LateCount++;"); - } - else - { - // Packet is sent only by 'size' - // Advance FIFO - ReadFifo(ts->SendFifo, NULL, size); - if (size < want_send_size) - { - // Fail to transmit all of the data that has been scheduled -#ifdef USE_PROBE - { - char tmp[MAX_SIZE]; - - snprintf(tmp, sizeof(tmp), "size < want_send_size: %u < %u", - size, want_send_size); - - PROBE_STR(tmp); - } -#endif // USE_PROBE - } - else - { - // Because sending all the packets is completed - // (The queue is exhausted), reset the delay counter - ts->LateCount = 0; - - PROBE_STR("TcpSockSend All Completed"); - } - // Updated the last communication date and time - UPDATE_LAST_COMM_TIME(c->Session->LastCommTime, now); - - goto SEND_START; - } - } - } - } - - Free(tcpsocks); - } - else if (c->Protocol == CONNECTION_UDP) - { - // UDP - UDP *udp = c->Udp; - SOCK *sock = NULL; - - Lock(c->lock); - { - sock = udp->s; - if (sock != NULL) - { - AddRef(sock->ref); - } - } - Unlock(c->lock); - - if (sock != NULL) - { - // Send with UDP - - // KeepAlive sending - if ((udp->NextKeepAliveTime == 0 || udp->NextKeepAliveTime <= now) || - (c->SendBlocks->num_item != 0) || (udp->BufferQueue->num_item != 0)) - { - // Send the current queue with UDP - SendDataWithUDP(sock, c); - } - } - - if (sock != NULL) - { - ReleaseSock(sock); - } - } - else if (c->Protocol == CONNECTION_HUB_SECURE_NAT) - { - // SecureNAT session - SNAT *snat = s->SecureNAT; - VH *v = snat->Nat->Virtual; - BLOCK *block; - UINT num_packet = 0; - - if (hub != NULL) - { - NatSetHubOption(v, hub->Option); - } - - while (block = GetNext(c->SendBlocks)) - { - num_packet++; - c->CurrentSendQueueSize -= block->Size; - VirtualPutPacket(v, block->Buf, block->Size); - Free(block); - } - - if (num_packet != 0) - { - VirtualPutPacket(v, NULL, 0); - } - } - else if (c->Protocol == CONNECTION_HUB_LAYER3) - { - // Layer-3 session - L3IF *f = s->L3If; - BLOCK *block; - UINT num_packet = 0; - - while (block = GetNext(c->SendBlocks)) - { - num_packet++; - c->CurrentSendQueueSize -= block->Size; - L3PutPacket(f, block->Buf, block->Size); - Free(block); - } - - if (num_packet != 0) - { - L3PutPacket(f, NULL, 0); - } - } - else if (c->Protocol == CONNECTION_HUB_LINK_SERVER) - { - // HUB Link - LINK *k = (LINK *)s->Link; - - if (k != NULL) - { - UINT num_blocks = 0; - LockQueue(k->SendPacketQueue); - { - BLOCK *block; - - // Transfer the packet queue to the client thread - while (block = GetNext(c->SendBlocks)) - { - c->CurrentSendQueueSize -= block->Size; - - if (k->SendPacketQueue->num_item >= MAX_STORED_QUEUE_NUM) - { - FreeBlock(block); - } - else - { - num_blocks++; - k->CurrentSendPacketQueueSize += block->Size; - InsertQueue(k->SendPacketQueue, block); - } - } - } - UnlockQueue(k->SendPacketQueue); - - if (num_blocks != 0) - { - // Issue of cancellation - Cancel(k->ClientSession->Cancel1); - } - } - } - else if (c->Protocol == CONNECTION_HUB_BRIDGE) - { - // Local bridge - BRIDGE *b = s->Bridge; - - if (b != NULL) - { - if (b->Active) - { - BLOCK *block; - UINT num_packet = c->SendBlocks->num_item; // Packet count - - if (num_packet != 0) - { - // Packet data array - void **datas = MallocFast(sizeof(void *) * num_packet); - UINT *sizes = MallocFast(sizeof(UINT) * num_packet); - UINT i; - - i = 0; - while (block = GetNext(c->SendBlocks)) - { - if (hub != NULL && hub->Option != NULL && hub->Option->DisableUdpFilterForLocalBridgeNic == false && - b->Eth != NULL && IsDhcpPacketForSpecificMac(block->Buf, block->Size, b->Eth->MacAddress)) - { - // DHCP Packet is filtered - datas[i] = NULL; - sizes[i] = 0; - - Free(block->Buf); - } - else - { - datas[i] = block->Buf; - sizes[i] = block->Size; - - if (block->Size > 1514) - { - NormalizeEthMtu(b, c, block->Size); - } - } - - c->CurrentSendQueueSize -= block->Size; - Free(block); - i++; - } - - // Write the packet - EthPutPackets(b->Eth, num_packet, datas, sizes); - - Free(datas); - Free(sizes); - } - } - } - } -} - -// Reception of the block -void ConnectionReceive(CONNECTION *c, CANCEL *c1, CANCEL *c2) -{ - UINT i, num; - SOCKSET set; - SESSION *s; - TCPSOCK **tcpsocks; - UCHAR *buf; - UINT size; - UINT time; - UINT num_delayed = 0; - bool no_spinlock_for_delay = false; - UINT64 now = Tick64(); - HUB *hub = NULL; - // Validate arguments - if (c == NULL) - { - return; - } - - PROBE_STR("ConnectionReceive"); - - s = c->Session; - - if (s != NULL) - { - hub = s->Hub; - } - - if (hub != NULL) - { - no_spinlock_for_delay = hub->Option->NoSpinLockForPacketDelay; - } - - if (c->RecvBuf == NULL) - { - c->RecvBuf = Malloc(RECV_BUF_SIZE); - } - buf = c->RecvBuf; - - // Protocol - if (c->Protocol == CONNECTION_TCP) - { - // TCP - TCP *tcp = c->Tcp; - UINT next_delay_packet_diff = 0; - UINT current_recv_fifo_size = 0; - int recv_fifo_size_middle_update = 0; - - // Disconnect if disconnection interval is specified - if (s->ServerMode == false) - { - if (s->ClientOption->ConnectionDisconnectSpan != 0) - { - LockList(tcp->TcpSockList); - { - UINT i; - for (i = 0;i < LIST_NUM(tcp->TcpSockList);i++) - { - TCPSOCK *ts = LIST_DATA(tcp->TcpSockList, i); - if (ts->DisconnectTick != 0 && - ts->DisconnectTick <= now) - { - Debug("ts->DisconnectTick <= now\n"); - Disconnect(ts->Sock); - } - } - } - UnlockList(tcp->TcpSockList); - } - } - - if (s->HalfConnection && (s->ServerMode == false)) - { - // Check the direction of the current TCP connections. - // Disconnect one if the number of connections reaches - // the limit and has only one direction - LockList(tcp->TcpSockList); - { - UINT i, num; - UINT c2s, s2c; - c2s = s2c = 0; - num = LIST_NUM(tcp->TcpSockList); - if (num >= s->MaxConnection) - { - TCPSOCK *ts; - for (i = 0;i < num;i++) - { - ts = LIST_DATA(tcp->TcpSockList, i); - if (ts->Direction == TCP_SERVER_TO_CLIENT) - { - s2c++; - } - else - { - c2s++; - } - } - if (s2c == 0 || c2s == 0) - { - // Disconnect the last socket - Disconnect(ts->Sock); - Debug("Disconnect (s2c=%u, c2s=%u)\n", s2c, c2s); - } - } - } - UnlockList(tcp->TcpSockList); - } - - // Initializing the socket set - InitSockSet(&set); - LockList(tcp->TcpSockList); - { - num = LIST_NUM(tcp->TcpSockList); - tcpsocks = ToArrayEx(tcp->TcpSockList, true); - } - UnlockList(tcp->TcpSockList); - - for (i = 0;i < num;i++) - { - AddSockSet(&set, tcpsocks[i]->Sock); - } - - if (s->UseUdpAcceleration && s->UdpAccel != NULL) - { - if (s->UdpAccel->UdpSock != NULL) - { - AddSockSet(&set, s->UdpAccel->UdpSock); - } - } - - // Select - time = SELECT_TIME; - if (s->VirtualHost) - { - time = MIN(time, SELECT_TIME_FOR_NAT); - } - next_delay_packet_diff = GetNextDelayedPacketTickDiff(s); - time = MIN(time, next_delay_packet_diff); - num_delayed = LIST_NUM(s->DelayedPacketList); - - PROBE_STR("ConnectionReceive: Select 0"); - - if (s->Flag1 != set.NumSocket) - { - Select(&set, (num_delayed == 0 ? time : 1), c1, c2); - s->Flag1 = set.NumSocket; - } - else - { - if (no_spinlock_for_delay || time >= 50 || num_delayed == false) - { - Select(&set, (num_delayed == 0 ? time : (time > 100 ? (time - 100) : 1)), c1, c2); - s->Flag1 = set.NumSocket; - } - else - { - YieldCpu(); - } - } - - now = Tick64(); - - PROBE_STR("ConnectionReceive: Select 1"); - - if (s->UseUdpAcceleration && s->UdpAccel != NULL) - { - // Read the data received by the UDP If using the UDP acceleration mode - UdpAccelSetTick(s->UdpAccel, now); - UdpAccelPoll(s->UdpAccel); - - if (s->UdpAccelMss == 0) - { - s->UdpAccelMss = UdpAccelCalcMss(s->UdpAccel); - } - - while (true) - { - UINT current_packet_index = 0; - BLOCK *b = GetNext(s->UdpAccel->RecvBlockQueue); - - if (b == NULL) - { - break; - } - - if (b->Size > MAX_PACKET_SIZE) - { - // Packet size exceeded - FreeBlock(b); - } - else - { - if (CedarGetQueueBudgetBalance(c->Cedar) == 0) - { - FreeBlock(b); - } - else - { - // Add the data block to queue - InsertReceivedBlockToQueue(c, b, true); - - if ((current_packet_index % 32) == 0) - { - UINT current_recv_block_num = c->ReceivedBlocks->num_item; - int diff = (int)current_recv_block_num - (int)c->LastRecvBlocksNum; - - CedarAddQueueBudget(c->Cedar, diff); - - c->LastRecvBlocksNum = current_recv_block_num; - } - - current_packet_index++; - } - } - } - } - - { - bool new_status = UdpAccelIsSendReady(s->UdpAccel, true); - - if (s->IsUsingUdpAcceleration != new_status) - { - Debug("UDP Status Changed: %u\n", new_status); - } - - s->IsUsingUdpAcceleration = new_status; - } - - // Read all the data that has arrived to the TCP socket - for (i = 0;i < num;i++) - { - TCPSOCK *ts = tcpsocks[i]; - SOCK *sock = ts->Sock; - - if (s->IsRUDPSession) - { - TUBE *t = sock->BulkRecvTube; - - if (s->EnableBulkOnRUDP) - { - // R-UDP bulk transfer data reception - if (t != NULL && IsTubeConnected(t)) - { - UINT current_packet_index = 0; - while (true) - { - TUBEDATA *d = TubeRecvAsync(t); - BLOCK *block; - if (d == NULL) - { - // All reception complete - break; - } - - if (d->DataSize > sizeof(UINT64) && READ_UINT64(d->Data) == CONNECTION_BULK_COMPRESS_SIGNATURE) - { - // Compression - block = NewBlock(Clone(((UCHAR *)d->Data) + sizeof(UINT64), - d->DataSize - sizeof(UINT64)), - d->DataSize - sizeof(UINT64), - -1); - } - else - { - // Uncompressed - block = NewBlock(Clone(d->Data, d->DataSize), d->DataSize, 0); - } - - if (block->Size > MAX_PACKET_SIZE) - { - // Packet size exceeded - FreeBlock(block); - } - else - { - if (CedarGetQueueBudgetBalance(c->Cedar) == 0) - { - FreeBlock(block); - } - else - { - // Add the data block to queue - InsertReceivedBlockToQueue(c, block, true); - - if ((current_packet_index % 32) == 0) - { - UINT current_recv_block_num = c->ReceivedBlocks->num_item; - int diff = (int)current_recv_block_num - (int)c->LastRecvBlocksNum; - - CedarAddQueueBudget(c->Cedar, diff); - - c->LastRecvBlocksNum = current_recv_block_num; - } - - current_packet_index++; - } - } - - FreeTubeData(d); - - UPDATE_LAST_COMM_TIME(ts->LastCommTime, now); - UPDATE_LAST_COMM_TIME(ts->LastRecvTime, now); - UPDATE_LAST_COMM_TIME(c->Session->LastCommTime, now); - } - } - } - } - - if (c->IsInProc) - { - TUBEDATA *d; - UINT current_packet_index = 0; - - // Socket for in-process connection - if (IsTubeConnected(sock->RecvTube) == false) - { - // Communication is disconnected - goto DISCONNECT_THIS_TCP; - } - - while (true) - { - BLOCK *block; - // Get the packet data from the tube - d = TubeRecvAsync(sock->RecvTube); - if (d == NULL) - { - // All acquisition completed - break; - } - - block = NewBlock(Clone(d->Data, d->DataSize), d->DataSize, 0); - - if (block->Size > MAX_PACKET_SIZE) - { - // Packet size exceeded - FreeBlock(block); - } - else - { - if (CedarGetQueueBudgetBalance(c->Cedar) == 0) - { - FreeBlock(block); - } - else - { - // Add the data block to queue - InsertReceivedBlockToQueue(c, block, true); - - if ((current_packet_index % 32) == 0) - { - UINT current_recv_block_num = c->ReceivedBlocks->num_item; - int diff = (int)current_recv_block_num - (int)c->LastRecvBlocksNum; - - CedarAddQueueBudget(c->Cedar, diff); - - c->LastRecvBlocksNum = current_recv_block_num; - } - - current_packet_index++; - } - } - - FreeTubeData(d); - } - - UPDATE_LAST_COMM_TIME(c->Session->LastCommTime, now); - } - else - { - UINT current_fifo_budget = 0; - UINT current_packet_index = 0; - // A normal socket (Not in-process) - if (ts->WantSize == 0) - { - // Read for sizeof(UINT) first - ts->WantSize = sizeof(UINT); - } - - now = Tick64(); - -RECV_START: - current_fifo_budget = CedarGetFifoBudgetBalance(c->Cedar); - // Receive - if (ts->RecvFifo->size < current_fifo_budget) - { - UINT recv_buf_size = current_fifo_budget - ts->RecvFifo->size; - - recv_buf_size = MIN(recv_buf_size, RECV_BUF_SIZE); - - size = TcpSockRecv(s, ts, buf, recv_buf_size); - } - else - { - size = SOCK_LATER; - - UPDATE_LAST_COMM_TIME(c->Session->LastCommTime, now); - UPDATE_LAST_COMM_TIME(ts->LastCommTime, now); - } - - /* - // Experiment - if (c->ServerMode) - { - if ((ts->EstablishedTick + (UINT64)3000) <= now) - { - size = 0; - WHERE; - } - }*/ - - if (size == 0) - { -DISCONNECT_THIS_TCP: - s->LastTryAddConnectTime = Tick64(); - s->NumDisconnected++; - // Communication is disconnected - LockList(tcp->TcpSockList); - { - // Remove the socket from socket list - Delete(tcp->TcpSockList, ts); - // Release of TCPSOCK - FreeTcpSock(ts); - // Decrement - Dec(c->CurrentNumConnection); - Debug("--- TCP Connection Decremented: %u (%s Line %u)\n", Count(c->CurrentNumConnection), __FILE__, __LINE__); - Debug("LIST_NUM(tcp->TcpSockList): %u\n", LIST_NUM(tcp->TcpSockList)); - } - UnlockList(tcp->TcpSockList); - - continue; - } - else if (size == SOCK_LATER) - { - // State of waiting reception : don't do anything - if (IS_RECV_TCP_SOCK(ts)) - { - if ((now > ts->LastCommTime) && ((now - ts->LastCommTime) >= ((UINT64)s->Timeout))) - { - // The connection has timed out - Debug("Connection %u Timeouted.\n", i); - goto DISCONNECT_THIS_TCP; - } - } - } - else - { - UINT budget_balance = CedarGetFifoBudgetBalance(c->Cedar); - UINT fifo_size_limit = budget_balance; - - if (fifo_size_limit > MAX_BUFFERING_PACKET_SIZE) - { - fifo_size_limit = MAX_BUFFERING_PACKET_SIZE; - } - - // Update the last communication time - UPDATE_LAST_COMM_TIME(c->Session->LastCommTime, now); - UPDATE_LAST_COMM_TIME(ts->LastRecvTime, now); - - CedarAddFifoBudget(c->Cedar, (int)size); - recv_fifo_size_middle_update += (int)size; - - // Write the received data into the FIFO - PROBE_DATA2("WriteRecvFifo", buf, size); - WriteRecvFifo(s, ts, buf, size); - - // Stop receiving when the receive buffer is full - if (ts->RecvFifo->size < fifo_size_limit) - { - goto RECV_START; - } - } - - current_recv_fifo_size += FifoSize(ts->RecvFifo); - - // process the data written to FIFO - while (ts->RecvFifo->size >= ts->WantSize) - { - UCHAR *buf; - void *data; - BLOCK *block; - UINT sz; - // A sufficient amount of data is already stored - // Get the pointer of the data - buf = (UCHAR *)ts->RecvFifo->p + ts->RecvFifo->pos; - - switch (ts->Mode) - { - case 0: - // The number of Data blocks - ts->WantSize = sizeof(UINT); - Copy(&sz, buf, sizeof(UINT)); - PROBE_DATA2("ReadFifo 0", buf, sizeof(UINT)); - sz = Endian32(sz); - ts->NextBlockNum = sz; - ReadFifo(ts->RecvFifo, NULL, sizeof(UINT)); - - s->TotalRecvSize += sizeof(UINT); - s->TotalRecvSizeReal += sizeof(UINT); - - ts->CurrentPacketNum = 0; - if (ts->NextBlockNum != 0) - { - if (ts->NextBlockNum == KEEP_ALIVE_MAGIC) - { - ts->Mode = 3; - } - else - { - ts->Mode = 1; - } - } - break; - - case 1: - // Data block size - Copy(&sz, buf, sizeof(UINT)); - sz = Endian32(sz); - PROBE_DATA2("ReadFifo 1", buf, sizeof(UINT)); - if (sz > (MAX_PACKET_SIZE * 2)) - { - // received a strange data size - // TCP/IP Error? - Debug("%s %u sz > (MAX_PACKET_SIZE * 2)\n", __FILE__, __LINE__); - Disconnect(ts->Sock); - } - ts->NextBlockSize = MIN(sz, MAX_PACKET_SIZE * 2); - ReadFifo(ts->RecvFifo, NULL, sizeof(UINT)); - - s->TotalRecvSize += sizeof(UINT); - s->TotalRecvSizeReal += sizeof(UINT); - - ts->WantSize = ts->NextBlockSize; - if (ts->WantSize != 0) - { - ts->Mode = 2; - } - else - { - ts->Mode = 1; - ts->WantSize = sizeof(UINT); - ts->CurrentPacketNum++; - if (ts->CurrentPacketNum >= ts->NextBlockNum) - { - ts->Mode = 0; - } - } - break; - - case 2: - // Data block body - ts->WantSize = sizeof(UINT); - ts->CurrentPacketNum++; - data = MallocFast(ts->NextBlockSize); - Copy(data, buf, ts->NextBlockSize); - PROBE_DATA2("ReadFifo 2", buf, ts->NextBlockSize); - ReadFifo(ts->RecvFifo, NULL, ts->NextBlockSize); - block = NewBlock(data, ts->NextBlockSize, s->UseCompress ? -1 : 0); - - UPDATE_LAST_COMM_TIME(c->Session->LastCommTime, now); - UPDATE_LAST_COMM_TIME(ts->LastCommTime, now); - - if (block->Size > MAX_PACKET_SIZE) - { - // Packet size exceeded - FreeBlock(block); - } - else - { - if (CedarGetQueueBudgetBalance(c->Cedar) == 0) - { - FreeBlock(block); - } - else - { - // Add the data block to queue - InsertReceivedBlockToQueue(c, block, true); - - if ((current_packet_index % 32) == 0) - { - UINT current_recv_block_num = c->ReceivedBlocks->num_item; - int diff = (int)current_recv_block_num - (int)c->LastRecvBlocksNum; - - CedarAddQueueBudget(c->Cedar, diff); - - c->LastRecvBlocksNum = current_recv_block_num; - } - - current_packet_index++; - } - } - - if (ts->CurrentPacketNum >= ts->NextBlockNum) - { - // Reception of all the data blocks completed - ts->Mode = 0; - } - else - { - // Receive next data block size - ts->Mode = 1; - } - break; - - case 3: - // Keep-Alive packet size - ts->Mode = 4; - Copy(&sz, buf, sizeof(UINT)); - PROBE_DATA2("ReadFifo 3", buf, sizeof(UINT)); - sz = Endian32(sz); - if (sz > MAX_KEEPALIVE_SIZE) - { - // received a strange data size - // TCP/IP Error? - Debug("%s %u sz > MAX_KEEPALIVE_SIZE\n", __FILE__, __LINE__); - Disconnect(ts->Sock); - } - ts->NextBlockSize = MIN(sz, MAX_KEEPALIVE_SIZE); - ReadFifo(ts->RecvFifo, NULL, sizeof(UINT)); - - UPDATE_LAST_COMM_TIME(c->Session->LastCommTime, now); - UPDATE_LAST_COMM_TIME(ts->LastCommTime, now); - - s->TotalRecvSize += sizeof(UINT); - s->TotalRecvSizeReal += sizeof(UINT); - - ts->WantSize = sz; - break; - - case 4: - // Keep-Alive packet body - //Debug("KeepAlive Recved.\n"); - ts->Mode = 0; - sz = ts->NextBlockSize; - - if (sz >= (StrLen(UDP_NAT_T_PORT_SIGNATURE_IN_KEEP_ALIVE) + sizeof(USHORT))) - { - UCHAR *keep_alive_buffer = FifoPtr(ts->RecvFifo); - - if (Cmp(keep_alive_buffer, UDP_NAT_T_PORT_SIGNATURE_IN_KEEP_ALIVE, StrLen(UDP_NAT_T_PORT_SIGNATURE_IN_KEEP_ALIVE)) == 0) - { - USHORT us = READ_USHORT(keep_alive_buffer + StrLen(UDP_NAT_T_PORT_SIGNATURE_IN_KEEP_ALIVE)); - - if (us != 0) - { - if (s->UseUdpAcceleration && s->UdpAccel != NULL) - { - UINT port = (UINT)us; - - if (s->UdpAccel->YourPortByNatTServer != port) - { - s->UdpAccel->YourPortByNatTServer = port; - s->UdpAccel->YourPortByNatTServerChanged = true; - - Debug("s->UdpAccel->YourPortByNatTServer: %u\n", - s->UdpAccel->YourPortByNatTServer); - } - } - } - } - } - - PROBE_DATA2("ReadFifo 4", NULL, 0); - ReadFifo(ts->RecvFifo, NULL, sz); - - UPDATE_LAST_COMM_TIME(c->Session->LastCommTime, now); - UPDATE_LAST_COMM_TIME(ts->LastCommTime, now); - - s->TotalRecvSize += sz; - s->TotalRecvSizeReal += sz; - - ts->WantSize = sizeof(UINT); - break; - } - } - - ShrinkFifoMemory(ts->RecvFifo); - //printf("Fifo: %u\n", ts->RecvFifo->memsize); - } - } - - if (true) - { - int diff; - - diff = (int)current_recv_fifo_size - (int)c->LastRecvFifoTotalSize; - - CedarAddFifoBudget(c->Cedar, (diff - recv_fifo_size_middle_update)); - - c->LastRecvFifoTotalSize = current_recv_fifo_size; - } - - if (true) - { - UINT current_recv_block_num = c->ReceivedBlocks->num_item; - int diff = (int)current_recv_block_num - (int)c->LastRecvBlocksNum; - - CedarAddQueueBudget(c->Cedar, diff); - - c->LastRecvBlocksNum = current_recv_block_num; - } - - Free(tcpsocks); - } - else if (c->Protocol == CONNECTION_UDP) - { - // UDP - UDP *udp = c->Udp; - SOCK *sock = NULL; - - if (s->ServerMode == false) - { - Lock(c->lock); - { - if (c->Udp->s != NULL) - { - sock = c->Udp->s; - if (sock != NULL) - { - AddRef(sock->ref); - } - } - } - Unlock(c->lock); - - InitSockSet(&set); - - if (sock != NULL) - { - AddSockSet(&set, sock); - } - - Select(&set, SELECT_TIME, c1, c2); - - if (sock != NULL) - { - IP ip; - UINT port; - UCHAR *buf; - UINT size; - - while (true) - { - buf = c->RecvBuf; - size = RecvFrom(sock, &ip, &port, buf, RECV_BUF_SIZE); - if (size == 0 && sock->IgnoreRecvErr == false) - { - Debug("UDP Socket Disconnected.\n"); - Lock(c->lock); - { - ReleaseSock(udp->s); - udp->s = NULL; - } - Unlock(c->lock); - break; - } - else if (size == SOCK_LATER) - { - break; - } - else - { - if (size) - { - PutUDPPacketData(c, buf, size); - } - } - } - } - - if (sock != NULL) - { - Release(sock->ref); - } - } - else - { - Select(NULL, SELECT_TIME, c1, c2); - } - } - else if (c->Protocol == CONNECTION_HUB_SECURE_NAT) - { - SNAT *snat = c->Session->SecureNAT; - VH *v = snat->Nat->Virtual; - UINT size; - void *data; - UINT num; - UINT select_wait_time = SELECT_TIME_FOR_NAT; - UINT next_delay_packet_diff = 0; - - if (snat->Nat != NULL && snat->Nat->Option.UseNat == false) - { - select_wait_time = SELECT_TIME; - } - else - { - if (snat->Nat != NULL) - { - LockList(v->NatTable); - { - if (LIST_NUM(v->NatTable) == 0 && LIST_NUM(v->ArpWaitTable) == 0) - { - select_wait_time = SELECT_TIME; - } - } - UnlockList(v->NatTable); - } - } - - next_delay_packet_diff = GetNextDelayedPacketTickDiff(s); - select_wait_time = MIN(select_wait_time, next_delay_packet_diff); - num_delayed = LIST_NUM(s->DelayedPacketList); - - if (no_spinlock_for_delay || select_wait_time >= 50 || num_delayed == false) - { - Select(NULL, (num_delayed == 0 ? select_wait_time : - (select_wait_time > 100 ? (select_wait_time - 100) : 1)), c1, c2); - } - else - { - YieldCpu(); - } - - num = 0; - - if (hub != NULL) - { - NatSetHubOption(v, hub->Option); - } - - // Receive a packet from the virtual machine - while (size = VirtualGetNextPacket(v, &data)) - { - BLOCK *block; - - // Generate packet block - block = NewBlock(data, size, 0); - if (block->Size > MAX_PACKET_SIZE) - { - // Packet size exceeded - FreeBlock(block); - } - else - { - // Add the data block to queue - InsertReceivedBlockToQueue(c, block, true); - } - num++; - if (num >= MAX_SEND_SOCKET_QUEUE_NUM) - { -// WHERE; - break; - } - } - } - else if (c->Protocol == CONNECTION_HUB_LINK_SERVER) - { - // HUB Link - // Waiting Cancel simply - if (c->SendBlocks->num_item == 0) - { - UINT time = SELECT_TIME; - UINT next_delay_packet_diff = 0; - - next_delay_packet_diff = GetNextDelayedPacketTickDiff(s); - time = MIN(time, next_delay_packet_diff); - num_delayed = LIST_NUM(s->DelayedPacketList); - - if (no_spinlock_for_delay || time >= 50 || num_delayed == false) - { - Select(NULL, (num_delayed == 0 ? time : (time > 100 ? (time - 100) : 1)), c1, c2); - } - else - { - YieldCpu(); - } - } - } - else if (c->Protocol == CONNECTION_HUB_LAYER3) - { - // Layer-3 switch session - L3IF *f = s->L3If; - UINT size, num = 0; - void *data; - - if (f->SendQueue->num_item == 0) - { - UINT time = SELECT_TIME_FOR_NAT; - UINT next_delay_packet_diff = 0; - - if (f->ArpWaitTable != NULL) - { - LockList(f->ArpWaitTable); - { - if (LIST_NUM(f->ArpWaitTable) == 0) - { - time = SELECT_TIME; - } - } - UnlockList(f->ArpWaitTable); - } - - next_delay_packet_diff = GetNextDelayedPacketTickDiff(s); - time = MIN(time, next_delay_packet_diff); - num_delayed = LIST_NUM(s->DelayedPacketList); - - if (no_spinlock_for_delay || time >= 50 || num_delayed == false) - { - Select(NULL, (num_delayed == 0 ? time : (time > 100 ? (time - 100) : 1)), c1, c2); - } - else - { - YieldCpu(); - } - } - - // Get the next packet - while (size = L3GetNextPacket(f, &data)) - { - BLOCK *block = NewBlock(data, size, 0); - if (block->Size > MAX_PACKET_SIZE) - { - FreeBlock(block); - } - else - { - InsertReceivedBlockToQueue(c, block, true); - } - - num++; - if (num >= MAX_SEND_SOCKET_QUEUE_NUM) - { - break; - } - } - } - else if (c->Protocol == CONNECTION_HUB_BRIDGE) - { - BRIDGE *b = c->Session->Bridge; - - // Bridge session - if (b->Active) - { - void *data; - UINT ret; - UINT num = 0; - bool check_device_num = false; - UINT time = SELECT_TIME; - UINT next_delay_packet_diff = 0; - - next_delay_packet_diff = GetNextDelayedPacketTickDiff(s); - time = MIN(time, next_delay_packet_diff); - num_delayed = LIST_NUM(s->DelayedPacketList); - - // Bridge is operating - if (no_spinlock_for_delay || time >= 50 || num_delayed == false) - { - Select(NULL, (num_delayed == 0 ? time : (time > 100 ? (time - 100) : 1)), c1, c2); - } - else - { - YieldCpu(); - } - - if ((b->LastNumDeviceCheck + BRIDGE_NUM_DEVICE_CHECK_SPAN) <= Tick64()) - { -#ifdef OS_WIN32 - check_device_num = true; -#endif // OS_WIN32 - b->LastNumDeviceCheck = Tick64(); - } - - // Get the next packet from the bridge - while (true) - { - if (check_device_num && b->LastNumDevice != GetEthDeviceHash()) - { - ret = INFINITE; - } - else - { - ret = EthGetPacket(b->Eth, &data); - } - -#ifdef OS_WIN32 - if (c->Session != NULL) - { - c->Session->BridgeIsEthLoopbackBlock = false; - if (b->Eth != NULL && b->Eth->LoopbackBlock) - { - // Check whether The Ethernet device in the bridge - // has the ability to block the loopback packet - c->Session->BridgeIsEthLoopbackBlock = true; - } - } -#endif // OS_WIN32 - - if (ret == INFINITE) - { - // Error occured: stop the bridge - CloseEth(b->Eth); - b->Eth = NULL; - b->Active = false; - ReleaseCancel(s->Cancel2); - s->Cancel2 = NULL; - - HLog(s->Hub, "LH_BRIDGE_2", s->Name, b->Name); - Debug("Bridge Device Error.\n"); - - break; - } - else if (ret == 0) - { - // There is no more packet to receive - break; - } - else - { - if (hub != NULL && hub->Option != NULL && hub->Option->DisableUdpFilterForLocalBridgeNic == false && - b->Eth != NULL && IsDhcpPacketForSpecificMac(data, ret, b->Eth->MacAddress)) - { - // DHCP Packet is filtered. - Free(data); - } - else - { - // Add the packet to queue - BLOCK *block = NewBlock(data, ret, 0); - - PROBE_DATA2("ConnectionReceive: NewBlock", data, ret); - - if (ret > 1514) - { - NormalizeEthMtu(b, c, ret); - } - - if (block->Size > MAX_PACKET_SIZE) - { - // Packet size exceeded - FreeBlock(block); - } - else - { - InsertReceivedBlockToQueue(c, block, true); - } - num++; - if (num >= MAX_SEND_SOCKET_QUEUE_NUM) - { - // WHERE; - break; - } - } - } - } - } - else - { - ETH *e; - // Bridge is stopped currently - Select(NULL, SELECT_TIME, c1, NULL); - - if (b->LastBridgeTry == 0 || (b->LastBridgeTry + BRIDGE_TRY_SPAN) <= Tick64()) - { - b->LastBridgeTry = Tick64(); - - // Try to open an Ethernet device - e = OpenEth(b->Name, b->Local, b->TapMode, b->TapMacAddress); - if (e != NULL) - { - // Success - b->Eth = e; - b->Active = true; - b->LastNumDeviceCheck = Tick64(); - b->LastNumDevice = GetEthDeviceHash(); - - // Update the NIC name of the bridge -#ifdef OS_WIN32 - if (IsEmptyStr(e->Title) == false) - { - StrCpy(b->Name, sizeof(b->Name), e->Title); - - if (b->ParentLocalBridge != NULL) - { - StrCpy(b->ParentLocalBridge->DeviceName, sizeof(b->ParentLocalBridge->DeviceName), e->Title); - } - } -#endif // OS_WIN32 - - Debug("Bridge Open Succeed.\n"); - - HLog(c->Session->Hub, "LH_BRIDGE_1", c->Session->Name, b->Name); - - s->Cancel2 = EthGetCancel(b->Eth); - } - } - } - } -} - -// Normalize the MTU of the Ethernet device -void NormalizeEthMtu(BRIDGE *b, CONNECTION *c, UINT packet_size) -{ - // Validate arguments - if (packet_size == 0 || b == NULL || c == NULL) - { - return; - } - - // Raise the MTU when the packet exceeds the current MTU - if (EthIsChangeMtuSupported(b->Eth)) - { - UINT currentMtu = EthGetMtu(b->Eth); - if (currentMtu != 0) - { - if (packet_size > currentMtu) - { - bool ok = EthSetMtu(b->Eth, packet_size); - - if (ok) - { - HLog(c->Session->Hub, "LH_SET_MTU", c->Session->Name, - b->Name, currentMtu, packet_size, packet_size); - } - else - { - UINT64 now = Tick64(); - - if (b->LastChangeMtuError == 0 || - now >= (b->LastChangeMtuError + 60000ULL)) - { - HLog(c->Session->Hub, "LH_SET_MTU_ERROR", c->Session->Name, - b->Name, currentMtu, packet_size, packet_size); - - b->LastChangeMtuError = now; - } - } - } - } - } -} - -// Release of the block -void FreeBlock(BLOCK *b) -{ - // Validate arguments - if (b == NULL) - { - return; - } - - Free(b->Buf); - Free(b); -} - -// Create a new block -BLOCK *NewBlock(void *data, UINT size, int compress) -{ - BLOCK *b; - // Validate arguments - if (data == NULL) - { - return NULL; - } - - b = MallocFast(sizeof(BLOCK)); - - b->RawFlagRetUdpAccel = 0; - - b->IsFlooding = false; - - b->PriorityQoS = b->Ttl = b->Param1 = 0; - - if (compress == 0) - { - // Uncompressed - b->Compressed = false; - b->Buf = data; - b->Size = size; - b->SizeofData = size; - } - else if (compress == 1) - { - UINT max_size; - - // Compressed - b->Compressed = true; - max_size = CalcCompress(size); - b->Buf = MallocFast(max_size); - b->Size = Compress(b->Buf, max_size, data, size); - b->SizeofData = size; - - // Discard old data block - Free(data); - } - else - { - // Expand - UINT max_size; - - b->Compressed = false; - max_size = MAX_PACKET_SIZE; - b->Buf = MallocFast(max_size); - b->Size = Uncompress(b->Buf, max_size, data, size); - b->SizeofData = size; - - // Discard old data - Free(data); - } - - return b; -} - -// Create a TCP socket -TCPSOCK *NewTcpSock(SOCK *s) -{ - TCPSOCK *ts; - // Validate arguments - if (s == NULL) - { - return NULL; - } - - ts = ZeroMalloc(sizeof(TCPSOCK)); - - ts->Sock = s; - AddRef(s->ref); - - ts->RecvFifo = NewFifo(); - ts->SendFifo = NewFifo(); - ts->EstablishedTick = ts->LastRecvTime = ts->LastCommTime = Tick64(); - - // Unset the time-out value - SetTimeout(s, TIMEOUT_INFINITE); - - return ts; -} - -// Release of TCP socket -void FreeTcpSock(TCPSOCK *ts) -{ - // Validate arguments - if (ts == NULL) - { - return; - } - - Disconnect(ts->Sock); - ReleaseSock(ts->Sock); - ReleaseFifo(ts->RecvFifo); - ReleaseFifo(ts->SendFifo); - - if (ts->SendKey) - { - FreeCrypt(ts->SendKey); - } - if (ts->RecvKey) - { - FreeCrypt(ts->RecvKey); - } - - Free(ts); -} - -// Exit the tunneling mode of connection -void EndTunnelingMode(CONNECTION *c) -{ - // Validate arguments - if (c == NULL) - { - return; - } - - // Protocol - if (c->Protocol == CONNECTION_TCP) - { - // TCP - DisconnectTcpSockets(c); - } - else - { - // UDP - DisconnectUDPSockets(c); - } -} - -// Shift the connection to tunneling mode -void StartTunnelingMode(CONNECTION *c) -{ - SOCK *s; - TCP *tcp; - TCPSOCK *ts; - IP ip; - UINT port; - // Validate arguments - if (c == NULL) - { - return; - } - - tcp = c->Tcp; - - // Protocol - if (c->Protocol == CONNECTION_TCP) - { - // TCP - s = c->FirstSock; - - if (c->IsInProc) - { - AddRef(s->ref); - c->TubeSock = s; - } - - ts = NewTcpSock(s); - - if (c->ServerMode == false) - { - if (c->Session->ClientOption->ConnectionDisconnectSpan != 0) - { - ts->DisconnectTick = Tick64() + c->Session->ClientOption->ConnectionDisconnectSpan * (UINT64)1000; - } - } - - LockList(tcp->TcpSockList); - { - Add(tcp->TcpSockList, ts); - } - UnlockList(tcp->TcpSockList); - ReleaseSock(s); - c->FirstSock = NULL; - } - else - { - // UDP - s = c->FirstSock; - Copy(&ip, &s->RemoteIP, sizeof(IP)); - // May disconnect TCP connection at this point - c->FirstSock = NULL; - Disconnect(s); - ReleaseSock(s); - - // Initialization of UDP structure - c->Udp = ZeroMalloc(sizeof(UDP)); - - if (c->ServerMode) - { - // Server mode - // Add an UDP Entry - AddUDPEntry(c->Cedar, c->Session); - c->Udp->s = NULL; - } - else - { - port = c->Session->ClientOption->PortUDP; - // Client mode - c->Udp->s = NewUDP(0); - // Write the IP address and port number - Copy(&c->Udp->ip, &ip, sizeof(IP)); - c->Udp->port = port; - } - - // Queue - c->Udp->BufferQueue = NewQueue(); - } -} - -// Generate a random value that depends on each machine -UINT GetMachineRand() -{ - char pcname[MAX_SIZE]; - UCHAR hash[SHA1_SIZE]; - - Zero(pcname, sizeof(pcname)); - GetMachineName(pcname, sizeof(pcname)); - - Sha1(hash, pcname, StrLen(pcname)); - - return READ_UINT(hash); -} - -// Function that accepts a new connection -void ConnectionAccept(CONNECTION *c) -{ - SOCK *s; - X *x; - K *k; - char tmp[128]; - UINT initial_timeout = CONNECTING_TIMEOUT; - UCHAR ctoken_hash[SHA1_SIZE]; - - // Validate arguments - if (c == NULL) - { - return; - } - - Zero(ctoken_hash, sizeof(ctoken_hash)); - - // Get a socket - s = c->FirstSock; - AddRef(s->ref); - - Dec(c->Cedar->AcceptingSockets); - - IPToStr(tmp, sizeof(tmp), &s->RemoteIP); - - SLog(c->Cedar, "LS_CONNECTION_START_1", tmp, s->RemoteHostname, (IS_SPECIAL_PORT(s->RemotePort) ? 0 : s->RemotePort), c->Name); - - // Timeout setting - initial_timeout += GetMachineRand() % (CONNECTING_TIMEOUT / 2); - SetTimeout(s, initial_timeout); - - // Handle third-party protocols - if (s->IsReverseAcceptedSocket == false && s->Type == SOCK_TCP) - { - if (c->Cedar != NULL && c->Cedar->Server != NULL) - { - PROTO *proto = c->Cedar->Server->Proto; - if (proto && ProtoHandleConnection(proto, s, NULL) == true) - { - c->Type = CONNECTION_TYPE_OTHER; - goto FINAL; - } - } - } - - // Specify the encryption algorithm - Lock(c->Cedar->lock); - { - if (c->Cedar->CipherList != NULL) - { - SetWantToUseCipher(s, c->Cedar->CipherList); - } - - x = CloneX(c->Cedar->ServerX); - k = CloneK(c->Cedar->ServerK); - } - Unlock(c->Cedar->lock); - - // Start the SSL communication - Copy(&s->SslAcceptSettings, &c->Cedar->SslAcceptSettings, sizeof(SSL_ACCEPT_SETTINGS)); - if (StartSSL(s, x, k) == false) - { - // Failed - AddNoSsl(c->Cedar, &s->RemoteIP); - Debug("ConnectionAccept(): StartSSL() failed\n"); - FreeX(x); - FreeK(k); - - goto FINAL; - } - - FreeX(x); - FreeK(k); - - SLog(c->Cedar, "LS_SSL_START", c->Name, s->CipherName); - - Copy(c->CToken_Hash, ctoken_hash, SHA1_SIZE); - - // Accept the connection - if (ServerAccept(c) == false) - { - // Failed - Debug("ConnectionAccept(): ServerAccept() failed with error %u\n", c->Err); - } - -FINAL: - if (c->flag1 == false) - { - Debug("%s %u c->flag1 == false\n", __FILE__, __LINE__); - Disconnect(s); - } - - DelConnection(c->Cedar, c); - ReleaseSock(s); -} - -// Stop the threads putting additional connection of all that are currently running -void StopAllAdditionalConnectThread(CONNECTION *c) -{ - UINT i, num; - SOCK **socks; - THREAD **threads; - // Validate arguments - if (c == NULL || c->ServerMode != false) - { - return; - } - - // Disconnect the socket first - LockList(c->ConnectingSocks); - { - num = LIST_NUM(c->ConnectingSocks); - socks = ToArray(c->ConnectingSocks); - DeleteAll(c->ConnectingSocks); - } - UnlockList(c->ConnectingSocks); - for (i = 0;i < num;i++) - { - Disconnect(socks[i]); - ReleaseSock(socks[i]); - } - Free(socks); - - // Then, wait for the suspension of the thread - LockList(c->ConnectingThreads); - { - num = LIST_NUM(c->ConnectingThreads); - Debug("c->ConnectingThreads: %u\n", num); - threads = ToArray(c->ConnectingThreads); - DeleteAll(c->ConnectingThreads); - } - UnlockList(c->ConnectingThreads); - for (i = 0;i < num;i++) - { - WaitThread(threads[i], INFINITE); - ReleaseThread(threads[i]); - } - Free(threads); -} - -// Stop the connection -void StopConnection(CONNECTION *c, bool no_wait) -{ - // Validate arguments - if (c == NULL) - { - return; - } - - Debug("Stop Connection: %s\n", c->Name); - - // Stop flag - c->Halt = true; - Disconnect(c->FirstSock); - - if (no_wait == false) - { - // Wait until the thread terminates - WaitThread(c->Thread, INFINITE); - } -} - -// Close all the UDP socket -void DisconnectUDPSockets(CONNECTION *c) -{ - // Validate arguments - if (c == NULL) - { - return; - } - if (c->Protocol != CONNECTION_UDP) - { - return; - } - - // Delete entry - if (c->ServerMode) - { - DelUDPEntry(c->Cedar, c->Session); - } - - // Delete the UDP structure - if (c->Udp != NULL) - { - if (c->Udp->s != NULL) - { - ReleaseSock(c->Udp->s); - } - if (c->Udp->BufferQueue != NULL) - { - // Release of the queue - BUF *b; - while (b = GetNext(c->Udp->BufferQueue)) - { - FreeBuf(b); - } - ReleaseQueue(c->Udp->BufferQueue); - } - Free(c->Udp); - c->Udp = NULL; - } - - if (c->FirstSock != NULL) - { - Disconnect(c->FirstSock); - ReleaseSock(c->FirstSock); - c->FirstSock = NULL; - } -} - -// Close all TCP connections -void DisconnectTcpSockets(CONNECTION *c) -{ - UINT i, num; - TCP *tcp; - TCPSOCK **tcpsocks; - // Validate arguments - if (c == NULL) - { - return; - } - if (c->Protocol != CONNECTION_TCP) - { - return; - } - - tcp = c->Tcp; - LockList(tcp->TcpSockList); - { - tcpsocks = ToArray(tcp->TcpSockList); - num = LIST_NUM(tcp->TcpSockList); - DeleteAll(tcp->TcpSockList); - } - UnlockList(tcp->TcpSockList); - - if (num != 0) - { - Debug("--- SOCKET STATUS ---\n"); - for (i = 0;i < num;i++) - { - TCPSOCK *ts = tcpsocks[i]; - Debug(" SOCK %2u: %u\n", i, ts->Sock->SendSize); - FreeTcpSock(ts); - } - } - - Free(tcpsocks); -} - -// Clean up of the connection -void CleanupConnection(CONNECTION *c) -{ - UINT i, num; - // Validate arguments - if (c == NULL) - { - return; - } - - if (c->LastRecvFifoTotalSize != 0) - { - CedarAddFifoBudget(c->Cedar, -((int)c->LastRecvFifoTotalSize)); - c->LastRecvFifoTotalSize = 0; - } - - if (c->LastRecvBlocksNum != 0) - { - CedarAddQueueBudget(c->Cedar, -((int)c->LastRecvBlocksNum)); - c->LastRecvBlocksNum = 0; - } - - if (c->LastTcpQueueSize != 0) - { - int diff = -((int)c->LastTcpQueueSize); - CedarAddCurrentTcpQueueSize(c->Cedar, diff); - c->LastTcpQueueSize = 0; - } - - if (c->LastPacketQueueSize != 0) - { - int diff = -((int)c->LastPacketQueueSize); - CedarAddCurrentTcpQueueSize(c->Cedar, diff); - c->LastPacketQueueSize = 0; - } - - DeleteLock(c->lock); - ReleaseCedar(c->Cedar); - - switch (c->Protocol) - { - case CONNECTION_TCP: - // Release of TCP connection list - DisconnectTcpSockets(c); - break; - - case CONNECTION_UDP: - break; - } - - ReleaseList(c->Tcp->TcpSockList); - Free(c->Tcp); - - ReleaseSock(c->FirstSock); - c->FirstSock = NULL; - - ReleaseSock(c->TubeSock); - c->TubeSock = NULL; - - ReleaseThread(c->Thread); - Free(c->Name); - - // Release all the receive block and send block - if (c->SendBlocks) - { - LockQueue(c->SendBlocks); - { - BLOCK *b; - while (b = GetNext(c->SendBlocks)) - { - FreeBlock(b); - } - } - UnlockQueue(c->SendBlocks); - } - if (c->SendBlocks2) - { - LockQueue(c->SendBlocks2); - { - BLOCK *b; - while (b = GetNext(c->SendBlocks2)) - { - FreeBlock(b); - } - } - UnlockQueue(c->SendBlocks2); - } - if (c->ReceivedBlocks) - { - LockQueue(c->ReceivedBlocks); - { - BLOCK *b; - while (b = GetNext(c->ReceivedBlocks)) - { - FreeBlock(b); - } - } - UnlockQueue(c->ReceivedBlocks); - } - - if (c->ConnectingThreads) - { - THREAD **threads; - LockList(c->ConnectingThreads); - { - num = LIST_NUM(c->ConnectingThreads); - threads = ToArray(c->ConnectingThreads); - for (i = 0;i < num;i++) - { - ReleaseThread(threads[i]); - } - Free(threads); - } - UnlockList(c->ConnectingThreads); - ReleaseList(c->ConnectingThreads); - } - - if (c->ConnectingSocks) - { - SOCK **socks; - LockList(c->ConnectingSocks); - { - num = LIST_NUM(c->ConnectingSocks); - socks = ToArray(c->ConnectingSocks); - for (i = 0;i < num;i++) - { - Disconnect(socks[i]); - ReleaseSock(socks[i]); - } - Free(socks); - } - UnlockList(c->ConnectingSocks); - ReleaseList(c->ConnectingSocks); - } - - if (c->RecvBuf) - { - Free(c->RecvBuf); - } - - if (c->ServerX != NULL) - { - FreeX(c->ServerX); - } - - if (c->ClientX != NULL) - { - FreeX(c->ClientX); - } - - ReleaseQueue(c->ReceivedBlocks); - ReleaseQueue(c->SendBlocks); - ReleaseQueue(c->SendBlocks2); - - DeleteCounter(c->CurrentNumConnection); - - if (c->CipherName != NULL) - { - Free(c->CipherName); - } - - Free(c); -} - -// Release of the connection -void ReleaseConnection(CONNECTION *c) -{ - // Validate arguments - if (c == NULL) - { - return; - } - - if (Release(c->ref) == 0) - { - CleanupConnection(c); - } -} - -// Comparison of connection -int CompareConnection(void *p1, void *p2) -{ - CONNECTION *c1, *c2; - if (p1 == NULL || p2 == NULL) - { - return 0; - } - c1 = *(CONNECTION **)p1; - c2 = *(CONNECTION **)p2; - if (c1 == NULL || c2 == NULL) - { - return 0; - } - - return StrCmpi(c1->Name, c2->Name); -} - -// Creating a server connection -CONNECTION *NewServerConnection(CEDAR *cedar, SOCK *s, THREAD *t) -{ - CONNECTION *c; - // Validate arguments - if (cedar == NULL) - { - return NULL; - } - - c = ZeroMalloc(sizeof(CONNECTION)); - c->ConnectedTick = Tick64(); - c->lock = NewLock(); - c->ref = NewRef(); - c->Cedar = cedar; - AddRef(c->Cedar->ref); - c->Protocol = CONNECTION_TCP; - c->Type = CONNECTION_TYPE_INIT; - c->FirstSock = s; - if (s != NULL) - { - AddRef(c->FirstSock->ref); - Copy(&c->ClientIp, &s->RemoteIP, sizeof(IP)); - StrCpy(c->ClientHostname, sizeof(c->ClientHostname), s->RemoteHostname); - } - c->Tcp = ZeroMalloc(sizeof(TCP)); - c->Tcp->TcpSockList = NewList(NULL); - c->ServerMode = true; - c->Status = CONNECTION_STATUS_ACCEPTED; - c->Name = CopyStr("INITING"); - c->Thread = t; - AddRef(t->ref); - c->CurrentNumConnection = NewCounter(); - Inc(c->CurrentNumConnection); - - c->ServerVer = cedar->Version; - c->ServerBuild = cedar->Build; - StrCpy(c->ServerStr, sizeof(c->ServerStr), cedar->ServerStr); - GetServerProductName(cedar->Server, c->ServerStr, sizeof(c->ServerStr)); - - if (s != NULL && s->RemoteX != NULL) - { - c->ServerX = CloneX(s->RemoteX); - } - - if (s != NULL && s->Type == SOCK_INPROC) - { - // In-process socket - c->IsInProc = true; - } - - // Creating a Queue - c->ReceivedBlocks = NewQueue(); - c->SendBlocks = NewQueue(); - c->SendBlocks2 = NewQueue(); - - return c; -} - -// Creating a Client Connection -CONNECTION *NewClientConnection(SESSION *s) -{ - return NewClientConnectionEx(s, NULL, 0, 0); -} -CONNECTION *NewClientConnectionEx(SESSION *s, char *client_str, UINT client_ver, UINT client_build) -{ - CONNECTION *c; - - // Initialization of CONNECTION object - c = ZeroMalloc(sizeof(CONNECTION)); - c->ConnectedTick = Tick64(); - c->lock = NewLock(); - c->ref = NewRef(); - c->Cedar = s->Cedar; - AddRef(c->Cedar->ref); - c->Protocol = CONNECTION_TCP; - c->Tcp = ZeroMalloc(sizeof(TCP)); - c->Tcp->TcpSockList = NewList(NULL); - c->ServerMode = false; - c->Status = CONNECTION_STATUS_CONNECTING; - c->Name = CopyStr("CLIENT_CONNECTION"); - c->Session = s; - c->CurrentNumConnection = NewCounter(); - c->LastCounterResetTick = Tick64(); - Inc(c->CurrentNumConnection); - - c->ConnectingThreads = NewList(NULL); - c->ConnectingSocks = NewList(NULL); - - if (client_str == NULL) - { - c->ClientVer = s->Cedar->Version; - c->ClientBuild = s->Cedar->Build; - - if (c->Session->VirtualHost == false) - { - if (c->Session->LinkModeClient == false) - { - StrCpy(c->ClientStr, sizeof(c->ClientStr), CEDAR_CLIENT_STR); - } - else - { - StrCpy(c->ClientStr, sizeof(c->ClientStr), CEDAR_SERVER_LINK_STR); - } - } - else - { - StrCpy(c->ClientStr, sizeof(c->ClientStr), CEDAR_ROUTER_STR); - } - } - else - { - c->ClientVer = client_ver; - c->ClientBuild = client_build; - StrCpy(c->ClientStr, sizeof(c->ClientStr), client_str); - } - - // Server name and port number - StrCpy(c->ServerName, sizeof(c->ServerName), s->ClientOption->Hostname); - c->ServerPort = s->ClientOption->Port; - - // Create queues - c->ReceivedBlocks = NewQueue(); - c->SendBlocks = NewQueue(); - c->SendBlocks2 = NewQueue(); - - return c; -} +// SoftEther VPN Source Code - Developer Edition Master Branch +// Cedar Communication Module +// © 2020 Nokia + +// Connection.c +// Connection Manager + +#include "CedarPch.h" + +// Determine whether the socket is to use to send +#define IS_SEND_TCP_SOCK(ts) \ + ((ts->Direction == TCP_BOTH) || ((ts->Direction == TCP_SERVER_TO_CLIENT) && (s->ServerMode)) || ((ts->Direction == TCP_CLIENT_TO_SERVER) && (s->ServerMode == false))) + +// Determine whether the socket is to use to receive +#define IS_RECV_TCP_SOCK(ts) \ + ((ts->Direction == TCP_BOTH) || ((ts->Direction == TCP_SERVER_TO_CLIENT) && (s->ServerMode == false)) || ((ts->Direction == TCP_CLIENT_TO_SERVER) && (s->ServerMode))) + +// Conversion of SECURE_SIGN +void InRpcSecureSign(SECURE_SIGN *t, PACK *p) +{ + // Validate arguments + if (t == NULL || p == NULL) + { + return; + } + + Zero(t, sizeof(SECURE_SIGN)); + PackGetStr(p, "SecurePublicCertName", t->SecurePublicCertName, sizeof(t->SecurePublicCertName)); + PackGetStr(p, "SecurePrivateKeyName", t->SecurePrivateKeyName, sizeof(t->SecurePrivateKeyName)); + t->ClientCert = PackGetX(p, "ClientCert"); + PackGetData2(p, "Random", t->Random, sizeof(t->Random)); + PackGetData2(p, "Signature", t->Signature, sizeof(t->Signature)); + t->UseSecureDeviceId = PackGetInt(p, "UseSecureDeviceId"); + t->BitmapId = PackGetInt(p, "BitmapId"); +} +void OutRpcSecureSign(PACK *p, SECURE_SIGN *t) +{ + // Validate arguments + if (p == NULL || t == NULL) + { + return; + } + + PackAddStr(p, "SecurePublicCertName", t->SecurePublicCertName); + PackAddStr(p, "SecurePrivateKeyName", t->SecurePrivateKeyName); + PackAddX(p, "ClientCert", t->ClientCert); + PackAddData(p, "Random", t->Random, sizeof(t->Random)); + PackAddData(p, "Signature", t->Signature, sizeof(t->Signature)); + PackAddInt(p, "UseSecureDeviceId", t->UseSecureDeviceId); + PackAddInt(p, "BitmapId", t->BitmapId); +} +void FreeRpcSecureSign(SECURE_SIGN *t) +{ + // Validate arguments + if (t == NULL) + { + return; + } + + FreeX(t->ClientCert); +} + +// Generate the next packet +BUF *NewKeepPacket(bool server_mode) +{ + BUF *b = NewBuf(); + char *string = KEEP_ALIVE_STRING; + + WriteBuf(b, string, StrLen(string)); + + SeekBuf(b, 0, 0); + + return b; +} + +// KEEP thread +void KeepThread(THREAD *thread, void *param) +{ + KEEP *k = (KEEP *)param; + SOCK *s; + char server_name[MAX_HOST_NAME_LEN + 1]; + UINT server_port; + bool udp_mode; + bool enabled; + // Validate arguments + if (thread == NULL || k == NULL) + { + return; + } + +WAIT_FOR_ENABLE: + Wait(k->HaltEvent, KEEP_POLLING_INTERVAL); + + // Wait until it becomes enabled + while (true) + { + enabled = false; + Lock(k->lock); + { + if (k->Enable) + { + if (StrLen(k->ServerName) != 0 && k->ServerPort != 0 && k->Interval != 0) + { + StrCpy(server_name, sizeof(server_name), k->ServerName); + server_port = k->ServerPort; + udp_mode = k->UdpMode; + enabled = true; + } + } + } + Unlock(k->lock); + if (enabled) + { + break; + } + if (k->Halt) + { + return; + } + Wait(k->HaltEvent, KEEP_POLLING_INTERVAL); + } + + if (udp_mode == false) + { + // TCP mode + // Try until a success to connection + while (true) + { + UINT64 connect_started_tick; + bool changed = false; + Lock(k->lock); + { + if (StrCmpi(k->ServerName, server_name) != 0 || + k->ServerPort != server_port || k->Enable == false || + k->UdpMode) + { + changed = true; + } + } + Unlock(k->lock); + if (changed) + { + // Settings are changed + goto WAIT_FOR_ENABLE; + } + + if (k->Halt) + { + // Stop + return; + } + + // Attempt to connect to the server + connect_started_tick = Tick64(); + s = ConnectEx2(server_name, server_port, KEEP_TCP_TIMEOUT, (bool *)&k->Halt); + if (s != NULL) + { + // Successful connection + break; + } + + // Connection failure: Wait until timeout or the setting is changed + while (true) + { + changed = false; + if (k->Halt) + { + // Stop + return; + } + Lock(k->lock); + { + if (StrCmpi(k->ServerName, server_name) != 0 || + k->ServerPort != server_port || k->Enable == false || + k->UdpMode) + { + changed = true; + } + } + Unlock(k->lock); + + if (changed) + { + // Settings are changed + goto WAIT_FOR_ENABLE; + } + + if ((Tick64() - connect_started_tick) >= KEEP_RETRY_INTERVAL) + { + break; + } + + Wait(k->HaltEvent, KEEP_POLLING_INTERVAL); + } + } + + // Success to connect the server + // Send and receive packet data periodically + if (s != NULL) + { + UINT64 last_packet_sent_time = 0; + while (true) + { + SOCKSET set; + UINT ret; + UCHAR buf[MAX_SIZE]; + bool changed; + + InitSockSet(&set); + AddSockSet(&set, s); + + Select(&set, KEEP_POLLING_INTERVAL, k->Cancel, NULL); + + ret = Recv(s, buf, sizeof(buf), false); + if (ret == 0) + { + // Disconnected + Disconnect(s); + ReleaseSock(s); + s = NULL; + } + + if (s != NULL) + { + if ((Tick64() - last_packet_sent_time) >= (UINT64)k->Interval) + { + BUF *b; + + // Send the next packet + last_packet_sent_time = Tick64(); + + b = NewKeepPacket(k->Server); + + ret = Send(s, b->Buf, b->Size, false); + FreeBuf(b); + + if (ret == 0) + { + // Disconnected + Disconnect(s); + ReleaseSock(s); + s = NULL; + } + } + } + + changed = false; + + Lock(k->lock); + { + if (StrCmpi(k->ServerName, server_name) != 0 || + k->ServerPort != server_port || k->Enable == false || + k->UdpMode) + { + changed = true; + } + } + Unlock(k->lock); + + if (changed || s == NULL) + { + // Setting has been changed or disconnected + Disconnect(s); + ReleaseSock(s); + s = NULL; + goto WAIT_FOR_ENABLE; + } + else + { + if (k->Halt) + { + // Stop + Disconnect(s); + ReleaseSock(s); + return; + } + } + } + } + } + else + { + IP dest_ip; + // UDP mode + // Try to create socket until it successes + while (true) + { + UINT64 connect_started_tick; + bool changed = false; + Lock(k->lock); + { + if (StrCmpi(k->ServerName, server_name) != 0 || + k->ServerPort != server_port || k->Enable == false || + k->UdpMode == false) + { + changed = true; + } + } + Unlock(k->lock); + if (changed) + { + // Settings are changed + goto WAIT_FOR_ENABLE; + } + + if (k->Halt) + { + // Stop + return; + } + + // Attempt to create a socket + connect_started_tick = Tick64(); + + // Attempt to resolve the name first + if (GetIP(&dest_ip, server_name)) + { + // After successful name resolution, create a socket + s = NewUDP(0); + if (s != NULL) + { + // Creating success + break; + } + } + + // Failure to create: wait until timeout or the setting is changed + while (true) + { + changed = false; + if (k->Halt) + { + // Stop + return; + } + Lock(k->lock); + { + if (StrCmpi(k->ServerName, server_name) != 0 || + k->ServerPort != server_port || k->Enable == false || + k->UdpMode == false) + { + changed = true; + } + } + Unlock(k->lock); + + if (changed) + { + // Settings are changed + goto WAIT_FOR_ENABLE; + } + + if ((Tick64() - connect_started_tick) >= KEEP_RETRY_INTERVAL) + { + break; + } + + Wait(k->HaltEvent, KEEP_POLLING_INTERVAL); + } + } + + // Send the packet data periodically + if (s != NULL) + { + UINT64 last_packet_sent_time = 0; + UINT num_ignore_errors = 0; + while (true) + { + SOCKSET set; + UINT ret; + UCHAR buf[MAX_SIZE]; + bool changed; + IP src_ip; + UINT src_port; + + InitSockSet(&set); + AddSockSet(&set, s); + + Select(&set, KEEP_POLLING_INTERVAL, k->Cancel, NULL); + + // Receive + ret = RecvFrom(s, &src_ip, &src_port, buf, sizeof(buf)); + if (ret == 0) + { + if (s->IgnoreRecvErr == false) + { +LABEL_DISCONNECTED: + // Disconnected + Disconnect(s); + ReleaseSock(s); + s = NULL; + } + else + { + if ((num_ignore_errors++) >= MAX_NUM_IGNORE_ERRORS) + { + goto LABEL_DISCONNECTED; + } + } + } + + if (s != NULL) + { + if ((Tick64() - last_packet_sent_time) >= (UINT64)k->Interval) + { + BUF *b; + + // Send the next packet + last_packet_sent_time = Tick64(); + + b = NewKeepPacket(k->Server); + + ret = SendTo(s, &dest_ip, server_port, b->Buf, b->Size); + FreeBuf(b); + + if (ret == 0 && s->IgnoreSendErr == false) + { + // Disconnected + Disconnect(s); + ReleaseSock(s); + s = NULL; + } + } + } + + changed = false; + + Lock(k->lock); + { + if (StrCmpi(k->ServerName, server_name) != 0 || + k->ServerPort != server_port || k->Enable == false || + k->UdpMode == false) + { + changed = true; + } + } + Unlock(k->lock); + + if (changed || s == NULL) + { + // Setting has been changed or disconnected + Disconnect(s); + ReleaseSock(s); + s = NULL; + goto WAIT_FOR_ENABLE; + } + else + { + if (k->Halt) + { + // Stop + Disconnect(s); + ReleaseSock(s); + return; + } + } + } + } + } +} + +// Stop the KEEP +void StopKeep(KEEP *k) +{ + // Validate arguments + if (k == NULL) + { + return; + } + + k->Halt = true; + Set(k->HaltEvent); + Cancel(k->Cancel); + + WaitThread(k->Thread, INFINITE); + ReleaseThread(k->Thread); + DeleteLock(k->lock); + + ReleaseCancel(k->Cancel); + ReleaseEvent(k->HaltEvent); + + Free(k); +} + +// Start the KEEP +KEEP *StartKeep() +{ + KEEP *k = ZeroMalloc(sizeof(KEEP)); + + k->lock = NewLock(); + k->HaltEvent = NewEvent(); + k->Cancel = NewCancel(); + + // Thread start + k->Thread = NewThread(KeepThread, k); + + return k; +} + +// Copy the client authentication data +CLIENT_AUTH *CopyClientAuth(CLIENT_AUTH *a) +{ + CLIENT_AUTH *ret; + // Validate arguments + if (a == NULL) + { + return NULL; + } + + ret = ZeroMallocEx(sizeof(CLIENT_AUTH), true); + + ret->AuthType = a->AuthType; + StrCpy(ret->Username, sizeof(ret->Username), a->Username); + + switch (a->AuthType) + { + case CLIENT_AUTHTYPE_ANONYMOUS: + // Anonymous authentication + break; + + case CLIENT_AUTHTYPE_PASSWORD: + // Password authentication + Copy(ret->HashedPassword, a->HashedPassword, SHA1_SIZE); + break; + + case CLIENT_AUTHTYPE_PLAIN_PASSWORD: + // Plaintext password authentication + StrCpy(ret->PlainPassword, sizeof(ret->PlainPassword), a->PlainPassword); + break; + + case CLIENT_AUTHTYPE_CERT: + // Certificate authentication + ret->ClientX = CloneX(a->ClientX); + ret->ClientK = CloneK(a->ClientK); + break; + + case CLIENT_AUTHTYPE_SECURE: + // Secure device authentication + StrCpy(ret->SecurePublicCertName, sizeof(ret->SecurePublicCertName), a->SecurePublicCertName); + StrCpy(ret->SecurePrivateKeyName, sizeof(ret->SecurePrivateKeyName), a->SecurePrivateKeyName); + break; + + case CLIENT_AUTHTYPE_OPENSSLENGINE: + // Secure device authentication + ret->ClientX = CloneX(a->ClientX); + StrCpy(ret->OpensslEnginePrivateKeyName, sizeof(ret->OpensslEnginePrivateKeyName), a->OpensslEnginePrivateKeyName); + StrCpy(ret->OpensslEngineName, sizeof(ret->OpensslEngineName), a->OpensslEngineName); + ret->ClientK = OpensslEngineToK(ret->OpensslEnginePrivateKeyName, ret->OpensslEngineName); + break; + } + + return ret; +} + +// Write data to the transmit FIFO (automatic encryption) +void WriteSendFifo(SESSION *s, TCPSOCK *ts, void *data, UINT size) +{ + // Validate arguments + if (s == NULL || ts == NULL || data == NULL) + { + return; + } + + WriteFifo(ts->SendFifo, data, size); +} + +// Write data to the reception FIFO (automatic decryption) +void WriteRecvFifo(SESSION *s, TCPSOCK *ts, void *data, UINT size) +{ + // Validate arguments + if (s == NULL || ts == NULL || data == NULL) + { + return; + } + + WriteFifo(ts->RecvFifo, data, size); +} + +// TCP socket receive +UINT TcpSockRecv(SESSION *s, TCPSOCK *ts, void *data, UINT size) +{ + // Receive + return Recv(ts->Sock, data, size, s->UseEncrypt); +} + +// TCP socket send +UINT TcpSockSend(SESSION *s, TCPSOCK *ts, void *data, UINT size) +{ + // Transmission + return Send(ts->Sock, data, size, s->UseEncrypt); +} + +// Send the data as UDP packet +void SendDataWithUDP(SOCK *s, CONNECTION *c) +{ + UCHAR *buf; + BUF *b; + UINT64 dummy_64 = 0; + UCHAR dummy_buf[16]; + UINT64 now = Tick64(); + UINT ret; + bool force_flag = false; + bool packet_sent = false; + // Validate arguments + if (s == NULL || c == NULL) + { + return; + } + + // Allocate the temporary buffer in heap + if (c->RecvBuf == NULL) + { + c->RecvBuf = Malloc(RECV_BUF_SIZE); + } + buf = c->RecvBuf; + + if (c->Udp->NextKeepAliveTime == 0 || c->Udp->NextKeepAliveTime <= now) + { + force_flag = true; + } + + // Creating a buffer + while ((c->SendBlocks->num_item > 0) || force_flag) + { + UINT *key32; + UINT64 *seq; + char *sign; + + force_flag = false; + + // Assemble a buffer from the current queue + b = NewBuf(); + + // Keep an area for packet header (16 bytes) + WriteBuf(b, dummy_buf, sizeof(dummy_buf)); + + // Pack the packets in transmission queue + while (true) + { + BLOCK *block; + + if (b->Size > UDP_BUF_SIZE) + { + break; + } + block = GetNext(c->SendBlocks); + if (block == NULL) + { + break; + } + + if (block->Size != 0) + { + WriteBufInt(b, block->Size); + WriteBuf(b, block->Buf, block->Size); + + c->Session->TotalSendSize += (UINT64)block->SizeofData; + c->Session->TotalSendSizeReal += (UINT64)block->Size; + } + + FreeBlock(block); + break; + } + + // Write sequence number and session key + sign = (char *)(((UCHAR *)b->Buf)); + key32 = (UINT *)(((UCHAR *)b->Buf + 4)); + seq = (UINT64 *)(((UCHAR *)b->Buf + 8)); + Copy(sign, SE_UDP_SIGN, 4); + *key32 = Endian32(c->Session->SessionKey32); + *seq = Endian64(c->Udp->Seq++); // Increment the sequence number + +// InsertQueue(c->Udp->BufferQueue, b); + + packet_sent = true; +/* } + + // Send a buffer + while (c->Udp->BufferQueue->num_item != 0) + { + FIFO *f = c->Udp->BufferQueue->fifo; + BUF **pb = (BUF**)(((UCHAR *)f->p) + f->pos); + BUF *b = *pb; + +*/ ret = SendTo(s, &c->Udp->ip, c->Udp->port, b->Buf, b->Size); + if (ret == SOCK_LATER) + { + // Blocking + Debug("."); +// break; + } + if (ret != b->Size) + { + if (s->IgnoreSendErr == false) + { + // Error + Debug("******* SendTo Error !!!\n"); + } + } + + // Memory release + FreeBuf(b); +// GetNext(c->Udp->BufferQueue); + } + + if (packet_sent) + { + // KeepAlive time update + c->Udp->NextKeepAliveTime = now + (UINT64)GenNextKeepAliveSpan(c); + } +} + +// Write the data of the UDP packet to the connection +void PutUDPPacketData(CONNECTION *c, void *data, UINT size) +{ + BUF *b; + char sign[4]; + // Validate arguments + if (c == NULL || data == NULL) + { + return; + } + + // Examine the protocol + if (c->Protocol != CONNECTION_UDP) + { + // UDP protocol is not used + return; + } + + // Buffer configuration + b = NewBuf(); + WriteBuf(b, data, size); + + SeekBuf(b, 0, 0); + ReadBuf(b, sign, 4); + + // Signature confirmation + if (Cmp(sign, SE_UDP_SIGN, 4) == 0) + { + UINT key32; + + // Session key number + key32 = ReadBufInt(b); + + if (c->Session->SessionKey32 == key32) + { + UINT64 seq; + + // Read the Sequence number + ReadBuf(b, &seq, sizeof(seq)); + seq = Endian64(seq); + + if ((UINT)(seq - c->Udp->RecvSeq - (UINT64)1)) + { + //Debug("** UDP Seq Lost %u\n", (UINT)(seq - c->Udp->RecvSeq - (UINT64)1)); + } + c->Udp->RecvSeq = seq; + + //Debug("SEQ: %I32u\n", seq); + + while (true) + { + UINT size; + + size = ReadBufInt(b); + if (size == 0) + { + break; + } + else if (size <= MAX_PACKET_SIZE) + { + void *tmp; + BLOCK *block; + + tmp = Malloc(size); + if (ReadBuf(b, tmp, size) != size) + { + Free(tmp); + break; + } + + // Block configuration + block = NewBlock(tmp, size, 0); + + // Insert Block + InsertReceivedBlockToQueue(c, block, false); + } + } + + // Update the last communication time + c->Session->LastCommTime = Tick64(); + } + else + { + Debug("Invalid SessionKey: 0x%X\n", key32); + } + } + + FreeBuf(b); +} + +// Add a block to the receive queue +void InsertReceivedBlockToQueue(CONNECTION *c, BLOCK *block, bool no_lock) +{ + SESSION *s; + // Validate arguments + if (c == NULL || block == NULL) + { + return; + } + + s = c->Session; + + if (c->Protocol == CONNECTION_TCP) + { + s->TotalRecvSizeReal += block->SizeofData; + s->TotalRecvSize += block->Size; + } + + if (no_lock == false) + { + LockQueue(c->ReceivedBlocks); + } + + if (c->ReceivedBlocks->num_item < MAX_STORED_QUEUE_NUM) + { + InsertQueue(c->ReceivedBlocks, block); + } + else + { + FreeBlock(block); + } + + if (no_lock == false) + { + UnlockQueue(c->ReceivedBlocks); + } +} + +// Generate the interval to the next Keep-Alive packet +// (This should be a random number for the network load reduction) +UINT GenNextKeepAliveSpan(CONNECTION *c) +{ + UINT a, b; + // Validate arguments + if (c == NULL) + { + return INFINITE; + } + + a = c->Session->Timeout; + b = rand() % (a / 2); + b = MAX(b, a / 5); + + return b; +} + +// send a Keep-Alive packet +void SendKeepAlive(CONNECTION *c, TCPSOCK *ts) +{ + UINT size, i, num; + UINT size_be; + SESSION *s; + UCHAR *buf; + bool insert_natt_port = false; + // Validate arguments + if (c == NULL || ts == NULL) + { + return; + } + + s = c->Session; + + size = rand() % MAX_KEEPALIVE_SIZE; + num = KEEP_ALIVE_MAGIC; + + if (s != NULL && s->UseUdpAcceleration && s->UdpAccel != NULL) + { + if (s->UdpAccel->MyPortByNatTServer != 0) + { + size = MAX(size, (StrLen(UDP_NAT_T_PORT_SIGNATURE_IN_KEEP_ALIVE) + sizeof(USHORT))); + + insert_natt_port = true; + } + } + + buf = MallocFast(size); + + for (i = 0;i < size;i++) + { + buf[i] = rand(); + } + + if (insert_natt_port) + { + USHORT myport = Endian16((USHORT)s->UdpAccel->MyPortByNatTServer); + + Copy(buf, UDP_NAT_T_PORT_SIGNATURE_IN_KEEP_ALIVE, StrLen(UDP_NAT_T_PORT_SIGNATURE_IN_KEEP_ALIVE)); + Copy(buf + StrLen(UDP_NAT_T_PORT_SIGNATURE_IN_KEEP_ALIVE), &myport, sizeof(USHORT)); + } + + num = Endian32(num); + size_be = Endian32(size); + WriteSendFifo(c->Session, ts, &num, sizeof(UINT)); + WriteSendFifo(c->Session, ts, &size_be, sizeof(UINT)); + WriteSendFifo(c->Session, ts, buf, size); + + c->Session->TotalSendSize += sizeof(UINT) * 2 + size; + c->Session->TotalSendSizeReal += sizeof(UINT) * 2 + size; + + Free(buf); +} + +// Transmission of block +void ConnectionSend(CONNECTION *c, UINT64 now) +{ + UINT i, num; + UINT min_count; + UINT64 max_recv_tick; + TCPSOCK **tcpsocks; + UINT size; + SESSION *s; + HUB *hub = NULL; + bool use_qos = false; + // Validate arguments + if (c == NULL) + { + return; + } + + s = c->Session; + + if (s != NULL) + { + hub = s->Hub; + use_qos = s->QoS; + } + + // Protocol + if (c->Protocol == CONNECTION_TCP) + { + // TCP + TCP *tcp = c->Tcp; + TCPSOCK *ts; + TCPSOCK *ts_hp; + UINT num_available; + bool is_rudp = false; + UINT tcp_queue_size = 0; + int tcp_queue_size_diff = 0; + LockList(tcp->TcpSockList); + { + num = LIST_NUM(tcp->TcpSockList); + tcpsocks = ToArrayEx(tcp->TcpSockList, true); + } + UnlockList(tcp->TcpSockList); + + if (s != NULL) + { + is_rudp = s->IsRUDPSession; + } + + // Select the socket that will be used to send + // Select a socket which have least delay count + min_count = INFINITE; + max_recv_tick = 0; + ts = NULL; + ts_hp = NULL; + + num_available = 0; + + if (c->IsInProc == false) + { + for (i = 0;i < num;i++) + { + TCPSOCK *tcpsock = tcpsocks[i]; + if (s != NULL && tcpsock->Sock->Connected && tcpsock->Sock->AsyncMode && + IS_SEND_TCP_SOCK(tcpsock)) + { + // Processing of KeepAlive + if (now >= tcpsock->NextKeepAliveTime || tcpsock->NextKeepAliveTime == 0 || + (s->UseUdpAcceleration && s->UdpAccel != NULL && s->UdpAccel->MyPortByNatTServerChanged)) + { + // Send the KeepAlive + SendKeepAlive(c, tcpsock); + tcpsock->NextKeepAliveTime = now + (UINT64)GenNextKeepAliveSpan(c); + + if (s->UseUdpAcceleration && s->UdpAccel != NULL) + { + s->UdpAccel->MyPortByNatTServerChanged = false; + } + } + + // Count the number of available sockets to send + num_available++; + + ts_hp = tcpsock; + } + } + } + + for (i = 0;i < num;i++) + { + TCPSOCK *tcpsock = tcpsocks[i]; + if (tcpsock->Sock->Connected && tcpsock->Sock->AsyncMode && + IS_SEND_TCP_SOCK(tcpsock)) + { + // Selection of the socket + bool b = false; + + if (use_qos == false) + { + b = true; + } + else if (num_available < 2) + { + b = true; + } + else if (tcpsock != ts_hp) + { + b = true; + } + + if (b) + { + if (is_rudp == false) + { + // Use a socket which have minimum delay occurrences in the case of such as a TCP socket + if (tcpsock->LateCount <= min_count) + { + min_count = tcpsock->LateCount; + ts = tcpsock; + } + } + else + { + // Use socket which have the largest last received time in the case of R-UDP socket + if (tcpsock->LastRecvTime >= max_recv_tick) + { + max_recv_tick = tcpsock->LastRecvTime; + ts = tcpsock; + } + } + } + } + + tcp_queue_size += tcpsock->SendFifo->size; + } + + tcp_queue_size_diff = ((int)tcp_queue_size) - ((int)c->LastTcpQueueSize); + + CedarAddCurrentTcpQueueSize(c->Cedar, tcp_queue_size_diff); + + c->LastTcpQueueSize = tcp_queue_size; + + if (ts_hp == NULL) + { + ts_hp = ts; + } + + if (use_qos == false) + { + ts_hp = ts; + } + + if (ts == NULL || ts_hp == NULL) + { + // The socket available to send doesn't currently exist + } + else + { + TCPSOCK *tss; + UINT j; + QUEUE *q; + + if (s != NULL && s->UdpAccel != NULL) + { + UdpAccelSetTick(s->UdpAccel, now); + } + + for (j = 0;j < 2;j++) + { + if (j == 0) + { + q = c->SendBlocks2; + tss = ts_hp; + } + else + { + q = c->SendBlocks; + tss = ts; + } + // I reserve the data to send on the selected socket ts + if (q->num_item != 0) + { + UINT num_data; + BLOCK *b; + UINT size_quota_v1 = MAX_SEND_SOCKET_QUEUE_SIZE / s->MaxConnection; + UINT size_quota_v2 = MIN_SEND_SOCKET_QUEUE_SIZE; + UINT size_quota = MAX(size_quota_v1, size_quota_v2); + + if (tss->SendFifo->size >= size_quota) + { + // The size of the socket send queue is exceeded + // Unable to send + while (b = GetNext(q)) + { + if (b != NULL) + { + c->CurrentSendQueueSize -= b->Size; + FreeBlock(b); + } + } + } + else + { + if (c->IsInProc == false) + { + if (s->UseUdpAcceleration && s->UdpAccel != NULL && UdpAccelIsSendReady(s->UdpAccel, true)) + { + // UDP acceleration mode + while (b = GetNext(q)) + { + UdpAccelSendBlock(s->UdpAccel, b); + + s->TotalSendSize += b->Size; + s->TotalSendSizeReal += b->Size; + + c->CurrentSendQueueSize -= b->Size; + + FreeBlock(b); + } + } + else if (s->IsRUDPSession && s->EnableBulkOnRUDP && ts->Sock != NULL && ts->Sock->BulkSendTube != NULL) + { + // R-UDP bulk transfer + TUBE *t = ts->Sock->BulkSendTube; + bool flush = false; + TCP_PAIR_HEADER h; + + Zero(&h, sizeof(h)); + h.EnableHMac = s->EnableHMacOnBulkOfRUDP; + + while (b = GetNext(q)) + { + if (b->Compressed == false) + { + // Uncompressed + TubeSendEx(t, b->Buf, b->Size, &h, true); + + s->TotalSendSize += b->Size; + s->TotalSendSizeReal += b->Size; + + c->CurrentSendQueueSize -= b->Size; + } + else + { + // Compressed + UCHAR *new_buf = Malloc(b->Size + sizeof(UINT64)); + + WRITE_UINT64(new_buf, CONNECTION_BULK_COMPRESS_SIGNATURE); + + Copy(new_buf + sizeof(UINT64), b->Buf, b->Size); + + TubeSendEx(t, new_buf, b->Size + sizeof(UINT64), &h, true); + + s->TotalSendSize += b->SizeofData; + s->TotalSendSizeReal += b->Size; + + c->CurrentSendQueueSize -= b->Size; + + Free(new_buf); + } + + FreeBlock(b); + + flush = true; + } + + if (flush) + { + TubeFlush(t); + } + } + else + { + // TCP/IP socket + bool update_keepalive_timer = false; + // Number of data + num_data = Endian32(q->num_item); + PROBE_DATA2("WriteSendFifo num", &num_data, sizeof(UINT)); + WriteSendFifo(s, tss, &num_data, sizeof(UINT)); + + s->TotalSendSize += sizeof(UINT); + s->TotalSendSizeReal += sizeof(UINT); + + while (b = GetNext(q)) + { + // Size data + UINT size_data; + size_data = Endian32(b->Size); + PROBE_DATA2("WriteSendFifo size", &size_data, sizeof(UINT)); + WriteSendFifo(s, tss, &size_data, sizeof(UINT)); + + c->CurrentSendQueueSize -= b->Size; + + s->TotalSendSize += sizeof(UINT); + s->TotalSendSizeReal += sizeof(UINT); + + // Data body + PROBE_DATA2("WriteSendFifo data", b->Buf, b->Size); + WriteSendFifo(s, tss, b->Buf, b->Size); + + s->TotalSendSize += b->SizeofData; + s->TotalSendSizeReal += b->Size; + + update_keepalive_timer = true; + + // Block release + FreeBlock(b); + } + + if (s->UseUdpAcceleration && s->UdpAccel != NULL && UdpAccelIsSendReady(s->UdpAccel, false)) + { + update_keepalive_timer = false; + } + + if (update_keepalive_timer) + { + // Increase the KeepAlive timer + tss->NextKeepAliveTime = now + (UINT64)GenNextKeepAliveSpan(c); + } + } + } + else + { + bool flush = false; + // In-process socket + while (b = GetNext(q)) + { + TubeSendEx(ts->Sock->SendTube, b->Buf, b->Size, NULL, true); + flush = true; + + s->TotalSendSize += b->Size; + s->TotalSendSizeReal += b->Size; + + c->CurrentSendQueueSize -= b->Size; + + FreeBlock(b); + } + + if (flush) + { + TubeFlush(ts->Sock->SendTube); + } + } + } + } + } + } + + // Send the reserved data to send registered in each socket now + if (c->IsInProc == false) + { + for (i = 0;i < num;i++) + { + ts = tcpsocks[i]; + +SEND_START: + if (ts->Sock->Connected == false) + { + s->LastTryAddConnectTime = Tick64(); + // Communication is disconnected + LockList(tcp->TcpSockList); + { + // Remove the socket from socket list + Delete(tcp->TcpSockList, ts); + // Release of TCPSOCK + FreeTcpSock(ts); + // Decrement the count + Dec(c->CurrentNumConnection); + Debug("--- TCP Connection Decremented: %u (%s Line %u)\n", Count(c->CurrentNumConnection), __FILE__, __LINE__); + Debug("LIST_NUM(tcp->TcpSockList): %u\n", LIST_NUM(tcp->TcpSockList)); + } + UnlockList(tcp->TcpSockList); + + continue; + } + + // Get Fifo size + if (ts->SendFifo->size != 0) + { + UCHAR *buf; + UINT want_send_size; + // Send only if the data to send exists by 1 byte or more + // Get the pointer to the buffer + buf = (UCHAR *)ts->SendFifo->p + ts->SendFifo->pos; + want_send_size = ts->SendFifo->size; + + PROBE_DATA2("TcpSockSend", buf, want_send_size); + size = TcpSockSend(s, ts, buf, want_send_size); + + if (size == 0) + { + // Disconnected + continue; + } + else if (size == SOCK_LATER) + { + // Packet is jammed + ts->LateCount++; // Increment of the delay counter + PROBE_STR("ts->LateCount++;"); + } + else + { + // Packet is sent only by 'size' + // Advance FIFO + ReadFifo(ts->SendFifo, NULL, size); + if (size < want_send_size) + { + // Fail to transmit all of the data that has been scheduled +#ifdef USE_PROBE + { + char tmp[MAX_SIZE]; + + snprintf(tmp, sizeof(tmp), "size < want_send_size: %u < %u", + size, want_send_size); + + PROBE_STR(tmp); + } +#endif // USE_PROBE + } + else + { + // Because sending all the packets is completed + // (The queue is exhausted), reset the delay counter + ts->LateCount = 0; + + PROBE_STR("TcpSockSend All Completed"); + } + // Updated the last communication date and time + UPDATE_LAST_COMM_TIME(c->Session->LastCommTime, now); + + goto SEND_START; + } + } + } + } + + Free(tcpsocks); + } + else if (c->Protocol == CONNECTION_UDP) + { + // UDP + UDP *udp = c->Udp; + SOCK *sock = NULL; + + Lock(c->lock); + { + sock = udp->s; + if (sock != NULL) + { + AddRef(sock->ref); + } + } + Unlock(c->lock); + + if (sock != NULL) + { + // Send with UDP + + // KeepAlive sending + if ((udp->NextKeepAliveTime == 0 || udp->NextKeepAliveTime <= now) || + (c->SendBlocks->num_item != 0) || (udp->BufferQueue->num_item != 0)) + { + // Send the current queue with UDP + SendDataWithUDP(sock, c); + } + } + + if (sock != NULL) + { + ReleaseSock(sock); + } + } + else if (c->Protocol == CONNECTION_HUB_SECURE_NAT) + { + // SecureNAT session + SNAT *snat = s->SecureNAT; + VH *v = snat->Nat->Virtual; + BLOCK *block; + UINT num_packet = 0; + + if (hub != NULL) + { + NatSetHubOption(v, hub->Option); + } + + while (block = GetNext(c->SendBlocks)) + { + num_packet++; + c->CurrentSendQueueSize -= block->Size; + VirtualPutPacket(v, block->Buf, block->Size); + Free(block); + } + + if (num_packet != 0) + { + VirtualPutPacket(v, NULL, 0); + } + } + else if (c->Protocol == CONNECTION_HUB_LAYER3) + { + // Layer-3 session + L3IF *f = s->L3If; + BLOCK *block; + UINT num_packet = 0; + + while (block = GetNext(c->SendBlocks)) + { + num_packet++; + c->CurrentSendQueueSize -= block->Size; + L3PutPacket(f, block->Buf, block->Size); + Free(block); + } + + if (num_packet != 0) + { + L3PutPacket(f, NULL, 0); + } + } + else if (c->Protocol == CONNECTION_HUB_LINK_SERVER) + { + // HUB Link + LINK *k = (LINK *)s->Link; + + if (k != NULL) + { + UINT num_blocks = 0; + LockQueue(k->SendPacketQueue); + { + BLOCK *block; + + // Transfer the packet queue to the client thread + while (block = GetNext(c->SendBlocks)) + { + c->CurrentSendQueueSize -= block->Size; + + if (k->SendPacketQueue->num_item >= MAX_STORED_QUEUE_NUM) + { + FreeBlock(block); + } + else + { + num_blocks++; + k->CurrentSendPacketQueueSize += block->Size; + InsertQueue(k->SendPacketQueue, block); + } + } + } + UnlockQueue(k->SendPacketQueue); + + if (num_blocks != 0) + { + // Issue of cancellation + Cancel(k->ClientSession->Cancel1); + } + } + } + else if (c->Protocol == CONNECTION_HUB_BRIDGE) + { + // Local bridge + BRIDGE *b = s->Bridge; + + if (b != NULL) + { + if (b->Active) + { + BLOCK *block; + UINT num_packet = c->SendBlocks->num_item; // Packet count + + if (num_packet != 0) + { + // Packet data array + void **datas = MallocFast(sizeof(void *) * num_packet); + UINT *sizes = MallocFast(sizeof(UINT) * num_packet); + UINT i; + + i = 0; + while (block = GetNext(c->SendBlocks)) + { + if (hub != NULL && hub->Option != NULL && hub->Option->DisableUdpFilterForLocalBridgeNic == false && + b->Eth != NULL && IsDhcpPacketForSpecificMac(block->Buf, block->Size, b->Eth->MacAddress)) + { + // DHCP Packet is filtered + datas[i] = NULL; + sizes[i] = 0; + + Free(block->Buf); + } + else + { + datas[i] = block->Buf; + sizes[i] = block->Size; + + if (block->Size > 1514) + { + NormalizeEthMtu(b, c, block->Size); + } + } + + c->CurrentSendQueueSize -= block->Size; + Free(block); + i++; + } + + // Write the packet + EthPutPackets(b->Eth, num_packet, datas, sizes); + + Free(datas); + Free(sizes); + } + } + } + } +} + +// Reception of the block +void ConnectionReceive(CONNECTION *c, CANCEL *c1, CANCEL *c2) +{ + UINT i, num; + SOCKSET set; + SESSION *s; + TCPSOCK **tcpsocks; + UCHAR *buf; + UINT size; + UINT time; + UINT num_delayed = 0; + bool no_spinlock_for_delay = false; + UINT64 now = Tick64(); + HUB *hub = NULL; + // Validate arguments + if (c == NULL) + { + return; + } + + PROBE_STR("ConnectionReceive"); + + s = c->Session; + + if (s != NULL) + { + hub = s->Hub; + } + + if (hub != NULL) + { + no_spinlock_for_delay = hub->Option->NoSpinLockForPacketDelay; + } + + if (c->RecvBuf == NULL) + { + c->RecvBuf = Malloc(RECV_BUF_SIZE); + } + buf = c->RecvBuf; + + // Protocol + if (c->Protocol == CONNECTION_TCP) + { + // TCP + TCP *tcp = c->Tcp; + UINT next_delay_packet_diff = 0; + UINT current_recv_fifo_size = 0; + int recv_fifo_size_middle_update = 0; + + // Disconnect if disconnection interval is specified + if (s->ServerMode == false) + { + if (s->ClientOption->ConnectionDisconnectSpan != 0) + { + LockList(tcp->TcpSockList); + { + UINT i; + for (i = 0;i < LIST_NUM(tcp->TcpSockList);i++) + { + TCPSOCK *ts = LIST_DATA(tcp->TcpSockList, i); + if (ts->DisconnectTick != 0 && + ts->DisconnectTick <= now) + { + Debug("ts->DisconnectTick <= now\n"); + Disconnect(ts->Sock); + } + } + } + UnlockList(tcp->TcpSockList); + } + } + + if (s->HalfConnection && (s->ServerMode == false)) + { + // Check the direction of the current TCP connections. + // Disconnect one if the number of connections reaches + // the limit and has only one direction + LockList(tcp->TcpSockList); + { + UINT i, num; + UINT c2s, s2c; + c2s = s2c = 0; + num = LIST_NUM(tcp->TcpSockList); + if (num >= s->MaxConnection) + { + TCPSOCK *ts; + for (i = 0;i < num;i++) + { + ts = LIST_DATA(tcp->TcpSockList, i); + if (ts->Direction == TCP_SERVER_TO_CLIENT) + { + s2c++; + } + else + { + c2s++; + } + } + if (s2c == 0 || c2s == 0) + { + // Disconnect the last socket + Disconnect(ts->Sock); + Debug("Disconnect (s2c=%u, c2s=%u)\n", s2c, c2s); + } + } + } + UnlockList(tcp->TcpSockList); + } + + // Initializing the socket set + InitSockSet(&set); + LockList(tcp->TcpSockList); + { + num = LIST_NUM(tcp->TcpSockList); + tcpsocks = ToArrayEx(tcp->TcpSockList, true); + } + UnlockList(tcp->TcpSockList); + + for (i = 0;i < num;i++) + { + AddSockSet(&set, tcpsocks[i]->Sock); + } + + if (s->UseUdpAcceleration && s->UdpAccel != NULL) + { + if (s->UdpAccel->UdpSock != NULL) + { + AddSockSet(&set, s->UdpAccel->UdpSock); + } + } + + // Select + time = SELECT_TIME; + if (s->VirtualHost) + { + time = MIN(time, SELECT_TIME_FOR_NAT); + } + next_delay_packet_diff = GetNextDelayedPacketTickDiff(s); + time = MIN(time, next_delay_packet_diff); + num_delayed = LIST_NUM(s->DelayedPacketList); + + PROBE_STR("ConnectionReceive: Select 0"); + + if (s->Flag1 != set.NumSocket) + { + Select(&set, (num_delayed == 0 ? time : 1), c1, c2); + s->Flag1 = set.NumSocket; + } + else + { + if (no_spinlock_for_delay || time >= 50 || num_delayed == false) + { + Select(&set, (num_delayed == 0 ? time : (time > 100 ? (time - 100) : 1)), c1, c2); + s->Flag1 = set.NumSocket; + } + else + { + YieldCpu(); + } + } + + now = Tick64(); + + PROBE_STR("ConnectionReceive: Select 1"); + + if (s->UseUdpAcceleration && s->UdpAccel != NULL) + { + // Read the data received by the UDP If using the UDP acceleration mode + UdpAccelSetTick(s->UdpAccel, now); + UdpAccelPoll(s->UdpAccel); + + if (s->UdpAccelMss == 0) + { + s->UdpAccelMss = UdpAccelCalcMss(s->UdpAccel); + } + + while (true) + { + UINT current_packet_index = 0; + BLOCK *b = GetNext(s->UdpAccel->RecvBlockQueue); + + if (b == NULL) + { + break; + } + + if (b->Size > MAX_PACKET_SIZE) + { + // Packet size exceeded + FreeBlock(b); + } + else + { + if (CedarGetQueueBudgetBalance(c->Cedar) == 0) + { + FreeBlock(b); + } + else + { + // Add the data block to queue + InsertReceivedBlockToQueue(c, b, true); + + if ((current_packet_index % 32) == 0) + { + UINT current_recv_block_num = c->ReceivedBlocks->num_item; + int diff = (int)current_recv_block_num - (int)c->LastRecvBlocksNum; + + CedarAddQueueBudget(c->Cedar, diff); + + c->LastRecvBlocksNum = current_recv_block_num; + } + + current_packet_index++; + } + } + } + } + + { + bool new_status = UdpAccelIsSendReady(s->UdpAccel, true); + + if (s->IsUsingUdpAcceleration != new_status) + { + Debug("UDP Status Changed: %u\n", new_status); + } + + s->IsUsingUdpAcceleration = new_status; + } + + // Read all the data that has arrived to the TCP socket + for (i = 0;i < num;i++) + { + TCPSOCK *ts = tcpsocks[i]; + SOCK *sock = ts->Sock; + + if (s->IsRUDPSession) + { + TUBE *t = sock->BulkRecvTube; + + if (s->EnableBulkOnRUDP) + { + // R-UDP bulk transfer data reception + if (t != NULL && IsTubeConnected(t)) + { + UINT current_packet_index = 0; + while (true) + { + TUBEDATA *d = TubeRecvAsync(t); + BLOCK *block; + if (d == NULL) + { + // All reception complete + break; + } + + if (d->DataSize > sizeof(UINT64) && READ_UINT64(d->Data) == CONNECTION_BULK_COMPRESS_SIGNATURE) + { + // Compression + block = NewBlock(Clone(((UCHAR *)d->Data) + sizeof(UINT64), + d->DataSize - sizeof(UINT64)), + d->DataSize - sizeof(UINT64), + -1); + } + else + { + // Uncompressed + block = NewBlock(Clone(d->Data, d->DataSize), d->DataSize, 0); + } + + if (block->Size > MAX_PACKET_SIZE) + { + // Packet size exceeded + FreeBlock(block); + } + else + { + if (CedarGetQueueBudgetBalance(c->Cedar) == 0) + { + FreeBlock(block); + } + else + { + // Add the data block to queue + InsertReceivedBlockToQueue(c, block, true); + + if ((current_packet_index % 32) == 0) + { + UINT current_recv_block_num = c->ReceivedBlocks->num_item; + int diff = (int)current_recv_block_num - (int)c->LastRecvBlocksNum; + + CedarAddQueueBudget(c->Cedar, diff); + + c->LastRecvBlocksNum = current_recv_block_num; + } + + current_packet_index++; + } + } + + FreeTubeData(d); + + UPDATE_LAST_COMM_TIME(ts->LastCommTime, now); + UPDATE_LAST_COMM_TIME(ts->LastRecvTime, now); + UPDATE_LAST_COMM_TIME(c->Session->LastCommTime, now); + } + } + } + } + + if (c->IsInProc) + { + TUBEDATA *d; + UINT current_packet_index = 0; + + // Socket for in-process connection + if (IsTubeConnected(sock->RecvTube) == false) + { + // Communication is disconnected + goto DISCONNECT_THIS_TCP; + } + + while (true) + { + BLOCK *block; + // Get the packet data from the tube + d = TubeRecvAsync(sock->RecvTube); + if (d == NULL) + { + // All acquisition completed + break; + } + + block = NewBlock(Clone(d->Data, d->DataSize), d->DataSize, 0); + + if (block->Size > MAX_PACKET_SIZE) + { + // Packet size exceeded + FreeBlock(block); + } + else + { + if (CedarGetQueueBudgetBalance(c->Cedar) == 0) + { + FreeBlock(block); + } + else + { + // Add the data block to queue + InsertReceivedBlockToQueue(c, block, true); + + if ((current_packet_index % 32) == 0) + { + UINT current_recv_block_num = c->ReceivedBlocks->num_item; + int diff = (int)current_recv_block_num - (int)c->LastRecvBlocksNum; + + CedarAddQueueBudget(c->Cedar, diff); + + c->LastRecvBlocksNum = current_recv_block_num; + } + + current_packet_index++; + } + } + + FreeTubeData(d); + } + + UPDATE_LAST_COMM_TIME(c->Session->LastCommTime, now); + } + else + { + UINT current_fifo_budget = 0; + UINT current_packet_index = 0; + // A normal socket (Not in-process) + if (ts->WantSize == 0) + { + // Read for sizeof(UINT) first + ts->WantSize = sizeof(UINT); + } + + now = Tick64(); + +RECV_START: + current_fifo_budget = CedarGetFifoBudgetBalance(c->Cedar); + // Receive + if (ts->RecvFifo->size < current_fifo_budget) + { + UINT recv_buf_size = current_fifo_budget - ts->RecvFifo->size; + + recv_buf_size = MIN(recv_buf_size, RECV_BUF_SIZE); + + size = TcpSockRecv(s, ts, buf, recv_buf_size); + } + else + { + size = SOCK_LATER; + + UPDATE_LAST_COMM_TIME(c->Session->LastCommTime, now); + UPDATE_LAST_COMM_TIME(ts->LastCommTime, now); + } + + /* + // Experiment + if (c->ServerMode) + { + if ((ts->EstablishedTick + (UINT64)3000) <= now) + { + size = 0; + WHERE; + } + }*/ + + if (size == 0) + { +DISCONNECT_THIS_TCP: + s->LastTryAddConnectTime = Tick64(); + s->NumDisconnected++; + // Communication is disconnected + LockList(tcp->TcpSockList); + { + // Remove the socket from socket list + Delete(tcp->TcpSockList, ts); + // Release of TCPSOCK + FreeTcpSock(ts); + // Decrement + Dec(c->CurrentNumConnection); + Debug("--- TCP Connection Decremented: %u (%s Line %u)\n", Count(c->CurrentNumConnection), __FILE__, __LINE__); + Debug("LIST_NUM(tcp->TcpSockList): %u\n", LIST_NUM(tcp->TcpSockList)); + } + UnlockList(tcp->TcpSockList); + + continue; + } + else if (size == SOCK_LATER) + { + // State of waiting reception : don't do anything + if (IS_RECV_TCP_SOCK(ts)) + { + if ((now > ts->LastCommTime) && ((now - ts->LastCommTime) >= ((UINT64)s->Timeout))) + { + // The connection has timed out + Debug("Connection %u Timeouted.\n", i); + goto DISCONNECT_THIS_TCP; + } + } + } + else + { + UINT budget_balance = CedarGetFifoBudgetBalance(c->Cedar); + UINT fifo_size_limit = budget_balance; + + if (fifo_size_limit > MAX_BUFFERING_PACKET_SIZE) + { + fifo_size_limit = MAX_BUFFERING_PACKET_SIZE; + } + + // Update the last communication time + UPDATE_LAST_COMM_TIME(c->Session->LastCommTime, now); + UPDATE_LAST_COMM_TIME(ts->LastRecvTime, now); + + CedarAddFifoBudget(c->Cedar, (int)size); + recv_fifo_size_middle_update += (int)size; + + // Write the received data into the FIFO + PROBE_DATA2("WriteRecvFifo", buf, size); + WriteRecvFifo(s, ts, buf, size); + + // Stop receiving when the receive buffer is full + if (ts->RecvFifo->size < fifo_size_limit) + { + goto RECV_START; + } + } + + current_recv_fifo_size += FifoSize(ts->RecvFifo); + + // process the data written to FIFO + while (ts->RecvFifo->size >= ts->WantSize) + { + UCHAR *buf; + void *data; + BLOCK *block; + UINT sz; + // A sufficient amount of data is already stored + // Get the pointer of the data + buf = (UCHAR *)ts->RecvFifo->p + ts->RecvFifo->pos; + + switch (ts->Mode) + { + case 0: + // The number of Data blocks + ts->WantSize = sizeof(UINT); + Copy(&sz, buf, sizeof(UINT)); + PROBE_DATA2("ReadFifo 0", buf, sizeof(UINT)); + sz = Endian32(sz); + ts->NextBlockNum = sz; + ReadFifo(ts->RecvFifo, NULL, sizeof(UINT)); + + s->TotalRecvSize += sizeof(UINT); + s->TotalRecvSizeReal += sizeof(UINT); + + ts->CurrentPacketNum = 0; + if (ts->NextBlockNum != 0) + { + if (ts->NextBlockNum == KEEP_ALIVE_MAGIC) + { + ts->Mode = 3; + } + else + { + ts->Mode = 1; + } + } + break; + + case 1: + // Data block size + Copy(&sz, buf, sizeof(UINT)); + sz = Endian32(sz); + PROBE_DATA2("ReadFifo 1", buf, sizeof(UINT)); + if (sz > (MAX_PACKET_SIZE * 2)) + { + // received a strange data size + // TCP/IP Error? + Debug("%s %u sz > (MAX_PACKET_SIZE * 2)\n", __FILE__, __LINE__); + Disconnect(ts->Sock); + } + ts->NextBlockSize = MIN(sz, MAX_PACKET_SIZE * 2); + ReadFifo(ts->RecvFifo, NULL, sizeof(UINT)); + + s->TotalRecvSize += sizeof(UINT); + s->TotalRecvSizeReal += sizeof(UINT); + + ts->WantSize = ts->NextBlockSize; + if (ts->WantSize != 0) + { + ts->Mode = 2; + } + else + { + ts->Mode = 1; + ts->WantSize = sizeof(UINT); + ts->CurrentPacketNum++; + if (ts->CurrentPacketNum >= ts->NextBlockNum) + { + ts->Mode = 0; + } + } + break; + + case 2: + // Data block body + ts->WantSize = sizeof(UINT); + ts->CurrentPacketNum++; + data = MallocFast(ts->NextBlockSize); + Copy(data, buf, ts->NextBlockSize); + PROBE_DATA2("ReadFifo 2", buf, ts->NextBlockSize); + ReadFifo(ts->RecvFifo, NULL, ts->NextBlockSize); + block = NewBlock(data, ts->NextBlockSize, s->UseCompress ? -1 : 0); + + UPDATE_LAST_COMM_TIME(c->Session->LastCommTime, now); + UPDATE_LAST_COMM_TIME(ts->LastCommTime, now); + + if (block->Size > MAX_PACKET_SIZE) + { + // Packet size exceeded + FreeBlock(block); + } + else + { + if (CedarGetQueueBudgetBalance(c->Cedar) == 0) + { + FreeBlock(block); + } + else + { + // Add the data block to queue + InsertReceivedBlockToQueue(c, block, true); + + if ((current_packet_index % 32) == 0) + { + UINT current_recv_block_num = c->ReceivedBlocks->num_item; + int diff = (int)current_recv_block_num - (int)c->LastRecvBlocksNum; + + CedarAddQueueBudget(c->Cedar, diff); + + c->LastRecvBlocksNum = current_recv_block_num; + } + + current_packet_index++; + } + } + + if (ts->CurrentPacketNum >= ts->NextBlockNum) + { + // Reception of all the data blocks completed + ts->Mode = 0; + } + else + { + // Receive next data block size + ts->Mode = 1; + } + break; + + case 3: + // Keep-Alive packet size + ts->Mode = 4; + Copy(&sz, buf, sizeof(UINT)); + PROBE_DATA2("ReadFifo 3", buf, sizeof(UINT)); + sz = Endian32(sz); + if (sz > MAX_KEEPALIVE_SIZE) + { + // received a strange data size + // TCP/IP Error? + Debug("%s %u sz > MAX_KEEPALIVE_SIZE\n", __FILE__, __LINE__); + Disconnect(ts->Sock); + } + ts->NextBlockSize = MIN(sz, MAX_KEEPALIVE_SIZE); + ReadFifo(ts->RecvFifo, NULL, sizeof(UINT)); + + UPDATE_LAST_COMM_TIME(c->Session->LastCommTime, now); + UPDATE_LAST_COMM_TIME(ts->LastCommTime, now); + + s->TotalRecvSize += sizeof(UINT); + s->TotalRecvSizeReal += sizeof(UINT); + + ts->WantSize = sz; + break; + + case 4: + // Keep-Alive packet body + //Debug("KeepAlive Recved.\n"); + ts->Mode = 0; + sz = ts->NextBlockSize; + + if (sz >= (StrLen(UDP_NAT_T_PORT_SIGNATURE_IN_KEEP_ALIVE) + sizeof(USHORT))) + { + UCHAR *keep_alive_buffer = FifoPtr(ts->RecvFifo); + + if (Cmp(keep_alive_buffer, UDP_NAT_T_PORT_SIGNATURE_IN_KEEP_ALIVE, StrLen(UDP_NAT_T_PORT_SIGNATURE_IN_KEEP_ALIVE)) == 0) + { + USHORT us = READ_USHORT(keep_alive_buffer + StrLen(UDP_NAT_T_PORT_SIGNATURE_IN_KEEP_ALIVE)); + + if (us != 0) + { + if (s->UseUdpAcceleration && s->UdpAccel != NULL) + { + UINT port = (UINT)us; + + if (s->UdpAccel->YourPortByNatTServer != port) + { + s->UdpAccel->YourPortByNatTServer = port; + s->UdpAccel->YourPortByNatTServerChanged = true; + + Debug("s->UdpAccel->YourPortByNatTServer: %u\n", + s->UdpAccel->YourPortByNatTServer); + } + } + } + } + } + + PROBE_DATA2("ReadFifo 4", NULL, 0); + ReadFifo(ts->RecvFifo, NULL, sz); + + UPDATE_LAST_COMM_TIME(c->Session->LastCommTime, now); + UPDATE_LAST_COMM_TIME(ts->LastCommTime, now); + + s->TotalRecvSize += sz; + s->TotalRecvSizeReal += sz; + + ts->WantSize = sizeof(UINT); + break; + } + } + + ShrinkFifoMemory(ts->RecvFifo); + //printf("Fifo: %u\n", ts->RecvFifo->memsize); + } + } + + if (true) + { + int diff; + + diff = (int)current_recv_fifo_size - (int)c->LastRecvFifoTotalSize; + + CedarAddFifoBudget(c->Cedar, (diff - recv_fifo_size_middle_update)); + + c->LastRecvFifoTotalSize = current_recv_fifo_size; + } + + if (true) + { + UINT current_recv_block_num = c->ReceivedBlocks->num_item; + int diff = (int)current_recv_block_num - (int)c->LastRecvBlocksNum; + + CedarAddQueueBudget(c->Cedar, diff); + + c->LastRecvBlocksNum = current_recv_block_num; + } + + Free(tcpsocks); + } + else if (c->Protocol == CONNECTION_UDP) + { + // UDP + UDP *udp = c->Udp; + SOCK *sock = NULL; + + if (s->ServerMode == false) + { + Lock(c->lock); + { + if (c->Udp->s != NULL) + { + sock = c->Udp->s; + if (sock != NULL) + { + AddRef(sock->ref); + } + } + } + Unlock(c->lock); + + InitSockSet(&set); + + if (sock != NULL) + { + AddSockSet(&set, sock); + } + + Select(&set, SELECT_TIME, c1, c2); + + if (sock != NULL) + { + IP ip; + UINT port; + UCHAR *buf; + UINT size; + + while (true) + { + buf = c->RecvBuf; + size = RecvFrom(sock, &ip, &port, buf, RECV_BUF_SIZE); + if (size == 0 && sock->IgnoreRecvErr == false) + { + Debug("UDP Socket Disconnected.\n"); + Lock(c->lock); + { + ReleaseSock(udp->s); + udp->s = NULL; + } + Unlock(c->lock); + break; + } + else if (size == SOCK_LATER) + { + break; + } + else + { + if (size) + { + PutUDPPacketData(c, buf, size); + } + } + } + } + + if (sock != NULL) + { + Release(sock->ref); + } + } + else + { + Select(NULL, SELECT_TIME, c1, c2); + } + } + else if (c->Protocol == CONNECTION_HUB_SECURE_NAT) + { + SNAT *snat = c->Session->SecureNAT; + VH *v = snat->Nat->Virtual; + UINT size; + void *data; + UINT num; + UINT select_wait_time = SELECT_TIME_FOR_NAT; + UINT next_delay_packet_diff = 0; + + if (snat->Nat != NULL && snat->Nat->Option.UseNat == false) + { + select_wait_time = SELECT_TIME; + } + else + { + if (snat->Nat != NULL) + { + LockList(v->NatTable); + { + if (LIST_NUM(v->NatTable) == 0 && LIST_NUM(v->ArpWaitTable) == 0) + { + select_wait_time = SELECT_TIME; + } + } + UnlockList(v->NatTable); + } + } + + next_delay_packet_diff = GetNextDelayedPacketTickDiff(s); + select_wait_time = MIN(select_wait_time, next_delay_packet_diff); + num_delayed = LIST_NUM(s->DelayedPacketList); + + if (no_spinlock_for_delay || select_wait_time >= 50 || num_delayed == false) + { + Select(NULL, (num_delayed == 0 ? select_wait_time : + (select_wait_time > 100 ? (select_wait_time - 100) : 1)), c1, c2); + } + else + { + YieldCpu(); + } + + num = 0; + + if (hub != NULL) + { + NatSetHubOption(v, hub->Option); + } + + // Receive a packet from the virtual machine + while (size = VirtualGetNextPacket(v, &data)) + { + BLOCK *block; + + // Generate packet block + block = NewBlock(data, size, 0); + if (block->Size > MAX_PACKET_SIZE) + { + // Packet size exceeded + FreeBlock(block); + } + else + { + // Add the data block to queue + InsertReceivedBlockToQueue(c, block, true); + } + num++; + if (num >= MAX_SEND_SOCKET_QUEUE_NUM) + { +// WHERE; + break; + } + } + } + else if (c->Protocol == CONNECTION_HUB_LINK_SERVER) + { + // HUB Link + // Waiting Cancel simply + if (c->SendBlocks->num_item == 0) + { + UINT time = SELECT_TIME; + UINT next_delay_packet_diff = 0; + + next_delay_packet_diff = GetNextDelayedPacketTickDiff(s); + time = MIN(time, next_delay_packet_diff); + num_delayed = LIST_NUM(s->DelayedPacketList); + + if (no_spinlock_for_delay || time >= 50 || num_delayed == false) + { + Select(NULL, (num_delayed == 0 ? time : (time > 100 ? (time - 100) : 1)), c1, c2); + } + else + { + YieldCpu(); + } + } + } + else if (c->Protocol == CONNECTION_HUB_LAYER3) + { + // Layer-3 switch session + L3IF *f = s->L3If; + UINT size, num = 0; + void *data; + + if (f->SendQueue->num_item == 0) + { + UINT time = SELECT_TIME_FOR_NAT; + UINT next_delay_packet_diff = 0; + + if (f->ArpWaitTable != NULL) + { + LockList(f->ArpWaitTable); + { + if (LIST_NUM(f->ArpWaitTable) == 0) + { + time = SELECT_TIME; + } + } + UnlockList(f->ArpWaitTable); + } + + next_delay_packet_diff = GetNextDelayedPacketTickDiff(s); + time = MIN(time, next_delay_packet_diff); + num_delayed = LIST_NUM(s->DelayedPacketList); + + if (no_spinlock_for_delay || time >= 50 || num_delayed == false) + { + Select(NULL, (num_delayed == 0 ? time : (time > 100 ? (time - 100) : 1)), c1, c2); + } + else + { + YieldCpu(); + } + } + + // Get the next packet + while (size = L3GetNextPacket(f, &data)) + { + BLOCK *block = NewBlock(data, size, 0); + if (block->Size > MAX_PACKET_SIZE) + { + FreeBlock(block); + } + else + { + InsertReceivedBlockToQueue(c, block, true); + } + + num++; + if (num >= MAX_SEND_SOCKET_QUEUE_NUM) + { + break; + } + } + } + else if (c->Protocol == CONNECTION_HUB_BRIDGE) + { + BRIDGE *b = c->Session->Bridge; + + // Bridge session + if (b->Active) + { + void *data; + UINT ret; + UINT num = 0; + bool check_device_num = false; + UINT time = SELECT_TIME; + UINT next_delay_packet_diff = 0; + + next_delay_packet_diff = GetNextDelayedPacketTickDiff(s); + time = MIN(time, next_delay_packet_diff); + num_delayed = LIST_NUM(s->DelayedPacketList); + + // Bridge is operating + if (no_spinlock_for_delay || time >= 50 || num_delayed == false) + { + Select(NULL, (num_delayed == 0 ? time : (time > 100 ? (time - 100) : 1)), c1, c2); + } + else + { + YieldCpu(); + } + + if ((b->LastNumDeviceCheck + BRIDGE_NUM_DEVICE_CHECK_SPAN) <= Tick64()) + { +#ifdef OS_WIN32 + check_device_num = true; +#endif // OS_WIN32 + b->LastNumDeviceCheck = Tick64(); + } + + // Get the next packet from the bridge + while (true) + { + if (check_device_num && b->LastNumDevice != GetEthDeviceHash()) + { + ret = INFINITE; + } + else + { + ret = EthGetPacket(b->Eth, &data); + } + +#ifdef OS_WIN32 + if (c->Session != NULL) + { + c->Session->BridgeIsEthLoopbackBlock = false; + if (b->Eth != NULL && b->Eth->LoopbackBlock) + { + // Check whether The Ethernet device in the bridge + // has the ability to block the loopback packet + c->Session->BridgeIsEthLoopbackBlock = true; + } + } +#endif // OS_WIN32 + + if (ret == INFINITE) + { + // Error occured: stop the bridge + CloseEth(b->Eth); + b->Eth = NULL; + b->Active = false; + ReleaseCancel(s->Cancel2); + s->Cancel2 = NULL; + + HLog(s->Hub, "LH_BRIDGE_2", s->Name, b->Name); + Debug("Bridge Device Error.\n"); + + break; + } + else if (ret == 0) + { + // There is no more packet to receive + break; + } + else + { + if (hub != NULL && hub->Option != NULL && hub->Option->DisableUdpFilterForLocalBridgeNic == false && + b->Eth != NULL && IsDhcpPacketForSpecificMac(data, ret, b->Eth->MacAddress)) + { + // DHCP Packet is filtered. + Free(data); + } + else + { + // Add the packet to queue + BLOCK *block = NewBlock(data, ret, 0); + + PROBE_DATA2("ConnectionReceive: NewBlock", data, ret); + + if (ret > 1514) + { + NormalizeEthMtu(b, c, ret); + } + + if (block->Size > MAX_PACKET_SIZE) + { + // Packet size exceeded + FreeBlock(block); + } + else + { + InsertReceivedBlockToQueue(c, block, true); + } + num++; + if (num >= MAX_SEND_SOCKET_QUEUE_NUM) + { + // WHERE; + break; + } + } + } + } + } + else + { + ETH *e; + // Bridge is stopped currently + Select(NULL, SELECT_TIME, c1, NULL); + + if (b->LastBridgeTry == 0 || (b->LastBridgeTry + BRIDGE_TRY_SPAN) <= Tick64()) + { + b->LastBridgeTry = Tick64(); + + // Try to open an Ethernet device + e = OpenEth(b->Name, b->Local, b->TapMode, b->TapMacAddress); + if (e != NULL) + { + // Success + b->Eth = e; + b->Active = true; + b->LastNumDeviceCheck = Tick64(); + b->LastNumDevice = GetEthDeviceHash(); + + // Update the NIC name of the bridge +#ifdef OS_WIN32 + if (IsEmptyStr(e->Title) == false) + { + StrCpy(b->Name, sizeof(b->Name), e->Title); + + if (b->ParentLocalBridge != NULL) + { + StrCpy(b->ParentLocalBridge->DeviceName, sizeof(b->ParentLocalBridge->DeviceName), e->Title); + } + } +#endif // OS_WIN32 + + Debug("Bridge Open Succeed.\n"); + + HLog(c->Session->Hub, "LH_BRIDGE_1", c->Session->Name, b->Name); + + s->Cancel2 = EthGetCancel(b->Eth); + } + } + } + } +} + +// Normalize the MTU of the Ethernet device +void NormalizeEthMtu(BRIDGE *b, CONNECTION *c, UINT packet_size) +{ + // Validate arguments + if (packet_size == 0 || b == NULL || c == NULL) + { + return; + } + + // Raise the MTU when the packet exceeds the current MTU + if (EthIsChangeMtuSupported(b->Eth)) + { + UINT currentMtu = EthGetMtu(b->Eth); + if (currentMtu != 0) + { + if (packet_size > currentMtu) + { + bool ok = EthSetMtu(b->Eth, packet_size); + + if (ok) + { + HLog(c->Session->Hub, "LH_SET_MTU", c->Session->Name, + b->Name, currentMtu, packet_size, packet_size); + } + else + { + UINT64 now = Tick64(); + + if (b->LastChangeMtuError == 0 || + now >= (b->LastChangeMtuError + 60000ULL)) + { + HLog(c->Session->Hub, "LH_SET_MTU_ERROR", c->Session->Name, + b->Name, currentMtu, packet_size, packet_size); + + b->LastChangeMtuError = now; + } + } + } + } + } +} + +// Release of the block +void FreeBlock(BLOCK *b) +{ + // Validate arguments + if (b == NULL) + { + return; + } + + Free(b->Buf); + Free(b); +} + +// Create a new block +BLOCK *NewBlock(void *data, UINT size, int compress) +{ + BLOCK *b; + // Validate arguments + if (data == NULL) + { + return NULL; + } + + b = MallocFast(sizeof(BLOCK)); + + b->RawFlagRetUdpAccel = 0; + + b->IsFlooding = false; + + b->PriorityQoS = b->Ttl = b->Param1 = 0; + + if (compress == 0) + { + // Uncompressed + b->Compressed = false; + b->Buf = data; + b->Size = size; + b->SizeofData = size; + } + else if (compress == 1) + { + UINT max_size; + + // Compressed + b->Compressed = true; + max_size = CalcCompress(size); + b->Buf = MallocFast(max_size); + b->Size = Compress(b->Buf, max_size, data, size); + b->SizeofData = size; + + // Discard old data block + Free(data); + } + else + { + // Expand + UINT max_size; + + b->Compressed = false; + max_size = MAX_PACKET_SIZE; + b->Buf = MallocFast(max_size); + b->Size = Uncompress(b->Buf, max_size, data, size); + b->SizeofData = size; + + // Discard old data + Free(data); + } + + return b; +} + +// Create a TCP socket +TCPSOCK *NewTcpSock(SOCK *s) +{ + TCPSOCK *ts; + // Validate arguments + if (s == NULL) + { + return NULL; + } + + ts = ZeroMalloc(sizeof(TCPSOCK)); + + ts->Sock = s; + AddRef(s->ref); + + ts->RecvFifo = NewFifo(); + ts->SendFifo = NewFifo(); + ts->EstablishedTick = ts->LastRecvTime = ts->LastCommTime = Tick64(); + + // Unset the time-out value + SetTimeout(s, TIMEOUT_INFINITE); + + return ts; +} + +// Release of TCP socket +void FreeTcpSock(TCPSOCK *ts) +{ + // Validate arguments + if (ts == NULL) + { + return; + } + + Disconnect(ts->Sock); + ReleaseSock(ts->Sock); + ReleaseFifo(ts->RecvFifo); + ReleaseFifo(ts->SendFifo); + + if (ts->SendKey) + { + FreeCrypt(ts->SendKey); + } + if (ts->RecvKey) + { + FreeCrypt(ts->RecvKey); + } + + Free(ts); +} + +// Exit the tunneling mode of connection +void EndTunnelingMode(CONNECTION *c) +{ + // Validate arguments + if (c == NULL) + { + return; + } + + // Protocol + if (c->Protocol == CONNECTION_TCP) + { + // TCP + DisconnectTcpSockets(c); + } + else + { + // UDP + DisconnectUDPSockets(c); + } +} + +// Shift the connection to tunneling mode +void StartTunnelingMode(CONNECTION *c) +{ + SOCK *s; + TCP *tcp; + TCPSOCK *ts; + IP ip; + UINT port; + // Validate arguments + if (c == NULL) + { + return; + } + + tcp = c->Tcp; + + // Protocol + if (c->Protocol == CONNECTION_TCP) + { + // TCP + s = c->FirstSock; + + if (c->IsInProc) + { + AddRef(s->ref); + c->TubeSock = s; + } + + ts = NewTcpSock(s); + + if (c->ServerMode == false) + { + if (c->Session->ClientOption->ConnectionDisconnectSpan != 0) + { + ts->DisconnectTick = Tick64() + c->Session->ClientOption->ConnectionDisconnectSpan * (UINT64)1000; + } + } + + LockList(tcp->TcpSockList); + { + Add(tcp->TcpSockList, ts); + } + UnlockList(tcp->TcpSockList); + ReleaseSock(s); + c->FirstSock = NULL; + } + else + { + // UDP + s = c->FirstSock; + Copy(&ip, &s->RemoteIP, sizeof(IP)); + // May disconnect TCP connection at this point + c->FirstSock = NULL; + Disconnect(s); + ReleaseSock(s); + + // Initialization of UDP structure + c->Udp = ZeroMalloc(sizeof(UDP)); + + if (c->ServerMode) + { + // Server mode + // Add an UDP Entry + AddUDPEntry(c->Cedar, c->Session); + c->Udp->s = NULL; + } + else + { + port = c->Session->ClientOption->PortUDP; + // Client mode + c->Udp->s = NewUDP(0); + // Write the IP address and port number + Copy(&c->Udp->ip, &ip, sizeof(IP)); + c->Udp->port = port; + } + + // Queue + c->Udp->BufferQueue = NewQueue(); + } +} + +// Generate a random value that depends on each machine +UINT GetMachineRand() +{ + char pcname[MAX_SIZE]; + UCHAR hash[SHA1_SIZE]; + + Zero(pcname, sizeof(pcname)); + GetMachineName(pcname, sizeof(pcname)); + + Sha1(hash, pcname, StrLen(pcname)); + + return READ_UINT(hash); +} + +// Function that accepts a new connection +void ConnectionAccept(CONNECTION *c) +{ + SOCK *s; + X *x; + K *k; + char tmp[128]; + UINT initial_timeout = CONNECTING_TIMEOUT; + UCHAR ctoken_hash[SHA1_SIZE]; + + // Validate arguments + if (c == NULL) + { + return; + } + + Zero(ctoken_hash, sizeof(ctoken_hash)); + + // Get a socket + s = c->FirstSock; + AddRef(s->ref); + + Dec(c->Cedar->AcceptingSockets); + + IPToStr(tmp, sizeof(tmp), &s->RemoteIP); + + SLog(c->Cedar, "LS_CONNECTION_START_1", tmp, s->RemoteHostname, (IS_SPECIAL_PORT(s->RemotePort) ? 0 : s->RemotePort), c->Name); + + // Timeout setting + initial_timeout += GetMachineRand() % (CONNECTING_TIMEOUT / 2); + SetTimeout(s, initial_timeout); + + // Handle third-party protocols + if (s->IsReverseAcceptedSocket == false && s->Type == SOCK_TCP) + { + if (c->Cedar != NULL && c->Cedar->Server != NULL) + { + PROTO *proto = c->Cedar->Server->Proto; + if (proto && ProtoHandleConnection(proto, s, NULL) == true) + { + c->Type = CONNECTION_TYPE_OTHER; + goto FINAL; + } + } + } + + // Specify the encryption algorithm + Lock(c->Cedar->lock); + { + if (c->Cedar->CipherList != NULL) + { + SetWantToUseCipher(s, c->Cedar->CipherList); + } + + x = CloneX(c->Cedar->ServerX); + k = CloneK(c->Cedar->ServerK); + } + Unlock(c->Cedar->lock); + + // Start the SSL communication + Copy(&s->SslAcceptSettings, &c->Cedar->SslAcceptSettings, sizeof(SSL_ACCEPT_SETTINGS)); + if (StartSSL(s, x, k) == false) + { + // Failed + AddNoSsl(c->Cedar, &s->RemoteIP); + Debug("ConnectionAccept(): StartSSL() failed\n"); + FreeX(x); + FreeK(k); + + goto FINAL; + } + + FreeX(x); + FreeK(k); + + SLog(c->Cedar, "LS_SSL_START", c->Name, s->CipherName); + + Copy(c->CToken_Hash, ctoken_hash, SHA1_SIZE); + + // Accept the connection + if (ServerAccept(c) == false) + { + // Failed + Debug("ConnectionAccept(): ServerAccept() failed with error %u\n", c->Err); + } + +FINAL: + if (c->flag1 == false) + { + Debug("%s %u c->flag1 == false\n", __FILE__, __LINE__); + Disconnect(s); + } + + DelConnection(c->Cedar, c); + ReleaseSock(s); +} + +// Stop the threads putting additional connection of all that are currently running +void StopAllAdditionalConnectThread(CONNECTION *c) +{ + UINT i, num; + SOCK **socks; + THREAD **threads; + // Validate arguments + if (c == NULL || c->ServerMode != false) + { + return; + } + + // Disconnect the socket first + LockList(c->ConnectingSocks); + { + num = LIST_NUM(c->ConnectingSocks); + socks = ToArray(c->ConnectingSocks); + DeleteAll(c->ConnectingSocks); + } + UnlockList(c->ConnectingSocks); + for (i = 0;i < num;i++) + { + Disconnect(socks[i]); + ReleaseSock(socks[i]); + } + Free(socks); + + // Then, wait for the suspension of the thread + LockList(c->ConnectingThreads); + { + num = LIST_NUM(c->ConnectingThreads); + Debug("c->ConnectingThreads: %u\n", num); + threads = ToArray(c->ConnectingThreads); + DeleteAll(c->ConnectingThreads); + } + UnlockList(c->ConnectingThreads); + for (i = 0;i < num;i++) + { + WaitThread(threads[i], INFINITE); + ReleaseThread(threads[i]); + } + Free(threads); +} + +// Stop the connection +void StopConnection(CONNECTION *c, bool no_wait) +{ + // Validate arguments + if (c == NULL) + { + return; + } + + Debug("Stop Connection: %s\n", c->Name); + + // Stop flag + c->Halt = true; + Disconnect(c->FirstSock); + + if (no_wait == false) + { + // Wait until the thread terminates + WaitThread(c->Thread, INFINITE); + } +} + +// Close all the UDP socket +void DisconnectUDPSockets(CONNECTION *c) +{ + // Validate arguments + if (c == NULL) + { + return; + } + if (c->Protocol != CONNECTION_UDP) + { + return; + } + + // Delete entry + if (c->ServerMode) + { + DelUDPEntry(c->Cedar, c->Session); + } + + // Delete the UDP structure + if (c->Udp != NULL) + { + if (c->Udp->s != NULL) + { + ReleaseSock(c->Udp->s); + } + if (c->Udp->BufferQueue != NULL) + { + // Release of the queue + BUF *b; + while (b = GetNext(c->Udp->BufferQueue)) + { + FreeBuf(b); + } + ReleaseQueue(c->Udp->BufferQueue); + } + Free(c->Udp); + c->Udp = NULL; + } + + if (c->FirstSock != NULL) + { + Disconnect(c->FirstSock); + ReleaseSock(c->FirstSock); + c->FirstSock = NULL; + } +} + +// Close all TCP connections +void DisconnectTcpSockets(CONNECTION *c) +{ + UINT i, num; + TCP *tcp; + TCPSOCK **tcpsocks; + // Validate arguments + if (c == NULL) + { + return; + } + if (c->Protocol != CONNECTION_TCP) + { + return; + } + + tcp = c->Tcp; + LockList(tcp->TcpSockList); + { + tcpsocks = ToArray(tcp->TcpSockList); + num = LIST_NUM(tcp->TcpSockList); + DeleteAll(tcp->TcpSockList); + } + UnlockList(tcp->TcpSockList); + + if (num != 0) + { + Debug("--- SOCKET STATUS ---\n"); + for (i = 0;i < num;i++) + { + TCPSOCK *ts = tcpsocks[i]; + Debug(" SOCK %2u: %u\n", i, ts->Sock->SendSize); + FreeTcpSock(ts); + } + } + + Free(tcpsocks); +} + +// Clean up of the connection +void CleanupConnection(CONNECTION *c) +{ + UINT i, num; + // Validate arguments + if (c == NULL) + { + return; + } + + if (c->LastRecvFifoTotalSize != 0) + { + CedarAddFifoBudget(c->Cedar, -((int)c->LastRecvFifoTotalSize)); + c->LastRecvFifoTotalSize = 0; + } + + if (c->LastRecvBlocksNum != 0) + { + CedarAddQueueBudget(c->Cedar, -((int)c->LastRecvBlocksNum)); + c->LastRecvBlocksNum = 0; + } + + if (c->LastTcpQueueSize != 0) + { + int diff = -((int)c->LastTcpQueueSize); + CedarAddCurrentTcpQueueSize(c->Cedar, diff); + c->LastTcpQueueSize = 0; + } + + if (c->LastPacketQueueSize != 0) + { + int diff = -((int)c->LastPacketQueueSize); + CedarAddCurrentTcpQueueSize(c->Cedar, diff); + c->LastPacketQueueSize = 0; + } + + DeleteLock(c->lock); + ReleaseCedar(c->Cedar); + + switch (c->Protocol) + { + case CONNECTION_TCP: + // Release of TCP connection list + DisconnectTcpSockets(c); + break; + + case CONNECTION_UDP: + break; + } + + ReleaseList(c->Tcp->TcpSockList); + Free(c->Tcp); + + ReleaseSock(c->FirstSock); + c->FirstSock = NULL; + + ReleaseSock(c->TubeSock); + c->TubeSock = NULL; + + ReleaseThread(c->Thread); + Free(c->Name); + + // Release all the receive block and send block + if (c->SendBlocks) + { + LockQueue(c->SendBlocks); + { + BLOCK *b; + while (b = GetNext(c->SendBlocks)) + { + FreeBlock(b); + } + } + UnlockQueue(c->SendBlocks); + } + if (c->SendBlocks2) + { + LockQueue(c->SendBlocks2); + { + BLOCK *b; + while (b = GetNext(c->SendBlocks2)) + { + FreeBlock(b); + } + } + UnlockQueue(c->SendBlocks2); + } + if (c->ReceivedBlocks) + { + LockQueue(c->ReceivedBlocks); + { + BLOCK *b; + while (b = GetNext(c->ReceivedBlocks)) + { + FreeBlock(b); + } + } + UnlockQueue(c->ReceivedBlocks); + } + + if (c->ConnectingThreads) + { + THREAD **threads; + LockList(c->ConnectingThreads); + { + num = LIST_NUM(c->ConnectingThreads); + threads = ToArray(c->ConnectingThreads); + for (i = 0;i < num;i++) + { + ReleaseThread(threads[i]); + } + Free(threads); + } + UnlockList(c->ConnectingThreads); + ReleaseList(c->ConnectingThreads); + } + + if (c->ConnectingSocks) + { + SOCK **socks; + LockList(c->ConnectingSocks); + { + num = LIST_NUM(c->ConnectingSocks); + socks = ToArray(c->ConnectingSocks); + for (i = 0;i < num;i++) + { + Disconnect(socks[i]); + ReleaseSock(socks[i]); + } + Free(socks); + } + UnlockList(c->ConnectingSocks); + ReleaseList(c->ConnectingSocks); + } + + if (c->RecvBuf) + { + Free(c->RecvBuf); + } + + if (c->ServerX != NULL) + { + FreeX(c->ServerX); + } + + if (c->ClientX != NULL) + { + FreeX(c->ClientX); + } + + ReleaseQueue(c->ReceivedBlocks); + ReleaseQueue(c->SendBlocks); + ReleaseQueue(c->SendBlocks2); + + DeleteCounter(c->CurrentNumConnection); + + if (c->CipherName != NULL) + { + Free(c->CipherName); + } + + Free(c); +} + +// Release of the connection +void ReleaseConnection(CONNECTION *c) +{ + // Validate arguments + if (c == NULL) + { + return; + } + + if (Release(c->ref) == 0) + { + CleanupConnection(c); + } +} + +// Comparison of connection +int CompareConnection(void *p1, void *p2) +{ + CONNECTION *c1, *c2; + if (p1 == NULL || p2 == NULL) + { + return 0; + } + c1 = *(CONNECTION **)p1; + c2 = *(CONNECTION **)p2; + if (c1 == NULL || c2 == NULL) + { + return 0; + } + + return StrCmpi(c1->Name, c2->Name); +} + +// Creating a server connection +CONNECTION *NewServerConnection(CEDAR *cedar, SOCK *s, THREAD *t) +{ + CONNECTION *c; + // Validate arguments + if (cedar == NULL) + { + return NULL; + } + + c = ZeroMalloc(sizeof(CONNECTION)); + c->ConnectedTick = Tick64(); + c->lock = NewLock(); + c->ref = NewRef(); + c->Cedar = cedar; + AddRef(c->Cedar->ref); + c->Protocol = CONNECTION_TCP; + c->Type = CONNECTION_TYPE_INIT; + c->FirstSock = s; + if (s != NULL) + { + AddRef(c->FirstSock->ref); + Copy(&c->ClientIp, &s->RemoteIP, sizeof(IP)); + StrCpy(c->ClientHostname, sizeof(c->ClientHostname), s->RemoteHostname); + } + c->Tcp = ZeroMalloc(sizeof(TCP)); + c->Tcp->TcpSockList = NewList(NULL); + c->ServerMode = true; + c->Status = CONNECTION_STATUS_ACCEPTED; + c->Name = CopyStr("INITING"); + c->Thread = t; + AddRef(t->ref); + c->CurrentNumConnection = NewCounter(); + Inc(c->CurrentNumConnection); + + c->ServerVer = cedar->Version; + c->ServerBuild = cedar->Build; + StrCpy(c->ServerStr, sizeof(c->ServerStr), cedar->ServerStr); + GetServerProductName(cedar->Server, c->ServerStr, sizeof(c->ServerStr)); + + if (s != NULL && s->RemoteX != NULL) + { + c->ServerX = CloneX(s->RemoteX); + } + + if (s != NULL && s->Type == SOCK_INPROC) + { + // In-process socket + c->IsInProc = true; + } + + // Creating a Queue + c->ReceivedBlocks = NewQueue(); + c->SendBlocks = NewQueue(); + c->SendBlocks2 = NewQueue(); + + return c; +} + +// Creating a Client Connection +CONNECTION *NewClientConnection(SESSION *s) +{ + return NewClientConnectionEx(s, NULL, 0, 0); +} +CONNECTION *NewClientConnectionEx(SESSION *s, char *client_str, UINT client_ver, UINT client_build) +{ + CONNECTION *c; + + // Initialization of CONNECTION object + c = ZeroMalloc(sizeof(CONNECTION)); + c->ConnectedTick = Tick64(); + c->lock = NewLock(); + c->ref = NewRef(); + c->Cedar = s->Cedar; + AddRef(c->Cedar->ref); + c->Protocol = CONNECTION_TCP; + c->Tcp = ZeroMalloc(sizeof(TCP)); + c->Tcp->TcpSockList = NewList(NULL); + c->ServerMode = false; + c->Status = CONNECTION_STATUS_CONNECTING; + c->Name = CopyStr("CLIENT_CONNECTION"); + c->Session = s; + c->CurrentNumConnection = NewCounter(); + c->LastCounterResetTick = Tick64(); + Inc(c->CurrentNumConnection); + + c->ConnectingThreads = NewList(NULL); + c->ConnectingSocks = NewList(NULL); + + if (client_str == NULL) + { + c->ClientVer = s->Cedar->Version; + c->ClientBuild = s->Cedar->Build; + + if (c->Session->VirtualHost == false) + { + if (c->Session->LinkModeClient == false) + { + StrCpy(c->ClientStr, sizeof(c->ClientStr), CEDAR_CLIENT_STR); + } + else + { + StrCpy(c->ClientStr, sizeof(c->ClientStr), CEDAR_SERVER_LINK_STR); + } + } + else + { + StrCpy(c->ClientStr, sizeof(c->ClientStr), CEDAR_ROUTER_STR); + } + } + else + { + c->ClientVer = client_ver; + c->ClientBuild = client_build; + StrCpy(c->ClientStr, sizeof(c->ClientStr), client_str); + } + + // Server name and port number + StrCpy(c->ServerName, sizeof(c->ServerName), s->ClientOption->Hostname); + c->ServerPort = s->ClientOption->Port; + + // Create queues + c->ReceivedBlocks = NewQueue(); + c->SendBlocks = NewQueue(); + c->SendBlocks2 = NewQueue(); + + return c; +} diff --git a/src/Cedar/Connection.h b/src/Cedar/Connection.h index c846ddeb..8f9066f9 100644 --- a/src/Cedar/Connection.h +++ b/src/Cedar/Connection.h @@ -1,273 +1,273 @@ -// SoftEther VPN Source Code - Developer Edition Master Branch -// Cedar Communication Module -// © 2020 Nokia - -// Connection.h -// Header of Connection.c - -#ifndef CONNECTION_H -#define CONNECTION_H - -// Magic number indicating that the packet is compressed -#define CONNECTION_BULK_COMPRESS_SIGNATURE 0xDEADBEEFCAFEFACEULL - -#define KEEP_ALIVE_STRING "Internet Connection Keep Alive Packet" - -#define UPDATE_LAST_COMM_TIME(v, n) {if ((v) <= (n)) { v = (n); } } - -// KEEP CONNECT structure -struct KEEP -{ - LOCK *lock; // Lock - bool Server; // Server mode - volatile bool Halt; // Stop flag - bool Enable; // Enable flag - char ServerName[MAX_HOST_NAME_LEN + 1]; // Server name - UINT ServerPort; // Server port number - bool UdpMode; // UDP mode - UINT Interval; // Packet transmission interval - THREAD *Thread; // Connection thread - EVENT *HaltEvent; // Stop event - CANCEL *Cancel; // Cancel -}; - -// SECURE_SIGN Structure -struct SECURE_SIGN -{ - char SecurePublicCertName[MAX_SECURE_DEVICE_FILE_LEN + 1]; // Secure device certificate name - char SecurePrivateKeyName[MAX_SECURE_DEVICE_FILE_LEN + 1]; // Secure device secret key name - X *ClientCert; // Client certificate - UCHAR Random[SHA1_SIZE]; // Random value for signature - UCHAR Signature[4096 / 8]; // Signed data - UINT UseSecureDeviceId; - UINT BitmapId; // Bitmap ID -}; - -// Function type declaration -typedef bool (CHECK_CERT_PROC)(SESSION *s, CONNECTION *c, X *server_x, bool *expired); -typedef bool (SECURE_SIGN_PROC)(SESSION *s, CONNECTION *c, SECURE_SIGN *sign); - -// RC4 key pair -struct RC4_KEY_PAIR -{ - UCHAR ServerToClientKey[16]; - UCHAR ClientToServerKey[16]; -}; - -// Client Options -struct CLIENT_OPTION -{ - wchar_t AccountName[MAX_ACCOUNT_NAME_LEN + 1]; // Connection setting name - char Hostname[MAX_HOST_NAME_LEN + 1]; // Host name - UINT Port; // Port number - UINT PortUDP; // UDP port number (0: Use only TCP) - UINT ProxyType; // Type of proxy - char ProxyName[MAX_HOST_NAME_LEN + 1]; // Proxy server name - UINT ProxyPort; // Port number of the proxy server - char ProxyUsername[PROXY_MAX_USERNAME_LEN + 1]; // Maximum user name length - char ProxyPassword[PROXY_MAX_PASSWORD_LEN + 1]; // Maximum password length - char CustomHttpHeader[HTTP_CUSTOM_HEADER_MAX_SIZE + 1]; // Custom HTTP proxy header - UINT NumRetry; // Automatic retries - UINT RetryInterval; // Retry interval - char HubName[MAX_HUBNAME_LEN + 1]; // HUB name - UINT MaxConnection; // Maximum number of concurrent TCP connections - bool UseEncrypt; // Use encrypted communication - bool UseCompress; // Use data compression - bool HalfConnection; // Use half connection in TCP - bool NoRoutingTracking; // Disable the routing tracking - char DeviceName[MAX_DEVICE_NAME_LEN + 1]; // VLAN device name - UINT AdditionalConnectionInterval; // Connection attempt interval when additional connection establish - UINT ConnectionDisconnectSpan; // Disconnection interval - bool HideStatusWindow; // Hide the status window - bool HideNicInfoWindow; // Hide the NIC status window - bool RequireMonitorMode; // Monitor port mode - bool RequireBridgeRoutingMode; // Bridge or routing mode - bool DisableQoS; // Disable the VoIP / QoS function - bool FromAdminPack; // For Administration Pack - bool NoUdpAcceleration; // Do not use UDP acceleration mode - UCHAR HostUniqueKey[SHA1_SIZE]; // Host unique key -}; - -// Client authentication data -struct CLIENT_AUTH -{ - UINT AuthType; // Authentication type - char Username[MAX_USERNAME_LEN + 1]; // User name - UCHAR HashedPassword[SHA1_SIZE]; // Hashed passwords - char PlainPassword[MAX_PASSWORD_LEN + 1]; // Password - X *ClientX; // Client certificate - K *ClientK; // Client private key - char SecurePublicCertName[MAX_SECURE_DEVICE_FILE_LEN + 1]; // Secure device certificate name - char SecurePrivateKeyName[MAX_SECURE_DEVICE_FILE_LEN + 1]; // Secure device secret key name - char OpensslEnginePrivateKeyName[MAX_SECURE_DEVICE_FILE_LEN + 1]; // Secure device secret key name - char OpensslEngineName[MAX_SECURE_DEVICE_FILE_LEN + 1]; // Secure device secret key name - CHECK_CERT_PROC *CheckCertProc; // Server certificate confirmation procedure - SECURE_SIGN_PROC *SecureSignProc; // Security signing procedure -}; - -// TCP socket data structure -struct TCPSOCK -{ - SOCK *Sock; // Socket - FIFO *RecvFifo; // Reception buffer - FIFO *SendFifo; // Transmission buffer - UINT Mode; // Read mode - UINT WantSize; // Requested data size - UINT NextBlockNum; // Total number of blocks that can be read next - UINT NextBlockSize; // Block size that is planned to read next - UINT CurrentPacketNum; // Current packet number - UINT64 LastCommTime; // Last communicated time - UINT64 LastRecvTime; // Time the last data received - UINT LateCount; // The number of delay occurences - UINT Direction; // Direction - UINT64 NextKeepAliveTime; // Next time to send a KeepAlive packet - RC4_KEY_PAIR Rc4KeyPair; // RC4 key pair - CRYPT *SendKey; // Transmission key - CRYPT *RecvKey; // Reception key - UINT64 DisconnectTick; // Time to disconnect this connection - UINT64 EstablishedTick; // Establishment time -}; - -// TCP communication data structure -struct TCP -{ - LIST *TcpSockList; // TCP socket list -}; - -// UDP communication data structure -struct UDP -{ - SOCK *s; // UDP socket (for transmission) - IP ip; // Destination IP address - UINT port; // Destination port number - UINT64 NextKeepAliveTime; // Next time to send a KeepAlive packet - UINT64 Seq; // Packet sequence number - UINT64 RecvSeq; - QUEUE *BufferQueue; // Queue of buffer to be sent -}; - -// Data block -struct BLOCK -{ - BOOL Compressed; // Compression flag - UINT Size; // Block size - UINT SizeofData; // Data size - UCHAR *Buf; // Buffer - bool PriorityQoS; // Priority packet for VoIP / QoS function - UINT Ttl; // TTL value (Used only in ICMP NAT of Virtual.c) - UINT Param1; // Parameter 1 - bool IsFlooding; // Is flooding packet - UCHAR RawFlagRetUdpAccel; // Raw flag returned by UDP accel -}; - -// Connection structure -struct CONNECTION -{ - LOCK *lock; // Lock - REF *ref; // Reference counter - CEDAR *Cedar; // Cedar - struct SESSION *Session; // Session - UINT Protocol; // Protocol - SOCK *FirstSock; // Socket for negotiation - SOCK *TubeSock; // Socket for in-process communication - TCP *Tcp; // TCP communication data structure - UDP *Udp; // UDP communication data structure - bool ServerMode; // Server mode - UINT Status; // Status - char *Name; // Connection name - THREAD *Thread; // Thread - volatile bool Halt; // Stop flag - UCHAR Random[SHA1_SIZE]; // Random number for Authentication - UINT ServerVer; // Server version - UINT ServerBuild; // Server build number - UINT ClientVer; // Client version - UINT ClientBuild; // Client build number - char ServerStr[MAX_SERVER_STR_LEN + 1]; // Server string - char ClientStr[MAX_CLIENT_STR_LEN + 1]; // Client string - UINT Err; // Error value - bool ClientConnectError_NoSavePassword; // Don't save the password for the specified user name - QUEUE *ReceivedBlocks; // Block queue that is received - QUEUE *SendBlocks; // Block queue planned to be sent - QUEUE *SendBlocks2; // Send queue (high priority) - COUNTER *CurrentNumConnection; // Counter of the number of current connections - LIST *ConnectingThreads; // List of connected threads - LIST *ConnectingSocks; // List of the connected sockets - bool flag1; // Flag 1 - UCHAR *RecvBuf; // Receive buffer - char ServerName[MAX_HOST_NAME_LEN + 1]; // Server name - UINT ServerPort; // Port number - bool RestoreServerNameAndPort; // Flag to restore the server name and port number to original - bool UseTicket; // Ticket using flag - UCHAR Ticket[SHA1_SIZE]; // Ticket - UINT CurrentSendQueueSize; // Total size of the transmission queue - X *ServerX; // Server certificate - X *ClientX; // Client certificate - char *CipherName; // Encryption algorithm name - UINT64 ConnectedTick; // Time it is connected - IP ClientIp; // Client IP address - char ClientHostname[MAX_HOST_NAME_LEN + 1]; // Client host name - UINT Type; // Type - void *hWndForUI; // Parent window - bool IsInProc; // In-process - char InProcPrefix[64]; // Prefix - UINT InProcLayer; // InProc layer - UINT AdditionalConnectionFailedCounter; // Additional connection failure counter - UINT64 LastCounterResetTick; // Time the counter was reset finally - bool WasSstp; // Processed the SSTP - bool WasDatProxy; // DAT proxy processed - UCHAR CToken_Hash[SHA1_SIZE]; // CTOKEN_HASH - UINT LastTcpQueueSize; // The last queue size of TCP sockets - UINT LastPacketQueueSize; // The last queue size of packets - UINT LastRecvFifoTotalSize; // The last RecvFifo total size - UINT LastRecvBlocksNum; // The last ReceivedBlocks num - bool IsJsonRpc; // Is JSON-RPC - bool JsonRpcAuthed; // JSON-RPC Authed - LISTENER *Listener; // Listener ref -}; - - - -// Function prototypes - -CONNECTION *NewClientConnection(SESSION *s); -CONNECTION *NewClientConnectionEx(SESSION *s, char *client_str, UINT client_ver, UINT client_build); -CONNECTION *NewServerConnection(CEDAR *cedar, SOCK *s, THREAD *t); -void ReleaseConnection(CONNECTION *c); -void CleanupConnection(CONNECTION *c); -int CompareConnection(void *p1, void *p2); -void StopConnection(CONNECTION *c, bool no_wait); -void ConnectionAccept(CONNECTION *c); -void StartTunnelingMode(CONNECTION *c); -void EndTunnelingMode(CONNECTION *c); -void DisconnectTcpSockets(CONNECTION *c); -void ConnectionReceive(CONNECTION *c, CANCEL *c1, CANCEL *c2); -void ConnectionSend(CONNECTION *c, UINT64 now); -TCPSOCK *NewTcpSock(SOCK *s); -void FreeTcpSock(TCPSOCK *ts); -BLOCK *NewBlock(void *data, UINT size, int compress); -void FreeBlock(BLOCK *b); -void StopAllAdditionalConnectThread(CONNECTION *c); -UINT GenNextKeepAliveSpan(CONNECTION *c); -void SendKeepAlive(CONNECTION *c, TCPSOCK *ts); -void DisconnectUDPSockets(CONNECTION *c); -void PutUDPPacketData(CONNECTION *c, void *data, UINT size); -void SendDataWithUDP(SOCK *s, CONNECTION *c); -void InsertReceivedBlockToQueue(CONNECTION *c, BLOCK *block, bool no_lock); -UINT TcpSockRecv(SESSION *s, TCPSOCK *ts, void *data, UINT size); -UINT TcpSockSend(SESSION *s, TCPSOCK *ts, void *data, UINT size); -void WriteSendFifo(SESSION *s, TCPSOCK *ts, void *data, UINT size); -void WriteRecvFifo(SESSION *s, TCPSOCK *ts, void *data, UINT size); -CLIENT_AUTH *CopyClientAuth(CLIENT_AUTH *a); -BUF *NewKeepPacket(bool server_mode); -void KeepThread(THREAD *thread, void *param); -KEEP *StartKeep(); -void StopKeep(KEEP *k); -void InRpcSecureSign(SECURE_SIGN *t, PACK *p); -void OutRpcSecureSign(PACK *p, SECURE_SIGN *t); -void FreeRpcSecureSign(SECURE_SIGN *t); -void NormalizeEthMtu(BRIDGE *b, CONNECTION *c, UINT packet_size); -UINT GetMachineRand(); - - - -#endif // CONNECTION_H +// SoftEther VPN Source Code - Developer Edition Master Branch +// Cedar Communication Module +// © 2020 Nokia + +// Connection.h +// Header of Connection.c + +#ifndef CONNECTION_H +#define CONNECTION_H + +// Magic number indicating that the packet is compressed +#define CONNECTION_BULK_COMPRESS_SIGNATURE 0xDEADBEEFCAFEFACEULL + +#define KEEP_ALIVE_STRING "Internet Connection Keep Alive Packet" + +#define UPDATE_LAST_COMM_TIME(v, n) {if ((v) <= (n)) { v = (n); } } + +// KEEP CONNECT structure +struct KEEP +{ + LOCK *lock; // Lock + bool Server; // Server mode + volatile bool Halt; // Stop flag + bool Enable; // Enable flag + char ServerName[MAX_HOST_NAME_LEN + 1]; // Server name + UINT ServerPort; // Server port number + bool UdpMode; // UDP mode + UINT Interval; // Packet transmission interval + THREAD *Thread; // Connection thread + EVENT *HaltEvent; // Stop event + CANCEL *Cancel; // Cancel +}; + +// SECURE_SIGN Structure +struct SECURE_SIGN +{ + char SecurePublicCertName[MAX_SECURE_DEVICE_FILE_LEN + 1]; // Secure device certificate name + char SecurePrivateKeyName[MAX_SECURE_DEVICE_FILE_LEN + 1]; // Secure device secret key name + X *ClientCert; // Client certificate + UCHAR Random[SHA1_SIZE]; // Random value for signature + UCHAR Signature[4096 / 8]; // Signed data + UINT UseSecureDeviceId; + UINT BitmapId; // Bitmap ID +}; + +// Function type declaration +typedef bool (CHECK_CERT_PROC)(SESSION *s, CONNECTION *c, X *server_x, bool *expired); +typedef bool (SECURE_SIGN_PROC)(SESSION *s, CONNECTION *c, SECURE_SIGN *sign); + +// RC4 key pair +struct RC4_KEY_PAIR +{ + UCHAR ServerToClientKey[16]; + UCHAR ClientToServerKey[16]; +}; + +// Client Options +struct CLIENT_OPTION +{ + wchar_t AccountName[MAX_ACCOUNT_NAME_LEN + 1]; // Connection setting name + char Hostname[MAX_HOST_NAME_LEN + 1]; // Host name + UINT Port; // Port number + UINT PortUDP; // UDP port number (0: Use only TCP) + UINT ProxyType; // Type of proxy + char ProxyName[MAX_HOST_NAME_LEN + 1]; // Proxy server name + UINT ProxyPort; // Port number of the proxy server + char ProxyUsername[PROXY_MAX_USERNAME_LEN + 1]; // Maximum user name length + char ProxyPassword[PROXY_MAX_PASSWORD_LEN + 1]; // Maximum password length + char CustomHttpHeader[HTTP_CUSTOM_HEADER_MAX_SIZE + 1]; // Custom HTTP proxy header + UINT NumRetry; // Automatic retries + UINT RetryInterval; // Retry interval + char HubName[MAX_HUBNAME_LEN + 1]; // HUB name + UINT MaxConnection; // Maximum number of concurrent TCP connections + bool UseEncrypt; // Use encrypted communication + bool UseCompress; // Use data compression + bool HalfConnection; // Use half connection in TCP + bool NoRoutingTracking; // Disable the routing tracking + char DeviceName[MAX_DEVICE_NAME_LEN + 1]; // VLAN device name + UINT AdditionalConnectionInterval; // Connection attempt interval when additional connection establish + UINT ConnectionDisconnectSpan; // Disconnection interval + bool HideStatusWindow; // Hide the status window + bool HideNicInfoWindow; // Hide the NIC status window + bool RequireMonitorMode; // Monitor port mode + bool RequireBridgeRoutingMode; // Bridge or routing mode + bool DisableQoS; // Disable the VoIP / QoS function + bool FromAdminPack; // For Administration Pack + bool NoUdpAcceleration; // Do not use UDP acceleration mode + UCHAR HostUniqueKey[SHA1_SIZE]; // Host unique key +}; + +// Client authentication data +struct CLIENT_AUTH +{ + UINT AuthType; // Authentication type + char Username[MAX_USERNAME_LEN + 1]; // User name + UCHAR HashedPassword[SHA1_SIZE]; // Hashed passwords + char PlainPassword[MAX_PASSWORD_LEN + 1]; // Password + X *ClientX; // Client certificate + K *ClientK; // Client private key + char SecurePublicCertName[MAX_SECURE_DEVICE_FILE_LEN + 1]; // Secure device certificate name + char SecurePrivateKeyName[MAX_SECURE_DEVICE_FILE_LEN + 1]; // Secure device secret key name + char OpensslEnginePrivateKeyName[MAX_SECURE_DEVICE_FILE_LEN + 1]; // Secure device secret key name + char OpensslEngineName[MAX_SECURE_DEVICE_FILE_LEN + 1]; // Secure device secret key name + CHECK_CERT_PROC *CheckCertProc; // Server certificate confirmation procedure + SECURE_SIGN_PROC *SecureSignProc; // Security signing procedure +}; + +// TCP socket data structure +struct TCPSOCK +{ + SOCK *Sock; // Socket + FIFO *RecvFifo; // Reception buffer + FIFO *SendFifo; // Transmission buffer + UINT Mode; // Read mode + UINT WantSize; // Requested data size + UINT NextBlockNum; // Total number of blocks that can be read next + UINT NextBlockSize; // Block size that is planned to read next + UINT CurrentPacketNum; // Current packet number + UINT64 LastCommTime; // Last communicated time + UINT64 LastRecvTime; // Time the last data received + UINT LateCount; // The number of delay occurences + UINT Direction; // Direction + UINT64 NextKeepAliveTime; // Next time to send a KeepAlive packet + RC4_KEY_PAIR Rc4KeyPair; // RC4 key pair + CRYPT *SendKey; // Transmission key + CRYPT *RecvKey; // Reception key + UINT64 DisconnectTick; // Time to disconnect this connection + UINT64 EstablishedTick; // Establishment time +}; + +// TCP communication data structure +struct TCP +{ + LIST *TcpSockList; // TCP socket list +}; + +// UDP communication data structure +struct UDP +{ + SOCK *s; // UDP socket (for transmission) + IP ip; // Destination IP address + UINT port; // Destination port number + UINT64 NextKeepAliveTime; // Next time to send a KeepAlive packet + UINT64 Seq; // Packet sequence number + UINT64 RecvSeq; + QUEUE *BufferQueue; // Queue of buffer to be sent +}; + +// Data block +struct BLOCK +{ + BOOL Compressed; // Compression flag + UINT Size; // Block size + UINT SizeofData; // Data size + UCHAR *Buf; // Buffer + bool PriorityQoS; // Priority packet for VoIP / QoS function + UINT Ttl; // TTL value (Used only in ICMP NAT of Virtual.c) + UINT Param1; // Parameter 1 + bool IsFlooding; // Is flooding packet + UCHAR RawFlagRetUdpAccel; // Raw flag returned by UDP accel +}; + +// Connection structure +struct CONNECTION +{ + LOCK *lock; // Lock + REF *ref; // Reference counter + CEDAR *Cedar; // Cedar + struct SESSION *Session; // Session + UINT Protocol; // Protocol + SOCK *FirstSock; // Socket for negotiation + SOCK *TubeSock; // Socket for in-process communication + TCP *Tcp; // TCP communication data structure + UDP *Udp; // UDP communication data structure + bool ServerMode; // Server mode + UINT Status; // Status + char *Name; // Connection name + THREAD *Thread; // Thread + volatile bool Halt; // Stop flag + UCHAR Random[SHA1_SIZE]; // Random number for Authentication + UINT ServerVer; // Server version + UINT ServerBuild; // Server build number + UINT ClientVer; // Client version + UINT ClientBuild; // Client build number + char ServerStr[MAX_SERVER_STR_LEN + 1]; // Server string + char ClientStr[MAX_CLIENT_STR_LEN + 1]; // Client string + UINT Err; // Error value + bool ClientConnectError_NoSavePassword; // Don't save the password for the specified user name + QUEUE *ReceivedBlocks; // Block queue that is received + QUEUE *SendBlocks; // Block queue planned to be sent + QUEUE *SendBlocks2; // Send queue (high priority) + COUNTER *CurrentNumConnection; // Counter of the number of current connections + LIST *ConnectingThreads; // List of connected threads + LIST *ConnectingSocks; // List of the connected sockets + bool flag1; // Flag 1 + UCHAR *RecvBuf; // Receive buffer + char ServerName[MAX_HOST_NAME_LEN + 1]; // Server name + UINT ServerPort; // Port number + bool RestoreServerNameAndPort; // Flag to restore the server name and port number to original + bool UseTicket; // Ticket using flag + UCHAR Ticket[SHA1_SIZE]; // Ticket + UINT CurrentSendQueueSize; // Total size of the transmission queue + X *ServerX; // Server certificate + X *ClientX; // Client certificate + char *CipherName; // Encryption algorithm name + UINT64 ConnectedTick; // Time it is connected + IP ClientIp; // Client IP address + char ClientHostname[MAX_HOST_NAME_LEN + 1]; // Client host name + UINT Type; // Type + void *hWndForUI; // Parent window + bool IsInProc; // In-process + char InProcPrefix[64]; // Prefix + UINT InProcLayer; // InProc layer + UINT AdditionalConnectionFailedCounter; // Additional connection failure counter + UINT64 LastCounterResetTick; // Time the counter was reset finally + bool WasSstp; // Processed the SSTP + bool WasDatProxy; // DAT proxy processed + UCHAR CToken_Hash[SHA1_SIZE]; // CTOKEN_HASH + UINT LastTcpQueueSize; // The last queue size of TCP sockets + UINT LastPacketQueueSize; // The last queue size of packets + UINT LastRecvFifoTotalSize; // The last RecvFifo total size + UINT LastRecvBlocksNum; // The last ReceivedBlocks num + bool IsJsonRpc; // Is JSON-RPC + bool JsonRpcAuthed; // JSON-RPC Authed + LISTENER *Listener; // Listener ref +}; + + + +// Function prototypes + +CONNECTION *NewClientConnection(SESSION *s); +CONNECTION *NewClientConnectionEx(SESSION *s, char *client_str, UINT client_ver, UINT client_build); +CONNECTION *NewServerConnection(CEDAR *cedar, SOCK *s, THREAD *t); +void ReleaseConnection(CONNECTION *c); +void CleanupConnection(CONNECTION *c); +int CompareConnection(void *p1, void *p2); +void StopConnection(CONNECTION *c, bool no_wait); +void ConnectionAccept(CONNECTION *c); +void StartTunnelingMode(CONNECTION *c); +void EndTunnelingMode(CONNECTION *c); +void DisconnectTcpSockets(CONNECTION *c); +void ConnectionReceive(CONNECTION *c, CANCEL *c1, CANCEL *c2); +void ConnectionSend(CONNECTION *c, UINT64 now); +TCPSOCK *NewTcpSock(SOCK *s); +void FreeTcpSock(TCPSOCK *ts); +BLOCK *NewBlock(void *data, UINT size, int compress); +void FreeBlock(BLOCK *b); +void StopAllAdditionalConnectThread(CONNECTION *c); +UINT GenNextKeepAliveSpan(CONNECTION *c); +void SendKeepAlive(CONNECTION *c, TCPSOCK *ts); +void DisconnectUDPSockets(CONNECTION *c); +void PutUDPPacketData(CONNECTION *c, void *data, UINT size); +void SendDataWithUDP(SOCK *s, CONNECTION *c); +void InsertReceivedBlockToQueue(CONNECTION *c, BLOCK *block, bool no_lock); +UINT TcpSockRecv(SESSION *s, TCPSOCK *ts, void *data, UINT size); +UINT TcpSockSend(SESSION *s, TCPSOCK *ts, void *data, UINT size); +void WriteSendFifo(SESSION *s, TCPSOCK *ts, void *data, UINT size); +void WriteRecvFifo(SESSION *s, TCPSOCK *ts, void *data, UINT size); +CLIENT_AUTH *CopyClientAuth(CLIENT_AUTH *a); +BUF *NewKeepPacket(bool server_mode); +void KeepThread(THREAD *thread, void *param); +KEEP *StartKeep(); +void StopKeep(KEEP *k); +void InRpcSecureSign(SECURE_SIGN *t, PACK *p); +void OutRpcSecureSign(PACK *p, SECURE_SIGN *t); +void FreeRpcSecureSign(SECURE_SIGN *t); +void NormalizeEthMtu(BRIDGE *b, CONNECTION *c, UINT packet_size); +UINT GetMachineRand(); + + + +#endif // CONNECTION_H diff --git a/src/Cedar/Console.c b/src/Cedar/Console.c index 28d4bc57..bd946e5a 100644 --- a/src/Cedar/Console.c +++ b/src/Cedar/Console.c @@ -1,2461 +1,2461 @@ -// SoftEther VPN Source Code - Developer Edition Master Branch -// Cedar Communication Module - - -// Console.c -// Console Service - -#include "CedarPch.h" - - -// Display the help for the command -void PrintCmdHelp(CONSOLE *c, char *cmd_name, TOKEN_LIST *param_list) -{ - wchar_t tmp[MAX_SIZE]; - wchar_t *buf; - UINT buf_size; - wchar_t *description, *args, *help; - UNI_TOKEN_LIST *t; - UINT width; - UINT i; - char *space; - // Validate arguments - if (c == NULL || cmd_name == NULL || param_list == NULL) - { - return; - } - - width = GetConsoleWidth(c) - 2; - - buf_size = sizeof(wchar_t) * (width + 32); - buf = Malloc(buf_size); - - GetCommandHelpStr(cmd_name, &description, &args, &help); - - space = MakeCharArray(' ', 2); - - // Title - UniFormat(tmp, sizeof(tmp), _UU("CMD_HELP_TITLE"), cmd_name); - c->Write(c, tmp); - c->Write(c, L""); - - // Purpose - c->Write(c, _UU("CMD_HELP_DESCRIPTION")); - t = SeparateStringByWidth(description, width - 2); - for (i = 0;i < t->NumTokens;i++) - { - UniFormat(buf, buf_size, L"%S%s", space, t->Token[i]); - c->Write(c, buf); - } - UniFreeToken(t); - c->Write(c, L""); - - // Description - c->Write(c, _UU("CMD_HELP_HELP")); - t = SeparateStringByWidth(help, width - 2); - for (i = 0;i < t->NumTokens;i++) - { - UniFormat(buf, buf_size, L"%S%s", space, t->Token[i]); - c->Write(c, buf); - } - UniFreeToken(t); - c->Write(c, L""); - - // Usage - c->Write(c, _UU("CMD_HELP_USAGE")); - t = SeparateStringByWidth(args, width - 2); - for (i = 0;i < t->NumTokens;i++) - { - UniFormat(buf, buf_size, L"%S%s", space, t->Token[i]); - c->Write(c, buf); - } - UniFreeToken(t); - - // Arguments - if (param_list->NumTokens >= 1) - { - c->Write(c, L""); - c->Write(c, _UU("CMD_HELP_ARGS")); - PrintCandidateHelp(c, cmd_name, param_list, 2); - } - - Free(space); - - Free(buf); -} - -// Evaluate whether it is SafeStr -bool CmdEvalSafe(CONSOLE *c, wchar_t *str, void *param) -{ - wchar_t *p = (param == NULL) ? _UU("CMD_EVAL_SAFE") : (wchar_t *)param; - - if (IsSafeUniStr(str)) - { - return true; - } - - c->Write(c, p); - - return false; -} - -// String input prompt -wchar_t *CmdPrompt(CONSOLE *c, void *param) -{ - wchar_t *p = (param == NULL) ? _UU("CMD_PROMPT") : (wchar_t *)param; - - return c->ReadLine(c, p, true); -} - -// Evaluation whether the specified file exists -bool CmdEvalIsFile(CONSOLE *c, wchar_t *str, void *param) -{ - wchar_t tmp[MAX_PATH]; - // Validate arguments - if (c == NULL || str == NULL) - { - return false; - } - - UniStrCpy(tmp, sizeof(tmp), str); - - if (IsEmptyUniStr(tmp)) - { - c->Write(c, _UU("CMD_FILE_NAME_EMPTY")); - return false; - } - - if (IsFileExistsW(tmp) == false) - { - wchar_t tmp2[MAX_SIZE]; - - UniFormat(tmp2, sizeof(tmp2), _UU("CMD_FILE_NOT_FOUND"), tmp); - c->Write(c, tmp2); - - return false; - } - - return true; -} - -// Evaluation of integer -bool CmdEvalInt1(CONSOLE *c, wchar_t *str, void *param) -{ - wchar_t *p = (param == NULL) ? _UU("CMD_EVAL_INT") : (wchar_t *)param; - - if (UniToInt(str) == 0) - { - c->Write(c, p); - - return false; - } - - return true; -} - -// Evaluation of the parameters that a blank cannot be specified to -bool CmdEvalNotEmpty(CONSOLE *c, wchar_t *str, void *param) -{ - wchar_t *p = (param == NULL) ? _UU("CMD_EVAL_NOT_EMPTY") : (wchar_t *)param; - - if (UniIsEmptyStr(str) == false) - { - return true; - } - - c->Write(c, p); - - return false; -} - -// Evaluation function for minimum / maximum value of the parameter -bool CmdEvalMinMax(CONSOLE *c, wchar_t *str, void *param) -{ - CMD_EVAL_MIN_MAX *e; - wchar_t *tag; - UINT v; - // Validate arguments - if (param == NULL) - { - return false; - } - - e = (CMD_EVAL_MIN_MAX *)param; - - if (e->StrName == NULL) - { - tag = _UU("CMD_EVAL_MIN_MAX"); - } - else - { - tag = _UU(e->StrName); - } - - v = UniToInt(str); - - if (v >= e->MinValue && v <= e->MaxValue) - { - return true; - } - else - { - wchar_t tmp[MAX_SIZE]; - - UniFormat(tmp, sizeof(tmp), tag, e->MinValue, e->MaxValue); - c->Write(c, tmp); - - return false; - } -} - -// Get the help string of command -void GetCommandHelpStr(char *command_name, wchar_t **description, wchar_t **args, wchar_t **help) -{ - char tmp1[128], tmp2[128], tmp3[128]; - - Format(tmp1, sizeof(tmp1), "CMD_%s", command_name); - Format(tmp2, sizeof(tmp2), "CMD_%s_ARGS", command_name); - Format(tmp3, sizeof(tmp3), "CMD_%s_HELP", command_name); - - if (description != NULL) - { - *description = _UU(tmp1); - if (UniIsEmptyStr(*description)) - { - *description = _UU("CMD_UNKNOWM"); - } - } - - if (args != NULL) - { - *args = _UU(tmp2); - if (UniIsEmptyStr(*args)) - { - *args = _UU("CMD_UNKNOWN_ARGS"); - } - } - - if (help != NULL) - { - *help = _UU(tmp3); - if (UniIsEmptyStr(*help)) - { - *help = _UU("CMD_UNKNOWN_HELP"); - } - } -} - -// Get the help string for parameter -void GetCommandParamHelpStr(char *command_name, char *param_name, wchar_t **description) -{ - char tmp[160]; - if (description == NULL) - { - return; - } - - Format(tmp, sizeof(tmp), "CMD_%s_%s", command_name, param_name); - - *description = _UU(tmp); - - if (UniIsEmptyStr(*description)) - { - *description = _UU("CMD_UNKNOWN_PARAM"); - } -} - -// String comparison function -int CompareCandidateStr(void *p1, void *p2) -{ - char *s1, *s2; - if (p1 == NULL || p2 == NULL) - { - return 0; - } - s1 = *(char **)p1; - s2 = *(char **)p2; - if (s1 == NULL || s2 == NULL) - { - return 0; - } - - if (s1[0] == '[' && s2[0] != '[') - { - return -1; - } - else if (s2[0] == '[' && s1[0] != '[') - { - return 1; - } - - return StrCmp(s1, s2); -} - -// Display the help of the candidate list -void PrintCandidateHelp(CONSOLE *c, char *cmd_name, TOKEN_LIST *candidate_list, UINT left_space) -{ - UINT console_width; - UINT max_keyword_width; - LIST *o; - UINT i; - wchar_t *tmpbuf; - UINT tmpbuf_size; - char *left_space_array; - char *max_space_array; - // Validate arguments - if (c == NULL || candidate_list == NULL) - { - return; - } - - // Get the width of the screen - console_width = GetConsoleWidth(c) - 1; - - tmpbuf_size = sizeof(wchar_t) * (console_width + 32); - tmpbuf = Malloc(tmpbuf_size); - - left_space_array = MakeCharArray(' ', left_space); - - // Sort and enlist the command name - // no need to sort the parameter name - o = NewListFast(cmd_name == NULL ? CompareCandidateStr : NULL); - - max_keyword_width = 0; - - for (i = 0;i < candidate_list->NumTokens;i++) - { - UINT keyword_width; - - // Get the width of each keyword - Insert(o, candidate_list->Token[i]); - - keyword_width = StrWidth(candidate_list->Token[i]); - if (cmd_name != NULL) - { - if (candidate_list->Token[i][0] != '[') - { - keyword_width += 1; - } - else - { - keyword_width -= 2; - } - } - - max_keyword_width = MAX(max_keyword_width, keyword_width); - } - - max_space_array = MakeCharArray(' ', max_keyword_width); - - // Display the candidate - for (i = 0;i < LIST_NUM(o);i++) - { - char tmp[128]; - char *name = LIST_DATA(o, i); - UNI_TOKEN_LIST *t; - wchar_t *help; - UINT j; - UINT keyword_start_width = left_space; - UINT descript_start_width = left_space + max_keyword_width + 1; - UINT descript_width; - char *space; - - if (console_width >= (descript_start_width + 5)) - { - descript_width = console_width - descript_start_width - 3; - } - else - { - descript_width = 2; - } - - // Generate the name - if (cmd_name != NULL && name[0] != '[') - { - // Prepend a "/" in the case of a parameter - Format(tmp, sizeof(tmp), "/%s", name); - } - else - { - // Use the characters as it is in the case of a command name - if (cmd_name == NULL) - { - StrCpy(tmp, sizeof(tmp), name); - } - else - { - StrCpy(tmp, sizeof(tmp), name + 1); - if (StrLen(tmp) >= 1) - { - tmp[StrLen(tmp) - 1] = 0; - } - } - } - - // Get the help string - if (cmd_name == NULL) - { - GetCommandHelpStr(name, &help, NULL, NULL); - } - else - { - GetCommandParamHelpStr(cmd_name, name, &help); - } - - space = MakeCharArray(' ', max_keyword_width - StrWidth(name) - (cmd_name == NULL ? 0 : (name[0] != '[' ? 1 : -2))); - - t = SeparateStringByWidth(help, descript_width); - - for (j = 0;j < t->NumTokens;j++) - { - if (j == 0) - { - UniFormat(tmpbuf, tmpbuf_size, L"%S%S%S - %s", - left_space_array, tmp, space, t->Token[j]); - } - else - { - UniFormat(tmpbuf, tmpbuf_size, L"%S%S %s", - left_space_array, max_space_array, t->Token[j]); - } - - c->Write(c, tmpbuf); - } - - Free(space); - - UniFreeToken(t); - } - - ReleaseList(o); - - Free(max_space_array); - Free(tmpbuf); - Free(left_space_array); -} - -// Acquisition whether word characters -bool IsWordChar(wchar_t c) -{ - if (c >= L'a' && c <= 'z') - { - return true; - } - if (c >= L'A' && c <= 'Z') - { - return true; - } - if (c >= L'0' && c <= '9') - { - return true; - } - if (c == L'_') - { - return true; - } - if (c == L'.') - { - return true; - } - if (c == L'\"') - { - return true; - } - if (c == L'\'') - { - return true; - } - if (c == L',') - { - return true; - } - if (c == L')') - { - return true; - } - if (c == L']') - { - return true; - } - - return false; -} - -// Get the character width of the word that comes next -UINT GetNextWordWidth(wchar_t *str) -{ - UINT i; - UINT ret; - // Validate arguments - if (str == NULL) - { - return 0; - } - - ret = 0; - - for (i = 0;;i++) - { - wchar_t c = str[i]; - - if (c == 0) - { - break; - } - - if (IsWordChar(c) == false) - { - break; - } - - ret++; - } - - return ret; -} - -// Split a string into specified width -UNI_TOKEN_LIST *SeparateStringByWidth(wchar_t *str, UINT width) -{ - UINT wp; - wchar_t *tmp; - UINT len, i; - LIST *o; - UNI_TOKEN_LIST *ret; - // Validate arguments - if (str == NULL) - { - return UniNullToken(); - } - if (width == 0) - { - width = 1; - } - - o = NewListFast(NULL); - - len = UniStrLen(str); - tmp = ZeroMalloc(sizeof(wchar_t) * (len + 32)); - wp = 0; - - for (i = 0;i < (len + 1);i++) - { - wchar_t c = str[i]; - UINT next_word_width; - UINT remain_width; - - switch (c) - { - case 0: - case L'\r': - case L'\n': - if (c == L'\r') - { - if (str[i + 1] == L'\n') - { - i++; - } - } - - tmp[wp++] = 0; - wp = 0; - - Insert(o, UniCopyStr(tmp)); - break; - - default: - next_word_width = GetNextWordWidth(&str[i]); - remain_width = (width - UniStrWidth(tmp)); - - if ((remain_width >= 1) && (next_word_width > remain_width) && (next_word_width <= width)) - { - tmp[wp++] = 0; - wp = 0; - - Insert(o, UniCopyStr(tmp)); - } - - tmp[wp++] = c; - tmp[wp] = 0; - if (UniStrWidth(tmp) >= width) - { - tmp[wp++] = 0; - wp = 0; - - Insert(o, UniCopyStr(tmp)); - } - break; - } - } - - if (LIST_NUM(o) == 0) - { - Insert(o, CopyUniStr(L"")); - } - - ret = ZeroMalloc(sizeof(UNI_TOKEN_LIST)); - ret->NumTokens = LIST_NUM(o); - ret->Token = ZeroMalloc(sizeof(wchar_t *) * ret->NumTokens); - - for (i = 0;i < LIST_NUM(o);i++) - { - wchar_t *s = LIST_DATA(o, i); - - UniTrimLeft(s); - - ret->Token[i] = s; - } - - ReleaseList(o); - Free(tmp); - - return ret; -} - -// Check whether the specified string means 'help' -bool IsHelpStr(char *str) -{ - // Validate arguments - if (str == NULL) - { - return false; - } - - if (StrCmpi(str, "help") == 0 || StrCmpi(str, "?") == 0 || - StrCmpi(str, "man") == 0 || StrCmpi(str, "/man") == 0 || - StrCmpi(str, "-man") == 0 || StrCmpi(str, "--man") == 0 || - StrCmpi(str, "/help") == 0 || StrCmpi(str, "/?") == 0 || - StrCmpi(str, "-help") == 0 || StrCmpi(str, "-?") == 0 || - StrCmpi(str, "/h") == 0 || StrCmpi(str, "--help") == 0 || - StrCmpi(str, "--?") == 0) - { - return true; - } - - return false; -} - -// Execution of the command -bool DispatchNextCmd(CONSOLE *c, char *prompt, CMD cmd[], UINT num_cmd, void *param) -{ - return DispatchNextCmdEx(c, NULL, prompt, cmd, num_cmd, param); -} -bool DispatchNextCmdEx(CONSOLE *c, wchar_t *exec_command, char *prompt, CMD cmd[], UINT num_cmd, void *param) -{ - wchar_t *str; - wchar_t *tmp; - char *cmd_name; - bool b_exit = false; - wchar_t *cmd_param; - UINT ret = ERR_NO_ERROR; - TOKEN_LIST *t; - TOKEN_LIST *candidate; - bool no_end_crlf = false; - UINT i; - // Validate arguments - if (c == NULL || (num_cmd >= 1 && cmd == NULL)) - { - return false; - } - - if (exec_command == NULL) - { - // Show the prompt -RETRY: - tmp = CopyStrToUni(prompt); - - if (c->ProgrammingMode) - { - wchar_t tmp2[MAX_PATH]; - - UniFormat(tmp2, sizeof(tmp2), L"[PROMPT:%u:%s]\r\n", c->RetCode, tmp); - - Free(tmp); - - tmp = CopyUniStr(tmp2); - } - - str = c->ReadLine(c, tmp, false); - Free(tmp); - - if (str != NULL && IsEmptyUniStr(str)) - { - Free(str); - goto RETRY; - } - } - else - { - wchar_t tmp[MAX_SIZE]; - // Use exec_command - if (UniStartWith(exec_command, L"vpncmd") == false) - { - if (prompt != NULL) - { - if (c->ConsoleType != CONSOLE_CSV) - { - UniFormat(tmp, sizeof(tmp), L"%S%s", prompt, exec_command); - c->Write(c, tmp); - } - } - } - str = CopyUniStr(exec_command); - } - - if (str == NULL) - { - // User canceled - return false; - } - - UniTrimCrlf(str); - UniTrim(str); - - if (UniIsEmptyStr(str)) - { - // Do Nothing - Free(str); - return true; - } - - // Divide into command name and parameter - if (SeparateCommandAndParam(str, &cmd_name, &cmd_param) == false) - { - // Do Nothing - Free(str); - return true; - } - - if (StrLen(cmd_name) >= 2 && cmd_name[0] == '?' && cmd_name[1] != '?') - { - char tmp[MAX_SIZE]; - wchar_t *s; - - StrCpy(tmp, sizeof(tmp), cmd_name + 1); - StrCpy(cmd_name, 0, tmp); - - s = UniCopyStr(L"/?"); - Free(cmd_param); - - cmd_param = s; - } - - if (StrLen(cmd_name) >= 2 && EndWith(cmd_name, "?") && cmd_name[StrLen(cmd_name) - 2] != '?') - { - wchar_t *s; - - cmd_name[StrLen(cmd_name) - 1] = 0; - - s = UniCopyStr(L"/?"); - Free(cmd_param); - - cmd_param = s; - } - - // Get the candidate of command - t = ZeroMalloc(sizeof(TOKEN_LIST)); - t->NumTokens = num_cmd; - t->Token = ZeroMalloc(sizeof(char *) * t->NumTokens); - for (i = 0;i < t->NumTokens;i++) - { - t->Token[i] = CopyStr(cmd[i].Name); - } - - if (IsHelpStr(cmd_name)) - { - if (UniIsEmptyStr(cmd_param)) - { - wchar_t tmp[MAX_SIZE]; - - // Display the list of commands that can be used - UniFormat(tmp, sizeof(tmp), _UU("CMD_HELP_1"), t->NumTokens); - c->Write(c, tmp); - - PrintCandidateHelp(c, NULL, t, 1); - - c->Write(c, L""); - c->Write(c, _UU("CMD_HELP_2")); - } - else - { - char *cmd_name; - - // Display the help for the specified command - if (SeparateCommandAndParam(cmd_param, &cmd_name, NULL)) - { - bool b = true; - - if (IsHelpStr(cmd_name)) - { - b = false; - } - - if (b) - { - wchar_t str[MAX_SIZE]; - - UniFormat(str, sizeof(str), L"%S /help", cmd_name); - DispatchNextCmdEx(c, str, NULL, cmd, num_cmd, param); - no_end_crlf = true; - } - - Free(cmd_name); - } - } - } - else if (StrCmpi(cmd_name, "exit") == 0 || StrCmpi(cmd_name, "quit") == 0) - { - // Exit - b_exit = true; - } - else - { - candidate = GetRealnameCandidate(cmd_name, t); - - if (candidate == NULL || candidate->NumTokens == 0) - { - wchar_t tmp[MAX_SIZE]; - - // No candidate - UniFormat(tmp, sizeof(tmp), _UU("CON_UNKNOWN_CMD"), cmd_name); - c->Write(c, tmp); - - c->RetCode = ERR_BAD_COMMAND_OR_PARAM; - } - else if (candidate->NumTokens >= 2) - { - wchar_t tmp[MAX_SIZE]; - - // There is more than one candidate - UniFormat(tmp, sizeof(tmp), _UU("CON_AMBIGUOUS_CMD"), cmd_name); - c->Write(c, tmp); - c->Write(c, _UU("CON_AMBIGUOUS_CMD_1")); - PrintCandidateHelp(c, NULL, candidate, 1); - c->Write(c, _UU("CON_AMBIGUOUS_CMD_2")); - - c->RetCode = ERR_BAD_COMMAND_OR_PARAM; - } - else - { - char *real_cmd_name; - UINT i; - - // The candidate was shortlisted to one - real_cmd_name = candidate->Token[0]; - - for (i = 0;i < num_cmd;i++) - { - if (StrCmpi(cmd[i].Name, real_cmd_name) == 0) - { - if (cmd[i].Proc != NULL) - { - // Show the description of the command if it isn't in CSV mode - if(c->ConsoleType != CONSOLE_CSV) - { - wchar_t tmp[256]; - wchar_t *note; - - GetCommandHelpStr(cmd[i].Name, ¬e, NULL, NULL); - UniFormat(tmp, sizeof(tmp), _UU("CMD_EXEC_MSG_NAME"), cmd[i].Name, note); - c->Write(c, tmp); - } - - // Call the procedure of the command - ret = cmd[i].Proc(c, cmd[i].Name, cmd_param, param); - - if (ret == INFINITE) - { - // Exit command - b_exit = true; - } - else - { - c->RetCode = ret; - } - } - } - } - } - - FreeToken(candidate); - } - - FreeToken(t); - Free(str); - Free(cmd_name); - Free(cmd_param); - - if (no_end_crlf == false) - { - //c->Write(c, L""); - } - - if (b_exit) - { - return false; - } - - return true; -} - -// Get the width of the current console -UINT GetConsoleWidth(CONSOLE *c) -{ - UINT size; - - size = c->GetWidth(c); - - if (size == 0) - { - size = 80; - } - - if (size < 32) - { - size = 32; - } - - if (size > 65536) - { - size = 65535; - } - - return size; -} - -// Separate the command line into the command and the parameters -bool SeparateCommandAndParam(wchar_t *src, char **cmd, wchar_t **param) -{ - UINT i, len, wp; - wchar_t *tmp; - wchar_t *src_tmp; - // Validate arguments - if (src == NULL) - { - return false; - } - if (cmd != NULL) - { - *cmd = NULL; - } - if (param != NULL) - { - *param = NULL; - } - - src_tmp = UniCopyStr(src); - UniTrimCrlf(src_tmp); - UniTrim(src_tmp); - - len = UniStrLen(src_tmp); - tmp = Malloc(sizeof(wchar_t) * (len + 32)); - wp = 0; - - for (i = 0;i < (len + 1);i++) - { - wchar_t c = src_tmp[i]; - - switch (c) - { - case 0: - case L' ': - case L'\t': - tmp[wp] = 0; - if (UniIsEmptyStr(tmp)) - { - Free(tmp); - Free(src_tmp); - return false; - } - if (cmd != NULL) - { - *cmd = CopyUniToStr(tmp); - Trim(*cmd); - } - goto ESCAPE; - - default: - tmp[wp++] = c; - break; - } - } - -ESCAPE: - if (param != NULL) - { - *param = CopyUniStr(&src_tmp[wp]); - UniTrim(*param); - } - - Free(tmp); - Free(src_tmp); - - return true; -} - -// Get the candidates list of of the real command name whose abbreviation matches to the command specified by the user -TOKEN_LIST *GetRealnameCandidate(char *input_name, TOKEN_LIST *real_name_list) -{ - TOKEN_LIST *ret; - LIST *o; - UINT i; - bool ok = false; - // Validate arguments - if (input_name == NULL || real_name_list == NULL) - { - return NullToken(); - } - - o = NewListFast(NULL); - - for (i = 0;i < real_name_list->NumTokens;i++) - { - char *name = real_name_list->Token[i]; - - // Search for an exact match with the highest priority first - if (StrCmpi(name, input_name) == 0) - { - Insert(o, name); - ok = true; - break; - } - } - - if (ok == false) - { - // If there is no command to exact match, check whether it matches to a short form command - for (i = 0;i < real_name_list->NumTokens;i++) - { - char *name = real_name_list->Token[i]; - - if (IsOmissionName(input_name, name) || IsNameInRealName(input_name, name)) - { - // A abbreviation is found - Insert(o, name); - ok = true; - } - } - } - - if (ok) - { - // One or more candidate is found - ret = ListToTokenList(o); - } - else - { - ret = NullToken(); - } - - ReleaseList(o); - - return ret; -} - -// Check whether the command specified by the user is a abbreviation of existing commands -bool IsOmissionName(char *input_name, char *real_name) -{ - char oname[128]; - // Validate arguments - if (input_name == NULL || real_name == NULL) - { - return false; - } - - if (IsAllUpperStr(real_name)) - { - // Command of all capital letters do not take abbreviations - return false; - } - - GetOmissionName(oname, sizeof(oname), real_name); - - if (IsEmptyStr(oname)) - { - return false; - } - - if (StartWith(oname, input_name)) - { - // Example: The oname of AccountSecureCertSet is "ascs". - // But if the user enters "asc", returns true - return true; - } - - if (StartWith(input_name, oname)) - { - // Example: When two commands AccountCreate and AccountConnect exist, - // if the user enter "aconnect" , only AccountConnect is true - - if (EndWith(real_name, &input_name[StrLen(oname)])) - { - return true; - } - } - - return false; -} - -// Get the short name of the specified command -void GetOmissionName(char *dst, UINT size, char *src) -{ - UINT i, len; - // Validate arguments - if (dst == NULL || src == NULL) - { - return; - } - - StrCpy(dst, size, ""); - len = StrLen(src); - - for (i = 0;i < len;i++) - { - char c = src[i]; - - if ((c >= '0' && c <= '9') || - (c >= 'A' && c <= 'Z')) - { - char tmp[2]; - tmp[0] = c; - tmp[1] = 0; - - StrCat(dst, size, tmp); - } - } -} - -// Check whether the command specified by the user matches the existing commands -bool IsNameInRealName(char *input_name, char *real_name) -{ - // Validate arguments - if (input_name == NULL || real_name == NULL) - { - return false; - } - - if (StartWith(real_name, input_name)) - { - return true; - } - - return false; -} - -// Parse the command list -LIST *ParseCommandList(CONSOLE *c, char *cmd_name, wchar_t *command, PARAM param[], UINT num_param) -{ - UINT i; - LIST *o; - bool ok = true; - TOKEN_LIST *param_list; - TOKEN_LIST *real_name_list; - bool help_mode = false; - wchar_t *tmp; - // Validate arguments - if (c == NULL || command == NULL || (num_param >= 1 && param == NULL) || cmd_name == NULL) - { - return NULL; - } - - // Initialization - for (i = 0;i < num_param;i++) - { - if (IsEmptyStr(param[i].Name) == false) - { - if (param[i].Name[0] == '[') - { - param[i].Tmp = ""; - } - else - { - param[i].Tmp = NULL; - } - } - else - { - param[i].Tmp = ""; - } - } - - real_name_list = ZeroMalloc(sizeof(TOKEN_LIST)); - real_name_list->NumTokens = num_param; - real_name_list->Token = ZeroMalloc(sizeof(char *) * real_name_list->NumTokens); - - for (i = 0;i < real_name_list->NumTokens;i++) - { - real_name_list->Token[i] = CopyStr(param[i].Name); - } - - // Generate a list of parameter name specified by the user - param_list = GetCommandNameList(command); - - for (i = 0;i < param_list->NumTokens;i++) - { - char *s = param_list->Token[i]; - - if (StrCmpi(s, "help") == 0 || StrCmpi(s, "?") == 0) - { - help_mode = true; - break; - } - } - - tmp = ParseCommand(command, L""); - if (tmp != NULL) - { - if (UniStrCmpi(tmp, L"?") == 0) - { - help_mode = true; - } - Free(tmp); - } - - if (help_mode) - { - // Show the help - PrintCmdHelp(c, cmd_name, real_name_list); - FreeToken(param_list); - FreeToken(real_name_list); - return NULL; - } - - for (i = 0;i < param_list->NumTokens;i++) - { - // Get the corresponding commands for all parameter names which is specified by the user - TOKEN_LIST *candidate = GetRealnameCandidate(param_list->Token[i], real_name_list); - - if (candidate != NULL && candidate->NumTokens >= 1) - { - if (candidate->NumTokens >= 2) - { - wchar_t tmp[MAX_SIZE]; - - // There is more than one candidate - UniFormat(tmp, sizeof(tmp), _UU("CON_AMBIGUOUS_PARAM"), param_list->Token[i]); - c->Write(c, tmp); - UniFormat(tmp, sizeof(tmp), _UU("CON_AMBIGUOUS_PARAM_1"), cmd_name); - c->Write(c, tmp); - - PrintCandidateHelp(c, cmd_name, candidate, 1); - - c->Write(c, _UU("CON_AMBIGUOUS_PARAM_2")); - - ok = false; - } - else - { - UINT j; - char *real_name = candidate->Token[0]; - - // There is only one candidate - for (j = 0;j < num_param;j++) - { - if (StrCmpi(param[j].Name, real_name) == 0) - { - param[j].Tmp = param_list->Token[i]; - } - } - } - } - else - { - wchar_t tmp[MAX_SIZE]; - - // No candidate - UniFormat(tmp, sizeof(tmp), _UU("CON_INVALID_PARAM"), param_list->Token[i], cmd_name, cmd_name); - c->Write(c, tmp); - - ok = false; - } - - FreeToken(candidate); - } - - if (ok == false) - { - FreeToken(param_list); - FreeToken(real_name_list); - - return NULL; - } - - // Creating a list - o = NewParamValueList(); - - // Read all the parameters of the specified name in the parameter list - for (i = 0;i < num_param;i++) - { - bool prompt_input_value = false; - PARAM *p = ¶m[i]; - - if (p->Tmp != NULL || p->PromptProc != NULL) - { - wchar_t *name = CopyStrToUni(p->Name); - wchar_t *tmp; - wchar_t *str; - - if (p->Tmp != NULL) - { - tmp = CopyStrToUni(p->Tmp); - } - else - { - tmp = CopyStrToUni(p->Name); - } - - str = ParseCommand(command, tmp); - Free(tmp); - if (str != NULL) - { - wchar_t *unistr; - bool ret; -EVAL_VALUE: - // Reading succeeded - unistr = str; - - if (p->EvalProc != NULL) - { - // Evaluate the value if EvalProc is specified - ret = p->EvalProc(c, unistr, p->EvalProcParam); - } - else - { - // Accept any value if EvalProc is not specified - ret = true; - } - - if (ret == false) - { - // The specified value is invalid - if (p->PromptProc == NULL) - { - // Cancel - ok = false; - Free(name); - Free(str); - break; - } - else if (c->ProgrammingMode) - { - // In the programming mode, return the error immediately. - ok = false; - Free(name); - Free(str); - break; - } - else - { - // Request to re-enter - Free(str); - str = NULL; - goto SHOW_PROMPT; - } - } - else - { - PARAM_VALUE *v; - // Finished loading, add it to the list - v = ZeroMalloc(sizeof(PARAM_VALUE)); - v->Name = CopyStr(p->Name); - v->StrValue = CopyUniToStr(str); - v->UniStrValue = CopyUniStr(str); - v->IntValue = ToInt(v->StrValue); - Insert(o, v); - } - } - else - { - // Failed to read. The parameter is not specified - if (p->PromptProc != NULL) - { - wchar_t *tmp; -SHOW_PROMPT: - // Prompt because it is a mandatory parameter - tmp = NULL; - if (c->ProgrammingMode == false) - { - tmp = p->PromptProc(c, p->PromptProcParam); - } - if (tmp == NULL) - { - // User canceled - ok = false; - Free(str); - Free(name); - break; - } - else - { - // Entered by the user - c->Write(c, L""); - str = tmp; - prompt_input_value = true; - goto EVAL_VALUE; - } - } - } - - Free(str); - Free(name); - } - } - - FreeToken(param_list); - FreeToken(real_name_list); - - if (ok) - { - return o; - } - else - { - FreeParamValueList(o); - return NULL; - } -} - -// Acquisition of [Yes] or [No] -bool GetParamYes(LIST *o, char *name) -{ - char *s; - char tmp[64]; - // Validate arguments - if (o == NULL) - { - return false; - } - - s = GetParamStr(o, name); - if (s == NULL) - { - return false; - } - - StrCpy(tmp, sizeof(tmp), s); - Trim(tmp); - - if (StartWith(tmp, "y")) - { - return true; - } - - if (StartWith(tmp, "t")) - { - return true; - } - - if (ToInt(tmp) != 0) - { - return true; - } - - return false; -} - -// Acquisition of parameter value Int -UINT GetParamInt(LIST *o, char *name) -{ - PARAM_VALUE *v; - // Validate arguments - if (o == NULL) - { - return 0; - } - - v = FindParamValue(o, name); - if (v == NULL) - { - return 0; - } - else - { - return v->IntValue; - } -} - -// Acquisition of parameter value Unicode string -wchar_t *GetParamUniStr(LIST *o, char *name) -{ - PARAM_VALUE *v; - // Validate arguments - if (o == NULL) - { - return NULL; - } - - v = FindParamValue(o, name); - if (v == NULL) - { - return NULL; - } - else - { - return v->UniStrValue; - } -} - -// Acquisition of the parameter value string -char *GetParamStr(LIST *o, char *name) -{ - PARAM_VALUE *v; - // Validate arguments - if (o == NULL) - { - return NULL; - } - - v = FindParamValue(o, name); - if (v == NULL) - { - return NULL; - } - else - { - return v->StrValue; - } -} - -// Acquisition of parameter value -PARAM_VALUE *FindParamValue(LIST *o, char *name) -{ - PARAM_VALUE t, *ret; - // Validate arguments - if (o == NULL) - { - return NULL; - } - if (name == NULL) - { - name = ""; - } - - Zero(&t, sizeof(t)); - t.Name = name; - - ret = Search(o, &t); - - return ret; -} - -// Release of the parameter value list -void FreeParamValueList(LIST *o) -{ - UINT i; - // Validate arguments - if (o == NULL) - { - return; - } - - for (i = 0;i < LIST_NUM(o);i++) - { - PARAM_VALUE *v = LIST_DATA(o, i); - - Free(v->StrValue); - Free(v->UniStrValue); - Free(v->Name); - Free(v); - } - - ReleaseList(o); -} - -// Parameter value list sort function -int CmpParamValue(void *p1, void *p2) -{ - PARAM_VALUE *v1, *v2; - if (p1 == NULL || p2 == NULL) - { - return 0; - } - v1 = *(PARAM_VALUE **)p1; - v2 = *(PARAM_VALUE **)p2; - if (v1 == NULL || v2 == NULL) - { - return 0; - } - - if (IsEmptyStr(v1->Name) && IsEmptyStr(v2->Name)) - { - return 0; - } - return StrCmpi(v1->Name, v2->Name); -} - -// Generation of the parameter value list -LIST *NewParamValueList() -{ - return NewListFast(CmpParamValue); -} - -// Get the list of parameter names that were included in the entered command -TOKEN_LIST *GetCommandNameList(wchar_t *str) -{ - TOKEN_LIST *t; - // Validate arguments - if (str == NULL) - { - return NullToken(); - } - - Free(ParseCommandEx(str, L"dummy_str", &t)); - - return t; -} - -// Get the commands that start with the specified name -wchar_t *ParseCommand(wchar_t *str, wchar_t *name) -{ - return ParseCommandEx(str, name, NULL); -} -wchar_t *ParseCommandEx(wchar_t *str, wchar_t *name, TOKEN_LIST **param_list) -{ - UNI_TOKEN_LIST *t; - UINT i; - wchar_t *tmp; - wchar_t *ret = NULL; - LIST *o; - // Validate arguments - if (str == NULL) - { - return NULL; - } - if (name != NULL && UniIsEmptyStr(name)) - { - name = NULL; - } - - o = NULL; - if (param_list != NULL) - { - o = NewListFast(CompareStr); - } - - tmp = CopyUniStr(str); - UniTrim(tmp); - - i = UniSearchStrEx(tmp, L"/CMD ", 0, false); - - if (i != INFINITE && i >= 1 && tmp[i - 1] == L'/') - { - i = INFINITE; - } - if (i == INFINITE) - { - i = UniSearchStrEx(tmp, L"/CMD\t", 0, false); - if (i != INFINITE && i >= 1 && tmp[i - 1] == L'/') - { - i = INFINITE; - } - } - if (i == INFINITE) - { - i = UniSearchStrEx(tmp, L"/CMD:", 0, false); - if (i != INFINITE && i >= 1 && tmp[i - 1] == L'/') - { - i = INFINITE; - } - } - if (i == INFINITE) - { - i = UniSearchStrEx(tmp, L"/CMD=", 0, false); - if (i != INFINITE && i >= 1 && tmp[i - 1] == L'/') - { - i = INFINITE; - } - } - if (i == INFINITE) - { - i = UniSearchStrEx(tmp, L"-CMD ", 0, false); - if (i != INFINITE && i >= 1 && tmp[i - 1] == L'-') - { - i = INFINITE; - } - } - if (i == INFINITE) - { - i = UniSearchStrEx(tmp, L"-CMD\t", 0, false); - if (i != INFINITE && i >= 1 && tmp[i - 1] == L'-') - { - i = INFINITE; - } - } - if (i == INFINITE) - { - i = UniSearchStrEx(tmp, L"-CMD:", 0, false); - if (i != INFINITE && i >= 1 && tmp[i - 1] == L'-') - { - i = INFINITE; - } - } - if (i == INFINITE) - { - i = UniSearchStrEx(tmp, L"-CMD=", 0, false); - if (i != INFINITE && i >= 1 && tmp[i - 1] == L'-') - { - i = INFINITE; - } - } - - if (i != INFINITE) - { - char *s = CopyStr("CMD"); - if (InsertStr(o, s) == false) - { - Free(s); - } - if (UniStrCmpi(name, L"CMD") == 0) - { - ret = CopyUniStr(&str[i + 5]); - UniTrim(ret); - } - else - { - tmp[i] = 0; - } - } - - if (ret == NULL) - { - t = UniParseCmdLine(tmp); - - if (t != NULL) - { - for (i = 0;i < t->NumTokens;i++) - { - wchar_t *token = t->Token[i]; - - if ((token[0] == L'-' && token[1] != L'-') || - (UniStrCmpi(token, L"--help") == 0) || - (token[0] == L'/' && token[1] != L'/')) - { - UINT i; - - // Named parameter - // Examine whether there is a colon character - - if (UniStrCmpi(token, L"--help") == 0) - { - token++; - } - - i = UniSearchStrEx(token, L":", 0, false); - if (i == INFINITE) - { - i = UniSearchStrEx(token, L"=", 0, false); - } - if (i != INFINITE) - { - wchar_t *tmp; - char *a; - - // There is a colon character - tmp = CopyUniStr(token); - tmp[i] = 0; - - a = CopyUniToStr(&tmp[1]); - if (InsertStr(o, a) == false) - { - Free(a); - } - - if (UniStrCmpi(name, &tmp[1]) == 0) - { - if (ret == NULL) - { - // Content - ret = UniCopyStr(&token[i + 1]); - } - } - - Free(tmp); - } - else - { - // There is no colon character - char *a; - - a = CopyUniToStr(&token[1]); - if (InsertStr(o, a) == false) - { - Free(a); - } - - if (UniStrCmpi(name, &token[1]) == 0) - { - if (ret == NULL) - { - // Empty character - ret = UniCopyStr(L""); - } - } - } - } - else - { - // Nameless argument - if (name == NULL) - { - if (ret == NULL) - { - if (token[0] == L'-' && token[1] == L'-') - { - ret = UniCopyStr(&token[1]); - } - else if (token[0] == L'/' && token[1] == L'/') - { - ret = UniCopyStr(&token[1]); - } - else - { - ret = UniCopyStr(token); - } - } - } - } - } - - UniFreeToken(t); - } - } - - Free(tmp); - - if (o != NULL) - { - TOKEN_LIST *t = ZeroMalloc(sizeof(TOKEN_LIST)); - UINT i; - - t->NumTokens = LIST_NUM(o); - t->Token = ZeroMalloc(sizeof(char *) * t->NumTokens); - - for (i = 0;i < t->NumTokens;i++) - { - t->Token[i] = LIST_DATA(o, i); - } - - ReleaseList(o); - - *param_list = t; - } - - if (UniStrCmpi(ret, L"none") == 0 || UniStrCmpi(ret, L"null") == 0) - { - // Null and none are reserved words - ret[0] = 0; - } - - return ret; -} -char *ParseCommandA(wchar_t *str, char *name) -{ - wchar_t *tmp1, *tmp2; - char *ret; - // Validate arguments - if (str == NULL) - { - return NULL; - } - - if (name != NULL) - { - tmp1 = CopyStrToUni(name); - } - else - { - tmp1 = NULL; - } - - tmp2 = ParseCommand(str, tmp1); - - if (tmp2 == NULL) - { - ret = NULL; - } - else - { - ret = CopyUniToStr(tmp2); - Free(tmp2); - } - - Free(tmp1); - - return ret; -} - -// Password prompt -bool PasswordPrompt(char *password, UINT size) -{ - UINT wp; - bool escape = false; - void *console; - // Validate arguments - if (password == NULL || size <= 1) - { - if (size >= 1) - { - password[0] = 0; - } - return false; - } - - wp = 0; - - Zero(password, size); - - console = SetConsoleRaw(); - - while (true) - { - int c; - -#ifdef OS_WIN32 - c = getch(); -#else // OS_WIN32 - c = getc(stdin); -#endif // OS_WIN32 - - if (c >= 0x20 && c <= 0x7E) - { - // Character - if ((wp + 1) < size) - { - password[wp++] = (char)c; - putc('*', stdout); - } - } - else if (c == 0x03) - { - // Break - exit(0); - } - else if (c == 0x04 || c == 0x1a || c == 0x0D || c==0x0A) - { - // Exit - if (c == 0x04 || c == 0x1a) - { - escape = true; - } - break; - } - else if (c == 0xE0) - { - // Read one more character -#ifdef OS_WIN32 - c = getch(); -#else // OS_WIN32 - c = getc(stdin); -#endif // OS_WIN32 - if (c == 0x4B || c == 0x53) - { - // Backspace - goto BACKSPACE; - } - } - else if (c == 0x08) - { -BACKSPACE: - // Backspace - if (wp >= 1) - { - password[--wp] = 0; - putc(0x08, stdout); - putc(' ', stdout); - putc(0x08, stdout); - } - } - } - Print("\n"); - - RestoreConsole(console); - - return (escape ? false : true); -} - -// Show the prompt -wchar_t *Prompt(wchar_t *prompt_str) -{ - wchar_t *ret = NULL; - wchar_t *tmp = NULL; - // Validate arguments - if (prompt_str == NULL) - { - prompt_str = L""; - } - -#ifdef OS_WIN32 - UniPrint(L"%s", prompt_str); - tmp = Malloc(MAX_PROMPT_STRSIZE); - if (fgetws(tmp, MAX_PROMPT_STRSIZE - 1, stdin) != NULL) - { - bool escape = false; - UINT i, len; - - len = UniStrLen(tmp); - for (i = 0;i < len;i++) - { - if (tmp[i] == 0x04 || tmp[i] == 0x1A) - { - escape = true; - break; - } - } - - if (escape == false) - { - UniTrimCrlf(tmp); - - ret = UniCopyStr(tmp); - } - } - Free(tmp); -#else // OS_WIN32 - { - char *prompt = CopyUniToStr(prompt_str); - char *s = readline(prompt); - Free(prompt); - - if (s != NULL) - { - TrimCrlf(s); - Trim(s); - - if (IsEmptyStr(s) == false) - { - add_history(s); - } - - ret = CopyStrToUni(s); - - free(s); - } - } -#endif // OS_WIN32 - - if (ret == NULL) - { - Print("\n"); - } - - return ret; -} -char *PromptA(wchar_t *prompt_str) -{ - wchar_t *str = Prompt(prompt_str); - - if (str == NULL) - { - return NULL; - } - else - { - char *ret = CopyUniToStr(str); - - Free(str); - return ret; - } -} - -// Set the console to raw mode -void *SetConsoleRaw() -{ -#ifdef OS_UNIX - struct termios t, *ret; - - Zero(&t, sizeof(t)); - if (tcgetattr(0, &t) != 0) - { - // Failed - return NULL; - } - - // Copy the current settings - ret = Clone(&t, sizeof(t)); - - // Change the settings - t.c_lflag &= (~ICANON); - t.c_lflag &= (~ECHO); - t.c_cc[VTIME] = 0; - t.c_cc[VMIN] = 1; - tcsetattr(0, TCSANOW, &t); - - return ret; -#else // OS_UNIX - return Malloc(0); -#endif // OS_UNIX -} - -// Restore the mode of the console -void RestoreConsole(void *p) -{ -#ifdef OS_UNIX - struct termios *t; - // Validate arguments - if (p == NULL) - { - return; - } - - t = (struct termios *)p; - - // Restore the settings - tcsetattr(0, TCSANOW, t); - - Free(t); -#else // OS_UNIX - if (p != NULL) - { - Free(p); - } -#endif // OS_UNIX -} - -//////////////////////////// -// Local console function - -// Creating a new local console -CONSOLE *NewLocalConsole(wchar_t *infile, wchar_t *outfile) -{ - IO *in_io = NULL, *out_io = NULL; - CONSOLE *c = ZeroMalloc(sizeof(CONSOLE)); - LOCAL_CONSOLE_PARAM *p; - UINT old_size = 0; - -#ifdef OS_WIN32 - if (MsGetConsoleWidth() == 80) - { - //old_size = MsSetConsoleWidth(WIN32_DEFAULT_CONSOLE_WIDTH); - } -#endif // OS_WIN32 - - c->ConsoleType = CONSOLE_LOCAL; - c->Free = ConsoleLocalFree; - c->ReadLine = ConsoleLocalReadLine; - c->ReadPassword = ConsoleLocalReadPassword; - c->Write = ConsoleLocalWrite; - c->GetWidth = ConsoleLocalGetWidth; - c->OutputLock = NewLock(); - - if (UniIsEmptyStr(infile) == false) - { - // Input file is specified - in_io = FileOpenW(infile, false); - if (in_io == NULL) - { - wchar_t tmp[MAX_SIZE]; - - UniFormat(tmp, sizeof(tmp), _UU("CON_INFILE_ERROR"), infile); - c->Write(c, tmp); - Free(c); - return NULL; - } - else - { - wchar_t tmp[MAX_SIZE]; - - UniFormat(tmp, sizeof(tmp), _UU("CON_INFILE_START"), infile); - c->Write(c, tmp); - } - } - - if (UniIsEmptyStr(outfile) == false) - { - // Output file is specified - out_io = FileCreateW(outfile); - if (out_io == NULL) - { - wchar_t tmp[MAX_SIZE]; - - UniFormat(tmp, sizeof(tmp), _UU("CON_OUTFILE_ERROR"), outfile); - c->Write(c, tmp); - Free(c); - - if (in_io != NULL) - { - FileClose(in_io); - } - return NULL; - } - else - { - wchar_t tmp[MAX_SIZE]; - - UniFormat(tmp, sizeof(tmp), _UU("CON_OUTFILE_START"), outfile); - c->Write(c, tmp); - } - } - - p = ZeroMalloc(sizeof(LOCAL_CONSOLE_PARAM)); - c->Param = p; - - p->InFile = in_io; - p->OutFile = out_io; - p->Win32_OldConsoleWidth = old_size; - - if (in_io != NULL) - { - UINT size; - void *buf; - - size = FileSize(in_io); - buf = ZeroMalloc(size + 1); - FileRead(in_io, buf, size); - - p->InBuf = NewBuf(); - WriteBuf(p->InBuf, buf, size); - Free(buf); - - p->InBuf->Current = 0; - } - - return c; -} - -// Release Console -void ConsoleLocalFree(CONSOLE *c) -{ - LOCAL_CONSOLE_PARAM *p; - // Validate arguments - if (c == NULL) - { - return; - } - - p = (LOCAL_CONSOLE_PARAM *)c->Param; - -#ifdef OS_WIN32 - if (p->Win32_OldConsoleWidth != 0) - { - MsSetConsoleWidth(p->Win32_OldConsoleWidth); - } -#endif // OS_WIN32 - - if (p != NULL) - { - if (p->InFile != NULL) - { - FileClose(p->InFile); - FreeBuf(p->InBuf); - } - - if (p->OutFile != NULL) - { - FileClose(p->OutFile); - } - - Free(p); - } - - DeleteLock(c->OutputLock); - - // Memory release - Free(c); -} - -// Get the width of the screen -UINT ConsoleLocalGetWidth(CONSOLE *c) -{ - UINT ret = 0; - // Validate arguments - if (c == NULL) - { - return 0; - } - -#ifdef OS_WIN32 - ret = MsGetConsoleWidth(); -#else // OS_WIN32 - { - struct winsize t; - - Zero(&t, sizeof(t)); - - if (ioctl(1, TIOCGWINSZ, &t) == 0) - { - ret = t.ws_col; - } - } -#endif // OS_WIN32 - - return ret; -} - -// Read one line from the console -wchar_t *ConsoleLocalReadLine(CONSOLE *c, wchar_t *prompt, bool nofile) -{ - wchar_t *ret; - LOCAL_CONSOLE_PARAM *p; - // Validate arguments - if (c == NULL) - { - return NULL; - } - p = (LOCAL_CONSOLE_PARAM *)c->Param; - if (prompt == NULL) - { - prompt = L">"; - } - - ConsoleWriteOutFile(c, prompt, false); - - if (nofile == false && p->InBuf != NULL) - { - // Read the next line from the file - ret = ConsoleReadNextFromInFile(c); - - if (ret != NULL) - { - // Display the pseudo prompt - UniPrint(L"%s", prompt); - - // Display on the screen - UniPrint(L"%s\n", ret); - } - } - else - { - // Read the following line from the console - ret = Prompt(prompt); - } - - if (ret != NULL) - { - ConsoleWriteOutFile(c, ret, true); - } - else - { - ConsoleWriteOutFile(c, _UU("CON_USER_CANCEL"), true); - } - - return ret; -} - -// Read the password from the console -char *ConsoleLocalReadPassword(CONSOLE *c, wchar_t *prompt) -{ - char tmp[64]; - // Validate arguments - if (c == NULL) - { - return NULL; - } - if (prompt == NULL) - { - prompt = L"Password>"; - } - - UniPrint(L"%s", prompt); - ConsoleWriteOutFile(c, prompt, false); - - if (PasswordPrompt(tmp, sizeof(tmp))) - { - ConsoleWriteOutFile(c, L"********", true); - return CopyStr(tmp); - } - else - { - ConsoleWriteOutFile(c, _UU("CON_USER_CANCEL"), true); - return NULL; - } -} - -// Display a string to the console -bool ConsoleLocalWrite(CONSOLE *c, wchar_t *str) -{ - // Validate arguments - if (c == NULL || str == NULL) - { - return false; - } - - UniPrint(L"%s%s", str, (UniEndWith(str, L"\n") ? L"" : L"\n")); - - ConsoleWriteOutFile(c, str, true); - - return true; -} - -// Read the next line from the input file -wchar_t *ConsoleReadNextFromInFile(CONSOLE *c) -{ - LOCAL_CONSOLE_PARAM *p; - char *str; - // Validate arguments - if (c == NULL) - { - return NULL; - } - - p = (LOCAL_CONSOLE_PARAM *)c->Param; - - if (p->InBuf == NULL) - { - return NULL; - } - - while (true) - { - str = CfgReadNextLine(p->InBuf); - - if (str == NULL) - { - return NULL; - } - - Trim(str); - - if (IsEmptyStr(str) == false) - { - UINT size; - wchar_t *ret; - - size = CalcUtf8ToUni((BYTE *)str, StrLen(str)); - ret = ZeroMalloc(size + 32); - Utf8ToUni(ret, size, (BYTE *)str, StrLen(str)); - - Free(str); - - return ret; - } - - Free(str); - } -} - -// Write when the output file is specified -void ConsoleWriteOutFile(CONSOLE *c, wchar_t *str, bool add_last_crlf) -{ - LOCAL_CONSOLE_PARAM *p; - // Validate arguments - if (c == NULL || str == NULL) - { - return; - } - - p = (LOCAL_CONSOLE_PARAM *)c->Param; - - if (p != NULL && p->OutFile != NULL) - { - wchar_t *tmp = UniNormalizeCrlf(str); - UINT utf8_size; - UCHAR *utf8; - - utf8_size = CalcUniToUtf8(tmp); - utf8 = ZeroMalloc(utf8_size + 1); - UniToUtf8(utf8, utf8_size + 1, tmp); - - FileWrite(p->OutFile, utf8, utf8_size); - - if (UniEndWith(str, L"\n") == false && add_last_crlf) - { - char *crlf = "\r\n"; - FileWrite(p->OutFile, "\r\n", StrLen(crlf)); - } - - Free(utf8); - Free(tmp); - } - -} - +// SoftEther VPN Source Code - Developer Edition Master Branch +// Cedar Communication Module + + +// Console.c +// Console Service + +#include "CedarPch.h" + + +// Display the help for the command +void PrintCmdHelp(CONSOLE *c, char *cmd_name, TOKEN_LIST *param_list) +{ + wchar_t tmp[MAX_SIZE]; + wchar_t *buf; + UINT buf_size; + wchar_t *description, *args, *help; + UNI_TOKEN_LIST *t; + UINT width; + UINT i; + char *space; + // Validate arguments + if (c == NULL || cmd_name == NULL || param_list == NULL) + { + return; + } + + width = GetConsoleWidth(c) - 2; + + buf_size = sizeof(wchar_t) * (width + 32); + buf = Malloc(buf_size); + + GetCommandHelpStr(cmd_name, &description, &args, &help); + + space = MakeCharArray(' ', 2); + + // Title + UniFormat(tmp, sizeof(tmp), _UU("CMD_HELP_TITLE"), cmd_name); + c->Write(c, tmp); + c->Write(c, L""); + + // Purpose + c->Write(c, _UU("CMD_HELP_DESCRIPTION")); + t = SeparateStringByWidth(description, width - 2); + for (i = 0;i < t->NumTokens;i++) + { + UniFormat(buf, buf_size, L"%S%s", space, t->Token[i]); + c->Write(c, buf); + } + UniFreeToken(t); + c->Write(c, L""); + + // Description + c->Write(c, _UU("CMD_HELP_HELP")); + t = SeparateStringByWidth(help, width - 2); + for (i = 0;i < t->NumTokens;i++) + { + UniFormat(buf, buf_size, L"%S%s", space, t->Token[i]); + c->Write(c, buf); + } + UniFreeToken(t); + c->Write(c, L""); + + // Usage + c->Write(c, _UU("CMD_HELP_USAGE")); + t = SeparateStringByWidth(args, width - 2); + for (i = 0;i < t->NumTokens;i++) + { + UniFormat(buf, buf_size, L"%S%s", space, t->Token[i]); + c->Write(c, buf); + } + UniFreeToken(t); + + // Arguments + if (param_list->NumTokens >= 1) + { + c->Write(c, L""); + c->Write(c, _UU("CMD_HELP_ARGS")); + PrintCandidateHelp(c, cmd_name, param_list, 2); + } + + Free(space); + + Free(buf); +} + +// Evaluate whether it is SafeStr +bool CmdEvalSafe(CONSOLE *c, wchar_t *str, void *param) +{ + wchar_t *p = (param == NULL) ? _UU("CMD_EVAL_SAFE") : (wchar_t *)param; + + if (IsSafeUniStr(str)) + { + return true; + } + + c->Write(c, p); + + return false; +} + +// String input prompt +wchar_t *CmdPrompt(CONSOLE *c, void *param) +{ + wchar_t *p = (param == NULL) ? _UU("CMD_PROMPT") : (wchar_t *)param; + + return c->ReadLine(c, p, true); +} + +// Evaluation whether the specified file exists +bool CmdEvalIsFile(CONSOLE *c, wchar_t *str, void *param) +{ + wchar_t tmp[MAX_PATH]; + // Validate arguments + if (c == NULL || str == NULL) + { + return false; + } + + UniStrCpy(tmp, sizeof(tmp), str); + + if (IsEmptyUniStr(tmp)) + { + c->Write(c, _UU("CMD_FILE_NAME_EMPTY")); + return false; + } + + if (IsFileExistsW(tmp) == false) + { + wchar_t tmp2[MAX_SIZE]; + + UniFormat(tmp2, sizeof(tmp2), _UU("CMD_FILE_NOT_FOUND"), tmp); + c->Write(c, tmp2); + + return false; + } + + return true; +} + +// Evaluation of integer +bool CmdEvalInt1(CONSOLE *c, wchar_t *str, void *param) +{ + wchar_t *p = (param == NULL) ? _UU("CMD_EVAL_INT") : (wchar_t *)param; + + if (UniToInt(str) == 0) + { + c->Write(c, p); + + return false; + } + + return true; +} + +// Evaluation of the parameters that a blank cannot be specified to +bool CmdEvalNotEmpty(CONSOLE *c, wchar_t *str, void *param) +{ + wchar_t *p = (param == NULL) ? _UU("CMD_EVAL_NOT_EMPTY") : (wchar_t *)param; + + if (UniIsEmptyStr(str) == false) + { + return true; + } + + c->Write(c, p); + + return false; +} + +// Evaluation function for minimum / maximum value of the parameter +bool CmdEvalMinMax(CONSOLE *c, wchar_t *str, void *param) +{ + CMD_EVAL_MIN_MAX *e; + wchar_t *tag; + UINT v; + // Validate arguments + if (param == NULL) + { + return false; + } + + e = (CMD_EVAL_MIN_MAX *)param; + + if (e->StrName == NULL) + { + tag = _UU("CMD_EVAL_MIN_MAX"); + } + else + { + tag = _UU(e->StrName); + } + + v = UniToInt(str); + + if (v >= e->MinValue && v <= e->MaxValue) + { + return true; + } + else + { + wchar_t tmp[MAX_SIZE]; + + UniFormat(tmp, sizeof(tmp), tag, e->MinValue, e->MaxValue); + c->Write(c, tmp); + + return false; + } +} + +// Get the help string of command +void GetCommandHelpStr(char *command_name, wchar_t **description, wchar_t **args, wchar_t **help) +{ + char tmp1[128], tmp2[128], tmp3[128]; + + Format(tmp1, sizeof(tmp1), "CMD_%s", command_name); + Format(tmp2, sizeof(tmp2), "CMD_%s_ARGS", command_name); + Format(tmp3, sizeof(tmp3), "CMD_%s_HELP", command_name); + + if (description != NULL) + { + *description = _UU(tmp1); + if (UniIsEmptyStr(*description)) + { + *description = _UU("CMD_UNKNOWM"); + } + } + + if (args != NULL) + { + *args = _UU(tmp2); + if (UniIsEmptyStr(*args)) + { + *args = _UU("CMD_UNKNOWN_ARGS"); + } + } + + if (help != NULL) + { + *help = _UU(tmp3); + if (UniIsEmptyStr(*help)) + { + *help = _UU("CMD_UNKNOWN_HELP"); + } + } +} + +// Get the help string for parameter +void GetCommandParamHelpStr(char *command_name, char *param_name, wchar_t **description) +{ + char tmp[160]; + if (description == NULL) + { + return; + } + + Format(tmp, sizeof(tmp), "CMD_%s_%s", command_name, param_name); + + *description = _UU(tmp); + + if (UniIsEmptyStr(*description)) + { + *description = _UU("CMD_UNKNOWN_PARAM"); + } +} + +// String comparison function +int CompareCandidateStr(void *p1, void *p2) +{ + char *s1, *s2; + if (p1 == NULL || p2 == NULL) + { + return 0; + } + s1 = *(char **)p1; + s2 = *(char **)p2; + if (s1 == NULL || s2 == NULL) + { + return 0; + } + + if (s1[0] == '[' && s2[0] != '[') + { + return -1; + } + else if (s2[0] == '[' && s1[0] != '[') + { + return 1; + } + + return StrCmp(s1, s2); +} + +// Display the help of the candidate list +void PrintCandidateHelp(CONSOLE *c, char *cmd_name, TOKEN_LIST *candidate_list, UINT left_space) +{ + UINT console_width; + UINT max_keyword_width; + LIST *o; + UINT i; + wchar_t *tmpbuf; + UINT tmpbuf_size; + char *left_space_array; + char *max_space_array; + // Validate arguments + if (c == NULL || candidate_list == NULL) + { + return; + } + + // Get the width of the screen + console_width = GetConsoleWidth(c) - 1; + + tmpbuf_size = sizeof(wchar_t) * (console_width + 32); + tmpbuf = Malloc(tmpbuf_size); + + left_space_array = MakeCharArray(' ', left_space); + + // Sort and enlist the command name + // no need to sort the parameter name + o = NewListFast(cmd_name == NULL ? CompareCandidateStr : NULL); + + max_keyword_width = 0; + + for (i = 0;i < candidate_list->NumTokens;i++) + { + UINT keyword_width; + + // Get the width of each keyword + Insert(o, candidate_list->Token[i]); + + keyword_width = StrWidth(candidate_list->Token[i]); + if (cmd_name != NULL) + { + if (candidate_list->Token[i][0] != '[') + { + keyword_width += 1; + } + else + { + keyword_width -= 2; + } + } + + max_keyword_width = MAX(max_keyword_width, keyword_width); + } + + max_space_array = MakeCharArray(' ', max_keyword_width); + + // Display the candidate + for (i = 0;i < LIST_NUM(o);i++) + { + char tmp[128]; + char *name = LIST_DATA(o, i); + UNI_TOKEN_LIST *t; + wchar_t *help; + UINT j; + UINT keyword_start_width = left_space; + UINT descript_start_width = left_space + max_keyword_width + 1; + UINT descript_width; + char *space; + + if (console_width >= (descript_start_width + 5)) + { + descript_width = console_width - descript_start_width - 3; + } + else + { + descript_width = 2; + } + + // Generate the name + if (cmd_name != NULL && name[0] != '[') + { + // Prepend a "/" in the case of a parameter + Format(tmp, sizeof(tmp), "/%s", name); + } + else + { + // Use the characters as it is in the case of a command name + if (cmd_name == NULL) + { + StrCpy(tmp, sizeof(tmp), name); + } + else + { + StrCpy(tmp, sizeof(tmp), name + 1); + if (StrLen(tmp) >= 1) + { + tmp[StrLen(tmp) - 1] = 0; + } + } + } + + // Get the help string + if (cmd_name == NULL) + { + GetCommandHelpStr(name, &help, NULL, NULL); + } + else + { + GetCommandParamHelpStr(cmd_name, name, &help); + } + + space = MakeCharArray(' ', max_keyword_width - StrWidth(name) - (cmd_name == NULL ? 0 : (name[0] != '[' ? 1 : -2))); + + t = SeparateStringByWidth(help, descript_width); + + for (j = 0;j < t->NumTokens;j++) + { + if (j == 0) + { + UniFormat(tmpbuf, tmpbuf_size, L"%S%S%S - %s", + left_space_array, tmp, space, t->Token[j]); + } + else + { + UniFormat(tmpbuf, tmpbuf_size, L"%S%S %s", + left_space_array, max_space_array, t->Token[j]); + } + + c->Write(c, tmpbuf); + } + + Free(space); + + UniFreeToken(t); + } + + ReleaseList(o); + + Free(max_space_array); + Free(tmpbuf); + Free(left_space_array); +} + +// Acquisition whether word characters +bool IsWordChar(wchar_t c) +{ + if (c >= L'a' && c <= 'z') + { + return true; + } + if (c >= L'A' && c <= 'Z') + { + return true; + } + if (c >= L'0' && c <= '9') + { + return true; + } + if (c == L'_') + { + return true; + } + if (c == L'.') + { + return true; + } + if (c == L'\"') + { + return true; + } + if (c == L'\'') + { + return true; + } + if (c == L',') + { + return true; + } + if (c == L')') + { + return true; + } + if (c == L']') + { + return true; + } + + return false; +} + +// Get the character width of the word that comes next +UINT GetNextWordWidth(wchar_t *str) +{ + UINT i; + UINT ret; + // Validate arguments + if (str == NULL) + { + return 0; + } + + ret = 0; + + for (i = 0;;i++) + { + wchar_t c = str[i]; + + if (c == 0) + { + break; + } + + if (IsWordChar(c) == false) + { + break; + } + + ret++; + } + + return ret; +} + +// Split a string into specified width +UNI_TOKEN_LIST *SeparateStringByWidth(wchar_t *str, UINT width) +{ + UINT wp; + wchar_t *tmp; + UINT len, i; + LIST *o; + UNI_TOKEN_LIST *ret; + // Validate arguments + if (str == NULL) + { + return UniNullToken(); + } + if (width == 0) + { + width = 1; + } + + o = NewListFast(NULL); + + len = UniStrLen(str); + tmp = ZeroMalloc(sizeof(wchar_t) * (len + 32)); + wp = 0; + + for (i = 0;i < (len + 1);i++) + { + wchar_t c = str[i]; + UINT next_word_width; + UINT remain_width; + + switch (c) + { + case 0: + case L'\r': + case L'\n': + if (c == L'\r') + { + if (str[i + 1] == L'\n') + { + i++; + } + } + + tmp[wp++] = 0; + wp = 0; + + Insert(o, UniCopyStr(tmp)); + break; + + default: + next_word_width = GetNextWordWidth(&str[i]); + remain_width = (width - UniStrWidth(tmp)); + + if ((remain_width >= 1) && (next_word_width > remain_width) && (next_word_width <= width)) + { + tmp[wp++] = 0; + wp = 0; + + Insert(o, UniCopyStr(tmp)); + } + + tmp[wp++] = c; + tmp[wp] = 0; + if (UniStrWidth(tmp) >= width) + { + tmp[wp++] = 0; + wp = 0; + + Insert(o, UniCopyStr(tmp)); + } + break; + } + } + + if (LIST_NUM(o) == 0) + { + Insert(o, CopyUniStr(L"")); + } + + ret = ZeroMalloc(sizeof(UNI_TOKEN_LIST)); + ret->NumTokens = LIST_NUM(o); + ret->Token = ZeroMalloc(sizeof(wchar_t *) * ret->NumTokens); + + for (i = 0;i < LIST_NUM(o);i++) + { + wchar_t *s = LIST_DATA(o, i); + + UniTrimLeft(s); + + ret->Token[i] = s; + } + + ReleaseList(o); + Free(tmp); + + return ret; +} + +// Check whether the specified string means 'help' +bool IsHelpStr(char *str) +{ + // Validate arguments + if (str == NULL) + { + return false; + } + + if (StrCmpi(str, "help") == 0 || StrCmpi(str, "?") == 0 || + StrCmpi(str, "man") == 0 || StrCmpi(str, "/man") == 0 || + StrCmpi(str, "-man") == 0 || StrCmpi(str, "--man") == 0 || + StrCmpi(str, "/help") == 0 || StrCmpi(str, "/?") == 0 || + StrCmpi(str, "-help") == 0 || StrCmpi(str, "-?") == 0 || + StrCmpi(str, "/h") == 0 || StrCmpi(str, "--help") == 0 || + StrCmpi(str, "--?") == 0) + { + return true; + } + + return false; +} + +// Execution of the command +bool DispatchNextCmd(CONSOLE *c, char *prompt, CMD cmd[], UINT num_cmd, void *param) +{ + return DispatchNextCmdEx(c, NULL, prompt, cmd, num_cmd, param); +} +bool DispatchNextCmdEx(CONSOLE *c, wchar_t *exec_command, char *prompt, CMD cmd[], UINT num_cmd, void *param) +{ + wchar_t *str; + wchar_t *tmp; + char *cmd_name; + bool b_exit = false; + wchar_t *cmd_param; + UINT ret = ERR_NO_ERROR; + TOKEN_LIST *t; + TOKEN_LIST *candidate; + bool no_end_crlf = false; + UINT i; + // Validate arguments + if (c == NULL || (num_cmd >= 1 && cmd == NULL)) + { + return false; + } + + if (exec_command == NULL) + { + // Show the prompt +RETRY: + tmp = CopyStrToUni(prompt); + + if (c->ProgrammingMode) + { + wchar_t tmp2[MAX_PATH]; + + UniFormat(tmp2, sizeof(tmp2), L"[PROMPT:%u:%s]\r\n", c->RetCode, tmp); + + Free(tmp); + + tmp = CopyUniStr(tmp2); + } + + str = c->ReadLine(c, tmp, false); + Free(tmp); + + if (str != NULL && IsEmptyUniStr(str)) + { + Free(str); + goto RETRY; + } + } + else + { + wchar_t tmp[MAX_SIZE]; + // Use exec_command + if (UniStartWith(exec_command, L"vpncmd") == false) + { + if (prompt != NULL) + { + if (c->ConsoleType != CONSOLE_CSV) + { + UniFormat(tmp, sizeof(tmp), L"%S%s", prompt, exec_command); + c->Write(c, tmp); + } + } + } + str = CopyUniStr(exec_command); + } + + if (str == NULL) + { + // User canceled + return false; + } + + UniTrimCrlf(str); + UniTrim(str); + + if (UniIsEmptyStr(str)) + { + // Do Nothing + Free(str); + return true; + } + + // Divide into command name and parameter + if (SeparateCommandAndParam(str, &cmd_name, &cmd_param) == false) + { + // Do Nothing + Free(str); + return true; + } + + if (StrLen(cmd_name) >= 2 && cmd_name[0] == '?' && cmd_name[1] != '?') + { + char tmp[MAX_SIZE]; + wchar_t *s; + + StrCpy(tmp, sizeof(tmp), cmd_name + 1); + StrCpy(cmd_name, 0, tmp); + + s = UniCopyStr(L"/?"); + Free(cmd_param); + + cmd_param = s; + } + + if (StrLen(cmd_name) >= 2 && EndWith(cmd_name, "?") && cmd_name[StrLen(cmd_name) - 2] != '?') + { + wchar_t *s; + + cmd_name[StrLen(cmd_name) - 1] = 0; + + s = UniCopyStr(L"/?"); + Free(cmd_param); + + cmd_param = s; + } + + // Get the candidate of command + t = ZeroMalloc(sizeof(TOKEN_LIST)); + t->NumTokens = num_cmd; + t->Token = ZeroMalloc(sizeof(char *) * t->NumTokens); + for (i = 0;i < t->NumTokens;i++) + { + t->Token[i] = CopyStr(cmd[i].Name); + } + + if (IsHelpStr(cmd_name)) + { + if (UniIsEmptyStr(cmd_param)) + { + wchar_t tmp[MAX_SIZE]; + + // Display the list of commands that can be used + UniFormat(tmp, sizeof(tmp), _UU("CMD_HELP_1"), t->NumTokens); + c->Write(c, tmp); + + PrintCandidateHelp(c, NULL, t, 1); + + c->Write(c, L""); + c->Write(c, _UU("CMD_HELP_2")); + } + else + { + char *cmd_name; + + // Display the help for the specified command + if (SeparateCommandAndParam(cmd_param, &cmd_name, NULL)) + { + bool b = true; + + if (IsHelpStr(cmd_name)) + { + b = false; + } + + if (b) + { + wchar_t str[MAX_SIZE]; + + UniFormat(str, sizeof(str), L"%S /help", cmd_name); + DispatchNextCmdEx(c, str, NULL, cmd, num_cmd, param); + no_end_crlf = true; + } + + Free(cmd_name); + } + } + } + else if (StrCmpi(cmd_name, "exit") == 0 || StrCmpi(cmd_name, "quit") == 0) + { + // Exit + b_exit = true; + } + else + { + candidate = GetRealnameCandidate(cmd_name, t); + + if (candidate == NULL || candidate->NumTokens == 0) + { + wchar_t tmp[MAX_SIZE]; + + // No candidate + UniFormat(tmp, sizeof(tmp), _UU("CON_UNKNOWN_CMD"), cmd_name); + c->Write(c, tmp); + + c->RetCode = ERR_BAD_COMMAND_OR_PARAM; + } + else if (candidate->NumTokens >= 2) + { + wchar_t tmp[MAX_SIZE]; + + // There is more than one candidate + UniFormat(tmp, sizeof(tmp), _UU("CON_AMBIGUOUS_CMD"), cmd_name); + c->Write(c, tmp); + c->Write(c, _UU("CON_AMBIGUOUS_CMD_1")); + PrintCandidateHelp(c, NULL, candidate, 1); + c->Write(c, _UU("CON_AMBIGUOUS_CMD_2")); + + c->RetCode = ERR_BAD_COMMAND_OR_PARAM; + } + else + { + char *real_cmd_name; + UINT i; + + // The candidate was shortlisted to one + real_cmd_name = candidate->Token[0]; + + for (i = 0;i < num_cmd;i++) + { + if (StrCmpi(cmd[i].Name, real_cmd_name) == 0) + { + if (cmd[i].Proc != NULL) + { + // Show the description of the command if it isn't in CSV mode + if(c->ConsoleType != CONSOLE_CSV) + { + wchar_t tmp[256]; + wchar_t *note; + + GetCommandHelpStr(cmd[i].Name, ¬e, NULL, NULL); + UniFormat(tmp, sizeof(tmp), _UU("CMD_EXEC_MSG_NAME"), cmd[i].Name, note); + c->Write(c, tmp); + } + + // Call the procedure of the command + ret = cmd[i].Proc(c, cmd[i].Name, cmd_param, param); + + if (ret == INFINITE) + { + // Exit command + b_exit = true; + } + else + { + c->RetCode = ret; + } + } + } + } + } + + FreeToken(candidate); + } + + FreeToken(t); + Free(str); + Free(cmd_name); + Free(cmd_param); + + if (no_end_crlf == false) + { + //c->Write(c, L""); + } + + if (b_exit) + { + return false; + } + + return true; +} + +// Get the width of the current console +UINT GetConsoleWidth(CONSOLE *c) +{ + UINT size; + + size = c->GetWidth(c); + + if (size == 0) + { + size = 80; + } + + if (size < 32) + { + size = 32; + } + + if (size > 65536) + { + size = 65535; + } + + return size; +} + +// Separate the command line into the command and the parameters +bool SeparateCommandAndParam(wchar_t *src, char **cmd, wchar_t **param) +{ + UINT i, len, wp; + wchar_t *tmp; + wchar_t *src_tmp; + // Validate arguments + if (src == NULL) + { + return false; + } + if (cmd != NULL) + { + *cmd = NULL; + } + if (param != NULL) + { + *param = NULL; + } + + src_tmp = UniCopyStr(src); + UniTrimCrlf(src_tmp); + UniTrim(src_tmp); + + len = UniStrLen(src_tmp); + tmp = Malloc(sizeof(wchar_t) * (len + 32)); + wp = 0; + + for (i = 0;i < (len + 1);i++) + { + wchar_t c = src_tmp[i]; + + switch (c) + { + case 0: + case L' ': + case L'\t': + tmp[wp] = 0; + if (UniIsEmptyStr(tmp)) + { + Free(tmp); + Free(src_tmp); + return false; + } + if (cmd != NULL) + { + *cmd = CopyUniToStr(tmp); + Trim(*cmd); + } + goto ESCAPE; + + default: + tmp[wp++] = c; + break; + } + } + +ESCAPE: + if (param != NULL) + { + *param = CopyUniStr(&src_tmp[wp]); + UniTrim(*param); + } + + Free(tmp); + Free(src_tmp); + + return true; +} + +// Get the candidates list of of the real command name whose abbreviation matches to the command specified by the user +TOKEN_LIST *GetRealnameCandidate(char *input_name, TOKEN_LIST *real_name_list) +{ + TOKEN_LIST *ret; + LIST *o; + UINT i; + bool ok = false; + // Validate arguments + if (input_name == NULL || real_name_list == NULL) + { + return NullToken(); + } + + o = NewListFast(NULL); + + for (i = 0;i < real_name_list->NumTokens;i++) + { + char *name = real_name_list->Token[i]; + + // Search for an exact match with the highest priority first + if (StrCmpi(name, input_name) == 0) + { + Insert(o, name); + ok = true; + break; + } + } + + if (ok == false) + { + // If there is no command to exact match, check whether it matches to a short form command + for (i = 0;i < real_name_list->NumTokens;i++) + { + char *name = real_name_list->Token[i]; + + if (IsOmissionName(input_name, name) || IsNameInRealName(input_name, name)) + { + // A abbreviation is found + Insert(o, name); + ok = true; + } + } + } + + if (ok) + { + // One or more candidate is found + ret = ListToTokenList(o); + } + else + { + ret = NullToken(); + } + + ReleaseList(o); + + return ret; +} + +// Check whether the command specified by the user is a abbreviation of existing commands +bool IsOmissionName(char *input_name, char *real_name) +{ + char oname[128]; + // Validate arguments + if (input_name == NULL || real_name == NULL) + { + return false; + } + + if (IsAllUpperStr(real_name)) + { + // Command of all capital letters do not take abbreviations + return false; + } + + GetOmissionName(oname, sizeof(oname), real_name); + + if (IsEmptyStr(oname)) + { + return false; + } + + if (StartWith(oname, input_name)) + { + // Example: The oname of AccountSecureCertSet is "ascs". + // But if the user enters "asc", returns true + return true; + } + + if (StartWith(input_name, oname)) + { + // Example: When two commands AccountCreate and AccountConnect exist, + // if the user enter "aconnect" , only AccountConnect is true + + if (EndWith(real_name, &input_name[StrLen(oname)])) + { + return true; + } + } + + return false; +} + +// Get the short name of the specified command +void GetOmissionName(char *dst, UINT size, char *src) +{ + UINT i, len; + // Validate arguments + if (dst == NULL || src == NULL) + { + return; + } + + StrCpy(dst, size, ""); + len = StrLen(src); + + for (i = 0;i < len;i++) + { + char c = src[i]; + + if ((c >= '0' && c <= '9') || + (c >= 'A' && c <= 'Z')) + { + char tmp[2]; + tmp[0] = c; + tmp[1] = 0; + + StrCat(dst, size, tmp); + } + } +} + +// Check whether the command specified by the user matches the existing commands +bool IsNameInRealName(char *input_name, char *real_name) +{ + // Validate arguments + if (input_name == NULL || real_name == NULL) + { + return false; + } + + if (StartWith(real_name, input_name)) + { + return true; + } + + return false; +} + +// Parse the command list +LIST *ParseCommandList(CONSOLE *c, char *cmd_name, wchar_t *command, PARAM param[], UINT num_param) +{ + UINT i; + LIST *o; + bool ok = true; + TOKEN_LIST *param_list; + TOKEN_LIST *real_name_list; + bool help_mode = false; + wchar_t *tmp; + // Validate arguments + if (c == NULL || command == NULL || (num_param >= 1 && param == NULL) || cmd_name == NULL) + { + return NULL; + } + + // Initialization + for (i = 0;i < num_param;i++) + { + if (IsEmptyStr(param[i].Name) == false) + { + if (param[i].Name[0] == '[') + { + param[i].Tmp = ""; + } + else + { + param[i].Tmp = NULL; + } + } + else + { + param[i].Tmp = ""; + } + } + + real_name_list = ZeroMalloc(sizeof(TOKEN_LIST)); + real_name_list->NumTokens = num_param; + real_name_list->Token = ZeroMalloc(sizeof(char *) * real_name_list->NumTokens); + + for (i = 0;i < real_name_list->NumTokens;i++) + { + real_name_list->Token[i] = CopyStr(param[i].Name); + } + + // Generate a list of parameter name specified by the user + param_list = GetCommandNameList(command); + + for (i = 0;i < param_list->NumTokens;i++) + { + char *s = param_list->Token[i]; + + if (StrCmpi(s, "help") == 0 || StrCmpi(s, "?") == 0) + { + help_mode = true; + break; + } + } + + tmp = ParseCommand(command, L""); + if (tmp != NULL) + { + if (UniStrCmpi(tmp, L"?") == 0) + { + help_mode = true; + } + Free(tmp); + } + + if (help_mode) + { + // Show the help + PrintCmdHelp(c, cmd_name, real_name_list); + FreeToken(param_list); + FreeToken(real_name_list); + return NULL; + } + + for (i = 0;i < param_list->NumTokens;i++) + { + // Get the corresponding commands for all parameter names which is specified by the user + TOKEN_LIST *candidate = GetRealnameCandidate(param_list->Token[i], real_name_list); + + if (candidate != NULL && candidate->NumTokens >= 1) + { + if (candidate->NumTokens >= 2) + { + wchar_t tmp[MAX_SIZE]; + + // There is more than one candidate + UniFormat(tmp, sizeof(tmp), _UU("CON_AMBIGUOUS_PARAM"), param_list->Token[i]); + c->Write(c, tmp); + UniFormat(tmp, sizeof(tmp), _UU("CON_AMBIGUOUS_PARAM_1"), cmd_name); + c->Write(c, tmp); + + PrintCandidateHelp(c, cmd_name, candidate, 1); + + c->Write(c, _UU("CON_AMBIGUOUS_PARAM_2")); + + ok = false; + } + else + { + UINT j; + char *real_name = candidate->Token[0]; + + // There is only one candidate + for (j = 0;j < num_param;j++) + { + if (StrCmpi(param[j].Name, real_name) == 0) + { + param[j].Tmp = param_list->Token[i]; + } + } + } + } + else + { + wchar_t tmp[MAX_SIZE]; + + // No candidate + UniFormat(tmp, sizeof(tmp), _UU("CON_INVALID_PARAM"), param_list->Token[i], cmd_name, cmd_name); + c->Write(c, tmp); + + ok = false; + } + + FreeToken(candidate); + } + + if (ok == false) + { + FreeToken(param_list); + FreeToken(real_name_list); + + return NULL; + } + + // Creating a list + o = NewParamValueList(); + + // Read all the parameters of the specified name in the parameter list + for (i = 0;i < num_param;i++) + { + bool prompt_input_value = false; + PARAM *p = ¶m[i]; + + if (p->Tmp != NULL || p->PromptProc != NULL) + { + wchar_t *name = CopyStrToUni(p->Name); + wchar_t *tmp; + wchar_t *str; + + if (p->Tmp != NULL) + { + tmp = CopyStrToUni(p->Tmp); + } + else + { + tmp = CopyStrToUni(p->Name); + } + + str = ParseCommand(command, tmp); + Free(tmp); + if (str != NULL) + { + wchar_t *unistr; + bool ret; +EVAL_VALUE: + // Reading succeeded + unistr = str; + + if (p->EvalProc != NULL) + { + // Evaluate the value if EvalProc is specified + ret = p->EvalProc(c, unistr, p->EvalProcParam); + } + else + { + // Accept any value if EvalProc is not specified + ret = true; + } + + if (ret == false) + { + // The specified value is invalid + if (p->PromptProc == NULL) + { + // Cancel + ok = false; + Free(name); + Free(str); + break; + } + else if (c->ProgrammingMode) + { + // In the programming mode, return the error immediately. + ok = false; + Free(name); + Free(str); + break; + } + else + { + // Request to re-enter + Free(str); + str = NULL; + goto SHOW_PROMPT; + } + } + else + { + PARAM_VALUE *v; + // Finished loading, add it to the list + v = ZeroMalloc(sizeof(PARAM_VALUE)); + v->Name = CopyStr(p->Name); + v->StrValue = CopyUniToStr(str); + v->UniStrValue = CopyUniStr(str); + v->IntValue = ToInt(v->StrValue); + Insert(o, v); + } + } + else + { + // Failed to read. The parameter is not specified + if (p->PromptProc != NULL) + { + wchar_t *tmp; +SHOW_PROMPT: + // Prompt because it is a mandatory parameter + tmp = NULL; + if (c->ProgrammingMode == false) + { + tmp = p->PromptProc(c, p->PromptProcParam); + } + if (tmp == NULL) + { + // User canceled + ok = false; + Free(str); + Free(name); + break; + } + else + { + // Entered by the user + c->Write(c, L""); + str = tmp; + prompt_input_value = true; + goto EVAL_VALUE; + } + } + } + + Free(str); + Free(name); + } + } + + FreeToken(param_list); + FreeToken(real_name_list); + + if (ok) + { + return o; + } + else + { + FreeParamValueList(o); + return NULL; + } +} + +// Acquisition of [Yes] or [No] +bool GetParamYes(LIST *o, char *name) +{ + char *s; + char tmp[64]; + // Validate arguments + if (o == NULL) + { + return false; + } + + s = GetParamStr(o, name); + if (s == NULL) + { + return false; + } + + StrCpy(tmp, sizeof(tmp), s); + Trim(tmp); + + if (StartWith(tmp, "y")) + { + return true; + } + + if (StartWith(tmp, "t")) + { + return true; + } + + if (ToInt(tmp) != 0) + { + return true; + } + + return false; +} + +// Acquisition of parameter value Int +UINT GetParamInt(LIST *o, char *name) +{ + PARAM_VALUE *v; + // Validate arguments + if (o == NULL) + { + return 0; + } + + v = FindParamValue(o, name); + if (v == NULL) + { + return 0; + } + else + { + return v->IntValue; + } +} + +// Acquisition of parameter value Unicode string +wchar_t *GetParamUniStr(LIST *o, char *name) +{ + PARAM_VALUE *v; + // Validate arguments + if (o == NULL) + { + return NULL; + } + + v = FindParamValue(o, name); + if (v == NULL) + { + return NULL; + } + else + { + return v->UniStrValue; + } +} + +// Acquisition of the parameter value string +char *GetParamStr(LIST *o, char *name) +{ + PARAM_VALUE *v; + // Validate arguments + if (o == NULL) + { + return NULL; + } + + v = FindParamValue(o, name); + if (v == NULL) + { + return NULL; + } + else + { + return v->StrValue; + } +} + +// Acquisition of parameter value +PARAM_VALUE *FindParamValue(LIST *o, char *name) +{ + PARAM_VALUE t, *ret; + // Validate arguments + if (o == NULL) + { + return NULL; + } + if (name == NULL) + { + name = ""; + } + + Zero(&t, sizeof(t)); + t.Name = name; + + ret = Search(o, &t); + + return ret; +} + +// Release of the parameter value list +void FreeParamValueList(LIST *o) +{ + UINT i; + // Validate arguments + if (o == NULL) + { + return; + } + + for (i = 0;i < LIST_NUM(o);i++) + { + PARAM_VALUE *v = LIST_DATA(o, i); + + Free(v->StrValue); + Free(v->UniStrValue); + Free(v->Name); + Free(v); + } + + ReleaseList(o); +} + +// Parameter value list sort function +int CmpParamValue(void *p1, void *p2) +{ + PARAM_VALUE *v1, *v2; + if (p1 == NULL || p2 == NULL) + { + return 0; + } + v1 = *(PARAM_VALUE **)p1; + v2 = *(PARAM_VALUE **)p2; + if (v1 == NULL || v2 == NULL) + { + return 0; + } + + if (IsEmptyStr(v1->Name) && IsEmptyStr(v2->Name)) + { + return 0; + } + return StrCmpi(v1->Name, v2->Name); +} + +// Generation of the parameter value list +LIST *NewParamValueList() +{ + return NewListFast(CmpParamValue); +} + +// Get the list of parameter names that were included in the entered command +TOKEN_LIST *GetCommandNameList(wchar_t *str) +{ + TOKEN_LIST *t; + // Validate arguments + if (str == NULL) + { + return NullToken(); + } + + Free(ParseCommandEx(str, L"dummy_str", &t)); + + return t; +} + +// Get the commands that start with the specified name +wchar_t *ParseCommand(wchar_t *str, wchar_t *name) +{ + return ParseCommandEx(str, name, NULL); +} +wchar_t *ParseCommandEx(wchar_t *str, wchar_t *name, TOKEN_LIST **param_list) +{ + UNI_TOKEN_LIST *t; + UINT i; + wchar_t *tmp; + wchar_t *ret = NULL; + LIST *o; + // Validate arguments + if (str == NULL) + { + return NULL; + } + if (name != NULL && UniIsEmptyStr(name)) + { + name = NULL; + } + + o = NULL; + if (param_list != NULL) + { + o = NewListFast(CompareStr); + } + + tmp = CopyUniStr(str); + UniTrim(tmp); + + i = UniSearchStrEx(tmp, L"/CMD ", 0, false); + + if (i != INFINITE && i >= 1 && tmp[i - 1] == L'/') + { + i = INFINITE; + } + if (i == INFINITE) + { + i = UniSearchStrEx(tmp, L"/CMD\t", 0, false); + if (i != INFINITE && i >= 1 && tmp[i - 1] == L'/') + { + i = INFINITE; + } + } + if (i == INFINITE) + { + i = UniSearchStrEx(tmp, L"/CMD:", 0, false); + if (i != INFINITE && i >= 1 && tmp[i - 1] == L'/') + { + i = INFINITE; + } + } + if (i == INFINITE) + { + i = UniSearchStrEx(tmp, L"/CMD=", 0, false); + if (i != INFINITE && i >= 1 && tmp[i - 1] == L'/') + { + i = INFINITE; + } + } + if (i == INFINITE) + { + i = UniSearchStrEx(tmp, L"-CMD ", 0, false); + if (i != INFINITE && i >= 1 && tmp[i - 1] == L'-') + { + i = INFINITE; + } + } + if (i == INFINITE) + { + i = UniSearchStrEx(tmp, L"-CMD\t", 0, false); + if (i != INFINITE && i >= 1 && tmp[i - 1] == L'-') + { + i = INFINITE; + } + } + if (i == INFINITE) + { + i = UniSearchStrEx(tmp, L"-CMD:", 0, false); + if (i != INFINITE && i >= 1 && tmp[i - 1] == L'-') + { + i = INFINITE; + } + } + if (i == INFINITE) + { + i = UniSearchStrEx(tmp, L"-CMD=", 0, false); + if (i != INFINITE && i >= 1 && tmp[i - 1] == L'-') + { + i = INFINITE; + } + } + + if (i != INFINITE) + { + char *s = CopyStr("CMD"); + if (InsertStr(o, s) == false) + { + Free(s); + } + if (UniStrCmpi(name, L"CMD") == 0) + { + ret = CopyUniStr(&str[i + 5]); + UniTrim(ret); + } + else + { + tmp[i] = 0; + } + } + + if (ret == NULL) + { + t = UniParseCmdLine(tmp); + + if (t != NULL) + { + for (i = 0;i < t->NumTokens;i++) + { + wchar_t *token = t->Token[i]; + + if ((token[0] == L'-' && token[1] != L'-') || + (UniStrCmpi(token, L"--help") == 0) || + (token[0] == L'/' && token[1] != L'/')) + { + UINT i; + + // Named parameter + // Examine whether there is a colon character + + if (UniStrCmpi(token, L"--help") == 0) + { + token++; + } + + i = UniSearchStrEx(token, L":", 0, false); + if (i == INFINITE) + { + i = UniSearchStrEx(token, L"=", 0, false); + } + if (i != INFINITE) + { + wchar_t *tmp; + char *a; + + // There is a colon character + tmp = CopyUniStr(token); + tmp[i] = 0; + + a = CopyUniToStr(&tmp[1]); + if (InsertStr(o, a) == false) + { + Free(a); + } + + if (UniStrCmpi(name, &tmp[1]) == 0) + { + if (ret == NULL) + { + // Content + ret = UniCopyStr(&token[i + 1]); + } + } + + Free(tmp); + } + else + { + // There is no colon character + char *a; + + a = CopyUniToStr(&token[1]); + if (InsertStr(o, a) == false) + { + Free(a); + } + + if (UniStrCmpi(name, &token[1]) == 0) + { + if (ret == NULL) + { + // Empty character + ret = UniCopyStr(L""); + } + } + } + } + else + { + // Nameless argument + if (name == NULL) + { + if (ret == NULL) + { + if (token[0] == L'-' && token[1] == L'-') + { + ret = UniCopyStr(&token[1]); + } + else if (token[0] == L'/' && token[1] == L'/') + { + ret = UniCopyStr(&token[1]); + } + else + { + ret = UniCopyStr(token); + } + } + } + } + } + + UniFreeToken(t); + } + } + + Free(tmp); + + if (o != NULL) + { + TOKEN_LIST *t = ZeroMalloc(sizeof(TOKEN_LIST)); + UINT i; + + t->NumTokens = LIST_NUM(o); + t->Token = ZeroMalloc(sizeof(char *) * t->NumTokens); + + for (i = 0;i < t->NumTokens;i++) + { + t->Token[i] = LIST_DATA(o, i); + } + + ReleaseList(o); + + *param_list = t; + } + + if (UniStrCmpi(ret, L"none") == 0 || UniStrCmpi(ret, L"null") == 0) + { + // Null and none are reserved words + ret[0] = 0; + } + + return ret; +} +char *ParseCommandA(wchar_t *str, char *name) +{ + wchar_t *tmp1, *tmp2; + char *ret; + // Validate arguments + if (str == NULL) + { + return NULL; + } + + if (name != NULL) + { + tmp1 = CopyStrToUni(name); + } + else + { + tmp1 = NULL; + } + + tmp2 = ParseCommand(str, tmp1); + + if (tmp2 == NULL) + { + ret = NULL; + } + else + { + ret = CopyUniToStr(tmp2); + Free(tmp2); + } + + Free(tmp1); + + return ret; +} + +// Password prompt +bool PasswordPrompt(char *password, UINT size) +{ + UINT wp; + bool escape = false; + void *console; + // Validate arguments + if (password == NULL || size <= 1) + { + if (size >= 1) + { + password[0] = 0; + } + return false; + } + + wp = 0; + + Zero(password, size); + + console = SetConsoleRaw(); + + while (true) + { + int c; + +#ifdef OS_WIN32 + c = getch(); +#else // OS_WIN32 + c = getc(stdin); +#endif // OS_WIN32 + + if (c >= 0x20 && c <= 0x7E) + { + // Character + if ((wp + 1) < size) + { + password[wp++] = (char)c; + putc('*', stdout); + } + } + else if (c == 0x03) + { + // Break + exit(0); + } + else if (c == 0x04 || c == 0x1a || c == 0x0D || c==0x0A) + { + // Exit + if (c == 0x04 || c == 0x1a) + { + escape = true; + } + break; + } + else if (c == 0xE0) + { + // Read one more character +#ifdef OS_WIN32 + c = getch(); +#else // OS_WIN32 + c = getc(stdin); +#endif // OS_WIN32 + if (c == 0x4B || c == 0x53) + { + // Backspace + goto BACKSPACE; + } + } + else if (c == 0x08) + { +BACKSPACE: + // Backspace + if (wp >= 1) + { + password[--wp] = 0; + putc(0x08, stdout); + putc(' ', stdout); + putc(0x08, stdout); + } + } + } + Print("\n"); + + RestoreConsole(console); + + return (escape ? false : true); +} + +// Show the prompt +wchar_t *Prompt(wchar_t *prompt_str) +{ + wchar_t *ret = NULL; + wchar_t *tmp = NULL; + // Validate arguments + if (prompt_str == NULL) + { + prompt_str = L""; + } + +#ifdef OS_WIN32 + UniPrint(L"%s", prompt_str); + tmp = Malloc(MAX_PROMPT_STRSIZE); + if (fgetws(tmp, MAX_PROMPT_STRSIZE - 1, stdin) != NULL) + { + bool escape = false; + UINT i, len; + + len = UniStrLen(tmp); + for (i = 0;i < len;i++) + { + if (tmp[i] == 0x04 || tmp[i] == 0x1A) + { + escape = true; + break; + } + } + + if (escape == false) + { + UniTrimCrlf(tmp); + + ret = UniCopyStr(tmp); + } + } + Free(tmp); +#else // OS_WIN32 + { + char *prompt = CopyUniToStr(prompt_str); + char *s = readline(prompt); + Free(prompt); + + if (s != NULL) + { + TrimCrlf(s); + Trim(s); + + if (IsEmptyStr(s) == false) + { + add_history(s); + } + + ret = CopyStrToUni(s); + + free(s); + } + } +#endif // OS_WIN32 + + if (ret == NULL) + { + Print("\n"); + } + + return ret; +} +char *PromptA(wchar_t *prompt_str) +{ + wchar_t *str = Prompt(prompt_str); + + if (str == NULL) + { + return NULL; + } + else + { + char *ret = CopyUniToStr(str); + + Free(str); + return ret; + } +} + +// Set the console to raw mode +void *SetConsoleRaw() +{ +#ifdef OS_UNIX + struct termios t, *ret; + + Zero(&t, sizeof(t)); + if (tcgetattr(0, &t) != 0) + { + // Failed + return NULL; + } + + // Copy the current settings + ret = Clone(&t, sizeof(t)); + + // Change the settings + t.c_lflag &= (~ICANON); + t.c_lflag &= (~ECHO); + t.c_cc[VTIME] = 0; + t.c_cc[VMIN] = 1; + tcsetattr(0, TCSANOW, &t); + + return ret; +#else // OS_UNIX + return Malloc(0); +#endif // OS_UNIX +} + +// Restore the mode of the console +void RestoreConsole(void *p) +{ +#ifdef OS_UNIX + struct termios *t; + // Validate arguments + if (p == NULL) + { + return; + } + + t = (struct termios *)p; + + // Restore the settings + tcsetattr(0, TCSANOW, t); + + Free(t); +#else // OS_UNIX + if (p != NULL) + { + Free(p); + } +#endif // OS_UNIX +} + +//////////////////////////// +// Local console function + +// Creating a new local console +CONSOLE *NewLocalConsole(wchar_t *infile, wchar_t *outfile) +{ + IO *in_io = NULL, *out_io = NULL; + CONSOLE *c = ZeroMalloc(sizeof(CONSOLE)); + LOCAL_CONSOLE_PARAM *p; + UINT old_size = 0; + +#ifdef OS_WIN32 + if (MsGetConsoleWidth() == 80) + { + //old_size = MsSetConsoleWidth(WIN32_DEFAULT_CONSOLE_WIDTH); + } +#endif // OS_WIN32 + + c->ConsoleType = CONSOLE_LOCAL; + c->Free = ConsoleLocalFree; + c->ReadLine = ConsoleLocalReadLine; + c->ReadPassword = ConsoleLocalReadPassword; + c->Write = ConsoleLocalWrite; + c->GetWidth = ConsoleLocalGetWidth; + c->OutputLock = NewLock(); + + if (UniIsEmptyStr(infile) == false) + { + // Input file is specified + in_io = FileOpenW(infile, false); + if (in_io == NULL) + { + wchar_t tmp[MAX_SIZE]; + + UniFormat(tmp, sizeof(tmp), _UU("CON_INFILE_ERROR"), infile); + c->Write(c, tmp); + Free(c); + return NULL; + } + else + { + wchar_t tmp[MAX_SIZE]; + + UniFormat(tmp, sizeof(tmp), _UU("CON_INFILE_START"), infile); + c->Write(c, tmp); + } + } + + if (UniIsEmptyStr(outfile) == false) + { + // Output file is specified + out_io = FileCreateW(outfile); + if (out_io == NULL) + { + wchar_t tmp[MAX_SIZE]; + + UniFormat(tmp, sizeof(tmp), _UU("CON_OUTFILE_ERROR"), outfile); + c->Write(c, tmp); + Free(c); + + if (in_io != NULL) + { + FileClose(in_io); + } + return NULL; + } + else + { + wchar_t tmp[MAX_SIZE]; + + UniFormat(tmp, sizeof(tmp), _UU("CON_OUTFILE_START"), outfile); + c->Write(c, tmp); + } + } + + p = ZeroMalloc(sizeof(LOCAL_CONSOLE_PARAM)); + c->Param = p; + + p->InFile = in_io; + p->OutFile = out_io; + p->Win32_OldConsoleWidth = old_size; + + if (in_io != NULL) + { + UINT size; + void *buf; + + size = FileSize(in_io); + buf = ZeroMalloc(size + 1); + FileRead(in_io, buf, size); + + p->InBuf = NewBuf(); + WriteBuf(p->InBuf, buf, size); + Free(buf); + + p->InBuf->Current = 0; + } + + return c; +} + +// Release Console +void ConsoleLocalFree(CONSOLE *c) +{ + LOCAL_CONSOLE_PARAM *p; + // Validate arguments + if (c == NULL) + { + return; + } + + p = (LOCAL_CONSOLE_PARAM *)c->Param; + +#ifdef OS_WIN32 + if (p->Win32_OldConsoleWidth != 0) + { + MsSetConsoleWidth(p->Win32_OldConsoleWidth); + } +#endif // OS_WIN32 + + if (p != NULL) + { + if (p->InFile != NULL) + { + FileClose(p->InFile); + FreeBuf(p->InBuf); + } + + if (p->OutFile != NULL) + { + FileClose(p->OutFile); + } + + Free(p); + } + + DeleteLock(c->OutputLock); + + // Memory release + Free(c); +} + +// Get the width of the screen +UINT ConsoleLocalGetWidth(CONSOLE *c) +{ + UINT ret = 0; + // Validate arguments + if (c == NULL) + { + return 0; + } + +#ifdef OS_WIN32 + ret = MsGetConsoleWidth(); +#else // OS_WIN32 + { + struct winsize t; + + Zero(&t, sizeof(t)); + + if (ioctl(1, TIOCGWINSZ, &t) == 0) + { + ret = t.ws_col; + } + } +#endif // OS_WIN32 + + return ret; +} + +// Read one line from the console +wchar_t *ConsoleLocalReadLine(CONSOLE *c, wchar_t *prompt, bool nofile) +{ + wchar_t *ret; + LOCAL_CONSOLE_PARAM *p; + // Validate arguments + if (c == NULL) + { + return NULL; + } + p = (LOCAL_CONSOLE_PARAM *)c->Param; + if (prompt == NULL) + { + prompt = L">"; + } + + ConsoleWriteOutFile(c, prompt, false); + + if (nofile == false && p->InBuf != NULL) + { + // Read the next line from the file + ret = ConsoleReadNextFromInFile(c); + + if (ret != NULL) + { + // Display the pseudo prompt + UniPrint(L"%s", prompt); + + // Display on the screen + UniPrint(L"%s\n", ret); + } + } + else + { + // Read the following line from the console + ret = Prompt(prompt); + } + + if (ret != NULL) + { + ConsoleWriteOutFile(c, ret, true); + } + else + { + ConsoleWriteOutFile(c, _UU("CON_USER_CANCEL"), true); + } + + return ret; +} + +// Read the password from the console +char *ConsoleLocalReadPassword(CONSOLE *c, wchar_t *prompt) +{ + char tmp[64]; + // Validate arguments + if (c == NULL) + { + return NULL; + } + if (prompt == NULL) + { + prompt = L"Password>"; + } + + UniPrint(L"%s", prompt); + ConsoleWriteOutFile(c, prompt, false); + + if (PasswordPrompt(tmp, sizeof(tmp))) + { + ConsoleWriteOutFile(c, L"********", true); + return CopyStr(tmp); + } + else + { + ConsoleWriteOutFile(c, _UU("CON_USER_CANCEL"), true); + return NULL; + } +} + +// Display a string to the console +bool ConsoleLocalWrite(CONSOLE *c, wchar_t *str) +{ + // Validate arguments + if (c == NULL || str == NULL) + { + return false; + } + + UniPrint(L"%s%s", str, (UniEndWith(str, L"\n") ? L"" : L"\n")); + + ConsoleWriteOutFile(c, str, true); + + return true; +} + +// Read the next line from the input file +wchar_t *ConsoleReadNextFromInFile(CONSOLE *c) +{ + LOCAL_CONSOLE_PARAM *p; + char *str; + // Validate arguments + if (c == NULL) + { + return NULL; + } + + p = (LOCAL_CONSOLE_PARAM *)c->Param; + + if (p->InBuf == NULL) + { + return NULL; + } + + while (true) + { + str = CfgReadNextLine(p->InBuf); + + if (str == NULL) + { + return NULL; + } + + Trim(str); + + if (IsEmptyStr(str) == false) + { + UINT size; + wchar_t *ret; + + size = CalcUtf8ToUni((BYTE *)str, StrLen(str)); + ret = ZeroMalloc(size + 32); + Utf8ToUni(ret, size, (BYTE *)str, StrLen(str)); + + Free(str); + + return ret; + } + + Free(str); + } +} + +// Write when the output file is specified +void ConsoleWriteOutFile(CONSOLE *c, wchar_t *str, bool add_last_crlf) +{ + LOCAL_CONSOLE_PARAM *p; + // Validate arguments + if (c == NULL || str == NULL) + { + return; + } + + p = (LOCAL_CONSOLE_PARAM *)c->Param; + + if (p != NULL && p->OutFile != NULL) + { + wchar_t *tmp = UniNormalizeCrlf(str); + UINT utf8_size; + UCHAR *utf8; + + utf8_size = CalcUniToUtf8(tmp); + utf8 = ZeroMalloc(utf8_size + 1); + UniToUtf8(utf8, utf8_size + 1, tmp); + + FileWrite(p->OutFile, utf8, utf8_size); + + if (UniEndWith(str, L"\n") == false && add_last_crlf) + { + char *crlf = "\r\n"; + FileWrite(p->OutFile, "\r\n", StrLen(crlf)); + } + + Free(utf8); + Free(tmp); + } + +} + diff --git a/src/Cedar/Console.h b/src/Cedar/Console.h index 0e9c2b35..f335e94b 100644 --- a/src/Cedar/Console.h +++ b/src/Cedar/Console.h @@ -1,144 +1,144 @@ -// SoftEther VPN Source Code - Developer Edition Master Branch -// Cedar Communication Module - - -// Console.h -// Header of Console.c - -#ifndef CONSOLE_H -#define CONSOLE_H - -// Constant -#define MAX_PROMPT_STRSIZE 65536 -#define WIN32_DEFAULT_CONSOLE_WIDTH 100 - -// Types of console -#define CONSOLE_LOCAL 0 // Local console -#define CONSOLE_CSV 1 // CSV output mode - -// Parameters completion prompt function -typedef wchar_t *(PROMPT_PROC)(CONSOLE *c, void *param); - -// Parameter validation prompt function -typedef bool (EVAL_PROC)(CONSOLE *c, wchar_t *str, void *param); - -// Definition of the parameter item -struct PARAM -{ - char *Name; // Parameter name - PROMPT_PROC *PromptProc; // Prompt function that automatically invoked if the parameter is not specified - // (This is not called in the case of NULL) - void *PromptProcParam; // Any pointers to pass to the prompt function - EVAL_PROC *EvalProc; // Parameter string validation function - void *EvalProcParam; // Any pointers to be passed to the validation function - char *Tmp; // Temporary variable -}; - -// Parameter value of the internal data -struct PARAM_VALUE -{ - char *Name; // Name - char *StrValue; // String value - wchar_t *UniStrValue; // Unicode string value - UINT IntValue; // Integer value -}; - -// Console service structure -struct CONSOLE -{ - UINT ConsoleType; // Type of console - UINT RetCode; // The last exit code - void *Param; // Data of any - void (*Free)(CONSOLE *c); // Release function - wchar_t *(*ReadLine)(CONSOLE *c, wchar_t *prompt, bool nofile); // Function to read one line - char *(*ReadPassword)(CONSOLE *c, wchar_t *prompt); // Function to read the password - bool (*Write)(CONSOLE *c, wchar_t *str); // Function to write a string - UINT (*GetWidth)(CONSOLE *c); // Get the width of the screen - bool ProgrammingMode; // Programming Mode - LOCK *OutputLock; // Output Lock -}; - -// Local console parameters -struct LOCAL_CONSOLE_PARAM -{ - IO *InFile; // Input file - BUF *InBuf; // Input buffer - IO *OutFile; // Output file - UINT Win32_OldConsoleWidth; // Previous console size -}; - -// Command procedure -typedef UINT (COMMAND_PROC)(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); - -// Definition of command -struct CMD -{ - char *Name; // Command name - COMMAND_PROC *Proc; // Procedure function -}; - -// Evaluate the minimum / maximum value of the parameter -struct CMD_EVAL_MIN_MAX -{ - char *StrName; - UINT MinValue, MaxValue; -}; - - -// Function prototype -wchar_t *Prompt(wchar_t *prompt_str); -char *PromptA(wchar_t *prompt_str); -bool PasswordPrompt(char *password, UINT size); -void *SetConsoleRaw(); -void RestoreConsole(void *p); -wchar_t *ParseCommandEx(wchar_t *str, wchar_t *name, TOKEN_LIST **param_list); -wchar_t *ParseCommand(wchar_t *str, wchar_t *name); -TOKEN_LIST *GetCommandNameList(wchar_t *str); -char *ParseCommandA(wchar_t *str, char *name); -LIST *NewParamValueList(); -int CmpParamValue(void *p1, void *p2); -void FreeParamValueList(LIST *o); -PARAM_VALUE *FindParamValue(LIST *o, char *name); -char *GetParamStr(LIST *o, char *name); -wchar_t *GetParamUniStr(LIST *o, char *name); -UINT GetParamInt(LIST *o, char *name); -bool GetParamYes(LIST *o, char *name); -LIST *ParseCommandList(CONSOLE *c, char *cmd_name, wchar_t *command, PARAM param[], UINT num_param); -bool IsNameInRealName(char *input_name, char *real_name); -void GetOmissionName(char *dst, UINT size, char *src); -bool IsOmissionName(char *input_name, char *real_name); -TOKEN_LIST *GetRealnameCandidate(char *input_name, TOKEN_LIST *real_name_list); -bool SeparateCommandAndParam(wchar_t *src, char **cmd, wchar_t **param); -UINT GetConsoleWidth(CONSOLE *c); -bool DispatchNextCmd(CONSOLE *c, char *prompt, CMD cmd[], UINT num_cmd, void *param); -bool DispatchNextCmdEx(CONSOLE *c, wchar_t *exec_command, char *prompt, CMD cmd[], UINT num_cmd, void *param); -void PrintCandidateHelp(CONSOLE *c, char *cmd_name, TOKEN_LIST *candidate_list, UINT left_space); -UNI_TOKEN_LIST *SeparateStringByWidth(wchar_t *str, UINT width); -UINT GetNextWordWidth(wchar_t *str); -bool IsWordChar(wchar_t c); -void GetCommandHelpStr(char *command_name, wchar_t **description, wchar_t **args, wchar_t **help); -void GetCommandParamHelpStr(char *command_name, char *param_name, wchar_t **description); -bool CmdEvalMinMax(CONSOLE *c, wchar_t *str, void *param); -wchar_t *CmdPrompt(CONSOLE *c, void *param); -bool CmdEvalNotEmpty(CONSOLE *c, wchar_t *str, void *param); -bool CmdEvalInt1(CONSOLE *c, wchar_t *str, void *param); -bool CmdEvalIsFile(CONSOLE *c, wchar_t *str, void *param); -bool CmdEvalSafe(CONSOLE *c, wchar_t *str, void *param); -void PrintCmdHelp(CONSOLE *c, char *cmd_name, TOKEN_LIST *param_list); -int CompareCandidateStr(void *p1, void *p2); -bool IsHelpStr(char *str); - -CONSOLE *NewLocalConsole(wchar_t *infile, wchar_t *outfile); -void ConsoleLocalFree(CONSOLE *c); -wchar_t *ConsoleLocalReadLine(CONSOLE *c, wchar_t *prompt, bool nofile); -char *ConsoleLocalReadPassword(CONSOLE *c, wchar_t *prompt); -bool ConsoleLocalWrite(CONSOLE *c, wchar_t *str); -void ConsoleWriteOutFile(CONSOLE *c, wchar_t *str, bool add_last_crlf); -wchar_t *ConsoleReadNextFromInFile(CONSOLE *c); -UINT ConsoleLocalGetWidth(CONSOLE *c); - - -#endif // CONSOLE_H - - - +// SoftEther VPN Source Code - Developer Edition Master Branch +// Cedar Communication Module + + +// Console.h +// Header of Console.c + +#ifndef CONSOLE_H +#define CONSOLE_H + +// Constant +#define MAX_PROMPT_STRSIZE 65536 +#define WIN32_DEFAULT_CONSOLE_WIDTH 100 + +// Types of console +#define CONSOLE_LOCAL 0 // Local console +#define CONSOLE_CSV 1 // CSV output mode + +// Parameters completion prompt function +typedef wchar_t *(PROMPT_PROC)(CONSOLE *c, void *param); + +// Parameter validation prompt function +typedef bool (EVAL_PROC)(CONSOLE *c, wchar_t *str, void *param); + +// Definition of the parameter item +struct PARAM +{ + char *Name; // Parameter name + PROMPT_PROC *PromptProc; // Prompt function that automatically invoked if the parameter is not specified + // (This is not called in the case of NULL) + void *PromptProcParam; // Any pointers to pass to the prompt function + EVAL_PROC *EvalProc; // Parameter string validation function + void *EvalProcParam; // Any pointers to be passed to the validation function + char *Tmp; // Temporary variable +}; + +// Parameter value of the internal data +struct PARAM_VALUE +{ + char *Name; // Name + char *StrValue; // String value + wchar_t *UniStrValue; // Unicode string value + UINT IntValue; // Integer value +}; + +// Console service structure +struct CONSOLE +{ + UINT ConsoleType; // Type of console + UINT RetCode; // The last exit code + void *Param; // Data of any + void (*Free)(CONSOLE *c); // Release function + wchar_t *(*ReadLine)(CONSOLE *c, wchar_t *prompt, bool nofile); // Function to read one line + char *(*ReadPassword)(CONSOLE *c, wchar_t *prompt); // Function to read the password + bool (*Write)(CONSOLE *c, wchar_t *str); // Function to write a string + UINT (*GetWidth)(CONSOLE *c); // Get the width of the screen + bool ProgrammingMode; // Programming Mode + LOCK *OutputLock; // Output Lock +}; + +// Local console parameters +struct LOCAL_CONSOLE_PARAM +{ + IO *InFile; // Input file + BUF *InBuf; // Input buffer + IO *OutFile; // Output file + UINT Win32_OldConsoleWidth; // Previous console size +}; + +// Command procedure +typedef UINT (COMMAND_PROC)(CONSOLE *c, char *cmd_name, wchar_t *str, void *param); + +// Definition of command +struct CMD +{ + char *Name; // Command name + COMMAND_PROC *Proc; // Procedure function +}; + +// Evaluate the minimum / maximum value of the parameter +struct CMD_EVAL_MIN_MAX +{ + char *StrName; + UINT MinValue, MaxValue; +}; + + +// Function prototype +wchar_t *Prompt(wchar_t *prompt_str); +char *PromptA(wchar_t *prompt_str); +bool PasswordPrompt(char *password, UINT size); +void *SetConsoleRaw(); +void RestoreConsole(void *p); +wchar_t *ParseCommandEx(wchar_t *str, wchar_t *name, TOKEN_LIST **param_list); +wchar_t *ParseCommand(wchar_t *str, wchar_t *name); +TOKEN_LIST *GetCommandNameList(wchar_t *str); +char *ParseCommandA(wchar_t *str, char *name); +LIST *NewParamValueList(); +int CmpParamValue(void *p1, void *p2); +void FreeParamValueList(LIST *o); +PARAM_VALUE *FindParamValue(LIST *o, char *name); +char *GetParamStr(LIST *o, char *name); +wchar_t *GetParamUniStr(LIST *o, char *name); +UINT GetParamInt(LIST *o, char *name); +bool GetParamYes(LIST *o, char *name); +LIST *ParseCommandList(CONSOLE *c, char *cmd_name, wchar_t *command, PARAM param[], UINT num_param); +bool IsNameInRealName(char *input_name, char *real_name); +void GetOmissionName(char *dst, UINT size, char *src); +bool IsOmissionName(char *input_name, char *real_name); +TOKEN_LIST *GetRealnameCandidate(char *input_name, TOKEN_LIST *real_name_list); +bool SeparateCommandAndParam(wchar_t *src, char **cmd, wchar_t **param); +UINT GetConsoleWidth(CONSOLE *c); +bool DispatchNextCmd(CONSOLE *c, char *prompt, CMD cmd[], UINT num_cmd, void *param); +bool DispatchNextCmdEx(CONSOLE *c, wchar_t *exec_command, char *prompt, CMD cmd[], UINT num_cmd, void *param); +void PrintCandidateHelp(CONSOLE *c, char *cmd_name, TOKEN_LIST *candidate_list, UINT left_space); +UNI_TOKEN_LIST *SeparateStringByWidth(wchar_t *str, UINT width); +UINT GetNextWordWidth(wchar_t *str); +bool IsWordChar(wchar_t c); +void GetCommandHelpStr(char *command_name, wchar_t **description, wchar_t **args, wchar_t **help); +void GetCommandParamHelpStr(char *command_name, char *param_name, wchar_t **description); +bool CmdEvalMinMax(CONSOLE *c, wchar_t *str, void *param); +wchar_t *CmdPrompt(CONSOLE *c, void *param); +bool CmdEvalNotEmpty(CONSOLE *c, wchar_t *str, void *param); +bool CmdEvalInt1(CONSOLE *c, wchar_t *str, void *param); +bool CmdEvalIsFile(CONSOLE *c, wchar_t *str, void *param); +bool CmdEvalSafe(CONSOLE *c, wchar_t *str, void *param); +void PrintCmdHelp(CONSOLE *c, char *cmd_name, TOKEN_LIST *param_list); +int CompareCandidateStr(void *p1, void *p2); +bool IsHelpStr(char *str); + +CONSOLE *NewLocalConsole(wchar_t *infile, wchar_t *outfile); +void ConsoleLocalFree(CONSOLE *c); +wchar_t *ConsoleLocalReadLine(CONSOLE *c, wchar_t *prompt, bool nofile); +char *ConsoleLocalReadPassword(CONSOLE *c, wchar_t *prompt); +bool ConsoleLocalWrite(CONSOLE *c, wchar_t *str); +void ConsoleWriteOutFile(CONSOLE *c, wchar_t *str, bool add_last_crlf); +wchar_t *ConsoleReadNextFromInFile(CONSOLE *c); +UINT ConsoleLocalGetWidth(CONSOLE *c); + + +#endif // CONSOLE_H + + + diff --git a/src/Cedar/DDNS.c b/src/Cedar/DDNS.c index 5a2fec7b..bea28255 100644 --- a/src/Cedar/DDNS.c +++ b/src/Cedar/DDNS.c @@ -1,911 +1,911 @@ -// SoftEther VPN Source Code - Developer Edition Master Branch -// Cedar Communication Module - - -// DDNS.c -// Dynamic DNS Client - -#include "CedarPch.h" - -// Get the current status of the DDNS client -void DCGetStatus(DDNS_CLIENT *c, DDNS_CLIENT_STATUS *st) -{ - // Validate arguments - if (c == NULL || st == NULL) - { - return; - } - - Zero(st, sizeof(DDNS_CLIENT_STATUS)); - - Lock(c->Lock); - { - st->Err_IPv4 = c->Err_IPv4; - st->Err_IPv6 = c->Err_IPv6; - - StrCpy(st->CurrentHostName, sizeof(st->CurrentHostName), c->CurrentHostName); - StrCpy(st->CurrentFqdn, sizeof(st->CurrentFqdn), c->CurrentFqdn); - StrCpy(st->DnsSuffix, sizeof(st->DnsSuffix), c->DnsSuffix); - StrCpy(st->CurrentIPv4, sizeof(st->CurrentIPv4), c->CurrentIPv4); - StrCpy(st->CurrentIPv6, sizeof(st->CurrentIPv6), c->CurrentIPv6); - - StrCpy(st->CurrentAzureIp, sizeof(st->CurrentAzureIp), c->CurrentAzureIp); - st->CurrentAzureTimestamp = c->CurrentAzureTimestamp; - StrCpy(st->CurrentAzureSignature, sizeof(st->CurrentAzureSignature), c->CurrentAzureSignature); - StrCpy(st->AzureCertHash, sizeof(st->AzureCertHash), c->AzureCertHash); - - Copy(&st->InternetSetting, &c->InternetSetting, sizeof(INTERNET_SETTING)); - } - Unlock(c->Lock); - - UniStrCpy(st->ErrStr_IPv4, sizeof(st->ErrStr_IPv4), _E(st->Err_IPv4)); - UniStrCpy(st->ErrStr_IPv6, sizeof(st->ErrStr_IPv6), _E(st->Err_IPv6)); -} - -// Set the Internet settings -void DCSetInternetSetting(DDNS_CLIENT *c, INTERNET_SETTING *t) -{ - // Validate arguments - if (c == NULL || t == NULL) - { - return; - } - - Copy(&c->InternetSetting, t, sizeof(INTERNET_SETTING)); -} - -// Get the Internet settings -void DCGetInternetSetting(DDNS_CLIENT *c, INTERNET_SETTING *t) -{ - // Validate arguments - if (c == NULL || t == NULL) - { - return; - } - - Copy(t, &c->InternetSetting, sizeof(INTERNET_SETTING)); -} - -// Changing the host name -UINT DCChangeHostName(DDNS_CLIENT *c, char *hostname) -{ - UINT ret; - DDNS_REGISTER_PARAM p; - // Validate arguments - if (c == NULL || hostname == NULL) - { - return ERR_INTERNAL_ERROR; - } - - if (StrLen(hostname) > 32) - { - // The host name is too long - return ERR_DDNS_HOSTNAME_TOO_LONG; - } - - Zero(&p, sizeof(p)); - - StrCpy(p.NewHostname, sizeof(p.NewHostname), hostname); - - // Use one of IPv4 or IPv6 if it seems to be communication - if (c->Err_IPv4 == ERR_NO_ERROR) - { - // IPv4 - ret = DCRegister(c, false, &p, NULL); - } - else if (c->Err_IPv6 == ERR_NO_ERROR) - { - // IPv6 - ret = DCRegister(c, true, &p, NULL); - } - else - { - // Try both - ret = DCRegister(c, true, &p, NULL); - if (ret != ERR_NO_ERROR) - { - ret = DCRegister(c, false, &p, NULL); - } - } - - if (ret == ERR_NO_ERROR) - { - DDNS_CLIENT_STATUS st; - - DCGetStatus(c, &st); - - SiApplyAzureConfig(c->Cedar->Server, &st); - } - - return ret; -} - -// DDNS client thread -void DCThread(THREAD *thread, void *param) -{ - DDNS_CLIENT *c; - INTERRUPT_MANAGER *interrupt; - UINT last_ip_hash = 0; - void *route_change_poller = NULL; - bool last_time_ip_changed = false; - UINT last_azure_ddns_trigger_int = 0; - UINT last_vgs_ddns_trigger_int = 0; - UINT n; - INTERNET_SETTING last_t; - // Validate arguments - if (thread == NULL || param == NULL) - { - return; - } - - c = (DDNS_CLIENT *)param; - - interrupt = NewInterruptManager(); - - route_change_poller = NewRouteChange(); - IsRouteChanged(route_change_poller); - - Zero(&last_t, sizeof(last_t)); - - n = 0; - - while (c->Halt == false) - { - UINT ip_hash = GetHostIPAddressHash32(); - UINT interval; - UINT64 now = Tick64(); - bool ip_changed = false; - bool azure_client_triggered = false; - bool internet_setting_changed = false; - bool vgs_server_triggered = false; - - - if (c->Cedar->Server != NULL && c->Cedar->Server->AzureClient != NULL) - { - if (c->Cedar->Server->AzureClient->DDnsTriggerInt != last_azure_ddns_trigger_int) - { - azure_client_triggered = true; - last_azure_ddns_trigger_int = c->Cedar->Server->AzureClient->DDnsTriggerInt; - last_time_ip_changed = false; - Debug("DDNS Thread Triggered by AzureClient.\n"); - } - } - - if (Cmp(&last_t, &c->InternetSetting, sizeof(INTERNET_SETTING)) != 0) - { - Copy(&last_t, &c->InternetSetting, sizeof(INTERNET_SETTING)); - internet_setting_changed = true; - last_time_ip_changed = false; - } - - if (ip_hash != last_ip_hash) - { - last_time_ip_changed = false; - Debug("DDNS Thread Triggered by IP Hash Changed.\n"); - } - - if ((ip_hash != last_ip_hash) || (IsRouteChanged(route_change_poller)) || azure_client_triggered || internet_setting_changed || vgs_server_triggered) - { - if (last_time_ip_changed == false) - { - // Call all getting functions from the beginning if the routing - // table or the IP address of this host has changed - c->NextRegisterTick_IPv4 = 0; - c->NextRegisterTick_IPv6 = 0; - c->NextGetMyIpTick_IPv4 = 0; - c->NextGetMyIpTick_IPv6 = 0; - - last_ip_hash = ip_hash; - - last_time_ip_changed = true; - - ip_changed = true; - - Debug("DDNS Internet Condition Changed.\n"); - } - } - else - { - last_time_ip_changed = false; - } - - if ((n++) >= 1) - { - // Self IPv4 address acquisition - if (c->NextGetMyIpTick_IPv4 == 0 || now >= c->NextGetMyIpTick_IPv4) - { - UINT next_interval; - char ip[MAX_SIZE]; - - Zero(ip, sizeof(ip)); - c->Err_IPv4_GetMyIp = DCGetMyIp(c, false, ip, sizeof(ip), NULL); - - if (c->Err_IPv4_GetMyIp == ERR_NO_ERROR) - { - if (StrCmpi(c->LastMyIPv4, ip) != 0) - { - ip_changed = true; - StrCpy(c->LastMyIPv4, sizeof(c->LastMyIPv4), ip); - } - - next_interval = GenRandInterval(DDNS_GETMYIP_INTERVAL_OK_MIN, DDNS_GETMYIP_INTERVAL_OK_MAX); - } - else - { - if (IsEmptyStr(c->LastMyIPv4) == false) - { - ip_changed = true; - } - - Zero(c->LastMyIPv4, sizeof(c->LastMyIPv4)); - next_interval = GenRandInterval(DDNS_GETMYIP_INTERVAL_NG_MIN, DDNS_GETMYIP_INTERVAL_NG_MAX); - } - - c->NextGetMyIpTick_IPv4 = Tick64() + (UINT64)next_interval; - - AddInterrupt(interrupt, c->NextGetMyIpTick_IPv4); - } - - // Self IPv6 address acquisition - if (c->NextGetMyIpTick_IPv6 == 0 || now >= c->NextGetMyIpTick_IPv6) - { - UINT next_interval; - char ip[MAX_SIZE]; - - Zero(ip, sizeof(ip)); - c->Err_IPv6_GetMyIp = DCGetMyIp(c, true, ip, sizeof(ip), NULL); - - if (c->Err_IPv6_GetMyIp == ERR_NO_ERROR) - { - if (StrCmpi(c->LastMyIPv6, ip) != 0) - { - ip_changed = true; - StrCpy(c->LastMyIPv6, sizeof(c->LastMyIPv6), ip); - } - - next_interval = GenRandInterval(DDNS_GETMYIP_INTERVAL_OK_MIN, DDNS_GETMYIP_INTERVAL_OK_MAX); - } - else - { - if (IsEmptyStr(c->LastMyIPv6) == false) - { - ip_changed = true; - } - - Zero(c->LastMyIPv6, sizeof(c->LastMyIPv6)); - next_interval = GenRandInterval(DDNS_GETMYIP_INTERVAL_NG_MIN, DDNS_GETMYIP_INTERVAL_NG_MAX); - } - - c->NextGetMyIpTick_IPv6 = Tick64() + (UINT64)next_interval; - - AddInterrupt(interrupt, c->NextGetMyIpTick_IPv6); - } - } - - if (ip_changed) - { - c->NextRegisterTick_IPv4 = 0; - c->NextRegisterTick_IPv6 = 0; - } - - // IPv4 host registration - if (c->NextRegisterTick_IPv4 == 0 || now >= c->NextRegisterTick_IPv4) - { - UINT next_interval; - - c->Err_IPv4 = DCRegister(c, false, NULL, NULL); - - if (c->Err_IPv4 == ERR_NO_ERROR) - { - next_interval = GenRandInterval(DDNS_REGISTER_INTERVAL_OK_MIN, DDNS_REGISTER_INTERVAL_OK_MAX); - } - else - { - next_interval = GenRandInterval(DDNS_REGISTER_INTERVAL_NG_MIN, DDNS_REGISTER_INTERVAL_NG_MAX); - } - //next_interval = 0; - - c->NextRegisterTick_IPv4 = Tick64() + (UINT64)next_interval; - - if (true) - { - DDNS_CLIENT_STATUS st; - - DCGetStatus(c, &st); - - SiApplyAzureConfig(c->Cedar->Server, &st); - } - - AddInterrupt(interrupt, c->NextRegisterTick_IPv4); - } - - if (c->Halt) - { - break; - } - - // IPv6 host registration - if (c->NextRegisterTick_IPv6 == 0 || now >= c->NextRegisterTick_IPv6) - { - UINT next_interval; - - c->Err_IPv6 = DCRegister(c, true, NULL, NULL); - - if (c->Err_IPv6 == ERR_NO_ERROR) - { - next_interval = GenRandInterval(DDNS_REGISTER_INTERVAL_OK_MIN, DDNS_REGISTER_INTERVAL_OK_MAX); - } - else - { - next_interval = GenRandInterval(DDNS_REGISTER_INTERVAL_NG_MIN, DDNS_REGISTER_INTERVAL_NG_MAX); - } - - c->NextRegisterTick_IPv6 = Tick64() + (UINT64)next_interval; - - if (true) - { - DDNS_CLIENT_STATUS st; - - DCGetStatus(c, &st); - - SiApplyAzureConfig(c->Cedar->Server, &st); - } - - AddInterrupt(interrupt, c->NextRegisterTick_IPv6); - } - - interval = GetNextIntervalForInterrupt(interrupt); - interval = MIN(interval, 1234); - - if (n == 1) - { - interval = 0; - } - - if (c->Halt) - { - break; - } - - if (c->KeyChanged) - { - c->KeyChanged = false; - c->NextRegisterTick_IPv4 = c->NextRegisterTick_IPv6 = 0; - - interval = 0; - } - - if (last_time_ip_changed) - { - if (c->Cedar->Server != NULL && c->Cedar->Server->AzureClient != NULL) - { - c->Cedar->Server->AzureClient->IpStatusRevision++; - } - } - - Wait(c->Event, interval); - } - - FreeRouteChange(route_change_poller); - FreeInterruptManager(interrupt); -} - -// Execution of registration -UINT DCRegister(DDNS_CLIENT *c, bool ipv6, DDNS_REGISTER_PARAM *p, char *replace_v6) -{ - char *url; - char url2[MAX_SIZE]; - char url3[MAX_SIZE]; - PACK *req, *ret; - char key_str[MAX_SIZE]; - UCHAR machine_key[SHA1_SIZE]; - char machine_key_str[MAX_SIZE]; - char machine_name[MAX_SIZE]; - BUF *cert_hash = NULL; - UINT err = ERR_INTERNAL_ERROR; - UCHAR key_hash[SHA1_SIZE]; - char key_hash_str[MAX_SIZE]; - bool use_azure = false; - char current_azure_ip[MAX_SIZE]; - INTERNET_SETTING t; - UINT build = 0; - char add_header_name[64]; - char add_header_value[64]; - // Validate arguments - if (c == NULL) - { - return ERR_INTERNAL_ERROR; - } - - Zero(add_header_name, sizeof(add_header_name)); - Zero(add_header_value, sizeof(add_header_value)); - - Zero(current_azure_ip, sizeof(current_azure_ip)); - - GetCurrentMachineIpProcessHash(machine_key); - BinToStr(machine_key_str, sizeof(machine_key_str), machine_key, sizeof(machine_key)); - - GetMachineHostName(machine_name, sizeof(machine_name)); - StrLower(machine_name); - - if (ipv6 == false) - { - url = DDNS_URL_V4_GLOBAL; - - if (IsUseAlternativeHostname()) - { - url = DDNS_URL_V4_ALT; - } - } - else - { - url = DDNS_URL_V6_GLOBAL; - - if (IsUseAlternativeHostname()) - { - url = DDNS_URL_V6_ALT; - } - - if (replace_v6) - { - url = replace_v6; - } - } - - Zero(&t, sizeof(t)); - if (ipv6 == false) - { - // Proxy Setting - Copy(&t, &c->InternetSetting, sizeof(INTERNET_SETTING)); - } - - if (ipv6 == false) - { - // Get the current status of the VPN Azure Client - if (c->Cedar->Server != NULL) - { - AZURE_CLIENT *ac = c->Cedar->Server->AzureClient; - - if (ac != NULL) - { - use_azure = SiIsAzureEnabled(c->Cedar->Server); - - if (use_azure) - { - Lock(ac->Lock); - { - StrCpy(current_azure_ip, sizeof(current_azure_ip), ac->ConnectingAzureIp); - } - Unlock(ac->Lock); - } - } - } - } - - req = NewPack(); - BinToStr(key_str, sizeof(key_str), c->Key, sizeof(c->Key)); - StrUpper(key_str); - PackAddStr(req, "key", key_str); - - // Build Number - build = c->Cedar->Build; - - - PackAddInt(req, "build", build); - PackAddInt(req, "osinfo", GetOsInfo()->OsType); - PackAddInt(req, "is_64bit", Is64()); -#ifdef OS_WIN32 - PackAddInt(req, "is_windows_64bit", MsIs64BitWindows()); -#endif // OS_WIN32 - PackAddBool(req, "is_softether", true); - PackAddBool(req, "is_packetix", false); - PackAddStr(req, "machine_key", machine_key_str); - PackAddStr(req, "machine_name", machine_name); - PackAddInt(req, "lasterror_ipv4", c->Err_IPv4_GetMyIp); - PackAddInt(req, "lasterror_ipv6", c->Err_IPv6_GetMyIp); - PackAddBool(req, "use_azure", use_azure); - PackAddStr(req, "product_str", "SoftEther OSS"); - PackAddInt(req, "ddns_protocol_version", DDNS_VERSION); - PackAddInt(req, "ddns_oss", 1); - - - if (use_azure) - { - Debug("current_azure_ip = %s\n", current_azure_ip); - PackAddStr(req, "current_azure_ip", current_azure_ip); - } - - Sha1(key_hash, key_str, StrLen(key_str)); - BinToStr(key_hash_str, sizeof(key_hash_str), key_hash, sizeof(key_hash)); - StrLower(key_hash_str); - - if (p != NULL) - { - if (IsEmptyStr(p->NewHostname) == false) - { - PackAddStr(req, "new_hostname", p->NewHostname); - } - } - - - - Format(url2, sizeof(url2), "%s?v=%I64u", url, Rand64()); - Format(url3, sizeof(url3), url2, key_hash_str[2], key_hash_str[3]); - - ReplaceStr(url3, sizeof(url3), url3, "https://", "http://"); - - ReplaceStr(url3, sizeof(url3), url3, ".servers", ".open.servers"); - - cert_hash = StrToBin(DDNS_CERT_HASH); - - Debug("WpcCall: %s\n", url3); - ret = WpcCallEx2(url3, &t, DDNS_CONNECT_TIMEOUT, DDNS_COMM_TIMEOUT, "register", req, - NULL, NULL, ((cert_hash != NULL && ((cert_hash->Size % SHA1_SIZE) == 0)) ? cert_hash->Buf : NULL), - (cert_hash != NULL ? cert_hash->Size / SHA1_SIZE : 0), - NULL, DDNS_RPC_MAX_RECV_SIZE, - add_header_name, add_header_value, - DDNS_SNI_VER_STRING); - Debug("WpcCall Ret: %u\n", ret); - - FreeBuf(cert_hash); - - FreePack(req); - - err = GetErrorFromPack(ret); - - ExtractAndApplyDynList(ret); - - // Status update - Lock(c->Lock); - { - if (err == ERR_NO_ERROR) - { - char snat_t[MAX_SIZE]; - char current_region[128]; - - // Current host name - PackGetStr(ret, "current_hostname", c->CurrentHostName, sizeof(c->CurrentHostName)); - PackGetStr(ret, "current_fqdn", c->CurrentFqdn, sizeof(c->CurrentFqdn)); - PackGetStr(ret, "current_ipv4", c->CurrentIPv4, sizeof(c->CurrentIPv4)); - PackGetStr(ret, "current_ipv6", c->CurrentIPv6, sizeof(c->CurrentIPv6)); - PackGetStr(ret, "dns_suffix", c->DnsSuffix, sizeof(c->DnsSuffix)); - PackGetStr(ret, "current_region", current_region, sizeof(current_region)); - - // SecureNAT connectivity check parameters - Zero(snat_t, sizeof(snat_t)); - PackGetStr(ret, "snat_t", snat_t, sizeof(snat_t)); - NnSetSecureNatTargetHostname(snat_t); - - if (ipv6 == false) - { - char cert_hash[MAX_SIZE]; - - PackGetStr(ret, "current_azure_ip", c->CurrentAzureIp, sizeof(c->CurrentAzureIp)); - c->CurrentAzureTimestamp = PackGetInt64(ret, "current_azure_timestamp"); - PackGetStr(ret, "current_azure_signature", c->CurrentAzureSignature, sizeof(c->CurrentAzureSignature)); - - Zero(cert_hash, sizeof(cert_hash)); - PackGetStr(ret, "azure_cert_hash", cert_hash, sizeof(cert_hash)); - - if (IsEmptyStr(cert_hash) == false) - { - StrCpy(c->AzureCertHash, sizeof(c->AzureCertHash), cert_hash); - } - } - - StrCpy(c->Cedar->CurrentDDnsFqdn, sizeof(c->Cedar->CurrentDDnsFqdn), c->CurrentFqdn); - - Debug("current_hostname=%s, current_fqdn=%s, current_ipv4=%s, current_ipv6=%s, current_azure_ip=%s, CurrentAzureTimestamp=%I64u, CurrentAzureSignature=%s, CertHash=%s\n", - c->CurrentHostName, c->CurrentFqdn, - c->CurrentIPv4, c->CurrentIPv6, - c->CurrentAzureIp, c->CurrentAzureTimestamp, c->CurrentAzureSignature, c->AzureCertHash); - - if (IsEmptyStr(current_region) == false) - { - // Update the current region - SiUpdateCurrentRegion(c->Cedar, current_region, false); - } - } - } - Unlock(c->Lock); - - if (IsEmptyStr(c->CurrentFqdn) == false) - { - SetCurrentDDnsFqdn(c->CurrentFqdn); - } - - - FreePack(ret); - - UniDebug(L"DCRegister Error: %s\n", _E(err)); - - if (err == ERR_DUPLICATE_DDNS_KEY) - { - // Key duplication - DCGenNewKey(c->Key); - c->KeyChanged = true; - } - - if (err == ERR_DISCONNECTED) - { - err = ERR_DDNS_DISCONNECTED; - } - - if (IsUseAlternativeHostname() == false) - { - if (err == ERR_CONNECT_FAILED) - { - if (ipv6 && replace_v6 == NULL) - { - UINT type = DetectFletsType(); - - if (type & FLETS_DETECT_TYPE_EAST_BFLETS_PRIVATE && err != ERR_NO_ERROR) - { - err = DCRegister(c, ipv6, p, DDNS_REPLACE_URL_FOR_EAST_BFLETS); - } - - if (type & FLETS_DETECT_TYPE_EAST_NGN_PRIVATE && err != ERR_NO_ERROR) - { - err = DCRegister(c, ipv6, p, DDNS_REPLACE_URL_FOR_EAST_NGN); - } - - if (type & FLETS_DETECT_TYPE_WEST_NGN_PRIVATE && err != ERR_NO_ERROR) - { - err = DCRegister(c, ipv6, p, DDNS_REPLACE_URL_FOR_WEST_NGN); - } - } - } - } - - return err; -} - -// Get the self IP address -UINT DCGetMyIp(DDNS_CLIENT *c, bool ipv6, char *dst, UINT dst_size, char *replace_v6) -{ - UINT ret = ERR_INTERNAL_ERROR; - - ret = DCGetMyIpMain(c, ipv6, dst, dst_size, false, replace_v6); - - - if (ret == ERR_NO_ERROR) - { - IP ip; - - if (StrToIP(&ip, dst)) - { - if (ipv6 == false && IsIP4(&ip)) - { - SetCurrentGlobalIP(&ip, false); - } - else if (ipv6 && IsIP6(&ip)) - { - SetCurrentGlobalIP(&ip, true); - } - } - } - - return ret; -} -UINT DCGetMyIpMain(DDNS_CLIENT *c, bool ipv6, char *dst, UINT dst_size, bool use_ssl, char *replace_v6) -{ - char *url; - char url2[MAX_SIZE]; - UINT ret = ERR_INTERNAL_ERROR; - URL_DATA data; - BUF *recv; - BUF *cert_hash = NULL; - // Validate arguments - if (dst == NULL || c == NULL) - { - return ERR_INTERNAL_ERROR; - } - - if (ipv6 == false) - { - url = DDNS_URL2_V4_GLOBAL; - - if (IsUseAlternativeHostname()) - { - url = DDNS_URL2_V4_ALT; - } - } - else - { - url = DDNS_URL2_V6_GLOBAL; - - if (IsUseAlternativeHostname()) - { - url = DDNS_URL2_V6_ALT; - } - - if (replace_v6) - { - url = replace_v6; - } - } - - Format(url2, sizeof(url2), "%s?v=%I64u", url, Rand64()); - - if (use_ssl) - { - ReplaceStr(url2, sizeof(url2), url2, "http://", "https://"); - } - - - if (ParseUrl(&data, url2, false, NULL) == false) - { - return ERR_INTERNAL_ERROR; - } - - cert_hash = StrToBin(DDNS_CERT_HASH); - - StrCpy(data.SniString, sizeof(data.SniString), DDNS_SNI_VER_STRING); - - recv = HttpRequestEx3(&data, (ipv6 ? NULL : &c->InternetSetting), DDNS_CONNECT_TIMEOUT, DDNS_COMM_TIMEOUT, &ret, false, NULL, NULL, - NULL, ((cert_hash != NULL && (cert_hash->Size % SHA1_SIZE) == 0) ? cert_hash->Buf : NULL), - (cert_hash != NULL ? cert_hash->Size / SHA1_SIZE : 0), NULL, 0, NULL, NULL); - - FreeBuf(cert_hash); - - if (recv != NULL) - { - char *str = ZeroMalloc(recv->Size + 1); - Copy(str, recv->Buf, recv->Size); - - if (StartWith(str, "IP=") == false) - { - ret = ERR_PROTOCOL_ERROR; - } - else - { - StrCpy(dst, dst_size, str + 3); - ret = ERR_NO_ERROR; - } - - Free(str); - FreeBuf(recv); - } - - if (IsUseAlternativeHostname() == false) - { - if (ret == ERR_CONNECT_FAILED) - { - if (ipv6 && replace_v6 == NULL && use_ssl == false) - { - UINT type = DetectFletsType(); - - if (type & FLETS_DETECT_TYPE_EAST_BFLETS_PRIVATE && ret != ERR_NO_ERROR) - { - ret = DCGetMyIpMain(c, ipv6, dst, dst_size, use_ssl, DDNS_REPLACE_URL2_FOR_EAST_BFLETS); - } - - if (type & FLETS_DETECT_TYPE_EAST_NGN_PRIVATE && ret != ERR_NO_ERROR) - { - ret = DCGetMyIpMain(c, ipv6, dst, dst_size, use_ssl, DDNS_REPLACE_URL2_FOR_EAST_NGN); - } - - if (type & FLETS_DETECT_TYPE_WEST_NGN_PRIVATE && ret != ERR_NO_ERROR) - { - ret = DCGetMyIpMain(c, ipv6, dst, dst_size, use_ssl, DDNS_REPLACE_URL2_FOR_WEST_NGN); - } - } - } - } - - return ret; -} - - -// Creating a DDNS client -DDNS_CLIENT *NewDDNSClient(CEDAR *cedar, UCHAR *key, INTERNET_SETTING *t) -{ - DDNS_CLIENT *c; - UCHAR key_hash[SHA1_SIZE]; - // Validate arguments - if (cedar == NULL) - { - return NULL; - } - - c = ZeroMalloc(sizeof(DDNS_CLIENT)); - c->Cedar = cedar; - AddRef(c->Cedar->ref); - - c->Err_IPv4 = c->Err_IPv6 = ERR_TRYING_TO_CONNECT; - - if (key == NULL) - { - // Create a new key - DCGenNewKey(c->Key); - } - else - { - // Set the key - Copy(c->Key, key, SHA1_SIZE); - } - - Sha1(key_hash, c->Key, sizeof(c->Key)); - - - if (t != NULL) - { - Copy(&c->InternetSetting, t, sizeof(INTERNET_SETTING)); - } - - c->Lock = NewLock(); - - // Thread creation - c->Event = NewEvent(); - c->Thread = NewThread(DCThread, c); - - return c; -} - -// Release of DDNS client -void FreeDDNSClient(DDNS_CLIENT *c) -{ - // Validate arguments - if (c == NULL) - { - return; - } - - // Stop the thread - c->Halt = true; - Set(c->Event); - - WaitThread(c->Thread, INFINITE); - ReleaseThread(c->Thread); - - ReleaseEvent(c->Event); - - ReleaseCedar(c->Cedar); - DeleteLock(c->Lock); - - Free(c); -} - -// Create a new key -void DCGenNewKey(UCHAR *key) -{ - BUF *b; - UINT64 tick; - UCHAR hash[SHA1_SIZE]; - UCHAR rand[SHA1_SIZE]; - UINT i; - // Validate arguments - if (key == NULL) - { - return; - } - - b = NewBuf(); - - Rand(rand, sizeof(rand)); - WriteBuf(b, rand, sizeof(rand)); - - tick = TickHighres64(); - WriteBufInt64(b, tick); - - tick = Tick64(); - WriteBufInt64(b, tick); - - tick = SystemTime64(); - WriteBufInt64(b, tick); - - GetCurrentMachineIpProcessHash(hash); - WriteBuf(b, hash, sizeof(hash)); - - Sha1(key, b->Buf, b->Size); - Rand(rand, sizeof(rand)); - - for (i = 0;i < SHA1_SIZE;i++) - { - key[i] = key[i] ^ rand[i]; - } - - FreeBuf(b); -} - - +// SoftEther VPN Source Code - Developer Edition Master Branch +// Cedar Communication Module + + +// DDNS.c +// Dynamic DNS Client + +#include "CedarPch.h" + +// Get the current status of the DDNS client +void DCGetStatus(DDNS_CLIENT *c, DDNS_CLIENT_STATUS *st) +{ + // Validate arguments + if (c == NULL || st == NULL) + { + return; + } + + Zero(st, sizeof(DDNS_CLIENT_STATUS)); + + Lock(c->Lock); + { + st->Err_IPv4 = c->Err_IPv4; + st->Err_IPv6 = c->Err_IPv6; + + StrCpy(st->CurrentHostName, sizeof(st->CurrentHostName), c->CurrentHostName); + StrCpy(st->CurrentFqdn, sizeof(st->CurrentFqdn), c->CurrentFqdn); + StrCpy(st->DnsSuffix, sizeof(st->DnsSuffix), c->DnsSuffix); + StrCpy(st->CurrentIPv4, sizeof(st->CurrentIPv4), c->CurrentIPv4); + StrCpy(st->CurrentIPv6, sizeof(st->CurrentIPv6), c->CurrentIPv6); + + StrCpy(st->CurrentAzureIp, sizeof(st->CurrentAzureIp), c->CurrentAzureIp); + st->CurrentAzureTimestamp = c->CurrentAzureTimestamp; + StrCpy(st->CurrentAzureSignature, sizeof(st->CurrentAzureSignature), c->CurrentAzureSignature); + StrCpy(st->AzureCertHash, sizeof(st->AzureCertHash), c->AzureCertHash); + + Copy(&st->InternetSetting, &c->InternetSetting, sizeof(INTERNET_SETTING)); + } + Unlock(c->Lock); + + UniStrCpy(st->ErrStr_IPv4, sizeof(st->ErrStr_IPv4), _E(st->Err_IPv4)); + UniStrCpy(st->ErrStr_IPv6, sizeof(st->ErrStr_IPv6), _E(st->Err_IPv6)); +} + +// Set the Internet settings +void DCSetInternetSetting(DDNS_CLIENT *c, INTERNET_SETTING *t) +{ + // Validate arguments + if (c == NULL || t == NULL) + { + return; + } + + Copy(&c->InternetSetting, t, sizeof(INTERNET_SETTING)); +} + +// Get the Internet settings +void DCGetInternetSetting(DDNS_CLIENT *c, INTERNET_SETTING *t) +{ + // Validate arguments + if (c == NULL || t == NULL) + { + return; + } + + Copy(t, &c->InternetSetting, sizeof(INTERNET_SETTING)); +} + +// Changing the host name +UINT DCChangeHostName(DDNS_CLIENT *c, char *hostname) +{ + UINT ret; + DDNS_REGISTER_PARAM p; + // Validate arguments + if (c == NULL || hostname == NULL) + { + return ERR_INTERNAL_ERROR; + } + + if (StrLen(hostname) > 32) + { + // The host name is too long + return ERR_DDNS_HOSTNAME_TOO_LONG; + } + + Zero(&p, sizeof(p)); + + StrCpy(p.NewHostname, sizeof(p.NewHostname), hostname); + + // Use one of IPv4 or IPv6 if it seems to be communication + if (c->Err_IPv4 == ERR_NO_ERROR) + { + // IPv4 + ret = DCRegister(c, false, &p, NULL); + } + else if (c->Err_IPv6 == ERR_NO_ERROR) + { + // IPv6 + ret = DCRegister(c, true, &p, NULL); + } + else + { + // Try both + ret = DCRegister(c, true, &p, NULL); + if (ret != ERR_NO_ERROR) + { + ret = DCRegister(c, false, &p, NULL); + } + } + + if (ret == ERR_NO_ERROR) + { + DDNS_CLIENT_STATUS st; + + DCGetStatus(c, &st); + + SiApplyAzureConfig(c->Cedar->Server, &st); + } + + return ret; +} + +// DDNS client thread +void DCThread(THREAD *thread, void *param) +{ + DDNS_CLIENT *c; + INTERRUPT_MANAGER *interrupt; + UINT last_ip_hash = 0; + void *route_change_poller = NULL; + bool last_time_ip_changed = false; + UINT last_azure_ddns_trigger_int = 0; + UINT last_vgs_ddns_trigger_int = 0; + UINT n; + INTERNET_SETTING last_t; + // Validate arguments + if (thread == NULL || param == NULL) + { + return; + } + + c = (DDNS_CLIENT *)param; + + interrupt = NewInterruptManager(); + + route_change_poller = NewRouteChange(); + IsRouteChanged(route_change_poller); + + Zero(&last_t, sizeof(last_t)); + + n = 0; + + while (c->Halt == false) + { + UINT ip_hash = GetHostIPAddressHash32(); + UINT interval; + UINT64 now = Tick64(); + bool ip_changed = false; + bool azure_client_triggered = false; + bool internet_setting_changed = false; + bool vgs_server_triggered = false; + + + if (c->Cedar->Server != NULL && c->Cedar->Server->AzureClient != NULL) + { + if (c->Cedar->Server->AzureClient->DDnsTriggerInt != last_azure_ddns_trigger_int) + { + azure_client_triggered = true; + last_azure_ddns_trigger_int = c->Cedar->Server->AzureClient->DDnsTriggerInt; + last_time_ip_changed = false; + Debug("DDNS Thread Triggered by AzureClient.\n"); + } + } + + if (Cmp(&last_t, &c->InternetSetting, sizeof(INTERNET_SETTING)) != 0) + { + Copy(&last_t, &c->InternetSetting, sizeof(INTERNET_SETTING)); + internet_setting_changed = true; + last_time_ip_changed = false; + } + + if (ip_hash != last_ip_hash) + { + last_time_ip_changed = false; + Debug("DDNS Thread Triggered by IP Hash Changed.\n"); + } + + if ((ip_hash != last_ip_hash) || (IsRouteChanged(route_change_poller)) || azure_client_triggered || internet_setting_changed || vgs_server_triggered) + { + if (last_time_ip_changed == false) + { + // Call all getting functions from the beginning if the routing + // table or the IP address of this host has changed + c->NextRegisterTick_IPv4 = 0; + c->NextRegisterTick_IPv6 = 0; + c->NextGetMyIpTick_IPv4 = 0; + c->NextGetMyIpTick_IPv6 = 0; + + last_ip_hash = ip_hash; + + last_time_ip_changed = true; + + ip_changed = true; + + Debug("DDNS Internet Condition Changed.\n"); + } + } + else + { + last_time_ip_changed = false; + } + + if ((n++) >= 1) + { + // Self IPv4 address acquisition + if (c->NextGetMyIpTick_IPv4 == 0 || now >= c->NextGetMyIpTick_IPv4) + { + UINT next_interval; + char ip[MAX_SIZE]; + + Zero(ip, sizeof(ip)); + c->Err_IPv4_GetMyIp = DCGetMyIp(c, false, ip, sizeof(ip), NULL); + + if (c->Err_IPv4_GetMyIp == ERR_NO_ERROR) + { + if (StrCmpi(c->LastMyIPv4, ip) != 0) + { + ip_changed = true; + StrCpy(c->LastMyIPv4, sizeof(c->LastMyIPv4), ip); + } + + next_interval = GenRandInterval(DDNS_GETMYIP_INTERVAL_OK_MIN, DDNS_GETMYIP_INTERVAL_OK_MAX); + } + else + { + if (IsEmptyStr(c->LastMyIPv4) == false) + { + ip_changed = true; + } + + Zero(c->LastMyIPv4, sizeof(c->LastMyIPv4)); + next_interval = GenRandInterval(DDNS_GETMYIP_INTERVAL_NG_MIN, DDNS_GETMYIP_INTERVAL_NG_MAX); + } + + c->NextGetMyIpTick_IPv4 = Tick64() + (UINT64)next_interval; + + AddInterrupt(interrupt, c->NextGetMyIpTick_IPv4); + } + + // Self IPv6 address acquisition + if (c->NextGetMyIpTick_IPv6 == 0 || now >= c->NextGetMyIpTick_IPv6) + { + UINT next_interval; + char ip[MAX_SIZE]; + + Zero(ip, sizeof(ip)); + c->Err_IPv6_GetMyIp = DCGetMyIp(c, true, ip, sizeof(ip), NULL); + + if (c->Err_IPv6_GetMyIp == ERR_NO_ERROR) + { + if (StrCmpi(c->LastMyIPv6, ip) != 0) + { + ip_changed = true; + StrCpy(c->LastMyIPv6, sizeof(c->LastMyIPv6), ip); + } + + next_interval = GenRandInterval(DDNS_GETMYIP_INTERVAL_OK_MIN, DDNS_GETMYIP_INTERVAL_OK_MAX); + } + else + { + if (IsEmptyStr(c->LastMyIPv6) == false) + { + ip_changed = true; + } + + Zero(c->LastMyIPv6, sizeof(c->LastMyIPv6)); + next_interval = GenRandInterval(DDNS_GETMYIP_INTERVAL_NG_MIN, DDNS_GETMYIP_INTERVAL_NG_MAX); + } + + c->NextGetMyIpTick_IPv6 = Tick64() + (UINT64)next_interval; + + AddInterrupt(interrupt, c->NextGetMyIpTick_IPv6); + } + } + + if (ip_changed) + { + c->NextRegisterTick_IPv4 = 0; + c->NextRegisterTick_IPv6 = 0; + } + + // IPv4 host registration + if (c->NextRegisterTick_IPv4 == 0 || now >= c->NextRegisterTick_IPv4) + { + UINT next_interval; + + c->Err_IPv4 = DCRegister(c, false, NULL, NULL); + + if (c->Err_IPv4 == ERR_NO_ERROR) + { + next_interval = GenRandInterval(DDNS_REGISTER_INTERVAL_OK_MIN, DDNS_REGISTER_INTERVAL_OK_MAX); + } + else + { + next_interval = GenRandInterval(DDNS_REGISTER_INTERVAL_NG_MIN, DDNS_REGISTER_INTERVAL_NG_MAX); + } + //next_interval = 0; + + c->NextRegisterTick_IPv4 = Tick64() + (UINT64)next_interval; + + if (true) + { + DDNS_CLIENT_STATUS st; + + DCGetStatus(c, &st); + + SiApplyAzureConfig(c->Cedar->Server, &st); + } + + AddInterrupt(interrupt, c->NextRegisterTick_IPv4); + } + + if (c->Halt) + { + break; + } + + // IPv6 host registration + if (c->NextRegisterTick_IPv6 == 0 || now >= c->NextRegisterTick_IPv6) + { + UINT next_interval; + + c->Err_IPv6 = DCRegister(c, true, NULL, NULL); + + if (c->Err_IPv6 == ERR_NO_ERROR) + { + next_interval = GenRandInterval(DDNS_REGISTER_INTERVAL_OK_MIN, DDNS_REGISTER_INTERVAL_OK_MAX); + } + else + { + next_interval = GenRandInterval(DDNS_REGISTER_INTERVAL_NG_MIN, DDNS_REGISTER_INTERVAL_NG_MAX); + } + + c->NextRegisterTick_IPv6 = Tick64() + (UINT64)next_interval; + + if (true) + { + DDNS_CLIENT_STATUS st; + + DCGetStatus(c, &st); + + SiApplyAzureConfig(c->Cedar->Server, &st); + } + + AddInterrupt(interrupt, c->NextRegisterTick_IPv6); + } + + interval = GetNextIntervalForInterrupt(interrupt); + interval = MIN(interval, 1234); + + if (n == 1) + { + interval = 0; + } + + if (c->Halt) + { + break; + } + + if (c->KeyChanged) + { + c->KeyChanged = false; + c->NextRegisterTick_IPv4 = c->NextRegisterTick_IPv6 = 0; + + interval = 0; + } + + if (last_time_ip_changed) + { + if (c->Cedar->Server != NULL && c->Cedar->Server->AzureClient != NULL) + { + c->Cedar->Server->AzureClient->IpStatusRevision++; + } + } + + Wait(c->Event, interval); + } + + FreeRouteChange(route_change_poller); + FreeInterruptManager(interrupt); +} + +// Execution of registration +UINT DCRegister(DDNS_CLIENT *c, bool ipv6, DDNS_REGISTER_PARAM *p, char *replace_v6) +{ + char *url; + char url2[MAX_SIZE]; + char url3[MAX_SIZE]; + PACK *req, *ret; + char key_str[MAX_SIZE]; + UCHAR machine_key[SHA1_SIZE]; + char machine_key_str[MAX_SIZE]; + char machine_name[MAX_SIZE]; + BUF *cert_hash = NULL; + UINT err = ERR_INTERNAL_ERROR; + UCHAR key_hash[SHA1_SIZE]; + char key_hash_str[MAX_SIZE]; + bool use_azure = false; + char current_azure_ip[MAX_SIZE]; + INTERNET_SETTING t; + UINT build = 0; + char add_header_name[64]; + char add_header_value[64]; + // Validate arguments + if (c == NULL) + { + return ERR_INTERNAL_ERROR; + } + + Zero(add_header_name, sizeof(add_header_name)); + Zero(add_header_value, sizeof(add_header_value)); + + Zero(current_azure_ip, sizeof(current_azure_ip)); + + GetCurrentMachineIpProcessHash(machine_key); + BinToStr(machine_key_str, sizeof(machine_key_str), machine_key, sizeof(machine_key)); + + GetMachineHostName(machine_name, sizeof(machine_name)); + StrLower(machine_name); + + if (ipv6 == false) + { + url = DDNS_URL_V4_GLOBAL; + + if (IsUseAlternativeHostname()) + { + url = DDNS_URL_V4_ALT; + } + } + else + { + url = DDNS_URL_V6_GLOBAL; + + if (IsUseAlternativeHostname()) + { + url = DDNS_URL_V6_ALT; + } + + if (replace_v6) + { + url = replace_v6; + } + } + + Zero(&t, sizeof(t)); + if (ipv6 == false) + { + // Proxy Setting + Copy(&t, &c->InternetSetting, sizeof(INTERNET_SETTING)); + } + + if (ipv6 == false) + { + // Get the current status of the VPN Azure Client + if (c->Cedar->Server != NULL) + { + AZURE_CLIENT *ac = c->Cedar->Server->AzureClient; + + if (ac != NULL) + { + use_azure = SiIsAzureEnabled(c->Cedar->Server); + + if (use_azure) + { + Lock(ac->Lock); + { + StrCpy(current_azure_ip, sizeof(current_azure_ip), ac->ConnectingAzureIp); + } + Unlock(ac->Lock); + } + } + } + } + + req = NewPack(); + BinToStr(key_str, sizeof(key_str), c->Key, sizeof(c->Key)); + StrUpper(key_str); + PackAddStr(req, "key", key_str); + + // Build Number + build = c->Cedar->Build; + + + PackAddInt(req, "build", build); + PackAddInt(req, "osinfo", GetOsInfo()->OsType); + PackAddInt(req, "is_64bit", Is64()); +#ifdef OS_WIN32 + PackAddInt(req, "is_windows_64bit", MsIs64BitWindows()); +#endif // OS_WIN32 + PackAddBool(req, "is_softether", true); + PackAddBool(req, "is_packetix", false); + PackAddStr(req, "machine_key", machine_key_str); + PackAddStr(req, "machine_name", machine_name); + PackAddInt(req, "lasterror_ipv4", c->Err_IPv4_GetMyIp); + PackAddInt(req, "lasterror_ipv6", c->Err_IPv6_GetMyIp); + PackAddBool(req, "use_azure", use_azure); + PackAddStr(req, "product_str", "SoftEther OSS"); + PackAddInt(req, "ddns_protocol_version", DDNS_VERSION); + PackAddInt(req, "ddns_oss", 1); + + + if (use_azure) + { + Debug("current_azure_ip = %s\n", current_azure_ip); + PackAddStr(req, "current_azure_ip", current_azure_ip); + } + + Sha1(key_hash, key_str, StrLen(key_str)); + BinToStr(key_hash_str, sizeof(key_hash_str), key_hash, sizeof(key_hash)); + StrLower(key_hash_str); + + if (p != NULL) + { + if (IsEmptyStr(p->NewHostname) == false) + { + PackAddStr(req, "new_hostname", p->NewHostname); + } + } + + + + Format(url2, sizeof(url2), "%s?v=%I64u", url, Rand64()); + Format(url3, sizeof(url3), url2, key_hash_str[2], key_hash_str[3]); + + ReplaceStr(url3, sizeof(url3), url3, "https://", "http://"); + + ReplaceStr(url3, sizeof(url3), url3, ".servers", ".open.servers"); + + cert_hash = StrToBin(DDNS_CERT_HASH); + + Debug("WpcCall: %s\n", url3); + ret = WpcCallEx2(url3, &t, DDNS_CONNECT_TIMEOUT, DDNS_COMM_TIMEOUT, "register", req, + NULL, NULL, ((cert_hash != NULL && ((cert_hash->Size % SHA1_SIZE) == 0)) ? cert_hash->Buf : NULL), + (cert_hash != NULL ? cert_hash->Size / SHA1_SIZE : 0), + NULL, DDNS_RPC_MAX_RECV_SIZE, + add_header_name, add_header_value, + DDNS_SNI_VER_STRING); + Debug("WpcCall Ret: %u\n", ret); + + FreeBuf(cert_hash); + + FreePack(req); + + err = GetErrorFromPack(ret); + + ExtractAndApplyDynList(ret); + + // Status update + Lock(c->Lock); + { + if (err == ERR_NO_ERROR) + { + char snat_t[MAX_SIZE]; + char current_region[128]; + + // Current host name + PackGetStr(ret, "current_hostname", c->CurrentHostName, sizeof(c->CurrentHostName)); + PackGetStr(ret, "current_fqdn", c->CurrentFqdn, sizeof(c->CurrentFqdn)); + PackGetStr(ret, "current_ipv4", c->CurrentIPv4, sizeof(c->CurrentIPv4)); + PackGetStr(ret, "current_ipv6", c->CurrentIPv6, sizeof(c->CurrentIPv6)); + PackGetStr(ret, "dns_suffix", c->DnsSuffix, sizeof(c->DnsSuffix)); + PackGetStr(ret, "current_region", current_region, sizeof(current_region)); + + // SecureNAT connectivity check parameters + Zero(snat_t, sizeof(snat_t)); + PackGetStr(ret, "snat_t", snat_t, sizeof(snat_t)); + NnSetSecureNatTargetHostname(snat_t); + + if (ipv6 == false) + { + char cert_hash[MAX_SIZE]; + + PackGetStr(ret, "current_azure_ip", c->CurrentAzureIp, sizeof(c->CurrentAzureIp)); + c->CurrentAzureTimestamp = PackGetInt64(ret, "current_azure_timestamp"); + PackGetStr(ret, "current_azure_signature", c->CurrentAzureSignature, sizeof(c->CurrentAzureSignature)); + + Zero(cert_hash, sizeof(cert_hash)); + PackGetStr(ret, "azure_cert_hash", cert_hash, sizeof(cert_hash)); + + if (IsEmptyStr(cert_hash) == false) + { + StrCpy(c->AzureCertHash, sizeof(c->AzureCertHash), cert_hash); + } + } + + StrCpy(c->Cedar->CurrentDDnsFqdn, sizeof(c->Cedar->CurrentDDnsFqdn), c->CurrentFqdn); + + Debug("current_hostname=%s, current_fqdn=%s, current_ipv4=%s, current_ipv6=%s, current_azure_ip=%s, CurrentAzureTimestamp=%I64u, CurrentAzureSignature=%s, CertHash=%s\n", + c->CurrentHostName, c->CurrentFqdn, + c->CurrentIPv4, c->CurrentIPv6, + c->CurrentAzureIp, c->CurrentAzureTimestamp, c->CurrentAzureSignature, c->AzureCertHash); + + if (IsEmptyStr(current_region) == false) + { + // Update the current region + SiUpdateCurrentRegion(c->Cedar, current_region, false); + } + } + } + Unlock(c->Lock); + + if (IsEmptyStr(c->CurrentFqdn) == false) + { + SetCurrentDDnsFqdn(c->CurrentFqdn); + } + + + FreePack(ret); + + UniDebug(L"DCRegister Error: %s\n", _E(err)); + + if (err == ERR_DUPLICATE_DDNS_KEY) + { + // Key duplication + DCGenNewKey(c->Key); + c->KeyChanged = true; + } + + if (err == ERR_DISCONNECTED) + { + err = ERR_DDNS_DISCONNECTED; + } + + if (IsUseAlternativeHostname() == false) + { + if (err == ERR_CONNECT_FAILED) + { + if (ipv6 && replace_v6 == NULL) + { + UINT type = DetectFletsType(); + + if (type & FLETS_DETECT_TYPE_EAST_BFLETS_PRIVATE && err != ERR_NO_ERROR) + { + err = DCRegister(c, ipv6, p, DDNS_REPLACE_URL_FOR_EAST_BFLETS); + } + + if (type & FLETS_DETECT_TYPE_EAST_NGN_PRIVATE && err != ERR_NO_ERROR) + { + err = DCRegister(c, ipv6, p, DDNS_REPLACE_URL_FOR_EAST_NGN); + } + + if (type & FLETS_DETECT_TYPE_WEST_NGN_PRIVATE && err != ERR_NO_ERROR) + { + err = DCRegister(c, ipv6, p, DDNS_REPLACE_URL_FOR_WEST_NGN); + } + } + } + } + + return err; +} + +// Get the self IP address +UINT DCGetMyIp(DDNS_CLIENT *c, bool ipv6, char *dst, UINT dst_size, char *replace_v6) +{ + UINT ret = ERR_INTERNAL_ERROR; + + ret = DCGetMyIpMain(c, ipv6, dst, dst_size, false, replace_v6); + + + if (ret == ERR_NO_ERROR) + { + IP ip; + + if (StrToIP(&ip, dst)) + { + if (ipv6 == false && IsIP4(&ip)) + { + SetCurrentGlobalIP(&ip, false); + } + else if (ipv6 && IsIP6(&ip)) + { + SetCurrentGlobalIP(&ip, true); + } + } + } + + return ret; +} +UINT DCGetMyIpMain(DDNS_CLIENT *c, bool ipv6, char *dst, UINT dst_size, bool use_ssl, char *replace_v6) +{ + char *url; + char url2[MAX_SIZE]; + UINT ret = ERR_INTERNAL_ERROR; + URL_DATA data; + BUF *recv; + BUF *cert_hash = NULL; + // Validate arguments + if (dst == NULL || c == NULL) + { + return ERR_INTERNAL_ERROR; + } + + if (ipv6 == false) + { + url = DDNS_URL2_V4_GLOBAL; + + if (IsUseAlternativeHostname()) + { + url = DDNS_URL2_V4_ALT; + } + } + else + { + url = DDNS_URL2_V6_GLOBAL; + + if (IsUseAlternativeHostname()) + { + url = DDNS_URL2_V6_ALT; + } + + if (replace_v6) + { + url = replace_v6; + } + } + + Format(url2, sizeof(url2), "%s?v=%I64u", url, Rand64()); + + if (use_ssl) + { + ReplaceStr(url2, sizeof(url2), url2, "http://", "https://"); + } + + + if (ParseUrl(&data, url2, false, NULL) == false) + { + return ERR_INTERNAL_ERROR; + } + + cert_hash = StrToBin(DDNS_CERT_HASH); + + StrCpy(data.SniString, sizeof(data.SniString), DDNS_SNI_VER_STRING); + + recv = HttpRequestEx3(&data, (ipv6 ? NULL : &c->InternetSetting), DDNS_CONNECT_TIMEOUT, DDNS_COMM_TIMEOUT, &ret, false, NULL, NULL, + NULL, ((cert_hash != NULL && (cert_hash->Size % SHA1_SIZE) == 0) ? cert_hash->Buf : NULL), + (cert_hash != NULL ? cert_hash->Size / SHA1_SIZE : 0), NULL, 0, NULL, NULL); + + FreeBuf(cert_hash); + + if (recv != NULL) + { + char *str = ZeroMalloc(recv->Size + 1); + Copy(str, recv->Buf, recv->Size); + + if (StartWith(str, "IP=") == false) + { + ret = ERR_PROTOCOL_ERROR; + } + else + { + StrCpy(dst, dst_size, str + 3); + ret = ERR_NO_ERROR; + } + + Free(str); + FreeBuf(recv); + } + + if (IsUseAlternativeHostname() == false) + { + if (ret == ERR_CONNECT_FAILED) + { + if (ipv6 && replace_v6 == NULL && use_ssl == false) + { + UINT type = DetectFletsType(); + + if (type & FLETS_DETECT_TYPE_EAST_BFLETS_PRIVATE && ret != ERR_NO_ERROR) + { + ret = DCGetMyIpMain(c, ipv6, dst, dst_size, use_ssl, DDNS_REPLACE_URL2_FOR_EAST_BFLETS); + } + + if (type & FLETS_DETECT_TYPE_EAST_NGN_PRIVATE && ret != ERR_NO_ERROR) + { + ret = DCGetMyIpMain(c, ipv6, dst, dst_size, use_ssl, DDNS_REPLACE_URL2_FOR_EAST_NGN); + } + + if (type & FLETS_DETECT_TYPE_WEST_NGN_PRIVATE && ret != ERR_NO_ERROR) + { + ret = DCGetMyIpMain(c, ipv6, dst, dst_size, use_ssl, DDNS_REPLACE_URL2_FOR_WEST_NGN); + } + } + } + } + + return ret; +} + + +// Creating a DDNS client +DDNS_CLIENT *NewDDNSClient(CEDAR *cedar, UCHAR *key, INTERNET_SETTING *t) +{ + DDNS_CLIENT *c; + UCHAR key_hash[SHA1_SIZE]; + // Validate arguments + if (cedar == NULL) + { + return NULL; + } + + c = ZeroMalloc(sizeof(DDNS_CLIENT)); + c->Cedar = cedar; + AddRef(c->Cedar->ref); + + c->Err_IPv4 = c->Err_IPv6 = ERR_TRYING_TO_CONNECT; + + if (key == NULL) + { + // Create a new key + DCGenNewKey(c->Key); + } + else + { + // Set the key + Copy(c->Key, key, SHA1_SIZE); + } + + Sha1(key_hash, c->Key, sizeof(c->Key)); + + + if (t != NULL) + { + Copy(&c->InternetSetting, t, sizeof(INTERNET_SETTING)); + } + + c->Lock = NewLock(); + + // Thread creation + c->Event = NewEvent(); + c->Thread = NewThread(DCThread, c); + + return c; +} + +// Release of DDNS client +void FreeDDNSClient(DDNS_CLIENT *c) +{ + // Validate arguments + if (c == NULL) + { + return; + } + + // Stop the thread + c->Halt = true; + Set(c->Event); + + WaitThread(c->Thread, INFINITE); + ReleaseThread(c->Thread); + + ReleaseEvent(c->Event); + + ReleaseCedar(c->Cedar); + DeleteLock(c->Lock); + + Free(c); +} + +// Create a new key +void DCGenNewKey(UCHAR *key) +{ + BUF *b; + UINT64 tick; + UCHAR hash[SHA1_SIZE]; + UCHAR rand[SHA1_SIZE]; + UINT i; + // Validate arguments + if (key == NULL) + { + return; + } + + b = NewBuf(); + + Rand(rand, sizeof(rand)); + WriteBuf(b, rand, sizeof(rand)); + + tick = TickHighres64(); + WriteBufInt64(b, tick); + + tick = Tick64(); + WriteBufInt64(b, tick); + + tick = SystemTime64(); + WriteBufInt64(b, tick); + + GetCurrentMachineIpProcessHash(hash); + WriteBuf(b, hash, sizeof(hash)); + + Sha1(key, b->Buf, b->Size); + Rand(rand, sizeof(rand)); + + for (i = 0;i < SHA1_SIZE;i++) + { + key[i] = key[i] ^ rand[i]; + } + + FreeBuf(b); +} + + diff --git a/src/Cedar/DDNS.h b/src/Cedar/DDNS.h index bd6a6fc1..483df690 100644 --- a/src/Cedar/DDNS.h +++ b/src/Cedar/DDNS.h @@ -1,145 +1,145 @@ -// SoftEther VPN Source Code - Developer Edition Master Branch -// Cedar Communication Module - - -// DDNS.h -// Header of DDNS.c - -#ifndef DDNS_H -#define DDNS_H - -// Certificate hash -#define DDNS_CERT_HASH "78BF0499A99396907C9F49DD13571C81FE26E6F5" \ - "439BAFA75A6EE5671FC9F9A02D34FF29881761A0" \ - "EFAC5FA0CDD14E0F864EED58A73C35D7E33B62F3" \ - "74DF99D4B1B5F0488A388B50D347D26013DC67A5" \ - "6EBB39AFCA8C900635CFC11218CF293A612457E4" - -#define DDNS_SNI_VER_STRING "DDNS" - - -// Destination URL -#define DDNS_URL_V4_GLOBAL "https://x%c.x%c.dev.servers.ddns.softether-network.net/ddns/ddns.aspx" -#define DDNS_URL_V6_GLOBAL "https://x%c.x%c.dev.servers-v6.ddns.softether-network.net/ddns/ddns.aspx" -#define DDNS_URL2_V4_GLOBAL "http://get-my-ip.ddns.softether-network.net/ddns/getmyip.ashx" -#define DDNS_URL2_V6_GLOBAL "http://get-my-ip-v6.ddns.softether-network.net/ddns/getmyip.ashx" - -#define DDNS_REPLACE_URL_FOR_EAST_BFLETS "https://senet-flets.v6.softether.co.jp/ddns/ddns.aspx" -#define DDNS_REPLACE_URL_FOR_EAST_NGN "https://senet.aoi.flets-east.jp/ddns/ddns.aspx" -#define DDNS_REPLACE_URL_FOR_WEST_NGN "https://senet.p-ns.flets-west.jp/ddns/ddns.aspx" - -#define DDNS_REPLACE_URL2_FOR_EAST_BFLETS "http://senet-flets.v6.softether.co.jp/ddns/getmyip.ashx" -#define DDNS_REPLACE_URL2_FOR_EAST_NGN "http://senet.aoi.flets-east.jp/ddns/getmyip.ashx" -#define DDNS_REPLACE_URL2_FOR_WEST_NGN "http://senet.p-ns.flets-west.jp/ddns/getmyip.ashx" - -// For China: Free version -#define DDNS_URL_V4_ALT "https://x%c.x%c.dev.servers.ddns.uxcom.jp/ddns/ddns.aspx" -#define DDNS_URL_V6_ALT "https://x%c.x%c.dev.servers-v6.ddns.uxcom.jp/ddns/ddns.aspx" -#define DDNS_URL2_V4_ALT "http://get-my-ip.ddns.uxcom.jp/ddns/getmyip.ashx" -#define DDNS_URL2_V6_ALT "http://get-my-ip-v6.ddns.uxcom.jp/ddns/getmyip.ashx" - -#define DDNS_RPC_MAX_RECV_SIZE DYN32(DDNS_RPC_MAX_RECV_SIZE, (128 * 1024 * 1024)) - -// Connection Timeout -#define DDNS_CONNECT_TIMEOUT DYN32(DDNS_CONNECT_TIMEOUT, (15 * 1000)) - -// Communication time-out -#define DDNS_COMM_TIMEOUT DYN32(DDNS_COMM_TIMEOUT, (60 * 1000)) - -// Maximum length of the host name -#define DDNS_MAX_HOSTNAME 31 - -// DDNS Version -#define DDNS_VERSION 1 - -// Period until the next registration in case of success -#define DDNS_REGISTER_INTERVAL_OK_MIN DYN32(DDNS_REGISTER_INTERVAL_OK_MIN, (1 * 60 * 60 * 1000)) -#define DDNS_REGISTER_INTERVAL_OK_MAX DYN32(DDNS_REGISTER_INTERVAL_OK_MAX, (2 * 60 * 60 * 1000)) - -// Period until the next registration in case of failure -#define DDNS_REGISTER_INTERVAL_NG_MIN DYN32(DDNS_REGISTER_INTERVAL_NG_MIN, (1 * 60 * 1000)) -#define DDNS_REGISTER_INTERVAL_NG_MAX DYN32(DDNS_REGISTER_INTERVAL_NG_MAX, (5 * 60 * 1000)) - -// The self IP address acquisition interval (If last trial succeeded) -#define DDNS_GETMYIP_INTERVAL_OK_MIN DYN32(DDNS_GETMYIP_INTERVAL_OK_MIN, (10 * 60 * 1000)) -#define DDNS_GETMYIP_INTERVAL_OK_MAX DYN32(DDNS_GETMYIP_INTERVAL_OK_MAX, (20 * 60 * 1000)) - -// The self IP address acquisition interval (If last trial failed) -#define DDNS_GETMYIP_INTERVAL_NG_MIN DYN32(DDNS_GETMYIP_INTERVAL_NG_MIN, (1 * 60 * 1000)) -#define DDNS_GETMYIP_INTERVAL_NG_MAX DYN32(DDNS_GETMYIP_INTERVAL_NG_MAX, (5 * 60 * 1000)) - -// Time difference to communicate with the DDNS server after a predetermined time has elapsed since the VPN Azure is disconnected -#define DDNS_VPN_AZURE_CONNECT_ERROR_DDNS_RETRY_TIME_DIFF DYN32(DDNS_VPN_AZURE_CONNECT_ERROR_DDNS_RETRY_TIME_DIFF, (120 * 1000)) -#define DDNS_VPN_AZURE_CONNECT_ERROR_DDNS_RETRY_TIME_DIFF_MAX DYN32(DDNS_VPN_AZURE_CONNECT_ERROR_DDNS_RETRY_TIME_DIFF_MAX, (10 * 60 * 1000)) - -// DDNS Client -struct DDNS_CLIENT -{ - CEDAR *Cedar; // Cedar - THREAD *Thread; // Thread - UCHAR Key[SHA1_SIZE]; // Key - LOCK *Lock; // Lock - volatile bool Halt; // Halt flag - EVENT *Event; // Halt event - char CurrentHostName[DDNS_MAX_HOSTNAME + 1]; // Current host name - char CurrentFqdn[MAX_SIZE]; // Current FQDN - char DnsSuffix[MAX_SIZE]; // DNS suffix - char CurrentIPv4[MAX_SIZE]; // Current IPv4 address - char CurrentIPv6[MAX_SIZE]; // Current IPv6 address - UINT Err_IPv4, Err_IPv6; // Last error - UINT Err_IPv4_GetMyIp, Err_IPv6_GetMyIp; // Last error (obtaining self IP address) - bool KeyChanged; // Flag to indicate that the key has been changed - char LastMyIPv4[MAX_SIZE]; // Self IPv4 address that were acquired on last - char LastMyIPv6[MAX_SIZE]; // Self IPv6 address that were acquired on last - char CurrentAzureIp[MAX_SIZE]; // IP address of Azure Server to be used - UINT64 CurrentAzureTimestamp; // Time stamp to be presented to the Azure Server - char CurrentAzureSignature[MAX_SIZE]; // Signature to be presented to the Azure Server - char AzureCertHash[MAX_SIZE]; // Azure Server certificate hash - INTERNET_SETTING InternetSetting; // Internet connection settings - - UINT64 NextRegisterTick_IPv4, NextRegisterTick_IPv6; // Next register time - UINT64 NextGetMyIpTick_IPv4, NextGetMyIpTick_IPv6; // Next self IP acquisition time -}; - -// DDNS Register Param -struct DDNS_REGISTER_PARAM -{ - char NewHostname[DDNS_MAX_HOSTNAME + 1]; // Host name after the change -}; - -// The current status of the DDNS -struct DDNS_CLIENT_STATUS -{ - UINT Err_IPv4, Err_IPv6; // Last error - wchar_t ErrStr_IPv4[MAX_SIZE]; - wchar_t ErrStr_IPv6[MAX_SIZE]; - char CurrentHostName[DDNS_MAX_HOSTNAME + 1]; // Current host name - char CurrentFqdn[MAX_SIZE]; // Current FQDN - char DnsSuffix[MAX_SIZE]; // DNS suffix - char CurrentIPv4[MAX_SIZE]; // Current IPv4 address - char CurrentIPv6[MAX_SIZE]; // Current IPv6 address - char CurrentAzureIp[MAX_SIZE]; // IP address of Azure Server to be used - UINT64 CurrentAzureTimestamp; // Time stamp to be presented to the Azure Server - char CurrentAzureSignature[MAX_SIZE]; // Signature to be presented to the Azure Server - char AzureCertHash[MAX_SIZE]; // Azure Server certificate hash - INTERNET_SETTING InternetSetting; // Internet settings -}; - -// Function prototype -DDNS_CLIENT *NewDDNSClient(CEDAR *cedar, UCHAR *key, INTERNET_SETTING *t); -void FreeDDNSClient(DDNS_CLIENT *c); -void DCGenNewKey(UCHAR *key); -void DCThread(THREAD *thread, void *param); -UINT DCRegister(DDNS_CLIENT *c, bool ipv6, DDNS_REGISTER_PARAM *p, char *replace_v6); -UINT DCGetMyIpMain(DDNS_CLIENT *c, bool ipv6, char *dst, UINT dst_size, bool use_ssl, char *replace_v6); -UINT DCGetMyIp(DDNS_CLIENT *c, bool ipv6, char *dst, UINT dst_size, char *replace_v6); -void DCGetStatus(DDNS_CLIENT *c, DDNS_CLIENT_STATUS *st); -UINT DCChangeHostName(DDNS_CLIENT *c, char *hostname); -void DCSetInternetSetting(DDNS_CLIENT *c, INTERNET_SETTING *t); -void DCGetInternetSetting(DDNS_CLIENT *c, INTERNET_SETTING *t); - - - -#endif // DDNS_H - - +// SoftEther VPN Source Code - Developer Edition Master Branch +// Cedar Communication Module + + +// DDNS.h +// Header of DDNS.c + +#ifndef DDNS_H +#define DDNS_H + +// Certificate hash +#define DDNS_CERT_HASH "78BF0499A99396907C9F49DD13571C81FE26E6F5" \ + "439BAFA75A6EE5671FC9F9A02D34FF29881761A0" \ + "EFAC5FA0CDD14E0F864EED58A73C35D7E33B62F3" \ + "74DF99D4B1B5F0488A388B50D347D26013DC67A5" \ + "6EBB39AFCA8C900635CFC11218CF293A612457E4" + +#define DDNS_SNI_VER_STRING "DDNS" + + +// Destination URL +#define DDNS_URL_V4_GLOBAL "https://x%c.x%c.dev.servers.ddns.softether-network.net/ddns/ddns.aspx" +#define DDNS_URL_V6_GLOBAL "https://x%c.x%c.dev.servers-v6.ddns.softether-network.net/ddns/ddns.aspx" +#define DDNS_URL2_V4_GLOBAL "http://get-my-ip.ddns.softether-network.net/ddns/getmyip.ashx" +#define DDNS_URL2_V6_GLOBAL "http://get-my-ip-v6.ddns.softether-network.net/ddns/getmyip.ashx" + +#define DDNS_REPLACE_URL_FOR_EAST_BFLETS "https://senet-flets.v6.softether.co.jp/ddns/ddns.aspx" +#define DDNS_REPLACE_URL_FOR_EAST_NGN "https://senet.aoi.flets-east.jp/ddns/ddns.aspx" +#define DDNS_REPLACE_URL_FOR_WEST_NGN "https://senet.p-ns.flets-west.jp/ddns/ddns.aspx" + +#define DDNS_REPLACE_URL2_FOR_EAST_BFLETS "http://senet-flets.v6.softether.co.jp/ddns/getmyip.ashx" +#define DDNS_REPLACE_URL2_FOR_EAST_NGN "http://senet.aoi.flets-east.jp/ddns/getmyip.ashx" +#define DDNS_REPLACE_URL2_FOR_WEST_NGN "http://senet.p-ns.flets-west.jp/ddns/getmyip.ashx" + +// For China: Free version +#define DDNS_URL_V4_ALT "https://x%c.x%c.dev.servers.ddns.uxcom.jp/ddns/ddns.aspx" +#define DDNS_URL_V6_ALT "https://x%c.x%c.dev.servers-v6.ddns.uxcom.jp/ddns/ddns.aspx" +#define DDNS_URL2_V4_ALT "http://get-my-ip.ddns.uxcom.jp/ddns/getmyip.ashx" +#define DDNS_URL2_V6_ALT "http://get-my-ip-v6.ddns.uxcom.jp/ddns/getmyip.ashx" + +#define DDNS_RPC_MAX_RECV_SIZE DYN32(DDNS_RPC_MAX_RECV_SIZE, (128 * 1024 * 1024)) + +// Connection Timeout +#define DDNS_CONNECT_TIMEOUT DYN32(DDNS_CONNECT_TIMEOUT, (15 * 1000)) + +// Communication time-out +#define DDNS_COMM_TIMEOUT DYN32(DDNS_COMM_TIMEOUT, (60 * 1000)) + +// Maximum length of the host name +#define DDNS_MAX_HOSTNAME 31 + +// DDNS Version +#define DDNS_VERSION 1 + +// Period until the next registration in case of success +#define DDNS_REGISTER_INTERVAL_OK_MIN DYN32(DDNS_REGISTER_INTERVAL_OK_MIN, (1 * 60 * 60 * 1000)) +#define DDNS_REGISTER_INTERVAL_OK_MAX DYN32(DDNS_REGISTER_INTERVAL_OK_MAX, (2 * 60 * 60 * 1000)) + +// Period until the next registration in case of failure +#define DDNS_REGISTER_INTERVAL_NG_MIN DYN32(DDNS_REGISTER_INTERVAL_NG_MIN, (1 * 60 * 1000)) +#define DDNS_REGISTER_INTERVAL_NG_MAX DYN32(DDNS_REGISTER_INTERVAL_NG_MAX, (5 * 60 * 1000)) + +// The self IP address acquisition interval (If last trial succeeded) +#define DDNS_GETMYIP_INTERVAL_OK_MIN DYN32(DDNS_GETMYIP_INTERVAL_OK_MIN, (10 * 60 * 1000)) +#define DDNS_GETMYIP_INTERVAL_OK_MAX DYN32(DDNS_GETMYIP_INTERVAL_OK_MAX, (20 * 60 * 1000)) + +// The self IP address acquisition interval (If last trial failed) +#define DDNS_GETMYIP_INTERVAL_NG_MIN DYN32(DDNS_GETMYIP_INTERVAL_NG_MIN, (1 * 60 * 1000)) +#define DDNS_GETMYIP_INTERVAL_NG_MAX DYN32(DDNS_GETMYIP_INTERVAL_NG_MAX, (5 * 60 * 1000)) + +// Time difference to communicate with the DDNS server after a predetermined time has elapsed since the VPN Azure is disconnected +#define DDNS_VPN_AZURE_CONNECT_ERROR_DDNS_RETRY_TIME_DIFF DYN32(DDNS_VPN_AZURE_CONNECT_ERROR_DDNS_RETRY_TIME_DIFF, (120 * 1000)) +#define DDNS_VPN_AZURE_CONNECT_ERROR_DDNS_RETRY_TIME_DIFF_MAX DYN32(DDNS_VPN_AZURE_CONNECT_ERROR_DDNS_RETRY_TIME_DIFF_MAX, (10 * 60 * 1000)) + +// DDNS Client +struct DDNS_CLIENT +{ + CEDAR *Cedar; // Cedar + THREAD *Thread; // Thread + UCHAR Key[SHA1_SIZE]; // Key + LOCK *Lock; // Lock + volatile bool Halt; // Halt flag + EVENT *Event; // Halt event + char CurrentHostName[DDNS_MAX_HOSTNAME + 1]; // Current host name + char CurrentFqdn[MAX_SIZE]; // Current FQDN + char DnsSuffix[MAX_SIZE]; // DNS suffix + char CurrentIPv4[MAX_SIZE]; // Current IPv4 address + char CurrentIPv6[MAX_SIZE]; // Current IPv6 address + UINT Err_IPv4, Err_IPv6; // Last error + UINT Err_IPv4_GetMyIp, Err_IPv6_GetMyIp; // Last error (obtaining self IP address) + bool KeyChanged; // Flag to indicate that the key has been changed + char LastMyIPv4[MAX_SIZE]; // Self IPv4 address that were acquired on last + char LastMyIPv6[MAX_SIZE]; // Self IPv6 address that were acquired on last + char CurrentAzureIp[MAX_SIZE]; // IP address of Azure Server to be used + UINT64 CurrentAzureTimestamp; // Time stamp to be presented to the Azure Server + char CurrentAzureSignature[MAX_SIZE]; // Signature to be presented to the Azure Server + char AzureCertHash[MAX_SIZE]; // Azure Server certificate hash + INTERNET_SETTING InternetSetting; // Internet connection settings + + UINT64 NextRegisterTick_IPv4, NextRegisterTick_IPv6; // Next register time + UINT64 NextGetMyIpTick_IPv4, NextGetMyIpTick_IPv6; // Next self IP acquisition time +}; + +// DDNS Register Param +struct DDNS_REGISTER_PARAM +{ + char NewHostname[DDNS_MAX_HOSTNAME + 1]; // Host name after the change +}; + +// The current status of the DDNS +struct DDNS_CLIENT_STATUS +{ + UINT Err_IPv4, Err_IPv6; // Last error + wchar_t ErrStr_IPv4[MAX_SIZE]; + wchar_t ErrStr_IPv6[MAX_SIZE]; + char CurrentHostName[DDNS_MAX_HOSTNAME + 1]; // Current host name + char CurrentFqdn[MAX_SIZE]; // Current FQDN + char DnsSuffix[MAX_SIZE]; // DNS suffix + char CurrentIPv4[MAX_SIZE]; // Current IPv4 address + char CurrentIPv6[MAX_SIZE]; // Current IPv6 address + char CurrentAzureIp[MAX_SIZE]; // IP address of Azure Server to be used + UINT64 CurrentAzureTimestamp; // Time stamp to be presented to the Azure Server + char CurrentAzureSignature[MAX_SIZE]; // Signature to be presented to the Azure Server + char AzureCertHash[MAX_SIZE]; // Azure Server certificate hash + INTERNET_SETTING InternetSetting; // Internet settings +}; + +// Function prototype +DDNS_CLIENT *NewDDNSClient(CEDAR *cedar, UCHAR *key, INTERNET_SETTING *t); +void FreeDDNSClient(DDNS_CLIENT *c); +void DCGenNewKey(UCHAR *key); +void DCThread(THREAD *thread, void *param); +UINT DCRegister(DDNS_CLIENT *c, bool ipv6, DDNS_REGISTER_PARAM *p, char *replace_v6); +UINT DCGetMyIpMain(DDNS_CLIENT *c, bool ipv6, char *dst, UINT dst_size, bool use_ssl, char *replace_v6); +UINT DCGetMyIp(DDNS_CLIENT *c, bool ipv6, char *dst, UINT dst_size, char *replace_v6); +void DCGetStatus(DDNS_CLIENT *c, DDNS_CLIENT_STATUS *st); +UINT DCChangeHostName(DDNS_CLIENT *c, char *hostname); +void DCSetInternetSetting(DDNS_CLIENT *c, INTERNET_SETTING *t); +void DCGetInternetSetting(DDNS_CLIENT *c, INTERNET_SETTING *t); + + + +#endif // DDNS_H + + diff --git a/src/Cedar/Database.c b/src/Cedar/Database.c index 321d64b0..439fb4bf 100644 --- a/src/Cedar/Database.c +++ b/src/Cedar/Database.c @@ -1,159 +1,159 @@ -// SoftEther VPN Source Code - Developer Edition Master Branch -// Cedar Communication Module - - -// Database.c -// License database - -#include "CedarPch.h" - -// Get the License status string -wchar_t *LiGetLicenseStatusStr(UINT i) -{ - wchar_t *ret = _UU("LICENSE_STATUS_OTHERERROR"); - - switch (i) - { - case LICENSE_STATUS_OK: - ret = _UU("LICENSE_STATUS_OK"); - break; - - case LICENSE_STATUS_EXPIRED: - ret = _UU("LICENSE_STATUS_EXPIRED"); - break; - - case LICENSE_STATUS_ID_DIFF: - ret = _UU("LICENSE_STATUS_ID_DIFF"); - break; - - case LICENSE_STATUS_DUP: - ret = _UU("LICENSE_STATUS_DUP"); - break; - - case LICENSE_STATUS_INSUFFICIENT: - ret = _UU("LICENSE_STATUS_INSUFFICIENT"); - break; - - case LICENSE_STATUS_COMPETITION: - ret = _UU("LICENSE_STATUS_COMPETITION"); - break; - - case LICENSE_STATUS_NONSENSE: - ret = _UU("LICENSE_STATUS_NONSENSE"); - break; - - case LICENSE_STATUS_CPU: - ret = _UU("LICENSE_STATUS_CPU"); - break; - } - - return ret; -} - -static char *li_keybit_chars = "ABCDEFGHJKLMNPQRSTUVWXYZ12345678"; - -// Convert the string to a key bit -bool LiStrToKeyBit(UCHAR *keybit, char *keystr) -{ - UINT x[36]; - UINT i, wp; - char *str; - // Validate arguments - if (keybit == NULL || keystr == NULL) - { - return false; - } - - str = CopyStr(keystr); - Trim(str); - - wp = 0; - if (StrLen(str) != 41) - { - Free(str); - return false; - } - - for (i = 0;i < 36;i++) - { - char c = str[wp++]; - UINT j; - - if (((i % 6) == 5) && (i != 35)) - { - if (str[wp++] != '-') - { - Free(str); - return false; - } - } - - x[i] = INFINITE; - for (j = 0;j < 32;j++) - { - if (ToUpper(c) == li_keybit_chars[j]) - { - x[i] = j; - } - } - - if (x[i] == INFINITE) - { - Free(str); - return false; - } - } - - Zero(keybit, 23); - - keybit[0] = x[0] << 1 | x[1] >> 4; - keybit[1] = x[1] << 4 | x[2] >> 1; - keybit[2] = x[2] << 7 | x[3] << 2 | x[4] >> 3; - keybit[3] = x[4] << 5 | x[5]; - - keybit[4] = x[6] << 3 | x[7] >> 2; - keybit[5] = x[7] << 6 | x[8] << 1 | x[9] >> 4; - keybit[6] = x[9] << 4 | x[10] >> 1; - keybit[7] = x[10] << 7 | x[11] << 2 | x[12] >> 3; - keybit[8] = x[12] << 5 | x[13]; - - keybit[9] = x[14] << 3 | x[15] >> 2; - keybit[10] = x[15] << 6 | x[16] << 1 | x[17] >> 4; - keybit[11] = x[17] << 4 | x[18] >> 1; - keybit[12] = x[18] << 7 | x[19] << 2 | x[20] >> 3; - keybit[13] = x[20] << 5 | x[21]; - - keybit[14] = x[22] << 3 | x[23] >> 2; - keybit[15] = x[23] << 6 | x[24] << 1 | x[25] >> 4; - keybit[16] = x[25] << 4 | x[26] >> 1; - keybit[17] = x[26] << 7 | x[27] << 2 | x[28] >> 3; - keybit[18] = x[28] << 5 | x[29]; - - keybit[19] = x[30] << 3 | x[31] >> 2; - keybit[20] = x[31] << 6 | x[32] << 1 | x[33] >> 4; - keybit[21] = x[33] << 4 | x[34] >> 1; - keybit[22] = x[34] << 7 | x[35] << 2; - - Free(str); - - return true; -} - -// Determine whether the string is a license key -bool LiIsLicenseKey(char *str) -{ - UCHAR keybit[23]; - // Validate arguments - if (str == NULL) - { - return false; - } - - if (LiStrToKeyBit(keybit, str) == false) - { - return false; - } - - return true; -} - +// SoftEther VPN Source Code - Developer Edition Master Branch +// Cedar Communication Module + + +// Database.c +// License database + +#include "CedarPch.h" + +// Get the License status string +wchar_t *LiGetLicenseStatusStr(UINT i) +{ + wchar_t *ret = _UU("LICENSE_STATUS_OTHERERROR"); + + switch (i) + { + case LICENSE_STATUS_OK: + ret = _UU("LICENSE_STATUS_OK"); + break; + + case LICENSE_STATUS_EXPIRED: + ret = _UU("LICENSE_STATUS_EXPIRED"); + break; + + case LICENSE_STATUS_ID_DIFF: + ret = _UU("LICENSE_STATUS_ID_DIFF"); + break; + + case LICENSE_STATUS_DUP: + ret = _UU("LICENSE_STATUS_DUP"); + break; + + case LICENSE_STATUS_INSUFFICIENT: + ret = _UU("LICENSE_STATUS_INSUFFICIENT"); + break; + + case LICENSE_STATUS_COMPETITION: + ret = _UU("LICENSE_STATUS_COMPETITION"); + break; + + case LICENSE_STATUS_NONSENSE: + ret = _UU("LICENSE_STATUS_NONSENSE"); + break; + + case LICENSE_STATUS_CPU: + ret = _UU("LICENSE_STATUS_CPU"); + break; + } + + return ret; +} + +static char *li_keybit_chars = "ABCDEFGHJKLMNPQRSTUVWXYZ12345678"; + +// Convert the string to a key bit +bool LiStrToKeyBit(UCHAR *keybit, char *keystr) +{ + UINT x[36]; + UINT i, wp; + char *str; + // Validate arguments + if (keybit == NULL || keystr == NULL) + { + return false; + } + + str = CopyStr(keystr); + Trim(str); + + wp = 0; + if (StrLen(str) != 41) + { + Free(str); + return false; + } + + for (i = 0;i < 36;i++) + { + char c = str[wp++]; + UINT j; + + if (((i % 6) == 5) && (i != 35)) + { + if (str[wp++] != '-') + { + Free(str); + return false; + } + } + + x[i] = INFINITE; + for (j = 0;j < 32;j++) + { + if (ToUpper(c) == li_keybit_chars[j]) + { + x[i] = j; + } + } + + if (x[i] == INFINITE) + { + Free(str); + return false; + } + } + + Zero(keybit, 23); + + keybit[0] = x[0] << 1 | x[1] >> 4; + keybit[1] = x[1] << 4 | x[2] >> 1; + keybit[2] = x[2] << 7 | x[3] << 2 | x[4] >> 3; + keybit[3] = x[4] << 5 | x[5]; + + keybit[4] = x[6] << 3 | x[7] >> 2; + keybit[5] = x[7] << 6 | x[8] << 1 | x[9] >> 4; + keybit[6] = x[9] << 4 | x[10] >> 1; + keybit[7] = x[10] << 7 | x[11] << 2 | x[12] >> 3; + keybit[8] = x[12] << 5 | x[13]; + + keybit[9] = x[14] << 3 | x[15] >> 2; + keybit[10] = x[15] << 6 | x[16] << 1 | x[17] >> 4; + keybit[11] = x[17] << 4 | x[18] >> 1; + keybit[12] = x[18] << 7 | x[19] << 2 | x[20] >> 3; + keybit[13] = x[20] << 5 | x[21]; + + keybit[14] = x[22] << 3 | x[23] >> 2; + keybit[15] = x[23] << 6 | x[24] << 1 | x[25] >> 4; + keybit[16] = x[25] << 4 | x[26] >> 1; + keybit[17] = x[26] << 7 | x[27] << 2 | x[28] >> 3; + keybit[18] = x[28] << 5 | x[29]; + + keybit[19] = x[30] << 3 | x[31] >> 2; + keybit[20] = x[31] << 6 | x[32] << 1 | x[33] >> 4; + keybit[21] = x[33] << 4 | x[34] >> 1; + keybit[22] = x[34] << 7 | x[35] << 2; + + Free(str); + + return true; +} + +// Determine whether the string is a license key +bool LiIsLicenseKey(char *str) +{ + UCHAR keybit[23]; + // Validate arguments + if (str == NULL) + { + return false; + } + + if (LiStrToKeyBit(keybit, str) == false) + { + return false; + } + + return true; +} + diff --git a/src/Cedar/Database.h b/src/Cedar/Database.h index a413a5d5..da43af94 100644 --- a/src/Cedar/Database.h +++ b/src/Cedar/Database.h @@ -1,18 +1,18 @@ -// SoftEther VPN Source Code - Developer Edition Master Branch -// Cedar Communication Module - - -// Database.h -// Header of Database.c - -#ifndef DATABASE_H -#define DATABASE_H - -wchar_t *LiGetLicenseStatusStr(UINT i); -bool LiIsLicenseKey(char *str); -bool LiStrToKeyBit(UCHAR *keybit, char *keystr); - - -#endif // DATABASE_H - - +// SoftEther VPN Source Code - Developer Edition Master Branch +// Cedar Communication Module + + +// Database.h +// Header of Database.c + +#ifndef DATABASE_H +#define DATABASE_H + +wchar_t *LiGetLicenseStatusStr(UINT i); +bool LiIsLicenseKey(char *str); +bool LiStrToKeyBit(UCHAR *keybit, char *keystr); + + +#endif // DATABASE_H + + diff --git a/src/Cedar/EM.c b/src/Cedar/EM.c index ee529211..8da4e4f5 100644 --- a/src/Cedar/EM.c +++ b/src/Cedar/EM.c @@ -1,1396 +1,1396 @@ -// SoftEther VPN Source Code - Developer Edition Master Branch -// Cedar Communication Module - - -// EM.c -// EtherLogger Manager for Win32 - -#include - -#ifdef WIN32 - -#define SM_C -#define CM_C -#define NM_C -#define EM_C - -#define _WIN32_WINNT 0x0502 -#define WINVER 0x0502 -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "CMInner.h" -#include "SMInner.h" -#include "NMInner.h" -#include "EMInner.h" -#include "../PenCore/resource.h" - - -// License registration process -void EmLicenseAddDlgOnOk(HWND hWnd, RPC *s) -{ -} - -// Shift treatment of text input -void EmLicenseAddDlgShiftTextItem(HWND hWnd, UINT id1, UINT id2, UINT *next_focus) -{ - char *s; - // Validate arguments - if (hWnd == NULL || next_focus == NULL) - { - return; - } - - s = GetTextA(hWnd, id1); - if (StrLen(s) >= 6) - { - char *s2 = CopyStr(s); - char tmp[MAX_SIZE]; - s2[6] = 0; - SetTextA(hWnd, id1, s2); - Free(s2); - - if (id2 != 0) - { - GetTxtA(hWnd, id2, tmp, sizeof(tmp)); - - StrCat(tmp, sizeof(tmp), s + 6); - ReplaceStrEx(tmp, sizeof(tmp), tmp, "-", "", false); - - SetTextA(hWnd, id2, tmp); - - *next_focus = id2; - } - else - { - *next_focus = IDOK; - } - } - - Free(s); -} - -// Make a text from the input data -void EmLicenseAddDlgGetText(HWND hWnd, char *str, UINT size) -{ - char *k1, *k2, *k3, *k4, *k5, *k6; - // Validate arguments - if (hWnd == NULL || str == NULL) - { - return; - } - - k1 = GetTextA(hWnd, B_KEY1); - k2 = GetTextA(hWnd, B_KEY2); - k3 = GetTextA(hWnd, B_KEY3); - k4 = GetTextA(hWnd, B_KEY4); - k5 = GetTextA(hWnd, B_KEY5); - k6 = GetTextA(hWnd, B_KEY6); - - Format(str, size, "%s-%s-%s-%s-%s-%s", k1, k2, k3, k4, k5, k6); - - Free(k1); - Free(k2); - Free(k3); - Free(k4); - Free(k5); - Free(k6); -} - -// License addition dialog update -void EmLicenseAddDlgUpdate(HWND hWnd, RPC *s) -{ -} - -// License addition dialog initialization -void EmLicenseAddDlgInit(HWND hWnd, RPC *s) -{ - HFONT h; - // Validate arguments - if (hWnd == NULL || s == NULL) - { - return; - } - - h = GetFont("Arial", 10, true, false, false, false); - SetFont(hWnd, B_KEY1, h); - SetFont(hWnd, B_KEY2, h); - SetFont(hWnd, B_KEY3, h); - SetFont(hWnd, B_KEY4, h); - SetFont(hWnd, B_KEY5, h); - SetFont(hWnd, B_KEY6, h); - - DlgFont(hWnd, S_INFO, 10, true); - - EmLicenseAddDlgUpdate(hWnd, s); -} - -// License addition dialog -UINT EmLicenseAddDlg(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param) -{ - RPC *s = (RPC *)param; - // Validate arguments - if (hWnd == NULL) - { - return 0; - } - - switch (msg) - { - case WM_INITDIALOG: - EmLicenseAddDlgInit(hWnd, s); - break; - - case WM_COMMAND: - switch (LOWORD(wParam)) - { - case B_KEY1: - case B_KEY2: - case B_KEY3: - case B_KEY4: - case B_KEY5: - case B_KEY6: - switch (HIWORD(wParam)) - { - case EN_CHANGE: - EmLicenseAddDlgUpdate(hWnd, s); - - switch (LOWORD(wParam)) - { - case B_KEY2: - if (GetTextLen(hWnd, B_KEY2, true) == 0) - { - FocusEx(hWnd, B_KEY1); - } - break; - case B_KEY3: - if (GetTextLen(hWnd, B_KEY3, true) == 0) - { - FocusEx(hWnd, B_KEY2); - } - break; - case B_KEY4: - if (GetTextLen(hWnd, B_KEY4, true) == 0) - { - FocusEx(hWnd, B_KEY3); - } - break; - case B_KEY5: - if (GetTextLen(hWnd, B_KEY5, true) == 0) - { - FocusEx(hWnd, B_KEY4); - } - break; - case B_KEY6: - if (GetTextLen(hWnd, B_KEY6, true) == 0) - { - FocusEx(hWnd, B_KEY5); - } - break; - } - break; - } - break; - } - - switch (wParam) - { - case IDOK: - EmLicenseAddDlgOnOk(hWnd, s); - break; - - case IDCANCEL: - Close(hWnd); - break; - } - break; - - case WM_CLOSE: - EndDialog(hWnd, 0); - break; - } - - return 0; -} - -// Add a license -bool EmLicenseAdd(HWND hWnd, RPC *s) -{ - // Validate arguments - if (s == NULL) - { - return false; - } - - return Dialog(hWnd, D_EM_LICENSE_ADD, EmLicenseAddDlg, s); -} - -// License dialog initialization -void EmLicenseDlgInit(HWND hWnd, RPC *s) -{ - // Validate arguments - if (hWnd == NULL || s == NULL) - { - return; - } - - SetIcon(hWnd, 0, ICO_CERT); - - DlgFont(hWnd, S_BOLD, 0, true); - DlgFont(hWnd, S_BOLD2, 0, true); - - LvInit(hWnd, L_LIST); - LvSetStyle(hWnd, L_LIST, LVS_EX_GRIDLINES); - LvInsertColumn(hWnd, L_LIST, 0, _UU("SM_LICENSE_COLUMN_1"), 50); - LvInsertColumn(hWnd, L_LIST, 1, _UU("SM_LICENSE_COLUMN_2"), 100); - LvInsertColumn(hWnd, L_LIST, 2, _UU("SM_LICENSE_COLUMN_3"), 290); - LvInsertColumn(hWnd, L_LIST, 3, _UU("SM_LICENSE_COLUMN_4"), 150); - LvInsertColumn(hWnd, L_LIST, 4, _UU("SM_LICENSE_COLUMN_5"), 120); - LvInsertColumn(hWnd, L_LIST, 5, _UU("SM_LICENSE_COLUMN_6"), 250); - LvInsertColumn(hWnd, L_LIST, 6, _UU("SM_LICENSE_COLUMN_7"), 100); - LvInsertColumn(hWnd, L_LIST, 7, _UU("SM_LICENSE_COLUMN_8"), 100); - LvInsertColumn(hWnd, L_LIST, 8, _UU("SM_LICENSE_COLUMN_9"), 100); - - LvInitEx(hWnd, L_STATUS, true); - LvInsertColumn(hWnd, L_STATUS, 0, _UU("SM_STATUS_COLUMN_1"), 100); - LvInsertColumn(hWnd, L_STATUS, 1, _UU("SM_STATUS_COLUMN_2"), 100); - - EmLicenseDlgRefresh(hWnd, s); -} - -// License dialog update -void EmLicenseDlgRefresh(HWND hWnd, RPC *s) -{ - RPC_ENUM_LICENSE_KEY t; - RPC_EL_LICENSE_STATUS st; - UINT i; - wchar_t tmp[MAX_SIZE]; - LVB *b; - // Validate arguments - if (hWnd == NULL || s == NULL) - { - return; - } - - Zero(&t, sizeof(t)); - - if (CALL(hWnd, EcEnumLicenseKey(s, &t)) == false) - { - Close(hWnd); - return; - } - - b = LvInsertStart(); - - for (i = 0;i < t.NumItem;i++) - { - wchar_t tmp1[32], tmp2[LICENSE_KEYSTR_LEN + 1], tmp3[LICENSE_MAX_PRODUCT_NAME_LEN + 1], - *tmp4, tmp5[128], tmp6[LICENSE_LICENSEID_STR_LEN + 1], tmp7[64], - tmp8[64], tmp9[64]; - RPC_ENUM_LICENSE_KEY_ITEM *e = &t.Items[i]; - - UniToStru(tmp1, e->Id); - StrToUni(tmp2, sizeof(tmp2), e->LicenseKey); - StrToUni(tmp3, sizeof(tmp3), e->LicenseName); - tmp4 = LiGetLicenseStatusStr(e->Status); - if (e->Expires == 0) - { - UniStrCpy(tmp5, sizeof(tmp5), _UU("SM_LICENSE_NO_EXPIRES")); - } - else - { - GetDateStrEx64(tmp5, sizeof(tmp5), e->Expires, NULL); - } - StrToUni(tmp6, sizeof(tmp6), e->LicenseId); - UniToStru(tmp7, e->ProductId); - UniFormat(tmp8, sizeof(tmp8), L"%I64u", e->SystemId); - UniToStru(tmp9, e->SerialId); - - LvInsertAdd(b, - e->Status == LICENSE_STATUS_OK ? ICO_PASS : ICO_DISCARD, - (void *)e->Id, 9, - tmp1, tmp2, tmp3, tmp4, tmp5, tmp6, tmp7, tmp8, tmp9); - } - - LvInsertEnd(b, hWnd, L_LIST); - - FreeRpcEnumLicenseKey(&t); - - Zero(&st, sizeof(st)); - - if (CALL(hWnd, EcGetLicenseStatus(s, &st)) == false) - { - Close(hWnd); - return; - } - - b = LvInsertStart(); - - if (st.Valid == false) - { - LvInsertAdd(b, 0, NULL, 2, _UU("EM_NO_LICENSE_COLUMN"), _UU("EM_NO_LICENSE")); - } - else - { - // Current system ID - UniFormat(tmp, sizeof(tmp), L"%I64u", st.SystemId); - LvInsertAdd(b, 0, NULL, 2, _UU("SM_LICENSE_STATUS_SYSTEM_ID"), tmp); - - // Expiration date of the current license product - if (st.SystemExpires == 0) - { - UniStrCpy(tmp, sizeof(tmp), _UU("SM_LICENSE_NO_EXPIRES")); - } - else - { - GetDateStrEx64(tmp, sizeof(tmp), st.SystemExpires, NULL); - } - LvInsertAdd(b, 0, NULL, 2, _UU("SM_LICENSE_STATUS_EXPIRES"), tmp); - } - - LvInsertEnd(b, hWnd, L_STATUS); - - if (LvNum(hWnd, L_STATUS) >= 1) - { - LvAutoSize(hWnd, L_STATUS); - } - - EmLicenseDlgUpdate(hWnd, s); -} - -// License dialog control update -void EmLicenseDlgUpdate(HWND hWnd, RPC *s) -{ - bool b = false; - // Validate arguments - if (hWnd == NULL || s == NULL) - { - return; - } - - b = LvIsSingleSelected(hWnd, L_LIST); - - SetEnable(hWnd, B_DEL, b); - SetEnable(hWnd, IDOK, b); -} - -// License dialog -UINT EmLicenseDlg(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param) -{ - RPC *s = (RPC *)param; - NMHDR *n; - // Validate arguments - if (hWnd == NULL) - { - return 0; - } - - switch (msg) - { - case WM_INITDIALOG: - EmLicenseDlgInit(hWnd, s); - break; - - case WM_NOTIFY: - n = (NMHDR *)lParam; - switch (n->code) - { - case LVN_ITEMCHANGED: - switch (n->idFrom) - { - case L_LIST: - case L_STATUS: - EmLicenseDlgUpdate(hWnd, s); - break; - } - break; - } - break; - - case WM_COMMAND: - switch (wParam) - { - case IDOK: - if (IsEnable(hWnd, IDOK)) - { - UINT i = LvGetSelected(hWnd, L_LIST); - - if (i != INFINITE) - { - char *s = LvGetStrA(hWnd, L_LIST, i, 5); - char tmp[MAX_SIZE]; - - Format(tmp, sizeof(tmp), _SS("LICENSE_SUPPORT_URL"), s); - ShellExecute(hWnd, "open", tmp, NULL, NULL, SW_SHOW); - - Free(s); - } - } - break; - - case B_OBTAIN: - ShellExecute(hWnd, "open", _SS("LICENSE_INFO_URL"), NULL, NULL, SW_SHOW); - break; - - case B_ADD: - if (EmLicenseAdd(hWnd, s)) - { - EmLicenseDlgRefresh(hWnd, s); - } - break; - - case B_DEL: - if (IsEnable(hWnd, B_DEL)) - { - UINT id = (UINT)LvGetParam(hWnd, L_LIST, LvGetSelected(hWnd, L_LIST)); - - if (id != 0) - { - if (MsgBox(hWnd, MB_ICONQUESTION | MB_YESNO | MB_DEFBUTTON2, _UU("SM_LICENSE_DELETE_MSG")) == IDYES) - { - RPC_TEST t; - - Zero(&t, sizeof(t)); - t.IntValue = id; - - if (CALL(hWnd, EcDelLicenseKey(s, &t))) - { - EmLicenseDlgRefresh(hWnd, s); - } - } - } - } - break; - - case IDCANCEL: - Close(hWnd); - break; - } - break; - - case WM_CLOSE: - EndDialog(hWnd, 0); - break; - } - - LvStandardHandler(hWnd, msg, wParam, lParam, L_LIST); - - return 0; -} - - - - - -// Change Password dialog -UINT EmPasswordDlg(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param) -{ - RPC *r = (RPC *)param; - char pass1[MAX_PATH]; - char pass2[MAX_PATH]; - UCHAR hash[SHA1_SIZE]; - RPC_SET_PASSWORD t; - // Validate arguments - if (hWnd == NULL) - { - return 0; - } - - switch (msg) - { - case WM_INITDIALOG: - Focus(hWnd, E_PASSWORD1); - break; - - case WM_COMMAND: - switch (wParam) - { - case IDOK: - GetTxtA(hWnd, E_PASSWORD1, pass1, sizeof(pass1)); - Sha0(hash, pass1, StrLen(pass1)); - Zero(&t, sizeof(t)); - Copy(t.HashedPassword, hash, SHA1_SIZE); - if (CALL(hWnd, EcSetPassword(r, &t)) == false) - { - break; - } - MsgBox(hWnd, MB_ICONINFORMATION, _UU("CM_PASSWORD_SET")); - EndDialog(hWnd, 1); - break; - - case IDCANCEL: - Close(hWnd); - break; - } - - switch (LOWORD(wParam)) - { - case E_PASSWORD1: - case E_PASSWORD2: - GetTxtA(hWnd, E_PASSWORD1, pass1, sizeof(pass1)); - GetTxtA(hWnd, E_PASSWORD2, pass2, sizeof(pass2)); - SetEnable(hWnd, IDOK, StrCmp(pass1, pass2) == 0 ? true : false); - break; - } - break; - - case WM_CLOSE: - EndDialog(hWnd, 0); - break; - } - - return 0; -} - -// Copy the state of the dialog to the HUB_LOG -void EmDlgToHubLog(HWND hWnd, HUB_LOG *g) -{ - // Validate arguments - if (hWnd == NULL || g == NULL) - { - return; - } - - Zero(g, sizeof(HUB_LOG)); - g->PacketLogSwitchType = CbGetSelect(hWnd, C_PACKET_SWITCH); - g->PacketLogConfig[0] = IsChecked(hWnd, B_PACKET_0_0) ? 0 : IsChecked(hWnd, B_PACKET_0_1) ? 1 : 2; - g->PacketLogConfig[1] = IsChecked(hWnd, B_PACKET_1_0) ? 0 : IsChecked(hWnd, B_PACKET_1_1) ? 1 : 2; - g->PacketLogConfig[2] = IsChecked(hWnd, B_PACKET_2_0) ? 0 : IsChecked(hWnd, B_PACKET_2_1) ? 1 : 2; - g->PacketLogConfig[3] = IsChecked(hWnd, B_PACKET_3_0) ? 0 : IsChecked(hWnd, B_PACKET_3_1) ? 1 : 2; - g->PacketLogConfig[4] = IsChecked(hWnd, B_PACKET_4_0) ? 0 : IsChecked(hWnd, B_PACKET_4_1) ? 1 : 2; - g->PacketLogConfig[5] = IsChecked(hWnd, B_PACKET_5_0) ? 0 : IsChecked(hWnd, B_PACKET_5_1) ? 1 : 2; - g->PacketLogConfig[6] = IsChecked(hWnd, B_PACKET_6_0) ? 0 : IsChecked(hWnd, B_PACKET_6_1) ? 1 : 2; - g->PacketLogConfig[7] = IsChecked(hWnd, B_PACKET_7_0) ? 0 : IsChecked(hWnd, B_PACKET_7_1) ? 1 : 2; -} - -// Copy the HUB_LOG to the state of the dialog -void EmHubLogToDlg(HWND hWnd, HUB_LOG *g) -{ - // Validate arguments - if (hWnd == NULL || g == NULL) - { - return; - } - - CbSelect(hWnd, C_PACKET_SWITCH, g->PacketLogSwitchType); - - Check(hWnd, B_PACKET_0_0, g->PacketLogConfig[0] == 0); - Check(hWnd, B_PACKET_0_1, g->PacketLogConfig[0] == 1); - Check(hWnd, B_PACKET_0_2, g->PacketLogConfig[0] == 2); - - Check(hWnd, B_PACKET_1_0, g->PacketLogConfig[1] == 0); - Check(hWnd, B_PACKET_1_1, g->PacketLogConfig[1] == 1); - Check(hWnd, B_PACKET_1_2, g->PacketLogConfig[1] == 2); - - Check(hWnd, B_PACKET_2_0, g->PacketLogConfig[2] == 0); - Check(hWnd, B_PACKET_2_1, g->PacketLogConfig[2] == 1); - Check(hWnd, B_PACKET_2_2, g->PacketLogConfig[2] == 2); - - Check(hWnd, B_PACKET_3_0, g->PacketLogConfig[3] == 0); - Check(hWnd, B_PACKET_3_1, g->PacketLogConfig[3] == 1); - Check(hWnd, B_PACKET_3_2, g->PacketLogConfig[3] == 2); - - Check(hWnd, B_PACKET_4_0, g->PacketLogConfig[4] == 0); - Check(hWnd, B_PACKET_4_1, g->PacketLogConfig[4] == 1); - Check(hWnd, B_PACKET_4_2, g->PacketLogConfig[4] == 2); - - Check(hWnd, B_PACKET_5_0, g->PacketLogConfig[5] == 0); - Check(hWnd, B_PACKET_5_1, g->PacketLogConfig[5] == 1); - Check(hWnd, B_PACKET_5_2, g->PacketLogConfig[5] == 2); - - Check(hWnd, B_PACKET_6_0, g->PacketLogConfig[6] == 0); - Check(hWnd, B_PACKET_6_1, g->PacketLogConfig[6] == 1); - Check(hWnd, B_PACKET_6_2, g->PacketLogConfig[6] == 2); - - Check(hWnd, B_PACKET_7_0, g->PacketLogConfig[7] == 0); - Check(hWnd, B_PACKET_7_1, g->PacketLogConfig[7] == 1); - Check(hWnd, B_PACKET_7_2, g->PacketLogConfig[7] == 2); -} - -// Initialize -void EmAddInit(HWND hWnd, EM_ADD *p) -{ - // Validate arguments - if (hWnd == NULL || p == NULL) - { - return; - } - - // Initialize controls - CbAddStr(hWnd, C_PACKET_SWITCH, _UU("SM_LOG_SWITCH_0"), 0); - CbAddStr(hWnd, C_PACKET_SWITCH, _UU("SM_LOG_SWITCH_1"), 1); - CbAddStr(hWnd, C_PACKET_SWITCH, _UU("SM_LOG_SWITCH_2"), 2); - CbAddStr(hWnd, C_PACKET_SWITCH, _UU("SM_LOG_SWITCH_3"), 3); - CbAddStr(hWnd, C_PACKET_SWITCH, _UU("SM_LOG_SWITCH_4"), 4); - CbAddStr(hWnd, C_PACKET_SWITCH, _UU("SM_LOG_SWITCH_5"), 5); - - if (p->NewMode) - { - // Newly creation mode - RPC_ENUM_DEVICE t; - HUB_LOG g; - - Zero(&g, sizeof(g)); - g.PacketLogSwitchType = LOG_SWITCH_DAY; - g.PacketLogConfig[PACKET_LOG_TCP_CONN] = g.PacketLogConfig[PACKET_LOG_DHCP] = 1; - - EmHubLogToDlg(hWnd, &g); - - Zero(&t, sizeof(t)); - if (CALL(hWnd, EcEnumAllDevice(p->Rpc, &t))) - { - UINT i; - CbSetHeight(hWnd, C_DEVICE, 18); - - for (i = 0;i < t.NumItem;i++) - { - RPC_ENUM_DEVICE_ITEM *dev = &t.Items[i]; - wchar_t tmp[MAX_SIZE]; - - StrToUni(tmp, sizeof(tmp), dev->DeviceName); - - CbAddStr(hWnd, C_DEVICE, tmp, 0); - } - - FreeRpcEnumDevice(&t); - } - - SetText(hWnd, 0, _UU("EM_ADD_NEW")); - } - else - { - // Edit mode (to obtain a configuration) - wchar_t tmp[MAX_PATH]; - RPC_ADD_DEVICE t; - Hide(hWnd, R_PROMISCUOUS); - - Zero(&t, sizeof(t)); - StrCpy(t.DeviceName, sizeof(t.DeviceName), p->DeviceName); - - if (CALL(hWnd, EcGetDevice(p->Rpc, &t))) - { - EmHubLogToDlg(hWnd, &t.LogSetting); - } - else - { - Close(hWnd); - } - - StrToUni(tmp, sizeof(tmp), p->DeviceName); - CbAddStr(hWnd, C_DEVICE, tmp, 0); - - Disable(hWnd, C_DEVICE); - - SetText(hWnd, 0, _UU("EM_ADD_EDIT")); - } - - EmAddUpdate(hWnd, p); -} - -// [OK] button -void EmAddOk(HWND hWnd, EM_ADD *p) -{ - RPC_ADD_DEVICE t; - wchar_t *tmp; - char *name; - // Validate arguments - if (hWnd == NULL || p == NULL) - { - return; - } - - Zero(&t, sizeof(t)); - EmDlgToHubLog(hWnd, &t.LogSetting); - tmp = CbGetStr(hWnd, C_DEVICE); - name = CopyUniToStr(tmp); - - StrCpy(t.DeviceName, sizeof(t.DeviceName), name); - - if (p->NewMode) - { - t.NoPromiscuous = IsChecked(hWnd, R_PROMISCUOUS); - } - - if (p->NewMode) - { - if (CALL(hWnd, EcAddDevice(p->Rpc, &t))) - { - Close(hWnd); - } - } - else - { - if (CALL(hWnd, EcSetDevice(p->Rpc, &t))) - { - Close(hWnd); - } - } - - Free(name); - Free(tmp); -} - -// Control update -void EmAddUpdate(HWND hWnd, EM_ADD *p) -{ - wchar_t *tmp; - char *name; - // Validate arguments - if (hWnd == NULL || p == NULL) - { - return; - } - - tmp = CbGetStr(hWnd, C_DEVICE); - name = CopyUniToStr(tmp); - - Trim(name); - - if (StrLen(name) == 0) - { - Disable(hWnd, IDOK); - } - else - { - Enable(hWnd, IDCANCEL); - } - - Free(name); - Free(tmp); -} - -// Device Add / Edit dialog -UINT EmAddDlg(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param) -{ - EM_ADD *p = (EM_ADD *)param; - // Validate arguments - if (hWnd == NULL) - { - return 0; - } - - switch (msg) - { - case WM_INITDIALOG: - EmAddInit(hWnd, p); - break; - - case WM_COMMAND: - EmAddUpdate(hWnd, p); - switch (wParam) - { - case IDOK: - EmAddOk(hWnd, p); - break; - - case IDCANCEL: - Close(hWnd); - break; - } - break; - - case WM_CLOSE: - EndDialog(hWnd, 0); - break; - } - - return 0; -} - -// Add or edit -void EmAdd(HWND hWnd, RPC *r, char *device_name) -{ - EM_ADD p; - // Validate arguments - if (hWnd == NULL || r == NULL) - { - return; - } - - Zero(&p, sizeof(p)); - - p.Rpc = r; - - if (device_name != NULL) - { - StrCpy(p.DeviceName, sizeof(p.DeviceName), device_name); - } - else - { - p.NewMode = true; - } - - Dialog(hWnd, D_EM_ADD, EmAddDlg, &p); -} - -// Initialize -void EmMainInit(HWND hWnd, RPC *r) -{ - // Validate arguments - if (hWnd == NULL || r == NULL) - { - return; - } - - LvInit(hWnd, L_LIST); - LvInsertColumn(hWnd, L_LIST, 0, _UU("EM_MAIN_COLUMN_1"), 300); - LvInsertColumn(hWnd, L_LIST, 1, _UU("EM_MAIN_COLUMN_2"), 150); - - SetIcon(hWnd, 0, ICO_NIC_ONLINE); - - EmMainRefresh(hWnd, r); - - SetTimer(hWnd, 1, 1000, NULL); -} - -// Control update -void EmMainUpdate(HWND hWnd, RPC *r) -{ - // Validate arguments - if (hWnd == NULL || r == NULL) - { - return; - } - - SetEnable(hWnd, IDOK, LvIsMasked(hWnd, L_LIST) && LvIsMultiMasked(hWnd, L_LIST) == false); - SetEnable(hWnd, B_DELETE, LvIsMasked(hWnd, L_LIST) && LvIsMultiMasked(hWnd, L_LIST) == false); -} - -// Update -void EmMainRefresh(HWND hWnd, RPC *r) -{ - RPC_ENUM_DEVICE t; - // Validate arguments - if (hWnd == NULL || r == NULL) - { - return; - } - - Zero(&t, sizeof(t)); - - if (CALL(hWnd, EcEnumDevice(r, &t))) - { - UINT i; - LVB *b; - - b = LvInsertStart(); - - for (i = 0;i < t.NumItem;i++) - { - wchar_t tmp[MAX_PATH]; - RPC_ENUM_DEVICE_ITEM *dev = &t.Items[i]; - - StrToUni(tmp, sizeof(tmp), dev->DeviceName); - - LvInsertAdd(b, - dev->Active ? ICO_NIC_ONLINE : ICO_NIC_OFFLINE, - NULL, - 2, - tmp, - dev->Active ? _UU("EM_MAIN_OK") : _UU("EM_MAIN_ERROR")); - } - - LvInsertEnd(b, hWnd, L_LIST); - - FreeRpcEnumDevice(&t); - - SetShow(hWnd, B_LICENSE, t.IsLicenseSupported); - } - else - { - Close(hWnd); - } - - EmMainUpdate(hWnd, r); -} - -// Main dialog procedure -UINT EmMainDlg(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param) -{ - NMHDR *n; - RPC *r = (RPC *)param; - UINT i; - char *name; - // Validate arguments - if (hWnd == NULL) - { - return 0; - } - - switch (msg) - { - case WM_INITDIALOG: - EmMainInit(hWnd, r); - break; - - case WM_COMMAND: - switch (wParam) - { - case IDOK: - // Edit - i = LvGetSelected(hWnd, L_LIST); - if (i != INFINITE) - { - wchar_t *tmp; - tmp = LvGetStr(hWnd, L_LIST, i, 0); - if (tmp != NULL) - { - name = CopyUniToStr(tmp); - EmAdd(hWnd, r, name); - Free(tmp); - Free(name); - } - } - break; - - case B_PASSWORD: - // Admin password - Dialog(hWnd, D_EM_PASSWORD, EmPasswordDlg, r); - break; - - case B_LICENSE: - // Admin password - Dialog(hWnd, D_EM_LICENSE, EmLicenseDlg, r); - break; - - case B_ADD: - // Add - EmAdd(hWnd, r, NULL); - EmMainRefresh(hWnd, r); - break; - - case B_DELETE: - // Delete - i = LvGetSelected(hWnd, L_LIST); - if (i != INFINITE) - { - wchar_t *tmp; - tmp = LvGetStr(hWnd, L_LIST, i, 0); - if (tmp != NULL) - { - RPC_DELETE_DEVICE t; - wchar_t msg[MAX_SIZE]; - name = CopyUniToStr(tmp); - UniFormat(msg, sizeof(msg), _UU("EM_DELETE_CONFIRM"), name); - if (MsgBox(hWnd, MB_YESNO | MB_ICONEXCLAMATION | MB_DEFBUTTON2, msg) == IDYES) - { - Zero(&t, sizeof(t)); - StrCpy(t.DeviceName, sizeof(t.DeviceName), name); - if (CALL(hWnd, EcDelDevice(r, &t))) - { - EmMainRefresh(hWnd, r); - } - } - Free(tmp); - Free(name); - } - } - break; - - case IDCANCEL: - Close(hWnd); - break; - } - break; - - case WM_TIMER: - switch (wParam) - { - case 1: - KillTimer(hWnd, 1); - EmMainRefresh(hWnd, r); - SetTimer(hWnd, 1, 1000, NULL); - break; - } - break; - - case WM_NOTIFY: - n = (NMHDR *)lParam; - switch (n->code) - { - case NM_DBLCLK: - switch (n->idFrom) - { - case L_LIST: - if (IsEnable(hWnd, IDOK)) - { - Command(hWnd, IDOK); - } - break; - } - break; - case LVN_ITEMCHANGED: - switch (n->idFrom) - { - case L_LIST: - EmMainUpdate(hWnd, r); - break; - } - break; - } - break; - - case WM_CLOSE: - EndDialog(hWnd, 0); - break; - } - - return 0; -} - -// Installation of WinPcap -void EmInstallWinPcap(HWND hWnd, RPC *r) -{ - wchar_t temp_name[MAX_SIZE]; - HGLOBAL g; - HINSTANCE h; - HRSRC hr; - UINT size; - void *data; - IO *io; - - // Ask whether the user want to start the installation - if (MsgBox(hWnd, MB_ICONQUESTION | MB_YESNO, _UU("EM_WPCAP_INSTALL")) == IDNO) - { - return; - } - - // Generate a temporary file name - UniFormat(temp_name, sizeof(temp_name), L"%s\\winpcap_installer.exe", MsGetTempDirW()); - - // Read from the resource - h = GetUiDll(); - hr = FindResource(h, MAKEINTRESOURCE(BIN_WINPCAP), "BIN"); - if (hr == NULL) - { -RES_ERROR: - MsgBox(hWnd, MB_ICONSTOP, _UU("EM_RESOURCE")); - return; - } - - g = LoadResource(h, hr); - if (g == NULL) - { - goto RES_ERROR; - } - - size = SizeofResource(h, hr); - data = LockResource(g); - - if (data == NULL) - { - goto RES_ERROR; - } - - // Write to a temporary file - io = FileCreateW(temp_name); - if (io == NULL) - { - goto RES_ERROR; - } - - FileWrite(io, data, size); - FileClose(io); - - // Run - if (RunW(temp_name, NULL, false, true) == false) - { - // Failure - FileDeleteW(temp_name); - goto RES_ERROR; - } - - FileDeleteW(temp_name); - - if (r == NULL) - { - return; - } - - // Message after the end - if (OS_IS_WINDOWS_NT(GetOsInfo()->OsType) == false) - { - // Need to restart the computer - MsgBox(hWnd, MB_ICONINFORMATION, _UU("EM_WPCAP_REBOOT1")); - } - else - { - // Need to restart the service - if (MsgBox(hWnd, MB_ICONQUESTION | MB_YESNO, _UU("EM_WPCAP_REBOOT2")) == IDNO) - { - // Not restart - } - else - { - // Restart - RPC_TEST t; - RPC_BRIDGE_SUPPORT t2; - Zero(&t, sizeof(t)); - EcRebootServer(r, &t); - - SleepThread(500); - - Zero(&t2, sizeof(t2)); - CALL(hWnd, EcGetBridgeSupport(r, &t2)); - } - } -} - -// Main screen -void EMMain(RPC *r) -{ - RPC_BRIDGE_SUPPORT t; - - // Validate arguments - if (r == NULL) - { - return; - } - - // Examine the bridge support status of the server side first - Zero(&t, sizeof(t)); - if (CALLEX(NULL, ScGetBridgeSupport(r, &t)) == ERR_NO_ERROR) - { - if (t.IsBridgeSupportedOs == false) - { - // OS does not support the bridge - MsgBox(NULL, MB_ICONEXCLAMATION, _UU("EM_UNSUPPORTED")); - return; - } - - if (t.IsWinPcapNeeded) - { - if (r->Sock->RemoteIP.addr[0] != 127) - { - // WinPcap is required, but can not do anything because it is in remote management mode - MsgBox(NULL, MB_ICONINFORMATION, _UU("EM_WPCAP_REMOTE")); - return; - } - else - { - // WinPcap is required, and it's in local management mode - if (MsIsAdmin()) - { - // Administrators - EmInstallWinPcap(NULL, r); - return; - } - else - { - // Non-Administrators - MsgBox(NULL, MB_ICONINFORMATION, _UU("EM_WPCAP_ROOT")); - return; - } - } - } - } - - Dialog(NULL, D_EM_MAIN, EmMainDlg, r); -} - -// Remote connection dialog procedure -UINT EmRemoteDlgProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param) -{ - WINUI_REMOTE *r = (WINUI_REMOTE *)param; - CEDAR *c; - // Validate arguments - if (hWnd == NULL) - { - return 0; - } - - switch (msg) - { - case WM_INITDIALOG: - RemoteDlgInit(hWnd, r); - SetTimer(hWnd, 1, 100, NULL); - break; - case WM_TIMER: - switch (wParam) - { - case 1: - KillTimer(hWnd, 1); - RemoteDlgRefresh(hWnd, r); - SetTimer(hWnd, 1, 100, NULL); - break; - } - break; - case WM_COMMAND: - switch (wParam) - { - case R_LOCAL: - if (IsChecked(hWnd, R_LOCAL) == false) - { - SetTextA(hWnd, C_HOSTNAME, ""); - RemoteDlgRefresh(hWnd, r); - FocusEx(hWnd, C_HOSTNAME); - } - else - { - SetTextA(hWnd, C_HOSTNAME, "localhost"); - RemoteDlgRefresh(hWnd, r); - Focus(hWnd, IDOK); - } - break; - case IDCANCEL: - Close(hWnd); - break; - case IDOK: - RemoteDlgOnOk(hWnd, r); - break; - case B_ABOUT: - c = NewCedar(NULL, NULL); - About(hWnd, c, _UU("PRODUCT_NAME_ELOGMGR")); - ReleaseCedar(c); - } - switch (LOWORD(wParam)) - { - case R_LOCAL: - case C_HOSTNAME: - RemoteDlgRefresh(hWnd, r); - break; - } - break; - case WM_CLOSE: - FreeCandidateList(r->CandidateList); - EndDialog(hWnd, false); - break; - } - - return 0; -} - -// Remote connection dialog -char *EmRemoteDlg() -{ - WINUI_REMOTE r; - - Zero(&r, sizeof(r)); - r.RegKeyName = EM_REG_KEY; - r.Caption = _UU("EM_TITLE"); - r.Title = _UU("EM_REMOTE_TITLE"); - r.Icon = ICO_USER_ADMIN; - r.DefaultHostname = NULL; - - if (Dialog(NULL, D_EM_REMOTE, EmRemoteDlgProc, &r) == false) - { - return NULL; - } - - return r.Hostname; -} - -// Start the EtherLogger Manager -void EMExec() -{ - char *host; - char *ret; - bool cancel_now = false; - TOKEN_LIST *t; - UINT port = EL_ADMIN_PORT; - InitWinUi(_UU("EM_TITLE"), _SS("DEFAULT_FONT"), _II("DEFAULT_FONT_SIZE")); - - while (true) - { - ret = EmRemoteDlg(); - - if (ret != NULL) - { - t = ParseToken(ret, ":"); - if (t->NumTokens == 1 || t->NumTokens == 2) - { - RPC *rpc = NULL; - bool ok = false; - UINT ret; - host = t->Token[0]; - if (t->NumTokens == 2) - { - port = ToInt(t->Token[1]); - } - else - { - port = EL_ADMIN_PORT; - } - - // Try without a password first - ret = EcConnect(host, port, "", &rpc); -RETRY: - if (ret != ERR_NO_ERROR && ret != ERR_AUTH_FAILED) - { - // Connection failed - CALL(NULL, ret); - } - else - { - if (ret == ERR_NO_ERROR) - { - // Successful connection - ok = true; - } - else - { - // Password required - char *pass = SmPassword(NULL, host); - if (pass == NULL) - { - // Cancel - cancel_now = true; - } - else - { - // Retry - ret = EcConnect(host, port, pass, &rpc); - Free(pass); - if (ret == ERR_NO_ERROR) - { - ok = true; - } - else - { - goto RETRY; - } - } - } - } - - if (ok) - { - // Main screen - EMMain(rpc); - - // Disconnect - EcDisconnect(rpc); - cancel_now = true; - } - FreeToken(t); - } - Free(ret); - } - else - { - cancel_now = true; - } - - if (cancel_now) - { - break; - } - } - - FreeWinUi(); -} - -#endif // WIN32 +// SoftEther VPN Source Code - Developer Edition Master Branch +// Cedar Communication Module + + +// EM.c +// EtherLogger Manager for Win32 + +#include + +#ifdef WIN32 + +#define SM_C +#define CM_C +#define NM_C +#define EM_C + +#define _WIN32_WINNT 0x0502 +#define WINVER 0x0502 +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "CMInner.h" +#include "SMInner.h" +#include "NMInner.h" +#include "EMInner.h" +#include "../PenCore/resource.h" + + +// License registration process +void EmLicenseAddDlgOnOk(HWND hWnd, RPC *s) +{ +} + +// Shift treatment of text input +void EmLicenseAddDlgShiftTextItem(HWND hWnd, UINT id1, UINT id2, UINT *next_focus) +{ + char *s; + // Validate arguments + if (hWnd == NULL || next_focus == NULL) + { + return; + } + + s = GetTextA(hWnd, id1); + if (StrLen(s) >= 6) + { + char *s2 = CopyStr(s); + char tmp[MAX_SIZE]; + s2[6] = 0; + SetTextA(hWnd, id1, s2); + Free(s2); + + if (id2 != 0) + { + GetTxtA(hWnd, id2, tmp, sizeof(tmp)); + + StrCat(tmp, sizeof(tmp), s + 6); + ReplaceStrEx(tmp, sizeof(tmp), tmp, "-", "", false); + + SetTextA(hWnd, id2, tmp); + + *next_focus = id2; + } + else + { + *next_focus = IDOK; + } + } + + Free(s); +} + +// Make a text from the input data +void EmLicenseAddDlgGetText(HWND hWnd, char *str, UINT size) +{ + char *k1, *k2, *k3, *k4, *k5, *k6; + // Validate arguments + if (hWnd == NULL || str == NULL) + { + return; + } + + k1 = GetTextA(hWnd, B_KEY1); + k2 = GetTextA(hWnd, B_KEY2); + k3 = GetTextA(hWnd, B_KEY3); + k4 = GetTextA(hWnd, B_KEY4); + k5 = GetTextA(hWnd, B_KEY5); + k6 = GetTextA(hWnd, B_KEY6); + + Format(str, size, "%s-%s-%s-%s-%s-%s", k1, k2, k3, k4, k5, k6); + + Free(k1); + Free(k2); + Free(k3); + Free(k4); + Free(k5); + Free(k6); +} + +// License addition dialog update +void EmLicenseAddDlgUpdate(HWND hWnd, RPC *s) +{ +} + +// License addition dialog initialization +void EmLicenseAddDlgInit(HWND hWnd, RPC *s) +{ + HFONT h; + // Validate arguments + if (hWnd == NULL || s == NULL) + { + return; + } + + h = GetFont("Arial", 10, true, false, false, false); + SetFont(hWnd, B_KEY1, h); + SetFont(hWnd, B_KEY2, h); + SetFont(hWnd, B_KEY3, h); + SetFont(hWnd, B_KEY4, h); + SetFont(hWnd, B_KEY5, h); + SetFont(hWnd, B_KEY6, h); + + DlgFont(hWnd, S_INFO, 10, true); + + EmLicenseAddDlgUpdate(hWnd, s); +} + +// License addition dialog +UINT EmLicenseAddDlg(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param) +{ + RPC *s = (RPC *)param; + // Validate arguments + if (hWnd == NULL) + { + return 0; + } + + switch (msg) + { + case WM_INITDIALOG: + EmLicenseAddDlgInit(hWnd, s); + break; + + case WM_COMMAND: + switch (LOWORD(wParam)) + { + case B_KEY1: + case B_KEY2: + case B_KEY3: + case B_KEY4: + case B_KEY5: + case B_KEY6: + switch (HIWORD(wParam)) + { + case EN_CHANGE: + EmLicenseAddDlgUpdate(hWnd, s); + + switch (LOWORD(wParam)) + { + case B_KEY2: + if (GetTextLen(hWnd, B_KEY2, true) == 0) + { + FocusEx(hWnd, B_KEY1); + } + break; + case B_KEY3: + if (GetTextLen(hWnd, B_KEY3, true) == 0) + { + FocusEx(hWnd, B_KEY2); + } + break; + case B_KEY4: + if (GetTextLen(hWnd, B_KEY4, true) == 0) + { + FocusEx(hWnd, B_KEY3); + } + break; + case B_KEY5: + if (GetTextLen(hWnd, B_KEY5, true) == 0) + { + FocusEx(hWnd, B_KEY4); + } + break; + case B_KEY6: + if (GetTextLen(hWnd, B_KEY6, true) == 0) + { + FocusEx(hWnd, B_KEY5); + } + break; + } + break; + } + break; + } + + switch (wParam) + { + case IDOK: + EmLicenseAddDlgOnOk(hWnd, s); + break; + + case IDCANCEL: + Close(hWnd); + break; + } + break; + + case WM_CLOSE: + EndDialog(hWnd, 0); + break; + } + + return 0; +} + +// Add a license +bool EmLicenseAdd(HWND hWnd, RPC *s) +{ + // Validate arguments + if (s == NULL) + { + return false; + } + + return Dialog(hWnd, D_EM_LICENSE_ADD, EmLicenseAddDlg, s); +} + +// License dialog initialization +void EmLicenseDlgInit(HWND hWnd, RPC *s) +{ + // Validate arguments + if (hWnd == NULL || s == NULL) + { + return; + } + + SetIcon(hWnd, 0, ICO_CERT); + + DlgFont(hWnd, S_BOLD, 0, true); + DlgFont(hWnd, S_BOLD2, 0, true); + + LvInit(hWnd, L_LIST); + LvSetStyle(hWnd, L_LIST, LVS_EX_GRIDLINES); + LvInsertColumn(hWnd, L_LIST, 0, _UU("SM_LICENSE_COLUMN_1"), 50); + LvInsertColumn(hWnd, L_LIST, 1, _UU("SM_LICENSE_COLUMN_2"), 100); + LvInsertColumn(hWnd, L_LIST, 2, _UU("SM_LICENSE_COLUMN_3"), 290); + LvInsertColumn(hWnd, L_LIST, 3, _UU("SM_LICENSE_COLUMN_4"), 150); + LvInsertColumn(hWnd, L_LIST, 4, _UU("SM_LICENSE_COLUMN_5"), 120); + LvInsertColumn(hWnd, L_LIST, 5, _UU("SM_LICENSE_COLUMN_6"), 250); + LvInsertColumn(hWnd, L_LIST, 6, _UU("SM_LICENSE_COLUMN_7"), 100); + LvInsertColumn(hWnd, L_LIST, 7, _UU("SM_LICENSE_COLUMN_8"), 100); + LvInsertColumn(hWnd, L_LIST, 8, _UU("SM_LICENSE_COLUMN_9"), 100); + + LvInitEx(hWnd, L_STATUS, true); + LvInsertColumn(hWnd, L_STATUS, 0, _UU("SM_STATUS_COLUMN_1"), 100); + LvInsertColumn(hWnd, L_STATUS, 1, _UU("SM_STATUS_COLUMN_2"), 100); + + EmLicenseDlgRefresh(hWnd, s); +} + +// License dialog update +void EmLicenseDlgRefresh(HWND hWnd, RPC *s) +{ + RPC_ENUM_LICENSE_KEY t; + RPC_EL_LICENSE_STATUS st; + UINT i; + wchar_t tmp[MAX_SIZE]; + LVB *b; + // Validate arguments + if (hWnd == NULL || s == NULL) + { + return; + } + + Zero(&t, sizeof(t)); + + if (CALL(hWnd, EcEnumLicenseKey(s, &t)) == false) + { + Close(hWnd); + return; + } + + b = LvInsertStart(); + + for (i = 0;i < t.NumItem;i++) + { + wchar_t tmp1[32], tmp2[LICENSE_KEYSTR_LEN + 1], tmp3[LICENSE_MAX_PRODUCT_NAME_LEN + 1], + *tmp4, tmp5[128], tmp6[LICENSE_LICENSEID_STR_LEN + 1], tmp7[64], + tmp8[64], tmp9[64]; + RPC_ENUM_LICENSE_KEY_ITEM *e = &t.Items[i]; + + UniToStru(tmp1, e->Id); + StrToUni(tmp2, sizeof(tmp2), e->LicenseKey); + StrToUni(tmp3, sizeof(tmp3), e->LicenseName); + tmp4 = LiGetLicenseStatusStr(e->Status); + if (e->Expires == 0) + { + UniStrCpy(tmp5, sizeof(tmp5), _UU("SM_LICENSE_NO_EXPIRES")); + } + else + { + GetDateStrEx64(tmp5, sizeof(tmp5), e->Expires, NULL); + } + StrToUni(tmp6, sizeof(tmp6), e->LicenseId); + UniToStru(tmp7, e->ProductId); + UniFormat(tmp8, sizeof(tmp8), L"%I64u", e->SystemId); + UniToStru(tmp9, e->SerialId); + + LvInsertAdd(b, + e->Status == LICENSE_STATUS_OK ? ICO_PASS : ICO_DISCARD, + (void *)e->Id, 9, + tmp1, tmp2, tmp3, tmp4, tmp5, tmp6, tmp7, tmp8, tmp9); + } + + LvInsertEnd(b, hWnd, L_LIST); + + FreeRpcEnumLicenseKey(&t); + + Zero(&st, sizeof(st)); + + if (CALL(hWnd, EcGetLicenseStatus(s, &st)) == false) + { + Close(hWnd); + return; + } + + b = LvInsertStart(); + + if (st.Valid == false) + { + LvInsertAdd(b, 0, NULL, 2, _UU("EM_NO_LICENSE_COLUMN"), _UU("EM_NO_LICENSE")); + } + else + { + // Current system ID + UniFormat(tmp, sizeof(tmp), L"%I64u", st.SystemId); + LvInsertAdd(b, 0, NULL, 2, _UU("SM_LICENSE_STATUS_SYSTEM_ID"), tmp); + + // Expiration date of the current license product + if (st.SystemExpires == 0) + { + UniStrCpy(tmp, sizeof(tmp), _UU("SM_LICENSE_NO_EXPIRES")); + } + else + { + GetDateStrEx64(tmp, sizeof(tmp), st.SystemExpires, NULL); + } + LvInsertAdd(b, 0, NULL, 2, _UU("SM_LICENSE_STATUS_EXPIRES"), tmp); + } + + LvInsertEnd(b, hWnd, L_STATUS); + + if (LvNum(hWnd, L_STATUS) >= 1) + { + LvAutoSize(hWnd, L_STATUS); + } + + EmLicenseDlgUpdate(hWnd, s); +} + +// License dialog control update +void EmLicenseDlgUpdate(HWND hWnd, RPC *s) +{ + bool b = false; + // Validate arguments + if (hWnd == NULL || s == NULL) + { + return; + } + + b = LvIsSingleSelected(hWnd, L_LIST); + + SetEnable(hWnd, B_DEL, b); + SetEnable(hWnd, IDOK, b); +} + +// License dialog +UINT EmLicenseDlg(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param) +{ + RPC *s = (RPC *)param; + NMHDR *n; + // Validate arguments + if (hWnd == NULL) + { + return 0; + } + + switch (msg) + { + case WM_INITDIALOG: + EmLicenseDlgInit(hWnd, s); + break; + + case WM_NOTIFY: + n = (NMHDR *)lParam; + switch (n->code) + { + case LVN_ITEMCHANGED: + switch (n->idFrom) + { + case L_LIST: + case L_STATUS: + EmLicenseDlgUpdate(hWnd, s); + break; + } + break; + } + break; + + case WM_COMMAND: + switch (wParam) + { + case IDOK: + if (IsEnable(hWnd, IDOK)) + { + UINT i = LvGetSelected(hWnd, L_LIST); + + if (i != INFINITE) + { + char *s = LvGetStrA(hWnd, L_LIST, i, 5); + char tmp[MAX_SIZE]; + + Format(tmp, sizeof(tmp), _SS("LICENSE_SUPPORT_URL"), s); + ShellExecute(hWnd, "open", tmp, NULL, NULL, SW_SHOW); + + Free(s); + } + } + break; + + case B_OBTAIN: + ShellExecute(hWnd, "open", _SS("LICENSE_INFO_URL"), NULL, NULL, SW_SHOW); + break; + + case B_ADD: + if (EmLicenseAdd(hWnd, s)) + { + EmLicenseDlgRefresh(hWnd, s); + } + break; + + case B_DEL: + if (IsEnable(hWnd, B_DEL)) + { + UINT id = (UINT)LvGetParam(hWnd, L_LIST, LvGetSelected(hWnd, L_LIST)); + + if (id != 0) + { + if (MsgBox(hWnd, MB_ICONQUESTION | MB_YESNO | MB_DEFBUTTON2, _UU("SM_LICENSE_DELETE_MSG")) == IDYES) + { + RPC_TEST t; + + Zero(&t, sizeof(t)); + t.IntValue = id; + + if (CALL(hWnd, EcDelLicenseKey(s, &t))) + { + EmLicenseDlgRefresh(hWnd, s); + } + } + } + } + break; + + case IDCANCEL: + Close(hWnd); + break; + } + break; + + case WM_CLOSE: + EndDialog(hWnd, 0); + break; + } + + LvStandardHandler(hWnd, msg, wParam, lParam, L_LIST); + + return 0; +} + + + + + +// Change Password dialog +UINT EmPasswordDlg(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param) +{ + RPC *r = (RPC *)param; + char pass1[MAX_PATH]; + char pass2[MAX_PATH]; + UCHAR hash[SHA1_SIZE]; + RPC_SET_PASSWORD t; + // Validate arguments + if (hWnd == NULL) + { + return 0; + } + + switch (msg) + { + case WM_INITDIALOG: + Focus(hWnd, E_PASSWORD1); + break; + + case WM_COMMAND: + switch (wParam) + { + case IDOK: + GetTxtA(hWnd, E_PASSWORD1, pass1, sizeof(pass1)); + Sha0(hash, pass1, StrLen(pass1)); + Zero(&t, sizeof(t)); + Copy(t.HashedPassword, hash, SHA1_SIZE); + if (CALL(hWnd, EcSetPassword(r, &t)) == false) + { + break; + } + MsgBox(hWnd, MB_ICONINFORMATION, _UU("CM_PASSWORD_SET")); + EndDialog(hWnd, 1); + break; + + case IDCANCEL: + Close(hWnd); + break; + } + + switch (LOWORD(wParam)) + { + case E_PASSWORD1: + case E_PASSWORD2: + GetTxtA(hWnd, E_PASSWORD1, pass1, sizeof(pass1)); + GetTxtA(hWnd, E_PASSWORD2, pass2, sizeof(pass2)); + SetEnable(hWnd, IDOK, StrCmp(pass1, pass2) == 0 ? true : false); + break; + } + break; + + case WM_CLOSE: + EndDialog(hWnd, 0); + break; + } + + return 0; +} + +// Copy the state of the dialog to the HUB_LOG +void EmDlgToHubLog(HWND hWnd, HUB_LOG *g) +{ + // Validate arguments + if (hWnd == NULL || g == NULL) + { + return; + } + + Zero(g, sizeof(HUB_LOG)); + g->PacketLogSwitchType = CbGetSelect(hWnd, C_PACKET_SWITCH); + g->PacketLogConfig[0] = IsChecked(hWnd, B_PACKET_0_0) ? 0 : IsChecked(hWnd, B_PACKET_0_1) ? 1 : 2; + g->PacketLogConfig[1] = IsChecked(hWnd, B_PACKET_1_0) ? 0 : IsChecked(hWnd, B_PACKET_1_1) ? 1 : 2; + g->PacketLogConfig[2] = IsChecked(hWnd, B_PACKET_2_0) ? 0 : IsChecked(hWnd, B_PACKET_2_1) ? 1 : 2; + g->PacketLogConfig[3] = IsChecked(hWnd, B_PACKET_3_0) ? 0 : IsChecked(hWnd, B_PACKET_3_1) ? 1 : 2; + g->PacketLogConfig[4] = IsChecked(hWnd, B_PACKET_4_0) ? 0 : IsChecked(hWnd, B_PACKET_4_1) ? 1 : 2; + g->PacketLogConfig[5] = IsChecked(hWnd, B_PACKET_5_0) ? 0 : IsChecked(hWnd, B_PACKET_5_1) ? 1 : 2; + g->PacketLogConfig[6] = IsChecked(hWnd, B_PACKET_6_0) ? 0 : IsChecked(hWnd, B_PACKET_6_1) ? 1 : 2; + g->PacketLogConfig[7] = IsChecked(hWnd, B_PACKET_7_0) ? 0 : IsChecked(hWnd, B_PACKET_7_1) ? 1 : 2; +} + +// Copy the HUB_LOG to the state of the dialog +void EmHubLogToDlg(HWND hWnd, HUB_LOG *g) +{ + // Validate arguments + if (hWnd == NULL || g == NULL) + { + return; + } + + CbSelect(hWnd, C_PACKET_SWITCH, g->PacketLogSwitchType); + + Check(hWnd, B_PACKET_0_0, g->PacketLogConfig[0] == 0); + Check(hWnd, B_PACKET_0_1, g->PacketLogConfig[0] == 1); + Check(hWnd, B_PACKET_0_2, g->PacketLogConfig[0] == 2); + + Check(hWnd, B_PACKET_1_0, g->PacketLogConfig[1] == 0); + Check(hWnd, B_PACKET_1_1, g->PacketLogConfig[1] == 1); + Check(hWnd, B_PACKET_1_2, g->PacketLogConfig[1] == 2); + + Check(hWnd, B_PACKET_2_0, g->PacketLogConfig[2] == 0); + Check(hWnd, B_PACKET_2_1, g->PacketLogConfig[2] == 1); + Check(hWnd, B_PACKET_2_2, g->PacketLogConfig[2] == 2); + + Check(hWnd, B_PACKET_3_0, g->PacketLogConfig[3] == 0); + Check(hWnd, B_PACKET_3_1, g->PacketLogConfig[3] == 1); + Check(hWnd, B_PACKET_3_2, g->PacketLogConfig[3] == 2); + + Check(hWnd, B_PACKET_4_0, g->PacketLogConfig[4] == 0); + Check(hWnd, B_PACKET_4_1, g->PacketLogConfig[4] == 1); + Check(hWnd, B_PACKET_4_2, g->PacketLogConfig[4] == 2); + + Check(hWnd, B_PACKET_5_0, g->PacketLogConfig[5] == 0); + Check(hWnd, B_PACKET_5_1, g->PacketLogConfig[5] == 1); + Check(hWnd, B_PACKET_5_2, g->PacketLogConfig[5] == 2); + + Check(hWnd, B_PACKET_6_0, g->PacketLogConfig[6] == 0); + Check(hWnd, B_PACKET_6_1, g->PacketLogConfig[6] == 1); + Check(hWnd, B_PACKET_6_2, g->PacketLogConfig[6] == 2); + + Check(hWnd, B_PACKET_7_0, g->PacketLogConfig[7] == 0); + Check(hWnd, B_PACKET_7_1, g->PacketLogConfig[7] == 1); + Check(hWnd, B_PACKET_7_2, g->PacketLogConfig[7] == 2); +} + +// Initialize +void EmAddInit(HWND hWnd, EM_ADD *p) +{ + // Validate arguments + if (hWnd == NULL || p == NULL) + { + return; + } + + // Initialize controls + CbAddStr(hWnd, C_PACKET_SWITCH, _UU("SM_LOG_SWITCH_0"), 0); + CbAddStr(hWnd, C_PACKET_SWITCH, _UU("SM_LOG_SWITCH_1"), 1); + CbAddStr(hWnd, C_PACKET_SWITCH, _UU("SM_LOG_SWITCH_2"), 2); + CbAddStr(hWnd, C_PACKET_SWITCH, _UU("SM_LOG_SWITCH_3"), 3); + CbAddStr(hWnd, C_PACKET_SWITCH, _UU("SM_LOG_SWITCH_4"), 4); + CbAddStr(hWnd, C_PACKET_SWITCH, _UU("SM_LOG_SWITCH_5"), 5); + + if (p->NewMode) + { + // Newly creation mode + RPC_ENUM_DEVICE t; + HUB_LOG g; + + Zero(&g, sizeof(g)); + g.PacketLogSwitchType = LOG_SWITCH_DAY; + g.PacketLogConfig[PACKET_LOG_TCP_CONN] = g.PacketLogConfig[PACKET_LOG_DHCP] = 1; + + EmHubLogToDlg(hWnd, &g); + + Zero(&t, sizeof(t)); + if (CALL(hWnd, EcEnumAllDevice(p->Rpc, &t))) + { + UINT i; + CbSetHeight(hWnd, C_DEVICE, 18); + + for (i = 0;i < t.NumItem;i++) + { + RPC_ENUM_DEVICE_ITEM *dev = &t.Items[i]; + wchar_t tmp[MAX_SIZE]; + + StrToUni(tmp, sizeof(tmp), dev->DeviceName); + + CbAddStr(hWnd, C_DEVICE, tmp, 0); + } + + FreeRpcEnumDevice(&t); + } + + SetText(hWnd, 0, _UU("EM_ADD_NEW")); + } + else + { + // Edit mode (to obtain a configuration) + wchar_t tmp[MAX_PATH]; + RPC_ADD_DEVICE t; + Hide(hWnd, R_PROMISCUOUS); + + Zero(&t, sizeof(t)); + StrCpy(t.DeviceName, sizeof(t.DeviceName), p->DeviceName); + + if (CALL(hWnd, EcGetDevice(p->Rpc, &t))) + { + EmHubLogToDlg(hWnd, &t.LogSetting); + } + else + { + Close(hWnd); + } + + StrToUni(tmp, sizeof(tmp), p->DeviceName); + CbAddStr(hWnd, C_DEVICE, tmp, 0); + + Disable(hWnd, C_DEVICE); + + SetText(hWnd, 0, _UU("EM_ADD_EDIT")); + } + + EmAddUpdate(hWnd, p); +} + +// [OK] button +void EmAddOk(HWND hWnd, EM_ADD *p) +{ + RPC_ADD_DEVICE t; + wchar_t *tmp; + char *name; + // Validate arguments + if (hWnd == NULL || p == NULL) + { + return; + } + + Zero(&t, sizeof(t)); + EmDlgToHubLog(hWnd, &t.LogSetting); + tmp = CbGetStr(hWnd, C_DEVICE); + name = CopyUniToStr(tmp); + + StrCpy(t.DeviceName, sizeof(t.DeviceName), name); + + if (p->NewMode) + { + t.NoPromiscuous = IsChecked(hWnd, R_PROMISCUOUS); + } + + if (p->NewMode) + { + if (CALL(hWnd, EcAddDevice(p->Rpc, &t))) + { + Close(hWnd); + } + } + else + { + if (CALL(hWnd, EcSetDevice(p->Rpc, &t))) + { + Close(hWnd); + } + } + + Free(name); + Free(tmp); +} + +// Control update +void EmAddUpdate(HWND hWnd, EM_ADD *p) +{ + wchar_t *tmp; + char *name; + // Validate arguments + if (hWnd == NULL || p == NULL) + { + return; + } + + tmp = CbGetStr(hWnd, C_DEVICE); + name = CopyUniToStr(tmp); + + Trim(name); + + if (StrLen(name) == 0) + { + Disable(hWnd, IDOK); + } + else + { + Enable(hWnd, IDCANCEL); + } + + Free(name); + Free(tmp); +} + +// Device Add / Edit dialog +UINT EmAddDlg(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param) +{ + EM_ADD *p = (EM_ADD *)param; + // Validate arguments + if (hWnd == NULL) + { + return 0; + } + + switch (msg) + { + case WM_INITDIALOG: + EmAddInit(hWnd, p); + break; + + case WM_COMMAND: + EmAddUpdate(hWnd, p); + switch (wParam) + { + case IDOK: + EmAddOk(hWnd, p); + break; + + case IDCANCEL: + Close(hWnd); + break; + } + break; + + case WM_CLOSE: + EndDialog(hWnd, 0); + break; + } + + return 0; +} + +// Add or edit +void EmAdd(HWND hWnd, RPC *r, char *device_name) +{ + EM_ADD p; + // Validate arguments + if (hWnd == NULL || r == NULL) + { + return; + } + + Zero(&p, sizeof(p)); + + p.Rpc = r; + + if (device_name != NULL) + { + StrCpy(p.DeviceName, sizeof(p.DeviceName), device_name); + } + else + { + p.NewMode = true; + } + + Dialog(hWnd, D_EM_ADD, EmAddDlg, &p); +} + +// Initialize +void EmMainInit(HWND hWnd, RPC *r) +{ + // Validate arguments + if (hWnd == NULL || r == NULL) + { + return; + } + + LvInit(hWnd, L_LIST); + LvInsertColumn(hWnd, L_LIST, 0, _UU("EM_MAIN_COLUMN_1"), 300); + LvInsertColumn(hWnd, L_LIST, 1, _UU("EM_MAIN_COLUMN_2"), 150); + + SetIcon(hWnd, 0, ICO_NIC_ONLINE); + + EmMainRefresh(hWnd, r); + + SetTimer(hWnd, 1, 1000, NULL); +} + +// Control update +void EmMainUpdate(HWND hWnd, RPC *r) +{ + // Validate arguments + if (hWnd == NULL || r == NULL) + { + return; + } + + SetEnable(hWnd, IDOK, LvIsMasked(hWnd, L_LIST) && LvIsMultiMasked(hWnd, L_LIST) == false); + SetEnable(hWnd, B_DELETE, LvIsMasked(hWnd, L_LIST) && LvIsMultiMasked(hWnd, L_LIST) == false); +} + +// Update +void EmMainRefresh(HWND hWnd, RPC *r) +{ + RPC_ENUM_DEVICE t; + // Validate arguments + if (hWnd == NULL || r == NULL) + { + return; + } + + Zero(&t, sizeof(t)); + + if (CALL(hWnd, EcEnumDevice(r, &t))) + { + UINT i; + LVB *b; + + b = LvInsertStart(); + + for (i = 0;i < t.NumItem;i++) + { + wchar_t tmp[MAX_PATH]; + RPC_ENUM_DEVICE_ITEM *dev = &t.Items[i]; + + StrToUni(tmp, sizeof(tmp), dev->DeviceName); + + LvInsertAdd(b, + dev->Active ? ICO_NIC_ONLINE : ICO_NIC_OFFLINE, + NULL, + 2, + tmp, + dev->Active ? _UU("EM_MAIN_OK") : _UU("EM_MAIN_ERROR")); + } + + LvInsertEnd(b, hWnd, L_LIST); + + FreeRpcEnumDevice(&t); + + SetShow(hWnd, B_LICENSE, t.IsLicenseSupported); + } + else + { + Close(hWnd); + } + + EmMainUpdate(hWnd, r); +} + +// Main dialog procedure +UINT EmMainDlg(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param) +{ + NMHDR *n; + RPC *r = (RPC *)param; + UINT i; + char *name; + // Validate arguments + if (hWnd == NULL) + { + return 0; + } + + switch (msg) + { + case WM_INITDIALOG: + EmMainInit(hWnd, r); + break; + + case WM_COMMAND: + switch (wParam) + { + case IDOK: + // Edit + i = LvGetSelected(hWnd, L_LIST); + if (i != INFINITE) + { + wchar_t *tmp; + tmp = LvGetStr(hWnd, L_LIST, i, 0); + if (tmp != NULL) + { + name = CopyUniToStr(tmp); + EmAdd(hWnd, r, name); + Free(tmp); + Free(name); + } + } + break; + + case B_PASSWORD: + // Admin password + Dialog(hWnd, D_EM_PASSWORD, EmPasswordDlg, r); + break; + + case B_LICENSE: + // Admin password + Dialog(hWnd, D_EM_LICENSE, EmLicenseDlg, r); + break; + + case B_ADD: + // Add + EmAdd(hWnd, r, NULL); + EmMainRefresh(hWnd, r); + break; + + case B_DELETE: + // Delete + i = LvGetSelected(hWnd, L_LIST); + if (i != INFINITE) + { + wchar_t *tmp; + tmp = LvGetStr(hWnd, L_LIST, i, 0); + if (tmp != NULL) + { + RPC_DELETE_DEVICE t; + wchar_t msg[MAX_SIZE]; + name = CopyUniToStr(tmp); + UniFormat(msg, sizeof(msg), _UU("EM_DELETE_CONFIRM"), name); + if (MsgBox(hWnd, MB_YESNO | MB_ICONEXCLAMATION | MB_DEFBUTTON2, msg) == IDYES) + { + Zero(&t, sizeof(t)); + StrCpy(t.DeviceName, sizeof(t.DeviceName), name); + if (CALL(hWnd, EcDelDevice(r, &t))) + { + EmMainRefresh(hWnd, r); + } + } + Free(tmp); + Free(name); + } + } + break; + + case IDCANCEL: + Close(hWnd); + break; + } + break; + + case WM_TIMER: + switch (wParam) + { + case 1: + KillTimer(hWnd, 1); + EmMainRefresh(hWnd, r); + SetTimer(hWnd, 1, 1000, NULL); + break; + } + break; + + case WM_NOTIFY: + n = (NMHDR *)lParam; + switch (n->code) + { + case NM_DBLCLK: + switch (n->idFrom) + { + case L_LIST: + if (IsEnable(hWnd, IDOK)) + { + Command(hWnd, IDOK); + } + break; + } + break; + case LVN_ITEMCHANGED: + switch (n->idFrom) + { + case L_LIST: + EmMainUpdate(hWnd, r); + break; + } + break; + } + break; + + case WM_CLOSE: + EndDialog(hWnd, 0); + break; + } + + return 0; +} + +// Installation of WinPcap +void EmInstallWinPcap(HWND hWnd, RPC *r) +{ + wchar_t temp_name[MAX_SIZE]; + HGLOBAL g; + HINSTANCE h; + HRSRC hr; + UINT size; + void *data; + IO *io; + + // Ask whether the user want to start the installation + if (MsgBox(hWnd, MB_ICONQUESTION | MB_YESNO, _UU("EM_WPCAP_INSTALL")) == IDNO) + { + return; + } + + // Generate a temporary file name + UniFormat(temp_name, sizeof(temp_name), L"%s\\winpcap_installer.exe", MsGetTempDirW()); + + // Read from the resource + h = GetUiDll(); + hr = FindResource(h, MAKEINTRESOURCE(BIN_WINPCAP), "BIN"); + if (hr == NULL) + { +RES_ERROR: + MsgBox(hWnd, MB_ICONSTOP, _UU("EM_RESOURCE")); + return; + } + + g = LoadResource(h, hr); + if (g == NULL) + { + goto RES_ERROR; + } + + size = SizeofResource(h, hr); + data = LockResource(g); + + if (data == NULL) + { + goto RES_ERROR; + } + + // Write to a temporary file + io = FileCreateW(temp_name); + if (io == NULL) + { + goto RES_ERROR; + } + + FileWrite(io, data, size); + FileClose(io); + + // Run + if (RunW(temp_name, NULL, false, true) == false) + { + // Failure + FileDeleteW(temp_name); + goto RES_ERROR; + } + + FileDeleteW(temp_name); + + if (r == NULL) + { + return; + } + + // Message after the end + if (OS_IS_WINDOWS_NT(GetOsInfo()->OsType) == false) + { + // Need to restart the computer + MsgBox(hWnd, MB_ICONINFORMATION, _UU("EM_WPCAP_REBOOT1")); + } + else + { + // Need to restart the service + if (MsgBox(hWnd, MB_ICONQUESTION | MB_YESNO, _UU("EM_WPCAP_REBOOT2")) == IDNO) + { + // Not restart + } + else + { + // Restart + RPC_TEST t; + RPC_BRIDGE_SUPPORT t2; + Zero(&t, sizeof(t)); + EcRebootServer(r, &t); + + SleepThread(500); + + Zero(&t2, sizeof(t2)); + CALL(hWnd, EcGetBridgeSupport(r, &t2)); + } + } +} + +// Main screen +void EMMain(RPC *r) +{ + RPC_BRIDGE_SUPPORT t; + + // Validate arguments + if (r == NULL) + { + return; + } + + // Examine the bridge support status of the server side first + Zero(&t, sizeof(t)); + if (CALLEX(NULL, ScGetBridgeSupport(r, &t)) == ERR_NO_ERROR) + { + if (t.IsBridgeSupportedOs == false) + { + // OS does not support the bridge + MsgBox(NULL, MB_ICONEXCLAMATION, _UU("EM_UNSUPPORTED")); + return; + } + + if (t.IsWinPcapNeeded) + { + if (r->Sock->RemoteIP.addr[0] != 127) + { + // WinPcap is required, but can not do anything because it is in remote management mode + MsgBox(NULL, MB_ICONINFORMATION, _UU("EM_WPCAP_REMOTE")); + return; + } + else + { + // WinPcap is required, and it's in local management mode + if (MsIsAdmin()) + { + // Administrators + EmInstallWinPcap(NULL, r); + return; + } + else + { + // Non-Administrators + MsgBox(NULL, MB_ICONINFORMATION, _UU("EM_WPCAP_ROOT")); + return; + } + } + } + } + + Dialog(NULL, D_EM_MAIN, EmMainDlg, r); +} + +// Remote connection dialog procedure +UINT EmRemoteDlgProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param) +{ + WINUI_REMOTE *r = (WINUI_REMOTE *)param; + CEDAR *c; + // Validate arguments + if (hWnd == NULL) + { + return 0; + } + + switch (msg) + { + case WM_INITDIALOG: + RemoteDlgInit(hWnd, r); + SetTimer(hWnd, 1, 100, NULL); + break; + case WM_TIMER: + switch (wParam) + { + case 1: + KillTimer(hWnd, 1); + RemoteDlgRefresh(hWnd, r); + SetTimer(hWnd, 1, 100, NULL); + break; + } + break; + case WM_COMMAND: + switch (wParam) + { + case R_LOCAL: + if (IsChecked(hWnd, R_LOCAL) == false) + { + SetTextA(hWnd, C_HOSTNAME, ""); + RemoteDlgRefresh(hWnd, r); + FocusEx(hWnd, C_HOSTNAME); + } + else + { + SetTextA(hWnd, C_HOSTNAME, "localhost"); + RemoteDlgRefresh(hWnd, r); + Focus(hWnd, IDOK); + } + break; + case IDCANCEL: + Close(hWnd); + break; + case IDOK: + RemoteDlgOnOk(hWnd, r); + break; + case B_ABOUT: + c = NewCedar(NULL, NULL); + About(hWnd, c, _UU("PRODUCT_NAME_ELOGMGR")); + ReleaseCedar(c); + } + switch (LOWORD(wParam)) + { + case R_LOCAL: + case C_HOSTNAME: + RemoteDlgRefresh(hWnd, r); + break; + } + break; + case WM_CLOSE: + FreeCandidateList(r->CandidateList); + EndDialog(hWnd, false); + break; + } + + return 0; +} + +// Remote connection dialog +char *EmRemoteDlg() +{ + WINUI_REMOTE r; + + Zero(&r, sizeof(r)); + r.RegKeyName = EM_REG_KEY; + r.Caption = _UU("EM_TITLE"); + r.Title = _UU("EM_REMOTE_TITLE"); + r.Icon = ICO_USER_ADMIN; + r.DefaultHostname = NULL; + + if (Dialog(NULL, D_EM_REMOTE, EmRemoteDlgProc, &r) == false) + { + return NULL; + } + + return r.Hostname; +} + +// Start the EtherLogger Manager +void EMExec() +{ + char *host; + char *ret; + bool cancel_now = false; + TOKEN_LIST *t; + UINT port = EL_ADMIN_PORT; + InitWinUi(_UU("EM_TITLE"), _SS("DEFAULT_FONT"), _II("DEFAULT_FONT_SIZE")); + + while (true) + { + ret = EmRemoteDlg(); + + if (ret != NULL) + { + t = ParseToken(ret, ":"); + if (t->NumTokens == 1 || t->NumTokens == 2) + { + RPC *rpc = NULL; + bool ok = false; + UINT ret; + host = t->Token[0]; + if (t->NumTokens == 2) + { + port = ToInt(t->Token[1]); + } + else + { + port = EL_ADMIN_PORT; + } + + // Try without a password first + ret = EcConnect(host, port, "", &rpc); +RETRY: + if (ret != ERR_NO_ERROR && ret != ERR_AUTH_FAILED) + { + // Connection failed + CALL(NULL, ret); + } + else + { + if (ret == ERR_NO_ERROR) + { + // Successful connection + ok = true; + } + else + { + // Password required + char *pass = SmPassword(NULL, host); + if (pass == NULL) + { + // Cancel + cancel_now = true; + } + else + { + // Retry + ret = EcConnect(host, port, pass, &rpc); + Free(pass); + if (ret == ERR_NO_ERROR) + { + ok = true; + } + else + { + goto RETRY; + } + } + } + } + + if (ok) + { + // Main screen + EMMain(rpc); + + // Disconnect + EcDisconnect(rpc); + cancel_now = true; + } + FreeToken(t); + } + Free(ret); + } + else + { + cancel_now = true; + } + + if (cancel_now) + { + break; + } + } + + FreeWinUi(); +} + +#endif // WIN32 diff --git a/src/Cedar/EM.h b/src/Cedar/EM.h index 447438b7..54c24abb 100644 --- a/src/Cedar/EM.h +++ b/src/Cedar/EM.h @@ -1,16 +1,16 @@ -// SoftEther VPN Source Code - Developer Edition Master Branch -// Cedar Communication Module - - -// EM.h -// Header of EM.c - -#ifndef EM_H -#define EM_H - -// Public function -void EMExec(); - -#endif // EM_H - - +// SoftEther VPN Source Code - Developer Edition Master Branch +// Cedar Communication Module + + +// EM.h +// Header of EM.c + +#ifndef EM_H +#define EM_H + +// Public function +void EMExec(); + +#endif // EM_H + + diff --git a/src/Cedar/EMInner.h b/src/Cedar/EMInner.h index c4327aee..da9f089a 100644 --- a/src/Cedar/EMInner.h +++ b/src/Cedar/EMInner.h @@ -1,43 +1,43 @@ -// SoftEther VPN Source Code - Developer Edition Master Branch -// Cedar Communication Module - - -// EMInner.h -// Inner header of EM.c - -// Constants -#define EM_REG_KEY "Software\\" GC_REG_COMPANY_NAME "\\EtherLogger\\Manager" - -// Inner structure -typedef struct EM_ADD -{ - RPC *Rpc; - bool NewMode; - char DeviceName[MAX_SIZE]; -} EM_ADD; - -// Inner functions -void EMMain(RPC *r); -UINT EmMainDlg(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param); -void EmMainInit(HWND hWnd, RPC *r); -void EmMainUpdate(HWND hWnd, RPC *r); -void EmMainRefresh(HWND hWnd, RPC *r); -void EmAdd(HWND hWnd, RPC *r, char *device_name); -UINT EmAddDlg(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param); -void EmAddInit(HWND hWnd, EM_ADD *p); -void EmDlgToHubLog(HWND hWnd, HUB_LOG *g); -void EmHubLogToDlg(HWND hWnd, HUB_LOG *g); -void EmAddOk(HWND hWnd, EM_ADD *p); -void EmAddUpdate(HWND hWnd, EM_ADD *p); -UINT EmPasswordDlg(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param); -UINT EmLicenseDlg(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param); -void EmLicenseDlgInit(HWND hWnd, RPC *s); -void EmLicenseDlgRefresh(HWND hWnd, RPC *s); -void EmLicenseDlgUpdate(HWND hWnd, RPC *s); -bool EmLicenseAdd(HWND hWnd, RPC *s); -UINT EmLicenseAddDlg(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param); -void EmLicenseAddDlgInit(HWND hWnd, RPC *s); -void EmLicenseAddDlgUpdate(HWND hWnd, RPC *s); -void EmLicenseAddDlgShiftTextItem(HWND hWnd, UINT id1, UINT id2, UINT *next_focus); -void EmLicenseAddDlgGetText(HWND hWnd, char *str, UINT size); -void EmLicenseAddDlgOnOk(HWND hWnd, RPC *s); +// SoftEther VPN Source Code - Developer Edition Master Branch +// Cedar Communication Module + + +// EMInner.h +// Inner header of EM.c + +// Constants +#define EM_REG_KEY "Software\\" GC_REG_COMPANY_NAME "\\EtherLogger\\Manager" + +// Inner structure +typedef struct EM_ADD +{ + RPC *Rpc; + bool NewMode; + char DeviceName[MAX_SIZE]; +} EM_ADD; + +// Inner functions +void EMMain(RPC *r); +UINT EmMainDlg(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param); +void EmMainInit(HWND hWnd, RPC *r); +void EmMainUpdate(HWND hWnd, RPC *r); +void EmMainRefresh(HWND hWnd, RPC *r); +void EmAdd(HWND hWnd, RPC *r, char *device_name); +UINT EmAddDlg(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param); +void EmAddInit(HWND hWnd, EM_ADD *p); +void EmDlgToHubLog(HWND hWnd, HUB_LOG *g); +void EmHubLogToDlg(HWND hWnd, HUB_LOG *g); +void EmAddOk(HWND hWnd, EM_ADD *p); +void EmAddUpdate(HWND hWnd, EM_ADD *p); +UINT EmPasswordDlg(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param); +UINT EmLicenseDlg(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param); +void EmLicenseDlgInit(HWND hWnd, RPC *s); +void EmLicenseDlgRefresh(HWND hWnd, RPC *s); +void EmLicenseDlgUpdate(HWND hWnd, RPC *s); +bool EmLicenseAdd(HWND hWnd, RPC *s); +UINT EmLicenseAddDlg(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param); +void EmLicenseAddDlgInit(HWND hWnd, RPC *s); +void EmLicenseAddDlgUpdate(HWND hWnd, RPC *s); +void EmLicenseAddDlgShiftTextItem(HWND hWnd, UINT id1, UINT id2, UINT *next_focus); +void EmLicenseAddDlgGetText(HWND hWnd, char *str, UINT size); +void EmLicenseAddDlgOnOk(HWND hWnd, RPC *s); diff --git a/src/Cedar/EtherLog.c b/src/Cedar/EtherLog.c index dc057a97..888cde0b 100644 --- a/src/Cedar/EtherLog.c +++ b/src/Cedar/EtherLog.c @@ -1,1258 +1,1258 @@ -// SoftEther VPN Source Code - Developer Edition Master Branch -// Cedar Communication Module - - -// EtherLog.c -// EtherLogger program - -#include "CedarPch.h" - -static LOCK *el_lock = NULL; -static EL *el = NULL; - -// RPC functional related macro -#define DECLARE_RPC_EX(rpc_name, data_type, function, in_rpc, out_rpc, free_rpc) \ - else if (StrCmpi(name, rpc_name) == 0) \ - { \ - data_type t; \ - Zero(&t, sizeof(t)); \ - in_rpc(&t, p); \ - err = function(e, &t); \ - if (err == ERR_NO_ERROR) \ - { \ - out_rpc(ret, &t); \ - } \ - free_rpc(&t); \ - ok = true; \ - } -#define DECLARE_RPC(rpc_name, data_type, function, in_rpc, out_rpc) \ - else if (StrCmpi(name, rpc_name) == 0) \ - { \ - data_type t; \ - Zero(&t, sizeof(t)); \ - in_rpc(&t, p); \ - err = function(e, &t); \ - if (err == ERR_NO_ERROR) \ - { \ - out_rpc(ret, &t); \ - } \ - ok = true; \ - } -#define DECLARE_SC_EX(rpc_name, data_type, function, in_rpc, out_rpc, free_rpc) \ - UINT function(RPC *r, data_type *t) \ - { \ - PACK *p, *ret; \ - UINT err; \ - if (r == NULL || t == NULL) \ - { \ - return ERR_INTERNAL_ERROR; \ - } \ - p = NewPack(); \ - out_rpc(p, t); \ - free_rpc(t); \ - Zero(t, sizeof(data_type)); \ - ret = AdminCall(r, rpc_name, p); \ - err = GetErrorFromPack(ret); \ - if (err == ERR_NO_ERROR) \ - { \ - in_rpc(t, ret); \ - } \ - FreePack(ret); \ - return err; \ - } -#define DECLARE_SC(rpc_name, data_type, function, in_rpc, out_rpc) \ - UINT function(RPC *r, data_type *t) \ - { \ - PACK *p, *ret; \ - UINT err; \ - if (r == NULL || t == NULL) \ - { \ - return ERR_INTERNAL_ERROR; \ - } \ - p = NewPack(); \ - out_rpc(p, t); \ - ret = AdminCall(r, rpc_name, p); \ - err = GetErrorFromPack(ret); \ - if (err == ERR_NO_ERROR) \ - { \ - in_rpc(t, ret); \ - } \ - FreePack(ret); \ - return err; \ - } - -// RPC client disconnect -void EcDisconnect(RPC *rpc) -{ - // Validate arguments - if (rpc == NULL) - { - return; - } - - RpcFree(rpc); -} - -// RPC client connect -UINT EcConnect(char *host, UINT port, char *password, RPC **rpc) -{ - SOCK *s; - UCHAR password_hash[SHA1_SIZE]; - UCHAR rand[SHA1_SIZE]; - UCHAR response[SHA1_SIZE]; - bool retcode; - // Validate arguments - if (host == NULL) - { - host = "localhost"; - } - if (port == 0) - { - port = EL_ADMIN_PORT; - } - if (password == NULL) - { - password = ""; - } - if (rpc == NULL) - { - return ERR_INTERNAL_ERROR; - } - - // Connect to the server - s = Connect(host, port); - if (s == NULL) - { - // Connection failure - return ERR_CONNECT_FAILED; - } - - SetTimeout(s, 5000); - - // Hash the password - Sha0(password_hash, password, StrLen(password)); - - // Receive the random number - Zero(rand, sizeof(rand)); - (void)RecvAll(s, rand, sizeof(rand), false); - SecurePassword(response, password_hash, rand); - - // Send a response - SendAll(s, response, sizeof(response), false); - - // Receive results - retcode = false; - if (RecvAll(s, &retcode, sizeof(retcode), false) == false) - { - // Disconnect - ReleaseSock(s); - return ERR_PROTOCOL_ERROR; - } - retcode = Endian32(retcode); - - if (retcode == false) - { - // Password incorrect - ReleaseSock(s); - return ERR_AUTH_FAILED; - } - - // Successful connection - SetTimeout(s, INFINITE); - - *rpc = StartRpcClient(s, NULL); - - ReleaseSock(s); - - return ERR_NO_ERROR; -} - -// RPC server function -PACK *ElRpcServer(RPC *r, char *name, PACK *p) -{ - EL *e; - PACK *ret; - UINT err; - bool ok; - // Validate arguments - if (r == NULL || name == NULL || p == NULL || r->Param == NULL) - { - return NULL; - } - - e = (EL *)r->Param; - ret = NewPack(); - err = ERR_NO_ERROR; - ok = false; - - if (0) {} - - DECLARE_RPC("AddDevice", RPC_ADD_DEVICE, EtAddDevice, InRpcAddDevice, OutRpcAddDevice) - DECLARE_RPC("DelDevice", RPC_DELETE_DEVICE, EtDelDevice, InRpcDeleteDevice, OutRpcDeleteDevice) - DECLARE_RPC("SetDevice", RPC_ADD_DEVICE, EtSetDevice, InRpcAddDevice, OutRpcAddDevice) - DECLARE_RPC("GetDevice", RPC_ADD_DEVICE, EtGetDevice, InRpcAddDevice, OutRpcAddDevice) - DECLARE_RPC_EX("EnumDevice", RPC_ENUM_DEVICE, EtEnumDevice, InRpcEnumDevice, OutRpcEnumDevice, FreeRpcEnumDevice) - DECLARE_RPC("SetPassword", RPC_SET_PASSWORD, EtSetPassword, InRpcSetPassword, OutRpcSetPassword) - DECLARE_RPC_EX("EnumAllDevice", RPC_ENUM_DEVICE, EtEnumAllDevice, InRpcEnumDevice, OutRpcEnumDevice, FreeRpcEnumDevice) - DECLARE_RPC("AddLicenseKey", RPC_TEST, EtAddLicenseKey, InRpcTest, OutRpcTest) - DECLARE_RPC("DelLicenseKey", RPC_TEST, EtDelLicenseKey, InRpcTest, OutRpcTest) - DECLARE_RPC_EX("EnumLicenseKey", RPC_ENUM_LICENSE_KEY, EtEnumLicenseKey, InRpcEnumLicenseKey, OutRpcEnumLicenseKey, FreeRpcEnumLicenseKey) - DECLARE_RPC("GetLicenseStatus", RPC_EL_LICENSE_STATUS, EtGetLicenseStatus, InRpcElLicenseStatus, OutRpcElLicenseStatus) - DECLARE_RPC("GetBridgeSupport", RPC_BRIDGE_SUPPORT, EtGetBridgeSupport, InRpcBridgeSupport, OutRpcBridgeSupport) - DECLARE_RPC("RebootServer", RPC_TEST, EtRebootServer, InRpcTest, OutRpcTest) - - if (ok == false) - { - err = ERR_NOT_SUPPORTED; - } - - PackAddInt(ret, "error", err); - - return ret; -} - -DECLARE_SC("AddDevice", RPC_ADD_DEVICE, EcAddDevice, InRpcAddDevice, OutRpcAddDevice) -DECLARE_SC("DelDevice", RPC_DELETE_DEVICE, EcDelDevice, InRpcDeleteDevice, OutRpcDeleteDevice) -DECLARE_SC("SetDevice", RPC_ADD_DEVICE, EcSetDevice, InRpcAddDevice, OutRpcAddDevice) -DECLARE_SC("GetDevice", RPC_ADD_DEVICE, EcGetDevice, InRpcAddDevice, OutRpcAddDevice) -DECLARE_SC_EX("EnumDevice", RPC_ENUM_DEVICE, EcEnumDevice, InRpcEnumDevice, OutRpcEnumDevice, FreeRpcEnumDevice) -DECLARE_SC("SetPassword", RPC_SET_PASSWORD, EcSetPassword, InRpcSetPassword, OutRpcSetPassword) -DECLARE_SC_EX("EnumAllDevice", RPC_ENUM_DEVICE, EcEnumAllDevice, InRpcEnumDevice, OutRpcEnumDevice, FreeRpcEnumDevice) -DECLARE_SC("DelLicenseKey", RPC_TEST, EcDelLicenseKey, InRpcTest, OutRpcTest) -DECLARE_SC_EX("EnumLicenseKey", RPC_ENUM_LICENSE_KEY, EcEnumLicenseKey, InRpcEnumLicenseKey, OutRpcEnumLicenseKey, FreeRpcEnumLicenseKey) -DECLARE_SC("GetLicenseStatus", RPC_EL_LICENSE_STATUS, EcGetLicenseStatus, InRpcElLicenseStatus, OutRpcElLicenseStatus) -DECLARE_SC("GetBridgeSupport", RPC_BRIDGE_SUPPORT, EcGetBridgeSupport, InRpcBridgeSupport, OutRpcBridgeSupport) -DECLARE_SC("RebootServer", RPC_TEST, EcRebootServer, InRpcTest, OutRpcTest) - -// Thread to restart the server -void EiRebootServerThread(THREAD *thread, void *param) -{ - // Validate arguments - if (thread == NULL) - { - return; - } - - if (el == NULL) - { - return; - } - - // Stopping the server - ElStop(); - - // Starting the server - ElStart(); -} - -// Restarting the server -void EiRebootServer() -{ - THREAD *t; - - t = NewThread(EiRebootServerThread, NULL); - ReleaseThread(t); -} - -// RPC to restart server -UINT EtRebootServer(EL *a, RPC_TEST *t) -{ - - EiRebootServer(); - - return ERR_NO_ERROR; -} - -// Get support information for the local bridge -UINT EtGetBridgeSupport(EL *a, RPC_BRIDGE_SUPPORT *t) -{ - Zero(t, sizeof(RPC_BRIDGE_SUPPORT)); - - t->IsBridgeSupportedOs = IsBridgeSupported(); - t->IsWinPcapNeeded = IsNeedWinPcap(); - - return ERR_NO_ERROR; -} - -// Save by analyzing the status of the current license -void ElParseCurrentLicenseStatus(LICENSE_SYSTEM *s, EL_LICENSE_STATUS *st) -{ -} - -// Get a license status -UINT EtGetLicenseStatus(EL *e, RPC_EL_LICENSE_STATUS *t) -{ - UINT ret = ERR_NO_ERROR; - LICENSE_SYSTEM *ls = e->LicenseSystem; - - if (ls == NULL) - { - return ERR_NOT_SUPPORTED; - } - - Zero(t, sizeof(RPC_EL_LICENSE_STATUS)); - - // Get the current license status - ElParseCurrentLicenseStatus(ls, e->LicenseStatus); - - t->Valid = e->LicenseStatus->Valid; - t->SystemId = e->LicenseStatus->SystemId; - t->SystemExpires = e->LicenseStatus->Expires; - - return ret; -} - -// Enumerate the license keys -UINT EtEnumLicenseKey(EL *el, RPC_ENUM_LICENSE_KEY *t) -{ - return ERR_NOT_SUPPORTED; -} - -// Add a license key -UINT EtAddLicenseKey(EL *e, RPC_TEST *t) -{ - return ERR_NOT_SUPPORTED; -} - -// Delete the license key -UINT EtDelLicenseKey(EL *e, RPC_TEST *t) -{ - return ERR_NOT_SUPPORTED; -} - -// Password setting -UINT EtSetPassword(EL *e, RPC_SET_PASSWORD *t) -{ - Copy(e->HashedPassword, t->HashedPassword, SHA1_SIZE); - - ElSaveConfig(e); - - return ERR_NO_ERROR; -} - -// Add a device -UINT EtAddDevice(EL *e, RPC_ADD_DEVICE *t) -{ - if (ElAddCaptureDevice(e, t->DeviceName, &t->LogSetting, t->NoPromiscuous) == false) - { - return ERR_CAPTURE_DEVICE_ADD_ERROR; - } - - ElSaveConfig(e); - - return ERR_NO_ERROR; -} - -// Remove the device -UINT EtDelDevice(EL *e, RPC_DELETE_DEVICE *t) -{ - if (ElDeleteCaptureDevice(e, t->DeviceName) == false) - { - return ERR_CAPTURE_NOT_FOUND; - } - - ElSaveConfig(e); - - return ERR_NO_ERROR; -} - -// Get the device -UINT EtGetDevice(EL *e, RPC_ADD_DEVICE *t) -{ - UINT ret = ERR_CAPTURE_NOT_FOUND; - - LockList(e->DeviceList); - { - EL_DEVICE *d, a; - Zero(&a, sizeof(a)); - StrCpy(a.DeviceName, sizeof(a.DeviceName), t->DeviceName); - - d = Search(e->DeviceList, &a); - - if (d != NULL) - { - ret = ERR_NO_ERROR; - - Copy(&t->LogSetting, &d->LogSetting, sizeof(HUB_LOG)); - t->NoPromiscuous = d->NoPromiscuous; - } - } - UnlockList(e->DeviceList); - - return ret; -} - -// Device Setting -UINT EtSetDevice(EL *e, RPC_ADD_DEVICE *t) -{ - if (ElSetCaptureDeviceLogSetting(e, t->DeviceName, &t->LogSetting) == false) - { - return ERR_CAPTURE_NOT_FOUND; - } - - ElSaveConfig(e); - - return ERR_NO_ERROR; -} - -// Enumerate all devices -UINT EtEnumAllDevice(EL *e, RPC_ENUM_DEVICE *t) -{ - TOKEN_LIST *eth; - UINT i; - if (IsEthSupported() == false) - { - return ERR_NOT_SUPPORTED; - } - - FreeRpcEnumDevice(t); - Zero(t, sizeof(RPC_ENUM_DEVICE)); - - eth = GetEthList(); - - t->NumItem = eth->NumTokens; - t->Items = ZeroMalloc(sizeof(RPC_ENUM_DEVICE_ITEM) * t->NumItem); - - for (i = 0;i < eth->NumTokens;i++) - { - char *name = eth->Token[i]; - RPC_ENUM_DEVICE_ITEM *item = &t->Items[i]; - - StrCpy(item->DeviceName, sizeof(item->DeviceName), name); - } - - FreeToken(eth); - - return ERR_NO_ERROR; -} - -// Device enumeration -UINT EtEnumDevice(EL *e, RPC_ENUM_DEVICE *t) -{ - bool is_beta_expired = ElIsBetaExpired(); - - if (is_beta_expired) - { - // The beta version has expired - return ERR_BETA_EXPIRES; - } - - FreeRpcEnumDevice(t); - Zero(t, sizeof(RPC_ENUM_DEVICE)); - - LockList(e->DeviceList); - { - UINT i; - - t->NumItem = LIST_NUM(e->DeviceList); - t->Items = ZeroMalloc(sizeof(RPC_ENUM_DEVICE_ITEM) * t->NumItem); - - for (i = 0;i < t->NumItem;i++) - { - RPC_ENUM_DEVICE_ITEM *d = &t->Items[i]; - EL_DEVICE *eld = LIST_DATA(e->DeviceList, i); - - StrCpy(d->DeviceName, sizeof(d->DeviceName), eld->DeviceName); - d->Active = eld->Active && ((ELOG_IS_BETA || e->LicenseStatus->Valid) ? true : false); - } - } - UnlockList(e->DeviceList); - - return ERR_NO_ERROR; -} - -void InRpcAddDevice(RPC_ADD_DEVICE *t, PACK *p) -{ - UINT i; - // Validate arguments - if (t == NULL || p == NULL) - { - return; - } - - Zero(t, sizeof(RPC_ADD_DEVICE)); - PackGetStr(p, "DeviceName", t->DeviceName, sizeof(t->DeviceName)); - t->NoPromiscuous = PackGetInt(p, "NoPromiscuous"); - t->LogSetting.PacketLogSwitchType = PackGetInt(p, "PacketLogSwitchType"); - - for (i = 0;i < NUM_PACKET_LOG;i++) - { - t->LogSetting.PacketLogConfig[i] = PackGetIntEx(p, "PacketLogConfig", i); - } -} - -void OutRpcAddDevice(PACK *p, RPC_ADD_DEVICE *t) -{ - UINT i; - // Validate arguments - if (t == NULL || p == NULL) - { - return; - } - - PackAddStr(p, "DeviceName", t->DeviceName); - PackAddInt(p, "NoPromiscuous", t->NoPromiscuous); - PackAddInt(p, "PacketLogSwitchType", t->LogSetting.PacketLogSwitchType); - - for (i = 0;i < NUM_PACKET_LOG;i++) - { - PackAddIntEx(p, "PacketLogConfig", t->LogSetting.PacketLogConfig[i], i, NUM_PACKET_LOG); - } -} - -void InRpcDeleteDevice(RPC_DELETE_DEVICE *t, PACK *p) -{ - // Validate arguments - if (t == NULL || p == NULL) - { - return; - } - - Zero(t, sizeof(RPC_DELETE_DEVICE)); - PackGetStr(p, "DeviceName", t->DeviceName, sizeof(t->DeviceName)); -} - -void OutRpcDeleteDevice(PACK *p, RPC_DELETE_DEVICE *t) -{ - // Validate arguments - if (p == NULL || t == NULL) - { - return; - } - - PackAddStr(p, "DeviceName", t->DeviceName); -} - -void InRpcEnumDevice(RPC_ENUM_DEVICE *t, PACK *p) -{ - UINT i; - // Validate arguments - if (t == NULL || p == NULL) - { - return; - } - - Zero(t, sizeof(RPC_ENUM_DEVICE)); - t->NumItem = PackGetInt(p, "NumItem"); - t->Items = ZeroMalloc(sizeof(RPC_ENUM_DEVICE_ITEM) * t->NumItem); - - for (i = 0;i < t->NumItem;i++) - { - RPC_ENUM_DEVICE_ITEM *d = &t->Items[i]; - - PackGetStrEx(p, "DeviceName", d->DeviceName, sizeof(d->DeviceName), i); - d->Active = PackGetBoolEx(p, "Active", i); - } - - t->IsLicenseSupported = PackGetBool(p, "IsLicenseSupported"); -} - -void OutRpcEnumDevice(PACK *p, RPC_ENUM_DEVICE *t) -{ - UINT i; - // Validate arguments - if (t == NULL || p == NULL) - { - return; - } - - PackAddInt(p, "NumItem", t->NumItem); - - PackSetCurrentJsonGroupName(p, "DeviceList"); - for (i = 0;i < t->NumItem;i++) - { - RPC_ENUM_DEVICE_ITEM *d = &t->Items[i]; - - PackAddStrEx(p, "DeviceName", d->DeviceName, i, t->NumItem); - PackAddBoolEx(p, "Active", d->Active, i, t->NumItem); - } - PackSetCurrentJsonGroupName(p, NULL); - - PackAddBool(p, "IsLicenseSupported", t->IsLicenseSupported); -} - -void FreeRpcEnumDevice(RPC_ENUM_DEVICE *t) -{ - // Validate arguments - if (t == NULL) - { - return; - } - - Free(t->Items); -} - -// RPC_LICENSE_STATUS -void InRpcElLicenseStatus(RPC_EL_LICENSE_STATUS *t, PACK *p) -{ - // Validate arguments - if (t == NULL || p == NULL) - { - return; - } - - Zero(t, sizeof(RPC_EL_LICENSE_STATUS)); - - t->Valid = PackGetBool(p, "Valid"); - t->SystemId = PackGetInt64(p, "SystemId"); - t->SystemExpires = PackGetInt64(p, "SystemExpires"); -} -void OutRpcElLicenseStatus(PACK *p, RPC_EL_LICENSE_STATUS *t) -{ - // Validate arguments - if (t == NULL || p == NULL) - { - return; - } - - PackAddBool(p, "Valid", t->Valid); - PackAddInt64(p, "SystemId", t->SystemId); - PackAddTime64(p, "SystemExpires", t->SystemExpires); -} - -// Listener thread -void ElListenerProc(THREAD *thread, void *param) -{ - TCP_ACCEPTED_PARAM *data = (TCP_ACCEPTED_PARAM *)param; - EL *e; - SOCK *s; - UCHAR rand[SHA1_SIZE]; - UCHAR pass1[SHA1_SIZE], pass2[SHA1_SIZE]; - // Validate arguments - if (data == NULL || thread == NULL) - { - return; - } - - e = (EL *)data->r->ThreadParam; - s = data->s; - AddRef(s->ref); - SetTimeout(s, 5000); - LockList(e->AdminThreadList); - { - AddRef(thread->ref); - AddRef(s->ref); - Insert(e->AdminThreadList, thread); - Insert(e->AdminSockList, s); - } - UnlockList(e->AdminThreadList); - NoticeThreadInit(thread); - - // Submit a challenge - Rand(rand, sizeof(rand)); - SendAll(s, rand, sizeof(rand), false); - - // Receive a response - SecurePassword(pass1, e->HashedPassword, rand); - Zero(pass2, sizeof(pass2)); - (void)RecvAll(s, pass2, sizeof(pass2), false); - - if (Cmp(pass1, pass2, SHA1_SIZE) != 0) - { - // Password incorrect - bool code = false; - code = Endian32(code); - SendAll(s, &code, sizeof(code), false); - } - else - { - // Password match - bool code = true; - RPC *r; - - code = Endian32(code); - SendAll(s, &code, sizeof(code), false); - - SetTimeout(s, INFINITE); - - // Start operation as a RPC server - r = StartRpcServer(s, ElRpcServer, e); - RpcServer(r); - RpcFree(r); - } - - Disconnect(s); - ReleaseSock(s); - - LockList(e->AdminThreadList); - { - if (Delete(e->AdminThreadList, thread)) - { - ReleaseThread(thread); - } - if (Delete(e->AdminSockList, s)) - { - ReleaseSock(s); - } - } - UnlockList(e->AdminThreadList); -} - -// Listener start -void ElStartListener(EL *e) -{ - // Validate arguments - if (e == NULL) - { - return; - } - - e->AdminThreadList = NewList(NULL); - e->AdminSockList = NewList(NULL); - - e->Listener = NewListenerEx(e->Cedar, LISTENER_TCP, e->Port == 0 ? EL_ADMIN_PORT : e->Port, - ElListenerProc, e); -} - -// Listener stop -void ElStopListener(EL *e) -{ - UINT i; - THREAD **threads; - SOCK **socks; - UINT num_threads, num_socks; - // Validate arguments - if (e == NULL) - { - return; - } - - StopAllListener(e->Cedar); - - LockList(e->AdminThreadList); - { - threads = ToArray(e->AdminThreadList); - num_threads = LIST_NUM(e->AdminThreadList); - DeleteAll(e->AdminThreadList); - - socks = ToArray(e->AdminSockList); - num_socks = LIST_NUM(e->AdminSockList); - DeleteAll(e->AdminSockList); - } - UnlockList(e->AdminThreadList); - - for (i = 0;i < num_socks;i++) - { - Disconnect(socks[i]); - ReleaseSock(socks[i]); - } - - for (i = 0;i < num_threads;i++) - { - WaitThread(threads[i], INFINITE); - ReleaseThread(threads[i]); - } - - Free(threads); - Free(socks); - - ReleaseList(e->AdminSockList); - ReleaseList(e->AdminThreadList); - - ReleaseListener(e->Listener); -} - -// Update the log configuration of the capture device -bool ElSetCaptureDeviceLogSetting(EL *e, char *name, HUB_LOG *log) -{ - EL_DEVICE *d; - bool ret = false; - // Validate arguments - if (e == NULL || log == NULL || name == NULL) - { - return false; - } - - LockList(e->DeviceList); - { - EL_DEVICE t; - - Zero(&t, sizeof(t)); - StrCpy(t.DeviceName, sizeof(t.DeviceName), name); - - d = Search(e->DeviceList, &t); - - if (d != NULL) - { - Copy(&d->LogSetting, log, sizeof(HUB_LOG)); - - SetLogSwitchType(d->Logger, log->PacketLogSwitchType); - - ret = true; - } - } - UnlockList(e->DeviceList); - - return ret; -} - -// Confirm whether the beta version has expired -bool ElIsBetaExpired() -{ - SYSTEMTIME st; - UINT64 expires64; - UINT64 now64; - if (ELOG_IS_BETA == false) - { - return false; - } - - Zero(&st, sizeof(st)); - - st.wYear = ELOG_BETA_EXPIRES_YEAR; - st.wMonth = ELOG_BETA_EXPIRES_MONTH; - st.wDay = ELOG_BETA_EXPIRES_DAY; - - expires64 = SystemToUINT64(&st); - now64 = LocalTime64(); - - if (now64 >= expires64) - { - return true; - } - - return false; -} - -// Capture thread -void ElCaptureThread(THREAD *thread, void *param) -{ -} - -// Delete the capture device -bool ElDeleteCaptureDevice(EL *e, char *name) -{ - bool ret = false; - EL_DEVICE *d, t; - // Validate arguments - if (e == NULL || name == NULL) - { - return false; - } - - LockList(e->DeviceList); - { - Zero(&t, sizeof(t)); - StrCpy(t.DeviceName, sizeof(t.DeviceName), name); - - d = Search(e->DeviceList, &t); - - if (d != NULL) - { - // Stop capture - d->Halt = true; - Cancel(d->Cancel1); - - // Wait for thread stop - WaitThread(d->Thread, INFINITE); - ReleaseThread(d->Thread); - - // Release the memory - Delete(e->DeviceList, d); - Free(d); - - ret = true; - } - } - UnlockList(e->DeviceList); - - return ret; -} - -// Add a capture device -bool ElAddCaptureDevice(EL *e, char *name, HUB_LOG *log, bool no_promiscuous) -{ - EL_DEVICE *d, t; - // Validate arguments - if (e == NULL || name == NULL || log == NULL) - { - return false; - } - - Zero(&t, sizeof(t)); - StrCpy(t.DeviceName, sizeof(t.DeviceName), name); - - LockList(e->DeviceList); - { - d = Search(e->DeviceList, &t); - if (d != NULL) - { - // Capture settings with the same name already exists - UnlockList(e->DeviceList); - return false; - } - - // Add a device - d = ZeroMalloc(sizeof(EL_DEVICE)); - StrCpy(d->DeviceName, sizeof(d->DeviceName), name); - Copy(&d->LogSetting, log, sizeof(HUB_LOG)); - d->NoPromiscuous = no_promiscuous; - d->el = e; - Insert(e->DeviceList, d); - - // Start the thread - d->Thread = NewThread(ElCaptureThread, d); - WaitThreadInit(d->Thread); - } - UnlockList(e->DeviceList); - - ElSaveConfig(e); - - return true; -} - -// Write the license List -void EiWriteLicenseManager(FOLDER *f, EL *s) -{ -} - -// Read the license list -void EiLoadLicenseManager(EL *s, FOLDER *f) -{ -} - -// Configuration initialization -void ElInitConfig(EL *e) -{ - // Validate arguments - if (e == NULL) - { - return; - } - - // Device list initialization - e->DeviceList = NewList(ElCompareDevice); - - // Read configuration file - ElLoadConfig(e); - - // Write configuration file - ElSaveConfig(e); -} - -// Write the configuration -void ElSaveConfig(EL *e) -{ - FOLDER *root; - // Validate arguments - if (e == NULL) - { - return; - } - - root = CfgCreateFolder(NULL, TAG_ROOT); - - ElSaveConfigToFolder(e, root); - - SaveCfgRw(e->CfgRw, root); - - CfgDeleteFolder(root); -} - -// Write the configuration to the folder -void ElSaveConfigToFolder(EL *e, FOLDER *root) -{ - UINT i; - FOLDER *devices; - // Validate arguments - if (e == NULL || root == NULL) - { - return; - } - - CfgAddInt64(root, "AutoDeleteCheckDiskFreeSpaceMin", e->AutoDeleteCheckDiskFreeSpaceMin); - - CfgAddInt(root, "AdminPort", e->Port); - - CfgAddByte(root, "AdminPassword", e->HashedPassword, sizeof(e->HashedPassword)); - - if (ELOG_IS_BETA == false) - { - EiWriteLicenseManager(CfgCreateFolder(root, "LicenseManager"), e); - } - - devices = CfgCreateFolder(root,"Devices"); - - LockList(e->DeviceList); - { - for (i = 0;i < LIST_NUM(e->DeviceList);i++) - { - FOLDER *f; - EL_DEVICE *d = LIST_DATA(e->DeviceList, i); - - f = CfgCreateFolder(devices, d->DeviceName); - SiWriteHubLogCfgEx(f, &d->LogSetting, true); - CfgAddBool(f, "NoPromiscuousMode", d->NoPromiscuous); - } - } - UnlockList(e->DeviceList); -} - -// Read the configuration from the folder -void ElLoadConfigFromFolder(EL *e, FOLDER *root) -{ - UINT i; - TOKEN_LIST *t; - FOLDER *devices; - - // Validate arguments - if (e == NULL || root == NULL) - { - return; - } - - i = CfgGetInt(root, "AdminPort"); - if (i >= 1 && i <= 65535) - { - e->Port = i; - } - - e->AutoDeleteCheckDiskFreeSpaceMin = CfgGetInt64(root, "AutoDeleteCheckDiskFreeSpaceMin"); - if (CfgIsItem(root, "AutoDeleteCheckDiskFreeSpaceMin") == false && e->AutoDeleteCheckDiskFreeSpaceMin == 0) - { - e->AutoDeleteCheckDiskFreeSpaceMin = DISK_FREE_SPACE_DEFAULT; - } - - if (e->AutoDeleteCheckDiskFreeSpaceMin != 0) - { - if (e->AutoDeleteCheckDiskFreeSpaceMin < DISK_FREE_SPACE_MIN) - { - e->AutoDeleteCheckDiskFreeSpaceMin = DISK_FREE_SPACE_MIN; - } - } - - if (CfgGetByte(root, "AdminPassword", e->HashedPassword, sizeof(e->HashedPassword)) != sizeof(e->HashedPassword)) - { - Sha0(e->HashedPassword, "", 0); - } - - if (ELOG_IS_BETA == false) - { - EiLoadLicenseManager(e, CfgGetFolder(root, "LicenseManager")); - } - - devices = CfgGetFolder(root, "Devices"); - if(devices != NULL) - { - LockList(e->DeviceList); - { - t = CfgEnumFolderToTokenList(devices); - for (i = 0;i < t->NumTokens;i++) - { - char *name = t->Token[i]; - FOLDER *f = CfgGetFolder(devices, name); - - if (f != NULL) - { - HUB_LOG g; - - Zero(&g, sizeof(g)); - SiLoadHubLogCfg(&g, f); - ElAddCaptureDevice(e, name, &g, CfgGetBool(f, "NoPromiscuousMode")); - } - } - FreeToken(t); - } - UnlockList(e->DeviceList); - } -} - -// Reading configuration -bool ElLoadConfig(EL *e) -{ - FOLDER *root; - bool ret = false; - // Validate arguments - if (e == NULL) - { - return false; - } - - e->Port = EL_ADMIN_PORT; - - e->CfgRw = NewCfgRw(&root, EL_CONFIG_FILENAME); - - if (root != NULL) - { - ElLoadConfigFromFolder(e, root); - - CfgDeleteFolder(root); - } - else - { - char *pass = ""; - Sha0(e->HashedPassword, pass, StrLen(pass)); - e->AutoDeleteCheckDiskFreeSpaceMin = DISK_FREE_SPACE_DEFAULT; - } - - return ret; -} - -// Configuration release -void ElFreeConfig(EL *e) -{ - UINT i; - LIST *o; - // Validate arguments - if (e == NULL) - { - return; - } - - // Write the configuration file - ElSaveConfig(e); - FreeCfgRw(e->CfgRw); - - // Stop all capture - o = NewList(NULL); - LockList(e->DeviceList); - { - for (i = 0;i < LIST_NUM(e->DeviceList);i++) - { - EL_DEVICE *d = LIST_DATA(e->DeviceList, i); - Insert(o, CopyStr(d->DeviceName)); - } - for (i = 0;i < LIST_NUM(o);i++) - { - char *name = LIST_DATA(o, i); - ElDeleteCaptureDevice(e, name); - Free(name); - } - ReleaseList(o); - } - UnlockList(e->DeviceList); - - ReleaseList(e->DeviceList); -} - -// Comparison function of the device -int ElCompareDevice(void *p1, void *p2) -{ - EL_DEVICE *d1, *d2; - // Validate arguments - if (p1 == NULL || p2 == NULL) - { - return 0; - } - d1 = *(EL_DEVICE **)p1; - d2 = *(EL_DEVICE **)p2; - if (d1 == NULL || d2 == NULL) - { - return 0; - } - - return StrCmpi(d1->DeviceName, d2->DeviceName); -} - -// Clean-up the EL -void CleanupEl(EL *e) -{ - // Validate arguments - if (e == NULL) - { - return; - } - - // Stop Eraser - FreeEraser(e->Eraser); - - // Stop Listener - ElStopListener(e); - - // Setting release - ElFreeConfig(e); - - // Free the license system - if(e->LicenseSystem != NULL) - { - } - - // Free the license status - if(e->LicenseStatus != NULL) - { - Free(e->LicenseStatus); - } - - // Ethernet release - FreeEth(); - - ReleaseCedar(e->Cedar); - - DeleteLock(e->lock); - - Free(e); -} - -// Release the EL -void ReleaseEl(EL *e) -{ - // Validate arguments - if (e == NULL) - { - return; - } - - if (Release(e->ref) == 0) - { - CleanupEl(e); - } -} - -// Create the EL -EL *NewEl() -{ - EL *e; - -#ifdef OS_WIN32 - RegistWindowsFirewallAll(); -#endif - - e = ZeroMalloc(sizeof(EL)); - e->lock = NewLock(); - e->ref = NewRef(); - - e->Cedar = NewCedar(NULL, NULL); - - - // Ethernet initialization - InitEth(); - - // Setting initialization - ElInitConfig(e); - - // Listener start - ElStartListener(e); - - // Initialize the license status - ElParseCurrentLicenseStatus(e->LicenseSystem, e->LicenseStatus); - - // Eraser start - e->Eraser = NewEraser(NULL, e->AutoDeleteCheckDiskFreeSpaceMin); - - return e; -} - -// EL start -void ElStart() -{ - // Raise the priority - OSSetHighPriority(); - - Lock(el_lock); - { - el = NewEl(); - } - Unlock(el_lock); -} - -// EL stop -void ElStop() -{ - Lock(el_lock); - { - ReleaseEl(el); - el = NULL; - } - Unlock(el_lock); -} - +// SoftEther VPN Source Code - Developer Edition Master Branch +// Cedar Communication Module + + +// EtherLog.c +// EtherLogger program + +#include "CedarPch.h" + +static LOCK *el_lock = NULL; +static EL *el = NULL; + +// RPC functional related macro +#define DECLARE_RPC_EX(rpc_name, data_type, function, in_rpc, out_rpc, free_rpc) \ + else if (StrCmpi(name, rpc_name) == 0) \ + { \ + data_type t; \ + Zero(&t, sizeof(t)); \ + in_rpc(&t, p); \ + err = function(e, &t); \ + if (err == ERR_NO_ERROR) \ + { \ + out_rpc(ret, &t); \ + } \ + free_rpc(&t); \ + ok = true; \ + } +#define DECLARE_RPC(rpc_name, data_type, function, in_rpc, out_rpc) \ + else if (StrCmpi(name, rpc_name) == 0) \ + { \ + data_type t; \ + Zero(&t, sizeof(t)); \ + in_rpc(&t, p); \ + err = function(e, &t); \ + if (err == ERR_NO_ERROR) \ + { \ + out_rpc(ret, &t); \ + } \ + ok = true; \ + } +#define DECLARE_SC_EX(rpc_name, data_type, function, in_rpc, out_rpc, free_rpc) \ + UINT function(RPC *r, data_type *t) \ + { \ + PACK *p, *ret; \ + UINT err; \ + if (r == NULL || t == NULL) \ + { \ + return ERR_INTERNAL_ERROR; \ + } \ + p = NewPack(); \ + out_rpc(p, t); \ + free_rpc(t); \ + Zero(t, sizeof(data_type)); \ + ret = AdminCall(r, rpc_name, p); \ + err = GetErrorFromPack(ret); \ + if (err == ERR_NO_ERROR) \ + { \ + in_rpc(t, ret); \ + } \ + FreePack(ret); \ + return err; \ + } +#define DECLARE_SC(rpc_name, data_type, function, in_rpc, out_rpc) \ + UINT function(RPC *r, data_type *t) \ + { \ + PACK *p, *ret; \ + UINT err; \ + if (r == NULL || t == NULL) \ + { \ + return ERR_INTERNAL_ERROR; \ + } \ + p = NewPack(); \ + out_rpc(p, t); \ + ret = AdminCall(r, rpc_name, p); \ + err = GetErrorFromPack(ret); \ + if (err == ERR_NO_ERROR) \ + { \ + in_rpc(t, ret); \ + } \ + FreePack(ret); \ + return err; \ + } + +// RPC client disconnect +void EcDisconnect(RPC *rpc) +{ + // Validate arguments + if (rpc == NULL) + { + return; + } + + RpcFree(rpc); +} + +// RPC client connect +UINT EcConnect(char *host, UINT port, char *password, RPC **rpc) +{ + SOCK *s; + UCHAR password_hash[SHA1_SIZE]; + UCHAR rand[SHA1_SIZE]; + UCHAR response[SHA1_SIZE]; + bool retcode; + // Validate arguments + if (host == NULL) + { + host = "localhost"; + } + if (port == 0) + { + port = EL_ADMIN_PORT; + } + if (password == NULL) + { + password = ""; + } + if (rpc == NULL) + { + return ERR_INTERNAL_ERROR; + } + + // Connect to the server + s = Connect(host, port); + if (s == NULL) + { + // Connection failure + return ERR_CONNECT_FAILED; + } + + SetTimeout(s, 5000); + + // Hash the password + Sha0(password_hash, password, StrLen(password)); + + // Receive the random number + Zero(rand, sizeof(rand)); + (void)RecvAll(s, rand, sizeof(rand), false); + SecurePassword(response, password_hash, rand); + + // Send a response + SendAll(s, response, sizeof(response), false); + + // Receive results + retcode = false; + if (RecvAll(s, &retcode, sizeof(retcode), false) == false) + { + // Disconnect + ReleaseSock(s); + return ERR_PROTOCOL_ERROR; + } + retcode = Endian32(retcode); + + if (retcode == false) + { + // Password incorrect + ReleaseSock(s); + return ERR_AUTH_FAILED; + } + + // Successful connection + SetTimeout(s, INFINITE); + + *rpc = StartRpcClient(s, NULL); + + ReleaseSock(s); + + return ERR_NO_ERROR; +} + +// RPC server function +PACK *ElRpcServer(RPC *r, char *name, PACK *p) +{ + EL *e; + PACK *ret; + UINT err; + bool ok; + // Validate arguments + if (r == NULL || name == NULL || p == NULL || r->Param == NULL) + { + return NULL; + } + + e = (EL *)r->Param; + ret = NewPack(); + err = ERR_NO_ERROR; + ok = false; + + if (0) {} + + DECLARE_RPC("AddDevice", RPC_ADD_DEVICE, EtAddDevice, InRpcAddDevice, OutRpcAddDevice) + DECLARE_RPC("DelDevice", RPC_DELETE_DEVICE, EtDelDevice, InRpcDeleteDevice, OutRpcDeleteDevice) + DECLARE_RPC("SetDevice", RPC_ADD_DEVICE, EtSetDevice, InRpcAddDevice, OutRpcAddDevice) + DECLARE_RPC("GetDevice", RPC_ADD_DEVICE, EtGetDevice, InRpcAddDevice, OutRpcAddDevice) + DECLARE_RPC_EX("EnumDevice", RPC_ENUM_DEVICE, EtEnumDevice, InRpcEnumDevice, OutRpcEnumDevice, FreeRpcEnumDevice) + DECLARE_RPC("SetPassword", RPC_SET_PASSWORD, EtSetPassword, InRpcSetPassword, OutRpcSetPassword) + DECLARE_RPC_EX("EnumAllDevice", RPC_ENUM_DEVICE, EtEnumAllDevice, InRpcEnumDevice, OutRpcEnumDevice, FreeRpcEnumDevice) + DECLARE_RPC("AddLicenseKey", RPC_TEST, EtAddLicenseKey, InRpcTest, OutRpcTest) + DECLARE_RPC("DelLicenseKey", RPC_TEST, EtDelLicenseKey, InRpcTest, OutRpcTest) + DECLARE_RPC_EX("EnumLicenseKey", RPC_ENUM_LICENSE_KEY, EtEnumLicenseKey, InRpcEnumLicenseKey, OutRpcEnumLicenseKey, FreeRpcEnumLicenseKey) + DECLARE_RPC("GetLicenseStatus", RPC_EL_LICENSE_STATUS, EtGetLicenseStatus, InRpcElLicenseStatus, OutRpcElLicenseStatus) + DECLARE_RPC("GetBridgeSupport", RPC_BRIDGE_SUPPORT, EtGetBridgeSupport, InRpcBridgeSupport, OutRpcBridgeSupport) + DECLARE_RPC("RebootServer", RPC_TEST, EtRebootServer, InRpcTest, OutRpcTest) + + if (ok == false) + { + err = ERR_NOT_SUPPORTED; + } + + PackAddInt(ret, "error", err); + + return ret; +} + +DECLARE_SC("AddDevice", RPC_ADD_DEVICE, EcAddDevice, InRpcAddDevice, OutRpcAddDevice) +DECLARE_SC("DelDevice", RPC_DELETE_DEVICE, EcDelDevice, InRpcDeleteDevice, OutRpcDeleteDevice) +DECLARE_SC("SetDevice", RPC_ADD_DEVICE, EcSetDevice, InRpcAddDevice, OutRpcAddDevice) +DECLARE_SC("GetDevice", RPC_ADD_DEVICE, EcGetDevice, InRpcAddDevice, OutRpcAddDevice) +DECLARE_SC_EX("EnumDevice", RPC_ENUM_DEVICE, EcEnumDevice, InRpcEnumDevice, OutRpcEnumDevice, FreeRpcEnumDevice) +DECLARE_SC("SetPassword", RPC_SET_PASSWORD, EcSetPassword, InRpcSetPassword, OutRpcSetPassword) +DECLARE_SC_EX("EnumAllDevice", RPC_ENUM_DEVICE, EcEnumAllDevice, InRpcEnumDevice, OutRpcEnumDevice, FreeRpcEnumDevice) +DECLARE_SC("DelLicenseKey", RPC_TEST, EcDelLicenseKey, InRpcTest, OutRpcTest) +DECLARE_SC_EX("EnumLicenseKey", RPC_ENUM_LICENSE_KEY, EcEnumLicenseKey, InRpcEnumLicenseKey, OutRpcEnumLicenseKey, FreeRpcEnumLicenseKey) +DECLARE_SC("GetLicenseStatus", RPC_EL_LICENSE_STATUS, EcGetLicenseStatus, InRpcElLicenseStatus, OutRpcElLicenseStatus) +DECLARE_SC("GetBridgeSupport", RPC_BRIDGE_SUPPORT, EcGetBridgeSupport, InRpcBridgeSupport, OutRpcBridgeSupport) +DECLARE_SC("RebootServer", RPC_TEST, EcRebootServer, InRpcTest, OutRpcTest) + +// Thread to restart the server +void EiRebootServerThread(THREAD *thread, void *param) +{ + // Validate arguments + if (thread == NULL) + { + return; + } + + if (el == NULL) + { + return; + } + + // Stopping the server + ElStop(); + + // Starting the server + ElStart(); +} + +// Restarting the server +void EiRebootServer() +{ + THREAD *t; + + t = NewThread(EiRebootServerThread, NULL); + ReleaseThread(t); +} + +// RPC to restart server +UINT EtRebootServer(EL *a, RPC_TEST *t) +{ + + EiRebootServer(); + + return ERR_NO_ERROR; +} + +// Get support information for the local bridge +UINT EtGetBridgeSupport(EL *a, RPC_BRIDGE_SUPPORT *t) +{ + Zero(t, sizeof(RPC_BRIDGE_SUPPORT)); + + t->IsBridgeSupportedOs = IsBridgeSupported(); + t->IsWinPcapNeeded = IsNeedWinPcap(); + + return ERR_NO_ERROR; +} + +// Save by analyzing the status of the current license +void ElParseCurrentLicenseStatus(LICENSE_SYSTEM *s, EL_LICENSE_STATUS *st) +{ +} + +// Get a license status +UINT EtGetLicenseStatus(EL *e, RPC_EL_LICENSE_STATUS *t) +{ + UINT ret = ERR_NO_ERROR; + LICENSE_SYSTEM *ls = e->LicenseSystem; + + if (ls == NULL) + { + return ERR_NOT_SUPPORTED; + } + + Zero(t, sizeof(RPC_EL_LICENSE_STATUS)); + + // Get the current license status + ElParseCurrentLicenseStatus(ls, e->LicenseStatus); + + t->Valid = e->LicenseStatus->Valid; + t->SystemId = e->LicenseStatus->SystemId; + t->SystemExpires = e->LicenseStatus->Expires; + + return ret; +} + +// Enumerate the license keys +UINT EtEnumLicenseKey(EL *el, RPC_ENUM_LICENSE_KEY *t) +{ + return ERR_NOT_SUPPORTED; +} + +// Add a license key +UINT EtAddLicenseKey(EL *e, RPC_TEST *t) +{ + return ERR_NOT_SUPPORTED; +} + +// Delete the license key +UINT EtDelLicenseKey(EL *e, RPC_TEST *t) +{ + return ERR_NOT_SUPPORTED; +} + +// Password setting +UINT EtSetPassword(EL *e, RPC_SET_PASSWORD *t) +{ + Copy(e->HashedPassword, t->HashedPassword, SHA1_SIZE); + + ElSaveConfig(e); + + return ERR_NO_ERROR; +} + +// Add a device +UINT EtAddDevice(EL *e, RPC_ADD_DEVICE *t) +{ + if (ElAddCaptureDevice(e, t->DeviceName, &t->LogSetting, t->NoPromiscuous) == false) + { + return ERR_CAPTURE_DEVICE_ADD_ERROR; + } + + ElSaveConfig(e); + + return ERR_NO_ERROR; +} + +// Remove the device +UINT EtDelDevice(EL *e, RPC_DELETE_DEVICE *t) +{ + if (ElDeleteCaptureDevice(e, t->DeviceName) == false) + { + return ERR_CAPTURE_NOT_FOUND; + } + + ElSaveConfig(e); + + return ERR_NO_ERROR; +} + +// Get the device +UINT EtGetDevice(EL *e, RPC_ADD_DEVICE *t) +{ + UINT ret = ERR_CAPTURE_NOT_FOUND; + + LockList(e->DeviceList); + { + EL_DEVICE *d, a; + Zero(&a, sizeof(a)); + StrCpy(a.DeviceName, sizeof(a.DeviceName), t->DeviceName); + + d = Search(e->DeviceList, &a); + + if (d != NULL) + { + ret = ERR_NO_ERROR; + + Copy(&t->LogSetting, &d->LogSetting, sizeof(HUB_LOG)); + t->NoPromiscuous = d->NoPromiscuous; + } + } + UnlockList(e->DeviceList); + + return ret; +} + +// Device Setting +UINT EtSetDevice(EL *e, RPC_ADD_DEVICE *t) +{ + if (ElSetCaptureDeviceLogSetting(e, t->DeviceName, &t->LogSetting) == false) + { + return ERR_CAPTURE_NOT_FOUND; + } + + ElSaveConfig(e); + + return ERR_NO_ERROR; +} + +// Enumerate all devices +UINT EtEnumAllDevice(EL *e, RPC_ENUM_DEVICE *t) +{ + TOKEN_LIST *eth; + UINT i; + if (IsEthSupported() == false) + { + return ERR_NOT_SUPPORTED; + } + + FreeRpcEnumDevice(t); + Zero(t, sizeof(RPC_ENUM_DEVICE)); + + eth = GetEthList(); + + t->NumItem = eth->NumTokens; + t->Items = ZeroMalloc(sizeof(RPC_ENUM_DEVICE_ITEM) * t->NumItem); + + for (i = 0;i < eth->NumTokens;i++) + { + char *name = eth->Token[i]; + RPC_ENUM_DEVICE_ITEM *item = &t->Items[i]; + + StrCpy(item->DeviceName, sizeof(item->DeviceName), name); + } + + FreeToken(eth); + + return ERR_NO_ERROR; +} + +// Device enumeration +UINT EtEnumDevice(EL *e, RPC_ENUM_DEVICE *t) +{ + bool is_beta_expired = ElIsBetaExpired(); + + if (is_beta_expired) + { + // The beta version has expired + return ERR_BETA_EXPIRES; + } + + FreeRpcEnumDevice(t); + Zero(t, sizeof(RPC_ENUM_DEVICE)); + + LockList(e->DeviceList); + { + UINT i; + + t->NumItem = LIST_NUM(e->DeviceList); + t->Items = ZeroMalloc(sizeof(RPC_ENUM_DEVICE_ITEM) * t->NumItem); + + for (i = 0;i < t->NumItem;i++) + { + RPC_ENUM_DEVICE_ITEM *d = &t->Items[i]; + EL_DEVICE *eld = LIST_DATA(e->DeviceList, i); + + StrCpy(d->DeviceName, sizeof(d->DeviceName), eld->DeviceName); + d->Active = eld->Active && ((ELOG_IS_BETA || e->LicenseStatus->Valid) ? true : false); + } + } + UnlockList(e->DeviceList); + + return ERR_NO_ERROR; +} + +void InRpcAddDevice(RPC_ADD_DEVICE *t, PACK *p) +{ + UINT i; + // Validate arguments + if (t == NULL || p == NULL) + { + return; + } + + Zero(t, sizeof(RPC_ADD_DEVICE)); + PackGetStr(p, "DeviceName", t->DeviceName, sizeof(t->DeviceName)); + t->NoPromiscuous = PackGetInt(p, "NoPromiscuous"); + t->LogSetting.PacketLogSwitchType = PackGetInt(p, "PacketLogSwitchType"); + + for (i = 0;i < NUM_PACKET_LOG;i++) + { + t->LogSetting.PacketLogConfig[i] = PackGetIntEx(p, "PacketLogConfig", i); + } +} + +void OutRpcAddDevice(PACK *p, RPC_ADD_DEVICE *t) +{ + UINT i; + // Validate arguments + if (t == NULL || p == NULL) + { + return; + } + + PackAddStr(p, "DeviceName", t->DeviceName); + PackAddInt(p, "NoPromiscuous", t->NoPromiscuous); + PackAddInt(p, "PacketLogSwitchType", t->LogSetting.PacketLogSwitchType); + + for (i = 0;i < NUM_PACKET_LOG;i++) + { + PackAddIntEx(p, "PacketLogConfig", t->LogSetting.PacketLogConfig[i], i, NUM_PACKET_LOG); + } +} + +void InRpcDeleteDevice(RPC_DELETE_DEVICE *t, PACK *p) +{ + // Validate arguments + if (t == NULL || p == NULL) + { + return; + } + + Zero(t, sizeof(RPC_DELETE_DEVICE)); + PackGetStr(p, "DeviceName", t->DeviceName, sizeof(t->DeviceName)); +} + +void OutRpcDeleteDevice(PACK *p, RPC_DELETE_DEVICE *t) +{ + // Validate arguments + if (p == NULL || t == NULL) + { + return; + } + + PackAddStr(p, "DeviceName", t->DeviceName); +} + +void InRpcEnumDevice(RPC_ENUM_DEVICE *t, PACK *p) +{ + UINT i; + // Validate arguments + if (t == NULL || p == NULL) + { + return; + } + + Zero(t, sizeof(RPC_ENUM_DEVICE)); + t->NumItem = PackGetInt(p, "NumItem"); + t->Items = ZeroMalloc(sizeof(RPC_ENUM_DEVICE_ITEM) * t->NumItem); + + for (i = 0;i < t->NumItem;i++) + { + RPC_ENUM_DEVICE_ITEM *d = &t->Items[i]; + + PackGetStrEx(p, "DeviceName", d->DeviceName, sizeof(d->DeviceName), i); + d->Active = PackGetBoolEx(p, "Active", i); + } + + t->IsLicenseSupported = PackGetBool(p, "IsLicenseSupported"); +} + +void OutRpcEnumDevice(PACK *p, RPC_ENUM_DEVICE *t) +{ + UINT i; + // Validate arguments + if (t == NULL || p == NULL) + { + return; + } + + PackAddInt(p, "NumItem", t->NumItem); + + PackSetCurrentJsonGroupName(p, "DeviceList"); + for (i = 0;i < t->NumItem;i++) + { + RPC_ENUM_DEVICE_ITEM *d = &t->Items[i]; + + PackAddStrEx(p, "DeviceName", d->DeviceName, i, t->NumItem); + PackAddBoolEx(p, "Active", d->Active, i, t->NumItem); + } + PackSetCurrentJsonGroupName(p, NULL); + + PackAddBool(p, "IsLicenseSupported", t->IsLicenseSupported); +} + +void FreeRpcEnumDevice(RPC_ENUM_DEVICE *t) +{ + // Validate arguments + if (t == NULL) + { + return; + } + + Free(t->Items); +} + +// RPC_LICENSE_STATUS +void InRpcElLicenseStatus(RPC_EL_LICENSE_STATUS *t, PACK *p) +{ + // Validate arguments + if (t == NULL || p == NULL) + { + return; + } + + Zero(t, sizeof(RPC_EL_LICENSE_STATUS)); + + t->Valid = PackGetBool(p, "Valid"); + t->SystemId = PackGetInt64(p, "SystemId"); + t->SystemExpires = PackGetInt64(p, "SystemExpires"); +} +void OutRpcElLicenseStatus(PACK *p, RPC_EL_LICENSE_STATUS *t) +{ + // Validate arguments + if (t == NULL || p == NULL) + { + return; + } + + PackAddBool(p, "Valid", t->Valid); + PackAddInt64(p, "SystemId", t->SystemId); + PackAddTime64(p, "SystemExpires", t->SystemExpires); +} + +// Listener thread +void ElListenerProc(THREAD *thread, void *param) +{ + TCP_ACCEPTED_PARAM *data = (TCP_ACCEPTED_PARAM *)param; + EL *e; + SOCK *s; + UCHAR rand[SHA1_SIZE]; + UCHAR pass1[SHA1_SIZE], pass2[SHA1_SIZE]; + // Validate arguments + if (data == NULL || thread == NULL) + { + return; + } + + e = (EL *)data->r->ThreadParam; + s = data->s; + AddRef(s->ref); + SetTimeout(s, 5000); + LockList(e->AdminThreadList); + { + AddRef(thread->ref); + AddRef(s->ref); + Insert(e->AdminThreadList, thread); + Insert(e->AdminSockList, s); + } + UnlockList(e->AdminThreadList); + NoticeThreadInit(thread); + + // Submit a challenge + Rand(rand, sizeof(rand)); + SendAll(s, rand, sizeof(rand), false); + + // Receive a response + SecurePassword(pass1, e->HashedPassword, rand); + Zero(pass2, sizeof(pass2)); + (void)RecvAll(s, pass2, sizeof(pass2), false); + + if (Cmp(pass1, pass2, SHA1_SIZE) != 0) + { + // Password incorrect + bool code = false; + code = Endian32(code); + SendAll(s, &code, sizeof(code), false); + } + else + { + // Password match + bool code = true; + RPC *r; + + code = Endian32(code); + SendAll(s, &code, sizeof(code), false); + + SetTimeout(s, INFINITE); + + // Start operation as a RPC server + r = StartRpcServer(s, ElRpcServer, e); + RpcServer(r); + RpcFree(r); + } + + Disconnect(s); + ReleaseSock(s); + + LockList(e->AdminThreadList); + { + if (Delete(e->AdminThreadList, thread)) + { + ReleaseThread(thread); + } + if (Delete(e->AdminSockList, s)) + { + ReleaseSock(s); + } + } + UnlockList(e->AdminThreadList); +} + +// Listener start +void ElStartListener(EL *e) +{ + // Validate arguments + if (e == NULL) + { + return; + } + + e->AdminThreadList = NewList(NULL); + e->AdminSockList = NewList(NULL); + + e->Listener = NewListenerEx(e->Cedar, LISTENER_TCP, e->Port == 0 ? EL_ADMIN_PORT : e->Port, + ElListenerProc, e); +} + +// Listener stop +void ElStopListener(EL *e) +{ + UINT i; + THREAD **threads; + SOCK **socks; + UINT num_threads, num_socks; + // Validate arguments + if (e == NULL) + { + return; + } + + StopAllListener(e->Cedar); + + LockList(e->AdminThreadList); + { + threads = ToArray(e->AdminThreadList); + num_threads = LIST_NUM(e->AdminThreadList); + DeleteAll(e->AdminThreadList); + + socks = ToArray(e->AdminSockList); + num_socks = LIST_NUM(e->AdminSockList); + DeleteAll(e->AdminSockList); + } + UnlockList(e->AdminThreadList); + + for (i = 0;i < num_socks;i++) + { + Disconnect(socks[i]); + ReleaseSock(socks[i]); + } + + for (i = 0;i < num_threads;i++) + { + WaitThread(threads[i], INFINITE); + ReleaseThread(threads[i]); + } + + Free(threads); + Free(socks); + + ReleaseList(e->AdminSockList); + ReleaseList(e->AdminThreadList); + + ReleaseListener(e->Listener); +} + +// Update the log configuration of the capture device +bool ElSetCaptureDeviceLogSetting(EL *e, char *name, HUB_LOG *log) +{ + EL_DEVICE *d; + bool ret = false; + // Validate arguments + if (e == NULL || log == NULL || name == NULL) + { + return false; + } + + LockList(e->DeviceList); + { + EL_DEVICE t; + + Zero(&t, sizeof(t)); + StrCpy(t.DeviceName, sizeof(t.DeviceName), name); + + d = Search(e->DeviceList, &t); + + if (d != NULL) + { + Copy(&d->LogSetting, log, sizeof(HUB_LOG)); + + SetLogSwitchType(d->Logger, log->PacketLogSwitchType); + + ret = true; + } + } + UnlockList(e->DeviceList); + + return ret; +} + +// Confirm whether the beta version has expired +bool ElIsBetaExpired() +{ + SYSTEMTIME st; + UINT64 expires64; + UINT64 now64; + if (ELOG_IS_BETA == false) + { + return false; + } + + Zero(&st, sizeof(st)); + + st.wYear = ELOG_BETA_EXPIRES_YEAR; + st.wMonth = ELOG_BETA_EXPIRES_MONTH; + st.wDay = ELOG_BETA_EXPIRES_DAY; + + expires64 = SystemToUINT64(&st); + now64 = LocalTime64(); + + if (now64 >= expires64) + { + return true; + } + + return false; +} + +// Capture thread +void ElCaptureThread(THREAD *thread, void *param) +{ +} + +// Delete the capture device +bool ElDeleteCaptureDevice(EL *e, char *name) +{ + bool ret = false; + EL_DEVICE *d, t; + // Validate arguments + if (e == NULL || name == NULL) + { + return false; + } + + LockList(e->DeviceList); + { + Zero(&t, sizeof(t)); + StrCpy(t.DeviceName, sizeof(t.DeviceName), name); + + d = Search(e->DeviceList, &t); + + if (d != NULL) + { + // Stop capture + d->Halt = true; + Cancel(d->Cancel1); + + // Wait for thread stop + WaitThread(d->Thread, INFINITE); + ReleaseThread(d->Thread); + + // Release the memory + Delete(e->DeviceList, d); + Free(d); + + ret = true; + } + } + UnlockList(e->DeviceList); + + return ret; +} + +// Add a capture device +bool ElAddCaptureDevice(EL *e, char *name, HUB_LOG *log, bool no_promiscuous) +{ + EL_DEVICE *d, t; + // Validate arguments + if (e == NULL || name == NULL || log == NULL) + { + return false; + } + + Zero(&t, sizeof(t)); + StrCpy(t.DeviceName, sizeof(t.DeviceName), name); + + LockList(e->DeviceList); + { + d = Search(e->DeviceList, &t); + if (d != NULL) + { + // Capture settings with the same name already exists + UnlockList(e->DeviceList); + return false; + } + + // Add a device + d = ZeroMalloc(sizeof(EL_DEVICE)); + StrCpy(d->DeviceName, sizeof(d->DeviceName), name); + Copy(&d->LogSetting, log, sizeof(HUB_LOG)); + d->NoPromiscuous = no_promiscuous; + d->el = e; + Insert(e->DeviceList, d); + + // Start the thread + d->Thread = NewThread(ElCaptureThread, d); + WaitThreadInit(d->Thread); + } + UnlockList(e->DeviceList); + + ElSaveConfig(e); + + return true; +} + +// Write the license List +void EiWriteLicenseManager(FOLDER *f, EL *s) +{ +} + +// Read the license list +void EiLoadLicenseManager(EL *s, FOLDER *f) +{ +} + +// Configuration initialization +void ElInitConfig(EL *e) +{ + // Validate arguments + if (e == NULL) + { + return; + } + + // Device list initialization + e->DeviceList = NewList(ElCompareDevice); + + // Read configuration file + ElLoadConfig(e); + + // Write configuration file + ElSaveConfig(e); +} + +// Write the configuration +void ElSaveConfig(EL *e) +{ + FOLDER *root; + // Validate arguments + if (e == NULL) + { + return; + } + + root = CfgCreateFolder(NULL, TAG_ROOT); + + ElSaveConfigToFolder(e, root); + + SaveCfgRw(e->CfgRw, root); + + CfgDeleteFolder(root); +} + +// Write the configuration to the folder +void ElSaveConfigToFolder(EL *e, FOLDER *root) +{ + UINT i; + FOLDER *devices; + // Validate arguments + if (e == NULL || root == NULL) + { + return; + } + + CfgAddInt64(root, "AutoDeleteCheckDiskFreeSpaceMin", e->AutoDeleteCheckDiskFreeSpaceMin); + + CfgAddInt(root, "AdminPort", e->Port); + + CfgAddByte(root, "AdminPassword", e->HashedPassword, sizeof(e->HashedPassword)); + + if (ELOG_IS_BETA == false) + { + EiWriteLicenseManager(CfgCreateFolder(root, "LicenseManager"), e); + } + + devices = CfgCreateFolder(root,"Devices"); + + LockList(e->DeviceList); + { + for (i = 0;i < LIST_NUM(e->DeviceList);i++) + { + FOLDER *f; + EL_DEVICE *d = LIST_DATA(e->DeviceList, i); + + f = CfgCreateFolder(devices, d->DeviceName); + SiWriteHubLogCfgEx(f, &d->LogSetting, true); + CfgAddBool(f, "NoPromiscuousMode", d->NoPromiscuous); + } + } + UnlockList(e->DeviceList); +} + +// Read the configuration from the folder +void ElLoadConfigFromFolder(EL *e, FOLDER *root) +{ + UINT i; + TOKEN_LIST *t; + FOLDER *devices; + + // Validate arguments + if (e == NULL || root == NULL) + { + return; + } + + i = CfgGetInt(root, "AdminPort"); + if (i >= 1 && i <= 65535) + { + e->Port = i; + } + + e->AutoDeleteCheckDiskFreeSpaceMin = CfgGetInt64(root, "AutoDeleteCheckDiskFreeSpaceMin"); + if (CfgIsItem(root, "AutoDeleteCheckDiskFreeSpaceMin") == false && e->AutoDeleteCheckDiskFreeSpaceMin == 0) + { + e->AutoDeleteCheckDiskFreeSpaceMin = DISK_FREE_SPACE_DEFAULT; + } + + if (e->AutoDeleteCheckDiskFreeSpaceMin != 0) + { + if (e->AutoDeleteCheckDiskFreeSpaceMin < DISK_FREE_SPACE_MIN) + { + e->AutoDeleteCheckDiskFreeSpaceMin = DISK_FREE_SPACE_MIN; + } + } + + if (CfgGetByte(root, "AdminPassword", e->HashedPassword, sizeof(e->HashedPassword)) != sizeof(e->HashedPassword)) + { + Sha0(e->HashedPassword, "", 0); + } + + if (ELOG_IS_BETA == false) + { + EiLoadLicenseManager(e, CfgGetFolder(root, "LicenseManager")); + } + + devices = CfgGetFolder(root, "Devices"); + if(devices != NULL) + { + LockList(e->DeviceList); + { + t = CfgEnumFolderToTokenList(devices); + for (i = 0;i < t->NumTokens;i++) + { + char *name = t->Token[i]; + FOLDER *f = CfgGetFolder(devices, name); + + if (f != NULL) + { + HUB_LOG g; + + Zero(&g, sizeof(g)); + SiLoadHubLogCfg(&g, f); + ElAddCaptureDevice(e, name, &g, CfgGetBool(f, "NoPromiscuousMode")); + } + } + FreeToken(t); + } + UnlockList(e->DeviceList); + } +} + +// Reading configuration +bool ElLoadConfig(EL *e) +{ + FOLDER *root; + bool ret = false; + // Validate arguments + if (e == NULL) + { + return false; + } + + e->Port = EL_ADMIN_PORT; + + e->CfgRw = NewCfgRw(&root, EL_CONFIG_FILENAME); + + if (root != NULL) + { + ElLoadConfigFromFolder(e, root); + + CfgDeleteFolder(root); + } + else + { + char *pass = ""; + Sha0(e->HashedPassword, pass, StrLen(pass)); + e->AutoDeleteCheckDiskFreeSpaceMin = DISK_FREE_SPACE_DEFAULT; + } + + return ret; +} + +// Configuration release +void ElFreeConfig(EL *e) +{ + UINT i; + LIST *o; + // Validate arguments + if (e == NULL) + { + return; + } + + // Write the configuration file + ElSaveConfig(e); + FreeCfgRw(e->CfgRw); + + // Stop all capture + o = NewList(NULL); + LockList(e->DeviceList); + { + for (i = 0;i < LIST_NUM(e->DeviceList);i++) + { + EL_DEVICE *d = LIST_DATA(e->DeviceList, i); + Insert(o, CopyStr(d->DeviceName)); + } + for (i = 0;i < LIST_NUM(o);i++) + { + char *name = LIST_DATA(o, i); + ElDeleteCaptureDevice(e, name); + Free(name); + } + ReleaseList(o); + } + UnlockList(e->DeviceList); + + ReleaseList(e->DeviceList); +} + +// Comparison function of the device +int ElCompareDevice(void *p1, void *p2) +{ + EL_DEVICE *d1, *d2; + // Validate arguments + if (p1 == NULL || p2 == NULL) + { + return 0; + } + d1 = *(EL_DEVICE **)p1; + d2 = *(EL_DEVICE **)p2; + if (d1 == NULL || d2 == NULL) + { + return 0; + } + + return StrCmpi(d1->DeviceName, d2->DeviceName); +} + +// Clean-up the EL +void CleanupEl(EL *e) +{ + // Validate arguments + if (e == NULL) + { + return; + } + + // Stop Eraser + FreeEraser(e->Eraser); + + // Stop Listener + ElStopListener(e); + + // Setting release + ElFreeConfig(e); + + // Free the license system + if(e->LicenseSystem != NULL) + { + } + + // Free the license status + if(e->LicenseStatus != NULL) + { + Free(e->LicenseStatus); + } + + // Ethernet release + FreeEth(); + + ReleaseCedar(e->Cedar); + + DeleteLock(e->lock); + + Free(e); +} + +// Release the EL +void ReleaseEl(EL *e) +{ + // Validate arguments + if (e == NULL) + { + return; + } + + if (Release(e->ref) == 0) + { + CleanupEl(e); + } +} + +// Create the EL +EL *NewEl() +{ + EL *e; + +#ifdef OS_WIN32 + RegistWindowsFirewallAll(); +#endif + + e = ZeroMalloc(sizeof(EL)); + e->lock = NewLock(); + e->ref = NewRef(); + + e->Cedar = NewCedar(NULL, NULL); + + + // Ethernet initialization + InitEth(); + + // Setting initialization + ElInitConfig(e); + + // Listener start + ElStartListener(e); + + // Initialize the license status + ElParseCurrentLicenseStatus(e->LicenseSystem, e->LicenseStatus); + + // Eraser start + e->Eraser = NewEraser(NULL, e->AutoDeleteCheckDiskFreeSpaceMin); + + return e; +} + +// EL start +void ElStart() +{ + // Raise the priority + OSSetHighPriority(); + + Lock(el_lock); + { + el = NewEl(); + } + Unlock(el_lock); +} + +// EL stop +void ElStop() +{ + Lock(el_lock); + { + ReleaseEl(el); + el = NULL; + } + Unlock(el_lock); +} + diff --git a/src/Cedar/EtherLog.h b/src/Cedar/EtherLog.h index 15800b41..733852f2 100644 --- a/src/Cedar/EtherLog.h +++ b/src/Cedar/EtherLog.h @@ -1,171 +1,171 @@ -// SoftEther VPN Source Code - Developer Edition Master Branch -// Cedar Communication Module - - -// EtherLog.h -// Header of EtherLog.c - -#ifndef ETHERLOG_H -#define ETHERLOG_H - -// Whether this is a beta version -#define ELOG_IS_BETA true - -// Beta expiration date -#define ELOG_BETA_EXPIRES_YEAR 2008 -#define ELOG_BETA_EXPIRES_MONTH 12 -#define ELOG_BETA_EXPIRES_DAY 2 - -// Version information -//#define EL_VER 201 -//#define EL_BUILD 1600 -//#define EL_BETA 1 -#define MAX_LOGGING_QUEUE_LEN 100000 - -// RPC related -struct RPC_ADD_DEVICE -{ - char DeviceName[MAX_SIZE]; // Device name - HUB_LOG LogSetting; // Log settings - bool NoPromiscuous; // Without promiscuous mode -}; - -struct RPC_DELETE_DEVICE -{ - char DeviceName[MAX_SIZE]; // Device name -}; - -struct RPC_ENUM_DEVICE_ITEM -{ - char DeviceName[MAX_SIZE]; // Device name - bool Active; // Running flag -}; - -struct RPC_ENUM_DEVICE -{ - UINT NumItem; // Number of items - RPC_ENUM_DEVICE_ITEM *Items; // Items - bool IsLicenseSupported; // Whether the license system is supported -}; - -// License status of the service -struct RPC_EL_LICENSE_STATUS -{ - BOOL Valid; // Enable flag - UINT64 SystemId; // System ID - UINT64 SystemExpires; // System expiration date -}; - -// Device -struct EL_DEVICE -{ - EL *el; // EL - char DeviceName[MAX_SIZE]; // Device name - HUB_LOG LogSetting; // Log settings - THREAD *Thread; // Thread - CANCEL *Cancel1; // Cancel 1 - CANCEL *Cancel2; // Cancel 2 - volatile bool Halt; // Halting flag - bool Active; // Running flag - bool NoPromiscuous; // Without promiscuous mode - LOG *Logger; // Logger -}; - -// License status -struct EL_LICENSE_STATUS -{ - BOOL Valid; // Enable flag - UINT64 SystemId; // System ID - UINT64 Expires; // Expiration date -}; - -// EtherLogger -struct EL -{ - LOCK *lock; // Lock - REF *ref; // Reference counter - CEDAR *Cedar; // Cedar - LIST *DeviceList; // Device list - CFG_RW *CfgRw; // Config R/W - UINT Port; // Port number - LISTENER *Listener; // Listener - UCHAR HashedPassword[SHA1_SIZE]; // Password - LIST *AdminThreadList; // Management thread list - LIST *AdminSockList; // Management socket list - LICENSE_SYSTEM *LicenseSystem; // License system - EL_LICENSE_STATUS *LicenseStatus; // License status - UINT64 AutoDeleteCheckDiskFreeSpaceMin; // Minimum free disk space - ERASER *Eraser; // Eraser -}; - -// Function prototype -void ElStart(); -void ElStop(); -EL *NewEl(); -void ReleaseEl(EL *e); -void CleanupEl(EL *e); -void ElInitConfig(EL *e); -void ElFreeConfig(EL *e); -bool ElLoadConfig(EL *e); -void ElLoadConfigFromFolder(EL *e, FOLDER *root); -void ElSaveConfig(EL *e); -void ElSaveConfigToFolder(EL *e, FOLDER *root); -int ElCompareDevice(void *p1, void *p2); -bool ElAddCaptureDevice(EL *e, char *name, HUB_LOG *log, bool no_promiscuous); -bool ElDeleteCaptureDevice(EL *e, char *name); -bool ElSetCaptureDeviceLogSetting(EL *e, char *name, HUB_LOG *log); -void ElCaptureThread(THREAD *thread, void *param); -void ElStartListener(EL *e); -void ElStopListener(EL *e); -void ElListenerProc(THREAD *thread, void *param); -PACK *ElRpcServer(RPC *r, char *name, PACK *p); -void ElParseCurrentLicenseStatus(LICENSE_SYSTEM *s, EL_LICENSE_STATUS *st); -bool ElIsBetaExpired(); - - -UINT EtAddDevice(EL *e, RPC_ADD_DEVICE *t); -UINT EtDelDevice(EL *e, RPC_DELETE_DEVICE *t); -UINT EtSetDevice(EL *e, RPC_ADD_DEVICE *t); -UINT EtGetDevice(EL *e, RPC_ADD_DEVICE *t); -UINT EtEnumDevice(EL *e, RPC_ENUM_DEVICE *t); -UINT EtEnumAllDevice(EL *e, RPC_ENUM_DEVICE *t); -UINT EtSetPassword(EL *e, RPC_SET_PASSWORD *t); -UINT EtAddLicenseKey(EL *a, RPC_TEST *t); -UINT EtDelLicenseKey(EL *a, RPC_TEST *t); -UINT EtEnumLicenseKey(EL *a, RPC_ENUM_LICENSE_KEY *t); -UINT EtGetLicenseStatus(EL *a, RPC_EL_LICENSE_STATUS *t); -UINT EtGetBridgeSupport(EL *a, RPC_BRIDGE_SUPPORT *t); -UINT EtRebootServer(EL *a, RPC_TEST *t); - -UINT EcAddDevice(RPC *r, RPC_ADD_DEVICE *t); -UINT EcDelDevice(RPC *r, RPC_DELETE_DEVICE *t); -UINT EcSetDevice(RPC *r, RPC_ADD_DEVICE *t); -UINT EcGetDevice(RPC *r, RPC_ADD_DEVICE *t); -UINT EcEnumDevice(RPC *r, RPC_ENUM_DEVICE *t); -UINT EcEnumAllDevice(RPC *r, RPC_ENUM_DEVICE *t); -UINT EcSetPassword(RPC *r, RPC_SET_PASSWORD *t); -UINT EcDelLicenseKey(RPC *r, RPC_TEST *t); -UINT EcEnumLicenseKey(RPC *r, RPC_ENUM_LICENSE_KEY *t); -UINT EcGetLicenseStatus(RPC *r, RPC_EL_LICENSE_STATUS *t); -UINT EcGetBridgeSupport(RPC *r, RPC_BRIDGE_SUPPORT *t); -UINT EcRebootServer(RPC *r, RPC_TEST *t); - -UINT EcConnect(char *host, UINT port, char *password, RPC **rpc); -void EcDisconnect(RPC *rpc); - -void InRpcAddDevice(RPC_ADD_DEVICE *t, PACK *p); -void OutRpcAddDevice(PACK *p, RPC_ADD_DEVICE *t); -void InRpcDeleteDevice(RPC_DELETE_DEVICE *t, PACK *p); -void OutRpcDeleteDevice(PACK *p, RPC_DELETE_DEVICE *t); -void InRpcEnumDevice(RPC_ENUM_DEVICE *t, PACK *p); -void OutRpcEnumDevice(PACK *p, RPC_ENUM_DEVICE *t); -void FreeRpcEnumDevice(RPC_ENUM_DEVICE *t); -void InRpcEnumLicenseKey(RPC_ENUM_LICENSE_KEY *t, PACK *p); -void OutRpcEnumLicenseKey(PACK *p, RPC_ENUM_LICENSE_KEY *t); -void FreeRpcEnumLicenseKey(RPC_ENUM_LICENSE_KEY *t); -void InRpcElLicenseStatus(RPC_EL_LICENSE_STATUS *t, PACK *p); -void OutRpcElLicenseStatus(PACK *p, RPC_EL_LICENSE_STATUS *t); - -#endif // ETHERLOG_H - - +// SoftEther VPN Source Code - Developer Edition Master Branch +// Cedar Communication Module + + +// EtherLog.h +// Header of EtherLog.c + +#ifndef ETHERLOG_H +#define ETHERLOG_H + +// Whether this is a beta version +#define ELOG_IS_BETA true + +// Beta expiration date +#define ELOG_BETA_EXPIRES_YEAR 2008 +#define ELOG_BETA_EXPIRES_MONTH 12 +#define ELOG_BETA_EXPIRES_DAY 2 + +// Version information +//#define EL_VER 201 +//#define EL_BUILD 1600 +//#define EL_BETA 1 +#define MAX_LOGGING_QUEUE_LEN 100000 + +// RPC related +struct RPC_ADD_DEVICE +{ + char DeviceName[MAX_SIZE]; // Device name + HUB_LOG LogSetting; // Log settings + bool NoPromiscuous; // Without promiscuous mode +}; + +struct RPC_DELETE_DEVICE +{ + char DeviceName[MAX_SIZE]; // Device name +}; + +struct RPC_ENUM_DEVICE_ITEM +{ + char DeviceName[MAX_SIZE]; // Device name + bool Active; // Running flag +}; + +struct RPC_ENUM_DEVICE +{ + UINT NumItem; // Number of items + RPC_ENUM_DEVICE_ITEM *Items; // Items + bool IsLicenseSupported; // Whether the license system is supported +}; + +// License status of the service +struct RPC_EL_LICENSE_STATUS +{ + BOOL Valid; // Enable flag + UINT64 SystemId; // System ID + UINT64 SystemExpires; // System expiration date +}; + +// Device +struct EL_DEVICE +{ + EL *el; // EL + char DeviceName[MAX_SIZE]; // Device name + HUB_LOG LogSetting; // Log settings + THREAD *Thread; // Thread + CANCEL *Cancel1; // Cancel 1 + CANCEL *Cancel2; // Cancel 2 + volatile bool Halt; // Halting flag + bool Active; // Running flag + bool NoPromiscuous; // Without promiscuous mode + LOG *Logger; // Logger +}; + +// License status +struct EL_LICENSE_STATUS +{ + BOOL Valid; // Enable flag + UINT64 SystemId; // System ID + UINT64 Expires; // Expiration date +}; + +// EtherLogger +struct EL +{ + LOCK *lock; // Lock + REF *ref; // Reference counter + CEDAR *Cedar; // Cedar + LIST *DeviceList; // Device list + CFG_RW *CfgRw; // Config R/W + UINT Port; // Port number + LISTENER *Listener; // Listener + UCHAR HashedPassword[SHA1_SIZE]; // Password + LIST *AdminThreadList; // Management thread list + LIST *AdminSockList; // Management socket list + LICENSE_SYSTEM *LicenseSystem; // License system + EL_LICENSE_STATUS *LicenseStatus; // License status + UINT64 AutoDeleteCheckDiskFreeSpaceMin; // Minimum free disk space + ERASER *Eraser; // Eraser +}; + +// Function prototype +void ElStart(); +void ElStop(); +EL *NewEl(); +void ReleaseEl(EL *e); +void CleanupEl(EL *e); +void ElInitConfig(EL *e); +void ElFreeConfig(EL *e); +bool ElLoadConfig(EL *e); +void ElLoadConfigFromFolder(EL *e, FOLDER *root); +void ElSaveConfig(EL *e); +void ElSaveConfigToFolder(EL *e, FOLDER *root); +int ElCompareDevice(void *p1, void *p2); +bool ElAddCaptureDevice(EL *e, char *name, HUB_LOG *log, bool no_promiscuous); +bool ElDeleteCaptureDevice(EL *e, char *name); +bool ElSetCaptureDeviceLogSetting(EL *e, char *name, HUB_LOG *log); +void ElCaptureThread(THREAD *thread, void *param); +void ElStartListener(EL *e); +void ElStopListener(EL *e); +void ElListenerProc(THREAD *thread, void *param); +PACK *ElRpcServer(RPC *r, char *name, PACK *p); +void ElParseCurrentLicenseStatus(LICENSE_SYSTEM *s, EL_LICENSE_STATUS *st); +bool ElIsBetaExpired(); + + +UINT EtAddDevice(EL *e, RPC_ADD_DEVICE *t); +UINT EtDelDevice(EL *e, RPC_DELETE_DEVICE *t); +UINT EtSetDevice(EL *e, RPC_ADD_DEVICE *t); +UINT EtGetDevice(EL *e, RPC_ADD_DEVICE *t); +UINT EtEnumDevice(EL *e, RPC_ENUM_DEVICE *t); +UINT EtEnumAllDevice(EL *e, RPC_ENUM_DEVICE *t); +UINT EtSetPassword(EL *e, RPC_SET_PASSWORD *t); +UINT EtAddLicenseKey(EL *a, RPC_TEST *t); +UINT EtDelLicenseKey(EL *a, RPC_TEST *t); +UINT EtEnumLicenseKey(EL *a, RPC_ENUM_LICENSE_KEY *t); +UINT EtGetLicenseStatus(EL *a, RPC_EL_LICENSE_STATUS *t); +UINT EtGetBridgeSupport(EL *a, RPC_BRIDGE_SUPPORT *t); +UINT EtRebootServer(EL *a, RPC_TEST *t); + +UINT EcAddDevice(RPC *r, RPC_ADD_DEVICE *t); +UINT EcDelDevice(RPC *r, RPC_DELETE_DEVICE *t); +UINT EcSetDevice(RPC *r, RPC_ADD_DEVICE *t); +UINT EcGetDevice(RPC *r, RPC_ADD_DEVICE *t); +UINT EcEnumDevice(RPC *r, RPC_ENUM_DEVICE *t); +UINT EcEnumAllDevice(RPC *r, RPC_ENUM_DEVICE *t); +UINT EcSetPassword(RPC *r, RPC_SET_PASSWORD *t); +UINT EcDelLicenseKey(RPC *r, RPC_TEST *t); +UINT EcEnumLicenseKey(RPC *r, RPC_ENUM_LICENSE_KEY *t); +UINT EcGetLicenseStatus(RPC *r, RPC_EL_LICENSE_STATUS *t); +UINT EcGetBridgeSupport(RPC *r, RPC_BRIDGE_SUPPORT *t); +UINT EcRebootServer(RPC *r, RPC_TEST *t); + +UINT EcConnect(char *host, UINT port, char *password, RPC **rpc); +void EcDisconnect(RPC *rpc); + +void InRpcAddDevice(RPC_ADD_DEVICE *t, PACK *p); +void OutRpcAddDevice(PACK *p, RPC_ADD_DEVICE *t); +void InRpcDeleteDevice(RPC_DELETE_DEVICE *t, PACK *p); +void OutRpcDeleteDevice(PACK *p, RPC_DELETE_DEVICE *t); +void InRpcEnumDevice(RPC_ENUM_DEVICE *t, PACK *p); +void OutRpcEnumDevice(PACK *p, RPC_ENUM_DEVICE *t); +void FreeRpcEnumDevice(RPC_ENUM_DEVICE *t); +void InRpcEnumLicenseKey(RPC_ENUM_LICENSE_KEY *t, PACK *p); +void OutRpcEnumLicenseKey(PACK *p, RPC_ENUM_LICENSE_KEY *t); +void FreeRpcEnumLicenseKey(RPC_ENUM_LICENSE_KEY *t); +void InRpcElLicenseStatus(RPC_EL_LICENSE_STATUS *t, PACK *p); +void OutRpcElLicenseStatus(PACK *p, RPC_EL_LICENSE_STATUS *t); + +#endif // ETHERLOG_H + + diff --git a/src/Cedar/Hub.c b/src/Cedar/Hub.c index 184f3312..1bf6d6a3 100644 --- a/src/Cedar/Hub.c +++ b/src/Cedar/Hub.c @@ -1,7214 +1,7214 @@ -// SoftEther VPN Source Code - Developer Edition Master Branch -// Cedar Communication Module - - -// Hub.c -// Virtual HUB module - -#include "CedarPch.h" - -static UCHAR broadcast[] = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff}; -static char vgs_ua_str[9] = {0}; -static bool g_vgs_emb_tag = false; - -// A list of administration options that are currently supported and its default values -// These names must be shorter than 64 bytes -ADMIN_OPTION admin_options[] = -{ - {"allow_hub_admin_change_option", 0}, - {"max_users", 0}, - {"max_multilogins_per_user", 0}, - {"max_groups", 0}, - {"max_accesslists", 0}, - {"max_sessions_client_bridge_apply", 0}, - {"max_sessions", 0}, - {"max_sessions_client", 0}, - {"max_sessions_bridge", 0}, - {"max_bitrates_download", 0}, - {"max_bitrates_upload", 0}, - {"deny_empty_password", 0}, - {"deny_bridge", 0}, - {"deny_routing", 0}, - {"deny_qos", 0}, - {"deny_change_user_password", 0}, - {"no_change_users", 0}, - {"no_change_groups", 0}, - {"no_securenat", 0}, - {"no_securenat_enablenat", 0}, - {"no_securenat_enabledhcp", 0}, - {"no_cascade", 0}, - {"no_online", 0}, - {"no_offline", 0}, - {"no_change_log_config", 0}, - {"no_disconnect_session", 0}, - {"no_delete_iptable", 0}, - {"no_delete_mactable", 0}, - {"no_enum_session", 0}, - {"no_query_session", 0}, - {"no_change_admin_password", 0}, - {"no_change_log_switch_type", 0}, - {"no_change_access_list", 0}, - {"no_change_access_control_list", 0}, - {"no_change_cert_list", 0}, - {"no_change_crl_list", 0}, - {"no_read_log_file", 0}, - {"deny_hub_admin_change_ext_option", 0}, - {"no_delay_jitter_packet_loss", 0}, - {"no_change_msg", 0}, - {"no_access_list_include_file", 0}, -}; - -UINT num_admin_options = sizeof(admin_options) / sizeof(ADMIN_OPTION); - - -// Create an EAP client for the specified Virtual Hub -EAP_CLIENT *HubNewEapClient(CEDAR *cedar, char *hubname, char *client_ip_str, char *username, char *vpn_protocol_state_str) -{ - HUB *hub = NULL; - EAP_CLIENT *ret = NULL; - char radius_servers[MAX_PATH] = {0}; - UINT radius_port = 0; - UINT radius_retry_interval = 0; - char radius_secret[MAX_PATH] = {0}; - char radius_suffix_filter[MAX_PATH] = {0}; - if (cedar == NULL || hubname == NULL || client_ip_str == NULL || username == NULL) - { - return NULL; - } - - // Find the Virtual Hub - LockHubList(cedar); - { - hub = GetHub(cedar, hubname); - } - UnlockHubList(cedar); - - if (hub != NULL) - { - if (GetRadiusServerEx2(hub, radius_servers, sizeof(radius_servers), &radius_port, radius_secret, - sizeof(radius_secret), &radius_retry_interval, radius_suffix_filter, sizeof(radius_suffix_filter))) - { - bool use_peap = hub->RadiusUsePeapInsteadOfEap; - - if (IsEmptyStr(radius_suffix_filter) || EndWith(username, radius_suffix_filter)) - { - TOKEN_LIST *radius_servers_list = ParseToken(radius_servers, " ,;\t"); - - if (radius_servers_list != NULL && radius_servers_list->NumTokens >= 1) - { - // Try for each of RADIUS servers - UINT i; - bool finish = false; - - for (i = 0;i < radius_servers_list->NumTokens;i++) - { - EAP_CLIENT *eap; - IP ip; - - if (GetIP(&ip, radius_servers_list->Token[i])) - { - eap = NewEapClient(&ip, radius_port, radius_secret, radius_retry_interval, - RADIUS_INITIAL_EAP_TIMEOUT, client_ip_str, username, hubname); - - if (eap != NULL) - { - if (IsEmptyStr(vpn_protocol_state_str) == false) - { - StrCpy(eap->In_VpnProtocolState, sizeof(eap->In_VpnProtocolState), vpn_protocol_state_str); - } - - if (use_peap == false) - { - // EAP - if (EapClientSendMsChapv2AuthRequest(eap)) - { - eap->GiveupTimeout = RADIUS_RETRY_TIMEOUT; - ret = eap; - finish = true; - } - } - else - { - // PEAP - if (PeapClientSendMsChapv2AuthRequest(eap)) - { - eap->GiveupTimeout = RADIUS_RETRY_TIMEOUT; - ret = eap; - finish = true; - } - } - - if (finish == false) - { - ReleaseEapClient(eap); - } - } - } - - if (finish) - { - break; - } - } - } - - FreeToken(radius_servers_list); - } - } - } - - ReleaseHub(hub); - - return ret; -} - -// Create a user list -LIST *NewUserList() -{ - LIST *o = NewList(CompareUserList); - - return o; -} - -// Search whether the specified user matches to the user list (with cache expiration) -bool IsUserMatchInUserListWithCacheExpires(LIST *o, char *filename, UINT64 user_hash, UINT64 lifetime) -{ - bool ret = false; - UINT64 now = Tick64(); - // Validate arguments - if (o == NULL || filename == NULL || user_hash == 0) - { - return false; - } - - LockList(o); - { - if (lifetime != 0) - { - if (o->Param1 == 0 || (now >= (o->Param1 + lifetime))) - { - DeleteAllUserListCache(o); - - o->Param1 = now; - } - } - - ret = IsUserMatchInUserList(o, filename, user_hash); - } - UnlockList(o); - - return ret; -} -bool IsUserMatchInUserListWithCacheExpiresAcl(LIST *o, char *name_in_acl, UINT64 user_hash, UINT64 lifetime) -{ - char tmp[16]; - bool exclude = false; - char filename[MAX_SIZE]; - char filename2[MAX_SIZE]; - bool is_full_path = false; - bool ret = false; - // Validate arguments - if (o == NULL || name_in_acl == NULL || user_hash == 0 || StrLen(name_in_acl) < 9) - { - return false; - } - - StrCpy(tmp, sizeof(tmp), name_in_acl); - StrLower(tmp); - - tmp[8] = 0; - - if (Cmp(tmp, ACCESS_LIST_INCLUDED_PREFIX, 8) == 0) - { - // include - exclude = false; - } - else - { - // exclude - exclude = true; - } - - // Extract the file name - StrCpy(filename, sizeof(filename), name_in_acl + 8); - Trim(filename); - - // Identify whether the file name is an absolute path - if (filename[0] == '\\' || filename[0] == '/' || (filename[1] == ':' && filename[2] == '\\')) - { - is_full_path = true; - } - - if (is_full_path == false) - { - // Prepend a '@' if the file name is a relative path - StrCpy(filename2, sizeof(filename2), "@"); - StrCat(filename2, sizeof(filename2), filename); - StrCpy(filename, sizeof(filename), filename2); - } - - ret = IsUserMatchInUserListWithCacheExpires(o, filename, user_hash, lifetime); - - if (exclude) - { - ret = NEGATIVE_BOOL(ret); - } - - return ret; -} - -// Search whether the specified user matches to the user list -bool IsUserMatchInUserList(LIST *o, char *filename, UINT64 user_hash) -{ - USERLIST *u; - bool ret = false; - // Validate arguments - if (o == NULL || filename == NULL || user_hash == 0) - { - return false; - } - - LockList(o); - { - u = FindUserList(o, filename); - if (u == NULL) - { - u = LoadUserList(o, filename); - } - - if (u != NULL) - { - ret = IsInt64InList(u->UserHashList, user_hash); - } - } - UnlockList(o); - - return ret; -} - -// Read the user list -USERLIST *LoadUserList(LIST *o, char *filename) -{ - USERLIST *u; - BUF *b; - // Validate arguments - if (o == NULL || filename == NULL) - { - return NULL; - } - - u = FindUserList(o, filename); - - if (u != NULL) - { - Delete(o, u); - - FreeUserListEntry(u); - } - - u = ZeroMalloc(sizeof(USERLIST)); - - StrCpy(u->Filename, sizeof(u->Filename), filename); - - u->UserHashList = NewInt64List(false); - - b = ReadDumpWithMaxSize(filename, ACCESS_LIST_INCLUDE_FILE_MAX_SIZE); - if (b != NULL) - { - while (true) - { - char *line = CfgReadNextLine(b); - UINT64 ui; - if (line == NULL) - { - break; - } - - Trim(line); - - if (IsEmptyStr(line) == false) - { - if (StartWith(line, "#") == false && - StartWith(line, "//") == false && - StartWith(line, ";") == false) - { - ui = UsernameToInt64(line); - - AddInt64Distinct(u->UserHashList, ui); - } - } - - Free(line); - } - - FreeBuf(b); - } - - Add(o, u); - - return u; -} - -// Release the user list entry -void FreeUserListEntry(USERLIST *u) -{ - // Validate arguments - if (u == NULL) - { - return; - } - - ReleaseInt64List(u->UserHashList); - - Free(u); -} - -// Search in user list -USERLIST *FindUserList(LIST *o, char *filename) -{ - USERLIST t, *u; - // Validate arguments - if (o == NULL || filename == NULL) - { - return NULL; - } - - Zero(&t, sizeof(t)); - - StrCpy(t.Filename, sizeof(t.Filename), filename); - - u = Search(o, &t); - - return u; -} - -// User list entry comparison function -int CompareUserList(void *p1, void *p2) -{ - USERLIST *u1, *u2; - // Validate arguments - if (p1 == NULL || p2 == NULL) - { - return 0; - } - u1 = *(USERLIST **)p1; - u2 = *(USERLIST **)p2; - if (u1 == NULL || u2 == NULL) - { - return 0; - } - - return StrCmpi(u1->Filename, u2->Filename); -} - -// Delete the cache of the all user list -void DeleteAllUserListCache(LIST *o) -{ - UINT i; - // Validate arguments - if (o == NULL) - { - return; - } - - LockList(o); - { - for (i = 0;i < LIST_NUM(o);i++) - { - USERLIST *u = LIST_DATA(o, i); - - FreeUserListEntry(u); - } - - DeleteAll(o); - } - UnlockList(o); -} - -// Release the user list -void FreeUserList(LIST *o) -{ - UINT i; - // Validate arguments - if (o == NULL) - { - return; - } - - for (i = 0;i < LIST_NUM(o);i++) - { - USERLIST *u = LIST_DATA(o, i); - - FreeUserListEntry(u); - } - - ReleaseList(o); -} - -// Get whether the specified message is a URL string -bool IsURLMsg(wchar_t *str, char *url, UINT url_size) -{ - UNI_TOKEN_LIST *t; - bool ret = false; - UINT i; - UINT n = 0; - // Validate arguments - if (str == NULL) - { - return false; - } - - t = UniParseToken(str, L"\r\n"); - - for (i = 0;i < t->NumTokens;i++) - { - wchar_t *str = t->Token[i]; - - if (IsEmptyUniStr(str) == false) - { - n++; - - UniTrim(str); - - if (n == 1) - { - if (UniStartWith(str, L"http://") || - UniStartWith(str, L"https://") || - UniStartWith(str, L"ftp://")) - { - ret = true; - - UniToStr(url, url_size, str); - } - } - } - } - - if (n != 1) - { - ret = false; - } - - UniFreeToken(t); - - return ret; -} - -// Get data from RPC_ADMIN_OPTION -UINT GetHubAdminOptionData(RPC_ADMIN_OPTION *ao, char *name) -{ - UINT i; - // Validate arguments - if (ao == NULL || name == NULL) - { - return INFINITE; - } - - for (i = 0;i < ao->NumItem;i++) - { - ADMIN_OPTION *a = &ao->Items[i]; - - if (StrCmpi(a->Name, name) == 0) - { - return a->Value; - } - } - - return INFINITE; -} -void GetHubAdminOptionDataAndSet(RPC_ADMIN_OPTION *ao, char *name, UINT *dest) -{ - UINT value; - // Validate arguments - if (ao == NULL || name == NULL || dest == NULL) - { - return; - } - - value = GetHubAdminOptionData(ao, name); - if (value == INFINITE) - { - return; - } - - *dest = value; -} - -// Set the contents of the HUB_OPTION based on the data -void DataToHubOptionStruct(HUB_OPTION *o, RPC_ADMIN_OPTION *ao) -{ - // Validate arguments - if (o == NULL || ao == NULL) - { - return; - } - - GetHubAdminOptionDataAndSet(ao, "NoAddressPollingIPv4", &o->NoArpPolling); - GetHubAdminOptionDataAndSet(ao, "NoAddressPollingIPv6", &o->NoIPv6AddrPolling); - GetHubAdminOptionDataAndSet(ao, "NoIpTable", &o->NoIpTable); - GetHubAdminOptionDataAndSet(ao, "NoMacAddressLog", &o->NoMacAddressLog); - GetHubAdminOptionDataAndSet(ao, "ManageOnlyPrivateIP", &o->ManageOnlyPrivateIP); - GetHubAdminOptionDataAndSet(ao, "ManageOnlyLocalUnicastIPv6", &o->ManageOnlyLocalUnicastIPv6); - GetHubAdminOptionDataAndSet(ao, "DisableIPParsing", &o->DisableIPParsing); - GetHubAdminOptionDataAndSet(ao, "YieldAfterStorePacket", &o->YieldAfterStorePacket); - GetHubAdminOptionDataAndSet(ao, "NoSpinLockForPacketDelay", &o->NoSpinLockForPacketDelay); - GetHubAdminOptionDataAndSet(ao, "BroadcastStormDetectionThreshold", &o->BroadcastStormDetectionThreshold); - GetHubAdminOptionDataAndSet(ao, "ClientMinimumRequiredBuild", &o->ClientMinimumRequiredBuild); - GetHubAdminOptionDataAndSet(ao, "FilterPPPoE", &o->FilterPPPoE); - GetHubAdminOptionDataAndSet(ao, "FilterOSPF", &o->FilterOSPF); - GetHubAdminOptionDataAndSet(ao, "FilterIPv4", &o->FilterIPv4); - GetHubAdminOptionDataAndSet(ao, "FilterIPv6", &o->FilterIPv6); - GetHubAdminOptionDataAndSet(ao, "FilterNonIP", &o->FilterNonIP); - GetHubAdminOptionDataAndSet(ao, "NoIPv4PacketLog", &o->NoIPv4PacketLog); - GetHubAdminOptionDataAndSet(ao, "NoIPv6PacketLog", &o->NoIPv6PacketLog); - GetHubAdminOptionDataAndSet(ao, "FilterBPDU", &o->FilterBPDU); - GetHubAdminOptionDataAndSet(ao, "NoIPv6DefaultRouterInRAWhenIPv6", &o->NoIPv6DefaultRouterInRAWhenIPv6); - GetHubAdminOptionDataAndSet(ao, "NoLookBPDUBridgeId", &o->NoLookBPDUBridgeId); - GetHubAdminOptionDataAndSet(ao, "NoManageVlanId", &o->NoManageVlanId); - GetHubAdminOptionDataAndSet(ao, "VlanTypeId", &o->VlanTypeId); - GetHubAdminOptionDataAndSet(ao, "FixForDLinkBPDU", &o->FixForDLinkBPDU); - GetHubAdminOptionDataAndSet(ao, "RequiredClientId", &o->RequiredClientId); - GetHubAdminOptionDataAndSet(ao, "AdjustTcpMssValue", &o->AdjustTcpMssValue); - GetHubAdminOptionDataAndSet(ao, "DisableAdjustTcpMss", &o->DisableAdjustTcpMss); - GetHubAdminOptionDataAndSet(ao, "NoDhcpPacketLogOutsideHub", &o->NoDhcpPacketLogOutsideHub); - GetHubAdminOptionDataAndSet(ao, "DisableHttpParsing", &o->DisableHttpParsing); - GetHubAdminOptionDataAndSet(ao, "DisableUdpAcceleration", &o->DisableUdpAcceleration); - GetHubAdminOptionDataAndSet(ao, "DisableUdpFilterForLocalBridgeNic", &o->DisableUdpFilterForLocalBridgeNic); - GetHubAdminOptionDataAndSet(ao, "ApplyIPv4AccessListOnArpPacket", &o->ApplyIPv4AccessListOnArpPacket); - GetHubAdminOptionDataAndSet(ao, "RemoveDefGwOnDhcpForLocalhost", &o->RemoveDefGwOnDhcpForLocalhost); - GetHubAdminOptionDataAndSet(ao, "SecureNAT_MaxTcpSessionsPerIp", &o->SecureNAT_MaxTcpSessionsPerIp); - GetHubAdminOptionDataAndSet(ao, "SecureNAT_MaxTcpSynSentPerIp", &o->SecureNAT_MaxTcpSynSentPerIp); - GetHubAdminOptionDataAndSet(ao, "SecureNAT_MaxUdpSessionsPerIp", &o->SecureNAT_MaxUdpSessionsPerIp); - GetHubAdminOptionDataAndSet(ao, "SecureNAT_MaxDnsSessionsPerIp", &o->SecureNAT_MaxDnsSessionsPerIp); - GetHubAdminOptionDataAndSet(ao, "SecureNAT_MaxIcmpSessionsPerIp", &o->SecureNAT_MaxIcmpSessionsPerIp); - GetHubAdminOptionDataAndSet(ao, "AccessListIncludeFileCacheLifetime", &o->AccessListIncludeFileCacheLifetime); - GetHubAdminOptionDataAndSet(ao, "DisableKernelModeSecureNAT", &o->DisableKernelModeSecureNAT); - GetHubAdminOptionDataAndSet(ao, "DisableIpRawModeSecureNAT", &o->DisableIpRawModeSecureNAT); - GetHubAdminOptionDataAndSet(ao, "DisableUserModeSecureNAT", &o->DisableUserModeSecureNAT); - GetHubAdminOptionDataAndSet(ao, "DisableCheckMacOnLocalBridge", &o->DisableCheckMacOnLocalBridge); - GetHubAdminOptionDataAndSet(ao, "DisableCorrectIpOffloadChecksum", &o->DisableCorrectIpOffloadChecksum); - GetHubAdminOptionDataAndSet(ao, "BroadcastLimiterStrictMode", &o->BroadcastLimiterStrictMode); - GetHubAdminOptionDataAndSet(ao, "MaxLoggedPacketsPerMinute", &o->MaxLoggedPacketsPerMinute); - GetHubAdminOptionDataAndSet(ao, "DoNotSaveHeavySecurityLogs", &o->DoNotSaveHeavySecurityLogs); - GetHubAdminOptionDataAndSet(ao, "DropBroadcastsInPrivacyFilterMode", &o->DropBroadcastsInPrivacyFilterMode); - GetHubAdminOptionDataAndSet(ao, "DropArpInPrivacyFilterMode", &o->DropArpInPrivacyFilterMode); - GetHubAdminOptionDataAndSet(ao, "SuppressClientUpdateNotification", &o->SuppressClientUpdateNotification); - GetHubAdminOptionDataAndSet(ao, "FloodingSendQueueBufferQuota", &o->FloodingSendQueueBufferQuota); - GetHubAdminOptionDataAndSet(ao, "AssignVLanIdByRadiusAttribute", &o->AssignVLanIdByRadiusAttribute); - GetHubAdminOptionDataAndSet(ao, "DenyAllRadiusLoginWithNoVlanAssign", &o->DenyAllRadiusLoginWithNoVlanAssign); - GetHubAdminOptionDataAndSet(ao, "SecureNAT_RandomizeAssignIp", &o->SecureNAT_RandomizeAssignIp); - GetHubAdminOptionDataAndSet(ao, "DetectDormantSessionInterval", &o->DetectDormantSessionInterval); - GetHubAdminOptionDataAndSet(ao, "NoPhysicalIPOnPacketLog", &o->NoPhysicalIPOnPacketLog); - GetHubAdminOptionDataAndSet(ao, "UseHubNameAsDhcpUserClassOption", &o->UseHubNameAsDhcpUserClassOption); - GetHubAdminOptionDataAndSet(ao, "UseHubNameAsRadiusNasId", &o->UseHubNameAsRadiusNasId); -} - -// Convert the contents of the HUB_OPTION to data -void HubOptionStructToData(RPC_ADMIN_OPTION *ao, HUB_OPTION *o, char *hub_name) -{ - LIST *aol; - UINT i; - // Validate arguments - if (ao == NULL || o == NULL || hub_name == NULL) - { - return; - } - - aol = NewListFast(NULL); - - Add(aol, NewAdminOption("NoAddressPollingIPv4", o->NoArpPolling)); - Add(aol, NewAdminOption("NoAddressPollingIPv6", o->NoIPv6AddrPolling)); - Add(aol, NewAdminOption("NoIpTable", o->NoIpTable)); - Add(aol, NewAdminOption("NoMacAddressLog", o->NoMacAddressLog)); - Add(aol, NewAdminOption("ManageOnlyPrivateIP", o->ManageOnlyPrivateIP)); - Add(aol, NewAdminOption("ManageOnlyLocalUnicastIPv6", o->ManageOnlyLocalUnicastIPv6)); - Add(aol, NewAdminOption("DisableIPParsing", o->DisableIPParsing)); - Add(aol, NewAdminOption("YieldAfterStorePacket", o->YieldAfterStorePacket)); - Add(aol, NewAdminOption("NoSpinLockForPacketDelay", o->NoSpinLockForPacketDelay)); - Add(aol, NewAdminOption("BroadcastStormDetectionThreshold", o->BroadcastStormDetectionThreshold)); - Add(aol, NewAdminOption("ClientMinimumRequiredBuild", o->ClientMinimumRequiredBuild)); - Add(aol, NewAdminOption("FilterPPPoE", o->FilterPPPoE)); - Add(aol, NewAdminOption("FilterOSPF", o->FilterOSPF)); - Add(aol, NewAdminOption("FilterIPv4", o->FilterIPv4)); - Add(aol, NewAdminOption("FilterIPv6", o->FilterIPv6)); - Add(aol, NewAdminOption("FilterNonIP", o->FilterNonIP)); - Add(aol, NewAdminOption("NoIPv4PacketLog", o->NoIPv4PacketLog)); - Add(aol, NewAdminOption("NoIPv6PacketLog", o->NoIPv6PacketLog)); - Add(aol, NewAdminOption("FilterBPDU", o->FilterBPDU)); - Add(aol, NewAdminOption("NoIPv6DefaultRouterInRAWhenIPv6", o->NoIPv6DefaultRouterInRAWhenIPv6)); - Add(aol, NewAdminOption("NoLookBPDUBridgeId", o->NoLookBPDUBridgeId)); - Add(aol, NewAdminOption("NoManageVlanId", o->NoManageVlanId)); - Add(aol, NewAdminOption("VlanTypeId", o->VlanTypeId)); - Add(aol, NewAdminOption("FixForDLinkBPDU", o->FixForDLinkBPDU)); - Add(aol, NewAdminOption("RequiredClientId", o->RequiredClientId)); - Add(aol, NewAdminOption("AdjustTcpMssValue", o->AdjustTcpMssValue)); - Add(aol, NewAdminOption("DisableAdjustTcpMss", o->DisableAdjustTcpMss)); - Add(aol, NewAdminOption("NoDhcpPacketLogOutsideHub", o->NoDhcpPacketLogOutsideHub)); - Add(aol, NewAdminOption("DisableHttpParsing", o->DisableHttpParsing)); - Add(aol, NewAdminOption("DisableUdpAcceleration", o->DisableUdpAcceleration)); - Add(aol, NewAdminOption("DisableUdpFilterForLocalBridgeNic", o->DisableUdpFilterForLocalBridgeNic)); - Add(aol, NewAdminOption("ApplyIPv4AccessListOnArpPacket", o->ApplyIPv4AccessListOnArpPacket)); - Add(aol, NewAdminOption("RemoveDefGwOnDhcpForLocalhost", o->RemoveDefGwOnDhcpForLocalhost)); - Add(aol, NewAdminOption("SecureNAT_MaxTcpSessionsPerIp", o->SecureNAT_MaxTcpSessionsPerIp)); - Add(aol, NewAdminOption("SecureNAT_MaxTcpSynSentPerIp", o->SecureNAT_MaxTcpSynSentPerIp)); - Add(aol, NewAdminOption("SecureNAT_MaxUdpSessionsPerIp", o->SecureNAT_MaxUdpSessionsPerIp)); - Add(aol, NewAdminOption("SecureNAT_MaxDnsSessionsPerIp", o->SecureNAT_MaxDnsSessionsPerIp)); - Add(aol, NewAdminOption("SecureNAT_MaxIcmpSessionsPerIp", o->SecureNAT_MaxIcmpSessionsPerIp)); - Add(aol, NewAdminOption("AccessListIncludeFileCacheLifetime", o->AccessListIncludeFileCacheLifetime)); - Add(aol, NewAdminOption("DisableKernelModeSecureNAT", o->DisableKernelModeSecureNAT)); - Add(aol, NewAdminOption("DisableIpRawModeSecureNAT", o->DisableIpRawModeSecureNAT)); - Add(aol, NewAdminOption("DisableUserModeSecureNAT", o->DisableUserModeSecureNAT)); - Add(aol, NewAdminOption("DisableCheckMacOnLocalBridge", o->DisableCheckMacOnLocalBridge)); - Add(aol, NewAdminOption("DisableCorrectIpOffloadChecksum", o->DisableCorrectIpOffloadChecksum)); - Add(aol, NewAdminOption("BroadcastLimiterStrictMode", o->BroadcastLimiterStrictMode)); - Add(aol, NewAdminOption("MaxLoggedPacketsPerMinute", o->MaxLoggedPacketsPerMinute)); - Add(aol, NewAdminOption("DoNotSaveHeavySecurityLogs", o->DoNotSaveHeavySecurityLogs)); - Add(aol, NewAdminOption("DropBroadcastsInPrivacyFilterMode", o->DropBroadcastsInPrivacyFilterMode)); - Add(aol, NewAdminOption("DropArpInPrivacyFilterMode", o->DropArpInPrivacyFilterMode)); - Add(aol, NewAdminOption("SuppressClientUpdateNotification", o->SuppressClientUpdateNotification)); - Add(aol, NewAdminOption("FloodingSendQueueBufferQuota", o->FloodingSendQueueBufferQuota)); - Add(aol, NewAdminOption("AssignVLanIdByRadiusAttribute", o->AssignVLanIdByRadiusAttribute)); - Add(aol, NewAdminOption("DenyAllRadiusLoginWithNoVlanAssign", o->DenyAllRadiusLoginWithNoVlanAssign)); - Add(aol, NewAdminOption("SecureNAT_RandomizeAssignIp", o->SecureNAT_RandomizeAssignIp)); - Add(aol, NewAdminOption("DetectDormantSessionInterval", o->DetectDormantSessionInterval)); - Add(aol, NewAdminOption("NoPhysicalIPOnPacketLog", o->NoPhysicalIPOnPacketLog)); - Add(aol, NewAdminOption("UseHubNameAsDhcpUserClassOption", o->UseHubNameAsDhcpUserClassOption)); - Add(aol, NewAdminOption("UseHubNameAsRadiusNasId", o->UseHubNameAsRadiusNasId)); - - Zero(ao, sizeof(RPC_ADMIN_OPTION)); - - StrCpy(ao->HubName, sizeof(ao->HubName), hub_name); - - ao->NumItem = LIST_NUM(aol); - ao->Items = ZeroMalloc(sizeof(ADMIN_OPTION) * ao->NumItem); - - for (i = 0;i < LIST_NUM(aol);i++) - { - ADMIN_OPTION *a = LIST_DATA(aol, i); - - UniStrCpy(a->Descrption, sizeof(a->Descrption), GetHubAdminOptionHelpString(a->Name)); - - Copy(&ao->Items[i], a, sizeof(ADMIN_OPTION)); - - Free(a); - } - - ReleaseList(aol); -} - -// Create a new ADMIN OPTION -ADMIN_OPTION *NewAdminOption(char *name, UINT value) -{ - ADMIN_OPTION *a; - // Validate arguments - if (name == NULL) - { - return NULL; - } - - a = ZeroMalloc(sizeof(ADMIN_OPTION)); - StrCpy(a->Name, sizeof(a->Name), name); - a->Value = value; - - return a; -} - -// Clone the AC list -LIST *CloneAcList(LIST *o) -{ - LIST *ret; - // Validate arguments - if (o == NULL) - { - return NULL; - } - - ret = NewAcList(); - SetAcList(ret, o); - - return ret; -} - -// Set all the AC list -void SetAcList(LIST *o, LIST *src) -{ - UINT i; - // Validate arguments - if (o == NULL || src == NULL) - { - return; - } - - DelAllAc(o); - - for (i = 0;i < LIST_NUM(src);i++) - { - AC *ac = LIST_DATA(src, i); - - AddAc(o, ac); - } -} - -// Remove all AC from the AC list -void DelAllAc(LIST *o) -{ - UINT i; - // Validate arguments - if (o == NULL) - { - return; - } - - for (i = 0;i < LIST_NUM(o);i++) - { - AC *ac = LIST_DATA(o, i); - - Free(ac); - } - - DeleteAll(o); -} - -// Release the AC list -void FreeAcList(LIST *o) -{ - UINT i; - // Validate arguments - if (o == NULL) - { - return; - } - - for (i = 0;i < LIST_NUM(o);i++) - { - AC *ac = LIST_DATA(o, i); - - Free(ac); - } - - ReleaseList(o); -} - -// Generate a string that indicates the contents of the AC -char *GenerateAcStr(AC *ac) -{ - char tmp[MAX_SIZE]; - char ip[64], mask[64]; - - if (ac == NULL) - { - return NULL; - } - - IPToStr(ip, sizeof(ip), &ac->IpAddress); - MaskToStr(mask, sizeof(mask), &ac->SubnetMask); - - if (ac->Masked == false) - { - Format(tmp, sizeof(tmp), "%s", ip); - } - else - { - Format(tmp, sizeof(tmp), "%s/%s", ip, mask); - } - - return CopyStr(tmp); -} - -// Calculate whether the specified IP address is rejected by the access list -bool IsIpDeniedByAcList(IP *ip, LIST *o) -{ - UINT i; - // Validate arguments - if (ip == NULL || o == NULL) - { - return false; - } - - if (GetGlobalServerFlag(GSF_DISABLE_AC) != 0) - { - return false; - } - - for (i = 0;i < LIST_NUM(o);i++) - { - AC *ac = LIST_DATA(o, i); - - if (IsIpMaskedByAc(ip, ac)) - { - if (ac->Deny == false) - { - return false; - } - else - { - return true; - } - } - } - - return false; -} - -// Calculate whether the specified IP address is masked by the AC -bool IsIpMaskedByAc(IP *ip, AC *ac) -{ - UINT uip, net, mask; - // Validate arguments - if (ip == NULL || ac == NULL) - { - return false; - } - - if (GetGlobalServerFlag(GSF_DISABLE_AC) != 0) - { - return false; - } - - if (IsIP4(ip)) - { - // IPv4 - uip = IPToUINT(ip); - net = IPToUINT(&ac->IpAddress); - mask = IPToUINT(&ac->SubnetMask); - - if (ac->Masked == false) - { - if (uip == net) - { - return true; - } - } - else - { - if ((uip & mask) == (net & mask)) - { - return true; - } - } - - return false; - } - else - { - // IPv6 - if (ac->Masked == false) - { - if (CmpIpAddr(ip, &ac->IpAddress) == 0) - { - return true; - } - } - else - { - IP and1, and2; - - IPAnd6(&and1, ip, &ac->SubnetMask); - IPAnd6(&and2, &ac->IpAddress, &ac->SubnetMask); - - if (CmpIpAddr(&and1, &and2) == 0) - { - return true; - } - } - - return false; - } -} - -// Set the AC -void SetAc(LIST *o, UINT id, AC *ac) -{ - // Validate arguments - if (o == NULL || id == 0 || ac == NULL) - { - return; - } - - if (DelAc(o, id)) - { - AddAc(o, ac); - } -} - -// Get the AC -AC *GetAc(LIST *o, UINT id) -{ - UINT i; - // Validate arguments - if (o == NULL || id == 0) - { - return NULL; - } - - for (i = 0;i < LIST_NUM(o);i++) - { - AC *ac = LIST_DATA(o, i); - - if (ac->Id == id) - { - return Clone(ac, sizeof(AC)); - } - } - - return NULL; -} - -// Delete the AC -bool DelAc(LIST *o, UINT id) -{ - UINT i; - // Validate arguments - if (o == NULL || id == 0) - { - return false; - } - - for (i = 0;i < LIST_NUM(o);i++) - { - AC *ac = LIST_DATA(o, i); - - if (ac->Id == id) - { - if (Delete(o, ac)) - { - Free(ac); - - NormalizeAcList(o); - - return true; - } - } - } - - return false; -} - -// Add an AC to the list -void AddAc(LIST *o, AC *ac) -{ - // Validate arguments - if (o == NULL || ac == NULL) - { - return; - } - - if (LIST_NUM(o) < MAX_HUB_ACS) - { - Insert(o, Clone(ac, sizeof(AC))); - - NormalizeAcList(o); - } -} - -// Normalize the AC list -void NormalizeAcList(LIST *o) -{ - UINT i; - // Validate arguments - if (o == NULL) - { - return; - } - - for (i = 0;i < LIST_NUM(o);i++) - { - AC *ac = LIST_DATA(o, i); - - if (IsIP6(&ac->IpAddress)) - { - ac->IpAddress.ipv6_scope_id = 0; - } - - ac->Id = (i + 1); - } -} - -// Create a new AC list -LIST *NewAcList() -{ - return NewList(CmpAc); -} - -// AC comparison -int CmpAc(void *p1, void *p2) -{ - AC *a1, *a2; - if (p1 == NULL || p2 == NULL) - { - return 0; - } - a1 = *(AC **)p1; - a2 = *(AC **)p2; - if (a1 == NULL || a2 == NULL) - { - return 0; - } - if (a1->Priority > a2->Priority) - { - return 1; - } - else if (a1->Priority < a2->Priority) - { - return -1; - } - else if (a1->Deny > a2->Deny) - { - return 1; - } - else if (a1->Deny < a2->Deny) - { - return -1; - } - else - { - return 0; - } -} - -// Copy the CRL -CRL *CopyCrl(CRL *crl) -{ - CRL *ret; - // Validate arguments - if (crl == NULL) - { - return NULL; - } - - ret = ZeroMalloc(sizeof(CRL)); - - if (crl->Serial != NULL) - { - ret->Serial = NewXSerial(crl->Serial->data, crl->Serial->size); - } - - ret->Name = CopyName(crl->Name); - - Copy(ret->DigestMD5, crl->DigestMD5, MD5_SIZE); - Copy(ret->DigestSHA1, crl->DigestSHA1, SHA1_SIZE); - - return ret; -} - -// Release the CRL -void FreeCrl(CRL *crl) -{ - // Validate arguments - if (crl == NULL) - { - return; - } - - if (crl->Serial != NULL) - { - FreeXSerial(crl->Serial); - } - - if (crl->Name != NULL) - { - FreeName(crl->Name); - } - - Free(crl); -} - -// Check whether the certificate has been disabled by searching the CRL list of Virtual HUB -bool IsValidCertInHub(HUB *h, X *x) -{ - bool ret; - // Validate arguments - if (h == NULL || x == NULL) - { - return false; - } - - if (h->HubDb == NULL) - { - return false; - } - - LockList(h->HubDb->CrlList); - { - ret = IsCertMatchCrlList(x, h->HubDb->CrlList); - } - UnlockList(h->HubDb->CrlList); - - if (ret) - { - // This is invalid because it was matched - return false; - } - - // This is valid because it wasn't matched - return true; -} - -// Search whether the certificate matches the CRL list -bool IsCertMatchCrlList(X *x, LIST *o) -{ - UINT i; - // Validate arguments - if (x == NULL || o == NULL) - { - return false; - } - - for (i = 0;i < LIST_NUM(o);i++) - { - CRL *crl = LIST_DATA(o, i); - - if (IsCertMatchCrl(x, crl)) - { - return true; - } - } - - return false; -} - -// Convert the CRL to a string -wchar_t *GenerateCrlStr(CRL *crl) -{ - wchar_t tmp[2048]; - // Validate arguments - if (crl == NULL) - { - return NULL; - } - - UniStrCpy(tmp, sizeof(tmp), L""); - - if (crl->Name != NULL) - { - // Name information - wchar_t name[MAX_SIZE]; - - UniStrCat(tmp, sizeof(tmp), L"Subject=\""); - - GetAllNameFromName(name, sizeof(name), crl->Name); - UniStrCat(tmp, sizeof(tmp), name); - UniStrCat(tmp, sizeof(tmp), L"\", "); - } - - if (crl->Serial != NULL) - { - // Serial information - char str[128]; - wchar_t uni[128]; - - BinToStrEx(str, sizeof(str), crl->Serial->data, crl->Serial->size); - StrToUni(uni, sizeof(uni), str); - UniStrCat(tmp, sizeof(tmp), L"Serial=\""); - UniStrCat(tmp, sizeof(tmp), uni); - UniStrCat(tmp, sizeof(tmp), L"\", "); - } - - if (IsZero(crl->DigestMD5, MD5_SIZE) == false) - { - // MD5 - char str[128]; - wchar_t uni[128]; - - BinToStrEx(str, sizeof(str), crl->DigestMD5, MD5_SIZE); - StrToUni(uni, sizeof(uni), str); - UniStrCat(tmp, sizeof(tmp), L"MD5=\""); - UniStrCat(tmp, sizeof(tmp), uni); - UniStrCat(tmp, sizeof(tmp), L"\", "); - } - - if (IsZero(crl->DigestSHA1, SHA1_SIZE) == false) - { - // MD5 - char str[128]; - wchar_t uni[128]; - - BinToStrEx(str, sizeof(str), crl->DigestSHA1, SHA1_SIZE); - StrToUni(uni, sizeof(uni), str); - UniStrCat(tmp, sizeof(tmp), L"SHA1=\""); - UniStrCat(tmp, sizeof(tmp), uni); - UniStrCat(tmp, sizeof(tmp), L"\", "); - } - - if (UniEndWith(tmp, L", ")) - { - tmp[UniStrLen(tmp) - 2] = 0; - } - - return CopyUniStr(tmp); -} - -// Check whether it matches the Certificate Revocation List entry -bool IsCertMatchCrl(X *x, CRL *crl) -{ - bool b = true; - // Validate arguments - if (x == NULL || crl == NULL) - { - return false; - } - - if (crl->Serial != NULL) - { - // If a serial number is defined in the CRL - if (x->serial == NULL || CompareXSerial(x->serial, crl->Serial) == false) - { - // Serial number mismatch - b = false; - } - } - - if (IsZero(crl->DigestMD5, sizeof(crl->DigestMD5)) == false) - { - UCHAR test[MD5_SIZE]; - // If a DigestMD5 is defined in the CRL - GetXDigest(x, test, false); - - if (Cmp(test, crl->DigestMD5, MD5_SIZE) != 0) - { - b = false; - } - } - - if (IsZero(crl->DigestSHA1, sizeof(crl->DigestSHA1)) == false) - { - UCHAR test[SHA1_SIZE]; - // If a DigestSHA1 is defined in the CRL - GetXDigest(x, test, true); - - if (Cmp(test, crl->DigestSHA1, SHA1_SIZE) != 0) - { - b = false; - } - } - - if (crl->Name != NULL) - { - // If a name is defined in the CRL - NAME *xn, *cn; - xn = x->subject_name; - cn = crl->Name; - - if (cn->CommonName != NULL && (UniIsEmptyStr(cn->CommonName) == false)) - { - if (xn->CommonName == NULL || UniSoftStrCmp(xn->CommonName, cn->CommonName) != 0) - { - // CommonName mismatch - b = false; - } - } - - if (cn->Organization != NULL && (UniIsEmptyStr(cn->Organization) == false)) - { - if (xn->Organization == NULL || UniSoftStrCmp(xn->Organization, cn->Organization) != 0) - { - // Organization mismatch - b = false; - } - } - - if (cn->Unit != NULL && (UniIsEmptyStr(cn->Unit) == false)) - { - if (xn->Unit == NULL || UniSoftStrCmp(xn->Unit, cn->Unit) != 0) - { - // Unit mismatch - b = false; - } - } - - if (cn->Country != NULL && (UniIsEmptyStr(cn->Country) == false)) - { - if (xn->Country == NULL || UniSoftStrCmp(xn->Country, cn->Country) != 0) - { - // Country mismatch - b = false; - } - } - - if (cn->State != NULL && (UniIsEmptyStr(cn->State) == false)) - { - if (xn->State == NULL || UniSoftStrCmp(xn->State, cn->State) != 0) - { - // State mismatch - b = false; - } - } - - if (cn->Local != NULL && (UniIsEmptyStr(cn->Local) == false)) - { - if (xn->Local == NULL || UniSoftStrCmp(xn->Local, cn->Local) != 0) - { - // Local mismatch - b = false; - } - } - } - - return b; -} - -// Get the help string of administration options -wchar_t *GetHubAdminOptionHelpString(char *name) -{ - char tmp[MAX_SIZE]; - wchar_t *ret; - // Validate arguments - if (name == NULL) - { - return L""; - } - - Format(tmp, sizeof(tmp), "HUB_AO_%s", name); - - ret = _UU(tmp); - if (UniIsEmptyStr(ret)) - { - ret = _UU("HUB_AO_UNKNOWN"); - } - - return ret; -} - -// Add the default administration options to the Virtual HUB -void AddHubAdminOptionsDefaults(HUB *h, bool lock) -{ - UINT i; - // Validate arguments - if (h == NULL) - { - return; - } - - if (lock) - { - LockList(h->AdminOptionList); - } - - for (i = 0;i < num_admin_options;i++) - { - ADMIN_OPTION *e = &admin_options[i]; - ADMIN_OPTION t, *r; - - Zero(&t, sizeof(t)); - StrCpy(t.Name, sizeof(t.Name), e->Name); - - r = Search(h->AdminOptionList, &t); - if (r == NULL) - { - ADMIN_OPTION *a = ZeroMalloc(sizeof(ADMIN_OPTION)); - - StrCpy(a->Name, sizeof(a->Name), e->Name); - a->Value = e->Value; - - Insert(h->AdminOptionList, a); - } - } - - if (lock) - { - UnlockList(h->AdminOptionList); - } -} - -// Delete all administration options of Virtual HUB -void DeleteAllHubAdminOption(HUB *h, bool lock) -{ - UINT i; - // Validate arguments - if (h == NULL) - { - return; - } - - if (lock) - { - LockList(h->AdminOptionList); - } - - for (i = 0;i < LIST_NUM(h->AdminOptionList);i++) - { - Free(LIST_DATA(h->AdminOptionList, i)); - } - - DeleteAll(h->AdminOptionList); - - if (lock) - { - UnlockList(h->AdminOptionList); - } -} - -// Get the administration options for the virtual HUB -UINT GetHubAdminOptionEx(HUB *h, char *name, UINT default_value) -{ - UINT ret = default_value; - // Validate arguments - if (h == NULL || name == NULL) - { - return 0; - } - - LockList(h->AdminOptionList); - { - ADMIN_OPTION *a, t; - - Zero(&t, sizeof(t)); - StrCpy(t.Name, sizeof(t.Name), name); - Trim(t.Name); - - a = Search(h->AdminOptionList, &t); - - if (a != NULL) - { - ret = a->Value; - } - } - UnlockList(h->AdminOptionList); - - return ret; -} -UINT GetHubAdminOption(HUB *h, char *name) -{ - return GetHubAdminOptionEx(h, name, 0); -} - -// Administration options -int CompareAdminOption(void *p1, void *p2) -{ - ADMIN_OPTION *a1, *a2; - if (p1 == NULL || p2 == NULL) - { - return 0; - } - a1 = *(ADMIN_OPTION **)p1; - a2 = *(ADMIN_OPTION **)p2; - if (a1 == NULL || a2 == NULL) - { - return 0; - } - return StrCmpi(a1->Name, a2->Name); -} - -// Start the watchdog -void StartHubWatchDog(HUB *h) -{ - THREAD *t; - // Validate arguments - if (h == NULL) - { - return; - } - - h->HaltWatchDog = false; - h->WatchDogEvent = NewEvent(); - - t = NewThread(HubWatchDogThread, h); - WaitThreadInit(t); - ReleaseThread(t); -} - -// Stop the watchdog -void StopHubWatchDog(HUB *h) -{ - // Validate arguments - if (h == NULL) - { - return; - } - - h->HaltWatchDog = true; - Set(h->WatchDogEvent); - - WaitThread(h->WatchDogThread, INFINITE); - ReleaseThread(h->WatchDogThread); - h->WatchDogThread = NULL; - h->HaltWatchDog = false; - - ReleaseEvent(h->WatchDogEvent); - h->WatchDogEvent = NULL; -} - -// Watchdog thread -void HubWatchDogThread(THREAD *t, void *param) -{ - UINT num_packets_v4 = 0; - UINT num_packets_v6 = 0; - HUB *hub; - // Validate arguments - if (t == NULL || param == NULL) - { - return; - } - - hub = (HUB *)param; - - hub->WatchDogThread = t; - AddRef(t->ref); - - NoticeThreadInit(t); - - while (true) - { - LIST *o; - LIST *o2; - UINT i, num; - UINT interval; - UINT wait_time = 100; - if (hub->HaltWatchDog) - { - break; - } - - o = NewListFast(NULL); - o2 = NewListFast(NULL); - - // Send an ARP packet - LockHashList(hub->MacHashTable); - { - num = LIST_NUM(hub->IpTable); - for (i = 0;i < LIST_NUM(hub->IpTable);i++) - { - IP_TABLE_ENTRY *e = LIST_DATA(hub->IpTable, i); - - if (e == NULL) continue; - - if ((e->UpdatedTime + (UINT64)(IP_TABLE_EXPIRE_TIME)) > Tick64()) - { - if (e->MacAddress[0] != 0xff || e->MacAddress[1] != 0xff || e->MacAddress[2] != 0xff || - e->MacAddress[3] != 0xff || e->MacAddress[4] != 0xff || e->MacAddress[5] != 0xff) - { - if (hub->Option != NULL && hub->Option->NoArpPolling == false) - { - if (IsIP4(&e->Ip)) - { - // IPv4 - MAC_HEADER *mac = ZeroMalloc(sizeof(MAC_HEADER) + sizeof(ARPV4_HEADER)); - ARPV4_HEADER *p = (ARPV4_HEADER *)(((UCHAR *)mac) + sizeof(MAC_HEADER)); - - Copy(mac->DestAddress, e->MacAddress, 6); - Copy(mac->SrcAddress, hub->HubMacAddr, 6); - mac->Protocol = Endian16(MAC_PROTO_ARPV4); - - p->HardwareType = Endian16(ARP_HARDWARE_TYPE_ETHERNET); - p->ProtocolType = Endian16(MAC_PROTO_IPV4); - p->HardwareSize = 6; - p->ProtocolSize = 4; - p->Operation = Endian16(ARP_OPERATION_REQUEST); - Copy(p->SrcAddress, hub->HubMacAddr, 6); - p->SrcIP = IPToUINT(&hub->HubIp); - p->TargetAddress[0] = - p->TargetAddress[1] = - p->TargetAddress[2] = - p->TargetAddress[3] = - p->TargetAddress[4] = - p->TargetAddress[5] = 0x00; - p->TargetIP = IPToUINT(&e->Ip); - Insert(o, mac); - } - } - - if (hub->Option != NULL && hub->Option->NoIPv6AddrPolling == false) - { - if (IsIP6(&e->Ip)) - { - // IPv6 - BUF *buf; - IPV6_ADDR ip6addr; - - if (IPToIPv6Addr(&ip6addr, &e->Ip)) - { - buf = BuildICMPv6NeighborSoliciation(&hub->HubIpV6, - &ip6addr, - hub->HubMacAddr, ++hub->HubIP6Id); - - if (buf != NULL) - { - BUF *buf2 = NewBuf(); - MAC_HEADER mac; - - Zero(&mac, sizeof(mac)); - - Copy(mac.DestAddress, e->MacAddress, 6); - Copy(mac.SrcAddress, hub->HubMacAddr, 6); - mac.Protocol = Endian16(MAC_PROTO_IPV6); - - WriteBuf(buf2, &mac, sizeof(MAC_HEADER)); - - WriteBuf(buf2, buf->Buf, buf->Size); - - FreeBuf(buf); - - Insert(o2, buf2); - } - } - } - } - } - } - } - } - UnlockHashList(hub->MacHashTable); - - if ((LIST_NUM(o) + LIST_NUM(o2)) != 0) - { - interval = HUB_ARP_SEND_INTERVAL / (LIST_NUM(o) + LIST_NUM(o2)); - } - else - { - interval = HUB_ARP_SEND_INTERVAL; - } - - for (i = 0;i < LIST_NUM(o);i++) - { - PKT *packet; - void *p = LIST_DATA(o, i); - - Wait(hub->WatchDogEvent, interval); - if (hub->HaltWatchDog) - { - for (;i < LIST_NUM(o);i++) - { - Free(LIST_DATA(o, i)); - } - ReleaseList(o); - - for (i = 0;i < LIST_NUM(o2);i++) - { - FreeBuf(LIST_DATA(o2, i)); - } - ReleaseList(o2); - goto ESCAPE; - } - - packet = ParsePacket((UCHAR *)p, sizeof(MAC_HEADER) + sizeof(ARPV4_HEADER)); - if (packet != NULL) - { - StorePacket(hub, NULL, packet); - num_packets_v4++; - } - else - { - Free(p); - } - } - - for (i = 0;i < LIST_NUM(o2);i++) - { - PKT *packet; - BUF *buf = LIST_DATA(o2, i); - - Wait(hub->WatchDogEvent, interval); - if (hub->HaltWatchDog) - { - ReleaseList(o); - - for (;i < LIST_NUM(o2);i++) - { - FreeBuf(LIST_DATA(o2, i)); - } - ReleaseList(o2); - goto ESCAPE; - } - - packet = ParsePacket(buf->Buf, buf->Size); - if (packet != NULL) - { - StorePacket(hub, NULL, packet); - num_packets_v6++; - } - else - { - Free(buf->Buf); - } - - Free(buf); - } - - ReleaseList(o); - ReleaseList(o2); - - if (num == 0) - { - wait_time = HUB_ARP_SEND_INTERVAL; - } - - Wait(hub->WatchDogEvent, wait_time); - } -ESCAPE: - return; -} - -// Enable / disable the SecureNAT -void EnableSecureNAT(HUB *h, bool enable) -{ - EnableSecureNATEx(h, enable, false); -} -void EnableSecureNATEx(HUB *h, bool enable, bool no_change) -{ - bool for_cluster = false; - // Validate arguments - if (h == NULL) - { - return; - } - - if (h->Cedar->Server != NULL && h->Cedar->Server->ServerType == SERVER_TYPE_FARM_CONTROLLER) - { - if (h->Type == HUB_TYPE_FARM_DYNAMIC) - { - for_cluster = true; - } - } - - Lock(h->lock_online); - { - if (no_change == false) - { - h->EnableSecureNAT = enable; - } - - if (h->EnableSecureNAT == false) - { -STOP: - // Stop if it's already started - if (h->SecureNAT != NULL) - { - SnFreeSecureNAT(h->SecureNAT); - h->SecureNAT = NULL; - } - } - else - { - if (for_cluster) - { - if ((h->SecureNAT != NULL && LIST_NUM(h->SessionList) <= 1) || - (h->SecureNAT == NULL && LIST_NUM(h->SessionList) == 0)) - { - // It is in a start mode, but stop when there is no other sessions - // in the case of dynamic Virtual HUB - goto STOP; - } - } - - // Start if the HUB is online and not started - if (h->SecureNAT == NULL && h->Offline == false) - { - h->SecureNAT = SnNewSecureNAT(h, h->SecureNATOption); - } - } - } - Unlock(h->lock_online); -} - -// Convert an access list to a string -void GetAccessListStr(char *str, UINT size, ACCESS *a) -{ - char tmp[MAX_SIZE]; - char tmp1[MAX_SIZE]; - char tmp2[MAX_SIZE]; - bool l3 = false; - bool asterisk = false; - // Validate arguments - if (str == NULL || a == NULL) - { - return; - } - - StrCpy(str, size, ""); - - if (a->IsIPv6 == false) - { - if (a->SrcIpAddress != 0 || a->SrcSubnetMask != 0) - { - IPToStr32(tmp1, sizeof(tmp1), a->SrcIpAddress); - MaskToStr32(tmp2, sizeof(tmp2), a->SrcSubnetMask); - Format(tmp, sizeof(tmp), "SrcIPv4=%s/%s, ", tmp1, tmp2); - StrCat(str, size, tmp); - - l3 = true; - } - - if (a->DestIpAddress != 0 || a->DestSubnetMask != 0) - { - IPToStr32(tmp1, sizeof(tmp1), a->DestIpAddress); - MaskToStr32(tmp2, sizeof(tmp2), a->DestSubnetMask); - Format(tmp, sizeof(tmp), "DstIPv4=%s/%s, ", tmp1, tmp2); - StrCat(str, size, tmp); - - l3 = true; - } - } - else - { - if (IsZeroIP6Addr(&a->SrcIpAddress6) == false || IsZeroIP6Addr(&a->SrcSubnetMask6) == false) - { - IP6AddrToStr(tmp1, sizeof(tmp1), &a->SrcIpAddress6); - Mask6AddrToStr(tmp2, sizeof(tmp2), &a->SrcSubnetMask6); - Format(tmp, sizeof(tmp), "SrcIPv6=%s/%s, ", tmp1, tmp2); - StrCat(str, size, tmp); - - l3 = true; - } - - if (IsZeroIP6Addr(&a->DestIpAddress6) == false || IsZeroIP6Addr(&a->DestSubnetMask6) == false) - { - IP6AddrToStr(tmp1, sizeof(tmp1), &a->DestIpAddress6); - Mask6AddrToStr(tmp2, sizeof(tmp2), &a->DestSubnetMask6); - Format(tmp, sizeof(tmp), "DstIPv6=%s/%s, ", tmp1, tmp2); - StrCat(str, size, tmp); - - l3 = true; - } - } - - if (a->Protocol != 0) - { - StrCpy(tmp1, sizeof(tmp1), ""); - switch (a->Protocol) - { - case 1: - StrCpy(tmp1, sizeof(tmp1), "ICMPv4"); - break; - case 3: - StrCpy(tmp1, sizeof(tmp1), "GGP"); - break; - case 6: - StrCpy(tmp1, sizeof(tmp1), "TCP"); - break; - case 8: - StrCpy(tmp1, sizeof(tmp1), "EGP"); - break; - case 12: - StrCpy(tmp1, sizeof(tmp1), "PUP"); - break; - case 17: - StrCpy(tmp1, sizeof(tmp1), "UDP"); - break; - case 20: - StrCpy(tmp1, sizeof(tmp1), "HMP"); - break; - case 22: - StrCpy(tmp1, sizeof(tmp1), "XNS-IDP"); - break; - case 27: - StrCpy(tmp1, sizeof(tmp1), "RDP"); - break; - case 58: - StrCpy(tmp1, sizeof(tmp1), "ICMPv6"); - break; - case 66: - StrCpy(tmp1, sizeof(tmp1), "RVD"); - break; - } - - if (IsEmptyStr(tmp1)) - { - Format(tmp, sizeof(tmp), "Protocol=%s(%u), ", tmp1, a->Protocol); - } - else - { - Format(tmp, sizeof(tmp), "Protocol=%s, ", tmp1); - } - - StrCat(str, size, tmp); - - l3 = true; - } - - if (a->SrcPortStart != 0) - { - if (a->SrcPortEnd == a->SrcPortStart) - { - Format(tmp, sizeof(tmp), "SrcPort=%u, ", a->SrcPortStart); - StrCat(str, size, tmp); - } - else - { - Format(tmp, sizeof(tmp), "SrcPort=%u-%u, ", a->SrcPortStart, a->SrcPortEnd); - StrCat(str, size, tmp); - } - - l3 = true; - } - - if (a->DestPortStart != 0) - { - if (a->DestPortEnd == a->DestPortStart) - { - Format(tmp, sizeof(tmp), "DstPort=%u, ", a->DestPortStart); - StrCat(str, size, tmp); - } - else - { - Format(tmp, sizeof(tmp), "DstPort=%u-%u, ", a->DestPortStart, a->DestPortEnd); - StrCat(str, size, tmp); - } - - l3 = true; - } - - if (StrLen(a->SrcUsername) != 0) - { - Format(tmp, sizeof(tmp), "SrcUser=%s, ", a->SrcUsername); - StrCat(str, size, tmp); - } - - if (StrLen(a->DestUsername) != 0) - { - Format(tmp, sizeof(tmp), "DstUser=%s, ", a->DestUsername); - StrCat(str, size, tmp); - } - - if (a->CheckSrcMac != false) - { - char mac[MAX_SIZE], mask[MAX_SIZE]; - MacToStr(mac, sizeof(mac), a->SrcMacAddress); - MacToStr(mask, sizeof(mask), a->SrcMacMask); - Format(tmp, sizeof(tmp), "SrcMac=%s/%s, ", mac, mask); - StrCat(str, size, tmp); - } - if (a->CheckDstMac != false) - { - char mac[MAX_SIZE], mask[MAX_SIZE]; - MacToStr(mac, sizeof(mac), a->DstMacAddress); - MacToStr(mask, sizeof(mask), a->DstMacMask); - Format(tmp, sizeof(tmp), "DstMac=%s/%s, ", mac, mask); - StrCat(str, size, tmp); - } - - if (a->CheckTcpState) - { - if(a->Established) - { - StrCat(str, size, "Established, "); - } - else - { - StrCat(str, size, "Unestablished, "); - } - - l3 = true; - } - - if (a->Discard == false) - { - if (a->Delay >= 1) - { - Format(tmp, sizeof(tmp), "Delay=%u, ", a->Delay); - StrCat(str, size, tmp); - } - - if (a->Jitter >= 1) - { - Format(tmp, sizeof(tmp), "Jitter=%u, ", a->Jitter); - StrCat(str, size, tmp); - } - - if (a->Loss >= 1) - { - Format(tmp, sizeof(tmp), "Loss=%u, " , a->Loss); - StrCat(str, size, tmp); - } - } - - if (IsEmptyStr(a->RedirectUrl) == false) - { - Format(tmp, sizeof(tmp), "RedirectUrl=%s, ", a->RedirectUrl); - StrCat(str, size, tmp); - } - - if (StrLen(str) == 0) - { - asterisk = true; - } - - if (l3) - { - if (a->IsIPv6) - { - StrCatLeft(str, size, "(ipv6) "); - } - else - { - StrCatLeft(str, size, "(ipv4) "); - } - } - else - { - StrCatLeft(str, size, "(ether) "); - } - - if (EndWith(str, ", ")) - { - str[StrLen(str) - 2] = 0; - } - - if (asterisk) - { - StrCat(str, size, "*"); - } -} - -// Determine whether the access list can mask the packet -bool IsPacketMaskedByAccessList(SESSION *s, PKT *p, ACCESS *a, UINT64 dest_username, UINT64 dest_groupname, SESSION *dest_session) -{ - UINT64 src_username; - UINT64 src_username_simple; - UINT64 src_groupname; - HUB_PA *pa; - IPV4_HEADER *ip = NULL; - IPV6_HEADER *ip6 = NULL; - bool is_ipv4_packet = false; - bool is_ipv6_packet = false; - bool is_arp_packet = false; - // Validate arguments - if (s == NULL || p == NULL || a == NULL) - { - return false; - } - if (a->Active == false) - { - // Access list is inactive - return false; - } - - pa = (HUB_PA *)s->PacketAdapter->Param; - - // Hash of the source user name - src_username = pa->UsernameHash; - src_username_simple = pa->UsernameHashSimple; - src_groupname = pa->GroupnameHash; - - // Determine the source and destination MAC address - if (a->CheckSrcMac != false) - { - UINT i; - for (i = 0; i < 6; i++) - { - if((a->SrcMacAddress[i] & a->SrcMacMask[i]) != (a->SrcMacMask[i] & p->MacAddressSrc[i])) - { - return false; - } - } - } - - if (a->CheckDstMac != false) - { - UINT i; - for (i = 0; i < 6; i++) - { - if ((a->DstMacAddress[i] & a->DstMacMask[i]) != (a->DstMacMask[i] & p->MacAddressDest[i])) - { - return false; - } - } - } - - // Check the source user name / group name - if (a->SrcUsernameHash != 0) - { - if (a->IsSrcUsernameIncludeOrExclude == false) - { - // It is specified as a regular user name - if ((a->SrcUsernameHash != src_username) && (a->SrcUsernameHash != src_groupname)) - { - return false; - } - } - else - { - // It is specified in the form of a exclude:FILENAME or include:FILENAME - HUB *hub = s->Hub; - - if (hub != NULL) - { - LIST *o = hub->UserList; - - if (s->NormalClient == false) - { - // The internal session don't become target for format exclude: or include: - return false; - } - - if (IsUserMatchInUserListWithCacheExpiresAcl(o, a->SrcUsername, src_username, - hub->Option->AccessListIncludeFileCacheLifetime * 1000) == false) - { - return false; - } - } - } - } - - // Check the destination user name / group name - if (a->DestUsernameHash != 0) - { - if (a->IsDestUsernameIncludeOrExclude == false) - { - // It is specified as a regular user name - if ((a->DestUsernameHash != dest_username) && (a->DestUsernameHash != dest_groupname)) - { - return false; - } - } - else - { - // It is specified in the form of a exclude:FILENAME or include:FILENAME - HUB *hub = s->Hub; - - if (hub != NULL) - { - LIST *o = hub->UserList; - - if (dest_session != NULL && dest_session->NormalClient == false) - { - // The internal session don't become target for format exclude: or include: - return false; - } - - if (IsUserMatchInUserListWithCacheExpiresAcl(o, a->DestUsername, dest_username, - hub->Option->AccessListIncludeFileCacheLifetime * 1000) == false) - { - return false; - } - } - } - } - - // Determine of the IP packet - if (p->TypeL3 != L3_IPV4) - { - is_ipv4_packet = false; - } - else - { - is_ipv4_packet = true; - } - - if (p->TypeL3 != L3_IPV6) - { - is_ipv6_packet = false; - } - else - { - is_ipv6_packet = true; - } - - if (p->TypeL3 == L3_ARPV4) - { - is_arp_packet = true; - } - - if (is_ipv4_packet) - { - ip = p->L3.IPv4Header; - } - - if (is_ipv6_packet) - { - ip6 = p->L3.IPv6Header; - } - - if (a->IsIPv6 == false) - { - // IPv4 - - // Check the source IP address - if (a->SrcIpAddress != 0 || a->SrcSubnetMask != 0) - { - if (is_ipv4_packet == false) - { - if (p->TypeL3 == L3_ARPV4) - { - bool arp_match = false; - if (p->L3.ARPv4Header->HardwareSize == 6 && - Endian16(p->L3.ARPv4Header->HardwareType) == ARP_HARDWARE_TYPE_ETHERNET && - p->L3.ARPv4Header->ProtocolSize == 4 && - Endian16(p->L3.ARPv4Header->ProtocolType) == 0x0800) - { - UINT uint_ip = p->L3.ARPv4Header->SrcIP; - - if (uint_ip != 0 && uint_ip != 0xffffffff && !(IsHubIpAddress32(uint_ip) && IsHubMacAddress(p->MacAddressSrc))) - { - if ((uint_ip & a->SrcSubnetMask) != (a->SrcIpAddress & a->SrcSubnetMask)) - { - } - else - { - arp_match = true; - } - } - } - - if (arp_match == false) - { - return false; - } - } - else - { - return false; - } - } - else - { - if ((ip->SrcIP & a->SrcSubnetMask) != (a->SrcIpAddress & a->SrcSubnetMask)) - { - return false; - } - } - } - - // Check the destination IP address - if (a->DestIpAddress != 0 || a->DestSubnetMask != 0) - { - if (is_ipv4_packet == false) - { - if (p->TypeL3 == L3_ARPV4) - { - bool arp_match = false; - if (p->L3.ARPv4Header->HardwareSize == 6 && - Endian16(p->L3.ARPv4Header->HardwareType) == ARP_HARDWARE_TYPE_ETHERNET && - p->L3.ARPv4Header->ProtocolSize == 4 && - Endian16(p->L3.ARPv4Header->ProtocolType) == 0x0800) - { - UINT uint_ip = p->L3.ARPv4Header->TargetIP; - - if (uint_ip != 0 && uint_ip != 0xffffffff && !(IsHubIpAddress32(uint_ip) && IsHubMacAddress(p->MacAddressSrc))) - { - if ((uint_ip & a->DestSubnetMask) != (a->DestIpAddress & a->DestSubnetMask)) - { - } - else - { - arp_match = true; - } - } - } - - if (arp_match == false) - { - return false; - } - } - else - { - return false; - } - } - else - { - if ((ip->DstIP & a->DestSubnetMask) != (a->DestIpAddress & a->DestSubnetMask)) - { - return false; - } - } - } - } - else - { - // IPv6 - - // Check the source IP address - if (IsZeroIP6Addr(&a->SrcIpAddress6) == false || - IsZeroIP6Addr(&a->SrcSubnetMask6) == false) - { - if (is_ipv6_packet == false) - { - return false; - } - else - { - IP a_ip, a_subnet, p_ip; - IP and1, and2; - - IPv6AddrToIP(&a_ip, &a->SrcIpAddress6); - IPv6AddrToIP(&a_subnet, &a->SrcSubnetMask6); - IPv6AddrToIP(&p_ip, &ip6->SrcAddress); - - IPAnd6(&and1, &a_ip, &a_subnet); - IPAnd6(&and2, &p_ip, &a_subnet); - - if (CmpIpAddr(&and1, &and2) != 0) - { - return false; - } - } - } - - // Check the destination IP address - if (IsZeroIP6Addr(&a->DestIpAddress6) == false || - IsZeroIP6Addr(&a->DestSubnetMask6) == false) - { - if (is_ipv6_packet == false) - { - return false; - } - else - { - IP a_ip, a_subnet, p_ip; - IP and1, and2; - - IPv6AddrToIP(&a_ip, &a->DestIpAddress6); - IPv6AddrToIP(&a_subnet, &a->DestSubnetMask6); - IPv6AddrToIP(&p_ip, &ip6->DestAddress); - - IPAnd6(&and1, &a_ip, &a_subnet); - IPAnd6(&and2, &p_ip, &a_subnet); - - if (CmpIpAddr(&and1, &and2) != 0) - { - return false; - } - } - } - } - - // Don't match the packet of non-IPv4 and non-IPv6 - if (is_arp_packet) - { - if (s->Hub != NULL && s->Hub->Option != NULL && s->Hub->Option->ApplyIPv4AccessListOnArpPacket) - { - // Match the ARP only if ApplyIPv4AccessListOnArpPacket option is enabled - } - else - { - return false; - } - } - - // Check the protocol number - if (a->Protocol != 0) - { - if (a->IsIPv6 == false) - { - if (is_ipv4_packet == false) - { - return false; - } - else - { - if (ip->Protocol != a->Protocol) - { - return false; - } - } - } - else - { - if (is_ipv6_packet == false) - { - return false; - } - else - { - if (p->IPv6HeaderPacketInfo.Protocol != a->Protocol) - { - return false; - } - } - } - } - - // Check the port number - if (a->SrcPortStart != 0 || a->DestPortStart != 0 || - a->SrcPortEnd != 0 || a->DestPortEnd != 0) - { - if ((a->IsIPv6 == false && is_ipv4_packet == false) || - (a->IsIPv6 && is_ipv6_packet == false)) - { - return false; - } - else - { - if (p->TypeL4 == L4_TCP) - { - TCP_HEADER *tcp = p->L4.TCPHeader; - // Check the source port - if (a->SrcPortStart != 0 || a->SrcPortEnd != 0) - { - UINT src_port = Endian16(tcp->SrcPort); - if (src_port < a->SrcPortStart || src_port > a->SrcPortEnd) - { - return false; - } - } - - // Check the destination port number - if (a->DestPortStart != 0 || a->DestPortEnd != 0) - { - UINT dest_port = Endian16(tcp->DstPort); - if (dest_port < a->DestPortStart || dest_port > a->DestPortEnd) - { - return false; - } - } - } - else if (p->TypeL4 == L4_UDP) - { - UDP_HEADER *udp = p->L4.UDPHeader; - // Check the source port - if (a->SrcPortStart != 0 || a->SrcPortEnd != 0) - { - UINT src_port = Endian16(udp->SrcPort); - if (src_port < a->SrcPortStart || src_port > a->SrcPortEnd) - { - return false; - } - } - - // Check the destination port number - if (a->DestPortStart != 0 || a->DestPortEnd != 0) - { - UINT dest_port = Endian16(udp->DstPort); - if (dest_port < a->DestPortStart || dest_port > a->DestPortEnd) - { - return false; - } - } - } - else - { - // When the port number is specified in the access list, - // The rule is applied only for UDP or TCP packets - return false; - } - } - } - - // Check the status of the TCP connection - if (a->CheckTcpState != false) - { - if ((a->IsIPv6 == false && is_ipv4_packet == false) || - (a->IsIPv6 && is_ipv6_packet == false)) - { - return false; - } - else - { - if(p->TypeL4 == L4_TCP) - { - // by shimizu - TCP_HEADER *tcp = p->L4.TCPHeader; - bool est = true; - - if ((tcp->Flag & TCP_SYN) && (!(tcp->Flag & TCP_ACK))) - { - est = false; - } - - if((MAKEBOOL(a->Established) ^ MAKEBOOL(est))) - { - return false; - } - } - else - { - return false; - } - } - } - - return true; -} - -// Apply the access list for packets to forward -bool ApplyAccessListToForwardPacket(HUB *hub, SESSION *src_session, SESSION *dest_session, PKT *p) -{ - UINT i; - bool pass = true; // Pass by default - bool skip = true; - // Validate arguments - if (hub == NULL || src_session == NULL || p == NULL || dest_session == NULL) - { - return false; - } - - // The access list is not re-applied for packets that have been already checked - if (p->AccessChecked) - { - return true; - } - - LockList(hub->AccessList); - { - for (i = 0;i < LIST_NUM(hub->AccessList);i++) - { - ACCESS *a = LIST_DATA(hub->AccessList, i); - - // Scan the entry only after the destination user name is specified. - if (a->DestUsernameHash != 0) - { - skip = false; - } - - if (skip == false) - { - if (IsPacketMaskedByAccessList(src_session, p, a, - ((HUB_PA *)dest_session->PacketAdapter->Param)->UsernameHash, - ((HUB_PA *)dest_session->PacketAdapter->Param)->GroupnameHash, - dest_session)) - { - // Determine the pass or discard the packet - pass = a->Discard ? false : true; - - // Complete the scanning of the list here - break; - } - } - } - } - UnlockList(hub->AccessList); - - return pass; -} - -// Generate a HTTP payload for redirect -BUF *BuildRedirectToUrlPayload(HUB *hub, SESSION *s, char *redirect_url) -{ - char html[MAX_REDIRECT_URL_LEN * 2 + 1 + MAX_SIZE]; - char header[MAX_REDIRECT_URL_LEN * 2 + 1 + MAX_SIZE]; - char redirect_url2[MAX_REDIRECT_URL_LEN * 2]; - BUF *b; - // Validate arguments - if (hub == NULL || s == NULL || redirect_url == NULL) - { - return NULL; - } - - StrCpy(redirect_url2, sizeof(redirect_url2), redirect_url); - Trim(redirect_url2); - - if (InStr(redirect_url2, ACCESS_LIST_URL_INFO_TAG)) - { - // Get the secret key string - char secret[MAX_SIZE]; - char tmp[MAX_SIZE]; - SYSTEMTIME st; - UINT i, len, isp; - - isp = INFINITE; - - SystemTime(&st); - ClearStr(secret, sizeof(secret)); - - len = StrLen(redirect_url2); - - for (i = 0;i < len;i++) - { - char c = redirect_url2[i]; - if (c == '|') - { - isp = i; - } - } - - if (isp != INFINITE) - { - StrCpy(secret, sizeof(secret), redirect_url2 + isp + 1); - redirect_url2[isp] = 0; - } - - Format(tmp, sizeof(tmp), "%s|%s|%r|%04u%02u%02u%02u%02u%02u%s", - s->Username, s->Name, &s->Connection->ClientIp, - st.wYear, st.wMonth, st.wDay, st.wHour, st.wMinute, st.wSecond, (IsEmptyStr(secret) ? "" : "|")); - - if (IsEmptyStr(secret) == false) - { - // Calculate the hash - UCHAR hash[SHA1_SIZE]; - char hash_str[MAX_SIZE]; - BUF *b2 = NewBuf(); - - WriteBuf(b2, tmp, StrLen(tmp)); - WriteBuf(b2, secret, StrLen(secret)); - - Sha1(hash, b2->Buf, b2->Size); - - BinToStr(hash_str, sizeof(hash_str), hash, sizeof(hash)); - - FreeBuf(b2); - - StrCat(tmp, sizeof(tmp), hash_str); - - // Replace - ReplaceStrEx(redirect_url2, sizeof(redirect_url2), redirect_url2, - ACCESS_LIST_URL_INFO_TAG, tmp, false); - } - } - - Format(html, sizeof(html), - "Object moved\r\n

Object moved to here.

\r\n\r\n\r\n", - redirect_url2); - - Format(header, sizeof(header), - "HTTP/1.1 302 Found\r\nLocation: %s\r\nCache-Control: private\r\nContent-Type: text/html; charset=utf-8\r\nContent-Length: %u\r\n\r\n", - redirect_url2, StrLen(redirect_url2)); - - b = NewBuf(); - - WriteBuf(b, header, StrLen(header)); - WriteBuf(b, html, StrLen(html)); - - return b; -} - -// Rpely a TCP response packet to redirect forcibly to the specified URL -void ForceRedirectToUrl(HUB *hub, SESSION *src_session, PKT *p, char *redirect_url) -{ - BUF *payload; - UINT tcp_size; - TCP_HEADER *tcp_data; - TCP_HEADER *src_tcp; - BUF *b; - // Validate arguments - if (hub == NULL || src_session == NULL || p == NULL || redirect_url == NULL) - { - return; - } - if (p->TypeL3 != L3_IPV4 && p->TypeL3 != L3_IPV6) - { - return; - } - if (p->TypeL4 != L4_TCP) - { - return; - } - - src_tcp = p->L4.TCPHeader; - if (src_tcp == NULL) - { - return; - } - - // Generate a payload to be sent - payload = BuildRedirectToUrlPayload(hub, src_session, redirect_url); - if (payload == NULL) - { - return; - } - - // Generate a TCP packet - tcp_size = sizeof(TCP_HEADER) + payload->Size; - tcp_data = (TCP_HEADER *)ZeroMalloc(tcp_size); - tcp_data->SrcPort = src_tcp->DstPort; - tcp_data->DstPort = src_tcp->SrcPort; - tcp_data->SeqNumber = src_tcp->AckNumber; - tcp_data->AckNumber = Endian32(Endian32(src_tcp->SeqNumber) + p->PayloadSize); - TCP_SET_HEADER_SIZE(tcp_data, 5); - tcp_data->Flag = TCP_ACK | TCP_PSH; - tcp_data->WindowSize = Endian16(0xFFFF); - Copy(((UCHAR *)tcp_data) + sizeof(TCP_HEADER), payload->Buf, payload->Size); - - // Calculate the TCP checksum - if (p->TypeL3 == L3_IPV4) - { - // IPv4 - tcp_data->Checksum = CalcChecksumForIPv4(p->L3.IPv4Header->DstIP, p->L3.IPv4Header->SrcIP, IP_PROTO_TCP, - tcp_data, tcp_size, 0); - } - else - { - // IPv6 - tcp_data->Checksum = CalcChecksumForIPv6(&p->IPv6HeaderPacketInfo.IPv6Header->DestAddress, - &p->IPv6HeaderPacketInfo.IPv6Header->SrcAddress, IP_PROTO_TCP, tcp_data, tcp_size, 0); - } - - // Generate the Ethernet and IP packet - b = NewBuf(); - - // Destination MAC address - WriteBuf(b, p->MacHeader->SrcAddress, 6); - WriteBuf(b, p->MacHeader->DestAddress, 6); - WriteBuf(b, &p->MacHeader->Protocol, 2); - - if (p->TypeL3 == L3_IPV4) - { - // IPv4 - IPV4_HEADER v4; - - Zero(&v4, sizeof(v4)); - - IPV4_SET_VERSION(&v4, 4); - IPV4_SET_HEADER_LEN(&v4, 5); - v4.TotalLength = Endian16((USHORT)(sizeof(IPV4_HEADER) + tcp_size)); - v4.Identification = Endian16(Rand16()); - IPV4_SET_FLAGS(&v4, 0x02); - v4.TimeToLive = 128; - v4.Protocol = IP_PROTO_TCP; - v4.SrcIP = p->L3.IPv4Header->DstIP; - v4.DstIP = p->L3.IPv4Header->SrcIP; - v4.Checksum = IpChecksum(&v4, sizeof(v4)); - - WriteBuf(b, &v4, sizeof(v4)); - } - else - { - // IPv6 - IPV6_HEADER v6; - - Zero(&v6, sizeof(v6)); - - IPV6_SET_VERSION(&v6, 6); - v6.PayloadLength = Endian16(tcp_size); - v6.NextHeader = IP_PROTO_TCP; - v6.HopLimit = 64; - - Copy(&v6.SrcAddress, &p->IPv6HeaderPacketInfo.IPv6Header->DestAddress, sizeof(IPV6_ADDR)); - Copy(&v6.DestAddress, &p->IPv6HeaderPacketInfo.IPv6Header->SrcAddress, sizeof(IPV6_ADDR)); - - WriteBuf(b, &v6, sizeof(v6)); - } - - WriteBuf(b, tcp_data, tcp_size); - - // Reply packet - StorePacketToHubPa((HUB_PA *)src_session->PacketAdapter->Param, - NULL, b->Buf, b->Size, NULL, false, false); - - // Release the memory - Free(tcp_data); - FreeBuf(payload); - Free(b); -} - -// Apply the access list for packets stored -bool ApplyAccessListToStoredPacket(HUB *hub, SESSION *s, PKT *p) -{ - UINT i; - bool pass = true; // Pass by default - bool use_redirect_url = false; - char redirect_url[MAX_REDIRECT_URL_LEN + 1]; - // Validate arguments - if (hub == NULL || s == NULL || p == NULL) - { - return false; - } - - if (hub->Option != NULL && hub->Option->FilterPPPoE) - { - if (p->MacHeader != NULL) - { - USHORT proto = Endian16(p->MacHeader->Protocol); - if (proto == 0x8863 || proto == 0x8864) - { - // PPPoE Filter - return false; - } - } - } - - if (hub->Option != NULL && hub->Option->FilterOSPF) - { - if (p->TypeL3 == L3_IPV4) - { - if (p->L3.IPv4Header != NULL) - { - if (p->L3.IPv4Header->Protocol == 89) - { - // OSPF Filter - return false; - } - } - } - } - - if (hub->Option != NULL && hub->Option->FilterIPv4) - { - if (p->MacHeader != NULL) - { - USHORT proto = Endian16(p->MacHeader->Protocol); - if (proto == 0x0800 || proto == 0x0806) - { - // IPv4 Filter - return false; - } - } - } - - if (hub->Option != NULL && hub->Option->FilterIPv6) - { - if (p->MacHeader != NULL) - { - USHORT proto = Endian16(p->MacHeader->Protocol); - if (proto == 0x86dd) - { - // IPv6 Filter - return false; - } - } - } - - if (hub->Option != NULL && hub->Option->FilterNonIP) - { - if (p->MacHeader != NULL) - { - USHORT proto = Endian16(p->MacHeader->Protocol); - if (!(proto == 0x86dd || proto == 0x0800 || proto == 0x0806)) - { - // Non-IP Filter - return false; - } - } - } - - if (hub->Option != NULL && hub->Option->FilterBPDU) - { - if (p->MacHeader != NULL) - { - if (p->TypeL3 == L3_BPDU) - { - // BPDU Filter - return false; - } - } - } - - LockList(hub->AccessList); - { - for (i = 0;i < LIST_NUM(hub->AccessList);i++) - { - ACCESS *a = LIST_DATA(hub->AccessList, i); - - if (a->DestUsernameHash != 0) - { - // If a destination user name is specified, suspend the scanning of the list. - break; - } - - if (IsPacketMaskedByAccessList(s, p, a, 0, 0, NULL)) - { - // Determine the pass or discard the packet - pass = a->Discard ? false : true; - - // Packets determined processing here is not scanned when leaving the HUB. - p->AccessChecked = true; - - // Copy of the parameters of the delay jitter packet loss - p->Delay = a->Delay; - p->Jitter = a->Jitter; - p->Loss = a->Loss; - - if (a->RedirectUrl[0] != 0) - { - // There is a setting of URL redirection in the access list - if ((p->TypeL3 == L3_IPV4 || p->TypeL3 == L3_IPV6) && - p->TypeL4 == L4_TCP) - { - TCP_HEADER *tcp = p->L4.TCPHeader; - - // Examine whether this packet is a TCP data packet - if (tcp != NULL) - { - if (tcp->Flag & TCP_ACK) - { - if ((tcp->Flag & TCP_SYN) == 0 && - (tcp->Flag & TCP_RST) == 0 && - (tcp->Flag & TCP_URG) == 0) - { - if (p->PayloadSize != 0) - { - // Do URL redirection - use_redirect_url = true; - StrCpy(redirect_url, sizeof(redirect_url), a->RedirectUrl); - } - } - } - } - } - } - - // Complete the scanning of the list here - break; - } - } - } - UnlockList(hub->AccessList); - - if (pass) - { - if (s->FirstTimeHttpRedirect && s->FirstTimeHttpAccessCheckIp != 0) - { - if ((p->TypeL3 == L3_IPV4 || p->TypeL3 == L3_IPV6) && - p->TypeL4 == L4_TCP) - { - TCP_HEADER *tcp = p->L4.TCPHeader; - - // Examine whether this packet is a TCP data packet - if (tcp != NULL) - { - if (tcp->DstPort == Endian16(80)) - { - if (p->L3.IPv4Header->DstIP == s->FirstTimeHttpAccessCheckIp) - { - s->FirstTimeHttpRedirect = false; - } - else if (tcp->Flag & TCP_ACK) - { - if ((tcp->Flag & TCP_SYN) == 0 && - (tcp->Flag & TCP_RST) == 0 && - (tcp->Flag & TCP_URG) == 0) - { - if (p->PayloadSize != 0) - { - if (IsTcpPacketNcsiHttpAccess(p) == false) - { -/* char tmp[4000]; - Zero(tmp, sizeof(tmp)); - Copy(tmp, p->Payload, p->PayloadSize); - Debug("HTTP: %s\n", tmp);*/ - if (IsEmptyStr(s->FirstTimeHttpRedirectUrl) == false) - { - use_redirect_url = true; - StrCpy(redirect_url, sizeof(redirect_url), s->FirstTimeHttpRedirectUrl); - } - } - } - } - } - } - } - } - } - } - - if (use_redirect_url) - { - if (s->NormalClient) - { - // In the case of a normal VPN client (Not a local bridge, a SecureNAT, and not a virtual L3 switch), - // process URL redirection and discard the packet - ForceRedirectToUrl(hub, s, p, redirect_url); - } - else - { - // Discard packets that is sent from the sessions such as local bridge, - // SecureNAT, virtual L3 switch - } - - pass = false; - } - - return pass; -} - -// Check whether the TCP packet is NCSI accessing -bool IsTcpPacketNcsiHttpAccess(PKT *p) -{ - // Validate arguments - if (p == NULL) - { - return false; - } - - if (p->TypeL4 != L4_TCP) - { - return false; - } - - if (p->Payload == NULL || p->PayloadSize == 0) - { - return false; - } - - if (SearchBin(p->Payload, 0, p->PayloadSize, "NCSI", 4) != INFINITE) - { - return true; - } - - if (SearchBin(p->Payload, 0, p->PayloadSize, ".jpeg", 5) != INFINITE) - { - return true; - } - - if (SearchBin(p->Payload, 0, p->PayloadSize, ".jpg", 4) != INFINITE) - { - return true; - } - - if (SearchBin(p->Payload, 0, p->PayloadSize, ".gif", 4) != INFINITE) - { - return true; - } - - if (SearchBin(p->Payload, 0, p->PayloadSize, ".css", 4) != INFINITE) - { - return true; - } - - return false; -} - -// Adding Access List -void AddAccessList(HUB *hub, ACCESS *a) -{ - AddAccessListEx(hub, a, false, false); -} -void AddAccessListEx(HUB *hub, ACCESS *a, bool no_sort, bool no_reassign_id) -{ - // Validate arguments - if (hub == NULL || a == NULL) - { - return; - } - - LockList(hub->AccessList); - { - ACCESS *access; - UINT i; - - // Check the number of items - if (LIST_NUM(hub->AccessList) >= MAX_ACCESSLISTS) - { - UnlockList(hub->AccessList); - return; - } - - access = Malloc(sizeof(ACCESS)); - Copy(access, a, sizeof(ACCESS)); - - access->IsSrcUsernameIncludeOrExclude = false; - access->IsDestUsernameIncludeOrExclude = false; - - // User name correction - if (IsEmptyStr(access->SrcUsername) == false) - { - if (StartWith(access->SrcUsername, ACCESS_LIST_INCLUDED_PREFIX) == false && StartWith(access->SrcUsername, ACCESS_LIST_EXCLUDED_PREFIX) == false) - { - MakeSimpleUsernameRemoveNtDomain(access->SrcUsername, sizeof(access->SrcUsername), access->SrcUsername); - } - else - { - access->IsSrcUsernameIncludeOrExclude = true; - } - } - if (IsEmptyStr(access->DestUsername) == false) - { - if (StartWith(access->DestUsername, ACCESS_LIST_INCLUDED_PREFIX) == false && StartWith(access->DestUsername, ACCESS_LIST_EXCLUDED_PREFIX) == false) - { - MakeSimpleUsernameRemoveNtDomain(access->DestUsername, sizeof(access->DestUsername), access->DestUsername); - } - else - { - access->IsDestUsernameIncludeOrExclude = true; - } - } - - access->SrcUsernameHash = UsernameToInt64(access->SrcUsername); - access->DestUsernameHash = UsernameToInt64(access->DestUsername); - - // Port number correction - if (access->SrcPortStart != 0) - { - access->SrcPortEnd = MAX(access->SrcPortEnd, access->SrcPortStart); - } - if (access->DestPortStart != 0) - { - access->DestPortEnd = MAX(access->DestPortEnd, access->DestPortStart); - } - - // Correct delay, jitter, and packet loss - access->Delay = MAKESURE(access->Delay, 0, HUB_ACCESSLIST_DELAY_MAX); - access->Jitter = MAKESURE(access->Jitter, 0, HUB_ACCESSLIST_JITTER_MAX); - access->Loss = MAKESURE(access->Loss, 0, HUB_ACCESSLIST_LOSS_MAX); - - if (no_sort == false) - { - Insert(hub->AccessList, access); - } - else - { - Add(hub->AccessList, access); - } - - // Reassign the ID - if (no_reassign_id == false) - { - for (i = 0;i < LIST_NUM(hub->AccessList);i++) - { - ACCESS *a = LIST_DATA(hub->AccessList, i); - a->Id = (i + 1); - } - } - } - UnlockList(hub->AccessList); -} - -// Initialize the access list -void InitAccessList(HUB *hub) -{ - // Validate arguments - if (hub == NULL) - { - return; - } - - hub->AccessList = NewList(CmpAccessList); -} - -// Release the access list -void FreeAccessList(HUB *hub) -{ - UINT i; - // Validate arguments - if (hub == NULL) - { - return; - } - - for (i = 0;i < LIST_NUM(hub->AccessList);i++) - { - ACCESS *a = LIST_DATA(hub->AccessList, i); - Free(a); - } - - ReleaseList(hub->AccessList); - hub->AccessList = NULL; -} - -// Comparison of the access list entry -int CmpAccessList(void *p1, void *p2) -{ - ACCESS *a1, *a2; - if (p1 == NULL || p2 == NULL) - { - return 0; - } - a1 = *(ACCESS **)p1; - a2 = *(ACCESS **)p2; - if (a1 == NULL || a2 == NULL) - { - return 0; - } - // Sort by priority - if (a1->Priority > a2->Priority) - { - return 1; - } - else if (a1->Priority < a2->Priority) - { - return -1; - } - else if (a1->Discard > a2->Discard) - { - return 1; - } - else if (a1->Discard < a2->Discard) - { - return -1; - } - else - { - UINT64 size64 = ((UINT64)(&a1->UniqueId) - (UINT64)(&a1->Active)); - UINT size32 = (UINT)size64; - - return Cmp(&a1->Active, &a2->Active, size32); - } -} - -// Generate a user name without domain name of the Windows NT -void MakeSimpleUsernameRemoveNtDomain(char *dst, UINT dst_size, char *src) -{ - char tmp1[MAX_SIZE]; - char tmp2[MAX_SIZE]; - // Validate arguments - if (dst == NULL || src == NULL) - { - return; - } - - ParseNtUsername(src, tmp1, sizeof(tmp1), tmp2, sizeof(tmp2), false); - - StrCpy(dst, dst_size, tmp1); -} - -// Convert the user name to UINT -UINT64 UsernameToInt64(char *name) -{ - UCHAR hash[SHA1_SIZE]; - UINT64 ret; - char tmp[MAX_USERNAME_LEN + 1]; - // Validate arguments - if (name == 0 || IsEmptyStr(name)) - { - return 0; - } - - if (StartWith(name, ACCESS_LIST_INCLUDED_PREFIX) || StartWith(name, ACCESS_LIST_EXCLUDED_PREFIX)) - { - return Rand64(); - } - - MakeSimpleUsernameRemoveNtDomain(tmp, sizeof(tmp), name); - Trim(tmp); - StrUpper(tmp); - - if (StrLen(tmp) == 0) - { - return 0; - } - - Sha0(hash, tmp, StrLen(tmp)); - Copy(&ret, hash, sizeof(ret)); - - return ret; -} - -// Search the session from the session name -SESSION *GetSessionByName(HUB *hub, char *name) -{ - // Validate arguments - if (hub == NULL || name == NULL) - { - return NULL; - } - - LockList(hub->SessionList); - { - UINT i; - for (i = 0;i < LIST_NUM(hub->SessionList);i++) - { - SESSION *s = LIST_DATA(hub->SessionList, i); - if (StrCmpi(s->Name, name) == 0) - { - // Found - AddRef(s->ref); - UnlockList(hub->SessionList); - return s; - } - } - } - UnlockList(hub->SessionList); - - return NULL; -} - -// Sort of the STORM list -int CompareStormList(void *p1, void *p2) -{ - STORM *s1, *s2; - UINT r; - // Validate arguments - if (p1 == NULL || p2 == NULL) - { - return 0; - } - s1 = *(STORM **)p1; - s2 = *(STORM **)p2; - if (s1 == NULL || s2 == NULL) - { - return 0; - } - if (s1->StrictMode == false && s2->StrictMode == false) - { - // Normal mode - r = CmpIpAddr(&s1->DestIp, &s2->DestIp); - if (r != 0) - { - return r; - } - r = CmpIpAddr(&s1->SrcIp, &s2->SrcIp); - if (r != 0) - { - return r; - } - } - else - { - // Strict mode - int r1, r2; - r1 = CmpIpAddr(&s1->DestIp, &s2->DestIp); - r2 = CmpIpAddr(&s1->SrcIp, &s2->SrcIp); - if (r1 == 0 || r2 == 0) - { - // Either the source IP, and destination IP match - } - else - { - // Mismatch - if (r1 != 0) - { - return r1; - } - - if (r2 != 0) - { - return r2; - } - } - } - r = Cmp(s1->MacAddress, s2->MacAddress, 6); - return r; -} - -// Packet adapter initialization -bool HubPaInit(SESSION *s) -{ - // Initialize the packet adapter information - HUB_PA *pa = ZeroMalloc(sizeof(HUB_PA)); - pa->Cancel = NewCancel(); - pa->PacketQueue = NewQueue(); - pa->Now = Tick64(); - pa->Session = s; - pa->StormList = NewList(CompareStormList); - pa->UsernameHash = UsernameToInt64(s->Username); - pa->GroupnameHash = UsernameToInt64(s->GroupName); - - s->PacketAdapter->Param = pa; - - if (s->Policy->MonitorPort) - { - // Mark this port as monitoring port - pa->MonitorPort = true; - - // Add this session to the list of monitoring port of the HUB - LockList(s->Hub->MonitorList); - { - Insert(s->Hub->MonitorList, s); - } - UnlockList(s->Hub->MonitorList); - } - - return true; -} - -// Release the Packet adapter -void HubPaFree(SESSION *s) -{ - HUB_PA *pa = (HUB_PA *)s->PacketAdapter->Param; - HUB *hub = s->Hub; - - if (pa->MonitorPort) - { - // Remove the session from the list of monitor port of the HUB - LockList(s->Hub->MonitorList); - { - Delete(s->Hub->MonitorList, s); - } - UnlockList(s->Hub->MonitorList); - } - - // Erase MAC address table entries that is associated with this session - LockHashList(hub->MacHashTable); - { - UINT i, num; - MAC_TABLE_ENTRY **pp; - LIST *o = NewListFast(NULL); - - pp = (MAC_TABLE_ENTRY **)HashListToArray(hub->MacHashTable, &num); - for (i = 0;i < num;i++) - { - MAC_TABLE_ENTRY *e = (MAC_TABLE_ENTRY *)pp[i]; - if (e->Session == s) - { - Add(o, e); - } - } - for (i = 0;i < LIST_NUM(o);i++) - { - MAC_TABLE_ENTRY *e = (MAC_TABLE_ENTRY *)LIST_DATA(o, i); - DeleteHash(hub->MacHashTable, e); - Free(e); - } - ReleaseList(o); - Free(pp); - } - { - UINT i, num = LIST_NUM(hub->IpTable); - LIST *o = NewListFast(NULL); - for (i = 0;i < num;i++) - { - IP_TABLE_ENTRY *e = LIST_DATA(hub->IpTable, i); - if (e->Session == s) - { - Add(o, e); - } - } - for (i = 0;i < LIST_NUM(o);i++) - { - IP_TABLE_ENTRY *e = LIST_DATA(o, i); - Delete(hub->IpTable, e); - Free(e); - } - ReleaseList(o); - } - UnlockHashList(hub->MacHashTable); - - // Release the STORM list - LockList(pa->StormList); - { - UINT i; - for (i = 0;i < LIST_NUM(pa->StormList);i++) - { - STORM *s = (STORM *)LIST_DATA(pa->StormList, i); - Free(s); - } - DeleteAll(pa->StormList); - } - UnlockList(pa->StormList); - - ReleaseList(pa->StormList); - - // Release the packets remaining in the queue - LockQueue(pa->PacketQueue); - { - BLOCK *b; - - while (b = GetNext(pa->PacketQueue)) - { - // Release the block - if (b->IsFlooding) - { - CedarAddCurrentTcpQueueSize(s->Cedar, -((int)b->Size)); - } - - FreeBlock(b); - } - } - UnlockQueue(pa->PacketQueue); - - // Release the queue - ReleaseQueue(pa->PacketQueue); - - // Release the cancel object - ReleaseCancel(pa->Cancel); - - // Release the packet adapter information - Free(pa); - s->PacketAdapter->Param = NULL; -} - -// Get the cancel object -CANCEL *HubPaGetCancel(SESSION *s) -{ - HUB_PA *pa = (HUB_PA *)s->PacketAdapter->Param; - - AddRef(pa->Cancel->ref); - return pa->Cancel; -} - -// Get the packet to be transmitted next -UINT HubPaGetNextPacket(SESSION *s, void **data) -{ - UINT ret = 0; - HUB_PA *pa = (HUB_PA *)s->PacketAdapter->Param; - - // Get one from the head of the queue - LockQueue(pa->PacketQueue); - { - BLOCK *block = GetNext(pa->PacketQueue); - if (block == NULL) - { - // No queue - ret = 0; - } - else - { - if (block->IsFlooding) - { - CedarAddCurrentTcpQueueSize(s->Cedar, -((int)block->Size)); - } - - // Found - *data = block->Buf; - ret = block->Size; - // Release the memory of the structure of the block - Free(block); - } - } - UnlockQueue(pa->PacketQueue); - - return ret; -} - -// Receive a packet -bool HubPaPutPacket(SESSION *s, void *data, UINT size) -{ - PKT *packet; - HUB_PA *pa = (HUB_PA *)s->PacketAdapter->Param; - bool b = false; - HUB *hub; - bool no_l3 = false; - bool no_http = false; - LIST *o = NULL; - UINT i; - UINT vlan_type_id = 0; - bool no_look_bpdu_bridge_id = false; - bool no_parse_dhcp = false; - bool no_correct_checksum = false; - - hub = s->Hub; - - pa->Now = Tick64(); - - // Processing of Adjust TCP MSS - if (hub != NULL && hub->Option != NULL && hub->Option->DisableAdjustTcpMss == false && s != NULL) - { - UINT target_mss = (hub->Option->AdjustTcpMssValue == 0 ? INFINITE : hub->Option->AdjustTcpMssValue); - UINT session_mss = (s->AdjustMss == 0 ? INFINITE : s->AdjustMss); - - target_mss = MIN(target_mss, session_mss); - - if (s->IsUsingUdpAcceleration && s->UdpAccelMss != 0) - { - // If the link is established with UDP acceleration function, use optimum value of the UDP acceleration function - target_mss = MIN(target_mss, s->UdpAccelMss); - } - else if (s->IsRUDPSession && s->RUdpMss != 0) - { - // If the link with UDP acceleration is not established, use the optimum value for R-UDP in the case of using R-UDP connection - target_mss = MIN(target_mss, s->RUdpMss); - } - - if (target_mss != INFINITE) - { - AdjustTcpMssL2(data, size, target_mss, hub->Option->VlanTypeId); - } - } - - if (data == NULL) - { - // Check the delayed packet - o = NULL; - LockList(s->DelayedPacketList); - { - UINT i; - if (LIST_NUM(s->DelayedPacketList) >= 1) - { - UINT64 now = TickHighres64(); - for (i = 0;i < LIST_NUM(s->DelayedPacketList);i++) - { - PKT *p = LIST_DATA(s->DelayedPacketList, i); - - if (now >= p->DelayedForwardTick) - { - if (o == NULL) - { - o = NewListFast(NULL); - } - - Add(o, p); - } - } - } - - if (o != NULL) - { - for (i = 0;i < LIST_NUM(o);i++) - { - PKT *p = LIST_DATA(o, i); - - Delete(s->DelayedPacketList, p); - } - } - } - UnlockList(s->DelayedPacketList); - - // If there is a delayed packet, store it - if (o != NULL) - { - for (i = 0;i < LIST_NUM(o);i++) - { - PKT *p = LIST_DATA(o, i); - - StorePacket(s->Hub, s, p); - } - - ReleaseList(o); - } - - // Reception of all packets from this session is complete - CancelList(s->CancelList); - - // Yield - if (hub != NULL) - { - if (hub->Option != NULL && hub->Option->YieldAfterStorePacket) - { - YieldCpu(); - } - } - - return true; - } - - if (hub != NULL && hub->Option != NULL) - { - no_l3 = hub->Option->DisableIPParsing; - no_http = hub->Option->DisableHttpParsing; - vlan_type_id = hub->Option->VlanTypeId; - no_look_bpdu_bridge_id = hub->Option->NoLookBPDUBridgeId; - no_correct_checksum = hub->Option->DisableCorrectIpOffloadChecksum; - } - - // Insert a VLAN tag - if (s->VLanId != 0) - { - VLanInsertTag(&data, &size, s->VLanId, vlan_type_id); - } - -LABEL_TRY_AGAIN: - // Parse the packet - packet = ParsePacketEx4(data, size, no_l3, vlan_type_id, !no_look_bpdu_bridge_id, no_http, !no_correct_checksum); - - if (packet != NULL) - { - if (packet->InvalidSourcePacket) - { - // Packet which have illegal source - FreePacket(packet); - packet = NULL; - } - } - - - if (packet != NULL) - { - if (packet->TypeL7 == L7_DHCPV4) - { - if (packet->TypeL3 == L3_IPV4 && packet->TypeL4 == L4_UDP) - { - if (packet->L7.DHCPv4Header != NULL) - { - DHCPV4_HEADER *dhcp = packet->L7.DHCPv4Header; - - if (dhcp->OpCode == 1) - { - if (NsIsMacAddressOnLocalhost(dhcp->ClientMacAddress)) - { - // Filter DHCP requests sent from local kernel-mode virtual NAT - // not to re-enter it to the virtual HUB along the local bridge - FreePacket(packet); - packet = NULL; - } - } - } - } - } - } - - if (no_parse_dhcp == false && packet != NULL) - { - if (hub != NULL && hub->Option != NULL && hub->Option->RemoveDefGwOnDhcpForLocalhost) - { - // Remove the designation of the DHCP server from the DHCP response packet addressed to localhost - if (packet->TypeL7 == L7_DHCPV4) - { - if (packet->TypeL3 == L3_IPV4) - { - if (packet->TypeL4 == L4_UDP) - { - if (packet->L7.DHCPv4Header != NULL) - { - DHCPV4_HEADER *dhcp = packet->L7.DHCPv4Header; - - if (dhcp->OpCode == 2) - { - if (IsMacAddressLocalFast(dhcp->ClientMacAddress)) - { - BUF *new_buf; - DHCP_MODIFY_OPTION m; - WHERE; - - Zero(&m, sizeof(m)); - m.RemoveDefaultGatewayOnReply = true; - - new_buf = DhcpModifyIPv4(&m, data, size); - - if (new_buf != NULL) - { - Free(data); - - data = new_buf->Buf; - size = new_buf->Size; - - Free(new_buf); - - no_parse_dhcp = true; - - FreePacket(packet); - - goto LABEL_TRY_AGAIN; - } - } - } - } - } - } - } - } - } - - if (packet != NULL) - { - // Store packet - StorePacket(s->Hub, s, packet); - } - else - { - // Release the packet data because it is a bad packet (not a correct MAC frame) - Free(data); - } - - return true; -} - -// Checking algorithm to prevent broadcast-storm -// If broadcast from a specific endpoint came frequently, filter it -bool CheckBroadcastStorm(HUB *hub, SESSION *s, PKT *p) -{ - IP src_ip, dest_ip; - HUB_PA *pa; - UINT64 now = Tick64(); - UINT limit_start_count; - SESSION *sess = s; - bool ret = true; - bool strict = false; - bool no_heavy = false; - // Validate arguments - if (s == NULL || p == NULL || hub == NULL) - { - return false; - } - - if (s->Policy->NoBroadcastLimiter) - { - // Unlimited the number of broadcasts - return true; - } - - if (hub->Option != NULL) - { - strict = hub->Option->BroadcastLimiterStrictMode; - no_heavy = hub->Option->DoNotSaveHeavySecurityLogs; - } - - pa = (HUB_PA *)s->PacketAdapter->Param; - - Zero(&src_ip, sizeof(IP)); - Zero(&dest_ip, sizeof(IP)); - - if (p->TypeL3 == L3_IPV4) - { - UINTToIP(&src_ip, p->L3.IPv4Header->SrcIP); - UINTToIP(&dest_ip, p->L3.IPv4Header->DstIP); - } - else if (p->TypeL3 == L3_ARPV4) - { - UINTToIP(&src_ip, p->L3.ARPv4Header->SrcIP); - Zero(&dest_ip, sizeof(IP)); - } - else if (p->TypeL3 == L3_IPV6) - { - IPv6AddrToIP(&src_ip, &p->L3.IPv6Header->SrcAddress); - IPv6AddrToIP(&dest_ip, &p->L3.IPv6Header->DestAddress); - } - - // Number of broadcast to start limitation for a single interval - limit_start_count = 32; - - if (s->Hub != NULL && s->Hub->Option->BroadcastStormDetectionThreshold != 0) - { - limit_start_count = s->Hub->Option->BroadcastStormDetectionThreshold; - } - - LockList(pa->StormList); - { - STORM *s; - UINT num; - s = SearchStormList(pa, p->MacAddressSrc, &src_ip, &dest_ip, strict); - if (s == NULL) - { - s = AddStormList(pa, p->MacAddressSrc, &src_ip, &dest_ip, strict); - } - - s->CurrentBroadcastNum++; - - if ((s->CheckStartTick + STORM_CHECK_SPAN) < now || - s->CheckStartTick == 0 || s->CheckStartTick > now) - { - // Measure the number of broadcast periodically - UINT64 diff_time; - if (s->CheckStartTick < now) - { - diff_time = now - s->CheckStartTick; - } - else - { - diff_time = 0; - } - s->CheckStartTick = now; - num = (UINT)((UINT64)s->CurrentBroadcastNum * (UINT64)1000 / (UINT64)STORM_CHECK_SPAN); - s->CurrentBroadcastNum = 0; - if (num >= limit_start_count) - { - char ip1[64]; - char ip2[64]; - char mac[MAX_SIZE]; - IPToStr(ip1, sizeof(ip1), &src_ip); - IPToStr(ip2, sizeof(ip2), &dest_ip); - ret = false; - if (s->DiscardValue < STORM_DISCARD_VALUE_END) - { - s->DiscardValue = MAX(s->DiscardValue, 1) * 2; - } - Debug("s->DiscardValue: %u (%u)\n", s->DiscardValue, num); - - MacToStr(mac, sizeof(mac), p->MacAddressSrc); - - if (no_heavy == false) - { - HLog(sess->Hub, "LH_BCAST_STORM", sess->Name, mac, ip1, ip2, num); - } - } - else - { - if (s->DiscardValue >= 1) - { - s->DiscardValue = (UINT)((UINT64)s->DiscardValue / MAX((UINT64)2, (UINT64)diff_time / (UINT64)STORM_CHECK_SPAN)); - } - } - } - - if (s->DiscardValue >= STORM_DISCARD_VALUE_START) - { - if (s->DiscardValue >= 128) - { - ret = false; - } - else if ((rand() % s->DiscardValue) != 0) - { - ret = false; - } - } - - } - UnlockList(pa->StormList); - - return ret; -} - -// Store packet -void StorePacket(HUB *hub, SESSION *s, PKT *packet) -{ - MAC_TABLE_ENTRY *entry = NULL; - MAC_TABLE_ENTRY t; - void *data; - UINT size; - bool broadcast_mode; - HUB_PA *dest_pa; - SESSION *dest_session; - UINT64 now = Tick64(); - bool no_heavy = false; - bool drop_broadcast_packet_privacy = false; - bool drop_arp_packet_privacy = false; - UINT tcp_queue_quota = 0; - UINT64 dormant_interval = 0; - // Validate arguments - if (hub == NULL || packet == NULL) - { - return; - } - - if (s != NULL) - { - if (((HUB_PA *)s->PacketAdapter->Param)->MonitorPort) - { - // Not to forward packets received from the monitor port - Free(packet->PacketData); - FreePacket(packet); - return; - } - } - - if (hub->Option != NULL) - { - no_heavy = hub->Option->DoNotSaveHeavySecurityLogs; - drop_broadcast_packet_privacy = hub->Option->DropBroadcastsInPrivacyFilterMode; - drop_arp_packet_privacy = hub->Option->DropArpInPrivacyFilterMode; - tcp_queue_quota = hub->Option->FloodingSendQueueBufferQuota; - if (hub->Option->DetectDormantSessionInterval != 0) - { - dormant_interval = (UINT64)hub->Option->DetectDormantSessionInterval * (UINT64)1000; - } - } - - if (dormant_interval != 0) - { - if (s != NULL && s->NormalClient) - { - if (packet->MacAddressSrc != NULL) - { - if (IsHubMacAddress(packet->MacAddressSrc) == false) - { - s->LastCommTimeForDormant = now; - } - } - } - } - - // Lock the entire MAC address table - LockHashList(hub->MacHashTable); - { - // Filtering - if (s != NULL && (packet->DelayedForwardTick == 0 && StorePacketFilter(s, packet) == false)) - { -DISCARD_PACKET: - // Release a packet since passing has been disallowed - Free(packet->PacketData); - FreePacket(packet); - } - else // Passing is allowed - { - bool forward_now = true; - - if (packet->Loss >= 1) - { - // Cause packet loss - UINT r = rand() % 100; - if ((packet->Loss >= 100) || (r < packet->Loss)) - { - // Packet loss - goto DISCARD_PACKET; - } - } - - if (packet->Delay >= 1) - { - float delay = (float)packet->Delay; - float jitter; - UINT delay_uint; - bool f = Rand1(); - if (packet->Jitter == 0) - { - jitter = 0; - } - else - { - jitter = (float)(Rand32() % (int)((float)packet->Jitter * delay / 100.0f)); - } - - delay += jitter * (f ? 1 : -1); - delay_uint = (UINT)delay; - - if (delay_uint >= 1) - { - // Cause delay - forward_now = false; - packet->Loss = packet->Jitter = packet->Delay = 0; - packet->DelayedForwardTick = TickHighres64() + (UINT64)delay_uint; - packet->DelayedSrcSession = s; - - LockList(s->DelayedPacketList); - { - Add(s->DelayedPacketList, packet); - } - UnlockList(s->DelayedPacketList); - } - } - - if (forward_now) - { - if (memcmp(packet->MacAddressSrc, hub->HubMacAddr, 6) == 0) - { - if (s != NULL) - { - // Packets that this HUB itself sent is input from the outside - goto DISCARD_PACKET; - } - } - if (s != NULL && (memcmp(packet->MacAddressSrc, hub->HubMacAddr, 6) != 0)) - { - // Check whether the source MAC address is registered in the table - Copy(t.MacAddress, packet->MacAddressSrc, 6); - if (hub->Option->NoManageVlanId == false) - { - t.VlanId = packet->VlanId; - } - else - { - t.VlanId = 0; - } - entry = SearchHash(hub->MacHashTable, &t); - - if (entry == NULL) - { - if (hub->LastFlushTick == 0 || (hub->LastFlushTick + (UINT64)OLD_MAC_ADDRESS_ENTRY_FLUSH_INTERVAL) < now) - { - hub->LastFlushTick = now; - - // Remove old entries - DeleteExpiredMacTableEntry(hub->MacHashTable); - } - - // Register since it is not registered - if ((s->Policy->MaxMac != 0 || s->Policy->NoBridge) && (s->IsOpenVPNL3Session == false)) - { - UINT i, num_mac_for_me = 0; - UINT limited_count; - MAC_TABLE_ENTRY **pp; - UINT num_pp; - - pp = (MAC_TABLE_ENTRY **)HashListToArray(hub->MacHashTable, &num_pp); - - // Examine a number of MAC addresses that are registered in this current session - for (i = 0;i < num_pp;i++) - { - MAC_TABLE_ENTRY *e = pp[i]; - if (e->Session == s) - { - num_mac_for_me++; - } - } - - Free(pp); - - limited_count = 0xffffffff; - if (s->Policy->NoBridge) - { - limited_count = MIN(limited_count, MAC_MIN_LIMIT_COUNT); - } - if (s->Policy->MaxMac != 0) - { - limited_count = MIN(limited_count, s->Policy->MaxMac); - } - limited_count = MAX(limited_count, MAC_MIN_LIMIT_COUNT); - - if (num_mac_for_me >= limited_count) - { - // Number of MAC addresses that are registered already exceeds the upper limit - char mac_str[64]; - - if (s != NULL) - { - MacToStr(mac_str, sizeof(mac_str), packet->MacAddressSrc); - if (s->Policy->NoBridge) - { - if (no_heavy == false) - { - HLog(hub, "LH_BRIDGE_LIMIT", s->Name, mac_str, num_mac_for_me, limited_count); - } - } - else - { - if (no_heavy == false) - { - HLog(hub, "LH_MAC_LIMIT", s->Name, mac_str, num_mac_for_me, limited_count); - } - } - } - - goto DISCARD_PACKET; // Drop the packet - } - } - - if (HASH_LIST_NUM(hub->MacHashTable) >= MAX_MAC_TABLES) - { - // Number of MAC addresses exceeded, discard the packet - goto DISCARD_PACKET; - } - - entry = ZeroMalloc(sizeof(MAC_TABLE_ENTRY)); - entry->HubPa = (HUB_PA *)s->PacketAdapter->Param; - Copy(entry->MacAddress, packet->MacAddressSrc, 6); - if (hub->Option->NoManageVlanId == false) - { - entry->VlanId = packet->VlanId; - } - else - { - entry->VlanId = 0; - } - entry->Session = s; - entry->UpdatedTime = entry->CreatedTime = now; - - AddHash(hub->MacHashTable, entry); - - if (hub->Option->NoMacAddressLog == false) - { - // Debug display - char mac_address[32]; - - if (s != NULL) - { - if (no_heavy == false) - { - MacToStr(mac_address, sizeof(mac_address), packet->MacAddressSrc); - // Debug("Register MAC Address %s to Session %X.\n", mac_address, s); - - if (packet->VlanId == 0) - { - HLog(hub, "LH_MAC_REGIST", s->Name, mac_address); - } - else - { - HLog(hub, "LH_MAC_REGIST_VLAN", s->Name, mac_address, packet->VlanId); - } - } - } - } - } - else - { - if (entry->Session == s) - { - // Do not do anything because it is already registered - entry->UpdatedTime = now; - } - else - { - // Read the value of the policy CheckMac - bool check_mac = s->Policy->CheckMac; - - if (check_mac == false) - { - if (s->BridgeMode) - { - // Enable the CheckMac policy for the local bridge session forcibly - check_mac = true; - - if (hub->Option != NULL && hub->Option->DisableCheckMacOnLocalBridge) - { - // Disable if DisableCheckMacOnLocalBridge option is set - check_mac = false; - } - } - } - - // It's already registered and it's in another session - if (check_mac && (memcmp(packet->MacAddressSrc, hub->HubMacAddr, 6) != 0) && - ((entry->UpdatedTime + MAC_TABLE_EXCLUSIVE_TIME) >= now)) - { - UCHAR *mac = packet->MacAddressSrc; - if (hub->Option != NULL && hub->Option->FixForDLinkBPDU && - (mac[0] == 0x00 && mac[1] == 0x80 && mac[2] == 0xc8 && mac[3] == 0x00 && mac[4] == 0x00 && mac[5] == 0x00) || - (mac[0] == 0x00 && mac[1] == 0x0d && mac[2] == 0x88 && mac[3] == 0x00 && mac[4] == 0x00 && mac[5] == 0x00)) - { - // Measures for D-Link. Spanning tree packet of D-Link is sent from the above address. - //CheckMac options for the local bridge may cause an adverse effect. So process this exceptionally. - UCHAR hash[MD5_SIZE]; - UINT64 tick_diff = Tick64() - s->LastDLinkSTPPacketSendTick; - - Md5(hash, packet->PacketData, packet->PacketSize); - - if ((s->LastDLinkSTPPacketSendTick != 0) && - (tick_diff < 750ULL) && - (memcmp(hash, s->LastDLinkSTPPacketDataHash, MD5_SIZE) == 0)) - { - // Discard if the same packet sent before 750ms ago - Debug("D-Link Discard %u\n", (UINT)tick_diff); - goto DISCARD_PACKET; // Drop the packet - } - else - { - goto UPDATE_FDB; - } - } - else - { - if (0) - { - // If the CheckMac policy-enabled, owning same - // MAC address by other sessions are prohibited - // (If the second byte is 0xAE, don't perform this check) - char mac_address[32]; - BinToStr(mac_address, sizeof(mac_address), packet->MacAddressSrc, 6); - } - } - - goto DISCARD_PACKET; // Drop the packet - } - else - { - // Rewrite the session of MAC address table and the HUB_PA - char mac_address[32]; -UPDATE_FDB: - BinToStr(mac_address, sizeof(mac_address), packet->MacAddressSrc, 6); - - entry->Session = s; - entry->HubPa = (HUB_PA *)s->PacketAdapter->Param; - entry->UpdatedTime = entry->CreatedTime = now; - - if (1) - { - // Debug display - char mac_address[32]; - - if (s != NULL) - { - if (no_heavy == false) - { - MacToStr(mac_address, sizeof(mac_address), packet->MacHeader->SrcAddress); - Debug("Register MAC Address %s to Session %X.\n", mac_address, s); - if (packet->VlanId == 0) - { - HLog(hub, "LH_MAC_REGIST", s->Name, mac_address); - } - else - { - HLog(hub, "LH_MAC_REGIST_VLAN", s->Name, mac_address, packet->VlanId); - } - } - } - } - } - } - } - } - - broadcast_mode = false; - dest_pa = NULL; - dest_session = NULL; - - if (packet->BroadcastPacket) - { - // Broadcast packet - broadcast_mode = true; - } - else - { - // Examine whether the destination MAC address is registered in the table - Copy(t.MacAddress, packet->MacAddressDest, 6); - if (hub->Option->NoManageVlanId == false) - { - t.VlanId = packet->VlanId; - } - else - { - t.VlanId = 0; - } - entry = SearchHash(hub->MacHashTable, &t); - - if (entry == NULL) - { - // Broadcast because the destination isn't found - broadcast_mode = true; - } - else - { - if (entry->Session != s) - { - // Destination is found - dest_pa = entry->HubPa; - dest_session = entry->Session; - } - else - { - // Bad packet whose destination is its own - goto DISCARD_PACKET; - } - } - } - - if (s != NULL && hub->Option->NoIpTable == false) - { - if (packet->TypeL3 == L3_IPV6) - { - // IPv6 packet - IP ip; - bool b = true; - UINT ip_type; - bool dhcp_or_ra = false; - - IPv6AddrToIP(&ip, &packet->L3.IPv6Header->SrcAddress); - ip_type = GetIPv6AddrType(&packet->L3.IPv6Header->SrcAddress); - - if (!(ip_type & IPV6_ADDR_UNICAST)) - { - // Multicast address - b = false; - } - else if ((ip_type & IPV6_ADDR_LOOPBACK) || (ip_type & IPV6_ADDR_ZERO)) - { - // Loop-back address or all-zero address - b = false; - } - - if (packet->TypeL4 == L4_ICMPV6) - { - if (packet->ICMPv6HeaderPacketInfo.Type == 133 || - packet->ICMPv6HeaderPacketInfo.Type == 134) - { - // ICMPv6 RS/RA - dhcp_or_ra = true; - } - } - else if (packet->TypeL4 == L4_UDP) - { - if (Endian16(packet->L4.UDPHeader->DstPort) == 546 || - Endian16(packet->L4.UDPHeader->DstPort) == 547) - { - // DHCPv6 - dhcp_or_ra = true; - } - } - - if (IsHubMacAddress(packet->MacAddressSrc) && - IsHubIpAddress64(&packet->L3.IPv6Header->SrcAddress)) - { - // The source address of the Virtual HUB for polling - b = false; - } - - if (b) - { - // Other than ICMPv6 RS/RA nor DHCPv6 packet - IP_TABLE_ENTRY t, *e; - - Copy(&t.Ip, &ip, sizeof(IP)); - - // Check whether it is registered to an existing table - e = Search(hub->IpTable, &t); - - if (e == NULL) - { - // Register since it is not registered - if (s->Policy->NoRoutingV6 || s->Policy->MaxIPv6 != 0) - { - UINT i, num_ip_for_me = 0; - UINT limited_count = 0xffffffff; - - for (i = 0;i < LIST_NUM(hub->IpTable);i++) - { - IP_TABLE_ENTRY *e = LIST_DATA(hub->IpTable, i); - - if (e->Session == s) - { - if (IsIP6(&e->Ip)) - { - num_ip_for_me++; - } - } - } - - if (s->Policy->NoRoutingV6) - { - limited_count = MIN(limited_count, IP_LIMIT_WHEN_NO_ROUTING_V6); - } - if (s->Policy->MaxIPv6 != 0) - { - limited_count = MIN(limited_count, s->Policy->MaxIPv6); - } - limited_count = MAX(limited_count, IP_MIN_LIMIT_COUNT_V6); - - if (dhcp_or_ra) - { - limited_count = 0xffffffff; - } - - if (num_ip_for_me >= limited_count) - { - // Discard the packet because it exceeded the - // upper limit of the IP address that can be used - char tmp[64]; - IPToStr(tmp, sizeof(tmp), &ip); - if (s->Policy->NoRoutingV6 == false) - { - if (no_heavy == false) - { - HLog(hub, "LH_IP_LIMIT", s->Name, tmp, num_ip_for_me, limited_count); - } - } - else - { - if (no_heavy == false) - { - HLog(hub, "LH_ROUTING_LIMIT", s->Name, tmp, num_ip_for_me, limited_count); - } - } - goto DISCARD_PACKET; - } - } - - if (IsIPManagementTargetForHUB(&ip, hub)) - { - // Create a entry - e = ZeroMalloc(sizeof(IP_TABLE_ENTRY)); - e->CreatedTime = e->UpdatedTime = now; - e->DhcpAllocated = false; - Copy(&e->Ip, &ip, sizeof(IP)); - Copy(e->MacAddress, packet->MacAddressSrc, 6); - e->Session = s; - - DeleteExpiredIpTableEntry(hub->IpTable); - - if (LIST_NUM(hub->IpTable) >= MAX_IP_TABLES) - { - // Delete old IP table entries - DeleteOldIpTableEntry(hub->IpTable); - } - - Insert(hub->IpTable, e); - - if (0) - { - char ip_address[64]; - IPToStr(ip_address, sizeof(ip_address), &ip); - Debug("Registered IP Address %s to Session %X.\n", - ip_address, s); - } - } - } - else - { - if (e->Session == s) - { - // Do not do anything because it is self session - // Renew updated time - e->UpdatedTime = now; - Copy(e->MacAddress, packet->MacAddressSrc, 6); - } - else - { - // Another session was using this IP address before - if ((s->Policy->CheckIPv6) && - ((e->UpdatedTime + IP_TABLE_EXCLUSIVE_TIME) >= now)) - { - // Discard the packet because another session uses this IP address - char ip_address[32]; - char mac_str[48]; - IPToStr(ip_address, sizeof(ip_address), &ip); - - Debug("IP Address %s is Already used by Session %X.\n", - ip_address, s); - - MacToStr(mac_str, sizeof(mac_str), e->MacAddress); - - if (no_heavy == false) - { - HLog(hub, "LH_IP_CONFLICT", s->Name, ip_address, e->Session->Name, mac_str, - e->CreatedTime, e->UpdatedTime, e->DhcpAllocated, now); - } - - goto DISCARD_PACKET; - } - } - } - } - } - } - - if ( - (s != NULL) && - (hub->Option->NoIpTable == false) && - ( - (packet->TypeL3 == L3_IPV4 || - (packet->TypeL3 == L3_ARPV4 && packet->L3.ARPv4Header->HardwareSize == 6 && - Endian16(packet->L3.ARPv4Header->HardwareType) == ARP_HARDWARE_TYPE_ETHERNET && - packet->L3.ARPv4Header->ProtocolSize == 4 && - Endian16(packet->L3.ARPv4Header->ProtocolType) == 0x0800) - ) && - (packet->TypeL7 != L7_DHCPV4) - ) - ) // Other than DHCP packets - { - // In the case of the ARP response packet or the IP packet, search in the IP address table - IP_TABLE_ENTRY t, *e; - IP ip; - UINT uint_ip = 0; - - if (packet->TypeL3 == L3_IPV4) - { - uint_ip = packet->L3.IPv4Header->SrcIP; - } - else if (packet->TypeL3 == L3_ARPV4) - { - uint_ip = packet->L3.ARPv4Header->SrcIP; - } - - if (uint_ip != 0 && uint_ip != 0xffffffff && !(IsHubIpAddress32(uint_ip) && IsHubMacAddress(packet->MacAddressSrc))) - { - UINTToIP(&ip, uint_ip); - Copy(&t.Ip, &ip, sizeof(IP)); - - // Check whether it is registered to an existing table - e = Search(hub->IpTable, &t); - - if (e == NULL) - { - // Register since it is not registered - if (s->Policy->DHCPForce) - { - char ipstr[MAX_SIZE]; - - // Discard the packet because this IP address isn't - // assigned by the DHCP server - IPToStr32(ipstr, sizeof(ipstr), uint_ip); - if (no_heavy == false) - { - HLog(hub, "LH_DHCP_FORCE", s->Name, ipstr); - } - goto DISCARD_PACKET; - } - - // if (packet->TypeL3 == L3_ARPV4) - { - // Examine the number that are registered in this session already - if (s->Policy->NoRouting || s->Policy->MaxIP != 0) - { - UINT i, num_ip_for_me = 0; - UINT limited_count = 0xffffffff; - - for (i = 0;i < LIST_NUM(hub->IpTable);i++) - { - IP_TABLE_ENTRY *e = LIST_DATA(hub->IpTable, i); - - if (e->Session == s) - { - if (IsIP4(&e->Ip)) - { - num_ip_for_me++; - } - } - } - - if (s->Policy->NoRouting) - { - limited_count = MIN(limited_count, IP_MIN_LIMIT_COUNT); - } - if (s->Policy->MaxIP != 0) - { - limited_count = MIN(limited_count, s->Policy->MaxIP); - } - limited_count = MAX(limited_count, IP_MIN_LIMIT_COUNT); - - if (num_ip_for_me >= limited_count) - { - // Discard the packet because it exceeded the - // upper limit of the IP address that can be used - char tmp[64]; - IPToStr32(tmp, sizeof(tmp), uint_ip); - if (s->Policy->NoRouting == false) - { - if (no_heavy == false) - { - HLog(hub, "LH_IP_LIMIT", s->Name, tmp, num_ip_for_me, limited_count); - } - } - else - { - if (no_heavy == false) - { - HLog(hub, "LH_ROUTING_LIMIT", s->Name, tmp, num_ip_for_me, limited_count); - } - } - goto DISCARD_PACKET; - } - } - - if (IsIPManagementTargetForHUB(&ip, hub)) - { - // Create a entry - e = ZeroMalloc(sizeof(IP_TABLE_ENTRY)); - e->CreatedTime = e->UpdatedTime = now; - e->DhcpAllocated = false; - Copy(&e->Ip, &ip, sizeof(IP)); - Copy(e->MacAddress, packet->MacAddressSrc, 6); - e->Session = s; - - DeleteExpiredIpTableEntry(hub->IpTable); - - if (LIST_NUM(hub->IpTable) >= MAX_IP_TABLES) - { - // Delete old IP table entries - DeleteOldIpTableEntry(hub->IpTable); - } - - Insert(hub->IpTable, e); - - if (0) - { - char ip_address[64]; - IPToStr(ip_address, sizeof(ip_address), &ip); - Debug("Registered IP Address %s to Session %X.\n", - ip_address, s); - } - } - } - } - else - { - if (e->Session == s) - { - // Do not do anything because it is self session - // Renew update time - e->UpdatedTime = now; - Copy(e->MacAddress, packet->MacAddressSrc, 6); - } - else - { - // Another session was using this IP address before - if ((s->Policy->CheckIP || s->Policy->DHCPForce) && - ((e->UpdatedTime + IP_TABLE_EXCLUSIVE_TIME) >= now)) - { - // Discard the packet because another session uses - // this IP address - char ip_address[32]; - char mac_str[48]; - IPToStr(ip_address, sizeof(ip_address), &ip); - - Debug("IP Address %s is Already used by Session %X.\n", - ip_address, s); - - MacToStr(mac_str, sizeof(mac_str), e->MacAddress); - - if (no_heavy == false) - { - HLog(hub, "LH_IP_CONFLICT", s->Name, ip_address, e->Session->Name, mac_str, - e->CreatedTime, e->UpdatedTime, e->DhcpAllocated, now); - } - - goto DISCARD_PACKET; - } - - if (s->Policy->DHCPForce) - { - if (e->DhcpAllocated == false) - { - char ipstr[MAX_SIZE]; - - // Discard the packet because this IP address - // isn't assigned by the DHCP server - IPToStr32(ipstr, sizeof(ipstr), uint_ip); - if (no_heavy == false) - { - HLog(hub, "LH_DHCP_FORCE", s->Name, ipstr); - } - goto DISCARD_PACKET; - } - } - - // Overwrite the entry - e->Session = s; - e->UpdatedTime = now; - Copy(e->MacAddress, packet->MacAddressSrc, 6); - } - } - } - } - - if (s != NULL && broadcast_mode) - { - // Calling Broadcast Storm avoidance algorithm - // in order to prevent occurrence of a broadcast packet loop - // or a large number of broadcast - if (CheckBroadcastStorm(hub, s, packet) == false) - { - goto DISCARD_PACKET; - } - } - - // Broadcast this packet to the monitor port of the HUB - if (hub->MonitorList->num_item != 0) - { - LockList(hub->MonitorList); - { - UINT i; - void *data; - UINT size = packet->PacketSize; - for (i = 0;i < LIST_NUM(hub->MonitorList);i++) - { - SESSION *monitor_session = (SESSION *)LIST_DATA(hub->MonitorList, i); - - // Flood the packet - if (monitor_session->PacketAdapter->Param != NULL) - { - data = MallocFast(size); - Copy(data, packet->PacketData, size); - StorePacketToHubPa((HUB_PA *)monitor_session->PacketAdapter->Param, - s, data, size, packet, false, false); - } - } - } - UnlockList(hub->MonitorList); - } - - if (broadcast_mode == false) - { - // Unicast packet - if (dest_pa != NULL) - { - if (dest_session->Policy->NoIPv6DefaultRouterInRA || - (dest_session->Policy->NoIPv6DefaultRouterInRAWhenIPv6 && dest_session->IPv6Session) || - (hub->Option->NoIPv6DefaultRouterInRAWhenIPv6 && dest_session->IPv6Session)) - { - DeleteIPv6DefaultRouterInRA(packet); - } - if (dest_session->Policy->RSandRAFilter) - { - if (packet->TypeL3 == L3_IPV6 && - packet->TypeL4 == L4_ICMPV6 && - (packet->ICMPv6HeaderPacketInfo.Type == ICMPV6_TYPE_ROUTER_SOLICIATION || - packet->ICMPv6HeaderPacketInfo.Type == ICMPV6_TYPE_ROUTER_ADVERTISEMENT)) - { - goto DISCARD_UNICAST_PACKET; - } - } - if (dest_session->Policy->DHCPFilter) - { - if (packet->TypeL3 == L3_IPV4 && - packet->TypeL4 == L4_UDP && - packet->TypeL7 == L7_DHCPV4) - { - goto DISCARD_UNICAST_PACKET; - } - } - if (dest_session->Policy->DHCPv6Filter) - { - if (packet->TypeL3 == L3_IPV6 && - packet->TypeL4 == L4_UDP && - (Endian16(packet->L4.UDPHeader->DstPort) == 546 || Endian16(packet->L4.UDPHeader->DstPort) == 547)) - { - goto DISCARD_UNICAST_PACKET; - } - } - if (dest_session->Policy->ArpDhcpOnly) - { - if (packet->BroadcastPacket) - { - bool b = true; - - if (packet->TypeL3 == L3_IPV4 && - packet->TypeL4 == L4_UDP && - packet->TypeL7 == L7_DHCPV4) - { - b = false; - } - else if (packet->TypeL3 == L3_ARPV4) - { - b = false; - } - else if (packet->TypeL3 == L3_IPV6 && - packet->TypeL4 == L4_UDP && - (Endian16(packet->L4.UDPHeader->DstPort) == 546 || Endian16(packet->L4.UDPHeader->DstPort) == 547)) - { - b = false; - } - else if (packet->TypeL3 == L3_IPV6 && - packet->TypeL4 == L4_ICMPV6) - { - b = false; - } - - if (b) - { - goto DISCARD_UNICAST_PACKET; - } - } - } - if (dest_session->Policy->FilterIPv4) - { - if (packet->TypeL3 == L3_IPV4 || packet->TypeL3 == L3_ARPV4) - { - goto DISCARD_UNICAST_PACKET; - } - } - if (dest_session->Policy->FilterIPv6) - { - if (packet->TypeL3 == L3_IPV6) - { - goto DISCARD_UNICAST_PACKET; - } - } - if (dest_session->Policy->FilterNonIP) - { - if (packet->TypeL3 != L3_IPV4 && packet->TypeL3 != L3_ARPV4 && packet->TypeL3 != L3_IPV6) - { - goto DISCARD_UNICAST_PACKET; - } - } - - if (s != NULL && - ((drop_broadcast_packet_privacy || packet->BroadcastPacket == false) && - s->Policy->PrivacyFilter && - dest_session->Policy->PrivacyFilter) - ) - { - // Privacy filter - if (drop_arp_packet_privacy || packet->TypeL3 != L3_ARPV4) - { - goto DISCARD_UNICAST_PACKET; - } - } - - if (s != NULL) - { - if (memcmp(packet->MacAddressSrc, s->Hub->HubMacAddr, 6) == 0 || - memcmp(packet->MacAddressDest, s->Hub->HubMacAddr, 6) == 0) - { - goto DISCARD_UNICAST_PACKET; - } - } - - // Take a packet log - if (s != NULL) - { - if (PacketLog(s->Hub, s, dest_session, packet, now) == false) - { - // The packet drops because it have exceeded the allowable amount - goto DISCARD_UNICAST_PACKET; - } - } - - // Store to the destination HUB_PA - StorePacketToHubPa(dest_pa, s, packet->PacketData, packet->PacketSize, packet, false, false); - } - else - { -DISCARD_UNICAST_PACKET: - Free(packet->PacketData); - } - } - else - { - // Flooding as a broadcast packet - UINT current_tcp_queue_size = 0; - - // Take a packet log - if (s != NULL) - { - if (PacketLog(s->Hub, s, NULL, packet, now) == false) - { - // The packet drops because It have exceeded the allowable amount - goto DISCARD_BROADCAST_PACKET; - } - } - - // Store for all sessions - LockList(hub->SessionList); - { - UINT i, num = LIST_NUM(hub->SessionList); - for (i = 0;i < num;i++) - { - SESSION *dest_session = LIST_DATA(hub->SessionList, i); - HUB_PA *dest_pa = (HUB_PA *)dest_session->PacketAdapter->Param; - bool discard = false; - - if (dest_session != s) - { - bool delete_default_router_in_ra = false; - - if (dest_session->IsMonitorMode) - { - discard = true; - } - - if (dest_session->NormalClient) - { - if (dormant_interval != 0) - { - if (dest_session->LastCommTimeForDormant == 0 || - (dest_session->LastCommTimeForDormant + dormant_interval) < now) - { - // This is dormant session - discard = true; - } - } - } - - if (tcp_queue_quota != 0) - { - current_tcp_queue_size = CedarGetCurrentTcpQueueSize(hub->Cedar); - - if (current_tcp_queue_size >= tcp_queue_quota) - { - // Quota exceeded. Discard the packet for normal session. - if (dest_session->Connection != NULL && - dest_session->Connection->Protocol == CONNECTION_TCP) - { - discard = true; - } - - if (dest_session->LinkModeServer) - { - LINK *k = dest_session->Link; - - discard = true; - } - } - } - - if (dest_session->VLanId != 0 && packet->TypeL3 == L3_TAGVLAN && - packet->VlanId != dest_session->VLanId) - { - discard = true; - } - - if (dest_session->Policy->NoIPv6DefaultRouterInRA || - (dest_session->Policy->NoIPv6DefaultRouterInRAWhenIPv6 && dest_session->IPv6Session) || - (hub->Option->NoIPv6DefaultRouterInRAWhenIPv6 && dest_session->IPv6Session)) - { - if (packet->TypeL3 == L3_IPV6 && packet->TypeL4 == L4_ICMPV6 && - (packet->ICMPv6HeaderPacketInfo.Type == ICMPV6_TYPE_ROUTER_ADVERTISEMENT)) - { - if (packet->ICMPv6HeaderPacketInfo.Headers.RouterAdvertisementHeader->Lifetime != 0) - { - delete_default_router_in_ra = true; - } - } - } - if (dest_session->Policy->RSandRAFilter) - { - if (packet->TypeL3 == L3_IPV6 && - packet->TypeL4 == L4_ICMPV6 && - (packet->ICMPv6HeaderPacketInfo.Type == ICMPV6_TYPE_ROUTER_SOLICIATION || - packet->ICMPv6HeaderPacketInfo.Type == ICMPV6_TYPE_ROUTER_ADVERTISEMENT)) - { - discard = true; - } - } - - if (dest_session->Policy->DHCPFilter) - { - if (packet->TypeL3 == L3_IPV4 && - packet->TypeL4 == L4_UDP && - packet->TypeL7 == L7_DHCPV4) - { - discard = true; - } - } - - if (dest_session->Policy->DHCPv6Filter) - { - if (packet->TypeL3 == L3_IPV6 && - packet->TypeL4 == L4_UDP && - (Endian16(packet->L4.UDPHeader->DstPort) == 546 || Endian16(packet->L4.UDPHeader->DstPort) == 547)) - { - discard = true; - } - } - - if (dest_session->Policy->ArpDhcpOnly) - { - if (packet->BroadcastPacket) - { - bool b = true; - - if (packet->TypeL3 == L3_IPV4 && - packet->TypeL4 == L4_UDP && - packet->TypeL7 == L7_DHCPV4) - { - b = false; - } - else if (packet->TypeL3 == L3_ARPV4) - { - b = false; - } - else if (packet->TypeL3 == L3_IPV6 && - packet->TypeL4 == L4_UDP && - (Endian16(packet->L4.UDPHeader->DstPort) == 546 || Endian16(packet->L4.UDPHeader->DstPort) == 547)) - { - b = false; - } - else if (packet->TypeL3 == L3_IPV6 && - packet->TypeL4 == L4_ICMPV6) - { - b = false; - } - - if (discard == false) - { - discard = b; - } - } - } - - if (dest_session->Policy->FilterIPv4) - { - if (packet->TypeL3 == L3_IPV4 || packet->TypeL3 == L3_ARPV4) - { - discard = true; - } - } - if (dest_session->Policy->FilterIPv6) - { - if (packet->TypeL3 == L3_IPV6) - { - discard = true; - } - } - if (dest_session->Policy->FilterNonIP) - { - if (packet->TypeL3 != L3_IPV4 && packet->TypeL3 != L3_ARPV4 && packet->TypeL3 != L3_IPV6) - { - discard = true; - } - } - - if (s != NULL && - ((drop_broadcast_packet_privacy || packet->BroadcastPacket == false) && - s->Policy->PrivacyFilter && - dest_session->Policy->PrivacyFilter) - ) - { - // Privacy filter - if (drop_arp_packet_privacy || packet->TypeL3 != L3_ARPV4) - { - discard = true; - } - } - - if (s != NULL) - { - if (memcmp(packet->MacAddressSrc, s->Hub->HubMacAddr, 6) == 0 || - memcmp(packet->MacAddressDest, s->Hub->HubMacAddr, 6) == 0) - { - discard = true; - } - } - - if (discard == false && dest_pa != NULL) - { - if (s == NULL || - ApplyAccessListToForwardPacket(s->Hub, s, dest_pa->Session, packet)) - { - // Store in session other than its own - data = MallocFast(packet->PacketSize); - Copy(data, packet->PacketData, packet->PacketSize); - size = packet->PacketSize; - - if (delete_default_router_in_ra) - { - PKT *pkt2 = ParsePacket(data, size); - - DeleteIPv6DefaultRouterInRA(pkt2); - - FreePacket(pkt2); - } - - StorePacketToHubPa(dest_pa, s, data, size, packet, true, true); - } - } - } - } - } - UnlockList(hub->SessionList); - -DISCARD_BROADCAST_PACKET: - Free(packet->PacketData); - } - FreePacket(packet); - } - } - } - UnlockHashList(hub->MacHashTable); -} - -// Examine the maximum number of logging target packets per minute -bool CheckMaxLoggedPacketsPerMinute(SESSION *s, UINT max_packets, UINT64 now) -{ - UINT64 minute = 60 * 1000; - // Validate arguments - if (s == NULL || max_packets == 0) - { - return true; - } - - if ((s->Policy != NULL && s->Policy->NoBroadcastLimiter) || - s->SecureNATMode || s->BridgeMode || s->LinkModeServer || s->LinkModeClient || - s->L3SwitchMode) - { - return true; - } - - if (s->MaxLoggedPacketsPerMinuteStartTick == 0 || - ((s->MaxLoggedPacketsPerMinuteStartTick + minute) <= now)) - { - s->MaxLoggedPacketsPerMinuteStartTick = now; - s->CurrentNumPackets = 0; - } - - s->CurrentNumPackets++; - if (s->CurrentNumPackets > max_packets) - { - return false; - } - - return true; -} - -// Confirm whether the specified IP address is managed by Virtual HUB -bool IsIPManagementTargetForHUB(IP *ip, HUB *hub) -{ - // Validate arguments - if (ip == NULL || hub == NULL) - { - return false; - } - - if (hub->Option == NULL) - { - return true; - } - - if (IsIP4(ip)) - { - if (hub->Option->ManageOnlyPrivateIP) - { - if (IsIPPrivate(ip) == false) - { - return false; - } - } - } - else - { - if (hub->Option->ManageOnlyLocalUnicastIPv6) - { - UINT ip_type = GetIPAddrType6(ip); - - if (!(ip_type & IPV6_ADDR_LOCAL_UNICAST)) - { - return false; - } - } - } - - return true; -} - -// Delete old IP table entries -void DeleteOldIpTableEntry(LIST *o) -{ - UINT i; - IP_TABLE_ENTRY *old = NULL; - // Validate arguments - if (o == NULL) - { - return; - } - - for (i = 0;i < LIST_NUM(o);i++) - { - IP_TABLE_ENTRY *e = LIST_DATA(o, i); - old = e; - } - - if (old != NULL) - { - Delete(o, old); - Free(old); - } -} - - -// Add to Storm list -STORM *AddStormList(HUB_PA *pa, UCHAR *mac_address, IP *src_ip, IP *dest_ip, bool strict) -{ - STORM *s; - // Validate arguments - if (pa == NULL || mac_address == NULL) - { - return NULL; - } - - s = ZeroMalloc(sizeof(STORM)); - if (src_ip != NULL) - { - Copy(&s->SrcIp, src_ip, sizeof(IP)); - } - if (dest_ip != NULL) - { - Copy(&s->DestIp, dest_ip, sizeof(IP)); - } - Copy(s->MacAddress, mac_address, 6); - s->StrictMode = strict; - - Insert(pa->StormList, s); - - return s; -} - -// Search in Storm list -STORM *SearchStormList(HUB_PA *pa, UCHAR *mac_address, IP *src_ip, IP *dest_ip, bool strict) -{ - STORM t, *s; - // Validate arguments - if (pa == NULL || mac_address == NULL) - { - return NULL; - } - - Zero(&t, sizeof(t)); - if (src_ip != NULL) - { - Copy(&t.SrcIp, src_ip, sizeof(IP)); - } - if (dest_ip != NULL) - { - Copy(&t.DestIp, dest_ip, sizeof(IP)); - } - Copy(t.MacAddress, mac_address, 6); - - t.StrictMode = strict; - - s = Search(pa->StormList, &t); - - return s; -} - -// Store the packet to destination HUB_PA -void StorePacketToHubPa(HUB_PA *dest, SESSION *src, void *data, UINT size, PKT *packet, bool is_flooding, bool no_check_acl) -{ - BLOCK *b; - // Validate arguments - if (dest == NULL || data == NULL) - { - return; - } - - if (size < 14) - { - Free(data); - return; - } - - if (no_check_acl == false) - { - if (src != NULL) - { - // Apply the access list for forwarding - if (ApplyAccessListToForwardPacket(src->Hub, src, dest->Session, packet) == false) - { - Free(data); - return; - } - } - } - - if (src != NULL) - { - if (dest->Session->Policy->MaxDownload != 0) - { - // Traffic limit - if (packet != NULL && IsMostHighestPriorityPacket(dest->Session, packet) == false) - { - TRAFFIC_LIMITER *tr = &dest->DownloadLimiter; - IntoTrafficLimiter(tr, packet); - - if ((tr->Value * (UINT64)1000 / (UINT64)LIMITER_SAMPLING_SPAN) > dest->Session->Policy->MaxDownload) - { - // Limit - Free(data); - return; - } - } - } - } - - if (packet != NULL && src != NULL && src->Hub != NULL && src->Hub->Option != NULL && src->Hub->Option->FixForDLinkBPDU) - { - // Measures for D-Link bug - UCHAR *mac = packet->MacAddressSrc; - if ((mac[0] == 0x00 && mac[1] == 0x80 && mac[2] == 0xc8 && mac[3] == 0x00 && mac[4] == 0x00 && mac[5] == 0x00) || - (mac[0] == 0x00 && mac[1] == 0x0d && mac[2] == 0x88 && mac[3] == 0x00 && mac[4] == 0x00 && mac[5] == 0x00)) - { - SESSION *session = dest->Session; - - if (session != NULL) - { - if (session->Policy != NULL && session->Policy->CheckMac) - { - UCHAR hash[MD5_SIZE]; - Md5(hash, packet->PacketData, packet->PacketSize); - - Copy(session->LastDLinkSTPPacketDataHash, hash, MD5_SIZE); - session->LastDLinkSTPPacketSendTick = Tick64(); - } - } - } - } - - // Remove the VLAN tag - if (dest->Session != NULL && dest->Session->VLanId != 0) - { - UINT vlan_tpid = 0; - if (src != NULL && src->Hub != NULL && src->Hub->Option != NULL) - { - vlan_tpid = src->Hub->Option->VlanTypeId; - } - if (VLanRemoveTag(&data, &size, dest->Session->VLanId, vlan_tpid) == false) - { - Free(data); - return; - } - } - - if (src != NULL && dest->Session != NULL && src->Hub != NULL && src->Hub->Option != NULL) - { - if (dest->Session->AdjustMss != 0 || - (dest->Session->IsUsingUdpAcceleration && dest->Session->UdpAccelMss != 0) || - (dest->Session->IsRUDPSession && dest->Session->RUdpMss != 0)) - { - if (src->Hub->Option->DisableAdjustTcpMss == false) - { - UINT target_mss = INFINITE; - - if (dest->Session->AdjustMss != 0) - { - target_mss = MIN(target_mss, dest->Session->AdjustMss); - } - - if (dest->Session->IsUsingUdpAcceleration && dest->Session->UdpAccelMss != 0) - { - target_mss = MIN(target_mss, dest->Session->UdpAccelMss); - } - else if (dest->Session->IsRUDPSession && dest->Session->RUdpMss != 0) - { - target_mss = MIN(target_mss, dest->Session->RUdpMss); - } - - // Processing of Adjust TCP MSS - if (target_mss != INFINITE) - { - AdjustTcpMssL2(data, size, target_mss, src->Hub->Option->VlanTypeId); - } - } - } - } - - // Create a block - b = NewBlock(data, size, 0); - - LockQueue(dest->PacketQueue); - { - // Measure the length of queue - if (dest->PacketQueue->num_item < MAX_STORED_QUEUE_NUM) - { - // Store - InsertQueue(dest->PacketQueue, b); - - if (is_flooding) - { - if (src != NULL) - { - b->IsFlooding = true; - CedarAddCurrentTcpQueueSize(src->Cedar, b->Size); - } - } - } - else - { - // Drop the packet - FreeBlock(b); - } - } - UnlockQueue(dest->PacketQueue); - - // Issue of cancellation - if (src != NULL) - { - AddCancelList(src->CancelList, dest->Cancel); - } - else - { - Cancel(dest->Cancel); - } -} - -// Remove the default router specification from the IPv6 router advertisement -bool DeleteIPv6DefaultRouterInRA(PKT *p) -{ - if (p->TypeL3 == L3_IPV6 && p->TypeL4 == L4_ICMPV6 && - (p->ICMPv6HeaderPacketInfo.Type == ICMPV6_TYPE_ROUTER_ADVERTISEMENT)) - { - if (p->ICMPv6HeaderPacketInfo.Headers.RouterAdvertisementHeader->Lifetime != 0) - { - p->ICMPv6HeaderPacketInfo.Headers.RouterAdvertisementHeader->Lifetime = 0; - - p->L4.ICMPHeader->Checksum = 0; - p->L4.ICMPHeader->Checksum = - CalcChecksumForIPv6(&p->L3.IPv6Header->SrcAddress, - &p->L3.IPv6Header->DestAddress, IP_PROTO_ICMPV6, - p->L4.ICMPHeader, p->IPv6HeaderPacketInfo.PayloadSize, 0); - } - } - - return false; -} - -// Packet filter by policy -bool StorePacketFilterByPolicy(SESSION *s, PKT *p) -{ - POLICY *pol; - HUB *hub; - bool no_heavy = false; - // Validate arguments - if (s == NULL || p == NULL) - { - return false; - } - - hub = s->Hub; - - if (hub != NULL && hub->Option != NULL) - { - no_heavy = hub->Option->DoNotSaveHeavySecurityLogs; - } - - // Policy - pol = s->Policy; - - // To prohibit the operation as a server - if (pol->NoServer) - { - if (p->TypeL3 == L3_IPV4) - { - if (p->TypeL4 == L4_TCP) - { - UCHAR flag = p->L4.TCPHeader->Flag; - if ((flag & TCP_SYN) && (flag & TCP_ACK)) - { - char ip1[64], ip2[64]; - // Not to send a SYN + ACK packet - Debug("pol->NoServer: Discard SYN+ACK Packet.\n"); - - IPToStr32(ip1, sizeof(ip1), p->L3.IPv4Header->SrcIP); - IPToStr32(ip2, sizeof(ip2), p->L3.IPv4Header->DstIP); - - if (no_heavy == false) - { - HLog(s->Hub, "LH_NO_SERVER", s->Name, ip2, p->L4.TCPHeader->DstPort, - ip1, p->L4.TCPHeader->SrcPort); - } - - return false; - } - } - } - } - - // Prohibit the operation as a server (IPv6) - if (pol->NoServerV6) - { - if (p->TypeL3 == L3_IPV6) - { - if (p->TypeL4 == L4_TCP) - { - UCHAR flag = p->L4.TCPHeader->Flag; - if ((flag & TCP_SYN) && (flag & TCP_ACK)) - { - char ip1[128], ip2[128]; - // Not to send a SYN + ACK packet - Debug("pol->NoServerV6: Discard SYN+ACK Packet.\n"); - - IP6AddrToStr(ip1, sizeof(ip1), &p->IPv6HeaderPacketInfo.IPv6Header->SrcAddress); - IP6AddrToStr(ip2, sizeof(ip2), &p->IPv6HeaderPacketInfo.IPv6Header->DestAddress); - - if (no_heavy == false) - { - HLog(s->Hub, "LH_NO_SERVER", s->Name, ip2, p->L4.TCPHeader->DstPort, - ip1, p->L4.TCPHeader->SrcPort); - } - - return false; - } - } - } - } - - // Allow broadcast only DHCP and ARP - if (pol->ArpDhcpOnly && p->BroadcastPacket) - { - bool ok = false; - - if (p->TypeL3 == L3_ARPV4) - { - ok = true; - } - if (p->TypeL3 == L3_IPV4) - { - if (p->TypeL4 == L4_UDP) - { - if (p->TypeL7 == L7_DHCPV4) - { - ok = true; - } - } - } - if (p->TypeL3 == L3_IPV6) - { - if (p->TypeL4 == L4_ICMPV6) - { - ok = true; - } - } - - if (p->TypeL3 == L3_IPV6 && - p->TypeL4 == L4_UDP && - (Endian16(p->L4.UDPHeader->DstPort) == 546 || Endian16(p->L4.UDPHeader->DstPort) == 547)) - { - ok = true; - } - - if (ok == false) - { - return false; - } - } - - // Filter IPv4 packets - if (pol->FilterIPv4) - { - if (p->MacHeader != NULL) - { - USHORT proto = Endian16(p->MacHeader->Protocol); - if (proto == 0x0800 || proto == 0x0806) - { - return false; - } - } - } - - // Filter IPv6 packets - if (pol->FilterIPv6) - { - if (p->MacHeader != NULL) - { - USHORT proto = Endian16(p->MacHeader->Protocol); - if (proto == 0x86dd) - { - return false; - } - } - } - - // Filter non-IP packets - if (pol->FilterNonIP) - { - if (p->MacHeader != NULL) - { - USHORT proto = Endian16(p->MacHeader->Protocol); - if (!(proto == 0x86dd || proto == 0x0800 || proto == 0x0806)) - { - return false; - } - } - } - - // Filter DHCP packets - if (pol->DHCPFilter) - { - if (p->TypeL3 == L3_IPV4 && - p->TypeL4 == L4_UDP && - p->TypeL7 == L7_DHCPV4) - { - // Discard the DHCP packet - Debug("pol->DHCPFilter: Discard DHCP Packet.\n"); - - return false; - } - } - - // DHCPv6 packet filtering - if (pol->DHCPv6Filter) - { - if (p->TypeL3 == L3_IPV6 && - p->TypeL4 == L4_UDP) - { - if (Endian16(p->L4.UDPHeader->DstPort) == 546 || - Endian16(p->L4.UDPHeader->DstPort) == 547) - { - // Discard the DHCPv6 packet - Debug("pol->DHCPv6Filter: Discard DHCPv6 Packet.\n"); - - return false; - } - } - } - - // The behavior as a DHCP server is prohibited - if (pol->DHCPNoServer) - { - if (p->TypeL3 == L3_IPV4 && - p->TypeL4 == L4_UDP && - p->TypeL7 == L7_DHCPV4) - { - DHCPV4_HEADER *h = p->L7.DHCPv4Header; - if (h->OpCode == 2) - { - char ip1[64], ip2[64]; - - // Discard the DHCP packet - IPToStr32(ip1, sizeof(ip1), p->L3.IPv4Header->SrcIP); - IPToStr32(ip2, sizeof(ip2), p->L3.IPv4Header->DstIP); - - if (no_heavy == false) - { - HLog(s->Hub, "LH_NO_DHCP", s->Name, ip1, ip2); - } - - // Discard the DHCP response packet - Debug("pol->DHCPNoServer: Discard DHCP Response Packet.\n"); - return false; - } - } - } - - // The behavior as a DHCPv6 server is prohibited - if (pol->DHCPv6NoServer) - { - if (p->TypeL3 == L3_IPV6 && - p->TypeL4 == L4_UDP && - (Endian16(p->L4.UDPHeader->DstPort) == 546 || Endian16(p->L4.UDPHeader->SrcPort) == 547)) - { - char ip1[128], ip2[128]; - - // Discard the DHCP packet - IP6AddrToStr(ip1, sizeof(ip1), &p->L3.IPv6Header->SrcAddress); - IP6AddrToStr(ip2, sizeof(ip2), &p->L3.IPv6Header->DestAddress); - - if (no_heavy == false) - { - HLog(s->Hub, "LH_NO_DHCP", s->Name, ip1, ip2); - } - - // Discard the DHCP response packet - Debug("pol->DHCPv6NoServer: Discard DHCPv6 Response Packet.\n"); - return false; - } - } - - // Filter the Router Solicitation / Advertising packet (IPv6) - if (pol->RSandRAFilter) - { - if (p->TypeL3 == L3_IPV6 && p->TypeL4 == L4_ICMPV6 && - (p->ICMPv6HeaderPacketInfo.Type == ICMPV6_TYPE_ROUTER_SOLICIATION || - p->ICMPv6HeaderPacketInfo.Type == ICMPV6_TYPE_ROUTER_ADVERTISEMENT)) - { - return false; - } - } - - // Filter the router advertisement packet (IPv6) - if (pol->RAFilter) - { - if (p->TypeL3 == L3_IPV6 && p->TypeL4 == L4_ICMPV6 && - p->ICMPv6HeaderPacketInfo.Type == ICMPV6_TYPE_ROUTER_ADVERTISEMENT) - { - return false; - } - } - - // Register to the IP table by recording the DHCP response packet - if (p->TypeL3 == L3_IPV4 && - p->TypeL4 == L4_UDP && - p->TypeL7 == L7_DHCPV4 && - (s->Hub != NULL && s->Hub->Option->NoIpTable == false)) - { - DHCPV4_HEADER *h = p->L7.DHCPv4Header; - if (h->OpCode == 2 && p->DhcpOpCode == DHCP_ACK) - { - // Register to the IP table by peeking the contents of the DHCP response packet - if (h->HardwareType == ARP_HARDWARE_TYPE_ETHERNET) - { - if (h->HardwareAddressSize == 6) - { - if (h->YourIP != 0 && h->YourIP != 0xffffffff) - { - UINT ip_uint = h->YourIP; - IP ip; - IP_TABLE_ENTRY *e, t; - MAC_TABLE_ENTRY *mac_table, mt; - mt.VlanId = 0; - Copy(&mt.MacAddress, &h->ClientMacAddress, 6); - mac_table = SearchHash(hub->MacHashTable, &mt); - - if (mac_table != NULL) - { - bool new_entry = true; - UINTToIP(&ip, ip_uint); - Copy(&t.Ip, &ip, sizeof(IP)); - - e = Search(hub->IpTable, &t); - if (e == NULL) - { - // Register as a new item - e = ZeroMalloc(sizeof(IP_TABLE_ENTRY)); -UPDATE_DHCP_ALLOC_ENTRY: - e->CreatedTime = e->UpdatedTime = Tick64(); - e->DhcpAllocated = true; - Copy(&e->Ip, &ip, sizeof(IP)); - e->Session = mac_table->Session; - Copy(e->MacAddress, p->MacAddressDest, 6); - - if (new_entry) - { - // Delete the expired IP table entries - DeleteExpiredIpTableEntry(hub->IpTable); - if (LIST_NUM(hub->IpTable) >= MAX_IP_TABLES) - { - // Remove old entries - DeleteOldIpTableEntry(hub->IpTable); - } - Insert(hub->IpTable, e); - - - if ((hub->Option != NULL && hub->Option->NoDhcpPacketLogOutsideHub == false) || mac_table->Session != s) - { - char dhcp_mac_addr[64]; - char dest_mac_addr[64]; - char dest_ip_addr[64]; - char server_ip_addr[64]; - MacToStr(dhcp_mac_addr, sizeof(dhcp_mac_addr), p->MacAddressSrc); - MacToStr(dest_mac_addr, sizeof(dest_mac_addr), h->ClientMacAddress); - IPToStr(dest_ip_addr, sizeof(dest_ip_addr), &ip); - IPToStr32(server_ip_addr, sizeof(server_ip_addr), p->L3.IPv4Header->SrcIP); - Debug("DHCP Allocated; dhcp server: %s, client: %s, new_ip: %s\n", - dhcp_mac_addr, dest_mac_addr, dest_ip_addr); - - if (no_heavy == false) - { - HLog(s->Hub, "LH_REGIST_DHCP", s->Name, dhcp_mac_addr, server_ip_addr, - mac_table->Session->Name, dest_mac_addr, dest_ip_addr); - } - } - } - } - else - { - // Update - new_entry = false; - goto UPDATE_DHCP_ALLOC_ENTRY; - } - } - } - } - } - } - } - - return true; -} - -// Delete the expired MAC table entries -void DeleteExpiredMacTableEntry(HASH_LIST *h) -{ - LIST *o2; - UINT i; - MAC_TABLE_ENTRY **pp; - UINT num; - // Validate arguments - if (h == NULL) - { - return; - } - - o2 = NewListFast(NULL); - - pp = (MAC_TABLE_ENTRY **)HashListToArray(h, &num); - - for (i = 0;i < num;i++) - { - MAC_TABLE_ENTRY *e = pp[i]; - if ((e->UpdatedTime + (UINT64)MAC_TABLE_EXPIRE_TIME) <= Tick64()) - { - Add(o2, e); - } - } - - for (i = 0;i < LIST_NUM(o2);i++) - { - MAC_TABLE_ENTRY *e = LIST_DATA(o2, i); - DeleteHash(h, e); - Free(e); - } - - ReleaseList(o2); - - Free(pp); -} - -// Delete the expired IP table entries -void DeleteExpiredIpTableEntry(LIST *o) -{ - LIST *o2; - UINT i; - // Validate arguments - if (o == NULL) - { - return; - } - - o2 = NewListFast(NULL); - - for (i = 0;i < LIST_NUM(o);i++) - { - IP_TABLE_ENTRY *e = LIST_DATA(o, i); - if ((e->UpdatedTime + (UINT64)(e->DhcpAllocated ? IP_TABLE_EXPIRE_TIME_DHCP : IP_TABLE_EXPIRE_TIME)) <= Tick64()) - { - Add(o2, e); - } - } - - for (i = 0;i < LIST_NUM(o2);i++) - { - IP_TABLE_ENTRY *e = LIST_DATA(o2, i); - Delete(o, e); - Free(e); - } - - ReleaseList(o2); -} - -// Determine whether the packet to be handled with priority -bool IsMostHighestPriorityPacket(SESSION *s, PKT *p) -{ - // Validate arguments - if (s == NULL || p == NULL) - { - return false; - } - - if (p->TypeL3 == L3_ARPV4) - { - // ARP packets - return true; - } - - if (p->TypeL3 == L3_IPV4) - { - if (p->TypeL4 == L4_ICMPV4) - { - // ICMP packets - return true; - } - - if (p->TypeL4 == L4_TCP) - { - if ((p->L4.TCPHeader->Flag & TCP_SYN) || (p->L4.TCPHeader->Flag & TCP_FIN) - || (p->L4.TCPHeader->Flag & TCP_RST)) - { - // SYN, FIN, RST packet - return true; - } - } - - if (p->TypeL4 == L4_UDP) - { - if (p->TypeL7 == L7_DHCPV4) - { - // DHCP packets - return true; - } - } - } - - return false; -} - -// Add a packet to traffic limiter -void IntoTrafficLimiter(TRAFFIC_LIMITER *tr, PKT *p) -{ - UINT64 now = Tick64(); - // Validate arguments - if (tr == NULL || p == NULL) - { - return; - } - - if (tr->LastTime == 0 || tr->LastTime > now || - (tr->LastTime + LIMITER_SAMPLING_SPAN) < now) - { - // Sampling initialization - tr->Value = 0; - tr->LastTime = now; - } - - // Value increase - tr->Value += (UINT64)p->PacketSize * (UINT64)8; -} - -// The bandwidth reduction by traffic limiter -bool StorePacketFilterByTrafficLimiter(SESSION *s, PKT *p) -{ - HUB_PA *pa; - TRAFFIC_LIMITER *tr; - // Validate arguments - if (s == NULL || p == NULL) - { - return false; - } - - if (s->Policy->MaxUpload == 0) - { - // Unlimited - return true; - } - - pa = (HUB_PA *)s->PacketAdapter->Param; - tr = &pa->UploadLimiter; - - // Restrictions are not applied for priority packets - if (IsMostHighestPriorityPacket(s, p)) - { - return true; - } - - // Input packets to the limiter - IntoTrafficLimiter(tr, p); - - // Compare the current bandwidth and limit value - if ((tr->Value * (UINT64)1000 / (UINT64)LIMITER_SAMPLING_SPAN) > s->Policy->MaxUpload) - { - // Discard the packet - return false; - } - - return true; -} - -// Filtering of packets to store -bool StorePacketFilter(SESSION *s, PKT *packet) -{ - // Validate arguments - if (s == NULL || packet == NULL) - { - return false; - } - - // The bandwidth reduction by traffic limiter - if (StorePacketFilterByTrafficLimiter(s, packet) == false) - { - return false; - } - - // Packet filter by policy - if (StorePacketFilterByPolicy(s, packet) == false) - { - return false; - } - - // The packet filter with Access Lists - if (ApplyAccessListToStoredPacket(s->Hub, s, packet) == false) - { - return false; - } - - return true; -} - -// Get the packet adapter for the HUB -PACKET_ADAPTER *GetHubPacketAdapter() -{ - // Hand over by creating a function list - PACKET_ADAPTER *pa = NewPacketAdapter(HubPaInit, - HubPaGetCancel, HubPaGetNextPacket, HubPaPutPacket, HubPaFree); - - return pa; -} - -// Stop all the SESSION of the HUB -void StopAllSession(HUB *h) -{ - SESSION **s; - UINT i, num; - // Validate arguments - if (h == NULL) - { - return; - } - - LockList(h->SessionList); - { - num = LIST_NUM(h->SessionList); - s = ToArray(h->SessionList); - DeleteAll(h->SessionList); - } - UnlockList(h->SessionList); - - for (i = 0;i < num;i++) - { - StopSession(s[i]); - ReleaseSession(s[i]); - } - - Free(s); -} - -// Remove the SESSION from HUB -void DelSession(HUB *h, SESSION *s) -{ - // Validate arguments - if (h == NULL || s == NULL) - { - return; - } - - LockList(h->SessionList); - { - if (Delete(h->SessionList, s)) - { - Debug("Session %s was Deleted from %s.\n", s->Name, h->Name); - ReleaseSession(s); - } - } - UnlockList(h->SessionList); -} - -// Add a SESSION to the HUB -void AddSession(HUB *h, SESSION *s) -{ - // Validate arguments - if (h == NULL || s == NULL) - { - return; - } - - LockList(h->SessionList); - { - Insert(h->SessionList, s); - AddRef(s->ref); - Debug("Session %s Inserted to %s.\n", s->Name, h->Name); - - if (s->InProcMode) - { - s->UniqueId = GetNewUniqueId(h); - } - } - UnlockList(h->SessionList); -} - -// Create a new unique ID of the HUB -UINT GetNewUniqueId(HUB *h) -{ - UINT id; - // Validate arguments - if (h == NULL) - { - return 0; - } - - for (id = 1;;id++) - { - if (SearchSessionByUniqueId(h, id) == NULL) - { - return id; - } - } -} - -// Search for a session by the unique session ID -SESSION *SearchSessionByUniqueId(HUB *h, UINT id) -{ - UINT i; - // Validate arguments - if (h == NULL) - { - return NULL; - } - - for (i = 0;i < LIST_NUM(h->SessionList);i++) - { - SESSION *s = LIST_DATA(h->SessionList, i); - - if (s->UniqueId == id) - { - return s; - } - } - - return NULL; -} - -// Stop the operation of the HUB -void StopHub(HUB *h) -{ - bool old_status = false; - // Validate arguments - if (h == NULL) - { - return; - } - - old_status = h->Offline; - h->HubIsOnlineButHalting = true; - - SetHubOffline(h); - - if (h->Halt == false) - { - SLog(h->Cedar, "LS_HUB_STOP", h->Name); - h->Halt = true; - } - - h->Offline = old_status; - h->HubIsOnlineButHalting = false; -} - -// Online the Virtual HUB -void SetHubOnline(HUB *h) -{ - bool for_cluster = false; - // Validate arguments - if (h == NULL) - { - return; - } - - if (h->Cedar->Server != NULL && h->Cedar->Server->ServerType == SERVER_TYPE_FARM_CONTROLLER) - { - if (h->Type == HUB_TYPE_FARM_DYNAMIC) - { - for_cluster = true; - } - } - - Lock(h->lock_online); - { - if (h->Offline == false) - { - Unlock(h->lock_online); - return; - } - HLog(h, "LH_ONLINE"); - - // Start all links - StartAllLink(h); - - // Start the SecureNAT - if (h->EnableSecureNAT) - { - if (h->SecureNAT == NULL) - { - if (for_cluster == false) - { - h->SecureNAT = SnNewSecureNAT(h, h->SecureNATOption); - } - } - } - - // Start all of the local bridges that is associated with this HUB - if (h->Type != HUB_TYPE_FARM_DYNAMIC) - { - LockList(h->Cedar->LocalBridgeList); - { - UINT i; - for (i = 0;i < LIST_NUM(h->Cedar->LocalBridgeList);i++) - { - LOCALBRIDGE *br = LIST_DATA(h->Cedar->LocalBridgeList, i); - - if (StrCmpi(br->HubName, h->Name) == 0) - { - if (br->Bridge == NULL) - { - br->Bridge = BrNewBridge(h, br->DeviceName, NULL, br->Local, br->Monitor, - br->TapMode, br->TapMacAddress, br->LimitBroadcast, br); - } - } - } - } - UnlockList(h->Cedar->LocalBridgeList); - } - - h->Offline = false; - } - Unlock(h->lock_online); - - if (h->Cedar->Server != NULL) - { - SiHubOnlineProc(h); - } -} - -// Offline the Virtual HUB -void SetHubOffline(HUB *h) -{ - UINT i; - bool for_cluster = false; - // Validate arguments - if (h == NULL) - { - return; - } - - if (h->Cedar->Server != NULL && h->Cedar->Server->ServerType == SERVER_TYPE_FARM_CONTROLLER) - { - if (h->Type == HUB_TYPE_FARM_DYNAMIC) - { - for_cluster = true; - } - } - - h->BeingOffline = true; - - Lock(h->lock_online); - { - if (h->Offline || h->Halt) - { - Unlock(h->lock_online); - h->BeingOffline = false; - return; - } - - HLog(h, "LH_OFFLINE"); - - // Stop all links - StopAllLink(h); - - // Stop the SecureNAT - SnFreeSecureNAT(h->SecureNAT); - h->SecureNAT = NULL; - - // Stop all the local bridges that is associated with this HUB - LockList(h->Cedar->LocalBridgeList); - { - for (i = 0;i < LIST_NUM(h->Cedar->LocalBridgeList);i++) - { - LOCALBRIDGE *br = LIST_DATA(h->Cedar->LocalBridgeList, i); - - if (StrCmpi(br->HubName, h->Name) == 0) - { - BrFreeBridge(br->Bridge); - br->Bridge = NULL; - } - } - } - UnlockList(h->Cedar->LocalBridgeList); - - // Offline - h->Offline = true; - - // Disconnect all sessions - StopAllSession(h); - } - Unlock(h->lock_online); - - h->BeingOffline = false; - - if (h->Cedar->Server != NULL) - { - SiHubOfflineProc(h); - } -} - -// Get whether a HUB which have the specified name exists -bool IsHub(CEDAR *cedar, char *name) -{ - HUB *h; - // Validate arguments - if (cedar == NULL || name == NULL) - { - return false; - } - - h = GetHub(cedar, name); - if (h == NULL) - { - return false; - } - - ReleaseHub(h); - - return true; -} - -// Get the HUB -HUB *GetHub(CEDAR *cedar, char *name) -{ - HUB *h, t; - // Validate arguments - if (cedar == NULL || name == NULL) - { - return NULL; - } - - LockHubList(cedar); - - t.Name = name; - h = Search(cedar->HubList, &t); - if (h == NULL) - { - UnlockHubList(cedar); - return NULL; - } - - AddRef(h->ref); - - UnlockHubList(cedar); - - return h; -} - -// Lock the HUB list -void LockHubList(CEDAR *cedar) -{ - // Validate arguments - if (cedar == NULL) - { - return; - } - - LockList(cedar->HubList); -} - -// Unlock the HUB list -void UnlockHubList(CEDAR *cedar) -{ - // Validate arguments - if (cedar == NULL) - { - return; - } - - UnlockList(cedar->HubList); -} - -// Release the HUB -void ReleaseHub(HUB *h) -{ - // Validate arguments - if (h == NULL) - { - return; - } - - if (Release(h->ref) == 0) - { - CleanupHub(h); - } -} - -// Get the Radius server information -bool GetRadiusServer(HUB *hub, char *name, UINT size, UINT *port, char *secret, UINT secret_size) -{ - UINT interval; - return GetRadiusServerEx(hub, name, size, port, secret, secret_size, &interval); -} -bool GetRadiusServerEx(HUB *hub, char *name, UINT size, UINT *port, char *secret, UINT secret_size, UINT *interval) -{ - return GetRadiusServerEx2(hub, name, size, port, secret, secret_size, interval, NULL, 0); -} -bool GetRadiusServerEx2(HUB *hub, char *name, UINT size, UINT *port, char *secret, UINT secret_size, UINT *interval, char *suffix_filter, UINT suffix_filter_size) -{ - bool ret = false; - // Validate arguments - if (hub == NULL || name == NULL || port == NULL || secret == NULL || interval == NULL) - { - return false; - } - - Lock(hub->RadiusOptionLock); - { - if (hub->RadiusServerName != NULL) - { - char *tmp; - UINT tmp_size; - StrCpy(name, size, hub->RadiusServerName); - *port = hub->RadiusServerPort; - *interval = hub->RadiusRetryInterval; - - tmp_size = hub->RadiusSecret->Size + 1; - tmp = ZeroMalloc(tmp_size); - Copy(tmp, hub->RadiusSecret->Buf, hub->RadiusSecret->Size); - StrCpy(secret, secret_size, tmp); - Free(tmp); - - if (suffix_filter != NULL) - { - StrCpy(suffix_filter, suffix_filter_size, hub->RadiusSuffixFilter); - } - - ret = true; - } - } - Unlock(hub->RadiusOptionLock); - - return ret; -} - -// Set the Radius server information -void SetRadiusServer(HUB *hub, char *name, UINT port, char *secret) -{ - SetRadiusServerEx(hub, name, port, secret, RADIUS_RETRY_INTERVAL); -} -void SetRadiusServerEx(HUB *hub, char *name, UINT port, char *secret, UINT interval) -{ - // Validate arguments - if (hub == NULL) - { - return; - } - - Lock(hub->RadiusOptionLock); - { - if (hub->RadiusServerName != NULL) - { - Free(hub->RadiusServerName); - } - - if (name == NULL) - { - hub->RadiusServerName = NULL; - hub->RadiusServerPort = 0; - hub->RadiusRetryInterval = RADIUS_RETRY_INTERVAL; - FreeBuf(hub->RadiusSecret); - } - else - { - hub->RadiusServerName = CopyStr(name); - hub->RadiusServerPort = port; - if (interval == 0) - { - hub->RadiusRetryInterval = RADIUS_RETRY_INTERVAL; - } - else if (interval > RADIUS_RETRY_TIMEOUT) - { - hub->RadiusRetryInterval = RADIUS_RETRY_TIMEOUT; - } - else - { - hub->RadiusRetryInterval = interval; - } - FreeBuf(hub->RadiusSecret); - - if (secret == NULL) - { - hub->RadiusSecret = NewBuf(); - } - else - { - hub->RadiusSecret = NewBuf(); - WriteBuf(hub->RadiusSecret, secret, StrLen(secret)); - SeekBuf(hub->RadiusSecret, 0, 0); - } - } - } - Unlock(hub->RadiusOptionLock); -} - -// Add the traffic information for Virtual HUB -void IncrementHubTraffic(HUB *h) -{ - TRAFFIC t; - // Validate arguments - if (h == NULL || h->FarmMember == false) - { - return; - } - - Zero(&t, sizeof(t)); - - Lock(h->TrafficLock); - { - t.Send.BroadcastBytes = - h->Traffic->Send.BroadcastBytes - h->OldTraffic->Send.BroadcastBytes; - t.Send.BroadcastCount = - h->Traffic->Send.BroadcastCount - h->OldTraffic->Send.BroadcastCount; - t.Send.UnicastBytes = - h->Traffic->Send.UnicastBytes - h->OldTraffic->Send.UnicastBytes; - t.Send.UnicastCount = - h->Traffic->Send.UnicastCount - h->OldTraffic->Send.UnicastCount; - t.Recv.BroadcastBytes = - h->Traffic->Recv.BroadcastBytes - h->OldTraffic->Recv.BroadcastBytes; - t.Recv.BroadcastCount = - h->Traffic->Recv.BroadcastCount - h->OldTraffic->Recv.BroadcastCount; - t.Recv.UnicastBytes = - h->Traffic->Recv.UnicastBytes - h->OldTraffic->Recv.UnicastBytes; - t.Recv.UnicastCount = - h->Traffic->Recv.UnicastCount - h->OldTraffic->Recv.UnicastCount; - Copy(h->OldTraffic, h->Traffic, sizeof(TRAFFIC)); - } - Unlock(h->TrafficLock); - - if (IsZero(&t, sizeof(TRAFFIC))) - { - return; - } - - AddTrafficDiff(h, h->Name, TRAFFIC_DIFF_HUB, &t); -} - -// Adding Traffic information -void AddTrafficDiff(HUB *h, char *name, UINT type, TRAFFIC *traffic) -{ - TRAFFIC_DIFF *d; - // Validate arguments - if (h == NULL || h->FarmMember == false || name == NULL || traffic == NULL) - { - return; - } - - if (LIST_NUM(h->Cedar->TrafficDiffList) > MAX_TRAFFIC_DIFF) - { - return; - } - - d = ZeroMallocFast(sizeof(TRAFFIC_DIFF)); - d->HubName = CopyStr(h->Name); - d->Name = CopyStr(name); - d->Type = type; - Copy(&d->Traffic, traffic, sizeof(TRAFFIC)); - - LockList(h->Cedar->TrafficDiffList); - { - Insert(h->Cedar->TrafficDiffList, d); - } - UnlockList(h->Cedar->TrafficDiffList); -} - -// Cleanup of HUB -void CleanupHub(HUB *h) -{ - UINT i; - char name[MAX_SIZE]; - // Validate arguments - if (h == NULL) - { - return; - } - - StrCpy(name, sizeof(name), h->Name); - - if (h->WatchDogStarted) - { - StopHubWatchDog(h); - } - - FreeAccessList(h); - - if (h->RadiusServerName != NULL) - { - Free(h->RadiusServerName); - FreeBuf(h->RadiusSecret); - } - ReleaseAllLink(h); - DeleteHubDb(h->HubDb); - ReleaseCedar(h->Cedar); - DeleteLock(h->lock); - DeleteLock(h->lock_online); - Free(h->Name); - ReleaseList(h->SessionList); - ReleaseHashList(h->MacHashTable); - ReleaseList(h->IpTable); - ReleaseList(h->MonitorList); - ReleaseList(h->LinkList); - DeleteCounter(h->NumSessions); - DeleteCounter(h->NumSessionsClient); - DeleteCounter(h->NumSessionsBridge); - DeleteCounter(h->SessionCounter); - FreeTraffic(h->Traffic); - FreeTraffic(h->OldTraffic); - Free(h->Option); - - Free(h->SecureNATOption); - - DeleteLock(h->TrafficLock); - - for (i = 0;i < LIST_NUM(h->TicketList);i++) - { - Free(LIST_DATA(h->TicketList, i)); - } - - ReleaseList(h->TicketList); - - DeleteLock(h->RadiusOptionLock); - - FreeLog(h->PacketLogger); - FreeLog(h->SecurityLogger); - - for (i = 0;i < LIST_NUM(h->AdminOptionList);i++) - { - Free(LIST_DATA(h->AdminOptionList, i)); - } - ReleaseList(h->AdminOptionList); - - if (h->Msg != NULL) - { - Free(h->Msg); - } - - FreeUserList(h->UserList); - - Free(h); -} - -// Comparison function of IP table entries -int CompareIpTable(void *p1, void *p2) -{ - IP_TABLE_ENTRY *e1, *e2; - if (p1 == NULL || p2 == NULL) - { - return 0; - } - e1 = *(IP_TABLE_ENTRY **)p1; - e2 = *(IP_TABLE_ENTRY **)p2; - if (e1 == NULL || e2 == NULL) - { - return 0; - } - return CmpIpAddr(&e1->Ip, &e2->Ip); -} - -// Get hash of MAC table entry -UINT GetHashOfMacTable(void *p) -{ - UINT v; - MAC_TABLE_ENTRY *e = p; - - if (e == NULL) - { - return 0; - } - - v = e->MacAddress[0] + e->MacAddress[1] + e->MacAddress[2] + - e->MacAddress[3] + e->MacAddress[4] + e->MacAddress[5] + - e->VlanId; - - return v; -} - -// Comparison function of the MAC table entries -int CompareMacTable(void *p1, void *p2) -{ - int r; - MAC_TABLE_ENTRY *e1, *e2; - if (p1 == NULL || p2 == NULL) - { - return 0; - } - e1 = *(MAC_TABLE_ENTRY **)p1; - e2 = *(MAC_TABLE_ENTRY **)p2; - if (e1 == NULL || e2 == NULL) - { - return 0; - } - r = memcmp(e1->MacAddress, e2->MacAddress, 6); - if (r != 0) - { - return r; - } - if (e1->VlanId > e2->VlanId) - { - return 1; - } - else if (e1->VlanId < e2->VlanId) - { - return -1; - } - return 0; -} - -// Comparison function of HUB -int CompareHub(void *p1, void *p2) -{ - HUB *h1, *h2; - if (p1 == NULL || p2 == NULL) - { - return 0; - } - h1 = *(HUB **)p1; - h2 = *(HUB **)p2; - if (h1 == NULL || h2 == NULL) - { - return 0; - } - return StrCmpi(h1->Name, h2->Name); -} - -// Examine whether the MAC address is for the ARP polling of the Virtual HUB -bool IsHubMacAddress(UCHAR *mac) -{ - // Validate arguments - if (mac == NULL) - { - return false; - } - - if (mac[0] == 0x00 && mac[1] == SE_HUB_MAC_ADDR_SIGN) - { - return true; - } - - return false; -} - -// Examine whether the IP address is for the ARP polling of the Virtual HUB -bool IsHubIpAddress32(UINT ip32) -{ - IP ip; - - UINTToIP(&ip, ip32); - - return IsHubIpAddress(&ip); -} -bool IsHubIpAddress(IP *ip) -{ - // Validate arguments - if (ip == NULL) - { - return false; - } - - if (ip->addr[0] == 172 && ip->addr[1] == 31) - { - if (ip->addr[2] >= 1 && ip->addr[2] <= 254) - { - if (ip->addr[3] >= 1 && ip->addr[3] <= 254) - { - return true; - } - } - } - - return false; -} -bool IsHubIpAddress64(IPV6_ADDR *addr) -{ - // Validate arguments - if (addr == NULL) - { - return false; - } - - if (addr->Value[0] == 0xfe && addr->Value[1] == 0x80 && - addr->Value[2] == 0 && - addr->Value[3] == 0 && - addr->Value[4] == 0 && - addr->Value[5] == 0 && - addr->Value[6] == 0 && - addr->Value[7] == 0 && - addr->Value[8] == 0x02 && addr->Value[9] == 0xae && - addr->Value[11] == 0xff && addr->Value[12] == 0xfe) - { - return true; - } - - return false; -} - -// Generate an IP address for the Virtual HUB -void GenHubIpAddress(IP *ip, char *name) -{ - char tmp1[MAX_SIZE]; - char tmp2[MAX_SIZE]; - UCHAR hash[SHA1_SIZE]; - // Validate arguments - if (ip == NULL || name == NULL) - { - return; - } - - StrCpy(tmp1, sizeof(tmp1), name); - Trim(tmp1); - GenerateMachineUniqueHash(hash); - BinToStr(tmp2, sizeof(tmp2), hash, sizeof(hash)); - StrCat(tmp2, sizeof(tmp2), tmp1); - StrUpper(tmp2); - - Sha0(hash, tmp2, StrLen(tmp2)); - - Zero(ip, sizeof(IP)); - ip->addr[0] = 172; - ip->addr[1] = 31; - ip->addr[2] = hash[0] % 254 + 1; - ip->addr[3] = hash[1] % 254 + 1; -} - -// Generate a MAC address for the Virtual HUB -void GenHubMacAddress(UCHAR *mac, char *name) -{ - char tmp1[MAX_SIZE]; - char tmp2[MAX_SIZE]; - UCHAR hash[SHA1_SIZE]; - // Validate arguments - if (mac == NULL || name == NULL) - { - return; - } - - StrCpy(tmp1, sizeof(tmp1), name); - Trim(tmp1); - GenerateMachineUniqueHash(hash); - BinToStr(tmp2, sizeof(tmp2), hash, sizeof(hash)); - StrCat(tmp2, sizeof(tmp2), tmp1); - StrUpper(tmp2); - - Sha0(hash, tmp2, StrLen(tmp2)); - - mac[0] = 0x00; - mac[1] = SE_HUB_MAC_ADDR_SIGN; - mac[2] = hash[0]; - mac[3] = hash[1]; - mac[4] = hash[2]; - mac[5] = hash[3]; -} - -// Get a message from HUB -wchar_t *GetHubMsg(HUB *h) -{ - wchar_t *ret = NULL; - // Validate arguments - if (h == NULL) - { - return NULL; - } - - Lock(h->lock); - { - if (h->Msg != NULL) - { - ret = CopyUniStr(h->Msg); - } - } - Unlock(h->lock); - - return ret; -} - -// Set a message to the HUB -void SetHubMsg(HUB *h, wchar_t *msg) -{ - // Validate arguments - if (h == NULL) - { - return; - } - - Lock(h->lock); - { - if (h->Msg != NULL) - { - Free(h->Msg); - h->Msg = NULL; - } - - if (UniIsEmptyStr(msg) == false) - { - h->Msg = UniCopyStr(msg); - } - } - Unlock(h->lock); -} - -// Creating a new HUB -HUB *NewHub(CEDAR *cedar, char *HubName, HUB_OPTION *option) -{ - HUB *h; - char packet_logger_name[MAX_SIZE]; - char tmp[MAX_SIZE]; - char safe_hub_name[MAX_HUBNAME_LEN + 1]; - UCHAR hash[SHA1_SIZE]; - IP ip6; - // Validate arguments - if (cedar == NULL || option == NULL || HubName == NULL) - { - return NULL; - } - - h = ZeroMalloc(sizeof(HUB)); - Sha0(h->HashedPassword, "", 0); - HashPassword(h->SecurePassword, ADMINISTRATOR_USERNAME, ""); - h->lock = NewLock(); - h->lock_online = NewLock(); - h->ref = NewRef(); - h->Cedar = cedar; - AddRef(h->Cedar->ref); - h->Type = HUB_TYPE_STANDALONE; - - ConvertSafeFileName(safe_hub_name, sizeof(safe_hub_name), HubName); - h->Name = CopyStr(safe_hub_name); - - - h->AdminOptionList = NewList(CompareAdminOption); - AddHubAdminOptionsDefaults(h, true); - - h->LastCommTime = SystemTime64(); - h->LastLoginTime = SystemTime64(); - h->NumLogin = 0; - - h->TrafficLock = NewLock(); - - h->HubDb = NewHubDb(); - - h->SessionList = NewList(NULL); - h->SessionCounter = NewCounter(); - h->NumSessions = NewCounter(); - h->NumSessionsClient = NewCounter(); - h->NumSessionsBridge = NewCounter(); - h->MacHashTable = NewHashList(GetHashOfMacTable, CompareMacTable, 8, false); - h->IpTable = NewList(CompareIpTable); - h->MonitorList = NewList(NULL); - h->LinkList = NewList(NULL); - - h->Traffic = NewTraffic(); - h->OldTraffic = NewTraffic(); - - h->Option = ZeroMalloc(sizeof(HUB_OPTION)); - Copy(h->Option, option, sizeof(HUB_OPTION)); - - if (h->Option->VlanTypeId == 0) - { - h->Option->VlanTypeId = MAC_PROTO_TAGVLAN; - } - - h->Option->DropBroadcastsInPrivacyFilterMode = true; - h->Option->DropArpInPrivacyFilterMode = true; - - Rand(h->HubSignature, sizeof(h->HubSignature)); - - // SecureNAT related - h->EnableSecureNAT = false; - h->SecureNAT = NULL; - h->SecureNATOption = ZeroMalloc(sizeof(VH_OPTION)); - NiSetDefaultVhOption(NULL, h->SecureNATOption); - - if (h->Cedar != NULL && h->Cedar->Server != NULL && h->Cedar->Server->ServerType == SERVER_TYPE_FARM_CONTROLLER) - { - NiClearUnsupportedVhOptionForDynamicHub(h->SecureNATOption, true); - } - - // Generate a temporary MAC address for the HUB - GenerateMachineUniqueHash(hash); - GenHubMacAddress(h->HubMacAddr, h->Name); - GenHubIpAddress(&h->HubIp, h->Name); - - // IPv6 address for the HUB - GenerateEui64LocalAddress(&ip6, h->HubMacAddr); - IPToIPv6Addr(&h->HubIpV6, &ip6); - - h->RadiusOptionLock = NewLock(); - h->RadiusServerPort = RADIUS_DEFAULT_PORT; - - h->TicketList = NewList(NULL); - - InitAccessList(h); - - // Create a user list - h->UserList = NewUserList(); - - // Default logging settings - h->LogSetting.SavePacketLog = h->LogSetting.SaveSecurityLog = true; - h->LogSetting.PacketLogConfig[PACKET_LOG_TCP_CONN] = - h->LogSetting.PacketLogConfig[PACKET_LOG_DHCP] = PACKET_LOG_HEADER; - h->LogSetting.SecurityLogSwitchType = LOG_SWITCH_DAY; - h->LogSetting.PacketLogSwitchType = LOG_SWITCH_DAY; - - MakeDir(HUB_SECURITY_LOG_DIR_NAME); - MakeDir(HUB_PACKET_LOG_DIR_NAME); - - // Start the packet logger - Format(packet_logger_name, sizeof(packet_logger_name), HUB_PACKET_LOG_FILE_NAME, h->Name); - h->PacketLogger = NewLog(packet_logger_name, HUB_PACKET_LOG_PREFIX, h->LogSetting.PacketLogSwitchType); - - // Start the security logger - Format(tmp, sizeof(tmp), HUB_SECURITY_LOG_FILE_NAME, h->Name); - h->SecurityLogger = NewLog(tmp, HUB_SECURITY_LOG_PREFIX, h->LogSetting.SecurityLogSwitchType); - - if (h->Cedar->Server != NULL && h->Cedar->Server->ServerType == SERVER_TYPE_FARM_MEMBER) - { - h->FarmMember = true; - } - - // Start the HUB - SetHubOnline(h); - - if (h->Cedar->Bridge) - { - h->Option->NoArpPolling = true; - } - - if (h->Option->NoArpPolling == false && h->Option->NoIpTable == false) - { - StartHubWatchDog(h); - h->WatchDogStarted = true; - } - - SLog(h->Cedar, "LS_HUB_START", h->Name); - - MacToStr(tmp, sizeof(tmp), h->HubMacAddr); - SLog(h->Cedar, "LS_HUB_MAC", h->Name, tmp); - - return h; -} - -// Delete the HUBDB -void DeleteHubDb(HUBDB *d) -{ - // Validate arguments - if (d == NULL) - { - return; - } - - LockList(d->UserList); - { - LockList(d->GroupList); - { - // Release all users and groups - UINT i; - USER **users; - USERGROUP **groups; - - users = ToArray(d->UserList); - groups = ToArray(d->GroupList); - - for (i = 0;i < LIST_NUM(d->UserList);i++) - { - ReleaseUser(users[i]); - } - for (i = 0;i < LIST_NUM(d->GroupList);i++) - { - ReleaseGroup(groups[i]); - } - - Free(users); - Free(groups); - } - UnlockList(d->GroupList); - } - UnlockList(d->UserList); - - // Release the root certificate list - LockList(d->RootCertList); - { - UINT i; - for (i = 0;i < LIST_NUM(d->RootCertList);i++) - { - X *x = LIST_DATA(d->RootCertList, i); - FreeX(x); - } - } - UnlockList(d->RootCertList); - - // Release the CRL - LockList(d->CrlList); - { - UINT i; - for (i = 0;i < LIST_NUM(d->CrlList);i++) - { - CRL *crl = LIST_DATA(d->CrlList, i); - FreeCrl(crl); - } - } - UnlockList(d->CrlList); - - // Release the AC list - FreeAcList(d->AcList); - - ReleaseList(d->GroupList); - ReleaseList(d->UserList); - ReleaseList(d->RootCertList); - ReleaseList(d->CrlList); - Free(d); -} - -// Get a log setting of the HUB -void GetHubLogSetting(HUB *h, HUB_LOG *setting) -{ - // Validate arguments - if (setting == NULL || h == NULL) - { - return; - } - - Copy(setting, &h->LogSetting, sizeof(HUB_LOG)); -} - -// Update the log settings of the HUB -void SetHubLogSettingEx(HUB *h, HUB_LOG *setting, bool no_change_switch_type) -{ - UINT i1, i2; - // Validate arguments - if (setting == NULL || h == NULL) - { - return; - } - - i1 = h->LogSetting.PacketLogSwitchType; - i2 = h->LogSetting.SecurityLogSwitchType; - - Copy(&h->LogSetting, setting, sizeof(HUB_LOG)); - - if (no_change_switch_type) - { - h->LogSetting.PacketLogSwitchType = i1; - h->LogSetting.SecurityLogSwitchType = i2; - } - - // Packet logger configuration - SetLogSwitchType(h->PacketLogger, setting->PacketLogSwitchType); - SetLogSwitchType(h->SecurityLogger, setting->SecurityLogSwitchType); -} -void SetHubLogSetting(HUB *h, HUB_LOG *setting) -{ - SetHubLogSettingEx(h, setting, false); -} - -// Add the trusted root certificate to the HUB -void AddRootCert(HUB *hub, X *x) -{ - HUBDB *db; - // Validate arguments - if (hub == NULL || x == NULL) - { - return; - } - - db = hub->HubDb; - if (db != NULL) - { - LockList(db->RootCertList); - { - if (LIST_NUM(db->RootCertList) < MAX_HUB_CERTS) - { - UINT i; - bool ok = true; - - for (i = 0;i < LIST_NUM(db->RootCertList);i++) - { - X *exist_x = LIST_DATA(db->RootCertList, i); - if (CompareX(exist_x, x)) - { - ok = false; - break; - } - } - - if (ok) - { - Insert(db->RootCertList, CloneX(x)); - } - } - } - UnlockList(db->RootCertList); - } -} - -// Compare the list of certificates -int CompareCert(void *p1, void *p2) -{ - X *x1, *x2; - wchar_t tmp1[MAX_SIZE]; - wchar_t tmp2[MAX_SIZE]; - if (p1 == NULL || p2 == NULL) - { - return 0; - } - x1 = *(X **)p1; - x2 = *(X **)p2; - if (x1 == NULL || x2 == NULL) - { - return 0; - } - - GetPrintNameFromX(tmp1, sizeof(tmp1), x1); - GetPrintNameFromX(tmp2, sizeof(tmp2), x2); - - return UniStrCmpi(tmp1, tmp2); -} - -// Creating a new HUBDB -HUBDB *NewHubDb() -{ - HUBDB *d = ZeroMalloc(sizeof(HUBDB)); - - d->GroupList = NewList(CompareGroupName); - d->UserList = NewList(CompareUserName); - d->RootCertList = NewList(CompareCert); - d->CrlList = NewList(NULL); - d->AcList = NewAcList(); - - return d; -} - - +// SoftEther VPN Source Code - Developer Edition Master Branch +// Cedar Communication Module + + +// Hub.c +// Virtual HUB module + +#include "CedarPch.h" + +static UCHAR broadcast[] = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff}; +static char vgs_ua_str[9] = {0}; +static bool g_vgs_emb_tag = false; + +// A list of administration options that are currently supported and its default values +// These names must be shorter than 64 bytes +ADMIN_OPTION admin_options[] = +{ + {"allow_hub_admin_change_option", 0}, + {"max_users", 0}, + {"max_multilogins_per_user", 0}, + {"max_groups", 0}, + {"max_accesslists", 0}, + {"max_sessions_client_bridge_apply", 0}, + {"max_sessions", 0}, + {"max_sessions_client", 0}, + {"max_sessions_bridge", 0}, + {"max_bitrates_download", 0}, + {"max_bitrates_upload", 0}, + {"deny_empty_password", 0}, + {"deny_bridge", 0}, + {"deny_routing", 0}, + {"deny_qos", 0}, + {"deny_change_user_password", 0}, + {"no_change_users", 0}, + {"no_change_groups", 0}, + {"no_securenat", 0}, + {"no_securenat_enablenat", 0}, + {"no_securenat_enabledhcp", 0}, + {"no_cascade", 0}, + {"no_online", 0}, + {"no_offline", 0}, + {"no_change_log_config", 0}, + {"no_disconnect_session", 0}, + {"no_delete_iptable", 0}, + {"no_delete_mactable", 0}, + {"no_enum_session", 0}, + {"no_query_session", 0}, + {"no_change_admin_password", 0}, + {"no_change_log_switch_type", 0}, + {"no_change_access_list", 0}, + {"no_change_access_control_list", 0}, + {"no_change_cert_list", 0}, + {"no_change_crl_list", 0}, + {"no_read_log_file", 0}, + {"deny_hub_admin_change_ext_option", 0}, + {"no_delay_jitter_packet_loss", 0}, + {"no_change_msg", 0}, + {"no_access_list_include_file", 0}, +}; + +UINT num_admin_options = sizeof(admin_options) / sizeof(ADMIN_OPTION); + + +// Create an EAP client for the specified Virtual Hub +EAP_CLIENT *HubNewEapClient(CEDAR *cedar, char *hubname, char *client_ip_str, char *username, char *vpn_protocol_state_str) +{ + HUB *hub = NULL; + EAP_CLIENT *ret = NULL; + char radius_servers[MAX_PATH] = {0}; + UINT radius_port = 0; + UINT radius_retry_interval = 0; + char radius_secret[MAX_PATH] = {0}; + char radius_suffix_filter[MAX_PATH] = {0}; + if (cedar == NULL || hubname == NULL || client_ip_str == NULL || username == NULL) + { + return NULL; + } + + // Find the Virtual Hub + LockHubList(cedar); + { + hub = GetHub(cedar, hubname); + } + UnlockHubList(cedar); + + if (hub != NULL) + { + if (GetRadiusServerEx2(hub, radius_servers, sizeof(radius_servers), &radius_port, radius_secret, + sizeof(radius_secret), &radius_retry_interval, radius_suffix_filter, sizeof(radius_suffix_filter))) + { + bool use_peap = hub->RadiusUsePeapInsteadOfEap; + + if (IsEmptyStr(radius_suffix_filter) || EndWith(username, radius_suffix_filter)) + { + TOKEN_LIST *radius_servers_list = ParseToken(radius_servers, " ,;\t"); + + if (radius_servers_list != NULL && radius_servers_list->NumTokens >= 1) + { + // Try for each of RADIUS servers + UINT i; + bool finish = false; + + for (i = 0;i < radius_servers_list->NumTokens;i++) + { + EAP_CLIENT *eap; + IP ip; + + if (GetIP(&ip, radius_servers_list->Token[i])) + { + eap = NewEapClient(&ip, radius_port, radius_secret, radius_retry_interval, + RADIUS_INITIAL_EAP_TIMEOUT, client_ip_str, username, hubname); + + if (eap != NULL) + { + if (IsEmptyStr(vpn_protocol_state_str) == false) + { + StrCpy(eap->In_VpnProtocolState, sizeof(eap->In_VpnProtocolState), vpn_protocol_state_str); + } + + if (use_peap == false) + { + // EAP + if (EapClientSendMsChapv2AuthRequest(eap)) + { + eap->GiveupTimeout = RADIUS_RETRY_TIMEOUT; + ret = eap; + finish = true; + } + } + else + { + // PEAP + if (PeapClientSendMsChapv2AuthRequest(eap)) + { + eap->GiveupTimeout = RADIUS_RETRY_TIMEOUT; + ret = eap; + finish = true; + } + } + + if (finish == false) + { + ReleaseEapClient(eap); + } + } + } + + if (finish) + { + break; + } + } + } + + FreeToken(radius_servers_list); + } + } + } + + ReleaseHub(hub); + + return ret; +} + +// Create a user list +LIST *NewUserList() +{ + LIST *o = NewList(CompareUserList); + + return o; +} + +// Search whether the specified user matches to the user list (with cache expiration) +bool IsUserMatchInUserListWithCacheExpires(LIST *o, char *filename, UINT64 user_hash, UINT64 lifetime) +{ + bool ret = false; + UINT64 now = Tick64(); + // Validate arguments + if (o == NULL || filename == NULL || user_hash == 0) + { + return false; + } + + LockList(o); + { + if (lifetime != 0) + { + if (o->Param1 == 0 || (now >= (o->Param1 + lifetime))) + { + DeleteAllUserListCache(o); + + o->Param1 = now; + } + } + + ret = IsUserMatchInUserList(o, filename, user_hash); + } + UnlockList(o); + + return ret; +} +bool IsUserMatchInUserListWithCacheExpiresAcl(LIST *o, char *name_in_acl, UINT64 user_hash, UINT64 lifetime) +{ + char tmp[16]; + bool exclude = false; + char filename[MAX_SIZE]; + char filename2[MAX_SIZE]; + bool is_full_path = false; + bool ret = false; + // Validate arguments + if (o == NULL || name_in_acl == NULL || user_hash == 0 || StrLen(name_in_acl) < 9) + { + return false; + } + + StrCpy(tmp, sizeof(tmp), name_in_acl); + StrLower(tmp); + + tmp[8] = 0; + + if (Cmp(tmp, ACCESS_LIST_INCLUDED_PREFIX, 8) == 0) + { + // include + exclude = false; + } + else + { + // exclude + exclude = true; + } + + // Extract the file name + StrCpy(filename, sizeof(filename), name_in_acl + 8); + Trim(filename); + + // Identify whether the file name is an absolute path + if (filename[0] == '\\' || filename[0] == '/' || (filename[1] == ':' && filename[2] == '\\')) + { + is_full_path = true; + } + + if (is_full_path == false) + { + // Prepend a '@' if the file name is a relative path + StrCpy(filename2, sizeof(filename2), "@"); + StrCat(filename2, sizeof(filename2), filename); + StrCpy(filename, sizeof(filename), filename2); + } + + ret = IsUserMatchInUserListWithCacheExpires(o, filename, user_hash, lifetime); + + if (exclude) + { + ret = NEGATIVE_BOOL(ret); + } + + return ret; +} + +// Search whether the specified user matches to the user list +bool IsUserMatchInUserList(LIST *o, char *filename, UINT64 user_hash) +{ + USERLIST *u; + bool ret = false; + // Validate arguments + if (o == NULL || filename == NULL || user_hash == 0) + { + return false; + } + + LockList(o); + { + u = FindUserList(o, filename); + if (u == NULL) + { + u = LoadUserList(o, filename); + } + + if (u != NULL) + { + ret = IsInt64InList(u->UserHashList, user_hash); + } + } + UnlockList(o); + + return ret; +} + +// Read the user list +USERLIST *LoadUserList(LIST *o, char *filename) +{ + USERLIST *u; + BUF *b; + // Validate arguments + if (o == NULL || filename == NULL) + { + return NULL; + } + + u = FindUserList(o, filename); + + if (u != NULL) + { + Delete(o, u); + + FreeUserListEntry(u); + } + + u = ZeroMalloc(sizeof(USERLIST)); + + StrCpy(u->Filename, sizeof(u->Filename), filename); + + u->UserHashList = NewInt64List(false); + + b = ReadDumpWithMaxSize(filename, ACCESS_LIST_INCLUDE_FILE_MAX_SIZE); + if (b != NULL) + { + while (true) + { + char *line = CfgReadNextLine(b); + UINT64 ui; + if (line == NULL) + { + break; + } + + Trim(line); + + if (IsEmptyStr(line) == false) + { + if (StartWith(line, "#") == false && + StartWith(line, "//") == false && + StartWith(line, ";") == false) + { + ui = UsernameToInt64(line); + + AddInt64Distinct(u->UserHashList, ui); + } + } + + Free(line); + } + + FreeBuf(b); + } + + Add(o, u); + + return u; +} + +// Release the user list entry +void FreeUserListEntry(USERLIST *u) +{ + // Validate arguments + if (u == NULL) + { + return; + } + + ReleaseInt64List(u->UserHashList); + + Free(u); +} + +// Search in user list +USERLIST *FindUserList(LIST *o, char *filename) +{ + USERLIST t, *u; + // Validate arguments + if (o == NULL || filename == NULL) + { + return NULL; + } + + Zero(&t, sizeof(t)); + + StrCpy(t.Filename, sizeof(t.Filename), filename); + + u = Search(o, &t); + + return u; +} + +// User list entry comparison function +int CompareUserList(void *p1, void *p2) +{ + USERLIST *u1, *u2; + // Validate arguments + if (p1 == NULL || p2 == NULL) + { + return 0; + } + u1 = *(USERLIST **)p1; + u2 = *(USERLIST **)p2; + if (u1 == NULL || u2 == NULL) + { + return 0; + } + + return StrCmpi(u1->Filename, u2->Filename); +} + +// Delete the cache of the all user list +void DeleteAllUserListCache(LIST *o) +{ + UINT i; + // Validate arguments + if (o == NULL) + { + return; + } + + LockList(o); + { + for (i = 0;i < LIST_NUM(o);i++) + { + USERLIST *u = LIST_DATA(o, i); + + FreeUserListEntry(u); + } + + DeleteAll(o); + } + UnlockList(o); +} + +// Release the user list +void FreeUserList(LIST *o) +{ + UINT i; + // Validate arguments + if (o == NULL) + { + return; + } + + for (i = 0;i < LIST_NUM(o);i++) + { + USERLIST *u = LIST_DATA(o, i); + + FreeUserListEntry(u); + } + + ReleaseList(o); +} + +// Get whether the specified message is a URL string +bool IsURLMsg(wchar_t *str, char *url, UINT url_size) +{ + UNI_TOKEN_LIST *t; + bool ret = false; + UINT i; + UINT n = 0; + // Validate arguments + if (str == NULL) + { + return false; + } + + t = UniParseToken(str, L"\r\n"); + + for (i = 0;i < t->NumTokens;i++) + { + wchar_t *str = t->Token[i]; + + if (IsEmptyUniStr(str) == false) + { + n++; + + UniTrim(str); + + if (n == 1) + { + if (UniStartWith(str, L"http://") || + UniStartWith(str, L"https://") || + UniStartWith(str, L"ftp://")) + { + ret = true; + + UniToStr(url, url_size, str); + } + } + } + } + + if (n != 1) + { + ret = false; + } + + UniFreeToken(t); + + return ret; +} + +// Get data from RPC_ADMIN_OPTION +UINT GetHubAdminOptionData(RPC_ADMIN_OPTION *ao, char *name) +{ + UINT i; + // Validate arguments + if (ao == NULL || name == NULL) + { + return INFINITE; + } + + for (i = 0;i < ao->NumItem;i++) + { + ADMIN_OPTION *a = &ao->Items[i]; + + if (StrCmpi(a->Name, name) == 0) + { + return a->Value; + } + } + + return INFINITE; +} +void GetHubAdminOptionDataAndSet(RPC_ADMIN_OPTION *ao, char *name, UINT *dest) +{ + UINT value; + // Validate arguments + if (ao == NULL || name == NULL || dest == NULL) + { + return; + } + + value = GetHubAdminOptionData(ao, name); + if (value == INFINITE) + { + return; + } + + *dest = value; +} + +// Set the contents of the HUB_OPTION based on the data +void DataToHubOptionStruct(HUB_OPTION *o, RPC_ADMIN_OPTION *ao) +{ + // Validate arguments + if (o == NULL || ao == NULL) + { + return; + } + + GetHubAdminOptionDataAndSet(ao, "NoAddressPollingIPv4", &o->NoArpPolling); + GetHubAdminOptionDataAndSet(ao, "NoAddressPollingIPv6", &o->NoIPv6AddrPolling); + GetHubAdminOptionDataAndSet(ao, "NoIpTable", &o->NoIpTable); + GetHubAdminOptionDataAndSet(ao, "NoMacAddressLog", &o->NoMacAddressLog); + GetHubAdminOptionDataAndSet(ao, "ManageOnlyPrivateIP", &o->ManageOnlyPrivateIP); + GetHubAdminOptionDataAndSet(ao, "ManageOnlyLocalUnicastIPv6", &o->ManageOnlyLocalUnicastIPv6); + GetHubAdminOptionDataAndSet(ao, "DisableIPParsing", &o->DisableIPParsing); + GetHubAdminOptionDataAndSet(ao, "YieldAfterStorePacket", &o->YieldAfterStorePacket); + GetHubAdminOptionDataAndSet(ao, "NoSpinLockForPacketDelay", &o->NoSpinLockForPacketDelay); + GetHubAdminOptionDataAndSet(ao, "BroadcastStormDetectionThreshold", &o->BroadcastStormDetectionThreshold); + GetHubAdminOptionDataAndSet(ao, "ClientMinimumRequiredBuild", &o->ClientMinimumRequiredBuild); + GetHubAdminOptionDataAndSet(ao, "FilterPPPoE", &o->FilterPPPoE); + GetHubAdminOptionDataAndSet(ao, "FilterOSPF", &o->FilterOSPF); + GetHubAdminOptionDataAndSet(ao, "FilterIPv4", &o->FilterIPv4); + GetHubAdminOptionDataAndSet(ao, "FilterIPv6", &o->FilterIPv6); + GetHubAdminOptionDataAndSet(ao, "FilterNonIP", &o->FilterNonIP); + GetHubAdminOptionDataAndSet(ao, "NoIPv4PacketLog", &o->NoIPv4PacketLog); + GetHubAdminOptionDataAndSet(ao, "NoIPv6PacketLog", &o->NoIPv6PacketLog); + GetHubAdminOptionDataAndSet(ao, "FilterBPDU", &o->FilterBPDU); + GetHubAdminOptionDataAndSet(ao, "NoIPv6DefaultRouterInRAWhenIPv6", &o->NoIPv6DefaultRouterInRAWhenIPv6); + GetHubAdminOptionDataAndSet(ao, "NoLookBPDUBridgeId", &o->NoLookBPDUBridgeId); + GetHubAdminOptionDataAndSet(ao, "NoManageVlanId", &o->NoManageVlanId); + GetHubAdminOptionDataAndSet(ao, "VlanTypeId", &o->VlanTypeId); + GetHubAdminOptionDataAndSet(ao, "FixForDLinkBPDU", &o->FixForDLinkBPDU); + GetHubAdminOptionDataAndSet(ao, "RequiredClientId", &o->RequiredClientId); + GetHubAdminOptionDataAndSet(ao, "AdjustTcpMssValue", &o->AdjustTcpMssValue); + GetHubAdminOptionDataAndSet(ao, "DisableAdjustTcpMss", &o->DisableAdjustTcpMss); + GetHubAdminOptionDataAndSet(ao, "NoDhcpPacketLogOutsideHub", &o->NoDhcpPacketLogOutsideHub); + GetHubAdminOptionDataAndSet(ao, "DisableHttpParsing", &o->DisableHttpParsing); + GetHubAdminOptionDataAndSet(ao, "DisableUdpAcceleration", &o->DisableUdpAcceleration); + GetHubAdminOptionDataAndSet(ao, "DisableUdpFilterForLocalBridgeNic", &o->DisableUdpFilterForLocalBridgeNic); + GetHubAdminOptionDataAndSet(ao, "ApplyIPv4AccessListOnArpPacket", &o->ApplyIPv4AccessListOnArpPacket); + GetHubAdminOptionDataAndSet(ao, "RemoveDefGwOnDhcpForLocalhost", &o->RemoveDefGwOnDhcpForLocalhost); + GetHubAdminOptionDataAndSet(ao, "SecureNAT_MaxTcpSessionsPerIp", &o->SecureNAT_MaxTcpSessionsPerIp); + GetHubAdminOptionDataAndSet(ao, "SecureNAT_MaxTcpSynSentPerIp", &o->SecureNAT_MaxTcpSynSentPerIp); + GetHubAdminOptionDataAndSet(ao, "SecureNAT_MaxUdpSessionsPerIp", &o->SecureNAT_MaxUdpSessionsPerIp); + GetHubAdminOptionDataAndSet(ao, "SecureNAT_MaxDnsSessionsPerIp", &o->SecureNAT_MaxDnsSessionsPerIp); + GetHubAdminOptionDataAndSet(ao, "SecureNAT_MaxIcmpSessionsPerIp", &o->SecureNAT_MaxIcmpSessionsPerIp); + GetHubAdminOptionDataAndSet(ao, "AccessListIncludeFileCacheLifetime", &o->AccessListIncludeFileCacheLifetime); + GetHubAdminOptionDataAndSet(ao, "DisableKernelModeSecureNAT", &o->DisableKernelModeSecureNAT); + GetHubAdminOptionDataAndSet(ao, "DisableIpRawModeSecureNAT", &o->DisableIpRawModeSecureNAT); + GetHubAdminOptionDataAndSet(ao, "DisableUserModeSecureNAT", &o->DisableUserModeSecureNAT); + GetHubAdminOptionDataAndSet(ao, "DisableCheckMacOnLocalBridge", &o->DisableCheckMacOnLocalBridge); + GetHubAdminOptionDataAndSet(ao, "DisableCorrectIpOffloadChecksum", &o->DisableCorrectIpOffloadChecksum); + GetHubAdminOptionDataAndSet(ao, "BroadcastLimiterStrictMode", &o->BroadcastLimiterStrictMode); + GetHubAdminOptionDataAndSet(ao, "MaxLoggedPacketsPerMinute", &o->MaxLoggedPacketsPerMinute); + GetHubAdminOptionDataAndSet(ao, "DoNotSaveHeavySecurityLogs", &o->DoNotSaveHeavySecurityLogs); + GetHubAdminOptionDataAndSet(ao, "DropBroadcastsInPrivacyFilterMode", &o->DropBroadcastsInPrivacyFilterMode); + GetHubAdminOptionDataAndSet(ao, "DropArpInPrivacyFilterMode", &o->DropArpInPrivacyFilterMode); + GetHubAdminOptionDataAndSet(ao, "SuppressClientUpdateNotification", &o->SuppressClientUpdateNotification); + GetHubAdminOptionDataAndSet(ao, "FloodingSendQueueBufferQuota", &o->FloodingSendQueueBufferQuota); + GetHubAdminOptionDataAndSet(ao, "AssignVLanIdByRadiusAttribute", &o->AssignVLanIdByRadiusAttribute); + GetHubAdminOptionDataAndSet(ao, "DenyAllRadiusLoginWithNoVlanAssign", &o->DenyAllRadiusLoginWithNoVlanAssign); + GetHubAdminOptionDataAndSet(ao, "SecureNAT_RandomizeAssignIp", &o->SecureNAT_RandomizeAssignIp); + GetHubAdminOptionDataAndSet(ao, "DetectDormantSessionInterval", &o->DetectDormantSessionInterval); + GetHubAdminOptionDataAndSet(ao, "NoPhysicalIPOnPacketLog", &o->NoPhysicalIPOnPacketLog); + GetHubAdminOptionDataAndSet(ao, "UseHubNameAsDhcpUserClassOption", &o->UseHubNameAsDhcpUserClassOption); + GetHubAdminOptionDataAndSet(ao, "UseHubNameAsRadiusNasId", &o->UseHubNameAsRadiusNasId); +} + +// Convert the contents of the HUB_OPTION to data +void HubOptionStructToData(RPC_ADMIN_OPTION *ao, HUB_OPTION *o, char *hub_name) +{ + LIST *aol; + UINT i; + // Validate arguments + if (ao == NULL || o == NULL || hub_name == NULL) + { + return; + } + + aol = NewListFast(NULL); + + Add(aol, NewAdminOption("NoAddressPollingIPv4", o->NoArpPolling)); + Add(aol, NewAdminOption("NoAddressPollingIPv6", o->NoIPv6AddrPolling)); + Add(aol, NewAdminOption("NoIpTable", o->NoIpTable)); + Add(aol, NewAdminOption("NoMacAddressLog", o->NoMacAddressLog)); + Add(aol, NewAdminOption("ManageOnlyPrivateIP", o->ManageOnlyPrivateIP)); + Add(aol, NewAdminOption("ManageOnlyLocalUnicastIPv6", o->ManageOnlyLocalUnicastIPv6)); + Add(aol, NewAdminOption("DisableIPParsing", o->DisableIPParsing)); + Add(aol, NewAdminOption("YieldAfterStorePacket", o->YieldAfterStorePacket)); + Add(aol, NewAdminOption("NoSpinLockForPacketDelay", o->NoSpinLockForPacketDelay)); + Add(aol, NewAdminOption("BroadcastStormDetectionThreshold", o->BroadcastStormDetectionThreshold)); + Add(aol, NewAdminOption("ClientMinimumRequiredBuild", o->ClientMinimumRequiredBuild)); + Add(aol, NewAdminOption("FilterPPPoE", o->FilterPPPoE)); + Add(aol, NewAdminOption("FilterOSPF", o->FilterOSPF)); + Add(aol, NewAdminOption("FilterIPv4", o->FilterIPv4)); + Add(aol, NewAdminOption("FilterIPv6", o->FilterIPv6)); + Add(aol, NewAdminOption("FilterNonIP", o->FilterNonIP)); + Add(aol, NewAdminOption("NoIPv4PacketLog", o->NoIPv4PacketLog)); + Add(aol, NewAdminOption("NoIPv6PacketLog", o->NoIPv6PacketLog)); + Add(aol, NewAdminOption("FilterBPDU", o->FilterBPDU)); + Add(aol, NewAdminOption("NoIPv6DefaultRouterInRAWhenIPv6", o->NoIPv6DefaultRouterInRAWhenIPv6)); + Add(aol, NewAdminOption("NoLookBPDUBridgeId", o->NoLookBPDUBridgeId)); + Add(aol, NewAdminOption("NoManageVlanId", o->NoManageVlanId)); + Add(aol, NewAdminOption("VlanTypeId", o->VlanTypeId)); + Add(aol, NewAdminOption("FixForDLinkBPDU", o->FixForDLinkBPDU)); + Add(aol, NewAdminOption("RequiredClientId", o->RequiredClientId)); + Add(aol, NewAdminOption("AdjustTcpMssValue", o->AdjustTcpMssValue)); + Add(aol, NewAdminOption("DisableAdjustTcpMss", o->DisableAdjustTcpMss)); + Add(aol, NewAdminOption("NoDhcpPacketLogOutsideHub", o->NoDhcpPacketLogOutsideHub)); + Add(aol, NewAdminOption("DisableHttpParsing", o->DisableHttpParsing)); + Add(aol, NewAdminOption("DisableUdpAcceleration", o->DisableUdpAcceleration)); + Add(aol, NewAdminOption("DisableUdpFilterForLocalBridgeNic", o->DisableUdpFilterForLocalBridgeNic)); + Add(aol, NewAdminOption("ApplyIPv4AccessListOnArpPacket", o->ApplyIPv4AccessListOnArpPacket)); + Add(aol, NewAdminOption("RemoveDefGwOnDhcpForLocalhost", o->RemoveDefGwOnDhcpForLocalhost)); + Add(aol, NewAdminOption("SecureNAT_MaxTcpSessionsPerIp", o->SecureNAT_MaxTcpSessionsPerIp)); + Add(aol, NewAdminOption("SecureNAT_MaxTcpSynSentPerIp", o->SecureNAT_MaxTcpSynSentPerIp)); + Add(aol, NewAdminOption("SecureNAT_MaxUdpSessionsPerIp", o->SecureNAT_MaxUdpSessionsPerIp)); + Add(aol, NewAdminOption("SecureNAT_MaxDnsSessionsPerIp", o->SecureNAT_MaxDnsSessionsPerIp)); + Add(aol, NewAdminOption("SecureNAT_MaxIcmpSessionsPerIp", o->SecureNAT_MaxIcmpSessionsPerIp)); + Add(aol, NewAdminOption("AccessListIncludeFileCacheLifetime", o->AccessListIncludeFileCacheLifetime)); + Add(aol, NewAdminOption("DisableKernelModeSecureNAT", o->DisableKernelModeSecureNAT)); + Add(aol, NewAdminOption("DisableIpRawModeSecureNAT", o->DisableIpRawModeSecureNAT)); + Add(aol, NewAdminOption("DisableUserModeSecureNAT", o->DisableUserModeSecureNAT)); + Add(aol, NewAdminOption("DisableCheckMacOnLocalBridge", o->DisableCheckMacOnLocalBridge)); + Add(aol, NewAdminOption("DisableCorrectIpOffloadChecksum", o->DisableCorrectIpOffloadChecksum)); + Add(aol, NewAdminOption("BroadcastLimiterStrictMode", o->BroadcastLimiterStrictMode)); + Add(aol, NewAdminOption("MaxLoggedPacketsPerMinute", o->MaxLoggedPacketsPerMinute)); + Add(aol, NewAdminOption("DoNotSaveHeavySecurityLogs", o->DoNotSaveHeavySecurityLogs)); + Add(aol, NewAdminOption("DropBroadcastsInPrivacyFilterMode", o->DropBroadcastsInPrivacyFilterMode)); + Add(aol, NewAdminOption("DropArpInPrivacyFilterMode", o->DropArpInPrivacyFilterMode)); + Add(aol, NewAdminOption("SuppressClientUpdateNotification", o->SuppressClientUpdateNotification)); + Add(aol, NewAdminOption("FloodingSendQueueBufferQuota", o->FloodingSendQueueBufferQuota)); + Add(aol, NewAdminOption("AssignVLanIdByRadiusAttribute", o->AssignVLanIdByRadiusAttribute)); + Add(aol, NewAdminOption("DenyAllRadiusLoginWithNoVlanAssign", o->DenyAllRadiusLoginWithNoVlanAssign)); + Add(aol, NewAdminOption("SecureNAT_RandomizeAssignIp", o->SecureNAT_RandomizeAssignIp)); + Add(aol, NewAdminOption("DetectDormantSessionInterval", o->DetectDormantSessionInterval)); + Add(aol, NewAdminOption("NoPhysicalIPOnPacketLog", o->NoPhysicalIPOnPacketLog)); + Add(aol, NewAdminOption("UseHubNameAsDhcpUserClassOption", o->UseHubNameAsDhcpUserClassOption)); + Add(aol, NewAdminOption("UseHubNameAsRadiusNasId", o->UseHubNameAsRadiusNasId)); + + Zero(ao, sizeof(RPC_ADMIN_OPTION)); + + StrCpy(ao->HubName, sizeof(ao->HubName), hub_name); + + ao->NumItem = LIST_NUM(aol); + ao->Items = ZeroMalloc(sizeof(ADMIN_OPTION) * ao->NumItem); + + for (i = 0;i < LIST_NUM(aol);i++) + { + ADMIN_OPTION *a = LIST_DATA(aol, i); + + UniStrCpy(a->Descrption, sizeof(a->Descrption), GetHubAdminOptionHelpString(a->Name)); + + Copy(&ao->Items[i], a, sizeof(ADMIN_OPTION)); + + Free(a); + } + + ReleaseList(aol); +} + +// Create a new ADMIN OPTION +ADMIN_OPTION *NewAdminOption(char *name, UINT value) +{ + ADMIN_OPTION *a; + // Validate arguments + if (name == NULL) + { + return NULL; + } + + a = ZeroMalloc(sizeof(ADMIN_OPTION)); + StrCpy(a->Name, sizeof(a->Name), name); + a->Value = value; + + return a; +} + +// Clone the AC list +LIST *CloneAcList(LIST *o) +{ + LIST *ret; + // Validate arguments + if (o == NULL) + { + return NULL; + } + + ret = NewAcList(); + SetAcList(ret, o); + + return ret; +} + +// Set all the AC list +void SetAcList(LIST *o, LIST *src) +{ + UINT i; + // Validate arguments + if (o == NULL || src == NULL) + { + return; + } + + DelAllAc(o); + + for (i = 0;i < LIST_NUM(src);i++) + { + AC *ac = LIST_DATA(src, i); + + AddAc(o, ac); + } +} + +// Remove all AC from the AC list +void DelAllAc(LIST *o) +{ + UINT i; + // Validate arguments + if (o == NULL) + { + return; + } + + for (i = 0;i < LIST_NUM(o);i++) + { + AC *ac = LIST_DATA(o, i); + + Free(ac); + } + + DeleteAll(o); +} + +// Release the AC list +void FreeAcList(LIST *o) +{ + UINT i; + // Validate arguments + if (o == NULL) + { + return; + } + + for (i = 0;i < LIST_NUM(o);i++) + { + AC *ac = LIST_DATA(o, i); + + Free(ac); + } + + ReleaseList(o); +} + +// Generate a string that indicates the contents of the AC +char *GenerateAcStr(AC *ac) +{ + char tmp[MAX_SIZE]; + char ip[64], mask[64]; + + if (ac == NULL) + { + return NULL; + } + + IPToStr(ip, sizeof(ip), &ac->IpAddress); + MaskToStr(mask, sizeof(mask), &ac->SubnetMask); + + if (ac->Masked == false) + { + Format(tmp, sizeof(tmp), "%s", ip); + } + else + { + Format(tmp, sizeof(tmp), "%s/%s", ip, mask); + } + + return CopyStr(tmp); +} + +// Calculate whether the specified IP address is rejected by the access list +bool IsIpDeniedByAcList(IP *ip, LIST *o) +{ + UINT i; + // Validate arguments + if (ip == NULL || o == NULL) + { + return false; + } + + if (GetGlobalServerFlag(GSF_DISABLE_AC) != 0) + { + return false; + } + + for (i = 0;i < LIST_NUM(o);i++) + { + AC *ac = LIST_DATA(o, i); + + if (IsIpMaskedByAc(ip, ac)) + { + if (ac->Deny == false) + { + return false; + } + else + { + return true; + } + } + } + + return false; +} + +// Calculate whether the specified IP address is masked by the AC +bool IsIpMaskedByAc(IP *ip, AC *ac) +{ + UINT uip, net, mask; + // Validate arguments + if (ip == NULL || ac == NULL) + { + return false; + } + + if (GetGlobalServerFlag(GSF_DISABLE_AC) != 0) + { + return false; + } + + if (IsIP4(ip)) + { + // IPv4 + uip = IPToUINT(ip); + net = IPToUINT(&ac->IpAddress); + mask = IPToUINT(&ac->SubnetMask); + + if (ac->Masked == false) + { + if (uip == net) + { + return true; + } + } + else + { + if ((uip & mask) == (net & mask)) + { + return true; + } + } + + return false; + } + else + { + // IPv6 + if (ac->Masked == false) + { + if (CmpIpAddr(ip, &ac->IpAddress) == 0) + { + return true; + } + } + else + { + IP and1, and2; + + IPAnd6(&and1, ip, &ac->SubnetMask); + IPAnd6(&and2, &ac->IpAddress, &ac->SubnetMask); + + if (CmpIpAddr(&and1, &and2) == 0) + { + return true; + } + } + + return false; + } +} + +// Set the AC +void SetAc(LIST *o, UINT id, AC *ac) +{ + // Validate arguments + if (o == NULL || id == 0 || ac == NULL) + { + return; + } + + if (DelAc(o, id)) + { + AddAc(o, ac); + } +} + +// Get the AC +AC *GetAc(LIST *o, UINT id) +{ + UINT i; + // Validate arguments + if (o == NULL || id == 0) + { + return NULL; + } + + for (i = 0;i < LIST_NUM(o);i++) + { + AC *ac = LIST_DATA(o, i); + + if (ac->Id == id) + { + return Clone(ac, sizeof(AC)); + } + } + + return NULL; +} + +// Delete the AC +bool DelAc(LIST *o, UINT id) +{ + UINT i; + // Validate arguments + if (o == NULL || id == 0) + { + return false; + } + + for (i = 0;i < LIST_NUM(o);i++) + { + AC *ac = LIST_DATA(o, i); + + if (ac->Id == id) + { + if (Delete(o, ac)) + { + Free(ac); + + NormalizeAcList(o); + + return true; + } + } + } + + return false; +} + +// Add an AC to the list +void AddAc(LIST *o, AC *ac) +{ + // Validate arguments + if (o == NULL || ac == NULL) + { + return; + } + + if (LIST_NUM(o) < MAX_HUB_ACS) + { + Insert(o, Clone(ac, sizeof(AC))); + + NormalizeAcList(o); + } +} + +// Normalize the AC list +void NormalizeAcList(LIST *o) +{ + UINT i; + // Validate arguments + if (o == NULL) + { + return; + } + + for (i = 0;i < LIST_NUM(o);i++) + { + AC *ac = LIST_DATA(o, i); + + if (IsIP6(&ac->IpAddress)) + { + ac->IpAddress.ipv6_scope_id = 0; + } + + ac->Id = (i + 1); + } +} + +// Create a new AC list +LIST *NewAcList() +{ + return NewList(CmpAc); +} + +// AC comparison +int CmpAc(void *p1, void *p2) +{ + AC *a1, *a2; + if (p1 == NULL || p2 == NULL) + { + return 0; + } + a1 = *(AC **)p1; + a2 = *(AC **)p2; + if (a1 == NULL || a2 == NULL) + { + return 0; + } + if (a1->Priority > a2->Priority) + { + return 1; + } + else if (a1->Priority < a2->Priority) + { + return -1; + } + else if (a1->Deny > a2->Deny) + { + return 1; + } + else if (a1->Deny < a2->Deny) + { + return -1; + } + else + { + return 0; + } +} + +// Copy the CRL +CRL *CopyCrl(CRL *crl) +{ + CRL *ret; + // Validate arguments + if (crl == NULL) + { + return NULL; + } + + ret = ZeroMalloc(sizeof(CRL)); + + if (crl->Serial != NULL) + { + ret->Serial = NewXSerial(crl->Serial->data, crl->Serial->size); + } + + ret->Name = CopyName(crl->Name); + + Copy(ret->DigestMD5, crl->DigestMD5, MD5_SIZE); + Copy(ret->DigestSHA1, crl->DigestSHA1, SHA1_SIZE); + + return ret; +} + +// Release the CRL +void FreeCrl(CRL *crl) +{ + // Validate arguments + if (crl == NULL) + { + return; + } + + if (crl->Serial != NULL) + { + FreeXSerial(crl->Serial); + } + + if (crl->Name != NULL) + { + FreeName(crl->Name); + } + + Free(crl); +} + +// Check whether the certificate has been disabled by searching the CRL list of Virtual HUB +bool IsValidCertInHub(HUB *h, X *x) +{ + bool ret; + // Validate arguments + if (h == NULL || x == NULL) + { + return false; + } + + if (h->HubDb == NULL) + { + return false; + } + + LockList(h->HubDb->CrlList); + { + ret = IsCertMatchCrlList(x, h->HubDb->CrlList); + } + UnlockList(h->HubDb->CrlList); + + if (ret) + { + // This is invalid because it was matched + return false; + } + + // This is valid because it wasn't matched + return true; +} + +// Search whether the certificate matches the CRL list +bool IsCertMatchCrlList(X *x, LIST *o) +{ + UINT i; + // Validate arguments + if (x == NULL || o == NULL) + { + return false; + } + + for (i = 0;i < LIST_NUM(o);i++) + { + CRL *crl = LIST_DATA(o, i); + + if (IsCertMatchCrl(x, crl)) + { + return true; + } + } + + return false; +} + +// Convert the CRL to a string +wchar_t *GenerateCrlStr(CRL *crl) +{ + wchar_t tmp[2048]; + // Validate arguments + if (crl == NULL) + { + return NULL; + } + + UniStrCpy(tmp, sizeof(tmp), L""); + + if (crl->Name != NULL) + { + // Name information + wchar_t name[MAX_SIZE]; + + UniStrCat(tmp, sizeof(tmp), L"Subject=\""); + + GetAllNameFromName(name, sizeof(name), crl->Name); + UniStrCat(tmp, sizeof(tmp), name); + UniStrCat(tmp, sizeof(tmp), L"\", "); + } + + if (crl->Serial != NULL) + { + // Serial information + char str[128]; + wchar_t uni[128]; + + BinToStrEx(str, sizeof(str), crl->Serial->data, crl->Serial->size); + StrToUni(uni, sizeof(uni), str); + UniStrCat(tmp, sizeof(tmp), L"Serial=\""); + UniStrCat(tmp, sizeof(tmp), uni); + UniStrCat(tmp, sizeof(tmp), L"\", "); + } + + if (IsZero(crl->DigestMD5, MD5_SIZE) == false) + { + // MD5 + char str[128]; + wchar_t uni[128]; + + BinToStrEx(str, sizeof(str), crl->DigestMD5, MD5_SIZE); + StrToUni(uni, sizeof(uni), str); + UniStrCat(tmp, sizeof(tmp), L"MD5=\""); + UniStrCat(tmp, sizeof(tmp), uni); + UniStrCat(tmp, sizeof(tmp), L"\", "); + } + + if (IsZero(crl->DigestSHA1, SHA1_SIZE) == false) + { + // MD5 + char str[128]; + wchar_t uni[128]; + + BinToStrEx(str, sizeof(str), crl->DigestSHA1, SHA1_SIZE); + StrToUni(uni, sizeof(uni), str); + UniStrCat(tmp, sizeof(tmp), L"SHA1=\""); + UniStrCat(tmp, sizeof(tmp), uni); + UniStrCat(tmp, sizeof(tmp), L"\", "); + } + + if (UniEndWith(tmp, L", ")) + { + tmp[UniStrLen(tmp) - 2] = 0; + } + + return CopyUniStr(tmp); +} + +// Check whether it matches the Certificate Revocation List entry +bool IsCertMatchCrl(X *x, CRL *crl) +{ + bool b = true; + // Validate arguments + if (x == NULL || crl == NULL) + { + return false; + } + + if (crl->Serial != NULL) + { + // If a serial number is defined in the CRL + if (x->serial == NULL || CompareXSerial(x->serial, crl->Serial) == false) + { + // Serial number mismatch + b = false; + } + } + + if (IsZero(crl->DigestMD5, sizeof(crl->DigestMD5)) == false) + { + UCHAR test[MD5_SIZE]; + // If a DigestMD5 is defined in the CRL + GetXDigest(x, test, false); + + if (Cmp(test, crl->DigestMD5, MD5_SIZE) != 0) + { + b = false; + } + } + + if (IsZero(crl->DigestSHA1, sizeof(crl->DigestSHA1)) == false) + { + UCHAR test[SHA1_SIZE]; + // If a DigestSHA1 is defined in the CRL + GetXDigest(x, test, true); + + if (Cmp(test, crl->DigestSHA1, SHA1_SIZE) != 0) + { + b = false; + } + } + + if (crl->Name != NULL) + { + // If a name is defined in the CRL + NAME *xn, *cn; + xn = x->subject_name; + cn = crl->Name; + + if (cn->CommonName != NULL && (UniIsEmptyStr(cn->CommonName) == false)) + { + if (xn->CommonName == NULL || UniSoftStrCmp(xn->CommonName, cn->CommonName) != 0) + { + // CommonName mismatch + b = false; + } + } + + if (cn->Organization != NULL && (UniIsEmptyStr(cn->Organization) == false)) + { + if (xn->Organization == NULL || UniSoftStrCmp(xn->Organization, cn->Organization) != 0) + { + // Organization mismatch + b = false; + } + } + + if (cn->Unit != NULL && (UniIsEmptyStr(cn->Unit) == false)) + { + if (xn->Unit == NULL || UniSoftStrCmp(xn->Unit, cn->Unit) != 0) + { + // Unit mismatch + b = false; + } + } + + if (cn->Country != NULL && (UniIsEmptyStr(cn->Country) == false)) + { + if (xn->Country == NULL || UniSoftStrCmp(xn->Country, cn->Country) != 0) + { + // Country mismatch + b = false; + } + } + + if (cn->State != NULL && (UniIsEmptyStr(cn->State) == false)) + { + if (xn->State == NULL || UniSoftStrCmp(xn->State, cn->State) != 0) + { + // State mismatch + b = false; + } + } + + if (cn->Local != NULL && (UniIsEmptyStr(cn->Local) == false)) + { + if (xn->Local == NULL || UniSoftStrCmp(xn->Local, cn->Local) != 0) + { + // Local mismatch + b = false; + } + } + } + + return b; +} + +// Get the help string of administration options +wchar_t *GetHubAdminOptionHelpString(char *name) +{ + char tmp[MAX_SIZE]; + wchar_t *ret; + // Validate arguments + if (name == NULL) + { + return L""; + } + + Format(tmp, sizeof(tmp), "HUB_AO_%s", name); + + ret = _UU(tmp); + if (UniIsEmptyStr(ret)) + { + ret = _UU("HUB_AO_UNKNOWN"); + } + + return ret; +} + +// Add the default administration options to the Virtual HUB +void AddHubAdminOptionsDefaults(HUB *h, bool lock) +{ + UINT i; + // Validate arguments + if (h == NULL) + { + return; + } + + if (lock) + { + LockList(h->AdminOptionList); + } + + for (i = 0;i < num_admin_options;i++) + { + ADMIN_OPTION *e = &admin_options[i]; + ADMIN_OPTION t, *r; + + Zero(&t, sizeof(t)); + StrCpy(t.Name, sizeof(t.Name), e->Name); + + r = Search(h->AdminOptionList, &t); + if (r == NULL) + { + ADMIN_OPTION *a = ZeroMalloc(sizeof(ADMIN_OPTION)); + + StrCpy(a->Name, sizeof(a->Name), e->Name); + a->Value = e->Value; + + Insert(h->AdminOptionList, a); + } + } + + if (lock) + { + UnlockList(h->AdminOptionList); + } +} + +// Delete all administration options of Virtual HUB +void DeleteAllHubAdminOption(HUB *h, bool lock) +{ + UINT i; + // Validate arguments + if (h == NULL) + { + return; + } + + if (lock) + { + LockList(h->AdminOptionList); + } + + for (i = 0;i < LIST_NUM(h->AdminOptionList);i++) + { + Free(LIST_DATA(h->AdminOptionList, i)); + } + + DeleteAll(h->AdminOptionList); + + if (lock) + { + UnlockList(h->AdminOptionList); + } +} + +// Get the administration options for the virtual HUB +UINT GetHubAdminOptionEx(HUB *h, char *name, UINT default_value) +{ + UINT ret = default_value; + // Validate arguments + if (h == NULL || name == NULL) + { + return 0; + } + + LockList(h->AdminOptionList); + { + ADMIN_OPTION *a, t; + + Zero(&t, sizeof(t)); + StrCpy(t.Name, sizeof(t.Name), name); + Trim(t.Name); + + a = Search(h->AdminOptionList, &t); + + if (a != NULL) + { + ret = a->Value; + } + } + UnlockList(h->AdminOptionList); + + return ret; +} +UINT GetHubAdminOption(HUB *h, char *name) +{ + return GetHubAdminOptionEx(h, name, 0); +} + +// Administration options +int CompareAdminOption(void *p1, void *p2) +{ + ADMIN_OPTION *a1, *a2; + if (p1 == NULL || p2 == NULL) + { + return 0; + } + a1 = *(ADMIN_OPTION **)p1; + a2 = *(ADMIN_OPTION **)p2; + if (a1 == NULL || a2 == NULL) + { + return 0; + } + return StrCmpi(a1->Name, a2->Name); +} + +// Start the watchdog +void StartHubWatchDog(HUB *h) +{ + THREAD *t; + // Validate arguments + if (h == NULL) + { + return; + } + + h->HaltWatchDog = false; + h->WatchDogEvent = NewEvent(); + + t = NewThread(HubWatchDogThread, h); + WaitThreadInit(t); + ReleaseThread(t); +} + +// Stop the watchdog +void StopHubWatchDog(HUB *h) +{ + // Validate arguments + if (h == NULL) + { + return; + } + + h->HaltWatchDog = true; + Set(h->WatchDogEvent); + + WaitThread(h->WatchDogThread, INFINITE); + ReleaseThread(h->WatchDogThread); + h->WatchDogThread = NULL; + h->HaltWatchDog = false; + + ReleaseEvent(h->WatchDogEvent); + h->WatchDogEvent = NULL; +} + +// Watchdog thread +void HubWatchDogThread(THREAD *t, void *param) +{ + UINT num_packets_v4 = 0; + UINT num_packets_v6 = 0; + HUB *hub; + // Validate arguments + if (t == NULL || param == NULL) + { + return; + } + + hub = (HUB *)param; + + hub->WatchDogThread = t; + AddRef(t->ref); + + NoticeThreadInit(t); + + while (true) + { + LIST *o; + LIST *o2; + UINT i, num; + UINT interval; + UINT wait_time = 100; + if (hub->HaltWatchDog) + { + break; + } + + o = NewListFast(NULL); + o2 = NewListFast(NULL); + + // Send an ARP packet + LockHashList(hub->MacHashTable); + { + num = LIST_NUM(hub->IpTable); + for (i = 0;i < LIST_NUM(hub->IpTable);i++) + { + IP_TABLE_ENTRY *e = LIST_DATA(hub->IpTable, i); + + if (e == NULL) continue; + + if ((e->UpdatedTime + (UINT64)(IP_TABLE_EXPIRE_TIME)) > Tick64()) + { + if (e->MacAddress[0] != 0xff || e->MacAddress[1] != 0xff || e->MacAddress[2] != 0xff || + e->MacAddress[3] != 0xff || e->MacAddress[4] != 0xff || e->MacAddress[5] != 0xff) + { + if (hub->Option != NULL && hub->Option->NoArpPolling == false) + { + if (IsIP4(&e->Ip)) + { + // IPv4 + MAC_HEADER *mac = ZeroMalloc(sizeof(MAC_HEADER) + sizeof(ARPV4_HEADER)); + ARPV4_HEADER *p = (ARPV4_HEADER *)(((UCHAR *)mac) + sizeof(MAC_HEADER)); + + Copy(mac->DestAddress, e->MacAddress, 6); + Copy(mac->SrcAddress, hub->HubMacAddr, 6); + mac->Protocol = Endian16(MAC_PROTO_ARPV4); + + p->HardwareType = Endian16(ARP_HARDWARE_TYPE_ETHERNET); + p->ProtocolType = Endian16(MAC_PROTO_IPV4); + p->HardwareSize = 6; + p->ProtocolSize = 4; + p->Operation = Endian16(ARP_OPERATION_REQUEST); + Copy(p->SrcAddress, hub->HubMacAddr, 6); + p->SrcIP = IPToUINT(&hub->HubIp); + p->TargetAddress[0] = + p->TargetAddress[1] = + p->TargetAddress[2] = + p->TargetAddress[3] = + p->TargetAddress[4] = + p->TargetAddress[5] = 0x00; + p->TargetIP = IPToUINT(&e->Ip); + Insert(o, mac); + } + } + + if (hub->Option != NULL && hub->Option->NoIPv6AddrPolling == false) + { + if (IsIP6(&e->Ip)) + { + // IPv6 + BUF *buf; + IPV6_ADDR ip6addr; + + if (IPToIPv6Addr(&ip6addr, &e->Ip)) + { + buf = BuildICMPv6NeighborSoliciation(&hub->HubIpV6, + &ip6addr, + hub->HubMacAddr, ++hub->HubIP6Id); + + if (buf != NULL) + { + BUF *buf2 = NewBuf(); + MAC_HEADER mac; + + Zero(&mac, sizeof(mac)); + + Copy(mac.DestAddress, e->MacAddress, 6); + Copy(mac.SrcAddress, hub->HubMacAddr, 6); + mac.Protocol = Endian16(MAC_PROTO_IPV6); + + WriteBuf(buf2, &mac, sizeof(MAC_HEADER)); + + WriteBuf(buf2, buf->Buf, buf->Size); + + FreeBuf(buf); + + Insert(o2, buf2); + } + } + } + } + } + } + } + } + UnlockHashList(hub->MacHashTable); + + if ((LIST_NUM(o) + LIST_NUM(o2)) != 0) + { + interval = HUB_ARP_SEND_INTERVAL / (LIST_NUM(o) + LIST_NUM(o2)); + } + else + { + interval = HUB_ARP_SEND_INTERVAL; + } + + for (i = 0;i < LIST_NUM(o);i++) + { + PKT *packet; + void *p = LIST_DATA(o, i); + + Wait(hub->WatchDogEvent, interval); + if (hub->HaltWatchDog) + { + for (;i < LIST_NUM(o);i++) + { + Free(LIST_DATA(o, i)); + } + ReleaseList(o); + + for (i = 0;i < LIST_NUM(o2);i++) + { + FreeBuf(LIST_DATA(o2, i)); + } + ReleaseList(o2); + goto ESCAPE; + } + + packet = ParsePacket((UCHAR *)p, sizeof(MAC_HEADER) + sizeof(ARPV4_HEADER)); + if (packet != NULL) + { + StorePacket(hub, NULL, packet); + num_packets_v4++; + } + else + { + Free(p); + } + } + + for (i = 0;i < LIST_NUM(o2);i++) + { + PKT *packet; + BUF *buf = LIST_DATA(o2, i); + + Wait(hub->WatchDogEvent, interval); + if (hub->HaltWatchDog) + { + ReleaseList(o); + + for (;i < LIST_NUM(o2);i++) + { + FreeBuf(LIST_DATA(o2, i)); + } + ReleaseList(o2); + goto ESCAPE; + } + + packet = ParsePacket(buf->Buf, buf->Size); + if (packet != NULL) + { + StorePacket(hub, NULL, packet); + num_packets_v6++; + } + else + { + Free(buf->Buf); + } + + Free(buf); + } + + ReleaseList(o); + ReleaseList(o2); + + if (num == 0) + { + wait_time = HUB_ARP_SEND_INTERVAL; + } + + Wait(hub->WatchDogEvent, wait_time); + } +ESCAPE: + return; +} + +// Enable / disable the SecureNAT +void EnableSecureNAT(HUB *h, bool enable) +{ + EnableSecureNATEx(h, enable, false); +} +void EnableSecureNATEx(HUB *h, bool enable, bool no_change) +{ + bool for_cluster = false; + // Validate arguments + if (h == NULL) + { + return; + } + + if (h->Cedar->Server != NULL && h->Cedar->Server->ServerType == SERVER_TYPE_FARM_CONTROLLER) + { + if (h->Type == HUB_TYPE_FARM_DYNAMIC) + { + for_cluster = true; + } + } + + Lock(h->lock_online); + { + if (no_change == false) + { + h->EnableSecureNAT = enable; + } + + if (h->EnableSecureNAT == false) + { +STOP: + // Stop if it's already started + if (h->SecureNAT != NULL) + { + SnFreeSecureNAT(h->SecureNAT); + h->SecureNAT = NULL; + } + } + else + { + if (for_cluster) + { + if ((h->SecureNAT != NULL && LIST_NUM(h->SessionList) <= 1) || + (h->SecureNAT == NULL && LIST_NUM(h->SessionList) == 0)) + { + // It is in a start mode, but stop when there is no other sessions + // in the case of dynamic Virtual HUB + goto STOP; + } + } + + // Start if the HUB is online and not started + if (h->SecureNAT == NULL && h->Offline == false) + { + h->SecureNAT = SnNewSecureNAT(h, h->SecureNATOption); + } + } + } + Unlock(h->lock_online); +} + +// Convert an access list to a string +void GetAccessListStr(char *str, UINT size, ACCESS *a) +{ + char tmp[MAX_SIZE]; + char tmp1[MAX_SIZE]; + char tmp2[MAX_SIZE]; + bool l3 = false; + bool asterisk = false; + // Validate arguments + if (str == NULL || a == NULL) + { + return; + } + + StrCpy(str, size, ""); + + if (a->IsIPv6 == false) + { + if (a->SrcIpAddress != 0 || a->SrcSubnetMask != 0) + { + IPToStr32(tmp1, sizeof(tmp1), a->SrcIpAddress); + MaskToStr32(tmp2, sizeof(tmp2), a->SrcSubnetMask); + Format(tmp, sizeof(tmp), "SrcIPv4=%s/%s, ", tmp1, tmp2); + StrCat(str, size, tmp); + + l3 = true; + } + + if (a->DestIpAddress != 0 || a->DestSubnetMask != 0) + { + IPToStr32(tmp1, sizeof(tmp1), a->DestIpAddress); + MaskToStr32(tmp2, sizeof(tmp2), a->DestSubnetMask); + Format(tmp, sizeof(tmp), "DstIPv4=%s/%s, ", tmp1, tmp2); + StrCat(str, size, tmp); + + l3 = true; + } + } + else + { + if (IsZeroIP6Addr(&a->SrcIpAddress6) == false || IsZeroIP6Addr(&a->SrcSubnetMask6) == false) + { + IP6AddrToStr(tmp1, sizeof(tmp1), &a->SrcIpAddress6); + Mask6AddrToStr(tmp2, sizeof(tmp2), &a->SrcSubnetMask6); + Format(tmp, sizeof(tmp), "SrcIPv6=%s/%s, ", tmp1, tmp2); + StrCat(str, size, tmp); + + l3 = true; + } + + if (IsZeroIP6Addr(&a->DestIpAddress6) == false || IsZeroIP6Addr(&a->DestSubnetMask6) == false) + { + IP6AddrToStr(tmp1, sizeof(tmp1), &a->DestIpAddress6); + Mask6AddrToStr(tmp2, sizeof(tmp2), &a->DestSubnetMask6); + Format(tmp, sizeof(tmp), "DstIPv6=%s/%s, ", tmp1, tmp2); + StrCat(str, size, tmp); + + l3 = true; + } + } + + if (a->Protocol != 0) + { + StrCpy(tmp1, sizeof(tmp1), ""); + switch (a->Protocol) + { + case 1: + StrCpy(tmp1, sizeof(tmp1), "ICMPv4"); + break; + case 3: + StrCpy(tmp1, sizeof(tmp1), "GGP"); + break; + case 6: + StrCpy(tmp1, sizeof(tmp1), "TCP"); + break; + case 8: + StrCpy(tmp1, sizeof(tmp1), "EGP"); + break; + case 12: + StrCpy(tmp1, sizeof(tmp1), "PUP"); + break; + case 17: + StrCpy(tmp1, sizeof(tmp1), "UDP"); + break; + case 20: + StrCpy(tmp1, sizeof(tmp1), "HMP"); + break; + case 22: + StrCpy(tmp1, sizeof(tmp1), "XNS-IDP"); + break; + case 27: + StrCpy(tmp1, sizeof(tmp1), "RDP"); + break; + case 58: + StrCpy(tmp1, sizeof(tmp1), "ICMPv6"); + break; + case 66: + StrCpy(tmp1, sizeof(tmp1), "RVD"); + break; + } + + if (IsEmptyStr(tmp1)) + { + Format(tmp, sizeof(tmp), "Protocol=%s(%u), ", tmp1, a->Protocol); + } + else + { + Format(tmp, sizeof(tmp), "Protocol=%s, ", tmp1); + } + + StrCat(str, size, tmp); + + l3 = true; + } + + if (a->SrcPortStart != 0) + { + if (a->SrcPortEnd == a->SrcPortStart) + { + Format(tmp, sizeof(tmp), "SrcPort=%u, ", a->SrcPortStart); + StrCat(str, size, tmp); + } + else + { + Format(tmp, sizeof(tmp), "SrcPort=%u-%u, ", a->SrcPortStart, a->SrcPortEnd); + StrCat(str, size, tmp); + } + + l3 = true; + } + + if (a->DestPortStart != 0) + { + if (a->DestPortEnd == a->DestPortStart) + { + Format(tmp, sizeof(tmp), "DstPort=%u, ", a->DestPortStart); + StrCat(str, size, tmp); + } + else + { + Format(tmp, sizeof(tmp), "DstPort=%u-%u, ", a->DestPortStart, a->DestPortEnd); + StrCat(str, size, tmp); + } + + l3 = true; + } + + if (StrLen(a->SrcUsername) != 0) + { + Format(tmp, sizeof(tmp), "SrcUser=%s, ", a->SrcUsername); + StrCat(str, size, tmp); + } + + if (StrLen(a->DestUsername) != 0) + { + Format(tmp, sizeof(tmp), "DstUser=%s, ", a->DestUsername); + StrCat(str, size, tmp); + } + + if (a->CheckSrcMac != false) + { + char mac[MAX_SIZE], mask[MAX_SIZE]; + MacToStr(mac, sizeof(mac), a->SrcMacAddress); + MacToStr(mask, sizeof(mask), a->SrcMacMask); + Format(tmp, sizeof(tmp), "SrcMac=%s/%s, ", mac, mask); + StrCat(str, size, tmp); + } + if (a->CheckDstMac != false) + { + char mac[MAX_SIZE], mask[MAX_SIZE]; + MacToStr(mac, sizeof(mac), a->DstMacAddress); + MacToStr(mask, sizeof(mask), a->DstMacMask); + Format(tmp, sizeof(tmp), "DstMac=%s/%s, ", mac, mask); + StrCat(str, size, tmp); + } + + if (a->CheckTcpState) + { + if(a->Established) + { + StrCat(str, size, "Established, "); + } + else + { + StrCat(str, size, "Unestablished, "); + } + + l3 = true; + } + + if (a->Discard == false) + { + if (a->Delay >= 1) + { + Format(tmp, sizeof(tmp), "Delay=%u, ", a->Delay); + StrCat(str, size, tmp); + } + + if (a->Jitter >= 1) + { + Format(tmp, sizeof(tmp), "Jitter=%u, ", a->Jitter); + StrCat(str, size, tmp); + } + + if (a->Loss >= 1) + { + Format(tmp, sizeof(tmp), "Loss=%u, " , a->Loss); + StrCat(str, size, tmp); + } + } + + if (IsEmptyStr(a->RedirectUrl) == false) + { + Format(tmp, sizeof(tmp), "RedirectUrl=%s, ", a->RedirectUrl); + StrCat(str, size, tmp); + } + + if (StrLen(str) == 0) + { + asterisk = true; + } + + if (l3) + { + if (a->IsIPv6) + { + StrCatLeft(str, size, "(ipv6) "); + } + else + { + StrCatLeft(str, size, "(ipv4) "); + } + } + else + { + StrCatLeft(str, size, "(ether) "); + } + + if (EndWith(str, ", ")) + { + str[StrLen(str) - 2] = 0; + } + + if (asterisk) + { + StrCat(str, size, "*"); + } +} + +// Determine whether the access list can mask the packet +bool IsPacketMaskedByAccessList(SESSION *s, PKT *p, ACCESS *a, UINT64 dest_username, UINT64 dest_groupname, SESSION *dest_session) +{ + UINT64 src_username; + UINT64 src_username_simple; + UINT64 src_groupname; + HUB_PA *pa; + IPV4_HEADER *ip = NULL; + IPV6_HEADER *ip6 = NULL; + bool is_ipv4_packet = false; + bool is_ipv6_packet = false; + bool is_arp_packet = false; + // Validate arguments + if (s == NULL || p == NULL || a == NULL) + { + return false; + } + if (a->Active == false) + { + // Access list is inactive + return false; + } + + pa = (HUB_PA *)s->PacketAdapter->Param; + + // Hash of the source user name + src_username = pa->UsernameHash; + src_username_simple = pa->UsernameHashSimple; + src_groupname = pa->GroupnameHash; + + // Determine the source and destination MAC address + if (a->CheckSrcMac != false) + { + UINT i; + for (i = 0; i < 6; i++) + { + if((a->SrcMacAddress[i] & a->SrcMacMask[i]) != (a->SrcMacMask[i] & p->MacAddressSrc[i])) + { + return false; + } + } + } + + if (a->CheckDstMac != false) + { + UINT i; + for (i = 0; i < 6; i++) + { + if ((a->DstMacAddress[i] & a->DstMacMask[i]) != (a->DstMacMask[i] & p->MacAddressDest[i])) + { + return false; + } + } + } + + // Check the source user name / group name + if (a->SrcUsernameHash != 0) + { + if (a->IsSrcUsernameIncludeOrExclude == false) + { + // It is specified as a regular user name + if ((a->SrcUsernameHash != src_username) && (a->SrcUsernameHash != src_groupname)) + { + return false; + } + } + else + { + // It is specified in the form of a exclude:FILENAME or include:FILENAME + HUB *hub = s->Hub; + + if (hub != NULL) + { + LIST *o = hub->UserList; + + if (s->NormalClient == false) + { + // The internal session don't become target for format exclude: or include: + return false; + } + + if (IsUserMatchInUserListWithCacheExpiresAcl(o, a->SrcUsername, src_username, + hub->Option->AccessListIncludeFileCacheLifetime * 1000) == false) + { + return false; + } + } + } + } + + // Check the destination user name / group name + if (a->DestUsernameHash != 0) + { + if (a->IsDestUsernameIncludeOrExclude == false) + { + // It is specified as a regular user name + if ((a->DestUsernameHash != dest_username) && (a->DestUsernameHash != dest_groupname)) + { + return false; + } + } + else + { + // It is specified in the form of a exclude:FILENAME or include:FILENAME + HUB *hub = s->Hub; + + if (hub != NULL) + { + LIST *o = hub->UserList; + + if (dest_session != NULL && dest_session->NormalClient == false) + { + // The internal session don't become target for format exclude: or include: + return false; + } + + if (IsUserMatchInUserListWithCacheExpiresAcl(o, a->DestUsername, dest_username, + hub->Option->AccessListIncludeFileCacheLifetime * 1000) == false) + { + return false; + } + } + } + } + + // Determine of the IP packet + if (p->TypeL3 != L3_IPV4) + { + is_ipv4_packet = false; + } + else + { + is_ipv4_packet = true; + } + + if (p->TypeL3 != L3_IPV6) + { + is_ipv6_packet = false; + } + else + { + is_ipv6_packet = true; + } + + if (p->TypeL3 == L3_ARPV4) + { + is_arp_packet = true; + } + + if (is_ipv4_packet) + { + ip = p->L3.IPv4Header; + } + + if (is_ipv6_packet) + { + ip6 = p->L3.IPv6Header; + } + + if (a->IsIPv6 == false) + { + // IPv4 + + // Check the source IP address + if (a->SrcIpAddress != 0 || a->SrcSubnetMask != 0) + { + if (is_ipv4_packet == false) + { + if (p->TypeL3 == L3_ARPV4) + { + bool arp_match = false; + if (p->L3.ARPv4Header->HardwareSize == 6 && + Endian16(p->L3.ARPv4Header->HardwareType) == ARP_HARDWARE_TYPE_ETHERNET && + p->L3.ARPv4Header->ProtocolSize == 4 && + Endian16(p->L3.ARPv4Header->ProtocolType) == 0x0800) + { + UINT uint_ip = p->L3.ARPv4Header->SrcIP; + + if (uint_ip != 0 && uint_ip != 0xffffffff && !(IsHubIpAddress32(uint_ip) && IsHubMacAddress(p->MacAddressSrc))) + { + if ((uint_ip & a->SrcSubnetMask) != (a->SrcIpAddress & a->SrcSubnetMask)) + { + } + else + { + arp_match = true; + } + } + } + + if (arp_match == false) + { + return false; + } + } + else + { + return false; + } + } + else + { + if ((ip->SrcIP & a->SrcSubnetMask) != (a->SrcIpAddress & a->SrcSubnetMask)) + { + return false; + } + } + } + + // Check the destination IP address + if (a->DestIpAddress != 0 || a->DestSubnetMask != 0) + { + if (is_ipv4_packet == false) + { + if (p->TypeL3 == L3_ARPV4) + { + bool arp_match = false; + if (p->L3.ARPv4Header->HardwareSize == 6 && + Endian16(p->L3.ARPv4Header->HardwareType) == ARP_HARDWARE_TYPE_ETHERNET && + p->L3.ARPv4Header->ProtocolSize == 4 && + Endian16(p->L3.ARPv4Header->ProtocolType) == 0x0800) + { + UINT uint_ip = p->L3.ARPv4Header->TargetIP; + + if (uint_ip != 0 && uint_ip != 0xffffffff && !(IsHubIpAddress32(uint_ip) && IsHubMacAddress(p->MacAddressSrc))) + { + if ((uint_ip & a->DestSubnetMask) != (a->DestIpAddress & a->DestSubnetMask)) + { + } + else + { + arp_match = true; + } + } + } + + if (arp_match == false) + { + return false; + } + } + else + { + return false; + } + } + else + { + if ((ip->DstIP & a->DestSubnetMask) != (a->DestIpAddress & a->DestSubnetMask)) + { + return false; + } + } + } + } + else + { + // IPv6 + + // Check the source IP address + if (IsZeroIP6Addr(&a->SrcIpAddress6) == false || + IsZeroIP6Addr(&a->SrcSubnetMask6) == false) + { + if (is_ipv6_packet == false) + { + return false; + } + else + { + IP a_ip, a_subnet, p_ip; + IP and1, and2; + + IPv6AddrToIP(&a_ip, &a->SrcIpAddress6); + IPv6AddrToIP(&a_subnet, &a->SrcSubnetMask6); + IPv6AddrToIP(&p_ip, &ip6->SrcAddress); + + IPAnd6(&and1, &a_ip, &a_subnet); + IPAnd6(&and2, &p_ip, &a_subnet); + + if (CmpIpAddr(&and1, &and2) != 0) + { + return false; + } + } + } + + // Check the destination IP address + if (IsZeroIP6Addr(&a->DestIpAddress6) == false || + IsZeroIP6Addr(&a->DestSubnetMask6) == false) + { + if (is_ipv6_packet == false) + { + return false; + } + else + { + IP a_ip, a_subnet, p_ip; + IP and1, and2; + + IPv6AddrToIP(&a_ip, &a->DestIpAddress6); + IPv6AddrToIP(&a_subnet, &a->DestSubnetMask6); + IPv6AddrToIP(&p_ip, &ip6->DestAddress); + + IPAnd6(&and1, &a_ip, &a_subnet); + IPAnd6(&and2, &p_ip, &a_subnet); + + if (CmpIpAddr(&and1, &and2) != 0) + { + return false; + } + } + } + } + + // Don't match the packet of non-IPv4 and non-IPv6 + if (is_arp_packet) + { + if (s->Hub != NULL && s->Hub->Option != NULL && s->Hub->Option->ApplyIPv4AccessListOnArpPacket) + { + // Match the ARP only if ApplyIPv4AccessListOnArpPacket option is enabled + } + else + { + return false; + } + } + + // Check the protocol number + if (a->Protocol != 0) + { + if (a->IsIPv6 == false) + { + if (is_ipv4_packet == false) + { + return false; + } + else + { + if (ip->Protocol != a->Protocol) + { + return false; + } + } + } + else + { + if (is_ipv6_packet == false) + { + return false; + } + else + { + if (p->IPv6HeaderPacketInfo.Protocol != a->Protocol) + { + return false; + } + } + } + } + + // Check the port number + if (a->SrcPortStart != 0 || a->DestPortStart != 0 || + a->SrcPortEnd != 0 || a->DestPortEnd != 0) + { + if ((a->IsIPv6 == false && is_ipv4_packet == false) || + (a->IsIPv6 && is_ipv6_packet == false)) + { + return false; + } + else + { + if (p->TypeL4 == L4_TCP) + { + TCP_HEADER *tcp = p->L4.TCPHeader; + // Check the source port + if (a->SrcPortStart != 0 || a->SrcPortEnd != 0) + { + UINT src_port = Endian16(tcp->SrcPort); + if (src_port < a->SrcPortStart || src_port > a->SrcPortEnd) + { + return false; + } + } + + // Check the destination port number + if (a->DestPortStart != 0 || a->DestPortEnd != 0) + { + UINT dest_port = Endian16(tcp->DstPort); + if (dest_port < a->DestPortStart || dest_port > a->DestPortEnd) + { + return false; + } + } + } + else if (p->TypeL4 == L4_UDP) + { + UDP_HEADER *udp = p->L4.UDPHeader; + // Check the source port + if (a->SrcPortStart != 0 || a->SrcPortEnd != 0) + { + UINT src_port = Endian16(udp->SrcPort); + if (src_port < a->SrcPortStart || src_port > a->SrcPortEnd) + { + return false; + } + } + + // Check the destination port number + if (a->DestPortStart != 0 || a->DestPortEnd != 0) + { + UINT dest_port = Endian16(udp->DstPort); + if (dest_port < a->DestPortStart || dest_port > a->DestPortEnd) + { + return false; + } + } + } + else + { + // When the port number is specified in the access list, + // The rule is applied only for UDP or TCP packets + return false; + } + } + } + + // Check the status of the TCP connection + if (a->CheckTcpState != false) + { + if ((a->IsIPv6 == false && is_ipv4_packet == false) || + (a->IsIPv6 && is_ipv6_packet == false)) + { + return false; + } + else + { + if(p->TypeL4 == L4_TCP) + { + // by shimizu + TCP_HEADER *tcp = p->L4.TCPHeader; + bool est = true; + + if ((tcp->Flag & TCP_SYN) && (!(tcp->Flag & TCP_ACK))) + { + est = false; + } + + if((MAKEBOOL(a->Established) ^ MAKEBOOL(est))) + { + return false; + } + } + else + { + return false; + } + } + } + + return true; +} + +// Apply the access list for packets to forward +bool ApplyAccessListToForwardPacket(HUB *hub, SESSION *src_session, SESSION *dest_session, PKT *p) +{ + UINT i; + bool pass = true; // Pass by default + bool skip = true; + // Validate arguments + if (hub == NULL || src_session == NULL || p == NULL || dest_session == NULL) + { + return false; + } + + // The access list is not re-applied for packets that have been already checked + if (p->AccessChecked) + { + return true; + } + + LockList(hub->AccessList); + { + for (i = 0;i < LIST_NUM(hub->AccessList);i++) + { + ACCESS *a = LIST_DATA(hub->AccessList, i); + + // Scan the entry only after the destination user name is specified. + if (a->DestUsernameHash != 0) + { + skip = false; + } + + if (skip == false) + { + if (IsPacketMaskedByAccessList(src_session, p, a, + ((HUB_PA *)dest_session->PacketAdapter->Param)->UsernameHash, + ((HUB_PA *)dest_session->PacketAdapter->Param)->GroupnameHash, + dest_session)) + { + // Determine the pass or discard the packet + pass = a->Discard ? false : true; + + // Complete the scanning of the list here + break; + } + } + } + } + UnlockList(hub->AccessList); + + return pass; +} + +// Generate a HTTP payload for redirect +BUF *BuildRedirectToUrlPayload(HUB *hub, SESSION *s, char *redirect_url) +{ + char html[MAX_REDIRECT_URL_LEN * 2 + 1 + MAX_SIZE]; + char header[MAX_REDIRECT_URL_LEN * 2 + 1 + MAX_SIZE]; + char redirect_url2[MAX_REDIRECT_URL_LEN * 2]; + BUF *b; + // Validate arguments + if (hub == NULL || s == NULL || redirect_url == NULL) + { + return NULL; + } + + StrCpy(redirect_url2, sizeof(redirect_url2), redirect_url); + Trim(redirect_url2); + + if (InStr(redirect_url2, ACCESS_LIST_URL_INFO_TAG)) + { + // Get the secret key string + char secret[MAX_SIZE]; + char tmp[MAX_SIZE]; + SYSTEMTIME st; + UINT i, len, isp; + + isp = INFINITE; + + SystemTime(&st); + ClearStr(secret, sizeof(secret)); + + len = StrLen(redirect_url2); + + for (i = 0;i < len;i++) + { + char c = redirect_url2[i]; + if (c == '|') + { + isp = i; + } + } + + if (isp != INFINITE) + { + StrCpy(secret, sizeof(secret), redirect_url2 + isp + 1); + redirect_url2[isp] = 0; + } + + Format(tmp, sizeof(tmp), "%s|%s|%r|%04u%02u%02u%02u%02u%02u%s", + s->Username, s->Name, &s->Connection->ClientIp, + st.wYear, st.wMonth, st.wDay, st.wHour, st.wMinute, st.wSecond, (IsEmptyStr(secret) ? "" : "|")); + + if (IsEmptyStr(secret) == false) + { + // Calculate the hash + UCHAR hash[SHA1_SIZE]; + char hash_str[MAX_SIZE]; + BUF *b2 = NewBuf(); + + WriteBuf(b2, tmp, StrLen(tmp)); + WriteBuf(b2, secret, StrLen(secret)); + + Sha1(hash, b2->Buf, b2->Size); + + BinToStr(hash_str, sizeof(hash_str), hash, sizeof(hash)); + + FreeBuf(b2); + + StrCat(tmp, sizeof(tmp), hash_str); + + // Replace + ReplaceStrEx(redirect_url2, sizeof(redirect_url2), redirect_url2, + ACCESS_LIST_URL_INFO_TAG, tmp, false); + } + } + + Format(html, sizeof(html), + "Object moved\r\n

Object moved to here.

\r\n\r\n\r\n", + redirect_url2); + + Format(header, sizeof(header), + "HTTP/1.1 302 Found\r\nLocation: %s\r\nCache-Control: private\r\nContent-Type: text/html; charset=utf-8\r\nContent-Length: %u\r\n\r\n", + redirect_url2, StrLen(redirect_url2)); + + b = NewBuf(); + + WriteBuf(b, header, StrLen(header)); + WriteBuf(b, html, StrLen(html)); + + return b; +} + +// Rpely a TCP response packet to redirect forcibly to the specified URL +void ForceRedirectToUrl(HUB *hub, SESSION *src_session, PKT *p, char *redirect_url) +{ + BUF *payload; + UINT tcp_size; + TCP_HEADER *tcp_data; + TCP_HEADER *src_tcp; + BUF *b; + // Validate arguments + if (hub == NULL || src_session == NULL || p == NULL || redirect_url == NULL) + { + return; + } + if (p->TypeL3 != L3_IPV4 && p->TypeL3 != L3_IPV6) + { + return; + } + if (p->TypeL4 != L4_TCP) + { + return; + } + + src_tcp = p->L4.TCPHeader; + if (src_tcp == NULL) + { + return; + } + + // Generate a payload to be sent + payload = BuildRedirectToUrlPayload(hub, src_session, redirect_url); + if (payload == NULL) + { + return; + } + + // Generate a TCP packet + tcp_size = sizeof(TCP_HEADER) + payload->Size; + tcp_data = (TCP_HEADER *)ZeroMalloc(tcp_size); + tcp_data->SrcPort = src_tcp->DstPort; + tcp_data->DstPort = src_tcp->SrcPort; + tcp_data->SeqNumber = src_tcp->AckNumber; + tcp_data->AckNumber = Endian32(Endian32(src_tcp->SeqNumber) + p->PayloadSize); + TCP_SET_HEADER_SIZE(tcp_data, 5); + tcp_data->Flag = TCP_ACK | TCP_PSH; + tcp_data->WindowSize = Endian16(0xFFFF); + Copy(((UCHAR *)tcp_data) + sizeof(TCP_HEADER), payload->Buf, payload->Size); + + // Calculate the TCP checksum + if (p->TypeL3 == L3_IPV4) + { + // IPv4 + tcp_data->Checksum = CalcChecksumForIPv4(p->L3.IPv4Header->DstIP, p->L3.IPv4Header->SrcIP, IP_PROTO_TCP, + tcp_data, tcp_size, 0); + } + else + { + // IPv6 + tcp_data->Checksum = CalcChecksumForIPv6(&p->IPv6HeaderPacketInfo.IPv6Header->DestAddress, + &p->IPv6HeaderPacketInfo.IPv6Header->SrcAddress, IP_PROTO_TCP, tcp_data, tcp_size, 0); + } + + // Generate the Ethernet and IP packet + b = NewBuf(); + + // Destination MAC address + WriteBuf(b, p->MacHeader->SrcAddress, 6); + WriteBuf(b, p->MacHeader->DestAddress, 6); + WriteBuf(b, &p->MacHeader->Protocol, 2); + + if (p->TypeL3 == L3_IPV4) + { + // IPv4 + IPV4_HEADER v4; + + Zero(&v4, sizeof(v4)); + + IPV4_SET_VERSION(&v4, 4); + IPV4_SET_HEADER_LEN(&v4, 5); + v4.TotalLength = Endian16((USHORT)(sizeof(IPV4_HEADER) + tcp_size)); + v4.Identification = Endian16(Rand16()); + IPV4_SET_FLAGS(&v4, 0x02); + v4.TimeToLive = 128; + v4.Protocol = IP_PROTO_TCP; + v4.SrcIP = p->L3.IPv4Header->DstIP; + v4.DstIP = p->L3.IPv4Header->SrcIP; + v4.Checksum = IpChecksum(&v4, sizeof(v4)); + + WriteBuf(b, &v4, sizeof(v4)); + } + else + { + // IPv6 + IPV6_HEADER v6; + + Zero(&v6, sizeof(v6)); + + IPV6_SET_VERSION(&v6, 6); + v6.PayloadLength = Endian16(tcp_size); + v6.NextHeader = IP_PROTO_TCP; + v6.HopLimit = 64; + + Copy(&v6.SrcAddress, &p->IPv6HeaderPacketInfo.IPv6Header->DestAddress, sizeof(IPV6_ADDR)); + Copy(&v6.DestAddress, &p->IPv6HeaderPacketInfo.IPv6Header->SrcAddress, sizeof(IPV6_ADDR)); + + WriteBuf(b, &v6, sizeof(v6)); + } + + WriteBuf(b, tcp_data, tcp_size); + + // Reply packet + StorePacketToHubPa((HUB_PA *)src_session->PacketAdapter->Param, + NULL, b->Buf, b->Size, NULL, false, false); + + // Release the memory + Free(tcp_data); + FreeBuf(payload); + Free(b); +} + +// Apply the access list for packets stored +bool ApplyAccessListToStoredPacket(HUB *hub, SESSION *s, PKT *p) +{ + UINT i; + bool pass = true; // Pass by default + bool use_redirect_url = false; + char redirect_url[MAX_REDIRECT_URL_LEN + 1]; + // Validate arguments + if (hub == NULL || s == NULL || p == NULL) + { + return false; + } + + if (hub->Option != NULL && hub->Option->FilterPPPoE) + { + if (p->MacHeader != NULL) + { + USHORT proto = Endian16(p->MacHeader->Protocol); + if (proto == 0x8863 || proto == 0x8864) + { + // PPPoE Filter + return false; + } + } + } + + if (hub->Option != NULL && hub->Option->FilterOSPF) + { + if (p->TypeL3 == L3_IPV4) + { + if (p->L3.IPv4Header != NULL) + { + if (p->L3.IPv4Header->Protocol == 89) + { + // OSPF Filter + return false; + } + } + } + } + + if (hub->Option != NULL && hub->Option->FilterIPv4) + { + if (p->MacHeader != NULL) + { + USHORT proto = Endian16(p->MacHeader->Protocol); + if (proto == 0x0800 || proto == 0x0806) + { + // IPv4 Filter + return false; + } + } + } + + if (hub->Option != NULL && hub->Option->FilterIPv6) + { + if (p->MacHeader != NULL) + { + USHORT proto = Endian16(p->MacHeader->Protocol); + if (proto == 0x86dd) + { + // IPv6 Filter + return false; + } + } + } + + if (hub->Option != NULL && hub->Option->FilterNonIP) + { + if (p->MacHeader != NULL) + { + USHORT proto = Endian16(p->MacHeader->Protocol); + if (!(proto == 0x86dd || proto == 0x0800 || proto == 0x0806)) + { + // Non-IP Filter + return false; + } + } + } + + if (hub->Option != NULL && hub->Option->FilterBPDU) + { + if (p->MacHeader != NULL) + { + if (p->TypeL3 == L3_BPDU) + { + // BPDU Filter + return false; + } + } + } + + LockList(hub->AccessList); + { + for (i = 0;i < LIST_NUM(hub->AccessList);i++) + { + ACCESS *a = LIST_DATA(hub->AccessList, i); + + if (a->DestUsernameHash != 0) + { + // If a destination user name is specified, suspend the scanning of the list. + break; + } + + if (IsPacketMaskedByAccessList(s, p, a, 0, 0, NULL)) + { + // Determine the pass or discard the packet + pass = a->Discard ? false : true; + + // Packets determined processing here is not scanned when leaving the HUB. + p->AccessChecked = true; + + // Copy of the parameters of the delay jitter packet loss + p->Delay = a->Delay; + p->Jitter = a->Jitter; + p->Loss = a->Loss; + + if (a->RedirectUrl[0] != 0) + { + // There is a setting of URL redirection in the access list + if ((p->TypeL3 == L3_IPV4 || p->TypeL3 == L3_IPV6) && + p->TypeL4 == L4_TCP) + { + TCP_HEADER *tcp = p->L4.TCPHeader; + + // Examine whether this packet is a TCP data packet + if (tcp != NULL) + { + if (tcp->Flag & TCP_ACK) + { + if ((tcp->Flag & TCP_SYN) == 0 && + (tcp->Flag & TCP_RST) == 0 && + (tcp->Flag & TCP_URG) == 0) + { + if (p->PayloadSize != 0) + { + // Do URL redirection + use_redirect_url = true; + StrCpy(redirect_url, sizeof(redirect_url), a->RedirectUrl); + } + } + } + } + } + } + + // Complete the scanning of the list here + break; + } + } + } + UnlockList(hub->AccessList); + + if (pass) + { + if (s->FirstTimeHttpRedirect && s->FirstTimeHttpAccessCheckIp != 0) + { + if ((p->TypeL3 == L3_IPV4 || p->TypeL3 == L3_IPV6) && + p->TypeL4 == L4_TCP) + { + TCP_HEADER *tcp = p->L4.TCPHeader; + + // Examine whether this packet is a TCP data packet + if (tcp != NULL) + { + if (tcp->DstPort == Endian16(80)) + { + if (p->L3.IPv4Header->DstIP == s->FirstTimeHttpAccessCheckIp) + { + s->FirstTimeHttpRedirect = false; + } + else if (tcp->Flag & TCP_ACK) + { + if ((tcp->Flag & TCP_SYN) == 0 && + (tcp->Flag & TCP_RST) == 0 && + (tcp->Flag & TCP_URG) == 0) + { + if (p->PayloadSize != 0) + { + if (IsTcpPacketNcsiHttpAccess(p) == false) + { +/* char tmp[4000]; + Zero(tmp, sizeof(tmp)); + Copy(tmp, p->Payload, p->PayloadSize); + Debug("HTTP: %s\n", tmp);*/ + if (IsEmptyStr(s->FirstTimeHttpRedirectUrl) == false) + { + use_redirect_url = true; + StrCpy(redirect_url, sizeof(redirect_url), s->FirstTimeHttpRedirectUrl); + } + } + } + } + } + } + } + } + } + } + + if (use_redirect_url) + { + if (s->NormalClient) + { + // In the case of a normal VPN client (Not a local bridge, a SecureNAT, and not a virtual L3 switch), + // process URL redirection and discard the packet + ForceRedirectToUrl(hub, s, p, redirect_url); + } + else + { + // Discard packets that is sent from the sessions such as local bridge, + // SecureNAT, virtual L3 switch + } + + pass = false; + } + + return pass; +} + +// Check whether the TCP packet is NCSI accessing +bool IsTcpPacketNcsiHttpAccess(PKT *p) +{ + // Validate arguments + if (p == NULL) + { + return false; + } + + if (p->TypeL4 != L4_TCP) + { + return false; + } + + if (p->Payload == NULL || p->PayloadSize == 0) + { + return false; + } + + if (SearchBin(p->Payload, 0, p->PayloadSize, "NCSI", 4) != INFINITE) + { + return true; + } + + if (SearchBin(p->Payload, 0, p->PayloadSize, ".jpeg", 5) != INFINITE) + { + return true; + } + + if (SearchBin(p->Payload, 0, p->PayloadSize, ".jpg", 4) != INFINITE) + { + return true; + } + + if (SearchBin(p->Payload, 0, p->PayloadSize, ".gif", 4) != INFINITE) + { + return true; + } + + if (SearchBin(p->Payload, 0, p->PayloadSize, ".css", 4) != INFINITE) + { + return true; + } + + return false; +} + +// Adding Access List +void AddAccessList(HUB *hub, ACCESS *a) +{ + AddAccessListEx(hub, a, false, false); +} +void AddAccessListEx(HUB *hub, ACCESS *a, bool no_sort, bool no_reassign_id) +{ + // Validate arguments + if (hub == NULL || a == NULL) + { + return; + } + + LockList(hub->AccessList); + { + ACCESS *access; + UINT i; + + // Check the number of items + if (LIST_NUM(hub->AccessList) >= MAX_ACCESSLISTS) + { + UnlockList(hub->AccessList); + return; + } + + access = Malloc(sizeof(ACCESS)); + Copy(access, a, sizeof(ACCESS)); + + access->IsSrcUsernameIncludeOrExclude = false; + access->IsDestUsernameIncludeOrExclude = false; + + // User name correction + if (IsEmptyStr(access->SrcUsername) == false) + { + if (StartWith(access->SrcUsername, ACCESS_LIST_INCLUDED_PREFIX) == false && StartWith(access->SrcUsername, ACCESS_LIST_EXCLUDED_PREFIX) == false) + { + MakeSimpleUsernameRemoveNtDomain(access->SrcUsername, sizeof(access->SrcUsername), access->SrcUsername); + } + else + { + access->IsSrcUsernameIncludeOrExclude = true; + } + } + if (IsEmptyStr(access->DestUsername) == false) + { + if (StartWith(access->DestUsername, ACCESS_LIST_INCLUDED_PREFIX) == false && StartWith(access->DestUsername, ACCESS_LIST_EXCLUDED_PREFIX) == false) + { + MakeSimpleUsernameRemoveNtDomain(access->DestUsername, sizeof(access->DestUsername), access->DestUsername); + } + else + { + access->IsDestUsernameIncludeOrExclude = true; + } + } + + access->SrcUsernameHash = UsernameToInt64(access->SrcUsername); + access->DestUsernameHash = UsernameToInt64(access->DestUsername); + + // Port number correction + if (access->SrcPortStart != 0) + { + access->SrcPortEnd = MAX(access->SrcPortEnd, access->SrcPortStart); + } + if (access->DestPortStart != 0) + { + access->DestPortEnd = MAX(access->DestPortEnd, access->DestPortStart); + } + + // Correct delay, jitter, and packet loss + access->Delay = MAKESURE(access->Delay, 0, HUB_ACCESSLIST_DELAY_MAX); + access->Jitter = MAKESURE(access->Jitter, 0, HUB_ACCESSLIST_JITTER_MAX); + access->Loss = MAKESURE(access->Loss, 0, HUB_ACCESSLIST_LOSS_MAX); + + if (no_sort == false) + { + Insert(hub->AccessList, access); + } + else + { + Add(hub->AccessList, access); + } + + // Reassign the ID + if (no_reassign_id == false) + { + for (i = 0;i < LIST_NUM(hub->AccessList);i++) + { + ACCESS *a = LIST_DATA(hub->AccessList, i); + a->Id = (i + 1); + } + } + } + UnlockList(hub->AccessList); +} + +// Initialize the access list +void InitAccessList(HUB *hub) +{ + // Validate arguments + if (hub == NULL) + { + return; + } + + hub->AccessList = NewList(CmpAccessList); +} + +// Release the access list +void FreeAccessList(HUB *hub) +{ + UINT i; + // Validate arguments + if (hub == NULL) + { + return; + } + + for (i = 0;i < LIST_NUM(hub->AccessList);i++) + { + ACCESS *a = LIST_DATA(hub->AccessList, i); + Free(a); + } + + ReleaseList(hub->AccessList); + hub->AccessList = NULL; +} + +// Comparison of the access list entry +int CmpAccessList(void *p1, void *p2) +{ + ACCESS *a1, *a2; + if (p1 == NULL || p2 == NULL) + { + return 0; + } + a1 = *(ACCESS **)p1; + a2 = *(ACCESS **)p2; + if (a1 == NULL || a2 == NULL) + { + return 0; + } + // Sort by priority + if (a1->Priority > a2->Priority) + { + return 1; + } + else if (a1->Priority < a2->Priority) + { + return -1; + } + else if (a1->Discard > a2->Discard) + { + return 1; + } + else if (a1->Discard < a2->Discard) + { + return -1; + } + else + { + UINT64 size64 = ((UINT64)(&a1->UniqueId) - (UINT64)(&a1->Active)); + UINT size32 = (UINT)size64; + + return Cmp(&a1->Active, &a2->Active, size32); + } +} + +// Generate a user name without domain name of the Windows NT +void MakeSimpleUsernameRemoveNtDomain(char *dst, UINT dst_size, char *src) +{ + char tmp1[MAX_SIZE]; + char tmp2[MAX_SIZE]; + // Validate arguments + if (dst == NULL || src == NULL) + { + return; + } + + ParseNtUsername(src, tmp1, sizeof(tmp1), tmp2, sizeof(tmp2), false); + + StrCpy(dst, dst_size, tmp1); +} + +// Convert the user name to UINT +UINT64 UsernameToInt64(char *name) +{ + UCHAR hash[SHA1_SIZE]; + UINT64 ret; + char tmp[MAX_USERNAME_LEN + 1]; + // Validate arguments + if (name == 0 || IsEmptyStr(name)) + { + return 0; + } + + if (StartWith(name, ACCESS_LIST_INCLUDED_PREFIX) || StartWith(name, ACCESS_LIST_EXCLUDED_PREFIX)) + { + return Rand64(); + } + + MakeSimpleUsernameRemoveNtDomain(tmp, sizeof(tmp), name); + Trim(tmp); + StrUpper(tmp); + + if (StrLen(tmp) == 0) + { + return 0; + } + + Sha0(hash, tmp, StrLen(tmp)); + Copy(&ret, hash, sizeof(ret)); + + return ret; +} + +// Search the session from the session name +SESSION *GetSessionByName(HUB *hub, char *name) +{ + // Validate arguments + if (hub == NULL || name == NULL) + { + return NULL; + } + + LockList(hub->SessionList); + { + UINT i; + for (i = 0;i < LIST_NUM(hub->SessionList);i++) + { + SESSION *s = LIST_DATA(hub->SessionList, i); + if (StrCmpi(s->Name, name) == 0) + { + // Found + AddRef(s->ref); + UnlockList(hub->SessionList); + return s; + } + } + } + UnlockList(hub->SessionList); + + return NULL; +} + +// Sort of the STORM list +int CompareStormList(void *p1, void *p2) +{ + STORM *s1, *s2; + UINT r; + // Validate arguments + if (p1 == NULL || p2 == NULL) + { + return 0; + } + s1 = *(STORM **)p1; + s2 = *(STORM **)p2; + if (s1 == NULL || s2 == NULL) + { + return 0; + } + if (s1->StrictMode == false && s2->StrictMode == false) + { + // Normal mode + r = CmpIpAddr(&s1->DestIp, &s2->DestIp); + if (r != 0) + { + return r; + } + r = CmpIpAddr(&s1->SrcIp, &s2->SrcIp); + if (r != 0) + { + return r; + } + } + else + { + // Strict mode + int r1, r2; + r1 = CmpIpAddr(&s1->DestIp, &s2->DestIp); + r2 = CmpIpAddr(&s1->SrcIp, &s2->SrcIp); + if (r1 == 0 || r2 == 0) + { + // Either the source IP, and destination IP match + } + else + { + // Mismatch + if (r1 != 0) + { + return r1; + } + + if (r2 != 0) + { + return r2; + } + } + } + r = Cmp(s1->MacAddress, s2->MacAddress, 6); + return r; +} + +// Packet adapter initialization +bool HubPaInit(SESSION *s) +{ + // Initialize the packet adapter information + HUB_PA *pa = ZeroMalloc(sizeof(HUB_PA)); + pa->Cancel = NewCancel(); + pa->PacketQueue = NewQueue(); + pa->Now = Tick64(); + pa->Session = s; + pa->StormList = NewList(CompareStormList); + pa->UsernameHash = UsernameToInt64(s->Username); + pa->GroupnameHash = UsernameToInt64(s->GroupName); + + s->PacketAdapter->Param = pa; + + if (s->Policy->MonitorPort) + { + // Mark this port as monitoring port + pa->MonitorPort = true; + + // Add this session to the list of monitoring port of the HUB + LockList(s->Hub->MonitorList); + { + Insert(s->Hub->MonitorList, s); + } + UnlockList(s->Hub->MonitorList); + } + + return true; +} + +// Release the Packet adapter +void HubPaFree(SESSION *s) +{ + HUB_PA *pa = (HUB_PA *)s->PacketAdapter->Param; + HUB *hub = s->Hub; + + if (pa->MonitorPort) + { + // Remove the session from the list of monitor port of the HUB + LockList(s->Hub->MonitorList); + { + Delete(s->Hub->MonitorList, s); + } + UnlockList(s->Hub->MonitorList); + } + + // Erase MAC address table entries that is associated with this session + LockHashList(hub->MacHashTable); + { + UINT i, num; + MAC_TABLE_ENTRY **pp; + LIST *o = NewListFast(NULL); + + pp = (MAC_TABLE_ENTRY **)HashListToArray(hub->MacHashTable, &num); + for (i = 0;i < num;i++) + { + MAC_TABLE_ENTRY *e = (MAC_TABLE_ENTRY *)pp[i]; + if (e->Session == s) + { + Add(o, e); + } + } + for (i = 0;i < LIST_NUM(o);i++) + { + MAC_TABLE_ENTRY *e = (MAC_TABLE_ENTRY *)LIST_DATA(o, i); + DeleteHash(hub->MacHashTable, e); + Free(e); + } + ReleaseList(o); + Free(pp); + } + { + UINT i, num = LIST_NUM(hub->IpTable); + LIST *o = NewListFast(NULL); + for (i = 0;i < num;i++) + { + IP_TABLE_ENTRY *e = LIST_DATA(hub->IpTable, i); + if (e->Session == s) + { + Add(o, e); + } + } + for (i = 0;i < LIST_NUM(o);i++) + { + IP_TABLE_ENTRY *e = LIST_DATA(o, i); + Delete(hub->IpTable, e); + Free(e); + } + ReleaseList(o); + } + UnlockHashList(hub->MacHashTable); + + // Release the STORM list + LockList(pa->StormList); + { + UINT i; + for (i = 0;i < LIST_NUM(pa->StormList);i++) + { + STORM *s = (STORM *)LIST_DATA(pa->StormList, i); + Free(s); + } + DeleteAll(pa->StormList); + } + UnlockList(pa->StormList); + + ReleaseList(pa->StormList); + + // Release the packets remaining in the queue + LockQueue(pa->PacketQueue); + { + BLOCK *b; + + while (b = GetNext(pa->PacketQueue)) + { + // Release the block + if (b->IsFlooding) + { + CedarAddCurrentTcpQueueSize(s->Cedar, -((int)b->Size)); + } + + FreeBlock(b); + } + } + UnlockQueue(pa->PacketQueue); + + // Release the queue + ReleaseQueue(pa->PacketQueue); + + // Release the cancel object + ReleaseCancel(pa->Cancel); + + // Release the packet adapter information + Free(pa); + s->PacketAdapter->Param = NULL; +} + +// Get the cancel object +CANCEL *HubPaGetCancel(SESSION *s) +{ + HUB_PA *pa = (HUB_PA *)s->PacketAdapter->Param; + + AddRef(pa->Cancel->ref); + return pa->Cancel; +} + +// Get the packet to be transmitted next +UINT HubPaGetNextPacket(SESSION *s, void **data) +{ + UINT ret = 0; + HUB_PA *pa = (HUB_PA *)s->PacketAdapter->Param; + + // Get one from the head of the queue + LockQueue(pa->PacketQueue); + { + BLOCK *block = GetNext(pa->PacketQueue); + if (block == NULL) + { + // No queue + ret = 0; + } + else + { + if (block->IsFlooding) + { + CedarAddCurrentTcpQueueSize(s->Cedar, -((int)block->Size)); + } + + // Found + *data = block->Buf; + ret = block->Size; + // Release the memory of the structure of the block + Free(block); + } + } + UnlockQueue(pa->PacketQueue); + + return ret; +} + +// Receive a packet +bool HubPaPutPacket(SESSION *s, void *data, UINT size) +{ + PKT *packet; + HUB_PA *pa = (HUB_PA *)s->PacketAdapter->Param; + bool b = false; + HUB *hub; + bool no_l3 = false; + bool no_http = false; + LIST *o = NULL; + UINT i; + UINT vlan_type_id = 0; + bool no_look_bpdu_bridge_id = false; + bool no_parse_dhcp = false; + bool no_correct_checksum = false; + + hub = s->Hub; + + pa->Now = Tick64(); + + // Processing of Adjust TCP MSS + if (hub != NULL && hub->Option != NULL && hub->Option->DisableAdjustTcpMss == false && s != NULL) + { + UINT target_mss = (hub->Option->AdjustTcpMssValue == 0 ? INFINITE : hub->Option->AdjustTcpMssValue); + UINT session_mss = (s->AdjustMss == 0 ? INFINITE : s->AdjustMss); + + target_mss = MIN(target_mss, session_mss); + + if (s->IsUsingUdpAcceleration && s->UdpAccelMss != 0) + { + // If the link is established with UDP acceleration function, use optimum value of the UDP acceleration function + target_mss = MIN(target_mss, s->UdpAccelMss); + } + else if (s->IsRUDPSession && s->RUdpMss != 0) + { + // If the link with UDP acceleration is not established, use the optimum value for R-UDP in the case of using R-UDP connection + target_mss = MIN(target_mss, s->RUdpMss); + } + + if (target_mss != INFINITE) + { + AdjustTcpMssL2(data, size, target_mss, hub->Option->VlanTypeId); + } + } + + if (data == NULL) + { + // Check the delayed packet + o = NULL; + LockList(s->DelayedPacketList); + { + UINT i; + if (LIST_NUM(s->DelayedPacketList) >= 1) + { + UINT64 now = TickHighres64(); + for (i = 0;i < LIST_NUM(s->DelayedPacketList);i++) + { + PKT *p = LIST_DATA(s->DelayedPacketList, i); + + if (now >= p->DelayedForwardTick) + { + if (o == NULL) + { + o = NewListFast(NULL); + } + + Add(o, p); + } + } + } + + if (o != NULL) + { + for (i = 0;i < LIST_NUM(o);i++) + { + PKT *p = LIST_DATA(o, i); + + Delete(s->DelayedPacketList, p); + } + } + } + UnlockList(s->DelayedPacketList); + + // If there is a delayed packet, store it + if (o != NULL) + { + for (i = 0;i < LIST_NUM(o);i++) + { + PKT *p = LIST_DATA(o, i); + + StorePacket(s->Hub, s, p); + } + + ReleaseList(o); + } + + // Reception of all packets from this session is complete + CancelList(s->CancelList); + + // Yield + if (hub != NULL) + { + if (hub->Option != NULL && hub->Option->YieldAfterStorePacket) + { + YieldCpu(); + } + } + + return true; + } + + if (hub != NULL && hub->Option != NULL) + { + no_l3 = hub->Option->DisableIPParsing; + no_http = hub->Option->DisableHttpParsing; + vlan_type_id = hub->Option->VlanTypeId; + no_look_bpdu_bridge_id = hub->Option->NoLookBPDUBridgeId; + no_correct_checksum = hub->Option->DisableCorrectIpOffloadChecksum; + } + + // Insert a VLAN tag + if (s->VLanId != 0) + { + VLanInsertTag(&data, &size, s->VLanId, vlan_type_id); + } + +LABEL_TRY_AGAIN: + // Parse the packet + packet = ParsePacketEx4(data, size, no_l3, vlan_type_id, !no_look_bpdu_bridge_id, no_http, !no_correct_checksum); + + if (packet != NULL) + { + if (packet->InvalidSourcePacket) + { + // Packet which have illegal source + FreePacket(packet); + packet = NULL; + } + } + + + if (packet != NULL) + { + if (packet->TypeL7 == L7_DHCPV4) + { + if (packet->TypeL3 == L3_IPV4 && packet->TypeL4 == L4_UDP) + { + if (packet->L7.DHCPv4Header != NULL) + { + DHCPV4_HEADER *dhcp = packet->L7.DHCPv4Header; + + if (dhcp->OpCode == 1) + { + if (NsIsMacAddressOnLocalhost(dhcp->ClientMacAddress)) + { + // Filter DHCP requests sent from local kernel-mode virtual NAT + // not to re-enter it to the virtual HUB along the local bridge + FreePacket(packet); + packet = NULL; + } + } + } + } + } + } + + if (no_parse_dhcp == false && packet != NULL) + { + if (hub != NULL && hub->Option != NULL && hub->Option->RemoveDefGwOnDhcpForLocalhost) + { + // Remove the designation of the DHCP server from the DHCP response packet addressed to localhost + if (packet->TypeL7 == L7_DHCPV4) + { + if (packet->TypeL3 == L3_IPV4) + { + if (packet->TypeL4 == L4_UDP) + { + if (packet->L7.DHCPv4Header != NULL) + { + DHCPV4_HEADER *dhcp = packet->L7.DHCPv4Header; + + if (dhcp->OpCode == 2) + { + if (IsMacAddressLocalFast(dhcp->ClientMacAddress)) + { + BUF *new_buf; + DHCP_MODIFY_OPTION m; + WHERE; + + Zero(&m, sizeof(m)); + m.RemoveDefaultGatewayOnReply = true; + + new_buf = DhcpModifyIPv4(&m, data, size); + + if (new_buf != NULL) + { + Free(data); + + data = new_buf->Buf; + size = new_buf->Size; + + Free(new_buf); + + no_parse_dhcp = true; + + FreePacket(packet); + + goto LABEL_TRY_AGAIN; + } + } + } + } + } + } + } + } + } + + if (packet != NULL) + { + // Store packet + StorePacket(s->Hub, s, packet); + } + else + { + // Release the packet data because it is a bad packet (not a correct MAC frame) + Free(data); + } + + return true; +} + +// Checking algorithm to prevent broadcast-storm +// If broadcast from a specific endpoint came frequently, filter it +bool CheckBroadcastStorm(HUB *hub, SESSION *s, PKT *p) +{ + IP src_ip, dest_ip; + HUB_PA *pa; + UINT64 now = Tick64(); + UINT limit_start_count; + SESSION *sess = s; + bool ret = true; + bool strict = false; + bool no_heavy = false; + // Validate arguments + if (s == NULL || p == NULL || hub == NULL) + { + return false; + } + + if (s->Policy->NoBroadcastLimiter) + { + // Unlimited the number of broadcasts + return true; + } + + if (hub->Option != NULL) + { + strict = hub->Option->BroadcastLimiterStrictMode; + no_heavy = hub->Option->DoNotSaveHeavySecurityLogs; + } + + pa = (HUB_PA *)s->PacketAdapter->Param; + + Zero(&src_ip, sizeof(IP)); + Zero(&dest_ip, sizeof(IP)); + + if (p->TypeL3 == L3_IPV4) + { + UINTToIP(&src_ip, p->L3.IPv4Header->SrcIP); + UINTToIP(&dest_ip, p->L3.IPv4Header->DstIP); + } + else if (p->TypeL3 == L3_ARPV4) + { + UINTToIP(&src_ip, p->L3.ARPv4Header->SrcIP); + Zero(&dest_ip, sizeof(IP)); + } + else if (p->TypeL3 == L3_IPV6) + { + IPv6AddrToIP(&src_ip, &p->L3.IPv6Header->SrcAddress); + IPv6AddrToIP(&dest_ip, &p->L3.IPv6Header->DestAddress); + } + + // Number of broadcast to start limitation for a single interval + limit_start_count = 32; + + if (s->Hub != NULL && s->Hub->Option->BroadcastStormDetectionThreshold != 0) + { + limit_start_count = s->Hub->Option->BroadcastStormDetectionThreshold; + } + + LockList(pa->StormList); + { + STORM *s; + UINT num; + s = SearchStormList(pa, p->MacAddressSrc, &src_ip, &dest_ip, strict); + if (s == NULL) + { + s = AddStormList(pa, p->MacAddressSrc, &src_ip, &dest_ip, strict); + } + + s->CurrentBroadcastNum++; + + if ((s->CheckStartTick + STORM_CHECK_SPAN) < now || + s->CheckStartTick == 0 || s->CheckStartTick > now) + { + // Measure the number of broadcast periodically + UINT64 diff_time; + if (s->CheckStartTick < now) + { + diff_time = now - s->CheckStartTick; + } + else + { + diff_time = 0; + } + s->CheckStartTick = now; + num = (UINT)((UINT64)s->CurrentBroadcastNum * (UINT64)1000 / (UINT64)STORM_CHECK_SPAN); + s->CurrentBroadcastNum = 0; + if (num >= limit_start_count) + { + char ip1[64]; + char ip2[64]; + char mac[MAX_SIZE]; + IPToStr(ip1, sizeof(ip1), &src_ip); + IPToStr(ip2, sizeof(ip2), &dest_ip); + ret = false; + if (s->DiscardValue < STORM_DISCARD_VALUE_END) + { + s->DiscardValue = MAX(s->DiscardValue, 1) * 2; + } + Debug("s->DiscardValue: %u (%u)\n", s->DiscardValue, num); + + MacToStr(mac, sizeof(mac), p->MacAddressSrc); + + if (no_heavy == false) + { + HLog(sess->Hub, "LH_BCAST_STORM", sess->Name, mac, ip1, ip2, num); + } + } + else + { + if (s->DiscardValue >= 1) + { + s->DiscardValue = (UINT)((UINT64)s->DiscardValue / MAX((UINT64)2, (UINT64)diff_time / (UINT64)STORM_CHECK_SPAN)); + } + } + } + + if (s->DiscardValue >= STORM_DISCARD_VALUE_START) + { + if (s->DiscardValue >= 128) + { + ret = false; + } + else if ((rand() % s->DiscardValue) != 0) + { + ret = false; + } + } + + } + UnlockList(pa->StormList); + + return ret; +} + +// Store packet +void StorePacket(HUB *hub, SESSION *s, PKT *packet) +{ + MAC_TABLE_ENTRY *entry = NULL; + MAC_TABLE_ENTRY t; + void *data; + UINT size; + bool broadcast_mode; + HUB_PA *dest_pa; + SESSION *dest_session; + UINT64 now = Tick64(); + bool no_heavy = false; + bool drop_broadcast_packet_privacy = false; + bool drop_arp_packet_privacy = false; + UINT tcp_queue_quota = 0; + UINT64 dormant_interval = 0; + // Validate arguments + if (hub == NULL || packet == NULL) + { + return; + } + + if (s != NULL) + { + if (((HUB_PA *)s->PacketAdapter->Param)->MonitorPort) + { + // Not to forward packets received from the monitor port + Free(packet->PacketData); + FreePacket(packet); + return; + } + } + + if (hub->Option != NULL) + { + no_heavy = hub->Option->DoNotSaveHeavySecurityLogs; + drop_broadcast_packet_privacy = hub->Option->DropBroadcastsInPrivacyFilterMode; + drop_arp_packet_privacy = hub->Option->DropArpInPrivacyFilterMode; + tcp_queue_quota = hub->Option->FloodingSendQueueBufferQuota; + if (hub->Option->DetectDormantSessionInterval != 0) + { + dormant_interval = (UINT64)hub->Option->DetectDormantSessionInterval * (UINT64)1000; + } + } + + if (dormant_interval != 0) + { + if (s != NULL && s->NormalClient) + { + if (packet->MacAddressSrc != NULL) + { + if (IsHubMacAddress(packet->MacAddressSrc) == false) + { + s->LastCommTimeForDormant = now; + } + } + } + } + + // Lock the entire MAC address table + LockHashList(hub->MacHashTable); + { + // Filtering + if (s != NULL && (packet->DelayedForwardTick == 0 && StorePacketFilter(s, packet) == false)) + { +DISCARD_PACKET: + // Release a packet since passing has been disallowed + Free(packet->PacketData); + FreePacket(packet); + } + else // Passing is allowed + { + bool forward_now = true; + + if (packet->Loss >= 1) + { + // Cause packet loss + UINT r = rand() % 100; + if ((packet->Loss >= 100) || (r < packet->Loss)) + { + // Packet loss + goto DISCARD_PACKET; + } + } + + if (packet->Delay >= 1) + { + float delay = (float)packet->Delay; + float jitter; + UINT delay_uint; + bool f = Rand1(); + if (packet->Jitter == 0) + { + jitter = 0; + } + else + { + jitter = (float)(Rand32() % (int)((float)packet->Jitter * delay / 100.0f)); + } + + delay += jitter * (f ? 1 : -1); + delay_uint = (UINT)delay; + + if (delay_uint >= 1) + { + // Cause delay + forward_now = false; + packet->Loss = packet->Jitter = packet->Delay = 0; + packet->DelayedForwardTick = TickHighres64() + (UINT64)delay_uint; + packet->DelayedSrcSession = s; + + LockList(s->DelayedPacketList); + { + Add(s->DelayedPacketList, packet); + } + UnlockList(s->DelayedPacketList); + } + } + + if (forward_now) + { + if (memcmp(packet->MacAddressSrc, hub->HubMacAddr, 6) == 0) + { + if (s != NULL) + { + // Packets that this HUB itself sent is input from the outside + goto DISCARD_PACKET; + } + } + if (s != NULL && (memcmp(packet->MacAddressSrc, hub->HubMacAddr, 6) != 0)) + { + // Check whether the source MAC address is registered in the table + Copy(t.MacAddress, packet->MacAddressSrc, 6); + if (hub->Option->NoManageVlanId == false) + { + t.VlanId = packet->VlanId; + } + else + { + t.VlanId = 0; + } + entry = SearchHash(hub->MacHashTable, &t); + + if (entry == NULL) + { + if (hub->LastFlushTick == 0 || (hub->LastFlushTick + (UINT64)OLD_MAC_ADDRESS_ENTRY_FLUSH_INTERVAL) < now) + { + hub->LastFlushTick = now; + + // Remove old entries + DeleteExpiredMacTableEntry(hub->MacHashTable); + } + + // Register since it is not registered + if ((s->Policy->MaxMac != 0 || s->Policy->NoBridge) && (s->IsOpenVPNL3Session == false)) + { + UINT i, num_mac_for_me = 0; + UINT limited_count; + MAC_TABLE_ENTRY **pp; + UINT num_pp; + + pp = (MAC_TABLE_ENTRY **)HashListToArray(hub->MacHashTable, &num_pp); + + // Examine a number of MAC addresses that are registered in this current session + for (i = 0;i < num_pp;i++) + { + MAC_TABLE_ENTRY *e = pp[i]; + if (e->Session == s) + { + num_mac_for_me++; + } + } + + Free(pp); + + limited_count = 0xffffffff; + if (s->Policy->NoBridge) + { + limited_count = MIN(limited_count, MAC_MIN_LIMIT_COUNT); + } + if (s->Policy->MaxMac != 0) + { + limited_count = MIN(limited_count, s->Policy->MaxMac); + } + limited_count = MAX(limited_count, MAC_MIN_LIMIT_COUNT); + + if (num_mac_for_me >= limited_count) + { + // Number of MAC addresses that are registered already exceeds the upper limit + char mac_str[64]; + + if (s != NULL) + { + MacToStr(mac_str, sizeof(mac_str), packet->MacAddressSrc); + if (s->Policy->NoBridge) + { + if (no_heavy == false) + { + HLog(hub, "LH_BRIDGE_LIMIT", s->Name, mac_str, num_mac_for_me, limited_count); + } + } + else + { + if (no_heavy == false) + { + HLog(hub, "LH_MAC_LIMIT", s->Name, mac_str, num_mac_for_me, limited_count); + } + } + } + + goto DISCARD_PACKET; // Drop the packet + } + } + + if (HASH_LIST_NUM(hub->MacHashTable) >= MAX_MAC_TABLES) + { + // Number of MAC addresses exceeded, discard the packet + goto DISCARD_PACKET; + } + + entry = ZeroMalloc(sizeof(MAC_TABLE_ENTRY)); + entry->HubPa = (HUB_PA *)s->PacketAdapter->Param; + Copy(entry->MacAddress, packet->MacAddressSrc, 6); + if (hub->Option->NoManageVlanId == false) + { + entry->VlanId = packet->VlanId; + } + else + { + entry->VlanId = 0; + } + entry->Session = s; + entry->UpdatedTime = entry->CreatedTime = now; + + AddHash(hub->MacHashTable, entry); + + if (hub->Option->NoMacAddressLog == false) + { + // Debug display + char mac_address[32]; + + if (s != NULL) + { + if (no_heavy == false) + { + MacToStr(mac_address, sizeof(mac_address), packet->MacAddressSrc); + // Debug("Register MAC Address %s to Session %X.\n", mac_address, s); + + if (packet->VlanId == 0) + { + HLog(hub, "LH_MAC_REGIST", s->Name, mac_address); + } + else + { + HLog(hub, "LH_MAC_REGIST_VLAN", s->Name, mac_address, packet->VlanId); + } + } + } + } + } + else + { + if (entry->Session == s) + { + // Do not do anything because it is already registered + entry->UpdatedTime = now; + } + else + { + // Read the value of the policy CheckMac + bool check_mac = s->Policy->CheckMac; + + if (check_mac == false) + { + if (s->BridgeMode) + { + // Enable the CheckMac policy for the local bridge session forcibly + check_mac = true; + + if (hub->Option != NULL && hub->Option->DisableCheckMacOnLocalBridge) + { + // Disable if DisableCheckMacOnLocalBridge option is set + check_mac = false; + } + } + } + + // It's already registered and it's in another session + if (check_mac && (memcmp(packet->MacAddressSrc, hub->HubMacAddr, 6) != 0) && + ((entry->UpdatedTime + MAC_TABLE_EXCLUSIVE_TIME) >= now)) + { + UCHAR *mac = packet->MacAddressSrc; + if (hub->Option != NULL && hub->Option->FixForDLinkBPDU && + (mac[0] == 0x00 && mac[1] == 0x80 && mac[2] == 0xc8 && mac[3] == 0x00 && mac[4] == 0x00 && mac[5] == 0x00) || + (mac[0] == 0x00 && mac[1] == 0x0d && mac[2] == 0x88 && mac[3] == 0x00 && mac[4] == 0x00 && mac[5] == 0x00)) + { + // Measures for D-Link. Spanning tree packet of D-Link is sent from the above address. + //CheckMac options for the local bridge may cause an adverse effect. So process this exceptionally. + UCHAR hash[MD5_SIZE]; + UINT64 tick_diff = Tick64() - s->LastDLinkSTPPacketSendTick; + + Md5(hash, packet->PacketData, packet->PacketSize); + + if ((s->LastDLinkSTPPacketSendTick != 0) && + (tick_diff < 750ULL) && + (memcmp(hash, s->LastDLinkSTPPacketDataHash, MD5_SIZE) == 0)) + { + // Discard if the same packet sent before 750ms ago + Debug("D-Link Discard %u\n", (UINT)tick_diff); + goto DISCARD_PACKET; // Drop the packet + } + else + { + goto UPDATE_FDB; + } + } + else + { + if (0) + { + // If the CheckMac policy-enabled, owning same + // MAC address by other sessions are prohibited + // (If the second byte is 0xAE, don't perform this check) + char mac_address[32]; + BinToStr(mac_address, sizeof(mac_address), packet->MacAddressSrc, 6); + } + } + + goto DISCARD_PACKET; // Drop the packet + } + else + { + // Rewrite the session of MAC address table and the HUB_PA + char mac_address[32]; +UPDATE_FDB: + BinToStr(mac_address, sizeof(mac_address), packet->MacAddressSrc, 6); + + entry->Session = s; + entry->HubPa = (HUB_PA *)s->PacketAdapter->Param; + entry->UpdatedTime = entry->CreatedTime = now; + + if (1) + { + // Debug display + char mac_address[32]; + + if (s != NULL) + { + if (no_heavy == false) + { + MacToStr(mac_address, sizeof(mac_address), packet->MacHeader->SrcAddress); + Debug("Register MAC Address %s to Session %X.\n", mac_address, s); + if (packet->VlanId == 0) + { + HLog(hub, "LH_MAC_REGIST", s->Name, mac_address); + } + else + { + HLog(hub, "LH_MAC_REGIST_VLAN", s->Name, mac_address, packet->VlanId); + } + } + } + } + } + } + } + } + + broadcast_mode = false; + dest_pa = NULL; + dest_session = NULL; + + if (packet->BroadcastPacket) + { + // Broadcast packet + broadcast_mode = true; + } + else + { + // Examine whether the destination MAC address is registered in the table + Copy(t.MacAddress, packet->MacAddressDest, 6); + if (hub->Option->NoManageVlanId == false) + { + t.VlanId = packet->VlanId; + } + else + { + t.VlanId = 0; + } + entry = SearchHash(hub->MacHashTable, &t); + + if (entry == NULL) + { + // Broadcast because the destination isn't found + broadcast_mode = true; + } + else + { + if (entry->Session != s) + { + // Destination is found + dest_pa = entry->HubPa; + dest_session = entry->Session; + } + else + { + // Bad packet whose destination is its own + goto DISCARD_PACKET; + } + } + } + + if (s != NULL && hub->Option->NoIpTable == false) + { + if (packet->TypeL3 == L3_IPV6) + { + // IPv6 packet + IP ip; + bool b = true; + UINT ip_type; + bool dhcp_or_ra = false; + + IPv6AddrToIP(&ip, &packet->L3.IPv6Header->SrcAddress); + ip_type = GetIPv6AddrType(&packet->L3.IPv6Header->SrcAddress); + + if (!(ip_type & IPV6_ADDR_UNICAST)) + { + // Multicast address + b = false; + } + else if ((ip_type & IPV6_ADDR_LOOPBACK) || (ip_type & IPV6_ADDR_ZERO)) + { + // Loop-back address or all-zero address + b = false; + } + + if (packet->TypeL4 == L4_ICMPV6) + { + if (packet->ICMPv6HeaderPacketInfo.Type == 133 || + packet->ICMPv6HeaderPacketInfo.Type == 134) + { + // ICMPv6 RS/RA + dhcp_or_ra = true; + } + } + else if (packet->TypeL4 == L4_UDP) + { + if (Endian16(packet->L4.UDPHeader->DstPort) == 546 || + Endian16(packet->L4.UDPHeader->DstPort) == 547) + { + // DHCPv6 + dhcp_or_ra = true; + } + } + + if (IsHubMacAddress(packet->MacAddressSrc) && + IsHubIpAddress64(&packet->L3.IPv6Header->SrcAddress)) + { + // The source address of the Virtual HUB for polling + b = false; + } + + if (b) + { + // Other than ICMPv6 RS/RA nor DHCPv6 packet + IP_TABLE_ENTRY t, *e; + + Copy(&t.Ip, &ip, sizeof(IP)); + + // Check whether it is registered to an existing table + e = Search(hub->IpTable, &t); + + if (e == NULL) + { + // Register since it is not registered + if (s->Policy->NoRoutingV6 || s->Policy->MaxIPv6 != 0) + { + UINT i, num_ip_for_me = 0; + UINT limited_count = 0xffffffff; + + for (i = 0;i < LIST_NUM(hub->IpTable);i++) + { + IP_TABLE_ENTRY *e = LIST_DATA(hub->IpTable, i); + + if (e->Session == s) + { + if (IsIP6(&e->Ip)) + { + num_ip_for_me++; + } + } + } + + if (s->Policy->NoRoutingV6) + { + limited_count = MIN(limited_count, IP_LIMIT_WHEN_NO_ROUTING_V6); + } + if (s->Policy->MaxIPv6 != 0) + { + limited_count = MIN(limited_count, s->Policy->MaxIPv6); + } + limited_count = MAX(limited_count, IP_MIN_LIMIT_COUNT_V6); + + if (dhcp_or_ra) + { + limited_count = 0xffffffff; + } + + if (num_ip_for_me >= limited_count) + { + // Discard the packet because it exceeded the + // upper limit of the IP address that can be used + char tmp[64]; + IPToStr(tmp, sizeof(tmp), &ip); + if (s->Policy->NoRoutingV6 == false) + { + if (no_heavy == false) + { + HLog(hub, "LH_IP_LIMIT", s->Name, tmp, num_ip_for_me, limited_count); + } + } + else + { + if (no_heavy == false) + { + HLog(hub, "LH_ROUTING_LIMIT", s->Name, tmp, num_ip_for_me, limited_count); + } + } + goto DISCARD_PACKET; + } + } + + if (IsIPManagementTargetForHUB(&ip, hub)) + { + // Create a entry + e = ZeroMalloc(sizeof(IP_TABLE_ENTRY)); + e->CreatedTime = e->UpdatedTime = now; + e->DhcpAllocated = false; + Copy(&e->Ip, &ip, sizeof(IP)); + Copy(e->MacAddress, packet->MacAddressSrc, 6); + e->Session = s; + + DeleteExpiredIpTableEntry(hub->IpTable); + + if (LIST_NUM(hub->IpTable) >= MAX_IP_TABLES) + { + // Delete old IP table entries + DeleteOldIpTableEntry(hub->IpTable); + } + + Insert(hub->IpTable, e); + + if (0) + { + char ip_address[64]; + IPToStr(ip_address, sizeof(ip_address), &ip); + Debug("Registered IP Address %s to Session %X.\n", + ip_address, s); + } + } + } + else + { + if (e->Session == s) + { + // Do not do anything because it is self session + // Renew updated time + e->UpdatedTime = now; + Copy(e->MacAddress, packet->MacAddressSrc, 6); + } + else + { + // Another session was using this IP address before + if ((s->Policy->CheckIPv6) && + ((e->UpdatedTime + IP_TABLE_EXCLUSIVE_TIME) >= now)) + { + // Discard the packet because another session uses this IP address + char ip_address[32]; + char mac_str[48]; + IPToStr(ip_address, sizeof(ip_address), &ip); + + Debug("IP Address %s is Already used by Session %X.\n", + ip_address, s); + + MacToStr(mac_str, sizeof(mac_str), e->MacAddress); + + if (no_heavy == false) + { + HLog(hub, "LH_IP_CONFLICT", s->Name, ip_address, e->Session->Name, mac_str, + e->CreatedTime, e->UpdatedTime, e->DhcpAllocated, now); + } + + goto DISCARD_PACKET; + } + } + } + } + } + } + + if ( + (s != NULL) && + (hub->Option->NoIpTable == false) && + ( + (packet->TypeL3 == L3_IPV4 || + (packet->TypeL3 == L3_ARPV4 && packet->L3.ARPv4Header->HardwareSize == 6 && + Endian16(packet->L3.ARPv4Header->HardwareType) == ARP_HARDWARE_TYPE_ETHERNET && + packet->L3.ARPv4Header->ProtocolSize == 4 && + Endian16(packet->L3.ARPv4Header->ProtocolType) == 0x0800) + ) && + (packet->TypeL7 != L7_DHCPV4) + ) + ) // Other than DHCP packets + { + // In the case of the ARP response packet or the IP packet, search in the IP address table + IP_TABLE_ENTRY t, *e; + IP ip; + UINT uint_ip = 0; + + if (packet->TypeL3 == L3_IPV4) + { + uint_ip = packet->L3.IPv4Header->SrcIP; + } + else if (packet->TypeL3 == L3_ARPV4) + { + uint_ip = packet->L3.ARPv4Header->SrcIP; + } + + if (uint_ip != 0 && uint_ip != 0xffffffff && !(IsHubIpAddress32(uint_ip) && IsHubMacAddress(packet->MacAddressSrc))) + { + UINTToIP(&ip, uint_ip); + Copy(&t.Ip, &ip, sizeof(IP)); + + // Check whether it is registered to an existing table + e = Search(hub->IpTable, &t); + + if (e == NULL) + { + // Register since it is not registered + if (s->Policy->DHCPForce) + { + char ipstr[MAX_SIZE]; + + // Discard the packet because this IP address isn't + // assigned by the DHCP server + IPToStr32(ipstr, sizeof(ipstr), uint_ip); + if (no_heavy == false) + { + HLog(hub, "LH_DHCP_FORCE", s->Name, ipstr); + } + goto DISCARD_PACKET; + } + + // if (packet->TypeL3 == L3_ARPV4) + { + // Examine the number that are registered in this session already + if (s->Policy->NoRouting || s->Policy->MaxIP != 0) + { + UINT i, num_ip_for_me = 0; + UINT limited_count = 0xffffffff; + + for (i = 0;i < LIST_NUM(hub->IpTable);i++) + { + IP_TABLE_ENTRY *e = LIST_DATA(hub->IpTable, i); + + if (e->Session == s) + { + if (IsIP4(&e->Ip)) + { + num_ip_for_me++; + } + } + } + + if (s->Policy->NoRouting) + { + limited_count = MIN(limited_count, IP_MIN_LIMIT_COUNT); + } + if (s->Policy->MaxIP != 0) + { + limited_count = MIN(limited_count, s->Policy->MaxIP); + } + limited_count = MAX(limited_count, IP_MIN_LIMIT_COUNT); + + if (num_ip_for_me >= limited_count) + { + // Discard the packet because it exceeded the + // upper limit of the IP address that can be used + char tmp[64]; + IPToStr32(tmp, sizeof(tmp), uint_ip); + if (s->Policy->NoRouting == false) + { + if (no_heavy == false) + { + HLog(hub, "LH_IP_LIMIT", s->Name, tmp, num_ip_for_me, limited_count); + } + } + else + { + if (no_heavy == false) + { + HLog(hub, "LH_ROUTING_LIMIT", s->Name, tmp, num_ip_for_me, limited_count); + } + } + goto DISCARD_PACKET; + } + } + + if (IsIPManagementTargetForHUB(&ip, hub)) + { + // Create a entry + e = ZeroMalloc(sizeof(IP_TABLE_ENTRY)); + e->CreatedTime = e->UpdatedTime = now; + e->DhcpAllocated = false; + Copy(&e->Ip, &ip, sizeof(IP)); + Copy(e->MacAddress, packet->MacAddressSrc, 6); + e->Session = s; + + DeleteExpiredIpTableEntry(hub->IpTable); + + if (LIST_NUM(hub->IpTable) >= MAX_IP_TABLES) + { + // Delete old IP table entries + DeleteOldIpTableEntry(hub->IpTable); + } + + Insert(hub->IpTable, e); + + if (0) + { + char ip_address[64]; + IPToStr(ip_address, sizeof(ip_address), &ip); + Debug("Registered IP Address %s to Session %X.\n", + ip_address, s); + } + } + } + } + else + { + if (e->Session == s) + { + // Do not do anything because it is self session + // Renew update time + e->UpdatedTime = now; + Copy(e->MacAddress, packet->MacAddressSrc, 6); + } + else + { + // Another session was using this IP address before + if ((s->Policy->CheckIP || s->Policy->DHCPForce) && + ((e->UpdatedTime + IP_TABLE_EXCLUSIVE_TIME) >= now)) + { + // Discard the packet because another session uses + // this IP address + char ip_address[32]; + char mac_str[48]; + IPToStr(ip_address, sizeof(ip_address), &ip); + + Debug("IP Address %s is Already used by Session %X.\n", + ip_address, s); + + MacToStr(mac_str, sizeof(mac_str), e->MacAddress); + + if (no_heavy == false) + { + HLog(hub, "LH_IP_CONFLICT", s->Name, ip_address, e->Session->Name, mac_str, + e->CreatedTime, e->UpdatedTime, e->DhcpAllocated, now); + } + + goto DISCARD_PACKET; + } + + if (s->Policy->DHCPForce) + { + if (e->DhcpAllocated == false) + { + char ipstr[MAX_SIZE]; + + // Discard the packet because this IP address + // isn't assigned by the DHCP server + IPToStr32(ipstr, sizeof(ipstr), uint_ip); + if (no_heavy == false) + { + HLog(hub, "LH_DHCP_FORCE", s->Name, ipstr); + } + goto DISCARD_PACKET; + } + } + + // Overwrite the entry + e->Session = s; + e->UpdatedTime = now; + Copy(e->MacAddress, packet->MacAddressSrc, 6); + } + } + } + } + + if (s != NULL && broadcast_mode) + { + // Calling Broadcast Storm avoidance algorithm + // in order to prevent occurrence of a broadcast packet loop + // or a large number of broadcast + if (CheckBroadcastStorm(hub, s, packet) == false) + { + goto DISCARD_PACKET; + } + } + + // Broadcast this packet to the monitor port of the HUB + if (hub->MonitorList->num_item != 0) + { + LockList(hub->MonitorList); + { + UINT i; + void *data; + UINT size = packet->PacketSize; + for (i = 0;i < LIST_NUM(hub->MonitorList);i++) + { + SESSION *monitor_session = (SESSION *)LIST_DATA(hub->MonitorList, i); + + // Flood the packet + if (monitor_session->PacketAdapter->Param != NULL) + { + data = MallocFast(size); + Copy(data, packet->PacketData, size); + StorePacketToHubPa((HUB_PA *)monitor_session->PacketAdapter->Param, + s, data, size, packet, false, false); + } + } + } + UnlockList(hub->MonitorList); + } + + if (broadcast_mode == false) + { + // Unicast packet + if (dest_pa != NULL) + { + if (dest_session->Policy->NoIPv6DefaultRouterInRA || + (dest_session->Policy->NoIPv6DefaultRouterInRAWhenIPv6 && dest_session->IPv6Session) || + (hub->Option->NoIPv6DefaultRouterInRAWhenIPv6 && dest_session->IPv6Session)) + { + DeleteIPv6DefaultRouterInRA(packet); + } + if (dest_session->Policy->RSandRAFilter) + { + if (packet->TypeL3 == L3_IPV6 && + packet->TypeL4 == L4_ICMPV6 && + (packet->ICMPv6HeaderPacketInfo.Type == ICMPV6_TYPE_ROUTER_SOLICIATION || + packet->ICMPv6HeaderPacketInfo.Type == ICMPV6_TYPE_ROUTER_ADVERTISEMENT)) + { + goto DISCARD_UNICAST_PACKET; + } + } + if (dest_session->Policy->DHCPFilter) + { + if (packet->TypeL3 == L3_IPV4 && + packet->TypeL4 == L4_UDP && + packet->TypeL7 == L7_DHCPV4) + { + goto DISCARD_UNICAST_PACKET; + } + } + if (dest_session->Policy->DHCPv6Filter) + { + if (packet->TypeL3 == L3_IPV6 && + packet->TypeL4 == L4_UDP && + (Endian16(packet->L4.UDPHeader->DstPort) == 546 || Endian16(packet->L4.UDPHeader->DstPort) == 547)) + { + goto DISCARD_UNICAST_PACKET; + } + } + if (dest_session->Policy->ArpDhcpOnly) + { + if (packet->BroadcastPacket) + { + bool b = true; + + if (packet->TypeL3 == L3_IPV4 && + packet->TypeL4 == L4_UDP && + packet->TypeL7 == L7_DHCPV4) + { + b = false; + } + else if (packet->TypeL3 == L3_ARPV4) + { + b = false; + } + else if (packet->TypeL3 == L3_IPV6 && + packet->TypeL4 == L4_UDP && + (Endian16(packet->L4.UDPHeader->DstPort) == 546 || Endian16(packet->L4.UDPHeader->DstPort) == 547)) + { + b = false; + } + else if (packet->TypeL3 == L3_IPV6 && + packet->TypeL4 == L4_ICMPV6) + { + b = false; + } + + if (b) + { + goto DISCARD_UNICAST_PACKET; + } + } + } + if (dest_session->Policy->FilterIPv4) + { + if (packet->TypeL3 == L3_IPV4 || packet->TypeL3 == L3_ARPV4) + { + goto DISCARD_UNICAST_PACKET; + } + } + if (dest_session->Policy->FilterIPv6) + { + if (packet->TypeL3 == L3_IPV6) + { + goto DISCARD_UNICAST_PACKET; + } + } + if (dest_session->Policy->FilterNonIP) + { + if (packet->TypeL3 != L3_IPV4 && packet->TypeL3 != L3_ARPV4 && packet->TypeL3 != L3_IPV6) + { + goto DISCARD_UNICAST_PACKET; + } + } + + if (s != NULL && + ((drop_broadcast_packet_privacy || packet->BroadcastPacket == false) && + s->Policy->PrivacyFilter && + dest_session->Policy->PrivacyFilter) + ) + { + // Privacy filter + if (drop_arp_packet_privacy || packet->TypeL3 != L3_ARPV4) + { + goto DISCARD_UNICAST_PACKET; + } + } + + if (s != NULL) + { + if (memcmp(packet->MacAddressSrc, s->Hub->HubMacAddr, 6) == 0 || + memcmp(packet->MacAddressDest, s->Hub->HubMacAddr, 6) == 0) + { + goto DISCARD_UNICAST_PACKET; + } + } + + // Take a packet log + if (s != NULL) + { + if (PacketLog(s->Hub, s, dest_session, packet, now) == false) + { + // The packet drops because it have exceeded the allowable amount + goto DISCARD_UNICAST_PACKET; + } + } + + // Store to the destination HUB_PA + StorePacketToHubPa(dest_pa, s, packet->PacketData, packet->PacketSize, packet, false, false); + } + else + { +DISCARD_UNICAST_PACKET: + Free(packet->PacketData); + } + } + else + { + // Flooding as a broadcast packet + UINT current_tcp_queue_size = 0; + + // Take a packet log + if (s != NULL) + { + if (PacketLog(s->Hub, s, NULL, packet, now) == false) + { + // The packet drops because It have exceeded the allowable amount + goto DISCARD_BROADCAST_PACKET; + } + } + + // Store for all sessions + LockList(hub->SessionList); + { + UINT i, num = LIST_NUM(hub->SessionList); + for (i = 0;i < num;i++) + { + SESSION *dest_session = LIST_DATA(hub->SessionList, i); + HUB_PA *dest_pa = (HUB_PA *)dest_session->PacketAdapter->Param; + bool discard = false; + + if (dest_session != s) + { + bool delete_default_router_in_ra = false; + + if (dest_session->IsMonitorMode) + { + discard = true; + } + + if (dest_session->NormalClient) + { + if (dormant_interval != 0) + { + if (dest_session->LastCommTimeForDormant == 0 || + (dest_session->LastCommTimeForDormant + dormant_interval) < now) + { + // This is dormant session + discard = true; + } + } + } + + if (tcp_queue_quota != 0) + { + current_tcp_queue_size = CedarGetCurrentTcpQueueSize(hub->Cedar); + + if (current_tcp_queue_size >= tcp_queue_quota) + { + // Quota exceeded. Discard the packet for normal session. + if (dest_session->Connection != NULL && + dest_session->Connection->Protocol == CONNECTION_TCP) + { + discard = true; + } + + if (dest_session->LinkModeServer) + { + LINK *k = dest_session->Link; + + discard = true; + } + } + } + + if (dest_session->VLanId != 0 && packet->TypeL3 == L3_TAGVLAN && + packet->VlanId != dest_session->VLanId) + { + discard = true; + } + + if (dest_session->Policy->NoIPv6DefaultRouterInRA || + (dest_session->Policy->NoIPv6DefaultRouterInRAWhenIPv6 && dest_session->IPv6Session) || + (hub->Option->NoIPv6DefaultRouterInRAWhenIPv6 && dest_session->IPv6Session)) + { + if (packet->TypeL3 == L3_IPV6 && packet->TypeL4 == L4_ICMPV6 && + (packet->ICMPv6HeaderPacketInfo.Type == ICMPV6_TYPE_ROUTER_ADVERTISEMENT)) + { + if (packet->ICMPv6HeaderPacketInfo.Headers.RouterAdvertisementHeader->Lifetime != 0) + { + delete_default_router_in_ra = true; + } + } + } + if (dest_session->Policy->RSandRAFilter) + { + if (packet->TypeL3 == L3_IPV6 && + packet->TypeL4 == L4_ICMPV6 && + (packet->ICMPv6HeaderPacketInfo.Type == ICMPV6_TYPE_ROUTER_SOLICIATION || + packet->ICMPv6HeaderPacketInfo.Type == ICMPV6_TYPE_ROUTER_ADVERTISEMENT)) + { + discard = true; + } + } + + if (dest_session->Policy->DHCPFilter) + { + if (packet->TypeL3 == L3_IPV4 && + packet->TypeL4 == L4_UDP && + packet->TypeL7 == L7_DHCPV4) + { + discard = true; + } + } + + if (dest_session->Policy->DHCPv6Filter) + { + if (packet->TypeL3 == L3_IPV6 && + packet->TypeL4 == L4_UDP && + (Endian16(packet->L4.UDPHeader->DstPort) == 546 || Endian16(packet->L4.UDPHeader->DstPort) == 547)) + { + discard = true; + } + } + + if (dest_session->Policy->ArpDhcpOnly) + { + if (packet->BroadcastPacket) + { + bool b = true; + + if (packet->TypeL3 == L3_IPV4 && + packet->TypeL4 == L4_UDP && + packet->TypeL7 == L7_DHCPV4) + { + b = false; + } + else if (packet->TypeL3 == L3_ARPV4) + { + b = false; + } + else if (packet->TypeL3 == L3_IPV6 && + packet->TypeL4 == L4_UDP && + (Endian16(packet->L4.UDPHeader->DstPort) == 546 || Endian16(packet->L4.UDPHeader->DstPort) == 547)) + { + b = false; + } + else if (packet->TypeL3 == L3_IPV6 && + packet->TypeL4 == L4_ICMPV6) + { + b = false; + } + + if (discard == false) + { + discard = b; + } + } + } + + if (dest_session->Policy->FilterIPv4) + { + if (packet->TypeL3 == L3_IPV4 || packet->TypeL3 == L3_ARPV4) + { + discard = true; + } + } + if (dest_session->Policy->FilterIPv6) + { + if (packet->TypeL3 == L3_IPV6) + { + discard = true; + } + } + if (dest_session->Policy->FilterNonIP) + { + if (packet->TypeL3 != L3_IPV4 && packet->TypeL3 != L3_ARPV4 && packet->TypeL3 != L3_IPV6) + { + discard = true; + } + } + + if (s != NULL && + ((drop_broadcast_packet_privacy || packet->BroadcastPacket == false) && + s->Policy->PrivacyFilter && + dest_session->Policy->PrivacyFilter) + ) + { + // Privacy filter + if (drop_arp_packet_privacy || packet->TypeL3 != L3_ARPV4) + { + discard = true; + } + } + + if (s != NULL) + { + if (memcmp(packet->MacAddressSrc, s->Hub->HubMacAddr, 6) == 0 || + memcmp(packet->MacAddressDest, s->Hub->HubMacAddr, 6) == 0) + { + discard = true; + } + } + + if (discard == false && dest_pa != NULL) + { + if (s == NULL || + ApplyAccessListToForwardPacket(s->Hub, s, dest_pa->Session, packet)) + { + // Store in session other than its own + data = MallocFast(packet->PacketSize); + Copy(data, packet->PacketData, packet->PacketSize); + size = packet->PacketSize; + + if (delete_default_router_in_ra) + { + PKT *pkt2 = ParsePacket(data, size); + + DeleteIPv6DefaultRouterInRA(pkt2); + + FreePacket(pkt2); + } + + StorePacketToHubPa(dest_pa, s, data, size, packet, true, true); + } + } + } + } + } + UnlockList(hub->SessionList); + +DISCARD_BROADCAST_PACKET: + Free(packet->PacketData); + } + FreePacket(packet); + } + } + } + UnlockHashList(hub->MacHashTable); +} + +// Examine the maximum number of logging target packets per minute +bool CheckMaxLoggedPacketsPerMinute(SESSION *s, UINT max_packets, UINT64 now) +{ + UINT64 minute = 60 * 1000; + // Validate arguments + if (s == NULL || max_packets == 0) + { + return true; + } + + if ((s->Policy != NULL && s->Policy->NoBroadcastLimiter) || + s->SecureNATMode || s->BridgeMode || s->LinkModeServer || s->LinkModeClient || + s->L3SwitchMode) + { + return true; + } + + if (s->MaxLoggedPacketsPerMinuteStartTick == 0 || + ((s->MaxLoggedPacketsPerMinuteStartTick + minute) <= now)) + { + s->MaxLoggedPacketsPerMinuteStartTick = now; + s->CurrentNumPackets = 0; + } + + s->CurrentNumPackets++; + if (s->CurrentNumPackets > max_packets) + { + return false; + } + + return true; +} + +// Confirm whether the specified IP address is managed by Virtual HUB +bool IsIPManagementTargetForHUB(IP *ip, HUB *hub) +{ + // Validate arguments + if (ip == NULL || hub == NULL) + { + return false; + } + + if (hub->Option == NULL) + { + return true; + } + + if (IsIP4(ip)) + { + if (hub->Option->ManageOnlyPrivateIP) + { + if (IsIPPrivate(ip) == false) + { + return false; + } + } + } + else + { + if (hub->Option->ManageOnlyLocalUnicastIPv6) + { + UINT ip_type = GetIPAddrType6(ip); + + if (!(ip_type & IPV6_ADDR_LOCAL_UNICAST)) + { + return false; + } + } + } + + return true; +} + +// Delete old IP table entries +void DeleteOldIpTableEntry(LIST *o) +{ + UINT i; + IP_TABLE_ENTRY *old = NULL; + // Validate arguments + if (o == NULL) + { + return; + } + + for (i = 0;i < LIST_NUM(o);i++) + { + IP_TABLE_ENTRY *e = LIST_DATA(o, i); + old = e; + } + + if (old != NULL) + { + Delete(o, old); + Free(old); + } +} + + +// Add to Storm list +STORM *AddStormList(HUB_PA *pa, UCHAR *mac_address, IP *src_ip, IP *dest_ip, bool strict) +{ + STORM *s; + // Validate arguments + if (pa == NULL || mac_address == NULL) + { + return NULL; + } + + s = ZeroMalloc(sizeof(STORM)); + if (src_ip != NULL) + { + Copy(&s->SrcIp, src_ip, sizeof(IP)); + } + if (dest_ip != NULL) + { + Copy(&s->DestIp, dest_ip, sizeof(IP)); + } + Copy(s->MacAddress, mac_address, 6); + s->StrictMode = strict; + + Insert(pa->StormList, s); + + return s; +} + +// Search in Storm list +STORM *SearchStormList(HUB_PA *pa, UCHAR *mac_address, IP *src_ip, IP *dest_ip, bool strict) +{ + STORM t, *s; + // Validate arguments + if (pa == NULL || mac_address == NULL) + { + return NULL; + } + + Zero(&t, sizeof(t)); + if (src_ip != NULL) + { + Copy(&t.SrcIp, src_ip, sizeof(IP)); + } + if (dest_ip != NULL) + { + Copy(&t.DestIp, dest_ip, sizeof(IP)); + } + Copy(t.MacAddress, mac_address, 6); + + t.StrictMode = strict; + + s = Search(pa->StormList, &t); + + return s; +} + +// Store the packet to destination HUB_PA +void StorePacketToHubPa(HUB_PA *dest, SESSION *src, void *data, UINT size, PKT *packet, bool is_flooding, bool no_check_acl) +{ + BLOCK *b; + // Validate arguments + if (dest == NULL || data == NULL) + { + return; + } + + if (size < 14) + { + Free(data); + return; + } + + if (no_check_acl == false) + { + if (src != NULL) + { + // Apply the access list for forwarding + if (ApplyAccessListToForwardPacket(src->Hub, src, dest->Session, packet) == false) + { + Free(data); + return; + } + } + } + + if (src != NULL) + { + if (dest->Session->Policy->MaxDownload != 0) + { + // Traffic limit + if (packet != NULL && IsMostHighestPriorityPacket(dest->Session, packet) == false) + { + TRAFFIC_LIMITER *tr = &dest->DownloadLimiter; + IntoTrafficLimiter(tr, packet); + + if ((tr->Value * (UINT64)1000 / (UINT64)LIMITER_SAMPLING_SPAN) > dest->Session->Policy->MaxDownload) + { + // Limit + Free(data); + return; + } + } + } + } + + if (packet != NULL && src != NULL && src->Hub != NULL && src->Hub->Option != NULL && src->Hub->Option->FixForDLinkBPDU) + { + // Measures for D-Link bug + UCHAR *mac = packet->MacAddressSrc; + if ((mac[0] == 0x00 && mac[1] == 0x80 && mac[2] == 0xc8 && mac[3] == 0x00 && mac[4] == 0x00 && mac[5] == 0x00) || + (mac[0] == 0x00 && mac[1] == 0x0d && mac[2] == 0x88 && mac[3] == 0x00 && mac[4] == 0x00 && mac[5] == 0x00)) + { + SESSION *session = dest->Session; + + if (session != NULL) + { + if (session->Policy != NULL && session->Policy->CheckMac) + { + UCHAR hash[MD5_SIZE]; + Md5(hash, packet->PacketData, packet->PacketSize); + + Copy(session->LastDLinkSTPPacketDataHash, hash, MD5_SIZE); + session->LastDLinkSTPPacketSendTick = Tick64(); + } + } + } + } + + // Remove the VLAN tag + if (dest->Session != NULL && dest->Session->VLanId != 0) + { + UINT vlan_tpid = 0; + if (src != NULL && src->Hub != NULL && src->Hub->Option != NULL) + { + vlan_tpid = src->Hub->Option->VlanTypeId; + } + if (VLanRemoveTag(&data, &size, dest->Session->VLanId, vlan_tpid) == false) + { + Free(data); + return; + } + } + + if (src != NULL && dest->Session != NULL && src->Hub != NULL && src->Hub->Option != NULL) + { + if (dest->Session->AdjustMss != 0 || + (dest->Session->IsUsingUdpAcceleration && dest->Session->UdpAccelMss != 0) || + (dest->Session->IsRUDPSession && dest->Session->RUdpMss != 0)) + { + if (src->Hub->Option->DisableAdjustTcpMss == false) + { + UINT target_mss = INFINITE; + + if (dest->Session->AdjustMss != 0) + { + target_mss = MIN(target_mss, dest->Session->AdjustMss); + } + + if (dest->Session->IsUsingUdpAcceleration && dest->Session->UdpAccelMss != 0) + { + target_mss = MIN(target_mss, dest->Session->UdpAccelMss); + } + else if (dest->Session->IsRUDPSession && dest->Session->RUdpMss != 0) + { + target_mss = MIN(target_mss, dest->Session->RUdpMss); + } + + // Processing of Adjust TCP MSS + if (target_mss != INFINITE) + { + AdjustTcpMssL2(data, size, target_mss, src->Hub->Option->VlanTypeId); + } + } + } + } + + // Create a block + b = NewBlock(data, size, 0); + + LockQueue(dest->PacketQueue); + { + // Measure the length of queue + if (dest->PacketQueue->num_item < MAX_STORED_QUEUE_NUM) + { + // Store + InsertQueue(dest->PacketQueue, b); + + if (is_flooding) + { + if (src != NULL) + { + b->IsFlooding = true; + CedarAddCurrentTcpQueueSize(src->Cedar, b->Size); + } + } + } + else + { + // Drop the packet + FreeBlock(b); + } + } + UnlockQueue(dest->PacketQueue); + + // Issue of cancellation + if (src != NULL) + { + AddCancelList(src->CancelList, dest->Cancel); + } + else + { + Cancel(dest->Cancel); + } +} + +// Remove the default router specification from the IPv6 router advertisement +bool DeleteIPv6DefaultRouterInRA(PKT *p) +{ + if (p->TypeL3 == L3_IPV6 && p->TypeL4 == L4_ICMPV6 && + (p->ICMPv6HeaderPacketInfo.Type == ICMPV6_TYPE_ROUTER_ADVERTISEMENT)) + { + if (p->ICMPv6HeaderPacketInfo.Headers.RouterAdvertisementHeader->Lifetime != 0) + { + p->ICMPv6HeaderPacketInfo.Headers.RouterAdvertisementHeader->Lifetime = 0; + + p->L4.ICMPHeader->Checksum = 0; + p->L4.ICMPHeader->Checksum = + CalcChecksumForIPv6(&p->L3.IPv6Header->SrcAddress, + &p->L3.IPv6Header->DestAddress, IP_PROTO_ICMPV6, + p->L4.ICMPHeader, p->IPv6HeaderPacketInfo.PayloadSize, 0); + } + } + + return false; +} + +// Packet filter by policy +bool StorePacketFilterByPolicy(SESSION *s, PKT *p) +{ + POLICY *pol; + HUB *hub; + bool no_heavy = false; + // Validate arguments + if (s == NULL || p == NULL) + { + return false; + } + + hub = s->Hub; + + if (hub != NULL && hub->Option != NULL) + { + no_heavy = hub->Option->DoNotSaveHeavySecurityLogs; + } + + // Policy + pol = s->Policy; + + // To prohibit the operation as a server + if (pol->NoServer) + { + if (p->TypeL3 == L3_IPV4) + { + if (p->TypeL4 == L4_TCP) + { + UCHAR flag = p->L4.TCPHeader->Flag; + if ((flag & TCP_SYN) && (flag & TCP_ACK)) + { + char ip1[64], ip2[64]; + // Not to send a SYN + ACK packet + Debug("pol->NoServer: Discard SYN+ACK Packet.\n"); + + IPToStr32(ip1, sizeof(ip1), p->L3.IPv4Header->SrcIP); + IPToStr32(ip2, sizeof(ip2), p->L3.IPv4Header->DstIP); + + if (no_heavy == false) + { + HLog(s->Hub, "LH_NO_SERVER", s->Name, ip2, p->L4.TCPHeader->DstPort, + ip1, p->L4.TCPHeader->SrcPort); + } + + return false; + } + } + } + } + + // Prohibit the operation as a server (IPv6) + if (pol->NoServerV6) + { + if (p->TypeL3 == L3_IPV6) + { + if (p->TypeL4 == L4_TCP) + { + UCHAR flag = p->L4.TCPHeader->Flag; + if ((flag & TCP_SYN) && (flag & TCP_ACK)) + { + char ip1[128], ip2[128]; + // Not to send a SYN + ACK packet + Debug("pol->NoServerV6: Discard SYN+ACK Packet.\n"); + + IP6AddrToStr(ip1, sizeof(ip1), &p->IPv6HeaderPacketInfo.IPv6Header->SrcAddress); + IP6AddrToStr(ip2, sizeof(ip2), &p->IPv6HeaderPacketInfo.IPv6Header->DestAddress); + + if (no_heavy == false) + { + HLog(s->Hub, "LH_NO_SERVER", s->Name, ip2, p->L4.TCPHeader->DstPort, + ip1, p->L4.TCPHeader->SrcPort); + } + + return false; + } + } + } + } + + // Allow broadcast only DHCP and ARP + if (pol->ArpDhcpOnly && p->BroadcastPacket) + { + bool ok = false; + + if (p->TypeL3 == L3_ARPV4) + { + ok = true; + } + if (p->TypeL3 == L3_IPV4) + { + if (p->TypeL4 == L4_UDP) + { + if (p->TypeL7 == L7_DHCPV4) + { + ok = true; + } + } + } + if (p->TypeL3 == L3_IPV6) + { + if (p->TypeL4 == L4_ICMPV6) + { + ok = true; + } + } + + if (p->TypeL3 == L3_IPV6 && + p->TypeL4 == L4_UDP && + (Endian16(p->L4.UDPHeader->DstPort) == 546 || Endian16(p->L4.UDPHeader->DstPort) == 547)) + { + ok = true; + } + + if (ok == false) + { + return false; + } + } + + // Filter IPv4 packets + if (pol->FilterIPv4) + { + if (p->MacHeader != NULL) + { + USHORT proto = Endian16(p->MacHeader->Protocol); + if (proto == 0x0800 || proto == 0x0806) + { + return false; + } + } + } + + // Filter IPv6 packets + if (pol->FilterIPv6) + { + if (p->MacHeader != NULL) + { + USHORT proto = Endian16(p->MacHeader->Protocol); + if (proto == 0x86dd) + { + return false; + } + } + } + + // Filter non-IP packets + if (pol->FilterNonIP) + { + if (p->MacHeader != NULL) + { + USHORT proto = Endian16(p->MacHeader->Protocol); + if (!(proto == 0x86dd || proto == 0x0800 || proto == 0x0806)) + { + return false; + } + } + } + + // Filter DHCP packets + if (pol->DHCPFilter) + { + if (p->TypeL3 == L3_IPV4 && + p->TypeL4 == L4_UDP && + p->TypeL7 == L7_DHCPV4) + { + // Discard the DHCP packet + Debug("pol->DHCPFilter: Discard DHCP Packet.\n"); + + return false; + } + } + + // DHCPv6 packet filtering + if (pol->DHCPv6Filter) + { + if (p->TypeL3 == L3_IPV6 && + p->TypeL4 == L4_UDP) + { + if (Endian16(p->L4.UDPHeader->DstPort) == 546 || + Endian16(p->L4.UDPHeader->DstPort) == 547) + { + // Discard the DHCPv6 packet + Debug("pol->DHCPv6Filter: Discard DHCPv6 Packet.\n"); + + return false; + } + } + } + + // The behavior as a DHCP server is prohibited + if (pol->DHCPNoServer) + { + if (p->TypeL3 == L3_IPV4 && + p->TypeL4 == L4_UDP && + p->TypeL7 == L7_DHCPV4) + { + DHCPV4_HEADER *h = p->L7.DHCPv4Header; + if (h->OpCode == 2) + { + char ip1[64], ip2[64]; + + // Discard the DHCP packet + IPToStr32(ip1, sizeof(ip1), p->L3.IPv4Header->SrcIP); + IPToStr32(ip2, sizeof(ip2), p->L3.IPv4Header->DstIP); + + if (no_heavy == false) + { + HLog(s->Hub, "LH_NO_DHCP", s->Name, ip1, ip2); + } + + // Discard the DHCP response packet + Debug("pol->DHCPNoServer: Discard DHCP Response Packet.\n"); + return false; + } + } + } + + // The behavior as a DHCPv6 server is prohibited + if (pol->DHCPv6NoServer) + { + if (p->TypeL3 == L3_IPV6 && + p->TypeL4 == L4_UDP && + (Endian16(p->L4.UDPHeader->DstPort) == 546 || Endian16(p->L4.UDPHeader->SrcPort) == 547)) + { + char ip1[128], ip2[128]; + + // Discard the DHCP packet + IP6AddrToStr(ip1, sizeof(ip1), &p->L3.IPv6Header->SrcAddress); + IP6AddrToStr(ip2, sizeof(ip2), &p->L3.IPv6Header->DestAddress); + + if (no_heavy == false) + { + HLog(s->Hub, "LH_NO_DHCP", s->Name, ip1, ip2); + } + + // Discard the DHCP response packet + Debug("pol->DHCPv6NoServer: Discard DHCPv6 Response Packet.\n"); + return false; + } + } + + // Filter the Router Solicitation / Advertising packet (IPv6) + if (pol->RSandRAFilter) + { + if (p->TypeL3 == L3_IPV6 && p->TypeL4 == L4_ICMPV6 && + (p->ICMPv6HeaderPacketInfo.Type == ICMPV6_TYPE_ROUTER_SOLICIATION || + p->ICMPv6HeaderPacketInfo.Type == ICMPV6_TYPE_ROUTER_ADVERTISEMENT)) + { + return false; + } + } + + // Filter the router advertisement packet (IPv6) + if (pol->RAFilter) + { + if (p->TypeL3 == L3_IPV6 && p->TypeL4 == L4_ICMPV6 && + p->ICMPv6HeaderPacketInfo.Type == ICMPV6_TYPE_ROUTER_ADVERTISEMENT) + { + return false; + } + } + + // Register to the IP table by recording the DHCP response packet + if (p->TypeL3 == L3_IPV4 && + p->TypeL4 == L4_UDP && + p->TypeL7 == L7_DHCPV4 && + (s->Hub != NULL && s->Hub->Option->NoIpTable == false)) + { + DHCPV4_HEADER *h = p->L7.DHCPv4Header; + if (h->OpCode == 2 && p->DhcpOpCode == DHCP_ACK) + { + // Register to the IP table by peeking the contents of the DHCP response packet + if (h->HardwareType == ARP_HARDWARE_TYPE_ETHERNET) + { + if (h->HardwareAddressSize == 6) + { + if (h->YourIP != 0 && h->YourIP != 0xffffffff) + { + UINT ip_uint = h->YourIP; + IP ip; + IP_TABLE_ENTRY *e, t; + MAC_TABLE_ENTRY *mac_table, mt; + mt.VlanId = 0; + Copy(&mt.MacAddress, &h->ClientMacAddress, 6); + mac_table = SearchHash(hub->MacHashTable, &mt); + + if (mac_table != NULL) + { + bool new_entry = true; + UINTToIP(&ip, ip_uint); + Copy(&t.Ip, &ip, sizeof(IP)); + + e = Search(hub->IpTable, &t); + if (e == NULL) + { + // Register as a new item + e = ZeroMalloc(sizeof(IP_TABLE_ENTRY)); +UPDATE_DHCP_ALLOC_ENTRY: + e->CreatedTime = e->UpdatedTime = Tick64(); + e->DhcpAllocated = true; + Copy(&e->Ip, &ip, sizeof(IP)); + e->Session = mac_table->Session; + Copy(e->MacAddress, p->MacAddressDest, 6); + + if (new_entry) + { + // Delete the expired IP table entries + DeleteExpiredIpTableEntry(hub->IpTable); + if (LIST_NUM(hub->IpTable) >= MAX_IP_TABLES) + { + // Remove old entries + DeleteOldIpTableEntry(hub->IpTable); + } + Insert(hub->IpTable, e); + + + if ((hub->Option != NULL && hub->Option->NoDhcpPacketLogOutsideHub == false) || mac_table->Session != s) + { + char dhcp_mac_addr[64]; + char dest_mac_addr[64]; + char dest_ip_addr[64]; + char server_ip_addr[64]; + MacToStr(dhcp_mac_addr, sizeof(dhcp_mac_addr), p->MacAddressSrc); + MacToStr(dest_mac_addr, sizeof(dest_mac_addr), h->ClientMacAddress); + IPToStr(dest_ip_addr, sizeof(dest_ip_addr), &ip); + IPToStr32(server_ip_addr, sizeof(server_ip_addr), p->L3.IPv4Header->SrcIP); + Debug("DHCP Allocated; dhcp server: %s, client: %s, new_ip: %s\n", + dhcp_mac_addr, dest_mac_addr, dest_ip_addr); + + if (no_heavy == false) + { + HLog(s->Hub, "LH_REGIST_DHCP", s->Name, dhcp_mac_addr, server_ip_addr, + mac_table->Session->Name, dest_mac_addr, dest_ip_addr); + } + } + } + } + else + { + // Update + new_entry = false; + goto UPDATE_DHCP_ALLOC_ENTRY; + } + } + } + } + } + } + } + + return true; +} + +// Delete the expired MAC table entries +void DeleteExpiredMacTableEntry(HASH_LIST *h) +{ + LIST *o2; + UINT i; + MAC_TABLE_ENTRY **pp; + UINT num; + // Validate arguments + if (h == NULL) + { + return; + } + + o2 = NewListFast(NULL); + + pp = (MAC_TABLE_ENTRY **)HashListToArray(h, &num); + + for (i = 0;i < num;i++) + { + MAC_TABLE_ENTRY *e = pp[i]; + if ((e->UpdatedTime + (UINT64)MAC_TABLE_EXPIRE_TIME) <= Tick64()) + { + Add(o2, e); + } + } + + for (i = 0;i < LIST_NUM(o2);i++) + { + MAC_TABLE_ENTRY *e = LIST_DATA(o2, i); + DeleteHash(h, e); + Free(e); + } + + ReleaseList(o2); + + Free(pp); +} + +// Delete the expired IP table entries +void DeleteExpiredIpTableEntry(LIST *o) +{ + LIST *o2; + UINT i; + // Validate arguments + if (o == NULL) + { + return; + } + + o2 = NewListFast(NULL); + + for (i = 0;i < LIST_NUM(o);i++) + { + IP_TABLE_ENTRY *e = LIST_DATA(o, i); + if ((e->UpdatedTime + (UINT64)(e->DhcpAllocated ? IP_TABLE_EXPIRE_TIME_DHCP : IP_TABLE_EXPIRE_TIME)) <= Tick64()) + { + Add(o2, e); + } + } + + for (i = 0;i < LIST_NUM(o2);i++) + { + IP_TABLE_ENTRY *e = LIST_DATA(o2, i); + Delete(o, e); + Free(e); + } + + ReleaseList(o2); +} + +// Determine whether the packet to be handled with priority +bool IsMostHighestPriorityPacket(SESSION *s, PKT *p) +{ + // Validate arguments + if (s == NULL || p == NULL) + { + return false; + } + + if (p->TypeL3 == L3_ARPV4) + { + // ARP packets + return true; + } + + if (p->TypeL3 == L3_IPV4) + { + if (p->TypeL4 == L4_ICMPV4) + { + // ICMP packets + return true; + } + + if (p->TypeL4 == L4_TCP) + { + if ((p->L4.TCPHeader->Flag & TCP_SYN) || (p->L4.TCPHeader->Flag & TCP_FIN) + || (p->L4.TCPHeader->Flag & TCP_RST)) + { + // SYN, FIN, RST packet + return true; + } + } + + if (p->TypeL4 == L4_UDP) + { + if (p->TypeL7 == L7_DHCPV4) + { + // DHCP packets + return true; + } + } + } + + return false; +} + +// Add a packet to traffic limiter +void IntoTrafficLimiter(TRAFFIC_LIMITER *tr, PKT *p) +{ + UINT64 now = Tick64(); + // Validate arguments + if (tr == NULL || p == NULL) + { + return; + } + + if (tr->LastTime == 0 || tr->LastTime > now || + (tr->LastTime + LIMITER_SAMPLING_SPAN) < now) + { + // Sampling initialization + tr->Value = 0; + tr->LastTime = now; + } + + // Value increase + tr->Value += (UINT64)p->PacketSize * (UINT64)8; +} + +// The bandwidth reduction by traffic limiter +bool StorePacketFilterByTrafficLimiter(SESSION *s, PKT *p) +{ + HUB_PA *pa; + TRAFFIC_LIMITER *tr; + // Validate arguments + if (s == NULL || p == NULL) + { + return false; + } + + if (s->Policy->MaxUpload == 0) + { + // Unlimited + return true; + } + + pa = (HUB_PA *)s->PacketAdapter->Param; + tr = &pa->UploadLimiter; + + // Restrictions are not applied for priority packets + if (IsMostHighestPriorityPacket(s, p)) + { + return true; + } + + // Input packets to the limiter + IntoTrafficLimiter(tr, p); + + // Compare the current bandwidth and limit value + if ((tr->Value * (UINT64)1000 / (UINT64)LIMITER_SAMPLING_SPAN) > s->Policy->MaxUpload) + { + // Discard the packet + return false; + } + + return true; +} + +// Filtering of packets to store +bool StorePacketFilter(SESSION *s, PKT *packet) +{ + // Validate arguments + if (s == NULL || packet == NULL) + { + return false; + } + + // The bandwidth reduction by traffic limiter + if (StorePacketFilterByTrafficLimiter(s, packet) == false) + { + return false; + } + + // Packet filter by policy + if (StorePacketFilterByPolicy(s, packet) == false) + { + return false; + } + + // The packet filter with Access Lists + if (ApplyAccessListToStoredPacket(s->Hub, s, packet) == false) + { + return false; + } + + return true; +} + +// Get the packet adapter for the HUB +PACKET_ADAPTER *GetHubPacketAdapter() +{ + // Hand over by creating a function list + PACKET_ADAPTER *pa = NewPacketAdapter(HubPaInit, + HubPaGetCancel, HubPaGetNextPacket, HubPaPutPacket, HubPaFree); + + return pa; +} + +// Stop all the SESSION of the HUB +void StopAllSession(HUB *h) +{ + SESSION **s; + UINT i, num; + // Validate arguments + if (h == NULL) + { + return; + } + + LockList(h->SessionList); + { + num = LIST_NUM(h->SessionList); + s = ToArray(h->SessionList); + DeleteAll(h->SessionList); + } + UnlockList(h->SessionList); + + for (i = 0;i < num;i++) + { + StopSession(s[i]); + ReleaseSession(s[i]); + } + + Free(s); +} + +// Remove the SESSION from HUB +void DelSession(HUB *h, SESSION *s) +{ + // Validate arguments + if (h == NULL || s == NULL) + { + return; + } + + LockList(h->SessionList); + { + if (Delete(h->SessionList, s)) + { + Debug("Session %s was Deleted from %s.\n", s->Name, h->Name); + ReleaseSession(s); + } + } + UnlockList(h->SessionList); +} + +// Add a SESSION to the HUB +void AddSession(HUB *h, SESSION *s) +{ + // Validate arguments + if (h == NULL || s == NULL) + { + return; + } + + LockList(h->SessionList); + { + Insert(h->SessionList, s); + AddRef(s->ref); + Debug("Session %s Inserted to %s.\n", s->Name, h->Name); + + if (s->InProcMode) + { + s->UniqueId = GetNewUniqueId(h); + } + } + UnlockList(h->SessionList); +} + +// Create a new unique ID of the HUB +UINT GetNewUniqueId(HUB *h) +{ + UINT id; + // Validate arguments + if (h == NULL) + { + return 0; + } + + for (id = 1;;id++) + { + if (SearchSessionByUniqueId(h, id) == NULL) + { + return id; + } + } +} + +// Search for a session by the unique session ID +SESSION *SearchSessionByUniqueId(HUB *h, UINT id) +{ + UINT i; + // Validate arguments + if (h == NULL) + { + return NULL; + } + + for (i = 0;i < LIST_NUM(h->SessionList);i++) + { + SESSION *s = LIST_DATA(h->SessionList, i); + + if (s->UniqueId == id) + { + return s; + } + } + + return NULL; +} + +// Stop the operation of the HUB +void StopHub(HUB *h) +{ + bool old_status = false; + // Validate arguments + if (h == NULL) + { + return; + } + + old_status = h->Offline; + h->HubIsOnlineButHalting = true; + + SetHubOffline(h); + + if (h->Halt == false) + { + SLog(h->Cedar, "LS_HUB_STOP", h->Name); + h->Halt = true; + } + + h->Offline = old_status; + h->HubIsOnlineButHalting = false; +} + +// Online the Virtual HUB +void SetHubOnline(HUB *h) +{ + bool for_cluster = false; + // Validate arguments + if (h == NULL) + { + return; + } + + if (h->Cedar->Server != NULL && h->Cedar->Server->ServerType == SERVER_TYPE_FARM_CONTROLLER) + { + if (h->Type == HUB_TYPE_FARM_DYNAMIC) + { + for_cluster = true; + } + } + + Lock(h->lock_online); + { + if (h->Offline == false) + { + Unlock(h->lock_online); + return; + } + HLog(h, "LH_ONLINE"); + + // Start all links + StartAllLink(h); + + // Start the SecureNAT + if (h->EnableSecureNAT) + { + if (h->SecureNAT == NULL) + { + if (for_cluster == false) + { + h->SecureNAT = SnNewSecureNAT(h, h->SecureNATOption); + } + } + } + + // Start all of the local bridges that is associated with this HUB + if (h->Type != HUB_TYPE_FARM_DYNAMIC) + { + LockList(h->Cedar->LocalBridgeList); + { + UINT i; + for (i = 0;i < LIST_NUM(h->Cedar->LocalBridgeList);i++) + { + LOCALBRIDGE *br = LIST_DATA(h->Cedar->LocalBridgeList, i); + + if (StrCmpi(br->HubName, h->Name) == 0) + { + if (br->Bridge == NULL) + { + br->Bridge = BrNewBridge(h, br->DeviceName, NULL, br->Local, br->Monitor, + br->TapMode, br->TapMacAddress, br->LimitBroadcast, br); + } + } + } + } + UnlockList(h->Cedar->LocalBridgeList); + } + + h->Offline = false; + } + Unlock(h->lock_online); + + if (h->Cedar->Server != NULL) + { + SiHubOnlineProc(h); + } +} + +// Offline the Virtual HUB +void SetHubOffline(HUB *h) +{ + UINT i; + bool for_cluster = false; + // Validate arguments + if (h == NULL) + { + return; + } + + if (h->Cedar->Server != NULL && h->Cedar->Server->ServerType == SERVER_TYPE_FARM_CONTROLLER) + { + if (h->Type == HUB_TYPE_FARM_DYNAMIC) + { + for_cluster = true; + } + } + + h->BeingOffline = true; + + Lock(h->lock_online); + { + if (h->Offline || h->Halt) + { + Unlock(h->lock_online); + h->BeingOffline = false; + return; + } + + HLog(h, "LH_OFFLINE"); + + // Stop all links + StopAllLink(h); + + // Stop the SecureNAT + SnFreeSecureNAT(h->SecureNAT); + h->SecureNAT = NULL; + + // Stop all the local bridges that is associated with this HUB + LockList(h->Cedar->LocalBridgeList); + { + for (i = 0;i < LIST_NUM(h->Cedar->LocalBridgeList);i++) + { + LOCALBRIDGE *br = LIST_DATA(h->Cedar->LocalBridgeList, i); + + if (StrCmpi(br->HubName, h->Name) == 0) + { + BrFreeBridge(br->Bridge); + br->Bridge = NULL; + } + } + } + UnlockList(h->Cedar->LocalBridgeList); + + // Offline + h->Offline = true; + + // Disconnect all sessions + StopAllSession(h); + } + Unlock(h->lock_online); + + h->BeingOffline = false; + + if (h->Cedar->Server != NULL) + { + SiHubOfflineProc(h); + } +} + +// Get whether a HUB which have the specified name exists +bool IsHub(CEDAR *cedar, char *name) +{ + HUB *h; + // Validate arguments + if (cedar == NULL || name == NULL) + { + return false; + } + + h = GetHub(cedar, name); + if (h == NULL) + { + return false; + } + + ReleaseHub(h); + + return true; +} + +// Get the HUB +HUB *GetHub(CEDAR *cedar, char *name) +{ + HUB *h, t; + // Validate arguments + if (cedar == NULL || name == NULL) + { + return NULL; + } + + LockHubList(cedar); + + t.Name = name; + h = Search(cedar->HubList, &t); + if (h == NULL) + { + UnlockHubList(cedar); + return NULL; + } + + AddRef(h->ref); + + UnlockHubList(cedar); + + return h; +} + +// Lock the HUB list +void LockHubList(CEDAR *cedar) +{ + // Validate arguments + if (cedar == NULL) + { + return; + } + + LockList(cedar->HubList); +} + +// Unlock the HUB list +void UnlockHubList(CEDAR *cedar) +{ + // Validate arguments + if (cedar == NULL) + { + return; + } + + UnlockList(cedar->HubList); +} + +// Release the HUB +void ReleaseHub(HUB *h) +{ + // Validate arguments + if (h == NULL) + { + return; + } + + if (Release(h->ref) == 0) + { + CleanupHub(h); + } +} + +// Get the Radius server information +bool GetRadiusServer(HUB *hub, char *name, UINT size, UINT *port, char *secret, UINT secret_size) +{ + UINT interval; + return GetRadiusServerEx(hub, name, size, port, secret, secret_size, &interval); +} +bool GetRadiusServerEx(HUB *hub, char *name, UINT size, UINT *port, char *secret, UINT secret_size, UINT *interval) +{ + return GetRadiusServerEx2(hub, name, size, port, secret, secret_size, interval, NULL, 0); +} +bool GetRadiusServerEx2(HUB *hub, char *name, UINT size, UINT *port, char *secret, UINT secret_size, UINT *interval, char *suffix_filter, UINT suffix_filter_size) +{ + bool ret = false; + // Validate arguments + if (hub == NULL || name == NULL || port == NULL || secret == NULL || interval == NULL) + { + return false; + } + + Lock(hub->RadiusOptionLock); + { + if (hub->RadiusServerName != NULL) + { + char *tmp; + UINT tmp_size; + StrCpy(name, size, hub->RadiusServerName); + *port = hub->RadiusServerPort; + *interval = hub->RadiusRetryInterval; + + tmp_size = hub->RadiusSecret->Size + 1; + tmp = ZeroMalloc(tmp_size); + Copy(tmp, hub->RadiusSecret->Buf, hub->RadiusSecret->Size); + StrCpy(secret, secret_size, tmp); + Free(tmp); + + if (suffix_filter != NULL) + { + StrCpy(suffix_filter, suffix_filter_size, hub->RadiusSuffixFilter); + } + + ret = true; + } + } + Unlock(hub->RadiusOptionLock); + + return ret; +} + +// Set the Radius server information +void SetRadiusServer(HUB *hub, char *name, UINT port, char *secret) +{ + SetRadiusServerEx(hub, name, port, secret, RADIUS_RETRY_INTERVAL); +} +void SetRadiusServerEx(HUB *hub, char *name, UINT port, char *secret, UINT interval) +{ + // Validate arguments + if (hub == NULL) + { + return; + } + + Lock(hub->RadiusOptionLock); + { + if (hub->RadiusServerName != NULL) + { + Free(hub->RadiusServerName); + } + + if (name == NULL) + { + hub->RadiusServerName = NULL; + hub->RadiusServerPort = 0; + hub->RadiusRetryInterval = RADIUS_RETRY_INTERVAL; + FreeBuf(hub->RadiusSecret); + } + else + { + hub->RadiusServerName = CopyStr(name); + hub->RadiusServerPort = port; + if (interval == 0) + { + hub->RadiusRetryInterval = RADIUS_RETRY_INTERVAL; + } + else if (interval > RADIUS_RETRY_TIMEOUT) + { + hub->RadiusRetryInterval = RADIUS_RETRY_TIMEOUT; + } + else + { + hub->RadiusRetryInterval = interval; + } + FreeBuf(hub->RadiusSecret); + + if (secret == NULL) + { + hub->RadiusSecret = NewBuf(); + } + else + { + hub->RadiusSecret = NewBuf(); + WriteBuf(hub->RadiusSecret, secret, StrLen(secret)); + SeekBuf(hub->RadiusSecret, 0, 0); + } + } + } + Unlock(hub->RadiusOptionLock); +} + +// Add the traffic information for Virtual HUB +void IncrementHubTraffic(HUB *h) +{ + TRAFFIC t; + // Validate arguments + if (h == NULL || h->FarmMember == false) + { + return; + } + + Zero(&t, sizeof(t)); + + Lock(h->TrafficLock); + { + t.Send.BroadcastBytes = + h->Traffic->Send.BroadcastBytes - h->OldTraffic->Send.BroadcastBytes; + t.Send.BroadcastCount = + h->Traffic->Send.BroadcastCount - h->OldTraffic->Send.BroadcastCount; + t.Send.UnicastBytes = + h->Traffic->Send.UnicastBytes - h->OldTraffic->Send.UnicastBytes; + t.Send.UnicastCount = + h->Traffic->Send.UnicastCount - h->OldTraffic->Send.UnicastCount; + t.Recv.BroadcastBytes = + h->Traffic->Recv.BroadcastBytes - h->OldTraffic->Recv.BroadcastBytes; + t.Recv.BroadcastCount = + h->Traffic->Recv.BroadcastCount - h->OldTraffic->Recv.BroadcastCount; + t.Recv.UnicastBytes = + h->Traffic->Recv.UnicastBytes - h->OldTraffic->Recv.UnicastBytes; + t.Recv.UnicastCount = + h->Traffic->Recv.UnicastCount - h->OldTraffic->Recv.UnicastCount; + Copy(h->OldTraffic, h->Traffic, sizeof(TRAFFIC)); + } + Unlock(h->TrafficLock); + + if (IsZero(&t, sizeof(TRAFFIC))) + { + return; + } + + AddTrafficDiff(h, h->Name, TRAFFIC_DIFF_HUB, &t); +} + +// Adding Traffic information +void AddTrafficDiff(HUB *h, char *name, UINT type, TRAFFIC *traffic) +{ + TRAFFIC_DIFF *d; + // Validate arguments + if (h == NULL || h->FarmMember == false || name == NULL || traffic == NULL) + { + return; + } + + if (LIST_NUM(h->Cedar->TrafficDiffList) > MAX_TRAFFIC_DIFF) + { + return; + } + + d = ZeroMallocFast(sizeof(TRAFFIC_DIFF)); + d->HubName = CopyStr(h->Name); + d->Name = CopyStr(name); + d->Type = type; + Copy(&d->Traffic, traffic, sizeof(TRAFFIC)); + + LockList(h->Cedar->TrafficDiffList); + { + Insert(h->Cedar->TrafficDiffList, d); + } + UnlockList(h->Cedar->TrafficDiffList); +} + +// Cleanup of HUB +void CleanupHub(HUB *h) +{ + UINT i; + char name[MAX_SIZE]; + // Validate arguments + if (h == NULL) + { + return; + } + + StrCpy(name, sizeof(name), h->Name); + + if (h->WatchDogStarted) + { + StopHubWatchDog(h); + } + + FreeAccessList(h); + + if (h->RadiusServerName != NULL) + { + Free(h->RadiusServerName); + FreeBuf(h->RadiusSecret); + } + ReleaseAllLink(h); + DeleteHubDb(h->HubDb); + ReleaseCedar(h->Cedar); + DeleteLock(h->lock); + DeleteLock(h->lock_online); + Free(h->Name); + ReleaseList(h->SessionList); + ReleaseHashList(h->MacHashTable); + ReleaseList(h->IpTable); + ReleaseList(h->MonitorList); + ReleaseList(h->LinkList); + DeleteCounter(h->NumSessions); + DeleteCounter(h->NumSessionsClient); + DeleteCounter(h->NumSessionsBridge); + DeleteCounter(h->SessionCounter); + FreeTraffic(h->Traffic); + FreeTraffic(h->OldTraffic); + Free(h->Option); + + Free(h->SecureNATOption); + + DeleteLock(h->TrafficLock); + + for (i = 0;i < LIST_NUM(h->TicketList);i++) + { + Free(LIST_DATA(h->TicketList, i)); + } + + ReleaseList(h->TicketList); + + DeleteLock(h->RadiusOptionLock); + + FreeLog(h->PacketLogger); + FreeLog(h->SecurityLogger); + + for (i = 0;i < LIST_NUM(h->AdminOptionList);i++) + { + Free(LIST_DATA(h->AdminOptionList, i)); + } + ReleaseList(h->AdminOptionList); + + if (h->Msg != NULL) + { + Free(h->Msg); + } + + FreeUserList(h->UserList); + + Free(h); +} + +// Comparison function of IP table entries +int CompareIpTable(void *p1, void *p2) +{ + IP_TABLE_ENTRY *e1, *e2; + if (p1 == NULL || p2 == NULL) + { + return 0; + } + e1 = *(IP_TABLE_ENTRY **)p1; + e2 = *(IP_TABLE_ENTRY **)p2; + if (e1 == NULL || e2 == NULL) + { + return 0; + } + return CmpIpAddr(&e1->Ip, &e2->Ip); +} + +// Get hash of MAC table entry +UINT GetHashOfMacTable(void *p) +{ + UINT v; + MAC_TABLE_ENTRY *e = p; + + if (e == NULL) + { + return 0; + } + + v = e->MacAddress[0] + e->MacAddress[1] + e->MacAddress[2] + + e->MacAddress[3] + e->MacAddress[4] + e->MacAddress[5] + + e->VlanId; + + return v; +} + +// Comparison function of the MAC table entries +int CompareMacTable(void *p1, void *p2) +{ + int r; + MAC_TABLE_ENTRY *e1, *e2; + if (p1 == NULL || p2 == NULL) + { + return 0; + } + e1 = *(MAC_TABLE_ENTRY **)p1; + e2 = *(MAC_TABLE_ENTRY **)p2; + if (e1 == NULL || e2 == NULL) + { + return 0; + } + r = memcmp(e1->MacAddress, e2->MacAddress, 6); + if (r != 0) + { + return r; + } + if (e1->VlanId > e2->VlanId) + { + return 1; + } + else if (e1->VlanId < e2->VlanId) + { + return -1; + } + return 0; +} + +// Comparison function of HUB +int CompareHub(void *p1, void *p2) +{ + HUB *h1, *h2; + if (p1 == NULL || p2 == NULL) + { + return 0; + } + h1 = *(HUB **)p1; + h2 = *(HUB **)p2; + if (h1 == NULL || h2 == NULL) + { + return 0; + } + return StrCmpi(h1->Name, h2->Name); +} + +// Examine whether the MAC address is for the ARP polling of the Virtual HUB +bool IsHubMacAddress(UCHAR *mac) +{ + // Validate arguments + if (mac == NULL) + { + return false; + } + + if (mac[0] == 0x00 && mac[1] == SE_HUB_MAC_ADDR_SIGN) + { + return true; + } + + return false; +} + +// Examine whether the IP address is for the ARP polling of the Virtual HUB +bool IsHubIpAddress32(UINT ip32) +{ + IP ip; + + UINTToIP(&ip, ip32); + + return IsHubIpAddress(&ip); +} +bool IsHubIpAddress(IP *ip) +{ + // Validate arguments + if (ip == NULL) + { + return false; + } + + if (ip->addr[0] == 172 && ip->addr[1] == 31) + { + if (ip->addr[2] >= 1 && ip->addr[2] <= 254) + { + if (ip->addr[3] >= 1 && ip->addr[3] <= 254) + { + return true; + } + } + } + + return false; +} +bool IsHubIpAddress64(IPV6_ADDR *addr) +{ + // Validate arguments + if (addr == NULL) + { + return false; + } + + if (addr->Value[0] == 0xfe && addr->Value[1] == 0x80 && + addr->Value[2] == 0 && + addr->Value[3] == 0 && + addr->Value[4] == 0 && + addr->Value[5] == 0 && + addr->Value[6] == 0 && + addr->Value[7] == 0 && + addr->Value[8] == 0x02 && addr->Value[9] == 0xae && + addr->Value[11] == 0xff && addr->Value[12] == 0xfe) + { + return true; + } + + return false; +} + +// Generate an IP address for the Virtual HUB +void GenHubIpAddress(IP *ip, char *name) +{ + char tmp1[MAX_SIZE]; + char tmp2[MAX_SIZE]; + UCHAR hash[SHA1_SIZE]; + // Validate arguments + if (ip == NULL || name == NULL) + { + return; + } + + StrCpy(tmp1, sizeof(tmp1), name); + Trim(tmp1); + GenerateMachineUniqueHash(hash); + BinToStr(tmp2, sizeof(tmp2), hash, sizeof(hash)); + StrCat(tmp2, sizeof(tmp2), tmp1); + StrUpper(tmp2); + + Sha0(hash, tmp2, StrLen(tmp2)); + + Zero(ip, sizeof(IP)); + ip->addr[0] = 172; + ip->addr[1] = 31; + ip->addr[2] = hash[0] % 254 + 1; + ip->addr[3] = hash[1] % 254 + 1; +} + +// Generate a MAC address for the Virtual HUB +void GenHubMacAddress(UCHAR *mac, char *name) +{ + char tmp1[MAX_SIZE]; + char tmp2[MAX_SIZE]; + UCHAR hash[SHA1_SIZE]; + // Validate arguments + if (mac == NULL || name == NULL) + { + return; + } + + StrCpy(tmp1, sizeof(tmp1), name); + Trim(tmp1); + GenerateMachineUniqueHash(hash); + BinToStr(tmp2, sizeof(tmp2), hash, sizeof(hash)); + StrCat(tmp2, sizeof(tmp2), tmp1); + StrUpper(tmp2); + + Sha0(hash, tmp2, StrLen(tmp2)); + + mac[0] = 0x00; + mac[1] = SE_HUB_MAC_ADDR_SIGN; + mac[2] = hash[0]; + mac[3] = hash[1]; + mac[4] = hash[2]; + mac[5] = hash[3]; +} + +// Get a message from HUB +wchar_t *GetHubMsg(HUB *h) +{ + wchar_t *ret = NULL; + // Validate arguments + if (h == NULL) + { + return NULL; + } + + Lock(h->lock); + { + if (h->Msg != NULL) + { + ret = CopyUniStr(h->Msg); + } + } + Unlock(h->lock); + + return ret; +} + +// Set a message to the HUB +void SetHubMsg(HUB *h, wchar_t *msg) +{ + // Validate arguments + if (h == NULL) + { + return; + } + + Lock(h->lock); + { + if (h->Msg != NULL) + { + Free(h->Msg); + h->Msg = NULL; + } + + if (UniIsEmptyStr(msg) == false) + { + h->Msg = UniCopyStr(msg); + } + } + Unlock(h->lock); +} + +// Creating a new HUB +HUB *NewHub(CEDAR *cedar, char *HubName, HUB_OPTION *option) +{ + HUB *h; + char packet_logger_name[MAX_SIZE]; + char tmp[MAX_SIZE]; + char safe_hub_name[MAX_HUBNAME_LEN + 1]; + UCHAR hash[SHA1_SIZE]; + IP ip6; + // Validate arguments + if (cedar == NULL || option == NULL || HubName == NULL) + { + return NULL; + } + + h = ZeroMalloc(sizeof(HUB)); + Sha0(h->HashedPassword, "", 0); + HashPassword(h->SecurePassword, ADMINISTRATOR_USERNAME, ""); + h->lock = NewLock(); + h->lock_online = NewLock(); + h->ref = NewRef(); + h->Cedar = cedar; + AddRef(h->Cedar->ref); + h->Type = HUB_TYPE_STANDALONE; + + ConvertSafeFileName(safe_hub_name, sizeof(safe_hub_name), HubName); + h->Name = CopyStr(safe_hub_name); + + + h->AdminOptionList = NewList(CompareAdminOption); + AddHubAdminOptionsDefaults(h, true); + + h->LastCommTime = SystemTime64(); + h->LastLoginTime = SystemTime64(); + h->NumLogin = 0; + + h->TrafficLock = NewLock(); + + h->HubDb = NewHubDb(); + + h->SessionList = NewList(NULL); + h->SessionCounter = NewCounter(); + h->NumSessions = NewCounter(); + h->NumSessionsClient = NewCounter(); + h->NumSessionsBridge = NewCounter(); + h->MacHashTable = NewHashList(GetHashOfMacTable, CompareMacTable, 8, false); + h->IpTable = NewList(CompareIpTable); + h->MonitorList = NewList(NULL); + h->LinkList = NewList(NULL); + + h->Traffic = NewTraffic(); + h->OldTraffic = NewTraffic(); + + h->Option = ZeroMalloc(sizeof(HUB_OPTION)); + Copy(h->Option, option, sizeof(HUB_OPTION)); + + if (h->Option->VlanTypeId == 0) + { + h->Option->VlanTypeId = MAC_PROTO_TAGVLAN; + } + + h->Option->DropBroadcastsInPrivacyFilterMode = true; + h->Option->DropArpInPrivacyFilterMode = true; + + Rand(h->HubSignature, sizeof(h->HubSignature)); + + // SecureNAT related + h->EnableSecureNAT = false; + h->SecureNAT = NULL; + h->SecureNATOption = ZeroMalloc(sizeof(VH_OPTION)); + NiSetDefaultVhOption(NULL, h->SecureNATOption); + + if (h->Cedar != NULL && h->Cedar->Server != NULL && h->Cedar->Server->ServerType == SERVER_TYPE_FARM_CONTROLLER) + { + NiClearUnsupportedVhOptionForDynamicHub(h->SecureNATOption, true); + } + + // Generate a temporary MAC address for the HUB + GenerateMachineUniqueHash(hash); + GenHubMacAddress(h->HubMacAddr, h->Name); + GenHubIpAddress(&h->HubIp, h->Name); + + // IPv6 address for the HUB + GenerateEui64LocalAddress(&ip6, h->HubMacAddr); + IPToIPv6Addr(&h->HubIpV6, &ip6); + + h->RadiusOptionLock = NewLock(); + h->RadiusServerPort = RADIUS_DEFAULT_PORT; + + h->TicketList = NewList(NULL); + + InitAccessList(h); + + // Create a user list + h->UserList = NewUserList(); + + // Default logging settings + h->LogSetting.SavePacketLog = h->LogSetting.SaveSecurityLog = true; + h->LogSetting.PacketLogConfig[PACKET_LOG_TCP_CONN] = + h->LogSetting.PacketLogConfig[PACKET_LOG_DHCP] = PACKET_LOG_HEADER; + h->LogSetting.SecurityLogSwitchType = LOG_SWITCH_DAY; + h->LogSetting.PacketLogSwitchType = LOG_SWITCH_DAY; + + MakeDir(HUB_SECURITY_LOG_DIR_NAME); + MakeDir(HUB_PACKET_LOG_DIR_NAME); + + // Start the packet logger + Format(packet_logger_name, sizeof(packet_logger_name), HUB_PACKET_LOG_FILE_NAME, h->Name); + h->PacketLogger = NewLog(packet_logger_name, HUB_PACKET_LOG_PREFIX, h->LogSetting.PacketLogSwitchType); + + // Start the security logger + Format(tmp, sizeof(tmp), HUB_SECURITY_LOG_FILE_NAME, h->Name); + h->SecurityLogger = NewLog(tmp, HUB_SECURITY_LOG_PREFIX, h->LogSetting.SecurityLogSwitchType); + + if (h->Cedar->Server != NULL && h->Cedar->Server->ServerType == SERVER_TYPE_FARM_MEMBER) + { + h->FarmMember = true; + } + + // Start the HUB + SetHubOnline(h); + + if (h->Cedar->Bridge) + { + h->Option->NoArpPolling = true; + } + + if (h->Option->NoArpPolling == false && h->Option->NoIpTable == false) + { + StartHubWatchDog(h); + h->WatchDogStarted = true; + } + + SLog(h->Cedar, "LS_HUB_START", h->Name); + + MacToStr(tmp, sizeof(tmp), h->HubMacAddr); + SLog(h->Cedar, "LS_HUB_MAC", h->Name, tmp); + + return h; +} + +// Delete the HUBDB +void DeleteHubDb(HUBDB *d) +{ + // Validate arguments + if (d == NULL) + { + return; + } + + LockList(d->UserList); + { + LockList(d->GroupList); + { + // Release all users and groups + UINT i; + USER **users; + USERGROUP **groups; + + users = ToArray(d->UserList); + groups = ToArray(d->GroupList); + + for (i = 0;i < LIST_NUM(d->UserList);i++) + { + ReleaseUser(users[i]); + } + for (i = 0;i < LIST_NUM(d->GroupList);i++) + { + ReleaseGroup(groups[i]); + } + + Free(users); + Free(groups); + } + UnlockList(d->GroupList); + } + UnlockList(d->UserList); + + // Release the root certificate list + LockList(d->RootCertList); + { + UINT i; + for (i = 0;i < LIST_NUM(d->RootCertList);i++) + { + X *x = LIST_DATA(d->RootCertList, i); + FreeX(x); + } + } + UnlockList(d->RootCertList); + + // Release the CRL + LockList(d->CrlList); + { + UINT i; + for (i = 0;i < LIST_NUM(d->CrlList);i++) + { + CRL *crl = LIST_DATA(d->CrlList, i); + FreeCrl(crl); + } + } + UnlockList(d->CrlList); + + // Release the AC list + FreeAcList(d->AcList); + + ReleaseList(d->GroupList); + ReleaseList(d->UserList); + ReleaseList(d->RootCertList); + ReleaseList(d->CrlList); + Free(d); +} + +// Get a log setting of the HUB +void GetHubLogSetting(HUB *h, HUB_LOG *setting) +{ + // Validate arguments + if (setting == NULL || h == NULL) + { + return; + } + + Copy(setting, &h->LogSetting, sizeof(HUB_LOG)); +} + +// Update the log settings of the HUB +void SetHubLogSettingEx(HUB *h, HUB_LOG *setting, bool no_change_switch_type) +{ + UINT i1, i2; + // Validate arguments + if (setting == NULL || h == NULL) + { + return; + } + + i1 = h->LogSetting.PacketLogSwitchType; + i2 = h->LogSetting.SecurityLogSwitchType; + + Copy(&h->LogSetting, setting, sizeof(HUB_LOG)); + + if (no_change_switch_type) + { + h->LogSetting.PacketLogSwitchType = i1; + h->LogSetting.SecurityLogSwitchType = i2; + } + + // Packet logger configuration + SetLogSwitchType(h->PacketLogger, setting->PacketLogSwitchType); + SetLogSwitchType(h->SecurityLogger, setting->SecurityLogSwitchType); +} +void SetHubLogSetting(HUB *h, HUB_LOG *setting) +{ + SetHubLogSettingEx(h, setting, false); +} + +// Add the trusted root certificate to the HUB +void AddRootCert(HUB *hub, X *x) +{ + HUBDB *db; + // Validate arguments + if (hub == NULL || x == NULL) + { + return; + } + + db = hub->HubDb; + if (db != NULL) + { + LockList(db->RootCertList); + { + if (LIST_NUM(db->RootCertList) < MAX_HUB_CERTS) + { + UINT i; + bool ok = true; + + for (i = 0;i < LIST_NUM(db->RootCertList);i++) + { + X *exist_x = LIST_DATA(db->RootCertList, i); + if (CompareX(exist_x, x)) + { + ok = false; + break; + } + } + + if (ok) + { + Insert(db->RootCertList, CloneX(x)); + } + } + } + UnlockList(db->RootCertList); + } +} + +// Compare the list of certificates +int CompareCert(void *p1, void *p2) +{ + X *x1, *x2; + wchar_t tmp1[MAX_SIZE]; + wchar_t tmp2[MAX_SIZE]; + if (p1 == NULL || p2 == NULL) + { + return 0; + } + x1 = *(X **)p1; + x2 = *(X **)p2; + if (x1 == NULL || x2 == NULL) + { + return 0; + } + + GetPrintNameFromX(tmp1, sizeof(tmp1), x1); + GetPrintNameFromX(tmp2, sizeof(tmp2), x2); + + return UniStrCmpi(tmp1, tmp2); +} + +// Creating a new HUBDB +HUBDB *NewHubDb() +{ + HUBDB *d = ZeroMalloc(sizeof(HUBDB)); + + d->GroupList = NewList(CompareGroupName); + d->UserList = NewList(CompareUserName); + d->RootCertList = NewList(CompareCert); + d->CrlList = NewList(NULL); + d->AcList = NewAcList(); + + return d; +} + + diff --git a/src/Cedar/Hub.h b/src/Cedar/Hub.h index 2c2dc66a..3f85c24b 100644 --- a/src/Cedar/Hub.h +++ b/src/Cedar/Hub.h @@ -1,539 +1,539 @@ -// SoftEther VPN Source Code -// Cedar Communication Module - - -// Hub.h -// Header of Hub.c - -#ifndef HUB_H -#define HUB_H - - -// Prefix in the access list for investigating whether the user name which is contained in a particular file -#define ACCESS_LIST_INCLUDED_PREFIX "include:" // Included -#define ACCESS_LIST_EXCLUDED_PREFIX "exclude:" // Not included - -// The default value for the cache expiration of the user name reference file of the access list (in seconds) -#define ACCESS_LIST_INCLUDE_FILE_CACHE_LIFETIME 30 - -// The maximum length of the include file in the access list -#define ACCESS_LIST_INCLUDE_FILE_MAX_SIZE (1024 * 1024) - -// tags of the URL in the access list -#define ACCESS_LIST_URL_INFO_TAG "" - -// Old MAC address entry flush interval -#define OLD_MAC_ADDRESS_ENTRY_FLUSH_INTERVAL 1000 - -// Default flooding queue length -#define DEFAULT_FLOODING_QUEUE_LENGTH (32 * 1024 * 1024) - -// SoftEther link control packet -struct SE_LINK -{ - UCHAR DestMacAddress[6]; // Destination MAC address - UCHAR SrcMacAddress[6]; // Source MAC address - UCHAR SignatureS; // 'S' - UCHAR SignatureE; // 'E' - UCHAR Padding[2]; // Padding - UINT Type; // Type - UCHAR HubSignature[16]; // HUB signature - UINT TransactionId; // Transaction ID - UINT Data; // Data - UCHAR Dummy[20]; // Dummy - UCHAR Checksum[SHA1_SIZE]; // Checksum -}; - - -// Test packet reception record -struct TEST_HISTORY -{ - SESSION *s1; - SESSION *s2; -}; - -// State machine for link test -struct SE_TEST -{ - LOCK *lock; // Lock - UINT64 LastTestPacketSentTime; // Time that sent the test packet at the last - UINT NextTestPacketSendInterval; // Next test packet transmission interval - bool CurrentTesting; // Test by sending a test packet currently - UINT TransactionId; // Transaction ID - LIST *TestHistory; // Reception history -}; - -// Macro -#define NO_ACCOUNT_DB(h) ((h)->FarmMember) - -// Database in the case of a stand-alone or a farm master HUB -struct HUBDB -{ - LIST *UserList; // User List - LIST *GroupList; // Group List - LIST *RootCertList; // Certificate list to trust - LIST *CrlList; // CRL list - LIST *AcList; // AC List -}; - -// Traffic limiter -struct TRAFFIC_LIMITER -{ - UINT64 LastTime; // Time of last measured - UINT64 Value; // The current value -}; - -// Record the number of broadcast of each endpoint -struct STORM -{ - UCHAR MacAddress[6]; // MAC address - UCHAR Padding[2]; // Padding - IP SrcIp; // Source IP address - IP DestIp; // Destination IP address - UINT64 CheckStartTick; // Time that checking is started - UINT CurrentBroadcastNum; // The current number of broadcasts - UINT DiscardValue; // Ratio to discard the broadcast packet - bool StrictMode; // Strict mode -}; - -// Packet adapter information structure for HUB -struct HUB_PA -{ - CANCEL *Cancel; // Cancel object - QUEUE *PacketQueue; // Packet queue - bool MonitorPort; // Monitor port - UINT64 Now; // Current time - TRAFFIC_LIMITER UploadLimiter; // Upload bandwidth limit - TRAFFIC_LIMITER DownloadLimiter; // Download bandwidth limitation - SESSION *Session; // Session - LIST *StormList; // Broadcast storm recording list - UINT64 UsernameHash; // User name hash - UINT64 UsernameHashSimple; // User name hash (simple) - UINT64 GroupnameHash; // Group name hash -}; - -// HUB options -struct HUB_OPTION -{ - // Standard options - UINT MaxSession; // Maximum number of simultaneous connections - bool NoEnum; // Excluded from the enumeration - // Advanced options - bool NoArpPolling; // No ARP polling - bool NoIPv6AddrPolling; // No IPv6 address polling - bool NoIpTable; // Do not generate an IP address table - bool NoMacAddressLog; // Not to write the registration log of the MAC address - bool ManageOnlyPrivateIP; // Manage only private IP - bool ManageOnlyLocalUnicastIPv6; // Manage only local unicast IPv6 addresses - bool DisableIPParsing; // Disable the IP interpretation - bool YieldAfterStorePacket; // Yield after the packet is stored - bool NoSpinLockForPacketDelay; // Do not use the spin lock - UINT BroadcastStormDetectionThreshold; // Broadcast number limit threshold - bool FilterPPPoE; // Filtering the PPPoE (0x8863, 0x8864) - bool FilterOSPF; // Filtering the OSPF (ip_proto = 89) - bool FilterIPv4; // Filter IPv4 packets - bool FilterIPv6; // Filter IPv6 packets - bool FilterNonIP; // Filter all non-IP packets - bool FilterBPDU; // Filter the BPDU packets - UINT ClientMinimumRequiredBuild; // If the build number of the client is lower than a certain value, deny it - bool NoIPv6DefaultRouterInRAWhenIPv6; // Delete the default router specification from the IPv6 router advertisement (only in the case of IPv6 physical connection) - bool NoIPv4PacketLog; // Do not save the packet log for the IPv4 packet - bool NoIPv6PacketLog; // Do not save the packet log of IPv6 packets - bool NoLookBPDUBridgeId; // Don't look the BPDU bridge ID for switching - bool NoManageVlanId; // Don't manage the VLAN ID - UINT VlanTypeId; // Type ID of VLAN packets (usually 0x8100) - bool FixForDLinkBPDU; // Apply the fix for the BPDU of the strange behavior of the D-Link - UINT RequiredClientId; // Client ID - UINT AdjustTcpMssValue; // TCP MSS adjustment value - bool DisableAdjustTcpMss; // Completely disable the TCP MSS adjustment function - bool NoDhcpPacketLogOutsideHub; // Suppress DHCP unrelated log - bool DisableHttpParsing; // Prohibit the HTTP interpretation - bool DisableUdpAcceleration; // Prohibit the UDP acceleration function - bool DisableUdpFilterForLocalBridgeNic; // Not to perform filtering DHCP packets associated with local bridge NIC - bool ApplyIPv4AccessListOnArpPacket; // Apply an IPv4 access list to the ARP packet - bool RemoveDefGwOnDhcpForLocalhost; // Remove the designation of the DHCP server from the DHCP response packet addressed to localhost - UINT SecureNAT_MaxTcpSessionsPerIp; // Maximum number of TCP sessions per IP address - UINT SecureNAT_MaxTcpSynSentPerIp; // Maximum number of TCP sessions of SYN_SENT state per IP address - UINT SecureNAT_MaxUdpSessionsPerIp; // Maximum number of UDP sessions per IP address - UINT SecureNAT_MaxDnsSessionsPerIp; // Maximum number of DNS sessions per IP address - UINT SecureNAT_MaxIcmpSessionsPerIp; // Maximum number of ICMP sessions per IP address - UINT AccessListIncludeFileCacheLifetime; // Expiration of the access list external file (in seconds) - bool DisableKernelModeSecureNAT; // Disable the kernel mode NAT - bool DisableIpRawModeSecureNAT; // Disable the IP Raw Mode NAT - bool DisableUserModeSecureNAT; // Disable the user mode NAT - bool DisableCheckMacOnLocalBridge; // Disable the MAC address verification in local bridge - bool DisableCorrectIpOffloadChecksum; // Disable the correction of checksum that is IP-Offloaded - bool BroadcastLimiterStrictMode; // Strictly broadcast packets limiting mode - UINT MaxLoggedPacketsPerMinute; // Maximum number of logging target packets per minute - bool DoNotSaveHeavySecurityLogs; // Do not take heavy security log - bool DropBroadcastsInPrivacyFilterMode; // Drop broadcasting packets if the both source and destination session is PrivacyFilter mode - bool DropArpInPrivacyFilterMode; // Drop ARP packets if the both source and destination session is PrivacyFilter mode - bool SuppressClientUpdateNotification; // Suppress the update notification function on the VPN Client - UINT FloodingSendQueueBufferQuota; // The global quota of send queues of flooding packets - bool AssignVLanIdByRadiusAttribute; // Assign the VLAN ID for the VPN session, by the attribute value of RADIUS - bool DenyAllRadiusLoginWithNoVlanAssign; // Deny all RADIUS login with no VLAN ID assigned - bool SecureNAT_RandomizeAssignIp; // Randomize the assignment IP address for new DHCP client - UINT DetectDormantSessionInterval; // Interval (seconds) threshold to detect a dormant VPN session - bool NoPhysicalIPOnPacketLog; // Disable saving physical IP address on the packet log - bool UseHubNameAsDhcpUserClassOption; // Add HubName to DHCP request as User-Class option - bool UseHubNameAsRadiusNasId; // Add HubName to Radius request as NAS-Identifier attrioption -}; - -// MAC table entry -struct MAC_TABLE_ENTRY -{ - UCHAR MacAddress[6]; // MAC address - UCHAR Padding[2]; - UINT VlanId; // VLAN ID - SESSION *Session; // Session - HUB_PA *HubPa; // HUB packet adapter - UINT64 CreatedTime; // Creation date and time - UINT64 UpdatedTime; // Updating date -}; - -// IP table entry -struct IP_TABLE_ENTRY -{ - IP Ip; // IP address - SESSION *Session; // Session - bool DhcpAllocated; // Assigned by DHCP - UINT64 CreatedTime; // Creation date and time - UINT64 UpdatedTime; // Updating date - UCHAR MacAddress[6]; // MAC address -}; - -// Loop List -struct LOOP_LIST -{ - UINT NumSessions; - SESSION **Session; -}; - -// Access list -struct ACCESS -{ - // IPv4 - UINT Id; // ID - wchar_t Note[MAX_ACCESSLIST_NOTE_LEN + 1]; // Note - - // --- Please add items to the bottom of here for enhancements --- - bool Active; // Enable flag - UINT Priority; // Priority - bool Discard; // Discard flag - UINT SrcIpAddress; // Source IP address - UINT SrcSubnetMask; // Source subnet mask - UINT DestIpAddress; // Destination IP address - UINT DestSubnetMask; // Destination subnet mask - UINT Protocol; // Protocol - UINT SrcPortStart; // Source port number starting point - UINT SrcPortEnd; // Source port number end point - UINT DestPortStart; // Destination port number starting point - UINT DestPortEnd; // Destination port number end point - UINT64 SrcUsernameHash; // Source user name hash - bool IsSrcUsernameIncludeOrExclude; // The source user name is formed as the "include:" or "exclude:" - char SrcUsername[MAX_USERNAME_LEN + 1]; - bool IsDestUsernameIncludeOrExclude; // The destination user name is formed as "include:" or "exclude:" - UINT64 DestUsernameHash; // Destination user name hash - char DestUsername[MAX_USERNAME_LEN + 1]; - bool CheckSrcMac; // Presence of a source MAC address setting - UCHAR SrcMacAddress[6]; // Source MAC address - UCHAR SrcMacMask[6]; // Source MAC address mask - bool CheckDstMac; // Whether the setting of the destination MAC address exists - UCHAR DstMacAddress[6]; // Destination MAC address - UCHAR DstMacMask[6]; // Destination MAC address mask - bool CheckTcpState; // The state of the TCP connection - bool Established; // Established(TCP) - UINT Delay; // Delay - UINT Jitter; // Jitter - UINT Loss; // Packet loss - char RedirectUrl[MAX_REDIRECT_URL_LEN + 1]; // URL to redirect to - - // IPv6 - bool IsIPv6; // Whether it's an IPv6 - IPV6_ADDR SrcIpAddress6; // The source IP address (IPv6) - IPV6_ADDR SrcSubnetMask6; // Source subnet mask (IPv6) - IPV6_ADDR DestIpAddress6; // Destination IP address (IPv6) - IPV6_ADDR DestSubnetMask6; // Destination subnet mask (IPv6) - - // --- Please add items to the above of here for enhancements --- - - // For management - UINT UniqueId; // Unique ID -}; - -// Ticket -struct TICKET -{ - UINT64 CreatedTick; // Creation date and time - UCHAR Ticket[SHA1_SIZE]; // Ticket - char Username[MAX_USERNAME_LEN + 1]; // User name - char UsernameReal[MAX_USERNAME_LEN + 1]; // Real user name - char GroupName[MAX_USERNAME_LEN + 1]; // Group name - char SessionName[MAX_SESSION_NAME_LEN + 1]; // Session name - POLICY Policy; // Policy -}; - -// Traffic difference -struct TRAFFIC_DIFF -{ - UINT Type; // Type - TRAFFIC Traffic; // Traffic - char *HubName; // HUB name - char *Name; // Name -}; - -// Administration options -struct ADMIN_OPTION -{ - char Name[MAX_ADMIN_OPTION_NAME_LEN + 1]; // Name - UINT Value; // Data - wchar_t Descrption[MAX_SIZE]; // Descrption -}; - -// Certificate Revocation List entry -struct CRL -{ - X_SERIAL *Serial; // Serial number - NAME *Name; // Name information - UCHAR DigestMD5[MD5_SIZE]; // MD5 hash - UCHAR DigestSHA1[SHA1_SIZE]; // SHA-1 hash -}; - -// Access control -struct AC -{ - UINT Id; // ID - UINT Priority; // Priority - bool Deny; // Deny access - bool Masked; // Is masked - IP IpAddress; // IP address - IP SubnetMask; // Subnet mask -}; - -// User List -struct USERLIST -{ - char Filename[MAX_PATH]; // File name - LIST *UserHashList; // Hash list of user names -}; - -// HUB structure -struct HUB -{ - LOCK *lock; // Lock - LOCK *lock_online; // Lock for Online - REF *ref; // Reference counter - CEDAR *Cedar; // Cedar - UINT Type; // Type - HUBDB *HubDb; // Database - char *Name; // The name of the HUB - LOCK *RadiusOptionLock; // Lock for Radius option - char *RadiusServerName; // Radius server name - UINT RadiusServerPort; // Radius server port number - UINT RadiusRetryInterval; // Radius retry interval - BUF *RadiusSecret; // Radius shared key - char RadiusSuffixFilter[MAX_SIZE]; // Radius suffix filter - char RadiusRealm[MAX_SIZE]; // Radius realm (optional) - bool RadiusConvertAllMsChapv2AuthRequestToEap; // Convert all MS-CHAPv2 auth request to EAP - bool RadiusUsePeapInsteadOfEap; // Use PEAP instead of EAP - volatile bool Halt; // Halting flag - bool Offline; // Offline - bool BeingOffline; // Be Doing Offline - LIST *SessionList; // Session list - COUNTER *SessionCounter; // Session number generation counter - TRAFFIC *Traffic; // Traffic information - TRAFFIC *OldTraffic; // Old traffic information - LOCK *TrafficLock; // Traffic lock - COUNTER *NumSessions; // The current number of sessions - COUNTER *NumSessionsClient; // The current number of sessions (client) - COUNTER *NumSessionsBridge; // The current number of sessions (bridge) - HUB_OPTION *Option; // HUB options - HASH_LIST *MacHashTable; // MAC address hash table - LIST *IpTable; // IP address table - LIST *MonitorList; // Monitor port session list - LIST *LinkList; // Linked list - UCHAR HubSignature[16]; // HUB signature - UCHAR HubMacAddr[6]; // MAC address of the HUB - IP HubIp; // IP address of the HUB (IPv4) - IPV6_ADDR HubIpV6; // IP address of the HUB (IPv6) - UINT HubIP6Id; // IPv6 packet ID of the HUB - UCHAR Padding[2]; // Padding - LOCK *LoopListLock; // Lock for the loop list - UINT NumLoopList; // Number of loop lists - LOOP_LIST **LoopLists; // Loop List - LIST *AccessList; // Access list - HUB_LOG LogSetting; // Log Settings - LOG *PacketLogger; // Packet logger - LOG *SecurityLogger; // Security logger - UCHAR HashedPassword[SHA1_SIZE]; // Password - UCHAR SecurePassword[SHA1_SIZE]; // Secure password - LIST *TicketList; // Ticket list - bool FarmMember; // Farm member - UINT64 LastIncrementTraffic; // Traffic reporting time - UINT64 LastSendArpTick; // ARP transmission time of the last - SNAT *SecureNAT; // SecureNAT - bool EnableSecureNAT; // SecureNAT enable / disable flag - VH_OPTION *SecureNATOption; // SecureNAT Option - THREAD *WatchDogThread; // Watchdog thread - EVENT *WatchDogEvent; // Watchdog event - bool WatchDogStarted; // Whether the watchdog thread is used - volatile bool HaltWatchDog; // Stop the watchdog thread - LIST *AdminOptionList; // Administration options list - UINT64 CreatedTime; // Creation date and time - UINT64 LastCommTime; // Last communication date and time - UINT64 LastLoginTime; // Last login date and time - UINT NumLogin; // Number of logins - bool HubIsOnlineButHalting; // Virtual HUB is really online, but it is in offline state to stop - UINT FarmMember_MaxSessionClient; // Maximum client connection sessions for cluster members - UINT FarmMember_MaxSessionBridge; // Maximum bridge connection sessions for cluster members - bool FarmMember_MaxSessionClientBridgeApply; // Apply the FarmMember_MaxSession* - UINT CurrentVersion; // The current version - UINT LastVersion; // Version of when the update notification is issued at the last - wchar_t *Msg; // Message to be displayed when the client is connected - LIST *UserList; // Cache of the user list file - bool IsVgsHub; // Whether it's a VGS Virtual HUB - bool IsVgsSuperRelayHub; // Whether it's a VGS Super Relay Virtual HUB - UINT64 LastFlushTick; // Last tick to flush the MAC address table - bool StopAllLinkFlag; // Stop all link flag - bool ForceDisableComm; // Disable the communication function -}; - - -// Global variable -extern ADMIN_OPTION admin_options[]; -extern UINT num_admin_options; - - -// Function prototype -HUBDB *NewHubDb(); -void DeleteHubDb(HUBDB *d); -HUB *NewHub(CEDAR *cedar, char *HubName, HUB_OPTION *option); -void SetHubMsg(HUB *h, wchar_t *msg); -wchar_t *GetHubMsg(HUB *h); -void GenHubMacAddress(UCHAR *mac, char *name); -void GenHubIpAddress(IP *ip, char *name); -bool IsHubIpAddress(IP *ip); -bool IsHubIpAddress32(UINT ip32); -bool IsHubIpAddress64(IPV6_ADDR *addr); -bool IsHubMacAddress(UCHAR *mac); -void ReleaseHub(HUB *h); -void CleanupHub(HUB *h); -int CompareHub(void *p1, void *p2); -void LockHubList(CEDAR *cedar); -void UnlockHubList(CEDAR *cedar); -HUB *GetHub(CEDAR *cedar, char *name); -bool IsHub(CEDAR *cedar, char *name); -void StopHub(HUB *h); -void AddSession(HUB *h, SESSION *s); -void DelSession(HUB *h, SESSION *s); -SESSION *SearchSessionByUniqueId(HUB *h, UINT id); -UINT GetNewUniqueId(HUB *h); -void StopAllSession(HUB *h); -bool HubPaInit(SESSION *s); -void HubPaFree(SESSION *s); -CANCEL *HubPaGetCancel(SESSION *s); -UINT HubPaGetNextPacket(SESSION *s, void **data); -bool HubPaPutPacket(SESSION *s, void *data, UINT size); -PACKET_ADAPTER *GetHubPacketAdapter(); -int CompareMacTable(void *p1, void *p2); -UINT GetHashOfMacTable(void *p); -void StorePacket(HUB *hub, SESSION *s, PKT *packet); -bool StorePacketFilter(SESSION *s, PKT *packet); -void StorePacketToHubPa(HUB_PA *dest, SESSION *src, void *data, UINT size, PKT *packet, bool is_flooding, bool no_check_acl); -void SetHubOnline(HUB *h); -void SetHubOffline(HUB *h); -SESSION *GetSessionByName(HUB *hub, char *name); -int CompareIpTable(void *p1, void *p2); -bool StorePacketFilterByPolicy(SESSION *s, PKT *p); -bool DeleteIPv6DefaultRouterInRA(PKT *p); -bool StorePacketFilterByTrafficLimiter(SESSION *s, PKT *p); -void IntoTrafficLimiter(TRAFFIC_LIMITER *tr, PKT *p); -bool IsMostHighestPriorityPacket(SESSION *s, PKT *p); -bool IsPriorityPacketForQoS(PKT *p); -int CompareStormList(void *p1, void *p2); -STORM *SearchStormList(HUB_PA *pa, UCHAR *mac_address, IP *src_ip, IP *dest_ip, bool strict); -STORM *AddStormList(HUB_PA *pa, UCHAR *mac_address, IP *src_ip, IP *dest_ip, bool strict); -bool CheckBroadcastStorm(HUB *hub, SESSION *s, PKT *p); -void AddRootCert(HUB *hub, X *x); -int CmpAccessList(void *p1, void *p2); -void InitAccessList(HUB *hub); -void FreeAccessList(HUB *hub); -void AddAccessList(HUB *hub, ACCESS *a); -void AddAccessListEx(HUB *hub, ACCESS *a, bool no_sort, bool no_reassign_id); -bool IsTcpPacketNcsiHttpAccess(PKT *p); -UINT64 UsernameToInt64(char *name); -void MakeSimpleUsernameRemoveNtDomain(char *dst, UINT dst_size, char *src); -bool ApplyAccessListToStoredPacket(HUB *hub, SESSION *s, PKT *p); -void ForceRedirectToUrl(HUB *hub, SESSION *src_session, PKT *p, char *redirect_url); -BUF *BuildRedirectToUrlPayload(HUB *hub, SESSION *s, char *redirect_url); -bool ApplyAccessListToForwardPacket(HUB *hub, SESSION *src_session, SESSION *dest_session, PKT *p); -bool IsPacketMaskedByAccessList(SESSION *s, PKT *p, ACCESS *a, UINT64 dest_username, UINT64 dest_groupname, SESSION *dest_session); -void GetAccessListStr(char *str, UINT size, ACCESS *a); -void DeleteOldIpTableEntry(LIST *o); -void SetRadiusServer(HUB *hub, char *name, UINT port, char *secret); -void SetRadiusServerEx(HUB *hub, char *name, UINT port, char *secret, UINT interval); -bool GetRadiusServer(HUB *hub, char *name, UINT size, UINT *port, char *secret, UINT secret_size); -bool GetRadiusServerEx(HUB *hub, char *name, UINT size, UINT *port, char *secret, UINT secret_size, UINT *interval); -bool GetRadiusServerEx2(HUB *hub, char *name, UINT size, UINT *port, char *secret, UINT secret_size, UINT *interval, char *suffix_filter, UINT suffix_filter_size); -int CompareCert(void *p1, void *p2); -void GetHubLogSetting(HUB *h, HUB_LOG *setting); -void SetHubLogSetting(HUB *h, HUB_LOG *setting); -void SetHubLogSettingEx(HUB *h, HUB_LOG *setting, bool no_change_switch_type); -void DeleteExpiredIpTableEntry(LIST *o); -void DeleteExpiredMacTableEntry(HASH_LIST *h); -void AddTrafficDiff(HUB *h, char *name, UINT type, TRAFFIC *traffic); -void IncrementHubTraffic(HUB *h); -void EnableSecureNAT(HUB *h, bool enable); -void EnableSecureNATEx(HUB *h, bool enable, bool no_change); -void StartHubWatchDog(HUB *h); -void StopHubWatchDog(HUB *h); -void HubWatchDogThread(THREAD *t, void *param); -int CompareAdminOption(void *p1, void *p2); -UINT GetHubAdminOptionEx(HUB *h, char *name, UINT default_value); -UINT GetHubAdminOption(HUB *h, char *name); -void DeleteAllHubAdminOption(HUB *h, bool lock); -void AddHubAdminOptionsDefaults(HUB *h, bool lock); -bool IsCertMatchCrl(X *x, CRL *crl); -bool IsCertMatchCrlList(X *x, LIST *o); -wchar_t *GenerateCrlStr(CRL *crl); -bool IsValidCertInHub(HUB *h, X *x); -void FreeCrl(CRL *crl); -CRL *CopyCrl(CRL *crl); -int CmpAc(void *p1, void *p2); -LIST *NewAcList(); -void AddAc(LIST *o, AC *ac); -bool DelAc(LIST *o, UINT id); -AC *GetAc(LIST *o, UINT id); -void SetAc(LIST *o, UINT id, AC *ac); -void DelAllAc(LIST *o); -void SetAcList(LIST *o, LIST *src); -void NormalizeAcList(LIST *o); -bool IsIpMaskedByAc(IP *ip, AC *ac); -bool IsIpDeniedByAcList(IP *ip, LIST *o); -char *GenerateAcStr(AC *ac); -void FreeAcList(LIST *o); -LIST *CloneAcList(LIST *o); -bool IsIPManagementTargetForHUB(IP *ip, HUB *hub); -wchar_t *GetHubAdminOptionHelpString(char *name); -void HubOptionStructToData(RPC_ADMIN_OPTION *ao, HUB_OPTION *o, char *hub_name); -ADMIN_OPTION *NewAdminOption(char *name, UINT value); -void DataToHubOptionStruct(HUB_OPTION *o, RPC_ADMIN_OPTION *ao); -UINT GetHubAdminOptionData(RPC_ADMIN_OPTION *ao, char *name); -void GetHubAdminOptionDataAndSet(RPC_ADMIN_OPTION *ao, char *name, UINT *dest); -bool IsURLMsg(wchar_t *str, char *url, UINT url_size); -LIST *NewUserList(); -void DeleteAllUserListCache(LIST *o); -void FreeUserList(LIST *o); -void FreeUserListEntry(USERLIST *u); -int CompareUserList(void *p1, void *p2); -USERLIST *LoadUserList(LIST *o, char *filename); -USERLIST *FindUserList(LIST *o, char *filename); -bool IsUserMatchInUserList(LIST *o, char *filename, UINT64 user_hash); -bool IsUserMatchInUserListWithCacheExpires(LIST *o, char *filename, UINT64 user_hash, UINT64 lifetime); -bool IsUserMatchInUserListWithCacheExpiresAcl(LIST *o, char *name_in_acl, UINT64 user_hash, UINT64 lifetime); -bool CheckMaxLoggedPacketsPerMinute(SESSION *s, UINT max_packets, UINT64 now); -EAP_CLIENT *HubNewEapClient(CEDAR *cedar, char *hubname, char *client_ip_str, char *username, char *vpn_protocol_state_str); - -#endif // HUB_H - - +// SoftEther VPN Source Code +// Cedar Communication Module + + +// Hub.h +// Header of Hub.c + +#ifndef HUB_H +#define HUB_H + + +// Prefix in the access list for investigating whether the user name which is contained in a particular file +#define ACCESS_LIST_INCLUDED_PREFIX "include:" // Included +#define ACCESS_LIST_EXCLUDED_PREFIX "exclude:" // Not included + +// The default value for the cache expiration of the user name reference file of the access list (in seconds) +#define ACCESS_LIST_INCLUDE_FILE_CACHE_LIFETIME 30 + +// The maximum length of the include file in the access list +#define ACCESS_LIST_INCLUDE_FILE_MAX_SIZE (1024 * 1024) + +// tags of the URL in the access list +#define ACCESS_LIST_URL_INFO_TAG "" + +// Old MAC address entry flush interval +#define OLD_MAC_ADDRESS_ENTRY_FLUSH_INTERVAL 1000 + +// Default flooding queue length +#define DEFAULT_FLOODING_QUEUE_LENGTH (32 * 1024 * 1024) + +// SoftEther link control packet +struct SE_LINK +{ + UCHAR DestMacAddress[6]; // Destination MAC address + UCHAR SrcMacAddress[6]; // Source MAC address + UCHAR SignatureS; // 'S' + UCHAR SignatureE; // 'E' + UCHAR Padding[2]; // Padding + UINT Type; // Type + UCHAR HubSignature[16]; // HUB signature + UINT TransactionId; // Transaction ID + UINT Data; // Data + UCHAR Dummy[20]; // Dummy + UCHAR Checksum[SHA1_SIZE]; // Checksum +}; + + +// Test packet reception record +struct TEST_HISTORY +{ + SESSION *s1; + SESSION *s2; +}; + +// State machine for link test +struct SE_TEST +{ + LOCK *lock; // Lock + UINT64 LastTestPacketSentTime; // Time that sent the test packet at the last + UINT NextTestPacketSendInterval; // Next test packet transmission interval + bool CurrentTesting; // Test by sending a test packet currently + UINT TransactionId; // Transaction ID + LIST *TestHistory; // Reception history +}; + +// Macro +#define NO_ACCOUNT_DB(h) ((h)->FarmMember) + +// Database in the case of a stand-alone or a farm master HUB +struct HUBDB +{ + LIST *UserList; // User List + LIST *GroupList; // Group List + LIST *RootCertList; // Certificate list to trust + LIST *CrlList; // CRL list + LIST *AcList; // AC List +}; + +// Traffic limiter +struct TRAFFIC_LIMITER +{ + UINT64 LastTime; // Time of last measured + UINT64 Value; // The current value +}; + +// Record the number of broadcast of each endpoint +struct STORM +{ + UCHAR MacAddress[6]; // MAC address + UCHAR Padding[2]; // Padding + IP SrcIp; // Source IP address + IP DestIp; // Destination IP address + UINT64 CheckStartTick; // Time that checking is started + UINT CurrentBroadcastNum; // The current number of broadcasts + UINT DiscardValue; // Ratio to discard the broadcast packet + bool StrictMode; // Strict mode +}; + +// Packet adapter information structure for HUB +struct HUB_PA +{ + CANCEL *Cancel; // Cancel object + QUEUE *PacketQueue; // Packet queue + bool MonitorPort; // Monitor port + UINT64 Now; // Current time + TRAFFIC_LIMITER UploadLimiter; // Upload bandwidth limit + TRAFFIC_LIMITER DownloadLimiter; // Download bandwidth limitation + SESSION *Session; // Session + LIST *StormList; // Broadcast storm recording list + UINT64 UsernameHash; // User name hash + UINT64 UsernameHashSimple; // User name hash (simple) + UINT64 GroupnameHash; // Group name hash +}; + +// HUB options +struct HUB_OPTION +{ + // Standard options + UINT MaxSession; // Maximum number of simultaneous connections + bool NoEnum; // Excluded from the enumeration + // Advanced options + bool NoArpPolling; // No ARP polling + bool NoIPv6AddrPolling; // No IPv6 address polling + bool NoIpTable; // Do not generate an IP address table + bool NoMacAddressLog; // Not to write the registration log of the MAC address + bool ManageOnlyPrivateIP; // Manage only private IP + bool ManageOnlyLocalUnicastIPv6; // Manage only local unicast IPv6 addresses + bool DisableIPParsing; // Disable the IP interpretation + bool YieldAfterStorePacket; // Yield after the packet is stored + bool NoSpinLockForPacketDelay; // Do not use the spin lock + UINT BroadcastStormDetectionThreshold; // Broadcast number limit threshold + bool FilterPPPoE; // Filtering the PPPoE (0x8863, 0x8864) + bool FilterOSPF; // Filtering the OSPF (ip_proto = 89) + bool FilterIPv4; // Filter IPv4 packets + bool FilterIPv6; // Filter IPv6 packets + bool FilterNonIP; // Filter all non-IP packets + bool FilterBPDU; // Filter the BPDU packets + UINT ClientMinimumRequiredBuild; // If the build number of the client is lower than a certain value, deny it + bool NoIPv6DefaultRouterInRAWhenIPv6; // Delete the default router specification from the IPv6 router advertisement (only in the case of IPv6 physical connection) + bool NoIPv4PacketLog; // Do not save the packet log for the IPv4 packet + bool NoIPv6PacketLog; // Do not save the packet log of IPv6 packets + bool NoLookBPDUBridgeId; // Don't look the BPDU bridge ID for switching + bool NoManageVlanId; // Don't manage the VLAN ID + UINT VlanTypeId; // Type ID of VLAN packets (usually 0x8100) + bool FixForDLinkBPDU; // Apply the fix for the BPDU of the strange behavior of the D-Link + UINT RequiredClientId; // Client ID + UINT AdjustTcpMssValue; // TCP MSS adjustment value + bool DisableAdjustTcpMss; // Completely disable the TCP MSS adjustment function + bool NoDhcpPacketLogOutsideHub; // Suppress DHCP unrelated log + bool DisableHttpParsing; // Prohibit the HTTP interpretation + bool DisableUdpAcceleration; // Prohibit the UDP acceleration function + bool DisableUdpFilterForLocalBridgeNic; // Not to perform filtering DHCP packets associated with local bridge NIC + bool ApplyIPv4AccessListOnArpPacket; // Apply an IPv4 access list to the ARP packet + bool RemoveDefGwOnDhcpForLocalhost; // Remove the designation of the DHCP server from the DHCP response packet addressed to localhost + UINT SecureNAT_MaxTcpSessionsPerIp; // Maximum number of TCP sessions per IP address + UINT SecureNAT_MaxTcpSynSentPerIp; // Maximum number of TCP sessions of SYN_SENT state per IP address + UINT SecureNAT_MaxUdpSessionsPerIp; // Maximum number of UDP sessions per IP address + UINT SecureNAT_MaxDnsSessionsPerIp; // Maximum number of DNS sessions per IP address + UINT SecureNAT_MaxIcmpSessionsPerIp; // Maximum number of ICMP sessions per IP address + UINT AccessListIncludeFileCacheLifetime; // Expiration of the access list external file (in seconds) + bool DisableKernelModeSecureNAT; // Disable the kernel mode NAT + bool DisableIpRawModeSecureNAT; // Disable the IP Raw Mode NAT + bool DisableUserModeSecureNAT; // Disable the user mode NAT + bool DisableCheckMacOnLocalBridge; // Disable the MAC address verification in local bridge + bool DisableCorrectIpOffloadChecksum; // Disable the correction of checksum that is IP-Offloaded + bool BroadcastLimiterStrictMode; // Strictly broadcast packets limiting mode + UINT MaxLoggedPacketsPerMinute; // Maximum number of logging target packets per minute + bool DoNotSaveHeavySecurityLogs; // Do not take heavy security log + bool DropBroadcastsInPrivacyFilterMode; // Drop broadcasting packets if the both source and destination session is PrivacyFilter mode + bool DropArpInPrivacyFilterMode; // Drop ARP packets if the both source and destination session is PrivacyFilter mode + bool SuppressClientUpdateNotification; // Suppress the update notification function on the VPN Client + UINT FloodingSendQueueBufferQuota; // The global quota of send queues of flooding packets + bool AssignVLanIdByRadiusAttribute; // Assign the VLAN ID for the VPN session, by the attribute value of RADIUS + bool DenyAllRadiusLoginWithNoVlanAssign; // Deny all RADIUS login with no VLAN ID assigned + bool SecureNAT_RandomizeAssignIp; // Randomize the assignment IP address for new DHCP client + UINT DetectDormantSessionInterval; // Interval (seconds) threshold to detect a dormant VPN session + bool NoPhysicalIPOnPacketLog; // Disable saving physical IP address on the packet log + bool UseHubNameAsDhcpUserClassOption; // Add HubName to DHCP request as User-Class option + bool UseHubNameAsRadiusNasId; // Add HubName to Radius request as NAS-Identifier attrioption +}; + +// MAC table entry +struct MAC_TABLE_ENTRY +{ + UCHAR MacAddress[6]; // MAC address + UCHAR Padding[2]; + UINT VlanId; // VLAN ID + SESSION *Session; // Session + HUB_PA *HubPa; // HUB packet adapter + UINT64 CreatedTime; // Creation date and time + UINT64 UpdatedTime; // Updating date +}; + +// IP table entry +struct IP_TABLE_ENTRY +{ + IP Ip; // IP address + SESSION *Session; // Session + bool DhcpAllocated; // Assigned by DHCP + UINT64 CreatedTime; // Creation date and time + UINT64 UpdatedTime; // Updating date + UCHAR MacAddress[6]; // MAC address +}; + +// Loop List +struct LOOP_LIST +{ + UINT NumSessions; + SESSION **Session; +}; + +// Access list +struct ACCESS +{ + // IPv4 + UINT Id; // ID + wchar_t Note[MAX_ACCESSLIST_NOTE_LEN + 1]; // Note + + // --- Please add items to the bottom of here for enhancements --- + bool Active; // Enable flag + UINT Priority; // Priority + bool Discard; // Discard flag + UINT SrcIpAddress; // Source IP address + UINT SrcSubnetMask; // Source subnet mask + UINT DestIpAddress; // Destination IP address + UINT DestSubnetMask; // Destination subnet mask + UINT Protocol; // Protocol + UINT SrcPortStart; // Source port number starting point + UINT SrcPortEnd; // Source port number end point + UINT DestPortStart; // Destination port number starting point + UINT DestPortEnd; // Destination port number end point + UINT64 SrcUsernameHash; // Source user name hash + bool IsSrcUsernameIncludeOrExclude; // The source user name is formed as the "include:" or "exclude:" + char SrcUsername[MAX_USERNAME_LEN + 1]; + bool IsDestUsernameIncludeOrExclude; // The destination user name is formed as "include:" or "exclude:" + UINT64 DestUsernameHash; // Destination user name hash + char DestUsername[MAX_USERNAME_LEN + 1]; + bool CheckSrcMac; // Presence of a source MAC address setting + UCHAR SrcMacAddress[6]; // Source MAC address + UCHAR SrcMacMask[6]; // Source MAC address mask + bool CheckDstMac; // Whether the setting of the destination MAC address exists + UCHAR DstMacAddress[6]; // Destination MAC address + UCHAR DstMacMask[6]; // Destination MAC address mask + bool CheckTcpState; // The state of the TCP connection + bool Established; // Established(TCP) + UINT Delay; // Delay + UINT Jitter; // Jitter + UINT Loss; // Packet loss + char RedirectUrl[MAX_REDIRECT_URL_LEN + 1]; // URL to redirect to + + // IPv6 + bool IsIPv6; // Whether it's an IPv6 + IPV6_ADDR SrcIpAddress6; // The source IP address (IPv6) + IPV6_ADDR SrcSubnetMask6; // Source subnet mask (IPv6) + IPV6_ADDR DestIpAddress6; // Destination IP address (IPv6) + IPV6_ADDR DestSubnetMask6; // Destination subnet mask (IPv6) + + // --- Please add items to the above of here for enhancements --- + + // For management + UINT UniqueId; // Unique ID +}; + +// Ticket +struct TICKET +{ + UINT64 CreatedTick; // Creation date and time + UCHAR Ticket[SHA1_SIZE]; // Ticket + char Username[MAX_USERNAME_LEN + 1]; // User name + char UsernameReal[MAX_USERNAME_LEN + 1]; // Real user name + char GroupName[MAX_USERNAME_LEN + 1]; // Group name + char SessionName[MAX_SESSION_NAME_LEN + 1]; // Session name + POLICY Policy; // Policy +}; + +// Traffic difference +struct TRAFFIC_DIFF +{ + UINT Type; // Type + TRAFFIC Traffic; // Traffic + char *HubName; // HUB name + char *Name; // Name +}; + +// Administration options +struct ADMIN_OPTION +{ + char Name[MAX_ADMIN_OPTION_NAME_LEN + 1]; // Name + UINT Value; // Data + wchar_t Descrption[MAX_SIZE]; // Descrption +}; + +// Certificate Revocation List entry +struct CRL +{ + X_SERIAL *Serial; // Serial number + NAME *Name; // Name information + UCHAR DigestMD5[MD5_SIZE]; // MD5 hash + UCHAR DigestSHA1[SHA1_SIZE]; // SHA-1 hash +}; + +// Access control +struct AC +{ + UINT Id; // ID + UINT Priority; // Priority + bool Deny; // Deny access + bool Masked; // Is masked + IP IpAddress; // IP address + IP SubnetMask; // Subnet mask +}; + +// User List +struct USERLIST +{ + char Filename[MAX_PATH]; // File name + LIST *UserHashList; // Hash list of user names +}; + +// HUB structure +struct HUB +{ + LOCK *lock; // Lock + LOCK *lock_online; // Lock for Online + REF *ref; // Reference counter + CEDAR *Cedar; // Cedar + UINT Type; // Type + HUBDB *HubDb; // Database + char *Name; // The name of the HUB + LOCK *RadiusOptionLock; // Lock for Radius option + char *RadiusServerName; // Radius server name + UINT RadiusServerPort; // Radius server port number + UINT RadiusRetryInterval; // Radius retry interval + BUF *RadiusSecret; // Radius shared key + char RadiusSuffixFilter[MAX_SIZE]; // Radius suffix filter + char RadiusRealm[MAX_SIZE]; // Radius realm (optional) + bool RadiusConvertAllMsChapv2AuthRequestToEap; // Convert all MS-CHAPv2 auth request to EAP + bool RadiusUsePeapInsteadOfEap; // Use PEAP instead of EAP + volatile bool Halt; // Halting flag + bool Offline; // Offline + bool BeingOffline; // Be Doing Offline + LIST *SessionList; // Session list + COUNTER *SessionCounter; // Session number generation counter + TRAFFIC *Traffic; // Traffic information + TRAFFIC *OldTraffic; // Old traffic information + LOCK *TrafficLock; // Traffic lock + COUNTER *NumSessions; // The current number of sessions + COUNTER *NumSessionsClient; // The current number of sessions (client) + COUNTER *NumSessionsBridge; // The current number of sessions (bridge) + HUB_OPTION *Option; // HUB options + HASH_LIST *MacHashTable; // MAC address hash table + LIST *IpTable; // IP address table + LIST *MonitorList; // Monitor port session list + LIST *LinkList; // Linked list + UCHAR HubSignature[16]; // HUB signature + UCHAR HubMacAddr[6]; // MAC address of the HUB + IP HubIp; // IP address of the HUB (IPv4) + IPV6_ADDR HubIpV6; // IP address of the HUB (IPv6) + UINT HubIP6Id; // IPv6 packet ID of the HUB + UCHAR Padding[2]; // Padding + LOCK *LoopListLock; // Lock for the loop list + UINT NumLoopList; // Number of loop lists + LOOP_LIST **LoopLists; // Loop List + LIST *AccessList; // Access list + HUB_LOG LogSetting; // Log Settings + LOG *PacketLogger; // Packet logger + LOG *SecurityLogger; // Security logger + UCHAR HashedPassword[SHA1_SIZE]; // Password + UCHAR SecurePassword[SHA1_SIZE]; // Secure password + LIST *TicketList; // Ticket list + bool FarmMember; // Farm member + UINT64 LastIncrementTraffic; // Traffic reporting time + UINT64 LastSendArpTick; // ARP transmission time of the last + SNAT *SecureNAT; // SecureNAT + bool EnableSecureNAT; // SecureNAT enable / disable flag + VH_OPTION *SecureNATOption; // SecureNAT Option + THREAD *WatchDogThread; // Watchdog thread + EVENT *WatchDogEvent; // Watchdog event + bool WatchDogStarted; // Whether the watchdog thread is used + volatile bool HaltWatchDog; // Stop the watchdog thread + LIST *AdminOptionList; // Administration options list + UINT64 CreatedTime; // Creation date and time + UINT64 LastCommTime; // Last communication date and time + UINT64 LastLoginTime; // Last login date and time + UINT NumLogin; // Number of logins + bool HubIsOnlineButHalting; // Virtual HUB is really online, but it is in offline state to stop + UINT FarmMember_MaxSessionClient; // Maximum client connection sessions for cluster members + UINT FarmMember_MaxSessionBridge; // Maximum bridge connection sessions for cluster members + bool FarmMember_MaxSessionClientBridgeApply; // Apply the FarmMember_MaxSession* + UINT CurrentVersion; // The current version + UINT LastVersion; // Version of when the update notification is issued at the last + wchar_t *Msg; // Message to be displayed when the client is connected + LIST *UserList; // Cache of the user list file + bool IsVgsHub; // Whether it's a VGS Virtual HUB + bool IsVgsSuperRelayHub; // Whether it's a VGS Super Relay Virtual HUB + UINT64 LastFlushTick; // Last tick to flush the MAC address table + bool StopAllLinkFlag; // Stop all link flag + bool ForceDisableComm; // Disable the communication function +}; + + +// Global variable +extern ADMIN_OPTION admin_options[]; +extern UINT num_admin_options; + + +// Function prototype +HUBDB *NewHubDb(); +void DeleteHubDb(HUBDB *d); +HUB *NewHub(CEDAR *cedar, char *HubName, HUB_OPTION *option); +void SetHubMsg(HUB *h, wchar_t *msg); +wchar_t *GetHubMsg(HUB *h); +void GenHubMacAddress(UCHAR *mac, char *name); +void GenHubIpAddress(IP *ip, char *name); +bool IsHubIpAddress(IP *ip); +bool IsHubIpAddress32(UINT ip32); +bool IsHubIpAddress64(IPV6_ADDR *addr); +bool IsHubMacAddress(UCHAR *mac); +void ReleaseHub(HUB *h); +void CleanupHub(HUB *h); +int CompareHub(void *p1, void *p2); +void LockHubList(CEDAR *cedar); +void UnlockHubList(CEDAR *cedar); +HUB *GetHub(CEDAR *cedar, char *name); +bool IsHub(CEDAR *cedar, char *name); +void StopHub(HUB *h); +void AddSession(HUB *h, SESSION *s); +void DelSession(HUB *h, SESSION *s); +SESSION *SearchSessionByUniqueId(HUB *h, UINT id); +UINT GetNewUniqueId(HUB *h); +void StopAllSession(HUB *h); +bool HubPaInit(SESSION *s); +void HubPaFree(SESSION *s); +CANCEL *HubPaGetCancel(SESSION *s); +UINT HubPaGetNextPacket(SESSION *s, void **data); +bool HubPaPutPacket(SESSION *s, void *data, UINT size); +PACKET_ADAPTER *GetHubPacketAdapter(); +int CompareMacTable(void *p1, void *p2); +UINT GetHashOfMacTable(void *p); +void StorePacket(HUB *hub, SESSION *s, PKT *packet); +bool StorePacketFilter(SESSION *s, PKT *packet); +void StorePacketToHubPa(HUB_PA *dest, SESSION *src, void *data, UINT size, PKT *packet, bool is_flooding, bool no_check_acl); +void SetHubOnline(HUB *h); +void SetHubOffline(HUB *h); +SESSION *GetSessionByName(HUB *hub, char *name); +int CompareIpTable(void *p1, void *p2); +bool StorePacketFilterByPolicy(SESSION *s, PKT *p); +bool DeleteIPv6DefaultRouterInRA(PKT *p); +bool StorePacketFilterByTrafficLimiter(SESSION *s, PKT *p); +void IntoTrafficLimiter(TRAFFIC_LIMITER *tr, PKT *p); +bool IsMostHighestPriorityPacket(SESSION *s, PKT *p); +bool IsPriorityPacketForQoS(PKT *p); +int CompareStormList(void *p1, void *p2); +STORM *SearchStormList(HUB_PA *pa, UCHAR *mac_address, IP *src_ip, IP *dest_ip, bool strict); +STORM *AddStormList(HUB_PA *pa, UCHAR *mac_address, IP *src_ip, IP *dest_ip, bool strict); +bool CheckBroadcastStorm(HUB *hub, SESSION *s, PKT *p); +void AddRootCert(HUB *hub, X *x); +int CmpAccessList(void *p1, void *p2); +void InitAccessList(HUB *hub); +void FreeAccessList(HUB *hub); +void AddAccessList(HUB *hub, ACCESS *a); +void AddAccessListEx(HUB *hub, ACCESS *a, bool no_sort, bool no_reassign_id); +bool IsTcpPacketNcsiHttpAccess(PKT *p); +UINT64 UsernameToInt64(char *name); +void MakeSimpleUsernameRemoveNtDomain(char *dst, UINT dst_size, char *src); +bool ApplyAccessListToStoredPacket(HUB *hub, SESSION *s, PKT *p); +void ForceRedirectToUrl(HUB *hub, SESSION *src_session, PKT *p, char *redirect_url); +BUF *BuildRedirectToUrlPayload(HUB *hub, SESSION *s, char *redirect_url); +bool ApplyAccessListToForwardPacket(HUB *hub, SESSION *src_session, SESSION *dest_session, PKT *p); +bool IsPacketMaskedByAccessList(SESSION *s, PKT *p, ACCESS *a, UINT64 dest_username, UINT64 dest_groupname, SESSION *dest_session); +void GetAccessListStr(char *str, UINT size, ACCESS *a); +void DeleteOldIpTableEntry(LIST *o); +void SetRadiusServer(HUB *hub, char *name, UINT port, char *secret); +void SetRadiusServerEx(HUB *hub, char *name, UINT port, char *secret, UINT interval); +bool GetRadiusServer(HUB *hub, char *name, UINT size, UINT *port, char *secret, UINT secret_size); +bool GetRadiusServerEx(HUB *hub, char *name, UINT size, UINT *port, char *secret, UINT secret_size, UINT *interval); +bool GetRadiusServerEx2(HUB *hub, char *name, UINT size, UINT *port, char *secret, UINT secret_size, UINT *interval, char *suffix_filter, UINT suffix_filter_size); +int CompareCert(void *p1, void *p2); +void GetHubLogSetting(HUB *h, HUB_LOG *setting); +void SetHubLogSetting(HUB *h, HUB_LOG *setting); +void SetHubLogSettingEx(HUB *h, HUB_LOG *setting, bool no_change_switch_type); +void DeleteExpiredIpTableEntry(LIST *o); +void DeleteExpiredMacTableEntry(HASH_LIST *h); +void AddTrafficDiff(HUB *h, char *name, UINT type, TRAFFIC *traffic); +void IncrementHubTraffic(HUB *h); +void EnableSecureNAT(HUB *h, bool enable); +void EnableSecureNATEx(HUB *h, bool enable, bool no_change); +void StartHubWatchDog(HUB *h); +void StopHubWatchDog(HUB *h); +void HubWatchDogThread(THREAD *t, void *param); +int CompareAdminOption(void *p1, void *p2); +UINT GetHubAdminOptionEx(HUB *h, char *name, UINT default_value); +UINT GetHubAdminOption(HUB *h, char *name); +void DeleteAllHubAdminOption(HUB *h, bool lock); +void AddHubAdminOptionsDefaults(HUB *h, bool lock); +bool IsCertMatchCrl(X *x, CRL *crl); +bool IsCertMatchCrlList(X *x, LIST *o); +wchar_t *GenerateCrlStr(CRL *crl); +bool IsValidCertInHub(HUB *h, X *x); +void FreeCrl(CRL *crl); +CRL *CopyCrl(CRL *crl); +int CmpAc(void *p1, void *p2); +LIST *NewAcList(); +void AddAc(LIST *o, AC *ac); +bool DelAc(LIST *o, UINT id); +AC *GetAc(LIST *o, UINT id); +void SetAc(LIST *o, UINT id, AC *ac); +void DelAllAc(LIST *o); +void SetAcList(LIST *o, LIST *src); +void NormalizeAcList(LIST *o); +bool IsIpMaskedByAc(IP *ip, AC *ac); +bool IsIpDeniedByAcList(IP *ip, LIST *o); +char *GenerateAcStr(AC *ac); +void FreeAcList(LIST *o); +LIST *CloneAcList(LIST *o); +bool IsIPManagementTargetForHUB(IP *ip, HUB *hub); +wchar_t *GetHubAdminOptionHelpString(char *name); +void HubOptionStructToData(RPC_ADMIN_OPTION *ao, HUB_OPTION *o, char *hub_name); +ADMIN_OPTION *NewAdminOption(char *name, UINT value); +void DataToHubOptionStruct(HUB_OPTION *o, RPC_ADMIN_OPTION *ao); +UINT GetHubAdminOptionData(RPC_ADMIN_OPTION *ao, char *name); +void GetHubAdminOptionDataAndSet(RPC_ADMIN_OPTION *ao, char *name, UINT *dest); +bool IsURLMsg(wchar_t *str, char *url, UINT url_size); +LIST *NewUserList(); +void DeleteAllUserListCache(LIST *o); +void FreeUserList(LIST *o); +void FreeUserListEntry(USERLIST *u); +int CompareUserList(void *p1, void *p2); +USERLIST *LoadUserList(LIST *o, char *filename); +USERLIST *FindUserList(LIST *o, char *filename); +bool IsUserMatchInUserList(LIST *o, char *filename, UINT64 user_hash); +bool IsUserMatchInUserListWithCacheExpires(LIST *o, char *filename, UINT64 user_hash, UINT64 lifetime); +bool IsUserMatchInUserListWithCacheExpiresAcl(LIST *o, char *name_in_acl, UINT64 user_hash, UINT64 lifetime); +bool CheckMaxLoggedPacketsPerMinute(SESSION *s, UINT max_packets, UINT64 now); +EAP_CLIENT *HubNewEapClient(CEDAR *cedar, char *hubname, char *client_ip_str, char *username, char *vpn_protocol_state_str); + +#endif // HUB_H + + diff --git a/src/Cedar/IPC.c b/src/Cedar/IPC.c index f8a5f081..d1b022b3 100644 --- a/src/Cedar/IPC.c +++ b/src/Cedar/IPC.c @@ -1,2613 +1,2613 @@ -// SoftEther VPN Source Code - Developer Edition Master Branch -// Cedar Communication Module - - -// IPC.c -// In-process VPN client module - -#include "CedarPch.h" - -// Extract the MS-CHAP v2 authentication information by parsing the password string -bool ParseAndExtractMsChapV2InfoFromPassword(IPC_MSCHAP_V2_AUTHINFO *d, char *password) -{ - TOKEN_LIST *t; - bool ret = false; - // Validate arguments - if (d == NULL || password == NULL) - { - return false; - } - - Zero(d, sizeof(IPC_MSCHAP_V2_AUTHINFO)); - - if (StartWith(password, IPC_PASSWORD_MSCHAPV2_TAG) == false) - { - return false; - } - - t = ParseTokenWithNullStr(password, ":"); - - if (t->NumTokens == 6) - { - BUF *b1, *b2, *b3, *b4; - - b1 = StrToBin(t->Token[2]); - b2 = StrToBin(t->Token[3]); - b3 = StrToBin(t->Token[4]); - b4 = StrToBin(t->Token[5]); - - if (IsEmptyStr(t->Token[1]) == false && b1->Size == 16 && b2->Size == 16 && b3->Size == 24 - && b4->Size == 8) - { - UINT64 eap_client_ptr = 0; - - StrCpy(d->MsChapV2_PPPUsername, sizeof(d->MsChapV2_PPPUsername), t->Token[1]); - Copy(d->MsChapV2_ServerChallenge, b1->Buf, 16); - Copy(d->MsChapV2_ClientChallenge, b2->Buf, 16); - Copy(d->MsChapV2_ClientResponse, b3->Buf, 24); - Copy(&eap_client_ptr, b4->Buf, 8); - - d->MsChapV2_EapClient = (EAP_CLIENT *)eap_client_ptr; - - ret = true; - } - - FreeBuf(b1); - FreeBuf(b2); - FreeBuf(b3); - FreeBuf(b4); - } - - FreeToken(t); - - return ret; -} - -// Start an IPC connection asynchronously -IPC_ASYNC *NewIPCAsync(CEDAR *cedar, IPC_PARAM *param, SOCK_EVENT *sock_event) -{ - IPC_ASYNC *a; - // Validate arguments - if (cedar == NULL || param == NULL) - { - return NULL; - } - - a = ZeroMalloc(sizeof(IPC_ASYNC)); - - a->TubeForDisconnect = NewTube(0); - - a->Cedar = cedar; - AddRef(a->Cedar->ref); - - Copy(&a->Param, param, sizeof(IPC_PARAM)); - - if (param->ClientCertificate != NULL) - { - // Client certificate must be copied for async processing - a->Param.ClientCertificate = CloneX(param->ClientCertificate); - } - - if (sock_event != NULL) - { - a->SockEvent = sock_event; - AddRef(a->SockEvent->ref); - } - - a->Thread = NewThread(IPCAsyncThreadProc, a); - - return a; -} - -// asynchronous IPC connection creation thread -void IPCAsyncThreadProc(THREAD *thread, void *param) -{ - IPC_ASYNC *a; - // Validate arguments - if (thread == NULL || param == NULL) - { - return; - } - - a = (IPC_ASYNC *)param; - - // Attempt to connect - a->Ipc = NewIPCByParam(a->Cedar, &a->Param, &a->ErrorCode); - - if (a->Ipc != NULL) - { - if (a->Param.IsL3Mode) - { - DHCP_OPTION_LIST cao; - - Zero(&cao, sizeof(cao)); - - // Get an IP address from the DHCP server in the case of L3 mode - Debug("IPCDhcpAllocateIP() start...\n"); - if (IPCDhcpAllocateIP(a->Ipc, &cao, a->TubeForDisconnect)) - { - UINT t; - IP ip, subnet, gw; - - Debug("IPCDhcpAllocateIP() Ok.\n"); - - // Calculate the DHCP update interval - t = cao.LeaseTime; - if (t == 0) - { - t = 600; - } - - t = t / 3; - - if (t == 0) - { - t = 1; - } - - // Save the options list - Copy(&a->L3ClientAddressOption, &cao, sizeof(DHCP_OPTION_LIST)); - a->L3DhcpRenewInterval = (UINT64)t * (UINT64)1000; - - // Set the obtained IP address parameters to the IPC virtual host - UINTToIP(&ip, cao.ClientAddress); - UINTToIP(&subnet, cao.SubnetMask); - UINTToIP(&gw, cao.Gateway); - - IPCSetIPv4Parameters(a->Ipc, &ip, &subnet, &gw, &cao.ClasslessRoute); - - a->L3NextDhcpRenewTick = Tick64() + a->L3DhcpRenewInterval; - } - else - { - Debug("IPCDhcpAllocateIP() Error.\n"); - - a->DhcpAllocFailed = true; - - FreeIPC(a->Ipc); - a->Ipc = NULL; - } - } - } - - // Procedure complete - a->Done = true; - - if (a->SockEvent != NULL) - { - SetSockEvent(a->SockEvent); - } -} - -// Release the IPC asynchronous connection object -void FreeIPCAsync(IPC_ASYNC *a) -{ - // Validate arguments - if (a == NULL) - { - return; - } - - TubeDisconnect(a->TubeForDisconnect); - WaitThread(a->Thread, INFINITE); - ReleaseThread(a->Thread); - - if (a->Ipc != NULL) - { - FreeIPC(a->Ipc); - a->Ipc = NULL; - } - - if (a->SockEvent != NULL) - { - ReleaseSockEvent(a->SockEvent); - } - - ReleaseCedar(a->Cedar); - - ReleaseTube(a->TubeForDisconnect); - - if (a->Param.ClientCertificate != NULL) - { - FreeX(a->Param.ClientCertificate); - } - - Free(a); -} - -// Start a new IPC connection by specifying the parameter structure -IPC *NewIPCByParam(CEDAR *cedar, IPC_PARAM *param, UINT *error_code) -{ - IPC *ipc; - // Validate arguments - if (cedar == NULL || param == NULL) - { - return NULL; - } - - ipc = NewIPC(cedar, param->ClientName, param->Postfix, param->HubName, - param->UserName, param->Password, error_code, ¶m->ClientIp, - param->ClientPort, ¶m->ServerIp, param->ServerPort, - param->ClientHostname, param->CryptName, - param->BridgeMode, param->Mss, NULL, param->ClientCertificate, param->Layer); - - return ipc; -} - -// Start a new IPC connection -IPC *NewIPC(CEDAR *cedar, char *client_name, char *postfix, char *hubname, char *username, char *password, - UINT *error_code, IP *client_ip, UINT client_port, IP *server_ip, UINT server_port, - char *client_hostname, char *crypt_name, - bool bridge_mode, UINT mss, EAP_CLIENT *eap_client, X *client_certificate, - UINT layer) -{ - IPC *ipc; - UINT dummy_int = 0; - SOCK *a; - SOCK *s; - PACK *p; - UINT err = ERR_INTERNAL_ERROR; - char server_str[MAX_SIZE]; - char macstr[30]; - UINT server_ver, server_build; - UCHAR unique[SHA1_SIZE]; - NODE_INFO info; - BUF *b; - UCHAR mschap_v2_server_response_20[20]; - UINT64 u64; - // Validate arguments - if (cedar == NULL || username == NULL || password == NULL || client_hostname == NULL) - { - return NULL; - } - if (IsEmptyStr(client_name)) - { - client_name = "InProc VPN Connection"; - } - if (IsEmptyStr(crypt_name)) - { - crypt_name = ""; - } - if (error_code == NULL) - { - error_code = &dummy_int; - } - - Zero(mschap_v2_server_response_20, sizeof(mschap_v2_server_response_20)); - - err = *error_code = ERR_INTERNAL_ERROR; - - a = GetInProcListeningSock(cedar); - if (a == NULL) - { - return NULL; - } - - ipc = ZeroMalloc(sizeof(IPC)); - - ipc->Cedar = cedar; - AddRef(cedar->ref); - - ipc->Layer = layer; - if (ipc->Layer == 0) - { - ipc->Layer = IPC_LAYER_2; - } - - ipc->FlushList = NewTubeFlushList(); - - StrCpy(ipc->ClientHostname, sizeof(ipc->ClientHostname), client_hostname); - StrCpy(ipc->HubName, sizeof(ipc->HubName), hubname); - StrCpy(ipc->UserName, sizeof(ipc->UserName), username); - StrCpy(ipc->Password, sizeof(ipc->Password), password); - - // Connect the in-process socket - s = ConnectInProc(a, client_ip, client_port, server_ip, server_port); - if (s == NULL) - { - goto LABEL_ERROR; - } - - // Protocol initialization process - if (ClientUploadSignature(s) == false) - { - err = ERR_DISCONNECTED; - goto LABEL_ERROR; - } - - p = HttpClientRecv(s); - if (p == NULL) - { - err = ERR_DISCONNECTED; - goto LABEL_ERROR; - } - - err = GetErrorFromPack(p); - if (err != ERR_NO_ERROR) - { - FreePack(p); - goto LABEL_ERROR; - } - - if (GetHello(p, ipc->random, &server_ver, &server_build, server_str, sizeof(server_str)) == false) - { - FreePack(p); - err = ERR_DISCONNECTED; - goto LABEL_ERROR; - } - - FreePack(p); - - // Upload the authentication data - if (client_certificate != NULL) - { - p = PackLoginWithOpenVPNCertificate(hubname, username, client_certificate); - } - else - { - p = PackLoginWithPlainPassword(hubname, username, password); - } - - if (p == NULL) - { - err = ERR_AUTH_FAILED; - goto LABEL_ERROR; - } - - PackAddStr(p, "hello", client_name); - PackAddInt(p, "client_ver", cedar->Version); - PackAddInt(p, "client_build", cedar->Build); - PackAddInt(p, "max_connection", 1); - PackAddInt(p, "use_encrypt", 0); - PackAddInt(p, "use_compress", 0); - PackAddInt(p, "half_connection", 0); - PackAddInt(p, "adjust_mss", mss); - PackAddBool(p, "require_bridge_routing_mode", bridge_mode); - PackAddBool(p, "require_monitor_mode", false); - PackAddBool(p, "qos", false); - - if (eap_client != NULL) - { - UINT64 ptr = (UINT64)eap_client; - PackAddInt64(p, "release_me_eap_client", ptr); - - AddRef(eap_client->Ref); - } - - // Unique ID is determined by the sum of the connecting client IP address and the client_name - b = NewBuf(); - WriteBuf(b, client_ip, sizeof(IP)); - WriteBufStr(b, client_name); - WriteBufStr(b, crypt_name); - - Sha1(unique, b->Buf, b->Size); - - FreeBuf(b); - - PackAddData(p, "unique_id", unique, SHA1_SIZE); - - PackAddStr(p, "inproc_postfix", postfix); - PackAddStr(p, "inproc_cryptname", crypt_name); - PackAddInt(p, "inproc_layer", ipc->Layer); - - // Node information - Zero(&info, sizeof(info)); - StrCpy(info.ClientProductName, sizeof(info.ClientProductName), client_name); - info.ClientProductVer = Endian32(cedar->Version); - info.ClientProductBuild = Endian32(cedar->Build); - StrCpy(info.ServerProductName, sizeof(info.ServerProductName), server_str); - info.ServerProductVer = Endian32(server_ver); - info.ServerProductBuild = Endian32(server_build); - StrCpy(info.ClientOsName, sizeof(info.ClientOsName), client_name); - StrCpy(info.ClientOsVer, sizeof(info.ClientOsVer), "-"); - StrCpy(info.ClientOsProductId, sizeof(info.ClientOsProductId), "-"); - info.ClientIpAddress = IPToUINT(&s->LocalIP); - info.ClientPort = Endian32(s->LocalPort); - StrCpy(info.ClientHostname, sizeof(info.ClientHostname), ipc->ClientHostname); - IPToStr(info.ServerHostname, sizeof(info.ServerHostname), &s->RemoteIP); - info.ServerIpAddress = IPToUINT(&s->RemoteIP); - info.ServerPort = Endian32(s->RemotePort); - StrCpy(info.HubName, sizeof(info.HubName), hubname); - Copy(info.UniqueId, unique, 16); - if (IsIP6(&s->LocalIP)) - { - Copy(info.ClientIpAddress6, s->LocalIP.ipv6_addr, 16); - } - if (IsIP6(&s->RemoteIP)) - { - Copy(info.ServerIpAddress6, s->RemoteIP.ipv6_addr, 16); - } - OutRpcNodeInfo(p, &info); - - if (HttpClientSend(s, p) == false) - { - FreePack(p); - err = ERR_DISCONNECTED; - goto LABEL_ERROR; - } - - FreePack(p); - - // Receive a Welcome packet - p = HttpClientRecv(s); - if (p == NULL) - { - err = ERR_DISCONNECTED; - goto LABEL_ERROR; - } - - err = GetErrorFromPack(p); - if (err != ERR_NO_ERROR) - { - FreePack(p); - goto LABEL_ERROR; - } - - if (ParseWelcomeFromPack(p, ipc->SessionName, sizeof(ipc->SessionName), - ipc->ConnectionName, sizeof(ipc->ConnectionName), &ipc->Policy) == false) - { - err = ERR_PROTOCOL_ERROR; - FreePack(p); - goto LABEL_ERROR; - } - - if (PackGetData2(p, "IpcMacAddress", ipc->MacAddress, 6) == false || IsZero(ipc->MacAddress, 6)) - { - err = ERR_PROTOCOL_ERROR; - FreePack(p); - goto LABEL_ERROR; - } - - if (PackGetData2(p, "IpcMsChapV2ServerResponse", mschap_v2_server_response_20, sizeof(mschap_v2_server_response_20))) - { - Copy(ipc->MsChapV2_ServerResponse, mschap_v2_server_response_20, sizeof(mschap_v2_server_response_20)); - } - - PackGetStr(p, "IpcHubName", ipc->HubName, sizeof(ipc->HubName)); - Debug("IPC Hub Name: %s\n", ipc->HubName); - - MacToStr(macstr, sizeof(macstr), ipc->MacAddress); - - Debug("IPC: Session = %s, Connection = %s, Mac = %s\n", ipc->SessionName, ipc->ConnectionName, macstr); - - u64 = PackGetInt64(p, "IpcSessionSharedBuffer"); - ipc->IpcSessionSharedBuffer = (SHARED_BUFFER *)u64; - ipc->IpcSessionShared = ipc->IpcSessionSharedBuffer->Data; - - FreePack(p); - - ReleaseSock(a); - ipc->Sock = s; - - Debug("NewIPC() Succeed.\n"); - - ipc->Interrupt = NewInterruptManager(); - - // Create an ARP table - ipc->ArpTable = NewList(IPCCmpArpTable); - - // Create an IPv4 reception queue - ipc->IPv4ReceivedQueue = NewQueue(); - ipc->IPv4State = IPC_PROTO_STATUS_CLOSED; - - ipc->DHCPv4Awaiter.IsAwaiting = false; - ipc->DHCPv4Awaiter.DhcpData = NULL; - - IPCIPv6Init(ipc); - - return ipc; - -LABEL_ERROR: - Debug("NewIPC() Failed: Err = %u\n", err); - Disconnect(s); - ReleaseSock(s); - ReleaseSock(a); - FreeIPC(ipc); - *error_code = err; - return NULL; -} - -// Create a new IPC based on SOCK -IPC *NewIPCBySock(CEDAR *cedar, SOCK *s, void *mac_address) -{ - IPC *ipc; - // Validate arguments - if (cedar == NULL || mac_address == NULL || s == NULL) - { - return NULL; - } - - ipc = ZeroMalloc(sizeof(IPC)); - - ipc->Cedar = cedar; - AddRef(cedar->ref); - - ipc->Sock = s; - AddRef(s->ref); - - Copy(ipc->MacAddress, mac_address, 6); - - ipc->Interrupt = NewInterruptManager(); - - // Create an ARP table - ipc->ArpTable = NewList(IPCCmpArpTable); - - // Create an IPv4 reception queue - ipc->IPv4ReceivedQueue = NewQueue(); - ipc->IPv4State = IPC_PROTO_STATUS_CLOSED; - - ipc->DHCPv4Awaiter.IsAwaiting = false; - ipc->DHCPv4Awaiter.DhcpData = NULL; - - ipc->FlushList = NewTubeFlushList(); - - IPCIPv6Init(ipc); - - return ipc; -} - -// Get whether the IPC is connected -bool IsIPCConnected(IPC *ipc) -{ - // Validate arguments - if (ipc == NULL) - { - return false; - } - - if (IsTubeConnected(ipc->Sock->RecvTube) == false || IsTubeConnected(ipc->Sock->SendTube) == false) - { - return false; - } - - return true; -} - -// Get to hit the SOCK_EVENT when a new data has arrived in the IPC -void IPCSetSockEventWhenRecvL2Packet(IPC *ipc, SOCK_EVENT *e) -{ - // Validate arguments - if (ipc == NULL || e == NULL) - { - return; - } - - JoinSockToSockEvent(ipc->Sock, e); -} - -// End of IPC connection -void FreeIPC(IPC *ipc) -{ - UINT i; - // Validate arguments - if (ipc == NULL) - { - return; - } - - FreeTubeFlushList(ipc->FlushList); - - Disconnect(ipc->Sock); - ReleaseSock(ipc->Sock); - - if (ipc->Policy != NULL) - { - Free(ipc->Policy); - } - - ReleaseCedar(ipc->Cedar); - - FreeInterruptManager(ipc->Interrupt); - - for (i = 0; i < LIST_NUM(ipc->ArpTable); i++) - { - IPC_ARP *a = LIST_DATA(ipc->ArpTable, i); - IPCFreeARP(a); - } - - ReleaseList(ipc->ArpTable); - - while (true) - { - BLOCK *b = GetNext(ipc->IPv4ReceivedQueue); - if (b == NULL) - { - break; - } - - FreeBlock(b); - } - - ReleaseQueue(ipc->IPv4ReceivedQueue); - - ReleaseSharedBuffer(ipc->IpcSessionSharedBuffer); - - FreeDHCPv4Data(ipc->DHCPv4Awaiter.DhcpData); - - IPCIPv6Free(ipc); - - Free(ipc); -} - -// Set User Class option if corresponding Virtual Hub optin is set -void IPCDhcpSetConditionalUserClass(IPC *ipc, DHCP_OPTION_LIST *req) -{ - HUB *hub; - - hub = GetHub(ipc->Cedar, ipc->HubName); - if (hub == NULL) - { - return; - } - - if (hub->Option && hub->Option->UseHubNameAsDhcpUserClassOption) - { - StrCpy(req->UserClass, sizeof(req->UserClass), ipc->HubName); - } - ReleaseHub(hub); -} - -// Release the IP address from the DHCP server -void IPCDhcpFreeIP(IPC *ipc, IP *dhcp_server) -{ - DHCP_OPTION_LIST req; - UINT tran_id = Rand32(); - // Validate arguments - if (ipc == NULL || dhcp_server == NULL) - { - return; - } - - Zero(&req, sizeof(req)); - req.Opcode = DHCP_RELEASE; - req.ServerAddress = IPToUINT(dhcp_server); - IPCDhcpSetConditionalUserClass(ipc, &req); - - FreeDHCPv4Data(IPCSendDhcpRequest(ipc, NULL, tran_id, &req, 0, 0, NULL)); -} - -// Update the IP address using the DHCP -void IPCDhcpRenewIP(IPC *ipc, IP *dhcp_server) -{ - DHCP_OPTION_LIST req; - UINT tran_id = Rand32(); - // Validate arguments - if (ipc == NULL || dhcp_server == NULL) - { - return; - } - - // Send a DHCP Request - Zero(&req, sizeof(req)); - req.Opcode = DHCP_REQUEST; - StrCpy(req.Hostname, sizeof(req.Hostname), ipc->ClientHostname); - req.RequestedIp = IPToUINT(&ipc->ClientIPAddress); - IPCDhcpSetConditionalUserClass(ipc, &req); - - FreeDHCPv4Data(IPCSendDhcpRequest(ipc, dhcp_server, tran_id, &req, 0, 0, NULL)); -} - -// Get the information other than the IP address with using DHCP -bool IPCDhcpRequestInformIP(IPC *ipc, DHCP_OPTION_LIST *opt, TUBE *discon_poll_tube, IP *client_ip) -{ - DHCP_OPTION_LIST req; - DHCPV4_DATA *d; - UINT tran_id = Rand32(); - bool ok; - // Validate arguments - if (ipc == NULL || opt == NULL || client_ip == NULL) - { - return false; - } - - // Send a DHCP Inform - Zero(&req, sizeof(req)); - req.Opcode = DHCP_INFORM; - req.ClientAddress = IPToUINT(client_ip); - StrCpy(req.Hostname, sizeof(req.Hostname), ipc->ClientHostname); - IPCDhcpSetConditionalUserClass(ipc, &req); - - d = IPCSendDhcpRequest(ipc, NULL, tran_id, &req, DHCP_ACK, IPC_DHCP_TIMEOUT, discon_poll_tube); - if (d == NULL) - { - return false; - } - - // Analyze the DHCP Ack - ok = true; - if (d->ParsedOptionList->SubnetMask == 0) - { - ok = false; - } - - if (ok == false) - { - FreeDHCPv4Data(d); - return false; - } - - Copy(opt, d->ParsedOptionList, sizeof(DHCP_OPTION_LIST)); - - FreeDHCPv4Data(d); - - return true; -} - -// Make a request for IP addresses using DHCP -bool IPCDhcpAllocateIP(IPC *ipc, DHCP_OPTION_LIST *opt, TUBE *discon_poll_tube) -{ - DHCP_OPTION_LIST req; - DHCPV4_DATA *d, *d2; - UINT tran_id = Rand32(); - bool ok; - // Validate arguments - if (ipc == NULL || opt == NULL) - { - return false; - } - - // Send a DHCP Discover - Zero(&req, sizeof(req)); - req.RequestedIp = 0; - req.Opcode = DHCP_DISCOVER; - StrCpy(req.Hostname, sizeof(req.Hostname), ipc->ClientHostname); - IPCDhcpSetConditionalUserClass(ipc, &req); - - d = IPCSendDhcpRequest(ipc, NULL, tran_id, &req, DHCP_OFFER, IPC_DHCP_TIMEOUT, discon_poll_tube); - if (d == NULL) - { - return false; - } - - // Analyze the DHCP Offer - ok = true; - if (IsValidUnicastIPAddressUINT4(d->ParsedOptionList->ClientAddress) == false) - { - ok = false; - } - if (IsValidUnicastIPAddressUINT4(d->ParsedOptionList->ServerAddress) == false) - { - ok = false; - } - if (d->ParsedOptionList->SubnetMask == 0) - { - ok = false; - } - if (d->ParsedOptionList->LeaseTime == 0) - { - d->ParsedOptionList->LeaseTime = IPC_DHCP_DEFAULT_LEASE; - } - if (d->ParsedOptionList->LeaseTime <= IPC_DHCP_MIN_LEASE) - { - d->ParsedOptionList->LeaseTime = IPC_DHCP_MIN_LEASE; - } - - if (ok == false) - { - FreeDHCPv4Data(d); - return false; - } - - // Send a DHCP Request - Zero(&req, sizeof(req)); - req.Opcode = DHCP_REQUEST; - StrCpy(req.Hostname, sizeof(req.Hostname), ipc->ClientHostname); - req.ServerAddress = d->ParsedOptionList->ServerAddress; - req.RequestedIp = d->ParsedOptionList->ClientAddress; - IPCDhcpSetConditionalUserClass(ipc, &req); - - d2 = IPCSendDhcpRequest(ipc, NULL, tran_id, &req, DHCP_ACK, IPC_DHCP_TIMEOUT, discon_poll_tube); - if (d2 == NULL) - { - FreeDHCPv4Data(d); - return false; - } - - // Analyze the DHCP Ack - ok = true; - if (IsValidUnicastIPAddressUINT4(d2->ParsedOptionList->ClientAddress) == false) - { - ok = false; - } - if (IsValidUnicastIPAddressUINT4(d2->ParsedOptionList->ServerAddress) == false) - { - ok = false; - } - if (d2->ParsedOptionList->SubnetMask == 0) - { - ok = false; - } - if (d2->ParsedOptionList->LeaseTime == 0) - { - d2->ParsedOptionList->LeaseTime = IPC_DHCP_DEFAULT_LEASE; - } - if (d2->ParsedOptionList->LeaseTime <= IPC_DHCP_MIN_LEASE) - { - d2->ParsedOptionList->LeaseTime = IPC_DHCP_MIN_LEASE; - } - - if (ok == false) - { - FreeDHCPv4Data(d); - FreeDHCPv4Data(d2); - return false; - } - - Copy(opt, d2->ParsedOptionList, sizeof(DHCP_OPTION_LIST)); - - FreeDHCPv4Data(d); - FreeDHCPv4Data(d2); - - return true; -} - -// Send out a DHCP request, and wait for a corresponding response -DHCPV4_DATA *IPCSendDhcpRequest(IPC *ipc, IP *dest_ip, UINT tran_id, DHCP_OPTION_LIST *opt, UINT expecting_code, UINT timeout, TUBE *discon_poll_tube) -{ - UINT resend_interval; - UINT64 giveup_time; - UINT64 next_send_time = 0; - TUBE *tubes[3]; - UINT num_tubes = 0; - // Validate arguments - if (ipc == NULL || opt == NULL || (expecting_code != 0 && timeout == 0)) - { - return NULL; - } - - // Retransmission interval - resend_interval = MAX(1, (timeout / 3) - 100); - - // Time-out time - giveup_time = Tick64() + (UINT64)timeout; - - AddInterrupt(ipc->Interrupt, giveup_time); - - tubes[num_tubes++] = ipc->Sock->RecvTube; - tubes[num_tubes++] = ipc->Sock->SendTube; - - if (discon_poll_tube != NULL) - { - tubes[num_tubes++] = discon_poll_tube; - } - - while (true) - { - UINT64 now = Tick64(); - BUF *dhcp_packet; - - IPCFlushArpTable(ipc); - - // Time-out inspection - if ((expecting_code != 0) && (now >= giveup_time)) - { - ipc->DHCPv4Awaiter.IsAwaiting = false; - FreeDHCPv4Data(ipc->DHCPv4Awaiter.DhcpData); - ipc->DHCPv4Awaiter.DhcpData = NULL; - return NULL; - } - - // Send by building a DHCP packet periodically - if (next_send_time == 0 || next_send_time <= now) - { - dhcp_packet = IPCBuildDhcpRequest(ipc, dest_ip, tran_id, opt); - if (dhcp_packet == NULL) - { - ipc->DHCPv4Awaiter.IsAwaiting = false; - FreeDHCPv4Data(ipc->DHCPv4Awaiter.DhcpData); - ipc->DHCPv4Awaiter.DhcpData = NULL; - return NULL; - } - - IPCSendIPv4(ipc, dhcp_packet->Buf, dhcp_packet->Size); - - FreeBuf(dhcp_packet); - - if (expecting_code == 0) - { - ipc->DHCPv4Awaiter.IsAwaiting = false; - FreeDHCPv4Data(ipc->DHCPv4Awaiter.DhcpData); - ipc->DHCPv4Awaiter.DhcpData = NULL; - return NULL; - } - - next_send_time = now + (UINT64)resend_interval; - - AddInterrupt(ipc->Interrupt, next_send_time); - } - - // Happy processing - ipc->DHCPv4Awaiter.IsAwaiting = true; - FreeDHCPv4Data(ipc->DHCPv4Awaiter.DhcpData); - ipc->DHCPv4Awaiter.DhcpData = NULL; - ipc->DHCPv4Awaiter.TransCode = tran_id; - ipc->DHCPv4Awaiter.OpCode = expecting_code; - IPCProcessL3Events(ipc); - - if (ipc->DHCPv4Awaiter.DhcpData != NULL) - { - DHCPV4_DATA *dhcp = ipc->DHCPv4Awaiter.DhcpData; - ipc->DHCPv4Awaiter.IsAwaiting = false; - ipc->DHCPv4Awaiter.DhcpData = NULL; - return dhcp; - } - - if (IsTubeConnected(ipc->Sock->RecvTube) == false || IsTubeConnected(ipc->Sock->SendTube) == false || - (discon_poll_tube != NULL && IsTubeConnected(discon_poll_tube) == false)) - { - // Session is disconnected - ipc->DHCPv4Awaiter.IsAwaiting = false; - FreeDHCPv4Data(ipc->DHCPv4Awaiter.DhcpData); - ipc->DHCPv4Awaiter.DhcpData = NULL; - return NULL; - } - - // Keep the CPU waiting - WaitForTubes(tubes, num_tubes, GetNextIntervalForInterrupt(ipc->Interrupt)); - } - - ipc->DHCPv4Awaiter.IsAwaiting = false; - FreeDHCPv4Data(ipc->DHCPv4Awaiter.DhcpData); - ipc->DHCPv4Awaiter.DhcpData = NULL; - return NULL; -} - -// Build a DHCP request packet -BUF *IPCBuildDhcpRequest(IPC *ipc, IP *dest_ip, UINT tran_id, DHCP_OPTION_LIST *opt) -{ - IPV4_HEADER ip; - UDP_HEADER *udp; - DHCPV4_HEADER dhcp; - UINT blank_size = 128 + 64; - BUF *ret; - BUF *b; - UDPV4_PSEUDO_HEADER *ph; - UINT ph_size; - UINT udp_size; - UINT magic_number = Endian32(DHCP_MAGIC_COOKIE); - USHORT checksum; - // Validate arguments - if (ipc == NULL || opt == NULL) - { - return NULL; - } - - // DHCPv4 Options - b = IPCBuildDhcpRequestOptions(ipc, opt); - if (b == NULL) - { - return NULL; - } - - // DHCPv4 Header - Zero(&dhcp, sizeof(dhcp)); - dhcp.OpCode = 1; - dhcp.HardwareType = ARP_HARDWARE_TYPE_ETHERNET; - dhcp.HardwareAddressSize = 6; - dhcp.Hops = 0; - dhcp.TransactionId = Endian32(tran_id); - dhcp.ClientIP = IPToUINT(&ipc->ClientIPAddress); - if (dhcp.ClientIP == 0) - { - dhcp.ClientIP = opt->ClientAddress; - } - Copy(dhcp.ClientMacAddress, ipc->MacAddress, 6); - - // UDP pseudo header - ph_size = b->Size + sizeof(dhcp) + blank_size + sizeof(UINT) + sizeof(UDPV4_PSEUDO_HEADER); - udp_size = b->Size + sizeof(dhcp) + blank_size + sizeof(UINT) + sizeof(UDP_HEADER); - - ph = ZeroMalloc(ph_size); - ph->SrcIP = IPToUINT(&ipc->ClientIPAddress); - ph->DstIP = IPToUINT(dest_ip); - ph->Protocol = IP_PROTO_UDP; - ph->PacketLength1 = Endian16(udp_size); - ph->SrcPort = Endian16(NAT_DHCP_CLIENT_PORT); - ph->DstPort = Endian16(NAT_DHCP_SERVER_PORT); - ph->PacketLength2 = Endian16(udp_size); - - Copy(((UCHAR *)(ph)) + sizeof(UDPV4_PSEUDO_HEADER), &dhcp, sizeof(dhcp)); - Copy(((UCHAR *)(ph)) + sizeof(UDPV4_PSEUDO_HEADER) + sizeof(dhcp) + blank_size, &magic_number, sizeof(UINT)); - Copy(((UCHAR *)(ph)) + sizeof(UDPV4_PSEUDO_HEADER) + sizeof(dhcp) + blank_size + sizeof(UINT), - b->Buf, b->Size); - - // UDP Header - udp = (UDP_HEADER *)(((UCHAR *)ph) + 12); - - // Calculate the checksum - checksum = IpChecksum(ph, ph_size); - if (checksum == 0x0000) - { - checksum = 0xffff; - } - udp->Checksum = checksum; - - // IP Header - Zero(&ip, sizeof(ip)); - IPV4_SET_VERSION(&ip, 4); - IPV4_SET_HEADER_LEN(&ip, 5); - ip.Identification = Rand16(); - ip.TimeToLive = 128; - ip.Protocol = IP_PROTO_UDP; - ip.SrcIP = IPToUINT(&ipc->ClientIPAddress); - if (dest_ip != NULL) - { - ip.DstIP = IPToUINT(dest_ip); - } - else - { - ip.DstIP = Endian32(0xffffffff); - } - ip.TotalLength = Endian16((USHORT)(sizeof(IPV4_HEADER) + udp_size)); - ip.Checksum = IpChecksum(&ip, sizeof(IPV4_HEADER)); - - ret = NewBuf(); - - WriteBuf(ret, &ip, sizeof(IPV4_HEADER)); - WriteBuf(ret, udp, udp_size); - - FreeBuf(b); - Free(ph); - - return ret; -} - -// Build a option data in the DHCP request packet -BUF *IPCBuildDhcpRequestOptions(IPC *ipc, DHCP_OPTION_LIST *opt) -{ - LIST *o; - UCHAR opcode; - BUF *ret; - // Validate arguments - if (ipc == NULL || opt == NULL) - { - return NULL; - } - - o = NewListFast(NULL); - - // Opcode - opcode = opt->Opcode; - Add(o, NewDhcpOption(DHCP_ID_MESSAGE_TYPE, &opcode, sizeof(opcode))); - - // Server ID - if (opt->ServerAddress != 0) - { - Add(o, NewDhcpOption(DHCP_ID_SERVER_ADDRESS, &opt->ServerAddress, 4)); - } - - // Requested IP Address - if (opt->RequestedIp != 0) - { - Add(o, NewDhcpOption(DHCP_ID_REQUEST_IP_ADDRESS, &opt->RequestedIp, 4)); - } - - // Hostname - if (IsEmptyStr(opt->Hostname) == false) - { - UCHAR client_id[MAX_HOST_NAME_LEN + 32]; - UCHAR macstr[30]; - MacToStr(macstr, sizeof(macstr), ipc->MacAddress); - - Format(client_id, sizeof(client_id), "%s/%s", opt->Hostname, macstr); - - Add(o, NewDhcpOption(DHCP_ID_HOST_NAME, opt->Hostname, StrLen(opt->Hostname))); - Add(o, NewDhcpOption(DHCP_ID_CLIENT_ID, client_id, StrLen(client_id))); - } - else // Client MAC Address - { - UCHAR client_id[7]; - client_id[0] = ARP_HARDWARE_TYPE_ETHERNET; - Copy(client_id + 1, ipc->MacAddress, 6); - Add(o, NewDhcpOption(DHCP_ID_CLIENT_ID, client_id, sizeof(client_id))); - } - - // User Class - if (IsEmptyStr(opt->UserClass) == false) - { - Add(o, NewDhcpOption(DHCP_ID_USER_CLASS, opt->UserClass, StrLen(opt->UserClass))); - } - - // Vendor - Add(o, NewDhcpOption(DHCP_ID_VENDOR_ID, IPC_DHCP_VENDOR_ID, StrLen(IPC_DHCP_VENDOR_ID))); - - // Parameter Request List - if (opcode == DHCP_DISCOVER || opcode == DHCP_REQUEST || opcode == DHCP_INFORM) - { - UCHAR param_list[12]; - - param_list[0] = 1; - param_list[1] = 15; - param_list[2] = 3; - param_list[3] = 6; - param_list[4] = 44; - param_list[5] = 46; - param_list[6] = 47; - param_list[7] = 31; - param_list[8] = 33; - param_list[9] = 121; - param_list[10] = 249; - param_list[11] = 43; - - Add(o, NewDhcpOption(DHCP_ID_REQ_PARAM_LIST, param_list, sizeof(param_list))); - } - - ret = BuildDhcpOptionsBuf(o); - - FreeDhcpOptions(o); - - return ret; -} - -// Process the received ARP -void IPCProcessArp(IPC *ipc, BLOCK *b) -{ - UCHAR *dest_mac; - UCHAR *src_mac; - ARPV4_HEADER *arp; - UCHAR *sender_mac; - IP sender_ip; - UCHAR *target_mac; - IP target_ip; - // Validate arguments - if (ipc == NULL || b == NULL || b->Size < (14 + sizeof(ARPV4_HEADER))) - { - return; - } - - dest_mac = b->Buf + 0; - src_mac = b->Buf + 6; - - arp = (ARPV4_HEADER *)(b->Buf + 14); - - if (arp->HardwareType != Endian16(ARP_HARDWARE_TYPE_ETHERNET)) - { - return; - } - if (arp->ProtocolType != Endian16(MAC_PROTO_IPV4)) - { - return; - } - if (arp->HardwareSize != 6 || arp->ProtocolSize != 4) - { - return; - } - - sender_mac = arp->SrcAddress; - UINTToIP(&sender_ip, arp->SrcIP); - - target_mac = arp->TargetAddress; - UINTToIP(&target_ip, arp->TargetIP); - - if (CmpIpAddr(&sender_ip, &ipc->ClientIPAddress) == 0) - { - // Source is myself - return; - } - - IPCAssociateOnArpTable(ipc, &sender_ip, sender_mac); - IPCAssociateOnArpTable(ipc, &target_ip, target_mac); - - if (Endian16(arp->Operation) == ARP_OPERATION_REQUEST) - { - // Received an ARP request - if (CmpIpAddr(&target_ip, &ipc->ClientIPAddress) == 0) - { - // Create a response since a request for its own IP address have received - if (IsMacUnicast(sender_mac)) - { - UCHAR tmp[14 + sizeof(ARPV4_HEADER)]; - ARPV4_HEADER *arp = (ARPV4_HEADER *)(tmp + 14); - - Copy(tmp + 0, sender_mac, 6); - Copy(tmp + 6, ipc->MacAddress, 6); - WRITE_USHORT(tmp + 12, MAC_PROTO_ARPV4); - - arp->HardwareType = Endian16(ARP_HARDWARE_TYPE_ETHERNET); - arp->ProtocolType = Endian16(MAC_PROTO_IPV4); - arp->HardwareSize = 6; - arp->ProtocolSize = 4; - arp->Operation = Endian16(ARP_OPERATION_RESPONSE); - - Copy(arp->SrcAddress, ipc->MacAddress, 6); - arp->SrcIP = IPToUINT(&ipc->ClientIPAddress); - - Copy(arp->TargetAddress, sender_mac, 6); - arp->TargetIP = IPToUINT(&sender_ip); - - IPCSendL2(ipc, tmp, sizeof(tmp)); - } - } - } -} - -// Associate the MAC address and IP address on the ARP table -void IPCAssociateOnArpTable(IPC *ipc, IP *ip, UCHAR *mac_address) -{ - IPC_ARP *a; - // Validate arguments - if (ipc == NULL || ip == NULL || IsValidUnicastIPAddress4(ip) == false || IsMacUnicast(mac_address) == false) - { - return; - } - if (CmpIpAddr(&ipc->ClientIPAddress, ip) == 0 || Cmp(ipc->MacAddress, mac_address, 6) == 0) - { - return; - } - if (IsInSameNetwork4(ip, &ipc->ClientIPAddress, &ipc->SubnetMask) == false) - { - // Not to learn the IP address of outside the subnet - return; - } - - if (CmpIpAddr(&ipc->BroadcastAddress, ip) == 0) - { - // Not to learn the broadcast IP address - return; - } - - // Search whether there is ARP table entry already - a = IPCSearchArpTable(ipc->ArpTable, ip); - if (a == NULL) - { - // Add to the ARP table - a = IPCNewARP(ip, mac_address); - - Insert(ipc->ArpTable, a); - } - else - { - Copy(a->MacAddress, mac_address, 6); - - // There is the ARP table entry already - if (a->Resolved == false) - { - a->Resolved = true; - a->GiveupTime = 0; - - // Send all the packets that are accumulated to be sent - while (true) - { - BLOCK *b = GetNext(a->PacketQueue); - - if (b == NULL) - { - break; - } - - IPCSendIPv4WithDestMacAddr(ipc, b->Buf, b->Size, a->MacAddress); - - FreeBlock(b); - } - } - - // Extend the expiration date - a->ExpireTime = Tick64() + (UINT64)IPC_ARP_LIFETIME; - } -} - -// Interrupt process (This is called periodically) -void IPCProcessInterrupts(IPC *ipc) -{ - // Validate arguments - if (ipc == NULL) - { - return; - } - - FlushTubeFlushList(ipc->FlushList); -} - -// Process the L3 event by the IPC -void IPCProcessL3Events(IPC *ipc) -{ - IPCProcessL3EventsEx(ipc, 0); -} -void IPCProcessL3EventsIPv4Only(IPC *ipc) -{ - UINT previousStatus4 = IPC_PROTO_GET_STATUS(ipc, IPv4State); - UINT previousStatus6 = IPC_PROTO_GET_STATUS(ipc, IPv6State); - IPC_PROTO_SET_STATUS(ipc, IPv4State, IPC_PROTO_STATUS_OPENED); - IPC_PROTO_SET_STATUS(ipc, IPv6State, IPC_PROTO_STATUS_CLOSED); - IPCProcessL3Events(ipc); - IPC_PROTO_SET_STATUS(ipc, IPv4State, previousStatus4); - IPC_PROTO_SET_STATUS(ipc, IPv6State, previousStatus6); -} -void IPCProcessL3EventsEx(IPC *ipc, UINT64 now) -{ - // Validate arguments - if (ipc == NULL) - { - return; - } - if (now == 0) - { - now = Tick64(); - } - - // Remove old ARP table entries - IPCFlushArpTableEx(ipc, now); - IPCIPv6FlushNDTEx(ipc, now); - - // Receive all the L2 packet - while (true) - { - BLOCK *b = IPCRecvL2(ipc); - if (b == NULL) - { - // All reception completed - break; - } - - if (b->Size >= 14) - { - UCHAR *dest_mac = b->Buf + 0; - UCHAR *src_mac = b->Buf + 6; - USHORT protocol = READ_USHORT(b->Buf + 12); - - // Confirm the destination MAC address - // (Receive if the destination MAC address is the IPC address or a broadcast address) - if (Cmp(dest_mac, ipc->MacAddress, 6) == 0 || IsMacBroadcast(dest_mac) || IsMacMulticast(dest_mac)) - { - // If the source MAC address is itselves or invalid address, ignore the packet - if (Cmp(src_mac, ipc->MacAddress, 6) != 0 && IsMacUnicast(src_mac)) - { - if (protocol == MAC_PROTO_ARPV4) - { - // ARP receiving process - IPCProcessArp(ipc, b); - } - else if (protocol == MAC_PROTO_IPV4) - { - // IPv4 receiving process - if (b->Size >= (14 + 20)) - { - UCHAR *data = Clone(b->Buf + 14, b->Size - 14); - UINT size = b->Size - 14; - IP ip_src, ip_dst; - bool ok = false; - - // Extract the IP address portion - UINTToIP(&ip_src, *((UINT *)(((UCHAR *)data) + 12))); - UINTToIP(&ip_dst, *((UINT *)(((UCHAR *)data) + 16))); - - // Receive only if the IPv4 destination address is its own - // or 255.255.255.255 or a multicast address or a broadcast address - if (CmpIpAddr(&ip_dst, &ipc->ClientIPAddress) == 0) - { - ok = true; - } - else if (ip_dst.addr[0] == 255 && ip_dst.addr[1] == 255 && - ip_dst.addr[2] == 255 && ip_dst.addr[3] == 255) - { - ok = true; - } - else if (ip_dst.addr[0] >= 224 && ip_dst.addr[0] <= 239) - { - ok = true; - } - else - { - if (CmpIpAddr(&ipc->BroadcastAddress, &ip_dst) == 0) - { - ok = true; - } - - if (IsZeroIP(&ipc->ClientIPAddress)) - { - // Client IP address is undetermined - ok = true; - } - } - - if (ok) - { - // Parse DHCP packets - bool packetConsumed = false; - if (ipc->DHCPv4Awaiter.IsAwaiting) - { - PKT *pkt; - DHCPV4_DATA *dhcp; - - Debug("Parsing for DHCP awaiter\n"); - pkt = ParsePacketIPv4WithDummyMacHeader(data, size); - dhcp = ParseDHCPv4Data(pkt); - - if (dhcp != NULL) - { - if (Endian32(dhcp->Header->TransactionId) == ipc->DHCPv4Awaiter.TransCode && - dhcp->OpCode == ipc->DHCPv4Awaiter.OpCode) - { - FreeDHCPv4Data(ipc->DHCPv4Awaiter.DhcpData); - ipc->DHCPv4Awaiter.DhcpData = dhcp; - packetConsumed = true; - } - else - { - FreeDHCPv4Data(dhcp); - } - } - - FreePacketWithData(pkt); - } - - IPCAssociateOnArpTable(ipc, &ip_src, src_mac); - - if (ipc->IPv4State == IPC_PROTO_STATUS_OPENED && !packetConsumed) - { - // Place in the reception queue - InsertQueue(ipc->IPv4ReceivedQueue, NewBlock(data, size, 0)); - } - else - { - Free(data); // We need to free the packet if we don't save it - } - - } - else - { - // This packet is discarded because it is irrelevant for me - Free(data); - } - } - } - else if (protocol == MAC_PROTO_IPV6) - { - PKT *p = ParsePacketUpToICMPv6(b->Buf, b->Size); - if (p != NULL) - { - IP ip_src, ip_dst; - bool ndtProcessed = false; - UINT size = b->Size - 14; - - UCHAR *data = Clone(b->Buf + 14, size); - - IPv6AddrToIP(&ip_src, &p->IPv6HeaderPacketInfo.IPv6Header->SrcAddress); - IPv6AddrToIP(&ip_dst, &p->IPv6HeaderPacketInfo.IPv6Header->DestAddress); - - if (p->IPv6HeaderPacketInfo.Protocol == IP_PROTO_ICMPV6) - { - IP icmpHeaderAddr; - // We need to parse the Router Advertisement and Neighbor Advertisement messages - // to build the Neighbor Discovery Table (aka ARP table for IPv6) - switch (p->ICMPv6HeaderPacketInfo.Type) - { - case ICMPV6_TYPE_ROUTER_ADVERTISEMENT: - // We save the router advertisement data for later use - IPCIPv6AddRouterPrefixes(ipc, &p->ICMPv6HeaderPacketInfo.OptionList, src_mac, &ip_src); - IPCIPv6AssociateOnNDTEx(ipc, &ip_src, src_mac, true); - IPCIPv6AssociateOnNDTEx(ipc, &ip_src, p->ICMPv6HeaderPacketInfo.OptionList.SourceLinkLayer->Address, true); - break; - case ICMPV6_TYPE_NEIGHBOR_ADVERTISEMENT: - // We save the neighbor advertisements into NDT - IPv6AddrToIP(&icmpHeaderAddr, &p->ICMPv6HeaderPacketInfo.Headers.NeighborAdvertisementHeader->TargetAddress); - IPCIPv6AssociateOnNDTEx(ipc, &icmpHeaderAddr, src_mac, true); - IPCIPv6AssociateOnNDTEx(ipc, &ip_src, src_mac, true); - ndtProcessed = true; - break; - } - } - - // We update the NDT only if we have an entry in it for the IP+Mac - if (!ndtProcessed) - { - IPCIPv6AssociateOnNDT(ipc, &ip_src, src_mac); - } - - /// TODO: should we or not filter Neighbor Advertisements and/or Neighbor Solicitations? - if (ipc->IPv6State == IPC_PROTO_STATUS_OPENED) - { - InsertQueue(ipc->IPv6ReceivedQueue, NewBlock(data, size, 0)); - } - else - { - Free(data); // We need to free the packet if we don't save it - } - - FreePacket(p); - } - } - } - } - } - - FreeBlock(b); - } - - IPCProcessInterrupts(ipc); -} - -// Configure IPv4 parameters -bool IPCSetIPv4Parameters(IPC *ipc, IP *ip, IP *subnet, IP *gw, DHCP_CLASSLESS_ROUTE_TABLE *rt) -{ - bool changed = false; - // Validate arguments - if (ipc == NULL || ip == NULL || subnet == NULL) - { - return false; - } - - if (CmpIpAddr(&ipc->ClientIPAddress, ip) != 0) - { - changed = true; - } - Copy(&ipc->ClientIPAddress, ip, sizeof(IP)); - - if (CmpIpAddr(&ipc->SubnetMask, subnet) != 0) - { - changed = true; - } - Copy(&ipc->SubnetMask, subnet, sizeof(IP)); - - if (gw != NULL) - { - if (CmpIpAddr(&ipc->DefaultGateway, gw) != 0) - { - changed = true; - } - - Copy(&ipc->DefaultGateway, gw, sizeof(IP)); - } - else - { - if (IsZeroIP(&ipc->DefaultGateway) == false) - { - changed = true; - } - - Zero(&ipc->DefaultGateway, sizeof(IP)); - } - - GetBroadcastAddress4(&ipc->BroadcastAddress, ip, subnet); - - if (rt != NULL && rt->NumExistingRoutes >= 1) - { - if (Cmp(&ipc->ClasslessRoute, rt, sizeof(DHCP_CLASSLESS_ROUTE_TABLE)) != 0) - { - changed = true; - - Copy(&ipc->ClasslessRoute, rt, sizeof(DHCP_CLASSLESS_ROUTE_TABLE)); - } - } - - return changed; -} - -// Send an IPv4 packet (client -> server) -void IPCSendIPv4(IPC *ipc, void *data, UINT size) -{ - IP ip_src, ip_dst; - IP ip_dst_local; - bool is_broadcast = false; - UCHAR uc; - DHCP_CLASSLESS_ROUTE *r = NULL; - // Validate arguments - if (ipc == NULL || data == NULL || size < 20 || size > 1500) - { - return; - } - - uc = ((UCHAR *)data)[0]; - if (((uc >> 4) & 0x0f) != 4) - { - // Not an IPv4 - return; - } - - // Extract the IP address portion - UINTToIP(&ip_src, *((UINT *)(((UCHAR *)data) + 12))); - UINTToIP(&ip_dst, *((UINT *)(((UCHAR *)data) + 16))); - - // Filter the source IP address - if (CmpIpAddr(&ip_src, &ipc->ClientIPAddress) != 0) - { - // Cut off packets from illegal IP address - return; - } - - if (IsZeroIP(&ip_dst)) - { - // Illegal destination address - return; - } - - if (CmpIpAddr(&ip_dst, &ipc->ClientIPAddress) == 0) - { - // Packet destined for myself - return; - } - - // Get the IP address of the relayed destination - Copy(&ip_dst_local, &ip_dst, sizeof(IP)); - - if (IsInSameNetwork4(&ip_dst, &ipc->ClientIPAddress, &ipc->SubnetMask) == false) - { - r = GetBestClasslessRoute(&ipc->ClasslessRoute, &ip_dst); - - if (r == NULL) - { - Copy(&ip_dst_local, &ipc->DefaultGateway, sizeof(IP)); - } - else - { - Copy(&ip_dst_local, &r->Gateway, sizeof(IP)); - } - } - - if (CmpIpAddr(&ipc->BroadcastAddress, &ip_dst) == 0) - { - // Local Broadcast - is_broadcast = true; - } - - if (ip_dst.addr[0] == 255 && ip_dst.addr[1] == 255 && ip_dst.addr[2] == 255 && ip_dst.addr[3] == 255) - { - // Global Broadcast - is_broadcast = true; - } - - if (ip_dst.addr[0] >= 224 && ip_dst.addr[0] <= 239) - { - // IPv4 Multicast - is_broadcast = true; - } - - if (is_broadcast) - { - // Send a broadcast packet - UCHAR dest[6]; - UINT i; - - // Destination - for (i = 0; i < 6; i++) - { - dest[i] = 0xff; - } - - // Send - IPCSendIPv4WithDestMacAddr(ipc, data, size, dest); - - return; - } - - if (IsZeroIP(&ip_dst_local)) - { - // Unable to send - return; - } - - // Send a unicast packet - IPCSendIPv4Unicast(ipc, data, size, &ip_dst_local); -} - -// Send an IPv4 packet with a specified destination MAC address -void IPCSendIPv4WithDestMacAddr(IPC *ipc, void *data, UINT size, UCHAR *dest_mac_addr) -{ - UCHAR tmp[1514]; - // Validate arguments - if (ipc == NULL || data == NULL || size < 20 || size > 1500 || dest_mac_addr == NULL) - { - return; - } - - // Destination - Copy(tmp + 0, dest_mac_addr, 6); - - // Source - Copy(tmp + 6, ipc->MacAddress, 6); - - // Protocol number - WRITE_USHORT(tmp + 12, MAC_PROTO_IPV4); - - // Data - Copy(tmp + 14, data, size); - - // Send - IPCSendL2(ipc, tmp, size + 14); -} - -// Remove old ARP table entries -void IPCFlushArpTable(IPC *ipc) -{ - IPCFlushArpTableEx(ipc, 0); -} -void IPCFlushArpTableEx(IPC *ipc, UINT64 now) -{ - UINT i; - LIST *o = NULL; - // Validate arguments - if (ipc == NULL) - { - return; - } - if (now == 0) - { - now = Tick64(); - } - - for (i = 0; i < LIST_NUM(ipc->ArpTable); i++) - { - IPC_ARP *a = LIST_DATA(ipc->ArpTable, i); - bool b = false; - - if (a->Resolved && a->ExpireTime <= now) - { - b = true; - } - else if (a->Resolved == false && a->GiveupTime <= now) - { - b = true; - } - - if (b) - { - if (o == NULL) - { - o = NewListFast(NULL); - } - - Add(o, a); - } - } - - if (o != NULL) - { - for (i = 0; i < LIST_NUM(o); i++) - { - IPC_ARP *a = LIST_DATA(o, i); - - IPCFreeARP(a); - - Delete(ipc->ArpTable, a); - } - - ReleaseList(o); - } -} - -// Send an IPv4 unicast packet -void IPCSendIPv4Unicast(IPC *ipc, void *data, UINT size, IP *next_ip) -{ - IPC_ARP *a; - // Validate arguments - if (ipc == NULL || data == NULL || size < 20 || size > 1500 || next_ip == NULL) - { - return; - } - - a = IPCSearchArpTable(ipc->ArpTable, next_ip); - - if (a != NULL) - { - // ARP entry is found - if (a->Resolved) - { - // Send - a->ExpireTime = Tick64() + (UINT64)IPC_ARP_LIFETIME; - - IPCSendIPv4WithDestMacAddr(ipc, data, size, a->MacAddress); - } - else - { - // Undeliverable because of unresolved table. Accumulate in the queue - if (a->PacketQueue->num_item < IPC_MAX_PACKET_QUEUE_LEN) - { - InsertQueue(a->PacketQueue, NewBlock(Clone(data, size), size, false)); - } - } - } - else - { - ARPV4_HEADER arp; - UCHAR tmp[14 + sizeof(ARPV4_HEADER)]; - UINT i; - - // Because there is no such ARP entry, create a new one - a = IPCNewARP(next_ip, NULL); - - // Send an ARP request - Zero(&arp, sizeof(arp)); - arp.HardwareType = Endian16(ARP_HARDWARE_TYPE_ETHERNET); - arp.ProtocolType = Endian16(MAC_PROTO_IPV4); - arp.HardwareSize = 6; - arp.ProtocolSize = 4; - arp.Operation = Endian16(ARP_OPERATION_REQUEST); - Copy(&arp.SrcAddress, &ipc->MacAddress, 6); - arp.SrcIP = IPToUINT(&ipc->ClientIPAddress); - arp.TargetIP = IPToUINT(next_ip); - - for (i = 0; i < 6; i++) - { - tmp[i] = 0xff; - } - - Copy(tmp + 6, ipc->MacAddress, 6); - - WRITE_USHORT(tmp + 12, MAC_PROTO_ARPV4); - Copy(tmp + 14, &arp, sizeof(ARPV4_HEADER)); - - IPCSendL2(ipc, tmp, 14 + sizeof(ARPV4_HEADER)); - - // Accumulate the IP packet to be transmitted in the queue - if (a->PacketQueue->num_item < IPC_MAX_PACKET_QUEUE_LEN) - { - InsertQueue(a->PacketQueue, NewBlock(Clone(data, size), size, false)); - } - - Insert(ipc->ArpTable, a); - } -} - -// Search the ARP table -IPC_ARP *IPCSearchArpTable(LIST *arpTable, IP *ip) -{ - IPC_ARP t; - IPC_ARP *a; - // Validate arguments - if (arpTable == NULL || ip == NULL) - { - return NULL; - } - - Copy(&t.Ip, ip, sizeof(IP)); - - a = Search(arpTable, &t); - - return a; -} - -// Release the ARP entry -void IPCFreeARP(IPC_ARP *a) -{ - BLOCK *b; - // Validate arguments - if (a == NULL) - { - return; - } - - while (true) - { - b = GetNext(a->PacketQueue); - if (b == NULL) - { - break; - } - - FreeBlock(b); - } - - ReleaseQueue(a->PacketQueue); - - Free(a); -} - -// Create a new ARP entry -IPC_ARP *IPCNewARP(IP *ip, UCHAR *mac_address) -{ - IPC_ARP *a; - // Validate arguments - if (ip == NULL) - { - return NULL; - } - - a = ZeroMalloc(sizeof(IPC_ARP)); - - Copy(&a->Ip, ip, sizeof(IP)); - if (mac_address != NULL) - { - Copy(a->MacAddress, mac_address, 6); - a->Resolved = true; - a->ExpireTime = Tick64() + (UINT64)IPC_ARP_LIFETIME; - } - else - { - a->GiveupTime = Tick64() + (UINT64)IPC_ARP_GIVEUPTIME; - } - - a->PacketQueue = NewQueueFast(); - - return a; -} - -// Compare ARP entries -int IPCCmpArpTable(void *p1, void *p2) -{ - IPC_ARP *a1, *a2; - // Validate arguments - if (p1 == NULL || p2 == NULL) - { - return 0; - } - a1 = *(IPC_ARP **)p1; - a2 = *(IPC_ARP **)p2; - if (a1 == NULL || a2 == NULL) - { - return 0; - } - - return CmpIpAddr(&a1->Ip, &a2->Ip); -} - -// Send an Ethernet packet (client -> server) -void IPCSendL2(IPC *ipc, void *data, UINT size) -{ - // Validate arguments - if (ipc == NULL || data == NULL || size == 0) - { - return; - } - - if (ipc->Sock == NULL) - { - return; - } - - TubeSendEx(ipc->Sock->SendTube, data, size, NULL, true); - AddTubeToFlushList(ipc->FlushList, ipc->Sock->SendTube); -} - -// Receive an IPv4 packet (server -> client) -BLOCK *IPCRecvIPv4(IPC *ipc) -{ - BLOCK *b; - // Validate arguments - if (ipc == NULL) - { - return NULL; - } - - b = GetNext(ipc->IPv4ReceivedQueue); - - return b; -} - -// Receive an Ethernet packet (server -> client) -BLOCK *IPCRecvL2(IPC *ipc) -{ - TUBEDATA *d; - BLOCK *b; - // Validate arguments - if (ipc == NULL) - { - return NULL; - } - - if (ipc->Sock == NULL) - { - return NULL; - } - - d = TubeRecvAsync(ipc->Sock->RecvTube); - - if (d == NULL) - { - return NULL; - } - - b = NewBlock(d->Data, d->DataSize, 0); - - Free(d->Header); - Free(d); - - return b; -} - -// IPv6 stuff -// Memory management -void IPCIPv6Init(IPC *ipc) -{ - ipc->IPv6ReceivedQueue = NewQueue(); - // The NDT is basically the same as ARP Table with some slight adjustments - ipc->IPv6NeighborTable = NewList(IPCCmpArpTable); - ipc->IPv6RouterAdvs = NewList(NULL); - - ipc->IPv6ClientEUI = 0; - ipc->IPv6ServerEUI = 0; - - ipc->IPv6State = IPC_PROTO_STATUS_CLOSED; -} -void IPCIPv6Free(IPC *ipc) -{ - UINT i; - for (i = 0; i < LIST_NUM(ipc->IPv6NeighborTable); i++) - { - IPC_ARP *a = LIST_DATA(ipc->IPv6NeighborTable, i); - IPCFreeARP(a); - } - - ReleaseList(ipc->IPv6NeighborTable); - - for (i = 0; i < LIST_NUM(ipc->IPv6RouterAdvs); i++) - { - IPC_IPV6_ROUTER_ADVERTISEMENT *ra = LIST_DATA(ipc->IPv6RouterAdvs, i); - Free(ra); - } - - ReleaseList(ipc->IPv6RouterAdvs); - - while (true) - { - BLOCK *b = GetNext(ipc->IPv6ReceivedQueue); - if (b == NULL) - { - break; - } - - FreeBlock(b); - } - - ReleaseQueue(ipc->IPv6ReceivedQueue); -} - -// NDT -void IPCIPv6AssociateOnNDT(IPC *ipc, IP *ip, UCHAR *mac_address) -{ - IPCIPv6AssociateOnNDTEx(ipc, ip, mac_address, false); -} -void IPCIPv6AssociateOnNDTEx(IPC *ipc, IP *ip, UCHAR *mac_address, bool isNeighborAdv) -{ - IPC_ARP *a; - UINT addrType = 0; - if (ipc == NULL || ip == NULL || - IsValidUnicastIPAddress6(ip) == false || - IsMacUnicast(mac_address) == false) - { - return; - } - - addrType = GetIPAddrType6(ip); - - if (addrType != IPV6_ADDR_LOCAL_UNICAST && - addrType != IPV6_ADDR_GLOBAL_UNICAST) - { - return; - } - - if (addrType == IPV6_ADDR_GLOBAL_UNICAST) - { - if (!IPCIPv6CheckUnicastFromRouterPrefix(ipc, ip, NULL)) - { - return; - } - } - - a = IPCSearchArpTable(ipc->IPv6NeighborTable, ip); - - // We create a new entry only if we got a neighbor advertisement - if (a == NULL && isNeighborAdv) - { - a = IPCNewARP(ip, mac_address); - Insert(ipc->IPv6NeighborTable, a); - } - else if (a == NULL) - { - // We skip the NDT association on random packets from unknown locations - return; - } - else - { - Copy(a->MacAddress, mac_address, 6); - - if (a->Resolved == false) - { - a->Resolved = true; - a->GiveupTime = 0; - while (true) - { - BLOCK *b = GetNext(a->PacketQueue); - - if (b == NULL) - { - break; - } - - IPCIPv6SendWithDestMacAddr(ipc, b->Buf, b->Size, a->MacAddress); - - FreeBlock(b); - } - } - - a->ExpireTime = Tick64() + (UINT64)IPC_IPV6_NDT_LIFETIME; - } -} - -void IPCIPv6FlushNDT(IPC *ipc) -{ - IPCIPv6FlushNDTEx(ipc, 0); -} -void IPCIPv6FlushNDTEx(IPC *ipc, UINT64 now) -{ - UINT i; - LIST *o = NULL; - // Validate arguments - if (ipc == NULL) - { - return; - } - if (now == 0) - { - now = Tick64(); - } - - for (i = 0; i < LIST_NUM(ipc->IPv6NeighborTable); i++) - { - IPC_ARP *a = LIST_DATA(ipc->IPv6NeighborTable, i); - bool b = false; - - if (a->Resolved && a->ExpireTime <= now) - { - b = true; - } - else if (a->Resolved == false && a->GiveupTime <= now) - { - b = true; - } - /// TODO: think about adding retransmission as per RFC4861 - - if (b) - { - if (o == NULL) - { - o = NewListFast(NULL); - } - - Add(o, a); - } - } - - if (o != NULL) - { - for (i = 0; i < LIST_NUM(o); i++) - { - IPC_ARP *a = LIST_DATA(o, i); - - IPCFreeARP(a); - - Delete(ipc->IPv6NeighborTable, a); - } - - ReleaseList(o); - } -} - -// Scan the hub IP Table to try to find the EUI-based link-local address -bool IPCIPv6CheckExistingLinkLocal(IPC *ipc, UINT64 eui) -{ - HUB t, *h; - IP_TABLE_ENTRY i, *e; - t.Name = ipc->HubName; - - // Construct link local from eui - ZeroIP6(&i.Ip); - i.Ip.ipv6_addr[0] = 0xFE; - i.Ip.ipv6_addr[1] = 0x80; - Copy(&i.Ip.ipv6_addr[8], &eui, sizeof(UINT64)); - - h = Search(ipc->Cedar->HubList, &t); - - if (h != NULL) - { - e = Search(h->IpTable, &i); - if (e != NULL) - { - return true; - } - } - - return false; -} - -// RA -void IPCIPv6AddRouterPrefixes(IPC *ipc, ICMPV6_OPTION_LIST *recvPrefix, UCHAR *macAddress, IP *ip) -{ - UINT i, j; - for (i = 0; i < ICMPV6_OPTION_PREFIXES_MAX_COUNT; i++) - { - if (recvPrefix->Prefix[i] != NULL) - { - bool foundPrefix = false; - for (j = 0; j < LIST_NUM(ipc->IPv6RouterAdvs); j++) - { - IPC_IPV6_ROUTER_ADVERTISEMENT *existingRA = LIST_DATA(ipc->IPv6RouterAdvs, j); - if (Cmp(&recvPrefix->Prefix[i]->Prefix, &existingRA->RoutedPrefix.ipv6_addr, sizeof(IPV6_ADDR)) == 0) - { - foundPrefix = true; - break; - } - } - - if (!foundPrefix) - { - IPC_IPV6_ROUTER_ADVERTISEMENT *newRA = Malloc(sizeof(IPC_IPV6_ROUTER_ADVERTISEMENT)); - IPv6AddrToIP(&newRA->RoutedPrefix, &recvPrefix->Prefix[i]->Prefix); - IntToSubnetMask6(&newRA->RoutedMask, recvPrefix->Prefix[i]->SubnetLength); - CopyIP(&newRA->RouterAddress, ip); - Copy(newRA->RouterMacAddress, macAddress, 6); - Copy(newRA->RouterLinkLayerAddress, recvPrefix->SourceLinkLayer->Address, 6); - Add(ipc->IPv6RouterAdvs, newRA); - } - } - else - { - break; - } - } -} - -bool IPCIPv6CheckUnicastFromRouterPrefix(IPC *ipc, IP *ip, IPC_IPV6_ROUTER_ADVERTISEMENT *matchedRA) -{ - UINT i; - IPC_IPV6_ROUTER_ADVERTISEMENT *matchingRA = NULL; - bool isInPrefix = false; - for (i = 0; i < LIST_NUM(ipc->IPv6RouterAdvs); i++) - { - IPC_IPV6_ROUTER_ADVERTISEMENT *ra = LIST_DATA(ipc->IPv6RouterAdvs, i); - isInPrefix = IsInSameNetwork6(ip, &ra->RoutedPrefix, &ra->RoutedMask); - if (isInPrefix) - { - matchingRA = ra; - break; - } - } - - if (matchedRA != NULL && matchingRA != NULL) - { - Copy(matchedRA, matchingRA, sizeof(IPC_IPV6_ROUTER_ADVERTISEMENT)); - } - - return isInPrefix; -} - -// Send router solicitation and then eventually populate the info from Router Advertisements -UINT64 IPCIPv6GetServerEui(IPC *ipc) -{ - // It is already configured, nothing to do here - if (ipc->IPv6ServerEUI != 0) - { - return ipc->IPv6ServerEUI; - } - - // If we don't have a valid client EUI, we can't generate a correct link local - if (ipc->IPv6ClientEUI == 0) - { - return ipc->IPv6ServerEUI; - } - - if (LIST_NUM(ipc->IPv6RouterAdvs) == 0) - { - IP destIP; - IPV6_ADDR destV6; - UCHAR destMacAddress[6]; - IPV6_ADDR linkLocal; - BUF *packet; - UINT64 giveup_time = Tick64() + (UINT64)(IPC_IPV6_RA_MAX_RETRIES * IPC_IPV6_RA_INTERVAL); - UINT64 timeout_retry = 0; - - Zero(&linkLocal, sizeof(IPV6_ADDR)); - - // Generate link local from client's EUI - linkLocal.Value[0] = 0xFE; - linkLocal.Value[1] = 0x80; - Copy(&linkLocal.Value[8], &ipc->IPv6ClientEUI, sizeof(UINT64)); - - GetAllRouterMulticastAddress6(&destIP); - - // Generate the MAC address from the multicast address - destMacAddress[0] = 0x33; - destMacAddress[1] = 0x33; - Copy(&destMacAddress[2], &destIP.ipv6_addr[12], sizeof(UINT)); - - IPToIPv6Addr(&destV6, &destIP); - - packet = BuildICMPv6RouterSoliciation(&linkLocal, &destV6, ipc->MacAddress, 0); - - while (LIST_NUM(ipc->IPv6RouterAdvs) == 0) - { - UINT64 now = Tick64(); - if (now >= timeout_retry) - { - timeout_retry = now + (UINT64)IPC_IPV6_RA_INTERVAL; - IPCIPv6SendWithDestMacAddr(ipc, packet->Buf, packet->Size, destMacAddress); - } - - AddInterrupt(ipc->Interrupt, timeout_retry); - - if (Tick64() >= giveup_time) - { - // We failed to receive any router advertisements - break; - } - - // The processing should populate the received RAs by itself - IPCProcessL3Events(ipc); - } - - FreeBuf(packet); - } - - // Populating the IPv6 Server EUI for IPV6CP - if (LIST_NUM(ipc->IPv6RouterAdvs) > 0) - { - IPC_IPV6_ROUTER_ADVERTISEMENT *ra = LIST_DATA(ipc->IPv6RouterAdvs, 0); - Copy(&ipc->IPv6ServerEUI, &ra->RouterAddress.ipv6_addr[8], sizeof(UINT64)); - } - - // If it is still not defined, let's just generate something random - while (ipc->IPv6ServerEUI == 0) - { - ipc->IPv6ServerEUI = Rand64(); - if (ipc->IPv6ClientEUI == ipc->IPv6ServerEUI) - { - ipc->IPv6ServerEUI = 0; - } - } - - return ipc->IPv6ServerEUI; -} - -// Data flow -BLOCK *IPCIPv6Recv(IPC *ipc) -{ - BLOCK *b; - // Validate arguments - if (ipc == NULL) - { - return NULL; - } - - b = GetNext(ipc->IPv6ReceivedQueue); - - return b; -} - -void IPCIPv6Send(IPC *ipc, void *data, UINT size) -{ - IP destAddr; - UINT ipv6Type; - UCHAR destMac[6]; - IPV6_HEADER *header = data; - - IPv6AddrToIP(&destAddr, &header->DestAddress); - - if (IsValidUnicastIPAddress6(&destAddr)) - { - IPCIPv6SendUnicast(ipc, data, size, &destAddr); - return; - } - - // Here we're probably dealing with a multicast packet. But let's check it anyway - ipv6Type = GetIPAddrType6(&destAddr); - if (ipv6Type & IPV6_ADDR_MULTICAST) - { - // Constructing multicast MAC address based on destination IP address, then just fire and forget - destMac[0] = 0x33; - destMac[1] = 0x33; - destMac[2] = destAddr.ipv6_addr[12]; - destMac[3] = destAddr.ipv6_addr[13]; - destMac[4] = destAddr.ipv6_addr[14]; - destMac[5] = destAddr.ipv6_addr[15]; - IPCIPv6SendWithDestMacAddr(ipc, data, size, destMac); - return; - } - else - { - Debug("We got a weird packet with a weird type! %i\n", ipv6Type); - } -} - -void IPCIPv6SendWithDestMacAddr(IPC *ipc, void *data, UINT size, UCHAR *dest_mac_addr) -{ - UCHAR tmp[1514]; - - IPV6_HEADER *header = data; - - - // Validate arguments - if (ipc == NULL || data == NULL || size < 40 || size > 1500 || dest_mac_addr == NULL) - { - return; - } - - // Destination - Copy(tmp + 0, dest_mac_addr, 6); - - // Source - Copy(tmp + 6, ipc->MacAddress, 6); - - // Protocol number - WRITE_USHORT(tmp + 12, MAC_PROTO_IPV6); - - // Data - Copy(tmp + 14, data, size); - - // Parse the packet for ND ICMPv6 fixup - if (header->NextHeader == IP_PROTO_ICMPV6) - { - PKT *p = ParsePacketUpToICMPv6(tmp, size + 14); - if (p != NULL) - { - ICMPV6_OPTION_LINK_LAYER linkLayer; - BUF *buf; - BUF *optBuf; - BUF *packet; - // We need to rebuild the packet to - switch (p->ICMPv6HeaderPacketInfo.Type) - { - case ICMPV6_TYPE_NEIGHBOR_SOLICIATION: - if (p->ICMPv6HeaderPacketInfo.OptionList.SourceLinkLayer == NULL) - { - p->ICMPv6HeaderPacketInfo.OptionList.SourceLinkLayer = &linkLayer; - } - Copy(p->ICMPv6HeaderPacketInfo.OptionList.SourceLinkLayer->Address, ipc->MacAddress, 6); - break; - case ICMPV6_TYPE_NEIGHBOR_ADVERTISEMENT: - if (p->ICMPv6HeaderPacketInfo.OptionList.TargetLinkLayer == NULL) - { - p->ICMPv6HeaderPacketInfo.OptionList.TargetLinkLayer = &linkLayer; - } - Copy(p->ICMPv6HeaderPacketInfo.OptionList.TargetLinkLayer->Address, ipc->MacAddress, 6); - break; - } - switch (p->ICMPv6HeaderPacketInfo.Type) - { - case ICMPV6_TYPE_NEIGHBOR_SOLICIATION: - case ICMPV6_TYPE_NEIGHBOR_ADVERTISEMENT: - optBuf = BuildICMPv6Options(&p->ICMPv6HeaderPacketInfo.OptionList); - buf = NewBuf(); - WriteBuf(buf, p->ICMPv6HeaderPacketInfo.Headers.HeaderPointer, - p->ICMPv6HeaderPacketInfo.Type == ICMPV6_TYPE_NEIGHBOR_SOLICIATION ? sizeof(ICMPV6_NEIGHBOR_SOLICIATION_HEADER) : sizeof(ICMPV6_NEIGHBOR_ADVERTISEMENT_HEADER)); - WriteBufBuf(buf, optBuf); - packet = BuildICMPv6(&p->IPv6HeaderPacketInfo.IPv6Header->SrcAddress, - &p->IPv6HeaderPacketInfo.IPv6Header->DestAddress, - p->IPv6HeaderPacketInfo.IPv6Header->HopLimit, - p->ICMPv6HeaderPacketInfo.Type, - p->ICMPv6HeaderPacketInfo.Code, - buf->Buf, - buf->Size, - 0); - Copy(tmp + 14, packet->Buf, packet->Size); - size = packet->Size; - FreeBuf(optBuf); - FreeBuf(buf); - FreeBuf(packet); - break; - } - } - FreePacket(p); - } - - // Send - IPCSendL2(ipc, tmp, size + 14); -} - -void IPCIPv6SendUnicast(IPC *ipc, void *data, UINT size, IP *next_ip) -{ - IPC_ARP *ndtMatch; - UCHAR *destMac = NULL; - IPC_IPV6_ROUTER_ADVERTISEMENT ra; - IPV6_HEADER *header = data; - IP srcIp; - bool isLocal = false; - // First we need to understand if it is a local packet or we should route it through the router - UINT addrType = GetIPAddrType6(next_ip); - - Zero(&ra, sizeof(IPC_IPV6_ROUTER_ADVERTISEMENT)); - IPv6AddrToIP(&srcIp, &header->SrcAddress); - - // Link local is always local =) - if (addrType & IPV6_ADDR_LOCAL_UNICAST) - { - isLocal = true; - } - - // If it matches any received prefix from router advertisements, it's also local - if (!isLocal && IPCIPv6CheckUnicastFromRouterPrefix(ipc, next_ip, &ra)) - { - isLocal = true; - } - - // If it is a global packet, we need to get our source IP prefix to know through which router shall we route - if (!isLocal) - { - if (!IPCIPv6CheckUnicastFromRouterPrefix(ipc, &srcIp, &ra)) - { - // If we didn't find a router for the source IP, let's just try to pick the first router and try to send to it - if (LIST_NUM(ipc->IPv6RouterAdvs) > 0) - { - Copy(&ra, LIST_DATA(ipc->IPv6RouterAdvs, 0), sizeof(IPC_IPV6_ROUTER_ADVERTISEMENT)); - } - else - { - char tmp[MAX_SIZE]; - IPToStr6(tmp, MAX_SIZE, &srcIp); - Debug("We couldn't find a router for the source address of %s! Trying as local.\n", tmp); - isLocal = true; - } - } - - destMac = ra.RouterMacAddress; - if (!IsMacUnicast(destMac) && !IsMacInvalid(ra.RouterMacAddress)) - { - destMac = ra.RouterLinkLayerAddress; - } - } - - // If it is local it should be routed directly through the NDT - if (isLocal) - { - ndtMatch = IPCSearchArpTable(ipc->IPv6NeighborTable, next_ip); - if (ndtMatch == NULL) - { - // Creating a non-matched NDT entry - ndtMatch = IPCNewARP(next_ip, NULL); - Add(ipc->IPv6NeighborTable, ndtMatch); - } - - if (ndtMatch->Resolved != true && LIST_NUM(ipc->IPv6RouterAdvs) > 0) - { - // First try to look up in router advertisements - UINT i; - for (i = 0; i < LIST_NUM(ipc->IPv6RouterAdvs); i++) - { - IPC_IPV6_ROUTER_ADVERTISEMENT *ra = LIST_DATA(ipc->IPv6RouterAdvs, i); - if (CmpIpAddr(next_ip, &ra->RouterAddress) == 0) - { - Copy(ndtMatch->MacAddress, IsMacUnicast(ra->RouterLinkLayerAddress) ? ra->RouterLinkLayerAddress : ra->RouterMacAddress, 6); - ndtMatch->Resolved = true; - break; - } - } - } - - if (ndtMatch->Resolved != true) - { - // We need to send the Neighbor Solicitation and save the packet for sending later - // Generate the MAC address from the multicast address - BUF *neighborSolicit; - UCHAR destMacAddress[6]; - IPV6_ADDR solicitAddress; - - char tmp[MAX_SIZE]; - UCHAR *copy; - BLOCK *blk; - - Zero(&solicitAddress, sizeof(IPV6_ADDR)); - Copy(&solicitAddress.Value[13], &header->DestAddress.Value[13], 3); - solicitAddress.Value[0] = 0xFF; - solicitAddress.Value[1] = 0x02; - solicitAddress.Value[11] = 0x01; - solicitAddress.Value[12] = 0xFF; - - neighborSolicit = BuildICMPv6NeighborSoliciation(&header->SrcAddress, &solicitAddress, ipc->MacAddress, 0); - destMacAddress[0] = 0x33; - destMacAddress[1] = 0x33; - Copy(&destMacAddress[2], &solicitAddress.Value[12], sizeof(UINT)); - IPCIPv6SendWithDestMacAddr(ipc, neighborSolicit->Buf, neighborSolicit->Size, destMacAddress); - - FreeBuf(neighborSolicit); - - - copy = Clone(data, size); - blk = NewBlock(copy, size, 0); - InsertQueue(ndtMatch->PacketQueue, blk); - IPToStr6(tmp, MAX_SIZE, next_ip); - - return; - } - destMac = ndtMatch->MacAddress; - } - - if (destMac != NULL && !IsMacInvalid(destMac)) - { - IPCIPv6SendWithDestMacAddr(ipc, data, size, destMac); - } - else - { - char tmp[MAX_SIZE]; - IPToStr6(tmp, MAX_SIZE, next_ip); - Debug("We couldn't deduce the MAC address for unicast address %s, packet dropped.\n", tmp); - /// TODO: think about sending to the all routers broadcast MAC as a last resort - } -} +// SoftEther VPN Source Code - Developer Edition Master Branch +// Cedar Communication Module + + +// IPC.c +// In-process VPN client module + +#include "CedarPch.h" + +// Extract the MS-CHAP v2 authentication information by parsing the password string +bool ParseAndExtractMsChapV2InfoFromPassword(IPC_MSCHAP_V2_AUTHINFO *d, char *password) +{ + TOKEN_LIST *t; + bool ret = false; + // Validate arguments + if (d == NULL || password == NULL) + { + return false; + } + + Zero(d, sizeof(IPC_MSCHAP_V2_AUTHINFO)); + + if (StartWith(password, IPC_PASSWORD_MSCHAPV2_TAG) == false) + { + return false; + } + + t = ParseTokenWithNullStr(password, ":"); + + if (t->NumTokens == 6) + { + BUF *b1, *b2, *b3, *b4; + + b1 = StrToBin(t->Token[2]); + b2 = StrToBin(t->Token[3]); + b3 = StrToBin(t->Token[4]); + b4 = StrToBin(t->Token[5]); + + if (IsEmptyStr(t->Token[1]) == false && b1->Size == 16 && b2->Size == 16 && b3->Size == 24 + && b4->Size == 8) + { + UINT64 eap_client_ptr = 0; + + StrCpy(d->MsChapV2_PPPUsername, sizeof(d->MsChapV2_PPPUsername), t->Token[1]); + Copy(d->MsChapV2_ServerChallenge, b1->Buf, 16); + Copy(d->MsChapV2_ClientChallenge, b2->Buf, 16); + Copy(d->MsChapV2_ClientResponse, b3->Buf, 24); + Copy(&eap_client_ptr, b4->Buf, 8); + + d->MsChapV2_EapClient = (EAP_CLIENT *)eap_client_ptr; + + ret = true; + } + + FreeBuf(b1); + FreeBuf(b2); + FreeBuf(b3); + FreeBuf(b4); + } + + FreeToken(t); + + return ret; +} + +// Start an IPC connection asynchronously +IPC_ASYNC *NewIPCAsync(CEDAR *cedar, IPC_PARAM *param, SOCK_EVENT *sock_event) +{ + IPC_ASYNC *a; + // Validate arguments + if (cedar == NULL || param == NULL) + { + return NULL; + } + + a = ZeroMalloc(sizeof(IPC_ASYNC)); + + a->TubeForDisconnect = NewTube(0); + + a->Cedar = cedar; + AddRef(a->Cedar->ref); + + Copy(&a->Param, param, sizeof(IPC_PARAM)); + + if (param->ClientCertificate != NULL) + { + // Client certificate must be copied for async processing + a->Param.ClientCertificate = CloneX(param->ClientCertificate); + } + + if (sock_event != NULL) + { + a->SockEvent = sock_event; + AddRef(a->SockEvent->ref); + } + + a->Thread = NewThread(IPCAsyncThreadProc, a); + + return a; +} + +// asynchronous IPC connection creation thread +void IPCAsyncThreadProc(THREAD *thread, void *param) +{ + IPC_ASYNC *a; + // Validate arguments + if (thread == NULL || param == NULL) + { + return; + } + + a = (IPC_ASYNC *)param; + + // Attempt to connect + a->Ipc = NewIPCByParam(a->Cedar, &a->Param, &a->ErrorCode); + + if (a->Ipc != NULL) + { + if (a->Param.IsL3Mode) + { + DHCP_OPTION_LIST cao; + + Zero(&cao, sizeof(cao)); + + // Get an IP address from the DHCP server in the case of L3 mode + Debug("IPCDhcpAllocateIP() start...\n"); + if (IPCDhcpAllocateIP(a->Ipc, &cao, a->TubeForDisconnect)) + { + UINT t; + IP ip, subnet, gw; + + Debug("IPCDhcpAllocateIP() Ok.\n"); + + // Calculate the DHCP update interval + t = cao.LeaseTime; + if (t == 0) + { + t = 600; + } + + t = t / 3; + + if (t == 0) + { + t = 1; + } + + // Save the options list + Copy(&a->L3ClientAddressOption, &cao, sizeof(DHCP_OPTION_LIST)); + a->L3DhcpRenewInterval = (UINT64)t * (UINT64)1000; + + // Set the obtained IP address parameters to the IPC virtual host + UINTToIP(&ip, cao.ClientAddress); + UINTToIP(&subnet, cao.SubnetMask); + UINTToIP(&gw, cao.Gateway); + + IPCSetIPv4Parameters(a->Ipc, &ip, &subnet, &gw, &cao.ClasslessRoute); + + a->L3NextDhcpRenewTick = Tick64() + a->L3DhcpRenewInterval; + } + else + { + Debug("IPCDhcpAllocateIP() Error.\n"); + + a->DhcpAllocFailed = true; + + FreeIPC(a->Ipc); + a->Ipc = NULL; + } + } + } + + // Procedure complete + a->Done = true; + + if (a->SockEvent != NULL) + { + SetSockEvent(a->SockEvent); + } +} + +// Release the IPC asynchronous connection object +void FreeIPCAsync(IPC_ASYNC *a) +{ + // Validate arguments + if (a == NULL) + { + return; + } + + TubeDisconnect(a->TubeForDisconnect); + WaitThread(a->Thread, INFINITE); + ReleaseThread(a->Thread); + + if (a->Ipc != NULL) + { + FreeIPC(a->Ipc); + a->Ipc = NULL; + } + + if (a->SockEvent != NULL) + { + ReleaseSockEvent(a->SockEvent); + } + + ReleaseCedar(a->Cedar); + + ReleaseTube(a->TubeForDisconnect); + + if (a->Param.ClientCertificate != NULL) + { + FreeX(a->Param.ClientCertificate); + } + + Free(a); +} + +// Start a new IPC connection by specifying the parameter structure +IPC *NewIPCByParam(CEDAR *cedar, IPC_PARAM *param, UINT *error_code) +{ + IPC *ipc; + // Validate arguments + if (cedar == NULL || param == NULL) + { + return NULL; + } + + ipc = NewIPC(cedar, param->ClientName, param->Postfix, param->HubName, + param->UserName, param->Password, error_code, ¶m->ClientIp, + param->ClientPort, ¶m->ServerIp, param->ServerPort, + param->ClientHostname, param->CryptName, + param->BridgeMode, param->Mss, NULL, param->ClientCertificate, param->Layer); + + return ipc; +} + +// Start a new IPC connection +IPC *NewIPC(CEDAR *cedar, char *client_name, char *postfix, char *hubname, char *username, char *password, + UINT *error_code, IP *client_ip, UINT client_port, IP *server_ip, UINT server_port, + char *client_hostname, char *crypt_name, + bool bridge_mode, UINT mss, EAP_CLIENT *eap_client, X *client_certificate, + UINT layer) +{ + IPC *ipc; + UINT dummy_int = 0; + SOCK *a; + SOCK *s; + PACK *p; + UINT err = ERR_INTERNAL_ERROR; + char server_str[MAX_SIZE]; + char macstr[30]; + UINT server_ver, server_build; + UCHAR unique[SHA1_SIZE]; + NODE_INFO info; + BUF *b; + UCHAR mschap_v2_server_response_20[20]; + UINT64 u64; + // Validate arguments + if (cedar == NULL || username == NULL || password == NULL || client_hostname == NULL) + { + return NULL; + } + if (IsEmptyStr(client_name)) + { + client_name = "InProc VPN Connection"; + } + if (IsEmptyStr(crypt_name)) + { + crypt_name = ""; + } + if (error_code == NULL) + { + error_code = &dummy_int; + } + + Zero(mschap_v2_server_response_20, sizeof(mschap_v2_server_response_20)); + + err = *error_code = ERR_INTERNAL_ERROR; + + a = GetInProcListeningSock(cedar); + if (a == NULL) + { + return NULL; + } + + ipc = ZeroMalloc(sizeof(IPC)); + + ipc->Cedar = cedar; + AddRef(cedar->ref); + + ipc->Layer = layer; + if (ipc->Layer == 0) + { + ipc->Layer = IPC_LAYER_2; + } + + ipc->FlushList = NewTubeFlushList(); + + StrCpy(ipc->ClientHostname, sizeof(ipc->ClientHostname), client_hostname); + StrCpy(ipc->HubName, sizeof(ipc->HubName), hubname); + StrCpy(ipc->UserName, sizeof(ipc->UserName), username); + StrCpy(ipc->Password, sizeof(ipc->Password), password); + + // Connect the in-process socket + s = ConnectInProc(a, client_ip, client_port, server_ip, server_port); + if (s == NULL) + { + goto LABEL_ERROR; + } + + // Protocol initialization process + if (ClientUploadSignature(s) == false) + { + err = ERR_DISCONNECTED; + goto LABEL_ERROR; + } + + p = HttpClientRecv(s); + if (p == NULL) + { + err = ERR_DISCONNECTED; + goto LABEL_ERROR; + } + + err = GetErrorFromPack(p); + if (err != ERR_NO_ERROR) + { + FreePack(p); + goto LABEL_ERROR; + } + + if (GetHello(p, ipc->random, &server_ver, &server_build, server_str, sizeof(server_str)) == false) + { + FreePack(p); + err = ERR_DISCONNECTED; + goto LABEL_ERROR; + } + + FreePack(p); + + // Upload the authentication data + if (client_certificate != NULL) + { + p = PackLoginWithOpenVPNCertificate(hubname, username, client_certificate); + } + else + { + p = PackLoginWithPlainPassword(hubname, username, password); + } + + if (p == NULL) + { + err = ERR_AUTH_FAILED; + goto LABEL_ERROR; + } + + PackAddStr(p, "hello", client_name); + PackAddInt(p, "client_ver", cedar->Version); + PackAddInt(p, "client_build", cedar->Build); + PackAddInt(p, "max_connection", 1); + PackAddInt(p, "use_encrypt", 0); + PackAddInt(p, "use_compress", 0); + PackAddInt(p, "half_connection", 0); + PackAddInt(p, "adjust_mss", mss); + PackAddBool(p, "require_bridge_routing_mode", bridge_mode); + PackAddBool(p, "require_monitor_mode", false); + PackAddBool(p, "qos", false); + + if (eap_client != NULL) + { + UINT64 ptr = (UINT64)eap_client; + PackAddInt64(p, "release_me_eap_client", ptr); + + AddRef(eap_client->Ref); + } + + // Unique ID is determined by the sum of the connecting client IP address and the client_name + b = NewBuf(); + WriteBuf(b, client_ip, sizeof(IP)); + WriteBufStr(b, client_name); + WriteBufStr(b, crypt_name); + + Sha1(unique, b->Buf, b->Size); + + FreeBuf(b); + + PackAddData(p, "unique_id", unique, SHA1_SIZE); + + PackAddStr(p, "inproc_postfix", postfix); + PackAddStr(p, "inproc_cryptname", crypt_name); + PackAddInt(p, "inproc_layer", ipc->Layer); + + // Node information + Zero(&info, sizeof(info)); + StrCpy(info.ClientProductName, sizeof(info.ClientProductName), client_name); + info.ClientProductVer = Endian32(cedar->Version); + info.ClientProductBuild = Endian32(cedar->Build); + StrCpy(info.ServerProductName, sizeof(info.ServerProductName), server_str); + info.ServerProductVer = Endian32(server_ver); + info.ServerProductBuild = Endian32(server_build); + StrCpy(info.ClientOsName, sizeof(info.ClientOsName), client_name); + StrCpy(info.ClientOsVer, sizeof(info.ClientOsVer), "-"); + StrCpy(info.ClientOsProductId, sizeof(info.ClientOsProductId), "-"); + info.ClientIpAddress = IPToUINT(&s->LocalIP); + info.ClientPort = Endian32(s->LocalPort); + StrCpy(info.ClientHostname, sizeof(info.ClientHostname), ipc->ClientHostname); + IPToStr(info.ServerHostname, sizeof(info.ServerHostname), &s->RemoteIP); + info.ServerIpAddress = IPToUINT(&s->RemoteIP); + info.ServerPort = Endian32(s->RemotePort); + StrCpy(info.HubName, sizeof(info.HubName), hubname); + Copy(info.UniqueId, unique, 16); + if (IsIP6(&s->LocalIP)) + { + Copy(info.ClientIpAddress6, s->LocalIP.ipv6_addr, 16); + } + if (IsIP6(&s->RemoteIP)) + { + Copy(info.ServerIpAddress6, s->RemoteIP.ipv6_addr, 16); + } + OutRpcNodeInfo(p, &info); + + if (HttpClientSend(s, p) == false) + { + FreePack(p); + err = ERR_DISCONNECTED; + goto LABEL_ERROR; + } + + FreePack(p); + + // Receive a Welcome packet + p = HttpClientRecv(s); + if (p == NULL) + { + err = ERR_DISCONNECTED; + goto LABEL_ERROR; + } + + err = GetErrorFromPack(p); + if (err != ERR_NO_ERROR) + { + FreePack(p); + goto LABEL_ERROR; + } + + if (ParseWelcomeFromPack(p, ipc->SessionName, sizeof(ipc->SessionName), + ipc->ConnectionName, sizeof(ipc->ConnectionName), &ipc->Policy) == false) + { + err = ERR_PROTOCOL_ERROR; + FreePack(p); + goto LABEL_ERROR; + } + + if (PackGetData2(p, "IpcMacAddress", ipc->MacAddress, 6) == false || IsZero(ipc->MacAddress, 6)) + { + err = ERR_PROTOCOL_ERROR; + FreePack(p); + goto LABEL_ERROR; + } + + if (PackGetData2(p, "IpcMsChapV2ServerResponse", mschap_v2_server_response_20, sizeof(mschap_v2_server_response_20))) + { + Copy(ipc->MsChapV2_ServerResponse, mschap_v2_server_response_20, sizeof(mschap_v2_server_response_20)); + } + + PackGetStr(p, "IpcHubName", ipc->HubName, sizeof(ipc->HubName)); + Debug("IPC Hub Name: %s\n", ipc->HubName); + + MacToStr(macstr, sizeof(macstr), ipc->MacAddress); + + Debug("IPC: Session = %s, Connection = %s, Mac = %s\n", ipc->SessionName, ipc->ConnectionName, macstr); + + u64 = PackGetInt64(p, "IpcSessionSharedBuffer"); + ipc->IpcSessionSharedBuffer = (SHARED_BUFFER *)u64; + ipc->IpcSessionShared = ipc->IpcSessionSharedBuffer->Data; + + FreePack(p); + + ReleaseSock(a); + ipc->Sock = s; + + Debug("NewIPC() Succeed.\n"); + + ipc->Interrupt = NewInterruptManager(); + + // Create an ARP table + ipc->ArpTable = NewList(IPCCmpArpTable); + + // Create an IPv4 reception queue + ipc->IPv4ReceivedQueue = NewQueue(); + ipc->IPv4State = IPC_PROTO_STATUS_CLOSED; + + ipc->DHCPv4Awaiter.IsAwaiting = false; + ipc->DHCPv4Awaiter.DhcpData = NULL; + + IPCIPv6Init(ipc); + + return ipc; + +LABEL_ERROR: + Debug("NewIPC() Failed: Err = %u\n", err); + Disconnect(s); + ReleaseSock(s); + ReleaseSock(a); + FreeIPC(ipc); + *error_code = err; + return NULL; +} + +// Create a new IPC based on SOCK +IPC *NewIPCBySock(CEDAR *cedar, SOCK *s, void *mac_address) +{ + IPC *ipc; + // Validate arguments + if (cedar == NULL || mac_address == NULL || s == NULL) + { + return NULL; + } + + ipc = ZeroMalloc(sizeof(IPC)); + + ipc->Cedar = cedar; + AddRef(cedar->ref); + + ipc->Sock = s; + AddRef(s->ref); + + Copy(ipc->MacAddress, mac_address, 6); + + ipc->Interrupt = NewInterruptManager(); + + // Create an ARP table + ipc->ArpTable = NewList(IPCCmpArpTable); + + // Create an IPv4 reception queue + ipc->IPv4ReceivedQueue = NewQueue(); + ipc->IPv4State = IPC_PROTO_STATUS_CLOSED; + + ipc->DHCPv4Awaiter.IsAwaiting = false; + ipc->DHCPv4Awaiter.DhcpData = NULL; + + ipc->FlushList = NewTubeFlushList(); + + IPCIPv6Init(ipc); + + return ipc; +} + +// Get whether the IPC is connected +bool IsIPCConnected(IPC *ipc) +{ + // Validate arguments + if (ipc == NULL) + { + return false; + } + + if (IsTubeConnected(ipc->Sock->RecvTube) == false || IsTubeConnected(ipc->Sock->SendTube) == false) + { + return false; + } + + return true; +} + +// Get to hit the SOCK_EVENT when a new data has arrived in the IPC +void IPCSetSockEventWhenRecvL2Packet(IPC *ipc, SOCK_EVENT *e) +{ + // Validate arguments + if (ipc == NULL || e == NULL) + { + return; + } + + JoinSockToSockEvent(ipc->Sock, e); +} + +// End of IPC connection +void FreeIPC(IPC *ipc) +{ + UINT i; + // Validate arguments + if (ipc == NULL) + { + return; + } + + FreeTubeFlushList(ipc->FlushList); + + Disconnect(ipc->Sock); + ReleaseSock(ipc->Sock); + + if (ipc->Policy != NULL) + { + Free(ipc->Policy); + } + + ReleaseCedar(ipc->Cedar); + + FreeInterruptManager(ipc->Interrupt); + + for (i = 0; i < LIST_NUM(ipc->ArpTable); i++) + { + IPC_ARP *a = LIST_DATA(ipc->ArpTable, i); + IPCFreeARP(a); + } + + ReleaseList(ipc->ArpTable); + + while (true) + { + BLOCK *b = GetNext(ipc->IPv4ReceivedQueue); + if (b == NULL) + { + break; + } + + FreeBlock(b); + } + + ReleaseQueue(ipc->IPv4ReceivedQueue); + + ReleaseSharedBuffer(ipc->IpcSessionSharedBuffer); + + FreeDHCPv4Data(ipc->DHCPv4Awaiter.DhcpData); + + IPCIPv6Free(ipc); + + Free(ipc); +} + +// Set User Class option if corresponding Virtual Hub optin is set +void IPCDhcpSetConditionalUserClass(IPC *ipc, DHCP_OPTION_LIST *req) +{ + HUB *hub; + + hub = GetHub(ipc->Cedar, ipc->HubName); + if (hub == NULL) + { + return; + } + + if (hub->Option && hub->Option->UseHubNameAsDhcpUserClassOption) + { + StrCpy(req->UserClass, sizeof(req->UserClass), ipc->HubName); + } + ReleaseHub(hub); +} + +// Release the IP address from the DHCP server +void IPCDhcpFreeIP(IPC *ipc, IP *dhcp_server) +{ + DHCP_OPTION_LIST req; + UINT tran_id = Rand32(); + // Validate arguments + if (ipc == NULL || dhcp_server == NULL) + { + return; + } + + Zero(&req, sizeof(req)); + req.Opcode = DHCP_RELEASE; + req.ServerAddress = IPToUINT(dhcp_server); + IPCDhcpSetConditionalUserClass(ipc, &req); + + FreeDHCPv4Data(IPCSendDhcpRequest(ipc, NULL, tran_id, &req, 0, 0, NULL)); +} + +// Update the IP address using the DHCP +void IPCDhcpRenewIP(IPC *ipc, IP *dhcp_server) +{ + DHCP_OPTION_LIST req; + UINT tran_id = Rand32(); + // Validate arguments + if (ipc == NULL || dhcp_server == NULL) + { + return; + } + + // Send a DHCP Request + Zero(&req, sizeof(req)); + req.Opcode = DHCP_REQUEST; + StrCpy(req.Hostname, sizeof(req.Hostname), ipc->ClientHostname); + req.RequestedIp = IPToUINT(&ipc->ClientIPAddress); + IPCDhcpSetConditionalUserClass(ipc, &req); + + FreeDHCPv4Data(IPCSendDhcpRequest(ipc, dhcp_server, tran_id, &req, 0, 0, NULL)); +} + +// Get the information other than the IP address with using DHCP +bool IPCDhcpRequestInformIP(IPC *ipc, DHCP_OPTION_LIST *opt, TUBE *discon_poll_tube, IP *client_ip) +{ + DHCP_OPTION_LIST req; + DHCPV4_DATA *d; + UINT tran_id = Rand32(); + bool ok; + // Validate arguments + if (ipc == NULL || opt == NULL || client_ip == NULL) + { + return false; + } + + // Send a DHCP Inform + Zero(&req, sizeof(req)); + req.Opcode = DHCP_INFORM; + req.ClientAddress = IPToUINT(client_ip); + StrCpy(req.Hostname, sizeof(req.Hostname), ipc->ClientHostname); + IPCDhcpSetConditionalUserClass(ipc, &req); + + d = IPCSendDhcpRequest(ipc, NULL, tran_id, &req, DHCP_ACK, IPC_DHCP_TIMEOUT, discon_poll_tube); + if (d == NULL) + { + return false; + } + + // Analyze the DHCP Ack + ok = true; + if (d->ParsedOptionList->SubnetMask == 0) + { + ok = false; + } + + if (ok == false) + { + FreeDHCPv4Data(d); + return false; + } + + Copy(opt, d->ParsedOptionList, sizeof(DHCP_OPTION_LIST)); + + FreeDHCPv4Data(d); + + return true; +} + +// Make a request for IP addresses using DHCP +bool IPCDhcpAllocateIP(IPC *ipc, DHCP_OPTION_LIST *opt, TUBE *discon_poll_tube) +{ + DHCP_OPTION_LIST req; + DHCPV4_DATA *d, *d2; + UINT tran_id = Rand32(); + bool ok; + // Validate arguments + if (ipc == NULL || opt == NULL) + { + return false; + } + + // Send a DHCP Discover + Zero(&req, sizeof(req)); + req.RequestedIp = 0; + req.Opcode = DHCP_DISCOVER; + StrCpy(req.Hostname, sizeof(req.Hostname), ipc->ClientHostname); + IPCDhcpSetConditionalUserClass(ipc, &req); + + d = IPCSendDhcpRequest(ipc, NULL, tran_id, &req, DHCP_OFFER, IPC_DHCP_TIMEOUT, discon_poll_tube); + if (d == NULL) + { + return false; + } + + // Analyze the DHCP Offer + ok = true; + if (IsValidUnicastIPAddressUINT4(d->ParsedOptionList->ClientAddress) == false) + { + ok = false; + } + if (IsValidUnicastIPAddressUINT4(d->ParsedOptionList->ServerAddress) == false) + { + ok = false; + } + if (d->ParsedOptionList->SubnetMask == 0) + { + ok = false; + } + if (d->ParsedOptionList->LeaseTime == 0) + { + d->ParsedOptionList->LeaseTime = IPC_DHCP_DEFAULT_LEASE; + } + if (d->ParsedOptionList->LeaseTime <= IPC_DHCP_MIN_LEASE) + { + d->ParsedOptionList->LeaseTime = IPC_DHCP_MIN_LEASE; + } + + if (ok == false) + { + FreeDHCPv4Data(d); + return false; + } + + // Send a DHCP Request + Zero(&req, sizeof(req)); + req.Opcode = DHCP_REQUEST; + StrCpy(req.Hostname, sizeof(req.Hostname), ipc->ClientHostname); + req.ServerAddress = d->ParsedOptionList->ServerAddress; + req.RequestedIp = d->ParsedOptionList->ClientAddress; + IPCDhcpSetConditionalUserClass(ipc, &req); + + d2 = IPCSendDhcpRequest(ipc, NULL, tran_id, &req, DHCP_ACK, IPC_DHCP_TIMEOUT, discon_poll_tube); + if (d2 == NULL) + { + FreeDHCPv4Data(d); + return false; + } + + // Analyze the DHCP Ack + ok = true; + if (IsValidUnicastIPAddressUINT4(d2->ParsedOptionList->ClientAddress) == false) + { + ok = false; + } + if (IsValidUnicastIPAddressUINT4(d2->ParsedOptionList->ServerAddress) == false) + { + ok = false; + } + if (d2->ParsedOptionList->SubnetMask == 0) + { + ok = false; + } + if (d2->ParsedOptionList->LeaseTime == 0) + { + d2->ParsedOptionList->LeaseTime = IPC_DHCP_DEFAULT_LEASE; + } + if (d2->ParsedOptionList->LeaseTime <= IPC_DHCP_MIN_LEASE) + { + d2->ParsedOptionList->LeaseTime = IPC_DHCP_MIN_LEASE; + } + + if (ok == false) + { + FreeDHCPv4Data(d); + FreeDHCPv4Data(d2); + return false; + } + + Copy(opt, d2->ParsedOptionList, sizeof(DHCP_OPTION_LIST)); + + FreeDHCPv4Data(d); + FreeDHCPv4Data(d2); + + return true; +} + +// Send out a DHCP request, and wait for a corresponding response +DHCPV4_DATA *IPCSendDhcpRequest(IPC *ipc, IP *dest_ip, UINT tran_id, DHCP_OPTION_LIST *opt, UINT expecting_code, UINT timeout, TUBE *discon_poll_tube) +{ + UINT resend_interval; + UINT64 giveup_time; + UINT64 next_send_time = 0; + TUBE *tubes[3]; + UINT num_tubes = 0; + // Validate arguments + if (ipc == NULL || opt == NULL || (expecting_code != 0 && timeout == 0)) + { + return NULL; + } + + // Retransmission interval + resend_interval = MAX(1, (timeout / 3) - 100); + + // Time-out time + giveup_time = Tick64() + (UINT64)timeout; + + AddInterrupt(ipc->Interrupt, giveup_time); + + tubes[num_tubes++] = ipc->Sock->RecvTube; + tubes[num_tubes++] = ipc->Sock->SendTube; + + if (discon_poll_tube != NULL) + { + tubes[num_tubes++] = discon_poll_tube; + } + + while (true) + { + UINT64 now = Tick64(); + BUF *dhcp_packet; + + IPCFlushArpTable(ipc); + + // Time-out inspection + if ((expecting_code != 0) && (now >= giveup_time)) + { + ipc->DHCPv4Awaiter.IsAwaiting = false; + FreeDHCPv4Data(ipc->DHCPv4Awaiter.DhcpData); + ipc->DHCPv4Awaiter.DhcpData = NULL; + return NULL; + } + + // Send by building a DHCP packet periodically + if (next_send_time == 0 || next_send_time <= now) + { + dhcp_packet = IPCBuildDhcpRequest(ipc, dest_ip, tran_id, opt); + if (dhcp_packet == NULL) + { + ipc->DHCPv4Awaiter.IsAwaiting = false; + FreeDHCPv4Data(ipc->DHCPv4Awaiter.DhcpData); + ipc->DHCPv4Awaiter.DhcpData = NULL; + return NULL; + } + + IPCSendIPv4(ipc, dhcp_packet->Buf, dhcp_packet->Size); + + FreeBuf(dhcp_packet); + + if (expecting_code == 0) + { + ipc->DHCPv4Awaiter.IsAwaiting = false; + FreeDHCPv4Data(ipc->DHCPv4Awaiter.DhcpData); + ipc->DHCPv4Awaiter.DhcpData = NULL; + return NULL; + } + + next_send_time = now + (UINT64)resend_interval; + + AddInterrupt(ipc->Interrupt, next_send_time); + } + + // Happy processing + ipc->DHCPv4Awaiter.IsAwaiting = true; + FreeDHCPv4Data(ipc->DHCPv4Awaiter.DhcpData); + ipc->DHCPv4Awaiter.DhcpData = NULL; + ipc->DHCPv4Awaiter.TransCode = tran_id; + ipc->DHCPv4Awaiter.OpCode = expecting_code; + IPCProcessL3Events(ipc); + + if (ipc->DHCPv4Awaiter.DhcpData != NULL) + { + DHCPV4_DATA *dhcp = ipc->DHCPv4Awaiter.DhcpData; + ipc->DHCPv4Awaiter.IsAwaiting = false; + ipc->DHCPv4Awaiter.DhcpData = NULL; + return dhcp; + } + + if (IsTubeConnected(ipc->Sock->RecvTube) == false || IsTubeConnected(ipc->Sock->SendTube) == false || + (discon_poll_tube != NULL && IsTubeConnected(discon_poll_tube) == false)) + { + // Session is disconnected + ipc->DHCPv4Awaiter.IsAwaiting = false; + FreeDHCPv4Data(ipc->DHCPv4Awaiter.DhcpData); + ipc->DHCPv4Awaiter.DhcpData = NULL; + return NULL; + } + + // Keep the CPU waiting + WaitForTubes(tubes, num_tubes, GetNextIntervalForInterrupt(ipc->Interrupt)); + } + + ipc->DHCPv4Awaiter.IsAwaiting = false; + FreeDHCPv4Data(ipc->DHCPv4Awaiter.DhcpData); + ipc->DHCPv4Awaiter.DhcpData = NULL; + return NULL; +} + +// Build a DHCP request packet +BUF *IPCBuildDhcpRequest(IPC *ipc, IP *dest_ip, UINT tran_id, DHCP_OPTION_LIST *opt) +{ + IPV4_HEADER ip; + UDP_HEADER *udp; + DHCPV4_HEADER dhcp; + UINT blank_size = 128 + 64; + BUF *ret; + BUF *b; + UDPV4_PSEUDO_HEADER *ph; + UINT ph_size; + UINT udp_size; + UINT magic_number = Endian32(DHCP_MAGIC_COOKIE); + USHORT checksum; + // Validate arguments + if (ipc == NULL || opt == NULL) + { + return NULL; + } + + // DHCPv4 Options + b = IPCBuildDhcpRequestOptions(ipc, opt); + if (b == NULL) + { + return NULL; + } + + // DHCPv4 Header + Zero(&dhcp, sizeof(dhcp)); + dhcp.OpCode = 1; + dhcp.HardwareType = ARP_HARDWARE_TYPE_ETHERNET; + dhcp.HardwareAddressSize = 6; + dhcp.Hops = 0; + dhcp.TransactionId = Endian32(tran_id); + dhcp.ClientIP = IPToUINT(&ipc->ClientIPAddress); + if (dhcp.ClientIP == 0) + { + dhcp.ClientIP = opt->ClientAddress; + } + Copy(dhcp.ClientMacAddress, ipc->MacAddress, 6); + + // UDP pseudo header + ph_size = b->Size + sizeof(dhcp) + blank_size + sizeof(UINT) + sizeof(UDPV4_PSEUDO_HEADER); + udp_size = b->Size + sizeof(dhcp) + blank_size + sizeof(UINT) + sizeof(UDP_HEADER); + + ph = ZeroMalloc(ph_size); + ph->SrcIP = IPToUINT(&ipc->ClientIPAddress); + ph->DstIP = IPToUINT(dest_ip); + ph->Protocol = IP_PROTO_UDP; + ph->PacketLength1 = Endian16(udp_size); + ph->SrcPort = Endian16(NAT_DHCP_CLIENT_PORT); + ph->DstPort = Endian16(NAT_DHCP_SERVER_PORT); + ph->PacketLength2 = Endian16(udp_size); + + Copy(((UCHAR *)(ph)) + sizeof(UDPV4_PSEUDO_HEADER), &dhcp, sizeof(dhcp)); + Copy(((UCHAR *)(ph)) + sizeof(UDPV4_PSEUDO_HEADER) + sizeof(dhcp) + blank_size, &magic_number, sizeof(UINT)); + Copy(((UCHAR *)(ph)) + sizeof(UDPV4_PSEUDO_HEADER) + sizeof(dhcp) + blank_size + sizeof(UINT), + b->Buf, b->Size); + + // UDP Header + udp = (UDP_HEADER *)(((UCHAR *)ph) + 12); + + // Calculate the checksum + checksum = IpChecksum(ph, ph_size); + if (checksum == 0x0000) + { + checksum = 0xffff; + } + udp->Checksum = checksum; + + // IP Header + Zero(&ip, sizeof(ip)); + IPV4_SET_VERSION(&ip, 4); + IPV4_SET_HEADER_LEN(&ip, 5); + ip.Identification = Rand16(); + ip.TimeToLive = 128; + ip.Protocol = IP_PROTO_UDP; + ip.SrcIP = IPToUINT(&ipc->ClientIPAddress); + if (dest_ip != NULL) + { + ip.DstIP = IPToUINT(dest_ip); + } + else + { + ip.DstIP = Endian32(0xffffffff); + } + ip.TotalLength = Endian16((USHORT)(sizeof(IPV4_HEADER) + udp_size)); + ip.Checksum = IpChecksum(&ip, sizeof(IPV4_HEADER)); + + ret = NewBuf(); + + WriteBuf(ret, &ip, sizeof(IPV4_HEADER)); + WriteBuf(ret, udp, udp_size); + + FreeBuf(b); + Free(ph); + + return ret; +} + +// Build a option data in the DHCP request packet +BUF *IPCBuildDhcpRequestOptions(IPC *ipc, DHCP_OPTION_LIST *opt) +{ + LIST *o; + UCHAR opcode; + BUF *ret; + // Validate arguments + if (ipc == NULL || opt == NULL) + { + return NULL; + } + + o = NewListFast(NULL); + + // Opcode + opcode = opt->Opcode; + Add(o, NewDhcpOption(DHCP_ID_MESSAGE_TYPE, &opcode, sizeof(opcode))); + + // Server ID + if (opt->ServerAddress != 0) + { + Add(o, NewDhcpOption(DHCP_ID_SERVER_ADDRESS, &opt->ServerAddress, 4)); + } + + // Requested IP Address + if (opt->RequestedIp != 0) + { + Add(o, NewDhcpOption(DHCP_ID_REQUEST_IP_ADDRESS, &opt->RequestedIp, 4)); + } + + // Hostname + if (IsEmptyStr(opt->Hostname) == false) + { + UCHAR client_id[MAX_HOST_NAME_LEN + 32]; + UCHAR macstr[30]; + MacToStr(macstr, sizeof(macstr), ipc->MacAddress); + + Format(client_id, sizeof(client_id), "%s/%s", opt->Hostname, macstr); + + Add(o, NewDhcpOption(DHCP_ID_HOST_NAME, opt->Hostname, StrLen(opt->Hostname))); + Add(o, NewDhcpOption(DHCP_ID_CLIENT_ID, client_id, StrLen(client_id))); + } + else // Client MAC Address + { + UCHAR client_id[7]; + client_id[0] = ARP_HARDWARE_TYPE_ETHERNET; + Copy(client_id + 1, ipc->MacAddress, 6); + Add(o, NewDhcpOption(DHCP_ID_CLIENT_ID, client_id, sizeof(client_id))); + } + + // User Class + if (IsEmptyStr(opt->UserClass) == false) + { + Add(o, NewDhcpOption(DHCP_ID_USER_CLASS, opt->UserClass, StrLen(opt->UserClass))); + } + + // Vendor + Add(o, NewDhcpOption(DHCP_ID_VENDOR_ID, IPC_DHCP_VENDOR_ID, StrLen(IPC_DHCP_VENDOR_ID))); + + // Parameter Request List + if (opcode == DHCP_DISCOVER || opcode == DHCP_REQUEST || opcode == DHCP_INFORM) + { + UCHAR param_list[12]; + + param_list[0] = 1; + param_list[1] = 15; + param_list[2] = 3; + param_list[3] = 6; + param_list[4] = 44; + param_list[5] = 46; + param_list[6] = 47; + param_list[7] = 31; + param_list[8] = 33; + param_list[9] = 121; + param_list[10] = 249; + param_list[11] = 43; + + Add(o, NewDhcpOption(DHCP_ID_REQ_PARAM_LIST, param_list, sizeof(param_list))); + } + + ret = BuildDhcpOptionsBuf(o); + + FreeDhcpOptions(o); + + return ret; +} + +// Process the received ARP +void IPCProcessArp(IPC *ipc, BLOCK *b) +{ + UCHAR *dest_mac; + UCHAR *src_mac; + ARPV4_HEADER *arp; + UCHAR *sender_mac; + IP sender_ip; + UCHAR *target_mac; + IP target_ip; + // Validate arguments + if (ipc == NULL || b == NULL || b->Size < (14 + sizeof(ARPV4_HEADER))) + { + return; + } + + dest_mac = b->Buf + 0; + src_mac = b->Buf + 6; + + arp = (ARPV4_HEADER *)(b->Buf + 14); + + if (arp->HardwareType != Endian16(ARP_HARDWARE_TYPE_ETHERNET)) + { + return; + } + if (arp->ProtocolType != Endian16(MAC_PROTO_IPV4)) + { + return; + } + if (arp->HardwareSize != 6 || arp->ProtocolSize != 4) + { + return; + } + + sender_mac = arp->SrcAddress; + UINTToIP(&sender_ip, arp->SrcIP); + + target_mac = arp->TargetAddress; + UINTToIP(&target_ip, arp->TargetIP); + + if (CmpIpAddr(&sender_ip, &ipc->ClientIPAddress) == 0) + { + // Source is myself + return; + } + + IPCAssociateOnArpTable(ipc, &sender_ip, sender_mac); + IPCAssociateOnArpTable(ipc, &target_ip, target_mac); + + if (Endian16(arp->Operation) == ARP_OPERATION_REQUEST) + { + // Received an ARP request + if (CmpIpAddr(&target_ip, &ipc->ClientIPAddress) == 0) + { + // Create a response since a request for its own IP address have received + if (IsMacUnicast(sender_mac)) + { + UCHAR tmp[14 + sizeof(ARPV4_HEADER)]; + ARPV4_HEADER *arp = (ARPV4_HEADER *)(tmp + 14); + + Copy(tmp + 0, sender_mac, 6); + Copy(tmp + 6, ipc->MacAddress, 6); + WRITE_USHORT(tmp + 12, MAC_PROTO_ARPV4); + + arp->HardwareType = Endian16(ARP_HARDWARE_TYPE_ETHERNET); + arp->ProtocolType = Endian16(MAC_PROTO_IPV4); + arp->HardwareSize = 6; + arp->ProtocolSize = 4; + arp->Operation = Endian16(ARP_OPERATION_RESPONSE); + + Copy(arp->SrcAddress, ipc->MacAddress, 6); + arp->SrcIP = IPToUINT(&ipc->ClientIPAddress); + + Copy(arp->TargetAddress, sender_mac, 6); + arp->TargetIP = IPToUINT(&sender_ip); + + IPCSendL2(ipc, tmp, sizeof(tmp)); + } + } + } +} + +// Associate the MAC address and IP address on the ARP table +void IPCAssociateOnArpTable(IPC *ipc, IP *ip, UCHAR *mac_address) +{ + IPC_ARP *a; + // Validate arguments + if (ipc == NULL || ip == NULL || IsValidUnicastIPAddress4(ip) == false || IsMacUnicast(mac_address) == false) + { + return; + } + if (CmpIpAddr(&ipc->ClientIPAddress, ip) == 0 || Cmp(ipc->MacAddress, mac_address, 6) == 0) + { + return; + } + if (IsInSameNetwork4(ip, &ipc->ClientIPAddress, &ipc->SubnetMask) == false) + { + // Not to learn the IP address of outside the subnet + return; + } + + if (CmpIpAddr(&ipc->BroadcastAddress, ip) == 0) + { + // Not to learn the broadcast IP address + return; + } + + // Search whether there is ARP table entry already + a = IPCSearchArpTable(ipc->ArpTable, ip); + if (a == NULL) + { + // Add to the ARP table + a = IPCNewARP(ip, mac_address); + + Insert(ipc->ArpTable, a); + } + else + { + Copy(a->MacAddress, mac_address, 6); + + // There is the ARP table entry already + if (a->Resolved == false) + { + a->Resolved = true; + a->GiveupTime = 0; + + // Send all the packets that are accumulated to be sent + while (true) + { + BLOCK *b = GetNext(a->PacketQueue); + + if (b == NULL) + { + break; + } + + IPCSendIPv4WithDestMacAddr(ipc, b->Buf, b->Size, a->MacAddress); + + FreeBlock(b); + } + } + + // Extend the expiration date + a->ExpireTime = Tick64() + (UINT64)IPC_ARP_LIFETIME; + } +} + +// Interrupt process (This is called periodically) +void IPCProcessInterrupts(IPC *ipc) +{ + // Validate arguments + if (ipc == NULL) + { + return; + } + + FlushTubeFlushList(ipc->FlushList); +} + +// Process the L3 event by the IPC +void IPCProcessL3Events(IPC *ipc) +{ + IPCProcessL3EventsEx(ipc, 0); +} +void IPCProcessL3EventsIPv4Only(IPC *ipc) +{ + UINT previousStatus4 = IPC_PROTO_GET_STATUS(ipc, IPv4State); + UINT previousStatus6 = IPC_PROTO_GET_STATUS(ipc, IPv6State); + IPC_PROTO_SET_STATUS(ipc, IPv4State, IPC_PROTO_STATUS_OPENED); + IPC_PROTO_SET_STATUS(ipc, IPv6State, IPC_PROTO_STATUS_CLOSED); + IPCProcessL3Events(ipc); + IPC_PROTO_SET_STATUS(ipc, IPv4State, previousStatus4); + IPC_PROTO_SET_STATUS(ipc, IPv6State, previousStatus6); +} +void IPCProcessL3EventsEx(IPC *ipc, UINT64 now) +{ + // Validate arguments + if (ipc == NULL) + { + return; + } + if (now == 0) + { + now = Tick64(); + } + + // Remove old ARP table entries + IPCFlushArpTableEx(ipc, now); + IPCIPv6FlushNDTEx(ipc, now); + + // Receive all the L2 packet + while (true) + { + BLOCK *b = IPCRecvL2(ipc); + if (b == NULL) + { + // All reception completed + break; + } + + if (b->Size >= 14) + { + UCHAR *dest_mac = b->Buf + 0; + UCHAR *src_mac = b->Buf + 6; + USHORT protocol = READ_USHORT(b->Buf + 12); + + // Confirm the destination MAC address + // (Receive if the destination MAC address is the IPC address or a broadcast address) + if (Cmp(dest_mac, ipc->MacAddress, 6) == 0 || IsMacBroadcast(dest_mac) || IsMacMulticast(dest_mac)) + { + // If the source MAC address is itselves or invalid address, ignore the packet + if (Cmp(src_mac, ipc->MacAddress, 6) != 0 && IsMacUnicast(src_mac)) + { + if (protocol == MAC_PROTO_ARPV4) + { + // ARP receiving process + IPCProcessArp(ipc, b); + } + else if (protocol == MAC_PROTO_IPV4) + { + // IPv4 receiving process + if (b->Size >= (14 + 20)) + { + UCHAR *data = Clone(b->Buf + 14, b->Size - 14); + UINT size = b->Size - 14; + IP ip_src, ip_dst; + bool ok = false; + + // Extract the IP address portion + UINTToIP(&ip_src, *((UINT *)(((UCHAR *)data) + 12))); + UINTToIP(&ip_dst, *((UINT *)(((UCHAR *)data) + 16))); + + // Receive only if the IPv4 destination address is its own + // or 255.255.255.255 or a multicast address or a broadcast address + if (CmpIpAddr(&ip_dst, &ipc->ClientIPAddress) == 0) + { + ok = true; + } + else if (ip_dst.addr[0] == 255 && ip_dst.addr[1] == 255 && + ip_dst.addr[2] == 255 && ip_dst.addr[3] == 255) + { + ok = true; + } + else if (ip_dst.addr[0] >= 224 && ip_dst.addr[0] <= 239) + { + ok = true; + } + else + { + if (CmpIpAddr(&ipc->BroadcastAddress, &ip_dst) == 0) + { + ok = true; + } + + if (IsZeroIP(&ipc->ClientIPAddress)) + { + // Client IP address is undetermined + ok = true; + } + } + + if (ok) + { + // Parse DHCP packets + bool packetConsumed = false; + if (ipc->DHCPv4Awaiter.IsAwaiting) + { + PKT *pkt; + DHCPV4_DATA *dhcp; + + Debug("Parsing for DHCP awaiter\n"); + pkt = ParsePacketIPv4WithDummyMacHeader(data, size); + dhcp = ParseDHCPv4Data(pkt); + + if (dhcp != NULL) + { + if (Endian32(dhcp->Header->TransactionId) == ipc->DHCPv4Awaiter.TransCode && + dhcp->OpCode == ipc->DHCPv4Awaiter.OpCode) + { + FreeDHCPv4Data(ipc->DHCPv4Awaiter.DhcpData); + ipc->DHCPv4Awaiter.DhcpData = dhcp; + packetConsumed = true; + } + else + { + FreeDHCPv4Data(dhcp); + } + } + + FreePacketWithData(pkt); + } + + IPCAssociateOnArpTable(ipc, &ip_src, src_mac); + + if (ipc->IPv4State == IPC_PROTO_STATUS_OPENED && !packetConsumed) + { + // Place in the reception queue + InsertQueue(ipc->IPv4ReceivedQueue, NewBlock(data, size, 0)); + } + else + { + Free(data); // We need to free the packet if we don't save it + } + + } + else + { + // This packet is discarded because it is irrelevant for me + Free(data); + } + } + } + else if (protocol == MAC_PROTO_IPV6) + { + PKT *p = ParsePacketUpToICMPv6(b->Buf, b->Size); + if (p != NULL) + { + IP ip_src, ip_dst; + bool ndtProcessed = false; + UINT size = b->Size - 14; + + UCHAR *data = Clone(b->Buf + 14, size); + + IPv6AddrToIP(&ip_src, &p->IPv6HeaderPacketInfo.IPv6Header->SrcAddress); + IPv6AddrToIP(&ip_dst, &p->IPv6HeaderPacketInfo.IPv6Header->DestAddress); + + if (p->IPv6HeaderPacketInfo.Protocol == IP_PROTO_ICMPV6) + { + IP icmpHeaderAddr; + // We need to parse the Router Advertisement and Neighbor Advertisement messages + // to build the Neighbor Discovery Table (aka ARP table for IPv6) + switch (p->ICMPv6HeaderPacketInfo.Type) + { + case ICMPV6_TYPE_ROUTER_ADVERTISEMENT: + // We save the router advertisement data for later use + IPCIPv6AddRouterPrefixes(ipc, &p->ICMPv6HeaderPacketInfo.OptionList, src_mac, &ip_src); + IPCIPv6AssociateOnNDTEx(ipc, &ip_src, src_mac, true); + IPCIPv6AssociateOnNDTEx(ipc, &ip_src, p->ICMPv6HeaderPacketInfo.OptionList.SourceLinkLayer->Address, true); + break; + case ICMPV6_TYPE_NEIGHBOR_ADVERTISEMENT: + // We save the neighbor advertisements into NDT + IPv6AddrToIP(&icmpHeaderAddr, &p->ICMPv6HeaderPacketInfo.Headers.NeighborAdvertisementHeader->TargetAddress); + IPCIPv6AssociateOnNDTEx(ipc, &icmpHeaderAddr, src_mac, true); + IPCIPv6AssociateOnNDTEx(ipc, &ip_src, src_mac, true); + ndtProcessed = true; + break; + } + } + + // We update the NDT only if we have an entry in it for the IP+Mac + if (!ndtProcessed) + { + IPCIPv6AssociateOnNDT(ipc, &ip_src, src_mac); + } + + /// TODO: should we or not filter Neighbor Advertisements and/or Neighbor Solicitations? + if (ipc->IPv6State == IPC_PROTO_STATUS_OPENED) + { + InsertQueue(ipc->IPv6ReceivedQueue, NewBlock(data, size, 0)); + } + else + { + Free(data); // We need to free the packet if we don't save it + } + + FreePacket(p); + } + } + } + } + } + + FreeBlock(b); + } + + IPCProcessInterrupts(ipc); +} + +// Configure IPv4 parameters +bool IPCSetIPv4Parameters(IPC *ipc, IP *ip, IP *subnet, IP *gw, DHCP_CLASSLESS_ROUTE_TABLE *rt) +{ + bool changed = false; + // Validate arguments + if (ipc == NULL || ip == NULL || subnet == NULL) + { + return false; + } + + if (CmpIpAddr(&ipc->ClientIPAddress, ip) != 0) + { + changed = true; + } + Copy(&ipc->ClientIPAddress, ip, sizeof(IP)); + + if (CmpIpAddr(&ipc->SubnetMask, subnet) != 0) + { + changed = true; + } + Copy(&ipc->SubnetMask, subnet, sizeof(IP)); + + if (gw != NULL) + { + if (CmpIpAddr(&ipc->DefaultGateway, gw) != 0) + { + changed = true; + } + + Copy(&ipc->DefaultGateway, gw, sizeof(IP)); + } + else + { + if (IsZeroIP(&ipc->DefaultGateway) == false) + { + changed = true; + } + + Zero(&ipc->DefaultGateway, sizeof(IP)); + } + + GetBroadcastAddress4(&ipc->BroadcastAddress, ip, subnet); + + if (rt != NULL && rt->NumExistingRoutes >= 1) + { + if (Cmp(&ipc->ClasslessRoute, rt, sizeof(DHCP_CLASSLESS_ROUTE_TABLE)) != 0) + { + changed = true; + + Copy(&ipc->ClasslessRoute, rt, sizeof(DHCP_CLASSLESS_ROUTE_TABLE)); + } + } + + return changed; +} + +// Send an IPv4 packet (client -> server) +void IPCSendIPv4(IPC *ipc, void *data, UINT size) +{ + IP ip_src, ip_dst; + IP ip_dst_local; + bool is_broadcast = false; + UCHAR uc; + DHCP_CLASSLESS_ROUTE *r = NULL; + // Validate arguments + if (ipc == NULL || data == NULL || size < 20 || size > 1500) + { + return; + } + + uc = ((UCHAR *)data)[0]; + if (((uc >> 4) & 0x0f) != 4) + { + // Not an IPv4 + return; + } + + // Extract the IP address portion + UINTToIP(&ip_src, *((UINT *)(((UCHAR *)data) + 12))); + UINTToIP(&ip_dst, *((UINT *)(((UCHAR *)data) + 16))); + + // Filter the source IP address + if (CmpIpAddr(&ip_src, &ipc->ClientIPAddress) != 0) + { + // Cut off packets from illegal IP address + return; + } + + if (IsZeroIP(&ip_dst)) + { + // Illegal destination address + return; + } + + if (CmpIpAddr(&ip_dst, &ipc->ClientIPAddress) == 0) + { + // Packet destined for myself + return; + } + + // Get the IP address of the relayed destination + Copy(&ip_dst_local, &ip_dst, sizeof(IP)); + + if (IsInSameNetwork4(&ip_dst, &ipc->ClientIPAddress, &ipc->SubnetMask) == false) + { + r = GetBestClasslessRoute(&ipc->ClasslessRoute, &ip_dst); + + if (r == NULL) + { + Copy(&ip_dst_local, &ipc->DefaultGateway, sizeof(IP)); + } + else + { + Copy(&ip_dst_local, &r->Gateway, sizeof(IP)); + } + } + + if (CmpIpAddr(&ipc->BroadcastAddress, &ip_dst) == 0) + { + // Local Broadcast + is_broadcast = true; + } + + if (ip_dst.addr[0] == 255 && ip_dst.addr[1] == 255 && ip_dst.addr[2] == 255 && ip_dst.addr[3] == 255) + { + // Global Broadcast + is_broadcast = true; + } + + if (ip_dst.addr[0] >= 224 && ip_dst.addr[0] <= 239) + { + // IPv4 Multicast + is_broadcast = true; + } + + if (is_broadcast) + { + // Send a broadcast packet + UCHAR dest[6]; + UINT i; + + // Destination + for (i = 0; i < 6; i++) + { + dest[i] = 0xff; + } + + // Send + IPCSendIPv4WithDestMacAddr(ipc, data, size, dest); + + return; + } + + if (IsZeroIP(&ip_dst_local)) + { + // Unable to send + return; + } + + // Send a unicast packet + IPCSendIPv4Unicast(ipc, data, size, &ip_dst_local); +} + +// Send an IPv4 packet with a specified destination MAC address +void IPCSendIPv4WithDestMacAddr(IPC *ipc, void *data, UINT size, UCHAR *dest_mac_addr) +{ + UCHAR tmp[1514]; + // Validate arguments + if (ipc == NULL || data == NULL || size < 20 || size > 1500 || dest_mac_addr == NULL) + { + return; + } + + // Destination + Copy(tmp + 0, dest_mac_addr, 6); + + // Source + Copy(tmp + 6, ipc->MacAddress, 6); + + // Protocol number + WRITE_USHORT(tmp + 12, MAC_PROTO_IPV4); + + // Data + Copy(tmp + 14, data, size); + + // Send + IPCSendL2(ipc, tmp, size + 14); +} + +// Remove old ARP table entries +void IPCFlushArpTable(IPC *ipc) +{ + IPCFlushArpTableEx(ipc, 0); +} +void IPCFlushArpTableEx(IPC *ipc, UINT64 now) +{ + UINT i; + LIST *o = NULL; + // Validate arguments + if (ipc == NULL) + { + return; + } + if (now == 0) + { + now = Tick64(); + } + + for (i = 0; i < LIST_NUM(ipc->ArpTable); i++) + { + IPC_ARP *a = LIST_DATA(ipc->ArpTable, i); + bool b = false; + + if (a->Resolved && a->ExpireTime <= now) + { + b = true; + } + else if (a->Resolved == false && a->GiveupTime <= now) + { + b = true; + } + + if (b) + { + if (o == NULL) + { + o = NewListFast(NULL); + } + + Add(o, a); + } + } + + if (o != NULL) + { + for (i = 0; i < LIST_NUM(o); i++) + { + IPC_ARP *a = LIST_DATA(o, i); + + IPCFreeARP(a); + + Delete(ipc->ArpTable, a); + } + + ReleaseList(o); + } +} + +// Send an IPv4 unicast packet +void IPCSendIPv4Unicast(IPC *ipc, void *data, UINT size, IP *next_ip) +{ + IPC_ARP *a; + // Validate arguments + if (ipc == NULL || data == NULL || size < 20 || size > 1500 || next_ip == NULL) + { + return; + } + + a = IPCSearchArpTable(ipc->ArpTable, next_ip); + + if (a != NULL) + { + // ARP entry is found + if (a->Resolved) + { + // Send + a->ExpireTime = Tick64() + (UINT64)IPC_ARP_LIFETIME; + + IPCSendIPv4WithDestMacAddr(ipc, data, size, a->MacAddress); + } + else + { + // Undeliverable because of unresolved table. Accumulate in the queue + if (a->PacketQueue->num_item < IPC_MAX_PACKET_QUEUE_LEN) + { + InsertQueue(a->PacketQueue, NewBlock(Clone(data, size), size, false)); + } + } + } + else + { + ARPV4_HEADER arp; + UCHAR tmp[14 + sizeof(ARPV4_HEADER)]; + UINT i; + + // Because there is no such ARP entry, create a new one + a = IPCNewARP(next_ip, NULL); + + // Send an ARP request + Zero(&arp, sizeof(arp)); + arp.HardwareType = Endian16(ARP_HARDWARE_TYPE_ETHERNET); + arp.ProtocolType = Endian16(MAC_PROTO_IPV4); + arp.HardwareSize = 6; + arp.ProtocolSize = 4; + arp.Operation = Endian16(ARP_OPERATION_REQUEST); + Copy(&arp.SrcAddress, &ipc->MacAddress, 6); + arp.SrcIP = IPToUINT(&ipc->ClientIPAddress); + arp.TargetIP = IPToUINT(next_ip); + + for (i = 0; i < 6; i++) + { + tmp[i] = 0xff; + } + + Copy(tmp + 6, ipc->MacAddress, 6); + + WRITE_USHORT(tmp + 12, MAC_PROTO_ARPV4); + Copy(tmp + 14, &arp, sizeof(ARPV4_HEADER)); + + IPCSendL2(ipc, tmp, 14 + sizeof(ARPV4_HEADER)); + + // Accumulate the IP packet to be transmitted in the queue + if (a->PacketQueue->num_item < IPC_MAX_PACKET_QUEUE_LEN) + { + InsertQueue(a->PacketQueue, NewBlock(Clone(data, size), size, false)); + } + + Insert(ipc->ArpTable, a); + } +} + +// Search the ARP table +IPC_ARP *IPCSearchArpTable(LIST *arpTable, IP *ip) +{ + IPC_ARP t; + IPC_ARP *a; + // Validate arguments + if (arpTable == NULL || ip == NULL) + { + return NULL; + } + + Copy(&t.Ip, ip, sizeof(IP)); + + a = Search(arpTable, &t); + + return a; +} + +// Release the ARP entry +void IPCFreeARP(IPC_ARP *a) +{ + BLOCK *b; + // Validate arguments + if (a == NULL) + { + return; + } + + while (true) + { + b = GetNext(a->PacketQueue); + if (b == NULL) + { + break; + } + + FreeBlock(b); + } + + ReleaseQueue(a->PacketQueue); + + Free(a); +} + +// Create a new ARP entry +IPC_ARP *IPCNewARP(IP *ip, UCHAR *mac_address) +{ + IPC_ARP *a; + // Validate arguments + if (ip == NULL) + { + return NULL; + } + + a = ZeroMalloc(sizeof(IPC_ARP)); + + Copy(&a->Ip, ip, sizeof(IP)); + if (mac_address != NULL) + { + Copy(a->MacAddress, mac_address, 6); + a->Resolved = true; + a->ExpireTime = Tick64() + (UINT64)IPC_ARP_LIFETIME; + } + else + { + a->GiveupTime = Tick64() + (UINT64)IPC_ARP_GIVEUPTIME; + } + + a->PacketQueue = NewQueueFast(); + + return a; +} + +// Compare ARP entries +int IPCCmpArpTable(void *p1, void *p2) +{ + IPC_ARP *a1, *a2; + // Validate arguments + if (p1 == NULL || p2 == NULL) + { + return 0; + } + a1 = *(IPC_ARP **)p1; + a2 = *(IPC_ARP **)p2; + if (a1 == NULL || a2 == NULL) + { + return 0; + } + + return CmpIpAddr(&a1->Ip, &a2->Ip); +} + +// Send an Ethernet packet (client -> server) +void IPCSendL2(IPC *ipc, void *data, UINT size) +{ + // Validate arguments + if (ipc == NULL || data == NULL || size == 0) + { + return; + } + + if (ipc->Sock == NULL) + { + return; + } + + TubeSendEx(ipc->Sock->SendTube, data, size, NULL, true); + AddTubeToFlushList(ipc->FlushList, ipc->Sock->SendTube); +} + +// Receive an IPv4 packet (server -> client) +BLOCK *IPCRecvIPv4(IPC *ipc) +{ + BLOCK *b; + // Validate arguments + if (ipc == NULL) + { + return NULL; + } + + b = GetNext(ipc->IPv4ReceivedQueue); + + return b; +} + +// Receive an Ethernet packet (server -> client) +BLOCK *IPCRecvL2(IPC *ipc) +{ + TUBEDATA *d; + BLOCK *b; + // Validate arguments + if (ipc == NULL) + { + return NULL; + } + + if (ipc->Sock == NULL) + { + return NULL; + } + + d = TubeRecvAsync(ipc->Sock->RecvTube); + + if (d == NULL) + { + return NULL; + } + + b = NewBlock(d->Data, d->DataSize, 0); + + Free(d->Header); + Free(d); + + return b; +} + +// IPv6 stuff +// Memory management +void IPCIPv6Init(IPC *ipc) +{ + ipc->IPv6ReceivedQueue = NewQueue(); + // The NDT is basically the same as ARP Table with some slight adjustments + ipc->IPv6NeighborTable = NewList(IPCCmpArpTable); + ipc->IPv6RouterAdvs = NewList(NULL); + + ipc->IPv6ClientEUI = 0; + ipc->IPv6ServerEUI = 0; + + ipc->IPv6State = IPC_PROTO_STATUS_CLOSED; +} +void IPCIPv6Free(IPC *ipc) +{ + UINT i; + for (i = 0; i < LIST_NUM(ipc->IPv6NeighborTable); i++) + { + IPC_ARP *a = LIST_DATA(ipc->IPv6NeighborTable, i); + IPCFreeARP(a); + } + + ReleaseList(ipc->IPv6NeighborTable); + + for (i = 0; i < LIST_NUM(ipc->IPv6RouterAdvs); i++) + { + IPC_IPV6_ROUTER_ADVERTISEMENT *ra = LIST_DATA(ipc->IPv6RouterAdvs, i); + Free(ra); + } + + ReleaseList(ipc->IPv6RouterAdvs); + + while (true) + { + BLOCK *b = GetNext(ipc->IPv6ReceivedQueue); + if (b == NULL) + { + break; + } + + FreeBlock(b); + } + + ReleaseQueue(ipc->IPv6ReceivedQueue); +} + +// NDT +void IPCIPv6AssociateOnNDT(IPC *ipc, IP *ip, UCHAR *mac_address) +{ + IPCIPv6AssociateOnNDTEx(ipc, ip, mac_address, false); +} +void IPCIPv6AssociateOnNDTEx(IPC *ipc, IP *ip, UCHAR *mac_address, bool isNeighborAdv) +{ + IPC_ARP *a; + UINT addrType = 0; + if (ipc == NULL || ip == NULL || + IsValidUnicastIPAddress6(ip) == false || + IsMacUnicast(mac_address) == false) + { + return; + } + + addrType = GetIPAddrType6(ip); + + if (addrType != IPV6_ADDR_LOCAL_UNICAST && + addrType != IPV6_ADDR_GLOBAL_UNICAST) + { + return; + } + + if (addrType == IPV6_ADDR_GLOBAL_UNICAST) + { + if (!IPCIPv6CheckUnicastFromRouterPrefix(ipc, ip, NULL)) + { + return; + } + } + + a = IPCSearchArpTable(ipc->IPv6NeighborTable, ip); + + // We create a new entry only if we got a neighbor advertisement + if (a == NULL && isNeighborAdv) + { + a = IPCNewARP(ip, mac_address); + Insert(ipc->IPv6NeighborTable, a); + } + else if (a == NULL) + { + // We skip the NDT association on random packets from unknown locations + return; + } + else + { + Copy(a->MacAddress, mac_address, 6); + + if (a->Resolved == false) + { + a->Resolved = true; + a->GiveupTime = 0; + while (true) + { + BLOCK *b = GetNext(a->PacketQueue); + + if (b == NULL) + { + break; + } + + IPCIPv6SendWithDestMacAddr(ipc, b->Buf, b->Size, a->MacAddress); + + FreeBlock(b); + } + } + + a->ExpireTime = Tick64() + (UINT64)IPC_IPV6_NDT_LIFETIME; + } +} + +void IPCIPv6FlushNDT(IPC *ipc) +{ + IPCIPv6FlushNDTEx(ipc, 0); +} +void IPCIPv6FlushNDTEx(IPC *ipc, UINT64 now) +{ + UINT i; + LIST *o = NULL; + // Validate arguments + if (ipc == NULL) + { + return; + } + if (now == 0) + { + now = Tick64(); + } + + for (i = 0; i < LIST_NUM(ipc->IPv6NeighborTable); i++) + { + IPC_ARP *a = LIST_DATA(ipc->IPv6NeighborTable, i); + bool b = false; + + if (a->Resolved && a->ExpireTime <= now) + { + b = true; + } + else if (a->Resolved == false && a->GiveupTime <= now) + { + b = true; + } + /// TODO: think about adding retransmission as per RFC4861 + + if (b) + { + if (o == NULL) + { + o = NewListFast(NULL); + } + + Add(o, a); + } + } + + if (o != NULL) + { + for (i = 0; i < LIST_NUM(o); i++) + { + IPC_ARP *a = LIST_DATA(o, i); + + IPCFreeARP(a); + + Delete(ipc->IPv6NeighborTable, a); + } + + ReleaseList(o); + } +} + +// Scan the hub IP Table to try to find the EUI-based link-local address +bool IPCIPv6CheckExistingLinkLocal(IPC *ipc, UINT64 eui) +{ + HUB t, *h; + IP_TABLE_ENTRY i, *e; + t.Name = ipc->HubName; + + // Construct link local from eui + ZeroIP6(&i.Ip); + i.Ip.ipv6_addr[0] = 0xFE; + i.Ip.ipv6_addr[1] = 0x80; + Copy(&i.Ip.ipv6_addr[8], &eui, sizeof(UINT64)); + + h = Search(ipc->Cedar->HubList, &t); + + if (h != NULL) + { + e = Search(h->IpTable, &i); + if (e != NULL) + { + return true; + } + } + + return false; +} + +// RA +void IPCIPv6AddRouterPrefixes(IPC *ipc, ICMPV6_OPTION_LIST *recvPrefix, UCHAR *macAddress, IP *ip) +{ + UINT i, j; + for (i = 0; i < ICMPV6_OPTION_PREFIXES_MAX_COUNT; i++) + { + if (recvPrefix->Prefix[i] != NULL) + { + bool foundPrefix = false; + for (j = 0; j < LIST_NUM(ipc->IPv6RouterAdvs); j++) + { + IPC_IPV6_ROUTER_ADVERTISEMENT *existingRA = LIST_DATA(ipc->IPv6RouterAdvs, j); + if (Cmp(&recvPrefix->Prefix[i]->Prefix, &existingRA->RoutedPrefix.ipv6_addr, sizeof(IPV6_ADDR)) == 0) + { + foundPrefix = true; + break; + } + } + + if (!foundPrefix) + { + IPC_IPV6_ROUTER_ADVERTISEMENT *newRA = Malloc(sizeof(IPC_IPV6_ROUTER_ADVERTISEMENT)); + IPv6AddrToIP(&newRA->RoutedPrefix, &recvPrefix->Prefix[i]->Prefix); + IntToSubnetMask6(&newRA->RoutedMask, recvPrefix->Prefix[i]->SubnetLength); + CopyIP(&newRA->RouterAddress, ip); + Copy(newRA->RouterMacAddress, macAddress, 6); + Copy(newRA->RouterLinkLayerAddress, recvPrefix->SourceLinkLayer->Address, 6); + Add(ipc->IPv6RouterAdvs, newRA); + } + } + else + { + break; + } + } +} + +bool IPCIPv6CheckUnicastFromRouterPrefix(IPC *ipc, IP *ip, IPC_IPV6_ROUTER_ADVERTISEMENT *matchedRA) +{ + UINT i; + IPC_IPV6_ROUTER_ADVERTISEMENT *matchingRA = NULL; + bool isInPrefix = false; + for (i = 0; i < LIST_NUM(ipc->IPv6RouterAdvs); i++) + { + IPC_IPV6_ROUTER_ADVERTISEMENT *ra = LIST_DATA(ipc->IPv6RouterAdvs, i); + isInPrefix = IsInSameNetwork6(ip, &ra->RoutedPrefix, &ra->RoutedMask); + if (isInPrefix) + { + matchingRA = ra; + break; + } + } + + if (matchedRA != NULL && matchingRA != NULL) + { + Copy(matchedRA, matchingRA, sizeof(IPC_IPV6_ROUTER_ADVERTISEMENT)); + } + + return isInPrefix; +} + +// Send router solicitation and then eventually populate the info from Router Advertisements +UINT64 IPCIPv6GetServerEui(IPC *ipc) +{ + // It is already configured, nothing to do here + if (ipc->IPv6ServerEUI != 0) + { + return ipc->IPv6ServerEUI; + } + + // If we don't have a valid client EUI, we can't generate a correct link local + if (ipc->IPv6ClientEUI == 0) + { + return ipc->IPv6ServerEUI; + } + + if (LIST_NUM(ipc->IPv6RouterAdvs) == 0) + { + IP destIP; + IPV6_ADDR destV6; + UCHAR destMacAddress[6]; + IPV6_ADDR linkLocal; + BUF *packet; + UINT64 giveup_time = Tick64() + (UINT64)(IPC_IPV6_RA_MAX_RETRIES * IPC_IPV6_RA_INTERVAL); + UINT64 timeout_retry = 0; + + Zero(&linkLocal, sizeof(IPV6_ADDR)); + + // Generate link local from client's EUI + linkLocal.Value[0] = 0xFE; + linkLocal.Value[1] = 0x80; + Copy(&linkLocal.Value[8], &ipc->IPv6ClientEUI, sizeof(UINT64)); + + GetAllRouterMulticastAddress6(&destIP); + + // Generate the MAC address from the multicast address + destMacAddress[0] = 0x33; + destMacAddress[1] = 0x33; + Copy(&destMacAddress[2], &destIP.ipv6_addr[12], sizeof(UINT)); + + IPToIPv6Addr(&destV6, &destIP); + + packet = BuildICMPv6RouterSoliciation(&linkLocal, &destV6, ipc->MacAddress, 0); + + while (LIST_NUM(ipc->IPv6RouterAdvs) == 0) + { + UINT64 now = Tick64(); + if (now >= timeout_retry) + { + timeout_retry = now + (UINT64)IPC_IPV6_RA_INTERVAL; + IPCIPv6SendWithDestMacAddr(ipc, packet->Buf, packet->Size, destMacAddress); + } + + AddInterrupt(ipc->Interrupt, timeout_retry); + + if (Tick64() >= giveup_time) + { + // We failed to receive any router advertisements + break; + } + + // The processing should populate the received RAs by itself + IPCProcessL3Events(ipc); + } + + FreeBuf(packet); + } + + // Populating the IPv6 Server EUI for IPV6CP + if (LIST_NUM(ipc->IPv6RouterAdvs) > 0) + { + IPC_IPV6_ROUTER_ADVERTISEMENT *ra = LIST_DATA(ipc->IPv6RouterAdvs, 0); + Copy(&ipc->IPv6ServerEUI, &ra->RouterAddress.ipv6_addr[8], sizeof(UINT64)); + } + + // If it is still not defined, let's just generate something random + while (ipc->IPv6ServerEUI == 0) + { + ipc->IPv6ServerEUI = Rand64(); + if (ipc->IPv6ClientEUI == ipc->IPv6ServerEUI) + { + ipc->IPv6ServerEUI = 0; + } + } + + return ipc->IPv6ServerEUI; +} + +// Data flow +BLOCK *IPCIPv6Recv(IPC *ipc) +{ + BLOCK *b; + // Validate arguments + if (ipc == NULL) + { + return NULL; + } + + b = GetNext(ipc->IPv6ReceivedQueue); + + return b; +} + +void IPCIPv6Send(IPC *ipc, void *data, UINT size) +{ + IP destAddr; + UINT ipv6Type; + UCHAR destMac[6]; + IPV6_HEADER *header = data; + + IPv6AddrToIP(&destAddr, &header->DestAddress); + + if (IsValidUnicastIPAddress6(&destAddr)) + { + IPCIPv6SendUnicast(ipc, data, size, &destAddr); + return; + } + + // Here we're probably dealing with a multicast packet. But let's check it anyway + ipv6Type = GetIPAddrType6(&destAddr); + if (ipv6Type & IPV6_ADDR_MULTICAST) + { + // Constructing multicast MAC address based on destination IP address, then just fire and forget + destMac[0] = 0x33; + destMac[1] = 0x33; + destMac[2] = destAddr.ipv6_addr[12]; + destMac[3] = destAddr.ipv6_addr[13]; + destMac[4] = destAddr.ipv6_addr[14]; + destMac[5] = destAddr.ipv6_addr[15]; + IPCIPv6SendWithDestMacAddr(ipc, data, size, destMac); + return; + } + else + { + Debug("We got a weird packet with a weird type! %i\n", ipv6Type); + } +} + +void IPCIPv6SendWithDestMacAddr(IPC *ipc, void *data, UINT size, UCHAR *dest_mac_addr) +{ + UCHAR tmp[1514]; + + IPV6_HEADER *header = data; + + + // Validate arguments + if (ipc == NULL || data == NULL || size < 40 || size > 1500 || dest_mac_addr == NULL) + { + return; + } + + // Destination + Copy(tmp + 0, dest_mac_addr, 6); + + // Source + Copy(tmp + 6, ipc->MacAddress, 6); + + // Protocol number + WRITE_USHORT(tmp + 12, MAC_PROTO_IPV6); + + // Data + Copy(tmp + 14, data, size); + + // Parse the packet for ND ICMPv6 fixup + if (header->NextHeader == IP_PROTO_ICMPV6) + { + PKT *p = ParsePacketUpToICMPv6(tmp, size + 14); + if (p != NULL) + { + ICMPV6_OPTION_LINK_LAYER linkLayer; + BUF *buf; + BUF *optBuf; + BUF *packet; + // We need to rebuild the packet to + switch (p->ICMPv6HeaderPacketInfo.Type) + { + case ICMPV6_TYPE_NEIGHBOR_SOLICIATION: + if (p->ICMPv6HeaderPacketInfo.OptionList.SourceLinkLayer == NULL) + { + p->ICMPv6HeaderPacketInfo.OptionList.SourceLinkLayer = &linkLayer; + } + Copy(p->ICMPv6HeaderPacketInfo.OptionList.SourceLinkLayer->Address, ipc->MacAddress, 6); + break; + case ICMPV6_TYPE_NEIGHBOR_ADVERTISEMENT: + if (p->ICMPv6HeaderPacketInfo.OptionList.TargetLinkLayer == NULL) + { + p->ICMPv6HeaderPacketInfo.OptionList.TargetLinkLayer = &linkLayer; + } + Copy(p->ICMPv6HeaderPacketInfo.OptionList.TargetLinkLayer->Address, ipc->MacAddress, 6); + break; + } + switch (p->ICMPv6HeaderPacketInfo.Type) + { + case ICMPV6_TYPE_NEIGHBOR_SOLICIATION: + case ICMPV6_TYPE_NEIGHBOR_ADVERTISEMENT: + optBuf = BuildICMPv6Options(&p->ICMPv6HeaderPacketInfo.OptionList); + buf = NewBuf(); + WriteBuf(buf, p->ICMPv6HeaderPacketInfo.Headers.HeaderPointer, + p->ICMPv6HeaderPacketInfo.Type == ICMPV6_TYPE_NEIGHBOR_SOLICIATION ? sizeof(ICMPV6_NEIGHBOR_SOLICIATION_HEADER) : sizeof(ICMPV6_NEIGHBOR_ADVERTISEMENT_HEADER)); + WriteBufBuf(buf, optBuf); + packet = BuildICMPv6(&p->IPv6HeaderPacketInfo.IPv6Header->SrcAddress, + &p->IPv6HeaderPacketInfo.IPv6Header->DestAddress, + p->IPv6HeaderPacketInfo.IPv6Header->HopLimit, + p->ICMPv6HeaderPacketInfo.Type, + p->ICMPv6HeaderPacketInfo.Code, + buf->Buf, + buf->Size, + 0); + Copy(tmp + 14, packet->Buf, packet->Size); + size = packet->Size; + FreeBuf(optBuf); + FreeBuf(buf); + FreeBuf(packet); + break; + } + } + FreePacket(p); + } + + // Send + IPCSendL2(ipc, tmp, size + 14); +} + +void IPCIPv6SendUnicast(IPC *ipc, void *data, UINT size, IP *next_ip) +{ + IPC_ARP *ndtMatch; + UCHAR *destMac = NULL; + IPC_IPV6_ROUTER_ADVERTISEMENT ra; + IPV6_HEADER *header = data; + IP srcIp; + bool isLocal = false; + // First we need to understand if it is a local packet or we should route it through the router + UINT addrType = GetIPAddrType6(next_ip); + + Zero(&ra, sizeof(IPC_IPV6_ROUTER_ADVERTISEMENT)); + IPv6AddrToIP(&srcIp, &header->SrcAddress); + + // Link local is always local =) + if (addrType & IPV6_ADDR_LOCAL_UNICAST) + { + isLocal = true; + } + + // If it matches any received prefix from router advertisements, it's also local + if (!isLocal && IPCIPv6CheckUnicastFromRouterPrefix(ipc, next_ip, &ra)) + { + isLocal = true; + } + + // If it is a global packet, we need to get our source IP prefix to know through which router shall we route + if (!isLocal) + { + if (!IPCIPv6CheckUnicastFromRouterPrefix(ipc, &srcIp, &ra)) + { + // If we didn't find a router for the source IP, let's just try to pick the first router and try to send to it + if (LIST_NUM(ipc->IPv6RouterAdvs) > 0) + { + Copy(&ra, LIST_DATA(ipc->IPv6RouterAdvs, 0), sizeof(IPC_IPV6_ROUTER_ADVERTISEMENT)); + } + else + { + char tmp[MAX_SIZE]; + IPToStr6(tmp, MAX_SIZE, &srcIp); + Debug("We couldn't find a router for the source address of %s! Trying as local.\n", tmp); + isLocal = true; + } + } + + destMac = ra.RouterMacAddress; + if (!IsMacUnicast(destMac) && !IsMacInvalid(ra.RouterMacAddress)) + { + destMac = ra.RouterLinkLayerAddress; + } + } + + // If it is local it should be routed directly through the NDT + if (isLocal) + { + ndtMatch = IPCSearchArpTable(ipc->IPv6NeighborTable, next_ip); + if (ndtMatch == NULL) + { + // Creating a non-matched NDT entry + ndtMatch = IPCNewARP(next_ip, NULL); + Add(ipc->IPv6NeighborTable, ndtMatch); + } + + if (ndtMatch->Resolved != true && LIST_NUM(ipc->IPv6RouterAdvs) > 0) + { + // First try to look up in router advertisements + UINT i; + for (i = 0; i < LIST_NUM(ipc->IPv6RouterAdvs); i++) + { + IPC_IPV6_ROUTER_ADVERTISEMENT *ra = LIST_DATA(ipc->IPv6RouterAdvs, i); + if (CmpIpAddr(next_ip, &ra->RouterAddress) == 0) + { + Copy(ndtMatch->MacAddress, IsMacUnicast(ra->RouterLinkLayerAddress) ? ra->RouterLinkLayerAddress : ra->RouterMacAddress, 6); + ndtMatch->Resolved = true; + break; + } + } + } + + if (ndtMatch->Resolved != true) + { + // We need to send the Neighbor Solicitation and save the packet for sending later + // Generate the MAC address from the multicast address + BUF *neighborSolicit; + UCHAR destMacAddress[6]; + IPV6_ADDR solicitAddress; + + char tmp[MAX_SIZE]; + UCHAR *copy; + BLOCK *blk; + + Zero(&solicitAddress, sizeof(IPV6_ADDR)); + Copy(&solicitAddress.Value[13], &header->DestAddress.Value[13], 3); + solicitAddress.Value[0] = 0xFF; + solicitAddress.Value[1] = 0x02; + solicitAddress.Value[11] = 0x01; + solicitAddress.Value[12] = 0xFF; + + neighborSolicit = BuildICMPv6NeighborSoliciation(&header->SrcAddress, &solicitAddress, ipc->MacAddress, 0); + destMacAddress[0] = 0x33; + destMacAddress[1] = 0x33; + Copy(&destMacAddress[2], &solicitAddress.Value[12], sizeof(UINT)); + IPCIPv6SendWithDestMacAddr(ipc, neighborSolicit->Buf, neighborSolicit->Size, destMacAddress); + + FreeBuf(neighborSolicit); + + + copy = Clone(data, size); + blk = NewBlock(copy, size, 0); + InsertQueue(ndtMatch->PacketQueue, blk); + IPToStr6(tmp, MAX_SIZE, next_ip); + + return; + } + destMac = ndtMatch->MacAddress; + } + + if (destMac != NULL && !IsMacInvalid(destMac)) + { + IPCIPv6SendWithDestMacAddr(ipc, data, size, destMac); + } + else + { + char tmp[MAX_SIZE]; + IPToStr6(tmp, MAX_SIZE, next_ip); + Debug("We couldn't deduce the MAC address for unicast address %s, packet dropped.\n", tmp); + /// TODO: think about sending to the all routers broadcast MAC as a last resort + } +} diff --git a/src/Cedar/IPC.h b/src/Cedar/IPC.h index bd68c176..f7b83e6c 100644 --- a/src/Cedar/IPC.h +++ b/src/Cedar/IPC.h @@ -1,241 +1,241 @@ -// SoftEther VPN Source Code - Developer Edition Master Branch -// Cedar Communication Module - - -// IPC.h -// Header of IPC.c - -#ifndef IPC_H -#define IPC_H - -// Constants -#define IPC_ARP_LIFETIME (3 * 60 * 1000) -#define IPC_ARP_GIVEUPTIME (1 * 1000) -#define IPC_DHCP_TIMEOUT (5 * 1000) -#define IPC_DHCP_MIN_LEASE 5 -#define IPC_DHCP_DEFAULT_LEASE 3600 - -#define IPC_MAX_PACKET_QUEUE_LEN 10000 - -#define IPC_DHCP_VENDOR_ID "MSFT 5.0" - -#define IPC_PASSWORD_MSCHAPV2_TAG "xH7DiNlurDhcYV4a:" - -#define IPC_LAYER_2 2 -#define IPC_LAYER_3 3 - -// IPv6 constants -#define IPC_IPV6_NDT_LIFETIME (30 * 1000) // as per REACHABLE_TIME constant of RFC4861 -#define IPC_IPV6_NDT_GIVEUPTIME (3 * 1000) // as per MAX_MULTICAST_SOLICIT * RETRANS_TIMER constants of RFC4861 -#define IPC_IPV6_RA_INTERVAL (2 * 1000) // Windows gets stuck if it is bigger -#define IPC_IPV6_RA_MAX_RETRIES 2 // Windows seems to be stuck when it doesn't receive an answer in due time - -// Protocol status -#define IPC_PROTO_STATUS_CLOSED 0x0 -#define IPC_PROTO_STATUS_CONFIG 0x1 -#define IPC_PROTO_STATUS_CONFIG_WAIT 0x2 -#define IPC_PROTO_STATUS_OPENED 0x10 -#define IPC_PROTO_STATUS_REJECTED 0x100 - -#define IPC_PROTO_SET_STATUS(ipc, proto, value) ((ipc) != NULL ? ((ipc->proto) = (value)) : 0) -#define IPC_PROTO_GET_STATUS(ipc, proto) ((ipc) != NULL ? (ipc->proto) : IPC_PROTO_STATUS_REJECTED) - -// ARP table entry -struct IPC_ARP -{ - IP Ip; // IP address - bool Resolved; // Whether the MAC address have been resolved - UCHAR MacAddress[6]; // MAC address - UINT64 GiveupTime; // Time to give up (in the case of unresolved) - UINT64 ExpireTime; // Expiration date (If resolved) - QUEUE *PacketQueue; // Transmission packet queue -}; - -// DHCP release queue -struct IPC_DHCP_RELEASE_QUEUE -{ - DHCP_OPTION_LIST Req; - UINT TranId; - UCHAR MacAddress[6]; -}; - -// IPC_SESSION_SHARED_BUFFER_DATA -struct IPC_SESSION_SHARED_BUFFER_DATA -{ - char ProtocolDetails[256]; - bool EnableUdpAccel; - bool UsingUdpAccel; -}; - -// IPC_PARAM -struct IPC_PARAM -{ - char ClientName[MAX_SIZE]; - char Postfix[MAX_SIZE]; - char HubName[MAX_HUBNAME_LEN + 1]; - char UserName[MAX_USERNAME_LEN + 1]; - char Password[MAX_PASSWORD_LEN + 1]; - IP ClientIp; - UINT ClientPort; - IP ServerIp; - UINT ServerPort; - char ClientHostname[MAX_SIZE]; - char CryptName[MAX_SIZE]; - bool BridgeMode; - UINT Mss; - bool IsL3Mode; - X *ClientCertificate; - UINT Layer; -}; - -// DHCPv4 response awaiter -struct IPC_DHCPV4_AWAIT -{ - bool IsAwaiting; - DHCPV4_DATA *DhcpData; - UINT TransCode; - UINT OpCode; -}; - -// IPC_ASYNC object -struct IPC_ASYNC -{ - CEDAR *Cedar; // Cedar - IPC_PARAM Param; // Parameters for creating IPC - THREAD *Thread; // Thread - SOCK_EVENT *SockEvent; // Socket events that is set when the connection is completed - bool Done; // Processing completion flag - IPC *Ipc; // IPC object (if it fails to connect, the value is NULL) - TUBE *TubeForDisconnect; // Tube for disconnection notification - UINT ErrorCode; // Error code in the case of failing to connect - DHCP_OPTION_LIST L3ClientAddressOption; // Client IP address option (Only in the case of L3 mode) - UINT64 L3DhcpRenewInterval; // DHCP update interval - UINT64 L3NextDhcpRenewTick; // DHCP renewal time of the next - bool DhcpAllocFailed; // Failed to get IP address from the DHCP server -}; - -// IPC object -struct IPC -{ - CEDAR *Cedar; - char HubName[MAX_HUBNAME_LEN + 1]; - char UserName[MAX_USERNAME_LEN + 1]; - char Password[MAX_PASSWORD_LEN + 1]; - char ClientHostname[MAX_SIZE]; - UCHAR random[SHA1_SIZE]; - char SessionName[MAX_SESSION_NAME_LEN + 1]; - char ConnectionName[MAX_CONNECTION_NAME_LEN + 1]; - POLICY *Policy; - SOCK *Sock; - INTERRUPT_MANAGER *Interrupt; // Interrupt manager - IP ClientIPAddress; // IP address of the client - IP SubnetMask; // Subnet mask of the client - IP DefaultGateway; // Default gateway address - IP BroadcastAddress; // Broadcast address - UCHAR MacAddress[6]; // MAC address - UCHAR Padding[2]; - LIST *ArpTable; // ARP table - QUEUE *IPv4ReceivedQueue; // IPv4 reception queue - UINT IPv4State; - IPC_DHCPV4_AWAIT DHCPv4Awaiter; - TUBE_FLUSH_LIST *FlushList; // Tube Flush List - UCHAR MsChapV2_ServerResponse[20]; // Server response - DHCP_CLASSLESS_ROUTE_TABLE ClasslessRoute; // Classless routing table - SHARED_BUFFER *IpcSessionSharedBuffer; // A shared buffer between IPC and Session - IPC_SESSION_SHARED_BUFFER_DATA *IpcSessionShared; // Shared data between IPC and Session - UINT Layer; - - // IPv6 stuff - QUEUE *IPv6ReceivedQueue; // IPv6 reception queue - UINT IPv6State; - LIST *IPv6NeighborTable; // Neighbor Discovery Table - LIST *IPv6RouterAdvs; // Router offered prefixes - UINT64 IPv6ClientEUI; // The EUI of the client (for the SLAAC autoconf) - UINT64 IPv6ServerEUI; // The EUI of the server (from the RA discovery) -}; - -// MS-CHAPv2 authentication information -struct IPC_MSCHAP_V2_AUTHINFO -{ - char MsChapV2_PPPUsername[MAX_SIZE]; // MS-CHAPv2 Username - UCHAR MsChapV2_ServerChallenge[16]; // MS-CHAPv2 Server Challenge - UCHAR MsChapV2_ClientChallenge[16]; // MS-CHAPv2 Client Challenge - UCHAR MsChapV2_ClientResponse[24]; // MS-CHAPv2 Client Response - EAP_CLIENT *MsChapV2_EapClient; // EAP client -}; - -struct IPC_IPV6_ROUTER_ADVERTISEMENT -{ - IP RoutedPrefix; - IP RoutedMask; - IP RouterAddress; - UCHAR RouterMacAddress[6]; - UCHAR RouterLinkLayerAddress[6]; -}; - -IPC *NewIPC(CEDAR *cedar, char *client_name, char *postfix, char *hubname, char *username, char *password, - UINT *error_code, IP *client_ip, UINT client_port, IP *server_ip, UINT server_port, - char *client_hostname, char *crypt_name, - bool bridge_mode, UINT mss, EAP_CLIENT *eap_client, X *client_certificate, - UINT layer); -IPC *NewIPCByParam(CEDAR *cedar, IPC_PARAM *param, UINT *error_code); -IPC *NewIPCBySock(CEDAR *cedar, SOCK *s, void *mac_address); -void FreeIPC(IPC *ipc); -bool IsIPCConnected(IPC *ipc); -void IPCSetSockEventWhenRecvL2Packet(IPC *ipc, SOCK_EVENT *e); -void IPCSendL2(IPC *ipc, void *data, UINT size); -void IPCSendIPv4(IPC *ipc, void *data, UINT size); -BLOCK *IPCRecvL2(IPC *ipc); -BLOCK *IPCRecvIPv4(IPC *ipc); -void IPCProcessInterrupts(IPC *ipc); -void IPCProcessL3EventsIPv4Only(IPC *ipc); -void IPCProcessL3Events(IPC *ipc); -void IPCProcessL3EventsEx(IPC *ipc, UINT64 now); -bool IPCSetIPv4Parameters(IPC *ipc, IP *ip, IP *subnet, IP *gw, DHCP_CLASSLESS_ROUTE_TABLE *rt); -IPC_ARP *IPCNewARP(IP *ip, UCHAR *mac_address); -void IPCFreeARP(IPC_ARP *a); -int IPCCmpArpTable(void *p1, void *p2); -void IPCSendIPv4Unicast(IPC *ipc, void *data, UINT size, IP *next_ip); -IPC_ARP *IPCSearchArpTable(LIST *arpTable, IP *ip); -void IPCSendIPv4WithDestMacAddr(IPC *ipc, void *data, UINT size, UCHAR *dest_mac_addr); -void IPCFlushArpTable(IPC *ipc); -void IPCFlushArpTableEx(IPC *ipc, UINT64 now); -void IPCProcessArp(IPC *ipc, BLOCK *b); -void IPCAssociateOnArpTable(IPC *ipc, IP *ip, UCHAR *mac_address); - - - -DHCPV4_DATA *IPCSendDhcpRequest(IPC *ipc, IP *dest_ip, UINT tran_id, DHCP_OPTION_LIST *opt, UINT expecting_code, UINT timeout, TUBE *discon_poll_tube); -BUF *IPCBuildDhcpRequest(IPC *ipc, IP *dest_ip, UINT tran_id, DHCP_OPTION_LIST *opt); -BUF *IPCBuildDhcpRequestOptions(IPC *ipc, DHCP_OPTION_LIST *opt); -bool IPCDhcpAllocateIP(IPC *ipc, DHCP_OPTION_LIST *opt, TUBE *discon_poll_tube); -bool IPCDhcpRequestInformIP(IPC *ipc, DHCP_OPTION_LIST *opt, TUBE *discon_poll_tube, IP *client_ip); -void IPCDhcpRenewIP(IPC *ipc, IP *dhcp_server); -void IPCDhcpFreeIP(IPC *ipc, IP *dhcp_server); -IPC_ASYNC *NewIPCAsync(CEDAR *cedar, IPC_PARAM *param, SOCK_EVENT *sock_event); -void IPCAsyncThreadProc(THREAD *thread, void *param); -void FreeIPCAsync(IPC_ASYNC *a); - -// IPv6 stuff -// Memory management -void IPCIPv6Init(IPC *ipc); -void IPCIPv6Free(IPC *ipc); -// NDT -void IPCIPv6AssociateOnNDT(IPC *ipc, IP *ip, UCHAR *mac_address); -void IPCIPv6AssociateOnNDTEx(IPC *ipc, IP *ip, UCHAR *mac_address, bool isNeighborAdv); -void IPCIPv6FlushNDT(IPC *ipc); -void IPCIPv6FlushNDTEx(IPC *ipc, UINT64 now); -bool IPCIPv6CheckExistingLinkLocal(IPC *ipc, UINT64 eui); -// RA -void IPCIPv6AddRouterPrefixes(IPC *ipc, ICMPV6_OPTION_LIST *recvPrefix, UCHAR *macAddress, IP *ip); -bool IPCIPv6CheckUnicastFromRouterPrefix(IPC *ipc, IP *ip, IPC_IPV6_ROUTER_ADVERTISEMENT *matchedRA); -UINT64 IPCIPv6GetServerEui(IPC *ipc); -// Data flow -BLOCK *IPCIPv6Recv(IPC *ipc); -void IPCIPv6Send(IPC *ipc, void *data, UINT size); -void IPCIPv6SendWithDestMacAddr(IPC *ipc, void *data, UINT size, UCHAR *dest_mac_addr); -void IPCIPv6SendUnicast(IPC *ipc, void *data, UINT size, IP *next_ip); - -bool ParseAndExtractMsChapV2InfoFromPassword(IPC_MSCHAP_V2_AUTHINFO *d, char *password); - -#endif // IPC_H +// SoftEther VPN Source Code - Developer Edition Master Branch +// Cedar Communication Module + + +// IPC.h +// Header of IPC.c + +#ifndef IPC_H +#define IPC_H + +// Constants +#define IPC_ARP_LIFETIME (3 * 60 * 1000) +#define IPC_ARP_GIVEUPTIME (1 * 1000) +#define IPC_DHCP_TIMEOUT (5 * 1000) +#define IPC_DHCP_MIN_LEASE 5 +#define IPC_DHCP_DEFAULT_LEASE 3600 + +#define IPC_MAX_PACKET_QUEUE_LEN 10000 + +#define IPC_DHCP_VENDOR_ID "MSFT 5.0" + +#define IPC_PASSWORD_MSCHAPV2_TAG "xH7DiNlurDhcYV4a:" + +#define IPC_LAYER_2 2 +#define IPC_LAYER_3 3 + +// IPv6 constants +#define IPC_IPV6_NDT_LIFETIME (30 * 1000) // as per REACHABLE_TIME constant of RFC4861 +#define IPC_IPV6_NDT_GIVEUPTIME (3 * 1000) // as per MAX_MULTICAST_SOLICIT * RETRANS_TIMER constants of RFC4861 +#define IPC_IPV6_RA_INTERVAL (2 * 1000) // Windows gets stuck if it is bigger +#define IPC_IPV6_RA_MAX_RETRIES 2 // Windows seems to be stuck when it doesn't receive an answer in due time + +// Protocol status +#define IPC_PROTO_STATUS_CLOSED 0x0 +#define IPC_PROTO_STATUS_CONFIG 0x1 +#define IPC_PROTO_STATUS_CONFIG_WAIT 0x2 +#define IPC_PROTO_STATUS_OPENED 0x10 +#define IPC_PROTO_STATUS_REJECTED 0x100 + +#define IPC_PROTO_SET_STATUS(ipc, proto, value) ((ipc) != NULL ? ((ipc->proto) = (value)) : 0) +#define IPC_PROTO_GET_STATUS(ipc, proto) ((ipc) != NULL ? (ipc->proto) : IPC_PROTO_STATUS_REJECTED) + +// ARP table entry +struct IPC_ARP +{ + IP Ip; // IP address + bool Resolved; // Whether the MAC address have been resolved + UCHAR MacAddress[6]; // MAC address + UINT64 GiveupTime; // Time to give up (in the case of unresolved) + UINT64 ExpireTime; // Expiration date (If resolved) + QUEUE *PacketQueue; // Transmission packet queue +}; + +// DHCP release queue +struct IPC_DHCP_RELEASE_QUEUE +{ + DHCP_OPTION_LIST Req; + UINT TranId; + UCHAR MacAddress[6]; +}; + +// IPC_SESSION_SHARED_BUFFER_DATA +struct IPC_SESSION_SHARED_BUFFER_DATA +{ + char ProtocolDetails[256]; + bool EnableUdpAccel; + bool UsingUdpAccel; +}; + +// IPC_PARAM +struct IPC_PARAM +{ + char ClientName[MAX_SIZE]; + char Postfix[MAX_SIZE]; + char HubName[MAX_HUBNAME_LEN + 1]; + char UserName[MAX_USERNAME_LEN + 1]; + char Password[MAX_PASSWORD_LEN + 1]; + IP ClientIp; + UINT ClientPort; + IP ServerIp; + UINT ServerPort; + char ClientHostname[MAX_SIZE]; + char CryptName[MAX_SIZE]; + bool BridgeMode; + UINT Mss; + bool IsL3Mode; + X *ClientCertificate; + UINT Layer; +}; + +// DHCPv4 response awaiter +struct IPC_DHCPV4_AWAIT +{ + bool IsAwaiting; + DHCPV4_DATA *DhcpData; + UINT TransCode; + UINT OpCode; +}; + +// IPC_ASYNC object +struct IPC_ASYNC +{ + CEDAR *Cedar; // Cedar + IPC_PARAM Param; // Parameters for creating IPC + THREAD *Thread; // Thread + SOCK_EVENT *SockEvent; // Socket events that is set when the connection is completed + bool Done; // Processing completion flag + IPC *Ipc; // IPC object (if it fails to connect, the value is NULL) + TUBE *TubeForDisconnect; // Tube for disconnection notification + UINT ErrorCode; // Error code in the case of failing to connect + DHCP_OPTION_LIST L3ClientAddressOption; // Client IP address option (Only in the case of L3 mode) + UINT64 L3DhcpRenewInterval; // DHCP update interval + UINT64 L3NextDhcpRenewTick; // DHCP renewal time of the next + bool DhcpAllocFailed; // Failed to get IP address from the DHCP server +}; + +// IPC object +struct IPC +{ + CEDAR *Cedar; + char HubName[MAX_HUBNAME_LEN + 1]; + char UserName[MAX_USERNAME_LEN + 1]; + char Password[MAX_PASSWORD_LEN + 1]; + char ClientHostname[MAX_SIZE]; + UCHAR random[SHA1_SIZE]; + char SessionName[MAX_SESSION_NAME_LEN + 1]; + char ConnectionName[MAX_CONNECTION_NAME_LEN + 1]; + POLICY *Policy; + SOCK *Sock; + INTERRUPT_MANAGER *Interrupt; // Interrupt manager + IP ClientIPAddress; // IP address of the client + IP SubnetMask; // Subnet mask of the client + IP DefaultGateway; // Default gateway address + IP BroadcastAddress; // Broadcast address + UCHAR MacAddress[6]; // MAC address + UCHAR Padding[2]; + LIST *ArpTable; // ARP table + QUEUE *IPv4ReceivedQueue; // IPv4 reception queue + UINT IPv4State; + IPC_DHCPV4_AWAIT DHCPv4Awaiter; + TUBE_FLUSH_LIST *FlushList; // Tube Flush List + UCHAR MsChapV2_ServerResponse[20]; // Server response + DHCP_CLASSLESS_ROUTE_TABLE ClasslessRoute; // Classless routing table + SHARED_BUFFER *IpcSessionSharedBuffer; // A shared buffer between IPC and Session + IPC_SESSION_SHARED_BUFFER_DATA *IpcSessionShared; // Shared data between IPC and Session + UINT Layer; + + // IPv6 stuff + QUEUE *IPv6ReceivedQueue; // IPv6 reception queue + UINT IPv6State; + LIST *IPv6NeighborTable; // Neighbor Discovery Table + LIST *IPv6RouterAdvs; // Router offered prefixes + UINT64 IPv6ClientEUI; // The EUI of the client (for the SLAAC autoconf) + UINT64 IPv6ServerEUI; // The EUI of the server (from the RA discovery) +}; + +// MS-CHAPv2 authentication information +struct IPC_MSCHAP_V2_AUTHINFO +{ + char MsChapV2_PPPUsername[MAX_SIZE]; // MS-CHAPv2 Username + UCHAR MsChapV2_ServerChallenge[16]; // MS-CHAPv2 Server Challenge + UCHAR MsChapV2_ClientChallenge[16]; // MS-CHAPv2 Client Challenge + UCHAR MsChapV2_ClientResponse[24]; // MS-CHAPv2 Client Response + EAP_CLIENT *MsChapV2_EapClient; // EAP client +}; + +struct IPC_IPV6_ROUTER_ADVERTISEMENT +{ + IP RoutedPrefix; + IP RoutedMask; + IP RouterAddress; + UCHAR RouterMacAddress[6]; + UCHAR RouterLinkLayerAddress[6]; +}; + +IPC *NewIPC(CEDAR *cedar, char *client_name, char *postfix, char *hubname, char *username, char *password, + UINT *error_code, IP *client_ip, UINT client_port, IP *server_ip, UINT server_port, + char *client_hostname, char *crypt_name, + bool bridge_mode, UINT mss, EAP_CLIENT *eap_client, X *client_certificate, + UINT layer); +IPC *NewIPCByParam(CEDAR *cedar, IPC_PARAM *param, UINT *error_code); +IPC *NewIPCBySock(CEDAR *cedar, SOCK *s, void *mac_address); +void FreeIPC(IPC *ipc); +bool IsIPCConnected(IPC *ipc); +void IPCSetSockEventWhenRecvL2Packet(IPC *ipc, SOCK_EVENT *e); +void IPCSendL2(IPC *ipc, void *data, UINT size); +void IPCSendIPv4(IPC *ipc, void *data, UINT size); +BLOCK *IPCRecvL2(IPC *ipc); +BLOCK *IPCRecvIPv4(IPC *ipc); +void IPCProcessInterrupts(IPC *ipc); +void IPCProcessL3EventsIPv4Only(IPC *ipc); +void IPCProcessL3Events(IPC *ipc); +void IPCProcessL3EventsEx(IPC *ipc, UINT64 now); +bool IPCSetIPv4Parameters(IPC *ipc, IP *ip, IP *subnet, IP *gw, DHCP_CLASSLESS_ROUTE_TABLE *rt); +IPC_ARP *IPCNewARP(IP *ip, UCHAR *mac_address); +void IPCFreeARP(IPC_ARP *a); +int IPCCmpArpTable(void *p1, void *p2); +void IPCSendIPv4Unicast(IPC *ipc, void *data, UINT size, IP *next_ip); +IPC_ARP *IPCSearchArpTable(LIST *arpTable, IP *ip); +void IPCSendIPv4WithDestMacAddr(IPC *ipc, void *data, UINT size, UCHAR *dest_mac_addr); +void IPCFlushArpTable(IPC *ipc); +void IPCFlushArpTableEx(IPC *ipc, UINT64 now); +void IPCProcessArp(IPC *ipc, BLOCK *b); +void IPCAssociateOnArpTable(IPC *ipc, IP *ip, UCHAR *mac_address); + + + +DHCPV4_DATA *IPCSendDhcpRequest(IPC *ipc, IP *dest_ip, UINT tran_id, DHCP_OPTION_LIST *opt, UINT expecting_code, UINT timeout, TUBE *discon_poll_tube); +BUF *IPCBuildDhcpRequest(IPC *ipc, IP *dest_ip, UINT tran_id, DHCP_OPTION_LIST *opt); +BUF *IPCBuildDhcpRequestOptions(IPC *ipc, DHCP_OPTION_LIST *opt); +bool IPCDhcpAllocateIP(IPC *ipc, DHCP_OPTION_LIST *opt, TUBE *discon_poll_tube); +bool IPCDhcpRequestInformIP(IPC *ipc, DHCP_OPTION_LIST *opt, TUBE *discon_poll_tube, IP *client_ip); +void IPCDhcpRenewIP(IPC *ipc, IP *dhcp_server); +void IPCDhcpFreeIP(IPC *ipc, IP *dhcp_server); +IPC_ASYNC *NewIPCAsync(CEDAR *cedar, IPC_PARAM *param, SOCK_EVENT *sock_event); +void IPCAsyncThreadProc(THREAD *thread, void *param); +void FreeIPCAsync(IPC_ASYNC *a); + +// IPv6 stuff +// Memory management +void IPCIPv6Init(IPC *ipc); +void IPCIPv6Free(IPC *ipc); +// NDT +void IPCIPv6AssociateOnNDT(IPC *ipc, IP *ip, UCHAR *mac_address); +void IPCIPv6AssociateOnNDTEx(IPC *ipc, IP *ip, UCHAR *mac_address, bool isNeighborAdv); +void IPCIPv6FlushNDT(IPC *ipc); +void IPCIPv6FlushNDTEx(IPC *ipc, UINT64 now); +bool IPCIPv6CheckExistingLinkLocal(IPC *ipc, UINT64 eui); +// RA +void IPCIPv6AddRouterPrefixes(IPC *ipc, ICMPV6_OPTION_LIST *recvPrefix, UCHAR *macAddress, IP *ip); +bool IPCIPv6CheckUnicastFromRouterPrefix(IPC *ipc, IP *ip, IPC_IPV6_ROUTER_ADVERTISEMENT *matchedRA); +UINT64 IPCIPv6GetServerEui(IPC *ipc); +// Data flow +BLOCK *IPCIPv6Recv(IPC *ipc); +void IPCIPv6Send(IPC *ipc, void *data, UINT size); +void IPCIPv6SendWithDestMacAddr(IPC *ipc, void *data, UINT size, UCHAR *dest_mac_addr); +void IPCIPv6SendUnicast(IPC *ipc, void *data, UINT size, IP *next_ip); + +bool ParseAndExtractMsChapV2InfoFromPassword(IPC_MSCHAP_V2_AUTHINFO *d, char *password); + +#endif // IPC_H diff --git a/src/Cedar/Layer3.c b/src/Cedar/Layer3.c index 96c5c216..2efcffe5 100644 --- a/src/Cedar/Layer3.c +++ b/src/Cedar/Layer3.c @@ -1,2099 +1,2099 @@ -// SoftEther VPN Source Code - Developer Edition Master Branch -// Cedar Communication Module - - -// Layer3.c -// Layer-3 switch module - -#include "CedarPch.h" - -static UCHAR broadcast[6] = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff}; - -// Process the IP queue -void L3PollingIpQueue(L3IF *f) -{ - L3PACKET *p; - // Validate arguments - if (f == NULL) - { - return; - } - - // Process the packet came from another session - while (p = GetNext(f->IpPacketQueue)) - { - PKT *pkt = p->Packet; - - // Send as an IP packet - L3SendIp(f, p); - } -} - -// Process IP packets -void L3RecvIp(L3IF *f, PKT *p, bool self) -{ - IPV4_HEADER *ip; - UINT header_size; - UINT next_hop = 0; - L3IF *dst; - L3PACKET *packet; - UINT new_ttl = 0; - // Validate arguments - if (f == NULL || p == NULL) - { - return; - } - - ip = p->L3.IPv4Header; - header_size = IPV4_GET_HEADER_LEN(p->L3.IPv4Header) * 4; - - // Calculate the checksum - if (IpCheckChecksum(ip) == false) - { - // The checksum does not match - goto FREE_PACKET; - } - - // Register in the ARP table - L3KnownArp(f, ip->SrcIP, p->MacAddressSrc); - - if (p->BroadcastPacket) - { - // Not to route in the case of broadcast packet - goto FREE_PACKET; - } - - // Calculate the TTL - if (ip->TimeToLive >= 1) - { - new_ttl = ip->TimeToLive - 1; - } - else - { - new_ttl = 0; - } - - if (new_ttl == 0) - { - if (ip->DstIP != f->IpAddress) - { - UINT src_packet_size = p->PacketSize - sizeof(MAC_HEADER); - UINT icmp_packet_total_size = sizeof(MAC_HEADER) + sizeof(IPV4_HEADER) + sizeof(ICMP_HEADER) + 4 + header_size + 8; - UCHAR *buf; - IPV4_HEADER *ipv4; - ICMP_HEADER *icmpv4; - UCHAR *data; - PKT *pkt; - UINT data_size = MIN(p->PacketSize - header_size, header_size + 8); - - // Generate an ICMP message that means that the TTL has expired - buf = ZeroMalloc(icmp_packet_total_size); - ipv4 = (IPV4_HEADER *)(buf + sizeof(MAC_HEADER)); - icmpv4 = (ICMP_HEADER *)(buf + sizeof(MAC_HEADER) + sizeof(IPV4_HEADER)); - data = buf + sizeof(MAC_HEADER) + sizeof(IPV4_HEADER) + sizeof(ICMP_HEADER) + 4; - - IPV4_SET_VERSION(ipv4, 4); - IPV4_SET_HEADER_LEN(ipv4, sizeof(IPV4_HEADER) / 4); - ipv4->TotalLength = Endian16((USHORT)(icmp_packet_total_size - sizeof(MAC_HEADER))); - ipv4->TimeToLive = 0xff; - ipv4->Protocol = IP_PROTO_ICMPV4; - ipv4->SrcIP = f->IpAddress; - ipv4->DstIP = ip->SrcIP; - ipv4->Checksum = IpChecksum(ipv4, sizeof(IPV4_HEADER)); - - icmpv4->Type = 11; - Copy(data, ip, data_size); - icmpv4->Checksum = IpChecksum(icmpv4, sizeof(ICMP_HEADER) + data_size + 4); - - buf[12] = 0x08; - buf[13] = 0x00; - - pkt = ParsePacket(buf, icmp_packet_total_size); - if (pkt == NULL) - { - Free(buf); - } - else - { - L3RecvIp(f, pkt, true); - } - - // Discard the packet body whose the TTL has expired - goto FREE_PACKET; - } - } - - // Rewrite the TTL - p->L3.IPv4Header->TimeToLive = (UCHAR)new_ttl; - - // Get the interface corresponding to the destination IP address - dst = L3GetNextIf(f->Switch, ip->DstIP, &next_hop); - - if (dst == NULL && self == false) - { - UINT src_packet_size = p->PacketSize - sizeof(MAC_HEADER); - UINT icmp_packet_total_size = sizeof(MAC_HEADER) + sizeof(IPV4_HEADER) + sizeof(ICMP_HEADER) + 4 + header_size + 8; - UCHAR *buf; - IPV4_HEADER *ipv4; - ICMP_HEADER *icmpv4; - UCHAR *data; - PKT *pkt; - UINT data_size = MIN(p->PacketSize - header_size, header_size + 8); - - // Respond with ICMP that indicates that no route can be found - buf = ZeroMalloc(icmp_packet_total_size); - ipv4 = (IPV4_HEADER *)(buf + sizeof(MAC_HEADER)); - icmpv4 = (ICMP_HEADER *)(buf + sizeof(MAC_HEADER) + sizeof(IPV4_HEADER)); - data = buf + sizeof(MAC_HEADER) + sizeof(IPV4_HEADER) + sizeof(ICMP_HEADER) + 4; - - IPV4_SET_VERSION(ipv4, 4); - IPV4_SET_HEADER_LEN(ipv4, sizeof(IPV4_HEADER) / 4); - ipv4->TotalLength = Endian16((USHORT)(icmp_packet_total_size - sizeof(MAC_HEADER))); - ipv4->TimeToLive = 0xff; - ipv4->Protocol = IP_PROTO_ICMPV4; - ipv4->SrcIP = f->IpAddress; - ipv4->DstIP = ip->SrcIP; - ipv4->Checksum = IpChecksum(ipv4, sizeof(IPV4_HEADER)); - - icmpv4->Type = 3; - Copy(data, ip, data_size); - icmpv4->Checksum = IpChecksum(icmpv4, sizeof(ICMP_HEADER) + data_size + 4); - - buf[12] = 0x08; - buf[13] = 0x00; - - pkt = ParsePacket(buf, icmp_packet_total_size); - if (pkt == NULL) - { - Free(buf); - } - else - { - L3RecvIp(f, pkt, true); - } - - // Discard the packet body whose route can not be found - goto FREE_PACKET; - } - - if (dst != NULL && ip->DstIP == dst->IpAddress) - { - bool free_packet = true; - // IP packet addressed to myself has arrived - if (p->TypeL4 == L4_ICMPV4) - { - ICMP_HEADER *icmp = p->L4.ICMPHeader; - if (icmp->Type == ICMP_TYPE_ECHO_REQUEST) - { - // Reply by rewriting the source and destination of the IP packet - UINT src_ip, dst_ip; - src_ip = p->L3.IPv4Header->DstIP; - dst_ip = p->L3.IPv4Header->SrcIP; - - p->L3.IPv4Header->DstIP = dst_ip; - p->L3.IPv4Header->SrcIP = src_ip; - - ip->TimeToLive = 0xff; - - // Recalculates the checksum - ip->FlagsAndFragmentOffset[0] = ip->FlagsAndFragmentOffset[1] = 0; - icmp->Checksum = 0; - icmp->Type = ICMP_TYPE_ECHO_RESPONSE; - icmp->Checksum = IpChecksum(icmp, p->PacketSize - sizeof(MAC_HEADER) - header_size); - - dst = L3GetNextIf(f->Switch, ip->DstIP, &next_hop); - - free_packet = false; - } - } - - if (free_packet) - { - goto FREE_PACKET; - } - } - - if (dst == NULL) - { - // The destination does not exist - goto FREE_PACKET; - } - - // Recalculate the IP checksum - ip->Checksum = 0; - ip->Checksum = IpChecksum(ip, header_size); - - // Treat as a Layer-3 packet - packet = ZeroMalloc(sizeof(L3PACKET)); - packet->Expire = Tick64() + IP_WAIT_FOR_ARP_TIMEOUT; - packet->NextHopIp = next_hop; - packet->Packet = p; - - // Store to the destination session - L3StoreIpPacketToIf(f, dst, packet); - - return; - -FREE_PACKET: - // Release the packet - Free(p->PacketData); - FreePacket(p); - return; -} - -// Process the Layer 2 packet -void L3RecvL2(L3IF *f, PKT *p) -{ - // Validate arguments - if (f == NULL || p == NULL) - { - return; - } - - // Ignore any packets except a unicast packet which is at destination - // or a packet which I sent - if (Cmp(p->MacAddressSrc, f->MacAddress, 6) == 0 || - (p->BroadcastPacket == false && Cmp(p->MacAddressDest, f->MacAddress, 6) != 0)) - { - // Release the packet - Free(p->PacketData); - FreePacket(p); - return; - } - - if (p->TypeL3 == L3_ARPV4) - { - // Received an ARP packet - L3RecvArp(f, p); - - // Release the packet - Free(p->PacketData); - FreePacket(p); - } - else if (p->TypeL3 == L3_IPV4) - { - // Received an IP packet - L3RecvIp(f, p, false); - } - else - { - // Release the packet - Free(p->PacketData); - FreePacket(p); - } -} - -// Store the IP packet to a different interface -void L3StoreIpPacketToIf(L3IF *src_if, L3IF *dst_if, L3PACKET *p) -{ - // Validate arguments - if (src_if == NULL || p == NULL || dst_if == NULL) - { - return; - } - - // Add to the queue of store-destination session - InsertQueue(dst_if->IpPacketQueue, p); - - // Hit the Cancel object of the store-destination session - AddCancelList(src_if->CancelList, dst_if->Session->Cancel1); -} - -// Write the packet (Process because the packet was received) -void L3PutPacket(L3IF *f, void *data, UINT size) -{ - PKT *p; - L3SW *s; - if (f == NULL) - { - return; - } - - s = f->Switch; - - if (data != NULL) - { - // Handle the next packet - if (f->CancelList == NULL) - { - f->CancelList = NewCancelList(); - } - - // Packet analysis - p = ParsePacket(data, size); - - if (p == NULL) - { - // Packet analysis failure - Free(data); - } - else - { - // Packet analysis success - Lock(s->lock); - { - L3RecvL2(f, p); - } - Unlock(s->lock); - } - } - else - { - // Cancel for the cancellation list after all packet processing has been finished - if (f->CancelList != NULL) - { - CancelList(f->CancelList); - ReleaseCancelList(f->CancelList); - f->CancelList = NULL; - } - } -} - -// Send the waiting IP packets whose destination MAC address has been resolved -void L3SendWaitingIp(L3IF *f, UCHAR *mac, UINT ip, L3ARPENTRY *a) -{ - UINT i; - LIST *o = NULL; - // Validate arguments - if (f == NULL || mac == NULL || a == NULL) - { - return; - } - - for (i = 0;i < LIST_NUM(f->IpWaitList);i++) - { - L3PACKET *p = LIST_DATA(f->IpWaitList, i); - - if (p->NextHopIp == ip) - { - if (o == NULL) - { - o = NewListFast(NULL); - } - Add(o, p); - } - } - - if (o != NULL) - { - for (i = 0;i < LIST_NUM(o);i++) - { - L3PACKET *p = LIST_DATA(o, i); - - // Transmission - L3SendIpNow(f, a, p); - - Delete(f->IpWaitList, p); - Free(p->Packet->PacketData); - FreePacket(p->Packet); - Free(p); - } - - ReleaseList(o); - } -} - -// Register in the ARP table -void L3InsertArpTable(L3IF *f, UINT ip, UCHAR *mac) -{ - L3ARPENTRY *a, t; - // Validate arguments - if (f == NULL || ip == 0 || ip == 0xffffffff || mac == NULL) - { - return; - } - - Zero(&t, sizeof(t)); - t.IpAddress = ip; - - a = Search(f->ArpTable, &t); - - if (a == NULL) - { - // Since this is not registered, register this - a = ZeroMalloc(sizeof(L3ARPENTRY)); - a->IpAddress = ip; - Copy(a->MacAddress, mac, 6); - Insert(f->ArpTable, a); - } - - // Extend the expiration date - a->Expire = Tick64() + ARP_ENTRY_EXPIRES; - - // Send waiting IP packets - L3SendWaitingIp(f, mac, ip, a); -} - -// Function to be called when the ARP resolved -void L3KnownArp(L3IF *f, UINT ip, UCHAR *mac) -{ - L3ARPWAIT t, *w; - // Validate arguments - if (f == NULL || ip == 0 || ip == 0xffffffff || mac == NULL) - { - return; - } - - if (!((f->IpAddress & f->SubnetMask) == (ip & f->SubnetMask))) - { - // Outside the subnet - return; - } - - // Delete an ARP query entry to this IP address - Zero(&t, sizeof(t)); - t.IpAddress = ip; - w = Search(f->IpWaitList, &t); - if (w != NULL) - { - Delete(f->IpWaitList, w); - Free(w); - } - - // Register in the ARP table - L3InsertArpTable(f, ip, mac); -} - -// Issue an ARP query -void L3SendArp(L3IF *f, UINT ip) -{ - L3ARPWAIT t, *w; - // Validate arguments - if (f == NULL || ip == 0 || ip == 0xffffffff) - { - return; - } - - // Examine whether it has not already registered - Zero(&t, sizeof(t)); - t.IpAddress = ip; - w = Search(f->ArpWaitTable, &t); - - if (w != NULL) - { - // Do not do anything because it is already registered in the waiting list - return; - } - else - { - // Register in the waiting list newly - w = ZeroMalloc(sizeof(L3ARPWAIT)); - w->Expire = Tick64() + ARP_REQUEST_GIVEUP; - w->IpAddress = ip; - Insert(f->ArpWaitTable, w); - } -} - -// Received an ARP request -void L3RecvArpRequest(L3IF *f, PKT *p) -{ - ARPV4_HEADER *a; - // Validate arguments - if (f == NULL || p == NULL) - { - return; - } - - a = p->L3.ARPv4Header; - - L3KnownArp(f, a->SrcIP, a->SrcAddress); - - if (a->TargetIP == f->IpAddress) - { - // Respond only if the ARP packet addressed to myself - L3SendArpResponseNow(f, a->SrcAddress, a->SrcIP, f->IpAddress); - } -} - -// Received an ARP response -void L3RecvArpResponse(L3IF *f, PKT *p) -{ - ARPV4_HEADER *a; - // Validate arguments - if (f == NULL || p == NULL) - { - return; - } - - a = p->L3.ARPv4Header; - - L3KnownArp(f, a->SrcIP, a->SrcAddress); -} - -// Received an ARP packet -void L3RecvArp(L3IF *f, PKT *p) -{ - ARPV4_HEADER *a; - // Validate arguments - if (f == NULL || p == NULL) - { - return; - } - - a = p->L3.ARPv4Header; - - if (Endian16(a->HardwareType) != ARP_HARDWARE_TYPE_ETHERNET || - Endian16(a->ProtocolType) != MAC_PROTO_IPV4 || - a->HardwareSize != 6 || a->ProtocolSize != 4) - { - return; - } - if (Cmp(a->SrcAddress, p->MacAddressSrc, 6) != 0) - { - return; - } - - switch (Endian16(a->Operation)) - { - case ARP_OPERATION_REQUEST: - // ARP request arrives - L3RecvArpRequest(f, p); - break; - - case ARP_OPERATION_RESPONSE: - // ARP response arrives - L3RecvArpResponse(f, p); - break; - } -} - -// Send an IP packet -void L3SendIp(L3IF *f, L3PACKET *p) -{ - L3ARPENTRY *a = NULL; - bool broadcast = false; - IPV4_HEADER *ip; - bool for_me = false; - // Validate arguments - if (f == NULL || p == NULL) - { - return; - } - if (p->Packet->TypeL3 != L3_IPV4) - { - return; - } - - ip = p->Packet->L3.IPv4Header; - - // Determining whether it's a broadcast - if (p->NextHopIp == 0xffffffff || - ((p->NextHopIp & f->SubnetMask) == (f->IpAddress & f->SubnetMask)) && - ((p->NextHopIp & (~f->SubnetMask)) == (~f->SubnetMask))) - { - broadcast = true; - } - - if (broadcast == false && ip->DstIP == f->IpAddress) - { - // me? - } - else if (broadcast == false) - { - // Examine whether the ARP entry contains this in the case of unicast - a = L3SearchArpTable(f, p->NextHopIp); - - if (a == NULL) - { - // Since It is not in the ARP table, - // insert it into the IP waiting list without sending immediately - p->Expire = Tick64() + IP_WAIT_FOR_ARP_TIMEOUT; - - Insert(f->IpWaitList, p); - - // Issue an ARP query - L3SendArp(f, p->NextHopIp); - return; - } - } - - if (for_me == false) - { - // Send the IP packet - L3SendIpNow(f, a, p); - } - - // Release the packet - Free(p->Packet->PacketData); - FreePacket(p->Packet); - Free(p); -} - -// Send the IP packet immediately -void L3SendIpNow(L3IF *f, L3ARPENTRY *a, L3PACKET *p) -{ - // Validate arguments - if (f == NULL || p == NULL) - { - return; - } - - L3SendL2Now(f, a != NULL ? a->MacAddress : broadcast, f->MacAddress, Endian16(p->Packet->MacHeader->Protocol), - p->Packet->L3.PointerL3, p->Packet->PacketSize - sizeof(MAC_HEADER)); -} - -// Search in the ARP table -L3ARPENTRY *L3SearchArpTable(L3IF *f, UINT ip) -{ - L3ARPENTRY *e, t; - // Validate arguments - if (f == NULL || ip == 0 || ip == 0xffffffff) - { - return NULL; - } - - Zero(&t, sizeof(t)); - t.IpAddress = ip; - - e = Search(f->ArpTable, &t); - - return e; -} - -// Send an ARP request packet -void L3SendArpRequestNow(L3IF *f, UINT dest_ip) -{ - ARPV4_HEADER arp; - // Validate arguments - if (f == NULL) - { - return; - } - - // Build an ARP header - arp.HardwareType = Endian16(ARP_HARDWARE_TYPE_ETHERNET); - arp.ProtocolType = Endian16(MAC_PROTO_IPV4); - arp.HardwareSize = 6; - arp.ProtocolSize = 4; - arp.Operation = Endian16(ARP_OPERATION_REQUEST); - Copy(arp.SrcAddress, f->MacAddress, 6); - arp.SrcIP = f->IpAddress; - Zero(&arp.TargetAddress, 6); - arp.TargetIP = dest_ip; - - // Transmission - L3SendL2Now(f, broadcast, f->MacAddress, MAC_PROTO_ARPV4, &arp, sizeof(arp)); -} - -// Send an ARP response packet -void L3SendArpResponseNow(L3IF *f, UCHAR *dest_mac, UINT dest_ip, UINT src_ip) -{ - ARPV4_HEADER arp; - // Validate arguments - if (f == NULL || dest_mac == NULL) - { - return; - } - - // Build a header - arp.HardwareType = Endian16(ARP_HARDWARE_TYPE_ETHERNET); - arp.ProtocolType = Endian16(MAC_PROTO_IPV4); - arp.HardwareSize = 6; - arp.ProtocolSize = 4; - arp.Operation = Endian16(ARP_OPERATION_RESPONSE); - Copy(arp.SrcAddress, f->MacAddress, 6); - Copy(arp.TargetAddress, dest_mac, 6); - arp.SrcIP = src_ip; - arp.TargetIP = dest_ip; - - // Transmission - L3SendL2Now(f, dest_mac, f->MacAddress, MAC_PROTO_ARPV4, &arp, sizeof(arp)); -} - -// Generate a MAC address of the interface -void L3GenerateMacAddress(L3IF *f) -{ - BUF *b; - UCHAR hash[SHA1_SIZE]; - // Validate arguments - if (f == NULL) - { - return; - } - - b = NewBuf(); - WriteBuf(b, f->Switch->Name, StrLen(f->Switch->Name)); - WriteBuf(b, f->HubName, StrLen(f->HubName)); - WriteBuf(b, &f->IpAddress, sizeof(f->IpAddress)); - - GenMacAddress(f->MacAddress); - Sha0(hash, b->Buf, b->Size); - Copy(f->MacAddress + 2, hash, 4); - f->MacAddress[1] = 0xA3; - FreeBuf(b); -} - -// Send an L2 packet immediately -void L3SendL2Now(L3IF *f, UCHAR *dest_mac, UCHAR *src_mac, USHORT protocol, void *data, UINT size) -{ - UCHAR *buf; - MAC_HEADER *mac_header; - PKT *p; - // Validate arguments - if (f == NULL || dest_mac == NULL || src_mac == NULL || data == NULL) - { - return; - } - - // Buffer creation - buf = Malloc(MAC_HEADER_SIZE + size); - - // MAC header - mac_header = (MAC_HEADER *)&buf[0]; - Copy(mac_header->DestAddress, dest_mac, 6); - Copy(mac_header->SrcAddress, src_mac, 6); - mac_header->Protocol = Endian16(protocol); - - // Copy data - Copy(&buf[sizeof(MAC_HEADER)], data, size); - - // Size - size += sizeof(MAC_HEADER); - - // Packet generation - p = ZeroMalloc(sizeof(PKT)); - p->PacketData = buf; - p->PacketSize = size; - - // Add to the queue - InsertQueue(f->SendQueue, p); -} - -// Polling for the ARP resolution waiting list -void L3PollingArpWaitTable(L3IF *f) -{ - UINT i; - LIST *o = NULL; - // Validate arguments - if (f == NULL) - { - return; - } - - for (i = 0;i < LIST_NUM(f->ArpWaitTable);i++) - { - L3ARPWAIT *w = LIST_DATA(f->ArpWaitTable, i); - - if (w->Expire <= Tick64()) - { - // The ARP request entry is expired - if (o == NULL) - { - o = NewListFast(NULL); - } - - Insert(o, w); - } - else if ((w->LastSentTime + ARP_REQUEST_TIMEOUT) <= Tick64()) - { - // Send a next ARP request packet - w->LastSentTime = Tick64(); - - L3SendArpRequestNow(f, w->IpAddress); - } - } - - if (o != NULL) - { - for (i = 0;i < LIST_NUM(o);i++) - { - L3ARPWAIT *w = LIST_DATA(o, i); - - Delete(f->ArpWaitTable, w); - Free(w); - } - - ReleaseList(o); - } -} - -// Clear old ARP table entries -void L3DeleteOldArpTable(L3IF *f) -{ - UINT i; - LIST *o = NULL; - // Validate arguments - if (f == NULL) - { - return; - } - - if ((f->LastDeleteOldArpTable + ARP_ENTRY_POLLING_TIME) > Tick64()) - { - return; - } - f->LastDeleteOldArpTable = Tick64(); - - for (i = 0;i < LIST_NUM(f->ArpTable);i++) - { - L3ARPENTRY *a = LIST_DATA(f->ArpTable, i); - - if (a->Expire <= Tick64()) - { - // Expired - if (o == NULL) - { - o = NewListFast(NULL); - } - - Insert(o, a); - } - } - - if (o != NULL) - { - for (i = 0;i < LIST_NUM(o);i++) - { - L3ARPENTRY *a = LIST_DATA(o, i); - - Delete(f->ArpTable, a); - Free(a); - } - - ReleaseList(o); - } -} - -// Clear the IP waiting list -void L3DeleteOldIpWaitList(L3IF *f) -{ - UINT i; - LIST *o = NULL; - // Validate arguments - if (f == NULL) - { - return; - } - - for (i = 0;i < LIST_NUM(f->IpWaitList);i++) - { - L3PACKET *p = LIST_DATA(f->IpWaitList, i); - - if (p->Expire <= Tick64()) - { - if (o == NULL) - { - o = NewListFast(NULL); - } - - Insert(o, p); - } - } - - if (o != NULL) - { - for (i = 0;i < LIST_NUM(o);i++) - { - L3PACKET *p = LIST_DATA(o, i); - - Delete(f->IpWaitList, p); - - Free(p->Packet->PacketData); - FreePacket(p->Packet); - Free(p); - } - - ReleaseList(o); - } -} - -// Beacon transmission -void L3PollingBeacon(L3IF *f) -{ - // Validate arguments - if (f == NULL) - { - return; - } - - if (f->LastBeaconSent == 0 || - (f->LastBeaconSent + BEACON_SEND_INTERVAL) <= Tick64()) - { - UINT dest_ip; - UCHAR *udp_buf; - UINT udp_buf_size; - ARPV4_HEADER arp; - IPV4_HEADER *ip; - UDP_HEADER *udp; - static char beacon_str[] = - "PacketiX VPN Virtual Layer-3 Switch Beacon"; - - // Send an UDP - dest_ip = (f->IpAddress & f->SubnetMask) | (~f->SubnetMask); - udp_buf_size = sizeof(IPV4_HEADER) + sizeof(UDP_HEADER) + sizeof(beacon_str); - udp_buf = ZeroMalloc(udp_buf_size); - - ip = (IPV4_HEADER *)udp_buf; - udp = (UDP_HEADER *)(udp_buf + sizeof(IPV4_HEADER)); - udp->DstPort = Endian16(7); - udp->SrcPort = Endian16(7); - udp->PacketLength = Endian16(sizeof(UDP_HEADER) + sizeof(beacon_str)); - - Copy(udp_buf + sizeof(IPV4_HEADER) + sizeof(UDP_HEADER), beacon_str, sizeof(beacon_str)); - - udp->Checksum = CalcChecksumForIPv4(f->IpAddress, dest_ip, 0x11, udp, sizeof(UDP_HEADER) + sizeof(beacon_str), 0); - - ip->DstIP = dest_ip; - IPV4_SET_VERSION(ip, 4); - IPV4_SET_HEADER_LEN(ip, (IP_HEADER_SIZE / 4)); - ip->TypeOfService = DEFAULT_IP_TOS; - ip->TotalLength = Endian16((USHORT)(udp_buf_size)); - ip->TimeToLive = DEFAULT_IP_TTL; - ip->Protocol = IP_PROTO_UDP; - ip->SrcIP = f->IpAddress; - ip->Checksum = IpChecksum(ip, IP_HEADER_SIZE); - - L3SendL2Now(f, broadcast, f->MacAddress, MAC_PROTO_IPV4, udp_buf, udp_buf_size); - - Free(udp_buf); - - // Build the ARP header - arp.HardwareType = Endian16(ARP_HARDWARE_TYPE_ETHERNET); - arp.ProtocolType = Endian16(MAC_PROTO_IPV4); - arp.HardwareSize = 6; - arp.ProtocolSize = 4; - arp.Operation = Endian16(ARP_OPERATION_RESPONSE); - Copy(arp.SrcAddress, f->MacAddress, 6); - arp.SrcIP = f->IpAddress; - arp.TargetAddress[0] = - arp.TargetAddress[1] = - arp.TargetAddress[2] = - arp.TargetAddress[3] = - arp.TargetAddress[4] = - arp.TargetAddress[5] = 0xff; - arp.TargetIP = dest_ip; - - // Transmission - L3SendL2Now(f, broadcast, f->MacAddress, MAC_PROTO_ARPV4, &arp, sizeof(arp)); - - f->LastBeaconSent = Tick64(); - } -} - -// Polling process -void L3Polling(L3IF *f) -{ - L3SW *s; - // Validate arguments - if (f == NULL) - { - return; - } - - s = f->Switch; - - // Lock the entire switch in the middle of the polling process - Lock(s->lock); - { - // Beacon transmission - L3PollingBeacon(f); - - // Process the IP queue - L3PollingIpQueue(f); - - // Clear old ARP table entries - L3DeleteOldArpTable(f); - - // Polling ARP resolution waiting list - L3PollingArpWaitTable(f); - - // Clear the IP waiting list - L3DeleteOldIpWaitList(f); - } - Unlock(s->lock); -} - -// Get the next packet -UINT L3GetNextPacket(L3IF *f, void **data) -{ - UINT ret = 0; - // Validate arguments - if (f == NULL || data == NULL) - { - return 0; - } - -START: - // Examine the send queue - LockQueue(f->SendQueue); - { - PKT *p = GetNext(f->SendQueue); - - if (p != NULL) - { - // There is a packet - ret = p->PacketSize; - *data = p->PacketData; - // Packet structure may be discarded - Free(p); - } - } - UnlockQueue(f->SendQueue); - - if (ret == 0) - { - // Polling process - L3Polling(f); - - // Examine whether a new packet is queued for results of the polling process - if (f->SendQueue->num_item != 0) - { - // Get the packet immediately if it's in the queue - goto START; - } - } - - return ret; -} - -// Determine the packet destined for the specified IP address should be sent to which interface -L3IF *L3GetNextIf(L3SW *s, UINT ip, UINT *next_hop) -{ - UINT i; - L3IF *f; - UINT next_hop_ip = 0; - // Validate arguments - if (s == NULL || ip == 0 || ip == 0xffffffff) - { - return NULL; - } - - f = NULL; - - // Examine whether the specified IP address is contained - // in the networks which each interfaces belong to - for (i = 0;i < LIST_NUM(s->IfList);i++) - { - L3IF *ff = LIST_DATA(s->IfList, i); - - if ((ff->IpAddress & ff->SubnetMask) == (ip & ff->SubnetMask)) - { - f = ff; - next_hop_ip = ip; - break; - } - } - - if (f == NULL) - { - // Find the routing table if it's not found - L3TABLE *t = L3GetBestRoute(s, ip); - - if (t == NULL) - { - // Still not found - return NULL; - } - else - { - // Find the interface with the IP address of the router of - // NextHop of the found route - for (i = 0;i < LIST_NUM(s->IfList);i++) - { - L3IF *ff = LIST_DATA(s->IfList, i); - - if ((ff->IpAddress & ff->SubnetMask) == (t->GatewayAddress & ff->SubnetMask)) - { - f = ff; - next_hop_ip = t->GatewayAddress; - break; - } - } - } - } - - if (f == NULL) - { - // Destination interface was unknown after all - return NULL; - } - - if (next_hop != NULL) - { - *next_hop = next_hop_ip; - } - - return f; -} - -// Get the best routing table entry for the specified IP address -L3TABLE *L3GetBestRoute(L3SW *s, UINT ip) -{ - UINT i; - UINT max_mask = 0; - UINT min_metric = INFINITE; - L3TABLE *ret = NULL; - // Validate arguments - if (s == NULL || ip == 0) - { - return NULL; - } - - // 1st condition: Choose the one which have the largest subnet mask - // 2nd condition: Choose the one which have the smallest metric - for (i = 0;i < LIST_NUM(s->TableList);i++) - { - L3TABLE *t = LIST_DATA(s->TableList, i); - - if ((t->NetworkAddress & t->SubnetMask) == (ip & t->SubnetMask)) - { - if (t->SubnetMask >= max_mask) - { - max_mask = t->SubnetMask; - if (min_metric >= t->Metric) - { - min_metric = t->Metric; - ret = t; - } - } - } - } - - return ret; -} - -// Initialize the Layer-3 interface -void L3InitInterface(L3IF *f) -{ - // Validate arguments - if (f == NULL) - { - return; - } - - // MAC address generation - L3GenerateMacAddress(f); - - // List generation - f->ArpTable = NewList(CmpL3ArpEntry); - f->ArpWaitTable = NewList(CmpL3ArpWaitTable); - f->IpPacketQueue = NewQueue(); - f->IpWaitList = NewList(NULL); - f->SendQueue = NewQueue(); -} - -// Release the Layer-3 interface -void L3FreeInterface(L3IF *f) -{ - UINT i; - L3PACKET *p; - PKT *pkt; - // Validate arguments - if (f == NULL) - { - return; - } - - for (i = 0;i < LIST_NUM(f->ArpTable);i++) - { - L3ARPENTRY *a = LIST_DATA(f->ArpTable, i); - Free(a); - } - ReleaseList(f->ArpTable); - f->ArpTable = NULL; - - for (i = 0;i < LIST_NUM(f->ArpWaitTable);i++) - { - L3ARPWAIT *w = LIST_DATA(f->ArpWaitTable, i); - Free(w); - } - ReleaseList(f->ArpWaitTable); - f->ArpWaitTable = NULL; - - while (p = GetNext(f->IpPacketQueue)) - { - Free(p->Packet->PacketData); - FreePacket(p->Packet); - Free(p); - } - ReleaseQueue(f->IpPacketQueue); - f->IpPacketQueue = NULL; - - for (i = 0;i < LIST_NUM(f->IpWaitList);i++) - { - L3PACKET *p = LIST_DATA(f->IpWaitList, i); - Free(p->Packet->PacketData); - FreePacket(p->Packet); - Free(p); - } - ReleaseList(f->IpWaitList); - f->IpWaitList = NULL; - - while (pkt = GetNext(f->SendQueue)) - { - Free(pkt->PacketData); - FreePacket(pkt); - } - ReleaseQueue(f->SendQueue); - f->SendQueue = NULL; -} - -// Layer-3 interface thread -void L3IfThread(THREAD *t, void *param) -{ - L3IF *f; - CONNECTION *c; - SESSION *s; - POLICY *policy; - char tmp[MAX_SIZE]; - char name[MAX_SIZE]; - char username[MAX_SIZE]; - // Validate arguments - if (t == NULL || param == NULL) - { - return; - } - - f = (L3IF *)param; - - StrCpy(username, sizeof(username), L3_USERNAME); - if (f->Switch != NULL) - { - StrCat(username, sizeof(username), f->Switch->Name); - } - - // Create a connection - c = NewServerConnection(f->Switch->Cedar, NULL, t); - c->Protocol = CONNECTION_HUB_LAYER3; - - // Create a Session - policy = ClonePolicy(GetDefaultPolicy()); - // Not to limit the number of broadcast by policy - policy->NoBroadcastLimiter = true; - s = NewServerSession(f->Switch->Cedar, c, f->Hub, username, policy); - c->Session = s; - - ReleaseConnection(c); - - // Determine the name of the session - GetMachineHostName(tmp, sizeof(tmp)); - if (f->Switch->Cedar->Server->ServerType == SERVER_TYPE_STANDALONE) - { - Format(name, sizeof(name), "SID-L3-%s-%u", f->Switch->Name, Inc(f->Hub->SessionCounter)); - } - else - { - Format(name, sizeof(name), "SID-L3-%s-%s-%u", tmp, f->Switch->Name, Inc(f->Hub->SessionCounter)); - } - ConvertSafeFileName(name, sizeof(name), name); - StrUpper(name); - - Free(s->Name); - s->Name = CopyStr(name); - - s->L3SwitchMode = true; - s->L3If = f; - - if (s->Username != NULL) - { - Free(s->Username); - } - s->Username = CopyStr(username); - - StrCpy(s->UserNameReal, sizeof(s->UserNameReal), username); - - f->Session = s; - AddRef(s->ref); - - // Notify the initialization completion - NoticeThreadInit(t); - - // Session main process - SessionMain(s); - - // Release the session - ReleaseSession(s); -} - -// Initialize all Layer-3 interfaces -void L3InitAllInterfaces(L3SW *s) -{ - UINT i; - // Validate arguments - if (s == NULL) - { - return; - } - - for (i = 0;i < LIST_NUM(s->IfList);i++) - { - L3IF *f = LIST_DATA(s->IfList, i); - THREAD *t; - - L3InitInterface(f); - - f->Hub = GetHub(s->Cedar, f->HubName); - t = NewThread(L3IfThread, f); - WaitThreadInit(t); - ReleaseThread(t); - } -} - -// Release all Layer-3 interfaces -void L3FreeAllInterfaces(L3SW *s) -{ - UINT i; - // Validate arguments - if (s == NULL) - { - return; - } - - for (i = 0;i < LIST_NUM(s->IfList);i++) - { - L3IF *f = LIST_DATA(s->IfList, i); - - ReleaseHub(f->Hub); - f->Hub = NULL; - ReleaseSession(f->Session); - f->Session = NULL; - - L3FreeInterface(f); - } -} - -// Layer-3 test -void L3Test(SERVER *s) -{ - L3SW *ss = L3AddSw(s->Cedar, "TEST"); - L3AddIf(ss, "DEFAULT", 0x0101a8c0, 0x00ffffff); - L3AddIf(ss, "DEFAULT2", 0x0102a8c0, 0x00ffffff); - L3SwStart(ss); - ReleaseL3Sw(ss); -} - -// Layer-3 switch thread -void L3SwThread(THREAD *t, void *param) -{ - L3SW *s; - bool shutdown_now = false; - // Validate arguments - if (t == NULL || param == NULL) - { - return; - } - - s = (L3SW *)param; - - s->Active = true; - - NoticeThreadInit(t); - - // Operation start - SLog(s->Cedar, "L3_SWITCH_START", s->Name); - - while (s->Halt == false) - { - if (s->Online == false) - { - // Because the L3 switch is off-line now, - // attempt to make it on-line periodically - LockList(s->Cedar->HubList); - { - Lock(s->lock); - { - UINT i; - UINT n = 0; - bool all_exists = true; - if (LIST_NUM(s->IfList) == 0) - { - // Don't operate if there is no interface - all_exists = false; - } - for (i = 0;i < LIST_NUM(s->IfList);i++) - { - L3IF *f = LIST_DATA(s->IfList, i); - HUB *h = GetHub(s->Cedar, f->HubName); - - if (h != NULL) - { - if (h->Offline || h->Type == HUB_TYPE_FARM_DYNAMIC) - { - all_exists = false; - } - else - { - n++; - } - ReleaseHub(h); - } - else - { - all_exists = false; - } - } - - if (all_exists && n >= 1) - { - // Start the operation because all Virtual HUBs for - // interfaces are enabled - SLog(s->Cedar, "L3_SWITCH_ONLINE", s->Name); - L3InitAllInterfaces(s); - s->Online = true; - } - } - Unlock(s->lock); - } - UnlockList(s->Cedar->HubList); - } - else - { - // Examine periodically whether all sessions terminated - UINT i; - bool any_halted = false; - LIST *o = NULL; - -SHUTDOWN: - - Lock(s->lock); - { - for (i = 0;i < LIST_NUM(s->IfList);i++) - { - L3IF *f = LIST_DATA(s->IfList, i); - if (f->Session->Halt || f->Hub->Offline != false) - { - any_halted = true; - break; - } - } - - if (shutdown_now) - { - any_halted = true; - } - - if (any_halted) - { - SLog(s->Cedar, "L3_SWITCH_OFFLINE", s->Name); - o = NewListFast(NULL); - // If there is any terminated session, terminate all sessions - for (i = 0;i < LIST_NUM(s->IfList);i++) - { - L3IF *f = LIST_DATA(s->IfList, i); - Insert(o, f->Session); - } - - // Restore to the offline - s->Online = false; - } - } - Unlock(s->lock); - - if (o != NULL) - { - UINT i; - for (i = 0;i < LIST_NUM(o);i++) - { - SESSION *s = LIST_DATA(o, i); - StopSession(s); - } - L3FreeAllInterfaces(s); - ReleaseList(o); - o = NULL; - } - } - - SleepThread(50); - } - - if (s->Online != false) - { - shutdown_now = true; - goto SHUTDOWN; - } - - // Stop the operation - SLog(s->Cedar, "L3_SWITCH_STOP", s->Name); -} - -// Start a Layer-3 switch -void L3SwStart(L3SW *s) -{ - // Validate arguments - if (s == NULL) - { - return; - } - - Lock(s->lock); - { - if (s->Active == false) - { - // Start if there is registered interface - if (LIST_NUM(s->IfList) >= 1) - { - s->Halt = false; - - // Create a thread - s->Thread = NewThread(L3SwThread, s); - WaitThreadInit(s->Thread); - } - } - } - Unlock(s->lock); -} - -// Stop the Layer-3 switch -void L3SwStop(L3SW *s) -{ - THREAD *t = NULL; - // Validate arguments - if (s == NULL) - { - return; - } - - Lock(s->lock); - { - if (s->Active == false) - { - Unlock(s->lock); - return; - } - - s->Halt = true; - - t = s->Thread; - - s->Active = false; - } - Unlock(s->lock); - - WaitThread(t, INFINITE); - ReleaseThread(t); -} - -// Add a Layer-3 switch -L3SW *L3AddSw(CEDAR *c, char *name) -{ - L3SW *s = NULL; - // Validate arguments - if (c == NULL || name == NULL) - { - return NULL; - } - - LockList(c->L3SwList); - { - s = L3GetSw(c, name); - - if (s == NULL) - { - s = NewL3Sw(c, name); - - Insert(c->L3SwList, s); - - AddRef(s->ref); - } - else - { - ReleaseL3Sw(s); - s = NULL; - } - } - UnlockList(c->L3SwList); - - return s; -} - -// Delete the Layer-3 switch -bool L3DelSw(CEDAR *c, char *name) -{ - L3SW *s; - bool ret = false; - // Validate arguments - if (c == NULL || name == NULL) - { - return false; - } - - LockList(c->L3SwList); - { - s = L3GetSw(c, name); - - if (s != NULL) - { - // Stop and delete - L3SwStop(s); - Delete(c->L3SwList, s); - ReleaseL3Sw(s); - ReleaseL3Sw(s); - - ret = true; - } - } - UnlockList(c->L3SwList); - - return ret; -} - - -// Delete the routing table -bool L3DelTable(L3SW *s, L3TABLE *tbl) -{ - bool ret = false; - // Validate arguments - if (s == NULL || tbl == NULL) - { - return false; - } - - Lock(s->lock); - { - if (s->Active == false) - { - L3TABLE *t = Search(s->TableList, tbl); - - if (t != NULL) - { - Delete(s->TableList, t); - Free(t); - - ret = true; - } - } - } - Unlock(s->lock); - - return ret; -} - -// Add to the routing table -bool L3AddTable(L3SW *s, L3TABLE *tbl) -{ - bool ret = false; - // Validate arguments - if (s == NULL || tbl == NULL) - { - return false; - } - - if (tbl->Metric == 0 || tbl->GatewayAddress == 0 || tbl->GatewayAddress == 0xffffffff) - { - return false; - } - - Lock(s->lock); - { - if (LIST_NUM(s->TableList) >= GetServerCapsInt(s->Cedar->Server, "i_max_l3_table")) - { - // Too many - } - else - { - // Create - if (s->Active == false) - { - if (Search(s->TableList, tbl) == NULL) - { - L3TABLE *t = ZeroMalloc(sizeof(L3TABLE)); - - Copy(t, tbl, sizeof(L3TABLE)); - - Insert(s->TableList, t); - - ret = true; - } - } - } - } - Unlock(s->lock); - - return ret; -} - -// Get the L3 switch -L3SW *L3GetSw(CEDAR *c, char *name) -{ - L3SW t, *s; - // Validate arguments - if (c == NULL || name == NULL) - { - return NULL; - } - - Zero(&t, sizeof(t)); - StrCpy(t.Name, sizeof(t.Name), name); - - LockList(c->L3SwList); - { - s = Search(c->L3SwList, &t); - } - UnlockList(c->L3SwList); - - if (s != NULL) - { - AddRef(s->ref); - } - - return s; -} - -// Get the interface that is connected to the specified Virtual HUB from the L3 switch -L3IF *L3SearchIf(L3SW *s, char *hubname) -{ - L3IF t, *f; - // Validate arguments - if (s == NULL || hubname == NULL) - { - return NULL; - } - - Zero(&t, sizeof(t)); - StrCpy(t.HubName, sizeof(t.HubName), hubname); - - f = Search(s->IfList, &t); - - return f; -} - -// Delete the interface -bool L3DelIf(L3SW *s, char *hubname) -{ - L3IF *f; - bool ret = false; - // Validate arguments - if (s == NULL || hubname == NULL) - { - return false; - } - - Lock(s->lock); - { - if (s->Active == false) - { - f = L3SearchIf(s, hubname); - - if (f != NULL) - { - // Remove - Delete(s->IfList, f); - Free(f); - - ret = true; - } - } - } - Unlock(s->lock); - - return ret; -} - -// Add an interface -bool L3AddIf(L3SW *s, char *hubname, UINT ip, UINT subnet) -{ - L3IF *f; - bool ret = false; - // Validate arguments - if (s == NULL || hubname == NULL || IsSafeStr(hubname) == false || - ip == 0 || ip == 0xffffffff) - { - return false; - } - - Lock(s->lock); - { - if (LIST_NUM(s->TableList) >= GetServerCapsInt(s->Cedar->Server, "i_max_l3_if")) - { - // Too many - } - else - { - if (s->Active == false) - { - // Examine whether the interface is already in the same Virtual HUB - if (L3SearchIf(s, hubname) == NULL) - { - // Add - f = ZeroMalloc(sizeof(L3IF)); - - f->Switch = s; - StrCpy(f->HubName, sizeof(f->HubName), hubname); - f->IpAddress = ip; - f->SubnetMask = subnet; - - Insert(s->IfList, f); - - ret = true; - } - } - } - } - Unlock(s->lock); - - return ret; -} - -// Clean-up the L3 switch -void CleanupL3Sw(L3SW *s) -{ - UINT i; - // Validate arguments - if (s == NULL) - { - return; - } - - for (i = 0;i < LIST_NUM(s->IfList);i++) - { - L3IF *f = LIST_DATA(s->IfList, i); - Free(f); - } - ReleaseList(s->IfList); - - for (i = 0;i < LIST_NUM(s->TableList);i++) - { - L3TABLE *t = LIST_DATA(s->TableList, i); - Free(t); - } - ReleaseList(s->TableList); - - DeleteLock(s->lock); - Free(s); -} - -// Release the L3 switch -void ReleaseL3Sw(L3SW *s) -{ - // Validate arguments - if (s == NULL) - { - return; - } - - if (Release(s->ref) == 0) - { - CleanupL3Sw(s); - } -} - -// Create a new L3 switch -L3SW *NewL3Sw(CEDAR *c, char *name) -{ - L3SW *o; - // Validate arguments - if (c == NULL || name == NULL) - { - return NULL; - } - - o = ZeroMalloc(sizeof(L3SW)); - - StrCpy(o->Name, sizeof(o->Name), name); - - o->lock = NewLock(); - o->ref = NewRef(); - o->Cedar = c; - o->Active = false; - - o->IfList = NewList(CmpL3If); - o->TableList = NewList(CmpL3Table); - - return o; -} - -// Stop all L3 switches in the Cedar -void L3FreeAllSw(CEDAR *c) -{ - LIST *o; - UINT i; - // Validate arguments - if (c == NULL) - { - return; - } - - o = NewListFast(NULL); - - LockList(c->L3SwList); - { - for (i = 0;i < LIST_NUM(c->L3SwList);i++) - { - L3SW *s = LIST_DATA(c->L3SwList, i); - Insert(o, CopyStr(s->Name)); - } - - for (i = 0;i < LIST_NUM(o);i++) - { - char *name = LIST_DATA(o, i); - - L3DelSw(c, name); - - Free(name); - } - - ReleaseList(o); - } - UnlockList(c->L3SwList); -} - -// Stop the L3 switch function of the Cedar -void FreeCedarLayer3(CEDAR *c) -{ - // Validate arguments - if (c == NULL) - { - return; - } - - ReleaseList(c->L3SwList); - c->L3SwList = NULL; -} - -// Start the L3 switch function of the Cedar -void InitCedarLayer3(CEDAR *c) -{ - // Validate arguments - if (c == NULL) - { - return; - } - - c->L3SwList = NewList(CmpL3Sw); -} - -// Interface comparison function -int CmpL3If(void *p1, void *p2) -{ - L3IF *f1, *f2; - if (p1 == NULL || p2 == NULL) - { - return 0; - } - f1 = *(L3IF **)p1; - f2 = *(L3IF **)p2; - if (f1 == NULL || f2 == NULL) - { - return 0; - } - - return StrCmpi(f1->HubName, f2->HubName); -} - -// Routing table entry comparison function -int CmpL3Table(void *p1, void *p2) -{ - L3TABLE *t1, *t2; - if (p1 == NULL || p2 == NULL) - { - return 0; - } - t1 = *(L3TABLE **)p1; - t2 = *(L3TABLE **)p2; - if (t1 == NULL || t2 == NULL) - { - return 0; - } - - if (t1->NetworkAddress > t2->NetworkAddress) - { - return 1; - } - else if (t1->NetworkAddress < t2->NetworkAddress) - { - return -1; - } - else if (t1->SubnetMask > t2->SubnetMask) - { - return 1; - } - else if (t1->SubnetMask < t2->SubnetMask) - { - return -1; - } - else if (t1->GatewayAddress > t2->GatewayAddress) - { - return 1; - } - else if (t1->GatewayAddress < t2->GatewayAddress) - { - return -1; - } - else if (t1->Metric > t2->Metric) - { - return 1; - } - else if (t1->Metric < t2->Metric) - { - return -1; - } - else - { - return 0; - } -} - -// L3SW comparison function -int CmpL3Sw(void *p1, void *p2) -{ - L3SW *s1, *s2; - if (p1 == NULL || p2 == NULL) - { - return 0; - } - s1 = *(L3SW **)p1; - s2 = *(L3SW **)p2; - if (s1 == NULL || s2 == NULL) - { - return 0; - } - - return StrCmpi(s1->Name, s2->Name); -} - -// ARP waiting entry comparison function -int CmpL3ArpWaitTable(void *p1, void *p2) -{ - L3ARPWAIT *w1, *w2; - if (p1 == NULL || p2 == NULL) - { - return 0; - } - w1 = *(L3ARPWAIT **)p1; - w2 = *(L3ARPWAIT **)p2; - if (w1 == NULL || w2 == NULL) - { - return 0; - } - if (w1->IpAddress > w2->IpAddress) - { - return 1; - } - else if (w1->IpAddress < w2->IpAddress) - { - return -1; - } - else - { - return 0; - } -} - -// ARP entries comparison function -int CmpL3ArpEntry(void *p1, void *p2) -{ - L3ARPENTRY *e1, *e2; - if (p1 == NULL || p2 == NULL) - { - return 0; - } - e1 = *(L3ARPENTRY **)p1; - e2 = *(L3ARPENTRY **)p2; - if (e1 == NULL || e2 == NULL) - { - return 0; - } - if (e1->IpAddress > e2->IpAddress) - { - return 1; - } - else if (e1->IpAddress < e2->IpAddress) - { - return -1; - } - else - { - return 0; - } -} - +// SoftEther VPN Source Code - Developer Edition Master Branch +// Cedar Communication Module + + +// Layer3.c +// Layer-3 switch module + +#include "CedarPch.h" + +static UCHAR broadcast[6] = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff}; + +// Process the IP queue +void L3PollingIpQueue(L3IF *f) +{ + L3PACKET *p; + // Validate arguments + if (f == NULL) + { + return; + } + + // Process the packet came from another session + while (p = GetNext(f->IpPacketQueue)) + { + PKT *pkt = p->Packet; + + // Send as an IP packet + L3SendIp(f, p); + } +} + +// Process IP packets +void L3RecvIp(L3IF *f, PKT *p, bool self) +{ + IPV4_HEADER *ip; + UINT header_size; + UINT next_hop = 0; + L3IF *dst; + L3PACKET *packet; + UINT new_ttl = 0; + // Validate arguments + if (f == NULL || p == NULL) + { + return; + } + + ip = p->L3.IPv4Header; + header_size = IPV4_GET_HEADER_LEN(p->L3.IPv4Header) * 4; + + // Calculate the checksum + if (IpCheckChecksum(ip) == false) + { + // The checksum does not match + goto FREE_PACKET; + } + + // Register in the ARP table + L3KnownArp(f, ip->SrcIP, p->MacAddressSrc); + + if (p->BroadcastPacket) + { + // Not to route in the case of broadcast packet + goto FREE_PACKET; + } + + // Calculate the TTL + if (ip->TimeToLive >= 1) + { + new_ttl = ip->TimeToLive - 1; + } + else + { + new_ttl = 0; + } + + if (new_ttl == 0) + { + if (ip->DstIP != f->IpAddress) + { + UINT src_packet_size = p->PacketSize - sizeof(MAC_HEADER); + UINT icmp_packet_total_size = sizeof(MAC_HEADER) + sizeof(IPV4_HEADER) + sizeof(ICMP_HEADER) + 4 + header_size + 8; + UCHAR *buf; + IPV4_HEADER *ipv4; + ICMP_HEADER *icmpv4; + UCHAR *data; + PKT *pkt; + UINT data_size = MIN(p->PacketSize - header_size, header_size + 8); + + // Generate an ICMP message that means that the TTL has expired + buf = ZeroMalloc(icmp_packet_total_size); + ipv4 = (IPV4_HEADER *)(buf + sizeof(MAC_HEADER)); + icmpv4 = (ICMP_HEADER *)(buf + sizeof(MAC_HEADER) + sizeof(IPV4_HEADER)); + data = buf + sizeof(MAC_HEADER) + sizeof(IPV4_HEADER) + sizeof(ICMP_HEADER) + 4; + + IPV4_SET_VERSION(ipv4, 4); + IPV4_SET_HEADER_LEN(ipv4, sizeof(IPV4_HEADER) / 4); + ipv4->TotalLength = Endian16((USHORT)(icmp_packet_total_size - sizeof(MAC_HEADER))); + ipv4->TimeToLive = 0xff; + ipv4->Protocol = IP_PROTO_ICMPV4; + ipv4->SrcIP = f->IpAddress; + ipv4->DstIP = ip->SrcIP; + ipv4->Checksum = IpChecksum(ipv4, sizeof(IPV4_HEADER)); + + icmpv4->Type = 11; + Copy(data, ip, data_size); + icmpv4->Checksum = IpChecksum(icmpv4, sizeof(ICMP_HEADER) + data_size + 4); + + buf[12] = 0x08; + buf[13] = 0x00; + + pkt = ParsePacket(buf, icmp_packet_total_size); + if (pkt == NULL) + { + Free(buf); + } + else + { + L3RecvIp(f, pkt, true); + } + + // Discard the packet body whose the TTL has expired + goto FREE_PACKET; + } + } + + // Rewrite the TTL + p->L3.IPv4Header->TimeToLive = (UCHAR)new_ttl; + + // Get the interface corresponding to the destination IP address + dst = L3GetNextIf(f->Switch, ip->DstIP, &next_hop); + + if (dst == NULL && self == false) + { + UINT src_packet_size = p->PacketSize - sizeof(MAC_HEADER); + UINT icmp_packet_total_size = sizeof(MAC_HEADER) + sizeof(IPV4_HEADER) + sizeof(ICMP_HEADER) + 4 + header_size + 8; + UCHAR *buf; + IPV4_HEADER *ipv4; + ICMP_HEADER *icmpv4; + UCHAR *data; + PKT *pkt; + UINT data_size = MIN(p->PacketSize - header_size, header_size + 8); + + // Respond with ICMP that indicates that no route can be found + buf = ZeroMalloc(icmp_packet_total_size); + ipv4 = (IPV4_HEADER *)(buf + sizeof(MAC_HEADER)); + icmpv4 = (ICMP_HEADER *)(buf + sizeof(MAC_HEADER) + sizeof(IPV4_HEADER)); + data = buf + sizeof(MAC_HEADER) + sizeof(IPV4_HEADER) + sizeof(ICMP_HEADER) + 4; + + IPV4_SET_VERSION(ipv4, 4); + IPV4_SET_HEADER_LEN(ipv4, sizeof(IPV4_HEADER) / 4); + ipv4->TotalLength = Endian16((USHORT)(icmp_packet_total_size - sizeof(MAC_HEADER))); + ipv4->TimeToLive = 0xff; + ipv4->Protocol = IP_PROTO_ICMPV4; + ipv4->SrcIP = f->IpAddress; + ipv4->DstIP = ip->SrcIP; + ipv4->Checksum = IpChecksum(ipv4, sizeof(IPV4_HEADER)); + + icmpv4->Type = 3; + Copy(data, ip, data_size); + icmpv4->Checksum = IpChecksum(icmpv4, sizeof(ICMP_HEADER) + data_size + 4); + + buf[12] = 0x08; + buf[13] = 0x00; + + pkt = ParsePacket(buf, icmp_packet_total_size); + if (pkt == NULL) + { + Free(buf); + } + else + { + L3RecvIp(f, pkt, true); + } + + // Discard the packet body whose route can not be found + goto FREE_PACKET; + } + + if (dst != NULL && ip->DstIP == dst->IpAddress) + { + bool free_packet = true; + // IP packet addressed to myself has arrived + if (p->TypeL4 == L4_ICMPV4) + { + ICMP_HEADER *icmp = p->L4.ICMPHeader; + if (icmp->Type == ICMP_TYPE_ECHO_REQUEST) + { + // Reply by rewriting the source and destination of the IP packet + UINT src_ip, dst_ip; + src_ip = p->L3.IPv4Header->DstIP; + dst_ip = p->L3.IPv4Header->SrcIP; + + p->L3.IPv4Header->DstIP = dst_ip; + p->L3.IPv4Header->SrcIP = src_ip; + + ip->TimeToLive = 0xff; + + // Recalculates the checksum + ip->FlagsAndFragmentOffset[0] = ip->FlagsAndFragmentOffset[1] = 0; + icmp->Checksum = 0; + icmp->Type = ICMP_TYPE_ECHO_RESPONSE; + icmp->Checksum = IpChecksum(icmp, p->PacketSize - sizeof(MAC_HEADER) - header_size); + + dst = L3GetNextIf(f->Switch, ip->DstIP, &next_hop); + + free_packet = false; + } + } + + if (free_packet) + { + goto FREE_PACKET; + } + } + + if (dst == NULL) + { + // The destination does not exist + goto FREE_PACKET; + } + + // Recalculate the IP checksum + ip->Checksum = 0; + ip->Checksum = IpChecksum(ip, header_size); + + // Treat as a Layer-3 packet + packet = ZeroMalloc(sizeof(L3PACKET)); + packet->Expire = Tick64() + IP_WAIT_FOR_ARP_TIMEOUT; + packet->NextHopIp = next_hop; + packet->Packet = p; + + // Store to the destination session + L3StoreIpPacketToIf(f, dst, packet); + + return; + +FREE_PACKET: + // Release the packet + Free(p->PacketData); + FreePacket(p); + return; +} + +// Process the Layer 2 packet +void L3RecvL2(L3IF *f, PKT *p) +{ + // Validate arguments + if (f == NULL || p == NULL) + { + return; + } + + // Ignore any packets except a unicast packet which is at destination + // or a packet which I sent + if (Cmp(p->MacAddressSrc, f->MacAddress, 6) == 0 || + (p->BroadcastPacket == false && Cmp(p->MacAddressDest, f->MacAddress, 6) != 0)) + { + // Release the packet + Free(p->PacketData); + FreePacket(p); + return; + } + + if (p->TypeL3 == L3_ARPV4) + { + // Received an ARP packet + L3RecvArp(f, p); + + // Release the packet + Free(p->PacketData); + FreePacket(p); + } + else if (p->TypeL3 == L3_IPV4) + { + // Received an IP packet + L3RecvIp(f, p, false); + } + else + { + // Release the packet + Free(p->PacketData); + FreePacket(p); + } +} + +// Store the IP packet to a different interface +void L3StoreIpPacketToIf(L3IF *src_if, L3IF *dst_if, L3PACKET *p) +{ + // Validate arguments + if (src_if == NULL || p == NULL || dst_if == NULL) + { + return; + } + + // Add to the queue of store-destination session + InsertQueue(dst_if->IpPacketQueue, p); + + // Hit the Cancel object of the store-destination session + AddCancelList(src_if->CancelList, dst_if->Session->Cancel1); +} + +// Write the packet (Process because the packet was received) +void L3PutPacket(L3IF *f, void *data, UINT size) +{ + PKT *p; + L3SW *s; + if (f == NULL) + { + return; + } + + s = f->Switch; + + if (data != NULL) + { + // Handle the next packet + if (f->CancelList == NULL) + { + f->CancelList = NewCancelList(); + } + + // Packet analysis + p = ParsePacket(data, size); + + if (p == NULL) + { + // Packet analysis failure + Free(data); + } + else + { + // Packet analysis success + Lock(s->lock); + { + L3RecvL2(f, p); + } + Unlock(s->lock); + } + } + else + { + // Cancel for the cancellation list after all packet processing has been finished + if (f->CancelList != NULL) + { + CancelList(f->CancelList); + ReleaseCancelList(f->CancelList); + f->CancelList = NULL; + } + } +} + +// Send the waiting IP packets whose destination MAC address has been resolved +void L3SendWaitingIp(L3IF *f, UCHAR *mac, UINT ip, L3ARPENTRY *a) +{ + UINT i; + LIST *o = NULL; + // Validate arguments + if (f == NULL || mac == NULL || a == NULL) + { + return; + } + + for (i = 0;i < LIST_NUM(f->IpWaitList);i++) + { + L3PACKET *p = LIST_DATA(f->IpWaitList, i); + + if (p->NextHopIp == ip) + { + if (o == NULL) + { + o = NewListFast(NULL); + } + Add(o, p); + } + } + + if (o != NULL) + { + for (i = 0;i < LIST_NUM(o);i++) + { + L3PACKET *p = LIST_DATA(o, i); + + // Transmission + L3SendIpNow(f, a, p); + + Delete(f->IpWaitList, p); + Free(p->Packet->PacketData); + FreePacket(p->Packet); + Free(p); + } + + ReleaseList(o); + } +} + +// Register in the ARP table +void L3InsertArpTable(L3IF *f, UINT ip, UCHAR *mac) +{ + L3ARPENTRY *a, t; + // Validate arguments + if (f == NULL || ip == 0 || ip == 0xffffffff || mac == NULL) + { + return; + } + + Zero(&t, sizeof(t)); + t.IpAddress = ip; + + a = Search(f->ArpTable, &t); + + if (a == NULL) + { + // Since this is not registered, register this + a = ZeroMalloc(sizeof(L3ARPENTRY)); + a->IpAddress = ip; + Copy(a->MacAddress, mac, 6); + Insert(f->ArpTable, a); + } + + // Extend the expiration date + a->Expire = Tick64() + ARP_ENTRY_EXPIRES; + + // Send waiting IP packets + L3SendWaitingIp(f, mac, ip, a); +} + +// Function to be called when the ARP resolved +void L3KnownArp(L3IF *f, UINT ip, UCHAR *mac) +{ + L3ARPWAIT t, *w; + // Validate arguments + if (f == NULL || ip == 0 || ip == 0xffffffff || mac == NULL) + { + return; + } + + if (!((f->IpAddress & f->SubnetMask) == (ip & f->SubnetMask))) + { + // Outside the subnet + return; + } + + // Delete an ARP query entry to this IP address + Zero(&t, sizeof(t)); + t.IpAddress = ip; + w = Search(f->IpWaitList, &t); + if (w != NULL) + { + Delete(f->IpWaitList, w); + Free(w); + } + + // Register in the ARP table + L3InsertArpTable(f, ip, mac); +} + +// Issue an ARP query +void L3SendArp(L3IF *f, UINT ip) +{ + L3ARPWAIT t, *w; + // Validate arguments + if (f == NULL || ip == 0 || ip == 0xffffffff) + { + return; + } + + // Examine whether it has not already registered + Zero(&t, sizeof(t)); + t.IpAddress = ip; + w = Search(f->ArpWaitTable, &t); + + if (w != NULL) + { + // Do not do anything because it is already registered in the waiting list + return; + } + else + { + // Register in the waiting list newly + w = ZeroMalloc(sizeof(L3ARPWAIT)); + w->Expire = Tick64() + ARP_REQUEST_GIVEUP; + w->IpAddress = ip; + Insert(f->ArpWaitTable, w); + } +} + +// Received an ARP request +void L3RecvArpRequest(L3IF *f, PKT *p) +{ + ARPV4_HEADER *a; + // Validate arguments + if (f == NULL || p == NULL) + { + return; + } + + a = p->L3.ARPv4Header; + + L3KnownArp(f, a->SrcIP, a->SrcAddress); + + if (a->TargetIP == f->IpAddress) + { + // Respond only if the ARP packet addressed to myself + L3SendArpResponseNow(f, a->SrcAddress, a->SrcIP, f->IpAddress); + } +} + +// Received an ARP response +void L3RecvArpResponse(L3IF *f, PKT *p) +{ + ARPV4_HEADER *a; + // Validate arguments + if (f == NULL || p == NULL) + { + return; + } + + a = p->L3.ARPv4Header; + + L3KnownArp(f, a->SrcIP, a->SrcAddress); +} + +// Received an ARP packet +void L3RecvArp(L3IF *f, PKT *p) +{ + ARPV4_HEADER *a; + // Validate arguments + if (f == NULL || p == NULL) + { + return; + } + + a = p->L3.ARPv4Header; + + if (Endian16(a->HardwareType) != ARP_HARDWARE_TYPE_ETHERNET || + Endian16(a->ProtocolType) != MAC_PROTO_IPV4 || + a->HardwareSize != 6 || a->ProtocolSize != 4) + { + return; + } + if (Cmp(a->SrcAddress, p->MacAddressSrc, 6) != 0) + { + return; + } + + switch (Endian16(a->Operation)) + { + case ARP_OPERATION_REQUEST: + // ARP request arrives + L3RecvArpRequest(f, p); + break; + + case ARP_OPERATION_RESPONSE: + // ARP response arrives + L3RecvArpResponse(f, p); + break; + } +} + +// Send an IP packet +void L3SendIp(L3IF *f, L3PACKET *p) +{ + L3ARPENTRY *a = NULL; + bool broadcast = false; + IPV4_HEADER *ip; + bool for_me = false; + // Validate arguments + if (f == NULL || p == NULL) + { + return; + } + if (p->Packet->TypeL3 != L3_IPV4) + { + return; + } + + ip = p->Packet->L3.IPv4Header; + + // Determining whether it's a broadcast + if (p->NextHopIp == 0xffffffff || + ((p->NextHopIp & f->SubnetMask) == (f->IpAddress & f->SubnetMask)) && + ((p->NextHopIp & (~f->SubnetMask)) == (~f->SubnetMask))) + { + broadcast = true; + } + + if (broadcast == false && ip->DstIP == f->IpAddress) + { + // me? + } + else if (broadcast == false) + { + // Examine whether the ARP entry contains this in the case of unicast + a = L3SearchArpTable(f, p->NextHopIp); + + if (a == NULL) + { + // Since It is not in the ARP table, + // insert it into the IP waiting list without sending immediately + p->Expire = Tick64() + IP_WAIT_FOR_ARP_TIMEOUT; + + Insert(f->IpWaitList, p); + + // Issue an ARP query + L3SendArp(f, p->NextHopIp); + return; + } + } + + if (for_me == false) + { + // Send the IP packet + L3SendIpNow(f, a, p); + } + + // Release the packet + Free(p->Packet->PacketData); + FreePacket(p->Packet); + Free(p); +} + +// Send the IP packet immediately +void L3SendIpNow(L3IF *f, L3ARPENTRY *a, L3PACKET *p) +{ + // Validate arguments + if (f == NULL || p == NULL) + { + return; + } + + L3SendL2Now(f, a != NULL ? a->MacAddress : broadcast, f->MacAddress, Endian16(p->Packet->MacHeader->Protocol), + p->Packet->L3.PointerL3, p->Packet->PacketSize - sizeof(MAC_HEADER)); +} + +// Search in the ARP table +L3ARPENTRY *L3SearchArpTable(L3IF *f, UINT ip) +{ + L3ARPENTRY *e, t; + // Validate arguments + if (f == NULL || ip == 0 || ip == 0xffffffff) + { + return NULL; + } + + Zero(&t, sizeof(t)); + t.IpAddress = ip; + + e = Search(f->ArpTable, &t); + + return e; +} + +// Send an ARP request packet +void L3SendArpRequestNow(L3IF *f, UINT dest_ip) +{ + ARPV4_HEADER arp; + // Validate arguments + if (f == NULL) + { + return; + } + + // Build an ARP header + arp.HardwareType = Endian16(ARP_HARDWARE_TYPE_ETHERNET); + arp.ProtocolType = Endian16(MAC_PROTO_IPV4); + arp.HardwareSize = 6; + arp.ProtocolSize = 4; + arp.Operation = Endian16(ARP_OPERATION_REQUEST); + Copy(arp.SrcAddress, f->MacAddress, 6); + arp.SrcIP = f->IpAddress; + Zero(&arp.TargetAddress, 6); + arp.TargetIP = dest_ip; + + // Transmission + L3SendL2Now(f, broadcast, f->MacAddress, MAC_PROTO_ARPV4, &arp, sizeof(arp)); +} + +// Send an ARP response packet +void L3SendArpResponseNow(L3IF *f, UCHAR *dest_mac, UINT dest_ip, UINT src_ip) +{ + ARPV4_HEADER arp; + // Validate arguments + if (f == NULL || dest_mac == NULL) + { + return; + } + + // Build a header + arp.HardwareType = Endian16(ARP_HARDWARE_TYPE_ETHERNET); + arp.ProtocolType = Endian16(MAC_PROTO_IPV4); + arp.HardwareSize = 6; + arp.ProtocolSize = 4; + arp.Operation = Endian16(ARP_OPERATION_RESPONSE); + Copy(arp.SrcAddress, f->MacAddress, 6); + Copy(arp.TargetAddress, dest_mac, 6); + arp.SrcIP = src_ip; + arp.TargetIP = dest_ip; + + // Transmission + L3SendL2Now(f, dest_mac, f->MacAddress, MAC_PROTO_ARPV4, &arp, sizeof(arp)); +} + +// Generate a MAC address of the interface +void L3GenerateMacAddress(L3IF *f) +{ + BUF *b; + UCHAR hash[SHA1_SIZE]; + // Validate arguments + if (f == NULL) + { + return; + } + + b = NewBuf(); + WriteBuf(b, f->Switch->Name, StrLen(f->Switch->Name)); + WriteBuf(b, f->HubName, StrLen(f->HubName)); + WriteBuf(b, &f->IpAddress, sizeof(f->IpAddress)); + + GenMacAddress(f->MacAddress); + Sha0(hash, b->Buf, b->Size); + Copy(f->MacAddress + 2, hash, 4); + f->MacAddress[1] = 0xA3; + FreeBuf(b); +} + +// Send an L2 packet immediately +void L3SendL2Now(L3IF *f, UCHAR *dest_mac, UCHAR *src_mac, USHORT protocol, void *data, UINT size) +{ + UCHAR *buf; + MAC_HEADER *mac_header; + PKT *p; + // Validate arguments + if (f == NULL || dest_mac == NULL || src_mac == NULL || data == NULL) + { + return; + } + + // Buffer creation + buf = Malloc(MAC_HEADER_SIZE + size); + + // MAC header + mac_header = (MAC_HEADER *)&buf[0]; + Copy(mac_header->DestAddress, dest_mac, 6); + Copy(mac_header->SrcAddress, src_mac, 6); + mac_header->Protocol = Endian16(protocol); + + // Copy data + Copy(&buf[sizeof(MAC_HEADER)], data, size); + + // Size + size += sizeof(MAC_HEADER); + + // Packet generation + p = ZeroMalloc(sizeof(PKT)); + p->PacketData = buf; + p->PacketSize = size; + + // Add to the queue + InsertQueue(f->SendQueue, p); +} + +// Polling for the ARP resolution waiting list +void L3PollingArpWaitTable(L3IF *f) +{ + UINT i; + LIST *o = NULL; + // Validate arguments + if (f == NULL) + { + return; + } + + for (i = 0;i < LIST_NUM(f->ArpWaitTable);i++) + { + L3ARPWAIT *w = LIST_DATA(f->ArpWaitTable, i); + + if (w->Expire <= Tick64()) + { + // The ARP request entry is expired + if (o == NULL) + { + o = NewListFast(NULL); + } + + Insert(o, w); + } + else if ((w->LastSentTime + ARP_REQUEST_TIMEOUT) <= Tick64()) + { + // Send a next ARP request packet + w->LastSentTime = Tick64(); + + L3SendArpRequestNow(f, w->IpAddress); + } + } + + if (o != NULL) + { + for (i = 0;i < LIST_NUM(o);i++) + { + L3ARPWAIT *w = LIST_DATA(o, i); + + Delete(f->ArpWaitTable, w); + Free(w); + } + + ReleaseList(o); + } +} + +// Clear old ARP table entries +void L3DeleteOldArpTable(L3IF *f) +{ + UINT i; + LIST *o = NULL; + // Validate arguments + if (f == NULL) + { + return; + } + + if ((f->LastDeleteOldArpTable + ARP_ENTRY_POLLING_TIME) > Tick64()) + { + return; + } + f->LastDeleteOldArpTable = Tick64(); + + for (i = 0;i < LIST_NUM(f->ArpTable);i++) + { + L3ARPENTRY *a = LIST_DATA(f->ArpTable, i); + + if (a->Expire <= Tick64()) + { + // Expired + if (o == NULL) + { + o = NewListFast(NULL); + } + + Insert(o, a); + } + } + + if (o != NULL) + { + for (i = 0;i < LIST_NUM(o);i++) + { + L3ARPENTRY *a = LIST_DATA(o, i); + + Delete(f->ArpTable, a); + Free(a); + } + + ReleaseList(o); + } +} + +// Clear the IP waiting list +void L3DeleteOldIpWaitList(L3IF *f) +{ + UINT i; + LIST *o = NULL; + // Validate arguments + if (f == NULL) + { + return; + } + + for (i = 0;i < LIST_NUM(f->IpWaitList);i++) + { + L3PACKET *p = LIST_DATA(f->IpWaitList, i); + + if (p->Expire <= Tick64()) + { + if (o == NULL) + { + o = NewListFast(NULL); + } + + Insert(o, p); + } + } + + if (o != NULL) + { + for (i = 0;i < LIST_NUM(o);i++) + { + L3PACKET *p = LIST_DATA(o, i); + + Delete(f->IpWaitList, p); + + Free(p->Packet->PacketData); + FreePacket(p->Packet); + Free(p); + } + + ReleaseList(o); + } +} + +// Beacon transmission +void L3PollingBeacon(L3IF *f) +{ + // Validate arguments + if (f == NULL) + { + return; + } + + if (f->LastBeaconSent == 0 || + (f->LastBeaconSent + BEACON_SEND_INTERVAL) <= Tick64()) + { + UINT dest_ip; + UCHAR *udp_buf; + UINT udp_buf_size; + ARPV4_HEADER arp; + IPV4_HEADER *ip; + UDP_HEADER *udp; + static char beacon_str[] = + "PacketiX VPN Virtual Layer-3 Switch Beacon"; + + // Send an UDP + dest_ip = (f->IpAddress & f->SubnetMask) | (~f->SubnetMask); + udp_buf_size = sizeof(IPV4_HEADER) + sizeof(UDP_HEADER) + sizeof(beacon_str); + udp_buf = ZeroMalloc(udp_buf_size); + + ip = (IPV4_HEADER *)udp_buf; + udp = (UDP_HEADER *)(udp_buf + sizeof(IPV4_HEADER)); + udp->DstPort = Endian16(7); + udp->SrcPort = Endian16(7); + udp->PacketLength = Endian16(sizeof(UDP_HEADER) + sizeof(beacon_str)); + + Copy(udp_buf + sizeof(IPV4_HEADER) + sizeof(UDP_HEADER), beacon_str, sizeof(beacon_str)); + + udp->Checksum = CalcChecksumForIPv4(f->IpAddress, dest_ip, 0x11, udp, sizeof(UDP_HEADER) + sizeof(beacon_str), 0); + + ip->DstIP = dest_ip; + IPV4_SET_VERSION(ip, 4); + IPV4_SET_HEADER_LEN(ip, (IP_HEADER_SIZE / 4)); + ip->TypeOfService = DEFAULT_IP_TOS; + ip->TotalLength = Endian16((USHORT)(udp_buf_size)); + ip->TimeToLive = DEFAULT_IP_TTL; + ip->Protocol = IP_PROTO_UDP; + ip->SrcIP = f->IpAddress; + ip->Checksum = IpChecksum(ip, IP_HEADER_SIZE); + + L3SendL2Now(f, broadcast, f->MacAddress, MAC_PROTO_IPV4, udp_buf, udp_buf_size); + + Free(udp_buf); + + // Build the ARP header + arp.HardwareType = Endian16(ARP_HARDWARE_TYPE_ETHERNET); + arp.ProtocolType = Endian16(MAC_PROTO_IPV4); + arp.HardwareSize = 6; + arp.ProtocolSize = 4; + arp.Operation = Endian16(ARP_OPERATION_RESPONSE); + Copy(arp.SrcAddress, f->MacAddress, 6); + arp.SrcIP = f->IpAddress; + arp.TargetAddress[0] = + arp.TargetAddress[1] = + arp.TargetAddress[2] = + arp.TargetAddress[3] = + arp.TargetAddress[4] = + arp.TargetAddress[5] = 0xff; + arp.TargetIP = dest_ip; + + // Transmission + L3SendL2Now(f, broadcast, f->MacAddress, MAC_PROTO_ARPV4, &arp, sizeof(arp)); + + f->LastBeaconSent = Tick64(); + } +} + +// Polling process +void L3Polling(L3IF *f) +{ + L3SW *s; + // Validate arguments + if (f == NULL) + { + return; + } + + s = f->Switch; + + // Lock the entire switch in the middle of the polling process + Lock(s->lock); + { + // Beacon transmission + L3PollingBeacon(f); + + // Process the IP queue + L3PollingIpQueue(f); + + // Clear old ARP table entries + L3DeleteOldArpTable(f); + + // Polling ARP resolution waiting list + L3PollingArpWaitTable(f); + + // Clear the IP waiting list + L3DeleteOldIpWaitList(f); + } + Unlock(s->lock); +} + +// Get the next packet +UINT L3GetNextPacket(L3IF *f, void **data) +{ + UINT ret = 0; + // Validate arguments + if (f == NULL || data == NULL) + { + return 0; + } + +START: + // Examine the send queue + LockQueue(f->SendQueue); + { + PKT *p = GetNext(f->SendQueue); + + if (p != NULL) + { + // There is a packet + ret = p->PacketSize; + *data = p->PacketData; + // Packet structure may be discarded + Free(p); + } + } + UnlockQueue(f->SendQueue); + + if (ret == 0) + { + // Polling process + L3Polling(f); + + // Examine whether a new packet is queued for results of the polling process + if (f->SendQueue->num_item != 0) + { + // Get the packet immediately if it's in the queue + goto START; + } + } + + return ret; +} + +// Determine the packet destined for the specified IP address should be sent to which interface +L3IF *L3GetNextIf(L3SW *s, UINT ip, UINT *next_hop) +{ + UINT i; + L3IF *f; + UINT next_hop_ip = 0; + // Validate arguments + if (s == NULL || ip == 0 || ip == 0xffffffff) + { + return NULL; + } + + f = NULL; + + // Examine whether the specified IP address is contained + // in the networks which each interfaces belong to + for (i = 0;i < LIST_NUM(s->IfList);i++) + { + L3IF *ff = LIST_DATA(s->IfList, i); + + if ((ff->IpAddress & ff->SubnetMask) == (ip & ff->SubnetMask)) + { + f = ff; + next_hop_ip = ip; + break; + } + } + + if (f == NULL) + { + // Find the routing table if it's not found + L3TABLE *t = L3GetBestRoute(s, ip); + + if (t == NULL) + { + // Still not found + return NULL; + } + else + { + // Find the interface with the IP address of the router of + // NextHop of the found route + for (i = 0;i < LIST_NUM(s->IfList);i++) + { + L3IF *ff = LIST_DATA(s->IfList, i); + + if ((ff->IpAddress & ff->SubnetMask) == (t->GatewayAddress & ff->SubnetMask)) + { + f = ff; + next_hop_ip = t->GatewayAddress; + break; + } + } + } + } + + if (f == NULL) + { + // Destination interface was unknown after all + return NULL; + } + + if (next_hop != NULL) + { + *next_hop = next_hop_ip; + } + + return f; +} + +// Get the best routing table entry for the specified IP address +L3TABLE *L3GetBestRoute(L3SW *s, UINT ip) +{ + UINT i; + UINT max_mask = 0; + UINT min_metric = INFINITE; + L3TABLE *ret = NULL; + // Validate arguments + if (s == NULL || ip == 0) + { + return NULL; + } + + // 1st condition: Choose the one which have the largest subnet mask + // 2nd condition: Choose the one which have the smallest metric + for (i = 0;i < LIST_NUM(s->TableList);i++) + { + L3TABLE *t = LIST_DATA(s->TableList, i); + + if ((t->NetworkAddress & t->SubnetMask) == (ip & t->SubnetMask)) + { + if (t->SubnetMask >= max_mask) + { + max_mask = t->SubnetMask; + if (min_metric >= t->Metric) + { + min_metric = t->Metric; + ret = t; + } + } + } + } + + return ret; +} + +// Initialize the Layer-3 interface +void L3InitInterface(L3IF *f) +{ + // Validate arguments + if (f == NULL) + { + return; + } + + // MAC address generation + L3GenerateMacAddress(f); + + // List generation + f->ArpTable = NewList(CmpL3ArpEntry); + f->ArpWaitTable = NewList(CmpL3ArpWaitTable); + f->IpPacketQueue = NewQueue(); + f->IpWaitList = NewList(NULL); + f->SendQueue = NewQueue(); +} + +// Release the Layer-3 interface +void L3FreeInterface(L3IF *f) +{ + UINT i; + L3PACKET *p; + PKT *pkt; + // Validate arguments + if (f == NULL) + { + return; + } + + for (i = 0;i < LIST_NUM(f->ArpTable);i++) + { + L3ARPENTRY *a = LIST_DATA(f->ArpTable, i); + Free(a); + } + ReleaseList(f->ArpTable); + f->ArpTable = NULL; + + for (i = 0;i < LIST_NUM(f->ArpWaitTable);i++) + { + L3ARPWAIT *w = LIST_DATA(f->ArpWaitTable, i); + Free(w); + } + ReleaseList(f->ArpWaitTable); + f->ArpWaitTable = NULL; + + while (p = GetNext(f->IpPacketQueue)) + { + Free(p->Packet->PacketData); + FreePacket(p->Packet); + Free(p); + } + ReleaseQueue(f->IpPacketQueue); + f->IpPacketQueue = NULL; + + for (i = 0;i < LIST_NUM(f->IpWaitList);i++) + { + L3PACKET *p = LIST_DATA(f->IpWaitList, i); + Free(p->Packet->PacketData); + FreePacket(p->Packet); + Free(p); + } + ReleaseList(f->IpWaitList); + f->IpWaitList = NULL; + + while (pkt = GetNext(f->SendQueue)) + { + Free(pkt->PacketData); + FreePacket(pkt); + } + ReleaseQueue(f->SendQueue); + f->SendQueue = NULL; +} + +// Layer-3 interface thread +void L3IfThread(THREAD *t, void *param) +{ + L3IF *f; + CONNECTION *c; + SESSION *s; + POLICY *policy; + char tmp[MAX_SIZE]; + char name[MAX_SIZE]; + char username[MAX_SIZE]; + // Validate arguments + if (t == NULL || param == NULL) + { + return; + } + + f = (L3IF *)param; + + StrCpy(username, sizeof(username), L3_USERNAME); + if (f->Switch != NULL) + { + StrCat(username, sizeof(username), f->Switch->Name); + } + + // Create a connection + c = NewServerConnection(f->Switch->Cedar, NULL, t); + c->Protocol = CONNECTION_HUB_LAYER3; + + // Create a Session + policy = ClonePolicy(GetDefaultPolicy()); + // Not to limit the number of broadcast by policy + policy->NoBroadcastLimiter = true; + s = NewServerSession(f->Switch->Cedar, c, f->Hub, username, policy); + c->Session = s; + + ReleaseConnection(c); + + // Determine the name of the session + GetMachineHostName(tmp, sizeof(tmp)); + if (f->Switch->Cedar->Server->ServerType == SERVER_TYPE_STANDALONE) + { + Format(name, sizeof(name), "SID-L3-%s-%u", f->Switch->Name, Inc(f->Hub->SessionCounter)); + } + else + { + Format(name, sizeof(name), "SID-L3-%s-%s-%u", tmp, f->Switch->Name, Inc(f->Hub->SessionCounter)); + } + ConvertSafeFileName(name, sizeof(name), name); + StrUpper(name); + + Free(s->Name); + s->Name = CopyStr(name); + + s->L3SwitchMode = true; + s->L3If = f; + + if (s->Username != NULL) + { + Free(s->Username); + } + s->Username = CopyStr(username); + + StrCpy(s->UserNameReal, sizeof(s->UserNameReal), username); + + f->Session = s; + AddRef(s->ref); + + // Notify the initialization completion + NoticeThreadInit(t); + + // Session main process + SessionMain(s); + + // Release the session + ReleaseSession(s); +} + +// Initialize all Layer-3 interfaces +void L3InitAllInterfaces(L3SW *s) +{ + UINT i; + // Validate arguments + if (s == NULL) + { + return; + } + + for (i = 0;i < LIST_NUM(s->IfList);i++) + { + L3IF *f = LIST_DATA(s->IfList, i); + THREAD *t; + + L3InitInterface(f); + + f->Hub = GetHub(s->Cedar, f->HubName); + t = NewThread(L3IfThread, f); + WaitThreadInit(t); + ReleaseThread(t); + } +} + +// Release all Layer-3 interfaces +void L3FreeAllInterfaces(L3SW *s) +{ + UINT i; + // Validate arguments + if (s == NULL) + { + return; + } + + for (i = 0;i < LIST_NUM(s->IfList);i++) + { + L3IF *f = LIST_DATA(s->IfList, i); + + ReleaseHub(f->Hub); + f->Hub = NULL; + ReleaseSession(f->Session); + f->Session = NULL; + + L3FreeInterface(f); + } +} + +// Layer-3 test +void L3Test(SERVER *s) +{ + L3SW *ss = L3AddSw(s->Cedar, "TEST"); + L3AddIf(ss, "DEFAULT", 0x0101a8c0, 0x00ffffff); + L3AddIf(ss, "DEFAULT2", 0x0102a8c0, 0x00ffffff); + L3SwStart(ss); + ReleaseL3Sw(ss); +} + +// Layer-3 switch thread +void L3SwThread(THREAD *t, void *param) +{ + L3SW *s; + bool shutdown_now = false; + // Validate arguments + if (t == NULL || param == NULL) + { + return; + } + + s = (L3SW *)param; + + s->Active = true; + + NoticeThreadInit(t); + + // Operation start + SLog(s->Cedar, "L3_SWITCH_START", s->Name); + + while (s->Halt == false) + { + if (s->Online == false) + { + // Because the L3 switch is off-line now, + // attempt to make it on-line periodically + LockList(s->Cedar->HubList); + { + Lock(s->lock); + { + UINT i; + UINT n = 0; + bool all_exists = true; + if (LIST_NUM(s->IfList) == 0) + { + // Don't operate if there is no interface + all_exists = false; + } + for (i = 0;i < LIST_NUM(s->IfList);i++) + { + L3IF *f = LIST_DATA(s->IfList, i); + HUB *h = GetHub(s->Cedar, f->HubName); + + if (h != NULL) + { + if (h->Offline || h->Type == HUB_TYPE_FARM_DYNAMIC) + { + all_exists = false; + } + else + { + n++; + } + ReleaseHub(h); + } + else + { + all_exists = false; + } + } + + if (all_exists && n >= 1) + { + // Start the operation because all Virtual HUBs for + // interfaces are enabled + SLog(s->Cedar, "L3_SWITCH_ONLINE", s->Name); + L3InitAllInterfaces(s); + s->Online = true; + } + } + Unlock(s->lock); + } + UnlockList(s->Cedar->HubList); + } + else + { + // Examine periodically whether all sessions terminated + UINT i; + bool any_halted = false; + LIST *o = NULL; + +SHUTDOWN: + + Lock(s->lock); + { + for (i = 0;i < LIST_NUM(s->IfList);i++) + { + L3IF *f = LIST_DATA(s->IfList, i); + if (f->Session->Halt || f->Hub->Offline != false) + { + any_halted = true; + break; + } + } + + if (shutdown_now) + { + any_halted = true; + } + + if (any_halted) + { + SLog(s->Cedar, "L3_SWITCH_OFFLINE", s->Name); + o = NewListFast(NULL); + // If there is any terminated session, terminate all sessions + for (i = 0;i < LIST_NUM(s->IfList);i++) + { + L3IF *f = LIST_DATA(s->IfList, i); + Insert(o, f->Session); + } + + // Restore to the offline + s->Online = false; + } + } + Unlock(s->lock); + + if (o != NULL) + { + UINT i; + for (i = 0;i < LIST_NUM(o);i++) + { + SESSION *s = LIST_DATA(o, i); + StopSession(s); + } + L3FreeAllInterfaces(s); + ReleaseList(o); + o = NULL; + } + } + + SleepThread(50); + } + + if (s->Online != false) + { + shutdown_now = true; + goto SHUTDOWN; + } + + // Stop the operation + SLog(s->Cedar, "L3_SWITCH_STOP", s->Name); +} + +// Start a Layer-3 switch +void L3SwStart(L3SW *s) +{ + // Validate arguments + if (s == NULL) + { + return; + } + + Lock(s->lock); + { + if (s->Active == false) + { + // Start if there is registered interface + if (LIST_NUM(s->IfList) >= 1) + { + s->Halt = false; + + // Create a thread + s->Thread = NewThread(L3SwThread, s); + WaitThreadInit(s->Thread); + } + } + } + Unlock(s->lock); +} + +// Stop the Layer-3 switch +void L3SwStop(L3SW *s) +{ + THREAD *t = NULL; + // Validate arguments + if (s == NULL) + { + return; + } + + Lock(s->lock); + { + if (s->Active == false) + { + Unlock(s->lock); + return; + } + + s->Halt = true; + + t = s->Thread; + + s->Active = false; + } + Unlock(s->lock); + + WaitThread(t, INFINITE); + ReleaseThread(t); +} + +// Add a Layer-3 switch +L3SW *L3AddSw(CEDAR *c, char *name) +{ + L3SW *s = NULL; + // Validate arguments + if (c == NULL || name == NULL) + { + return NULL; + } + + LockList(c->L3SwList); + { + s = L3GetSw(c, name); + + if (s == NULL) + { + s = NewL3Sw(c, name); + + Insert(c->L3SwList, s); + + AddRef(s->ref); + } + else + { + ReleaseL3Sw(s); + s = NULL; + } + } + UnlockList(c->L3SwList); + + return s; +} + +// Delete the Layer-3 switch +bool L3DelSw(CEDAR *c, char *name) +{ + L3SW *s; + bool ret = false; + // Validate arguments + if (c == NULL || name == NULL) + { + return false; + } + + LockList(c->L3SwList); + { + s = L3GetSw(c, name); + + if (s != NULL) + { + // Stop and delete + L3SwStop(s); + Delete(c->L3SwList, s); + ReleaseL3Sw(s); + ReleaseL3Sw(s); + + ret = true; + } + } + UnlockList(c->L3SwList); + + return ret; +} + + +// Delete the routing table +bool L3DelTable(L3SW *s, L3TABLE *tbl) +{ + bool ret = false; + // Validate arguments + if (s == NULL || tbl == NULL) + { + return false; + } + + Lock(s->lock); + { + if (s->Active == false) + { + L3TABLE *t = Search(s->TableList, tbl); + + if (t != NULL) + { + Delete(s->TableList, t); + Free(t); + + ret = true; + } + } + } + Unlock(s->lock); + + return ret; +} + +// Add to the routing table +bool L3AddTable(L3SW *s, L3TABLE *tbl) +{ + bool ret = false; + // Validate arguments + if (s == NULL || tbl == NULL) + { + return false; + } + + if (tbl->Metric == 0 || tbl->GatewayAddress == 0 || tbl->GatewayAddress == 0xffffffff) + { + return false; + } + + Lock(s->lock); + { + if (LIST_NUM(s->TableList) >= GetServerCapsInt(s->Cedar->Server, "i_max_l3_table")) + { + // Too many + } + else + { + // Create + if (s->Active == false) + { + if (Search(s->TableList, tbl) == NULL) + { + L3TABLE *t = ZeroMalloc(sizeof(L3TABLE)); + + Copy(t, tbl, sizeof(L3TABLE)); + + Insert(s->TableList, t); + + ret = true; + } + } + } + } + Unlock(s->lock); + + return ret; +} + +// Get the L3 switch +L3SW *L3GetSw(CEDAR *c, char *name) +{ + L3SW t, *s; + // Validate arguments + if (c == NULL || name == NULL) + { + return NULL; + } + + Zero(&t, sizeof(t)); + StrCpy(t.Name, sizeof(t.Name), name); + + LockList(c->L3SwList); + { + s = Search(c->L3SwList, &t); + } + UnlockList(c->L3SwList); + + if (s != NULL) + { + AddRef(s->ref); + } + + return s; +} + +// Get the interface that is connected to the specified Virtual HUB from the L3 switch +L3IF *L3SearchIf(L3SW *s, char *hubname) +{ + L3IF t, *f; + // Validate arguments + if (s == NULL || hubname == NULL) + { + return NULL; + } + + Zero(&t, sizeof(t)); + StrCpy(t.HubName, sizeof(t.HubName), hubname); + + f = Search(s->IfList, &t); + + return f; +} + +// Delete the interface +bool L3DelIf(L3SW *s, char *hubname) +{ + L3IF *f; + bool ret = false; + // Validate arguments + if (s == NULL || hubname == NULL) + { + return false; + } + + Lock(s->lock); + { + if (s->Active == false) + { + f = L3SearchIf(s, hubname); + + if (f != NULL) + { + // Remove + Delete(s->IfList, f); + Free(f); + + ret = true; + } + } + } + Unlock(s->lock); + + return ret; +} + +// Add an interface +bool L3AddIf(L3SW *s, char *hubname, UINT ip, UINT subnet) +{ + L3IF *f; + bool ret = false; + // Validate arguments + if (s == NULL || hubname == NULL || IsSafeStr(hubname) == false || + ip == 0 || ip == 0xffffffff) + { + return false; + } + + Lock(s->lock); + { + if (LIST_NUM(s->TableList) >= GetServerCapsInt(s->Cedar->Server, "i_max_l3_if")) + { + // Too many + } + else + { + if (s->Active == false) + { + // Examine whether the interface is already in the same Virtual HUB + if (L3SearchIf(s, hubname) == NULL) + { + // Add + f = ZeroMalloc(sizeof(L3IF)); + + f->Switch = s; + StrCpy(f->HubName, sizeof(f->HubName), hubname); + f->IpAddress = ip; + f->SubnetMask = subnet; + + Insert(s->IfList, f); + + ret = true; + } + } + } + } + Unlock(s->lock); + + return ret; +} + +// Clean-up the L3 switch +void CleanupL3Sw(L3SW *s) +{ + UINT i; + // Validate arguments + if (s == NULL) + { + return; + } + + for (i = 0;i < LIST_NUM(s->IfList);i++) + { + L3IF *f = LIST_DATA(s->IfList, i); + Free(f); + } + ReleaseList(s->IfList); + + for (i = 0;i < LIST_NUM(s->TableList);i++) + { + L3TABLE *t = LIST_DATA(s->TableList, i); + Free(t); + } + ReleaseList(s->TableList); + + DeleteLock(s->lock); + Free(s); +} + +// Release the L3 switch +void ReleaseL3Sw(L3SW *s) +{ + // Validate arguments + if (s == NULL) + { + return; + } + + if (Release(s->ref) == 0) + { + CleanupL3Sw(s); + } +} + +// Create a new L3 switch +L3SW *NewL3Sw(CEDAR *c, char *name) +{ + L3SW *o; + // Validate arguments + if (c == NULL || name == NULL) + { + return NULL; + } + + o = ZeroMalloc(sizeof(L3SW)); + + StrCpy(o->Name, sizeof(o->Name), name); + + o->lock = NewLock(); + o->ref = NewRef(); + o->Cedar = c; + o->Active = false; + + o->IfList = NewList(CmpL3If); + o->TableList = NewList(CmpL3Table); + + return o; +} + +// Stop all L3 switches in the Cedar +void L3FreeAllSw(CEDAR *c) +{ + LIST *o; + UINT i; + // Validate arguments + if (c == NULL) + { + return; + } + + o = NewListFast(NULL); + + LockList(c->L3SwList); + { + for (i = 0;i < LIST_NUM(c->L3SwList);i++) + { + L3SW *s = LIST_DATA(c->L3SwList, i); + Insert(o, CopyStr(s->Name)); + } + + for (i = 0;i < LIST_NUM(o);i++) + { + char *name = LIST_DATA(o, i); + + L3DelSw(c, name); + + Free(name); + } + + ReleaseList(o); + } + UnlockList(c->L3SwList); +} + +// Stop the L3 switch function of the Cedar +void FreeCedarLayer3(CEDAR *c) +{ + // Validate arguments + if (c == NULL) + { + return; + } + + ReleaseList(c->L3SwList); + c->L3SwList = NULL; +} + +// Start the L3 switch function of the Cedar +void InitCedarLayer3(CEDAR *c) +{ + // Validate arguments + if (c == NULL) + { + return; + } + + c->L3SwList = NewList(CmpL3Sw); +} + +// Interface comparison function +int CmpL3If(void *p1, void *p2) +{ + L3IF *f1, *f2; + if (p1 == NULL || p2 == NULL) + { + return 0; + } + f1 = *(L3IF **)p1; + f2 = *(L3IF **)p2; + if (f1 == NULL || f2 == NULL) + { + return 0; + } + + return StrCmpi(f1->HubName, f2->HubName); +} + +// Routing table entry comparison function +int CmpL3Table(void *p1, void *p2) +{ + L3TABLE *t1, *t2; + if (p1 == NULL || p2 == NULL) + { + return 0; + } + t1 = *(L3TABLE **)p1; + t2 = *(L3TABLE **)p2; + if (t1 == NULL || t2 == NULL) + { + return 0; + } + + if (t1->NetworkAddress > t2->NetworkAddress) + { + return 1; + } + else if (t1->NetworkAddress < t2->NetworkAddress) + { + return -1; + } + else if (t1->SubnetMask > t2->SubnetMask) + { + return 1; + } + else if (t1->SubnetMask < t2->SubnetMask) + { + return -1; + } + else if (t1->GatewayAddress > t2->GatewayAddress) + { + return 1; + } + else if (t1->GatewayAddress < t2->GatewayAddress) + { + return -1; + } + else if (t1->Metric > t2->Metric) + { + return 1; + } + else if (t1->Metric < t2->Metric) + { + return -1; + } + else + { + return 0; + } +} + +// L3SW comparison function +int CmpL3Sw(void *p1, void *p2) +{ + L3SW *s1, *s2; + if (p1 == NULL || p2 == NULL) + { + return 0; + } + s1 = *(L3SW **)p1; + s2 = *(L3SW **)p2; + if (s1 == NULL || s2 == NULL) + { + return 0; + } + + return StrCmpi(s1->Name, s2->Name); +} + +// ARP waiting entry comparison function +int CmpL3ArpWaitTable(void *p1, void *p2) +{ + L3ARPWAIT *w1, *w2; + if (p1 == NULL || p2 == NULL) + { + return 0; + } + w1 = *(L3ARPWAIT **)p1; + w2 = *(L3ARPWAIT **)p2; + if (w1 == NULL || w2 == NULL) + { + return 0; + } + if (w1->IpAddress > w2->IpAddress) + { + return 1; + } + else if (w1->IpAddress < w2->IpAddress) + { + return -1; + } + else + { + return 0; + } +} + +// ARP entries comparison function +int CmpL3ArpEntry(void *p1, void *p2) +{ + L3ARPENTRY *e1, *e2; + if (p1 == NULL || p2 == NULL) + { + return 0; + } + e1 = *(L3ARPENTRY **)p1; + e2 = *(L3ARPENTRY **)p2; + if (e1 == NULL || e2 == NULL) + { + return 0; + } + if (e1->IpAddress > e2->IpAddress) + { + return 1; + } + else if (e1->IpAddress < e2->IpAddress) + { + return -1; + } + else + { + return 0; + } +} + diff --git a/src/Cedar/Layer3.h b/src/Cedar/Layer3.h index 5e91d3a3..f4c1b8c0 100644 --- a/src/Cedar/Layer3.h +++ b/src/Cedar/Layer3.h @@ -1,149 +1,149 @@ -// SoftEther VPN Source Code - Developer Edition Master Branch -// Cedar Communication Module - - -// Layer3.h -// Header of Layer3.c - -#ifndef LAYER3_H -#define LAYER3_H - -// Constants -#define L3_USERNAME "L3SW_" - - -// L3 ARP table entry -struct L3ARPENTRY -{ - UINT IpAddress; // IP address - UCHAR MacAddress[6]; // MAC address - UCHAR Padding[2]; - UINT64 Expire; // Expiration date -}; - -// L3 ARP resolution waiting list entry -struct L3ARPWAIT -{ - UINT IpAddress; // IP address - UINT64 LastSentTime; // Time which the data has been sent last - UINT64 Expire; // Expiration date -}; - -// L3 IP packet table -struct L3PACKET -{ - PKT *Packet; // Packet data body - UINT64 Expire; // Expiration date - UINT NextHopIp; // Local delivery destination IP address -}; - -// L3 routing table definition -struct L3TABLE -{ - UINT NetworkAddress; // Network address - UINT SubnetMask; // Subnet mask - UINT GatewayAddress; // Gateway address - UINT Metric; // Metric -}; - -// L3 interface definition -struct L3IF -{ - L3SW *Switch; // Layer-3 switch - char HubName[MAX_HUBNAME_LEN + 1]; // Virtual HUB name - UINT IpAddress; // IP address - UINT SubnetMask; // Subnet mask - - HUB *Hub; // Virtual HUB - SESSION *Session; // Session - LIST *ArpTable; // ARP table - LIST *ArpWaitTable; // ARP waiting table - QUEUE *IpPacketQueue; // IP packet queue (for reception from other interfaces) - LIST *IpWaitList; // IP waiting list - QUEUE *SendQueue; // Transmission queue - UCHAR MacAddress[6]; // MAC address - UCHAR Padding[2]; - UINT64 LastDeleteOldArpTable; // Time that old ARP table entries are cleared - LIST *CancelList; // Cancellation list - UINT64 LastBeaconSent; // Time which the beacon has been sent last -}; - -// L3 switch definition -struct L3SW -{ - char Name[MAX_HUBNAME_LEN + 1]; // Name - LOCK *lock; // Lock - REF *ref; // Reference counter - CEDAR *Cedar; // Cedar - bool Active; // During operation flag - bool Online; // Online flag - volatile bool Halt; // Halting flag - LIST *IfList; // Interface list - LIST *TableList; // Routing table list - THREAD *Thread; // Thread -}; - - - -// Function prototype -int CmpL3Sw(void *p1, void *p2); -int CmpL3ArpEntry(void *p1, void *p2); -int CmpL3ArpWaitTable(void *p1, void *p2); -int CmpL3Table(void *p1, void *p2); -int CmpL3If(void *p1, void *p2); -void InitCedarLayer3(CEDAR *c); -void FreeCedarLayer3(CEDAR *c); -L3SW *NewL3Sw(CEDAR *c, char *name); -void ReleaseL3Sw(L3SW *s); -void CleanupL3Sw(L3SW *s); -bool L3AddIf(L3SW *s, char *hubname, UINT ip, UINT subnet); -bool L3DelIf(L3SW *s, char *hubname); -bool L3AddTable(L3SW *s, L3TABLE *tbl); -bool L3DelTable(L3SW *s, L3TABLE *tbl); -L3IF *L3SearchIf(L3SW *s, char *hubname); -L3SW *L3GetSw(CEDAR *c, char *name); -L3SW *L3AddSw(CEDAR *c, char *name); -bool L3DelSw(CEDAR *c, char *name); -void L3FreeAllSw(CEDAR *c); -void L3SwStart(L3SW *s); -void L3SwStop(L3SW *s); -void L3SwThread(THREAD *t, void *param); -void L3Test(SERVER *s); -void L3InitAllInterfaces(L3SW *s); -void L3FreeAllInterfaces(L3SW *s); -void L3IfThread(THREAD *t, void *param); -void L3InitInterface(L3IF *f); -void L3FreeInterface(L3IF *f); -L3IF *L3GetNextIf(L3SW *s, UINT ip, UINT *next_hop); -L3TABLE *L3GetBestRoute(L3SW *s, UINT ip); -UINT L3GetNextPacket(L3IF *f, void **data); -void L3Polling(L3IF *f); -void L3PollingBeacon(L3IF *f); -void L3DeleteOldArpTable(L3IF *f); -void L3DeleteOldIpWaitList(L3IF *f); -void L3PollingArpWaitTable(L3IF *f); -void L3SendL2Now(L3IF *f, UCHAR *dest_mac, UCHAR *src_mac, USHORT protocol, void *data, UINT size); -void L3SendArpRequestNow(L3IF *f, UINT dest_ip); -void L3SendArpResponseNow(L3IF *f, UCHAR *dest_mac, UINT dest_ip, UINT src_ip); -void L3GenerateMacAddress(L3IF *f); -L3ARPENTRY *L3SearchArpTable(L3IF *f, UINT ip); -void L3SendIpNow(L3IF *f, L3ARPENTRY *a, L3PACKET *p); -void L3SendIp(L3IF *f, L3PACKET *p); -void L3RecvArp(L3IF *f, PKT *p); -void L3RecvArpRequest(L3IF *f, PKT *p); -void L3RecvArpResponse(L3IF *f, PKT *p); -void L3KnownArp(L3IF *f, UINT ip, UCHAR *mac); -void L3SendArp(L3IF *f, UINT ip); -void L3InsertArpTable(L3IF *f, UINT ip, UCHAR *mac); -void L3SendWaitingIp(L3IF *f, UCHAR *mac, UINT ip, L3ARPENTRY *a); -void L3PutPacket(L3IF *f, void *data, UINT size); -void L3RecvL2(L3IF *f, PKT *p); -void L3StoreIpPacketToIf(L3IF *src_if, L3IF *dst_if, L3PACKET *p); -void L3RecvIp(L3IF *f, PKT *p, bool self); -void L3PollingIpQueue(L3IF *f); - - -#endif // LAYER3_H - - - +// SoftEther VPN Source Code - Developer Edition Master Branch +// Cedar Communication Module + + +// Layer3.h +// Header of Layer3.c + +#ifndef LAYER3_H +#define LAYER3_H + +// Constants +#define L3_USERNAME "L3SW_" + + +// L3 ARP table entry +struct L3ARPENTRY +{ + UINT IpAddress; // IP address + UCHAR MacAddress[6]; // MAC address + UCHAR Padding[2]; + UINT64 Expire; // Expiration date +}; + +// L3 ARP resolution waiting list entry +struct L3ARPWAIT +{ + UINT IpAddress; // IP address + UINT64 LastSentTime; // Time which the data has been sent last + UINT64 Expire; // Expiration date +}; + +// L3 IP packet table +struct L3PACKET +{ + PKT *Packet; // Packet data body + UINT64 Expire; // Expiration date + UINT NextHopIp; // Local delivery destination IP address +}; + +// L3 routing table definition +struct L3TABLE +{ + UINT NetworkAddress; // Network address + UINT SubnetMask; // Subnet mask + UINT GatewayAddress; // Gateway address + UINT Metric; // Metric +}; + +// L3 interface definition +struct L3IF +{ + L3SW *Switch; // Layer-3 switch + char HubName[MAX_HUBNAME_LEN + 1]; // Virtual HUB name + UINT IpAddress; // IP address + UINT SubnetMask; // Subnet mask + + HUB *Hub; // Virtual HUB + SESSION *Session; // Session + LIST *ArpTable; // ARP table + LIST *ArpWaitTable; // ARP waiting table + QUEUE *IpPacketQueue; // IP packet queue (for reception from other interfaces) + LIST *IpWaitList; // IP waiting list + QUEUE *SendQueue; // Transmission queue + UCHAR MacAddress[6]; // MAC address + UCHAR Padding[2]; + UINT64 LastDeleteOldArpTable; // Time that old ARP table entries are cleared + LIST *CancelList; // Cancellation list + UINT64 LastBeaconSent; // Time which the beacon has been sent last +}; + +// L3 switch definition +struct L3SW +{ + char Name[MAX_HUBNAME_LEN + 1]; // Name + LOCK *lock; // Lock + REF *ref; // Reference counter + CEDAR *Cedar; // Cedar + bool Active; // During operation flag + bool Online; // Online flag + volatile bool Halt; // Halting flag + LIST *IfList; // Interface list + LIST *TableList; // Routing table list + THREAD *Thread; // Thread +}; + + + +// Function prototype +int CmpL3Sw(void *p1, void *p2); +int CmpL3ArpEntry(void *p1, void *p2); +int CmpL3ArpWaitTable(void *p1, void *p2); +int CmpL3Table(void *p1, void *p2); +int CmpL3If(void *p1, void *p2); +void InitCedarLayer3(CEDAR *c); +void FreeCedarLayer3(CEDAR *c); +L3SW *NewL3Sw(CEDAR *c, char *name); +void ReleaseL3Sw(L3SW *s); +void CleanupL3Sw(L3SW *s); +bool L3AddIf(L3SW *s, char *hubname, UINT ip, UINT subnet); +bool L3DelIf(L3SW *s, char *hubname); +bool L3AddTable(L3SW *s, L3TABLE *tbl); +bool L3DelTable(L3SW *s, L3TABLE *tbl); +L3IF *L3SearchIf(L3SW *s, char *hubname); +L3SW *L3GetSw(CEDAR *c, char *name); +L3SW *L3AddSw(CEDAR *c, char *name); +bool L3DelSw(CEDAR *c, char *name); +void L3FreeAllSw(CEDAR *c); +void L3SwStart(L3SW *s); +void L3SwStop(L3SW *s); +void L3SwThread(THREAD *t, void *param); +void L3Test(SERVER *s); +void L3InitAllInterfaces(L3SW *s); +void L3FreeAllInterfaces(L3SW *s); +void L3IfThread(THREAD *t, void *param); +void L3InitInterface(L3IF *f); +void L3FreeInterface(L3IF *f); +L3IF *L3GetNextIf(L3SW *s, UINT ip, UINT *next_hop); +L3TABLE *L3GetBestRoute(L3SW *s, UINT ip); +UINT L3GetNextPacket(L3IF *f, void **data); +void L3Polling(L3IF *f); +void L3PollingBeacon(L3IF *f); +void L3DeleteOldArpTable(L3IF *f); +void L3DeleteOldIpWaitList(L3IF *f); +void L3PollingArpWaitTable(L3IF *f); +void L3SendL2Now(L3IF *f, UCHAR *dest_mac, UCHAR *src_mac, USHORT protocol, void *data, UINT size); +void L3SendArpRequestNow(L3IF *f, UINT dest_ip); +void L3SendArpResponseNow(L3IF *f, UCHAR *dest_mac, UINT dest_ip, UINT src_ip); +void L3GenerateMacAddress(L3IF *f); +L3ARPENTRY *L3SearchArpTable(L3IF *f, UINT ip); +void L3SendIpNow(L3IF *f, L3ARPENTRY *a, L3PACKET *p); +void L3SendIp(L3IF *f, L3PACKET *p); +void L3RecvArp(L3IF *f, PKT *p); +void L3RecvArpRequest(L3IF *f, PKT *p); +void L3RecvArpResponse(L3IF *f, PKT *p); +void L3KnownArp(L3IF *f, UINT ip, UCHAR *mac); +void L3SendArp(L3IF *f, UINT ip); +void L3InsertArpTable(L3IF *f, UINT ip, UCHAR *mac); +void L3SendWaitingIp(L3IF *f, UCHAR *mac, UINT ip, L3ARPENTRY *a); +void L3PutPacket(L3IF *f, void *data, UINT size); +void L3RecvL2(L3IF *f, PKT *p); +void L3StoreIpPacketToIf(L3IF *src_if, L3IF *dst_if, L3PACKET *p); +void L3RecvIp(L3IF *f, PKT *p, bool self); +void L3PollingIpQueue(L3IF *f); + + +#endif // LAYER3_H + + + diff --git a/src/Cedar/Link.c b/src/Cedar/Link.c index ec25023c..2bc4e98b 100644 --- a/src/Cedar/Link.c +++ b/src/Cedar/Link.c @@ -1,678 +1,678 @@ -// SoftEther VPN Source Code - Developer Edition Master Branch -// Cedar Communication Module -// © 2020 Nokia - -// Link.c -// Inter-HUB Link - -#include "CedarPch.h" - -// Link server thread -void LinkServerSessionThread(THREAD *t, void *param) -{ - LINK *k = (LINK *)param; - CONNECTION *c; - SESSION *s; - POLICY *policy; - wchar_t name[MAX_SIZE]; - // Validate arguments - if (t == NULL || param == NULL) - { - return; - } - - // Create a server connection - c = NewServerConnection(k->Cedar, NULL, t); - c->Protocol = CONNECTION_HUB_LINK_SERVER; - - // Create a policy - policy = ZeroMalloc(sizeof(POLICY)); - Copy(policy, k->Policy, sizeof(POLICY)); - - // Create a server session - s = NewServerSession(k->Cedar, c, k->Hub, LINK_USER_NAME, policy); - s->LinkModeServer = true; - s->Link = k; - c->Session = s; - ReleaseConnection(c); - - // User name - s->Username = CopyStr(LINK_USER_NAME_PRINT); - - k->ServerSession = s; - AddRef(k->ServerSession->ref); - - // Notify the initialization completion - NoticeThreadInit(t); - - UniStrCpy(name, sizeof(name), k->Option->AccountName); - HLog(s->Hub, "LH_LINK_START", name, s->Name); - - // Main function of session - SessionMain(s); - - HLog(s->Hub, "LH_LINK_STOP", name); - - ReleaseSession(s); -} - -// Initialize the packet adapter -bool LinkPaInit(SESSION *s) -{ - LINK *k; - THREAD *t; - // Validate arguments - if (s == NULL || (k = (LINK *)s->PacketAdapter->Param) == NULL) - { - return false; - } - - if (k->Halting || (*k->StopAllLinkFlag)) - { - return false; - } - - // Create a transmission packet queue - k->SendPacketQueue = NewQueue(); - - // Creat a link server thread - t = NewThread(LinkServerSessionThread, (void *)k); - WaitThreadInit(t); - - k->LastServerConnectionReceivedBlocksNum = 0; - k->CurrentSendPacketQueueSize = 0; - - ReleaseThread(t); - - return true; -} - -// Get the cancel object -CANCEL *LinkPaGetCancel(SESSION *s) -{ - LINK *k; - // Validate arguments - if (s == NULL || (k = (LINK *)s->PacketAdapter->Param) == NULL) - { - return NULL; - } - - return NULL; -} - -// Get the next packet -UINT LinkPaGetNextPacket(SESSION *s, void **data) -{ - LINK *k; - UINT ret = 0; - // Validate arguments - if (s == NULL || data == NULL || (k = (LINK *)s->PacketAdapter->Param) == NULL) - { - return INFINITE; - } - - if (k->Halting || (*k->StopAllLinkFlag)) - { - return INFINITE; - } - // Examine whether there are packets in the queue - LockQueue(k->SendPacketQueue); - { - BLOCK *block = GetNext(k->SendPacketQueue); - - if (block != NULL) - { - // There was a packet - *data = block->Buf; - ret = block->Size; - - k->CurrentSendPacketQueueSize -= block->Size; - - // Discard the memory for the structure - Free(block); - } - } - UnlockQueue(k->SendPacketQueue); - - return ret; -} - -// Write the received packet -bool LinkPaPutPacket(SESSION *s, void *data, UINT size) -{ - LINK *k; - BLOCK *block = NULL; - SESSION *server_session; - CONNECTION *server_connection; - bool ret = true; - bool halting = false; - // Validate arguments - if (s == NULL || (k = (LINK *)s->PacketAdapter->Param) == NULL) - { - return false; - } - - halting = (k->Halting || (*k->StopAllLinkFlag)); - - server_session = k->ServerSession; - server_connection = server_session->Connection; - - k->Flag1++; - if ((k->Flag1 % 32) == 0) - { - // Omit for performance - UINT current_num; - int diff; - - current_num = GetQueueNum(server_connection->ReceivedBlocks); - - diff = (int)current_num - (int)k->LastServerConnectionReceivedBlocksNum; - - k->LastServerConnectionReceivedBlocksNum = current_num; - - CedarAddQueueBudget(k->Cedar, diff); - } - - // Since the packet arrives from the HUB of the link destination, - // deliver it to the ReceivedBlocks of the server session - if (data != NULL) - { - if (halting == false) - { - block = NewBlock(data, size, 0); - } - - if (k->LockFlag == false) - { - UINT current_num; - int diff; - - k->LockFlag = true; - LockQueue(server_connection->ReceivedBlocks); - - current_num = GetQueueNum(server_connection->ReceivedBlocks); - - diff = (int)current_num - (int)k->LastServerConnectionReceivedBlocksNum; - - k->LastServerConnectionReceivedBlocksNum = current_num; - - CedarAddQueueBudget(k->Cedar, diff); - } - - if (halting == false) - { - if (CedarGetFifoBudgetBalance(k->Cedar) == 0) - { - FreeBlock(block); - } - else - { - InsertReceivedBlockToQueue(server_connection, block, true); - } - } - } - else - { - UINT current_num; - int diff; - - current_num = GetQueueNum(server_connection->ReceivedBlocks); - - diff = (int)current_num - (int)k->LastServerConnectionReceivedBlocksNum; - - k->LastServerConnectionReceivedBlocksNum = current_num; - - CedarAddQueueBudget(k->Cedar, diff); - - if (k->LockFlag) - { - k->LockFlag = false; - UnlockQueue(server_connection->ReceivedBlocks); - } - - // Issue the Cancel, since finished store all packets when the data == NULL - Cancel(server_session->Cancel1); - - if (k->Hub != NULL && k->Hub->Option != NULL && k->Hub->Option->YieldAfterStorePacket) - { - YieldCpu(); - } - } - - if (halting) - { - ret = false; - } - - return ret; -} - -// Release the packet adapter -void LinkPaFree(SESSION *s) -{ - LINK *k; - // Validate arguments - if (s == NULL || (k = (LINK *)s->PacketAdapter->Param) == NULL) - { - return; - } - - CedarAddQueueBudget(k->Cedar, -((int)k->LastServerConnectionReceivedBlocksNum)); - k->LastServerConnectionReceivedBlocksNum = 0; - - // Stop the server session - StopSession(k->ServerSession); - ReleaseSession(k->ServerSession); - - // Release the transmission packet queue - LockQueue(k->SendPacketQueue); - { - BLOCK *block; - while (block = GetNext(k->SendPacketQueue)) - { - FreeBlock(block); - } - } - UnlockQueue(k->SendPacketQueue); - - ReleaseQueue(k->SendPacketQueue); - - k->CurrentSendPacketQueueSize = 0; -} - -// Packet adapter -PACKET_ADAPTER *LinkGetPacketAdapter() -{ - return NewPacketAdapter(LinkPaInit, LinkPaGetCancel, LinkPaGetNextPacket, - LinkPaPutPacket, LinkPaFree); -} - -// Release all links -void ReleaseAllLink(HUB *h) -{ - LINK **kk; - UINT num, i; - // Validate arguments - if (h == NULL) - { - return; - } - - LockList(h->LinkList); - { - num = LIST_NUM(h->LinkList); - kk = ToArray(h->LinkList); - DeleteAll(h->LinkList); - } - UnlockList(h->LinkList); - - for (i = 0;i < num;i++) - { - LINK *k = kk[i]; - - ReleaseLink(k); - } - - Free(kk); -} - -// Release the link -void ReleaseLink(LINK *k) -{ - // Validate arguments - if (k == NULL) - { - return; - } - - if (Release(k->ref) == 0) - { - CleanupLink(k); - } -} - -// Clean-up the link -void CleanupLink(LINK *k) -{ - // Validate arguments - if (k == NULL) - { - return; - } - - DeleteLock(k->lock); - if (k->ClientSession) - { - ReleaseSession(k->ClientSession); - } - Free(k->Option); - CiFreeClientAuth(k->Auth); - Free(k->Policy); - - if (k->ServerCert != NULL) - { - FreeX(k->ServerCert); - } - - Free(k); -} - -// Make the link on-line -void SetLinkOnline(LINK *k) -{ - // Validate arguments - if (k == NULL) - { - return; - } - - if (k->NoOnline) - { - return; - } - - if (k->Offline == false) - { - return; - } - - k->Offline = false; - StartLink(k); -} - -// Make the link off-line -void SetLinkOffline(LINK *k) -{ - // Validate arguments - if (k == NULL) - { - return; - } - - if (k->Offline) - { - return; - } - - StopLink(k); - k->Offline = true; -} - -// Delete the link -void DelLink(HUB *hub, LINK *k) -{ - // Validate arguments - if (hub == NULL || k == NULL) - { - return; - } - - LockList(hub->LinkList); - { - if (Delete(hub->LinkList, k)) - { - ReleaseLink(k); - } - } - UnlockList(hub->LinkList); -} - -// Start all links -void StartAllLink(HUB *h) -{ - // Validate arguments - if (h == NULL) - { - return; - } - - LockList(h->LinkList); - { - UINT i; - for (i = 0;i < LIST_NUM(h->LinkList);i++) - { - LINK *k = (LINK *)LIST_DATA(h->LinkList, i); - - if (k->Offline == false) - { - StartLink(k); - } - } - } - UnlockList(h->LinkList); -} - -// Stop all links -void StopAllLink(HUB *h) -{ - LINK **link_list; - UINT num_link; - UINT i; - // Validate arguments - if (h == NULL) - { - return; - } - - h->StopAllLinkFlag = true; - - LockList(h->LinkList); - { - link_list = ToArray(h->LinkList); - num_link = LIST_NUM(h->LinkList); - for (i = 0;i < num_link;i++) - { - AddRef(link_list[i]->ref); - } - } - UnlockList(h->LinkList); - - for (i = 0;i < num_link;i++) - { - StopLink(link_list[i]); - ReleaseLink(link_list[i]); - } - - Free(link_list); - - h->StopAllLinkFlag = false; -} - -// Start the link -void StartLink(LINK *k) -{ - PACKET_ADAPTER *pa; - // Validate arguments - if (k == NULL) - { - return; - } - - LockLink(k); - { - if (k->Started || k->Halting) - { - UnlockLink(k); - return; - } - k->Started = true; - - Inc(k->Cedar->CurrentActiveLinks); - } - UnlockLink(k); - - // Connect the client session - pa = LinkGetPacketAdapter(); - pa->Param = (void *)k; - LockLink(k); - { - k->ClientSession = NewClientSession(k->Cedar, k->Option, k->Auth, pa); - } - UnlockLink(k); -} - -// Stop the link -void StopLink(LINK *k) -{ - // Validate arguments - if (k == NULL) - { - return; - } - - LockLink(k); - { - if (k->Started == false) - { - UnlockLink(k); - return; - } - k->Started = false; - k->Halting = true; - - Dec(k->Cedar->CurrentActiveLinks); - } - UnlockLink(k); - - if (k->ClientSession != NULL) - { - // Disconnect the client session - StopSession(k->ClientSession); - - LockLink(k); - { - ReleaseSession(k->ClientSession); - k->ClientSession = NULL; - } - UnlockLink(k); - } - - LockLink(k); - { - k->Halting = false; - } - UnlockLink(k); -} - -// Lock the link -void LockLink(LINK *k) -{ - // Validate arguments - if (k == NULL) - { - return; - } - - Lock(k->lock); -} - -// Unlock the link -void UnlockLink(LINK *k) -{ - // Validate arguments - if (k == NULL) - { - return; - } - - Unlock(k->lock); -} - -// Normalize the policy for the link -void NormalizeLinkPolicy(POLICY *p) -{ - // Validate arguments - if (p == NULL) - { - return; - } - - p->Access = true; - p->NoBridge = p->NoRouting = p->MonitorPort = false; - p->MaxConnection = 32; - p->TimeOut = 20; - p->FixPassword = false; -} - -// Create a Link -LINK *NewLink(CEDAR *cedar, HUB *hub, CLIENT_OPTION *option, CLIENT_AUTH *auth, POLICY *policy) -{ - CLIENT_OPTION *o; - LINK *k; - CLIENT_AUTH *a; - // Validate arguments - if (cedar == NULL || hub == NULL || option == NULL || auth == NULL || policy == NULL) - { - return NULL; - } - if (hub->Halt) - { - return NULL; - } - - if (LIST_NUM(hub->LinkList) >= MAX_HUB_LINKS) - { - return NULL; - } - - if (UniIsEmptyStr(option->AccountName)) - { - return NULL; - } - - // Limitation of authentication method - if (auth->AuthType != CLIENT_AUTHTYPE_ANONYMOUS && auth->AuthType != CLIENT_AUTHTYPE_PASSWORD && - auth->AuthType != CLIENT_AUTHTYPE_PLAIN_PASSWORD && auth->AuthType != CLIENT_AUTHTYPE_CERT && auth->AuthType != CLIENT_AUTHTYPE_OPENSSLENGINE) - { - // Authentication method other than anonymous authentication, password authentication, plain password, certificate authentication cannot be used - return NULL; - } - - // Copy of the client options (for modification) - o = ZeroMalloc(sizeof(CLIENT_OPTION)); - Copy(o, option, sizeof(CLIENT_OPTION)); - StrCpy(o->DeviceName, sizeof(o->DeviceName), LINK_DEVICE_NAME); - - o->RequireBridgeRoutingMode = true; // Request the bridge mode - o->RequireMonitorMode = false; // Not to require the monitor mode - - o->NumRetry = INFINITE; // Retry the connection infinitely - o->RetryInterval = 10; // Retry interval is 10 seconds - o->NoRoutingTracking = true; // Stop the routing tracking - - // Copy the authentication data - a = CopyClientAuth(auth); - a->SecureSignProc = NULL; - a->CheckCertProc = NULL; - - // Link object - k = ZeroMalloc(sizeof(LINK)); - - k->StopAllLinkFlag = &hub->StopAllLinkFlag; - - k->lock = NewLock(); - k->ref = NewRef(); - - k->Cedar = cedar; - k->Option = o; - k->Auth = a; - k->Hub = hub; - - // Copy the policy - k->Policy = ZeroMalloc(sizeof(POLICY)); - Copy(k->Policy, policy, sizeof(POLICY)); - - // Normalize the policy - NormalizeLinkPolicy(k->Policy); - - // Register in the link list of the HUB - LockList(hub->LinkList); - { - Add(hub->LinkList, k); - AddRef(k->ref); - } - UnlockList(hub->LinkList); - - return k; -} - +// SoftEther VPN Source Code - Developer Edition Master Branch +// Cedar Communication Module +// © 2020 Nokia + +// Link.c +// Inter-HUB Link + +#include "CedarPch.h" + +// Link server thread +void LinkServerSessionThread(THREAD *t, void *param) +{ + LINK *k = (LINK *)param; + CONNECTION *c; + SESSION *s; + POLICY *policy; + wchar_t name[MAX_SIZE]; + // Validate arguments + if (t == NULL || param == NULL) + { + return; + } + + // Create a server connection + c = NewServerConnection(k->Cedar, NULL, t); + c->Protocol = CONNECTION_HUB_LINK_SERVER; + + // Create a policy + policy = ZeroMalloc(sizeof(POLICY)); + Copy(policy, k->Policy, sizeof(POLICY)); + + // Create a server session + s = NewServerSession(k->Cedar, c, k->Hub, LINK_USER_NAME, policy); + s->LinkModeServer = true; + s->Link = k; + c->Session = s; + ReleaseConnection(c); + + // User name + s->Username = CopyStr(LINK_USER_NAME_PRINT); + + k->ServerSession = s; + AddRef(k->ServerSession->ref); + + // Notify the initialization completion + NoticeThreadInit(t); + + UniStrCpy(name, sizeof(name), k->Option->AccountName); + HLog(s->Hub, "LH_LINK_START", name, s->Name); + + // Main function of session + SessionMain(s); + + HLog(s->Hub, "LH_LINK_STOP", name); + + ReleaseSession(s); +} + +// Initialize the packet adapter +bool LinkPaInit(SESSION *s) +{ + LINK *k; + THREAD *t; + // Validate arguments + if (s == NULL || (k = (LINK *)s->PacketAdapter->Param) == NULL) + { + return false; + } + + if (k->Halting || (*k->StopAllLinkFlag)) + { + return false; + } + + // Create a transmission packet queue + k->SendPacketQueue = NewQueue(); + + // Creat a link server thread + t = NewThread(LinkServerSessionThread, (void *)k); + WaitThreadInit(t); + + k->LastServerConnectionReceivedBlocksNum = 0; + k->CurrentSendPacketQueueSize = 0; + + ReleaseThread(t); + + return true; +} + +// Get the cancel object +CANCEL *LinkPaGetCancel(SESSION *s) +{ + LINK *k; + // Validate arguments + if (s == NULL || (k = (LINK *)s->PacketAdapter->Param) == NULL) + { + return NULL; + } + + return NULL; +} + +// Get the next packet +UINT LinkPaGetNextPacket(SESSION *s, void **data) +{ + LINK *k; + UINT ret = 0; + // Validate arguments + if (s == NULL || data == NULL || (k = (LINK *)s->PacketAdapter->Param) == NULL) + { + return INFINITE; + } + + if (k->Halting || (*k->StopAllLinkFlag)) + { + return INFINITE; + } + // Examine whether there are packets in the queue + LockQueue(k->SendPacketQueue); + { + BLOCK *block = GetNext(k->SendPacketQueue); + + if (block != NULL) + { + // There was a packet + *data = block->Buf; + ret = block->Size; + + k->CurrentSendPacketQueueSize -= block->Size; + + // Discard the memory for the structure + Free(block); + } + } + UnlockQueue(k->SendPacketQueue); + + return ret; +} + +// Write the received packet +bool LinkPaPutPacket(SESSION *s, void *data, UINT size) +{ + LINK *k; + BLOCK *block = NULL; + SESSION *server_session; + CONNECTION *server_connection; + bool ret = true; + bool halting = false; + // Validate arguments + if (s == NULL || (k = (LINK *)s->PacketAdapter->Param) == NULL) + { + return false; + } + + halting = (k->Halting || (*k->StopAllLinkFlag)); + + server_session = k->ServerSession; + server_connection = server_session->Connection; + + k->Flag1++; + if ((k->Flag1 % 32) == 0) + { + // Omit for performance + UINT current_num; + int diff; + + current_num = GetQueueNum(server_connection->ReceivedBlocks); + + diff = (int)current_num - (int)k->LastServerConnectionReceivedBlocksNum; + + k->LastServerConnectionReceivedBlocksNum = current_num; + + CedarAddQueueBudget(k->Cedar, diff); + } + + // Since the packet arrives from the HUB of the link destination, + // deliver it to the ReceivedBlocks of the server session + if (data != NULL) + { + if (halting == false) + { + block = NewBlock(data, size, 0); + } + + if (k->LockFlag == false) + { + UINT current_num; + int diff; + + k->LockFlag = true; + LockQueue(server_connection->ReceivedBlocks); + + current_num = GetQueueNum(server_connection->ReceivedBlocks); + + diff = (int)current_num - (int)k->LastServerConnectionReceivedBlocksNum; + + k->LastServerConnectionReceivedBlocksNum = current_num; + + CedarAddQueueBudget(k->Cedar, diff); + } + + if (halting == false) + { + if (CedarGetFifoBudgetBalance(k->Cedar) == 0) + { + FreeBlock(block); + } + else + { + InsertReceivedBlockToQueue(server_connection, block, true); + } + } + } + else + { + UINT current_num; + int diff; + + current_num = GetQueueNum(server_connection->ReceivedBlocks); + + diff = (int)current_num - (int)k->LastServerConnectionReceivedBlocksNum; + + k->LastServerConnectionReceivedBlocksNum = current_num; + + CedarAddQueueBudget(k->Cedar, diff); + + if (k->LockFlag) + { + k->LockFlag = false; + UnlockQueue(server_connection->ReceivedBlocks); + } + + // Issue the Cancel, since finished store all packets when the data == NULL + Cancel(server_session->Cancel1); + + if (k->Hub != NULL && k->Hub->Option != NULL && k->Hub->Option->YieldAfterStorePacket) + { + YieldCpu(); + } + } + + if (halting) + { + ret = false; + } + + return ret; +} + +// Release the packet adapter +void LinkPaFree(SESSION *s) +{ + LINK *k; + // Validate arguments + if (s == NULL || (k = (LINK *)s->PacketAdapter->Param) == NULL) + { + return; + } + + CedarAddQueueBudget(k->Cedar, -((int)k->LastServerConnectionReceivedBlocksNum)); + k->LastServerConnectionReceivedBlocksNum = 0; + + // Stop the server session + StopSession(k->ServerSession); + ReleaseSession(k->ServerSession); + + // Release the transmission packet queue + LockQueue(k->SendPacketQueue); + { + BLOCK *block; + while (block = GetNext(k->SendPacketQueue)) + { + FreeBlock(block); + } + } + UnlockQueue(k->SendPacketQueue); + + ReleaseQueue(k->SendPacketQueue); + + k->CurrentSendPacketQueueSize = 0; +} + +// Packet adapter +PACKET_ADAPTER *LinkGetPacketAdapter() +{ + return NewPacketAdapter(LinkPaInit, LinkPaGetCancel, LinkPaGetNextPacket, + LinkPaPutPacket, LinkPaFree); +} + +// Release all links +void ReleaseAllLink(HUB *h) +{ + LINK **kk; + UINT num, i; + // Validate arguments + if (h == NULL) + { + return; + } + + LockList(h->LinkList); + { + num = LIST_NUM(h->LinkList); + kk = ToArray(h->LinkList); + DeleteAll(h->LinkList); + } + UnlockList(h->LinkList); + + for (i = 0;i < num;i++) + { + LINK *k = kk[i]; + + ReleaseLink(k); + } + + Free(kk); +} + +// Release the link +void ReleaseLink(LINK *k) +{ + // Validate arguments + if (k == NULL) + { + return; + } + + if (Release(k->ref) == 0) + { + CleanupLink(k); + } +} + +// Clean-up the link +void CleanupLink(LINK *k) +{ + // Validate arguments + if (k == NULL) + { + return; + } + + DeleteLock(k->lock); + if (k->ClientSession) + { + ReleaseSession(k->ClientSession); + } + Free(k->Option); + CiFreeClientAuth(k->Auth); + Free(k->Policy); + + if (k->ServerCert != NULL) + { + FreeX(k->ServerCert); + } + + Free(k); +} + +// Make the link on-line +void SetLinkOnline(LINK *k) +{ + // Validate arguments + if (k == NULL) + { + return; + } + + if (k->NoOnline) + { + return; + } + + if (k->Offline == false) + { + return; + } + + k->Offline = false; + StartLink(k); +} + +// Make the link off-line +void SetLinkOffline(LINK *k) +{ + // Validate arguments + if (k == NULL) + { + return; + } + + if (k->Offline) + { + return; + } + + StopLink(k); + k->Offline = true; +} + +// Delete the link +void DelLink(HUB *hub, LINK *k) +{ + // Validate arguments + if (hub == NULL || k == NULL) + { + return; + } + + LockList(hub->LinkList); + { + if (Delete(hub->LinkList, k)) + { + ReleaseLink(k); + } + } + UnlockList(hub->LinkList); +} + +// Start all links +void StartAllLink(HUB *h) +{ + // Validate arguments + if (h == NULL) + { + return; + } + + LockList(h->LinkList); + { + UINT i; + for (i = 0;i < LIST_NUM(h->LinkList);i++) + { + LINK *k = (LINK *)LIST_DATA(h->LinkList, i); + + if (k->Offline == false) + { + StartLink(k); + } + } + } + UnlockList(h->LinkList); +} + +// Stop all links +void StopAllLink(HUB *h) +{ + LINK **link_list; + UINT num_link; + UINT i; + // Validate arguments + if (h == NULL) + { + return; + } + + h->StopAllLinkFlag = true; + + LockList(h->LinkList); + { + link_list = ToArray(h->LinkList); + num_link = LIST_NUM(h->LinkList); + for (i = 0;i < num_link;i++) + { + AddRef(link_list[i]->ref); + } + } + UnlockList(h->LinkList); + + for (i = 0;i < num_link;i++) + { + StopLink(link_list[i]); + ReleaseLink(link_list[i]); + } + + Free(link_list); + + h->StopAllLinkFlag = false; +} + +// Start the link +void StartLink(LINK *k) +{ + PACKET_ADAPTER *pa; + // Validate arguments + if (k == NULL) + { + return; + } + + LockLink(k); + { + if (k->Started || k->Halting) + { + UnlockLink(k); + return; + } + k->Started = true; + + Inc(k->Cedar->CurrentActiveLinks); + } + UnlockLink(k); + + // Connect the client session + pa = LinkGetPacketAdapter(); + pa->Param = (void *)k; + LockLink(k); + { + k->ClientSession = NewClientSession(k->Cedar, k->Option, k->Auth, pa); + } + UnlockLink(k); +} + +// Stop the link +void StopLink(LINK *k) +{ + // Validate arguments + if (k == NULL) + { + return; + } + + LockLink(k); + { + if (k->Started == false) + { + UnlockLink(k); + return; + } + k->Started = false; + k->Halting = true; + + Dec(k->Cedar->CurrentActiveLinks); + } + UnlockLink(k); + + if (k->ClientSession != NULL) + { + // Disconnect the client session + StopSession(k->ClientSession); + + LockLink(k); + { + ReleaseSession(k->ClientSession); + k->ClientSession = NULL; + } + UnlockLink(k); + } + + LockLink(k); + { + k->Halting = false; + } + UnlockLink(k); +} + +// Lock the link +void LockLink(LINK *k) +{ + // Validate arguments + if (k == NULL) + { + return; + } + + Lock(k->lock); +} + +// Unlock the link +void UnlockLink(LINK *k) +{ + // Validate arguments + if (k == NULL) + { + return; + } + + Unlock(k->lock); +} + +// Normalize the policy for the link +void NormalizeLinkPolicy(POLICY *p) +{ + // Validate arguments + if (p == NULL) + { + return; + } + + p->Access = true; + p->NoBridge = p->NoRouting = p->MonitorPort = false; + p->MaxConnection = 32; + p->TimeOut = 20; + p->FixPassword = false; +} + +// Create a Link +LINK *NewLink(CEDAR *cedar, HUB *hub, CLIENT_OPTION *option, CLIENT_AUTH *auth, POLICY *policy) +{ + CLIENT_OPTION *o; + LINK *k; + CLIENT_AUTH *a; + // Validate arguments + if (cedar == NULL || hub == NULL || option == NULL || auth == NULL || policy == NULL) + { + return NULL; + } + if (hub->Halt) + { + return NULL; + } + + if (LIST_NUM(hub->LinkList) >= MAX_HUB_LINKS) + { + return NULL; + } + + if (UniIsEmptyStr(option->AccountName)) + { + return NULL; + } + + // Limitation of authentication method + if (auth->AuthType != CLIENT_AUTHTYPE_ANONYMOUS && auth->AuthType != CLIENT_AUTHTYPE_PASSWORD && + auth->AuthType != CLIENT_AUTHTYPE_PLAIN_PASSWORD && auth->AuthType != CLIENT_AUTHTYPE_CERT && auth->AuthType != CLIENT_AUTHTYPE_OPENSSLENGINE) + { + // Authentication method other than anonymous authentication, password authentication, plain password, certificate authentication cannot be used + return NULL; + } + + // Copy of the client options (for modification) + o = ZeroMalloc(sizeof(CLIENT_OPTION)); + Copy(o, option, sizeof(CLIENT_OPTION)); + StrCpy(o->DeviceName, sizeof(o->DeviceName), LINK_DEVICE_NAME); + + o->RequireBridgeRoutingMode = true; // Request the bridge mode + o->RequireMonitorMode = false; // Not to require the monitor mode + + o->NumRetry = INFINITE; // Retry the connection infinitely + o->RetryInterval = 10; // Retry interval is 10 seconds + o->NoRoutingTracking = true; // Stop the routing tracking + + // Copy the authentication data + a = CopyClientAuth(auth); + a->SecureSignProc = NULL; + a->CheckCertProc = NULL; + + // Link object + k = ZeroMalloc(sizeof(LINK)); + + k->StopAllLinkFlag = &hub->StopAllLinkFlag; + + k->lock = NewLock(); + k->ref = NewRef(); + + k->Cedar = cedar; + k->Option = o; + k->Auth = a; + k->Hub = hub; + + // Copy the policy + k->Policy = ZeroMalloc(sizeof(POLICY)); + Copy(k->Policy, policy, sizeof(POLICY)); + + // Normalize the policy + NormalizeLinkPolicy(k->Policy); + + // Register in the link list of the HUB + LockList(hub->LinkList); + { + Add(hub->LinkList, k); + AddRef(k->ref); + } + UnlockList(hub->LinkList); + + return k; +} + diff --git a/src/Cedar/Link.h b/src/Cedar/Link.h index 22b42999..66870b13 100644 --- a/src/Cedar/Link.h +++ b/src/Cedar/Link.h @@ -1,65 +1,65 @@ -// SoftEther VPN Source Code - Developer Edition Master Branch -// Cedar Communication Module - - -// Link.h -// Header of Link.c - -#ifndef LINK_H -#define LINK_H - -struct LINK -{ - bool Started; // Running flag - volatile bool Halting; // Halting flag - bool Offline; // Offline - bool NoOnline; // Do not set to online flag - REF *ref; // Reference counter - LOCK *lock; // Lock - CEDAR *Cedar; // Cedar - HUB *Hub; // HUB - SESSION *ClientSession; // Client session - SESSION *ServerSession; // Server session - CLIENT_OPTION *Option; // Client Option - CLIENT_AUTH *Auth; // Authentication data - POLICY *Policy; // Policy - QUEUE *SendPacketQueue; // Transmission packet queue - UINT CurrentSendPacketQueueSize; // Current send packet queue size - UINT LastError; // Last error - bool CheckServerCert; // To check the server certificate - X *ServerCert; // Server certificate - bool LockFlag; // Lock flag - bool *StopAllLinkFlag; // Stop all link flag - UINT LastServerConnectionReceivedBlocksNum; // Last server connection recv queue num - UINT Flag1; -}; - - -PACKET_ADAPTER *LinkGetPacketAdapter(); -bool LinkPaInit(SESSION *s); -CANCEL *LinkPaGetCancel(SESSION *s); -UINT LinkPaGetNextPacket(SESSION *s, void **data); -bool LinkPaPutPacket(SESSION *s, void *data, UINT size); -void LinkPaFree(SESSION *s); - -void LinkServerSessionThread(THREAD *t, void *param); -LINK *NewLink(CEDAR *cedar, HUB *hub, CLIENT_OPTION *option, CLIENT_AUTH *auth, POLICY *policy); -void StartLink(LINK *k); -void StopLink(LINK *k); -void DelLink(HUB *hub, LINK *k); -void LockLink(LINK *k); -void UnlockLink(LINK *k); -void StopAllLink(HUB *h); -void StartAllLink(HUB *h); -void SetLinkOnline(LINK *k); -void SetLinkOffline(LINK *k); -void ReleaseLink(LINK *k); -void CleanupLink(LINK *k); -void ReleaseAllLink(HUB *h); -void NormalizeLinkPolicy(POLICY *p); - -#endif // LINK_H - - - - +// SoftEther VPN Source Code - Developer Edition Master Branch +// Cedar Communication Module + + +// Link.h +// Header of Link.c + +#ifndef LINK_H +#define LINK_H + +struct LINK +{ + bool Started; // Running flag + volatile bool Halting; // Halting flag + bool Offline; // Offline + bool NoOnline; // Do not set to online flag + REF *ref; // Reference counter + LOCK *lock; // Lock + CEDAR *Cedar; // Cedar + HUB *Hub; // HUB + SESSION *ClientSession; // Client session + SESSION *ServerSession; // Server session + CLIENT_OPTION *Option; // Client Option + CLIENT_AUTH *Auth; // Authentication data + POLICY *Policy; // Policy + QUEUE *SendPacketQueue; // Transmission packet queue + UINT CurrentSendPacketQueueSize; // Current send packet queue size + UINT LastError; // Last error + bool CheckServerCert; // To check the server certificate + X *ServerCert; // Server certificate + bool LockFlag; // Lock flag + bool *StopAllLinkFlag; // Stop all link flag + UINT LastServerConnectionReceivedBlocksNum; // Last server connection recv queue num + UINT Flag1; +}; + + +PACKET_ADAPTER *LinkGetPacketAdapter(); +bool LinkPaInit(SESSION *s); +CANCEL *LinkPaGetCancel(SESSION *s); +UINT LinkPaGetNextPacket(SESSION *s, void **data); +bool LinkPaPutPacket(SESSION *s, void *data, UINT size); +void LinkPaFree(SESSION *s); + +void LinkServerSessionThread(THREAD *t, void *param); +LINK *NewLink(CEDAR *cedar, HUB *hub, CLIENT_OPTION *option, CLIENT_AUTH *auth, POLICY *policy); +void StartLink(LINK *k); +void StopLink(LINK *k); +void DelLink(HUB *hub, LINK *k); +void LockLink(LINK *k); +void UnlockLink(LINK *k); +void StopAllLink(HUB *h); +void StartAllLink(HUB *h); +void SetLinkOnline(LINK *k); +void SetLinkOffline(LINK *k); +void ReleaseLink(LINK *k); +void CleanupLink(LINK *k); +void ReleaseAllLink(HUB *h); +void NormalizeLinkPolicy(POLICY *p); + +#endif // LINK_H + + + + diff --git a/src/Cedar/Listener.c b/src/Cedar/Listener.c index f365ddc8..b39341b3 100644 --- a/src/Cedar/Listener.c +++ b/src/Cedar/Listener.c @@ -1,1011 +1,1011 @@ -// SoftEther VPN Source Code - Developer Edition Master Branch -// Cedar Communication Module - - -// Listener.c -// Listener module - -#include "CedarPch.h" - -static bool disable_dos = false; -static UINT max_connections_per_ip = DEFAULT_MAX_CONNECTIONS_PER_IP; -static UINT max_unestablished_connections = DEFAULT_MAX_UNESTABLISHED_CONNECTIONS; -static bool listener_proc_recv_rpc = false; - -// Set the flag of whether to response to the RPC of RUDP -void ListenerSetProcRecvRpcEnable(bool b) -{ - listener_proc_recv_rpc = b; -} - -// Get the number of allowed outstanding connections -UINT GetMaxUnestablishedConnections() -{ - return max_unestablished_connections; -} - -// Set the number of allowed outstanding connections -void SetMaxUnestablishedConnections(UINT num) -{ - if (num == 0) - { - num = DEFAULT_MAX_UNESTABLISHED_CONNECTIONS; - } - - max_unestablished_connections = MAX(num, max_connections_per_ip); -} - -// Get the maximum number of connections per IP address -UINT GetMaxConnectionsPerIp() -{ - return max_connections_per_ip; -} - -// Set the maximum number of connections per IP address -void SetMaxConnectionsPerIp(UINT num) -{ - if (num == 0) - { - num = DEFAULT_MAX_CONNECTIONS_PER_IP; - } - max_connections_per_ip = MAX(num, MIN_MAX_CONNECTIONS_PER_IP); -} - -// Enable the DoS defense -void EnableDosProtect() -{ - disable_dos = false; -} - -// Disable the DoS defense -void DisableDosProtect() -{ - disable_dos = true; -} - -// An UDP packet has been received -void UDPReceivedPacket(CEDAR *cedar, SOCK *s, IP *ip, UINT port, void *data, UINT size) -{ - SESSION *session; - UINT *key32; - UCHAR *buf; - CONNECTION *c; - // Validate arguments - if (s == NULL || ip == NULL || data == NULL || size == 0 || cedar == NULL) - { - return; - } - - if (size < 16) - { - // Ignore since the packet size is not enough - return; - } - buf = (UCHAR *)data; - key32 = (UINT *)(buf + 4); - - - // Get the session from the Key32 value - session = GetSessionFromUDPEntry(cedar, Endian32(*key32)); - if (session == NULL) - { - Debug("Invalid UDP Session Key 32: 0x%X\n", *key32); - return; - } - - c = session->Connection; - - // Write the data - PutUDPPacketData(c, buf, size); - - // Rewrite the UDP socket associated with the connection - Lock(c->lock); - { - if (c->Protocol == CONNECTION_UDP) - { - if (c->Udp->s != s) - { - if (c->Udp->s != NULL) - { - ReleaseSock(c->Udp->s); - } - AddRef(s->ref); - c->Udp->s = s; - } - Copy(&c->Udp->ip, ip, sizeof(UINT)); - c->Udp->port = port; - } - } - Unlock(c->lock); - - // Invoke the Cancel - Cancel(session->Cancel1); - - // Release the session - ReleaseSession(session); -} - -// Thread that processes the accepted TCP connection -void TCPAcceptedThread(THREAD *t, void *param) -{ - TCP_ACCEPTED_PARAM *data; - LISTENER *r; - SOCK *s; - CONNECTION *c; - bool flag1; - char tmp[128]; - // Validate arguments - if (t == NULL || param == NULL) - { - return; - } - - // Initialize - data = (TCP_ACCEPTED_PARAM *)param; - r = data->r; - s = data->s; - AddRef(r->ref); - AddRef(s->ref); - - // Create a connection - c = NewServerConnection(r->Cedar, s, t); - - AddRef(r->ref); - c->Listener = r; - - // Register to Cedar as a transient connection - AddConnection(c->Cedar, c); - - NoticeThreadInit(t); - - AcceptInit(s); - StrCpy(c->ClientHostname, sizeof(c->ClientHostname), s->RemoteHostname); - IPToStr(tmp, sizeof(tmp), &s->RemoteIP); - if (IS_SPECIAL_PORT(s->RemotePort) == false) - { - SLog(r->Cedar, "LS_LISTENER_ACCEPT", r->Port, tmp, s->RemoteHostname, s->RemotePort); - } - - // Reception - ConnectionAccept(c); - flag1 = c->flag1; - - // Release - SLog(r->Cedar, "LS_CONNECTION_END_1", c->Name); - ReleaseListener(c->Listener); - c->Listener = NULL; - ReleaseConnection(c); - - // Release - if (flag1 == false) - { - Debug("%s %u flag1 == false\n", __FILE__, __LINE__); - IPToStr(tmp, sizeof(tmp), &s->RemoteIP); - - if (IS_SPECIAL_PORT(s->RemotePort) == false) - { - SLog(r->Cedar, "LS_LISTENER_DISCONNECT", tmp, s->RemotePort); - } - Disconnect(s); - } - ReleaseSock(s); - ReleaseListener(r); -} - -// Jump here if there is accepted connection in the TCP -void TCPAccepted(LISTENER *r, SOCK *s) -{ - TCP_ACCEPTED_PARAM *data; - THREAD *t; - char tmp[MAX_SIZE]; - UINT num_clients_from_this_ip = 0; - CEDAR *cedar; - // Validate arguments - if (r == NULL || s == NULL) - { - return; - } - - cedar = r->Cedar; - - num_clients_from_this_ip = GetNumIpClient(&s->RemoteIP); - - - IPToStr(tmp, sizeof(tmp), &s->RemoteIP); - - data = ZeroMalloc(sizeof(TCP_ACCEPTED_PARAM)); - data->r = r; - data->s = s; - - if (r->ThreadProc == TCPAcceptedThread) - { - Inc(cedar->AcceptingSockets); - } - - t = NewThread(r->ThreadProc, data); - WaitThreadInit(t); - Free(data); - ReleaseThread(t); -} - - -// UDP listener main loop -void ListenerUDPMainLoop(LISTENER *r) -{ - UCHAR *data; - // Validate arguments - if (r == NULL) - { - return; - } - - Debug("ListenerUDPMainLoop Starts.\n"); - r->Status = LISTENER_STATUS_TRYING; - - while (true) - { - // Try to listen on the UDP port - while (true) - { - // Stop flag inspection - if (r->Halt) - { - // Stop - return; - } - - Debug("NewUDP()\n"); - r->Sock = NewUDPEx2(r->Port, false, &r->Cedar->Server->ListenIP); - if (r->Sock != NULL) - { - // Wait success - break; - } - - // Wait failure - Debug("Failed to NewUDP.\n"); - Wait(r->Event, LISTEN_RETRY_TIME); - - // Stop flag inspection - if (r->Halt) - { - Debug("UDP Halt.\n"); - return; - } - } - - r->Status = LISTENER_STATUS_LISTENING; - Debug("Start Listening at UDP Port %u.\n", r->Sock->LocalPort); - - // Stop flag inspection - if (r->Halt) - { - // Stop - goto STOP; - } - - // Allocate the buffer area - data = Malloc(UDP_PACKET_SIZE); - - // Read the next packet - while (true) - { - IP src_ip; - UINT src_port; - UINT size; - SOCKSET set; - - InitSockSet(&set); - AddSockSet(&set, r->Sock); - Select(&set, SELECT_TIME, NULL, NULL); - - size = RecvFrom(r->Sock, &src_ip, &src_port, data, UDP_PACKET_SIZE); - if (((size == 0) && (r->Sock->IgnoreRecvErr == false)) || r->Halt) - { - // Error has occurred -STOP: - Disconnect(r->Sock); - ReleaseSock(r->Sock); - r->Sock = NULL; - Debug("UDP Listen Stopped.\n"); - Free(data); - break; - } - - // Received an UDP packet - if (size != SOCK_LATER) - { - UDPReceivedPacket(r->Cedar, r->Sock, &src_ip, src_port, data, size); - } - } - } -} - -// RPC reception procedure -bool ListenerRUDPRpcRecvProc(RUDP_STACK *r, UDPPACKET *p) -{ - return false; -} - -// TCP listener main loop -void ListenerTCPMainLoop(LISTENER *r) -{ - SOCK *new_sock; - SOCK *s; - // Validate arguments - if (r == NULL) - { - return; - } - - Debug("ListenerTCPMainLoop Starts.\n"); - r->Status = LISTENER_STATUS_TRYING; - - while (true) - { - bool first_failed = true; - Debug("Status = LISTENER_STATUS_TRYING\n"); - r->Status = LISTENER_STATUS_TRYING; - - // Try to Listen - while (true) - { - UINT interval; - // Stop flag inspection - if (r->Halt) - { - // Stop - return; - } - - s = NULL; - - if (r->Protocol == LISTENER_TCP) - { - if (r->ShadowIPv6 == false) - { - if (r->Cedar->Server == NULL) - { - s = ListenEx2(r->Port, r->LocalOnly, r->EnableConditionalAccept, NULL); - } - else - { - s = ListenEx2(r->Port, r->LocalOnly, r->EnableConditionalAccept, &r->Cedar->Server->ListenIP); - } - } - else - { - s = ListenEx6(r->Port, r->LocalOnly); - } - } - else if (r->Protocol == LISTENER_INPROC) - { - s = ListenInProc(); - } - else if (r->Protocol == LISTENER_RUDP) - { - s = ListenRUDPEx(VPN_RUDP_SVC_NAME, NULL, ListenerRUDPRpcRecvProc, NULL, 0, false, false, r->NatTGlobalUdpPort, r->RandPortId, &r->Cedar->Server->ListenIP); - } - else if (r->Protocol == LISTENER_ICMP) - { - s = ListenRUDPEx(VPN_RUDP_SVC_NAME, NULL, ListenerRUDPRpcRecvProc, NULL, MAKE_SPECIAL_PORT(IP_PROTO_ICMPV4), - true, false, NULL, 0, &r->Cedar->Server->ListenIP); - } - else if (r->Protocol == LISTENER_DNS) - { - s = ListenRUDPEx(VPN_RUDP_SVC_NAME, NULL, ListenerRUDPRpcRecvProc, NULL, 53, true, true, NULL, 0, &r->Cedar->Server->ListenIP); - } - else if (r->Protocol == LISTENER_REVERSE) - { - s = ListenReverse(); - } - - if (s != NULL) - { - // Listen success - AddRef(s->ref); - - Lock(r->lock); - { - r->Sock = s; - } - Unlock(r->lock); - - if (r->ShadowIPv6 == false && r->Protocol == LISTENER_TCP) - { - SLog(r->Cedar, "LS_LISTENER_START_2", r->Port); - } - break; - } - - // Listen failure - if (first_failed) - { - first_failed = false; - if (r->ShadowIPv6 == false && r->Protocol == LISTENER_TCP) - { - SLog(r->Cedar, "LS_LISTENER_START_3", r->Port, LISTEN_RETRY_TIME / 1000); - } - } - - interval = LISTEN_RETRY_TIME; - - if (r->ShadowIPv6) - { - if (IsIPv6Supported() == false) - { - interval = LISTEN_RETRY_TIME_NOIPV6; - - Debug("IPv6 is not supported.\n"); - } - } - - Wait(r->Event, interval); - - // Stop flag inspection - if (r->Halt) - { - // Stop - Debug("Listener Halt.\n"); - return; - } - } - - r->Status = LISTENER_STATUS_LISTENING; - Debug("Status = LISTENER_STATUS_LISTENING\n"); - - // Stop flag inspection - if (r->Halt) - { - // Stop - goto STOP; - } - - // Accept loop - while (true) - { - // Accept - Debug("Accept()\n"); - new_sock = Accept(s); - if (new_sock != NULL) - { - // Accept success - Debug("Accepted.\n"); - TCPAccepted(r, new_sock); - ReleaseSock(new_sock); - } - else - { -STOP: - Debug("Accept Canceled.\n"); - // Failed to accept (socket is destroyed) - // Close the listening socket - Disconnect(s); - ReleaseSock(s); - s = NULL; - - Lock(r->lock); - { - if (r->Sock != NULL) - { - s = r->Sock; - r->Sock = NULL; - } - } - Unlock(r->lock); - - if (s != NULL) - { - ReleaseSock(s); - } - - s = NULL; - - break; - } - } - - // Stop flag inspection - if (r->Halt) - { - // Stop - Debug("Listener Halt.\n"); - return; - } - } -} - -// Listener Thread -void ListenerThread(THREAD *thread, void *param) -{ - LISTENER *r; - // Validate arguments - if (thread == NULL || param == NULL) - { - return; - } - - // Initialize - r = (LISTENER *)param; - AddRef(r->ref); - r->Thread = thread; - AddRef(thread->ref); - NoticeThreadInit(thread); - - // Main loop - switch (r->Protocol) - { - case LISTENER_TCP: - case LISTENER_INPROC: - case LISTENER_RUDP: - case LISTENER_DNS: - case LISTENER_ICMP: - case LISTENER_REVERSE: - // TCP or other stream-based protocol - ListenerTCPMainLoop(r); - break; - - case LISTENER_UDP: - // UDP protocol - ListenerUDPMainLoop(r); - break; - } - - // Release - ReleaseListener(r); -} - -// Shutdown the Listener -void StopListener(LISTENER *r) -{ - UINT port; - SOCK *s = NULL; - // Validate arguments - if (r == NULL) - { - return; - } - - Lock(r->lock); - if (r->Halt) - { - Unlock(r->lock); - return; - } - - // Stop flag set - r->Halt = true; - - if (r->Sock != NULL) - { - s = r->Sock; - - AddRef(s->ref); - } - - Unlock(r->lock); - - port = r->Port; - - if (r->ShadowIPv6 == false && r->Protocol == LISTENER_TCP) - { - SLog(r->Cedar, "LS_LISTENER_STOP_1", port); - } - - // Close the socket - if (s != NULL) - { - Disconnect(s); - ReleaseSock(s); - s = NULL; - } - - // Set the event - Set(r->Event); - - // Wait for stopping the thread - WaitThread(r->Thread, INFINITE); - - // Stop the shadow listener - if (r->ShadowIPv6 == false) - { - if (r->ShadowListener != NULL) - { - StopListener(r->ShadowListener); - - ReleaseListener(r->ShadowListener); - - r->ShadowListener = NULL; - } - } - - if (r->ShadowIPv6 == false && r->Protocol == LISTENER_TCP) - { - SLog(r->Cedar, "LS_LISTENER_STOP_2", port); - } -} - -// Cleanup the listener -void CleanupListener(LISTENER *r) -{ - UINT i = 0; - // Validate arguments - if (r == NULL) - { - return; - } - - - if (r->Sock != NULL) - { - ReleaseSock(r->Sock); - } - - DeleteLock(r->lock); - ReleaseThread(r->Thread); - ReleaseEvent(r->Event); - - ReleaseCedar(r->Cedar); - - Free(r); -} - -// Release the listener -void ReleaseListener(LISTENER *r) -{ - // Validate arguments - if (r == NULL) - { - return; - } - - if (Release(r->ref) == 0) - { - CleanupListener(r); - } -} - -// Comparison function of UDP entry list -int CompareUDPEntry(void *p1, void *p2) -{ - UDP_ENTRY *e1, *e2; - if (p1 == NULL || p2 == NULL) - { - return 0; - } - e1 = *(UDP_ENTRY **)p1; - e2 = *(UDP_ENTRY **)p2; - if (e1 == NULL || e2 == NULL) - { - return 0; - } - - if (e1->SessionKey32 > e2->SessionKey32) - { - return 1; - } - else if (e1->SessionKey32 == e2->SessionKey32) - { - return 0; - } - else - { - return -1; - } -} - -// Comparison function of the listener -int CompareListener(void *p1, void *p2) -{ - LISTENER *r1, *r2; - if (p1 == NULL || p2 == NULL) - { - return 0; - } - r1 = *(LISTENER **)p1; - r2 = *(LISTENER **)p2; - if (r1 == NULL || r2 == NULL) - { - return 0; - } - - if (r1->Protocol > r2->Protocol) - { - return 1; - } - else if (r1->Protocol < r2->Protocol) - { - return -1; - } - else if (r1->Port > r2->Port) - { - return 1; - } - else if (r1->Port < r2->Port) - { - return -1; - } - else - { - return 0; - } -} - -// Create a New Listener -LISTENER *NewListener(CEDAR *cedar, UINT proto, UINT port) -{ - return NewListenerEx(cedar, proto, port, TCPAcceptedThread, NULL); -} -LISTENER *NewListenerEx(CEDAR *cedar, UINT proto, UINT port, THREAD_PROC *proc, void *thread_param) -{ - return NewListenerEx2(cedar, proto, port, proc, thread_param, false); -} -LISTENER *NewListenerEx2(CEDAR *cedar, UINT proto, UINT port, THREAD_PROC *proc, void *thread_param, bool local_only) -{ - return NewListenerEx3(cedar, proto, port, proc, thread_param, local_only, false); -} -LISTENER *NewListenerEx3(CEDAR *cedar, UINT proto, UINT port, THREAD_PROC *proc, void *thread_param, bool local_only, bool shadow_ipv6) -{ - return NewListenerEx4(cedar, proto, port, proc, thread_param, local_only, shadow_ipv6, NULL, 0); -} -LISTENER *NewListenerEx4(CEDAR *cedar, UINT proto, UINT port, THREAD_PROC *proc, void *thread_param, bool local_only, bool shadow_ipv6, - volatile UINT *natt_global_udp_port, UCHAR rand_port_id) -{ - return NewListenerEx5(cedar, proto, port, proc, thread_param, - local_only, shadow_ipv6, natt_global_udp_port, rand_port_id, false); -} -LISTENER *NewListenerEx5(CEDAR *cedar, UINT proto, UINT port, THREAD_PROC *proc, void *thread_param, bool local_only, bool shadow_ipv6, - volatile UINT *natt_global_udp_port, UCHAR rand_port_id, bool enable_ca) -{ - LISTENER *r; - THREAD *t; - // Validate arguments - if ((proto == LISTENER_TCP && port == 0) || cedar == NULL) - { - return NULL; - } - // Check the protocol number - if (proto != LISTENER_TCP && proto != LISTENER_INPROC && - proto != LISTENER_RUDP && proto != LISTENER_ICMP && proto != LISTENER_DNS && - proto != LISTENER_REVERSE) - { - return NULL; - } - - r = ZeroMalloc(sizeof(LISTENER)); - - r->ThreadProc = proc; - r->ThreadParam = thread_param; - r->Cedar = cedar; - AddRef(r->Cedar->ref); - r->lock = NewLock(); - r->ref = NewRef(); - r->Protocol = proto; - r->Port = port; - r->Event = NewEvent(); - - - r->LocalOnly = local_only; - r->ShadowIPv6 = shadow_ipv6; - r->NatTGlobalUdpPort = natt_global_udp_port; - r->RandPortId = rand_port_id; - r->EnableConditionalAccept = enable_ca; - - if (r->ShadowIPv6 == false) - { - if (proto == LISTENER_TCP) - { - SLog(cedar, "LS_LISTENER_START_1", port); - } - } - - // Creating a thread - t = NewThread(ListenerThread, r); - WaitThreadInit(t); - ReleaseThread(t); - - if (r->ShadowIPv6 == false && proto == LISTENER_TCP) - { - if (r->Cedar->DisableIPv6Listener == false) - { - // Add a shadow listener - r->ShadowListener = NewListenerEx3(cedar, proto, port, proc, thread_param, - local_only, true); - } - } - - if (r->ShadowIPv6 == false) - { - // Add to the Cedar - AddListener(cedar, r); - } - - return r; -} - -// Get the session from the session key -SESSION *GetSessionFromUDPEntry(CEDAR *cedar, UINT key32) -{ - UDP_ENTRY *e, t; - SESSION *s; - // Validate arguments - if (cedar == NULL) - { - return NULL; - } - - t.SessionKey32 = key32; - - LockList(cedar->UDPEntryList); - { - e = Search(cedar->UDPEntryList, &t); - if (e == NULL) - { - UnlockList(cedar->UDPEntryList); - return NULL; - } - s = e->Session; - AddRef(s->ref); - } - UnlockList(cedar->UDPEntryList); - - return s; -} - -// Delete the UDP session from the UDP entry -void DelUDPEntry(CEDAR *cedar, SESSION *session) -{ - UINT num, i; - // Validate arguments - if (cedar == NULL || session == NULL) - { - return; - } - - LockList(cedar->UDPEntryList); - { - num = LIST_NUM(cedar->UDPEntryList); - for (i = 0;i < num;i++) - { - UDP_ENTRY *e = LIST_DATA(cedar->UDPEntryList, i); - if (e->Session == session) - { - ReleaseSession(e->Session); - Delete(cedar->UDPEntryList, e); - Free(e); - UnlockList(cedar->UDPEntryList); - Debug("UDP_Entry Deleted.\n"); - return; - } - } - } - UnlockList(cedar->UDPEntryList); -} - -// Add an UDP session to the UDP entry -void AddUDPEntry(CEDAR *cedar, SESSION *session) -{ - UDP_ENTRY *e; - // Validate arguments - if (cedar == NULL || session == NULL) - { - return; - } - - e = ZeroMalloc(sizeof(UDP_ENTRY)); - e->Session = session; - e->SessionKey32 = session->SessionKey32; - AddRef(session->ref); - - LockList(cedar->UDPEntryList); - { - Add(cedar->UDPEntryList, e); - } - UnlockList(cedar->UDPEntryList); - - Debug("UDP_Entry Added.\n"); -} - -// Clear the UDP entry -void CleanupUDPEntry(CEDAR *cedar) -{ - // Validate arguments - if (cedar == NULL) - { - return; - } -} - -// Create a new dynamic listener -DYNAMIC_LISTENER *NewDynamicListener(CEDAR *c, bool *enable_ptr, UINT protocol, UINT port) -{ - DYNAMIC_LISTENER *d; - // Validate arguments - if (c == NULL || enable_ptr == NULL) - { - return NULL; - } - - d = ZeroMalloc(sizeof(DYNAMIC_LISTENER)); - - d->Cedar = c; - AddRef(d->Cedar->ref); - - d->Lock = NewLock(); - - d->EnablePtr = enable_ptr; - - d->Listener = NULL; - - d->Protocol = protocol; - d->Port = port; - - ApplyDynamicListener(d); - - return d; -} - -// Release the dynamic listener -void FreeDynamicListener(DYNAMIC_LISTENER *d) -{ - // Validate arguments - if (d == NULL) - { - return; - } - - Lock(d->Lock); - { - if (d->Listener != NULL) - { - StopListener(d->Listener); - ReleaseListener(d->Listener); - d->Listener = NULL; - } - } - Unlock(d->Lock); - - ReleaseCedar(d->Cedar); - - DeleteLock(d->Lock); - - Free(d); -} - -// Set the state to dynamic listener -void ApplyDynamicListener(DYNAMIC_LISTENER *d) -{ - // Validate arguments - if (d == NULL) - { - return; - } - - Lock(d->Lock); - { - // Change the state - if (*d->EnablePtr) - { - if (d->Listener == NULL) - { - // Create a listener - WHERE; - d->Listener = NewListener(d->Cedar, d->Protocol, d->Port); - } - } - else - { - // Stop the listener - if (d->Listener != NULL) - { - WHERE; - StopListener(d->Listener); - ReleaseListener(d->Listener); - d->Listener = NULL; - } - } - } - Unlock(d->Lock); -} - - +// SoftEther VPN Source Code - Developer Edition Master Branch +// Cedar Communication Module + + +// Listener.c +// Listener module + +#include "CedarPch.h" + +static bool disable_dos = false; +static UINT max_connections_per_ip = DEFAULT_MAX_CONNECTIONS_PER_IP; +static UINT max_unestablished_connections = DEFAULT_MAX_UNESTABLISHED_CONNECTIONS; +static bool listener_proc_recv_rpc = false; + +// Set the flag of whether to response to the RPC of RUDP +void ListenerSetProcRecvRpcEnable(bool b) +{ + listener_proc_recv_rpc = b; +} + +// Get the number of allowed outstanding connections +UINT GetMaxUnestablishedConnections() +{ + return max_unestablished_connections; +} + +// Set the number of allowed outstanding connections +void SetMaxUnestablishedConnections(UINT num) +{ + if (num == 0) + { + num = DEFAULT_MAX_UNESTABLISHED_CONNECTIONS; + } + + max_unestablished_connections = MAX(num, max_connections_per_ip); +} + +// Get the maximum number of connections per IP address +UINT GetMaxConnectionsPerIp() +{ + return max_connections_per_ip; +} + +// Set the maximum number of connections per IP address +void SetMaxConnectionsPerIp(UINT num) +{ + if (num == 0) + { + num = DEFAULT_MAX_CONNECTIONS_PER_IP; + } + max_connections_per_ip = MAX(num, MIN_MAX_CONNECTIONS_PER_IP); +} + +// Enable the DoS defense +void EnableDosProtect() +{ + disable_dos = false; +} + +// Disable the DoS defense +void DisableDosProtect() +{ + disable_dos = true; +} + +// An UDP packet has been received +void UDPReceivedPacket(CEDAR *cedar, SOCK *s, IP *ip, UINT port, void *data, UINT size) +{ + SESSION *session; + UINT *key32; + UCHAR *buf; + CONNECTION *c; + // Validate arguments + if (s == NULL || ip == NULL || data == NULL || size == 0 || cedar == NULL) + { + return; + } + + if (size < 16) + { + // Ignore since the packet size is not enough + return; + } + buf = (UCHAR *)data; + key32 = (UINT *)(buf + 4); + + + // Get the session from the Key32 value + session = GetSessionFromUDPEntry(cedar, Endian32(*key32)); + if (session == NULL) + { + Debug("Invalid UDP Session Key 32: 0x%X\n", *key32); + return; + } + + c = session->Connection; + + // Write the data + PutUDPPacketData(c, buf, size); + + // Rewrite the UDP socket associated with the connection + Lock(c->lock); + { + if (c->Protocol == CONNECTION_UDP) + { + if (c->Udp->s != s) + { + if (c->Udp->s != NULL) + { + ReleaseSock(c->Udp->s); + } + AddRef(s->ref); + c->Udp->s = s; + } + Copy(&c->Udp->ip, ip, sizeof(UINT)); + c->Udp->port = port; + } + } + Unlock(c->lock); + + // Invoke the Cancel + Cancel(session->Cancel1); + + // Release the session + ReleaseSession(session); +} + +// Thread that processes the accepted TCP connection +void TCPAcceptedThread(THREAD *t, void *param) +{ + TCP_ACCEPTED_PARAM *data; + LISTENER *r; + SOCK *s; + CONNECTION *c; + bool flag1; + char tmp[128]; + // Validate arguments + if (t == NULL || param == NULL) + { + return; + } + + // Initialize + data = (TCP_ACCEPTED_PARAM *)param; + r = data->r; + s = data->s; + AddRef(r->ref); + AddRef(s->ref); + + // Create a connection + c = NewServerConnection(r->Cedar, s, t); + + AddRef(r->ref); + c->Listener = r; + + // Register to Cedar as a transient connection + AddConnection(c->Cedar, c); + + NoticeThreadInit(t); + + AcceptInit(s); + StrCpy(c->ClientHostname, sizeof(c->ClientHostname), s->RemoteHostname); + IPToStr(tmp, sizeof(tmp), &s->RemoteIP); + if (IS_SPECIAL_PORT(s->RemotePort) == false) + { + SLog(r->Cedar, "LS_LISTENER_ACCEPT", r->Port, tmp, s->RemoteHostname, s->RemotePort); + } + + // Reception + ConnectionAccept(c); + flag1 = c->flag1; + + // Release + SLog(r->Cedar, "LS_CONNECTION_END_1", c->Name); + ReleaseListener(c->Listener); + c->Listener = NULL; + ReleaseConnection(c); + + // Release + if (flag1 == false) + { + Debug("%s %u flag1 == false\n", __FILE__, __LINE__); + IPToStr(tmp, sizeof(tmp), &s->RemoteIP); + + if (IS_SPECIAL_PORT(s->RemotePort) == false) + { + SLog(r->Cedar, "LS_LISTENER_DISCONNECT", tmp, s->RemotePort); + } + Disconnect(s); + } + ReleaseSock(s); + ReleaseListener(r); +} + +// Jump here if there is accepted connection in the TCP +void TCPAccepted(LISTENER *r, SOCK *s) +{ + TCP_ACCEPTED_PARAM *data; + THREAD *t; + char tmp[MAX_SIZE]; + UINT num_clients_from_this_ip = 0; + CEDAR *cedar; + // Validate arguments + if (r == NULL || s == NULL) + { + return; + } + + cedar = r->Cedar; + + num_clients_from_this_ip = GetNumIpClient(&s->RemoteIP); + + + IPToStr(tmp, sizeof(tmp), &s->RemoteIP); + + data = ZeroMalloc(sizeof(TCP_ACCEPTED_PARAM)); + data->r = r; + data->s = s; + + if (r->ThreadProc == TCPAcceptedThread) + { + Inc(cedar->AcceptingSockets); + } + + t = NewThread(r->ThreadProc, data); + WaitThreadInit(t); + Free(data); + ReleaseThread(t); +} + + +// UDP listener main loop +void ListenerUDPMainLoop(LISTENER *r) +{ + UCHAR *data; + // Validate arguments + if (r == NULL) + { + return; + } + + Debug("ListenerUDPMainLoop Starts.\n"); + r->Status = LISTENER_STATUS_TRYING; + + while (true) + { + // Try to listen on the UDP port + while (true) + { + // Stop flag inspection + if (r->Halt) + { + // Stop + return; + } + + Debug("NewUDP()\n"); + r->Sock = NewUDPEx2(r->Port, false, &r->Cedar->Server->ListenIP); + if (r->Sock != NULL) + { + // Wait success + break; + } + + // Wait failure + Debug("Failed to NewUDP.\n"); + Wait(r->Event, LISTEN_RETRY_TIME); + + // Stop flag inspection + if (r->Halt) + { + Debug("UDP Halt.\n"); + return; + } + } + + r->Status = LISTENER_STATUS_LISTENING; + Debug("Start Listening at UDP Port %u.\n", r->Sock->LocalPort); + + // Stop flag inspection + if (r->Halt) + { + // Stop + goto STOP; + } + + // Allocate the buffer area + data = Malloc(UDP_PACKET_SIZE); + + // Read the next packet + while (true) + { + IP src_ip; + UINT src_port; + UINT size; + SOCKSET set; + + InitSockSet(&set); + AddSockSet(&set, r->Sock); + Select(&set, SELECT_TIME, NULL, NULL); + + size = RecvFrom(r->Sock, &src_ip, &src_port, data, UDP_PACKET_SIZE); + if (((size == 0) && (r->Sock->IgnoreRecvErr == false)) || r->Halt) + { + // Error has occurred +STOP: + Disconnect(r->Sock); + ReleaseSock(r->Sock); + r->Sock = NULL; + Debug("UDP Listen Stopped.\n"); + Free(data); + break; + } + + // Received an UDP packet + if (size != SOCK_LATER) + { + UDPReceivedPacket(r->Cedar, r->Sock, &src_ip, src_port, data, size); + } + } + } +} + +// RPC reception procedure +bool ListenerRUDPRpcRecvProc(RUDP_STACK *r, UDPPACKET *p) +{ + return false; +} + +// TCP listener main loop +void ListenerTCPMainLoop(LISTENER *r) +{ + SOCK *new_sock; + SOCK *s; + // Validate arguments + if (r == NULL) + { + return; + } + + Debug("ListenerTCPMainLoop Starts.\n"); + r->Status = LISTENER_STATUS_TRYING; + + while (true) + { + bool first_failed = true; + Debug("Status = LISTENER_STATUS_TRYING\n"); + r->Status = LISTENER_STATUS_TRYING; + + // Try to Listen + while (true) + { + UINT interval; + // Stop flag inspection + if (r->Halt) + { + // Stop + return; + } + + s = NULL; + + if (r->Protocol == LISTENER_TCP) + { + if (r->ShadowIPv6 == false) + { + if (r->Cedar->Server == NULL) + { + s = ListenEx2(r->Port, r->LocalOnly, r->EnableConditionalAccept, NULL); + } + else + { + s = ListenEx2(r->Port, r->LocalOnly, r->EnableConditionalAccept, &r->Cedar->Server->ListenIP); + } + } + else + { + s = ListenEx6(r->Port, r->LocalOnly); + } + } + else if (r->Protocol == LISTENER_INPROC) + { + s = ListenInProc(); + } + else if (r->Protocol == LISTENER_RUDP) + { + s = ListenRUDPEx(VPN_RUDP_SVC_NAME, NULL, ListenerRUDPRpcRecvProc, NULL, 0, false, false, r->NatTGlobalUdpPort, r->RandPortId, &r->Cedar->Server->ListenIP); + } + else if (r->Protocol == LISTENER_ICMP) + { + s = ListenRUDPEx(VPN_RUDP_SVC_NAME, NULL, ListenerRUDPRpcRecvProc, NULL, MAKE_SPECIAL_PORT(IP_PROTO_ICMPV4), + true, false, NULL, 0, &r->Cedar->Server->ListenIP); + } + else if (r->Protocol == LISTENER_DNS) + { + s = ListenRUDPEx(VPN_RUDP_SVC_NAME, NULL, ListenerRUDPRpcRecvProc, NULL, 53, true, true, NULL, 0, &r->Cedar->Server->ListenIP); + } + else if (r->Protocol == LISTENER_REVERSE) + { + s = ListenReverse(); + } + + if (s != NULL) + { + // Listen success + AddRef(s->ref); + + Lock(r->lock); + { + r->Sock = s; + } + Unlock(r->lock); + + if (r->ShadowIPv6 == false && r->Protocol == LISTENER_TCP) + { + SLog(r->Cedar, "LS_LISTENER_START_2", r->Port); + } + break; + } + + // Listen failure + if (first_failed) + { + first_failed = false; + if (r->ShadowIPv6 == false && r->Protocol == LISTENER_TCP) + { + SLog(r->Cedar, "LS_LISTENER_START_3", r->Port, LISTEN_RETRY_TIME / 1000); + } + } + + interval = LISTEN_RETRY_TIME; + + if (r->ShadowIPv6) + { + if (IsIPv6Supported() == false) + { + interval = LISTEN_RETRY_TIME_NOIPV6; + + Debug("IPv6 is not supported.\n"); + } + } + + Wait(r->Event, interval); + + // Stop flag inspection + if (r->Halt) + { + // Stop + Debug("Listener Halt.\n"); + return; + } + } + + r->Status = LISTENER_STATUS_LISTENING; + Debug("Status = LISTENER_STATUS_LISTENING\n"); + + // Stop flag inspection + if (r->Halt) + { + // Stop + goto STOP; + } + + // Accept loop + while (true) + { + // Accept + Debug("Accept()\n"); + new_sock = Accept(s); + if (new_sock != NULL) + { + // Accept success + Debug("Accepted.\n"); + TCPAccepted(r, new_sock); + ReleaseSock(new_sock); + } + else + { +STOP: + Debug("Accept Canceled.\n"); + // Failed to accept (socket is destroyed) + // Close the listening socket + Disconnect(s); + ReleaseSock(s); + s = NULL; + + Lock(r->lock); + { + if (r->Sock != NULL) + { + s = r->Sock; + r->Sock = NULL; + } + } + Unlock(r->lock); + + if (s != NULL) + { + ReleaseSock(s); + } + + s = NULL; + + break; + } + } + + // Stop flag inspection + if (r->Halt) + { + // Stop + Debug("Listener Halt.\n"); + return; + } + } +} + +// Listener Thread +void ListenerThread(THREAD *thread, void *param) +{ + LISTENER *r; + // Validate arguments + if (thread == NULL || param == NULL) + { + return; + } + + // Initialize + r = (LISTENER *)param; + AddRef(r->ref); + r->Thread = thread; + AddRef(thread->ref); + NoticeThreadInit(thread); + + // Main loop + switch (r->Protocol) + { + case LISTENER_TCP: + case LISTENER_INPROC: + case LISTENER_RUDP: + case LISTENER_DNS: + case LISTENER_ICMP: + case LISTENER_REVERSE: + // TCP or other stream-based protocol + ListenerTCPMainLoop(r); + break; + + case LISTENER_UDP: + // UDP protocol + ListenerUDPMainLoop(r); + break; + } + + // Release + ReleaseListener(r); +} + +// Shutdown the Listener +void StopListener(LISTENER *r) +{ + UINT port; + SOCK *s = NULL; + // Validate arguments + if (r == NULL) + { + return; + } + + Lock(r->lock); + if (r->Halt) + { + Unlock(r->lock); + return; + } + + // Stop flag set + r->Halt = true; + + if (r->Sock != NULL) + { + s = r->Sock; + + AddRef(s->ref); + } + + Unlock(r->lock); + + port = r->Port; + + if (r->ShadowIPv6 == false && r->Protocol == LISTENER_TCP) + { + SLog(r->Cedar, "LS_LISTENER_STOP_1", port); + } + + // Close the socket + if (s != NULL) + { + Disconnect(s); + ReleaseSock(s); + s = NULL; + } + + // Set the event + Set(r->Event); + + // Wait for stopping the thread + WaitThread(r->Thread, INFINITE); + + // Stop the shadow listener + if (r->ShadowIPv6 == false) + { + if (r->ShadowListener != NULL) + { + StopListener(r->ShadowListener); + + ReleaseListener(r->ShadowListener); + + r->ShadowListener = NULL; + } + } + + if (r->ShadowIPv6 == false && r->Protocol == LISTENER_TCP) + { + SLog(r->Cedar, "LS_LISTENER_STOP_2", port); + } +} + +// Cleanup the listener +void CleanupListener(LISTENER *r) +{ + UINT i = 0; + // Validate arguments + if (r == NULL) + { + return; + } + + + if (r->Sock != NULL) + { + ReleaseSock(r->Sock); + } + + DeleteLock(r->lock); + ReleaseThread(r->Thread); + ReleaseEvent(r->Event); + + ReleaseCedar(r->Cedar); + + Free(r); +} + +// Release the listener +void ReleaseListener(LISTENER *r) +{ + // Validate arguments + if (r == NULL) + { + return; + } + + if (Release(r->ref) == 0) + { + CleanupListener(r); + } +} + +// Comparison function of UDP entry list +int CompareUDPEntry(void *p1, void *p2) +{ + UDP_ENTRY *e1, *e2; + if (p1 == NULL || p2 == NULL) + { + return 0; + } + e1 = *(UDP_ENTRY **)p1; + e2 = *(UDP_ENTRY **)p2; + if (e1 == NULL || e2 == NULL) + { + return 0; + } + + if (e1->SessionKey32 > e2->SessionKey32) + { + return 1; + } + else if (e1->SessionKey32 == e2->SessionKey32) + { + return 0; + } + else + { + return -1; + } +} + +// Comparison function of the listener +int CompareListener(void *p1, void *p2) +{ + LISTENER *r1, *r2; + if (p1 == NULL || p2 == NULL) + { + return 0; + } + r1 = *(LISTENER **)p1; + r2 = *(LISTENER **)p2; + if (r1 == NULL || r2 == NULL) + { + return 0; + } + + if (r1->Protocol > r2->Protocol) + { + return 1; + } + else if (r1->Protocol < r2->Protocol) + { + return -1; + } + else if (r1->Port > r2->Port) + { + return 1; + } + else if (r1->Port < r2->Port) + { + return -1; + } + else + { + return 0; + } +} + +// Create a New Listener +LISTENER *NewListener(CEDAR *cedar, UINT proto, UINT port) +{ + return NewListenerEx(cedar, proto, port, TCPAcceptedThread, NULL); +} +LISTENER *NewListenerEx(CEDAR *cedar, UINT proto, UINT port, THREAD_PROC *proc, void *thread_param) +{ + return NewListenerEx2(cedar, proto, port, proc, thread_param, false); +} +LISTENER *NewListenerEx2(CEDAR *cedar, UINT proto, UINT port, THREAD_PROC *proc, void *thread_param, bool local_only) +{ + return NewListenerEx3(cedar, proto, port, proc, thread_param, local_only, false); +} +LISTENER *NewListenerEx3(CEDAR *cedar, UINT proto, UINT port, THREAD_PROC *proc, void *thread_param, bool local_only, bool shadow_ipv6) +{ + return NewListenerEx4(cedar, proto, port, proc, thread_param, local_only, shadow_ipv6, NULL, 0); +} +LISTENER *NewListenerEx4(CEDAR *cedar, UINT proto, UINT port, THREAD_PROC *proc, void *thread_param, bool local_only, bool shadow_ipv6, + volatile UINT *natt_global_udp_port, UCHAR rand_port_id) +{ + return NewListenerEx5(cedar, proto, port, proc, thread_param, + local_only, shadow_ipv6, natt_global_udp_port, rand_port_id, false); +} +LISTENER *NewListenerEx5(CEDAR *cedar, UINT proto, UINT port, THREAD_PROC *proc, void *thread_param, bool local_only, bool shadow_ipv6, + volatile UINT *natt_global_udp_port, UCHAR rand_port_id, bool enable_ca) +{ + LISTENER *r; + THREAD *t; + // Validate arguments + if ((proto == LISTENER_TCP && port == 0) || cedar == NULL) + { + return NULL; + } + // Check the protocol number + if (proto != LISTENER_TCP && proto != LISTENER_INPROC && + proto != LISTENER_RUDP && proto != LISTENER_ICMP && proto != LISTENER_DNS && + proto != LISTENER_REVERSE) + { + return NULL; + } + + r = ZeroMalloc(sizeof(LISTENER)); + + r->ThreadProc = proc; + r->ThreadParam = thread_param; + r->Cedar = cedar; + AddRef(r->Cedar->ref); + r->lock = NewLock(); + r->ref = NewRef(); + r->Protocol = proto; + r->Port = port; + r->Event = NewEvent(); + + + r->LocalOnly = local_only; + r->ShadowIPv6 = shadow_ipv6; + r->NatTGlobalUdpPort = natt_global_udp_port; + r->RandPortId = rand_port_id; + r->EnableConditionalAccept = enable_ca; + + if (r->ShadowIPv6 == false) + { + if (proto == LISTENER_TCP) + { + SLog(cedar, "LS_LISTENER_START_1", port); + } + } + + // Creating a thread + t = NewThread(ListenerThread, r); + WaitThreadInit(t); + ReleaseThread(t); + + if (r->ShadowIPv6 == false && proto == LISTENER_TCP) + { + if (r->Cedar->DisableIPv6Listener == false) + { + // Add a shadow listener + r->ShadowListener = NewListenerEx3(cedar, proto, port, proc, thread_param, + local_only, true); + } + } + + if (r->ShadowIPv6 == false) + { + // Add to the Cedar + AddListener(cedar, r); + } + + return r; +} + +// Get the session from the session key +SESSION *GetSessionFromUDPEntry(CEDAR *cedar, UINT key32) +{ + UDP_ENTRY *e, t; + SESSION *s; + // Validate arguments + if (cedar == NULL) + { + return NULL; + } + + t.SessionKey32 = key32; + + LockList(cedar->UDPEntryList); + { + e = Search(cedar->UDPEntryList, &t); + if (e == NULL) + { + UnlockList(cedar->UDPEntryList); + return NULL; + } + s = e->Session; + AddRef(s->ref); + } + UnlockList(cedar->UDPEntryList); + + return s; +} + +// Delete the UDP session from the UDP entry +void DelUDPEntry(CEDAR *cedar, SESSION *session) +{ + UINT num, i; + // Validate arguments + if (cedar == NULL || session == NULL) + { + return; + } + + LockList(cedar->UDPEntryList); + { + num = LIST_NUM(cedar->UDPEntryList); + for (i = 0;i < num;i++) + { + UDP_ENTRY *e = LIST_DATA(cedar->UDPEntryList, i); + if (e->Session == session) + { + ReleaseSession(e->Session); + Delete(cedar->UDPEntryList, e); + Free(e); + UnlockList(cedar->UDPEntryList); + Debug("UDP_Entry Deleted.\n"); + return; + } + } + } + UnlockList(cedar->UDPEntryList); +} + +// Add an UDP session to the UDP entry +void AddUDPEntry(CEDAR *cedar, SESSION *session) +{ + UDP_ENTRY *e; + // Validate arguments + if (cedar == NULL || session == NULL) + { + return; + } + + e = ZeroMalloc(sizeof(UDP_ENTRY)); + e->Session = session; + e->SessionKey32 = session->SessionKey32; + AddRef(session->ref); + + LockList(cedar->UDPEntryList); + { + Add(cedar->UDPEntryList, e); + } + UnlockList(cedar->UDPEntryList); + + Debug("UDP_Entry Added.\n"); +} + +// Clear the UDP entry +void CleanupUDPEntry(CEDAR *cedar) +{ + // Validate arguments + if (cedar == NULL) + { + return; + } +} + +// Create a new dynamic listener +DYNAMIC_LISTENER *NewDynamicListener(CEDAR *c, bool *enable_ptr, UINT protocol, UINT port) +{ + DYNAMIC_LISTENER *d; + // Validate arguments + if (c == NULL || enable_ptr == NULL) + { + return NULL; + } + + d = ZeroMalloc(sizeof(DYNAMIC_LISTENER)); + + d->Cedar = c; + AddRef(d->Cedar->ref); + + d->Lock = NewLock(); + + d->EnablePtr = enable_ptr; + + d->Listener = NULL; + + d->Protocol = protocol; + d->Port = port; + + ApplyDynamicListener(d); + + return d; +} + +// Release the dynamic listener +void FreeDynamicListener(DYNAMIC_LISTENER *d) +{ + // Validate arguments + if (d == NULL) + { + return; + } + + Lock(d->Lock); + { + if (d->Listener != NULL) + { + StopListener(d->Listener); + ReleaseListener(d->Listener); + d->Listener = NULL; + } + } + Unlock(d->Lock); + + ReleaseCedar(d->Cedar); + + DeleteLock(d->Lock); + + Free(d); +} + +// Set the state to dynamic listener +void ApplyDynamicListener(DYNAMIC_LISTENER *d) +{ + // Validate arguments + if (d == NULL) + { + return; + } + + Lock(d->Lock); + { + // Change the state + if (*d->EnablePtr) + { + if (d->Listener == NULL) + { + // Create a listener + WHERE; + d->Listener = NewListener(d->Cedar, d->Protocol, d->Port); + } + } + else + { + // Stop the listener + if (d->Listener != NULL) + { + WHERE; + StopListener(d->Listener); + ReleaseListener(d->Listener); + d->Listener = NULL; + } + } + } + Unlock(d->Lock); +} + + diff --git a/src/Cedar/Listener.h b/src/Cedar/Listener.h index 9ef8a1d8..8cd8e792 100644 --- a/src/Cedar/Listener.h +++ b/src/Cedar/Listener.h @@ -1,108 +1,108 @@ -// SoftEther VPN Source Code - Developer Edition Master Branch -// Cedar Communication Module - - -// Listener.h -// Header of Listener.c - -#ifndef LISTENER_H -#define LISTENER_H - - -// Function to call when receiving a new connection -typedef void (NEW_CONNECTION_PROC)(CONNECTION *c); - - - -// Listener structure -struct LISTENER -{ - LOCK *lock; // Lock - REF *ref; // Reference counter - CEDAR *Cedar; // Cedar - UINT Protocol; // Protocol - UINT Port; // Port number - THREAD *Thread; // Operating thread - SOCK *Sock; // Socket - EVENT *Event; // Event - volatile bool Halt; // Halting flag - UINT Status; // State - - - THREAD_PROC *ThreadProc; // Thread procedure - void *ThreadParam; // Thread parameters - bool LocalOnly; // Can be connected only from localhost - bool ShadowIPv6; // Flag indicating that the shadow IPv6 listener - LISTENER *ShadowListener; // Reference to managing shadow IPv6 listener - bool DisableDos; // Disable the DoS attack detection - volatile UINT *NatTGlobalUdpPort; // NAT-T global UDP port number - UCHAR RandPortId; // NAT-T UDP random port ID - bool EnableConditionalAccept; // The flag of whether to enable the Conditional Accept -}; - -// Parameters of TCPAcceptedThread -struct TCP_ACCEPTED_PARAM -{ - LISTENER *r; - SOCK *s; -}; - -// UDP entry -struct UDP_ENTRY -{ - UINT SessionKey32; // 32bit session key - SESSION *Session; // Reference to the session -}; - -// Dynamic listener -struct DYNAMIC_LISTENER -{ - UINT Protocol; // Protocol - UINT Port; // Port - LOCK *Lock; // Lock - CEDAR *Cedar; // Cedar - bool *EnablePtr; // A pointer to the flag of the valid / invalid state - LISTENER *Listener; // Listener -}; - - -// Function prototype -LISTENER *NewListener(CEDAR *cedar, UINT proto, UINT port); -LISTENER *NewListenerEx(CEDAR *cedar, UINT proto, UINT port, THREAD_PROC *proc, void *thread_param); -LISTENER *NewListenerEx2(CEDAR *cedar, UINT proto, UINT port, THREAD_PROC *proc, void *thread_param, bool local_only); -LISTENER *NewListenerEx3(CEDAR *cedar, UINT proto, UINT port, THREAD_PROC *proc, void *thread_param, bool local_only, bool shadow_ipv6); -LISTENER *NewListenerEx4(CEDAR *cedar, UINT proto, UINT port, THREAD_PROC *proc, void *thread_param, bool local_only, bool shadow_ipv6, - volatile UINT *natt_global_udp_port, UCHAR rand_port_id); -LISTENER *NewListenerEx5(CEDAR *cedar, UINT proto, UINT port, THREAD_PROC *proc, void *thread_param, bool local_only, bool shadow_ipv6, - volatile UINT *natt_global_udp_port, UCHAR rand_port_id, bool enable_ca); -void ReleaseListener(LISTENER *r); -void CleanupListener(LISTENER *r); -void ListenerThread(THREAD *thread, void *param); -void ListenerTCPMainLoop(LISTENER *r); -void StopListener(LISTENER *r); -int CompareListener(void *p1, void *p2); -void TCPAccepted(LISTENER *r, SOCK *s); -void EnableDosProtect(); -void DisableDosProtect(); -void TCPAcceptedThread(THREAD *t, void *param); -void ListenerUDPMainLoop(LISTENER *r); -void UDPReceivedPacket(CEDAR *cedar, SOCK *s, IP *ip, UINT port, void *data, UINT size); -int CompareUDPEntry(void *p1, void *p2); -void CleanupUDPEntry(CEDAR *cedar); -void AddUDPEntry(CEDAR *cedar, SESSION *session); -void DelUDPEntry(CEDAR *cedar, SESSION *session); -SESSION *GetSessionFromUDPEntry(CEDAR *cedar, UINT key32); -UINT GetMaxConnectionsPerIp(); -void SetMaxConnectionsPerIp(UINT num); -UINT GetMaxUnestablishedConnections(); -void SetMaxUnestablishedConnections(UINT num); -DYNAMIC_LISTENER *NewDynamicListener(CEDAR *c, bool *enable_ptr, UINT protocol, UINT port); -void ApplyDynamicListener(DYNAMIC_LISTENER *d); -void FreeDynamicListener(DYNAMIC_LISTENER *d); -bool ListenerRUDPRpcRecvProc(RUDP_STACK *r, UDPPACKET *p); -void ListenerSetProcRecvRpcEnable(bool b); - - -#endif // LISTENER_H - - +// SoftEther VPN Source Code - Developer Edition Master Branch +// Cedar Communication Module + + +// Listener.h +// Header of Listener.c + +#ifndef LISTENER_H +#define LISTENER_H + + +// Function to call when receiving a new connection +typedef void (NEW_CONNECTION_PROC)(CONNECTION *c); + + + +// Listener structure +struct LISTENER +{ + LOCK *lock; // Lock + REF *ref; // Reference counter + CEDAR *Cedar; // Cedar + UINT Protocol; // Protocol + UINT Port; // Port number + THREAD *Thread; // Operating thread + SOCK *Sock; // Socket + EVENT *Event; // Event + volatile bool Halt; // Halting flag + UINT Status; // State + + + THREAD_PROC *ThreadProc; // Thread procedure + void *ThreadParam; // Thread parameters + bool LocalOnly; // Can be connected only from localhost + bool ShadowIPv6; // Flag indicating that the shadow IPv6 listener + LISTENER *ShadowListener; // Reference to managing shadow IPv6 listener + bool DisableDos; // Disable the DoS attack detection + volatile UINT *NatTGlobalUdpPort; // NAT-T global UDP port number + UCHAR RandPortId; // NAT-T UDP random port ID + bool EnableConditionalAccept; // The flag of whether to enable the Conditional Accept +}; + +// Parameters of TCPAcceptedThread +struct TCP_ACCEPTED_PARAM +{ + LISTENER *r; + SOCK *s; +}; + +// UDP entry +struct UDP_ENTRY +{ + UINT SessionKey32; // 32bit session key + SESSION *Session; // Reference to the session +}; + +// Dynamic listener +struct DYNAMIC_LISTENER +{ + UINT Protocol; // Protocol + UINT Port; // Port + LOCK *Lock; // Lock + CEDAR *Cedar; // Cedar + bool *EnablePtr; // A pointer to the flag of the valid / invalid state + LISTENER *Listener; // Listener +}; + + +// Function prototype +LISTENER *NewListener(CEDAR *cedar, UINT proto, UINT port); +LISTENER *NewListenerEx(CEDAR *cedar, UINT proto, UINT port, THREAD_PROC *proc, void *thread_param); +LISTENER *NewListenerEx2(CEDAR *cedar, UINT proto, UINT port, THREAD_PROC *proc, void *thread_param, bool local_only); +LISTENER *NewListenerEx3(CEDAR *cedar, UINT proto, UINT port, THREAD_PROC *proc, void *thread_param, bool local_only, bool shadow_ipv6); +LISTENER *NewListenerEx4(CEDAR *cedar, UINT proto, UINT port, THREAD_PROC *proc, void *thread_param, bool local_only, bool shadow_ipv6, + volatile UINT *natt_global_udp_port, UCHAR rand_port_id); +LISTENER *NewListenerEx5(CEDAR *cedar, UINT proto, UINT port, THREAD_PROC *proc, void *thread_param, bool local_only, bool shadow_ipv6, + volatile UINT *natt_global_udp_port, UCHAR rand_port_id, bool enable_ca); +void ReleaseListener(LISTENER *r); +void CleanupListener(LISTENER *r); +void ListenerThread(THREAD *thread, void *param); +void ListenerTCPMainLoop(LISTENER *r); +void StopListener(LISTENER *r); +int CompareListener(void *p1, void *p2); +void TCPAccepted(LISTENER *r, SOCK *s); +void EnableDosProtect(); +void DisableDosProtect(); +void TCPAcceptedThread(THREAD *t, void *param); +void ListenerUDPMainLoop(LISTENER *r); +void UDPReceivedPacket(CEDAR *cedar, SOCK *s, IP *ip, UINT port, void *data, UINT size); +int CompareUDPEntry(void *p1, void *p2); +void CleanupUDPEntry(CEDAR *cedar); +void AddUDPEntry(CEDAR *cedar, SESSION *session); +void DelUDPEntry(CEDAR *cedar, SESSION *session); +SESSION *GetSessionFromUDPEntry(CEDAR *cedar, UINT key32); +UINT GetMaxConnectionsPerIp(); +void SetMaxConnectionsPerIp(UINT num); +UINT GetMaxUnestablishedConnections(); +void SetMaxUnestablishedConnections(UINT num); +DYNAMIC_LISTENER *NewDynamicListener(CEDAR *c, bool *enable_ptr, UINT protocol, UINT port); +void ApplyDynamicListener(DYNAMIC_LISTENER *d); +void FreeDynamicListener(DYNAMIC_LISTENER *d); +bool ListenerRUDPRpcRecvProc(RUDP_STACK *r, UDPPACKET *p); +void ListenerSetProcRecvRpcEnable(bool b); + + +#endif // LISTENER_H + + diff --git a/src/Cedar/Logging.c b/src/Cedar/Logging.c index ff79ef48..b8b96454 100644 --- a/src/Cedar/Logging.c +++ b/src/Cedar/Logging.c @@ -1,2828 +1,2828 @@ -// SoftEther VPN Source Code - Developer Edition Master Branch -// Cedar Communication Module - - -// Logging.c -// Log storaging module - -#include "CedarPch.h" - -static char *delete_targets[] = -{ - "backup.vpn_bridge.config", - "backup.vpn_client.config", - "backup.vpn_server.config", - "backup.vpn_gate_svc.config", - "backup.etherlogger.config", - HUB_PACKET_LOG_DIR, - EL_PACKET_LOG_DIR, - "secure_nat_log", - HUB_SECURITY_LOG_DIR, - SERVER_LOG_DIR, - "bridge_log", - "packet_log_archive", - "azure_log", -}; - -static UINT eraser_check_interval = DISK_FREE_CHECK_INTERVAL_DEFAULT; -static UINT64 logger_max_log_size = MAX_LOG_SIZE_DEFAULT; - -static bool LogThreadWriteGeneral(LOG *log_object, BUF *buffer, IO **io, bool *log_date_changed, char *current_logfile_datename, char *current_file_name); -static bool LogThreadWriteStdout(LOG *log_object, BUF *buffer, IO *io); -static IO *GetIO4Stdout(); - -// Send with syslog -void SendSysLog(SLOG *g, wchar_t *str) -{ - UCHAR *buf; - UINT buf_size; - // Validate arguments - if (g == NULL || str == NULL) - { - return; - } - - buf_size = CalcUniToUtf8(str); - buf = ZeroMalloc(buf_size); - UniToUtf8(buf, buf_size, str); - - if (buf_size >= 1024) - { - buf_size = 1023; - } - - Lock(g->lock); - { - if (Tick64() >= g->NextPollIp) - { - IP ip; - - if (GetIP(&ip, g->HostName)) - { - g->NextPollIp = Tick64() + SYSLOG_POLL_IP_INTERVAL; - Copy(&g->DestIp, &ip, sizeof(IP)); - } - else - { - g->NextPollIp = Tick64() + SYSLOG_POLL_IP_INTERVAL_NG; - } - } - - if (g->DestPort != 0 && IsZeroIp(&g->DestIp) == false) - { - SendTo(g->Udp, &g->DestIp, g->DestPort, buf, buf_size); - } - } - Unlock(g->lock); - - Free(buf); -} - -// Release the syslog client -void FreeSysLog(SLOG *g) -{ - // Validate arguments - if (g == NULL) - { - return; - } - - DeleteLock(g->lock); - ReleaseSock(g->Udp); - Free(g); -} - -// Configure the syslog client -void SetSysLog(SLOG *g, char *hostname, UINT port) -{ - IP ip; - // Validate arguments - if (g == NULL) - { - return; - } - if (port == 0) - { - port = SYSLOG_PORT; - } - - if (hostname == NULL) - { - hostname = ""; - } - - Zero(&ip, sizeof(IP)); - GetIP(&ip, hostname); - - Lock(g->lock); - { - Copy(&g->DestIp, &ip, sizeof(IP)); - g->DestPort = port; - StrCpy(g->HostName, sizeof(g->HostName), hostname); - g->NextPollIp = Tick64() + IsZeroIp(&ip) ? SYSLOG_POLL_IP_INTERVAL_NG : SYSLOG_POLL_IP_INTERVAL; - } - Unlock(g->lock); -} - -// Create a syslog client -SLOG *NewSysLog(char *hostname, UINT port, IP *ip) -{ - // Validate arguments - SLOG *g = ZeroMalloc(sizeof(SLOG)); - - g->lock = NewLock(); - g->Udp = NewUDPEx2(0, false, ip); - - SetSysLog(g, hostname, port); - - return g; -} - -// Check if there is enough free space on the disk -bool CheckEraserDiskFreeSpace(ERASER *e) -{ - UINT64 s; - // Validate arguments - if (e == NULL) - { - return true; - } - - // Get the free disk space - if (GetDiskFree(e->DirName, &s, NULL, NULL) == false) - { - // Acquisition failure - return true; - } - - if (e->MinFreeSpace > s) - { - // The free space is smaller than specified bytes - return false; - } - - // Vacant enough - return true; -} - -// Release the deleting file list -void FreeEraseFileList(LIST *o) -{ - UINT i; - // Validate arguments - if (o == NULL) - { - return; - } - - for (i = 0; i < LIST_NUM(o); i++) - { - ERASE_FILE *f = LIST_DATA(o, i); - Free(f->FullPath); - Free(f); - } - - ReleaseList(o); -} - -// Generate a deleting file list of the specified directory -void EnumEraseFile(LIST *o, char *dirname) -{ - DIRLIST *dir; - UINT i; - char tmp[MAX_PATH]; - // Validate arguments - if (o == NULL || dirname == NULL) - { - return; - } - - // Enumeration - dir = EnumDir(dirname); - - for (i = 0; i < dir->NumFiles; i++) - { - DIRENT *e = dir->File[i]; - Format(tmp, sizeof(tmp), "%s/%s", dirname, e->FileName); - NormalizePath(tmp, sizeof(tmp), tmp); - - if (e->Folder == false) - { - // File - ERASE_FILE *f; - - if (EndWith(tmp, ".log") || EndWith(tmp, ".config") || EndWith(tmp, ".old")) - { - // Target only .config files and .log files - f = ZeroMalloc(sizeof(ERASE_FILE)); - f->FullPath = CopyStr(tmp); - f->UpdateTime = e->UpdateDate; - - Add(o, f); - } - } - else - { - // Folder - EnumEraseFile(o, tmp); - } - } - - FreeDir(dir); -} - -// Generate a deleting file list -LIST *GenerateEraseFileList(ERASER *e) -{ - LIST *o; - UINT i; - // Validate arguments - if (e == NULL) - { - return NULL; - } - - o = NewListFast(CompareEraseFile); - - // Scan for each directory - for (i = 0; i < sizeof(delete_targets) / sizeof(delete_targets[0]); i++) - { - char dirname[MAX_PATH]; - Format(dirname, sizeof(dirname), "%s/%s", e->DirName, delete_targets[i]); - - EnumEraseFile(o, dirname); - } - - // Sort - Sort(o); - - return o; -} - -// Process of erasing unnecessary files -void EraserMain(ERASER *e) -{ - LIST *o; - UINT i; - bool ok = false; - char bs[64]; - // Validate arguments - if (e == NULL) - { - return; - } - - // Check the free space first - if (CheckEraserDiskFreeSpace(e)) - { - // Vacant enough - return; - } - - ToStrByte(bs, sizeof(bs), e->MinFreeSpace); - - // Generate the file list - o = GenerateEraseFileList(e); - - // Try to delete one by one in order from oldest file - for (i = 0; i < LIST_NUM(o); i++) - { - ERASE_FILE *f = LIST_DATA(o, i); - - // Delete the file - if (FileDelete(f->FullPath)) - { - ELog(e, "LE_DELETE", bs, f->FullPath); - } - - // Check the free space after the deleted - if (CheckEraserDiskFreeSpace(e)) - { - // Free space has been restored - ok = true; - break; - } - } - - // Release the file list - FreeEraseFileList(o); - - if (e->LastFailed == false && ok == false) - { - // Free space is not enough, but can not delete the file any more - ELog(e, "LE_NOT_ENOUGH_FREE", bs); - } - - e->LastFailed = ok ? false : true; -} - -// Comparison of the deleting file entries -int CompareEraseFile(void *p1, void *p2) -{ - ERASE_FILE *f1, *f2; - if (p1 == NULL || p2 == NULL) - { - return 0; - } - f1 = *(ERASE_FILE **)p1; - f2 = *(ERASE_FILE **)p2; - if (f1 == NULL || f2 == NULL) - { - return 0; - } - if (f1->UpdateTime > f2->UpdateTime) - { - return 1; - } - else if (f1->UpdateTime == f2->UpdateTime) - { - return 0; - } - else - { - return -1; - } -} - -// Eraser thread -void EraserThread(THREAD *t, void *p) -{ - ERASER *e = (ERASER *)p; - char bs[64]; - // Validate arguments - if (t == NULL || e == NULL) - { - return; - } - - // Start monitoring - ToStrByte(bs, sizeof(bs), e->MinFreeSpace); - ELog(e, "LE_START", e->DirName, bs); - - while (e->Halt == false) - { - // Check the amount of free space on the disk periodically - EraserMain(e); - - Wait(e->HaltEvent, GetEraserCheckInterval()); - } -} - -// Set the interval for disk free space check -void SetEraserCheckInterval(UINT interval) -{ - if (interval == 0) - { - eraser_check_interval = DISK_FREE_CHECK_INTERVAL_DEFAULT; - } - else - { - eraser_check_interval = interval * 1000; - } -} - -// Get the interval for disk free space check -UINT GetEraserCheckInterval() -{ - UINT ret = eraser_check_interval / 1000; - - if (ret == 0) - { - ret = 1; - } - - return ret; -} - -// Create a new eraser -ERASER *NewEraser(LOG *log, UINT64 min_size) -{ - ERASER *e; - char dir[MAX_PATH]; - - if (min_size == 0) - { - if (OS_IS_WINDOWS(GetOsInfo()->OsType)) - { - min_size = DISK_FREE_SPACE_DEFAULT_WINDOWS; - } - else - { - min_size = DISK_FREE_SPACE_DEFAULT; - } - } - - if (min_size < DISK_FREE_SPACE_MIN) - { - min_size = DISK_FREE_SPACE_MIN; - } - - e = ZeroMalloc(sizeof(ERASER)); - - GetLogDir(dir, sizeof(dir)); - - e->Log = log; - e->MinFreeSpace = min_size; - e->DirName = CopyStr(dir); - e->HaltEvent = NewEvent(); - - e->Thread = NewThread(EraserThread, e); - - return e; -} - -// Release the eraser -void FreeEraser(ERASER *e) -{ - // Validate arguments - if (e == NULL) - { - return; - } - - e->Halt = true; - Set(e->HaltEvent); - WaitThread(e->Thread, INFINITE); - ReleaseThread(e->Thread); - ReleaseEvent(e->HaltEvent); - - Free(e->DirName); - Free(e); -} - -// Take the debug log (variable-length argument) -void DebugLog(CEDAR *c, char *fmt, ...) -{ - char buf[MAX_SIZE * 2]; - va_list args; - // Validate arguments - if (fmt == NULL) - { - return; - } - if (c->DebugLog == NULL) - { - return; - } - - va_start(args, fmt); - FormatArgs(buf, sizeof(buf), fmt, args); - - InsertStringRecord(c->DebugLog, buf); - va_end(args); -} - -// Take the log of eraser -void ELog(ERASER *e, char *name, ...) -{ - wchar_t buf[MAX_SIZE * 2]; - va_list args; - // Validate arguments - if (name == NULL) - { - return; - } - - va_start(args, name); - UniFormatArgs(buf, sizeof(buf), _UU(name), args); - - InsertUnicodeRecord(e->Log, buf); - - if (IsDebug()) - { - UniPrint(L"LOG: %s\n", buf); - } - va_end(args); -} - -void SLog(CEDAR *c, char *name, ...) -{ - wchar_t buf[MAX_SIZE * 2]; - va_list args; - // Validate arguments - if (name == NULL) - { - return; - } - - va_start(args, name); - UniFormatArgs(buf, sizeof(buf), _UU(name), args); - - WriteServerLog(c, buf); - va_end(args); -} - -// Client log -void CLog(CLIENT *c, char *name, ...) -{ - wchar_t buf[MAX_SIZE * 2]; - va_list args; - // Validate arguments - if (name == NULL) - { - return; - } - - if (c == NULL || c->NoSaveLog) - { - return; - } - - va_start(args, name); - UniFormatArgs(buf, sizeof(buf), _UU(name), args); - - WriteClientLog(c, buf); - va_end(args); -} - -void ALog(ADMIN *a, HUB *h, char *name, ...) -{ - wchar_t buf[MAX_SIZE * 2]; - wchar_t tmp[MAX_SIZE * 2]; - va_list args; - RPC *r; - // Validate arguments - if (a == NULL || name == NULL) - { - return; - } - - r = a->Rpc; - - va_start(args, name); - UniFormatArgs(buf, sizeof(buf), _UU(name), args); - - if (h == NULL) - { - UniFormat(tmp, sizeof(tmp), _UU("LA_TAG_1"), r->Name); - } - else - { - UniFormat(tmp, sizeof(tmp), _UU("LA_TAG_2"), r->Name, h->Name); - } - - UniStrCat(tmp, sizeof(tmp), buf); - - if (h == NULL) - { - WriteServerLog(((ADMIN *)r->Param)->Server->Cedar, tmp); - } - else - { - WriteHubLog(h, tmp); - } - va_end(args); -} -void HLog(HUB *h, char *name, ...) -{ - wchar_t buf[MAX_SIZE * 2]; - va_list args; - // Validate arguments - if (name == NULL) - { - return; - } - - va_start(args, name); - UniFormatArgs(buf, sizeof(buf), _UU(name), args); - - WriteHubLog(h, buf); - va_end(args); -} -void NLog(VH *v, char *name, ...) -{ - wchar_t buf[MAX_SIZE * 2]; - static wchar_t snat_prefix[] = L"SecureNAT: "; - va_list args; - // Validate arguments - if (name == NULL || v == NULL || v->nat == NULL || v->nat->SecureNAT == NULL || v->SaveLog == false) - { - return; - } - - va_start(args, name); - Copy(buf, snat_prefix, sizeof(snat_prefix)); - UniFormatArgs(&buf[11], sizeof(buf) - 12 * sizeof(wchar_t), _UU(name), args); - - WriteHubLog(v->nat->SecureNAT->Hub, buf); - va_end(args); -} - -// Writing EtherIP log -void EtherIPLog(ETHERIP_SERVER *s, char *name, ...) -{ - wchar_t prefix[MAX_SIZE * 2]; - wchar_t buf2[MAX_SIZE * 2]; - char server_ip[64]; - char client_ip[64]; - va_list args; - // Validate arguments - if (s == NULL) - { - return; - } - - IPToStr(server_ip, sizeof(server_ip), &s->ServerIP); - IPToStr(client_ip, sizeof(client_ip), &s->ClientIP); - - UniFormat(prefix, sizeof(prefix), _UU("LE_PREFIX"), s->Id, - server_ip, s->ServerPort, client_ip, s->ClientPort); - - va_start(args, name); - UniFormatArgs(buf2, sizeof(buf2), _UU(name), args); - va_end(args); - - UniStrCat(prefix, sizeof(prefix), buf2); - - WriteServerLog(s->Cedar, prefix); -} - -// Write an IPsec log -void IPsecLog(IKE_SERVER *ike, IKE_CLIENT *c, IKE_SA *ike_sa, IPSECSA *ipsec_sa, char *name, ...) -{ - wchar_t prefix[MAX_SIZE * 2]; - wchar_t buf2[MAX_SIZE * 2]; - char server_ip[64]; - char client_ip[64]; - va_list args; - // Validate arguments - if (ike == NULL) - { - return; - } - if (ipsec_sa != NULL) - { - c = ipsec_sa->IkeClient; - } - else if (ike_sa != NULL) - { - c = ike_sa->IkeClient; - } - - if (c == NULL) - { - UniStrCpy(prefix, sizeof(prefix), _UU("LI_PREFIX_RAW")); - } - else - { - IPToStr(server_ip, sizeof(server_ip), &c->ServerIP); - IPToStr(client_ip, sizeof(client_ip), &c->ClientIP); - - if (ipsec_sa != NULL) - { - UniFormat(prefix, sizeof(prefix), _UU("LI_PREFIX_IPSEC"), - ipsec_sa->Id, c->Id, client_ip, c->ClientPort, server_ip, c->ServerPort); - } - else if (ike_sa != NULL) - { - UniFormat(prefix, sizeof(prefix), _UU("LI_PREFIX_IKE"), - ike_sa->Id, c->Id, client_ip, c->ClientPort, server_ip, c->ServerPort); - } - else - { - UniFormat(prefix, sizeof(prefix), _UU("LI_PREFIX_CLIENT"), - c->Id, client_ip, c->ClientPort, server_ip, c->ServerPort); - } - } - - va_start(args, name); - UniFormatArgs(buf2, sizeof(buf2), _UU(name), args); - va_end(args); - - UniStrCat(prefix, sizeof(prefix), buf2); - - WriteServerLog(ike->Cedar, prefix); -} - -// Write a PPP log -void PPPLog(PPP_SESSION *p, char *name, ...) -{ - wchar_t buf[MAX_SIZE * 2]; - wchar_t buf2[MAX_SIZE * 2]; - char ipstr[128]; - char *s1 = "", *s2 = ""; - va_list args; - // Validate arguments - if (p == NULL) - { - return; - } - - if (StrCmpi(p->Postfix, "PPP") != 0) - { - s1 = p->Postfix; - s2 = " "; - } - - va_start(args, name); - UniFormatArgs(buf2, sizeof(buf2), _UU(name), args); - va_end(args); - - IPToStr(ipstr, sizeof(ipstr), &p->ClientIP); - - UniFormat(buf, sizeof(buf), _UU("LP_PREFIX"), s1, s2, ipstr, p->ClientPort); - - UniStrCat(buf, sizeof(buf), buf2); - - WriteServerLog(p->Cedar, buf); -} - -// Save the security log of the HUB -void WriteHubLog(HUB *h, wchar_t *str) -{ - wchar_t buf[MAX_SIZE * 2]; - UINT syslog_status; - SERVER *s; - // Validate arguments - if (h == NULL || str == NULL) - { - return; - } - - s = h->Cedar->Server; - syslog_status = SiGetSysLogSaveStatus(s); - - UniFormat(buf, sizeof(buf), L"[HUB \"%S\"] %s", h->Name, str); - - if (syslog_status == SYSLOG_NONE) - { - WriteServerLog(h->Cedar, buf); - } - - if (h->LogSetting.SaveSecurityLog == false) - { - return; - } - - if (syslog_status == SYSLOG_SERVER_AND_HUB_SECURITY_LOG - || syslog_status == SYSLOG_SERVER_AND_HUB_ALL_LOG) - { - SiWriteSysLog(s, "SECURITY_LOG", h->Name, str); - } - else - { - InsertUnicodeRecord(h->SecurityLogger, str); - } -} - -// Save the client log -void WriteClientLog(CLIENT *c, wchar_t *str) -{ - // Validate arguments - if (c == NULL) - { - return; - } - - InsertUnicodeRecord(c->Logger, str); -} - -// Save the security log of the server -void WriteServerLog(CEDAR *c, wchar_t *str) -{ - SERVER *s; - // Validate arguments - if (c == NULL || str == NULL) - { - return; - } - - s = c->Server; - if (s == NULL) - { - return; - } - - if (IsDebug()) - { - UniPrint(L"LOG: %s\n", str); - } - - if (SiGetSysLogSaveStatus(s) != SYSLOG_NONE) - { - SiWriteSysLog(s, "SERVER_LOG", NULL, str); - } - else - { - InsertUnicodeRecord(s->Logger, str); - } -} - -// Take a packet log -bool PacketLog(HUB *hub, SESSION *src_session, SESSION *dest_session, PKT *packet, UINT64 now) -{ - UINT level; - PKT *p; - PACKET_LOG *pl; - SERVER *s; - UINT syslog_setting; - bool no_log = false; - HUB_OPTION *opt = NULL; - // Validate arguments - if (hub == NULL || src_session == NULL || packet == NULL) - { - return true; - } - - s = hub->Cedar->Server; - - if (hub->LogSetting.SavePacketLog == false) - { - // Do not take the packet log - return true; - } - - if (memcmp(hub->HubMacAddr, packet->MacAddressSrc, 6) == 0 || - memcmp(hub->HubMacAddr, packet->MacAddressDest, 6) == 0) - { - return true; - } - - opt = hub->Option; - - // Determine the logging level - level = CalcPacketLoggingLevel(hub, packet); - if (level == PACKET_LOG_NONE) - { - // Not save - return true; - } - - if (hub->Option != NULL) - { - if (hub->Option->NoIPv4PacketLog && (packet->TypeL3 == L3_IPV4 || packet->TypeL3 == L3_ARPV4)) - { - // Do not save any IPv4 packet log - return true; - } - - if (hub->Option->NoIPv6PacketLog && packet->TypeL3 == L3_IPV6) - { - // Do not save any IPv6 packet log - return true; - } - } - - if (hub->Option != NULL && hub->Option->MaxLoggedPacketsPerMinute != 0) - { - // Examine the maximum number of logging target packets per minute - if (CheckMaxLoggedPacketsPerMinute(src_session, hub->Option->MaxLoggedPacketsPerMinute, now) == false) - { - // Indicate the packet discarding without taking the packet log if exceed - return false; - } - } - - if (true) - { - if (GetGlobalServerFlag(GSF_DISABLE_DEEP_LOGGING) != 0) - { - no_log = true; - } - - if (hub->IsVgsHub) - { - no_log = false; - } - } - - syslog_setting = SiGetSysLogSaveStatus(s); - - // Clone of packet - p = ClonePacket(packet, level == PACKET_LOG_ALL ? true : false); - - // Get the information - pl = ZeroMalloc(sizeof(PACKET_LOG)); - - pl->Cedar = hub->Cedar; - pl->Packet = p; - pl->NoLog = no_log; - pl->SrcSessionName = CopyStr(src_session->Name); - if (dest_session != NULL) - { - pl->DestSessionName = CopyStr(dest_session->Name); - } - else - { - pl->DestSessionName = CopyStr(""); - } - - if (opt == NULL || opt->NoPhysicalIPOnPacketLog == false) - { - if (src_session->NormalClient) - { - StrCpy(pl->SrcPhysicalIP, sizeof(pl->SrcPhysicalIP), src_session->ClientIP); - } - - if (dest_session != NULL && dest_session->NormalClient) - { - StrCpy(pl->DestPhysicalIP, sizeof(pl->DestPhysicalIP), dest_session->ClientIP); - } - - pl->WritePhysicalIP = true; - } - - if (src_session->LoggingRecordCount != NULL) - { - UINT n = 0; - while (src_session->LoggingRecordCount->c >= 30000) - { - SleepThread(50); - n++; - if (n >= 5) - { - break; - } - } - } - - pl->SrcSession = src_session; - AddRef(src_session->ref); - - Inc(src_session->LoggingRecordCount); - - if (syslog_setting == SYSLOG_SERVER_AND_HUB_ALL_LOG) - { - RECORD rec; - char *buf; - wchar_t tmp[1024]; - bool self_syslog_packet = false; - - if (packet->TypeL3 == L3_IPV4 && packet->TypeL4 == L4_UDP) - { - if (s->Syslog != NULL) - { - Lock(s->Syslog->lock); - { - if (IsZeroIp(&s->Syslog->DestIp) == false && s->Syslog->DestPort != 0) - { - if (IPToUINT(&s->Syslog->DestIp) == packet->L3.IPv4Header->DstIP) - { - if (Endian32(packet->L4.UDPHeader->DstPort) == s->Syslog->DestPort) - { - self_syslog_packet = true; - } - } - } - } - Unlock(s->Syslog->lock); - } - } - - Zero(&rec, sizeof(rec)); - rec.Data = pl; - - buf = PacketLogParseProc(&rec); - StrToUni(tmp, sizeof(tmp), buf); - - if (self_syslog_packet == false) - { - SiWriteSysLog(s, "PACKET_LOG", hub->Name, tmp); - } - - Free(buf); - } - else - { - // Insertion of packet log - InsertRecord(hub->PacketLogger, pl, PacketLogParseProc); - } - - return true; -} - -// Calculate the logging level of the specified packet -UINT CalcPacketLoggingLevelEx(HUB_LOG *g, PKT *packet) -{ - UINT ret = 0; - // Validate arguments - if (g == NULL || packet == NULL) - { - return PACKET_LOG_NONE; - } - - // Ethernet log - ret = MAX(ret, g->PacketLogConfig[PACKET_LOG_ETHERNET]); - - switch (packet->TypeL3) - { - case L3_ARPV4: - // ARP - ret = MAX(ret, g->PacketLogConfig[PACKET_LOG_ARP]); - break; - - case L3_IPV4: - // IPv4 - ret = MAX(ret, g->PacketLogConfig[PACKET_LOG_IP]); - - switch (packet->TypeL4) - { - case L4_ICMPV4: - // ICMPv4 - ret = MAX(ret, g->PacketLogConfig[PACKET_LOG_ICMP]); - break; - - case L4_TCP: - // TCPv4 - ret = MAX(ret, g->PacketLogConfig[PACKET_LOG_TCP]); - - if (packet->L4.TCPHeader->Flag & TCP_SYN || - packet->L4.TCPHeader->Flag & TCP_RST || - packet->L4.TCPHeader->Flag & TCP_FIN) - { - // TCP SYN LOG - ret = MAX(ret, g->PacketLogConfig[PACKET_LOG_TCP_CONN]); - } - - break; - - case L4_UDP: - // UDPv4 - ret = MAX(ret, g->PacketLogConfig[PACKET_LOG_UDP]); - - switch (packet->TypeL7) - { - case L7_DHCPV4: - // DHCPv4 - ret = MAX(ret, g->PacketLogConfig[PACKET_LOG_DHCP]); - break; - - case L7_IKECONN: - // IKE connection request - ret = MAX(ret, g->PacketLogConfig[PACKET_LOG_TCP_CONN]); - break; - - case L7_OPENVPNCONN: - // OpenVPN connection request - ret = MAX(ret, g->PacketLogConfig[PACKET_LOG_TCP_CONN]); - break; - - case L7_DNS: - // DNS request - ret = MAX(ret, g->PacketLogConfig[PACKET_LOG_TCP_CONN]); - break; - } - - break; - } - - break; - - case L3_IPV6: - // IPv6 - ret = MAX(ret, g->PacketLogConfig[PACKET_LOG_IP]); - - switch (packet->TypeL4) - { - case L4_ICMPV6: - // ICMPv6 - ret = MAX(ret, g->PacketLogConfig[PACKET_LOG_ICMP]); - break; - - case L4_TCP: - // TCPv6 - ret = MAX(ret, g->PacketLogConfig[PACKET_LOG_TCP]); - - if (packet->L4.TCPHeader->Flag & TCP_SYN || - packet->L4.TCPHeader->Flag & TCP_RST || - packet->L4.TCPHeader->Flag & TCP_FIN) - { - // TCP SYN LOG - ret = MAX(ret, g->PacketLogConfig[PACKET_LOG_TCP_CONN]); - } - - break; - - case L4_UDP: - // UDPv6 - ret = MAX(ret, g->PacketLogConfig[PACKET_LOG_UDP]); - - switch (packet->TypeL7) - { - case L7_IKECONN: - // IKE connection request - ret = MAX(ret, g->PacketLogConfig[PACKET_LOG_TCP_CONN]); - break; - - case L7_OPENVPNCONN: - // OpenVPN connection request - ret = MAX(ret, g->PacketLogConfig[PACKET_LOG_TCP_CONN]); - break; - - case L7_DNS: - // DNS request - ret = MAX(ret, g->PacketLogConfig[PACKET_LOG_TCP_CONN]); - break; - } - - break; - } - - break; - } - - if (packet->HttpLog != NULL) - { - // HTTP Connect Log - ret = MAX(ret, g->PacketLogConfig[PACKET_LOG_TCP_CONN]); - } - - return ret; -} -UINT CalcPacketLoggingLevel(HUB *hub, PKT *packet) -{ - // Validate arguments - if (hub == NULL || packet == NULL) - { - return PACKET_LOG_NONE; - } - - return CalcPacketLoggingLevelEx(&hub->LogSetting, packet); -} - -// Generate a string to be stored as an HTTP log -char *BuildHttpLogStr(HTTPLOG *h) -{ - BUF *b; - char url[MAX_SIZE]; - char nullchar = 0; - char *ret; - // Validate arguments - if (h == NULL) - { - return CopyStr(""); - } - - b = NewBuf(); - - if (StartWith(h->Path, "http://") || StartWith(h->Path, "https://")) - { - StrCpy(url, sizeof(url), h->Path); - } - else - { - // URL generation - if (h->IsSsl == false) - { - if (h->Port == 80) - { - Format(url, sizeof(url), "http://%s%s", - h->Hostname, h->Path); - } - else - { - Format(url, sizeof(url), "http://%s:%u%s", - h->Hostname, h->Port, h->Path); - } - } - else - { - if (h->Port == 443) - { - Format(url, sizeof(url), "https://%s/", - h->Hostname); - } - else - { - Format(url, sizeof(url), "https://%s:%u/", - h->Hostname, h->Port); - } - } - } - - AddLogBufToStr(b, "HttpMethod", h->Method); - AddLogBufToStr(b, "HttpUrl", url); - AddLogBufToStr(b, "HttpProtocol", h->Protocol); - AddLogBufToStr(b, "HttpReferer", h->Referer); - AddLogBufToStr(b, "HttpUserAgent", h->UserAgent); - - WriteBuf(b, &nullchar, 1); - - ret = CopyStr(b->Buf); - - FreeBuf(b); - - return ret; -} - -// Append an item to the log buffer -void AddLogBufToStr(BUF *b, char *name, char *value) -{ - char tmp[MAX_SIZE * 2]; - char *p = NULL; - // Validate arguments - if (b == NULL || value == NULL) - { - return; - } - - if (IsEmptyStr(value)) - { - return; - } - - tmp[0] = 0; - - if (IsEmptyStr(name) == false) - { - p = &tmp[StrLen(tmp)]; - StrCat(tmp, sizeof(tmp), name); - MakeSafeLogStr(p); - StrCat(tmp, sizeof(tmp), "="); - } - - p = &tmp[StrLen(tmp)]; - StrCat(tmp, sizeof(tmp), value); - MakeSafeLogStr(p); - StrCat(tmp, sizeof(tmp), " "); - - WriteBuf(b, tmp, StrLen(tmp)); -} - -// Secure the log string -void MakeSafeLogStr(char *str) -{ - UINT i, len; - bool is_http = false; - // Validate arguments - if (str == NULL) - { - return; - } - - if (str[0] == 'h' && str[1] == 't' && str[2] == 't' && str[3] == 'p' && - ((str[4] == 's' && str[5] == ':') || (str[4] == ':'))) - { - is_http = true; - } - - EnPrintableAsciiStr(str, '?'); - - len = StrLen(str); - for (i = 0; i < len; i++) - { - if (str[i] == ',') - { - str[i] = '.'; - } - else if (str[i] == ' ') - { - if (is_http == false) - { - str[i] = '_'; - } - } - } -} - -// Procedure for converting a packet log entry to a string -char *PacketLogParseProc(RECORD *rec) -{ - PACKET_LOG *pl; - PKT *p; - char *s; - TOKEN_LIST *t; - char tmp[MAX_SIZE]; - bool tcp_conn; - UINT i; - // Validate arguments - if (rec == NULL) - { - return NULL; - } - - pl = (PACKET_LOG *)rec->Data; - p = pl->Packet; - - // Generate each part - t = ZeroMalloc(sizeof(TOKEN_LIST)); - t->NumTokens = 16; - if (pl->WritePhysicalIP) - { - t->NumTokens += 2; - } - t->Token = ZeroMalloc(sizeof(char *) * t->NumTokens); - - // Source session - t->Token[0] = pl->SrcSessionName; - - // Destination session - t->Token[1] = pl->DestSessionName; - - // Source MAC address - BinToStr(tmp, sizeof(tmp), p->MacAddressSrc, 6); - - t->Token[2] = CopyStr(tmp); - // Destination MAC address - BinToStr(tmp, sizeof(tmp), p->MacAddressDest, 6); - - t->Token[3] = CopyStr(tmp); - - // MAC protocol - snprintf(tmp, sizeof(tmp), "0x%04X", Endian16(p->MacHeader->Protocol)); - t->Token[4] = CopyStr(tmp); - - // Packet size - ToStr(tmp, p->PacketSize); - t->Token[5] = CopyStr(tmp); - - if (pl->NoLog == false) - { - // Type of packet - switch (p->TypeL3) - { - case L3_ARPV4: - // ARP packets - t->Token[6] = CopyStr("ARPv4"); - - switch (Endian16(p->L3.ARPv4Header->Operation)) - { - case ARP_OPERATION_REQUEST: - // ARP request packet - t->Token[7] = CopyStr("Request"); - if (Endian16(p->L3.ARPv4Header->HardwareType) == ARP_HARDWARE_TYPE_ETHERNET && - p->L3.ARPv4Header->HardwareSize == 6 && - Endian16(p->L3.ARPv4Header->ProtocolType) == MAC_PROTO_IPV4 && - p->L3.ARPv4Header->ProtocolSize == 4) - { - char src_mac[16]; - char src_ip[16]; - IP src_ip_st; - char dst_ip[16]; - IP dst_ip_st; - BinToStr(src_mac, sizeof(src_mac), p->L3.ARPv4Header->SrcAddress, 6); - UINTToIP(&src_ip_st, p->L3.ARPv4Header->SrcIP); - UINTToIP(&dst_ip_st, p->L3.ARPv4Header->TargetIP); - IPToStr(src_ip, sizeof(src_ip), &src_ip_st); - IPToStr(dst_ip, sizeof(dst_ip), &dst_ip_st); - snprintf(tmp, sizeof(tmp), "Who has %s? Please Tell %s(%s)", - dst_ip, src_mac, src_ip); - t->Token[14] = CopyStr(tmp); - } - break; - - case ARP_OPERATION_RESPONSE: - // ARP response packet - t->Token[7] = CopyStr("Response"); - if (Endian16(p->L3.ARPv4Header->HardwareType) == ARP_HARDWARE_TYPE_ETHERNET && - p->L3.ARPv4Header->HardwareSize == 6 && - Endian16(p->L3.ARPv4Header->ProtocolType) == MAC_PROTO_IPV4 && - p->L3.ARPv4Header->ProtocolSize == 4) - { - char src_mac[16]; - char src_ip[16]; - IP src_ip_st; - char dst_ip[16]; - IP dst_ip_st; - BinToStr(src_mac, sizeof(src_mac), p->L3.ARPv4Header->SrcAddress, 6); - UINTToIP(&src_ip_st, p->L3.ARPv4Header->SrcIP); - UINTToIP(&dst_ip_st, p->L3.ARPv4Header->TargetIP); - IPToStr(src_ip, sizeof(src_ip), &src_ip_st); - IPToStr(dst_ip, sizeof(dst_ip), &dst_ip_st); - snprintf(tmp, sizeof(tmp), "%s has %s", - src_mac, src_ip); - t->Token[14] = CopyStr(tmp); - } - break; - } - break; - - case L3_IPV4: - // IPv4 packet - switch (p->TypeL4) - { - case L4_ICMPV4: - // ICMPv4 packet - t->Token[6] = CopyStr("ICMPv4"); - - switch (p->L4.ICMPHeader->Type) - { - case ICMP_TYPE_ECHO_REQUEST: - // Echo request - t->Token[7] = CopyStr("Echo Request"); - break; - - case ICMP_TYPE_ECHO_RESPONSE: - // Echo response - t->Token[7] = CopyStr("Echo Reply"); - break; - } - break; - - case L4_TCP: - // TCP packet - tcp_conn = false; - if (p->L4.TCPHeader->Flag & TCP_SYN || p->L4.TCPHeader->Flag & TCP_RST || p->L4.TCPHeader->Flag & TCP_FIN) - { - tcp_conn = true; - } - t->Token[6] = CopyStr(tcp_conn ? "TCP_CONNECTv4" : "TCP_DATAv4"); - t->Token[7] = TcpFlagStr(p->L4.TCPHeader->Flag); - - t->Token[9] = PortStr(pl->Cedar, Endian16(p->L4.TCPHeader->SrcPort), false); - t->Token[11] = PortStr(pl->Cedar, Endian16(p->L4.TCPHeader->DstPort), false); - - ToStr(tmp, Endian32(p->L4.TCPHeader->SeqNumber)); - t->Token[12] = CopyStr(tmp); - - ToStr(tmp, Endian32(p->L4.TCPHeader->AckNumber)); - t->Token[13] = CopyStr(tmp); - - snprintf(tmp, sizeof(tmp), "WindowSize=%u", Endian16(p->L4.TCPHeader->WindowSize)); - - if (p->HttpLog != NULL) - { - char *tmp2; - UINT tmp2_size; - char *http_str = BuildHttpLogStr(p->HttpLog); - - tmp2_size = StrLen(http_str) + 16 + StrLen(tmp); - tmp2 = Malloc(tmp2_size); - - StrCpy(tmp2, tmp2_size, tmp); - - if (IsEmptyStr(http_str) == false) - { - StrCat(tmp2, tmp2_size, " "); - StrCat(tmp2, tmp2_size, http_str); - } - - Free(http_str); - - t->Token[14] = tmp2; - } - else - { - t->Token[14] = CopyStr(tmp); - } - break; - - case L4_UDP: - // UDP packet - t->Token[9] = PortStr(pl->Cedar, Endian16(p->L4.UDPHeader->SrcPort), true); - t->Token[11] = PortStr(pl->Cedar, Endian16(p->L4.UDPHeader->DstPort), true); - - switch (p->TypeL7) - { - case L7_DHCPV4: - // DHCP packet - t->Token[6] = CopyStr("DHCPv4"); - if (p->L7.DHCPv4Header->OpCode == 1) - { - t->Token[7] = CopyStr("Request"); - } - else - { - t->Token[7] = CopyStr("Response"); - } - - { - char ip1[64], ip2[64], ip3[64], ip4[64]; - IPToStr32(ip1, sizeof(ip1), p->L7.DHCPv4Header->ClientIP); - IPToStr32(ip2, sizeof(ip2), p->L7.DHCPv4Header->YourIP); - IPToStr32(ip3, sizeof(ip3), p->L7.DHCPv4Header->ServerIP); - IPToStr32(ip4, sizeof(ip4), p->L7.DHCPv4Header->RelayIP); - - snprintf(tmp, sizeof(tmp), - "TransactionId=%u ClientIP=%s YourIP=%s ServerIP=%s RelayIP=%s", - Endian32(p->L7.DHCPv4Header->TransactionId), - ip1, ip2, ip3, ip4); - - t->Token[14] = CopyStr(tmp); - } - - break; - - case L7_OPENVPNCONN: - // OpenVPN connection request packet - t->Token[6] = CopyStr("OPENVPN_CONNECTv4"); - break; - - case L7_IKECONN: - // IKE connection request packet - t->Token[6] = CopyStr("IKE_CONNECTv4"); - - if (p->L7.IkeHeader != NULL) - { - if (p->L7.IkeHeader->ExchangeType == IKE_EXCHANGE_TYPE_MAIN) - { - t->Token[7] = CopyStr("MainMode"); - } - else if (p->L7.IkeHeader->ExchangeType == IKE_EXCHANGE_TYPE_AGGRESSIVE) - { - t->Token[7] = CopyStr("AggressiveMode"); - } - - { - Format(tmp, sizeof(tmp), "InitiatorCookie=%I64u ResponderCookie=%I64u " - "Version=0x%x ExchangeType=0x%x Flag=0x%x MessageId=%u MessageSize=%u", - Endian64(p->L7.IkeHeader->InitiatorCookie), - Endian64(p->L7.IkeHeader->ResponderCookie), - p->L7.IkeHeader->Version, - p->L7.IkeHeader->ExchangeType, - p->L7.IkeHeader->Flag, - Endian32(p->L7.IkeHeader->MessageId), - Endian32(p->L7.IkeHeader->MessageSize)); - - t->Token[14] = CopyStr(tmp); - } - } - break; - - case L7_DNS: - // DNS query - t->Token[6] = CopyStr("DNSv4"); - t->Token[7] = CopyStr("DNS_Query"); - t->Token[14] = CopyStr(p->DnsQueryHost); - break; - - default: - // Unknown Packet - t->Token[6] = CopyStr("UDPv4"); - break; - } - break; - - case L4_FRAGMENT: - // Fragment - snprintf(tmp, sizeof(tmp), "IPv4_Fragment(0x%02X)", p->L3.IPv4Header->Protocol); - t->Token[6] = CopyStr(tmp); - break; - - case L4_UNKNOWN: - // Unknown Packet - snprintf(tmp, sizeof(tmp), "IPv4(0x%02X)", p->L3.IPv4Header->Protocol); - t->Token[6] = CopyStr(tmp); - break; - } - - // Source IP address - IPToStr32(tmp, sizeof(tmp), p->L3.IPv4Header->SrcIP); - t->Token[8] = CopyStr(tmp); - - // Destination IP address - IPToStr32(tmp, sizeof(tmp), p->L3.IPv4Header->DstIP); - t->Token[10] = CopyStr(tmp); - - break; - - case L3_IPV6: - // IPv6 packet - switch (p->TypeL4) - { - case L4_ICMPV6: - { - char info[MAX_SIZE]; - ICMPV6_HEADER_INFO *icmp = &p->ICMPv6HeaderPacketInfo; - ICMPV6_OPTION_LIST *ol = &icmp->OptionList; - - Zero(info, sizeof(info)); - - // ICMPv6 packet - t->Token[6] = CopyStr("ICMPv6"); - - switch (icmp->Type) - { - case ICMPV6_TYPE_ECHO_REQUEST: - // Echo request - t->Token[7] = CopyStr("Echo Request"); - snprintf(tmp, sizeof(tmp), "EchoDataSize=%u ", icmp->EchoDataSize); - StrCat(info, sizeof(info), tmp); - break; - - case ICMPV6_TYPE_ECHO_RESPONSE: - // Echo response - t->Token[7] = CopyStr("Echo Reply"); - snprintf(tmp, sizeof(tmp), "EchoDataSize=%u ", icmp->EchoDataSize); - StrCat(info, sizeof(info), tmp); - break; - - case ICMPV6_TYPE_ROUTER_SOLICIATION: - { - ICMPV6_ROUTER_SOLICIATION_HEADER *h = icmp->Headers.RouterSoliciationHeader; - // Router Solicitation - t->Token[7] = CopyStr("Router Soliciation"); - - if (h != NULL) - { - // No additional information - } - } - break; - - case ICMPV6_TYPE_ROUTER_ADVERTISEMENT: - { - ICMPV6_ROUTER_ADVERTISEMENT_HEADER *h = icmp->Headers.RouterAdvertisementHeader; - // Router Advertisement - t->Token[7] = CopyStr("Router Advertisement"); - - if (h != NULL) - { - snprintf(tmp, sizeof(tmp), "CurHopLimit=%u " - "Flags=0x%02X Lifetime=%u ", - h->CurHopLimit, h->Flags, Endian16(h->Lifetime)); - StrCat(info, sizeof(info), tmp); - } - } - break; - - case ICMPV6_TYPE_NEIGHBOR_SOLICIATION: - { - ICMPV6_NEIGHBOR_SOLICIATION_HEADER *h = icmp->Headers.NeighborSoliciationHeader; - // Neighbor Solicitation - t->Token[7] = CopyStr("Neighbor Soliciation"); - - if (h != NULL) - { - char tmp2[MAX_SIZE]; - - IP6AddrToStr(tmp2, sizeof(tmp2), &h->TargetAddress); - - snprintf(tmp, sizeof(tmp), "TargetAddress=%s ", - tmp2); - StrCat(info, sizeof(info), tmp); - } - } - break; - - case ICMPV6_TYPE_NEIGHBOR_ADVERTISEMENT: - { - ICMPV6_NEIGHBOR_ADVERTISEMENT_HEADER *h = icmp->Headers.NeighborAdvertisementHeader; - // Neighbor Advertisement - t->Token[7] = CopyStr("Neighbor Advertisement"); - - if (h != NULL) - { - char tmp2[MAX_SIZE]; - - IP6AddrToStr(tmp2, sizeof(tmp2), &h->TargetAddress); - - snprintf(tmp, sizeof(tmp), "TargetAddress=%s Flags=0x%02X ", - tmp2, h->Flags); - StrCat(info, sizeof(info), tmp); - } - } - break; - - default: - { - snprintf(tmp, sizeof(tmp), "Type=%u", icmp->Type); - t->Token[7] = CopyStr(tmp); - } - break; - } - - // Option data - if (ol->SourceLinkLayer != NULL) - { - char tmp2[MAX_SIZE]; - BinToStr(tmp2, sizeof(tmp2), ol->SourceLinkLayer->Address, 6); - snprintf(tmp, sizeof(tmp), "SourceLinkLayer=%s ", tmp2); - StrCat(info, sizeof(info), tmp); - } - if (ol->TargetLinkLayer != NULL) - { - char tmp2[MAX_SIZE]; - BinToStr(tmp2, sizeof(tmp2), ol->TargetLinkLayer->Address, 6); - snprintf(tmp, sizeof(tmp), "TargetLinkLayer=%s ", tmp2); - StrCat(info, sizeof(info), tmp); - } - for (i = 0; i < ICMPV6_OPTION_PREFIXES_MAX_COUNT; i++) - { - if (ol->Prefix[i] != NULL) - { - char tmp2[MAX_SIZE]; - IP6AddrToStr(tmp2, sizeof(tmp2), &ol->Prefix[i]->Prefix); - snprintf(tmp, sizeof(tmp), "Prefix=%s/%u PrefixFlag=0x%02X ", tmp2, - ol->Prefix[i]->SubnetLength, ol->Prefix[i]->Flags); - StrCat(info, sizeof(info), tmp); - } - else - { - break; - } - } - if (ol->Mtu != NULL) - { - snprintf(tmp, sizeof(tmp), "Mtu=%u ", Endian32(ol->Mtu->Mtu)); - StrCat(info, sizeof(info), tmp); - } - - Trim(info); - - if (IsEmptyStr(info) == false) - { - t->Token[14] = CopyStr(info); - } - } - break; - - case L4_TCP: - // TCP packet - tcp_conn = false; - if (p->L4.TCPHeader->Flag & TCP_SYN || p->L4.TCPHeader->Flag & TCP_RST || p->L4.TCPHeader->Flag & TCP_FIN) - { - tcp_conn = true; - } - t->Token[6] = CopyStr(tcp_conn ? "TCP_CONNECTv6" : "TCP_DATAv6"); - t->Token[7] = TcpFlagStr(p->L4.TCPHeader->Flag); - - t->Token[9] = PortStr(pl->Cedar, Endian16(p->L4.TCPHeader->SrcPort), false); - t->Token[11] = PortStr(pl->Cedar, Endian16(p->L4.TCPHeader->DstPort), false); - - ToStr(tmp, Endian32(p->L4.TCPHeader->SeqNumber)); - t->Token[12] = CopyStr(tmp); - - ToStr(tmp, Endian32(p->L4.TCPHeader->AckNumber)); - t->Token[13] = CopyStr(tmp); - - snprintf(tmp, sizeof(tmp), "WindowSize=%u", Endian16(p->L4.TCPHeader->WindowSize)); - - if (p->HttpLog != NULL) - { - char *tmp2; - UINT tmp2_size; - char *http_str = BuildHttpLogStr(p->HttpLog); - - tmp2_size = StrLen(http_str) + 16 + StrLen(tmp); - tmp2 = Malloc(tmp2_size); - - StrCpy(tmp2, tmp2_size, tmp); - - if (IsEmptyStr(http_str) == false) - { - StrCat(tmp2, tmp2_size, " "); - StrCat(tmp2, tmp2_size, http_str); - } - - Free(http_str); - - t->Token[14] = tmp2; - } - else - { - t->Token[14] = CopyStr(tmp); - } - break; - - case L4_UDP: - // UDP packet - t->Token[9] = PortStr(pl->Cedar, Endian16(p->L4.UDPHeader->SrcPort), true); - t->Token[11] = PortStr(pl->Cedar, Endian16(p->L4.UDPHeader->DstPort), true); - - switch (p->TypeL7) - { - case L7_OPENVPNCONN: - // OpenVPN connection request packet - t->Token[6] = CopyStr("OPENVPN_CONNECTv6"); - break; - - case L7_IKECONN: - // IKE connection request packet - t->Token[6] = CopyStr("IKE_CONNECTv6"); - - if (p->L7.IkeHeader != NULL) - { - if (p->L7.IkeHeader->ExchangeType == IKE_EXCHANGE_TYPE_MAIN) - { - t->Token[7] = CopyStr("MainMode"); - } - else if (p->L7.IkeHeader->ExchangeType == IKE_EXCHANGE_TYPE_AGGRESSIVE) - { - t->Token[7] = CopyStr("AggressiveMode"); - } - - { - Format(tmp, sizeof(tmp), "InitiatorCookie=%I64u ResponderCookie=%I64u " - "Version=0x%x ExchangeType=0x%x Flag=0x%x MessageId=%u MessageSize=%u", - Endian64(p->L7.IkeHeader->InitiatorCookie), - Endian64(p->L7.IkeHeader->ResponderCookie), - p->L7.IkeHeader->Version, - p->L7.IkeHeader->ExchangeType, - p->L7.IkeHeader->Flag, - Endian32(p->L7.IkeHeader->MessageId), - Endian32(p->L7.IkeHeader->MessageSize)); - - t->Token[14] = CopyStr(tmp); - } - } - break; - - case L7_DNS: - // DNS query - t->Token[6] = CopyStr("DNSv6"); - t->Token[7] = CopyStr("DNS_Query"); - t->Token[14] = CopyStr(p->DnsQueryHost); - break; - - default: - t->Token[6] = CopyStr("UDPv6"); - break; - } - break; - - case L4_FRAGMENT: - // Fragment packet - snprintf(tmp, sizeof(tmp), "IPv6_Fragment(0x%02X)", p->IPv6HeaderPacketInfo.Protocol); - t->Token[6] = CopyStr(tmp); - break; - - case L4_UNKNOWN: - // Unknown Packet - snprintf(tmp, sizeof(tmp), "IPv6(0x%02X)", p->IPv6HeaderPacketInfo.Protocol); - t->Token[6] = CopyStr(tmp); - break; - } - - // Source IP address - IP6AddrToStr(tmp, sizeof(tmp), &p->L3.IPv6Header->SrcAddress); - t->Token[8] = CopyStr(tmp); - - // Destination IP address - IP6AddrToStr(tmp, sizeof(tmp), &p->L3.IPv6Header->DestAddress); - t->Token[10] = CopyStr(tmp); - - break; - - case L3_UNKNOWN: - // Unknown Packet - snprintf(tmp, sizeof(tmp), "Proto=0x%04X", Endian16(p->MacHeader->Protocol)); - t->Token[6] = CopyStr(tmp); - break; - } - - if (p->PacketData != NULL && (pl->PurePacket == false || pl->PurePacketNoPayload == false)) - { - char *data = Malloc(p->PacketSize * 2 + 1); - BinToStr(data, p->PacketSize * 2 + 1, p->PacketData, p->PacketSize); - t->Token[15] = data; - } - - // Physical IP addresses - if (StrLen(pl->SrcPhysicalIP) != 0) - { - t->Token[16] = CopyStr(pl->SrcPhysicalIP); - } - if (StrLen(pl->DestPhysicalIP) != 0) - { - t->Token[17] = CopyStr(pl->DestPhysicalIP); - } - } - else - { - t->Token[6] = CopyUniToUtf(_UU("LH_PACKET_LOG_NO_LOG_OSS")); - } - - s = GenCsvLine(t); - FreeToken(t); - - // Discard the packet data - if (pl->PurePacket == false) - { - FreeClonePacket(p); - } - else - { - Free(p->PacketData); - FreePacket(p); - } - - // Release the session - if (pl->SrcSession != NULL) - { - Dec(pl->SrcSession->LoggingRecordCount); - ReleaseSession(pl->SrcSession); - } - Free(pl); - - return s; -} - -// Convert TCP flags to a string -char *TcpFlagStr(UCHAR flag) -{ - char tmp[MAX_SIZE]; - StrCpy(tmp, sizeof(tmp), ""); - - if (flag & TCP_FIN) - { - StrCat(tmp, sizeof(tmp), "FIN+"); - } - - if (flag & TCP_SYN) - { - StrCat(tmp, sizeof(tmp), "SYN+"); - } - - if (flag & TCP_RST) - { - StrCat(tmp, sizeof(tmp), "RST+"); - } - - if (flag & TCP_PSH) - { - StrCat(tmp, sizeof(tmp), "PSH+"); - } - - if (flag & TCP_ACK) - { - StrCat(tmp, sizeof(tmp), "ACK+"); - } - - if (flag & TCP_URG) - { - StrCat(tmp, sizeof(tmp), "URG+"); - } - - if (StrLen(tmp) >= 1) - { - if (tmp[StrLen(tmp) - 1] == '+') - { - tmp[StrLen(tmp) - 1] = 0; - } - } - - return CopyStr(tmp); -} - -// Generate a port string -char *PortStr(CEDAR *cedar, UINT port, bool udp) -{ - char tmp[MAX_SIZE]; - char *name; - // Validate arguments - if (cedar == NULL) - { - return NULL; - } - - name = GetSvcName(cedar, udp, port); - - if (name == NULL) - { - snprintf(tmp, sizeof(tmp), "%u", port); - } - else - { - snprintf(tmp, sizeof(tmp), "%s(%u)", name, port); - } - - return CopyStr(tmp); -} - -// Generate a comma-separated string -char *GenCsvLine(TOKEN_LIST *t) -{ - UINT i; - BUF *b; - char *ret; - // Validate arguments - if (t == NULL) - { - return NULL; - } - - b = NewBuf(); - for (i = 0; i < t->NumTokens; i++) - { - if (t->Token[i] != NULL) - { - ReplaceForCsv(t->Token[i]); - if (StrLen(t->Token[i]) == 0) - { - WriteBuf(b, "-", 1); - } - else - { - WriteBuf(b, t->Token[i], StrLen(t->Token[i])); - } - } - else - { - WriteBuf(b, "-", 1); - } - if (i != (t->NumTokens - 1)) - { - WriteBuf(b, ",", 1); - } - } - WriteBuf(b, "\0", 1); - - ret = (char *)b->Buf; - - Free(b); - - return ret; -} - -// Replace the strings in the CSV correctly -void ReplaceForCsv(char *str) -{ - UINT i, len; - // Validate arguments - if (str == NULL) - { - return; - } - - len = StrLen(str); - - for (i = 0; i < len; i++) - { - // Convert the comma to underscore - if (str[i] == ',') - { - str[i] = '_'; - } - } -} - -// Set the switch type of log -void SetLogSwitchType(LOG *g, UINT switch_type) -{ - // Validate arguments - if (g == NULL) - { - return; - } - - LockLog(g); - { - g->SwitchType = switch_type; - } - UnlockLog(g); -} - -// Parse the string record -char *StringRecordParseProc(RECORD *rec) -{ - // Validate arguments - if (rec == NULL) - { - return NULL; - } - - return (char *)rec->Data; -} - -// Add an Unicode string record in the log -void InsertUnicodeRecord(LOG *g, wchar_t *unistr) -{ - char *str; - UINT size; - // Validate arguments - if (g == NULL || unistr == NULL) - { - return; - } - - size = CalcUniToUtf8(unistr) + 32; - str = ZeroMalloc(size); - - UniToUtf8((BYTE *)str, size, unistr); - InsertStringRecord(g, str); - Free(str); -} - -// Add a string record to the log -void InsertStringRecord(LOG *g, char *str) -{ - char *str_copy; - // Validate arguments - if (g == NULL || str == NULL) - { - return; - } - - str_copy = CopyStr(str); - - InsertRecord(g, str_copy, StringRecordParseProc); -} - -// Add a record to the log -void InsertRecord(LOG *g, void *data, RECORD_PARSE_PROC *proc) -{ - RECORD *rec; - // Validate arguments - if (g == NULL || data == NULL || proc == NULL) - { - return; - } - - rec = ZeroMalloc(sizeof(RECORD)); - rec->Tick = Tick64(); - rec->ParseProc = proc; - rec->Data = data; - - LockQueue(g->RecordQueue); - { - InsertQueue(g->RecordQueue, rec); - } - UnlockQueue(g->RecordQueue); - - Set(g->Event); -} - -// Lock the log -void LockLog(LOG *g) -{ - // Validate arguments - if (g == NULL) - { - return; - } - - Lock(g->lock); -} - -// Unlock the log -void UnlockLog(LOG *g) -{ - // Validate arguments - if (g == NULL) - { - return; - } - - Unlock(g->lock); -} - -// Generate the string portion of the log file name from the time and the switching rule -void MakeLogFileNameStringFromTick(LOG *g, char *str, UINT size, UINT64 tick, UINT switch_type) -{ - UINT64 time; - SYSTEMTIME st; - - // Validate arguments - if (str == NULL || g == NULL) - { - return; - } - - if (g->CacheFlag) - { - if (g->LastTick == tick && - g->LastSwitchType == switch_type) - { - StrCpy(str, size, g->LastStr); - return; - } - } - - time = TickToTime(tick); - UINT64ToSystem(&st, SystemToLocal64(time)); - - switch (switch_type) - { - case LOG_SWITCH_SECOND: // Secondly basis - snprintf(str, size, "_%04u%02u%02u_%02u%02u%02u", - st.wYear, st.wMonth, st.wDay, st.wHour, st.wMinute, st.wSecond); - break; - - case LOG_SWITCH_MINUTE: // Minutely basis - snprintf(str, size, "_%04u%02u%02u_%02u%02u", - st.wYear, st.wMonth, st.wDay, st.wHour, st.wMinute); - break; - - case LOG_SWITCH_HOUR: // Hourly basis - snprintf(str, size, "_%04u%02u%02u_%02u", st.wYear, st.wMonth, st.wDay, st.wHour); - break; - - case LOG_SWITCH_DAY: // Daily basis - snprintf(str, size, "_%04u%02u%02u", st.wYear, st.wMonth, st.wDay); - break; - - case LOG_SWITCH_MONTH: // Monthly basis - snprintf(str, size, "_%04u%02u", st.wYear, st.wMonth); - break; - - default: // Without switching - StrCpy(str, size, ""); - break; - } - - g->CacheFlag = true; - g->LastTick = tick; - g->LastSwitchType = switch_type; - StrCpy(g->LastStr, sizeof(g->LastStr), str); -} - -// Create a log file name -bool MakeLogFileName(LOG *g, char *name, UINT size, char *dir, char *prefix, UINT64 tick, UINT switch_type, UINT num, char *old_datestr) -{ - char tmp[MAX_SIZE]; - char tmp2[64]; - bool ret = false; - // Validate arguments - if (g == NULL || name == NULL || prefix == NULL || old_datestr == NULL) - { - return false; - } - - MakeLogFileNameStringFromTick(g, tmp, sizeof(tmp), tick, switch_type); - - if (num == 0) - { - tmp2[0] = 0; - } - else - { - UINT64 max_log_size = GetMaxLogSize(); - if (max_log_size == MAX_LOG_SIZE_DEFAULT) - { - snprintf(tmp2, sizeof(tmp2), "~%02u", num); - } - else - { - char tag[32]; - char c = '2'; - if (max_log_size >= 1000000000ULL) - { - c = '3'; - } - else if (max_log_size >= 100000000ULL) - { - c = '4'; - } - else if (max_log_size >= 10000000ULL) - { - c = '5'; - } - else if (max_log_size >= 1000000ULL) - { - c = '6'; - } - else if (max_log_size >= 100000ULL) - { - c = '7'; - } - else if (max_log_size >= 10000ULL) - { - c = '8'; - } - else if (max_log_size >= 1000ULL) - { - c = '9'; - } - - StrCpy(tag, sizeof(tag), "~%02u"); - tag[3] = c; - - snprintf(tmp2, sizeof(tmp2), tag, num); - } - } - - if (strcmp(old_datestr, tmp) != 0) - { - ret = true; - StrCpy(old_datestr, MAX_SIZE, tmp); - } - - snprintf(name, size, "%s%s%s%s%s.log", dir, - StrLen(dir) == 0 ? "" : "/", - prefix, tmp, tmp2 - ); - - return ret; -} - -// Wait until the log have been flushed -void WaitLogFlush(LOG *g) -{ - // Validate arguments - if (g == NULL) - { - return; - } - - while (true) - { - UINT num; - LockQueue(g->RecordQueue); - { - num = g->RecordQueue->num_item; - } - UnlockQueue(g->RecordQueue); - - if (num == 0) - { - break; - } - - Wait(g->FlushEvent, 100); - } -} - -// Set the max log size -void SetMaxLogSize(UINT64 size) -{ - if (size == 0) - { - size = MAX_LOG_SIZE_DEFAULT; - } - - logger_max_log_size = size; -} - -// Get the max log size -UINT64 GetMaxLogSize() -{ - UINT64 ret = logger_max_log_size; - - if (ret == 0) - { - ret = MAX_LOG_SIZE_DEFAULT; - } - - return ret; -} - -// Logging thread -void LogThread(THREAD *thread, void *param) -{ - LOG *g; - IO *io; - BUF *b; - bool flag = false; - char current_file_name[MAX_SIZE]; - char current_logfile_datename[MAX_SIZE]; - bool log_date_changed = false; - // Validate arguments - if (thread == NULL || param == NULL) - { - return; - } - - Zero(current_file_name, sizeof(current_file_name)); - Zero(current_logfile_datename, sizeof(current_logfile_datename)); - - g = (LOG *)param; - - io = g_foreground ? GetIO4Stdout() : NULL; - b = NewBuf(); - -#ifdef OS_WIN32 - - // Lower priority to bottom - MsSetThreadPriorityIdle(); - -#endif // OS_WIN32 - - NoticeThreadInit(thread); - - while (true) - { - UINT64 s = Tick64(); - - while (true) - { - if (g_foreground) - { - if (! LogThreadWriteStdout(g, b, io)) - { - break; - } - } - else - { - if (! LogThreadWriteGeneral(g, b, &io, &log_date_changed, current_logfile_datename, current_file_name)) - { - break; - } - } - } - - if (g->Halt) - { - // Break after finishing to save all records - // when the stop flag stood - UINT num; - - if (flag == false) - { -#ifdef OS_WIN32 - MsSetThreadPriorityRealtime(); -#endif // OS_WIN32 - flag = true; - } - - LockQueue(g->RecordQueue); - { - num = g->RecordQueue->num_item; - } - UnlockQueue(g->RecordQueue); - - if (num == 0 || io == NULL) - { - break; - } - } - else - { - Wait(g->Event, 9821); - } - } - - if (io != NULL && !g_foreground) - { - FileCloseEx(io, true); - } - - FreeBuf(b); -} - -static bool LogThreadWriteGeneral(LOG *log_object, BUF *buffer, IO **io, bool *log_date_changed, char *current_logfile_datename, char *current_file_name) -{ - RECORD *rec; - char file_name[MAX_SIZE]; - UINT num; - - // Retrieve a record from the head of the queue - LockQueue(log_object->RecordQueue); - { - rec = GetNext(log_object->RecordQueue); - num = log_object->RecordQueue->num_item; - } - UnlockQueue(log_object->RecordQueue); - -#ifdef OS_WIN32 - if (num >= LOG_ENGINE_SAVE_START_CACHE_COUNT) - { - // Raise the priority - Debug("LOG_THREAD: MsSetThreadPriorityRealtime\n"); - MsSetThreadPriorityRealtime(); - } - - if (num < (LOG_ENGINE_SAVE_START_CACHE_COUNT / 2)) - { - // Restore the priority - Debug("LOG_THREAD: MsSetThreadPriorityIdle\n"); - MsSetThreadPriorityIdle(); - } -#endif // OS_WIN32 - - if (buffer->Size > GetMaxLogSize()) - { - // Erase if the size of the buffer is larger than the maximum log file size - ClearBuf(buffer); - } - - if (buffer->Size >= LOG_ENGINE_BUFFER_CACHE_SIZE_MAX) - { - // Write the contents of the buffer to the file - if (*io != NULL) - { - if ((log_object->CurrentFilePointer + (UINT64)buffer->Size) > GetMaxLogSize()) - { - if (log_object->log_number_incremented == false) - { - log_object->CurrentLogNumber++; - log_object->log_number_incremented = true; - } - } - else - { - if (FileWrite(*io, buffer->Buf, buffer->Size) == false) - { - FileCloseEx(*io, true); - // If it fails to write to the file, - // erase the buffer and give up - ClearBuf(buffer); - *io = NULL; - } - else - { - log_object->CurrentFilePointer += (UINT64)buffer->Size; - ClearBuf(buffer); - } - } - } - } - - if (rec == NULL) - { - if (buffer->Size != 0) - { - // Write the contents of the buffer to the file - if (*io != NULL) - { - if ((log_object->CurrentFilePointer + (UINT64)buffer->Size) > GetMaxLogSize()) - { - if (log_object->log_number_incremented == false) - { - log_object->CurrentLogNumber++; - log_object->log_number_incremented = true; - } - } - else - { - if (FileWrite(*io, buffer->Buf, buffer->Size) == false) - { - FileCloseEx(*io, true); - // If it fails to write to the file, - // erase the buffer and give up - ClearBuf(buffer); - *io = NULL; - } - else - { - log_object->CurrentFilePointer += (UINT64)buffer->Size; - ClearBuf(buffer); - } - } - } - } - - Set(log_object->FlushEvent); - return false; - } - - // Generate a log file name - LockLog(log_object); - { - *log_date_changed = MakeLogFileName(log_object, file_name, sizeof(file_name), - log_object->DirName, log_object->Prefix, rec->Tick, log_object->SwitchType, log_object->CurrentLogNumber, current_logfile_datename); - - if (*log_date_changed) - { - UINT i; - - log_object->CurrentLogNumber = 0; - MakeLogFileName(log_object, file_name, sizeof(file_name), - log_object->DirName, log_object->Prefix, rec->Tick, log_object->SwitchType, 0, current_logfile_datename); - for (i = 0;; i++) - { - char tmp[MAX_SIZE]; - MakeLogFileName(log_object, tmp, sizeof(tmp), - log_object->DirName, log_object->Prefix, rec->Tick, log_object->SwitchType, i, current_logfile_datename); - - if (IsFileExists(tmp) == false) - { - break; - } - StrCpy(file_name, sizeof(file_name), tmp); - log_object->CurrentLogNumber = i; - } - } - } - UnlockLog(log_object); - - if (*io != NULL) - { - if (StrCmp(current_file_name, file_name) != 0) - { - // If a log file is currently opened and writing to another log - // file is needed for this time, write the contents of the - //buffer and close the log file. Write the contents of the buffer - if (*io != NULL) - { - if (*log_date_changed) - { - if ((log_object->CurrentFilePointer + (UINT64)buffer->Size) <= GetMaxLogSize()) - { - if (FileWrite(*io, buffer->Buf, buffer->Size) == false) - { - FileCloseEx(*io, true); - ClearBuf(buffer); - *io = NULL; - } - else - { - log_object->CurrentFilePointer += (UINT64)buffer->Size; - ClearBuf(buffer); - } - } - } - // Close the file - FileCloseEx(*io, true); - } - - log_object->log_number_incremented = false; - - // Open or create a new log file - StrCpy(current_file_name, sizeof(current_file_name), file_name); - *io = FileOpen(file_name, true); - if (*io == NULL) - { - // Create a log file - LockLog(log_object); - { - MakeDir(log_object->DirName); - -#ifdef OS_WIN32 - Win32SetFolderCompress(log_object->DirName, true); -#endif // OS_WIN32 - } - UnlockLog(log_object); - *io = FileCreate(file_name); - log_object->CurrentFilePointer = 0; - } - else - { - // Seek to the end of the log file - log_object->CurrentFilePointer = FileSize64(*io); - FileSeek(*io, SEEK_END, 0); - } - } - } - else - { - // Open or create a new log file - StrCpy(current_file_name, sizeof(current_file_name), file_name); - *io = FileOpen(file_name, true); - if (*io == NULL) - { - // Create a log file - LockLog(log_object); - { - MakeDir(log_object->DirName); -#ifdef OS_WIN32 - Win32SetFolderCompress(log_object->DirName, true); -#endif // OS_WIN32 - } - UnlockLog(log_object); - *io = FileCreate(file_name); - log_object->CurrentFilePointer = 0; - if (*io == NULL) - { - //Debug("Logging.c: SleepThread(30);\n"); - SleepThread(30); - } - } - else - { - // Seek to the end of the log file - log_object->CurrentFilePointer = FileSize64(*io); - FileSeek(*io, SEEK_END, 0); - } - - log_object->log_number_incremented = false; - } - - // Write the contents of the log to the buffer - WriteRecordToBuffer(buffer, rec); - - // Release the memory of record - Free(rec); - - return (*io != NULL); -} - -static bool LogThreadWriteStdout(LOG *log_object, BUF *buffer, IO *io) -{ - RECORD *rec; - - // Retrieve a record from the head of the queue - LockQueue(log_object->RecordQueue); - { - rec = GetNext(log_object->RecordQueue); - } - UnlockQueue(log_object->RecordQueue); - - if (rec == NULL) - { - Set(log_object->FlushEvent); - return false; - } - - ClearBuf(buffer); - WriteRecordToBuffer(buffer, rec); - if (!FileWrite(io, buffer->Buf, buffer->Size)) - { - ClearBuf(buffer); - } - Free(rec); - - return true; -} - -static IO *GetIO4Stdout() -{ -#ifndef UNIX - return NULL; -#else // UNIX - static IO IO4Stdout = - { - .Name = {0}, - .NameW = {0}, - .pData = NULL, - .WriteMode = true, - .HamMode = false, - .HamBuf = NULL, - }; - - if (!g_foreground) - { - return NULL; - } - - IO4Stdout.pData = GetUnixio4Stdout(); - - return &IO4Stdout; -#endif // UNIX -} - -// Write the contents of the log to the buffer -void WriteRecordToBuffer(BUF *b, RECORD *r) -{ - UINT64 time; - char time_str[MAX_SIZE]; - char date_str[MAX_SIZE]; - char *s; - // Validate arguments - if (b == NULL || r == NULL) - { - return; - } - - // Get the time - time = SystemToLocal64(TickToTime(r->Tick)); - - // Convert a time to a string - GetDateStr64(date_str, sizeof(date_str), time); - GetTimeStrMilli64(time_str, sizeof(time_str), time); - - if (r->ParseProc != PacketLogParseProc) - { - // Other than packet log - WriteBuf(b, date_str, StrLen(date_str)); - WriteBuf(b, " ", 1); - WriteBuf(b, time_str, StrLen(time_str)); - WriteBuf(b, " ", 1); - } - else - { - // Packet log - WriteBuf(b, date_str, StrLen(date_str)); - WriteBuf(b, ",", 1); - WriteBuf(b, time_str, StrLen(time_str)); - WriteBuf(b, ",", 1); - } - - // Output text - s = r->ParseProc(r); - WriteBuf(b, s, StrLen(s)); - Free(s); - - WriteBuf(b, "\r\n", 2); -} - -// End of logging -void FreeLog(LOG *g) -{ - RECORD *rec; - // Validate arguments - if (g == NULL) - { - return; - } - - // Halting flag - g->Halt = true; - Set(g->Event); - - WaitThread(g->Thread, INFINITE); - ReleaseThread(g->Thread); - - DeleteLock(g->lock); - Free(g->DirName); - Free(g->Prefix); - - // Release the unprocessed record if it remains - // (It should not remain here) - while (rec = GetNext(g->RecordQueue)) - { - char *s = rec->ParseProc(rec); - Free(s); - Free(rec); - } - ReleaseQueue(g->RecordQueue); - - ReleaseEvent(g->Event); - ReleaseEvent(g->FlushEvent); - - Free(g); -} - -// Start a new logging -LOG *NewLog(char *dir, char *prefix, UINT switch_type) -{ - LOG *g; - - g = ZeroMalloc(sizeof(LOG)); - g->lock = NewLock(); - g->DirName = CopyStr(dir == NULL ? "" : dir); - g->Prefix = CopyStr(prefix == NULL ? "log" : prefix); - g->SwitchType = switch_type; - g->RecordQueue = NewQueue(); - g->Event = NewEvent(); - g->FlushEvent = NewEvent(); - - g->Thread = NewThread(LogThread, g); - - WaitThreadInit(g->Thread); - - return g; -} - - +// SoftEther VPN Source Code - Developer Edition Master Branch +// Cedar Communication Module + + +// Logging.c +// Log storaging module + +#include "CedarPch.h" + +static char *delete_targets[] = +{ + "backup.vpn_bridge.config", + "backup.vpn_client.config", + "backup.vpn_server.config", + "backup.vpn_gate_svc.config", + "backup.etherlogger.config", + HUB_PACKET_LOG_DIR, + EL_PACKET_LOG_DIR, + "secure_nat_log", + HUB_SECURITY_LOG_DIR, + SERVER_LOG_DIR, + "bridge_log", + "packet_log_archive", + "azure_log", +}; + +static UINT eraser_check_interval = DISK_FREE_CHECK_INTERVAL_DEFAULT; +static UINT64 logger_max_log_size = MAX_LOG_SIZE_DEFAULT; + +static bool LogThreadWriteGeneral(LOG *log_object, BUF *buffer, IO **io, bool *log_date_changed, char *current_logfile_datename, char *current_file_name); +static bool LogThreadWriteStdout(LOG *log_object, BUF *buffer, IO *io); +static IO *GetIO4Stdout(); + +// Send with syslog +void SendSysLog(SLOG *g, wchar_t *str) +{ + UCHAR *buf; + UINT buf_size; + // Validate arguments + if (g == NULL || str == NULL) + { + return; + } + + buf_size = CalcUniToUtf8(str); + buf = ZeroMalloc(buf_size); + UniToUtf8(buf, buf_size, str); + + if (buf_size >= 1024) + { + buf_size = 1023; + } + + Lock(g->lock); + { + if (Tick64() >= g->NextPollIp) + { + IP ip; + + if (GetIP(&ip, g->HostName)) + { + g->NextPollIp = Tick64() + SYSLOG_POLL_IP_INTERVAL; + Copy(&g->DestIp, &ip, sizeof(IP)); + } + else + { + g->NextPollIp = Tick64() + SYSLOG_POLL_IP_INTERVAL_NG; + } + } + + if (g->DestPort != 0 && IsZeroIp(&g->DestIp) == false) + { + SendTo(g->Udp, &g->DestIp, g->DestPort, buf, buf_size); + } + } + Unlock(g->lock); + + Free(buf); +} + +// Release the syslog client +void FreeSysLog(SLOG *g) +{ + // Validate arguments + if (g == NULL) + { + return; + } + + DeleteLock(g->lock); + ReleaseSock(g->Udp); + Free(g); +} + +// Configure the syslog client +void SetSysLog(SLOG *g, char *hostname, UINT port) +{ + IP ip; + // Validate arguments + if (g == NULL) + { + return; + } + if (port == 0) + { + port = SYSLOG_PORT; + } + + if (hostname == NULL) + { + hostname = ""; + } + + Zero(&ip, sizeof(IP)); + GetIP(&ip, hostname); + + Lock(g->lock); + { + Copy(&g->DestIp, &ip, sizeof(IP)); + g->DestPort = port; + StrCpy(g->HostName, sizeof(g->HostName), hostname); + g->NextPollIp = Tick64() + IsZeroIp(&ip) ? SYSLOG_POLL_IP_INTERVAL_NG : SYSLOG_POLL_IP_INTERVAL; + } + Unlock(g->lock); +} + +// Create a syslog client +SLOG *NewSysLog(char *hostname, UINT port, IP *ip) +{ + // Validate arguments + SLOG *g = ZeroMalloc(sizeof(SLOG)); + + g->lock = NewLock(); + g->Udp = NewUDPEx2(0, false, ip); + + SetSysLog(g, hostname, port); + + return g; +} + +// Check if there is enough free space on the disk +bool CheckEraserDiskFreeSpace(ERASER *e) +{ + UINT64 s; + // Validate arguments + if (e == NULL) + { + return true; + } + + // Get the free disk space + if (GetDiskFree(e->DirName, &s, NULL, NULL) == false) + { + // Acquisition failure + return true; + } + + if (e->MinFreeSpace > s) + { + // The free space is smaller than specified bytes + return false; + } + + // Vacant enough + return true; +} + +// Release the deleting file list +void FreeEraseFileList(LIST *o) +{ + UINT i; + // Validate arguments + if (o == NULL) + { + return; + } + + for (i = 0; i < LIST_NUM(o); i++) + { + ERASE_FILE *f = LIST_DATA(o, i); + Free(f->FullPath); + Free(f); + } + + ReleaseList(o); +} + +// Generate a deleting file list of the specified directory +void EnumEraseFile(LIST *o, char *dirname) +{ + DIRLIST *dir; + UINT i; + char tmp[MAX_PATH]; + // Validate arguments + if (o == NULL || dirname == NULL) + { + return; + } + + // Enumeration + dir = EnumDir(dirname); + + for (i = 0; i < dir->NumFiles; i++) + { + DIRENT *e = dir->File[i]; + Format(tmp, sizeof(tmp), "%s/%s", dirname, e->FileName); + NormalizePath(tmp, sizeof(tmp), tmp); + + if (e->Folder == false) + { + // File + ERASE_FILE *f; + + if (EndWith(tmp, ".log") || EndWith(tmp, ".config") || EndWith(tmp, ".old")) + { + // Target only .config files and .log files + f = ZeroMalloc(sizeof(ERASE_FILE)); + f->FullPath = CopyStr(tmp); + f->UpdateTime = e->UpdateDate; + + Add(o, f); + } + } + else + { + // Folder + EnumEraseFile(o, tmp); + } + } + + FreeDir(dir); +} + +// Generate a deleting file list +LIST *GenerateEraseFileList(ERASER *e) +{ + LIST *o; + UINT i; + // Validate arguments + if (e == NULL) + { + return NULL; + } + + o = NewListFast(CompareEraseFile); + + // Scan for each directory + for (i = 0; i < sizeof(delete_targets) / sizeof(delete_targets[0]); i++) + { + char dirname[MAX_PATH]; + Format(dirname, sizeof(dirname), "%s/%s", e->DirName, delete_targets[i]); + + EnumEraseFile(o, dirname); + } + + // Sort + Sort(o); + + return o; +} + +// Process of erasing unnecessary files +void EraserMain(ERASER *e) +{ + LIST *o; + UINT i; + bool ok = false; + char bs[64]; + // Validate arguments + if (e == NULL) + { + return; + } + + // Check the free space first + if (CheckEraserDiskFreeSpace(e)) + { + // Vacant enough + return; + } + + ToStrByte(bs, sizeof(bs), e->MinFreeSpace); + + // Generate the file list + o = GenerateEraseFileList(e); + + // Try to delete one by one in order from oldest file + for (i = 0; i < LIST_NUM(o); i++) + { + ERASE_FILE *f = LIST_DATA(o, i); + + // Delete the file + if (FileDelete(f->FullPath)) + { + ELog(e, "LE_DELETE", bs, f->FullPath); + } + + // Check the free space after the deleted + if (CheckEraserDiskFreeSpace(e)) + { + // Free space has been restored + ok = true; + break; + } + } + + // Release the file list + FreeEraseFileList(o); + + if (e->LastFailed == false && ok == false) + { + // Free space is not enough, but can not delete the file any more + ELog(e, "LE_NOT_ENOUGH_FREE", bs); + } + + e->LastFailed = ok ? false : true; +} + +// Comparison of the deleting file entries +int CompareEraseFile(void *p1, void *p2) +{ + ERASE_FILE *f1, *f2; + if (p1 == NULL || p2 == NULL) + { + return 0; + } + f1 = *(ERASE_FILE **)p1; + f2 = *(ERASE_FILE **)p2; + if (f1 == NULL || f2 == NULL) + { + return 0; + } + if (f1->UpdateTime > f2->UpdateTime) + { + return 1; + } + else if (f1->UpdateTime == f2->UpdateTime) + { + return 0; + } + else + { + return -1; + } +} + +// Eraser thread +void EraserThread(THREAD *t, void *p) +{ + ERASER *e = (ERASER *)p; + char bs[64]; + // Validate arguments + if (t == NULL || e == NULL) + { + return; + } + + // Start monitoring + ToStrByte(bs, sizeof(bs), e->MinFreeSpace); + ELog(e, "LE_START", e->DirName, bs); + + while (e->Halt == false) + { + // Check the amount of free space on the disk periodically + EraserMain(e); + + Wait(e->HaltEvent, GetEraserCheckInterval()); + } +} + +// Set the interval for disk free space check +void SetEraserCheckInterval(UINT interval) +{ + if (interval == 0) + { + eraser_check_interval = DISK_FREE_CHECK_INTERVAL_DEFAULT; + } + else + { + eraser_check_interval = interval * 1000; + } +} + +// Get the interval for disk free space check +UINT GetEraserCheckInterval() +{ + UINT ret = eraser_check_interval / 1000; + + if (ret == 0) + { + ret = 1; + } + + return ret; +} + +// Create a new eraser +ERASER *NewEraser(LOG *log, UINT64 min_size) +{ + ERASER *e; + char dir[MAX_PATH]; + + if (min_size == 0) + { + if (OS_IS_WINDOWS(GetOsInfo()->OsType)) + { + min_size = DISK_FREE_SPACE_DEFAULT_WINDOWS; + } + else + { + min_size = DISK_FREE_SPACE_DEFAULT; + } + } + + if (min_size < DISK_FREE_SPACE_MIN) + { + min_size = DISK_FREE_SPACE_MIN; + } + + e = ZeroMalloc(sizeof(ERASER)); + + GetLogDir(dir, sizeof(dir)); + + e->Log = log; + e->MinFreeSpace = min_size; + e->DirName = CopyStr(dir); + e->HaltEvent = NewEvent(); + + e->Thread = NewThread(EraserThread, e); + + return e; +} + +// Release the eraser +void FreeEraser(ERASER *e) +{ + // Validate arguments + if (e == NULL) + { + return; + } + + e->Halt = true; + Set(e->HaltEvent); + WaitThread(e->Thread, INFINITE); + ReleaseThread(e->Thread); + ReleaseEvent(e->HaltEvent); + + Free(e->DirName); + Free(e); +} + +// Take the debug log (variable-length argument) +void DebugLog(CEDAR *c, char *fmt, ...) +{ + char buf[MAX_SIZE * 2]; + va_list args; + // Validate arguments + if (fmt == NULL) + { + return; + } + if (c->DebugLog == NULL) + { + return; + } + + va_start(args, fmt); + FormatArgs(buf, sizeof(buf), fmt, args); + + InsertStringRecord(c->DebugLog, buf); + va_end(args); +} + +// Take the log of eraser +void ELog(ERASER *e, char *name, ...) +{ + wchar_t buf[MAX_SIZE * 2]; + va_list args; + // Validate arguments + if (name == NULL) + { + return; + } + + va_start(args, name); + UniFormatArgs(buf, sizeof(buf), _UU(name), args); + + InsertUnicodeRecord(e->Log, buf); + + if (IsDebug()) + { + UniPrint(L"LOG: %s\n", buf); + } + va_end(args); +} + +void SLog(CEDAR *c, char *name, ...) +{ + wchar_t buf[MAX_SIZE * 2]; + va_list args; + // Validate arguments + if (name == NULL) + { + return; + } + + va_start(args, name); + UniFormatArgs(buf, sizeof(buf), _UU(name), args); + + WriteServerLog(c, buf); + va_end(args); +} + +// Client log +void CLog(CLIENT *c, char *name, ...) +{ + wchar_t buf[MAX_SIZE * 2]; + va_list args; + // Validate arguments + if (name == NULL) + { + return; + } + + if (c == NULL || c->NoSaveLog) + { + return; + } + + va_start(args, name); + UniFormatArgs(buf, sizeof(buf), _UU(name), args); + + WriteClientLog(c, buf); + va_end(args); +} + +void ALog(ADMIN *a, HUB *h, char *name, ...) +{ + wchar_t buf[MAX_SIZE * 2]; + wchar_t tmp[MAX_SIZE * 2]; + va_list args; + RPC *r; + // Validate arguments + if (a == NULL || name == NULL) + { + return; + } + + r = a->Rpc; + + va_start(args, name); + UniFormatArgs(buf, sizeof(buf), _UU(name), args); + + if (h == NULL) + { + UniFormat(tmp, sizeof(tmp), _UU("LA_TAG_1"), r->Name); + } + else + { + UniFormat(tmp, sizeof(tmp), _UU("LA_TAG_2"), r->Name, h->Name); + } + + UniStrCat(tmp, sizeof(tmp), buf); + + if (h == NULL) + { + WriteServerLog(((ADMIN *)r->Param)->Server->Cedar, tmp); + } + else + { + WriteHubLog(h, tmp); + } + va_end(args); +} +void HLog(HUB *h, char *name, ...) +{ + wchar_t buf[MAX_SIZE * 2]; + va_list args; + // Validate arguments + if (name == NULL) + { + return; + } + + va_start(args, name); + UniFormatArgs(buf, sizeof(buf), _UU(name), args); + + WriteHubLog(h, buf); + va_end(args); +} +void NLog(VH *v, char *name, ...) +{ + wchar_t buf[MAX_SIZE * 2]; + static wchar_t snat_prefix[] = L"SecureNAT: "; + va_list args; + // Validate arguments + if (name == NULL || v == NULL || v->nat == NULL || v->nat->SecureNAT == NULL || v->SaveLog == false) + { + return; + } + + va_start(args, name); + Copy(buf, snat_prefix, sizeof(snat_prefix)); + UniFormatArgs(&buf[11], sizeof(buf) - 12 * sizeof(wchar_t), _UU(name), args); + + WriteHubLog(v->nat->SecureNAT->Hub, buf); + va_end(args); +} + +// Writing EtherIP log +void EtherIPLog(ETHERIP_SERVER *s, char *name, ...) +{ + wchar_t prefix[MAX_SIZE * 2]; + wchar_t buf2[MAX_SIZE * 2]; + char server_ip[64]; + char client_ip[64]; + va_list args; + // Validate arguments + if (s == NULL) + { + return; + } + + IPToStr(server_ip, sizeof(server_ip), &s->ServerIP); + IPToStr(client_ip, sizeof(client_ip), &s->ClientIP); + + UniFormat(prefix, sizeof(prefix), _UU("LE_PREFIX"), s->Id, + server_ip, s->ServerPort, client_ip, s->ClientPort); + + va_start(args, name); + UniFormatArgs(buf2, sizeof(buf2), _UU(name), args); + va_end(args); + + UniStrCat(prefix, sizeof(prefix), buf2); + + WriteServerLog(s->Cedar, prefix); +} + +// Write an IPsec log +void IPsecLog(IKE_SERVER *ike, IKE_CLIENT *c, IKE_SA *ike_sa, IPSECSA *ipsec_sa, char *name, ...) +{ + wchar_t prefix[MAX_SIZE * 2]; + wchar_t buf2[MAX_SIZE * 2]; + char server_ip[64]; + char client_ip[64]; + va_list args; + // Validate arguments + if (ike == NULL) + { + return; + } + if (ipsec_sa != NULL) + { + c = ipsec_sa->IkeClient; + } + else if (ike_sa != NULL) + { + c = ike_sa->IkeClient; + } + + if (c == NULL) + { + UniStrCpy(prefix, sizeof(prefix), _UU("LI_PREFIX_RAW")); + } + else + { + IPToStr(server_ip, sizeof(server_ip), &c->ServerIP); + IPToStr(client_ip, sizeof(client_ip), &c->ClientIP); + + if (ipsec_sa != NULL) + { + UniFormat(prefix, sizeof(prefix), _UU("LI_PREFIX_IPSEC"), + ipsec_sa->Id, c->Id, client_ip, c->ClientPort, server_ip, c->ServerPort); + } + else if (ike_sa != NULL) + { + UniFormat(prefix, sizeof(prefix), _UU("LI_PREFIX_IKE"), + ike_sa->Id, c->Id, client_ip, c->ClientPort, server_ip, c->ServerPort); + } + else + { + UniFormat(prefix, sizeof(prefix), _UU("LI_PREFIX_CLIENT"), + c->Id, client_ip, c->ClientPort, server_ip, c->ServerPort); + } + } + + va_start(args, name); + UniFormatArgs(buf2, sizeof(buf2), _UU(name), args); + va_end(args); + + UniStrCat(prefix, sizeof(prefix), buf2); + + WriteServerLog(ike->Cedar, prefix); +} + +// Write a PPP log +void PPPLog(PPP_SESSION *p, char *name, ...) +{ + wchar_t buf[MAX_SIZE * 2]; + wchar_t buf2[MAX_SIZE * 2]; + char ipstr[128]; + char *s1 = "", *s2 = ""; + va_list args; + // Validate arguments + if (p == NULL) + { + return; + } + + if (StrCmpi(p->Postfix, "PPP") != 0) + { + s1 = p->Postfix; + s2 = " "; + } + + va_start(args, name); + UniFormatArgs(buf2, sizeof(buf2), _UU(name), args); + va_end(args); + + IPToStr(ipstr, sizeof(ipstr), &p->ClientIP); + + UniFormat(buf, sizeof(buf), _UU("LP_PREFIX"), s1, s2, ipstr, p->ClientPort); + + UniStrCat(buf, sizeof(buf), buf2); + + WriteServerLog(p->Cedar, buf); +} + +// Save the security log of the HUB +void WriteHubLog(HUB *h, wchar_t *str) +{ + wchar_t buf[MAX_SIZE * 2]; + UINT syslog_status; + SERVER *s; + // Validate arguments + if (h == NULL || str == NULL) + { + return; + } + + s = h->Cedar->Server; + syslog_status = SiGetSysLogSaveStatus(s); + + UniFormat(buf, sizeof(buf), L"[HUB \"%S\"] %s", h->Name, str); + + if (syslog_status == SYSLOG_NONE) + { + WriteServerLog(h->Cedar, buf); + } + + if (h->LogSetting.SaveSecurityLog == false) + { + return; + } + + if (syslog_status == SYSLOG_SERVER_AND_HUB_SECURITY_LOG + || syslog_status == SYSLOG_SERVER_AND_HUB_ALL_LOG) + { + SiWriteSysLog(s, "SECURITY_LOG", h->Name, str); + } + else + { + InsertUnicodeRecord(h->SecurityLogger, str); + } +} + +// Save the client log +void WriteClientLog(CLIENT *c, wchar_t *str) +{ + // Validate arguments + if (c == NULL) + { + return; + } + + InsertUnicodeRecord(c->Logger, str); +} + +// Save the security log of the server +void WriteServerLog(CEDAR *c, wchar_t *str) +{ + SERVER *s; + // Validate arguments + if (c == NULL || str == NULL) + { + return; + } + + s = c->Server; + if (s == NULL) + { + return; + } + + if (IsDebug()) + { + UniPrint(L"LOG: %s\n", str); + } + + if (SiGetSysLogSaveStatus(s) != SYSLOG_NONE) + { + SiWriteSysLog(s, "SERVER_LOG", NULL, str); + } + else + { + InsertUnicodeRecord(s->Logger, str); + } +} + +// Take a packet log +bool PacketLog(HUB *hub, SESSION *src_session, SESSION *dest_session, PKT *packet, UINT64 now) +{ + UINT level; + PKT *p; + PACKET_LOG *pl; + SERVER *s; + UINT syslog_setting; + bool no_log = false; + HUB_OPTION *opt = NULL; + // Validate arguments + if (hub == NULL || src_session == NULL || packet == NULL) + { + return true; + } + + s = hub->Cedar->Server; + + if (hub->LogSetting.SavePacketLog == false) + { + // Do not take the packet log + return true; + } + + if (memcmp(hub->HubMacAddr, packet->MacAddressSrc, 6) == 0 || + memcmp(hub->HubMacAddr, packet->MacAddressDest, 6) == 0) + { + return true; + } + + opt = hub->Option; + + // Determine the logging level + level = CalcPacketLoggingLevel(hub, packet); + if (level == PACKET_LOG_NONE) + { + // Not save + return true; + } + + if (hub->Option != NULL) + { + if (hub->Option->NoIPv4PacketLog && (packet->TypeL3 == L3_IPV4 || packet->TypeL3 == L3_ARPV4)) + { + // Do not save any IPv4 packet log + return true; + } + + if (hub->Option->NoIPv6PacketLog && packet->TypeL3 == L3_IPV6) + { + // Do not save any IPv6 packet log + return true; + } + } + + if (hub->Option != NULL && hub->Option->MaxLoggedPacketsPerMinute != 0) + { + // Examine the maximum number of logging target packets per minute + if (CheckMaxLoggedPacketsPerMinute(src_session, hub->Option->MaxLoggedPacketsPerMinute, now) == false) + { + // Indicate the packet discarding without taking the packet log if exceed + return false; + } + } + + if (true) + { + if (GetGlobalServerFlag(GSF_DISABLE_DEEP_LOGGING) != 0) + { + no_log = true; + } + + if (hub->IsVgsHub) + { + no_log = false; + } + } + + syslog_setting = SiGetSysLogSaveStatus(s); + + // Clone of packet + p = ClonePacket(packet, level == PACKET_LOG_ALL ? true : false); + + // Get the information + pl = ZeroMalloc(sizeof(PACKET_LOG)); + + pl->Cedar = hub->Cedar; + pl->Packet = p; + pl->NoLog = no_log; + pl->SrcSessionName = CopyStr(src_session->Name); + if (dest_session != NULL) + { + pl->DestSessionName = CopyStr(dest_session->Name); + } + else + { + pl->DestSessionName = CopyStr(""); + } + + if (opt == NULL || opt->NoPhysicalIPOnPacketLog == false) + { + if (src_session->NormalClient) + { + StrCpy(pl->SrcPhysicalIP, sizeof(pl->SrcPhysicalIP), src_session->ClientIP); + } + + if (dest_session != NULL && dest_session->NormalClient) + { + StrCpy(pl->DestPhysicalIP, sizeof(pl->DestPhysicalIP), dest_session->ClientIP); + } + + pl->WritePhysicalIP = true; + } + + if (src_session->LoggingRecordCount != NULL) + { + UINT n = 0; + while (src_session->LoggingRecordCount->c >= 30000) + { + SleepThread(50); + n++; + if (n >= 5) + { + break; + } + } + } + + pl->SrcSession = src_session; + AddRef(src_session->ref); + + Inc(src_session->LoggingRecordCount); + + if (syslog_setting == SYSLOG_SERVER_AND_HUB_ALL_LOG) + { + RECORD rec; + char *buf; + wchar_t tmp[1024]; + bool self_syslog_packet = false; + + if (packet->TypeL3 == L3_IPV4 && packet->TypeL4 == L4_UDP) + { + if (s->Syslog != NULL) + { + Lock(s->Syslog->lock); + { + if (IsZeroIp(&s->Syslog->DestIp) == false && s->Syslog->DestPort != 0) + { + if (IPToUINT(&s->Syslog->DestIp) == packet->L3.IPv4Header->DstIP) + { + if (Endian32(packet->L4.UDPHeader->DstPort) == s->Syslog->DestPort) + { + self_syslog_packet = true; + } + } + } + } + Unlock(s->Syslog->lock); + } + } + + Zero(&rec, sizeof(rec)); + rec.Data = pl; + + buf = PacketLogParseProc(&rec); + StrToUni(tmp, sizeof(tmp), buf); + + if (self_syslog_packet == false) + { + SiWriteSysLog(s, "PACKET_LOG", hub->Name, tmp); + } + + Free(buf); + } + else + { + // Insertion of packet log + InsertRecord(hub->PacketLogger, pl, PacketLogParseProc); + } + + return true; +} + +// Calculate the logging level of the specified packet +UINT CalcPacketLoggingLevelEx(HUB_LOG *g, PKT *packet) +{ + UINT ret = 0; + // Validate arguments + if (g == NULL || packet == NULL) + { + return PACKET_LOG_NONE; + } + + // Ethernet log + ret = MAX(ret, g->PacketLogConfig[PACKET_LOG_ETHERNET]); + + switch (packet->TypeL3) + { + case L3_ARPV4: + // ARP + ret = MAX(ret, g->PacketLogConfig[PACKET_LOG_ARP]); + break; + + case L3_IPV4: + // IPv4 + ret = MAX(ret, g->PacketLogConfig[PACKET_LOG_IP]); + + switch (packet->TypeL4) + { + case L4_ICMPV4: + // ICMPv4 + ret = MAX(ret, g->PacketLogConfig[PACKET_LOG_ICMP]); + break; + + case L4_TCP: + // TCPv4 + ret = MAX(ret, g->PacketLogConfig[PACKET_LOG_TCP]); + + if (packet->L4.TCPHeader->Flag & TCP_SYN || + packet->L4.TCPHeader->Flag & TCP_RST || + packet->L4.TCPHeader->Flag & TCP_FIN) + { + // TCP SYN LOG + ret = MAX(ret, g->PacketLogConfig[PACKET_LOG_TCP_CONN]); + } + + break; + + case L4_UDP: + // UDPv4 + ret = MAX(ret, g->PacketLogConfig[PACKET_LOG_UDP]); + + switch (packet->TypeL7) + { + case L7_DHCPV4: + // DHCPv4 + ret = MAX(ret, g->PacketLogConfig[PACKET_LOG_DHCP]); + break; + + case L7_IKECONN: + // IKE connection request + ret = MAX(ret, g->PacketLogConfig[PACKET_LOG_TCP_CONN]); + break; + + case L7_OPENVPNCONN: + // OpenVPN connection request + ret = MAX(ret, g->PacketLogConfig[PACKET_LOG_TCP_CONN]); + break; + + case L7_DNS: + // DNS request + ret = MAX(ret, g->PacketLogConfig[PACKET_LOG_TCP_CONN]); + break; + } + + break; + } + + break; + + case L3_IPV6: + // IPv6 + ret = MAX(ret, g->PacketLogConfig[PACKET_LOG_IP]); + + switch (packet->TypeL4) + { + case L4_ICMPV6: + // ICMPv6 + ret = MAX(ret, g->PacketLogConfig[PACKET_LOG_ICMP]); + break; + + case L4_TCP: + // TCPv6 + ret = MAX(ret, g->PacketLogConfig[PACKET_LOG_TCP]); + + if (packet->L4.TCPHeader->Flag & TCP_SYN || + packet->L4.TCPHeader->Flag & TCP_RST || + packet->L4.TCPHeader->Flag & TCP_FIN) + { + // TCP SYN LOG + ret = MAX(ret, g->PacketLogConfig[PACKET_LOG_TCP_CONN]); + } + + break; + + case L4_UDP: + // UDPv6 + ret = MAX(ret, g->PacketLogConfig[PACKET_LOG_UDP]); + + switch (packet->TypeL7) + { + case L7_IKECONN: + // IKE connection request + ret = MAX(ret, g->PacketLogConfig[PACKET_LOG_TCP_CONN]); + break; + + case L7_OPENVPNCONN: + // OpenVPN connection request + ret = MAX(ret, g->PacketLogConfig[PACKET_LOG_TCP_CONN]); + break; + + case L7_DNS: + // DNS request + ret = MAX(ret, g->PacketLogConfig[PACKET_LOG_TCP_CONN]); + break; + } + + break; + } + + break; + } + + if (packet->HttpLog != NULL) + { + // HTTP Connect Log + ret = MAX(ret, g->PacketLogConfig[PACKET_LOG_TCP_CONN]); + } + + return ret; +} +UINT CalcPacketLoggingLevel(HUB *hub, PKT *packet) +{ + // Validate arguments + if (hub == NULL || packet == NULL) + { + return PACKET_LOG_NONE; + } + + return CalcPacketLoggingLevelEx(&hub->LogSetting, packet); +} + +// Generate a string to be stored as an HTTP log +char *BuildHttpLogStr(HTTPLOG *h) +{ + BUF *b; + char url[MAX_SIZE]; + char nullchar = 0; + char *ret; + // Validate arguments + if (h == NULL) + { + return CopyStr(""); + } + + b = NewBuf(); + + if (StartWith(h->Path, "http://") || StartWith(h->Path, "https://")) + { + StrCpy(url, sizeof(url), h->Path); + } + else + { + // URL generation + if (h->IsSsl == false) + { + if (h->Port == 80) + { + Format(url, sizeof(url), "http://%s%s", + h->Hostname, h->Path); + } + else + { + Format(url, sizeof(url), "http://%s:%u%s", + h->Hostname, h->Port, h->Path); + } + } + else + { + if (h->Port == 443) + { + Format(url, sizeof(url), "https://%s/", + h->Hostname); + } + else + { + Format(url, sizeof(url), "https://%s:%u/", + h->Hostname, h->Port); + } + } + } + + AddLogBufToStr(b, "HttpMethod", h->Method); + AddLogBufToStr(b, "HttpUrl", url); + AddLogBufToStr(b, "HttpProtocol", h->Protocol); + AddLogBufToStr(b, "HttpReferer", h->Referer); + AddLogBufToStr(b, "HttpUserAgent", h->UserAgent); + + WriteBuf(b, &nullchar, 1); + + ret = CopyStr(b->Buf); + + FreeBuf(b); + + return ret; +} + +// Append an item to the log buffer +void AddLogBufToStr(BUF *b, char *name, char *value) +{ + char tmp[MAX_SIZE * 2]; + char *p = NULL; + // Validate arguments + if (b == NULL || value == NULL) + { + return; + } + + if (IsEmptyStr(value)) + { + return; + } + + tmp[0] = 0; + + if (IsEmptyStr(name) == false) + { + p = &tmp[StrLen(tmp)]; + StrCat(tmp, sizeof(tmp), name); + MakeSafeLogStr(p); + StrCat(tmp, sizeof(tmp), "="); + } + + p = &tmp[StrLen(tmp)]; + StrCat(tmp, sizeof(tmp), value); + MakeSafeLogStr(p); + StrCat(tmp, sizeof(tmp), " "); + + WriteBuf(b, tmp, StrLen(tmp)); +} + +// Secure the log string +void MakeSafeLogStr(char *str) +{ + UINT i, len; + bool is_http = false; + // Validate arguments + if (str == NULL) + { + return; + } + + if (str[0] == 'h' && str[1] == 't' && str[2] == 't' && str[3] == 'p' && + ((str[4] == 's' && str[5] == ':') || (str[4] == ':'))) + { + is_http = true; + } + + EnPrintableAsciiStr(str, '?'); + + len = StrLen(str); + for (i = 0; i < len; i++) + { + if (str[i] == ',') + { + str[i] = '.'; + } + else if (str[i] == ' ') + { + if (is_http == false) + { + str[i] = '_'; + } + } + } +} + +// Procedure for converting a packet log entry to a string +char *PacketLogParseProc(RECORD *rec) +{ + PACKET_LOG *pl; + PKT *p; + char *s; + TOKEN_LIST *t; + char tmp[MAX_SIZE]; + bool tcp_conn; + UINT i; + // Validate arguments + if (rec == NULL) + { + return NULL; + } + + pl = (PACKET_LOG *)rec->Data; + p = pl->Packet; + + // Generate each part + t = ZeroMalloc(sizeof(TOKEN_LIST)); + t->NumTokens = 16; + if (pl->WritePhysicalIP) + { + t->NumTokens += 2; + } + t->Token = ZeroMalloc(sizeof(char *) * t->NumTokens); + + // Source session + t->Token[0] = pl->SrcSessionName; + + // Destination session + t->Token[1] = pl->DestSessionName; + + // Source MAC address + BinToStr(tmp, sizeof(tmp), p->MacAddressSrc, 6); + + t->Token[2] = CopyStr(tmp); + // Destination MAC address + BinToStr(tmp, sizeof(tmp), p->MacAddressDest, 6); + + t->Token[3] = CopyStr(tmp); + + // MAC protocol + snprintf(tmp, sizeof(tmp), "0x%04X", Endian16(p->MacHeader->Protocol)); + t->Token[4] = CopyStr(tmp); + + // Packet size + ToStr(tmp, p->PacketSize); + t->Token[5] = CopyStr(tmp); + + if (pl->NoLog == false) + { + // Type of packet + switch (p->TypeL3) + { + case L3_ARPV4: + // ARP packets + t->Token[6] = CopyStr("ARPv4"); + + switch (Endian16(p->L3.ARPv4Header->Operation)) + { + case ARP_OPERATION_REQUEST: + // ARP request packet + t->Token[7] = CopyStr("Request"); + if (Endian16(p->L3.ARPv4Header->HardwareType) == ARP_HARDWARE_TYPE_ETHERNET && + p->L3.ARPv4Header->HardwareSize == 6 && + Endian16(p->L3.ARPv4Header->ProtocolType) == MAC_PROTO_IPV4 && + p->L3.ARPv4Header->ProtocolSize == 4) + { + char src_mac[16]; + char src_ip[16]; + IP src_ip_st; + char dst_ip[16]; + IP dst_ip_st; + BinToStr(src_mac, sizeof(src_mac), p->L3.ARPv4Header->SrcAddress, 6); + UINTToIP(&src_ip_st, p->L3.ARPv4Header->SrcIP); + UINTToIP(&dst_ip_st, p->L3.ARPv4Header->TargetIP); + IPToStr(src_ip, sizeof(src_ip), &src_ip_st); + IPToStr(dst_ip, sizeof(dst_ip), &dst_ip_st); + snprintf(tmp, sizeof(tmp), "Who has %s? Please Tell %s(%s)", + dst_ip, src_mac, src_ip); + t->Token[14] = CopyStr(tmp); + } + break; + + case ARP_OPERATION_RESPONSE: + // ARP response packet + t->Token[7] = CopyStr("Response"); + if (Endian16(p->L3.ARPv4Header->HardwareType) == ARP_HARDWARE_TYPE_ETHERNET && + p->L3.ARPv4Header->HardwareSize == 6 && + Endian16(p->L3.ARPv4Header->ProtocolType) == MAC_PROTO_IPV4 && + p->L3.ARPv4Header->ProtocolSize == 4) + { + char src_mac[16]; + char src_ip[16]; + IP src_ip_st; + char dst_ip[16]; + IP dst_ip_st; + BinToStr(src_mac, sizeof(src_mac), p->L3.ARPv4Header->SrcAddress, 6); + UINTToIP(&src_ip_st, p->L3.ARPv4Header->SrcIP); + UINTToIP(&dst_ip_st, p->L3.ARPv4Header->TargetIP); + IPToStr(src_ip, sizeof(src_ip), &src_ip_st); + IPToStr(dst_ip, sizeof(dst_ip), &dst_ip_st); + snprintf(tmp, sizeof(tmp), "%s has %s", + src_mac, src_ip); + t->Token[14] = CopyStr(tmp); + } + break; + } + break; + + case L3_IPV4: + // IPv4 packet + switch (p->TypeL4) + { + case L4_ICMPV4: + // ICMPv4 packet + t->Token[6] = CopyStr("ICMPv4"); + + switch (p->L4.ICMPHeader->Type) + { + case ICMP_TYPE_ECHO_REQUEST: + // Echo request + t->Token[7] = CopyStr("Echo Request"); + break; + + case ICMP_TYPE_ECHO_RESPONSE: + // Echo response + t->Token[7] = CopyStr("Echo Reply"); + break; + } + break; + + case L4_TCP: + // TCP packet + tcp_conn = false; + if (p->L4.TCPHeader->Flag & TCP_SYN || p->L4.TCPHeader->Flag & TCP_RST || p->L4.TCPHeader->Flag & TCP_FIN) + { + tcp_conn = true; + } + t->Token[6] = CopyStr(tcp_conn ? "TCP_CONNECTv4" : "TCP_DATAv4"); + t->Token[7] = TcpFlagStr(p->L4.TCPHeader->Flag); + + t->Token[9] = PortStr(pl->Cedar, Endian16(p->L4.TCPHeader->SrcPort), false); + t->Token[11] = PortStr(pl->Cedar, Endian16(p->L4.TCPHeader->DstPort), false); + + ToStr(tmp, Endian32(p->L4.TCPHeader->SeqNumber)); + t->Token[12] = CopyStr(tmp); + + ToStr(tmp, Endian32(p->L4.TCPHeader->AckNumber)); + t->Token[13] = CopyStr(tmp); + + snprintf(tmp, sizeof(tmp), "WindowSize=%u", Endian16(p->L4.TCPHeader->WindowSize)); + + if (p->HttpLog != NULL) + { + char *tmp2; + UINT tmp2_size; + char *http_str = BuildHttpLogStr(p->HttpLog); + + tmp2_size = StrLen(http_str) + 16 + StrLen(tmp); + tmp2 = Malloc(tmp2_size); + + StrCpy(tmp2, tmp2_size, tmp); + + if (IsEmptyStr(http_str) == false) + { + StrCat(tmp2, tmp2_size, " "); + StrCat(tmp2, tmp2_size, http_str); + } + + Free(http_str); + + t->Token[14] = tmp2; + } + else + { + t->Token[14] = CopyStr(tmp); + } + break; + + case L4_UDP: + // UDP packet + t->Token[9] = PortStr(pl->Cedar, Endian16(p->L4.UDPHeader->SrcPort), true); + t->Token[11] = PortStr(pl->Cedar, Endian16(p->L4.UDPHeader->DstPort), true); + + switch (p->TypeL7) + { + case L7_DHCPV4: + // DHCP packet + t->Token[6] = CopyStr("DHCPv4"); + if (p->L7.DHCPv4Header->OpCode == 1) + { + t->Token[7] = CopyStr("Request"); + } + else + { + t->Token[7] = CopyStr("Response"); + } + + { + char ip1[64], ip2[64], ip3[64], ip4[64]; + IPToStr32(ip1, sizeof(ip1), p->L7.DHCPv4Header->ClientIP); + IPToStr32(ip2, sizeof(ip2), p->L7.DHCPv4Header->YourIP); + IPToStr32(ip3, sizeof(ip3), p->L7.DHCPv4Header->ServerIP); + IPToStr32(ip4, sizeof(ip4), p->L7.DHCPv4Header->RelayIP); + + snprintf(tmp, sizeof(tmp), + "TransactionId=%u ClientIP=%s YourIP=%s ServerIP=%s RelayIP=%s", + Endian32(p->L7.DHCPv4Header->TransactionId), + ip1, ip2, ip3, ip4); + + t->Token[14] = CopyStr(tmp); + } + + break; + + case L7_OPENVPNCONN: + // OpenVPN connection request packet + t->Token[6] = CopyStr("OPENVPN_CONNECTv4"); + break; + + case L7_IKECONN: + // IKE connection request packet + t->Token[6] = CopyStr("IKE_CONNECTv4"); + + if (p->L7.IkeHeader != NULL) + { + if (p->L7.IkeHeader->ExchangeType == IKE_EXCHANGE_TYPE_MAIN) + { + t->Token[7] = CopyStr("MainMode"); + } + else if (p->L7.IkeHeader->ExchangeType == IKE_EXCHANGE_TYPE_AGGRESSIVE) + { + t->Token[7] = CopyStr("AggressiveMode"); + } + + { + Format(tmp, sizeof(tmp), "InitiatorCookie=%I64u ResponderCookie=%I64u " + "Version=0x%x ExchangeType=0x%x Flag=0x%x MessageId=%u MessageSize=%u", + Endian64(p->L7.IkeHeader->InitiatorCookie), + Endian64(p->L7.IkeHeader->ResponderCookie), + p->L7.IkeHeader->Version, + p->L7.IkeHeader->ExchangeType, + p->L7.IkeHeader->Flag, + Endian32(p->L7.IkeHeader->MessageId), + Endian32(p->L7.IkeHeader->MessageSize)); + + t->Token[14] = CopyStr(tmp); + } + } + break; + + case L7_DNS: + // DNS query + t->Token[6] = CopyStr("DNSv4"); + t->Token[7] = CopyStr("DNS_Query"); + t->Token[14] = CopyStr(p->DnsQueryHost); + break; + + default: + // Unknown Packet + t->Token[6] = CopyStr("UDPv4"); + break; + } + break; + + case L4_FRAGMENT: + // Fragment + snprintf(tmp, sizeof(tmp), "IPv4_Fragment(0x%02X)", p->L3.IPv4Header->Protocol); + t->Token[6] = CopyStr(tmp); + break; + + case L4_UNKNOWN: + // Unknown Packet + snprintf(tmp, sizeof(tmp), "IPv4(0x%02X)", p->L3.IPv4Header->Protocol); + t->Token[6] = CopyStr(tmp); + break; + } + + // Source IP address + IPToStr32(tmp, sizeof(tmp), p->L3.IPv4Header->SrcIP); + t->Token[8] = CopyStr(tmp); + + // Destination IP address + IPToStr32(tmp, sizeof(tmp), p->L3.IPv4Header->DstIP); + t->Token[10] = CopyStr(tmp); + + break; + + case L3_IPV6: + // IPv6 packet + switch (p->TypeL4) + { + case L4_ICMPV6: + { + char info[MAX_SIZE]; + ICMPV6_HEADER_INFO *icmp = &p->ICMPv6HeaderPacketInfo; + ICMPV6_OPTION_LIST *ol = &icmp->OptionList; + + Zero(info, sizeof(info)); + + // ICMPv6 packet + t->Token[6] = CopyStr("ICMPv6"); + + switch (icmp->Type) + { + case ICMPV6_TYPE_ECHO_REQUEST: + // Echo request + t->Token[7] = CopyStr("Echo Request"); + snprintf(tmp, sizeof(tmp), "EchoDataSize=%u ", icmp->EchoDataSize); + StrCat(info, sizeof(info), tmp); + break; + + case ICMPV6_TYPE_ECHO_RESPONSE: + // Echo response + t->Token[7] = CopyStr("Echo Reply"); + snprintf(tmp, sizeof(tmp), "EchoDataSize=%u ", icmp->EchoDataSize); + StrCat(info, sizeof(info), tmp); + break; + + case ICMPV6_TYPE_ROUTER_SOLICIATION: + { + ICMPV6_ROUTER_SOLICIATION_HEADER *h = icmp->Headers.RouterSoliciationHeader; + // Router Solicitation + t->Token[7] = CopyStr("Router Soliciation"); + + if (h != NULL) + { + // No additional information + } + } + break; + + case ICMPV6_TYPE_ROUTER_ADVERTISEMENT: + { + ICMPV6_ROUTER_ADVERTISEMENT_HEADER *h = icmp->Headers.RouterAdvertisementHeader; + // Router Advertisement + t->Token[7] = CopyStr("Router Advertisement"); + + if (h != NULL) + { + snprintf(tmp, sizeof(tmp), "CurHopLimit=%u " + "Flags=0x%02X Lifetime=%u ", + h->CurHopLimit, h->Flags, Endian16(h->Lifetime)); + StrCat(info, sizeof(info), tmp); + } + } + break; + + case ICMPV6_TYPE_NEIGHBOR_SOLICIATION: + { + ICMPV6_NEIGHBOR_SOLICIATION_HEADER *h = icmp->Headers.NeighborSoliciationHeader; + // Neighbor Solicitation + t->Token[7] = CopyStr("Neighbor Soliciation"); + + if (h != NULL) + { + char tmp2[MAX_SIZE]; + + IP6AddrToStr(tmp2, sizeof(tmp2), &h->TargetAddress); + + snprintf(tmp, sizeof(tmp), "TargetAddress=%s ", + tmp2); + StrCat(info, sizeof(info), tmp); + } + } + break; + + case ICMPV6_TYPE_NEIGHBOR_ADVERTISEMENT: + { + ICMPV6_NEIGHBOR_ADVERTISEMENT_HEADER *h = icmp->Headers.NeighborAdvertisementHeader; + // Neighbor Advertisement + t->Token[7] = CopyStr("Neighbor Advertisement"); + + if (h != NULL) + { + char tmp2[MAX_SIZE]; + + IP6AddrToStr(tmp2, sizeof(tmp2), &h->TargetAddress); + + snprintf(tmp, sizeof(tmp), "TargetAddress=%s Flags=0x%02X ", + tmp2, h->Flags); + StrCat(info, sizeof(info), tmp); + } + } + break; + + default: + { + snprintf(tmp, sizeof(tmp), "Type=%u", icmp->Type); + t->Token[7] = CopyStr(tmp); + } + break; + } + + // Option data + if (ol->SourceLinkLayer != NULL) + { + char tmp2[MAX_SIZE]; + BinToStr(tmp2, sizeof(tmp2), ol->SourceLinkLayer->Address, 6); + snprintf(tmp, sizeof(tmp), "SourceLinkLayer=%s ", tmp2); + StrCat(info, sizeof(info), tmp); + } + if (ol->TargetLinkLayer != NULL) + { + char tmp2[MAX_SIZE]; + BinToStr(tmp2, sizeof(tmp2), ol->TargetLinkLayer->Address, 6); + snprintf(tmp, sizeof(tmp), "TargetLinkLayer=%s ", tmp2); + StrCat(info, sizeof(info), tmp); + } + for (i = 0; i < ICMPV6_OPTION_PREFIXES_MAX_COUNT; i++) + { + if (ol->Prefix[i] != NULL) + { + char tmp2[MAX_SIZE]; + IP6AddrToStr(tmp2, sizeof(tmp2), &ol->Prefix[i]->Prefix); + snprintf(tmp, sizeof(tmp), "Prefix=%s/%u PrefixFlag=0x%02X ", tmp2, + ol->Prefix[i]->SubnetLength, ol->Prefix[i]->Flags); + StrCat(info, sizeof(info), tmp); + } + else + { + break; + } + } + if (ol->Mtu != NULL) + { + snprintf(tmp, sizeof(tmp), "Mtu=%u ", Endian32(ol->Mtu->Mtu)); + StrCat(info, sizeof(info), tmp); + } + + Trim(info); + + if (IsEmptyStr(info) == false) + { + t->Token[14] = CopyStr(info); + } + } + break; + + case L4_TCP: + // TCP packet + tcp_conn = false; + if (p->L4.TCPHeader->Flag & TCP_SYN || p->L4.TCPHeader->Flag & TCP_RST || p->L4.TCPHeader->Flag & TCP_FIN) + { + tcp_conn = true; + } + t->Token[6] = CopyStr(tcp_conn ? "TCP_CONNECTv6" : "TCP_DATAv6"); + t->Token[7] = TcpFlagStr(p->L4.TCPHeader->Flag); + + t->Token[9] = PortStr(pl->Cedar, Endian16(p->L4.TCPHeader->SrcPort), false); + t->Token[11] = PortStr(pl->Cedar, Endian16(p->L4.TCPHeader->DstPort), false); + + ToStr(tmp, Endian32(p->L4.TCPHeader->SeqNumber)); + t->Token[12] = CopyStr(tmp); + + ToStr(tmp, Endian32(p->L4.TCPHeader->AckNumber)); + t->Token[13] = CopyStr(tmp); + + snprintf(tmp, sizeof(tmp), "WindowSize=%u", Endian16(p->L4.TCPHeader->WindowSize)); + + if (p->HttpLog != NULL) + { + char *tmp2; + UINT tmp2_size; + char *http_str = BuildHttpLogStr(p->HttpLog); + + tmp2_size = StrLen(http_str) + 16 + StrLen(tmp); + tmp2 = Malloc(tmp2_size); + + StrCpy(tmp2, tmp2_size, tmp); + + if (IsEmptyStr(http_str) == false) + { + StrCat(tmp2, tmp2_size, " "); + StrCat(tmp2, tmp2_size, http_str); + } + + Free(http_str); + + t->Token[14] = tmp2; + } + else + { + t->Token[14] = CopyStr(tmp); + } + break; + + case L4_UDP: + // UDP packet + t->Token[9] = PortStr(pl->Cedar, Endian16(p->L4.UDPHeader->SrcPort), true); + t->Token[11] = PortStr(pl->Cedar, Endian16(p->L4.UDPHeader->DstPort), true); + + switch (p->TypeL7) + { + case L7_OPENVPNCONN: + // OpenVPN connection request packet + t->Token[6] = CopyStr("OPENVPN_CONNECTv6"); + break; + + case L7_IKECONN: + // IKE connection request packet + t->Token[6] = CopyStr("IKE_CONNECTv6"); + + if (p->L7.IkeHeader != NULL) + { + if (p->L7.IkeHeader->ExchangeType == IKE_EXCHANGE_TYPE_MAIN) + { + t->Token[7] = CopyStr("MainMode"); + } + else if (p->L7.IkeHeader->ExchangeType == IKE_EXCHANGE_TYPE_AGGRESSIVE) + { + t->Token[7] = CopyStr("AggressiveMode"); + } + + { + Format(tmp, sizeof(tmp), "InitiatorCookie=%I64u ResponderCookie=%I64u " + "Version=0x%x ExchangeType=0x%x Flag=0x%x MessageId=%u MessageSize=%u", + Endian64(p->L7.IkeHeader->InitiatorCookie), + Endian64(p->L7.IkeHeader->ResponderCookie), + p->L7.IkeHeader->Version, + p->L7.IkeHeader->ExchangeType, + p->L7.IkeHeader->Flag, + Endian32(p->L7.IkeHeader->MessageId), + Endian32(p->L7.IkeHeader->MessageSize)); + + t->Token[14] = CopyStr(tmp); + } + } + break; + + case L7_DNS: + // DNS query + t->Token[6] = CopyStr("DNSv6"); + t->Token[7] = CopyStr("DNS_Query"); + t->Token[14] = CopyStr(p->DnsQueryHost); + break; + + default: + t->Token[6] = CopyStr("UDPv6"); + break; + } + break; + + case L4_FRAGMENT: + // Fragment packet + snprintf(tmp, sizeof(tmp), "IPv6_Fragment(0x%02X)", p->IPv6HeaderPacketInfo.Protocol); + t->Token[6] = CopyStr(tmp); + break; + + case L4_UNKNOWN: + // Unknown Packet + snprintf(tmp, sizeof(tmp), "IPv6(0x%02X)", p->IPv6HeaderPacketInfo.Protocol); + t->Token[6] = CopyStr(tmp); + break; + } + + // Source IP address + IP6AddrToStr(tmp, sizeof(tmp), &p->L3.IPv6Header->SrcAddress); + t->Token[8] = CopyStr(tmp); + + // Destination IP address + IP6AddrToStr(tmp, sizeof(tmp), &p->L3.IPv6Header->DestAddress); + t->Token[10] = CopyStr(tmp); + + break; + + case L3_UNKNOWN: + // Unknown Packet + snprintf(tmp, sizeof(tmp), "Proto=0x%04X", Endian16(p->MacHeader->Protocol)); + t->Token[6] = CopyStr(tmp); + break; + } + + if (p->PacketData != NULL && (pl->PurePacket == false || pl->PurePacketNoPayload == false)) + { + char *data = Malloc(p->PacketSize * 2 + 1); + BinToStr(data, p->PacketSize * 2 + 1, p->PacketData, p->PacketSize); + t->Token[15] = data; + } + + // Physical IP addresses + if (StrLen(pl->SrcPhysicalIP) != 0) + { + t->Token[16] = CopyStr(pl->SrcPhysicalIP); + } + if (StrLen(pl->DestPhysicalIP) != 0) + { + t->Token[17] = CopyStr(pl->DestPhysicalIP); + } + } + else + { + t->Token[6] = CopyUniToUtf(_UU("LH_PACKET_LOG_NO_LOG_OSS")); + } + + s = GenCsvLine(t); + FreeToken(t); + + // Discard the packet data + if (pl->PurePacket == false) + { + FreeClonePacket(p); + } + else + { + Free(p->PacketData); + FreePacket(p); + } + + // Release the session + if (pl->SrcSession != NULL) + { + Dec(pl->SrcSession->LoggingRecordCount); + ReleaseSession(pl->SrcSession); + } + Free(pl); + + return s; +} + +// Convert TCP flags to a string +char *TcpFlagStr(UCHAR flag) +{ + char tmp[MAX_SIZE]; + StrCpy(tmp, sizeof(tmp), ""); + + if (flag & TCP_FIN) + { + StrCat(tmp, sizeof(tmp), "FIN+"); + } + + if (flag & TCP_SYN) + { + StrCat(tmp, sizeof(tmp), "SYN+"); + } + + if (flag & TCP_RST) + { + StrCat(tmp, sizeof(tmp), "RST+"); + } + + if (flag & TCP_PSH) + { + StrCat(tmp, sizeof(tmp), "PSH+"); + } + + if (flag & TCP_ACK) + { + StrCat(tmp, sizeof(tmp), "ACK+"); + } + + if (flag & TCP_URG) + { + StrCat(tmp, sizeof(tmp), "URG+"); + } + + if (StrLen(tmp) >= 1) + { + if (tmp[StrLen(tmp) - 1] == '+') + { + tmp[StrLen(tmp) - 1] = 0; + } + } + + return CopyStr(tmp); +} + +// Generate a port string +char *PortStr(CEDAR *cedar, UINT port, bool udp) +{ + char tmp[MAX_SIZE]; + char *name; + // Validate arguments + if (cedar == NULL) + { + return NULL; + } + + name = GetSvcName(cedar, udp, port); + + if (name == NULL) + { + snprintf(tmp, sizeof(tmp), "%u", port); + } + else + { + snprintf(tmp, sizeof(tmp), "%s(%u)", name, port); + } + + return CopyStr(tmp); +} + +// Generate a comma-separated string +char *GenCsvLine(TOKEN_LIST *t) +{ + UINT i; + BUF *b; + char *ret; + // Validate arguments + if (t == NULL) + { + return NULL; + } + + b = NewBuf(); + for (i = 0; i < t->NumTokens; i++) + { + if (t->Token[i] != NULL) + { + ReplaceForCsv(t->Token[i]); + if (StrLen(t->Token[i]) == 0) + { + WriteBuf(b, "-", 1); + } + else + { + WriteBuf(b, t->Token[i], StrLen(t->Token[i])); + } + } + else + { + WriteBuf(b, "-", 1); + } + if (i != (t->NumTokens - 1)) + { + WriteBuf(b, ",", 1); + } + } + WriteBuf(b, "\0", 1); + + ret = (char *)b->Buf; + + Free(b); + + return ret; +} + +// Replace the strings in the CSV correctly +void ReplaceForCsv(char *str) +{ + UINT i, len; + // Validate arguments + if (str == NULL) + { + return; + } + + len = StrLen(str); + + for (i = 0; i < len; i++) + { + // Convert the comma to underscore + if (str[i] == ',') + { + str[i] = '_'; + } + } +} + +// Set the switch type of log +void SetLogSwitchType(LOG *g, UINT switch_type) +{ + // Validate arguments + if (g == NULL) + { + return; + } + + LockLog(g); + { + g->SwitchType = switch_type; + } + UnlockLog(g); +} + +// Parse the string record +char *StringRecordParseProc(RECORD *rec) +{ + // Validate arguments + if (rec == NULL) + { + return NULL; + } + + return (char *)rec->Data; +} + +// Add an Unicode string record in the log +void InsertUnicodeRecord(LOG *g, wchar_t *unistr) +{ + char *str; + UINT size; + // Validate arguments + if (g == NULL || unistr == NULL) + { + return; + } + + size = CalcUniToUtf8(unistr) + 32; + str = ZeroMalloc(size); + + UniToUtf8((BYTE *)str, size, unistr); + InsertStringRecord(g, str); + Free(str); +} + +// Add a string record to the log +void InsertStringRecord(LOG *g, char *str) +{ + char *str_copy; + // Validate arguments + if (g == NULL || str == NULL) + { + return; + } + + str_copy = CopyStr(str); + + InsertRecord(g, str_copy, StringRecordParseProc); +} + +// Add a record to the log +void InsertRecord(LOG *g, void *data, RECORD_PARSE_PROC *proc) +{ + RECORD *rec; + // Validate arguments + if (g == NULL || data == NULL || proc == NULL) + { + return; + } + + rec = ZeroMalloc(sizeof(RECORD)); + rec->Tick = Tick64(); + rec->ParseProc = proc; + rec->Data = data; + + LockQueue(g->RecordQueue); + { + InsertQueue(g->RecordQueue, rec); + } + UnlockQueue(g->RecordQueue); + + Set(g->Event); +} + +// Lock the log +void LockLog(LOG *g) +{ + // Validate arguments + if (g == NULL) + { + return; + } + + Lock(g->lock); +} + +// Unlock the log +void UnlockLog(LOG *g) +{ + // Validate arguments + if (g == NULL) + { + return; + } + + Unlock(g->lock); +} + +// Generate the string portion of the log file name from the time and the switching rule +void MakeLogFileNameStringFromTick(LOG *g, char *str, UINT size, UINT64 tick, UINT switch_type) +{ + UINT64 time; + SYSTEMTIME st; + + // Validate arguments + if (str == NULL || g == NULL) + { + return; + } + + if (g->CacheFlag) + { + if (g->LastTick == tick && + g->LastSwitchType == switch_type) + { + StrCpy(str, size, g->LastStr); + return; + } + } + + time = TickToTime(tick); + UINT64ToSystem(&st, SystemToLocal64(time)); + + switch (switch_type) + { + case LOG_SWITCH_SECOND: // Secondly basis + snprintf(str, size, "_%04u%02u%02u_%02u%02u%02u", + st.wYear, st.wMonth, st.wDay, st.wHour, st.wMinute, st.wSecond); + break; + + case LOG_SWITCH_MINUTE: // Minutely basis + snprintf(str, size, "_%04u%02u%02u_%02u%02u", + st.wYear, st.wMonth, st.wDay, st.wHour, st.wMinute); + break; + + case LOG_SWITCH_HOUR: // Hourly basis + snprintf(str, size, "_%04u%02u%02u_%02u", st.wYear, st.wMonth, st.wDay, st.wHour); + break; + + case LOG_SWITCH_DAY: // Daily basis + snprintf(str, size, "_%04u%02u%02u", st.wYear, st.wMonth, st.wDay); + break; + + case LOG_SWITCH_MONTH: // Monthly basis + snprintf(str, size, "_%04u%02u", st.wYear, st.wMonth); + break; + + default: // Without switching + StrCpy(str, size, ""); + break; + } + + g->CacheFlag = true; + g->LastTick = tick; + g->LastSwitchType = switch_type; + StrCpy(g->LastStr, sizeof(g->LastStr), str); +} + +// Create a log file name +bool MakeLogFileName(LOG *g, char *name, UINT size, char *dir, char *prefix, UINT64 tick, UINT switch_type, UINT num, char *old_datestr) +{ + char tmp[MAX_SIZE]; + char tmp2[64]; + bool ret = false; + // Validate arguments + if (g == NULL || name == NULL || prefix == NULL || old_datestr == NULL) + { + return false; + } + + MakeLogFileNameStringFromTick(g, tmp, sizeof(tmp), tick, switch_type); + + if (num == 0) + { + tmp2[0] = 0; + } + else + { + UINT64 max_log_size = GetMaxLogSize(); + if (max_log_size == MAX_LOG_SIZE_DEFAULT) + { + snprintf(tmp2, sizeof(tmp2), "~%02u", num); + } + else + { + char tag[32]; + char c = '2'; + if (max_log_size >= 1000000000ULL) + { + c = '3'; + } + else if (max_log_size >= 100000000ULL) + { + c = '4'; + } + else if (max_log_size >= 10000000ULL) + { + c = '5'; + } + else if (max_log_size >= 1000000ULL) + { + c = '6'; + } + else if (max_log_size >= 100000ULL) + { + c = '7'; + } + else if (max_log_size >= 10000ULL) + { + c = '8'; + } + else if (max_log_size >= 1000ULL) + { + c = '9'; + } + + StrCpy(tag, sizeof(tag), "~%02u"); + tag[3] = c; + + snprintf(tmp2, sizeof(tmp2), tag, num); + } + } + + if (strcmp(old_datestr, tmp) != 0) + { + ret = true; + StrCpy(old_datestr, MAX_SIZE, tmp); + } + + snprintf(name, size, "%s%s%s%s%s.log", dir, + StrLen(dir) == 0 ? "" : "/", + prefix, tmp, tmp2 + ); + + return ret; +} + +// Wait until the log have been flushed +void WaitLogFlush(LOG *g) +{ + // Validate arguments + if (g == NULL) + { + return; + } + + while (true) + { + UINT num; + LockQueue(g->RecordQueue); + { + num = g->RecordQueue->num_item; + } + UnlockQueue(g->RecordQueue); + + if (num == 0) + { + break; + } + + Wait(g->FlushEvent, 100); + } +} + +// Set the max log size +void SetMaxLogSize(UINT64 size) +{ + if (size == 0) + { + size = MAX_LOG_SIZE_DEFAULT; + } + + logger_max_log_size = size; +} + +// Get the max log size +UINT64 GetMaxLogSize() +{ + UINT64 ret = logger_max_log_size; + + if (ret == 0) + { + ret = MAX_LOG_SIZE_DEFAULT; + } + + return ret; +} + +// Logging thread +void LogThread(THREAD *thread, void *param) +{ + LOG *g; + IO *io; + BUF *b; + bool flag = false; + char current_file_name[MAX_SIZE]; + char current_logfile_datename[MAX_SIZE]; + bool log_date_changed = false; + // Validate arguments + if (thread == NULL || param == NULL) + { + return; + } + + Zero(current_file_name, sizeof(current_file_name)); + Zero(current_logfile_datename, sizeof(current_logfile_datename)); + + g = (LOG *)param; + + io = g_foreground ? GetIO4Stdout() : NULL; + b = NewBuf(); + +#ifdef OS_WIN32 + + // Lower priority to bottom + MsSetThreadPriorityIdle(); + +#endif // OS_WIN32 + + NoticeThreadInit(thread); + + while (true) + { + UINT64 s = Tick64(); + + while (true) + { + if (g_foreground) + { + if (! LogThreadWriteStdout(g, b, io)) + { + break; + } + } + else + { + if (! LogThreadWriteGeneral(g, b, &io, &log_date_changed, current_logfile_datename, current_file_name)) + { + break; + } + } + } + + if (g->Halt) + { + // Break after finishing to save all records + // when the stop flag stood + UINT num; + + if (flag == false) + { +#ifdef OS_WIN32 + MsSetThreadPriorityRealtime(); +#endif // OS_WIN32 + flag = true; + } + + LockQueue(g->RecordQueue); + { + num = g->RecordQueue->num_item; + } + UnlockQueue(g->RecordQueue); + + if (num == 0 || io == NULL) + { + break; + } + } + else + { + Wait(g->Event, 9821); + } + } + + if (io != NULL && !g_foreground) + { + FileCloseEx(io, true); + } + + FreeBuf(b); +} + +static bool LogThreadWriteGeneral(LOG *log_object, BUF *buffer, IO **io, bool *log_date_changed, char *current_logfile_datename, char *current_file_name) +{ + RECORD *rec; + char file_name[MAX_SIZE]; + UINT num; + + // Retrieve a record from the head of the queue + LockQueue(log_object->RecordQueue); + { + rec = GetNext(log_object->RecordQueue); + num = log_object->RecordQueue->num_item; + } + UnlockQueue(log_object->RecordQueue); + +#ifdef OS_WIN32 + if (num >= LOG_ENGINE_SAVE_START_CACHE_COUNT) + { + // Raise the priority + Debug("LOG_THREAD: MsSetThreadPriorityRealtime\n"); + MsSetThreadPriorityRealtime(); + } + + if (num < (LOG_ENGINE_SAVE_START_CACHE_COUNT / 2)) + { + // Restore the priority + Debug("LOG_THREAD: MsSetThreadPriorityIdle\n"); + MsSetThreadPriorityIdle(); + } +#endif // OS_WIN32 + + if (buffer->Size > GetMaxLogSize()) + { + // Erase if the size of the buffer is larger than the maximum log file size + ClearBuf(buffer); + } + + if (buffer->Size >= LOG_ENGINE_BUFFER_CACHE_SIZE_MAX) + { + // Write the contents of the buffer to the file + if (*io != NULL) + { + if ((log_object->CurrentFilePointer + (UINT64)buffer->Size) > GetMaxLogSize()) + { + if (log_object->log_number_incremented == false) + { + log_object->CurrentLogNumber++; + log_object->log_number_incremented = true; + } + } + else + { + if (FileWrite(*io, buffer->Buf, buffer->Size) == false) + { + FileCloseEx(*io, true); + // If it fails to write to the file, + // erase the buffer and give up + ClearBuf(buffer); + *io = NULL; + } + else + { + log_object->CurrentFilePointer += (UINT64)buffer->Size; + ClearBuf(buffer); + } + } + } + } + + if (rec == NULL) + { + if (buffer->Size != 0) + { + // Write the contents of the buffer to the file + if (*io != NULL) + { + if ((log_object->CurrentFilePointer + (UINT64)buffer->Size) > GetMaxLogSize()) + { + if (log_object->log_number_incremented == false) + { + log_object->CurrentLogNumber++; + log_object->log_number_incremented = true; + } + } + else + { + if (FileWrite(*io, buffer->Buf, buffer->Size) == false) + { + FileCloseEx(*io, true); + // If it fails to write to the file, + // erase the buffer and give up + ClearBuf(buffer); + *io = NULL; + } + else + { + log_object->CurrentFilePointer += (UINT64)buffer->Size; + ClearBuf(buffer); + } + } + } + } + + Set(log_object->FlushEvent); + return false; + } + + // Generate a log file name + LockLog(log_object); + { + *log_date_changed = MakeLogFileName(log_object, file_name, sizeof(file_name), + log_object->DirName, log_object->Prefix, rec->Tick, log_object->SwitchType, log_object->CurrentLogNumber, current_logfile_datename); + + if (*log_date_changed) + { + UINT i; + + log_object->CurrentLogNumber = 0; + MakeLogFileName(log_object, file_name, sizeof(file_name), + log_object->DirName, log_object->Prefix, rec->Tick, log_object->SwitchType, 0, current_logfile_datename); + for (i = 0;; i++) + { + char tmp[MAX_SIZE]; + MakeLogFileName(log_object, tmp, sizeof(tmp), + log_object->DirName, log_object->Prefix, rec->Tick, log_object->SwitchType, i, current_logfile_datename); + + if (IsFileExists(tmp) == false) + { + break; + } + StrCpy(file_name, sizeof(file_name), tmp); + log_object->CurrentLogNumber = i; + } + } + } + UnlockLog(log_object); + + if (*io != NULL) + { + if (StrCmp(current_file_name, file_name) != 0) + { + // If a log file is currently opened and writing to another log + // file is needed for this time, write the contents of the + //buffer and close the log file. Write the contents of the buffer + if (*io != NULL) + { + if (*log_date_changed) + { + if ((log_object->CurrentFilePointer + (UINT64)buffer->Size) <= GetMaxLogSize()) + { + if (FileWrite(*io, buffer->Buf, buffer->Size) == false) + { + FileCloseEx(*io, true); + ClearBuf(buffer); + *io = NULL; + } + else + { + log_object->CurrentFilePointer += (UINT64)buffer->Size; + ClearBuf(buffer); + } + } + } + // Close the file + FileCloseEx(*io, true); + } + + log_object->log_number_incremented = false; + + // Open or create a new log file + StrCpy(current_file_name, sizeof(current_file_name), file_name); + *io = FileOpen(file_name, true); + if (*io == NULL) + { + // Create a log file + LockLog(log_object); + { + MakeDir(log_object->DirName); + +#ifdef OS_WIN32 + Win32SetFolderCompress(log_object->DirName, true); +#endif // OS_WIN32 + } + UnlockLog(log_object); + *io = FileCreate(file_name); + log_object->CurrentFilePointer = 0; + } + else + { + // Seek to the end of the log file + log_object->CurrentFilePointer = FileSize64(*io); + FileSeek(*io, SEEK_END, 0); + } + } + } + else + { + // Open or create a new log file + StrCpy(current_file_name, sizeof(current_file_name), file_name); + *io = FileOpen(file_name, true); + if (*io == NULL) + { + // Create a log file + LockLog(log_object); + { + MakeDir(log_object->DirName); +#ifdef OS_WIN32 + Win32SetFolderCompress(log_object->DirName, true); +#endif // OS_WIN32 + } + UnlockLog(log_object); + *io = FileCreate(file_name); + log_object->CurrentFilePointer = 0; + if (*io == NULL) + { + //Debug("Logging.c: SleepThread(30);\n"); + SleepThread(30); + } + } + else + { + // Seek to the end of the log file + log_object->CurrentFilePointer = FileSize64(*io); + FileSeek(*io, SEEK_END, 0); + } + + log_object->log_number_incremented = false; + } + + // Write the contents of the log to the buffer + WriteRecordToBuffer(buffer, rec); + + // Release the memory of record + Free(rec); + + return (*io != NULL); +} + +static bool LogThreadWriteStdout(LOG *log_object, BUF *buffer, IO *io) +{ + RECORD *rec; + + // Retrieve a record from the head of the queue + LockQueue(log_object->RecordQueue); + { + rec = GetNext(log_object->RecordQueue); + } + UnlockQueue(log_object->RecordQueue); + + if (rec == NULL) + { + Set(log_object->FlushEvent); + return false; + } + + ClearBuf(buffer); + WriteRecordToBuffer(buffer, rec); + if (!FileWrite(io, buffer->Buf, buffer->Size)) + { + ClearBuf(buffer); + } + Free(rec); + + return true; +} + +static IO *GetIO4Stdout() +{ +#ifndef UNIX + return NULL; +#else // UNIX + static IO IO4Stdout = + { + .Name = {0}, + .NameW = {0}, + .pData = NULL, + .WriteMode = true, + .HamMode = false, + .HamBuf = NULL, + }; + + if (!g_foreground) + { + return NULL; + } + + IO4Stdout.pData = GetUnixio4Stdout(); + + return &IO4Stdout; +#endif // UNIX +} + +// Write the contents of the log to the buffer +void WriteRecordToBuffer(BUF *b, RECORD *r) +{ + UINT64 time; + char time_str[MAX_SIZE]; + char date_str[MAX_SIZE]; + char *s; + // Validate arguments + if (b == NULL || r == NULL) + { + return; + } + + // Get the time + time = SystemToLocal64(TickToTime(r->Tick)); + + // Convert a time to a string + GetDateStr64(date_str, sizeof(date_str), time); + GetTimeStrMilli64(time_str, sizeof(time_str), time); + + if (r->ParseProc != PacketLogParseProc) + { + // Other than packet log + WriteBuf(b, date_str, StrLen(date_str)); + WriteBuf(b, " ", 1); + WriteBuf(b, time_str, StrLen(time_str)); + WriteBuf(b, " ", 1); + } + else + { + // Packet log + WriteBuf(b, date_str, StrLen(date_str)); + WriteBuf(b, ",", 1); + WriteBuf(b, time_str, StrLen(time_str)); + WriteBuf(b, ",", 1); + } + + // Output text + s = r->ParseProc(r); + WriteBuf(b, s, StrLen(s)); + Free(s); + + WriteBuf(b, "\r\n", 2); +} + +// End of logging +void FreeLog(LOG *g) +{ + RECORD *rec; + // Validate arguments + if (g == NULL) + { + return; + } + + // Halting flag + g->Halt = true; + Set(g->Event); + + WaitThread(g->Thread, INFINITE); + ReleaseThread(g->Thread); + + DeleteLock(g->lock); + Free(g->DirName); + Free(g->Prefix); + + // Release the unprocessed record if it remains + // (It should not remain here) + while (rec = GetNext(g->RecordQueue)) + { + char *s = rec->ParseProc(rec); + Free(s); + Free(rec); + } + ReleaseQueue(g->RecordQueue); + + ReleaseEvent(g->Event); + ReleaseEvent(g->FlushEvent); + + Free(g); +} + +// Start a new logging +LOG *NewLog(char *dir, char *prefix, UINT switch_type) +{ + LOG *g; + + g = ZeroMalloc(sizeof(LOG)); + g->lock = NewLock(); + g->DirName = CopyStr(dir == NULL ? "" : dir); + g->Prefix = CopyStr(prefix == NULL ? "log" : prefix); + g->SwitchType = switch_type; + g->RecordQueue = NewQueue(); + g->Event = NewEvent(); + g->FlushEvent = NewEvent(); + + g->Thread = NewThread(LogThread, g); + + WaitThreadInit(g->Thread); + + return g; +} + + diff --git a/src/Cedar/Logging.h b/src/Cedar/Logging.h index b59be053..27919599 100644 --- a/src/Cedar/Logging.h +++ b/src/Cedar/Logging.h @@ -1,165 +1,165 @@ -// SoftEther VPN Source Code - Developer Edition Master Branch -// Cedar Communication Module - - -// Logging.h -// Header of Logging.c - -#ifndef LOGGING_H -#define LOGGING_H - - -// Port number for HTTP monitoring -#define LOG_HTTP_PORT 80 - - -#define MAX_LOG_SIZE_DEFAULT 1073741823ULL - -typedef char *(RECORD_PARSE_PROC)(RECORD *rec); - -// Packet log structure -struct PACKET_LOG -{ - CEDAR *Cedar; - struct PKT *Packet; - char *SrcSessionName; - char *DestSessionName; - bool WritePhysicalIP; - char SrcPhysicalIP[64]; - char DestPhysicalIP[64]; - bool PurePacket; // Packet not cloned - bool PurePacketNoPayload; // Packet not cloned (without payload) - SESSION *SrcSession; - bool NoLog; // Not to write a log -}; - -// Log save options of the HUB -struct HUB_LOG -{ - bool SaveSecurityLog; // To save the security log - UINT SecurityLogSwitchType; // Switching type of security log - bool SavePacketLog; // To save the packet log - UINT PacketLogSwitchType; // Switching type of packet log - UINT PacketLogConfig[NUM_PACKET_LOG]; // Packet log settings -}; - -// Record -struct RECORD -{ - UINT64 Tick; // Time - RECORD_PARSE_PROC *ParseProc; // Parsing procedure - void *Data; // Data -}; - -// LOG object -struct LOG -{ - LOCK *lock; // Lock - THREAD *Thread; // Thread - char *DirName; // Destination directory name - char *Prefix; // File name - UINT SwitchType; // Switching type of log file - QUEUE *RecordQueue; // Record queue - volatile bool Halt; // Halting flag - EVENT *Event; // Event for Log - EVENT *FlushEvent; // Flash completion event - bool CacheFlag; - UINT64 LastTick; - UINT LastSwitchType; - char LastStr[MAX_SIZE]; - UINT64 CurrentFilePointer; // The current file pointer - UINT CurrentLogNumber; // Log file number of the current - bool log_number_incremented; -}; - - -// ERASER object -struct ERASER -{ - LOG *Log; // Logger - UINT64 MinFreeSpace; // Disk space to start deleting files - char *DirName; // Directory name - volatile bool Halt; // Halting flag - THREAD *Thread; // Thread - bool LastFailed; // Whether deletion of the file failed at the end - EVENT *HaltEvent; // Halting event -}; - -// List of files that can be deleted -typedef struct ERASE_FILE -{ - char *FullPath; // Full path - UINT64 UpdateTime; // Updating date -} ERASE_FILE; - -// SYSLOG object -struct SLOG -{ - LOCK *lock; // Lock - SOCK *Udp; // UDP socket - IP DestIp; // Destination IP address - UINT DestPort; // Destination port number - char HostName[MAX_HOST_NAME_LEN + 1]; // Host name - UINT64 NextPollIp; // Time of examination of the IP address at the end -}; - -// Function prototype -LOG *NewLog(char *dir, char *prefix, UINT switch_type); -void FreeLog(LOG *g); -void LogThread(THREAD *thread, void *param); -void WaitLogFlush(LOG *g); -void LockLog(LOG *g); -void UnlockLog(LOG *g); -void InsertRecord(LOG *g, void *data, RECORD_PARSE_PROC *proc); -void InsertStringRecord(LOG *g, char *str); -void InsertUnicodeRecord(LOG *g, wchar_t *unistr); -char *StringRecordParseProc(RECORD *rec); -bool MakeLogFileName(LOG *g, char *name, UINT size, char *dir, char *prefix, UINT64 tick, UINT switch_type, UINT num, char *old_datestr); -void MakeLogFileNameStringFromTick(LOG *g, char *str, UINT size, UINT64 tick, UINT switch_type); -void WriteRecordToBuffer(BUF *b, RECORD *r); -void SetLogSwitchType(LOG *g, UINT switch_type); -bool PacketLog(HUB *hub, SESSION *src_session, SESSION *dest_session, PKT *packet, UINT64 now); -char *PacketLogParseProc(RECORD *rec); -UINT CalcPacketLoggingLevel(HUB *hub, PKT *packet); -UINT CalcPacketLoggingLevelEx(HUB_LOG *g, PKT *packet); -char *GenCsvLine(TOKEN_LIST *t); -void ReplaceForCsv(char *str); -char *PortStr(CEDAR *cedar, UINT port, bool udp); -char *TcpFlagStr(UCHAR flag); -void SiSetDefaultLogSetting(HUB_LOG *g); -void DebugLog(CEDAR *c, char *fmt, ...); -void SLog(CEDAR *c, char *name, ...); -void WriteHubLog(HUB *h, wchar_t *str); -void HLog(HUB *h, char *name, ...); -void NLog(VH *v, char *name, ...); -void PPPLog(PPP_SESSION *p, char *name, ...); -void IPsecLog(IKE_SERVER *ike, IKE_CLIENT *c, IKE_SA *ike_sa, IPSECSA *ipsec_sa, char *name, ...); -void EtherIPLog(ETHERIP_SERVER *s, char *name, ...); -void WriteServerLog(CEDAR *c, wchar_t *str); -void ALog(ADMIN *a, HUB *h, char *name, ...); -void CLog(CLIENT *c, char *name, ...); -void WriteClientLog(CLIENT *c, wchar_t *str); -ERASER *NewEraser(LOG *log, UINT64 min_size); -void FreeEraser(ERASER *e); -void ELog(ERASER *e, char *name, ...); -void EraserThread(THREAD *t, void *p); -void EraserMain(ERASER *e); -bool CheckEraserDiskFreeSpace(ERASER *e); -int CompareEraseFile(void *p1, void *p2); -LIST *GenerateEraseFileList(ERASER *e); -void FreeEraseFileList(LIST *o); -void EnumEraseFile(LIST *o, char *dirname); -SLOG *NewSysLog(char *hostname, UINT port, IP *ip); -void SetSysLog(SLOG *g, char *hostname, UINT port); -void FreeSysLog(SLOG *g); -void SendSysLog(SLOG *g, wchar_t *str); -char *BuildHttpLogStr(HTTPLOG *h); -void MakeSafeLogStr(char *str); -void AddLogBufToStr(BUF *b, char *name, char *value); -void SetEraserCheckInterval(UINT interval); -UINT GetEraserCheckInterval(); -void SetMaxLogSize(UINT64 size); -UINT64 GetMaxLogSize(); - -#endif // LOGGING_G - +// SoftEther VPN Source Code - Developer Edition Master Branch +// Cedar Communication Module + + +// Logging.h +// Header of Logging.c + +#ifndef LOGGING_H +#define LOGGING_H + + +// Port number for HTTP monitoring +#define LOG_HTTP_PORT 80 + + +#define MAX_LOG_SIZE_DEFAULT 1073741823ULL + +typedef char *(RECORD_PARSE_PROC)(RECORD *rec); + +// Packet log structure +struct PACKET_LOG +{ + CEDAR *Cedar; + struct PKT *Packet; + char *SrcSessionName; + char *DestSessionName; + bool WritePhysicalIP; + char SrcPhysicalIP[64]; + char DestPhysicalIP[64]; + bool PurePacket; // Packet not cloned + bool PurePacketNoPayload; // Packet not cloned (without payload) + SESSION *SrcSession; + bool NoLog; // Not to write a log +}; + +// Log save options of the HUB +struct HUB_LOG +{ + bool SaveSecurityLog; // To save the security log + UINT SecurityLogSwitchType; // Switching type of security log + bool SavePacketLog; // To save the packet log + UINT PacketLogSwitchType; // Switching type of packet log + UINT PacketLogConfig[NUM_PACKET_LOG]; // Packet log settings +}; + +// Record +struct RECORD +{ + UINT64 Tick; // Time + RECORD_PARSE_PROC *ParseProc; // Parsing procedure + void *Data; // Data +}; + +// LOG object +struct LOG +{ + LOCK *lock; // Lock + THREAD *Thread; // Thread + char *DirName; // Destination directory name + char *Prefix; // File name + UINT SwitchType; // Switching type of log file + QUEUE *RecordQueue; // Record queue + volatile bool Halt; // Halting flag + EVENT *Event; // Event for Log + EVENT *FlushEvent; // Flash completion event + bool CacheFlag; + UINT64 LastTick; + UINT LastSwitchType; + char LastStr[MAX_SIZE]; + UINT64 CurrentFilePointer; // The current file pointer + UINT CurrentLogNumber; // Log file number of the current + bool log_number_incremented; +}; + + +// ERASER object +struct ERASER +{ + LOG *Log; // Logger + UINT64 MinFreeSpace; // Disk space to start deleting files + char *DirName; // Directory name + volatile bool Halt; // Halting flag + THREAD *Thread; // Thread + bool LastFailed; // Whether deletion of the file failed at the end + EVENT *HaltEvent; // Halting event +}; + +// List of files that can be deleted +typedef struct ERASE_FILE +{ + char *FullPath; // Full path + UINT64 UpdateTime; // Updating date +} ERASE_FILE; + +// SYSLOG object +struct SLOG +{ + LOCK *lock; // Lock + SOCK *Udp; // UDP socket + IP DestIp; // Destination IP address + UINT DestPort; // Destination port number + char HostName[MAX_HOST_NAME_LEN + 1]; // Host name + UINT64 NextPollIp; // Time of examination of the IP address at the end +}; + +// Function prototype +LOG *NewLog(char *dir, char *prefix, UINT switch_type); +void FreeLog(LOG *g); +void LogThread(THREAD *thread, void *param); +void WaitLogFlush(LOG *g); +void LockLog(LOG *g); +void UnlockLog(LOG *g); +void InsertRecord(LOG *g, void *data, RECORD_PARSE_PROC *proc); +void InsertStringRecord(LOG *g, char *str); +void InsertUnicodeRecord(LOG *g, wchar_t *unistr); +char *StringRecordParseProc(RECORD *rec); +bool MakeLogFileName(LOG *g, char *name, UINT size, char *dir, char *prefix, UINT64 tick, UINT switch_type, UINT num, char *old_datestr); +void MakeLogFileNameStringFromTick(LOG *g, char *str, UINT size, UINT64 tick, UINT switch_type); +void WriteRecordToBuffer(BUF *b, RECORD *r); +void SetLogSwitchType(LOG *g, UINT switch_type); +bool PacketLog(HUB *hub, SESSION *src_session, SESSION *dest_session, PKT *packet, UINT64 now); +char *PacketLogParseProc(RECORD *rec); +UINT CalcPacketLoggingLevel(HUB *hub, PKT *packet); +UINT CalcPacketLoggingLevelEx(HUB_LOG *g, PKT *packet); +char *GenCsvLine(TOKEN_LIST *t); +void ReplaceForCsv(char *str); +char *PortStr(CEDAR *cedar, UINT port, bool udp); +char *TcpFlagStr(UCHAR flag); +void SiSetDefaultLogSetting(HUB_LOG *g); +void DebugLog(CEDAR *c, char *fmt, ...); +void SLog(CEDAR *c, char *name, ...); +void WriteHubLog(HUB *h, wchar_t *str); +void HLog(HUB *h, char *name, ...); +void NLog(VH *v, char *name, ...); +void PPPLog(PPP_SESSION *p, char *name, ...); +void IPsecLog(IKE_SERVER *ike, IKE_CLIENT *c, IKE_SA *ike_sa, IPSECSA *ipsec_sa, char *name, ...); +void EtherIPLog(ETHERIP_SERVER *s, char *name, ...); +void WriteServerLog(CEDAR *c, wchar_t *str); +void ALog(ADMIN *a, HUB *h, char *name, ...); +void CLog(CLIENT *c, char *name, ...); +void WriteClientLog(CLIENT *c, wchar_t *str); +ERASER *NewEraser(LOG *log, UINT64 min_size); +void FreeEraser(ERASER *e); +void ELog(ERASER *e, char *name, ...); +void EraserThread(THREAD *t, void *p); +void EraserMain(ERASER *e); +bool CheckEraserDiskFreeSpace(ERASER *e); +int CompareEraseFile(void *p1, void *p2); +LIST *GenerateEraseFileList(ERASER *e); +void FreeEraseFileList(LIST *o); +void EnumEraseFile(LIST *o, char *dirname); +SLOG *NewSysLog(char *hostname, UINT port, IP *ip); +void SetSysLog(SLOG *g, char *hostname, UINT port); +void FreeSysLog(SLOG *g); +void SendSysLog(SLOG *g, wchar_t *str); +char *BuildHttpLogStr(HTTPLOG *h); +void MakeSafeLogStr(char *str); +void AddLogBufToStr(BUF *b, char *name, char *value); +void SetEraserCheckInterval(UINT interval); +UINT GetEraserCheckInterval(); +void SetMaxLogSize(UINT64 size); +UINT64 GetMaxLogSize(); + +#endif // LOGGING_G + diff --git a/src/Cedar/NM.c b/src/Cedar/NM.c index 61c98f0e..758914da 100644 --- a/src/Cedar/NM.c +++ b/src/Cedar/NM.c @@ -1,1537 +1,1537 @@ -// SoftEther VPN Source Code - Developer Edition Master Branch -// Cedar Communication Module - - -// NM.c -// VPN User-mode Router Manager for Win32 - -#include - -#ifdef WIN32 - -#define SM_C -#define CM_C -#define NM_C - -#define _WIN32_WINNT 0x0502 -#define WINVER 0x0502 -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "CMInner.h" -#include "SMInner.h" -#include "NMInner.h" -#include "EMInner.h" -#include "../PenCore/resource.h" - -// Global variable -static NM *nm = NULL; - -// Dialog proc for the push routing option -UINT NmEditPushRouteProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param) -{ - SM_HUB *r = (SM_HUB *)param; - char *str = NULL; - // Validate arguments - if (hWnd == NULL) - { - return 0; - } - - switch (msg) - { - case WM_INITDIALOG: - SetTextA(hWnd, E_TEXT, r->CurrentPushRouteStr); - Focus(hWnd, E_TEXT); - - SetIcon(hWnd, 0, ICO_PROTOCOL); - break; - - case WM_COMMAND: - switch (wParam) - { - case IDOK: - str = GetTextA(hWnd, E_TEXT); - if (str != NULL) - { - bool ok = true; - - if (CheckClasslessRouteTableStr(str) == false) - { - if (MsgBox(hWnd, MB_ICONWARNING | MB_OKCANCEL | MB_DEFBUTTON2, _UU("NM_PUSH_ROUTE_WARNING")) == IDCANCEL) - { - ok = false; - } - } - - if (ok) - { - if (IsEmptyStr(str) == false) - { - if (GetCapsBool(r->p->CapsList, "b_suppport_push_route") == false) - { - MsgBox(hWnd, MB_ICONEXCLAMATION, _UU("ERR_147")); - } - } - - StrCpy(r->CurrentPushRouteStr, sizeof(r->CurrentPushRouteStr), str); - - EndDialog(hWnd, 1); - } - - Free(str); - } - break; - - case IDCANCEL: - Close(hWnd); - break; - } - break; - - case WM_CLOSE: - EndDialog(hWnd, 0); - break; - } - - return 0; -} - -// Edit dialog for the push routing option -bool NmEditPushRoute(HWND hWnd, SM_HUB *r) -{ - // Validate arguments - if (r == NULL) - { - return false; - } - - return Dialog(hWnd, D_NM_PUSH, NmEditPushRouteProc, r); -} - -// Change Password dialog -UINT NmChangePasswordProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param) -{ - RPC *r = (RPC *)param; - char tmp1[MAX_SIZE]; - char tmp2[MAX_SIZE]; - RPC_SET_PASSWORD t; - // Validate arguments - if (hWnd == NULL) - { - return 0; - } - - switch (msg) - { - case WM_INITDIALOG: - FormatText(hWnd, 0, r->Sock->RemoteHostname); - FormatText(hWnd, S_TITLE, r->Sock->RemoteHostname); - break; - - case WM_COMMAND: - GetTxtA(hWnd, E_PASSWORD1, tmp1, sizeof(tmp1)); - GetTxtA(hWnd, E_PASSWORD2, tmp2, sizeof(tmp2)); - switch (LOWORD(wParam)) - { - case E_PASSWORD1: - case E_PASSWORD2: - SetEnable(hWnd, IDOK, StrCmp(tmp1, tmp2) == 0); - break; - } - - switch (wParam) - { - case IDOK: - Zero(&t, sizeof(t)); - Sha0(t.HashedPassword, tmp1, StrLen(tmp1)); - - if (CALL(hWnd, NcSetPassword(r, &t))) - { - MsgBox(hWnd, MB_ICONINFORMATION, _UU("NM_PASSWORD_MSG")); - EndDialog(hWnd, true); - } - break; - - case IDCANCEL: - Close(hWnd); - break; - } - break; - - case WM_CLOSE: - EndDialog(hWnd, false); - break; - } - - return 0; -} - -// Change the password -void NmChangePassword(HWND hWnd, RPC *r) -{ - // Validate arguments - if (hWnd == NULL || r == NULL) - { - return; - } - - Dialog(hWnd, D_NM_CHANGE_PASSWORD, NmChangePasswordProc, r); -} - -// DHCP enumeration initialization -void NmDhcpInit(HWND hWnd, SM_HUB *r) -{ - // Validate arguments - if (hWnd == NULL || r == NULL) - { - return; - } - - SetIcon(hWnd, 0, ICO_INTERNET); - - LvInit(hWnd, L_TABLE); - LvInsertColumn(hWnd, L_TABLE, 0, _UU("DHCP_DHCP_ID"), 50); - LvInsertColumn(hWnd, L_TABLE, 1, _UU("DHCP_LEASED_TIME"), 200); - LvInsertColumn(hWnd, L_TABLE, 2, _UU("DHCP_EXPIRE_TIME"), 200); - LvInsertColumn(hWnd, L_TABLE, 3, _UU("DHCP_MAC_ADDRESS"), 130); - LvInsertColumn(hWnd, L_TABLE, 4, _UU("DHCP_IP_ADDRESS"), 100); - LvInsertColumn(hWnd, L_TABLE, 5, _UU("DHCP_HOSTNAME"), 150); - - NmDhcpRefresh(hWnd, r); -} - -// DHCP enumeration -void NmDhcpRefresh(HWND hWnd, SM_HUB *r) -{ - LVB *b; - RPC_ENUM_DHCP t; - UINT i; - // Validate arguments - if (hWnd == NULL || r == NULL) - { - Close(hWnd); - return; - } - - Zero(&t, sizeof(t)); - - StrCpy(t.HubName, sizeof(t.HubName), r->HubName); - - if (CALL(hWnd, ScEnumDHCP(r->Rpc, &t)) == false) - { - return; - } - - b = LvInsertStart(); - - for (i = 0;i < t.NumItem;i++) - { - RPC_ENUM_DHCP_ITEM *e = &t.Items[i]; - wchar_t tmp0[MAX_SIZE]; - wchar_t tmp1[MAX_SIZE]; - wchar_t tmp2[MAX_SIZE]; - wchar_t tmp3[MAX_SIZE]; - wchar_t tmp4[MAX_SIZE]; - wchar_t tmp5[MAX_SIZE]; - char str[MAX_SIZE]; - - // ID - UniToStru(tmp0, e->Id); - - // Time - GetDateTimeStrEx64(tmp1, sizeof(tmp1), SystemToLocal64(e->LeasedTime), NULL); - GetDateTimeStrEx64(tmp2, sizeof(tmp2), SystemToLocal64(e->ExpireTime), NULL); - - MacToStr(str, sizeof(str), e->MacAddress); - StrToUni(tmp3, sizeof(tmp3), str); - - IPToStr32(str, sizeof(str), e->IpAddress); - StrToUni(tmp4, sizeof(tmp4), str); - - StrToUni(tmp5, sizeof(tmp5), e->Hostname); - - LvInsertAdd(b, ICO_INTERNET, NULL, 6, - tmp0, tmp1, tmp2, tmp3, tmp4, tmp5); - } - - LvInsertEnd(b, hWnd, L_TABLE); - - FreeRpcEnumDhcp(&t); -} - -// DHCP enumeration procedure -UINT NmDhcpProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param) -{ - SM_HUB *r = (SM_HUB *)param; - // Validate arguments - if (hWnd == NULL) - { - return 0; - } - - switch (msg) - { - case WM_INITDIALOG: - NmDhcpInit(hWnd, r); - SetTimer(hWnd, 1, NM_DHCP_REFRESH_TIME, NULL); - break; - - case WM_COMMAND: - switch (wParam) - { - case IDCANCEL: - Close(hWnd); - break; - - case B_REFRESH: - NmDhcpRefresh(hWnd, r); - break; - } - break; - - case WM_TIMER: - switch (wParam) - { - case 1: - KillTimer(hWnd, 1); - NmDhcpRefresh(hWnd, r); - SetTimer(hWnd, 1, NM_DHCP_REFRESH_TIME, NULL); - break; - } - break; - - case WM_CLOSE: - EndDialog(hWnd, false); - break; - } - - LvStandardHandler(hWnd, msg, wParam, lParam, L_TABLE); - - return 0; -} - -// DHCP enumeration -void NmDhcp(HWND hWnd, SM_HUB *r) -{ - // Validate arguments - if (hWnd == NULL || r == NULL) - { - return; - } - - Dialog(hWnd, D_NM_DHCP, NmDhcpProc, r); -} - - -// NAT enumeration initialization -void NmNatInit(HWND hWnd, SM_HUB *r) -{ - // Validate arguments - if (hWnd == NULL || r == NULL) - { - return; - } - - SetIcon(hWnd, 0, ICO_PROTOCOL); - - LvInit(hWnd, L_TABLE); - LvInsertColumn(hWnd, L_TABLE, 0, _UU("NM_NAT_ID"), 50); - LvInsertColumn(hWnd, L_TABLE, 1, _UU("NM_NAT_PROTOCOL"), 80); - LvInsertColumn(hWnd, L_TABLE, 2, _UU("NM_NAT_SRC_HOST"), 100); - LvInsertColumn(hWnd, L_TABLE, 3, _UU("NM_NAT_SRC_PORT"), 80); - LvInsertColumn(hWnd, L_TABLE, 4, _UU("NM_NAT_DST_HOST"), 150); - LvInsertColumn(hWnd, L_TABLE, 5, _UU("NM_NAT_DST_PORT"), 80); - LvInsertColumn(hWnd, L_TABLE, 6, _UU("NM_NAT_CREATED"), 200); - LvInsertColumn(hWnd, L_TABLE, 7, _UU("NM_NAT_LAST_COMM"), 200); - LvInsertColumn(hWnd, L_TABLE, 8, _UU("NM_NAT_SIZE"), 120); - LvInsertColumn(hWnd, L_TABLE, 9, _UU("NM_NAT_TCP_STATUS"), 120); - - NmNatRefresh(hWnd, r); -} - -// NAT enumeration -void NmNatRefresh(HWND hWnd, SM_HUB *r) -{ - LVB *b; - RPC_ENUM_NAT t; - UINT i; - // Validate arguments - if (hWnd == NULL || r == NULL) - { - return; - } - - Zero(&t, sizeof(t)); - - StrCpy(t.HubName, sizeof(t.HubName), r->HubName); - - if (CALL(hWnd, ScEnumNAT(r->Rpc, &t)) == false) - { - Close(hWnd); - return; - } - - b = LvInsertStart(); - - for (i = 0;i < t.NumItem;i++) - { - RPC_ENUM_NAT_ITEM *e = &t.Items[i]; - wchar_t tmp0[MAX_SIZE]; - wchar_t *tmp1 = L""; - wchar_t tmp2[MAX_SIZE]; - wchar_t tmp3[MAX_SIZE]; - wchar_t tmp4[MAX_SIZE]; - wchar_t tmp5[MAX_SIZE]; - wchar_t tmp6[MAX_SIZE]; - wchar_t tmp7[MAX_SIZE]; - wchar_t tmp8[MAX_SIZE]; - wchar_t *tmp9 = L""; - char v1[128], v2[128]; - - // ID - UniToStru(tmp0, e->Id); - - // Protocol - switch (e->Protocol) - { - case NAT_TCP: - tmp1 = _UU("NM_NAT_PROTO_TCP"); - break; - case NAT_UDP: - tmp1 = _UU("NM_NAT_PROTO_UDP"); - break; - case NAT_DNS: - tmp1 = _UU("NM_NAT_PROTO_DNS"); - break; - case NAT_ICMP: - tmp1 = _UU("NM_NAT_PROTO_ICMP"); - break; - } - - // Source host - StrToUni(tmp2, sizeof(tmp2), e->SrcHost); - - // Source port - UniToStru(tmp3, e->SrcPort); - - // Destination host - StrToUni(tmp4, sizeof(tmp4), e->DestHost); - - // Destination port - UniToStru(tmp5, e->DestPort); - - // Creation date and time of the session - GetDateTimeStrEx64(tmp6, sizeof(tmp6), SystemToLocal64(e->CreatedTime), NULL); - - // Last communication date and time - GetDateTimeStrEx64(tmp7, sizeof(tmp7), SystemToLocal64(e->LastCommTime), NULL); - - // Communication amount - ToStr3(v1, sizeof(v1), e->RecvSize); - ToStr3(v2, sizeof(v2), e->SendSize); - UniFormat(tmp8, sizeof(tmp8), L"%S / %S", v1, v2); - - // TCP state - if (e->Protocol == NAT_TCP) - { - switch (e->TcpStatus) - { - case NAT_TCP_CONNECTING: - tmp9 = _UU("NAT_TCP_CONNECTING"); - break; - case NAT_TCP_SEND_RESET: - tmp9 = _UU("NAT_TCP_SEND_RESET"); - break; - case NAT_TCP_CONNECTED: - tmp9 = _UU("NAT_TCP_CONNECTED"); - break; - case NAT_TCP_ESTABLISHED: - tmp9 = _UU("NAT_TCP_ESTABLISHED"); - break; - case NAT_TCP_WAIT_DISCONNECT: - tmp9 = _UU("NAT_TCP_WAIT_DISCONNECT"); - break; - } - } - - LvInsertAdd(b, ICO_PROTOCOL, NULL, 10, - tmp0, tmp1, tmp2, tmp3, tmp4, tmp5, tmp6, tmp7, tmp8, tmp9); - } - - LvInsertEnd(b, hWnd, L_TABLE); - - FreeRpcEnumNat(&t); -} - -// NAT enumeration procedure -UINT NmNatProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param) -{ - SM_HUB *r = (SM_HUB *)param; - // Validate arguments - if (hWnd == NULL) - { - return 0; - } - - switch (msg) - { - case WM_INITDIALOG: - NmNatInit(hWnd, r); - SetTimer(hWnd, 1, NM_NAT_REFRESH_TIME, NULL); - break; - - case WM_COMMAND: - switch (wParam) - { - case IDCANCEL: - Close(hWnd); - break; - - case B_REFRESH: - NmNatRefresh(hWnd, r); - break; - } - break; - - case WM_TIMER: - switch (wParam) - { - case 1: - KillTimer(hWnd, 1); - NmNatRefresh(hWnd, r); - SetTimer(hWnd, 1, NM_NAT_REFRESH_TIME, NULL); - break; - } - break; - - case WM_CLOSE: - EndDialog(hWnd, false); - break; - } - - LvStandardHandler(hWnd, msg, wParam, lParam, L_TABLE); - - return 0; -} - -// NAT enumeration -void NmNat(HWND hWnd, SM_HUB *r) -{ - // Validate arguments - if (hWnd == NULL || r == NULL) - { - return; - } - - Dialog(hWnd, D_NM_NAT, NmNatProc, r); -} - -// Show the information of the router -bool NmInfo(HWND hWnd, SM_SERVER *s, void *param) -{ - LVB *b; - RPC_NAT_INFO t; - wchar_t tmp[MAX_SIZE]; - // Validate arguments - if (hWnd == NULL || s == NULL) - { - return false; - } - - Zero(&t, sizeof(t)); - - if (CALL(hWnd, NcGetInfo(s->Rpc, &t)) == false) - { - return false; - } - - b = LvInsertStart(); - - StrToUni(tmp, sizeof(tmp), t.NatProductName); - LvInsertAdd(b, ICO_ROUTER, NULL, 2, _UU("NM_INFO_PRODUCT_NAME"), tmp); - - StrToUni(tmp, sizeof(tmp), t.NatVersionString); - LvInsertAdd(b, ICO_INFORMATION, NULL, 2, _UU("NM_INFO_VERSION_STR"), tmp); - - StrToUni(tmp, sizeof(tmp), t.NatBuildInfoString); - LvInsertAdd(b, ICO_INFORMATION, NULL, 2, _UU("NM_INFO_BUILD_INFO"), tmp); - - StrToUni(tmp, sizeof(tmp), t.NatHostName); - LvInsertAdd(b, ICO_TOWER, NULL, 2, _UU("NM_INFO_HOSTNAME"), tmp); - - // OS - StrToUni(tmp, sizeof(tmp), t.OsInfo.OsSystemName); - LvInsertAdd(b, ICO_MACHINE, NULL, 2, _UU("SM_OS_SYSTEM_NAME"), tmp); - - StrToUni(tmp, sizeof(tmp), t.OsInfo.OsProductName); - LvInsertAdd(b, ICO_MACHINE, NULL, 2, _UU("SM_OS_PRODUCT_NAME"), tmp); - - if (t.OsInfo.OsServicePack != 0) - { - UniFormat(tmp, sizeof(tmp), _UU("SM_OS_SP_TAG"), t.OsInfo.OsServicePack); - LvInsertAdd(b, ICO_MACHINE, NULL, 2, _UU("SM_OS_SERVICE_PACK"), tmp); - } - - StrToUni(tmp, sizeof(tmp), t.OsInfo.OsVendorName); - LvInsertAdd(b, ICO_MACHINE, NULL, 2, _UU("SM_OS_VENDER_NAME"), tmp); - - StrToUni(tmp, sizeof(tmp), t.OsInfo.OsVersion); - LvInsertAdd(b, ICO_MACHINE, NULL, 2, _UU("SM_OS_VERSION"), tmp); - - StrToUni(tmp, sizeof(tmp), t.OsInfo.KernelName); - LvInsertAdd(b, ICO_MACHINE, NULL, 2, _UU("SM_OS_KERNEL_NAME"), tmp); - - StrToUni(tmp, sizeof(tmp), t.OsInfo.KernelVersion); - LvInsertAdd(b, ICO_MACHINE, NULL, 2, _UU("SM_OS_KERNEL_VERSION"), tmp); - - // Memory information - if (t.MemInfo.TotalMemory != 0) - { - char vv[128]; - - ToStr3(vv, sizeof(vv), t.MemInfo.TotalMemory); - UniFormat(tmp, sizeof(tmp), _UU("SM_ST_RAM_SIZE_KB"), vv); - LvInsertAdd(b, ICO_MEMORY, NULL, 2, _UU("SM_ST_TOTAL_MEMORY"), tmp); - - ToStr3(vv, sizeof(vv), t.MemInfo.UsedMemory); - UniFormat(tmp, sizeof(tmp), _UU("SM_ST_RAM_SIZE_KB"), vv); - LvInsertAdd(b, ICO_MEMORY, NULL, 2, _UU("SM_ST_USED_MEMORY"), tmp); - - ToStr3(vv, sizeof(vv), t.MemInfo.FreeMemory); - UniFormat(tmp, sizeof(tmp), _UU("SM_ST_RAM_SIZE_KB"), vv); - LvInsertAdd(b, ICO_MEMORY, NULL, 2, _UU("SM_ST_FREE_MEMORY"), tmp); - - ToStr3(vv, sizeof(vv), t.MemInfo.TotalPhys); - UniFormat(tmp, sizeof(tmp), _UU("SM_ST_RAM_SIZE_KB"), vv); - LvInsertAdd(b, ICO_MEMORY, NULL, 2, _UU("SM_ST_TOTAL_PHYS"), tmp); - - ToStr3(vv, sizeof(vv), t.MemInfo.UsedPhys); - UniFormat(tmp, sizeof(tmp), _UU("SM_ST_RAM_SIZE_KB"), vv); - LvInsertAdd(b, ICO_MEMORY, NULL, 2, _UU("SM_ST_USED_PHYS"), tmp); - - ToStr3(vv, sizeof(vv), t.MemInfo.FreePhys); - UniFormat(tmp, sizeof(tmp), _UU("SM_ST_RAM_SIZE_KB"), vv); - LvInsertAdd(b, ICO_MEMORY, NULL, 2, _UU("SM_ST_FREE_PHYS"), tmp); - } - - LvInsertEnd(b, hWnd, L_STATUS); - - FreeRpcNatInfo(&t); - - return true; -} - -// Show the status of the router -bool NmStatus(HWND hWnd, SM_SERVER *s, void *param) -{ - LVB *b; - RPC_NAT_STATUS t; - wchar_t tmp[MAX_SIZE]; - SM_HUB *h = (SM_HUB *)param; - // Validate arguments - if (hWnd == NULL || s == NULL) - { - return false; - } - - Zero(&t, sizeof(t)); - - StrCpy(t.HubName, sizeof(t.HubName), h->HubName); - - if (CALL(hWnd, ScGetSecureNATStatus(s->Rpc, &t)) == false) - { - return false; - } - - b = LvInsertStart(); - - StrToUni(tmp, sizeof(tmp), h->HubName); - LvInsertAdd(b, ICO_HUB, NULL, 2, _UU("SM_HUB_COLUMN_1"), tmp); - - UniFormat(tmp, sizeof(tmp), _UU("SM_SNAT_NUM_SESSION"), t.NumTcpSessions); - LvInsertAdd(b, ICO_PROTOCOL, NULL, 2, _UU("NM_STATUS_TCP"), tmp); - - UniFormat(tmp, sizeof(tmp), _UU("SM_SNAT_NUM_SESSION"), t.NumUdpSessions); - LvInsertAdd(b, ICO_PROTOCOL, NULL, 2, _UU("NM_STATUS_UDP"), tmp); - - UniFormat(tmp, sizeof(tmp), _UU("SM_SNAT_NUM_SESSION"), t.NumIcmpSessions); - LvInsertAdd(b, ICO_PROTOCOL, NULL, 2, _UU("NM_STATUS_ICMP"), tmp); - - UniFormat(tmp, sizeof(tmp), _UU("SM_SNAT_NUM_SESSION"), t.NumDnsSessions); - LvInsertAdd(b, ICO_PROTOCOL, NULL, 2, _UU("NM_STATUS_DNS"), tmp); - - UniFormat(tmp, sizeof(tmp), _UU("SM_SNAT_NUM_CLIENT"), t.NumDhcpClients); - LvInsertAdd(b, ICO_PROTOCOL_DHCP, NULL, 2, _UU("NM_STATUS_DHCP"), tmp); - - LvInsertAdd(b, ICO_MACHINE, NULL, 2, _UU("SM_SNAT_IS_KERNEL"), t.IsKernelMode ? _UU("SEC_YES") : _UU("SEC_NO")); - LvInsertAdd(b, ICO_MACHINE, NULL, 2, _UU("SM_SNAT_IS_RAW"), t.IsRawIpMode ? _UU("SEC_YES") : _UU("SEC_NO")); - - LvInsertEnd(b, hWnd, L_STATUS); - - FreeRpcNatStatus(&t); - - return true; -} - -// Convert the contents of the form to the VH_OPTION -void NmEditVhOptionFormToVH(HWND hWnd, VH_OPTION *t) -{ - char tmp[MAX_SIZE]; - BUF *b; - // Validate arguments - if (hWnd == NULL || t == NULL) - { - return; - } - - Zero(t, sizeof(VH_OPTION)); - - GetTxtA(hWnd, E_MAC, tmp, sizeof(tmp)); - b = StrToBin(tmp); - if (b != NULL) - { - if (b->Size == 6) - { - Copy(t->MacAddress, b->Buf, 6); - } - FreeBuf(b); - } - - UINTToIP(&t->Ip, IpGet(hWnd, E_IP)); - UINTToIP(&t->Mask, IpGet(hWnd, E_MASK)); - - t->UseNat = IsChecked(hWnd, R_USE_NAT); - t->Mtu = GetInt(hWnd, E_MTU); - t->NatTcpTimeout = GetInt(hWnd, E_TCP); - t->NatUdpTimeout = GetInt(hWnd, E_UDP); - - t->UseDhcp = IsChecked(hWnd, R_USE_DHCP); - UINTToIP(&t->DhcpLeaseIPStart, IpGet(hWnd, E_DHCP_START)); - UINTToIP(&t->DhcpLeaseIPEnd, IpGet(hWnd, E_DHCP_END)); - UINTToIP(&t->DhcpSubnetMask, IpGet(hWnd, E_DHCP_MASK)); - t->DhcpExpireTimeSpan = GetInt(hWnd, E_EXPIRES); - UINTToIP(&t->DhcpGatewayAddress, IpGet(hWnd, E_GATEWAY)); - UINTToIP(&t->DhcpDnsServerAddress, IpGet(hWnd, E_DNS)); - UINTToIP(&t->DhcpDnsServerAddress2, IpGet(hWnd, E_DNS2)); - GetTxtA(hWnd, E_DOMAIN, t->DhcpDomainName, sizeof(t->DhcpDomainName)); - t->SaveLog = IsChecked(hWnd, R_SAVE_LOG); -} - -// Initialize -void NmEditVhOptionInit(HWND hWnd, SM_HUB *r) -{ - char tmp[MAX_SIZE]; - VH_OPTION t; - // Validate arguments - if (hWnd == NULL || r == NULL) - { - return; - } - - SetIcon(hWnd, 0, ICO_ROUTER); - - FormatText(hWnd, S_TITLE, r->HubName); - - Zero(&t, sizeof(VH_OPTION)); - StrCpy(t.HubName, sizeof(t.HubName), r->HubName); - if (CALL(hWnd, ScGetSecureNATOption(r->Rpc, &t)) == false) - { - EndDialog(hWnd, false); - return; - } - - if (GetCapsBool(r->p->CapsList, "b_virtual_nat_disabled")) - { - SetEnable(hWnd, R_USE_NAT, false); - Check(hWnd, R_USE_NAT, false); - } - - MacToStr(tmp, sizeof(tmp), t.MacAddress); - SetTextA(hWnd, E_MAC, tmp); - IpSet(hWnd, E_IP, IPToUINT(&t.Ip)); - IpSet(hWnd, E_MASK, IPToUINT(&t.Mask)); - - Check(hWnd, R_USE_NAT, t.UseNat); - SetIntEx(hWnd, E_MTU, t.Mtu); - SetIntEx(hWnd, E_TCP, t.NatTcpTimeout); - SetIntEx(hWnd, E_UDP, t.NatUdpTimeout); - - Check(hWnd, R_USE_DHCP, t.UseDhcp); - IpSet(hWnd, E_DHCP_START, IPToUINT(&t.DhcpLeaseIPStart)); - IpSet(hWnd, E_DHCP_END, IPToUINT(&t.DhcpLeaseIPEnd)); - IpSet(hWnd, E_DHCP_MASK, IPToUINT(&t.DhcpSubnetMask)); - SetIntEx(hWnd, E_EXPIRES, t.DhcpExpireTimeSpan); - - if (IPToUINT(&t.DhcpGatewayAddress) != 0) - { - IpSet(hWnd, E_GATEWAY, IPToUINT(&t.DhcpGatewayAddress)); - } - - if (IPToUINT(&t.DhcpDnsServerAddress) != 0) - { - IpSet(hWnd, E_DNS, IPToUINT(&t.DhcpDnsServerAddress)); - } - - if (IPToUINT(&t.DhcpDnsServerAddress2) != 0) - { - IpSet(hWnd, E_DNS2, IPToUINT(&t.DhcpDnsServerAddress2)); - } - - SetTextA(hWnd, E_DOMAIN, t.DhcpDomainName); - Check(hWnd, R_SAVE_LOG, t.SaveLog); - - StrCpy(r->CurrentPushRouteStr, sizeof(r->CurrentPushRouteStr), t.DhcpPushRoutes); - - if (GetCapsBool(r->p->CapsList, "b_suppport_push_route_config") == false) - { - Disable(hWnd, S_1); - Disable(hWnd, S_2); - Disable(hWnd, B_PUSH); - } - - NmEditVhOptionUpdate(hWnd, r); - -} - -void NmEditVhOptionUpdate(HWND hWnd, SM_HUB *r) -{ - VH_OPTION t; - bool ok = true; - // Validate arguments - if (hWnd == NULL || r == NULL) - { - return; - } - - NmEditVhOptionFormToVH(hWnd, &t); - - if (IsZero(t.MacAddress, 6)) - { - ok = false; - } - - if (IPToUINT(&t.Ip) == 0 || IPToUINT(&t.Mask) == 0) - { - ok = false; - } - - if (IpIsFilled(hWnd, E_IP) == false || IpIsFilled(hWnd, E_MASK) == false) - { - ok = false; - } - - if (IsHostIPAddress4(&t.Ip) == false || IsSubnetMask4(&t.Mask) == false) - { - ok = false; - } - - if (t.UseNat) - { - if (t.Mtu < 64 || t.Mtu > 1500) - { - ok = false; - } - - if (t.NatTcpTimeout < (NAT_TCP_MIN_TIMEOUT / 1000) || t.NatTcpTimeout > (NAT_TCP_MAX_TIMEOUT / 1000)) - { - ok = false; - } - - if (t.NatUdpTimeout < (NAT_UDP_MIN_TIMEOUT / 1000) || t.NatUdpTimeout > (NAT_UDP_MAX_TIMEOUT / 1000)) - { - ok = false; - } - } - - if (t.UseDhcp) - { - if (IpIsFilled(hWnd, E_DHCP_START) == false || IpIsFilled(hWnd, E_DHCP_END) == false || - IpIsFilled(hWnd, E_DHCP_MASK) == false) - { - ok = false; - } - - if (IpGetFilledNum(hWnd, E_GATEWAY) != 0 && IpGetFilledNum(hWnd, E_GATEWAY) != 4) - { - ok = false; - } - - if (IpGetFilledNum(hWnd, E_DNS) != 0 && IpGetFilledNum(hWnd, E_DNS) != 4) - { - ok = false; - } - - if (IpGetFilledNum(hWnd, E_DNS2) != 0 && IpGetFilledNum(hWnd, E_DNS2) != 4) - { - ok = false; - } - - if (IPToUINT(&t.DhcpLeaseIPStart) == 0 || IPToUINT(&t.DhcpLeaseIPEnd) == 0 || - IPToUINT(&t.DhcpSubnetMask) == 0) - { - ok = false; - } - - if (t.DhcpExpireTimeSpan < 15) - { - ok = false; - } - - if (Endian32(IPToUINT(&t.DhcpLeaseIPStart)) > Endian32(IPToUINT(&t.DhcpLeaseIPEnd))) - { - ok = false; - } - - if (IsHostIPAddress4(&t.DhcpLeaseIPStart) == false || - IsHostIPAddress4(&t.DhcpLeaseIPEnd) == false) - { - ok = false; - } - - if (IsSubnetMask4(&t.DhcpSubnetMask) == false) - { - ok = false; - } - } - - SetEnable(hWnd, E_MTU, t.UseNat); - SetEnable(hWnd, E_TCP, t.UseNat); - SetEnable(hWnd, E_UDP, t.UseNat); - - SetEnable(hWnd, E_DHCP_START, t.UseDhcp); - SetEnable(hWnd, E_DHCP_END, t.UseDhcp); - SetEnable(hWnd, E_DHCP_MASK, t.UseDhcp); - SetEnable(hWnd, E_EXPIRES, t.UseDhcp); - SetEnable(hWnd, E_GATEWAY, t.UseDhcp); - SetEnable(hWnd, E_DNS, t.UseDhcp); - SetEnable(hWnd, E_DNS2, t.UseDhcp); - SetEnable(hWnd, E_DOMAIN, t.UseDhcp); - - SetEnable(hWnd, IDOK, ok); -} - -// [OK] button -void NmEditVhOptionOnOk(HWND hWnd, SM_HUB *r) -{ - VH_OPTION t; - // Validate arguments - if (hWnd == NULL || r == NULL) - { - return; - } - - NmEditVhOptionFormToVH(hWnd, &t); - StrCpy(t.HubName, sizeof(t.HubName), r->HubName); - - t.ApplyDhcpPushRoutes = true; - StrCpy(t.DhcpPushRoutes, sizeof(t.DhcpPushRoutes), r->CurrentPushRouteStr); - - if (CALL(hWnd, ScSetSecureNATOption(r->Rpc, &t))) - { - EndDialog(hWnd, true); - } -} - -// Virtual host options editing dialog -UINT NmEditVhOptionProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param) -{ - SM_HUB *r = (SM_HUB *)param; - // Validate arguments - if (hWnd == NULL) - { - return 0; - } - - switch (msg) - { - case WM_INITDIALOG: - NmEditVhOptionInit(hWnd, r); - break; - - case WM_COMMAND: - switch (LOWORD(wParam)) - { - case E_MAC: - case E_IP: - case E_MASK: - case R_USE_NAT: - case E_MTU: - case E_TCP: - case E_UDP: - case R_SAVE_LOG: - case R_USE_DHCP: - case E_DHCP_START: - case E_DHCP_END: - case E_DHCP_MASK: - case E_EXPIRES: - case E_GATEWAY: - case E_DNS: - case E_DNS2: - case E_DOMAIN: - NmEditVhOptionUpdate(hWnd, r); - break; - } - - switch (wParam) - { - case IDOK: - NmEditVhOptionOnOk(hWnd, r); - break; - - case IDCANCEL: - EndDialog(hWnd, false); - break; - - case R_USE_NAT: - if (IsChecked(hWnd, R_USE_NAT)) - { - FocusEx(hWnd, E_MTU); - } - - if (IsChecked(hWnd, R_USE_DHCP)) - { - Focus(hWnd, E_DHCP_START); - } - break; - - case B_PUSH: - NmEditPushRoute(hWnd, r); - break; - } - - break; - } - - return 0; -} - -// Edit the virtual host option -void NmEditVhOption(HWND hWnd, SM_HUB *r) -{ - // Validate arguments - if (hWnd == NULL || r == NULL) - { - return; - } - - Zero(r->CurrentPushRouteStr, sizeof(r->CurrentPushRouteStr)); - Dialog(hWnd, D_NM_OPTION, NmEditVhOptionProc, r); -} - -// Edit the client configuration -void NmEditClientConfig(HWND hWnd, RPC *r) -{ - CM_ACCOUNT a; - RPC_CREATE_LINK t; - bool ret = false; - // Validate arguments - if (hWnd == NULL || r == NULL) - { - return; - } - - Zero(&a, sizeof(a)); - Zero(&t, sizeof(t)); - - a.ClientOption = ZeroMalloc(sizeof(CLIENT_OPTION)); - a.NatMode = true; - a.Rpc = r; - - if (CALLEX(hWnd, NcGetClientConfig(r, &t)) != ERR_NO_ERROR) - { - // Create New - a.ClientOption->Port = 443; - a.ClientOption->RetryInterval = 15; - a.ClientOption->NumRetry = INFINITE; - a.ClientOption->AdditionalConnectionInterval = 1; - a.ClientOption->UseEncrypt = true; - a.ClientOption->NoRoutingTracking = true; - a.ClientAuth = ZeroMalloc(sizeof(CLIENT_AUTH)); - a.ClientAuth->AuthType = CLIENT_AUTHTYPE_PASSWORD; - } - else - { - // Edit - a.EditMode = true; - Copy(a.ClientOption, t.ClientOption, sizeof(CLIENT_OPTION)); - a.ClientAuth = CopyClientAuth(t.ClientAuth); - - FreeRpcCreateLink(&t); - } - - ret = CmEditAccountDlg(hWnd, &a); - - Free(a.ServerCert); - Free(a.ClientOption); - CiFreeClientAuth(a.ClientAuth); -} - -// Initialize -void NmMainDlgInit(HWND hWnd, RPC *r) -{ - // Validate arguments - if (r == NULL || hWnd == NULL) - { - return; - } - - SetIcon(hWnd, 0, ICO_ROUTER); - FormatText(hWnd, 0, r->Sock->RemoteHostname); - DlgFont(hWnd, S_STATUS, 11, true); - - NmMainDlgRefresh(hWnd, r); -} - -// Update -void NmMainDlgRefresh(HWND hWnd, RPC *r) -{ -#if 0 - RPC_NAT_STATUS t; - wchar_t tmp[MAX_SIZE]; - wchar_t tmp2[MAX_SIZE]; - // Validate arguments - if (r == NULL || hWnd == NULL) - { - return; - } - - Zero(&t, sizeof(RPC_NAT_STATUS)); - - CALL(hWnd, NcGetStatus(r, &t)); - - if (t.Online == false) - { - UniStrCpy(tmp, sizeof(tmp), _UU("NM_OFFLINE")); - - Enable(hWnd, B_CONNECT); - Disable(hWnd, B_DISCONNECT); - } - else - { - if (t.Connected) - { - UniFormat(tmp, sizeof(tmp), _UU("NM_CONNECTED"), t.Status.ServerName); - } - else - { - if (t.LastError == ERR_NO_ERROR) - { - UniStrCpy(tmp, sizeof(tmp), _UU("NM_CONNECTING")); - } - else - { - UniFormat(tmp, sizeof(tmp), _UU("NM_CONNECT_ERROR"), t.LastError, _E(t.LastError)); - } - } - Disable(hWnd, B_CONNECT); - Enable(hWnd, B_DISCONNECT); - } - - UniFormat(tmp2, sizeof(tmp2), _UU("NM_STATUS_TAG"), tmp); - - SetText(hWnd, S_STATUS, tmp2); - - FreeRpcNatStatus(&t); -#endif -} - -// Main dialog procedure -UINT NmMainDlgProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param) -{ -#if 0 - SM_HUB *r = (SM_HUB *)param; - RPC_DUMMY dummy; - SM_SERVER sm; - // Validate arguments - if (hWnd == NULL) - { - return 0; - } - - switch (msg) - { - case WM_INITDIALOG: - NmMainDlgInit(hWnd, r); - - SetTimer(hWnd, 1, NM_REFRESH_TIME, NULL); - - break; - - case WM_COMMAND: - switch (wParam) - { - case B_SETTING: - // Connection setting - NmEditClientConfig(hWnd, r); - break; - - case B_CONNECT: - // Connection - Zero(&dummy, sizeof(dummy)); - CALL(hWnd, NcOnline(r, &dummy)); - NmMainDlgRefresh(hWnd, r); - break; - - case B_DISCONNECT: - // Disconnect - Zero(&dummy, sizeof(dummy)); - CALL(hWnd, NcOffline(r, &dummy)); - NmMainDlgRefresh(hWnd, r); - break; - - case B_OPTION: - // Operation setting - NmEditVhOption(hWnd, r->Rpc); - break; - - case B_NAT: - // NAT - NmNat(hWnd, r); - break; - - case B_DHCP: - // DHCP - NmDhcp(hWnd, r); - break; - - case B_STATUS: - // Status - Zero(&sm, sizeof(sm)); - sm.Rpc = r; - SmStatusDlg(hWnd, &sm, NULL, true, true, _UU("NM_STATUS"), ICO_ROUTER, - NULL, NmStatus); - break; - - case B_INFO: - // Information - Zero(&sm, sizeof(sm)); - sm.Rpc = r; - SmStatusDlg(hWnd, &sm, NULL, false, true, _UU("NM_INFO"), ICO_ROUTER, - NULL, NmInfo); - break; - - case B_REFRESH: - // Refresh - NmMainDlgRefresh(hWnd, r); - break; - - case B_PASSWORD: - // Change the password - NmChangePassword(hWnd, r); - break; - - case B_ABOUT: - // Version information - About(hWnd, nm->Cedar, CEDAR_ROUTER_STR); - break; - - case IDCANCEL: - Close(hWnd); - break; - } - break; - - case WM_TIMER: - switch (wParam) - { - case 1: - KillTimer(hWnd, 1); - - if (IsEnable(hWnd, 0)) - { - NmMainDlgRefresh(hWnd, r); - } - - SetTimer(hWnd, 1, NM_REFRESH_TIME, NULL); - break; - } - break; - - case WM_CLOSE: - EndDialog(hWnd, false); - break; - } - -#endif - - return 0; -} - -// Main dialog -void NmMainDlg(RPC *r) -{ - // Validate arguments - if (r == NULL) - { - return; - } - - Dialog(NULL, D_NM_MAIN, NmMainDlgProc, r); -} - -// Login dialog -UINT NmLogin(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param) -{ - NM_LOGIN *login = (NM_LOGIN *)param; - char tmp[MAX_SIZE]; - // Validate arguments - if (hWnd == NULL) - { - return 0; - } - - switch (msg) - { - case WM_INITDIALOG: - FormatText(hWnd, S_TITLE, login->Hostname); - break; - - case WM_COMMAND: - switch (wParam) - { - case IDOK: - GetTxtA(hWnd, E_PASSWORD, tmp, sizeof(tmp)); - Sha0(login->hashed_password, tmp, StrLen(tmp)); - EndDialog(hWnd, true); - break; - - case IDCANCEL: - Close(hWnd); - break; - } - break; - - case WM_CLOSE: - EndDialog(hWnd, false); - break; - } - - return 0; -} - -// Connecting dialog -UINT NmConnectDlgProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param) -{ - NM_CONNECT *t = (NM_CONNECT *)param; - RPC *rpc; - NM_LOGIN login; - UINT err; - // Validate arguments - if (hWnd == NULL) - { - return 0; - } - - switch (msg) - { - case WM_INITDIALOG: - FormatText(hWnd, S_TITLE, t->Hostname); - SetTimer(hWnd, 1, 50, NULL); - break; - - case WM_TIMER: - switch (wParam) - { - case 1: - KillTimer(hWnd, 1); - - while (true) - { - bool flag = false; -RETRY_PASSWORD: - // Password input dialog - Zero(&login, sizeof(login)); - login.Hostname = t->Hostname; - login.Port = t->Port; - Sha0(login.hashed_password, "", 0); - - if (flag) - { - if (Dialog(hWnd, D_NM_LOGIN, NmLogin, &login) == false) - { - EndDialog(hWnd, false); - break; - } - } - -RETRY_CONNECT: - Refresh(DlgItem(hWnd, S_TITLE)); - Refresh(hWnd); - // Connection - rpc = NatAdminConnect(nm->Cedar, t->Hostname, t->Port, login.hashed_password, &err); - if (rpc != NULL) - { - t->Rpc = rpc; - EndDialog(hWnd, true); - break; - } - - // Error - if (err == ERR_ACCESS_DENIED || err == ERR_AUTH_FAILED) - { - if (flag) - { - if (MsgBox(hWnd, MB_ICONEXCLAMATION | MB_RETRYCANCEL, - _E(err)) == IDCANCEL) - { - EndDialog(hWnd, false); - break; - } - } - flag = true; - goto RETRY_PASSWORD; - } - else - { - if (MsgBox(hWnd, MB_ICONEXCLAMATION | MB_RETRYCANCEL, - _E(err)) == IDCANCEL) - { - EndDialog(hWnd, false); - break; - } - goto RETRY_CONNECT; - } - } - break; - } - break; - } - - return 0; -} - -// Connect to the User-mode NAT program -RPC *NmConnect(char *hostname, UINT port) -{ - NM_CONNECT t; - // Validate arguments - if (hostname == NULL || port == 0) - { - return NULL; - } - - Zero(&t, sizeof(t)); - t.Hostname = hostname; - t.Port = port; - - Dialog(NULL, D_NM_CONNECT, NmConnectDlgProc, &t); - - return t.Rpc; -} - -// Main process -void MainNM() -{ - UINT port; - char hostname[MAX_HOST_NAME_LEN + 1]; - char *tmp = - RemoteDlg(NULL, NM_SETTING_REG_KEY, ICO_ROUTER, - _UU("NM_TITLE"), _UU("NM_CONNECT_TITLE"), NULL); - TOKEN_LIST *t; - - Zero(hostname, sizeof(hostname)); - - if (tmp == NULL) - { - return; - } - - t = ParseToken(tmp, ":"); - port = DEFAULT_NAT_ADMIN_PORT; - - if (t->NumTokens >= 2) - { - UINT i = ToInt(t->Token[1]); - if (i != 0) - { - port = i; - } - } - if (t->NumTokens >= 1) - { - RPC *rpc; - StrCpy(hostname, sizeof(hostname), t->Token[0]); - - // Connection - Trim(hostname); - - if (StrLen(hostname) != 0) - { - rpc = NmConnect(hostname, port); - if (rpc != NULL) - { - // Connected - NmMainDlg(rpc); - NatAdminDisconnect(rpc); - } - } - } - - FreeToken(t); - - Free(tmp); -} - -// Initialize -void InitNM() -{ - if (nm != NULL) - { - // Already initialized - return; - } - - nm = ZeroMalloc(sizeof(NM)); - - InitWinUi(_UU("NM_TITLE"), _SS("DEFAULT_FONT"), _II("DEFAULT_FONT_SIZE")); - - nm->Cedar = NewCedar(NULL, NULL); - - InitCM(false); - InitSM(); -} - -// Release -void FreeNM() -{ - if (nm == NULL) - { - // Uninitialized - return; - } - - FreeSM(); - FreeCM(); - - ReleaseCedar(nm->Cedar); - - FreeWinUi(); - - Free(nm); - nm = NULL; -} - -// Execution of NM -void NMExec() -{ - InitNM(); - MainNM(); - FreeNM(); -} - -#endif - +// SoftEther VPN Source Code - Developer Edition Master Branch +// Cedar Communication Module + + +// NM.c +// VPN User-mode Router Manager for Win32 + +#include + +#ifdef WIN32 + +#define SM_C +#define CM_C +#define NM_C + +#define _WIN32_WINNT 0x0502 +#define WINVER 0x0502 +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "CMInner.h" +#include "SMInner.h" +#include "NMInner.h" +#include "EMInner.h" +#include "../PenCore/resource.h" + +// Global variable +static NM *nm = NULL; + +// Dialog proc for the push routing option +UINT NmEditPushRouteProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param) +{ + SM_HUB *r = (SM_HUB *)param; + char *str = NULL; + // Validate arguments + if (hWnd == NULL) + { + return 0; + } + + switch (msg) + { + case WM_INITDIALOG: + SetTextA(hWnd, E_TEXT, r->CurrentPushRouteStr); + Focus(hWnd, E_TEXT); + + SetIcon(hWnd, 0, ICO_PROTOCOL); + break; + + case WM_COMMAND: + switch (wParam) + { + case IDOK: + str = GetTextA(hWnd, E_TEXT); + if (str != NULL) + { + bool ok = true; + + if (CheckClasslessRouteTableStr(str) == false) + { + if (MsgBox(hWnd, MB_ICONWARNING | MB_OKCANCEL | MB_DEFBUTTON2, _UU("NM_PUSH_ROUTE_WARNING")) == IDCANCEL) + { + ok = false; + } + } + + if (ok) + { + if (IsEmptyStr(str) == false) + { + if (GetCapsBool(r->p->CapsList, "b_suppport_push_route") == false) + { + MsgBox(hWnd, MB_ICONEXCLAMATION, _UU("ERR_147")); + } + } + + StrCpy(r->CurrentPushRouteStr, sizeof(r->CurrentPushRouteStr), str); + + EndDialog(hWnd, 1); + } + + Free(str); + } + break; + + case IDCANCEL: + Close(hWnd); + break; + } + break; + + case WM_CLOSE: + EndDialog(hWnd, 0); + break; + } + + return 0; +} + +// Edit dialog for the push routing option +bool NmEditPushRoute(HWND hWnd, SM_HUB *r) +{ + // Validate arguments + if (r == NULL) + { + return false; + } + + return Dialog(hWnd, D_NM_PUSH, NmEditPushRouteProc, r); +} + +// Change Password dialog +UINT NmChangePasswordProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param) +{ + RPC *r = (RPC *)param; + char tmp1[MAX_SIZE]; + char tmp2[MAX_SIZE]; + RPC_SET_PASSWORD t; + // Validate arguments + if (hWnd == NULL) + { + return 0; + } + + switch (msg) + { + case WM_INITDIALOG: + FormatText(hWnd, 0, r->Sock->RemoteHostname); + FormatText(hWnd, S_TITLE, r->Sock->RemoteHostname); + break; + + case WM_COMMAND: + GetTxtA(hWnd, E_PASSWORD1, tmp1, sizeof(tmp1)); + GetTxtA(hWnd, E_PASSWORD2, tmp2, sizeof(tmp2)); + switch (LOWORD(wParam)) + { + case E_PASSWORD1: + case E_PASSWORD2: + SetEnable(hWnd, IDOK, StrCmp(tmp1, tmp2) == 0); + break; + } + + switch (wParam) + { + case IDOK: + Zero(&t, sizeof(t)); + Sha0(t.HashedPassword, tmp1, StrLen(tmp1)); + + if (CALL(hWnd, NcSetPassword(r, &t))) + { + MsgBox(hWnd, MB_ICONINFORMATION, _UU("NM_PASSWORD_MSG")); + EndDialog(hWnd, true); + } + break; + + case IDCANCEL: + Close(hWnd); + break; + } + break; + + case WM_CLOSE: + EndDialog(hWnd, false); + break; + } + + return 0; +} + +// Change the password +void NmChangePassword(HWND hWnd, RPC *r) +{ + // Validate arguments + if (hWnd == NULL || r == NULL) + { + return; + } + + Dialog(hWnd, D_NM_CHANGE_PASSWORD, NmChangePasswordProc, r); +} + +// DHCP enumeration initialization +void NmDhcpInit(HWND hWnd, SM_HUB *r) +{ + // Validate arguments + if (hWnd == NULL || r == NULL) + { + return; + } + + SetIcon(hWnd, 0, ICO_INTERNET); + + LvInit(hWnd, L_TABLE); + LvInsertColumn(hWnd, L_TABLE, 0, _UU("DHCP_DHCP_ID"), 50); + LvInsertColumn(hWnd, L_TABLE, 1, _UU("DHCP_LEASED_TIME"), 200); + LvInsertColumn(hWnd, L_TABLE, 2, _UU("DHCP_EXPIRE_TIME"), 200); + LvInsertColumn(hWnd, L_TABLE, 3, _UU("DHCP_MAC_ADDRESS"), 130); + LvInsertColumn(hWnd, L_TABLE, 4, _UU("DHCP_IP_ADDRESS"), 100); + LvInsertColumn(hWnd, L_TABLE, 5, _UU("DHCP_HOSTNAME"), 150); + + NmDhcpRefresh(hWnd, r); +} + +// DHCP enumeration +void NmDhcpRefresh(HWND hWnd, SM_HUB *r) +{ + LVB *b; + RPC_ENUM_DHCP t; + UINT i; + // Validate arguments + if (hWnd == NULL || r == NULL) + { + Close(hWnd); + return; + } + + Zero(&t, sizeof(t)); + + StrCpy(t.HubName, sizeof(t.HubName), r->HubName); + + if (CALL(hWnd, ScEnumDHCP(r->Rpc, &t)) == false) + { + return; + } + + b = LvInsertStart(); + + for (i = 0;i < t.NumItem;i++) + { + RPC_ENUM_DHCP_ITEM *e = &t.Items[i]; + wchar_t tmp0[MAX_SIZE]; + wchar_t tmp1[MAX_SIZE]; + wchar_t tmp2[MAX_SIZE]; + wchar_t tmp3[MAX_SIZE]; + wchar_t tmp4[MAX_SIZE]; + wchar_t tmp5[MAX_SIZE]; + char str[MAX_SIZE]; + + // ID + UniToStru(tmp0, e->Id); + + // Time + GetDateTimeStrEx64(tmp1, sizeof(tmp1), SystemToLocal64(e->LeasedTime), NULL); + GetDateTimeStrEx64(tmp2, sizeof(tmp2), SystemToLocal64(e->ExpireTime), NULL); + + MacToStr(str, sizeof(str), e->MacAddress); + StrToUni(tmp3, sizeof(tmp3), str); + + IPToStr32(str, sizeof(str), e->IpAddress); + StrToUni(tmp4, sizeof(tmp4), str); + + StrToUni(tmp5, sizeof(tmp5), e->Hostname); + + LvInsertAdd(b, ICO_INTERNET, NULL, 6, + tmp0, tmp1, tmp2, tmp3, tmp4, tmp5); + } + + LvInsertEnd(b, hWnd, L_TABLE); + + FreeRpcEnumDhcp(&t); +} + +// DHCP enumeration procedure +UINT NmDhcpProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param) +{ + SM_HUB *r = (SM_HUB *)param; + // Validate arguments + if (hWnd == NULL) + { + return 0; + } + + switch (msg) + { + case WM_INITDIALOG: + NmDhcpInit(hWnd, r); + SetTimer(hWnd, 1, NM_DHCP_REFRESH_TIME, NULL); + break; + + case WM_COMMAND: + switch (wParam) + { + case IDCANCEL: + Close(hWnd); + break; + + case B_REFRESH: + NmDhcpRefresh(hWnd, r); + break; + } + break; + + case WM_TIMER: + switch (wParam) + { + case 1: + KillTimer(hWnd, 1); + NmDhcpRefresh(hWnd, r); + SetTimer(hWnd, 1, NM_DHCP_REFRESH_TIME, NULL); + break; + } + break; + + case WM_CLOSE: + EndDialog(hWnd, false); + break; + } + + LvStandardHandler(hWnd, msg, wParam, lParam, L_TABLE); + + return 0; +} + +// DHCP enumeration +void NmDhcp(HWND hWnd, SM_HUB *r) +{ + // Validate arguments + if (hWnd == NULL || r == NULL) + { + return; + } + + Dialog(hWnd, D_NM_DHCP, NmDhcpProc, r); +} + + +// NAT enumeration initialization +void NmNatInit(HWND hWnd, SM_HUB *r) +{ + // Validate arguments + if (hWnd == NULL || r == NULL) + { + return; + } + + SetIcon(hWnd, 0, ICO_PROTOCOL); + + LvInit(hWnd, L_TABLE); + LvInsertColumn(hWnd, L_TABLE, 0, _UU("NM_NAT_ID"), 50); + LvInsertColumn(hWnd, L_TABLE, 1, _UU("NM_NAT_PROTOCOL"), 80); + LvInsertColumn(hWnd, L_TABLE, 2, _UU("NM_NAT_SRC_HOST"), 100); + LvInsertColumn(hWnd, L_TABLE, 3, _UU("NM_NAT_SRC_PORT"), 80); + LvInsertColumn(hWnd, L_TABLE, 4, _UU("NM_NAT_DST_HOST"), 150); + LvInsertColumn(hWnd, L_TABLE, 5, _UU("NM_NAT_DST_PORT"), 80); + LvInsertColumn(hWnd, L_TABLE, 6, _UU("NM_NAT_CREATED"), 200); + LvInsertColumn(hWnd, L_TABLE, 7, _UU("NM_NAT_LAST_COMM"), 200); + LvInsertColumn(hWnd, L_TABLE, 8, _UU("NM_NAT_SIZE"), 120); + LvInsertColumn(hWnd, L_TABLE, 9, _UU("NM_NAT_TCP_STATUS"), 120); + + NmNatRefresh(hWnd, r); +} + +// NAT enumeration +void NmNatRefresh(HWND hWnd, SM_HUB *r) +{ + LVB *b; + RPC_ENUM_NAT t; + UINT i; + // Validate arguments + if (hWnd == NULL || r == NULL) + { + return; + } + + Zero(&t, sizeof(t)); + + StrCpy(t.HubName, sizeof(t.HubName), r->HubName); + + if (CALL(hWnd, ScEnumNAT(r->Rpc, &t)) == false) + { + Close(hWnd); + return; + } + + b = LvInsertStart(); + + for (i = 0;i < t.NumItem;i++) + { + RPC_ENUM_NAT_ITEM *e = &t.Items[i]; + wchar_t tmp0[MAX_SIZE]; + wchar_t *tmp1 = L""; + wchar_t tmp2[MAX_SIZE]; + wchar_t tmp3[MAX_SIZE]; + wchar_t tmp4[MAX_SIZE]; + wchar_t tmp5[MAX_SIZE]; + wchar_t tmp6[MAX_SIZE]; + wchar_t tmp7[MAX_SIZE]; + wchar_t tmp8[MAX_SIZE]; + wchar_t *tmp9 = L""; + char v1[128], v2[128]; + + // ID + UniToStru(tmp0, e->Id); + + // Protocol + switch (e->Protocol) + { + case NAT_TCP: + tmp1 = _UU("NM_NAT_PROTO_TCP"); + break; + case NAT_UDP: + tmp1 = _UU("NM_NAT_PROTO_UDP"); + break; + case NAT_DNS: + tmp1 = _UU("NM_NAT_PROTO_DNS"); + break; + case NAT_ICMP: + tmp1 = _UU("NM_NAT_PROTO_ICMP"); + break; + } + + // Source host + StrToUni(tmp2, sizeof(tmp2), e->SrcHost); + + // Source port + UniToStru(tmp3, e->SrcPort); + + // Destination host + StrToUni(tmp4, sizeof(tmp4), e->DestHost); + + // Destination port + UniToStru(tmp5, e->DestPort); + + // Creation date and time of the session + GetDateTimeStrEx64(tmp6, sizeof(tmp6), SystemToLocal64(e->CreatedTime), NULL); + + // Last communication date and time + GetDateTimeStrEx64(tmp7, sizeof(tmp7), SystemToLocal64(e->LastCommTime), NULL); + + // Communication amount + ToStr3(v1, sizeof(v1), e->RecvSize); + ToStr3(v2, sizeof(v2), e->SendSize); + UniFormat(tmp8, sizeof(tmp8), L"%S / %S", v1, v2); + + // TCP state + if (e->Protocol == NAT_TCP) + { + switch (e->TcpStatus) + { + case NAT_TCP_CONNECTING: + tmp9 = _UU("NAT_TCP_CONNECTING"); + break; + case NAT_TCP_SEND_RESET: + tmp9 = _UU("NAT_TCP_SEND_RESET"); + break; + case NAT_TCP_CONNECTED: + tmp9 = _UU("NAT_TCP_CONNECTED"); + break; + case NAT_TCP_ESTABLISHED: + tmp9 = _UU("NAT_TCP_ESTABLISHED"); + break; + case NAT_TCP_WAIT_DISCONNECT: + tmp9 = _UU("NAT_TCP_WAIT_DISCONNECT"); + break; + } + } + + LvInsertAdd(b, ICO_PROTOCOL, NULL, 10, + tmp0, tmp1, tmp2, tmp3, tmp4, tmp5, tmp6, tmp7, tmp8, tmp9); + } + + LvInsertEnd(b, hWnd, L_TABLE); + + FreeRpcEnumNat(&t); +} + +// NAT enumeration procedure +UINT NmNatProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param) +{ + SM_HUB *r = (SM_HUB *)param; + // Validate arguments + if (hWnd == NULL) + { + return 0; + } + + switch (msg) + { + case WM_INITDIALOG: + NmNatInit(hWnd, r); + SetTimer(hWnd, 1, NM_NAT_REFRESH_TIME, NULL); + break; + + case WM_COMMAND: + switch (wParam) + { + case IDCANCEL: + Close(hWnd); + break; + + case B_REFRESH: + NmNatRefresh(hWnd, r); + break; + } + break; + + case WM_TIMER: + switch (wParam) + { + case 1: + KillTimer(hWnd, 1); + NmNatRefresh(hWnd, r); + SetTimer(hWnd, 1, NM_NAT_REFRESH_TIME, NULL); + break; + } + break; + + case WM_CLOSE: + EndDialog(hWnd, false); + break; + } + + LvStandardHandler(hWnd, msg, wParam, lParam, L_TABLE); + + return 0; +} + +// NAT enumeration +void NmNat(HWND hWnd, SM_HUB *r) +{ + // Validate arguments + if (hWnd == NULL || r == NULL) + { + return; + } + + Dialog(hWnd, D_NM_NAT, NmNatProc, r); +} + +// Show the information of the router +bool NmInfo(HWND hWnd, SM_SERVER *s, void *param) +{ + LVB *b; + RPC_NAT_INFO t; + wchar_t tmp[MAX_SIZE]; + // Validate arguments + if (hWnd == NULL || s == NULL) + { + return false; + } + + Zero(&t, sizeof(t)); + + if (CALL(hWnd, NcGetInfo(s->Rpc, &t)) == false) + { + return false; + } + + b = LvInsertStart(); + + StrToUni(tmp, sizeof(tmp), t.NatProductName); + LvInsertAdd(b, ICO_ROUTER, NULL, 2, _UU("NM_INFO_PRODUCT_NAME"), tmp); + + StrToUni(tmp, sizeof(tmp), t.NatVersionString); + LvInsertAdd(b, ICO_INFORMATION, NULL, 2, _UU("NM_INFO_VERSION_STR"), tmp); + + StrToUni(tmp, sizeof(tmp), t.NatBuildInfoString); + LvInsertAdd(b, ICO_INFORMATION, NULL, 2, _UU("NM_INFO_BUILD_INFO"), tmp); + + StrToUni(tmp, sizeof(tmp), t.NatHostName); + LvInsertAdd(b, ICO_TOWER, NULL, 2, _UU("NM_INFO_HOSTNAME"), tmp); + + // OS + StrToUni(tmp, sizeof(tmp), t.OsInfo.OsSystemName); + LvInsertAdd(b, ICO_MACHINE, NULL, 2, _UU("SM_OS_SYSTEM_NAME"), tmp); + + StrToUni(tmp, sizeof(tmp), t.OsInfo.OsProductName); + LvInsertAdd(b, ICO_MACHINE, NULL, 2, _UU("SM_OS_PRODUCT_NAME"), tmp); + + if (t.OsInfo.OsServicePack != 0) + { + UniFormat(tmp, sizeof(tmp), _UU("SM_OS_SP_TAG"), t.OsInfo.OsServicePack); + LvInsertAdd(b, ICO_MACHINE, NULL, 2, _UU("SM_OS_SERVICE_PACK"), tmp); + } + + StrToUni(tmp, sizeof(tmp), t.OsInfo.OsVendorName); + LvInsertAdd(b, ICO_MACHINE, NULL, 2, _UU("SM_OS_VENDER_NAME"), tmp); + + StrToUni(tmp, sizeof(tmp), t.OsInfo.OsVersion); + LvInsertAdd(b, ICO_MACHINE, NULL, 2, _UU("SM_OS_VERSION"), tmp); + + StrToUni(tmp, sizeof(tmp), t.OsInfo.KernelName); + LvInsertAdd(b, ICO_MACHINE, NULL, 2, _UU("SM_OS_KERNEL_NAME"), tmp); + + StrToUni(tmp, sizeof(tmp), t.OsInfo.KernelVersion); + LvInsertAdd(b, ICO_MACHINE, NULL, 2, _UU("SM_OS_KERNEL_VERSION"), tmp); + + // Memory information + if (t.MemInfo.TotalMemory != 0) + { + char vv[128]; + + ToStr3(vv, sizeof(vv), t.MemInfo.TotalMemory); + UniFormat(tmp, sizeof(tmp), _UU("SM_ST_RAM_SIZE_KB"), vv); + LvInsertAdd(b, ICO_MEMORY, NULL, 2, _UU("SM_ST_TOTAL_MEMORY"), tmp); + + ToStr3(vv, sizeof(vv), t.MemInfo.UsedMemory); + UniFormat(tmp, sizeof(tmp), _UU("SM_ST_RAM_SIZE_KB"), vv); + LvInsertAdd(b, ICO_MEMORY, NULL, 2, _UU("SM_ST_USED_MEMORY"), tmp); + + ToStr3(vv, sizeof(vv), t.MemInfo.FreeMemory); + UniFormat(tmp, sizeof(tmp), _UU("SM_ST_RAM_SIZE_KB"), vv); + LvInsertAdd(b, ICO_MEMORY, NULL, 2, _UU("SM_ST_FREE_MEMORY"), tmp); + + ToStr3(vv, sizeof(vv), t.MemInfo.TotalPhys); + UniFormat(tmp, sizeof(tmp), _UU("SM_ST_RAM_SIZE_KB"), vv); + LvInsertAdd(b, ICO_MEMORY, NULL, 2, _UU("SM_ST_TOTAL_PHYS"), tmp); + + ToStr3(vv, sizeof(vv), t.MemInfo.UsedPhys); + UniFormat(tmp, sizeof(tmp), _UU("SM_ST_RAM_SIZE_KB"), vv); + LvInsertAdd(b, ICO_MEMORY, NULL, 2, _UU("SM_ST_USED_PHYS"), tmp); + + ToStr3(vv, sizeof(vv), t.MemInfo.FreePhys); + UniFormat(tmp, sizeof(tmp), _UU("SM_ST_RAM_SIZE_KB"), vv); + LvInsertAdd(b, ICO_MEMORY, NULL, 2, _UU("SM_ST_FREE_PHYS"), tmp); + } + + LvInsertEnd(b, hWnd, L_STATUS); + + FreeRpcNatInfo(&t); + + return true; +} + +// Show the status of the router +bool NmStatus(HWND hWnd, SM_SERVER *s, void *param) +{ + LVB *b; + RPC_NAT_STATUS t; + wchar_t tmp[MAX_SIZE]; + SM_HUB *h = (SM_HUB *)param; + // Validate arguments + if (hWnd == NULL || s == NULL) + { + return false; + } + + Zero(&t, sizeof(t)); + + StrCpy(t.HubName, sizeof(t.HubName), h->HubName); + + if (CALL(hWnd, ScGetSecureNATStatus(s->Rpc, &t)) == false) + { + return false; + } + + b = LvInsertStart(); + + StrToUni(tmp, sizeof(tmp), h->HubName); + LvInsertAdd(b, ICO_HUB, NULL, 2, _UU("SM_HUB_COLUMN_1"), tmp); + + UniFormat(tmp, sizeof(tmp), _UU("SM_SNAT_NUM_SESSION"), t.NumTcpSessions); + LvInsertAdd(b, ICO_PROTOCOL, NULL, 2, _UU("NM_STATUS_TCP"), tmp); + + UniFormat(tmp, sizeof(tmp), _UU("SM_SNAT_NUM_SESSION"), t.NumUdpSessions); + LvInsertAdd(b, ICO_PROTOCOL, NULL, 2, _UU("NM_STATUS_UDP"), tmp); + + UniFormat(tmp, sizeof(tmp), _UU("SM_SNAT_NUM_SESSION"), t.NumIcmpSessions); + LvInsertAdd(b, ICO_PROTOCOL, NULL, 2, _UU("NM_STATUS_ICMP"), tmp); + + UniFormat(tmp, sizeof(tmp), _UU("SM_SNAT_NUM_SESSION"), t.NumDnsSessions); + LvInsertAdd(b, ICO_PROTOCOL, NULL, 2, _UU("NM_STATUS_DNS"), tmp); + + UniFormat(tmp, sizeof(tmp), _UU("SM_SNAT_NUM_CLIENT"), t.NumDhcpClients); + LvInsertAdd(b, ICO_PROTOCOL_DHCP, NULL, 2, _UU("NM_STATUS_DHCP"), tmp); + + LvInsertAdd(b, ICO_MACHINE, NULL, 2, _UU("SM_SNAT_IS_KERNEL"), t.IsKernelMode ? _UU("SEC_YES") : _UU("SEC_NO")); + LvInsertAdd(b, ICO_MACHINE, NULL, 2, _UU("SM_SNAT_IS_RAW"), t.IsRawIpMode ? _UU("SEC_YES") : _UU("SEC_NO")); + + LvInsertEnd(b, hWnd, L_STATUS); + + FreeRpcNatStatus(&t); + + return true; +} + +// Convert the contents of the form to the VH_OPTION +void NmEditVhOptionFormToVH(HWND hWnd, VH_OPTION *t) +{ + char tmp[MAX_SIZE]; + BUF *b; + // Validate arguments + if (hWnd == NULL || t == NULL) + { + return; + } + + Zero(t, sizeof(VH_OPTION)); + + GetTxtA(hWnd, E_MAC, tmp, sizeof(tmp)); + b = StrToBin(tmp); + if (b != NULL) + { + if (b->Size == 6) + { + Copy(t->MacAddress, b->Buf, 6); + } + FreeBuf(b); + } + + UINTToIP(&t->Ip, IpGet(hWnd, E_IP)); + UINTToIP(&t->Mask, IpGet(hWnd, E_MASK)); + + t->UseNat = IsChecked(hWnd, R_USE_NAT); + t->Mtu = GetInt(hWnd, E_MTU); + t->NatTcpTimeout = GetInt(hWnd, E_TCP); + t->NatUdpTimeout = GetInt(hWnd, E_UDP); + + t->UseDhcp = IsChecked(hWnd, R_USE_DHCP); + UINTToIP(&t->DhcpLeaseIPStart, IpGet(hWnd, E_DHCP_START)); + UINTToIP(&t->DhcpLeaseIPEnd, IpGet(hWnd, E_DHCP_END)); + UINTToIP(&t->DhcpSubnetMask, IpGet(hWnd, E_DHCP_MASK)); + t->DhcpExpireTimeSpan = GetInt(hWnd, E_EXPIRES); + UINTToIP(&t->DhcpGatewayAddress, IpGet(hWnd, E_GATEWAY)); + UINTToIP(&t->DhcpDnsServerAddress, IpGet(hWnd, E_DNS)); + UINTToIP(&t->DhcpDnsServerAddress2, IpGet(hWnd, E_DNS2)); + GetTxtA(hWnd, E_DOMAIN, t->DhcpDomainName, sizeof(t->DhcpDomainName)); + t->SaveLog = IsChecked(hWnd, R_SAVE_LOG); +} + +// Initialize +void NmEditVhOptionInit(HWND hWnd, SM_HUB *r) +{ + char tmp[MAX_SIZE]; + VH_OPTION t; + // Validate arguments + if (hWnd == NULL || r == NULL) + { + return; + } + + SetIcon(hWnd, 0, ICO_ROUTER); + + FormatText(hWnd, S_TITLE, r->HubName); + + Zero(&t, sizeof(VH_OPTION)); + StrCpy(t.HubName, sizeof(t.HubName), r->HubName); + if (CALL(hWnd, ScGetSecureNATOption(r->Rpc, &t)) == false) + { + EndDialog(hWnd, false); + return; + } + + if (GetCapsBool(r->p->CapsList, "b_virtual_nat_disabled")) + { + SetEnable(hWnd, R_USE_NAT, false); + Check(hWnd, R_USE_NAT, false); + } + + MacToStr(tmp, sizeof(tmp), t.MacAddress); + SetTextA(hWnd, E_MAC, tmp); + IpSet(hWnd, E_IP, IPToUINT(&t.Ip)); + IpSet(hWnd, E_MASK, IPToUINT(&t.Mask)); + + Check(hWnd, R_USE_NAT, t.UseNat); + SetIntEx(hWnd, E_MTU, t.Mtu); + SetIntEx(hWnd, E_TCP, t.NatTcpTimeout); + SetIntEx(hWnd, E_UDP, t.NatUdpTimeout); + + Check(hWnd, R_USE_DHCP, t.UseDhcp); + IpSet(hWnd, E_DHCP_START, IPToUINT(&t.DhcpLeaseIPStart)); + IpSet(hWnd, E_DHCP_END, IPToUINT(&t.DhcpLeaseIPEnd)); + IpSet(hWnd, E_DHCP_MASK, IPToUINT(&t.DhcpSubnetMask)); + SetIntEx(hWnd, E_EXPIRES, t.DhcpExpireTimeSpan); + + if (IPToUINT(&t.DhcpGatewayAddress) != 0) + { + IpSet(hWnd, E_GATEWAY, IPToUINT(&t.DhcpGatewayAddress)); + } + + if (IPToUINT(&t.DhcpDnsServerAddress) != 0) + { + IpSet(hWnd, E_DNS, IPToUINT(&t.DhcpDnsServerAddress)); + } + + if (IPToUINT(&t.DhcpDnsServerAddress2) != 0) + { + IpSet(hWnd, E_DNS2, IPToUINT(&t.DhcpDnsServerAddress2)); + } + + SetTextA(hWnd, E_DOMAIN, t.DhcpDomainName); + Check(hWnd, R_SAVE_LOG, t.SaveLog); + + StrCpy(r->CurrentPushRouteStr, sizeof(r->CurrentPushRouteStr), t.DhcpPushRoutes); + + if (GetCapsBool(r->p->CapsList, "b_suppport_push_route_config") == false) + { + Disable(hWnd, S_1); + Disable(hWnd, S_2); + Disable(hWnd, B_PUSH); + } + + NmEditVhOptionUpdate(hWnd, r); + +} + +void NmEditVhOptionUpdate(HWND hWnd, SM_HUB *r) +{ + VH_OPTION t; + bool ok = true; + // Validate arguments + if (hWnd == NULL || r == NULL) + { + return; + } + + NmEditVhOptionFormToVH(hWnd, &t); + + if (IsZero(t.MacAddress, 6)) + { + ok = false; + } + + if (IPToUINT(&t.Ip) == 0 || IPToUINT(&t.Mask) == 0) + { + ok = false; + } + + if (IpIsFilled(hWnd, E_IP) == false || IpIsFilled(hWnd, E_MASK) == false) + { + ok = false; + } + + if (IsHostIPAddress4(&t.Ip) == false || IsSubnetMask4(&t.Mask) == false) + { + ok = false; + } + + if (t.UseNat) + { + if (t.Mtu < 64 || t.Mtu > 1500) + { + ok = false; + } + + if (t.NatTcpTimeout < (NAT_TCP_MIN_TIMEOUT / 1000) || t.NatTcpTimeout > (NAT_TCP_MAX_TIMEOUT / 1000)) + { + ok = false; + } + + if (t.NatUdpTimeout < (NAT_UDP_MIN_TIMEOUT / 1000) || t.NatUdpTimeout > (NAT_UDP_MAX_TIMEOUT / 1000)) + { + ok = false; + } + } + + if (t.UseDhcp) + { + if (IpIsFilled(hWnd, E_DHCP_START) == false || IpIsFilled(hWnd, E_DHCP_END) == false || + IpIsFilled(hWnd, E_DHCP_MASK) == false) + { + ok = false; + } + + if (IpGetFilledNum(hWnd, E_GATEWAY) != 0 && IpGetFilledNum(hWnd, E_GATEWAY) != 4) + { + ok = false; + } + + if (IpGetFilledNum(hWnd, E_DNS) != 0 && IpGetFilledNum(hWnd, E_DNS) != 4) + { + ok = false; + } + + if (IpGetFilledNum(hWnd, E_DNS2) != 0 && IpGetFilledNum(hWnd, E_DNS2) != 4) + { + ok = false; + } + + if (IPToUINT(&t.DhcpLeaseIPStart) == 0 || IPToUINT(&t.DhcpLeaseIPEnd) == 0 || + IPToUINT(&t.DhcpSubnetMask) == 0) + { + ok = false; + } + + if (t.DhcpExpireTimeSpan < 15) + { + ok = false; + } + + if (Endian32(IPToUINT(&t.DhcpLeaseIPStart)) > Endian32(IPToUINT(&t.DhcpLeaseIPEnd))) + { + ok = false; + } + + if (IsHostIPAddress4(&t.DhcpLeaseIPStart) == false || + IsHostIPAddress4(&t.DhcpLeaseIPEnd) == false) + { + ok = false; + } + + if (IsSubnetMask4(&t.DhcpSubnetMask) == false) + { + ok = false; + } + } + + SetEnable(hWnd, E_MTU, t.UseNat); + SetEnable(hWnd, E_TCP, t.UseNat); + SetEnable(hWnd, E_UDP, t.UseNat); + + SetEnable(hWnd, E_DHCP_START, t.UseDhcp); + SetEnable(hWnd, E_DHCP_END, t.UseDhcp); + SetEnable(hWnd, E_DHCP_MASK, t.UseDhcp); + SetEnable(hWnd, E_EXPIRES, t.UseDhcp); + SetEnable(hWnd, E_GATEWAY, t.UseDhcp); + SetEnable(hWnd, E_DNS, t.UseDhcp); + SetEnable(hWnd, E_DNS2, t.UseDhcp); + SetEnable(hWnd, E_DOMAIN, t.UseDhcp); + + SetEnable(hWnd, IDOK, ok); +} + +// [OK] button +void NmEditVhOptionOnOk(HWND hWnd, SM_HUB *r) +{ + VH_OPTION t; + // Validate arguments + if (hWnd == NULL || r == NULL) + { + return; + } + + NmEditVhOptionFormToVH(hWnd, &t); + StrCpy(t.HubName, sizeof(t.HubName), r->HubName); + + t.ApplyDhcpPushRoutes = true; + StrCpy(t.DhcpPushRoutes, sizeof(t.DhcpPushRoutes), r->CurrentPushRouteStr); + + if (CALL(hWnd, ScSetSecureNATOption(r->Rpc, &t))) + { + EndDialog(hWnd, true); + } +} + +// Virtual host options editing dialog +UINT NmEditVhOptionProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param) +{ + SM_HUB *r = (SM_HUB *)param; + // Validate arguments + if (hWnd == NULL) + { + return 0; + } + + switch (msg) + { + case WM_INITDIALOG: + NmEditVhOptionInit(hWnd, r); + break; + + case WM_COMMAND: + switch (LOWORD(wParam)) + { + case E_MAC: + case E_IP: + case E_MASK: + case R_USE_NAT: + case E_MTU: + case E_TCP: + case E_UDP: + case R_SAVE_LOG: + case R_USE_DHCP: + case E_DHCP_START: + case E_DHCP_END: + case E_DHCP_MASK: + case E_EXPIRES: + case E_GATEWAY: + case E_DNS: + case E_DNS2: + case E_DOMAIN: + NmEditVhOptionUpdate(hWnd, r); + break; + } + + switch (wParam) + { + case IDOK: + NmEditVhOptionOnOk(hWnd, r); + break; + + case IDCANCEL: + EndDialog(hWnd, false); + break; + + case R_USE_NAT: + if (IsChecked(hWnd, R_USE_NAT)) + { + FocusEx(hWnd, E_MTU); + } + + if (IsChecked(hWnd, R_USE_DHCP)) + { + Focus(hWnd, E_DHCP_START); + } + break; + + case B_PUSH: + NmEditPushRoute(hWnd, r); + break; + } + + break; + } + + return 0; +} + +// Edit the virtual host option +void NmEditVhOption(HWND hWnd, SM_HUB *r) +{ + // Validate arguments + if (hWnd == NULL || r == NULL) + { + return; + } + + Zero(r->CurrentPushRouteStr, sizeof(r->CurrentPushRouteStr)); + Dialog(hWnd, D_NM_OPTION, NmEditVhOptionProc, r); +} + +// Edit the client configuration +void NmEditClientConfig(HWND hWnd, RPC *r) +{ + CM_ACCOUNT a; + RPC_CREATE_LINK t; + bool ret = false; + // Validate arguments + if (hWnd == NULL || r == NULL) + { + return; + } + + Zero(&a, sizeof(a)); + Zero(&t, sizeof(t)); + + a.ClientOption = ZeroMalloc(sizeof(CLIENT_OPTION)); + a.NatMode = true; + a.Rpc = r; + + if (CALLEX(hWnd, NcGetClientConfig(r, &t)) != ERR_NO_ERROR) + { + // Create New + a.ClientOption->Port = 443; + a.ClientOption->RetryInterval = 15; + a.ClientOption->NumRetry = INFINITE; + a.ClientOption->AdditionalConnectionInterval = 1; + a.ClientOption->UseEncrypt = true; + a.ClientOption->NoRoutingTracking = true; + a.ClientAuth = ZeroMalloc(sizeof(CLIENT_AUTH)); + a.ClientAuth->AuthType = CLIENT_AUTHTYPE_PASSWORD; + } + else + { + // Edit + a.EditMode = true; + Copy(a.ClientOption, t.ClientOption, sizeof(CLIENT_OPTION)); + a.ClientAuth = CopyClientAuth(t.ClientAuth); + + FreeRpcCreateLink(&t); + } + + ret = CmEditAccountDlg(hWnd, &a); + + Free(a.ServerCert); + Free(a.ClientOption); + CiFreeClientAuth(a.ClientAuth); +} + +// Initialize +void NmMainDlgInit(HWND hWnd, RPC *r) +{ + // Validate arguments + if (r == NULL || hWnd == NULL) + { + return; + } + + SetIcon(hWnd, 0, ICO_ROUTER); + FormatText(hWnd, 0, r->Sock->RemoteHostname); + DlgFont(hWnd, S_STATUS, 11, true); + + NmMainDlgRefresh(hWnd, r); +} + +// Update +void NmMainDlgRefresh(HWND hWnd, RPC *r) +{ +#if 0 + RPC_NAT_STATUS t; + wchar_t tmp[MAX_SIZE]; + wchar_t tmp2[MAX_SIZE]; + // Validate arguments + if (r == NULL || hWnd == NULL) + { + return; + } + + Zero(&t, sizeof(RPC_NAT_STATUS)); + + CALL(hWnd, NcGetStatus(r, &t)); + + if (t.Online == false) + { + UniStrCpy(tmp, sizeof(tmp), _UU("NM_OFFLINE")); + + Enable(hWnd, B_CONNECT); + Disable(hWnd, B_DISCONNECT); + } + else + { + if (t.Connected) + { + UniFormat(tmp, sizeof(tmp), _UU("NM_CONNECTED"), t.Status.ServerName); + } + else + { + if (t.LastError == ERR_NO_ERROR) + { + UniStrCpy(tmp, sizeof(tmp), _UU("NM_CONNECTING")); + } + else + { + UniFormat(tmp, sizeof(tmp), _UU("NM_CONNECT_ERROR"), t.LastError, _E(t.LastError)); + } + } + Disable(hWnd, B_CONNECT); + Enable(hWnd, B_DISCONNECT); + } + + UniFormat(tmp2, sizeof(tmp2), _UU("NM_STATUS_TAG"), tmp); + + SetText(hWnd, S_STATUS, tmp2); + + FreeRpcNatStatus(&t); +#endif +} + +// Main dialog procedure +UINT NmMainDlgProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param) +{ +#if 0 + SM_HUB *r = (SM_HUB *)param; + RPC_DUMMY dummy; + SM_SERVER sm; + // Validate arguments + if (hWnd == NULL) + { + return 0; + } + + switch (msg) + { + case WM_INITDIALOG: + NmMainDlgInit(hWnd, r); + + SetTimer(hWnd, 1, NM_REFRESH_TIME, NULL); + + break; + + case WM_COMMAND: + switch (wParam) + { + case B_SETTING: + // Connection setting + NmEditClientConfig(hWnd, r); + break; + + case B_CONNECT: + // Connection + Zero(&dummy, sizeof(dummy)); + CALL(hWnd, NcOnline(r, &dummy)); + NmMainDlgRefresh(hWnd, r); + break; + + case B_DISCONNECT: + // Disconnect + Zero(&dummy, sizeof(dummy)); + CALL(hWnd, NcOffline(r, &dummy)); + NmMainDlgRefresh(hWnd, r); + break; + + case B_OPTION: + // Operation setting + NmEditVhOption(hWnd, r->Rpc); + break; + + case B_NAT: + // NAT + NmNat(hWnd, r); + break; + + case B_DHCP: + // DHCP + NmDhcp(hWnd, r); + break; + + case B_STATUS: + // Status + Zero(&sm, sizeof(sm)); + sm.Rpc = r; + SmStatusDlg(hWnd, &sm, NULL, true, true, _UU("NM_STATUS"), ICO_ROUTER, + NULL, NmStatus); + break; + + case B_INFO: + // Information + Zero(&sm, sizeof(sm)); + sm.Rpc = r; + SmStatusDlg(hWnd, &sm, NULL, false, true, _UU("NM_INFO"), ICO_ROUTER, + NULL, NmInfo); + break; + + case B_REFRESH: + // Refresh + NmMainDlgRefresh(hWnd, r); + break; + + case B_PASSWORD: + // Change the password + NmChangePassword(hWnd, r); + break; + + case B_ABOUT: + // Version information + About(hWnd, nm->Cedar, CEDAR_ROUTER_STR); + break; + + case IDCANCEL: + Close(hWnd); + break; + } + break; + + case WM_TIMER: + switch (wParam) + { + case 1: + KillTimer(hWnd, 1); + + if (IsEnable(hWnd, 0)) + { + NmMainDlgRefresh(hWnd, r); + } + + SetTimer(hWnd, 1, NM_REFRESH_TIME, NULL); + break; + } + break; + + case WM_CLOSE: + EndDialog(hWnd, false); + break; + } + +#endif + + return 0; +} + +// Main dialog +void NmMainDlg(RPC *r) +{ + // Validate arguments + if (r == NULL) + { + return; + } + + Dialog(NULL, D_NM_MAIN, NmMainDlgProc, r); +} + +// Login dialog +UINT NmLogin(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param) +{ + NM_LOGIN *login = (NM_LOGIN *)param; + char tmp[MAX_SIZE]; + // Validate arguments + if (hWnd == NULL) + { + return 0; + } + + switch (msg) + { + case WM_INITDIALOG: + FormatText(hWnd, S_TITLE, login->Hostname); + break; + + case WM_COMMAND: + switch (wParam) + { + case IDOK: + GetTxtA(hWnd, E_PASSWORD, tmp, sizeof(tmp)); + Sha0(login->hashed_password, tmp, StrLen(tmp)); + EndDialog(hWnd, true); + break; + + case IDCANCEL: + Close(hWnd); + break; + } + break; + + case WM_CLOSE: + EndDialog(hWnd, false); + break; + } + + return 0; +} + +// Connecting dialog +UINT NmConnectDlgProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param) +{ + NM_CONNECT *t = (NM_CONNECT *)param; + RPC *rpc; + NM_LOGIN login; + UINT err; + // Validate arguments + if (hWnd == NULL) + { + return 0; + } + + switch (msg) + { + case WM_INITDIALOG: + FormatText(hWnd, S_TITLE, t->Hostname); + SetTimer(hWnd, 1, 50, NULL); + break; + + case WM_TIMER: + switch (wParam) + { + case 1: + KillTimer(hWnd, 1); + + while (true) + { + bool flag = false; +RETRY_PASSWORD: + // Password input dialog + Zero(&login, sizeof(login)); + login.Hostname = t->Hostname; + login.Port = t->Port; + Sha0(login.hashed_password, "", 0); + + if (flag) + { + if (Dialog(hWnd, D_NM_LOGIN, NmLogin, &login) == false) + { + EndDialog(hWnd, false); + break; + } + } + +RETRY_CONNECT: + Refresh(DlgItem(hWnd, S_TITLE)); + Refresh(hWnd); + // Connection + rpc = NatAdminConnect(nm->Cedar, t->Hostname, t->Port, login.hashed_password, &err); + if (rpc != NULL) + { + t->Rpc = rpc; + EndDialog(hWnd, true); + break; + } + + // Error + if (err == ERR_ACCESS_DENIED || err == ERR_AUTH_FAILED) + { + if (flag) + { + if (MsgBox(hWnd, MB_ICONEXCLAMATION | MB_RETRYCANCEL, + _E(err)) == IDCANCEL) + { + EndDialog(hWnd, false); + break; + } + } + flag = true; + goto RETRY_PASSWORD; + } + else + { + if (MsgBox(hWnd, MB_ICONEXCLAMATION | MB_RETRYCANCEL, + _E(err)) == IDCANCEL) + { + EndDialog(hWnd, false); + break; + } + goto RETRY_CONNECT; + } + } + break; + } + break; + } + + return 0; +} + +// Connect to the User-mode NAT program +RPC *NmConnect(char *hostname, UINT port) +{ + NM_CONNECT t; + // Validate arguments + if (hostname == NULL || port == 0) + { + return NULL; + } + + Zero(&t, sizeof(t)); + t.Hostname = hostname; + t.Port = port; + + Dialog(NULL, D_NM_CONNECT, NmConnectDlgProc, &t); + + return t.Rpc; +} + +// Main process +void MainNM() +{ + UINT port; + char hostname[MAX_HOST_NAME_LEN + 1]; + char *tmp = + RemoteDlg(NULL, NM_SETTING_REG_KEY, ICO_ROUTER, + _UU("NM_TITLE"), _UU("NM_CONNECT_TITLE"), NULL); + TOKEN_LIST *t; + + Zero(hostname, sizeof(hostname)); + + if (tmp == NULL) + { + return; + } + + t = ParseToken(tmp, ":"); + port = DEFAULT_NAT_ADMIN_PORT; + + if (t->NumTokens >= 2) + { + UINT i = ToInt(t->Token[1]); + if (i != 0) + { + port = i; + } + } + if (t->NumTokens >= 1) + { + RPC *rpc; + StrCpy(hostname, sizeof(hostname), t->Token[0]); + + // Connection + Trim(hostname); + + if (StrLen(hostname) != 0) + { + rpc = NmConnect(hostname, port); + if (rpc != NULL) + { + // Connected + NmMainDlg(rpc); + NatAdminDisconnect(rpc); + } + } + } + + FreeToken(t); + + Free(tmp); +} + +// Initialize +void InitNM() +{ + if (nm != NULL) + { + // Already initialized + return; + } + + nm = ZeroMalloc(sizeof(NM)); + + InitWinUi(_UU("NM_TITLE"), _SS("DEFAULT_FONT"), _II("DEFAULT_FONT_SIZE")); + + nm->Cedar = NewCedar(NULL, NULL); + + InitCM(false); + InitSM(); +} + +// Release +void FreeNM() +{ + if (nm == NULL) + { + // Uninitialized + return; + } + + FreeSM(); + FreeCM(); + + ReleaseCedar(nm->Cedar); + + FreeWinUi(); + + Free(nm); + nm = NULL; +} + +// Execution of NM +void NMExec() +{ + InitNM(); + MainNM(); + FreeNM(); +} + +#endif + diff --git a/src/Cedar/NM.h b/src/Cedar/NM.h index 375594a2..73ce9642 100644 --- a/src/Cedar/NM.h +++ b/src/Cedar/NM.h @@ -1,16 +1,16 @@ -// SoftEther VPN Source Code - Developer Edition Master Branch -// Cedar Communication Module - - -// NM.h -// Header of NM.c - -#ifndef NM_H -#define NM_H - -// External function -void NMExec(); - -#endif // NM_H - - +// SoftEther VPN Source Code - Developer Edition Master Branch +// Cedar Communication Module + + +// NM.h +// Header of NM.c + +#ifndef NM_H +#define NM_H + +// External function +void NMExec(); + +#endif // NM_H + + diff --git a/src/Cedar/NMInner.h b/src/Cedar/NMInner.h index ab9b6a22..a0b36e5d 100644 --- a/src/Cedar/NMInner.h +++ b/src/Cedar/NMInner.h @@ -1,72 +1,72 @@ -// SoftEther VPN Source Code - Developer Edition Master Branch -// Cedar Communication Module - - -// NMInner.h -// The internal header of NM.c - - -// Constants -#define NM_REG_KEY "Software\\" GC_REG_COMPANY_NAME "\\PacketiX VPN\\User-mode Router Manager" -#define NM_SETTING_REG_KEY "Software\\" GC_REG_COMPANY_NAME "\\PacketiX VPN\\User-mode Router Manager\\Settings" - -#define NM_REFRESH_TIME 1000 -#define NM_NAT_REFRESH_TIME 1000 -#define NM_DHCP_REFRESH_TIME 1000 - -// Nat Admin structure -typedef struct NM -{ - CEDAR *Cedar; // Cedar -} NM; - -// Connection structure -typedef struct NM_CONNECT -{ - RPC *Rpc; // RPC - char *Hostname; - UINT Port; -} NM_CONNECT; - -// Login -typedef struct NM_LOGIN -{ - char *Hostname; - UINT Port; - UCHAR hashed_password[SHA1_SIZE]; -} NM_LOGIN; - -// Internal function -void InitNM(); -void FreeNM(); -void MainNM(); -RPC *NmConnect(char *hostname, UINT port); -UINT NmConnectDlgProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param); -UINT NmLogin(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param); -void NmMainDlg(RPC *r); -UINT NmMainDlgProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param); -void NmMainDlgInit(HWND hWnd, RPC *r); -void NmMainDlgRefresh(HWND hWnd, RPC *r); -void NmEditClientConfig(HWND hWnd, RPC *r); -void NmEditVhOption(HWND hWnd, SM_HUB *r); -UINT NmEditVhOptionProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param); -void NmEditVhOptionInit(HWND hWnd, SM_HUB *r); -void NmEditVhOptionUpdate(HWND hWnd, SM_HUB *r); -void NmEditVhOptionOnOk(HWND hWnd, SM_HUB *r); -void NmEditVhOptionFormToVH(HWND hWnd, VH_OPTION *t); -bool NmStatus(HWND hWnd, SM_SERVER *s, void *param); -bool NmInfo(HWND hWnd, SM_SERVER *s, void *param); -void NmNat(HWND hWnd, SM_HUB *r); -UINT NmNatProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param); -void NmNatInit(HWND hWnd, SM_HUB *r); -void NmNatRefresh(HWND hWnd, SM_HUB *r); -void NmDhcp(HWND hWnd, SM_HUB *r); -UINT NmDhcpProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param); -void NmDhcpRefresh(HWND hWnd, SM_HUB *r); -void NmDhcpInit(HWND hWnd, SM_HUB *r); -void NmChangePassword(HWND hWnd, RPC *r); -UINT NmChangePasswordProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param); -bool NmEditPushRoute(HWND hWnd, SM_HUB *r); -UINT NmEditPushRouteProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param); - - +// SoftEther VPN Source Code - Developer Edition Master Branch +// Cedar Communication Module + + +// NMInner.h +// The internal header of NM.c + + +// Constants +#define NM_REG_KEY "Software\\" GC_REG_COMPANY_NAME "\\PacketiX VPN\\User-mode Router Manager" +#define NM_SETTING_REG_KEY "Software\\" GC_REG_COMPANY_NAME "\\PacketiX VPN\\User-mode Router Manager\\Settings" + +#define NM_REFRESH_TIME 1000 +#define NM_NAT_REFRESH_TIME 1000 +#define NM_DHCP_REFRESH_TIME 1000 + +// Nat Admin structure +typedef struct NM +{ + CEDAR *Cedar; // Cedar +} NM; + +// Connection structure +typedef struct NM_CONNECT +{ + RPC *Rpc; // RPC + char *Hostname; + UINT Port; +} NM_CONNECT; + +// Login +typedef struct NM_LOGIN +{ + char *Hostname; + UINT Port; + UCHAR hashed_password[SHA1_SIZE]; +} NM_LOGIN; + +// Internal function +void InitNM(); +void FreeNM(); +void MainNM(); +RPC *NmConnect(char *hostname, UINT port); +UINT NmConnectDlgProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param); +UINT NmLogin(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param); +void NmMainDlg(RPC *r); +UINT NmMainDlgProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param); +void NmMainDlgInit(HWND hWnd, RPC *r); +void NmMainDlgRefresh(HWND hWnd, RPC *r); +void NmEditClientConfig(HWND hWnd, RPC *r); +void NmEditVhOption(HWND hWnd, SM_HUB *r); +UINT NmEditVhOptionProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param); +void NmEditVhOptionInit(HWND hWnd, SM_HUB *r); +void NmEditVhOptionUpdate(HWND hWnd, SM_HUB *r); +void NmEditVhOptionOnOk(HWND hWnd, SM_HUB *r); +void NmEditVhOptionFormToVH(HWND hWnd, VH_OPTION *t); +bool NmStatus(HWND hWnd, SM_SERVER *s, void *param); +bool NmInfo(HWND hWnd, SM_SERVER *s, void *param); +void NmNat(HWND hWnd, SM_HUB *r); +UINT NmNatProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param); +void NmNatInit(HWND hWnd, SM_HUB *r); +void NmNatRefresh(HWND hWnd, SM_HUB *r); +void NmDhcp(HWND hWnd, SM_HUB *r); +UINT NmDhcpProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param); +void NmDhcpRefresh(HWND hWnd, SM_HUB *r); +void NmDhcpInit(HWND hWnd, SM_HUB *r); +void NmChangePassword(HWND hWnd, RPC *r); +UINT NmChangePasswordProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param); +bool NmEditPushRoute(HWND hWnd, SM_HUB *r); +UINT NmEditPushRouteProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param); + + diff --git a/src/Cedar/Nat.c b/src/Cedar/Nat.c index 63852fb5..1278de0a 100644 --- a/src/Cedar/Nat.c +++ b/src/Cedar/Nat.c @@ -1,1818 +1,1818 @@ -// SoftEther VPN Source Code - Developer Edition Master Branch -// Cedar Communication Module - - -// Nat.c -// User-mode Router - -#include "CedarPch.h" - -static LOCK *nat_lock = NULL; -static NAT *nat = NULL; - - -// Disconnect the connection for the NAT administrator -void NatAdminDisconnect(RPC *r) -{ - // Validate arguments - if (r == NULL) - { - return; - } - - EndRpc(r); -} - -// Connection for NAT administrator -RPC *NatAdminConnect(CEDAR *cedar, char *hostname, UINT port, void *hashed_password, UINT *err) -{ - UCHAR secure_password[SHA1_SIZE]; - UCHAR random[SHA1_SIZE]; - SOCK *sock; - RPC *rpc; - PACK *p; - UINT error; - // Validate arguments - if (cedar == NULL || hostname == NULL || port == 0 || hashed_password == NULL || err == NULL) - { - if (err != NULL) - { - *err = ERR_INTERNAL_ERROR; - } - return NULL; - } - - // Connection - sock = Connect(hostname, port); - if (sock == NULL) - { - *err = ERR_CONNECT_FAILED; - return NULL; - } - - if (StartSSL(sock, NULL, NULL) == false) - { - *err = ERR_PROTOCOL_ERROR; - ReleaseSock(sock); - return NULL; - } - - SetTimeout(sock, 5000); - - p = HttpClientRecv(sock); - if (p == NULL) - { - *err = ERR_DISCONNECTED; - ReleaseSock(sock); - return NULL; - } - - if (PackGetData2(p, "auth_random", random, SHA1_SIZE) == false) - { - FreePack(p); - *err = ERR_PROTOCOL_ERROR; - ReleaseSock(sock); - return NULL; - } - - FreePack(p); - - SecurePassword(secure_password, hashed_password, random); - - p = NewPack(); - PackAddData(p, "secure_password", secure_password, SHA1_SIZE); - - if (HttpClientSend(sock, p) == false) - { - FreePack(p); - *err = ERR_DISCONNECTED; - ReleaseSock(sock); - return NULL; - } - - FreePack(p); - - p = HttpClientRecv(sock); - if (p == NULL) - { - *err = ERR_DISCONNECTED; - ReleaseSock(sock); - return NULL; - } - - error = GetErrorFromPack(p); - - FreePack(p); - - if (error != ERR_NO_ERROR) - { - *err = error; - ReleaseSock(sock); - return NULL; - } - - SetTimeout(sock, TIMEOUT_INFINITE); - - rpc = StartRpcClient(sock, NULL); - ReleaseSock(sock); - - return rpc; -} - -// RPC functional related macro -#define DECLARE_RPC_EX(rpc_name, data_type, function, in_rpc, out_rpc, free_rpc) \ - else if (StrCmpi(name, rpc_name) == 0) \ - { \ - data_type t; \ - Zero(&t, sizeof(t)); \ - in_rpc(&t, p); \ - err = function(n, &t); \ - if (err == ERR_NO_ERROR) \ - { \ - out_rpc(ret, &t); \ - } \ - free_rpc(&t); \ - ok = true; \ - } -#define DECLARE_RPC(rpc_name, data_type, function, in_rpc, out_rpc) \ - else if (StrCmpi(name, rpc_name) == 0) \ - { \ - data_type t; \ - Zero(&t, sizeof(t)); \ - in_rpc(&t, p); \ - err = function(n, &t); \ - if (err == ERR_NO_ERROR) \ - { \ - out_rpc(ret, &t); \ - } \ - ok = true; \ - } -#define DECLARE_SC_EX(rpc_name, data_type, function, in_rpc, out_rpc, free_rpc) \ - UINT function(RPC *r, data_type *t) \ - { \ - PACK *p, *ret; \ - UINT err; \ - if (r == NULL || t == NULL) \ - { \ - return ERR_INTERNAL_ERROR; \ - } \ - p = NewPack(); \ - out_rpc(p, t); \ - free_rpc(t); \ - Zero(t, sizeof(data_type)); \ - ret = AdminCall(r, rpc_name, p); \ - err = GetErrorFromPack(ret); \ - if (err == ERR_NO_ERROR) \ - { \ - in_rpc(t, ret); \ - } \ - FreePack(ret); \ - return err; \ - } -#define DECLARE_SC(rpc_name, data_type, function, in_rpc, out_rpc) \ - UINT function(RPC *r, data_type *t) \ - { \ - PACK *p, *ret; \ - UINT err; \ - if (r == NULL || t == NULL) \ - { \ - return ERR_INTERNAL_ERROR; \ - } \ - p = NewPack(); \ - out_rpc(p, t); \ - ret = AdminCall(r, rpc_name, p); \ - err = GetErrorFromPack(ret); \ - if (err == ERR_NO_ERROR) \ - { \ - in_rpc(t, ret); \ - } \ - FreePack(ret); \ - return err; \ - } - -// RPC server function -PACK *NiRpcServer(RPC *r, char *name, PACK *p) -{ - NAT *n; - PACK *ret; - UINT err; - bool ok; - // Validate arguments - if (r == NULL || name == NULL || p == NULL) - { - return NULL; - } - - n = (NAT *)r->Param; - ret = NewPack(); - err = ERR_NO_ERROR; - ok = false; - - if (0) {} - - // RPC function definition: From here - -// DECLARE_RPC("Online", RPC_DUMMY, NtOnline, InRpcDummy, OutRpcDummy) -// DECLARE_RPC("Offline", RPC_DUMMY, NtOffline, InRpcDummy, OutRpcDummy) - DECLARE_RPC("SetHostOption", VH_OPTION, NtSetHostOption, InVhOption, OutVhOption) - DECLARE_RPC("GetHostOption", VH_OPTION, NtGetHostOption, InVhOption, OutVhOption) -// DECLARE_RPC_EX("SetClientConfig", RPC_CREATE_LINK, NtSetClientConfig, InRpcCreateLink, OutRpcCreateLink, FreeRpcCreateLink) -// DECLARE_RPC_EX("GetClientConfig", RPC_CREATE_LINK, NtGetClientConfig, InRpcCreateLink, OutRpcCreateLink, FreeRpcCreateLink) - DECLARE_RPC_EX("GetStatus", RPC_NAT_STATUS, NtGetStatus, InRpcNatStatus, OutRpcNatStatus, FreeRpcNatStatus) -// DECLARE_RPC_EX("GetInfo", RPC_NAT_INFO, NtGetInfo, InRpcNatInfo, OutRpcNatInfo, FreeRpcNatInfo) - DECLARE_RPC_EX("EnumNatList", RPC_ENUM_NAT, NtEnumNatList, InRpcEnumNat, OutRpcEnumNat, FreeRpcEnumNat) - DECLARE_RPC_EX("EnumDhcpList", RPC_ENUM_DHCP, NtEnumDhcpList, InRpcEnumDhcp, OutRpcEnumDhcp, FreeRpcEnumDhcp) -// DECLARE_RPC("SetPassword", RPC_SET_PASSWORD, NtSetPassword, InRpcSetPassword, OutRpcSetPassword) - - // RPC function definition: To here - - if (ok == false) - { - err = ERR_NOT_SUPPORTED; - } - - PackAddInt(ret, "error", err); - - return ret; -} - - - - -// RPC call definition: From here - -DECLARE_SC("Online", RPC_DUMMY, NcOnline, InRpcDummy, OutRpcDummy) -DECLARE_SC("Offline", RPC_DUMMY, NcOffline, InRpcDummy, OutRpcDummy) -DECLARE_SC("SetHostOption", VH_OPTION, NcSetHostOption, InVhOption, OutVhOption) -DECLARE_SC("GetHostOption", VH_OPTION, NcGetHostOption, InVhOption, OutVhOption) -DECLARE_SC_EX("SetClientConfig", RPC_CREATE_LINK, NcSetClientConfig, InRpcCreateLink, OutRpcCreateLink, FreeRpcCreateLink) -DECLARE_SC_EX("GetClientConfig", RPC_CREATE_LINK, NcGetClientConfig, InRpcCreateLink, OutRpcCreateLink, FreeRpcCreateLink) -DECLARE_SC_EX("GetStatus", RPC_NAT_STATUS, NcGetStatus, InRpcNatStatus, OutRpcNatStatus, FreeRpcNatStatus) -DECLARE_SC_EX("GetInfo", RPC_NAT_INFO, NcGetInfo, InRpcNatInfo, OutRpcNatInfo, FreeRpcNatInfo) -DECLARE_SC_EX("EnumNatList", RPC_ENUM_NAT, NcEnumNatList, InRpcEnumNat, OutRpcEnumNat, FreeRpcEnumNat) -DECLARE_SC_EX("EnumDhcpList", RPC_ENUM_DHCP, NcEnumDhcpList, InRpcEnumDhcp, OutRpcEnumDhcp, FreeRpcEnumDhcp) -DECLARE_SC("SetPassword", RPC_SET_PASSWORD, NcSetPassword, InRpcSetPassword, OutRpcSetPassword) - -// RPC call definition: To here - - - -// Set a password -UINT NtSetPassword(NAT *n, RPC_SET_PASSWORD *t) -{ - Copy(n->HashedPassword, t->HashedPassword, SHA1_SIZE); - - NiWriteConfig(n); - - return ERR_NO_ERROR; -} - -// Online -UINT NtOnline(NAT *n, RPC_DUMMY *t) -{ - UINT ret = ERR_NO_ERROR; - - Lock(n->lock); - { - if (n->Online) - { - // It is already online - ret = ERR_ALREADY_ONLINE; - } - else - { - if (n->ClientOption == NULL || n->ClientAuth == NULL) - { - // Setting is not yet done - ret = ERR_ACCOUNT_NOT_PRESENT; - } - else - { - // OK - n->Online = true; - - // Start connection - n->Virtual = NewVirtualHostEx(n->Cedar, n->ClientOption, n->ClientAuth, - &n->Option, n); - } - } - } - Unlock(n->lock); - - NiWriteConfig(n); - - return ret; -} - -// Offline -UINT NtOffline(NAT *n, RPC_DUMMY *t) -{ - UINT ret = ERR_NO_ERROR; - - Lock(n->lock); - { - if (n->Online == false) - { - // It is offline - ret = ERR_OFFLINE; - } - else - { - // Offline - StopVirtualHost(n->Virtual); - ReleaseVirtual(n->Virtual); - n->Virtual = NULL; - - n->Online = false; - } - } - Unlock(n->lock); - - NiWriteConfig(n); - - return ret; -} - -// Set host options -UINT NtSetHostOption(NAT *n, VH_OPTION *t) -{ - UINT ret = ERR_NO_ERROR; - - Lock(n->lock); - { - Copy(&n->Option, t, sizeof(VH_OPTION)); - } - Unlock(n->lock); - - SetVirtualHostOption(n->Virtual, t); - - NiWriteConfig(n); - - return ret; -} - -// Get host options -UINT NtGetHostOption(NAT *n, VH_OPTION *t) -{ - UINT ret = ERR_NO_ERROR; - - Lock(n->lock); - { - Copy(t, &n->Option, sizeof(VH_OPTION)); - } - Unlock(n->lock); - - return ret; -} - -// Set the connection settings -UINT NtSetClientConfig(NAT *n, RPC_CREATE_LINK *t) -{ - Lock(n->lock); - { - if (n->ClientOption != NULL || n->ClientAuth != NULL) - { - Free(n->ClientOption); - CiFreeClientAuth(n->ClientAuth); - } - - n->ClientOption = ZeroMalloc(sizeof(CLIENT_OPTION)); - Copy(n->ClientOption, t->ClientOption, sizeof(CLIENT_OPTION)); - n->ClientAuth = CopyClientAuth(t->ClientAuth); - } - Unlock(n->lock); - - NiWriteConfig(n); - - if (n->Online) - { - NtOffline(n, NULL); - NtOnline(n, NULL); - } - - return ERR_NO_ERROR; -} - -// Get the connection settings -UINT NtGetClientConfig(NAT *n, RPC_CREATE_LINK *t) -{ - UINT err = ERR_NO_ERROR; - - Lock(n->lock); - { - if (n->ClientOption == NULL || n->ClientAuth == NULL) - { - err = ERR_ACCOUNT_NOT_PRESENT; - } - else - { - FreeRpcCreateLink(t); - - Zero(t, sizeof(RPC_CREATE_LINK)); - t->ClientOption = ZeroMalloc(sizeof(CLIENT_OPTION)); - Copy(t->ClientOption, n->ClientOption, sizeof(CLIENT_OPTION)); - t->ClientAuth = CopyClientAuth(n->ClientAuth); - } - } - Unlock(n->lock); - - return err; -} - -// Get the state -UINT NtGetStatus(NAT *n, RPC_NAT_STATUS *t) -{ - Lock(n->lock); - { - VH *v = n->Virtual; - FreeRpcNatStatus(t); - Zero(t, sizeof(RPC_NAT_STATUS)); - - LockVirtual(v); - { - UINT i; - - LockList(v->NatTable); - { - for (i = 0;i < LIST_NUM(v->NatTable);i++) - { - NAT_ENTRY *e = LIST_DATA(v->NatTable, i); - - switch (e->Protocol) - { - case NAT_TCP: - t->NumTcpSessions++; - break; - - case NAT_UDP: - t->NumUdpSessions++; - break; - - case NAT_ICMP: - t->NumIcmpSessions++; - break; - - case NAT_DNS: - t->NumDnsSessions++; - break; - } - } - - if (NnIsActive(v) && v->NativeNat != NULL) - { - NATIVE_NAT *nn = v->NativeNat; - - for (i = 0;i < LIST_NUM(nn->NatTableForSend->AllList);i++) - { - NATIVE_NAT_ENTRY *e = LIST_DATA(nn->NatTableForSend->AllList, i); - - switch (e->Protocol) - { - case NAT_TCP: - t->NumTcpSessions++; - break; - - case NAT_UDP: - t->NumUdpSessions++; - break; - - case NAT_ICMP: - t->NumIcmpSessions++; - break; - - case NAT_DNS: - t->NumDnsSessions++; - break; - } - } - } - } - UnlockList(v->NatTable); - - t->NumDhcpClients = LIST_NUM(v->DhcpLeaseList); - - t->IsKernelMode = NnIsActiveEx(v, &t->IsRawIpMode); - } - UnlockVirtual(v); - } - Unlock(n->lock); - - return ERR_NO_ERROR; -} - -// Get the information -UINT NtGetInfo(NAT *n, RPC_NAT_INFO *t) -{ - OS_INFO *info; - FreeRpcNatInfo(t); - Zero(t, sizeof(RPC_NAT_INFO)); - - StrCpy(t->NatProductName, sizeof(t->NatProductName), CEDAR_ROUTER_STR); - StrCpy(t->NatVersionString, sizeof(t->NatVersionString), n->Cedar->VerString); - StrCpy(t->NatBuildInfoString, sizeof(t->NatBuildInfoString), n->Cedar->BuildInfo); - t->NatVerInt = n->Cedar->Build; - t->NatBuildInt = n->Cedar->Build; - - GetMachineName(t->NatHostName, sizeof(t->NatHostName)); - - info = GetOsInfo(); - - CopyOsInfo(&t->OsInfo, info); - - GetMemInfo(&t->MemInfo); - - return ERR_NO_ERROR; -} - -// Get the NAT list -UINT NtEnumNatList(NAT *n, RPC_ENUM_NAT *t) -{ - UINT ret = ERR_NO_ERROR; - VH *v = NULL; - - Lock(n->lock); - { - v = n->Virtual; - - if (n->Online == false || v == NULL) - { - ret = ERR_OFFLINE; - } - else - { - LockVirtual(v); - { - if (v->Active == false) - { - ret = ERR_OFFLINE; - } - else - { - FreeRpcEnumNat(t); - Zero(t, sizeof(RPC_ENUM_NAT)); - - LockList(v->NatTable); - { - UINT i; - UINT num_usermode_nat = LIST_NUM(v->NatTable); - UINT num_kernel_mode_nat = 0; - NATIVE_NAT *native = NULL; - - if (NnIsActive(v) && (v->NativeNat != NULL)) - { - native = v->NativeNat; - - num_kernel_mode_nat = LIST_NUM(native->NatTableForSend->AllList); - } - - t->NumItem = num_usermode_nat + num_kernel_mode_nat; - t->Items = ZeroMalloc(sizeof(RPC_ENUM_NAT_ITEM) * t->NumItem); - - // Enumerate entries of the user mode NAT - for (i = 0;i < num_usermode_nat;i++) - { - NAT_ENTRY *nat = LIST_DATA(v->NatTable, i); - RPC_ENUM_NAT_ITEM *e = &t->Items[i]; - - e->Id = nat->Id; - e->Protocol = nat->Protocol; - e->SrcIp = nat->SrcIp; - e->DestIp = nat->DestIp; - e->SrcPort = nat->SrcPort; - e->DestPort = nat->DestPort; - - e->CreatedTime = TickToTime(nat->CreatedTime); - e->LastCommTime = TickToTime(nat->LastCommTime); - - IPToStr32(e->SrcHost, sizeof(e->SrcHost), e->SrcIp); - IPToStr32(e->DestHost, sizeof(e->DestHost), e->DestIp); - - if (nat->Sock != NULL) - { - e->SendSize = nat->Sock->SendSize; - e->RecvSize = nat->Sock->RecvSize; - - if (nat->Sock->Type == SOCK_TCP) - { - StrCpy(e->DestHost, sizeof(e->DestHost), nat->Sock->RemoteHostname); - } - } - - e->TcpStatus = nat->TcpStatus; - } - - // Enumerate the entries in the kernel-mode NAT - if (native != NULL) - { - for (i = 0;i < num_kernel_mode_nat;i++) - { - NATIVE_NAT_ENTRY *nat = LIST_DATA(native->NatTableForSend->AllList, i); - RPC_ENUM_NAT_ITEM *e = &t->Items[num_usermode_nat + i]; - - e->Id = nat->Id; - e->Protocol = nat->Protocol; - e->SrcIp = nat->SrcIp; - e->DestIp = nat->DestIp; - e->SrcPort = nat->SrcPort; - e->DestPort = nat->DestPort; - e->CreatedTime = TickToTime(nat->CreatedTime); - e->LastCommTime = TickToTime(nat->LastCommTime); - - IPToStr32(e->SrcHost, sizeof(e->SrcHost), e->SrcIp); - IPToStr32(e->DestHost, sizeof(e->DestHost), e->DestIp); - - e->SendSize = nat->TotalSent; - e->RecvSize = nat->TotalRecv; - - e->TcpStatus = nat->Status; - } - } - } - UnlockList(v->NatTable); - } - } - UnlockVirtual(v); - } - } - Unlock(n->lock); - - return ret; -} - -UINT NtEnumDhcpList(NAT *n, RPC_ENUM_DHCP *t) -{ - UINT ret = ERR_NO_ERROR; - VH *v = NULL; - - Lock(n->lock); - { - v = n->Virtual; - - if (n->Online == false || v == NULL) - { - ret = ERR_OFFLINE; - } - else - { - LockVirtual(v); - { - if (v->Active == false) - { - ret = ERR_OFFLINE; - } - else - { - FreeRpcEnumDhcp(t); - Zero(t, sizeof(RPC_ENUM_DHCP)); - - LockList(v->DhcpLeaseList); - { - UINT i; - t->NumItem = LIST_NUM(v->DhcpLeaseList); - t->Items = ZeroMalloc(sizeof(RPC_ENUM_DHCP_ITEM) * t->NumItem); - - for (i = 0;i < t->NumItem;i++) - { - DHCP_LEASE *dhcp = LIST_DATA(v->DhcpLeaseList, i); - RPC_ENUM_DHCP_ITEM *e = &t->Items[i]; - - e->Id = dhcp->Id; - e->LeasedTime = TickToTime(dhcp->LeasedTime); - e->ExpireTime = TickToTime(dhcp->ExpireTime); - Copy(e->MacAddress, dhcp->MacAddress, 6); - e->IpAddress = dhcp->IpAddress; - e->Mask = dhcp->Mask; - StrCpy(e->Hostname, sizeof(e->Hostname), dhcp->Hostname); - } - } - UnlockList(v->DhcpLeaseList); - } - } - UnlockVirtual(v); - } - } - Unlock(n->lock); - - return ret; -} - -// VH_OPTION -void InVhOption(VH_OPTION *t, PACK *p) -{ - // Validate arguments - if (t == NULL || p == NULL) - { - return; - } - - Zero(t, sizeof(VH_OPTION)); - PackGetData2(p, "MacAddress", t->MacAddress, 6); - PackGetIp(p, "Ip", &t->Ip); - PackGetIp(p, "Mask", &t->Mask); - t->UseNat = PackGetBool(p, "UseNat"); - t->Mtu = PackGetInt(p, "Mtu"); - t->NatTcpTimeout = PackGetInt(p, "NatTcpTimeout"); - t->NatUdpTimeout = PackGetInt(p, "NatUdpTimeout"); - t->UseDhcp = PackGetBool(p, "UseDhcp"); - PackGetIp(p, "DhcpLeaseIPStart", &t->DhcpLeaseIPStart); - PackGetIp(p, "DhcpLeaseIPEnd", &t->DhcpLeaseIPEnd); - PackGetIp(p, "DhcpSubnetMask", &t->DhcpSubnetMask); - t->DhcpExpireTimeSpan = PackGetInt(p, "DhcpExpireTimeSpan"); - PackGetIp(p, "DhcpGatewayAddress", &t->DhcpGatewayAddress); - PackGetIp(p, "DhcpDnsServerAddress", &t->DhcpDnsServerAddress); - PackGetIp(p, "DhcpDnsServerAddress2", &t->DhcpDnsServerAddress2); - PackGetStr(p, "DhcpDomainName", t->DhcpDomainName, sizeof(t->DhcpDomainName)); - t->SaveLog = PackGetBool(p, "SaveLog"); - PackGetStr(p, "RpcHubName", t->HubName, sizeof(t->HubName)); - t->ApplyDhcpPushRoutes = PackGetBool(p, "ApplyDhcpPushRoutes"); - PackGetStr(p, "DhcpPushRoutes", t->DhcpPushRoutes, sizeof(t->DhcpPushRoutes)); -} -void OutVhOption(PACK *p, VH_OPTION *t) -{ - // Validate arguments - if (t == NULL || p == NULL) - { - return; - } - - PackAddData(p, "MacAddress", t->MacAddress, 6); - PackAddIp(p, "Ip", &t->Ip); - PackAddIp(p, "Mask", &t->Mask); - PackAddBool(p, "UseNat", t->UseNat); - PackAddInt(p, "Mtu", t->Mtu); - PackAddInt(p, "NatTcpTimeout", t->NatTcpTimeout); - PackAddInt(p, "NatUdpTimeout", t->NatUdpTimeout); - PackAddBool(p, "UseDhcp", t->UseDhcp); - PackAddIp(p, "DhcpLeaseIPStart", &t->DhcpLeaseIPStart); - PackAddIp(p, "DhcpLeaseIPEnd", &t->DhcpLeaseIPEnd); - PackAddIp(p, "DhcpSubnetMask", &t->DhcpSubnetMask); - PackAddInt(p, "DhcpExpireTimeSpan", t->DhcpExpireTimeSpan); - PackAddIp(p, "DhcpGatewayAddress", &t->DhcpGatewayAddress); - PackAddIp(p, "DhcpDnsServerAddress", &t->DhcpDnsServerAddress); - PackAddIp(p, "DhcpDnsServerAddress2", &t->DhcpDnsServerAddress2); - PackAddStr(p, "DhcpDomainName", t->DhcpDomainName); - PackAddBool(p, "SaveLog", t->SaveLog); - PackAddStr(p, "RpcHubName", t->HubName); - PackAddBool(p, "ApplyDhcpPushRoutes", true); - PackAddStr(p, "DhcpPushRoutes", t->DhcpPushRoutes); -} - -// RPC_ENUM_DHCP -void InRpcEnumDhcp(RPC_ENUM_DHCP *t, PACK *p) -{ - UINT i; - // Validate arguments - if (t == NULL || p == NULL) - { - return; - } - - Zero(t, sizeof(RPC_ENUM_DHCP)); - t->NumItem = PackGetInt(p, "NumItem"); - t->Items = ZeroMalloc(sizeof(RPC_ENUM_DHCP_ITEM) * t->NumItem); - PackGetStr(p, "HubName", t->HubName, sizeof(t->HubName)); - - for (i = 0;i < t->NumItem;i++) - { - RPC_ENUM_DHCP_ITEM *e = &t->Items[i]; - - e->Id = PackGetIntEx(p, "Id", i); - e->LeasedTime = PackGetInt64Ex(p, "LeasedTime", i); - e->ExpireTime = PackGetInt64Ex(p, "ExpireTime", i); - PackGetDataEx2(p, "MacAddress", e->MacAddress, 6, i); - e->IpAddress = PackGetIp32Ex(p, "IpAddress", i); - e->Mask = PackGetIntEx(p, "Mask", i); - PackGetStrEx(p, "Hostname", e->Hostname, sizeof(e->Hostname), i); - } -} -void OutRpcEnumDhcp(PACK *p, RPC_ENUM_DHCP *t) -{ - UINT i; - // Validate arguments - if (p == NULL || t == NULL) - { - return; - } - - PackAddInt(p, "NumItem", t->NumItem); - PackAddStr(p, "HubName", t->HubName); - - PackSetCurrentJsonGroupName(p, "DhcpTable"); - for (i = 0;i < t->NumItem;i++) - { - RPC_ENUM_DHCP_ITEM *e = &t->Items[i]; - - PackAddIntEx(p, "Id", e->Id, i, t->NumItem); - PackAddTime64Ex(p, "LeasedTime", e->LeasedTime, i, t->NumItem); - PackAddTime64Ex(p, "ExpireTime", e->ExpireTime, i, t->NumItem); - PackAddDataEx(p, "MacAddress", e->MacAddress, 6, i, t->NumItem); - PackAddIp32Ex(p, "IpAddress", e->IpAddress, i, t->NumItem); - PackAddIntEx(p, "Mask", e->Mask, i, t->NumItem); - PackAddStrEx(p, "Hostname", e->Hostname, i, t->NumItem); - } - PackSetCurrentJsonGroupName(p, NULL); -} -void FreeRpcEnumDhcp(RPC_ENUM_DHCP *t) -{ - // Validate arguments - if (t == NULL) - { - return; - } - - Free(t->Items); -} - -// RPC_ENUM_NAT -void InRpcEnumNat(RPC_ENUM_NAT *t, PACK *p) -{ - UINT i; - // Validate arguments - if (t == NULL || p == NULL) - { - return; - } - - Zero(t, sizeof(RPC_ENUM_NAT)); - t->NumItem = PackGetInt(p, "NumItem"); - PackGetStr(p, "HubName", t->HubName, sizeof(t->HubName)); - t->Items = ZeroMalloc(sizeof(RPC_ENUM_NAT_ITEM) * t->NumItem); - for (i = 0;i < t->NumItem;i++) - { - RPC_ENUM_NAT_ITEM *e = &t->Items[i]; - - e->Id = PackGetIntEx(p, "Id", i); - e->Protocol = PackGetIntEx(p, "Protocol", i); - e->SrcIp = PackGetIntEx(p, "SrcIp", i); - PackGetStrEx(p, "SrcHost", e->SrcHost, sizeof(e->SrcHost), i); - e->SrcPort = PackGetIntEx(p, "SrcPort", i); - e->DestIp = PackGetIntEx(p, "DestIp", i); - PackGetStrEx(p, "DestHost", e->DestHost, sizeof(e->DestHost), i); - e->DestPort = PackGetIntEx(p, "DestPort", i); - e->CreatedTime = PackGetInt64Ex(p, "CreatedTime", i); - e->LastCommTime = PackGetInt64Ex(p, "LastCommTime", i); - e->SendSize = PackGetInt64Ex(p, "SendSize", i); - e->RecvSize = PackGetInt64Ex(p, "RecvSize", i); - e->TcpStatus = PackGetIntEx(p, "TcpStatus", i); - } -} -void OutRpcEnumNat(PACK *p, RPC_ENUM_NAT *t) -{ - UINT i; - // Validate arguments - if (t == NULL || p == NULL) - { - return; - } - - PackAddInt(p, "NumItem", t->NumItem); - PackAddStr(p, "HubName", t->HubName); - - PackSetCurrentJsonGroupName(p, "NatTable"); - for (i = 0;i < t->NumItem;i++) - { - RPC_ENUM_NAT_ITEM *e = &t->Items[i]; - - PackAddIntEx(p, "Id", e->Id, i, t->NumItem); - PackAddIntEx(p, "Protocol", e->Protocol, i, t->NumItem); - PackAddIp32Ex(p, "SrcIp", e->SrcIp, i, t->NumItem); - PackAddStrEx(p, "SrcHost", e->SrcHost, i, t->NumItem); - PackAddIntEx(p, "SrcPort", e->SrcPort, i, t->NumItem); - PackAddIp32Ex(p, "DestIp", e->DestIp, i, t->NumItem); - PackAddStrEx(p, "DestHost", e->DestHost, i, t->NumItem); - PackAddIntEx(p, "DestPort", e->DestPort, i, t->NumItem); - PackAddTime64Ex(p, "CreatedTime", e->CreatedTime, i, t->NumItem); - PackAddTime64Ex(p, "LastCommTime", e->LastCommTime, i, t->NumItem); - PackAddInt64Ex(p, "SendSize", e->SendSize, i, t->NumItem); - PackAddInt64Ex(p, "RecvSize", e->RecvSize, i, t->NumItem); - PackAddIntEx(p, "TcpStatus", e->TcpStatus, i, t->NumItem); - } - PackSetCurrentJsonGroupName(p, NULL); -} -void FreeRpcEnumNat(RPC_ENUM_NAT *t) -{ - // Validate arguments - if (t == NULL) - { - return; - } - - Free(t->Items); -} - -// RPC_NAT_INFO -void InRpcNatInfo(RPC_NAT_INFO *t, PACK *p) -{ - // Validate arguments - if (t == NULL || p == NULL) - { - return; - } - - Zero(t, sizeof(RPC_NAT_INFO)); - PackGetStr(p, "NatProductName", t->NatProductName, sizeof(t->NatProductName)); - PackGetStr(p, "NatVersionString", t->NatVersionString, sizeof(t->NatVersionString)); - PackGetStr(p, "NatBuildInfoString", t->NatBuildInfoString, sizeof(t->NatBuildInfoString)); - t->NatVerInt = PackGetInt(p, "NatVerInt"); - t->NatBuildInt = PackGetInt(p, "NatBuildInt"); - PackGetStr(p, "NatHostName", t->NatHostName, sizeof(t->NatHostName)); - InRpcOsInfo(&t->OsInfo, p); - InRpcMemInfo(&t->MemInfo, p); -} -void OutRpcNatInfo(PACK *p, RPC_NAT_INFO *t) -{ - // Validate arguments - if (t == NULL || p == NULL) - { - return; - } - - PackAddStr(p, "NatProductName", t->NatProductName); - PackAddStr(p, "NatVersionString", t->NatVersionString); - PackAddStr(p, "NatBuildInfoString", t->NatBuildInfoString); - PackAddInt(p, "NatVerInt", t->NatVerInt); - PackAddInt(p, "NatBuildInt", t->NatBuildInt); - PackAddStr(p, "NatHostName", t->NatHostName); - OutRpcOsInfo(p, &t->OsInfo); - OutRpcMemInfo(p, &t->MemInfo); -} -void FreeRpcNatInfo(RPC_NAT_INFO *t) -{ - // Validate arguments - if (t == NULL) - { - return; - } - - FreeRpcOsInfo(&t->OsInfo); -} - -// RPC_NAT_STATUS -void InRpcNatStatus(RPC_NAT_STATUS *t, PACK *p) -{ - // Validate arguments - if (t == NULL || p == NULL) - { - return; - } - - Zero(t, sizeof(RPC_NAT_STATUS)); - t->NumTcpSessions = PackGetInt(p, "NumTcpSessions"); - t->NumUdpSessions = PackGetInt(p, "NumUdpSessions"); - t->NumIcmpSessions = PackGetInt(p, "NumIcmpSessions"); - t->NumDnsSessions = PackGetInt(p, "NumDnsSessions"); - t->NumDhcpClients = PackGetInt(p, "NumDhcpClients"); - t->IsKernelMode = PackGetBool(p, "IsKernelMode"); - t->IsRawIpMode = PackGetBool(p, "IsRawIpMode"); - PackGetStr(p, "HubName", t->HubName, sizeof(t->HubName)); -} -void OutRpcNatStatus(PACK *p, RPC_NAT_STATUS *t) -{ - // Validate arguments - if (p == NULL || t == NULL) - { - return; - } - - PackAddStr(p, "HubName", t->HubName); - PackAddInt(p, "NumTcpSessions", t->NumTcpSessions); - PackAddInt(p, "NumUdpSessions", t->NumUdpSessions); - PackAddInt(p, "NumIcmpSessions", t->NumIcmpSessions); - PackAddInt(p, "NumDnsSessions", t->NumDnsSessions); - PackAddInt(p, "NumDhcpClients", t->NumDhcpClients); - PackAddBool(p, "IsKernelMode", t->IsKernelMode); - PackAddBool(p, "IsRawIpMode", t->IsRawIpMode); -} -void FreeRpcNatStatus(RPC_NAT_STATUS *t) -{ -} - -// RPC_DUMMY -void InRpcDummy(RPC_DUMMY *t, PACK *p) -{ - // Validate arguments - if (t == NULL || p == NULL) - { - return; - } - - Zero(t, sizeof(RPC_DUMMY)); - t->DummyValue = PackGetInt(p, "DummyValue"); -} -void OutRpcDummy(PACK *p, RPC_DUMMY *t) -{ - // Validate arguments - if (t == NULL || p == NULL) - { - return; - } - - PackAddInt(p, "DummyValue", t->DummyValue); -} - -// Main procedure for management -void NiAdminMain(NAT *n, SOCK *s) -{ - RPC *r; - PACK *p; - // Validate arguments - if (n == NULL || s == NULL) - { - return; - } - - p = NewPack(); - HttpServerSend(s, p); - FreePack(p); - - r = StartRpcServer(s, NiRpcServer, n); - - RpcServer(r); - - RpcFree(r); -} - -// Management thread -void NiAdminThread(THREAD *thread, void *param) -{ - NAT_ADMIN *a = (NAT_ADMIN *)param; - NAT *n; - SOCK *s; - UCHAR random[SHA1_SIZE]; - UINT err; - // Validate arguments - if (thread == NULL || param == NULL) - { - return; - } - - // Random number generation - Rand(random, sizeof(random)); - - a->Thread = thread; - AddRef(a->Thread->ref); - s = a->Sock; - AddRef(s->ref); - - n = a->Nat; - - LockList(n->AdminList); - { - Add(n->AdminList, a); - } - UnlockList(n->AdminList); - - NoticeThreadInit(thread); - - err = ERR_AUTH_FAILED; - - if (StartSSL(s, n->AdminX, n->AdminK)) - { - PACK *p; - - // Send the random number - p = NewPack(); - PackAddData(p, "auth_random", random, sizeof(random)); - - if (HttpServerSend(s, p)) - { - PACK *p; - // Receive a password - p = HttpServerRecv(s); - if (p != NULL) - { - UCHAR secure_password[SHA1_SIZE]; - UCHAR secure_check[SHA1_SIZE]; - - if (PackGetData2(p, "secure_password", secure_password, sizeof(secure_password))) - { - SecurePassword(secure_check, n->HashedPassword, random); - - if (Cmp(secure_check, secure_password, SHA1_SIZE) == 0) - { - UCHAR test[SHA1_SIZE]; - // Password match - Sha0(test, "", 0); - SecurePassword(test, test, random); - -#if 0 - if (Cmp(test, secure_check, SHA1_SIZE) == 0 && s->RemoteIP.addr[0] != 127) - { - // A client can not connect from the outside with blank password - err = ERR_NULL_PASSWORD_LOCAL_ONLY; - } - else -#endif - - { - // Successful connection - err = ERR_NO_ERROR; - NiAdminMain(n, s); - } - } - } - - FreePack(p); - } - } - - FreePack(p); - - if (err != ERR_NO_ERROR) - { - p = PackError(err); - HttpServerSend(s, p); - FreePack(p); - } - } - - Disconnect(s); - ReleaseSock(s); -} - -// Management port Listen thread -void NiListenThread(THREAD *thread, void *param) -{ - NAT *n = (NAT *)param; - SOCK *a; - UINT i; - bool b = false; - // Validate arguments - if (thread == NULL || param == NULL) - { - return; - } - - // Initialize the management list - n->AdminList = NewList(NULL); - - while (true) - { - a = Listen(DEFAULT_NAT_ADMIN_PORT); - if (b == false) - { - b = true; - NoticeThreadInit(thread); - } - if (a != NULL) - { - break; - } - - Wait(n->HaltEvent, NAT_ADMIN_PORT_LISTEN_INTERVAL); - if (n->Halt) - { - return; - } - } - - n->AdminListenSock = a; - AddRef(a->ref); - - // Waiting - while (true) - { - SOCK *s = Accept(a); - THREAD *t; - NAT_ADMIN *admin; - if (s == NULL) - { - break; - } - if (n->Halt) - { - ReleaseSock(s); - break; - } - - admin = ZeroMalloc(sizeof(NAT_ADMIN)); - admin->Nat = n; - admin->Sock = s; - t = NewThread(NiAdminThread, admin); - WaitThreadInit(t); - ReleaseThread(t); - } - - // Disconnect all management connections - LockList(n->AdminList); - { - for (i = 0;i < LIST_NUM(n->AdminList);i++) - { - NAT_ADMIN *a = LIST_DATA(n->AdminList, i); - Disconnect(a->Sock); - WaitThread(a->Thread, INFINITE); - ReleaseThread(a->Thread); - ReleaseSock(a->Sock); - Free(a); - } - } - UnlockList(n->AdminList); - - ReleaseList(n->AdminList); - - ReleaseSock(a); -} - -// Initialize receiving management command -void NiInitAdminAccept(NAT *n) -{ - THREAD *t; - // Validate arguments - if (n == NULL) - { - return; - } - - t = NewThread(NiListenThread, n); - WaitThreadInit(t); - n->AdminAcceptThread = t; -} - -// Complete receiving management command -void NiFreeAdminAccept(NAT *n) -{ - // Validate arguments - if (n == NULL) - { - return; - } - - n->Halt = true; - Disconnect(n->AdminListenSock); - Set(n->HaltEvent); - - while (true) - { - if (WaitThread(n->AdminAcceptThread, 1000) == false) - { - Disconnect(n->AdminListenSock); - } - else - { - break; - } - } - ReleaseThread(n->AdminAcceptThread); - - ReleaseSock(n->AdminListenSock); -} - -// Clear the DHCP options that are not supported by the dynamic Virtual HUB -void NiClearUnsupportedVhOptionForDynamicHub(VH_OPTION *o, bool initial) -{ - // Validate arguments - if (o == NULL) - { - return; - } - - o->UseNat = false; - - if (initial) - { - Zero(&o->DhcpGatewayAddress, sizeof(IP)); - Zero(&o->DhcpDnsServerAddress, sizeof(IP)); - Zero(&o->DhcpDnsServerAddress2, sizeof(IP)); - StrCpy(o->DhcpDomainName, sizeof(o->DhcpDomainName), ""); - } -} - -// Initialize the options for the virtual host -void NiSetDefaultVhOption(NAT *n, VH_OPTION *o) -{ - // Validate arguments - if (o == NULL) - { - return; - } - - Zero(o, sizeof(VH_OPTION)); - GenMacAddress(o->MacAddress); - - // Set the virtual IP to 192.168.30.1/24 - SetIP(&o->Ip, 192, 168, 30, 1); - SetIP(&o->Mask, 255, 255, 255, 0); - o->UseNat = true; - o->Mtu = 1500; - o->NatTcpTimeout = 1800; - o->NatUdpTimeout = 60; - o->UseDhcp = true; - SetIP(&o->DhcpLeaseIPStart, 192, 168, 30, 10); - SetIP(&o->DhcpLeaseIPEnd, 192, 168, 30, 200); - SetIP(&o->DhcpSubnetMask, 255, 255, 255, 0); - o->DhcpExpireTimeSpan = 7200; - o->SaveLog = true; - - SetIP(&o->DhcpGatewayAddress, 192, 168, 30, 1); - SetIP(&o->DhcpDnsServerAddress, 192, 168, 30, 1); - - GetDomainName(o->DhcpDomainName, sizeof(o->DhcpDomainName)); -} - -// Reset the setting of NAT to the default -void NiInitDefaultConfig(NAT *n) -{ - // Validate arguments - if (n == NULL) - { - return; - } - - // Initialize the virtual host option - NiSetDefaultVhOption(n, &n->Option); - - // Initialize management port - n->AdminPort = DEFAULT_NAT_ADMIN_PORT; - - // Offline - n->Online = false; - - // Save the log - n->Option.SaveLog = true; -} - -// Initialize the NAT configuration -void NiInitConfig(NAT *n) -{ - // Validate arguments - if (n == NULL) - { - return; - } - - // Initial state - NiInitDefaultConfig(n); -} - -// Read the virtual host option (extended) -void NiLoadVhOptionEx(VH_OPTION *o, FOLDER *root) -{ - FOLDER *host, *nat, *dhcp; - char mac_address[MAX_SIZE]; - // Validate arguments - if (o == NULL || root == NULL) - { - return; - } - - host = CfgGetFolder(root, "VirtualHost"); - nat = CfgGetFolder(root, "VirtualRouter"); - dhcp = CfgGetFolder(root, "VirtualDhcpServer"); - - Zero(o, sizeof(VH_OPTION)); - - GenMacAddress(o->MacAddress); - if (CfgGetStr(host, "VirtualHostMacAddress", mac_address, sizeof(mac_address))) - { - BUF *b = StrToBin(mac_address); - if (b != NULL) - { - if (b->Size == 6) - { - Copy(o->MacAddress, b->Buf, 6); - } - } - FreeBuf(b); - } - CfgGetIp(host, "VirtualHostIp", &o->Ip); - CfgGetIp(host, "VirtualHostIpSubnetMask", &o->Mask); - - o->UseNat = CfgGetBool(nat, "NatEnabled"); - o->Mtu = CfgGetInt(nat, "NatMtu"); - o->NatTcpTimeout = CfgGetInt(nat, "NatTcpTimeout"); - o->NatUdpTimeout = CfgGetInt(nat, "NatUdpTimeout"); - - o->UseDhcp = CfgGetBool(dhcp, "DhcpEnabled"); - CfgGetIp(dhcp, "DhcpLeaseIPStart", &o->DhcpLeaseIPStart); - CfgGetIp(dhcp, "DhcpLeaseIPEnd", &o->DhcpLeaseIPEnd); - CfgGetIp(dhcp, "DhcpSubnetMask", &o->DhcpSubnetMask); - o->DhcpExpireTimeSpan = CfgGetInt(dhcp, "DhcpExpireTimeSpan"); - CfgGetIp(dhcp, "DhcpGatewayAddress", &o->DhcpGatewayAddress); - CfgGetIp(dhcp, "DhcpDnsServerAddress", &o->DhcpDnsServerAddress); - CfgGetIp(dhcp, "DhcpDnsServerAddress2", &o->DhcpDnsServerAddress2); - CfgGetStr(dhcp, "DhcpDomainName", o->DhcpDomainName, sizeof(o->DhcpDomainName)); - - CfgGetStr(dhcp, "DhcpPushRoutes", o->DhcpPushRoutes, sizeof(o->DhcpPushRoutes)); - -// Test code -// StrCpy(o->DhcpPushRoutes, sizeof(o->DhcpPushRoutes), -// "130.158.6.0/24/192.168.9.2 130.158.80.244/255.255.255.255/192.168.9.2"); - - NormalizeClasslessRouteTableStr(o->DhcpPushRoutes, sizeof(o->DhcpPushRoutes), o->DhcpPushRoutes); - o->ApplyDhcpPushRoutes = true; - - Trim(o->DhcpDomainName); - if (StrLen(o->DhcpDomainName) == 0) - { - //GetDomainName(o->DhcpDomainName, sizeof(o->DhcpDomainName)); - } - - o->SaveLog = CfgGetBool(root, "SaveLog"); -} - -// Read the virtual host option -void NiLoadVhOption(NAT *n, FOLDER *root) -{ - VH_OPTION *o; - FOLDER *host, *nat, *dhcp; - char mac_address[MAX_SIZE]; - // Validate arguments - if (n == NULL || root == NULL) - { - return; - } - - host = CfgGetFolder(root, "VirtualHost"); - nat = CfgGetFolder(root, "VirtualRouter"); - dhcp = CfgGetFolder(root, "VirtualDhcpServer"); - - o = &n->Option; - Zero(o, sizeof(VH_OPTION)); - - GenMacAddress(o->MacAddress); - if (CfgGetStr(host, "VirtualHostMacAddress", mac_address, sizeof(mac_address))) - { - BUF *b = StrToBin(mac_address); - if (b != NULL) - { - if (b->Size == 6) - { - Copy(o->MacAddress, b->Buf, 6); - } - } - FreeBuf(b); - } - CfgGetIp(host, "VirtualHostIp", &o->Ip); - CfgGetIp(host, "VirtualHostIpSubnetMask", &o->Mask); - - o->UseNat = CfgGetBool(nat, "NatEnabled"); - o->Mtu = CfgGetInt(nat, "NatMtu"); - o->NatTcpTimeout = CfgGetInt(nat, "NatTcpTimeout"); - o->NatUdpTimeout = CfgGetInt(nat, "NatUdpTimeout"); - - o->UseDhcp = CfgGetBool(dhcp, "DhcpEnabled"); - CfgGetIp(dhcp, "DhcpLeaseIPStart", &o->DhcpLeaseIPStart); - CfgGetIp(dhcp, "DhcpLeaseIPEnd", &o->DhcpLeaseIPEnd); - CfgGetIp(dhcp, "DhcpSubnetMask", &o->DhcpSubnetMask); - o->DhcpExpireTimeSpan = CfgGetInt(dhcp, "DhcpExpireTimeSpan"); - CfgGetIp(dhcp, "DhcpGatewayAddress", &o->DhcpGatewayAddress); - CfgGetIp(dhcp, "DhcpDnsServerAddress", &o->DhcpDnsServerAddress); - CfgGetIp(dhcp, "DhcpDnsServerAddress2", &o->DhcpDnsServerAddress2); - CfgGetStr(dhcp, "DhcpDomainName", o->DhcpDomainName, sizeof(o->DhcpDomainName)); - - o->SaveLog = CfgGetBool(root, "SaveLog"); -} - -// Read connection options from the VPN server -void NiLoadClientData(NAT *n, FOLDER *root) -{ - FOLDER *co, *ca; - // Validate arguments - if (n == NULL || root == NULL) - { - return; - } - - co = CfgGetFolder(root, "VpnClientOption"); - ca = CfgGetFolder(root, "VpnClientAuth"); - if (co == NULL || ca == NULL) - { - return; - } - - n->ClientOption = CiLoadClientOption(co); - n->ClientAuth = CiLoadClientAuth(ca); -} - -// Write connection options to the VPN server -void NiWriteClientData(NAT *n, FOLDER *root) -{ - // Validate arguments - if (n == NULL || root == NULL || n->ClientOption == NULL || n->ClientAuth == NULL) - { - return; - } - - CiWriteClientOption(CfgCreateFolder(root, "VpnClientOption"), n->ClientOption); - CiWriteClientAuth(CfgCreateFolder(root, "VpnClientAuth"), n->ClientAuth); -} - -// Write the virtual host option (extended) -void NiWriteVhOptionEx(VH_OPTION *o, FOLDER *root) -{ - FOLDER *host, *nat, *dhcp; - char mac_address[MAX_SIZE]; - // Validate arguments - if (o == NULL || root == NULL) - { - return; - } - - host = CfgCreateFolder(root, "VirtualHost"); - nat = CfgCreateFolder(root, "VirtualRouter"); - dhcp = CfgCreateFolder(root, "VirtualDhcpServer"); - - MacToStr(mac_address, sizeof(mac_address), o->MacAddress); - CfgAddStr(host, "VirtualHostMacAddress", mac_address); - CfgAddIp(host, "VirtualHostIp", &o->Ip); - CfgAddIp(host, "VirtualHostIpSubnetMask", &o->Mask); - - CfgAddBool(nat, "NatEnabled", o->UseNat); - CfgAddInt(nat, "NatMtu", o->Mtu); - CfgAddInt(nat, "NatTcpTimeout", o->NatTcpTimeout); - CfgAddInt(nat, "NatUdpTimeout", o->NatUdpTimeout); - - CfgAddBool(dhcp, "DhcpEnabled", o->UseDhcp); - CfgAddIp(dhcp, "DhcpLeaseIPStart", &o->DhcpLeaseIPStart); - CfgAddIp(dhcp, "DhcpLeaseIPEnd", &o->DhcpLeaseIPEnd); - CfgAddIp(dhcp, "DhcpSubnetMask", &o->DhcpSubnetMask); - CfgAddInt(dhcp, "DhcpExpireTimeSpan", o->DhcpExpireTimeSpan); - CfgAddIp(dhcp, "DhcpGatewayAddress", &o->DhcpGatewayAddress); - CfgAddIp(dhcp, "DhcpDnsServerAddress", &o->DhcpDnsServerAddress); - CfgAddIp(dhcp, "DhcpDnsServerAddress2", &o->DhcpDnsServerAddress2); - CfgAddStr(dhcp, "DhcpDomainName", o->DhcpDomainName); - CfgAddStr(dhcp, "DhcpPushRoutes", o->DhcpPushRoutes); - - CfgAddBool(root, "SaveLog", o->SaveLog); -} - -// Write the virtual host option -void NiWriteVhOption(NAT *n, FOLDER *root) -{ - VH_OPTION *o; - FOLDER *host, *nat, *dhcp; - char mac_address[MAX_SIZE]; - // Validate arguments - if (n == NULL || root == NULL) - { - return; - } - - host = CfgCreateFolder(root, "VirtualHost"); - nat = CfgCreateFolder(root, "VirtualRouter"); - dhcp = CfgCreateFolder(root, "VirtualDhcpServer"); - - o = &n->Option; - - MacToStr(mac_address, sizeof(mac_address), o->MacAddress); - CfgAddStr(host, "VirtualHostMacAddress", mac_address); - CfgAddIp(host, "VirtualHostIp", &o->Ip); - CfgAddIp(host, "VirtualHostIpSubnetMask", &o->Mask); - - CfgAddBool(nat, "NatEnabled", o->UseNat); - CfgAddInt(nat, "NatMtu", o->Mtu); - CfgAddInt(nat, "NatTcpTimeout", o->NatTcpTimeout); - CfgAddInt(nat, "NatUdpTimeout", o->NatUdpTimeout); - - CfgAddBool(dhcp, "DhcpEnabled", o->UseDhcp); - CfgAddIp(dhcp, "DhcpLeaseIPStart", &o->DhcpLeaseIPStart); - CfgAddIp(dhcp, "DhcpLeaseIPEnd", &o->DhcpLeaseIPEnd); - CfgAddIp(dhcp, "DhcpSubnetMask", &o->DhcpSubnetMask); - CfgAddInt(dhcp, "DhcpExpireTimeSpan", o->DhcpExpireTimeSpan); - CfgAddIp(dhcp, "DhcpGatewayAddress", &o->DhcpGatewayAddress); - CfgAddIp(dhcp, "DhcpDnsServerAddress", &o->DhcpDnsServerAddress); - CfgAddIp(dhcp, "DhcpDnsServerAddress2", &o->DhcpDnsServerAddress2); - CfgAddStr(dhcp, "DhcpDomainName", o->DhcpDomainName); - - CfgAddBool(root, "SaveLog", o->SaveLog); -} - -// Read the configuration file -bool NiLoadConfig(NAT *n, FOLDER *root) -{ - FOLDER *host; - BUF *b; - // Validate arguments - if (n == NULL || root == NULL) - { - return false; - } - - host = CfgGetFolder(root, "VirtualHost"); - if (host == NULL) - { - return false; - } - - CfgGetByte(root, "HashedPassword", n->HashedPassword, sizeof(n->HashedPassword)); - n->AdminPort = CfgGetInt(root, "AdminPort"); - n->Online = CfgGetBool(root, "Online"); - - b = CfgGetBuf(root, "AdminCert"); - if (b != NULL) - { - n->AdminX = BufToX(b, false); - FreeBuf(b); - } - - b = CfgGetBuf(root, "AdminKey"); - if (b != NULL) - { - n->AdminK = BufToK(b, true, false, NULL); - FreeBuf(b); - } - - NiLoadVhOption(n, root); - - NiLoadClientData(n, root); - - return true; -} - -// Write the configuration to a file -void NiWriteConfig(NAT *n) -{ - // Validate arguments - if (n == NULL) - { - return; - } - - Lock(n->lock); - { - FOLDER *root = CfgCreateFolder(NULL, TAG_ROOT); - BUF *b; - - // Certificate - b = XToBuf(n->AdminX, false); - CfgAddBuf(root, "AdminCert", b); - FreeBuf(b); - - // Secret key - b = KToBuf(n->AdminK, false, NULL); - CfgAddBuf(root, "AdminKey", b); - FreeBuf(b); - - // Password - CfgAddByte(root, "HashedPassword", n->HashedPassword, sizeof(n->HashedPassword)); - CfgAddInt(root, "AdminPort", n->AdminPort); - CfgAddBool(root, "Online", n->Online); - - // Virtual host option - NiWriteVhOption(n, root); - - // Connection options - if (n->ClientOption != NULL && n->ClientAuth != NULL) - { - NiWriteClientData(n, root); - } - - SaveCfgRw(n->CfgRw, root); - CfgDeleteFolder(root); - } - Unlock(n->lock); -} - -// Release the NAT configuration -void NiFreeConfig(NAT *n) -{ - // Validate arguments - if (n == NULL) - { - return; - } - - // Write the latest configuration - NiWriteConfig(n); - - // Release the configuration R/W - FreeCfgRw(n->CfgRw); - n->CfgRw = NULL; - - Free(n->ClientOption); - CiFreeClientAuth(n->ClientAuth); - - FreeX(n->AdminX); - FreeK(n->AdminK); -} - -// Create a NAT -NAT *NiNewNatEx(SNAT *snat, VH_OPTION *o) -{ - NAT *n = ZeroMalloc(sizeof(NAT)); - - n->lock = NewLock(); - Sha0(n->HashedPassword, "", 0); - n->HaltEvent = NewEvent(); - - //n->Cedar = NewCedar(NULL, NULL); - - n->SecureNAT = snat; - - // Raise the priority - //OSSetHighPriority(); - - // Initialize the settings - NiInitConfig(n); - -#if 0 - // Start the operation of the virtual host - if (n->Online && n->ClientOption != NULL) - { - n->Virtual = NewVirtualHostEx(n->Cedar, n->ClientOption, n->ClientAuth, &n->Option, n); - } - else - { - n->Online = false; - n->Virtual = NULL; - } -#else - n->Virtual = NewVirtualHostEx(n->Cedar, NULL, NULL, o, n); - n->Online = true; -#endif - - // Start management command - //NiInitAdminAccept(n); - - return n; -} -NAT *NiNewNat() -{ - return NiNewNatEx(NULL, NULL); -} - -// Release the NAT -void NiFreeNat(NAT *n) -{ - // Validate arguments - if (n == NULL) - { - return; - } - - // Complete management command - //NiFreeAdminAccept(n); - - // Stop if the virtual host is running - Lock(n->lock); - { - if (n->Virtual != NULL) - { - StopVirtualHost(n->Virtual); - ReleaseVirtual(n->Virtual); - n->Virtual = NULL; - } - } - Unlock(n->lock); - - // Release the settings - NiFreeConfig(n); - - // Delete the object - ReleaseCedar(n->Cedar); - ReleaseEvent(n->HaltEvent); - DeleteLock(n->lock); - - Free(n); -} - -// Stop the NAT -void NtStopNat() -{ - Lock(nat_lock); - { - if (nat != NULL) - { - NiFreeNat(nat); - nat = NULL; - } - } - Unlock(nat_lock); -} - -// Start the NAT -void NtStartNat() -{ - Lock(nat_lock); - { - if (nat == NULL) - { - nat = NiNewNat(); - } - } - Unlock(nat_lock); -} - -// Initialize the NtXxx function -void NtInit() -{ - if (nat_lock != NULL) - { - return; - } - - nat_lock = NewLock(); -} - -// Release the NtXxx function -void NtFree() -{ - if (nat_lock == NULL) - { - return; - } - - DeleteLock(nat_lock); - nat_lock = NULL; -} - +// SoftEther VPN Source Code - Developer Edition Master Branch +// Cedar Communication Module + + +// Nat.c +// User-mode Router + +#include "CedarPch.h" + +static LOCK *nat_lock = NULL; +static NAT *nat = NULL; + + +// Disconnect the connection for the NAT administrator +void NatAdminDisconnect(RPC *r) +{ + // Validate arguments + if (r == NULL) + { + return; + } + + EndRpc(r); +} + +// Connection for NAT administrator +RPC *NatAdminConnect(CEDAR *cedar, char *hostname, UINT port, void *hashed_password, UINT *err) +{ + UCHAR secure_password[SHA1_SIZE]; + UCHAR random[SHA1_SIZE]; + SOCK *sock; + RPC *rpc; + PACK *p; + UINT error; + // Validate arguments + if (cedar == NULL || hostname == NULL || port == 0 || hashed_password == NULL || err == NULL) + { + if (err != NULL) + { + *err = ERR_INTERNAL_ERROR; + } + return NULL; + } + + // Connection + sock = Connect(hostname, port); + if (sock == NULL) + { + *err = ERR_CONNECT_FAILED; + return NULL; + } + + if (StartSSL(sock, NULL, NULL) == false) + { + *err = ERR_PROTOCOL_ERROR; + ReleaseSock(sock); + return NULL; + } + + SetTimeout(sock, 5000); + + p = HttpClientRecv(sock); + if (p == NULL) + { + *err = ERR_DISCONNECTED; + ReleaseSock(sock); + return NULL; + } + + if (PackGetData2(p, "auth_random", random, SHA1_SIZE) == false) + { + FreePack(p); + *err = ERR_PROTOCOL_ERROR; + ReleaseSock(sock); + return NULL; + } + + FreePack(p); + + SecurePassword(secure_password, hashed_password, random); + + p = NewPack(); + PackAddData(p, "secure_password", secure_password, SHA1_SIZE); + + if (HttpClientSend(sock, p) == false) + { + FreePack(p); + *err = ERR_DISCONNECTED; + ReleaseSock(sock); + return NULL; + } + + FreePack(p); + + p = HttpClientRecv(sock); + if (p == NULL) + { + *err = ERR_DISCONNECTED; + ReleaseSock(sock); + return NULL; + } + + error = GetErrorFromPack(p); + + FreePack(p); + + if (error != ERR_NO_ERROR) + { + *err = error; + ReleaseSock(sock); + return NULL; + } + + SetTimeout(sock, TIMEOUT_INFINITE); + + rpc = StartRpcClient(sock, NULL); + ReleaseSock(sock); + + return rpc; +} + +// RPC functional related macro +#define DECLARE_RPC_EX(rpc_name, data_type, function, in_rpc, out_rpc, free_rpc) \ + else if (StrCmpi(name, rpc_name) == 0) \ + { \ + data_type t; \ + Zero(&t, sizeof(t)); \ + in_rpc(&t, p); \ + err = function(n, &t); \ + if (err == ERR_NO_ERROR) \ + { \ + out_rpc(ret, &t); \ + } \ + free_rpc(&t); \ + ok = true; \ + } +#define DECLARE_RPC(rpc_name, data_type, function, in_rpc, out_rpc) \ + else if (StrCmpi(name, rpc_name) == 0) \ + { \ + data_type t; \ + Zero(&t, sizeof(t)); \ + in_rpc(&t, p); \ + err = function(n, &t); \ + if (err == ERR_NO_ERROR) \ + { \ + out_rpc(ret, &t); \ + } \ + ok = true; \ + } +#define DECLARE_SC_EX(rpc_name, data_type, function, in_rpc, out_rpc, free_rpc) \ + UINT function(RPC *r, data_type *t) \ + { \ + PACK *p, *ret; \ + UINT err; \ + if (r == NULL || t == NULL) \ + { \ + return ERR_INTERNAL_ERROR; \ + } \ + p = NewPack(); \ + out_rpc(p, t); \ + free_rpc(t); \ + Zero(t, sizeof(data_type)); \ + ret = AdminCall(r, rpc_name, p); \ + err = GetErrorFromPack(ret); \ + if (err == ERR_NO_ERROR) \ + { \ + in_rpc(t, ret); \ + } \ + FreePack(ret); \ + return err; \ + } +#define DECLARE_SC(rpc_name, data_type, function, in_rpc, out_rpc) \ + UINT function(RPC *r, data_type *t) \ + { \ + PACK *p, *ret; \ + UINT err; \ + if (r == NULL || t == NULL) \ + { \ + return ERR_INTERNAL_ERROR; \ + } \ + p = NewPack(); \ + out_rpc(p, t); \ + ret = AdminCall(r, rpc_name, p); \ + err = GetErrorFromPack(ret); \ + if (err == ERR_NO_ERROR) \ + { \ + in_rpc(t, ret); \ + } \ + FreePack(ret); \ + return err; \ + } + +// RPC server function +PACK *NiRpcServer(RPC *r, char *name, PACK *p) +{ + NAT *n; + PACK *ret; + UINT err; + bool ok; + // Validate arguments + if (r == NULL || name == NULL || p == NULL) + { + return NULL; + } + + n = (NAT *)r->Param; + ret = NewPack(); + err = ERR_NO_ERROR; + ok = false; + + if (0) {} + + // RPC function definition: From here + +// DECLARE_RPC("Online", RPC_DUMMY, NtOnline, InRpcDummy, OutRpcDummy) +// DECLARE_RPC("Offline", RPC_DUMMY, NtOffline, InRpcDummy, OutRpcDummy) + DECLARE_RPC("SetHostOption", VH_OPTION, NtSetHostOption, InVhOption, OutVhOption) + DECLARE_RPC("GetHostOption", VH_OPTION, NtGetHostOption, InVhOption, OutVhOption) +// DECLARE_RPC_EX("SetClientConfig", RPC_CREATE_LINK, NtSetClientConfig, InRpcCreateLink, OutRpcCreateLink, FreeRpcCreateLink) +// DECLARE_RPC_EX("GetClientConfig", RPC_CREATE_LINK, NtGetClientConfig, InRpcCreateLink, OutRpcCreateLink, FreeRpcCreateLink) + DECLARE_RPC_EX("GetStatus", RPC_NAT_STATUS, NtGetStatus, InRpcNatStatus, OutRpcNatStatus, FreeRpcNatStatus) +// DECLARE_RPC_EX("GetInfo", RPC_NAT_INFO, NtGetInfo, InRpcNatInfo, OutRpcNatInfo, FreeRpcNatInfo) + DECLARE_RPC_EX("EnumNatList", RPC_ENUM_NAT, NtEnumNatList, InRpcEnumNat, OutRpcEnumNat, FreeRpcEnumNat) + DECLARE_RPC_EX("EnumDhcpList", RPC_ENUM_DHCP, NtEnumDhcpList, InRpcEnumDhcp, OutRpcEnumDhcp, FreeRpcEnumDhcp) +// DECLARE_RPC("SetPassword", RPC_SET_PASSWORD, NtSetPassword, InRpcSetPassword, OutRpcSetPassword) + + // RPC function definition: To here + + if (ok == false) + { + err = ERR_NOT_SUPPORTED; + } + + PackAddInt(ret, "error", err); + + return ret; +} + + + + +// RPC call definition: From here + +DECLARE_SC("Online", RPC_DUMMY, NcOnline, InRpcDummy, OutRpcDummy) +DECLARE_SC("Offline", RPC_DUMMY, NcOffline, InRpcDummy, OutRpcDummy) +DECLARE_SC("SetHostOption", VH_OPTION, NcSetHostOption, InVhOption, OutVhOption) +DECLARE_SC("GetHostOption", VH_OPTION, NcGetHostOption, InVhOption, OutVhOption) +DECLARE_SC_EX("SetClientConfig", RPC_CREATE_LINK, NcSetClientConfig, InRpcCreateLink, OutRpcCreateLink, FreeRpcCreateLink) +DECLARE_SC_EX("GetClientConfig", RPC_CREATE_LINK, NcGetClientConfig, InRpcCreateLink, OutRpcCreateLink, FreeRpcCreateLink) +DECLARE_SC_EX("GetStatus", RPC_NAT_STATUS, NcGetStatus, InRpcNatStatus, OutRpcNatStatus, FreeRpcNatStatus) +DECLARE_SC_EX("GetInfo", RPC_NAT_INFO, NcGetInfo, InRpcNatInfo, OutRpcNatInfo, FreeRpcNatInfo) +DECLARE_SC_EX("EnumNatList", RPC_ENUM_NAT, NcEnumNatList, InRpcEnumNat, OutRpcEnumNat, FreeRpcEnumNat) +DECLARE_SC_EX("EnumDhcpList", RPC_ENUM_DHCP, NcEnumDhcpList, InRpcEnumDhcp, OutRpcEnumDhcp, FreeRpcEnumDhcp) +DECLARE_SC("SetPassword", RPC_SET_PASSWORD, NcSetPassword, InRpcSetPassword, OutRpcSetPassword) + +// RPC call definition: To here + + + +// Set a password +UINT NtSetPassword(NAT *n, RPC_SET_PASSWORD *t) +{ + Copy(n->HashedPassword, t->HashedPassword, SHA1_SIZE); + + NiWriteConfig(n); + + return ERR_NO_ERROR; +} + +// Online +UINT NtOnline(NAT *n, RPC_DUMMY *t) +{ + UINT ret = ERR_NO_ERROR; + + Lock(n->lock); + { + if (n->Online) + { + // It is already online + ret = ERR_ALREADY_ONLINE; + } + else + { + if (n->ClientOption == NULL || n->ClientAuth == NULL) + { + // Setting is not yet done + ret = ERR_ACCOUNT_NOT_PRESENT; + } + else + { + // OK + n->Online = true; + + // Start connection + n->Virtual = NewVirtualHostEx(n->Cedar, n->ClientOption, n->ClientAuth, + &n->Option, n); + } + } + } + Unlock(n->lock); + + NiWriteConfig(n); + + return ret; +} + +// Offline +UINT NtOffline(NAT *n, RPC_DUMMY *t) +{ + UINT ret = ERR_NO_ERROR; + + Lock(n->lock); + { + if (n->Online == false) + { + // It is offline + ret = ERR_OFFLINE; + } + else + { + // Offline + StopVirtualHost(n->Virtual); + ReleaseVirtual(n->Virtual); + n->Virtual = NULL; + + n->Online = false; + } + } + Unlock(n->lock); + + NiWriteConfig(n); + + return ret; +} + +// Set host options +UINT NtSetHostOption(NAT *n, VH_OPTION *t) +{ + UINT ret = ERR_NO_ERROR; + + Lock(n->lock); + { + Copy(&n->Option, t, sizeof(VH_OPTION)); + } + Unlock(n->lock); + + SetVirtualHostOption(n->Virtual, t); + + NiWriteConfig(n); + + return ret; +} + +// Get host options +UINT NtGetHostOption(NAT *n, VH_OPTION *t) +{ + UINT ret = ERR_NO_ERROR; + + Lock(n->lock); + { + Copy(t, &n->Option, sizeof(VH_OPTION)); + } + Unlock(n->lock); + + return ret; +} + +// Set the connection settings +UINT NtSetClientConfig(NAT *n, RPC_CREATE_LINK *t) +{ + Lock(n->lock); + { + if (n->ClientOption != NULL || n->ClientAuth != NULL) + { + Free(n->ClientOption); + CiFreeClientAuth(n->ClientAuth); + } + + n->ClientOption = ZeroMalloc(sizeof(CLIENT_OPTION)); + Copy(n->ClientOption, t->ClientOption, sizeof(CLIENT_OPTION)); + n->ClientAuth = CopyClientAuth(t->ClientAuth); + } + Unlock(n->lock); + + NiWriteConfig(n); + + if (n->Online) + { + NtOffline(n, NULL); + NtOnline(n, NULL); + } + + return ERR_NO_ERROR; +} + +// Get the connection settings +UINT NtGetClientConfig(NAT *n, RPC_CREATE_LINK *t) +{ + UINT err = ERR_NO_ERROR; + + Lock(n->lock); + { + if (n->ClientOption == NULL || n->ClientAuth == NULL) + { + err = ERR_ACCOUNT_NOT_PRESENT; + } + else + { + FreeRpcCreateLink(t); + + Zero(t, sizeof(RPC_CREATE_LINK)); + t->ClientOption = ZeroMalloc(sizeof(CLIENT_OPTION)); + Copy(t->ClientOption, n->ClientOption, sizeof(CLIENT_OPTION)); + t->ClientAuth = CopyClientAuth(n->ClientAuth); + } + } + Unlock(n->lock); + + return err; +} + +// Get the state +UINT NtGetStatus(NAT *n, RPC_NAT_STATUS *t) +{ + Lock(n->lock); + { + VH *v = n->Virtual; + FreeRpcNatStatus(t); + Zero(t, sizeof(RPC_NAT_STATUS)); + + LockVirtual(v); + { + UINT i; + + LockList(v->NatTable); + { + for (i = 0;i < LIST_NUM(v->NatTable);i++) + { + NAT_ENTRY *e = LIST_DATA(v->NatTable, i); + + switch (e->Protocol) + { + case NAT_TCP: + t->NumTcpSessions++; + break; + + case NAT_UDP: + t->NumUdpSessions++; + break; + + case NAT_ICMP: + t->NumIcmpSessions++; + break; + + case NAT_DNS: + t->NumDnsSessions++; + break; + } + } + + if (NnIsActive(v) && v->NativeNat != NULL) + { + NATIVE_NAT *nn = v->NativeNat; + + for (i = 0;i < LIST_NUM(nn->NatTableForSend->AllList);i++) + { + NATIVE_NAT_ENTRY *e = LIST_DATA(nn->NatTableForSend->AllList, i); + + switch (e->Protocol) + { + case NAT_TCP: + t->NumTcpSessions++; + break; + + case NAT_UDP: + t->NumUdpSessions++; + break; + + case NAT_ICMP: + t->NumIcmpSessions++; + break; + + case NAT_DNS: + t->NumDnsSessions++; + break; + } + } + } + } + UnlockList(v->NatTable); + + t->NumDhcpClients = LIST_NUM(v->DhcpLeaseList); + + t->IsKernelMode = NnIsActiveEx(v, &t->IsRawIpMode); + } + UnlockVirtual(v); + } + Unlock(n->lock); + + return ERR_NO_ERROR; +} + +// Get the information +UINT NtGetInfo(NAT *n, RPC_NAT_INFO *t) +{ + OS_INFO *info; + FreeRpcNatInfo(t); + Zero(t, sizeof(RPC_NAT_INFO)); + + StrCpy(t->NatProductName, sizeof(t->NatProductName), CEDAR_ROUTER_STR); + StrCpy(t->NatVersionString, sizeof(t->NatVersionString), n->Cedar->VerString); + StrCpy(t->NatBuildInfoString, sizeof(t->NatBuildInfoString), n->Cedar->BuildInfo); + t->NatVerInt = n->Cedar->Build; + t->NatBuildInt = n->Cedar->Build; + + GetMachineName(t->NatHostName, sizeof(t->NatHostName)); + + info = GetOsInfo(); + + CopyOsInfo(&t->OsInfo, info); + + GetMemInfo(&t->MemInfo); + + return ERR_NO_ERROR; +} + +// Get the NAT list +UINT NtEnumNatList(NAT *n, RPC_ENUM_NAT *t) +{ + UINT ret = ERR_NO_ERROR; + VH *v = NULL; + + Lock(n->lock); + { + v = n->Virtual; + + if (n->Online == false || v == NULL) + { + ret = ERR_OFFLINE; + } + else + { + LockVirtual(v); + { + if (v->Active == false) + { + ret = ERR_OFFLINE; + } + else + { + FreeRpcEnumNat(t); + Zero(t, sizeof(RPC_ENUM_NAT)); + + LockList(v->NatTable); + { + UINT i; + UINT num_usermode_nat = LIST_NUM(v->NatTable); + UINT num_kernel_mode_nat = 0; + NATIVE_NAT *native = NULL; + + if (NnIsActive(v) && (v->NativeNat != NULL)) + { + native = v->NativeNat; + + num_kernel_mode_nat = LIST_NUM(native->NatTableForSend->AllList); + } + + t->NumItem = num_usermode_nat + num_kernel_mode_nat; + t->Items = ZeroMalloc(sizeof(RPC_ENUM_NAT_ITEM) * t->NumItem); + + // Enumerate entries of the user mode NAT + for (i = 0;i < num_usermode_nat;i++) + { + NAT_ENTRY *nat = LIST_DATA(v->NatTable, i); + RPC_ENUM_NAT_ITEM *e = &t->Items[i]; + + e->Id = nat->Id; + e->Protocol = nat->Protocol; + e->SrcIp = nat->SrcIp; + e->DestIp = nat->DestIp; + e->SrcPort = nat->SrcPort; + e->DestPort = nat->DestPort; + + e->CreatedTime = TickToTime(nat->CreatedTime); + e->LastCommTime = TickToTime(nat->LastCommTime); + + IPToStr32(e->SrcHost, sizeof(e->SrcHost), e->SrcIp); + IPToStr32(e->DestHost, sizeof(e->DestHost), e->DestIp); + + if (nat->Sock != NULL) + { + e->SendSize = nat->Sock->SendSize; + e->RecvSize = nat->Sock->RecvSize; + + if (nat->Sock->Type == SOCK_TCP) + { + StrCpy(e->DestHost, sizeof(e->DestHost), nat->Sock->RemoteHostname); + } + } + + e->TcpStatus = nat->TcpStatus; + } + + // Enumerate the entries in the kernel-mode NAT + if (native != NULL) + { + for (i = 0;i < num_kernel_mode_nat;i++) + { + NATIVE_NAT_ENTRY *nat = LIST_DATA(native->NatTableForSend->AllList, i); + RPC_ENUM_NAT_ITEM *e = &t->Items[num_usermode_nat + i]; + + e->Id = nat->Id; + e->Protocol = nat->Protocol; + e->SrcIp = nat->SrcIp; + e->DestIp = nat->DestIp; + e->SrcPort = nat->SrcPort; + e->DestPort = nat->DestPort; + e->CreatedTime = TickToTime(nat->CreatedTime); + e->LastCommTime = TickToTime(nat->LastCommTime); + + IPToStr32(e->SrcHost, sizeof(e->SrcHost), e->SrcIp); + IPToStr32(e->DestHost, sizeof(e->DestHost), e->DestIp); + + e->SendSize = nat->TotalSent; + e->RecvSize = nat->TotalRecv; + + e->TcpStatus = nat->Status; + } + } + } + UnlockList(v->NatTable); + } + } + UnlockVirtual(v); + } + } + Unlock(n->lock); + + return ret; +} + +UINT NtEnumDhcpList(NAT *n, RPC_ENUM_DHCP *t) +{ + UINT ret = ERR_NO_ERROR; + VH *v = NULL; + + Lock(n->lock); + { + v = n->Virtual; + + if (n->Online == false || v == NULL) + { + ret = ERR_OFFLINE; + } + else + { + LockVirtual(v); + { + if (v->Active == false) + { + ret = ERR_OFFLINE; + } + else + { + FreeRpcEnumDhcp(t); + Zero(t, sizeof(RPC_ENUM_DHCP)); + + LockList(v->DhcpLeaseList); + { + UINT i; + t->NumItem = LIST_NUM(v->DhcpLeaseList); + t->Items = ZeroMalloc(sizeof(RPC_ENUM_DHCP_ITEM) * t->NumItem); + + for (i = 0;i < t->NumItem;i++) + { + DHCP_LEASE *dhcp = LIST_DATA(v->DhcpLeaseList, i); + RPC_ENUM_DHCP_ITEM *e = &t->Items[i]; + + e->Id = dhcp->Id; + e->LeasedTime = TickToTime(dhcp->LeasedTime); + e->ExpireTime = TickToTime(dhcp->ExpireTime); + Copy(e->MacAddress, dhcp->MacAddress, 6); + e->IpAddress = dhcp->IpAddress; + e->Mask = dhcp->Mask; + StrCpy(e->Hostname, sizeof(e->Hostname), dhcp->Hostname); + } + } + UnlockList(v->DhcpLeaseList); + } + } + UnlockVirtual(v); + } + } + Unlock(n->lock); + + return ret; +} + +// VH_OPTION +void InVhOption(VH_OPTION *t, PACK *p) +{ + // Validate arguments + if (t == NULL || p == NULL) + { + return; + } + + Zero(t, sizeof(VH_OPTION)); + PackGetData2(p, "MacAddress", t->MacAddress, 6); + PackGetIp(p, "Ip", &t->Ip); + PackGetIp(p, "Mask", &t->Mask); + t->UseNat = PackGetBool(p, "UseNat"); + t->Mtu = PackGetInt(p, "Mtu"); + t->NatTcpTimeout = PackGetInt(p, "NatTcpTimeout"); + t->NatUdpTimeout = PackGetInt(p, "NatUdpTimeout"); + t->UseDhcp = PackGetBool(p, "UseDhcp"); + PackGetIp(p, "DhcpLeaseIPStart", &t->DhcpLeaseIPStart); + PackGetIp(p, "DhcpLeaseIPEnd", &t->DhcpLeaseIPEnd); + PackGetIp(p, "DhcpSubnetMask", &t->DhcpSubnetMask); + t->DhcpExpireTimeSpan = PackGetInt(p, "DhcpExpireTimeSpan"); + PackGetIp(p, "DhcpGatewayAddress", &t->DhcpGatewayAddress); + PackGetIp(p, "DhcpDnsServerAddress", &t->DhcpDnsServerAddress); + PackGetIp(p, "DhcpDnsServerAddress2", &t->DhcpDnsServerAddress2); + PackGetStr(p, "DhcpDomainName", t->DhcpDomainName, sizeof(t->DhcpDomainName)); + t->SaveLog = PackGetBool(p, "SaveLog"); + PackGetStr(p, "RpcHubName", t->HubName, sizeof(t->HubName)); + t->ApplyDhcpPushRoutes = PackGetBool(p, "ApplyDhcpPushRoutes"); + PackGetStr(p, "DhcpPushRoutes", t->DhcpPushRoutes, sizeof(t->DhcpPushRoutes)); +} +void OutVhOption(PACK *p, VH_OPTION *t) +{ + // Validate arguments + if (t == NULL || p == NULL) + { + return; + } + + PackAddData(p, "MacAddress", t->MacAddress, 6); + PackAddIp(p, "Ip", &t->Ip); + PackAddIp(p, "Mask", &t->Mask); + PackAddBool(p, "UseNat", t->UseNat); + PackAddInt(p, "Mtu", t->Mtu); + PackAddInt(p, "NatTcpTimeout", t->NatTcpTimeout); + PackAddInt(p, "NatUdpTimeout", t->NatUdpTimeout); + PackAddBool(p, "UseDhcp", t->UseDhcp); + PackAddIp(p, "DhcpLeaseIPStart", &t->DhcpLeaseIPStart); + PackAddIp(p, "DhcpLeaseIPEnd", &t->DhcpLeaseIPEnd); + PackAddIp(p, "DhcpSubnetMask", &t->DhcpSubnetMask); + PackAddInt(p, "DhcpExpireTimeSpan", t->DhcpExpireTimeSpan); + PackAddIp(p, "DhcpGatewayAddress", &t->DhcpGatewayAddress); + PackAddIp(p, "DhcpDnsServerAddress", &t->DhcpDnsServerAddress); + PackAddIp(p, "DhcpDnsServerAddress2", &t->DhcpDnsServerAddress2); + PackAddStr(p, "DhcpDomainName", t->DhcpDomainName); + PackAddBool(p, "SaveLog", t->SaveLog); + PackAddStr(p, "RpcHubName", t->HubName); + PackAddBool(p, "ApplyDhcpPushRoutes", true); + PackAddStr(p, "DhcpPushRoutes", t->DhcpPushRoutes); +} + +// RPC_ENUM_DHCP +void InRpcEnumDhcp(RPC_ENUM_DHCP *t, PACK *p) +{ + UINT i; + // Validate arguments + if (t == NULL || p == NULL) + { + return; + } + + Zero(t, sizeof(RPC_ENUM_DHCP)); + t->NumItem = PackGetInt(p, "NumItem"); + t->Items = ZeroMalloc(sizeof(RPC_ENUM_DHCP_ITEM) * t->NumItem); + PackGetStr(p, "HubName", t->HubName, sizeof(t->HubName)); + + for (i = 0;i < t->NumItem;i++) + { + RPC_ENUM_DHCP_ITEM *e = &t->Items[i]; + + e->Id = PackGetIntEx(p, "Id", i); + e->LeasedTime = PackGetInt64Ex(p, "LeasedTime", i); + e->ExpireTime = PackGetInt64Ex(p, "ExpireTime", i); + PackGetDataEx2(p, "MacAddress", e->MacAddress, 6, i); + e->IpAddress = PackGetIp32Ex(p, "IpAddress", i); + e->Mask = PackGetIntEx(p, "Mask", i); + PackGetStrEx(p, "Hostname", e->Hostname, sizeof(e->Hostname), i); + } +} +void OutRpcEnumDhcp(PACK *p, RPC_ENUM_DHCP *t) +{ + UINT i; + // Validate arguments + if (p == NULL || t == NULL) + { + return; + } + + PackAddInt(p, "NumItem", t->NumItem); + PackAddStr(p, "HubName", t->HubName); + + PackSetCurrentJsonGroupName(p, "DhcpTable"); + for (i = 0;i < t->NumItem;i++) + { + RPC_ENUM_DHCP_ITEM *e = &t->Items[i]; + + PackAddIntEx(p, "Id", e->Id, i, t->NumItem); + PackAddTime64Ex(p, "LeasedTime", e->LeasedTime, i, t->NumItem); + PackAddTime64Ex(p, "ExpireTime", e->ExpireTime, i, t->NumItem); + PackAddDataEx(p, "MacAddress", e->MacAddress, 6, i, t->NumItem); + PackAddIp32Ex(p, "IpAddress", e->IpAddress, i, t->NumItem); + PackAddIntEx(p, "Mask", e->Mask, i, t->NumItem); + PackAddStrEx(p, "Hostname", e->Hostname, i, t->NumItem); + } + PackSetCurrentJsonGroupName(p, NULL); +} +void FreeRpcEnumDhcp(RPC_ENUM_DHCP *t) +{ + // Validate arguments + if (t == NULL) + { + return; + } + + Free(t->Items); +} + +// RPC_ENUM_NAT +void InRpcEnumNat(RPC_ENUM_NAT *t, PACK *p) +{ + UINT i; + // Validate arguments + if (t == NULL || p == NULL) + { + return; + } + + Zero(t, sizeof(RPC_ENUM_NAT)); + t->NumItem = PackGetInt(p, "NumItem"); + PackGetStr(p, "HubName", t->HubName, sizeof(t->HubName)); + t->Items = ZeroMalloc(sizeof(RPC_ENUM_NAT_ITEM) * t->NumItem); + for (i = 0;i < t->NumItem;i++) + { + RPC_ENUM_NAT_ITEM *e = &t->Items[i]; + + e->Id = PackGetIntEx(p, "Id", i); + e->Protocol = PackGetIntEx(p, "Protocol", i); + e->SrcIp = PackGetIntEx(p, "SrcIp", i); + PackGetStrEx(p, "SrcHost", e->SrcHost, sizeof(e->SrcHost), i); + e->SrcPort = PackGetIntEx(p, "SrcPort", i); + e->DestIp = PackGetIntEx(p, "DestIp", i); + PackGetStrEx(p, "DestHost", e->DestHost, sizeof(e->DestHost), i); + e->DestPort = PackGetIntEx(p, "DestPort", i); + e->CreatedTime = PackGetInt64Ex(p, "CreatedTime", i); + e->LastCommTime = PackGetInt64Ex(p, "LastCommTime", i); + e->SendSize = PackGetInt64Ex(p, "SendSize", i); + e->RecvSize = PackGetInt64Ex(p, "RecvSize", i); + e->TcpStatus = PackGetIntEx(p, "TcpStatus", i); + } +} +void OutRpcEnumNat(PACK *p, RPC_ENUM_NAT *t) +{ + UINT i; + // Validate arguments + if (t == NULL || p == NULL) + { + return; + } + + PackAddInt(p, "NumItem", t->NumItem); + PackAddStr(p, "HubName", t->HubName); + + PackSetCurrentJsonGroupName(p, "NatTable"); + for (i = 0;i < t->NumItem;i++) + { + RPC_ENUM_NAT_ITEM *e = &t->Items[i]; + + PackAddIntEx(p, "Id", e->Id, i, t->NumItem); + PackAddIntEx(p, "Protocol", e->Protocol, i, t->NumItem); + PackAddIp32Ex(p, "SrcIp", e->SrcIp, i, t->NumItem); + PackAddStrEx(p, "SrcHost", e->SrcHost, i, t->NumItem); + PackAddIntEx(p, "SrcPort", e->SrcPort, i, t->NumItem); + PackAddIp32Ex(p, "DestIp", e->DestIp, i, t->NumItem); + PackAddStrEx(p, "DestHost", e->DestHost, i, t->NumItem); + PackAddIntEx(p, "DestPort", e->DestPort, i, t->NumItem); + PackAddTime64Ex(p, "CreatedTime", e->CreatedTime, i, t->NumItem); + PackAddTime64Ex(p, "LastCommTime", e->LastCommTime, i, t->NumItem); + PackAddInt64Ex(p, "SendSize", e->SendSize, i, t->NumItem); + PackAddInt64Ex(p, "RecvSize", e->RecvSize, i, t->NumItem); + PackAddIntEx(p, "TcpStatus", e->TcpStatus, i, t->NumItem); + } + PackSetCurrentJsonGroupName(p, NULL); +} +void FreeRpcEnumNat(RPC_ENUM_NAT *t) +{ + // Validate arguments + if (t == NULL) + { + return; + } + + Free(t->Items); +} + +// RPC_NAT_INFO +void InRpcNatInfo(RPC_NAT_INFO *t, PACK *p) +{ + // Validate arguments + if (t == NULL || p == NULL) + { + return; + } + + Zero(t, sizeof(RPC_NAT_INFO)); + PackGetStr(p, "NatProductName", t->NatProductName, sizeof(t->NatProductName)); + PackGetStr(p, "NatVersionString", t->NatVersionString, sizeof(t->NatVersionString)); + PackGetStr(p, "NatBuildInfoString", t->NatBuildInfoString, sizeof(t->NatBuildInfoString)); + t->NatVerInt = PackGetInt(p, "NatVerInt"); + t->NatBuildInt = PackGetInt(p, "NatBuildInt"); + PackGetStr(p, "NatHostName", t->NatHostName, sizeof(t->NatHostName)); + InRpcOsInfo(&t->OsInfo, p); + InRpcMemInfo(&t->MemInfo, p); +} +void OutRpcNatInfo(PACK *p, RPC_NAT_INFO *t) +{ + // Validate arguments + if (t == NULL || p == NULL) + { + return; + } + + PackAddStr(p, "NatProductName", t->NatProductName); + PackAddStr(p, "NatVersionString", t->NatVersionString); + PackAddStr(p, "NatBuildInfoString", t->NatBuildInfoString); + PackAddInt(p, "NatVerInt", t->NatVerInt); + PackAddInt(p, "NatBuildInt", t->NatBuildInt); + PackAddStr(p, "NatHostName", t->NatHostName); + OutRpcOsInfo(p, &t->OsInfo); + OutRpcMemInfo(p, &t->MemInfo); +} +void FreeRpcNatInfo(RPC_NAT_INFO *t) +{ + // Validate arguments + if (t == NULL) + { + return; + } + + FreeRpcOsInfo(&t->OsInfo); +} + +// RPC_NAT_STATUS +void InRpcNatStatus(RPC_NAT_STATUS *t, PACK *p) +{ + // Validate arguments + if (t == NULL || p == NULL) + { + return; + } + + Zero(t, sizeof(RPC_NAT_STATUS)); + t->NumTcpSessions = PackGetInt(p, "NumTcpSessions"); + t->NumUdpSessions = PackGetInt(p, "NumUdpSessions"); + t->NumIcmpSessions = PackGetInt(p, "NumIcmpSessions"); + t->NumDnsSessions = PackGetInt(p, "NumDnsSessions"); + t->NumDhcpClients = PackGetInt(p, "NumDhcpClients"); + t->IsKernelMode = PackGetBool(p, "IsKernelMode"); + t->IsRawIpMode = PackGetBool(p, "IsRawIpMode"); + PackGetStr(p, "HubName", t->HubName, sizeof(t->HubName)); +} +void OutRpcNatStatus(PACK *p, RPC_NAT_STATUS *t) +{ + // Validate arguments + if (p == NULL || t == NULL) + { + return; + } + + PackAddStr(p, "HubName", t->HubName); + PackAddInt(p, "NumTcpSessions", t->NumTcpSessions); + PackAddInt(p, "NumUdpSessions", t->NumUdpSessions); + PackAddInt(p, "NumIcmpSessions", t->NumIcmpSessions); + PackAddInt(p, "NumDnsSessions", t->NumDnsSessions); + PackAddInt(p, "NumDhcpClients", t->NumDhcpClients); + PackAddBool(p, "IsKernelMode", t->IsKernelMode); + PackAddBool(p, "IsRawIpMode", t->IsRawIpMode); +} +void FreeRpcNatStatus(RPC_NAT_STATUS *t) +{ +} + +// RPC_DUMMY +void InRpcDummy(RPC_DUMMY *t, PACK *p) +{ + // Validate arguments + if (t == NULL || p == NULL) + { + return; + } + + Zero(t, sizeof(RPC_DUMMY)); + t->DummyValue = PackGetInt(p, "DummyValue"); +} +void OutRpcDummy(PACK *p, RPC_DUMMY *t) +{ + // Validate arguments + if (t == NULL || p == NULL) + { + return; + } + + PackAddInt(p, "DummyValue", t->DummyValue); +} + +// Main procedure for management +void NiAdminMain(NAT *n, SOCK *s) +{ + RPC *r; + PACK *p; + // Validate arguments + if (n == NULL || s == NULL) + { + return; + } + + p = NewPack(); + HttpServerSend(s, p); + FreePack(p); + + r = StartRpcServer(s, NiRpcServer, n); + + RpcServer(r); + + RpcFree(r); +} + +// Management thread +void NiAdminThread(THREAD *thread, void *param) +{ + NAT_ADMIN *a = (NAT_ADMIN *)param; + NAT *n; + SOCK *s; + UCHAR random[SHA1_SIZE]; + UINT err; + // Validate arguments + if (thread == NULL || param == NULL) + { + return; + } + + // Random number generation + Rand(random, sizeof(random)); + + a->Thread = thread; + AddRef(a->Thread->ref); + s = a->Sock; + AddRef(s->ref); + + n = a->Nat; + + LockList(n->AdminList); + { + Add(n->AdminList, a); + } + UnlockList(n->AdminList); + + NoticeThreadInit(thread); + + err = ERR_AUTH_FAILED; + + if (StartSSL(s, n->AdminX, n->AdminK)) + { + PACK *p; + + // Send the random number + p = NewPack(); + PackAddData(p, "auth_random", random, sizeof(random)); + + if (HttpServerSend(s, p)) + { + PACK *p; + // Receive a password + p = HttpServerRecv(s); + if (p != NULL) + { + UCHAR secure_password[SHA1_SIZE]; + UCHAR secure_check[SHA1_SIZE]; + + if (PackGetData2(p, "secure_password", secure_password, sizeof(secure_password))) + { + SecurePassword(secure_check, n->HashedPassword, random); + + if (Cmp(secure_check, secure_password, SHA1_SIZE) == 0) + { + UCHAR test[SHA1_SIZE]; + // Password match + Sha0(test, "", 0); + SecurePassword(test, test, random); + +#if 0 + if (Cmp(test, secure_check, SHA1_SIZE) == 0 && s->RemoteIP.addr[0] != 127) + { + // A client can not connect from the outside with blank password + err = ERR_NULL_PASSWORD_LOCAL_ONLY; + } + else +#endif + + { + // Successful connection + err = ERR_NO_ERROR; + NiAdminMain(n, s); + } + } + } + + FreePack(p); + } + } + + FreePack(p); + + if (err != ERR_NO_ERROR) + { + p = PackError(err); + HttpServerSend(s, p); + FreePack(p); + } + } + + Disconnect(s); + ReleaseSock(s); +} + +// Management port Listen thread +void NiListenThread(THREAD *thread, void *param) +{ + NAT *n = (NAT *)param; + SOCK *a; + UINT i; + bool b = false; + // Validate arguments + if (thread == NULL || param == NULL) + { + return; + } + + // Initialize the management list + n->AdminList = NewList(NULL); + + while (true) + { + a = Listen(DEFAULT_NAT_ADMIN_PORT); + if (b == false) + { + b = true; + NoticeThreadInit(thread); + } + if (a != NULL) + { + break; + } + + Wait(n->HaltEvent, NAT_ADMIN_PORT_LISTEN_INTERVAL); + if (n->Halt) + { + return; + } + } + + n->AdminListenSock = a; + AddRef(a->ref); + + // Waiting + while (true) + { + SOCK *s = Accept(a); + THREAD *t; + NAT_ADMIN *admin; + if (s == NULL) + { + break; + } + if (n->Halt) + { + ReleaseSock(s); + break; + } + + admin = ZeroMalloc(sizeof(NAT_ADMIN)); + admin->Nat = n; + admin->Sock = s; + t = NewThread(NiAdminThread, admin); + WaitThreadInit(t); + ReleaseThread(t); + } + + // Disconnect all management connections + LockList(n->AdminList); + { + for (i = 0;i < LIST_NUM(n->AdminList);i++) + { + NAT_ADMIN *a = LIST_DATA(n->AdminList, i); + Disconnect(a->Sock); + WaitThread(a->Thread, INFINITE); + ReleaseThread(a->Thread); + ReleaseSock(a->Sock); + Free(a); + } + } + UnlockList(n->AdminList); + + ReleaseList(n->AdminList); + + ReleaseSock(a); +} + +// Initialize receiving management command +void NiInitAdminAccept(NAT *n) +{ + THREAD *t; + // Validate arguments + if (n == NULL) + { + return; + } + + t = NewThread(NiListenThread, n); + WaitThreadInit(t); + n->AdminAcceptThread = t; +} + +// Complete receiving management command +void NiFreeAdminAccept(NAT *n) +{ + // Validate arguments + if (n == NULL) + { + return; + } + + n->Halt = true; + Disconnect(n->AdminListenSock); + Set(n->HaltEvent); + + while (true) + { + if (WaitThread(n->AdminAcceptThread, 1000) == false) + { + Disconnect(n->AdminListenSock); + } + else + { + break; + } + } + ReleaseThread(n->AdminAcceptThread); + + ReleaseSock(n->AdminListenSock); +} + +// Clear the DHCP options that are not supported by the dynamic Virtual HUB +void NiClearUnsupportedVhOptionForDynamicHub(VH_OPTION *o, bool initial) +{ + // Validate arguments + if (o == NULL) + { + return; + } + + o->UseNat = false; + + if (initial) + { + Zero(&o->DhcpGatewayAddress, sizeof(IP)); + Zero(&o->DhcpDnsServerAddress, sizeof(IP)); + Zero(&o->DhcpDnsServerAddress2, sizeof(IP)); + StrCpy(o->DhcpDomainName, sizeof(o->DhcpDomainName), ""); + } +} + +// Initialize the options for the virtual host +void NiSetDefaultVhOption(NAT *n, VH_OPTION *o) +{ + // Validate arguments + if (o == NULL) + { + return; + } + + Zero(o, sizeof(VH_OPTION)); + GenMacAddress(o->MacAddress); + + // Set the virtual IP to 192.168.30.1/24 + SetIP(&o->Ip, 192, 168, 30, 1); + SetIP(&o->Mask, 255, 255, 255, 0); + o->UseNat = true; + o->Mtu = 1500; + o->NatTcpTimeout = 1800; + o->NatUdpTimeout = 60; + o->UseDhcp = true; + SetIP(&o->DhcpLeaseIPStart, 192, 168, 30, 10); + SetIP(&o->DhcpLeaseIPEnd, 192, 168, 30, 200); + SetIP(&o->DhcpSubnetMask, 255, 255, 255, 0); + o->DhcpExpireTimeSpan = 7200; + o->SaveLog = true; + + SetIP(&o->DhcpGatewayAddress, 192, 168, 30, 1); + SetIP(&o->DhcpDnsServerAddress, 192, 168, 30, 1); + + GetDomainName(o->DhcpDomainName, sizeof(o->DhcpDomainName)); +} + +// Reset the setting of NAT to the default +void NiInitDefaultConfig(NAT *n) +{ + // Validate arguments + if (n == NULL) + { + return; + } + + // Initialize the virtual host option + NiSetDefaultVhOption(n, &n->Option); + + // Initialize management port + n->AdminPort = DEFAULT_NAT_ADMIN_PORT; + + // Offline + n->Online = false; + + // Save the log + n->Option.SaveLog = true; +} + +// Initialize the NAT configuration +void NiInitConfig(NAT *n) +{ + // Validate arguments + if (n == NULL) + { + return; + } + + // Initial state + NiInitDefaultConfig(n); +} + +// Read the virtual host option (extended) +void NiLoadVhOptionEx(VH_OPTION *o, FOLDER *root) +{ + FOLDER *host, *nat, *dhcp; + char mac_address[MAX_SIZE]; + // Validate arguments + if (o == NULL || root == NULL) + { + return; + } + + host = CfgGetFolder(root, "VirtualHost"); + nat = CfgGetFolder(root, "VirtualRouter"); + dhcp = CfgGetFolder(root, "VirtualDhcpServer"); + + Zero(o, sizeof(VH_OPTION)); + + GenMacAddress(o->MacAddress); + if (CfgGetStr(host, "VirtualHostMacAddress", mac_address, sizeof(mac_address))) + { + BUF *b = StrToBin(mac_address); + if (b != NULL) + { + if (b->Size == 6) + { + Copy(o->MacAddress, b->Buf, 6); + } + } + FreeBuf(b); + } + CfgGetIp(host, "VirtualHostIp", &o->Ip); + CfgGetIp(host, "VirtualHostIpSubnetMask", &o->Mask); + + o->UseNat = CfgGetBool(nat, "NatEnabled"); + o->Mtu = CfgGetInt(nat, "NatMtu"); + o->NatTcpTimeout = CfgGetInt(nat, "NatTcpTimeout"); + o->NatUdpTimeout = CfgGetInt(nat, "NatUdpTimeout"); + + o->UseDhcp = CfgGetBool(dhcp, "DhcpEnabled"); + CfgGetIp(dhcp, "DhcpLeaseIPStart", &o->DhcpLeaseIPStart); + CfgGetIp(dhcp, "DhcpLeaseIPEnd", &o->DhcpLeaseIPEnd); + CfgGetIp(dhcp, "DhcpSubnetMask", &o->DhcpSubnetMask); + o->DhcpExpireTimeSpan = CfgGetInt(dhcp, "DhcpExpireTimeSpan"); + CfgGetIp(dhcp, "DhcpGatewayAddress", &o->DhcpGatewayAddress); + CfgGetIp(dhcp, "DhcpDnsServerAddress", &o->DhcpDnsServerAddress); + CfgGetIp(dhcp, "DhcpDnsServerAddress2", &o->DhcpDnsServerAddress2); + CfgGetStr(dhcp, "DhcpDomainName", o->DhcpDomainName, sizeof(o->DhcpDomainName)); + + CfgGetStr(dhcp, "DhcpPushRoutes", o->DhcpPushRoutes, sizeof(o->DhcpPushRoutes)); + +// Test code +// StrCpy(o->DhcpPushRoutes, sizeof(o->DhcpPushRoutes), +// "130.158.6.0/24/192.168.9.2 130.158.80.244/255.255.255.255/192.168.9.2"); + + NormalizeClasslessRouteTableStr(o->DhcpPushRoutes, sizeof(o->DhcpPushRoutes), o->DhcpPushRoutes); + o->ApplyDhcpPushRoutes = true; + + Trim(o->DhcpDomainName); + if (StrLen(o->DhcpDomainName) == 0) + { + //GetDomainName(o->DhcpDomainName, sizeof(o->DhcpDomainName)); + } + + o->SaveLog = CfgGetBool(root, "SaveLog"); +} + +// Read the virtual host option +void NiLoadVhOption(NAT *n, FOLDER *root) +{ + VH_OPTION *o; + FOLDER *host, *nat, *dhcp; + char mac_address[MAX_SIZE]; + // Validate arguments + if (n == NULL || root == NULL) + { + return; + } + + host = CfgGetFolder(root, "VirtualHost"); + nat = CfgGetFolder(root, "VirtualRouter"); + dhcp = CfgGetFolder(root, "VirtualDhcpServer"); + + o = &n->Option; + Zero(o, sizeof(VH_OPTION)); + + GenMacAddress(o->MacAddress); + if (CfgGetStr(host, "VirtualHostMacAddress", mac_address, sizeof(mac_address))) + { + BUF *b = StrToBin(mac_address); + if (b != NULL) + { + if (b->Size == 6) + { + Copy(o->MacAddress, b->Buf, 6); + } + } + FreeBuf(b); + } + CfgGetIp(host, "VirtualHostIp", &o->Ip); + CfgGetIp(host, "VirtualHostIpSubnetMask", &o->Mask); + + o->UseNat = CfgGetBool(nat, "NatEnabled"); + o->Mtu = CfgGetInt(nat, "NatMtu"); + o->NatTcpTimeout = CfgGetInt(nat, "NatTcpTimeout"); + o->NatUdpTimeout = CfgGetInt(nat, "NatUdpTimeout"); + + o->UseDhcp = CfgGetBool(dhcp, "DhcpEnabled"); + CfgGetIp(dhcp, "DhcpLeaseIPStart", &o->DhcpLeaseIPStart); + CfgGetIp(dhcp, "DhcpLeaseIPEnd", &o->DhcpLeaseIPEnd); + CfgGetIp(dhcp, "DhcpSubnetMask", &o->DhcpSubnetMask); + o->DhcpExpireTimeSpan = CfgGetInt(dhcp, "DhcpExpireTimeSpan"); + CfgGetIp(dhcp, "DhcpGatewayAddress", &o->DhcpGatewayAddress); + CfgGetIp(dhcp, "DhcpDnsServerAddress", &o->DhcpDnsServerAddress); + CfgGetIp(dhcp, "DhcpDnsServerAddress2", &o->DhcpDnsServerAddress2); + CfgGetStr(dhcp, "DhcpDomainName", o->DhcpDomainName, sizeof(o->DhcpDomainName)); + + o->SaveLog = CfgGetBool(root, "SaveLog"); +} + +// Read connection options from the VPN server +void NiLoadClientData(NAT *n, FOLDER *root) +{ + FOLDER *co, *ca; + // Validate arguments + if (n == NULL || root == NULL) + { + return; + } + + co = CfgGetFolder(root, "VpnClientOption"); + ca = CfgGetFolder(root, "VpnClientAuth"); + if (co == NULL || ca == NULL) + { + return; + } + + n->ClientOption = CiLoadClientOption(co); + n->ClientAuth = CiLoadClientAuth(ca); +} + +// Write connection options to the VPN server +void NiWriteClientData(NAT *n, FOLDER *root) +{ + // Validate arguments + if (n == NULL || root == NULL || n->ClientOption == NULL || n->ClientAuth == NULL) + { + return; + } + + CiWriteClientOption(CfgCreateFolder(root, "VpnClientOption"), n->ClientOption); + CiWriteClientAuth(CfgCreateFolder(root, "VpnClientAuth"), n->ClientAuth); +} + +// Write the virtual host option (extended) +void NiWriteVhOptionEx(VH_OPTION *o, FOLDER *root) +{ + FOLDER *host, *nat, *dhcp; + char mac_address[MAX_SIZE]; + // Validate arguments + if (o == NULL || root == NULL) + { + return; + } + + host = CfgCreateFolder(root, "VirtualHost"); + nat = CfgCreateFolder(root, "VirtualRouter"); + dhcp = CfgCreateFolder(root, "VirtualDhcpServer"); + + MacToStr(mac_address, sizeof(mac_address), o->MacAddress); + CfgAddStr(host, "VirtualHostMacAddress", mac_address); + CfgAddIp(host, "VirtualHostIp", &o->Ip); + CfgAddIp(host, "VirtualHostIpSubnetMask", &o->Mask); + + CfgAddBool(nat, "NatEnabled", o->UseNat); + CfgAddInt(nat, "NatMtu", o->Mtu); + CfgAddInt(nat, "NatTcpTimeout", o->NatTcpTimeout); + CfgAddInt(nat, "NatUdpTimeout", o->NatUdpTimeout); + + CfgAddBool(dhcp, "DhcpEnabled", o->UseDhcp); + CfgAddIp(dhcp, "DhcpLeaseIPStart", &o->DhcpLeaseIPStart); + CfgAddIp(dhcp, "DhcpLeaseIPEnd", &o->DhcpLeaseIPEnd); + CfgAddIp(dhcp, "DhcpSubnetMask", &o->DhcpSubnetMask); + CfgAddInt(dhcp, "DhcpExpireTimeSpan", o->DhcpExpireTimeSpan); + CfgAddIp(dhcp, "DhcpGatewayAddress", &o->DhcpGatewayAddress); + CfgAddIp(dhcp, "DhcpDnsServerAddress", &o->DhcpDnsServerAddress); + CfgAddIp(dhcp, "DhcpDnsServerAddress2", &o->DhcpDnsServerAddress2); + CfgAddStr(dhcp, "DhcpDomainName", o->DhcpDomainName); + CfgAddStr(dhcp, "DhcpPushRoutes", o->DhcpPushRoutes); + + CfgAddBool(root, "SaveLog", o->SaveLog); +} + +// Write the virtual host option +void NiWriteVhOption(NAT *n, FOLDER *root) +{ + VH_OPTION *o; + FOLDER *host, *nat, *dhcp; + char mac_address[MAX_SIZE]; + // Validate arguments + if (n == NULL || root == NULL) + { + return; + } + + host = CfgCreateFolder(root, "VirtualHost"); + nat = CfgCreateFolder(root, "VirtualRouter"); + dhcp = CfgCreateFolder(root, "VirtualDhcpServer"); + + o = &n->Option; + + MacToStr(mac_address, sizeof(mac_address), o->MacAddress); + CfgAddStr(host, "VirtualHostMacAddress", mac_address); + CfgAddIp(host, "VirtualHostIp", &o->Ip); + CfgAddIp(host, "VirtualHostIpSubnetMask", &o->Mask); + + CfgAddBool(nat, "NatEnabled", o->UseNat); + CfgAddInt(nat, "NatMtu", o->Mtu); + CfgAddInt(nat, "NatTcpTimeout", o->NatTcpTimeout); + CfgAddInt(nat, "NatUdpTimeout", o->NatUdpTimeout); + + CfgAddBool(dhcp, "DhcpEnabled", o->UseDhcp); + CfgAddIp(dhcp, "DhcpLeaseIPStart", &o->DhcpLeaseIPStart); + CfgAddIp(dhcp, "DhcpLeaseIPEnd", &o->DhcpLeaseIPEnd); + CfgAddIp(dhcp, "DhcpSubnetMask", &o->DhcpSubnetMask); + CfgAddInt(dhcp, "DhcpExpireTimeSpan", o->DhcpExpireTimeSpan); + CfgAddIp(dhcp, "DhcpGatewayAddress", &o->DhcpGatewayAddress); + CfgAddIp(dhcp, "DhcpDnsServerAddress", &o->DhcpDnsServerAddress); + CfgAddIp(dhcp, "DhcpDnsServerAddress2", &o->DhcpDnsServerAddress2); + CfgAddStr(dhcp, "DhcpDomainName", o->DhcpDomainName); + + CfgAddBool(root, "SaveLog", o->SaveLog); +} + +// Read the configuration file +bool NiLoadConfig(NAT *n, FOLDER *root) +{ + FOLDER *host; + BUF *b; + // Validate arguments + if (n == NULL || root == NULL) + { + return false; + } + + host = CfgGetFolder(root, "VirtualHost"); + if (host == NULL) + { + return false; + } + + CfgGetByte(root, "HashedPassword", n->HashedPassword, sizeof(n->HashedPassword)); + n->AdminPort = CfgGetInt(root, "AdminPort"); + n->Online = CfgGetBool(root, "Online"); + + b = CfgGetBuf(root, "AdminCert"); + if (b != NULL) + { + n->AdminX = BufToX(b, false); + FreeBuf(b); + } + + b = CfgGetBuf(root, "AdminKey"); + if (b != NULL) + { + n->AdminK = BufToK(b, true, false, NULL); + FreeBuf(b); + } + + NiLoadVhOption(n, root); + + NiLoadClientData(n, root); + + return true; +} + +// Write the configuration to a file +void NiWriteConfig(NAT *n) +{ + // Validate arguments + if (n == NULL) + { + return; + } + + Lock(n->lock); + { + FOLDER *root = CfgCreateFolder(NULL, TAG_ROOT); + BUF *b; + + // Certificate + b = XToBuf(n->AdminX, false); + CfgAddBuf(root, "AdminCert", b); + FreeBuf(b); + + // Secret key + b = KToBuf(n->AdminK, false, NULL); + CfgAddBuf(root, "AdminKey", b); + FreeBuf(b); + + // Password + CfgAddByte(root, "HashedPassword", n->HashedPassword, sizeof(n->HashedPassword)); + CfgAddInt(root, "AdminPort", n->AdminPort); + CfgAddBool(root, "Online", n->Online); + + // Virtual host option + NiWriteVhOption(n, root); + + // Connection options + if (n->ClientOption != NULL && n->ClientAuth != NULL) + { + NiWriteClientData(n, root); + } + + SaveCfgRw(n->CfgRw, root); + CfgDeleteFolder(root); + } + Unlock(n->lock); +} + +// Release the NAT configuration +void NiFreeConfig(NAT *n) +{ + // Validate arguments + if (n == NULL) + { + return; + } + + // Write the latest configuration + NiWriteConfig(n); + + // Release the configuration R/W + FreeCfgRw(n->CfgRw); + n->CfgRw = NULL; + + Free(n->ClientOption); + CiFreeClientAuth(n->ClientAuth); + + FreeX(n->AdminX); + FreeK(n->AdminK); +} + +// Create a NAT +NAT *NiNewNatEx(SNAT *snat, VH_OPTION *o) +{ + NAT *n = ZeroMalloc(sizeof(NAT)); + + n->lock = NewLock(); + Sha0(n->HashedPassword, "", 0); + n->HaltEvent = NewEvent(); + + //n->Cedar = NewCedar(NULL, NULL); + + n->SecureNAT = snat; + + // Raise the priority + //OSSetHighPriority(); + + // Initialize the settings + NiInitConfig(n); + +#if 0 + // Start the operation of the virtual host + if (n->Online && n->ClientOption != NULL) + { + n->Virtual = NewVirtualHostEx(n->Cedar, n->ClientOption, n->ClientAuth, &n->Option, n); + } + else + { + n->Online = false; + n->Virtual = NULL; + } +#else + n->Virtual = NewVirtualHostEx(n->Cedar, NULL, NULL, o, n); + n->Online = true; +#endif + + // Start management command + //NiInitAdminAccept(n); + + return n; +} +NAT *NiNewNat() +{ + return NiNewNatEx(NULL, NULL); +} + +// Release the NAT +void NiFreeNat(NAT *n) +{ + // Validate arguments + if (n == NULL) + { + return; + } + + // Complete management command + //NiFreeAdminAccept(n); + + // Stop if the virtual host is running + Lock(n->lock); + { + if (n->Virtual != NULL) + { + StopVirtualHost(n->Virtual); + ReleaseVirtual(n->Virtual); + n->Virtual = NULL; + } + } + Unlock(n->lock); + + // Release the settings + NiFreeConfig(n); + + // Delete the object + ReleaseCedar(n->Cedar); + ReleaseEvent(n->HaltEvent); + DeleteLock(n->lock); + + Free(n); +} + +// Stop the NAT +void NtStopNat() +{ + Lock(nat_lock); + { + if (nat != NULL) + { + NiFreeNat(nat); + nat = NULL; + } + } + Unlock(nat_lock); +} + +// Start the NAT +void NtStartNat() +{ + Lock(nat_lock); + { + if (nat == NULL) + { + nat = NiNewNat(); + } + } + Unlock(nat_lock); +} + +// Initialize the NtXxx function +void NtInit() +{ + if (nat_lock != NULL) + { + return; + } + + nat_lock = NewLock(); +} + +// Release the NtXxx function +void NtFree() +{ + if (nat_lock == NULL) + { + return; + } + + DeleteLock(nat_lock); + nat_lock = NULL; +} + diff --git a/src/Cedar/Nat.h b/src/Cedar/Nat.h index 70cf601e..b4ceb09f 100644 --- a/src/Cedar/Nat.h +++ b/src/Cedar/Nat.h @@ -1,212 +1,212 @@ -// SoftEther VPN Source Code - Developer Edition Master Branch -// Cedar Communication Module - - -// Nat.h -// Header of Nat.c - -#ifndef NAT_H -#define NAT_H - -// Constants -#define NAT_CONFIG_FILE_NAME "$vpn_router.config" // NAT configuration file -#define DEFAULT_NAT_ADMIN_PORT 2828 // Default port number for management -#define NAT_ADMIN_PORT_LISTEN_INTERVAL 1000 // Interval for trying to open a port for management -#define NAT_FILE_SAVE_INTERVAL (30 * 1000) // Interval to save - - -// NAT object -struct NAT -{ - LOCK *lock; // Lock - UCHAR HashedPassword[SHA1_SIZE]; // Administrative password - VH_OPTION Option; // Option - CEDAR *Cedar; // Cedar - UINT AdminPort; // Management port number - bool Online; // Online flag - VH *Virtual; // Virtual host object - CLIENT_OPTION *ClientOption; // Client Option - CLIENT_AUTH *ClientAuth; // Client authentication data - CFG_RW *CfgRw; // Config file R/W - THREAD *AdminAcceptThread; // Management connection reception thread - SOCK *AdminListenSock; // Management port socket - EVENT *HaltEvent; // Halting event - volatile bool Halt; // Halting flag - LIST *AdminList; // Management thread list - X *AdminX; // Server certificate for management - K *AdminK; // Server private key for management - SNAT *SecureNAT; // SecureNAT object -}; - -// NAT management connection -struct NAT_ADMIN -{ - NAT *Nat; // NAT - SOCK *Sock; // Socket - THREAD *Thread; // Thread -}; - -// RPC_DUMMY -struct RPC_DUMMY -{ - UINT DummyValue; -}; - -// RPC_NAT_STATUS -struct RPC_NAT_STATUS -{ - char HubName[MAX_HUBNAME_LEN + 1]; // HUB name - UINT NumTcpSessions; // Number of TCP sessions - UINT NumUdpSessions; // Ntmber of UDP sessions - UINT NumIcmpSessions; // Number of ICMP sessions - UINT NumDnsSessions; // Number of DNS sessions - UINT NumDhcpClients; // Number of DHCP clients - bool IsKernelMode; // Whether kernel mode - bool IsRawIpMode; // Whether raw IP mode -}; - -// RPC_NAT_INFO * -struct RPC_NAT_INFO -{ - char NatProductName[128]; // Server product name - char NatVersionString[128]; // Server version string - char NatBuildInfoString[128]; // Server build information string - UINT NatVerInt; // Server version integer value - UINT NatBuildInt; // Server build number integer value - char NatHostName[MAX_HOST_NAME_LEN + 1]; // Server host name - OS_INFO OsInfo; // OS information - MEMINFO MemInfo; // Memory information -}; - -// RPC_ENUM_NAT_ITEM -struct RPC_ENUM_NAT_ITEM -{ - UINT Id; // ID - UINT Protocol; // Protocol - UINT SrcIp; // Source IP address - char SrcHost[MAX_HOST_NAME_LEN + 1]; // Source host name - UINT SrcPort; // Source port number - UINT DestIp; // Destination IP address - char DestHost[MAX_HOST_NAME_LEN + 1]; // Destination host name - UINT DestPort; // Destination port number - UINT64 CreatedTime; // Connection time - UINT64 LastCommTime; // Last communication time - UINT64 SendSize; // Transmission size - UINT64 RecvSize; // Receive size - UINT TcpStatus; // TCP state -}; - -// RPC_ENUM_NAT * -struct RPC_ENUM_NAT -{ - char HubName[MAX_HUBNAME_LEN + 1]; // HUB name - UINT NumItem; // Number of items - RPC_ENUM_NAT_ITEM *Items; // Item -}; - -// RPC_ENUM_DHCP_ITEM -struct RPC_ENUM_DHCP_ITEM -{ - UINT Id; // ID - UINT64 LeasedTime; // Lease time - UINT64 ExpireTime; // Expiration date - UCHAR MacAddress[6]; // MAC address - UCHAR Padding[2]; // Padding - UINT IpAddress; // IP address - UINT Mask; // Subnet mask - char Hostname[MAX_HOST_NAME_LEN + 1]; // Host name -}; - -// RPC_ENUM_DHCP * -struct RPC_ENUM_DHCP -{ - char HubName[MAX_HUBNAME_LEN + 1]; // HUB name - UINT NumItem; // Number of items - RPC_ENUM_DHCP_ITEM *Items; // Item -}; - - -// Function prototype -NAT *NiNewNat(); -NAT *NiNewNatEx(SNAT *snat, VH_OPTION *o); -void NiFreeNat(NAT *n); -void NiInitConfig(NAT *n); -void NiFreeConfig(NAT *n); -void NiInitDefaultConfig(NAT *n); -void NiSetDefaultVhOption(NAT *n, VH_OPTION *o); -void NiClearUnsupportedVhOptionForDynamicHub(VH_OPTION *o, bool initial); -void NiWriteConfig(NAT *n); -void NiWriteVhOption(NAT *n, FOLDER *root); -void NiWriteVhOptionEx(VH_OPTION *o, FOLDER *root); -void NiWriteClientData(NAT *n, FOLDER *root); -void NiLoadVhOption(NAT *n, FOLDER *root); -void NiLoadVhOptionEx(VH_OPTION *o, FOLDER *root); -bool NiLoadConfig(NAT *n, FOLDER *root); -void NiLoadClientData(NAT *n, FOLDER *root); -void NiInitAdminAccept(NAT *n); -void NiFreeAdminAccept(NAT *n); -void NiListenThread(THREAD *thread, void *param); -void NiAdminThread(THREAD *thread, void *param); -void NiAdminMain(NAT *n, SOCK *s); -PACK *NiRpcServer(RPC *r, char *name, PACK *p); - -RPC *NatAdminConnect(CEDAR *cedar, char *hostname, UINT port, void *hashed_password, UINT *err); -void NatAdminDisconnect(RPC *r); - -void NtStartNat(); -void NtStopNat(); -void NtInit(); -void NtFree(); - - -UINT NtOnline(NAT *n, RPC_DUMMY *t); -UINT NtOffline(NAT *n, RPC_DUMMY *t); -UINT NtSetHostOption(NAT *n, VH_OPTION *t); -UINT NtGetHostOption(NAT *n, VH_OPTION *t); -UINT NtSetClientConfig(NAT *n, RPC_CREATE_LINK *t); -UINT NtGetClientConfig(NAT *n, RPC_CREATE_LINK *t); -UINT NtGetStatus(NAT *n, RPC_NAT_STATUS *t); -UINT NtGetInfo(NAT *n, RPC_NAT_INFO *t); -UINT NtEnumNatList(NAT *n, RPC_ENUM_NAT *t); -UINT NtEnumDhcpList(NAT *n, RPC_ENUM_DHCP *t); -UINT NtSetPassword(NAT *n, RPC_SET_PASSWORD *t); - - -UINT NcOnline(RPC *r, RPC_DUMMY *t); -UINT NcOffline(RPC *r, RPC_DUMMY *t); -UINT NcSetHostOption(RPC *r, VH_OPTION *t); -UINT NcGetHostOption(RPC *r, VH_OPTION *t); -UINT NcSetClientConfig(RPC *r, RPC_CREATE_LINK *t); -UINT NcGetClientConfig(RPC *r, RPC_CREATE_LINK *t); -UINT NcGetStatus(RPC *r, RPC_NAT_STATUS *t); -UINT NcGetInfo(RPC *r, RPC_NAT_INFO *t); -UINT NcEnumNatList(RPC *r, RPC_ENUM_NAT *t); -UINT NcEnumDhcpList(RPC *r, RPC_ENUM_DHCP *t); -UINT NcSetPassword(RPC *r, RPC_SET_PASSWORD *t); - - - - -void InRpcEnumDhcp(RPC_ENUM_DHCP *t, PACK *p); -void OutRpcEnumDhcp(PACK *p, RPC_ENUM_DHCP *t); -void FreeRpcEnumDhcp(RPC_ENUM_DHCP *t); -void InRpcEnumNat(RPC_ENUM_NAT *t, PACK *p); -void OutRpcEnumNat(PACK *p, RPC_ENUM_NAT *t); -void FreeRpcEnumNat(RPC_ENUM_NAT *t); -void InRpcNatInfo(RPC_NAT_INFO *t, PACK *p); -void OutRpcNatInfo(PACK *p, RPC_NAT_INFO *t); -void FreeRpcNatInfo(RPC_NAT_INFO *t); -void InRpcNatStatus(RPC_NAT_STATUS *t, PACK *p); -void OutRpcNatStatus(PACK *p, RPC_NAT_STATUS *t); -void FreeRpcNatStatus(RPC_NAT_STATUS *t); -void InVhOption(VH_OPTION *t, PACK *p); -void OutVhOption(PACK *p, VH_OPTION *t); -void InRpcDummy(RPC_DUMMY *t, PACK *p); -void OutRpcDummy(PACK *p, RPC_DUMMY *t); - - - - -#endif // NAT_H - - +// SoftEther VPN Source Code - Developer Edition Master Branch +// Cedar Communication Module + + +// Nat.h +// Header of Nat.c + +#ifndef NAT_H +#define NAT_H + +// Constants +#define NAT_CONFIG_FILE_NAME "$vpn_router.config" // NAT configuration file +#define DEFAULT_NAT_ADMIN_PORT 2828 // Default port number for management +#define NAT_ADMIN_PORT_LISTEN_INTERVAL 1000 // Interval for trying to open a port for management +#define NAT_FILE_SAVE_INTERVAL (30 * 1000) // Interval to save + + +// NAT object +struct NAT +{ + LOCK *lock; // Lock + UCHAR HashedPassword[SHA1_SIZE]; // Administrative password + VH_OPTION Option; // Option + CEDAR *Cedar; // Cedar + UINT AdminPort; // Management port number + bool Online; // Online flag + VH *Virtual; // Virtual host object + CLIENT_OPTION *ClientOption; // Client Option + CLIENT_AUTH *ClientAuth; // Client authentication data + CFG_RW *CfgRw; // Config file R/W + THREAD *AdminAcceptThread; // Management connection reception thread + SOCK *AdminListenSock; // Management port socket + EVENT *HaltEvent; // Halting event + volatile bool Halt; // Halting flag + LIST *AdminList; // Management thread list + X *AdminX; // Server certificate for management + K *AdminK; // Server private key for management + SNAT *SecureNAT; // SecureNAT object +}; + +// NAT management connection +struct NAT_ADMIN +{ + NAT *Nat; // NAT + SOCK *Sock; // Socket + THREAD *Thread; // Thread +}; + +// RPC_DUMMY +struct RPC_DUMMY +{ + UINT DummyValue; +}; + +// RPC_NAT_STATUS +struct RPC_NAT_STATUS +{ + char HubName[MAX_HUBNAME_LEN + 1]; // HUB name + UINT NumTcpSessions; // Number of TCP sessions + UINT NumUdpSessions; // Ntmber of UDP sessions + UINT NumIcmpSessions; // Number of ICMP sessions + UINT NumDnsSessions; // Number of DNS sessions + UINT NumDhcpClients; // Number of DHCP clients + bool IsKernelMode; // Whether kernel mode + bool IsRawIpMode; // Whether raw IP mode +}; + +// RPC_NAT_INFO * +struct RPC_NAT_INFO +{ + char NatProductName[128]; // Server product name + char NatVersionString[128]; // Server version string + char NatBuildInfoString[128]; // Server build information string + UINT NatVerInt; // Server version integer value + UINT NatBuildInt; // Server build number integer value + char NatHostName[MAX_HOST_NAME_LEN + 1]; // Server host name + OS_INFO OsInfo; // OS information + MEMINFO MemInfo; // Memory information +}; + +// RPC_ENUM_NAT_ITEM +struct RPC_ENUM_NAT_ITEM +{ + UINT Id; // ID + UINT Protocol; // Protocol + UINT SrcIp; // Source IP address + char SrcHost[MAX_HOST_NAME_LEN + 1]; // Source host name + UINT SrcPort; // Source port number + UINT DestIp; // Destination IP address + char DestHost[MAX_HOST_NAME_LEN + 1]; // Destination host name + UINT DestPort; // Destination port number + UINT64 CreatedTime; // Connection time + UINT64 LastCommTime; // Last communication time + UINT64 SendSize; // Transmission size + UINT64 RecvSize; // Receive size + UINT TcpStatus; // TCP state +}; + +// RPC_ENUM_NAT * +struct RPC_ENUM_NAT +{ + char HubName[MAX_HUBNAME_LEN + 1]; // HUB name + UINT NumItem; // Number of items + RPC_ENUM_NAT_ITEM *Items; // Item +}; + +// RPC_ENUM_DHCP_ITEM +struct RPC_ENUM_DHCP_ITEM +{ + UINT Id; // ID + UINT64 LeasedTime; // Lease time + UINT64 ExpireTime; // Expiration date + UCHAR MacAddress[6]; // MAC address + UCHAR Padding[2]; // Padding + UINT IpAddress; // IP address + UINT Mask; // Subnet mask + char Hostname[MAX_HOST_NAME_LEN + 1]; // Host name +}; + +// RPC_ENUM_DHCP * +struct RPC_ENUM_DHCP +{ + char HubName[MAX_HUBNAME_LEN + 1]; // HUB name + UINT NumItem; // Number of items + RPC_ENUM_DHCP_ITEM *Items; // Item +}; + + +// Function prototype +NAT *NiNewNat(); +NAT *NiNewNatEx(SNAT *snat, VH_OPTION *o); +void NiFreeNat(NAT *n); +void NiInitConfig(NAT *n); +void NiFreeConfig(NAT *n); +void NiInitDefaultConfig(NAT *n); +void NiSetDefaultVhOption(NAT *n, VH_OPTION *o); +void NiClearUnsupportedVhOptionForDynamicHub(VH_OPTION *o, bool initial); +void NiWriteConfig(NAT *n); +void NiWriteVhOption(NAT *n, FOLDER *root); +void NiWriteVhOptionEx(VH_OPTION *o, FOLDER *root); +void NiWriteClientData(NAT *n, FOLDER *root); +void NiLoadVhOption(NAT *n, FOLDER *root); +void NiLoadVhOptionEx(VH_OPTION *o, FOLDER *root); +bool NiLoadConfig(NAT *n, FOLDER *root); +void NiLoadClientData(NAT *n, FOLDER *root); +void NiInitAdminAccept(NAT *n); +void NiFreeAdminAccept(NAT *n); +void NiListenThread(THREAD *thread, void *param); +void NiAdminThread(THREAD *thread, void *param); +void NiAdminMain(NAT *n, SOCK *s); +PACK *NiRpcServer(RPC *r, char *name, PACK *p); + +RPC *NatAdminConnect(CEDAR *cedar, char *hostname, UINT port, void *hashed_password, UINT *err); +void NatAdminDisconnect(RPC *r); + +void NtStartNat(); +void NtStopNat(); +void NtInit(); +void NtFree(); + + +UINT NtOnline(NAT *n, RPC_DUMMY *t); +UINT NtOffline(NAT *n, RPC_DUMMY *t); +UINT NtSetHostOption(NAT *n, VH_OPTION *t); +UINT NtGetHostOption(NAT *n, VH_OPTION *t); +UINT NtSetClientConfig(NAT *n, RPC_CREATE_LINK *t); +UINT NtGetClientConfig(NAT *n, RPC_CREATE_LINK *t); +UINT NtGetStatus(NAT *n, RPC_NAT_STATUS *t); +UINT NtGetInfo(NAT *n, RPC_NAT_INFO *t); +UINT NtEnumNatList(NAT *n, RPC_ENUM_NAT *t); +UINT NtEnumDhcpList(NAT *n, RPC_ENUM_DHCP *t); +UINT NtSetPassword(NAT *n, RPC_SET_PASSWORD *t); + + +UINT NcOnline(RPC *r, RPC_DUMMY *t); +UINT NcOffline(RPC *r, RPC_DUMMY *t); +UINT NcSetHostOption(RPC *r, VH_OPTION *t); +UINT NcGetHostOption(RPC *r, VH_OPTION *t); +UINT NcSetClientConfig(RPC *r, RPC_CREATE_LINK *t); +UINT NcGetClientConfig(RPC *r, RPC_CREATE_LINK *t); +UINT NcGetStatus(RPC *r, RPC_NAT_STATUS *t); +UINT NcGetInfo(RPC *r, RPC_NAT_INFO *t); +UINT NcEnumNatList(RPC *r, RPC_ENUM_NAT *t); +UINT NcEnumDhcpList(RPC *r, RPC_ENUM_DHCP *t); +UINT NcSetPassword(RPC *r, RPC_SET_PASSWORD *t); + + + + +void InRpcEnumDhcp(RPC_ENUM_DHCP *t, PACK *p); +void OutRpcEnumDhcp(PACK *p, RPC_ENUM_DHCP *t); +void FreeRpcEnumDhcp(RPC_ENUM_DHCP *t); +void InRpcEnumNat(RPC_ENUM_NAT *t, PACK *p); +void OutRpcEnumNat(PACK *p, RPC_ENUM_NAT *t); +void FreeRpcEnumNat(RPC_ENUM_NAT *t); +void InRpcNatInfo(RPC_NAT_INFO *t, PACK *p); +void OutRpcNatInfo(PACK *p, RPC_NAT_INFO *t); +void FreeRpcNatInfo(RPC_NAT_INFO *t); +void InRpcNatStatus(RPC_NAT_STATUS *t, PACK *p); +void OutRpcNatStatus(PACK *p, RPC_NAT_STATUS *t); +void FreeRpcNatStatus(RPC_NAT_STATUS *t); +void InVhOption(VH_OPTION *t, PACK *p); +void OutVhOption(PACK *p, VH_OPTION *t); +void InRpcDummy(RPC_DUMMY *t, PACK *p); +void OutRpcDummy(PACK *p, RPC_DUMMY *t); + + + + +#endif // NAT_H + + diff --git a/src/Cedar/NativeStack.c b/src/Cedar/NativeStack.c index afd01afe..e5bc76ba 100644 --- a/src/Cedar/NativeStack.c +++ b/src/Cedar/NativeStack.c @@ -1,895 +1,895 @@ -// SoftEther VPN Source Code - Developer Edition Master Branch -// Cedar Communication Module - - -// NativeStack.c -// Native IP stack - -#include "CedarPch.h" - -// Stack main thread -void NsMainThread(THREAD *thread, void *param) -{ - NATIVE_STACK *a = (NATIVE_STACK *)param; - // Validate arguments - if (thread == NULL || param == NULL) - { - return; - } - - while (true) - { - SOCKSET set; - bool err = false; - bool flush_tube; - LIST *recv_packets; - bool state_changed = false; - - InitSockSet(&set); - AddSockSet(&set, a->Sock1); - - if (a->Halt) - { - break; - } - - // Pass to the IPC by receiving from the bridge -LABEL_RESTART: - state_changed = false; - flush_tube = false; - while (true) - { - void *data; - UINT size; - - size = EthGetPacket(a->Eth, &data); - - if (size == INFINITE) - { - // Device error - err = true; - break; - } - else if (size == 0) - { - // Can not get any more - break; - } - else - { - // Pass the IPC socket - TubeSendEx(a->Sock1->SendTube, data, size, NULL, true); - Free(data); - flush_tube = true; - state_changed = true; - } - } - - if (flush_tube) - { - TubeFlush(a->Sock1->SendTube); - } - - // Pass to the bridge by receiving from IPC - recv_packets = NULL; - while (true) - { - TUBEDATA *d = TubeRecvAsync(a->Sock1->RecvTube); - - if (d == NULL) - { - break; - } - - if (recv_packets == NULL) - { - recv_packets = NewListFast(NULL); - } - - Add(recv_packets, d); - - state_changed = true; - } - if (recv_packets != NULL) - { - UINT i; - UINT num = LIST_NUM(recv_packets); - void **data_array; - UINT *size_array; - - data_array = Malloc(sizeof(void *) * num); - size_array = Malloc(sizeof(UINT) * num); - - for (i = 0;i < num;i++) - { - TUBEDATA *d = LIST_DATA(recv_packets, i); - - data_array[i] = d->Data; - size_array[i] = d->DataSize; - } - - EthPutPackets(a->Eth, num, data_array, size_array); - - for (i = 0;i < num;i++) - { - TUBEDATA *d = LIST_DATA(recv_packets, i); - - // Because the data buffer has been already released, not to release twice - d->Data = NULL; - - FreeTubeData(d); - } - - Free(data_array); - Free(size_array); - - ReleaseList(recv_packets); - } - - if (IsTubeConnected(a->Sock1->SendTube) == false || IsTubeConnected(a->Sock1->RecvTube) == false) - { - err = true; - } - - if (err) - { - // An error has occured - Debug("Native Stack: Error !\n"); - a->Halt = true; - continue; - } - - if (state_changed) - { - goto LABEL_RESTART; - } - - Select(&set, 1234, a->Cancel, NULL); - } - - Disconnect(a->Sock1); - Disconnect(a->Sock2); -} - -// Start the iptables tracking -bool NsStartIpTablesTracking(NATIVE_STACK *a) -{ - if (a->IpTablesThread != NULL) - { - return true; - } - - a->IpTablesInitOk = false; - - a->IpTablesHalt = false; - - a->IpTablesHaltEvent = NewEvent(); - - a->IpTablesThread = NewThread(NsIpTablesThread, a); - - WaitThreadInit(a->IpTablesThread); - - return a->IpTablesInitOk; -} - -// iptables thread -void NsIpTablesThread(THREAD *thread, void *param) -{ - IPTABLES_STATE *state; - NATIVE_STACK *s; - UINT counter = 0; - BUF *seed_buf; - char exe_name[MAX_PATH]; - if (thread == NULL || param == NULL) - { - return; - } - - s = (NATIVE_STACK *)param; - - seed_buf = NewBuf(); - - WriteBuf(seed_buf, s->MacAddress, 6); - - GetExeName(exe_name, sizeof(exe_name)); - WriteBufStr(seed_buf, exe_name); - - state = StartAddIpTablesEntryForNativeStack(seed_buf->Buf, seed_buf->Size); - - FreeBuf(seed_buf); - - if (state == NULL) - { - NoticeThreadInit(thread); - return; - } - - s->IpTablesInitOk = true; - NoticeThreadInit(thread); - - while (true) - { - UINT wait_interval; - - if (s->IpTablesHalt) - { - break; - } - - if (MaintainAddIpTablesEntryForNativeStack(state)) - { - counter = 0; - } - - counter++; - wait_interval = NS_CHECK_IPTABLES_INTERVAL_INIT * counter; - wait_interval = MIN(wait_interval, NS_CHECK_IPTABLES_INTERVAL_MAX); - - //Debug("NsIpTablesThread: wait for %u\n", wait_interval); - Wait(s->IpTablesHaltEvent, wait_interval); - } - - EndAddIpTablesEntryForNativeStack(state); -} - -// Stop the iptables tracking -void NsStopIpTablesTracking(NATIVE_STACK *a) -{ - if (a->IpTablesThread == NULL) - { - return; - } - - a->IpTablesHalt = true; - Set(a->IpTablesHaltEvent); - - WaitThread(a->IpTablesThread, INFINITE); - - ReleaseThread(a->IpTablesThread); - ReleaseEvent(a->IpTablesHaltEvent); - - a->IpTablesThread = NULL; - a->IpTablesHaltEvent = NULL; - a->IpTablesInitOk = false; - a->IpTablesHalt = false; -} - -// Release the stack -void FreeNativeStack(NATIVE_STACK *a) -{ - // Validate arguments - if (a == NULL) - { - return; - } - - if (a->Ipc != NULL && IsZero(&a->CurrentDhcpOptionList, sizeof(a->CurrentDhcpOptionList)) == false) - { - IP dhcp_server; - - UINTToIP(&dhcp_server, a->CurrentDhcpOptionList.ServerAddress); - - IPCDhcpFreeIP(a->Ipc, &dhcp_server); - SleepThread(200); - } - - a->Halt = true; - Cancel(a->Cancel); - Disconnect(a->Sock1); - Disconnect(a->Sock2); - - WaitThread(a->MainThread, INFINITE); - - ReleaseThread(a->MainThread); - - CloseEth(a->Eth); - FreeIPC(a->Ipc); - - NsStopIpTablesTracking(a); - - ReleaseCancel(a->Cancel); - - ReleaseSock(a->Sock1); - ReleaseSock(a->Sock2); - - ReleaseCedar(a->Cedar); - - Free(a); -} - -// Create a new stack -NATIVE_STACK *NewNativeStack(CEDAR *cedar, char *device_name, char *mac_address_seed) -{ - ETH *eth; - NATIVE_STACK *a; - IP localhost; - char tmp[64]; - bool release_cedar = false; - // Validate arguments - if (device_name == NULL || mac_address_seed == NULL) - { - return NULL; - } - - GetLocalHostIP4(&localhost); - - // Open the Eth device - eth = OpenEth(device_name, false, false, NULL); - if (eth == NULL) - { - return NULL; - } - - if (cedar == NULL) - { - cedar = NewCedar(NULL, NULL); - release_cedar = true; - } - - a = ZeroMalloc(sizeof(NATIVE_STACK)); - - NewSocketPair(&a->Sock1, &a->Sock2, &localhost, 1, &localhost, 1); - - a->Cedar = cedar; - AddRef(a->Cedar->ref); - - NsGenMacAddress(a->MacAddress, mac_address_seed, device_name); - - BinToStr(tmp, sizeof(tmp), a->MacAddress, sizeof(a->MacAddress)); - Debug("NewNativeStack: MAC Address = %s\n", tmp); - - a->Ipc = NewIPCBySock(cedar, a->Sock2, a->MacAddress); - - StrCpy(a->DeviceName, sizeof(a->DeviceName), device_name); - - a->Eth = eth; - a->Cancel = EthGetCancel(eth); - - a->MainThread = NewThread(NsMainThread, a); - - if (release_cedar) - { - ReleaseCedar(cedar); - } - - a->IsIpRawMode = a->Eth->IsRawIpMode; - - return a; -} - -// Identify whether the specified MAC address is for the Native Stack which operate on the same host -bool NsIsMacAddressOnLocalhost(UCHAR *mac) -{ - UCHAR tmp[2]; - // Validate arguments - if (mac == NULL) - { - return false; - } - - if (mac[0] != NS_MAC_ADDRESS_BYTE_1) - { - return false; - } - - NsGenMacAddressSignatureForMachine(tmp, mac); - - if (Cmp(mac + 4, tmp, 2) == 0) - { - return true; - } - - return false; -} - -// Determine the last two bytes of the MAC address -void NsGenMacAddressSignatureForMachine(UCHAR *dst_last_2, UCHAR *src_mac_addr_4) -{ - char machine_name[MAX_SIZE]; - BUF *b; - UCHAR hash[SHA1_SIZE]; - // Validate arguments - if (dst_last_2 == NULL || src_mac_addr_4 == NULL) - { - return; - } - - GetMachineHostName(machine_name, sizeof(machine_name)); - - Trim(machine_name); - StrUpper(machine_name); - - b = NewBuf(); - WriteBuf(b, src_mac_addr_4, 4); - WriteBufStr(b, machine_name); - - Sha1(hash, b->Buf, b->Size); - - FreeBuf(b); - - Copy(dst_last_2, hash, 2); -} - -// Generate the MAC address -void NsGenMacAddress(void *dest, char *mac_address_seed, char *device_name) -{ - char tmp[MAX_SIZE]; - UCHAR mac[6]; - UCHAR hash[SHA1_SIZE]; - - Zero(tmp, sizeof(tmp)); - - StrCat(tmp, sizeof(tmp), mac_address_seed); - StrCat(tmp, sizeof(tmp), "@"); - StrCat(tmp, sizeof(tmp), device_name); - - Trim(tmp); - - StrLower(tmp); - - Sha1(hash, tmp, StrLen(tmp)); - - mac[0] = NS_MAC_ADDRESS_BYTE_1; - mac[1] = hash[1]; - mac[2] = hash[2]; - mac[3] = hash[3]; - mac[4] = hash[4]; - mac[5] = hash[5]; - - NsGenMacAddressSignatureForMachine(mac + 4, mac); - - Copy(dest, mac, 6); -} - -// Add the iptables entries for native stack -IPTABLES_STATE *StartAddIpTablesEntryForNativeStack(void *seed, UINT seed_size) -{ - IPTABLES_STATE *ret = NULL; - bool ok = false; - - if (IsIpTablesSupported()) - { - IPTABLES_ENTRY *e; - UINT i; - - ret = ZeroMalloc(sizeof(IPTABLES_STATE)); - - ret->EntryList = NewListFast(NULL); - - Sha1(ret->SeedHash, seed, seed_size); - - // Create a pair of entry - e = ZeroMalloc(sizeof(IPTABLES_ENTRY)); - GenerateDummyIpAndMark(ret->SeedHash, e, 0); - StrCpy(e->Chain, sizeof(e->Chain), "OUTPUT"); - Format(e->ConditionAndArgs, sizeof(e->ConditionAndArgs), - "-p tcp --tcp-flags RST RST --sport %u:%u ! -s %r/32 ! -d %r/32 -m connmark ! --mark 0x%x -j DROP", - NN_RAW_IP_PORT_START, NN_RAW_IP_PORT_END, - &e->DummySrcIp, &e->DummyDestIP, e->DummyMark); - Add(ret->EntryList, e); - - e = ZeroMalloc(sizeof(IPTABLES_ENTRY)); - GenerateDummyIpAndMark(ret->SeedHash, e, 1); - StrCpy(e->Chain, sizeof(e->Chain), "OUTPUT"); - Format(e->ConditionAndArgs, sizeof(e->ConditionAndArgs), - "-p icmp --icmp-type 3/3 ! -s %r/32 ! -d %r/32 -m connmark ! --mark 0x%x -j DROP", - &e->DummySrcIp, &e->DummyDestIP, e->DummyMark); - Add(ret->EntryList, e); - - ok = true; - - // Insert entries if not exists - for (i = 0; i < LIST_NUM(ret->EntryList);i++) - { - UINT j; - IPTABLES_ENTRY *e = LIST_DATA(ret->EntryList, i); - - for (j = 0;j < 100;j++) - { - if (GetCurrentIpTableLineNumber(e->Chain, &e->DummySrcIp, &e->DummyDestIP, e->DummyMark) != 0) - { - char cmdline[MAX_PATH]; - - Format(cmdline, sizeof(cmdline), - "iptables -D %s %s", - e->Chain, e->ConditionAndArgs); - - system(cmdline); - } - else - { - break; - } - } - - if (GetCurrentIpTableLineNumber(e->Chain, &e->DummySrcIp, &e->DummyDestIP, e->DummyMark) == 0) - { - char cmdline[MAX_PATH]; - - Format(cmdline, sizeof(cmdline), - "iptables -I %s %s", - e->Chain, e->ConditionAndArgs); - - system(cmdline); - - if (GetCurrentIpTableLineNumber(e->Chain, &e->DummySrcIp, &e->DummyDestIP, e->DummyMark) == 0) - { - Debug("Run \"%s\" failed.\n", cmdline); - ok = false; - break; - } - else - { - Debug("Run \"%s\" ok.\n", cmdline); - } - } - } - } - - if (ok == false) - { - EndAddIpTablesEntryForNativeStack(ret); - ret = NULL; - } - - return ret; -} - -// Maintain the iptables -bool MaintainAddIpTablesEntryForNativeStack(IPTABLES_STATE *s) -{ - UINT i; - bool ret = false; - if (s == NULL) - { - return false; - } - - if (s->HasError) - { - return false; - } - - // Insert entries if not exists - for (i = 0; i < LIST_NUM(s->EntryList);i++) - { - IPTABLES_ENTRY *e = LIST_DATA(s->EntryList, i); - - if (GetCurrentIpTableLineNumber(e->Chain, &e->DummySrcIp, &e->DummyDestIP, e->DummyMark) == 0) - { - char cmdline[MAX_PATH]; - - Format(cmdline, sizeof(cmdline), - "iptables -I %s %s", - e->Chain, e->ConditionAndArgs); - - system(cmdline); - - if (GetCurrentIpTableLineNumber(e->Chain, &e->DummySrcIp, &e->DummyDestIP, e->DummyMark) == 0) - { - Debug("Run \"%s\" failed.\n", cmdline); - s->HasError = true; - break; - } - else - { - Debug("Run \"%s\" ok.\n", cmdline); - ret = true; - } - } - } - - return ret; -} - -// Stop the iptables management -void EndAddIpTablesEntryForNativeStack(IPTABLES_STATE *s) -{ - UINT i; - if (s == NULL) - { - return; - } - - // Delete entries - for (i = 0; i < LIST_NUM(s->EntryList);i++) - { - IPTABLES_ENTRY *e = LIST_DATA(s->EntryList, i); - UINT j; - - for (j = 0;j < 100;j++) - { - if (GetCurrentIpTableLineNumber(e->Chain, &e->DummySrcIp, &e->DummyDestIP, e->DummyMark) != 0) - { - char cmdline[MAX_PATH]; - - Format(cmdline, sizeof(cmdline), - "iptables -D %s %s", - e->Chain, e->ConditionAndArgs); - - system(cmdline); - } - else - { - break; - } - } - } - - FreeIpTablesState(s); -} - -// Generate a set of dummy IP addresses and mark -void GenerateDummyIpAndMark(void *hash_seed, IPTABLES_ENTRY *e, UINT id) -{ - PRAND *p; - BUF *b; - if (hash_seed == NULL || e == NULL) - { - return; - } - - b = NewBuf(); - WriteBufInt(b, id); - WriteBuf(b, hash_seed, SHA1_SIZE); - WriteBufStr(b, "20151002"); - - p = NewPRand(b->Buf, b->Size); - FreeBuf(b); - - GenerateDummyIp(p, &e->DummySrcIp); - GenerateDummyIp(p, &e->DummyDestIP); - e->DummyMark = GenerateDummyMark(p); - - FreePRand(p); -} - -// Generate a dummy iptables mark -UINT GenerateDummyMark(PRAND *p) -{ - UINT i; - if (p == NULL) - { - return 0; - } - - while (true) - { - i = PRandInt(p); - - if (i >= 1000000000 && i <= 0x7FFFFFFE) - { - return i; - } - } - - return 0; -} - -// Generate a dummy IP -void GenerateDummyIp(PRAND *p, IP *ip) -{ - UINT i; - if (p == NULL || ip == NULL) - { - return; - } - - Zero(ip, sizeof(IP)); - - for (i = 1;i < 4;i++) - { - UINT v = 0; - while (true) - { - v = PRandInt(p) % 256; - if (v >= 1 && v <= 254) - { - break; - } - } - - ip->addr[i] = (UCHAR)v; - } - - ip->addr[0] = 127; -} - -// Search an entry -IPTABLES_ENTRY *SearchIpTables(IPTABLES_STATE *s, char *chain, IP *src_ip, IP *dest_ip, UINT mark) -{ - char ip_str1[64]; - char ip_str2[64]; - char mark_str1[64]; - char mark_str2[64]; - UINT i; - if (s == NULL || chain == NULL || src_ip == NULL || dest_ip == NULL || mark == 0) - { - return NULL; - } - - IPToStr(ip_str1, sizeof(ip_str1), src_ip); - IPToStr(ip_str2, sizeof(ip_str2), dest_ip); - ToStr(mark_str1, mark); - Format(mark_str2, sizeof(mark_str2), "%x", mark); - - for (i = 0;i < LIST_NUM(s->EntryList);i++) - { - IPTABLES_ENTRY *e = LIST_DATA(s->EntryList, i); - - if (StrCmpi(e->Chain, chain) == 0) - { - if (InStr(e->ConditionAndArgs, ip_str1) && - InStr(e->ConditionAndArgs, ip_str2) && - (InStr(e->ConditionAndArgs, mark_str1) || InStr(e->ConditionAndArgs, mark_str2))) - { - return e; - } - } - } - - return NULL; -} - -// Search an entry and get the line number -UINT GetCurrentIpTableLineNumber(char *chain, IP *src_ip, IP *dest_ip, UINT mark) -{ - IPTABLES_STATE *s; - IPTABLES_ENTRY *e; - UINT ret = 0; - - if (chain == NULL || src_ip == NULL || dest_ip == NULL || mark == 0) - { - return 0; - } - - s = GetCurrentIpTables(); - - e = SearchIpTables(s, chain, src_ip, dest_ip, mark); - - if (e != NULL) - { - ret = e->LineNumber; - } - - FreeIpTablesState(s); - - return ret; -} - -// Free the iptables state -void FreeIpTablesState(IPTABLES_STATE *s) -{ - UINT i; - if (s == NULL) - { - return; - } - - for (i = 0;i < LIST_NUM(s->EntryList);i++) - { - IPTABLES_ENTRY *e = LIST_DATA(s->EntryList, i); - - Free(e); - } - - ReleaseList(s->EntryList); - - Free(s); -} - -// Get the current iptables state -IPTABLES_STATE *GetCurrentIpTables() -{ - IPTABLES_STATE *ret = NULL; - TOKEN_LIST *t = NULL; - -#ifdef OS_UNIX - t = UnixExec("iptables -L -x -n --line-numbers"); -#endif // OS_UNIX - - if (t != NULL) - { - UINT i; - UINT tmp_num = 0; - - for (i = 0;i < t->NumTokens;i++) - { - char *line = t->Token[i]; - if (StartWith(line, "Chain INPUT") || - StartWith(line, "Chain FORWARD") || - StartWith(line, "Chain OUTPUT")) - { - tmp_num++; - } - } - - if (tmp_num >= 3) - { - char current_chain[64]; - UINT mode = 0; - - Zero(current_chain, sizeof(current_chain)); - - for (i = 0;i < t->NumTokens;i++) - { - char *line = t->Token[i]; - - if (StartWith(line, "Chain")) - { - TOKEN_LIST *t2 = ParseToken(line, " \t"); - if (t2 != NULL) - { - if (t2->NumTokens >= 4) - { - StrCpy(current_chain, sizeof(current_chain), t2->Token[1]); - mode = 1; - - if (ret == NULL) - { - ret = ZeroMalloc(sizeof(IPTABLES_STATE)); - ret->EntryList = NewListFast(NULL); - } - - } - FreeToken(t2); - } - } - - if (mode == 1) - { - if (StartWith(line, "num")) - { - mode = 2; - } - } - else if (mode == 2) - { - TOKEN_LIST *t2 = ParseToken(line, " \t"); - if (t2 != NULL) - { - if (t2->NumTokens >= 6 && ToInt(t2->Token[0]) != 0) - { - IPTABLES_ENTRY *e = ZeroMalloc(sizeof(IPTABLES_ENTRY)); - - StrCpy(e->Chain, sizeof(e->Chain), current_chain); - e->LineNumber = ToInt(t2->Token[0]); - StrCpy(e->ConditionAndArgs, sizeof(e->ConditionAndArgs), line); - - Add(ret->EntryList, e); - } - - FreeToken(t2); - } - } - } - } - - FreeToken(t); - } - - return ret; -} - -// Get whether iptables is supported -bool IsIpTablesSupported() -{ -#ifdef UNIX_LINUX - IPTABLES_STATE *s = GetCurrentIpTables(); - if (s != NULL) - { - FreeIpTablesState(s); - return true; - } - else - { - return false; - } -#else // UNIX_LINUX - return false; -#endif // UNIX_LINUX -} - - - - +// SoftEther VPN Source Code - Developer Edition Master Branch +// Cedar Communication Module + + +// NativeStack.c +// Native IP stack + +#include "CedarPch.h" + +// Stack main thread +void NsMainThread(THREAD *thread, void *param) +{ + NATIVE_STACK *a = (NATIVE_STACK *)param; + // Validate arguments + if (thread == NULL || param == NULL) + { + return; + } + + while (true) + { + SOCKSET set; + bool err = false; + bool flush_tube; + LIST *recv_packets; + bool state_changed = false; + + InitSockSet(&set); + AddSockSet(&set, a->Sock1); + + if (a->Halt) + { + break; + } + + // Pass to the IPC by receiving from the bridge +LABEL_RESTART: + state_changed = false; + flush_tube = false; + while (true) + { + void *data; + UINT size; + + size = EthGetPacket(a->Eth, &data); + + if (size == INFINITE) + { + // Device error + err = true; + break; + } + else if (size == 0) + { + // Can not get any more + break; + } + else + { + // Pass the IPC socket + TubeSendEx(a->Sock1->SendTube, data, size, NULL, true); + Free(data); + flush_tube = true; + state_changed = true; + } + } + + if (flush_tube) + { + TubeFlush(a->Sock1->SendTube); + } + + // Pass to the bridge by receiving from IPC + recv_packets = NULL; + while (true) + { + TUBEDATA *d = TubeRecvAsync(a->Sock1->RecvTube); + + if (d == NULL) + { + break; + } + + if (recv_packets == NULL) + { + recv_packets = NewListFast(NULL); + } + + Add(recv_packets, d); + + state_changed = true; + } + if (recv_packets != NULL) + { + UINT i; + UINT num = LIST_NUM(recv_packets); + void **data_array; + UINT *size_array; + + data_array = Malloc(sizeof(void *) * num); + size_array = Malloc(sizeof(UINT) * num); + + for (i = 0;i < num;i++) + { + TUBEDATA *d = LIST_DATA(recv_packets, i); + + data_array[i] = d->Data; + size_array[i] = d->DataSize; + } + + EthPutPackets(a->Eth, num, data_array, size_array); + + for (i = 0;i < num;i++) + { + TUBEDATA *d = LIST_DATA(recv_packets, i); + + // Because the data buffer has been already released, not to release twice + d->Data = NULL; + + FreeTubeData(d); + } + + Free(data_array); + Free(size_array); + + ReleaseList(recv_packets); + } + + if (IsTubeConnected(a->Sock1->SendTube) == false || IsTubeConnected(a->Sock1->RecvTube) == false) + { + err = true; + } + + if (err) + { + // An error has occured + Debug("Native Stack: Error !\n"); + a->Halt = true; + continue; + } + + if (state_changed) + { + goto LABEL_RESTART; + } + + Select(&set, 1234, a->Cancel, NULL); + } + + Disconnect(a->Sock1); + Disconnect(a->Sock2); +} + +// Start the iptables tracking +bool NsStartIpTablesTracking(NATIVE_STACK *a) +{ + if (a->IpTablesThread != NULL) + { + return true; + } + + a->IpTablesInitOk = false; + + a->IpTablesHalt = false; + + a->IpTablesHaltEvent = NewEvent(); + + a->IpTablesThread = NewThread(NsIpTablesThread, a); + + WaitThreadInit(a->IpTablesThread); + + return a->IpTablesInitOk; +} + +// iptables thread +void NsIpTablesThread(THREAD *thread, void *param) +{ + IPTABLES_STATE *state; + NATIVE_STACK *s; + UINT counter = 0; + BUF *seed_buf; + char exe_name[MAX_PATH]; + if (thread == NULL || param == NULL) + { + return; + } + + s = (NATIVE_STACK *)param; + + seed_buf = NewBuf(); + + WriteBuf(seed_buf, s->MacAddress, 6); + + GetExeName(exe_name, sizeof(exe_name)); + WriteBufStr(seed_buf, exe_name); + + state = StartAddIpTablesEntryForNativeStack(seed_buf->Buf, seed_buf->Size); + + FreeBuf(seed_buf); + + if (state == NULL) + { + NoticeThreadInit(thread); + return; + } + + s->IpTablesInitOk = true; + NoticeThreadInit(thread); + + while (true) + { + UINT wait_interval; + + if (s->IpTablesHalt) + { + break; + } + + if (MaintainAddIpTablesEntryForNativeStack(state)) + { + counter = 0; + } + + counter++; + wait_interval = NS_CHECK_IPTABLES_INTERVAL_INIT * counter; + wait_interval = MIN(wait_interval, NS_CHECK_IPTABLES_INTERVAL_MAX); + + //Debug("NsIpTablesThread: wait for %u\n", wait_interval); + Wait(s->IpTablesHaltEvent, wait_interval); + } + + EndAddIpTablesEntryForNativeStack(state); +} + +// Stop the iptables tracking +void NsStopIpTablesTracking(NATIVE_STACK *a) +{ + if (a->IpTablesThread == NULL) + { + return; + } + + a->IpTablesHalt = true; + Set(a->IpTablesHaltEvent); + + WaitThread(a->IpTablesThread, INFINITE); + + ReleaseThread(a->IpTablesThread); + ReleaseEvent(a->IpTablesHaltEvent); + + a->IpTablesThread = NULL; + a->IpTablesHaltEvent = NULL; + a->IpTablesInitOk = false; + a->IpTablesHalt = false; +} + +// Release the stack +void FreeNativeStack(NATIVE_STACK *a) +{ + // Validate arguments + if (a == NULL) + { + return; + } + + if (a->Ipc != NULL && IsZero(&a->CurrentDhcpOptionList, sizeof(a->CurrentDhcpOptionList)) == false) + { + IP dhcp_server; + + UINTToIP(&dhcp_server, a->CurrentDhcpOptionList.ServerAddress); + + IPCDhcpFreeIP(a->Ipc, &dhcp_server); + SleepThread(200); + } + + a->Halt = true; + Cancel(a->Cancel); + Disconnect(a->Sock1); + Disconnect(a->Sock2); + + WaitThread(a->MainThread, INFINITE); + + ReleaseThread(a->MainThread); + + CloseEth(a->Eth); + FreeIPC(a->Ipc); + + NsStopIpTablesTracking(a); + + ReleaseCancel(a->Cancel); + + ReleaseSock(a->Sock1); + ReleaseSock(a->Sock2); + + ReleaseCedar(a->Cedar); + + Free(a); +} + +// Create a new stack +NATIVE_STACK *NewNativeStack(CEDAR *cedar, char *device_name, char *mac_address_seed) +{ + ETH *eth; + NATIVE_STACK *a; + IP localhost; + char tmp[64]; + bool release_cedar = false; + // Validate arguments + if (device_name == NULL || mac_address_seed == NULL) + { + return NULL; + } + + GetLocalHostIP4(&localhost); + + // Open the Eth device + eth = OpenEth(device_name, false, false, NULL); + if (eth == NULL) + { + return NULL; + } + + if (cedar == NULL) + { + cedar = NewCedar(NULL, NULL); + release_cedar = true; + } + + a = ZeroMalloc(sizeof(NATIVE_STACK)); + + NewSocketPair(&a->Sock1, &a->Sock2, &localhost, 1, &localhost, 1); + + a->Cedar = cedar; + AddRef(a->Cedar->ref); + + NsGenMacAddress(a->MacAddress, mac_address_seed, device_name); + + BinToStr(tmp, sizeof(tmp), a->MacAddress, sizeof(a->MacAddress)); + Debug("NewNativeStack: MAC Address = %s\n", tmp); + + a->Ipc = NewIPCBySock(cedar, a->Sock2, a->MacAddress); + + StrCpy(a->DeviceName, sizeof(a->DeviceName), device_name); + + a->Eth = eth; + a->Cancel = EthGetCancel(eth); + + a->MainThread = NewThread(NsMainThread, a); + + if (release_cedar) + { + ReleaseCedar(cedar); + } + + a->IsIpRawMode = a->Eth->IsRawIpMode; + + return a; +} + +// Identify whether the specified MAC address is for the Native Stack which operate on the same host +bool NsIsMacAddressOnLocalhost(UCHAR *mac) +{ + UCHAR tmp[2]; + // Validate arguments + if (mac == NULL) + { + return false; + } + + if (mac[0] != NS_MAC_ADDRESS_BYTE_1) + { + return false; + } + + NsGenMacAddressSignatureForMachine(tmp, mac); + + if (Cmp(mac + 4, tmp, 2) == 0) + { + return true; + } + + return false; +} + +// Determine the last two bytes of the MAC address +void NsGenMacAddressSignatureForMachine(UCHAR *dst_last_2, UCHAR *src_mac_addr_4) +{ + char machine_name[MAX_SIZE]; + BUF *b; + UCHAR hash[SHA1_SIZE]; + // Validate arguments + if (dst_last_2 == NULL || src_mac_addr_4 == NULL) + { + return; + } + + GetMachineHostName(machine_name, sizeof(machine_name)); + + Trim(machine_name); + StrUpper(machine_name); + + b = NewBuf(); + WriteBuf(b, src_mac_addr_4, 4); + WriteBufStr(b, machine_name); + + Sha1(hash, b->Buf, b->Size); + + FreeBuf(b); + + Copy(dst_last_2, hash, 2); +} + +// Generate the MAC address +void NsGenMacAddress(void *dest, char *mac_address_seed, char *device_name) +{ + char tmp[MAX_SIZE]; + UCHAR mac[6]; + UCHAR hash[SHA1_SIZE]; + + Zero(tmp, sizeof(tmp)); + + StrCat(tmp, sizeof(tmp), mac_address_seed); + StrCat(tmp, sizeof(tmp), "@"); + StrCat(tmp, sizeof(tmp), device_name); + + Trim(tmp); + + StrLower(tmp); + + Sha1(hash, tmp, StrLen(tmp)); + + mac[0] = NS_MAC_ADDRESS_BYTE_1; + mac[1] = hash[1]; + mac[2] = hash[2]; + mac[3] = hash[3]; + mac[4] = hash[4]; + mac[5] = hash[5]; + + NsGenMacAddressSignatureForMachine(mac + 4, mac); + + Copy(dest, mac, 6); +} + +// Add the iptables entries for native stack +IPTABLES_STATE *StartAddIpTablesEntryForNativeStack(void *seed, UINT seed_size) +{ + IPTABLES_STATE *ret = NULL; + bool ok = false; + + if (IsIpTablesSupported()) + { + IPTABLES_ENTRY *e; + UINT i; + + ret = ZeroMalloc(sizeof(IPTABLES_STATE)); + + ret->EntryList = NewListFast(NULL); + + Sha1(ret->SeedHash, seed, seed_size); + + // Create a pair of entry + e = ZeroMalloc(sizeof(IPTABLES_ENTRY)); + GenerateDummyIpAndMark(ret->SeedHash, e, 0); + StrCpy(e->Chain, sizeof(e->Chain), "OUTPUT"); + Format(e->ConditionAndArgs, sizeof(e->ConditionAndArgs), + "-p tcp --tcp-flags RST RST --sport %u:%u ! -s %r/32 ! -d %r/32 -m connmark ! --mark 0x%x -j DROP", + NN_RAW_IP_PORT_START, NN_RAW_IP_PORT_END, + &e->DummySrcIp, &e->DummyDestIP, e->DummyMark); + Add(ret->EntryList, e); + + e = ZeroMalloc(sizeof(IPTABLES_ENTRY)); + GenerateDummyIpAndMark(ret->SeedHash, e, 1); + StrCpy(e->Chain, sizeof(e->Chain), "OUTPUT"); + Format(e->ConditionAndArgs, sizeof(e->ConditionAndArgs), + "-p icmp --icmp-type 3/3 ! -s %r/32 ! -d %r/32 -m connmark ! --mark 0x%x -j DROP", + &e->DummySrcIp, &e->DummyDestIP, e->DummyMark); + Add(ret->EntryList, e); + + ok = true; + + // Insert entries if not exists + for (i = 0; i < LIST_NUM(ret->EntryList);i++) + { + UINT j; + IPTABLES_ENTRY *e = LIST_DATA(ret->EntryList, i); + + for (j = 0;j < 100;j++) + { + if (GetCurrentIpTableLineNumber(e->Chain, &e->DummySrcIp, &e->DummyDestIP, e->DummyMark) != 0) + { + char cmdline[MAX_PATH]; + + Format(cmdline, sizeof(cmdline), + "iptables -D %s %s", + e->Chain, e->ConditionAndArgs); + + system(cmdline); + } + else + { + break; + } + } + + if (GetCurrentIpTableLineNumber(e->Chain, &e->DummySrcIp, &e->DummyDestIP, e->DummyMark) == 0) + { + char cmdline[MAX_PATH]; + + Format(cmdline, sizeof(cmdline), + "iptables -I %s %s", + e->Chain, e->ConditionAndArgs); + + system(cmdline); + + if (GetCurrentIpTableLineNumber(e->Chain, &e->DummySrcIp, &e->DummyDestIP, e->DummyMark) == 0) + { + Debug("Run \"%s\" failed.\n", cmdline); + ok = false; + break; + } + else + { + Debug("Run \"%s\" ok.\n", cmdline); + } + } + } + } + + if (ok == false) + { + EndAddIpTablesEntryForNativeStack(ret); + ret = NULL; + } + + return ret; +} + +// Maintain the iptables +bool MaintainAddIpTablesEntryForNativeStack(IPTABLES_STATE *s) +{ + UINT i; + bool ret = false; + if (s == NULL) + { + return false; + } + + if (s->HasError) + { + return false; + } + + // Insert entries if not exists + for (i = 0; i < LIST_NUM(s->EntryList);i++) + { + IPTABLES_ENTRY *e = LIST_DATA(s->EntryList, i); + + if (GetCurrentIpTableLineNumber(e->Chain, &e->DummySrcIp, &e->DummyDestIP, e->DummyMark) == 0) + { + char cmdline[MAX_PATH]; + + Format(cmdline, sizeof(cmdline), + "iptables -I %s %s", + e->Chain, e->ConditionAndArgs); + + system(cmdline); + + if (GetCurrentIpTableLineNumber(e->Chain, &e->DummySrcIp, &e->DummyDestIP, e->DummyMark) == 0) + { + Debug("Run \"%s\" failed.\n", cmdline); + s->HasError = true; + break; + } + else + { + Debug("Run \"%s\" ok.\n", cmdline); + ret = true; + } + } + } + + return ret; +} + +// Stop the iptables management +void EndAddIpTablesEntryForNativeStack(IPTABLES_STATE *s) +{ + UINT i; + if (s == NULL) + { + return; + } + + // Delete entries + for (i = 0; i < LIST_NUM(s->EntryList);i++) + { + IPTABLES_ENTRY *e = LIST_DATA(s->EntryList, i); + UINT j; + + for (j = 0;j < 100;j++) + { + if (GetCurrentIpTableLineNumber(e->Chain, &e->DummySrcIp, &e->DummyDestIP, e->DummyMark) != 0) + { + char cmdline[MAX_PATH]; + + Format(cmdline, sizeof(cmdline), + "iptables -D %s %s", + e->Chain, e->ConditionAndArgs); + + system(cmdline); + } + else + { + break; + } + } + } + + FreeIpTablesState(s); +} + +// Generate a set of dummy IP addresses and mark +void GenerateDummyIpAndMark(void *hash_seed, IPTABLES_ENTRY *e, UINT id) +{ + PRAND *p; + BUF *b; + if (hash_seed == NULL || e == NULL) + { + return; + } + + b = NewBuf(); + WriteBufInt(b, id); + WriteBuf(b, hash_seed, SHA1_SIZE); + WriteBufStr(b, "20151002"); + + p = NewPRand(b->Buf, b->Size); + FreeBuf(b); + + GenerateDummyIp(p, &e->DummySrcIp); + GenerateDummyIp(p, &e->DummyDestIP); + e->DummyMark = GenerateDummyMark(p); + + FreePRand(p); +} + +// Generate a dummy iptables mark +UINT GenerateDummyMark(PRAND *p) +{ + UINT i; + if (p == NULL) + { + return 0; + } + + while (true) + { + i = PRandInt(p); + + if (i >= 1000000000 && i <= 0x7FFFFFFE) + { + return i; + } + } + + return 0; +} + +// Generate a dummy IP +void GenerateDummyIp(PRAND *p, IP *ip) +{ + UINT i; + if (p == NULL || ip == NULL) + { + return; + } + + Zero(ip, sizeof(IP)); + + for (i = 1;i < 4;i++) + { + UINT v = 0; + while (true) + { + v = PRandInt(p) % 256; + if (v >= 1 && v <= 254) + { + break; + } + } + + ip->addr[i] = (UCHAR)v; + } + + ip->addr[0] = 127; +} + +// Search an entry +IPTABLES_ENTRY *SearchIpTables(IPTABLES_STATE *s, char *chain, IP *src_ip, IP *dest_ip, UINT mark) +{ + char ip_str1[64]; + char ip_str2[64]; + char mark_str1[64]; + char mark_str2[64]; + UINT i; + if (s == NULL || chain == NULL || src_ip == NULL || dest_ip == NULL || mark == 0) + { + return NULL; + } + + IPToStr(ip_str1, sizeof(ip_str1), src_ip); + IPToStr(ip_str2, sizeof(ip_str2), dest_ip); + ToStr(mark_str1, mark); + Format(mark_str2, sizeof(mark_str2), "%x", mark); + + for (i = 0;i < LIST_NUM(s->EntryList);i++) + { + IPTABLES_ENTRY *e = LIST_DATA(s->EntryList, i); + + if (StrCmpi(e->Chain, chain) == 0) + { + if (InStr(e->ConditionAndArgs, ip_str1) && + InStr(e->ConditionAndArgs, ip_str2) && + (InStr(e->ConditionAndArgs, mark_str1) || InStr(e->ConditionAndArgs, mark_str2))) + { + return e; + } + } + } + + return NULL; +} + +// Search an entry and get the line number +UINT GetCurrentIpTableLineNumber(char *chain, IP *src_ip, IP *dest_ip, UINT mark) +{ + IPTABLES_STATE *s; + IPTABLES_ENTRY *e; + UINT ret = 0; + + if (chain == NULL || src_ip == NULL || dest_ip == NULL || mark == 0) + { + return 0; + } + + s = GetCurrentIpTables(); + + e = SearchIpTables(s, chain, src_ip, dest_ip, mark); + + if (e != NULL) + { + ret = e->LineNumber; + } + + FreeIpTablesState(s); + + return ret; +} + +// Free the iptables state +void FreeIpTablesState(IPTABLES_STATE *s) +{ + UINT i; + if (s == NULL) + { + return; + } + + for (i = 0;i < LIST_NUM(s->EntryList);i++) + { + IPTABLES_ENTRY *e = LIST_DATA(s->EntryList, i); + + Free(e); + } + + ReleaseList(s->EntryList); + + Free(s); +} + +// Get the current iptables state +IPTABLES_STATE *GetCurrentIpTables() +{ + IPTABLES_STATE *ret = NULL; + TOKEN_LIST *t = NULL; + +#ifdef OS_UNIX + t = UnixExec("iptables -L -x -n --line-numbers"); +#endif // OS_UNIX + + if (t != NULL) + { + UINT i; + UINT tmp_num = 0; + + for (i = 0;i < t->NumTokens;i++) + { + char *line = t->Token[i]; + if (StartWith(line, "Chain INPUT") || + StartWith(line, "Chain FORWARD") || + StartWith(line, "Chain OUTPUT")) + { + tmp_num++; + } + } + + if (tmp_num >= 3) + { + char current_chain[64]; + UINT mode = 0; + + Zero(current_chain, sizeof(current_chain)); + + for (i = 0;i < t->NumTokens;i++) + { + char *line = t->Token[i]; + + if (StartWith(line, "Chain")) + { + TOKEN_LIST *t2 = ParseToken(line, " \t"); + if (t2 != NULL) + { + if (t2->NumTokens >= 4) + { + StrCpy(current_chain, sizeof(current_chain), t2->Token[1]); + mode = 1; + + if (ret == NULL) + { + ret = ZeroMalloc(sizeof(IPTABLES_STATE)); + ret->EntryList = NewListFast(NULL); + } + + } + FreeToken(t2); + } + } + + if (mode == 1) + { + if (StartWith(line, "num")) + { + mode = 2; + } + } + else if (mode == 2) + { + TOKEN_LIST *t2 = ParseToken(line, " \t"); + if (t2 != NULL) + { + if (t2->NumTokens >= 6 && ToInt(t2->Token[0]) != 0) + { + IPTABLES_ENTRY *e = ZeroMalloc(sizeof(IPTABLES_ENTRY)); + + StrCpy(e->Chain, sizeof(e->Chain), current_chain); + e->LineNumber = ToInt(t2->Token[0]); + StrCpy(e->ConditionAndArgs, sizeof(e->ConditionAndArgs), line); + + Add(ret->EntryList, e); + } + + FreeToken(t2); + } + } + } + } + + FreeToken(t); + } + + return ret; +} + +// Get whether iptables is supported +bool IsIpTablesSupported() +{ +#ifdef UNIX_LINUX + IPTABLES_STATE *s = GetCurrentIpTables(); + if (s != NULL) + { + FreeIpTablesState(s); + return true; + } + else + { + return false; + } +#else // UNIX_LINUX + return false; +#endif // UNIX_LINUX +} + + + + diff --git a/src/Cedar/NativeStack.h b/src/Cedar/NativeStack.h index 23142d8a..f55e70c5 100644 --- a/src/Cedar/NativeStack.h +++ b/src/Cedar/NativeStack.h @@ -1,89 +1,89 @@ -// SoftEther VPN Source Code - Developer Edition Master Branch -// Cedar Communication Module - - -// NativeStack.h -// Header of NativeStack.c - -#ifndef NATIVESTACK_H -#define NATIVESTACK_H - -//// Constants -#define NS_MAC_ADDRESS_BYTE_1 0xDA // First byte of the MAC address - -#define NS_CHECK_IPTABLES_INTERVAL_INIT (1 * 1000) - -#define NS_CHECK_IPTABLES_INTERVAL_MAX (5 * 60 * 1000) - -//// Type -struct NATIVE_STACK -{ - CEDAR *Cedar; - IPC *Ipc; // IPC object - char DeviceName[MAX_SIZE]; // Ethernet device name - THREAD *MainThread; // Main thread - bool Halt; // Halting flag - CANCEL *Cancel; // Cancel - UCHAR MacAddress[6]; // MAC address of the virtual host - ETH *Eth; // Eth device - SOCK *Sock1; // Sock1 (To be used in the bridge side) - SOCK *Sock2; // Sock2 (Used in the IPC side) - DHCP_OPTION_LIST CurrentDhcpOptionList; // Current DHCP options list - IP DnsServerIP; // IP address of the DNS server - IP DnsServerIP2; // IP address of the DNS server #2 - bool IsIpRawMode; - IP MyIP_InCaseOfIpRawMode; // My IP - - THREAD *IpTablesThread; - EVENT *IpTablesHaltEvent; - bool IpTablesHalt; - bool IpTablesInitOk; -}; - -struct IPTABLES_ENTRY -{ - char Chain[64]; - UINT LineNumber; - char ConditionAndArgs[MAX_SIZE]; - IP DummySrcIp, DummyDestIP; - UINT DummyMark; -}; - -struct IPTABLES_STATE -{ - UCHAR SeedHash[SHA1_SIZE]; - LIST *EntryList; - bool HasError; -}; - - -//// Function prototype -NATIVE_STACK *NewNativeStack(CEDAR *cedar, char *device_name, char *mac_address_seed); -void FreeNativeStack(NATIVE_STACK *a); - -void NsGenMacAddress(void *dest, char *mac_address_seed, char *device_name); -void NsMainThread(THREAD *thread, void *param); -void NsGenMacAddressSignatureForMachine(UCHAR *dst_last_2, UCHAR *src_mac_addr_4); -bool NsIsMacAddressOnLocalhost(UCHAR *mac); - -bool NsStartIpTablesTracking(NATIVE_STACK *a); -void NsStopIpTablesTracking(NATIVE_STACK *a); -void NsIpTablesThread(THREAD *thread, void *param); - -IPTABLES_STATE *GetCurrentIpTables(); -void FreeIpTablesState(IPTABLES_STATE *s); -bool IsIpTablesSupported(); -IPTABLES_ENTRY *SearchIpTables(IPTABLES_STATE *s, char *chain, IP *src_ip, IP *dest_ip, UINT mark); -UINT GetCurrentIpTableLineNumber(char *chain, IP *src_ip, IP *dest_ip, UINT mark); - -IPTABLES_STATE *StartAddIpTablesEntryForNativeStack(void *seed, UINT seed_size); -void EndAddIpTablesEntryForNativeStack(IPTABLES_STATE *s); -bool MaintainAddIpTablesEntryForNativeStack(IPTABLES_STATE *s); - -void GenerateDummyIpAndMark(void *hash_seed, IPTABLES_ENTRY *e, UINT id); -UINT GenerateDummyMark(PRAND *p); -void GenerateDummyIp(PRAND *p, IP *ip); - -#endif // NATIVESTACK_H - - +// SoftEther VPN Source Code - Developer Edition Master Branch +// Cedar Communication Module + + +// NativeStack.h +// Header of NativeStack.c + +#ifndef NATIVESTACK_H +#define NATIVESTACK_H + +//// Constants +#define NS_MAC_ADDRESS_BYTE_1 0xDA // First byte of the MAC address + +#define NS_CHECK_IPTABLES_INTERVAL_INIT (1 * 1000) + +#define NS_CHECK_IPTABLES_INTERVAL_MAX (5 * 60 * 1000) + +//// Type +struct NATIVE_STACK +{ + CEDAR *Cedar; + IPC *Ipc; // IPC object + char DeviceName[MAX_SIZE]; // Ethernet device name + THREAD *MainThread; // Main thread + bool Halt; // Halting flag + CANCEL *Cancel; // Cancel + UCHAR MacAddress[6]; // MAC address of the virtual host + ETH *Eth; // Eth device + SOCK *Sock1; // Sock1 (To be used in the bridge side) + SOCK *Sock2; // Sock2 (Used in the IPC side) + DHCP_OPTION_LIST CurrentDhcpOptionList; // Current DHCP options list + IP DnsServerIP; // IP address of the DNS server + IP DnsServerIP2; // IP address of the DNS server #2 + bool IsIpRawMode; + IP MyIP_InCaseOfIpRawMode; // My IP + + THREAD *IpTablesThread; + EVENT *IpTablesHaltEvent; + bool IpTablesHalt; + bool IpTablesInitOk; +}; + +struct IPTABLES_ENTRY +{ + char Chain[64]; + UINT LineNumber; + char ConditionAndArgs[MAX_SIZE]; + IP DummySrcIp, DummyDestIP; + UINT DummyMark; +}; + +struct IPTABLES_STATE +{ + UCHAR SeedHash[SHA1_SIZE]; + LIST *EntryList; + bool HasError; +}; + + +//// Function prototype +NATIVE_STACK *NewNativeStack(CEDAR *cedar, char *device_name, char *mac_address_seed); +void FreeNativeStack(NATIVE_STACK *a); + +void NsGenMacAddress(void *dest, char *mac_address_seed, char *device_name); +void NsMainThread(THREAD *thread, void *param); +void NsGenMacAddressSignatureForMachine(UCHAR *dst_last_2, UCHAR *src_mac_addr_4); +bool NsIsMacAddressOnLocalhost(UCHAR *mac); + +bool NsStartIpTablesTracking(NATIVE_STACK *a); +void NsStopIpTablesTracking(NATIVE_STACK *a); +void NsIpTablesThread(THREAD *thread, void *param); + +IPTABLES_STATE *GetCurrentIpTables(); +void FreeIpTablesState(IPTABLES_STATE *s); +bool IsIpTablesSupported(); +IPTABLES_ENTRY *SearchIpTables(IPTABLES_STATE *s, char *chain, IP *src_ip, IP *dest_ip, UINT mark); +UINT GetCurrentIpTableLineNumber(char *chain, IP *src_ip, IP *dest_ip, UINT mark); + +IPTABLES_STATE *StartAddIpTablesEntryForNativeStack(void *seed, UINT seed_size); +void EndAddIpTablesEntryForNativeStack(IPTABLES_STATE *s); +bool MaintainAddIpTablesEntryForNativeStack(IPTABLES_STATE *s); + +void GenerateDummyIpAndMark(void *hash_seed, IPTABLES_ENTRY *e, UINT id); +UINT GenerateDummyMark(PRAND *p); +void GenerateDummyIp(PRAND *p, IP *ip); + +#endif // NATIVESTACK_H + + diff --git a/src/Cedar/NullLan.c b/src/Cedar/NullLan.c index 1e2606a0..adeb06e2 100644 --- a/src/Cedar/NullLan.c +++ b/src/Cedar/NullLan.c @@ -1,227 +1,227 @@ -// SoftEther VPN Source Code - Developer Edition Master Branch -// Cedar Communication Module - - -// NullLan.c -// Virtual LAN card device driver for testing - -#include "CedarPch.h" - -static UCHAR null_lan_broadcast_address[] = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff}; - -// Get the packet adapter -PACKET_ADAPTER *NullGetPacketAdapter() -{ - PACKET_ADAPTER *pa = NewPacketAdapter(NullPaInit, NullPaGetCancel, NullPaGetNextPacket, - NullPaPutPacket, NullPaFree); - - return pa; -} - -// Generate MAC address -void NullGenerateMacAddress(UCHAR *mac, UINT id, UINT seq) -{ - UCHAR hash[SHA1_SIZE]; - char name[MAX_SIZE]; - BUF *b; - // Validate arguments - if (mac == NULL) - { - return; - } - - b = NewBuf(); - WriteBufInt(b, id); - WriteBufInt(b, seq); - GetMachineHostName(name, sizeof(name)); -#ifdef OS_WIN32 - WriteBufInt(b, MsGetCurrentProcessId()); -#endif // OS_WIN32 - WriteBufStr(b, name); - - Sha1(hash, b->Buf, b->Size); - - FreeBuf(b); - - Copy(mac, hash, 6); - mac[0] = 0x7E; -} - -// Packet generation thread -void NullPacketGenerateThread(THREAD *t, void *param) -{ - NULL_LAN *n = (NULL_LAN *)param; - UINT64 end_tick = Tick64() + (UINT64)(60 * 1000); - UINT seq = 0; - // Validate arguments - if (t == NULL || param == NULL) - { - return; - } - - while (true) - { - /*if (Tick64() >= end_tick) - { - break; - }*/ - - Wait(n->Event, Rand32() % 1500); - if (n->Halt) - { - break; - } - - LockQueue(n->PacketQueue); - { - UCHAR *data; - BLOCK *b; - UINT size = Rand32() % 1500 + 14; - UCHAR dst_mac[6]; - - NullGenerateMacAddress(n->MacAddr, n->Id, seq); - - //NullGenerateMacAddress(dst_mac, n->Id + 1, 0); - //StrToMac(dst_mac, "00-1B-21-A9-47-E6"); - StrToMac(dst_mac, "00-AC-7A-EF-83-FD"); - - data = Malloc(size); - Copy(data, null_lan_broadcast_address, 6); - //Copy(data, dst_mac, 6); - Copy(data + 6, n->MacAddr, 6); - b = NewBlock(data, size, 0); - InsertQueue(n->PacketQueue, b); - } - UnlockQueue(n->PacketQueue); - Cancel(n->Cancel); - - //seq++; - } -} - -// Initialize the packet adapter -bool NullPaInit(SESSION *s) -{ - NULL_LAN *n; - static UINT id_seed = 0; - // Validate arguments - if (s == NULL) - { - return false; - } - - id_seed++; - - n = ZeroMalloc(sizeof(NULL_LAN)); - n->Id = id_seed; - s->PacketAdapter->Param = (void *)n; - - n->Cancel = NewCancel(); - n->PacketQueue = NewQueue(); - n->Event = NewEvent(); - - NullGenerateMacAddress(n->MacAddr, n->Id, 0); - - n->PacketGeneratorThread = NewThread(NullPacketGenerateThread, n); - - return true; -} - -// Get the cancel object -CANCEL *NullPaGetCancel(SESSION *s) -{ - // Validate arguments - NULL_LAN *n; - if (s == NULL || (n = s->PacketAdapter->Param) == NULL) - { - return NULL; - } - - AddRef(n->Cancel->ref); - - return n->Cancel; -} - -// Get the next packet -UINT NullPaGetNextPacket(SESSION *s, void **data) -{ - UINT size = 0; - // Validate arguments - NULL_LAN *n; - if (s == NULL || (n = s->PacketAdapter->Param) == NULL) - { - return INFINITE; - } - - LockQueue(n->PacketQueue); - { - BLOCK *b = GetNext(n->PacketQueue); - - if (b != NULL) - { - *data = b->Buf; - size = b->Size; - Free(b); - } - } - UnlockQueue(n->PacketQueue); - - return size; -} - -// Write the packet -bool NullPaPutPacket(SESSION *s, void *data, UINT size) -{ - // Validate arguments - if (s == NULL) - { - return false; - } - if (data == NULL) - { - return true; - } - - // Packet ignored - Free(data); - - return true; -} - -// Release -void NullPaFree(SESSION *s) -{ - // Validate arguments - NULL_LAN *n; - BLOCK *b; - if (s == NULL || (n = s->PacketAdapter->Param) == NULL) - { - return; - } - - n->Halt = true; - Set(n->Event); - - WaitThread(n->PacketGeneratorThread, INFINITE); - ReleaseThread(n->PacketGeneratorThread); - - LockQueue(n->PacketQueue); - { - while (b = GetNext(n->PacketQueue)) - { - FreeBlock(b); - } - } - UnlockQueue(n->PacketQueue); - - ReleaseQueue(n->PacketQueue); - - ReleaseCancel(n->Cancel); - - ReleaseEvent(n->Event); - - s->PacketAdapter->Param = NULL; - Free(n); -} - - +// SoftEther VPN Source Code - Developer Edition Master Branch +// Cedar Communication Module + + +// NullLan.c +// Virtual LAN card device driver for testing + +#include "CedarPch.h" + +static UCHAR null_lan_broadcast_address[] = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff}; + +// Get the packet adapter +PACKET_ADAPTER *NullGetPacketAdapter() +{ + PACKET_ADAPTER *pa = NewPacketAdapter(NullPaInit, NullPaGetCancel, NullPaGetNextPacket, + NullPaPutPacket, NullPaFree); + + return pa; +} + +// Generate MAC address +void NullGenerateMacAddress(UCHAR *mac, UINT id, UINT seq) +{ + UCHAR hash[SHA1_SIZE]; + char name[MAX_SIZE]; + BUF *b; + // Validate arguments + if (mac == NULL) + { + return; + } + + b = NewBuf(); + WriteBufInt(b, id); + WriteBufInt(b, seq); + GetMachineHostName(name, sizeof(name)); +#ifdef OS_WIN32 + WriteBufInt(b, MsGetCurrentProcessId()); +#endif // OS_WIN32 + WriteBufStr(b, name); + + Sha1(hash, b->Buf, b->Size); + + FreeBuf(b); + + Copy(mac, hash, 6); + mac[0] = 0x7E; +} + +// Packet generation thread +void NullPacketGenerateThread(THREAD *t, void *param) +{ + NULL_LAN *n = (NULL_LAN *)param; + UINT64 end_tick = Tick64() + (UINT64)(60 * 1000); + UINT seq = 0; + // Validate arguments + if (t == NULL || param == NULL) + { + return; + } + + while (true) + { + /*if (Tick64() >= end_tick) + { + break; + }*/ + + Wait(n->Event, Rand32() % 1500); + if (n->Halt) + { + break; + } + + LockQueue(n->PacketQueue); + { + UCHAR *data; + BLOCK *b; + UINT size = Rand32() % 1500 + 14; + UCHAR dst_mac[6]; + + NullGenerateMacAddress(n->MacAddr, n->Id, seq); + + //NullGenerateMacAddress(dst_mac, n->Id + 1, 0); + //StrToMac(dst_mac, "00-1B-21-A9-47-E6"); + StrToMac(dst_mac, "00-AC-7A-EF-83-FD"); + + data = Malloc(size); + Copy(data, null_lan_broadcast_address, 6); + //Copy(data, dst_mac, 6); + Copy(data + 6, n->MacAddr, 6); + b = NewBlock(data, size, 0); + InsertQueue(n->PacketQueue, b); + } + UnlockQueue(n->PacketQueue); + Cancel(n->Cancel); + + //seq++; + } +} + +// Initialize the packet adapter +bool NullPaInit(SESSION *s) +{ + NULL_LAN *n; + static UINT id_seed = 0; + // Validate arguments + if (s == NULL) + { + return false; + } + + id_seed++; + + n = ZeroMalloc(sizeof(NULL_LAN)); + n->Id = id_seed; + s->PacketAdapter->Param = (void *)n; + + n->Cancel = NewCancel(); + n->PacketQueue = NewQueue(); + n->Event = NewEvent(); + + NullGenerateMacAddress(n->MacAddr, n->Id, 0); + + n->PacketGeneratorThread = NewThread(NullPacketGenerateThread, n); + + return true; +} + +// Get the cancel object +CANCEL *NullPaGetCancel(SESSION *s) +{ + // Validate arguments + NULL_LAN *n; + if (s == NULL || (n = s->PacketAdapter->Param) == NULL) + { + return NULL; + } + + AddRef(n->Cancel->ref); + + return n->Cancel; +} + +// Get the next packet +UINT NullPaGetNextPacket(SESSION *s, void **data) +{ + UINT size = 0; + // Validate arguments + NULL_LAN *n; + if (s == NULL || (n = s->PacketAdapter->Param) == NULL) + { + return INFINITE; + } + + LockQueue(n->PacketQueue); + { + BLOCK *b = GetNext(n->PacketQueue); + + if (b != NULL) + { + *data = b->Buf; + size = b->Size; + Free(b); + } + } + UnlockQueue(n->PacketQueue); + + return size; +} + +// Write the packet +bool NullPaPutPacket(SESSION *s, void *data, UINT size) +{ + // Validate arguments + if (s == NULL) + { + return false; + } + if (data == NULL) + { + return true; + } + + // Packet ignored + Free(data); + + return true; +} + +// Release +void NullPaFree(SESSION *s) +{ + // Validate arguments + NULL_LAN *n; + BLOCK *b; + if (s == NULL || (n = s->PacketAdapter->Param) == NULL) + { + return; + } + + n->Halt = true; + Set(n->Event); + + WaitThread(n->PacketGeneratorThread, INFINITE); + ReleaseThread(n->PacketGeneratorThread); + + LockQueue(n->PacketQueue); + { + while (b = GetNext(n->PacketQueue)) + { + FreeBlock(b); + } + } + UnlockQueue(n->PacketQueue); + + ReleaseQueue(n->PacketQueue); + + ReleaseCancel(n->Cancel); + + ReleaseEvent(n->Event); + + s->PacketAdapter->Param = NULL; + Free(n); +} + + diff --git a/src/Cedar/NullLan.h b/src/Cedar/NullLan.h index 16267f55..9ac7a69d 100644 --- a/src/Cedar/NullLan.h +++ b/src/Cedar/NullLan.h @@ -1,39 +1,39 @@ -// SoftEther VPN Source Code - Developer Edition Master Branch -// Cedar Communication Module - - -// NullLan.h -// Header of NullLan.c - -#ifndef NULLLAN_H -#define NULLLAN_H - - -#define NULL_PACKET_GENERATE_INTERVAL 100000000 // Packet generation interval - -// NULL device structure -struct NULL_LAN -{ - THREAD *PacketGeneratorThread; - CANCEL *Cancel; - QUEUE *PacketQueue; - volatile bool Halt; - EVENT *Event; - UCHAR MacAddr[6]; - UCHAR Padding[2]; - UINT Id; -}; - -PACKET_ADAPTER *NullGetPacketAdapter(); -bool NullPaInit(SESSION *s); -CANCEL *NullPaGetCancel(SESSION *s); -UINT NullPaGetNextPacket(SESSION *s, void **data); -bool NullPaPutPacket(SESSION *s, void *data, UINT size); -void NullPaFree(SESSION *s); -void NullPacketGenerateThread(THREAD *t, void *param); -void NullGenerateMacAddress(UCHAR *mac, UINT id, UINT seq); - -#endif // NULLAN_H - - - +// SoftEther VPN Source Code - Developer Edition Master Branch +// Cedar Communication Module + + +// NullLan.h +// Header of NullLan.c + +#ifndef NULLLAN_H +#define NULLLAN_H + + +#define NULL_PACKET_GENERATE_INTERVAL 100000000 // Packet generation interval + +// NULL device structure +struct NULL_LAN +{ + THREAD *PacketGeneratorThread; + CANCEL *Cancel; + QUEUE *PacketQueue; + volatile bool Halt; + EVENT *Event; + UCHAR MacAddr[6]; + UCHAR Padding[2]; + UINT Id; +}; + +PACKET_ADAPTER *NullGetPacketAdapter(); +bool NullPaInit(SESSION *s); +CANCEL *NullPaGetCancel(SESSION *s); +UINT NullPaGetNextPacket(SESSION *s, void **data); +bool NullPaPutPacket(SESSION *s, void *data, UINT size); +void NullPaFree(SESSION *s); +void NullPacketGenerateThread(THREAD *t, void *param); +void NullGenerateMacAddress(UCHAR *mac, UINT id, UINT seq); + +#endif // NULLAN_H + + + diff --git a/src/Cedar/Proto_EtherIP.c b/src/Cedar/Proto_EtherIP.c index 60d4616e..775d7d87 100644 --- a/src/Cedar/Proto_EtherIP.c +++ b/src/Cedar/Proto_EtherIP.c @@ -1,451 +1,451 @@ -// SoftEther VPN Source Code - Developer Edition Master Branch -// Cedar Communication Module - - -// Proto_EtherIP.c -// EtherIP protocol stack - -#include "CedarPch.h" - -// IPC connection processing thread -void EtherIPIpcConnectThread(THREAD *t, void *p) -{ - ETHERIP_SERVER *s; - IPC *ipc = NULL; - UINT error_code = 0; - char tmp[MAX_SIZE]; - ETHERIP_ID id; - // Validate arguments - if (t == NULL || p == NULL) - { - return; - } - - s = (ETHERIP_SERVER *)p; - - GetHostName(tmp, sizeof(tmp), &s->ClientIP); - - // Get the setting of the virtual HUB to be connected based on the client ID presented - if (SearchEtherIPId(s->Ike->IPsec, &id, s->ClientId) == false && - SearchEtherIPId(s->Ike->IPsec, &id, "*") == false) - { - // Failed to get the settings for the virtual HUB - Debug("Not Found: EtherIP Settings for Client ID \"%s\".\n", s->ClientId); - - EtherIPLog(s, "LE_NO_SETTING", s->ClientId); - } - else - { - UINT mss = CalcEtherIPTcpMss(s); - char client_name[MAX_SIZE]; - - if (s->L2TPv3 == false) - { - StrCpy(client_name, sizeof(client_name), ETHERIP_CLIENT_NAME); - } - else - { - if (IsEmptyStr(s->VendorName)) - { - StrCpy(client_name, sizeof(client_name), ETHERIP_L2TPV3_CLIENT_NAME); - } - else - { - Format(client_name, sizeof(client_name), ETHERIP_L2TPV3_CLIENT_NAME_EX, s->VendorName); - } - } - - // Execution of IPC connection process - EtherIPLog(s, "LE_START_IPC", id.HubName, id.UserName, mss); - ipc = NewIPC(s->Cedar, client_name, - (s->L2TPv3 ? ETHERIP_L2TPV3_POSTFIX : ETHERIP_POSTFIX), - id.HubName, id.UserName, id.Password, - &error_code, - &s->ClientIP, s->ClientPort, - &s->ServerIP, s->ServerPort, - tmp, - s->CryptName, true, mss, NULL, NULL, IPC_LAYER_2); - - if (ipc != NULL) - { - Copy(&s->CurrentEtherIPIdSetting, &id, sizeof(ETHERIP_ID)); - EtherIPLog(s, "LE_IPC_CONNECT_OK", id.HubName); - } - else - { - EtherIPLog(s, "LE_IPC_CONNECT_ERROR", id.HubName, error_code, _E(error_code)); - } - } - - Lock(s->Lock); - { - // Set the results - ReleaseThread(s->IpcConnectThread); - s->IpcConnectThread = NULL; - - s->Ipc = ipc; - - s->LastConnectFailedTick = Tick64(); - } - Unlock(s->Lock); - - // Hit the event to cause interrupt - SetSockEvent(s->SockEvent); - - // Release the EtherIP object that is hold by this thread - ReleaseEtherIPServer(s); -} - -// Processing of the interrupt -void EtherIPProcInterrupts(ETHERIP_SERVER *s) -{ - // Validate arguments - if (s == NULL) - { - return; - } - - // If EtherIP settings have been changed, and the change may effect to this connection, disconnect - if (s->Ipc != NULL) - { - if (s->Ike->IPsec->EtherIPIdListSettingVerNo != s->LastEtherIPSettingVerNo) - { - ETHERIP_ID id; - bool ok = true; - - s->LastEtherIPSettingVerNo = s->Ike->IPsec->EtherIPIdListSettingVerNo; - - if (SearchEtherIPId(s->IPsec, &id, s->ClientId) == false && - SearchEtherIPId(s->IPsec, &id, "*") == false) - { - ok = false; - } - else - { - if (StrCmpi(s->CurrentEtherIPIdSetting.HubName, id.HubName) != 0 || - StrCmpi(s->CurrentEtherIPIdSetting.UserName, id.UserName) != 0 || - StrCmp(s->CurrentEtherIPIdSetting.Password, id.Password) != 0) - { - ok = false; - } - } - - if (ok == false) - { - // Disconnect immediately since setting of EtherIP seems to have been changed - FreeIPC(s->Ipc); - s->Ipc = NULL; - - EtherIPLog(s, "LE_RECONNECT"); - } - } - } - - // Connect if IPC connection is not completed - Lock(s->Lock); - { - if (s->Ipc == NULL) - { - if (s->IpcConnectThread == NULL) - { - if ((s->LastConnectFailedTick == 0) || ((s->LastConnectFailedTick + (UINT64)ETHERIP_VPN_CONNECT_RETRY_INTERVAL) <= s->Now)) - { - Lock(s->IPsec->LockSettings); - { - Copy(&s->CurrentIPSecServiceSetting, &s->IPsec->Services, sizeof(IPSEC_SERVICES)); - } - Unlock(s->IPsec->LockSettings); - - s->IpcConnectThread = NewThread(EtherIPIpcConnectThread, s); - AddThreadToThreadList(s->Ike->ThreadList, s->IpcConnectThread); - AddRef(s->Ref); - } - } - } - } - Unlock(s->Lock); - - if (s->Ipc != NULL) - { - // Set to get hit the SockEvent when a packet arrives via the IPC - IPCSetSockEventWhenRecvL2Packet(s->Ipc, s->SockEvent); - - // IPC interrupt processing - IPCProcessInterrupts(s->Ipc); - - // Receive the MAC frame which arrived via the IPC - while (true) - { - BLOCK *b = IPCRecvL2(s->Ipc); - UCHAR *dst; - UINT dst_size; - - if (b == NULL) - { - break; - } - - if (b->Size >= 14) - { - BLOCK *block; - - // Store the arrived MAC frame by adding an EtherIP header to the reception packet queue - - if (s->L2TPv3 == false) - { - dst_size = b->Size + 2; - dst = Malloc(dst_size); - - dst[0] = 0x30; - dst[1] = 0x00; - - Copy(dst + 2, b->Buf, b->Size); - } - else - { - dst = Clone(b->Buf, b->Size); - dst_size = b->Size; - } - - block = NewBlock(dst, dst_size, 0); - - Add(s->SendPacketList, block); - } - - FreeBlock(b); - } - - if (IsIPCConnected(s->Ipc) == false) - { - // IPC connection is disconnected - FreeIPC(s->Ipc); - s->Ipc = NULL; - } - } -} - -// Process the received packet -void EtherIPProcRecvPackets(ETHERIP_SERVER *s, BLOCK *b) -{ - UCHAR *src; - UINT src_size; - // Validate arguments - if (s == NULL || b == NULL) - { - return; - } - - if (s->Ipc == NULL) - { - // Not connected to the Virtual HUB - return; - } - - src = b->Buf; - src_size = b->Size; - - if (s->L2TPv3 == false) - { - // EtherIP header confirmation - if (src_size < 2) - { - return; - } - - if ((src[0] & 0xf0) != 0x30) - { - return; - } - - src += 2; - src_size -= 2; - } - - if (src_size < 14) - { - // The size of the MAC frame is less than 14 bytes - return; - } - - // Send by IPC since a MAC frame has been received - IPCSendL2(s->Ipc, src, src_size); -} - -// Create a new EtherIP server -ETHERIP_SERVER *NewEtherIPServer(CEDAR *cedar, IPSEC_SERVER *ipsec, IKE_SERVER *ike, - IP *client_ip, UINT client_port, IP *server_ip, UINT server_port, char *crypt_name, - bool is_tunnel_mode, UINT crypt_block_size, - char *client_id, UINT id) -{ - ETHERIP_SERVER *s; - // Validate arguments - if (cedar == NULL || ipsec == NULL || ike == NULL || client_ip == NULL || server_ip == NULL || client_id == NULL) - { - return NULL; - } - - s = ZeroMalloc(sizeof(ETHERIP_SERVER)); - - s->Ref = NewRef(); - - s->Id = id; - - s->Cedar = cedar; - AddRef(s->Cedar->ref); - s->IPsec = ipsec; - s->Ike = ike; - s->IsTunnelMode = is_tunnel_mode; - - StrCpy(s->ClientId, sizeof(s->ClientId), client_id); - - s->SendPacketList = NewList(NULL); - - s->Now = Tick64(); - - s->Lock = NewLock(); - - Copy(&s->ClientIP, client_ip, sizeof(IP)); - s->ClientPort = client_port; - - Copy(&s->ServerIP, server_ip, sizeof(IP)); - s->ServerPort = server_port; - - StrCpy(s->CryptName, sizeof(s->CryptName), crypt_name); - s->CryptBlockSize = crypt_block_size; - - EtherIPLog(s, "LE_START_MODULE"); - - return s; -} - -// Release the EtherIP server -void ReleaseEtherIPServer(ETHERIP_SERVER *s) -{ - // Validate arguments - if (s == NULL) - { - return; - } - - if (Release(s->Ref) == 0) - { - CleanupEtherIPServer(s); - } -} -void CleanupEtherIPServer(ETHERIP_SERVER *s) -{ - UINT i; - // Validate arguments - if (s == NULL) - { - return; - } - - EtherIPLog(s, "LE_STOP"); - - if (s->IpcConnectThread != NULL) - { - ReleaseThread(s->IpcConnectThread); - } - - if (s->Ipc != NULL) - { - FreeIPC(s->Ipc); - } - - for (i = 0;i < LIST_NUM(s->SendPacketList);i++) - { - BLOCK *b = LIST_DATA(s->SendPacketList, i); - - FreeBlock(b); - } - - ReleaseList(s->SendPacketList); - - ReleaseSockEvent(s->SockEvent); - - ReleaseCedar(s->Cedar); - - DeleteLock(s->Lock); - - Free(s); -} - - -// Set SockEvent to EtherIP server -void SetEtherIPServerSockEvent(ETHERIP_SERVER *s, SOCK_EVENT *e) -{ - // Validate arguments - if (s == NULL) - { - return; - } - - if (e != NULL) - { - AddRef(e->ref); - } - - if (s->SockEvent != NULL) - { - ReleaseSockEvent(s->SockEvent); - s->SockEvent = NULL; - } - - s->SockEvent = e; -} - -// Calculate the proper TCP MSS in EtherIP communication -UINT CalcEtherIPTcpMss(ETHERIP_SERVER *s) -{ - UINT ret = MTU_FOR_PPPOE; - // Validate arguments - if (s == NULL) - { - return 0; - } - - // IPv4 / IPv6 - if (IsIP4(&s->ClientIP)) - { - ret -= 20; - } - else - { - ret -= 40; - } - - // IPsec UDP - ret -= 8; - - // IPsec ESP - ret -= 20; - ret -= s->CryptBlockSize * 2; - - // IPsec Tunnel Mode IPv4 / IPv6 Header - if (s->IsTunnelMode) - { - if (IsIP4(&s->ClientIP)) - { - ret -= 20; - } - else - { - ret -= 40; - } - } - - // EtherIP, L2TPv3 - ret -= 2; - - // Ethernet - ret -= 14; - - // IPv4 - ret -= 20; - - // TCP - ret -= 20; - - return ret; -} +// SoftEther VPN Source Code - Developer Edition Master Branch +// Cedar Communication Module + + +// Proto_EtherIP.c +// EtherIP protocol stack + +#include "CedarPch.h" + +// IPC connection processing thread +void EtherIPIpcConnectThread(THREAD *t, void *p) +{ + ETHERIP_SERVER *s; + IPC *ipc = NULL; + UINT error_code = 0; + char tmp[MAX_SIZE]; + ETHERIP_ID id; + // Validate arguments + if (t == NULL || p == NULL) + { + return; + } + + s = (ETHERIP_SERVER *)p; + + GetHostName(tmp, sizeof(tmp), &s->ClientIP); + + // Get the setting of the virtual HUB to be connected based on the client ID presented + if (SearchEtherIPId(s->Ike->IPsec, &id, s->ClientId) == false && + SearchEtherIPId(s->Ike->IPsec, &id, "*") == false) + { + // Failed to get the settings for the virtual HUB + Debug("Not Found: EtherIP Settings for Client ID \"%s\".\n", s->ClientId); + + EtherIPLog(s, "LE_NO_SETTING", s->ClientId); + } + else + { + UINT mss = CalcEtherIPTcpMss(s); + char client_name[MAX_SIZE]; + + if (s->L2TPv3 == false) + { + StrCpy(client_name, sizeof(client_name), ETHERIP_CLIENT_NAME); + } + else + { + if (IsEmptyStr(s->VendorName)) + { + StrCpy(client_name, sizeof(client_name), ETHERIP_L2TPV3_CLIENT_NAME); + } + else + { + Format(client_name, sizeof(client_name), ETHERIP_L2TPV3_CLIENT_NAME_EX, s->VendorName); + } + } + + // Execution of IPC connection process + EtherIPLog(s, "LE_START_IPC", id.HubName, id.UserName, mss); + ipc = NewIPC(s->Cedar, client_name, + (s->L2TPv3 ? ETHERIP_L2TPV3_POSTFIX : ETHERIP_POSTFIX), + id.HubName, id.UserName, id.Password, + &error_code, + &s->ClientIP, s->ClientPort, + &s->ServerIP, s->ServerPort, + tmp, + s->CryptName, true, mss, NULL, NULL, IPC_LAYER_2); + + if (ipc != NULL) + { + Copy(&s->CurrentEtherIPIdSetting, &id, sizeof(ETHERIP_ID)); + EtherIPLog(s, "LE_IPC_CONNECT_OK", id.HubName); + } + else + { + EtherIPLog(s, "LE_IPC_CONNECT_ERROR", id.HubName, error_code, _E(error_code)); + } + } + + Lock(s->Lock); + { + // Set the results + ReleaseThread(s->IpcConnectThread); + s->IpcConnectThread = NULL; + + s->Ipc = ipc; + + s->LastConnectFailedTick = Tick64(); + } + Unlock(s->Lock); + + // Hit the event to cause interrupt + SetSockEvent(s->SockEvent); + + // Release the EtherIP object that is hold by this thread + ReleaseEtherIPServer(s); +} + +// Processing of the interrupt +void EtherIPProcInterrupts(ETHERIP_SERVER *s) +{ + // Validate arguments + if (s == NULL) + { + return; + } + + // If EtherIP settings have been changed, and the change may effect to this connection, disconnect + if (s->Ipc != NULL) + { + if (s->Ike->IPsec->EtherIPIdListSettingVerNo != s->LastEtherIPSettingVerNo) + { + ETHERIP_ID id; + bool ok = true; + + s->LastEtherIPSettingVerNo = s->Ike->IPsec->EtherIPIdListSettingVerNo; + + if (SearchEtherIPId(s->IPsec, &id, s->ClientId) == false && + SearchEtherIPId(s->IPsec, &id, "*") == false) + { + ok = false; + } + else + { + if (StrCmpi(s->CurrentEtherIPIdSetting.HubName, id.HubName) != 0 || + StrCmpi(s->CurrentEtherIPIdSetting.UserName, id.UserName) != 0 || + StrCmp(s->CurrentEtherIPIdSetting.Password, id.Password) != 0) + { + ok = false; + } + } + + if (ok == false) + { + // Disconnect immediately since setting of EtherIP seems to have been changed + FreeIPC(s->Ipc); + s->Ipc = NULL; + + EtherIPLog(s, "LE_RECONNECT"); + } + } + } + + // Connect if IPC connection is not completed + Lock(s->Lock); + { + if (s->Ipc == NULL) + { + if (s->IpcConnectThread == NULL) + { + if ((s->LastConnectFailedTick == 0) || ((s->LastConnectFailedTick + (UINT64)ETHERIP_VPN_CONNECT_RETRY_INTERVAL) <= s->Now)) + { + Lock(s->IPsec->LockSettings); + { + Copy(&s->CurrentIPSecServiceSetting, &s->IPsec->Services, sizeof(IPSEC_SERVICES)); + } + Unlock(s->IPsec->LockSettings); + + s->IpcConnectThread = NewThread(EtherIPIpcConnectThread, s); + AddThreadToThreadList(s->Ike->ThreadList, s->IpcConnectThread); + AddRef(s->Ref); + } + } + } + } + Unlock(s->Lock); + + if (s->Ipc != NULL) + { + // Set to get hit the SockEvent when a packet arrives via the IPC + IPCSetSockEventWhenRecvL2Packet(s->Ipc, s->SockEvent); + + // IPC interrupt processing + IPCProcessInterrupts(s->Ipc); + + // Receive the MAC frame which arrived via the IPC + while (true) + { + BLOCK *b = IPCRecvL2(s->Ipc); + UCHAR *dst; + UINT dst_size; + + if (b == NULL) + { + break; + } + + if (b->Size >= 14) + { + BLOCK *block; + + // Store the arrived MAC frame by adding an EtherIP header to the reception packet queue + + if (s->L2TPv3 == false) + { + dst_size = b->Size + 2; + dst = Malloc(dst_size); + + dst[0] = 0x30; + dst[1] = 0x00; + + Copy(dst + 2, b->Buf, b->Size); + } + else + { + dst = Clone(b->Buf, b->Size); + dst_size = b->Size; + } + + block = NewBlock(dst, dst_size, 0); + + Add(s->SendPacketList, block); + } + + FreeBlock(b); + } + + if (IsIPCConnected(s->Ipc) == false) + { + // IPC connection is disconnected + FreeIPC(s->Ipc); + s->Ipc = NULL; + } + } +} + +// Process the received packet +void EtherIPProcRecvPackets(ETHERIP_SERVER *s, BLOCK *b) +{ + UCHAR *src; + UINT src_size; + // Validate arguments + if (s == NULL || b == NULL) + { + return; + } + + if (s->Ipc == NULL) + { + // Not connected to the Virtual HUB + return; + } + + src = b->Buf; + src_size = b->Size; + + if (s->L2TPv3 == false) + { + // EtherIP header confirmation + if (src_size < 2) + { + return; + } + + if ((src[0] & 0xf0) != 0x30) + { + return; + } + + src += 2; + src_size -= 2; + } + + if (src_size < 14) + { + // The size of the MAC frame is less than 14 bytes + return; + } + + // Send by IPC since a MAC frame has been received + IPCSendL2(s->Ipc, src, src_size); +} + +// Create a new EtherIP server +ETHERIP_SERVER *NewEtherIPServer(CEDAR *cedar, IPSEC_SERVER *ipsec, IKE_SERVER *ike, + IP *client_ip, UINT client_port, IP *server_ip, UINT server_port, char *crypt_name, + bool is_tunnel_mode, UINT crypt_block_size, + char *client_id, UINT id) +{ + ETHERIP_SERVER *s; + // Validate arguments + if (cedar == NULL || ipsec == NULL || ike == NULL || client_ip == NULL || server_ip == NULL || client_id == NULL) + { + return NULL; + } + + s = ZeroMalloc(sizeof(ETHERIP_SERVER)); + + s->Ref = NewRef(); + + s->Id = id; + + s->Cedar = cedar; + AddRef(s->Cedar->ref); + s->IPsec = ipsec; + s->Ike = ike; + s->IsTunnelMode = is_tunnel_mode; + + StrCpy(s->ClientId, sizeof(s->ClientId), client_id); + + s->SendPacketList = NewList(NULL); + + s->Now = Tick64(); + + s->Lock = NewLock(); + + Copy(&s->ClientIP, client_ip, sizeof(IP)); + s->ClientPort = client_port; + + Copy(&s->ServerIP, server_ip, sizeof(IP)); + s->ServerPort = server_port; + + StrCpy(s->CryptName, sizeof(s->CryptName), crypt_name); + s->CryptBlockSize = crypt_block_size; + + EtherIPLog(s, "LE_START_MODULE"); + + return s; +} + +// Release the EtherIP server +void ReleaseEtherIPServer(ETHERIP_SERVER *s) +{ + // Validate arguments + if (s == NULL) + { + return; + } + + if (Release(s->Ref) == 0) + { + CleanupEtherIPServer(s); + } +} +void CleanupEtherIPServer(ETHERIP_SERVER *s) +{ + UINT i; + // Validate arguments + if (s == NULL) + { + return; + } + + EtherIPLog(s, "LE_STOP"); + + if (s->IpcConnectThread != NULL) + { + ReleaseThread(s->IpcConnectThread); + } + + if (s->Ipc != NULL) + { + FreeIPC(s->Ipc); + } + + for (i = 0;i < LIST_NUM(s->SendPacketList);i++) + { + BLOCK *b = LIST_DATA(s->SendPacketList, i); + + FreeBlock(b); + } + + ReleaseList(s->SendPacketList); + + ReleaseSockEvent(s->SockEvent); + + ReleaseCedar(s->Cedar); + + DeleteLock(s->Lock); + + Free(s); +} + + +// Set SockEvent to EtherIP server +void SetEtherIPServerSockEvent(ETHERIP_SERVER *s, SOCK_EVENT *e) +{ + // Validate arguments + if (s == NULL) + { + return; + } + + if (e != NULL) + { + AddRef(e->ref); + } + + if (s->SockEvent != NULL) + { + ReleaseSockEvent(s->SockEvent); + s->SockEvent = NULL; + } + + s->SockEvent = e; +} + +// Calculate the proper TCP MSS in EtherIP communication +UINT CalcEtherIPTcpMss(ETHERIP_SERVER *s) +{ + UINT ret = MTU_FOR_PPPOE; + // Validate arguments + if (s == NULL) + { + return 0; + } + + // IPv4 / IPv6 + if (IsIP4(&s->ClientIP)) + { + ret -= 20; + } + else + { + ret -= 40; + } + + // IPsec UDP + ret -= 8; + + // IPsec ESP + ret -= 20; + ret -= s->CryptBlockSize * 2; + + // IPsec Tunnel Mode IPv4 / IPv6 Header + if (s->IsTunnelMode) + { + if (IsIP4(&s->ClientIP)) + { + ret -= 20; + } + else + { + ret -= 40; + } + } + + // EtherIP, L2TPv3 + ret -= 2; + + // Ethernet + ret -= 14; + + // IPv4 + ret -= 20; + + // TCP + ret -= 20; + + return ret; +} diff --git a/src/Cedar/Proto_EtherIP.h b/src/Cedar/Proto_EtherIP.h index c540bc68..f42cf50b 100644 --- a/src/Cedar/Proto_EtherIP.h +++ b/src/Cedar/Proto_EtherIP.h @@ -1,68 +1,68 @@ -// SoftEther VPN Source Code - Developer Edition Master Branch -// Cedar Communication Module - - -// Proto_EtherIP.h -// Header of Proto_EtherIP.c - -#ifndef PROTO_ETHERIP_H -#define PROTO_ETHERIP_H - -//// Macro - - -//// Constants -#define ETHERIP_VPN_CONNECT_RETRY_INTERVAL (15 * 1000) // VPN connection retry interval -#define ETHERIP_CLIENT_NAME "EtherIP Client" -#define ETHERIP_POSTFIX "ETHERIP" -#define ETHERIP_L2TPV3_CLIENT_NAME "L2TPv3 Client" -#define ETHERIP_L2TPV3_CLIENT_NAME_EX "L2TPv3 Client - %s" -#define ETHERIP_L2TPV3_POSTFIX "L2TPV3" - -//// Type - -// EtherIP server -struct ETHERIP_SERVER -{ - REF *Ref; - CEDAR *Cedar; - IPSEC_SERVER *IPsec; - LOCK *Lock; - UINT Id; - IKE_SERVER *Ike; - UINT64 Now; // Current time - INTERRUPT_MANAGER *Interrupts; // Interrupt manager - SOCK_EVENT *SockEvent; // SockEvent - char CryptName[MAX_SIZE]; // Cipher algorithm name - LIST *SendPacketList; // Transmission packet list - UINT64 LastConnectFailedTick; // Time that it fails to connect at the last - IPC *Ipc; // IPC - THREAD *IpcConnectThread; // IPC connection thread - IPSEC_SERVICES CurrentIPSecServiceSetting; // Copy of the current IPsec service settings - IP ClientIP, ServerIP; - UINT ClientPort, ServerPort; - bool IsTunnelMode; // Whether the IPsec is in the tunnel mode - UINT CryptBlockSize; // Encryption block size of IPsec - char ClientId[MAX_SIZE]; // Client ID has been presented by the IPsec connection - UINT LastEtherIPSettingVerNo; // Version number of EtherIP settings last checked - ETHERIP_ID CurrentEtherIPIdSetting; // Current EtherIP ID settings - bool L2TPv3; // L2TPv3 mode - char VendorName[MAX_SIZE]; // Vendor name -}; - - -//// Function prototype -ETHERIP_SERVER *NewEtherIPServer(CEDAR *cedar, IPSEC_SERVER *ipsec, IKE_SERVER *ike, - IP *client_ip, UINT client_port, IP *server_ip, UINT server_port, char *crypt_name, - bool is_tunnel_mode, UINT crypt_block_size, - char *client_id, UINT id); -void ReleaseEtherIPServer(ETHERIP_SERVER *s); -void CleanupEtherIPServer(ETHERIP_SERVER *s); -void SetEtherIPServerSockEvent(ETHERIP_SERVER *s, SOCK_EVENT *e); -void EtherIPProcInterrupts(ETHERIP_SERVER *s); -void EtherIPProcRecvPackets(ETHERIP_SERVER *s, BLOCK *b); -void EtherIPIpcConnectThread(THREAD *t, void *p); -UINT CalcEtherIPTcpMss(ETHERIP_SERVER *s); - - -#endif // PROTO_ETHERIP_H +// SoftEther VPN Source Code - Developer Edition Master Branch +// Cedar Communication Module + + +// Proto_EtherIP.h +// Header of Proto_EtherIP.c + +#ifndef PROTO_ETHERIP_H +#define PROTO_ETHERIP_H + +//// Macro + + +//// Constants +#define ETHERIP_VPN_CONNECT_RETRY_INTERVAL (15 * 1000) // VPN connection retry interval +#define ETHERIP_CLIENT_NAME "EtherIP Client" +#define ETHERIP_POSTFIX "ETHERIP" +#define ETHERIP_L2TPV3_CLIENT_NAME "L2TPv3 Client" +#define ETHERIP_L2TPV3_CLIENT_NAME_EX "L2TPv3 Client - %s" +#define ETHERIP_L2TPV3_POSTFIX "L2TPV3" + +//// Type + +// EtherIP server +struct ETHERIP_SERVER +{ + REF *Ref; + CEDAR *Cedar; + IPSEC_SERVER *IPsec; + LOCK *Lock; + UINT Id; + IKE_SERVER *Ike; + UINT64 Now; // Current time + INTERRUPT_MANAGER *Interrupts; // Interrupt manager + SOCK_EVENT *SockEvent; // SockEvent + char CryptName[MAX_SIZE]; // Cipher algorithm name + LIST *SendPacketList; // Transmission packet list + UINT64 LastConnectFailedTick; // Time that it fails to connect at the last + IPC *Ipc; // IPC + THREAD *IpcConnectThread; // IPC connection thread + IPSEC_SERVICES CurrentIPSecServiceSetting; // Copy of the current IPsec service settings + IP ClientIP, ServerIP; + UINT ClientPort, ServerPort; + bool IsTunnelMode; // Whether the IPsec is in the tunnel mode + UINT CryptBlockSize; // Encryption block size of IPsec + char ClientId[MAX_SIZE]; // Client ID has been presented by the IPsec connection + UINT LastEtherIPSettingVerNo; // Version number of EtherIP settings last checked + ETHERIP_ID CurrentEtherIPIdSetting; // Current EtherIP ID settings + bool L2TPv3; // L2TPv3 mode + char VendorName[MAX_SIZE]; // Vendor name +}; + + +//// Function prototype +ETHERIP_SERVER *NewEtherIPServer(CEDAR *cedar, IPSEC_SERVER *ipsec, IKE_SERVER *ike, + IP *client_ip, UINT client_port, IP *server_ip, UINT server_port, char *crypt_name, + bool is_tunnel_mode, UINT crypt_block_size, + char *client_id, UINT id); +void ReleaseEtherIPServer(ETHERIP_SERVER *s); +void CleanupEtherIPServer(ETHERIP_SERVER *s); +void SetEtherIPServerSockEvent(ETHERIP_SERVER *s, SOCK_EVENT *e); +void EtherIPProcInterrupts(ETHERIP_SERVER *s); +void EtherIPProcRecvPackets(ETHERIP_SERVER *s, BLOCK *b); +void EtherIPIpcConnectThread(THREAD *t, void *p); +UINT CalcEtherIPTcpMss(ETHERIP_SERVER *s); + + +#endif // PROTO_ETHERIP_H diff --git a/src/Cedar/Proto_IKE.c b/src/Cedar/Proto_IKE.c index c35468c2..30047618 100644 --- a/src/Cedar/Proto_IKE.c +++ b/src/Cedar/Proto_IKE.c @@ -1,5889 +1,5889 @@ -// SoftEther VPN Source Code - Developer Edition Master Branch -// Cedar Communication Module - - -// Proto_IKE.c -// IKE (ISAKMP) and ESP protocol stack - -#include "CedarPch.h" - -//#define RAW_DEBUG - -// Processing of IKE received packet -void ProcIKEPacketRecv(IKE_SERVER *ike, UDPPACKET *p) -{ - // Validate arguments - if (ike == NULL || p == NULL) - { - return; - } - - if (p->Type == IKE_UDP_TYPE_ISAKMP) - { - // ISAKMP (IKE) packet - IKE_PACKET *header; - - header = ParseIKEPacketHeader(p); - if (header == NULL) - { - return; - } - - //Debug("InitiatorCookie: %I64u, ResponderCookie: %I64u\n", header->InitiatorCookie, header->ResponderCookie); - - switch (header->ExchangeType) - { - case IKE_EXCHANGE_TYPE_MAIN: // Main mode - ProcIkeMainModePacketRecv(ike, p, header); - break; - - case IKE_EXCHANGE_TYPE_AGGRESSIVE: // Aggressive mode - if (ike->Cedar->Server->DisableIPsecAggressiveMode == false) - { - ProcIkeAggressiveModePacketRecv(ike, p, header); - } - break; - - case IKE_EXCHANGE_TYPE_QUICK: // Quick mode - ProcIkeQuickModePacketRecv(ike, p, header); - break; - - case IKE_EXCHANGE_TYPE_INFORMATION: // Information exchange - ProcIkeInformationalExchangePacketRecv(ike, p, header); - break; - } - - IkeFree(header); - } - else if (p->Type == IKE_UDP_TYPE_ESP) - { - // ESP packet - ProcIPsecEspPacketRecv(ike, p); - } -} - -// Send a packet via IPsec -void IPsecSendPacketByIPsecSa(IKE_SERVER *ike, IPSECSA *sa, UCHAR *data, UINT data_size, UCHAR protocol_id) -{ - bool is_tunnel_mode; - IKE_CLIENT *c; - // Validate arguments - if (ike == NULL || sa == NULL || data == NULL || data_size == 0) - { - return; - } - - is_tunnel_mode = IsIPsecSaTunnelMode(sa); - - c = sa->IkeClient; - - if (c == NULL) - { - return; - } - - if (is_tunnel_mode) - { - // Add an IPv4 / IPv6 header in the case of tunnel mode - if (IsZeroIP(&c->TunnelModeClientIP) == false || IsZeroIP(&c->TunnelModeServerIP) == false) - { - BUF *b; - UCHAR esp_proto_id; - - b = NewBuf(); - - if (IsIP4(&c->TunnelModeClientIP)) - { - // IPv4 header - IPV4_HEADER h; - - h.VersionAndHeaderLength = 0; - h.TypeOfService = 0; - IPV4_SET_VERSION(&h, 4); - IPV4_SET_HEADER_LEN(&h, sizeof(IPV4_HEADER) / 4); - h.TotalLength = Endian16((USHORT)(data_size + sizeof(IPV4_HEADER))); - h.Identification = Endian16(c->TunnelSendIpId++); - h.FlagsAndFragmentOffset[0] = h.FlagsAndFragmentOffset[1] = 0; - h.TimeToLive = DEFAULT_IP_TTL; - h.Protocol = protocol_id; - h.SrcIP = IPToUINT(&c->TunnelModeServerIP); - h.DstIP = IPToUINT(&c->TunnelModeClientIP); - h.Checksum = 0; - h.Checksum = IpChecksum(&h, sizeof(IPV4_HEADER)); - - WriteBuf(b, &h, sizeof(IPV4_HEADER)); - - esp_proto_id = IKE_PROTOCOL_ID_IPV4; - } - else - { - // IPv6 header - IPV6_HEADER h; - - Zero(&h, sizeof(h)); - h.VersionAndTrafficClass1 = 0; - IPV6_SET_VERSION(&h, 6); - h.TrafficClass2AndFlowLabel1 = 0; - h.FlowLabel2 = h.FlowLabel3 = 0; - h.PayloadLength = Endian16(data_size); - h.NextHeader = protocol_id; - h.HopLimit = 64; - Copy(h.SrcAddress.Value, c->TunnelModeServerIP.ipv6_addr, 16); - Copy(h.DestAddress.Value, c->TunnelModeClientIP.ipv6_addr, 16); - - WriteBuf(b, &h, sizeof(IPV6_HEADER)); - - esp_proto_id = IKE_PROTOCOL_ID_IPV6; - } - - WriteBuf(b, data, data_size); - - IPsecSendPacketByIPsecSaInner(ike, sa, b->Buf, b->Size, esp_proto_id); - - FreeBuf(b); - } - } - else - { - // Send as it is in the case of transport mode - IPsecSendPacketByIPsecSaInner(ike, sa, data, data_size, protocol_id); - } -} -void IPsecSendPacketByIPsecSaInner(IKE_SERVER *ike, IPSECSA *sa, UCHAR *data, UINT data_size, UCHAR protocol_id) -{ - UINT esp_size; - UINT encrypted_payload_size; - UCHAR *esp; - UINT i; - UINT size_of_padding; - IKE_CRYPTO_PARAM cp; - BUF *enc; - IKE_CLIENT *c; - // Validate arguments - if (ike == NULL || sa == NULL || data == NULL || data_size == 0) - { - return; - } - - c = sa->IkeClient; - if (c == NULL) - { - return; - } - - // Calculate the payload size after encryption - encrypted_payload_size = data_size + 2; - if ((encrypted_payload_size % sa->TransformSetting.Crypto->BlockSize) != 0) - { - encrypted_payload_size = ((encrypted_payload_size / sa->TransformSetting.Crypto->BlockSize) + 1) * sa->TransformSetting.Crypto->BlockSize; - } - size_of_padding = encrypted_payload_size - data_size - 2; - - // Calculate the size of the ESP packet - esp_size = sizeof(UINT) * 2 + sa->TransformSetting.Crypto->BlockSize + encrypted_payload_size + IKE_ESP_HASH_SIZE; - - // Build the ESP packet - esp = Malloc(esp_size + IKE_MAX_HASH_SIZE); - - // SPI - WRITE_UINT(esp, sa->Spi); - - // Sequence number - sa->CurrentSeqNo++; - WRITE_UINT(esp + sizeof(UINT), sa->CurrentSeqNo); - - // IV - Copy(esp + sizeof(UINT) * 2, sa->EspIv, sa->TransformSetting.Crypto->BlockSize); - - // Payload data - Copy(esp + sizeof(UINT) * 2 + sa->TransformSetting.Crypto->BlockSize, data, data_size); - - // Padding - for (i = 0;i < size_of_padding;i++) - { - esp[sizeof(UINT) * 2 + sa->TransformSetting.Crypto->BlockSize + data_size + i] = (UCHAR)(i + 1); - } - - // Padding length - esp[sizeof(UINT) * 2 + sa->TransformSetting.Crypto->BlockSize + data_size + size_of_padding] = (UCHAR)size_of_padding; - - // Next header number - esp[sizeof(UINT) * 2 + sa->TransformSetting.Crypto->BlockSize + data_size + size_of_padding + 1] = protocol_id; - - // Encryption - Copy(cp.Iv, sa->EspIv, sa->TransformSetting.Crypto->BlockSize); - cp.Key = sa->CryptoKey; - - enc = IkeEncrypt(esp + sizeof(UINT) * 2 + sa->TransformSetting.Crypto->BlockSize, encrypted_payload_size, &cp); - if (enc != NULL) - { - bool start_qm = false; - UINT server_port = c->ServerPort; - UINT client_port = c->ClientPort; - - // Overwrite the encrypted result - Copy(esp + sizeof(UINT) * 2 + sa->TransformSetting.Crypto->BlockSize, enc->Buf, encrypted_payload_size); - - FreeBuf(enc); - - // Calculate the HMAC - IkeHMac(sa->TransformSetting.Hash, - esp + sizeof(UINT) * 2 + sa->TransformSetting.Crypto->BlockSize + encrypted_payload_size, - sa->HashKey, - sa->TransformSetting.Hash->HashSize, - esp, - sizeof(UINT) * 2 + sa->TransformSetting.Crypto->BlockSize + encrypted_payload_size); - - //*(UCHAR *)(esp + sizeof(UINT) * 2 + sa->TransformSetting.Crypto->BlockSize + encrypted_payload_size) = 0xff; - - if (sa->TransformSetting.CapsuleMode == IKE_P2_CAPSULE_TRANSPORT || - sa->TransformSetting.CapsuleMode == IKE_P2_CAPSULE_TUNNEL) - { - server_port = client_port = IPSEC_PORT_IPSEC_ESP_RAW; - } - - // Add the completed packet to the transmission list - IkeSendUdpPacket(ike, IKE_UDP_TYPE_ESP, &c->ServerIP, server_port, &c->ClientIP, client_port, - esp, esp_size); - - // Feedback the IV - Copy(sa->EspIv, cp.NextIv, sa->TransformSetting.Crypto->BlockSize); - - sa->TotalSize += esp_size; - - if (sa->CurrentSeqNo >= 0xf0000000) - { - start_qm = true; - } - - if (sa->TransformSetting.LifeKilobytes != 0) - { - UINT64 hard_size = (UINT64)sa->TransformSetting.LifeKilobytes * (UINT64)1000; - UINT64 soft_size = hard_size * (UINT64)2 / (UINT64)3; - - if (sa->TotalSize >= soft_size) - { - start_qm = true; - } - } - - if (start_qm) - { - if (sa->StartQM_FlagSet == false) - { - sa->StartQM_FlagSet = true; - c->StartQuickModeAsSoon = true; - } - } - } - else - { - // Encryption failure - Free(esp); - } -} -void IPsecSendPacketByIkeClient(IKE_SERVER *ike, IKE_CLIENT *c, UCHAR *data, UINT data_size, UCHAR protocol_id) -{ - // Validate arguments - if (ike == NULL || c == NULL || data == NULL || data_size == 0) - { - return; - } - - if (c->CurrentIpSecSaSend == NULL) - { - return; - } - - IPsecSendPacketByIPsecSa(ike, c->CurrentIpSecSaSend, data, data_size, protocol_id); -} - -// Send an UDP packet via IPsec -void IPsecSendUdpPacket(IKE_SERVER *ike, IKE_CLIENT *c, UINT src_port, UINT dst_port, UCHAR *data, UINT data_size) -{ - UCHAR *udp; - UINT udp_size; - UDP_HEADER *u; - UCHAR tmp1600[1600]; - bool no_free = false; - // Validate arguments - if (ike == NULL || c == NULL || data == NULL || data_size == 0) - { - return; - } - - // Build an UDP packet - udp_size = sizeof(UDP_HEADER) + data_size; - - if (udp_size > sizeof(tmp1600)) - { - udp = Malloc(udp_size); - } - else - { - udp = tmp1600; - no_free = true; - } - - // UDP header - u = (UDP_HEADER *)udp; - u->SrcPort = Endian16(src_port); - u->DstPort = Endian16(dst_port); - u->PacketLength = Endian16(udp_size); - u->Checksum = 0; - - //Debug("IPsec UDP Send: %u -> %u %u\n", src_port, dst_port, data_size); -#ifdef RAW_DEBUG - IPsecIkeSendUdpForDebug(IPSEC_PORT_L2TP, 1, data, data_size); -#endif // RAW_DEBUG - - // Payload - Copy(udp + sizeof(UDP_HEADER), data, data_size); - - if (IsIP6(&c->ClientIP)) - { - if (IsIPsecSaTunnelMode(c->CurrentIpSecSaSend) == false) - { - u->Checksum = CalcChecksumForIPv6((IPV6_ADDR *)c->TransportModeServerIP.ipv6_addr, - (IPV6_ADDR *)c->TransportModeClientIP.ipv6_addr, - IP_PROTO_UDP, - u, - udp_size, 0); - } - else - { - u->Checksum = CalcChecksumForIPv6((IPV6_ADDR *)c->TunnelModeServerIP.ipv6_addr, - (IPV6_ADDR *)c->TunnelModeClientIP.ipv6_addr, - IP_PROTO_UDP, - u, - udp_size, 0); - } - } - - IPsecSendPacketByIkeClient(ike, c, udp, udp_size, IP_PROTO_UDP); - - if (no_free == false) - { - Free(udp); - } -} - -// Get whether the specified IPsec SA is in tunnel mode -bool IsIPsecSaTunnelMode(IPSECSA *sa) -{ - // Validate arguments - if (sa == NULL) - { - return false; - } - - if (sa->TransformSetting.CapsuleMode == IKE_P2_CAPSULE_TUNNEL || - sa->TransformSetting.CapsuleMode == IKE_P2_CAPSULE_NAT_TUNNEL_1 || - sa->TransformSetting.CapsuleMode == IKE_P2_CAPSULE_NAT_TUNNEL_2) - { - return true; - } - - return false; -} - -// Reception process of ESP packet -void ProcIPsecEspPacketRecv(IKE_SERVER *ike, UDPPACKET *p) -{ - UCHAR *src; - UINT src_size; - UINT spi; - UINT seq; - IPSECSA *ipsec_sa; - IKE_CLIENT *c; - UINT block_size; - UINT hash_size; - bool update_status = false; - UCHAR *iv; - UCHAR *hash; - UCHAR *encrypted_payload_data; - UINT size_of_payload_data; - IKE_CRYPTO_PARAM cp; - BUF *dec; - UCHAR calced_hash[IKE_MAX_HASH_SIZE]; - bool is_tunnel_mode = false; - // Validate arguments - if (ike == NULL || p == NULL) - { - return; - } - - src = (UCHAR *)p->Data; - src_size = p->Size; - - if (p->DestPort == IPSEC_PORT_IPSEC_ESP_RAW) - { - if (IsIP4(&p->DstIP)) - { - // Skip the IP header when received in Raw mode (only in the case of IPv4) - UINT ip_header_size = GetIpHeaderSize(src, src_size); - - src += ip_header_size; - src_size -= ip_header_size; - } - } - - // Get the SPI - if (src_size < sizeof(UINT)) - { - return; - } - - spi = READ_UINT(src + 0); - if (spi == 0) - { - return; - } - - // Get the sequence number - if (src_size < (sizeof(UINT) * 2)) - { - return; - } - seq = READ_UINT(src + sizeof(UINT)); - - // Search and retrieve the IPsec SA from SPI - ipsec_sa = SearchClientToServerIPsecSaBySpi(ike, spi); - if (ipsec_sa == NULL) - { - // Invalid SPI - UINT64 init_cookie = Rand64(); - UINT64 resp_cookie = 0; - IKE_CLIENT *c = NULL; - IKE_CLIENT t; - - - Copy(&t.ClientIP, &p->SrcIP, sizeof(IP)); - t.ClientPort = p->SrcPort; - Copy(&t.ServerIP, &p->DstIP, sizeof(IP)); - t.ServerPort = p->DestPort; - t.CurrentIkeSa = NULL; - - if (p->DestPort == IPSEC_PORT_IPSEC_ESP_RAW) - { - t.ClientPort = t.ServerPort = IPSEC_PORT_IPSEC_ISAKMP; - } - - c = Search(ike->ClientList, &t); - - if (c != NULL && c->CurrentIkeSa != NULL) - { - init_cookie = c->CurrentIkeSa->InitiatorCookie; - resp_cookie = c->CurrentIkeSa->ResponderCookie; - } - - SendInformationalExchangePacketEx(ike, (c == NULL ? &t : c), IkeNewNoticeErrorInvalidSpiPayload(spi), false, - init_cookie, resp_cookie); - - SendDeleteIPsecSaPacket(ike, (c == NULL ? &t : c), spi); - return; - } - - is_tunnel_mode = IsIPsecSaTunnelMode(ipsec_sa); - - c = ipsec_sa->IkeClient; - if (c == NULL) - { - return; - } - - block_size = ipsec_sa->TransformSetting.Crypto->BlockSize; - hash_size = IKE_ESP_HASH_SIZE; - - // Get the IV - if (src_size < (sizeof(UINT) * 2 + block_size + hash_size + block_size)) - { - return; - } - iv = src + sizeof(UINT) * 2; - - // Get the hash - hash = src + src_size - hash_size; - - // Inspect the HMAC - IkeHMac(ipsec_sa->TransformSetting.Hash, calced_hash, ipsec_sa->HashKey, - ipsec_sa->TransformSetting.Hash->HashSize, src, src_size - hash_size); - - if (Cmp(calced_hash, hash, hash_size) != 0) - { - //Debug("IPsec SA 0x%X: Invalid HMAC Value.\n", ipsec_sa->Spi); - return; - } - - // Get the payload data - encrypted_payload_data = src + sizeof(UINT) * 2 + block_size; - size_of_payload_data = src_size - hash_size - block_size - sizeof(UINT) * 2; - if (size_of_payload_data == 0 || (size_of_payload_data % block_size) != 0) - { - // Payload data don't exist or is not a multiple of block size - return; - } - - // Decrypt the payload data - cp.Key = ipsec_sa->CryptoKey; - Copy(&cp.Iv, iv, block_size); - - dec = IkeDecrypt(encrypted_payload_data, size_of_payload_data, &cp); - if (dec != NULL) - { - UCHAR *dec_data = dec->Buf; - UINT dec_size = dec->Size; - UCHAR size_of_padding = dec_data[dec_size - 2]; - UCHAR next_header = dec_data[dec_size - 1]; - if ((dec_size - 2) >= size_of_padding) - { - UINT orig_size = dec_size - 2 - size_of_padding; - - ipsec_sa->TotalSize += dec_size; - - if (is_tunnel_mode) - { - // Tunnel Mode - if (next_header == IKE_PROTOCOL_ID_IPV4 || next_header == IKE_PROTOCOL_ID_IPV6) - { - // Check the contents by parsing the IPv4 / IPv6 header in the case of tunnel mode - BUF *b = NewBuf(); - static UCHAR src_mac_dummy[6] = {0, 0, 0, 0, 0, 0, }; - static UCHAR dst_mac_dummy[6] = {0, 0, 0, 0, 0, 0, }; - USHORT tpid = Endian16(next_header == IKE_PROTOCOL_ID_IPV4 ? MAC_PROTO_IPV4 : MAC_PROTO_IPV6); - PKT *pkt; - - WriteBuf(b, src_mac_dummy, sizeof(src_mac_dummy)); - WriteBuf(b, dst_mac_dummy, sizeof(dst_mac_dummy)); - WriteBuf(b, &tpid, sizeof(tpid)); - - WriteBuf(b, dec_data, dec_size); - - // Parse - pkt = ParsePacket(b->Buf, b->Size); - -#ifdef RAW_DEBUG - IPsecIkeSendUdpForDebug(IPSEC_PORT_L2TP, 1, b->Buf, b->Size); -#endif // RAW_DEBUG - - if (pkt == NULL) - { - // Parsing failure - dec_data = NULL; - dec_size = 0; - } - else - { - // Parsing success - switch (pkt->TypeL3) - { - case L3_IPV4: - // Save the internal IP address information - UINTToIP(&c->TunnelModeServerIP, pkt->L3.IPv4Header->DstIP); - UINTToIP(&c->TunnelModeClientIP, pkt->L3.IPv4Header->SrcIP); - - if (IPV4_GET_OFFSET(pkt->L3.IPv4Header) == 0) - { - if ((IPV4_GET_FLAGS(pkt->L3.IPv4Header) & 0x01) == 0) - { - if (pkt->L3.IPv4Header->Protocol == IPSEC_IP_PROTO_ETHERIP) - { - // EtherIP - if (ike->IPsec->Services.EtherIP_IPsec) - { - // An EtherIP packet has been received - ProcIPsecEtherIPPacketRecv(ike, c, pkt->IPv4PayloadData, pkt->IPv4PayloadSize, true); - } - } - else if (pkt->L3.IPv4Header->Protocol == IPSEC_IP_PROTO_L2TPV3) - { - // L2TPv3 - if (ike->IPsec->Services.EtherIP_IPsec) - { - // A L2TPv3 packet has been received - ProcL2TPv3PacketRecv(ike, c, pkt->IPv4PayloadData, pkt->IPv4PayloadSize, true); - } - } - } - } - break; - - case L3_IPV6: - // Save the internal IP address information - SetIP6(&c->TunnelModeServerIP, pkt->IPv6HeaderPacketInfo.IPv6Header->DestAddress.Value); - SetIP6(&c->TunnelModeClientIP, pkt->IPv6HeaderPacketInfo.IPv6Header->SrcAddress.Value); - - if (pkt->IPv6HeaderPacketInfo.IsFragment == false) - { - if (pkt->IPv6HeaderPacketInfo.FragmentHeader == NULL || (IPV6_GET_FLAGS(pkt->IPv6HeaderPacketInfo.FragmentHeader) & IPV6_FRAGMENT_HEADER_FLAG_MORE_FRAGMENTS) == 0) - { - if (pkt->IPv6HeaderPacketInfo.Protocol == IPSEC_IP_PROTO_ETHERIP) - { - // EtherIP - if (ike->IPsec->Services.EtherIP_IPsec) - { - // An EtherIP packet has been received - ProcIPsecEtherIPPacketRecv(ike, c, pkt->IPv6HeaderPacketInfo.Payload, pkt->IPv6HeaderPacketInfo.PayloadSize, true); - } - } - else if (pkt->IPv6HeaderPacketInfo.Protocol == IPSEC_IP_PROTO_L2TPV3) - { - // L2TPv3 - if (ike->IPsec->Services.EtherIP_IPsec) - { - // A L2TPv3 packet has been received - ProcL2TPv3PacketRecv(ike, c, pkt->IPv6HeaderPacketInfo.Payload, pkt->IPv6HeaderPacketInfo.PayloadSize, true); - } - } - } - } - break; - } - - FreePacket(pkt); - } - - FreeBuf(b); - } - } - else - { - // Transport mode - if (next_header == IP_PROTO_UDP) - { - if (ike->IPsec->Services.L2TP_IPsec || ike->IPsec->Services.EtherIP_IPsec) - { - // An UDP packet has been received - ProcIPsecUdpPacketRecv(ike, c, dec_data, dec_size); - } - } - else if (next_header == IPSEC_IP_PROTO_ETHERIP) - { - if (ike->IPsec->Services.EtherIP_IPsec) - { - // An EtherIP packet has been received - ProcIPsecEtherIPPacketRecv(ike, c, dec_data, dec_size, false); - } - } - else if (next_header == IPSEC_IP_PROTO_L2TPV3) - { - if (ike->IPsec->Services.EtherIP_IPsec) - { - // A L2TPv3 packet has been received - ProcL2TPv3PacketRecv(ike, c, dec_data, dec_size, false); - } - } - } - - update_status = true; - } - - FreeBuf(dec); - } - - if (update_status) - { - bool start_qm = false; - // Update the status of the client - c->CurrentIpSecSaRecv = ipsec_sa; - if (ipsec_sa->PairIPsecSa != NULL) - { - c->CurrentIpSecSaSend = ipsec_sa->PairIPsecSa; - - if (p->DestPort == IPSEC_PORT_IPSEC_ESP_UDP) - { - IPSECSA *send_sa = c->CurrentIpSecSaSend; - if (send_sa->TransformSetting.CapsuleMode == IKE_P2_CAPSULE_TUNNEL) - { - send_sa->TransformSetting.CapsuleMode = IKE_P2_CAPSULE_NAT_TUNNEL_1; - } - else if (send_sa->TransformSetting.CapsuleMode == IKE_P2_CAPSULE_TRANSPORT) - { - send_sa->TransformSetting.CapsuleMode = IKE_P2_CAPSULE_NAT_TRANSPORT_1; - } - } - } - c->LastCommTick = ike->Now; - ipsec_sa->LastCommTick = ike->Now; - if (ipsec_sa->PairIPsecSa != NULL) - { - ipsec_sa->PairIPsecSa->LastCommTick = ike->Now; - } - - SetIkeClientEndpoint(ike, c, &p->SrcIP, p->SrcPort, &p->DstIP, p->DestPort); - - if (seq >= 0xf0000000) - { - // Execute a QuickMode forcibly since sequence number is going to exhaust - start_qm = true; - } - - if (ipsec_sa->TransformSetting.LifeKilobytes != 0) - { - UINT64 hard_size = (UINT64)ipsec_sa->TransformSetting.LifeKilobytes * (UINT64)1000; - UINT64 soft_size = hard_size * (UINT64)2 / (UINT64)3; - - if (ipsec_sa->TotalSize >= soft_size) - { - // Execute a QuickMode forcibly because the capacity limit is going to exceed - start_qm = true; - } - } - - if (start_qm) - { - if (ipsec_sa->StartQM_FlagSet == false) - { - c->StartQuickModeAsSoon = true; - ipsec_sa->StartQM_FlagSet = true; - } - } - } -} - -// Received the L2TPv3 packet via the IPsec tunnel -void ProcL2TPv3PacketRecv(IKE_SERVER *ike, IKE_CLIENT *c, UCHAR *data, UINT data_size, bool is_tunnel_mode) -{ - UDPPACKET p; - // Validate arguments - if (ike == NULL || c == NULL || data == NULL || data_size == 0) - { - return; - } - - c->IsL2TPOnIPsecTunnelMode = is_tunnel_mode; - - IPsecIkeClientManageL2TPServer(ike, c); - - // Pass the received packet to the L2TP server - p.Type = 0; - p.Data = data; - p.DestPort = IPSEC_PORT_L2TPV3_VIRTUAL; - p.Size = data_size; - - if (is_tunnel_mode) - { - Copy(&p.DstIP, &c->TunnelModeServerIP, sizeof(IP)); - Copy(&p.SrcIP, &c->TunnelModeClientIP, sizeof(IP)); - } - else - { - Copy(&p.DstIP, &c->L2TPServerIP, sizeof(IP)); - Copy(&p.SrcIP, &c->L2TPClientIP, sizeof(IP)); - } - p.SrcPort = IPSEC_PORT_L2TPV3_VIRTUAL; - -#ifdef RAW_DEBUG - IPsecIkeSendUdpForDebug(IPSEC_PORT_L2TP, 1, ((UCHAR *)p.Data) + 4, p.Size - 4); -#endif // RAW_DEBUG - - ProcL2TPPacketRecv(c->L2TP, &p); -} - -// An EtherIP packet has been received via an IPsec tunnel -void ProcIPsecEtherIPPacketRecv(IKE_SERVER *ike, IKE_CLIENT *c, UCHAR *data, UINT data_size, bool is_tunnel_mode) -{ - BLOCK *b; - // Validate arguments - if (ike == NULL || c == NULL || data == NULL || data_size == 0) - { - return; - } - - c->IsEtherIPOnIPsecTunnelMode = is_tunnel_mode; - - IPsecIkeClientManageEtherIPServer(ike, c); - - b = NewBlock(data, data_size, 0); - - EtherIPProcRecvPackets(c->EtherIP, b); - - Free(b); -} - -// An UDP packet has been received via the IPsec tunnel -void ProcIPsecUdpPacketRecv(IKE_SERVER *ike, IKE_CLIENT *c, UCHAR *data, UINT data_size) -{ - UDP_HEADER *u; - UINT payload_size; - UINT src_port, dst_port; - UINT packet_length; - // Validate arguments - if (ike == NULL || c == NULL || data == NULL || data_size == 0) - { - return; - } - - if (data_size <= sizeof(UDP_HEADER)) - { - // There is no UDP header or the data is 0 bytes - return; - } - - // UDP header - u = (UDP_HEADER *)data; - - packet_length = Endian16(u->PacketLength); - - if (packet_length <= sizeof(UDP_HEADER)) - { - return; - } - - payload_size = packet_length - sizeof(UDP_HEADER); - - if (payload_size == 0) - { - // No data - return; - } - - if (data_size < (sizeof(UDP_HEADER) + payload_size)) - { - // Data is not followed - return; - } - - src_port = Endian16(u->SrcPort); - dst_port = Endian16(u->DstPort); - - if (dst_port == IPSEC_PORT_L2TP) - { - UDPPACKET p; - // A L2TP packet has been received - IPsecIkeClientManageL2TPServer(ike, c); - - // Update Port number - c->L2TPClientPort = src_port; - - // Pass the received packet to the L2TP server - p.Type = 0; - p.Data = data + sizeof(UDP_HEADER); - p.DestPort = IPSEC_PORT_L2TP; - Copy(&p.DstIP, &c->L2TPServerIP, sizeof(IP)); - p.Size = payload_size; - Copy(&p.SrcIP, &c->L2TPClientIP, sizeof(IP)); - p.SrcPort = IPSEC_PORT_L2TP; - - ProcL2TPPacketRecv(c->L2TP, &p); - - //Debug("IPsec UDP Recv: %u <= %u %u\n", dst_port, src_port, p.Size); - -#ifdef RAW_DEBUG - IPsecIkeSendUdpForDebug(IPSEC_PORT_L2TP, 1, p.Data, p.Size); -#endif // RAW_DEBUG - } -} - -// Send a raw packet for debugging -void IPsecIkeSendUdpForDebug(UINT dst_port, UINT dst_ip, void *data, UINT size) -{ - SOCK *s = NewUDP(0); - IP d; - - SetIP(&d, dst_ip, dst_ip, dst_ip, dst_ip); - - SendTo(s, &d, dst_port, data, size); - - ReleaseSock(s); -} - -// L2TP packet transmission (via IPsec SA tunnel) -void IPsecIkeClientSendL2TPPackets(IKE_SERVER *ike, IKE_CLIENT *c, L2TP_SERVER *l2tp) -{ - UINT i; - // Validate arguments - if (ike == NULL || c == NULL || l2tp == NULL) - { - return; - } - - for (i = 0;i < LIST_NUM(l2tp->SendPacketList);i++) - { - UDPPACKET *u = LIST_DATA(l2tp->SendPacketList, i); - - if (u->SrcPort != IPSEC_PORT_L2TPV3_VIRTUAL) - { - // L2TP UDP packet transmission - IPsecSendUdpPacket(ike, c, IPSEC_PORT_L2TP, c->L2TPClientPort, - u->Data, u->Size); - } - else - { - // L2TPv3 special IP packet transmission - IPsecSendPacketByIkeClient(ike, c, u->Data, u->Size, IPSEC_IP_PROTO_L2TPV3); - -#ifdef RAW_DEBUG - IPsecIkeSendUdpForDebug(IPSEC_PORT_L2TP, 1, ((UCHAR *)u->Data) + 4, u->Size - 4); -#endif // RAW_DEBUG - } - - FreeUdpPacket(u); - } - - DeleteAll(l2tp->SendPacketList); -} - -// Manage the L2TP server that is associated with the IKE_CLIENT -void IPsecIkeClientManageL2TPServer(IKE_SERVER *ike, IKE_CLIENT *c) -{ - L2TP_SERVER *l2tp; - // Validate arguments - if (ike == NULL || c == NULL) - { - return; - } - - if (c->L2TP == NULL) - { - UINT crypt_block_size = IKE_MAX_BLOCK_SIZE; - - if (c->CurrentIpSecSaRecv != NULL) - { - crypt_block_size = c->CurrentIpSecSaRecv->TransformSetting.Crypto->BlockSize; - } - - c->L2TP = NewL2TPServerEx(ike->Cedar, ike, IsIP6(&c->ClientIP), crypt_block_size); - c->L2TP->IkeClient = c; - - Copy(&c->L2TPServerIP, &c->ServerIP, sizeof(IP)); - Copy(&c->L2TPClientIP, &c->ClientIP, sizeof(IP)); - - if (c->CurrentIpSecSaRecv != NULL) - { - Format(c->L2TP->CryptName, sizeof(c->L2TP->CryptName), - "IPsec - %s (%u bits)", - c->CurrentIpSecSaRecv->TransformSetting.Crypto->Name, - c->CurrentIpSecSaRecv->TransformSetting.CryptoKeySize * 8); - } - - Debug("IKE_CLIENT 0x%X: L2TP Server Started.\n", c); - - IPsecLog(ike, c, NULL, NULL, "LI_L2TP_SERVER_STARTED"); - } - - l2tp = c->L2TP; - - if (l2tp->Interrupts == NULL) - { - l2tp->Interrupts = ike->Interrupts; - } - - if (l2tp->SockEvent == NULL) - { - SetL2TPServerSockEvent(l2tp, ike->SockEvent); - } - - l2tp->Now = ike->Now; -} - -// Manage the EtherIP server that is associated with the IKE_CLIENT -void IPsecIkeClientManageEtherIPServer(IKE_SERVER *ike, IKE_CLIENT *c) -{ - ETHERIP_SERVER *s; - // Validate arguments - if (ike == NULL || c == NULL) - { - return; - } - - if (c->EtherIP == NULL) - { - char crypt_name[MAX_SIZE]; - UINT crypt_block_size = IKE_MAX_BLOCK_SIZE; - - Zero(crypt_name, sizeof(crypt_name)); - - if (c->CurrentIpSecSaRecv != NULL) - { - Format(crypt_name, sizeof(crypt_name), - "IPsec - %s (%u bits)", - c->CurrentIpSecSaRecv->TransformSetting.Crypto->Name, - c->CurrentIpSecSaRecv->TransformSetting.CryptoKeySize * 8); - - crypt_block_size = c->CurrentIpSecSaRecv->TransformSetting.Crypto->BlockSize; - } - - c->EtherIP = NewEtherIPServer(ike->Cedar, ike->IPsec, ike, - &c->ClientIP, c->ClientPort, - &c->ServerIP, c->ServerPort, crypt_name, - c->IsEtherIPOnIPsecTunnelMode, crypt_block_size, c->ClientId, - ++ike->CurrentEtherId); - - Debug("IKE_CLIENT 0x%X: EtherIP Server Started.\n", c); - - IPsecLog(ike, c, NULL, NULL, NULL, "LI_ETHERIP_SERVER_STARTED", ike->CurrentEtherId); - } - else - { - StrCpy(c->EtherIP->ClientId, sizeof(c->EtherIP->ClientId), c->ClientId); - } - - s = c->EtherIP; - - if (s->Interrupts == NULL) - { - s->Interrupts = ike->Interrupts; - } - - if (s->SockEvent == NULL) - { - SetEtherIPServerSockEvent(s, ike->SockEvent); - } - - s->Now = ike->Now; -} - -// EtherIP packet transmission (via IPsec SA tunnel) -void IPsecIkeClientSendEtherIPPackets(IKE_SERVER *ike, IKE_CLIENT *c, ETHERIP_SERVER *s) -{ - UINT i; - // Validate arguments - if (ike == NULL || c == NULL || s == NULL) - { - return; - } - - for (i = 0;i < LIST_NUM(s->SendPacketList);i++) - { - BLOCK *b = LIST_DATA(s->SendPacketList, i); - - // Packet transmission - IPsecSendPacketByIkeClient(ike, c, b->Buf, b->Size, IPSEC_IP_PROTO_ETHERIP); - - FreeBlock(b); - } - - DeleteAll(s->SendPacketList); -} - -// Handle the deletion payload -void ProcDeletePayload(IKE_SERVER *ike, IKE_CLIENT *c, IKE_PACKET_DELETE_PAYLOAD *d) -{ - // Validate arguments - if (ike == NULL || c == NULL || d == NULL) - { - return; - } - - if (d->ProtocolId == IKE_PROTOCOL_ID_IPSEC_ESP) - { - UINT i; - // Remove the IPsec SA - for (i = 0;i < LIST_NUM(d->SpiList);i++) - { - BUF *b = LIST_DATA(d->SpiList, i); - - if (b->Size == 4) - { - UINT spi = READ_UINT(b->Buf); - MarkIPsecSaAsDeleted(ike, SearchIPsecSaBySpi(ike, c, spi)); - } - } - } - else if (d->ProtocolId == IKE_PROTOCOL_ID_IKE) - { - UINT i; - // Remove the IKE SA - for (i = 0;i < LIST_NUM(d->SpiList);i++) - { - BUF *b = LIST_DATA(d->SpiList, i); - - if (b->Size == 16) - { - UINT64 v1 = READ_UINT64(((UCHAR *)b->Buf) + 0); - UINT64 v2 = READ_UINT64(((UCHAR *)b->Buf) + 8); - - IKE_SA *sa = FindIkeSaByResponderCookie(ike, v2); - - if (sa != NULL && sa->IkeClient == c) - { - MarkIkeSaAsDeleted(ike, sa); - } - } - } - } -} - -// Mark the IKE_CLIENT for deletion -void MarkIkeClientAsDeleted(IKE_SERVER *ike, IKE_CLIENT *c) -{ - char client_ip_str[MAX_SIZE]; - char server_ip_str[MAX_SIZE]; - // Validate arguments - if (ike == NULL || c == NULL) - { - return; - } - - if (c->Deleting) - { - return; - } - - ike->StateHasChanged = true; - - c->Deleting = true; - - IPToStr(client_ip_str, sizeof(client_ip_str), &c->ClientIP); - IPToStr(server_ip_str, sizeof(server_ip_str), &c->ServerIP); - - Debug("Deleting IKE_CLIENT: %p: %s:%u -> %s:%u\n", c, client_ip_str, c->ClientPort, server_ip_str, c->ServerPort); - - IPsecLog(ike, c, NULL, NULL, "LI_DELETE_IKE_CLIENT"); -} - -// Mark the IKE SA for deletion -void MarkIkeSaAsDeleted(IKE_SERVER *ike, IKE_SA *sa) -{ - // Validate arguments - if (ike == NULL || sa == NULL) - { - return; - } - - if (sa->Deleting) - { - return; - } - - ike->StateHasChanged = true; - - sa->Deleting = true; - - Debug("IKE SA %I64u - %I64u has been marked as being deleted.\n", sa->InitiatorCookie, sa->ResponderCookie); - - SendDeleteIkeSaPacket(ike, sa->IkeClient, sa->InitiatorCookie, sa->ResponderCookie); - - IPsecLog(ike, NULL, sa, NULL, "LI_DELETE_IKE_SA"); -} - -// Mark the IPsec SA for deletion -void MarkIPsecSaAsDeleted(IKE_SERVER *ike, IPSECSA *sa) -{ - // Validate arguments - if (ike == NULL || sa == NULL) - { - return; - } - - if (sa->Deleting) - { - return; - } - - ike->StateHasChanged = true; - - sa->Deleting = true; - - Debug("IPsec SA 0x%X has been marked as being deleted.\n", sa->Spi); - - SendDeleteIPsecSaPacket(ike, sa->IkeClient, sa->Spi); - - IPsecLog(ike, NULL, NULL, sa, "LI_DELETE_IPSEC_SA"); -} - -// IPsec SA Deletion packet transmission process -void SendDeleteIPsecSaPacket(IKE_SERVER *ike, IKE_CLIENT *c, UINT spi) -{ - IKE_PACKET_PAYLOAD *payload; - BUF *buf; - // Validate arguments - if (ike == NULL || c == NULL || spi == 0) - { - return; - } - - buf = NewBuf(); - WriteBufInt(buf, spi); - - payload = IkeNewDeletePayload(IKE_PROTOCOL_ID_IPSEC_ESP, NewListSingle(buf)); - - SendInformationalExchangePacket(ike, c, payload); -} - -// IKE SA deletion packet transmission process -void SendDeleteIkeSaPacket(IKE_SERVER *ike, IKE_CLIENT *c, UINT64 init_cookie, UINT64 resp_cookie) -{ - IKE_PACKET_PAYLOAD *payload; - BUF *buf; - // Validate arguments - if (ike == NULL || c == NULL) - { - return; - } - - buf = NewBuf(); - WriteBufInt64(buf, init_cookie); - WriteBufInt64(buf, resp_cookie); - - payload = IkeNewDeletePayload(IKE_PROTOCOL_ID_IKE, NewListSingle(buf)); - - SendInformationalExchangePacket(ike, c, payload); -} - -// Information exchange packet transmission process -void SendInformationalExchangePacket(IKE_SERVER *ike, IKE_CLIENT *c, IKE_PACKET_PAYLOAD *payload) -{ - SendInformationalExchangePacketEx(ike, c, payload, false, 0, 0); -} -void SendInformationalExchangePacketEx(IKE_SERVER *ike, IKE_CLIENT *c, IKE_PACKET_PAYLOAD *payload, bool force_plain, UINT64 init_cookie, UINT64 resp_cookie) -{ - IKE_SA *sa; - IKE_PACKET *ps; - LIST *payload_list; - UCHAR dummy_hash_data[IKE_MAX_HASH_SIZE]; - IKE_PACKET_PAYLOAD *hash_payload; - BUF *ps_buf; - UINT after_hash_offset, after_hash_size; - BUF *ps_buf_after_hash; - BUF *tmp_buf; - UCHAR hash[IKE_MAX_HASH_SIZE]; - IKE_CRYPTO_PARAM cp; - bool plain = false; - // Validate arguments - if (ike == NULL || c == NULL || payload == NULL) - { - IkeFreePayload(payload); - return; - } - - sa = c->CurrentIkeSa; - if (sa == NULL) - { - plain = true; - } - - if (force_plain) - { - plain = true; - } - - if (plain && (init_cookie == 0 && resp_cookie == 0)) - { - init_cookie = Rand64(); - resp_cookie = 0; - } - - payload_list = NewListFast(NULL); - - Zero(dummy_hash_data, sizeof(dummy_hash_data)); - - // Hash payload - if (plain == false) - { - hash_payload = IkeNewDataPayload(IKE_PAYLOAD_HASH, dummy_hash_data, sa->HashSize); - Add(payload_list, hash_payload); - } - - // Body - Add(payload_list, payload); - - // Packet creation - ps = IkeNew((plain ? init_cookie : sa->InitiatorCookie), (plain ? resp_cookie : sa->ResponderCookie), - IKE_EXCHANGE_TYPE_INFORMATION, false, false, false, - GenerateNewMessageId(ike), payload_list); - - if (plain == false) - { - // Build a temporary packet - ps_buf = IkeBuild(ps, NULL); - - // Get the payload after the hash part - after_hash_offset = sizeof(IKE_HEADER) + hash_payload->BitArray->Size + sizeof(IKE_COMMON_HEADER); - after_hash_size = ((ps_buf->Size > after_hash_offset) ? (ps_buf->Size - after_hash_offset) : 0); - - ps_buf_after_hash = MemToBuf(((UCHAR *)ps_buf->Buf) + after_hash_offset, after_hash_size); - FreeBuf(ps_buf); - - // Calculate the hash - tmp_buf = NewBuf(); - WriteBufInt(tmp_buf, ps->MessageId); - WriteBufBuf(tmp_buf, ps_buf_after_hash); - IkeHMac(sa->TransformSetting.Hash, hash, sa->SKEYID_a, sa->HashSize, tmp_buf->Buf, tmp_buf->Size); - FreeBuf(tmp_buf); - - // Overwrite the hash - Copy(hash_payload->Payload.Hash.Data->Buf, hash, sa->HashSize); - - ps->FlagEncrypted = true; - FreeBuf(ps_buf_after_hash); - } - - // Packet reply - Zero(&cp, sizeof(cp)); - - if (plain == false) - { - cp.Key = sa->CryptoKey; - IkeCalcPhase2InitialIv(cp.Iv, sa, ps->MessageId); - } - - ps_buf = IkeBuild(ps, &cp); - - IkeSendUdpPacket(ike, IKE_UDP_TYPE_ISAKMP, &c->ServerIP, c->ServerPort, - &c->ClientIP, c->ClientPort, - ps_buf->Buf, ps_buf->Size); - -#ifdef RAW_DEBUG - IkeDebugUdpSendRawPacket(ps); -#endif // RAW_DEBUG - - Free(ps_buf); - - IkeFree(ps); -} - -// Information exchange packet reception process -void ProcIkeInformationalExchangePacketRecv(IKE_SERVER *ike, UDPPACKET *p, IKE_PACKET *header) -{ - IKE_CLIENT *c; - IKE_SA *ike_sa; - // Validate arguments - if (ike == NULL || p == NULL || header == NULL || header->InitiatorCookie == 0 || header->ResponderCookie == 0 - || header->MessageId == 0 || header->FlagEncrypted == false) - { - return; - } - - c = SearchOrCreateNewIkeClientForIkePacket(ike, &p->SrcIP, p->SrcPort, &p->DstIP, p->DestPort, header); - - if (c == NULL) - { - return; - } - - ike_sa = FindIkeSaByResponderCookieAndClient(ike, header->ResponderCookie, c); - - if (ike_sa != NULL && ike_sa->Established) - { - IKE_PACKET *pr; - IKE_CRYPTO_PARAM cp; - - // Packet decoding - Zero(&cp, sizeof(cp)); - cp.Key = ike_sa->CryptoKey; - IkeCalcPhase2InitialIv(cp.Iv, ike_sa, header->MessageId); - - pr = IkeParse(p->Data, p->Size, &cp); -#ifdef RAW_DEBUG - IkeDebugUdpSendRawPacket(pr); -#endif // RAW_DEBUG - if (pr != NULL) - { - // Get the hash payload - IKE_PACKET_PAYLOAD *hash_payload; - - hash_payload = IkeGetPayload(pr->PayloadList, IKE_PAYLOAD_HASH, 0); - if (hash_payload != NULL) - { - // Get the payload after the hash - UINT header_and_hash_size = sizeof(IKE_COMMON_HEADER) + hash_payload->BitArray->Size; - void *after_hash_data = ((UCHAR *)pr->DecryptedPayload->Buf) + header_and_hash_size; - if (pr->DecryptedPayload->Size > header_and_hash_size) - { - UINT after_hash_size = pr->DecryptedPayload->Size - header_and_hash_size; - UCHAR hash1[IKE_MAX_HASH_SIZE]; - BUF *hash1_buf; - - hash1_buf = NewBuf(); - WriteBufInt(hash1_buf, header->MessageId); - WriteBuf(hash1_buf, after_hash_data, after_hash_size); - - IkeHMac(ike_sa->TransformSetting.Hash, hash1, ike_sa->SKEYID_a, ike_sa->HashSize, - hash1_buf->Buf, hash1_buf->Size); - - // Compare the hash value - if (IkeCompareHash(hash_payload, hash1, ike_sa->HashSize)) - { - UINT i, num; - // Handle the deletion payload - num = IkeGetPayloadNum(pr->PayloadList, IKE_PAYLOAD_DELETE); - for (i = 0;i < num;i++) - { - IKE_PACKET_PAYLOAD *payload = IkeGetPayload(pr->PayloadList, IKE_PAYLOAD_DELETE, i); - IKE_PACKET_DELETE_PAYLOAD *del = &payload->Payload.Delete; - - ProcDeletePayload(ike, c, del); - } - num = IkeGetPayloadNum(pr->PayloadList, IKE_PAYLOAD_NOTICE); - // Handle the notification payload - for (i = 0;i < num;i++) - { - IKE_PACKET_PAYLOAD *payload = IkeGetPayload(pr->PayloadList, IKE_PAYLOAD_NOTICE, i); - IKE_PACKET_NOTICE_PAYLOAD *n = &payload->Payload.Notice; - - if (n->MessageType == IKE_NOTICE_DPD_REQUEST || n->MessageType == IKE_NOTICE_DPD_RESPONSE) - { - if (n->MessageData != NULL && n->MessageData->Size == sizeof(UINT)) - { - UINT seq_no = READ_UINT(n->MessageData->Buf); - - if (n->Spi->Size == (sizeof(UINT64) * 2)) - { - UINT64 init_cookie = READ_UINT64(((UCHAR *)n->Spi->Buf)); - UINT64 resp_cookie = READ_UINT64(((UCHAR *)n->Spi->Buf) + sizeof(UINT64)); - - if (init_cookie != 0 && resp_cookie != 0) - { - IKE_SA *found_ike_sa = SearchIkeSaByCookie(ike, init_cookie, resp_cookie); - - if (found_ike_sa != NULL && found_ike_sa->IkeClient == c) - { - if (n->MessageType == IKE_NOTICE_DPD_REQUEST) - { - // Return the DPD Response (ACK) for the DPD Request - SendInformationalExchangePacket(ike, c, - IkeNewNoticeDpdPayload(true, init_cookie, resp_cookie, - seq_no)); - } - - // Update the status of the IKE SA - found_ike_sa->LastCommTick = ike->Now; - ike_sa->LastCommTick = ike->Now; - found_ike_sa->IkeClient->LastCommTick = ike->Now; - ike_sa->IkeClient->LastCommTick = ike->Now; - ike_sa->IkeClient->CurrentIkeSa = ike_sa; - } - } - } - } - } - } - } - - FreeBuf(hash1_buf); - } - } - - IkeFree(pr); - } - } -} - -// Create a new message ID -UINT GenerateNewMessageId(IKE_SERVER *ike) -{ - UINT ret; - // Validate arguments - if (ike == NULL) - { - return 0; - } - - while (true) - { - ret = Rand32(); - - if (ret != 0 && ret != 0xffffffff) - { - UINT i; - bool ok = true; - - for (i = 0;i < LIST_NUM(ike->IPsecSaList);i++) - { - IPSECSA *sa = LIST_DATA(ike->IPsecSaList, i); - - if (sa->MessageId == ret) - { - ok = false; - break; - } - } - - if (ok) - { - return ret; - } - } - } -} - -// Start the quick mode -void StartQuickMode(IKE_SERVER *ike, IKE_CLIENT *c) -{ - IPSEC_SA_TRANSFORM_SETTING setting; - IKE_SA *ike_sa; - UINT message_id; - UCHAR iv[IKE_MAX_BLOCK_SIZE]; - // Validate arguments - if (ike == NULL || c == NULL) - { - return; - } - - if (IsZero(&c->CachedTransformSetting, sizeof(IPSEC_SA_TRANSFORM_SETTING))) - { - // Cached transform setting does not exist - Debug("Error: c->CachedTransformSetting is not existing.\n"); - return; - } - - ike_sa = c->CurrentIkeSa; - if (ike_sa == NULL) - { - return; - } - - IPsecLog(ike, NULL, ike_sa, NULL, "LI_START_QM_FROM_SERVER"); - - Copy(&setting, &c->CachedTransformSetting, sizeof(IPSEC_SA_TRANSFORM_SETTING)); - - message_id = GenerateNewMessageId(ike); - - IkeCalcPhase2InitialIv(iv, ike_sa, message_id); - -#ifdef FORCE_LIFETIME_QM - setting.LifeSeconds = FORCE_LIFETIME_QM; -#endif // FORCE_LIFETIME_QM - - if (true) - { - IKE_PACKET *ps; - LIST *payload_list; - IKE_PACKET_PAYLOAD *send_hash_payload; - IKE_PACKET_PAYLOAD *send_sa_payload; - IKE_PACKET_PAYLOAD *send_proposal_payload; - IKE_PACKET_PAYLOAD *send_transform_payload; - IKE_PACKET_PAYLOAD *send_rand_payload; - IKE_PACKET_PAYLOAD *send_key_payload = NULL; - IKE_PACKET_PAYLOAD *send_id_1 = NULL, *send_id_2 = NULL; - UINT shared_key_size = 0; - UCHAR *shared_key = NULL; - BUF *initiator_rand; - IPSECSA *ipsec_sa_s_c, *ipsec_sa_c_s; - BUF *ps_buf; - UINT after_hash_offset, after_hash_size; - BUF *ps_buf_after_hash; - BUF *tmp_buf; - UINT spi; - UINT spi_be; - UCHAR hash1[IKE_MAX_HASH_SIZE]; - DH_CTX *dh = NULL; - UCHAR dummy_hash_data[IKE_MAX_HASH_SIZE]; - - initiator_rand = RandBuf(IKE_SA_RAND_SIZE); - - if (setting.Dh != NULL) - { - // Generate DH - dh = IkeDhNewCtx(setting.Dh); - - if (dh != NULL) - { - send_key_payload = IkeNewDataPayload(IKE_PAYLOAD_KEY_EXCHANGE, - dh->MyPublicKey->Buf, dh->MyPublicKey->Size); - } - } - - Zero(dummy_hash_data, sizeof(dummy_hash_data)); - - // Dummy hash value - payload_list = NewListFast(NULL); - send_hash_payload = IkeNewDataPayload(IKE_PAYLOAD_HASH, dummy_hash_data, ike_sa->HashSize); - Add(payload_list, send_hash_payload); - - // Determine the SPI - spi = GenerateNewIPsecSaSpi(ike, 0); - spi_be = Endian32(spi); - - // SA - send_transform_payload = TransformSettingToTransformPayloadForIPsec(ike, &setting); - send_proposal_payload = IkeNewProposalPayload(1, IKE_PROTOCOL_ID_IPSEC_ESP, &spi_be, sizeof(spi_be), - NewListSingle(send_transform_payload)); - send_sa_payload = IkeNewSaPayload(NewListSingle(send_proposal_payload)); - Add(payload_list, send_sa_payload); - - // Random number - send_rand_payload = IkeNewDataPayload(IKE_PAYLOAD_RAND, initiator_rand->Buf, initiator_rand->Size); - Add(payload_list, send_rand_payload); - - // Key exchange - if (send_key_payload != NULL) - { - Add(payload_list, send_key_payload); - } - - if (c->SendID1andID2) - { - // Add the ID payload - if (setting.CapsuleMode == IKE_P2_CAPSULE_NAT_TUNNEL_1 || setting.CapsuleMode == IKE_P2_CAPSULE_NAT_TUNNEL_2) - { - UCHAR zero[32]; - - Zero(zero, sizeof(zero)); - - // Tunnel Mode - send_id_1 = IkeNewIdPayload((IsIP4(&c->ServerIP) ? IKE_ID_IPV4_ADDR_SUBNET : IKE_ID_IPV6_ADDR_SUBNET), - 0, 0, - zero, (IsIP4(&c->ServerIP) ? 8 : 32)); - - send_id_2 = IkeNewIdPayload(c->SendID1_Type, - c->SendID1_Protocol, c->SendID1_Port, - c->SendID1_Buf->Buf, c->SendID1_Buf->Size); - } - else - { - // Transport mode - // Specify in the reverse order in which the client has been specified - send_id_2 = IkeNewIdPayload(c->SendID1_Type, - c->SendID1_Protocol, c->SendID1_Port, - c->SendID1_Buf->Buf, c->SendID1_Buf->Size); - - send_id_1 = IkeNewIdPayload(c->SendID2_Type, - c->SendID2_Protocol, c->SendID2_Port, - c->SendID2_Buf->Buf, c->SendID2_Buf->Size); - } - - Add(payload_list, send_id_1); - Add(payload_list, send_id_2); - } - - if (true) - { - // NAT-OA payload - if (c->SendNatOaDraft1) - { - Add(payload_list, IkeNewNatOaPayload(IKE_PAYLOAD_NAT_OA_DRAFT, &c->ServerIP)); - } - - if (c->SendNatOaDraft2) - { - Add(payload_list, IkeNewNatOaPayload(IKE_PAYLOAD_NAT_OA_DRAFT_2, &c->ServerIP)); - } - - if (c->SendNatOaRfc) - { - Add(payload_list, IkeNewNatOaPayload(IKE_PAYLOAD_NAT_OA, &c->ClientIP)); - Add(payload_list, IkeNewNatOaPayload(IKE_PAYLOAD_NAT_OA, &c->ServerIP)); - } - } - - // Build a packet - ps = IkeNew(ike_sa->InitiatorCookie, ike_sa->ResponderCookie, IKE_EXCHANGE_TYPE_QUICK, - false, false, false, message_id, payload_list); - - // Build a temporary packet - ps_buf = IkeBuild(ps, NULL); - - // Get the payload after the hash part - after_hash_offset = sizeof(IKE_HEADER) + send_hash_payload->BitArray->Size + sizeof(IKE_COMMON_HEADER); - after_hash_size = ((ps_buf->Size > after_hash_offset) ? (ps_buf->Size - after_hash_offset) : 0); - - ps_buf_after_hash = MemToBuf(((UCHAR *)ps_buf->Buf) + after_hash_offset, after_hash_size); - FreeBuf(ps_buf); - - // Calculate the hash #1 - tmp_buf = NewBuf(); - WriteBufInt(tmp_buf, message_id); - WriteBufBuf(tmp_buf, ps_buf_after_hash); - IkeHMac(ike_sa->TransformSetting.Hash, hash1, ike_sa->SKEYID_a, ike_sa->HashSize, tmp_buf->Buf, tmp_buf->Size); - FreeBuf(tmp_buf); - - // Overwrite hash #1 - Copy(send_hash_payload->Payload.Hash.Data->Buf, hash1, ike_sa->HashSize); - - // Create an IPsec SA - ipsec_sa_c_s = NewIPsecSa(ike, c, ike_sa, true, message_id, false, iv, spi, - initiator_rand->Buf, initiator_rand->Size, NULL, 0, - &setting, shared_key, shared_key_size); - - ipsec_sa_s_c = NewIPsecSa(ike, c, ike_sa, true, message_id, true, iv, 0, - initiator_rand->Buf, initiator_rand->Size, NULL, 0, - &setting, shared_key, shared_key_size); - - ipsec_sa_c_s->PairIPsecSa = ipsec_sa_s_c; - ipsec_sa_s_c->PairIPsecSa = ipsec_sa_c_s; - - ipsec_sa_s_c->Dh = dh; - - Insert(ike->IPsecSaList, ipsec_sa_c_s); - Insert(ike->IPsecSaList, ipsec_sa_s_c); - - // Packet transmission - ps->FlagEncrypted = true; - IPsecSaSendPacket(ike, ipsec_sa_s_c, ps); - ipsec_sa_s_c->NumResends = 3; -#ifdef RAW_DEBUG - IkeDebugUdpSendRawPacket(ps); -#endif // RAW_DEBUG - - IkeFree(ps); - Free(shared_key); - FreeBuf(ps_buf_after_hash); - FreeBuf(initiator_rand); - } -} - -// Process the quick mode received packet -void ProcIkeQuickModePacketRecv(IKE_SERVER *ike, UDPPACKET *p, IKE_PACKET *header) -{ - IKE_CLIENT *c; - IKE_SA *ike_sa; - // Validate arguments - if (ike == NULL || p == NULL || header == NULL || header->InitiatorCookie == 0 || header->ResponderCookie == 0 - || header->MessageId == 0 || header->FlagEncrypted == false) - { - return; - } - - c = SearchOrCreateNewIkeClientForIkePacket(ike, &p->SrcIP, p->SrcPort, &p->DstIP, p->DestPort, header); - - if (c == NULL) - { - return; - } - - ike_sa = FindIkeSaByResponderCookieAndClient(ike, header->ResponderCookie, c); - - if (ike_sa == NULL) - { - // IKE SA does not exist - SendInformationalExchangePacketEx(ike, c, IkeNewNoticeErrorInvalidCookiePayload(header->InitiatorCookie, - header->ResponderCookie), true, header->InitiatorCookie, header->ResponderCookie); - } - - if (ike_sa != NULL && ike_sa->Established) - { - // Update the status of the IKE SA - ike_sa->LastCommTick = ike->Now; - ike_sa->IkeClient->LastCommTick = ike->Now; - ike_sa->IkeClient->CurrentIkeSa = ike_sa; - - // Search whether the Message ID is already in the database - if (SearchIPsecSaByMessageId(ike, c, header->MessageId) == NULL) - { - IKE_PACKET *pr; - IKE_CRYPTO_PARAM cp; - - // Message ID does not exist. Start a new Quick Mode session - Zero(&cp, sizeof(cp)); - cp.Key = ike_sa->CryptoKey; - IkeCalcPhase2InitialIv(cp.Iv, ike_sa, header->MessageId); - - pr = IkeParse(p->Data, p->Size, &cp); -#ifdef RAW_DEBUG - IkeDebugUdpSendRawPacket(pr); -#endif // RAW_DEBUG - if (pr != NULL) - { - // Get the hash payload - IKE_PACKET_PAYLOAD *hash_payload; - - hash_payload = IkeGetPayload(pr->PayloadList, IKE_PAYLOAD_HASH, 0); - if (hash_payload != NULL) - { - // Get the payload after the hash - UINT header_and_hash_size = sizeof(IKE_COMMON_HEADER) + hash_payload->BitArray->Size; - void *after_hash_data = ((UCHAR *)pr->DecryptedPayload->Buf) + header_and_hash_size; - if (pr->DecryptedPayload->Size > header_and_hash_size) - { - UINT after_hash_size = pr->DecryptedPayload->Size - header_and_hash_size; - UCHAR hash1[IKE_MAX_HASH_SIZE]; - BUF *hash1_buf; - - hash1_buf = NewBuf(); - WriteBufInt(hash1_buf, header->MessageId); - WriteBuf(hash1_buf, after_hash_data, after_hash_size); - - IkeHMac(ike_sa->TransformSetting.Hash, hash1, ike_sa->SKEYID_a, ike_sa->HashSize, - hash1_buf->Buf, hash1_buf->Size); - - // Compare the hash value - if (IkeCompareHash(hash_payload, hash1, ike_sa->HashSize)) - { - IKE_PACKET_PAYLOAD *sa_payload, *rand_payload, *key_payload, *id_payload_1, *id_payload_2; - - // Get the payload of other - sa_payload = IkeGetPayload(pr->PayloadList, IKE_PAYLOAD_SA, 0); - rand_payload = IkeGetPayload(pr->PayloadList, IKE_PAYLOAD_RAND, 0); - key_payload = IkeGetPayload(pr->PayloadList, IKE_PAYLOAD_KEY_EXCHANGE, 0); - id_payload_1 = IkeGetPayload(pr->PayloadList, IKE_PAYLOAD_ID, 0); - id_payload_2 = IkeGetPayload(pr->PayloadList, IKE_PAYLOAD_ID, 1); - - if (sa_payload != NULL && rand_payload != NULL) - { - IPSEC_SA_TRANSFORM_SETTING setting; - - Zero(&setting, sizeof(setting)); - - // Interpret the SA payload - if (GetBestTransformSettingForIPsecSa(ike, pr, &setting, &p->DstIP) && (GetNumberOfIPsecSaOfIkeClient(ike, c) <= IKE_QUOTA_MAX_SA_PER_CLIENT)) - { - // Appropriate transform setting is selected - Debug("P2 Transform: %s %s %s(%u) %u %u\n", - (setting.Dh == NULL ? NULL : setting.Dh->Name), setting.Hash->Name, setting.Crypto->Name, setting.CryptoKeySize, - setting.LifeKilobytes, setting.LifeSeconds); - -#ifdef FORCE_LIFETIME_QM - setting.LifeSeconds = FORCE_LIFETIME_QM; -#endif // FORCE_LIFETIME_QM - - // Cache the transform attribute value - Copy(&c->CachedTransformSetting, &setting, sizeof(IPSEC_SA_TRANSFORM_SETTING)); - - // Check the key exchange payload if the PFS is specified - if (setting.Dh == NULL || (setting.Dh != NULL && key_payload != NULL && - key_payload->Payload.KeyExchange.Data->Size <= setting.Dh->KeySize)) - { - // Create a payload for response - IKE_PACKET *ps; - LIST *payload_list; - IKE_PACKET_PAYLOAD *send_hash_payload; - IKE_PACKET_PAYLOAD *send_sa_payload; - IKE_PACKET_PAYLOAD *send_proposal_payload; - IKE_PACKET_PAYLOAD *send_transform_payload; - IKE_PACKET_PAYLOAD *send_rand_payload; - IKE_PACKET_PAYLOAD *send_key_payload = NULL; - IKE_PACKET_PAYLOAD *send_id_1 = NULL, *send_id_2 = NULL; - UCHAR dummy_hash_data[IKE_MAX_HASH_SIZE]; - DH_CTX *dh = NULL; - UINT shared_key_size = 0; - UCHAR *shared_key = NULL; - BUF *initiator_rand, *responder_rand; - IPSECSA *ipsec_sa_s_c, *ipsec_sa_c_s; - BUF *ps_buf; - UINT after_hash_offset, after_hash_size; - BUF *ps_buf_after_hash; - BUF *tmp_buf; - UINT spi; - UINT spi_be; - UCHAR hash2[IKE_MAX_HASH_SIZE]; - UCHAR hash3[IKE_MAX_HASH_SIZE]; - UCHAR zero = 0; - - IPsecLog(ike, NULL, ike_sa, NULL, "LI_START_QM_FROM_CLIENT"); - - initiator_rand = CloneBuf(rand_payload->Payload.Rand.Data); - responder_rand = RandBuf(IKE_SA_RAND_SIZE); - - if (setting.Dh != NULL) - { - // Calculate DH - dh = IkeDhNewCtx(setting.Dh); - shared_key_size = (dh == NULL ? 0 : dh->Size); - shared_key = ZeroMalloc(shared_key_size); - - if (DhCompute(dh, shared_key, key_payload->Payload.KeyExchange.Data->Buf, key_payload->Payload.KeyExchange.Data->Size)) - { - // DH calculation success - Debug("P2 DH Ok.\n"); - - send_key_payload = IkeNewDataPayload(IKE_PAYLOAD_KEY_EXCHANGE, - dh->MyPublicKey->Buf, dh->MyPublicKey->Size); - - IkeDhFreeCtx(dh); - } - else - { - // DH calculation failure - Debug("P2 DhCompute failed.\n"); - - shared_key = NULL; - Free(shared_key); - shared_key_size = 0; - - IPsecLog(ike, NULL, ike_sa, NULL, "LI_QM_DH_ERROR"); - } - } - - Zero(dummy_hash_data, sizeof(dummy_hash_data)); - - // Dummy hash value - payload_list = NewListFast(NULL); - send_hash_payload = IkeNewDataPayload(IKE_PAYLOAD_HASH, dummy_hash_data, ike_sa->HashSize); - Add(payload_list, send_hash_payload); - - // Determine the SPI - spi = GenerateNewIPsecSaSpi(ike, setting.SpiServerToClient); - spi_be = Endian32(spi); - - // SA - send_transform_payload = TransformSettingToTransformPayloadForIPsec(ike, &setting); - send_proposal_payload = IkeNewProposalPayload(1, IKE_PROTOCOL_ID_IPSEC_ESP, &spi_be, sizeof(spi_be), - NewListSingle(send_transform_payload)); - send_sa_payload = IkeNewSaPayload(NewListSingle(send_proposal_payload)); - Add(payload_list, send_sa_payload); - - // Random number - send_rand_payload = IkeNewDataPayload(IKE_PAYLOAD_RAND, responder_rand->Buf, responder_rand->Size); - Add(payload_list, send_rand_payload); - - // Key exchange - if (send_key_payload != NULL) - { - Add(payload_list, send_key_payload); - } - - // ID - if (id_payload_1 != NULL && id_payload_2 != NULL) - { - send_id_1 = IkeNewIdPayload(id_payload_1->Payload.Id.Type, - id_payload_1->Payload.Id.ProtocolId, id_payload_1->Payload.Id.Port, - id_payload_1->Payload.Id.IdData->Buf, id_payload_1->Payload.Id.IdData->Size); - - send_id_2 = IkeNewIdPayload(id_payload_2->Payload.Id.Type, - id_payload_2->Payload.Id.ProtocolId, id_payload_2->Payload.Id.Port, - id_payload_2->Payload.Id.IdData->Buf, id_payload_2->Payload.Id.IdData->Size); - - Add(payload_list, send_id_1); - Add(payload_list, send_id_2); - - if (c->SendID1_Buf != NULL) - { - FreeBuf(c->SendID1_Buf); - } - - if (c->SendID2_Buf != NULL) - { - FreeBuf(c->SendID2_Buf); - } - - c->SendID1_Type = id_payload_1->Payload.Id.Type; - c->SendID1_Protocol = id_payload_1->Payload.Id.ProtocolId; - c->SendID1_Port = id_payload_1->Payload.Id.Port; - c->SendID1_Buf = CloneBuf(id_payload_1->Payload.Id.IdData); - - c->SendID2_Type = id_payload_2->Payload.Id.Type; - c->SendID2_Protocol = id_payload_2->Payload.Id.ProtocolId; - c->SendID2_Port = id_payload_2->Payload.Id.Port; - c->SendID2_Buf = CloneBuf(id_payload_2->Payload.Id.IdData); - - c->SendID1andID2 = true; - } - else - { - c->SendID1andID2 = false; - } - - if (true) - { - // Reply if NAT-OA payload is presented by the client - IKE_PACKET_PAYLOAD *nat_oa_draft1 = IkeGetPayload(pr->PayloadList, IKE_PAYLOAD_NAT_OA_DRAFT, 0); - IKE_PACKET_PAYLOAD *nat_oa_draft2 = IkeGetPayload(pr->PayloadList, IKE_PAYLOAD_NAT_OA_DRAFT_2, 0); - IKE_PACKET_PAYLOAD *nat_oa_rfc_0 = IkeGetPayload(pr->PayloadList, IKE_PAYLOAD_NAT_OA, 0); - IKE_PACKET_PAYLOAD *nat_oa_rfc_1 = IkeGetPayload(pr->PayloadList, IKE_PAYLOAD_NAT_OA, 1); - - c->SendNatOaDraft1 = c->SendNatOaDraft2 = c->SendNatOaRfc = false; - - c->ShouldCalcChecksumForUDP = false; - - if (nat_oa_draft1 != NULL) - { - Add(payload_list, IkeNewNatOaPayload(IKE_PAYLOAD_NAT_OA_DRAFT, &c->ServerIP)); - c->SendNatOaDraft1 = true; - - if (IsIP4(&nat_oa_draft1->Payload.NatOa.IpAddress) == IsIP4(&c->ServerIP)) - { - Copy(&c->TransportModeClientIP, &nat_oa_draft1->Payload.NatOa.IpAddress, sizeof(IP)); - Copy(&c->TransportModeServerIP, &c->ServerIP, sizeof(IP)); - - c->ShouldCalcChecksumForUDP = true; - } - } - - if (nat_oa_draft2 != NULL) - { - Add(payload_list, IkeNewNatOaPayload(IKE_PAYLOAD_NAT_OA_DRAFT_2, &c->ServerIP)); - c->SendNatOaDraft2 = true; - - if (IsIP4(&nat_oa_draft2->Payload.NatOa.IpAddress) == IsIP4(&c->ServerIP)) - { - Copy(&c->TransportModeClientIP, &nat_oa_draft2->Payload.NatOa.IpAddress, sizeof(IP)); - Copy(&c->TransportModeServerIP, &c->ServerIP, sizeof(IP)); - - c->ShouldCalcChecksumForUDP = true; - } - } - - if (nat_oa_rfc_0 != NULL && nat_oa_rfc_1 != NULL) - { - Add(payload_list, IkeNewNatOaPayload(IKE_PAYLOAD_NAT_OA, &c->ClientIP)); - Add(payload_list, IkeNewNatOaPayload(IKE_PAYLOAD_NAT_OA, &c->ServerIP)); - c->SendNatOaRfc = true; - - if (IsIP4(&nat_oa_rfc_0->Payload.NatOa.IpAddress) == IsIP4(&c->ServerIP)) - { - Copy(&c->TransportModeClientIP, &nat_oa_rfc_0->Payload.NatOa.IpAddress, sizeof(IP)); - Copy(&c->TransportModeServerIP, &c->ServerIP, sizeof(IP)); - - c->ShouldCalcChecksumForUDP = true; - } - } - } - - // Build a packet - ps = IkeNew(ike_sa->InitiatorCookie, ike_sa->ResponderCookie, IKE_EXCHANGE_TYPE_QUICK, - false, false, false, header->MessageId, payload_list); - - // Build a temporary packet - ps_buf = IkeBuild(ps, NULL); - - // Get the payload after the hash part - after_hash_offset = sizeof(IKE_HEADER) + send_hash_payload->BitArray->Size + sizeof(IKE_COMMON_HEADER); - after_hash_size = ((ps_buf->Size > after_hash_offset) ? (ps_buf->Size - after_hash_offset) : 0); - - ps_buf_after_hash = MemToBuf(((UCHAR *)ps_buf->Buf) + after_hash_offset, after_hash_size); - FreeBuf(ps_buf); - - // Calculate the hash #2 - tmp_buf = NewBuf(); - WriteBufInt(tmp_buf, header->MessageId); - WriteBufBuf(tmp_buf, initiator_rand); - WriteBufBuf(tmp_buf, ps_buf_after_hash); - IkeHMac(ike_sa->TransformSetting.Hash, hash2, ike_sa->SKEYID_a, ike_sa->HashSize, tmp_buf->Buf, tmp_buf->Size); - FreeBuf(tmp_buf); - - // Calculate the hash #3 - tmp_buf = NewBuf(); - WriteBuf(tmp_buf, &zero, 1); - WriteBufInt(tmp_buf, header->MessageId); - WriteBufBuf(tmp_buf, initiator_rand); - WriteBufBuf(tmp_buf, responder_rand); - IkeHMac(ike_sa->TransformSetting.Hash, hash3, ike_sa->SKEYID_a, ike_sa->HashSize, tmp_buf->Buf, tmp_buf->Size); - FreeBuf(tmp_buf); - - // Create an IPsec SA - ipsec_sa_c_s = NewIPsecSa(ike, c, ike_sa, false, header->MessageId, false, cp.NextIv, spi, - initiator_rand->Buf, initiator_rand->Size, responder_rand->Buf, responder_rand->Size, - &setting, shared_key, shared_key_size); - ipsec_sa_s_c = NewIPsecSa(ike, c, ike_sa, false, header->MessageId, true, cp.NextIv, setting.SpiServerToClient, - initiator_rand->Buf, initiator_rand->Size, responder_rand->Buf, responder_rand->Size, - &setting, shared_key, shared_key_size); - - ipsec_sa_c_s->PairIPsecSa = ipsec_sa_s_c; - ipsec_sa_s_c->PairIPsecSa = ipsec_sa_c_s; - - Insert(ike->IPsecSaList, ipsec_sa_c_s); - Insert(ike->IPsecSaList, ipsec_sa_s_c); - - Copy(ipsec_sa_c_s->Hash3, hash3, ike_sa->HashSize); - - // Overwrite hash #2 - Copy(send_hash_payload->Payload.Hash.Data->Buf, hash2, ike_sa->HashSize); - - // Packet reply - ps->FlagEncrypted = true; - IPsecSaSendPacket(ike, ipsec_sa_s_c, ps); - IkeSaSendPacket(ike, ike_sa, NULL); - -#ifdef RAW_DEBUG - IkeDebugUdpSendRawPacket(ps); -#endif // RAW_DEBUG - - IkeFree(ps); - Free(shared_key); - FreeBuf(ps_buf_after_hash); - FreeBuf(initiator_rand); - FreeBuf(responder_rand); - } - } - else - { - // No appropriate transform setting - Debug("No Appropriate Transform was Found.\n"); - - IPsecLog(ike, NULL, ike_sa, NULL, "LI_IPSEC_NO_TRANSFORM"); - - SendInformationalExchangePacket(ike, c, IkeNewNoticeErrorNoProposalChosenPayload(true, header->InitiatorCookie, header->ResponderCookie)); - } - } - } - else - { - Debug("QM-1: Hash 1 is invalid.\n"); - } - - FreeBuf(hash1_buf); - } - } - - IkeFree(pr); - } - } - else - { - // Get the IPsec SA - IPSECSA *ipsec_sa_cs = SearchIPsecSaByMessageId(ike, c, header->MessageId); - if (ipsec_sa_cs != NULL) - { - IPSECSA *ipsec_sa_sc = ipsec_sa_cs->PairIPsecSa; - if (ipsec_sa_sc != NULL) - { - if (ipsec_sa_sc->Established == false && ipsec_sa_cs->Established == false) - { - IKE_PACKET *pr = IPsecSaRecvPacket(ike, ipsec_sa_cs, p->Data, p->Size); - -#ifdef RAW_DEBUG - IkeDebugUdpSendRawPacket(pr); -#endif // RAW_DEBUG - - if (pr != NULL) - { - if (ipsec_sa_cs->Initiated == false) - { - // Initiator is client-side - // Check hash3 payload - IKE_PACKET_PAYLOAD *hash_payload = IkeGetPayload(pr->PayloadList, IKE_PAYLOAD_HASH, 0); - - if (hash_payload != NULL) - { - BUF *hash_buf = hash_payload->Payload.Hash.Data; - if (hash_buf != NULL) - { - if (hash_buf->Size == ipsec_sa_cs->IkeSa->HashSize) - { - if (Cmp(hash_buf->Buf, ipsec_sa_cs->Hash3, hash_buf->Size) == 0) - { - ipsec_sa_cs->Established = ipsec_sa_sc->Established = true; - ipsec_sa_cs->EstablishedTick = ipsec_sa_sc->EstablishedTick = ike->Now; - ipsec_sa_cs->LastCommTick = ipsec_sa_sc->LastCommTick = ike->Now; - - c->CurrentIpSecSaRecv = ipsec_sa_cs; - c->CurrentIpSecSaSend = ipsec_sa_sc; - - Debug("IPsec SA 0x%X & 0x%X Established.\n", - ipsec_sa_cs->Spi, - ipsec_sa_sc->Spi); - - IPsecLog(ike, NULL, NULL, ipsec_sa_sc, "LI_IPSEC_SA_ESTABLISHED"); - - IPsecSaSendPacket(ike, ipsec_sa_sc, NULL); - } - else - { - Debug("QM-3: Hash 3 is invalid.\n"); - } - } - } - } - } - else - { - // Initiator is server-side - // Get hash payload - IKE_PACKET_PAYLOAD *hash_payload; - - hash_payload = IkeGetPayload(pr->PayloadList, IKE_PAYLOAD_HASH, 0); - if (hash_payload != NULL && ipsec_sa_sc->InitiatorRand != NULL) - { - // Get the payload after the hash - UINT header_and_hash_size = sizeof(IKE_COMMON_HEADER) + hash_payload->BitArray->Size; - void *after_hash_data = ((UCHAR *)pr->DecryptedPayload->Buf) + header_and_hash_size; - if (pr->DecryptedPayload->Size > header_and_hash_size) - { - UINT after_hash_size = pr->DecryptedPayload->Size - header_and_hash_size; - UCHAR hash2[IKE_MAX_HASH_SIZE]; - BUF *hash2_buf; - - hash2_buf = NewBuf(); - WriteBufInt(hash2_buf, header->MessageId); - WriteBufBuf(hash2_buf, ipsec_sa_sc->InitiatorRand); - WriteBuf(hash2_buf, after_hash_data, after_hash_size); - - IkeHMac(ipsec_sa_sc->SKEYID_Hash, hash2, ipsec_sa_sc->SKEYID_a, ipsec_sa_sc->SKEYID_Hash->HashSize, - hash2_buf->Buf, hash2_buf->Size); - - FreeBuf(hash2_buf); - - // Compare the hash value - if (IkeCompareHash(hash_payload, hash2, ike_sa->HashSize)) - { - IKE_PACKET_PAYLOAD *sa_payload, *rand_payload, *key_payload, *id_payload_1, *id_payload_2; - - // Get the payload of other - sa_payload = IkeGetPayload(pr->PayloadList, IKE_PAYLOAD_SA, 0); - rand_payload = IkeGetPayload(pr->PayloadList, IKE_PAYLOAD_RAND, 0); - key_payload = IkeGetPayload(pr->PayloadList, IKE_PAYLOAD_KEY_EXCHANGE, 0); - id_payload_1 = IkeGetPayload(pr->PayloadList, IKE_PAYLOAD_ID, 0); - id_payload_2 = IkeGetPayload(pr->PayloadList, IKE_PAYLOAD_ID, 1); - - if (sa_payload != NULL && rand_payload != NULL) - { - IPSEC_SA_TRANSFORM_SETTING setting; - - // Interpret the SA payload - if (GetBestTransformSettingForIPsecSa(ike, pr, &setting, &p->DstIP)) - { - // Appropriate transform setting is selected - Debug("P2 Transform: %s %s %s(%u) %u %u\n", - (setting.Dh == NULL ? NULL : setting.Dh->Name), setting.Hash->Name, setting.Crypto->Name, setting.CryptoKeySize, - setting.LifeKilobytes, setting.LifeSeconds); - -#ifdef FORCE_LIFETIME_QM - setting.LifeSeconds = FORCE_LIFETIME_QM; -#endif // FORCE_LIFETIME_QM - - // Check the key exchange payload if the PFS is specified - if (setting.Dh == NULL || (setting.Dh != NULL && key_payload != NULL && ipsec_sa_sc->Dh != NULL && - key_payload->Payload.KeyExchange.Data->Size <= setting.Dh->KeySize)) - { - IKE_PACKET *ps; - LIST *payload_list; - IKE_PACKET_PAYLOAD *send_hash_payload; - IKE_PACKET_PAYLOAD *send_key_payload = NULL; - IKE_PACKET_PAYLOAD *send_id_1 = NULL, *send_id_2 = NULL; - DH_CTX *dh = NULL; - UINT shared_key_size = 0; - UCHAR *shared_key = NULL; - BUF *initiator_rand, *responder_rand; - BUF *tmp_buf; - UCHAR hash3[IKE_MAX_HASH_SIZE]; - char tmp[MAX_SIZE]; - UCHAR zero = 0; - - initiator_rand = ipsec_sa_sc->InitiatorRand; - responder_rand = CloneBuf(rand_payload->Payload.Rand.Data); - - if (setting.Dh != NULL) - { - // Calculate DH - DH_CTX *dh = ipsec_sa_sc->Dh; - - shared_key_size = (dh == NULL ? 0 : dh->Size); - shared_key = ZeroMalloc(shared_key_size); - - if (DhCompute(dh, shared_key, key_payload->Payload.KeyExchange.Data->Buf, key_payload->Payload.KeyExchange.Data->Size)) - { - // DH calculation success - Debug("P2 DH Ok.\n"); - } - else - { - // DH calculation failure - Debug("P2 DhCompute failed.\n"); - - shared_key = NULL; - Free(shared_key); - shared_key_size = 0; - - IPsecLog(ike, NULL, ike_sa, NULL, "LI_QM_DH_ERROR"); - } - } - - // Update the information of IPsec SA - if (shared_key != NULL) - { - ipsec_sa_sc->SharedKey = NewBuf(shared_key, shared_key_size); - ipsec_sa_cs->SharedKey = NewBuf(shared_key, shared_key_size); - } - - ipsec_sa_sc->Spi = setting.SpiServerToClient; - IPsecLog(ike, NULL, NULL, ipsec_sa_sc, "LI_IPSEC_SA_SPI_SET", ipsec_sa_sc->Spi); - ike->IPsecSaList->sorted = false; - - ipsec_sa_sc->ResponderRand = CloneBuf(responder_rand); - ipsec_sa_cs->ResponderRand = CloneBuf(responder_rand); - - Copy(&ipsec_sa_sc->TransformSetting, &setting, sizeof(IPSEC_SA_TRANSFORM_SETTING)); - Copy(&ipsec_sa_cs->TransformSetting, &setting, sizeof(IPSEC_SA_TRANSFORM_SETTING)); - - ipsec_sa_sc->Established = true; - ipsec_sa_cs->Established = true; - - IPsecLog(ike, NULL, NULL, ipsec_sa_sc, "LI_IPSEC_SA_ESTABLISHED"); - - ipsec_sa_sc->LastCommTick = ike->Now; - ipsec_sa_cs->LastCommTick = ike->Now; - - c->CurrentIpSecSaRecv = ipsec_sa_cs; - c->CurrentIpSecSaSend = ipsec_sa_sc; - - // Calculate the KEYMAT - IPsecCalcKeymat(ike, ipsec_sa_sc->SKEYID_Hash, ipsec_sa_sc->KeyMat, sizeof(ipsec_sa_sc->KeyMat), - ipsec_sa_sc->SKEYID_d, ipsec_sa_sc->SKEYID_Hash->HashSize, IKE_PROTOCOL_ID_IPSEC_ESP, - ipsec_sa_sc->Spi, initiator_rand->Buf, initiator_rand->Size, - responder_rand->Buf, responder_rand->Size, - shared_key, shared_key_size); - - IPsecCalcKeymat(ike, ipsec_sa_cs->SKEYID_Hash, ipsec_sa_cs->KeyMat, sizeof(ipsec_sa_cs->KeyMat), - ipsec_sa_cs->SKEYID_d, ipsec_sa_cs->SKEYID_Hash->HashSize, IKE_PROTOCOL_ID_IPSEC_ESP, - ipsec_sa_cs->Spi, initiator_rand->Buf, initiator_rand->Size, - responder_rand->Buf, responder_rand->Size, - shared_key, shared_key_size); - - IkeFreeKey(ipsec_sa_sc->CryptoKey); - IkeFreeKey(ipsec_sa_cs->CryptoKey); - - ipsec_sa_sc->CryptoKey = IkeNewKey(setting.Crypto, ipsec_sa_sc->KeyMat, setting.CryptoKeySize); - ipsec_sa_cs->CryptoKey = IkeNewKey(setting.Crypto, ipsec_sa_cs->KeyMat, setting.CryptoKeySize); - - Copy(ipsec_sa_sc->HashKey, ipsec_sa_sc->KeyMat + setting.CryptoKeySize, setting.Hash->HashSize); - Copy(ipsec_sa_cs->HashKey, ipsec_sa_cs->KeyMat + setting.CryptoKeySize, setting.Hash->HashSize); - - BinToStrEx(tmp, sizeof(tmp), ipsec_sa_sc->KeyMat, ipsec_sa_sc->TransformSetting.CryptoKeySize); - Debug(" KEYMAT (SC): %s\n", tmp); - - BinToStrEx(tmp, sizeof(tmp), ipsec_sa_cs->KeyMat, ipsec_sa_cs->TransformSetting.CryptoKeySize); - Debug(" KEYMAT (CS): %s\n", tmp); - - Debug("IPsec SA 0x%X & 0x%X Established (Server is Initiator).\n", - ipsec_sa_cs->Spi, - ipsec_sa_sc->Spi); - - // Calculate the hash #3 - tmp_buf = NewBuf(); - WriteBuf(tmp_buf, &zero, 1); - WriteBufInt(tmp_buf, header->MessageId); - WriteBufBuf(tmp_buf, initiator_rand); - WriteBufBuf(tmp_buf, responder_rand); - IkeHMac(ipsec_sa_cs->SKEYID_Hash, hash3, ipsec_sa_cs->SKEYID_a, ipsec_sa_cs->SKEYID_Hash->HashSize, tmp_buf->Buf, tmp_buf->Size); - FreeBuf(tmp_buf); - - // Return the hash #3 - send_hash_payload = IkeNewDataPayload(IKE_PAYLOAD_HASH, hash3, ipsec_sa_cs->SKEYID_Hash->HashSize); - - payload_list = NewListSingle(send_hash_payload); - ps = IkeNew(ike_sa->InitiatorCookie, ike_sa->ResponderCookie, - IKE_EXCHANGE_TYPE_QUICK, true, false, false, header->MessageId, payload_list); - - IPsecSaSendPacket(ike, ipsec_sa_sc, ps); -#ifdef RAW_DEBUG - IkeDebugUdpSendRawPacket(ps); -#endif // RAW_DEBUG - ipsec_sa_sc->NumResends = 3; - - if (false) - { - UINT i; - - for (i = 0;i < LIST_NUM(ike->IPsecSaList);i++) - { - IPSECSA *sa = LIST_DATA(ike->IPsecSaList, i); - - if (sa != ipsec_sa_sc && sa != ipsec_sa_cs) - { - MarkIPsecSaAsDeleted(ike, sa); - } - } - } - - IkeFree(ps); - - // Release the memory - FreeBuf(responder_rand); - } - } - else - { - // No appropriate transform setting - Debug("No Appropriate Transform was Found.\n"); - - IPsecLog(ike, NULL, ike_sa, NULL, "LI_IPSEC_NO_TRANSFORM"); - - SendInformationalExchangePacket(ike, c, IkeNewNoticeErrorNoProposalChosenPayload(true, header->InitiatorCookie, header->ResponderCookie)); - } - } - } - } - } - } - IkeFree(pr); - } - } - } - } - } - } -} - -// Calculate the KEYMAT -void IPsecCalcKeymat(IKE_SERVER *ike, IKE_HASH *h, void *dst, UINT dst_size, void *skeyid_d_data, UINT skeyid_d_size, UCHAR protocol, UINT spi, void *rand_init_data, UINT rand_init_size, - void *rand_resp_data, UINT rand_resp_size, void *df_key_data, UINT df_key_size) -{ - BUF *k; - BUF *ret; - // Validate arguments - if (ike == NULL || dst == NULL || h == NULL || rand_init_data == NULL || rand_resp_data == NULL|| - (df_key_size != 0 && df_key_data == NULL)) - { - return; - } - - ret = NewBuf(); - - k = NULL; - - while (true) - { - BUF *tmp = NewBuf(); - UCHAR hash[IKE_MAX_HASH_SIZE]; - - if (k != NULL) - { - WriteBufBuf(tmp, k); - } - - if (df_key_data != NULL) - { - WriteBuf(tmp, df_key_data, df_key_size); - } - - WriteBuf(tmp, &protocol, 1); - - WriteBufInt(tmp, spi); - - WriteBuf(tmp, rand_init_data, rand_init_size); - WriteBuf(tmp, rand_resp_data, rand_resp_size); - - if (k != NULL) - { - FreeBuf(k); - } - - IkeHMac(h, hash, skeyid_d_data, skeyid_d_size, tmp->Buf, tmp->Size); - - FreeBuf(tmp); - - k = MemToBuf(hash, h->HashSize); - - WriteBufBuf(ret, k); - - if (ret->Size >= dst_size) - { - break; - } - } - - Copy(dst, ret->Buf, dst_size); - - FreeBuf(ret); - FreeBuf(k); -} - -// Search for IPsec SA from Message ID -IPSECSA *SearchIPsecSaByMessageId(IKE_SERVER *ike, IKE_CLIENT *c, UINT message_id) -{ - UINT i; - // Validate arguments - if (ike == NULL || c == NULL || message_id == 0) - { - return NULL; - } - - for (i = 0;i < LIST_NUM(ike->IPsecSaList);i++) - { - IPSECSA *sa = LIST_DATA(ike->IPsecSaList, i); - - if (sa->IkeClient == c) - { - if (sa->MessageId == message_id) - { - if (sa->ServerToClient == false) - { - if (sa->Established == false) - { - return sa; - } - } - } - } - } - - return NULL; -} - -// Search for IPsec SA from SPI value -IPSECSA *SearchClientToServerIPsecSaBySpi(IKE_SERVER *ike, UINT spi) -{ - IPSECSA t; - // Validate arguments - if (ike == NULL || spi == 0) - { - return NULL; - } - - t.ServerToClient = false; - t.Spi = spi; - - return Search(ike->IPsecSaList, &t); -} -IPSECSA *SearchIPsecSaBySpi(IKE_SERVER *ike, IKE_CLIENT *c, UINT spi) -{ - UINT i; - // Validate arguments - if (ike == NULL || c == NULL || spi == 0) - { - return NULL; - } - - for (i = 0;i < LIST_NUM(ike->IPsecSaList);i++) - { - IPSECSA *sa = LIST_DATA(ike->IPsecSaList, i); - - if (sa->Spi == spi) - { - if (sa->IkeClient == c) - { - return sa; - } - } - } - - return NULL; -} - -// Search an IKE SA from the value of the Cookie -IKE_SA *SearchIkeSaByCookie(IKE_SERVER *ike, UINT64 init_cookie, UINT64 resp_cookie) -{ - UINT i; - // Validate arguments - if (ike == NULL) - { - return NULL; - } - - for (i = 0;i < LIST_NUM(ike->IkeSaList);i++) - { - IKE_SA *sa = LIST_DATA(ike->IkeSaList, i); - - if (sa->InitiatorCookie == init_cookie && sa->ResponderCookie == resp_cookie) - { - return sa; - } - } - - return NULL; -} - -// Generate the SPI value of new IPsec SA -UINT GenerateNewIPsecSaSpi(IKE_SERVER *ike, UINT counterpart_spi) -{ - UINT ret; - // Validate arguments - if (ike == NULL) - { - return 0; - } - - while (true) - { - ret = Rand32(); - - if (ret != counterpart_spi) - { - if (ret >= 4096 && ret != INFINITE) - { - if (SearchClientToServerIPsecSaBySpi(ike, ret) == NULL) - { - return ret; - } - } - } - } -} - -// Calculate the initial IV for Phase 2 -void IkeCalcPhase2InitialIv(void *iv, IKE_SA *sa, UINT message_id) -{ - BUF *b; - UCHAR hash[IKE_MAX_HASH_SIZE]; - // Validate arguments - if (iv == NULL || sa == NULL) - { - return; - } - - message_id = Endian32(message_id); - - b = NewBuf(); - WriteBuf(b, sa->Iv, sa->BlockSize); - WriteBuf(b, &message_id, sizeof(UINT)); - - IkeHash(sa->TransformSetting.Hash, hash, b->Buf, b->Size); - - Copy(iv, hash, sa->TransformSetting.Crypto->BlockSize); - - FreeBuf(b); -} - -// Create a new IPsec SA -IPSECSA *NewIPsecSa(IKE_SERVER *ike, IKE_CLIENT *c, IKE_SA *ike_sa, bool initiate, UINT message_id, bool server_to_client, void *iv, UINT spi, void *init_rand_data, UINT init_rand_size, void *res_rand_data, UINT res_rand_size, IPSEC_SA_TRANSFORM_SETTING *setting, void *shared_key_data, UINT shared_key_size) -{ - IPSECSA *sa; - char tmp[MAX_SIZE]; - UINT total_key_size; - // Validate arguments - if (ike == NULL || c == NULL || ike_sa == NULL || message_id == 0 || iv == NULL || setting == NULL || - (shared_key_data == NULL && shared_key_size != 0)) - { - return NULL; - } - - sa = ZeroMalloc(sizeof(IPSECSA)); - - if (server_to_client == false) - { - ike->CurrentIPsecSaId++; - } - sa->Id = ike->CurrentIPsecSaId; - - sa->IkeClient = c; - sa->IkeSa = ike_sa; - - sa->MessageId = message_id; - sa->FirstCommTick = ike->Now; - sa->LastCommTick = ike->Now; - sa->Initiated = initiate; - - sa->ServerToClient = server_to_client; - - sa->Spi = spi; - - sa->SKEYID_Hash = ike_sa->TransformSetting.Hash; - Copy(sa->SKEYID_a, ike_sa->SKEYID_a, sa->SKEYID_Hash->HashSize); - Copy(sa->SKEYID_d, ike_sa->SKEYID_d, sa->SKEYID_Hash->HashSize); - - sa->InitiatorRand = MemToBuf(init_rand_data, init_rand_size); - - if (initiate == false) - { - sa->ResponderRand = MemToBuf(res_rand_data, res_rand_size); - } - - Copy(sa->Iv, iv, ike_sa->BlockSize); - - Copy(&sa->TransformSetting, setting, sizeof(IPSEC_SA_TRANSFORM_SETTING)); - - if (shared_key_data != NULL) - { - sa->SharedKey = MemToBuf(shared_key_data, shared_key_size); - } - - total_key_size = sa->TransformSetting.CryptoKeySize + sa->TransformSetting.Hash->HashSize; - - if (initiate == false) - { - IPsecCalcKeymat(ike, ike_sa->TransformSetting.Hash, sa->KeyMat, total_key_size, - ike_sa->SKEYID_d, ike_sa->HashSize, IKE_PROTOCOL_ID_IPSEC_ESP, spi, sa->InitiatorRand->Buf, - sa->InitiatorRand->Size, sa->ResponderRand->Buf, sa->ResponderRand->Size, - shared_key_data, shared_key_size); - - sa->CryptoKey = IkeNewKey(sa->TransformSetting.Crypto, sa->KeyMat, sa->TransformSetting.CryptoKeySize); - - Copy(sa->HashKey, sa->KeyMat + sa->TransformSetting.CryptoKeySize, sa->TransformSetting.Hash->HashSize); - } - - Debug("New IPsec SA (StoC = %u): 0x%X 0x%X (%s %s %s(%u) %u %u)\n", - sa->ServerToClient, - sa->MessageId, - sa->Spi, - (setting->Dh == NULL ? NULL : setting->Dh->Name), setting->Hash->Name, setting->Crypto->Name, setting->CryptoKeySize, - setting->LifeKilobytes, setting->LifeSeconds); - - IPsecLog(ike, c, NULL, sa, "LI_NEW_IPSEC_SA", - (sa->ServerToClient ? _UU("LI_TAG_SERVER_TO_CLIENT") : _UU("LI_TAG_CLIENT_TO_SERVER")), - sa->Spi, - (setting->Dh == NULL ? NULL : setting->Dh->Name), setting->Hash->Name, setting->Crypto->Name, setting->CryptoKeySize * 8, - setting->LifeKilobytes, setting->LifeSeconds); - - Rand(sa->EspIv, sizeof(sa->EspIv)); - - if (initiate == false) - { - BinToStrEx(tmp, sizeof(tmp), sa->KeyMat, sa->TransformSetting.CryptoKeySize); - Debug(" KEYMAT: %s\n", tmp); - } - - // Set the expiration time - if (setting->LifeSeconds != 0) - { - const UINT64 span = (UINT64)((UINT64)setting->LifeSeconds * (UINT64)1000) + (UINT64)IKE_SOFT_EXPIRES_MARGIN; - sa->ExpiresHardTick = ike->Now + span; - sa->ExpiresSoftTick = ike->Now + span; - //sa->ExpiresSoftTick = ike->Now + (UINT64)5000; - - AddInterrupt(ike->Interrupts, sa->ExpiresSoftTick); - } - - return sa; -} - -// Treat aggressive mode packet reception -void ProcIkeAggressiveModePacketRecv(IKE_SERVER *ike, UDPPACKET *p, IKE_PACKET *header) -{ - IKE_CLIENT *c; - char tmp[MAX_SIZE]; - // Validate arguments - if (ike == NULL || p == NULL || header == NULL || header->InitiatorCookie == 0) - { - return; - } - - c = SearchOrCreateNewIkeClientForIkePacket(ike, &p->SrcIP, p->SrcPort, &p->DstIP, p->DestPort, header); - - if (c == NULL) - { - return; - } - - if (header->ResponderCookie == 0) - { - // Start process of the state 1 - IKE_CAPS caps; - IKE_SA *sa; - IKE_PACKET *pr = IkeParse(p->Data, p->Size, NULL); - - if (pr != NULL) - { - // Determine the CAPS - IkeCheckCaps(&caps, pr); - if (caps.MS_L2TPIPSecVPNClient || caps.MS_NT5_ISAKMP_OAKLEY || caps.MS_Vid_InitialContact) - { - c->IsMicrosoft = true; - } - - if ((caps.NatTraversalDraftIetf || caps.NatTraversalRfc3947) || (IsUdpPortOpened(ike->IPsec->UdpListener, &p->DstIP, IPSEC_PORT_IPSEC_ESP_RAW))) - { - sa = FindIkeSaByEndPointAndInitiatorCookie(ike, &p->DstIP, p->DestPort, &p->SrcIP, p->SrcPort, header->InitiatorCookie, IKE_SA_AGGRESSIVE_MODE); - - if (sa == NULL) - { - // Check whether there is acceptable SA parameters by analyzing proposed parameters - IKE_SA_TRANSFORM_SETTING setting; - - if (GetBestTransformSettingForIkeSa(ike, pr, &setting) && (GetNumberOfIkeSaOfIkeClient(ike, c) <= IKE_QUOTA_MAX_SA_PER_CLIENT)) - { - IKE_PACKET_PAYLOAD *tp; - IKE_PACKET_PAYLOAD *pp; - IKE_PACKET_PAYLOAD *sap; - IKE_PACKET_PAYLOAD *client_sa_payload; - IKE_PACKET_PAYLOAD *your_key_payload; - IKE_PACKET_PAYLOAD *your_rand_payload; - IKE_PACKET_PAYLOAD *your_id_payload = IkeGetPayload(pr->PayloadList, IKE_PAYLOAD_ID, 0); - - // Appropriate transform setting is selected - Debug("P1 Transform: %s %s %s(%u) %u %u\n", - setting.Dh->Name, setting.Hash->Name, setting.Crypto->Name, setting.CryptoKeySize, - setting.LifeKilobytes, setting.LifeSeconds); - - // Receive a key exchange packet - your_key_payload = IkeGetPayload(pr->PayloadList, IKE_PAYLOAD_KEY_EXCHANGE, 0); - your_rand_payload = IkeGetPayload(pr->PayloadList, IKE_PAYLOAD_RAND, 0); - if (your_key_payload != NULL && your_rand_payload != NULL && your_id_payload != NULL) - { - // Check the key payload - BUF *your_key_buf = your_key_payload->Payload.KeyExchange.Data; - BUF *your_rand_buf = your_rand_payload->Payload.Rand.Data; - - // DH generation - DH_CTX *dh = IkeDhNewCtx(setting.Dh); - UINT shared_key_size = (dh == NULL ? 0 : dh->Size); - UCHAR *shared_key = ZeroMalloc(shared_key_size); - - // DH calculation - if (DhCompute(dh, shared_key, your_key_buf->Buf, your_key_buf->Size)) - { - IKE_PACKET *ps; - LIST *payload_list; - IKE_PACKET_PAYLOAD *my_key_payload; - IKE_PACKET_PAYLOAD *my_rand_payload; - BUF *nat_buf1, *nat_buf2; - BUF *iv_buf; - UCHAR iv_hashed_data[IKE_MAX_HASH_SIZE]; - UCHAR initiator_hash[IKE_MAX_HASH_SIZE]; - BUF *b; - IKE_PACKET_PAYLOAD *my_id_payload, *my_hash_payload; - UCHAR responder_hash[IKE_MAX_HASH_SIZE]; - BUF *idir_b; - IKE_PACKET_PAYLOAD *your_nat_d_1 = NULL; - IKE_PACKET_PAYLOAD *your_nat_d_2 = NULL; - - // Create an IKE SA - sa = NewIkeSa(ike, c, header->InitiatorCookie, IKE_SA_AGGRESSIVE_MODE, &setting); - Copy(&sa->Caps, &caps, sizeof(IKE_CAPS)); - sa->State= IKE_SA_AM_STATE_1_SA; - Insert(ike->IkeSaList, sa); - - sa->HashSize = sa->TransformSetting.Hash->HashSize; - sa->KeySize = sa->TransformSetting.CryptoKeySize; - sa->BlockSize = sa->TransformSetting.Crypto->BlockSize; - - // Get the Caps additionally - if (sa->Caps.NatTraversalRfc3947) - { - sa->Caps.UsingNatTraversalRfc3947 = true; - - your_nat_d_1 = IkeGetPayload(pr->PayloadList, IKE_PAYLOAD_NAT_D, 0); - your_nat_d_2 = IkeGetPayload(pr->PayloadList, IKE_PAYLOAD_NAT_D, 1); - } - else if (sa->Caps.NatTraversalDraftIetf) - { - sa->Caps.UsingNatTraversalDraftIetf = true; - - your_nat_d_1 = IkeGetPayload(pr->PayloadList, IKE_PAYLOAD_NAT_D_DRAFT, 0); - your_nat_d_2 = IkeGetPayload(pr->PayloadList, IKE_PAYLOAD_NAT_D_DRAFT, 1); - } - - // Calculation success - sa->DhSharedKey = MemToBuf(shared_key, shared_key_size); - sa->InitiatorRand = RandBuf(IKE_SA_RAND_SIZE); - sa->ResponderRand = CloneBuf(your_rand_buf); - - // Save a bit array of SA payload presented by the client - client_sa_payload = IkeGetPayload(pr->PayloadList, IKE_PAYLOAD_SA, 0); - sa->SAi_b = CloneBuf(client_sa_payload->BitArray); - - // Save the ID payload presented by the client - sa->YourIDPayloadForAM = CloneBuf(your_id_payload->BitArray); - - //// Assemble the SA payload - // Construct transform payload - tp = TransformSettingToTransformPayloadForIke(ike, &setting); - - // Build a proposal payload - pp = IkeNewProposalPayload(1, IKE_PROTOCOL_ID_IKE, NULL, 0, NewListSingle(tp)); - - // Build the SA payload - sap = IkeNewSaPayload(NewListSingle(pp)); - - payload_list = NewListSingle(sap); - - // Send a key exchange packet - my_key_payload = IkeNewDataPayload(IKE_PAYLOAD_KEY_EXCHANGE, dh->MyPublicKey->Buf, dh->MyPublicKey->Size); - my_rand_payload = IkeNewDataPayload(IKE_PAYLOAD_RAND, sa->InitiatorRand->Buf, sa->InitiatorRand->Size); - - Add(payload_list, my_key_payload); - Add(payload_list, my_rand_payload); - - // NAT-D Packet - // Address of the opponent. Randomize in order to be forced to use NAT - nat_buf1 = IkeCalcNatDetectHash(ike, sa->TransformSetting.Hash, Rand64(), Rand64(), &c->ClientIP, Rand16()); - - // My address - if (c->IsMicrosoft == false || (your_nat_d_1 == NULL || your_nat_d_2 == NULL || your_nat_d_1->BitArray == NULL)) - { - // Calculate exactly - nat_buf2 = IkeCalcNatDetectHash(ike, sa->TransformSetting.Hash, - sa->InitiatorCookie, sa->ResponderCookie, &c->ServerIP, c->ServerPort); - } - else - { - // Parrot the NAT_D payload indicating myself I got from - // the other if it has connected from a Microsoft VPN Client - nat_buf2 = CloneBuf(your_nat_d_1->BitArray); - } - - // Save DH information - sa->GXi = CloneBuf(your_key_buf); - sa->GXr = CloneBuf(dh->MyPublicKey); - - // Calculate the key set - IkeCalcSaKeySet(ike, sa, NULL); - - // Calculate the initiator side hash value - b = NewBuf(); - WriteBufBuf(b, sa->GXi); - WriteBufBuf(b, sa->GXr); - WriteBufInt64(b, sa->InitiatorCookie); - WriteBufInt64(b, sa->ResponderCookie); - WriteBufBuf(b, sa->SAi_b); - WriteBufBuf(b, sa->YourIDPayloadForAM); - - IkeHMac(sa->TransformSetting.Hash, initiator_hash, sa->SKEYID, sa->HashSize, - b->Buf, b->Size); - - FreeBuf(b); - - Copy(sa->InitiatorHashForAM, initiator_hash, sa->HashSize); - - // Prepare the response ID payload - // Generate the ID payload - if (IsIP6(&sa->IkeClient->ServerIP)) - { - // IPv6 address - my_id_payload = IkeNewIdPayload(IKE_ID_IPV6_ADDR, 0, 0, sa->IkeClient->ServerIP.ipv6_addr, 16); - } - else - { - // IPv4 address - my_id_payload = IkeNewIdPayload(IKE_ID_IPV4_ADDR, 0, 0, sa->IkeClient->ServerIP.addr, 4); - } - - // Build the ID payload tentatively - idir_b = IkeBuildIdPayload(&my_id_payload->Payload.Id); - - b = NewBuf(); - WriteBufBuf(b, sa->GXr); - WriteBufBuf(b, sa->GXi); - WriteBufInt64(b, sa->ResponderCookie); - WriteBufInt64(b, sa->InitiatorCookie); - WriteBufBuf(b, sa->SAi_b); - WriteBufBuf(b, idir_b); - - IkeHMac(sa->TransformSetting.Hash, responder_hash, sa->SKEYID, sa->HashSize, - b->Buf, b->Size); - - FreeBuf(b); - FreeBuf(idir_b); - - my_hash_payload = IkeNewDataPayload(IKE_PAYLOAD_HASH, responder_hash, sa->HashSize); - - Add(payload_list, my_id_payload); - Add(payload_list, my_hash_payload); - - ps = IkeNew(sa->InitiatorCookie, sa->ResponderCookie, IKE_EXCHANGE_TYPE_AGGRESSIVE, - false, false, false, 0, payload_list); - - // Add the vendor ID - IkeAddVendorIdPayloads(ps); - - // NAT-D related - if (sa->Caps.UsingNatTraversalRfc3947) - { - // RFC-compliant - Add(payload_list, IkeNewDataPayload(IKE_PAYLOAD_NAT_D, nat_buf1->Buf, nat_buf1->Size)); - Add(payload_list, IkeNewDataPayload(IKE_PAYLOAD_NAT_D, nat_buf2->Buf, nat_buf2->Size)); - } - - if (sa->Caps.UsingNatTraversalDraftIetf) - { - // Draft compliant - Add(payload_list, IkeNewDataPayload(IKE_PAYLOAD_NAT_D_DRAFT, nat_buf1->Buf, nat_buf1->Size)); - Add(payload_list, IkeNewDataPayload(IKE_PAYLOAD_NAT_D_DRAFT, nat_buf2->Buf, nat_buf2->Size)); - } - - FreeBuf(nat_buf1); - FreeBuf(nat_buf2); - - StrCpy(c->ClientId, sizeof(c->ClientId), your_id_payload->Payload.Id.StrData); - Debug("Client ID = %s\n", c->ClientId); - - IPsecLog(ike, c, NULL, NULL, NULL, "LI_SET_CLIENT_ID", c->ClientId); - - // Initial IV setting - iv_buf = NewBuf(); - WriteBuf(iv_buf, your_key_buf->Buf, your_key_buf->Size); - WriteBuf(iv_buf, dh->MyPublicKey->Buf, dh->MyPublicKey->Size); - IkeHash(sa->TransformSetting.Hash, iv_hashed_data, iv_buf->Buf, iv_buf->Size); - - BinToStrEx(tmp, sizeof(tmp), iv_hashed_data, sa->BlockSize); - Debug("Initial IV: %s\n", tmp); - - IkeSaUpdateIv(sa, iv_hashed_data, sa->HashSize); - - FreeBuf(iv_buf); - - // Transmission - IkeSaSendPacket(ike, sa, ps); - - IkeFree(ps); - } - else - { - // DH calculation failure - Debug("DhCompute failed.\n"); - } - - Free(shared_key); - DhFree(dh); - } - } - else - { - // No appropriate transform setting - Debug("No Appropriate Transform was Found.\n"); - - IPsecLog(ike, c, NULL, NULL, "LI_IKE_NO_TRANSFORM"); - - SendInformationalExchangePacket(ike, c, IkeNewNoticeErrorNoProposalChosenPayload(false, header->InitiatorCookie, header->ResponderCookie)); - } - } - } - else - { - // Client does not support NAT Traversal - Debug("Client doesn't support NAT-T.\n"); - - IPsecLog(ike, c, NULL, NULL, "LI_IKE_NO_NAT_T"); - } - - IkeFree(pr); - } - } - else - { - // Process of state 2 - IKE_SA *sa; - - sa = FindIkeSaByResponderCookieAndClient(ike, header->ResponderCookie, c); - - if (sa == NULL) - { - SendInformationalExchangePacketEx(ike, c, IkeNewNoticeErrorInvalidCookiePayload(header->InitiatorCookie, - header->ResponderCookie), true, header->InitiatorCookie, header->ResponderCookie); - } - - if (sa != NULL && sa->Mode == IKE_SA_AGGRESSIVE_MODE) - { - IKE_PACKET *pr = NULL; - - sa->LastCommTick = ike->Now; - - switch (sa->State) - { - case IKE_SA_AM_STATE_1_SA: - pr = IkeSaRecvPacket(ike, sa, p->Data, p->Size); - if (pr != NULL) - { - IKE_PACKET_PAYLOAD *your_hash_payload = IkeGetPayload(pr->PayloadList, IKE_PAYLOAD_HASH, 0); - - if (your_hash_payload != NULL) - { - // Compare the hash - if (IkeCompareHash(your_hash_payload, sa->InitiatorHashForAM, sa->HashSize)) - { - // Transit to the established state - Debug("IKE SA 0x%X Established.\n", sa); - sa->State = IKE_SA_AM_STATE_2_ESTABLISHED; - sa->EstablishedTick = ike->Now; - sa->Established = true; - c->CurrentIkeSa = sa; - c->NextDpdSendTick = ike->Now + (UINT64)IKE_INTERVAL_DPD_KEEPALIVE; - StrCpy(c->Secret, sizeof(c->Secret), sa->Secret); - - IPsecLog(ike, NULL, sa, NULL, "LI_IKE_SA_ESTABLISHED"); - - IkeSaSendPacket(ike, sa, NULL); - } - else - { - Debug("IKE SA 0x%X Invalid Hash.\n", sa); - } - } - } - break; - } - - if (pr != NULL) - { - IkeFree(pr); - } - } - } -} - -// Process of the main mode packet reception -void ProcIkeMainModePacketRecv(IKE_SERVER *ike, UDPPACKET *p, IKE_PACKET *header) -{ - IKE_CLIENT *c; - char tmp[MAX_SIZE]; - // Validate arguments - if (ike == NULL || p == NULL || header == NULL || header->InitiatorCookie == 0) - { - return; - } - - c = SearchOrCreateNewIkeClientForIkePacket(ike, &p->SrcIP, p->SrcPort, &p->DstIP, p->DestPort, header); - - if (c == NULL) - { - return; - } - - if (header->ResponderCookie == 0) - { - // Start process of the state 1 - IKE_CAPS caps; - IKE_SA *sa; - IKE_PACKET *pr = IkeParse(p->Data, p->Size, NULL); - - if (pr != NULL) - { - // Determine the CAPS - IkeCheckCaps(&caps, pr); - if (caps.MS_L2TPIPSecVPNClient || caps.MS_NT5_ISAKMP_OAKLEY || caps.MS_Vid_InitialContact) - { - c->IsMicrosoft = true; - } - - if ((caps.NatTraversalDraftIetf || caps.NatTraversalRfc3947) || (IsUdpPortOpened(ike->IPsec->UdpListener, &p->DstIP, IPSEC_PORT_IPSEC_ESP_RAW))) - { - sa = FindIkeSaByEndPointAndInitiatorCookie(ike, &p->DstIP, p->DestPort, &p->SrcIP, p->SrcPort, header->InitiatorCookie, IKE_SA_MAIN_MODE); - - if (sa == NULL) - { - // Check whether there is acceptable SA parameters by analyzing proposed parameters - IKE_SA_TRANSFORM_SETTING setting; - - if (GetBestTransformSettingForIkeSa(ike, pr, &setting) && (GetNumberOfIkeSaOfIkeClient(ike, c) <= IKE_QUOTA_MAX_SA_PER_CLIENT)) - { - IKE_PACKET *ps; - IKE_PACKET_PAYLOAD *tp; - IKE_PACKET_PAYLOAD *pp; - IKE_PACKET_PAYLOAD *sap; - LIST *payload_list; - IKE_PACKET_PAYLOAD *client_sa_payload; - - // Appropriate transform setting is selected - Debug("P1 Transform: %s %s %s(%u) %u %u\n", - setting.Dh->Name, setting.Hash->Name, setting.Crypto->Name, setting.CryptoKeySize, - setting.LifeKilobytes, setting.LifeSeconds); - -#ifdef FORCE_LIFETIME_MM - setting.LifeSeconds = FORCE_LIFETIME_MM; -#endif // FORCE_LIFETIME_MM - - // Create an IKE SA - sa = NewIkeSa(ike, c, header->InitiatorCookie, IKE_SA_MAIN_MODE, &setting); - - Copy(&sa->Caps, &caps, sizeof(IKE_CAPS)); - - Insert(ike->IkeSaList, sa); - - // Answer the SA parameter selection results - sa->State = IKE_SA_MM_STATE_1_SA; - - // Save a bit array of SA payload presented by the client - client_sa_payload = IkeGetPayload(pr->PayloadList, IKE_PAYLOAD_SA, 0); - sa->SAi_b = CloneBuf(client_sa_payload->BitArray); - - //// Assemble the SA payload - // Construct a transform payload - tp = TransformSettingToTransformPayloadForIke(ike, &setting); - - // Build a proposal payload - pp = IkeNewProposalPayload(1, IKE_PROTOCOL_ID_IKE, NULL, 0, NewListSingle(tp)); - - // Build a SA payload - sap = IkeNewSaPayload(NewListSingle(pp)); - - payload_list = NewListSingle(sap); - - ps = IkeNew(sa->InitiatorCookie, sa->ResponderCookie, IKE_EXCHANGE_TYPE_MAIN, - false, false, false, 0, payload_list); - - // Add the vendor ID payload - IkeAddVendorIdPayloads(ps); - - IkeSaSendPacket(ike, sa, ps); - - sa->HashSize = sa->TransformSetting.Hash->HashSize; - sa->KeySize = sa->TransformSetting.CryptoKeySize; - sa->BlockSize = sa->TransformSetting.Crypto->BlockSize; - - IkeFree(ps); - } - else - { - // No appropriate transform setting - Debug("No Appropriate Transform was Found.\n"); - - IPsecLog(ike, c, NULL, NULL, "LI_IKE_NO_TRANSFORM"); - - SendInformationalExchangePacket(ike, c, IkeNewNoticeErrorNoProposalChosenPayload(false, header->InitiatorCookie, header->ResponderCookie)); - } - } - else - { - // Ignore for IKE SA which already exists (Because it's likely to be a re-transmission) - } - } - else - { - // It does not support NAT Traversal - Debug("Client doesn't support NAT-T.\n"); - - IPsecLog(ike, c, NULL, NULL, "LI_IKE_NO_NAT_T"); - } - IkeFree(pr); - } - } - else - { - // Process of state 2 or later - IKE_SA *sa; - - sa = FindIkeSaByResponderCookieAndClient(ike, header->ResponderCookie, c); - - if (sa == NULL) - { - SendInformationalExchangePacketEx(ike, c, IkeNewNoticeErrorInvalidCookiePayload(header->InitiatorCookie, - header->ResponderCookie), true, header->InitiatorCookie, header->ResponderCookie); - } - - if (sa != NULL && sa->Mode == IKE_SA_MAIN_MODE) - { - IKE_PACKET *pr = NULL; - - sa->LastCommTick = ike->Now; - - switch (sa->State) - { - case IKE_SA_MM_STATE_1_SA: - pr = IkeSaRecvPacket(ike, sa, p->Data, p->Size); - if (pr != NULL) - { - // Receive a key exchange packet - IKE_PACKET_PAYLOAD *your_key_payload; - IKE_PACKET_PAYLOAD *your_rand_payload; - IKE_PACKET_PAYLOAD *your_nat_d_1 = NULL; - IKE_PACKET_PAYLOAD *your_nat_d_2 = NULL; - - your_key_payload = IkeGetPayload(pr->PayloadList, IKE_PAYLOAD_KEY_EXCHANGE, 0); - your_rand_payload = IkeGetPayload(pr->PayloadList, IKE_PAYLOAD_RAND, 0); - - if (IkeGetPayloadNum(pr->PayloadList, IKE_PAYLOAD_NAT_D) != 0) - { - sa->Caps.UsingNatTraversalRfc3947 = true; - - your_nat_d_1 = IkeGetPayload(pr->PayloadList, IKE_PAYLOAD_NAT_D, 0); - your_nat_d_2 = IkeGetPayload(pr->PayloadList, IKE_PAYLOAD_NAT_D, 1); - } - - if (IkeGetPayloadNum(pr->PayloadList, IKE_PAYLOAD_NAT_D_DRAFT) != 0) - { - sa->Caps.UsingNatTraversalDraftIetf = true; - - your_nat_d_1 = IkeGetPayload(pr->PayloadList, IKE_PAYLOAD_NAT_D_DRAFT, 0); - your_nat_d_2 = IkeGetPayload(pr->PayloadList, IKE_PAYLOAD_NAT_D_DRAFT, 1); - } - - if (your_key_payload != NULL && your_rand_payload != NULL) - { - // Check the key payload - BUF *your_key_buf = your_key_payload->Payload.KeyExchange.Data; - BUF *your_rand_buf = your_rand_payload->Payload.Rand.Data; - - // DH generation - DH_CTX *dh = IkeDhNewCtx(sa->TransformSetting.Dh); - UINT shared_key_size = (dh == NULL ? 0 : dh->Size); - UCHAR *shared_key = ZeroMalloc(shared_key_size); - - // DH calculation - if (DhCompute(dh, shared_key, your_key_buf->Buf, your_key_buf->Size)) - { - IKE_PACKET *ps; - LIST *payload_list; - IKE_PACKET_PAYLOAD *my_key_payload; - IKE_PACKET_PAYLOAD *my_rand_payload; - BUF *nat_buf1, *nat_buf2; - BUF *iv_buf; - UCHAR iv_hashed_data[IKE_MAX_HASH_SIZE]; - - // Calculation success - sa->DhSharedKey = MemToBuf(shared_key, shared_key_size); - sa->InitiatorRand = RandBuf(IKE_SA_RAND_SIZE); - sa->ResponderRand = CloneBuf(your_rand_buf); - - // Send a key exchange packet - my_key_payload = IkeNewDataPayload(IKE_PAYLOAD_KEY_EXCHANGE, dh->MyPublicKey->Buf, dh->MyPublicKey->Size); - my_rand_payload = IkeNewDataPayload(IKE_PAYLOAD_RAND, sa->InitiatorRand->Buf, sa->InitiatorRand->Size); - - payload_list = NewListSingle(my_key_payload); - Add(payload_list, my_rand_payload); - - // NAT-D packet - // Address of the opponent. Randomize in order to be forced to use NAT - nat_buf1 = IkeCalcNatDetectHash(ike, sa->TransformSetting.Hash, Rand64(), Rand64(), &c->ClientIP, Rand16()); - //nat_buf1 = IkeCalcNatDetectHash(ike, sa->TransformSetting.Hash, sa->InitiatorCookie, sa->ResponderCookie, &c->ClientIP, c->ClientPort); - // My address - - if (c->IsMicrosoft == false || (your_nat_d_1 == NULL || your_nat_d_2 == NULL || your_nat_d_1->BitArray == NULL)) - { - // Calculate exactly - nat_buf2 = IkeCalcNatDetectHash(ike, sa->TransformSetting.Hash, - sa->InitiatorCookie, sa->ResponderCookie, &c->ServerIP, c->ServerPort); - } - else - { - // Parrot the NAT_D payload indicating myself I got from - // the other if it has connected from a Microsoft VPN Client - nat_buf2 = CloneBuf(your_nat_d_1->BitArray); - } - - if (sa->Caps.UsingNatTraversalRfc3947) - { - // RFC-compliant - Add(payload_list, IkeNewDataPayload(IKE_PAYLOAD_NAT_D, nat_buf1->Buf, nat_buf1->Size)); - Add(payload_list, IkeNewDataPayload(IKE_PAYLOAD_NAT_D, nat_buf2->Buf, nat_buf2->Size)); - } - - if (sa->Caps.UsingNatTraversalDraftIetf) - { - // Draft compliant - Add(payload_list, IkeNewDataPayload(IKE_PAYLOAD_NAT_D_DRAFT, nat_buf1->Buf, nat_buf1->Size)); - Add(payload_list, IkeNewDataPayload(IKE_PAYLOAD_NAT_D_DRAFT, nat_buf2->Buf, nat_buf2->Size)); - } - - FreeBuf(nat_buf1); - FreeBuf(nat_buf2); - - ps = IkeNew(sa->InitiatorCookie, sa->ResponderCookie, IKE_EXCHANGE_TYPE_MAIN, - false, false, false, 0, payload_list); - - // Initial IV setting - iv_buf = NewBuf(); - WriteBuf(iv_buf, your_key_buf->Buf, your_key_buf->Size); - WriteBuf(iv_buf, dh->MyPublicKey->Buf, dh->MyPublicKey->Size); - IkeHash(sa->TransformSetting.Hash, iv_hashed_data, iv_buf->Buf, iv_buf->Size); - - BinToStrEx(tmp, sizeof(tmp), iv_hashed_data, sa->BlockSize); - Debug("Initial IV: %s\n", tmp); - - IkeSaUpdateIv(sa, iv_hashed_data, sa->HashSize); - - FreeBuf(iv_buf); - - // Save the DH information - sa->GXi = CloneBuf(your_key_buf); - sa->GXr = CloneBuf(dh->MyPublicKey); - - // Transmission - IkeSaSendPacket(ike, sa, ps); - - IkeFree(ps); - - // Calculate the key set - IkeCalcSaKeySet(ike, sa, NULL); - - sa->State = IKE_SA_MM_STATE_2_KEY; - } - else - { - // DH calculation failure - Debug("DhCompute failed.\n"); - } - - Free(shared_key); - DhFree(dh); - } - } - break; - - case IKE_SA_MM_STATE_2_KEY: - pr = IkeSaRecvPacket(ike, sa, p->Data, p->Size); - if (pr != NULL && pr->FlagEncrypted) - { - // Receive an ID exchange packet - IKE_PACKET_PAYLOAD *your_id_payload = IkeGetPayload(pr->PayloadList, IKE_PAYLOAD_ID, 0); - IKE_PACKET_PAYLOAD *your_hash_payload = IkeGetPayload(pr->PayloadList, IKE_PAYLOAD_HASH, 0); - - if (your_id_payload && your_hash_payload) - { - UCHAR initiator_hash[IKE_MAX_HASH_SIZE]; - BUF *b; - - // Calculate the initiator side hash value - b = NewBuf(); - WriteBufBuf(b, sa->GXi); - WriteBufBuf(b, sa->GXr); - WriteBufInt64(b, sa->InitiatorCookie); - WriteBufInt64(b, sa->ResponderCookie); - WriteBufBuf(b, sa->SAi_b); - WriteBufBuf(b, your_id_payload->BitArray); - - StrCpy(c->ClientId, sizeof(c->ClientId), your_id_payload->Payload.Id.StrData); - Debug("Client ID = %s\n", c->ClientId); - IPsecLog(ike, c, NULL, NULL, NULL, "LI_SET_CLIENT_ID", c->ClientId); - - IkeHMac(sa->TransformSetting.Hash, initiator_hash, sa->SKEYID, sa->HashSize, - b->Buf, b->Size); - - FreeBuf(b); - - // Hash comparison - if (IkeCompareHash(your_hash_payload, initiator_hash, sa->HashSize)) - { - // Generate a response packet - IKE_PACKET *ps; - LIST *payload_list = NewListFast(NULL); - IKE_PACKET_PAYLOAD *my_id_payload, *my_hash_payload; - UCHAR responder_hash[IKE_MAX_HASH_SIZE]; - BUF *idir_b; - - // Generate an ID payload - if (IsIP6(&sa->IkeClient->ServerIP)) - { - // IPv6 address - my_id_payload = IkeNewIdPayload(IKE_ID_IPV6_ADDR, 0, 0, sa->IkeClient->ServerIP.ipv6_addr, 16); - } - else - { - // IPv4 address - my_id_payload = IkeNewIdPayload(IKE_ID_IPV4_ADDR, 0, 0, sa->IkeClient->ServerIP.addr, 4); - } - - // Build the ID payload tentatively - idir_b = IkeBuildIdPayload(&my_id_payload->Payload.Id); - - // Generate the hash payload - b = NewBuf(); - WriteBufBuf(b, sa->GXr); - WriteBufBuf(b, sa->GXi); - WriteBufInt64(b, sa->ResponderCookie); - WriteBufInt64(b, sa->InitiatorCookie); - WriteBufBuf(b, sa->SAi_b); - WriteBufBuf(b, idir_b); - - IkeHMac(sa->TransformSetting.Hash, responder_hash, sa->SKEYID, sa->HashSize, - b->Buf, b->Size); - - FreeBuf(b); - FreeBuf(idir_b); - - my_hash_payload = IkeNewDataPayload(IKE_PAYLOAD_HASH, responder_hash, sa->HashSize); - - Add(payload_list, my_id_payload); - Add(payload_list, my_hash_payload); - - ps = IkeNew(sa->InitiatorCookie, sa->ResponderCookie, IKE_EXCHANGE_TYPE_MAIN, true, false, - false, 0, payload_list); - - // Transmission - IkeSaSendPacket(ike, sa, ps); - sa->NumResends = 3; - - IkeFree(ps); - - StrCpy(c->ClientId, sizeof(c->ClientId), your_id_payload->Payload.Id.StrData); - - // Transit to the established state - Debug("IKE SA 0x%X Established. Client ID=%s\n", sa, c->ClientId); - sa->State = IKE_SA_MM_STATE_3_ESTABLISHED; - sa->EstablishedTick = ike->Now; - c->CurrentIkeSa = sa; - c->NextDpdSendTick = ike->Now + (UINT64)IKE_INTERVAL_DPD_KEEPALIVE; - StrCpy(c->Secret, sizeof(c->Secret), sa->Secret); - sa->Established = true; - - IPsecLog(ike, NULL, sa, NULL, "LI_IKE_SA_ESTABLISHED"); - } - else - { - Debug("IKE SA 0x%X Invalid Hash.\n", sa); - } - } - } - break; - } - - if (pr != NULL) - { - IkeFree(pr); - } - } - } -} - -// Update the IV of IPsec SA -void IPsecSaUpdateIv(IPSECSA *sa, void *iv, UINT iv_size) -{ - // Validate arguments - if (sa == NULL || iv == NULL) - { - return; - } - - Copy(sa->Iv, iv, MIN(sa->IkeSa->BlockSize, iv_size)); - - if (iv_size < sa->IkeSa->BlockSize) - { - Zero(sa->Iv + sa->IkeSa->BlockSize, sa->IkeSa->BlockSize - iv_size); - } - - sa->IsIvExisting = true; -} - -// Update the IV of the IKE SA -void IkeSaUpdateIv(IKE_SA *sa, void *iv, UINT iv_size) -{ - // Validate arguments - if (sa == NULL || iv == NULL) - { - return; - } - - Copy(sa->Iv, iv, MIN(sa->BlockSize, iv_size)); - - if (iv_size < sa->BlockSize) - { - Zero(sa->Iv + sa->BlockSize, sa->BlockSize - iv_size); - } - - sa->IsIvExisting = true; -} - -// Calculate the key set of the IKE SA -void IkeCalcSaKeySet(IKE_SERVER *ike, IKE_SA *sa, char *secret) -{ - BUF *secret_buf; - BUF *rand_buf; - BUF *d_buf, *a_buf, *e_buf; - UCHAR u; - IKE_HASH *h; - char tmp[MAX_SIZE]; - // Validate arguments - if (ike == NULL || sa == NULL) - { - return; - } - - h = sa->TransformSetting.Hash; - - // Calculation of SKEYID - StrCpy(sa->Secret, sizeof(sa->Secret), secret == NULL ? ike->Secret : secret); - secret_buf = IkeStrToPassword(sa->Secret); - rand_buf = CloneBuf(sa->ResponderRand); - SeekBufToEnd(rand_buf); - BinToStrEx(tmp, sizeof(tmp), rand_buf->Buf, rand_buf->Size); - Debug("ResponderRand: %s\n", tmp); - BinToStrEx(tmp, sizeof(tmp), sa->InitiatorRand->Buf, sa->InitiatorRand->Size); - Debug("InitiatorRand: %s\n", tmp); - - WriteBufBuf(rand_buf, sa->InitiatorRand); - - IkeHMacBuf(h, sa->SKEYID, secret_buf, rand_buf); - - BinToStrEx(tmp, sizeof(tmp), sa->SKEYID, sa->HashSize); - Debug("SKEYID: %s\n", tmp); - - // SKEYID_d - d_buf = CloneBuf(sa->DhSharedKey); - SeekBufToEnd(d_buf); - WriteBufInt64(d_buf, sa->InitiatorCookie); - WriteBufInt64(d_buf, sa->ResponderCookie); - u = 0; - WriteBuf(d_buf, &u, 1); - IkeHMac(h, sa->SKEYID_d, sa->SKEYID, sa->HashSize, d_buf->Buf, d_buf->Size); - - BinToStrEx(tmp, sizeof(tmp), sa->SKEYID_d, sa->HashSize); - Debug("SKEYID_d: %s\n", tmp); - - // SKEYID_a - a_buf = MemToBuf(sa->SKEYID_d, sa->HashSize); - SeekBufToEnd(a_buf); - WriteBufBuf(a_buf, sa->DhSharedKey); - WriteBufInt64(a_buf, sa->InitiatorCookie); - WriteBufInt64(a_buf, sa->ResponderCookie); - u = 1; - WriteBuf(a_buf, &u, 1); - IkeHMac(h, sa->SKEYID_a, sa->SKEYID, sa->HashSize, a_buf->Buf, a_buf->Size); - - BinToStrEx(tmp, sizeof(tmp), sa->SKEYID_a, sa->HashSize); - Debug("SKEYID_a: %s\n", tmp); - - // SKEYID_e - e_buf = MemToBuf(sa->SKEYID_a, sa->HashSize); - SeekBufToEnd(e_buf); - WriteBufBuf(e_buf, sa->DhSharedKey); - WriteBufInt64(e_buf, sa->InitiatorCookie); - WriteBufInt64(e_buf, sa->ResponderCookie); - u = 2; - WriteBuf(e_buf, &u, 1); - IkeHMac(h, sa->SKEYID_e, sa->SKEYID, sa->HashSize, e_buf->Buf, e_buf->Size); - - BinToStrEx(tmp, sizeof(tmp), sa->SKEYID_e, sa->HashSize); - Debug("SKEYID_e: %s\n", tmp); - - if (sa->CryptoKey != NULL) - { - IkeFreeKey(sa->CryptoKey); - } - - sa->CryptoKey = IkeNewCryptoKeyFromK(ike, sa->SKEYID_e, sa->HashSize, sa->TransformSetting.Hash, - sa->TransformSetting.Crypto, sa->TransformSetting.CryptoKeySize); - - // Release the memory - FreeBuf(secret_buf); - FreeBuf(rand_buf); - FreeBuf(d_buf); - FreeBuf(a_buf); - FreeBuf(e_buf); -} - -// Extend the key size -BUF *IkeExpandKeySize(IKE_HASH *h, void *k, UINT k_size, UINT target_size) -{ - BUF *b1, *b2; - UCHAR tmp[IKE_MAX_HASH_SIZE]; - UINT tmp_size; - // Validate arguments - if (h == NULL || k == NULL || k_size == 0) - { - return NULL; - } - - if (k_size >= target_size) - { - return MemToBuf(k, target_size); - } - - tmp[0] = 0; - tmp_size = 1; - b1 = NewBuf(); - - do - { - IkeHMac(h, tmp, k, k_size, tmp, tmp_size); - WriteBuf(b1, tmp, h->HashSize); - - tmp_size = h->HashSize; - } - while (b1->Size < target_size); - - b2 = MemToBuf(b1->Buf, target_size); - - FreeBuf(b1); - - return b2; -} - -// Generate a key from K -IKE_CRYPTO_KEY *IkeNewCryptoKeyFromK(IKE_SERVER *ike, void *k, UINT k_size, IKE_HASH *h, IKE_CRYPTO *c, UINT crypto_key_size) -{ - BUF *key_buf; - IKE_CRYPTO_KEY *ret; - // Validate arguments - if (ike == NULL || k == NULL || k_size == 0 || h == NULL || c == NULL || crypto_key_size == 0) - { - return NULL; - } - - key_buf = IkeExpandKeySize(h, k, k_size, crypto_key_size); - if (key_buf == NULL) - { - return NULL; - } - - ret = IkeNewKey(c, key_buf->Buf, key_buf->Size); - - FreeBuf(key_buf); - - return ret; -} - -// Generate a hash for NAT detection -BUF *IkeCalcNatDetectHash(IKE_SERVER *ike, IKE_HASH *hash, UINT64 initiator_cookie, UINT64 responder_cookie, IP *ip, UINT port) -{ - BUF *b; - USHORT us; - USHORT hash_data[IKE_MAX_HASH_SIZE]; - // Validate arguments - if (ike == NULL || ip == NULL || hash == NULL) - { - return NewBuf(); - } - - b = NewBuf(); - - WriteBufInt64(b, initiator_cookie); - WriteBufInt64(b, responder_cookie); - - if (IsIP6(ip)) - { - WriteBuf(b, ip->ipv6_addr, sizeof(ip->ipv6_addr)); - } - else - { - WriteBuf(b, ip->addr, sizeof(ip->addr)); - } - - us = Endian16((USHORT)port); - - WriteBuf(b, &us, sizeof(USHORT)); - - IkeHash(hash, hash_data, b->Buf, b->Size); - - FreeBuf(b); - - return MemToBuf(hash_data, hash->HashSize); -} - -// Check the capacity of the opposite IPsec client -void IkeCheckCaps(IKE_CAPS *caps, IKE_PACKET *p) -{ - // Validate arguments - if (caps == NULL || p == NULL) - { - Zero(caps, sizeof(IKE_CAPS)); - return; - } - - Zero(caps, sizeof(IKE_CAPS)); - - caps->NatTraversalRfc3947 = IkeIsVendorIdExists(p, IKE_VENDOR_ID_RFC3947_NAT_T); - - caps->NatTraversalDraftIetf = IkeIsVendorIdExists(p, IKE_VENDOR_ID_IPSEC_NAT_T_IKE_03) || - IkeIsVendorIdExists(p, IKE_VENDOR_ID_IPSEC_NAT_T_IKE_02) || - IkeIsVendorIdExists(p, IKE_VENDOR_ID_IPSEC_NAT_T_IKE_02_2) || - IkeIsVendorIdExists(p, IKE_VENDOR_ID_IPSEC_NAT_T_IKE_00); - - caps->DpdRfc3706 = IkeIsVendorIdExists(p, IKE_VENDOR_ID_RFC3706_DPD); - - caps->MS_L2TPIPSecVPNClient = IkeIsVendorIdExists(p, IKE_VENDOR_ID_MICROSOFT_L2TP); - caps->MS_NT5_ISAKMP_OAKLEY = IkeIsVendorIdExists(p, IKE_VENDOR_ID_MS_NT5_ISAKMPOAKLEY); - caps->MS_Vid_InitialContact = IkeIsVendorIdExists(p, IKE_VENDOR_ID_MS_VID_INITIALCONTACT); -} - -// Check whether the specified vendor ID is contained in the packet -bool IkeIsVendorIdExists(IKE_PACKET *p, char *str) -{ - BUF *buf; - UINT i, num; - bool ok = false; - // Validate arguments - if (p == NULL || str == NULL) - { - return false; - } - - buf = IkeStrToVendorId(str); - if (buf == NULL) - { - return false; - } - - num = IkeGetPayloadNum(p->PayloadList, IKE_PAYLOAD_VENDOR_ID); - for (i = 0;i < num;i++) - { - IKE_PACKET_PAYLOAD *payload = IkeGetPayload(p->PayloadList, IKE_PAYLOAD_VENDOR_ID, i); - if (payload == NULL) - { - break; - } - - if (CompareBuf(payload->Payload.VendorId.Data, buf)) - { - ok = true; - } - else - { - if (payload->Payload.VendorId.Data != NULL) - { - if (payload->Payload.VendorId.Data->Size >= buf->Size) - { - if (Cmp(payload->Payload.VendorId.Data->Buf, buf->Buf, buf->Size) == 0) - { - ok = true; - } - } - } - } - } - - FreeBuf(buf); - - return ok; -} - -// Add the vendor ID payload list -void IkeAddVendorIdPayloads(IKE_PACKET *p) -{ - // Validate arguments - if (p == NULL) - { - return; - } - - IkeAddVendorId(p, IKE_VENDOR_ID_RFC3947_NAT_T); - IkeAddVendorId(p, IKE_VENDOR_ID_IPSEC_NAT_T_IKE_03); - IkeAddVendorId(p, IKE_VENDOR_ID_IPSEC_NAT_T_IKE_02); - IkeAddVendorId(p, IKE_VENDOR_ID_IPSEC_NAT_T_IKE_02_2); - IkeAddVendorId(p, IKE_VENDOR_ID_IPSEC_NAT_T_IKE_00); - IkeAddVendorId(p, IKE_VENDOR_ID_RFC3706_DPD); -} - -// Add the vendor ID payload -void IkeAddVendorId(IKE_PACKET *p, char *str) -{ - BUF *buf; - IKE_PACKET_PAYLOAD *payload; - // Validate arguments - if (p == NULL || str == NULL) - { - return; - } - - buf = IkeStrToVendorId(str); - if (buf == NULL) - { - return; - } - - payload = IkeNewDataPayload(IKE_PAYLOAD_VENDOR_ID, buf->Buf, buf->Size); - - Add(p->PayloadList, payload); - - FreeBuf(buf); -} - -// Convert string to the vendor ID -BUF *IkeStrToVendorId(char *str) -{ - // Validate arguments - if (IsEmptyStr(str)) - { - return NULL; - } - - if (StartWith(str, "0x")) - { - BUF *buf = StrToBin(str + 2); - - if (buf == NULL || buf->Size == 0) - { - FreeBuf(buf); - return NULL; - } - - return buf; - } - else - { - BUF *buf; - UCHAR hash[MD5_SIZE]; - - Md5(hash, str, StrLen(str)); - - buf = MemToBuf(hash, sizeof(hash)); - - return buf; - } -} - -// Receive a packet using the IKE SA -IKE_PACKET *IkeSaRecvPacket(IKE_SERVER *ike, IKE_SA *sa, void *data, UINT size) -{ - IKE_PACKET *ret; - // Validate arguments - if (ike == NULL || sa == NULL || (size != 0 && data == NULL)) - { - return NULL; - } - - if (sa->IsIvExisting == false || sa->CryptoKey == NULL) - { - ret = IkeParse(data, size, NULL); - } - else - { - IKE_CRYPTO_PARAM cp; - - Copy(&cp.Iv, sa->Iv, sa->BlockSize); - cp.Key = sa->CryptoKey; - - ret = IkeParse(data, size, &cp); - - if (ret->FlagEncrypted) - { - IkeSaUpdateIv(sa, cp.NextIv, sa->BlockSize); - } - } - - return ret; -} - -// Receive a packet using IPsec SA (Quick Mode received) -IKE_PACKET *IPsecSaRecvPacket(IKE_SERVER *ike, IPSECSA *sa, void *data, UINT size) -{ - IKE_PACKET *ret; - // Validate arguments - if (ike == NULL || sa == NULL || (size != 0 && data == NULL)) - { - return NULL; - } - - if (sa->IsIvExisting == false || sa->IkeSa->CryptoKey == NULL) - { - ret = IkeParse(data, size, NULL); - } - else - { - IKE_CRYPTO_PARAM cp; - - Copy(&cp.Iv, sa->Iv, sa->IkeSa->BlockSize); - cp.Key = sa->IkeSa->CryptoKey; - - ret = IkeParse(data, size, &cp); - - if (ret->FlagEncrypted) - { - IPsecSaUpdateIv(sa, cp.NextIv, sa->IkeSa->BlockSize); - IPsecSaUpdateIv(sa->PairIPsecSa, cp.NextIv, sa->IkeSa->BlockSize); - } - } - - return ret; -} - -// Send a packet using IPsec SA (Quick Mode transmission) -void IPsecSaSendPacket(IKE_SERVER *ike, IPSECSA *sa, IKE_PACKET *p) -{ - BUF *buf; - // Validate arguments - if (ike == NULL || sa == NULL) - { - return; - } - - if (p == NULL) - { - FreeBuf(sa->SendBuffer); - sa->SendBuffer = NULL; - sa->NextSendTick = 0; - return; - } - - // Build a packet - if (p->FlagEncrypted == false) - { - buf = IkeBuild(p, NULL); - } - else - { - IKE_CRYPTO_PARAM cp; - - Copy(cp.Iv, sa->Iv, sa->IkeSa->BlockSize); - cp.Key = sa->IkeSa->CryptoKey; - - buf = IkeBuild(p, &cp); - - IPsecSaUpdateIv(sa, cp.NextIv, sa->IkeSa->BlockSize); - IPsecSaUpdateIv(sa->PairIPsecSa, cp.NextIv, sa->IkeSa->BlockSize); - } - - if (buf == NULL) - { - return; - } - - // Register the last packet to re-transmit - if (sa->SendBuffer != NULL) - { - FreeBuf(sa->SendBuffer); - } - - sa->SendBuffer = CloneBuf(buf); - sa->NextSendTick = ike->Now + (UINT64)(IKE_SA_RESEND_INTERVAL); - AddInterrupt(ike->Interrupts, sa->NextSendTick); - - IkeSendUdpPacket(ike, IKE_UDP_TYPE_ISAKMP, &sa->IkeClient->ServerIP, sa->IkeClient->ServerPort, - &sa->IkeClient->ClientIP, sa->IkeClient->ClientPort, - buf->Buf, buf->Size); - - Free(buf); -} - -// Send a packet using the IKE SA -void IkeSaSendPacket(IKE_SERVER *ike, IKE_SA *sa, IKE_PACKET *p) -{ - BUF *buf; - // Validate arguments - if (ike == NULL || sa == NULL) - { - return; - } - - if (p == NULL) - { - FreeBuf(sa->SendBuffer); - sa->SendBuffer = NULL; - sa->NextSendTick = 0; - return; - } - - // Build a packet - if (p->FlagEncrypted == false) - { - buf = IkeBuild(p, NULL); - } - else - { - IKE_CRYPTO_PARAM cp; - - Copy(cp.Iv, sa->Iv, sa->BlockSize); - cp.Key = sa->CryptoKey; - - buf = IkeBuild(p, &cp); - - IkeSaUpdateIv(sa, cp.NextIv, sa->BlockSize); - } - - if (buf == NULL) - { - return; - } - - if (p->ExchangeType != IKE_EXCHANGE_TYPE_INFORMATION) - { - // Register the last packet to re-transmit - if (sa->SendBuffer != NULL) - { - FreeBuf(sa->SendBuffer); - } - - sa->SendBuffer = CloneBuf(buf); - sa->NextSendTick = ike->Now + (UINT64)(IKE_SA_RESEND_INTERVAL); - AddInterrupt(ike->Interrupts, sa->NextSendTick); - } - - IkeSendUdpPacket(ike, IKE_UDP_TYPE_ISAKMP, &sa->IkeClient->ServerIP, sa->IkeClient->ServerPort, - &sa->IkeClient->ClientIP, sa->IkeClient->ClientPort, - buf->Buf, buf->Size); - - Free(buf); -} - -// Send an UDP packet -void IkeSendUdpPacket(IKE_SERVER *ike, UINT type, IP *server_ip, UINT server_port, IP *client_ip, UINT client_port, void *data, UINT size) -{ - UDPPACKET *p; - // Validate arguments - if (ike == NULL || server_ip == NULL || client_ip == NULL || server_port == 0 || client_port == 0 || data == NULL || size == 0) - { - return; - } - - p = NewUdpPacket(server_ip, server_port, client_ip, client_port, data, size); - - p->Type = type; - - Add(ike->SendPacketList, p); -} - -// Create an IKE SA -IKE_SA *NewIkeSa(IKE_SERVER *ike, IKE_CLIENT *c, UINT64 init_cookie, UINT mode, IKE_SA_TRANSFORM_SETTING *setting) -{ - IKE_SA *sa; - // Validate arguments - if (ike == NULL || c == NULL || init_cookie == 0 || setting == NULL) - { - return NULL; - } - - sa = ZeroMalloc(sizeof(IKE_SA)); - - sa->Id = ++ike->CurrentIkeSaId; - - sa->IkeClient = c; - sa->InitiatorCookie = init_cookie; - sa->ResponderCookie = GenerateNewResponserCookie(ike); - sa->Mode = mode; - sa->FirstCommTick = sa->LastCommTick = ike->Now; - Copy(&sa->TransformSetting, setting, sizeof(IKE_SA_TRANSFORM_SETTING)); - - Debug("New IKE SA (Mode = %u): %I64u <--> %I64u (%s %s %s(%u) %u %u)\n", - mode, - sa->InitiatorCookie, - sa->ResponderCookie, - setting->Dh->Name, setting->Hash->Name, setting->Crypto->Name, setting->CryptoKeySize, - setting->LifeKilobytes, setting->LifeSeconds); - - IPsecLog(ike, NULL, sa, NULL, "LI_NEW_IKE_SA", - (mode == IKE_SA_MAIN_MODE ? _UU("LI_TAG_MAINMODE") : _UU("LI_TAG_AGGRESSIVE")), - sa->InitiatorCookie, sa->ResponderCookie, - setting->Dh->Name, setting->Hash->Name, setting->Crypto->Name, setting->CryptoKeySize * 8, - setting->LifeKilobytes, setting->LifeSeconds); - - return sa; -} - -// Search an IKE SA from the Responder Cookie -IKE_SA *FindIkeSaByResponderCookie(IKE_SERVER *ike, UINT64 responder_cookie) -{ - IKE_SA t; - // Validate arguments - if (ike == NULL || responder_cookie == 0) - { - return NULL; - } - - t.ResponderCookie = responder_cookie; - - return Search(ike->IkeSaList, &t); -} - -// Search an IKE SA from the Responder Cookie and the IKE_CLIENT -IKE_SA *FindIkeSaByResponderCookieAndClient(IKE_SERVER *ike, UINT64 responder_cookie, IKE_CLIENT *c) -{ - IKE_SA *sa; - // Validate arguments - if (ike == NULL || responder_cookie == 0 || c == NULL) - { - return NULL; - } - - sa = FindIkeSaByResponderCookie(ike, responder_cookie); - if (sa == NULL) - { - return NULL; - } - - if (sa->IkeClient != c) - { - return NULL; - } - - return sa; -} - -// Search an IKE SA from the endpoint and the Initiator Cookie -IKE_SA *FindIkeSaByEndPointAndInitiatorCookie(IKE_SERVER *ike, IP *client_ip, UINT client_port, IP *server_ip, UINT server_port, UINT64 init_cookie, UINT mode) -{ - UINT i; - // Validate arguments - if (ike == NULL || client_ip == NULL || server_ip == NULL || client_port == 0 || server_port == 0 || init_cookie == 0) - { - return NULL; - } - - for (i = 0;i < LIST_NUM(ike->IkeSaList);i++) - { - IKE_SA *sa = LIST_DATA(ike->IkeSaList, i); - IKE_CLIENT *c; - - c = sa->IkeClient; - - if (CmpIpAddr(&c->ClientIP, client_ip) == 0 && - CmpIpAddr(&c->ServerIP, server_ip) == 0 && - c->ClientPort == client_port && - c->ServerPort == server_port && - sa->InitiatorCookie == init_cookie && - sa->Mode == mode) - { - return sa; - } - } - - return NULL; -} - -// Get the number of IPsec SA that is associated with the IKE_CLIENT -UINT GetNumberOfIPsecSaOfIkeClient(IKE_SERVER *ike, IKE_CLIENT *c) -{ - UINT num = 0, i; - // Validate arguments - if (ike == NULL || c == NULL) - { - return 0; - } - - for (i = 0;i < LIST_NUM(ike->IPsecSaList);i++) - { - IPSECSA *sa = LIST_DATA(ike->IPsecSaList, i); - - if (sa->IkeClient == c) - { - num++; - } - } - - return num; -} - -// Get the number of IKE SA that is associated with the IKE_CLIENT -UINT GetNumberOfIkeSaOfIkeClient(IKE_SERVER *ike, IKE_CLIENT *c) -{ - UINT num = 0, i; - // Validate arguments - if (ike == NULL || c == NULL) - { - return 0; - } - - for (i = 0;i < LIST_NUM(ike->IkeSaList);i++) - { - IKE_SA *sa = LIST_DATA(ike->IkeSaList, i); - - if (sa->IkeClient == c) - { - num++; - } - } - - return num; -} - -// Get the number of clients that are connected from the specified IP address -UINT GetNumberOfIkeClientsFromIP(IKE_SERVER *ike, IP *client_ip) -{ - UINT i, num; - // Validate arguments - if (ike == NULL || client_ip == NULL) - { - return 0; - } - - num = 0; - - for (i = 0;i < LIST_NUM(ike->ClientList);i++) - { - IKE_CLIENT *c = LIST_DATA(ike->ClientList, i); - - if (CmpIpAddr(&c->ClientIP, client_ip) == 0) - { - num++; - } - } - - return num; -} - -// Find the appropriate IKE client. Create if it is absent -IKE_CLIENT *SearchOrCreateNewIkeClientForIkePacket(IKE_SERVER *ike, IP *client_ip, UINT client_port, IP *server_ip, UINT server_port, IKE_PACKET *pr) -{ - IKE_CLIENT *c; - // Validate arguments - if (ike == NULL || pr == NULL || client_ip == NULL || server_ip == NULL || client_port == 0 || server_port == 0) - { - return NULL; - } - - c = SearchIkeClientForIkePacket(ike, client_ip, client_port, server_ip, server_port, pr); - if (c == NULL) - { - if (GetNumberOfIkeClientsFromIP(ike, client_ip) > IKE_QUOTA_MAX_NUM_CLIENTS_PER_IP || - LIST_NUM(ike->ClientList) > IKE_QUOTA_MAX_NUM_CLIENTS) - { - return NULL; - } - - - c = NewIkeClient(ike, client_ip, client_port, server_ip, server_port); - - Insert(ike->ClientList, c); - } - - return SetIkeClientEndpoint(ike, c, client_ip, client_port, server_ip, server_port); -} - -// Create an IKE client -IKE_CLIENT *NewIkeClient(IKE_SERVER *ike, IP *client_ip, UINT client_port, IP *server_ip, UINT server_port) -{ - IKE_CLIENT *c; - char client_ip_str[MAX_SIZE]; - char server_ip_str[MAX_SIZE]; - // Validate arguments - if (ike == NULL || client_ip == NULL || server_ip == NULL || client_port == 0 || server_port == 0) - { - return NULL; - } - - c = ZeroMalloc(sizeof(IKE_CLIENT)); - - c->Id = ++ike->CurrentIkeClientId; - - Copy(&c->ClientIP, client_ip, sizeof(IP)); - c->ClientPort = client_port; - - Copy(&c->ServerIP, server_ip, sizeof(IP)); - Copy(&c->TransportModeServerIP, server_ip, sizeof(IP)); - Copy(&c->TransportModeClientIP, client_ip, sizeof(IP)); - c->ServerPort = server_port; - - c->LastCommTick = ike->Now; - c->FirstCommTick = ike->Now; - - IPToStr(client_ip_str, sizeof(client_ip_str), client_ip); - IPToStr(server_ip_str, sizeof(server_ip_str), server_ip); - - Debug("New IKE_CLIENT: %p: %s:%u -> %s:%u\n", c, client_ip_str, client_port, server_ip_str, server_port); - - IPsecLog(ike, c, NULL, NULL, "LI_NEW_IKE_CLIENT"); - - return c; -} - -// Search for the best associated IKE client when an IKE packet has been received -IKE_CLIENT *SearchIkeClientForIkePacket(IKE_SERVER *ike, IP *client_ip, UINT client_port, IP *server_ip, UINT server_port, IKE_PACKET *pr) -{ - IKE_CLIENT t; - IKE_CLIENT *c = NULL; - // Validate arguments - if (ike == NULL || pr == NULL || client_ip == NULL || server_ip == NULL || client_port == 0 || server_port == 0) - { - return NULL; - } - - if (true) - { - UINT i; - - if (pr->InitiatorCookie != 0 && pr->ResponderCookie != 0) - { - for (i = 0;i < LIST_NUM(ike->IkeSaList);i++) - { - IKE_SA *sa = LIST_DATA(ike->IkeSaList, i); - - // Extract what Cookie matches exactly - if (sa->InitiatorCookie == pr->InitiatorCookie && sa->ResponderCookie == pr->ResponderCookie) - { - IKE_CLIENT *cc = sa->IkeClient; - - if (CmpIpAddr(&cc->ServerIP, server_ip) == 0 && - CmpIpAddr(&cc->ClientIP, client_ip) == 0) - { - c = cc; - break; - } - } - } - } - } - - if (c == NULL) - { - // Search by a pair of IP address and port number - Copy(&t.ClientIP, client_ip, sizeof(IP)); - t.ClientPort = client_port; - Copy(&t.ServerIP, server_ip, sizeof(IP)); - t.ServerPort = server_port; - - c = Search(ike->ClientList, &t); - - if (c != NULL)// && server_port == IPSEC_PORT_IPSEC_ISAKMP) - { - // Search that the IKE_SA that points to this IKE_CLIENT exists and match the Cookie - bool ok = false; - UINT i; - - if (server_port == IPSEC_PORT_IPSEC_ESP_UDP) - { - // Regard as OK if the port number exactly match in the case of connecting to a server-side 4500 - ok = true; - } - else - { - if (c->CurrentIkeSa != NULL && - c->CurrentIkeSa->InitiatorCookie == pr->InitiatorCookie && - c->CurrentIkeSa->ResponderCookie == pr->ResponderCookie) - { - ok = true; - } - else - { - for (i = 0;i < LIST_NUM(ike->IkeSaList);i++) - { - IKE_SA *sa = LIST_DATA(ike->IkeSaList, i); - - if (sa->IkeClient == c) - { - if (sa->InitiatorCookie == pr->InitiatorCookie && - sa->ResponderCookie == pr->ResponderCookie) - { - ok = true; - break; - } - } - } - } - } - - if (ok == false) - { - // Not found - c = NULL; - } - } - } - - return c; -} - -// Comparison of IPsec SA -int CmpIPsecSa(void *p1, void *p2) -{ - IPSECSA *sa1, *sa2; - int r; - // Validate arguments - if (p1 == NULL || p2 == NULL) - { - return 0; - } - sa1 = *(IPSECSA **)p1; - sa2 = *(IPSECSA **)p2; - if (sa1 == NULL || sa2 == NULL) - { - return 0; - } - - r = COMPARE_RET(sa1->ServerToClient, sa2->ServerToClient); - if (r != 0) - { - return r; - } - - r = COMPARE_RET(sa1->Spi, sa2->Spi); - - return r; -} - -// Comparison of IKE_SA -int CmpIkeSa(void *p1, void *p2) -{ - IKE_SA *sa1, *sa2; - int r; - // Validate arguments - if (p1 == NULL || p2 == NULL) - { - return 0; - } - sa1 = *(IKE_SA **)p1; - sa2 = *(IKE_SA **)p2; - if (sa1 == NULL || sa2 == NULL) - { - return 0; - } - - r = COMPARE_RET(sa1->ResponderCookie, sa2->ResponderCookie); - - return r; -} - -// Comparison of IKE_CLIENT -int CmpIkeClient(void *p1, void *p2) -{ - IKE_CLIENT *c1, *c2; - int r; - // Validate arguments - if (p1 == NULL || p2 == NULL) - { - return 0; - } - c1 = *(IKE_CLIENT **)p1; - c2 = *(IKE_CLIENT **)p2; - if (c1 == NULL || c2 == NULL) - { - return 0; - } - - r = CmpIpAddr(&c1->ClientIP, &c2->ClientIP); - if (r != 0) - { - return r; - } - - r = CmpIpAddr(&c1->ServerIP, &c2->ServerIP); - if (r != 0) - { - return r; - } - - r = COMPARE_RET(c1->ClientPort, c2->ClientPort); - if (r != 0) - { - return r; - } - - r = COMPARE_RET(c1->ServerPort, c2->ServerPort); - if (r != 0) - { - return r; - } - - return 0; -} - -// Update the endpoint information of IKE_CLIENT -IKE_CLIENT *SetIkeClientEndpoint(IKE_SERVER *ike, IKE_CLIENT *c, IP *client_ip, UINT client_port, IP *server_ip, UINT server_port) -{ - char client_ip_str[MAX_SIZE]; - char server_ip_str[MAX_SIZE]; - IKE_CLIENT *ret = c; - IKE_CLIENT *cc; - IKE_CLIENT t; - // Validate arguments - if (ike == NULL || c == NULL || client_ip == NULL || client_port == 0 || server_ip == NULL || server_port == 0) - { - return NULL; - } - - if (CmpIpAddr(&c->ClientIP, client_ip) == 0 && - CmpIpAddr(&c->ServerIP, server_ip) == 0 && - c->ClientPort == client_port && - c->ServerPort == server_port) - { - // No change - return ret; - } - - if (IS_SPECIAL_PORT(client_port) || IS_SPECIAL_PORT(server_port)) - { - // Don't change in the case of Raw socket - return ret; - } - - // Search for an existing IKE_CLIENT which exactly matches to combination of the new IP address and the port number - Copy(&t.ClientIP, client_ip, sizeof(IP)); - t.ClientPort = client_port; - Copy(&t.ServerIP, server_ip, sizeof(IP)); - t.ServerPort = server_port; - - cc = Search(ike->ClientList, &t); - if (cc != NULL && c != cc && cc->Deleting == false && c->L2TP == NULL) - { - UINT i; - // Merge into this existing IKE_CLIENT since it found - for (i = 0;i < LIST_NUM(ike->IkeSaList);i++) - { - IKE_SA *sa = LIST_DATA(ike->IkeSaList, i); - - if (sa->IkeClient == c) - { - sa->IkeClient = cc; - } - } - for (i = 0;i < LIST_NUM(ike->IPsecSaList);i++) - { - IPSECSA *sa = LIST_DATA(ike->IPsecSaList, i); - - if (sa->IkeClient == c) - { - sa->IkeClient = cc; - } - } - - if (cc->LastCommTick < c->LastCommTick) - { - StrCpy(cc->ClientId, sizeof(cc->ClientId), c->ClientId); - } - - cc->FirstCommTick = MIN(cc->FirstCommTick, c->FirstCommTick); - cc->LastCommTick = MAX(cc->LastCommTick, c->LastCommTick); - - ret = cc; - - IPToStr(client_ip_str, sizeof(client_ip_str), client_ip); - IPToStr(server_ip_str, sizeof(server_ip_str), server_ip); - - Debug("Merge IKE_CLIENT: %p->%p: %s:%u -> %s:%u\n", c, cc, client_ip_str, client_port, server_ip_str, server_port); - - IPsecLog(ike, c, NULL, NULL, "LI_CLIENT_MERGE", c->Id, cc->Id, cc->Id); - - // Remove old IKE_CLIENT from the list and free - Delete(ike->ClientList, c); - FreeIkeClient(ike, c); - } - else - { - // Rewrite the end point information of this IKE_CLIENT because not found - Copy(&c->ClientIP, client_ip, sizeof(IP)); - Copy(&c->ServerIP, server_ip, sizeof(IP)); - c->ClientPort = client_port; - c->ServerPort = server_port; - - IPToStr(client_ip_str, sizeof(client_ip_str), client_ip); - IPToStr(server_ip_str, sizeof(server_ip_str), server_ip); - - Debug("Update IKE_CLIENT: %p: %s:%u -> %s:%u\n", c, client_ip_str, client_port, server_ip_str, server_port); - - IPsecLog(ike, c, NULL, NULL, "LI_CLIENT_UPDATE"); - - ike->ClientList->sorted = false; - } - - return ret; -} - -// Select the optimal transform setting for IPsec SA -bool GetBestTransformSettingForIPsecSa(IKE_SERVER *ike, IKE_PACKET *pr, IPSEC_SA_TRANSFORM_SETTING *setting, IP *server_ip) -{ - IKE_PACKET_PAYLOAD *sa_payload; - IKE_PACKET_SA_PAYLOAD *sa; - UINT i, num; - bool ocmii_flag = false; - // Validate arguments - if (ike == NULL || pr == NULL || setting == NULL || server_ip == NULL) - { - return false; - } - - Zero(setting, sizeof(IPSEC_SA_TRANSFORM_SETTING)); - - // Get the SA payload - sa_payload = IkeGetPayload(pr->PayloadList, IKE_PAYLOAD_SA, 0); - if (sa_payload == NULL) - { - return false; - } - - sa = &sa_payload->Payload.Sa; - - // Scan all proposal payloads - num = IkeGetPayloadNum(sa->PayloadList, IKE_PAYLOAD_PROPOSAL); - for (i = 0;i < num;i++) - { - IKE_PACKET_PAYLOAD *proposal_payload = IkeGetPayload(sa->PayloadList, IKE_PAYLOAD_PROPOSAL, i); - - if (proposal_payload != NULL) - { - IKE_PACKET_PROPOSAL_PAYLOAD *proposal = &proposal_payload->Payload.Proposal; - - // Examine the contents of the proposal payload - if (proposal->ProtocolId == IKE_PROTOCOL_ID_IPSEC_ESP && proposal->Spi->Size == 4) - { - // Scan all transform payloads - UINT j, num2; - - num2 = IkeGetPayloadNum(proposal->PayloadList, IKE_PAYLOAD_TRANSFORM); - for (j = 0;j < num2;j++) - { - IKE_PACKET_PAYLOAD *transform_payload = IkeGetPayload(proposal->PayloadList, IKE_PAYLOAD_TRANSFORM, j); - if (transform_payload != NULL) - { - IKE_PACKET_TRANSFORM_PAYLOAD *transform = &transform_payload->Payload.Transform; - IPSEC_SA_TRANSFORM_SETTING set; - - Zero(&set, sizeof(set)); - - if (TransformPayloadToTransformSettingForIPsecSa(ike, transform, &set, server_ip)) - { - Copy(setting, &set, sizeof(IPSEC_SA_TRANSFORM_SETTING)); - - setting->SpiServerToClient = READ_UINT(proposal->Spi->Buf); - - return true; - } - else - { - if (set.OnlyCapsuleModeIsInvalid) - { - if (ocmii_flag == false) - { - Copy(setting, &set, sizeof(IPSEC_SA_TRANSFORM_SETTING)); - ocmii_flag = true; - } - } - } - } - } - } - } - } - - return false; -} - -// Select the optimal transform settings for the IKE SA -bool GetBestTransformSettingForIkeSa(IKE_SERVER *ike, IKE_PACKET *pr, IKE_SA_TRANSFORM_SETTING *setting) -{ - IKE_PACKET_PAYLOAD *sa_payload; - IKE_PACKET_SA_PAYLOAD *sa; - UINT i, num; - // Validate arguments - if (ike == NULL || pr == NULL || setting == NULL) - { - return false; - } - - // Get the SA payload - sa_payload = IkeGetPayload(pr->PayloadList, IKE_PAYLOAD_SA, 0); - if (sa_payload == NULL) - { - return false; - } - - sa = &sa_payload->Payload.Sa; - - // Scan all proposal payloads - num = IkeGetPayloadNum(sa->PayloadList, IKE_PAYLOAD_PROPOSAL); - for (i = 0;i < num;i++) - { - IKE_PACKET_PAYLOAD *proposal_payload = IkeGetPayload(sa->PayloadList, IKE_PAYLOAD_PROPOSAL, i); - - if (proposal_payload != NULL) - { - IKE_PACKET_PROPOSAL_PAYLOAD *proposal = &proposal_payload->Payload.Proposal; - - // Examine the contents of the proposal payload - if (proposal->ProtocolId == IKE_PROTOCOL_ID_IKE) - { - // Scan all transform payloads - UINT j, num2; - - num2 = IkeGetPayloadNum(proposal->PayloadList, IKE_PAYLOAD_TRANSFORM); - for (j = 0;j < num2;j++) - { - IKE_PACKET_PAYLOAD *transform_payload = IkeGetPayload(proposal->PayloadList, IKE_PAYLOAD_TRANSFORM, j); - if (transform_payload != NULL) - { - IKE_PACKET_TRANSFORM_PAYLOAD *transform = &transform_payload->Payload.Transform; - - if (transform->TransformId == IKE_TRANSFORM_ID_P1_KEY_IKE) - { - IKE_SA_TRANSFORM_SETTING set; - - if (TransformPayloadToTransformSettingForIkeSa(ike, transform, &set)) - { - Copy(setting, &set, sizeof(IKE_SA_TRANSFORM_SETTING)); - return true; - } - } - } - } - } - } - } - - return false; -} - -// Convert a structure to the transform payload (for IPsec SA) -IKE_PACKET_PAYLOAD *TransformSettingToTransformPayloadForIPsec(IKE_SERVER *ike, IPSEC_SA_TRANSFORM_SETTING *setting) -{ - LIST *value_list; - // Validate arguments - if (ike == NULL || setting == NULL) - { - return NULL; - } - - value_list = NewListFast(NULL); - - Add(value_list, IkeNewTransformValue(IKE_TRANSFORM_VALUE_P2_HMAC, setting->HashId)); - - if (setting->Dh != NULL) - { - Add(value_list, IkeNewTransformValue(IKE_TRANSFORM_VALUE_P2_DH_GROUP, setting->DhId)); - } - - if (setting->LifeSeconds != INFINITE) - { - Add(value_list, IkeNewTransformValue(IKE_TRANSFORM_VALUE_P2_LIFE_TYPE, IKE_P2_LIFE_TYPE_SECONDS)); - Add(value_list, IkeNewTransformValue(IKE_TRANSFORM_VALUE_P2_LIFE_VALUE, setting->LifeSeconds)); - } - - if (setting->LifeKilobytes != INFINITE) - { - Add(value_list, IkeNewTransformValue(IKE_TRANSFORM_VALUE_P2_LIFE_TYPE, IKE_P2_LIFE_TYPE_KILOBYTES)); - Add(value_list, IkeNewTransformValue(IKE_TRANSFORM_VALUE_P2_LIFE_VALUE, setting->LifeKilobytes)); - } - - if (setting->Crypto->VariableKeySize) - { - Add(value_list, IkeNewTransformValue(IKE_TRANSFORM_VALUE_P2_KEY_SIZE, setting->CryptoKeySize * 8)); - } - - Add(value_list, IkeNewTransformValue(IKE_TRANSFORM_VALUE_P2_CAPSULE, setting->CapsuleMode)); - - return IkeNewTransformPayload(1, setting->CryptoId, value_list); -} - -// Convert a structure to the transform payload (for IKE SA) -IKE_PACKET_PAYLOAD *TransformSettingToTransformPayloadForIke(IKE_SERVER *ike, IKE_SA_TRANSFORM_SETTING *setting) -{ - LIST *value_list; - // Validate arguments - if (ike == NULL || setting == NULL) - { - return NULL; - } - - value_list = NewListFast(NULL); - - Add(value_list, IkeNewTransformValue(IKE_TRANSFORM_VALUE_P1_CRYPTO, setting->CryptoId)); - Add(value_list, IkeNewTransformValue(IKE_TRANSFORM_VALUE_P1_HASH, setting->HashId)); - Add(value_list, IkeNewTransformValue(IKE_TRANSFORM_VALUE_P1_AUTH_METHOD, IKE_P1_AUTH_METHOD_PRESHAREDKEY)); - Add(value_list, IkeNewTransformValue(IKE_TRANSFORM_VALUE_P1_DH_GROUP, setting->DhId)); - - if (setting->LifeSeconds != INFINITE) - { - Add(value_list, IkeNewTransformValue(IKE_TRANSFORM_VALUE_P1_LIFE_TYPE, IKE_P1_LIFE_TYPE_SECONDS)); - Add(value_list, IkeNewTransformValue(IKE_TRANSFORM_VALUE_P1_LIFE_VALUE, setting->LifeSeconds)); - } - - if (setting->LifeKilobytes != INFINITE) - { - Add(value_list, IkeNewTransformValue(IKE_TRANSFORM_VALUE_P1_LIFE_TYPE, IKE_P1_LIFE_TYPE_KILOBYTES)); - Add(value_list, IkeNewTransformValue(IKE_TRANSFORM_VALUE_P1_LIFE_VALUE, setting->LifeKilobytes)); - } - - if (setting->Crypto->VariableKeySize) - { - Add(value_list, IkeNewTransformValue(IKE_TRANSFORM_VALUE_P1_KET_SIZE, setting->CryptoKeySize * 8)); - } - - return IkeNewTransformPayload(1, IKE_TRANSFORM_ID_P1_KEY_IKE, value_list); -} - -// Convert a transform payload to a structure (for IPsec SA) -bool TransformPayloadToTransformSettingForIPsecSa(IKE_SERVER *ike, IKE_PACKET_TRANSFORM_PAYLOAD *transform, IPSEC_SA_TRANSFORM_SETTING *setting, IP *server_ip) -{ - UINT i; - UINT capsule_mode; - bool is_esp_supported; - // Validate arguments - if (ike == NULL || transform == NULL || setting == NULL || server_ip == NULL) - { - return false; - } - - is_esp_supported = IsUdpPortOpened(ike->IPsec->UdpListener, server_ip, IPSEC_PORT_IPSEC_ESP_RAW); - - Zero(setting, sizeof(IPSEC_SA_TRANSFORM_SETTING)); - - setting->CryptoId = transform->TransformId; - setting->HashId = IkeGetTransformValue(transform, IKE_TRANSFORM_VALUE_P2_HMAC, 0); - - setting->DhId = IkeGetTransformValue(transform, IKE_TRANSFORM_VALUE_P2_DH_GROUP, 0); - - setting->LifeKilobytes = INFINITE; - setting->LifeSeconds = INFINITE; - - for (i = 0;i < IkeGetTransformValueNum(transform, IKE_TRANSFORM_VALUE_P2_LIFE_TYPE);i++) - { - UINT life_type = IkeGetTransformValue(transform, IKE_TRANSFORM_VALUE_P2_LIFE_TYPE, i); - - switch (life_type) - { - case IKE_P2_LIFE_TYPE_SECONDS: // Number of seconds - setting->LifeSeconds = IkeGetTransformValue(transform, IKE_TRANSFORM_VALUE_P2_LIFE_VALUE, i); - break; - - case IKE_P2_LIFE_TYPE_KILOBYTES: // Kilobytes - setting->LifeKilobytes = IkeGetTransformValue(transform, IKE_TRANSFORM_VALUE_P2_LIFE_VALUE, i); - break; - - default: - // Unsupported expiration type - return false; - } - } - - setting->Crypto = GetIkeCrypto(ike->Engine, true, setting->CryptoId); - setting->Hash = GetIkeHash(ike->Engine, true, setting->HashId); - setting->Dh = GetIkeDh(ike->Engine, true, setting->DhId); - - if (setting->Crypto == NULL || setting->Hash == NULL) - { - // Unsupported algorithm - return false; - } - - if (setting->Crypto->VariableKeySize) - { - // Get the actual key size in the case of variable key size - setting->CryptoKeySize = IkeGetTransformValue(transform, IKE_TRANSFORM_VALUE_P2_KEY_SIZE, 0); - - // bits -> bytes - setting->CryptoKeySize = setting->CryptoKeySize / 8; - - if (setting->CryptoKeySize == 0 || IkeCheckKeySize(setting->Crypto, setting->CryptoKeySize) == false) - { - // The key size is not specified or inappropriate - return false; - } - } - else - { - // Get a fixed key length for fixed key size - setting->CryptoKeySize = setting->Crypto->KeySizes[0]; - } - - capsule_mode = IkeGetTransformValue(transform, IKE_TRANSFORM_VALUE_P2_CAPSULE, 0); - if (capsule_mode != IKE_P2_CAPSULE_NAT_TUNNEL_1 && capsule_mode != IKE_P2_CAPSULE_NAT_TUNNEL_2 && - capsule_mode != IKE_P2_CAPSULE_NAT_TRANSPORT_1 && capsule_mode != IKE_P2_CAPSULE_NAT_TRANSPORT_2) - { - // No support for UDP encapsulation mode except for the NAT-Traversal - if (capsule_mode == IKE_P2_CAPSULE_TRANSPORT || capsule_mode == IKE_P2_CAPSULE_TUNNEL) - { - if (is_esp_supported == false) - { - setting->OnlyCapsuleModeIsInvalid = true; - return false; - } - else - { - // It is an environment that can send and receive ESP packets - } - } - else - { - return false; - } - } - - setting->CapsuleMode = capsule_mode; - - return true; -} - -// Convert a transform payload to a structure (for IKE SA) -bool TransformPayloadToTransformSettingForIkeSa(IKE_SERVER *ike, IKE_PACKET_TRANSFORM_PAYLOAD *transform, IKE_SA_TRANSFORM_SETTING *setting) -{ - UINT i; - // Validate arguments - if (ike == NULL || transform == NULL || setting == NULL) - { - return false; - } - - Zero(setting, sizeof(IKE_SA_TRANSFORM_SETTING)); - - setting->CryptoId = IkeGetTransformValue(transform, IKE_TRANSFORM_VALUE_P1_CRYPTO, 0); - setting->HashId = IkeGetTransformValue(transform, IKE_TRANSFORM_VALUE_P1_HASH, 0); - - if (IkeGetTransformValue(transform, IKE_TRANSFORM_VALUE_P1_AUTH_METHOD, 0) != IKE_P1_AUTH_METHOD_PRESHAREDKEY) - { - // Only PSK authentication method is supported - return false; - } - - setting->DhId = IkeGetTransformValue(transform, IKE_TRANSFORM_VALUE_P1_DH_GROUP, 0); - - setting->LifeKilobytes = INFINITE; - setting->LifeSeconds = INFINITE; - - for (i = 0;i < IkeGetTransformValueNum(transform, IKE_TRANSFORM_VALUE_P1_LIFE_TYPE);i++) - { - UINT life_type = IkeGetTransformValue(transform, IKE_TRANSFORM_VALUE_P1_LIFE_TYPE, i); - - switch (life_type) - { - case IKE_P1_LIFE_TYPE_SECONDS: // Number of seconds - setting->LifeSeconds = IkeGetTransformValue(transform, IKE_TRANSFORM_VALUE_P1_LIFE_VALUE, i); - break; - - case IKE_P1_LIFE_TYPE_KILOBYTES: // Kilobytes - setting->LifeKilobytes = IkeGetTransformValue(transform, IKE_TRANSFORM_VALUE_P1_LIFE_VALUE, i); - break; - - default: - // Unsupported expiration type - return false; - } - } - - setting->Crypto = GetIkeCrypto(ike->Engine, false, setting->CryptoId); - setting->Hash = GetIkeHash(ike->Engine, false, setting->HashId); - setting->Dh = GetIkeDh(ike->Engine, false, setting->DhId); - - if (setting->Crypto == NULL || setting->Hash == NULL || setting->Dh == NULL) - { - // Unsupported algorithm - return false; - } - - if (setting->Crypto->VariableKeySize) - { - // Get the actual key size in the case of variable key size - setting->CryptoKeySize = IkeGetTransformValue(transform, IKE_TRANSFORM_VALUE_P1_KET_SIZE, 0); - - // bits -> bytes - setting->CryptoKeySize = setting->CryptoKeySize / 8; - - if (setting->CryptoKeySize == 0 || IkeCheckKeySize(setting->Crypto, setting->CryptoKeySize) == false) - { - // The key size is not specified or inappropriate - return false; - } - } - else - { - // Get a fixed key length for fixed key size - setting->CryptoKeySize = setting->Crypto->KeySizes[0]; - } - - return true; -} - -// Creating a new Responder Cookie -UINT64 GenerateNewResponserCookie(IKE_SERVER *ike) -{ - UINT64 c; - // Validate arguments - if (ike == NULL) - { - return 0; - } - - while (true) - { - bool b = false; - UINT i; - - c = Rand64(); - - for (i = 0;i < LIST_NUM(ike->IkeSaList);i++) - { - IKE_SA *sa = LIST_DATA(ike->IkeSaList, i); - - if (sa->ResponderCookie == c) - { - b = true; - break; - } - } - - if (b == false) - { - return c; - } - } -} - -// Parse the IKE packet header -IKE_PACKET *ParseIKEPacketHeader(UDPPACKET *p) -{ - // Validate arguments - if (p == NULL) - { - return NULL; - } - - return IkeParseHeader(p->Data, p->Size, NULL); -} - -// Search for another IPsec SA belonging to the IKE_CLIENT which have same conditions to the specified IPsec SA -IPSECSA *GetOtherLatestIPsecSa(IKE_SERVER *ike, IPSECSA *sa) -{ - UINT i; - UINT64 min_value = 0; - IPSECSA *max_sa = NULL; - // Validate arguments - if (ike == NULL || sa == NULL) - { - return NULL; - } - - if (sa->IkeClient == NULL) - { - return NULL; - } - - for (i = 0;i < LIST_NUM(ike->IPsecSaList);i++) - { - IPSECSA *sa2 = LIST_DATA(ike->IPsecSaList, i); - - if (sa2 != sa) - { - if (sa2->IkeClient == sa->IkeClient) - { - if (sa2->ServerToClient == sa->ServerToClient) - { - if (sa2->Deleting == false) - { - if (sa2->Established) - { - UINT64 last_comm_tick = sa2->LastCommTick; - - if (sa2->ServerToClient) - { - if (sa2->PairIPsecSa != NULL) - { - last_comm_tick = sa2->PairIPsecSa->LastCommTick; - } - } - - if (min_value < last_comm_tick) - { - min_value = last_comm_tick; - - max_sa = sa2; - } - } - } - } - } - } - } - - return max_sa; -} - -// Search for another IKE_SA belonging to the IKE_CLIENT which have same conditions to the specified IKE_SA -IKE_SA *GetOtherLatestIkeSa(IKE_SERVER *ike, IKE_SA *sa) -{ - UINT i; - UINT64 min_value = 0; - IKE_SA *max_sa = NULL; - // Validate arguments - if (ike == NULL || sa == NULL) - { - return NULL; - } - - if (sa->IkeClient == NULL) - { - return NULL; - } - - for (i = 0;i < LIST_NUM(ike->IkeSaList);i++) - { - IKE_SA *sa2 = LIST_DATA(ike->IkeSaList, i); - - if (sa2 != sa) - { - if (sa2->IkeClient == sa->IkeClient) - { - if (sa2->Deleting == false) - { - if (sa2->Established) - { - if (min_value < sa2->LastCommTick) - { - min_value = sa2->LastCommTick; - - max_sa = sa2; - } - } - } - } - } - } - - return max_sa; -} - -// Purge the IPsec SA -void PurgeIPsecSa(IKE_SERVER *ike, IPSECSA *sa) -{ - UINT i; - IPSECSA *other_sa; - // Validate arguments - if (ike == NULL || sa == NULL) - { - return; - } - - other_sa = GetOtherLatestIPsecSa(ike, sa); - - // Rewrite the pairing partner by looking for IPsec SA that are paired - for (i = 0;i < LIST_NUM(ike->IPsecSaList);i++) - { - IPSECSA *sa2 = LIST_DATA(ike->IPsecSaList, i); - - if (sa2->PairIPsecSa == sa) - { - sa2->PairIPsecSa = other_sa; - } - } - - // Rewrite the IKE_CLIENT using this IPsec SA to use alternate - for (i = 0;i < LIST_NUM(ike->ClientList);i++) - { - IKE_CLIENT *c = LIST_DATA(ike->ClientList, i); - - if (c->CurrentIpSecSaRecv == sa) - { - c->CurrentIpSecSaRecv = other_sa; - } - - if (c->CurrentIpSecSaSend == sa) - { - c->CurrentIpSecSaSend = other_sa; - } - } - - Delete(ike->IPsecSaList, sa); - FreeIPsecSa(sa); -} - -// Remove the IKE SA -void PurgeIkeSa(IKE_SERVER *ike, IKE_SA *sa) -{ - IKE_SA *other_sa; - UINT i; - // Validate arguments - if (ike == NULL || sa == NULL) - { - return; - } - - Debug("Purging IKE SA %I64u-%I64u\n", sa->InitiatorCookie, sa->ResponderCookie); - - // Rewrite to alternative IKE_SA of all IPsec SA that are using this IKE_SA - other_sa = GetOtherLatestIkeSa(ike, sa); - - for (i = 0;i < LIST_NUM(ike->IPsecSaList);i++) - { - IPSECSA *ipsec_sa = LIST_DATA(ike->IPsecSaList, i); - - if (ipsec_sa->IkeSa == sa) - { - if (other_sa == NULL) - { - // Remove this IPsec SA because there is no alternative IKE_SA - Debug(" Deleting IPsec SA 0x%X of this IKE SA (no alternatives)\n", ipsec_sa->Spi); - MarkIPsecSaAsDeleted(ike, ipsec_sa); - ipsec_sa->IkeSa = NULL; - } - else - { - // Replace to the alternative IKE_SA - Debug(" Replacing IKE SA of IPsec SA 0x%X from %I64u-%I64u to %I64u-%I64u\n", ipsec_sa->Spi, - sa->InitiatorCookie, sa->ResponderCookie, - other_sa->InitiatorCookie, other_sa->ResponderCookie); - ipsec_sa->IkeSa = other_sa; - } - } - } - - // Substitute the IKE_SA of all IKE_CLIENT that are using this IKE_SA with alternative - for (i = 0;i < LIST_NUM(ike->ClientList);i++) - { - IKE_CLIENT *c = LIST_DATA(ike->ClientList, i); - - if (c->CurrentIkeSa == sa) - { - c->CurrentIkeSa = other_sa; - } - } - - Delete(ike->IkeSaList, sa); - FreeIkeSa(sa); -} - -// Purge the IKE_CLIENT -void PurgeIkeClient(IKE_SERVER *ike, IKE_CLIENT *c) -{ - UINT i; - // Validate arguments - if (ike == NULL || c == NULL) - { - return; - } - - // Delete all of IPsec SA and IKE SA that belong to this IKE Client - for (i = 0;i < LIST_NUM(ike->IkeSaList);i++) - { - IKE_SA *sa = LIST_DATA(ike->IkeSaList, i); - - if (sa->IkeClient == c) - { - MarkIkeSaAsDeleted(ike, sa); - } - } - for (i = 0;i < LIST_NUM(ike->IPsecSaList);i++) - { - IPSECSA *sa = LIST_DATA(ike->IPsecSaList, i); - - if (sa->IkeClient == c) - { - MarkIPsecSaAsDeleted(ike, sa); - } - } - - Delete(ike->ClientList, c); - FreeIkeClient(ike, c); -} - -// Remove the SA that has been marked to delete -void PurgeDeletingSAsAndClients(IKE_SERVER *ike) -{ - UINT i; - LIST *o = NULL; - // Validate arguments - if (ike == NULL) - { - return; - } - - for (i = 0;i < LIST_NUM(ike->IkeSaList);i++) - { - IKE_SA *sa = LIST_DATA(ike->IkeSaList, i); - if (sa->Deleting) - { - if (o == NULL) - { - o = NewListFast(NULL); - } - - Add(o, sa); - } - } - - for (i = 0;i < LIST_NUM(o);i++) - { - IKE_SA *sa = LIST_DATA(o, i); - - PurgeIkeSa(ike, sa); - } - - ReleaseList(o); - - o = NULL; - - for (i = 0;i < LIST_NUM(ike->IPsecSaList);i++) - { - IPSECSA *sa = LIST_DATA(ike->IPsecSaList, i); - if (sa->Deleting) - { - if (o == NULL) - { - o = NewListFast(NULL); - } - - Add(o, sa); - } - } - - for (i = 0;i < LIST_NUM(o);i++) - { - IPSECSA *sa = LIST_DATA(o, i); - - PurgeIPsecSa(ike, sa); - } - - ReleaseList(o); - - o = NULL; - - for (i = 0;i < LIST_NUM(ike->ClientList);i++) - { - IKE_CLIENT *c = LIST_DATA(ike->ClientList, i); - if (c->Deleting) - { - if (o == NULL) - { - o = NewListFast(NULL); - } - - Add(o, c); - } - } - - for (i = 0;i < LIST_NUM(o);i++) - { - IKE_CLIENT *c = LIST_DATA(o, i); - - PurgeIkeClient(ike, c); - } - - ReleaseList(o); -} - -// IKE interrupt process -void ProcessIKEInterrupts(IKE_SERVER *ike) -{ - UINT i; - // Validate arguments - if (ike == NULL) - { - return; - } - - for (i = 0;i < LIST_NUM(ike->ClientList);i++) - { - IKE_CLIENT *c = LIST_DATA(ike->ClientList, i); - - c->CurrentExpiresSoftTick_CtoS = 0; - c->CurrentExpiresSoftTick_StoC = 0; - c->CurrentNumEstablishedIPsecSA_CtoS = 0; - c->CurrentNumEstablishedIPsecSA_StoC = 0; - c->CurrentNumHealtyIPsecSA_CtoS = 0; - c->CurrentNumHealtyIPsecSA_StoC = 0; - } - - // Packet retransmission by scanning all IKE SA - for (i = 0;i < LIST_NUM(ike->IkeSaList);i++) - { - IKE_SA *sa = LIST_DATA(ike->IkeSaList, i); - - if (sa->SendBuffer != NULL) - { - if (ike->Now >= sa->NextSendTick) - { - IKE_CLIENT *c = sa->IkeClient; - - IkeSendUdpPacket(ike, IKE_UDP_TYPE_ISAKMP, &c->ServerIP, c->ServerPort, &c->ClientIP, c->ClientPort, - Clone(sa->SendBuffer->Buf, sa->SendBuffer->Size), sa->SendBuffer->Size); - - sa->NextSendTick += (UINT64)(IKE_SA_RESEND_INTERVAL); - - AddInterrupt(ike->Interrupts, sa->NextSendTick); - - if (sa->NumResends != 0) - { - sa->NumResends--; - if (sa->NumResends == 0) - { - sa->NextSendTick = 0; - FreeBuf(sa->SendBuffer); - sa->SendBuffer = NULL; - } - } - } - } - - // Remove those of non-communication - if (sa->IkeClient == NULL || (sa->IkeClient->CurrentIkeSa != sa)) - { - // When the IKE_CLIENT don't point this - if (sa->Established == false) - { - // Make time-out in a short time when it is not established - if ((sa->LastCommTick + (UINT64)IKE_TIMEOUT_FOR_IKE_CLIENT_FOR_NOT_ESTABLISHED) <= ike->Now) - { - WHERE; - MarkIkeSaAsDeleted(ike, sa); - } - } - else - { - // Timeout in a long time in the case of established - if ((sa->LastCommTick + (UINT64)IKE_TIMEOUT_FOR_IKE_CLIENT) <= ike->Now) - { - WHERE; - MarkIkeSaAsDeleted(ike, sa); - } - } - } - } - - // Packet retransmission by scanning all IPsec SA - for (i = 0;i < LIST_NUM(ike->IPsecSaList);i++) - { - IPSECSA *sa = LIST_DATA(ike->IPsecSaList, i); - IKE_CLIENT *c = sa->IkeClient; - - if (sa->SendBuffer != NULL) - { - if (ike->Now >= sa->NextSendTick) - { - IKE_CLIENT *c = sa->IkeClient; - - IkeSendUdpPacket(ike, IKE_UDP_TYPE_ISAKMP, &c->ServerIP, c->ServerPort, &c->ClientIP, c->ClientPort, - Clone(sa->SendBuffer->Buf, sa->SendBuffer->Size), sa->SendBuffer->Size); - - sa->NextSendTick += (UINT64)(IKE_SA_RESEND_INTERVAL); - - AddInterrupt(ike->Interrupts, sa->NextSendTick); - - if (sa->NumResends != 0) - { - sa->NumResends--; - - if (sa->NumResends == 0) - { - sa->NextSendTick = 0; - FreeBuf(sa->SendBuffer); - sa->SendBuffer = NULL; - } - } - } - } - - if (sa->Established && sa->Deleting == false && c != NULL) - { - // Get the flexible expiration date of SA for each IKE_CLIENT - if (sa->ServerToClient) - { - c->CurrentExpiresSoftTick_StoC = MAX(c->CurrentExpiresSoftTick_StoC, sa->ExpiresSoftTick); - c->CurrentNumEstablishedIPsecSA_StoC++; - - if (sa->ExpiresSoftTick == 0 || sa->ExpiresSoftTick > ike->Now) - { - c->CurrentNumHealtyIPsecSA_StoC++; - } - } - else - { - c->CurrentExpiresSoftTick_CtoS = MAX(c->CurrentExpiresSoftTick_CtoS, sa->ExpiresSoftTick); - c->CurrentNumEstablishedIPsecSA_CtoS++; - - if (sa->ExpiresSoftTick == 0 || sa->ExpiresSoftTick > ike->Now) - { - c->CurrentNumHealtyIPsecSA_CtoS++; - } - } - } - - // Remove those of non-communication - if (sa->IkeClient == NULL || (sa->IkeClient->CurrentIpSecSaRecv != sa && sa->IkeClient->CurrentIpSecSaSend != sa)) - { - // When the IKE_CLIENT don't point this - UINT64 last_comm_tick = sa->LastCommTick; - - if (sa->ServerToClient && sa->PairIPsecSa != NULL) - { - last_comm_tick = sa->PairIPsecSa->LastCommTick; - } - - if (sa->Established == false) - { - // Make time-out in a short time when it is not established - if ((last_comm_tick + (UINT64)IKE_TIMEOUT_FOR_IKE_CLIENT_FOR_NOT_ESTABLISHED) <= ike->Now) - { - WHERE; - MarkIPsecSaAsDeleted(ike, sa); - } - } - else - { - // Timeout in a long time in the case of established - if ((last_comm_tick + (UINT64)IKE_TIMEOUT_FOR_IKE_CLIENT) <= ike->Now) - { - WHERE; - MarkIPsecSaAsDeleted(ike, sa); - } - } - } - } - - // IKE_CLIENT scanning process - for (i = 0;i < LIST_NUM(ike->ClientList);i++) - { - IKE_CLIENT *c = LIST_DATA(ike->ClientList, i); - UINT64 tick; - UCHAR data[1]; - bool need_qm = false; - bool need_qm_hard = false; - UINT64 qm_soft_tick = 0; - - // Determine whether it is necessary to start a new Quick Mode - if (c->CurrentExpiresSoftTick_StoC != 0 && ike->Now >= c->CurrentExpiresSoftTick_StoC) - { - need_qm = true; - qm_soft_tick = MAX(qm_soft_tick, c->CurrentExpiresSoftTick_StoC); - } - - if (c->CurrentExpiresSoftTick_CtoS != 0 && ike->Now >= c->CurrentExpiresSoftTick_CtoS) - { - need_qm = true; - qm_soft_tick = MAX(qm_soft_tick, c->CurrentExpiresSoftTick_StoC); - } - - if (c->CurrentNumHealtyIPsecSA_CtoS == 0 || c->CurrentNumHealtyIPsecSA_StoC == 0) - { - need_qm = true; - need_qm_hard = true; - } - - if (c->StartQuickModeAsSoon) - { - need_qm = true; - need_qm_hard = true; - } - - if (c->Deleting || c->CurrentIkeSa == NULL || c->CurrentIkeSa->Deleting) - { - need_qm = false; - need_qm_hard = true; - } - - if (need_qm) - { - if (c->StartQuickModeAsSoon || ((c->LastQuickModeStartTick + (UINT64)IKE_QUICKMODE_START_INTERVAL) <= ike->Now)) - { - // Start the Quick Mode - Debug("IKE_CLIENT 0x%X: Begin QuickMode\n", c); - c->StartQuickModeAsSoon = false; - c->LastQuickModeStartTick = ike->Now; - - AddInterrupt(ike->Interrupts, c->LastQuickModeStartTick + (UINT64)IKE_QUICKMODE_START_INTERVAL); - - StartQuickMode(ike, c); - } - } - - if (need_qm_hard) - { - if (c->NeedQmBeginTick == 0) - { - c->NeedQmBeginTick = ike->Now; - } - } - else - { - c->NeedQmBeginTick = 0; - } - - if (((c->LastCommTick + (UINT64)IKE_TIMEOUT_FOR_IKE_CLIENT) <= ike->Now) || - ((c->CurrentIkeSa == NULL && c->CurrentIpSecSaRecv == NULL && c->CurrentIpSecSaSend == NULL) && (c->LastCommTick + (UINT64)IKE_TIMEOUT_FOR_IKE_CLIENT_FOR_NOT_ESTABLISHED) <= ike->Now) || - (c->NeedQmBeginTick != 0 && ((c->NeedQmBeginTick + (UINT64)IKE_QUICKMODE_FAILED_TIMEOUT) <= ike->Now))) - { - // Remove IKE_CLIENT not communicating for a certain period of time - WHERE; - MarkIkeClientAsDeleted(ike, c); - } - - // L2TP processing - if (c->L2TP != NULL) - { - IPsecIkeClientManageL2TPServer(ike, c); - - // Interrupt processing occurs - L2TPProcessInterrupts(c->L2TP); - - // Packet transmission - IPsecIkeClientSendL2TPPackets(ike, c, c->L2TP); - } - - // EtherIP processing - if (c->EtherIP != NULL) - { - IPsecIkeClientManageEtherIPServer(ike, c); - - // Interrupt processing occurs - EtherIPProcInterrupts(c->EtherIP); - - // Packet transmission - IPsecIkeClientSendEtherIPPackets(ike, c, c->EtherIP); - } - - // KeepAlive transmission - tick = MAX(c->LastCommTick + (UINT64)IKE_INTERVAL_UDP_KEEPALIVE, c->NextKeepAliveSendTick); - - if (tick <= ike->Now && c->ServerPort == IPSEC_PORT_IPSEC_ESP_UDP) - { - c->NextKeepAliveSendTick = ike->Now + (UINT64)IKE_INTERVAL_UDP_KEEPALIVE; - - AddInterrupt(ike->Interrupts, c->NextKeepAliveSendTick); - - Zero(data, sizeof(data)); - data[0] = 0xff; - - IkeSendUdpPacket(ike, IKE_UDP_KEEPALIVE, &c->ServerIP, c->ServerPort, &c->ClientIP, c->ClientPort, Clone(data, sizeof(data)), sizeof(data)); - } - - // DPD transmission - if (c->NextDpdSendTick == 0 || c->NextDpdSendTick <= ike->Now) - { - if (c->CurrentIkeSa != NULL && c->CurrentIkeSa->Established) - { - if (c->CurrentIkeSa->Caps.DpdRfc3706) - { - c->NextDpdSendTick = ike->Now + (UINT64)IKE_INTERVAL_DPD_KEEPALIVE; - - AddInterrupt(ike->Interrupts, c->NextDpdSendTick); - - SendInformationalExchangePacket(ike, c, - IkeNewNoticeDpdPayload(false, c->CurrentIkeSa->InitiatorCookie, c->CurrentIkeSa->ResponderCookie, - c->DpdSeqNo++)); - } - } - } - } - - do - { - ike->StateHasChanged = false; - - // Deletion process - PurgeDeletingSAsAndClients(ike); - } - while (ike->StateHasChanged); - - // Maintenance of the thread list - MaintainThreadList(ike->ThreadList); - /*Debug("ike->ThreadList: %u\n", LIST_NUM(ike->ThreadList)); - { - UINT i; - for (i = 0;i < LIST_NUM(ike->ThreadList);i++) - { - THREAD *t = LIST_DATA(ike->ThreadList, i); - - Debug(" Thread %u: 0x%p ID: %u Stop: %u Ref: %u\n", i, t, t->ThreadId, t->Stopped, t->ref->c->c); - } - }*/ -} - -// Stop the IKE server -void StopIKEServer(IKE_SERVER *ike) -{ - // Validate arguments - if (ike == NULL) - { - return; - } -} - -// Set the socket events in IKE server -void SetIKEServerSockEvent(IKE_SERVER *ike, SOCK_EVENT *e) -{ - // Validate arguments - if (ike == NULL) - { - return; - } - - if (e != NULL) - { - AddRef(e->ref); - } - - if (ike->SockEvent != NULL) - { - ReleaseSockEvent(ike->SockEvent); - } - - ike->SockEvent = e; -} - -// Release the IKE client -void FreeIkeClient(IKE_SERVER *ike, IKE_CLIENT *c) -{ - // Validate arguments - if (c == NULL || ike == NULL) - { - return; - } - - if (c->L2TP != NULL) - { - StopL2TPServer(c->L2TP, true); - FreeL2TPServer(c->L2TP); - } - - if (c->EtherIP != NULL) - { - ReleaseEtherIPServer(c->EtherIP); - } - - FreeBuf(c->SendID1_Buf); - FreeBuf(c->SendID2_Buf); - - Free(c); -} - -// Release the IPsec SA -void FreeIPsecSa(IPSECSA *sa) -{ - // Validate arguments - if (sa == NULL) - { - return; - } - - IkeFreeKey(sa->CryptoKey); - - FreeBuf(sa->SendBuffer); - - FreeBuf(sa->InitiatorRand); - FreeBuf(sa->ResponderRand); - - FreeBuf(sa->SharedKey); - - IkeDhFreeCtx(sa->Dh); - - Free(sa); -} - -// Release the IKE SA -void FreeIkeSa(IKE_SA *sa) -{ - // Validate arguments - if (sa == NULL) - { - return; - } - - FreeBuf(sa->SendBuffer); - - FreeBuf(sa->InitiatorRand); - FreeBuf(sa->ResponderRand); - FreeBuf(sa->DhSharedKey); - FreeBuf(sa->YourIDPayloadForAM); - - FreeBuf(sa->GXi); - FreeBuf(sa->GXr); - - FreeBuf(sa->SAi_b); - - IkeFreeKey(sa->CryptoKey); - - Free(sa); -} - -// Release the IKE server -void FreeIKEServer(IKE_SERVER *ike) -{ - UINT i; - // Validate arguments - if (ike == NULL) - { - return; - } - - IPsecLog(ike, NULL, NULL, NULL, "LI_STOPPING"); - - for (i = 0;i < LIST_NUM(ike->SendPacketList);i++) - { - UDPPACKET *udp = LIST_DATA(ike->SendPacketList, i); - - FreeUdpPacket(udp); - } - - ReleaseList(ike->SendPacketList); - - Debug("Num of IPsec SAs: %u\n", LIST_NUM(ike->IPsecSaList)); - IPsecLog(ike, NULL, NULL, NULL, "LI_NUM_IPSEC_SA", LIST_NUM(ike->IPsecSaList)); - - for (i = 0;i < LIST_NUM(ike->IPsecSaList);i++) - { - IPSECSA *sa = LIST_DATA(ike->IPsecSaList, i); - - FreeIPsecSa(sa); - } - - ReleaseList(ike->IPsecSaList); - - Debug("Num of IKE SAs: %u\n", LIST_NUM(ike->IkeSaList)); - IPsecLog(ike, NULL, NULL, NULL, "LI_NUM_IKE_SA", LIST_NUM(ike->IkeSaList)); - - for (i = 0;i < LIST_NUM(ike->IkeSaList);i++) - { - IKE_SA *sa = LIST_DATA(ike->IkeSaList, i); - - FreeIkeSa(sa); - } - - ReleaseList(ike->IkeSaList); - - Debug("Num of IKE_CLIENTs: %u\n", LIST_NUM(ike->ClientList)); - IPsecLog(ike, NULL, NULL, NULL, "LI_NUM_IKE_CLIENTS", LIST_NUM(ike->ClientList)); - - for (i = 0;i < LIST_NUM(ike->ClientList);i++) - { - IKE_CLIENT *c = LIST_DATA(ike->ClientList, i); - - FreeIkeClient(ike, c); - } - - ReleaseList(ike->ClientList); - - ReleaseSockEvent(ike->SockEvent); - - IPsecLog(ike, NULL, NULL, NULL, "LI_STOP"); - - ReleaseCedar(ike->Cedar); - - FreeIkeEngine(ike->Engine); - - Debug("FreeThreadList()...\n"); - FreeThreadList(ike->ThreadList); - Debug("FreeThreadList() Done.\n"); - - Free(ike); -} - -// Create a new IKE server -IKE_SERVER *NewIKEServer(CEDAR *cedar, IPSEC_SERVER *ipsec) -{ - IKE_SERVER *ike; - // Validate arguments - if (cedar == NULL) - { - return NULL; - } - - ike = ZeroMalloc(sizeof(IKE_SERVER)); - - ike->Cedar = cedar; - AddRef(cedar->ref); - - ike->IPsec = ipsec; - - ike->Now = Tick64(); - - ike->SendPacketList = NewList(NULL); - - ike->IkeSaList = NewList(CmpIkeSa); - - ike->IPsecSaList = NewList(CmpIPsecSa); - - ike->ClientList = NewList(CmpIkeClient); - - ike->Engine = NewIkeEngine(); - - ike->ThreadList = NewThreadList(); - - IPsecLog(ike, NULL, NULL, NULL, "LI_START"); - - return ike; -} - - - +// SoftEther VPN Source Code - Developer Edition Master Branch +// Cedar Communication Module + + +// Proto_IKE.c +// IKE (ISAKMP) and ESP protocol stack + +#include "CedarPch.h" + +//#define RAW_DEBUG + +// Processing of IKE received packet +void ProcIKEPacketRecv(IKE_SERVER *ike, UDPPACKET *p) +{ + // Validate arguments + if (ike == NULL || p == NULL) + { + return; + } + + if (p->Type == IKE_UDP_TYPE_ISAKMP) + { + // ISAKMP (IKE) packet + IKE_PACKET *header; + + header = ParseIKEPacketHeader(p); + if (header == NULL) + { + return; + } + + //Debug("InitiatorCookie: %I64u, ResponderCookie: %I64u\n", header->InitiatorCookie, header->ResponderCookie); + + switch (header->ExchangeType) + { + case IKE_EXCHANGE_TYPE_MAIN: // Main mode + ProcIkeMainModePacketRecv(ike, p, header); + break; + + case IKE_EXCHANGE_TYPE_AGGRESSIVE: // Aggressive mode + if (ike->Cedar->Server->DisableIPsecAggressiveMode == false) + { + ProcIkeAggressiveModePacketRecv(ike, p, header); + } + break; + + case IKE_EXCHANGE_TYPE_QUICK: // Quick mode + ProcIkeQuickModePacketRecv(ike, p, header); + break; + + case IKE_EXCHANGE_TYPE_INFORMATION: // Information exchange + ProcIkeInformationalExchangePacketRecv(ike, p, header); + break; + } + + IkeFree(header); + } + else if (p->Type == IKE_UDP_TYPE_ESP) + { + // ESP packet + ProcIPsecEspPacketRecv(ike, p); + } +} + +// Send a packet via IPsec +void IPsecSendPacketByIPsecSa(IKE_SERVER *ike, IPSECSA *sa, UCHAR *data, UINT data_size, UCHAR protocol_id) +{ + bool is_tunnel_mode; + IKE_CLIENT *c; + // Validate arguments + if (ike == NULL || sa == NULL || data == NULL || data_size == 0) + { + return; + } + + is_tunnel_mode = IsIPsecSaTunnelMode(sa); + + c = sa->IkeClient; + + if (c == NULL) + { + return; + } + + if (is_tunnel_mode) + { + // Add an IPv4 / IPv6 header in the case of tunnel mode + if (IsZeroIP(&c->TunnelModeClientIP) == false || IsZeroIP(&c->TunnelModeServerIP) == false) + { + BUF *b; + UCHAR esp_proto_id; + + b = NewBuf(); + + if (IsIP4(&c->TunnelModeClientIP)) + { + // IPv4 header + IPV4_HEADER h; + + h.VersionAndHeaderLength = 0; + h.TypeOfService = 0; + IPV4_SET_VERSION(&h, 4); + IPV4_SET_HEADER_LEN(&h, sizeof(IPV4_HEADER) / 4); + h.TotalLength = Endian16((USHORT)(data_size + sizeof(IPV4_HEADER))); + h.Identification = Endian16(c->TunnelSendIpId++); + h.FlagsAndFragmentOffset[0] = h.FlagsAndFragmentOffset[1] = 0; + h.TimeToLive = DEFAULT_IP_TTL; + h.Protocol = protocol_id; + h.SrcIP = IPToUINT(&c->TunnelModeServerIP); + h.DstIP = IPToUINT(&c->TunnelModeClientIP); + h.Checksum = 0; + h.Checksum = IpChecksum(&h, sizeof(IPV4_HEADER)); + + WriteBuf(b, &h, sizeof(IPV4_HEADER)); + + esp_proto_id = IKE_PROTOCOL_ID_IPV4; + } + else + { + // IPv6 header + IPV6_HEADER h; + + Zero(&h, sizeof(h)); + h.VersionAndTrafficClass1 = 0; + IPV6_SET_VERSION(&h, 6); + h.TrafficClass2AndFlowLabel1 = 0; + h.FlowLabel2 = h.FlowLabel3 = 0; + h.PayloadLength = Endian16(data_size); + h.NextHeader = protocol_id; + h.HopLimit = 64; + Copy(h.SrcAddress.Value, c->TunnelModeServerIP.ipv6_addr, 16); + Copy(h.DestAddress.Value, c->TunnelModeClientIP.ipv6_addr, 16); + + WriteBuf(b, &h, sizeof(IPV6_HEADER)); + + esp_proto_id = IKE_PROTOCOL_ID_IPV6; + } + + WriteBuf(b, data, data_size); + + IPsecSendPacketByIPsecSaInner(ike, sa, b->Buf, b->Size, esp_proto_id); + + FreeBuf(b); + } + } + else + { + // Send as it is in the case of transport mode + IPsecSendPacketByIPsecSaInner(ike, sa, data, data_size, protocol_id); + } +} +void IPsecSendPacketByIPsecSaInner(IKE_SERVER *ike, IPSECSA *sa, UCHAR *data, UINT data_size, UCHAR protocol_id) +{ + UINT esp_size; + UINT encrypted_payload_size; + UCHAR *esp; + UINT i; + UINT size_of_padding; + IKE_CRYPTO_PARAM cp; + BUF *enc; + IKE_CLIENT *c; + // Validate arguments + if (ike == NULL || sa == NULL || data == NULL || data_size == 0) + { + return; + } + + c = sa->IkeClient; + if (c == NULL) + { + return; + } + + // Calculate the payload size after encryption + encrypted_payload_size = data_size + 2; + if ((encrypted_payload_size % sa->TransformSetting.Crypto->BlockSize) != 0) + { + encrypted_payload_size = ((encrypted_payload_size / sa->TransformSetting.Crypto->BlockSize) + 1) * sa->TransformSetting.Crypto->BlockSize; + } + size_of_padding = encrypted_payload_size - data_size - 2; + + // Calculate the size of the ESP packet + esp_size = sizeof(UINT) * 2 + sa->TransformSetting.Crypto->BlockSize + encrypted_payload_size + IKE_ESP_HASH_SIZE; + + // Build the ESP packet + esp = Malloc(esp_size + IKE_MAX_HASH_SIZE); + + // SPI + WRITE_UINT(esp, sa->Spi); + + // Sequence number + sa->CurrentSeqNo++; + WRITE_UINT(esp + sizeof(UINT), sa->CurrentSeqNo); + + // IV + Copy(esp + sizeof(UINT) * 2, sa->EspIv, sa->TransformSetting.Crypto->BlockSize); + + // Payload data + Copy(esp + sizeof(UINT) * 2 + sa->TransformSetting.Crypto->BlockSize, data, data_size); + + // Padding + for (i = 0;i < size_of_padding;i++) + { + esp[sizeof(UINT) * 2 + sa->TransformSetting.Crypto->BlockSize + data_size + i] = (UCHAR)(i + 1); + } + + // Padding length + esp[sizeof(UINT) * 2 + sa->TransformSetting.Crypto->BlockSize + data_size + size_of_padding] = (UCHAR)size_of_padding; + + // Next header number + esp[sizeof(UINT) * 2 + sa->TransformSetting.Crypto->BlockSize + data_size + size_of_padding + 1] = protocol_id; + + // Encryption + Copy(cp.Iv, sa->EspIv, sa->TransformSetting.Crypto->BlockSize); + cp.Key = sa->CryptoKey; + + enc = IkeEncrypt(esp + sizeof(UINT) * 2 + sa->TransformSetting.Crypto->BlockSize, encrypted_payload_size, &cp); + if (enc != NULL) + { + bool start_qm = false; + UINT server_port = c->ServerPort; + UINT client_port = c->ClientPort; + + // Overwrite the encrypted result + Copy(esp + sizeof(UINT) * 2 + sa->TransformSetting.Crypto->BlockSize, enc->Buf, encrypted_payload_size); + + FreeBuf(enc); + + // Calculate the HMAC + IkeHMac(sa->TransformSetting.Hash, + esp + sizeof(UINT) * 2 + sa->TransformSetting.Crypto->BlockSize + encrypted_payload_size, + sa->HashKey, + sa->TransformSetting.Hash->HashSize, + esp, + sizeof(UINT) * 2 + sa->TransformSetting.Crypto->BlockSize + encrypted_payload_size); + + //*(UCHAR *)(esp + sizeof(UINT) * 2 + sa->TransformSetting.Crypto->BlockSize + encrypted_payload_size) = 0xff; + + if (sa->TransformSetting.CapsuleMode == IKE_P2_CAPSULE_TRANSPORT || + sa->TransformSetting.CapsuleMode == IKE_P2_CAPSULE_TUNNEL) + { + server_port = client_port = IPSEC_PORT_IPSEC_ESP_RAW; + } + + // Add the completed packet to the transmission list + IkeSendUdpPacket(ike, IKE_UDP_TYPE_ESP, &c->ServerIP, server_port, &c->ClientIP, client_port, + esp, esp_size); + + // Feedback the IV + Copy(sa->EspIv, cp.NextIv, sa->TransformSetting.Crypto->BlockSize); + + sa->TotalSize += esp_size; + + if (sa->CurrentSeqNo >= 0xf0000000) + { + start_qm = true; + } + + if (sa->TransformSetting.LifeKilobytes != 0) + { + UINT64 hard_size = (UINT64)sa->TransformSetting.LifeKilobytes * (UINT64)1000; + UINT64 soft_size = hard_size * (UINT64)2 / (UINT64)3; + + if (sa->TotalSize >= soft_size) + { + start_qm = true; + } + } + + if (start_qm) + { + if (sa->StartQM_FlagSet == false) + { + sa->StartQM_FlagSet = true; + c->StartQuickModeAsSoon = true; + } + } + } + else + { + // Encryption failure + Free(esp); + } +} +void IPsecSendPacketByIkeClient(IKE_SERVER *ike, IKE_CLIENT *c, UCHAR *data, UINT data_size, UCHAR protocol_id) +{ + // Validate arguments + if (ike == NULL || c == NULL || data == NULL || data_size == 0) + { + return; + } + + if (c->CurrentIpSecSaSend == NULL) + { + return; + } + + IPsecSendPacketByIPsecSa(ike, c->CurrentIpSecSaSend, data, data_size, protocol_id); +} + +// Send an UDP packet via IPsec +void IPsecSendUdpPacket(IKE_SERVER *ike, IKE_CLIENT *c, UINT src_port, UINT dst_port, UCHAR *data, UINT data_size) +{ + UCHAR *udp; + UINT udp_size; + UDP_HEADER *u; + UCHAR tmp1600[1600]; + bool no_free = false; + // Validate arguments + if (ike == NULL || c == NULL || data == NULL || data_size == 0) + { + return; + } + + // Build an UDP packet + udp_size = sizeof(UDP_HEADER) + data_size; + + if (udp_size > sizeof(tmp1600)) + { + udp = Malloc(udp_size); + } + else + { + udp = tmp1600; + no_free = true; + } + + // UDP header + u = (UDP_HEADER *)udp; + u->SrcPort = Endian16(src_port); + u->DstPort = Endian16(dst_port); + u->PacketLength = Endian16(udp_size); + u->Checksum = 0; + + //Debug("IPsec UDP Send: %u -> %u %u\n", src_port, dst_port, data_size); +#ifdef RAW_DEBUG + IPsecIkeSendUdpForDebug(IPSEC_PORT_L2TP, 1, data, data_size); +#endif // RAW_DEBUG + + // Payload + Copy(udp + sizeof(UDP_HEADER), data, data_size); + + if (IsIP6(&c->ClientIP)) + { + if (IsIPsecSaTunnelMode(c->CurrentIpSecSaSend) == false) + { + u->Checksum = CalcChecksumForIPv6((IPV6_ADDR *)c->TransportModeServerIP.ipv6_addr, + (IPV6_ADDR *)c->TransportModeClientIP.ipv6_addr, + IP_PROTO_UDP, + u, + udp_size, 0); + } + else + { + u->Checksum = CalcChecksumForIPv6((IPV6_ADDR *)c->TunnelModeServerIP.ipv6_addr, + (IPV6_ADDR *)c->TunnelModeClientIP.ipv6_addr, + IP_PROTO_UDP, + u, + udp_size, 0); + } + } + + IPsecSendPacketByIkeClient(ike, c, udp, udp_size, IP_PROTO_UDP); + + if (no_free == false) + { + Free(udp); + } +} + +// Get whether the specified IPsec SA is in tunnel mode +bool IsIPsecSaTunnelMode(IPSECSA *sa) +{ + // Validate arguments + if (sa == NULL) + { + return false; + } + + if (sa->TransformSetting.CapsuleMode == IKE_P2_CAPSULE_TUNNEL || + sa->TransformSetting.CapsuleMode == IKE_P2_CAPSULE_NAT_TUNNEL_1 || + sa->TransformSetting.CapsuleMode == IKE_P2_CAPSULE_NAT_TUNNEL_2) + { + return true; + } + + return false; +} + +// Reception process of ESP packet +void ProcIPsecEspPacketRecv(IKE_SERVER *ike, UDPPACKET *p) +{ + UCHAR *src; + UINT src_size; + UINT spi; + UINT seq; + IPSECSA *ipsec_sa; + IKE_CLIENT *c; + UINT block_size; + UINT hash_size; + bool update_status = false; + UCHAR *iv; + UCHAR *hash; + UCHAR *encrypted_payload_data; + UINT size_of_payload_data; + IKE_CRYPTO_PARAM cp; + BUF *dec; + UCHAR calced_hash[IKE_MAX_HASH_SIZE]; + bool is_tunnel_mode = false; + // Validate arguments + if (ike == NULL || p == NULL) + { + return; + } + + src = (UCHAR *)p->Data; + src_size = p->Size; + + if (p->DestPort == IPSEC_PORT_IPSEC_ESP_RAW) + { + if (IsIP4(&p->DstIP)) + { + // Skip the IP header when received in Raw mode (only in the case of IPv4) + UINT ip_header_size = GetIpHeaderSize(src, src_size); + + src += ip_header_size; + src_size -= ip_header_size; + } + } + + // Get the SPI + if (src_size < sizeof(UINT)) + { + return; + } + + spi = READ_UINT(src + 0); + if (spi == 0) + { + return; + } + + // Get the sequence number + if (src_size < (sizeof(UINT) * 2)) + { + return; + } + seq = READ_UINT(src + sizeof(UINT)); + + // Search and retrieve the IPsec SA from SPI + ipsec_sa = SearchClientToServerIPsecSaBySpi(ike, spi); + if (ipsec_sa == NULL) + { + // Invalid SPI + UINT64 init_cookie = Rand64(); + UINT64 resp_cookie = 0; + IKE_CLIENT *c = NULL; + IKE_CLIENT t; + + + Copy(&t.ClientIP, &p->SrcIP, sizeof(IP)); + t.ClientPort = p->SrcPort; + Copy(&t.ServerIP, &p->DstIP, sizeof(IP)); + t.ServerPort = p->DestPort; + t.CurrentIkeSa = NULL; + + if (p->DestPort == IPSEC_PORT_IPSEC_ESP_RAW) + { + t.ClientPort = t.ServerPort = IPSEC_PORT_IPSEC_ISAKMP; + } + + c = Search(ike->ClientList, &t); + + if (c != NULL && c->CurrentIkeSa != NULL) + { + init_cookie = c->CurrentIkeSa->InitiatorCookie; + resp_cookie = c->CurrentIkeSa->ResponderCookie; + } + + SendInformationalExchangePacketEx(ike, (c == NULL ? &t : c), IkeNewNoticeErrorInvalidSpiPayload(spi), false, + init_cookie, resp_cookie); + + SendDeleteIPsecSaPacket(ike, (c == NULL ? &t : c), spi); + return; + } + + is_tunnel_mode = IsIPsecSaTunnelMode(ipsec_sa); + + c = ipsec_sa->IkeClient; + if (c == NULL) + { + return; + } + + block_size = ipsec_sa->TransformSetting.Crypto->BlockSize; + hash_size = IKE_ESP_HASH_SIZE; + + // Get the IV + if (src_size < (sizeof(UINT) * 2 + block_size + hash_size + block_size)) + { + return; + } + iv = src + sizeof(UINT) * 2; + + // Get the hash + hash = src + src_size - hash_size; + + // Inspect the HMAC + IkeHMac(ipsec_sa->TransformSetting.Hash, calced_hash, ipsec_sa->HashKey, + ipsec_sa->TransformSetting.Hash->HashSize, src, src_size - hash_size); + + if (Cmp(calced_hash, hash, hash_size) != 0) + { + //Debug("IPsec SA 0x%X: Invalid HMAC Value.\n", ipsec_sa->Spi); + return; + } + + // Get the payload data + encrypted_payload_data = src + sizeof(UINT) * 2 + block_size; + size_of_payload_data = src_size - hash_size - block_size - sizeof(UINT) * 2; + if (size_of_payload_data == 0 || (size_of_payload_data % block_size) != 0) + { + // Payload data don't exist or is not a multiple of block size + return; + } + + // Decrypt the payload data + cp.Key = ipsec_sa->CryptoKey; + Copy(&cp.Iv, iv, block_size); + + dec = IkeDecrypt(encrypted_payload_data, size_of_payload_data, &cp); + if (dec != NULL) + { + UCHAR *dec_data = dec->Buf; + UINT dec_size = dec->Size; + UCHAR size_of_padding = dec_data[dec_size - 2]; + UCHAR next_header = dec_data[dec_size - 1]; + if ((dec_size - 2) >= size_of_padding) + { + UINT orig_size = dec_size - 2 - size_of_padding; + + ipsec_sa->TotalSize += dec_size; + + if (is_tunnel_mode) + { + // Tunnel Mode + if (next_header == IKE_PROTOCOL_ID_IPV4 || next_header == IKE_PROTOCOL_ID_IPV6) + { + // Check the contents by parsing the IPv4 / IPv6 header in the case of tunnel mode + BUF *b = NewBuf(); + static UCHAR src_mac_dummy[6] = {0, 0, 0, 0, 0, 0, }; + static UCHAR dst_mac_dummy[6] = {0, 0, 0, 0, 0, 0, }; + USHORT tpid = Endian16(next_header == IKE_PROTOCOL_ID_IPV4 ? MAC_PROTO_IPV4 : MAC_PROTO_IPV6); + PKT *pkt; + + WriteBuf(b, src_mac_dummy, sizeof(src_mac_dummy)); + WriteBuf(b, dst_mac_dummy, sizeof(dst_mac_dummy)); + WriteBuf(b, &tpid, sizeof(tpid)); + + WriteBuf(b, dec_data, dec_size); + + // Parse + pkt = ParsePacket(b->Buf, b->Size); + +#ifdef RAW_DEBUG + IPsecIkeSendUdpForDebug(IPSEC_PORT_L2TP, 1, b->Buf, b->Size); +#endif // RAW_DEBUG + + if (pkt == NULL) + { + // Parsing failure + dec_data = NULL; + dec_size = 0; + } + else + { + // Parsing success + switch (pkt->TypeL3) + { + case L3_IPV4: + // Save the internal IP address information + UINTToIP(&c->TunnelModeServerIP, pkt->L3.IPv4Header->DstIP); + UINTToIP(&c->TunnelModeClientIP, pkt->L3.IPv4Header->SrcIP); + + if (IPV4_GET_OFFSET(pkt->L3.IPv4Header) == 0) + { + if ((IPV4_GET_FLAGS(pkt->L3.IPv4Header) & 0x01) == 0) + { + if (pkt->L3.IPv4Header->Protocol == IPSEC_IP_PROTO_ETHERIP) + { + // EtherIP + if (ike->IPsec->Services.EtherIP_IPsec) + { + // An EtherIP packet has been received + ProcIPsecEtherIPPacketRecv(ike, c, pkt->IPv4PayloadData, pkt->IPv4PayloadSize, true); + } + } + else if (pkt->L3.IPv4Header->Protocol == IPSEC_IP_PROTO_L2TPV3) + { + // L2TPv3 + if (ike->IPsec->Services.EtherIP_IPsec) + { + // A L2TPv3 packet has been received + ProcL2TPv3PacketRecv(ike, c, pkt->IPv4PayloadData, pkt->IPv4PayloadSize, true); + } + } + } + } + break; + + case L3_IPV6: + // Save the internal IP address information + SetIP6(&c->TunnelModeServerIP, pkt->IPv6HeaderPacketInfo.IPv6Header->DestAddress.Value); + SetIP6(&c->TunnelModeClientIP, pkt->IPv6HeaderPacketInfo.IPv6Header->SrcAddress.Value); + + if (pkt->IPv6HeaderPacketInfo.IsFragment == false) + { + if (pkt->IPv6HeaderPacketInfo.FragmentHeader == NULL || (IPV6_GET_FLAGS(pkt->IPv6HeaderPacketInfo.FragmentHeader) & IPV6_FRAGMENT_HEADER_FLAG_MORE_FRAGMENTS) == 0) + { + if (pkt->IPv6HeaderPacketInfo.Protocol == IPSEC_IP_PROTO_ETHERIP) + { + // EtherIP + if (ike->IPsec->Services.EtherIP_IPsec) + { + // An EtherIP packet has been received + ProcIPsecEtherIPPacketRecv(ike, c, pkt->IPv6HeaderPacketInfo.Payload, pkt->IPv6HeaderPacketInfo.PayloadSize, true); + } + } + else if (pkt->IPv6HeaderPacketInfo.Protocol == IPSEC_IP_PROTO_L2TPV3) + { + // L2TPv3 + if (ike->IPsec->Services.EtherIP_IPsec) + { + // A L2TPv3 packet has been received + ProcL2TPv3PacketRecv(ike, c, pkt->IPv6HeaderPacketInfo.Payload, pkt->IPv6HeaderPacketInfo.PayloadSize, true); + } + } + } + } + break; + } + + FreePacket(pkt); + } + + FreeBuf(b); + } + } + else + { + // Transport mode + if (next_header == IP_PROTO_UDP) + { + if (ike->IPsec->Services.L2TP_IPsec || ike->IPsec->Services.EtherIP_IPsec) + { + // An UDP packet has been received + ProcIPsecUdpPacketRecv(ike, c, dec_data, dec_size); + } + } + else if (next_header == IPSEC_IP_PROTO_ETHERIP) + { + if (ike->IPsec->Services.EtherIP_IPsec) + { + // An EtherIP packet has been received + ProcIPsecEtherIPPacketRecv(ike, c, dec_data, dec_size, false); + } + } + else if (next_header == IPSEC_IP_PROTO_L2TPV3) + { + if (ike->IPsec->Services.EtherIP_IPsec) + { + // A L2TPv3 packet has been received + ProcL2TPv3PacketRecv(ike, c, dec_data, dec_size, false); + } + } + } + + update_status = true; + } + + FreeBuf(dec); + } + + if (update_status) + { + bool start_qm = false; + // Update the status of the client + c->CurrentIpSecSaRecv = ipsec_sa; + if (ipsec_sa->PairIPsecSa != NULL) + { + c->CurrentIpSecSaSend = ipsec_sa->PairIPsecSa; + + if (p->DestPort == IPSEC_PORT_IPSEC_ESP_UDP) + { + IPSECSA *send_sa = c->CurrentIpSecSaSend; + if (send_sa->TransformSetting.CapsuleMode == IKE_P2_CAPSULE_TUNNEL) + { + send_sa->TransformSetting.CapsuleMode = IKE_P2_CAPSULE_NAT_TUNNEL_1; + } + else if (send_sa->TransformSetting.CapsuleMode == IKE_P2_CAPSULE_TRANSPORT) + { + send_sa->TransformSetting.CapsuleMode = IKE_P2_CAPSULE_NAT_TRANSPORT_1; + } + } + } + c->LastCommTick = ike->Now; + ipsec_sa->LastCommTick = ike->Now; + if (ipsec_sa->PairIPsecSa != NULL) + { + ipsec_sa->PairIPsecSa->LastCommTick = ike->Now; + } + + SetIkeClientEndpoint(ike, c, &p->SrcIP, p->SrcPort, &p->DstIP, p->DestPort); + + if (seq >= 0xf0000000) + { + // Execute a QuickMode forcibly since sequence number is going to exhaust + start_qm = true; + } + + if (ipsec_sa->TransformSetting.LifeKilobytes != 0) + { + UINT64 hard_size = (UINT64)ipsec_sa->TransformSetting.LifeKilobytes * (UINT64)1000; + UINT64 soft_size = hard_size * (UINT64)2 / (UINT64)3; + + if (ipsec_sa->TotalSize >= soft_size) + { + // Execute a QuickMode forcibly because the capacity limit is going to exceed + start_qm = true; + } + } + + if (start_qm) + { + if (ipsec_sa->StartQM_FlagSet == false) + { + c->StartQuickModeAsSoon = true; + ipsec_sa->StartQM_FlagSet = true; + } + } + } +} + +// Received the L2TPv3 packet via the IPsec tunnel +void ProcL2TPv3PacketRecv(IKE_SERVER *ike, IKE_CLIENT *c, UCHAR *data, UINT data_size, bool is_tunnel_mode) +{ + UDPPACKET p; + // Validate arguments + if (ike == NULL || c == NULL || data == NULL || data_size == 0) + { + return; + } + + c->IsL2TPOnIPsecTunnelMode = is_tunnel_mode; + + IPsecIkeClientManageL2TPServer(ike, c); + + // Pass the received packet to the L2TP server + p.Type = 0; + p.Data = data; + p.DestPort = IPSEC_PORT_L2TPV3_VIRTUAL; + p.Size = data_size; + + if (is_tunnel_mode) + { + Copy(&p.DstIP, &c->TunnelModeServerIP, sizeof(IP)); + Copy(&p.SrcIP, &c->TunnelModeClientIP, sizeof(IP)); + } + else + { + Copy(&p.DstIP, &c->L2TPServerIP, sizeof(IP)); + Copy(&p.SrcIP, &c->L2TPClientIP, sizeof(IP)); + } + p.SrcPort = IPSEC_PORT_L2TPV3_VIRTUAL; + +#ifdef RAW_DEBUG + IPsecIkeSendUdpForDebug(IPSEC_PORT_L2TP, 1, ((UCHAR *)p.Data) + 4, p.Size - 4); +#endif // RAW_DEBUG + + ProcL2TPPacketRecv(c->L2TP, &p); +} + +// An EtherIP packet has been received via an IPsec tunnel +void ProcIPsecEtherIPPacketRecv(IKE_SERVER *ike, IKE_CLIENT *c, UCHAR *data, UINT data_size, bool is_tunnel_mode) +{ + BLOCK *b; + // Validate arguments + if (ike == NULL || c == NULL || data == NULL || data_size == 0) + { + return; + } + + c->IsEtherIPOnIPsecTunnelMode = is_tunnel_mode; + + IPsecIkeClientManageEtherIPServer(ike, c); + + b = NewBlock(data, data_size, 0); + + EtherIPProcRecvPackets(c->EtherIP, b); + + Free(b); +} + +// An UDP packet has been received via the IPsec tunnel +void ProcIPsecUdpPacketRecv(IKE_SERVER *ike, IKE_CLIENT *c, UCHAR *data, UINT data_size) +{ + UDP_HEADER *u; + UINT payload_size; + UINT src_port, dst_port; + UINT packet_length; + // Validate arguments + if (ike == NULL || c == NULL || data == NULL || data_size == 0) + { + return; + } + + if (data_size <= sizeof(UDP_HEADER)) + { + // There is no UDP header or the data is 0 bytes + return; + } + + // UDP header + u = (UDP_HEADER *)data; + + packet_length = Endian16(u->PacketLength); + + if (packet_length <= sizeof(UDP_HEADER)) + { + return; + } + + payload_size = packet_length - sizeof(UDP_HEADER); + + if (payload_size == 0) + { + // No data + return; + } + + if (data_size < (sizeof(UDP_HEADER) + payload_size)) + { + // Data is not followed + return; + } + + src_port = Endian16(u->SrcPort); + dst_port = Endian16(u->DstPort); + + if (dst_port == IPSEC_PORT_L2TP) + { + UDPPACKET p; + // A L2TP packet has been received + IPsecIkeClientManageL2TPServer(ike, c); + + // Update Port number + c->L2TPClientPort = src_port; + + // Pass the received packet to the L2TP server + p.Type = 0; + p.Data = data + sizeof(UDP_HEADER); + p.DestPort = IPSEC_PORT_L2TP; + Copy(&p.DstIP, &c->L2TPServerIP, sizeof(IP)); + p.Size = payload_size; + Copy(&p.SrcIP, &c->L2TPClientIP, sizeof(IP)); + p.SrcPort = IPSEC_PORT_L2TP; + + ProcL2TPPacketRecv(c->L2TP, &p); + + //Debug("IPsec UDP Recv: %u <= %u %u\n", dst_port, src_port, p.Size); + +#ifdef RAW_DEBUG + IPsecIkeSendUdpForDebug(IPSEC_PORT_L2TP, 1, p.Data, p.Size); +#endif // RAW_DEBUG + } +} + +// Send a raw packet for debugging +void IPsecIkeSendUdpForDebug(UINT dst_port, UINT dst_ip, void *data, UINT size) +{ + SOCK *s = NewUDP(0); + IP d; + + SetIP(&d, dst_ip, dst_ip, dst_ip, dst_ip); + + SendTo(s, &d, dst_port, data, size); + + ReleaseSock(s); +} + +// L2TP packet transmission (via IPsec SA tunnel) +void IPsecIkeClientSendL2TPPackets(IKE_SERVER *ike, IKE_CLIENT *c, L2TP_SERVER *l2tp) +{ + UINT i; + // Validate arguments + if (ike == NULL || c == NULL || l2tp == NULL) + { + return; + } + + for (i = 0;i < LIST_NUM(l2tp->SendPacketList);i++) + { + UDPPACKET *u = LIST_DATA(l2tp->SendPacketList, i); + + if (u->SrcPort != IPSEC_PORT_L2TPV3_VIRTUAL) + { + // L2TP UDP packet transmission + IPsecSendUdpPacket(ike, c, IPSEC_PORT_L2TP, c->L2TPClientPort, + u->Data, u->Size); + } + else + { + // L2TPv3 special IP packet transmission + IPsecSendPacketByIkeClient(ike, c, u->Data, u->Size, IPSEC_IP_PROTO_L2TPV3); + +#ifdef RAW_DEBUG + IPsecIkeSendUdpForDebug(IPSEC_PORT_L2TP, 1, ((UCHAR *)u->Data) + 4, u->Size - 4); +#endif // RAW_DEBUG + } + + FreeUdpPacket(u); + } + + DeleteAll(l2tp->SendPacketList); +} + +// Manage the L2TP server that is associated with the IKE_CLIENT +void IPsecIkeClientManageL2TPServer(IKE_SERVER *ike, IKE_CLIENT *c) +{ + L2TP_SERVER *l2tp; + // Validate arguments + if (ike == NULL || c == NULL) + { + return; + } + + if (c->L2TP == NULL) + { + UINT crypt_block_size = IKE_MAX_BLOCK_SIZE; + + if (c->CurrentIpSecSaRecv != NULL) + { + crypt_block_size = c->CurrentIpSecSaRecv->TransformSetting.Crypto->BlockSize; + } + + c->L2TP = NewL2TPServerEx(ike->Cedar, ike, IsIP6(&c->ClientIP), crypt_block_size); + c->L2TP->IkeClient = c; + + Copy(&c->L2TPServerIP, &c->ServerIP, sizeof(IP)); + Copy(&c->L2TPClientIP, &c->ClientIP, sizeof(IP)); + + if (c->CurrentIpSecSaRecv != NULL) + { + Format(c->L2TP->CryptName, sizeof(c->L2TP->CryptName), + "IPsec - %s (%u bits)", + c->CurrentIpSecSaRecv->TransformSetting.Crypto->Name, + c->CurrentIpSecSaRecv->TransformSetting.CryptoKeySize * 8); + } + + Debug("IKE_CLIENT 0x%X: L2TP Server Started.\n", c); + + IPsecLog(ike, c, NULL, NULL, "LI_L2TP_SERVER_STARTED"); + } + + l2tp = c->L2TP; + + if (l2tp->Interrupts == NULL) + { + l2tp->Interrupts = ike->Interrupts; + } + + if (l2tp->SockEvent == NULL) + { + SetL2TPServerSockEvent(l2tp, ike->SockEvent); + } + + l2tp->Now = ike->Now; +} + +// Manage the EtherIP server that is associated with the IKE_CLIENT +void IPsecIkeClientManageEtherIPServer(IKE_SERVER *ike, IKE_CLIENT *c) +{ + ETHERIP_SERVER *s; + // Validate arguments + if (ike == NULL || c == NULL) + { + return; + } + + if (c->EtherIP == NULL) + { + char crypt_name[MAX_SIZE]; + UINT crypt_block_size = IKE_MAX_BLOCK_SIZE; + + Zero(crypt_name, sizeof(crypt_name)); + + if (c->CurrentIpSecSaRecv != NULL) + { + Format(crypt_name, sizeof(crypt_name), + "IPsec - %s (%u bits)", + c->CurrentIpSecSaRecv->TransformSetting.Crypto->Name, + c->CurrentIpSecSaRecv->TransformSetting.CryptoKeySize * 8); + + crypt_block_size = c->CurrentIpSecSaRecv->TransformSetting.Crypto->BlockSize; + } + + c->EtherIP = NewEtherIPServer(ike->Cedar, ike->IPsec, ike, + &c->ClientIP, c->ClientPort, + &c->ServerIP, c->ServerPort, crypt_name, + c->IsEtherIPOnIPsecTunnelMode, crypt_block_size, c->ClientId, + ++ike->CurrentEtherId); + + Debug("IKE_CLIENT 0x%X: EtherIP Server Started.\n", c); + + IPsecLog(ike, c, NULL, NULL, NULL, "LI_ETHERIP_SERVER_STARTED", ike->CurrentEtherId); + } + else + { + StrCpy(c->EtherIP->ClientId, sizeof(c->EtherIP->ClientId), c->ClientId); + } + + s = c->EtherIP; + + if (s->Interrupts == NULL) + { + s->Interrupts = ike->Interrupts; + } + + if (s->SockEvent == NULL) + { + SetEtherIPServerSockEvent(s, ike->SockEvent); + } + + s->Now = ike->Now; +} + +// EtherIP packet transmission (via IPsec SA tunnel) +void IPsecIkeClientSendEtherIPPackets(IKE_SERVER *ike, IKE_CLIENT *c, ETHERIP_SERVER *s) +{ + UINT i; + // Validate arguments + if (ike == NULL || c == NULL || s == NULL) + { + return; + } + + for (i = 0;i < LIST_NUM(s->SendPacketList);i++) + { + BLOCK *b = LIST_DATA(s->SendPacketList, i); + + // Packet transmission + IPsecSendPacketByIkeClient(ike, c, b->Buf, b->Size, IPSEC_IP_PROTO_ETHERIP); + + FreeBlock(b); + } + + DeleteAll(s->SendPacketList); +} + +// Handle the deletion payload +void ProcDeletePayload(IKE_SERVER *ike, IKE_CLIENT *c, IKE_PACKET_DELETE_PAYLOAD *d) +{ + // Validate arguments + if (ike == NULL || c == NULL || d == NULL) + { + return; + } + + if (d->ProtocolId == IKE_PROTOCOL_ID_IPSEC_ESP) + { + UINT i; + // Remove the IPsec SA + for (i = 0;i < LIST_NUM(d->SpiList);i++) + { + BUF *b = LIST_DATA(d->SpiList, i); + + if (b->Size == 4) + { + UINT spi = READ_UINT(b->Buf); + MarkIPsecSaAsDeleted(ike, SearchIPsecSaBySpi(ike, c, spi)); + } + } + } + else if (d->ProtocolId == IKE_PROTOCOL_ID_IKE) + { + UINT i; + // Remove the IKE SA + for (i = 0;i < LIST_NUM(d->SpiList);i++) + { + BUF *b = LIST_DATA(d->SpiList, i); + + if (b->Size == 16) + { + UINT64 v1 = READ_UINT64(((UCHAR *)b->Buf) + 0); + UINT64 v2 = READ_UINT64(((UCHAR *)b->Buf) + 8); + + IKE_SA *sa = FindIkeSaByResponderCookie(ike, v2); + + if (sa != NULL && sa->IkeClient == c) + { + MarkIkeSaAsDeleted(ike, sa); + } + } + } + } +} + +// Mark the IKE_CLIENT for deletion +void MarkIkeClientAsDeleted(IKE_SERVER *ike, IKE_CLIENT *c) +{ + char client_ip_str[MAX_SIZE]; + char server_ip_str[MAX_SIZE]; + // Validate arguments + if (ike == NULL || c == NULL) + { + return; + } + + if (c->Deleting) + { + return; + } + + ike->StateHasChanged = true; + + c->Deleting = true; + + IPToStr(client_ip_str, sizeof(client_ip_str), &c->ClientIP); + IPToStr(server_ip_str, sizeof(server_ip_str), &c->ServerIP); + + Debug("Deleting IKE_CLIENT: %p: %s:%u -> %s:%u\n", c, client_ip_str, c->ClientPort, server_ip_str, c->ServerPort); + + IPsecLog(ike, c, NULL, NULL, "LI_DELETE_IKE_CLIENT"); +} + +// Mark the IKE SA for deletion +void MarkIkeSaAsDeleted(IKE_SERVER *ike, IKE_SA *sa) +{ + // Validate arguments + if (ike == NULL || sa == NULL) + { + return; + } + + if (sa->Deleting) + { + return; + } + + ike->StateHasChanged = true; + + sa->Deleting = true; + + Debug("IKE SA %I64u - %I64u has been marked as being deleted.\n", sa->InitiatorCookie, sa->ResponderCookie); + + SendDeleteIkeSaPacket(ike, sa->IkeClient, sa->InitiatorCookie, sa->ResponderCookie); + + IPsecLog(ike, NULL, sa, NULL, "LI_DELETE_IKE_SA"); +} + +// Mark the IPsec SA for deletion +void MarkIPsecSaAsDeleted(IKE_SERVER *ike, IPSECSA *sa) +{ + // Validate arguments + if (ike == NULL || sa == NULL) + { + return; + } + + if (sa->Deleting) + { + return; + } + + ike->StateHasChanged = true; + + sa->Deleting = true; + + Debug("IPsec SA 0x%X has been marked as being deleted.\n", sa->Spi); + + SendDeleteIPsecSaPacket(ike, sa->IkeClient, sa->Spi); + + IPsecLog(ike, NULL, NULL, sa, "LI_DELETE_IPSEC_SA"); +} + +// IPsec SA Deletion packet transmission process +void SendDeleteIPsecSaPacket(IKE_SERVER *ike, IKE_CLIENT *c, UINT spi) +{ + IKE_PACKET_PAYLOAD *payload; + BUF *buf; + // Validate arguments + if (ike == NULL || c == NULL || spi == 0) + { + return; + } + + buf = NewBuf(); + WriteBufInt(buf, spi); + + payload = IkeNewDeletePayload(IKE_PROTOCOL_ID_IPSEC_ESP, NewListSingle(buf)); + + SendInformationalExchangePacket(ike, c, payload); +} + +// IKE SA deletion packet transmission process +void SendDeleteIkeSaPacket(IKE_SERVER *ike, IKE_CLIENT *c, UINT64 init_cookie, UINT64 resp_cookie) +{ + IKE_PACKET_PAYLOAD *payload; + BUF *buf; + // Validate arguments + if (ike == NULL || c == NULL) + { + return; + } + + buf = NewBuf(); + WriteBufInt64(buf, init_cookie); + WriteBufInt64(buf, resp_cookie); + + payload = IkeNewDeletePayload(IKE_PROTOCOL_ID_IKE, NewListSingle(buf)); + + SendInformationalExchangePacket(ike, c, payload); +} + +// Information exchange packet transmission process +void SendInformationalExchangePacket(IKE_SERVER *ike, IKE_CLIENT *c, IKE_PACKET_PAYLOAD *payload) +{ + SendInformationalExchangePacketEx(ike, c, payload, false, 0, 0); +} +void SendInformationalExchangePacketEx(IKE_SERVER *ike, IKE_CLIENT *c, IKE_PACKET_PAYLOAD *payload, bool force_plain, UINT64 init_cookie, UINT64 resp_cookie) +{ + IKE_SA *sa; + IKE_PACKET *ps; + LIST *payload_list; + UCHAR dummy_hash_data[IKE_MAX_HASH_SIZE]; + IKE_PACKET_PAYLOAD *hash_payload; + BUF *ps_buf; + UINT after_hash_offset, after_hash_size; + BUF *ps_buf_after_hash; + BUF *tmp_buf; + UCHAR hash[IKE_MAX_HASH_SIZE]; + IKE_CRYPTO_PARAM cp; + bool plain = false; + // Validate arguments + if (ike == NULL || c == NULL || payload == NULL) + { + IkeFreePayload(payload); + return; + } + + sa = c->CurrentIkeSa; + if (sa == NULL) + { + plain = true; + } + + if (force_plain) + { + plain = true; + } + + if (plain && (init_cookie == 0 && resp_cookie == 0)) + { + init_cookie = Rand64(); + resp_cookie = 0; + } + + payload_list = NewListFast(NULL); + + Zero(dummy_hash_data, sizeof(dummy_hash_data)); + + // Hash payload + if (plain == false) + { + hash_payload = IkeNewDataPayload(IKE_PAYLOAD_HASH, dummy_hash_data, sa->HashSize); + Add(payload_list, hash_payload); + } + + // Body + Add(payload_list, payload); + + // Packet creation + ps = IkeNew((plain ? init_cookie : sa->InitiatorCookie), (plain ? resp_cookie : sa->ResponderCookie), + IKE_EXCHANGE_TYPE_INFORMATION, false, false, false, + GenerateNewMessageId(ike), payload_list); + + if (plain == false) + { + // Build a temporary packet + ps_buf = IkeBuild(ps, NULL); + + // Get the payload after the hash part + after_hash_offset = sizeof(IKE_HEADER) + hash_payload->BitArray->Size + sizeof(IKE_COMMON_HEADER); + after_hash_size = ((ps_buf->Size > after_hash_offset) ? (ps_buf->Size - after_hash_offset) : 0); + + ps_buf_after_hash = MemToBuf(((UCHAR *)ps_buf->Buf) + after_hash_offset, after_hash_size); + FreeBuf(ps_buf); + + // Calculate the hash + tmp_buf = NewBuf(); + WriteBufInt(tmp_buf, ps->MessageId); + WriteBufBuf(tmp_buf, ps_buf_after_hash); + IkeHMac(sa->TransformSetting.Hash, hash, sa->SKEYID_a, sa->HashSize, tmp_buf->Buf, tmp_buf->Size); + FreeBuf(tmp_buf); + + // Overwrite the hash + Copy(hash_payload->Payload.Hash.Data->Buf, hash, sa->HashSize); + + ps->FlagEncrypted = true; + FreeBuf(ps_buf_after_hash); + } + + // Packet reply + Zero(&cp, sizeof(cp)); + + if (plain == false) + { + cp.Key = sa->CryptoKey; + IkeCalcPhase2InitialIv(cp.Iv, sa, ps->MessageId); + } + + ps_buf = IkeBuild(ps, &cp); + + IkeSendUdpPacket(ike, IKE_UDP_TYPE_ISAKMP, &c->ServerIP, c->ServerPort, + &c->ClientIP, c->ClientPort, + ps_buf->Buf, ps_buf->Size); + +#ifdef RAW_DEBUG + IkeDebugUdpSendRawPacket(ps); +#endif // RAW_DEBUG + + Free(ps_buf); + + IkeFree(ps); +} + +// Information exchange packet reception process +void ProcIkeInformationalExchangePacketRecv(IKE_SERVER *ike, UDPPACKET *p, IKE_PACKET *header) +{ + IKE_CLIENT *c; + IKE_SA *ike_sa; + // Validate arguments + if (ike == NULL || p == NULL || header == NULL || header->InitiatorCookie == 0 || header->ResponderCookie == 0 + || header->MessageId == 0 || header->FlagEncrypted == false) + { + return; + } + + c = SearchOrCreateNewIkeClientForIkePacket(ike, &p->SrcIP, p->SrcPort, &p->DstIP, p->DestPort, header); + + if (c == NULL) + { + return; + } + + ike_sa = FindIkeSaByResponderCookieAndClient(ike, header->ResponderCookie, c); + + if (ike_sa != NULL && ike_sa->Established) + { + IKE_PACKET *pr; + IKE_CRYPTO_PARAM cp; + + // Packet decoding + Zero(&cp, sizeof(cp)); + cp.Key = ike_sa->CryptoKey; + IkeCalcPhase2InitialIv(cp.Iv, ike_sa, header->MessageId); + + pr = IkeParse(p->Data, p->Size, &cp); +#ifdef RAW_DEBUG + IkeDebugUdpSendRawPacket(pr); +#endif // RAW_DEBUG + if (pr != NULL) + { + // Get the hash payload + IKE_PACKET_PAYLOAD *hash_payload; + + hash_payload = IkeGetPayload(pr->PayloadList, IKE_PAYLOAD_HASH, 0); + if (hash_payload != NULL) + { + // Get the payload after the hash + UINT header_and_hash_size = sizeof(IKE_COMMON_HEADER) + hash_payload->BitArray->Size; + void *after_hash_data = ((UCHAR *)pr->DecryptedPayload->Buf) + header_and_hash_size; + if (pr->DecryptedPayload->Size > header_and_hash_size) + { + UINT after_hash_size = pr->DecryptedPayload->Size - header_and_hash_size; + UCHAR hash1[IKE_MAX_HASH_SIZE]; + BUF *hash1_buf; + + hash1_buf = NewBuf(); + WriteBufInt(hash1_buf, header->MessageId); + WriteBuf(hash1_buf, after_hash_data, after_hash_size); + + IkeHMac(ike_sa->TransformSetting.Hash, hash1, ike_sa->SKEYID_a, ike_sa->HashSize, + hash1_buf->Buf, hash1_buf->Size); + + // Compare the hash value + if (IkeCompareHash(hash_payload, hash1, ike_sa->HashSize)) + { + UINT i, num; + // Handle the deletion payload + num = IkeGetPayloadNum(pr->PayloadList, IKE_PAYLOAD_DELETE); + for (i = 0;i < num;i++) + { + IKE_PACKET_PAYLOAD *payload = IkeGetPayload(pr->PayloadList, IKE_PAYLOAD_DELETE, i); + IKE_PACKET_DELETE_PAYLOAD *del = &payload->Payload.Delete; + + ProcDeletePayload(ike, c, del); + } + num = IkeGetPayloadNum(pr->PayloadList, IKE_PAYLOAD_NOTICE); + // Handle the notification payload + for (i = 0;i < num;i++) + { + IKE_PACKET_PAYLOAD *payload = IkeGetPayload(pr->PayloadList, IKE_PAYLOAD_NOTICE, i); + IKE_PACKET_NOTICE_PAYLOAD *n = &payload->Payload.Notice; + + if (n->MessageType == IKE_NOTICE_DPD_REQUEST || n->MessageType == IKE_NOTICE_DPD_RESPONSE) + { + if (n->MessageData != NULL && n->MessageData->Size == sizeof(UINT)) + { + UINT seq_no = READ_UINT(n->MessageData->Buf); + + if (n->Spi->Size == (sizeof(UINT64) * 2)) + { + UINT64 init_cookie = READ_UINT64(((UCHAR *)n->Spi->Buf)); + UINT64 resp_cookie = READ_UINT64(((UCHAR *)n->Spi->Buf) + sizeof(UINT64)); + + if (init_cookie != 0 && resp_cookie != 0) + { + IKE_SA *found_ike_sa = SearchIkeSaByCookie(ike, init_cookie, resp_cookie); + + if (found_ike_sa != NULL && found_ike_sa->IkeClient == c) + { + if (n->MessageType == IKE_NOTICE_DPD_REQUEST) + { + // Return the DPD Response (ACK) for the DPD Request + SendInformationalExchangePacket(ike, c, + IkeNewNoticeDpdPayload(true, init_cookie, resp_cookie, + seq_no)); + } + + // Update the status of the IKE SA + found_ike_sa->LastCommTick = ike->Now; + ike_sa->LastCommTick = ike->Now; + found_ike_sa->IkeClient->LastCommTick = ike->Now; + ike_sa->IkeClient->LastCommTick = ike->Now; + ike_sa->IkeClient->CurrentIkeSa = ike_sa; + } + } + } + } + } + } + } + + FreeBuf(hash1_buf); + } + } + + IkeFree(pr); + } + } +} + +// Create a new message ID +UINT GenerateNewMessageId(IKE_SERVER *ike) +{ + UINT ret; + // Validate arguments + if (ike == NULL) + { + return 0; + } + + while (true) + { + ret = Rand32(); + + if (ret != 0 && ret != 0xffffffff) + { + UINT i; + bool ok = true; + + for (i = 0;i < LIST_NUM(ike->IPsecSaList);i++) + { + IPSECSA *sa = LIST_DATA(ike->IPsecSaList, i); + + if (sa->MessageId == ret) + { + ok = false; + break; + } + } + + if (ok) + { + return ret; + } + } + } +} + +// Start the quick mode +void StartQuickMode(IKE_SERVER *ike, IKE_CLIENT *c) +{ + IPSEC_SA_TRANSFORM_SETTING setting; + IKE_SA *ike_sa; + UINT message_id; + UCHAR iv[IKE_MAX_BLOCK_SIZE]; + // Validate arguments + if (ike == NULL || c == NULL) + { + return; + } + + if (IsZero(&c->CachedTransformSetting, sizeof(IPSEC_SA_TRANSFORM_SETTING))) + { + // Cached transform setting does not exist + Debug("Error: c->CachedTransformSetting is not existing.\n"); + return; + } + + ike_sa = c->CurrentIkeSa; + if (ike_sa == NULL) + { + return; + } + + IPsecLog(ike, NULL, ike_sa, NULL, "LI_START_QM_FROM_SERVER"); + + Copy(&setting, &c->CachedTransformSetting, sizeof(IPSEC_SA_TRANSFORM_SETTING)); + + message_id = GenerateNewMessageId(ike); + + IkeCalcPhase2InitialIv(iv, ike_sa, message_id); + +#ifdef FORCE_LIFETIME_QM + setting.LifeSeconds = FORCE_LIFETIME_QM; +#endif // FORCE_LIFETIME_QM + + if (true) + { + IKE_PACKET *ps; + LIST *payload_list; + IKE_PACKET_PAYLOAD *send_hash_payload; + IKE_PACKET_PAYLOAD *send_sa_payload; + IKE_PACKET_PAYLOAD *send_proposal_payload; + IKE_PACKET_PAYLOAD *send_transform_payload; + IKE_PACKET_PAYLOAD *send_rand_payload; + IKE_PACKET_PAYLOAD *send_key_payload = NULL; + IKE_PACKET_PAYLOAD *send_id_1 = NULL, *send_id_2 = NULL; + UINT shared_key_size = 0; + UCHAR *shared_key = NULL; + BUF *initiator_rand; + IPSECSA *ipsec_sa_s_c, *ipsec_sa_c_s; + BUF *ps_buf; + UINT after_hash_offset, after_hash_size; + BUF *ps_buf_after_hash; + BUF *tmp_buf; + UINT spi; + UINT spi_be; + UCHAR hash1[IKE_MAX_HASH_SIZE]; + DH_CTX *dh = NULL; + UCHAR dummy_hash_data[IKE_MAX_HASH_SIZE]; + + initiator_rand = RandBuf(IKE_SA_RAND_SIZE); + + if (setting.Dh != NULL) + { + // Generate DH + dh = IkeDhNewCtx(setting.Dh); + + if (dh != NULL) + { + send_key_payload = IkeNewDataPayload(IKE_PAYLOAD_KEY_EXCHANGE, + dh->MyPublicKey->Buf, dh->MyPublicKey->Size); + } + } + + Zero(dummy_hash_data, sizeof(dummy_hash_data)); + + // Dummy hash value + payload_list = NewListFast(NULL); + send_hash_payload = IkeNewDataPayload(IKE_PAYLOAD_HASH, dummy_hash_data, ike_sa->HashSize); + Add(payload_list, send_hash_payload); + + // Determine the SPI + spi = GenerateNewIPsecSaSpi(ike, 0); + spi_be = Endian32(spi); + + // SA + send_transform_payload = TransformSettingToTransformPayloadForIPsec(ike, &setting); + send_proposal_payload = IkeNewProposalPayload(1, IKE_PROTOCOL_ID_IPSEC_ESP, &spi_be, sizeof(spi_be), + NewListSingle(send_transform_payload)); + send_sa_payload = IkeNewSaPayload(NewListSingle(send_proposal_payload)); + Add(payload_list, send_sa_payload); + + // Random number + send_rand_payload = IkeNewDataPayload(IKE_PAYLOAD_RAND, initiator_rand->Buf, initiator_rand->Size); + Add(payload_list, send_rand_payload); + + // Key exchange + if (send_key_payload != NULL) + { + Add(payload_list, send_key_payload); + } + + if (c->SendID1andID2) + { + // Add the ID payload + if (setting.CapsuleMode == IKE_P2_CAPSULE_NAT_TUNNEL_1 || setting.CapsuleMode == IKE_P2_CAPSULE_NAT_TUNNEL_2) + { + UCHAR zero[32]; + + Zero(zero, sizeof(zero)); + + // Tunnel Mode + send_id_1 = IkeNewIdPayload((IsIP4(&c->ServerIP) ? IKE_ID_IPV4_ADDR_SUBNET : IKE_ID_IPV6_ADDR_SUBNET), + 0, 0, + zero, (IsIP4(&c->ServerIP) ? 8 : 32)); + + send_id_2 = IkeNewIdPayload(c->SendID1_Type, + c->SendID1_Protocol, c->SendID1_Port, + c->SendID1_Buf->Buf, c->SendID1_Buf->Size); + } + else + { + // Transport mode + // Specify in the reverse order in which the client has been specified + send_id_2 = IkeNewIdPayload(c->SendID1_Type, + c->SendID1_Protocol, c->SendID1_Port, + c->SendID1_Buf->Buf, c->SendID1_Buf->Size); + + send_id_1 = IkeNewIdPayload(c->SendID2_Type, + c->SendID2_Protocol, c->SendID2_Port, + c->SendID2_Buf->Buf, c->SendID2_Buf->Size); + } + + Add(payload_list, send_id_1); + Add(payload_list, send_id_2); + } + + if (true) + { + // NAT-OA payload + if (c->SendNatOaDraft1) + { + Add(payload_list, IkeNewNatOaPayload(IKE_PAYLOAD_NAT_OA_DRAFT, &c->ServerIP)); + } + + if (c->SendNatOaDraft2) + { + Add(payload_list, IkeNewNatOaPayload(IKE_PAYLOAD_NAT_OA_DRAFT_2, &c->ServerIP)); + } + + if (c->SendNatOaRfc) + { + Add(payload_list, IkeNewNatOaPayload(IKE_PAYLOAD_NAT_OA, &c->ClientIP)); + Add(payload_list, IkeNewNatOaPayload(IKE_PAYLOAD_NAT_OA, &c->ServerIP)); + } + } + + // Build a packet + ps = IkeNew(ike_sa->InitiatorCookie, ike_sa->ResponderCookie, IKE_EXCHANGE_TYPE_QUICK, + false, false, false, message_id, payload_list); + + // Build a temporary packet + ps_buf = IkeBuild(ps, NULL); + + // Get the payload after the hash part + after_hash_offset = sizeof(IKE_HEADER) + send_hash_payload->BitArray->Size + sizeof(IKE_COMMON_HEADER); + after_hash_size = ((ps_buf->Size > after_hash_offset) ? (ps_buf->Size - after_hash_offset) : 0); + + ps_buf_after_hash = MemToBuf(((UCHAR *)ps_buf->Buf) + after_hash_offset, after_hash_size); + FreeBuf(ps_buf); + + // Calculate the hash #1 + tmp_buf = NewBuf(); + WriteBufInt(tmp_buf, message_id); + WriteBufBuf(tmp_buf, ps_buf_after_hash); + IkeHMac(ike_sa->TransformSetting.Hash, hash1, ike_sa->SKEYID_a, ike_sa->HashSize, tmp_buf->Buf, tmp_buf->Size); + FreeBuf(tmp_buf); + + // Overwrite hash #1 + Copy(send_hash_payload->Payload.Hash.Data->Buf, hash1, ike_sa->HashSize); + + // Create an IPsec SA + ipsec_sa_c_s = NewIPsecSa(ike, c, ike_sa, true, message_id, false, iv, spi, + initiator_rand->Buf, initiator_rand->Size, NULL, 0, + &setting, shared_key, shared_key_size); + + ipsec_sa_s_c = NewIPsecSa(ike, c, ike_sa, true, message_id, true, iv, 0, + initiator_rand->Buf, initiator_rand->Size, NULL, 0, + &setting, shared_key, shared_key_size); + + ipsec_sa_c_s->PairIPsecSa = ipsec_sa_s_c; + ipsec_sa_s_c->PairIPsecSa = ipsec_sa_c_s; + + ipsec_sa_s_c->Dh = dh; + + Insert(ike->IPsecSaList, ipsec_sa_c_s); + Insert(ike->IPsecSaList, ipsec_sa_s_c); + + // Packet transmission + ps->FlagEncrypted = true; + IPsecSaSendPacket(ike, ipsec_sa_s_c, ps); + ipsec_sa_s_c->NumResends = 3; +#ifdef RAW_DEBUG + IkeDebugUdpSendRawPacket(ps); +#endif // RAW_DEBUG + + IkeFree(ps); + Free(shared_key); + FreeBuf(ps_buf_after_hash); + FreeBuf(initiator_rand); + } +} + +// Process the quick mode received packet +void ProcIkeQuickModePacketRecv(IKE_SERVER *ike, UDPPACKET *p, IKE_PACKET *header) +{ + IKE_CLIENT *c; + IKE_SA *ike_sa; + // Validate arguments + if (ike == NULL || p == NULL || header == NULL || header->InitiatorCookie == 0 || header->ResponderCookie == 0 + || header->MessageId == 0 || header->FlagEncrypted == false) + { + return; + } + + c = SearchOrCreateNewIkeClientForIkePacket(ike, &p->SrcIP, p->SrcPort, &p->DstIP, p->DestPort, header); + + if (c == NULL) + { + return; + } + + ike_sa = FindIkeSaByResponderCookieAndClient(ike, header->ResponderCookie, c); + + if (ike_sa == NULL) + { + // IKE SA does not exist + SendInformationalExchangePacketEx(ike, c, IkeNewNoticeErrorInvalidCookiePayload(header->InitiatorCookie, + header->ResponderCookie), true, header->InitiatorCookie, header->ResponderCookie); + } + + if (ike_sa != NULL && ike_sa->Established) + { + // Update the status of the IKE SA + ike_sa->LastCommTick = ike->Now; + ike_sa->IkeClient->LastCommTick = ike->Now; + ike_sa->IkeClient->CurrentIkeSa = ike_sa; + + // Search whether the Message ID is already in the database + if (SearchIPsecSaByMessageId(ike, c, header->MessageId) == NULL) + { + IKE_PACKET *pr; + IKE_CRYPTO_PARAM cp; + + // Message ID does not exist. Start a new Quick Mode session + Zero(&cp, sizeof(cp)); + cp.Key = ike_sa->CryptoKey; + IkeCalcPhase2InitialIv(cp.Iv, ike_sa, header->MessageId); + + pr = IkeParse(p->Data, p->Size, &cp); +#ifdef RAW_DEBUG + IkeDebugUdpSendRawPacket(pr); +#endif // RAW_DEBUG + if (pr != NULL) + { + // Get the hash payload + IKE_PACKET_PAYLOAD *hash_payload; + + hash_payload = IkeGetPayload(pr->PayloadList, IKE_PAYLOAD_HASH, 0); + if (hash_payload != NULL) + { + // Get the payload after the hash + UINT header_and_hash_size = sizeof(IKE_COMMON_HEADER) + hash_payload->BitArray->Size; + void *after_hash_data = ((UCHAR *)pr->DecryptedPayload->Buf) + header_and_hash_size; + if (pr->DecryptedPayload->Size > header_and_hash_size) + { + UINT after_hash_size = pr->DecryptedPayload->Size - header_and_hash_size; + UCHAR hash1[IKE_MAX_HASH_SIZE]; + BUF *hash1_buf; + + hash1_buf = NewBuf(); + WriteBufInt(hash1_buf, header->MessageId); + WriteBuf(hash1_buf, after_hash_data, after_hash_size); + + IkeHMac(ike_sa->TransformSetting.Hash, hash1, ike_sa->SKEYID_a, ike_sa->HashSize, + hash1_buf->Buf, hash1_buf->Size); + + // Compare the hash value + if (IkeCompareHash(hash_payload, hash1, ike_sa->HashSize)) + { + IKE_PACKET_PAYLOAD *sa_payload, *rand_payload, *key_payload, *id_payload_1, *id_payload_2; + + // Get the payload of other + sa_payload = IkeGetPayload(pr->PayloadList, IKE_PAYLOAD_SA, 0); + rand_payload = IkeGetPayload(pr->PayloadList, IKE_PAYLOAD_RAND, 0); + key_payload = IkeGetPayload(pr->PayloadList, IKE_PAYLOAD_KEY_EXCHANGE, 0); + id_payload_1 = IkeGetPayload(pr->PayloadList, IKE_PAYLOAD_ID, 0); + id_payload_2 = IkeGetPayload(pr->PayloadList, IKE_PAYLOAD_ID, 1); + + if (sa_payload != NULL && rand_payload != NULL) + { + IPSEC_SA_TRANSFORM_SETTING setting; + + Zero(&setting, sizeof(setting)); + + // Interpret the SA payload + if (GetBestTransformSettingForIPsecSa(ike, pr, &setting, &p->DstIP) && (GetNumberOfIPsecSaOfIkeClient(ike, c) <= IKE_QUOTA_MAX_SA_PER_CLIENT)) + { + // Appropriate transform setting is selected + Debug("P2 Transform: %s %s %s(%u) %u %u\n", + (setting.Dh == NULL ? NULL : setting.Dh->Name), setting.Hash->Name, setting.Crypto->Name, setting.CryptoKeySize, + setting.LifeKilobytes, setting.LifeSeconds); + +#ifdef FORCE_LIFETIME_QM + setting.LifeSeconds = FORCE_LIFETIME_QM; +#endif // FORCE_LIFETIME_QM + + // Cache the transform attribute value + Copy(&c->CachedTransformSetting, &setting, sizeof(IPSEC_SA_TRANSFORM_SETTING)); + + // Check the key exchange payload if the PFS is specified + if (setting.Dh == NULL || (setting.Dh != NULL && key_payload != NULL && + key_payload->Payload.KeyExchange.Data->Size <= setting.Dh->KeySize)) + { + // Create a payload for response + IKE_PACKET *ps; + LIST *payload_list; + IKE_PACKET_PAYLOAD *send_hash_payload; + IKE_PACKET_PAYLOAD *send_sa_payload; + IKE_PACKET_PAYLOAD *send_proposal_payload; + IKE_PACKET_PAYLOAD *send_transform_payload; + IKE_PACKET_PAYLOAD *send_rand_payload; + IKE_PACKET_PAYLOAD *send_key_payload = NULL; + IKE_PACKET_PAYLOAD *send_id_1 = NULL, *send_id_2 = NULL; + UCHAR dummy_hash_data[IKE_MAX_HASH_SIZE]; + DH_CTX *dh = NULL; + UINT shared_key_size = 0; + UCHAR *shared_key = NULL; + BUF *initiator_rand, *responder_rand; + IPSECSA *ipsec_sa_s_c, *ipsec_sa_c_s; + BUF *ps_buf; + UINT after_hash_offset, after_hash_size; + BUF *ps_buf_after_hash; + BUF *tmp_buf; + UINT spi; + UINT spi_be; + UCHAR hash2[IKE_MAX_HASH_SIZE]; + UCHAR hash3[IKE_MAX_HASH_SIZE]; + UCHAR zero = 0; + + IPsecLog(ike, NULL, ike_sa, NULL, "LI_START_QM_FROM_CLIENT"); + + initiator_rand = CloneBuf(rand_payload->Payload.Rand.Data); + responder_rand = RandBuf(IKE_SA_RAND_SIZE); + + if (setting.Dh != NULL) + { + // Calculate DH + dh = IkeDhNewCtx(setting.Dh); + shared_key_size = (dh == NULL ? 0 : dh->Size); + shared_key = ZeroMalloc(shared_key_size); + + if (DhCompute(dh, shared_key, key_payload->Payload.KeyExchange.Data->Buf, key_payload->Payload.KeyExchange.Data->Size)) + { + // DH calculation success + Debug("P2 DH Ok.\n"); + + send_key_payload = IkeNewDataPayload(IKE_PAYLOAD_KEY_EXCHANGE, + dh->MyPublicKey->Buf, dh->MyPublicKey->Size); + + IkeDhFreeCtx(dh); + } + else + { + // DH calculation failure + Debug("P2 DhCompute failed.\n"); + + shared_key = NULL; + Free(shared_key); + shared_key_size = 0; + + IPsecLog(ike, NULL, ike_sa, NULL, "LI_QM_DH_ERROR"); + } + } + + Zero(dummy_hash_data, sizeof(dummy_hash_data)); + + // Dummy hash value + payload_list = NewListFast(NULL); + send_hash_payload = IkeNewDataPayload(IKE_PAYLOAD_HASH, dummy_hash_data, ike_sa->HashSize); + Add(payload_list, send_hash_payload); + + // Determine the SPI + spi = GenerateNewIPsecSaSpi(ike, setting.SpiServerToClient); + spi_be = Endian32(spi); + + // SA + send_transform_payload = TransformSettingToTransformPayloadForIPsec(ike, &setting); + send_proposal_payload = IkeNewProposalPayload(1, IKE_PROTOCOL_ID_IPSEC_ESP, &spi_be, sizeof(spi_be), + NewListSingle(send_transform_payload)); + send_sa_payload = IkeNewSaPayload(NewListSingle(send_proposal_payload)); + Add(payload_list, send_sa_payload); + + // Random number + send_rand_payload = IkeNewDataPayload(IKE_PAYLOAD_RAND, responder_rand->Buf, responder_rand->Size); + Add(payload_list, send_rand_payload); + + // Key exchange + if (send_key_payload != NULL) + { + Add(payload_list, send_key_payload); + } + + // ID + if (id_payload_1 != NULL && id_payload_2 != NULL) + { + send_id_1 = IkeNewIdPayload(id_payload_1->Payload.Id.Type, + id_payload_1->Payload.Id.ProtocolId, id_payload_1->Payload.Id.Port, + id_payload_1->Payload.Id.IdData->Buf, id_payload_1->Payload.Id.IdData->Size); + + send_id_2 = IkeNewIdPayload(id_payload_2->Payload.Id.Type, + id_payload_2->Payload.Id.ProtocolId, id_payload_2->Payload.Id.Port, + id_payload_2->Payload.Id.IdData->Buf, id_payload_2->Payload.Id.IdData->Size); + + Add(payload_list, send_id_1); + Add(payload_list, send_id_2); + + if (c->SendID1_Buf != NULL) + { + FreeBuf(c->SendID1_Buf); + } + + if (c->SendID2_Buf != NULL) + { + FreeBuf(c->SendID2_Buf); + } + + c->SendID1_Type = id_payload_1->Payload.Id.Type; + c->SendID1_Protocol = id_payload_1->Payload.Id.ProtocolId; + c->SendID1_Port = id_payload_1->Payload.Id.Port; + c->SendID1_Buf = CloneBuf(id_payload_1->Payload.Id.IdData); + + c->SendID2_Type = id_payload_2->Payload.Id.Type; + c->SendID2_Protocol = id_payload_2->Payload.Id.ProtocolId; + c->SendID2_Port = id_payload_2->Payload.Id.Port; + c->SendID2_Buf = CloneBuf(id_payload_2->Payload.Id.IdData); + + c->SendID1andID2 = true; + } + else + { + c->SendID1andID2 = false; + } + + if (true) + { + // Reply if NAT-OA payload is presented by the client + IKE_PACKET_PAYLOAD *nat_oa_draft1 = IkeGetPayload(pr->PayloadList, IKE_PAYLOAD_NAT_OA_DRAFT, 0); + IKE_PACKET_PAYLOAD *nat_oa_draft2 = IkeGetPayload(pr->PayloadList, IKE_PAYLOAD_NAT_OA_DRAFT_2, 0); + IKE_PACKET_PAYLOAD *nat_oa_rfc_0 = IkeGetPayload(pr->PayloadList, IKE_PAYLOAD_NAT_OA, 0); + IKE_PACKET_PAYLOAD *nat_oa_rfc_1 = IkeGetPayload(pr->PayloadList, IKE_PAYLOAD_NAT_OA, 1); + + c->SendNatOaDraft1 = c->SendNatOaDraft2 = c->SendNatOaRfc = false; + + c->ShouldCalcChecksumForUDP = false; + + if (nat_oa_draft1 != NULL) + { + Add(payload_list, IkeNewNatOaPayload(IKE_PAYLOAD_NAT_OA_DRAFT, &c->ServerIP)); + c->SendNatOaDraft1 = true; + + if (IsIP4(&nat_oa_draft1->Payload.NatOa.IpAddress) == IsIP4(&c->ServerIP)) + { + Copy(&c->TransportModeClientIP, &nat_oa_draft1->Payload.NatOa.IpAddress, sizeof(IP)); + Copy(&c->TransportModeServerIP, &c->ServerIP, sizeof(IP)); + + c->ShouldCalcChecksumForUDP = true; + } + } + + if (nat_oa_draft2 != NULL) + { + Add(payload_list, IkeNewNatOaPayload(IKE_PAYLOAD_NAT_OA_DRAFT_2, &c->ServerIP)); + c->SendNatOaDraft2 = true; + + if (IsIP4(&nat_oa_draft2->Payload.NatOa.IpAddress) == IsIP4(&c->ServerIP)) + { + Copy(&c->TransportModeClientIP, &nat_oa_draft2->Payload.NatOa.IpAddress, sizeof(IP)); + Copy(&c->TransportModeServerIP, &c->ServerIP, sizeof(IP)); + + c->ShouldCalcChecksumForUDP = true; + } + } + + if (nat_oa_rfc_0 != NULL && nat_oa_rfc_1 != NULL) + { + Add(payload_list, IkeNewNatOaPayload(IKE_PAYLOAD_NAT_OA, &c->ClientIP)); + Add(payload_list, IkeNewNatOaPayload(IKE_PAYLOAD_NAT_OA, &c->ServerIP)); + c->SendNatOaRfc = true; + + if (IsIP4(&nat_oa_rfc_0->Payload.NatOa.IpAddress) == IsIP4(&c->ServerIP)) + { + Copy(&c->TransportModeClientIP, &nat_oa_rfc_0->Payload.NatOa.IpAddress, sizeof(IP)); + Copy(&c->TransportModeServerIP, &c->ServerIP, sizeof(IP)); + + c->ShouldCalcChecksumForUDP = true; + } + } + } + + // Build a packet + ps = IkeNew(ike_sa->InitiatorCookie, ike_sa->ResponderCookie, IKE_EXCHANGE_TYPE_QUICK, + false, false, false, header->MessageId, payload_list); + + // Build a temporary packet + ps_buf = IkeBuild(ps, NULL); + + // Get the payload after the hash part + after_hash_offset = sizeof(IKE_HEADER) + send_hash_payload->BitArray->Size + sizeof(IKE_COMMON_HEADER); + after_hash_size = ((ps_buf->Size > after_hash_offset) ? (ps_buf->Size - after_hash_offset) : 0); + + ps_buf_after_hash = MemToBuf(((UCHAR *)ps_buf->Buf) + after_hash_offset, after_hash_size); + FreeBuf(ps_buf); + + // Calculate the hash #2 + tmp_buf = NewBuf(); + WriteBufInt(tmp_buf, header->MessageId); + WriteBufBuf(tmp_buf, initiator_rand); + WriteBufBuf(tmp_buf, ps_buf_after_hash); + IkeHMac(ike_sa->TransformSetting.Hash, hash2, ike_sa->SKEYID_a, ike_sa->HashSize, tmp_buf->Buf, tmp_buf->Size); + FreeBuf(tmp_buf); + + // Calculate the hash #3 + tmp_buf = NewBuf(); + WriteBuf(tmp_buf, &zero, 1); + WriteBufInt(tmp_buf, header->MessageId); + WriteBufBuf(tmp_buf, initiator_rand); + WriteBufBuf(tmp_buf, responder_rand); + IkeHMac(ike_sa->TransformSetting.Hash, hash3, ike_sa->SKEYID_a, ike_sa->HashSize, tmp_buf->Buf, tmp_buf->Size); + FreeBuf(tmp_buf); + + // Create an IPsec SA + ipsec_sa_c_s = NewIPsecSa(ike, c, ike_sa, false, header->MessageId, false, cp.NextIv, spi, + initiator_rand->Buf, initiator_rand->Size, responder_rand->Buf, responder_rand->Size, + &setting, shared_key, shared_key_size); + ipsec_sa_s_c = NewIPsecSa(ike, c, ike_sa, false, header->MessageId, true, cp.NextIv, setting.SpiServerToClient, + initiator_rand->Buf, initiator_rand->Size, responder_rand->Buf, responder_rand->Size, + &setting, shared_key, shared_key_size); + + ipsec_sa_c_s->PairIPsecSa = ipsec_sa_s_c; + ipsec_sa_s_c->PairIPsecSa = ipsec_sa_c_s; + + Insert(ike->IPsecSaList, ipsec_sa_c_s); + Insert(ike->IPsecSaList, ipsec_sa_s_c); + + Copy(ipsec_sa_c_s->Hash3, hash3, ike_sa->HashSize); + + // Overwrite hash #2 + Copy(send_hash_payload->Payload.Hash.Data->Buf, hash2, ike_sa->HashSize); + + // Packet reply + ps->FlagEncrypted = true; + IPsecSaSendPacket(ike, ipsec_sa_s_c, ps); + IkeSaSendPacket(ike, ike_sa, NULL); + +#ifdef RAW_DEBUG + IkeDebugUdpSendRawPacket(ps); +#endif // RAW_DEBUG + + IkeFree(ps); + Free(shared_key); + FreeBuf(ps_buf_after_hash); + FreeBuf(initiator_rand); + FreeBuf(responder_rand); + } + } + else + { + // No appropriate transform setting + Debug("No Appropriate Transform was Found.\n"); + + IPsecLog(ike, NULL, ike_sa, NULL, "LI_IPSEC_NO_TRANSFORM"); + + SendInformationalExchangePacket(ike, c, IkeNewNoticeErrorNoProposalChosenPayload(true, header->InitiatorCookie, header->ResponderCookie)); + } + } + } + else + { + Debug("QM-1: Hash 1 is invalid.\n"); + } + + FreeBuf(hash1_buf); + } + } + + IkeFree(pr); + } + } + else + { + // Get the IPsec SA + IPSECSA *ipsec_sa_cs = SearchIPsecSaByMessageId(ike, c, header->MessageId); + if (ipsec_sa_cs != NULL) + { + IPSECSA *ipsec_sa_sc = ipsec_sa_cs->PairIPsecSa; + if (ipsec_sa_sc != NULL) + { + if (ipsec_sa_sc->Established == false && ipsec_sa_cs->Established == false) + { + IKE_PACKET *pr = IPsecSaRecvPacket(ike, ipsec_sa_cs, p->Data, p->Size); + +#ifdef RAW_DEBUG + IkeDebugUdpSendRawPacket(pr); +#endif // RAW_DEBUG + + if (pr != NULL) + { + if (ipsec_sa_cs->Initiated == false) + { + // Initiator is client-side + // Check hash3 payload + IKE_PACKET_PAYLOAD *hash_payload = IkeGetPayload(pr->PayloadList, IKE_PAYLOAD_HASH, 0); + + if (hash_payload != NULL) + { + BUF *hash_buf = hash_payload->Payload.Hash.Data; + if (hash_buf != NULL) + { + if (hash_buf->Size == ipsec_sa_cs->IkeSa->HashSize) + { + if (Cmp(hash_buf->Buf, ipsec_sa_cs->Hash3, hash_buf->Size) == 0) + { + ipsec_sa_cs->Established = ipsec_sa_sc->Established = true; + ipsec_sa_cs->EstablishedTick = ipsec_sa_sc->EstablishedTick = ike->Now; + ipsec_sa_cs->LastCommTick = ipsec_sa_sc->LastCommTick = ike->Now; + + c->CurrentIpSecSaRecv = ipsec_sa_cs; + c->CurrentIpSecSaSend = ipsec_sa_sc; + + Debug("IPsec SA 0x%X & 0x%X Established.\n", + ipsec_sa_cs->Spi, + ipsec_sa_sc->Spi); + + IPsecLog(ike, NULL, NULL, ipsec_sa_sc, "LI_IPSEC_SA_ESTABLISHED"); + + IPsecSaSendPacket(ike, ipsec_sa_sc, NULL); + } + else + { + Debug("QM-3: Hash 3 is invalid.\n"); + } + } + } + } + } + else + { + // Initiator is server-side + // Get hash payload + IKE_PACKET_PAYLOAD *hash_payload; + + hash_payload = IkeGetPayload(pr->PayloadList, IKE_PAYLOAD_HASH, 0); + if (hash_payload != NULL && ipsec_sa_sc->InitiatorRand != NULL) + { + // Get the payload after the hash + UINT header_and_hash_size = sizeof(IKE_COMMON_HEADER) + hash_payload->BitArray->Size; + void *after_hash_data = ((UCHAR *)pr->DecryptedPayload->Buf) + header_and_hash_size; + if (pr->DecryptedPayload->Size > header_and_hash_size) + { + UINT after_hash_size = pr->DecryptedPayload->Size - header_and_hash_size; + UCHAR hash2[IKE_MAX_HASH_SIZE]; + BUF *hash2_buf; + + hash2_buf = NewBuf(); + WriteBufInt(hash2_buf, header->MessageId); + WriteBufBuf(hash2_buf, ipsec_sa_sc->InitiatorRand); + WriteBuf(hash2_buf, after_hash_data, after_hash_size); + + IkeHMac(ipsec_sa_sc->SKEYID_Hash, hash2, ipsec_sa_sc->SKEYID_a, ipsec_sa_sc->SKEYID_Hash->HashSize, + hash2_buf->Buf, hash2_buf->Size); + + FreeBuf(hash2_buf); + + // Compare the hash value + if (IkeCompareHash(hash_payload, hash2, ike_sa->HashSize)) + { + IKE_PACKET_PAYLOAD *sa_payload, *rand_payload, *key_payload, *id_payload_1, *id_payload_2; + + // Get the payload of other + sa_payload = IkeGetPayload(pr->PayloadList, IKE_PAYLOAD_SA, 0); + rand_payload = IkeGetPayload(pr->PayloadList, IKE_PAYLOAD_RAND, 0); + key_payload = IkeGetPayload(pr->PayloadList, IKE_PAYLOAD_KEY_EXCHANGE, 0); + id_payload_1 = IkeGetPayload(pr->PayloadList, IKE_PAYLOAD_ID, 0); + id_payload_2 = IkeGetPayload(pr->PayloadList, IKE_PAYLOAD_ID, 1); + + if (sa_payload != NULL && rand_payload != NULL) + { + IPSEC_SA_TRANSFORM_SETTING setting; + + // Interpret the SA payload + if (GetBestTransformSettingForIPsecSa(ike, pr, &setting, &p->DstIP)) + { + // Appropriate transform setting is selected + Debug("P2 Transform: %s %s %s(%u) %u %u\n", + (setting.Dh == NULL ? NULL : setting.Dh->Name), setting.Hash->Name, setting.Crypto->Name, setting.CryptoKeySize, + setting.LifeKilobytes, setting.LifeSeconds); + +#ifdef FORCE_LIFETIME_QM + setting.LifeSeconds = FORCE_LIFETIME_QM; +#endif // FORCE_LIFETIME_QM + + // Check the key exchange payload if the PFS is specified + if (setting.Dh == NULL || (setting.Dh != NULL && key_payload != NULL && ipsec_sa_sc->Dh != NULL && + key_payload->Payload.KeyExchange.Data->Size <= setting.Dh->KeySize)) + { + IKE_PACKET *ps; + LIST *payload_list; + IKE_PACKET_PAYLOAD *send_hash_payload; + IKE_PACKET_PAYLOAD *send_key_payload = NULL; + IKE_PACKET_PAYLOAD *send_id_1 = NULL, *send_id_2 = NULL; + DH_CTX *dh = NULL; + UINT shared_key_size = 0; + UCHAR *shared_key = NULL; + BUF *initiator_rand, *responder_rand; + BUF *tmp_buf; + UCHAR hash3[IKE_MAX_HASH_SIZE]; + char tmp[MAX_SIZE]; + UCHAR zero = 0; + + initiator_rand = ipsec_sa_sc->InitiatorRand; + responder_rand = CloneBuf(rand_payload->Payload.Rand.Data); + + if (setting.Dh != NULL) + { + // Calculate DH + DH_CTX *dh = ipsec_sa_sc->Dh; + + shared_key_size = (dh == NULL ? 0 : dh->Size); + shared_key = ZeroMalloc(shared_key_size); + + if (DhCompute(dh, shared_key, key_payload->Payload.KeyExchange.Data->Buf, key_payload->Payload.KeyExchange.Data->Size)) + { + // DH calculation success + Debug("P2 DH Ok.\n"); + } + else + { + // DH calculation failure + Debug("P2 DhCompute failed.\n"); + + shared_key = NULL; + Free(shared_key); + shared_key_size = 0; + + IPsecLog(ike, NULL, ike_sa, NULL, "LI_QM_DH_ERROR"); + } + } + + // Update the information of IPsec SA + if (shared_key != NULL) + { + ipsec_sa_sc->SharedKey = NewBuf(shared_key, shared_key_size); + ipsec_sa_cs->SharedKey = NewBuf(shared_key, shared_key_size); + } + + ipsec_sa_sc->Spi = setting.SpiServerToClient; + IPsecLog(ike, NULL, NULL, ipsec_sa_sc, "LI_IPSEC_SA_SPI_SET", ipsec_sa_sc->Spi); + ike->IPsecSaList->sorted = false; + + ipsec_sa_sc->ResponderRand = CloneBuf(responder_rand); + ipsec_sa_cs->ResponderRand = CloneBuf(responder_rand); + + Copy(&ipsec_sa_sc->TransformSetting, &setting, sizeof(IPSEC_SA_TRANSFORM_SETTING)); + Copy(&ipsec_sa_cs->TransformSetting, &setting, sizeof(IPSEC_SA_TRANSFORM_SETTING)); + + ipsec_sa_sc->Established = true; + ipsec_sa_cs->Established = true; + + IPsecLog(ike, NULL, NULL, ipsec_sa_sc, "LI_IPSEC_SA_ESTABLISHED"); + + ipsec_sa_sc->LastCommTick = ike->Now; + ipsec_sa_cs->LastCommTick = ike->Now; + + c->CurrentIpSecSaRecv = ipsec_sa_cs; + c->CurrentIpSecSaSend = ipsec_sa_sc; + + // Calculate the KEYMAT + IPsecCalcKeymat(ike, ipsec_sa_sc->SKEYID_Hash, ipsec_sa_sc->KeyMat, sizeof(ipsec_sa_sc->KeyMat), + ipsec_sa_sc->SKEYID_d, ipsec_sa_sc->SKEYID_Hash->HashSize, IKE_PROTOCOL_ID_IPSEC_ESP, + ipsec_sa_sc->Spi, initiator_rand->Buf, initiator_rand->Size, + responder_rand->Buf, responder_rand->Size, + shared_key, shared_key_size); + + IPsecCalcKeymat(ike, ipsec_sa_cs->SKEYID_Hash, ipsec_sa_cs->KeyMat, sizeof(ipsec_sa_cs->KeyMat), + ipsec_sa_cs->SKEYID_d, ipsec_sa_cs->SKEYID_Hash->HashSize, IKE_PROTOCOL_ID_IPSEC_ESP, + ipsec_sa_cs->Spi, initiator_rand->Buf, initiator_rand->Size, + responder_rand->Buf, responder_rand->Size, + shared_key, shared_key_size); + + IkeFreeKey(ipsec_sa_sc->CryptoKey); + IkeFreeKey(ipsec_sa_cs->CryptoKey); + + ipsec_sa_sc->CryptoKey = IkeNewKey(setting.Crypto, ipsec_sa_sc->KeyMat, setting.CryptoKeySize); + ipsec_sa_cs->CryptoKey = IkeNewKey(setting.Crypto, ipsec_sa_cs->KeyMat, setting.CryptoKeySize); + + Copy(ipsec_sa_sc->HashKey, ipsec_sa_sc->KeyMat + setting.CryptoKeySize, setting.Hash->HashSize); + Copy(ipsec_sa_cs->HashKey, ipsec_sa_cs->KeyMat + setting.CryptoKeySize, setting.Hash->HashSize); + + BinToStrEx(tmp, sizeof(tmp), ipsec_sa_sc->KeyMat, ipsec_sa_sc->TransformSetting.CryptoKeySize); + Debug(" KEYMAT (SC): %s\n", tmp); + + BinToStrEx(tmp, sizeof(tmp), ipsec_sa_cs->KeyMat, ipsec_sa_cs->TransformSetting.CryptoKeySize); + Debug(" KEYMAT (CS): %s\n", tmp); + + Debug("IPsec SA 0x%X & 0x%X Established (Server is Initiator).\n", + ipsec_sa_cs->Spi, + ipsec_sa_sc->Spi); + + // Calculate the hash #3 + tmp_buf = NewBuf(); + WriteBuf(tmp_buf, &zero, 1); + WriteBufInt(tmp_buf, header->MessageId); + WriteBufBuf(tmp_buf, initiator_rand); + WriteBufBuf(tmp_buf, responder_rand); + IkeHMac(ipsec_sa_cs->SKEYID_Hash, hash3, ipsec_sa_cs->SKEYID_a, ipsec_sa_cs->SKEYID_Hash->HashSize, tmp_buf->Buf, tmp_buf->Size); + FreeBuf(tmp_buf); + + // Return the hash #3 + send_hash_payload = IkeNewDataPayload(IKE_PAYLOAD_HASH, hash3, ipsec_sa_cs->SKEYID_Hash->HashSize); + + payload_list = NewListSingle(send_hash_payload); + ps = IkeNew(ike_sa->InitiatorCookie, ike_sa->ResponderCookie, + IKE_EXCHANGE_TYPE_QUICK, true, false, false, header->MessageId, payload_list); + + IPsecSaSendPacket(ike, ipsec_sa_sc, ps); +#ifdef RAW_DEBUG + IkeDebugUdpSendRawPacket(ps); +#endif // RAW_DEBUG + ipsec_sa_sc->NumResends = 3; + + if (false) + { + UINT i; + + for (i = 0;i < LIST_NUM(ike->IPsecSaList);i++) + { + IPSECSA *sa = LIST_DATA(ike->IPsecSaList, i); + + if (sa != ipsec_sa_sc && sa != ipsec_sa_cs) + { + MarkIPsecSaAsDeleted(ike, sa); + } + } + } + + IkeFree(ps); + + // Release the memory + FreeBuf(responder_rand); + } + } + else + { + // No appropriate transform setting + Debug("No Appropriate Transform was Found.\n"); + + IPsecLog(ike, NULL, ike_sa, NULL, "LI_IPSEC_NO_TRANSFORM"); + + SendInformationalExchangePacket(ike, c, IkeNewNoticeErrorNoProposalChosenPayload(true, header->InitiatorCookie, header->ResponderCookie)); + } + } + } + } + } + } + IkeFree(pr); + } + } + } + } + } + } +} + +// Calculate the KEYMAT +void IPsecCalcKeymat(IKE_SERVER *ike, IKE_HASH *h, void *dst, UINT dst_size, void *skeyid_d_data, UINT skeyid_d_size, UCHAR protocol, UINT spi, void *rand_init_data, UINT rand_init_size, + void *rand_resp_data, UINT rand_resp_size, void *df_key_data, UINT df_key_size) +{ + BUF *k; + BUF *ret; + // Validate arguments + if (ike == NULL || dst == NULL || h == NULL || rand_init_data == NULL || rand_resp_data == NULL|| + (df_key_size != 0 && df_key_data == NULL)) + { + return; + } + + ret = NewBuf(); + + k = NULL; + + while (true) + { + BUF *tmp = NewBuf(); + UCHAR hash[IKE_MAX_HASH_SIZE]; + + if (k != NULL) + { + WriteBufBuf(tmp, k); + } + + if (df_key_data != NULL) + { + WriteBuf(tmp, df_key_data, df_key_size); + } + + WriteBuf(tmp, &protocol, 1); + + WriteBufInt(tmp, spi); + + WriteBuf(tmp, rand_init_data, rand_init_size); + WriteBuf(tmp, rand_resp_data, rand_resp_size); + + if (k != NULL) + { + FreeBuf(k); + } + + IkeHMac(h, hash, skeyid_d_data, skeyid_d_size, tmp->Buf, tmp->Size); + + FreeBuf(tmp); + + k = MemToBuf(hash, h->HashSize); + + WriteBufBuf(ret, k); + + if (ret->Size >= dst_size) + { + break; + } + } + + Copy(dst, ret->Buf, dst_size); + + FreeBuf(ret); + FreeBuf(k); +} + +// Search for IPsec SA from Message ID +IPSECSA *SearchIPsecSaByMessageId(IKE_SERVER *ike, IKE_CLIENT *c, UINT message_id) +{ + UINT i; + // Validate arguments + if (ike == NULL || c == NULL || message_id == 0) + { + return NULL; + } + + for (i = 0;i < LIST_NUM(ike->IPsecSaList);i++) + { + IPSECSA *sa = LIST_DATA(ike->IPsecSaList, i); + + if (sa->IkeClient == c) + { + if (sa->MessageId == message_id) + { + if (sa->ServerToClient == false) + { + if (sa->Established == false) + { + return sa; + } + } + } + } + } + + return NULL; +} + +// Search for IPsec SA from SPI value +IPSECSA *SearchClientToServerIPsecSaBySpi(IKE_SERVER *ike, UINT spi) +{ + IPSECSA t; + // Validate arguments + if (ike == NULL || spi == 0) + { + return NULL; + } + + t.ServerToClient = false; + t.Spi = spi; + + return Search(ike->IPsecSaList, &t); +} +IPSECSA *SearchIPsecSaBySpi(IKE_SERVER *ike, IKE_CLIENT *c, UINT spi) +{ + UINT i; + // Validate arguments + if (ike == NULL || c == NULL || spi == 0) + { + return NULL; + } + + for (i = 0;i < LIST_NUM(ike->IPsecSaList);i++) + { + IPSECSA *sa = LIST_DATA(ike->IPsecSaList, i); + + if (sa->Spi == spi) + { + if (sa->IkeClient == c) + { + return sa; + } + } + } + + return NULL; +} + +// Search an IKE SA from the value of the Cookie +IKE_SA *SearchIkeSaByCookie(IKE_SERVER *ike, UINT64 init_cookie, UINT64 resp_cookie) +{ + UINT i; + // Validate arguments + if (ike == NULL) + { + return NULL; + } + + for (i = 0;i < LIST_NUM(ike->IkeSaList);i++) + { + IKE_SA *sa = LIST_DATA(ike->IkeSaList, i); + + if (sa->InitiatorCookie == init_cookie && sa->ResponderCookie == resp_cookie) + { + return sa; + } + } + + return NULL; +} + +// Generate the SPI value of new IPsec SA +UINT GenerateNewIPsecSaSpi(IKE_SERVER *ike, UINT counterpart_spi) +{ + UINT ret; + // Validate arguments + if (ike == NULL) + { + return 0; + } + + while (true) + { + ret = Rand32(); + + if (ret != counterpart_spi) + { + if (ret >= 4096 && ret != INFINITE) + { + if (SearchClientToServerIPsecSaBySpi(ike, ret) == NULL) + { + return ret; + } + } + } + } +} + +// Calculate the initial IV for Phase 2 +void IkeCalcPhase2InitialIv(void *iv, IKE_SA *sa, UINT message_id) +{ + BUF *b; + UCHAR hash[IKE_MAX_HASH_SIZE]; + // Validate arguments + if (iv == NULL || sa == NULL) + { + return; + } + + message_id = Endian32(message_id); + + b = NewBuf(); + WriteBuf(b, sa->Iv, sa->BlockSize); + WriteBuf(b, &message_id, sizeof(UINT)); + + IkeHash(sa->TransformSetting.Hash, hash, b->Buf, b->Size); + + Copy(iv, hash, sa->TransformSetting.Crypto->BlockSize); + + FreeBuf(b); +} + +// Create a new IPsec SA +IPSECSA *NewIPsecSa(IKE_SERVER *ike, IKE_CLIENT *c, IKE_SA *ike_sa, bool initiate, UINT message_id, bool server_to_client, void *iv, UINT spi, void *init_rand_data, UINT init_rand_size, void *res_rand_data, UINT res_rand_size, IPSEC_SA_TRANSFORM_SETTING *setting, void *shared_key_data, UINT shared_key_size) +{ + IPSECSA *sa; + char tmp[MAX_SIZE]; + UINT total_key_size; + // Validate arguments + if (ike == NULL || c == NULL || ike_sa == NULL || message_id == 0 || iv == NULL || setting == NULL || + (shared_key_data == NULL && shared_key_size != 0)) + { + return NULL; + } + + sa = ZeroMalloc(sizeof(IPSECSA)); + + if (server_to_client == false) + { + ike->CurrentIPsecSaId++; + } + sa->Id = ike->CurrentIPsecSaId; + + sa->IkeClient = c; + sa->IkeSa = ike_sa; + + sa->MessageId = message_id; + sa->FirstCommTick = ike->Now; + sa->LastCommTick = ike->Now; + sa->Initiated = initiate; + + sa->ServerToClient = server_to_client; + + sa->Spi = spi; + + sa->SKEYID_Hash = ike_sa->TransformSetting.Hash; + Copy(sa->SKEYID_a, ike_sa->SKEYID_a, sa->SKEYID_Hash->HashSize); + Copy(sa->SKEYID_d, ike_sa->SKEYID_d, sa->SKEYID_Hash->HashSize); + + sa->InitiatorRand = MemToBuf(init_rand_data, init_rand_size); + + if (initiate == false) + { + sa->ResponderRand = MemToBuf(res_rand_data, res_rand_size); + } + + Copy(sa->Iv, iv, ike_sa->BlockSize); + + Copy(&sa->TransformSetting, setting, sizeof(IPSEC_SA_TRANSFORM_SETTING)); + + if (shared_key_data != NULL) + { + sa->SharedKey = MemToBuf(shared_key_data, shared_key_size); + } + + total_key_size = sa->TransformSetting.CryptoKeySize + sa->TransformSetting.Hash->HashSize; + + if (initiate == false) + { + IPsecCalcKeymat(ike, ike_sa->TransformSetting.Hash, sa->KeyMat, total_key_size, + ike_sa->SKEYID_d, ike_sa->HashSize, IKE_PROTOCOL_ID_IPSEC_ESP, spi, sa->InitiatorRand->Buf, + sa->InitiatorRand->Size, sa->ResponderRand->Buf, sa->ResponderRand->Size, + shared_key_data, shared_key_size); + + sa->CryptoKey = IkeNewKey(sa->TransformSetting.Crypto, sa->KeyMat, sa->TransformSetting.CryptoKeySize); + + Copy(sa->HashKey, sa->KeyMat + sa->TransformSetting.CryptoKeySize, sa->TransformSetting.Hash->HashSize); + } + + Debug("New IPsec SA (StoC = %u): 0x%X 0x%X (%s %s %s(%u) %u %u)\n", + sa->ServerToClient, + sa->MessageId, + sa->Spi, + (setting->Dh == NULL ? NULL : setting->Dh->Name), setting->Hash->Name, setting->Crypto->Name, setting->CryptoKeySize, + setting->LifeKilobytes, setting->LifeSeconds); + + IPsecLog(ike, c, NULL, sa, "LI_NEW_IPSEC_SA", + (sa->ServerToClient ? _UU("LI_TAG_SERVER_TO_CLIENT") : _UU("LI_TAG_CLIENT_TO_SERVER")), + sa->Spi, + (setting->Dh == NULL ? NULL : setting->Dh->Name), setting->Hash->Name, setting->Crypto->Name, setting->CryptoKeySize * 8, + setting->LifeKilobytes, setting->LifeSeconds); + + Rand(sa->EspIv, sizeof(sa->EspIv)); + + if (initiate == false) + { + BinToStrEx(tmp, sizeof(tmp), sa->KeyMat, sa->TransformSetting.CryptoKeySize); + Debug(" KEYMAT: %s\n", tmp); + } + + // Set the expiration time + if (setting->LifeSeconds != 0) + { + const UINT64 span = (UINT64)((UINT64)setting->LifeSeconds * (UINT64)1000) + (UINT64)IKE_SOFT_EXPIRES_MARGIN; + sa->ExpiresHardTick = ike->Now + span; + sa->ExpiresSoftTick = ike->Now + span; + //sa->ExpiresSoftTick = ike->Now + (UINT64)5000; + + AddInterrupt(ike->Interrupts, sa->ExpiresSoftTick); + } + + return sa; +} + +// Treat aggressive mode packet reception +void ProcIkeAggressiveModePacketRecv(IKE_SERVER *ike, UDPPACKET *p, IKE_PACKET *header) +{ + IKE_CLIENT *c; + char tmp[MAX_SIZE]; + // Validate arguments + if (ike == NULL || p == NULL || header == NULL || header->InitiatorCookie == 0) + { + return; + } + + c = SearchOrCreateNewIkeClientForIkePacket(ike, &p->SrcIP, p->SrcPort, &p->DstIP, p->DestPort, header); + + if (c == NULL) + { + return; + } + + if (header->ResponderCookie == 0) + { + // Start process of the state 1 + IKE_CAPS caps; + IKE_SA *sa; + IKE_PACKET *pr = IkeParse(p->Data, p->Size, NULL); + + if (pr != NULL) + { + // Determine the CAPS + IkeCheckCaps(&caps, pr); + if (caps.MS_L2TPIPSecVPNClient || caps.MS_NT5_ISAKMP_OAKLEY || caps.MS_Vid_InitialContact) + { + c->IsMicrosoft = true; + } + + if ((caps.NatTraversalDraftIetf || caps.NatTraversalRfc3947) || (IsUdpPortOpened(ike->IPsec->UdpListener, &p->DstIP, IPSEC_PORT_IPSEC_ESP_RAW))) + { + sa = FindIkeSaByEndPointAndInitiatorCookie(ike, &p->DstIP, p->DestPort, &p->SrcIP, p->SrcPort, header->InitiatorCookie, IKE_SA_AGGRESSIVE_MODE); + + if (sa == NULL) + { + // Check whether there is acceptable SA parameters by analyzing proposed parameters + IKE_SA_TRANSFORM_SETTING setting; + + if (GetBestTransformSettingForIkeSa(ike, pr, &setting) && (GetNumberOfIkeSaOfIkeClient(ike, c) <= IKE_QUOTA_MAX_SA_PER_CLIENT)) + { + IKE_PACKET_PAYLOAD *tp; + IKE_PACKET_PAYLOAD *pp; + IKE_PACKET_PAYLOAD *sap; + IKE_PACKET_PAYLOAD *client_sa_payload; + IKE_PACKET_PAYLOAD *your_key_payload; + IKE_PACKET_PAYLOAD *your_rand_payload; + IKE_PACKET_PAYLOAD *your_id_payload = IkeGetPayload(pr->PayloadList, IKE_PAYLOAD_ID, 0); + + // Appropriate transform setting is selected + Debug("P1 Transform: %s %s %s(%u) %u %u\n", + setting.Dh->Name, setting.Hash->Name, setting.Crypto->Name, setting.CryptoKeySize, + setting.LifeKilobytes, setting.LifeSeconds); + + // Receive a key exchange packet + your_key_payload = IkeGetPayload(pr->PayloadList, IKE_PAYLOAD_KEY_EXCHANGE, 0); + your_rand_payload = IkeGetPayload(pr->PayloadList, IKE_PAYLOAD_RAND, 0); + if (your_key_payload != NULL && your_rand_payload != NULL && your_id_payload != NULL) + { + // Check the key payload + BUF *your_key_buf = your_key_payload->Payload.KeyExchange.Data; + BUF *your_rand_buf = your_rand_payload->Payload.Rand.Data; + + // DH generation + DH_CTX *dh = IkeDhNewCtx(setting.Dh); + UINT shared_key_size = (dh == NULL ? 0 : dh->Size); + UCHAR *shared_key = ZeroMalloc(shared_key_size); + + // DH calculation + if (DhCompute(dh, shared_key, your_key_buf->Buf, your_key_buf->Size)) + { + IKE_PACKET *ps; + LIST *payload_list; + IKE_PACKET_PAYLOAD *my_key_payload; + IKE_PACKET_PAYLOAD *my_rand_payload; + BUF *nat_buf1, *nat_buf2; + BUF *iv_buf; + UCHAR iv_hashed_data[IKE_MAX_HASH_SIZE]; + UCHAR initiator_hash[IKE_MAX_HASH_SIZE]; + BUF *b; + IKE_PACKET_PAYLOAD *my_id_payload, *my_hash_payload; + UCHAR responder_hash[IKE_MAX_HASH_SIZE]; + BUF *idir_b; + IKE_PACKET_PAYLOAD *your_nat_d_1 = NULL; + IKE_PACKET_PAYLOAD *your_nat_d_2 = NULL; + + // Create an IKE SA + sa = NewIkeSa(ike, c, header->InitiatorCookie, IKE_SA_AGGRESSIVE_MODE, &setting); + Copy(&sa->Caps, &caps, sizeof(IKE_CAPS)); + sa->State= IKE_SA_AM_STATE_1_SA; + Insert(ike->IkeSaList, sa); + + sa->HashSize = sa->TransformSetting.Hash->HashSize; + sa->KeySize = sa->TransformSetting.CryptoKeySize; + sa->BlockSize = sa->TransformSetting.Crypto->BlockSize; + + // Get the Caps additionally + if (sa->Caps.NatTraversalRfc3947) + { + sa->Caps.UsingNatTraversalRfc3947 = true; + + your_nat_d_1 = IkeGetPayload(pr->PayloadList, IKE_PAYLOAD_NAT_D, 0); + your_nat_d_2 = IkeGetPayload(pr->PayloadList, IKE_PAYLOAD_NAT_D, 1); + } + else if (sa->Caps.NatTraversalDraftIetf) + { + sa->Caps.UsingNatTraversalDraftIetf = true; + + your_nat_d_1 = IkeGetPayload(pr->PayloadList, IKE_PAYLOAD_NAT_D_DRAFT, 0); + your_nat_d_2 = IkeGetPayload(pr->PayloadList, IKE_PAYLOAD_NAT_D_DRAFT, 1); + } + + // Calculation success + sa->DhSharedKey = MemToBuf(shared_key, shared_key_size); + sa->InitiatorRand = RandBuf(IKE_SA_RAND_SIZE); + sa->ResponderRand = CloneBuf(your_rand_buf); + + // Save a bit array of SA payload presented by the client + client_sa_payload = IkeGetPayload(pr->PayloadList, IKE_PAYLOAD_SA, 0); + sa->SAi_b = CloneBuf(client_sa_payload->BitArray); + + // Save the ID payload presented by the client + sa->YourIDPayloadForAM = CloneBuf(your_id_payload->BitArray); + + //// Assemble the SA payload + // Construct transform payload + tp = TransformSettingToTransformPayloadForIke(ike, &setting); + + // Build a proposal payload + pp = IkeNewProposalPayload(1, IKE_PROTOCOL_ID_IKE, NULL, 0, NewListSingle(tp)); + + // Build the SA payload + sap = IkeNewSaPayload(NewListSingle(pp)); + + payload_list = NewListSingle(sap); + + // Send a key exchange packet + my_key_payload = IkeNewDataPayload(IKE_PAYLOAD_KEY_EXCHANGE, dh->MyPublicKey->Buf, dh->MyPublicKey->Size); + my_rand_payload = IkeNewDataPayload(IKE_PAYLOAD_RAND, sa->InitiatorRand->Buf, sa->InitiatorRand->Size); + + Add(payload_list, my_key_payload); + Add(payload_list, my_rand_payload); + + // NAT-D Packet + // Address of the opponent. Randomize in order to be forced to use NAT + nat_buf1 = IkeCalcNatDetectHash(ike, sa->TransformSetting.Hash, Rand64(), Rand64(), &c->ClientIP, Rand16()); + + // My address + if (c->IsMicrosoft == false || (your_nat_d_1 == NULL || your_nat_d_2 == NULL || your_nat_d_1->BitArray == NULL)) + { + // Calculate exactly + nat_buf2 = IkeCalcNatDetectHash(ike, sa->TransformSetting.Hash, + sa->InitiatorCookie, sa->ResponderCookie, &c->ServerIP, c->ServerPort); + } + else + { + // Parrot the NAT_D payload indicating myself I got from + // the other if it has connected from a Microsoft VPN Client + nat_buf2 = CloneBuf(your_nat_d_1->BitArray); + } + + // Save DH information + sa->GXi = CloneBuf(your_key_buf); + sa->GXr = CloneBuf(dh->MyPublicKey); + + // Calculate the key set + IkeCalcSaKeySet(ike, sa, NULL); + + // Calculate the initiator side hash value + b = NewBuf(); + WriteBufBuf(b, sa->GXi); + WriteBufBuf(b, sa->GXr); + WriteBufInt64(b, sa->InitiatorCookie); + WriteBufInt64(b, sa->ResponderCookie); + WriteBufBuf(b, sa->SAi_b); + WriteBufBuf(b, sa->YourIDPayloadForAM); + + IkeHMac(sa->TransformSetting.Hash, initiator_hash, sa->SKEYID, sa->HashSize, + b->Buf, b->Size); + + FreeBuf(b); + + Copy(sa->InitiatorHashForAM, initiator_hash, sa->HashSize); + + // Prepare the response ID payload + // Generate the ID payload + if (IsIP6(&sa->IkeClient->ServerIP)) + { + // IPv6 address + my_id_payload = IkeNewIdPayload(IKE_ID_IPV6_ADDR, 0, 0, sa->IkeClient->ServerIP.ipv6_addr, 16); + } + else + { + // IPv4 address + my_id_payload = IkeNewIdPayload(IKE_ID_IPV4_ADDR, 0, 0, sa->IkeClient->ServerIP.addr, 4); + } + + // Build the ID payload tentatively + idir_b = IkeBuildIdPayload(&my_id_payload->Payload.Id); + + b = NewBuf(); + WriteBufBuf(b, sa->GXr); + WriteBufBuf(b, sa->GXi); + WriteBufInt64(b, sa->ResponderCookie); + WriteBufInt64(b, sa->InitiatorCookie); + WriteBufBuf(b, sa->SAi_b); + WriteBufBuf(b, idir_b); + + IkeHMac(sa->TransformSetting.Hash, responder_hash, sa->SKEYID, sa->HashSize, + b->Buf, b->Size); + + FreeBuf(b); + FreeBuf(idir_b); + + my_hash_payload = IkeNewDataPayload(IKE_PAYLOAD_HASH, responder_hash, sa->HashSize); + + Add(payload_list, my_id_payload); + Add(payload_list, my_hash_payload); + + ps = IkeNew(sa->InitiatorCookie, sa->ResponderCookie, IKE_EXCHANGE_TYPE_AGGRESSIVE, + false, false, false, 0, payload_list); + + // Add the vendor ID + IkeAddVendorIdPayloads(ps); + + // NAT-D related + if (sa->Caps.UsingNatTraversalRfc3947) + { + // RFC-compliant + Add(payload_list, IkeNewDataPayload(IKE_PAYLOAD_NAT_D, nat_buf1->Buf, nat_buf1->Size)); + Add(payload_list, IkeNewDataPayload(IKE_PAYLOAD_NAT_D, nat_buf2->Buf, nat_buf2->Size)); + } + + if (sa->Caps.UsingNatTraversalDraftIetf) + { + // Draft compliant + Add(payload_list, IkeNewDataPayload(IKE_PAYLOAD_NAT_D_DRAFT, nat_buf1->Buf, nat_buf1->Size)); + Add(payload_list, IkeNewDataPayload(IKE_PAYLOAD_NAT_D_DRAFT, nat_buf2->Buf, nat_buf2->Size)); + } + + FreeBuf(nat_buf1); + FreeBuf(nat_buf2); + + StrCpy(c->ClientId, sizeof(c->ClientId), your_id_payload->Payload.Id.StrData); + Debug("Client ID = %s\n", c->ClientId); + + IPsecLog(ike, c, NULL, NULL, NULL, "LI_SET_CLIENT_ID", c->ClientId); + + // Initial IV setting + iv_buf = NewBuf(); + WriteBuf(iv_buf, your_key_buf->Buf, your_key_buf->Size); + WriteBuf(iv_buf, dh->MyPublicKey->Buf, dh->MyPublicKey->Size); + IkeHash(sa->TransformSetting.Hash, iv_hashed_data, iv_buf->Buf, iv_buf->Size); + + BinToStrEx(tmp, sizeof(tmp), iv_hashed_data, sa->BlockSize); + Debug("Initial IV: %s\n", tmp); + + IkeSaUpdateIv(sa, iv_hashed_data, sa->HashSize); + + FreeBuf(iv_buf); + + // Transmission + IkeSaSendPacket(ike, sa, ps); + + IkeFree(ps); + } + else + { + // DH calculation failure + Debug("DhCompute failed.\n"); + } + + Free(shared_key); + DhFree(dh); + } + } + else + { + // No appropriate transform setting + Debug("No Appropriate Transform was Found.\n"); + + IPsecLog(ike, c, NULL, NULL, "LI_IKE_NO_TRANSFORM"); + + SendInformationalExchangePacket(ike, c, IkeNewNoticeErrorNoProposalChosenPayload(false, header->InitiatorCookie, header->ResponderCookie)); + } + } + } + else + { + // Client does not support NAT Traversal + Debug("Client doesn't support NAT-T.\n"); + + IPsecLog(ike, c, NULL, NULL, "LI_IKE_NO_NAT_T"); + } + + IkeFree(pr); + } + } + else + { + // Process of state 2 + IKE_SA *sa; + + sa = FindIkeSaByResponderCookieAndClient(ike, header->ResponderCookie, c); + + if (sa == NULL) + { + SendInformationalExchangePacketEx(ike, c, IkeNewNoticeErrorInvalidCookiePayload(header->InitiatorCookie, + header->ResponderCookie), true, header->InitiatorCookie, header->ResponderCookie); + } + + if (sa != NULL && sa->Mode == IKE_SA_AGGRESSIVE_MODE) + { + IKE_PACKET *pr = NULL; + + sa->LastCommTick = ike->Now; + + switch (sa->State) + { + case IKE_SA_AM_STATE_1_SA: + pr = IkeSaRecvPacket(ike, sa, p->Data, p->Size); + if (pr != NULL) + { + IKE_PACKET_PAYLOAD *your_hash_payload = IkeGetPayload(pr->PayloadList, IKE_PAYLOAD_HASH, 0); + + if (your_hash_payload != NULL) + { + // Compare the hash + if (IkeCompareHash(your_hash_payload, sa->InitiatorHashForAM, sa->HashSize)) + { + // Transit to the established state + Debug("IKE SA 0x%X Established.\n", sa); + sa->State = IKE_SA_AM_STATE_2_ESTABLISHED; + sa->EstablishedTick = ike->Now; + sa->Established = true; + c->CurrentIkeSa = sa; + c->NextDpdSendTick = ike->Now + (UINT64)IKE_INTERVAL_DPD_KEEPALIVE; + StrCpy(c->Secret, sizeof(c->Secret), sa->Secret); + + IPsecLog(ike, NULL, sa, NULL, "LI_IKE_SA_ESTABLISHED"); + + IkeSaSendPacket(ike, sa, NULL); + } + else + { + Debug("IKE SA 0x%X Invalid Hash.\n", sa); + } + } + } + break; + } + + if (pr != NULL) + { + IkeFree(pr); + } + } + } +} + +// Process of the main mode packet reception +void ProcIkeMainModePacketRecv(IKE_SERVER *ike, UDPPACKET *p, IKE_PACKET *header) +{ + IKE_CLIENT *c; + char tmp[MAX_SIZE]; + // Validate arguments + if (ike == NULL || p == NULL || header == NULL || header->InitiatorCookie == 0) + { + return; + } + + c = SearchOrCreateNewIkeClientForIkePacket(ike, &p->SrcIP, p->SrcPort, &p->DstIP, p->DestPort, header); + + if (c == NULL) + { + return; + } + + if (header->ResponderCookie == 0) + { + // Start process of the state 1 + IKE_CAPS caps; + IKE_SA *sa; + IKE_PACKET *pr = IkeParse(p->Data, p->Size, NULL); + + if (pr != NULL) + { + // Determine the CAPS + IkeCheckCaps(&caps, pr); + if (caps.MS_L2TPIPSecVPNClient || caps.MS_NT5_ISAKMP_OAKLEY || caps.MS_Vid_InitialContact) + { + c->IsMicrosoft = true; + } + + if ((caps.NatTraversalDraftIetf || caps.NatTraversalRfc3947) || (IsUdpPortOpened(ike->IPsec->UdpListener, &p->DstIP, IPSEC_PORT_IPSEC_ESP_RAW))) + { + sa = FindIkeSaByEndPointAndInitiatorCookie(ike, &p->DstIP, p->DestPort, &p->SrcIP, p->SrcPort, header->InitiatorCookie, IKE_SA_MAIN_MODE); + + if (sa == NULL) + { + // Check whether there is acceptable SA parameters by analyzing proposed parameters + IKE_SA_TRANSFORM_SETTING setting; + + if (GetBestTransformSettingForIkeSa(ike, pr, &setting) && (GetNumberOfIkeSaOfIkeClient(ike, c) <= IKE_QUOTA_MAX_SA_PER_CLIENT)) + { + IKE_PACKET *ps; + IKE_PACKET_PAYLOAD *tp; + IKE_PACKET_PAYLOAD *pp; + IKE_PACKET_PAYLOAD *sap; + LIST *payload_list; + IKE_PACKET_PAYLOAD *client_sa_payload; + + // Appropriate transform setting is selected + Debug("P1 Transform: %s %s %s(%u) %u %u\n", + setting.Dh->Name, setting.Hash->Name, setting.Crypto->Name, setting.CryptoKeySize, + setting.LifeKilobytes, setting.LifeSeconds); + +#ifdef FORCE_LIFETIME_MM + setting.LifeSeconds = FORCE_LIFETIME_MM; +#endif // FORCE_LIFETIME_MM + + // Create an IKE SA + sa = NewIkeSa(ike, c, header->InitiatorCookie, IKE_SA_MAIN_MODE, &setting); + + Copy(&sa->Caps, &caps, sizeof(IKE_CAPS)); + + Insert(ike->IkeSaList, sa); + + // Answer the SA parameter selection results + sa->State = IKE_SA_MM_STATE_1_SA; + + // Save a bit array of SA payload presented by the client + client_sa_payload = IkeGetPayload(pr->PayloadList, IKE_PAYLOAD_SA, 0); + sa->SAi_b = CloneBuf(client_sa_payload->BitArray); + + //// Assemble the SA payload + // Construct a transform payload + tp = TransformSettingToTransformPayloadForIke(ike, &setting); + + // Build a proposal payload + pp = IkeNewProposalPayload(1, IKE_PROTOCOL_ID_IKE, NULL, 0, NewListSingle(tp)); + + // Build a SA payload + sap = IkeNewSaPayload(NewListSingle(pp)); + + payload_list = NewListSingle(sap); + + ps = IkeNew(sa->InitiatorCookie, sa->ResponderCookie, IKE_EXCHANGE_TYPE_MAIN, + false, false, false, 0, payload_list); + + // Add the vendor ID payload + IkeAddVendorIdPayloads(ps); + + IkeSaSendPacket(ike, sa, ps); + + sa->HashSize = sa->TransformSetting.Hash->HashSize; + sa->KeySize = sa->TransformSetting.CryptoKeySize; + sa->BlockSize = sa->TransformSetting.Crypto->BlockSize; + + IkeFree(ps); + } + else + { + // No appropriate transform setting + Debug("No Appropriate Transform was Found.\n"); + + IPsecLog(ike, c, NULL, NULL, "LI_IKE_NO_TRANSFORM"); + + SendInformationalExchangePacket(ike, c, IkeNewNoticeErrorNoProposalChosenPayload(false, header->InitiatorCookie, header->ResponderCookie)); + } + } + else + { + // Ignore for IKE SA which already exists (Because it's likely to be a re-transmission) + } + } + else + { + // It does not support NAT Traversal + Debug("Client doesn't support NAT-T.\n"); + + IPsecLog(ike, c, NULL, NULL, "LI_IKE_NO_NAT_T"); + } + IkeFree(pr); + } + } + else + { + // Process of state 2 or later + IKE_SA *sa; + + sa = FindIkeSaByResponderCookieAndClient(ike, header->ResponderCookie, c); + + if (sa == NULL) + { + SendInformationalExchangePacketEx(ike, c, IkeNewNoticeErrorInvalidCookiePayload(header->InitiatorCookie, + header->ResponderCookie), true, header->InitiatorCookie, header->ResponderCookie); + } + + if (sa != NULL && sa->Mode == IKE_SA_MAIN_MODE) + { + IKE_PACKET *pr = NULL; + + sa->LastCommTick = ike->Now; + + switch (sa->State) + { + case IKE_SA_MM_STATE_1_SA: + pr = IkeSaRecvPacket(ike, sa, p->Data, p->Size); + if (pr != NULL) + { + // Receive a key exchange packet + IKE_PACKET_PAYLOAD *your_key_payload; + IKE_PACKET_PAYLOAD *your_rand_payload; + IKE_PACKET_PAYLOAD *your_nat_d_1 = NULL; + IKE_PACKET_PAYLOAD *your_nat_d_2 = NULL; + + your_key_payload = IkeGetPayload(pr->PayloadList, IKE_PAYLOAD_KEY_EXCHANGE, 0); + your_rand_payload = IkeGetPayload(pr->PayloadList, IKE_PAYLOAD_RAND, 0); + + if (IkeGetPayloadNum(pr->PayloadList, IKE_PAYLOAD_NAT_D) != 0) + { + sa->Caps.UsingNatTraversalRfc3947 = true; + + your_nat_d_1 = IkeGetPayload(pr->PayloadList, IKE_PAYLOAD_NAT_D, 0); + your_nat_d_2 = IkeGetPayload(pr->PayloadList, IKE_PAYLOAD_NAT_D, 1); + } + + if (IkeGetPayloadNum(pr->PayloadList, IKE_PAYLOAD_NAT_D_DRAFT) != 0) + { + sa->Caps.UsingNatTraversalDraftIetf = true; + + your_nat_d_1 = IkeGetPayload(pr->PayloadList, IKE_PAYLOAD_NAT_D_DRAFT, 0); + your_nat_d_2 = IkeGetPayload(pr->PayloadList, IKE_PAYLOAD_NAT_D_DRAFT, 1); + } + + if (your_key_payload != NULL && your_rand_payload != NULL) + { + // Check the key payload + BUF *your_key_buf = your_key_payload->Payload.KeyExchange.Data; + BUF *your_rand_buf = your_rand_payload->Payload.Rand.Data; + + // DH generation + DH_CTX *dh = IkeDhNewCtx(sa->TransformSetting.Dh); + UINT shared_key_size = (dh == NULL ? 0 : dh->Size); + UCHAR *shared_key = ZeroMalloc(shared_key_size); + + // DH calculation + if (DhCompute(dh, shared_key, your_key_buf->Buf, your_key_buf->Size)) + { + IKE_PACKET *ps; + LIST *payload_list; + IKE_PACKET_PAYLOAD *my_key_payload; + IKE_PACKET_PAYLOAD *my_rand_payload; + BUF *nat_buf1, *nat_buf2; + BUF *iv_buf; + UCHAR iv_hashed_data[IKE_MAX_HASH_SIZE]; + + // Calculation success + sa->DhSharedKey = MemToBuf(shared_key, shared_key_size); + sa->InitiatorRand = RandBuf(IKE_SA_RAND_SIZE); + sa->ResponderRand = CloneBuf(your_rand_buf); + + // Send a key exchange packet + my_key_payload = IkeNewDataPayload(IKE_PAYLOAD_KEY_EXCHANGE, dh->MyPublicKey->Buf, dh->MyPublicKey->Size); + my_rand_payload = IkeNewDataPayload(IKE_PAYLOAD_RAND, sa->InitiatorRand->Buf, sa->InitiatorRand->Size); + + payload_list = NewListSingle(my_key_payload); + Add(payload_list, my_rand_payload); + + // NAT-D packet + // Address of the opponent. Randomize in order to be forced to use NAT + nat_buf1 = IkeCalcNatDetectHash(ike, sa->TransformSetting.Hash, Rand64(), Rand64(), &c->ClientIP, Rand16()); + //nat_buf1 = IkeCalcNatDetectHash(ike, sa->TransformSetting.Hash, sa->InitiatorCookie, sa->ResponderCookie, &c->ClientIP, c->ClientPort); + // My address + + if (c->IsMicrosoft == false || (your_nat_d_1 == NULL || your_nat_d_2 == NULL || your_nat_d_1->BitArray == NULL)) + { + // Calculate exactly + nat_buf2 = IkeCalcNatDetectHash(ike, sa->TransformSetting.Hash, + sa->InitiatorCookie, sa->ResponderCookie, &c->ServerIP, c->ServerPort); + } + else + { + // Parrot the NAT_D payload indicating myself I got from + // the other if it has connected from a Microsoft VPN Client + nat_buf2 = CloneBuf(your_nat_d_1->BitArray); + } + + if (sa->Caps.UsingNatTraversalRfc3947) + { + // RFC-compliant + Add(payload_list, IkeNewDataPayload(IKE_PAYLOAD_NAT_D, nat_buf1->Buf, nat_buf1->Size)); + Add(payload_list, IkeNewDataPayload(IKE_PAYLOAD_NAT_D, nat_buf2->Buf, nat_buf2->Size)); + } + + if (sa->Caps.UsingNatTraversalDraftIetf) + { + // Draft compliant + Add(payload_list, IkeNewDataPayload(IKE_PAYLOAD_NAT_D_DRAFT, nat_buf1->Buf, nat_buf1->Size)); + Add(payload_list, IkeNewDataPayload(IKE_PAYLOAD_NAT_D_DRAFT, nat_buf2->Buf, nat_buf2->Size)); + } + + FreeBuf(nat_buf1); + FreeBuf(nat_buf2); + + ps = IkeNew(sa->InitiatorCookie, sa->ResponderCookie, IKE_EXCHANGE_TYPE_MAIN, + false, false, false, 0, payload_list); + + // Initial IV setting + iv_buf = NewBuf(); + WriteBuf(iv_buf, your_key_buf->Buf, your_key_buf->Size); + WriteBuf(iv_buf, dh->MyPublicKey->Buf, dh->MyPublicKey->Size); + IkeHash(sa->TransformSetting.Hash, iv_hashed_data, iv_buf->Buf, iv_buf->Size); + + BinToStrEx(tmp, sizeof(tmp), iv_hashed_data, sa->BlockSize); + Debug("Initial IV: %s\n", tmp); + + IkeSaUpdateIv(sa, iv_hashed_data, sa->HashSize); + + FreeBuf(iv_buf); + + // Save the DH information + sa->GXi = CloneBuf(your_key_buf); + sa->GXr = CloneBuf(dh->MyPublicKey); + + // Transmission + IkeSaSendPacket(ike, sa, ps); + + IkeFree(ps); + + // Calculate the key set + IkeCalcSaKeySet(ike, sa, NULL); + + sa->State = IKE_SA_MM_STATE_2_KEY; + } + else + { + // DH calculation failure + Debug("DhCompute failed.\n"); + } + + Free(shared_key); + DhFree(dh); + } + } + break; + + case IKE_SA_MM_STATE_2_KEY: + pr = IkeSaRecvPacket(ike, sa, p->Data, p->Size); + if (pr != NULL && pr->FlagEncrypted) + { + // Receive an ID exchange packet + IKE_PACKET_PAYLOAD *your_id_payload = IkeGetPayload(pr->PayloadList, IKE_PAYLOAD_ID, 0); + IKE_PACKET_PAYLOAD *your_hash_payload = IkeGetPayload(pr->PayloadList, IKE_PAYLOAD_HASH, 0); + + if (your_id_payload && your_hash_payload) + { + UCHAR initiator_hash[IKE_MAX_HASH_SIZE]; + BUF *b; + + // Calculate the initiator side hash value + b = NewBuf(); + WriteBufBuf(b, sa->GXi); + WriteBufBuf(b, sa->GXr); + WriteBufInt64(b, sa->InitiatorCookie); + WriteBufInt64(b, sa->ResponderCookie); + WriteBufBuf(b, sa->SAi_b); + WriteBufBuf(b, your_id_payload->BitArray); + + StrCpy(c->ClientId, sizeof(c->ClientId), your_id_payload->Payload.Id.StrData); + Debug("Client ID = %s\n", c->ClientId); + IPsecLog(ike, c, NULL, NULL, NULL, "LI_SET_CLIENT_ID", c->ClientId); + + IkeHMac(sa->TransformSetting.Hash, initiator_hash, sa->SKEYID, sa->HashSize, + b->Buf, b->Size); + + FreeBuf(b); + + // Hash comparison + if (IkeCompareHash(your_hash_payload, initiator_hash, sa->HashSize)) + { + // Generate a response packet + IKE_PACKET *ps; + LIST *payload_list = NewListFast(NULL); + IKE_PACKET_PAYLOAD *my_id_payload, *my_hash_payload; + UCHAR responder_hash[IKE_MAX_HASH_SIZE]; + BUF *idir_b; + + // Generate an ID payload + if (IsIP6(&sa->IkeClient->ServerIP)) + { + // IPv6 address + my_id_payload = IkeNewIdPayload(IKE_ID_IPV6_ADDR, 0, 0, sa->IkeClient->ServerIP.ipv6_addr, 16); + } + else + { + // IPv4 address + my_id_payload = IkeNewIdPayload(IKE_ID_IPV4_ADDR, 0, 0, sa->IkeClient->ServerIP.addr, 4); + } + + // Build the ID payload tentatively + idir_b = IkeBuildIdPayload(&my_id_payload->Payload.Id); + + // Generate the hash payload + b = NewBuf(); + WriteBufBuf(b, sa->GXr); + WriteBufBuf(b, sa->GXi); + WriteBufInt64(b, sa->ResponderCookie); + WriteBufInt64(b, sa->InitiatorCookie); + WriteBufBuf(b, sa->SAi_b); + WriteBufBuf(b, idir_b); + + IkeHMac(sa->TransformSetting.Hash, responder_hash, sa->SKEYID, sa->HashSize, + b->Buf, b->Size); + + FreeBuf(b); + FreeBuf(idir_b); + + my_hash_payload = IkeNewDataPayload(IKE_PAYLOAD_HASH, responder_hash, sa->HashSize); + + Add(payload_list, my_id_payload); + Add(payload_list, my_hash_payload); + + ps = IkeNew(sa->InitiatorCookie, sa->ResponderCookie, IKE_EXCHANGE_TYPE_MAIN, true, false, + false, 0, payload_list); + + // Transmission + IkeSaSendPacket(ike, sa, ps); + sa->NumResends = 3; + + IkeFree(ps); + + StrCpy(c->ClientId, sizeof(c->ClientId), your_id_payload->Payload.Id.StrData); + + // Transit to the established state + Debug("IKE SA 0x%X Established. Client ID=%s\n", sa, c->ClientId); + sa->State = IKE_SA_MM_STATE_3_ESTABLISHED; + sa->EstablishedTick = ike->Now; + c->CurrentIkeSa = sa; + c->NextDpdSendTick = ike->Now + (UINT64)IKE_INTERVAL_DPD_KEEPALIVE; + StrCpy(c->Secret, sizeof(c->Secret), sa->Secret); + sa->Established = true; + + IPsecLog(ike, NULL, sa, NULL, "LI_IKE_SA_ESTABLISHED"); + } + else + { + Debug("IKE SA 0x%X Invalid Hash.\n", sa); + } + } + } + break; + } + + if (pr != NULL) + { + IkeFree(pr); + } + } + } +} + +// Update the IV of IPsec SA +void IPsecSaUpdateIv(IPSECSA *sa, void *iv, UINT iv_size) +{ + // Validate arguments + if (sa == NULL || iv == NULL) + { + return; + } + + Copy(sa->Iv, iv, MIN(sa->IkeSa->BlockSize, iv_size)); + + if (iv_size < sa->IkeSa->BlockSize) + { + Zero(sa->Iv + sa->IkeSa->BlockSize, sa->IkeSa->BlockSize - iv_size); + } + + sa->IsIvExisting = true; +} + +// Update the IV of the IKE SA +void IkeSaUpdateIv(IKE_SA *sa, void *iv, UINT iv_size) +{ + // Validate arguments + if (sa == NULL || iv == NULL) + { + return; + } + + Copy(sa->Iv, iv, MIN(sa->BlockSize, iv_size)); + + if (iv_size < sa->BlockSize) + { + Zero(sa->Iv + sa->BlockSize, sa->BlockSize - iv_size); + } + + sa->IsIvExisting = true; +} + +// Calculate the key set of the IKE SA +void IkeCalcSaKeySet(IKE_SERVER *ike, IKE_SA *sa, char *secret) +{ + BUF *secret_buf; + BUF *rand_buf; + BUF *d_buf, *a_buf, *e_buf; + UCHAR u; + IKE_HASH *h; + char tmp[MAX_SIZE]; + // Validate arguments + if (ike == NULL || sa == NULL) + { + return; + } + + h = sa->TransformSetting.Hash; + + // Calculation of SKEYID + StrCpy(sa->Secret, sizeof(sa->Secret), secret == NULL ? ike->Secret : secret); + secret_buf = IkeStrToPassword(sa->Secret); + rand_buf = CloneBuf(sa->ResponderRand); + SeekBufToEnd(rand_buf); + BinToStrEx(tmp, sizeof(tmp), rand_buf->Buf, rand_buf->Size); + Debug("ResponderRand: %s\n", tmp); + BinToStrEx(tmp, sizeof(tmp), sa->InitiatorRand->Buf, sa->InitiatorRand->Size); + Debug("InitiatorRand: %s\n", tmp); + + WriteBufBuf(rand_buf, sa->InitiatorRand); + + IkeHMacBuf(h, sa->SKEYID, secret_buf, rand_buf); + + BinToStrEx(tmp, sizeof(tmp), sa->SKEYID, sa->HashSize); + Debug("SKEYID: %s\n", tmp); + + // SKEYID_d + d_buf = CloneBuf(sa->DhSharedKey); + SeekBufToEnd(d_buf); + WriteBufInt64(d_buf, sa->InitiatorCookie); + WriteBufInt64(d_buf, sa->ResponderCookie); + u = 0; + WriteBuf(d_buf, &u, 1); + IkeHMac(h, sa->SKEYID_d, sa->SKEYID, sa->HashSize, d_buf->Buf, d_buf->Size); + + BinToStrEx(tmp, sizeof(tmp), sa->SKEYID_d, sa->HashSize); + Debug("SKEYID_d: %s\n", tmp); + + // SKEYID_a + a_buf = MemToBuf(sa->SKEYID_d, sa->HashSize); + SeekBufToEnd(a_buf); + WriteBufBuf(a_buf, sa->DhSharedKey); + WriteBufInt64(a_buf, sa->InitiatorCookie); + WriteBufInt64(a_buf, sa->ResponderCookie); + u = 1; + WriteBuf(a_buf, &u, 1); + IkeHMac(h, sa->SKEYID_a, sa->SKEYID, sa->HashSize, a_buf->Buf, a_buf->Size); + + BinToStrEx(tmp, sizeof(tmp), sa->SKEYID_a, sa->HashSize); + Debug("SKEYID_a: %s\n", tmp); + + // SKEYID_e + e_buf = MemToBuf(sa->SKEYID_a, sa->HashSize); + SeekBufToEnd(e_buf); + WriteBufBuf(e_buf, sa->DhSharedKey); + WriteBufInt64(e_buf, sa->InitiatorCookie); + WriteBufInt64(e_buf, sa->ResponderCookie); + u = 2; + WriteBuf(e_buf, &u, 1); + IkeHMac(h, sa->SKEYID_e, sa->SKEYID, sa->HashSize, e_buf->Buf, e_buf->Size); + + BinToStrEx(tmp, sizeof(tmp), sa->SKEYID_e, sa->HashSize); + Debug("SKEYID_e: %s\n", tmp); + + if (sa->CryptoKey != NULL) + { + IkeFreeKey(sa->CryptoKey); + } + + sa->CryptoKey = IkeNewCryptoKeyFromK(ike, sa->SKEYID_e, sa->HashSize, sa->TransformSetting.Hash, + sa->TransformSetting.Crypto, sa->TransformSetting.CryptoKeySize); + + // Release the memory + FreeBuf(secret_buf); + FreeBuf(rand_buf); + FreeBuf(d_buf); + FreeBuf(a_buf); + FreeBuf(e_buf); +} + +// Extend the key size +BUF *IkeExpandKeySize(IKE_HASH *h, void *k, UINT k_size, UINT target_size) +{ + BUF *b1, *b2; + UCHAR tmp[IKE_MAX_HASH_SIZE]; + UINT tmp_size; + // Validate arguments + if (h == NULL || k == NULL || k_size == 0) + { + return NULL; + } + + if (k_size >= target_size) + { + return MemToBuf(k, target_size); + } + + tmp[0] = 0; + tmp_size = 1; + b1 = NewBuf(); + + do + { + IkeHMac(h, tmp, k, k_size, tmp, tmp_size); + WriteBuf(b1, tmp, h->HashSize); + + tmp_size = h->HashSize; + } + while (b1->Size < target_size); + + b2 = MemToBuf(b1->Buf, target_size); + + FreeBuf(b1); + + return b2; +} + +// Generate a key from K +IKE_CRYPTO_KEY *IkeNewCryptoKeyFromK(IKE_SERVER *ike, void *k, UINT k_size, IKE_HASH *h, IKE_CRYPTO *c, UINT crypto_key_size) +{ + BUF *key_buf; + IKE_CRYPTO_KEY *ret; + // Validate arguments + if (ike == NULL || k == NULL || k_size == 0 || h == NULL || c == NULL || crypto_key_size == 0) + { + return NULL; + } + + key_buf = IkeExpandKeySize(h, k, k_size, crypto_key_size); + if (key_buf == NULL) + { + return NULL; + } + + ret = IkeNewKey(c, key_buf->Buf, key_buf->Size); + + FreeBuf(key_buf); + + return ret; +} + +// Generate a hash for NAT detection +BUF *IkeCalcNatDetectHash(IKE_SERVER *ike, IKE_HASH *hash, UINT64 initiator_cookie, UINT64 responder_cookie, IP *ip, UINT port) +{ + BUF *b; + USHORT us; + USHORT hash_data[IKE_MAX_HASH_SIZE]; + // Validate arguments + if (ike == NULL || ip == NULL || hash == NULL) + { + return NewBuf(); + } + + b = NewBuf(); + + WriteBufInt64(b, initiator_cookie); + WriteBufInt64(b, responder_cookie); + + if (IsIP6(ip)) + { + WriteBuf(b, ip->ipv6_addr, sizeof(ip->ipv6_addr)); + } + else + { + WriteBuf(b, ip->addr, sizeof(ip->addr)); + } + + us = Endian16((USHORT)port); + + WriteBuf(b, &us, sizeof(USHORT)); + + IkeHash(hash, hash_data, b->Buf, b->Size); + + FreeBuf(b); + + return MemToBuf(hash_data, hash->HashSize); +} + +// Check the capacity of the opposite IPsec client +void IkeCheckCaps(IKE_CAPS *caps, IKE_PACKET *p) +{ + // Validate arguments + if (caps == NULL || p == NULL) + { + Zero(caps, sizeof(IKE_CAPS)); + return; + } + + Zero(caps, sizeof(IKE_CAPS)); + + caps->NatTraversalRfc3947 = IkeIsVendorIdExists(p, IKE_VENDOR_ID_RFC3947_NAT_T); + + caps->NatTraversalDraftIetf = IkeIsVendorIdExists(p, IKE_VENDOR_ID_IPSEC_NAT_T_IKE_03) || + IkeIsVendorIdExists(p, IKE_VENDOR_ID_IPSEC_NAT_T_IKE_02) || + IkeIsVendorIdExists(p, IKE_VENDOR_ID_IPSEC_NAT_T_IKE_02_2) || + IkeIsVendorIdExists(p, IKE_VENDOR_ID_IPSEC_NAT_T_IKE_00); + + caps->DpdRfc3706 = IkeIsVendorIdExists(p, IKE_VENDOR_ID_RFC3706_DPD); + + caps->MS_L2TPIPSecVPNClient = IkeIsVendorIdExists(p, IKE_VENDOR_ID_MICROSOFT_L2TP); + caps->MS_NT5_ISAKMP_OAKLEY = IkeIsVendorIdExists(p, IKE_VENDOR_ID_MS_NT5_ISAKMPOAKLEY); + caps->MS_Vid_InitialContact = IkeIsVendorIdExists(p, IKE_VENDOR_ID_MS_VID_INITIALCONTACT); +} + +// Check whether the specified vendor ID is contained in the packet +bool IkeIsVendorIdExists(IKE_PACKET *p, char *str) +{ + BUF *buf; + UINT i, num; + bool ok = false; + // Validate arguments + if (p == NULL || str == NULL) + { + return false; + } + + buf = IkeStrToVendorId(str); + if (buf == NULL) + { + return false; + } + + num = IkeGetPayloadNum(p->PayloadList, IKE_PAYLOAD_VENDOR_ID); + for (i = 0;i < num;i++) + { + IKE_PACKET_PAYLOAD *payload = IkeGetPayload(p->PayloadList, IKE_PAYLOAD_VENDOR_ID, i); + if (payload == NULL) + { + break; + } + + if (CompareBuf(payload->Payload.VendorId.Data, buf)) + { + ok = true; + } + else + { + if (payload->Payload.VendorId.Data != NULL) + { + if (payload->Payload.VendorId.Data->Size >= buf->Size) + { + if (Cmp(payload->Payload.VendorId.Data->Buf, buf->Buf, buf->Size) == 0) + { + ok = true; + } + } + } + } + } + + FreeBuf(buf); + + return ok; +} + +// Add the vendor ID payload list +void IkeAddVendorIdPayloads(IKE_PACKET *p) +{ + // Validate arguments + if (p == NULL) + { + return; + } + + IkeAddVendorId(p, IKE_VENDOR_ID_RFC3947_NAT_T); + IkeAddVendorId(p, IKE_VENDOR_ID_IPSEC_NAT_T_IKE_03); + IkeAddVendorId(p, IKE_VENDOR_ID_IPSEC_NAT_T_IKE_02); + IkeAddVendorId(p, IKE_VENDOR_ID_IPSEC_NAT_T_IKE_02_2); + IkeAddVendorId(p, IKE_VENDOR_ID_IPSEC_NAT_T_IKE_00); + IkeAddVendorId(p, IKE_VENDOR_ID_RFC3706_DPD); +} + +// Add the vendor ID payload +void IkeAddVendorId(IKE_PACKET *p, char *str) +{ + BUF *buf; + IKE_PACKET_PAYLOAD *payload; + // Validate arguments + if (p == NULL || str == NULL) + { + return; + } + + buf = IkeStrToVendorId(str); + if (buf == NULL) + { + return; + } + + payload = IkeNewDataPayload(IKE_PAYLOAD_VENDOR_ID, buf->Buf, buf->Size); + + Add(p->PayloadList, payload); + + FreeBuf(buf); +} + +// Convert string to the vendor ID +BUF *IkeStrToVendorId(char *str) +{ + // Validate arguments + if (IsEmptyStr(str)) + { + return NULL; + } + + if (StartWith(str, "0x")) + { + BUF *buf = StrToBin(str + 2); + + if (buf == NULL || buf->Size == 0) + { + FreeBuf(buf); + return NULL; + } + + return buf; + } + else + { + BUF *buf; + UCHAR hash[MD5_SIZE]; + + Md5(hash, str, StrLen(str)); + + buf = MemToBuf(hash, sizeof(hash)); + + return buf; + } +} + +// Receive a packet using the IKE SA +IKE_PACKET *IkeSaRecvPacket(IKE_SERVER *ike, IKE_SA *sa, void *data, UINT size) +{ + IKE_PACKET *ret; + // Validate arguments + if (ike == NULL || sa == NULL || (size != 0 && data == NULL)) + { + return NULL; + } + + if (sa->IsIvExisting == false || sa->CryptoKey == NULL) + { + ret = IkeParse(data, size, NULL); + } + else + { + IKE_CRYPTO_PARAM cp; + + Copy(&cp.Iv, sa->Iv, sa->BlockSize); + cp.Key = sa->CryptoKey; + + ret = IkeParse(data, size, &cp); + + if (ret->FlagEncrypted) + { + IkeSaUpdateIv(sa, cp.NextIv, sa->BlockSize); + } + } + + return ret; +} + +// Receive a packet using IPsec SA (Quick Mode received) +IKE_PACKET *IPsecSaRecvPacket(IKE_SERVER *ike, IPSECSA *sa, void *data, UINT size) +{ + IKE_PACKET *ret; + // Validate arguments + if (ike == NULL || sa == NULL || (size != 0 && data == NULL)) + { + return NULL; + } + + if (sa->IsIvExisting == false || sa->IkeSa->CryptoKey == NULL) + { + ret = IkeParse(data, size, NULL); + } + else + { + IKE_CRYPTO_PARAM cp; + + Copy(&cp.Iv, sa->Iv, sa->IkeSa->BlockSize); + cp.Key = sa->IkeSa->CryptoKey; + + ret = IkeParse(data, size, &cp); + + if (ret->FlagEncrypted) + { + IPsecSaUpdateIv(sa, cp.NextIv, sa->IkeSa->BlockSize); + IPsecSaUpdateIv(sa->PairIPsecSa, cp.NextIv, sa->IkeSa->BlockSize); + } + } + + return ret; +} + +// Send a packet using IPsec SA (Quick Mode transmission) +void IPsecSaSendPacket(IKE_SERVER *ike, IPSECSA *sa, IKE_PACKET *p) +{ + BUF *buf; + // Validate arguments + if (ike == NULL || sa == NULL) + { + return; + } + + if (p == NULL) + { + FreeBuf(sa->SendBuffer); + sa->SendBuffer = NULL; + sa->NextSendTick = 0; + return; + } + + // Build a packet + if (p->FlagEncrypted == false) + { + buf = IkeBuild(p, NULL); + } + else + { + IKE_CRYPTO_PARAM cp; + + Copy(cp.Iv, sa->Iv, sa->IkeSa->BlockSize); + cp.Key = sa->IkeSa->CryptoKey; + + buf = IkeBuild(p, &cp); + + IPsecSaUpdateIv(sa, cp.NextIv, sa->IkeSa->BlockSize); + IPsecSaUpdateIv(sa->PairIPsecSa, cp.NextIv, sa->IkeSa->BlockSize); + } + + if (buf == NULL) + { + return; + } + + // Register the last packet to re-transmit + if (sa->SendBuffer != NULL) + { + FreeBuf(sa->SendBuffer); + } + + sa->SendBuffer = CloneBuf(buf); + sa->NextSendTick = ike->Now + (UINT64)(IKE_SA_RESEND_INTERVAL); + AddInterrupt(ike->Interrupts, sa->NextSendTick); + + IkeSendUdpPacket(ike, IKE_UDP_TYPE_ISAKMP, &sa->IkeClient->ServerIP, sa->IkeClient->ServerPort, + &sa->IkeClient->ClientIP, sa->IkeClient->ClientPort, + buf->Buf, buf->Size); + + Free(buf); +} + +// Send a packet using the IKE SA +void IkeSaSendPacket(IKE_SERVER *ike, IKE_SA *sa, IKE_PACKET *p) +{ + BUF *buf; + // Validate arguments + if (ike == NULL || sa == NULL) + { + return; + } + + if (p == NULL) + { + FreeBuf(sa->SendBuffer); + sa->SendBuffer = NULL; + sa->NextSendTick = 0; + return; + } + + // Build a packet + if (p->FlagEncrypted == false) + { + buf = IkeBuild(p, NULL); + } + else + { + IKE_CRYPTO_PARAM cp; + + Copy(cp.Iv, sa->Iv, sa->BlockSize); + cp.Key = sa->CryptoKey; + + buf = IkeBuild(p, &cp); + + IkeSaUpdateIv(sa, cp.NextIv, sa->BlockSize); + } + + if (buf == NULL) + { + return; + } + + if (p->ExchangeType != IKE_EXCHANGE_TYPE_INFORMATION) + { + // Register the last packet to re-transmit + if (sa->SendBuffer != NULL) + { + FreeBuf(sa->SendBuffer); + } + + sa->SendBuffer = CloneBuf(buf); + sa->NextSendTick = ike->Now + (UINT64)(IKE_SA_RESEND_INTERVAL); + AddInterrupt(ike->Interrupts, sa->NextSendTick); + } + + IkeSendUdpPacket(ike, IKE_UDP_TYPE_ISAKMP, &sa->IkeClient->ServerIP, sa->IkeClient->ServerPort, + &sa->IkeClient->ClientIP, sa->IkeClient->ClientPort, + buf->Buf, buf->Size); + + Free(buf); +} + +// Send an UDP packet +void IkeSendUdpPacket(IKE_SERVER *ike, UINT type, IP *server_ip, UINT server_port, IP *client_ip, UINT client_port, void *data, UINT size) +{ + UDPPACKET *p; + // Validate arguments + if (ike == NULL || server_ip == NULL || client_ip == NULL || server_port == 0 || client_port == 0 || data == NULL || size == 0) + { + return; + } + + p = NewUdpPacket(server_ip, server_port, client_ip, client_port, data, size); + + p->Type = type; + + Add(ike->SendPacketList, p); +} + +// Create an IKE SA +IKE_SA *NewIkeSa(IKE_SERVER *ike, IKE_CLIENT *c, UINT64 init_cookie, UINT mode, IKE_SA_TRANSFORM_SETTING *setting) +{ + IKE_SA *sa; + // Validate arguments + if (ike == NULL || c == NULL || init_cookie == 0 || setting == NULL) + { + return NULL; + } + + sa = ZeroMalloc(sizeof(IKE_SA)); + + sa->Id = ++ike->CurrentIkeSaId; + + sa->IkeClient = c; + sa->InitiatorCookie = init_cookie; + sa->ResponderCookie = GenerateNewResponserCookie(ike); + sa->Mode = mode; + sa->FirstCommTick = sa->LastCommTick = ike->Now; + Copy(&sa->TransformSetting, setting, sizeof(IKE_SA_TRANSFORM_SETTING)); + + Debug("New IKE SA (Mode = %u): %I64u <--> %I64u (%s %s %s(%u) %u %u)\n", + mode, + sa->InitiatorCookie, + sa->ResponderCookie, + setting->Dh->Name, setting->Hash->Name, setting->Crypto->Name, setting->CryptoKeySize, + setting->LifeKilobytes, setting->LifeSeconds); + + IPsecLog(ike, NULL, sa, NULL, "LI_NEW_IKE_SA", + (mode == IKE_SA_MAIN_MODE ? _UU("LI_TAG_MAINMODE") : _UU("LI_TAG_AGGRESSIVE")), + sa->InitiatorCookie, sa->ResponderCookie, + setting->Dh->Name, setting->Hash->Name, setting->Crypto->Name, setting->CryptoKeySize * 8, + setting->LifeKilobytes, setting->LifeSeconds); + + return sa; +} + +// Search an IKE SA from the Responder Cookie +IKE_SA *FindIkeSaByResponderCookie(IKE_SERVER *ike, UINT64 responder_cookie) +{ + IKE_SA t; + // Validate arguments + if (ike == NULL || responder_cookie == 0) + { + return NULL; + } + + t.ResponderCookie = responder_cookie; + + return Search(ike->IkeSaList, &t); +} + +// Search an IKE SA from the Responder Cookie and the IKE_CLIENT +IKE_SA *FindIkeSaByResponderCookieAndClient(IKE_SERVER *ike, UINT64 responder_cookie, IKE_CLIENT *c) +{ + IKE_SA *sa; + // Validate arguments + if (ike == NULL || responder_cookie == 0 || c == NULL) + { + return NULL; + } + + sa = FindIkeSaByResponderCookie(ike, responder_cookie); + if (sa == NULL) + { + return NULL; + } + + if (sa->IkeClient != c) + { + return NULL; + } + + return sa; +} + +// Search an IKE SA from the endpoint and the Initiator Cookie +IKE_SA *FindIkeSaByEndPointAndInitiatorCookie(IKE_SERVER *ike, IP *client_ip, UINT client_port, IP *server_ip, UINT server_port, UINT64 init_cookie, UINT mode) +{ + UINT i; + // Validate arguments + if (ike == NULL || client_ip == NULL || server_ip == NULL || client_port == 0 || server_port == 0 || init_cookie == 0) + { + return NULL; + } + + for (i = 0;i < LIST_NUM(ike->IkeSaList);i++) + { + IKE_SA *sa = LIST_DATA(ike->IkeSaList, i); + IKE_CLIENT *c; + + c = sa->IkeClient; + + if (CmpIpAddr(&c->ClientIP, client_ip) == 0 && + CmpIpAddr(&c->ServerIP, server_ip) == 0 && + c->ClientPort == client_port && + c->ServerPort == server_port && + sa->InitiatorCookie == init_cookie && + sa->Mode == mode) + { + return sa; + } + } + + return NULL; +} + +// Get the number of IPsec SA that is associated with the IKE_CLIENT +UINT GetNumberOfIPsecSaOfIkeClient(IKE_SERVER *ike, IKE_CLIENT *c) +{ + UINT num = 0, i; + // Validate arguments + if (ike == NULL || c == NULL) + { + return 0; + } + + for (i = 0;i < LIST_NUM(ike->IPsecSaList);i++) + { + IPSECSA *sa = LIST_DATA(ike->IPsecSaList, i); + + if (sa->IkeClient == c) + { + num++; + } + } + + return num; +} + +// Get the number of IKE SA that is associated with the IKE_CLIENT +UINT GetNumberOfIkeSaOfIkeClient(IKE_SERVER *ike, IKE_CLIENT *c) +{ + UINT num = 0, i; + // Validate arguments + if (ike == NULL || c == NULL) + { + return 0; + } + + for (i = 0;i < LIST_NUM(ike->IkeSaList);i++) + { + IKE_SA *sa = LIST_DATA(ike->IkeSaList, i); + + if (sa->IkeClient == c) + { + num++; + } + } + + return num; +} + +// Get the number of clients that are connected from the specified IP address +UINT GetNumberOfIkeClientsFromIP(IKE_SERVER *ike, IP *client_ip) +{ + UINT i, num; + // Validate arguments + if (ike == NULL || client_ip == NULL) + { + return 0; + } + + num = 0; + + for (i = 0;i < LIST_NUM(ike->ClientList);i++) + { + IKE_CLIENT *c = LIST_DATA(ike->ClientList, i); + + if (CmpIpAddr(&c->ClientIP, client_ip) == 0) + { + num++; + } + } + + return num; +} + +// Find the appropriate IKE client. Create if it is absent +IKE_CLIENT *SearchOrCreateNewIkeClientForIkePacket(IKE_SERVER *ike, IP *client_ip, UINT client_port, IP *server_ip, UINT server_port, IKE_PACKET *pr) +{ + IKE_CLIENT *c; + // Validate arguments + if (ike == NULL || pr == NULL || client_ip == NULL || server_ip == NULL || client_port == 0 || server_port == 0) + { + return NULL; + } + + c = SearchIkeClientForIkePacket(ike, client_ip, client_port, server_ip, server_port, pr); + if (c == NULL) + { + if (GetNumberOfIkeClientsFromIP(ike, client_ip) > IKE_QUOTA_MAX_NUM_CLIENTS_PER_IP || + LIST_NUM(ike->ClientList) > IKE_QUOTA_MAX_NUM_CLIENTS) + { + return NULL; + } + + + c = NewIkeClient(ike, client_ip, client_port, server_ip, server_port); + + Insert(ike->ClientList, c); + } + + return SetIkeClientEndpoint(ike, c, client_ip, client_port, server_ip, server_port); +} + +// Create an IKE client +IKE_CLIENT *NewIkeClient(IKE_SERVER *ike, IP *client_ip, UINT client_port, IP *server_ip, UINT server_port) +{ + IKE_CLIENT *c; + char client_ip_str[MAX_SIZE]; + char server_ip_str[MAX_SIZE]; + // Validate arguments + if (ike == NULL || client_ip == NULL || server_ip == NULL || client_port == 0 || server_port == 0) + { + return NULL; + } + + c = ZeroMalloc(sizeof(IKE_CLIENT)); + + c->Id = ++ike->CurrentIkeClientId; + + Copy(&c->ClientIP, client_ip, sizeof(IP)); + c->ClientPort = client_port; + + Copy(&c->ServerIP, server_ip, sizeof(IP)); + Copy(&c->TransportModeServerIP, server_ip, sizeof(IP)); + Copy(&c->TransportModeClientIP, client_ip, sizeof(IP)); + c->ServerPort = server_port; + + c->LastCommTick = ike->Now; + c->FirstCommTick = ike->Now; + + IPToStr(client_ip_str, sizeof(client_ip_str), client_ip); + IPToStr(server_ip_str, sizeof(server_ip_str), server_ip); + + Debug("New IKE_CLIENT: %p: %s:%u -> %s:%u\n", c, client_ip_str, client_port, server_ip_str, server_port); + + IPsecLog(ike, c, NULL, NULL, "LI_NEW_IKE_CLIENT"); + + return c; +} + +// Search for the best associated IKE client when an IKE packet has been received +IKE_CLIENT *SearchIkeClientForIkePacket(IKE_SERVER *ike, IP *client_ip, UINT client_port, IP *server_ip, UINT server_port, IKE_PACKET *pr) +{ + IKE_CLIENT t; + IKE_CLIENT *c = NULL; + // Validate arguments + if (ike == NULL || pr == NULL || client_ip == NULL || server_ip == NULL || client_port == 0 || server_port == 0) + { + return NULL; + } + + if (true) + { + UINT i; + + if (pr->InitiatorCookie != 0 && pr->ResponderCookie != 0) + { + for (i = 0;i < LIST_NUM(ike->IkeSaList);i++) + { + IKE_SA *sa = LIST_DATA(ike->IkeSaList, i); + + // Extract what Cookie matches exactly + if (sa->InitiatorCookie == pr->InitiatorCookie && sa->ResponderCookie == pr->ResponderCookie) + { + IKE_CLIENT *cc = sa->IkeClient; + + if (CmpIpAddr(&cc->ServerIP, server_ip) == 0 && + CmpIpAddr(&cc->ClientIP, client_ip) == 0) + { + c = cc; + break; + } + } + } + } + } + + if (c == NULL) + { + // Search by a pair of IP address and port number + Copy(&t.ClientIP, client_ip, sizeof(IP)); + t.ClientPort = client_port; + Copy(&t.ServerIP, server_ip, sizeof(IP)); + t.ServerPort = server_port; + + c = Search(ike->ClientList, &t); + + if (c != NULL)// && server_port == IPSEC_PORT_IPSEC_ISAKMP) + { + // Search that the IKE_SA that points to this IKE_CLIENT exists and match the Cookie + bool ok = false; + UINT i; + + if (server_port == IPSEC_PORT_IPSEC_ESP_UDP) + { + // Regard as OK if the port number exactly match in the case of connecting to a server-side 4500 + ok = true; + } + else + { + if (c->CurrentIkeSa != NULL && + c->CurrentIkeSa->InitiatorCookie == pr->InitiatorCookie && + c->CurrentIkeSa->ResponderCookie == pr->ResponderCookie) + { + ok = true; + } + else + { + for (i = 0;i < LIST_NUM(ike->IkeSaList);i++) + { + IKE_SA *sa = LIST_DATA(ike->IkeSaList, i); + + if (sa->IkeClient == c) + { + if (sa->InitiatorCookie == pr->InitiatorCookie && + sa->ResponderCookie == pr->ResponderCookie) + { + ok = true; + break; + } + } + } + } + } + + if (ok == false) + { + // Not found + c = NULL; + } + } + } + + return c; +} + +// Comparison of IPsec SA +int CmpIPsecSa(void *p1, void *p2) +{ + IPSECSA *sa1, *sa2; + int r; + // Validate arguments + if (p1 == NULL || p2 == NULL) + { + return 0; + } + sa1 = *(IPSECSA **)p1; + sa2 = *(IPSECSA **)p2; + if (sa1 == NULL || sa2 == NULL) + { + return 0; + } + + r = COMPARE_RET(sa1->ServerToClient, sa2->ServerToClient); + if (r != 0) + { + return r; + } + + r = COMPARE_RET(sa1->Spi, sa2->Spi); + + return r; +} + +// Comparison of IKE_SA +int CmpIkeSa(void *p1, void *p2) +{ + IKE_SA *sa1, *sa2; + int r; + // Validate arguments + if (p1 == NULL || p2 == NULL) + { + return 0; + } + sa1 = *(IKE_SA **)p1; + sa2 = *(IKE_SA **)p2; + if (sa1 == NULL || sa2 == NULL) + { + return 0; + } + + r = COMPARE_RET(sa1->ResponderCookie, sa2->ResponderCookie); + + return r; +} + +// Comparison of IKE_CLIENT +int CmpIkeClient(void *p1, void *p2) +{ + IKE_CLIENT *c1, *c2; + int r; + // Validate arguments + if (p1 == NULL || p2 == NULL) + { + return 0; + } + c1 = *(IKE_CLIENT **)p1; + c2 = *(IKE_CLIENT **)p2; + if (c1 == NULL || c2 == NULL) + { + return 0; + } + + r = CmpIpAddr(&c1->ClientIP, &c2->ClientIP); + if (r != 0) + { + return r; + } + + r = CmpIpAddr(&c1->ServerIP, &c2->ServerIP); + if (r != 0) + { + return r; + } + + r = COMPARE_RET(c1->ClientPort, c2->ClientPort); + if (r != 0) + { + return r; + } + + r = COMPARE_RET(c1->ServerPort, c2->ServerPort); + if (r != 0) + { + return r; + } + + return 0; +} + +// Update the endpoint information of IKE_CLIENT +IKE_CLIENT *SetIkeClientEndpoint(IKE_SERVER *ike, IKE_CLIENT *c, IP *client_ip, UINT client_port, IP *server_ip, UINT server_port) +{ + char client_ip_str[MAX_SIZE]; + char server_ip_str[MAX_SIZE]; + IKE_CLIENT *ret = c; + IKE_CLIENT *cc; + IKE_CLIENT t; + // Validate arguments + if (ike == NULL || c == NULL || client_ip == NULL || client_port == 0 || server_ip == NULL || server_port == 0) + { + return NULL; + } + + if (CmpIpAddr(&c->ClientIP, client_ip) == 0 && + CmpIpAddr(&c->ServerIP, server_ip) == 0 && + c->ClientPort == client_port && + c->ServerPort == server_port) + { + // No change + return ret; + } + + if (IS_SPECIAL_PORT(client_port) || IS_SPECIAL_PORT(server_port)) + { + // Don't change in the case of Raw socket + return ret; + } + + // Search for an existing IKE_CLIENT which exactly matches to combination of the new IP address and the port number + Copy(&t.ClientIP, client_ip, sizeof(IP)); + t.ClientPort = client_port; + Copy(&t.ServerIP, server_ip, sizeof(IP)); + t.ServerPort = server_port; + + cc = Search(ike->ClientList, &t); + if (cc != NULL && c != cc && cc->Deleting == false && c->L2TP == NULL) + { + UINT i; + // Merge into this existing IKE_CLIENT since it found + for (i = 0;i < LIST_NUM(ike->IkeSaList);i++) + { + IKE_SA *sa = LIST_DATA(ike->IkeSaList, i); + + if (sa->IkeClient == c) + { + sa->IkeClient = cc; + } + } + for (i = 0;i < LIST_NUM(ike->IPsecSaList);i++) + { + IPSECSA *sa = LIST_DATA(ike->IPsecSaList, i); + + if (sa->IkeClient == c) + { + sa->IkeClient = cc; + } + } + + if (cc->LastCommTick < c->LastCommTick) + { + StrCpy(cc->ClientId, sizeof(cc->ClientId), c->ClientId); + } + + cc->FirstCommTick = MIN(cc->FirstCommTick, c->FirstCommTick); + cc->LastCommTick = MAX(cc->LastCommTick, c->LastCommTick); + + ret = cc; + + IPToStr(client_ip_str, sizeof(client_ip_str), client_ip); + IPToStr(server_ip_str, sizeof(server_ip_str), server_ip); + + Debug("Merge IKE_CLIENT: %p->%p: %s:%u -> %s:%u\n", c, cc, client_ip_str, client_port, server_ip_str, server_port); + + IPsecLog(ike, c, NULL, NULL, "LI_CLIENT_MERGE", c->Id, cc->Id, cc->Id); + + // Remove old IKE_CLIENT from the list and free + Delete(ike->ClientList, c); + FreeIkeClient(ike, c); + } + else + { + // Rewrite the end point information of this IKE_CLIENT because not found + Copy(&c->ClientIP, client_ip, sizeof(IP)); + Copy(&c->ServerIP, server_ip, sizeof(IP)); + c->ClientPort = client_port; + c->ServerPort = server_port; + + IPToStr(client_ip_str, sizeof(client_ip_str), client_ip); + IPToStr(server_ip_str, sizeof(server_ip_str), server_ip); + + Debug("Update IKE_CLIENT: %p: %s:%u -> %s:%u\n", c, client_ip_str, client_port, server_ip_str, server_port); + + IPsecLog(ike, c, NULL, NULL, "LI_CLIENT_UPDATE"); + + ike->ClientList->sorted = false; + } + + return ret; +} + +// Select the optimal transform setting for IPsec SA +bool GetBestTransformSettingForIPsecSa(IKE_SERVER *ike, IKE_PACKET *pr, IPSEC_SA_TRANSFORM_SETTING *setting, IP *server_ip) +{ + IKE_PACKET_PAYLOAD *sa_payload; + IKE_PACKET_SA_PAYLOAD *sa; + UINT i, num; + bool ocmii_flag = false; + // Validate arguments + if (ike == NULL || pr == NULL || setting == NULL || server_ip == NULL) + { + return false; + } + + Zero(setting, sizeof(IPSEC_SA_TRANSFORM_SETTING)); + + // Get the SA payload + sa_payload = IkeGetPayload(pr->PayloadList, IKE_PAYLOAD_SA, 0); + if (sa_payload == NULL) + { + return false; + } + + sa = &sa_payload->Payload.Sa; + + // Scan all proposal payloads + num = IkeGetPayloadNum(sa->PayloadList, IKE_PAYLOAD_PROPOSAL); + for (i = 0;i < num;i++) + { + IKE_PACKET_PAYLOAD *proposal_payload = IkeGetPayload(sa->PayloadList, IKE_PAYLOAD_PROPOSAL, i); + + if (proposal_payload != NULL) + { + IKE_PACKET_PROPOSAL_PAYLOAD *proposal = &proposal_payload->Payload.Proposal; + + // Examine the contents of the proposal payload + if (proposal->ProtocolId == IKE_PROTOCOL_ID_IPSEC_ESP && proposal->Spi->Size == 4) + { + // Scan all transform payloads + UINT j, num2; + + num2 = IkeGetPayloadNum(proposal->PayloadList, IKE_PAYLOAD_TRANSFORM); + for (j = 0;j < num2;j++) + { + IKE_PACKET_PAYLOAD *transform_payload = IkeGetPayload(proposal->PayloadList, IKE_PAYLOAD_TRANSFORM, j); + if (transform_payload != NULL) + { + IKE_PACKET_TRANSFORM_PAYLOAD *transform = &transform_payload->Payload.Transform; + IPSEC_SA_TRANSFORM_SETTING set; + + Zero(&set, sizeof(set)); + + if (TransformPayloadToTransformSettingForIPsecSa(ike, transform, &set, server_ip)) + { + Copy(setting, &set, sizeof(IPSEC_SA_TRANSFORM_SETTING)); + + setting->SpiServerToClient = READ_UINT(proposal->Spi->Buf); + + return true; + } + else + { + if (set.OnlyCapsuleModeIsInvalid) + { + if (ocmii_flag == false) + { + Copy(setting, &set, sizeof(IPSEC_SA_TRANSFORM_SETTING)); + ocmii_flag = true; + } + } + } + } + } + } + } + } + + return false; +} + +// Select the optimal transform settings for the IKE SA +bool GetBestTransformSettingForIkeSa(IKE_SERVER *ike, IKE_PACKET *pr, IKE_SA_TRANSFORM_SETTING *setting) +{ + IKE_PACKET_PAYLOAD *sa_payload; + IKE_PACKET_SA_PAYLOAD *sa; + UINT i, num; + // Validate arguments + if (ike == NULL || pr == NULL || setting == NULL) + { + return false; + } + + // Get the SA payload + sa_payload = IkeGetPayload(pr->PayloadList, IKE_PAYLOAD_SA, 0); + if (sa_payload == NULL) + { + return false; + } + + sa = &sa_payload->Payload.Sa; + + // Scan all proposal payloads + num = IkeGetPayloadNum(sa->PayloadList, IKE_PAYLOAD_PROPOSAL); + for (i = 0;i < num;i++) + { + IKE_PACKET_PAYLOAD *proposal_payload = IkeGetPayload(sa->PayloadList, IKE_PAYLOAD_PROPOSAL, i); + + if (proposal_payload != NULL) + { + IKE_PACKET_PROPOSAL_PAYLOAD *proposal = &proposal_payload->Payload.Proposal; + + // Examine the contents of the proposal payload + if (proposal->ProtocolId == IKE_PROTOCOL_ID_IKE) + { + // Scan all transform payloads + UINT j, num2; + + num2 = IkeGetPayloadNum(proposal->PayloadList, IKE_PAYLOAD_TRANSFORM); + for (j = 0;j < num2;j++) + { + IKE_PACKET_PAYLOAD *transform_payload = IkeGetPayload(proposal->PayloadList, IKE_PAYLOAD_TRANSFORM, j); + if (transform_payload != NULL) + { + IKE_PACKET_TRANSFORM_PAYLOAD *transform = &transform_payload->Payload.Transform; + + if (transform->TransformId == IKE_TRANSFORM_ID_P1_KEY_IKE) + { + IKE_SA_TRANSFORM_SETTING set; + + if (TransformPayloadToTransformSettingForIkeSa(ike, transform, &set)) + { + Copy(setting, &set, sizeof(IKE_SA_TRANSFORM_SETTING)); + return true; + } + } + } + } + } + } + } + + return false; +} + +// Convert a structure to the transform payload (for IPsec SA) +IKE_PACKET_PAYLOAD *TransformSettingToTransformPayloadForIPsec(IKE_SERVER *ike, IPSEC_SA_TRANSFORM_SETTING *setting) +{ + LIST *value_list; + // Validate arguments + if (ike == NULL || setting == NULL) + { + return NULL; + } + + value_list = NewListFast(NULL); + + Add(value_list, IkeNewTransformValue(IKE_TRANSFORM_VALUE_P2_HMAC, setting->HashId)); + + if (setting->Dh != NULL) + { + Add(value_list, IkeNewTransformValue(IKE_TRANSFORM_VALUE_P2_DH_GROUP, setting->DhId)); + } + + if (setting->LifeSeconds != INFINITE) + { + Add(value_list, IkeNewTransformValue(IKE_TRANSFORM_VALUE_P2_LIFE_TYPE, IKE_P2_LIFE_TYPE_SECONDS)); + Add(value_list, IkeNewTransformValue(IKE_TRANSFORM_VALUE_P2_LIFE_VALUE, setting->LifeSeconds)); + } + + if (setting->LifeKilobytes != INFINITE) + { + Add(value_list, IkeNewTransformValue(IKE_TRANSFORM_VALUE_P2_LIFE_TYPE, IKE_P2_LIFE_TYPE_KILOBYTES)); + Add(value_list, IkeNewTransformValue(IKE_TRANSFORM_VALUE_P2_LIFE_VALUE, setting->LifeKilobytes)); + } + + if (setting->Crypto->VariableKeySize) + { + Add(value_list, IkeNewTransformValue(IKE_TRANSFORM_VALUE_P2_KEY_SIZE, setting->CryptoKeySize * 8)); + } + + Add(value_list, IkeNewTransformValue(IKE_TRANSFORM_VALUE_P2_CAPSULE, setting->CapsuleMode)); + + return IkeNewTransformPayload(1, setting->CryptoId, value_list); +} + +// Convert a structure to the transform payload (for IKE SA) +IKE_PACKET_PAYLOAD *TransformSettingToTransformPayloadForIke(IKE_SERVER *ike, IKE_SA_TRANSFORM_SETTING *setting) +{ + LIST *value_list; + // Validate arguments + if (ike == NULL || setting == NULL) + { + return NULL; + } + + value_list = NewListFast(NULL); + + Add(value_list, IkeNewTransformValue(IKE_TRANSFORM_VALUE_P1_CRYPTO, setting->CryptoId)); + Add(value_list, IkeNewTransformValue(IKE_TRANSFORM_VALUE_P1_HASH, setting->HashId)); + Add(value_list, IkeNewTransformValue(IKE_TRANSFORM_VALUE_P1_AUTH_METHOD, IKE_P1_AUTH_METHOD_PRESHAREDKEY)); + Add(value_list, IkeNewTransformValue(IKE_TRANSFORM_VALUE_P1_DH_GROUP, setting->DhId)); + + if (setting->LifeSeconds != INFINITE) + { + Add(value_list, IkeNewTransformValue(IKE_TRANSFORM_VALUE_P1_LIFE_TYPE, IKE_P1_LIFE_TYPE_SECONDS)); + Add(value_list, IkeNewTransformValue(IKE_TRANSFORM_VALUE_P1_LIFE_VALUE, setting->LifeSeconds)); + } + + if (setting->LifeKilobytes != INFINITE) + { + Add(value_list, IkeNewTransformValue(IKE_TRANSFORM_VALUE_P1_LIFE_TYPE, IKE_P1_LIFE_TYPE_KILOBYTES)); + Add(value_list, IkeNewTransformValue(IKE_TRANSFORM_VALUE_P1_LIFE_VALUE, setting->LifeKilobytes)); + } + + if (setting->Crypto->VariableKeySize) + { + Add(value_list, IkeNewTransformValue(IKE_TRANSFORM_VALUE_P1_KET_SIZE, setting->CryptoKeySize * 8)); + } + + return IkeNewTransformPayload(1, IKE_TRANSFORM_ID_P1_KEY_IKE, value_list); +} + +// Convert a transform payload to a structure (for IPsec SA) +bool TransformPayloadToTransformSettingForIPsecSa(IKE_SERVER *ike, IKE_PACKET_TRANSFORM_PAYLOAD *transform, IPSEC_SA_TRANSFORM_SETTING *setting, IP *server_ip) +{ + UINT i; + UINT capsule_mode; + bool is_esp_supported; + // Validate arguments + if (ike == NULL || transform == NULL || setting == NULL || server_ip == NULL) + { + return false; + } + + is_esp_supported = IsUdpPortOpened(ike->IPsec->UdpListener, server_ip, IPSEC_PORT_IPSEC_ESP_RAW); + + Zero(setting, sizeof(IPSEC_SA_TRANSFORM_SETTING)); + + setting->CryptoId = transform->TransformId; + setting->HashId = IkeGetTransformValue(transform, IKE_TRANSFORM_VALUE_P2_HMAC, 0); + + setting->DhId = IkeGetTransformValue(transform, IKE_TRANSFORM_VALUE_P2_DH_GROUP, 0); + + setting->LifeKilobytes = INFINITE; + setting->LifeSeconds = INFINITE; + + for (i = 0;i < IkeGetTransformValueNum(transform, IKE_TRANSFORM_VALUE_P2_LIFE_TYPE);i++) + { + UINT life_type = IkeGetTransformValue(transform, IKE_TRANSFORM_VALUE_P2_LIFE_TYPE, i); + + switch (life_type) + { + case IKE_P2_LIFE_TYPE_SECONDS: // Number of seconds + setting->LifeSeconds = IkeGetTransformValue(transform, IKE_TRANSFORM_VALUE_P2_LIFE_VALUE, i); + break; + + case IKE_P2_LIFE_TYPE_KILOBYTES: // Kilobytes + setting->LifeKilobytes = IkeGetTransformValue(transform, IKE_TRANSFORM_VALUE_P2_LIFE_VALUE, i); + break; + + default: + // Unsupported expiration type + return false; + } + } + + setting->Crypto = GetIkeCrypto(ike->Engine, true, setting->CryptoId); + setting->Hash = GetIkeHash(ike->Engine, true, setting->HashId); + setting->Dh = GetIkeDh(ike->Engine, true, setting->DhId); + + if (setting->Crypto == NULL || setting->Hash == NULL) + { + // Unsupported algorithm + return false; + } + + if (setting->Crypto->VariableKeySize) + { + // Get the actual key size in the case of variable key size + setting->CryptoKeySize = IkeGetTransformValue(transform, IKE_TRANSFORM_VALUE_P2_KEY_SIZE, 0); + + // bits -> bytes + setting->CryptoKeySize = setting->CryptoKeySize / 8; + + if (setting->CryptoKeySize == 0 || IkeCheckKeySize(setting->Crypto, setting->CryptoKeySize) == false) + { + // The key size is not specified or inappropriate + return false; + } + } + else + { + // Get a fixed key length for fixed key size + setting->CryptoKeySize = setting->Crypto->KeySizes[0]; + } + + capsule_mode = IkeGetTransformValue(transform, IKE_TRANSFORM_VALUE_P2_CAPSULE, 0); + if (capsule_mode != IKE_P2_CAPSULE_NAT_TUNNEL_1 && capsule_mode != IKE_P2_CAPSULE_NAT_TUNNEL_2 && + capsule_mode != IKE_P2_CAPSULE_NAT_TRANSPORT_1 && capsule_mode != IKE_P2_CAPSULE_NAT_TRANSPORT_2) + { + // No support for UDP encapsulation mode except for the NAT-Traversal + if (capsule_mode == IKE_P2_CAPSULE_TRANSPORT || capsule_mode == IKE_P2_CAPSULE_TUNNEL) + { + if (is_esp_supported == false) + { + setting->OnlyCapsuleModeIsInvalid = true; + return false; + } + else + { + // It is an environment that can send and receive ESP packets + } + } + else + { + return false; + } + } + + setting->CapsuleMode = capsule_mode; + + return true; +} + +// Convert a transform payload to a structure (for IKE SA) +bool TransformPayloadToTransformSettingForIkeSa(IKE_SERVER *ike, IKE_PACKET_TRANSFORM_PAYLOAD *transform, IKE_SA_TRANSFORM_SETTING *setting) +{ + UINT i; + // Validate arguments + if (ike == NULL || transform == NULL || setting == NULL) + { + return false; + } + + Zero(setting, sizeof(IKE_SA_TRANSFORM_SETTING)); + + setting->CryptoId = IkeGetTransformValue(transform, IKE_TRANSFORM_VALUE_P1_CRYPTO, 0); + setting->HashId = IkeGetTransformValue(transform, IKE_TRANSFORM_VALUE_P1_HASH, 0); + + if (IkeGetTransformValue(transform, IKE_TRANSFORM_VALUE_P1_AUTH_METHOD, 0) != IKE_P1_AUTH_METHOD_PRESHAREDKEY) + { + // Only PSK authentication method is supported + return false; + } + + setting->DhId = IkeGetTransformValue(transform, IKE_TRANSFORM_VALUE_P1_DH_GROUP, 0); + + setting->LifeKilobytes = INFINITE; + setting->LifeSeconds = INFINITE; + + for (i = 0;i < IkeGetTransformValueNum(transform, IKE_TRANSFORM_VALUE_P1_LIFE_TYPE);i++) + { + UINT life_type = IkeGetTransformValue(transform, IKE_TRANSFORM_VALUE_P1_LIFE_TYPE, i); + + switch (life_type) + { + case IKE_P1_LIFE_TYPE_SECONDS: // Number of seconds + setting->LifeSeconds = IkeGetTransformValue(transform, IKE_TRANSFORM_VALUE_P1_LIFE_VALUE, i); + break; + + case IKE_P1_LIFE_TYPE_KILOBYTES: // Kilobytes + setting->LifeKilobytes = IkeGetTransformValue(transform, IKE_TRANSFORM_VALUE_P1_LIFE_VALUE, i); + break; + + default: + // Unsupported expiration type + return false; + } + } + + setting->Crypto = GetIkeCrypto(ike->Engine, false, setting->CryptoId); + setting->Hash = GetIkeHash(ike->Engine, false, setting->HashId); + setting->Dh = GetIkeDh(ike->Engine, false, setting->DhId); + + if (setting->Crypto == NULL || setting->Hash == NULL || setting->Dh == NULL) + { + // Unsupported algorithm + return false; + } + + if (setting->Crypto->VariableKeySize) + { + // Get the actual key size in the case of variable key size + setting->CryptoKeySize = IkeGetTransformValue(transform, IKE_TRANSFORM_VALUE_P1_KET_SIZE, 0); + + // bits -> bytes + setting->CryptoKeySize = setting->CryptoKeySize / 8; + + if (setting->CryptoKeySize == 0 || IkeCheckKeySize(setting->Crypto, setting->CryptoKeySize) == false) + { + // The key size is not specified or inappropriate + return false; + } + } + else + { + // Get a fixed key length for fixed key size + setting->CryptoKeySize = setting->Crypto->KeySizes[0]; + } + + return true; +} + +// Creating a new Responder Cookie +UINT64 GenerateNewResponserCookie(IKE_SERVER *ike) +{ + UINT64 c; + // Validate arguments + if (ike == NULL) + { + return 0; + } + + while (true) + { + bool b = false; + UINT i; + + c = Rand64(); + + for (i = 0;i < LIST_NUM(ike->IkeSaList);i++) + { + IKE_SA *sa = LIST_DATA(ike->IkeSaList, i); + + if (sa->ResponderCookie == c) + { + b = true; + break; + } + } + + if (b == false) + { + return c; + } + } +} + +// Parse the IKE packet header +IKE_PACKET *ParseIKEPacketHeader(UDPPACKET *p) +{ + // Validate arguments + if (p == NULL) + { + return NULL; + } + + return IkeParseHeader(p->Data, p->Size, NULL); +} + +// Search for another IPsec SA belonging to the IKE_CLIENT which have same conditions to the specified IPsec SA +IPSECSA *GetOtherLatestIPsecSa(IKE_SERVER *ike, IPSECSA *sa) +{ + UINT i; + UINT64 min_value = 0; + IPSECSA *max_sa = NULL; + // Validate arguments + if (ike == NULL || sa == NULL) + { + return NULL; + } + + if (sa->IkeClient == NULL) + { + return NULL; + } + + for (i = 0;i < LIST_NUM(ike->IPsecSaList);i++) + { + IPSECSA *sa2 = LIST_DATA(ike->IPsecSaList, i); + + if (sa2 != sa) + { + if (sa2->IkeClient == sa->IkeClient) + { + if (sa2->ServerToClient == sa->ServerToClient) + { + if (sa2->Deleting == false) + { + if (sa2->Established) + { + UINT64 last_comm_tick = sa2->LastCommTick; + + if (sa2->ServerToClient) + { + if (sa2->PairIPsecSa != NULL) + { + last_comm_tick = sa2->PairIPsecSa->LastCommTick; + } + } + + if (min_value < last_comm_tick) + { + min_value = last_comm_tick; + + max_sa = sa2; + } + } + } + } + } + } + } + + return max_sa; +} + +// Search for another IKE_SA belonging to the IKE_CLIENT which have same conditions to the specified IKE_SA +IKE_SA *GetOtherLatestIkeSa(IKE_SERVER *ike, IKE_SA *sa) +{ + UINT i; + UINT64 min_value = 0; + IKE_SA *max_sa = NULL; + // Validate arguments + if (ike == NULL || sa == NULL) + { + return NULL; + } + + if (sa->IkeClient == NULL) + { + return NULL; + } + + for (i = 0;i < LIST_NUM(ike->IkeSaList);i++) + { + IKE_SA *sa2 = LIST_DATA(ike->IkeSaList, i); + + if (sa2 != sa) + { + if (sa2->IkeClient == sa->IkeClient) + { + if (sa2->Deleting == false) + { + if (sa2->Established) + { + if (min_value < sa2->LastCommTick) + { + min_value = sa2->LastCommTick; + + max_sa = sa2; + } + } + } + } + } + } + + return max_sa; +} + +// Purge the IPsec SA +void PurgeIPsecSa(IKE_SERVER *ike, IPSECSA *sa) +{ + UINT i; + IPSECSA *other_sa; + // Validate arguments + if (ike == NULL || sa == NULL) + { + return; + } + + other_sa = GetOtherLatestIPsecSa(ike, sa); + + // Rewrite the pairing partner by looking for IPsec SA that are paired + for (i = 0;i < LIST_NUM(ike->IPsecSaList);i++) + { + IPSECSA *sa2 = LIST_DATA(ike->IPsecSaList, i); + + if (sa2->PairIPsecSa == sa) + { + sa2->PairIPsecSa = other_sa; + } + } + + // Rewrite the IKE_CLIENT using this IPsec SA to use alternate + for (i = 0;i < LIST_NUM(ike->ClientList);i++) + { + IKE_CLIENT *c = LIST_DATA(ike->ClientList, i); + + if (c->CurrentIpSecSaRecv == sa) + { + c->CurrentIpSecSaRecv = other_sa; + } + + if (c->CurrentIpSecSaSend == sa) + { + c->CurrentIpSecSaSend = other_sa; + } + } + + Delete(ike->IPsecSaList, sa); + FreeIPsecSa(sa); +} + +// Remove the IKE SA +void PurgeIkeSa(IKE_SERVER *ike, IKE_SA *sa) +{ + IKE_SA *other_sa; + UINT i; + // Validate arguments + if (ike == NULL || sa == NULL) + { + return; + } + + Debug("Purging IKE SA %I64u-%I64u\n", sa->InitiatorCookie, sa->ResponderCookie); + + // Rewrite to alternative IKE_SA of all IPsec SA that are using this IKE_SA + other_sa = GetOtherLatestIkeSa(ike, sa); + + for (i = 0;i < LIST_NUM(ike->IPsecSaList);i++) + { + IPSECSA *ipsec_sa = LIST_DATA(ike->IPsecSaList, i); + + if (ipsec_sa->IkeSa == sa) + { + if (other_sa == NULL) + { + // Remove this IPsec SA because there is no alternative IKE_SA + Debug(" Deleting IPsec SA 0x%X of this IKE SA (no alternatives)\n", ipsec_sa->Spi); + MarkIPsecSaAsDeleted(ike, ipsec_sa); + ipsec_sa->IkeSa = NULL; + } + else + { + // Replace to the alternative IKE_SA + Debug(" Replacing IKE SA of IPsec SA 0x%X from %I64u-%I64u to %I64u-%I64u\n", ipsec_sa->Spi, + sa->InitiatorCookie, sa->ResponderCookie, + other_sa->InitiatorCookie, other_sa->ResponderCookie); + ipsec_sa->IkeSa = other_sa; + } + } + } + + // Substitute the IKE_SA of all IKE_CLIENT that are using this IKE_SA with alternative + for (i = 0;i < LIST_NUM(ike->ClientList);i++) + { + IKE_CLIENT *c = LIST_DATA(ike->ClientList, i); + + if (c->CurrentIkeSa == sa) + { + c->CurrentIkeSa = other_sa; + } + } + + Delete(ike->IkeSaList, sa); + FreeIkeSa(sa); +} + +// Purge the IKE_CLIENT +void PurgeIkeClient(IKE_SERVER *ike, IKE_CLIENT *c) +{ + UINT i; + // Validate arguments + if (ike == NULL || c == NULL) + { + return; + } + + // Delete all of IPsec SA and IKE SA that belong to this IKE Client + for (i = 0;i < LIST_NUM(ike->IkeSaList);i++) + { + IKE_SA *sa = LIST_DATA(ike->IkeSaList, i); + + if (sa->IkeClient == c) + { + MarkIkeSaAsDeleted(ike, sa); + } + } + for (i = 0;i < LIST_NUM(ike->IPsecSaList);i++) + { + IPSECSA *sa = LIST_DATA(ike->IPsecSaList, i); + + if (sa->IkeClient == c) + { + MarkIPsecSaAsDeleted(ike, sa); + } + } + + Delete(ike->ClientList, c); + FreeIkeClient(ike, c); +} + +// Remove the SA that has been marked to delete +void PurgeDeletingSAsAndClients(IKE_SERVER *ike) +{ + UINT i; + LIST *o = NULL; + // Validate arguments + if (ike == NULL) + { + return; + } + + for (i = 0;i < LIST_NUM(ike->IkeSaList);i++) + { + IKE_SA *sa = LIST_DATA(ike->IkeSaList, i); + if (sa->Deleting) + { + if (o == NULL) + { + o = NewListFast(NULL); + } + + Add(o, sa); + } + } + + for (i = 0;i < LIST_NUM(o);i++) + { + IKE_SA *sa = LIST_DATA(o, i); + + PurgeIkeSa(ike, sa); + } + + ReleaseList(o); + + o = NULL; + + for (i = 0;i < LIST_NUM(ike->IPsecSaList);i++) + { + IPSECSA *sa = LIST_DATA(ike->IPsecSaList, i); + if (sa->Deleting) + { + if (o == NULL) + { + o = NewListFast(NULL); + } + + Add(o, sa); + } + } + + for (i = 0;i < LIST_NUM(o);i++) + { + IPSECSA *sa = LIST_DATA(o, i); + + PurgeIPsecSa(ike, sa); + } + + ReleaseList(o); + + o = NULL; + + for (i = 0;i < LIST_NUM(ike->ClientList);i++) + { + IKE_CLIENT *c = LIST_DATA(ike->ClientList, i); + if (c->Deleting) + { + if (o == NULL) + { + o = NewListFast(NULL); + } + + Add(o, c); + } + } + + for (i = 0;i < LIST_NUM(o);i++) + { + IKE_CLIENT *c = LIST_DATA(o, i); + + PurgeIkeClient(ike, c); + } + + ReleaseList(o); +} + +// IKE interrupt process +void ProcessIKEInterrupts(IKE_SERVER *ike) +{ + UINT i; + // Validate arguments + if (ike == NULL) + { + return; + } + + for (i = 0;i < LIST_NUM(ike->ClientList);i++) + { + IKE_CLIENT *c = LIST_DATA(ike->ClientList, i); + + c->CurrentExpiresSoftTick_CtoS = 0; + c->CurrentExpiresSoftTick_StoC = 0; + c->CurrentNumEstablishedIPsecSA_CtoS = 0; + c->CurrentNumEstablishedIPsecSA_StoC = 0; + c->CurrentNumHealtyIPsecSA_CtoS = 0; + c->CurrentNumHealtyIPsecSA_StoC = 0; + } + + // Packet retransmission by scanning all IKE SA + for (i = 0;i < LIST_NUM(ike->IkeSaList);i++) + { + IKE_SA *sa = LIST_DATA(ike->IkeSaList, i); + + if (sa->SendBuffer != NULL) + { + if (ike->Now >= sa->NextSendTick) + { + IKE_CLIENT *c = sa->IkeClient; + + IkeSendUdpPacket(ike, IKE_UDP_TYPE_ISAKMP, &c->ServerIP, c->ServerPort, &c->ClientIP, c->ClientPort, + Clone(sa->SendBuffer->Buf, sa->SendBuffer->Size), sa->SendBuffer->Size); + + sa->NextSendTick += (UINT64)(IKE_SA_RESEND_INTERVAL); + + AddInterrupt(ike->Interrupts, sa->NextSendTick); + + if (sa->NumResends != 0) + { + sa->NumResends--; + if (sa->NumResends == 0) + { + sa->NextSendTick = 0; + FreeBuf(sa->SendBuffer); + sa->SendBuffer = NULL; + } + } + } + } + + // Remove those of non-communication + if (sa->IkeClient == NULL || (sa->IkeClient->CurrentIkeSa != sa)) + { + // When the IKE_CLIENT don't point this + if (sa->Established == false) + { + // Make time-out in a short time when it is not established + if ((sa->LastCommTick + (UINT64)IKE_TIMEOUT_FOR_IKE_CLIENT_FOR_NOT_ESTABLISHED) <= ike->Now) + { + WHERE; + MarkIkeSaAsDeleted(ike, sa); + } + } + else + { + // Timeout in a long time in the case of established + if ((sa->LastCommTick + (UINT64)IKE_TIMEOUT_FOR_IKE_CLIENT) <= ike->Now) + { + WHERE; + MarkIkeSaAsDeleted(ike, sa); + } + } + } + } + + // Packet retransmission by scanning all IPsec SA + for (i = 0;i < LIST_NUM(ike->IPsecSaList);i++) + { + IPSECSA *sa = LIST_DATA(ike->IPsecSaList, i); + IKE_CLIENT *c = sa->IkeClient; + + if (sa->SendBuffer != NULL) + { + if (ike->Now >= sa->NextSendTick) + { + IKE_CLIENT *c = sa->IkeClient; + + IkeSendUdpPacket(ike, IKE_UDP_TYPE_ISAKMP, &c->ServerIP, c->ServerPort, &c->ClientIP, c->ClientPort, + Clone(sa->SendBuffer->Buf, sa->SendBuffer->Size), sa->SendBuffer->Size); + + sa->NextSendTick += (UINT64)(IKE_SA_RESEND_INTERVAL); + + AddInterrupt(ike->Interrupts, sa->NextSendTick); + + if (sa->NumResends != 0) + { + sa->NumResends--; + + if (sa->NumResends == 0) + { + sa->NextSendTick = 0; + FreeBuf(sa->SendBuffer); + sa->SendBuffer = NULL; + } + } + } + } + + if (sa->Established && sa->Deleting == false && c != NULL) + { + // Get the flexible expiration date of SA for each IKE_CLIENT + if (sa->ServerToClient) + { + c->CurrentExpiresSoftTick_StoC = MAX(c->CurrentExpiresSoftTick_StoC, sa->ExpiresSoftTick); + c->CurrentNumEstablishedIPsecSA_StoC++; + + if (sa->ExpiresSoftTick == 0 || sa->ExpiresSoftTick > ike->Now) + { + c->CurrentNumHealtyIPsecSA_StoC++; + } + } + else + { + c->CurrentExpiresSoftTick_CtoS = MAX(c->CurrentExpiresSoftTick_CtoS, sa->ExpiresSoftTick); + c->CurrentNumEstablishedIPsecSA_CtoS++; + + if (sa->ExpiresSoftTick == 0 || sa->ExpiresSoftTick > ike->Now) + { + c->CurrentNumHealtyIPsecSA_CtoS++; + } + } + } + + // Remove those of non-communication + if (sa->IkeClient == NULL || (sa->IkeClient->CurrentIpSecSaRecv != sa && sa->IkeClient->CurrentIpSecSaSend != sa)) + { + // When the IKE_CLIENT don't point this + UINT64 last_comm_tick = sa->LastCommTick; + + if (sa->ServerToClient && sa->PairIPsecSa != NULL) + { + last_comm_tick = sa->PairIPsecSa->LastCommTick; + } + + if (sa->Established == false) + { + // Make time-out in a short time when it is not established + if ((last_comm_tick + (UINT64)IKE_TIMEOUT_FOR_IKE_CLIENT_FOR_NOT_ESTABLISHED) <= ike->Now) + { + WHERE; + MarkIPsecSaAsDeleted(ike, sa); + } + } + else + { + // Timeout in a long time in the case of established + if ((last_comm_tick + (UINT64)IKE_TIMEOUT_FOR_IKE_CLIENT) <= ike->Now) + { + WHERE; + MarkIPsecSaAsDeleted(ike, sa); + } + } + } + } + + // IKE_CLIENT scanning process + for (i = 0;i < LIST_NUM(ike->ClientList);i++) + { + IKE_CLIENT *c = LIST_DATA(ike->ClientList, i); + UINT64 tick; + UCHAR data[1]; + bool need_qm = false; + bool need_qm_hard = false; + UINT64 qm_soft_tick = 0; + + // Determine whether it is necessary to start a new Quick Mode + if (c->CurrentExpiresSoftTick_StoC != 0 && ike->Now >= c->CurrentExpiresSoftTick_StoC) + { + need_qm = true; + qm_soft_tick = MAX(qm_soft_tick, c->CurrentExpiresSoftTick_StoC); + } + + if (c->CurrentExpiresSoftTick_CtoS != 0 && ike->Now >= c->CurrentExpiresSoftTick_CtoS) + { + need_qm = true; + qm_soft_tick = MAX(qm_soft_tick, c->CurrentExpiresSoftTick_StoC); + } + + if (c->CurrentNumHealtyIPsecSA_CtoS == 0 || c->CurrentNumHealtyIPsecSA_StoC == 0) + { + need_qm = true; + need_qm_hard = true; + } + + if (c->StartQuickModeAsSoon) + { + need_qm = true; + need_qm_hard = true; + } + + if (c->Deleting || c->CurrentIkeSa == NULL || c->CurrentIkeSa->Deleting) + { + need_qm = false; + need_qm_hard = true; + } + + if (need_qm) + { + if (c->StartQuickModeAsSoon || ((c->LastQuickModeStartTick + (UINT64)IKE_QUICKMODE_START_INTERVAL) <= ike->Now)) + { + // Start the Quick Mode + Debug("IKE_CLIENT 0x%X: Begin QuickMode\n", c); + c->StartQuickModeAsSoon = false; + c->LastQuickModeStartTick = ike->Now; + + AddInterrupt(ike->Interrupts, c->LastQuickModeStartTick + (UINT64)IKE_QUICKMODE_START_INTERVAL); + + StartQuickMode(ike, c); + } + } + + if (need_qm_hard) + { + if (c->NeedQmBeginTick == 0) + { + c->NeedQmBeginTick = ike->Now; + } + } + else + { + c->NeedQmBeginTick = 0; + } + + if (((c->LastCommTick + (UINT64)IKE_TIMEOUT_FOR_IKE_CLIENT) <= ike->Now) || + ((c->CurrentIkeSa == NULL && c->CurrentIpSecSaRecv == NULL && c->CurrentIpSecSaSend == NULL) && (c->LastCommTick + (UINT64)IKE_TIMEOUT_FOR_IKE_CLIENT_FOR_NOT_ESTABLISHED) <= ike->Now) || + (c->NeedQmBeginTick != 0 && ((c->NeedQmBeginTick + (UINT64)IKE_QUICKMODE_FAILED_TIMEOUT) <= ike->Now))) + { + // Remove IKE_CLIENT not communicating for a certain period of time + WHERE; + MarkIkeClientAsDeleted(ike, c); + } + + // L2TP processing + if (c->L2TP != NULL) + { + IPsecIkeClientManageL2TPServer(ike, c); + + // Interrupt processing occurs + L2TPProcessInterrupts(c->L2TP); + + // Packet transmission + IPsecIkeClientSendL2TPPackets(ike, c, c->L2TP); + } + + // EtherIP processing + if (c->EtherIP != NULL) + { + IPsecIkeClientManageEtherIPServer(ike, c); + + // Interrupt processing occurs + EtherIPProcInterrupts(c->EtherIP); + + // Packet transmission + IPsecIkeClientSendEtherIPPackets(ike, c, c->EtherIP); + } + + // KeepAlive transmission + tick = MAX(c->LastCommTick + (UINT64)IKE_INTERVAL_UDP_KEEPALIVE, c->NextKeepAliveSendTick); + + if (tick <= ike->Now && c->ServerPort == IPSEC_PORT_IPSEC_ESP_UDP) + { + c->NextKeepAliveSendTick = ike->Now + (UINT64)IKE_INTERVAL_UDP_KEEPALIVE; + + AddInterrupt(ike->Interrupts, c->NextKeepAliveSendTick); + + Zero(data, sizeof(data)); + data[0] = 0xff; + + IkeSendUdpPacket(ike, IKE_UDP_KEEPALIVE, &c->ServerIP, c->ServerPort, &c->ClientIP, c->ClientPort, Clone(data, sizeof(data)), sizeof(data)); + } + + // DPD transmission + if (c->NextDpdSendTick == 0 || c->NextDpdSendTick <= ike->Now) + { + if (c->CurrentIkeSa != NULL && c->CurrentIkeSa->Established) + { + if (c->CurrentIkeSa->Caps.DpdRfc3706) + { + c->NextDpdSendTick = ike->Now + (UINT64)IKE_INTERVAL_DPD_KEEPALIVE; + + AddInterrupt(ike->Interrupts, c->NextDpdSendTick); + + SendInformationalExchangePacket(ike, c, + IkeNewNoticeDpdPayload(false, c->CurrentIkeSa->InitiatorCookie, c->CurrentIkeSa->ResponderCookie, + c->DpdSeqNo++)); + } + } + } + } + + do + { + ike->StateHasChanged = false; + + // Deletion process + PurgeDeletingSAsAndClients(ike); + } + while (ike->StateHasChanged); + + // Maintenance of the thread list + MaintainThreadList(ike->ThreadList); + /*Debug("ike->ThreadList: %u\n", LIST_NUM(ike->ThreadList)); + { + UINT i; + for (i = 0;i < LIST_NUM(ike->ThreadList);i++) + { + THREAD *t = LIST_DATA(ike->ThreadList, i); + + Debug(" Thread %u: 0x%p ID: %u Stop: %u Ref: %u\n", i, t, t->ThreadId, t->Stopped, t->ref->c->c); + } + }*/ +} + +// Stop the IKE server +void StopIKEServer(IKE_SERVER *ike) +{ + // Validate arguments + if (ike == NULL) + { + return; + } +} + +// Set the socket events in IKE server +void SetIKEServerSockEvent(IKE_SERVER *ike, SOCK_EVENT *e) +{ + // Validate arguments + if (ike == NULL) + { + return; + } + + if (e != NULL) + { + AddRef(e->ref); + } + + if (ike->SockEvent != NULL) + { + ReleaseSockEvent(ike->SockEvent); + } + + ike->SockEvent = e; +} + +// Release the IKE client +void FreeIkeClient(IKE_SERVER *ike, IKE_CLIENT *c) +{ + // Validate arguments + if (c == NULL || ike == NULL) + { + return; + } + + if (c->L2TP != NULL) + { + StopL2TPServer(c->L2TP, true); + FreeL2TPServer(c->L2TP); + } + + if (c->EtherIP != NULL) + { + ReleaseEtherIPServer(c->EtherIP); + } + + FreeBuf(c->SendID1_Buf); + FreeBuf(c->SendID2_Buf); + + Free(c); +} + +// Release the IPsec SA +void FreeIPsecSa(IPSECSA *sa) +{ + // Validate arguments + if (sa == NULL) + { + return; + } + + IkeFreeKey(sa->CryptoKey); + + FreeBuf(sa->SendBuffer); + + FreeBuf(sa->InitiatorRand); + FreeBuf(sa->ResponderRand); + + FreeBuf(sa->SharedKey); + + IkeDhFreeCtx(sa->Dh); + + Free(sa); +} + +// Release the IKE SA +void FreeIkeSa(IKE_SA *sa) +{ + // Validate arguments + if (sa == NULL) + { + return; + } + + FreeBuf(sa->SendBuffer); + + FreeBuf(sa->InitiatorRand); + FreeBuf(sa->ResponderRand); + FreeBuf(sa->DhSharedKey); + FreeBuf(sa->YourIDPayloadForAM); + + FreeBuf(sa->GXi); + FreeBuf(sa->GXr); + + FreeBuf(sa->SAi_b); + + IkeFreeKey(sa->CryptoKey); + + Free(sa); +} + +// Release the IKE server +void FreeIKEServer(IKE_SERVER *ike) +{ + UINT i; + // Validate arguments + if (ike == NULL) + { + return; + } + + IPsecLog(ike, NULL, NULL, NULL, "LI_STOPPING"); + + for (i = 0;i < LIST_NUM(ike->SendPacketList);i++) + { + UDPPACKET *udp = LIST_DATA(ike->SendPacketList, i); + + FreeUdpPacket(udp); + } + + ReleaseList(ike->SendPacketList); + + Debug("Num of IPsec SAs: %u\n", LIST_NUM(ike->IPsecSaList)); + IPsecLog(ike, NULL, NULL, NULL, "LI_NUM_IPSEC_SA", LIST_NUM(ike->IPsecSaList)); + + for (i = 0;i < LIST_NUM(ike->IPsecSaList);i++) + { + IPSECSA *sa = LIST_DATA(ike->IPsecSaList, i); + + FreeIPsecSa(sa); + } + + ReleaseList(ike->IPsecSaList); + + Debug("Num of IKE SAs: %u\n", LIST_NUM(ike->IkeSaList)); + IPsecLog(ike, NULL, NULL, NULL, "LI_NUM_IKE_SA", LIST_NUM(ike->IkeSaList)); + + for (i = 0;i < LIST_NUM(ike->IkeSaList);i++) + { + IKE_SA *sa = LIST_DATA(ike->IkeSaList, i); + + FreeIkeSa(sa); + } + + ReleaseList(ike->IkeSaList); + + Debug("Num of IKE_CLIENTs: %u\n", LIST_NUM(ike->ClientList)); + IPsecLog(ike, NULL, NULL, NULL, "LI_NUM_IKE_CLIENTS", LIST_NUM(ike->ClientList)); + + for (i = 0;i < LIST_NUM(ike->ClientList);i++) + { + IKE_CLIENT *c = LIST_DATA(ike->ClientList, i); + + FreeIkeClient(ike, c); + } + + ReleaseList(ike->ClientList); + + ReleaseSockEvent(ike->SockEvent); + + IPsecLog(ike, NULL, NULL, NULL, "LI_STOP"); + + ReleaseCedar(ike->Cedar); + + FreeIkeEngine(ike->Engine); + + Debug("FreeThreadList()...\n"); + FreeThreadList(ike->ThreadList); + Debug("FreeThreadList() Done.\n"); + + Free(ike); +} + +// Create a new IKE server +IKE_SERVER *NewIKEServer(CEDAR *cedar, IPSEC_SERVER *ipsec) +{ + IKE_SERVER *ike; + // Validate arguments + if (cedar == NULL) + { + return NULL; + } + + ike = ZeroMalloc(sizeof(IKE_SERVER)); + + ike->Cedar = cedar; + AddRef(cedar->ref); + + ike->IPsec = ipsec; + + ike->Now = Tick64(); + + ike->SendPacketList = NewList(NULL); + + ike->IkeSaList = NewList(CmpIkeSa); + + ike->IPsecSaList = NewList(CmpIPsecSa); + + ike->ClientList = NewList(CmpIkeClient); + + ike->Engine = NewIkeEngine(); + + ike->ThreadList = NewThreadList(); + + IPsecLog(ike, NULL, NULL, NULL, "LI_START"); + + return ike; +} + + + diff --git a/src/Cedar/Proto_IKE.h b/src/Cedar/Proto_IKE.h index c32b55fc..44cfa5fc 100644 --- a/src/Cedar/Proto_IKE.h +++ b/src/Cedar/Proto_IKE.h @@ -1,370 +1,370 @@ -// SoftEther VPN Source Code - Developer Edition Master Branch -// Cedar Communication Module - - -// Proto_IKE.h -// Header of Proto_IKE.c - -#ifndef PROTO_IKE_H -#define PROTO_IKE_H - -//// Macro - -//// Constants - -// State -#define IKE_SA_MAIN_MODE 0 // Main mode -#define IKE_SA_AGGRESSIVE_MODE 1 // Aggressive mode - -#define IKE_SA_MM_STATE_1_SA 0 // Main mode state 1 (SA exchange is complete. Wait for key exchange) -#define IKE_SA_MM_STATE_2_KEY 1 // Main mode state 2 (Key exchange is complete. Wait for exchange ID) -#define IKE_SA_MM_STATE_3_ESTABLISHED 2 // Main mode state 3 (ID exchange is complete. Established) - -#define IKE_SA_AM_STATE_1_SA 0 // Aggressive mode state 1 (SA exchange is completed. Wait for hash) -#define IKE_SA_AM_STATE_2_ESTABLISHED 1 // Aggressive mode state 2 (Hash exchange is completed. Established) - -#define IKE_SA_RESEND_INTERVAL (2 * 1000) // IKE SA packet retransmission interval -#define IKE_SA_RAND_SIZE 16 // Size of the random number - -// ESP -#define IKE_ESP_HASH_SIZE 12 // The hash size for the ESP packet - -// Type of UDP packet -#define IKE_UDP_TYPE_ISAKMP 0 // ISAKMP packet (destination 500) -#define IKE_UDP_TYPE_ESP 1 // ESP packet (destination 4500) -#define IKE_UDP_KEEPALIVE 2 // KeepAlive packet -#define IKE_UDP_SPECIAL 3 // Special packet - -// String for Vendor ID -#define IKE_VENDOR_ID_RFC3947_NAT_T "0x4a131c81070358455c5728f20e95452f" -#define IKE_VENDOR_ID_IPSEC_NAT_T_IKE_03 "0x7d9419a65310ca6f2c179d9215529d56" -#define IKE_VENDOR_ID_IPSEC_NAT_T_IKE_02 "0x90cb80913ebb696e086381b5ec427b1f" -#define IKE_VENDOR_ID_IPSEC_NAT_T_IKE_02_2 "0xcd60464335df21f87cfdb2fc68b6a448" -#define IKE_VENDOR_ID_IPSEC_NAT_T_IKE_00 "0x4485152d18b6bbcd0be8a8469579ddcc" -#define IKE_VENDOR_ID_RFC3706_DPD "0xafcad71368a1f1c96b8696fc77570100" -#define IKE_VENDOR_ID_MICROSOFT_L2TP "0x4048b7d56ebce88525e7de7f00d6c2d3" -#define IKE_VENDOR_ID_MS_NT5_ISAKMPOAKLEY "0x1e2b516905991c7d7c96fcbfb587e461" -#define IKE_VENDOR_ID_MS_VID_INITIALCONTACT "0x26244d38eddb61b3172a36e3d0cfb819" - -// Quota -#define IKE_QUOTA_MAX_NUM_CLIENTS_PER_IP 1000 // The number of IKE_CLIENT per IP address -#define IKE_QUOTA_MAX_NUM_CLIENTS 30000 // Limit number of IKE_CLIENT -#define IKE_QUOTA_MAX_SA_PER_CLIENT 100 // The limit number of SA for each IKE_CLIENT - -// Time-out -#define IKE_TIMEOUT_FOR_IKE_CLIENT 150000 // IKE_CLIENT non-communication disconnect time -#define IKE_TIMEOUT_FOR_IKE_CLIENT_FOR_NOT_ESTABLISHED 10000 // IKE_CLIENT non-communication disconnect time (connection incomplete) -#define IKE_INTERVAL_UDP_KEEPALIVE 5000 // UDP KeepAlive transmission interval -#define IKE_QUICKMODE_START_INTERVAL 2000 // QuickMode start interval -#define IKE_QUICKMODE_FAILED_TIMEOUT 10000 // Maximum time to tolerant that to fail to establish a QuickMode -#define IKE_INTERVAL_DPD_KEEPALIVE 10000 // DPD KeepAlive transmission interval - -// Expiration margin -#define IKE_SOFT_EXPIRES_MARGIN 1000 // Expiration margin - - -//// Type - -// IKE SA transform data -struct IKE_SA_TRANSFORM_SETTING -{ - IKE_CRYPTO *Crypto; - UINT CryptoKeySize; - IKE_HASH *Hash; - IKE_DH *Dh; - UINT CryptoId; - UINT HashId; - UINT DhId; - UINT LifeKilobytes; - UINT LifeSeconds; -}; - -// IPsec SA transforms data -struct IPSEC_SA_TRANSFORM_SETTING -{ - IKE_CRYPTO *Crypto; - UINT CryptoKeySize; - IKE_HASH *Hash; - IKE_DH *Dh; - UINT CryptoId; - UINT HashId; - UINT DhId; - UINT LifeKilobytes; - UINT LifeSeconds; - UINT SpiServerToClient; - UINT CapsuleMode; - bool OnlyCapsuleModeIsInvalid; -}; - -// Function support information -struct IKE_CAPS -{ - // Support Information - bool NatTraversalRfc3947; // RFC 3947 Negotiation of NAT-Traversal in the IKE - bool NatTraversalDraftIetf; // draft-ietf-ipsec-nat-t-ike - bool DpdRfc3706; // RFC 3706 A Traffic-Based Method of Detecting Dead Internet Key Exchange (IKE) Peers - bool MS_L2TPIPSecVPNClient; // Vendor ID: Microsoft L2TP/IPSec VPN Client - bool MS_NT5_ISAKMP_OAKLEY; // Vendor ID: MS NT5 ISAKMPOAKLEY - bool MS_Vid_InitialContact; // Vendor ID: Microsoft Vid-Initial-Contact - - // Use information - bool UsingNatTraversalRfc3947; - bool UsingNatTraversalDraftIetf; -}; - -// IKE / IPsec client -struct IKE_CLIENT -{ - UINT Id; - IP ClientIP; - UINT ClientPort; - IP ServerIP; - UINT ServerPort; - IKE_SA *CurrentIkeSa; // IKE SA to be used currently - IPSECSA *CurrentIpSecSaRecv; // IPsec SA to be used currently (receive direction) - IPSECSA *CurrentIpSecSaSend; // IPsec SA to be currently in use (transmit direction) - UINT64 FirstCommTick; // Time the first data communication - UINT64 LastCommTick; // Time that made the last communication (received data) time - bool Deleting; // Deleting - UINT64 NextKeepAliveSendTick; // Time to send the next KeepAlive - UINT64 NextDpdSendTick; // Time to send the next DPD - UINT DpdSeqNo; // DPD sequence number - char ClientId[128]; // ID presented by the client - char Secret[MAX_SIZE]; // Secret value of the authentication is successful - - bool IsMicrosoft; // Whether the client is Microsoft's - - IPSEC_SA_TRANSFORM_SETTING CachedTransformSetting; // Cached transform attribute value - UINT64 CurrentExpiresSoftTick_StoC; // The maximum value of the flexible expiration date of the current (server -> client) - UINT64 CurrentExpiresSoftTick_CtoS; // The maximum value of the flexible expiration date of the current (client -> server) - UINT CurrentNumEstablishedIPsecSA_StoC; // The number of IPsec SA currently active (server -> client) - UINT CurrentNumEstablishedIPsecSA_CtoS; // The number of IPsec SA currently active (client -> server) - UINT CurrentNumHealtyIPsecSA_CtoS; // The number of currently available IPsec SA which expiration well within (client -> server) - UINT CurrentNumHealtyIPsecSA_StoC; // The number of currently available IPsec SA which expiration well within (server -> client) - bool SendID1andID2; // Whether to send the ID in QM - UCHAR SendID1_Type, SendID2_Type; - UCHAR SendID1_Protocol, SendID2_Protocol; - USHORT SendID1_Port, SendID2_Port; - BUF *SendID1_Buf, *SendID2_Buf; - bool SendNatOaDraft1, SendNatOaDraft2, SendNatOaRfc; // Whether to send the NAT-OA in QM - bool StartQuickModeAsSoon; // Flag to indicate to the start of the Quick Mode as soon as possible - UINT64 LastQuickModeStartTick; // Time which the last QuickMode started - UINT64 NeedQmBeginTick; // Time which a start-up of QuickMode is required - - // L2TP related - L2TP_SERVER *L2TP; // L2TP server - UINT L2TPClientPort; // Client-side port number of L2TP - IP L2TPServerIP, L2TPClientIP; // IP address used by the L2TP processing - bool IsL2TPOnIPsecTunnelMode; // Whether the L2TP is working on IPsec tunnel mode - - // EtherIP related - ETHERIP_SERVER *EtherIP; // EtherIP server - bool IsEtherIPOnIPsecTunnelMode; // Whether the EtherIP is working on IPsec tunnel mode - - // Transport mode related - IP TransportModeServerIP; - IP TransportModeClientIP; - bool ShouldCalcChecksumForUDP; // Flag to calculate the checksum for the UDP packet - - // Tunnel mode related - IP TunnelModeServerIP; // Server-side internal IP address - IP TunnelModeClientIP; // Client-side internal IP address - USHORT TunnelSendIpId; // ID of the transmission IP header -}; - -// IKE SA -struct IKE_SA -{ - UINT Id; - IKE_CLIENT *IkeClient; // Pointer to the IKE client - UINT64 InitiatorCookie, ResponderCookie; // Cookie - UINT Mode; // Mode - UINT State; // State - BUF *SendBuffer; // Buffer during transmission - UINT64 NextSendTick; // Next transmission time - UINT64 FirstCommTick; // Time that the first data communication - UINT64 EstablishedTick; // Time that the SA has been established - UINT64 LastCommTick; // Time that made the last communication (received data) time - IKE_SA_TRANSFORM_SETTING TransformSetting; // Transform Configuration - IKE_CAPS Caps; // IKE Caps - BUF *InitiatorRand, *ResponderRand; // Random number - BUF *DhSharedKey; // DH common key - BUF *GXi, *GXr; // DH exchange data - BUF *SAi_b; // Data needed for authentication - BUF *YourIDPayloadForAM; // Copy the ID payload of the client-side - UCHAR SKEYID[IKE_MAX_HASH_SIZE]; // Key set - UCHAR SKEYID_d[IKE_MAX_HASH_SIZE]; - UCHAR SKEYID_a[IKE_MAX_HASH_SIZE]; - UCHAR SKEYID_e[IKE_MAX_HASH_SIZE]; - UCHAR InitiatorHashForAM[IKE_MAX_HASH_SIZE]; - IKE_CRYPTO_KEY *CryptoKey; // Common encryption key - UINT HashSize; // Hash size - UINT KeySize; // Key size - UINT BlockSize; // Block size - UCHAR Iv[IKE_MAX_BLOCK_SIZE]; // IV - bool IsIvExisting; // Whether an IV exists - bool Established; // Established flag - bool Deleting; // Deleting - UINT NumResends; // The number of retransmissions - char Secret[MAX_SIZE]; // Secret value of the authentication is successful -}; - -// IPsec SA -struct IPSECSA -{ - UINT Id; - IKE_CLIENT *IkeClient; // Pointer to the IKE client - IKE_SA *IkeSa; // Pointer to IKE_SA to use for transmission - UCHAR Iv[IKE_MAX_BLOCK_SIZE]; // IV used in the Quick Mode exchange - bool IsIvExisting; // Whether the IV exists - UINT MessageId; // Message ID used in Quick Mode exchange - UINT Spi; // SPI - UINT CurrentSeqNo; // Send sequence number - BUF *SendBuffer; // Buffer during transmission - UINT NumResends; // The number of retransmissions - UINT64 NextSendTick; // Next transmission date and time - UINT64 FirstCommTick; // Time the last data sent - UINT64 EstablishedTick; // Time that the SA has been established - UINT64 LastCommTick; // Time that made the last communication (received data) time - UINT64 ExpiresHardTick; // Exact expiration time - UINT64 ExpiresSoftTick; // Flexible expiration time - UINT64 TotalSize; // Size sent to and received - IPSEC_SA_TRANSFORM_SETTING TransformSetting; // Transform Configuration - bool ServerToClient; // Whether is upload direction - IPSECSA *PairIPsecSa; // IPsec SA that are paired - bool Established; // Established flag - BUF *InitiatorRand, *ResponderRand; // Random number - BUF *SharedKey; // PFS shared key - UCHAR Hash3[IKE_MAX_HASH_SIZE]; // Hash 3 - UCHAR KeyMat[IKE_MAX_KEY_SIZE + IKE_MAX_HASH_SIZE]; // Encryption key - UCHAR HashKey[IKE_MAX_HASH_SIZE]; // Hash key - IKE_CRYPTO_KEY *CryptoKey; // Key data - bool Deleting; // Deleting - UCHAR EspIv[IKE_MAX_BLOCK_SIZE]; // IV for ESP communication - bool Initiated; // The server-side is initiator - DH_CTX *Dh; // DH (only if the server-side is initiator) - bool StartQM_FlagSet; // Whether the flag to indicate to do the QM is set to the IKE_CLIENT - UCHAR SKEYID_d[IKE_MAX_HASH_SIZE]; - UCHAR SKEYID_a[IKE_MAX_HASH_SIZE]; - IKE_HASH *SKEYID_Hash; -}; - -// IKE server -struct IKE_SERVER -{ - CEDAR *Cedar; - IPSEC_SERVER *IPsec; - UINT64 Now; // Current time - LIST *SendPacketList; // Transmission packet - INTERRUPT_MANAGER *Interrupts; // Interrupt manager - SOCK_EVENT *SockEvent; // SockEvent - IKE_ENGINE *Engine; // Encryption engine - LIST *ClientList; // Client list - LIST *IkeSaList; // SA list - LIST *IPsecSaList; // IPsec SA list - LIST *ThreadList; // L2TP thread list - bool StateHasChanged; // Flag whether the state has changed - UINT CurrentIkeSaId, CurrentIPsecSaId, CurrentIkeClientId, CurrentEtherId; // Serial number ID - - // Setting data - char Secret[MAX_SIZE]; // Pre-shared key -}; - - -//// Function prototype -IKE_SERVER *NewIKEServer(CEDAR *cedar, IPSEC_SERVER *ipsec); -void FreeIKEServer(IKE_SERVER *ike); -void SetIKEServerSockEvent(IKE_SERVER *ike, SOCK_EVENT *e); -void ProcIKEPacketRecv(IKE_SERVER *ike, UDPPACKET *p); -void StopIKEServer(IKE_SERVER *ike); -void ProcessIKEInterrupts(IKE_SERVER *ike); -IKE_PACKET *ParseIKEPacketHeader(UDPPACKET *p); -void ProcIkeMainModePacketRecv(IKE_SERVER *ike, UDPPACKET *p, IKE_PACKET *header); -void ProcIkeQuickModePacketRecv(IKE_SERVER *ike, UDPPACKET *p, IKE_PACKET *header); -void ProcIkeAggressiveModePacketRecv(IKE_SERVER *ike, UDPPACKET *p, IKE_PACKET *header); -void ProcIkeInformationalExchangePacketRecv(IKE_SERVER *ike, UDPPACKET *p, IKE_PACKET *header); -void FreeIkeSa(IKE_SA *sa); -void FreeIkeClient(IKE_SERVER *ike, IKE_CLIENT *c); -UINT64 GenerateNewResponserCookie(IKE_SERVER *ike); -bool GetBestTransformSettingForIkeSa(IKE_SERVER *ike, IKE_PACKET *pr, IKE_SA_TRANSFORM_SETTING *setting); -bool TransformPayloadToTransformSettingForIkeSa(IKE_SERVER *ike, IKE_PACKET_TRANSFORM_PAYLOAD *transform, IKE_SA_TRANSFORM_SETTING *setting); -IKE_CLIENT *SearchIkeClientForIkePacket(IKE_SERVER *ike, IP *client_ip, UINT client_port, IP *server_ip, UINT server_port, IKE_PACKET *pr); -IKE_CLIENT *SearchOrCreateNewIkeClientForIkePacket(IKE_SERVER *ike, IP *client_ip, UINT client_port, IP *server_ip, UINT server_port, IKE_PACKET *pr); -UINT GetNumberOfIkeClientsFromIP(IKE_SERVER *ike, IP *client_ip); -UINT GetNumberOfIPsecSaOfIkeClient(IKE_SERVER *ike, IKE_CLIENT *c); -UINT GetNumberOfIkeSaOfIkeClient(IKE_SERVER *ike, IKE_CLIENT *c); -int CmpIkeClient(void *p1, void *p2); -int CmpIkeSa(void *p1, void *p2); -int CmpIPsecSa(void *p1, void *p2); -IKE_SA *FindIkeSaByEndPointAndInitiatorCookie(IKE_SERVER *ike, IP *client_ip, UINT client_port, IP *server_ip, UINT server_port, UINT64 init_cookie, UINT mode); -IKE_SA *FindIkeSaByResponderCookie(IKE_SERVER *ike, UINT64 responder_cookie); -IKE_SA *FindIkeSaByResponderCookieAndClient(IKE_SERVER *ike, UINT64 responder_cookie, IKE_CLIENT *c); -IKE_CLIENT *NewIkeClient(IKE_SERVER *ike, IP *client_ip, UINT client_port, IP *server_ip, UINT server_port); -IKE_CLIENT *SetIkeClientEndpoint(IKE_SERVER *ike, IKE_CLIENT *c, IP *client_ip, UINT client_port, IP *server_ip, UINT server_port); -IKE_SA *NewIkeSa(IKE_SERVER *ike, IKE_CLIENT *c, UINT64 init_cookie, UINT mode, IKE_SA_TRANSFORM_SETTING *setting); -IKE_PACKET_PAYLOAD *TransformSettingToTransformPayloadForIke(IKE_SERVER *ike, IKE_SA_TRANSFORM_SETTING *setting); -void IkeSaSendPacket(IKE_SERVER *ike, IKE_SA *sa, IKE_PACKET *p); -IKE_PACKET *IkeSaRecvPacket(IKE_SERVER *ike, IKE_SA *sa, void *data, UINT size); -void IkeSendUdpPacket(IKE_SERVER *ike, UINT type, IP *server_ip, UINT server_port, IP *client_ip, UINT client_port, void *data, UINT size); -void IkeAddVendorIdPayloads(IKE_PACKET *p); -BUF *IkeStrToVendorId(char *str); -void IkeAddVendorId(IKE_PACKET *p, char *str); -bool IkeIsVendorIdExists(IKE_PACKET *p, char *str); -void IkeCheckCaps(IKE_CAPS *caps, IKE_PACKET *p); -BUF *IkeCalcNatDetectHash(IKE_SERVER *ike, IKE_HASH *hash, UINT64 initiator_cookie, UINT64 responder_cookie, IP *ip, UINT port); -void IkeCalcSaKeySet(IKE_SERVER *ike, IKE_SA *sa, char *secret); -IKE_CRYPTO_KEY *IkeNewCryptoKeyFromK(IKE_SERVER *ike, void *k, UINT k_size, IKE_HASH *h, IKE_CRYPTO *c, UINT crypto_key_size); -BUF *IkeExpandKeySize(IKE_HASH *h, void *k, UINT k_size, UINT target_size); -void IkeSaUpdateIv(IKE_SA *sa, void *iv, UINT iv_size); -IPSECSA *NewIPsecSa(IKE_SERVER *ike, IKE_CLIENT *c, IKE_SA *ike_sa, bool initiate, UINT message_id, bool server_to_client, void *iv, UINT spi, void *init_rand_data, UINT init_rand_size, void *res_rand_data, UINT res_rand_size, IPSEC_SA_TRANSFORM_SETTING *setting, void *shared_key_data, UINT shared_key_size); -void IkeCalcPhase2InitialIv(void *iv, IKE_SA *sa, UINT message_id); -bool GetBestTransformSettingForIPsecSa(IKE_SERVER *ike, IKE_PACKET *pr, IPSEC_SA_TRANSFORM_SETTING *setting, IP *server_ip); -bool TransformPayloadToTransformSettingForIPsecSa(IKE_SERVER *ike, IKE_PACKET_TRANSFORM_PAYLOAD *transform, IPSEC_SA_TRANSFORM_SETTING *setting, IP *server_ip); -IKE_PACKET_PAYLOAD *TransformSettingToTransformPayloadForIPsec(IKE_SERVER *ike, IPSEC_SA_TRANSFORM_SETTING *setting); -UINT GenerateNewIPsecSaSpi(IKE_SERVER *ike, UINT counterpart_spi); -IPSECSA *SearchClientToServerIPsecSaBySpi(IKE_SERVER *ike, UINT spi); -IPSECSA *SearchIPsecSaBySpi(IKE_SERVER *ike, IKE_CLIENT *c, UINT spi); -IPSECSA *SearchIPsecSaByMessageId(IKE_SERVER *ike, IKE_CLIENT *c, UINT message_id); -void IPsecSaSendPacket(IKE_SERVER *ike, IPSECSA *sa, IKE_PACKET *p); -IKE_PACKET *IPsecSaRecvPacket(IKE_SERVER *ike, IPSECSA *sa, void *data, UINT size); -void IPsecSaUpdateIv(IPSECSA *sa, void *iv, UINT iv_size); -void ProcDeletePayload(IKE_SERVER *ike, IKE_CLIENT *c, IKE_PACKET_DELETE_PAYLOAD *d); -void MarkIPsecSaAsDeleted(IKE_SERVER *ike, IPSECSA *sa); -void MarkIkeSaAsDeleted(IKE_SERVER *ike, IKE_SA *sa); -void PurgeDeletingSAsAndClients(IKE_SERVER *ike); -void PurgeIPsecSa(IKE_SERVER *ike, IPSECSA *sa); -void PurgeIkeSa(IKE_SERVER *ike, IKE_SA *sa); -void PurgeIkeClient(IKE_SERVER *ike, IKE_CLIENT *c); -void FreeIPsecSa(IPSECSA *sa); -void MarkIkeClientAsDeleted(IKE_SERVER *ike, IKE_CLIENT *c); -IKE_SA *GetOtherLatestIkeSa(IKE_SERVER *ike, IKE_SA *sa); -IPSECSA *GetOtherLatestIPsecSa(IKE_SERVER *ike, IPSECSA *sa); -void SendInformationalExchangePacket(IKE_SERVER *ike, IKE_CLIENT *c, IKE_PACKET_PAYLOAD *payload); -void SendInformationalExchangePacketEx(IKE_SERVER *ike, IKE_CLIENT *c, IKE_PACKET_PAYLOAD *payload, bool force_plain, UINT64 init_cookie, UINT64 resp_cookie); -void SendDeleteIkeSaPacket(IKE_SERVER *ike, IKE_CLIENT *c, UINT64 init_cookie, UINT64 resp_cookie); -void SendDeleteIPsecSaPacket(IKE_SERVER *ike, IKE_CLIENT *c, UINT spi); -void IPsecCalcKeymat(IKE_SERVER *ike, IKE_HASH *h, void *dst, UINT dst_size, void *skeyid_d_data, UINT skeyid_d_size, UCHAR protocol, UINT spi, void *rand_init_data, UINT rand_init_size, - void *rand_resp_data, UINT rand_resp_size, void *df_key_data, UINT df_key_size); - -void ProcIPsecEspPacketRecv(IKE_SERVER *ike, UDPPACKET *p); -void ProcIPsecUdpPacketRecv(IKE_SERVER *ike, IKE_CLIENT *c, UCHAR *data, UINT data_size); -void IPsecSendPacketByIPsecSa(IKE_SERVER *ike, IPSECSA *sa, UCHAR *data, UINT data_size, UCHAR protocol_id); -void IPsecSendPacketByIPsecSaInner(IKE_SERVER *ike, IPSECSA *sa, UCHAR *data, UINT data_size, UCHAR protocol_id); -void IPsecSendPacketByIkeClient(IKE_SERVER *ike, IKE_CLIENT *c, UCHAR *data, UINT data_size, UCHAR protocol_id); -void IPsecSendUdpPacket(IKE_SERVER *ike, IKE_CLIENT *c, UINT src_port, UINT dst_port, UCHAR *data, UINT data_size); -void IPsecIkeClientManageL2TPServer(IKE_SERVER *ike, IKE_CLIENT *c); -void IPsecIkeClientSendL2TPPackets(IKE_SERVER *ike, IKE_CLIENT *c, L2TP_SERVER *l2tp); -void IPsecIkeSendUdpForDebug(UINT dst_port, UINT dst_ip, void *data, UINT size); -void StartQuickMode(IKE_SERVER *ike, IKE_CLIENT *c); -UINT GenerateNewMessageId(IKE_SERVER *ike); - -void IPsecIkeClientManageEtherIPServer(IKE_SERVER *ike, IKE_CLIENT *c); -void IPsecIkeClientSendEtherIPPackets(IKE_SERVER *ike, IKE_CLIENT *c, ETHERIP_SERVER *s); -void ProcIPsecEtherIPPacketRecv(IKE_SERVER *ike, IKE_CLIENT *c, UCHAR *data, UINT data_size, bool is_tunnel_mode); -bool IsIPsecSaTunnelMode(IPSECSA *sa); -void ProcL2TPv3PacketRecv(IKE_SERVER *ike, IKE_CLIENT *c, UCHAR *data, UINT data_size, bool is_tunnel_mode); - -IKE_SA *SearchIkeSaByCookie(IKE_SERVER *ike, UINT64 init_cookie, UINT64 resp_cookie); - -#endif // PROTO_IKE_H - +// SoftEther VPN Source Code - Developer Edition Master Branch +// Cedar Communication Module + + +// Proto_IKE.h +// Header of Proto_IKE.c + +#ifndef PROTO_IKE_H +#define PROTO_IKE_H + +//// Macro + +//// Constants + +// State +#define IKE_SA_MAIN_MODE 0 // Main mode +#define IKE_SA_AGGRESSIVE_MODE 1 // Aggressive mode + +#define IKE_SA_MM_STATE_1_SA 0 // Main mode state 1 (SA exchange is complete. Wait for key exchange) +#define IKE_SA_MM_STATE_2_KEY 1 // Main mode state 2 (Key exchange is complete. Wait for exchange ID) +#define IKE_SA_MM_STATE_3_ESTABLISHED 2 // Main mode state 3 (ID exchange is complete. Established) + +#define IKE_SA_AM_STATE_1_SA 0 // Aggressive mode state 1 (SA exchange is completed. Wait for hash) +#define IKE_SA_AM_STATE_2_ESTABLISHED 1 // Aggressive mode state 2 (Hash exchange is completed. Established) + +#define IKE_SA_RESEND_INTERVAL (2 * 1000) // IKE SA packet retransmission interval +#define IKE_SA_RAND_SIZE 16 // Size of the random number + +// ESP +#define IKE_ESP_HASH_SIZE 12 // The hash size for the ESP packet + +// Type of UDP packet +#define IKE_UDP_TYPE_ISAKMP 0 // ISAKMP packet (destination 500) +#define IKE_UDP_TYPE_ESP 1 // ESP packet (destination 4500) +#define IKE_UDP_KEEPALIVE 2 // KeepAlive packet +#define IKE_UDP_SPECIAL 3 // Special packet + +// String for Vendor ID +#define IKE_VENDOR_ID_RFC3947_NAT_T "0x4a131c81070358455c5728f20e95452f" +#define IKE_VENDOR_ID_IPSEC_NAT_T_IKE_03 "0x7d9419a65310ca6f2c179d9215529d56" +#define IKE_VENDOR_ID_IPSEC_NAT_T_IKE_02 "0x90cb80913ebb696e086381b5ec427b1f" +#define IKE_VENDOR_ID_IPSEC_NAT_T_IKE_02_2 "0xcd60464335df21f87cfdb2fc68b6a448" +#define IKE_VENDOR_ID_IPSEC_NAT_T_IKE_00 "0x4485152d18b6bbcd0be8a8469579ddcc" +#define IKE_VENDOR_ID_RFC3706_DPD "0xafcad71368a1f1c96b8696fc77570100" +#define IKE_VENDOR_ID_MICROSOFT_L2TP "0x4048b7d56ebce88525e7de7f00d6c2d3" +#define IKE_VENDOR_ID_MS_NT5_ISAKMPOAKLEY "0x1e2b516905991c7d7c96fcbfb587e461" +#define IKE_VENDOR_ID_MS_VID_INITIALCONTACT "0x26244d38eddb61b3172a36e3d0cfb819" + +// Quota +#define IKE_QUOTA_MAX_NUM_CLIENTS_PER_IP 1000 // The number of IKE_CLIENT per IP address +#define IKE_QUOTA_MAX_NUM_CLIENTS 30000 // Limit number of IKE_CLIENT +#define IKE_QUOTA_MAX_SA_PER_CLIENT 100 // The limit number of SA for each IKE_CLIENT + +// Time-out +#define IKE_TIMEOUT_FOR_IKE_CLIENT 150000 // IKE_CLIENT non-communication disconnect time +#define IKE_TIMEOUT_FOR_IKE_CLIENT_FOR_NOT_ESTABLISHED 10000 // IKE_CLIENT non-communication disconnect time (connection incomplete) +#define IKE_INTERVAL_UDP_KEEPALIVE 5000 // UDP KeepAlive transmission interval +#define IKE_QUICKMODE_START_INTERVAL 2000 // QuickMode start interval +#define IKE_QUICKMODE_FAILED_TIMEOUT 10000 // Maximum time to tolerant that to fail to establish a QuickMode +#define IKE_INTERVAL_DPD_KEEPALIVE 10000 // DPD KeepAlive transmission interval + +// Expiration margin +#define IKE_SOFT_EXPIRES_MARGIN 1000 // Expiration margin + + +//// Type + +// IKE SA transform data +struct IKE_SA_TRANSFORM_SETTING +{ + IKE_CRYPTO *Crypto; + UINT CryptoKeySize; + IKE_HASH *Hash; + IKE_DH *Dh; + UINT CryptoId; + UINT HashId; + UINT DhId; + UINT LifeKilobytes; + UINT LifeSeconds; +}; + +// IPsec SA transforms data +struct IPSEC_SA_TRANSFORM_SETTING +{ + IKE_CRYPTO *Crypto; + UINT CryptoKeySize; + IKE_HASH *Hash; + IKE_DH *Dh; + UINT CryptoId; + UINT HashId; + UINT DhId; + UINT LifeKilobytes; + UINT LifeSeconds; + UINT SpiServerToClient; + UINT CapsuleMode; + bool OnlyCapsuleModeIsInvalid; +}; + +// Function support information +struct IKE_CAPS +{ + // Support Information + bool NatTraversalRfc3947; // RFC 3947 Negotiation of NAT-Traversal in the IKE + bool NatTraversalDraftIetf; // draft-ietf-ipsec-nat-t-ike + bool DpdRfc3706; // RFC 3706 A Traffic-Based Method of Detecting Dead Internet Key Exchange (IKE) Peers + bool MS_L2TPIPSecVPNClient; // Vendor ID: Microsoft L2TP/IPSec VPN Client + bool MS_NT5_ISAKMP_OAKLEY; // Vendor ID: MS NT5 ISAKMPOAKLEY + bool MS_Vid_InitialContact; // Vendor ID: Microsoft Vid-Initial-Contact + + // Use information + bool UsingNatTraversalRfc3947; + bool UsingNatTraversalDraftIetf; +}; + +// IKE / IPsec client +struct IKE_CLIENT +{ + UINT Id; + IP ClientIP; + UINT ClientPort; + IP ServerIP; + UINT ServerPort; + IKE_SA *CurrentIkeSa; // IKE SA to be used currently + IPSECSA *CurrentIpSecSaRecv; // IPsec SA to be used currently (receive direction) + IPSECSA *CurrentIpSecSaSend; // IPsec SA to be currently in use (transmit direction) + UINT64 FirstCommTick; // Time the first data communication + UINT64 LastCommTick; // Time that made the last communication (received data) time + bool Deleting; // Deleting + UINT64 NextKeepAliveSendTick; // Time to send the next KeepAlive + UINT64 NextDpdSendTick; // Time to send the next DPD + UINT DpdSeqNo; // DPD sequence number + char ClientId[128]; // ID presented by the client + char Secret[MAX_SIZE]; // Secret value of the authentication is successful + + bool IsMicrosoft; // Whether the client is Microsoft's + + IPSEC_SA_TRANSFORM_SETTING CachedTransformSetting; // Cached transform attribute value + UINT64 CurrentExpiresSoftTick_StoC; // The maximum value of the flexible expiration date of the current (server -> client) + UINT64 CurrentExpiresSoftTick_CtoS; // The maximum value of the flexible expiration date of the current (client -> server) + UINT CurrentNumEstablishedIPsecSA_StoC; // The number of IPsec SA currently active (server -> client) + UINT CurrentNumEstablishedIPsecSA_CtoS; // The number of IPsec SA currently active (client -> server) + UINT CurrentNumHealtyIPsecSA_CtoS; // The number of currently available IPsec SA which expiration well within (client -> server) + UINT CurrentNumHealtyIPsecSA_StoC; // The number of currently available IPsec SA which expiration well within (server -> client) + bool SendID1andID2; // Whether to send the ID in QM + UCHAR SendID1_Type, SendID2_Type; + UCHAR SendID1_Protocol, SendID2_Protocol; + USHORT SendID1_Port, SendID2_Port; + BUF *SendID1_Buf, *SendID2_Buf; + bool SendNatOaDraft1, SendNatOaDraft2, SendNatOaRfc; // Whether to send the NAT-OA in QM + bool StartQuickModeAsSoon; // Flag to indicate to the start of the Quick Mode as soon as possible + UINT64 LastQuickModeStartTick; // Time which the last QuickMode started + UINT64 NeedQmBeginTick; // Time which a start-up of QuickMode is required + + // L2TP related + L2TP_SERVER *L2TP; // L2TP server + UINT L2TPClientPort; // Client-side port number of L2TP + IP L2TPServerIP, L2TPClientIP; // IP address used by the L2TP processing + bool IsL2TPOnIPsecTunnelMode; // Whether the L2TP is working on IPsec tunnel mode + + // EtherIP related + ETHERIP_SERVER *EtherIP; // EtherIP server + bool IsEtherIPOnIPsecTunnelMode; // Whether the EtherIP is working on IPsec tunnel mode + + // Transport mode related + IP TransportModeServerIP; + IP TransportModeClientIP; + bool ShouldCalcChecksumForUDP; // Flag to calculate the checksum for the UDP packet + + // Tunnel mode related + IP TunnelModeServerIP; // Server-side internal IP address + IP TunnelModeClientIP; // Client-side internal IP address + USHORT TunnelSendIpId; // ID of the transmission IP header +}; + +// IKE SA +struct IKE_SA +{ + UINT Id; + IKE_CLIENT *IkeClient; // Pointer to the IKE client + UINT64 InitiatorCookie, ResponderCookie; // Cookie + UINT Mode; // Mode + UINT State; // State + BUF *SendBuffer; // Buffer during transmission + UINT64 NextSendTick; // Next transmission time + UINT64 FirstCommTick; // Time that the first data communication + UINT64 EstablishedTick; // Time that the SA has been established + UINT64 LastCommTick; // Time that made the last communication (received data) time + IKE_SA_TRANSFORM_SETTING TransformSetting; // Transform Configuration + IKE_CAPS Caps; // IKE Caps + BUF *InitiatorRand, *ResponderRand; // Random number + BUF *DhSharedKey; // DH common key + BUF *GXi, *GXr; // DH exchange data + BUF *SAi_b; // Data needed for authentication + BUF *YourIDPayloadForAM; // Copy the ID payload of the client-side + UCHAR SKEYID[IKE_MAX_HASH_SIZE]; // Key set + UCHAR SKEYID_d[IKE_MAX_HASH_SIZE]; + UCHAR SKEYID_a[IKE_MAX_HASH_SIZE]; + UCHAR SKEYID_e[IKE_MAX_HASH_SIZE]; + UCHAR InitiatorHashForAM[IKE_MAX_HASH_SIZE]; + IKE_CRYPTO_KEY *CryptoKey; // Common encryption key + UINT HashSize; // Hash size + UINT KeySize; // Key size + UINT BlockSize; // Block size + UCHAR Iv[IKE_MAX_BLOCK_SIZE]; // IV + bool IsIvExisting; // Whether an IV exists + bool Established; // Established flag + bool Deleting; // Deleting + UINT NumResends; // The number of retransmissions + char Secret[MAX_SIZE]; // Secret value of the authentication is successful +}; + +// IPsec SA +struct IPSECSA +{ + UINT Id; + IKE_CLIENT *IkeClient; // Pointer to the IKE client + IKE_SA *IkeSa; // Pointer to IKE_SA to use for transmission + UCHAR Iv[IKE_MAX_BLOCK_SIZE]; // IV used in the Quick Mode exchange + bool IsIvExisting; // Whether the IV exists + UINT MessageId; // Message ID used in Quick Mode exchange + UINT Spi; // SPI + UINT CurrentSeqNo; // Send sequence number + BUF *SendBuffer; // Buffer during transmission + UINT NumResends; // The number of retransmissions + UINT64 NextSendTick; // Next transmission date and time + UINT64 FirstCommTick; // Time the last data sent + UINT64 EstablishedTick; // Time that the SA has been established + UINT64 LastCommTick; // Time that made the last communication (received data) time + UINT64 ExpiresHardTick; // Exact expiration time + UINT64 ExpiresSoftTick; // Flexible expiration time + UINT64 TotalSize; // Size sent to and received + IPSEC_SA_TRANSFORM_SETTING TransformSetting; // Transform Configuration + bool ServerToClient; // Whether is upload direction + IPSECSA *PairIPsecSa; // IPsec SA that are paired + bool Established; // Established flag + BUF *InitiatorRand, *ResponderRand; // Random number + BUF *SharedKey; // PFS shared key + UCHAR Hash3[IKE_MAX_HASH_SIZE]; // Hash 3 + UCHAR KeyMat[IKE_MAX_KEY_SIZE + IKE_MAX_HASH_SIZE]; // Encryption key + UCHAR HashKey[IKE_MAX_HASH_SIZE]; // Hash key + IKE_CRYPTO_KEY *CryptoKey; // Key data + bool Deleting; // Deleting + UCHAR EspIv[IKE_MAX_BLOCK_SIZE]; // IV for ESP communication + bool Initiated; // The server-side is initiator + DH_CTX *Dh; // DH (only if the server-side is initiator) + bool StartQM_FlagSet; // Whether the flag to indicate to do the QM is set to the IKE_CLIENT + UCHAR SKEYID_d[IKE_MAX_HASH_SIZE]; + UCHAR SKEYID_a[IKE_MAX_HASH_SIZE]; + IKE_HASH *SKEYID_Hash; +}; + +// IKE server +struct IKE_SERVER +{ + CEDAR *Cedar; + IPSEC_SERVER *IPsec; + UINT64 Now; // Current time + LIST *SendPacketList; // Transmission packet + INTERRUPT_MANAGER *Interrupts; // Interrupt manager + SOCK_EVENT *SockEvent; // SockEvent + IKE_ENGINE *Engine; // Encryption engine + LIST *ClientList; // Client list + LIST *IkeSaList; // SA list + LIST *IPsecSaList; // IPsec SA list + LIST *ThreadList; // L2TP thread list + bool StateHasChanged; // Flag whether the state has changed + UINT CurrentIkeSaId, CurrentIPsecSaId, CurrentIkeClientId, CurrentEtherId; // Serial number ID + + // Setting data + char Secret[MAX_SIZE]; // Pre-shared key +}; + + +//// Function prototype +IKE_SERVER *NewIKEServer(CEDAR *cedar, IPSEC_SERVER *ipsec); +void FreeIKEServer(IKE_SERVER *ike); +void SetIKEServerSockEvent(IKE_SERVER *ike, SOCK_EVENT *e); +void ProcIKEPacketRecv(IKE_SERVER *ike, UDPPACKET *p); +void StopIKEServer(IKE_SERVER *ike); +void ProcessIKEInterrupts(IKE_SERVER *ike); +IKE_PACKET *ParseIKEPacketHeader(UDPPACKET *p); +void ProcIkeMainModePacketRecv(IKE_SERVER *ike, UDPPACKET *p, IKE_PACKET *header); +void ProcIkeQuickModePacketRecv(IKE_SERVER *ike, UDPPACKET *p, IKE_PACKET *header); +void ProcIkeAggressiveModePacketRecv(IKE_SERVER *ike, UDPPACKET *p, IKE_PACKET *header); +void ProcIkeInformationalExchangePacketRecv(IKE_SERVER *ike, UDPPACKET *p, IKE_PACKET *header); +void FreeIkeSa(IKE_SA *sa); +void FreeIkeClient(IKE_SERVER *ike, IKE_CLIENT *c); +UINT64 GenerateNewResponserCookie(IKE_SERVER *ike); +bool GetBestTransformSettingForIkeSa(IKE_SERVER *ike, IKE_PACKET *pr, IKE_SA_TRANSFORM_SETTING *setting); +bool TransformPayloadToTransformSettingForIkeSa(IKE_SERVER *ike, IKE_PACKET_TRANSFORM_PAYLOAD *transform, IKE_SA_TRANSFORM_SETTING *setting); +IKE_CLIENT *SearchIkeClientForIkePacket(IKE_SERVER *ike, IP *client_ip, UINT client_port, IP *server_ip, UINT server_port, IKE_PACKET *pr); +IKE_CLIENT *SearchOrCreateNewIkeClientForIkePacket(IKE_SERVER *ike, IP *client_ip, UINT client_port, IP *server_ip, UINT server_port, IKE_PACKET *pr); +UINT GetNumberOfIkeClientsFromIP(IKE_SERVER *ike, IP *client_ip); +UINT GetNumberOfIPsecSaOfIkeClient(IKE_SERVER *ike, IKE_CLIENT *c); +UINT GetNumberOfIkeSaOfIkeClient(IKE_SERVER *ike, IKE_CLIENT *c); +int CmpIkeClient(void *p1, void *p2); +int CmpIkeSa(void *p1, void *p2); +int CmpIPsecSa(void *p1, void *p2); +IKE_SA *FindIkeSaByEndPointAndInitiatorCookie(IKE_SERVER *ike, IP *client_ip, UINT client_port, IP *server_ip, UINT server_port, UINT64 init_cookie, UINT mode); +IKE_SA *FindIkeSaByResponderCookie(IKE_SERVER *ike, UINT64 responder_cookie); +IKE_SA *FindIkeSaByResponderCookieAndClient(IKE_SERVER *ike, UINT64 responder_cookie, IKE_CLIENT *c); +IKE_CLIENT *NewIkeClient(IKE_SERVER *ike, IP *client_ip, UINT client_port, IP *server_ip, UINT server_port); +IKE_CLIENT *SetIkeClientEndpoint(IKE_SERVER *ike, IKE_CLIENT *c, IP *client_ip, UINT client_port, IP *server_ip, UINT server_port); +IKE_SA *NewIkeSa(IKE_SERVER *ike, IKE_CLIENT *c, UINT64 init_cookie, UINT mode, IKE_SA_TRANSFORM_SETTING *setting); +IKE_PACKET_PAYLOAD *TransformSettingToTransformPayloadForIke(IKE_SERVER *ike, IKE_SA_TRANSFORM_SETTING *setting); +void IkeSaSendPacket(IKE_SERVER *ike, IKE_SA *sa, IKE_PACKET *p); +IKE_PACKET *IkeSaRecvPacket(IKE_SERVER *ike, IKE_SA *sa, void *data, UINT size); +void IkeSendUdpPacket(IKE_SERVER *ike, UINT type, IP *server_ip, UINT server_port, IP *client_ip, UINT client_port, void *data, UINT size); +void IkeAddVendorIdPayloads(IKE_PACKET *p); +BUF *IkeStrToVendorId(char *str); +void IkeAddVendorId(IKE_PACKET *p, char *str); +bool IkeIsVendorIdExists(IKE_PACKET *p, char *str); +void IkeCheckCaps(IKE_CAPS *caps, IKE_PACKET *p); +BUF *IkeCalcNatDetectHash(IKE_SERVER *ike, IKE_HASH *hash, UINT64 initiator_cookie, UINT64 responder_cookie, IP *ip, UINT port); +void IkeCalcSaKeySet(IKE_SERVER *ike, IKE_SA *sa, char *secret); +IKE_CRYPTO_KEY *IkeNewCryptoKeyFromK(IKE_SERVER *ike, void *k, UINT k_size, IKE_HASH *h, IKE_CRYPTO *c, UINT crypto_key_size); +BUF *IkeExpandKeySize(IKE_HASH *h, void *k, UINT k_size, UINT target_size); +void IkeSaUpdateIv(IKE_SA *sa, void *iv, UINT iv_size); +IPSECSA *NewIPsecSa(IKE_SERVER *ike, IKE_CLIENT *c, IKE_SA *ike_sa, bool initiate, UINT message_id, bool server_to_client, void *iv, UINT spi, void *init_rand_data, UINT init_rand_size, void *res_rand_data, UINT res_rand_size, IPSEC_SA_TRANSFORM_SETTING *setting, void *shared_key_data, UINT shared_key_size); +void IkeCalcPhase2InitialIv(void *iv, IKE_SA *sa, UINT message_id); +bool GetBestTransformSettingForIPsecSa(IKE_SERVER *ike, IKE_PACKET *pr, IPSEC_SA_TRANSFORM_SETTING *setting, IP *server_ip); +bool TransformPayloadToTransformSettingForIPsecSa(IKE_SERVER *ike, IKE_PACKET_TRANSFORM_PAYLOAD *transform, IPSEC_SA_TRANSFORM_SETTING *setting, IP *server_ip); +IKE_PACKET_PAYLOAD *TransformSettingToTransformPayloadForIPsec(IKE_SERVER *ike, IPSEC_SA_TRANSFORM_SETTING *setting); +UINT GenerateNewIPsecSaSpi(IKE_SERVER *ike, UINT counterpart_spi); +IPSECSA *SearchClientToServerIPsecSaBySpi(IKE_SERVER *ike, UINT spi); +IPSECSA *SearchIPsecSaBySpi(IKE_SERVER *ike, IKE_CLIENT *c, UINT spi); +IPSECSA *SearchIPsecSaByMessageId(IKE_SERVER *ike, IKE_CLIENT *c, UINT message_id); +void IPsecSaSendPacket(IKE_SERVER *ike, IPSECSA *sa, IKE_PACKET *p); +IKE_PACKET *IPsecSaRecvPacket(IKE_SERVER *ike, IPSECSA *sa, void *data, UINT size); +void IPsecSaUpdateIv(IPSECSA *sa, void *iv, UINT iv_size); +void ProcDeletePayload(IKE_SERVER *ike, IKE_CLIENT *c, IKE_PACKET_DELETE_PAYLOAD *d); +void MarkIPsecSaAsDeleted(IKE_SERVER *ike, IPSECSA *sa); +void MarkIkeSaAsDeleted(IKE_SERVER *ike, IKE_SA *sa); +void PurgeDeletingSAsAndClients(IKE_SERVER *ike); +void PurgeIPsecSa(IKE_SERVER *ike, IPSECSA *sa); +void PurgeIkeSa(IKE_SERVER *ike, IKE_SA *sa); +void PurgeIkeClient(IKE_SERVER *ike, IKE_CLIENT *c); +void FreeIPsecSa(IPSECSA *sa); +void MarkIkeClientAsDeleted(IKE_SERVER *ike, IKE_CLIENT *c); +IKE_SA *GetOtherLatestIkeSa(IKE_SERVER *ike, IKE_SA *sa); +IPSECSA *GetOtherLatestIPsecSa(IKE_SERVER *ike, IPSECSA *sa); +void SendInformationalExchangePacket(IKE_SERVER *ike, IKE_CLIENT *c, IKE_PACKET_PAYLOAD *payload); +void SendInformationalExchangePacketEx(IKE_SERVER *ike, IKE_CLIENT *c, IKE_PACKET_PAYLOAD *payload, bool force_plain, UINT64 init_cookie, UINT64 resp_cookie); +void SendDeleteIkeSaPacket(IKE_SERVER *ike, IKE_CLIENT *c, UINT64 init_cookie, UINT64 resp_cookie); +void SendDeleteIPsecSaPacket(IKE_SERVER *ike, IKE_CLIENT *c, UINT spi); +void IPsecCalcKeymat(IKE_SERVER *ike, IKE_HASH *h, void *dst, UINT dst_size, void *skeyid_d_data, UINT skeyid_d_size, UCHAR protocol, UINT spi, void *rand_init_data, UINT rand_init_size, + void *rand_resp_data, UINT rand_resp_size, void *df_key_data, UINT df_key_size); + +void ProcIPsecEspPacketRecv(IKE_SERVER *ike, UDPPACKET *p); +void ProcIPsecUdpPacketRecv(IKE_SERVER *ike, IKE_CLIENT *c, UCHAR *data, UINT data_size); +void IPsecSendPacketByIPsecSa(IKE_SERVER *ike, IPSECSA *sa, UCHAR *data, UINT data_size, UCHAR protocol_id); +void IPsecSendPacketByIPsecSaInner(IKE_SERVER *ike, IPSECSA *sa, UCHAR *data, UINT data_size, UCHAR protocol_id); +void IPsecSendPacketByIkeClient(IKE_SERVER *ike, IKE_CLIENT *c, UCHAR *data, UINT data_size, UCHAR protocol_id); +void IPsecSendUdpPacket(IKE_SERVER *ike, IKE_CLIENT *c, UINT src_port, UINT dst_port, UCHAR *data, UINT data_size); +void IPsecIkeClientManageL2TPServer(IKE_SERVER *ike, IKE_CLIENT *c); +void IPsecIkeClientSendL2TPPackets(IKE_SERVER *ike, IKE_CLIENT *c, L2TP_SERVER *l2tp); +void IPsecIkeSendUdpForDebug(UINT dst_port, UINT dst_ip, void *data, UINT size); +void StartQuickMode(IKE_SERVER *ike, IKE_CLIENT *c); +UINT GenerateNewMessageId(IKE_SERVER *ike); + +void IPsecIkeClientManageEtherIPServer(IKE_SERVER *ike, IKE_CLIENT *c); +void IPsecIkeClientSendEtherIPPackets(IKE_SERVER *ike, IKE_CLIENT *c, ETHERIP_SERVER *s); +void ProcIPsecEtherIPPacketRecv(IKE_SERVER *ike, IKE_CLIENT *c, UCHAR *data, UINT data_size, bool is_tunnel_mode); +bool IsIPsecSaTunnelMode(IPSECSA *sa); +void ProcL2TPv3PacketRecv(IKE_SERVER *ike, IKE_CLIENT *c, UCHAR *data, UINT data_size, bool is_tunnel_mode); + +IKE_SA *SearchIkeSaByCookie(IKE_SERVER *ike, UINT64 init_cookie, UINT64 resp_cookie); + +#endif // PROTO_IKE_H + diff --git a/src/Cedar/Proto_IPsec.c b/src/Cedar/Proto_IPsec.c index 3128ffff..411e9503 100644 --- a/src/Cedar/Proto_IPsec.c +++ b/src/Cedar/Proto_IPsec.c @@ -1,684 +1,684 @@ -// SoftEther VPN Source Code - Developer Edition Master Branch -// Cedar Communication Module - - -// Proto_IPsec.c -// IPsec module - -#include "CedarPch.h" - - -static bool ipsec_disable = false; - -// Monitor the IPsec service of the OS, and stop it if it will conflict -void IPsecOsServiceCheckThread(THREAD *t, void *p) -{ - UINT interval = IPSEC_CHECK_OS_SERVICE_INTERVAL_INITIAL; - IPSEC_SERVER *s = (IPSEC_SERVER *)p; - // Validate arguments - if (t == NULL || p == NULL) - { - return; - } - - s->HostIPAddressListChanged = true; - s->OsServiceStoped = false; - - while (s->Halt == false) - { - if (IPsecCheckOsService(s)) - { - interval = IPSEC_CHECK_OS_SERVICE_INTERVAL_INITIAL; - } - - if (Wait(s->OsServiceCheckThreadEvent, interval) == false) - { - interval = MIN(interval * 2, IPSEC_CHECK_OS_SERVICE_INTERVAL_MAX); - } - else - { - interval = IPSEC_CHECK_OS_SERVICE_INTERVAL_INITIAL; - } - } - - IPsecCheckOsService(s); -} - -// Monitoring process main -bool IPsecCheckOsService(IPSEC_SERVER *s) -{ - bool b_ipsec; - IPSEC_SERVICES sl; - bool ret = false; - // Validate arguments - if (s == NULL) - { - return false; - } - - IPsecServerGetServices(s, &sl); - - b_ipsec = (sl.EtherIP_IPsec || sl.L2TP_IPsec); - - if (b_ipsec != s->Check_LastEnabledStatus) - { - s->Check_LastEnabledStatus = b_ipsec; - - if (b_ipsec) - { - // Use of IPsec has been started -#ifdef OS_WIN32 - if (s->Win7 == NULL) - { - s->Win7 = IPsecWin7Init(); - s->HostIPAddressListChanged = true; - } - - s->OsServiceStoped = false; -#else // OS_WIN32 -#endif // OS_WIN32 - } - else - { - // Use of IPsec is stopped -#ifdef OS_WIN32 - if (s->Win7 != NULL) - { - IPsecWin7Free(s->Win7); - s->Win7 = NULL; - } - - if (s->OsServiceStoped) - { - MsStartIPsecService(); - s->OsServiceStoped = false; - } -#else // OS_WIN32 - UnixSetEnableKernelEspProcessing(true); -#endif // OS_WIN32 - } - } - - if (b_ipsec) - { -#ifdef OS_WIN32 - if (MsStopIPsecService()) - { - s->OsServiceStoped = true; - ret = true; - } -#else // OS_WIN32 - UnixSetEnableKernelEspProcessing(false); -#endif // OS_WIN32 - } - -#ifdef OS_WIN32 - if (s->Win7 != NULL) - { - IPsecWin7UpdateHostIPAddressList(s->Win7); - s->HostIPAddressListChanged = false; - } -#endif // OS_WIN32 - - return ret; -} - -// Processing of UDP packets (one by one) -void IPsecProcPacket(IPSEC_SERVER *s, UDPPACKET *p) -{ - L2TP_SERVER *l2tp; - IKE_SERVER *ike; - void *old_data_ptr; - UINT old_data_size; - bool proc_this_packet = true; - // Validate arguments - if (s == NULL || p == NULL) - { - return; - } - - old_data_ptr = p->Data; - old_data_size = p->Size; - - l2tp = s->L2TP; - ike = s->Ike; - - // UDP decapsulation process - if (p->DestPort == IPSEC_PORT_IPSEC_ESP_UDP) - { -#ifdef OS_WIN32 - if (p->Size >= 12 && IsZero(p->Data, 4)) - { - if (((*((UINT *)(((UCHAR *)p->Data) + sizeof(UINT) * 1))) == WFP_ESP_PACKET_TAG_1) && - ((*((UINT *)(((UCHAR *)p->Data) + sizeof(UINT) * 2))) == WFP_ESP_PACKET_TAG_2)) - { - // Truncate the head because the packet was modified by WFP - p->Data = ((UCHAR *)p->Data) + 12; - p->Size -= 12; - } - } -#endif // OS_WIN32 - - if (p->Size >= 4 && IsZero(p->Data, 4)) - { - // Truncate the Non-ESP Marker - p->Data = ((UCHAR *)p->Data) + 4; - p->Size -= 4; - - p->Type = IKE_UDP_TYPE_ISAKMP; - } - else - { - p->Type = IKE_UDP_TYPE_ESP; - } - } - else if (p->DestPort == IPSEC_PORT_IPSEC_ISAKMP) - { - if (p->Size >= 8 && IsZero(p->Data, 8)) - { - // Truncate the Non-IKE Maker - p->Data = ((UCHAR *)p->Data) + 8; - p->Size -= 8; - - p->Type = IKE_UDP_TYPE_ESP; - } - else - { - p->Type = IKE_UDP_TYPE_ISAKMP; - } - } - else if (p->DestPort == IPSEC_PORT_IPSEC_ESP_RAW) - { - // Raw ESP - p->Type = IKE_UDP_TYPE_ESP; - } - - - if (proc_this_packet) - { - switch (p->DestPort) - { - case IPSEC_PORT_L2TP: - // L2TP - ProcL2TPPacketRecv(l2tp, p); - break; - - case IPSEC_PORT_IPSEC_ISAKMP: - case IPSEC_PORT_IPSEC_ESP_UDP: - case IPSEC_PORT_IPSEC_ESP_RAW: - // IPsec - ProcIKEPacketRecv(ike, p); - break; - } - } - - p->Data = old_data_ptr; - p->Size = old_data_size; -} - -// Packet reception procedure of UDP listener -void IPsecServerUdpPacketRecvProc(UDPLISTENER *u, LIST *packet_list) -{ - UINT i; - IPSEC_SERVER *s; - L2TP_SERVER *l2tp; - IKE_SERVER *ike; - UINT64 now; - static UCHAR zero8[8] = {0, 0, 0, 0, 0, 0, 0, 0, }; - // Validate arguments - if (u == NULL || packet_list == NULL) - { - return; - } - s = (IPSEC_SERVER *)u->Param; - if (s == NULL) - { - return; - } - - if (u->HostIPAddressListChanged) - { - u->HostIPAddressListChanged = false; - - s->HostIPAddressListChanged = true; - - Set(s->OsServiceCheckThreadEvent); - } - - now = Tick64(); - - // Adjustment about L2TP server timing - l2tp = s->L2TP; - - if (l2tp->Interrupts == NULL) - { - l2tp->Interrupts = u->Interrupts; - } - - if (l2tp->SockEvent == NULL) - { - SetL2TPServerSockEvent(l2tp, u->Event); - } - - l2tp->Now = now; - - // Adjustment about IKE server timing - ike = s->Ike; - - if (ike->Interrupts == NULL) - { - ike->Interrupts = u->Interrupts; - } - - if (ike->SockEvent == NULL) - { - SetIKEServerSockEvent(ike, u->Event); - } - - ike->Now = now; - - if (ipsec_disable == false) - { - { - // Process the received packet - for (i = 0;i < LIST_NUM(packet_list);i++) - { - UDPPACKET *p = LIST_DATA(packet_list, i); - - IPsecProcPacket(s, p); - } - } - } - - // Interrupt processing of L2TP server - L2TPProcessInterrupts(l2tp); - - // L2TP packet transmission processing - UdpListenerSendPackets(u, l2tp->SendPacketList); - DeleteAll(l2tp->SendPacketList); - - // Interrupt processing of IKE server - ProcessIKEInterrupts(ike); - - // UDP encapsulation process of IKE server packet scheduled for transmission - for (i = 0;i < LIST_NUM(ike->SendPacketList);i++) - { - UDPPACKET *p = LIST_DATA(ike->SendPacketList, i); - - if (p->Type == IKE_UDP_TYPE_ISAKMP && p->SrcPort == IPSEC_PORT_IPSEC_ESP_UDP) - { - // Add the Non-ESP Marker - void *old_data = p->Data; - - p->Data = AddHead(p->Data, p->Size, zero8, 4); - p->Size += 4; - - Free(old_data); - } - else if (p->Type == IKE_UDP_TYPE_ESP && p->SrcPort == IPSEC_PORT_IPSEC_ISAKMP) - { - // Add the Non-IKE Marker - void *old_data = p->Data; - - p->Data = AddHead(p->Data, p->Size, zero8, 8); - p->Size += 8; - - Free(old_data); - } - } - - // IKE server packet transmission processing - UdpListenerSendPackets(u, ike->SendPacketList); - DeleteAll(ike->SendPacketList); -} - -// Get the service list -void IPsecServerGetServices(IPSEC_SERVER *s, IPSEC_SERVICES *sl) -{ - // Validate arguments - if (s == NULL || sl == NULL) - { - return; - } - - Lock(s->LockSettings); - { - IPsecNormalizeServiceSetting(s); - - Copy(sl, &s->Services, sizeof(IPSEC_SERVICES)); - } - Unlock(s->LockSettings); -} - -// Normalize the IPsec service setttings -void IPsecNormalizeServiceSetting(IPSEC_SERVER *s) -{ - CEDAR *c; - // Validate arguments - if (s == NULL) - { - return; - } - - c = s->Cedar; - - Lock(s->LockSettings); - { - bool reset_hub_setting = false; - - if (IsEmptyStr(s->Services.IPsec_Secret)) - { - // If the secret is not set, set the default one - StrCpy(s->Services.IPsec_Secret, sizeof(s->Services.IPsec_Secret), IPSEC_DEFAULT_SECRET); - } - - LockList(c->HubList); - { - if (IsEmptyStr(s->Services.L2TP_DefaultHub)) - { - reset_hub_setting = true; - } - else - { - if (IsHub(c, s->Services.L2TP_DefaultHub) == false) - { - reset_hub_setting = true; - } - } - - if (reset_hub_setting) - { - // Select the first Virtual HUB if there is no HUB - HUB *h = NULL; - - if (LIST_NUM(c->HubList) >= 1) - { - h = LIST_DATA(c->HubList, 0); - } - - if (h != NULL) - { - StrCpy(s->Services.L2TP_DefaultHub, sizeof(s->Services.L2TP_DefaultHub), h->Name); - } - else - { - StrCpy(s->Services.L2TP_DefaultHub, sizeof(s->Services.L2TP_DefaultHub), ""); - } - } - } - UnlockList(c->HubList); - } - Unlock(s->LockSettings); -} - -// Set the service list -void IPsecServerSetServices(IPSEC_SERVER *s, IPSEC_SERVICES *sl) -{ - // Validate arguments - if (s == NULL || sl == NULL) - { - return; - } - - if (IsZero(sl, sizeof(IPSEC_SERVICES)) == false) - { - if (s->NoMoreChangeSettings) - { - return; - } - } - - Lock(s->LockSettings); - { - Copy(&s->Services, sl, sizeof(IPSEC_SERVICES)); - - Copy(&s->UdpListener->ListenIP, &s->Cedar->Server->ListenIP, sizeof(IP)); - - if (sl->L2TP_Raw) - { - AddPortToUdpListener(s->UdpListener, IPSEC_PORT_L2TP); - } - else - { - DeletePortFromUdpListener(s->UdpListener, IPSEC_PORT_L2TP); - } - - if (sl->L2TP_IPsec || sl->EtherIP_IPsec) - { - AddPortToUdpListener(s->UdpListener, IPSEC_PORT_IPSEC_ISAKMP); - AddPortToUdpListener(s->UdpListener, IPSEC_PORT_IPSEC_ESP_UDP); - AddPortToUdpListener(s->UdpListener, IPSEC_PORT_IPSEC_ESP_RAW); - AddPortToUdpListener(s->UdpListener, IPSEC_PORT_IPSEC_ESP_RAW_WPF); - } - else - { - DeletePortFromUdpListener(s->UdpListener, IPSEC_PORT_IPSEC_ISAKMP); - DeletePortFromUdpListener(s->UdpListener, IPSEC_PORT_IPSEC_ESP_UDP); - DeletePortFromUdpListener(s->UdpListener, IPSEC_PORT_IPSEC_ESP_RAW); - DeletePortFromUdpListener(s->UdpListener, IPSEC_PORT_IPSEC_ESP_RAW_WPF); - } - - if (IsEmptyStr(sl->IPsec_Secret) == false) - { - StrCpy(s->Ike->Secret, sizeof(s->Ike->Secret), sl->IPsec_Secret); - } - - IPsecNormalizeServiceSetting(s); - } - Unlock(s->LockSettings); - - Set(s->OsServiceCheckThreadEvent); -} - -// Add the EtherIP key -void AddEtherIPId(IPSEC_SERVER *s, ETHERIP_ID *id) -{ - // Validate arguments - if (s == NULL || id == NULL) - { - return; - } - - Lock(s->LockSettings); - { - // If there is the same key, remove them - ETHERIP_ID t, *k; - - Zero(&t, sizeof(t)); - - StrCpy(t.Id, sizeof(t.Id), id->Id); - - k = Search(s->EtherIPIdList, &t); - - if (k != NULL) - { - Delete(s->EtherIPIdList, k); - - Free(k); - } - - // Add - k = Clone(id, sizeof(ETHERIP_ID)); - - Insert(s->EtherIPIdList, k); - - s->EtherIPIdListSettingVerNo++; - } - Unlock(s->LockSettings); -} - -// Delete the EtherIP key -bool DeleteEtherIPId(IPSEC_SERVER *s, char *id_str) -{ - bool ret = false; - // Validate arguments - if (s == NULL || id_str == NULL) - { - return false; - } - - Lock(s->LockSettings); - { - // If there is the same key, remove them - ETHERIP_ID t, *k; - - Zero(&t, sizeof(t)); - - StrCpy(t.Id, sizeof(t.Id), id_str); - - k = Search(s->EtherIPIdList, &t); - - if (k != NULL) - { - Delete(s->EtherIPIdList, k); - - Free(k); - - ret = true; - - s->EtherIPIdListSettingVerNo++; - } - } - Unlock(s->LockSettings); - - return ret; -} - -// Search the EtherIP key -bool SearchEtherIPId(IPSEC_SERVER *s, ETHERIP_ID *id, char *id_str) -{ - bool ret = false; - // Validate arguments - if (s == NULL || id == NULL || id_str == NULL) - { - return false; - } - - Lock(s->LockSettings); - { - ETHERIP_ID t, *k; - - Zero(&t, sizeof(t)); - - StrCpy(t.Id, sizeof(t.Id), id_str); - - k = Search(s->EtherIPIdList, &t); - - if (k != NULL) - { - Copy(id, k, sizeof(ETHERIP_ID)); - - ret = true; - } - } - Unlock(s->LockSettings); - - return ret; -} - -// Comparison of key EtherIP list entries -int CmpEtherIPId(void *p1, void *p2) -{ - ETHERIP_ID *k1, *k2; - // Validate arguments - if (p1 == NULL || p2 == NULL) - { - return 0; - } - k1 = *(ETHERIP_ID **)p1; - k2 = *(ETHERIP_ID **)p2; - if (k1 == NULL || k2 == NULL) - { - return 0; - } - - return StrCmpi(k1->Id, k2->Id); -} - -// Release and stop the IPsec server -void FreeIPsecServer(IPSEC_SERVER *s) -{ - UINT i; - IPSEC_SERVICES sl; - // Validate arguments - if (s == NULL) - { - return; - } - - s->NoMoreChangeSettings = true; - - // Stopp the L2TP server - StopL2TPServer(s->L2TP, false); - - // Stop the IKE server - StopIKEServer(s->Ike); - - // Stop all the services explicitly - Zero(&sl, sizeof(sl)); - IPsecServerSetServices(s, &sl); - - // Releasing process - FreeUdpListener(s->UdpListener); - - ReleaseCedar(s->Cedar); - - FreeL2TPServer(s->L2TP); - - FreeIKEServer(s->Ike); - - for (i = 0;i < LIST_NUM(s->EtherIPIdList);i++) - { - ETHERIP_ID *k = LIST_DATA(s->EtherIPIdList, i); - - Free(k); - } - - ReleaseList(s->EtherIPIdList); - - // Stop the OS monitoring thread - s->Halt = true; - Set(s->OsServiceCheckThreadEvent); - WaitThread(s->OsServiceCheckThread, INFINITE); - ReleaseThread(s->OsServiceCheckThread); - ReleaseEvent(s->OsServiceCheckThreadEvent); - - DeleteLock(s->LockSettings); - - Free(s); -} - -// Initialize the IPsec server -IPSEC_SERVER *NewIPsecServer(CEDAR *cedar) -{ - IPSEC_SERVER *s; - // Validate arguments - if (cedar == NULL) - { - return NULL; - } - - s = ZeroMalloc(sizeof(IPSEC_SERVER)); - - s->LockSettings = NewLock(); - - s->Cedar = cedar; - - AddRef(s->Cedar->ref); - - s->L2TP = NewL2TPServer(cedar); - - s->Ike = NewIKEServer(cedar, s); - StrCpy(s->Ike->Secret, sizeof(s->Ike->Secret), IPSEC_DEFAULT_SECRET); - - s->UdpListener = NewUdpListener(IPsecServerUdpPacketRecvProc, s, &cedar->Server->ListenIP); - - s->EtherIPIdList = NewList(CmpEtherIPId); - - // Start an OS service monitoring thread - s->OsServiceCheckThreadEvent = NewEvent(); - s->OsServiceCheckThread = NewThread(IPsecOsServiceCheckThread, s); - - return s; -} - +// SoftEther VPN Source Code - Developer Edition Master Branch +// Cedar Communication Module + + +// Proto_IPsec.c +// IPsec module + +#include "CedarPch.h" + + +static bool ipsec_disable = false; + +// Monitor the IPsec service of the OS, and stop it if it will conflict +void IPsecOsServiceCheckThread(THREAD *t, void *p) +{ + UINT interval = IPSEC_CHECK_OS_SERVICE_INTERVAL_INITIAL; + IPSEC_SERVER *s = (IPSEC_SERVER *)p; + // Validate arguments + if (t == NULL || p == NULL) + { + return; + } + + s->HostIPAddressListChanged = true; + s->OsServiceStoped = false; + + while (s->Halt == false) + { + if (IPsecCheckOsService(s)) + { + interval = IPSEC_CHECK_OS_SERVICE_INTERVAL_INITIAL; + } + + if (Wait(s->OsServiceCheckThreadEvent, interval) == false) + { + interval = MIN(interval * 2, IPSEC_CHECK_OS_SERVICE_INTERVAL_MAX); + } + else + { + interval = IPSEC_CHECK_OS_SERVICE_INTERVAL_INITIAL; + } + } + + IPsecCheckOsService(s); +} + +// Monitoring process main +bool IPsecCheckOsService(IPSEC_SERVER *s) +{ + bool b_ipsec; + IPSEC_SERVICES sl; + bool ret = false; + // Validate arguments + if (s == NULL) + { + return false; + } + + IPsecServerGetServices(s, &sl); + + b_ipsec = (sl.EtherIP_IPsec || sl.L2TP_IPsec); + + if (b_ipsec != s->Check_LastEnabledStatus) + { + s->Check_LastEnabledStatus = b_ipsec; + + if (b_ipsec) + { + // Use of IPsec has been started +#ifdef OS_WIN32 + if (s->Win7 == NULL) + { + s->Win7 = IPsecWin7Init(); + s->HostIPAddressListChanged = true; + } + + s->OsServiceStoped = false; +#else // OS_WIN32 +#endif // OS_WIN32 + } + else + { + // Use of IPsec is stopped +#ifdef OS_WIN32 + if (s->Win7 != NULL) + { + IPsecWin7Free(s->Win7); + s->Win7 = NULL; + } + + if (s->OsServiceStoped) + { + MsStartIPsecService(); + s->OsServiceStoped = false; + } +#else // OS_WIN32 + UnixSetEnableKernelEspProcessing(true); +#endif // OS_WIN32 + } + } + + if (b_ipsec) + { +#ifdef OS_WIN32 + if (MsStopIPsecService()) + { + s->OsServiceStoped = true; + ret = true; + } +#else // OS_WIN32 + UnixSetEnableKernelEspProcessing(false); +#endif // OS_WIN32 + } + +#ifdef OS_WIN32 + if (s->Win7 != NULL) + { + IPsecWin7UpdateHostIPAddressList(s->Win7); + s->HostIPAddressListChanged = false; + } +#endif // OS_WIN32 + + return ret; +} + +// Processing of UDP packets (one by one) +void IPsecProcPacket(IPSEC_SERVER *s, UDPPACKET *p) +{ + L2TP_SERVER *l2tp; + IKE_SERVER *ike; + void *old_data_ptr; + UINT old_data_size; + bool proc_this_packet = true; + // Validate arguments + if (s == NULL || p == NULL) + { + return; + } + + old_data_ptr = p->Data; + old_data_size = p->Size; + + l2tp = s->L2TP; + ike = s->Ike; + + // UDP decapsulation process + if (p->DestPort == IPSEC_PORT_IPSEC_ESP_UDP) + { +#ifdef OS_WIN32 + if (p->Size >= 12 && IsZero(p->Data, 4)) + { + if (((*((UINT *)(((UCHAR *)p->Data) + sizeof(UINT) * 1))) == WFP_ESP_PACKET_TAG_1) && + ((*((UINT *)(((UCHAR *)p->Data) + sizeof(UINT) * 2))) == WFP_ESP_PACKET_TAG_2)) + { + // Truncate the head because the packet was modified by WFP + p->Data = ((UCHAR *)p->Data) + 12; + p->Size -= 12; + } + } +#endif // OS_WIN32 + + if (p->Size >= 4 && IsZero(p->Data, 4)) + { + // Truncate the Non-ESP Marker + p->Data = ((UCHAR *)p->Data) + 4; + p->Size -= 4; + + p->Type = IKE_UDP_TYPE_ISAKMP; + } + else + { + p->Type = IKE_UDP_TYPE_ESP; + } + } + else if (p->DestPort == IPSEC_PORT_IPSEC_ISAKMP) + { + if (p->Size >= 8 && IsZero(p->Data, 8)) + { + // Truncate the Non-IKE Maker + p->Data = ((UCHAR *)p->Data) + 8; + p->Size -= 8; + + p->Type = IKE_UDP_TYPE_ESP; + } + else + { + p->Type = IKE_UDP_TYPE_ISAKMP; + } + } + else if (p->DestPort == IPSEC_PORT_IPSEC_ESP_RAW) + { + // Raw ESP + p->Type = IKE_UDP_TYPE_ESP; + } + + + if (proc_this_packet) + { + switch (p->DestPort) + { + case IPSEC_PORT_L2TP: + // L2TP + ProcL2TPPacketRecv(l2tp, p); + break; + + case IPSEC_PORT_IPSEC_ISAKMP: + case IPSEC_PORT_IPSEC_ESP_UDP: + case IPSEC_PORT_IPSEC_ESP_RAW: + // IPsec + ProcIKEPacketRecv(ike, p); + break; + } + } + + p->Data = old_data_ptr; + p->Size = old_data_size; +} + +// Packet reception procedure of UDP listener +void IPsecServerUdpPacketRecvProc(UDPLISTENER *u, LIST *packet_list) +{ + UINT i; + IPSEC_SERVER *s; + L2TP_SERVER *l2tp; + IKE_SERVER *ike; + UINT64 now; + static UCHAR zero8[8] = {0, 0, 0, 0, 0, 0, 0, 0, }; + // Validate arguments + if (u == NULL || packet_list == NULL) + { + return; + } + s = (IPSEC_SERVER *)u->Param; + if (s == NULL) + { + return; + } + + if (u->HostIPAddressListChanged) + { + u->HostIPAddressListChanged = false; + + s->HostIPAddressListChanged = true; + + Set(s->OsServiceCheckThreadEvent); + } + + now = Tick64(); + + // Adjustment about L2TP server timing + l2tp = s->L2TP; + + if (l2tp->Interrupts == NULL) + { + l2tp->Interrupts = u->Interrupts; + } + + if (l2tp->SockEvent == NULL) + { + SetL2TPServerSockEvent(l2tp, u->Event); + } + + l2tp->Now = now; + + // Adjustment about IKE server timing + ike = s->Ike; + + if (ike->Interrupts == NULL) + { + ike->Interrupts = u->Interrupts; + } + + if (ike->SockEvent == NULL) + { + SetIKEServerSockEvent(ike, u->Event); + } + + ike->Now = now; + + if (ipsec_disable == false) + { + { + // Process the received packet + for (i = 0;i < LIST_NUM(packet_list);i++) + { + UDPPACKET *p = LIST_DATA(packet_list, i); + + IPsecProcPacket(s, p); + } + } + } + + // Interrupt processing of L2TP server + L2TPProcessInterrupts(l2tp); + + // L2TP packet transmission processing + UdpListenerSendPackets(u, l2tp->SendPacketList); + DeleteAll(l2tp->SendPacketList); + + // Interrupt processing of IKE server + ProcessIKEInterrupts(ike); + + // UDP encapsulation process of IKE server packet scheduled for transmission + for (i = 0;i < LIST_NUM(ike->SendPacketList);i++) + { + UDPPACKET *p = LIST_DATA(ike->SendPacketList, i); + + if (p->Type == IKE_UDP_TYPE_ISAKMP && p->SrcPort == IPSEC_PORT_IPSEC_ESP_UDP) + { + // Add the Non-ESP Marker + void *old_data = p->Data; + + p->Data = AddHead(p->Data, p->Size, zero8, 4); + p->Size += 4; + + Free(old_data); + } + else if (p->Type == IKE_UDP_TYPE_ESP && p->SrcPort == IPSEC_PORT_IPSEC_ISAKMP) + { + // Add the Non-IKE Marker + void *old_data = p->Data; + + p->Data = AddHead(p->Data, p->Size, zero8, 8); + p->Size += 8; + + Free(old_data); + } + } + + // IKE server packet transmission processing + UdpListenerSendPackets(u, ike->SendPacketList); + DeleteAll(ike->SendPacketList); +} + +// Get the service list +void IPsecServerGetServices(IPSEC_SERVER *s, IPSEC_SERVICES *sl) +{ + // Validate arguments + if (s == NULL || sl == NULL) + { + return; + } + + Lock(s->LockSettings); + { + IPsecNormalizeServiceSetting(s); + + Copy(sl, &s->Services, sizeof(IPSEC_SERVICES)); + } + Unlock(s->LockSettings); +} + +// Normalize the IPsec service setttings +void IPsecNormalizeServiceSetting(IPSEC_SERVER *s) +{ + CEDAR *c; + // Validate arguments + if (s == NULL) + { + return; + } + + c = s->Cedar; + + Lock(s->LockSettings); + { + bool reset_hub_setting = false; + + if (IsEmptyStr(s->Services.IPsec_Secret)) + { + // If the secret is not set, set the default one + StrCpy(s->Services.IPsec_Secret, sizeof(s->Services.IPsec_Secret), IPSEC_DEFAULT_SECRET); + } + + LockList(c->HubList); + { + if (IsEmptyStr(s->Services.L2TP_DefaultHub)) + { + reset_hub_setting = true; + } + else + { + if (IsHub(c, s->Services.L2TP_DefaultHub) == false) + { + reset_hub_setting = true; + } + } + + if (reset_hub_setting) + { + // Select the first Virtual HUB if there is no HUB + HUB *h = NULL; + + if (LIST_NUM(c->HubList) >= 1) + { + h = LIST_DATA(c->HubList, 0); + } + + if (h != NULL) + { + StrCpy(s->Services.L2TP_DefaultHub, sizeof(s->Services.L2TP_DefaultHub), h->Name); + } + else + { + StrCpy(s->Services.L2TP_DefaultHub, sizeof(s->Services.L2TP_DefaultHub), ""); + } + } + } + UnlockList(c->HubList); + } + Unlock(s->LockSettings); +} + +// Set the service list +void IPsecServerSetServices(IPSEC_SERVER *s, IPSEC_SERVICES *sl) +{ + // Validate arguments + if (s == NULL || sl == NULL) + { + return; + } + + if (IsZero(sl, sizeof(IPSEC_SERVICES)) == false) + { + if (s->NoMoreChangeSettings) + { + return; + } + } + + Lock(s->LockSettings); + { + Copy(&s->Services, sl, sizeof(IPSEC_SERVICES)); + + Copy(&s->UdpListener->ListenIP, &s->Cedar->Server->ListenIP, sizeof(IP)); + + if (sl->L2TP_Raw) + { + AddPortToUdpListener(s->UdpListener, IPSEC_PORT_L2TP); + } + else + { + DeletePortFromUdpListener(s->UdpListener, IPSEC_PORT_L2TP); + } + + if (sl->L2TP_IPsec || sl->EtherIP_IPsec) + { + AddPortToUdpListener(s->UdpListener, IPSEC_PORT_IPSEC_ISAKMP); + AddPortToUdpListener(s->UdpListener, IPSEC_PORT_IPSEC_ESP_UDP); + AddPortToUdpListener(s->UdpListener, IPSEC_PORT_IPSEC_ESP_RAW); + AddPortToUdpListener(s->UdpListener, IPSEC_PORT_IPSEC_ESP_RAW_WPF); + } + else + { + DeletePortFromUdpListener(s->UdpListener, IPSEC_PORT_IPSEC_ISAKMP); + DeletePortFromUdpListener(s->UdpListener, IPSEC_PORT_IPSEC_ESP_UDP); + DeletePortFromUdpListener(s->UdpListener, IPSEC_PORT_IPSEC_ESP_RAW); + DeletePortFromUdpListener(s->UdpListener, IPSEC_PORT_IPSEC_ESP_RAW_WPF); + } + + if (IsEmptyStr(sl->IPsec_Secret) == false) + { + StrCpy(s->Ike->Secret, sizeof(s->Ike->Secret), sl->IPsec_Secret); + } + + IPsecNormalizeServiceSetting(s); + } + Unlock(s->LockSettings); + + Set(s->OsServiceCheckThreadEvent); +} + +// Add the EtherIP key +void AddEtherIPId(IPSEC_SERVER *s, ETHERIP_ID *id) +{ + // Validate arguments + if (s == NULL || id == NULL) + { + return; + } + + Lock(s->LockSettings); + { + // If there is the same key, remove them + ETHERIP_ID t, *k; + + Zero(&t, sizeof(t)); + + StrCpy(t.Id, sizeof(t.Id), id->Id); + + k = Search(s->EtherIPIdList, &t); + + if (k != NULL) + { + Delete(s->EtherIPIdList, k); + + Free(k); + } + + // Add + k = Clone(id, sizeof(ETHERIP_ID)); + + Insert(s->EtherIPIdList, k); + + s->EtherIPIdListSettingVerNo++; + } + Unlock(s->LockSettings); +} + +// Delete the EtherIP key +bool DeleteEtherIPId(IPSEC_SERVER *s, char *id_str) +{ + bool ret = false; + // Validate arguments + if (s == NULL || id_str == NULL) + { + return false; + } + + Lock(s->LockSettings); + { + // If there is the same key, remove them + ETHERIP_ID t, *k; + + Zero(&t, sizeof(t)); + + StrCpy(t.Id, sizeof(t.Id), id_str); + + k = Search(s->EtherIPIdList, &t); + + if (k != NULL) + { + Delete(s->EtherIPIdList, k); + + Free(k); + + ret = true; + + s->EtherIPIdListSettingVerNo++; + } + } + Unlock(s->LockSettings); + + return ret; +} + +// Search the EtherIP key +bool SearchEtherIPId(IPSEC_SERVER *s, ETHERIP_ID *id, char *id_str) +{ + bool ret = false; + // Validate arguments + if (s == NULL || id == NULL || id_str == NULL) + { + return false; + } + + Lock(s->LockSettings); + { + ETHERIP_ID t, *k; + + Zero(&t, sizeof(t)); + + StrCpy(t.Id, sizeof(t.Id), id_str); + + k = Search(s->EtherIPIdList, &t); + + if (k != NULL) + { + Copy(id, k, sizeof(ETHERIP_ID)); + + ret = true; + } + } + Unlock(s->LockSettings); + + return ret; +} + +// Comparison of key EtherIP list entries +int CmpEtherIPId(void *p1, void *p2) +{ + ETHERIP_ID *k1, *k2; + // Validate arguments + if (p1 == NULL || p2 == NULL) + { + return 0; + } + k1 = *(ETHERIP_ID **)p1; + k2 = *(ETHERIP_ID **)p2; + if (k1 == NULL || k2 == NULL) + { + return 0; + } + + return StrCmpi(k1->Id, k2->Id); +} + +// Release and stop the IPsec server +void FreeIPsecServer(IPSEC_SERVER *s) +{ + UINT i; + IPSEC_SERVICES sl; + // Validate arguments + if (s == NULL) + { + return; + } + + s->NoMoreChangeSettings = true; + + // Stopp the L2TP server + StopL2TPServer(s->L2TP, false); + + // Stop the IKE server + StopIKEServer(s->Ike); + + // Stop all the services explicitly + Zero(&sl, sizeof(sl)); + IPsecServerSetServices(s, &sl); + + // Releasing process + FreeUdpListener(s->UdpListener); + + ReleaseCedar(s->Cedar); + + FreeL2TPServer(s->L2TP); + + FreeIKEServer(s->Ike); + + for (i = 0;i < LIST_NUM(s->EtherIPIdList);i++) + { + ETHERIP_ID *k = LIST_DATA(s->EtherIPIdList, i); + + Free(k); + } + + ReleaseList(s->EtherIPIdList); + + // Stop the OS monitoring thread + s->Halt = true; + Set(s->OsServiceCheckThreadEvent); + WaitThread(s->OsServiceCheckThread, INFINITE); + ReleaseThread(s->OsServiceCheckThread); + ReleaseEvent(s->OsServiceCheckThreadEvent); + + DeleteLock(s->LockSettings); + + Free(s); +} + +// Initialize the IPsec server +IPSEC_SERVER *NewIPsecServer(CEDAR *cedar) +{ + IPSEC_SERVER *s; + // Validate arguments + if (cedar == NULL) + { + return NULL; + } + + s = ZeroMalloc(sizeof(IPSEC_SERVER)); + + s->LockSettings = NewLock(); + + s->Cedar = cedar; + + AddRef(s->Cedar->ref); + + s->L2TP = NewL2TPServer(cedar); + + s->Ike = NewIKEServer(cedar, s); + StrCpy(s->Ike->Secret, sizeof(s->Ike->Secret), IPSEC_DEFAULT_SECRET); + + s->UdpListener = NewUdpListener(IPsecServerUdpPacketRecvProc, s, &cedar->Server->ListenIP); + + s->EtherIPIdList = NewList(CmpEtherIPId); + + // Start an OS service monitoring thread + s->OsServiceCheckThreadEvent = NewEvent(); + s->OsServiceCheckThread = NewThread(IPsecOsServiceCheckThread, s); + + return s; +} + diff --git a/src/Cedar/Proto_IPsec.h b/src/Cedar/Proto_IPsec.h index 7be62430..2f8bcdfd 100644 --- a/src/Cedar/Proto_IPsec.h +++ b/src/Cedar/Proto_IPsec.h @@ -1,98 +1,98 @@ -// SoftEther VPN Source Code - Developer Edition Master Branch -// Cedar Communication Module - - -// Proto_IPsec.h -// Header of Proto_IPsec.c - -#ifndef PROTO_IPSEC_H -#define PROTO_IPSEC_H - -//// Constants - -// UDP port number -#define IPSEC_PORT_L2TP 1701 // L2TP -#define IPSEC_PORT_IPSEC_ISAKMP 500 // ISAKMP -#define IPSEC_PORT_IPSEC_ESP_UDP 4500 // IPsec ESP over UDP -#define IPSEC_PORT_IPSEC_ESP_RAW MAKE_SPECIAL_PORT(50) // Raw mode ESP Protocol No: 50 -#define IPSEC_PORT_IPSEC_ESP_RAW_WPF MAKE_SPECIAL_PORT(52) // Raw mode ESP Protocol No: 52 (WPF) -#define IPSEC_PORT_L2TPV3_VIRTUAL 1000001 // L2TPv3 virtual port - -// IP protocol number -#define IPSEC_IP_PROTO_ETHERIP IP_PROTO_ETHERIP // EtherIP -#define IPSEC_IP_PROTO_L2TPV3 IP_PROTO_L2TPV3 // L2TPv3 - -// WFP tag -#define WFP_ESP_PACKET_TAG_1 0x19841117 -#define WFP_ESP_PACKET_TAG_2 0x1accafe1 - -// Monitoring interval of OS service -#define IPSEC_CHECK_OS_SERVICE_INTERVAL_INITIAL 1024 -#define IPSEC_CHECK_OS_SERVICE_INTERVAL_MAX (5 * 60 * 1000) - -// Default IPsec pre-shared key -#define IPSEC_DEFAULT_SECRET "vpn" - - -//// Type - -// List of services provided by IPsec server -struct IPSEC_SERVICES -{ - bool L2TP_Raw; // Raw L2TP - bool L2TP_IPsec; // L2TP over IPsec - bool EtherIP_IPsec; // EtherIP over IPsec - - char IPsec_Secret[MAX_SIZE]; // IPsec pre-shared key - char L2TP_DefaultHub[MAX_SIZE]; // Default Virtual HUB name for L2TP connection -}; - -// EtherIP key list entry -struct ETHERIP_ID -{ - char Id[MAX_SIZE]; // ID - char HubName[MAX_HUBNAME_LEN + 1]; // Virtual HUB name - char UserName[MAX_USERNAME_LEN + 1]; // User name - char Password[MAX_USERNAME_LEN + 1]; // Password -}; - -// IPsec server -struct IPSEC_SERVER -{ - CEDAR *Cedar; - UDPLISTENER *UdpListener; - bool Halt; - bool NoMoreChangeSettings; - LOCK *LockSettings; - IPSEC_SERVICES Services; - L2TP_SERVER *L2TP; // L2TP server - IKE_SERVER *Ike; // IKE server - LIST *EtherIPIdList; // EtherIP setting list - UINT EtherIPIdListSettingVerNo; // EtherIP setting list version number - THREAD *OsServiceCheckThread; // OS Service monitoring thread - EVENT *OsServiceCheckThreadEvent; // Event for OS Service monitoring thread - IPSEC_WIN7 *Win7; // Helper module for Windows Vista / 7 - bool Check_LastEnabledStatus; - bool HostIPAddressListChanged; - bool OsServiceStoped; -}; - - -//// Function prototype -IPSEC_SERVER *NewIPsecServer(CEDAR *cedar); -void FreeIPsecServer(IPSEC_SERVER *s); -void IPsecServerUdpPacketRecvProc(UDPLISTENER *u, LIST *packet_list); -void IPsecServerSetServices(IPSEC_SERVER *s, IPSEC_SERVICES *sl); -void IPsecNormalizeServiceSetting(IPSEC_SERVER *s); -void IPsecServerGetServices(IPSEC_SERVER *s, IPSEC_SERVICES *sl); -void IPsecProcPacket(IPSEC_SERVER *s, UDPPACKET *p); -int CmpEtherIPId(void *p1, void *p2); -bool SearchEtherIPId(IPSEC_SERVER *s, ETHERIP_ID *id, char *id_str); -void AddEtherIPId(IPSEC_SERVER *s, ETHERIP_ID *id); -bool DeleteEtherIPId(IPSEC_SERVER *s, char *id_str); -void IPsecOsServiceCheckThread(THREAD *t, void *p); -bool IPsecCheckOsService(IPSEC_SERVER *s); - - -#endif // PROTO_IPSEC_H - +// SoftEther VPN Source Code - Developer Edition Master Branch +// Cedar Communication Module + + +// Proto_IPsec.h +// Header of Proto_IPsec.c + +#ifndef PROTO_IPSEC_H +#define PROTO_IPSEC_H + +//// Constants + +// UDP port number +#define IPSEC_PORT_L2TP 1701 // L2TP +#define IPSEC_PORT_IPSEC_ISAKMP 500 // ISAKMP +#define IPSEC_PORT_IPSEC_ESP_UDP 4500 // IPsec ESP over UDP +#define IPSEC_PORT_IPSEC_ESP_RAW MAKE_SPECIAL_PORT(50) // Raw mode ESP Protocol No: 50 +#define IPSEC_PORT_IPSEC_ESP_RAW_WPF MAKE_SPECIAL_PORT(52) // Raw mode ESP Protocol No: 52 (WPF) +#define IPSEC_PORT_L2TPV3_VIRTUAL 1000001 // L2TPv3 virtual port + +// IP protocol number +#define IPSEC_IP_PROTO_ETHERIP IP_PROTO_ETHERIP // EtherIP +#define IPSEC_IP_PROTO_L2TPV3 IP_PROTO_L2TPV3 // L2TPv3 + +// WFP tag +#define WFP_ESP_PACKET_TAG_1 0x19841117 +#define WFP_ESP_PACKET_TAG_2 0x1accafe1 + +// Monitoring interval of OS service +#define IPSEC_CHECK_OS_SERVICE_INTERVAL_INITIAL 1024 +#define IPSEC_CHECK_OS_SERVICE_INTERVAL_MAX (5 * 60 * 1000) + +// Default IPsec pre-shared key +#define IPSEC_DEFAULT_SECRET "vpn" + + +//// Type + +// List of services provided by IPsec server +struct IPSEC_SERVICES +{ + bool L2TP_Raw; // Raw L2TP + bool L2TP_IPsec; // L2TP over IPsec + bool EtherIP_IPsec; // EtherIP over IPsec + + char IPsec_Secret[MAX_SIZE]; // IPsec pre-shared key + char L2TP_DefaultHub[MAX_SIZE]; // Default Virtual HUB name for L2TP connection +}; + +// EtherIP key list entry +struct ETHERIP_ID +{ + char Id[MAX_SIZE]; // ID + char HubName[MAX_HUBNAME_LEN + 1]; // Virtual HUB name + char UserName[MAX_USERNAME_LEN + 1]; // User name + char Password[MAX_USERNAME_LEN + 1]; // Password +}; + +// IPsec server +struct IPSEC_SERVER +{ + CEDAR *Cedar; + UDPLISTENER *UdpListener; + bool Halt; + bool NoMoreChangeSettings; + LOCK *LockSettings; + IPSEC_SERVICES Services; + L2TP_SERVER *L2TP; // L2TP server + IKE_SERVER *Ike; // IKE server + LIST *EtherIPIdList; // EtherIP setting list + UINT EtherIPIdListSettingVerNo; // EtherIP setting list version number + THREAD *OsServiceCheckThread; // OS Service monitoring thread + EVENT *OsServiceCheckThreadEvent; // Event for OS Service monitoring thread + IPSEC_WIN7 *Win7; // Helper module for Windows Vista / 7 + bool Check_LastEnabledStatus; + bool HostIPAddressListChanged; + bool OsServiceStoped; +}; + + +//// Function prototype +IPSEC_SERVER *NewIPsecServer(CEDAR *cedar); +void FreeIPsecServer(IPSEC_SERVER *s); +void IPsecServerUdpPacketRecvProc(UDPLISTENER *u, LIST *packet_list); +void IPsecServerSetServices(IPSEC_SERVER *s, IPSEC_SERVICES *sl); +void IPsecNormalizeServiceSetting(IPSEC_SERVER *s); +void IPsecServerGetServices(IPSEC_SERVER *s, IPSEC_SERVICES *sl); +void IPsecProcPacket(IPSEC_SERVER *s, UDPPACKET *p); +int CmpEtherIPId(void *p1, void *p2); +bool SearchEtherIPId(IPSEC_SERVER *s, ETHERIP_ID *id, char *id_str); +void AddEtherIPId(IPSEC_SERVER *s, ETHERIP_ID *id); +bool DeleteEtherIPId(IPSEC_SERVER *s, char *id_str); +void IPsecOsServiceCheckThread(THREAD *t, void *p); +bool IPsecCheckOsService(IPSEC_SERVER *s); + + +#endif // PROTO_IPSEC_H + diff --git a/src/Cedar/Proto_IkePacket.c b/src/Cedar/Proto_IkePacket.c index f3e837af..4fbbe362 100644 --- a/src/Cedar/Proto_IkePacket.c +++ b/src/Cedar/Proto_IkePacket.c @@ -1,2898 +1,2898 @@ -// SoftEther VPN Source Code - Developer Edition Master Branch -// Cedar Communication Module - - -// Proto_IkePacket.c -// IKE (ISAKMP) packet processing - -#include "CedarPch.h" - -// Convert the string to a password -BUF *IkeStrToPassword(char *str) -{ - BUF *b; - // Validate arguments - if (str == NULL) - { - return NewBuf(); - } - - if (StartWith(str, "0x") == false) - { - // Accept the string as is - b = NewBuf(); - WriteBuf(b, str, StrLen(str)); - } - else - { - // Interpret as a hexadecimal value - b = StrToBin(str + 2); - } - - return b; -} - -// Build a data payload -BUF *IkeBuildDataPayload(IKE_PACKET_DATA_PAYLOAD *t) -{ - BUF *b; - // Validate arguments - if (t == NULL) - { - return NULL; - } - - b = NewBuf(); - WriteBuf(b, t->Data->Buf, t->Data->Size); - - return b; -} - -// Build a SA payload -BUF *IkeBuildSaPayload(IKE_PACKET_SA_PAYLOAD *t) -{ - IKE_SA_HEADER h; - BUF *ret; - BUF *b; - // Validate arguments - if (t == NULL) - { - return NULL; - } - - Zero(&h, sizeof(h)); - h.DoI = Endian32(IKE_SA_DOI_IPSEC); - h.Situation = Endian32(IKE_SA_SITUATION_IDENTITY); - - ret = NewBuf(); - - WriteBuf(ret, &h, sizeof(h)); - - b = IkeBuildPayloadList(t->PayloadList); - WriteBufBuf(ret, b); - - FreeBuf(b); - - return ret; -} - -// Build a proposal payload -BUF *IkeBuildProposalPayload(IKE_PACKET_PROPOSAL_PAYLOAD *t) -{ - IKE_PROPOSAL_HEADER h; - BUF *ret, *b; - // Validate arguments - if (t == NULL) - { - return NULL; - } - - Zero(&h, sizeof(h)); - h.Number = t->Number; - h.NumTransforms = LIST_NUM(t->PayloadList); - h.ProtocolId = t->ProtocolId; - h.SpiSize = t->Spi->Size; - - ret = NewBuf(); - WriteBuf(ret, &h, sizeof(h)); - WriteBufBuf(ret, t->Spi); - - b = IkeBuildPayloadList(t->PayloadList); - WriteBufBuf(ret, b); - - FreeBuf(b); - - return ret; -} - -// Build the transform value list -BUF *IkeBuildTransformValueList(LIST *o) -{ - BUF *b; - UINT i; - // Validate arguments - if (o == NULL) - { - return NULL; - } - - b = NewBuf(); - - for (i = 0;i < LIST_NUM(o);i++) - { - IKE_PACKET_TRANSFORM_VALUE *v = LIST_DATA(o, i); - BUF *tmp = IkeBuildTransformValue(v); - - WriteBufBuf(b, tmp); - - FreeBuf(tmp); - } - - return b; -} - -// Build a transform value -BUF *IkeBuildTransformValue(IKE_PACKET_TRANSFORM_VALUE *v) -{ - BUF *b; - UCHAR af_bit, type; - USHORT size_or_value; - // Validate arguments - if (v == NULL) - { - return NULL; - } - - type = v->Type; - - if (v->Value >= 65536) - { - // 32 bit - af_bit = 0; - size_or_value = Endian16(sizeof(UINT)); - } - else - { - // 16 bit - af_bit = 0x80; - size_or_value = Endian16((USHORT)v->Value); - } - - b = NewBuf(); - WriteBuf(b, &af_bit, sizeof(af_bit)); - WriteBuf(b, &type, sizeof(type)); - WriteBuf(b, &size_or_value, sizeof(size_or_value)); - - if (af_bit == 0) - { - UINT value = Endian32(v->Value); - WriteBuf(b, &value, sizeof(UINT)); - } - - return b; -} - -// Build a transform payload -BUF *IkeBuildTransformPayload(IKE_PACKET_TRANSFORM_PAYLOAD *t) -{ - IKE_TRANSFORM_HEADER h; - BUF *ret, *b; - // Validate arguments - if (t == NULL) - { - return NULL; - } - - Zero(&h, sizeof(h)); - h.Number = t->Number; - h.TransformId = t->TransformId; - - ret = NewBuf(); - WriteBuf(ret, &h, sizeof(h)); - - b = IkeBuildTransformValueList(t->ValueList); - WriteBufBuf(ret, b); - - FreeBuf(b); - - return ret; -} - -// Get the value from the transform payload -UINT IkeGetTransformValue(IKE_PACKET_TRANSFORM_PAYLOAD *t, UINT type, UINT index) -{ - UINT i; - UINT num; - // Validate arguments - if (t == NULL) - { - return 0; - } - - num = 0; - - for (i = 0;i < LIST_NUM(t->ValueList);i++) - { - IKE_PACKET_TRANSFORM_VALUE *v = LIST_DATA(t->ValueList, i); - - if (v->Type == type) - { - if (num == index) - { - return v->Value; - } - - num++; - } - } - - return 0; -} - -// Get the number of values from the transform payload -UINT IkeGetTransformValueNum(IKE_PACKET_TRANSFORM_PAYLOAD *t, UINT type) -{ - UINT i; - UINT num; - // Validate arguments - if (t == NULL) - { - return 0; - } - - num = 0; - - for (i = 0;i < LIST_NUM(t->ValueList);i++) - { - IKE_PACKET_TRANSFORM_VALUE *v = LIST_DATA(t->ValueList, i); - - if (v->Type == type) - { - num++; - } - } - - return num; -} - -// Build the ID payload -BUF *IkeBuildIdPayload(IKE_PACKET_ID_PAYLOAD *t) -{ - IKE_ID_HEADER h; - BUF *ret; - // Validate arguments - if (t == NULL) - { - return NULL; - } - - Zero(&h, sizeof(h)); - h.IdType = t->Type; - h.Port = Endian16(t->Port); - h.ProtocolId = t->ProtocolId; - - ret = NewBuf(); - WriteBuf(ret, &h, sizeof(h)); - - WriteBufBuf(ret, t->IdData); - - return ret; -} - -// Build a certificate payload -BUF *IkeBuildCertPayload(IKE_PACKET_CERT_PAYLOAD *t) -{ - IKE_CERT_HEADER h; - BUF *ret; - // Validate arguments - if (t == NULL) - { - return NULL; - } - - Zero(&h, sizeof(h)); - h.CertType = t->CertType; - - ret = NewBuf(); - WriteBuf(ret, &h, sizeof(h)); - WriteBufBuf(ret, t->CertData); - - return ret; -} - -// Build a certificate request payload -BUF *IkeBuildCertRequestPayload(IKE_PACKET_CERT_REQUEST_PAYLOAD *t) -{ - IKE_CERT_REQUEST_HEADER h; - BUF *ret; - // Validate arguments - if (t == NULL) - { - return NULL; - } - - Zero(&h, sizeof(h)); - h.CertType = t->CertType; - - ret = NewBuf(); - WriteBuf(ret, &h, sizeof(h)); - WriteBufBuf(ret, t->Data); - - return ret; -} - -// Build a notification payload -BUF *IkeBuildNoticePayload(IKE_PACKET_NOTICE_PAYLOAD *t) -{ - IKE_NOTICE_HEADER h; - BUF *ret; - // Validate arguments - if (t == NULL) - { - return NULL; - } - - Zero(&h, sizeof(h)); - h.DoI = Endian32(IKE_SA_DOI_IPSEC); - h.MessageType = Endian16(t->MessageType); - h.ProtocolId = t->ProtocolId; - h.SpiSize = t->Spi->Size; - - ret = NewBuf(); - WriteBuf(ret, &h, sizeof(h)); - WriteBuf(ret, t->Spi->Buf, t->Spi->Size); - - if (t->MessageData != NULL) - { - WriteBuf(ret, t->MessageData->Buf, t->MessageData->Size); - } - - return ret; -} - -// Build a NAT-OA payload -BUF *IkeBuildNatOaPayload(IKE_PACKET_NAT_OA_PAYLOAD *t) -{ - IKE_NAT_OA_HEADER h; - BUF *ret; - // Validate arguments - if (t == NULL) - { - return NULL; - } - - Zero(&h, sizeof(h)); - - if (IsIP6(&t->IpAddress)) - { - h.IdType = IKE_ID_IPV6_ADDR; - } - else - { - h.IdType = IKE_ID_IPV4_ADDR; - } - - ret = NewBuf(); - - WriteBuf(ret, &h, sizeof(h)); - - if (IsIP6(&t->IpAddress)) - { - WriteBuf(ret, t->IpAddress.ipv6_addr, 16); - } - else - { - WriteBuf(ret, t->IpAddress.addr, 4); - } - - return ret; -} - -// Build a deletion payload -BUF *IkeBuildDeletePayload(IKE_PACKET_DELETE_PAYLOAD *t) -{ - IKE_DELETE_HEADER h; - BUF *ret; - UINT i; - // Validate arguments - if (t == NULL) - { - return NULL; - } - - Zero(&h, sizeof(h)); - h.DoI = Endian32(IKE_SA_DOI_IPSEC); - h.NumSpis = Endian16(LIST_NUM(t->SpiList)); - h.ProtocolId = t->ProtocolId; - - if (LIST_NUM(t->SpiList) >= 1) - { - BUF *b = LIST_DATA(t->SpiList, 0); - - h.SpiSize = b->Size; - } - - ret = NewBuf(); - WriteBuf(ret, &h, sizeof(h)); - - for (i = 0;i < LIST_NUM(t->SpiList);i++) - { - BUF *b = LIST_DATA(t->SpiList, i); - - WriteBuf(ret, b->Buf, b->Size); - } - - return ret; -} - -// Build a bit array from the payload -BUF *IkeBuildPayload(IKE_PACKET_PAYLOAD *p) -{ - BUF *b = NULL; - // Validate arguments - if (p == NULL) - { - return NULL; - } - - switch (p->PayloadType) - { - case IKE_PAYLOAD_SA: // SA payload - b = IkeBuildSaPayload(&p->Payload.Sa); - break; - - case IKE_PAYLOAD_PROPOSAL: // Proposal payload - b = IkeBuildProposalPayload(&p->Payload.Proposal); - break; - - case IKE_PAYLOAD_TRANSFORM: // Transform payload - b = IkeBuildTransformPayload(&p->Payload.Transform); - break; - - case IKE_PAYLOAD_ID: // ID payload - b = IkeBuildIdPayload(&p->Payload.Id); - break; - - case IKE_PAYLOAD_CERT: // Certificate payload - b = IkeBuildCertPayload(&p->Payload.Cert); - break; - - case IKE_PAYLOAD_CERT_REQUEST: // Certificate request payload - b = IkeBuildCertRequestPayload(&p->Payload.CertRequest); - break; - - case IKE_PAYLOAD_NOTICE: // Notification Payload - b = IkeBuildNoticePayload(&p->Payload.Notice); - break; - - case IKE_PAYLOAD_DELETE: // Deletion payload - b = IkeBuildDeletePayload(&p->Payload.Delete); - break; - - case IKE_PAYLOAD_NAT_OA: // NAT-OA payload - case IKE_PAYLOAD_NAT_OA_DRAFT: - case IKE_PAYLOAD_NAT_OA_DRAFT_2: - b = IkeBuildNatOaPayload(&p->Payload.NatOa); - break; - - case IKE_PAYLOAD_KEY_EXCHANGE: // Key exchange payload - case IKE_PAYLOAD_HASH: // Hash payload - case IKE_PAYLOAD_SIGN: // Signature payload - case IKE_PAYLOAD_RAND: // Random number payload - case IKE_PAYLOAD_VENDOR_ID: // Vendor ID payload - case IKE_PAYLOAD_NAT_D: // NAT-D payload - case IKE_PAYLOAD_NAT_D_DRAFT: // NAT-D payload (draft) - default: - b = IkeBuildDataPayload(&p->Payload.GeneralData); - break; - } - - if (b != NULL) - { - if (p->BitArray != NULL) - { - FreeBuf(p->BitArray); - } - p->BitArray = CloneBuf(b); - } - - return b; -} - -// Get the payload type of the first item -UCHAR IkeGetFirstPayloadType(LIST *o) -{ - IKE_PACKET_PAYLOAD *p; - // Validate arguments - if (o == NULL) - { - return IKE_PAYLOAD_NONE; - } - - if (LIST_NUM(o) == 0) - { - return IKE_PAYLOAD_NONE; - } - - p = (IKE_PACKET_PAYLOAD *)LIST_DATA(o, 0); - - return p->PayloadType; -} - -// Build a bit array from the payload list -BUF *IkeBuildPayloadList(LIST *o) -{ - BUF *b; - UINT i; - // Validate arguments - if (o == NULL) - { - return NULL; - } - - b = NewBuf(); - - for (i = 0;i < LIST_NUM(o);i++) - { - IKE_PACKET_PAYLOAD *p = LIST_DATA(o, i); - IKE_PACKET_PAYLOAD *next = NULL; - IKE_COMMON_HEADER h; - BUF *tmp; - - if (i < (LIST_NUM(o) - 1)) - { - next = LIST_DATA(o, i + 1); - } - - Zero(&h, sizeof(h)); - if (next != NULL) - { - h.NextPayload = next->PayloadType; - } - else - { - h.NextPayload = IKE_PAYLOAD_NONE; - } - - tmp = IkeBuildPayload(p); - if (tmp != NULL) - { - h.PayloadSize = Endian16(tmp->Size + (USHORT)sizeof(h)); - - WriteBuf(b, &h, sizeof(h)); - WriteBuf(b, tmp->Buf, tmp->Size); - - FreeBuf(tmp); - } - } - - SeekBuf(b, 0, 0); - - return b; -} - -// Get the specified payload -IKE_PACKET_PAYLOAD *IkeGetPayload(LIST *o, UINT payload_type, UINT index) -{ - UINT i, num; - IKE_PACKET_PAYLOAD *ret = NULL; - // Validate arguments - if (o == NULL) - { - return 0; - } - - num = 0; - - for (i = 0;i < LIST_NUM(o);i++) - { - IKE_PACKET_PAYLOAD *p = LIST_DATA(o, i); - - if (p->PayloadType == payload_type) - { - if (num == index) - { - ret = p; - break; - } - - num++; - } - } - - return ret; -} - -// Get the number of the payload of the specified type -UINT IkeGetPayloadNum(LIST *o, UINT payload_type) -{ - UINT i, num; - // Validate arguments - if (o == NULL) - { - return 0; - } - - num = 0; - - for (i = 0;i < LIST_NUM(o);i++) - { - IKE_PACKET_PAYLOAD *p = LIST_DATA(o, i); - - if (p->PayloadType == payload_type) - { - num++; - } - } - - return num; -} - -// Create a deletion payload -IKE_PACKET_PAYLOAD *IkeNewDeletePayload(UCHAR protocol_id, LIST *spi_list) -{ - IKE_PACKET_PAYLOAD *p; - if (spi_list == NULL) - { - return NULL; - } - - p = IkeNewPayload(IKE_PAYLOAD_DELETE); - p->Payload.Delete.ProtocolId = protocol_id; - p->Payload.Delete.SpiList = spi_list; - - return p; -} - -// Create a Notification payload -IKE_PACKET_PAYLOAD *IkeNewNoticePayload(UCHAR protocol_id, USHORT message_type, - void *spi, UINT spi_size, - void *message, UINT message_size) -{ - IKE_PACKET_PAYLOAD *p; - if (spi == NULL && spi_size != 0) - { - return NULL; - } - if (message == NULL && message_size != 0) - { - return NULL; - } - - p = IkeNewPayload(IKE_PAYLOAD_NOTICE); - p->Payload.Notice.MessageType = message_type; - p->Payload.Notice.MessageData = MemToBuf(message, message_size); - p->Payload.Notice.Spi = MemToBuf(spi, spi_size); - p->Payload.Notice.ProtocolId = protocol_id; - - return p; -} - -// Create a Invalid Cookie Payload -IKE_PACKET_PAYLOAD *IkeNewNoticeErrorInvalidCookiePayload(UINT64 init_cookie, UINT64 resp_cookie) -{ - IKE_PACKET_PAYLOAD *ret; - BUF *b = NewBuf(); - - WriteBufInt64(b, init_cookie); - WriteBufInt64(b, resp_cookie); - - ret = IkeNewNoticePayload(IKE_PROTOCOL_ID_IKE, IKE_NOTICE_ERROR_INVALID_COOKIE, b->Buf, b->Size, - b->Buf, b->Size); - - FreeBuf(b); - - return ret; -} - -// Create an Invalid SPI payload -IKE_PACKET_PAYLOAD *IkeNewNoticeErrorInvalidSpiPayload(UINT spi) -{ - IKE_PACKET_PAYLOAD *ret; - spi = Endian32(spi); - - ret = IkeNewNoticePayload(IKE_PROTOCOL_ID_IPSEC_ESP, IKE_NOTICE_ERROR_INVALID_SPI, &spi, sizeof(UINT), - &spi, sizeof(UINT)); - - return ret; -} - -// Create a No Proposal Chosen payload -IKE_PACKET_PAYLOAD *IkeNewNoticeErrorNoProposalChosenPayload(bool quick_mode, UINT64 init_cookie, UINT64 resp_cookie) -{ - BUF *b = NewBuf(); - IKE_PACKET_PAYLOAD *ret; - - WriteBufInt64(b, init_cookie); - WriteBufInt64(b, resp_cookie); - - ret = IkeNewNoticePayload((quick_mode ? IKE_PROTOCOL_ID_IPSEC_ESP : IKE_PROTOCOL_ID_IKE), - IKE_NOTICE_ERROR_NO_PROPOSAL_CHOSEN, b->Buf, b->Size, - NULL, 0); - - FreeBuf(b); - - return ret; -} - -// Create a DPD payload -IKE_PACKET_PAYLOAD *IkeNewNoticeDpdPayload(bool ack, UINT64 init_cookie, UINT64 resp_cookie, UINT seq_no) -{ - IKE_PACKET_PAYLOAD *ret; - BUF *b = NewBuf(); - - seq_no = Endian32(seq_no); - - WriteBufInt64(b, init_cookie); - WriteBufInt64(b, resp_cookie); - - ret = IkeNewNoticePayload(IKE_PROTOCOL_ID_IKE, (ack ? IKE_NOTICE_DPD_RESPONSE : IKE_NOTICE_DPD_REQUEST), - b->Buf, b->Size, - &seq_no, sizeof(UINT)); - - FreeBuf(b); - - return ret; -} - -// Create an ID payload -IKE_PACKET_PAYLOAD *IkeNewIdPayload(UCHAR id_type, UCHAR protocol_id, USHORT port, void *id_data, UINT id_size) -{ - IKE_PACKET_PAYLOAD *p; - if (id_data == NULL && id_size != 0) - { - return NULL; - } - - p = IkeNewPayload(IKE_PAYLOAD_ID); - p->Payload.Id.IdData = MemToBuf(id_data, id_size); - p->Payload.Id.Port = port; - p->Payload.Id.ProtocolId = protocol_id; - p->Payload.Id.Type = id_type; - - return p; -} - -// Create a transform payload -IKE_PACKET_PAYLOAD *IkeNewTransformPayload(UCHAR number, UCHAR transform_id, LIST *value_list) -{ - IKE_PACKET_PAYLOAD *p; - if (value_list == NULL) - { - return NULL; - } - - p = IkeNewPayload(IKE_PAYLOAD_TRANSFORM); - p->Payload.Transform.Number = number; - p->Payload.Transform.TransformId = transform_id; - p->Payload.Transform.ValueList = value_list; - - return p; -} - -// Create a proposal payload -IKE_PACKET_PAYLOAD *IkeNewProposalPayload(UCHAR number, UCHAR protocol_id, void *spi, UINT spi_size, LIST *payload_list) -{ - IKE_PACKET_PAYLOAD *p; - if (payload_list == NULL || (spi == NULL && spi_size != 0)) - { - return NULL; - } - - p = IkeNewPayload(IKE_PAYLOAD_PROPOSAL); - p->Payload.Proposal.Number = number; - p->Payload.Proposal.ProtocolId = protocol_id; - p->Payload.Proposal.Spi = MemToBuf(spi, spi_size); - p->Payload.Proposal.PayloadList = payload_list; - - return p; -} - -// Create an SA payload -IKE_PACKET_PAYLOAD *IkeNewSaPayload(LIST *payload_list) -{ - IKE_PACKET_PAYLOAD *p; - // Validate arguments - if (payload_list == NULL) - { - return NULL; - } - - p = IkeNewPayload(IKE_PAYLOAD_SA); - p->Payload.Sa.PayloadList = payload_list; - - return p; -} - -// Create a NAT-OA payload -IKE_PACKET_PAYLOAD *IkeNewNatOaPayload(UCHAR payload_type, IP *ip) -{ - IKE_PACKET_PAYLOAD *p; - // Validate arguments - if (ip == NULL) - { - return NULL; - } - - p = IkeNewPayload(payload_type); - Copy(&p->Payload.NatOa.IpAddress, ip, sizeof(IP)); - p->PayloadType = payload_type; - - return p; -} - -// Create a data payload -IKE_PACKET_PAYLOAD *IkeNewDataPayload(UCHAR payload_type, void *data, UINT size) -{ - IKE_PACKET_PAYLOAD *p; - // Validate arguments - if (data == NULL) - { - return NULL; - } - - p = IkeNewPayload(payload_type); - p->Payload.GeneralData.Data = MemToBuf(data, size); - - return p; -} - -// Create a new payload -IKE_PACKET_PAYLOAD *IkeNewPayload(UINT payload_type) -{ - IKE_PACKET_PAYLOAD *p; - - p = ZeroMalloc(sizeof(IKE_PACKET_PAYLOAD)); - - p->PayloadType = payload_type; - - return p; -} - -// Analyse the IKE payload body -IKE_PACKET_PAYLOAD *IkeParsePayload(UINT payload_type, BUF *b) -{ - IKE_PACKET_PAYLOAD *p = NULL; - bool ok = true; - // Validate arguments - if (b == NULL) - { - return NULL; - } - - p = ZeroMalloc(sizeof(IKE_PACKET_PAYLOAD)); - p->PayloadType = payload_type; - - switch (p->PayloadType) - { - case IKE_PAYLOAD_SA: // SA payload - ok = IkeParseSaPayload(&p->Payload.Sa, b); - break; - - case IKE_PAYLOAD_PROPOSAL: // Proposal payload - ok = IkeParseProposalPayload(&p->Payload.Proposal, b); - break; - - case IKE_PAYLOAD_TRANSFORM: // Proposal payload - ok = IkeParseTransformPayload(&p->Payload.Transform, b); - break; - - case IKE_PAYLOAD_ID: // ID payload - ok = IkeParseIdPayload(&p->Payload.Id, b); - break; - - case IKE_PAYLOAD_CERT: // Certificate payload - ok = IkeParseCertPayload(&p->Payload.Cert, b); - break; - - case IKE_PAYLOAD_CERT_REQUEST: // Certificate request payload - ok = IkeParseCertRequestPayload(&p->Payload.CertRequest, b); - break; - - case IKE_PAYLOAD_NOTICE: // Notification Payload - ok = IkeParseNoticePayload(&p->Payload.Notice, b); - break; - - case IKE_PAYLOAD_DELETE: // Deletion payload - ok = IkeParseDeletePayload(&p->Payload.Delete, b); - break; - - case IKE_PAYLOAD_NAT_OA: - case IKE_PAYLOAD_NAT_OA_DRAFT: - case IKE_PAYLOAD_NAT_OA_DRAFT_2: - ok = IkeParseNatOaPayload(&p->Payload.NatOa, b); - break; - - case IKE_PAYLOAD_KEY_EXCHANGE: // Key exchange payload - case IKE_PAYLOAD_HASH: // Hash payload - case IKE_PAYLOAD_SIGN: // Signature payload - case IKE_PAYLOAD_RAND: // Random number payload - case IKE_PAYLOAD_VENDOR_ID: // Vendor ID payload - case IKE_PAYLOAD_NAT_D: // NAT-D payload - case IKE_PAYLOAD_NAT_D_DRAFT: // NAT-D payload (draft) - default: - ok = IkeParseDataPayload(&p->Payload.GeneralData, b); - break; - } - - if (ok == false) - { - Free(p); - p = NULL; - } - else - { - p->BitArray = CloneBuf(b); - } - - return p; -} - -// Parse the SA payload -bool IkeParseSaPayload(IKE_PACKET_SA_PAYLOAD *t, BUF *b) -{ - IKE_SA_HEADER *h; - UCHAR *buf; - UINT size; - // Validate arguments - if (t == NULL || b == NULL) - { - return false; - } - - if (b->Size < sizeof(IKE_SA_HEADER)) - { - return false; - } - - h = (IKE_SA_HEADER *)b->Buf; - buf = (UCHAR *)b->Buf; - buf += sizeof(IKE_SA_HEADER); - size = b->Size - sizeof(IKE_SA_HEADER); - - if (Endian32(h->DoI) != IKE_SA_DOI_IPSEC) - { - Debug("ISAKMP: Invalid DoI Value: 0x%x\n", Endian32(h->DoI)); - return false; - } - - if (Endian32(h->Situation) != IKE_SA_SITUATION_IDENTITY) - { - Debug("ISAKMP: Invalid Situation Value: 0x%x\n", Endian32(h->Situation)); - return false; - } - - t->PayloadList = IkeParsePayloadList(buf, size, IKE_PAYLOAD_PROPOSAL); - - return true; -} - -// Release the SA payload -void IkeFreeSaPayload(IKE_PACKET_SA_PAYLOAD *t) -{ - // Validate arguments - if (t == NULL) - { - return; - } - - if (t->PayloadList != NULL) - { - IkeFreePayloadList(t->PayloadList); - t->PayloadList = NULL; - } -} - -// Parse the proposal payload -bool IkeParseProposalPayload(IKE_PACKET_PROPOSAL_PAYLOAD *t, BUF *b) -{ - IKE_PROPOSAL_HEADER *h; - UCHAR *buf; - UINT size; - // Validate arguments - if (t == NULL || b == NULL) - { - return false; - } - - if (b->Size < sizeof(IKE_PROPOSAL_HEADER)) - { - return false; - } - - h = (IKE_PROPOSAL_HEADER *)b->Buf; - - t->Number = h->Number; - t->ProtocolId = h->ProtocolId; - - buf = (UCHAR *)b->Buf; - buf += sizeof(IKE_PROPOSAL_HEADER); - size = b->Size - sizeof(IKE_PROPOSAL_HEADER); - - if (size < (UINT)h->SpiSize) - { - return false; - } - - t->Spi = MemToBuf(buf, h->SpiSize); - - buf += h->SpiSize; - size -= h->SpiSize; - - t->PayloadList = IkeParsePayloadList(buf, size, IKE_PAYLOAD_TRANSFORM); - - return true; -} - -// Release the proposal payload -void IkeFreeProposalPayload(IKE_PACKET_PROPOSAL_PAYLOAD *t) -{ - // Validate arguments - if (t == NULL) - { - return; - } - - if (t->Spi != NULL) - { - FreeBuf(t->Spi); - t->Spi = NULL; - } - - if (t->PayloadList != NULL) - { - IkeFreePayloadList(t->PayloadList); - t->PayloadList = NULL; - } -} - -// Parse the transform payload -bool IkeParseTransformPayload(IKE_PACKET_TRANSFORM_PAYLOAD *t, BUF *b) -{ - IKE_TRANSFORM_HEADER h; - // Validate arguments - if (t == NULL || b == NULL) - { - return false; - } - - if (ReadBuf(b, &h, sizeof(h)) != sizeof(h)) - { - return false; - } - - t->Number = h.Number; - t->TransformId = h.TransformId; - t->ValueList = IkeParseTransformValueList(b); - - return true; -} - -// Create a new transform value -IKE_PACKET_TRANSFORM_VALUE *IkeNewTransformValue(UCHAR type, UINT value) -{ - IKE_PACKET_TRANSFORM_VALUE *v = ZeroMalloc(sizeof(IKE_PACKET_TRANSFORM_VALUE)); - - v->Type = type; - v->Value = value; - - return v; -} - -// Parse the transform value list -LIST *IkeParseTransformValueList(BUF *b) -{ - LIST *o; - bool ok = true; - // Validate arguments - if (b == NULL) - { - return NULL; - } - - o = NewListFast(NULL); - - while (b->Current < b->Size) - { - UCHAR af_bit, type; - USHORT size; - UINT value = 0; - IKE_PACKET_TRANSFORM_VALUE *v; - - if (ReadBuf(b, &af_bit, sizeof(af_bit)) != sizeof(af_bit)) - { - ok = false; - break; - } - - if (ReadBuf(b, &type, sizeof(type)) != sizeof(type)) - { - ok = false; - break; - } - - if (ReadBuf(b, &size, sizeof(size)) != sizeof(size)) - { - ok = false; - } - - size = Endian16(size); - - if (af_bit == 0) - { - UCHAR *tmp = Malloc(size); - - if (ReadBuf(b, tmp, size) != size) - { - ok = false; - Free(tmp); - break; - } - - switch (size) - { - case sizeof(UINT): - value = READ_UINT(tmp); - break; - - case sizeof(USHORT): - value = READ_USHORT(tmp); - break; - - case sizeof(UCHAR): - value = *((UCHAR *)tmp); - break; - } - - Free(tmp); - } - else - { - value = (UINT)size; - } - - v = ZeroMalloc(sizeof(IKE_PACKET_TRANSFORM_VALUE)); - v->Type = type; - v->Value = value; - - Add(o, v); - } - - if (ok == false) - { - IkeFreeTransformValueList(o); - o = NULL; - } - - return o; -} - -// Release the transform value list -void IkeFreeTransformValueList(LIST *o) -{ - UINT i; - // Validate arguments - if (o == NULL) - { - return; - } - - for (i = 0;i < LIST_NUM(o);i++) - { - IKE_PACKET_TRANSFORM_VALUE *v = LIST_DATA(o, i); - - Free(v); - } - - ReleaseList(o); -} - -// Release the transform payload -void IkeFreeTransformPayload(IKE_PACKET_TRANSFORM_PAYLOAD *t) -{ - // Validate arguments - if (t == NULL) - { - return; - } - - if (t->ValueList != NULL) - { - IkeFreeTransformValueList(t->ValueList); - t->ValueList = NULL; - } -} - -// Parse the ID payload -bool IkeParseIdPayload(IKE_PACKET_ID_PAYLOAD *t, BUF *b) -{ - IKE_ID_HEADER h; - IP ip; - IP subnet; - // Validate arguments - if (t == NULL || b == NULL) - { - return false; - } - - if (ReadBuf(b, &h, sizeof(h)) != sizeof(h)) - { - return false; - } - - t->Type = h.IdType; - t->ProtocolId = h.ProtocolId; - t->Port = Endian16(h.Port); - t->IdData = ReadRemainBuf(b); - if (t->IdData == NULL) - { - return false; - } - - Zero(&ip, sizeof(ip)); - Zero(&subnet, sizeof(subnet)); - - // Convert to string - Zero(t->StrData, sizeof(t->StrData)); - switch (t->Type) - { - case IKE_ID_FQDN: - case IKE_ID_USER_FQDN: - case IKE_ID_KEY_ID: - Copy(t->StrData, t->IdData->Buf, MIN(t->IdData->Size, sizeof(t->StrData) - 1)); - break; - - case IKE_ID_IPV4_ADDR: - if (t->IdData->Size == 4) - { - Copy(ip.addr, t->IdData->Buf, 4); - - IPToStr(t->StrData, sizeof(t->StrData), &ip); - } - break; - - case IKE_ID_IPV6_ADDR: - if (t->IdData->Size == 16) - { - SetIP6(&ip, t->IdData->Buf); - - IPToStr(t->StrData, sizeof(t->StrData), &ip); - } - break; - - case IKE_ID_IPV4_ADDR_SUBNET: - if (t->IdData->Size == 8) - { - char ipstr[MAX_SIZE]; - char subnetstr[MAX_SIZE]; - Copy(ip.addr, t->IdData->Buf, 4); - Copy(subnet.addr, ((UCHAR *)t->IdData->Buf) + 4, 4); - - IPToStr(ipstr, sizeof(ipstr), &ip); - MaskToStr(subnetstr, sizeof(subnetstr), &subnet); - - Format(t->StrData, sizeof(t->StrData), "%s/%s", ipstr, subnetstr); - } - break; - - case IKE_ID_IPV6_ADDR_SUBNET: - if (t->IdData->Size == 32) - { - char ipstr[MAX_SIZE]; - char subnetstr[MAX_SIZE]; - SetIP6(&ip, t->IdData->Buf); - SetIP6(&subnet, ((UCHAR *)t->IdData->Buf) + 16); - - IPToStr(ipstr, sizeof(ipstr), &ip); - MaskToStr(subnetstr, sizeof(subnetstr), &subnet); - - Format(t->StrData, sizeof(t->StrData), "%s/%s", ipstr, subnetstr); - } - break; - } - - return true; -} - -// Release the ID payload -void IkeFreeIdPayload(IKE_PACKET_ID_PAYLOAD *t) -{ - // Validate arguments - if (t == NULL) - { - return; - } - - if (t->IdData != NULL) - { - FreeBuf(t->IdData); - t->IdData = NULL; - } -} - -// Parse the certificate payload -bool IkeParseCertPayload(IKE_PACKET_CERT_PAYLOAD *t, BUF *b) -{ - IKE_CERT_HEADER h; - // Validate arguments - if (t == NULL || b == NULL) - { - return false; - } - - if (ReadBuf(b, &h, sizeof(h)) != sizeof(h)) - { - return false; - } - - t->CertType = h.CertType; - t->CertData = ReadRemainBuf(b); - if (t->CertData == NULL) - { - return false; - } - - return true; -} - -// Release the certificate payload -void IkeFreeCertPayload(IKE_PACKET_CERT_PAYLOAD *t) -{ - // Validate arguments - if (t == NULL) - { - return; - } - - if (t->CertData != NULL) - { - FreeBuf(t->CertData); - t->CertData = NULL; - } -} - -// Parse the certificate request payload -bool IkeParseCertRequestPayload(IKE_PACKET_CERT_REQUEST_PAYLOAD *t, BUF *b) -{ - IKE_CERT_REQUEST_HEADER h; - // Validate arguments - if (t == NULL || b == NULL) - { - return false; - } - - if (ReadBuf(b, &h, sizeof(h)) != sizeof(h)) - { - return false; - } - - t->CertType = h.CertType; - t->Data = ReadRemainBuf(b); - if (t->Data == NULL) - { - return false; - } - - return true; -} - -// Release the certificate request payload -void IkeFreeCertRequestPayload(IKE_PACKET_CERT_REQUEST_PAYLOAD *t) -{ - // Validate arguments - if (t == NULL) - { - return; - } - - if (t->Data != NULL) - { - FreeBuf(t->Data); - t->Data = NULL; - } -} - -// Parse the notification payload -bool IkeParseNoticePayload(IKE_PACKET_NOTICE_PAYLOAD *t, BUF *b) -{ - IKE_NOTICE_HEADER h; - // Validate arguments - if (t == NULL || b == NULL) - { - return false; - } - - if (ReadBuf(b, &h, sizeof(h)) != sizeof(h)) - { - return false; - } - - if (Endian32(h.DoI) != IKE_SA_DOI_IPSEC) - { - Debug("ISAKMP: Invalid DoI Value: 0x%x\n", Endian32(h.DoI)); - return false; - } - - t->MessageType = Endian16(h.MessageType); - t->ProtocolId = h.ProtocolId; - t->Spi = ReadBufFromBuf(b, h.SpiSize); - if (t->Spi == NULL) - { - return false; - } - t->MessageData = ReadRemainBuf(b); - - return true; -} - -// Release the notification payload -void IkeFreeNoticePayload(IKE_PACKET_NOTICE_PAYLOAD *t) -{ - // Validate arguments - if (t == NULL) - { - return; - } - - if (t->MessageData != NULL) - { - FreeBuf(t->MessageData); - t->MessageData = NULL; - } - - if (t->Spi != NULL) - { - FreeBuf(t->Spi); - t->Spi = NULL; - } -} - -// Parse the NAT-OA payload -bool IkeParseNatOaPayload(IKE_PACKET_NAT_OA_PAYLOAD *t, BUF *b) -{ - IKE_NAT_OA_HEADER h; - UCHAR ip4[4]; - UCHAR ip6[16]; - IP ip; - // Validate arguments - if (t == NULL || b == NULL) - { - return false; - } - - Zero(&ip, sizeof(ip)); - - if (ReadBuf(b, &h, sizeof(h)) != sizeof(h)) - { - return false; - } - - if (h.IdType != IKE_ID_IPV4_ADDR && h.IdType != IKE_ID_IPV6_ADDR) - { - return false; - } - - switch (h.IdType) - { - case IKE_ID_IPV4_ADDR: // IPv4 - if (ReadBuf(b, ip4, sizeof(ip4)) != sizeof(ip4)) - { - return false; - } - - SetIP(&ip, ip4[0], ip4[1], ip4[2], ip4[3]); - - break; - - case IKE_ID_IPV6_ADDR: // IPv6 - if (ReadBuf(b, ip6, sizeof(ip6)) != sizeof(ip6)) - { - return false; - } - - SetIP6(&ip, ip6); - - break; - - default: - return false; - } - - Copy(&t->IpAddress, &ip, sizeof(IP)); - - return true; -} - -// Parse the deletion payload -bool IkeParseDeletePayload(IKE_PACKET_DELETE_PAYLOAD *t, BUF *b) -{ - IKE_DELETE_HEADER h; - UINT num_spi; - UINT spi_size; - UINT i; - bool ok = true; - // Validate arguments - if (t == NULL || b == NULL) - { - return false; - } - - if (ReadBuf(b, &h, sizeof(h)) != sizeof(h)) - { - return false; - } - - if (Endian32(h.DoI) != IKE_SA_DOI_IPSEC) - { - Debug("ISAKMP: Invalid DoI Value: 0x%x\n", Endian32(h.DoI)); - return false; - } - - t->ProtocolId = h.ProtocolId; - t->SpiList = NewListFast(NULL); - num_spi = Endian16(h.NumSpis); - spi_size = h.SpiSize; - - for (i = 0;i < num_spi;i++) - { - BUF *spi = ReadBufFromBuf(b, spi_size); - - if (spi == NULL) - { - ok = false; - break; - } - - Add(t->SpiList, spi); - } - - if (ok == false) - { - IkeFreeDeletePayload(t); - return false; - } - - return true; -} - -// Release the deletion payload -void IkeFreeDeletePayload(IKE_PACKET_DELETE_PAYLOAD *t) -{ - UINT i; - // Validate arguments - if (t == NULL) - { - return; - } - - if (t->SpiList != NULL) - { - for (i = 0;i < LIST_NUM(t->SpiList);i++) - { - BUF *spi = LIST_DATA(t->SpiList, i); - - FreeBuf(spi); - } - - ReleaseList(t->SpiList); - - t->SpiList = NULL; - } -} - -// Check whether the hash matches -bool IkeCompareHash(IKE_PACKET_PAYLOAD *hash_payload, void *hash_data, UINT hash_size) -{ - //char tmp1[MAX_SIZE], tmp2[MAX_SIZE]; - // Validate arguments - if (hash_payload == NULL || hash_data == NULL || hash_size == 0) - { - return false; - } - - if (hash_payload->PayloadType != IKE_PAYLOAD_HASH) - { - return false; - } - - if (hash_payload->Payload.Hash.Data == NULL) - { - return false; - } - - if (hash_payload->Payload.Hash.Data->Size != hash_size) - { - return false; - } - - //BinToStrEx(tmp1, sizeof(tmp1), hash_payload->Payload.Hash.Data->Buf, hash_size); - //BinToStrEx(tmp2, sizeof(tmp2), hash_data, hash_size); - - //Debug("IkeCompareHash\n 1: %s\n 2: %s\n", tmp1, tmp2); - - if (Cmp(hash_payload->Payload.Hash.Data->Buf, hash_data, hash_size) != 0) - { - return false; - } - - return true; -} - -// Parse the data payload -bool IkeParseDataPayload(IKE_PACKET_DATA_PAYLOAD *t, BUF *b) -{ - // Validate arguments - if (t == NULL || b == NULL) - { - return false; - } - - t->Data = MemToBuf(b->Buf, b->Size); - - return true; -} - -// Release the data payload -void IkeFreeDataPayload(IKE_PACKET_DATA_PAYLOAD *t) -{ - // Validate arguments - if (t == NULL) - { - return; - } - - FreeBuf(t->Data); -} - -// Release the IKE payload body -void IkeFreePayload(IKE_PACKET_PAYLOAD *p) -{ - // Validate arguments - if (p == NULL) - { - return; - } - - switch (p->PayloadType) - { - case IKE_PAYLOAD_SA: // SA payload - IkeFreeSaPayload(&p->Payload.Sa); - break; - - case IKE_PAYLOAD_PROPOSAL: // Proposal payload - IkeFreeProposalPayload(&p->Payload.Proposal); - break; - - case IKE_PAYLOAD_TRANSFORM: // Proposal payload - IkeFreeTransformPayload(&p->Payload.Transform); - break; - - case IKE_PAYLOAD_ID: // ID payload - IkeFreeIdPayload(&p->Payload.Id); - break; - - case IKE_PAYLOAD_CERT: // Certificate payload - IkeFreeCertPayload(&p->Payload.Cert); - break; - - case IKE_PAYLOAD_CERT_REQUEST: // Certificate request payload - IkeFreeCertRequestPayload(&p->Payload.CertRequest); - break; - - case IKE_PAYLOAD_NOTICE: // Notification Payload - IkeFreeNoticePayload(&p->Payload.Notice); - break; - - case IKE_PAYLOAD_DELETE: // Deletion payload - IkeFreeDeletePayload(&p->Payload.Delete); - break; - - case IKE_PAYLOAD_NAT_OA: // NAT-OD payload - case IKE_PAYLOAD_NAT_OA_DRAFT: - case IKE_PAYLOAD_NAT_OA_DRAFT_2: - // Do Nothing - break; - - case IKE_PAYLOAD_KEY_EXCHANGE: // Key exchange payload - case IKE_PAYLOAD_HASH: // Hash payload - case IKE_PAYLOAD_SIGN: // Signature payload - case IKE_PAYLOAD_RAND: // Random number payload - case IKE_PAYLOAD_VENDOR_ID: // Vendor ID payload - case IKE_PAYLOAD_NAT_D: // NAT-D payload - case IKE_PAYLOAD_NAT_D_DRAFT: // NAT-D payload (draft) - default: - IkeFreeDataPayload(&p->Payload.GeneralData); - break; - } - - if (p->BitArray != NULL) - { - FreeBuf(p->BitArray); - } - - Free(p); -} - -// Analyse the IKE payload list -LIST *IkeParsePayloadList(void *data, UINT size, UCHAR first_payload) -{ - return IkeParsePayloadListEx(data, size, first_payload, NULL); -} -LIST *IkeParsePayloadListEx(void *data, UINT size, UCHAR first_payload, UINT *total_read_size) -{ - LIST *o; - BUF *b; - UCHAR payload_type = first_payload; - UINT total = 0; - // Validate arguments - if (data == NULL) - { - return NULL; - } - - o = NewListFast(NULL); - b = MemToBuf(data, size); - - while (payload_type != IKE_PAYLOAD_NONE) - { - // Read the common header - IKE_COMMON_HEADER header; - USHORT payload_size; - BUF *payload_data; - IKE_PACKET_PAYLOAD *pay; - - if (ReadBuf(b, &header, sizeof(header)) != sizeof(header)) - { - Debug("ISAKMP: Broken Packet (Invalid Payload Size)\n"); - -LABEL_ERROR: - // Header reading failure - IkeFreePayloadList(o); - o = NULL; - - break; - } - - total += sizeof(header); - - // Get the payload size - payload_size = Endian16(header.PayloadSize); - - if (payload_size < sizeof(header)) - { - Debug("ISAKMP: Broken Packet (Invalid Payload Size)\n"); - goto LABEL_ERROR; - } - - payload_size -= sizeof(header); - - // Read the payload data - payload_data = ReadBufFromBuf(b, payload_size); - if (payload_data == NULL) - { - // Data read failure - Debug("ISAKMP: Broken Packet (Invalid Payload Data)\n"); - goto LABEL_ERROR; - } - - total += payload_size; - - // Analyse the payload body - if (IKE_IS_SUPPORTED_PAYLOAD_TYPE(payload_type)) - { - // Supported payload type - pay = IkeParsePayload(payload_type, payload_data); - - if (pay == NULL) - { - FreeBuf(payload_data); - Debug("ISAKMP: Broken Packet (Payload Data Parse Failed)\n"); - goto LABEL_ERROR; - } - - Add(o, pay); - } - else - { - // Unsupported payload type - Debug("ISAKMP: Ignored Payload Type: %u\n", payload_type); - pay = IkeParsePayload(payload_type, payload_data); - - if (pay == NULL) - { - FreeBuf(payload_data); - Debug("ISAKMP: Broken Packet (Payload Data Parse Failed)\n"); - goto LABEL_ERROR; - } - - Add(o, pay); - } - - payload_type = header.NextPayload; - - FreeBuf(payload_data); - } - - FreeBuf(b); - - if (total_read_size != NULL) - { - *total_read_size = total; - } - - return o; -} - -// Release the IKE payload list -void IkeFreePayloadList(LIST *o) -{ - UINT i; - // Validate arguments - if (o == NULL) - { - return; - } - - for (i = 0;i < LIST_NUM(o);i++) - { - IKE_PACKET_PAYLOAD *p = LIST_DATA(o, i); - - IkeFreePayload(p); - } - - ReleaseList(o); -} - -// Build an IKE packet -BUF *IkeBuild(IKE_PACKET *p, IKE_CRYPTO_PARAM *cparam) -{ - return IkeBuildEx(p, cparam, false); -} -BUF *IkeBuildEx(IKE_PACKET *p, IKE_CRYPTO_PARAM *cparam, bool use_original_decrypted) -{ - IKE_HEADER h; - BUF *msg_buf; - BUF *ret; - // Validate arguments - if (p == NULL) - { - return NULL; - } - - if (p->PayloadList == NULL) - { - return NULL; - } - - Zero(&h, sizeof(h)); - h.InitiatorCookie = Endian64(p->InitiatorCookie); - h.ResponderCookie = Endian64(p->ResponderCookie); - h.NextPayload = IkeGetFirstPayloadType(p->PayloadList); - h.Version = IKE_VERSION; - h.ExchangeType = p->ExchangeType; - h.Flag = (p->FlagEncrypted ? IKE_HEADER_FLAG_ENCRYPTED : 0) | - (p->FlagCommit ? IKE_HEADER_FLAG_COMMIT : 0) | - (p->FlagAuthOnly ? IKE_HEADER_FLAG_AUTH_ONLY : 0); - h.MessageId = Endian32(p->MessageId); - - if (p->DecryptedPayload != NULL && use_original_decrypted) - { - msg_buf = CloneBuf(p->DecryptedPayload); - } - else - { - msg_buf = IkeBuildPayloadList(p->PayloadList); - } - - if (p->DecryptedPayload != NULL) - { - FreeBuf(p->DecryptedPayload); - } - - p->DecryptedPayload = CloneBuf(msg_buf); - - if (p->FlagEncrypted) - { - BUF *b; - // Encryption - b = IkeEncryptWithPadding(msg_buf->Buf, msg_buf->Size, cparam); - - if (b == NULL) - { - Debug("ISAKMP: Packet Encrypt Failed\n"); - FreeBuf(msg_buf); - return NULL; - } - - FreeBuf(msg_buf); - - msg_buf = b; - } - - h.MessageSize = Endian32(msg_buf->Size + sizeof(h)); - - ret = NewBuf(); - WriteBuf(ret, &h, sizeof(h)); - WriteBufBuf(ret, msg_buf); - - FreeBuf(msg_buf); - - SeekBuf(ret, 0, 0); - - return ret; -} - -// Analyse the IKE packet -IKE_PACKET *IkeParseEx(void *data, UINT size, IKE_CRYPTO_PARAM *cparam, bool header_only) -{ - IKE_PACKET *p = NULL; - BUF *b; - // Validate arguments - if (data == NULL) - { - return NULL; - } - - b = MemToBuf(data, size); - - if (b->Size < sizeof(IKE_HEADER)) - { - Debug("ISAKMP: Invalid Packet Size\n"); - } - else - { - // Header analysis - IKE_HEADER *h = (IKE_HEADER *)b->Buf; - - p = ZeroMalloc(sizeof(IKE_PACKET)); - - p->MessageSize = Endian32(h->MessageSize); - p->InitiatorCookie = Endian64(h->InitiatorCookie); - p->ResponderCookie = Endian64(h->ResponderCookie); - p->ExchangeType = h->ExchangeType; - p->FlagEncrypted = (h->Flag & IKE_HEADER_FLAG_ENCRYPTED) ? true : false; - p->FlagCommit = (h->Flag & IKE_HEADER_FLAG_COMMIT) ? true : false; - p->FlagAuthOnly = (h->Flag & IKE_HEADER_FLAG_AUTH_ONLY) ? true : false; - p->MessageId = Endian32(h->MessageId); - - if (b->Size < Endian32(h->MessageSize) || - Endian32(h->MessageSize) < sizeof(IKE_HEADER)) - { - Debug("ISAKMP: Invalid Packet Size\n"); - - IkeFree(p); - p = NULL; - } - else - { - if (header_only == false) - { - bool ok = false; - UCHAR *payload_data; - UINT payload_size; - BUF *buf = NULL; - - payload_data = ((UCHAR *)h) + sizeof(IKE_HEADER); - payload_size = Endian32(h->MessageSize) - sizeof(IKE_HEADER); - - // Decrypt if it is encrypted - if (p->FlagEncrypted) - { - buf = IkeDecrypt(payload_data, payload_size, cparam); - - if (buf != NULL) - { - ok = true; - - payload_data = buf->Buf; - payload_size = buf->Size; - - p->DecryptedPayload = CloneBuf(buf); - } - } - else - { - ok = true; - } - - if (ok == false) - { - Debug("ISAKMP: Decrypt Failed\n"); - - IkeFree(p); - p = NULL; - } - else - { - UINT total_read_size; - - // Payload analysis - p->PayloadList = IkeParsePayloadListEx(payload_data, - payload_size, - h->NextPayload, - &total_read_size); - - if (p->DecryptedPayload != NULL) - { - p->DecryptedPayload->Size = MIN(p->DecryptedPayload->Size, total_read_size); - } - else - { - p->DecryptedPayload = MemToBuf(payload_data, payload_size); - } - } - - if (buf != NULL) - { - FreeBuf(buf); - } - } - } - } - - FreeBuf(b); - - return p; -} -IKE_PACKET *IkeParseHeader(void *data, UINT size, IKE_CRYPTO_PARAM *cparam) -{ - return IkeParseEx(data, size, cparam, true); -} -IKE_PACKET *IkeParse(void *data, UINT size, IKE_CRYPTO_PARAM *cparam) -{ - return IkeParseEx(data, size, cparam, false); -} - -// Send packet for debugging by UDP (For debugging with Ethereal) -void IkeDebugUdpSendRawPacket(IKE_PACKET *p) -{ - BUF *b; - IP ip; - SOCK *udp; - // Validate arguments - if (p == NULL) - { - return; - } - - p->FlagEncrypted = false; - - b = IkeBuildEx(p, NULL, true); - - if (b == NULL) - { - return; - } - - Zero(&ip, sizeof(ip)); - SetIP(&ip, 1, 2, 3, 4); - - udp = NewUDP(0); - - SendTo(udp, &ip, 500, b->Buf, b->Size); - - ReleaseSock(udp); - FreeBuf(b); -} - -// Output the payload list -void IkeDebugPrintPayloads(LIST *o, UINT depth) -{ - UINT i; - char space[MAX_SIZE]; - // Validate arguments - if (o == NULL) - { - return; - } - - MakeCharArray2(space, ' ', depth * 2); - - for (i = 0;i < LIST_NUM(o);i++) - { - IKE_PACKET_PAYLOAD *payload = LIST_DATA(o, i); - - Debug("%s%u: Type = %u, Size = %u\n", space, i, payload->PayloadType, payload->BitArray->Size); - - switch (payload->PayloadType) - { - case IKE_PAYLOAD_SA: - IkeDebugPrintPayloads(payload->Payload.Sa.PayloadList, depth + 1); - break; - - case IKE_PAYLOAD_PROPOSAL: - IkeDebugPrintPayloads(payload->Payload.Proposal.PayloadList, depth + 1); - break; - } - } -} - -// Encryption (also with padding) -BUF *IkeEncryptWithPadding(void *data, UINT size, IKE_CRYPTO_PARAM *cparam) -{ - UINT total_size; - UINT i; - UCHAR n = 0; - UCHAR *tmp; - BUF *ret; - UCHAR tmp1600[1600]; - bool no_free = false; - // Validate arguments - if (data == NULL || cparam == NULL) - { - return NULL; - } - - total_size = ((size / cparam->Key->Crypto->BlockSize) + ((size % cparam->Key->Crypto->BlockSize) == 0 ? 0 : 1)) - * cparam->Key->Crypto->BlockSize; - if (total_size == 0) - { - total_size = cparam->Key->Crypto->BlockSize; - } - - if (total_size > sizeof(tmp1600)) - { - tmp = Malloc(total_size); - } - else - { - tmp = tmp1600; - no_free = true; - } - - Copy(tmp, data, size); - - for (i = size;i < total_size;i++) - { - tmp[i] = ++n; - } - - ret = IkeEncrypt(tmp, total_size, cparam); - - if (no_free == false) - { - Free(tmp); - } - - return ret; -} - -// Encryption -BUF *IkeEncrypt(void *data, UINT size, IKE_CRYPTO_PARAM *cparam) -{ - void *tmp; - BUF *b; - UCHAR tmp1600[1600]; - bool no_free = false; - // Validate arguments - if (data == NULL || cparam == NULL) - { - return NULL; - } - - if ((size % cparam->Key->Crypto->BlockSize) != 0) - { - // Not an integral multiple of block size - return NULL; - } - - if (size > sizeof(tmp1600)) - { - tmp = Malloc(size); - } - else - { - tmp = tmp1600; - no_free = true; - } - - IkeCryptoEncrypt(cparam->Key, tmp, data, size, cparam->Iv); - - if (size >= cparam->Key->Crypto->BlockSize) - { - Copy(cparam->NextIv, ((UCHAR *)tmp) + (size - cparam->Key->Crypto->BlockSize), cparam->Key->Crypto->BlockSize); - } - else - { - Zero(cparam->NextIv, cparam->Key->Crypto->BlockSize); - } - - b = MemToBuf(tmp, size); - - if (no_free == false) - { - Free(tmp); - } - - return b; -} - -// Decryption -BUF *IkeDecrypt(void *data, UINT size, IKE_CRYPTO_PARAM *cparam) -{ - void *tmp; - BUF *b; - UCHAR tmp1600[1600]; - bool no_free = false; - // Validate arguments - if (data == NULL || cparam == NULL) - { - return NULL; - } - - if ((size % cparam->Key->Crypto->BlockSize) != 0) - { - // Not an integral multiple of block size - return NULL; - } - - if (size > sizeof(tmp1600)) - { - tmp = Malloc(size); - } - else - { - tmp = tmp1600; - no_free = true; - } - - IkeCryptoDecrypt(cparam->Key, tmp, data, size, cparam->Iv); - - if (size >= cparam->Key->Crypto->BlockSize) - { - Copy(cparam->NextIv, ((UCHAR *)data) + (size - cparam->Key->Crypto->BlockSize), cparam->Key->Crypto->BlockSize); - } - else - { - Zero(cparam->NextIv, cparam->Key->Crypto->BlockSize); - } - - b = MemToBuf(tmp, size); - - if (no_free == false) - { - Free(tmp); - } - - return b; -} - -// Release the IKE packet -void IkeFree(IKE_PACKET *p) -{ - // Validate arguments - if (p == NULL) - { - return; - } - - if (p->PayloadList != NULL) - { - IkeFreePayloadList(p->PayloadList); - } - - if (p->DecryptedPayload != NULL) - { - FreeBuf(p->DecryptedPayload); - } - - Free(p); -} - -// Create an IKE packet -IKE_PACKET *IkeNew(UINT64 init_cookie, UINT64 resp_cookie, UCHAR exchange_type, - bool encrypted, bool commit, bool auth_only, UINT msg_id, - LIST *payload_list) -{ - IKE_PACKET *p = ZeroMalloc(sizeof(IKE_PACKET)); - - p->InitiatorCookie = init_cookie; - p->ResponderCookie = resp_cookie; - p->ExchangeType = exchange_type; - p->FlagEncrypted = encrypted; - p->FlagCommit = commit; - p->FlagAuthOnly = auth_only; - p->MessageId = msg_id; - p->PayloadList = payload_list; - - return p; -} - -// Create an encryption engine for IKE -IKE_ENGINE *NewIkeEngine() -{ - IKE_ENGINE *e = ZeroMalloc(sizeof(IKE_ENGINE)); - IKE_CRYPTO *des, *des3, *aes; - IKE_HASH *sha1, *md5, *sha2_256, *sha2_384, *sha2_512; - IKE_DH *dh1, *dh2, *dh5, *dh2048, *dh3072, *dh4096; - UINT des_key_sizes[] = - { - 8, - }; - UINT des3_key_sizes[] = - { - 24, - }; - UINT aes_key_sizes[] = - { - 16, 24, 32, - }; - - e->CryptosList = NewListFast(NULL); - e->HashesList = NewListFast(NULL); - e->DhsList = NewListFast(NULL); - - //// Encryption algorithm - // DES - des = NewIkeCrypto(e, IKE_CRYPTO_DES_ID, IKE_CRYPTO_DES_STRING, - des_key_sizes, sizeof(des_key_sizes) / sizeof(UINT), 8); - - // 3DES - des3 = NewIkeCrypto(e, IKE_CRYPTO_3DES_ID, IKE_CRYPTO_3DES_STRING, - des3_key_sizes, sizeof(des3_key_sizes) / sizeof(UINT), 8); - - // AES - aes = NewIkeCrypto(e, IKE_CRYPTO_AES_ID, IKE_CRYPTO_AES_STRING, - aes_key_sizes, sizeof(aes_key_sizes) / sizeof(UINT), 16); - - //// Hash algorithm - // SHA-1 - sha1 = NewIkeHash(e, IKE_HASH_SHA1_ID, IKE_HASH_SHA1_STRING, 20); - - // SHA-2 - // sha2-256 - sha2_256 = NewIkeHash(e, IKE_HASH_SHA2_256_ID, IKE_HASH_SHA2_256_STRING, 32); - // sha2-384 - sha2_384 = NewIkeHash(e, IKE_HASH_SHA2_384_ID, IKE_HASH_SHA2_384_STRING, 48); - // sha2-512 - sha2_512 = NewIkeHash(e, IKE_HASH_SHA2_512_ID, IKE_HASH_SHA2_512_STRING, 64); - - // MD5 - md5 = NewIkeHash(e, IKE_HASH_MD5_ID, IKE_HASH_MD5_STRING, 16); - - //// DH algorithm - dh1 = NewIkeDh(e, IKE_DH_1_ID, IKE_DH_1_STRING, 96); - dh2 = NewIkeDh(e, IKE_DH_2_ID, IKE_DH_2_STRING, 128); - dh5 = NewIkeDh(e, IKE_DH_5_ID, IKE_DH_5_STRING, 192); - dh2048 = NewIkeDh(e, IKE_DH_2048_ID, IKE_DH_2048_STRING, 256); - dh3072 = NewIkeDh(e, IKE_DH_3072_ID, IKE_DH_3072_STRING, 384); - dh4096 = NewIkeDh(e, IKE_DH_4096_ID, IKE_DH_4096_STRING, 512); - - // Define the IKE algorithm - e->IkeCryptos[IKE_P1_CRYPTO_DES_CBC] = des; - e->IkeCryptos[IKE_P1_CRYPTO_3DES_CBC] = des3; - e->IkeCryptos[IKE_P1_CRYPTO_AES_CBC] = aes; - e->IkeHashes[IKE_P1_HASH_MD5] = md5; - e->IkeHashes[IKE_P1_HASH_SHA1] = sha1; - e->IkeHashes[IKE_P1_HASH_SHA2_256] = sha2_256; - e->IkeHashes[IKE_P1_HASH_SHA2_384] = sha2_384; - e->IkeHashes[IKE_P1_HASH_SHA2_512] = sha2_512; - - - // Definition of ESP algorithm - e->EspCryptos[IKE_TRANSFORM_ID_P2_ESP_DES] = des; - e->EspCryptos[IKE_TRANSFORM_ID_P2_ESP_3DES] = des3; - e->EspCryptos[IKE_TRANSFORM_ID_P2_ESP_AES] = aes; - e->EspHashes[IKE_P2_HMAC_MD5_96] = md5; - e->EspHashes[IKE_P2_HMAC_SHA1_96] = sha1; - - // Definition of the DH algorithm - e->IkeDhs[IKE_P1_DH_GROUP_768_MODP] = e->EspDhs[IKE_P2_DH_GROUP_768_MODP] = dh1; - e->IkeDhs[IKE_P1_DH_GROUP_1024_MODP] = e->EspDhs[IKE_P2_DH_GROUP_1024_MODP] = dh2; - e->IkeDhs[IKE_P1_DH_GROUP_1536_MODP] = e->EspDhs[IKE_P2_DH_GROUP_1536_MODP] = dh5; - e->IkeDhs[IKE_P1_DH_GROUP_2048_MODP] = e->EspDhs[IKE_P2_DH_GROUP_2048_MODP] = dh2048; - e->IkeDhs[IKE_P1_DH_GROUP_3072_MODP] = e->EspDhs[IKE_P2_DH_GROUP_3072_MODP] = dh3072; - e->IkeDhs[IKE_P1_DH_GROUP_4096_MODP] = e->EspDhs[IKE_P2_DH_GROUP_4096_MODP] = dh4096; - - return e; -} - -// Release the encryption engine for IKE -void FreeIkeEngine(IKE_ENGINE *e) -{ - UINT i; - // Validate arguments - if (e == NULL) - { - return; - } - - for (i = 0;i < LIST_NUM(e->CryptosList);i++) - { - IKE_CRYPTO *c = LIST_DATA(e->CryptosList, i); - - FreeIkeCrypto(c); - } - - ReleaseList(e->CryptosList); - - for (i = 0;i < LIST_NUM(e->HashesList);i++) - { - IKE_HASH *h = LIST_DATA(e->HashesList, i); - - FreeIkeHash(h); - } - ReleaseList(e->HashesList); - - for (i = 0;i < LIST_NUM(e->DhsList);i++) - { - IKE_DH *d = LIST_DATA(e->DhsList, i); - - FreeIkeDh(d); - } - ReleaseList(e->DhsList); - - Free(e); -} - -// Definition of a new DH algorithm for IKE -IKE_DH *NewIkeDh(IKE_ENGINE *e, UINT dh_id, char *name, UINT key_size) -{ - IKE_DH *d; - // Validate arguments - if (e == NULL || name == NULL || key_size == 0) - { - return NULL; - } - - d = ZeroMalloc(sizeof(IKE_DH)); - - d->DhId = dh_id; - d->Name = name; - d->KeySize = key_size; - - Add(e->DhsList, d); - - return d; -} - -// Definition of a new encryption algorithm for IKE -IKE_CRYPTO *NewIkeCrypto(IKE_ENGINE *e, UINT crypto_id, char *name, UINT *key_sizes, UINT num_key_sizes, UINT block_size) -{ - IKE_CRYPTO *c; - UINT i; - // Validate arguments - if (e == NULL || name == NULL || key_sizes == NULL) - { - return NULL; - } - - c = ZeroMalloc(sizeof(IKE_CRYPTO)); - - c->CryptoId = crypto_id; - c->Name = name; - - for (i = 0;i < MIN(num_key_sizes, 16);i++) - { - c->KeySizes[i] = key_sizes[i]; - } - - if (num_key_sizes >= 2) - { - c->VariableKeySize = true; - } - - c->BlockSize = block_size; - - Add(e->CryptosList, c); - - return c; -} - -// Release the definition of Encryption algorithm for IKE -void FreeIkeCrypto(IKE_CRYPTO *c) -{ - // Validate arguments - if (c == NULL) - { - return; - } - - Free(c); -} - -// Release the definition of IKE hash algorithm -void FreeIkeHash(IKE_HASH *h) -{ - // Validate arguments - if (h == NULL) - { - return; - } - - Free(h); -} - -// Release the definition of the DH algorithm for IKE -void FreeIkeDh(IKE_DH *d) -{ - // Validate arguments - if (d == NULL) - { - return; - } - - Free(d); -} - -// Definition of a new hash algorithm for IKE -IKE_HASH *NewIkeHash(IKE_ENGINE *e, UINT hash_id, char *name, UINT size) -{ - IKE_HASH *h; - // Validate arguments - if (e == NULL || name == NULL || size == 0) - { - return NULL; - } - - h = ZeroMalloc(sizeof(IKE_HASH)); - - h->HashId = hash_id; - h->Name = name; - h->HashSize = size; - - Add(e->HashesList, h); - - return h; -} - -// Get the encryption algorithm that is used in IKE -IKE_CRYPTO *GetIkeCrypto(IKE_ENGINE *e, bool for_esp, UINT i) -{ - // Validate arguments - if (e == NULL || i == 0 || i >= MAX_IKE_ENGINE_ELEMENTS) - { - return NULL; - } - - if (for_esp) - { - return e->EspCryptos[i]; - } - else - { - return e->IkeCryptos[i]; - } -} - -// Get the hash algorithm used in the IKE -IKE_HASH *GetIkeHash(IKE_ENGINE *e, bool for_esp, UINT i) -{ - // Validate arguments - if (e == NULL || i == 0 || i >= MAX_IKE_ENGINE_ELEMENTS) - { - return NULL; - } - - if (for_esp) - { - return e->EspHashes[i]; - } - else - { - return e->IkeHashes[i]; - } -} - -// Get the DH algorithm used in the IKE -IKE_DH *GetIkeDh(IKE_ENGINE *e, bool for_esp, UINT i) -{ - // Validate arguments - if (e == NULL || i == 0 || i >= MAX_IKE_ENGINE_ELEMENTS) - { - return NULL; - } - - if (for_esp) - { - return e->EspDhs[i]; - } - else - { - return e->IkeDhs[i]; - } -} - -// Perform encryption -void IkeCryptoEncrypt(IKE_CRYPTO_KEY *k, void *dst, void *src, UINT size, void *ivec) -{ - // Validate arguments - if (k == NULL || dst == NULL || src == NULL || size == 0 || ivec == NULL) - { - Zero(dst, size); - return; - } - - if ((size % k->Crypto->BlockSize) != 0) - { - Zero(dst, size); - return; - } - - switch (k->Crypto->CryptoId) - { - case IKE_CRYPTO_DES_ID: // DES - DesEncrypt(dst, src, size, k->DesKey1, ivec); - break; - - case IKE_CRYPTO_3DES_ID: // 3DES - Des3Encrypt2(dst, src, size, k->DesKey1, k->DesKey2, k->DesKey3, ivec); - break; - - case IKE_CRYPTO_AES_ID: // AES - AesEncrypt(dst, src, size, k->AesKey, ivec); - break; - - default: - // Unknown - Zero(dst, size); - break; - } -} - -// Perform decryption -void IkeCryptoDecrypt(IKE_CRYPTO_KEY *k, void *dst, void *src, UINT size, void *ivec) -{ - // Validate arguments - if (k == NULL || dst == NULL || src == NULL || size == 0 || ivec == NULL) - { - Zero(dst, size); - return; - } - - if ((size % k->Crypto->BlockSize) != 0) - { - Zero(dst, size); - return; - } - - switch (k->Crypto->CryptoId) - { - case IKE_CRYPTO_DES_ID: // DES - DesDecrypt(dst, src, size, k->DesKey1, ivec); - break; - - case IKE_CRYPTO_3DES_ID: // 3DES - Des3Decrypt2(dst, src, size, k->DesKey1, k->DesKey2, k->DesKey3, ivec); - break; - - case IKE_CRYPTO_AES_ID: // AES - AesDecrypt(dst, src, size, k->AesKey, ivec); - break; - - default: - // Unknown - Zero(dst, size); - break; - } -} - -// Calculate a hash -void IkeHash(IKE_HASH *h, void *dst, void *src, UINT size) -{ - // Validate arguments - if (h == NULL || dst == NULL || (size != 0 && src == NULL)) - { - Zero(dst, size); - return; - } - - switch (h->HashId) - { - case IKE_HASH_MD5_ID: - // MD5 - Md5(dst, src, size); - break; - - case IKE_HASH_SHA1_ID: - // SHA-1 - Sha1(dst, src, size); - break; - case IKE_HASH_SHA2_256_ID: - Sha2_256(dst, src, size); - break; - case IKE_HASH_SHA2_384_ID: - Sha2_384(dst, src, size); - break; - case IKE_HASH_SHA2_512_ID: - Sha2_512(dst, src, size); - break; - - default: - // Unknown - Zero(dst, size); - break; - } -} - -// Calculation of HMAC -void IkeHMac(IKE_HASH *h, void *dst, void *key, UINT key_size, void *data, UINT data_size) -{ - MD *md = NULL; - - switch (h->HashId) - { - case IKE_HASH_MD5_ID: - md = NewMd("MD5"); - break; - case IKE_HASH_SHA1_ID: - md = NewMd("SHA1"); - break; - case IKE_HASH_SHA2_256_ID: - md = NewMd("SHA256"); - break; - case IKE_HASH_SHA2_384_ID: - md = NewMd("SHA384"); - break; - case IKE_HASH_SHA2_512_ID: - md = NewMd("SHA512"); - break; - } - - if (md == NULL) - { - Debug("IkeHMac(): The MD object is NULL! Either NewMd() failed or the current algorithm is not handled by the switch-case block.\n"); - return; - } - - if (SetMdKey(md, key, key_size) == false) - { - Debug("IkeHMac(): SetMdKey() failed!\n"); - goto cleanup; - } - - if (MdProcess(md, dst, data, data_size) == 0) - { - Debug("IkeHMac(): MdProcess() returned 0!\n"); - } - -cleanup: - FreeMd(md); -} - -void IkeHMacBuf(IKE_HASH *h, void *dst, BUF *key, BUF *data) -{ - // Validate arguments - if (h == NULL || dst == NULL || key == NULL || data == NULL) - { - return; - } - - IkeHMac(h, dst, key->Buf, key->Size, data->Buf, data->Size); -} - -// Check whether the key size is valid -bool IkeCheckKeySize(IKE_CRYPTO *c, UINT size) -{ - bool ok = false; - UINT i; - // Validate arguments - if (c == NULL || size == 0) - { - return false; - } - - for (i = 0;i < sizeof(c->KeySizes) / sizeof(UINT);i++) - { - if (c->KeySizes[i] == size) - { - ok = true; - break; - } - } - - return ok; -} - -// Create a key -IKE_CRYPTO_KEY *IkeNewKey(IKE_CRYPTO *c, void *data, UINT size) -{ - IKE_CRYPTO_KEY *k; - // Validate arguments - if (c == NULL || data == NULL || size == 0) - { - return NULL; - } - - if (IkeCheckKeySize(c, size) == false) - { - return NULL; - } - - k = ZeroMalloc(sizeof(IKE_CRYPTO_KEY)); - k->Crypto = c; - k->Data = Clone(data, size); - k->Size = size; - - switch (k->Crypto->CryptoId) - { - case IKE_CRYPTO_DES_ID: - // DES 64bit key - k->DesKey1 = DesNewKeyValue(data); - break; - - case IKE_CRYPTO_3DES_ID: - // 3DES 192bit key - k->DesKey1 = DesNewKeyValue(((UCHAR *)data) + DES_KEY_SIZE * 0); - k->DesKey2 = DesNewKeyValue(((UCHAR *)data) + DES_KEY_SIZE * 1); - k->DesKey3 = DesNewKeyValue(((UCHAR *)data) + DES_KEY_SIZE * 2); - break; - - case IKE_CRYPTO_AES_ID: - // AES variable length key - k->AesKey = AesNewKey(data, size); - break; - } - - return k; -} - -// Release the key -void IkeFreeKey(IKE_CRYPTO_KEY *k) -{ - // Validate arguments - if (k == NULL) - { - return; - } - - DesFreeKeyValue(k->DesKey1); - DesFreeKeyValue(k->DesKey2); - DesFreeKeyValue(k->DesKey3); - - AesFreeKey(k->AesKey); - - Free(k->Data); - - Free(k); -} - -// Create a DH object -DH_CTX *IkeDhNewCtx(IKE_DH *d) -{ - // Validate arguments - if (d == NULL) - { - return NULL; - } - - switch (d->DhId) - { - case IKE_DH_1_ID: - return DhNewGroup1(); - - case IKE_DH_2_ID: - return DhNewGroup2(); - - case IKE_DH_5_ID: - return DhNewGroup5(); - - case IKE_DH_2048_ID: - return DhNew2048(); - - case IKE_DH_3072_ID: - return DhNew3072(); - - case IKE_DH_4096_ID: - return DhNew4096(); - } - - return NULL; -} - -// Release the DH object -void IkeDhFreeCtx(DH_CTX *dh) -{ - // Validate arguments - if (dh == NULL) - { - return; - } - - DhFree(dh); -} - - - - - +// SoftEther VPN Source Code - Developer Edition Master Branch +// Cedar Communication Module + + +// Proto_IkePacket.c +// IKE (ISAKMP) packet processing + +#include "CedarPch.h" + +// Convert the string to a password +BUF *IkeStrToPassword(char *str) +{ + BUF *b; + // Validate arguments + if (str == NULL) + { + return NewBuf(); + } + + if (StartWith(str, "0x") == false) + { + // Accept the string as is + b = NewBuf(); + WriteBuf(b, str, StrLen(str)); + } + else + { + // Interpret as a hexadecimal value + b = StrToBin(str + 2); + } + + return b; +} + +// Build a data payload +BUF *IkeBuildDataPayload(IKE_PACKET_DATA_PAYLOAD *t) +{ + BUF *b; + // Validate arguments + if (t == NULL) + { + return NULL; + } + + b = NewBuf(); + WriteBuf(b, t->Data->Buf, t->Data->Size); + + return b; +} + +// Build a SA payload +BUF *IkeBuildSaPayload(IKE_PACKET_SA_PAYLOAD *t) +{ + IKE_SA_HEADER h; + BUF *ret; + BUF *b; + // Validate arguments + if (t == NULL) + { + return NULL; + } + + Zero(&h, sizeof(h)); + h.DoI = Endian32(IKE_SA_DOI_IPSEC); + h.Situation = Endian32(IKE_SA_SITUATION_IDENTITY); + + ret = NewBuf(); + + WriteBuf(ret, &h, sizeof(h)); + + b = IkeBuildPayloadList(t->PayloadList); + WriteBufBuf(ret, b); + + FreeBuf(b); + + return ret; +} + +// Build a proposal payload +BUF *IkeBuildProposalPayload(IKE_PACKET_PROPOSAL_PAYLOAD *t) +{ + IKE_PROPOSAL_HEADER h; + BUF *ret, *b; + // Validate arguments + if (t == NULL) + { + return NULL; + } + + Zero(&h, sizeof(h)); + h.Number = t->Number; + h.NumTransforms = LIST_NUM(t->PayloadList); + h.ProtocolId = t->ProtocolId; + h.SpiSize = t->Spi->Size; + + ret = NewBuf(); + WriteBuf(ret, &h, sizeof(h)); + WriteBufBuf(ret, t->Spi); + + b = IkeBuildPayloadList(t->PayloadList); + WriteBufBuf(ret, b); + + FreeBuf(b); + + return ret; +} + +// Build the transform value list +BUF *IkeBuildTransformValueList(LIST *o) +{ + BUF *b; + UINT i; + // Validate arguments + if (o == NULL) + { + return NULL; + } + + b = NewBuf(); + + for (i = 0;i < LIST_NUM(o);i++) + { + IKE_PACKET_TRANSFORM_VALUE *v = LIST_DATA(o, i); + BUF *tmp = IkeBuildTransformValue(v); + + WriteBufBuf(b, tmp); + + FreeBuf(tmp); + } + + return b; +} + +// Build a transform value +BUF *IkeBuildTransformValue(IKE_PACKET_TRANSFORM_VALUE *v) +{ + BUF *b; + UCHAR af_bit, type; + USHORT size_or_value; + // Validate arguments + if (v == NULL) + { + return NULL; + } + + type = v->Type; + + if (v->Value >= 65536) + { + // 32 bit + af_bit = 0; + size_or_value = Endian16(sizeof(UINT)); + } + else + { + // 16 bit + af_bit = 0x80; + size_or_value = Endian16((USHORT)v->Value); + } + + b = NewBuf(); + WriteBuf(b, &af_bit, sizeof(af_bit)); + WriteBuf(b, &type, sizeof(type)); + WriteBuf(b, &size_or_value, sizeof(size_or_value)); + + if (af_bit == 0) + { + UINT value = Endian32(v->Value); + WriteBuf(b, &value, sizeof(UINT)); + } + + return b; +} + +// Build a transform payload +BUF *IkeBuildTransformPayload(IKE_PACKET_TRANSFORM_PAYLOAD *t) +{ + IKE_TRANSFORM_HEADER h; + BUF *ret, *b; + // Validate arguments + if (t == NULL) + { + return NULL; + } + + Zero(&h, sizeof(h)); + h.Number = t->Number; + h.TransformId = t->TransformId; + + ret = NewBuf(); + WriteBuf(ret, &h, sizeof(h)); + + b = IkeBuildTransformValueList(t->ValueList); + WriteBufBuf(ret, b); + + FreeBuf(b); + + return ret; +} + +// Get the value from the transform payload +UINT IkeGetTransformValue(IKE_PACKET_TRANSFORM_PAYLOAD *t, UINT type, UINT index) +{ + UINT i; + UINT num; + // Validate arguments + if (t == NULL) + { + return 0; + } + + num = 0; + + for (i = 0;i < LIST_NUM(t->ValueList);i++) + { + IKE_PACKET_TRANSFORM_VALUE *v = LIST_DATA(t->ValueList, i); + + if (v->Type == type) + { + if (num == index) + { + return v->Value; + } + + num++; + } + } + + return 0; +} + +// Get the number of values from the transform payload +UINT IkeGetTransformValueNum(IKE_PACKET_TRANSFORM_PAYLOAD *t, UINT type) +{ + UINT i; + UINT num; + // Validate arguments + if (t == NULL) + { + return 0; + } + + num = 0; + + for (i = 0;i < LIST_NUM(t->ValueList);i++) + { + IKE_PACKET_TRANSFORM_VALUE *v = LIST_DATA(t->ValueList, i); + + if (v->Type == type) + { + num++; + } + } + + return num; +} + +// Build the ID payload +BUF *IkeBuildIdPayload(IKE_PACKET_ID_PAYLOAD *t) +{ + IKE_ID_HEADER h; + BUF *ret; + // Validate arguments + if (t == NULL) + { + return NULL; + } + + Zero(&h, sizeof(h)); + h.IdType = t->Type; + h.Port = Endian16(t->Port); + h.ProtocolId = t->ProtocolId; + + ret = NewBuf(); + WriteBuf(ret, &h, sizeof(h)); + + WriteBufBuf(ret, t->IdData); + + return ret; +} + +// Build a certificate payload +BUF *IkeBuildCertPayload(IKE_PACKET_CERT_PAYLOAD *t) +{ + IKE_CERT_HEADER h; + BUF *ret; + // Validate arguments + if (t == NULL) + { + return NULL; + } + + Zero(&h, sizeof(h)); + h.CertType = t->CertType; + + ret = NewBuf(); + WriteBuf(ret, &h, sizeof(h)); + WriteBufBuf(ret, t->CertData); + + return ret; +} + +// Build a certificate request payload +BUF *IkeBuildCertRequestPayload(IKE_PACKET_CERT_REQUEST_PAYLOAD *t) +{ + IKE_CERT_REQUEST_HEADER h; + BUF *ret; + // Validate arguments + if (t == NULL) + { + return NULL; + } + + Zero(&h, sizeof(h)); + h.CertType = t->CertType; + + ret = NewBuf(); + WriteBuf(ret, &h, sizeof(h)); + WriteBufBuf(ret, t->Data); + + return ret; +} + +// Build a notification payload +BUF *IkeBuildNoticePayload(IKE_PACKET_NOTICE_PAYLOAD *t) +{ + IKE_NOTICE_HEADER h; + BUF *ret; + // Validate arguments + if (t == NULL) + { + return NULL; + } + + Zero(&h, sizeof(h)); + h.DoI = Endian32(IKE_SA_DOI_IPSEC); + h.MessageType = Endian16(t->MessageType); + h.ProtocolId = t->ProtocolId; + h.SpiSize = t->Spi->Size; + + ret = NewBuf(); + WriteBuf(ret, &h, sizeof(h)); + WriteBuf(ret, t->Spi->Buf, t->Spi->Size); + + if (t->MessageData != NULL) + { + WriteBuf(ret, t->MessageData->Buf, t->MessageData->Size); + } + + return ret; +} + +// Build a NAT-OA payload +BUF *IkeBuildNatOaPayload(IKE_PACKET_NAT_OA_PAYLOAD *t) +{ + IKE_NAT_OA_HEADER h; + BUF *ret; + // Validate arguments + if (t == NULL) + { + return NULL; + } + + Zero(&h, sizeof(h)); + + if (IsIP6(&t->IpAddress)) + { + h.IdType = IKE_ID_IPV6_ADDR; + } + else + { + h.IdType = IKE_ID_IPV4_ADDR; + } + + ret = NewBuf(); + + WriteBuf(ret, &h, sizeof(h)); + + if (IsIP6(&t->IpAddress)) + { + WriteBuf(ret, t->IpAddress.ipv6_addr, 16); + } + else + { + WriteBuf(ret, t->IpAddress.addr, 4); + } + + return ret; +} + +// Build a deletion payload +BUF *IkeBuildDeletePayload(IKE_PACKET_DELETE_PAYLOAD *t) +{ + IKE_DELETE_HEADER h; + BUF *ret; + UINT i; + // Validate arguments + if (t == NULL) + { + return NULL; + } + + Zero(&h, sizeof(h)); + h.DoI = Endian32(IKE_SA_DOI_IPSEC); + h.NumSpis = Endian16(LIST_NUM(t->SpiList)); + h.ProtocolId = t->ProtocolId; + + if (LIST_NUM(t->SpiList) >= 1) + { + BUF *b = LIST_DATA(t->SpiList, 0); + + h.SpiSize = b->Size; + } + + ret = NewBuf(); + WriteBuf(ret, &h, sizeof(h)); + + for (i = 0;i < LIST_NUM(t->SpiList);i++) + { + BUF *b = LIST_DATA(t->SpiList, i); + + WriteBuf(ret, b->Buf, b->Size); + } + + return ret; +} + +// Build a bit array from the payload +BUF *IkeBuildPayload(IKE_PACKET_PAYLOAD *p) +{ + BUF *b = NULL; + // Validate arguments + if (p == NULL) + { + return NULL; + } + + switch (p->PayloadType) + { + case IKE_PAYLOAD_SA: // SA payload + b = IkeBuildSaPayload(&p->Payload.Sa); + break; + + case IKE_PAYLOAD_PROPOSAL: // Proposal payload + b = IkeBuildProposalPayload(&p->Payload.Proposal); + break; + + case IKE_PAYLOAD_TRANSFORM: // Transform payload + b = IkeBuildTransformPayload(&p->Payload.Transform); + break; + + case IKE_PAYLOAD_ID: // ID payload + b = IkeBuildIdPayload(&p->Payload.Id); + break; + + case IKE_PAYLOAD_CERT: // Certificate payload + b = IkeBuildCertPayload(&p->Payload.Cert); + break; + + case IKE_PAYLOAD_CERT_REQUEST: // Certificate request payload + b = IkeBuildCertRequestPayload(&p->Payload.CertRequest); + break; + + case IKE_PAYLOAD_NOTICE: // Notification Payload + b = IkeBuildNoticePayload(&p->Payload.Notice); + break; + + case IKE_PAYLOAD_DELETE: // Deletion payload + b = IkeBuildDeletePayload(&p->Payload.Delete); + break; + + case IKE_PAYLOAD_NAT_OA: // NAT-OA payload + case IKE_PAYLOAD_NAT_OA_DRAFT: + case IKE_PAYLOAD_NAT_OA_DRAFT_2: + b = IkeBuildNatOaPayload(&p->Payload.NatOa); + break; + + case IKE_PAYLOAD_KEY_EXCHANGE: // Key exchange payload + case IKE_PAYLOAD_HASH: // Hash payload + case IKE_PAYLOAD_SIGN: // Signature payload + case IKE_PAYLOAD_RAND: // Random number payload + case IKE_PAYLOAD_VENDOR_ID: // Vendor ID payload + case IKE_PAYLOAD_NAT_D: // NAT-D payload + case IKE_PAYLOAD_NAT_D_DRAFT: // NAT-D payload (draft) + default: + b = IkeBuildDataPayload(&p->Payload.GeneralData); + break; + } + + if (b != NULL) + { + if (p->BitArray != NULL) + { + FreeBuf(p->BitArray); + } + p->BitArray = CloneBuf(b); + } + + return b; +} + +// Get the payload type of the first item +UCHAR IkeGetFirstPayloadType(LIST *o) +{ + IKE_PACKET_PAYLOAD *p; + // Validate arguments + if (o == NULL) + { + return IKE_PAYLOAD_NONE; + } + + if (LIST_NUM(o) == 0) + { + return IKE_PAYLOAD_NONE; + } + + p = (IKE_PACKET_PAYLOAD *)LIST_DATA(o, 0); + + return p->PayloadType; +} + +// Build a bit array from the payload list +BUF *IkeBuildPayloadList(LIST *o) +{ + BUF *b; + UINT i; + // Validate arguments + if (o == NULL) + { + return NULL; + } + + b = NewBuf(); + + for (i = 0;i < LIST_NUM(o);i++) + { + IKE_PACKET_PAYLOAD *p = LIST_DATA(o, i); + IKE_PACKET_PAYLOAD *next = NULL; + IKE_COMMON_HEADER h; + BUF *tmp; + + if (i < (LIST_NUM(o) - 1)) + { + next = LIST_DATA(o, i + 1); + } + + Zero(&h, sizeof(h)); + if (next != NULL) + { + h.NextPayload = next->PayloadType; + } + else + { + h.NextPayload = IKE_PAYLOAD_NONE; + } + + tmp = IkeBuildPayload(p); + if (tmp != NULL) + { + h.PayloadSize = Endian16(tmp->Size + (USHORT)sizeof(h)); + + WriteBuf(b, &h, sizeof(h)); + WriteBuf(b, tmp->Buf, tmp->Size); + + FreeBuf(tmp); + } + } + + SeekBuf(b, 0, 0); + + return b; +} + +// Get the specified payload +IKE_PACKET_PAYLOAD *IkeGetPayload(LIST *o, UINT payload_type, UINT index) +{ + UINT i, num; + IKE_PACKET_PAYLOAD *ret = NULL; + // Validate arguments + if (o == NULL) + { + return 0; + } + + num = 0; + + for (i = 0;i < LIST_NUM(o);i++) + { + IKE_PACKET_PAYLOAD *p = LIST_DATA(o, i); + + if (p->PayloadType == payload_type) + { + if (num == index) + { + ret = p; + break; + } + + num++; + } + } + + return ret; +} + +// Get the number of the payload of the specified type +UINT IkeGetPayloadNum(LIST *o, UINT payload_type) +{ + UINT i, num; + // Validate arguments + if (o == NULL) + { + return 0; + } + + num = 0; + + for (i = 0;i < LIST_NUM(o);i++) + { + IKE_PACKET_PAYLOAD *p = LIST_DATA(o, i); + + if (p->PayloadType == payload_type) + { + num++; + } + } + + return num; +} + +// Create a deletion payload +IKE_PACKET_PAYLOAD *IkeNewDeletePayload(UCHAR protocol_id, LIST *spi_list) +{ + IKE_PACKET_PAYLOAD *p; + if (spi_list == NULL) + { + return NULL; + } + + p = IkeNewPayload(IKE_PAYLOAD_DELETE); + p->Payload.Delete.ProtocolId = protocol_id; + p->Payload.Delete.SpiList = spi_list; + + return p; +} + +// Create a Notification payload +IKE_PACKET_PAYLOAD *IkeNewNoticePayload(UCHAR protocol_id, USHORT message_type, + void *spi, UINT spi_size, + void *message, UINT message_size) +{ + IKE_PACKET_PAYLOAD *p; + if (spi == NULL && spi_size != 0) + { + return NULL; + } + if (message == NULL && message_size != 0) + { + return NULL; + } + + p = IkeNewPayload(IKE_PAYLOAD_NOTICE); + p->Payload.Notice.MessageType = message_type; + p->Payload.Notice.MessageData = MemToBuf(message, message_size); + p->Payload.Notice.Spi = MemToBuf(spi, spi_size); + p->Payload.Notice.ProtocolId = protocol_id; + + return p; +} + +// Create a Invalid Cookie Payload +IKE_PACKET_PAYLOAD *IkeNewNoticeErrorInvalidCookiePayload(UINT64 init_cookie, UINT64 resp_cookie) +{ + IKE_PACKET_PAYLOAD *ret; + BUF *b = NewBuf(); + + WriteBufInt64(b, init_cookie); + WriteBufInt64(b, resp_cookie); + + ret = IkeNewNoticePayload(IKE_PROTOCOL_ID_IKE, IKE_NOTICE_ERROR_INVALID_COOKIE, b->Buf, b->Size, + b->Buf, b->Size); + + FreeBuf(b); + + return ret; +} + +// Create an Invalid SPI payload +IKE_PACKET_PAYLOAD *IkeNewNoticeErrorInvalidSpiPayload(UINT spi) +{ + IKE_PACKET_PAYLOAD *ret; + spi = Endian32(spi); + + ret = IkeNewNoticePayload(IKE_PROTOCOL_ID_IPSEC_ESP, IKE_NOTICE_ERROR_INVALID_SPI, &spi, sizeof(UINT), + &spi, sizeof(UINT)); + + return ret; +} + +// Create a No Proposal Chosen payload +IKE_PACKET_PAYLOAD *IkeNewNoticeErrorNoProposalChosenPayload(bool quick_mode, UINT64 init_cookie, UINT64 resp_cookie) +{ + BUF *b = NewBuf(); + IKE_PACKET_PAYLOAD *ret; + + WriteBufInt64(b, init_cookie); + WriteBufInt64(b, resp_cookie); + + ret = IkeNewNoticePayload((quick_mode ? IKE_PROTOCOL_ID_IPSEC_ESP : IKE_PROTOCOL_ID_IKE), + IKE_NOTICE_ERROR_NO_PROPOSAL_CHOSEN, b->Buf, b->Size, + NULL, 0); + + FreeBuf(b); + + return ret; +} + +// Create a DPD payload +IKE_PACKET_PAYLOAD *IkeNewNoticeDpdPayload(bool ack, UINT64 init_cookie, UINT64 resp_cookie, UINT seq_no) +{ + IKE_PACKET_PAYLOAD *ret; + BUF *b = NewBuf(); + + seq_no = Endian32(seq_no); + + WriteBufInt64(b, init_cookie); + WriteBufInt64(b, resp_cookie); + + ret = IkeNewNoticePayload(IKE_PROTOCOL_ID_IKE, (ack ? IKE_NOTICE_DPD_RESPONSE : IKE_NOTICE_DPD_REQUEST), + b->Buf, b->Size, + &seq_no, sizeof(UINT)); + + FreeBuf(b); + + return ret; +} + +// Create an ID payload +IKE_PACKET_PAYLOAD *IkeNewIdPayload(UCHAR id_type, UCHAR protocol_id, USHORT port, void *id_data, UINT id_size) +{ + IKE_PACKET_PAYLOAD *p; + if (id_data == NULL && id_size != 0) + { + return NULL; + } + + p = IkeNewPayload(IKE_PAYLOAD_ID); + p->Payload.Id.IdData = MemToBuf(id_data, id_size); + p->Payload.Id.Port = port; + p->Payload.Id.ProtocolId = protocol_id; + p->Payload.Id.Type = id_type; + + return p; +} + +// Create a transform payload +IKE_PACKET_PAYLOAD *IkeNewTransformPayload(UCHAR number, UCHAR transform_id, LIST *value_list) +{ + IKE_PACKET_PAYLOAD *p; + if (value_list == NULL) + { + return NULL; + } + + p = IkeNewPayload(IKE_PAYLOAD_TRANSFORM); + p->Payload.Transform.Number = number; + p->Payload.Transform.TransformId = transform_id; + p->Payload.Transform.ValueList = value_list; + + return p; +} + +// Create a proposal payload +IKE_PACKET_PAYLOAD *IkeNewProposalPayload(UCHAR number, UCHAR protocol_id, void *spi, UINT spi_size, LIST *payload_list) +{ + IKE_PACKET_PAYLOAD *p; + if (payload_list == NULL || (spi == NULL && spi_size != 0)) + { + return NULL; + } + + p = IkeNewPayload(IKE_PAYLOAD_PROPOSAL); + p->Payload.Proposal.Number = number; + p->Payload.Proposal.ProtocolId = protocol_id; + p->Payload.Proposal.Spi = MemToBuf(spi, spi_size); + p->Payload.Proposal.PayloadList = payload_list; + + return p; +} + +// Create an SA payload +IKE_PACKET_PAYLOAD *IkeNewSaPayload(LIST *payload_list) +{ + IKE_PACKET_PAYLOAD *p; + // Validate arguments + if (payload_list == NULL) + { + return NULL; + } + + p = IkeNewPayload(IKE_PAYLOAD_SA); + p->Payload.Sa.PayloadList = payload_list; + + return p; +} + +// Create a NAT-OA payload +IKE_PACKET_PAYLOAD *IkeNewNatOaPayload(UCHAR payload_type, IP *ip) +{ + IKE_PACKET_PAYLOAD *p; + // Validate arguments + if (ip == NULL) + { + return NULL; + } + + p = IkeNewPayload(payload_type); + Copy(&p->Payload.NatOa.IpAddress, ip, sizeof(IP)); + p->PayloadType = payload_type; + + return p; +} + +// Create a data payload +IKE_PACKET_PAYLOAD *IkeNewDataPayload(UCHAR payload_type, void *data, UINT size) +{ + IKE_PACKET_PAYLOAD *p; + // Validate arguments + if (data == NULL) + { + return NULL; + } + + p = IkeNewPayload(payload_type); + p->Payload.GeneralData.Data = MemToBuf(data, size); + + return p; +} + +// Create a new payload +IKE_PACKET_PAYLOAD *IkeNewPayload(UINT payload_type) +{ + IKE_PACKET_PAYLOAD *p; + + p = ZeroMalloc(sizeof(IKE_PACKET_PAYLOAD)); + + p->PayloadType = payload_type; + + return p; +} + +// Analyse the IKE payload body +IKE_PACKET_PAYLOAD *IkeParsePayload(UINT payload_type, BUF *b) +{ + IKE_PACKET_PAYLOAD *p = NULL; + bool ok = true; + // Validate arguments + if (b == NULL) + { + return NULL; + } + + p = ZeroMalloc(sizeof(IKE_PACKET_PAYLOAD)); + p->PayloadType = payload_type; + + switch (p->PayloadType) + { + case IKE_PAYLOAD_SA: // SA payload + ok = IkeParseSaPayload(&p->Payload.Sa, b); + break; + + case IKE_PAYLOAD_PROPOSAL: // Proposal payload + ok = IkeParseProposalPayload(&p->Payload.Proposal, b); + break; + + case IKE_PAYLOAD_TRANSFORM: // Proposal payload + ok = IkeParseTransformPayload(&p->Payload.Transform, b); + break; + + case IKE_PAYLOAD_ID: // ID payload + ok = IkeParseIdPayload(&p->Payload.Id, b); + break; + + case IKE_PAYLOAD_CERT: // Certificate payload + ok = IkeParseCertPayload(&p->Payload.Cert, b); + break; + + case IKE_PAYLOAD_CERT_REQUEST: // Certificate request payload + ok = IkeParseCertRequestPayload(&p->Payload.CertRequest, b); + break; + + case IKE_PAYLOAD_NOTICE: // Notification Payload + ok = IkeParseNoticePayload(&p->Payload.Notice, b); + break; + + case IKE_PAYLOAD_DELETE: // Deletion payload + ok = IkeParseDeletePayload(&p->Payload.Delete, b); + break; + + case IKE_PAYLOAD_NAT_OA: + case IKE_PAYLOAD_NAT_OA_DRAFT: + case IKE_PAYLOAD_NAT_OA_DRAFT_2: + ok = IkeParseNatOaPayload(&p->Payload.NatOa, b); + break; + + case IKE_PAYLOAD_KEY_EXCHANGE: // Key exchange payload + case IKE_PAYLOAD_HASH: // Hash payload + case IKE_PAYLOAD_SIGN: // Signature payload + case IKE_PAYLOAD_RAND: // Random number payload + case IKE_PAYLOAD_VENDOR_ID: // Vendor ID payload + case IKE_PAYLOAD_NAT_D: // NAT-D payload + case IKE_PAYLOAD_NAT_D_DRAFT: // NAT-D payload (draft) + default: + ok = IkeParseDataPayload(&p->Payload.GeneralData, b); + break; + } + + if (ok == false) + { + Free(p); + p = NULL; + } + else + { + p->BitArray = CloneBuf(b); + } + + return p; +} + +// Parse the SA payload +bool IkeParseSaPayload(IKE_PACKET_SA_PAYLOAD *t, BUF *b) +{ + IKE_SA_HEADER *h; + UCHAR *buf; + UINT size; + // Validate arguments + if (t == NULL || b == NULL) + { + return false; + } + + if (b->Size < sizeof(IKE_SA_HEADER)) + { + return false; + } + + h = (IKE_SA_HEADER *)b->Buf; + buf = (UCHAR *)b->Buf; + buf += sizeof(IKE_SA_HEADER); + size = b->Size - sizeof(IKE_SA_HEADER); + + if (Endian32(h->DoI) != IKE_SA_DOI_IPSEC) + { + Debug("ISAKMP: Invalid DoI Value: 0x%x\n", Endian32(h->DoI)); + return false; + } + + if (Endian32(h->Situation) != IKE_SA_SITUATION_IDENTITY) + { + Debug("ISAKMP: Invalid Situation Value: 0x%x\n", Endian32(h->Situation)); + return false; + } + + t->PayloadList = IkeParsePayloadList(buf, size, IKE_PAYLOAD_PROPOSAL); + + return true; +} + +// Release the SA payload +void IkeFreeSaPayload(IKE_PACKET_SA_PAYLOAD *t) +{ + // Validate arguments + if (t == NULL) + { + return; + } + + if (t->PayloadList != NULL) + { + IkeFreePayloadList(t->PayloadList); + t->PayloadList = NULL; + } +} + +// Parse the proposal payload +bool IkeParseProposalPayload(IKE_PACKET_PROPOSAL_PAYLOAD *t, BUF *b) +{ + IKE_PROPOSAL_HEADER *h; + UCHAR *buf; + UINT size; + // Validate arguments + if (t == NULL || b == NULL) + { + return false; + } + + if (b->Size < sizeof(IKE_PROPOSAL_HEADER)) + { + return false; + } + + h = (IKE_PROPOSAL_HEADER *)b->Buf; + + t->Number = h->Number; + t->ProtocolId = h->ProtocolId; + + buf = (UCHAR *)b->Buf; + buf += sizeof(IKE_PROPOSAL_HEADER); + size = b->Size - sizeof(IKE_PROPOSAL_HEADER); + + if (size < (UINT)h->SpiSize) + { + return false; + } + + t->Spi = MemToBuf(buf, h->SpiSize); + + buf += h->SpiSize; + size -= h->SpiSize; + + t->PayloadList = IkeParsePayloadList(buf, size, IKE_PAYLOAD_TRANSFORM); + + return true; +} + +// Release the proposal payload +void IkeFreeProposalPayload(IKE_PACKET_PROPOSAL_PAYLOAD *t) +{ + // Validate arguments + if (t == NULL) + { + return; + } + + if (t->Spi != NULL) + { + FreeBuf(t->Spi); + t->Spi = NULL; + } + + if (t->PayloadList != NULL) + { + IkeFreePayloadList(t->PayloadList); + t->PayloadList = NULL; + } +} + +// Parse the transform payload +bool IkeParseTransformPayload(IKE_PACKET_TRANSFORM_PAYLOAD *t, BUF *b) +{ + IKE_TRANSFORM_HEADER h; + // Validate arguments + if (t == NULL || b == NULL) + { + return false; + } + + if (ReadBuf(b, &h, sizeof(h)) != sizeof(h)) + { + return false; + } + + t->Number = h.Number; + t->TransformId = h.TransformId; + t->ValueList = IkeParseTransformValueList(b); + + return true; +} + +// Create a new transform value +IKE_PACKET_TRANSFORM_VALUE *IkeNewTransformValue(UCHAR type, UINT value) +{ + IKE_PACKET_TRANSFORM_VALUE *v = ZeroMalloc(sizeof(IKE_PACKET_TRANSFORM_VALUE)); + + v->Type = type; + v->Value = value; + + return v; +} + +// Parse the transform value list +LIST *IkeParseTransformValueList(BUF *b) +{ + LIST *o; + bool ok = true; + // Validate arguments + if (b == NULL) + { + return NULL; + } + + o = NewListFast(NULL); + + while (b->Current < b->Size) + { + UCHAR af_bit, type; + USHORT size; + UINT value = 0; + IKE_PACKET_TRANSFORM_VALUE *v; + + if (ReadBuf(b, &af_bit, sizeof(af_bit)) != sizeof(af_bit)) + { + ok = false; + break; + } + + if (ReadBuf(b, &type, sizeof(type)) != sizeof(type)) + { + ok = false; + break; + } + + if (ReadBuf(b, &size, sizeof(size)) != sizeof(size)) + { + ok = false; + } + + size = Endian16(size); + + if (af_bit == 0) + { + UCHAR *tmp = Malloc(size); + + if (ReadBuf(b, tmp, size) != size) + { + ok = false; + Free(tmp); + break; + } + + switch (size) + { + case sizeof(UINT): + value = READ_UINT(tmp); + break; + + case sizeof(USHORT): + value = READ_USHORT(tmp); + break; + + case sizeof(UCHAR): + value = *((UCHAR *)tmp); + break; + } + + Free(tmp); + } + else + { + value = (UINT)size; + } + + v = ZeroMalloc(sizeof(IKE_PACKET_TRANSFORM_VALUE)); + v->Type = type; + v->Value = value; + + Add(o, v); + } + + if (ok == false) + { + IkeFreeTransformValueList(o); + o = NULL; + } + + return o; +} + +// Release the transform value list +void IkeFreeTransformValueList(LIST *o) +{ + UINT i; + // Validate arguments + if (o == NULL) + { + return; + } + + for (i = 0;i < LIST_NUM(o);i++) + { + IKE_PACKET_TRANSFORM_VALUE *v = LIST_DATA(o, i); + + Free(v); + } + + ReleaseList(o); +} + +// Release the transform payload +void IkeFreeTransformPayload(IKE_PACKET_TRANSFORM_PAYLOAD *t) +{ + // Validate arguments + if (t == NULL) + { + return; + } + + if (t->ValueList != NULL) + { + IkeFreeTransformValueList(t->ValueList); + t->ValueList = NULL; + } +} + +// Parse the ID payload +bool IkeParseIdPayload(IKE_PACKET_ID_PAYLOAD *t, BUF *b) +{ + IKE_ID_HEADER h; + IP ip; + IP subnet; + // Validate arguments + if (t == NULL || b == NULL) + { + return false; + } + + if (ReadBuf(b, &h, sizeof(h)) != sizeof(h)) + { + return false; + } + + t->Type = h.IdType; + t->ProtocolId = h.ProtocolId; + t->Port = Endian16(h.Port); + t->IdData = ReadRemainBuf(b); + if (t->IdData == NULL) + { + return false; + } + + Zero(&ip, sizeof(ip)); + Zero(&subnet, sizeof(subnet)); + + // Convert to string + Zero(t->StrData, sizeof(t->StrData)); + switch (t->Type) + { + case IKE_ID_FQDN: + case IKE_ID_USER_FQDN: + case IKE_ID_KEY_ID: + Copy(t->StrData, t->IdData->Buf, MIN(t->IdData->Size, sizeof(t->StrData) - 1)); + break; + + case IKE_ID_IPV4_ADDR: + if (t->IdData->Size == 4) + { + Copy(ip.addr, t->IdData->Buf, 4); + + IPToStr(t->StrData, sizeof(t->StrData), &ip); + } + break; + + case IKE_ID_IPV6_ADDR: + if (t->IdData->Size == 16) + { + SetIP6(&ip, t->IdData->Buf); + + IPToStr(t->StrData, sizeof(t->StrData), &ip); + } + break; + + case IKE_ID_IPV4_ADDR_SUBNET: + if (t->IdData->Size == 8) + { + char ipstr[MAX_SIZE]; + char subnetstr[MAX_SIZE]; + Copy(ip.addr, t->IdData->Buf, 4); + Copy(subnet.addr, ((UCHAR *)t->IdData->Buf) + 4, 4); + + IPToStr(ipstr, sizeof(ipstr), &ip); + MaskToStr(subnetstr, sizeof(subnetstr), &subnet); + + Format(t->StrData, sizeof(t->StrData), "%s/%s", ipstr, subnetstr); + } + break; + + case IKE_ID_IPV6_ADDR_SUBNET: + if (t->IdData->Size == 32) + { + char ipstr[MAX_SIZE]; + char subnetstr[MAX_SIZE]; + SetIP6(&ip, t->IdData->Buf); + SetIP6(&subnet, ((UCHAR *)t->IdData->Buf) + 16); + + IPToStr(ipstr, sizeof(ipstr), &ip); + MaskToStr(subnetstr, sizeof(subnetstr), &subnet); + + Format(t->StrData, sizeof(t->StrData), "%s/%s", ipstr, subnetstr); + } + break; + } + + return true; +} + +// Release the ID payload +void IkeFreeIdPayload(IKE_PACKET_ID_PAYLOAD *t) +{ + // Validate arguments + if (t == NULL) + { + return; + } + + if (t->IdData != NULL) + { + FreeBuf(t->IdData); + t->IdData = NULL; + } +} + +// Parse the certificate payload +bool IkeParseCertPayload(IKE_PACKET_CERT_PAYLOAD *t, BUF *b) +{ + IKE_CERT_HEADER h; + // Validate arguments + if (t == NULL || b == NULL) + { + return false; + } + + if (ReadBuf(b, &h, sizeof(h)) != sizeof(h)) + { + return false; + } + + t->CertType = h.CertType; + t->CertData = ReadRemainBuf(b); + if (t->CertData == NULL) + { + return false; + } + + return true; +} + +// Release the certificate payload +void IkeFreeCertPayload(IKE_PACKET_CERT_PAYLOAD *t) +{ + // Validate arguments + if (t == NULL) + { + return; + } + + if (t->CertData != NULL) + { + FreeBuf(t->CertData); + t->CertData = NULL; + } +} + +// Parse the certificate request payload +bool IkeParseCertRequestPayload(IKE_PACKET_CERT_REQUEST_PAYLOAD *t, BUF *b) +{ + IKE_CERT_REQUEST_HEADER h; + // Validate arguments + if (t == NULL || b == NULL) + { + return false; + } + + if (ReadBuf(b, &h, sizeof(h)) != sizeof(h)) + { + return false; + } + + t->CertType = h.CertType; + t->Data = ReadRemainBuf(b); + if (t->Data == NULL) + { + return false; + } + + return true; +} + +// Release the certificate request payload +void IkeFreeCertRequestPayload(IKE_PACKET_CERT_REQUEST_PAYLOAD *t) +{ + // Validate arguments + if (t == NULL) + { + return; + } + + if (t->Data != NULL) + { + FreeBuf(t->Data); + t->Data = NULL; + } +} + +// Parse the notification payload +bool IkeParseNoticePayload(IKE_PACKET_NOTICE_PAYLOAD *t, BUF *b) +{ + IKE_NOTICE_HEADER h; + // Validate arguments + if (t == NULL || b == NULL) + { + return false; + } + + if (ReadBuf(b, &h, sizeof(h)) != sizeof(h)) + { + return false; + } + + if (Endian32(h.DoI) != IKE_SA_DOI_IPSEC) + { + Debug("ISAKMP: Invalid DoI Value: 0x%x\n", Endian32(h.DoI)); + return false; + } + + t->MessageType = Endian16(h.MessageType); + t->ProtocolId = h.ProtocolId; + t->Spi = ReadBufFromBuf(b, h.SpiSize); + if (t->Spi == NULL) + { + return false; + } + t->MessageData = ReadRemainBuf(b); + + return true; +} + +// Release the notification payload +void IkeFreeNoticePayload(IKE_PACKET_NOTICE_PAYLOAD *t) +{ + // Validate arguments + if (t == NULL) + { + return; + } + + if (t->MessageData != NULL) + { + FreeBuf(t->MessageData); + t->MessageData = NULL; + } + + if (t->Spi != NULL) + { + FreeBuf(t->Spi); + t->Spi = NULL; + } +} + +// Parse the NAT-OA payload +bool IkeParseNatOaPayload(IKE_PACKET_NAT_OA_PAYLOAD *t, BUF *b) +{ + IKE_NAT_OA_HEADER h; + UCHAR ip4[4]; + UCHAR ip6[16]; + IP ip; + // Validate arguments + if (t == NULL || b == NULL) + { + return false; + } + + Zero(&ip, sizeof(ip)); + + if (ReadBuf(b, &h, sizeof(h)) != sizeof(h)) + { + return false; + } + + if (h.IdType != IKE_ID_IPV4_ADDR && h.IdType != IKE_ID_IPV6_ADDR) + { + return false; + } + + switch (h.IdType) + { + case IKE_ID_IPV4_ADDR: // IPv4 + if (ReadBuf(b, ip4, sizeof(ip4)) != sizeof(ip4)) + { + return false; + } + + SetIP(&ip, ip4[0], ip4[1], ip4[2], ip4[3]); + + break; + + case IKE_ID_IPV6_ADDR: // IPv6 + if (ReadBuf(b, ip6, sizeof(ip6)) != sizeof(ip6)) + { + return false; + } + + SetIP6(&ip, ip6); + + break; + + default: + return false; + } + + Copy(&t->IpAddress, &ip, sizeof(IP)); + + return true; +} + +// Parse the deletion payload +bool IkeParseDeletePayload(IKE_PACKET_DELETE_PAYLOAD *t, BUF *b) +{ + IKE_DELETE_HEADER h; + UINT num_spi; + UINT spi_size; + UINT i; + bool ok = true; + // Validate arguments + if (t == NULL || b == NULL) + { + return false; + } + + if (ReadBuf(b, &h, sizeof(h)) != sizeof(h)) + { + return false; + } + + if (Endian32(h.DoI) != IKE_SA_DOI_IPSEC) + { + Debug("ISAKMP: Invalid DoI Value: 0x%x\n", Endian32(h.DoI)); + return false; + } + + t->ProtocolId = h.ProtocolId; + t->SpiList = NewListFast(NULL); + num_spi = Endian16(h.NumSpis); + spi_size = h.SpiSize; + + for (i = 0;i < num_spi;i++) + { + BUF *spi = ReadBufFromBuf(b, spi_size); + + if (spi == NULL) + { + ok = false; + break; + } + + Add(t->SpiList, spi); + } + + if (ok == false) + { + IkeFreeDeletePayload(t); + return false; + } + + return true; +} + +// Release the deletion payload +void IkeFreeDeletePayload(IKE_PACKET_DELETE_PAYLOAD *t) +{ + UINT i; + // Validate arguments + if (t == NULL) + { + return; + } + + if (t->SpiList != NULL) + { + for (i = 0;i < LIST_NUM(t->SpiList);i++) + { + BUF *spi = LIST_DATA(t->SpiList, i); + + FreeBuf(spi); + } + + ReleaseList(t->SpiList); + + t->SpiList = NULL; + } +} + +// Check whether the hash matches +bool IkeCompareHash(IKE_PACKET_PAYLOAD *hash_payload, void *hash_data, UINT hash_size) +{ + //char tmp1[MAX_SIZE], tmp2[MAX_SIZE]; + // Validate arguments + if (hash_payload == NULL || hash_data == NULL || hash_size == 0) + { + return false; + } + + if (hash_payload->PayloadType != IKE_PAYLOAD_HASH) + { + return false; + } + + if (hash_payload->Payload.Hash.Data == NULL) + { + return false; + } + + if (hash_payload->Payload.Hash.Data->Size != hash_size) + { + return false; + } + + //BinToStrEx(tmp1, sizeof(tmp1), hash_payload->Payload.Hash.Data->Buf, hash_size); + //BinToStrEx(tmp2, sizeof(tmp2), hash_data, hash_size); + + //Debug("IkeCompareHash\n 1: %s\n 2: %s\n", tmp1, tmp2); + + if (Cmp(hash_payload->Payload.Hash.Data->Buf, hash_data, hash_size) != 0) + { + return false; + } + + return true; +} + +// Parse the data payload +bool IkeParseDataPayload(IKE_PACKET_DATA_PAYLOAD *t, BUF *b) +{ + // Validate arguments + if (t == NULL || b == NULL) + { + return false; + } + + t->Data = MemToBuf(b->Buf, b->Size); + + return true; +} + +// Release the data payload +void IkeFreeDataPayload(IKE_PACKET_DATA_PAYLOAD *t) +{ + // Validate arguments + if (t == NULL) + { + return; + } + + FreeBuf(t->Data); +} + +// Release the IKE payload body +void IkeFreePayload(IKE_PACKET_PAYLOAD *p) +{ + // Validate arguments + if (p == NULL) + { + return; + } + + switch (p->PayloadType) + { + case IKE_PAYLOAD_SA: // SA payload + IkeFreeSaPayload(&p->Payload.Sa); + break; + + case IKE_PAYLOAD_PROPOSAL: // Proposal payload + IkeFreeProposalPayload(&p->Payload.Proposal); + break; + + case IKE_PAYLOAD_TRANSFORM: // Proposal payload + IkeFreeTransformPayload(&p->Payload.Transform); + break; + + case IKE_PAYLOAD_ID: // ID payload + IkeFreeIdPayload(&p->Payload.Id); + break; + + case IKE_PAYLOAD_CERT: // Certificate payload + IkeFreeCertPayload(&p->Payload.Cert); + break; + + case IKE_PAYLOAD_CERT_REQUEST: // Certificate request payload + IkeFreeCertRequestPayload(&p->Payload.CertRequest); + break; + + case IKE_PAYLOAD_NOTICE: // Notification Payload + IkeFreeNoticePayload(&p->Payload.Notice); + break; + + case IKE_PAYLOAD_DELETE: // Deletion payload + IkeFreeDeletePayload(&p->Payload.Delete); + break; + + case IKE_PAYLOAD_NAT_OA: // NAT-OD payload + case IKE_PAYLOAD_NAT_OA_DRAFT: + case IKE_PAYLOAD_NAT_OA_DRAFT_2: + // Do Nothing + break; + + case IKE_PAYLOAD_KEY_EXCHANGE: // Key exchange payload + case IKE_PAYLOAD_HASH: // Hash payload + case IKE_PAYLOAD_SIGN: // Signature payload + case IKE_PAYLOAD_RAND: // Random number payload + case IKE_PAYLOAD_VENDOR_ID: // Vendor ID payload + case IKE_PAYLOAD_NAT_D: // NAT-D payload + case IKE_PAYLOAD_NAT_D_DRAFT: // NAT-D payload (draft) + default: + IkeFreeDataPayload(&p->Payload.GeneralData); + break; + } + + if (p->BitArray != NULL) + { + FreeBuf(p->BitArray); + } + + Free(p); +} + +// Analyse the IKE payload list +LIST *IkeParsePayloadList(void *data, UINT size, UCHAR first_payload) +{ + return IkeParsePayloadListEx(data, size, first_payload, NULL); +} +LIST *IkeParsePayloadListEx(void *data, UINT size, UCHAR first_payload, UINT *total_read_size) +{ + LIST *o; + BUF *b; + UCHAR payload_type = first_payload; + UINT total = 0; + // Validate arguments + if (data == NULL) + { + return NULL; + } + + o = NewListFast(NULL); + b = MemToBuf(data, size); + + while (payload_type != IKE_PAYLOAD_NONE) + { + // Read the common header + IKE_COMMON_HEADER header; + USHORT payload_size; + BUF *payload_data; + IKE_PACKET_PAYLOAD *pay; + + if (ReadBuf(b, &header, sizeof(header)) != sizeof(header)) + { + Debug("ISAKMP: Broken Packet (Invalid Payload Size)\n"); + +LABEL_ERROR: + // Header reading failure + IkeFreePayloadList(o); + o = NULL; + + break; + } + + total += sizeof(header); + + // Get the payload size + payload_size = Endian16(header.PayloadSize); + + if (payload_size < sizeof(header)) + { + Debug("ISAKMP: Broken Packet (Invalid Payload Size)\n"); + goto LABEL_ERROR; + } + + payload_size -= sizeof(header); + + // Read the payload data + payload_data = ReadBufFromBuf(b, payload_size); + if (payload_data == NULL) + { + // Data read failure + Debug("ISAKMP: Broken Packet (Invalid Payload Data)\n"); + goto LABEL_ERROR; + } + + total += payload_size; + + // Analyse the payload body + if (IKE_IS_SUPPORTED_PAYLOAD_TYPE(payload_type)) + { + // Supported payload type + pay = IkeParsePayload(payload_type, payload_data); + + if (pay == NULL) + { + FreeBuf(payload_data); + Debug("ISAKMP: Broken Packet (Payload Data Parse Failed)\n"); + goto LABEL_ERROR; + } + + Add(o, pay); + } + else + { + // Unsupported payload type + Debug("ISAKMP: Ignored Payload Type: %u\n", payload_type); + pay = IkeParsePayload(payload_type, payload_data); + + if (pay == NULL) + { + FreeBuf(payload_data); + Debug("ISAKMP: Broken Packet (Payload Data Parse Failed)\n"); + goto LABEL_ERROR; + } + + Add(o, pay); + } + + payload_type = header.NextPayload; + + FreeBuf(payload_data); + } + + FreeBuf(b); + + if (total_read_size != NULL) + { + *total_read_size = total; + } + + return o; +} + +// Release the IKE payload list +void IkeFreePayloadList(LIST *o) +{ + UINT i; + // Validate arguments + if (o == NULL) + { + return; + } + + for (i = 0;i < LIST_NUM(o);i++) + { + IKE_PACKET_PAYLOAD *p = LIST_DATA(o, i); + + IkeFreePayload(p); + } + + ReleaseList(o); +} + +// Build an IKE packet +BUF *IkeBuild(IKE_PACKET *p, IKE_CRYPTO_PARAM *cparam) +{ + return IkeBuildEx(p, cparam, false); +} +BUF *IkeBuildEx(IKE_PACKET *p, IKE_CRYPTO_PARAM *cparam, bool use_original_decrypted) +{ + IKE_HEADER h; + BUF *msg_buf; + BUF *ret; + // Validate arguments + if (p == NULL) + { + return NULL; + } + + if (p->PayloadList == NULL) + { + return NULL; + } + + Zero(&h, sizeof(h)); + h.InitiatorCookie = Endian64(p->InitiatorCookie); + h.ResponderCookie = Endian64(p->ResponderCookie); + h.NextPayload = IkeGetFirstPayloadType(p->PayloadList); + h.Version = IKE_VERSION; + h.ExchangeType = p->ExchangeType; + h.Flag = (p->FlagEncrypted ? IKE_HEADER_FLAG_ENCRYPTED : 0) | + (p->FlagCommit ? IKE_HEADER_FLAG_COMMIT : 0) | + (p->FlagAuthOnly ? IKE_HEADER_FLAG_AUTH_ONLY : 0); + h.MessageId = Endian32(p->MessageId); + + if (p->DecryptedPayload != NULL && use_original_decrypted) + { + msg_buf = CloneBuf(p->DecryptedPayload); + } + else + { + msg_buf = IkeBuildPayloadList(p->PayloadList); + } + + if (p->DecryptedPayload != NULL) + { + FreeBuf(p->DecryptedPayload); + } + + p->DecryptedPayload = CloneBuf(msg_buf); + + if (p->FlagEncrypted) + { + BUF *b; + // Encryption + b = IkeEncryptWithPadding(msg_buf->Buf, msg_buf->Size, cparam); + + if (b == NULL) + { + Debug("ISAKMP: Packet Encrypt Failed\n"); + FreeBuf(msg_buf); + return NULL; + } + + FreeBuf(msg_buf); + + msg_buf = b; + } + + h.MessageSize = Endian32(msg_buf->Size + sizeof(h)); + + ret = NewBuf(); + WriteBuf(ret, &h, sizeof(h)); + WriteBufBuf(ret, msg_buf); + + FreeBuf(msg_buf); + + SeekBuf(ret, 0, 0); + + return ret; +} + +// Analyse the IKE packet +IKE_PACKET *IkeParseEx(void *data, UINT size, IKE_CRYPTO_PARAM *cparam, bool header_only) +{ + IKE_PACKET *p = NULL; + BUF *b; + // Validate arguments + if (data == NULL) + { + return NULL; + } + + b = MemToBuf(data, size); + + if (b->Size < sizeof(IKE_HEADER)) + { + Debug("ISAKMP: Invalid Packet Size\n"); + } + else + { + // Header analysis + IKE_HEADER *h = (IKE_HEADER *)b->Buf; + + p = ZeroMalloc(sizeof(IKE_PACKET)); + + p->MessageSize = Endian32(h->MessageSize); + p->InitiatorCookie = Endian64(h->InitiatorCookie); + p->ResponderCookie = Endian64(h->ResponderCookie); + p->ExchangeType = h->ExchangeType; + p->FlagEncrypted = (h->Flag & IKE_HEADER_FLAG_ENCRYPTED) ? true : false; + p->FlagCommit = (h->Flag & IKE_HEADER_FLAG_COMMIT) ? true : false; + p->FlagAuthOnly = (h->Flag & IKE_HEADER_FLAG_AUTH_ONLY) ? true : false; + p->MessageId = Endian32(h->MessageId); + + if (b->Size < Endian32(h->MessageSize) || + Endian32(h->MessageSize) < sizeof(IKE_HEADER)) + { + Debug("ISAKMP: Invalid Packet Size\n"); + + IkeFree(p); + p = NULL; + } + else + { + if (header_only == false) + { + bool ok = false; + UCHAR *payload_data; + UINT payload_size; + BUF *buf = NULL; + + payload_data = ((UCHAR *)h) + sizeof(IKE_HEADER); + payload_size = Endian32(h->MessageSize) - sizeof(IKE_HEADER); + + // Decrypt if it is encrypted + if (p->FlagEncrypted) + { + buf = IkeDecrypt(payload_data, payload_size, cparam); + + if (buf != NULL) + { + ok = true; + + payload_data = buf->Buf; + payload_size = buf->Size; + + p->DecryptedPayload = CloneBuf(buf); + } + } + else + { + ok = true; + } + + if (ok == false) + { + Debug("ISAKMP: Decrypt Failed\n"); + + IkeFree(p); + p = NULL; + } + else + { + UINT total_read_size; + + // Payload analysis + p->PayloadList = IkeParsePayloadListEx(payload_data, + payload_size, + h->NextPayload, + &total_read_size); + + if (p->DecryptedPayload != NULL) + { + p->DecryptedPayload->Size = MIN(p->DecryptedPayload->Size, total_read_size); + } + else + { + p->DecryptedPayload = MemToBuf(payload_data, payload_size); + } + } + + if (buf != NULL) + { + FreeBuf(buf); + } + } + } + } + + FreeBuf(b); + + return p; +} +IKE_PACKET *IkeParseHeader(void *data, UINT size, IKE_CRYPTO_PARAM *cparam) +{ + return IkeParseEx(data, size, cparam, true); +} +IKE_PACKET *IkeParse(void *data, UINT size, IKE_CRYPTO_PARAM *cparam) +{ + return IkeParseEx(data, size, cparam, false); +} + +// Send packet for debugging by UDP (For debugging with Ethereal) +void IkeDebugUdpSendRawPacket(IKE_PACKET *p) +{ + BUF *b; + IP ip; + SOCK *udp; + // Validate arguments + if (p == NULL) + { + return; + } + + p->FlagEncrypted = false; + + b = IkeBuildEx(p, NULL, true); + + if (b == NULL) + { + return; + } + + Zero(&ip, sizeof(ip)); + SetIP(&ip, 1, 2, 3, 4); + + udp = NewUDP(0); + + SendTo(udp, &ip, 500, b->Buf, b->Size); + + ReleaseSock(udp); + FreeBuf(b); +} + +// Output the payload list +void IkeDebugPrintPayloads(LIST *o, UINT depth) +{ + UINT i; + char space[MAX_SIZE]; + // Validate arguments + if (o == NULL) + { + return; + } + + MakeCharArray2(space, ' ', depth * 2); + + for (i = 0;i < LIST_NUM(o);i++) + { + IKE_PACKET_PAYLOAD *payload = LIST_DATA(o, i); + + Debug("%s%u: Type = %u, Size = %u\n", space, i, payload->PayloadType, payload->BitArray->Size); + + switch (payload->PayloadType) + { + case IKE_PAYLOAD_SA: + IkeDebugPrintPayloads(payload->Payload.Sa.PayloadList, depth + 1); + break; + + case IKE_PAYLOAD_PROPOSAL: + IkeDebugPrintPayloads(payload->Payload.Proposal.PayloadList, depth + 1); + break; + } + } +} + +// Encryption (also with padding) +BUF *IkeEncryptWithPadding(void *data, UINT size, IKE_CRYPTO_PARAM *cparam) +{ + UINT total_size; + UINT i; + UCHAR n = 0; + UCHAR *tmp; + BUF *ret; + UCHAR tmp1600[1600]; + bool no_free = false; + // Validate arguments + if (data == NULL || cparam == NULL) + { + return NULL; + } + + total_size = ((size / cparam->Key->Crypto->BlockSize) + ((size % cparam->Key->Crypto->BlockSize) == 0 ? 0 : 1)) + * cparam->Key->Crypto->BlockSize; + if (total_size == 0) + { + total_size = cparam->Key->Crypto->BlockSize; + } + + if (total_size > sizeof(tmp1600)) + { + tmp = Malloc(total_size); + } + else + { + tmp = tmp1600; + no_free = true; + } + + Copy(tmp, data, size); + + for (i = size;i < total_size;i++) + { + tmp[i] = ++n; + } + + ret = IkeEncrypt(tmp, total_size, cparam); + + if (no_free == false) + { + Free(tmp); + } + + return ret; +} + +// Encryption +BUF *IkeEncrypt(void *data, UINT size, IKE_CRYPTO_PARAM *cparam) +{ + void *tmp; + BUF *b; + UCHAR tmp1600[1600]; + bool no_free = false; + // Validate arguments + if (data == NULL || cparam == NULL) + { + return NULL; + } + + if ((size % cparam->Key->Crypto->BlockSize) != 0) + { + // Not an integral multiple of block size + return NULL; + } + + if (size > sizeof(tmp1600)) + { + tmp = Malloc(size); + } + else + { + tmp = tmp1600; + no_free = true; + } + + IkeCryptoEncrypt(cparam->Key, tmp, data, size, cparam->Iv); + + if (size >= cparam->Key->Crypto->BlockSize) + { + Copy(cparam->NextIv, ((UCHAR *)tmp) + (size - cparam->Key->Crypto->BlockSize), cparam->Key->Crypto->BlockSize); + } + else + { + Zero(cparam->NextIv, cparam->Key->Crypto->BlockSize); + } + + b = MemToBuf(tmp, size); + + if (no_free == false) + { + Free(tmp); + } + + return b; +} + +// Decryption +BUF *IkeDecrypt(void *data, UINT size, IKE_CRYPTO_PARAM *cparam) +{ + void *tmp; + BUF *b; + UCHAR tmp1600[1600]; + bool no_free = false; + // Validate arguments + if (data == NULL || cparam == NULL) + { + return NULL; + } + + if ((size % cparam->Key->Crypto->BlockSize) != 0) + { + // Not an integral multiple of block size + return NULL; + } + + if (size > sizeof(tmp1600)) + { + tmp = Malloc(size); + } + else + { + tmp = tmp1600; + no_free = true; + } + + IkeCryptoDecrypt(cparam->Key, tmp, data, size, cparam->Iv); + + if (size >= cparam->Key->Crypto->BlockSize) + { + Copy(cparam->NextIv, ((UCHAR *)data) + (size - cparam->Key->Crypto->BlockSize), cparam->Key->Crypto->BlockSize); + } + else + { + Zero(cparam->NextIv, cparam->Key->Crypto->BlockSize); + } + + b = MemToBuf(tmp, size); + + if (no_free == false) + { + Free(tmp); + } + + return b; +} + +// Release the IKE packet +void IkeFree(IKE_PACKET *p) +{ + // Validate arguments + if (p == NULL) + { + return; + } + + if (p->PayloadList != NULL) + { + IkeFreePayloadList(p->PayloadList); + } + + if (p->DecryptedPayload != NULL) + { + FreeBuf(p->DecryptedPayload); + } + + Free(p); +} + +// Create an IKE packet +IKE_PACKET *IkeNew(UINT64 init_cookie, UINT64 resp_cookie, UCHAR exchange_type, + bool encrypted, bool commit, bool auth_only, UINT msg_id, + LIST *payload_list) +{ + IKE_PACKET *p = ZeroMalloc(sizeof(IKE_PACKET)); + + p->InitiatorCookie = init_cookie; + p->ResponderCookie = resp_cookie; + p->ExchangeType = exchange_type; + p->FlagEncrypted = encrypted; + p->FlagCommit = commit; + p->FlagAuthOnly = auth_only; + p->MessageId = msg_id; + p->PayloadList = payload_list; + + return p; +} + +// Create an encryption engine for IKE +IKE_ENGINE *NewIkeEngine() +{ + IKE_ENGINE *e = ZeroMalloc(sizeof(IKE_ENGINE)); + IKE_CRYPTO *des, *des3, *aes; + IKE_HASH *sha1, *md5, *sha2_256, *sha2_384, *sha2_512; + IKE_DH *dh1, *dh2, *dh5, *dh2048, *dh3072, *dh4096; + UINT des_key_sizes[] = + { + 8, + }; + UINT des3_key_sizes[] = + { + 24, + }; + UINT aes_key_sizes[] = + { + 16, 24, 32, + }; + + e->CryptosList = NewListFast(NULL); + e->HashesList = NewListFast(NULL); + e->DhsList = NewListFast(NULL); + + //// Encryption algorithm + // DES + des = NewIkeCrypto(e, IKE_CRYPTO_DES_ID, IKE_CRYPTO_DES_STRING, + des_key_sizes, sizeof(des_key_sizes) / sizeof(UINT), 8); + + // 3DES + des3 = NewIkeCrypto(e, IKE_CRYPTO_3DES_ID, IKE_CRYPTO_3DES_STRING, + des3_key_sizes, sizeof(des3_key_sizes) / sizeof(UINT), 8); + + // AES + aes = NewIkeCrypto(e, IKE_CRYPTO_AES_ID, IKE_CRYPTO_AES_STRING, + aes_key_sizes, sizeof(aes_key_sizes) / sizeof(UINT), 16); + + //// Hash algorithm + // SHA-1 + sha1 = NewIkeHash(e, IKE_HASH_SHA1_ID, IKE_HASH_SHA1_STRING, 20); + + // SHA-2 + // sha2-256 + sha2_256 = NewIkeHash(e, IKE_HASH_SHA2_256_ID, IKE_HASH_SHA2_256_STRING, 32); + // sha2-384 + sha2_384 = NewIkeHash(e, IKE_HASH_SHA2_384_ID, IKE_HASH_SHA2_384_STRING, 48); + // sha2-512 + sha2_512 = NewIkeHash(e, IKE_HASH_SHA2_512_ID, IKE_HASH_SHA2_512_STRING, 64); + + // MD5 + md5 = NewIkeHash(e, IKE_HASH_MD5_ID, IKE_HASH_MD5_STRING, 16); + + //// DH algorithm + dh1 = NewIkeDh(e, IKE_DH_1_ID, IKE_DH_1_STRING, 96); + dh2 = NewIkeDh(e, IKE_DH_2_ID, IKE_DH_2_STRING, 128); + dh5 = NewIkeDh(e, IKE_DH_5_ID, IKE_DH_5_STRING, 192); + dh2048 = NewIkeDh(e, IKE_DH_2048_ID, IKE_DH_2048_STRING, 256); + dh3072 = NewIkeDh(e, IKE_DH_3072_ID, IKE_DH_3072_STRING, 384); + dh4096 = NewIkeDh(e, IKE_DH_4096_ID, IKE_DH_4096_STRING, 512); + + // Define the IKE algorithm + e->IkeCryptos[IKE_P1_CRYPTO_DES_CBC] = des; + e->IkeCryptos[IKE_P1_CRYPTO_3DES_CBC] = des3; + e->IkeCryptos[IKE_P1_CRYPTO_AES_CBC] = aes; + e->IkeHashes[IKE_P1_HASH_MD5] = md5; + e->IkeHashes[IKE_P1_HASH_SHA1] = sha1; + e->IkeHashes[IKE_P1_HASH_SHA2_256] = sha2_256; + e->IkeHashes[IKE_P1_HASH_SHA2_384] = sha2_384; + e->IkeHashes[IKE_P1_HASH_SHA2_512] = sha2_512; + + + // Definition of ESP algorithm + e->EspCryptos[IKE_TRANSFORM_ID_P2_ESP_DES] = des; + e->EspCryptos[IKE_TRANSFORM_ID_P2_ESP_3DES] = des3; + e->EspCryptos[IKE_TRANSFORM_ID_P2_ESP_AES] = aes; + e->EspHashes[IKE_P2_HMAC_MD5_96] = md5; + e->EspHashes[IKE_P2_HMAC_SHA1_96] = sha1; + + // Definition of the DH algorithm + e->IkeDhs[IKE_P1_DH_GROUP_768_MODP] = e->EspDhs[IKE_P2_DH_GROUP_768_MODP] = dh1; + e->IkeDhs[IKE_P1_DH_GROUP_1024_MODP] = e->EspDhs[IKE_P2_DH_GROUP_1024_MODP] = dh2; + e->IkeDhs[IKE_P1_DH_GROUP_1536_MODP] = e->EspDhs[IKE_P2_DH_GROUP_1536_MODP] = dh5; + e->IkeDhs[IKE_P1_DH_GROUP_2048_MODP] = e->EspDhs[IKE_P2_DH_GROUP_2048_MODP] = dh2048; + e->IkeDhs[IKE_P1_DH_GROUP_3072_MODP] = e->EspDhs[IKE_P2_DH_GROUP_3072_MODP] = dh3072; + e->IkeDhs[IKE_P1_DH_GROUP_4096_MODP] = e->EspDhs[IKE_P2_DH_GROUP_4096_MODP] = dh4096; + + return e; +} + +// Release the encryption engine for IKE +void FreeIkeEngine(IKE_ENGINE *e) +{ + UINT i; + // Validate arguments + if (e == NULL) + { + return; + } + + for (i = 0;i < LIST_NUM(e->CryptosList);i++) + { + IKE_CRYPTO *c = LIST_DATA(e->CryptosList, i); + + FreeIkeCrypto(c); + } + + ReleaseList(e->CryptosList); + + for (i = 0;i < LIST_NUM(e->HashesList);i++) + { + IKE_HASH *h = LIST_DATA(e->HashesList, i); + + FreeIkeHash(h); + } + ReleaseList(e->HashesList); + + for (i = 0;i < LIST_NUM(e->DhsList);i++) + { + IKE_DH *d = LIST_DATA(e->DhsList, i); + + FreeIkeDh(d); + } + ReleaseList(e->DhsList); + + Free(e); +} + +// Definition of a new DH algorithm for IKE +IKE_DH *NewIkeDh(IKE_ENGINE *e, UINT dh_id, char *name, UINT key_size) +{ + IKE_DH *d; + // Validate arguments + if (e == NULL || name == NULL || key_size == 0) + { + return NULL; + } + + d = ZeroMalloc(sizeof(IKE_DH)); + + d->DhId = dh_id; + d->Name = name; + d->KeySize = key_size; + + Add(e->DhsList, d); + + return d; +} + +// Definition of a new encryption algorithm for IKE +IKE_CRYPTO *NewIkeCrypto(IKE_ENGINE *e, UINT crypto_id, char *name, UINT *key_sizes, UINT num_key_sizes, UINT block_size) +{ + IKE_CRYPTO *c; + UINT i; + // Validate arguments + if (e == NULL || name == NULL || key_sizes == NULL) + { + return NULL; + } + + c = ZeroMalloc(sizeof(IKE_CRYPTO)); + + c->CryptoId = crypto_id; + c->Name = name; + + for (i = 0;i < MIN(num_key_sizes, 16);i++) + { + c->KeySizes[i] = key_sizes[i]; + } + + if (num_key_sizes >= 2) + { + c->VariableKeySize = true; + } + + c->BlockSize = block_size; + + Add(e->CryptosList, c); + + return c; +} + +// Release the definition of Encryption algorithm for IKE +void FreeIkeCrypto(IKE_CRYPTO *c) +{ + // Validate arguments + if (c == NULL) + { + return; + } + + Free(c); +} + +// Release the definition of IKE hash algorithm +void FreeIkeHash(IKE_HASH *h) +{ + // Validate arguments + if (h == NULL) + { + return; + } + + Free(h); +} + +// Release the definition of the DH algorithm for IKE +void FreeIkeDh(IKE_DH *d) +{ + // Validate arguments + if (d == NULL) + { + return; + } + + Free(d); +} + +// Definition of a new hash algorithm for IKE +IKE_HASH *NewIkeHash(IKE_ENGINE *e, UINT hash_id, char *name, UINT size) +{ + IKE_HASH *h; + // Validate arguments + if (e == NULL || name == NULL || size == 0) + { + return NULL; + } + + h = ZeroMalloc(sizeof(IKE_HASH)); + + h->HashId = hash_id; + h->Name = name; + h->HashSize = size; + + Add(e->HashesList, h); + + return h; +} + +// Get the encryption algorithm that is used in IKE +IKE_CRYPTO *GetIkeCrypto(IKE_ENGINE *e, bool for_esp, UINT i) +{ + // Validate arguments + if (e == NULL || i == 0 || i >= MAX_IKE_ENGINE_ELEMENTS) + { + return NULL; + } + + if (for_esp) + { + return e->EspCryptos[i]; + } + else + { + return e->IkeCryptos[i]; + } +} + +// Get the hash algorithm used in the IKE +IKE_HASH *GetIkeHash(IKE_ENGINE *e, bool for_esp, UINT i) +{ + // Validate arguments + if (e == NULL || i == 0 || i >= MAX_IKE_ENGINE_ELEMENTS) + { + return NULL; + } + + if (for_esp) + { + return e->EspHashes[i]; + } + else + { + return e->IkeHashes[i]; + } +} + +// Get the DH algorithm used in the IKE +IKE_DH *GetIkeDh(IKE_ENGINE *e, bool for_esp, UINT i) +{ + // Validate arguments + if (e == NULL || i == 0 || i >= MAX_IKE_ENGINE_ELEMENTS) + { + return NULL; + } + + if (for_esp) + { + return e->EspDhs[i]; + } + else + { + return e->IkeDhs[i]; + } +} + +// Perform encryption +void IkeCryptoEncrypt(IKE_CRYPTO_KEY *k, void *dst, void *src, UINT size, void *ivec) +{ + // Validate arguments + if (k == NULL || dst == NULL || src == NULL || size == 0 || ivec == NULL) + { + Zero(dst, size); + return; + } + + if ((size % k->Crypto->BlockSize) != 0) + { + Zero(dst, size); + return; + } + + switch (k->Crypto->CryptoId) + { + case IKE_CRYPTO_DES_ID: // DES + DesEncrypt(dst, src, size, k->DesKey1, ivec); + break; + + case IKE_CRYPTO_3DES_ID: // 3DES + Des3Encrypt2(dst, src, size, k->DesKey1, k->DesKey2, k->DesKey3, ivec); + break; + + case IKE_CRYPTO_AES_ID: // AES + AesEncrypt(dst, src, size, k->AesKey, ivec); + break; + + default: + // Unknown + Zero(dst, size); + break; + } +} + +// Perform decryption +void IkeCryptoDecrypt(IKE_CRYPTO_KEY *k, void *dst, void *src, UINT size, void *ivec) +{ + // Validate arguments + if (k == NULL || dst == NULL || src == NULL || size == 0 || ivec == NULL) + { + Zero(dst, size); + return; + } + + if ((size % k->Crypto->BlockSize) != 0) + { + Zero(dst, size); + return; + } + + switch (k->Crypto->CryptoId) + { + case IKE_CRYPTO_DES_ID: // DES + DesDecrypt(dst, src, size, k->DesKey1, ivec); + break; + + case IKE_CRYPTO_3DES_ID: // 3DES + Des3Decrypt2(dst, src, size, k->DesKey1, k->DesKey2, k->DesKey3, ivec); + break; + + case IKE_CRYPTO_AES_ID: // AES + AesDecrypt(dst, src, size, k->AesKey, ivec); + break; + + default: + // Unknown + Zero(dst, size); + break; + } +} + +// Calculate a hash +void IkeHash(IKE_HASH *h, void *dst, void *src, UINT size) +{ + // Validate arguments + if (h == NULL || dst == NULL || (size != 0 && src == NULL)) + { + Zero(dst, size); + return; + } + + switch (h->HashId) + { + case IKE_HASH_MD5_ID: + // MD5 + Md5(dst, src, size); + break; + + case IKE_HASH_SHA1_ID: + // SHA-1 + Sha1(dst, src, size); + break; + case IKE_HASH_SHA2_256_ID: + Sha2_256(dst, src, size); + break; + case IKE_HASH_SHA2_384_ID: + Sha2_384(dst, src, size); + break; + case IKE_HASH_SHA2_512_ID: + Sha2_512(dst, src, size); + break; + + default: + // Unknown + Zero(dst, size); + break; + } +} + +// Calculation of HMAC +void IkeHMac(IKE_HASH *h, void *dst, void *key, UINT key_size, void *data, UINT data_size) +{ + MD *md = NULL; + + switch (h->HashId) + { + case IKE_HASH_MD5_ID: + md = NewMd("MD5"); + break; + case IKE_HASH_SHA1_ID: + md = NewMd("SHA1"); + break; + case IKE_HASH_SHA2_256_ID: + md = NewMd("SHA256"); + break; + case IKE_HASH_SHA2_384_ID: + md = NewMd("SHA384"); + break; + case IKE_HASH_SHA2_512_ID: + md = NewMd("SHA512"); + break; + } + + if (md == NULL) + { + Debug("IkeHMac(): The MD object is NULL! Either NewMd() failed or the current algorithm is not handled by the switch-case block.\n"); + return; + } + + if (SetMdKey(md, key, key_size) == false) + { + Debug("IkeHMac(): SetMdKey() failed!\n"); + goto cleanup; + } + + if (MdProcess(md, dst, data, data_size) == 0) + { + Debug("IkeHMac(): MdProcess() returned 0!\n"); + } + +cleanup: + FreeMd(md); +} + +void IkeHMacBuf(IKE_HASH *h, void *dst, BUF *key, BUF *data) +{ + // Validate arguments + if (h == NULL || dst == NULL || key == NULL || data == NULL) + { + return; + } + + IkeHMac(h, dst, key->Buf, key->Size, data->Buf, data->Size); +} + +// Check whether the key size is valid +bool IkeCheckKeySize(IKE_CRYPTO *c, UINT size) +{ + bool ok = false; + UINT i; + // Validate arguments + if (c == NULL || size == 0) + { + return false; + } + + for (i = 0;i < sizeof(c->KeySizes) / sizeof(UINT);i++) + { + if (c->KeySizes[i] == size) + { + ok = true; + break; + } + } + + return ok; +} + +// Create a key +IKE_CRYPTO_KEY *IkeNewKey(IKE_CRYPTO *c, void *data, UINT size) +{ + IKE_CRYPTO_KEY *k; + // Validate arguments + if (c == NULL || data == NULL || size == 0) + { + return NULL; + } + + if (IkeCheckKeySize(c, size) == false) + { + return NULL; + } + + k = ZeroMalloc(sizeof(IKE_CRYPTO_KEY)); + k->Crypto = c; + k->Data = Clone(data, size); + k->Size = size; + + switch (k->Crypto->CryptoId) + { + case IKE_CRYPTO_DES_ID: + // DES 64bit key + k->DesKey1 = DesNewKeyValue(data); + break; + + case IKE_CRYPTO_3DES_ID: + // 3DES 192bit key + k->DesKey1 = DesNewKeyValue(((UCHAR *)data) + DES_KEY_SIZE * 0); + k->DesKey2 = DesNewKeyValue(((UCHAR *)data) + DES_KEY_SIZE * 1); + k->DesKey3 = DesNewKeyValue(((UCHAR *)data) + DES_KEY_SIZE * 2); + break; + + case IKE_CRYPTO_AES_ID: + // AES variable length key + k->AesKey = AesNewKey(data, size); + break; + } + + return k; +} + +// Release the key +void IkeFreeKey(IKE_CRYPTO_KEY *k) +{ + // Validate arguments + if (k == NULL) + { + return; + } + + DesFreeKeyValue(k->DesKey1); + DesFreeKeyValue(k->DesKey2); + DesFreeKeyValue(k->DesKey3); + + AesFreeKey(k->AesKey); + + Free(k->Data); + + Free(k); +} + +// Create a DH object +DH_CTX *IkeDhNewCtx(IKE_DH *d) +{ + // Validate arguments + if (d == NULL) + { + return NULL; + } + + switch (d->DhId) + { + case IKE_DH_1_ID: + return DhNewGroup1(); + + case IKE_DH_2_ID: + return DhNewGroup2(); + + case IKE_DH_5_ID: + return DhNewGroup5(); + + case IKE_DH_2048_ID: + return DhNew2048(); + + case IKE_DH_3072_ID: + return DhNew3072(); + + case IKE_DH_4096_ID: + return DhNew4096(); + } + + return NULL; +} + +// Release the DH object +void IkeDhFreeCtx(DH_CTX *dh) +{ + // Validate arguments + if (dh == NULL) + { + return; + } + + DhFree(dh); +} + + + + + diff --git a/src/Cedar/Proto_IkePacket.h b/src/Cedar/Proto_IkePacket.h index c02bba32..afda0690 100644 --- a/src/Cedar/Proto_IkePacket.h +++ b/src/Cedar/Proto_IkePacket.h @@ -1,654 +1,654 @@ -// SoftEther VPN Source Code - Developer Edition Master Branch -// Cedar Communication Module - - -// Proto_IkePacket.h -// Header of Proto_IkePacket.c - -#ifndef PROTO_IKEPACKET_H -#define PROTO_IKEPACKET_H - -// Constants -#ifdef OS_WIN32 -#pragma pack(push, 1) -#endif // OS_WIN32 - -// Maximum hash size -#define IKE_MAX_HASH_SIZE 64 // Size of SHA-2-512 is the maximum for now - -// Maximum block size -#define IKE_MAX_BLOCK_SIZE 16 // Size of AES is maximum at the moment - -// Maximum key size -#define IKE_MAX_KEY_SIZE 32 // Size of AES-256 is the maximum for now - -// IKE version -#define IKE_VERSION 0x10 // 1.0 - -// IKE payload type -#define IKE_PAYLOAD_NONE 0 // No payload -#define IKE_PAYLOAD_SA 1 // SA payload -#define IKE_PAYLOAD_PROPOSAL 2 // Proposal payload -#define IKE_PAYLOAD_TRANSFORM 3 // Transform payload -#define IKE_PAYLOAD_KEY_EXCHANGE 4 // Key exchange payload -#define IKE_PAYLOAD_ID 5 // ID payload -#define IKE_PAYLOAD_CERT 6 // Certificate payload -#define IKE_PAYLOAD_CERT_REQUEST 7 // Certificate request payload -#define IKE_PAYLOAD_HASH 8 // Hash payload -#define IKE_PAYLOAD_SIGN 9 // Signature payload -#define IKE_PAYLOAD_RAND 10 // Random number payload -#define IKE_PAYLOAD_NOTICE 11 // Notification Payload -#define IKE_PAYLOAD_DELETE 12 // Deletion payload -#define IKE_PAYLOAD_VENDOR_ID 13 // Vendor ID payload -#define IKE_PAYLOAD_NAT_D 20 // NAT-D payload -#define IKE_PAYLOAD_NAT_OA 21 // NAT-OA payload -#define IKE_PAYLOAD_NAT_D_DRAFT 130 // NAT-D payload draft -#define IKE_PAYLOAD_NAT_OA_DRAFT 16 // NAT-OA payload draft -#define IKE_PAYLOAD_NAT_OA_DRAFT_2 131 // NAT-OA payload draft 2 - -// Macro to check whether the payload type is supported -#define IKE_IS_SUPPORTED_PAYLOAD_TYPE(i) ((((i) >= IKE_PAYLOAD_SA) && ((i) <= IKE_PAYLOAD_VENDOR_ID)) || ((i) == IKE_PAYLOAD_NAT_D) || ((i) == IKE_PAYLOAD_NAT_OA) || ((i) == IKE_PAYLOAD_NAT_OA_DRAFT) || ((i) == IKE_PAYLOAD_NAT_OA_DRAFT_2) || ((i) == IKE_PAYLOAD_NAT_D_DRAFT)) - -// IKE header flag -#define IKE_HEADER_FLAG_ENCRYPTED 1 // Encryption -#define IKE_HEADER_FLAG_COMMIT 2 // Commit -#define IKE_HEADER_FLAG_AUTH_ONLY 4 // Only authentication - -// IKE payload common header -struct IKE_COMMON_HEADER -{ - UCHAR NextPayload; - UCHAR Reserved; - USHORT PayloadSize; -} GCC_PACKED; - -// IKE SA payload header -struct IKE_SA_HEADER -{ - UINT DoI; // DOI value - UINT Situation; // Situation value -} GCC_PACKED; - -// DOI value in the IKE SA payload -#define IKE_SA_DOI_IPSEC 1 // IPsec - -// Situation value in the IKE SA payload -#define IKE_SA_SITUATION_IDENTITY 1 // Only authentication - -// IKE proposal payload header -struct IKE_PROPOSAL_HEADER -{ - UCHAR Number; // Number - UCHAR ProtocolId; // Protocol ID - UCHAR SpiSize; // Length of SPI - UCHAR NumTransforms; // Transform number -} GCC_PACKED; - -// Protocol ID in the IKE proposal payload header -#define IKE_PROTOCOL_ID_IKE 1 // IKE -#define IKE_PROTOCOL_ID_IPSEC_AH 2 // AH -#define IKE_PROTOCOL_ID_IPSEC_ESP 3 // ESP -#define IKE_PROTOCOL_ID_IPV4 4 // IP -#define IKE_PROTOCOL_ID_IPV6 41 // IPv6 - -// IKE transform payload header -struct IKE_TRANSFORM_HEADER -{ - UCHAR Number; // Number - UCHAR TransformId; // Transform ID - USHORT Reserved; // Reserved -} GCC_PACKED; - -// Transform ID (Phase 1) in IKE transform payload header -#define IKE_TRANSFORM_ID_P1_KEY_IKE 1 // IKE - -// Transform ID (Phase 2) in IKE transform payload header -#define IKE_TRANSFORM_ID_P2_ESP_DES 2 // DES-CBC -#define IKE_TRANSFORM_ID_P2_ESP_3DES 3 // 3DES-CBC -#define IKE_TRANSFORM_ID_P2_ESP_CAST 6 // CAST -#define IKE_TRANSFORM_ID_P2_ESP_BLOWFISH 7 // BLOWFISH -#define IKE_TRANSFORM_ID_P2_ESP_AES 12 // AES - -// IKE transform value (fixed length) -struct IKE_TRANSFORM_VALUE -{ - UCHAR AfBit; // AF bit (0: Fixed length, 1: Variable length) - UCHAR Type; // Type - USHORT Value; // Value data (16bit) -} GCC_PACKED; - -// The Type value in IKE transform value (Phase 1) -// MUST BE LESS THAN "MAX_IKE_ENGINE_ELEMENTS" !!! -#define IKE_TRANSFORM_VALUE_P1_CRYPTO 1 // Encryption algorithm -#define IKE_TRANSFORM_VALUE_P1_HASH 2 // Hash algorithm -#define IKE_TRANSFORM_VALUE_P1_AUTH_METHOD 3 // Authentication method -#define IKE_TRANSFORM_VALUE_P1_DH_GROUP 4 // DH group number -#define IKE_TRANSFORM_VALUE_P1_LIFE_TYPE 11 // Expiration date type -#define IKE_TRANSFORM_VALUE_P1_LIFE_VALUE 12 // Expiration date -#define IKE_TRANSFORM_VALUE_P1_KET_SIZE 14 // Key size - -// The Type value in IKE transform values (Phase 2) -// MUST BE LESS THAN "MAX_IKE_ENGINE_ELEMENTS" !!! -#define IKE_TRANSFORM_VALUE_P2_LIFE_TYPE 1 // Expiration date type -#define IKE_TRANSFORM_VALUE_P2_LIFE_VALUE 2 // Expiration date -#define IKE_TRANSFORM_VALUE_P2_DH_GROUP 3 // DH group number -#define IKE_TRANSFORM_VALUE_P2_CAPSULE 4 // Encapsulation mode -#define IKE_TRANSFORM_VALUE_P2_HMAC 5 // HMAC algorithm -#define IKE_TRANSFORM_VALUE_P2_KEY_SIZE 6 // Key size - -// Phase 1: The encryption algorithm in the IKE transform value -// MUST BE LESS THAN "MAX_IKE_ENGINE_ELEMENTS" !!! -#define IKE_P1_CRYPTO_DES_CBC 1 -#define IKE_P1_CRYPTO_BLOWFISH 3 -#define IKE_P1_CRYPTO_3DES_CBC 5 -#define IKE_P1_CRYPTO_CAST_CBC 6 -#define IKE_P1_CRYPTO_AES_CBC 7 - -// Phase 1: The hash algorithm in IKE transform value -// MUST BE LESS THAN "MAX_IKE_ENGINE_ELEMENTS" !!! -#define IKE_P1_HASH_MD5 1 -#define IKE_P1_HASH_SHA1 2 -#define IKE_P1_HASH_SHA2_256 4 -#define IKE_P1_HASH_SHA2_384 5 -#define IKE_P1_HASH_SHA2_512 6 - -// Phase 1: The authentication method in the IKE transform value -// MUST BE LESS THAN "MAX_IKE_ENGINE_ELEMENTS" !!! -#define IKE_P1_AUTH_METHOD_PRESHAREDKEY 1 -#define IKE_P1_AUTH_METHOD_RSA_SIGN 3 - -// Phase 1: The DH group number in the IKE transform value -// MUST BE LESS THAN "MAX_IKE_ENGINE_ELEMENTS" !!! -#define IKE_P1_DH_GROUP_768_MODP 1 -#define IKE_P1_DH_GROUP_1024_MODP 2 -#define IKE_P1_DH_GROUP_1536_MODP 5 -#define IKE_P1_DH_GROUP_2048_MODP 14 -#define IKE_P1_DH_GROUP_3072_MODP 15 -#define IKE_P1_DH_GROUP_4096_MODP 16 - -// Phase 1: The expiration date type in IKE transform value -// MUST BE LESS THAN "MAX_IKE_ENGINE_ELEMENTS" !!! -#define IKE_P1_LIFE_TYPE_SECONDS 1 -#define IKE_P1_LIFE_TYPE_KILOBYTES 2 - -// Phase 2: The HMAC algorithm in IPsec transform value -// MUST BE LESS THAN "MAX_IKE_ENGINE_ELEMENTS" !!! -#define IKE_P2_HMAC_MD5_96 1 -#define IKE_P2_HMAC_SHA1_96 2 - -// Phase 2: The DH group number in the IPsec transform value -// MUST BE LESS THAN "MAX_IKE_ENGINE_ELEMENTS" !!! -#define IKE_P2_DH_GROUP_768_MODP 1 -#define IKE_P2_DH_GROUP_1024_MODP 2 -#define IKE_P2_DH_GROUP_1536_MODP 5 -#define IKE_P2_DH_GROUP_2048_MODP 14 -#define IKE_P2_DH_GROUP_3072_MODP 15 -#define IKE_P2_DH_GROUP_4096_MODP 16 - -// Phase 2: The encapsulation mode in IPsec transform value -#define IKE_P2_CAPSULE_TUNNEL 1 -#define IKE_P2_CAPSULE_TRANSPORT 2 -#define IKE_P2_CAPSULE_NAT_TUNNEL_1 3 -#define IKE_P2_CAPSULE_NAT_TUNNEL_2 61443 -#define IKE_P2_CAPSULE_NAT_TRANSPORT_1 4 -#define IKE_P2_CAPSULE_NAT_TRANSPORT_2 61444 - -// Phase 2: The expiration date type in IPsec transform value -#define IKE_P2_LIFE_TYPE_SECONDS 1 -#define IKE_P2_LIFE_TYPE_KILOBYTES 2 - - -// IKE ID payload header -struct IKE_ID_HEADER -{ - UCHAR IdType; // Type of ID - UCHAR ProtocolId; // Protocol ID - USHORT Port; // Port -} GCC_PACKED; - -// Type of ID in the IKE ID payload header -#define IKE_ID_IPV4_ADDR 1 // IPv4 address (32 bit) -#define IKE_ID_FQDN 2 // FQDN -#define IKE_ID_USER_FQDN 3 // User FQDN -#define IKE_ID_IPV4_ADDR_SUBNET 4 // IPv4 + subnet (64 bit) -#define IKE_ID_IPV6_ADDR 5 // IPv6 address (128 bit) -#define IKE_ID_IPV6_ADDR_SUBNET 6 // IPv6 + subnet (256 bit) -#define IKE_ID_DER_ASN1_DN 9 // X.500 Distinguished Name -#define IKE_ID_DER_ASN1_GN 10 // X.500 General Name -#define IKE_ID_KEY_ID 11 // Key - -// The protocol ID in the IKE ID payload -#define IKE_ID_PROTOCOL_UDP IP_PROTO_UDP // UDP - -// IKE certificate payload header -struct IKE_CERT_HEADER -{ - UCHAR CertType; // Certificate Type -} GCC_PACKED; - -// The certificate type in IKE certificate payload header -#define IKE_CERT_TYPE_X509 4 // X.509 certificate (for digital signature) - -// IKE certificate payload header -struct IKE_CERT_REQUEST_HEADER -{ - UCHAR CertType; // Certificate Type -} GCC_PACKED; - -// IKE notification payload header -struct IKE_NOTICE_HEADER -{ - UINT DoI; // DOI value - UCHAR ProtocolId; // Protocol ID - // Same to the protocol ID in the IKE proposal payload header - UCHAR SpiSize; // SPI size - USHORT MessageType; // Message type -} GCC_PACKED; - -// IKE Deletion payload header -struct IKE_DELETE_HEADER -{ - UINT DoI; // DOI value - UCHAR ProtocolId; // Protocol ID - // Same to the protocol ID in the IKE proposal payload header - UCHAR SpiSize; // SPI size - USHORT NumSpis; // SPI number -} GCC_PACKED; - -// IKE NAT-OA payload header -struct IKE_NAT_OA_HEADER -{ - UCHAR IdType; // Type of ID - UCHAR Reserved1; - USHORT Reserved2; -} GCC_PACKED; - - -#ifdef OS_WIN32 -#pragma pack(pop) -#endif // OS_WIN32 - - - -// -// IKE internal data structure -// - -// IKE packet SA payload -struct IKE_PACKET_SA_PAYLOAD -{ - LIST *PayloadList; // Proposal payload list -}; - -// IKE proposal packet payload -struct IKE_PACKET_PROPOSAL_PAYLOAD -{ - UCHAR Number; // Number - UCHAR ProtocolId; // Protocol ID - BUF *Spi; // SPI data - - LIST *PayloadList; // Payload list -}; - -// IKE packet transform payload -struct IKE_PACKET_TRANSFORM_PAYLOAD -{ - UCHAR Number; // Number - UCHAR TransformId; // Transform ID - - LIST *ValueList; // Value list -}; - -// IKE packet transform value -struct IKE_PACKET_TRANSFORM_VALUE -{ - UCHAR Type; // Type - UINT Value; // Value -}; - -// IKE generic data payload -struct IKE_PACKET_DATA_PAYLOAD -{ - BUF *Data; // Generic data -}; - -// IKE packet ID payload -struct IKE_PACKET_ID_PAYLOAD -{ - UCHAR Type; // Type - UCHAR ProtocolId; // Protocol ID - USHORT Port; // Port number - BUF *IdData; // ID data - char StrData[128]; // Data of the result of converting to a string -}; - -// IKE packet certificate payload -struct IKE_PACKET_CERT_PAYLOAD -{ - UCHAR CertType; // Certificate type - BUF *CertData; // Certificate data -}; - -// IKE packet certificate request payload -struct IKE_PACKET_CERT_REQUEST_PAYLOAD -{ - UCHAR CertType; // Certificate type - BUF *Data; // Request data -}; - -// IKE packet notification payload -struct IKE_PACKET_NOTICE_PAYLOAD -{ - UCHAR ProtocolId; // Protocol ID - USHORT MessageType; // Message type - BUF *Spi; // SPI data - BUF *MessageData; // Message data -}; - -// IKE notification message type -// Error -#define IKE_NOTICE_ERROR_INVALID_COOKIE 4 // Invalid cookie -#define IKE_NOTICE_ERROR_INVALID_EXCHANGE_TYPE 7 // Invalid exchange type -#define IKE_NOTICE_ERROR_INVALID_SPI 11 // Invalid SPI -#define IKE_NOTICE_ERROR_NO_PROPOSAL_CHOSEN 14 // There is nothing worth mentioning in the presented proposal - -// DPD -#define IKE_NOTICE_DPD_REQUEST 36136 // R-U-THERE -#define IKE_NOTICE_DPD_RESPONSE 36137 // R-U-THERE-ACK - - -// IKE packet deletion payload -struct IKE_PACKET_DELETE_PAYLOAD -{ - UCHAR ProtocolId; // Protocol ID - LIST *SpiList; // SPI list -}; - -// IKE NAT-OA payload -struct IKE_PACKET_NAT_OA_PAYLOAD -{ - IP IpAddress; // IP address -}; - -// IKE packet payload -struct IKE_PACKET_PAYLOAD -{ - UCHAR PayloadType; // Payload type - UCHAR Padding[3]; - BUF *BitArray; // Bit array - - union - { - IKE_PACKET_SA_PAYLOAD Sa; // SA payload - IKE_PACKET_PROPOSAL_PAYLOAD Proposal; // Proposal payload - IKE_PACKET_TRANSFORM_PAYLOAD Transform; // Transform payload - IKE_PACKET_DATA_PAYLOAD KeyExchange; // Key exchange payload - IKE_PACKET_ID_PAYLOAD Id; // ID payload - IKE_PACKET_CERT_PAYLOAD Cert; // Certificate payload - IKE_PACKET_CERT_REQUEST_PAYLOAD CertRequest; // Certificate request payload - IKE_PACKET_DATA_PAYLOAD Hash; // Hash payload - IKE_PACKET_DATA_PAYLOAD Sign; // Signature payload - IKE_PACKET_DATA_PAYLOAD Rand; // Random number payload - IKE_PACKET_NOTICE_PAYLOAD Notice; // Notification Payload - IKE_PACKET_DELETE_PAYLOAD Delete; // Deletion payload - IKE_PACKET_DATA_PAYLOAD VendorId; // Vendor ID payload - IKE_PACKET_NAT_OA_PAYLOAD NatOa; // NAT-OA payload - IKE_PACKET_DATA_PAYLOAD GeneralData; // Generic data payload - } Payload; -}; - -struct IKE_PACKET -{ - UINT64 InitiatorCookie; // Initiator cookie - UINT64 ResponderCookie; // Responder cookie - UCHAR ExchangeType; // Exchange type - bool FlagEncrypted; // Encryption flag - bool FlagCommit; // Commit flag - bool FlagAuthOnly; // Flag only authentication - UINT MessageId; // Message ID - LIST *PayloadList; // Payload list - BUF *DecryptedPayload; // Decrypted payload - UINT MessageSize; // Original size -}; - -// IKE P1 key set -struct IKE_P1_KEYSET -{ - BUF *SKEYID_d; // IPsec SA key - BUF *SKEYID_a; // IKE SA authentication key - BUF *SKEYID_e; // IKE SA encryption key -}; - -// Number and name of the encryption algorithm for IKE -#define IKE_CRYPTO_DES_ID 0 -#define IKE_CRYPTO_DES_STRING "DES-CBC" - -#define IKE_CRYPTO_3DES_ID 1 -#define IKE_CRYPTO_3DES_STRING "3DES-CBC" - -#define IKE_CRYPTO_AES_ID 2 -#define IKE_CRYPTO_AES_STRING "AES-CBC" - -#define IKE_CRYPTO_BLOWFISH_ID 3 -#define IKE_CRYPTO_BLOWFISH_STRING "Blowfish-CBC" - -#define IKE_CRYPTO_CAST_ID 4 -#define IKE_CRYPTO_CAST_STRING "CAST-128-CBC" - -// Number and name of the IKE hash algorithm -#define IKE_HASH_MD5_ID 0 -#define IKE_HASH_MD5_STRING "MD5" - -#define IKE_HASH_SHA1_ID 1 -#define IKE_HASH_SHA1_STRING "SHA-1" - -#define IKE_HASH_SHA2_256_ID 2 -#define IKE_HASH_SHA2_256_STRING "SHA-2-256" - -#define IKE_HASH_SHA2_384_ID 3 -#define IKE_HASH_SHA2_384_STRING "SHA-2-384" - -#define IKE_HASH_SHA2_512_ID 4 -#define IKE_HASH_SHA2_512_STRING "SHA-2-512" - -// Number and name of DH algorithm for IKE -#define IKE_DH_1_ID 0 -#define IKE_DH_1_STRING "MODP 768 (Group 1)" - -#define IKE_DH_2_ID 1 -#define IKE_DH_2_STRING "MODP 1024 (Group 2)" - -#define IKE_DH_5_ID 2 -#define IKE_DH_5_STRING "MODP 1536 (Group 5)" - -#define IKE_DH_2048_ID 14 -#define IKE_DH_2048_STRING "MODP 2048 (Group 14)" - -#define IKE_DH_3072_ID 15 -#define IKE_DH_3072_STRING "MODP 3072 (Group 15)" - -#define IKE_DH_4096_ID 16 -#define IKE_DH_4096_STRING "MODP 4096 (Group 16)" - - -// Encryption algorithm for IKE -struct IKE_CRYPTO -{ - UINT CryptoId; // ID - char *Name; // Name - UINT KeySizes[16]; // Key size candidate - UINT BlockSize; // Block size - bool VariableKeySize; // Whether the key size is variable -}; - -// IKE encryption key -struct IKE_CRYPTO_KEY -{ - IKE_CRYPTO *Crypto; - void *Data; // Key data - UINT Size; // Key size - - DES_KEY_VALUE *DesKey1, *DesKey2, *DesKey3; // DES key - AES_KEY_VALUE *AesKey; // AES key -}; - -// IKE hash algorithm -struct IKE_HASH -{ - UINT HashId; // ID - char *Name; // Name - UINT HashSize; // Output size -}; - -// DH algorithm for IKE -struct IKE_DH -{ - UINT DhId; // ID - char *Name; // Name - UINT KeySize; // Key size -}; - -#define MAX_IKE_ENGINE_ELEMENTS 64 - -// Encryption engine for IKE -struct IKE_ENGINE -{ - IKE_CRYPTO *IkeCryptos[MAX_IKE_ENGINE_ELEMENTS]; // Encryption algorithm list that is used in the IKE - IKE_HASH *IkeHashes[MAX_IKE_ENGINE_ELEMENTS]; // Hash algorithm list that is used in the IKE - IKE_DH *IkeDhs[MAX_IKE_ENGINE_ELEMENTS]; // DH algorithm list that is used in the IKE - - IKE_CRYPTO *EspCryptos[MAX_IKE_ENGINE_ELEMENTS]; // Encryption algorithm list that is used by ESP - IKE_HASH *EspHashes[MAX_IKE_ENGINE_ELEMENTS]; // Hash algorithm list that is used by ESP - IKE_DH *EspDhs[MAX_IKE_ENGINE_ELEMENTS]; // DH algorithm list that is used by ESP - - LIST *CryptosList; - LIST *HashesList; - LIST *DhsList; -}; - -// IKE encryption parameters -struct IKE_CRYPTO_PARAM -{ - IKE_CRYPTO_KEY *Key; // Key - UCHAR Iv[IKE_MAX_BLOCK_SIZE]; // IV - UCHAR NextIv[IKE_MAX_BLOCK_SIZE]; // IV to be used next -}; - - -// Function prototype -IKE_PACKET *IkeParseHeader(void *data, UINT size, IKE_CRYPTO_PARAM *cparam); -IKE_PACKET *IkeParse(void *data, UINT size, IKE_CRYPTO_PARAM *cparam); -IKE_PACKET *IkeParseEx(void *data, UINT size, IKE_CRYPTO_PARAM *cparam, bool header_only); -void IkeFree(IKE_PACKET *p); -IKE_PACKET *IkeNew(UINT64 init_cookie, UINT64 resp_cookie, UCHAR exchange_type, - bool encrypted, bool commit, bool auth_only, UINT msg_id, - LIST *payload_list); - -void IkeDebugPrintPayloads(LIST *o, UINT depth); -void IkeDebugUdpSendRawPacket(IKE_PACKET *p); - -BUF *IkeEncrypt(void *data, UINT size, IKE_CRYPTO_PARAM *cparam); -BUF *IkeEncryptWithPadding(void *data, UINT size, IKE_CRYPTO_PARAM *cparam); -BUF *IkeDecrypt(void *data, UINT size, IKE_CRYPTO_PARAM *cparam); - -LIST *IkeParsePayloadList(void *data, UINT size, UCHAR first_payload); -LIST *IkeParsePayloadListEx(void *data, UINT size, UCHAR first_payload, UINT *total_read_size); -void IkeFreePayloadList(LIST *o); -UINT IkeGetPayloadNum(LIST *o, UINT payload_type); -IKE_PACKET_PAYLOAD *IkeGetPayload(LIST *o, UINT payload_type, UINT index); - -IKE_PACKET_PAYLOAD *IkeParsePayload(UINT payload_type, BUF *b); -void IkeFreePayload(IKE_PACKET_PAYLOAD *p); -bool IkeParseDataPayload(IKE_PACKET_DATA_PAYLOAD *t, BUF *b); -void IkeFreeDataPayload(IKE_PACKET_DATA_PAYLOAD *t); -bool IkeParseSaPayload(IKE_PACKET_SA_PAYLOAD *t, BUF *b); -void IkeFreeSaPayload(IKE_PACKET_SA_PAYLOAD *t); -bool IkeParseProposalPayload(IKE_PACKET_PROPOSAL_PAYLOAD *t, BUF *b); -void IkeFreeProposalPayload(IKE_PACKET_PROPOSAL_PAYLOAD *t); -bool IkeParseTransformPayload(IKE_PACKET_TRANSFORM_PAYLOAD *t, BUF *b); -void IkeFreeTransformPayload(IKE_PACKET_TRANSFORM_PAYLOAD *t); -LIST *IkeParseTransformValueList(BUF *b); -void IkeFreeTransformValueList(LIST *o); -bool IkeParseIdPayload(IKE_PACKET_ID_PAYLOAD *t, BUF *b); -void IkeFreeIdPayload(IKE_PACKET_ID_PAYLOAD *t); -bool IkeParseCertPayload(IKE_PACKET_CERT_PAYLOAD *t, BUF *b); -void IkeFreeCertPayload(IKE_PACKET_CERT_PAYLOAD *t); -bool IkeParseCertRequestPayload(IKE_PACKET_CERT_REQUEST_PAYLOAD *t, BUF *b); -void IkeFreeCertRequestPayload(IKE_PACKET_CERT_REQUEST_PAYLOAD *t); -bool IkeParseNoticePayload(IKE_PACKET_NOTICE_PAYLOAD *t, BUF *b); -void IkeFreeNoticePayload(IKE_PACKET_NOTICE_PAYLOAD *t); -bool IkeParseDeletePayload(IKE_PACKET_DELETE_PAYLOAD *t, BUF *b); -void IkeFreeDeletePayload(IKE_PACKET_DELETE_PAYLOAD *t); -bool IkeParseNatOaPayload(IKE_PACKET_NAT_OA_PAYLOAD *t, BUF *b); - - -bool IkeCompareHash(IKE_PACKET_PAYLOAD *hash_payload, void *hash_data, UINT hash_size); - -IKE_PACKET_PAYLOAD *IkeNewPayload(UINT payload_type); -IKE_PACKET_PAYLOAD *IkeNewDataPayload(UCHAR payload_type, void *data, UINT size); -IKE_PACKET_PAYLOAD *IkeNewNatOaPayload(UCHAR payload_type, IP *ip); -IKE_PACKET_PAYLOAD *IkeNewSaPayload(LIST *payload_list); -IKE_PACKET_PAYLOAD *IkeNewProposalPayload(UCHAR number, UCHAR protocol_id, void *spi, UINT spi_size, LIST *payload_list); -IKE_PACKET_PAYLOAD *IkeNewTransformPayload(UCHAR number, UCHAR transform_id, LIST *value_list); -IKE_PACKET_TRANSFORM_VALUE *IkeNewTransformValue(UCHAR type, UINT value); -IKE_PACKET_PAYLOAD *IkeNewIdPayload(UCHAR id_type, UCHAR protocol_id, USHORT port, void *id_data, UINT id_size); -IKE_PACKET_PAYLOAD *IkeNewNoticePayload(UCHAR protocol_id, USHORT message_type, - void *spi, UINT spi_size, - void *message, UINT message_size); -IKE_PACKET_PAYLOAD *IkeNewDeletePayload(UCHAR protocol_id, LIST *spi_list); - -IKE_PACKET_PAYLOAD *IkeNewNoticeErrorInvalidCookiePayload(UINT64 init_cookie, UINT64 resp_cookie); -IKE_PACKET_PAYLOAD *IkeNewNoticeErrorInvalidSpiPayload(UINT spi); -IKE_PACKET_PAYLOAD *IkeNewNoticeErrorNoProposalChosenPayload(bool quick_mode, UINT64 init_cookie, UINT64 resp_cookie); -IKE_PACKET_PAYLOAD *IkeNewNoticeDpdPayload(bool ack, UINT64 init_cookie, UINT64 resp_cookie, UINT seq_no); - -UCHAR IkeGetFirstPayloadType(LIST *o); -BUF *IkeBuild(IKE_PACKET *p, IKE_CRYPTO_PARAM *cparam); -BUF *IkeBuildEx(IKE_PACKET *p, IKE_CRYPTO_PARAM *cparam, bool use_original_decrypted); -BUF *IkeBuildPayloadList(LIST *o); -BUF *IkeBuildPayload(IKE_PACKET_PAYLOAD *p); -BUF *IkeBuildDataPayload(IKE_PACKET_DATA_PAYLOAD *t); -BUF *IkeBuildSaPayload(IKE_PACKET_SA_PAYLOAD *t); -BUF *IkeBuildProposalPayload(IKE_PACKET_PROPOSAL_PAYLOAD *t); -BUF *IkeBuildTransformPayload(IKE_PACKET_TRANSFORM_PAYLOAD *t); -BUF *IkeBuildTransformValue(IKE_PACKET_TRANSFORM_VALUE *v); -BUF *IkeBuildTransformValueList(LIST *o); -BUF *IkeBuildIdPayload(IKE_PACKET_ID_PAYLOAD *t); -BUF *IkeBuildCertPayload(IKE_PACKET_CERT_PAYLOAD *t); -BUF *IkeBuildCertRequestPayload(IKE_PACKET_CERT_REQUEST_PAYLOAD *t); -BUF *IkeBuildNoticePayload(IKE_PACKET_NOTICE_PAYLOAD *t); -BUF *IkeBuildDeletePayload(IKE_PACKET_DELETE_PAYLOAD *t); - -BUF *IkeBuildTransformPayload(IKE_PACKET_TRANSFORM_PAYLOAD *t); -UINT IkeGetTransformValue(IKE_PACKET_TRANSFORM_PAYLOAD *t, UINT type, UINT index); -UINT IkeGetTransformValueNum(IKE_PACKET_TRANSFORM_PAYLOAD *t, UINT type); - -BUF *IkeStrToPassword(char *str); - -IKE_ENGINE *NewIkeEngine(); -IKE_CRYPTO *NewIkeCrypto(IKE_ENGINE *e, UINT crypto_id, char *name, UINT *key_sizes, UINT num_key_sizes, UINT block_size); -IKE_HASH *NewIkeHash(IKE_ENGINE *e, UINT hash_id, char *name, UINT size); -IKE_DH *NewIkeDh(IKE_ENGINE *e, UINT dh_id, char *name, UINT key_size); -void FreeIkeEngine(IKE_ENGINE *e); -void FreeIkeCrypto(IKE_CRYPTO *c); -void FreeIkeHash(IKE_HASH *h); -void FreeIkeDh(IKE_DH *d); -IKE_CRYPTO *GetIkeCrypto(IKE_ENGINE *e, bool for_esp, UINT i); -IKE_HASH *GetIkeHash(IKE_ENGINE *e, bool for_esp, UINT i); -IKE_DH *GetIkeDh(IKE_ENGINE *e, bool for_esp, UINT i); - -void IkeHash(IKE_HASH *h, void *dst, void *src, UINT size); -void IkeHMac(IKE_HASH *h, void *dst, void *key, UINT key_size, void *data, UINT data_size); -void IkeHMacBuf(IKE_HASH *h, void *dst, BUF *key, BUF *data); - -IKE_CRYPTO_KEY *IkeNewKey(IKE_CRYPTO *c, void *data, UINT size); -bool IkeCheckKeySize(IKE_CRYPTO *c, UINT size); -void IkeFreeKey(IKE_CRYPTO_KEY *k); -void IkeCryptoEncrypt(IKE_CRYPTO_KEY *k, void *dst, void *src, UINT size, void *ivec); -void IkeCryptoDecrypt(IKE_CRYPTO_KEY *k, void *dst, void *src, UINT size, void *ivec); - -DH_CTX *IkeDhNewCtx(IKE_DH *d); -void IkeDhFreeCtx(DH_CTX *dh); - - -#endif // PROTO_IKEPACKET_H +// SoftEther VPN Source Code - Developer Edition Master Branch +// Cedar Communication Module + + +// Proto_IkePacket.h +// Header of Proto_IkePacket.c + +#ifndef PROTO_IKEPACKET_H +#define PROTO_IKEPACKET_H + +// Constants +#ifdef OS_WIN32 +#pragma pack(push, 1) +#endif // OS_WIN32 + +// Maximum hash size +#define IKE_MAX_HASH_SIZE 64 // Size of SHA-2-512 is the maximum for now + +// Maximum block size +#define IKE_MAX_BLOCK_SIZE 16 // Size of AES is maximum at the moment + +// Maximum key size +#define IKE_MAX_KEY_SIZE 32 // Size of AES-256 is the maximum for now + +// IKE version +#define IKE_VERSION 0x10 // 1.0 + +// IKE payload type +#define IKE_PAYLOAD_NONE 0 // No payload +#define IKE_PAYLOAD_SA 1 // SA payload +#define IKE_PAYLOAD_PROPOSAL 2 // Proposal payload +#define IKE_PAYLOAD_TRANSFORM 3 // Transform payload +#define IKE_PAYLOAD_KEY_EXCHANGE 4 // Key exchange payload +#define IKE_PAYLOAD_ID 5 // ID payload +#define IKE_PAYLOAD_CERT 6 // Certificate payload +#define IKE_PAYLOAD_CERT_REQUEST 7 // Certificate request payload +#define IKE_PAYLOAD_HASH 8 // Hash payload +#define IKE_PAYLOAD_SIGN 9 // Signature payload +#define IKE_PAYLOAD_RAND 10 // Random number payload +#define IKE_PAYLOAD_NOTICE 11 // Notification Payload +#define IKE_PAYLOAD_DELETE 12 // Deletion payload +#define IKE_PAYLOAD_VENDOR_ID 13 // Vendor ID payload +#define IKE_PAYLOAD_NAT_D 20 // NAT-D payload +#define IKE_PAYLOAD_NAT_OA 21 // NAT-OA payload +#define IKE_PAYLOAD_NAT_D_DRAFT 130 // NAT-D payload draft +#define IKE_PAYLOAD_NAT_OA_DRAFT 16 // NAT-OA payload draft +#define IKE_PAYLOAD_NAT_OA_DRAFT_2 131 // NAT-OA payload draft 2 + +// Macro to check whether the payload type is supported +#define IKE_IS_SUPPORTED_PAYLOAD_TYPE(i) ((((i) >= IKE_PAYLOAD_SA) && ((i) <= IKE_PAYLOAD_VENDOR_ID)) || ((i) == IKE_PAYLOAD_NAT_D) || ((i) == IKE_PAYLOAD_NAT_OA) || ((i) == IKE_PAYLOAD_NAT_OA_DRAFT) || ((i) == IKE_PAYLOAD_NAT_OA_DRAFT_2) || ((i) == IKE_PAYLOAD_NAT_D_DRAFT)) + +// IKE header flag +#define IKE_HEADER_FLAG_ENCRYPTED 1 // Encryption +#define IKE_HEADER_FLAG_COMMIT 2 // Commit +#define IKE_HEADER_FLAG_AUTH_ONLY 4 // Only authentication + +// IKE payload common header +struct IKE_COMMON_HEADER +{ + UCHAR NextPayload; + UCHAR Reserved; + USHORT PayloadSize; +} GCC_PACKED; + +// IKE SA payload header +struct IKE_SA_HEADER +{ + UINT DoI; // DOI value + UINT Situation; // Situation value +} GCC_PACKED; + +// DOI value in the IKE SA payload +#define IKE_SA_DOI_IPSEC 1 // IPsec + +// Situation value in the IKE SA payload +#define IKE_SA_SITUATION_IDENTITY 1 // Only authentication + +// IKE proposal payload header +struct IKE_PROPOSAL_HEADER +{ + UCHAR Number; // Number + UCHAR ProtocolId; // Protocol ID + UCHAR SpiSize; // Length of SPI + UCHAR NumTransforms; // Transform number +} GCC_PACKED; + +// Protocol ID in the IKE proposal payload header +#define IKE_PROTOCOL_ID_IKE 1 // IKE +#define IKE_PROTOCOL_ID_IPSEC_AH 2 // AH +#define IKE_PROTOCOL_ID_IPSEC_ESP 3 // ESP +#define IKE_PROTOCOL_ID_IPV4 4 // IP +#define IKE_PROTOCOL_ID_IPV6 41 // IPv6 + +// IKE transform payload header +struct IKE_TRANSFORM_HEADER +{ + UCHAR Number; // Number + UCHAR TransformId; // Transform ID + USHORT Reserved; // Reserved +} GCC_PACKED; + +// Transform ID (Phase 1) in IKE transform payload header +#define IKE_TRANSFORM_ID_P1_KEY_IKE 1 // IKE + +// Transform ID (Phase 2) in IKE transform payload header +#define IKE_TRANSFORM_ID_P2_ESP_DES 2 // DES-CBC +#define IKE_TRANSFORM_ID_P2_ESP_3DES 3 // 3DES-CBC +#define IKE_TRANSFORM_ID_P2_ESP_CAST 6 // CAST +#define IKE_TRANSFORM_ID_P2_ESP_BLOWFISH 7 // BLOWFISH +#define IKE_TRANSFORM_ID_P2_ESP_AES 12 // AES + +// IKE transform value (fixed length) +struct IKE_TRANSFORM_VALUE +{ + UCHAR AfBit; // AF bit (0: Fixed length, 1: Variable length) + UCHAR Type; // Type + USHORT Value; // Value data (16bit) +} GCC_PACKED; + +// The Type value in IKE transform value (Phase 1) +// MUST BE LESS THAN "MAX_IKE_ENGINE_ELEMENTS" !!! +#define IKE_TRANSFORM_VALUE_P1_CRYPTO 1 // Encryption algorithm +#define IKE_TRANSFORM_VALUE_P1_HASH 2 // Hash algorithm +#define IKE_TRANSFORM_VALUE_P1_AUTH_METHOD 3 // Authentication method +#define IKE_TRANSFORM_VALUE_P1_DH_GROUP 4 // DH group number +#define IKE_TRANSFORM_VALUE_P1_LIFE_TYPE 11 // Expiration date type +#define IKE_TRANSFORM_VALUE_P1_LIFE_VALUE 12 // Expiration date +#define IKE_TRANSFORM_VALUE_P1_KET_SIZE 14 // Key size + +// The Type value in IKE transform values (Phase 2) +// MUST BE LESS THAN "MAX_IKE_ENGINE_ELEMENTS" !!! +#define IKE_TRANSFORM_VALUE_P2_LIFE_TYPE 1 // Expiration date type +#define IKE_TRANSFORM_VALUE_P2_LIFE_VALUE 2 // Expiration date +#define IKE_TRANSFORM_VALUE_P2_DH_GROUP 3 // DH group number +#define IKE_TRANSFORM_VALUE_P2_CAPSULE 4 // Encapsulation mode +#define IKE_TRANSFORM_VALUE_P2_HMAC 5 // HMAC algorithm +#define IKE_TRANSFORM_VALUE_P2_KEY_SIZE 6 // Key size + +// Phase 1: The encryption algorithm in the IKE transform value +// MUST BE LESS THAN "MAX_IKE_ENGINE_ELEMENTS" !!! +#define IKE_P1_CRYPTO_DES_CBC 1 +#define IKE_P1_CRYPTO_BLOWFISH 3 +#define IKE_P1_CRYPTO_3DES_CBC 5 +#define IKE_P1_CRYPTO_CAST_CBC 6 +#define IKE_P1_CRYPTO_AES_CBC 7 + +// Phase 1: The hash algorithm in IKE transform value +// MUST BE LESS THAN "MAX_IKE_ENGINE_ELEMENTS" !!! +#define IKE_P1_HASH_MD5 1 +#define IKE_P1_HASH_SHA1 2 +#define IKE_P1_HASH_SHA2_256 4 +#define IKE_P1_HASH_SHA2_384 5 +#define IKE_P1_HASH_SHA2_512 6 + +// Phase 1: The authentication method in the IKE transform value +// MUST BE LESS THAN "MAX_IKE_ENGINE_ELEMENTS" !!! +#define IKE_P1_AUTH_METHOD_PRESHAREDKEY 1 +#define IKE_P1_AUTH_METHOD_RSA_SIGN 3 + +// Phase 1: The DH group number in the IKE transform value +// MUST BE LESS THAN "MAX_IKE_ENGINE_ELEMENTS" !!! +#define IKE_P1_DH_GROUP_768_MODP 1 +#define IKE_P1_DH_GROUP_1024_MODP 2 +#define IKE_P1_DH_GROUP_1536_MODP 5 +#define IKE_P1_DH_GROUP_2048_MODP 14 +#define IKE_P1_DH_GROUP_3072_MODP 15 +#define IKE_P1_DH_GROUP_4096_MODP 16 + +// Phase 1: The expiration date type in IKE transform value +// MUST BE LESS THAN "MAX_IKE_ENGINE_ELEMENTS" !!! +#define IKE_P1_LIFE_TYPE_SECONDS 1 +#define IKE_P1_LIFE_TYPE_KILOBYTES 2 + +// Phase 2: The HMAC algorithm in IPsec transform value +// MUST BE LESS THAN "MAX_IKE_ENGINE_ELEMENTS" !!! +#define IKE_P2_HMAC_MD5_96 1 +#define IKE_P2_HMAC_SHA1_96 2 + +// Phase 2: The DH group number in the IPsec transform value +// MUST BE LESS THAN "MAX_IKE_ENGINE_ELEMENTS" !!! +#define IKE_P2_DH_GROUP_768_MODP 1 +#define IKE_P2_DH_GROUP_1024_MODP 2 +#define IKE_P2_DH_GROUP_1536_MODP 5 +#define IKE_P2_DH_GROUP_2048_MODP 14 +#define IKE_P2_DH_GROUP_3072_MODP 15 +#define IKE_P2_DH_GROUP_4096_MODP 16 + +// Phase 2: The encapsulation mode in IPsec transform value +#define IKE_P2_CAPSULE_TUNNEL 1 +#define IKE_P2_CAPSULE_TRANSPORT 2 +#define IKE_P2_CAPSULE_NAT_TUNNEL_1 3 +#define IKE_P2_CAPSULE_NAT_TUNNEL_2 61443 +#define IKE_P2_CAPSULE_NAT_TRANSPORT_1 4 +#define IKE_P2_CAPSULE_NAT_TRANSPORT_2 61444 + +// Phase 2: The expiration date type in IPsec transform value +#define IKE_P2_LIFE_TYPE_SECONDS 1 +#define IKE_P2_LIFE_TYPE_KILOBYTES 2 + + +// IKE ID payload header +struct IKE_ID_HEADER +{ + UCHAR IdType; // Type of ID + UCHAR ProtocolId; // Protocol ID + USHORT Port; // Port +} GCC_PACKED; + +// Type of ID in the IKE ID payload header +#define IKE_ID_IPV4_ADDR 1 // IPv4 address (32 bit) +#define IKE_ID_FQDN 2 // FQDN +#define IKE_ID_USER_FQDN 3 // User FQDN +#define IKE_ID_IPV4_ADDR_SUBNET 4 // IPv4 + subnet (64 bit) +#define IKE_ID_IPV6_ADDR 5 // IPv6 address (128 bit) +#define IKE_ID_IPV6_ADDR_SUBNET 6 // IPv6 + subnet (256 bit) +#define IKE_ID_DER_ASN1_DN 9 // X.500 Distinguished Name +#define IKE_ID_DER_ASN1_GN 10 // X.500 General Name +#define IKE_ID_KEY_ID 11 // Key + +// The protocol ID in the IKE ID payload +#define IKE_ID_PROTOCOL_UDP IP_PROTO_UDP // UDP + +// IKE certificate payload header +struct IKE_CERT_HEADER +{ + UCHAR CertType; // Certificate Type +} GCC_PACKED; + +// The certificate type in IKE certificate payload header +#define IKE_CERT_TYPE_X509 4 // X.509 certificate (for digital signature) + +// IKE certificate payload header +struct IKE_CERT_REQUEST_HEADER +{ + UCHAR CertType; // Certificate Type +} GCC_PACKED; + +// IKE notification payload header +struct IKE_NOTICE_HEADER +{ + UINT DoI; // DOI value + UCHAR ProtocolId; // Protocol ID + // Same to the protocol ID in the IKE proposal payload header + UCHAR SpiSize; // SPI size + USHORT MessageType; // Message type +} GCC_PACKED; + +// IKE Deletion payload header +struct IKE_DELETE_HEADER +{ + UINT DoI; // DOI value + UCHAR ProtocolId; // Protocol ID + // Same to the protocol ID in the IKE proposal payload header + UCHAR SpiSize; // SPI size + USHORT NumSpis; // SPI number +} GCC_PACKED; + +// IKE NAT-OA payload header +struct IKE_NAT_OA_HEADER +{ + UCHAR IdType; // Type of ID + UCHAR Reserved1; + USHORT Reserved2; +} GCC_PACKED; + + +#ifdef OS_WIN32 +#pragma pack(pop) +#endif // OS_WIN32 + + + +// +// IKE internal data structure +// + +// IKE packet SA payload +struct IKE_PACKET_SA_PAYLOAD +{ + LIST *PayloadList; // Proposal payload list +}; + +// IKE proposal packet payload +struct IKE_PACKET_PROPOSAL_PAYLOAD +{ + UCHAR Number; // Number + UCHAR ProtocolId; // Protocol ID + BUF *Spi; // SPI data + + LIST *PayloadList; // Payload list +}; + +// IKE packet transform payload +struct IKE_PACKET_TRANSFORM_PAYLOAD +{ + UCHAR Number; // Number + UCHAR TransformId; // Transform ID + + LIST *ValueList; // Value list +}; + +// IKE packet transform value +struct IKE_PACKET_TRANSFORM_VALUE +{ + UCHAR Type; // Type + UINT Value; // Value +}; + +// IKE generic data payload +struct IKE_PACKET_DATA_PAYLOAD +{ + BUF *Data; // Generic data +}; + +// IKE packet ID payload +struct IKE_PACKET_ID_PAYLOAD +{ + UCHAR Type; // Type + UCHAR ProtocolId; // Protocol ID + USHORT Port; // Port number + BUF *IdData; // ID data + char StrData[128]; // Data of the result of converting to a string +}; + +// IKE packet certificate payload +struct IKE_PACKET_CERT_PAYLOAD +{ + UCHAR CertType; // Certificate type + BUF *CertData; // Certificate data +}; + +// IKE packet certificate request payload +struct IKE_PACKET_CERT_REQUEST_PAYLOAD +{ + UCHAR CertType; // Certificate type + BUF *Data; // Request data +}; + +// IKE packet notification payload +struct IKE_PACKET_NOTICE_PAYLOAD +{ + UCHAR ProtocolId; // Protocol ID + USHORT MessageType; // Message type + BUF *Spi; // SPI data + BUF *MessageData; // Message data +}; + +// IKE notification message type +// Error +#define IKE_NOTICE_ERROR_INVALID_COOKIE 4 // Invalid cookie +#define IKE_NOTICE_ERROR_INVALID_EXCHANGE_TYPE 7 // Invalid exchange type +#define IKE_NOTICE_ERROR_INVALID_SPI 11 // Invalid SPI +#define IKE_NOTICE_ERROR_NO_PROPOSAL_CHOSEN 14 // There is nothing worth mentioning in the presented proposal + +// DPD +#define IKE_NOTICE_DPD_REQUEST 36136 // R-U-THERE +#define IKE_NOTICE_DPD_RESPONSE 36137 // R-U-THERE-ACK + + +// IKE packet deletion payload +struct IKE_PACKET_DELETE_PAYLOAD +{ + UCHAR ProtocolId; // Protocol ID + LIST *SpiList; // SPI list +}; + +// IKE NAT-OA payload +struct IKE_PACKET_NAT_OA_PAYLOAD +{ + IP IpAddress; // IP address +}; + +// IKE packet payload +struct IKE_PACKET_PAYLOAD +{ + UCHAR PayloadType; // Payload type + UCHAR Padding[3]; + BUF *BitArray; // Bit array + + union + { + IKE_PACKET_SA_PAYLOAD Sa; // SA payload + IKE_PACKET_PROPOSAL_PAYLOAD Proposal; // Proposal payload + IKE_PACKET_TRANSFORM_PAYLOAD Transform; // Transform payload + IKE_PACKET_DATA_PAYLOAD KeyExchange; // Key exchange payload + IKE_PACKET_ID_PAYLOAD Id; // ID payload + IKE_PACKET_CERT_PAYLOAD Cert; // Certificate payload + IKE_PACKET_CERT_REQUEST_PAYLOAD CertRequest; // Certificate request payload + IKE_PACKET_DATA_PAYLOAD Hash; // Hash payload + IKE_PACKET_DATA_PAYLOAD Sign; // Signature payload + IKE_PACKET_DATA_PAYLOAD Rand; // Random number payload + IKE_PACKET_NOTICE_PAYLOAD Notice; // Notification Payload + IKE_PACKET_DELETE_PAYLOAD Delete; // Deletion payload + IKE_PACKET_DATA_PAYLOAD VendorId; // Vendor ID payload + IKE_PACKET_NAT_OA_PAYLOAD NatOa; // NAT-OA payload + IKE_PACKET_DATA_PAYLOAD GeneralData; // Generic data payload + } Payload; +}; + +struct IKE_PACKET +{ + UINT64 InitiatorCookie; // Initiator cookie + UINT64 ResponderCookie; // Responder cookie + UCHAR ExchangeType; // Exchange type + bool FlagEncrypted; // Encryption flag + bool FlagCommit; // Commit flag + bool FlagAuthOnly; // Flag only authentication + UINT MessageId; // Message ID + LIST *PayloadList; // Payload list + BUF *DecryptedPayload; // Decrypted payload + UINT MessageSize; // Original size +}; + +// IKE P1 key set +struct IKE_P1_KEYSET +{ + BUF *SKEYID_d; // IPsec SA key + BUF *SKEYID_a; // IKE SA authentication key + BUF *SKEYID_e; // IKE SA encryption key +}; + +// Number and name of the encryption algorithm for IKE +#define IKE_CRYPTO_DES_ID 0 +#define IKE_CRYPTO_DES_STRING "DES-CBC" + +#define IKE_CRYPTO_3DES_ID 1 +#define IKE_CRYPTO_3DES_STRING "3DES-CBC" + +#define IKE_CRYPTO_AES_ID 2 +#define IKE_CRYPTO_AES_STRING "AES-CBC" + +#define IKE_CRYPTO_BLOWFISH_ID 3 +#define IKE_CRYPTO_BLOWFISH_STRING "Blowfish-CBC" + +#define IKE_CRYPTO_CAST_ID 4 +#define IKE_CRYPTO_CAST_STRING "CAST-128-CBC" + +// Number and name of the IKE hash algorithm +#define IKE_HASH_MD5_ID 0 +#define IKE_HASH_MD5_STRING "MD5" + +#define IKE_HASH_SHA1_ID 1 +#define IKE_HASH_SHA1_STRING "SHA-1" + +#define IKE_HASH_SHA2_256_ID 2 +#define IKE_HASH_SHA2_256_STRING "SHA-2-256" + +#define IKE_HASH_SHA2_384_ID 3 +#define IKE_HASH_SHA2_384_STRING "SHA-2-384" + +#define IKE_HASH_SHA2_512_ID 4 +#define IKE_HASH_SHA2_512_STRING "SHA-2-512" + +// Number and name of DH algorithm for IKE +#define IKE_DH_1_ID 0 +#define IKE_DH_1_STRING "MODP 768 (Group 1)" + +#define IKE_DH_2_ID 1 +#define IKE_DH_2_STRING "MODP 1024 (Group 2)" + +#define IKE_DH_5_ID 2 +#define IKE_DH_5_STRING "MODP 1536 (Group 5)" + +#define IKE_DH_2048_ID 14 +#define IKE_DH_2048_STRING "MODP 2048 (Group 14)" + +#define IKE_DH_3072_ID 15 +#define IKE_DH_3072_STRING "MODP 3072 (Group 15)" + +#define IKE_DH_4096_ID 16 +#define IKE_DH_4096_STRING "MODP 4096 (Group 16)" + + +// Encryption algorithm for IKE +struct IKE_CRYPTO +{ + UINT CryptoId; // ID + char *Name; // Name + UINT KeySizes[16]; // Key size candidate + UINT BlockSize; // Block size + bool VariableKeySize; // Whether the key size is variable +}; + +// IKE encryption key +struct IKE_CRYPTO_KEY +{ + IKE_CRYPTO *Crypto; + void *Data; // Key data + UINT Size; // Key size + + DES_KEY_VALUE *DesKey1, *DesKey2, *DesKey3; // DES key + AES_KEY_VALUE *AesKey; // AES key +}; + +// IKE hash algorithm +struct IKE_HASH +{ + UINT HashId; // ID + char *Name; // Name + UINT HashSize; // Output size +}; + +// DH algorithm for IKE +struct IKE_DH +{ + UINT DhId; // ID + char *Name; // Name + UINT KeySize; // Key size +}; + +#define MAX_IKE_ENGINE_ELEMENTS 64 + +// Encryption engine for IKE +struct IKE_ENGINE +{ + IKE_CRYPTO *IkeCryptos[MAX_IKE_ENGINE_ELEMENTS]; // Encryption algorithm list that is used in the IKE + IKE_HASH *IkeHashes[MAX_IKE_ENGINE_ELEMENTS]; // Hash algorithm list that is used in the IKE + IKE_DH *IkeDhs[MAX_IKE_ENGINE_ELEMENTS]; // DH algorithm list that is used in the IKE + + IKE_CRYPTO *EspCryptos[MAX_IKE_ENGINE_ELEMENTS]; // Encryption algorithm list that is used by ESP + IKE_HASH *EspHashes[MAX_IKE_ENGINE_ELEMENTS]; // Hash algorithm list that is used by ESP + IKE_DH *EspDhs[MAX_IKE_ENGINE_ELEMENTS]; // DH algorithm list that is used by ESP + + LIST *CryptosList; + LIST *HashesList; + LIST *DhsList; +}; + +// IKE encryption parameters +struct IKE_CRYPTO_PARAM +{ + IKE_CRYPTO_KEY *Key; // Key + UCHAR Iv[IKE_MAX_BLOCK_SIZE]; // IV + UCHAR NextIv[IKE_MAX_BLOCK_SIZE]; // IV to be used next +}; + + +// Function prototype +IKE_PACKET *IkeParseHeader(void *data, UINT size, IKE_CRYPTO_PARAM *cparam); +IKE_PACKET *IkeParse(void *data, UINT size, IKE_CRYPTO_PARAM *cparam); +IKE_PACKET *IkeParseEx(void *data, UINT size, IKE_CRYPTO_PARAM *cparam, bool header_only); +void IkeFree(IKE_PACKET *p); +IKE_PACKET *IkeNew(UINT64 init_cookie, UINT64 resp_cookie, UCHAR exchange_type, + bool encrypted, bool commit, bool auth_only, UINT msg_id, + LIST *payload_list); + +void IkeDebugPrintPayloads(LIST *o, UINT depth); +void IkeDebugUdpSendRawPacket(IKE_PACKET *p); + +BUF *IkeEncrypt(void *data, UINT size, IKE_CRYPTO_PARAM *cparam); +BUF *IkeEncryptWithPadding(void *data, UINT size, IKE_CRYPTO_PARAM *cparam); +BUF *IkeDecrypt(void *data, UINT size, IKE_CRYPTO_PARAM *cparam); + +LIST *IkeParsePayloadList(void *data, UINT size, UCHAR first_payload); +LIST *IkeParsePayloadListEx(void *data, UINT size, UCHAR first_payload, UINT *total_read_size); +void IkeFreePayloadList(LIST *o); +UINT IkeGetPayloadNum(LIST *o, UINT payload_type); +IKE_PACKET_PAYLOAD *IkeGetPayload(LIST *o, UINT payload_type, UINT index); + +IKE_PACKET_PAYLOAD *IkeParsePayload(UINT payload_type, BUF *b); +void IkeFreePayload(IKE_PACKET_PAYLOAD *p); +bool IkeParseDataPayload(IKE_PACKET_DATA_PAYLOAD *t, BUF *b); +void IkeFreeDataPayload(IKE_PACKET_DATA_PAYLOAD *t); +bool IkeParseSaPayload(IKE_PACKET_SA_PAYLOAD *t, BUF *b); +void IkeFreeSaPayload(IKE_PACKET_SA_PAYLOAD *t); +bool IkeParseProposalPayload(IKE_PACKET_PROPOSAL_PAYLOAD *t, BUF *b); +void IkeFreeProposalPayload(IKE_PACKET_PROPOSAL_PAYLOAD *t); +bool IkeParseTransformPayload(IKE_PACKET_TRANSFORM_PAYLOAD *t, BUF *b); +void IkeFreeTransformPayload(IKE_PACKET_TRANSFORM_PAYLOAD *t); +LIST *IkeParseTransformValueList(BUF *b); +void IkeFreeTransformValueList(LIST *o); +bool IkeParseIdPayload(IKE_PACKET_ID_PAYLOAD *t, BUF *b); +void IkeFreeIdPayload(IKE_PACKET_ID_PAYLOAD *t); +bool IkeParseCertPayload(IKE_PACKET_CERT_PAYLOAD *t, BUF *b); +void IkeFreeCertPayload(IKE_PACKET_CERT_PAYLOAD *t); +bool IkeParseCertRequestPayload(IKE_PACKET_CERT_REQUEST_PAYLOAD *t, BUF *b); +void IkeFreeCertRequestPayload(IKE_PACKET_CERT_REQUEST_PAYLOAD *t); +bool IkeParseNoticePayload(IKE_PACKET_NOTICE_PAYLOAD *t, BUF *b); +void IkeFreeNoticePayload(IKE_PACKET_NOTICE_PAYLOAD *t); +bool IkeParseDeletePayload(IKE_PACKET_DELETE_PAYLOAD *t, BUF *b); +void IkeFreeDeletePayload(IKE_PACKET_DELETE_PAYLOAD *t); +bool IkeParseNatOaPayload(IKE_PACKET_NAT_OA_PAYLOAD *t, BUF *b); + + +bool IkeCompareHash(IKE_PACKET_PAYLOAD *hash_payload, void *hash_data, UINT hash_size); + +IKE_PACKET_PAYLOAD *IkeNewPayload(UINT payload_type); +IKE_PACKET_PAYLOAD *IkeNewDataPayload(UCHAR payload_type, void *data, UINT size); +IKE_PACKET_PAYLOAD *IkeNewNatOaPayload(UCHAR payload_type, IP *ip); +IKE_PACKET_PAYLOAD *IkeNewSaPayload(LIST *payload_list); +IKE_PACKET_PAYLOAD *IkeNewProposalPayload(UCHAR number, UCHAR protocol_id, void *spi, UINT spi_size, LIST *payload_list); +IKE_PACKET_PAYLOAD *IkeNewTransformPayload(UCHAR number, UCHAR transform_id, LIST *value_list); +IKE_PACKET_TRANSFORM_VALUE *IkeNewTransformValue(UCHAR type, UINT value); +IKE_PACKET_PAYLOAD *IkeNewIdPayload(UCHAR id_type, UCHAR protocol_id, USHORT port, void *id_data, UINT id_size); +IKE_PACKET_PAYLOAD *IkeNewNoticePayload(UCHAR protocol_id, USHORT message_type, + void *spi, UINT spi_size, + void *message, UINT message_size); +IKE_PACKET_PAYLOAD *IkeNewDeletePayload(UCHAR protocol_id, LIST *spi_list); + +IKE_PACKET_PAYLOAD *IkeNewNoticeErrorInvalidCookiePayload(UINT64 init_cookie, UINT64 resp_cookie); +IKE_PACKET_PAYLOAD *IkeNewNoticeErrorInvalidSpiPayload(UINT spi); +IKE_PACKET_PAYLOAD *IkeNewNoticeErrorNoProposalChosenPayload(bool quick_mode, UINT64 init_cookie, UINT64 resp_cookie); +IKE_PACKET_PAYLOAD *IkeNewNoticeDpdPayload(bool ack, UINT64 init_cookie, UINT64 resp_cookie, UINT seq_no); + +UCHAR IkeGetFirstPayloadType(LIST *o); +BUF *IkeBuild(IKE_PACKET *p, IKE_CRYPTO_PARAM *cparam); +BUF *IkeBuildEx(IKE_PACKET *p, IKE_CRYPTO_PARAM *cparam, bool use_original_decrypted); +BUF *IkeBuildPayloadList(LIST *o); +BUF *IkeBuildPayload(IKE_PACKET_PAYLOAD *p); +BUF *IkeBuildDataPayload(IKE_PACKET_DATA_PAYLOAD *t); +BUF *IkeBuildSaPayload(IKE_PACKET_SA_PAYLOAD *t); +BUF *IkeBuildProposalPayload(IKE_PACKET_PROPOSAL_PAYLOAD *t); +BUF *IkeBuildTransformPayload(IKE_PACKET_TRANSFORM_PAYLOAD *t); +BUF *IkeBuildTransformValue(IKE_PACKET_TRANSFORM_VALUE *v); +BUF *IkeBuildTransformValueList(LIST *o); +BUF *IkeBuildIdPayload(IKE_PACKET_ID_PAYLOAD *t); +BUF *IkeBuildCertPayload(IKE_PACKET_CERT_PAYLOAD *t); +BUF *IkeBuildCertRequestPayload(IKE_PACKET_CERT_REQUEST_PAYLOAD *t); +BUF *IkeBuildNoticePayload(IKE_PACKET_NOTICE_PAYLOAD *t); +BUF *IkeBuildDeletePayload(IKE_PACKET_DELETE_PAYLOAD *t); + +BUF *IkeBuildTransformPayload(IKE_PACKET_TRANSFORM_PAYLOAD *t); +UINT IkeGetTransformValue(IKE_PACKET_TRANSFORM_PAYLOAD *t, UINT type, UINT index); +UINT IkeGetTransformValueNum(IKE_PACKET_TRANSFORM_PAYLOAD *t, UINT type); + +BUF *IkeStrToPassword(char *str); + +IKE_ENGINE *NewIkeEngine(); +IKE_CRYPTO *NewIkeCrypto(IKE_ENGINE *e, UINT crypto_id, char *name, UINT *key_sizes, UINT num_key_sizes, UINT block_size); +IKE_HASH *NewIkeHash(IKE_ENGINE *e, UINT hash_id, char *name, UINT size); +IKE_DH *NewIkeDh(IKE_ENGINE *e, UINT dh_id, char *name, UINT key_size); +void FreeIkeEngine(IKE_ENGINE *e); +void FreeIkeCrypto(IKE_CRYPTO *c); +void FreeIkeHash(IKE_HASH *h); +void FreeIkeDh(IKE_DH *d); +IKE_CRYPTO *GetIkeCrypto(IKE_ENGINE *e, bool for_esp, UINT i); +IKE_HASH *GetIkeHash(IKE_ENGINE *e, bool for_esp, UINT i); +IKE_DH *GetIkeDh(IKE_ENGINE *e, bool for_esp, UINT i); + +void IkeHash(IKE_HASH *h, void *dst, void *src, UINT size); +void IkeHMac(IKE_HASH *h, void *dst, void *key, UINT key_size, void *data, UINT data_size); +void IkeHMacBuf(IKE_HASH *h, void *dst, BUF *key, BUF *data); + +IKE_CRYPTO_KEY *IkeNewKey(IKE_CRYPTO *c, void *data, UINT size); +bool IkeCheckKeySize(IKE_CRYPTO *c, UINT size); +void IkeFreeKey(IKE_CRYPTO_KEY *k); +void IkeCryptoEncrypt(IKE_CRYPTO_KEY *k, void *dst, void *src, UINT size, void *ivec); +void IkeCryptoDecrypt(IKE_CRYPTO_KEY *k, void *dst, void *src, UINT size, void *ivec); + +DH_CTX *IkeDhNewCtx(IKE_DH *d); +void IkeDhFreeCtx(DH_CTX *dh); + + +#endif // PROTO_IKEPACKET_H diff --git a/src/Cedar/Proto_L2TP.c b/src/Cedar/Proto_L2TP.c index 6994777c..95c4fb6e 100644 --- a/src/Cedar/Proto_L2TP.c +++ b/src/Cedar/Proto_L2TP.c @@ -1,2627 +1,2627 @@ -// SoftEther VPN Source Code - Developer Edition Master Branch -// Cedar Communication Module - - -// Proto_L2TP.c -// L2TP protocol stack - -#include "CedarPch.h" - -// Release the L2TP AVP value -void FreeL2TPAVP(L2TP_AVP *a) -{ - // Validate arguments - if (a == NULL) - { - return; - } - - if (a->Data != NULL) - { - Free(a->Data); - } - - Free(a); -} - -// Release the L2TP packet -void FreeL2TPPacket(L2TP_PACKET *p) -{ - UINT i; - // Validate arguments - if (p == NULL) - { - return; - } - - if (p->AvpList != NULL) - { - for (i = 0;i < LIST_NUM(p->AvpList);i++) - { - L2TP_AVP *a = LIST_DATA(p->AvpList, i); - - FreeL2TPAVP(a); - } - - ReleaseList(p->AvpList); - } - - if (p->Data != NULL) - { - Free(p->Data); - } - - Free(p); -} - -// Send an L2TP control packet -void SendL2TPControlPacket(L2TP_SERVER *l2tp, L2TP_TUNNEL *t, UINT session_id, L2TP_PACKET *p) -{ - BUF *buf; - L2TP_QUEUE *q; - // Validate arguments - if (l2tp == NULL || t == NULL || p == NULL) - { - return; - } - - p->IsControl = true; - p->TunnelId = t->TunnelId1; - p->SessionId = session_id; - - p->Ns = t->NextNs; - t->NextNs++; - - p->Nr = t->LastNr + 1; - - buf = BuildL2TPPacketData(p, t); - - q = ZeroMalloc(sizeof(L2TP_QUEUE)); - q->Buf = buf; - q->Ns = p->Ns; - q->NextSendTick = l2tp->Now + (UINT64)L2TP_PACKET_RESEND_INTERVAL; - SendL2TPControlPacketMain(l2tp, t, q); - - L2TPAddInterrupt(l2tp, q->NextSendTick); - - Add(t->SendQueue, q); - -} - -// Specify the interrupt occurrence time of the next -void L2TPAddInterrupt(L2TP_SERVER *l2tp, UINT64 next_tick) -{ - // Validate arguments - if (l2tp == NULL || next_tick == 0) - { - return; - } - - AddInterrupt(l2tp->Interrupts, next_tick); -} - -// Send a L2TP data packet -void SendL2TPDataPacket(L2TP_SERVER *l2tp, L2TP_TUNNEL *t, L2TP_SESSION *s, void *data, UINT size) -{ - UDPPACKET *p; - UCHAR *buf; - UINT buf_size; - // Validate arguments - if (l2tp == NULL || t == NULL || s == NULL || (size != 0 && data == NULL)) - { - return; - } - - // Build a L2TP data packet - if (s->IsV3 == false) - { - // L2TP Ver 2 - buf_size = 8 + size; - buf = Malloc(buf_size); - buf[0] = 0x40; - buf[1] = 0x02; - - WRITE_USHORT(buf + 2, buf_size); - WRITE_USHORT(buf + 4, t->TunnelId1); - WRITE_USHORT(buf + 6, s->SessionId1); - - Copy(buf + 8, data, size); - - // Transmission - p = NewUdpPacket(&t->ServerIp, t->ServerPort, &t->ClientIp, t->ClientPort, buf, buf_size); - } - else - { - // L2TPv3 - if (t->IsYamahaV3 == false) - { - buf_size = 4 + size; - buf = Malloc(buf_size); - - WRITE_UINT(buf, s->SessionId1); - - Copy(buf + 4, data, size); - - // Transmission - p = NewUdpPacket(&t->ServerIp, IPSEC_PORT_L2TPV3_VIRTUAL, &t->ClientIp, IPSEC_PORT_L2TPV3_VIRTUAL, buf, buf_size); - } - else - { - UINT header = 0x00030000; - - buf_size = 8 + size; - buf = Malloc(buf_size); - - WRITE_UINT(buf, header); - WRITE_UINT(buf + 4, s->SessionId1); - - Copy(buf + 8, data, size); - - // Transmission - p = NewUdpPacket(&t->ServerIp, t->ServerPort, &t->ClientIp, t->ClientPort, buf, buf_size); - } - } - - L2TPSendUDP(l2tp, p); -} - -// L2TP packet transmission main -void SendL2TPControlPacketMain(L2TP_SERVER *l2tp, L2TP_TUNNEL *t, L2TP_QUEUE *q) -{ - UDPPACKET *p; - // Validate arguments - if (l2tp == NULL || t == NULL || q == NULL) - { - return; - } - - p = NewUdpPacket(&t->ServerIp, t->ServerPort, &t->ClientIp, t->ClientPort, - Clone(q->Buf->Buf, q->Buf->Size), q->Buf->Size); - - // Update the received sequence number - WRITE_USHORT(((UCHAR *)p->Data) + (p->SrcPort == IPSEC_PORT_L2TPV3_VIRTUAL ? 14 : 10), t->LastNr + 1); - - L2TPSendUDP(l2tp, p); -} - -// Send a UDP packet -void L2TPSendUDP(L2TP_SERVER *l2tp, UDPPACKET *p) -{ - // Validate arguments - if (l2tp == NULL || p == NULL) - { - return; - } - - Add(l2tp->SendPacketList, p); -} - -// Build a L2TP packet -BUF *BuildL2TPPacketData(L2TP_PACKET *pp, L2TP_TUNNEL *t) -{ - BUF *ret; - UCHAR c; - USHORT us; - UINT ui; - // Validate arguments - if (pp == NULL || t == NULL) - { - return NULL; - } - - ret = NewBuf(); - - c = 0; - - if (pp->Ver == 3) - { - if (pp->SessionId != 0) - { - // Add the Remote Session ID AVP - L2TP_AVP *a = GetAVPValue(pp, L2TP_AVP_TYPE_V3_SESSION_ID_REMOTE); - if (a == NULL || a->DataSize != sizeof(UINT)) - { - UINT ui = Endian32(pp->SessionId); - Add(pp->AvpList, NewAVP(L2TP_AVP_TYPE_V3_SESSION_ID_REMOTE, true, 0, &ui, sizeof(UINT))); - - if (GetAVPValueEx(pp, L2TPV3_CISCO_AVP_SESSION_ID_LOCAL, L2TP_AVP_VENDOR_ID_CISCO) != NULL) - { - Add(pp->AvpList, NewAVP(L2TPV3_CISCO_AVP_SESSION_ID_REMOTE, true, L2TP_AVP_VENDOR_ID_CISCO, &ui, sizeof(UINT))); - } - } - } - } - - if (pp->Ver == 3) - { - if (t->IsYamahaV3 == false) - { - // Zero as Session ID - ui = 0; - WriteBuf(ret, &ui, sizeof(UINT)); - } - } - - // Flags - if (pp->IsControl) - { - c |= L2TP_HEADER_BIT_TYPE; - c |= L2TP_HEADER_BIT_LENGTH; - c |= L2TP_HEADER_BIT_SEQUENCE; - } - else - { - c |= L2TP_HEADER_BIT_OFFSET; - } - - if (pp->IsControl == false && pp->Ver == 3 && t->IsYamahaV3) - { - c = 0; - } - - WriteBuf(ret, &c, 1); - - // Ver - c = 2; - if (pp->Ver == 3) - { - c = 3; - } - WriteBuf(ret, &c, 1); - - // Length - if (pp->IsControl) - { - us = 0; - WriteBuf(ret, &us, sizeof(USHORT)); - } - - // Reserved - if (pp->IsControl == false && pp->Ver == 3 && t->IsYamahaV3) - { - us = 0; - WriteBuf(ret, &us, sizeof(USHORT)); - } - - // Tunnel ID - if (pp->Ver != 3) - { - us = Endian16((USHORT)pp->TunnelId); - WriteBuf(ret, &us, sizeof(USHORT)); - } - else - { - ui = Endian32(pp->TunnelId); - WriteBuf(ret, &ui, sizeof(UINT)); - } - - // Session ID - if (pp->Ver != 3) - { - us = Endian16((USHORT)pp->SessionId); - WriteBuf(ret, &us, sizeof(USHORT)); - } - - if (pp->IsControl) - { - // Ns - us = Endian16(pp->Ns); - WriteBuf(ret, &us, sizeof(USHORT)); - - // Nr - us = Endian16(pp->Nr); - WriteBuf(ret, &us, sizeof(USHORT)); - } - else - { - if (!(pp->IsControl == false && pp->Ver == 3 && t->IsYamahaV3)) - { - // Offset Size = 0 - us = 0; - WriteBuf(ret, &us, sizeof(USHORT)); - } - } - - if (pp->IsControl) - { - // AVP - UINT i; - for (i = 0;i < LIST_NUM(pp->AvpList);i++) - { - L2TP_AVP *a = LIST_DATA(pp->AvpList, i); - - // Length and Flags - us = Endian16(a->DataSize + 6); - - if (a->Mandatory) - { - *((UCHAR *)&us) |= L2TP_AVP_BIT_MANDATORY; - } - - WriteBuf(ret, &us, sizeof(USHORT)); - - // Vendor ID - us = Endian16(a->VendorID); - WriteBuf(ret, &us, sizeof(USHORT)); - - // Type - us = Endian16(a->Type); - WriteBuf(ret, &us, sizeof(USHORT)); - - // Data - WriteBuf(ret, a->Data, a->DataSize); - } - } - else - { - // Payload - WriteBuf(ret, pp->Data, pp->DataSize); - } - - if (pp->IsControl) - { - // Update Length - bool l2tpv3_non_yamaha = ((pp->Ver == 3) && (t->IsYamahaV3 == false)); - WRITE_USHORT(((UCHAR *)ret->Buf) + 2 + (l2tpv3_non_yamaha ? sizeof(UINT) : 0), (USHORT)(ret->Size - (l2tpv3_non_yamaha ? sizeof(UINT) : 0))); - } - - SeekBuf(ret, 0, 0); - - return ret; -} - -// Parse the L2TP packet -L2TP_PACKET *ParseL2TPPacket(UDPPACKET *p) -{ - L2TP_PACKET *ret; - UCHAR *buf; - UINT size; - bool is_l2tpv3 = false; - bool is_l2tpv3_yamaha = false; - // Validate arguments - if (p == NULL) - { - return NULL; - } - - ret = ZeroMalloc(sizeof(L2TP_PACKET)); - - if (p->SrcPort == IPSEC_PORT_L2TPV3_VIRTUAL) - { - // L2TPv3 (Cisco) - is_l2tpv3 = true; - } - - buf = p->Data; - size = p->Size; - - if (size >= 2 && ((buf[1] & L2TP_HEADER_BIT_VER) == 3)) - { - if (p->SrcPort != IPSEC_PORT_L2TPV3_VIRTUAL) - { - // L2TPv3 (YAMAHA) - is_l2tpv3 = true; - is_l2tpv3_yamaha = true; - } - } - - if (is_l2tpv3 && (is_l2tpv3_yamaha == false)) - { - // L2TPv3 (Cisco) - UINT session_id; - if (size < 4) - { - goto LABEL_ERROR; - } - - session_id = READ_UINT(buf); - - if (session_id != 0) - { - // L2TPv3 data packet reception - ret->SessionId = session_id; - - buf += sizeof(UINT); - size -= sizeof(UINT); - - ret->Data = Clone(buf, size); - ret->DataSize = size; - - ret->Ver = 3; - - return ret; - } - else - { - // L2TPv3 control packet reception - buf += sizeof(UINT); - size -= sizeof(UINT); - } - } - - // L2TP - if (size < 6) - { - goto LABEL_ERROR; - } - - if (*buf & L2TP_HEADER_BIT_TYPE) - { - ret->IsControl = true; - } - - if (*buf & L2TP_HEADER_BIT_LENGTH) - { - ret->HasLength = true; - } - - if (*buf & L2TP_HEADER_BIT_SEQUENCE) - { - ret->HasSequence = true; - } - - if (is_l2tpv3 == false) - { - if (*buf & L2TP_HEADER_BIT_OFFSET) - { - ret->HasOffset = true; - } - - if (*buf & L2TP_HEADER_BIT_PRIORITY) - { - ret->IsPriority = true; - } - } - - buf++; - size--; - - ret->Ver = *buf & L2TP_HEADER_BIT_VER; - - buf++; - size--; - - if (is_l2tpv3 == false) - { - // L2TP - if (ret->Ver != 2) - { - goto LABEL_ERROR; - } - } - else - { - // L2TPv3 - if (ret->Ver != 3) - { - goto LABEL_ERROR; - } - } - - if (ret->IsControl) - { - if (ret->HasLength == false || ret->HasSequence == false) - { - goto LABEL_ERROR; - } - } - else - { - /*if (ret->HasSequence) - { - goto LABEL_ERROR; - }*/ - } - - if (ret->HasLength) - { - // Length - if (size < 2) - { - goto LABEL_ERROR; - } - ret->Length = READ_USHORT(buf); - buf += 2; - size -= 2; - - if (size < (ret->Length - 4)) - { - goto LABEL_ERROR; - } - - size = ret->Length - 4; - } - - if (is_l2tpv3) - { - if (p->SrcPort != IPSEC_PORT_L2TPV3_VIRTUAL) - { - if (ret->IsControl == false) - { - // Reserved - if (size < 2) - { - goto LABEL_ERROR; - } - - buf += 2; - size -= 2; - } - } - } - - // Tunnel ID, Session ID - if (size < 4) - { - goto LABEL_ERROR; - } - - if (is_l2tpv3 == false) - { - // L2TP - ret->TunnelId = READ_USHORT(buf); - buf += 2; - size -= 2; - - ret->SessionId = READ_USHORT(buf); - buf += 2; - size -= 2; - } - else - { - // L2TPv3: Only tunnel ID is written in the header - ret->TunnelId = READ_UINT(buf); - buf += 4; - size -= 4; - - // The session ID is not written in the header - ret->SessionId = 0; - - if (ret->IsControl == false) - { - ret->SessionId = ret->TunnelId; - } - } - - if (ret->HasSequence) - { - // Ns, Nr - if (size < 4) - { - goto LABEL_ERROR; - } - - ret->Ns = READ_USHORT(buf); - buf += 2; - size -= 2; - - ret->Nr = READ_USHORT(buf); - buf += 2; - size -= 2; - } - - if (ret->HasOffset) - { - // Offset - if (size < 2) - { - goto LABEL_ERROR; - } - - ret->OffsetSize = READ_USHORT(buf); - buf += 2; - size -= 2; - - if (size < ret->OffsetSize) - { - goto LABEL_ERROR; - } - - buf += ret->OffsetSize; - size -= ret->OffsetSize; - } - - ret->DataSize = size; - ret->Data = Clone(buf, ret->DataSize); - - if (ret->IsControl == false) - { - if (ret->DataSize == 0) - { - goto LABEL_ERROR; - } - } - - if (ret->IsControl) - { - if (ret->DataSize == 0) - { - ret->IsZLB = true; - } - } - - if (ret->IsControl) - { - ret->AvpList = NewListFast(NULL); - - // Parse the AVP field - while (size != 0) - { - L2TP_AVP a; - - Zero(&a, sizeof(a)); - - // Header - if (size < 6) - { - goto LABEL_ERROR; - } - - if (*buf & L2TP_AVP_BIT_MANDATORY) - { - a.Mandatory = true; - } - - if (*buf & L2TP_AVP_BIT_HIDDEN) - { - goto LABEL_ERROR; - } - - a.Length = READ_USHORT(buf) & L2TP_AVP_LENGTH; - - if (a.Length < 6) - { - goto LABEL_ERROR; - } - - buf += 2; - size -= 2; - - a.VendorID = READ_USHORT(buf); - buf += 2; - size -= 2; - - a.Type = READ_USHORT(buf); - buf += 2; - size -= 2; - - a.DataSize = a.Length - 6; - - if (a.DataSize > size) - { - goto LABEL_ERROR; - } - - a.Data = Clone(buf, a.DataSize); - - buf += a.DataSize; - size -= a.DataSize; - - Add(ret->AvpList, Clone(&a, sizeof(a))); - } - } - - if (ret->IsControl && ret->IsZLB == false) - { - // Get the MessageType in the case of Control packet - L2TP_AVP *a = GetAVPValue(ret, L2TP_AVP_TYPE_MESSAGE_TYPE); - if (a == NULL || a->DataSize != 2) - { - goto LABEL_ERROR; - } - - ret->MessageType = READ_USHORT(a->Data); - } - - if (ret->Ver == 3 && ret->IsControl) - { - // Get the Remote Session ID in the case of L2TPv3 - L2TP_AVP *a = GetAVPValue(ret, L2TP_AVP_TYPE_V3_SESSION_ID_REMOTE); - if (a != NULL && a->DataSize == sizeof(UINT)) - { - ret->SessionId = READ_UINT(a->Data); - } - } - - ret->IsYamahaV3 = is_l2tpv3_yamaha; - - return ret; - -LABEL_ERROR: - FreeL2TPPacket(ret); - return NULL; -} - -// Get the AVP value -L2TP_AVP *GetAVPValue(L2TP_PACKET *p, UINT type) -{ - return GetAVPValueEx(p, type, 0); -} -L2TP_AVP *GetAVPValueEx(L2TP_PACKET *p, UINT type, UINT vendor_id) -{ - UINT i; - // Validate arguments - if (p == NULL) - { - return NULL; - } - - for (i = 0;i < LIST_NUM(p->AvpList);i++) - { - L2TP_AVP *a = LIST_DATA(p->AvpList, i); - - if (a->Type == type && a->VendorID == vendor_id) - { - return a; - } - } - - if (vendor_id == 0) - { - if (type == L2TP_AVP_TYPE_V3_TUNNEL_ID) - { - return GetAVPValueEx(p, L2TPV3_CISCO_AVP_TUNNEL_ID, L2TP_AVP_VENDOR_ID_CISCO); - } - else if (type == L2TP_AVP_TYPE_V3_SESSION_ID_LOCAL) - { - return GetAVPValueEx(p, L2TPV3_CISCO_AVP_SESSION_ID_LOCAL, L2TP_AVP_VENDOR_ID_CISCO); - } - else if (type == L2TP_AVP_TYPE_V3_SESSION_ID_REMOTE) - { - return GetAVPValueEx(p, L2TPV3_CISCO_AVP_SESSION_ID_REMOTE, L2TP_AVP_VENDOR_ID_CISCO); - } - } - - return NULL; -} - -// Release the L2TP transmission queue -void FreeL2TPQueue(L2TP_QUEUE *q) -{ - // Validate arguments - if (q == NULL) - { - return; - } - - FreeBuf(q->Buf); - - FreeL2TPPacket(q->L2TPPacket); - - Free(q); -} - -// Sort function of L2TP reception queue -int CmpL2TPQueueForRecv(void *p1, void *p2) -{ - L2TP_QUEUE *q1, *q2; - // Validate arguments - if (p1 == NULL || p2 == NULL) - { - return 0; - } - q1 = *(L2TP_QUEUE **)p1; - q2 = *(L2TP_QUEUE **)p2; - if (q1 == NULL || q2 == NULL) - { - return 0; - } - - if (L2TP_SEQ_LT(q1->Ns, q2->Ns)) - { - return -1; - } - else if (q1->Ns == q2->Ns) - { - return 0; - } - else - { - return 1; - } -} - -// Create a L2TP tunnel -L2TP_TUNNEL *NewL2TPTunnel(L2TP_SERVER *l2tp, L2TP_PACKET *p, UDPPACKET *udp) -{ - L2TP_TUNNEL *t; - L2TP_AVP *a; - // Validate arguments - if (l2tp == NULL || p == NULL || udp == NULL) - { - return NULL; - } - - t = ZeroMalloc(sizeof(L2TP_TUNNEL)); - - if (p->Ver == 3) - { - t->IsV3 = true; - } - - t->SessionList = NewList(NULL); - - Copy(&t->ClientIp, &udp->SrcIP, sizeof(IP)); - t->ClientPort = udp->SrcPort; - - Copy(&t->ServerIp, &udp->DstIP, sizeof(IP)); - t->ServerPort = udp->DestPort; - - // Hostname - a = GetAVPValue(p, L2TP_AVP_TYPE_HOST_NAME); - if (a != NULL && a->DataSize >= 1 && a->DataSize < sizeof(t->HostName)) - { - Copy(t->HostName, a->Data, a->DataSize); - } - else - { - IPToStr(t->HostName, sizeof(t->HostName), &t->ClientIp); - } - - // Vendor Name - a = GetAVPValue(p, L2TP_AVP_TYPE_VENDOR_NAME); - if (a != NULL && a->DataSize >= 1 && a->DataSize < sizeof(t->VendorName)) - { - Copy(t->VendorName, a->Data, a->DataSize); - } - - // Assigned Tunnel ID - a = GetAVPValue(p, (p->Ver == 3 ? L2TP_AVP_TYPE_V3_TUNNEL_ID : L2TP_AVP_TYPE_ASSIGNED_TUNNEL)); - if (a == NULL || a->DataSize != (t->IsV3 ? sizeof(UINT) : sizeof(USHORT))) - { - goto LABEL_ERROR; - } - - t->TunnelId1 = (t->IsV3 ? READ_UINT(a->Data) : READ_USHORT(a->Data)); - t->TunnelId2 = GenerateNewTunnelIdEx(l2tp, &t->ClientIp, t->IsV3); - - if (t->TunnelId2 == 0) - { - goto LABEL_ERROR; - } - - if (p->Ver == 3) - { - // Identify whether it's Cisco - a = GetAVPValueEx(p, L2TPV3_CISCO_AVP_TUNNEL_ID, L2TP_AVP_VENDOR_ID_CISCO); - if (a != NULL) - { - t->IsCiscoV3 = true; - } - - // L2TPv3 on YAMAHA - t->IsYamahaV3 = p->IsYamahaV3; - } - - // Transmission queue - t->SendQueue = NewList(NULL); - - // Reception queue - t->RecvQueue = NewList(CmpL2TPQueueForRecv); - - t->LastRecvTick = l2tp->Now; - t->LastHelloSent = l2tp->Now; - - return t; - -LABEL_ERROR: - FreeL2TPTunnel(t); - return NULL; -} - -// Search a tunnel -L2TP_TUNNEL *GetTunnelFromId(L2TP_SERVER *l2tp, IP *client_ip, UINT tunnel_id, bool is_v3) -{ - UINT i; - // Validate arguments - if (l2tp == NULL || client_ip == 0 || tunnel_id == 0) - { - return NULL; - } - - for (i = 0;i < LIST_NUM(l2tp->TunnelList);i++) - { - L2TP_TUNNEL *t = LIST_DATA(l2tp->TunnelList, i); - - if (t->TunnelId2 == tunnel_id && CmpIpAddr(&t->ClientIp, client_ip) == 0) - { - if (EQUAL_BOOL(t->IsV3, is_v3)) - { - return t; - } - } - } - - return NULL; -} - -// Search the tunnel by the tunnel ID that is assigned by the client -L2TP_TUNNEL *GetTunnelFromIdOfAssignedByClient(L2TP_SERVER *l2tp, IP *client_ip, UINT tunnel_id) -{ - UINT i; - // Validate arguments - if (l2tp == NULL || client_ip == 0 || tunnel_id == 0) - { - return NULL; - } - - for (i = 0;i < LIST_NUM(l2tp->TunnelList);i++) - { - L2TP_TUNNEL *t = LIST_DATA(l2tp->TunnelList, i); - - if (t->TunnelId1 == tunnel_id && CmpIpAddr(&t->ClientIp, client_ip) == 0) - { - return t; - } - } - - return NULL; -} -L2TP_TUNNEL *GetTunnelFromIdOfAssignedByClientEx(L2TP_SERVER *l2tp, IP *client_ip, UINT tunnel_id, bool is_v3) -{ - UINT i; - // Validate arguments - if (l2tp == NULL || client_ip == 0 || tunnel_id == 0) - { - return NULL; - } - - for (i = 0;i < LIST_NUM(l2tp->TunnelList);i++) - { - L2TP_TUNNEL *t = LIST_DATA(l2tp->TunnelList, i); - - if (t->TunnelId1 == tunnel_id && CmpIpAddr(&t->ClientIp, client_ip) == 0) - { - if (EQUAL_BOOL(t->IsV3, is_v3)) - { - return t; - } - } - } - - return NULL; -} - -// Create a new tunnel ID -UINT GenerateNewTunnelId(L2TP_SERVER *l2tp, IP *client_ip) -{ - return GenerateNewTunnelIdEx(l2tp, client_ip, false); -} -UINT GenerateNewTunnelIdEx(L2TP_SERVER *l2tp, IP *client_ip, bool is_32bit) -{ - UINT id; - UINT max_number = 0xffff; - // Validate arguments - if (l2tp == NULL || client_ip == NULL) - { - return 0; - } - - if (is_32bit) - { - max_number = 0xfffffffe; - } - - for (id = 1;id <= max_number;id++) - { - if (GetTunnelFromId(l2tp, client_ip, id, is_32bit) == NULL) - { - return id; - } - } - - return 0; -} - -// Release the L2TP tunnel -void FreeL2TPTunnel(L2TP_TUNNEL *t) -{ - UINT i; - // Validate arguments - if (t == NULL) - { - return; - } - - for (i = 0;i < LIST_NUM(t->SessionList);i++) - { - L2TP_SESSION *s = LIST_DATA(t->SessionList, i); - - FreeL2TPSession(s); - } - - ReleaseList(t->SessionList); - - for (i = 0;i < LIST_NUM(t->SendQueue);i++) - { - L2TP_QUEUE *q = LIST_DATA(t->SendQueue, i); - - FreeL2TPQueue(q); - } - - ReleaseList(t->SendQueue); - - for (i = 0;i < LIST_NUM(t->RecvQueue);i++) - { - L2TP_QUEUE *q = LIST_DATA(t->RecvQueue, i); - - FreeL2TPQueue(q); - } - - ReleaseList(t->RecvQueue); - - Free(t); -} - -// Generate a new L2TP control packet -L2TP_PACKET *NewL2TPControlPacket(UINT message_type, bool is_v3) -{ - L2TP_PACKET *p = ZeroMalloc(sizeof(L2TP_PACKET)); - - p->IsControl = true; - p->HasLength = true; - p->HasSequence = true; - p->Ver = (is_v3 ? 3 : 2); - p->MessageType = message_type; - - p->AvpList = NewListFast(NULL); - - if (message_type != 0) - { - L2TP_AVP *a; - USHORT us; - - a = ZeroMalloc(sizeof(L2TP_AVP)); - - a->Type = L2TP_AVP_TYPE_MESSAGE_TYPE; - a->Mandatory = true; - - us = Endian16(message_type); - a->Data = Clone(&us, sizeof(USHORT)); - a->DataSize = sizeof(USHORT); - - Add(p->AvpList, a); - } - - return p; -} - -// Create a new AVP value -L2TP_AVP *NewAVP(USHORT type, bool mandatory, USHORT vendor_id, void *data, UINT data_size) -{ - L2TP_AVP *a; - // Validate arguments - if (data_size != 0 && data == NULL) - { - return NULL; - } - - a = ZeroMalloc(sizeof(L2TP_AVP)); - - a->Type = type; - a->Mandatory = mandatory; - a->VendorID = vendor_id; - a->Data = Clone(data, data_size); - a->DataSize = data_size; - - return a; -} - -// Process a received L2TP packet -void L2TPProcessRecvControlPacket(L2TP_SERVER *l2tp, L2TP_TUNNEL *t, L2TP_PACKET *p) -{ - // Validate arguments - if (l2tp == NULL || t == NULL || p == NULL) - { - return; - } - - if (p->SessionId == 0) - { - if (p->MessageType == L2TP_MESSAGE_TYPE_SCCCN && l2tp->Halt == false) - { - // Tunnel establishment completed - if (t->Established == false) - { - if (t->Disconnecting == false) - { - t->Established = true; - t->LastHelloSent = l2tp->Now; - } - } - } - - if (t->Established) - { - if (p->MessageType == L2TP_MESSAGE_TYPE_ICRQ && t->WantToDisconnect == false && l2tp->Halt == false) - { - // Request to establish a new session arrives - L2TP_AVP *a = GetAVPValue(p, - (t->IsV3 ? L2TP_AVP_TYPE_V3_SESSION_ID_LOCAL : L2TP_AVP_TYPE_ASSIGNED_SESSION)); - if (a != NULL && a->DataSize == (t->IsV3 ? sizeof(UINT) : sizeof(USHORT)) && IsZero(a->Data, (t->IsV3 ? sizeof(UINT) : sizeof(USHORT))) == false) - { - UINT session_id = (t->IsV3 ? READ_UINT(a->Data) : READ_USHORT(a->Data)); - - // Check whether there is other same session ID - if (GetSessionFromIdAssignedByClient(t, session_id) == NULL) - { - // Create a session - L2TP_SESSION *s = NewL2TPSession(l2tp, t, session_id); - - if (s != NULL) - { - L2TP_PACKET *pp; - USHORT us; - UINT ui; - - // Get the PseudowireType - if (t->IsV3) - { - s->PseudowireType = L2TPV3_PW_TYPE_ETHERNET; - - a = GetAVPValue(p, L2TP_AVP_TYPE_V3_PW_TYPE); - - if (a != NULL && a->DataSize == sizeof(USHORT)) - { - ui = READ_USHORT(a->Data); - - s->PseudowireType = ui; - } - } - - Add(t->SessionList, s); - Debug("L2TP New Session: ID = %u/%u on Tunnel %u/%u\n", s->SessionId1, s->SessionId2, - t->TunnelId1, t->TunnelId2); - - // Respond the session creation completion notice - pp = NewL2TPControlPacket(L2TP_MESSAGE_TYPE_ICRP, s->IsV3); - - // Assigned Session AVP - if (s->IsV3 == false) - { - us = Endian16(s->SessionId2); - Add(pp->AvpList, NewAVP(L2TP_AVP_TYPE_ASSIGNED_SESSION, true, 0, &us, sizeof(USHORT))); - } - else - { - ui = Endian32(s->SessionId2); - Add(pp->AvpList, NewAVP(L2TP_AVP_TYPE_V3_SESSION_ID_LOCAL, true, 0, &ui, sizeof(UINT))); - - if (s->IsCiscoV3) - { - Add(pp->AvpList, NewAVP(L2TPV3_CISCO_AVP_SESSION_ID_LOCAL, true, L2TP_AVP_VENDOR_ID_CISCO, &ui, sizeof(UINT))); - } - } - - if (s->IsV3) - { - if (t->IsYamahaV3 == false) - { - // Pseudowire AVP - us = Endian16(s->PseudowireType); - Add(pp->AvpList, NewAVP(L2TP_AVP_TYPE_V3_PW_TYPE, true, 0, &us, sizeof(USHORT))); - } - - if (s->IsCiscoV3) - { - Add(pp->AvpList, NewAVP(L2TPV3_CISCO_AVP_PW_TYPE, true, L2TP_AVP_VENDOR_ID_CISCO, &us, sizeof(USHORT))); - } - - if (t->IsYamahaV3) - { - us = Endian16(0x0003); - Add(pp->AvpList, NewAVP(L2TP_AVP_TYPE_V3_CIRCUIT_STATUS, true, 0, &us, sizeof(USHORT))); - } - } - - SendL2TPControlPacket(l2tp, t, session_id, pp); - - FreeL2TPPacket(pp); - } - } - } - } - else if (p->MessageType == L2TP_MESSAGE_TYPE_STOPCCN) - { - // Tunnel disconnect request arrives - L2TP_AVP *a = GetAVPValue(p, (t->IsV3 ? L2TP_AVP_TYPE_V3_TUNNEL_ID : L2TP_AVP_TYPE_ASSIGNED_TUNNEL)); - if (a != NULL && a->DataSize == (t->IsV3 ? sizeof(UINT) : sizeof(USHORT))) - { - UINT ui = (t->IsV3 ? READ_UINT(a->Data) : READ_USHORT(a->Data)); - - if (ui == t->TunnelId1) - { - // Disconnect the tunnel - DisconnectL2TPTunnel(t); - } - } - } - } - } - else - { - // Search a session - L2TP_SESSION *s = GetSessionFromId(t, p->SessionId); - - if (s != NULL) - { - if (s->Established == false) - { - if (p->MessageType == L2TP_MESSAGE_TYPE_ICCN) - { - // Session establishment completed - if (s->Disconnecting == false) - { - s->Established = true; - } - } - } - else - { - if (p->MessageType == L2TP_MESSAGE_TYPE_CDN) - { - // Received a session disconnection request - L2TP_AVP *a = GetAVPValue(p, - (t->IsV3 ? L2TP_AVP_TYPE_V3_SESSION_ID_LOCAL : L2TP_AVP_TYPE_ASSIGNED_SESSION)); - if (a != NULL && a->DataSize == (t->IsV3 ? sizeof(UINT) : sizeof(USHORT))) - { - UINT ui = (t->IsV3 ? READ_UINT(a->Data) : READ_USHORT(a->Data)); - - if (ui == s->SessionId1) - { - // Disconnect the session - DisconnectL2TPSession(t, s); - } - } - } - } - } - else - { - Debug("Session ID %u not found in Tunnel ID %u/%u\n", p->SessionId, t->TunnelId1, t->TunnelId2); - } - } -} - -// Disconnect the L2TP tunnel -void DisconnectL2TPTunnel(L2TP_TUNNEL *t) -{ - // Validate arguments - if (t == NULL) - { - return; - } - - if (/*t->Established && */t->Disconnecting == false && t->WantToDisconnect == false) - { - UINT i; - - Debug("Trying to Disconnect Tunnel ID %u/%u\n", t->TunnelId1, t->TunnelId2); - t->WantToDisconnect = true; - - // Disconnect all sessions within the tunnel - for (i = 0;i < LIST_NUM(t->SessionList);i++) - { - L2TP_SESSION *s = LIST_DATA(t->SessionList, i); - - DisconnectL2TPSession(t, s); - } - } -} - -// Disconnect the L2TP session -void DisconnectL2TPSession(L2TP_TUNNEL *t, L2TP_SESSION *s) -{ - // Validate arguments - if (t == NULL || s == NULL) - { - return; - } - - if (s->Established && s->Disconnecting == false && s->WantToDisconnect == false) - { - Debug("Trying to Disconnect Session ID %u/%u on Tunnel %u/%u\n", s->SessionId1, s->SessionId2, - t->TunnelId1, t->TunnelId2); - s->WantToDisconnect = true; - } -} - -// Create a new session -L2TP_SESSION *NewL2TPSession(L2TP_SERVER *l2tp, L2TP_TUNNEL *t, UINT session_id_by_client) -{ - L2TP_SESSION *s; - UINT session_id_by_server; - // Validate arguments - if (l2tp == NULL || t == NULL || session_id_by_client == 0) - { - return NULL; - } - - if (LIST_NUM(t->SessionList) >= L2TP_QUOTA_MAX_NUM_SESSIONS_PER_TUNNEL) - { - return NULL; - } - - if (t->IsV3 == false) - { - session_id_by_server = GenerateNewSessionIdEx(t, t->IsV3); - } - else - { - session_id_by_server = GenerateNewSessionIdForL2TPv3(l2tp); - } - if (session_id_by_server == 0) - { - return NULL; - } - - s = ZeroMalloc(sizeof(L2TP_SESSION)); - - s->SessionId1 = session_id_by_client; - s->SessionId2 = session_id_by_server; - - s->IsV3 = t->IsV3; - s->IsCiscoV3 = t->IsCiscoV3; - - s->Tunnel = t; - - return s; -} - -// Retrieve a session from L2TP session ID -L2TP_SESSION *SearchL2TPSessionById(L2TP_SERVER *l2tp, bool is_v3, UINT id) -{ - UINT i, j; - // Validate arguments - if (l2tp == NULL || id == 0) - { - return NULL; - } - - for (i = 0;i < LIST_NUM(l2tp->TunnelList);i++) - { - L2TP_TUNNEL *t = LIST_DATA(l2tp->TunnelList, i); - - for (j = 0;j < LIST_NUM(t->SessionList);j++) - { - L2TP_SESSION *s = LIST_DATA(t->SessionList, j); - - if (s->SessionId2 == id) - { - if (EQUAL_BOOL(s->IsV3, is_v3)) - { - return s; - } - } - } - } - - return NULL; -} - -// Create a new session ID -UINT GenerateNewSessionId(L2TP_TUNNEL *t) -{ - return GenerateNewSessionIdEx(t, false); -} -UINT GenerateNewSessionIdEx(L2TP_TUNNEL *t, bool is_32bit) -{ - UINT i; - UINT max_number = 0xffff; - // Validate arguments - if (t == NULL) - { - return 0; - } - - if (is_32bit) - { - max_number = 0xfffffffe; - } - - for (i = 1;i <= max_number;i++) - { - if (GetSessionFromId(t, i) == NULL) - { - return i; - } - } - - return 0; -} -UINT GenerateNewSessionIdForL2TPv3(L2TP_SERVER *l2tp) -{ - // Validate arguments - if (l2tp == NULL) - { - return 0; - } - - while (true) - { - UINT id = Rand32(); - - if (id == 0 || id == 0xffffffff) - { - continue; - } - - if (SearchL2TPSessionById(l2tp, true, id) == false) - { - return id; - } - } -} - -// Release the session -void FreeL2TPSession(L2TP_SESSION *s) -{ - // Validate arguments - if (s == NULL) - { - return; - } - - Free(s); -} - -// Search a session from the session ID -L2TP_SESSION *GetSessionFromId(L2TP_TUNNEL *t, UINT session_id) -{ - UINT i; - // Validate arguments - if (t == NULL || session_id == 0) - { - return NULL; - } - - for (i = 0;i < LIST_NUM(t->SessionList);i++) - { - L2TP_SESSION *s = LIST_DATA(t->SessionList, i); - - if (s->SessionId2 == session_id) - { - return s; - } - } - - return NULL; -} - -// Search a session from the session ID (Search by ID assigned from the client side) -L2TP_SESSION *GetSessionFromIdAssignedByClient(L2TP_TUNNEL *t, UINT session_id) -{ - UINT i; - // Validate arguments - if (t == NULL || session_id == 0) - { - return NULL; - } - - for (i = 0;i < LIST_NUM(t->SessionList);i++) - { - L2TP_SESSION *s = LIST_DATA(t->SessionList, i); - - if (s->SessionId1 == session_id) - { - return s; - } - } - - return NULL; -} - -// Get the number of L2TP sessions connected from the client IP address -UINT GetNumL2TPTunnelsByClientIP(L2TP_SERVER *l2tp, IP *client_ip) -{ - UINT i, ret; - // Validate arguments - if (l2tp == NULL || client_ip == NULL) - { - return 0; - } - - ret = 0; - - for (i = 0;i < LIST_NUM(l2tp->TunnelList);i++) - { - L2TP_TUNNEL *t = LIST_DATA(l2tp->TunnelList, i); - - if (CmpIpAddr(&t->ClientIp, client_ip) == 0) - { - ret++; - } - } - - return ret; -} - -// Performs processing L2TP received packets. -void ProcL2TPPacketRecv(L2TP_SERVER *l2tp, UDPPACKET *p) -{ - L2TP_PACKET *pp; - bool no_free = false; - // Validate arguments - if (l2tp == NULL || p == NULL) - { - return; - } - - // Parse a packet. - pp = ParseL2TPPacket(p); - if (pp == NULL) - { - return; - } - - if (pp->MessageType == L2TP_MESSAGE_TYPE_SCCRQ && pp->SessionId == 0 && pp->TunnelId == 0 && - pp->Nr == 0 && pp->Ns == 0 && l2tp->Halt == false) - { - { - L2TP_AVP *a = GetAVPValue(pp, (pp->Ver == 3 ? L2TP_AVP_TYPE_V3_TUNNEL_ID : L2TP_AVP_TYPE_ASSIGNED_TUNNEL)); - if (a != NULL && a->DataSize == (pp->Ver == 3 ? sizeof(UINT) : sizeof(USHORT))) - { - UINT client_assigned_id = (pp->Ver == 3 ? READ_UINT(a->Data) : READ_USHORT(a->Data)); - if (GetTunnelFromIdOfAssignedByClient(l2tp, &p->SrcIP, client_assigned_id) == NULL) - { - if (LIST_NUM(l2tp->TunnelList) < L2TP_QUOTA_MAX_NUM_TUNNELS && GetNumL2TPTunnelsByClientIP(l2tp, &p->SrcIP) < L2TP_QUOTA_MAX_NUM_TUNNELS_PER_IP) - { - char ipstr[MAX_SIZE]; - L2TP_PACKET *pp2; - UCHAR protocol_version[2]; - UCHAR caps_data[4]; - USHORT us; - char hostname[MAX_SIZE]; - - // Begin Tunneling - L2TP_TUNNEL *t = NewL2TPTunnel(l2tp, pp, p); - - if (t != NULL) - { - IPToStr(ipstr, sizeof(ipstr), &t->ClientIp); - Debug("L2TP New Tunnel From %s (%s, %s): New Tunnel ID = %u/%u\n", ipstr, t->HostName, t->VendorName, - t->TunnelId1, t->TunnelId2); - - // Add the tunnel to the list - Add(l2tp->TunnelList, t); - - // Respond with SCCEP to SCCRQ - pp2 = NewL2TPControlPacket(L2TP_MESSAGE_TYPE_SCCRP, t->IsV3); - - if (t->IsYamahaV3 == false) - { - // Protocol Version - protocol_version[0] = 1; - protocol_version[1] = 0; - Add(pp2->AvpList, NewAVP(L2TP_AVP_TYPE_PROTOCOL_VERSION, true, 0, protocol_version, sizeof(protocol_version))); - - // Framing Capabilities - Zero(caps_data, sizeof(caps_data)); - if (t->IsV3 == false) - { - caps_data[3] = 3; - } - Add(pp2->AvpList, NewAVP(L2TP_AVP_TYPE_FRAME_CAP, false, 0, caps_data, sizeof(caps_data))); - } - - if (t->IsV3 == false) - { - // Bearer Capabilities - Zero(caps_data, sizeof(caps_data)); - caps_data[3] = 3; - Add(pp2->AvpList, NewAVP(L2TP_AVP_TYPE_BEARER_CAP, false, 0, caps_data, sizeof(caps_data))); - } - - // Host Name - GetMachineHostName(hostname, sizeof(hostname)); - if (IsEmptyStr(hostname)) - { - StrCpy(hostname, sizeof(hostname), "vpn"); - } - Add(pp2->AvpList, NewAVP(L2TP_AVP_TYPE_HOST_NAME, true, 0, hostname, StrLen(hostname))); - - // Vendor Name - if (t->IsYamahaV3 == false) - { - Add(pp2->AvpList, NewAVP(L2TP_AVP_TYPE_VENDOR_NAME, false, 0, L2TP_VENDOR_NAME, StrLen(L2TP_VENDOR_NAME))); - } - else - { - char *yamaha_str = "YAMAHA Corporation"; - Add(pp2->AvpList, NewAVP(L2TP_AVP_TYPE_VENDOR_NAME, false, 0, yamaha_str, StrLen(yamaha_str))); - } - - if (t->IsYamahaV3) - { - UINT zero = 0; - Add(pp2->AvpList, NewAVP(L2TP_AVP_TYPE_V3_ROUTER_ID, true, 0, &zero, sizeof(UINT))); - } - - // Assigned Tunnel ID - if (t->IsV3 == false) - { - us = Endian16(t->TunnelId2); - Add(pp2->AvpList, NewAVP(L2TP_AVP_TYPE_ASSIGNED_TUNNEL, true, 0, &us, sizeof(USHORT))); - } - else - { - UINT ui = Endian32(t->TunnelId2); - Add(pp2->AvpList, NewAVP(L2TP_AVP_TYPE_V3_TUNNEL_ID, true, 0, &ui, sizeof(UINT))); - - if (t->IsCiscoV3) - { - Add(pp2->AvpList, NewAVP(L2TPV3_CISCO_AVP_TUNNEL_ID, true, L2TP_AVP_VENDOR_ID_CISCO, &ui, sizeof(UINT))); - } - } - - // Pseudowire Capabilities List - if (t->IsV3) - { - // Only Ethernet - USHORT cap_list[2]; - cap_list[0] = Endian16(L2TPV3_PW_TYPE_ETHERNET); - cap_list[1] = Endian16(L2TPV3_PW_TYPE_ETHERNET_VLAN); - Add(pp2->AvpList, NewAVP(L2TP_AVP_TYPE_V3_PW_CAP_LIST, true, 0, cap_list, sizeof(cap_list))); - - if (t->IsCiscoV3) - { - Add(pp2->AvpList, NewAVP(L2TPV3_CISCO_AVP_PW_CAP_LIST, true, L2TP_AVP_VENDOR_ID_CISCO, cap_list, sizeof(cap_list))); - } - } - - // Cisco AVP - if (t->IsCiscoV3) - { - USHORT us = Endian16(1); - Add(pp2->AvpList, NewAVP(L2TPV3_CISCO_AVP_DRAFT_AVP_VERSION, true, L2TP_AVP_VENDOR_ID_CISCO, &us, sizeof(USHORT))); - } - - // Recv Window Size - if (t->IsYamahaV3 == false) - { - us = Endian16(L2TP_WINDOW_SIZE); - Add(pp2->AvpList, NewAVP(L2TP_AVP_TYPE_RECV_WINDOW_SIZE, false, 0, &us, sizeof(USHORT))); - } - - SendL2TPControlPacket(l2tp, t, 0, pp2); - - FreeL2TPPacket(pp2); - } - } - } - } - } - } - else - { - // Process related to the existing tunnel - // Find the tunnel - L2TP_TUNNEL *t = NULL; - L2TP_SESSION *l2tpv3_session = NULL; - - if (pp->IsControl || pp->Ver != 3) - { - t = GetTunnelFromId(l2tp, &p->SrcIP, pp->TunnelId, pp->Ver == 3); - } - else - { - l2tpv3_session = SearchL2TPSessionById(l2tp, true, pp->SessionId); - if (l2tpv3_session != NULL) - { - t = l2tpv3_session->Tunnel; - - pp->TunnelId = t->TunnelId2; - } - } - - if (t == NULL) - { - char ipstr[MAX_SIZE]; - - IPToStr(ipstr, sizeof(ipstr), &p->SrcIP); - Debug("L2TP Tunnel From %s ID=%u Not Found on the Table.\n", ipstr, pp->TunnelId); - } - else - { - // Update last reception time - t->LastRecvTick = l2tp->Now; - - if (pp->IsControl) - { - // Control packet - UINT i; - LIST *o = NULL; - L2TP_QUEUE *q; - L2TP_QUEUE tt; - - // Delete the queue that the other party has already received from the retransmission queue - for (i = 0;i < LIST_NUM(t->SendQueue);i++) - { - L2TP_QUEUE *q = LIST_DATA(t->SendQueue, i); - if (L2TP_SEQ_LT(q->Ns, pp->Nr)) - { - if (o == NULL) - { - o = NewListFast(NULL); - } - - Add(o, q); - } - } - - if (o != NULL) - { - for (i = 0;i < LIST_NUM(o);i++) - { - L2TP_QUEUE *q = LIST_DATA(o, i); - - Delete(t->SendQueue, q); - - FreeL2TPQueue(q); - } - - ReleaseList(o); - } - - if ((!L2TP_SEQ_LT(pp->Ns, t->LastNr)) && (pp->Ns != t->LastNr)) - { - // Add the packet received from the opposite to the queue - if (LIST_NUM(t->RecvQueue) < L2TP_WINDOW_SIZE) - { - Zero(&tt, sizeof(tt)); - tt.Ns = pp->Ns; - - if (Search(t->RecvQueue, &tt) == NULL) - { - q = ZeroMalloc(sizeof(L2TP_QUEUE)); - q->Ns = pp->Ns; - q->L2TPPacket = pp; - no_free = true; - Insert(t->RecvQueue, q); - - // Read to the end of completed part from the head of the queue - while (true) - { - L2TP_QUEUE *q; - if (LIST_NUM(t->RecvQueue) == 0) - { - break; - } - - q = LIST_DATA(t->RecvQueue, 0); - if (!L2TP_SEQ_EQ(q->Ns, t->LastNr + 1)) - { - break; - } - - if (q->L2TPPacket->IsZLB == false) - { - t->LastNr = q->Ns; - - // The packet other than ZLB is treated - t->StateChanged = true; - } - - Delete(t->RecvQueue, q); - - // Process the received packet - L2TPProcessRecvControlPacket(l2tp, t, q->L2TPPacket); - - FreeL2TPQueue(q); - } - } - } - } - else - { - // Reply ACK for already-received packets - if (pp->IsZLB == false) - { - // The packet other than ZLB is treated - t->StateChanged = true; - } - } - } - else - { - // Data packet - L2TP_SESSION *s = GetSessionFromId(t, pp->SessionId); - - if (s != NULL && s->Established) - { - if (s->IsV3 == false) - { - // Start the L2TP thread (If not already started) - StartL2TPThread(l2tp, t, s); - - // Pass the data - TubeSendEx(s->TubeRecv, pp->Data, pp->DataSize, NULL, true); - AddTubeToFlushList(l2tp->FlushList, s->TubeRecv); - } - else - { - BLOCK *b; - - // Start the EtherIP session (If it's not have yet started) - L2TPSessionManageEtherIPServer(l2tp, s); - - // Pass the data - b = NewBlock(pp->Data, pp->DataSize, 0); - - EtherIPProcRecvPackets(s->EtherIP, b); - - Free(b); - } - } - } - } - } - - if (no_free == false) - { - FreeL2TPPacket(pp); - } -} - -// Manage the EtherIP server that is associated with the L2TP session -void L2TPSessionManageEtherIPServer(L2TP_SERVER *l2tp, L2TP_SESSION *s) -{ - IKE_SERVER *ike; - IKE_CLIENT *c; - // Validate arguments - if (l2tp == NULL || s == NULL) - { - return; - } - - if (l2tp->IkeClient == NULL || l2tp->IkeServer == NULL) - { - return; - } - - ike = l2tp->IkeServer; - c = l2tp->IkeClient; - - if (s->EtherIP == NULL) - { - char crypt_name[MAX_SIZE]; - UINT crypt_block_size = IKE_MAX_BLOCK_SIZE; - - Zero(crypt_name, sizeof(crypt_name)); - - if (c->CurrentIpSecSaRecv != NULL) - { - Format(crypt_name, sizeof(crypt_name), - "IPsec - %s (%u bits)", - c->CurrentIpSecSaRecv->TransformSetting.Crypto->Name, - c->CurrentIpSecSaRecv->TransformSetting.CryptoKeySize * 8); - - crypt_block_size = c->CurrentIpSecSaRecv->TransformSetting.Crypto->BlockSize; - } - - s->EtherIP = NewEtherIPServer(ike->Cedar, ike->IPsec, ike, - &c->ClientIP, c->ClientPort, - &c->ServerIP, c->ServerPort, crypt_name, - c->IsL2TPOnIPsecTunnelMode, crypt_block_size, c->ClientId, - ++ike->CurrentEtherId); - - StrCpy(s->EtherIP->VendorName, sizeof(s->EtherIP->VendorName), s->Tunnel->VendorName); - - s->EtherIP->L2TPv3 = true; - - Debug("IKE_CLIENT 0x%X: EtherIP Server Started.\n", c); - - IPsecLog(ike, c, NULL, NULL, NULL, "LI_ETHERIP_SERVER_STARTED", ike->CurrentEtherId); - } - else - { - StrCpy(s->EtherIP->ClientId, sizeof(s->EtherIP->ClientId), c->ClientId); - } - - if (s->EtherIP->Interrupts == NULL) - { - s->EtherIP->Interrupts = l2tp->Interrupts; - } - - if (s->EtherIP->SockEvent == NULL) - { - SetEtherIPServerSockEvent(s->EtherIP, l2tp->SockEvent); - } - - s->EtherIP->Now = l2tp->Now; -} - -// Calculate the appropriate MSS of the L2TP -UINT CalcL2TPMss(L2TP_SERVER *l2tp, L2TP_TUNNEL *t, L2TP_SESSION *s) -{ - UINT ret; - // Validate arguments - if (l2tp == NULL || t == NULL || s == NULL) - { - return 0; - } - - ret = MTU_FOR_PPPOE; - - if (l2tp->IkeServer != NULL) - { - // On IPsec - if (l2tp->IsIPsecIPv6) - { - ret -= 40; - } - else - { - ret -= 20; - } - - // UDP - ret -= 8; - - // ESP - ret -= 20 + l2tp->CryptBlockSize * 2; - } - else - { - // Raw L2TP - if (IsIP6(&t->ClientIp)) - { - ret -= 40; - } - else - { - ret -= 20; - } - } - - // L2TP UDP - ret -= 8; - - // L2TP - ret -= 8; - - // PPP - ret -= 4; - - // Target communication - ret -= 20; - - // TCP header - ret -= 20; - - return ret; -} - -// Start the L2TP thread -void StartL2TPThread(L2TP_SERVER *l2tp, L2TP_TUNNEL *t, L2TP_SESSION *s) -{ - PPP_SESSION* underlyingSession; - // Validate arguments - if (l2tp == NULL || t == NULL || s == NULL) - { - return; - } - - if (s->HasThread == false) - { - char tmp[MAX_SIZE]; - - Debug("Thread Created for Session %u/%u on Tunnel %u/%u\n", - s->SessionId1, s->SessionId2, t->TunnelId1, t->TunnelId2); - - s->HasThread = true; - - NewTubePair(&s->TubeSend, &s->TubeRecv, 0); - SetTubeSockEvent(s->TubeSend, l2tp->SockEvent); - - if (IsEmptyStr(t->VendorName) == false) - { - Format(tmp, sizeof(tmp), L2TP_IPC_CLIENT_NAME_TAG, t->VendorName); - } - else - { - StrCpy(tmp, sizeof(tmp), L2TP_IPC_CLIENT_NAME_NO_TAG); - } - - // Create a PPP thread - underlyingSession = NewPPPSession(l2tp->Cedar, &t->ClientIp, t->ClientPort, &t->ServerIp, t->ServerPort, - s->TubeSend, s->TubeRecv, L2TP_IPC_POSTFIX, tmp, t->HostName, l2tp->CryptName, - CalcL2TPMss(l2tp, t, s)); - s->Thread = underlyingSession->SessionThread; - s->PPPSession = underlyingSession; - } -} - -// Stop the L2TP thread -void StopL2TPThread(L2TP_SERVER *l2tp, L2TP_TUNNEL *t, L2TP_SESSION *s) -{ - THREAD *thread; - // Validate arguments - if (l2tp == NULL || t == NULL || s == NULL) - { - return; - } - - if (s->IsV3) - { - // Process the L2TPv3 - if (s->EtherIP != NULL) - { - // Release the EtherIP server - ReleaseEtherIPServer(s->EtherIP); - s->EtherIP = NULL; - } - return; - } - - if (s->HasThread == false) - { - return; - } - thread = s->Thread; - s->Thread = NULL; - s->HasThread = false; - - // Disconnect the tube - TubeDisconnect(s->TubeRecv); - TubeDisconnect(s->TubeSend); - - // Release the tube - ReleaseTube(s->TubeRecv); - ReleaseTube(s->TubeSend); - - s->TubeRecv = NULL; - s->TubeSend = NULL; - - // Pass the thread to termination list - if (l2tp->IkeServer == NULL) - { - AddThreadToThreadList(l2tp->ThreadList, thread); - } - else - { - AddThreadToThreadList(l2tp->IkeServer->ThreadList, thread); - } - - Debug("Thread Stopped for Session %u/%u on Tunnel %u/%u\n", - s->SessionId1, s->SessionId2, t->TunnelId1, t->TunnelId2); - - // Release the thread - ReleaseThread(thread); -} - -// Interrupt processing of L2TP server -void L2TPProcessInterrupts(L2TP_SERVER *l2tp) -{ - UINT i, j; - LIST *delete_tunnel_list = NULL; - // Validate arguments - if (l2tp == NULL) - { - return; - } - - if (l2tp->Halt) - { - if (l2tp->Halting == false) - { - l2tp->Halting = true; - - // Disconnect all tunnels - for (i = 0;i < LIST_NUM(l2tp->TunnelList);i++) - { - L2TP_TUNNEL *t = LIST_DATA(l2tp->TunnelList, i); - - DisconnectL2TPTunnel(t); - } - } - } - - // Flush - FlushTubeFlushList(l2tp->FlushList); - - // Enumerate all tunnels - for (i = 0;i < LIST_NUM(l2tp->TunnelList);i++) - { - L2TP_TUNNEL *t = LIST_DATA(l2tp->TunnelList, i); - LIST *delete_session_list = NULL; - UINT64 l2tpTimeout = L2TP_TUNNEL_TIMEOUT; - - // If we got on ANY session a higher timeout than the default L2TP tunnel timeout, increase it - for (i = 0; i < LIST_NUM(t->SessionList); i++) - { - L2TP_SESSION* s = LIST_DATA(t->SessionList, i); - - if (s->PPPSession != NULL && s->PPPSession->DataTimeout > l2tpTimeout) - { - l2tpTimeout = s->PPPSession->DataTimeout; - } - } - - - if ((l2tp->Now >= (t->LastRecvTick + (UINT64)l2tpTimeout)) && t->Timedout == false) - { - // Disconnect the tunnel forcibly if data can not be received for a certain period of time - t->Timedout = true; - - Debug("L2TP Tunnel %u/%u Timed out.\n", t->TunnelId1, t->TunnelId2); - DisconnectL2TPTunnel(t); - } - - if (t->Established && (l2tp->Now >= (t->LastHelloSent + (UINT64)L2TP_HELLO_INTERVAL))) - { - if (LIST_NUM(t->SendQueue) <= L2TP_HELLO_SUPRESS_MAX_THRETHORD_NUM_SEND_QUEUE) - { - L2TP_PACKET *pp = NewL2TPControlPacket(L2TP_MESSAGE_TYPE_HELLO, t->IsV3); - - // Send a Hello message - t->LastHelloSent = l2tp->Now; - //Debug("L2TP Sending Hello %u/%u: tick=%I64u\n", t->TunnelId1, t->TunnelId2, l2tp->Now); - - SendL2TPControlPacket(l2tp, t, 0, pp); - - FreeL2TPPacket(pp); - - L2TPAddInterrupt(l2tp, t->LastHelloSent + (UINT64)L2TP_HELLO_INTERVAL); - } - } - - // Enumerate all sessions - for (j = 0;j < LIST_NUM(t->SessionList);j++) - { - L2TP_SESSION *s = LIST_DATA(t->SessionList, j); - - if (s->HasThread) - { - // Send packet data - while (true) - { - TUBEDATA *d = TubeRecvAsync(s->TubeSend); - - if (d == NULL) - { - break; - } - - SendL2TPDataPacket(l2tp, t, s, d->Data, d->DataSize); - - FreeTubeData(d); - } - - if (IsTubeConnected(s->TubeSend) == false) - { - // Disconnect the this session because the PPP thread ends - DisconnectL2TPSession(t, s); - } - } - - if (s->IsV3) - { - if (s->EtherIP != NULL) - { - UINT k; - - L2TPSessionManageEtherIPServer(l2tp, s); - - // Notify an interrupt to the EtherIP module - EtherIPProcInterrupts(s->EtherIP); - - // Send an EtherIP packet data - for (k = 0;k < LIST_NUM(s->EtherIP->SendPacketList);k++) - { - BLOCK *b = LIST_DATA(s->EtherIP->SendPacketList, k); - - SendL2TPDataPacket(l2tp, t, s, b->Buf, b->Size); - - FreeBlock(b); - } - - DeleteAll(s->EtherIP->SendPacketList); - } - } - - if (s->WantToDisconnect && s->Disconnecting == false) - { - // Disconnect the session - UCHAR error_data[4]; - USHORT us; - UINT ui; - UINT ppp_error_1 = 0, ppp_error_2 = 0; - - // Send the session disconnection response - L2TP_PACKET *pp = NewL2TPControlPacket(L2TP_MESSAGE_TYPE_CDN, s->IsV3); - - if (s->TubeRecv != NULL) - { - ppp_error_1 = s->TubeRecv->IntParam1; - ppp_error_2 = s->TubeRecv->IntParam2; - } - - // Assigned Session ID - if (s->IsV3 == false) - { - us = Endian16(s->SessionId2); - Add(pp->AvpList, NewAVP(L2TP_AVP_TYPE_ASSIGNED_SESSION, true, 0, - &us, sizeof(USHORT))); - } - else - { - ui = Endian16(s->SessionId2); - Add(pp->AvpList, NewAVP(L2TP_AVP_TYPE_V3_SESSION_ID_LOCAL, true, 0, - &ui, sizeof(UINT))); - - if (t->IsCiscoV3) - { - Add(pp->AvpList, NewAVP(L2TPV3_CISCO_AVP_SESSION_ID_LOCAL, true, L2TP_AVP_VENDOR_ID_CISCO, - &ui, sizeof(UINT))); - } - } - - // Result-Error Code - Zero(error_data, sizeof(error_data)); - error_data[1] = 0x03; - Add(pp->AvpList, NewAVP(L2TP_AVP_TYPE_RESULT_CODE, true, 0, - error_data, sizeof(error_data))); - - if (ppp_error_1 != 0) - { - // PPP Disconnect Cause Code AVP - BUF *b = NewBuf(); - UCHAR uc; - USHORT us; - - // Disconnect Code - us = Endian16(ppp_error_1); - WriteBuf(b, &us, sizeof(USHORT)); - - // Control Protocol Number - us = Endian16(0xc021); - WriteBuf(b, &us, sizeof(USHORT)); - - // Direction - uc = (UCHAR)ppp_error_2; - WriteBuf(b, &uc, sizeof(UCHAR)); - - Add(pp->AvpList, NewAVP(L2TP_AVP_TYPE_PPP_DISCONNECT_CAUSE, false, 0, - b->Buf, b->Size)); - - FreeBuf(b); - } - - SendL2TPControlPacket(l2tp, t, s->SessionId1, pp); - - FreeL2TPPacket(pp); - - // Disconnect the session - Debug("L2TP Session %u/%u on Tunnel %u/%u Disconnected.\n", s->SessionId1, s->SessionId2, - t->TunnelId1, t->TunnelId2); - s->Disconnecting = true; - s->Established = false; - s->DisconnectTimeout = l2tp->Now + (UINT64)L2TP_TUNNEL_DISCONNECT_TIMEOUT; - - // Stop the thread - StopL2TPThread(l2tp, t, s); - - L2TPAddInterrupt(l2tp, s->DisconnectTimeout); - } - - if (s->Disconnecting && ((l2tp->Now >= s->DisconnectTimeout) || LIST_NUM(t->SendQueue) == 0)) - { - // Delete the session if synchronization between the client - // and the server is complete or a time-out occurs - if (delete_session_list == NULL) - { - delete_session_list = NewListFast(NULL); - } - - Add(delete_session_list, s); - } - } - - if (delete_session_list != NULL) - { - // Session deletion process - for (j = 0;j < LIST_NUM(delete_session_list);j++) - { - L2TP_SESSION *s = LIST_DATA(delete_session_list, j); - - Debug("L2TP Session %u/%u on Tunnel %u/%u Cleaned up.\n", s->SessionId1, s->SessionId2, - t->TunnelId1, t->TunnelId2); - - FreeL2TPSession(s); - Delete(t->SessionList, s); - } - - ReleaseList(delete_session_list); - } - - if (t->WantToDisconnect && t->Disconnecting == false) - { - // Disconnect the tunnel - USHORT error_data[4]; - USHORT us; - UINT ui; - // Reply the tunnel disconnection response - L2TP_PACKET *pp = NewL2TPControlPacket(L2TP_MESSAGE_TYPE_STOPCCN, t->IsV3); - - // Assigned Tunnel ID - if (t->IsV3 == false) - { - us = Endian16(t->TunnelId2); - Add(pp->AvpList, NewAVP(L2TP_AVP_TYPE_ASSIGNED_TUNNEL, true, 0, - &us, sizeof(USHORT))); - } - else - { - ui = Endian32(t->TunnelId2); - Add(pp->AvpList, NewAVP(L2TP_AVP_TYPE_V3_TUNNEL_ID, true, 0, - &ui, sizeof(UINT))); - - if (t->IsCiscoV3) - { - Add(pp->AvpList, NewAVP(L2TPV3_CISCO_AVP_TUNNEL_ID, true, L2TP_AVP_VENDOR_ID_CISCO, - &ui, sizeof(UINT))); - } - } - - // Result-Error Code - Zero(error_data, sizeof(error_data)); - error_data[1] = 0x06; - Add(pp->AvpList, NewAVP(L2TP_AVP_TYPE_RESULT_CODE, true, 0, - error_data, sizeof(error_data))); - - SendL2TPControlPacket(l2tp, t, 0, pp); - - FreeL2TPPacket(pp); - - Debug("L2TP Tunnel %u/%u is Disconnected.\n", t->TunnelId1, t->TunnelId2); - t->Disconnecting = true; - t->Established = false; - t->DisconnectTimeout = l2tp->Now + (UINT64)L2TP_TUNNEL_DISCONNECT_TIMEOUT; - L2TPAddInterrupt(l2tp, t->DisconnectTimeout); - } - - if (t->Disconnecting && (((LIST_NUM(t->SendQueue) == 0) && LIST_NUM(t->SessionList) == 0) || (l2tp->Now >= t->DisconnectTimeout))) - { - // Delete the tunnel if there is no session in the tunnel when synchronization - // between the client and the server has been completed or a time-out occurs - if (delete_tunnel_list == NULL) - { - delete_tunnel_list = NewListFast(NULL); - } - - Add(delete_tunnel_list, t); - } - } - - if (delete_tunnel_list != NULL) - { - for (i = 0;i < LIST_NUM(delete_tunnel_list);i++) - { - L2TP_TUNNEL *t = LIST_DATA(delete_tunnel_list, i); - - Debug("L2TP Tunnel %u/%u Cleaned up.\n", t->TunnelId1, t->TunnelId2); - - FreeL2TPTunnel(t); - Delete(l2tp->TunnelList, t); - } - - ReleaseList(delete_tunnel_list); - } - - // Re-transmit packets - for (i = 0;i < LIST_NUM(l2tp->TunnelList);i++) - { - L2TP_TUNNEL *t = LIST_DATA(l2tp->TunnelList, i); - UINT j; - - if (LIST_NUM(t->SendQueue) >= 1) - { - // Packet to be transmitted exists one or more - for (j = 0;j < LIST_NUM(t->SendQueue);j++) - { - L2TP_QUEUE *q = LIST_DATA(t->SendQueue, j); - - if (l2tp->Now >= q->NextSendTick) - { - q->NextSendTick = l2tp->Now + (UINT64)L2TP_PACKET_RESEND_INTERVAL; - - L2TPAddInterrupt(l2tp, q->NextSendTick); - - SendL2TPControlPacketMain(l2tp, t, q); - } - } - } - else - { - // There is no packet to be transmitted, but the state of the tunnel is changed - if (t->StateChanged) - { - // Send a ZLB - L2TP_QUEUE *q = ZeroMalloc(sizeof(L2TP_QUEUE)); - L2TP_PACKET *pp = NewL2TPControlPacket(0, t->IsV3); - - pp->TunnelId = t->TunnelId1; - pp->Ns = t->NextNs; - q->Buf = BuildL2TPPacketData(pp, t); - - SendL2TPControlPacketMain(l2tp, t, q); - - FreeL2TPQueue(q); - FreeL2TPPacket(pp); - } - } - - t->StateChanged = false; - } - - if (l2tp->Halting) - { - if (LIST_NUM(l2tp->TunnelList) == 0) - { - // Stop all the L2TP tunnel completed - if (l2tp->HaltCompleted == false) - { - l2tp->HaltCompleted = true; - - Set(l2tp->HaltCompletedEvent); - } - } - } - - // Maintenance the thread list - if (l2tp->IkeServer == NULL) - { - MaintainThreadList(l2tp->ThreadList); - //Debug("l2tp->ThreadList: %u\n", LIST_NUM(l2tp->ThreadList)); - } -} - -// Create a new L2TP server -L2TP_SERVER *NewL2TPServer(CEDAR *cedar) -{ - return NewL2TPServerEx(cedar, NULL, false, 0); -} -L2TP_SERVER *NewL2TPServerEx(CEDAR *cedar, IKE_SERVER *ike, bool is_ipv6, UINT crypt_block_size) -{ - L2TP_SERVER *l2tp; - // Validate arguments - if (cedar == NULL) - { - return NULL; - } - - l2tp = ZeroMalloc(sizeof(L2TP_SERVER)); - - l2tp->FlushList = NewTubeFlushList(); - - l2tp->Cedar = cedar; - AddRef(l2tp->Cedar->ref); - - l2tp->SendPacketList = NewList(NULL); - l2tp->TunnelList = NewList(NULL); - - l2tp->HaltCompletedEvent = NewEvent(); - - l2tp->ThreadList = NewThreadList(); - - l2tp->IkeServer = ike; - - l2tp->IsIPsecIPv6 = is_ipv6; - l2tp->CryptBlockSize = crypt_block_size; - - return l2tp; -} - -// Stop the L2TP server -void StopL2TPServer(L2TP_SERVER *l2tp, bool no_wait) -{ - // Validate arguments - if (l2tp == NULL) - { - return; - } - if (l2tp->Halt) - { - return; - } - - // Begin to shut down - l2tp->Halt = true; - Debug("Shutting down L2TP Server...\n"); - - // Hit the event - SetSockEvent(l2tp->SockEvent); - - if (no_wait == false) - { - // Wait until complete stopping all tunnels - Wait(l2tp->HaltCompletedEvent, INFINITE); - } - else - { - UINT i, j; - // Kill the thread of all sessions - for (i = 0;i < LIST_NUM(l2tp->TunnelList);i++) - { - L2TP_TUNNEL *t = LIST_DATA(l2tp->TunnelList, i); - - for (j = 0;j < LIST_NUM(t->SessionList);j++) - { - L2TP_SESSION *s = LIST_DATA(t->SessionList, j); - - StopL2TPThread(l2tp, t, s); - } - } - } - - // Thread stop - Debug("Stopping all L2TP PPP Threads...\n"); - StopThreadList(l2tp->ThreadList); - Debug("L2TP Server Shutdown Completed.\n"); -} - -// Release the L2TP server -void FreeL2TPServer(L2TP_SERVER *l2tp) -{ - UINT i; - // Validate arguments - if (l2tp == NULL) - { - return; - } - - FreeThreadList(l2tp->ThreadList); - - for (i = 0;i < LIST_NUM(l2tp->SendPacketList);i++) - { - UDPPACKET *p = LIST_DATA(l2tp->SendPacketList, i); - - FreeUdpPacket(p); - } - - ReleaseList(l2tp->SendPacketList); - - for (i = 0;i < LIST_NUM(l2tp->TunnelList);i++) - { - L2TP_TUNNEL *t = LIST_DATA(l2tp->TunnelList, i); - - FreeL2TPTunnel(t); - } - - ReleaseList(l2tp->TunnelList); - - ReleaseSockEvent(l2tp->SockEvent); - - ReleaseEvent(l2tp->HaltCompletedEvent); - - ReleaseCedar(l2tp->Cedar); - - FreeTubeFlushList(l2tp->FlushList); - - Free(l2tp); -} - -// Set a SockEvent to the L2TP server -void SetL2TPServerSockEvent(L2TP_SERVER *l2tp, SOCK_EVENT *e) -{ - // Validate arguments - if (l2tp == NULL) - { - return; - } - - if (e != NULL) - { - AddRef(e->ref); - } - - if (l2tp->SockEvent != NULL) - { - ReleaseSockEvent(l2tp->SockEvent); - l2tp->SockEvent = NULL; - } - - l2tp->SockEvent = e; -} - +// SoftEther VPN Source Code - Developer Edition Master Branch +// Cedar Communication Module + + +// Proto_L2TP.c +// L2TP protocol stack + +#include "CedarPch.h" + +// Release the L2TP AVP value +void FreeL2TPAVP(L2TP_AVP *a) +{ + // Validate arguments + if (a == NULL) + { + return; + } + + if (a->Data != NULL) + { + Free(a->Data); + } + + Free(a); +} + +// Release the L2TP packet +void FreeL2TPPacket(L2TP_PACKET *p) +{ + UINT i; + // Validate arguments + if (p == NULL) + { + return; + } + + if (p->AvpList != NULL) + { + for (i = 0;i < LIST_NUM(p->AvpList);i++) + { + L2TP_AVP *a = LIST_DATA(p->AvpList, i); + + FreeL2TPAVP(a); + } + + ReleaseList(p->AvpList); + } + + if (p->Data != NULL) + { + Free(p->Data); + } + + Free(p); +} + +// Send an L2TP control packet +void SendL2TPControlPacket(L2TP_SERVER *l2tp, L2TP_TUNNEL *t, UINT session_id, L2TP_PACKET *p) +{ + BUF *buf; + L2TP_QUEUE *q; + // Validate arguments + if (l2tp == NULL || t == NULL || p == NULL) + { + return; + } + + p->IsControl = true; + p->TunnelId = t->TunnelId1; + p->SessionId = session_id; + + p->Ns = t->NextNs; + t->NextNs++; + + p->Nr = t->LastNr + 1; + + buf = BuildL2TPPacketData(p, t); + + q = ZeroMalloc(sizeof(L2TP_QUEUE)); + q->Buf = buf; + q->Ns = p->Ns; + q->NextSendTick = l2tp->Now + (UINT64)L2TP_PACKET_RESEND_INTERVAL; + SendL2TPControlPacketMain(l2tp, t, q); + + L2TPAddInterrupt(l2tp, q->NextSendTick); + + Add(t->SendQueue, q); + +} + +// Specify the interrupt occurrence time of the next +void L2TPAddInterrupt(L2TP_SERVER *l2tp, UINT64 next_tick) +{ + // Validate arguments + if (l2tp == NULL || next_tick == 0) + { + return; + } + + AddInterrupt(l2tp->Interrupts, next_tick); +} + +// Send a L2TP data packet +void SendL2TPDataPacket(L2TP_SERVER *l2tp, L2TP_TUNNEL *t, L2TP_SESSION *s, void *data, UINT size) +{ + UDPPACKET *p; + UCHAR *buf; + UINT buf_size; + // Validate arguments + if (l2tp == NULL || t == NULL || s == NULL || (size != 0 && data == NULL)) + { + return; + } + + // Build a L2TP data packet + if (s->IsV3 == false) + { + // L2TP Ver 2 + buf_size = 8 + size; + buf = Malloc(buf_size); + buf[0] = 0x40; + buf[1] = 0x02; + + WRITE_USHORT(buf + 2, buf_size); + WRITE_USHORT(buf + 4, t->TunnelId1); + WRITE_USHORT(buf + 6, s->SessionId1); + + Copy(buf + 8, data, size); + + // Transmission + p = NewUdpPacket(&t->ServerIp, t->ServerPort, &t->ClientIp, t->ClientPort, buf, buf_size); + } + else + { + // L2TPv3 + if (t->IsYamahaV3 == false) + { + buf_size = 4 + size; + buf = Malloc(buf_size); + + WRITE_UINT(buf, s->SessionId1); + + Copy(buf + 4, data, size); + + // Transmission + p = NewUdpPacket(&t->ServerIp, IPSEC_PORT_L2TPV3_VIRTUAL, &t->ClientIp, IPSEC_PORT_L2TPV3_VIRTUAL, buf, buf_size); + } + else + { + UINT header = 0x00030000; + + buf_size = 8 + size; + buf = Malloc(buf_size); + + WRITE_UINT(buf, header); + WRITE_UINT(buf + 4, s->SessionId1); + + Copy(buf + 8, data, size); + + // Transmission + p = NewUdpPacket(&t->ServerIp, t->ServerPort, &t->ClientIp, t->ClientPort, buf, buf_size); + } + } + + L2TPSendUDP(l2tp, p); +} + +// L2TP packet transmission main +void SendL2TPControlPacketMain(L2TP_SERVER *l2tp, L2TP_TUNNEL *t, L2TP_QUEUE *q) +{ + UDPPACKET *p; + // Validate arguments + if (l2tp == NULL || t == NULL || q == NULL) + { + return; + } + + p = NewUdpPacket(&t->ServerIp, t->ServerPort, &t->ClientIp, t->ClientPort, + Clone(q->Buf->Buf, q->Buf->Size), q->Buf->Size); + + // Update the received sequence number + WRITE_USHORT(((UCHAR *)p->Data) + (p->SrcPort == IPSEC_PORT_L2TPV3_VIRTUAL ? 14 : 10), t->LastNr + 1); + + L2TPSendUDP(l2tp, p); +} + +// Send a UDP packet +void L2TPSendUDP(L2TP_SERVER *l2tp, UDPPACKET *p) +{ + // Validate arguments + if (l2tp == NULL || p == NULL) + { + return; + } + + Add(l2tp->SendPacketList, p); +} + +// Build a L2TP packet +BUF *BuildL2TPPacketData(L2TP_PACKET *pp, L2TP_TUNNEL *t) +{ + BUF *ret; + UCHAR c; + USHORT us; + UINT ui; + // Validate arguments + if (pp == NULL || t == NULL) + { + return NULL; + } + + ret = NewBuf(); + + c = 0; + + if (pp->Ver == 3) + { + if (pp->SessionId != 0) + { + // Add the Remote Session ID AVP + L2TP_AVP *a = GetAVPValue(pp, L2TP_AVP_TYPE_V3_SESSION_ID_REMOTE); + if (a == NULL || a->DataSize != sizeof(UINT)) + { + UINT ui = Endian32(pp->SessionId); + Add(pp->AvpList, NewAVP(L2TP_AVP_TYPE_V3_SESSION_ID_REMOTE, true, 0, &ui, sizeof(UINT))); + + if (GetAVPValueEx(pp, L2TPV3_CISCO_AVP_SESSION_ID_LOCAL, L2TP_AVP_VENDOR_ID_CISCO) != NULL) + { + Add(pp->AvpList, NewAVP(L2TPV3_CISCO_AVP_SESSION_ID_REMOTE, true, L2TP_AVP_VENDOR_ID_CISCO, &ui, sizeof(UINT))); + } + } + } + } + + if (pp->Ver == 3) + { + if (t->IsYamahaV3 == false) + { + // Zero as Session ID + ui = 0; + WriteBuf(ret, &ui, sizeof(UINT)); + } + } + + // Flags + if (pp->IsControl) + { + c |= L2TP_HEADER_BIT_TYPE; + c |= L2TP_HEADER_BIT_LENGTH; + c |= L2TP_HEADER_BIT_SEQUENCE; + } + else + { + c |= L2TP_HEADER_BIT_OFFSET; + } + + if (pp->IsControl == false && pp->Ver == 3 && t->IsYamahaV3) + { + c = 0; + } + + WriteBuf(ret, &c, 1); + + // Ver + c = 2; + if (pp->Ver == 3) + { + c = 3; + } + WriteBuf(ret, &c, 1); + + // Length + if (pp->IsControl) + { + us = 0; + WriteBuf(ret, &us, sizeof(USHORT)); + } + + // Reserved + if (pp->IsControl == false && pp->Ver == 3 && t->IsYamahaV3) + { + us = 0; + WriteBuf(ret, &us, sizeof(USHORT)); + } + + // Tunnel ID + if (pp->Ver != 3) + { + us = Endian16((USHORT)pp->TunnelId); + WriteBuf(ret, &us, sizeof(USHORT)); + } + else + { + ui = Endian32(pp->TunnelId); + WriteBuf(ret, &ui, sizeof(UINT)); + } + + // Session ID + if (pp->Ver != 3) + { + us = Endian16((USHORT)pp->SessionId); + WriteBuf(ret, &us, sizeof(USHORT)); + } + + if (pp->IsControl) + { + // Ns + us = Endian16(pp->Ns); + WriteBuf(ret, &us, sizeof(USHORT)); + + // Nr + us = Endian16(pp->Nr); + WriteBuf(ret, &us, sizeof(USHORT)); + } + else + { + if (!(pp->IsControl == false && pp->Ver == 3 && t->IsYamahaV3)) + { + // Offset Size = 0 + us = 0; + WriteBuf(ret, &us, sizeof(USHORT)); + } + } + + if (pp->IsControl) + { + // AVP + UINT i; + for (i = 0;i < LIST_NUM(pp->AvpList);i++) + { + L2TP_AVP *a = LIST_DATA(pp->AvpList, i); + + // Length and Flags + us = Endian16(a->DataSize + 6); + + if (a->Mandatory) + { + *((UCHAR *)&us) |= L2TP_AVP_BIT_MANDATORY; + } + + WriteBuf(ret, &us, sizeof(USHORT)); + + // Vendor ID + us = Endian16(a->VendorID); + WriteBuf(ret, &us, sizeof(USHORT)); + + // Type + us = Endian16(a->Type); + WriteBuf(ret, &us, sizeof(USHORT)); + + // Data + WriteBuf(ret, a->Data, a->DataSize); + } + } + else + { + // Payload + WriteBuf(ret, pp->Data, pp->DataSize); + } + + if (pp->IsControl) + { + // Update Length + bool l2tpv3_non_yamaha = ((pp->Ver == 3) && (t->IsYamahaV3 == false)); + WRITE_USHORT(((UCHAR *)ret->Buf) + 2 + (l2tpv3_non_yamaha ? sizeof(UINT) : 0), (USHORT)(ret->Size - (l2tpv3_non_yamaha ? sizeof(UINT) : 0))); + } + + SeekBuf(ret, 0, 0); + + return ret; +} + +// Parse the L2TP packet +L2TP_PACKET *ParseL2TPPacket(UDPPACKET *p) +{ + L2TP_PACKET *ret; + UCHAR *buf; + UINT size; + bool is_l2tpv3 = false; + bool is_l2tpv3_yamaha = false; + // Validate arguments + if (p == NULL) + { + return NULL; + } + + ret = ZeroMalloc(sizeof(L2TP_PACKET)); + + if (p->SrcPort == IPSEC_PORT_L2TPV3_VIRTUAL) + { + // L2TPv3 (Cisco) + is_l2tpv3 = true; + } + + buf = p->Data; + size = p->Size; + + if (size >= 2 && ((buf[1] & L2TP_HEADER_BIT_VER) == 3)) + { + if (p->SrcPort != IPSEC_PORT_L2TPV3_VIRTUAL) + { + // L2TPv3 (YAMAHA) + is_l2tpv3 = true; + is_l2tpv3_yamaha = true; + } + } + + if (is_l2tpv3 && (is_l2tpv3_yamaha == false)) + { + // L2TPv3 (Cisco) + UINT session_id; + if (size < 4) + { + goto LABEL_ERROR; + } + + session_id = READ_UINT(buf); + + if (session_id != 0) + { + // L2TPv3 data packet reception + ret->SessionId = session_id; + + buf += sizeof(UINT); + size -= sizeof(UINT); + + ret->Data = Clone(buf, size); + ret->DataSize = size; + + ret->Ver = 3; + + return ret; + } + else + { + // L2TPv3 control packet reception + buf += sizeof(UINT); + size -= sizeof(UINT); + } + } + + // L2TP + if (size < 6) + { + goto LABEL_ERROR; + } + + if (*buf & L2TP_HEADER_BIT_TYPE) + { + ret->IsControl = true; + } + + if (*buf & L2TP_HEADER_BIT_LENGTH) + { + ret->HasLength = true; + } + + if (*buf & L2TP_HEADER_BIT_SEQUENCE) + { + ret->HasSequence = true; + } + + if (is_l2tpv3 == false) + { + if (*buf & L2TP_HEADER_BIT_OFFSET) + { + ret->HasOffset = true; + } + + if (*buf & L2TP_HEADER_BIT_PRIORITY) + { + ret->IsPriority = true; + } + } + + buf++; + size--; + + ret->Ver = *buf & L2TP_HEADER_BIT_VER; + + buf++; + size--; + + if (is_l2tpv3 == false) + { + // L2TP + if (ret->Ver != 2) + { + goto LABEL_ERROR; + } + } + else + { + // L2TPv3 + if (ret->Ver != 3) + { + goto LABEL_ERROR; + } + } + + if (ret->IsControl) + { + if (ret->HasLength == false || ret->HasSequence == false) + { + goto LABEL_ERROR; + } + } + else + { + /*if (ret->HasSequence) + { + goto LABEL_ERROR; + }*/ + } + + if (ret->HasLength) + { + // Length + if (size < 2) + { + goto LABEL_ERROR; + } + ret->Length = READ_USHORT(buf); + buf += 2; + size -= 2; + + if (size < (ret->Length - 4)) + { + goto LABEL_ERROR; + } + + size = ret->Length - 4; + } + + if (is_l2tpv3) + { + if (p->SrcPort != IPSEC_PORT_L2TPV3_VIRTUAL) + { + if (ret->IsControl == false) + { + // Reserved + if (size < 2) + { + goto LABEL_ERROR; + } + + buf += 2; + size -= 2; + } + } + } + + // Tunnel ID, Session ID + if (size < 4) + { + goto LABEL_ERROR; + } + + if (is_l2tpv3 == false) + { + // L2TP + ret->TunnelId = READ_USHORT(buf); + buf += 2; + size -= 2; + + ret->SessionId = READ_USHORT(buf); + buf += 2; + size -= 2; + } + else + { + // L2TPv3: Only tunnel ID is written in the header + ret->TunnelId = READ_UINT(buf); + buf += 4; + size -= 4; + + // The session ID is not written in the header + ret->SessionId = 0; + + if (ret->IsControl == false) + { + ret->SessionId = ret->TunnelId; + } + } + + if (ret->HasSequence) + { + // Ns, Nr + if (size < 4) + { + goto LABEL_ERROR; + } + + ret->Ns = READ_USHORT(buf); + buf += 2; + size -= 2; + + ret->Nr = READ_USHORT(buf); + buf += 2; + size -= 2; + } + + if (ret->HasOffset) + { + // Offset + if (size < 2) + { + goto LABEL_ERROR; + } + + ret->OffsetSize = READ_USHORT(buf); + buf += 2; + size -= 2; + + if (size < ret->OffsetSize) + { + goto LABEL_ERROR; + } + + buf += ret->OffsetSize; + size -= ret->OffsetSize; + } + + ret->DataSize = size; + ret->Data = Clone(buf, ret->DataSize); + + if (ret->IsControl == false) + { + if (ret->DataSize == 0) + { + goto LABEL_ERROR; + } + } + + if (ret->IsControl) + { + if (ret->DataSize == 0) + { + ret->IsZLB = true; + } + } + + if (ret->IsControl) + { + ret->AvpList = NewListFast(NULL); + + // Parse the AVP field + while (size != 0) + { + L2TP_AVP a; + + Zero(&a, sizeof(a)); + + // Header + if (size < 6) + { + goto LABEL_ERROR; + } + + if (*buf & L2TP_AVP_BIT_MANDATORY) + { + a.Mandatory = true; + } + + if (*buf & L2TP_AVP_BIT_HIDDEN) + { + goto LABEL_ERROR; + } + + a.Length = READ_USHORT(buf) & L2TP_AVP_LENGTH; + + if (a.Length < 6) + { + goto LABEL_ERROR; + } + + buf += 2; + size -= 2; + + a.VendorID = READ_USHORT(buf); + buf += 2; + size -= 2; + + a.Type = READ_USHORT(buf); + buf += 2; + size -= 2; + + a.DataSize = a.Length - 6; + + if (a.DataSize > size) + { + goto LABEL_ERROR; + } + + a.Data = Clone(buf, a.DataSize); + + buf += a.DataSize; + size -= a.DataSize; + + Add(ret->AvpList, Clone(&a, sizeof(a))); + } + } + + if (ret->IsControl && ret->IsZLB == false) + { + // Get the MessageType in the case of Control packet + L2TP_AVP *a = GetAVPValue(ret, L2TP_AVP_TYPE_MESSAGE_TYPE); + if (a == NULL || a->DataSize != 2) + { + goto LABEL_ERROR; + } + + ret->MessageType = READ_USHORT(a->Data); + } + + if (ret->Ver == 3 && ret->IsControl) + { + // Get the Remote Session ID in the case of L2TPv3 + L2TP_AVP *a = GetAVPValue(ret, L2TP_AVP_TYPE_V3_SESSION_ID_REMOTE); + if (a != NULL && a->DataSize == sizeof(UINT)) + { + ret->SessionId = READ_UINT(a->Data); + } + } + + ret->IsYamahaV3 = is_l2tpv3_yamaha; + + return ret; + +LABEL_ERROR: + FreeL2TPPacket(ret); + return NULL; +} + +// Get the AVP value +L2TP_AVP *GetAVPValue(L2TP_PACKET *p, UINT type) +{ + return GetAVPValueEx(p, type, 0); +} +L2TP_AVP *GetAVPValueEx(L2TP_PACKET *p, UINT type, UINT vendor_id) +{ + UINT i; + // Validate arguments + if (p == NULL) + { + return NULL; + } + + for (i = 0;i < LIST_NUM(p->AvpList);i++) + { + L2TP_AVP *a = LIST_DATA(p->AvpList, i); + + if (a->Type == type && a->VendorID == vendor_id) + { + return a; + } + } + + if (vendor_id == 0) + { + if (type == L2TP_AVP_TYPE_V3_TUNNEL_ID) + { + return GetAVPValueEx(p, L2TPV3_CISCO_AVP_TUNNEL_ID, L2TP_AVP_VENDOR_ID_CISCO); + } + else if (type == L2TP_AVP_TYPE_V3_SESSION_ID_LOCAL) + { + return GetAVPValueEx(p, L2TPV3_CISCO_AVP_SESSION_ID_LOCAL, L2TP_AVP_VENDOR_ID_CISCO); + } + else if (type == L2TP_AVP_TYPE_V3_SESSION_ID_REMOTE) + { + return GetAVPValueEx(p, L2TPV3_CISCO_AVP_SESSION_ID_REMOTE, L2TP_AVP_VENDOR_ID_CISCO); + } + } + + return NULL; +} + +// Release the L2TP transmission queue +void FreeL2TPQueue(L2TP_QUEUE *q) +{ + // Validate arguments + if (q == NULL) + { + return; + } + + FreeBuf(q->Buf); + + FreeL2TPPacket(q->L2TPPacket); + + Free(q); +} + +// Sort function of L2TP reception queue +int CmpL2TPQueueForRecv(void *p1, void *p2) +{ + L2TP_QUEUE *q1, *q2; + // Validate arguments + if (p1 == NULL || p2 == NULL) + { + return 0; + } + q1 = *(L2TP_QUEUE **)p1; + q2 = *(L2TP_QUEUE **)p2; + if (q1 == NULL || q2 == NULL) + { + return 0; + } + + if (L2TP_SEQ_LT(q1->Ns, q2->Ns)) + { + return -1; + } + else if (q1->Ns == q2->Ns) + { + return 0; + } + else + { + return 1; + } +} + +// Create a L2TP tunnel +L2TP_TUNNEL *NewL2TPTunnel(L2TP_SERVER *l2tp, L2TP_PACKET *p, UDPPACKET *udp) +{ + L2TP_TUNNEL *t; + L2TP_AVP *a; + // Validate arguments + if (l2tp == NULL || p == NULL || udp == NULL) + { + return NULL; + } + + t = ZeroMalloc(sizeof(L2TP_TUNNEL)); + + if (p->Ver == 3) + { + t->IsV3 = true; + } + + t->SessionList = NewList(NULL); + + Copy(&t->ClientIp, &udp->SrcIP, sizeof(IP)); + t->ClientPort = udp->SrcPort; + + Copy(&t->ServerIp, &udp->DstIP, sizeof(IP)); + t->ServerPort = udp->DestPort; + + // Hostname + a = GetAVPValue(p, L2TP_AVP_TYPE_HOST_NAME); + if (a != NULL && a->DataSize >= 1 && a->DataSize < sizeof(t->HostName)) + { + Copy(t->HostName, a->Data, a->DataSize); + } + else + { + IPToStr(t->HostName, sizeof(t->HostName), &t->ClientIp); + } + + // Vendor Name + a = GetAVPValue(p, L2TP_AVP_TYPE_VENDOR_NAME); + if (a != NULL && a->DataSize >= 1 && a->DataSize < sizeof(t->VendorName)) + { + Copy(t->VendorName, a->Data, a->DataSize); + } + + // Assigned Tunnel ID + a = GetAVPValue(p, (p->Ver == 3 ? L2TP_AVP_TYPE_V3_TUNNEL_ID : L2TP_AVP_TYPE_ASSIGNED_TUNNEL)); + if (a == NULL || a->DataSize != (t->IsV3 ? sizeof(UINT) : sizeof(USHORT))) + { + goto LABEL_ERROR; + } + + t->TunnelId1 = (t->IsV3 ? READ_UINT(a->Data) : READ_USHORT(a->Data)); + t->TunnelId2 = GenerateNewTunnelIdEx(l2tp, &t->ClientIp, t->IsV3); + + if (t->TunnelId2 == 0) + { + goto LABEL_ERROR; + } + + if (p->Ver == 3) + { + // Identify whether it's Cisco + a = GetAVPValueEx(p, L2TPV3_CISCO_AVP_TUNNEL_ID, L2TP_AVP_VENDOR_ID_CISCO); + if (a != NULL) + { + t->IsCiscoV3 = true; + } + + // L2TPv3 on YAMAHA + t->IsYamahaV3 = p->IsYamahaV3; + } + + // Transmission queue + t->SendQueue = NewList(NULL); + + // Reception queue + t->RecvQueue = NewList(CmpL2TPQueueForRecv); + + t->LastRecvTick = l2tp->Now; + t->LastHelloSent = l2tp->Now; + + return t; + +LABEL_ERROR: + FreeL2TPTunnel(t); + return NULL; +} + +// Search a tunnel +L2TP_TUNNEL *GetTunnelFromId(L2TP_SERVER *l2tp, IP *client_ip, UINT tunnel_id, bool is_v3) +{ + UINT i; + // Validate arguments + if (l2tp == NULL || client_ip == 0 || tunnel_id == 0) + { + return NULL; + } + + for (i = 0;i < LIST_NUM(l2tp->TunnelList);i++) + { + L2TP_TUNNEL *t = LIST_DATA(l2tp->TunnelList, i); + + if (t->TunnelId2 == tunnel_id && CmpIpAddr(&t->ClientIp, client_ip) == 0) + { + if (EQUAL_BOOL(t->IsV3, is_v3)) + { + return t; + } + } + } + + return NULL; +} + +// Search the tunnel by the tunnel ID that is assigned by the client +L2TP_TUNNEL *GetTunnelFromIdOfAssignedByClient(L2TP_SERVER *l2tp, IP *client_ip, UINT tunnel_id) +{ + UINT i; + // Validate arguments + if (l2tp == NULL || client_ip == 0 || tunnel_id == 0) + { + return NULL; + } + + for (i = 0;i < LIST_NUM(l2tp->TunnelList);i++) + { + L2TP_TUNNEL *t = LIST_DATA(l2tp->TunnelList, i); + + if (t->TunnelId1 == tunnel_id && CmpIpAddr(&t->ClientIp, client_ip) == 0) + { + return t; + } + } + + return NULL; +} +L2TP_TUNNEL *GetTunnelFromIdOfAssignedByClientEx(L2TP_SERVER *l2tp, IP *client_ip, UINT tunnel_id, bool is_v3) +{ + UINT i; + // Validate arguments + if (l2tp == NULL || client_ip == 0 || tunnel_id == 0) + { + return NULL; + } + + for (i = 0;i < LIST_NUM(l2tp->TunnelList);i++) + { + L2TP_TUNNEL *t = LIST_DATA(l2tp->TunnelList, i); + + if (t->TunnelId1 == tunnel_id && CmpIpAddr(&t->ClientIp, client_ip) == 0) + { + if (EQUAL_BOOL(t->IsV3, is_v3)) + { + return t; + } + } + } + + return NULL; +} + +// Create a new tunnel ID +UINT GenerateNewTunnelId(L2TP_SERVER *l2tp, IP *client_ip) +{ + return GenerateNewTunnelIdEx(l2tp, client_ip, false); +} +UINT GenerateNewTunnelIdEx(L2TP_SERVER *l2tp, IP *client_ip, bool is_32bit) +{ + UINT id; + UINT max_number = 0xffff; + // Validate arguments + if (l2tp == NULL || client_ip == NULL) + { + return 0; + } + + if (is_32bit) + { + max_number = 0xfffffffe; + } + + for (id = 1;id <= max_number;id++) + { + if (GetTunnelFromId(l2tp, client_ip, id, is_32bit) == NULL) + { + return id; + } + } + + return 0; +} + +// Release the L2TP tunnel +void FreeL2TPTunnel(L2TP_TUNNEL *t) +{ + UINT i; + // Validate arguments + if (t == NULL) + { + return; + } + + for (i = 0;i < LIST_NUM(t->SessionList);i++) + { + L2TP_SESSION *s = LIST_DATA(t->SessionList, i); + + FreeL2TPSession(s); + } + + ReleaseList(t->SessionList); + + for (i = 0;i < LIST_NUM(t->SendQueue);i++) + { + L2TP_QUEUE *q = LIST_DATA(t->SendQueue, i); + + FreeL2TPQueue(q); + } + + ReleaseList(t->SendQueue); + + for (i = 0;i < LIST_NUM(t->RecvQueue);i++) + { + L2TP_QUEUE *q = LIST_DATA(t->RecvQueue, i); + + FreeL2TPQueue(q); + } + + ReleaseList(t->RecvQueue); + + Free(t); +} + +// Generate a new L2TP control packet +L2TP_PACKET *NewL2TPControlPacket(UINT message_type, bool is_v3) +{ + L2TP_PACKET *p = ZeroMalloc(sizeof(L2TP_PACKET)); + + p->IsControl = true; + p->HasLength = true; + p->HasSequence = true; + p->Ver = (is_v3 ? 3 : 2); + p->MessageType = message_type; + + p->AvpList = NewListFast(NULL); + + if (message_type != 0) + { + L2TP_AVP *a; + USHORT us; + + a = ZeroMalloc(sizeof(L2TP_AVP)); + + a->Type = L2TP_AVP_TYPE_MESSAGE_TYPE; + a->Mandatory = true; + + us = Endian16(message_type); + a->Data = Clone(&us, sizeof(USHORT)); + a->DataSize = sizeof(USHORT); + + Add(p->AvpList, a); + } + + return p; +} + +// Create a new AVP value +L2TP_AVP *NewAVP(USHORT type, bool mandatory, USHORT vendor_id, void *data, UINT data_size) +{ + L2TP_AVP *a; + // Validate arguments + if (data_size != 0 && data == NULL) + { + return NULL; + } + + a = ZeroMalloc(sizeof(L2TP_AVP)); + + a->Type = type; + a->Mandatory = mandatory; + a->VendorID = vendor_id; + a->Data = Clone(data, data_size); + a->DataSize = data_size; + + return a; +} + +// Process a received L2TP packet +void L2TPProcessRecvControlPacket(L2TP_SERVER *l2tp, L2TP_TUNNEL *t, L2TP_PACKET *p) +{ + // Validate arguments + if (l2tp == NULL || t == NULL || p == NULL) + { + return; + } + + if (p->SessionId == 0) + { + if (p->MessageType == L2TP_MESSAGE_TYPE_SCCCN && l2tp->Halt == false) + { + // Tunnel establishment completed + if (t->Established == false) + { + if (t->Disconnecting == false) + { + t->Established = true; + t->LastHelloSent = l2tp->Now; + } + } + } + + if (t->Established) + { + if (p->MessageType == L2TP_MESSAGE_TYPE_ICRQ && t->WantToDisconnect == false && l2tp->Halt == false) + { + // Request to establish a new session arrives + L2TP_AVP *a = GetAVPValue(p, + (t->IsV3 ? L2TP_AVP_TYPE_V3_SESSION_ID_LOCAL : L2TP_AVP_TYPE_ASSIGNED_SESSION)); + if (a != NULL && a->DataSize == (t->IsV3 ? sizeof(UINT) : sizeof(USHORT)) && IsZero(a->Data, (t->IsV3 ? sizeof(UINT) : sizeof(USHORT))) == false) + { + UINT session_id = (t->IsV3 ? READ_UINT(a->Data) : READ_USHORT(a->Data)); + + // Check whether there is other same session ID + if (GetSessionFromIdAssignedByClient(t, session_id) == NULL) + { + // Create a session + L2TP_SESSION *s = NewL2TPSession(l2tp, t, session_id); + + if (s != NULL) + { + L2TP_PACKET *pp; + USHORT us; + UINT ui; + + // Get the PseudowireType + if (t->IsV3) + { + s->PseudowireType = L2TPV3_PW_TYPE_ETHERNET; + + a = GetAVPValue(p, L2TP_AVP_TYPE_V3_PW_TYPE); + + if (a != NULL && a->DataSize == sizeof(USHORT)) + { + ui = READ_USHORT(a->Data); + + s->PseudowireType = ui; + } + } + + Add(t->SessionList, s); + Debug("L2TP New Session: ID = %u/%u on Tunnel %u/%u\n", s->SessionId1, s->SessionId2, + t->TunnelId1, t->TunnelId2); + + // Respond the session creation completion notice + pp = NewL2TPControlPacket(L2TP_MESSAGE_TYPE_ICRP, s->IsV3); + + // Assigned Session AVP + if (s->IsV3 == false) + { + us = Endian16(s->SessionId2); + Add(pp->AvpList, NewAVP(L2TP_AVP_TYPE_ASSIGNED_SESSION, true, 0, &us, sizeof(USHORT))); + } + else + { + ui = Endian32(s->SessionId2); + Add(pp->AvpList, NewAVP(L2TP_AVP_TYPE_V3_SESSION_ID_LOCAL, true, 0, &ui, sizeof(UINT))); + + if (s->IsCiscoV3) + { + Add(pp->AvpList, NewAVP(L2TPV3_CISCO_AVP_SESSION_ID_LOCAL, true, L2TP_AVP_VENDOR_ID_CISCO, &ui, sizeof(UINT))); + } + } + + if (s->IsV3) + { + if (t->IsYamahaV3 == false) + { + // Pseudowire AVP + us = Endian16(s->PseudowireType); + Add(pp->AvpList, NewAVP(L2TP_AVP_TYPE_V3_PW_TYPE, true, 0, &us, sizeof(USHORT))); + } + + if (s->IsCiscoV3) + { + Add(pp->AvpList, NewAVP(L2TPV3_CISCO_AVP_PW_TYPE, true, L2TP_AVP_VENDOR_ID_CISCO, &us, sizeof(USHORT))); + } + + if (t->IsYamahaV3) + { + us = Endian16(0x0003); + Add(pp->AvpList, NewAVP(L2TP_AVP_TYPE_V3_CIRCUIT_STATUS, true, 0, &us, sizeof(USHORT))); + } + } + + SendL2TPControlPacket(l2tp, t, session_id, pp); + + FreeL2TPPacket(pp); + } + } + } + } + else if (p->MessageType == L2TP_MESSAGE_TYPE_STOPCCN) + { + // Tunnel disconnect request arrives + L2TP_AVP *a = GetAVPValue(p, (t->IsV3 ? L2TP_AVP_TYPE_V3_TUNNEL_ID : L2TP_AVP_TYPE_ASSIGNED_TUNNEL)); + if (a != NULL && a->DataSize == (t->IsV3 ? sizeof(UINT) : sizeof(USHORT))) + { + UINT ui = (t->IsV3 ? READ_UINT(a->Data) : READ_USHORT(a->Data)); + + if (ui == t->TunnelId1) + { + // Disconnect the tunnel + DisconnectL2TPTunnel(t); + } + } + } + } + } + else + { + // Search a session + L2TP_SESSION *s = GetSessionFromId(t, p->SessionId); + + if (s != NULL) + { + if (s->Established == false) + { + if (p->MessageType == L2TP_MESSAGE_TYPE_ICCN) + { + // Session establishment completed + if (s->Disconnecting == false) + { + s->Established = true; + } + } + } + else + { + if (p->MessageType == L2TP_MESSAGE_TYPE_CDN) + { + // Received a session disconnection request + L2TP_AVP *a = GetAVPValue(p, + (t->IsV3 ? L2TP_AVP_TYPE_V3_SESSION_ID_LOCAL : L2TP_AVP_TYPE_ASSIGNED_SESSION)); + if (a != NULL && a->DataSize == (t->IsV3 ? sizeof(UINT) : sizeof(USHORT))) + { + UINT ui = (t->IsV3 ? READ_UINT(a->Data) : READ_USHORT(a->Data)); + + if (ui == s->SessionId1) + { + // Disconnect the session + DisconnectL2TPSession(t, s); + } + } + } + } + } + else + { + Debug("Session ID %u not found in Tunnel ID %u/%u\n", p->SessionId, t->TunnelId1, t->TunnelId2); + } + } +} + +// Disconnect the L2TP tunnel +void DisconnectL2TPTunnel(L2TP_TUNNEL *t) +{ + // Validate arguments + if (t == NULL) + { + return; + } + + if (/*t->Established && */t->Disconnecting == false && t->WantToDisconnect == false) + { + UINT i; + + Debug("Trying to Disconnect Tunnel ID %u/%u\n", t->TunnelId1, t->TunnelId2); + t->WantToDisconnect = true; + + // Disconnect all sessions within the tunnel + for (i = 0;i < LIST_NUM(t->SessionList);i++) + { + L2TP_SESSION *s = LIST_DATA(t->SessionList, i); + + DisconnectL2TPSession(t, s); + } + } +} + +// Disconnect the L2TP session +void DisconnectL2TPSession(L2TP_TUNNEL *t, L2TP_SESSION *s) +{ + // Validate arguments + if (t == NULL || s == NULL) + { + return; + } + + if (s->Established && s->Disconnecting == false && s->WantToDisconnect == false) + { + Debug("Trying to Disconnect Session ID %u/%u on Tunnel %u/%u\n", s->SessionId1, s->SessionId2, + t->TunnelId1, t->TunnelId2); + s->WantToDisconnect = true; + } +} + +// Create a new session +L2TP_SESSION *NewL2TPSession(L2TP_SERVER *l2tp, L2TP_TUNNEL *t, UINT session_id_by_client) +{ + L2TP_SESSION *s; + UINT session_id_by_server; + // Validate arguments + if (l2tp == NULL || t == NULL || session_id_by_client == 0) + { + return NULL; + } + + if (LIST_NUM(t->SessionList) >= L2TP_QUOTA_MAX_NUM_SESSIONS_PER_TUNNEL) + { + return NULL; + } + + if (t->IsV3 == false) + { + session_id_by_server = GenerateNewSessionIdEx(t, t->IsV3); + } + else + { + session_id_by_server = GenerateNewSessionIdForL2TPv3(l2tp); + } + if (session_id_by_server == 0) + { + return NULL; + } + + s = ZeroMalloc(sizeof(L2TP_SESSION)); + + s->SessionId1 = session_id_by_client; + s->SessionId2 = session_id_by_server; + + s->IsV3 = t->IsV3; + s->IsCiscoV3 = t->IsCiscoV3; + + s->Tunnel = t; + + return s; +} + +// Retrieve a session from L2TP session ID +L2TP_SESSION *SearchL2TPSessionById(L2TP_SERVER *l2tp, bool is_v3, UINT id) +{ + UINT i, j; + // Validate arguments + if (l2tp == NULL || id == 0) + { + return NULL; + } + + for (i = 0;i < LIST_NUM(l2tp->TunnelList);i++) + { + L2TP_TUNNEL *t = LIST_DATA(l2tp->TunnelList, i); + + for (j = 0;j < LIST_NUM(t->SessionList);j++) + { + L2TP_SESSION *s = LIST_DATA(t->SessionList, j); + + if (s->SessionId2 == id) + { + if (EQUAL_BOOL(s->IsV3, is_v3)) + { + return s; + } + } + } + } + + return NULL; +} + +// Create a new session ID +UINT GenerateNewSessionId(L2TP_TUNNEL *t) +{ + return GenerateNewSessionIdEx(t, false); +} +UINT GenerateNewSessionIdEx(L2TP_TUNNEL *t, bool is_32bit) +{ + UINT i; + UINT max_number = 0xffff; + // Validate arguments + if (t == NULL) + { + return 0; + } + + if (is_32bit) + { + max_number = 0xfffffffe; + } + + for (i = 1;i <= max_number;i++) + { + if (GetSessionFromId(t, i) == NULL) + { + return i; + } + } + + return 0; +} +UINT GenerateNewSessionIdForL2TPv3(L2TP_SERVER *l2tp) +{ + // Validate arguments + if (l2tp == NULL) + { + return 0; + } + + while (true) + { + UINT id = Rand32(); + + if (id == 0 || id == 0xffffffff) + { + continue; + } + + if (SearchL2TPSessionById(l2tp, true, id) == false) + { + return id; + } + } +} + +// Release the session +void FreeL2TPSession(L2TP_SESSION *s) +{ + // Validate arguments + if (s == NULL) + { + return; + } + + Free(s); +} + +// Search a session from the session ID +L2TP_SESSION *GetSessionFromId(L2TP_TUNNEL *t, UINT session_id) +{ + UINT i; + // Validate arguments + if (t == NULL || session_id == 0) + { + return NULL; + } + + for (i = 0;i < LIST_NUM(t->SessionList);i++) + { + L2TP_SESSION *s = LIST_DATA(t->SessionList, i); + + if (s->SessionId2 == session_id) + { + return s; + } + } + + return NULL; +} + +// Search a session from the session ID (Search by ID assigned from the client side) +L2TP_SESSION *GetSessionFromIdAssignedByClient(L2TP_TUNNEL *t, UINT session_id) +{ + UINT i; + // Validate arguments + if (t == NULL || session_id == 0) + { + return NULL; + } + + for (i = 0;i < LIST_NUM(t->SessionList);i++) + { + L2TP_SESSION *s = LIST_DATA(t->SessionList, i); + + if (s->SessionId1 == session_id) + { + return s; + } + } + + return NULL; +} + +// Get the number of L2TP sessions connected from the client IP address +UINT GetNumL2TPTunnelsByClientIP(L2TP_SERVER *l2tp, IP *client_ip) +{ + UINT i, ret; + // Validate arguments + if (l2tp == NULL || client_ip == NULL) + { + return 0; + } + + ret = 0; + + for (i = 0;i < LIST_NUM(l2tp->TunnelList);i++) + { + L2TP_TUNNEL *t = LIST_DATA(l2tp->TunnelList, i); + + if (CmpIpAddr(&t->ClientIp, client_ip) == 0) + { + ret++; + } + } + + return ret; +} + +// Performs processing L2TP received packets. +void ProcL2TPPacketRecv(L2TP_SERVER *l2tp, UDPPACKET *p) +{ + L2TP_PACKET *pp; + bool no_free = false; + // Validate arguments + if (l2tp == NULL || p == NULL) + { + return; + } + + // Parse a packet. + pp = ParseL2TPPacket(p); + if (pp == NULL) + { + return; + } + + if (pp->MessageType == L2TP_MESSAGE_TYPE_SCCRQ && pp->SessionId == 0 && pp->TunnelId == 0 && + pp->Nr == 0 && pp->Ns == 0 && l2tp->Halt == false) + { + { + L2TP_AVP *a = GetAVPValue(pp, (pp->Ver == 3 ? L2TP_AVP_TYPE_V3_TUNNEL_ID : L2TP_AVP_TYPE_ASSIGNED_TUNNEL)); + if (a != NULL && a->DataSize == (pp->Ver == 3 ? sizeof(UINT) : sizeof(USHORT))) + { + UINT client_assigned_id = (pp->Ver == 3 ? READ_UINT(a->Data) : READ_USHORT(a->Data)); + if (GetTunnelFromIdOfAssignedByClient(l2tp, &p->SrcIP, client_assigned_id) == NULL) + { + if (LIST_NUM(l2tp->TunnelList) < L2TP_QUOTA_MAX_NUM_TUNNELS && GetNumL2TPTunnelsByClientIP(l2tp, &p->SrcIP) < L2TP_QUOTA_MAX_NUM_TUNNELS_PER_IP) + { + char ipstr[MAX_SIZE]; + L2TP_PACKET *pp2; + UCHAR protocol_version[2]; + UCHAR caps_data[4]; + USHORT us; + char hostname[MAX_SIZE]; + + // Begin Tunneling + L2TP_TUNNEL *t = NewL2TPTunnel(l2tp, pp, p); + + if (t != NULL) + { + IPToStr(ipstr, sizeof(ipstr), &t->ClientIp); + Debug("L2TP New Tunnel From %s (%s, %s): New Tunnel ID = %u/%u\n", ipstr, t->HostName, t->VendorName, + t->TunnelId1, t->TunnelId2); + + // Add the tunnel to the list + Add(l2tp->TunnelList, t); + + // Respond with SCCEP to SCCRQ + pp2 = NewL2TPControlPacket(L2TP_MESSAGE_TYPE_SCCRP, t->IsV3); + + if (t->IsYamahaV3 == false) + { + // Protocol Version + protocol_version[0] = 1; + protocol_version[1] = 0; + Add(pp2->AvpList, NewAVP(L2TP_AVP_TYPE_PROTOCOL_VERSION, true, 0, protocol_version, sizeof(protocol_version))); + + // Framing Capabilities + Zero(caps_data, sizeof(caps_data)); + if (t->IsV3 == false) + { + caps_data[3] = 3; + } + Add(pp2->AvpList, NewAVP(L2TP_AVP_TYPE_FRAME_CAP, false, 0, caps_data, sizeof(caps_data))); + } + + if (t->IsV3 == false) + { + // Bearer Capabilities + Zero(caps_data, sizeof(caps_data)); + caps_data[3] = 3; + Add(pp2->AvpList, NewAVP(L2TP_AVP_TYPE_BEARER_CAP, false, 0, caps_data, sizeof(caps_data))); + } + + // Host Name + GetMachineHostName(hostname, sizeof(hostname)); + if (IsEmptyStr(hostname)) + { + StrCpy(hostname, sizeof(hostname), "vpn"); + } + Add(pp2->AvpList, NewAVP(L2TP_AVP_TYPE_HOST_NAME, true, 0, hostname, StrLen(hostname))); + + // Vendor Name + if (t->IsYamahaV3 == false) + { + Add(pp2->AvpList, NewAVP(L2TP_AVP_TYPE_VENDOR_NAME, false, 0, L2TP_VENDOR_NAME, StrLen(L2TP_VENDOR_NAME))); + } + else + { + char *yamaha_str = "YAMAHA Corporation"; + Add(pp2->AvpList, NewAVP(L2TP_AVP_TYPE_VENDOR_NAME, false, 0, yamaha_str, StrLen(yamaha_str))); + } + + if (t->IsYamahaV3) + { + UINT zero = 0; + Add(pp2->AvpList, NewAVP(L2TP_AVP_TYPE_V3_ROUTER_ID, true, 0, &zero, sizeof(UINT))); + } + + // Assigned Tunnel ID + if (t->IsV3 == false) + { + us = Endian16(t->TunnelId2); + Add(pp2->AvpList, NewAVP(L2TP_AVP_TYPE_ASSIGNED_TUNNEL, true, 0, &us, sizeof(USHORT))); + } + else + { + UINT ui = Endian32(t->TunnelId2); + Add(pp2->AvpList, NewAVP(L2TP_AVP_TYPE_V3_TUNNEL_ID, true, 0, &ui, sizeof(UINT))); + + if (t->IsCiscoV3) + { + Add(pp2->AvpList, NewAVP(L2TPV3_CISCO_AVP_TUNNEL_ID, true, L2TP_AVP_VENDOR_ID_CISCO, &ui, sizeof(UINT))); + } + } + + // Pseudowire Capabilities List + if (t->IsV3) + { + // Only Ethernet + USHORT cap_list[2]; + cap_list[0] = Endian16(L2TPV3_PW_TYPE_ETHERNET); + cap_list[1] = Endian16(L2TPV3_PW_TYPE_ETHERNET_VLAN); + Add(pp2->AvpList, NewAVP(L2TP_AVP_TYPE_V3_PW_CAP_LIST, true, 0, cap_list, sizeof(cap_list))); + + if (t->IsCiscoV3) + { + Add(pp2->AvpList, NewAVP(L2TPV3_CISCO_AVP_PW_CAP_LIST, true, L2TP_AVP_VENDOR_ID_CISCO, cap_list, sizeof(cap_list))); + } + } + + // Cisco AVP + if (t->IsCiscoV3) + { + USHORT us = Endian16(1); + Add(pp2->AvpList, NewAVP(L2TPV3_CISCO_AVP_DRAFT_AVP_VERSION, true, L2TP_AVP_VENDOR_ID_CISCO, &us, sizeof(USHORT))); + } + + // Recv Window Size + if (t->IsYamahaV3 == false) + { + us = Endian16(L2TP_WINDOW_SIZE); + Add(pp2->AvpList, NewAVP(L2TP_AVP_TYPE_RECV_WINDOW_SIZE, false, 0, &us, sizeof(USHORT))); + } + + SendL2TPControlPacket(l2tp, t, 0, pp2); + + FreeL2TPPacket(pp2); + } + } + } + } + } + } + else + { + // Process related to the existing tunnel + // Find the tunnel + L2TP_TUNNEL *t = NULL; + L2TP_SESSION *l2tpv3_session = NULL; + + if (pp->IsControl || pp->Ver != 3) + { + t = GetTunnelFromId(l2tp, &p->SrcIP, pp->TunnelId, pp->Ver == 3); + } + else + { + l2tpv3_session = SearchL2TPSessionById(l2tp, true, pp->SessionId); + if (l2tpv3_session != NULL) + { + t = l2tpv3_session->Tunnel; + + pp->TunnelId = t->TunnelId2; + } + } + + if (t == NULL) + { + char ipstr[MAX_SIZE]; + + IPToStr(ipstr, sizeof(ipstr), &p->SrcIP); + Debug("L2TP Tunnel From %s ID=%u Not Found on the Table.\n", ipstr, pp->TunnelId); + } + else + { + // Update last reception time + t->LastRecvTick = l2tp->Now; + + if (pp->IsControl) + { + // Control packet + UINT i; + LIST *o = NULL; + L2TP_QUEUE *q; + L2TP_QUEUE tt; + + // Delete the queue that the other party has already received from the retransmission queue + for (i = 0;i < LIST_NUM(t->SendQueue);i++) + { + L2TP_QUEUE *q = LIST_DATA(t->SendQueue, i); + if (L2TP_SEQ_LT(q->Ns, pp->Nr)) + { + if (o == NULL) + { + o = NewListFast(NULL); + } + + Add(o, q); + } + } + + if (o != NULL) + { + for (i = 0;i < LIST_NUM(o);i++) + { + L2TP_QUEUE *q = LIST_DATA(o, i); + + Delete(t->SendQueue, q); + + FreeL2TPQueue(q); + } + + ReleaseList(o); + } + + if ((!L2TP_SEQ_LT(pp->Ns, t->LastNr)) && (pp->Ns != t->LastNr)) + { + // Add the packet received from the opposite to the queue + if (LIST_NUM(t->RecvQueue) < L2TP_WINDOW_SIZE) + { + Zero(&tt, sizeof(tt)); + tt.Ns = pp->Ns; + + if (Search(t->RecvQueue, &tt) == NULL) + { + q = ZeroMalloc(sizeof(L2TP_QUEUE)); + q->Ns = pp->Ns; + q->L2TPPacket = pp; + no_free = true; + Insert(t->RecvQueue, q); + + // Read to the end of completed part from the head of the queue + while (true) + { + L2TP_QUEUE *q; + if (LIST_NUM(t->RecvQueue) == 0) + { + break; + } + + q = LIST_DATA(t->RecvQueue, 0); + if (!L2TP_SEQ_EQ(q->Ns, t->LastNr + 1)) + { + break; + } + + if (q->L2TPPacket->IsZLB == false) + { + t->LastNr = q->Ns; + + // The packet other than ZLB is treated + t->StateChanged = true; + } + + Delete(t->RecvQueue, q); + + // Process the received packet + L2TPProcessRecvControlPacket(l2tp, t, q->L2TPPacket); + + FreeL2TPQueue(q); + } + } + } + } + else + { + // Reply ACK for already-received packets + if (pp->IsZLB == false) + { + // The packet other than ZLB is treated + t->StateChanged = true; + } + } + } + else + { + // Data packet + L2TP_SESSION *s = GetSessionFromId(t, pp->SessionId); + + if (s != NULL && s->Established) + { + if (s->IsV3 == false) + { + // Start the L2TP thread (If not already started) + StartL2TPThread(l2tp, t, s); + + // Pass the data + TubeSendEx(s->TubeRecv, pp->Data, pp->DataSize, NULL, true); + AddTubeToFlushList(l2tp->FlushList, s->TubeRecv); + } + else + { + BLOCK *b; + + // Start the EtherIP session (If it's not have yet started) + L2TPSessionManageEtherIPServer(l2tp, s); + + // Pass the data + b = NewBlock(pp->Data, pp->DataSize, 0); + + EtherIPProcRecvPackets(s->EtherIP, b); + + Free(b); + } + } + } + } + } + + if (no_free == false) + { + FreeL2TPPacket(pp); + } +} + +// Manage the EtherIP server that is associated with the L2TP session +void L2TPSessionManageEtherIPServer(L2TP_SERVER *l2tp, L2TP_SESSION *s) +{ + IKE_SERVER *ike; + IKE_CLIENT *c; + // Validate arguments + if (l2tp == NULL || s == NULL) + { + return; + } + + if (l2tp->IkeClient == NULL || l2tp->IkeServer == NULL) + { + return; + } + + ike = l2tp->IkeServer; + c = l2tp->IkeClient; + + if (s->EtherIP == NULL) + { + char crypt_name[MAX_SIZE]; + UINT crypt_block_size = IKE_MAX_BLOCK_SIZE; + + Zero(crypt_name, sizeof(crypt_name)); + + if (c->CurrentIpSecSaRecv != NULL) + { + Format(crypt_name, sizeof(crypt_name), + "IPsec - %s (%u bits)", + c->CurrentIpSecSaRecv->TransformSetting.Crypto->Name, + c->CurrentIpSecSaRecv->TransformSetting.CryptoKeySize * 8); + + crypt_block_size = c->CurrentIpSecSaRecv->TransformSetting.Crypto->BlockSize; + } + + s->EtherIP = NewEtherIPServer(ike->Cedar, ike->IPsec, ike, + &c->ClientIP, c->ClientPort, + &c->ServerIP, c->ServerPort, crypt_name, + c->IsL2TPOnIPsecTunnelMode, crypt_block_size, c->ClientId, + ++ike->CurrentEtherId); + + StrCpy(s->EtherIP->VendorName, sizeof(s->EtherIP->VendorName), s->Tunnel->VendorName); + + s->EtherIP->L2TPv3 = true; + + Debug("IKE_CLIENT 0x%X: EtherIP Server Started.\n", c); + + IPsecLog(ike, c, NULL, NULL, NULL, "LI_ETHERIP_SERVER_STARTED", ike->CurrentEtherId); + } + else + { + StrCpy(s->EtherIP->ClientId, sizeof(s->EtherIP->ClientId), c->ClientId); + } + + if (s->EtherIP->Interrupts == NULL) + { + s->EtherIP->Interrupts = l2tp->Interrupts; + } + + if (s->EtherIP->SockEvent == NULL) + { + SetEtherIPServerSockEvent(s->EtherIP, l2tp->SockEvent); + } + + s->EtherIP->Now = l2tp->Now; +} + +// Calculate the appropriate MSS of the L2TP +UINT CalcL2TPMss(L2TP_SERVER *l2tp, L2TP_TUNNEL *t, L2TP_SESSION *s) +{ + UINT ret; + // Validate arguments + if (l2tp == NULL || t == NULL || s == NULL) + { + return 0; + } + + ret = MTU_FOR_PPPOE; + + if (l2tp->IkeServer != NULL) + { + // On IPsec + if (l2tp->IsIPsecIPv6) + { + ret -= 40; + } + else + { + ret -= 20; + } + + // UDP + ret -= 8; + + // ESP + ret -= 20 + l2tp->CryptBlockSize * 2; + } + else + { + // Raw L2TP + if (IsIP6(&t->ClientIp)) + { + ret -= 40; + } + else + { + ret -= 20; + } + } + + // L2TP UDP + ret -= 8; + + // L2TP + ret -= 8; + + // PPP + ret -= 4; + + // Target communication + ret -= 20; + + // TCP header + ret -= 20; + + return ret; +} + +// Start the L2TP thread +void StartL2TPThread(L2TP_SERVER *l2tp, L2TP_TUNNEL *t, L2TP_SESSION *s) +{ + PPP_SESSION* underlyingSession; + // Validate arguments + if (l2tp == NULL || t == NULL || s == NULL) + { + return; + } + + if (s->HasThread == false) + { + char tmp[MAX_SIZE]; + + Debug("Thread Created for Session %u/%u on Tunnel %u/%u\n", + s->SessionId1, s->SessionId2, t->TunnelId1, t->TunnelId2); + + s->HasThread = true; + + NewTubePair(&s->TubeSend, &s->TubeRecv, 0); + SetTubeSockEvent(s->TubeSend, l2tp->SockEvent); + + if (IsEmptyStr(t->VendorName) == false) + { + Format(tmp, sizeof(tmp), L2TP_IPC_CLIENT_NAME_TAG, t->VendorName); + } + else + { + StrCpy(tmp, sizeof(tmp), L2TP_IPC_CLIENT_NAME_NO_TAG); + } + + // Create a PPP thread + underlyingSession = NewPPPSession(l2tp->Cedar, &t->ClientIp, t->ClientPort, &t->ServerIp, t->ServerPort, + s->TubeSend, s->TubeRecv, L2TP_IPC_POSTFIX, tmp, t->HostName, l2tp->CryptName, + CalcL2TPMss(l2tp, t, s)); + s->Thread = underlyingSession->SessionThread; + s->PPPSession = underlyingSession; + } +} + +// Stop the L2TP thread +void StopL2TPThread(L2TP_SERVER *l2tp, L2TP_TUNNEL *t, L2TP_SESSION *s) +{ + THREAD *thread; + // Validate arguments + if (l2tp == NULL || t == NULL || s == NULL) + { + return; + } + + if (s->IsV3) + { + // Process the L2TPv3 + if (s->EtherIP != NULL) + { + // Release the EtherIP server + ReleaseEtherIPServer(s->EtherIP); + s->EtherIP = NULL; + } + return; + } + + if (s->HasThread == false) + { + return; + } + thread = s->Thread; + s->Thread = NULL; + s->HasThread = false; + + // Disconnect the tube + TubeDisconnect(s->TubeRecv); + TubeDisconnect(s->TubeSend); + + // Release the tube + ReleaseTube(s->TubeRecv); + ReleaseTube(s->TubeSend); + + s->TubeRecv = NULL; + s->TubeSend = NULL; + + // Pass the thread to termination list + if (l2tp->IkeServer == NULL) + { + AddThreadToThreadList(l2tp->ThreadList, thread); + } + else + { + AddThreadToThreadList(l2tp->IkeServer->ThreadList, thread); + } + + Debug("Thread Stopped for Session %u/%u on Tunnel %u/%u\n", + s->SessionId1, s->SessionId2, t->TunnelId1, t->TunnelId2); + + // Release the thread + ReleaseThread(thread); +} + +// Interrupt processing of L2TP server +void L2TPProcessInterrupts(L2TP_SERVER *l2tp) +{ + UINT i, j; + LIST *delete_tunnel_list = NULL; + // Validate arguments + if (l2tp == NULL) + { + return; + } + + if (l2tp->Halt) + { + if (l2tp->Halting == false) + { + l2tp->Halting = true; + + // Disconnect all tunnels + for (i = 0;i < LIST_NUM(l2tp->TunnelList);i++) + { + L2TP_TUNNEL *t = LIST_DATA(l2tp->TunnelList, i); + + DisconnectL2TPTunnel(t); + } + } + } + + // Flush + FlushTubeFlushList(l2tp->FlushList); + + // Enumerate all tunnels + for (i = 0;i < LIST_NUM(l2tp->TunnelList);i++) + { + L2TP_TUNNEL *t = LIST_DATA(l2tp->TunnelList, i); + LIST *delete_session_list = NULL; + UINT64 l2tpTimeout = L2TP_TUNNEL_TIMEOUT; + + // If we got on ANY session a higher timeout than the default L2TP tunnel timeout, increase it + for (i = 0; i < LIST_NUM(t->SessionList); i++) + { + L2TP_SESSION* s = LIST_DATA(t->SessionList, i); + + if (s->PPPSession != NULL && s->PPPSession->DataTimeout > l2tpTimeout) + { + l2tpTimeout = s->PPPSession->DataTimeout; + } + } + + + if ((l2tp->Now >= (t->LastRecvTick + (UINT64)l2tpTimeout)) && t->Timedout == false) + { + // Disconnect the tunnel forcibly if data can not be received for a certain period of time + t->Timedout = true; + + Debug("L2TP Tunnel %u/%u Timed out.\n", t->TunnelId1, t->TunnelId2); + DisconnectL2TPTunnel(t); + } + + if (t->Established && (l2tp->Now >= (t->LastHelloSent + (UINT64)L2TP_HELLO_INTERVAL))) + { + if (LIST_NUM(t->SendQueue) <= L2TP_HELLO_SUPRESS_MAX_THRETHORD_NUM_SEND_QUEUE) + { + L2TP_PACKET *pp = NewL2TPControlPacket(L2TP_MESSAGE_TYPE_HELLO, t->IsV3); + + // Send a Hello message + t->LastHelloSent = l2tp->Now; + //Debug("L2TP Sending Hello %u/%u: tick=%I64u\n", t->TunnelId1, t->TunnelId2, l2tp->Now); + + SendL2TPControlPacket(l2tp, t, 0, pp); + + FreeL2TPPacket(pp); + + L2TPAddInterrupt(l2tp, t->LastHelloSent + (UINT64)L2TP_HELLO_INTERVAL); + } + } + + // Enumerate all sessions + for (j = 0;j < LIST_NUM(t->SessionList);j++) + { + L2TP_SESSION *s = LIST_DATA(t->SessionList, j); + + if (s->HasThread) + { + // Send packet data + while (true) + { + TUBEDATA *d = TubeRecvAsync(s->TubeSend); + + if (d == NULL) + { + break; + } + + SendL2TPDataPacket(l2tp, t, s, d->Data, d->DataSize); + + FreeTubeData(d); + } + + if (IsTubeConnected(s->TubeSend) == false) + { + // Disconnect the this session because the PPP thread ends + DisconnectL2TPSession(t, s); + } + } + + if (s->IsV3) + { + if (s->EtherIP != NULL) + { + UINT k; + + L2TPSessionManageEtherIPServer(l2tp, s); + + // Notify an interrupt to the EtherIP module + EtherIPProcInterrupts(s->EtherIP); + + // Send an EtherIP packet data + for (k = 0;k < LIST_NUM(s->EtherIP->SendPacketList);k++) + { + BLOCK *b = LIST_DATA(s->EtherIP->SendPacketList, k); + + SendL2TPDataPacket(l2tp, t, s, b->Buf, b->Size); + + FreeBlock(b); + } + + DeleteAll(s->EtherIP->SendPacketList); + } + } + + if (s->WantToDisconnect && s->Disconnecting == false) + { + // Disconnect the session + UCHAR error_data[4]; + USHORT us; + UINT ui; + UINT ppp_error_1 = 0, ppp_error_2 = 0; + + // Send the session disconnection response + L2TP_PACKET *pp = NewL2TPControlPacket(L2TP_MESSAGE_TYPE_CDN, s->IsV3); + + if (s->TubeRecv != NULL) + { + ppp_error_1 = s->TubeRecv->IntParam1; + ppp_error_2 = s->TubeRecv->IntParam2; + } + + // Assigned Session ID + if (s->IsV3 == false) + { + us = Endian16(s->SessionId2); + Add(pp->AvpList, NewAVP(L2TP_AVP_TYPE_ASSIGNED_SESSION, true, 0, + &us, sizeof(USHORT))); + } + else + { + ui = Endian16(s->SessionId2); + Add(pp->AvpList, NewAVP(L2TP_AVP_TYPE_V3_SESSION_ID_LOCAL, true, 0, + &ui, sizeof(UINT))); + + if (t->IsCiscoV3) + { + Add(pp->AvpList, NewAVP(L2TPV3_CISCO_AVP_SESSION_ID_LOCAL, true, L2TP_AVP_VENDOR_ID_CISCO, + &ui, sizeof(UINT))); + } + } + + // Result-Error Code + Zero(error_data, sizeof(error_data)); + error_data[1] = 0x03; + Add(pp->AvpList, NewAVP(L2TP_AVP_TYPE_RESULT_CODE, true, 0, + error_data, sizeof(error_data))); + + if (ppp_error_1 != 0) + { + // PPP Disconnect Cause Code AVP + BUF *b = NewBuf(); + UCHAR uc; + USHORT us; + + // Disconnect Code + us = Endian16(ppp_error_1); + WriteBuf(b, &us, sizeof(USHORT)); + + // Control Protocol Number + us = Endian16(0xc021); + WriteBuf(b, &us, sizeof(USHORT)); + + // Direction + uc = (UCHAR)ppp_error_2; + WriteBuf(b, &uc, sizeof(UCHAR)); + + Add(pp->AvpList, NewAVP(L2TP_AVP_TYPE_PPP_DISCONNECT_CAUSE, false, 0, + b->Buf, b->Size)); + + FreeBuf(b); + } + + SendL2TPControlPacket(l2tp, t, s->SessionId1, pp); + + FreeL2TPPacket(pp); + + // Disconnect the session + Debug("L2TP Session %u/%u on Tunnel %u/%u Disconnected.\n", s->SessionId1, s->SessionId2, + t->TunnelId1, t->TunnelId2); + s->Disconnecting = true; + s->Established = false; + s->DisconnectTimeout = l2tp->Now + (UINT64)L2TP_TUNNEL_DISCONNECT_TIMEOUT; + + // Stop the thread + StopL2TPThread(l2tp, t, s); + + L2TPAddInterrupt(l2tp, s->DisconnectTimeout); + } + + if (s->Disconnecting && ((l2tp->Now >= s->DisconnectTimeout) || LIST_NUM(t->SendQueue) == 0)) + { + // Delete the session if synchronization between the client + // and the server is complete or a time-out occurs + if (delete_session_list == NULL) + { + delete_session_list = NewListFast(NULL); + } + + Add(delete_session_list, s); + } + } + + if (delete_session_list != NULL) + { + // Session deletion process + for (j = 0;j < LIST_NUM(delete_session_list);j++) + { + L2TP_SESSION *s = LIST_DATA(delete_session_list, j); + + Debug("L2TP Session %u/%u on Tunnel %u/%u Cleaned up.\n", s->SessionId1, s->SessionId2, + t->TunnelId1, t->TunnelId2); + + FreeL2TPSession(s); + Delete(t->SessionList, s); + } + + ReleaseList(delete_session_list); + } + + if (t->WantToDisconnect && t->Disconnecting == false) + { + // Disconnect the tunnel + USHORT error_data[4]; + USHORT us; + UINT ui; + // Reply the tunnel disconnection response + L2TP_PACKET *pp = NewL2TPControlPacket(L2TP_MESSAGE_TYPE_STOPCCN, t->IsV3); + + // Assigned Tunnel ID + if (t->IsV3 == false) + { + us = Endian16(t->TunnelId2); + Add(pp->AvpList, NewAVP(L2TP_AVP_TYPE_ASSIGNED_TUNNEL, true, 0, + &us, sizeof(USHORT))); + } + else + { + ui = Endian32(t->TunnelId2); + Add(pp->AvpList, NewAVP(L2TP_AVP_TYPE_V3_TUNNEL_ID, true, 0, + &ui, sizeof(UINT))); + + if (t->IsCiscoV3) + { + Add(pp->AvpList, NewAVP(L2TPV3_CISCO_AVP_TUNNEL_ID, true, L2TP_AVP_VENDOR_ID_CISCO, + &ui, sizeof(UINT))); + } + } + + // Result-Error Code + Zero(error_data, sizeof(error_data)); + error_data[1] = 0x06; + Add(pp->AvpList, NewAVP(L2TP_AVP_TYPE_RESULT_CODE, true, 0, + error_data, sizeof(error_data))); + + SendL2TPControlPacket(l2tp, t, 0, pp); + + FreeL2TPPacket(pp); + + Debug("L2TP Tunnel %u/%u is Disconnected.\n", t->TunnelId1, t->TunnelId2); + t->Disconnecting = true; + t->Established = false; + t->DisconnectTimeout = l2tp->Now + (UINT64)L2TP_TUNNEL_DISCONNECT_TIMEOUT; + L2TPAddInterrupt(l2tp, t->DisconnectTimeout); + } + + if (t->Disconnecting && (((LIST_NUM(t->SendQueue) == 0) && LIST_NUM(t->SessionList) == 0) || (l2tp->Now >= t->DisconnectTimeout))) + { + // Delete the tunnel if there is no session in the tunnel when synchronization + // between the client and the server has been completed or a time-out occurs + if (delete_tunnel_list == NULL) + { + delete_tunnel_list = NewListFast(NULL); + } + + Add(delete_tunnel_list, t); + } + } + + if (delete_tunnel_list != NULL) + { + for (i = 0;i < LIST_NUM(delete_tunnel_list);i++) + { + L2TP_TUNNEL *t = LIST_DATA(delete_tunnel_list, i); + + Debug("L2TP Tunnel %u/%u Cleaned up.\n", t->TunnelId1, t->TunnelId2); + + FreeL2TPTunnel(t); + Delete(l2tp->TunnelList, t); + } + + ReleaseList(delete_tunnel_list); + } + + // Re-transmit packets + for (i = 0;i < LIST_NUM(l2tp->TunnelList);i++) + { + L2TP_TUNNEL *t = LIST_DATA(l2tp->TunnelList, i); + UINT j; + + if (LIST_NUM(t->SendQueue) >= 1) + { + // Packet to be transmitted exists one or more + for (j = 0;j < LIST_NUM(t->SendQueue);j++) + { + L2TP_QUEUE *q = LIST_DATA(t->SendQueue, j); + + if (l2tp->Now >= q->NextSendTick) + { + q->NextSendTick = l2tp->Now + (UINT64)L2TP_PACKET_RESEND_INTERVAL; + + L2TPAddInterrupt(l2tp, q->NextSendTick); + + SendL2TPControlPacketMain(l2tp, t, q); + } + } + } + else + { + // There is no packet to be transmitted, but the state of the tunnel is changed + if (t->StateChanged) + { + // Send a ZLB + L2TP_QUEUE *q = ZeroMalloc(sizeof(L2TP_QUEUE)); + L2TP_PACKET *pp = NewL2TPControlPacket(0, t->IsV3); + + pp->TunnelId = t->TunnelId1; + pp->Ns = t->NextNs; + q->Buf = BuildL2TPPacketData(pp, t); + + SendL2TPControlPacketMain(l2tp, t, q); + + FreeL2TPQueue(q); + FreeL2TPPacket(pp); + } + } + + t->StateChanged = false; + } + + if (l2tp->Halting) + { + if (LIST_NUM(l2tp->TunnelList) == 0) + { + // Stop all the L2TP tunnel completed + if (l2tp->HaltCompleted == false) + { + l2tp->HaltCompleted = true; + + Set(l2tp->HaltCompletedEvent); + } + } + } + + // Maintenance the thread list + if (l2tp->IkeServer == NULL) + { + MaintainThreadList(l2tp->ThreadList); + //Debug("l2tp->ThreadList: %u\n", LIST_NUM(l2tp->ThreadList)); + } +} + +// Create a new L2TP server +L2TP_SERVER *NewL2TPServer(CEDAR *cedar) +{ + return NewL2TPServerEx(cedar, NULL, false, 0); +} +L2TP_SERVER *NewL2TPServerEx(CEDAR *cedar, IKE_SERVER *ike, bool is_ipv6, UINT crypt_block_size) +{ + L2TP_SERVER *l2tp; + // Validate arguments + if (cedar == NULL) + { + return NULL; + } + + l2tp = ZeroMalloc(sizeof(L2TP_SERVER)); + + l2tp->FlushList = NewTubeFlushList(); + + l2tp->Cedar = cedar; + AddRef(l2tp->Cedar->ref); + + l2tp->SendPacketList = NewList(NULL); + l2tp->TunnelList = NewList(NULL); + + l2tp->HaltCompletedEvent = NewEvent(); + + l2tp->ThreadList = NewThreadList(); + + l2tp->IkeServer = ike; + + l2tp->IsIPsecIPv6 = is_ipv6; + l2tp->CryptBlockSize = crypt_block_size; + + return l2tp; +} + +// Stop the L2TP server +void StopL2TPServer(L2TP_SERVER *l2tp, bool no_wait) +{ + // Validate arguments + if (l2tp == NULL) + { + return; + } + if (l2tp->Halt) + { + return; + } + + // Begin to shut down + l2tp->Halt = true; + Debug("Shutting down L2TP Server...\n"); + + // Hit the event + SetSockEvent(l2tp->SockEvent); + + if (no_wait == false) + { + // Wait until complete stopping all tunnels + Wait(l2tp->HaltCompletedEvent, INFINITE); + } + else + { + UINT i, j; + // Kill the thread of all sessions + for (i = 0;i < LIST_NUM(l2tp->TunnelList);i++) + { + L2TP_TUNNEL *t = LIST_DATA(l2tp->TunnelList, i); + + for (j = 0;j < LIST_NUM(t->SessionList);j++) + { + L2TP_SESSION *s = LIST_DATA(t->SessionList, j); + + StopL2TPThread(l2tp, t, s); + } + } + } + + // Thread stop + Debug("Stopping all L2TP PPP Threads...\n"); + StopThreadList(l2tp->ThreadList); + Debug("L2TP Server Shutdown Completed.\n"); +} + +// Release the L2TP server +void FreeL2TPServer(L2TP_SERVER *l2tp) +{ + UINT i; + // Validate arguments + if (l2tp == NULL) + { + return; + } + + FreeThreadList(l2tp->ThreadList); + + for (i = 0;i < LIST_NUM(l2tp->SendPacketList);i++) + { + UDPPACKET *p = LIST_DATA(l2tp->SendPacketList, i); + + FreeUdpPacket(p); + } + + ReleaseList(l2tp->SendPacketList); + + for (i = 0;i < LIST_NUM(l2tp->TunnelList);i++) + { + L2TP_TUNNEL *t = LIST_DATA(l2tp->TunnelList, i); + + FreeL2TPTunnel(t); + } + + ReleaseList(l2tp->TunnelList); + + ReleaseSockEvent(l2tp->SockEvent); + + ReleaseEvent(l2tp->HaltCompletedEvent); + + ReleaseCedar(l2tp->Cedar); + + FreeTubeFlushList(l2tp->FlushList); + + Free(l2tp); +} + +// Set a SockEvent to the L2TP server +void SetL2TPServerSockEvent(L2TP_SERVER *l2tp, SOCK_EVENT *e) +{ + // Validate arguments + if (l2tp == NULL) + { + return; + } + + if (e != NULL) + { + AddRef(e->ref); + } + + if (l2tp->SockEvent != NULL) + { + ReleaseSockEvent(l2tp->SockEvent); + l2tp->SockEvent = NULL; + } + + l2tp->SockEvent = e; +} + diff --git a/src/Cedar/Proto_L2TP.h b/src/Cedar/Proto_L2TP.h index 9d83f66b..ee983aca 100644 --- a/src/Cedar/Proto_L2TP.h +++ b/src/Cedar/Proto_L2TP.h @@ -1,276 +1,276 @@ -// SoftEther VPN Source Code - Developer Edition Master Branch -// Cedar Communication Module - - -// Proto_L2TP.h -// Header of Proto_L2TP.c - -#ifndef PROTO_L2TP_H -#define PROTO_L2TP_H - -//// Macro - -// Check the sequence number -#define L2TP_SEQ_LT(a, b) (((USHORT)(((USHORT)(a)) - ((USHORT)(b)))) & 0x8000) -#define L2TP_SEQ_EQ(a, b) ((USHORT)(a) == (USHORT)(b)) - -//// Constants - -// Client string -#define L2TP_IPC_CLIENT_NAME_TAG "L2TP VPN Client - %s" -#define L2TP_IPC_CLIENT_NAME_NO_TAG "L2TP VPN Client" -#define L2TP_IPC_POSTFIX "L2TP" - -// L2TP vendor name -#define L2TP_VENDOR_NAME "L2TP" - -// L2TP packet retransmission interval -#define L2TP_PACKET_RESEND_INTERVAL 500 - -// Timeout for L2TP tunnel disconnecting completion -#define L2TP_TUNNEL_DISCONNECT_TIMEOUT 3000 - -// Timeout for L2TP session disconnection completion -#define L2TP_SESSION_DISCONNECT_TIMEOUT 3000 - -// Time-out interval of L2TP tunnel -#define L2TP_TUNNEL_TIMEOUT (60 * 1000) - -// Transmission interval of L2TP Hello -#define L2TP_HELLO_INTERVAL (8801) - -// Threshold number of registered items in the transmission queue for suppressing the L2TP Hello transmission -#define L2TP_HELLO_SUPRESS_MAX_THRETHORD_NUM_SEND_QUEUE 32 - -// Quota -#define L2TP_QUOTA_MAX_NUM_TUNNELS_PER_IP 1000 // Number of L2TP sessions per IP address -#define L2TP_QUOTA_MAX_NUM_TUNNELS 30000 // Limit of the number of sessions -#define L2TP_QUOTA_MAX_NUM_SESSIONS_PER_TUNNEL 1024 // Max sessions in a tunnel - -// L2TP window size -#define L2TP_WINDOW_SIZE 16 - -// L2TP packet header bit mask -#define L2TP_HEADER_BIT_TYPE 0x80 // Type -#define L2TP_HEADER_BIT_LENGTH 0x40 // Length -#define L2TP_HEADER_BIT_SEQUENCE 0x08 // Sequence -#define L2TP_HEADER_BIT_OFFSET 0x02 // Offset -#define L2TP_HEADER_BIT_PRIORITY 0x01 // Priority -#define L2TP_HEADER_BIT_VER 0x0F // Version - -// L2TP AVP header bit mask -#define L2TP_AVP_BIT_MANDATORY 0x80 // Mandatory -#define L2TP_AVP_BIT_HIDDEN 0x40 // Hidden -#define L2TP_AVP_LENGTH 0x3FF // Length - -// AVP value -#define L2TP_AVP_TYPE_MESSAGE_TYPE 0 // Message Type -#define L2TP_AVP_TYPE_RESULT_CODE 1 // Result Code -#define L2TP_AVP_TYPE_PROTOCOL_VERSION 2 // Protocol Version -#define L2TP_AVP_TYPE_FRAME_CAP 3 // Framing Capabilities -#define L2TP_AVP_TYPE_BEARER_CAP 4 // Bearer Capabilities -#define L2TP_AVP_TYPE_TIE_BREAKER 5 // Tie Breaker -#define L2TP_AVP_TYPE_HOST_NAME 7 // Host Name -#define L2TP_AVP_TYPE_VENDOR_NAME 8 // Vendor Name -#define L2TP_AVP_TYPE_ASSIGNED_TUNNEL 9 // Assigned Tunnel -#define L2TP_AVP_TYPE_RECV_WINDOW_SIZE 10 // Receive Window Size -#define L2TP_AVP_TYPE_ASSIGNED_SESSION 14 // Assigned Session ID -#define L2TP_AVP_TYPE_CALL_SERIAL 15 // Call Serial Number -#define L2TP_AVP_TYPE_PPP_DISCONNECT_CAUSE 46 // PPP Disconnect Cause Code -#define L2TP_AVP_TYPE_V3_ROUTER_ID 60 // Router ID -#define L2TP_AVP_TYPE_V3_TUNNEL_ID 61 // Assigned Control Connection ID -#define L2TP_AVP_TYPE_V3_PW_CAP_LIST 62 // Pseudowire Capabilities List -#define L2TP_AVP_TYPE_V3_SESSION_ID_LOCAL 63 // Local Session ID -#define L2TP_AVP_TYPE_V3_SESSION_ID_REMOTE 64 // Remote Session ID -#define L2TP_AVP_TYPE_V3_PW_TYPE 68 // Pseudowire Type -#define L2TP_AVP_TYPE_V3_CIRCUIT_STATUS 71 - -// Message Type value -#define L2TP_MESSAGE_TYPE_SCCRQ 1 // Start-Control-Connection-Request -#define L2TP_MESSAGE_TYPE_SCCRP 2 // Start-Control-Connection-Reply -#define L2TP_MESSAGE_TYPE_SCCCN 3 // Start-Control-Connection-Connected -#define L2TP_MESSAGE_TYPE_STOPCCN 4 // Stop-Control-Connection-Notification -#define L2TP_MESSAGE_TYPE_HELLO 6 // Hello -#define L2TP_MESSAGE_TYPE_ICRQ 10 // Incoming-Call-Request -#define L2TP_MESSAGE_TYPE_ICRP 11 // Incoming-Call-Reply -#define L2TP_MESSAGE_TYPE_ICCN 12 // Incoming-Call-Connected -#define L2TP_MESSAGE_TYPE_CDN 14 // Call-Disconnect-Notify - -// Type of L2TPv3 virtual network -#define L2TPV3_PW_TYPE_ETHERNET 5 // Ethernet -#define L2TPV3_PW_TYPE_ETHERNET_VLAN 4 // Ethernet VLAN - -// L2TPv3 vendor unique value -#define L2TP_AVP_VENDOR_ID_CISCO 9 // Cisco Systems -#define L2TPV3_CISCO_AVP_TUNNEL_ID 1 // Assigned Connection ID -#define L2TPV3_CISCO_AVP_PW_CAP_LIST 2 // Pseudowire Capabilities List -#define L2TPV3_CISCO_AVP_SESSION_ID_LOCAL 3 // Local Session ID -#define L2TPV3_CISCO_AVP_SESSION_ID_REMOTE 4 // Remote Session ID -#define L2TPV3_CISCO_AVP_PW_TYPE 7 // Pseudowire Type -#define L2TPV3_CISCO_AVP_DRAFT_AVP_VERSION 10 // Draft AVP Version - - - -//// Types - -// L2TP queue -struct L2TP_QUEUE -{ - BUF *Buf; // Data - USHORT Ns; // Sequence number - UINT64 NextSendTick; // Scheduled time to be sent next - L2TP_PACKET *L2TPPacket; // L2TP packet data -}; - -// L2TP AVP value -struct L2TP_AVP -{ - bool Mandatory; // Force bit - UINT Length; // Overall length - USHORT VendorID; // Vendor ID - USHORT Type; // Type - UINT DataSize; // Data size - void *Data; // Data body -}; - -// L2TP packet -struct L2TP_PACKET -{ - bool IsControl; // Whether it's a control message - bool HasLength; // Whether there is length bit - bool HasSequence; // Whether there is sequence bit - bool HasOffset; // Whether there is offset bit - bool IsPriority; // Whether priority packet - bool IsZLB; // Zero Length Bit - bool IsYamahaV3; // L2TPv3 on YAMAHA - UINT Ver; // Version - UINT Length; // Length - UINT TunnelId; // Tunnel ID - UINT SessionId; // Session ID - USHORT Ns, Nr; // Sequence number - UINT OffsetSize; // Offset size - UINT DataSize; // Data size - void *Data; // Data body - LIST *AvpList; // AVP list - UINT MessageType; // Message type -}; - -// L2TP session -struct L2TP_SESSION -{ - L2TP_TUNNEL *Tunnel; // Parent L2TP tunnel - bool IsV3; // L2TPv3 - bool IsCiscoV3; // L2TPv3 for Cisco - UINT SessionId1; // Session ID (server -> client direction) - UINT SessionId2; // Session ID (client -> server direction) - bool Established; // Established - bool WantToDisconnect; // Whether to want to disconnect - bool Disconnecting; // Whether disconnected - UINT64 DisconnectTimeout; // Disconnection completion time-out - bool HasThread; // Whether have a thread - THREAD *Thread; // Thread - PPP_SESSION* PPPSession; // Underlying PPP session - TUBE *TubeSend; // Tube of PPP to L2TP direction - TUBE *TubeRecv; // Tube of L2TP to PPP direction - UINT PseudowireType; // Type of L2TPv3 virtual line - ETHERIP_SERVER *EtherIP; // EtherIP server -}; - -// L2TP tunnel -struct L2TP_TUNNEL -{ - bool IsV3; // L2TPv3 - bool IsCiscoV3; // L2TPv3 for Cisco - bool IsYamahaV3; // L2TPv3 for YAMAHA - IP ClientIp; // Client IP address - UINT ClientPort; // Client port number - IP ServerIp; // Server IP address - UINT ServerPort; // Server port number - UINT TunnelId1; // Tunnel ID (server -> client direction) - UINT TunnelId2; // Tunnel ID (client -> server direction) - char HostName[MAX_SIZE]; // Destination host name - char VendorName[MAX_SIZE]; // Destination vendor name - LIST *SessionList; // L2TP session list - LIST *SendQueue; // Transmission queue - LIST *RecvQueue; // Reception queue - USHORT NextNs; // Value of Ns of the packet to be sent next - USHORT LastNr; // Value of NR received in the last - bool Established; // Whether the tunnel is established - bool StateChanged; // Whether the state have changed - bool WantToDisconnect; // Whether to want to disconnect - bool Disconnecting; // Whether disconnected - UINT64 DisconnectTimeout; // Disconnection completion time-out - UINT64 LastRecvTick; // Time which the data has been received at last - bool Timedout; // Whether the time-out - UINT64 LastHelloSent; // Time which the data has been sent at last -}; - -// L2TP server -struct L2TP_SERVER -{ - CEDAR *Cedar; - UINT64 Now; // Current time - LIST *SendPacketList; // Transmission packet - LIST *TunnelList; // Tunnel list - INTERRUPT_MANAGER *Interrupts; // Interrupt manager - SOCK_EVENT *SockEvent; // SockEvent - bool Halt; // Start the shutdown - bool Halting; // During shutdown - bool HaltCompleted; // Shutdown is complete - EVENT *HaltCompletedEvent; // Stopping completion event - LIST *ThreadList; // Thread list - char CryptName[MAX_SIZE]; // Cipher algorithm name - IKE_SERVER *IkeServer; // IKE server (Only if associated) - IKE_CLIENT *IkeClient; // IKE client (Only if associated) - bool IsIPsecIPv6; // Whether it's IPv6 - UINT CryptBlockSize; // Cipher block size of the upper layer - TUBE_FLUSH_LIST *FlushList; // Tube Flush List -}; - - -//// Function prototype -L2TP_SERVER *NewL2TPServer(CEDAR *cedar); -L2TP_SERVER *NewL2TPServerEx(CEDAR *cedar, IKE_SERVER *ike, bool is_ipv6, UINT crypt_block_size); -UINT GetNumL2TPTunnelsByClientIP(L2TP_SERVER *l2tp, IP *client_ip); -void SetL2TPServerSockEvent(L2TP_SERVER *l2tp, SOCK_EVENT *e); -void FreeL2TPServer(L2TP_SERVER *l2tp); -void StopL2TPServer(L2TP_SERVER *l2tp, bool no_wait); -void ProcL2TPPacketRecv(L2TP_SERVER *l2tp, UDPPACKET *p); -L2TP_PACKET *ParseL2TPPacket(UDPPACKET *p); -BUF *BuildL2TPPacketData(L2TP_PACKET *pp, L2TP_TUNNEL *t); -L2TP_AVP *GetAVPValue(L2TP_PACKET *p, UINT type); -L2TP_AVP *GetAVPValueEx(L2TP_PACKET *p, UINT type, UINT vendor_id); -L2TP_TUNNEL *NewL2TPTunnel(L2TP_SERVER *l2tp, L2TP_PACKET *p, UDPPACKET *udp); -UINT GenerateNewTunnelId(L2TP_SERVER *l2tp, IP *client_ip); -UINT GenerateNewTunnelIdEx(L2TP_SERVER *l2tp, IP *client_ip, bool is_32bit); -void FreeL2TPTunnel(L2TP_TUNNEL *t); -L2TP_TUNNEL *GetTunnelFromId(L2TP_SERVER *l2tp, IP *client_ip, UINT tunnel_id, bool is_v3); -L2TP_TUNNEL *GetTunnelFromIdOfAssignedByClient(L2TP_SERVER *l2tp, IP *client_ip, UINT tunnel_id); -L2TP_TUNNEL *GetTunnelFromIdOfAssignedByClientEx(L2TP_SERVER *l2tp, IP *client_ip, UINT tunnel_id, bool is_v3); -void SendL2TPControlPacket(L2TP_SERVER *l2tp, L2TP_TUNNEL *t, UINT session_id, L2TP_PACKET *p); -void SendL2TPControlPacketMain(L2TP_SERVER *l2tp, L2TP_TUNNEL *t, L2TP_QUEUE *q); -void SendL2TPDataPacket(L2TP_SERVER *l2tp, L2TP_TUNNEL *t, L2TP_SESSION *s, void *data, UINT size); -void FreeL2TPQueue(L2TP_QUEUE *q); -void L2TPAddInterrupt(L2TP_SERVER *l2tp, UINT64 next_tick); -void L2TPSendUDP(L2TP_SERVER *l2tp, UDPPACKET *p); -void L2TPProcessInterrupts(L2TP_SERVER *l2tp); -L2TP_PACKET *NewL2TPControlPacket(UINT message_type, bool is_v3); -L2TP_AVP *NewAVP(USHORT type, bool mandatory, USHORT vendor_id, void *data, UINT data_size); -int CmpL2TPQueueForRecv(void *p1, void *p2); -void L2TPProcessRecvControlPacket(L2TP_SERVER *l2tp, L2TP_TUNNEL *t, L2TP_PACKET *p); -L2TP_SESSION *GetSessionFromId(L2TP_TUNNEL *t, UINT session_id); -L2TP_SESSION *GetSessionFromIdAssignedByClient(L2TP_TUNNEL *t, UINT session_id); -L2TP_SESSION *NewL2TPSession(L2TP_SERVER *l2tp, L2TP_TUNNEL *t, UINT session_id_by_client); -UINT GenerateNewSessionId(L2TP_TUNNEL *t); -UINT GenerateNewSessionIdEx(L2TP_TUNNEL *t, bool is_32bit); -void FreeL2TPSession(L2TP_SESSION *s); -void DisconnectL2TPSession(L2TP_TUNNEL *t, L2TP_SESSION *s); -void DisconnectL2TPTunnel(L2TP_TUNNEL *t); -void StartL2TPThread(L2TP_SERVER *l2tp, L2TP_TUNNEL *t, L2TP_SESSION *s); -void StopL2TPThread(L2TP_SERVER *l2tp, L2TP_TUNNEL *t, L2TP_SESSION *s); -UINT CalcL2TPMss(L2TP_SERVER *l2tp, L2TP_TUNNEL *t, L2TP_SESSION *s); -UINT GenerateNewSessionIdForL2TPv3(L2TP_SERVER *l2tp); -L2TP_SESSION *SearchL2TPSessionById(L2TP_SERVER *l2tp, bool is_v3, UINT id); -void L2TPSessionManageEtherIPServer(L2TP_SERVER *l2tp, L2TP_SESSION *s); - -#endif // PROTO_L2TP_H +// SoftEther VPN Source Code - Developer Edition Master Branch +// Cedar Communication Module + + +// Proto_L2TP.h +// Header of Proto_L2TP.c + +#ifndef PROTO_L2TP_H +#define PROTO_L2TP_H + +//// Macro + +// Check the sequence number +#define L2TP_SEQ_LT(a, b) (((USHORT)(((USHORT)(a)) - ((USHORT)(b)))) & 0x8000) +#define L2TP_SEQ_EQ(a, b) ((USHORT)(a) == (USHORT)(b)) + +//// Constants + +// Client string +#define L2TP_IPC_CLIENT_NAME_TAG "L2TP VPN Client - %s" +#define L2TP_IPC_CLIENT_NAME_NO_TAG "L2TP VPN Client" +#define L2TP_IPC_POSTFIX "L2TP" + +// L2TP vendor name +#define L2TP_VENDOR_NAME "L2TP" + +// L2TP packet retransmission interval +#define L2TP_PACKET_RESEND_INTERVAL 500 + +// Timeout for L2TP tunnel disconnecting completion +#define L2TP_TUNNEL_DISCONNECT_TIMEOUT 3000 + +// Timeout for L2TP session disconnection completion +#define L2TP_SESSION_DISCONNECT_TIMEOUT 3000 + +// Time-out interval of L2TP tunnel +#define L2TP_TUNNEL_TIMEOUT (60 * 1000) + +// Transmission interval of L2TP Hello +#define L2TP_HELLO_INTERVAL (8801) + +// Threshold number of registered items in the transmission queue for suppressing the L2TP Hello transmission +#define L2TP_HELLO_SUPRESS_MAX_THRETHORD_NUM_SEND_QUEUE 32 + +// Quota +#define L2TP_QUOTA_MAX_NUM_TUNNELS_PER_IP 1000 // Number of L2TP sessions per IP address +#define L2TP_QUOTA_MAX_NUM_TUNNELS 30000 // Limit of the number of sessions +#define L2TP_QUOTA_MAX_NUM_SESSIONS_PER_TUNNEL 1024 // Max sessions in a tunnel + +// L2TP window size +#define L2TP_WINDOW_SIZE 16 + +// L2TP packet header bit mask +#define L2TP_HEADER_BIT_TYPE 0x80 // Type +#define L2TP_HEADER_BIT_LENGTH 0x40 // Length +#define L2TP_HEADER_BIT_SEQUENCE 0x08 // Sequence +#define L2TP_HEADER_BIT_OFFSET 0x02 // Offset +#define L2TP_HEADER_BIT_PRIORITY 0x01 // Priority +#define L2TP_HEADER_BIT_VER 0x0F // Version + +// L2TP AVP header bit mask +#define L2TP_AVP_BIT_MANDATORY 0x80 // Mandatory +#define L2TP_AVP_BIT_HIDDEN 0x40 // Hidden +#define L2TP_AVP_LENGTH 0x3FF // Length + +// AVP value +#define L2TP_AVP_TYPE_MESSAGE_TYPE 0 // Message Type +#define L2TP_AVP_TYPE_RESULT_CODE 1 // Result Code +#define L2TP_AVP_TYPE_PROTOCOL_VERSION 2 // Protocol Version +#define L2TP_AVP_TYPE_FRAME_CAP 3 // Framing Capabilities +#define L2TP_AVP_TYPE_BEARER_CAP 4 // Bearer Capabilities +#define L2TP_AVP_TYPE_TIE_BREAKER 5 // Tie Breaker +#define L2TP_AVP_TYPE_HOST_NAME 7 // Host Name +#define L2TP_AVP_TYPE_VENDOR_NAME 8 // Vendor Name +#define L2TP_AVP_TYPE_ASSIGNED_TUNNEL 9 // Assigned Tunnel +#define L2TP_AVP_TYPE_RECV_WINDOW_SIZE 10 // Receive Window Size +#define L2TP_AVP_TYPE_ASSIGNED_SESSION 14 // Assigned Session ID +#define L2TP_AVP_TYPE_CALL_SERIAL 15 // Call Serial Number +#define L2TP_AVP_TYPE_PPP_DISCONNECT_CAUSE 46 // PPP Disconnect Cause Code +#define L2TP_AVP_TYPE_V3_ROUTER_ID 60 // Router ID +#define L2TP_AVP_TYPE_V3_TUNNEL_ID 61 // Assigned Control Connection ID +#define L2TP_AVP_TYPE_V3_PW_CAP_LIST 62 // Pseudowire Capabilities List +#define L2TP_AVP_TYPE_V3_SESSION_ID_LOCAL 63 // Local Session ID +#define L2TP_AVP_TYPE_V3_SESSION_ID_REMOTE 64 // Remote Session ID +#define L2TP_AVP_TYPE_V3_PW_TYPE 68 // Pseudowire Type +#define L2TP_AVP_TYPE_V3_CIRCUIT_STATUS 71 + +// Message Type value +#define L2TP_MESSAGE_TYPE_SCCRQ 1 // Start-Control-Connection-Request +#define L2TP_MESSAGE_TYPE_SCCRP 2 // Start-Control-Connection-Reply +#define L2TP_MESSAGE_TYPE_SCCCN 3 // Start-Control-Connection-Connected +#define L2TP_MESSAGE_TYPE_STOPCCN 4 // Stop-Control-Connection-Notification +#define L2TP_MESSAGE_TYPE_HELLO 6 // Hello +#define L2TP_MESSAGE_TYPE_ICRQ 10 // Incoming-Call-Request +#define L2TP_MESSAGE_TYPE_ICRP 11 // Incoming-Call-Reply +#define L2TP_MESSAGE_TYPE_ICCN 12 // Incoming-Call-Connected +#define L2TP_MESSAGE_TYPE_CDN 14 // Call-Disconnect-Notify + +// Type of L2TPv3 virtual network +#define L2TPV3_PW_TYPE_ETHERNET 5 // Ethernet +#define L2TPV3_PW_TYPE_ETHERNET_VLAN 4 // Ethernet VLAN + +// L2TPv3 vendor unique value +#define L2TP_AVP_VENDOR_ID_CISCO 9 // Cisco Systems +#define L2TPV3_CISCO_AVP_TUNNEL_ID 1 // Assigned Connection ID +#define L2TPV3_CISCO_AVP_PW_CAP_LIST 2 // Pseudowire Capabilities List +#define L2TPV3_CISCO_AVP_SESSION_ID_LOCAL 3 // Local Session ID +#define L2TPV3_CISCO_AVP_SESSION_ID_REMOTE 4 // Remote Session ID +#define L2TPV3_CISCO_AVP_PW_TYPE 7 // Pseudowire Type +#define L2TPV3_CISCO_AVP_DRAFT_AVP_VERSION 10 // Draft AVP Version + + + +//// Types + +// L2TP queue +struct L2TP_QUEUE +{ + BUF *Buf; // Data + USHORT Ns; // Sequence number + UINT64 NextSendTick; // Scheduled time to be sent next + L2TP_PACKET *L2TPPacket; // L2TP packet data +}; + +// L2TP AVP value +struct L2TP_AVP +{ + bool Mandatory; // Force bit + UINT Length; // Overall length + USHORT VendorID; // Vendor ID + USHORT Type; // Type + UINT DataSize; // Data size + void *Data; // Data body +}; + +// L2TP packet +struct L2TP_PACKET +{ + bool IsControl; // Whether it's a control message + bool HasLength; // Whether there is length bit + bool HasSequence; // Whether there is sequence bit + bool HasOffset; // Whether there is offset bit + bool IsPriority; // Whether priority packet + bool IsZLB; // Zero Length Bit + bool IsYamahaV3; // L2TPv3 on YAMAHA + UINT Ver; // Version + UINT Length; // Length + UINT TunnelId; // Tunnel ID + UINT SessionId; // Session ID + USHORT Ns, Nr; // Sequence number + UINT OffsetSize; // Offset size + UINT DataSize; // Data size + void *Data; // Data body + LIST *AvpList; // AVP list + UINT MessageType; // Message type +}; + +// L2TP session +struct L2TP_SESSION +{ + L2TP_TUNNEL *Tunnel; // Parent L2TP tunnel + bool IsV3; // L2TPv3 + bool IsCiscoV3; // L2TPv3 for Cisco + UINT SessionId1; // Session ID (server -> client direction) + UINT SessionId2; // Session ID (client -> server direction) + bool Established; // Established + bool WantToDisconnect; // Whether to want to disconnect + bool Disconnecting; // Whether disconnected + UINT64 DisconnectTimeout; // Disconnection completion time-out + bool HasThread; // Whether have a thread + THREAD *Thread; // Thread + PPP_SESSION* PPPSession; // Underlying PPP session + TUBE *TubeSend; // Tube of PPP to L2TP direction + TUBE *TubeRecv; // Tube of L2TP to PPP direction + UINT PseudowireType; // Type of L2TPv3 virtual line + ETHERIP_SERVER *EtherIP; // EtherIP server +}; + +// L2TP tunnel +struct L2TP_TUNNEL +{ + bool IsV3; // L2TPv3 + bool IsCiscoV3; // L2TPv3 for Cisco + bool IsYamahaV3; // L2TPv3 for YAMAHA + IP ClientIp; // Client IP address + UINT ClientPort; // Client port number + IP ServerIp; // Server IP address + UINT ServerPort; // Server port number + UINT TunnelId1; // Tunnel ID (server -> client direction) + UINT TunnelId2; // Tunnel ID (client -> server direction) + char HostName[MAX_SIZE]; // Destination host name + char VendorName[MAX_SIZE]; // Destination vendor name + LIST *SessionList; // L2TP session list + LIST *SendQueue; // Transmission queue + LIST *RecvQueue; // Reception queue + USHORT NextNs; // Value of Ns of the packet to be sent next + USHORT LastNr; // Value of NR received in the last + bool Established; // Whether the tunnel is established + bool StateChanged; // Whether the state have changed + bool WantToDisconnect; // Whether to want to disconnect + bool Disconnecting; // Whether disconnected + UINT64 DisconnectTimeout; // Disconnection completion time-out + UINT64 LastRecvTick; // Time which the data has been received at last + bool Timedout; // Whether the time-out + UINT64 LastHelloSent; // Time which the data has been sent at last +}; + +// L2TP server +struct L2TP_SERVER +{ + CEDAR *Cedar; + UINT64 Now; // Current time + LIST *SendPacketList; // Transmission packet + LIST *TunnelList; // Tunnel list + INTERRUPT_MANAGER *Interrupts; // Interrupt manager + SOCK_EVENT *SockEvent; // SockEvent + bool Halt; // Start the shutdown + bool Halting; // During shutdown + bool HaltCompleted; // Shutdown is complete + EVENT *HaltCompletedEvent; // Stopping completion event + LIST *ThreadList; // Thread list + char CryptName[MAX_SIZE]; // Cipher algorithm name + IKE_SERVER *IkeServer; // IKE server (Only if associated) + IKE_CLIENT *IkeClient; // IKE client (Only if associated) + bool IsIPsecIPv6; // Whether it's IPv6 + UINT CryptBlockSize; // Cipher block size of the upper layer + TUBE_FLUSH_LIST *FlushList; // Tube Flush List +}; + + +//// Function prototype +L2TP_SERVER *NewL2TPServer(CEDAR *cedar); +L2TP_SERVER *NewL2TPServerEx(CEDAR *cedar, IKE_SERVER *ike, bool is_ipv6, UINT crypt_block_size); +UINT GetNumL2TPTunnelsByClientIP(L2TP_SERVER *l2tp, IP *client_ip); +void SetL2TPServerSockEvent(L2TP_SERVER *l2tp, SOCK_EVENT *e); +void FreeL2TPServer(L2TP_SERVER *l2tp); +void StopL2TPServer(L2TP_SERVER *l2tp, bool no_wait); +void ProcL2TPPacketRecv(L2TP_SERVER *l2tp, UDPPACKET *p); +L2TP_PACKET *ParseL2TPPacket(UDPPACKET *p); +BUF *BuildL2TPPacketData(L2TP_PACKET *pp, L2TP_TUNNEL *t); +L2TP_AVP *GetAVPValue(L2TP_PACKET *p, UINT type); +L2TP_AVP *GetAVPValueEx(L2TP_PACKET *p, UINT type, UINT vendor_id); +L2TP_TUNNEL *NewL2TPTunnel(L2TP_SERVER *l2tp, L2TP_PACKET *p, UDPPACKET *udp); +UINT GenerateNewTunnelId(L2TP_SERVER *l2tp, IP *client_ip); +UINT GenerateNewTunnelIdEx(L2TP_SERVER *l2tp, IP *client_ip, bool is_32bit); +void FreeL2TPTunnel(L2TP_TUNNEL *t); +L2TP_TUNNEL *GetTunnelFromId(L2TP_SERVER *l2tp, IP *client_ip, UINT tunnel_id, bool is_v3); +L2TP_TUNNEL *GetTunnelFromIdOfAssignedByClient(L2TP_SERVER *l2tp, IP *client_ip, UINT tunnel_id); +L2TP_TUNNEL *GetTunnelFromIdOfAssignedByClientEx(L2TP_SERVER *l2tp, IP *client_ip, UINT tunnel_id, bool is_v3); +void SendL2TPControlPacket(L2TP_SERVER *l2tp, L2TP_TUNNEL *t, UINT session_id, L2TP_PACKET *p); +void SendL2TPControlPacketMain(L2TP_SERVER *l2tp, L2TP_TUNNEL *t, L2TP_QUEUE *q); +void SendL2TPDataPacket(L2TP_SERVER *l2tp, L2TP_TUNNEL *t, L2TP_SESSION *s, void *data, UINT size); +void FreeL2TPQueue(L2TP_QUEUE *q); +void L2TPAddInterrupt(L2TP_SERVER *l2tp, UINT64 next_tick); +void L2TPSendUDP(L2TP_SERVER *l2tp, UDPPACKET *p); +void L2TPProcessInterrupts(L2TP_SERVER *l2tp); +L2TP_PACKET *NewL2TPControlPacket(UINT message_type, bool is_v3); +L2TP_AVP *NewAVP(USHORT type, bool mandatory, USHORT vendor_id, void *data, UINT data_size); +int CmpL2TPQueueForRecv(void *p1, void *p2); +void L2TPProcessRecvControlPacket(L2TP_SERVER *l2tp, L2TP_TUNNEL *t, L2TP_PACKET *p); +L2TP_SESSION *GetSessionFromId(L2TP_TUNNEL *t, UINT session_id); +L2TP_SESSION *GetSessionFromIdAssignedByClient(L2TP_TUNNEL *t, UINT session_id); +L2TP_SESSION *NewL2TPSession(L2TP_SERVER *l2tp, L2TP_TUNNEL *t, UINT session_id_by_client); +UINT GenerateNewSessionId(L2TP_TUNNEL *t); +UINT GenerateNewSessionIdEx(L2TP_TUNNEL *t, bool is_32bit); +void FreeL2TPSession(L2TP_SESSION *s); +void DisconnectL2TPSession(L2TP_TUNNEL *t, L2TP_SESSION *s); +void DisconnectL2TPTunnel(L2TP_TUNNEL *t); +void StartL2TPThread(L2TP_SERVER *l2tp, L2TP_TUNNEL *t, L2TP_SESSION *s); +void StopL2TPThread(L2TP_SERVER *l2tp, L2TP_TUNNEL *t, L2TP_SESSION *s); +UINT CalcL2TPMss(L2TP_SERVER *l2tp, L2TP_TUNNEL *t, L2TP_SESSION *s); +UINT GenerateNewSessionIdForL2TPv3(L2TP_SERVER *l2tp); +L2TP_SESSION *SearchL2TPSessionById(L2TP_SERVER *l2tp, bool is_v3, UINT id); +void L2TPSessionManageEtherIPServer(L2TP_SERVER *l2tp, L2TP_SESSION *s); + +#endif // PROTO_L2TP_H diff --git a/src/Cedar/Proto_OpenVPN.c b/src/Cedar/Proto_OpenVPN.c index a466a9c1..e709cf16 100644 --- a/src/Cedar/Proto_OpenVPN.c +++ b/src/Cedar/Proto_OpenVPN.c @@ -1,3030 +1,3030 @@ -// SoftEther VPN Source Code - Developer Edition Master Branch -// Cedar Communication Module - - -// Proto_OpenVPN.c -// OpenVPN protocol stack - -#include "CedarPch.h" - -// Ping signature of the OpenVPN protocol -static UCHAR ping_signature[] = -{ - 0x2a, 0x18, 0x7b, 0xf3, 0x64, 0x1e, 0xb4, 0xcb, - 0x07, 0xed, 0x2d, 0x0a, 0x98, 0x1f, 0xc7, 0x48 -}; - -const PROTO_IMPL *OvsGetProtoImpl() -{ - static const PROTO_IMPL impl = - { - OvsName, - OvsOptions, - OvsInit, - OvsFree, - OvsIsPacketForMe, - OvsProcessData, - OvsProcessDatagrams - }; - - return &impl; -} - -const char *OvsName() -{ - return "OpenVPN"; -} - -const PROTO_OPTION *OvsOptions() -{ - static const PROTO_OPTION options[] = - { - { .Name = "DefaultClientOption", .Type = PROTO_OPTION_STRING, .String = "dev-type tun,link-mtu 1500,tun-mtu 1500,cipher AES-128-CBC,auth SHA1,keysize 128,key-method 2,tls-client" }, - { .Name = "Obfuscation", .Type = PROTO_OPTION_BOOL, .Bool = false }, - { .Name = "ObfuscationMask", .Type = PROTO_OPTION_STRING, .String = ""}, - { .Name = "PushDummyIPv4AddressOnL2Mode", .Type = PROTO_OPTION_BOOL, .Bool = true }, - { .Name = NULL, .Type = PROTO_OPTION_UNKNOWN } - }; - - return options; -} - -bool OvsInit(void **param, const LIST *options, CEDAR *cedar, INTERRUPT_MANAGER *im, SOCK_EVENT *se, const char *cipher, const char *hostname) -{ - if (param == NULL || options == NULL || cedar == NULL || im == NULL || se == NULL) - { - return false; - } - - Debug("OvsInit(): cipher: %s, hostname: %s\n", cipher, hostname); - - *param = NewOpenVpnServer(options, cedar, im, se); - - return true; -} - -void OvsFree(void *param) -{ - FreeOpenVpnServer(param); -} - -// Check whether it's an OpenVPN packet -bool OvsIsPacketForMe(const PROTO_MODE mode, const UCHAR *data, const UINT size) -{ - if (mode == PROTO_MODE_TCP) - { - if (data == NULL || size < 2) - { - return false; - } - - if (data[0] == 0x00 && data[1] == 0x0E) - { - return true; - } - } - else if (mode == PROTO_MODE_UDP) - { - OPENVPN_PACKET *packet = OvsParsePacket(data, size); - if (packet == NULL) - { - return false; - } - - OvsFreePacket(packet); - return true; - } - - return false; -} - -bool OvsProcessData(void *param, TCP_RAW_DATA *in, FIFO *out) -{ - bool ret = true; - UINT i; - OPENVPN_SERVER *server = param; - UCHAR buf[OPENVPN_TCP_MAX_PACKET_SIZE]; - - if (server == NULL || in == NULL || out == NULL) - { - return false; - } - - // Separate to a list of datagrams by interpreting the data received from the TCP socket - while (true) - { - UDPPACKET *packet; - USHORT payload_size, packet_size; - FIFO *fifo = in->Data; - const UINT fifo_size = FifoSize(fifo); - - if (fifo_size < sizeof(USHORT)) - { - // Non-arrival - break; - } - - // The beginning of a packet contains the data size - payload_size = READ_USHORT(FifoPtr(fifo)); - packet_size = payload_size + sizeof(USHORT); - - if (payload_size == 0 || packet_size > sizeof(buf)) - { - ret = false; - Debug("OvsProcessData(): Invalid payload size: %u bytes\n", payload_size); - break; - } - - if (fifo_size < packet_size) - { - // Non-arrival - break; - } - - if (ReadFifo(fifo, buf, packet_size) != packet_size) - { - ret = false; - Debug("OvsProcessData(): ReadFifo() failed to read the packet\n"); - break; - } - - // Insert packet into the list - packet = NewUdpPacket(&in->SrcIP, in->SrcPort, &in->DstIP, in->DstPort, Clone(buf + sizeof(USHORT), payload_size), payload_size); - Add(server->RecvPacketList, packet); - } - - // Process the list of received datagrams - OvsRecvPacket(server, server->RecvPacketList, OPENVPN_PROTOCOL_TCP); - - // Release the received packet list - for (i = 0; i < LIST_NUM(server->RecvPacketList); ++i) - { - UDPPACKET *p = LIST_DATA(server->RecvPacketList, i); - FreeUdpPacket(p); - } - - DeleteAll(server->RecvPacketList); - - // Store in the queue by getting a list of the datagrams to be transmitted from the OpenVPN server - for (i = 0; i < LIST_NUM(server->SendPacketList); ++i) - { - UDPPACKET *p = LIST_DATA(server->SendPacketList, i); - - // Store the size in the TCP send queue first - USHORT us = Endian16((USHORT)p->Size); - - WriteFifo(out, &us, sizeof(USHORT)); - - // Write the data body - WriteFifo(out, p->Data, p->Size); - - // Packet release - FreeUdpPacket(p); - } - - DeleteAll(server->SendPacketList); - - if (server->Giveup <= server->Now) - { - UINT i; - for (i = 0; i < LIST_NUM(server->SessionList); ++i) - { - OPENVPN_SESSION *se = LIST_DATA(server->SessionList, i); - - if (se->Established) - { - return ret && server->DisconnectCount < 1; - } - } - - return false; - } - - server->SupressSendPacket = FifoSize(out) > MAX_BUFFERING_PACKET_SIZE; - - return ret; -} - -bool OvsProcessDatagrams(void *param, LIST *in, LIST *out) -{ - UINT i; - LIST *to_send; - OPENVPN_SERVER *server = param; - - if (server == NULL || in == NULL || out == NULL) - { - return false; - } - - OvsRecvPacket(server, in, OPENVPN_PROTOCOL_UDP); - - to_send = server->SendPacketList; - - for (i = 0; i < LIST_NUM(to_send); ++i) - { - Add(out, LIST_DATA(to_send, i)); - } - - DeleteAll(server->SendPacketList); - - if (server->Giveup <= server->Now) - { - UINT i; - for (i = 0; i < LIST_NUM(server->SessionList); ++i) - { - OPENVPN_SESSION *se = LIST_DATA(server->SessionList, i); - - if (se->Established) - { - return server->DisconnectCount < 1; - } - } - - return false; - } - - return true; -} - -// Write the OpenVPN log -void OvsLog(OPENVPN_SERVER *s, OPENVPN_SESSION *se, OPENVPN_CHANNEL *c, char *name, ...) -{ - wchar_t prefix[MAX_SIZE * 2]; - wchar_t buf2[MAX_SIZE * 2]; - va_list args; - // Validate arguments - if (s == NULL) - { - return; - } - if (se == NULL) - { - UniStrCpy(prefix, sizeof(prefix), _UU("LO_PREFIX_RAW")); - } - else - { - if (c == NULL) - { - UniFormat(prefix, sizeof(prefix), _UU("LO_PREFIX_SESSION"), - se->Id, &se->ClientIp, se->ClientPort, &se->ServerIp, se->ServerPort); - } - else - { - UniFormat(prefix, sizeof(prefix), _UU("LO_PREFIX_CHANNEL"), - se->Id, &se->ClientIp, se->ClientPort, &se->ServerIp, se->ServerPort, - c->KeyId); - } - } - va_start(args, name); - UniFormatArgs(buf2, sizeof(buf2), _UU(name), args); - va_end(args); - - UniStrCat(prefix, sizeof(prefix), buf2); - - WriteServerLog(s->Cedar, prefix); -} - -// Encrypt the data -UINT OvsEncrypt(CIPHER *cipher, MD *md, UCHAR *iv, UCHAR *tag, UCHAR *dest, UCHAR *src, UINT src_size, UCHAR *aad, UINT aad_size) -{ - // Validate arguments - if (cipher == NULL || (cipher->IsAeadCipher == false && md == NULL)) - { - return 0; - } - - if (cipher->IsAeadCipher) - { - // Encrypt in AEAD mode (no HMAC) - UINT dest_size = CipherProcessAead(cipher, iv, tag, 16, dest, src, src_size, aad, aad_size); - if (dest_size == 0) - { - Debug("OvsEncrypt(): CipherProcessAead() failed!\n"); - return 0; - } - - return dest_size; - } - else - { - // Encrypt in non-AEAD mode (with HMAC) - UINT ret; - UINT dest_size = CipherProcess(cipher, iv, dest + md->Size + cipher->IvSize, src, src_size); - if (dest_size == 0) - { - Debug("OvsEncrypt(): CipherProcess() failed!\n"); - return 0; - } - - // Copy the IV - Copy(dest + md->Size, iv, cipher->IvSize); - dest_size += cipher->IvSize; - - // Calculate the HMAC - ret = MdProcess(md, dest, dest + md->Size, dest_size); - if (ret == 0) - { - Debug("OvsEncrypt(): MdProcess() failed!\n"); - return 0; - } - - return dest_size + ret; - } -} - -// Decrypt the data -UINT OvsDecrypt(CIPHER *cipher, MD *md, UCHAR *iv, UCHAR *dest, UCHAR *src, UINT size) -{ - // Validate arguments - if (cipher == NULL) - { - return 0; - } - - if (cipher->IsAeadCipher) - { - UCHAR *tag = src; - - if (iv == NULL || size <= OPENVPN_TAG_SIZE) - { - return 0; - } - - src += OPENVPN_TAG_SIZE; - size -= OPENVPN_TAG_SIZE; - - // Payload - if (size >= 1 && (cipher->BlockSize == 0 || (size % cipher->BlockSize) == 0)) - { - // Decryption - UINT ret = CipherProcessAead(cipher, iv, tag, OPENVPN_TAG_SIZE, dest, src, size, iv, sizeof(UINT)); - if (ret == 0) - { - Debug("OvsDecrypt(): CipherProcessAead() failed!\n"); - } - - return ret; - } - } - else - { - UCHAR *hmac; - UCHAR hmac_test[128]; - - if (md == NULL || iv == NULL || size < (md->Size + cipher->IvSize + sizeof(UINT))) - { - return 0; - } - - // HMAC - hmac = src; - src += md->Size; - size -= md->Size; - - if (MdProcess(md, hmac_test, src, size) == 0) - { - Debug("OvsDecrypt(): MdProcess() failed!\n"); - return 0; - } - - if (Cmp(hmac_test, hmac, md->Size) != 0) - { - Debug("OvsDecrypt(): HMAC verification failed!\n"); - return 0; - } - - // IV - Copy(iv, src, cipher->IvSize); - src += cipher->IvSize; - size -= cipher->IvSize; - - // Payload - if (size >= 1 && (cipher->BlockSize == 0 || (size % cipher->BlockSize) == 0)) - { - // Decryption - UINT ret = CipherProcess(cipher, iv, dest, src, size); - if (ret == 0) - { - Debug("OvsDecrypt(): CipherProcess() failed!\n"); - } - - return ret; - } - } - - return 0; -} - -// XOR the bytes with the specified string -void OvsDataXorMask(void *data, const UINT data_size, const char *mask, const UINT mask_size) -{ - UINT i; - UCHAR *buf; - // Validate arguments - if (data == NULL || data_size == 0 || mask == NULL || mask_size == 0) - { - return; - } - - for (i = 0, buf = data; i < data_size; i++, buf++) - { - *buf = *buf ^ mask[i % mask_size]; - } -} - -// XOR each byte with its position within the buffer -void OvsDataXorPtrPos(void *data, const UINT size) -{ - UINT i; - UCHAR *buf; - // Validate arguments - if (data == NULL || size == 0) - { - return; - } - - for (i = 0, buf = data; i < size; i++, buf++) - { - *buf = *buf ^ i + 1; - } -} - -// Reverse bytes order if they're more than 2, keeping the first byte unchanged -void OvsDataReverse(void *data, const UINT size) -{ - UINT i; - UCHAR tmp; - UCHAR *buf_start, *buf_end; - // Validate arguments - if (data == NULL || size < 3) - { - return; - } - - for (i = 0, buf_start = (UCHAR *)data + 1, buf_end = (UCHAR *)data + (size - 1); i < (size - 1 ) / 2; i++, buf_start++, buf_end--) - { - tmp = *buf_start; - *buf_start = *buf_end; - *buf_end = tmp; - } -} - -// Detects the method used to obfuscate the packet -UINT OvsDetectObfuscation(void *data, UINT size, char *xormask) -{ - UINT ret; - void *tmp; - OPENVPN_PACKET *parsed_packet; - // Validate arguments - if (data == NULL || size == 0) - { - return INFINITE; - } - - ret = INFINITE; - tmp = NULL; - - // OPENVPN_SCRAMBLE_MODE_DISABLED - parsed_packet = OvsParsePacket(data, size); - if (parsed_packet != NULL) - { - ret = OPENVPN_SCRAMBLE_MODE_DISABLED; - goto final; - } - - // OPENVPN_SCRAMBLE_MODE_XORMASK - tmp = Clone(data, size); - - OvsDataXorMask(tmp, size, xormask, StrLen(xormask)); - - parsed_packet = OvsParsePacket(tmp, size); - if (parsed_packet != NULL) - { - ret = OPENVPN_SCRAMBLE_MODE_XORMASK; - goto final; - } - - Free(tmp); - - // OPENVPN_SCRAMBLE_MODE_XORPTRPOS - tmp = Clone(data, size); - - OvsDataXorPtrPos(tmp, size); - - parsed_packet = OvsParsePacket(tmp, size); - if (parsed_packet != NULL) - { - ret = OPENVPN_SCRAMBLE_MODE_XORPTRPOS; - goto final; - } - - Free(tmp); - - // OPENVPN_SCRAMBLE_MODE_REVERSE - tmp = Clone(data, size); - - OvsDataReverse(tmp, size); - - parsed_packet = OvsParsePacket(tmp, size); - if (parsed_packet != NULL) - { - ret = OPENVPN_SCRAMBLE_MODE_REVERSE; - goto final; - } - - Free(tmp); - - // OPENVPN_SCRAMBLE_MODE_OBFUSCATE - tmp = Clone(data, size); - - OvsDataXorMask(tmp, size, xormask, StrLen(xormask)); - OvsDataXorPtrPos(tmp, size); - OvsDataReverse(tmp, size); - OvsDataXorPtrPos(tmp, size); - - parsed_packet = OvsParsePacket(tmp, size); - if (parsed_packet != NULL) - { - ret = OPENVPN_SCRAMBLE_MODE_OBFUSCATE; - goto final; - } - -final: - OvsFreePacket(parsed_packet); - Free(tmp); - return ret; -} - -// Process the received packet -void OvsProceccRecvPacket(OPENVPN_SERVER *s, UDPPACKET *p, UINT protocol) -{ - OPENVPN_CHANNEL *c; - OPENVPN_SESSION *se; - OPENVPN_PACKET *recv_packet; - // Validate arguments - if (s == NULL || p == NULL) - { - return; - } - - // Search for the session - se = OvsFindOrCreateSession(s, &p->DstIP, p->DestPort, &p->SrcIP, p->SrcPort, protocol); - if (se == NULL) - { - return; - } - - // Detect obfuscation mode and save it for the next packets in the same session - if (se->ObfuscationMode == INFINITE) - { - se->ObfuscationMode = OvsDetectObfuscation(p->Data, p->Size, s->ObfuscationMask); - if (se->ObfuscationMode != INFINITE) - { - Debug("OvsProceccRecvPacket(): detected packet obfuscation/scrambling mode: %u\n", se->ObfuscationMode); - } - else - { - Debug("OvsProceccRecvPacket(): failed to detect packet obfuscation/scrambling mode!\n"); - return; - } - } - - // Handle scrambled packet - switch (se->ObfuscationMode) - { - case OPENVPN_SCRAMBLE_MODE_DISABLED: - break; - case OPENVPN_SCRAMBLE_MODE_XORMASK: - OvsDataXorMask(p->Data, p->Size, s->ObfuscationMask, StrLen(s->ObfuscationMask)); - break; - case OPENVPN_SCRAMBLE_MODE_XORPTRPOS: - OvsDataXorPtrPos(p->Data, p->Size); - break; - case OPENVPN_SCRAMBLE_MODE_REVERSE: - OvsDataReverse(p->Data, p->Size); - break; - case OPENVPN_SCRAMBLE_MODE_OBFUSCATE: - OvsDataXorMask(p->Data, p->Size, s->ObfuscationMask, StrLen(s->ObfuscationMask)); - OvsDataXorPtrPos(p->Data, p->Size); - OvsDataReverse(p->Data, p->Size); - OvsDataXorPtrPos(p->Data, p->Size); - } - - // Parse the packet - recv_packet = OvsParsePacket(p->Data, p->Size); - if (recv_packet == NULL) - { - Debug("OvsProceccRecvPacket(): OvsParsePacket() returned NULL!\n"); - return; - } - - c = se->Channels[recv_packet->KeyId]; - - if (recv_packet->OpCode != OPENVPN_P_DATA_V1) - { - // Control packet - Debug("OvsProceccRecvPacket(): Received control packet. PacketId: %u, OpCode: %u, KeyId: %u, MySessionId: %I64u\n", - recv_packet->PacketId, recv_packet->OpCode, recv_packet->KeyId, recv_packet->MySessionId); - - if (recv_packet->OpCode == OPENVPN_P_CONTROL_HARD_RESET_CLIENT_V2 || - recv_packet->OpCode == OPENVPN_P_CONTROL_SOFT_RESET_V1) - { - // Connection request packet - if (c != NULL && c->Status == OPENVPN_CHANNEL_STATUS_ESTABLISHED) - { - // If there's already an established data channel, release it - OvsFreeChannel(se->Channels[recv_packet->KeyId]); - c = se->Channels[recv_packet->KeyId] = NULL; - Debug("OvsProceccRecvPacket(): Released established data channel: %u\n", recv_packet->KeyId); - } - - if (c == NULL) - { - // Create a new channel - c = OvsNewChannel(se, recv_packet->KeyId); - if (se->ClientSessionId == 0) - { - se->ClientSessionId = recv_packet->MySessionId; - } - se->Channels[recv_packet->KeyId] = c; - Debug("OvsProceccRecvPacket(): Created a new channel: %u\n", recv_packet->KeyId); - OvsLog(s, se, c, "LO_NEW_CHANNEL"); - } - } - /* else if (recv_packet->OpCode == OPENVPN_P_CONTROL_SOFT_RESET_V1) - { - // Response to soft reset request packet - OPENVPN_PACKET *p; - - p = OvsNewControlPacket(OPENVPN_P_CONTROL_SOFT_RESET_V1, recv_packet->KeyId, se->ServerSessionId, - 0, NULL, 0, 0, 0, NULL); - - OvsSendPacketNow(s, se, p); - - OvsFreePacket(p); - } - */ - if (c != NULL) - { - // Delete the send packet list by looking the packet ID in the ACK list of arrived packet - OvsDeleteFromSendingControlPacketList(c, recv_packet->NumAck, recv_packet->AckPacketId); - - if (recv_packet->OpCode != OPENVPN_P_ACK_V1) - { - // Add the Packet ID of arrived packet to the list - InsertIntDistinct(c->AckReplyList, recv_packet->PacketId); - - if ((recv_packet->PacketId > c->MaxRecvPacketId) - || (recv_packet->OpCode == OPENVPN_P_CONTROL_HARD_RESET_CLIENT_V2) - || (recv_packet->OpCode == OPENVPN_P_CONTROL_SOFT_RESET_V1)) - { - c->MaxRecvPacketId = recv_packet->PacketId; - - // Process the received control packet - OvsProcessRecvControlPacket(s, se, c, recv_packet); - } - } - } - } - else - { - // Data packet - if (c != NULL && c->Status == OPENVPN_CHANNEL_STATUS_ESTABLISHED) - { - UINT size; - UCHAR *data = s->TmpBuf; - if (c->CipherDecrypt->IsAeadCipher) - { - // Update variable part (packet ID) of IV - Copy(c->IvRecv, recv_packet->Data, sizeof(recv_packet->PacketId)); - - // Decrypt - size = OvsDecrypt(c->CipherDecrypt, NULL, c->IvRecv, data, recv_packet->Data + sizeof(UINT), recv_packet->DataSize - sizeof(UINT)); - } - else - { - // Decrypt - size = OvsDecrypt(c->CipherDecrypt, c->MdRecv, c->IvRecv, data, recv_packet->Data, recv_packet->DataSize); - if (size > sizeof(UINT)) - { - // Seek buffer after the packet ID - data += sizeof(UINT); - size -= sizeof(UINT); - } - } - - // Update of last communication time - se->LastCommTick = s->Now; - - if (size < sizeof(ping_signature) || Cmp(data, ping_signature, sizeof(ping_signature)) != 0) - { - // Receive a packet! - if (se->Ipc != NULL) - { - switch (se->Mode) - { - case OPENVPN_MODE_L2: // Send an Ethernet packet to a session - IPCSendL2(se->Ipc, data, size); - break; - case OPENVPN_MODE_L3: // Send an IPv4 packet to a session - IPCSendIPv4(se->Ipc, data, size); - break; - } - } - } - } - } - - OvsFreePacket(recv_packet); -} - -// Remove a packet which the opponent has received from the transmission list -void OvsDeleteFromSendingControlPacketList(OPENVPN_CHANNEL *c, UINT num_acks, UINT *acks) -{ - LIST *o; - UINT i; - // Validate arguments - if (c == NULL || num_acks == 0) - { - return; - } - - o = NewListFast(NULL); - for (i = 0; i < num_acks; i++) - { - UINT ack = acks[i]; - UINT j; - - for (j = 0; j < LIST_NUM(c->SendControlPacketList); j++) - { - OPENVPN_CONTROL_PACKET *p = LIST_DATA(c->SendControlPacketList, j); - - if (p->PacketId == ack) - { - AddDistinct(o, p); - } - } - } - - for (i = 0; i < LIST_NUM(o); i++) - { - OPENVPN_CONTROL_PACKET *p = LIST_DATA(o, i); - - Delete(c->SendControlPacketList, p); - - OvsFreeControlPacket(p); - } - - ReleaseList(o); -} - -// Process the received control packet -void OvsProcessRecvControlPacket(OPENVPN_SERVER *s, OPENVPN_SESSION *se, OPENVPN_CHANNEL *c, OPENVPN_PACKET *p) -{ - FIFO *recv_fifo = NULL; - FIFO *send_fifo = NULL; - // Validate arguments - if (s == NULL || se == NULL || c == NULL || p == NULL) - { - return; - } - - if (p->OpCode == OPENVPN_P_CONTROL_V1) - { - Debug("SSL (c=%u): %u\n", c->KeyId, p->DataSize); - - if (c->SslPipe == NULL) - { - // Create an SSL pipe - Lock(s->Cedar->lock); - { - if (s->Dh->Size != s->Cedar->DhParamBits) - { - DhFree(s->Dh); - s->Dh = DhNewFromBits(s->Cedar->DhParamBits); - } - - c->SslPipe = NewSslPipeEx(true, s->Cedar->ServerX, s->Cedar->ServerK, s->Dh, true, &c->ClientCert); - } - Unlock(s->Cedar->lock); - - Debug("SSL Pipe Created (c=%u).\n", c->KeyId); - } - - if (c->SslPipe->IsDisconnected == false) - { - // Pour the physically received data into SSL pipe - if (FifoSize(c->SslPipe->RawIn->SendFifo) < OPENVPN_MAX_SSL_RECV_BUF_SIZE) - { - Debug("SSL_Write: %u\n", p->DataSize); - WriteFifo(c->SslPipe->RawIn->SendFifo, p->Data, p->DataSize); - } - SyncSslPipe(c->SslPipe); - } - } - - if (c->SslPipe != NULL && c->SslPipe->IsDisconnected == false) - { - recv_fifo = c->SslPipe->SslInOut->RecvFifo; - send_fifo = c->SslPipe->SslInOut->SendFifo; - } - - Debug("SIZE: recv_fifo = %u, send_fifo = %u\n", FifoSize(recv_fifo), FifoSize(send_fifo)); - - switch (c->Status) - { - case OPENVPN_CHANNEL_STATUS_INIT: - switch (p->OpCode) - { - case OPENVPN_P_CONTROL_SOFT_RESET_V1: - // Key update (soft reset) - if (se->Established) - { - if (c->IsInitiatorServer == false) - { - OvsSendControlPacket(c, OPENVPN_P_CONTROL_SOFT_RESET_V1, NULL, 0); - } - - c->Status = OPENVPN_CHANNEL_STATUS_TLS_WAIT_CLIENT_KEY; - c->IsRekeyChannel = true; - } - break; - - case OPENVPN_P_CONTROL_HARD_RESET_CLIENT_V2: - // New connection (hard reset) - OvsSendControlPacketEx(c, OPENVPN_P_CONTROL_HARD_RESET_SERVER_V2, NULL, 0, true); - - c->Status = OPENVPN_CHANNEL_STATUS_TLS_WAIT_CLIENT_KEY; - break; - } - break; - - case OPENVPN_CHANNEL_STATUS_TLS_WAIT_CLIENT_KEY: - if (FifoSize(recv_fifo) >= 1) - { - OPENVPN_KEY_METHOD_2 data; - UCHAR *ptr = FifoPtr(recv_fifo); - - // Parse OPENVPN_KEY_METHOD_2 - UINT read_size = OvsParseKeyMethod2(&data, ptr, FifoSize(recv_fifo), true); - if (read_size != 0) - { - BUF *b; - - // Success in parsing key information - ReadFifo(recv_fifo, NULL, read_size); - - // Set session parameters - OvsSetupSessionParameters(s, se, c, &data); - - // Build OPENVPN_KEY_METHOD_2 to respond - b = OvsBuildKeyMethod2(&c->ServerKey); - - // Transmission of the response data - if (b != NULL) - { - WriteFifo(send_fifo, b->Buf, b->Size); - - FreeBuf(b); - } - - // State transition - c->Status = OPENVPN_CHANNEL_STATUS_TLS_WAIT_CLIENT_PUSH_REQUEST; - if (c->IsRekeyChannel) - { - c->Status = OPENVPN_CHANNEL_STATUS_ESTABLISHED; - c->EstablishedTick = s->Now; - Debug("OpenVPN Channel %u Established (re-key).\n", c->KeyId); - OvsLog(s, se, c, "LO_CHANNEL_ESTABLISHED_NEWKEY"); - } - } - } - break; - - case OPENVPN_CHANNEL_STATUS_TLS_WAIT_CLIENT_PUSH_REQUEST: - if (FifoSize(recv_fifo) >= 1) - { - char tmp[MAX_SIZE]; - UINT read_size = OvsPeekStringFromFifo(recv_fifo, tmp, sizeof(tmp)); - - if (read_size >= 1) - { - Debug("Client->Server (c=%u): %s\n", c->KeyId, tmp); - - ReadFifo(recv_fifo, NULL, read_size); - - if (StartWith(tmp, "PUSH_REQUEST")) - { - // Since connection requested, start VPN connection - // When the IPC VPN connection has not been started yet, start it - OvsBeginIPCAsyncConnectionIfEmpty(s, se, c); - - // State transition - c->Status = OPENVPN_CHANNEL_STATUS_TLS_VPN_CONNECTING; - } - } - } - break; - - case OPENVPN_CHANNEL_STATUS_TLS_VPN_CONNECTING: - case OPENVPN_CHANNEL_STATUS_ESTABLISHED: - if (FifoSize(recv_fifo) >= 1) - { - char tmp[MAX_SIZE]; - UINT read_size = OvsPeekStringFromFifo(recv_fifo, tmp, sizeof(tmp)); - - if (read_size >= 1) - { - Debug("Client->Server (c=%u): %s\n", c->KeyId, tmp); - - ReadFifo(recv_fifo, NULL, read_size); - - if (StartWith(tmp, "PUSH_REQUEST")) - { - WriteFifo(send_fifo, se->PushReplyStr, StrLen(se->PushReplyStr)); - } - } - } - break; - } -} - -// Calculate the proper MSS -UINT OvsCalcTcpMss(OPENVPN_SERVER *s, OPENVPN_SESSION *se, OPENVPN_CHANNEL *c) -{ - UINT ret = MTU_FOR_PPPOE; - // Validate arguments - if (s == NULL || se == NULL || c == NULL) - { - return 0; - } - - if (c->MdSend == NULL || c->CipherEncrypt == NULL) - { - return 0; - } - - if (se->Protocol == OPENVPN_PROTOCOL_TCP) - { - // Calculation is not required for TCP mode - return 0; - } - - // IPv4 / IPv6 - if (IsIP4(&se->ClientIp)) - { - ret -= 20; - } - else - { - ret -= 40; - } - - // UDP - ret -= 8; - - // opcode - ret -= 1; - - // HMAC - ret -= c->MdSend->Size; - - // IV - ret -= c->CipherEncrypt->IvSize; - - // Packet ID - ret -= 4; - - if (c->CipherEncrypt->IsNullCipher == false) - { - // block - ret -= c->CipherEncrypt->BlockSize; - } - - if (se->Mode == OPENVPN_MODE_L2) - { - // Inner Ethernet Header - ret -= 14; - } - - // Inner IPv4 - ret -= 20; - - // Inner TCP - ret -= 20; - - return ret; -} - -// When the IPC VPN connection has not been started yet, start it -void OvsBeginIPCAsyncConnectionIfEmpty(OPENVPN_SERVER *s, OPENVPN_SESSION *se, OPENVPN_CHANNEL *c) -{ - // Validate arguments - if (s == NULL || se == NULL || c == NULL) - { - return; - } - - if (IsIPCConnected(se->Ipc) == false) - { - FreeIPC(se->Ipc); - - se->Ipc = NULL; - } - - if (se->IpcAsync == NULL) - { - LIST *pi; - IPC_PARAM p; - ETHERIP_ID id; - - Zero(&p, sizeof(p)); - Zero(&id, sizeof(id)); - - // Parse the user name - PPPParseUsername(s->Cedar, c->ClientKey.Username, &id); - - - // Build IPC connection parameters - StrCpy(p.ClientName, sizeof(p.ClientName), OPENVPN_IPC_CLIENT_NAME); - StrCpy(p.Postfix, sizeof(p.Postfix), (se->Mode == OPENVPN_MODE_L3 ? OPENVPN_IPC_POSTFIX_L3 : OPENVPN_IPC_POSTFIX_L2)); - - StrCpy(p.UserName, sizeof(p.UserName), id.UserName); - StrCpy(p.HubName, sizeof(p.HubName), id.HubName); - StrCpy(p.Password, sizeof(p.Password), c->ClientKey.Password); - - Copy(&p.ClientIp, &se->ClientIp, sizeof(IP)); - p.ClientPort = se->ClientPort; - - Copy(&p.ServerIp, &se->ServerIp, sizeof(IP)); - p.ServerPort = se->ServerPort; - - if (c->CipherEncrypt->IsNullCipher == false) - { - StrCpy(p.CryptName, sizeof(p.CryptName), c->CipherEncrypt->Name); - } - - // OpenVPN sends the default gateway's MAC address, - // if the option --push-peer-info is enabled. - // It also sends all of the client's environment - // variables whose names start with "UV_". - pi = NewEntryList(c->ClientKey.PeerInfo, "\n", "=\t"); - - // Check presence of custom hostname - if (EntryListHasKey(pi, "UV_HOSTNAME")) - { - StrCpy(p.ClientHostname, sizeof(p.ClientHostname), EntryListStrValue(pi, "UV_HOSTNAME")); - } - else // Use the default gateway's MAC address - { - StrCpy(p.ClientHostname, sizeof(p.ClientHostname), EntryListStrValue(pi, "IV_HWADDR")); - } - - FreeEntryList(pi); - - if (se->Mode == OPENVPN_MODE_L3) - { - // L3 Mode - p.IsL3Mode = true; - } - else - { - // L2 Mode - p.BridgeMode = true; - } - - if (IsEmptyStr(c->ClientKey.Username) || IsEmptyStr(c->ClientKey.Password)) - { - // OpenVPN X.509 certificate authentication will be used only when no username / password is specified - if (c->ClientCert.X != NULL) - { - p.ClientCertificate = c->ClientCert.X; - } - } - - p.Layer = (se->Mode == OPENVPN_MODE_L2) ? IPC_LAYER_2 : IPC_LAYER_3; - - // Calculate the MSS - p.Mss = OvsCalcTcpMss(s, se, c); - Debug("MSS=%u\n", p.Mss); - - // Start an IPC connection - se->IpcAsync = NewIPCAsync(s->Cedar, &p, s->SockEvent); - } -} - -// Peek a NULL-terminated string from the FIFO -UINT OvsPeekStringFromFifo(FIFO *f, char *str, UINT str_size) -{ - UINT i; - bool ok = false; - // Validate arguments - if (f == NULL || str == NULL || str_size == 0) - { - return 0; - } - - StrCpy(str, str_size, ""); - - for (i = 0; i < MIN(str_size, FifoSize(f)); i++) - { - char c = *(((char *)FifoPtr(f)) + i); - - if (c != 0) - { - str[i] = c; - } - else - { - str[i] = 0; - i++; - ok = true; - break; - } - } - - if (ok == false) - { - return 0; - } - - return i; -} - -// Set session parameters -void OvsSetupSessionParameters(OPENVPN_SERVER *s, OPENVPN_SESSION *se, OPENVPN_CHANNEL *c, OPENVPN_KEY_METHOD_2 *data) -{ - LIST *o; - BUF *b; - char opt_str[MAX_SIZE]; - char *cipher_name, *md_name; - // Validate arguments - if (s == NULL || se == NULL || c == NULL || data == NULL) - { - return; - } - - Copy(&c->ClientKey, data, sizeof(OPENVPN_KEY_METHOD_2)); - - // Parse the parameter string - Debug("Parsing Option Str: %s\n", data->OptionString); - - OvsLog(s, se, c, "LO_OPTION_STR_RECV", data->OptionString); - - if (c->ClientCert.X != NULL) - { - if (c->ClientCert.X->subject_name != NULL) - { - OvsLog(s, se, c, "LO_CLIENT_CERT", c->ClientCert.X->subject_name->CommonName); - } - else - { - OvsLog(s, se, c, "LO_CLIENT_CERT", "(unknown CN)"); - } - } - else if (!c->ClientCert.PreverifyErr) - { - OvsLog(s, se, c, "LO_CLIENT_NO_CERT"); - } - else - { - OvsLog(s, se, c, "LO_CLIENT_UNVERIFIED_CERT", c->ClientCert.PreverifyErrMessage); - } - - Zero(opt_str, sizeof(opt_str)); - StrCpy(opt_str, sizeof(opt_str), data->OptionString); - if (s->Cedar != NULL && (IsEmptyStr(opt_str) || StartWith(opt_str, "V0 UNDEF") || InStr(opt_str, ",") == false)) - { - StrCpy(opt_str, sizeof(opt_str), s->DefaultClientOption); - } - - o = NewEntryList(opt_str, ",", " \t"); - - if (se->Mode == OPENVPN_MODE_UNKNOWN) - { - UINT mtu; - // Layer - if (StrCmpi(EntryListStrValue(o, "dev-type"), "tun") == 0) - { - // L3 - se->Mode = OPENVPN_MODE_L3; - } - else - { - // L2 - se->Mode = OPENVPN_MODE_L2; - } - - // Link MTU - mtu = EntryListIntValue(o, "link-mtu"); - if (mtu == 0) - { - mtu = OPENVPN_MTU_LINK; - } - se->LinkMtu = mtu; - - // Tun MTU - mtu = EntryListIntValue(o, "tun-mtu"); - if (mtu == 0) - { - mtu = OPENVPN_MTU_TUN; - } - se->TunMtu = mtu; - } - - // Protocol - if (se->Protocol == OPENVPN_PROTOCOL_TCP) - { - // TCP - if (IsIP6(&se->ClientIp) == false) - { - StrCpy(c->Proto, sizeof(c->Proto), "TCPv4_SERVER"); - } - else - { - StrCpy(c->Proto, sizeof(c->Proto), "TCPv6_SERVER"); - } - } - else - { - // UDP - if (IsIP6(&se->ClientIp) == false) - { - StrCpy(c->Proto, sizeof(c->Proto), "UDPv4"); - } - else - { - StrCpy(c->Proto, sizeof(c->Proto), "UDPv6"); - } - } - - // Encryption algorithm - cipher_name = EntryListStrValue(o, "cipher"); - - // Hash algorithm - md_name = EntryListStrValue(o, "auth"); - - // Random number generation - Rand(c->ServerKey.Random1, sizeof(c->ServerKey.Random1)); - Rand(c->ServerKey.Random2, sizeof(c->ServerKey.Random2)); - - // Generate the Master Secret - b = NewBuf(); - WriteBuf(b, OPENVPN_PREMASTER_LABEL, StrLen(OPENVPN_PREMASTER_LABEL)); - WriteBuf(b, c->ClientKey.Random1, sizeof(c->ClientKey.Random1)); - WriteBuf(b, c->ServerKey.Random1, sizeof(c->ServerKey.Random1)); - Enc_tls1_PRF(b->Buf, b->Size, - c->ClientKey.PreMasterSecret, sizeof(c->ClientKey.PreMasterSecret), - c->MasterSecret, sizeof(c->MasterSecret)); - FreeBuf(b); - - // Generate an Expansion Key - b = NewBuf(); - WriteBuf(b, OPENVPN_EXPANSION_LABEL, StrLen(OPENVPN_EXPANSION_LABEL)); - WriteBuf(b, c->ClientKey.Random2, sizeof(c->ClientKey.Random2)); - WriteBuf(b, c->ServerKey.Random2, sizeof(c->ServerKey.Random2)); - WriteBufInt64(b, se->ClientSessionId); - WriteBufInt64(b, se->ServerSessionId); - Enc_tls1_PRF(b->Buf, b->Size, c->MasterSecret, sizeof(c->MasterSecret), - c->ExpansionKey, sizeof(c->ExpansionKey)); - FreeBuf(b); - - // Set up the encryption algorithm - c->CipherEncrypt = OvsGetCipher(cipher_name); - c->CipherDecrypt = OvsGetCipher(cipher_name); - SetCipherKey(c->CipherDecrypt, c->ExpansionKey + 0, false); - SetCipherKey(c->CipherEncrypt, c->ExpansionKey + 128, true); - - if (c->CipherDecrypt->IsAeadCipher) - { - // In AEAD mode the IV is composed by the packet ID and a part of the HMAC key - Copy(c->IvRecv + sizeof(c->LastDataPacketId), c->ExpansionKey + 64, c->CipherDecrypt->IvSize - sizeof(c->LastDataPacketId)); - Copy(c->IvSend + sizeof(c->LastDataPacketId), c->ExpansionKey + 192, c->CipherEncrypt->IvSize - sizeof(c->LastDataPacketId)); - } - else - { - // Set up the hash algorithm - c->MdSend = OvsGetMd(md_name); - c->MdRecv = OvsGetMd(md_name); - SetMdKey(c->MdRecv, c->ExpansionKey + 64, c->MdRecv->Size); - SetMdKey(c->MdSend, c->ExpansionKey + 192, c->MdSend->Size); - } - - // We pass the cipher name sent from the OpenVPN client, unless it's a different cipher, to prevent a message such as: - // WARNING: 'cipher' is used inconsistently, local='cipher AES-128-GCM', remote='cipher aes-128-gcm' - // It happens because OpenVPN uses "strcmp()" to compare the local and remote parameters: - // https://github.com/OpenVPN/openvpn/blob/a6fd48ba36ede465b0905a95568c3ec0d425ca71/src/openvpn/options.c#L3819-L3831 - if (StrCmpi(cipher_name, c->CipherEncrypt->Name) != 0) - { - cipher_name = c->CipherEncrypt->Name; - } - - // Generate the response option string - Format(c->ServerKey.OptionString, sizeof(c->ServerKey.OptionString), - "V4,dev-type %s,link-mtu %u,tun-mtu %u,proto %s," - "cipher %s,auth %s,keysize %u,key-method 2,tls-server", - (se->Mode == OPENVPN_MODE_L2 ? "tap" : "tun"), - se->LinkMtu, - se->TunMtu, - c->Proto, - cipher_name, md_name, c->CipherEncrypt->KeySize * 8); - - FreeEntryList(o); - - Debug("OvsSetupSessionParameters(): Built OptionString: %s\n", c->ServerKey.OptionString); - OvsLog(s, se, c, "LO_OPTION_STR_SEND", c->ServerKey.OptionString); -} - -// Get the encryption algorithm -CIPHER *OvsGetCipher(char *name) -{ - CIPHER *c = NULL; - - // OpenVPN sends the cipher name in uppercase, even if it's not standard, - // thus we have to convert it to lowercase for EVP_get_cipherbyname(). - char lowercase_name[MAX_SIZE]; - StrCpy(lowercase_name, sizeof(lowercase_name), name); - StrLower(lowercase_name); - - if (IsEmptyStr(lowercase_name) == false) - { - c = NewCipher(lowercase_name); - } - - if (c == NULL) - { - c = NewCipher(OPENVPN_DEFAULT_CIPHER); - } - - return c; -} - -// Get the hash algorithm -MD *OvsGetMd(char *name) -{ - MD *m = NULL; - - if (IsEmptyStr(name) == false) - { - m = NewMd(name); - } - - if (m == NULL) - { - m = NewMd(OPENVPN_DEFAULT_MD); - } - - return m; -} - -// Build the data from KEY_METHOD2 -BUF *OvsBuildKeyMethod2(OPENVPN_KEY_METHOD_2 *d) -{ - BUF *b; - UCHAR uc; - // Validate arguments - if (d == NULL) - { - return NULL; - } - - b = NewBuf(); - - // Reserved - WriteBufInt(b, 0); - - // Method - uc = 2; - WriteBuf(b, &uc, sizeof(UCHAR)); - - // Random1 - WriteBuf(b, d->Random1, sizeof(d->Random1)); - - // Random2 - WriteBuf(b, d->Random2, sizeof(d->Random2)); - - // Option String - OvsWriteStringToBuf(b, d->OptionString, sizeof(d->OptionString)); - - // Username - OvsWriteStringToBuf(b, d->Username, sizeof(d->Username)); - - // Password - OvsWriteStringToBuf(b, d->Password, sizeof(d->Password)); - - // PeerInfo - OvsWriteStringToBuf(b, d->PeerInfo, sizeof(d->PeerInfo)); - - return b; -} - -// Append a string to buf -void OvsWriteStringToBuf(BUF *b, char *str, UINT max_size) -{ - USHORT us; - UINT i; - char *tmp; - // Validate arguments - if (b == NULL) - { - return; - } - if (str == NULL) - { - str = ""; - } - - if (StrLen(str) == 0) - { - us = 0; - WriteBuf(b, &us, sizeof(USHORT)); - return; - } - - i = StrSize(str); - i = MIN(i, max_size); - us = Endian16((USHORT)i); - WriteBuf(b, &us, sizeof(USHORT)); - - tmp = Malloc(i); - Copy(tmp, str, i); - tmp[i - 1] = 0; - WriteBuf(b, tmp, i); - - Free(tmp); -} - -// Parse the KEY_METHOD2 -UINT OvsParseKeyMethod2(OPENVPN_KEY_METHOD_2 *ret, UCHAR *data, UINT size, bool client_mode) -{ - BUF *b; - UINT read_size = 0; - UINT ui; - UCHAR uc; - // Validate arguments - Zero(ret, sizeof(OPENVPN_KEY_METHOD_2)); - if (ret == NULL || data == NULL || size == 0) - { - return 0; - } - - b = NewBuf(); - WriteBuf(b, data, size); - SeekBuf(b, 0, 0); - - // Reserved - if (ReadBuf(b, &ui, sizeof(UINT)) == sizeof(UINT)) - { - // Method - if (ReadBuf(b, &uc, sizeof(UCHAR)) == sizeof(UCHAR) && uc == 2) - { - // Pre Master Secret - if (client_mode == false || ReadBuf(b, ret->PreMasterSecret, sizeof(ret->PreMasterSecret)) == sizeof(ret->PreMasterSecret)) - { - // Random1 - if (ReadBuf(b, ret->Random1, sizeof(ret->Random1)) == sizeof(ret->Random1)) - { - // Random2 - if (ReadBuf(b, ret->Random2, sizeof(ret->Random2)) == sizeof(ret->Random2)) - { - // String - if (OvsReadStringFromBuf(b, ret->OptionString, sizeof(ret->OptionString)) && - OvsReadStringFromBuf(b, ret->Username, sizeof(ret->Username)) && - OvsReadStringFromBuf(b, ret->Password, sizeof(ret->Password))) - { - if (!OvsReadStringFromBuf(b, ret->PeerInfo, sizeof(ret->PeerInfo))) - { - Zero(ret->PeerInfo, sizeof(ret->PeerInfo)); - } - read_size = b->Current; - } - } - } - } - } - } - - FreeBuf(b); - - return read_size; -} - -// Read a string from BUF -bool OvsReadStringFromBuf(BUF *b, char *str, UINT str_size) -{ - USHORT us; - // Validate arguments - if (b == NULL || str == NULL) - { - return false; - } - - if (ReadBuf(b, &us, sizeof(USHORT)) != sizeof(USHORT)) - { - return false; - } - - us = Endian16(us); - - if (us == 0) - { - StrCpy(str, str_size, ""); - return true; - } - - if (us > str_size) - { - return false; - } - - if (ReadBuf(b, str, us) != us) - { - return false; - } - - if (str[us - 1] != 0) - { - return false; - } - - return true; -} - -// Transmission of control packet (Automatic segmentation with the maximum size) -void OvsSendControlPacketWithAutoSplit(OPENVPN_CHANNEL *c, UCHAR opcode, UCHAR *data, UINT data_size) -{ - BUF *b; - // Validate arguments - if (c == NULL || (data_size != 0 && data == NULL)) - { - return; - } - - b = NewBuf(); - WriteBuf(b, data, data_size); - SeekBuf(b, 0, 0); - - while (true) - { - UCHAR tmp[OPENVPN_CONTROL_PACKET_MAX_DATASIZE]; - UINT size = ReadBuf(b, tmp, sizeof(tmp)); - - if (size == 0) - { - break; - } - - OvsSendControlPacket(c, opcode, tmp, size); - //Debug(" *** CNT SEND %u\n", size); - } - - FreeBuf(b); -} - -// Send the control packet -void OvsSendControlPacket(OPENVPN_CHANNEL *c, UCHAR opcode, UCHAR *data, UINT data_size) -{ - OvsSendControlPacketEx(c, opcode, data, data_size, false); -} -void OvsSendControlPacketEx(OPENVPN_CHANNEL *c, UCHAR opcode, UCHAR *data, UINT data_size, bool no_resend) -{ - OPENVPN_CONTROL_PACKET *p; - // Validate arguments - if (c == NULL || (data_size != 0 && data == NULL)) - { - return; - } - - p = ZeroMalloc(sizeof(OPENVPN_CONTROL_PACKET)); - - p->NoResend = no_resend; - - p->OpCode = opcode; - p->PacketId = c->NextSendPacketId++; - - if (data != NULL) - { - p->Data = Clone(data, data_size); - p->DataSize = data_size; - } - - p->NextSendTime = 0; - - Add(c->SendControlPacketList, p); -} - -// Release the control packet being transmitted -void OvsFreeControlPacket(OPENVPN_CONTROL_PACKET *p) -{ - // Validate arguments - if (p == NULL) - { - return; - } - - if (p->Data != NULL) - { - Free(p->Data); - } - - Free(p); -} - -// Get a list of packet ID to be responded -UINT OvsGetAckReplyList(OPENVPN_CHANNEL *c, UINT *ret) -{ - UINT i; - LIST *o = NULL; - UINT num; - // Validate arguments - if (c == NULL || ret == NULL) - { - return 0; - } - - num = MIN(LIST_NUM(c->AckReplyList), OPENVPN_MAX_NUMACK); - - for (i = 0; i < num; i++) - { - UINT *v = LIST_DATA(c->AckReplyList, i); - - if (o == NULL) - { - o = NewListFast(NULL); - } - - Add(o, v); - - ret[i] = *v; - } - - for (i = 0; i < LIST_NUM(o); i++) - { - UINT *v = LIST_DATA(o, i); - - Delete(c->AckReplyList, v); - - Free(v); - } - - ReleaseList(o); - - return num; -} - -// Release the channel -void OvsFreeChannel(OPENVPN_CHANNEL *c) -{ - UINT i; - // Validate arguments - if (c == NULL) - { - return; - } - - if (c->SslPipe != NULL) - { - FreeSslPipe(c->SslPipe); - } - - ReleaseIntList(c->AckReplyList); - - for (i = 0; i < LIST_NUM(c->SendControlPacketList); i++) - { - OPENVPN_CONTROL_PACKET *p = LIST_DATA(c->SendControlPacketList, i); - - OvsFreeControlPacket(p); - } - - ReleaseList(c->SendControlPacketList); - - FreeCipher(c->CipherDecrypt); - FreeCipher(c->CipherEncrypt); - - FreeMd(c->MdRecv); - FreeMd(c->MdSend); - - if (c->ClientCert.X != NULL) - { - FreeX(c->ClientCert.X); - } - - Free(c); -} - -// Create a new channel -OPENVPN_CHANNEL *OvsNewChannel(OPENVPN_SESSION *se, UCHAR key_id) -{ - OPENVPN_CHANNEL *c; - // Validate arguments - if (se == NULL) - { - return NULL; - } - - c = ZeroMalloc(sizeof(OPENVPN_CHANNEL)); - - c->Session = se; - c->Server = se->Server; - - c->Status = OPENVPN_CHANNEL_STATUS_INIT; - - c->AckReplyList = NewIntList(true); - - c->SendControlPacketList = NewListFast(NULL); - - c->KeyId = key_id; - - Rand(c->IvSend, sizeof(c->IvSend)); - Rand(c->IvRecv, sizeof(c->IvRecv)); - - //c->NextRekey = se->Server->Now + (UINT64)5000; - - se->LastCreatedChannelIndex = key_id; - - return c; -} - -// Create a new server-side channel ID -UINT64 OvsNewServerSessionId(OPENVPN_SERVER *s) -{ - // Validate arguments - if (s == NULL) - { - return 0; - } - - while (true) - { - UINT64 id = Rand64(); - UINT i; - bool exists = false; - - if (id == 0 || id == (UINT64)(0xFFFFFFFFFFFFFFFFULL)) - { - continue; - } - - for (i = 0; i < LIST_NUM(s->SessionList); i++) - { - OPENVPN_SESSION *se = LIST_DATA(s->SessionList, i); - if (se->ServerSessionId == id) - { - exists = true; - } - } - - if (exists == false) - { - return id; - } - } -} - -// Build and submit the OpenVPN data packet -void OvsSendDataPacket(OPENVPN_CHANNEL *c, UCHAR key_id, UINT data_packet_id, void *data, UINT data_size) -{ - const UCHAR op = ((OPENVPN_P_DATA_V1 << 3) & 0xF8) | (key_id & 0x07); - UCHAR *dest_data; - UINT dest_size; - // Validate arguments - if (c == NULL || data == NULL || data_size == 0) - { - return; - } - - // [ xxx ] = unprotected - // [ - xxx - ] = authenticated - // [ * xxx * ] = encrypted and authenticated - - if (c->CipherEncrypt->IsAeadCipher) - { - // [ opcode ] [ - packet ID - ] [ TAG ] [ * packet payload * ] - UCHAR tag[16]; - - // Update variable part (packet ID) of IV - WRITE_UINT(c->IvSend, data_packet_id); - - // Prepare a buffer to store the results - dest_data = Malloc(sizeof(op) + sizeof(data_packet_id) + sizeof(tag) + data_size + 256); - - // Set data size to the maximum known - dest_size = sizeof(op) + sizeof(data_packet_id) + sizeof(tag); - - // Write opcode - dest_data[0] = op; - - // Write packet ID - WRITE_UINT(dest_data + sizeof(op), data_packet_id); - - // Write encrypted payload - dest_size += OvsEncrypt(c->CipherEncrypt, NULL, c->IvSend, tag, dest_data + dest_size, data, data_size, c->IvSend, sizeof(data_packet_id)); - - // Write authentication tag - Copy(dest_data + sizeof(op) + sizeof(data_packet_id), tag, sizeof(tag)); - } - else - { - // [ opcode ] [ HMAC ] [ - IV - ] [ * packet ID * ] [ * packet payload * ] - UINT encrypted_size = sizeof(data_packet_id) + data_size; - UCHAR *encrypted_data = ZeroMalloc(encrypted_size); - WRITE_UINT(encrypted_data, data_packet_id); - Copy(encrypted_data + sizeof(data_packet_id), data, data_size); - - // Prepare a buffer to store the results - dest_data = Malloc(sizeof(op) + c->MdSend->Size + c->CipherEncrypt->IvSize + encrypted_size + 256); - - // Set data size to the maximum known - dest_size = sizeof(op); - - // Write opcode - dest_data[0] = op; - - // Write IV, encrypted packet ID and payload - dest_size += OvsEncrypt(c->CipherEncrypt, c->MdSend, c->IvSend, NULL, dest_data + sizeof(op), encrypted_data, encrypted_size, NULL, 0); - - Free(encrypted_data); - - // Update the IV - Copy(c->IvSend, dest_data + dest_size - c->CipherEncrypt->IvSize, c->CipherEncrypt->IvSize); - } - - OvsSendPacketRawNow(c->Server, c->Session, dest_data, dest_size); -} - -// Build an OpenVPN control packet -BUF *OvsBuildPacket(OPENVPN_PACKET *p) -{ - BUF *b; - UCHAR uc; - UINT num_ack; - // Validate arguments - if (p == NULL) - { - return NULL; - } - - b = NewBuf(); - - // OpCode + KeyID - uc = ((p->OpCode << 3) & 0xF8) | (p->KeyId & 0x07); - WriteBufChar(b, uc); - - if (p->OpCode == OPENVPN_P_DATA_V1) - { - // Data Packet - WriteBuf(b, p->Data, p->DataSize); - SeekBuf(b, 0, 0); - return b; - } - - // Sender Channel ID - WriteBufInt64(b, p->MySessionId); - - // NumAck - num_ack = MIN(p->NumAck, OPENVPN_MAX_NUMACK); - WriteBufChar(b, (UCHAR)num_ack); - - if (p->NumAck >= 1) - { - UINT i; - - for (i = 0; i < num_ack; i++) - { - WriteBufInt(b, (UCHAR)p->AckPacketId[i]); - } - - // Received Channel ID - WriteBufInt64(b, p->YourSessionId); - } - - if (p->OpCode != OPENVPN_P_ACK_V1) - { - // Packet ID - WriteBufInt(b, p->PacketId); - - // Payload - if (p->DataSize >= 1 && p->Data != NULL) - { - WriteBuf(b, p->Data, p->DataSize); - } - } - - SeekBuf(b, 0, 0); - - return b; -} - -// Parse the OpenVPN packet -OPENVPN_PACKET *OvsParsePacket(UCHAR *data, UINT size) -{ - UCHAR uc; - OPENVPN_PACKET *ret = NULL; - // Validate arguments - if (data == NULL || size == 0) - { - return NULL; - } - - ret = ZeroMalloc(sizeof(OPENVPN_PACKET)); - - uc = *((UCHAR *)data); - data++; - size--; - - ret->OpCode = ((uc & 0xF8) >> 3) & 0x1F; - ret->KeyId = uc & 0x07; - - if (ret->OpCode == OPENVPN_P_DATA_V1) - { - // Data packet - ret->DataSize = size; - ret->Data = Clone(data, size); - return ret; - } - - // Sender Channel ID - if (size < sizeof(UINT64)) - { - goto LABEL_ERROR; - } - ret->MySessionId = READ_UINT64(data); - data += sizeof(UINT64); - size -= sizeof(UINT64); - - // ACK - if (size < 1) - { - goto LABEL_ERROR; - } - uc = *((UCHAR *)data); - data++; - size--; - - ret->NumAck = uc; - - if (ret->NumAck > 4) - { - goto LABEL_ERROR; - } - - if (ret->NumAck >= 1) - { - UINT i; - - if (size < (sizeof(UINT) * (UINT)ret->NumAck + sizeof(UINT64))) - { - goto LABEL_ERROR; - } - - for (i = 0; i < ret->NumAck; i++) - { - UINT ui; - - ui = READ_UINT(data); - - ret->AckPacketId[i] = ui; - - data += sizeof(UINT); - size -= sizeof(UINT); - } - - ret->YourSessionId = READ_UINT64(data); - data += sizeof(UINT64); - size -= sizeof(UINT64); - } - - if (ret->OpCode != OPENVPN_P_ACK_V1) - { - // Read the Packet ID Because in the case of other than ACK - if (size < sizeof(UINT)) - { - goto LABEL_ERROR; - } - - ret->PacketId = READ_UINT(data); - data += sizeof(UINT); - size -= sizeof(UINT); - - // Payload - ret->DataSize = size; - if (size >= 1) - { - ret->Data = Clone(data, size); - } - } - - return ret; - -LABEL_ERROR: - OvsFreePacket(ret); - return NULL; -} - -// Release the OpenVPN packet -void OvsFreePacket(OPENVPN_PACKET *p) -{ - // Validate arguments - if (p == NULL) - { - return; - } - - if (p->Data != NULL) - { - Free(p->Data); - } - - Free(p); -} - -// If the session does not exist, create a session -OPENVPN_SESSION *OvsFindOrCreateSession(OPENVPN_SERVER *s, IP *server_ip, UINT server_port, IP *client_ip, UINT client_port, UINT protocol) -{ - OPENVPN_SESSION *se; - // Validate arguments - if (s == NULL || server_ip == NULL || server_port == 0 || client_ip == NULL || client_port == 0) - { - return NULL; - } - - se = OvsSearchSession(s, server_ip, server_port, client_ip, client_port, protocol); - if (se == NULL) - { - se = OvsNewSession(s, server_ip, server_port, client_ip, client_port, protocol); - - if (se != NULL) - { - Insert(s->SessionList, se); - } - } - - return se; -} - -// Get the number of sessions currently connected from the IP address of the client -UINT OvsGetNumSessionByClientIp(OPENVPN_SERVER *s, IP *ip) -{ - UINT i; - UINT ret = 0; - // Validate arguments - if (s == NULL || ip == NULL) - { - return 0; - } - - for (i = 0; i < LIST_NUM(s->SessionList); i++) - { - OPENVPN_SESSION *se = LIST_DATA(s->SessionList, i); - - if (CmpIpAddr(&se->ClientIp, ip) == 0) - { - ret++; - } - } - - return ret; -} - -// Create a new session -OPENVPN_SESSION *OvsNewSession(OPENVPN_SERVER *s, IP *server_ip, UINT server_port, IP *client_ip, UINT client_port, UINT protocol) -{ - OPENVPN_SESSION *se; - char server_ip_str[MAX_SIZE]; - char client_ip_str[MAX_SIZE]; - // Validate arguments - if (s == NULL || server_ip == NULL || server_port == 0 || client_ip == NULL || client_port == 0) - { - return NULL; - } - - - if (OvsGetNumSessionByClientIp(s, client_ip) > OPENVPN_QUOTA_MAX_NUM_SESSIONS_PER_IP) - { - // Number of sessions from the same IP address too many - return NULL; - } - - if (LIST_NUM(s->SessionList) > OPENVPN_QUOTA_MAX_NUM_SESSIONS) - { - // Too many OpenVPN sessions - return NULL; - } - - se = ZeroMalloc(sizeof(OPENVPN_SESSION)); - - se->Server = s; - - Copy(&se->ClientIp, client_ip, sizeof(IP)); - se->ClientPort = client_port; - - Copy(&se->ServerIp, server_ip, sizeof(IP)); - se->ServerPort = server_port; - - se->ObfuscationMode = s->Obfuscation ? INFINITE : OPENVPN_SCRAMBLE_MODE_DISABLED; - - se->LastCommTick = s->Now; - - se->Protocol = protocol; - - se->ServerSessionId = OvsNewServerSessionId(se->Server); - - se->CreatedTick = s->Now; - - se->Id = s->NextSessionId; - s->NextSessionId++; - - IPToStr(server_ip_str, sizeof(server_ip_str), server_ip); - IPToStr(client_ip_str, sizeof(client_ip_str), client_ip); - Debug("OpenVPN New Session: %s:%u -> %s:%u Proto=%u\n", server_ip_str, server_port, - client_ip_str, client_port, protocol); - - return se; -} - -// Release the session -void OvsFreeSession(OPENVPN_SESSION *se) -{ - UINT i; - // Validate arguments - if (se == NULL) - { - return; - } - - // If there is IP addresses which is got from a DHCP server in the session, release it - if (se->Ipc != NULL) - { - if (se->Mode == OPENVPN_MODE_L3) - { - if (se->IpcAsync != NULL) - { - IP dhcp_ip; - - UINTToIP(&dhcp_ip, se->IpcAsync->L3ClientAddressOption.ServerAddress); - - IPCDhcpFreeIP(se->Ipc, &dhcp_ip); - IPC_PROTO_SET_STATUS(se->Ipc, IPv6State, IPC_PROTO_STATUS_CLOSED); - IPCProcessL3EventsIPv4Only(se->Ipc); - } - } - } - - // Release the channel - for (i = 0; i < OPENVPN_NUM_CHANNELS; i++) - { - OPENVPN_CHANNEL *c = se->Channels[i]; - - if (c != NULL) - { - OvsFreeChannel(c); - } - } - - // Release the IPC - if (se->Ipc != NULL) - { - FreeIPC(se->Ipc); - } - - if (se->IpcAsync != NULL) - { - FreeIPCAsync(se->IpcAsync); - } - - Free(se); -} - -// Search the session from the endpoint information -OPENVPN_SESSION *OvsSearchSession(OPENVPN_SERVER *s, IP *server_ip, UINT server_port, IP *client_ip, UINT client_port, UINT protocol) -{ - OPENVPN_SESSION *se; - OPENVPN_SESSION t; - // Validate arguments - if (s == NULL || server_ip == NULL || server_port == 0 || client_ip == NULL || client_port == 0) - { - return NULL; - } - - Copy(&t.ClientIp, client_ip, sizeof(IP)); - t.ClientPort = client_port; - Copy(&t.ServerIp, server_ip, sizeof(IP)); - t.ServerPort = server_port; - t.Protocol = protocol; - - se = Search(s->SessionList, &t); - - return se; -} - -// Receive packets in the OpenVPN server -void OvsRecvPacket(OPENVPN_SERVER *s, LIST *recv_packet_list, UINT protocol) -{ - UINT i, j; - LIST *delete_session_list = NULL; - // Validate arguments - if (s == NULL || recv_packet_list == NULL) - { - return; - } - - s->Now = Tick64(); - - // Process for all sessions - for (i = 0; i < LIST_NUM(s->SessionList); i++) - { - OPENVPN_SESSION *se = LIST_DATA(s->SessionList, i); - - if (se->Ipc != NULL) - { - if (se->Mode == OPENVPN_MODE_L3) - { - // Flush the ARP table of the IPC - IPCFlushArpTableEx(se->Ipc, s->Now); - } - } - } - - // Process received packets - for (i = 0; i < LIST_NUM(recv_packet_list); i++) - { - UDPPACKET *p = LIST_DATA(recv_packet_list, i); - - OvsProceccRecvPacket(s, p, protocol); - } - - // Treat for all sessions and all channels - for (i = 0; i < LIST_NUM(s->SessionList); i++) - { - OPENVPN_CHANNEL *latest_channel = NULL; - UINT64 max_tick = 0; - OPENVPN_SESSION *se = LIST_DATA(s->SessionList, i); - bool is_disconnected = false; - - if (se->Ipc != NULL) - { - if (se->Mode == OPENVPN_MODE_L3) - { - IPCProcessL3EventsIPv4Only(se->Ipc); - } - } - - for (j = 0; j < OPENVPN_NUM_CHANNELS; j++) - { - OPENVPN_CHANNEL *c = se->Channels[j]; - - if (c != NULL) - { - if (c->RekeyInitiated == false && ((c->NextRekey <= s->Now && c->NextRekey != 0) || (c->LastDataPacketId >= OPENVPN_MAX_PACKET_ID_FOR_TRIGGER_REKEY))) - { - OPENVPN_CHANNEL *c2; - // Send a soft reset by creating a new channel - UINT next_channel_id = se->LastCreatedChannelIndex + 1; - if (next_channel_id >= OPENVPN_NUM_CHANNELS) - { - next_channel_id = 1; - } - if (se->Channels[next_channel_id] != NULL) - { - // Release when there is a channel data already - OvsFreeChannel(se->Channels[next_channel_id]); - se->Channels[next_channel_id] = NULL; - } - - // Create a new channel - c2 = OvsNewChannel(se, (UCHAR)next_channel_id); - c2->IsInitiatorServer = true; - se->Channels[next_channel_id] = c2; - Debug("OpenVPN New Channel for Re-Keying :%u\n", next_channel_id); - OvsLog(s, se, c, "LO_INITIATE_REKEY"); - - // Send a soft reset - OvsSendControlPacket(c2, OPENVPN_P_CONTROL_SOFT_RESET_V1, NULL, 0); - - c->RekeyInitiated = true; - } - } - - if (c != NULL) - { - switch (c->Status) - { - case OPENVPN_CHANNEL_STATUS_TLS_VPN_CONNECTING: - // Check whether the connection process completed if there is a channel running a VPN connection process - if (se->IpcAsync != NULL) - { - if (se->IpcAsync->Done) - { - if (se->IpcAsync->Ipc != NULL) - { - char option_str[4096]; - char l3_options[MAX_SIZE]; - - // Successful in VPN connection - Debug("OpenVPN Channel %u Established (new key).\n", j); - OvsLog(s, se, c, "LO_CHANNEL_ESTABLISHED"); - - // Return the PUSH_REPLY - Format(option_str, sizeof(option_str), - "PUSH_REPLY,ping %u,ping-restart %u", - (OPENVPN_PING_SEND_INTERVAL / 1000), - (OPENVPN_RECV_TIMEOUT / 1000)); - - if (se->Mode == OPENVPN_MODE_L3) - { - // Add such as the IP address that was acquired from the DHCP server - // if the L3 mode to the option character string - DHCP_OPTION_LIST *cao = &se->IpcAsync->L3ClientAddressOption; - char ip_client[64]; - char ip_subnet_mask[64]; - char ip_dns1[64]; - char ip_dns2[64]; - char ip_wins1[64]; - char ip_wins2[64]; - char ip_defgw[64]; - - ClearStr(ip_dns1, sizeof(ip_dns1)); - ClearStr(ip_dns2, sizeof(ip_dns2)); - ClearStr(ip_wins1, sizeof(ip_wins1)); - ClearStr(ip_wins2, sizeof(ip_wins2)); - ClearStr(ip_defgw, sizeof(ip_defgw)); - - IPToStr32(ip_client, sizeof(ip_client), - cao->ClientAddress); - - IPToStr32(ip_subnet_mask, sizeof(ip_subnet_mask), - cao->SubnetMask); - - Format(l3_options, sizeof(l3_options), - ",topology subnet"); - StrCat(option_str, sizeof(option_str), l3_options); - - Format(l3_options, sizeof(l3_options), - ",ifconfig %s %s", - ip_client, - ip_subnet_mask); - StrCat(option_str, sizeof(option_str), l3_options); - - // Domain name - if (IsEmptyStr(cao->DomainName) == false) - { - Format(l3_options, sizeof(l3_options), - ",dhcp-option DOMAIN %s", cao->DomainName); - StrCat(option_str, sizeof(option_str), l3_options); - } - - // DNS server address 1 - if (cao->DnsServer != 0) - { - char ip_str[64]; - IPToStr32(ip_str, sizeof(ip_str), cao->DnsServer); - Format(l3_options, sizeof(l3_options), - ",dhcp-option DNS %s", ip_str); - StrCat(option_str, sizeof(option_str), l3_options); - - StrCpy(ip_dns1, sizeof(ip_dns1), ip_str); - } - - // DNS server address 2 - if (cao->DnsServer2 != 0) - { - char ip_str[64]; - IPToStr32(ip_str, sizeof(ip_str), cao->DnsServer2); - Format(l3_options, sizeof(l3_options), - ",dhcp-option DNS %s", ip_str); - StrCat(option_str, sizeof(option_str), l3_options); - - StrCpy(ip_dns2, sizeof(ip_dns2), ip_str); - } - - // WINS address 1 - if (cao->WinsServer != 0) - { - char ip_str[64]; - IPToStr32(ip_str, sizeof(ip_str), cao->WinsServer); - Format(l3_options, sizeof(l3_options), - ",dhcp-option WINS %s", ip_str); - StrCat(option_str, sizeof(option_str), l3_options); - - StrCpy(ip_wins1, sizeof(ip_wins1), ip_str); - } - - // WINS address 2 - if (cao->WinsServer2 != 0) - { - char ip_str[64]; - IPToStr32(ip_str, sizeof(ip_str), cao->WinsServer2); - Format(l3_options, sizeof(l3_options), - ",dhcp-option WINS %s", ip_str); - StrCat(option_str, sizeof(option_str), l3_options); - - StrCpy(ip_wins2, sizeof(ip_wins2), ip_str); - } - - // Default gateway - if (cao->Gateway != 0) - { - char ip_str[64]; - IPToStr32(ip_str, sizeof(ip_str), cao->Gateway); - Format(l3_options, sizeof(l3_options), - ",route-gateway %s,redirect-gateway def1", ip_str); - StrCat(option_str, sizeof(option_str), l3_options); - - StrCpy(ip_defgw, sizeof(ip_defgw), ip_str); - } - else - { -#if 0 // Currently disabled - // If the default gateway is not specified, add the static routing table - // entry for the local IP subnet - IP local_network; - IP client_ip; - IP subnet_mask; - - UINTToIP(&client_ip, cao->ClientAddress); - UINTToIP(&subnet_mask, cao->SubnetMask); - - Zero(&local_network, sizeof(IP)); - IPAnd4(&local_network, &client_ip, &subnet_mask); - - Format(l3_options, sizeof(l3_options), - ",route %r %r vpn_gateway", - &local_network, - &cao->SubnetMask); - - StrCat(option_str, sizeof(option_str), l3_options); -#endif - } - - // Classless routing table - if (cao->ClasslessRoute.NumExistingRoutes >= 1) - { - UINT i; - for (i = 0; i < MAX_DHCP_CLASSLESS_ROUTE_ENTRIES; i++) - { - DHCP_CLASSLESS_ROUTE *r = &cao->ClasslessRoute.Entries[i]; - - if (r->Exists) - { - Format(l3_options, sizeof(l3_options), - ",route %r %r vpn_gateway", - &r->Network, &r->SubnetMask); - - StrCat(option_str, sizeof(option_str), l3_options); - } - } - } - - OvsLog(s, se, c, "LP_SET_IPV4_PARAM", - ip_client, ip_subnet_mask, ip_defgw, ip_dns1, ip_dns2, ip_wins1, ip_wins2); - } - else - { - // OpenVPN L2 mode. To fix the bug of OpenVPN 2.4.6 and particular version of kernel mode TAP driver - // on Linux, the TAP device must be up after the OpenVPN client is connected. - // However there is no direct push instruction to do so to OpenVPN client. - // Therefore we push the dummy IPv4 address (RFC7600) to the OpenVPN client. - if (s->PushDummyIPv4AddressOnL2Mode) - { - StrCat(option_str, sizeof(option_str), ",ifconfig 192.0.0.8 255.255.255.240"); - } - } - - // From https://community.openvpn.net/openvpn/wiki/Openvpn23ManPage: - // - // --block-outside-dns - // Block DNS servers on other network adapters to prevent DNS leaks. - // This option prevents any application from accessing TCP or UDP port 53 except one inside the tunnel. - // It uses Windows Filtering Platform (WFP) and works on Windows Vista or later. - // This option is considered unknown on non-Windows platforms and unsupported on Windows XP, resulting in fatal error. - // You may want to use --setenv opt or --ignore-unknown-option (not suitable for Windows XP) to ignore said error. - // Note that pushing unknown options from server does not trigger fatal errors. - StrCat(option_str, sizeof(option_str), ",block-outside-dns"); - - WriteFifo(c->SslPipe->SslInOut->SendFifo, option_str, StrSize(option_str)); - - Debug("Push Str: %s\n", option_str); - OvsLog(s, se, c, "LO_PUSH_REPLY", option_str); - - StrCpy(se->PushReplyStr, sizeof(se->PushReplyStr), option_str); - - se->Ipc = se->IpcAsync->Ipc; - se->IpcAsync->Ipc = NULL; - - s->SessionEstablishedCount++; - - // Set a Sock Event of IPC to Sock Event of the UDP Listener - IPCSetSockEventWhenRecvL2Packet(se->Ipc, s->SockEvent); - - // State transition - c->Status = OPENVPN_CHANNEL_STATUS_ESTABLISHED; - c->EstablishedTick = s->Now; - se->Established = true; - se->LastCommTick = Tick64(); - } - else - { - char *str; - - if (se->IpcAsync->DhcpAllocFailed) - { - OvsLog(s, se, c, "LP_DHCP_REQUEST_NG"); - } - - // Failed to connect VPN - Debug("OpenVPN Channel %u Failed.\n", j); - OvsLog(s, se, c, "LO_CHANNEL_FAILED"); - - // Return the AUTH_FAILED - str = "AUTH_FAILED"; - WriteFifo(c->SslPipe->SslInOut->SendFifo, str, StrSize(str)); - - s->SessionEstablishedCount++; - - // State transition - c->Status = OPENVPN_CHANNEL_STATUS_DISCONNECTED; - - FreeIPCAsync(se->IpcAsync); - se->IpcAsync = NULL; - } - } - } - break; - - case OPENVPN_CHANNEL_STATUS_ESTABLISHED: - // Monitor the IPC whether not disconnected when there is a VPN connection completed channel - if (IsIPCConnected(se->Ipc) == false) - { - // Send the RESTART since IPC is disconnected - char *str = "RESTART"; - Debug("OpenVPN Channel %u Disconnected by HUB.\n", j); - - OvsLog(s, se, c, "LO_CHANNEL_DISCONNECTED_BY_HUB"); - - WriteFifo(c->SslPipe->SslInOut->SendFifo, str, StrSize(str)); - - // State transition - c->Status = OPENVPN_CHANNEL_STATUS_DISCONNECTED; - - // Set the session to disconnected state - se->Established = false; - se->LastCommTick = s->Now; - } - break; - } - } - - if (c != NULL) - { - // If there is a packet to be transmitted physically in SSL, send it - if (c->SslPipe != NULL && SyncSslPipe(c->SslPipe)) - { - if (FifoSize(c->SslPipe->RawOut->RecvFifo) >= 1) - { - Debug("RawOut Fifo Size (c=%u): %u\n", c->KeyId, FifoSize(c->SslPipe->RawOut->RecvFifo)); - - OvsSendControlPacketWithAutoSplit(c, OPENVPN_P_CONTROL_V1, - FifoPtr(c->SslPipe->RawOut->RecvFifo), - FifoSize(c->SslPipe->RawOut->RecvFifo)); - - ReadFifo(c->SslPipe->RawOut->RecvFifo, NULL, FifoSize(c->SslPipe->RawOut->RecvFifo)); - } - } - } - - if (c != NULL) - { - UINT num; - UINT acks[OPENVPN_MAX_NUMACK]; - UINT k; - - // Packet transmission - for (k = 0; k < LIST_NUM(c->SendControlPacketList); k++) - { - OPENVPN_CONTROL_PACKET *cp = LIST_DATA(c->SendControlPacketList, k); - - if (cp->NextSendTime <= s->Now) - { - if (cp->NoResend == false || cp->NumSent == 0) // To address the UDP reflection amplification attack: https://github.com/SoftEtherVPN/SoftEtherVPN/issues/1001 - { - OPENVPN_PACKET *p; - - cp->NumSent++; - - num = OvsGetAckReplyList(c, acks); - - p = OvsNewControlPacket(cp->OpCode, j, se->ServerSessionId, num, acks, - se->ClientSessionId, cp->PacketId, cp->DataSize, cp->Data); - - OvsSendPacketNow(s, se, p); - - OvsFreePacket(p); - - cp->NextSendTime = s->Now + (UINT64)OPENVPN_CONTROL_PACKET_RESEND_INTERVAL; - - AddInterrupt(s->Interrupt, cp->NextSendTime); - } - } - } - - // If the response with an ACK-only packet is required, respond such that - num = OvsGetAckReplyList(c, acks); - - if (num >= 1) - { - OPENVPN_PACKET *p = OvsNewControlPacket(OPENVPN_P_ACK_V1, j, se->ServerSessionId, - num, acks, se->ClientSessionId, 0, 0, NULL); - - OvsSendPacketNow(s, se, p); - - OvsFreePacket(p); - } - } - } - - if (se->Ipc != NULL) - { - if (se->Mode == OPENVPN_MODE_L3) - { - if (se->IpcAsync != NULL) - { - // Update DHCP address - if (se->IpcAsync->L3NextDhcpRenewTick <= s->Now) - { - IP ip; - - se->IpcAsync->L3NextDhcpRenewTick = s->Now + se->IpcAsync->L3DhcpRenewInterval; - - UINTToIP(&ip, se->IpcAsync->L3ClientAddressOption.ServerAddress); - - IPCDhcpRenewIP(se->Ipc, &ip); - } - } - - IPCProcessL3EventsIPv4Only(se->Ipc); - } - - IPCProcessInterrupts(se->Ipc); - } - - // Choose the latest channel in all established channels - for (j = 0; j < OPENVPN_NUM_CHANNELS; j++) - { - OPENVPN_CHANNEL *c = se->Channels[j]; - - if (c != NULL) - { - if (c->Status == OPENVPN_CHANNEL_STATUS_ESTABLISHED) - { - if (max_tick <= c->EstablishedTick) - { - max_tick = c->EstablishedTick; - latest_channel = c; - } - } - } - } - - if (se->Established == false) - { - latest_channel = NULL; - } - - // Send the data using the latest channel (when there is no transmission channel, suck out the queue simply) - if (se->Mode == OPENVPN_MODE_L2) - { - // Get an Ethernet frame from IPC - while (true) - { - BLOCK *b = IPCRecvL2(se->Ipc); - if (b == NULL) - { - break; - } - - if (latest_channel != NULL && s->SupressSendPacket == false) - { - OvsSendDataPacket(latest_channel, latest_channel->KeyId, ++latest_channel->LastDataPacketId, b->Buf, b->Size); - } - - FreeBlock(b); - } - } - else - { - // Get an IPv4 packet from IPC - while (true) - { - BLOCK *b = IPCRecvIPv4(se->Ipc); - if (b == NULL) - { - break; - } - - if (latest_channel != NULL && s->SupressSendPacket == false) - { - OvsSendDataPacket(latest_channel, latest_channel->KeyId, ++latest_channel->LastDataPacketId, b->Buf, b->Size); - } - - FreeBlock(b); - } - } - - // Send a Ping - if (latest_channel != NULL) - { - if ((se->NextPingSendTick == 0) || (se->NextPingSendTick <= s->Now)) - { - se->NextPingSendTick = s->Now + (UINT64)(OPENVPN_PING_SEND_INTERVAL); - - OvsSendDataPacket(latest_channel, latest_channel->KeyId, ++latest_channel->LastDataPacketId, - ping_signature, sizeof(ping_signature)); - //Debug("."); - - AddInterrupt(s->Interrupt, se->NextPingSendTick); - } - } - - if ((se->Established == false) && (s->Now >= (se->CreatedTick + (UINT64)OPENVPN_NEW_SESSION_DEADLINE_TIMEOUT))) - { - is_disconnected = true; - } - - if (se->Established && (s->Now >= (se->LastCommTick + (UINT64)OPENVPN_RECV_TIMEOUT))) - { - is_disconnected = true; - } - - if (is_disconnected) - { - if (delete_session_list == NULL) - { - delete_session_list = NewListFast(NULL); - } - - Add(delete_session_list, se); - } - } - - if (delete_session_list != NULL) - { - UINT i; - - for (i = 0; i < LIST_NUM(delete_session_list); i++) - { - OPENVPN_SESSION *se = LIST_DATA(delete_session_list, i); - - Debug("Deleting Session %p\n", se); - - OvsFreeSession(se); - - s->DisconnectCount++; - - Delete(s->SessionList, se); - } - - ReleaseList(delete_session_list); - } -} - -// Send the packet now -void OvsSendPacketNow(OPENVPN_SERVER *s, OPENVPN_SESSION *se, OPENVPN_PACKET *p) -{ - BUF *b; - UINT i; - // Validate arguments - if (s == NULL || se == NULL || p == NULL) - { - return; - } - - Debug("Sending Opcode=%u ", p->OpCode); - if (p->NumAck >= 1) - { - Debug("Sending ACK Packet IDs (c=%u): ", p->KeyId); - for (i = 0; i < p->NumAck; i++) - { - Debug("%u ", p->AckPacketId[i]); - } - } - Debug("\n"); - - b = OvsBuildPacket(p); - - OvsSendPacketRawNow(s, se, b->Buf, b->Size); - - Free(b); -} -void OvsSendPacketRawNow(OPENVPN_SERVER *s, OPENVPN_SESSION *se, void *data, UINT size) -{ - UDPPACKET *u; - - // Validate arguments - if (s == NULL || se == NULL || data == NULL || size == 0) - { - Free(data); - return; - } - - // Scramble the packet - switch (se->ObfuscationMode) - { - case OPENVPN_SCRAMBLE_MODE_DISABLED: - break; - case OPENVPN_SCRAMBLE_MODE_XORMASK: - OvsDataXorMask(data, size, s->ObfuscationMask, StrLen(s->ObfuscationMask)); - break; - case OPENVPN_SCRAMBLE_MODE_XORPTRPOS: - OvsDataXorPtrPos(data, size); - break; - case OPENVPN_SCRAMBLE_MODE_REVERSE: - OvsDataReverse(data, size); - break; - case OPENVPN_SCRAMBLE_MODE_OBFUSCATE: - OvsDataXorPtrPos(data, size); - OvsDataReverse(data, size); - OvsDataXorPtrPos(data, size); - OvsDataXorMask(data, size, s->ObfuscationMask, StrLen(s->ObfuscationMask)); - } - - u = NewUdpPacket(&se->ServerIp, se->ServerPort, &se->ClientIp, se->ClientPort, - data, size); - - Add(s->SendPacketList, u); -} -// Create a new OpenVPN control packet -OPENVPN_PACKET *OvsNewControlPacket(UCHAR opcode, UCHAR key_id, UINT64 my_channel_id, UINT num_ack, - UINT *ack_packet_ids, UINT64 your_channel_id, UINT packet_id, - UINT data_size, UCHAR *data) -{ - OPENVPN_PACKET *p = ZeroMalloc(sizeof(OPENVPN_PACKET)); - UINT i; - - p->OpCode = opcode; - p->KeyId = key_id; - p->MySessionId = my_channel_id; - p->NumAck = num_ack; - - for (i = 0; i < MIN(num_ack, OPENVPN_MAX_NUMACK); i++) - { - p->AckPacketId[i] = ack_packet_ids[i]; - } - - p->YourSessionId = your_channel_id; - p->PacketId = packet_id; - - if (data_size != 0 && data != NULL) - { - p->Data = Clone(data, data_size); - p->DataSize = data_size; - } - - return p; -} - -// Comparison function of the entries in the session list -int OvsCompareSessionList(void *p1, void *p2) -{ - OPENVPN_SESSION *s1, *s2; - int i; - // Validate arguments - if (p1 == NULL || p2 == NULL) - { - return 0; - } - s1 = *(OPENVPN_SESSION **)p1; - s2 = *(OPENVPN_SESSION **)p2; - if (s1 == NULL || s2 == NULL) - { - return 0; - } - - i = CmpIpAddr(&s1->Protocol, &s2->Protocol); - if (i != 0) - { - return i; - } - - i = CmpIpAddr(&s1->ClientIp, &s2->ClientIp); - if (i != 0) - { - return i; - } - - i = COMPARE_RET(s1->ClientPort, s2->ClientPort); - if (i != 0) - { - return i; - } - - i = CmpIpAddr(&s1->ServerIp, &s2->ServerIp); - if (i != 0) - { - return i; - } - - i = COMPARE_RET(s1->ServerPort, s2->ServerPort); - if (i != 0) - { - return i; - } - - return 0; -} - -// Create a new OpenVPN server -OPENVPN_SERVER *NewOpenVpnServer(const LIST *options, CEDAR *cedar, INTERRUPT_MANAGER *interrupt, SOCK_EVENT *sock_event) -{ - UINT i; - OPENVPN_SERVER *s; - - if (options == NULL || cedar == NULL || interrupt == NULL || sock_event == NULL) - { - return NULL; - } - - s = ZeroMalloc(sizeof(OPENVPN_SERVER)); - - for (i = 0; i < LIST_NUM(options); ++i) - { - const PROTO_OPTION *option = LIST_DATA(options, i); - if (StrCmp(option->Name, "DefaultClientOption") == 0) - { - s->DefaultClientOption = CopyStr(option->String); - } - else if (StrCmp(option->Name, "Obfuscation") == 0) - { - s->Obfuscation = option->Bool; - } - else if (StrCmp(option->Name, "ObfuscationMask") == 0) - { - s->ObfuscationMask = CopyStr(option->String); - } - else if (StrCmp(option->Name, "PushDummyIPv4AddressOnL2Mode") == 0) - { - s->PushDummyIPv4AddressOnL2Mode = option->Bool; - } - } - - s->Cedar = cedar; - s->Interrupt = interrupt; - s->SockEvent = sock_event; - - s->SessionList = NewList(OvsCompareSessionList); - s->RecvPacketList = NewListFast(NULL); - s->SendPacketList = NewListFast(NULL); - - s->Now = Tick64(); - s->Giveup = s->Now + OPENVPN_NEW_SESSION_DEADLINE_TIMEOUT; - - s->NextSessionId = 1; - - s->Dh = DhNewFromBits(cedar->DhParamBits); - - return s; -} - -// Release the OpenVPN server -void FreeOpenVpnServer(OPENVPN_SERVER *s) -{ - UINT i; - // Validate arguments - if (s == NULL) - { - return; - } - - // Release the sessions list - for (i = 0; i < LIST_NUM(s->SessionList); ++i) - { - OPENVPN_SESSION *se = LIST_DATA(s->SessionList, i); - OvsFreeSession(se); - } - - ReleaseList(s->SessionList); - - // Release the incoming packets list - for (i = 0; i < LIST_NUM(s->RecvPacketList); ++i) - { - UDPPACKET *p = LIST_DATA(s->RecvPacketList, i); - FreeUdpPacket(p); - } - - ReleaseList(s->RecvPacketList); - - // Release the outgoing packets list - for (i = 0; i < LIST_NUM(s->SendPacketList); ++i) - { - UDPPACKET *p = LIST_DATA(s->SendPacketList, i); - FreeUdpPacket(p); - } - - ReleaseList(s->SendPacketList); - - DhFree(s->Dh); - - Free(s->DefaultClientOption); - Free(s->ObfuscationMask); - - Free(s); -} +// SoftEther VPN Source Code - Developer Edition Master Branch +// Cedar Communication Module + + +// Proto_OpenVPN.c +// OpenVPN protocol stack + +#include "CedarPch.h" + +// Ping signature of the OpenVPN protocol +static UCHAR ping_signature[] = +{ + 0x2a, 0x18, 0x7b, 0xf3, 0x64, 0x1e, 0xb4, 0xcb, + 0x07, 0xed, 0x2d, 0x0a, 0x98, 0x1f, 0xc7, 0x48 +}; + +const PROTO_IMPL *OvsGetProtoImpl() +{ + static const PROTO_IMPL impl = + { + OvsName, + OvsOptions, + OvsInit, + OvsFree, + OvsIsPacketForMe, + OvsProcessData, + OvsProcessDatagrams + }; + + return &impl; +} + +const char *OvsName() +{ + return "OpenVPN"; +} + +const PROTO_OPTION *OvsOptions() +{ + static const PROTO_OPTION options[] = + { + { .Name = "DefaultClientOption", .Type = PROTO_OPTION_STRING, .String = "dev-type tun,link-mtu 1500,tun-mtu 1500,cipher AES-128-CBC,auth SHA1,keysize 128,key-method 2,tls-client" }, + { .Name = "Obfuscation", .Type = PROTO_OPTION_BOOL, .Bool = false }, + { .Name = "ObfuscationMask", .Type = PROTO_OPTION_STRING, .String = ""}, + { .Name = "PushDummyIPv4AddressOnL2Mode", .Type = PROTO_OPTION_BOOL, .Bool = true }, + { .Name = NULL, .Type = PROTO_OPTION_UNKNOWN } + }; + + return options; +} + +bool OvsInit(void **param, const LIST *options, CEDAR *cedar, INTERRUPT_MANAGER *im, SOCK_EVENT *se, const char *cipher, const char *hostname) +{ + if (param == NULL || options == NULL || cedar == NULL || im == NULL || se == NULL) + { + return false; + } + + Debug("OvsInit(): cipher: %s, hostname: %s\n", cipher, hostname); + + *param = NewOpenVpnServer(options, cedar, im, se); + + return true; +} + +void OvsFree(void *param) +{ + FreeOpenVpnServer(param); +} + +// Check whether it's an OpenVPN packet +bool OvsIsPacketForMe(const PROTO_MODE mode, const UCHAR *data, const UINT size) +{ + if (mode == PROTO_MODE_TCP) + { + if (data == NULL || size < 2) + { + return false; + } + + if (data[0] == 0x00 && data[1] == 0x0E) + { + return true; + } + } + else if (mode == PROTO_MODE_UDP) + { + OPENVPN_PACKET *packet = OvsParsePacket(data, size); + if (packet == NULL) + { + return false; + } + + OvsFreePacket(packet); + return true; + } + + return false; +} + +bool OvsProcessData(void *param, TCP_RAW_DATA *in, FIFO *out) +{ + bool ret = true; + UINT i; + OPENVPN_SERVER *server = param; + UCHAR buf[OPENVPN_TCP_MAX_PACKET_SIZE]; + + if (server == NULL || in == NULL || out == NULL) + { + return false; + } + + // Separate to a list of datagrams by interpreting the data received from the TCP socket + while (true) + { + UDPPACKET *packet; + USHORT payload_size, packet_size; + FIFO *fifo = in->Data; + const UINT fifo_size = FifoSize(fifo); + + if (fifo_size < sizeof(USHORT)) + { + // Non-arrival + break; + } + + // The beginning of a packet contains the data size + payload_size = READ_USHORT(FifoPtr(fifo)); + packet_size = payload_size + sizeof(USHORT); + + if (payload_size == 0 || packet_size > sizeof(buf)) + { + ret = false; + Debug("OvsProcessData(): Invalid payload size: %u bytes\n", payload_size); + break; + } + + if (fifo_size < packet_size) + { + // Non-arrival + break; + } + + if (ReadFifo(fifo, buf, packet_size) != packet_size) + { + ret = false; + Debug("OvsProcessData(): ReadFifo() failed to read the packet\n"); + break; + } + + // Insert packet into the list + packet = NewUdpPacket(&in->SrcIP, in->SrcPort, &in->DstIP, in->DstPort, Clone(buf + sizeof(USHORT), payload_size), payload_size); + Add(server->RecvPacketList, packet); + } + + // Process the list of received datagrams + OvsRecvPacket(server, server->RecvPacketList, OPENVPN_PROTOCOL_TCP); + + // Release the received packet list + for (i = 0; i < LIST_NUM(server->RecvPacketList); ++i) + { + UDPPACKET *p = LIST_DATA(server->RecvPacketList, i); + FreeUdpPacket(p); + } + + DeleteAll(server->RecvPacketList); + + // Store in the queue by getting a list of the datagrams to be transmitted from the OpenVPN server + for (i = 0; i < LIST_NUM(server->SendPacketList); ++i) + { + UDPPACKET *p = LIST_DATA(server->SendPacketList, i); + + // Store the size in the TCP send queue first + USHORT us = Endian16((USHORT)p->Size); + + WriteFifo(out, &us, sizeof(USHORT)); + + // Write the data body + WriteFifo(out, p->Data, p->Size); + + // Packet release + FreeUdpPacket(p); + } + + DeleteAll(server->SendPacketList); + + if (server->Giveup <= server->Now) + { + UINT i; + for (i = 0; i < LIST_NUM(server->SessionList); ++i) + { + OPENVPN_SESSION *se = LIST_DATA(server->SessionList, i); + + if (se->Established) + { + return ret && server->DisconnectCount < 1; + } + } + + return false; + } + + server->SupressSendPacket = FifoSize(out) > MAX_BUFFERING_PACKET_SIZE; + + return ret; +} + +bool OvsProcessDatagrams(void *param, LIST *in, LIST *out) +{ + UINT i; + LIST *to_send; + OPENVPN_SERVER *server = param; + + if (server == NULL || in == NULL || out == NULL) + { + return false; + } + + OvsRecvPacket(server, in, OPENVPN_PROTOCOL_UDP); + + to_send = server->SendPacketList; + + for (i = 0; i < LIST_NUM(to_send); ++i) + { + Add(out, LIST_DATA(to_send, i)); + } + + DeleteAll(server->SendPacketList); + + if (server->Giveup <= server->Now) + { + UINT i; + for (i = 0; i < LIST_NUM(server->SessionList); ++i) + { + OPENVPN_SESSION *se = LIST_DATA(server->SessionList, i); + + if (se->Established) + { + return server->DisconnectCount < 1; + } + } + + return false; + } + + return true; +} + +// Write the OpenVPN log +void OvsLog(OPENVPN_SERVER *s, OPENVPN_SESSION *se, OPENVPN_CHANNEL *c, char *name, ...) +{ + wchar_t prefix[MAX_SIZE * 2]; + wchar_t buf2[MAX_SIZE * 2]; + va_list args; + // Validate arguments + if (s == NULL) + { + return; + } + if (se == NULL) + { + UniStrCpy(prefix, sizeof(prefix), _UU("LO_PREFIX_RAW")); + } + else + { + if (c == NULL) + { + UniFormat(prefix, sizeof(prefix), _UU("LO_PREFIX_SESSION"), + se->Id, &se->ClientIp, se->ClientPort, &se->ServerIp, se->ServerPort); + } + else + { + UniFormat(prefix, sizeof(prefix), _UU("LO_PREFIX_CHANNEL"), + se->Id, &se->ClientIp, se->ClientPort, &se->ServerIp, se->ServerPort, + c->KeyId); + } + } + va_start(args, name); + UniFormatArgs(buf2, sizeof(buf2), _UU(name), args); + va_end(args); + + UniStrCat(prefix, sizeof(prefix), buf2); + + WriteServerLog(s->Cedar, prefix); +} + +// Encrypt the data +UINT OvsEncrypt(CIPHER *cipher, MD *md, UCHAR *iv, UCHAR *tag, UCHAR *dest, UCHAR *src, UINT src_size, UCHAR *aad, UINT aad_size) +{ + // Validate arguments + if (cipher == NULL || (cipher->IsAeadCipher == false && md == NULL)) + { + return 0; + } + + if (cipher->IsAeadCipher) + { + // Encrypt in AEAD mode (no HMAC) + UINT dest_size = CipherProcessAead(cipher, iv, tag, 16, dest, src, src_size, aad, aad_size); + if (dest_size == 0) + { + Debug("OvsEncrypt(): CipherProcessAead() failed!\n"); + return 0; + } + + return dest_size; + } + else + { + // Encrypt in non-AEAD mode (with HMAC) + UINT ret; + UINT dest_size = CipherProcess(cipher, iv, dest + md->Size + cipher->IvSize, src, src_size); + if (dest_size == 0) + { + Debug("OvsEncrypt(): CipherProcess() failed!\n"); + return 0; + } + + // Copy the IV + Copy(dest + md->Size, iv, cipher->IvSize); + dest_size += cipher->IvSize; + + // Calculate the HMAC + ret = MdProcess(md, dest, dest + md->Size, dest_size); + if (ret == 0) + { + Debug("OvsEncrypt(): MdProcess() failed!\n"); + return 0; + } + + return dest_size + ret; + } +} + +// Decrypt the data +UINT OvsDecrypt(CIPHER *cipher, MD *md, UCHAR *iv, UCHAR *dest, UCHAR *src, UINT size) +{ + // Validate arguments + if (cipher == NULL) + { + return 0; + } + + if (cipher->IsAeadCipher) + { + UCHAR *tag = src; + + if (iv == NULL || size <= OPENVPN_TAG_SIZE) + { + return 0; + } + + src += OPENVPN_TAG_SIZE; + size -= OPENVPN_TAG_SIZE; + + // Payload + if (size >= 1 && (cipher->BlockSize == 0 || (size % cipher->BlockSize) == 0)) + { + // Decryption + UINT ret = CipherProcessAead(cipher, iv, tag, OPENVPN_TAG_SIZE, dest, src, size, iv, sizeof(UINT)); + if (ret == 0) + { + Debug("OvsDecrypt(): CipherProcessAead() failed!\n"); + } + + return ret; + } + } + else + { + UCHAR *hmac; + UCHAR hmac_test[128]; + + if (md == NULL || iv == NULL || size < (md->Size + cipher->IvSize + sizeof(UINT))) + { + return 0; + } + + // HMAC + hmac = src; + src += md->Size; + size -= md->Size; + + if (MdProcess(md, hmac_test, src, size) == 0) + { + Debug("OvsDecrypt(): MdProcess() failed!\n"); + return 0; + } + + if (Cmp(hmac_test, hmac, md->Size) != 0) + { + Debug("OvsDecrypt(): HMAC verification failed!\n"); + return 0; + } + + // IV + Copy(iv, src, cipher->IvSize); + src += cipher->IvSize; + size -= cipher->IvSize; + + // Payload + if (size >= 1 && (cipher->BlockSize == 0 || (size % cipher->BlockSize) == 0)) + { + // Decryption + UINT ret = CipherProcess(cipher, iv, dest, src, size); + if (ret == 0) + { + Debug("OvsDecrypt(): CipherProcess() failed!\n"); + } + + return ret; + } + } + + return 0; +} + +// XOR the bytes with the specified string +void OvsDataXorMask(void *data, const UINT data_size, const char *mask, const UINT mask_size) +{ + UINT i; + UCHAR *buf; + // Validate arguments + if (data == NULL || data_size == 0 || mask == NULL || mask_size == 0) + { + return; + } + + for (i = 0, buf = data; i < data_size; i++, buf++) + { + *buf = *buf ^ mask[i % mask_size]; + } +} + +// XOR each byte with its position within the buffer +void OvsDataXorPtrPos(void *data, const UINT size) +{ + UINT i; + UCHAR *buf; + // Validate arguments + if (data == NULL || size == 0) + { + return; + } + + for (i = 0, buf = data; i < size; i++, buf++) + { + *buf = *buf ^ i + 1; + } +} + +// Reverse bytes order if they're more than 2, keeping the first byte unchanged +void OvsDataReverse(void *data, const UINT size) +{ + UINT i; + UCHAR tmp; + UCHAR *buf_start, *buf_end; + // Validate arguments + if (data == NULL || size < 3) + { + return; + } + + for (i = 0, buf_start = (UCHAR *)data + 1, buf_end = (UCHAR *)data + (size - 1); i < (size - 1 ) / 2; i++, buf_start++, buf_end--) + { + tmp = *buf_start; + *buf_start = *buf_end; + *buf_end = tmp; + } +} + +// Detects the method used to obfuscate the packet +UINT OvsDetectObfuscation(void *data, UINT size, char *xormask) +{ + UINT ret; + void *tmp; + OPENVPN_PACKET *parsed_packet; + // Validate arguments + if (data == NULL || size == 0) + { + return INFINITE; + } + + ret = INFINITE; + tmp = NULL; + + // OPENVPN_SCRAMBLE_MODE_DISABLED + parsed_packet = OvsParsePacket(data, size); + if (parsed_packet != NULL) + { + ret = OPENVPN_SCRAMBLE_MODE_DISABLED; + goto final; + } + + // OPENVPN_SCRAMBLE_MODE_XORMASK + tmp = Clone(data, size); + + OvsDataXorMask(tmp, size, xormask, StrLen(xormask)); + + parsed_packet = OvsParsePacket(tmp, size); + if (parsed_packet != NULL) + { + ret = OPENVPN_SCRAMBLE_MODE_XORMASK; + goto final; + } + + Free(tmp); + + // OPENVPN_SCRAMBLE_MODE_XORPTRPOS + tmp = Clone(data, size); + + OvsDataXorPtrPos(tmp, size); + + parsed_packet = OvsParsePacket(tmp, size); + if (parsed_packet != NULL) + { + ret = OPENVPN_SCRAMBLE_MODE_XORPTRPOS; + goto final; + } + + Free(tmp); + + // OPENVPN_SCRAMBLE_MODE_REVERSE + tmp = Clone(data, size); + + OvsDataReverse(tmp, size); + + parsed_packet = OvsParsePacket(tmp, size); + if (parsed_packet != NULL) + { + ret = OPENVPN_SCRAMBLE_MODE_REVERSE; + goto final; + } + + Free(tmp); + + // OPENVPN_SCRAMBLE_MODE_OBFUSCATE + tmp = Clone(data, size); + + OvsDataXorMask(tmp, size, xormask, StrLen(xormask)); + OvsDataXorPtrPos(tmp, size); + OvsDataReverse(tmp, size); + OvsDataXorPtrPos(tmp, size); + + parsed_packet = OvsParsePacket(tmp, size); + if (parsed_packet != NULL) + { + ret = OPENVPN_SCRAMBLE_MODE_OBFUSCATE; + goto final; + } + +final: + OvsFreePacket(parsed_packet); + Free(tmp); + return ret; +} + +// Process the received packet +void OvsProceccRecvPacket(OPENVPN_SERVER *s, UDPPACKET *p, UINT protocol) +{ + OPENVPN_CHANNEL *c; + OPENVPN_SESSION *se; + OPENVPN_PACKET *recv_packet; + // Validate arguments + if (s == NULL || p == NULL) + { + return; + } + + // Search for the session + se = OvsFindOrCreateSession(s, &p->DstIP, p->DestPort, &p->SrcIP, p->SrcPort, protocol); + if (se == NULL) + { + return; + } + + // Detect obfuscation mode and save it for the next packets in the same session + if (se->ObfuscationMode == INFINITE) + { + se->ObfuscationMode = OvsDetectObfuscation(p->Data, p->Size, s->ObfuscationMask); + if (se->ObfuscationMode != INFINITE) + { + Debug("OvsProceccRecvPacket(): detected packet obfuscation/scrambling mode: %u\n", se->ObfuscationMode); + } + else + { + Debug("OvsProceccRecvPacket(): failed to detect packet obfuscation/scrambling mode!\n"); + return; + } + } + + // Handle scrambled packet + switch (se->ObfuscationMode) + { + case OPENVPN_SCRAMBLE_MODE_DISABLED: + break; + case OPENVPN_SCRAMBLE_MODE_XORMASK: + OvsDataXorMask(p->Data, p->Size, s->ObfuscationMask, StrLen(s->ObfuscationMask)); + break; + case OPENVPN_SCRAMBLE_MODE_XORPTRPOS: + OvsDataXorPtrPos(p->Data, p->Size); + break; + case OPENVPN_SCRAMBLE_MODE_REVERSE: + OvsDataReverse(p->Data, p->Size); + break; + case OPENVPN_SCRAMBLE_MODE_OBFUSCATE: + OvsDataXorMask(p->Data, p->Size, s->ObfuscationMask, StrLen(s->ObfuscationMask)); + OvsDataXorPtrPos(p->Data, p->Size); + OvsDataReverse(p->Data, p->Size); + OvsDataXorPtrPos(p->Data, p->Size); + } + + // Parse the packet + recv_packet = OvsParsePacket(p->Data, p->Size); + if (recv_packet == NULL) + { + Debug("OvsProceccRecvPacket(): OvsParsePacket() returned NULL!\n"); + return; + } + + c = se->Channels[recv_packet->KeyId]; + + if (recv_packet->OpCode != OPENVPN_P_DATA_V1) + { + // Control packet + Debug("OvsProceccRecvPacket(): Received control packet. PacketId: %u, OpCode: %u, KeyId: %u, MySessionId: %I64u\n", + recv_packet->PacketId, recv_packet->OpCode, recv_packet->KeyId, recv_packet->MySessionId); + + if (recv_packet->OpCode == OPENVPN_P_CONTROL_HARD_RESET_CLIENT_V2 || + recv_packet->OpCode == OPENVPN_P_CONTROL_SOFT_RESET_V1) + { + // Connection request packet + if (c != NULL && c->Status == OPENVPN_CHANNEL_STATUS_ESTABLISHED) + { + // If there's already an established data channel, release it + OvsFreeChannel(se->Channels[recv_packet->KeyId]); + c = se->Channels[recv_packet->KeyId] = NULL; + Debug("OvsProceccRecvPacket(): Released established data channel: %u\n", recv_packet->KeyId); + } + + if (c == NULL) + { + // Create a new channel + c = OvsNewChannel(se, recv_packet->KeyId); + if (se->ClientSessionId == 0) + { + se->ClientSessionId = recv_packet->MySessionId; + } + se->Channels[recv_packet->KeyId] = c; + Debug("OvsProceccRecvPacket(): Created a new channel: %u\n", recv_packet->KeyId); + OvsLog(s, se, c, "LO_NEW_CHANNEL"); + } + } + /* else if (recv_packet->OpCode == OPENVPN_P_CONTROL_SOFT_RESET_V1) + { + // Response to soft reset request packet + OPENVPN_PACKET *p; + + p = OvsNewControlPacket(OPENVPN_P_CONTROL_SOFT_RESET_V1, recv_packet->KeyId, se->ServerSessionId, + 0, NULL, 0, 0, 0, NULL); + + OvsSendPacketNow(s, se, p); + + OvsFreePacket(p); + } + */ + if (c != NULL) + { + // Delete the send packet list by looking the packet ID in the ACK list of arrived packet + OvsDeleteFromSendingControlPacketList(c, recv_packet->NumAck, recv_packet->AckPacketId); + + if (recv_packet->OpCode != OPENVPN_P_ACK_V1) + { + // Add the Packet ID of arrived packet to the list + InsertIntDistinct(c->AckReplyList, recv_packet->PacketId); + + if ((recv_packet->PacketId > c->MaxRecvPacketId) + || (recv_packet->OpCode == OPENVPN_P_CONTROL_HARD_RESET_CLIENT_V2) + || (recv_packet->OpCode == OPENVPN_P_CONTROL_SOFT_RESET_V1)) + { + c->MaxRecvPacketId = recv_packet->PacketId; + + // Process the received control packet + OvsProcessRecvControlPacket(s, se, c, recv_packet); + } + } + } + } + else + { + // Data packet + if (c != NULL && c->Status == OPENVPN_CHANNEL_STATUS_ESTABLISHED) + { + UINT size; + UCHAR *data = s->TmpBuf; + if (c->CipherDecrypt->IsAeadCipher) + { + // Update variable part (packet ID) of IV + Copy(c->IvRecv, recv_packet->Data, sizeof(recv_packet->PacketId)); + + // Decrypt + size = OvsDecrypt(c->CipherDecrypt, NULL, c->IvRecv, data, recv_packet->Data + sizeof(UINT), recv_packet->DataSize - sizeof(UINT)); + } + else + { + // Decrypt + size = OvsDecrypt(c->CipherDecrypt, c->MdRecv, c->IvRecv, data, recv_packet->Data, recv_packet->DataSize); + if (size > sizeof(UINT)) + { + // Seek buffer after the packet ID + data += sizeof(UINT); + size -= sizeof(UINT); + } + } + + // Update of last communication time + se->LastCommTick = s->Now; + + if (size < sizeof(ping_signature) || Cmp(data, ping_signature, sizeof(ping_signature)) != 0) + { + // Receive a packet! + if (se->Ipc != NULL) + { + switch (se->Mode) + { + case OPENVPN_MODE_L2: // Send an Ethernet packet to a session + IPCSendL2(se->Ipc, data, size); + break; + case OPENVPN_MODE_L3: // Send an IPv4 packet to a session + IPCSendIPv4(se->Ipc, data, size); + break; + } + } + } + } + } + + OvsFreePacket(recv_packet); +} + +// Remove a packet which the opponent has received from the transmission list +void OvsDeleteFromSendingControlPacketList(OPENVPN_CHANNEL *c, UINT num_acks, UINT *acks) +{ + LIST *o; + UINT i; + // Validate arguments + if (c == NULL || num_acks == 0) + { + return; + } + + o = NewListFast(NULL); + for (i = 0; i < num_acks; i++) + { + UINT ack = acks[i]; + UINT j; + + for (j = 0; j < LIST_NUM(c->SendControlPacketList); j++) + { + OPENVPN_CONTROL_PACKET *p = LIST_DATA(c->SendControlPacketList, j); + + if (p->PacketId == ack) + { + AddDistinct(o, p); + } + } + } + + for (i = 0; i < LIST_NUM(o); i++) + { + OPENVPN_CONTROL_PACKET *p = LIST_DATA(o, i); + + Delete(c->SendControlPacketList, p); + + OvsFreeControlPacket(p); + } + + ReleaseList(o); +} + +// Process the received control packet +void OvsProcessRecvControlPacket(OPENVPN_SERVER *s, OPENVPN_SESSION *se, OPENVPN_CHANNEL *c, OPENVPN_PACKET *p) +{ + FIFO *recv_fifo = NULL; + FIFO *send_fifo = NULL; + // Validate arguments + if (s == NULL || se == NULL || c == NULL || p == NULL) + { + return; + } + + if (p->OpCode == OPENVPN_P_CONTROL_V1) + { + Debug("SSL (c=%u): %u\n", c->KeyId, p->DataSize); + + if (c->SslPipe == NULL) + { + // Create an SSL pipe + Lock(s->Cedar->lock); + { + if (s->Dh->Size != s->Cedar->DhParamBits) + { + DhFree(s->Dh); + s->Dh = DhNewFromBits(s->Cedar->DhParamBits); + } + + c->SslPipe = NewSslPipeEx(true, s->Cedar->ServerX, s->Cedar->ServerK, s->Dh, true, &c->ClientCert); + } + Unlock(s->Cedar->lock); + + Debug("SSL Pipe Created (c=%u).\n", c->KeyId); + } + + if (c->SslPipe->IsDisconnected == false) + { + // Pour the physically received data into SSL pipe + if (FifoSize(c->SslPipe->RawIn->SendFifo) < OPENVPN_MAX_SSL_RECV_BUF_SIZE) + { + Debug("SSL_Write: %u\n", p->DataSize); + WriteFifo(c->SslPipe->RawIn->SendFifo, p->Data, p->DataSize); + } + SyncSslPipe(c->SslPipe); + } + } + + if (c->SslPipe != NULL && c->SslPipe->IsDisconnected == false) + { + recv_fifo = c->SslPipe->SslInOut->RecvFifo; + send_fifo = c->SslPipe->SslInOut->SendFifo; + } + + Debug("SIZE: recv_fifo = %u, send_fifo = %u\n", FifoSize(recv_fifo), FifoSize(send_fifo)); + + switch (c->Status) + { + case OPENVPN_CHANNEL_STATUS_INIT: + switch (p->OpCode) + { + case OPENVPN_P_CONTROL_SOFT_RESET_V1: + // Key update (soft reset) + if (se->Established) + { + if (c->IsInitiatorServer == false) + { + OvsSendControlPacket(c, OPENVPN_P_CONTROL_SOFT_RESET_V1, NULL, 0); + } + + c->Status = OPENVPN_CHANNEL_STATUS_TLS_WAIT_CLIENT_KEY; + c->IsRekeyChannel = true; + } + break; + + case OPENVPN_P_CONTROL_HARD_RESET_CLIENT_V2: + // New connection (hard reset) + OvsSendControlPacketEx(c, OPENVPN_P_CONTROL_HARD_RESET_SERVER_V2, NULL, 0, true); + + c->Status = OPENVPN_CHANNEL_STATUS_TLS_WAIT_CLIENT_KEY; + break; + } + break; + + case OPENVPN_CHANNEL_STATUS_TLS_WAIT_CLIENT_KEY: + if (FifoSize(recv_fifo) >= 1) + { + OPENVPN_KEY_METHOD_2 data; + UCHAR *ptr = FifoPtr(recv_fifo); + + // Parse OPENVPN_KEY_METHOD_2 + UINT read_size = OvsParseKeyMethod2(&data, ptr, FifoSize(recv_fifo), true); + if (read_size != 0) + { + BUF *b; + + // Success in parsing key information + ReadFifo(recv_fifo, NULL, read_size); + + // Set session parameters + OvsSetupSessionParameters(s, se, c, &data); + + // Build OPENVPN_KEY_METHOD_2 to respond + b = OvsBuildKeyMethod2(&c->ServerKey); + + // Transmission of the response data + if (b != NULL) + { + WriteFifo(send_fifo, b->Buf, b->Size); + + FreeBuf(b); + } + + // State transition + c->Status = OPENVPN_CHANNEL_STATUS_TLS_WAIT_CLIENT_PUSH_REQUEST; + if (c->IsRekeyChannel) + { + c->Status = OPENVPN_CHANNEL_STATUS_ESTABLISHED; + c->EstablishedTick = s->Now; + Debug("OpenVPN Channel %u Established (re-key).\n", c->KeyId); + OvsLog(s, se, c, "LO_CHANNEL_ESTABLISHED_NEWKEY"); + } + } + } + break; + + case OPENVPN_CHANNEL_STATUS_TLS_WAIT_CLIENT_PUSH_REQUEST: + if (FifoSize(recv_fifo) >= 1) + { + char tmp[MAX_SIZE]; + UINT read_size = OvsPeekStringFromFifo(recv_fifo, tmp, sizeof(tmp)); + + if (read_size >= 1) + { + Debug("Client->Server (c=%u): %s\n", c->KeyId, tmp); + + ReadFifo(recv_fifo, NULL, read_size); + + if (StartWith(tmp, "PUSH_REQUEST")) + { + // Since connection requested, start VPN connection + // When the IPC VPN connection has not been started yet, start it + OvsBeginIPCAsyncConnectionIfEmpty(s, se, c); + + // State transition + c->Status = OPENVPN_CHANNEL_STATUS_TLS_VPN_CONNECTING; + } + } + } + break; + + case OPENVPN_CHANNEL_STATUS_TLS_VPN_CONNECTING: + case OPENVPN_CHANNEL_STATUS_ESTABLISHED: + if (FifoSize(recv_fifo) >= 1) + { + char tmp[MAX_SIZE]; + UINT read_size = OvsPeekStringFromFifo(recv_fifo, tmp, sizeof(tmp)); + + if (read_size >= 1) + { + Debug("Client->Server (c=%u): %s\n", c->KeyId, tmp); + + ReadFifo(recv_fifo, NULL, read_size); + + if (StartWith(tmp, "PUSH_REQUEST")) + { + WriteFifo(send_fifo, se->PushReplyStr, StrLen(se->PushReplyStr)); + } + } + } + break; + } +} + +// Calculate the proper MSS +UINT OvsCalcTcpMss(OPENVPN_SERVER *s, OPENVPN_SESSION *se, OPENVPN_CHANNEL *c) +{ + UINT ret = MTU_FOR_PPPOE; + // Validate arguments + if (s == NULL || se == NULL || c == NULL) + { + return 0; + } + + if (c->MdSend == NULL || c->CipherEncrypt == NULL) + { + return 0; + } + + if (se->Protocol == OPENVPN_PROTOCOL_TCP) + { + // Calculation is not required for TCP mode + return 0; + } + + // IPv4 / IPv6 + if (IsIP4(&se->ClientIp)) + { + ret -= 20; + } + else + { + ret -= 40; + } + + // UDP + ret -= 8; + + // opcode + ret -= 1; + + // HMAC + ret -= c->MdSend->Size; + + // IV + ret -= c->CipherEncrypt->IvSize; + + // Packet ID + ret -= 4; + + if (c->CipherEncrypt->IsNullCipher == false) + { + // block + ret -= c->CipherEncrypt->BlockSize; + } + + if (se->Mode == OPENVPN_MODE_L2) + { + // Inner Ethernet Header + ret -= 14; + } + + // Inner IPv4 + ret -= 20; + + // Inner TCP + ret -= 20; + + return ret; +} + +// When the IPC VPN connection has not been started yet, start it +void OvsBeginIPCAsyncConnectionIfEmpty(OPENVPN_SERVER *s, OPENVPN_SESSION *se, OPENVPN_CHANNEL *c) +{ + // Validate arguments + if (s == NULL || se == NULL || c == NULL) + { + return; + } + + if (IsIPCConnected(se->Ipc) == false) + { + FreeIPC(se->Ipc); + + se->Ipc = NULL; + } + + if (se->IpcAsync == NULL) + { + LIST *pi; + IPC_PARAM p; + ETHERIP_ID id; + + Zero(&p, sizeof(p)); + Zero(&id, sizeof(id)); + + // Parse the user name + PPPParseUsername(s->Cedar, c->ClientKey.Username, &id); + + + // Build IPC connection parameters + StrCpy(p.ClientName, sizeof(p.ClientName), OPENVPN_IPC_CLIENT_NAME); + StrCpy(p.Postfix, sizeof(p.Postfix), (se->Mode == OPENVPN_MODE_L3 ? OPENVPN_IPC_POSTFIX_L3 : OPENVPN_IPC_POSTFIX_L2)); + + StrCpy(p.UserName, sizeof(p.UserName), id.UserName); + StrCpy(p.HubName, sizeof(p.HubName), id.HubName); + StrCpy(p.Password, sizeof(p.Password), c->ClientKey.Password); + + Copy(&p.ClientIp, &se->ClientIp, sizeof(IP)); + p.ClientPort = se->ClientPort; + + Copy(&p.ServerIp, &se->ServerIp, sizeof(IP)); + p.ServerPort = se->ServerPort; + + if (c->CipherEncrypt->IsNullCipher == false) + { + StrCpy(p.CryptName, sizeof(p.CryptName), c->CipherEncrypt->Name); + } + + // OpenVPN sends the default gateway's MAC address, + // if the option --push-peer-info is enabled. + // It also sends all of the client's environment + // variables whose names start with "UV_". + pi = NewEntryList(c->ClientKey.PeerInfo, "\n", "=\t"); + + // Check presence of custom hostname + if (EntryListHasKey(pi, "UV_HOSTNAME")) + { + StrCpy(p.ClientHostname, sizeof(p.ClientHostname), EntryListStrValue(pi, "UV_HOSTNAME")); + } + else // Use the default gateway's MAC address + { + StrCpy(p.ClientHostname, sizeof(p.ClientHostname), EntryListStrValue(pi, "IV_HWADDR")); + } + + FreeEntryList(pi); + + if (se->Mode == OPENVPN_MODE_L3) + { + // L3 Mode + p.IsL3Mode = true; + } + else + { + // L2 Mode + p.BridgeMode = true; + } + + if (IsEmptyStr(c->ClientKey.Username) || IsEmptyStr(c->ClientKey.Password)) + { + // OpenVPN X.509 certificate authentication will be used only when no username / password is specified + if (c->ClientCert.X != NULL) + { + p.ClientCertificate = c->ClientCert.X; + } + } + + p.Layer = (se->Mode == OPENVPN_MODE_L2) ? IPC_LAYER_2 : IPC_LAYER_3; + + // Calculate the MSS + p.Mss = OvsCalcTcpMss(s, se, c); + Debug("MSS=%u\n", p.Mss); + + // Start an IPC connection + se->IpcAsync = NewIPCAsync(s->Cedar, &p, s->SockEvent); + } +} + +// Peek a NULL-terminated string from the FIFO +UINT OvsPeekStringFromFifo(FIFO *f, char *str, UINT str_size) +{ + UINT i; + bool ok = false; + // Validate arguments + if (f == NULL || str == NULL || str_size == 0) + { + return 0; + } + + StrCpy(str, str_size, ""); + + for (i = 0; i < MIN(str_size, FifoSize(f)); i++) + { + char c = *(((char *)FifoPtr(f)) + i); + + if (c != 0) + { + str[i] = c; + } + else + { + str[i] = 0; + i++; + ok = true; + break; + } + } + + if (ok == false) + { + return 0; + } + + return i; +} + +// Set session parameters +void OvsSetupSessionParameters(OPENVPN_SERVER *s, OPENVPN_SESSION *se, OPENVPN_CHANNEL *c, OPENVPN_KEY_METHOD_2 *data) +{ + LIST *o; + BUF *b; + char opt_str[MAX_SIZE]; + char *cipher_name, *md_name; + // Validate arguments + if (s == NULL || se == NULL || c == NULL || data == NULL) + { + return; + } + + Copy(&c->ClientKey, data, sizeof(OPENVPN_KEY_METHOD_2)); + + // Parse the parameter string + Debug("Parsing Option Str: %s\n", data->OptionString); + + OvsLog(s, se, c, "LO_OPTION_STR_RECV", data->OptionString); + + if (c->ClientCert.X != NULL) + { + if (c->ClientCert.X->subject_name != NULL) + { + OvsLog(s, se, c, "LO_CLIENT_CERT", c->ClientCert.X->subject_name->CommonName); + } + else + { + OvsLog(s, se, c, "LO_CLIENT_CERT", "(unknown CN)"); + } + } + else if (!c->ClientCert.PreverifyErr) + { + OvsLog(s, se, c, "LO_CLIENT_NO_CERT"); + } + else + { + OvsLog(s, se, c, "LO_CLIENT_UNVERIFIED_CERT", c->ClientCert.PreverifyErrMessage); + } + + Zero(opt_str, sizeof(opt_str)); + StrCpy(opt_str, sizeof(opt_str), data->OptionString); + if (s->Cedar != NULL && (IsEmptyStr(opt_str) || StartWith(opt_str, "V0 UNDEF") || InStr(opt_str, ",") == false)) + { + StrCpy(opt_str, sizeof(opt_str), s->DefaultClientOption); + } + + o = NewEntryList(opt_str, ",", " \t"); + + if (se->Mode == OPENVPN_MODE_UNKNOWN) + { + UINT mtu; + // Layer + if (StrCmpi(EntryListStrValue(o, "dev-type"), "tun") == 0) + { + // L3 + se->Mode = OPENVPN_MODE_L3; + } + else + { + // L2 + se->Mode = OPENVPN_MODE_L2; + } + + // Link MTU + mtu = EntryListIntValue(o, "link-mtu"); + if (mtu == 0) + { + mtu = OPENVPN_MTU_LINK; + } + se->LinkMtu = mtu; + + // Tun MTU + mtu = EntryListIntValue(o, "tun-mtu"); + if (mtu == 0) + { + mtu = OPENVPN_MTU_TUN; + } + se->TunMtu = mtu; + } + + // Protocol + if (se->Protocol == OPENVPN_PROTOCOL_TCP) + { + // TCP + if (IsIP6(&se->ClientIp) == false) + { + StrCpy(c->Proto, sizeof(c->Proto), "TCPv4_SERVER"); + } + else + { + StrCpy(c->Proto, sizeof(c->Proto), "TCPv6_SERVER"); + } + } + else + { + // UDP + if (IsIP6(&se->ClientIp) == false) + { + StrCpy(c->Proto, sizeof(c->Proto), "UDPv4"); + } + else + { + StrCpy(c->Proto, sizeof(c->Proto), "UDPv6"); + } + } + + // Encryption algorithm + cipher_name = EntryListStrValue(o, "cipher"); + + // Hash algorithm + md_name = EntryListStrValue(o, "auth"); + + // Random number generation + Rand(c->ServerKey.Random1, sizeof(c->ServerKey.Random1)); + Rand(c->ServerKey.Random2, sizeof(c->ServerKey.Random2)); + + // Generate the Master Secret + b = NewBuf(); + WriteBuf(b, OPENVPN_PREMASTER_LABEL, StrLen(OPENVPN_PREMASTER_LABEL)); + WriteBuf(b, c->ClientKey.Random1, sizeof(c->ClientKey.Random1)); + WriteBuf(b, c->ServerKey.Random1, sizeof(c->ServerKey.Random1)); + Enc_tls1_PRF(b->Buf, b->Size, + c->ClientKey.PreMasterSecret, sizeof(c->ClientKey.PreMasterSecret), + c->MasterSecret, sizeof(c->MasterSecret)); + FreeBuf(b); + + // Generate an Expansion Key + b = NewBuf(); + WriteBuf(b, OPENVPN_EXPANSION_LABEL, StrLen(OPENVPN_EXPANSION_LABEL)); + WriteBuf(b, c->ClientKey.Random2, sizeof(c->ClientKey.Random2)); + WriteBuf(b, c->ServerKey.Random2, sizeof(c->ServerKey.Random2)); + WriteBufInt64(b, se->ClientSessionId); + WriteBufInt64(b, se->ServerSessionId); + Enc_tls1_PRF(b->Buf, b->Size, c->MasterSecret, sizeof(c->MasterSecret), + c->ExpansionKey, sizeof(c->ExpansionKey)); + FreeBuf(b); + + // Set up the encryption algorithm + c->CipherEncrypt = OvsGetCipher(cipher_name); + c->CipherDecrypt = OvsGetCipher(cipher_name); + SetCipherKey(c->CipherDecrypt, c->ExpansionKey + 0, false); + SetCipherKey(c->CipherEncrypt, c->ExpansionKey + 128, true); + + if (c->CipherDecrypt->IsAeadCipher) + { + // In AEAD mode the IV is composed by the packet ID and a part of the HMAC key + Copy(c->IvRecv + sizeof(c->LastDataPacketId), c->ExpansionKey + 64, c->CipherDecrypt->IvSize - sizeof(c->LastDataPacketId)); + Copy(c->IvSend + sizeof(c->LastDataPacketId), c->ExpansionKey + 192, c->CipherEncrypt->IvSize - sizeof(c->LastDataPacketId)); + } + else + { + // Set up the hash algorithm + c->MdSend = OvsGetMd(md_name); + c->MdRecv = OvsGetMd(md_name); + SetMdKey(c->MdRecv, c->ExpansionKey + 64, c->MdRecv->Size); + SetMdKey(c->MdSend, c->ExpansionKey + 192, c->MdSend->Size); + } + + // We pass the cipher name sent from the OpenVPN client, unless it's a different cipher, to prevent a message such as: + // WARNING: 'cipher' is used inconsistently, local='cipher AES-128-GCM', remote='cipher aes-128-gcm' + // It happens because OpenVPN uses "strcmp()" to compare the local and remote parameters: + // https://github.com/OpenVPN/openvpn/blob/a6fd48ba36ede465b0905a95568c3ec0d425ca71/src/openvpn/options.c#L3819-L3831 + if (StrCmpi(cipher_name, c->CipherEncrypt->Name) != 0) + { + cipher_name = c->CipherEncrypt->Name; + } + + // Generate the response option string + Format(c->ServerKey.OptionString, sizeof(c->ServerKey.OptionString), + "V4,dev-type %s,link-mtu %u,tun-mtu %u,proto %s," + "cipher %s,auth %s,keysize %u,key-method 2,tls-server", + (se->Mode == OPENVPN_MODE_L2 ? "tap" : "tun"), + se->LinkMtu, + se->TunMtu, + c->Proto, + cipher_name, md_name, c->CipherEncrypt->KeySize * 8); + + FreeEntryList(o); + + Debug("OvsSetupSessionParameters(): Built OptionString: %s\n", c->ServerKey.OptionString); + OvsLog(s, se, c, "LO_OPTION_STR_SEND", c->ServerKey.OptionString); +} + +// Get the encryption algorithm +CIPHER *OvsGetCipher(char *name) +{ + CIPHER *c = NULL; + + // OpenVPN sends the cipher name in uppercase, even if it's not standard, + // thus we have to convert it to lowercase for EVP_get_cipherbyname(). + char lowercase_name[MAX_SIZE]; + StrCpy(lowercase_name, sizeof(lowercase_name), name); + StrLower(lowercase_name); + + if (IsEmptyStr(lowercase_name) == false) + { + c = NewCipher(lowercase_name); + } + + if (c == NULL) + { + c = NewCipher(OPENVPN_DEFAULT_CIPHER); + } + + return c; +} + +// Get the hash algorithm +MD *OvsGetMd(char *name) +{ + MD *m = NULL; + + if (IsEmptyStr(name) == false) + { + m = NewMd(name); + } + + if (m == NULL) + { + m = NewMd(OPENVPN_DEFAULT_MD); + } + + return m; +} + +// Build the data from KEY_METHOD2 +BUF *OvsBuildKeyMethod2(OPENVPN_KEY_METHOD_2 *d) +{ + BUF *b; + UCHAR uc; + // Validate arguments + if (d == NULL) + { + return NULL; + } + + b = NewBuf(); + + // Reserved + WriteBufInt(b, 0); + + // Method + uc = 2; + WriteBuf(b, &uc, sizeof(UCHAR)); + + // Random1 + WriteBuf(b, d->Random1, sizeof(d->Random1)); + + // Random2 + WriteBuf(b, d->Random2, sizeof(d->Random2)); + + // Option String + OvsWriteStringToBuf(b, d->OptionString, sizeof(d->OptionString)); + + // Username + OvsWriteStringToBuf(b, d->Username, sizeof(d->Username)); + + // Password + OvsWriteStringToBuf(b, d->Password, sizeof(d->Password)); + + // PeerInfo + OvsWriteStringToBuf(b, d->PeerInfo, sizeof(d->PeerInfo)); + + return b; +} + +// Append a string to buf +void OvsWriteStringToBuf(BUF *b, char *str, UINT max_size) +{ + USHORT us; + UINT i; + char *tmp; + // Validate arguments + if (b == NULL) + { + return; + } + if (str == NULL) + { + str = ""; + } + + if (StrLen(str) == 0) + { + us = 0; + WriteBuf(b, &us, sizeof(USHORT)); + return; + } + + i = StrSize(str); + i = MIN(i, max_size); + us = Endian16((USHORT)i); + WriteBuf(b, &us, sizeof(USHORT)); + + tmp = Malloc(i); + Copy(tmp, str, i); + tmp[i - 1] = 0; + WriteBuf(b, tmp, i); + + Free(tmp); +} + +// Parse the KEY_METHOD2 +UINT OvsParseKeyMethod2(OPENVPN_KEY_METHOD_2 *ret, UCHAR *data, UINT size, bool client_mode) +{ + BUF *b; + UINT read_size = 0; + UINT ui; + UCHAR uc; + // Validate arguments + Zero(ret, sizeof(OPENVPN_KEY_METHOD_2)); + if (ret == NULL || data == NULL || size == 0) + { + return 0; + } + + b = NewBuf(); + WriteBuf(b, data, size); + SeekBuf(b, 0, 0); + + // Reserved + if (ReadBuf(b, &ui, sizeof(UINT)) == sizeof(UINT)) + { + // Method + if (ReadBuf(b, &uc, sizeof(UCHAR)) == sizeof(UCHAR) && uc == 2) + { + // Pre Master Secret + if (client_mode == false || ReadBuf(b, ret->PreMasterSecret, sizeof(ret->PreMasterSecret)) == sizeof(ret->PreMasterSecret)) + { + // Random1 + if (ReadBuf(b, ret->Random1, sizeof(ret->Random1)) == sizeof(ret->Random1)) + { + // Random2 + if (ReadBuf(b, ret->Random2, sizeof(ret->Random2)) == sizeof(ret->Random2)) + { + // String + if (OvsReadStringFromBuf(b, ret->OptionString, sizeof(ret->OptionString)) && + OvsReadStringFromBuf(b, ret->Username, sizeof(ret->Username)) && + OvsReadStringFromBuf(b, ret->Password, sizeof(ret->Password))) + { + if (!OvsReadStringFromBuf(b, ret->PeerInfo, sizeof(ret->PeerInfo))) + { + Zero(ret->PeerInfo, sizeof(ret->PeerInfo)); + } + read_size = b->Current; + } + } + } + } + } + } + + FreeBuf(b); + + return read_size; +} + +// Read a string from BUF +bool OvsReadStringFromBuf(BUF *b, char *str, UINT str_size) +{ + USHORT us; + // Validate arguments + if (b == NULL || str == NULL) + { + return false; + } + + if (ReadBuf(b, &us, sizeof(USHORT)) != sizeof(USHORT)) + { + return false; + } + + us = Endian16(us); + + if (us == 0) + { + StrCpy(str, str_size, ""); + return true; + } + + if (us > str_size) + { + return false; + } + + if (ReadBuf(b, str, us) != us) + { + return false; + } + + if (str[us - 1] != 0) + { + return false; + } + + return true; +} + +// Transmission of control packet (Automatic segmentation with the maximum size) +void OvsSendControlPacketWithAutoSplit(OPENVPN_CHANNEL *c, UCHAR opcode, UCHAR *data, UINT data_size) +{ + BUF *b; + // Validate arguments + if (c == NULL || (data_size != 0 && data == NULL)) + { + return; + } + + b = NewBuf(); + WriteBuf(b, data, data_size); + SeekBuf(b, 0, 0); + + while (true) + { + UCHAR tmp[OPENVPN_CONTROL_PACKET_MAX_DATASIZE]; + UINT size = ReadBuf(b, tmp, sizeof(tmp)); + + if (size == 0) + { + break; + } + + OvsSendControlPacket(c, opcode, tmp, size); + //Debug(" *** CNT SEND %u\n", size); + } + + FreeBuf(b); +} + +// Send the control packet +void OvsSendControlPacket(OPENVPN_CHANNEL *c, UCHAR opcode, UCHAR *data, UINT data_size) +{ + OvsSendControlPacketEx(c, opcode, data, data_size, false); +} +void OvsSendControlPacketEx(OPENVPN_CHANNEL *c, UCHAR opcode, UCHAR *data, UINT data_size, bool no_resend) +{ + OPENVPN_CONTROL_PACKET *p; + // Validate arguments + if (c == NULL || (data_size != 0 && data == NULL)) + { + return; + } + + p = ZeroMalloc(sizeof(OPENVPN_CONTROL_PACKET)); + + p->NoResend = no_resend; + + p->OpCode = opcode; + p->PacketId = c->NextSendPacketId++; + + if (data != NULL) + { + p->Data = Clone(data, data_size); + p->DataSize = data_size; + } + + p->NextSendTime = 0; + + Add(c->SendControlPacketList, p); +} + +// Release the control packet being transmitted +void OvsFreeControlPacket(OPENVPN_CONTROL_PACKET *p) +{ + // Validate arguments + if (p == NULL) + { + return; + } + + if (p->Data != NULL) + { + Free(p->Data); + } + + Free(p); +} + +// Get a list of packet ID to be responded +UINT OvsGetAckReplyList(OPENVPN_CHANNEL *c, UINT *ret) +{ + UINT i; + LIST *o = NULL; + UINT num; + // Validate arguments + if (c == NULL || ret == NULL) + { + return 0; + } + + num = MIN(LIST_NUM(c->AckReplyList), OPENVPN_MAX_NUMACK); + + for (i = 0; i < num; i++) + { + UINT *v = LIST_DATA(c->AckReplyList, i); + + if (o == NULL) + { + o = NewListFast(NULL); + } + + Add(o, v); + + ret[i] = *v; + } + + for (i = 0; i < LIST_NUM(o); i++) + { + UINT *v = LIST_DATA(o, i); + + Delete(c->AckReplyList, v); + + Free(v); + } + + ReleaseList(o); + + return num; +} + +// Release the channel +void OvsFreeChannel(OPENVPN_CHANNEL *c) +{ + UINT i; + // Validate arguments + if (c == NULL) + { + return; + } + + if (c->SslPipe != NULL) + { + FreeSslPipe(c->SslPipe); + } + + ReleaseIntList(c->AckReplyList); + + for (i = 0; i < LIST_NUM(c->SendControlPacketList); i++) + { + OPENVPN_CONTROL_PACKET *p = LIST_DATA(c->SendControlPacketList, i); + + OvsFreeControlPacket(p); + } + + ReleaseList(c->SendControlPacketList); + + FreeCipher(c->CipherDecrypt); + FreeCipher(c->CipherEncrypt); + + FreeMd(c->MdRecv); + FreeMd(c->MdSend); + + if (c->ClientCert.X != NULL) + { + FreeX(c->ClientCert.X); + } + + Free(c); +} + +// Create a new channel +OPENVPN_CHANNEL *OvsNewChannel(OPENVPN_SESSION *se, UCHAR key_id) +{ + OPENVPN_CHANNEL *c; + // Validate arguments + if (se == NULL) + { + return NULL; + } + + c = ZeroMalloc(sizeof(OPENVPN_CHANNEL)); + + c->Session = se; + c->Server = se->Server; + + c->Status = OPENVPN_CHANNEL_STATUS_INIT; + + c->AckReplyList = NewIntList(true); + + c->SendControlPacketList = NewListFast(NULL); + + c->KeyId = key_id; + + Rand(c->IvSend, sizeof(c->IvSend)); + Rand(c->IvRecv, sizeof(c->IvRecv)); + + //c->NextRekey = se->Server->Now + (UINT64)5000; + + se->LastCreatedChannelIndex = key_id; + + return c; +} + +// Create a new server-side channel ID +UINT64 OvsNewServerSessionId(OPENVPN_SERVER *s) +{ + // Validate arguments + if (s == NULL) + { + return 0; + } + + while (true) + { + UINT64 id = Rand64(); + UINT i; + bool exists = false; + + if (id == 0 || id == (UINT64)(0xFFFFFFFFFFFFFFFFULL)) + { + continue; + } + + for (i = 0; i < LIST_NUM(s->SessionList); i++) + { + OPENVPN_SESSION *se = LIST_DATA(s->SessionList, i); + if (se->ServerSessionId == id) + { + exists = true; + } + } + + if (exists == false) + { + return id; + } + } +} + +// Build and submit the OpenVPN data packet +void OvsSendDataPacket(OPENVPN_CHANNEL *c, UCHAR key_id, UINT data_packet_id, void *data, UINT data_size) +{ + const UCHAR op = ((OPENVPN_P_DATA_V1 << 3) & 0xF8) | (key_id & 0x07); + UCHAR *dest_data; + UINT dest_size; + // Validate arguments + if (c == NULL || data == NULL || data_size == 0) + { + return; + } + + // [ xxx ] = unprotected + // [ - xxx - ] = authenticated + // [ * xxx * ] = encrypted and authenticated + + if (c->CipherEncrypt->IsAeadCipher) + { + // [ opcode ] [ - packet ID - ] [ TAG ] [ * packet payload * ] + UCHAR tag[16]; + + // Update variable part (packet ID) of IV + WRITE_UINT(c->IvSend, data_packet_id); + + // Prepare a buffer to store the results + dest_data = Malloc(sizeof(op) + sizeof(data_packet_id) + sizeof(tag) + data_size + 256); + + // Set data size to the maximum known + dest_size = sizeof(op) + sizeof(data_packet_id) + sizeof(tag); + + // Write opcode + dest_data[0] = op; + + // Write packet ID + WRITE_UINT(dest_data + sizeof(op), data_packet_id); + + // Write encrypted payload + dest_size += OvsEncrypt(c->CipherEncrypt, NULL, c->IvSend, tag, dest_data + dest_size, data, data_size, c->IvSend, sizeof(data_packet_id)); + + // Write authentication tag + Copy(dest_data + sizeof(op) + sizeof(data_packet_id), tag, sizeof(tag)); + } + else + { + // [ opcode ] [ HMAC ] [ - IV - ] [ * packet ID * ] [ * packet payload * ] + UINT encrypted_size = sizeof(data_packet_id) + data_size; + UCHAR *encrypted_data = ZeroMalloc(encrypted_size); + WRITE_UINT(encrypted_data, data_packet_id); + Copy(encrypted_data + sizeof(data_packet_id), data, data_size); + + // Prepare a buffer to store the results + dest_data = Malloc(sizeof(op) + c->MdSend->Size + c->CipherEncrypt->IvSize + encrypted_size + 256); + + // Set data size to the maximum known + dest_size = sizeof(op); + + // Write opcode + dest_data[0] = op; + + // Write IV, encrypted packet ID and payload + dest_size += OvsEncrypt(c->CipherEncrypt, c->MdSend, c->IvSend, NULL, dest_data + sizeof(op), encrypted_data, encrypted_size, NULL, 0); + + Free(encrypted_data); + + // Update the IV + Copy(c->IvSend, dest_data + dest_size - c->CipherEncrypt->IvSize, c->CipherEncrypt->IvSize); + } + + OvsSendPacketRawNow(c->Server, c->Session, dest_data, dest_size); +} + +// Build an OpenVPN control packet +BUF *OvsBuildPacket(OPENVPN_PACKET *p) +{ + BUF *b; + UCHAR uc; + UINT num_ack; + // Validate arguments + if (p == NULL) + { + return NULL; + } + + b = NewBuf(); + + // OpCode + KeyID + uc = ((p->OpCode << 3) & 0xF8) | (p->KeyId & 0x07); + WriteBufChar(b, uc); + + if (p->OpCode == OPENVPN_P_DATA_V1) + { + // Data Packet + WriteBuf(b, p->Data, p->DataSize); + SeekBuf(b, 0, 0); + return b; + } + + // Sender Channel ID + WriteBufInt64(b, p->MySessionId); + + // NumAck + num_ack = MIN(p->NumAck, OPENVPN_MAX_NUMACK); + WriteBufChar(b, (UCHAR)num_ack); + + if (p->NumAck >= 1) + { + UINT i; + + for (i = 0; i < num_ack; i++) + { + WriteBufInt(b, (UCHAR)p->AckPacketId[i]); + } + + // Received Channel ID + WriteBufInt64(b, p->YourSessionId); + } + + if (p->OpCode != OPENVPN_P_ACK_V1) + { + // Packet ID + WriteBufInt(b, p->PacketId); + + // Payload + if (p->DataSize >= 1 && p->Data != NULL) + { + WriteBuf(b, p->Data, p->DataSize); + } + } + + SeekBuf(b, 0, 0); + + return b; +} + +// Parse the OpenVPN packet +OPENVPN_PACKET *OvsParsePacket(UCHAR *data, UINT size) +{ + UCHAR uc; + OPENVPN_PACKET *ret = NULL; + // Validate arguments + if (data == NULL || size == 0) + { + return NULL; + } + + ret = ZeroMalloc(sizeof(OPENVPN_PACKET)); + + uc = *((UCHAR *)data); + data++; + size--; + + ret->OpCode = ((uc & 0xF8) >> 3) & 0x1F; + ret->KeyId = uc & 0x07; + + if (ret->OpCode == OPENVPN_P_DATA_V1) + { + // Data packet + ret->DataSize = size; + ret->Data = Clone(data, size); + return ret; + } + + // Sender Channel ID + if (size < sizeof(UINT64)) + { + goto LABEL_ERROR; + } + ret->MySessionId = READ_UINT64(data); + data += sizeof(UINT64); + size -= sizeof(UINT64); + + // ACK + if (size < 1) + { + goto LABEL_ERROR; + } + uc = *((UCHAR *)data); + data++; + size--; + + ret->NumAck = uc; + + if (ret->NumAck > 4) + { + goto LABEL_ERROR; + } + + if (ret->NumAck >= 1) + { + UINT i; + + if (size < (sizeof(UINT) * (UINT)ret->NumAck + sizeof(UINT64))) + { + goto LABEL_ERROR; + } + + for (i = 0; i < ret->NumAck; i++) + { + UINT ui; + + ui = READ_UINT(data); + + ret->AckPacketId[i] = ui; + + data += sizeof(UINT); + size -= sizeof(UINT); + } + + ret->YourSessionId = READ_UINT64(data); + data += sizeof(UINT64); + size -= sizeof(UINT64); + } + + if (ret->OpCode != OPENVPN_P_ACK_V1) + { + // Read the Packet ID Because in the case of other than ACK + if (size < sizeof(UINT)) + { + goto LABEL_ERROR; + } + + ret->PacketId = READ_UINT(data); + data += sizeof(UINT); + size -= sizeof(UINT); + + // Payload + ret->DataSize = size; + if (size >= 1) + { + ret->Data = Clone(data, size); + } + } + + return ret; + +LABEL_ERROR: + OvsFreePacket(ret); + return NULL; +} + +// Release the OpenVPN packet +void OvsFreePacket(OPENVPN_PACKET *p) +{ + // Validate arguments + if (p == NULL) + { + return; + } + + if (p->Data != NULL) + { + Free(p->Data); + } + + Free(p); +} + +// If the session does not exist, create a session +OPENVPN_SESSION *OvsFindOrCreateSession(OPENVPN_SERVER *s, IP *server_ip, UINT server_port, IP *client_ip, UINT client_port, UINT protocol) +{ + OPENVPN_SESSION *se; + // Validate arguments + if (s == NULL || server_ip == NULL || server_port == 0 || client_ip == NULL || client_port == 0) + { + return NULL; + } + + se = OvsSearchSession(s, server_ip, server_port, client_ip, client_port, protocol); + if (se == NULL) + { + se = OvsNewSession(s, server_ip, server_port, client_ip, client_port, protocol); + + if (se != NULL) + { + Insert(s->SessionList, se); + } + } + + return se; +} + +// Get the number of sessions currently connected from the IP address of the client +UINT OvsGetNumSessionByClientIp(OPENVPN_SERVER *s, IP *ip) +{ + UINT i; + UINT ret = 0; + // Validate arguments + if (s == NULL || ip == NULL) + { + return 0; + } + + for (i = 0; i < LIST_NUM(s->SessionList); i++) + { + OPENVPN_SESSION *se = LIST_DATA(s->SessionList, i); + + if (CmpIpAddr(&se->ClientIp, ip) == 0) + { + ret++; + } + } + + return ret; +} + +// Create a new session +OPENVPN_SESSION *OvsNewSession(OPENVPN_SERVER *s, IP *server_ip, UINT server_port, IP *client_ip, UINT client_port, UINT protocol) +{ + OPENVPN_SESSION *se; + char server_ip_str[MAX_SIZE]; + char client_ip_str[MAX_SIZE]; + // Validate arguments + if (s == NULL || server_ip == NULL || server_port == 0 || client_ip == NULL || client_port == 0) + { + return NULL; + } + + + if (OvsGetNumSessionByClientIp(s, client_ip) > OPENVPN_QUOTA_MAX_NUM_SESSIONS_PER_IP) + { + // Number of sessions from the same IP address too many + return NULL; + } + + if (LIST_NUM(s->SessionList) > OPENVPN_QUOTA_MAX_NUM_SESSIONS) + { + // Too many OpenVPN sessions + return NULL; + } + + se = ZeroMalloc(sizeof(OPENVPN_SESSION)); + + se->Server = s; + + Copy(&se->ClientIp, client_ip, sizeof(IP)); + se->ClientPort = client_port; + + Copy(&se->ServerIp, server_ip, sizeof(IP)); + se->ServerPort = server_port; + + se->ObfuscationMode = s->Obfuscation ? INFINITE : OPENVPN_SCRAMBLE_MODE_DISABLED; + + se->LastCommTick = s->Now; + + se->Protocol = protocol; + + se->ServerSessionId = OvsNewServerSessionId(se->Server); + + se->CreatedTick = s->Now; + + se->Id = s->NextSessionId; + s->NextSessionId++; + + IPToStr(server_ip_str, sizeof(server_ip_str), server_ip); + IPToStr(client_ip_str, sizeof(client_ip_str), client_ip); + Debug("OpenVPN New Session: %s:%u -> %s:%u Proto=%u\n", server_ip_str, server_port, + client_ip_str, client_port, protocol); + + return se; +} + +// Release the session +void OvsFreeSession(OPENVPN_SESSION *se) +{ + UINT i; + // Validate arguments + if (se == NULL) + { + return; + } + + // If there is IP addresses which is got from a DHCP server in the session, release it + if (se->Ipc != NULL) + { + if (se->Mode == OPENVPN_MODE_L3) + { + if (se->IpcAsync != NULL) + { + IP dhcp_ip; + + UINTToIP(&dhcp_ip, se->IpcAsync->L3ClientAddressOption.ServerAddress); + + IPCDhcpFreeIP(se->Ipc, &dhcp_ip); + IPC_PROTO_SET_STATUS(se->Ipc, IPv6State, IPC_PROTO_STATUS_CLOSED); + IPCProcessL3EventsIPv4Only(se->Ipc); + } + } + } + + // Release the channel + for (i = 0; i < OPENVPN_NUM_CHANNELS; i++) + { + OPENVPN_CHANNEL *c = se->Channels[i]; + + if (c != NULL) + { + OvsFreeChannel(c); + } + } + + // Release the IPC + if (se->Ipc != NULL) + { + FreeIPC(se->Ipc); + } + + if (se->IpcAsync != NULL) + { + FreeIPCAsync(se->IpcAsync); + } + + Free(se); +} + +// Search the session from the endpoint information +OPENVPN_SESSION *OvsSearchSession(OPENVPN_SERVER *s, IP *server_ip, UINT server_port, IP *client_ip, UINT client_port, UINT protocol) +{ + OPENVPN_SESSION *se; + OPENVPN_SESSION t; + // Validate arguments + if (s == NULL || server_ip == NULL || server_port == 0 || client_ip == NULL || client_port == 0) + { + return NULL; + } + + Copy(&t.ClientIp, client_ip, sizeof(IP)); + t.ClientPort = client_port; + Copy(&t.ServerIp, server_ip, sizeof(IP)); + t.ServerPort = server_port; + t.Protocol = protocol; + + se = Search(s->SessionList, &t); + + return se; +} + +// Receive packets in the OpenVPN server +void OvsRecvPacket(OPENVPN_SERVER *s, LIST *recv_packet_list, UINT protocol) +{ + UINT i, j; + LIST *delete_session_list = NULL; + // Validate arguments + if (s == NULL || recv_packet_list == NULL) + { + return; + } + + s->Now = Tick64(); + + // Process for all sessions + for (i = 0; i < LIST_NUM(s->SessionList); i++) + { + OPENVPN_SESSION *se = LIST_DATA(s->SessionList, i); + + if (se->Ipc != NULL) + { + if (se->Mode == OPENVPN_MODE_L3) + { + // Flush the ARP table of the IPC + IPCFlushArpTableEx(se->Ipc, s->Now); + } + } + } + + // Process received packets + for (i = 0; i < LIST_NUM(recv_packet_list); i++) + { + UDPPACKET *p = LIST_DATA(recv_packet_list, i); + + OvsProceccRecvPacket(s, p, protocol); + } + + // Treat for all sessions and all channels + for (i = 0; i < LIST_NUM(s->SessionList); i++) + { + OPENVPN_CHANNEL *latest_channel = NULL; + UINT64 max_tick = 0; + OPENVPN_SESSION *se = LIST_DATA(s->SessionList, i); + bool is_disconnected = false; + + if (se->Ipc != NULL) + { + if (se->Mode == OPENVPN_MODE_L3) + { + IPCProcessL3EventsIPv4Only(se->Ipc); + } + } + + for (j = 0; j < OPENVPN_NUM_CHANNELS; j++) + { + OPENVPN_CHANNEL *c = se->Channels[j]; + + if (c != NULL) + { + if (c->RekeyInitiated == false && ((c->NextRekey <= s->Now && c->NextRekey != 0) || (c->LastDataPacketId >= OPENVPN_MAX_PACKET_ID_FOR_TRIGGER_REKEY))) + { + OPENVPN_CHANNEL *c2; + // Send a soft reset by creating a new channel + UINT next_channel_id = se->LastCreatedChannelIndex + 1; + if (next_channel_id >= OPENVPN_NUM_CHANNELS) + { + next_channel_id = 1; + } + if (se->Channels[next_channel_id] != NULL) + { + // Release when there is a channel data already + OvsFreeChannel(se->Channels[next_channel_id]); + se->Channels[next_channel_id] = NULL; + } + + // Create a new channel + c2 = OvsNewChannel(se, (UCHAR)next_channel_id); + c2->IsInitiatorServer = true; + se->Channels[next_channel_id] = c2; + Debug("OpenVPN New Channel for Re-Keying :%u\n", next_channel_id); + OvsLog(s, se, c, "LO_INITIATE_REKEY"); + + // Send a soft reset + OvsSendControlPacket(c2, OPENVPN_P_CONTROL_SOFT_RESET_V1, NULL, 0); + + c->RekeyInitiated = true; + } + } + + if (c != NULL) + { + switch (c->Status) + { + case OPENVPN_CHANNEL_STATUS_TLS_VPN_CONNECTING: + // Check whether the connection process completed if there is a channel running a VPN connection process + if (se->IpcAsync != NULL) + { + if (se->IpcAsync->Done) + { + if (se->IpcAsync->Ipc != NULL) + { + char option_str[4096]; + char l3_options[MAX_SIZE]; + + // Successful in VPN connection + Debug("OpenVPN Channel %u Established (new key).\n", j); + OvsLog(s, se, c, "LO_CHANNEL_ESTABLISHED"); + + // Return the PUSH_REPLY + Format(option_str, sizeof(option_str), + "PUSH_REPLY,ping %u,ping-restart %u", + (OPENVPN_PING_SEND_INTERVAL / 1000), + (OPENVPN_RECV_TIMEOUT / 1000)); + + if (se->Mode == OPENVPN_MODE_L3) + { + // Add such as the IP address that was acquired from the DHCP server + // if the L3 mode to the option character string + DHCP_OPTION_LIST *cao = &se->IpcAsync->L3ClientAddressOption; + char ip_client[64]; + char ip_subnet_mask[64]; + char ip_dns1[64]; + char ip_dns2[64]; + char ip_wins1[64]; + char ip_wins2[64]; + char ip_defgw[64]; + + ClearStr(ip_dns1, sizeof(ip_dns1)); + ClearStr(ip_dns2, sizeof(ip_dns2)); + ClearStr(ip_wins1, sizeof(ip_wins1)); + ClearStr(ip_wins2, sizeof(ip_wins2)); + ClearStr(ip_defgw, sizeof(ip_defgw)); + + IPToStr32(ip_client, sizeof(ip_client), + cao->ClientAddress); + + IPToStr32(ip_subnet_mask, sizeof(ip_subnet_mask), + cao->SubnetMask); + + Format(l3_options, sizeof(l3_options), + ",topology subnet"); + StrCat(option_str, sizeof(option_str), l3_options); + + Format(l3_options, sizeof(l3_options), + ",ifconfig %s %s", + ip_client, + ip_subnet_mask); + StrCat(option_str, sizeof(option_str), l3_options); + + // Domain name + if (IsEmptyStr(cao->DomainName) == false) + { + Format(l3_options, sizeof(l3_options), + ",dhcp-option DOMAIN %s", cao->DomainName); + StrCat(option_str, sizeof(option_str), l3_options); + } + + // DNS server address 1 + if (cao->DnsServer != 0) + { + char ip_str[64]; + IPToStr32(ip_str, sizeof(ip_str), cao->DnsServer); + Format(l3_options, sizeof(l3_options), + ",dhcp-option DNS %s", ip_str); + StrCat(option_str, sizeof(option_str), l3_options); + + StrCpy(ip_dns1, sizeof(ip_dns1), ip_str); + } + + // DNS server address 2 + if (cao->DnsServer2 != 0) + { + char ip_str[64]; + IPToStr32(ip_str, sizeof(ip_str), cao->DnsServer2); + Format(l3_options, sizeof(l3_options), + ",dhcp-option DNS %s", ip_str); + StrCat(option_str, sizeof(option_str), l3_options); + + StrCpy(ip_dns2, sizeof(ip_dns2), ip_str); + } + + // WINS address 1 + if (cao->WinsServer != 0) + { + char ip_str[64]; + IPToStr32(ip_str, sizeof(ip_str), cao->WinsServer); + Format(l3_options, sizeof(l3_options), + ",dhcp-option WINS %s", ip_str); + StrCat(option_str, sizeof(option_str), l3_options); + + StrCpy(ip_wins1, sizeof(ip_wins1), ip_str); + } + + // WINS address 2 + if (cao->WinsServer2 != 0) + { + char ip_str[64]; + IPToStr32(ip_str, sizeof(ip_str), cao->WinsServer2); + Format(l3_options, sizeof(l3_options), + ",dhcp-option WINS %s", ip_str); + StrCat(option_str, sizeof(option_str), l3_options); + + StrCpy(ip_wins2, sizeof(ip_wins2), ip_str); + } + + // Default gateway + if (cao->Gateway != 0) + { + char ip_str[64]; + IPToStr32(ip_str, sizeof(ip_str), cao->Gateway); + Format(l3_options, sizeof(l3_options), + ",route-gateway %s,redirect-gateway def1", ip_str); + StrCat(option_str, sizeof(option_str), l3_options); + + StrCpy(ip_defgw, sizeof(ip_defgw), ip_str); + } + else + { +#if 0 // Currently disabled + // If the default gateway is not specified, add the static routing table + // entry for the local IP subnet + IP local_network; + IP client_ip; + IP subnet_mask; + + UINTToIP(&client_ip, cao->ClientAddress); + UINTToIP(&subnet_mask, cao->SubnetMask); + + Zero(&local_network, sizeof(IP)); + IPAnd4(&local_network, &client_ip, &subnet_mask); + + Format(l3_options, sizeof(l3_options), + ",route %r %r vpn_gateway", + &local_network, + &cao->SubnetMask); + + StrCat(option_str, sizeof(option_str), l3_options); +#endif + } + + // Classless routing table + if (cao->ClasslessRoute.NumExistingRoutes >= 1) + { + UINT i; + for (i = 0; i < MAX_DHCP_CLASSLESS_ROUTE_ENTRIES; i++) + { + DHCP_CLASSLESS_ROUTE *r = &cao->ClasslessRoute.Entries[i]; + + if (r->Exists) + { + Format(l3_options, sizeof(l3_options), + ",route %r %r vpn_gateway", + &r->Network, &r->SubnetMask); + + StrCat(option_str, sizeof(option_str), l3_options); + } + } + } + + OvsLog(s, se, c, "LP_SET_IPV4_PARAM", + ip_client, ip_subnet_mask, ip_defgw, ip_dns1, ip_dns2, ip_wins1, ip_wins2); + } + else + { + // OpenVPN L2 mode. To fix the bug of OpenVPN 2.4.6 and particular version of kernel mode TAP driver + // on Linux, the TAP device must be up after the OpenVPN client is connected. + // However there is no direct push instruction to do so to OpenVPN client. + // Therefore we push the dummy IPv4 address (RFC7600) to the OpenVPN client. + if (s->PushDummyIPv4AddressOnL2Mode) + { + StrCat(option_str, sizeof(option_str), ",ifconfig 192.0.0.8 255.255.255.240"); + } + } + + // From https://community.openvpn.net/openvpn/wiki/Openvpn23ManPage: + // + // --block-outside-dns + // Block DNS servers on other network adapters to prevent DNS leaks. + // This option prevents any application from accessing TCP or UDP port 53 except one inside the tunnel. + // It uses Windows Filtering Platform (WFP) and works on Windows Vista or later. + // This option is considered unknown on non-Windows platforms and unsupported on Windows XP, resulting in fatal error. + // You may want to use --setenv opt or --ignore-unknown-option (not suitable for Windows XP) to ignore said error. + // Note that pushing unknown options from server does not trigger fatal errors. + StrCat(option_str, sizeof(option_str), ",block-outside-dns"); + + WriteFifo(c->SslPipe->SslInOut->SendFifo, option_str, StrSize(option_str)); + + Debug("Push Str: %s\n", option_str); + OvsLog(s, se, c, "LO_PUSH_REPLY", option_str); + + StrCpy(se->PushReplyStr, sizeof(se->PushReplyStr), option_str); + + se->Ipc = se->IpcAsync->Ipc; + se->IpcAsync->Ipc = NULL; + + s->SessionEstablishedCount++; + + // Set a Sock Event of IPC to Sock Event of the UDP Listener + IPCSetSockEventWhenRecvL2Packet(se->Ipc, s->SockEvent); + + // State transition + c->Status = OPENVPN_CHANNEL_STATUS_ESTABLISHED; + c->EstablishedTick = s->Now; + se->Established = true; + se->LastCommTick = Tick64(); + } + else + { + char *str; + + if (se->IpcAsync->DhcpAllocFailed) + { + OvsLog(s, se, c, "LP_DHCP_REQUEST_NG"); + } + + // Failed to connect VPN + Debug("OpenVPN Channel %u Failed.\n", j); + OvsLog(s, se, c, "LO_CHANNEL_FAILED"); + + // Return the AUTH_FAILED + str = "AUTH_FAILED"; + WriteFifo(c->SslPipe->SslInOut->SendFifo, str, StrSize(str)); + + s->SessionEstablishedCount++; + + // State transition + c->Status = OPENVPN_CHANNEL_STATUS_DISCONNECTED; + + FreeIPCAsync(se->IpcAsync); + se->IpcAsync = NULL; + } + } + } + break; + + case OPENVPN_CHANNEL_STATUS_ESTABLISHED: + // Monitor the IPC whether not disconnected when there is a VPN connection completed channel + if (IsIPCConnected(se->Ipc) == false) + { + // Send the RESTART since IPC is disconnected + char *str = "RESTART"; + Debug("OpenVPN Channel %u Disconnected by HUB.\n", j); + + OvsLog(s, se, c, "LO_CHANNEL_DISCONNECTED_BY_HUB"); + + WriteFifo(c->SslPipe->SslInOut->SendFifo, str, StrSize(str)); + + // State transition + c->Status = OPENVPN_CHANNEL_STATUS_DISCONNECTED; + + // Set the session to disconnected state + se->Established = false; + se->LastCommTick = s->Now; + } + break; + } + } + + if (c != NULL) + { + // If there is a packet to be transmitted physically in SSL, send it + if (c->SslPipe != NULL && SyncSslPipe(c->SslPipe)) + { + if (FifoSize(c->SslPipe->RawOut->RecvFifo) >= 1) + { + Debug("RawOut Fifo Size (c=%u): %u\n", c->KeyId, FifoSize(c->SslPipe->RawOut->RecvFifo)); + + OvsSendControlPacketWithAutoSplit(c, OPENVPN_P_CONTROL_V1, + FifoPtr(c->SslPipe->RawOut->RecvFifo), + FifoSize(c->SslPipe->RawOut->RecvFifo)); + + ReadFifo(c->SslPipe->RawOut->RecvFifo, NULL, FifoSize(c->SslPipe->RawOut->RecvFifo)); + } + } + } + + if (c != NULL) + { + UINT num; + UINT acks[OPENVPN_MAX_NUMACK]; + UINT k; + + // Packet transmission + for (k = 0; k < LIST_NUM(c->SendControlPacketList); k++) + { + OPENVPN_CONTROL_PACKET *cp = LIST_DATA(c->SendControlPacketList, k); + + if (cp->NextSendTime <= s->Now) + { + if (cp->NoResend == false || cp->NumSent == 0) // To address the UDP reflection amplification attack: https://github.com/SoftEtherVPN/SoftEtherVPN/issues/1001 + { + OPENVPN_PACKET *p; + + cp->NumSent++; + + num = OvsGetAckReplyList(c, acks); + + p = OvsNewControlPacket(cp->OpCode, j, se->ServerSessionId, num, acks, + se->ClientSessionId, cp->PacketId, cp->DataSize, cp->Data); + + OvsSendPacketNow(s, se, p); + + OvsFreePacket(p); + + cp->NextSendTime = s->Now + (UINT64)OPENVPN_CONTROL_PACKET_RESEND_INTERVAL; + + AddInterrupt(s->Interrupt, cp->NextSendTime); + } + } + } + + // If the response with an ACK-only packet is required, respond such that + num = OvsGetAckReplyList(c, acks); + + if (num >= 1) + { + OPENVPN_PACKET *p = OvsNewControlPacket(OPENVPN_P_ACK_V1, j, se->ServerSessionId, + num, acks, se->ClientSessionId, 0, 0, NULL); + + OvsSendPacketNow(s, se, p); + + OvsFreePacket(p); + } + } + } + + if (se->Ipc != NULL) + { + if (se->Mode == OPENVPN_MODE_L3) + { + if (se->IpcAsync != NULL) + { + // Update DHCP address + if (se->IpcAsync->L3NextDhcpRenewTick <= s->Now) + { + IP ip; + + se->IpcAsync->L3NextDhcpRenewTick = s->Now + se->IpcAsync->L3DhcpRenewInterval; + + UINTToIP(&ip, se->IpcAsync->L3ClientAddressOption.ServerAddress); + + IPCDhcpRenewIP(se->Ipc, &ip); + } + } + + IPCProcessL3EventsIPv4Only(se->Ipc); + } + + IPCProcessInterrupts(se->Ipc); + } + + // Choose the latest channel in all established channels + for (j = 0; j < OPENVPN_NUM_CHANNELS; j++) + { + OPENVPN_CHANNEL *c = se->Channels[j]; + + if (c != NULL) + { + if (c->Status == OPENVPN_CHANNEL_STATUS_ESTABLISHED) + { + if (max_tick <= c->EstablishedTick) + { + max_tick = c->EstablishedTick; + latest_channel = c; + } + } + } + } + + if (se->Established == false) + { + latest_channel = NULL; + } + + // Send the data using the latest channel (when there is no transmission channel, suck out the queue simply) + if (se->Mode == OPENVPN_MODE_L2) + { + // Get an Ethernet frame from IPC + while (true) + { + BLOCK *b = IPCRecvL2(se->Ipc); + if (b == NULL) + { + break; + } + + if (latest_channel != NULL && s->SupressSendPacket == false) + { + OvsSendDataPacket(latest_channel, latest_channel->KeyId, ++latest_channel->LastDataPacketId, b->Buf, b->Size); + } + + FreeBlock(b); + } + } + else + { + // Get an IPv4 packet from IPC + while (true) + { + BLOCK *b = IPCRecvIPv4(se->Ipc); + if (b == NULL) + { + break; + } + + if (latest_channel != NULL && s->SupressSendPacket == false) + { + OvsSendDataPacket(latest_channel, latest_channel->KeyId, ++latest_channel->LastDataPacketId, b->Buf, b->Size); + } + + FreeBlock(b); + } + } + + // Send a Ping + if (latest_channel != NULL) + { + if ((se->NextPingSendTick == 0) || (se->NextPingSendTick <= s->Now)) + { + se->NextPingSendTick = s->Now + (UINT64)(OPENVPN_PING_SEND_INTERVAL); + + OvsSendDataPacket(latest_channel, latest_channel->KeyId, ++latest_channel->LastDataPacketId, + ping_signature, sizeof(ping_signature)); + //Debug("."); + + AddInterrupt(s->Interrupt, se->NextPingSendTick); + } + } + + if ((se->Established == false) && (s->Now >= (se->CreatedTick + (UINT64)OPENVPN_NEW_SESSION_DEADLINE_TIMEOUT))) + { + is_disconnected = true; + } + + if (se->Established && (s->Now >= (se->LastCommTick + (UINT64)OPENVPN_RECV_TIMEOUT))) + { + is_disconnected = true; + } + + if (is_disconnected) + { + if (delete_session_list == NULL) + { + delete_session_list = NewListFast(NULL); + } + + Add(delete_session_list, se); + } + } + + if (delete_session_list != NULL) + { + UINT i; + + for (i = 0; i < LIST_NUM(delete_session_list); i++) + { + OPENVPN_SESSION *se = LIST_DATA(delete_session_list, i); + + Debug("Deleting Session %p\n", se); + + OvsFreeSession(se); + + s->DisconnectCount++; + + Delete(s->SessionList, se); + } + + ReleaseList(delete_session_list); + } +} + +// Send the packet now +void OvsSendPacketNow(OPENVPN_SERVER *s, OPENVPN_SESSION *se, OPENVPN_PACKET *p) +{ + BUF *b; + UINT i; + // Validate arguments + if (s == NULL || se == NULL || p == NULL) + { + return; + } + + Debug("Sending Opcode=%u ", p->OpCode); + if (p->NumAck >= 1) + { + Debug("Sending ACK Packet IDs (c=%u): ", p->KeyId); + for (i = 0; i < p->NumAck; i++) + { + Debug("%u ", p->AckPacketId[i]); + } + } + Debug("\n"); + + b = OvsBuildPacket(p); + + OvsSendPacketRawNow(s, se, b->Buf, b->Size); + + Free(b); +} +void OvsSendPacketRawNow(OPENVPN_SERVER *s, OPENVPN_SESSION *se, void *data, UINT size) +{ + UDPPACKET *u; + + // Validate arguments + if (s == NULL || se == NULL || data == NULL || size == 0) + { + Free(data); + return; + } + + // Scramble the packet + switch (se->ObfuscationMode) + { + case OPENVPN_SCRAMBLE_MODE_DISABLED: + break; + case OPENVPN_SCRAMBLE_MODE_XORMASK: + OvsDataXorMask(data, size, s->ObfuscationMask, StrLen(s->ObfuscationMask)); + break; + case OPENVPN_SCRAMBLE_MODE_XORPTRPOS: + OvsDataXorPtrPos(data, size); + break; + case OPENVPN_SCRAMBLE_MODE_REVERSE: + OvsDataReverse(data, size); + break; + case OPENVPN_SCRAMBLE_MODE_OBFUSCATE: + OvsDataXorPtrPos(data, size); + OvsDataReverse(data, size); + OvsDataXorPtrPos(data, size); + OvsDataXorMask(data, size, s->ObfuscationMask, StrLen(s->ObfuscationMask)); + } + + u = NewUdpPacket(&se->ServerIp, se->ServerPort, &se->ClientIp, se->ClientPort, + data, size); + + Add(s->SendPacketList, u); +} +// Create a new OpenVPN control packet +OPENVPN_PACKET *OvsNewControlPacket(UCHAR opcode, UCHAR key_id, UINT64 my_channel_id, UINT num_ack, + UINT *ack_packet_ids, UINT64 your_channel_id, UINT packet_id, + UINT data_size, UCHAR *data) +{ + OPENVPN_PACKET *p = ZeroMalloc(sizeof(OPENVPN_PACKET)); + UINT i; + + p->OpCode = opcode; + p->KeyId = key_id; + p->MySessionId = my_channel_id; + p->NumAck = num_ack; + + for (i = 0; i < MIN(num_ack, OPENVPN_MAX_NUMACK); i++) + { + p->AckPacketId[i] = ack_packet_ids[i]; + } + + p->YourSessionId = your_channel_id; + p->PacketId = packet_id; + + if (data_size != 0 && data != NULL) + { + p->Data = Clone(data, data_size); + p->DataSize = data_size; + } + + return p; +} + +// Comparison function of the entries in the session list +int OvsCompareSessionList(void *p1, void *p2) +{ + OPENVPN_SESSION *s1, *s2; + int i; + // Validate arguments + if (p1 == NULL || p2 == NULL) + { + return 0; + } + s1 = *(OPENVPN_SESSION **)p1; + s2 = *(OPENVPN_SESSION **)p2; + if (s1 == NULL || s2 == NULL) + { + return 0; + } + + i = CmpIpAddr(&s1->Protocol, &s2->Protocol); + if (i != 0) + { + return i; + } + + i = CmpIpAddr(&s1->ClientIp, &s2->ClientIp); + if (i != 0) + { + return i; + } + + i = COMPARE_RET(s1->ClientPort, s2->ClientPort); + if (i != 0) + { + return i; + } + + i = CmpIpAddr(&s1->ServerIp, &s2->ServerIp); + if (i != 0) + { + return i; + } + + i = COMPARE_RET(s1->ServerPort, s2->ServerPort); + if (i != 0) + { + return i; + } + + return 0; +} + +// Create a new OpenVPN server +OPENVPN_SERVER *NewOpenVpnServer(const LIST *options, CEDAR *cedar, INTERRUPT_MANAGER *interrupt, SOCK_EVENT *sock_event) +{ + UINT i; + OPENVPN_SERVER *s; + + if (options == NULL || cedar == NULL || interrupt == NULL || sock_event == NULL) + { + return NULL; + } + + s = ZeroMalloc(sizeof(OPENVPN_SERVER)); + + for (i = 0; i < LIST_NUM(options); ++i) + { + const PROTO_OPTION *option = LIST_DATA(options, i); + if (StrCmp(option->Name, "DefaultClientOption") == 0) + { + s->DefaultClientOption = CopyStr(option->String); + } + else if (StrCmp(option->Name, "Obfuscation") == 0) + { + s->Obfuscation = option->Bool; + } + else if (StrCmp(option->Name, "ObfuscationMask") == 0) + { + s->ObfuscationMask = CopyStr(option->String); + } + else if (StrCmp(option->Name, "PushDummyIPv4AddressOnL2Mode") == 0) + { + s->PushDummyIPv4AddressOnL2Mode = option->Bool; + } + } + + s->Cedar = cedar; + s->Interrupt = interrupt; + s->SockEvent = sock_event; + + s->SessionList = NewList(OvsCompareSessionList); + s->RecvPacketList = NewListFast(NULL); + s->SendPacketList = NewListFast(NULL); + + s->Now = Tick64(); + s->Giveup = s->Now + OPENVPN_NEW_SESSION_DEADLINE_TIMEOUT; + + s->NextSessionId = 1; + + s->Dh = DhNewFromBits(cedar->DhParamBits); + + return s; +} + +// Release the OpenVPN server +void FreeOpenVpnServer(OPENVPN_SERVER *s) +{ + UINT i; + // Validate arguments + if (s == NULL) + { + return; + } + + // Release the sessions list + for (i = 0; i < LIST_NUM(s->SessionList); ++i) + { + OPENVPN_SESSION *se = LIST_DATA(s->SessionList, i); + OvsFreeSession(se); + } + + ReleaseList(s->SessionList); + + // Release the incoming packets list + for (i = 0; i < LIST_NUM(s->RecvPacketList); ++i) + { + UDPPACKET *p = LIST_DATA(s->RecvPacketList, i); + FreeUdpPacket(p); + } + + ReleaseList(s->RecvPacketList); + + // Release the outgoing packets list + for (i = 0; i < LIST_NUM(s->SendPacketList); ++i) + { + UDPPACKET *p = LIST_DATA(s->SendPacketList, i); + FreeUdpPacket(p); + } + + ReleaseList(s->SendPacketList); + + DhFree(s->Dh); + + Free(s->DefaultClientOption); + Free(s->ObfuscationMask); + + Free(s); +} diff --git a/src/Cedar/Proto_OpenVPN.h b/src/Cedar/Proto_OpenVPN.h index 8a5c111d..50658076 100644 --- a/src/Cedar/Proto_OpenVPN.h +++ b/src/Cedar/Proto_OpenVPN.h @@ -1,271 +1,271 @@ -// SoftEther VPN Source Code - Developer Edition Master Branch -// Cedar Communication Module - - -// Proto_OpenVPN.h -// Header of Proto_OpenVPN.c - -#ifndef PROTO_OPENVPN_H -#define PROTO_OPENVPN_H - - -//// Constants -#define OPENVPN_UDP_PORT 1194 // OpenVPN default UDP port number -#define OPENVPN_UDP_PORT_INCLUDE 1195 // OpenVPN default UDP port number (Operating within the client) - -#define OPENVPN_MAX_NUMACK 4 // The maximum number of ACKs -#define OPENVPN_NUM_CHANNELS 8 // Maximum number of channels during a session -#define OPENVPN_CONTROL_PACKET_RESEND_INTERVAL 500 // Control packet retransmission interval -#define OPENVPN_CONTROL_PACKET_MAX_DATASIZE 1200 // Maximum data size that can be stored in one control packet - -#define OPENVPN_MAX_SSL_RECV_BUF_SIZE (256 * 1024) // SSL receive buffer maximum length - -#define OPENVPN_MAX_KEY_SIZE 64 // Maximum key size -#define OPENVPN_TAG_SIZE 16 // Tag size (for packet authentication in AEAD mode) - -#define OPENVPN_TMP_BUFFER_SIZE (65536 + 256) // Temporary buffer size - -#define OPENVPN_PING_SEND_INTERVAL 3000 // Transmission interval of Ping -#define OPENVPN_RECV_TIMEOUT 10000 // Communication time-out -#define OPENVPN_NEW_SESSION_DEADLINE_TIMEOUT 30000 // Grace time to complete new VPN session connection since it was created - -#define OPENVPN_MAX_PACKET_ID_FOR_TRIGGER_REKEY 0xFF000000 // Packet ID that is a trigger to start the re-key -#define OPENVPN_TCP_MAX_PACKET_SIZE 2000 // The maximum packet size allowed in TCP mode - - -// The default algorithm -#define OPENVPN_DEFAULT_CIPHER "AES-128-CBC" -#define OPENVPN_DEFAULT_MD "SHA1" - -// Encryption related -#define OPENVPN_PREMASTER_LABEL "OpenVPN master secret" -#define OPENVPN_EXPANSION_LABEL "OpenVPN key expansion" - -// IPC related -#define OPENVPN_IPC_CLIENT_NAME "OpenVPN Client" -#define OPENVPN_IPC_POSTFIX_L2 "OPENVPN_L2" -#define OPENVPN_IPC_POSTFIX_L3 "OPENVPN_L3" - -// MTU -#define OPENVPN_MTU_LINK 1514 // Ethernet MTU -#define OPENVPN_MTU_TUN 1500 // Tun MTU - -// Protocol -#define OPENVPN_PROTOCOL_UDP 0 // UDP -#define OPENVPN_PROTOCOL_TCP 1 // TCP - -// Op-code -#define OPENVPN_P_CONTROL_SOFT_RESET_V1 3 // Soft reset request -#define OPENVPN_P_CONTROL_V1 4 // SSL negotiation packet -#define OPENVPN_P_ACK_V1 5 // Acknowledgment -#define OPENVPN_P_DATA_V1 6 // Data packet -#define OPENVPN_P_CONTROL_HARD_RESET_CLIENT_V2 7 // Connection request from client -#define OPENVPN_P_CONTROL_HARD_RESET_SERVER_V2 8 // Connection response from server - -// State of OpenVPN channel -#define OPENVPN_CHANNEL_STATUS_INIT 0 // Initialization phase -#define OPENVPN_CHANNEL_STATUS_TLS_WAIT_CLIENT_KEY 1 // Waiting for the key information from the client -#define OPENVPN_CHANNEL_STATUS_TLS_WAIT_CLIENT_PUSH_REQUEST 2 // Waiting for PUSH_REQUEST from the client -#define OPENVPN_CHANNEL_STATUS_TLS_VPN_CONNECTING 3 // VPN connecting process is running -#define OPENVPN_CHANNEL_STATUS_ESTABLISHED 4 // VPN connection established -#define OPENVPN_CHANNEL_STATUS_DISCONNECTED 5 // Disconnected - -// Quota -#define OPENVPN_QUOTA_MAX_NUM_SESSIONS_PER_IP 1000 // Number of OpenVPN sessions per IP address -#define OPENVPN_QUOTA_MAX_NUM_SESSIONS 30000 // Limit of the number of sessions - -// Mode -#define OPENVPN_MODE_UNKNOWN 0 // Unknown -#define OPENVPN_MODE_L2 1 // TAP (Ethernet) -#define OPENVPN_MODE_L3 2 // TUN (IP) - -// Scramble mode -#define OPENVPN_SCRAMBLE_MODE_DISABLED 0 // No scramble -#define OPENVPN_SCRAMBLE_MODE_XORMASK 1 // XOR the bytes with the specified string -#define OPENVPN_SCRAMBLE_MODE_XORPTRPOS 2 // XOR each byte with its position in the buffer -#define OPENVPN_SCRAMBLE_MODE_REVERSE 3 // Reverses bytes order, keeping the first byte unchanged -#define OPENVPN_SCRAMBLE_MODE_OBFUSCATE 4 // Performs the above steps using the specified string for xormask - -//// Type - -// Data of OpenVPN Key Method 2 -struct OPENVPN_KEY_METHOD_2 -{ - UCHAR PreMasterSecret[48]; // Pre Master Secret (client only) - UCHAR Random1[32]; // Random 1 - UCHAR Random2[32]; // Random 2 - char OptionString[512]; // Option string - char Username[512]; // User name - char Password[512]; // Password - char PeerInfo[1536]; // PeerInfo -}; - -// OpenVPN sending control packet -struct OPENVPN_CONTROL_PACKET -{ - UCHAR OpCode; // Op-code - UINT PacketId; // Packet ID - UINT DataSize; // Data size - UCHAR *Data; // Data body - UINT64 NextSendTime; // Scheduled next transmission time - bool NoResend; // Disable re-sending - UINT NumSent; // How many times we have sent this packet -}; - -// OpenVPN packet -struct OPENVPN_PACKET -{ - UCHAR OpCode; // Op-code - UCHAR KeyId; // Key ID - UINT64 MySessionId; // Channel ID of the sender - UCHAR NumAck; // Number of ACK - UINT AckPacketId[OPENVPN_MAX_NUMACK]; // ACK packet ID list - UINT64 YourSessionId; // Destination Channel ID (If there are one or more ACK) - UINT PacketId; // Packet ID - UINT DataSize; // Data size - UCHAR *Data; // Data body -}; - -// OpenVPN channel -struct OPENVPN_CHANNEL -{ - OPENVPN_SERVER *Server; - OPENVPN_SESSION *Session; - UINT Status; // State - LIST *AckReplyList; // Response ACK list - UINT MaxRecvPacketId; // The maximum value of the arrived packet ID - UINT NextSendPacketId; // The value of a packet ID to be transmitted next - LIST *SendControlPacketList; // Sending control packet list - SSL_PIPE *SslPipe; // SSL pipe - OPENVPN_KEY_METHOD_2 ClientKey; // Key sent from the client - OPENVPN_KEY_METHOD_2 ServerKey; // Key sent from the server - char Proto[64]; // Protocol - CIPHER *CipherEncrypt; // Encryption algorithm - CIPHER *CipherDecrypt; // Decryption algorithm - MD *MdSend; // Transmission MD algorithm - MD *MdRecv; // Reception MD algorithm - UCHAR IvSend[64]; // Transmission IV - UCHAR IvRecv[64]; // Reception IV - UCHAR MasterSecret[48]; // Master Secret - UCHAR ExpansionKey[256]; // Expansion Key - UINT LastDataPacketId; // Previous Data Packet ID - UINT64 EstablishedTick; // Established time - UCHAR KeyId; // KEY ID - bool IsRekeyChannel; // Whether it is a channel for key update - bool IsInitiatorServer; // Whether the channel was started from the server side - bool RekeyInitiated; // Whether re-keying has already started - UINT64 NextRekey; - struct SslClientCertInfo ClientCert; // Client certificate and verification data -}; - -// OpenVPN session -struct OPENVPN_SESSION -{ - UINT Id; // ID - OPENVPN_SERVER *Server; - UINT64 ServerSessionId; // The session ID of the server-side - UINT64 ClientSessionId; // Session ID of the client side - UINT Protocol; // Protocol - IP ClientIp; // Client IP address - UINT ClientPort; // Client port number - IP ServerIp; // Server IP address - UINT ServerPort; // Server port number - OPENVPN_CHANNEL *Channels[OPENVPN_NUM_CHANNELS]; // Channels (up to 8) - UINT LastCreatedChannelIndex; // Channel number that is created in the last - UINT Mode; // Mode (L3 or L2) - UINT ObfuscationMode; // Packet obfuscation/scrambling mode - UINT LinkMtu; // link-mtu - UINT TunMtu; // tun-mtu - IPC_ASYNC *IpcAsync; // Asynchronous IPC connection - IPC *Ipc; // Connected IPC connection - char PushReplyStr[MAX_SIZE]; // PUSH_REPLY string - UINT64 NextPingSendTick; // Next time to send a Ping - bool Established; // VPN communication established flag - UINT64 CreatedTick; // Creation date and time - UINT64 LastCommTick; // Last communication date and time -}; - -// OpenVPN server -struct OPENVPN_SERVER -{ - CEDAR *Cedar; - INTERRUPT_MANAGER *Interrupt; // Interrupt manager - LIST *RecvPacketList; // Received packets list - LIST *SendPacketList; // Transmission packet list - LIST *SessionList; // Session list - UINT64 Now; // Current time - UINT64 Giveup; // Session establishment deadline - SOCK_EVENT *SockEvent; // Socket event - UCHAR TmpBuf[OPENVPN_TMP_BUFFER_SIZE]; // Temporary buffer - UINT DisconnectCount; // The number of session lost that have occurred so far - bool SupressSendPacket; // Packet transmission suppression flag - UINT NextSessionId; // Next session ID - DH_CTX *Dh; // DH key - UINT SessionEstablishedCount; // Number of session establishment - // Options - char *DefaultClientOption; // Default option string to push to client - bool Obfuscation; // Obfuscation enabled/disabled - char *ObfuscationMask; // String (mask) for XOR obfuscation - bool PushDummyIPv4AddressOnL2Mode; // Push a dummy IPv4 address in L2 mode -}; - -//// Function prototype -const PROTO_IMPL *OvsGetProtoImpl(); -const char *OvsName(); -const PROTO_OPTION *OvsOptions(); -bool OvsInit(void **param, const LIST *options, CEDAR *cedar, INTERRUPT_MANAGER *im, SOCK_EVENT *se, const char *cipher, const char *hostname); -void OvsFree(void *param); -bool OvsIsPacketForMe(const PROTO_MODE mode, const UCHAR *data, const UINT size); -bool OvsProcessData(void *param, TCP_RAW_DATA *in, FIFO *out); -bool OvsProcessDatagrams(void *param, LIST *in, LIST *out); -bool OvsIsOk(void *param); -UINT OvsEstablishedSessions(void *param); - -OPENVPN_SERVER *NewOpenVpnServer(const LIST *options, CEDAR *cedar, INTERRUPT_MANAGER *interrupt, SOCK_EVENT *sock_event); -void FreeOpenVpnServer(OPENVPN_SERVER *s); -void OvsRecvPacket(OPENVPN_SERVER *s, LIST *recv_packet_list, UINT protocol); -void OvsProceccRecvPacket(OPENVPN_SERVER *s, UDPPACKET *p, UINT protocol); -int OvsCompareSessionList(void *p1, void *p2); -OPENVPN_SESSION *OvsSearchSession(OPENVPN_SERVER *s, IP *server_ip, UINT server_port, IP *client_ip, UINT client_port, UINT protocol); -OPENVPN_SESSION *OvsNewSession(OPENVPN_SERVER *s, IP *server_ip, UINT server_port, IP *client_ip, UINT client_port, UINT protocol); -OPENVPN_SESSION *OvsFindOrCreateSession(OPENVPN_SERVER *s, IP *server_ip, UINT server_port, IP *client_ip, UINT client_port, UINT protocol); -void OvsFreeSession(OPENVPN_SESSION *se); -UINT OvsGetNumSessionByClientIp(OPENVPN_SERVER *s, IP *ip); - -OPENVPN_PACKET *OvsParsePacket(UCHAR *data, UINT size); -void OvsFreePacket(OPENVPN_PACKET *p); -BUF *OvsBuildPacket(OPENVPN_PACKET *p); -OPENVPN_PACKET *OvsNewControlPacket(UCHAR opcode, UCHAR key_id, UINT64 my_channel_id, UINT num_ack, - UINT *ack_packet_ids, UINT64 your_channel_id, UINT packet_id, - UINT data_size, UCHAR *data); -void OvsSendDataPacket(OPENVPN_CHANNEL *c, UCHAR key_id, UINT data_packet_id, void *data, UINT data_size); - - -OPENVPN_CHANNEL *OvsNewChannel(OPENVPN_SESSION *se, UCHAR key_id); -void OvsFreeChannel(OPENVPN_CHANNEL *c); -UINT64 OvsNewServerSessionId(OPENVPN_SERVER *s); -UINT OvsGetAckReplyList(OPENVPN_CHANNEL *c, UINT *ret); - -void OvsSendPacketNow(OPENVPN_SERVER *s, OPENVPN_SESSION *se, OPENVPN_PACKET *p); -void OvsSendPacketRawNow(OPENVPN_SERVER *s, OPENVPN_SESSION *se, void *data, UINT size); - -void OvsProcessRecvControlPacket(OPENVPN_SERVER *s, OPENVPN_SESSION *se, OPENVPN_CHANNEL *c, OPENVPN_PACKET *p); -void OvsSendControlPacket(OPENVPN_CHANNEL *c, UCHAR opcode, UCHAR *data, UINT data_size); -void OvsSendControlPacketEx(OPENVPN_CHANNEL *c, UCHAR opcode, UCHAR *data, UINT data_size, bool no_resend); -void OvsSendControlPacketWithAutoSplit(OPENVPN_CHANNEL *c, UCHAR opcode, UCHAR *data, UINT data_size); -void OvsFreeControlPacket(OPENVPN_CONTROL_PACKET *p); -void OvsDeleteFromSendingControlPacketList(OPENVPN_CHANNEL *c, UINT num_acks, UINT *acks); -UINT OvsParseKeyMethod2(OPENVPN_KEY_METHOD_2 *ret, UCHAR *data, UINT size, bool client_mode); -bool OvsReadStringFromBuf(BUF *b, char *str, UINT str_size); -void OvsSetupSessionParameters(OPENVPN_SERVER *s, OPENVPN_SESSION *se, OPENVPN_CHANNEL *c, OPENVPN_KEY_METHOD_2 *data); -BUF *OvsBuildKeyMethod2(OPENVPN_KEY_METHOD_2 *d); -void OvsWriteStringToBuf(BUF *b, char *str, UINT max_size); - -UINT OvsPeekStringFromFifo(FIFO *f, char *str, UINT str_size); -void OvsBeginIPCAsyncConnectionIfEmpty(OPENVPN_SERVER *s, OPENVPN_SESSION *se, OPENVPN_CHANNEL *c); -UINT OvsCalcTcpMss(OPENVPN_SERVER *s, OPENVPN_SESSION *se, OPENVPN_CHANNEL *c); - -CIPHER *OvsGetCipher(char *name); -MD *OvsGetMd(char *name); - -#endif // PROTO_OPENVPN_H +// SoftEther VPN Source Code - Developer Edition Master Branch +// Cedar Communication Module + + +// Proto_OpenVPN.h +// Header of Proto_OpenVPN.c + +#ifndef PROTO_OPENVPN_H +#define PROTO_OPENVPN_H + + +//// Constants +#define OPENVPN_UDP_PORT 1194 // OpenVPN default UDP port number +#define OPENVPN_UDP_PORT_INCLUDE 1195 // OpenVPN default UDP port number (Operating within the client) + +#define OPENVPN_MAX_NUMACK 4 // The maximum number of ACKs +#define OPENVPN_NUM_CHANNELS 8 // Maximum number of channels during a session +#define OPENVPN_CONTROL_PACKET_RESEND_INTERVAL 500 // Control packet retransmission interval +#define OPENVPN_CONTROL_PACKET_MAX_DATASIZE 1200 // Maximum data size that can be stored in one control packet + +#define OPENVPN_MAX_SSL_RECV_BUF_SIZE (256 * 1024) // SSL receive buffer maximum length + +#define OPENVPN_MAX_KEY_SIZE 64 // Maximum key size +#define OPENVPN_TAG_SIZE 16 // Tag size (for packet authentication in AEAD mode) + +#define OPENVPN_TMP_BUFFER_SIZE (65536 + 256) // Temporary buffer size + +#define OPENVPN_PING_SEND_INTERVAL 3000 // Transmission interval of Ping +#define OPENVPN_RECV_TIMEOUT 10000 // Communication time-out +#define OPENVPN_NEW_SESSION_DEADLINE_TIMEOUT 30000 // Grace time to complete new VPN session connection since it was created + +#define OPENVPN_MAX_PACKET_ID_FOR_TRIGGER_REKEY 0xFF000000 // Packet ID that is a trigger to start the re-key +#define OPENVPN_TCP_MAX_PACKET_SIZE 2000 // The maximum packet size allowed in TCP mode + + +// The default algorithm +#define OPENVPN_DEFAULT_CIPHER "AES-128-CBC" +#define OPENVPN_DEFAULT_MD "SHA1" + +// Encryption related +#define OPENVPN_PREMASTER_LABEL "OpenVPN master secret" +#define OPENVPN_EXPANSION_LABEL "OpenVPN key expansion" + +// IPC related +#define OPENVPN_IPC_CLIENT_NAME "OpenVPN Client" +#define OPENVPN_IPC_POSTFIX_L2 "OPENVPN_L2" +#define OPENVPN_IPC_POSTFIX_L3 "OPENVPN_L3" + +// MTU +#define OPENVPN_MTU_LINK 1514 // Ethernet MTU +#define OPENVPN_MTU_TUN 1500 // Tun MTU + +// Protocol +#define OPENVPN_PROTOCOL_UDP 0 // UDP +#define OPENVPN_PROTOCOL_TCP 1 // TCP + +// Op-code +#define OPENVPN_P_CONTROL_SOFT_RESET_V1 3 // Soft reset request +#define OPENVPN_P_CONTROL_V1 4 // SSL negotiation packet +#define OPENVPN_P_ACK_V1 5 // Acknowledgment +#define OPENVPN_P_DATA_V1 6 // Data packet +#define OPENVPN_P_CONTROL_HARD_RESET_CLIENT_V2 7 // Connection request from client +#define OPENVPN_P_CONTROL_HARD_RESET_SERVER_V2 8 // Connection response from server + +// State of OpenVPN channel +#define OPENVPN_CHANNEL_STATUS_INIT 0 // Initialization phase +#define OPENVPN_CHANNEL_STATUS_TLS_WAIT_CLIENT_KEY 1 // Waiting for the key information from the client +#define OPENVPN_CHANNEL_STATUS_TLS_WAIT_CLIENT_PUSH_REQUEST 2 // Waiting for PUSH_REQUEST from the client +#define OPENVPN_CHANNEL_STATUS_TLS_VPN_CONNECTING 3 // VPN connecting process is running +#define OPENVPN_CHANNEL_STATUS_ESTABLISHED 4 // VPN connection established +#define OPENVPN_CHANNEL_STATUS_DISCONNECTED 5 // Disconnected + +// Quota +#define OPENVPN_QUOTA_MAX_NUM_SESSIONS_PER_IP 1000 // Number of OpenVPN sessions per IP address +#define OPENVPN_QUOTA_MAX_NUM_SESSIONS 30000 // Limit of the number of sessions + +// Mode +#define OPENVPN_MODE_UNKNOWN 0 // Unknown +#define OPENVPN_MODE_L2 1 // TAP (Ethernet) +#define OPENVPN_MODE_L3 2 // TUN (IP) + +// Scramble mode +#define OPENVPN_SCRAMBLE_MODE_DISABLED 0 // No scramble +#define OPENVPN_SCRAMBLE_MODE_XORMASK 1 // XOR the bytes with the specified string +#define OPENVPN_SCRAMBLE_MODE_XORPTRPOS 2 // XOR each byte with its position in the buffer +#define OPENVPN_SCRAMBLE_MODE_REVERSE 3 // Reverses bytes order, keeping the first byte unchanged +#define OPENVPN_SCRAMBLE_MODE_OBFUSCATE 4 // Performs the above steps using the specified string for xormask + +//// Type + +// Data of OpenVPN Key Method 2 +struct OPENVPN_KEY_METHOD_2 +{ + UCHAR PreMasterSecret[48]; // Pre Master Secret (client only) + UCHAR Random1[32]; // Random 1 + UCHAR Random2[32]; // Random 2 + char OptionString[512]; // Option string + char Username[512]; // User name + char Password[512]; // Password + char PeerInfo[1536]; // PeerInfo +}; + +// OpenVPN sending control packet +struct OPENVPN_CONTROL_PACKET +{ + UCHAR OpCode; // Op-code + UINT PacketId; // Packet ID + UINT DataSize; // Data size + UCHAR *Data; // Data body + UINT64 NextSendTime; // Scheduled next transmission time + bool NoResend; // Disable re-sending + UINT NumSent; // How many times we have sent this packet +}; + +// OpenVPN packet +struct OPENVPN_PACKET +{ + UCHAR OpCode; // Op-code + UCHAR KeyId; // Key ID + UINT64 MySessionId; // Channel ID of the sender + UCHAR NumAck; // Number of ACK + UINT AckPacketId[OPENVPN_MAX_NUMACK]; // ACK packet ID list + UINT64 YourSessionId; // Destination Channel ID (If there are one or more ACK) + UINT PacketId; // Packet ID + UINT DataSize; // Data size + UCHAR *Data; // Data body +}; + +// OpenVPN channel +struct OPENVPN_CHANNEL +{ + OPENVPN_SERVER *Server; + OPENVPN_SESSION *Session; + UINT Status; // State + LIST *AckReplyList; // Response ACK list + UINT MaxRecvPacketId; // The maximum value of the arrived packet ID + UINT NextSendPacketId; // The value of a packet ID to be transmitted next + LIST *SendControlPacketList; // Sending control packet list + SSL_PIPE *SslPipe; // SSL pipe + OPENVPN_KEY_METHOD_2 ClientKey; // Key sent from the client + OPENVPN_KEY_METHOD_2 ServerKey; // Key sent from the server + char Proto[64]; // Protocol + CIPHER *CipherEncrypt; // Encryption algorithm + CIPHER *CipherDecrypt; // Decryption algorithm + MD *MdSend; // Transmission MD algorithm + MD *MdRecv; // Reception MD algorithm + UCHAR IvSend[64]; // Transmission IV + UCHAR IvRecv[64]; // Reception IV + UCHAR MasterSecret[48]; // Master Secret + UCHAR ExpansionKey[256]; // Expansion Key + UINT LastDataPacketId; // Previous Data Packet ID + UINT64 EstablishedTick; // Established time + UCHAR KeyId; // KEY ID + bool IsRekeyChannel; // Whether it is a channel for key update + bool IsInitiatorServer; // Whether the channel was started from the server side + bool RekeyInitiated; // Whether re-keying has already started + UINT64 NextRekey; + struct SslClientCertInfo ClientCert; // Client certificate and verification data +}; + +// OpenVPN session +struct OPENVPN_SESSION +{ + UINT Id; // ID + OPENVPN_SERVER *Server; + UINT64 ServerSessionId; // The session ID of the server-side + UINT64 ClientSessionId; // Session ID of the client side + UINT Protocol; // Protocol + IP ClientIp; // Client IP address + UINT ClientPort; // Client port number + IP ServerIp; // Server IP address + UINT ServerPort; // Server port number + OPENVPN_CHANNEL *Channels[OPENVPN_NUM_CHANNELS]; // Channels (up to 8) + UINT LastCreatedChannelIndex; // Channel number that is created in the last + UINT Mode; // Mode (L3 or L2) + UINT ObfuscationMode; // Packet obfuscation/scrambling mode + UINT LinkMtu; // link-mtu + UINT TunMtu; // tun-mtu + IPC_ASYNC *IpcAsync; // Asynchronous IPC connection + IPC *Ipc; // Connected IPC connection + char PushReplyStr[MAX_SIZE]; // PUSH_REPLY string + UINT64 NextPingSendTick; // Next time to send a Ping + bool Established; // VPN communication established flag + UINT64 CreatedTick; // Creation date and time + UINT64 LastCommTick; // Last communication date and time +}; + +// OpenVPN server +struct OPENVPN_SERVER +{ + CEDAR *Cedar; + INTERRUPT_MANAGER *Interrupt; // Interrupt manager + LIST *RecvPacketList; // Received packets list + LIST *SendPacketList; // Transmission packet list + LIST *SessionList; // Session list + UINT64 Now; // Current time + UINT64 Giveup; // Session establishment deadline + SOCK_EVENT *SockEvent; // Socket event + UCHAR TmpBuf[OPENVPN_TMP_BUFFER_SIZE]; // Temporary buffer + UINT DisconnectCount; // The number of session lost that have occurred so far + bool SupressSendPacket; // Packet transmission suppression flag + UINT NextSessionId; // Next session ID + DH_CTX *Dh; // DH key + UINT SessionEstablishedCount; // Number of session establishment + // Options + char *DefaultClientOption; // Default option string to push to client + bool Obfuscation; // Obfuscation enabled/disabled + char *ObfuscationMask; // String (mask) for XOR obfuscation + bool PushDummyIPv4AddressOnL2Mode; // Push a dummy IPv4 address in L2 mode +}; + +//// Function prototype +const PROTO_IMPL *OvsGetProtoImpl(); +const char *OvsName(); +const PROTO_OPTION *OvsOptions(); +bool OvsInit(void **param, const LIST *options, CEDAR *cedar, INTERRUPT_MANAGER *im, SOCK_EVENT *se, const char *cipher, const char *hostname); +void OvsFree(void *param); +bool OvsIsPacketForMe(const PROTO_MODE mode, const UCHAR *data, const UINT size); +bool OvsProcessData(void *param, TCP_RAW_DATA *in, FIFO *out); +bool OvsProcessDatagrams(void *param, LIST *in, LIST *out); +bool OvsIsOk(void *param); +UINT OvsEstablishedSessions(void *param); + +OPENVPN_SERVER *NewOpenVpnServer(const LIST *options, CEDAR *cedar, INTERRUPT_MANAGER *interrupt, SOCK_EVENT *sock_event); +void FreeOpenVpnServer(OPENVPN_SERVER *s); +void OvsRecvPacket(OPENVPN_SERVER *s, LIST *recv_packet_list, UINT protocol); +void OvsProceccRecvPacket(OPENVPN_SERVER *s, UDPPACKET *p, UINT protocol); +int OvsCompareSessionList(void *p1, void *p2); +OPENVPN_SESSION *OvsSearchSession(OPENVPN_SERVER *s, IP *server_ip, UINT server_port, IP *client_ip, UINT client_port, UINT protocol); +OPENVPN_SESSION *OvsNewSession(OPENVPN_SERVER *s, IP *server_ip, UINT server_port, IP *client_ip, UINT client_port, UINT protocol); +OPENVPN_SESSION *OvsFindOrCreateSession(OPENVPN_SERVER *s, IP *server_ip, UINT server_port, IP *client_ip, UINT client_port, UINT protocol); +void OvsFreeSession(OPENVPN_SESSION *se); +UINT OvsGetNumSessionByClientIp(OPENVPN_SERVER *s, IP *ip); + +OPENVPN_PACKET *OvsParsePacket(UCHAR *data, UINT size); +void OvsFreePacket(OPENVPN_PACKET *p); +BUF *OvsBuildPacket(OPENVPN_PACKET *p); +OPENVPN_PACKET *OvsNewControlPacket(UCHAR opcode, UCHAR key_id, UINT64 my_channel_id, UINT num_ack, + UINT *ack_packet_ids, UINT64 your_channel_id, UINT packet_id, + UINT data_size, UCHAR *data); +void OvsSendDataPacket(OPENVPN_CHANNEL *c, UCHAR key_id, UINT data_packet_id, void *data, UINT data_size); + + +OPENVPN_CHANNEL *OvsNewChannel(OPENVPN_SESSION *se, UCHAR key_id); +void OvsFreeChannel(OPENVPN_CHANNEL *c); +UINT64 OvsNewServerSessionId(OPENVPN_SERVER *s); +UINT OvsGetAckReplyList(OPENVPN_CHANNEL *c, UINT *ret); + +void OvsSendPacketNow(OPENVPN_SERVER *s, OPENVPN_SESSION *se, OPENVPN_PACKET *p); +void OvsSendPacketRawNow(OPENVPN_SERVER *s, OPENVPN_SESSION *se, void *data, UINT size); + +void OvsProcessRecvControlPacket(OPENVPN_SERVER *s, OPENVPN_SESSION *se, OPENVPN_CHANNEL *c, OPENVPN_PACKET *p); +void OvsSendControlPacket(OPENVPN_CHANNEL *c, UCHAR opcode, UCHAR *data, UINT data_size); +void OvsSendControlPacketEx(OPENVPN_CHANNEL *c, UCHAR opcode, UCHAR *data, UINT data_size, bool no_resend); +void OvsSendControlPacketWithAutoSplit(OPENVPN_CHANNEL *c, UCHAR opcode, UCHAR *data, UINT data_size); +void OvsFreeControlPacket(OPENVPN_CONTROL_PACKET *p); +void OvsDeleteFromSendingControlPacketList(OPENVPN_CHANNEL *c, UINT num_acks, UINT *acks); +UINT OvsParseKeyMethod2(OPENVPN_KEY_METHOD_2 *ret, UCHAR *data, UINT size, bool client_mode); +bool OvsReadStringFromBuf(BUF *b, char *str, UINT str_size); +void OvsSetupSessionParameters(OPENVPN_SERVER *s, OPENVPN_SESSION *se, OPENVPN_CHANNEL *c, OPENVPN_KEY_METHOD_2 *data); +BUF *OvsBuildKeyMethod2(OPENVPN_KEY_METHOD_2 *d); +void OvsWriteStringToBuf(BUF *b, char *str, UINT max_size); + +UINT OvsPeekStringFromFifo(FIFO *f, char *str, UINT str_size); +void OvsBeginIPCAsyncConnectionIfEmpty(OPENVPN_SERVER *s, OPENVPN_SESSION *se, OPENVPN_CHANNEL *c); +UINT OvsCalcTcpMss(OPENVPN_SERVER *s, OPENVPN_SESSION *se, OPENVPN_CHANNEL *c); + +CIPHER *OvsGetCipher(char *name); +MD *OvsGetMd(char *name); + +#endif // PROTO_OPENVPN_H diff --git a/src/Cedar/Proto_PPP.c b/src/Cedar/Proto_PPP.c index 9542cf09..9f25fb97 100644 --- a/src/Cedar/Proto_PPP.c +++ b/src/Cedar/Proto_PPP.c @@ -1,4051 +1,4049 @@ -// SoftEther VPN Source Code - Developer Edition Master Branch -// Cedar Communication Module - - -// Proto_PPP.c -// PPP protocol stack - -#include "CedarPch.h" - -// PPP main thread -void PPPThread(THREAD *thread, void *param) -{ - PPP_SESSION *p = (PPP_SESSION *)param; - UINT i; - USHORT next_protocol = 0; - bool ret = false; - char ipstr1[128], ipstr2[128]; - bool authReqSent = false; - UINT64 now = Tick64(); - - // Validate arguments - if (thread == NULL || param == NULL) - { - return; - } - - // Initialize - - Debug("PPP Initialize"); - - PPPSetStatus(p, PPP_STATUS_CONNECTED); - - p->Eap_Protocol = PPP_UNSPECIFIED; - - p->Mru1 = p->Mru2 = PPP_MRU_DEFAULT; - p->RecvPacketList = NewList(NULL); - p->SentReqPacketList = NewList(NULL); - p->DelayedPackets = NewList(PPPDelayedPacketsComparator); - - p->MsChapV2_UseDoubleMsChapV2 = CedarIsThereAnyEapEnabledRadiusConfig(p->Cedar); - - Debug("MsChapV2_UseDoubleMsChapV2 = 0x%x\n", p->MsChapV2_UseDoubleMsChapV2); - - //// Link establishment phase - - Debug("PPP Link establishment phase\n"); - - IPToStr(ipstr1, sizeof(ipstr1), &p->ClientIP); - IPToStr(ipstr2, sizeof(ipstr2), &p->ServerIP); - PPPLog(p, "LP_CONNECTED", p->Postfix, ipstr1, p->ClientHostname, p->ClientPort, ipstr2, p->ServerPort, - p->ClientSoftwareName, p->AdjustMss); - - // We need that so we don't time out on connection immediately - p->LastRecvTime = Tick64(); - - Debug("PPP starting main dataloop\n"); - - // Dataloop active if the receiving tube is still connected - while (true) - { - PPP_LCP *lcp; - bool receivedPacketProcessed = false; - TUBE *tubes[2]; - UINT r; - - PPPGetNextPacket(p); - - if (p->CurrentPacket != NULL) - { - // First we process any possible unsupported packets - receivedPacketProcessed = PPPRejectUnsupportedPacket(p, p->CurrentPacket); - - // Now do some basic processing - if (!receivedPacketProcessed && p->CurrentPacket->IsControl && p->CurrentPacket->Protocol == PPP_PROTOCOL_LCP) - { - if (p->CurrentPacket->Lcp->Code == PPP_LCP_CODE_ECHO_REQUEST && !PPP_STATUS_IS_UNAVAILABLE(p->PPPStatus)) - { - // Immediately return the echo response to the echo request - PPP_PACKET *pp2 = ZeroMalloc(sizeof(PPP_PACKET)); - - pp2->IsControl = true; - pp2->Protocol = PPP_PROTOCOL_LCP; - pp2->Lcp = NewPPPLCP(PPP_LCP_CODE_ECHO_RESPONSE, p->CurrentPacket->Lcp->Id); - pp2->Lcp->Data = Clone(p->CurrentPacket->Lcp->Data, p->CurrentPacket->Lcp->DataSize); - pp2->Lcp->DataSize = p->CurrentPacket->Lcp->DataSize; - - if (PPPSendPacketAndFree(p, pp2) == false) - { - PPPSetStatus(p, PPP_STATUS_FAIL); - WHERE; - } - - receivedPacketProcessed = true; - } - else if (p->CurrentPacket->Lcp->Code == PPP_LCP_CODE_ECHO_RESPONSE && !PPP_STATUS_IS_UNAVAILABLE(p->PPPStatus)) - { - receivedPacketProcessed = true; - // Ignore the Echo response packet - } - else if (p->CurrentPacket->Lcp->Code == PPP_LCP_CODE_DROP && !PPP_STATUS_IS_UNAVAILABLE(p->PPPStatus)) - { - receivedPacketProcessed = true; - // Ignore the Drop packet - } - else if (p->CurrentPacket->Lcp->Code == PPP_LCP_CODE_IDENTIFICATION && !PPP_STATUS_IS_UNAVAILABLE(p->PPPStatus)) - { - receivedPacketProcessed = true; - // Ignore the Identification packet - WHERE; - } - else if (p->CurrentPacket->Lcp->Code == PPP_LCP_CODE_TERMINATE_REQ) - { - PPP_PACKET *pp2 = ZeroMalloc(sizeof(PPP_PACKET));; - receivedPacketProcessed = true; - // Return the Terminate ACK If a Terminate Request has been received - - pp2->IsControl = true; - pp2->Protocol = PPP_PROTOCOL_LCP; - pp2->Lcp = NewPPPLCP(PPP_LCP_CODE_TERMINATE_ACK, p->CurrentPacket->Lcp->Id); - pp2->Lcp->Data = Clone(p->CurrentPacket->Lcp->Data, p->CurrentPacket->Lcp->DataSize); - pp2->Lcp->DataSize = p->CurrentPacket->Lcp->DataSize; - - p->IsTerminateReceived = true; - - if (PPPSendPacketAndFree(p, pp2) == false) - { - PPPSetStatus(p, PPP_STATUS_FAIL); - WHERE; - } - else - { - SleepThread(100); - PPPSetStatus(p, PPP_STATUS_CLOSED); - } - } - else if (p->CurrentPacket->Lcp->Code == PPP_LCP_CODE_TERMINATE_ACK) - { - PPPSetStatus(p, PPP_STATUS_CLOSED); - } - } - - // Process responses - if (!receivedPacketProcessed && p->CurrentPacket != NULL && p->CurrentPacket->IsControl && PPP_CODE_IS_RESPONSE(p->CurrentPacket->Protocol, p->CurrentPacket->Lcp->Code) && !PPP_STATUS_IS_UNAVAILABLE(p->PPPStatus)) - { - PPP_PACKET *request = NULL; - // Removing from resend list - for (i = 0; i < LIST_NUM(p->SentReqPacketList); i++) - { - PPP_REQUEST_RESEND *t = LIST_DATA(p->SentReqPacketList, i); - - if (t->Id == p->CurrentPacket->Lcp->Id) - { - request = t->Packet; - Delete(p->SentReqPacketList, t); - Free(t); - break; - } - } - PPPProcessResponsePacket(p, p->CurrentPacket, request); - FreePPPPacket(request); - receivedPacketProcessed = true; - } - - // Process requests - if (!receivedPacketProcessed && p->CurrentPacket != NULL && p->CurrentPacket->IsControl && PPP_CODE_IS_REQUEST(p->CurrentPacket->Protocol, p->CurrentPacket->Lcp->Code) && !PPP_STATUS_IS_UNAVAILABLE(p->PPPStatus)) - { - PPPProcessRequestPacket(p, p->CurrentPacket); - receivedPacketProcessed = true; - } - - // Process data packets, discarded before we got any links up - if (!receivedPacketProcessed && p->CurrentPacket != NULL && !p->CurrentPacket->IsControl && p->PPPStatus == PPP_STATUS_NETWORK_LAYER && p->Ipc != NULL) - { - UINT64 timeBeforeLoop = Tick64(); - while (true) - { - UINT64 nowL; - // Here client to server - if (p->CurrentPacket->Protocol == PPP_PROTOCOL_IP && - IPC_PROTO_GET_STATUS(p->Ipc, IPv4State) == IPC_PROTO_STATUS_OPENED) - { - receivedPacketProcessed = true; - IPCSendIPv4(p->Ipc, p->CurrentPacket->Data, p->CurrentPacket->DataSize); - } - else if (p->CurrentPacket->Protocol == PPP_PROTOCOL_IP) - { - Debug("Got IPv4 packet before IPv4 ready!\n"); - } - else if (p->CurrentPacket->Protocol == PPP_PROTOCOL_IPV6 && - IPC_PROTO_GET_STATUS(p->Ipc, IPv6State) == IPC_PROTO_STATUS_OPENED) - { - receivedPacketProcessed = true; - IPCIPv6Send(p->Ipc, p->CurrentPacket->Data, p->CurrentPacket->DataSize); - } - else if (p->CurrentPacket->Protocol == PPP_PROTOCOL_IPV6) - { - Debug("Got IPv6 packet before IPv6 ready!\n"); - } - - // Let's break out of the loop once in a while so we don't get stuck here endlessly - nowL = Tick64(); - if (nowL > timeBeforeLoop + PPP_PACKET_RESEND_INTERVAL) - { - break; - } - - PPPGetNextPacket(p); - if (p->CurrentPacket == NULL) - { - break; - } - // Making sure we got a correctly parsed packet by rejecting all invalid ones - if (PPPRejectUnsupportedPacket(p, p->CurrentPacket)) - { - break; - } - if (p->CurrentPacket->IsControl || p->PPPStatus != PPP_STATUS_NETWORK_LAYER || p->Ipc == NULL) - { - PPPAddNextPacket(p, p->CurrentPacket, 0); - p->CurrentPacket = NULL; - break; - } - } - } - - if (!receivedPacketProcessed && p->CurrentPacket != NULL) - { - Debug("Unprocessed and unrejected packet, protocol = 0x%x\n", p->CurrentPacket->Protocol); - } - } - else if (p->PPPStatus == PPP_STATUS_BEFORE_AUTH && p->AuthProtocol == PPP_PROTOCOL_EAP) - { - PPP_LCP *lcpEap; - PPP_EAP *eapPacket; - UCHAR *welcomeMessage = "Welcome to the SoftEther VPN server!"; - UCHAR flags = PPP_EAP_TLS_FLAG_NONE; - // We got to start EAP when we got no LCP packets from the client on previous iteration - // which means we parsed all the client requests and responses - - switch (p->Eap_Protocol) - { - case PPP_EAP_TYPE_TLS: - // Sending TLS Start... - flags |= PPP_EAP_TLS_FLAG_SSLSTARTED; - lcpEap = BuildEAPTlsRequest(p->Eap_PacketId++, 0, flags); - PPPSetStatus(p, PPP_STATUS_AUTHENTICATING); - if (!PPPSendAndRetransmitRequest(p, PPP_PROTOCOL_EAP, lcpEap)) - { - PPPSetStatus(p, PPP_STATUS_FAIL); - WHERE; - break; - } - break; - case PPP_EAP_TYPE_IDENTITY: - default: // We treat the unspecified protocol as the IDENTITY protocol - p->Eap_Protocol = PPP_EAP_TYPE_IDENTITY; - lcpEap = BuildEAPPacketEx(PPP_EAP_CODE_REQUEST, p->Eap_PacketId++, PPP_EAP_TYPE_IDENTITY, StrLen(welcomeMessage) + 1); - eapPacket = lcpEap->Data; - Copy(eapPacket->Data, welcomeMessage, StrLen(welcomeMessage)); - PPPSetStatus(p, PPP_STATUS_AUTHENTICATING); - if (!PPPSendAndRetransmitRequest(p, PPP_PROTOCOL_EAP, lcpEap)) - { - PPPSetStatus(p, PPP_STATUS_FAIL); - WHERE; - break; - } - break; - } - } - else if (p->PPPStatus == PPP_STATUS_BEFORE_AUTH && p->AuthProtocol == PPP_PROTOCOL_CHAP) - { - // We got to start CHAP when we got no LCP packets from the client on previous iteration - // which means we parsed all the client requests and responses - Debug("Starting PPP Authentication phase MS-CHAP v2\n"); - - lcp = BuildMSCHAP2ChallengePacket(p); - if (!PPPSendAndRetransmitRequest(p, PPP_PROTOCOL_CHAP, lcp)) - { - PPPSetStatus(p, PPP_STATUS_FAIL); - WHERE; - } - - PPPSetStatus(p, PPP_STATUS_AUTHENTICATING); - } - - if (p->PPPStatus == PPP_STATUS_CONNECTED && !authReqSent) - { - // EAP code - PPP_LCP *c = NewPPPLCP(PPP_LCP_CODE_REQ, 0); - USHORT eap_code = Endian16(PPP_LCP_AUTH_EAP); - - Debug("Request EAP\n"); - Add(c->OptionList, NewPPPOption(PPP_LCP_OPTION_AUTH, &eap_code, sizeof(eap_code))); - if (!PPPSendAndRetransmitRequest(p, PPP_PROTOCOL_LCP, c)) - { - PPPSetStatus(p, PPP_STATUS_FAIL); - WHERE; - } - authReqSent = true; - } - - if (p->PPPStatus == PPP_STATUS_AUTHENTICATING) - { - //Debug("Tick waiting for auth...\n"); - } - - if (p->PPPStatus == PPP_STATUS_AUTH_FAIL) - { - Debug("PPP auth failed, giving up\n"); - p->DisconnectCauseCode = 15; - p->DisconnectCauseDirection = 1; - PPPSetStatus(p, PPP_STATUS_CLOSING); - } - - if (p->PPPStatus == PPP_STATUS_NETWORK_LAYER) - { - UINT64 timeBeforeLoop; - if (IPC_PROTO_GET_STATUS(p->Ipc, IPv4State) == IPC_PROTO_STATUS_OPENED) - { - if (p->DhcpAllocated) - { - if (now >= p->DhcpNextRenewTime) - { - IP ip; - - // DHCP renewal procedure - p->DhcpNextRenewTime = now + p->DhcpRenewInterval; - - UINTToIP(&ip, p->ClientAddressOption.ServerAddress); - - IPCDhcpRenewIP(p->Ipc, &ip); - } - } - } - - IPCProcessL3Events(p->Ipc); - - timeBeforeLoop = Tick64(); - - while (true) - { - UINT64 nowL; - bool no4packets = false; - bool no6packets = false; - if (IPC_PROTO_GET_STATUS(p->Ipc, IPv4State) == IPC_PROTO_STATUS_OPENED) - { - BLOCK *b = IPCRecvIPv4(p->Ipc); - if (b == NULL) - { - no4packets = true; - } - else - { - PPP_PACKET *pp; - PPP_PACKET tmp; - - // Since receiving the IP packet, send it to the client by PPP - pp = &tmp; - pp->IsControl = false; - pp->Protocol = PPP_PROTOCOL_IP; - pp->Lcp = NULL; - pp->Data = b->Buf; - pp->DataSize = b->Size; - - PPPSendPacketEx(p, pp, true); - - FreePPPPacketEx(pp, true); - Free(b); // Not FreeBlock because freed in FreePPPPacketEx - } - } - else - { - no4packets = true; - } - - if (IPC_PROTO_GET_STATUS(p->Ipc, IPv6State) == IPC_PROTO_STATUS_OPENED) - { - BLOCK *b = IPCIPv6Recv(p->Ipc); - if (b == NULL) - { - no6packets = true; - } - else - { - PPP_PACKET *pp; - PPP_PACKET tmp; - - // Since receiving the IP packet, send it to the client by PPP - pp = &tmp; - pp->IsControl = false; - pp->Protocol = PPP_PROTOCOL_IPV6; - pp->Lcp = NULL; - pp->Data = b->Buf; - pp->DataSize = b->Size; - - PPPSendPacketEx(p, pp, true); - - FreePPPPacketEx(pp, true); - Free(b); // Not FreeBlock because freed in FreePPPPacketEx - } - } - else - { - no6packets = true; - } - - // Let's break out of the loop once in a while so we don't get stuck here endlessly - nowL = Tick64(); - if (nowL > timeBeforeLoop + PPP_PACKET_RESEND_INTERVAL || (no4packets && no6packets)) - { - break; - } - } - - FlushTubeFlushList(p->FlushList); - } - - if (p->PPPStatus == PPP_STATUS_AUTH_SUCCESS) - { - Debug("PPP auth success, ready for network layer on next tick\n"); - p->AuthOk = true; - PPPSetStatus(p, PPP_STATUS_NETWORK_LAYER); - } - - if ((p->PPPStatus == PPP_STATUS_CLOSING || p->PPPStatus == PPP_STATUS_FAIL) && IsTubeConnected(p->TubeRecv) && IsTubeConnected(p->TubeSend)) - { - Debug("Trying to cleanly close the connection, status = 0x%x\n", p->PPPStatus); - PPPSetStatus(p, PPP_STATUS_CLOSING_WAIT); - lcp = NewPPPLCP(PPP_LCP_CODE_TERMINATE_REQ, 0); - if (!PPPSendAndRetransmitRequest(p, PPP_PROTOCOL_LCP, lcp)) - { - PPPSetStatus(p, PPP_STATUS_FAIL); - WHERE; - } - } - - if (!PPP_STATUS_IS_UNAVAILABLE(p->PPPStatus) || p->PPPStatus == PPP_STATUS_CLOSING_WAIT) - { - PPPProcessRetransmissions(p); - PPPSendEchoRequest(p); - } - - tubes[0] = p->TubeRecv; - - if (p->PPPStatus == PPP_STATUS_NETWORK_LAYER && p->Ipc != NULL && IsIPCConnected(p->Ipc)) - { - r = GetNextIntervalForInterrupt(p->Ipc->Interrupt); - tubes[1] = p->Ipc->Sock->RecvTube; - WaitForTubes(tubes, 2, MIN(r, PPP_PACKET_RESEND_INTERVAL)); - } - else - { - WaitForTubes(tubes, 1, 300); // Increasing timeout to make the ticks a bit slower - } - - if (IsTubeConnected(p->TubeRecv) == false || IsTubeConnected(p->TubeSend) == false) - { - // Higher-level protocol is disconnected - PPPLog(p, "LP_UPPER_PROTOCOL_DISCONNECTED", p->Postfix); - break; - } - - if (IsIPCConnected(p->Ipc) == false && p->PPPStatus == PPP_STATUS_NETWORK_LAYER) - { - // IPC VPN session is disconnected - PPPLog(p, "LP_VPN_SESSION_TERMINATED"); - break; - } - - // Time-out inspection - if ((p->LastRecvTime + (UINT64)p->DataTimeout) <= now) - { - // Communication time-out occurs - PPPLog(p, "LP_DATA_TIMEOUT"); - break; - } - - // Maximum PPP session time of the user reached inspection - if (p->UserConnectionTick != 0 && p->UserConnectionTimeout != 0 && - p->UserConnectionTick + p->UserConnectionTimeout <= now) - { - // User connection time-out occurs - PPPLog(p, "LP_USER_TIMEOUT"); - break; - } - - // Terminate if the PPP disconnected - if (p->IsTerminateReceived) - { - PPPLog(p, "LP_NORMAL_TERMINATE"); - break; - } - - if (p->PPPStatus == PPP_STATUS_FAIL || p->PPPStatus == PPP_STATUS_CLOSED) - { - Debug("Exiting main dataloop, status = 0x%x\n", p->PPPStatus); - break; - } - } - - Debug("Exited main dataloop, status = 0x%x\n", p->PPPStatus); - - if (p->PPPStatus != PPP_STATUS_FAIL) - { - IP ip; - char tmp[MAX_SIZE]; - - // Disconnected normally - PPPLog(p, "LP_DISCONNECTED"); - - if (p != NULL && p->DhcpAllocated && IsIPCConnected(p->Ipc) && p->ClientAddressOption.ServerAddress != 0) - { - // If any address is assigned from the DHCP, release it - UINTToIP(&ip, p->ClientAddressOption.ServerAddress); - - IPToStr(tmp, sizeof(tmp), &ip); - Debug("Releasing IP Address from DHCP Server %s...\n", tmp); - - IPCDhcpFreeIP(p->Ipc, &ip); - IPCProcessL3Events(p->Ipc); - - SleepThread(300); - } - } - else - { - PPPLog(p, "LP_DISCONNECTED_ABNORMAL"); - } - - FreePPPSession(p); - Debug("PPP Session ended correctly\n"); -} - - -// Entry point - -// Create a new PPP session -PPP_SESSION *NewPPPSession(CEDAR *cedar, IP *client_ip, UINT client_port, IP *server_ip, UINT server_port, TUBE *send_tube, TUBE *recv_tube, char *postfix, char *client_software_name, char *client_hostname, char *crypt_name, UINT adjust_mss) -{ - PPP_SESSION *p; - THREAD *t; - // Validate arguments - if (cedar == NULL || client_ip == NULL || server_ip == NULL || send_tube == NULL || recv_tube == NULL) - { - return NULL; - } - if (IsEmptyStr(postfix)) - { - postfix = "PPP"; - } - if (IsEmptyStr(crypt_name)) - { - crypt_name = ""; - } - if (IsEmptyStr(client_software_name)) - { - client_software_name = "PPP VPN Client"; - } - - // Data structure initialization - p = ZeroMalloc(sizeof(PPP_SESSION)); - - p->EnableMSCHAPv2 = true; - p->AuthProtocol = PPP_UNSPECIFIED; - p->MsChapV2_ErrorCode = 691; - p->EapClient = NULL; - - p->DataTimeout = PPP_DATA_TIMEOUT; - p->PacketRecvTimeout = PPP_PACKET_RECV_TIMEOUT; - p->UserConnectionTimeout = 0; - - p->Cedar = cedar; - AddRef(cedar->ref); - - p->AdjustMss = adjust_mss; - - StrCpy(p->CryptName, sizeof(p->CryptName), crypt_name); - - Copy(&p->ClientIP, client_ip, sizeof(IP)); - p->ClientPort = client_port; - - Copy(&p->ServerIP, server_ip, sizeof(IP)); - p->ServerPort = server_port; - - p->TubeRecv = recv_tube; - p->TubeSend = send_tube; - - AddRef(p->TubeRecv->Ref); - AddRef(p->TubeSend->Ref); - - StrCpy(p->Postfix, sizeof(p->Postfix), postfix); - StrCpy(p->ClientSoftwareName, sizeof(p->ClientSoftwareName), client_software_name); - - if (IsEmptyStr(client_hostname)) - { - IPToStr(p->ClientHostname, sizeof(p->ClientHostname), client_ip); - } - else - { - StrCpy(p->ClientHostname, sizeof(p->ClientHostname), client_hostname); - } - - p->FlushList = NewTubeFlushList(); - - // Thread creation - t = NewThread(PPPThread, p); - - p->SessionThread = t; - - return p; -} - -// PPP processing functions - -// Finds out if a packet is supported, if not - sends a notification to the peer -// result: false - supported, true - unsupported -bool PPPRejectUnsupportedPacket(PPP_SESSION *p, PPP_PACKET *pp) -{ - return PPPRejectUnsupportedPacketEx(p, pp, false); -} -bool PPPRejectUnsupportedPacketEx(PPP_SESSION *p, PPP_PACKET *pp, bool force) -{ - bool result = false; - if (p == NULL || pp == NULL) - { - return false; - } - - if (PPP_IS_SUPPORTED_PROTOCOL(pp->Protocol) == false || force == true) - { - // Unsupported algorithm - PPP_PACKET *pp2 = ZeroMalloc(sizeof(PPP_PACKET)); - BUF *buf; - UCHAR c; - USHORT us; - - Debug("Rejecting PPP protocol = 0x%x\n", pp->Protocol); - result = true; - - pp2->Protocol = PPP_PROTOCOL_LCP; - pp2->IsControl = false; - - buf = NewBuf(); - - // Code - c = PPP_LCP_CODE_PROTOCOL_REJECT; - WriteBuf(buf, &c, 1); - - // ID - c = p->NextId++; - WriteBuf(buf, &c, 1); - - // Length - us = Endian16(pp->DataSize + 6); - WriteBuf(buf, &us, 2); - - // Rejected Protocol - us = Endian16(pp->Protocol); - WriteBuf(buf, &us, 2); - - // Packet Data - WriteBuf(buf, pp->Data, pp->DataSize); - - pp2->Data = Clone(buf->Buf, buf->Size); - pp2->DataSize = buf->Size; - - FreeBuf(buf); - - if (!PPPSendPacketAndFree(p, pp2)) - { - PPPSetStatus(p, PPP_STATUS_FAIL); - WHERE; - } - } - return result; -} - -// Do the retransmissions if needed -bool PPPProcessRetransmissions(PPP_SESSION *p) -{ - INT64 i = 0; - UINT64 now = Tick64(); - UINT64 count; - if (p->SentReqPacketList == NULL) - { - Debug("Somehow SentReqPacketList is NULL!\n"); - return false; - } - // Making it signed but expanding to 64 bits - count = LIST_NUM(p->SentReqPacketList); - if (count == 0) - { - return true; - } - for (i = count - 1; i >= 0; --i) - { - PPP_REQUEST_RESEND *t = LIST_DATA(p->SentReqPacketList, i); - - if (t->TimeoutTime <= now) - { - Debug("Timing out on resending control packet protocol = 0x%x\n", t->Packet->Protocol); - Delete(p->SentReqPacketList, t); - FreePPPPacket(t->Packet); - Free(t); - } - else if (t->ResendTime <= now) - { - Debug("Resending control packet protocol = 0x%x\n", t->Packet->Protocol); - if (!PPPSendPacketEx(p, t->Packet, false)) - { - PPPSetStatus(p, PPP_STATUS_FAIL); - WHERE; - return false; - } - t->ResendTime = now + PPP_PACKET_RESEND_INTERVAL; - } - } - return true; -} - -// Send the PPP Echo Request -bool PPPSendEchoRequest(PPP_SESSION *p) -{ - // Validate arguments - if (p == NULL) - { - return false; - } - - UINT64 now = Tick64(); - if (p->NextEchoSendTime == 0 || now >= p->NextEchoSendTime) - { - PPP_PACKET *pp; - char echo_data[] = "\0\0\0\0Aho Baka Manuke"; - - p->NextEchoSendTime = now + (UINT64)PPP_ECHO_SEND_INTERVAL; - if (IsIPCConnected(p->Ipc)) - { - AddInterrupt(p->Ipc->Interrupt, p->NextEchoSendTime); - } - - pp = ZeroMalloc(sizeof(PPP_PACKET)); - pp->Protocol = PPP_PROTOCOL_LCP; - pp->IsControl = true; - pp->Lcp = NewPPPLCP(PPP_LCP_CODE_ECHO_REQUEST, 0); - - pp->Lcp->Data = Clone(echo_data, sizeof(echo_data)); - pp->Lcp->DataSize = sizeof(echo_data); - - if (!PPPSendPacketAndFree(p, pp)) - { - PPPSetStatus(p, PPP_STATUS_FAIL); - WHERE; - return false; - } - return true; - } - return false; -} - -// Processes response packets -bool PPPProcessResponsePacket(PPP_SESSION *p, PPP_PACKET *pp, PPP_PACKET *req) -{ - if (req == NULL) - { - Debug("We received a response for... What? We never sent this request, protocol = 0x%x, code = 0x%x\n", pp->Protocol, pp->Lcp->Code); - // Let's just discard this, as this was probably already parsed, and we just stumbled upon a resend - return false; - } - - switch (pp->Protocol) - { - case PPP_PROTOCOL_LCP: - return PPPProcessLCPResponsePacket(p, pp, req); - break; - case PPP_PROTOCOL_PAP: - Debug("Got a response PAP, which is invalid, we should get a request instead\n"); - PPPSetStatus(p, PPP_STATUS_FAIL); - WHERE; - return false; - break; - case PPP_PROTOCOL_CHAP: - return PPPProcessCHAPResponsePacket(p, pp, req); - break; - case PPP_PROTOCOL_IPCP: - return PPPProcessIPCPResponsePacket(p, pp, req); - break; - case PPP_PROTOCOL_IPV6CP: - return PPPProcessIPv6CPResponsePacket(p, pp, req); - break; - case PPP_PROTOCOL_EAP: - return PPPProcessEAPResponsePacket(p, pp, req); - break; - default: - Debug("We received a response for an unsupported protocol??? Should be filtered out already! protocol = 0x%x, code = 0x%x\n", pp->Protocol, pp->Lcp->Code); - PPPSetStatus(p, PPP_STATUS_FAIL); - WHERE; - return false; - } - - return false; -} - -bool PPPProcessLCPResponsePacket(PPP_SESSION *p, PPP_PACKET *pp, PPP_PACKET *req) -{ - UINT i; - bool isAccepted = !PPP_LCP_CODE_IS_NEGATIVE(pp->Lcp->Code); - bool result = true; - // MSCHAPv2 code - UCHAR ms_chap_v2_code[3]; - WRITE_USHORT(ms_chap_v2_code, PPP_LCP_AUTH_CHAP); - ms_chap_v2_code[2] = PPP_CHAP_ALG_MS_CHAP_V2; - - // We got one of rejects here, not NACKs - if (!isAccepted && pp->Lcp->Code == PPP_LCP_CODE_PROTOCOL_REJECT) - { - // If we receive a protocol reject before we finished authenticating - // probably means the PPP client is not compatible anyway so we fail the connection - if (p->PPPStatus != PPP_STATUS_NETWORK_LAYER) - { - USHORT *protocol = pp->Lcp->Data; - Debug("Protocol 0x%x rejected before auth, probably unsupported client, failing connection\n", *protocol); - PPPSetStatus(p, PPP_STATUS_FAIL); - WHERE; - return false; - } - else - { - USHORT *protocol = pp->Lcp->Data; - if (*protocol == PPP_PROTOCOL_IPCP || *protocol == PPP_PROTOCOL_IP) - { - IPC_PROTO_SET_STATUS(p->Ipc, IPv4State, IPC_PROTO_STATUS_REJECTED); - } - if (*protocol == PPP_PROTOCOL_IPV6CP || *protocol == PPP_PROTOCOL_IPV6) - { - IPC_PROTO_SET_STATUS(p->Ipc, IPv6State, IPC_PROTO_STATUS_REJECTED); - } - } - } - - if (!isAccepted && pp->Lcp->Code == PPP_LCP_CODE_CODE_REJECT) - { - PPPSetStatus(p, PPP_STATUS_FAIL); - WHERE; - return false; - } - - for (i = 0; i < LIST_NUM(pp->Lcp->OptionList); i++) - { - PPP_OPTION *t = LIST_DATA(pp->Lcp->OptionList, i); - PPP_OPTION *opt = NULL; - - switch (t->Type) - { - case PPP_LCP_OPTION_MRU: - // MRU - if (t->DataSize == sizeof(USHORT)) - { - USHORT value = READ_USHORT(t->Data); - if (!isAccepted) - { - if (pp->Lcp->Code != PPP_LCP_CODE_NAK) - { - Debug("MRU setup failed, rejected"); - p->Mru1 = p->Mru2 = PPP_MRU_DEFAULT; - } - if (value < PPP_MRU_MIN || value > PPP_MRU_MAX) - { - Debug("Couldn't agree on an MRU! Breaking link... MRU = 0x%x\n", value); - PPPSetStatus(p, PPP_STATUS_FAIL); - WHERE; - return false; - } - else - { - PPP_LCP *lcp = NewPPPLCP(PPP_LCP_CODE_REQ, 0); - Add(lcp->OptionList, NewPPPOption(PPP_LCP_OPTION_AUTH, &value, sizeof(USHORT))); - if (!PPPSendAndRetransmitRequest(p, PPP_PROTOCOL_LCP, lcp)) - { - PPPSetStatus(p, PPP_STATUS_FAIL); - WHERE; - return false; - } - Debug("PPP: Server got %u as MRU from NACK, re-requesting\n", p->Mru2); - } - } - else if (value < PPP_MRU_MIN || value > PPP_MRU_MAX) - { - Debug("The client somehow ACKed an invalid MRU, breaking link... MRU = 0x%x\n", value); - PPPSetStatus(p, PPP_STATUS_FAIL); - WHERE; - result = false; - } - else - { - p->Mru2 = value; - Debug("PPP: Server set %u as MRU\n", p->Mru2); - } - } - break; - case PPP_LCP_OPTION_AUTH: - opt = PPPGetOptionValue(req->Lcp, PPP_LCP_OPTION_AUTH); - if (opt == NULL) - { - Debug("We got some weird response with option absent in request, wut? Disconnecting\n"); - PPPSetStatus(p, PPP_STATUS_FAIL); - WHERE; - return false; - } - if (opt->DataSize == sizeof(USHORT) && *((USHORT *)(opt->Data)) == Endian16(PPP_LCP_AUTH_EAP)) - { - // Try to request MS-CHAPv2 then - if (!isAccepted) - { - UINT64 offer = 0; - PPP_LCP *c = NewPPPLCP(PPP_LCP_CODE_REQ, 0); - UCHAR ms_chap_v2_code[3]; - - WRITE_USHORT(ms_chap_v2_code, PPP_LCP_AUTH_CHAP); - ms_chap_v2_code[2] = PPP_CHAP_ALG_MS_CHAP_V2; - - Copy(&offer, ms_chap_v2_code, sizeof(ms_chap_v2_code)); - Debug("NACK proto with code = 0x%x, cypher = 0x%x, offered cypher = 0x%x\n", pp->Lcp->Code, *((USHORT *)(opt->Data)), offer); - Debug("Request MSCHAPv2\n"); - Add(c->OptionList, NewPPPOption(PPP_LCP_OPTION_AUTH, &ms_chap_v2_code, sizeof(ms_chap_v2_code))); - if (!PPPSendAndRetransmitRequest(p, PPP_PROTOCOL_LCP, c)) - { - PPPSetStatus(p, PPP_STATUS_FAIL); - WHERE; - return false; - } - } - else - { - p->AuthProtocol = PPP_PROTOCOL_EAP; - Debug("Setting BEFORE_AUTH from ACK on LCP response parse on EAP accept\n"); - PPPSetStatus(p, PPP_STATUS_BEFORE_AUTH); - } - } - else if (opt->DataSize == sizeof(ms_chap_v2_code) && Cmp(opt->Data, ms_chap_v2_code, opt->DataSize) == 0) - { - // Try to request PAP then - if (!isAccepted || !p->EnableMSCHAPv2) - { - UINT64 offer = 0; - PPP_LCP *c = NewPPPLCP(PPP_LCP_CODE_REQ, 0); - USHORT proto = Endian16(PPP_LCP_AUTH_PAP); - Copy(&offer, t->Data, t->DataSize > sizeof(UINT64) ? sizeof(UINT64) : t->DataSize); - Debug("NACK proto with code = 0x%x, cypher = 0x%x, offered cypher = 0x%x\n", pp->Lcp->Code, *((USHORT *)(opt->Data)), offer); - Debug("Request PAP\n"); - Add(c->OptionList, NewPPPOption(PPP_LCP_OPTION_AUTH, &proto, sizeof(USHORT))); - if (!PPPSendAndRetransmitRequest(p, PPP_PROTOCOL_LCP, c)) - { - PPPSetStatus(p, PPP_STATUS_FAIL); - WHERE; - return false; - } - } - else if (p->AuthProtocol == PPP_UNSPECIFIED) - { - p->AuthProtocol = PPP_PROTOCOL_CHAP; - Debug("Setting BEFORE_AUTH from ACK on LCP response parse on CHAP accept\n"); - PPPSetStatus(p, PPP_STATUS_BEFORE_AUTH); - } - - } - else if (opt->DataSize == sizeof(USHORT) && *((USHORT *)(opt->Data)) == Endian16(PPP_LCP_AUTH_PAP)) - { - // We couldn't agree on auth proto, failing connection - if (!isAccepted) - { - UINT64 offer = 0; - Copy(&offer, t->Data, t->DataSize > sizeof(UINT64) ? sizeof(UINT64) : t->DataSize); - Debug("NACK proto with code = 0x%x, cypher = 0x%x, offered cypher = 0x%x\n", pp->Lcp->Code, *((USHORT *)(opt->Data)), offer); - Debug("Couldn't agree on auth protocol!\n"); - PPPLog(p, "LP_PAP_MSCHAPV2_REJECTED"); - PPPSetStatus(p, PPP_STATUS_FAIL); - WHERE; - return false; - } - else if (p->AuthProtocol == PPP_UNSPECIFIED) - { - p->AuthProtocol = PPP_PROTOCOL_PAP; - Debug("Setting BEFORE_AUTH from ACK on LCP response parse on PAP accept\n"); - PPPSetStatus(p, PPP_STATUS_BEFORE_AUTH); - } - } - break; - } - } - - return result; -} - -// Process CHAP responses -bool PPPProcessCHAPResponsePacket(PPP_SESSION *p, PPP_PACKET *pp, PPP_PACKET *req) -{ - PPP_LCP *lcp; - if (pp->Lcp->Code == PPP_CHAP_CODE_RESPONSE) - { - bool ok = false; - if (p->PPPStatus != PPP_STATUS_AUTHENTICATING && !p->AuthOk) - { - Debug("Receiving CHAP response packets outside of auth status, some errors probably!"); - PPPSetStatus(p, PPP_STATUS_FAIL); - WHERE; - return false; - } - if (p->AuthProtocol != PPP_PROTOCOL_CHAP) - { - Debug("Receiving CHAP packet when auth protocol set to 0x%x\n", p->AuthProtocol); - PPPLog(p, "LP_NEXT_PROTOCOL_IS_NOT_PAP", pp->Protocol); - PPPRejectUnsupportedPacketEx(p, pp, true); - return false; - } - - ok = PPPParseMSCHAP2ResponsePacket(p, pp); - - // If we got only first packet of double CHAP then send second challenge - if (ok && p->MsChapV2_UseDoubleMsChapV2 && p->EapClient != NULL && p->Ipc == NULL) - { - lcp = BuildMSCHAP2ChallengePacket(p); - if (!PPPSendAndRetransmitRequest(p, PPP_PROTOCOL_CHAP, lcp)) - { - PPPSetStatus(p, PPP_STATUS_FAIL); - WHERE; - return false; - } - } - // We got a successful MSCHAPv2 response, so let's send a SUCCESS - else if (ok) - { - char hex[MAX_SIZE]; - char ret_str[MAX_SIZE]; - BUF *lcp_ret_data = NewBuf(); - PPP_PACKET *res = ZeroMalloc(sizeof(PPP_PACKET)); - BinToStr(hex, sizeof(hex), p->MsChapV2_ServerResponse, 20); - - Format(ret_str, sizeof(ret_str), - "S=%s", hex); - - WriteBuf(lcp_ret_data, ret_str, StrLen(ret_str)); - - lcp = NewPPPLCP(PPP_CHAP_CODE_SUCCESS, p->MsChapV2_PacketId); - lcp->Data = Clone(lcp_ret_data->Buf, lcp_ret_data->Size); - lcp->DataSize = lcp_ret_data->Size; - - if (lcp_ret_data != NULL) - { - FreeBuf(lcp_ret_data); - } - - res->Lcp = lcp; - res->IsControl = true; - res->Protocol = PPP_PROTOCOL_CHAP; - - if (!PPPSendPacketAndFree(p, res)) - { - PPPSetStatus(p, PPP_STATUS_FAIL); - WHERE; - return false; - } - - p->AuthOk = true; - PPPSetStatus(p, PPP_STATUS_AUTH_SUCCESS); - } - // We failed MSCHAPv2 auth - else - { - char hex[MAX_SIZE]; - char ret_str[MAX_SIZE]; - BUF *lcp_ret_data = NewBuf(); - PPP_PACKET *res = ZeroMalloc(sizeof(PPP_PACKET)); - - BinToStr(hex, sizeof(hex), p->MsChapV2_ServerChallenge, 16); - - Format(ret_str, sizeof(ret_str), - "E=%u R=0 C=%s V=3", p->MsChapV2_ErrorCode, hex); - - WriteBuf(lcp_ret_data, ret_str, StrLen(ret_str)); - - lcp = NewPPPLCP(PPP_CHAP_CODE_FAILURE, p->MsChapV2_PacketId); - lcp->Data = Clone(lcp_ret_data->Buf, lcp_ret_data->Size); - lcp->DataSize = lcp_ret_data->Size; - - if (lcp_ret_data != NULL) - { - FreeBuf(lcp_ret_data); - } - - res->Lcp = lcp; - res->IsControl = true; - res->Protocol = PPP_PROTOCOL_CHAP; - - if (!PPPSendPacketAndFree(p, res)) - { - PPPSetStatus(p, PPP_STATUS_FAIL); - WHERE; - return false; - } - - PPPLog(p, "LP_CHAP_FAILED"); - PPPSetStatus(p, PPP_STATUS_AUTH_FAIL); - } - - return ok; - } - return false; -} - -// Process IPCP responses -bool PPPProcessIPCPResponsePacket(PPP_SESSION *p, PPP_PACKET *pp, PPP_PACKET *req) -{ - bool isAccepted = !PPP_LCP_CODE_IS_NEGATIVE(pp->Lcp->Code); - - IP addrStruct; - char addrStr[MAX_SIZE]; - UINT addr; - IP prevAddrStruct; - char prevAddrStr[MAX_SIZE]; - UINT prevAddr; - PPP_LCP *c; - UINT ui; - - if (!PPPGetIPAddressValueFromLCP(pp->Lcp, PPP_IPCP_OPTION_IP, &addrStruct) || pp->Lcp->Code == PPP_LCP_CODE_REJECT || pp->Lcp->Code == PPP_LCP_CODE_CODE_REJECT) - { - Debug("Unsupported IPCP protocol"); - IPC_PROTO_SET_STATUS(p->Ipc, IPv4State, IPC_PROTO_STATUS_REJECTED); - PPPRejectUnsupportedPacketEx(p, pp, true); - return false; - } - - // We're dealing either with ACK or NACK - addr = IPToUINT(&addrStruct); - IPToStr(addrStr, MAX_SIZE, &addrStruct); - - if (isAccepted) - { - Debug("Accepted server IP address of %s\n", addrStr); - - // We already configured client address, now server address is also confirmed, ready for IPv4 data flow - if (IPC_PROTO_GET_STATUS(p->Ipc, IPv4State) == IPC_PROTO_STATUS_CONFIG) - { - IPC_PROTO_SET_STATUS(p->Ipc, IPv4State, IPC_PROTO_STATUS_CONFIG_WAIT); - } - return true; - } - - IPC_PROTO_SET_STATUS(p->Ipc, IPv4State, IPC_PROTO_STATUS_CONFIG); - - PPPGetIPAddressValueFromLCP(req->Lcp, PPP_IPCP_OPTION_IP, &prevAddrStruct); - prevAddr = IPToUINT(&prevAddrStruct); - IPToStr(prevAddrStr, MAX_SIZE, &prevAddrStruct); - - Debug("Denied server IP address %s, proposed %s\n", prevAddrStr, addrStr); - - // Fallback mechanism - just request 192.0.0.8 - if (prevAddr == Endian32(0xc0000008)) - { - Debug("We already tried the fallback IP of 192.0.0.8, giving up\n"); - IPC_PROTO_SET_STATUS(p->Ipc, IPv4State, IPC_PROTO_STATUS_REJECTED); - PPPRejectUnsupportedPacketEx(p, pp, true); - return false; - } - - c = NewPPPLCP(PPP_LCP_CODE_REQ, 0); - ui = Endian32(0xc0000008); // We always push 192.0.0.8, which is defined in RFC7600 as dummy IPv4 address. - Add(c->OptionList, NewPPPOption(PPP_IPCP_OPTION_IP, &ui, sizeof(UINT))); - if (!PPPSendAndRetransmitRequest(p, PPP_PROTOCOL_IPCP, c)) - { - PPPSetStatus(p, PPP_STATUS_FAIL); - WHERE; - return false; - } - - return false; -} - -// Process EAP responses -bool PPPProcessEAPResponsePacket(PPP_SESSION *p, PPP_PACKET *pp, PPP_PACKET *req) -{ - if (pp->Lcp->DataSize >= 1) - { - PPP_EAP *eap_packet = pp->Lcp->Data; - UINT eap_datasize = pp->Lcp->DataSize - 1; - UINT64 offer = 0; - PPP_LCP *c; - UCHAR ms_chap_v2_code[3]; - - WRITE_USHORT(ms_chap_v2_code, PPP_LCP_AUTH_CHAP); - ms_chap_v2_code[2] = PPP_CHAP_ALG_MS_CHAP_V2; - - switch (eap_packet->Type) - { - case PPP_EAP_TYPE_IDENTITY: - Copy(p->Eap_Identity, eap_packet->Data, MIN(MAX_SIZE, eap_datasize)); - // As we received the identity packet, we switch back to BEFORE_AUTH and switch to the EAP_TLS proto to send the TlsStart packet on the next tick - p->Eap_Protocol = PPP_EAP_TYPE_TLS; - PPPSetStatus(p, PPP_STATUS_BEFORE_AUTH); - break; - case PPP_EAP_TYPE_NOTIFICATION: - // Basically this is just an acknoweldgment that the notification was accepted by the client. Nothing to do here... - break; - case PPP_EAP_TYPE_NAK: - /// TODO: implement alternative EAP protocol selection based on received NAK - // For now just fallback to auth protocol selection to try to select MSCHAP or PAP - Debug("Got a EAP_NAK, abandoning EAP protocol\n"); - PPPRejectUnsupportedPacketEx(p, pp, true); - PPPSetStatus(p, PPP_STATUS_CONNECTED); - - c = NewPPPLCP(PPP_LCP_CODE_REQ, 0); - Copy(&offer, ms_chap_v2_code, sizeof(ms_chap_v2_code)); - Debug("Request MSCHAPv2 from EAP NAK\n"); - Add(c->OptionList, NewPPPOption(PPP_LCP_OPTION_AUTH, &ms_chap_v2_code, sizeof(ms_chap_v2_code))); - if (!PPPSendAndRetransmitRequest(p, PPP_PROTOCOL_LCP, c)) - { - PPPSetStatus(p, PPP_STATUS_FAIL); - WHERE; - return false; - } - break; - case PPP_EAP_TYPE_TLS: - PPPProcessEAPTlsResponse(p, eap_packet, eap_datasize); - break; - default: - Debug("We got an unexpected EAP response packet! Ignoring...\n"); - break; - } - } - else - { - PPP_EAP *eap; - - Debug("We got a CODE=%i ID=%i from client with zero size EAP structure, that shouldn't be happening!\n", pp->Lcp->Code, pp->Lcp->Id); - - eap = req->Lcp->Data; - if (eap->Type == PPP_EAP_TYPE_TLS) - { - PPP_LCP *lcp = BuildEAPTlsRequest(p->Eap_PacketId++, 0, PPP_EAP_TLS_FLAG_NONE); - if (!PPPSendAndRetransmitRequest(p, PPP_PROTOCOL_EAP, lcp)) - { - PPPSetStatus(p, PPP_STATUS_FAIL); - WHERE; - return false; - } - } - } - return false; -} - -// Process IPv6CP responses -bool PPPProcessIPv6CPResponsePacket(PPP_SESSION *p, PPP_PACKET *pp, PPP_PACKET *req) -{ - bool isAccepted = !PPP_LCP_CODE_IS_NEGATIVE(pp->Lcp->Code); - - // If we got a reject or a NACK, we just reject the whole IPv6 configuration, there is no way we can recover even from a NACK as we can't change the link-local address of an already existing router - if (!isAccepted) - { - Debug("Unsupported IPv6CP protocol"); - IPC_PROTO_SET_STATUS(p->Ipc, IPv6State, IPC_PROTO_STATUS_REJECTED); - PPPRejectUnsupportedPacketEx(p, pp, true); - return false; - } - - if (IPC_PROTO_GET_STATUS(p->Ipc, IPv6State) != IPC_PROTO_STATUS_CONFIG) - { - Debug("We got an early IPv6CP response, ignoring for now...\n"); - return false; - } - - Debug("Accepted server IPv6CP handshake\n"); - IPC_PROTO_SET_STATUS(p->Ipc, IPv6State, IPC_PROTO_STATUS_CONFIG_WAIT); - return true; -} - - -// Processes request packets -bool PPPProcessRequestPacket(PPP_SESSION *p, PPP_PACKET *pp) -{ - switch (pp->Protocol) - { - case PPP_PROTOCOL_LCP: - return PPPProcessLCPRequestPacket(p, pp); - break; - case PPP_PROTOCOL_PAP: - return PPPProcessPAPRequestPacket(p, pp); - break; - case PPP_PROTOCOL_CHAP: - Debug("Got a CHAP request, which is invalid, we should get CHAP response instead\n"); - PPPSetStatus(p, PPP_STATUS_FAIL); - WHERE; - return false; - break; - case PPP_PROTOCOL_IPCP: - return PPPProcessIPCPRequestPacket(p, pp); - break; - case PPP_PROTOCOL_IPV6CP: - return PPPProcessIPv6CPRequestPacket(p, pp); - break; - case PPP_PROTOCOL_EAP: - return PPPProcessEAPRequestPacket(p, pp); - break; - default: - Debug("Unsupported protocols should be already filtered out! protocol = 0x%x, code = 0x%x\n", pp->Protocol, pp->Lcp->Code); - return false; - break; - } - return false; -} - -bool PPPProcessLCPRequestPacket(PPP_SESSION *p, PPP_PACKET *pp) -{ - bool result = true; - UINT i = 0; - - USHORT NegotiatedAuthProto = PPP_UNSPECIFIED; - USHORT NegotiatedMRU = PPP_UNSPECIFIED; - // MSCHAPv2 code - UCHAR ms_chap_v2_code[3]; - USHORT eap_code = PPP_LCP_AUTH_EAP; - - WRITE_USHORT(ms_chap_v2_code, PPP_LCP_AUTH_CHAP); - ms_chap_v2_code[2] = PPP_CHAP_ALG_MS_CHAP_V2; - - Debug("Got LCP packet request ID=%i OptionsListSize=%i\n", pp->Lcp->Id, LIST_NUM(pp->Lcp->OptionList)); - - for (i = 0; i < LIST_NUM(pp->Lcp->OptionList); i++) - { - PPP_OPTION *t = LIST_DATA(pp->Lcp->OptionList, i); - - switch (t->Type) - { - case PPP_LCP_OPTION_AUTH: - t->IsSupported = true; - if (t->DataSize == sizeof(USHORT) && *((USHORT *)t->Data) == PPP_LCP_AUTH_EAP && p->AuthProtocol == PPP_UNSPECIFIED) - { - t->IsAccepted = true; - NegotiatedAuthProto = PPP_PROTOCOL_EAP; - } - else if (t->DataSize == sizeof(USHORT) && *((USHORT *)t->Data) == PPP_LCP_AUTH_PAP && p->AuthProtocol == PPP_UNSPECIFIED) - { - t->IsAccepted = true; - NegotiatedAuthProto = PPP_PROTOCOL_PAP; - } - else if (t->DataSize == sizeof(ms_chap_v2_code) && Cmp(t->Data, ms_chap_v2_code, t->DataSize) == 0 && p->AuthProtocol == PPP_UNSPECIFIED) - { - t->IsAccepted = true; - NegotiatedAuthProto = PPP_PROTOCOL_CHAP; - } - else - { - // We're recommending EAP by default as a more secure algo - t->IsAccepted = false; - t->AltDataSize = sizeof(eap_code); - Copy(t->AltData, &eap_code, sizeof(eap_code)); - } - break; - case PPP_LCP_OPTION_MRU: - t->IsSupported = true; - if (t->DataSize == sizeof(USHORT)) - { - USHORT value = READ_USHORT(t->Data); - if (value < PPP_MRU_MIN || value > PPP_MRU_MAX) - { - t->IsAccepted = false; - value = MAKESURE(value, PPP_MRU_MIN, PPP_MRU_MAX); - //Debug("MRU not accepted, sending NACK with value = 0x%x\n", value); - t->AltDataSize = sizeof(USHORT); - WRITE_USHORT(t->AltData, value); - } - else - { - t->IsAccepted = true; - NegotiatedMRU = value; - //Debug("MRU accepted, value = 0x%x\n", value); - } - } - else - { - t->IsAccepted = false; - t->AltDataSize = sizeof(USHORT); - WRITE_USHORT(t->AltData, PPP_MRU_DEFAULT); - } - break; - default: - t->IsSupported = false; - Debug("Unsupported LCP option = 0x%x\n", t->Type); - break; - } - } - - if (PPPRejectLCPOptions(p, pp)) - { - Debug("Rejected LCP options...\n"); - return false; - } - - if (PPPNackLCPOptions(p, pp)) - { - Debug("NACKed LCP options...\n"); - return false; - } - - if (!PPPAckLCPOptions(p, pp)) - { - return false; - } - - if (NegotiatedAuthProto != PPP_UNSPECIFIED) - { - if (p->AuthProtocol == PPP_UNSPECIFIED) - { - p->AuthProtocol = NegotiatedAuthProto; - PPPSetStatus(p, PPP_STATUS_BEFORE_AUTH); - Debug("Setting BEFORE_AUTH from REQ on LCP request parse\n"); - } - } - if (NegotiatedMRU != PPP_UNSPECIFIED) - { - p->Mru1 = NegotiatedMRU; - } - - return true; -} - -bool PPPProcessPAPRequestPacket(PPP_SESSION *p, PPP_PACKET *pp) -{ - if (p->PPPStatus != PPP_STATUS_BEFORE_AUTH && !p->AuthOk) - { - PPP_LCP *lcp = NewPPPLCP(PPP_PAP_CODE_NAK, pp->Lcp->Id); - PPP_PACKET *ret = ZeroMalloc(sizeof(PPP_PACKET)); - - Debug("Got a PAP request before we're ready for AUTH procedure!\n"); - - ret->IsControl = true; - ret->Protocol = PPP_PROTOCOL_PAP; - ret->Lcp = lcp; - if (!PPPSendPacketAndFree(p, ret)) - { - PPPSetStatus(p, PPP_STATUS_FAIL); - WHERE; - return false; - } - - return false; - } - if (p->AuthProtocol != PPP_PROTOCOL_PAP) - { - Debug("Trying to auth with PAP when should be 0x%x\n", p->AuthProtocol); - PPPLog(p, "LP_NEXT_PROTOCOL_IS_NOT_CHAP", pp->Protocol); - - // Forcing rejection of PAP on configured MSCHAPv2 - PPPRejectUnsupportedPacketEx(p, pp, true); - - return false; - } - if (!p->AuthOk) - { - UCHAR *data; - UINT size; - - PPPSetStatus(p, PPP_STATUS_AUTHENTICATING); - - if (p->Ipc == NULL) - { - // PAP - - // Extract the ID and the password - data = pp->Lcp->Data; - size = pp->Lcp->DataSize; - - if (size >= 1) - { - UCHAR len_id = data[0]; - data++; - size--; - - if (size >= len_id) - { - char username[256]; - char password[256]; - - Zero(username, sizeof(username)); - Zero(password, sizeof(password)); - - Copy(username, data, len_id); - data += len_id; - size -= len_id; - - if (size >= 1) - { - UCHAR len_pass = data[0]; - data++; - size--; - - if (size >= len_pass) - { - IPC *ipc; - char id[MAX_SIZE]; - char hub[MAX_SIZE]; - ETHERIP_ID d; - - Zero(id, sizeof(id)); - Zero(hub, sizeof(hub)); - - Copy(password, data, len_pass); - - Debug("PPP: id=%s, pw=%s\n", username, password); - - // The user name is divided into the ID and the virtual HUB name - Zero(&d, sizeof(d)); - PPPParseUsername(p->Cedar, username, &d); - - StrCpy(id, sizeof(id), d.UserName); - StrCpy(hub, sizeof(hub), d.HubName); - - if (IsEmptyStr(id) == false) - { - // Attempt to connect with IPC - UINT error_code; - - ipc = NewIPC(p->Cedar, p->ClientSoftwareName, p->Postfix, hub, id, password, - &error_code, &p->ClientIP, p->ClientPort, &p->ServerIP, p->ServerPort, - p->ClientHostname, p->CryptName, false, p->AdjustMss, NULL, NULL, - IPC_LAYER_3); - - if (ipc != NULL) - { - p->Ipc = ipc; - - // Setting user timeouts - p->PacketRecvTimeout = (UINT64)p->Ipc->Policy->TimeOut * 1000 * 3 / 4; // setting to 3/4 of the user timeout - p->DataTimeout = (UINT64)p->Ipc->Policy->TimeOut * 1000; - p->UserConnectionTimeout = (UINT64)p->Ipc->Policy->AutoDisconnect * 1000; - p->UserConnectionTick = Tick64(); - - p->AuthOk = true; - } - else - { - PPPSetStatus(p, PPP_STATUS_FAIL); - WHERE; - return false; - } - } - } - } - } - } - } - else - { - // Return success for a request from the second time when it is successfully authenticated once - p->AuthOk = true; - } - } - if (p->AuthOk) - { - PPP_LCP *lcp = NewPPPLCP(PPP_PAP_CODE_ACK, pp->Lcp->Id); - PPP_PACKET *ret = ZeroMalloc(sizeof(PPP_PACKET)); - ret->IsControl = true; - ret->Protocol = PPP_PROTOCOL_PAP; - ret->Lcp = lcp; - if (!PPPSendPacketAndFree(p, ret)) - { - PPPSetStatus(p, PPP_STATUS_FAIL); - WHERE; - return false; - } - - if (p->PPPStatus == PPP_STATUS_AUTHENTICATING) - { - PPPSetStatus(p, PPP_STATUS_AUTH_SUCCESS); - } - return true; - } - if (!p->AuthOk) - { - PPP_LCP *lcp = NewPPPLCP(PPP_PAP_CODE_NAK, pp->Lcp->Id); - PPP_PACKET *ret = ZeroMalloc(sizeof(PPP_PACKET)); - ret->IsControl = true; - ret->Protocol = PPP_PROTOCOL_PAP; - ret->Lcp = lcp; - if (!PPPSendPacketAndFree(p, ret)) - { - PPPSetStatus(p, PPP_STATUS_FAIL); - WHERE; - return false; - } - - if (p->PPPStatus == PPP_STATUS_AUTHENTICATING) - { - PPPSetStatus(p, PPP_STATUS_AUTH_FAIL); - PPPLog(p, "LP_PAP_FAILED"); - } - - return false; - } - return p->AuthOk; -} - - -bool PPPProcessIPCPRequestPacket(PPP_SESSION *p, PPP_PACKET *pp) -{ - PPP_IPOPTION o; - PPP_IPOPTION res; - PPP_OPTION *dummyIpOption; - UINT dummyIp = 0; - DHCP_OPTION_LIST cao; - IP client_ip; - IP subnet; - IP zero; - IP gw; - bool ok = true; - bool processed = false; - bool isEmptyIpAddress = false; - - if (IPC_PROTO_GET_STATUS(p->Ipc, IPv4State) == IPC_PROTO_STATUS_REJECTED) - { - Debug("We got an IPCP packet after we had it rejected\n"); - return PPPRejectUnsupportedPacketEx(p, pp, true); - } - - if (!PPPGetIPOptionFromLCP(&o, pp->Lcp)) - { - Debug("IPCP request without client IP address received! Treating as zeroed out client IP...\n"); - isEmptyIpAddress = true; - dummyIpOption = NewPPPOption(PPP_IPCP_OPTION_IP, &dummyIp, sizeof(UINT)); - dummyIpOption->IsSupported = true; - dummyIpOption->IsAccepted = false; - Add(pp->Lcp->OptionList, dummyIpOption); - } - - // Process if not configured yet by server - if ((IsZero(&p->ClientAddressOption, sizeof(DHCP_OPTION_LIST)) || isEmptyIpAddress) && ok) - { - // Decide if we received a static IP from client and it is allowed - if (IsZeroIP(&o.IpAddress) == false) - { - if (p->Ipc->Policy->DHCPForce == false) - { - if (p->DhcpAllocated == false) - { - if (p->UseStaticIPAddress == false) - { - DHCP_OPTION_LIST cao; - - // The client specify an IP address - Zero(&cao, sizeof(cao)); - - cao.ClientAddress = IPToUINT(&o.IpAddress); - - Copy(&p->ClientAddressOption, &cao, sizeof(cao)); - - p->UseStaticIPAddress = true; - } - } - } - } - else - { - p->UseStaticIPAddress = false; - } - - // Get additional information for static clients - if (p->UseStaticIPAddress) - { - if (p->DhcpIpInformTried == false) - { - // Get additional information such as the subnet mask from the DHCP server - SetIP(&subnet, 255, 0, 0, 0); - Zero(&zero, sizeof(zero)); - - UINTToIP(&client_ip, p->ClientAddressOption.ClientAddress); - - Zero(&cao, sizeof(cao)); - - IPCSetIPv4Parameters(p->Ipc, &client_ip, &subnet, &zero, NULL); - - p->DhcpIpInformTried = true; - - PPPLog(p, "LP_DHCP_INFORM_TRYING"); - - if (IPCDhcpRequestInformIP(p->Ipc, &cao, p->TubeRecv, &client_ip)) - { - Debug("IPCDhcpRequestInformIP ok.\n"); - Copy(&p->ClientAddressOption, &cao, sizeof(cao)); - p->ClientAddressOption.ClientAddress = IPToUINT(&client_ip); - - if (true) - { - char server_ip_str[64]; - char subnet_str[64], defgw_str[64]; - char dns1_str[64], dns2_str[64]; - char wins1_str[64], wins2_str[64]; - - IPToStr32(server_ip_str, sizeof(server_ip_str), cao.ServerAddress); - IPToStr32(subnet_str, sizeof(subnet_str), cao.SubnetMask); - IPToStr32(defgw_str, sizeof(defgw_str), cao.Gateway); - IPToStr32(dns1_str, sizeof(dns1_str), cao.DnsServer); - IPToStr32(dns2_str, sizeof(dns2_str), cao.DnsServer2); - IPToStr32(wins1_str, sizeof(wins1_str), cao.WinsServer); - IPToStr32(wins2_str, sizeof(wins2_str), cao.WinsServer2); - - PPPLog(p, "LP_DHCP_INFORM_OK", - subnet_str, defgw_str, cao.DomainName, - dns1_str, dns2_str, wins1_str, wins2_str, - server_ip_str); - } - } - else - { - Debug("IPCDhcpRequestInformIP failed.\n"); - ok = false; - p->DhcpIpInformTried = false; - PPPLog(p, "LP_DHCP_INFORM_NG"); - } - - IPCSetIPv4Parameters(p->Ipc, &zero, &zero, &zero, NULL); - } - } - // Get IP address and additional information from DHCP - else - { - if (p->DhcpIpAllocTried == false) - { - DHCP_OPTION_LIST cao; - - Zero(&cao, sizeof(cao)); - p->DhcpIpAllocTried = true; - - PPPLog(p, "LP_DHCP_REQUEST_TRYING"); - - if (IPCDhcpAllocateIP(p->Ipc, &cao, p->TubeRecv)) - { - UINT t; - - Debug("IPCDhcpAllocateIP ok.\n"); - - // IP address has been determined - Copy(&p->ClientAddressOption, &cao, sizeof(cao)); - - p->DhcpAllocated = true; - - // Determine the DHCP update interval - t = cao.LeaseTime; - if (t == 0) - { - t = 600; - } - - t = t / 3; - - if (t == 0) - { - t = 1; - } - - p->DhcpRenewInterval = (UINT64)t * (UINT64)1000; - p->DhcpNextRenewTime = Tick64() + p->DhcpRenewInterval; - - if (true) - { - char client_ip_str[64], server_ip_str[64]; - char subnet_str[64], defgw_str[64]; - char dns1_str[64], dns2_str[64]; - char wins1_str[64], wins2_str[64]; - - IPToStr32(client_ip_str, sizeof(client_ip_str), cao.ClientAddress); - IPToStr32(server_ip_str, sizeof(server_ip_str), cao.ServerAddress); - IPToStr32(subnet_str, sizeof(subnet_str), cao.SubnetMask); - IPToStr32(defgw_str, sizeof(defgw_str), cao.Gateway); - IPToStr32(dns1_str, sizeof(dns1_str), cao.DnsServer); - IPToStr32(dns2_str, sizeof(dns2_str), cao.DnsServer2); - IPToStr32(wins1_str, sizeof(wins1_str), cao.WinsServer); - IPToStr32(wins2_str, sizeof(wins2_str), cao.WinsServer2); - - PPPLog(p, "LP_DHCP_REQUEST_OK", - client_ip_str, subnet_str, defgw_str, cao.DomainName, - dns1_str, dns2_str, wins1_str, wins2_str, - server_ip_str, cao.LeaseTime); - } - } - else - { - Debug("IPCDhcpAllocateIP failed.\n"); - p->DhcpIpAllocTried = false; - ok = false; - PPPLog(p, "LP_DHCP_REQUEST_NG"); - } - } - } - } - - // If we already have a configured IP data - send it along - if (IsValidUnicastIPAddressUINT4(p->ClientAddressOption.ClientAddress) && - p->ClientAddressOption.SubnetMask != 0 && ok) - { - // Success to determine the address - UINTToIP(&subnet, p->ClientAddressOption.SubnetMask); - UINTToIP(&gw, p->ClientAddressOption.Gateway); - - Zero(&res, sizeof(res)); - UINTToIP(&res.IpAddress, p->ClientAddressOption.ClientAddress); - UINTToIP(&res.DnsServer1, p->ClientAddressOption.DnsServer); - UINTToIP(&res.DnsServer2, p->ClientAddressOption.DnsServer2); - UINTToIP(&res.WinsServer1, p->ClientAddressOption.WinsServer); - UINTToIP(&res.WinsServer2, p->ClientAddressOption.WinsServer2); - - if (IPCSetIPv4Parameters(p->Ipc, &res.IpAddress, &subnet, &gw, &p->ClientAddressOption.ClasslessRoute)) - { - char client_ip_str[64]; - char subnet_str[64], defgw_str[64]; - char dns1_str[64], dns2_str[64]; - char wins1_str[64], wins2_str[64]; - - // IPv4 parameters have been set for the first time - Debug("Param First Set.\n"); - - IPToStr(client_ip_str, sizeof(client_ip_str), &res.IpAddress); - IPToStr(subnet_str, sizeof(subnet_str), &subnet); - IPToStr(defgw_str, sizeof(defgw_str), &gw); - IPToStr(dns1_str, sizeof(dns1_str), &res.DnsServer1); - IPToStr(dns2_str, sizeof(dns2_str), &res.DnsServer2); - IPToStr(wins1_str, sizeof(wins1_str), &res.WinsServer1); - IPToStr(wins2_str, sizeof(wins2_str), &res.WinsServer2); - - PPPLog(p, "LP_SET_IPV4_PARAM", client_ip_str, subnet_str, - defgw_str, dns1_str, dns2_str, wins1_str, wins2_str); - } - - /*// Backporting static configuration received from client - let him use whatever he wants, - // he won't accept anything else anyway (as per testing with Windows clients) - if (!IsZeroIP(&o.DnsServer1)) - { - CopyIP(&res.DnsServer1, &o.DnsServer1); - Debug("Setting DNS1 from client\n"); - } - if (!IsZeroIP(&o.DnsServer2)) - { - CopyIP(&res.DnsServer2, &o.DnsServer2); - Debug("Setting DNS2 from client\n"); - } - if (!IsZeroIP(&o.WinsServer1)) - { - CopyIP(&res.WinsServer1, &o.WinsServer1); - Debug("Setting WINS1 from client\n"); - } - if (!IsZeroIP(&o.WinsServer2)) - { - CopyIP(&res.WinsServer2, &o.WinsServer2); - Debug("Setting WINS2 from client\n"); - }*/ - /*if (!IsZeroIP(&res.DnsServer1) && IsZeroIP(&res.DnsServer2)) - { - CopyIP(&res.DnsServer2, &res.DnsServer1); - } - if (!IsZeroIP(&res.WinsServer1) && IsZeroIP(&res.WinsServer2)) - { - CopyIP(&res.WinsServer2, &res.WinsServer1); - }*/ - PPPSetIPOptionToLCP(&res, pp->Lcp, true); - } - // We couldn't configure address for the client - else - { - // Failed to determine the address - Debug("IP Address Determination Failed.\n"); - - Zero(&res, sizeof(res)); - // We will try to reconfigure if we receive another request by wiping all data - Zero(&p->ClientAddressOption, sizeof(DHCP_OPTION_LIST)); - p->UseStaticIPAddress = false; - - PPPSetIPOptionToLCP(&res, pp->Lcp, true); - } - - if (PPPRejectLCPOptionsEx(p, pp, processed)) - { - Debug("Rejected IPCP options ID = 0x%x\n", pp->Lcp->Id); - processed = true; - } - - if (ok && PPPNackLCPOptionsEx(p, pp, processed)) - { - Debug("NACKed IPCP options ID = 0x%x\n", pp->Lcp->Id); - processed = true; - } - - // We will delay this packet ACK and send the server IP first, then wait for a reparse - // it is kind of dirty but fixes issues on some clients (namely VPN Client Pro on Android) - if (IPC_PROTO_GET_STATUS(p->Ipc, IPv4State) == IPC_PROTO_STATUS_CLOSED && p->ClientAddressOption.ServerAddress != 0 && ok) - { - PPP_LCP *c = NewPPPLCP(PPP_LCP_CODE_REQ, 0); - UINT ui = p->ClientAddressOption.ServerAddress; - Add(c->OptionList, NewPPPOption(PPP_IPCP_OPTION_IP, &ui, sizeof(UINT))); - if (!PPPSendAndRetransmitRequest(p, PPP_PROTOCOL_IPCP, c)) - { - PPPSetStatus(p, PPP_STATUS_FAIL); - WHERE; - return false; - } - IPC_PROTO_SET_STATUS(p->Ipc, IPv4State, IPC_PROTO_STATUS_CONFIG); - if (!processed) - { - PPPAddNextPacket(p, pp, 1); - } - return false; - } - - // We still haven't received any answer from client about server IP, keep waiting... - if ((IPC_PROTO_GET_STATUS(p->Ipc, IPv4State) == IPC_PROTO_STATUS_CONFIG || - IPC_PROTO_GET_STATUS(p->Ipc, IPv4State) == IPC_PROTO_STATUS_CLOSED) && !processed) - { - PPPAddNextPacket(p, pp, 1); - return false; - } - - //Debug("PPPAckLCPOptionsEx ok=%x, processed=%x", ok, processed); - if (!ok || !PPPAckLCPOptionsEx(p, pp, processed)) - { - return false; - } - Debug("ACKed IPCP options ID = 0x%x\n", pp->Lcp->Id); - - if (ok && IPC_PROTO_GET_STATUS(p->Ipc, IPv4State) == IPC_PROTO_STATUS_CONFIG_WAIT) - { - IPC_PROTO_SET_STATUS(p->Ipc, IPv4State, IPC_PROTO_STATUS_OPENED); - Debug("IPv4 OPENED\n"); - } - return ok; -} - -// Process EAP request packets -bool PPPProcessEAPRequestPacket(PPP_SESSION *p, PPP_PACKET *pp) -{ - Debug("We got an EAP request, which is weird...\n"); - return false; -} - -// Process IPv6CP request packets -bool PPPProcessIPv6CPRequestPacket(PPP_SESSION *p, PPP_PACKET *pp) -{ - UINT i; - bool processed = false; - if (IPC_PROTO_GET_STATUS(p->Ipc, IPv6State) == IPC_PROTO_STATUS_REJECTED) - { - Debug("We got an IPv6CP packet after we had it rejected\n"); - return PPPRejectUnsupportedPacketEx(p, pp, true); - } - - for (i = 0; i < LIST_NUM(pp->Lcp->OptionList); i++) - { - PPP_OPTION *t = LIST_DATA(pp->Lcp->OptionList, i); - - switch (t->Type) - { - case PPP_IPV6CP_OPTION_EUI: - t->IsSupported = true; - if (t->DataSize == sizeof(UINT64)) - { - UINT64 newValue = 0; - UINT64 value = READ_UINT64(t->Data); - if (value != 0 && !IPCIPv6CheckExistingLinkLocal(p->Ipc, value)) - { - t->IsAccepted = true; - p->Ipc->IPv6ClientEUI = value; - } - else - { - t->IsAccepted = false; - GenerateEui64Address6((UCHAR *)&newValue, p->Ipc->MacAddress); - if (newValue != value && !IPCIPv6CheckExistingLinkLocal(p->Ipc, newValue)) - { - WRITE_UINT64(t->AltData, newValue); - t->AltDataSize = sizeof(UINT64); - } - else - { - while (true) - { - newValue = Rand64(); - if (!IPCIPv6CheckExistingLinkLocal(p->Ipc, newValue)) - { - WRITE_UINT64(t->AltData, newValue); - t->AltDataSize = sizeof(UINT64); - break; - } - } - } - } - } - break; - default: - t->IsSupported = false; - break; - } - } - - if (PPPRejectLCPOptionsEx(p, pp, processed)) - { - Debug("Rejected IPv6CP options ID = 0x%x\n", pp->Lcp->Id); - processed = true; - } - - if (PPPNackLCPOptionsEx(p, pp, processed)) - { - Debug("NACKed IPv6CP options ID = 0x%x\n", pp->Lcp->Id); - processed = true; - } - - if (p->Ipc->IPv6ClientEUI != 0 && IPC_PROTO_GET_STATUS(p->Ipc, IPv6State) == IPC_PROTO_STATUS_CLOSED) - { - PPP_LCP *c = NewPPPLCP(PPP_LCP_CODE_REQ, 0); - UINT64 serverEui = IPCIPv6GetServerEui(p->Ipc); - if (serverEui != 0 && serverEui != p->Ipc->IPv6ClientEUI) - { - Add(c->OptionList, NewPPPOption(PPP_IPV6CP_OPTION_EUI, &serverEui, sizeof(UINT64))); - } - if (!PPPSendAndRetransmitRequest(p, PPP_PROTOCOL_IPV6CP, c)) - { - PPPSetStatus(p, PPP_STATUS_FAIL); - WHERE; - return false; - } - - IPC_PROTO_SET_STATUS(p->Ipc, IPv6State, IPC_PROTO_STATUS_CONFIG); - } - - if (IPC_PROTO_GET_STATUS(p->Ipc, IPv6State) == IPC_PROTO_STATUS_CONFIG && !processed) - { - PPPAddNextPacket(p, pp, 1); - return false; - } - - if (!PPPAckLCPOptionsEx(p, pp, processed)) - { - return false; - } - Debug("ACKed IPv6CP options ID = 0x%x\n", pp->Lcp->Id); - - if (IPC_PROTO_GET_STATUS(p->Ipc, IPv6State) == IPC_PROTO_STATUS_CONFIG_WAIT) - { - IPC_PROTO_SET_STATUS(p->Ipc, IPv6State, IPC_PROTO_STATUS_OPENED); - Debug("IPv6 OPENED\n"); - } - - return true; -} - -// LCP option based packets utility -bool PPPRejectLCPOptions(PPP_SESSION *p, PPP_PACKET *pp) -{ - return PPPRejectLCPOptionsEx(p, pp, false); -} -bool PPPRejectLCPOptionsEx(PPP_SESSION *p, PPP_PACKET *pp, bool simulate) -{ - UINT i = 0; - bool toBeRejected = false; - PPP_PACKET *ret; - for (i = 0; i < LIST_NUM(pp->Lcp->OptionList); i++) - { - PPP_OPTION *t = LIST_DATA(pp->Lcp->OptionList, i); - - if (t->IsSupported == false) - { - toBeRejected = true; - break; - } - } - - if (toBeRejected == false) - { - return false; - } - - ret = ZeroMalloc(sizeof(PPP_PACKET)); - ret->IsControl = true; - ret->Protocol = pp->Protocol; - // Return a Reject if there are unsupported parameters - ret->Lcp = NewPPPLCP(PPP_LCP_CODE_REJECT, pp->Lcp->Id); - - for (i = 0; i < LIST_NUM(pp->Lcp->OptionList); i++) - { - PPP_OPTION *t = LIST_DATA(pp->Lcp->OptionList, i); - - if (t->IsSupported == false) - { - // Attach the original option value as is - Add(ret->Lcp->OptionList, NewPPPOption(t->Type, t->Data, t->DataSize)); - Debug("Rejected LCP option = 0x%x, proto = 0x%x\n", t->Type, pp->Protocol); - } - } - - if (LIST_NUM(ret->Lcp->OptionList) == 0 || simulate) - { - FreePPPPacket(ret); - return false; - } - - PPPSendPacketAndFree(p, ret); - return true; -} -bool PPPNackLCPOptions(PPP_SESSION *p, PPP_PACKET *pp) -{ - return PPPNackLCPOptionsEx(p, pp, false); -} -bool PPPNackLCPOptionsEx(PPP_SESSION *p, PPP_PACKET *pp, bool simulate) -{ - UINT i = 0; - PPP_PACKET *ret; - bool toBeNACKed = false; - for (i = 0; i < LIST_NUM(pp->Lcp->OptionList); i++) - { - PPP_OPTION *t = LIST_DATA(pp->Lcp->OptionList, i); - - if (t->IsAccepted == false && t->IsSupported == true) - { - toBeNACKed = true; - break; - } - } - - if (toBeNACKed == false) - { - return false; - } - - ret = ZeroMalloc(sizeof(PPP_PACKET)); - ret->IsControl = true; - ret->Protocol = pp->Protocol; - // Return a NAK if there are any unacceptable parameter - // even that all parameters are supported - ret->Lcp = NewPPPLCP(PPP_LCP_CODE_NAK, pp->Lcp->Id); - - for (i = 0; i < LIST_NUM(pp->Lcp->OptionList); i++) - { - PPP_OPTION *t = LIST_DATA(pp->Lcp->OptionList, i); - - if (t->IsAccepted == false && t->IsSupported == true) - { - // Replace the original option value with an acceptable value - Add(ret->Lcp->OptionList, NewPPPOption(t->Type, t->AltData, t->AltDataSize)); - Debug("NACKed LCP option = 0x%x, proto = 0x%x\n", t->Type, pp->Protocol); - } - } - - if (LIST_NUM(ret->Lcp->OptionList) == 0 || simulate) - { - FreePPPPacket(ret); - return false; - } - - PPPSendPacketAndFree(p, ret); - return true; -} -bool PPPAckLCPOptions(PPP_SESSION *p, PPP_PACKET *pp) -{ - return PPPAckLCPOptionsEx(p, pp, false); -} -bool PPPAckLCPOptionsEx(PPP_SESSION *p, PPP_PACKET *pp, bool simulate) -{ - UINT i = 0; - PPP_PACKET *ret; - bool toBeACKed = false; - if (LIST_NUM(pp->Lcp->OptionList) == 0) - { - // We acknoweldge an empty option list - toBeACKed = true; - Debug("ACKing empty LCP options list, id=%i\n", pp->Lcp->Id); - } - for (i = 0; i < LIST_NUM(pp->Lcp->OptionList); i++) - { - PPP_OPTION *t = LIST_DATA(pp->Lcp->OptionList, i); - - if (t->IsAccepted == true && t->IsSupported == true) - { - toBeACKed = true; - break; - } - } - - if (toBeACKed == false) - { - return false; - } - - ret = ZeroMalloc(sizeof(PPP_PACKET)); - ret->IsControl = true; - ret->Protocol = pp->Protocol; - // Return an ACK if all parameters are accepted - ret->Lcp = NewPPPLCP(PPP_LCP_CODE_ACK, pp->Lcp->Id); - - for (i = 0; i < LIST_NUM(pp->Lcp->OptionList); i++) - { - PPP_OPTION *t = LIST_DATA(pp->Lcp->OptionList, i); - - if (t->IsAccepted == true && t->IsSupported == true) - { - // Attach the original option value as is - Add(ret->Lcp->OptionList, NewPPPOption(t->Type, t->Data, t->DataSize)); - Debug("ACKed LCP option = 0x%x, proto = 0x%x\n", t->Type, pp->Protocol); - } - } - - if (simulate) - { - FreePPPPacket(ret); - return false; - } - - PPPSendPacketAndFree(p, ret); - return true; -} - -// PPP networking functions -// Send a request packet in the PPP -bool PPPSendAndRetransmitRequest(PPP_SESSION *p, USHORT protocol, PPP_LCP *c) -{ - PPP_PACKET *pp; - UINT64 now = Tick64(); - PPP_REQUEST_RESEND *resend; - - // Validate arguments - if (p == NULL || c == NULL) - { - return false; - } - - pp = ZeroMalloc(sizeof(PPP_PACKET)); - pp->Protocol = protocol; - pp->IsControl = true; - pp->Lcp = c; - if (pp->Lcp->Id == 0) - { - pp->Lcp->Id = p->NextId++; - } - - // Send the PPP packet - if (!PPPSendPacketEx(p, pp, false)) - { - PPPSetStatus(p, PPP_STATUS_FAIL); - WHERE; - return false; - } - - resend = ZeroMalloc(sizeof(PPP_REQUEST_RESEND)); - resend->Id = pp->Lcp->Id; - resend->Packet = pp; - resend->ResendTime = now + PPP_PACKET_RESEND_INTERVAL; - resend->TimeoutTime = now + p->PacketRecvTimeout; - - Add(p->SentReqPacketList, resend); - - return true; -} -// Send the PPP packet and frees the sent packet -bool PPPSendPacketAndFree(PPP_SESSION *p, PPP_PACKET *pp) -{ - bool result = PPPSendPacketEx(p, pp, false); - FreePPPPacket(pp); - return result; -} -// Send the PPP packet -bool PPPSendPacketEx(PPP_SESSION *p, PPP_PACKET *pp, bool no_flush) -{ - bool ret = false; - BUF *b; - // Validate arguments - if (p == NULL || pp == NULL) - { - return false; - } - - b = BuildPPPPacketData(pp); - if (b == NULL) - { - return false; - } - - ret = TubeSendEx(p->TubeSend, b->Buf, b->Size, NULL, no_flush); - - if (no_flush) - { - AddTubeToFlushList(p->FlushList, p->TubeSend); - } - - FreeBuf(b); - - return ret; -} - -// Receive a PPP packet -PPP_PACKET *PPPRecvPacket(PPP_SESSION *p, bool async) -{ - TUBEDATA *d; - PPP_PACKET *pp; - // Validate arguments - if (p == NULL) - { - return NULL; - } - -LABEL_LOOP: - - if (async == false) - { - d = TubeRecvSync(p->TubeRecv, (UINT)p->PacketRecvTimeout); - } - else - { - d = TubeRecvAsync(p->TubeRecv); - } - - if (d == NULL) - { - return NULL; - } - - pp = ParsePPPPacket(d->Data, d->DataSize); - FreeTubeData(d); - - if (pp == NULL) - { - // A broken packet is received - goto LABEL_LOOP; - } - - p->LastRecvTime = Tick64(); - - return pp; -} - -PPP_PACKET *PPPGetNextPacket(PPP_SESSION *p) -{ - PPP_PACKET *ret = NULL; - UINT i = 0; - if (p->CurrentPacket != NULL) - { - FreePPPPacket(p->CurrentPacket); - p->CurrentPacket = NULL; - } - for (i = 0; i < LIST_NUM(p->DelayedPackets); i++) - { - PPP_DELAYED_PACKET *t = LIST_DATA(p->DelayedPackets, i); - if (t->DelayTicks > 0) - { - t->DelayTicks--; - } - else - { - ret = t->Packet; - Delete(p->DelayedPackets, t); - Free(t); - break; - } - } - - if (ret != NULL) - { - p->CurrentPacket = ret; - return ret; - } - - ret = PPPRecvPacket(p, true); - - if (ret != NULL && ret->IsControl && ret->Lcp != NULL) - { - PPP_DELAYED_PACKET *firstRelated = NULL; - for (i = 0; i < LIST_NUM(p->DelayedPackets); i++) - { - PPP_DELAYED_PACKET *t = LIST_DATA(p->DelayedPackets, i); - char related = PPPRelatedPacketComparator(ret, t->Packet); - if (related != 0xF && related != 0xE) - { - if (related == 0) - { - // It's the same packet, just remove it and wait for it's delays - FreePPPPacket(ret); - firstRelated = NULL; - ret = NULL; - break; - } - if (related == 1) - { - // We got a packet which should come later than any of delayed ones - PPPAddNextPacket(p, ret, t->DelayTicks); - firstRelated = NULL; - ret = NULL; - break; - } - if (related == -1) - { - char prevFoundRelated = -1; - if (firstRelated != NULL) - { - prevFoundRelated = PPPRelatedPacketComparator(t->Packet, firstRelated->Packet); - } - if (prevFoundRelated == -1) - { - firstRelated = t; - } - } - } - } - - if (firstRelated != NULL) - { - PPPAddNextPacket(p, ret, firstRelated->DelayTicks); - ret = NULL; - } - } - - p->CurrentPacket = ret; - return ret; -} - -void PPPAddNextPacket(PPP_SESSION *p, PPP_PACKET *pp, UINT delay) -{ - PPP_DELAYED_PACKET *t = ZeroMalloc(sizeof(PPP_DELAYED_PACKET)); - if (p->CurrentPacket == pp) - { - p->CurrentPacket = NULL; - } - t->Packet = pp; - t->DelayTicks = delay; - Add(p->DelayedPackets, t); - Sort(p->DelayedPackets); - /*Debug("after sorting delayeds\n"); - for (i = 0; i < LIST_NUM(p->DelayedPackets); i++) - { - t = LIST_DATA(p->DelayedPackets, i); - if (t->Packet->Lcp != NULL) - { - Debug("> Packet proto = 0x%x, id = 0x%x, code = 0x%x, delay = 0x%x\n", t->Packet->Protocol, t->Packet->Lcp->Id, t->Packet->Lcp->Code, t->DelayTicks); - } - } - Debug("after sorting delayeds end\n");*/ -} - -int PPPDelayedPacketsComparator(void *a, void *b) -{ - PPP_DELAYED_PACKET *first = a; - PPP_DELAYED_PACKET *second = b; - - char related = PPPRelatedPacketComparator(first->Packet, second->Packet); - - if (related == 0xF || related == 0xE) - { - if (first->DelayTicks < second->DelayTicks) - { - return -1; - } - if (first->DelayTicks > second->DelayTicks) - { - return 1; - } - return 0; - } - - // We make all delay ticks to be accounted with the sorting - if (related <= 1 && related >= -1) - { - if (related == -1 && first->DelayTicks >= second->DelayTicks) - { - second->DelayTicks = first->DelayTicks; - second->DelayTicks++; - } - else if (related == 1 && first->DelayTicks <= second->DelayTicks) - { - first->DelayTicks = second->DelayTicks; - first->DelayTicks++; - } - return related; - } - return 0; -} - -// -1 - packet a comes before packet b -// 0 - this is the same packet -// 1 - packet a comes after packet b -// 0xF - packet is not related -// 0xE - we got an error while comparing, treating as not related would be the most correct -char PPPRelatedPacketComparator(PPP_PACKET *a, PPP_PACKET *b) -{ - if (a->IsControl && b->IsControl && - a->Lcp != NULL && b->Lcp != NULL && - a->Protocol == b->Protocol && - PPP_CODE_IS_REQUEST(a->Protocol, a->Lcp->Code) == PPP_CODE_IS_REQUEST(b->Protocol, b->Lcp->Code) && - PPP_CODE_IS_RESPONSE(a->Protocol, a->Lcp->Code) == PPP_CODE_IS_RESPONSE(b->Protocol, b->Lcp->Code)) - { - // The packet is related! - if (a->Lcp->Id < b->Lcp->Id) - { - return -1; - } - else if (a->Lcp->Id == b->Lcp->Id) - { - if (a->Lcp->Code == b->Lcp->Code) - { - return 0; - } - else - { - return 0xE; - } - } - else if (a->Lcp->Id > b->Lcp->Id) - { - return 1; - } - else - { - return 0xE; - } - } - else - { - // The packet is not related! - return 0xF; - } -} - -// PPP utility functions -// Packet structure creation utilities - -// Create the LCP -PPP_LCP *NewPPPLCP(UCHAR code, UCHAR id) -{ - PPP_LCP *c = ZeroMalloc(sizeof(PPP_LCP)); - - c->Code = code; - c->Id = id; - c->OptionList = NewListFast(NULL); - - return c; -} - -// Create a new PPP options -PPP_OPTION *NewPPPOption(UCHAR type, void *data, UINT size) -{ - PPP_OPTION *o; - // Validate arguments - if (size != 0 && data == NULL) - { - return NULL; - } - - o = ZeroMalloc(sizeof(PPP_OPTION)); - - o->Type = type; - Copy(o->Data, data, size); - o->DataSize = size; - - return o; -} - -// Packet parse utilities - -// Analyse the PPP packet -PPP_PACKET *ParsePPPPacket(void *data, UINT size) -{ - PPP_PACKET *pp; - UCHAR *buf; - // Validate arguments - if (data == NULL || size == 0) - { - return NULL; - } - - pp = ZeroMalloc(sizeof(PPP_PACKET)); - - buf = (UCHAR *)data; - - // Address - if (buf[0] != 0xff) - { - goto LABEL_ERROR; - } - size--; - buf++; - - // Control - if (size < 1) - { - goto LABEL_ERROR; - } - if (buf[0] != 0x03) - { - goto LABEL_ERROR; - } - size--; - buf++; - - // Protocol - if (size < 2) - { - goto LABEL_ERROR; - } - pp->Protocol = READ_USHORT(buf); - - size -= 2; - buf += 2; - - if (pp->Protocol == PPP_PROTOCOL_LCP || pp->Protocol == PPP_PROTOCOL_PAP || pp->Protocol == PPP_PROTOCOL_CHAP || pp->Protocol == PPP_PROTOCOL_IPCP || pp->Protocol == PPP_PROTOCOL_IPV6CP || pp->Protocol == PPP_PROTOCOL_EAP) - { - pp->IsControl = true; - } - - pp->Data = Clone(buf, size); - pp->DataSize = size; - - if (pp->IsControl) - { - pp->Lcp = PPPParseLCP(pp->Protocol, pp->Data, pp->DataSize); - if (pp->Lcp == NULL) - { - goto LABEL_ERROR; - } - } - - return pp; - -LABEL_ERROR: - FreePPPPacket(pp); - return NULL; -} - -// Analyse the LCP data -PPP_LCP *PPPParseLCP(USHORT protocol, void *data, UINT size) -{ - UCHAR *buf; - PPP_LCP *c; - USHORT len; - bool has_option_list = false; - // Validate arguments - if (data == NULL || size == 0) - { - return NULL; - } - - buf = (UCHAR *)data; - c = ZeroMalloc(sizeof(PPP_LCP)); - - c->OptionList = NewListFast(NULL); - - // Code - if (size < 1) - { - goto LABEL_ERROR; - } - c->Code = buf[0]; - buf++; - size--; - - // ID - if (size < 1) - { - goto LABEL_ERROR; - } - c->Id = buf[0]; - buf++; - size--; - - // Length - if (size < 2) - { - goto LABEL_ERROR; - } - len = READ_USHORT(buf); - if (len < 4) - { - goto LABEL_ERROR; - } - len -= 4; - buf += 2; - size -= 2; - - // Options or Data - if (size < len) - { - goto LABEL_ERROR; - } - - has_option_list = PPP_CODE_IS_WITH_OPTION_LIST(protocol, c->Code); - - if (has_option_list == false) - { - c->Data = Clone(buf, size); - c->DataSize = size; - } - else - { - // Option List - while (len >= 1) - { - PPP_OPTION o; - - Zero(&o, sizeof(o)); - - // Type - if (len < 1) - { - goto LABEL_ERROR; - } - o.Type = buf[0]; - buf++; - len--; - - // Length - if (len < 1) - { - goto LABEL_ERROR; - } - o.DataSize = buf[0]; - if (o.DataSize < 2) - { - goto LABEL_ERROR; - } - o.DataSize -= 2; - buf++; - len--; - - // Data - if (len < o.DataSize) - { - goto LABEL_ERROR; - } - Copy(o.Data, buf, o.DataSize); - buf += o.DataSize; - len -= o.DataSize; - - Add(c->OptionList, Clone(&o, sizeof(o))); - } - } - - return c; - -LABEL_ERROR: - FreePPPLCP(c); - return NULL; -} - -// Analyse MS CHAP v2 Response packet -bool PPPParseMSCHAP2ResponsePacket(PPP_SESSION *p, PPP_PACKET *pp) -{ - bool ok = false; - - char client_ip_tmp[256]; - EAP_CLIENT *eap; - - UCHAR client_response_buffer[49]; - UCHAR *client_challenge_16; - UCHAR *client_response_24; - char username_tmp[MAX_SIZE]; - IPC *ipc = NULL; - char id[MAX_SIZE]; - char hub[MAX_SIZE]; - char password[MAX_SIZE]; - char server_challenge_hex[MAX_SIZE]; - char client_challenge_hex[MAX_SIZE]; - char client_response_hex[MAX_SIZE]; - char eap_client_hex[64]; - ETHERIP_ID d; - UINT error_code; - UINT64 eap_client_ptr = (UINT64)p->EapClient; - - if (pp->Lcp != NULL && pp->Lcp->DataSize >= 51) - { - BUF *b; - if (pp->Lcp->Id != p->MsChapV2_PacketId) - { - Debug("Got incorrect LCP PacketId! Should be 0x%x, got 0x%x\n", p->MsChapV2_PacketId, pp->Lcp->Id); - p->MsChapV2_PacketId = pp->Lcp->Id; - } - - b = NewBuf(); - - WriteBuf(b, pp->Lcp->Data, pp->Lcp->DataSize); - SeekBuf(b, 0, 0); - - if (ReadBufChar(b) == 49) - { - ReadBuf(b, client_response_buffer, 49); - - Zero(username_tmp, sizeof(username_tmp)); - ReadBuf(b, username_tmp, sizeof(username_tmp) - 1); - Debug("MS-CHAPv2: id=%s\n", username_tmp); - - client_challenge_16 = client_response_buffer + 0; - client_response_24 = client_response_buffer + 16 + 8; - - Copy(p->MsChapV2_ClientChallenge, client_challenge_16, 16); - Copy(p->MsChapV2_ClientResponse, client_response_24, 24); - - Zero(id, sizeof(id)); - Zero(hub, sizeof(hub)); - - // The user name is divided into the ID and the virtual HUB name - Zero(&d, sizeof(d)); - PPPParseUsername(p->Cedar, username_tmp, &d); - - StrCpy(id, sizeof(id), d.UserName); - StrCpy(hub, sizeof(hub), d.HubName); - Debug("MS-CHAPv2: username=%s, hubname=%s\n", id, hub); - - IPToStr(client_ip_tmp, sizeof(client_ip_tmp), &p->ClientIP); - - // Convert the MS-CHAPv2 data to a password string - BinToStr(server_challenge_hex, sizeof(server_challenge_hex), - p->MsChapV2_ServerChallenge, sizeof(p->MsChapV2_ServerChallenge)); - BinToStr(client_challenge_hex, sizeof(client_challenge_hex), - p->MsChapV2_ClientChallenge, sizeof(p->MsChapV2_ClientChallenge)); - BinToStr(client_response_hex, sizeof(client_response_hex), - p->MsChapV2_ClientResponse, sizeof(p->MsChapV2_ClientResponse)); - BinToStr(eap_client_hex, sizeof(eap_client_hex), - &eap_client_ptr, 8); - - Format(password, sizeof(password), "%s%s:%s:%s:%s:%s", - IPC_PASSWORD_MSCHAPV2_TAG, - username_tmp, - server_challenge_hex, - client_challenge_hex, - client_response_hex, - eap_client_hex); - - if (p->MsChapV2_UseDoubleMsChapV2 && p->EapClient == NULL) - { - Debug("Double MSCHAPv2 creating EAP client\n"); - eap = HubNewEapClient(p->Cedar, hub, client_ip_tmp, id, "L3:PPP"); - - if (eap) - { - ok = true; - p->EapClient = eap; - } - else - { - PPPSetStatus(p, PPP_STATUS_FAIL); - WHERE; - return false; - } - } - else if (p->Ipc == NULL) - { - Debug("MSCHAPv2 creating IPC\n"); - ipc = NewIPC(p->Cedar, p->ClientSoftwareName, p->Postfix, hub, id, password, - &error_code, &p->ClientIP, p->ClientPort, &p->ServerIP, p->ServerPort, - p->ClientHostname, p->CryptName, false, p->AdjustMss, p->EapClient, NULL, - + IPC_LAYER_3); - - if (ipc != NULL) - { - p->Ipc = ipc; - - // Setting user timeouts - p->PacketRecvTimeout = (UINT64)p->Ipc->Policy->TimeOut * 1000 * 3 / 4; // setting to 3/4 of the user timeout - p->DataTimeout = (UINT64)p->Ipc->Policy->TimeOut * 1000; - p->UserConnectionTimeout = (UINT64)p->Ipc->Policy->AutoDisconnect * 1000; - p->UserConnectionTick = Tick64(); - - Copy(p->MsChapV2_ServerResponse, ipc->MsChapV2_ServerResponse, 20); - - ok = true; - - p->AuthOk = true; - } - } - else - { - Debug("Got weird packet when we already have an active IPC! Ipc = 0x%x, AuthOk = 0x%x, Status = 0x%x\n", p->Ipc, p->AuthOk, p->PPPStatus); - ok = p->AuthOk; - } - } - - FreeBuf(b); - } - else - { - Debug("Got invalid MSCHAPv2 packet\n"); - } - - return ok; -} - -// Packet building utilities - -// Build a PPP packet data -BUF *BuildPPPPacketData(PPP_PACKET *pp) -{ - BUF *ret; - UCHAR c; - USHORT us; - // Validate arguments - if (pp == NULL) - { - return NULL; - } - - ret = NewBuf(); - - // Address - c = 0xff; - WriteBuf(ret, &c, 1); - - // Control - c = 0x03; - WriteBuf(ret, &c, 1); - - // Protocol - us = Endian16(pp->Protocol); - WriteBuf(ret, &us, 2); - - if (pp->IsControl) - { - // LCP - BUF *b = BuildLCPData(pp->Lcp); - - WriteBufBuf(ret, b); - - FreeBuf(b); - } - else - { - // Data - WriteBuf(ret, pp->Data, pp->DataSize); - } - - SeekBuf(ret, 0, 0); - - return ret; -} - -// Build the LCP packet data -BUF *BuildLCPData(PPP_LCP *c) -{ - BUF *b; - UCHAR zero = 0; - UINT i; - // Validate arguments - if (c == NULL) - { - return NULL; - } - - b = NewBuf(); - - // Code - WriteBuf(b, &c->Code, 1); - - // ID - WriteBuf(b, &c->Id, 1); - - // Length (to be updated later) - zero = 0; - WriteBuf(b, &zero, 1); - WriteBuf(b, &zero, 1); - - if (c->Data == NULL) - { - // Option List - for (i = 0; i < LIST_NUM(c->OptionList); i++) - { - PPP_OPTION *o = LIST_DATA(c->OptionList, i); - UCHAR sz = o->DataSize + 2; - - WriteBuf(b, &o->Type, 1); - WriteBuf(b, &sz, 1); - - WriteBuf(b, o->Data, o->DataSize); - } - } - else - { - // Data - WriteBuf(b, c->Data, c->DataSize); - } - - SeekBuf(b, 0, 0); - - // Update Length - WRITE_USHORT(((UCHAR *)b->Buf) + 2, b->Size); - - return b; -} - -// Build the MS CHAP v2 challenge packet -PPP_LCP *BuildMSCHAP2ChallengePacket(PPP_SESSION *p) -{ - PPP_LCP *lcp; - BUF *b; - char machine_name[MAX_SIZE]; - UINT64 now = Tick64(); - - // Generate a Server Challenge packet of MS-CHAP v2 - GetMachineHostName(machine_name, sizeof(machine_name)); - - if (p->EapClient == NULL) - { - MsChapV2Server_GenerateChallenge(p->MsChapV2_ServerChallenge); - } - else - { - Copy(p->MsChapV2_ServerChallenge, p->EapClient->MsChapV2Challenge.Chap_ChallengeValue, 16); - } - - p->MsChapV2_PacketId = p->NextId++; - lcp = NewPPPLCP(PPP_CHAP_CODE_CHALLENGE, p->MsChapV2_PacketId); - - b = NewBuf(); - WriteBufChar(b, 16); - WriteBuf(b, p->MsChapV2_ServerChallenge, sizeof(p->MsChapV2_ServerChallenge)); - WriteBuf(b, machine_name, StrLen(machine_name)); - lcp->Data = Clone(b->Buf, b->Size); - lcp->DataSize = b->Size; - FreeBuf(b); - - Debug("Building MS-CHAP v2 Challenge\n"); - - return lcp; -} - -// IPCP packet utilities - -// Set the IP options of PPP to LCP -bool PPPSetIPOptionToLCP(PPP_IPOPTION *o, PPP_LCP *c, bool only_modify) -{ - bool ret = false; - // Validate arguments - if (c == NULL || o == NULL) - { - return false; - } - - ret = PPPSetIPAddressValueToLCP(c, PPP_IPCP_OPTION_IP, &o->IpAddress, only_modify); - - PPPSetIPAddressValueToLCP(c, PPP_IPCP_OPTION_DNS1, &o->DnsServer1, only_modify); - PPPSetIPAddressValueToLCP(c, PPP_IPCP_OPTION_DNS2, &o->DnsServer2, only_modify); - PPPSetIPAddressValueToLCP(c, PPP_IPCP_OPTION_WINS1, &o->WinsServer1, only_modify); - PPPSetIPAddressValueToLCP(c, PPP_IPCP_OPTION_WINS2, &o->WinsServer2, only_modify); - - return ret; -} - -// Get the IP options of PPP from LCP -bool PPPGetIPOptionFromLCP(PPP_IPOPTION *o, PPP_LCP *c) -{ - bool ret; - // Validate arguments - if (c == NULL || o == NULL) - { - return false; - } - - Zero(o, sizeof(PPP_IPOPTION)); - - ret = PPPGetIPAddressValueFromLCP(c, PPP_IPCP_OPTION_IP, &o->IpAddress); - - PPPGetIPAddressValueFromLCP(c, PPP_IPCP_OPTION_DNS1, &o->DnsServer1); - PPPGetIPAddressValueFromLCP(c, PPP_IPCP_OPTION_DNS2, &o->DnsServer2); - PPPGetIPAddressValueFromLCP(c, PPP_IPCP_OPTION_WINS1, &o->WinsServer1); - PPPGetIPAddressValueFromLCP(c, PPP_IPCP_OPTION_WINS2, &o->WinsServer2); - - return ret; -} - -// Set the IP address data to the option list of the LCP -bool PPPSetIPAddressValueToLCP(PPP_LCP *c, UINT type, IP *ip, bool only_modify) -{ - IP ip2; - UINT ui; - // Validate arguments - if (c == NULL || ip == NULL) - { - return false; - } - - ui = IPToUINT(ip); - - if (PPPGetIPAddressValueFromLCP(c, type, &ip2)) - { - PPP_OPTION *opt; - opt = PPPGetOptionValue(c, type); - - if (opt != NULL) - { - if (IsZeroIP(ip) == false) - { - if (CmpIpAddr(&ip2, ip) == 0) - { - // No change - opt->IsAccepted = true; - opt->IsSupported = true; - } - else - { - // Changed - opt->IsAccepted = false; - opt->IsSupported = true; - opt->AltDataSize = 4; - Copy(opt->AltData, &ui, 4); - } - } - else - { - // The parameter itself is not supported - // (if the IP address is 0.0.0.0) - opt->IsSupported = false; - opt->IsAccepted = false; - } - } - - return true; - } - else - { - if (IsZeroIP(ip) == false) - { - // Add as a new item - if (only_modify != false) - { - return false; - } - else - { - PPP_OPTION *opt2 = NewPPPOption(type, &ui, 4); - UCHAR ipstr[MAX_SIZE]; - - opt2->IsAccepted = true; - opt2->IsSupported = true; - Copy(opt2->AltData, opt2->Data, opt2->DataSize); - opt2->AltDataSize = opt2->DataSize; - - Add(c->OptionList, opt2); - IPToStr(ipstr, MAX_SIZE, ip); - - return true; - } - } - else - { - return false; - } - } -} - -// Get the IP address data from the option list of the LCP -bool PPPGetIPAddressValueFromLCP(PPP_LCP *c, UINT type, IP *ip) -{ - PPP_OPTION *opt; - UINT ui; - // Validate arguments - if (c == NULL || ip == NULL) - { - return false; - } - - opt = PPPGetOptionValue(c, type); - if (opt == NULL) - { - return false; - } - - if (opt->DataSize != 4) - { - return false; - } - - opt->IsSupported = true; - - ui = *((UINT *)opt->Data); - - UINTToIP(ip, ui); - - return true; -} - -// EAP packet utilities -bool PPPProcessEAPTlsResponse(PPP_SESSION *p, PPP_EAP *eap_packet, UINT eapTlsSize) -{ - UCHAR *dataBuffer; - UINT dataSize; - UINT tlsLength = 0; - bool isFragmented = false; - PPP_LCP *lcp; - PPP_EAP *eap; - UCHAR flags = PPP_EAP_TLS_FLAG_NONE; - UINT sizeLeft = 0; - Debug("Got EAP-TLS size=%i\n", eapTlsSize); - if (eapTlsSize == 1) - { - // This is an EAP-TLS message ACK - if (p->Eap_TlsCtx.CachedBufferSend != NULL) - { - // We got an ACK to transmit the next fragmented message - dataSize = p->Mru1 - 8 - 1 - 1; // Calculating the maximum payload size (without TlsLength) - sizeLeft = GetMemSize(p->Eap_TlsCtx.CachedBufferSend); - sizeLeft -= (UINT)(p->Eap_TlsCtx.CachedBufferSendPntr - p->Eap_TlsCtx.CachedBufferSend); - - flags = PPP_EAP_TLS_FLAG_FRAGMENTED; // M flag - if (dataSize > sizeLeft) - { - dataSize = sizeLeft; - flags = PPP_EAP_TLS_FLAG_NONE; // Clearing the M flag because it is the last packet - } - lcp = BuildEAPTlsRequest(p->Eap_PacketId++, dataSize, flags); - eap = lcp->Data; - Copy(eap->Tls.TlsDataWithoutLength, p->Eap_TlsCtx.CachedBufferSendPntr, dataSize); - p->Eap_TlsCtx.CachedBufferSendPntr += (UINT64)dataSize; - - if (!PPPSendAndRetransmitRequest(p, PPP_PROTOCOL_EAP, lcp)) - { - PPPSetStatus(p, PPP_STATUS_FAIL); - WHERE; - return false; - } - Debug("Sent EAP-TLS size=%i type=%i flag=%i\n", lcp->DataSize, eap->Type, eap->Tls.Flags); - - if (flags == PPP_EAP_TLS_FLAG_NONE) - { - // As it is the latest message, we need to cleanup - Free(p->Eap_TlsCtx.CachedBufferSend); - p->Eap_TlsCtx.CachedBufferSend = NULL; - p->Eap_TlsCtx.CachedBufferSendPntr = NULL; - } - } - else - { - // It probably should be the final ACK on closed SSL pipe - SyncSslPipe(p->Eap_TlsCtx.SslPipe); - if (p->Eap_TlsCtx.ClientCert.X != NULL) - { - IPC *ipc; - ETHERIP_ID d; - UINT error_code; - - /*if (!p->Eap_TlsCtx.SslPipe->IsDisconnected) - { - dataSize = FifoSize(p->Eap_TlsCtx.SslPipe->RawOut->RecvFifo); - lcp = BuildEAPTlsRequest(p->Eap_PacketId++, dataSize, 0); - eap = lcp->Data; - ReadFifo(p->Eap_TlsCtx.SslPipe->RawOut->RecvFifo, &(eap->Tls.TlsDataWithoutLength), dataSize); - if (!PPPSendAndRetransmitRequest(p, PPP_PROTOCOL_EAP, lcp)) - { - PPPSetStatus(p, PPP_STATUS_FAIL); - WHERE; - return false; - } - Debug("Sent EAP-TLS size=%i type=%i flag=%i\n", lcp->DataSize, eap->Type, eap->Tls.Flags); - return true; - }*/ - - PPPParseUsername(p->Cedar, p->Eap_Identity, &d); - - ipc = NewIPC(p->Cedar, p->ClientSoftwareName, p->Postfix, d.HubName, d.UserName, "", - &error_code, &p->ClientIP, p->ClientPort, &p->ServerIP, p->ServerPort, - p->ClientHostname, p->CryptName, false, p->AdjustMss, NULL, p->Eap_TlsCtx.ClientCert.X, - IPC_LAYER_3); - - if (ipc != NULL) - { - PPP_PACKET *pack; - UINT identificator = p->Eap_PacketId - 1; // THIS IS A HACK TO SUPPORT VPN Client Pro on Android!!! - - p->Ipc = ipc; - PPPSetStatus(p, PPP_STATUS_AUTH_SUCCESS); - - // Just send an EAP-Success - pack = ZeroMalloc(sizeof(PPP_PACKET)); - pack->IsControl = true; - pack->Protocol = PPP_PROTOCOL_EAP; - lcp = NewPPPLCP(PPP_EAP_CODE_SUCCESS, identificator); - pack->Lcp = lcp; - Debug("Sent EAP-TLS size=%i SUCCESS\n", lcp->DataSize); - if (!PPPSendPacketAndFree(p, pack)) - { - PPPSetStatus(p, PPP_STATUS_FAIL); - WHERE; - return false; - } - return true; - } - else - { - PPP_PACKET *pack; - UINT identificator = p->Eap_PacketId - 1; // THIS IS A HACK TO SUPPORT VPN Client Pro on Android!!! - - PPPSetStatus(p, PPP_STATUS_AUTH_FAIL); - - pack = ZeroMalloc(sizeof(PPP_PACKET)); - pack->IsControl = true; - pack->Protocol = PPP_PROTOCOL_EAP; - lcp = NewPPPLCP(PPP_EAP_CODE_FAILURE, identificator); - pack->Lcp = lcp; - Debug("Sent EAP-TLS size=%i FAILURE\n", lcp->DataSize); - if (!PPPSendPacketAndFree(p, pack)) - { - PPPSetStatus(p, PPP_STATUS_FAIL); - WHERE; - return false; - } - return false; - } - } - else - { - // Some clients needs a little help it seems - namely VPN Client Pro on Android - flags |= PPP_EAP_TLS_FLAG_SSLSTARTED; - lcp = BuildEAPTlsRequest(p->Eap_PacketId++, 0, flags); - PPPSetStatus(p, PPP_STATUS_AUTHENTICATING); - if (!PPPSendAndRetransmitRequest(p, PPP_PROTOCOL_EAP, lcp)) - { - PPPSetStatus(p, PPP_STATUS_FAIL); - WHERE; - return false; - } - Debug("Sent EAP-TLS size=%i\n", lcp->DataSize); - return true; - } - } - return true; - } - dataBuffer = eap_packet->Tls.TlsDataWithoutLength; - dataSize = eapTlsSize - 1; - if (eap_packet->Tls.Flags & PPP_EAP_TLS_FLAG_TLS_LENGTH) - { - dataBuffer = eap_packet->Tls.TlsDataWithLength.Data; - dataSize -= 4; - tlsLength = Endian32(eap_packet->Tls.TlsDataWithLength.TlsLength); - } - /*Debug("=======RECV EAP-TLS PACKET DUMP=======\n"); - for (i = 0; i < dataSize; i++) - { - if (i > 0) printf(" "); - Debug("%02X", dataBuffer[i]); - } - Debug("\n=======RECV EAP-TLS PACKET DUMP END=======\n");*/ - if (eap_packet->Tls.Flags & PPP_EAP_TLS_FLAG_FRAGMENTED) - { - isFragmented = true; - } - - if (p->PPPStatus == PPP_STATUS_AUTHENTICATING) - { - // First we initialize the SslPipe if it is not already inited - if (p->Eap_TlsCtx.SslPipe == NULL) - { - p->Eap_TlsCtx.Dh = DhNewFromBits(DH_PARAM_BITS_DEFAULT); - p->Eap_TlsCtx.SslPipe = NewSslPipeEx(true, p->Cedar->ServerX, p->Cedar->ServerK, p->Eap_TlsCtx.Dh, true, &(p->Eap_TlsCtx.ClientCert)); - } - - // If the current frame is fragmented, or it is a possible last of a fragmented series, bufferize it - if (isFragmented || p->Eap_TlsCtx.CachedBufferRecv != NULL) - { - if (p->Eap_TlsCtx.CachedBufferRecv == NULL && tlsLength > 0) - { - p->Eap_TlsCtx.CachedBufferRecv = ZeroMalloc(MAX(dataSize, tlsLength)); - p->Eap_TlsCtx.CachedBufferRecvPntr = p->Eap_TlsCtx.CachedBufferRecv; - } - else if (p->Eap_TlsCtx.CachedBufferRecv == NULL) - { - p->Eap_TlsCtx.CachedBufferRecv = ZeroMalloc(MAX(dataSize, PPP_MRU_MAX * 10)); // 10 MRUs should be enough - p->Eap_TlsCtx.CachedBufferRecvPntr = p->Eap_TlsCtx.CachedBufferRecv; - } - sizeLeft = GetMemSize(p->Eap_TlsCtx.CachedBufferRecv); - sizeLeft -= (UINT)(p->Eap_TlsCtx.CachedBufferRecvPntr - p->Eap_TlsCtx.CachedBufferRecv); - - Copy(p->Eap_TlsCtx.CachedBufferRecvPntr, dataBuffer, MIN(sizeLeft, dataSize)); - - p->Eap_TlsCtx.CachedBufferRecvPntr += MIN(sizeLeft, dataSize); - } - - // If we got a cached buffer, we should feed the FIFOs via it - if (p->Eap_TlsCtx.CachedBufferRecv != NULL) - { - dataBuffer = p->Eap_TlsCtx.CachedBufferRecv; - dataSize = GetMemSize(p->Eap_TlsCtx.CachedBufferRecv); - if (dataSize == MAX_BUFFERING_PACKET_SIZE) - { - dataSize = (UINT)(p->Eap_TlsCtx.CachedBufferRecvPntr - p->Eap_TlsCtx.CachedBufferRecv); - } - } - - // Just acknoweldge that we buffered the fragmented data - if (isFragmented) - { - PPP_LCP *lcp = BuildEAPPacketEx(PPP_EAP_CODE_REQUEST, p->Eap_PacketId++, PPP_EAP_TYPE_TLS, 0); - if (!PPPSendAndRetransmitRequest(p, PPP_PROTOCOL_EAP, lcp)) - { - PPPSetStatus(p, PPP_STATUS_FAIL); - WHERE; - return false; - } - Debug("Sent EAP-TLS size=%i\n", lcp->DataSize); - } - else - { - /*Debug("=======RECV EAP-TLS FIFO DUMP=======\n"); - for (i = 0; i < dataSize; i++) - { - if (i > 0) printf(" "); - Debug("%02X", dataBuffer[i]); - } - Debug("\n=======RECV EAP-TLS PACKET FIFO END=======\n");*/ - WriteFifo(p->Eap_TlsCtx.SslPipe->RawIn->SendFifo, dataBuffer, dataSize); - SyncSslPipe(p->Eap_TlsCtx.SslPipe); - // Delete the cached buffer after we fed it into the pipe - if (p->Eap_TlsCtx.CachedBufferRecv != NULL) - { - Free(p->Eap_TlsCtx.CachedBufferRecv); - p->Eap_TlsCtx.CachedBufferRecv = NULL; - p->Eap_TlsCtx.CachedBufferRecvPntr = NULL; - } - - if (p->Eap_TlsCtx.SslPipe->IsDisconnected == false) - { - dataSize = FifoSize(p->Eap_TlsCtx.SslPipe->RawOut->RecvFifo); - // Do we need to send a fragmented packet? - if (dataSize > p->Mru1 - 8 - 1 - 1) - { - if (p->Eap_TlsCtx.CachedBufferSend == NULL) - { - p->Eap_TlsCtx.CachedBufferSend = ZeroMalloc(dataSize); - p->Eap_TlsCtx.CachedBufferSendPntr = p->Eap_TlsCtx.CachedBufferSend; - } - ReadFifo(p->Eap_TlsCtx.SslPipe->RawOut->RecvFifo, p->Eap_TlsCtx.CachedBufferSend, dataSize); - - // Now send data from the cached buffer with set fragmentation flag and also total TLS Size - tlsLength = dataSize; - dataSize = p->Mru1 - 8 - 1 - 1 - 4; // Calculating the maximum payload size (adjusting for including TlsLength) - flags = PPP_EAP_TLS_FLAG_TLS_LENGTH; // L flag - flags |= PPP_EAP_TLS_FLAG_FRAGMENTED; // M flag - lcp = BuildEAPTlsRequest(p->Eap_PacketId++, dataSize, flags); - eap = lcp->Data; - eap->Tls.TlsDataWithLength.TlsLength = Endian32(tlsLength); - Copy(eap->Tls.TlsDataWithLength.Data, p->Eap_TlsCtx.CachedBufferSend, dataSize); - p->Eap_TlsCtx.CachedBufferSendPntr += dataSize; - if (!PPPSendAndRetransmitRequest(p, PPP_PROTOCOL_EAP, lcp)) - { - PPPSetStatus(p, PPP_STATUS_FAIL); - WHERE; - return false; - } - Debug("Sent EAP-TLS size=%i type=%i flag=%i\n", lcp->DataSize, eap->Type, eap->Tls.Flags); - } - else - { - lcp = BuildEAPTlsRequest(p->Eap_PacketId++, dataSize, 0); - eap = lcp->Data; - ReadFifo(p->Eap_TlsCtx.SslPipe->RawOut->RecvFifo, &(eap->Tls.TlsDataWithoutLength), dataSize); - if (!PPPSendAndRetransmitRequest(p, PPP_PROTOCOL_EAP, lcp)) - { - PPPSetStatus(p, PPP_STATUS_FAIL); - WHERE; - return false; - } - Debug("Sent EAP-TLS size=%i type=%i flag=%i\n", lcp->DataSize, eap->Type, eap->Tls.Flags); - } - } - } - } - else - { - Debug("Got an EAP_TLS packet when not authenticating, ignoring...\n"); - } - return false; -} - -PPP_LCP *BuildEAPPacketEx(UCHAR code, UCHAR id, UCHAR type, UINT datasize) -{ - PPP_EAP *eap_packet; - PPP_LCP *lcp_packet; - UINT lcpDatasize; - lcpDatasize = datasize + sizeof(UCHAR); - eap_packet = ZeroMalloc(lcpDatasize); - eap_packet->Type = type; - lcp_packet = NewPPPLCP(code, id); - lcp_packet->Data = eap_packet; - lcp_packet->DataSize = lcpDatasize; - return lcp_packet; -} - -PPP_LCP *BuildEAPTlsPacketEx(UCHAR code, UCHAR id, UCHAR type, UINT datasize, UCHAR flags) -{ - PPP_LCP *lcp_packet; - PPP_EAP *eap_packet; - UINT tls_datasize = datasize + sizeof(UCHAR); - if (flags & PPP_EAP_TLS_FLAG_TLS_LENGTH) - { - tls_datasize += sizeof(UINT); - } - lcp_packet = BuildEAPPacketEx(code, id, type, tls_datasize); - eap_packet = lcp_packet->Data; - eap_packet->Tls.Flags = flags; - return lcp_packet; -} - -PPP_LCP *BuildEAPTlsRequest(UCHAR id, UINT datasize, UCHAR flags) -{ - return BuildEAPTlsPacketEx(PPP_EAP_CODE_REQUEST, id, PPP_EAP_TYPE_TLS, datasize, flags); -} - -// Other packet utilities - -// Get the option value -PPP_OPTION *PPPGetOptionValue(PPP_LCP *c, UCHAR type) -{ - UINT i; - // Validate arguments - if (c == NULL) - { - return NULL; - } - - for (i = 0; i < LIST_NUM(c->OptionList); i++) - { - PPP_OPTION *t = LIST_DATA(c->OptionList, i); - - if (t->Type == type) - { - return t; - } - } - - return NULL; -} - -// Check whether the Virtual HUB with the specified name exist? -bool IsHubExistsWithLock(CEDAR *cedar, char *hubname) -{ - bool ret = false; - // Validate arguments - if (cedar == NULL || hubname == NULL) - { - return false; - } - - LockList(cedar->HubList); - { - ret = IsHub(cedar, hubname); - } - UnlockList(cedar->HubList); - - return ret; -} - -// Sets the PPP status without overwriting the FAIL status -void PPPSetStatus(PPP_SESSION *p, UINT status) -{ - if (status == PPP_STATUS_FAIL) - { - Debug("SETTING PPP_STATUS_FAIL!!!\n"); - } - if (!PPP_STATUS_IS_UNAVAILABLE(p->PPPStatus) || PPP_STATUS_IS_UNAVAILABLE(status)) - { - p->PPPStatus = status; - } -} - - -// Memory freeing functions - -// Release the PPP session -void FreePPPSession(PPP_SESSION *p) -{ - UINT i; - // Validate arguments - if (p == NULL) - { - return; - } - - // Release the memory - for (i = 0; i < LIST_NUM(p->RecvPacketList); i++) - { - PPP_PACKET *pp = LIST_DATA(p->RecvPacketList, i); - - FreePPPPacket(pp); - } - ReleaseList(p->RecvPacketList); - - for (i = 0; i < LIST_NUM(p->SentReqPacketList); i++) - { - PPP_REQUEST_RESEND *t = LIST_DATA(p->SentReqPacketList, i); - FreePPPPacket(t->Packet); - - Free(t); - } - - ReleaseList(p->SentReqPacketList); - - for (i = 0; i < LIST_NUM(p->DelayedPackets); i++) - { - PPP_DELAYED_PACKET *t = LIST_DATA(p->DelayedPackets, i); - FreePPPPacket(t->Packet); - - Free(t); - } - - ReleaseList(p->DelayedPackets); - - if (p->CurrentPacket != NULL) - { - FreePPPPacket(p->CurrentPacket); - } - - if (p->TubeRecv != NULL) - { - // Record the PPP disconnect reason code for L2TP - p->TubeRecv->IntParam1 = p->DisconnectCauseCode; - p->TubeRecv->IntParam2 = p->DisconnectCauseDirection; - } - - // Freeing EAP-TLS context - if (p->Eap_TlsCtx.CachedBufferRecv != NULL) - { - Free(p->Eap_TlsCtx.CachedBufferRecv); - } - if (p->Eap_TlsCtx.CachedBufferSend != NULL) - { - Free(p->Eap_TlsCtx.CachedBufferSend); - } - if (p->Eap_TlsCtx.SslPipe != NULL) - { - FreeSslPipe(p->Eap_TlsCtx.SslPipe); - } - if (p->Eap_TlsCtx.ClientCert.X != NULL) - { - FreeX(p->Eap_TlsCtx.ClientCert.X); - } - if (p->Eap_TlsCtx.Dh != NULL) - { - DhFree(p->Eap_TlsCtx.Dh); - } - - - FreeTubeFlushList(p->FlushList); - - TubeDisconnect(p->TubeRecv); - TubeDisconnect(p->TubeSend); - - ReleaseCedar(p->Cedar); - - ReleaseTube(p->TubeRecv); - ReleaseTube(p->TubeSend); - - if (p->Ipc != NULL) - { - FreeIPC(p->Ipc); - } - - PPPFreeEapClient(p); - - Free(p); -} - -// Release the LCP -void FreePPPLCP(PPP_LCP *c) -{ - // Validate arguments - if (c == NULL) - { - return; - } - - FreePPPOptionList(c->OptionList); - - Free(c->Data); - - Free(c); -} - -// Release the PPP options list -void FreePPPOptionList(LIST *o) -{ - UINT i; - // Validate arguments - if (o == NULL) - { - return; - } - - for (i = 0; i < LIST_NUM(o); i++) - { - PPP_OPTION *t = LIST_DATA(o, i); - - Free(t); - } - - ReleaseList(o); -} - -// Release the PPP packet -void FreePPPPacket(PPP_PACKET *pp) -{ - FreePPPPacketEx(pp, false); -} - -void FreePPPPacketEx(PPP_PACKET *pp, bool no_free_struct) -{ - // Validate arguments - if (pp == NULL) - { - return; - } - - FreePPPLCP(pp->Lcp); - - Free(pp->Data); - - if (no_free_struct == false) - { - Free(pp); - } -} - -// Free the associated EAP client -void PPPFreeEapClient(PPP_SESSION *p) -{ - if (p == NULL) - { - return; - } - - if (p->EapClient != NULL) - { - ReleaseEapClient(p->EapClient); - p->EapClient = NULL; - } -} - - -// Utility functions used not only in PPP stack - -// Separate into the user name and the Virtual HUB name by analyzing the string -bool PPPParseUsername(CEDAR *cedar, char *src_username, ETHERIP_ID *dst) -{ - UINT i, len, last_at, first_en; - char token1[MAX_SIZE]; // username - char token2[MAX_SIZE]; // hub_name - char src[MAX_SIZE]; - // Validate arguments - Zero(dst, sizeof(ETHERIP_ID)); - if (cedar == NULL || dst == NULL) - { - return false; - } - - StrCpy(src, sizeof(src), src_username); - Trim(src); - - // Search for the first "\\" in the string - len = StrLen(src); - - first_en = SearchStrEx(src, "\\", 0, true); - - if (first_en != INFINITE && first_en >= 1 && (first_en < (len - 1))) - { - StrCpy(token1, sizeof(token1), src + first_en + 1); - StrCpy(token2, sizeof(token2), src); - token2[first_en] = 0; - - // Confirm whether the hubname exists if the virtual HUB name is - // specified like as hubname\username - if (IsHubExistsWithLock(cedar, token2) == false) - { - // If the hubname does not exist, restore to the original name - StrCpy(token1, sizeof(token1), src); - ClearStr(token2, sizeof(token2)); - } - } - else - { - // Search for the separator character's last position in the string - len = StrLen(src); - last_at = INFINITE; - for (i = 0; i < len; i++) - { - char c = src[i]; - - if (c == cedar->UsernameHubSeparator) - { - last_at = i; - } - } - - Zero(token1, sizeof(token1)); - Zero(token2, sizeof(token2)); - - if (last_at == INFINITE) - { - // The separator character is not specifiedd - StrCpy(token1, sizeof(token1), src); - } - else - { - StrCpy(token1, sizeof(token1), src); - token1[last_at] = 0; - - StrCpy(token2, sizeof(token2), src + last_at + 1); - } - - // Check whether such Virtual HUB exists If the virtual HUB name is specified - if (IsEmptyStr(token2) == false) - { - if (IsHubExistsWithLock(cedar, token2) == false) - { - // Because the specified virtual HUB name doesn't exist, it's considered to be a part of the user name - StrCpy(token1, sizeof(token1), src); - - ClearStr(token2, sizeof(token2)); - } - } - } - - if (IsEmptyStr(token2)) - { - // Select the default Virtual HUB if the Virtual HUB name is not specified - StrCpy(token2, sizeof(token2), SERVER_DEFAULT_HUB_NAME); - if (cedar->Server != NULL && cedar->Server->IPsecServer != NULL) - { - Lock(cedar->Server->IPsecServer->LockSettings); - { - IPsecNormalizeServiceSetting(cedar->Server->IPsecServer); - - StrCpy(token2, sizeof(token2), cedar->Server->IPsecServer->Services.L2TP_DefaultHub); - } - Unlock(cedar->Server->IPsecServer->LockSettings); - } - - } - - // Return the results - StrCpy(dst->HubName, sizeof(dst->HubName), token2); - StrCpy(dst->UserName, sizeof(dst->UserName), token1); - - return true; -} - -// Generate the NT hash of the password -void GenerateNtPasswordHash(UCHAR *dst, char *password) -{ - UCHAR *tmp; - UINT tmp_size; - UINT i, len; - // Validate arguments - if (dst == NULL || password == NULL) - { - return; - } - - // Generate a Unicode password - len = StrLen(password); - tmp_size = len * 2; - - tmp = ZeroMalloc(tmp_size); - - for (i = 0; i < len; i++) - { - tmp[i * 2] = password[i]; - } - - // Hashing - HashMd4(dst, tmp, tmp_size); - - Free(tmp); -} - -// Generate the MS-CHAPv2 server-side challenge -void MsChapV2Server_GenerateChallenge(UCHAR *dst) -{ - // Validate arguments - if (dst == NULL) - { - return; - } - - Rand(dst, 16); -} - -// Generate the MS-CHAPv2 client-side challenge -void MsChapV2Client_GenerateChallenge(UCHAR *dst) -{ - // Validate arguments - if (dst == NULL) - { - return; - } - - Rand(dst, 16); -} - -// Generate a 8 bytes challenge -void MsChapV2_GenerateChallenge8(UCHAR *dst, UCHAR *client_challenge, UCHAR *server_challenge, char *username) -{ - BUF *b; - UCHAR hash[SHA1_SIZE]; - char username2[MAX_SIZE]; - char domainname2[MAX_SIZE]; - // Validate arguments - if (dst == NULL || client_challenge == NULL || server_challenge == NULL) - { - return; - } - - b = NewBuf(); - - WriteBuf(b, client_challenge, 16); - WriteBuf(b, server_challenge, 16); - - ParseNtUsername(username, username2, sizeof(username2), domainname2, sizeof(domainname2), true); - - if (IsEmptyStr(username2) == false) - { - WriteBuf(b, username2, StrLen(username2)); - } - - Sha1(hash, b->Buf, b->Size); - - FreeBuf(b); - - Copy(dst, hash, 8); -} - -// Generate the MS-CHAPv2 client response -void MsChapV2Client_GenerateResponse(UCHAR *dst, UCHAR *challenge8, UCHAR *nt_password_hash) -{ - UCHAR password_hash_2[21]; - UCHAR key1[8], key2[8], key3[8]; - // Validate arguments - if (dst == NULL || challenge8 == NULL || nt_password_hash == NULL) - { - return; - } - - Zero(password_hash_2, sizeof(password_hash_2)); - Copy(password_hash_2, nt_password_hash, 16); - - Zero(key1, sizeof(key1)); - Zero(key2, sizeof(key2)); - Zero(key3, sizeof(key3)); - - Copy(key1, password_hash_2 + 0, 7); - Copy(key2, password_hash_2 + 7, 7); - Copy(key3, password_hash_2 + 14, 7); - - DesEcbEncrypt(dst + 0, challenge8, key1); - DesEcbEncrypt(dst + 8, challenge8, key2); - DesEcbEncrypt(dst + 16, challenge8, key3); -} - -// Generate a hash of the hash of the NT password -void GenerateNtPasswordHashHash(UCHAR *dst_hash, UCHAR *src_hash) -{ - // Validate arguments - if (dst_hash == NULL || src_hash == NULL) - { - return; - } - - HashMd4(dst_hash, src_hash, 16); -} - -// Generate the MS-CHAPv2 server response -void MsChapV2Server_GenerateResponse(UCHAR *dst, UCHAR *nt_password_hash_hash, UCHAR *client_response, UCHAR *challenge8) -{ - UCHAR digest[SHA1_SIZE]; - BUF *b; - char *magic1 = "Magic server to client signing constant"; - char *magic2 = "Pad to make it do more than one iteration"; - // Validate arguments - if (dst == NULL || nt_password_hash_hash == NULL || client_response == NULL || challenge8 == NULL) - { - return; - } - - b = NewBuf(); - WriteBuf(b, nt_password_hash_hash, 16); - WriteBuf(b, client_response, 24); - WriteBuf(b, magic1, StrLen(magic1)); - Sha1(digest, b->Buf, b->Size); - FreeBuf(b); - - b = NewBuf(); - WriteBuf(b, digest, sizeof(digest)); - WriteBuf(b, challenge8, 8); - WriteBuf(b, magic2, StrLen(magic2)); - Sha1(dst, b->Buf, b->Size); - FreeBuf(b); -} - -// Verify whether the password matches one that is specified by the user in the MS-CHAPv2 -bool MsChapV2VerityPassword(IPC_MSCHAP_V2_AUTHINFO *d, char *password) -{ - UCHAR ntlm_hash[MD5_SIZE]; - UCHAR challenge8[8]; - UCHAR client_response[24]; - // Validate arguments - if (d == NULL || password == NULL) - { - return false; - } - - GenerateNtPasswordHash(ntlm_hash, password); - MsChapV2_GenerateChallenge8(challenge8, d->MsChapV2_ClientChallenge, d->MsChapV2_ServerChallenge, d->MsChapV2_PPPUsername); - MsChapV2Client_GenerateResponse(client_response, challenge8, ntlm_hash); - - if (Cmp(client_response, d->MsChapV2_ClientResponse, 24) != 0) - { - return false; - } - - return true; -} - -// Estimate the password in the brute force for the request packet of MS-CHAPv2 -char *MsChapV2DoBruteForce(IPC_MSCHAP_V2_AUTHINFO *d, LIST *password_list) -{ - UINT i; - // Validate arguments - if (d == NULL || password_list == NULL) - { - return NULL; - } - - for (i = 0; i < LIST_NUM(password_list); i++) - { - char *s = LIST_DATA(password_list, i); - char tmp[MAX_SIZE]; - UINT j, max; - UINT len; - - StrCpy(tmp, sizeof(tmp), s); - - len = StrLen(tmp); - max = Power(2, MIN(len, 9)); - - for (j = 0; j < max; j++) - { - SetStrCaseAccordingToBits(tmp, j); - if (MsChapV2VerityPassword(d, tmp)) - { - return CopyStr(tmp); - } - } - } - - return NULL; -} - - +// SoftEther VPN Source Code - Developer Edition Master Branch +// Cedar Communication Module + + +// Proto_PPP.c +// PPP protocol stack + +#include "CedarPch.h" + +// PPP main thread +void PPPThread(THREAD *thread, void *param) +{ + PPP_SESSION *p = (PPP_SESSION *)param; + UINT i; + USHORT next_protocol = 0; + bool ret = false; + char ipstr1[128], ipstr2[128]; + bool authReqSent = false; + UINT64 now = Tick64(); + + // Validate arguments + if (thread == NULL || param == NULL) + { + return; + } + + // Initialize + + Debug("PPP Initialize"); + + PPPSetStatus(p, PPP_STATUS_CONNECTED); + + p->Eap_Protocol = PPP_UNSPECIFIED; + + p->Mru1 = p->Mru2 = PPP_MRU_DEFAULT; + p->RecvPacketList = NewList(NULL); + p->SentReqPacketList = NewList(NULL); + p->DelayedPackets = NewList(PPPDelayedPacketsComparator); + + p->MsChapV2_UseDoubleMsChapV2 = CedarIsThereAnyEapEnabledRadiusConfig(p->Cedar); + + Debug("MsChapV2_UseDoubleMsChapV2 = 0x%x\n", p->MsChapV2_UseDoubleMsChapV2); + + //// Link establishment phase + + Debug("PPP Link establishment phase\n"); + + IPToStr(ipstr1, sizeof(ipstr1), &p->ClientIP); + IPToStr(ipstr2, sizeof(ipstr2), &p->ServerIP); + PPPLog(p, "LP_CONNECTED", p->Postfix, ipstr1, p->ClientHostname, p->ClientPort, ipstr2, p->ServerPort, + p->ClientSoftwareName, p->AdjustMss); + + // We need that so we don't time out on connection immediately + p->LastRecvTime = Tick64(); + + Debug("PPP starting main dataloop\n"); + + // Dataloop active if the receiving tube is still connected + while (true) + { + PPP_LCP *lcp; + bool receivedPacketProcessed = false; + TUBE *tubes[2]; + UINT r; + + PPPGetNextPacket(p); + + if (p->CurrentPacket != NULL) + { + // First we process any possible unsupported packets + receivedPacketProcessed = PPPRejectUnsupportedPacket(p, p->CurrentPacket); + + // Now do some basic processing + if (!receivedPacketProcessed && p->CurrentPacket->IsControl && p->CurrentPacket->Protocol == PPP_PROTOCOL_LCP) + { + if (p->CurrentPacket->Lcp->Code == PPP_LCP_CODE_ECHO_REQUEST && !PPP_STATUS_IS_UNAVAILABLE(p->PPPStatus)) + { + // Immediately return the echo response to the echo request + PPP_PACKET *pp2 = ZeroMalloc(sizeof(PPP_PACKET)); + + pp2->IsControl = true; + pp2->Protocol = PPP_PROTOCOL_LCP; + pp2->Lcp = NewPPPLCP(PPP_LCP_CODE_ECHO_RESPONSE, p->CurrentPacket->Lcp->Id); + pp2->Lcp->Data = Clone(p->CurrentPacket->Lcp->Data, p->CurrentPacket->Lcp->DataSize); + pp2->Lcp->DataSize = p->CurrentPacket->Lcp->DataSize; + + if (PPPSendPacketAndFree(p, pp2) == false) + { + PPPSetStatus(p, PPP_STATUS_FAIL); + WHERE; + } + + receivedPacketProcessed = true; + } + else if (p->CurrentPacket->Lcp->Code == PPP_LCP_CODE_ECHO_RESPONSE && !PPP_STATUS_IS_UNAVAILABLE(p->PPPStatus)) + { + receivedPacketProcessed = true; + // Ignore the Echo response packet + } + else if (p->CurrentPacket->Lcp->Code == PPP_LCP_CODE_DROP && !PPP_STATUS_IS_UNAVAILABLE(p->PPPStatus)) + { + receivedPacketProcessed = true; + // Ignore the Drop packet + } + else if (p->CurrentPacket->Lcp->Code == PPP_LCP_CODE_IDENTIFICATION && !PPP_STATUS_IS_UNAVAILABLE(p->PPPStatus)) + { + receivedPacketProcessed = true; + // Ignore the Identification packet + WHERE; + } + else if (p->CurrentPacket->Lcp->Code == PPP_LCP_CODE_TERMINATE_REQ) + { + PPP_PACKET *pp2 = ZeroMalloc(sizeof(PPP_PACKET));; + receivedPacketProcessed = true; + // Return the Terminate ACK If a Terminate Request has been received + + pp2->IsControl = true; + pp2->Protocol = PPP_PROTOCOL_LCP; + pp2->Lcp = NewPPPLCP(PPP_LCP_CODE_TERMINATE_ACK, p->CurrentPacket->Lcp->Id); + pp2->Lcp->Data = Clone(p->CurrentPacket->Lcp->Data, p->CurrentPacket->Lcp->DataSize); + pp2->Lcp->DataSize = p->CurrentPacket->Lcp->DataSize; + + p->IsTerminateReceived = true; + + if (PPPSendPacketAndFree(p, pp2) == false) + { + PPPSetStatus(p, PPP_STATUS_FAIL); + WHERE; + } + else + { + SleepThread(100); + PPPSetStatus(p, PPP_STATUS_CLOSED); + } + } + else if (p->CurrentPacket->Lcp->Code == PPP_LCP_CODE_TERMINATE_ACK) + { + PPPSetStatus(p, PPP_STATUS_CLOSED); + } + } + + // Process responses + if (!receivedPacketProcessed && p->CurrentPacket != NULL && p->CurrentPacket->IsControl && PPP_CODE_IS_RESPONSE(p->CurrentPacket->Protocol, p->CurrentPacket->Lcp->Code) && !PPP_STATUS_IS_UNAVAILABLE(p->PPPStatus)) + { + PPP_PACKET *request = NULL; + // Removing from resend list + for (i = 0; i < LIST_NUM(p->SentReqPacketList); i++) + { + PPP_REQUEST_RESEND *t = LIST_DATA(p->SentReqPacketList, i); + + if (t->Id == p->CurrentPacket->Lcp->Id) + { + request = t->Packet; + Delete(p->SentReqPacketList, t); + Free(t); + break; + } + } + PPPProcessResponsePacket(p, p->CurrentPacket, request); + FreePPPPacket(request); + receivedPacketProcessed = true; + } + + // Process requests + if (!receivedPacketProcessed && p->CurrentPacket != NULL && p->CurrentPacket->IsControl && PPP_CODE_IS_REQUEST(p->CurrentPacket->Protocol, p->CurrentPacket->Lcp->Code) && !PPP_STATUS_IS_UNAVAILABLE(p->PPPStatus)) + { + PPPProcessRequestPacket(p, p->CurrentPacket); + receivedPacketProcessed = true; + } + + // Process data packets, discarded before we got any links up + if (!receivedPacketProcessed && p->CurrentPacket != NULL && !p->CurrentPacket->IsControl && p->PPPStatus == PPP_STATUS_NETWORK_LAYER && p->Ipc != NULL) + { + UINT64 timeBeforeLoop = Tick64(); + while (true) + { + UINT64 nowL; + // Here client to server + if (p->CurrentPacket->Protocol == PPP_PROTOCOL_IP && + IPC_PROTO_GET_STATUS(p->Ipc, IPv4State) == IPC_PROTO_STATUS_OPENED) + { + receivedPacketProcessed = true; + IPCSendIPv4(p->Ipc, p->CurrentPacket->Data, p->CurrentPacket->DataSize); + } + else if (p->CurrentPacket->Protocol == PPP_PROTOCOL_IP) + { + Debug("Got IPv4 packet before IPv4 ready!\n"); + } + else if (p->CurrentPacket->Protocol == PPP_PROTOCOL_IPV6 && + IPC_PROTO_GET_STATUS(p->Ipc, IPv6State) == IPC_PROTO_STATUS_OPENED) + { + receivedPacketProcessed = true; + IPCIPv6Send(p->Ipc, p->CurrentPacket->Data, p->CurrentPacket->DataSize); + } + else if (p->CurrentPacket->Protocol == PPP_PROTOCOL_IPV6) + { + Debug("Got IPv6 packet before IPv6 ready!\n"); + } + + // Let's break out of the loop once in a while so we don't get stuck here endlessly + nowL = Tick64(); + if (nowL > timeBeforeLoop + PPP_PACKET_RESEND_INTERVAL) + { + break; + } + + PPPGetNextPacket(p); + if (p->CurrentPacket == NULL) + { + break; + } + // Making sure we got a correctly parsed packet by rejecting all invalid ones + if (PPPRejectUnsupportedPacket(p, p->CurrentPacket)) + { + break; + } + if (p->CurrentPacket->IsControl || p->PPPStatus != PPP_STATUS_NETWORK_LAYER || p->Ipc == NULL) + { + PPPAddNextPacket(p, p->CurrentPacket, 0); + p->CurrentPacket = NULL; + break; + } + } + } + + if (!receivedPacketProcessed && p->CurrentPacket != NULL) + { + Debug("Unprocessed and unrejected packet, protocol = 0x%x\n", p->CurrentPacket->Protocol); + } + } + else if (p->PPPStatus == PPP_STATUS_BEFORE_AUTH && p->AuthProtocol == PPP_PROTOCOL_EAP) + { + PPP_LCP *lcpEap; + PPP_EAP *eapPacket; + UCHAR *welcomeMessage = "Welcome to the SoftEther VPN server!"; + UCHAR flags = PPP_EAP_TLS_FLAG_NONE; + // We got to start EAP when we got no LCP packets from the client on previous iteration + // which means we parsed all the client requests and responses + + switch (p->Eap_Protocol) + { + case PPP_EAP_TYPE_TLS: + // Sending TLS Start... + flags |= PPP_EAP_TLS_FLAG_SSLSTARTED; + lcpEap = BuildEAPTlsRequest(p->Eap_PacketId++, 0, flags); + PPPSetStatus(p, PPP_STATUS_AUTHENTICATING); + if (!PPPSendAndRetransmitRequest(p, PPP_PROTOCOL_EAP, lcpEap)) + { + PPPSetStatus(p, PPP_STATUS_FAIL); + WHERE; + break; + } + break; + case PPP_EAP_TYPE_IDENTITY: + default: // We treat the unspecified protocol as the IDENTITY protocol + p->Eap_Protocol = PPP_EAP_TYPE_IDENTITY; + lcpEap = BuildEAPPacketEx(PPP_EAP_CODE_REQUEST, p->Eap_PacketId++, PPP_EAP_TYPE_IDENTITY, StrLen(welcomeMessage) + 1); + eapPacket = lcpEap->Data; + Copy(eapPacket->Data, welcomeMessage, StrLen(welcomeMessage)); + PPPSetStatus(p, PPP_STATUS_AUTHENTICATING); + if (!PPPSendAndRetransmitRequest(p, PPP_PROTOCOL_EAP, lcpEap)) + { + PPPSetStatus(p, PPP_STATUS_FAIL); + WHERE; + break; + } + break; + } + } + else if (p->PPPStatus == PPP_STATUS_BEFORE_AUTH && p->AuthProtocol == PPP_PROTOCOL_CHAP) + { + // We got to start CHAP when we got no LCP packets from the client on previous iteration + // which means we parsed all the client requests and responses + Debug("Starting PPP Authentication phase MS-CHAP v2\n"); + + lcp = BuildMSCHAP2ChallengePacket(p); + if (!PPPSendAndRetransmitRequest(p, PPP_PROTOCOL_CHAP, lcp)) + { + PPPSetStatus(p, PPP_STATUS_FAIL); + WHERE; + } + + PPPSetStatus(p, PPP_STATUS_AUTHENTICATING); + } + + if (p->PPPStatus == PPP_STATUS_CONNECTED && !authReqSent) + { + // EAP code + PPP_LCP *c = NewPPPLCP(PPP_LCP_CODE_REQ, 0); + USHORT eap_code = Endian16(PPP_LCP_AUTH_EAP); + + Debug("Request EAP\n"); + Add(c->OptionList, NewPPPOption(PPP_LCP_OPTION_AUTH, &eap_code, sizeof(eap_code))); + if (!PPPSendAndRetransmitRequest(p, PPP_PROTOCOL_LCP, c)) + { + PPPSetStatus(p, PPP_STATUS_FAIL); + WHERE; + } + authReqSent = true; + } + + if (p->PPPStatus == PPP_STATUS_AUTHENTICATING) + { + //Debug("Tick waiting for auth...\n"); + } + + if (p->PPPStatus == PPP_STATUS_AUTH_FAIL) + { + Debug("PPP auth failed, giving up\n"); + p->DisconnectCauseCode = 15; + p->DisconnectCauseDirection = 1; + PPPSetStatus(p, PPP_STATUS_CLOSING); + } + + if (p->PPPStatus == PPP_STATUS_NETWORK_LAYER) + { + UINT64 timeBeforeLoop; + if (IPC_PROTO_GET_STATUS(p->Ipc, IPv4State) == IPC_PROTO_STATUS_OPENED) + { + if (p->DhcpAllocated) + { + if (now >= p->DhcpNextRenewTime) + { + IP ip; + + // DHCP renewal procedure + p->DhcpNextRenewTime = now + p->DhcpRenewInterval; + + UINTToIP(&ip, p->ClientAddressOption.ServerAddress); + + IPCDhcpRenewIP(p->Ipc, &ip); + } + } + } + + IPCProcessL3Events(p->Ipc); + + timeBeforeLoop = Tick64(); + + while (true) + { + UINT64 nowL; + bool no4packets = false; + bool no6packets = false; + if (IPC_PROTO_GET_STATUS(p->Ipc, IPv4State) == IPC_PROTO_STATUS_OPENED) + { + BLOCK *b = IPCRecvIPv4(p->Ipc); + if (b == NULL) + { + no4packets = true; + } + else + { + PPP_PACKET *pp; + PPP_PACKET tmp; + + // Since receiving the IP packet, send it to the client by PPP + pp = &tmp; + pp->IsControl = false; + pp->Protocol = PPP_PROTOCOL_IP; + pp->Lcp = NULL; + pp->Data = b->Buf; + pp->DataSize = b->Size; + + PPPSendPacketEx(p, pp, true); + + FreePPPPacketEx(pp, true); + Free(b); // Not FreeBlock because freed in FreePPPPacketEx + } + } + else + { + no4packets = true; + } + + if (IPC_PROTO_GET_STATUS(p->Ipc, IPv6State) == IPC_PROTO_STATUS_OPENED) + { + BLOCK *b = IPCIPv6Recv(p->Ipc); + if (b == NULL) + { + no6packets = true; + } + else + { + PPP_PACKET *pp; + PPP_PACKET tmp; + + // Since receiving the IP packet, send it to the client by PPP + pp = &tmp; + pp->IsControl = false; + pp->Protocol = PPP_PROTOCOL_IPV6; + pp->Lcp = NULL; + pp->Data = b->Buf; + pp->DataSize = b->Size; + + PPPSendPacketEx(p, pp, true); + + FreePPPPacketEx(pp, true); + Free(b); // Not FreeBlock because freed in FreePPPPacketEx + } + } + else + { + no6packets = true; + } + + // Let's break out of the loop once in a while so we don't get stuck here endlessly + nowL = Tick64(); + if (nowL > timeBeforeLoop + PPP_PACKET_RESEND_INTERVAL || (no4packets && no6packets)) + { + break; + } + } + + FlushTubeFlushList(p->FlushList); + } + + if (p->PPPStatus == PPP_STATUS_AUTH_SUCCESS) + { + Debug("PPP auth success, ready for network layer on next tick\n"); + p->AuthOk = true; + PPPSetStatus(p, PPP_STATUS_NETWORK_LAYER); + } + + if ((p->PPPStatus == PPP_STATUS_CLOSING || p->PPPStatus == PPP_STATUS_FAIL) && IsTubeConnected(p->TubeRecv) && IsTubeConnected(p->TubeSend)) + { + Debug("Trying to cleanly close the connection, status = 0x%x\n", p->PPPStatus); + PPPSetStatus(p, PPP_STATUS_CLOSING_WAIT); + lcp = NewPPPLCP(PPP_LCP_CODE_TERMINATE_REQ, 0); + if (!PPPSendAndRetransmitRequest(p, PPP_PROTOCOL_LCP, lcp)) + { + PPPSetStatus(p, PPP_STATUS_FAIL); + WHERE; + } + } + + if (!PPP_STATUS_IS_UNAVAILABLE(p->PPPStatus) || p->PPPStatus == PPP_STATUS_CLOSING_WAIT) + { + PPPProcessRetransmissions(p); + PPPSendEchoRequest(p); + } + + tubes[0] = p->TubeRecv; + + if (p->PPPStatus == PPP_STATUS_NETWORK_LAYER && p->Ipc != NULL && IsIPCConnected(p->Ipc)) + { + r = GetNextIntervalForInterrupt(p->Ipc->Interrupt); + tubes[1] = p->Ipc->Sock->RecvTube; + WaitForTubes(tubes, 2, MIN(r, PPP_PACKET_RESEND_INTERVAL)); + } + else + { + WaitForTubes(tubes, 1, 300); // Increasing timeout to make the ticks a bit slower + } + + if (IsTubeConnected(p->TubeRecv) == false || IsTubeConnected(p->TubeSend) == false) + { + // Higher-level protocol is disconnected + PPPLog(p, "LP_UPPER_PROTOCOL_DISCONNECTED", p->Postfix); + break; + } + + if (IsIPCConnected(p->Ipc) == false && p->PPPStatus == PPP_STATUS_NETWORK_LAYER) + { + // IPC VPN session is disconnected + PPPLog(p, "LP_VPN_SESSION_TERMINATED"); + break; + } + + // Time-out inspection + if ((p->LastRecvTime + (UINT64)p->DataTimeout) <= now) + { + // Communication time-out occurs + PPPLog(p, "LP_DATA_TIMEOUT"); + break; + } + + // Maximum PPP session time of the user reached inspection + if (p->UserConnectionTick != 0 && p->UserConnectionTimeout != 0 && + p->UserConnectionTick + p->UserConnectionTimeout <= now) + { + // User connection time-out occurs + PPPLog(p, "LP_USER_TIMEOUT"); + break; + } + + // Terminate if the PPP disconnected + if (p->IsTerminateReceived) + { + PPPLog(p, "LP_NORMAL_TERMINATE"); + break; + } + + if (p->PPPStatus == PPP_STATUS_FAIL || p->PPPStatus == PPP_STATUS_CLOSED) + { + Debug("Exiting main dataloop, status = 0x%x\n", p->PPPStatus); + break; + } + } + + Debug("Exited main dataloop, status = 0x%x\n", p->PPPStatus); + + if (p->PPPStatus != PPP_STATUS_FAIL) + { + IP ip; + char tmp[MAX_SIZE]; + + // Disconnected normally + PPPLog(p, "LP_DISCONNECTED"); + + if (p != NULL && p->DhcpAllocated && IsIPCConnected(p->Ipc) && p->ClientAddressOption.ServerAddress != 0) + { + // If any address is assigned from the DHCP, release it + UINTToIP(&ip, p->ClientAddressOption.ServerAddress); + + IPToStr(tmp, sizeof(tmp), &ip); + Debug("Releasing IP Address from DHCP Server %s...\n", tmp); + + IPCDhcpFreeIP(p->Ipc, &ip); + IPCProcessL3Events(p->Ipc); + + SleepThread(300); + } + } + else + { + PPPLog(p, "LP_DISCONNECTED_ABNORMAL"); + } + + FreePPPSession(p); + Debug("PPP Session ended correctly\n"); +} + + +// Entry point + +// Create a new PPP session +PPP_SESSION *NewPPPSession(CEDAR *cedar, IP *client_ip, UINT client_port, IP *server_ip, UINT server_port, TUBE *send_tube, TUBE *recv_tube, char *postfix, char *client_software_name, char *client_hostname, char *crypt_name, UINT adjust_mss) +{ + PPP_SESSION *p; + THREAD *t; + // Validate arguments + if (cedar == NULL || client_ip == NULL || server_ip == NULL || send_tube == NULL || recv_tube == NULL) + { + return NULL; + } + if (IsEmptyStr(postfix)) + { + postfix = "PPP"; + } + if (IsEmptyStr(crypt_name)) + { + crypt_name = ""; + } + if (IsEmptyStr(client_software_name)) + { + client_software_name = "PPP VPN Client"; + } + + // Data structure initialization + p = ZeroMalloc(sizeof(PPP_SESSION)); + + p->EnableMSCHAPv2 = true; + p->AuthProtocol = PPP_UNSPECIFIED; + p->MsChapV2_ErrorCode = 691; + p->EapClient = NULL; + + p->DataTimeout = PPP_DATA_TIMEOUT; + p->PacketRecvTimeout = PPP_PACKET_RECV_TIMEOUT; + p->UserConnectionTimeout = 0; + + p->Cedar = cedar; + AddRef(cedar->ref); + + p->AdjustMss = adjust_mss; + + StrCpy(p->CryptName, sizeof(p->CryptName), crypt_name); + + Copy(&p->ClientIP, client_ip, sizeof(IP)); + p->ClientPort = client_port; + + Copy(&p->ServerIP, server_ip, sizeof(IP)); + p->ServerPort = server_port; + + p->TubeRecv = recv_tube; + p->TubeSend = send_tube; + + AddRef(p->TubeRecv->Ref); + AddRef(p->TubeSend->Ref); + + StrCpy(p->Postfix, sizeof(p->Postfix), postfix); + StrCpy(p->ClientSoftwareName, sizeof(p->ClientSoftwareName), client_software_name); + + if (IsEmptyStr(client_hostname)) + { + IPToStr(p->ClientHostname, sizeof(p->ClientHostname), client_ip); + } + else + { + StrCpy(p->ClientHostname, sizeof(p->ClientHostname), client_hostname); + } + + p->FlushList = NewTubeFlushList(); + + // Thread creation + t = NewThread(PPPThread, p); + + p->SessionThread = t; + + return p; +} + +// PPP processing functions + +// Finds out if a packet is supported, if not - sends a notification to the peer +// result: false - supported, true - unsupported +bool PPPRejectUnsupportedPacket(PPP_SESSION *p, PPP_PACKET *pp) +{ + return PPPRejectUnsupportedPacketEx(p, pp, false); +} +bool PPPRejectUnsupportedPacketEx(PPP_SESSION *p, PPP_PACKET *pp, bool force) +{ + bool result = false; + if (p == NULL || pp == NULL) + { + return false; + } + + if (PPP_IS_SUPPORTED_PROTOCOL(pp->Protocol) == false || force == true) + { + // Unsupported algorithm + PPP_PACKET *pp2 = ZeroMalloc(sizeof(PPP_PACKET)); + BUF *buf; + UCHAR c; + USHORT us; + + Debug("Rejecting PPP protocol = 0x%x\n", pp->Protocol); + result = true; + + pp2->Protocol = PPP_PROTOCOL_LCP; + pp2->IsControl = false; + + buf = NewBuf(); + + // Code + c = PPP_LCP_CODE_PROTOCOL_REJECT; + WriteBuf(buf, &c, 1); + + // ID + c = p->NextId++; + WriteBuf(buf, &c, 1); + + // Length + us = Endian16(pp->DataSize + 6); + WriteBuf(buf, &us, 2); + + // Rejected Protocol + us = Endian16(pp->Protocol); + WriteBuf(buf, &us, 2); + + // Packet Data + WriteBuf(buf, pp->Data, pp->DataSize); + + pp2->Data = Clone(buf->Buf, buf->Size); + pp2->DataSize = buf->Size; + + FreeBuf(buf); + + if (!PPPSendPacketAndFree(p, pp2)) + { + PPPSetStatus(p, PPP_STATUS_FAIL); + WHERE; + } + } + return result; +} + +// Do the retransmissions if needed +bool PPPProcessRetransmissions(PPP_SESSION *p) +{ + INT64 i = 0; + UINT64 now = Tick64(); + UINT64 count; + if (p->SentReqPacketList == NULL) + { + Debug("Somehow SentReqPacketList is NULL!\n"); + return false; + } + // Making it signed but expanding to 64 bits + count = LIST_NUM(p->SentReqPacketList); + if (count == 0) + { + return true; + } + for (i = count - 1; i >= 0; --i) + { + PPP_REQUEST_RESEND *t = LIST_DATA(p->SentReqPacketList, i); + + if (t->TimeoutTime <= now) + { + Debug("Timing out on resending control packet protocol = 0x%x\n", t->Packet->Protocol); + Delete(p->SentReqPacketList, t); + FreePPPPacket(t->Packet); + Free(t); + } + else if (t->ResendTime <= now) + { + Debug("Resending control packet protocol = 0x%x\n", t->Packet->Protocol); + if (!PPPSendPacketEx(p, t->Packet, false)) + { + PPPSetStatus(p, PPP_STATUS_FAIL); + WHERE; + return false; + } + t->ResendTime = now + PPP_PACKET_RESEND_INTERVAL; + } + } + return true; +} + +// Send the PPP Echo Request +bool PPPSendEchoRequest(PPP_SESSION *p) +{ + // Validate arguments + if (p == NULL) + { + return false; + } + + UINT64 now = Tick64(); + if (p->NextEchoSendTime == 0 || now >= p->NextEchoSendTime) + { + PPP_PACKET *pp; + char echo_data[] = "\0\0\0\0Aho Baka Manuke"; + + p->NextEchoSendTime = now + (UINT64)PPP_ECHO_SEND_INTERVAL; + if (IsIPCConnected(p->Ipc)) + { + AddInterrupt(p->Ipc->Interrupt, p->NextEchoSendTime); + } + + pp = ZeroMalloc(sizeof(PPP_PACKET)); + pp->Protocol = PPP_PROTOCOL_LCP; + pp->IsControl = true; + pp->Lcp = NewPPPLCP(PPP_LCP_CODE_ECHO_REQUEST, 0); + + pp->Lcp->Data = Clone(echo_data, sizeof(echo_data)); + pp->Lcp->DataSize = sizeof(echo_data); + + if (!PPPSendPacketAndFree(p, pp)) + { + PPPSetStatus(p, PPP_STATUS_FAIL); + WHERE; + return false; + } + return true; + } + return false; +} + +// Processes response packets +bool PPPProcessResponsePacket(PPP_SESSION *p, PPP_PACKET *pp, PPP_PACKET *req) +{ + if (req == NULL) + { + Debug("We received a response for... What? We never sent this request, protocol = 0x%x, code = 0x%x\n", pp->Protocol, pp->Lcp->Code); + // Let's just discard this, as this was probably already parsed, and we just stumbled upon a resend + return false; + } + + switch (pp->Protocol) + { + case PPP_PROTOCOL_LCP: + return PPPProcessLCPResponsePacket(p, pp, req); + break; + case PPP_PROTOCOL_PAP: + Debug("Got a response PAP, which is invalid, we should get a request instead\n"); + PPPSetStatus(p, PPP_STATUS_FAIL); + WHERE; + return false; + break; + case PPP_PROTOCOL_CHAP: + return PPPProcessCHAPResponsePacket(p, pp, req); + break; + case PPP_PROTOCOL_IPCP: + return PPPProcessIPCPResponsePacket(p, pp, req); + break; + case PPP_PROTOCOL_IPV6CP: + return PPPProcessIPv6CPResponsePacket(p, pp, req); + break; + case PPP_PROTOCOL_EAP: + return PPPProcessEAPResponsePacket(p, pp, req); + break; + default: + Debug("We received a response for an unsupported protocol??? Should be filtered out already! protocol = 0x%x, code = 0x%x\n", pp->Protocol, pp->Lcp->Code); + PPPSetStatus(p, PPP_STATUS_FAIL); + WHERE; + return false; + } + + return false; +} + +bool PPPProcessLCPResponsePacket(PPP_SESSION *p, PPP_PACKET *pp, PPP_PACKET *req) +{ + UINT i; + bool isAccepted = !PPP_LCP_CODE_IS_NEGATIVE(pp->Lcp->Code); + bool result = true; + // MSCHAPv2 code + UCHAR ms_chap_v2_code[3]; + WRITE_USHORT(ms_chap_v2_code, PPP_LCP_AUTH_CHAP); + ms_chap_v2_code[2] = PPP_CHAP_ALG_MS_CHAP_V2; + + // We got one of rejects here, not NACKs + if (!isAccepted && pp->Lcp->Code == PPP_LCP_CODE_PROTOCOL_REJECT) + { + // If we receive a protocol reject before we finished authenticating + // probably means the PPP client is not compatible anyway so we fail the connection + if (p->PPPStatus != PPP_STATUS_NETWORK_LAYER) + { + USHORT *protocol = pp->Lcp->Data; + Debug("Protocol 0x%x rejected before auth, probably unsupported client, failing connection\n", *protocol); + PPPSetStatus(p, PPP_STATUS_FAIL); + WHERE; + return false; + } + else + { + USHORT *protocol = pp->Lcp->Data; + if (*protocol == PPP_PROTOCOL_IPCP || *protocol == PPP_PROTOCOL_IP) + { + IPC_PROTO_SET_STATUS(p->Ipc, IPv4State, IPC_PROTO_STATUS_REJECTED); + } + if (*protocol == PPP_PROTOCOL_IPV6CP || *protocol == PPP_PROTOCOL_IPV6) + { + IPC_PROTO_SET_STATUS(p->Ipc, IPv6State, IPC_PROTO_STATUS_REJECTED); + } + } + } + + if (!isAccepted && pp->Lcp->Code == PPP_LCP_CODE_CODE_REJECT) + { + PPPSetStatus(p, PPP_STATUS_FAIL); + WHERE; + return false; + } + + for (i = 0; i < LIST_NUM(pp->Lcp->OptionList); i++) + { + PPP_OPTION *t = LIST_DATA(pp->Lcp->OptionList, i); + PPP_OPTION *opt = NULL; + + switch (t->Type) + { + case PPP_LCP_OPTION_MRU: + // MRU + if (t->DataSize == sizeof(USHORT)) + { + USHORT value = READ_USHORT(t->Data); + if (!isAccepted) + { + if (pp->Lcp->Code != PPP_LCP_CODE_NAK) + { + Debug("MRU setup failed, rejected"); + p->Mru1 = p->Mru2 = PPP_MRU_DEFAULT; + } + if (value < PPP_MRU_MIN || value > PPP_MRU_MAX) + { + Debug("Couldn't agree on an MRU! Breaking link... MRU = 0x%x\n", value); + PPPSetStatus(p, PPP_STATUS_FAIL); + WHERE; + return false; + } + else + { + PPP_LCP *lcp = NewPPPLCP(PPP_LCP_CODE_REQ, 0); + Add(lcp->OptionList, NewPPPOption(PPP_LCP_OPTION_AUTH, &value, sizeof(USHORT))); + if (!PPPSendAndRetransmitRequest(p, PPP_PROTOCOL_LCP, lcp)) + { + PPPSetStatus(p, PPP_STATUS_FAIL); + WHERE; + return false; + } + Debug("PPP: Server got %u as MRU from NACK, re-requesting\n", p->Mru2); + } + } + else if (value < PPP_MRU_MIN || value > PPP_MRU_MAX) + { + Debug("The client somehow ACKed an invalid MRU, breaking link... MRU = 0x%x\n", value); + PPPSetStatus(p, PPP_STATUS_FAIL); + WHERE; + result = false; + } + else + { + p->Mru2 = value; + Debug("PPP: Server set %u as MRU\n", p->Mru2); + } + } + break; + case PPP_LCP_OPTION_AUTH: + opt = PPPGetOptionValue(req->Lcp, PPP_LCP_OPTION_AUTH); + if (opt == NULL) + { + Debug("We got some weird response with option absent in request, wut? Disconnecting\n"); + PPPSetStatus(p, PPP_STATUS_FAIL); + WHERE; + return false; + } + if (opt->DataSize == sizeof(USHORT) && *((USHORT *)(opt->Data)) == Endian16(PPP_LCP_AUTH_EAP)) + { + // Try to request MS-CHAPv2 then + if (!isAccepted) + { + UINT64 offer = 0; + PPP_LCP *c = NewPPPLCP(PPP_LCP_CODE_REQ, 0); + UCHAR ms_chap_v2_code[3]; + + WRITE_USHORT(ms_chap_v2_code, PPP_LCP_AUTH_CHAP); + ms_chap_v2_code[2] = PPP_CHAP_ALG_MS_CHAP_V2; + + Copy(&offer, ms_chap_v2_code, sizeof(ms_chap_v2_code)); + Debug("NACK proto with code = 0x%x, cypher = 0x%x, offered cypher = 0x%x\n", pp->Lcp->Code, *((USHORT *)(opt->Data)), offer); + Debug("Request MSCHAPv2\n"); + Add(c->OptionList, NewPPPOption(PPP_LCP_OPTION_AUTH, &ms_chap_v2_code, sizeof(ms_chap_v2_code))); + if (!PPPSendAndRetransmitRequest(p, PPP_PROTOCOL_LCP, c)) + { + PPPSetStatus(p, PPP_STATUS_FAIL); + WHERE; + return false; + } + } + else + { + p->AuthProtocol = PPP_PROTOCOL_EAP; + Debug("Setting BEFORE_AUTH from ACK on LCP response parse on EAP accept\n"); + PPPSetStatus(p, PPP_STATUS_BEFORE_AUTH); + } + } + else if (opt->DataSize == sizeof(ms_chap_v2_code) && Cmp(opt->Data, ms_chap_v2_code, opt->DataSize) == 0) + { + // Try to request PAP then + if (!isAccepted || !p->EnableMSCHAPv2) + { + UINT64 offer = 0; + PPP_LCP *c = NewPPPLCP(PPP_LCP_CODE_REQ, 0); + USHORT proto = Endian16(PPP_LCP_AUTH_PAP); + Copy(&offer, t->Data, t->DataSize > sizeof(UINT64) ? sizeof(UINT64) : t->DataSize); + Debug("NACK proto with code = 0x%x, cypher = 0x%x, offered cypher = 0x%x\n", pp->Lcp->Code, *((USHORT *)(opt->Data)), offer); + Debug("Request PAP\n"); + Add(c->OptionList, NewPPPOption(PPP_LCP_OPTION_AUTH, &proto, sizeof(USHORT))); + if (!PPPSendAndRetransmitRequest(p, PPP_PROTOCOL_LCP, c)) + { + PPPSetStatus(p, PPP_STATUS_FAIL); + WHERE; + return false; + } + } + else if (p->AuthProtocol == PPP_UNSPECIFIED) + { + p->AuthProtocol = PPP_PROTOCOL_CHAP; + Debug("Setting BEFORE_AUTH from ACK on LCP response parse on CHAP accept\n"); + PPPSetStatus(p, PPP_STATUS_BEFORE_AUTH); + } + + } + else if (opt->DataSize == sizeof(USHORT) && *((USHORT *)(opt->Data)) == Endian16(PPP_LCP_AUTH_PAP)) + { + // We couldn't agree on auth proto, failing connection + if (!isAccepted) + { + UINT64 offer = 0; + Copy(&offer, t->Data, t->DataSize > sizeof(UINT64) ? sizeof(UINT64) : t->DataSize); + Debug("NACK proto with code = 0x%x, cypher = 0x%x, offered cypher = 0x%x\n", pp->Lcp->Code, *((USHORT *)(opt->Data)), offer); + Debug("Couldn't agree on auth protocol!\n"); + PPPLog(p, "LP_PAP_MSCHAPV2_REJECTED"); + PPPSetStatus(p, PPP_STATUS_FAIL); + WHERE; + return false; + } + else if (p->AuthProtocol == PPP_UNSPECIFIED) + { + p->AuthProtocol = PPP_PROTOCOL_PAP; + Debug("Setting BEFORE_AUTH from ACK on LCP response parse on PAP accept\n"); + PPPSetStatus(p, PPP_STATUS_BEFORE_AUTH); + } + } + break; + } + } + + return result; +} + +// Process CHAP responses +bool PPPProcessCHAPResponsePacket(PPP_SESSION *p, PPP_PACKET *pp, PPP_PACKET *req) +{ + PPP_LCP *lcp; + if (pp->Lcp->Code == PPP_CHAP_CODE_RESPONSE) + { + bool ok = false; + if (p->PPPStatus != PPP_STATUS_AUTHENTICATING && !p->AuthOk) + { + Debug("Receiving CHAP response packets outside of auth status, some errors probably!"); + PPPSetStatus(p, PPP_STATUS_FAIL); + WHERE; + return false; + } + if (p->AuthProtocol != PPP_PROTOCOL_CHAP) + { + Debug("Receiving CHAP packet when auth protocol set to 0x%x\n", p->AuthProtocol); + PPPLog(p, "LP_NEXT_PROTOCOL_IS_NOT_PAP", pp->Protocol); + PPPRejectUnsupportedPacketEx(p, pp, true); + return false; + } + + ok = PPPParseMSCHAP2ResponsePacket(p, pp); + + // If we got only first packet of double CHAP then send second challenge + if (ok && p->MsChapV2_UseDoubleMsChapV2 && p->EapClient != NULL && p->Ipc == NULL) + { + lcp = BuildMSCHAP2ChallengePacket(p); + if (!PPPSendAndRetransmitRequest(p, PPP_PROTOCOL_CHAP, lcp)) + { + PPPSetStatus(p, PPP_STATUS_FAIL); + WHERE; + return false; + } + } + // We got a successful MSCHAPv2 response, so let's send a SUCCESS + else if (ok) + { + char hex[MAX_SIZE]; + char ret_str[MAX_SIZE]; + BUF *lcp_ret_data = NewBuf(); + PPP_PACKET *res = ZeroMalloc(sizeof(PPP_PACKET)); + BinToStr(hex, sizeof(hex), p->MsChapV2_ServerResponse, 20); + + Format(ret_str, sizeof(ret_str), + "S=%s", hex); + + WriteBuf(lcp_ret_data, ret_str, StrLen(ret_str)); + + lcp = NewPPPLCP(PPP_CHAP_CODE_SUCCESS, p->MsChapV2_PacketId); + lcp->Data = Clone(lcp_ret_data->Buf, lcp_ret_data->Size); + lcp->DataSize = lcp_ret_data->Size; + + if (lcp_ret_data != NULL) + { + FreeBuf(lcp_ret_data); + } + + res->Lcp = lcp; + res->IsControl = true; + res->Protocol = PPP_PROTOCOL_CHAP; + + if (!PPPSendPacketAndFree(p, res)) + { + PPPSetStatus(p, PPP_STATUS_FAIL); + WHERE; + return false; + } + + p->AuthOk = true; + PPPSetStatus(p, PPP_STATUS_AUTH_SUCCESS); + } + // We failed MSCHAPv2 auth + else + { + char hex[MAX_SIZE]; + char ret_str[MAX_SIZE]; + BUF *lcp_ret_data = NewBuf(); + PPP_PACKET *res = ZeroMalloc(sizeof(PPP_PACKET)); + + BinToStr(hex, sizeof(hex), p->MsChapV2_ServerChallenge, 16); + + Format(ret_str, sizeof(ret_str), + "E=%u R=0 C=%s V=3", p->MsChapV2_ErrorCode, hex); + + WriteBuf(lcp_ret_data, ret_str, StrLen(ret_str)); + + lcp = NewPPPLCP(PPP_CHAP_CODE_FAILURE, p->MsChapV2_PacketId); + lcp->Data = Clone(lcp_ret_data->Buf, lcp_ret_data->Size); + lcp->DataSize = lcp_ret_data->Size; + + if (lcp_ret_data != NULL) + { + FreeBuf(lcp_ret_data); + } + + res->Lcp = lcp; + res->IsControl = true; + res->Protocol = PPP_PROTOCOL_CHAP; + + if (!PPPSendPacketAndFree(p, res)) + { + PPPSetStatus(p, PPP_STATUS_FAIL); + WHERE; + return false; + } + + PPPLog(p, "LP_CHAP_FAILED"); + PPPSetStatus(p, PPP_STATUS_AUTH_FAIL); + } + + return ok; + } + return false; +} + +// Process IPCP responses +bool PPPProcessIPCPResponsePacket(PPP_SESSION *p, PPP_PACKET *pp, PPP_PACKET *req) +{ + bool isAccepted = !PPP_LCP_CODE_IS_NEGATIVE(pp->Lcp->Code); + + IP addrStruct; + char addrStr[MAX_SIZE]; + UINT addr; + IP prevAddrStruct; + char prevAddrStr[MAX_SIZE]; + UINT prevAddr; + PPP_LCP *c; + UINT ui; + + if (!PPPGetIPAddressValueFromLCP(pp->Lcp, PPP_IPCP_OPTION_IP, &addrStruct) || pp->Lcp->Code == PPP_LCP_CODE_REJECT || pp->Lcp->Code == PPP_LCP_CODE_CODE_REJECT) + { + Debug("Unsupported IPCP protocol"); + IPC_PROTO_SET_STATUS(p->Ipc, IPv4State, IPC_PROTO_STATUS_REJECTED); + PPPRejectUnsupportedPacketEx(p, pp, true); + return false; + } + + // We're dealing either with ACK or NACK + addr = IPToUINT(&addrStruct); + IPToStr(addrStr, MAX_SIZE, &addrStruct); + + if (isAccepted) + { + Debug("Accepted server IP address of %s\n", addrStr); + + // We already configured client address, now server address is also confirmed, ready for IPv4 data flow + if (IPC_PROTO_GET_STATUS(p->Ipc, IPv4State) == IPC_PROTO_STATUS_CONFIG) + { + IPC_PROTO_SET_STATUS(p->Ipc, IPv4State, IPC_PROTO_STATUS_CONFIG_WAIT); + } + return true; + } + + IPC_PROTO_SET_STATUS(p->Ipc, IPv4State, IPC_PROTO_STATUS_CONFIG); + + PPPGetIPAddressValueFromLCP(req->Lcp, PPP_IPCP_OPTION_IP, &prevAddrStruct); + prevAddr = IPToUINT(&prevAddrStruct); + IPToStr(prevAddrStr, MAX_SIZE, &prevAddrStruct); + + Debug("Denied server IP address %s, proposed %s\n", prevAddrStr, addrStr); + + // Fallback mechanism - just request 192.0.0.8 + if (prevAddr == Endian32(0xc0000008)) + { + Debug("We already tried the fallback IP of 192.0.0.8, giving up\n"); + IPC_PROTO_SET_STATUS(p->Ipc, IPv4State, IPC_PROTO_STATUS_REJECTED); + PPPRejectUnsupportedPacketEx(p, pp, true); + return false; + } + + c = NewPPPLCP(PPP_LCP_CODE_REQ, 0); + ui = Endian32(0xc0000008); // We always push 192.0.0.8, which is defined in RFC7600 as dummy IPv4 address. + Add(c->OptionList, NewPPPOption(PPP_IPCP_OPTION_IP, &ui, sizeof(UINT))); + if (!PPPSendAndRetransmitRequest(p, PPP_PROTOCOL_IPCP, c)) + { + PPPSetStatus(p, PPP_STATUS_FAIL); + WHERE; + return false; + } + + return false; +} + +// Process EAP responses +bool PPPProcessEAPResponsePacket(PPP_SESSION *p, PPP_PACKET *pp, PPP_PACKET *req) +{ + if (pp->Lcp->DataSize >= 1) + { + PPP_EAP *eap_packet = pp->Lcp->Data; + UINT eap_datasize = pp->Lcp->DataSize - 1; + UINT64 offer = 0; + PPP_LCP *c; + UCHAR ms_chap_v2_code[3]; + + WRITE_USHORT(ms_chap_v2_code, PPP_LCP_AUTH_CHAP); + ms_chap_v2_code[2] = PPP_CHAP_ALG_MS_CHAP_V2; + + switch (eap_packet->Type) + { + case PPP_EAP_TYPE_IDENTITY: + Copy(p->Eap_Identity, eap_packet->Data, MIN(MAX_SIZE, eap_datasize)); + // As we received the identity packet, we switch back to BEFORE_AUTH and switch to the EAP_TLS proto to send the TlsStart packet on the next tick + p->Eap_Protocol = PPP_EAP_TYPE_TLS; + PPPSetStatus(p, PPP_STATUS_BEFORE_AUTH); + break; + case PPP_EAP_TYPE_NOTIFICATION: + // Basically this is just an acknoweldgment that the notification was accepted by the client. Nothing to do here... + break; + case PPP_EAP_TYPE_NAK: + /// TODO: implement alternative EAP protocol selection based on received NAK + // For now just fallback to auth protocol selection to try to select MSCHAP or PAP + Debug("Got a EAP_NAK, abandoning EAP protocol\n"); + PPPRejectUnsupportedPacketEx(p, pp, true); + PPPSetStatus(p, PPP_STATUS_CONNECTED); + + c = NewPPPLCP(PPP_LCP_CODE_REQ, 0); + Copy(&offer, ms_chap_v2_code, sizeof(ms_chap_v2_code)); + Debug("Request MSCHAPv2 from EAP NAK\n"); + Add(c->OptionList, NewPPPOption(PPP_LCP_OPTION_AUTH, &ms_chap_v2_code, sizeof(ms_chap_v2_code))); + if (!PPPSendAndRetransmitRequest(p, PPP_PROTOCOL_LCP, c)) + { + PPPSetStatus(p, PPP_STATUS_FAIL); + WHERE; + return false; + } + break; + case PPP_EAP_TYPE_TLS: + PPPProcessEAPTlsResponse(p, eap_packet, eap_datasize); + break; + default: + Debug("We got an unexpected EAP response packet! Ignoring...\n"); + break; + } + } + else + { + PPP_EAP *eap; + + Debug("We got a CODE=%i ID=%i from client with zero size EAP structure, that shouldn't be happening!\n", pp->Lcp->Code, pp->Lcp->Id); + + eap = req->Lcp->Data; + if (eap->Type == PPP_EAP_TYPE_TLS) + { + PPP_LCP *lcp = BuildEAPTlsRequest(p->Eap_PacketId++, 0, PPP_EAP_TLS_FLAG_NONE); + if (!PPPSendAndRetransmitRequest(p, PPP_PROTOCOL_EAP, lcp)) + { + PPPSetStatus(p, PPP_STATUS_FAIL); + WHERE; + return false; + } + } + } + return false; +} + +// Process IPv6CP responses +bool PPPProcessIPv6CPResponsePacket(PPP_SESSION *p, PPP_PACKET *pp, PPP_PACKET *req) +{ + bool isAccepted = !PPP_LCP_CODE_IS_NEGATIVE(pp->Lcp->Code); + + // If we got a reject or a NACK, we just reject the whole IPv6 configuration, there is no way we can recover even from a NACK as we can't change the link-local address of an already existing router + if (!isAccepted) + { + Debug("Unsupported IPv6CP protocol"); + IPC_PROTO_SET_STATUS(p->Ipc, IPv6State, IPC_PROTO_STATUS_REJECTED); + PPPRejectUnsupportedPacketEx(p, pp, true); + return false; + } + + if (IPC_PROTO_GET_STATUS(p->Ipc, IPv6State) != IPC_PROTO_STATUS_CONFIG) + { + Debug("We got an early IPv6CP response, ignoring for now...\n"); + return false; + } + + Debug("Accepted server IPv6CP handshake\n"); + IPC_PROTO_SET_STATUS(p->Ipc, IPv6State, IPC_PROTO_STATUS_CONFIG_WAIT); + return true; +} + + +// Processes request packets +bool PPPProcessRequestPacket(PPP_SESSION *p, PPP_PACKET *pp) +{ + switch (pp->Protocol) + { + case PPP_PROTOCOL_LCP: + return PPPProcessLCPRequestPacket(p, pp); + break; + case PPP_PROTOCOL_PAP: + return PPPProcessPAPRequestPacket(p, pp); + break; + case PPP_PROTOCOL_CHAP: + Debug("Got a CHAP request, which is invalid, we should get CHAP response instead\n"); + PPPSetStatus(p, PPP_STATUS_FAIL); + WHERE; + return false; + break; + case PPP_PROTOCOL_IPCP: + return PPPProcessIPCPRequestPacket(p, pp); + break; + case PPP_PROTOCOL_IPV6CP: + return PPPProcessIPv6CPRequestPacket(p, pp); + break; + case PPP_PROTOCOL_EAP: + return PPPProcessEAPRequestPacket(p, pp); + break; + default: + Debug("Unsupported protocols should be already filtered out! protocol = 0x%x, code = 0x%x\n", pp->Protocol, pp->Lcp->Code); + return false; + break; + } + return false; +} + +bool PPPProcessLCPRequestPacket(PPP_SESSION *p, PPP_PACKET *pp) +{ + bool result = true; + UINT i = 0; + + USHORT NegotiatedAuthProto = PPP_UNSPECIFIED; + USHORT NegotiatedMRU = PPP_UNSPECIFIED; + // MSCHAPv2 code + UCHAR ms_chap_v2_code[3]; + USHORT eap_code = PPP_LCP_AUTH_EAP; + + WRITE_USHORT(ms_chap_v2_code, PPP_LCP_AUTH_CHAP); + ms_chap_v2_code[2] = PPP_CHAP_ALG_MS_CHAP_V2; + + Debug("Got LCP packet request ID=%i OptionsListSize=%i\n", pp->Lcp->Id, LIST_NUM(pp->Lcp->OptionList)); + + for (i = 0; i < LIST_NUM(pp->Lcp->OptionList); i++) + { + PPP_OPTION *t = LIST_DATA(pp->Lcp->OptionList, i); + + switch (t->Type) + { + case PPP_LCP_OPTION_AUTH: + t->IsSupported = true; + if (t->DataSize == sizeof(USHORT) && *((USHORT *)t->Data) == PPP_LCP_AUTH_EAP && p->AuthProtocol == PPP_UNSPECIFIED) + { + t->IsAccepted = true; + NegotiatedAuthProto = PPP_PROTOCOL_EAP; + } + else if (t->DataSize == sizeof(USHORT) && *((USHORT *)t->Data) == PPP_LCP_AUTH_PAP && p->AuthProtocol == PPP_UNSPECIFIED) + { + t->IsAccepted = true; + NegotiatedAuthProto = PPP_PROTOCOL_PAP; + } + else if (t->DataSize == sizeof(ms_chap_v2_code) && Cmp(t->Data, ms_chap_v2_code, t->DataSize) == 0 && p->AuthProtocol == PPP_UNSPECIFIED) + { + t->IsAccepted = true; + NegotiatedAuthProto = PPP_PROTOCOL_CHAP; + } + else + { + // We're recommending EAP by default as a more secure algo + t->IsAccepted = false; + t->AltDataSize = sizeof(eap_code); + Copy(t->AltData, &eap_code, sizeof(eap_code)); + } + break; + case PPP_LCP_OPTION_MRU: + t->IsSupported = true; + if (t->DataSize == sizeof(USHORT)) + { + USHORT value = READ_USHORT(t->Data); + if (value < PPP_MRU_MIN || value > PPP_MRU_MAX) + { + t->IsAccepted = false; + value = MAKESURE(value, PPP_MRU_MIN, PPP_MRU_MAX); + //Debug("MRU not accepted, sending NACK with value = 0x%x\n", value); + t->AltDataSize = sizeof(USHORT); + WRITE_USHORT(t->AltData, value); + } + else + { + t->IsAccepted = true; + NegotiatedMRU = value; + //Debug("MRU accepted, value = 0x%x\n", value); + } + } + else + { + t->IsAccepted = false; + t->AltDataSize = sizeof(USHORT); + WRITE_USHORT(t->AltData, PPP_MRU_DEFAULT); + } + break; + default: + t->IsSupported = false; + Debug("Unsupported LCP option = 0x%x\n", t->Type); + break; + } + } + + if (PPPRejectLCPOptions(p, pp)) + { + Debug("Rejected LCP options...\n"); + return false; + } + + if (PPPNackLCPOptions(p, pp)) + { + Debug("NACKed LCP options...\n"); + return false; + } + + if (!PPPAckLCPOptions(p, pp)) + { + return false; + } + + if (NegotiatedAuthProto != PPP_UNSPECIFIED) + { + if (p->AuthProtocol == PPP_UNSPECIFIED) + { + p->AuthProtocol = NegotiatedAuthProto; + PPPSetStatus(p, PPP_STATUS_BEFORE_AUTH); + Debug("Setting BEFORE_AUTH from REQ on LCP request parse\n"); + } + } + if (NegotiatedMRU != PPP_UNSPECIFIED) + { + p->Mru1 = NegotiatedMRU; + } + + return true; +} + +bool PPPProcessPAPRequestPacket(PPP_SESSION *p, PPP_PACKET *pp) +{ + if (p->PPPStatus != PPP_STATUS_BEFORE_AUTH && !p->AuthOk) + { + PPP_LCP *lcp = NewPPPLCP(PPP_PAP_CODE_NAK, pp->Lcp->Id); + PPP_PACKET *ret = ZeroMalloc(sizeof(PPP_PACKET)); + + Debug("Got a PAP request before we're ready for AUTH procedure!\n"); + + ret->IsControl = true; + ret->Protocol = PPP_PROTOCOL_PAP; + ret->Lcp = lcp; + if (!PPPSendPacketAndFree(p, ret)) + { + PPPSetStatus(p, PPP_STATUS_FAIL); + WHERE; + return false; + } + + return false; + } + if (p->AuthProtocol != PPP_PROTOCOL_PAP) + { + Debug("Trying to auth with PAP when should be 0x%x\n", p->AuthProtocol); + PPPLog(p, "LP_NEXT_PROTOCOL_IS_NOT_CHAP", pp->Protocol); + + // Forcing rejection of PAP on configured MSCHAPv2 + PPPRejectUnsupportedPacketEx(p, pp, true); + + return false; + } + if (!p->AuthOk) + { + UCHAR *data; + UINT size; + + PPPSetStatus(p, PPP_STATUS_AUTHENTICATING); + + if (p->Ipc == NULL) + { + // PAP + + // Extract the ID and the password + data = pp->Lcp->Data; + size = pp->Lcp->DataSize; + + if (size >= 1) + { + UCHAR len_id = data[0]; + data++; + size--; + + if (size >= len_id) + { + char username[256]; + char password[256]; + + Zero(username, sizeof(username)); + Zero(password, sizeof(password)); + + Copy(username, data, len_id); + data += len_id; + size -= len_id; + + if (size >= 1) + { + UCHAR len_pass = data[0]; + data++; + size--; + + if (size >= len_pass) + { + IPC *ipc; + char id[MAX_SIZE]; + char hub[MAX_SIZE]; + ETHERIP_ID d; + + Zero(id, sizeof(id)); + Zero(hub, sizeof(hub)); + + Copy(password, data, len_pass); + + Debug("PPP: id=%s, pw=%s\n", username, password); + + // The user name is divided into the ID and the virtual HUB name + Zero(&d, sizeof(d)); + PPPParseUsername(p->Cedar, username, &d); + + StrCpy(id, sizeof(id), d.UserName); + StrCpy(hub, sizeof(hub), d.HubName); + + if (IsEmptyStr(id) == false) + { + // Attempt to connect with IPC + UINT error_code; + + ipc = NewIPC(p->Cedar, p->ClientSoftwareName, p->Postfix, hub, id, password, + &error_code, &p->ClientIP, p->ClientPort, &p->ServerIP, p->ServerPort, + p->ClientHostname, p->CryptName, false, p->AdjustMss, NULL, NULL, + IPC_LAYER_3); + + if (ipc != NULL) + { + p->Ipc = ipc; + + // Setting user timeouts + p->PacketRecvTimeout = (UINT64)p->Ipc->Policy->TimeOut * 1000 * 3 / 4; // setting to 3/4 of the user timeout + p->DataTimeout = (UINT64)p->Ipc->Policy->TimeOut * 1000; + p->UserConnectionTimeout = (UINT64)p->Ipc->Policy->AutoDisconnect * 1000; + p->UserConnectionTick = Tick64(); + + p->AuthOk = true; + } + else + { + PPPSetStatus(p, PPP_STATUS_FAIL); + WHERE; + return false; + } + } + } + } + } + } + } + else + { + // Return success for a request from the second time when it is successfully authenticated once + p->AuthOk = true; + } + } + if (p->AuthOk) + { + PPP_LCP *lcp = NewPPPLCP(PPP_PAP_CODE_ACK, pp->Lcp->Id); + PPP_PACKET *ret = ZeroMalloc(sizeof(PPP_PACKET)); + ret->IsControl = true; + ret->Protocol = PPP_PROTOCOL_PAP; + ret->Lcp = lcp; + if (!PPPSendPacketAndFree(p, ret)) + { + PPPSetStatus(p, PPP_STATUS_FAIL); + WHERE; + return false; + } + + if (p->PPPStatus == PPP_STATUS_AUTHENTICATING) + { + PPPSetStatus(p, PPP_STATUS_AUTH_SUCCESS); + } + return true; + } + if (!p->AuthOk) + { + PPP_LCP *lcp = NewPPPLCP(PPP_PAP_CODE_NAK, pp->Lcp->Id); + PPP_PACKET *ret = ZeroMalloc(sizeof(PPP_PACKET)); + ret->IsControl = true; + ret->Protocol = PPP_PROTOCOL_PAP; + ret->Lcp = lcp; + if (!PPPSendPacketAndFree(p, ret)) + { + PPPSetStatus(p, PPP_STATUS_FAIL); + WHERE; + return false; + } + + if (p->PPPStatus == PPP_STATUS_AUTHENTICATING) + { + PPPSetStatus(p, PPP_STATUS_AUTH_FAIL); + PPPLog(p, "LP_PAP_FAILED"); + } + + return false; + } + return p->AuthOk; +} + + +bool PPPProcessIPCPRequestPacket(PPP_SESSION *p, PPP_PACKET *pp) +{ + PPP_IPOPTION o; + PPP_IPOPTION res; + PPP_OPTION *dummyIpOption; + UINT dummyIp = 0; + DHCP_OPTION_LIST cao; + IP client_ip; + IP subnet; + IP zero; + IP gw; + bool ok = true; + bool processed = false; + bool isEmptyIpAddress = false; + + if (IPC_PROTO_GET_STATUS(p->Ipc, IPv4State) == IPC_PROTO_STATUS_REJECTED) + { + Debug("We got an IPCP packet after we had it rejected\n"); + return PPPRejectUnsupportedPacketEx(p, pp, true); + } + + if (!PPPGetIPOptionFromLCP(&o, pp->Lcp)) + { + Debug("IPCP request without client IP address received! Treating as zeroed out client IP...\n"); + isEmptyIpAddress = true; + dummyIpOption = NewPPPOption(PPP_IPCP_OPTION_IP, &dummyIp, sizeof(UINT)); + dummyIpOption->IsSupported = true; + dummyIpOption->IsAccepted = false; + Add(pp->Lcp->OptionList, dummyIpOption); + } + + // Process if not configured yet by server + if ((IsZero(&p->ClientAddressOption, sizeof(DHCP_OPTION_LIST)) || isEmptyIpAddress) && ok) + { + // Decide if we received a static IP from client and it is allowed + if (IsZeroIP(&o.IpAddress) == false) + { + if (p->Ipc->Policy->DHCPForce == false) + { + if (p->DhcpAllocated == false) + { + if (p->UseStaticIPAddress == false) + { + DHCP_OPTION_LIST cao; + + // The client specify an IP address + Zero(&cao, sizeof(cao)); + + cao.ClientAddress = IPToUINT(&o.IpAddress); + + Copy(&p->ClientAddressOption, &cao, sizeof(cao)); + + p->UseStaticIPAddress = true; + } + } + } + } + else + { + p->UseStaticIPAddress = false; + } + + // Get additional information for static clients + if (p->UseStaticIPAddress) + { + if (p->DhcpIpInformTried == false) + { + // Get additional information such as the subnet mask from the DHCP server + SetIP(&subnet, 255, 0, 0, 0); + Zero(&zero, sizeof(zero)); + + UINTToIP(&client_ip, p->ClientAddressOption.ClientAddress); + + Zero(&cao, sizeof(cao)); + + IPCSetIPv4Parameters(p->Ipc, &client_ip, &subnet, &zero, NULL); + + p->DhcpIpInformTried = true; + + PPPLog(p, "LP_DHCP_INFORM_TRYING"); + + if (IPCDhcpRequestInformIP(p->Ipc, &cao, p->TubeRecv, &client_ip)) + { + Debug("IPCDhcpRequestInformIP ok.\n"); + Copy(&p->ClientAddressOption, &cao, sizeof(cao)); + p->ClientAddressOption.ClientAddress = IPToUINT(&client_ip); + + if (true) + { + char server_ip_str[64]; + char subnet_str[64], defgw_str[64]; + char dns1_str[64], dns2_str[64]; + char wins1_str[64], wins2_str[64]; + + IPToStr32(server_ip_str, sizeof(server_ip_str), cao.ServerAddress); + IPToStr32(subnet_str, sizeof(subnet_str), cao.SubnetMask); + IPToStr32(defgw_str, sizeof(defgw_str), cao.Gateway); + IPToStr32(dns1_str, sizeof(dns1_str), cao.DnsServer); + IPToStr32(dns2_str, sizeof(dns2_str), cao.DnsServer2); + IPToStr32(wins1_str, sizeof(wins1_str), cao.WinsServer); + IPToStr32(wins2_str, sizeof(wins2_str), cao.WinsServer2); + + PPPLog(p, "LP_DHCP_INFORM_OK", + subnet_str, defgw_str, cao.DomainName, + dns1_str, dns2_str, wins1_str, wins2_str, + server_ip_str); + } + } + else + { + Debug("IPCDhcpRequestInformIP failed.\n"); + ok = false; + p->DhcpIpInformTried = false; + PPPLog(p, "LP_DHCP_INFORM_NG"); + } + + IPCSetIPv4Parameters(p->Ipc, &zero, &zero, &zero, NULL); + } + } + // Get IP address and additional information from DHCP + else + { + if (p->DhcpIpAllocTried == false) + { + DHCP_OPTION_LIST cao; + + Zero(&cao, sizeof(cao)); + p->DhcpIpAllocTried = true; + + PPPLog(p, "LP_DHCP_REQUEST_TRYING"); + + if (IPCDhcpAllocateIP(p->Ipc, &cao, p->TubeRecv)) + { + UINT t; + + Debug("IPCDhcpAllocateIP ok.\n"); + + // IP address has been determined + Copy(&p->ClientAddressOption, &cao, sizeof(cao)); + + p->DhcpAllocated = true; + + // Determine the DHCP update interval + t = cao.LeaseTime; + if (t == 0) + { + t = 600; + } + + t = t / 3; + + if (t == 0) + { + t = 1; + } + + p->DhcpRenewInterval = (UINT64)t * (UINT64)1000; + p->DhcpNextRenewTime = Tick64() + p->DhcpRenewInterval; + + if (true) + { + char client_ip_str[64], server_ip_str[64]; + char subnet_str[64], defgw_str[64]; + char dns1_str[64], dns2_str[64]; + char wins1_str[64], wins2_str[64]; + + IPToStr32(client_ip_str, sizeof(client_ip_str), cao.ClientAddress); + IPToStr32(server_ip_str, sizeof(server_ip_str), cao.ServerAddress); + IPToStr32(subnet_str, sizeof(subnet_str), cao.SubnetMask); + IPToStr32(defgw_str, sizeof(defgw_str), cao.Gateway); + IPToStr32(dns1_str, sizeof(dns1_str), cao.DnsServer); + IPToStr32(dns2_str, sizeof(dns2_str), cao.DnsServer2); + IPToStr32(wins1_str, sizeof(wins1_str), cao.WinsServer); + IPToStr32(wins2_str, sizeof(wins2_str), cao.WinsServer2); + + PPPLog(p, "LP_DHCP_REQUEST_OK", + client_ip_str, subnet_str, defgw_str, cao.DomainName, + dns1_str, dns2_str, wins1_str, wins2_str, + server_ip_str, cao.LeaseTime); + } + } + else + { + Debug("IPCDhcpAllocateIP failed.\n"); + p->DhcpIpAllocTried = false; + ok = false; + PPPLog(p, "LP_DHCP_REQUEST_NG"); + } + } + } + } + + // If we already have a configured IP data - send it along + if (IsValidUnicastIPAddressUINT4(p->ClientAddressOption.ClientAddress) && + p->ClientAddressOption.SubnetMask != 0 && ok) + { + // Success to determine the address + UINTToIP(&subnet, p->ClientAddressOption.SubnetMask); + UINTToIP(&gw, p->ClientAddressOption.Gateway); + + Zero(&res, sizeof(res)); + UINTToIP(&res.IpAddress, p->ClientAddressOption.ClientAddress); + UINTToIP(&res.DnsServer1, p->ClientAddressOption.DnsServer); + UINTToIP(&res.DnsServer2, p->ClientAddressOption.DnsServer2); + UINTToIP(&res.WinsServer1, p->ClientAddressOption.WinsServer); + UINTToIP(&res.WinsServer2, p->ClientAddressOption.WinsServer2); + + if (IPCSetIPv4Parameters(p->Ipc, &res.IpAddress, &subnet, &gw, &p->ClientAddressOption.ClasslessRoute)) + { + char client_ip_str[64]; + char subnet_str[64], defgw_str[64]; + char dns1_str[64], dns2_str[64]; + char wins1_str[64], wins2_str[64]; + + // IPv4 parameters have been set for the first time + Debug("Param First Set.\n"); + + IPToStr(client_ip_str, sizeof(client_ip_str), &res.IpAddress); + IPToStr(subnet_str, sizeof(subnet_str), &subnet); + IPToStr(defgw_str, sizeof(defgw_str), &gw); + IPToStr(dns1_str, sizeof(dns1_str), &res.DnsServer1); + IPToStr(dns2_str, sizeof(dns2_str), &res.DnsServer2); + IPToStr(wins1_str, sizeof(wins1_str), &res.WinsServer1); + IPToStr(wins2_str, sizeof(wins2_str), &res.WinsServer2); + + PPPLog(p, "LP_SET_IPV4_PARAM", client_ip_str, subnet_str, + defgw_str, dns1_str, dns2_str, wins1_str, wins2_str); + } + + /*// Backporting static configuration received from client - let him use whatever he wants, + // he won't accept anything else anyway (as per testing with Windows clients) + if (!IsZeroIP(&o.DnsServer1)) + { + CopyIP(&res.DnsServer1, &o.DnsServer1); + Debug("Setting DNS1 from client\n"); + } + if (!IsZeroIP(&o.DnsServer2)) + { + CopyIP(&res.DnsServer2, &o.DnsServer2); + Debug("Setting DNS2 from client\n"); + } + if (!IsZeroIP(&o.WinsServer1)) + { + CopyIP(&res.WinsServer1, &o.WinsServer1); + Debug("Setting WINS1 from client\n"); + } + if (!IsZeroIP(&o.WinsServer2)) + { + CopyIP(&res.WinsServer2, &o.WinsServer2); + Debug("Setting WINS2 from client\n"); + }*/ + /*if (!IsZeroIP(&res.DnsServer1) && IsZeroIP(&res.DnsServer2)) + { + CopyIP(&res.DnsServer2, &res.DnsServer1); + } + if (!IsZeroIP(&res.WinsServer1) && IsZeroIP(&res.WinsServer2)) + { + CopyIP(&res.WinsServer2, &res.WinsServer1); + }*/ + PPPSetIPOptionToLCP(&res, pp->Lcp, true); + } + // We couldn't configure address for the client + else + { + // Failed to determine the address + Debug("IP Address Determination Failed.\n"); + + Zero(&res, sizeof(res)); + // We will try to reconfigure if we receive another request by wiping all data + Zero(&p->ClientAddressOption, sizeof(DHCP_OPTION_LIST)); + p->UseStaticIPAddress = false; + + PPPSetIPOptionToLCP(&res, pp->Lcp, true); + } + + if (PPPRejectLCPOptionsEx(p, pp, processed)) + { + Debug("Rejected IPCP options ID = 0x%x\n", pp->Lcp->Id); + processed = true; + } + + if (ok && PPPNackLCPOptionsEx(p, pp, processed)) + { + Debug("NACKed IPCP options ID = 0x%x\n", pp->Lcp->Id); + processed = true; + } + + // We will delay this packet ACK and send the server IP first, then wait for a reparse + // it is kind of dirty but fixes issues on some clients (namely VPN Client Pro on Android) + if (IPC_PROTO_GET_STATUS(p->Ipc, IPv4State) == IPC_PROTO_STATUS_CLOSED && p->ClientAddressOption.ServerAddress != 0 && ok) + { + PPP_LCP *c = NewPPPLCP(PPP_LCP_CODE_REQ, 0); + UINT ui = p->ClientAddressOption.ServerAddress; + Add(c->OptionList, NewPPPOption(PPP_IPCP_OPTION_IP, &ui, sizeof(UINT))); + if (!PPPSendAndRetransmitRequest(p, PPP_PROTOCOL_IPCP, c)) + { + PPPSetStatus(p, PPP_STATUS_FAIL); + WHERE; + return false; + } + IPC_PROTO_SET_STATUS(p->Ipc, IPv4State, IPC_PROTO_STATUS_CONFIG); + if (!processed) + { + PPPAddNextPacket(p, pp, 1); + } + return false; + } + + // We still haven't received any answer from client about server IP, keep waiting... + if ((IPC_PROTO_GET_STATUS(p->Ipc, IPv4State) == IPC_PROTO_STATUS_CONFIG || + IPC_PROTO_GET_STATUS(p->Ipc, IPv4State) == IPC_PROTO_STATUS_CLOSED) && !processed) + { + PPPAddNextPacket(p, pp, 1); + return false; + } + + //Debug("PPPAckLCPOptionsEx ok=%x, processed=%x", ok, processed); + if (!ok || !PPPAckLCPOptionsEx(p, pp, processed)) + { + return false; + } + Debug("ACKed IPCP options ID = 0x%x\n", pp->Lcp->Id); + + if (ok && IPC_PROTO_GET_STATUS(p->Ipc, IPv4State) == IPC_PROTO_STATUS_CONFIG_WAIT) + { + IPC_PROTO_SET_STATUS(p->Ipc, IPv4State, IPC_PROTO_STATUS_OPENED); + Debug("IPv4 OPENED\n"); + } + return ok; +} + +// Process EAP request packets +bool PPPProcessEAPRequestPacket(PPP_SESSION *p, PPP_PACKET *pp) +{ + Debug("We got an EAP request, which is weird...\n"); + return false; +} + +// Process IPv6CP request packets +bool PPPProcessIPv6CPRequestPacket(PPP_SESSION *p, PPP_PACKET *pp) +{ + UINT i; + bool processed = false; + if (IPC_PROTO_GET_STATUS(p->Ipc, IPv6State) == IPC_PROTO_STATUS_REJECTED) + { + Debug("We got an IPv6CP packet after we had it rejected\n"); + return PPPRejectUnsupportedPacketEx(p, pp, true); + } + + for (i = 0; i < LIST_NUM(pp->Lcp->OptionList); i++) + { + PPP_OPTION *t = LIST_DATA(pp->Lcp->OptionList, i); + + switch (t->Type) + { + case PPP_IPV6CP_OPTION_EUI: + t->IsSupported = true; + if (t->DataSize == sizeof(UINT64)) + { + UINT64 newValue = 0; + UINT64 value = READ_UINT64(t->Data); + if (value != 0 && !IPCIPv6CheckExistingLinkLocal(p->Ipc, value)) + { + t->IsAccepted = true; + p->Ipc->IPv6ClientEUI = value; + } + else + { + t->IsAccepted = false; + GenerateEui64Address6((UCHAR *)&newValue, p->Ipc->MacAddress); + if (newValue != value && !IPCIPv6CheckExistingLinkLocal(p->Ipc, newValue)) + { + WRITE_UINT64(t->AltData, newValue); + t->AltDataSize = sizeof(UINT64); + } + else + { + while (true) + { + newValue = Rand64(); + if (!IPCIPv6CheckExistingLinkLocal(p->Ipc, newValue)) + { + WRITE_UINT64(t->AltData, newValue); + t->AltDataSize = sizeof(UINT64); + break; + } + } + } + } + } + break; + default: + t->IsSupported = false; + break; + } + } + + if (PPPRejectLCPOptionsEx(p, pp, processed)) + { + Debug("Rejected IPv6CP options ID = 0x%x\n", pp->Lcp->Id); + processed = true; + } + + if (PPPNackLCPOptionsEx(p, pp, processed)) + { + Debug("NACKed IPv6CP options ID = 0x%x\n", pp->Lcp->Id); + processed = true; + } + + if (p->Ipc->IPv6ClientEUI != 0 && IPC_PROTO_GET_STATUS(p->Ipc, IPv6State) == IPC_PROTO_STATUS_CLOSED) + { + PPP_LCP *c = NewPPPLCP(PPP_LCP_CODE_REQ, 0); + UINT64 serverEui = IPCIPv6GetServerEui(p->Ipc); + if (serverEui != 0 && serverEui != p->Ipc->IPv6ClientEUI) + { + Add(c->OptionList, NewPPPOption(PPP_IPV6CP_OPTION_EUI, &serverEui, sizeof(UINT64))); + } + if (!PPPSendAndRetransmitRequest(p, PPP_PROTOCOL_IPV6CP, c)) + { + PPPSetStatus(p, PPP_STATUS_FAIL); + WHERE; + return false; + } + + IPC_PROTO_SET_STATUS(p->Ipc, IPv6State, IPC_PROTO_STATUS_CONFIG); + } + + if (IPC_PROTO_GET_STATUS(p->Ipc, IPv6State) == IPC_PROTO_STATUS_CONFIG && !processed) + { + PPPAddNextPacket(p, pp, 1); + return false; + } + + if (!PPPAckLCPOptionsEx(p, pp, processed)) + { + return false; + } + Debug("ACKed IPv6CP options ID = 0x%x\n", pp->Lcp->Id); + + if (IPC_PROTO_GET_STATUS(p->Ipc, IPv6State) == IPC_PROTO_STATUS_CONFIG_WAIT) + { + IPC_PROTO_SET_STATUS(p->Ipc, IPv6State, IPC_PROTO_STATUS_OPENED); + Debug("IPv6 OPENED\n"); + } + + return true; +} + +// LCP option based packets utility +bool PPPRejectLCPOptions(PPP_SESSION *p, PPP_PACKET *pp) +{ + return PPPRejectLCPOptionsEx(p, pp, false); +} +bool PPPRejectLCPOptionsEx(PPP_SESSION *p, PPP_PACKET *pp, bool simulate) +{ + UINT i = 0; + bool toBeRejected = false; + PPP_PACKET *ret; + for (i = 0; i < LIST_NUM(pp->Lcp->OptionList); i++) + { + PPP_OPTION *t = LIST_DATA(pp->Lcp->OptionList, i); + + if (t->IsSupported == false) + { + toBeRejected = true; + break; + } + } + + if (toBeRejected == false) + { + return false; + } + + ret = ZeroMalloc(sizeof(PPP_PACKET)); + ret->IsControl = true; + ret->Protocol = pp->Protocol; + // Return a Reject if there are unsupported parameters + ret->Lcp = NewPPPLCP(PPP_LCP_CODE_REJECT, pp->Lcp->Id); + + for (i = 0; i < LIST_NUM(pp->Lcp->OptionList); i++) + { + PPP_OPTION *t = LIST_DATA(pp->Lcp->OptionList, i); + + if (t->IsSupported == false) + { + // Attach the original option value as is + Add(ret->Lcp->OptionList, NewPPPOption(t->Type, t->Data, t->DataSize)); + Debug("Rejected LCP option = 0x%x, proto = 0x%x\n", t->Type, pp->Protocol); + } + } + + if (LIST_NUM(ret->Lcp->OptionList) == 0 || simulate) + { + FreePPPPacket(ret); + return false; + } + + PPPSendPacketAndFree(p, ret); + return true; +} +bool PPPNackLCPOptions(PPP_SESSION *p, PPP_PACKET *pp) +{ + return PPPNackLCPOptionsEx(p, pp, false); +} +bool PPPNackLCPOptionsEx(PPP_SESSION *p, PPP_PACKET *pp, bool simulate) +{ + UINT i = 0; + PPP_PACKET *ret; + bool toBeNACKed = false; + for (i = 0; i < LIST_NUM(pp->Lcp->OptionList); i++) + { + PPP_OPTION *t = LIST_DATA(pp->Lcp->OptionList, i); + + if (t->IsAccepted == false && t->IsSupported == true) + { + toBeNACKed = true; + break; + } + } + + if (toBeNACKed == false) + { + return false; + } + + ret = ZeroMalloc(sizeof(PPP_PACKET)); + ret->IsControl = true; + ret->Protocol = pp->Protocol; + // Return a NAK if there are any unacceptable parameter + // even that all parameters are supported + ret->Lcp = NewPPPLCP(PPP_LCP_CODE_NAK, pp->Lcp->Id); + + for (i = 0; i < LIST_NUM(pp->Lcp->OptionList); i++) + { + PPP_OPTION *t = LIST_DATA(pp->Lcp->OptionList, i); + + if (t->IsAccepted == false && t->IsSupported == true) + { + // Replace the original option value with an acceptable value + Add(ret->Lcp->OptionList, NewPPPOption(t->Type, t->AltData, t->AltDataSize)); + Debug("NACKed LCP option = 0x%x, proto = 0x%x\n", t->Type, pp->Protocol); + } + } + + if (LIST_NUM(ret->Lcp->OptionList) == 0 || simulate) + { + FreePPPPacket(ret); + return false; + } + + PPPSendPacketAndFree(p, ret); + return true; +} +bool PPPAckLCPOptions(PPP_SESSION *p, PPP_PACKET *pp) +{ + return PPPAckLCPOptionsEx(p, pp, false); +} +bool PPPAckLCPOptionsEx(PPP_SESSION *p, PPP_PACKET *pp, bool simulate) +{ + UINT i = 0; + PPP_PACKET *ret; + bool toBeACKed = false; + if (LIST_NUM(pp->Lcp->OptionList) == 0) + { + // We acknoweldge an empty option list + toBeACKed = true; + Debug("ACKing empty LCP options list, id=%i\n", pp->Lcp->Id); + } + for (i = 0; i < LIST_NUM(pp->Lcp->OptionList); i++) + { + PPP_OPTION *t = LIST_DATA(pp->Lcp->OptionList, i); + + if (t->IsAccepted == true && t->IsSupported == true) + { + toBeACKed = true; + break; + } + } + + if (toBeACKed == false) + { + return false; + } + + ret = ZeroMalloc(sizeof(PPP_PACKET)); + ret->IsControl = true; + ret->Protocol = pp->Protocol; + // Return an ACK if all parameters are accepted + ret->Lcp = NewPPPLCP(PPP_LCP_CODE_ACK, pp->Lcp->Id); + + for (i = 0; i < LIST_NUM(pp->Lcp->OptionList); i++) + { + PPP_OPTION *t = LIST_DATA(pp->Lcp->OptionList, i); + + if (t->IsAccepted == true && t->IsSupported == true) + { + // Attach the original option value as is + Add(ret->Lcp->OptionList, NewPPPOption(t->Type, t->Data, t->DataSize)); + Debug("ACKed LCP option = 0x%x, proto = 0x%x\n", t->Type, pp->Protocol); + } + } + + if (simulate) + { + FreePPPPacket(ret); + return false; + } + + PPPSendPacketAndFree(p, ret); + return true; +} + +// PPP networking functions +// Send a request packet in the PPP +bool PPPSendAndRetransmitRequest(PPP_SESSION *p, USHORT protocol, PPP_LCP *c) +{ + PPP_PACKET *pp; + UINT64 now = Tick64(); + PPP_REQUEST_RESEND *resend; + + // Validate arguments + if (p == NULL || c == NULL) + { + return false; + } + + pp = ZeroMalloc(sizeof(PPP_PACKET)); + pp->Protocol = protocol; + pp->IsControl = true; + pp->Lcp = c; + if (pp->Lcp->Id == 0) + { + pp->Lcp->Id = p->NextId++; + } + + // Send the PPP packet + if (!PPPSendPacketEx(p, pp, false)) + { + PPPSetStatus(p, PPP_STATUS_FAIL); + WHERE; + return false; + } + + resend = ZeroMalloc(sizeof(PPP_REQUEST_RESEND)); + resend->Id = pp->Lcp->Id; + resend->Packet = pp; + resend->ResendTime = now + PPP_PACKET_RESEND_INTERVAL; + resend->TimeoutTime = now + p->PacketRecvTimeout; + + Add(p->SentReqPacketList, resend); + + return true; +} +// Send the PPP packet and frees the sent packet +bool PPPSendPacketAndFree(PPP_SESSION *p, PPP_PACKET *pp) +{ + bool result = PPPSendPacketEx(p, pp, false); + FreePPPPacket(pp); + return result; +} +// Send the PPP packet +bool PPPSendPacketEx(PPP_SESSION *p, PPP_PACKET *pp, bool no_flush) +{ + bool ret = false; + BUF *b; + // Validate arguments + if (p == NULL || pp == NULL) + { + return false; + } + + b = BuildPPPPacketData(pp); + if (b == NULL) + { + return false; + } + + ret = TubeSendEx(p->TubeSend, b->Buf, b->Size, NULL, no_flush); + + if (no_flush) + { + AddTubeToFlushList(p->FlushList, p->TubeSend); + } + + FreeBuf(b); + + return ret; +} + +// Receive a PPP packet +PPP_PACKET *PPPRecvPacket(PPP_SESSION *p, bool async) +{ + TUBEDATA *d; + PPP_PACKET *pp; + // Validate arguments + if (p == NULL) + { + return NULL; + } + +LABEL_LOOP: + + if (async == false) + { + d = TubeRecvSync(p->TubeRecv, (UINT)p->PacketRecvTimeout); + } + else + { + d = TubeRecvAsync(p->TubeRecv); + } + + if (d == NULL) + { + return NULL; + } + + pp = ParsePPPPacket(d->Data, d->DataSize); + FreeTubeData(d); + + if (pp == NULL) + { + // A broken packet is received + goto LABEL_LOOP; + } + + p->LastRecvTime = Tick64(); + + return pp; +} + +PPP_PACKET *PPPGetNextPacket(PPP_SESSION *p) +{ + PPP_PACKET *ret = NULL; + UINT i = 0; + if (p->CurrentPacket != NULL) + { + FreePPPPacket(p->CurrentPacket); + p->CurrentPacket = NULL; + } + for (i = 0; i < LIST_NUM(p->DelayedPackets); i++) + { + PPP_DELAYED_PACKET *t = LIST_DATA(p->DelayedPackets, i); + if (t->DelayTicks > 0) + { + t->DelayTicks--; + } + else + { + ret = t->Packet; + Delete(p->DelayedPackets, t); + Free(t); + break; + } + } + + if (ret != NULL) + { + p->CurrentPacket = ret; + return ret; + } + + ret = PPPRecvPacket(p, true); + + if (ret != NULL && ret->IsControl && ret->Lcp != NULL) + { + PPP_DELAYED_PACKET *firstRelated = NULL; + for (i = 0; i < LIST_NUM(p->DelayedPackets); i++) + { + PPP_DELAYED_PACKET *t = LIST_DATA(p->DelayedPackets, i); + char related = PPPRelatedPacketComparator(ret, t->Packet); + if (related != 0xF && related != 0xE) + { + if (related == 0) + { + // It's the same packet, just remove it and wait for it's delays + FreePPPPacket(ret); + firstRelated = NULL; + ret = NULL; + break; + } + if (related == 1) + { + // We got a packet which should come later than any of delayed ones + PPPAddNextPacket(p, ret, t->DelayTicks); + firstRelated = NULL; + ret = NULL; + break; + } + if (related == -1) + { + char prevFoundRelated = -1; + if (firstRelated != NULL) + { + prevFoundRelated = PPPRelatedPacketComparator(t->Packet, firstRelated->Packet); + } + if (prevFoundRelated == -1) + { + firstRelated = t; + } + } + } + } + + if (firstRelated != NULL) + { + PPPAddNextPacket(p, ret, firstRelated->DelayTicks); + ret = NULL; + } + } + + p->CurrentPacket = ret; + return ret; +} + +void PPPAddNextPacket(PPP_SESSION *p, PPP_PACKET *pp, UINT delay) +{ + PPP_DELAYED_PACKET *t = ZeroMalloc(sizeof(PPP_DELAYED_PACKET)); + if (p->CurrentPacket == pp) + { + p->CurrentPacket = NULL; + } + t->Packet = pp; + t->DelayTicks = delay; + Add(p->DelayedPackets, t); + Sort(p->DelayedPackets); + /*Debug("after sorting delayeds\n"); + for (i = 0; i < LIST_NUM(p->DelayedPackets); i++) + { + t = LIST_DATA(p->DelayedPackets, i); + if (t->Packet->Lcp != NULL) + { + Debug("> Packet proto = 0x%x, id = 0x%x, code = 0x%x, delay = 0x%x\n", t->Packet->Protocol, t->Packet->Lcp->Id, t->Packet->Lcp->Code, t->DelayTicks); + } + } + Debug("after sorting delayeds end\n");*/ +} + +int PPPDelayedPacketsComparator(void *a, void *b) +{ + PPP_DELAYED_PACKET *first = a; + PPP_DELAYED_PACKET *second = b; + + char related = PPPRelatedPacketComparator(first->Packet, second->Packet); + + if (related == 0xF || related == 0xE) + { + if (first->DelayTicks < second->DelayTicks) + { + return -1; + } + if (first->DelayTicks > second->DelayTicks) + { + return 1; + } + return 0; + } + + // We make all delay ticks to be accounted with the sorting + if (related <= 1 && related >= -1) + { + if (related == -1 && first->DelayTicks >= second->DelayTicks) + { + second->DelayTicks = first->DelayTicks; + second->DelayTicks++; + } + else if (related == 1 && first->DelayTicks <= second->DelayTicks) + { + first->DelayTicks = second->DelayTicks; + first->DelayTicks++; + } + return related; + } + return 0; +} + +// -1 - packet a comes before packet b +// 0 - this is the same packet +// 1 - packet a comes after packet b +// 0xF - packet is not related +// 0xE - we got an error while comparing, treating as not related would be the most correct +char PPPRelatedPacketComparator(PPP_PACKET *a, PPP_PACKET *b) +{ + if (a->IsControl && b->IsControl && + a->Lcp != NULL && b->Lcp != NULL && + a->Protocol == b->Protocol && + PPP_CODE_IS_REQUEST(a->Protocol, a->Lcp->Code) == PPP_CODE_IS_REQUEST(b->Protocol, b->Lcp->Code) && + PPP_CODE_IS_RESPONSE(a->Protocol, a->Lcp->Code) == PPP_CODE_IS_RESPONSE(b->Protocol, b->Lcp->Code)) + { + // The packet is related! + if (a->Lcp->Id < b->Lcp->Id) + { + return -1; + } + else if (a->Lcp->Id == b->Lcp->Id) + { + if (a->Lcp->Code == b->Lcp->Code) + { + return 0; + } + else + { + return 0xE; + } + } + else if (a->Lcp->Id > b->Lcp->Id) + { + return 1; + } + else + { + return 0xE; + } + } + else + { + // The packet is not related! + return 0xF; + } +} + +// PPP utility functions +// Packet structure creation utilities + +// Create the LCP +PPP_LCP *NewPPPLCP(UCHAR code, UCHAR id) +{ + PPP_LCP *c = ZeroMalloc(sizeof(PPP_LCP)); + + c->Code = code; + c->Id = id; + c->OptionList = NewListFast(NULL); + + return c; +} + +// Create a new PPP options +PPP_OPTION *NewPPPOption(UCHAR type, void *data, UINT size) +{ + PPP_OPTION *o; + // Validate arguments + if (size != 0 && data == NULL) + { + return NULL; + } + + o = ZeroMalloc(sizeof(PPP_OPTION)); + + o->Type = type; + Copy(o->Data, data, size); + o->DataSize = size; + + return o; +} + +// Packet parse utilities + +// Analyse the PPP packet +PPP_PACKET *ParsePPPPacket(void *data, UINT size) +{ + PPP_PACKET *pp; + UCHAR *buf; + // Validate arguments + if (data == NULL || size == 0) + { + return NULL; + } + + pp = ZeroMalloc(sizeof(PPP_PACKET)); + + buf = (UCHAR *)data; + + // Address + if (buf[0] != 0xff) + { + goto LABEL_ERROR; + } + size--; + buf++; + + // Control + if (size < 1) + { + goto LABEL_ERROR; + } + if (buf[0] != 0x03) + { + goto LABEL_ERROR; + } + size--; + buf++; + + // Protocol + if (size < 2) + { + goto LABEL_ERROR; + } + pp->Protocol = READ_USHORT(buf); + + size -= 2; + buf += 2; + + if (pp->Protocol == PPP_PROTOCOL_LCP || pp->Protocol == PPP_PROTOCOL_PAP || pp->Protocol == PPP_PROTOCOL_CHAP || pp->Protocol == PPP_PROTOCOL_IPCP || pp->Protocol == PPP_PROTOCOL_IPV6CP || pp->Protocol == PPP_PROTOCOL_EAP) + { + pp->IsControl = true; + } + + pp->Data = Clone(buf, size); + pp->DataSize = size; + + if (pp->IsControl) + { + pp->Lcp = PPPParseLCP(pp->Protocol, pp->Data, pp->DataSize); + if (pp->Lcp == NULL) + { + goto LABEL_ERROR; + } + } + + return pp; + +LABEL_ERROR: + FreePPPPacket(pp); + return NULL; +} + +// Analyse the LCP data +PPP_LCP *PPPParseLCP(USHORT protocol, void *data, UINT size) +{ + UCHAR *buf; + PPP_LCP *c; + USHORT len; + bool has_option_list = false; + // Validate arguments + if (data == NULL || size == 0) + { + return NULL; + } + + buf = (UCHAR *)data; + c = ZeroMalloc(sizeof(PPP_LCP)); + + c->OptionList = NewListFast(NULL); + + // Code + if (size < 1) + { + goto LABEL_ERROR; + } + c->Code = buf[0]; + buf++; + size--; + + // ID + if (size < 1) + { + goto LABEL_ERROR; + } + c->Id = buf[0]; + buf++; + size--; + + // Length + if (size < 2) + { + goto LABEL_ERROR; + } + len = READ_USHORT(buf); + if (len < 4) + { + goto LABEL_ERROR; + } + len -= 4; + buf += 2; + size -= 2; + + // Options or Data + if (size < len) + { + goto LABEL_ERROR; + } + + has_option_list = PPP_CODE_IS_WITH_OPTION_LIST(protocol, c->Code); + + if (has_option_list == false) + { + c->Data = Clone(buf, size); + c->DataSize = size; + } + else + { + // Option List + while (len >= 1) + { + PPP_OPTION o; + + Zero(&o, sizeof(o)); + + // Type + if (len < 1) + { + goto LABEL_ERROR; + } + o.Type = buf[0]; + buf++; + len--; + + // Length + if (len < 1) + { + goto LABEL_ERROR; + } + o.DataSize = buf[0]; + if (o.DataSize < 2) + { + goto LABEL_ERROR; + } + o.DataSize -= 2; + buf++; + len--; + + // Data + if (len < o.DataSize) + { + goto LABEL_ERROR; + } + Copy(o.Data, buf, o.DataSize); + buf += o.DataSize; + len -= o.DataSize; + + Add(c->OptionList, Clone(&o, sizeof(o))); + } + } + + return c; + +LABEL_ERROR: + FreePPPLCP(c); + return NULL; +} + +// Analyse MS CHAP v2 Response packet +bool PPPParseMSCHAP2ResponsePacket(PPP_SESSION *p, PPP_PACKET *pp) +{ + bool ok = false; + + char client_ip_tmp[256]; + EAP_CLIENT *eap; + + UCHAR client_response_buffer[49]; + UCHAR *client_challenge_16; + UCHAR *client_response_24; + char username_tmp[MAX_SIZE]; + IPC *ipc = NULL; + char id[MAX_SIZE]; + char hub[MAX_SIZE]; + char password[MAX_SIZE]; + char server_challenge_hex[MAX_SIZE]; + char client_challenge_hex[MAX_SIZE]; + char client_response_hex[MAX_SIZE]; + char eap_client_hex[64]; + ETHERIP_ID d; + UINT error_code; + UINT64 eap_client_ptr = (UINT64)p->EapClient; + + if (pp->Lcp != NULL && pp->Lcp->DataSize >= 51) + { + BUF *b; + if (pp->Lcp->Id != p->MsChapV2_PacketId) + { + Debug("Got incorrect LCP PacketId! Should be 0x%x, got 0x%x\n", p->MsChapV2_PacketId, pp->Lcp->Id); + p->MsChapV2_PacketId = pp->Lcp->Id; + } + + b = NewBuf(); + + WriteBuf(b, pp->Lcp->Data, pp->Lcp->DataSize); + SeekBuf(b, 0, 0); + + if (ReadBufChar(b) == 49) + { + ReadBuf(b, client_response_buffer, 49); + + Zero(username_tmp, sizeof(username_tmp)); + ReadBuf(b, username_tmp, sizeof(username_tmp) - 1); + Debug("MS-CHAPv2: id=%s\n", username_tmp); + + client_challenge_16 = client_response_buffer + 0; + client_response_24 = client_response_buffer + 16 + 8; + + Copy(p->MsChapV2_ClientChallenge, client_challenge_16, 16); + Copy(p->MsChapV2_ClientResponse, client_response_24, 24); + + Zero(id, sizeof(id)); + Zero(hub, sizeof(hub)); + + // The user name is divided into the ID and the virtual HUB name + Zero(&d, sizeof(d)); + PPPParseUsername(p->Cedar, username_tmp, &d); + + StrCpy(id, sizeof(id), d.UserName); + StrCpy(hub, sizeof(hub), d.HubName); + Debug("MS-CHAPv2: username=%s, hubname=%s\n", id, hub); + + IPToStr(client_ip_tmp, sizeof(client_ip_tmp), &p->ClientIP); + + // Convert the MS-CHAPv2 data to a password string + BinToStr(server_challenge_hex, sizeof(server_challenge_hex), + p->MsChapV2_ServerChallenge, sizeof(p->MsChapV2_ServerChallenge)); + BinToStr(client_challenge_hex, sizeof(client_challenge_hex), + p->MsChapV2_ClientChallenge, sizeof(p->MsChapV2_ClientChallenge)); + BinToStr(client_response_hex, sizeof(client_response_hex), + p->MsChapV2_ClientResponse, sizeof(p->MsChapV2_ClientResponse)); + BinToStr(eap_client_hex, sizeof(eap_client_hex), + &eap_client_ptr, 8); + + Format(password, sizeof(password), "%s%s:%s:%s:%s:%s", + IPC_PASSWORD_MSCHAPV2_TAG, + username_tmp, + server_challenge_hex, + client_challenge_hex, + client_response_hex, + eap_client_hex); + + if (p->MsChapV2_UseDoubleMsChapV2 && p->EapClient == NULL) + { + Debug("Double MSCHAPv2 creating EAP client\n"); + eap = HubNewEapClient(p->Cedar, hub, client_ip_tmp, id, "L3:PPP"); + + if (eap) + { + ok = true; + p->EapClient = eap; + } + else + { + PPPSetStatus(p, PPP_STATUS_FAIL); + WHERE; + return false; + } + } + else if (p->Ipc == NULL) + { + Debug("MSCHAPv2 creating IPC\n"); + ipc = NewIPC(p->Cedar, p->ClientSoftwareName, p->Postfix, hub, id, password, + &error_code, &p->ClientIP, p->ClientPort, &p->ServerIP, p->ServerPort, + p->ClientHostname, p->CryptName, false, p->AdjustMss, p->EapClient, NULL, + + IPC_LAYER_3); + + if (ipc != NULL) + { + p->Ipc = ipc; + + // Setting user timeouts + p->PacketRecvTimeout = (UINT64)p->Ipc->Policy->TimeOut * 1000 * 3 / 4; // setting to 3/4 of the user timeout + p->DataTimeout = (UINT64)p->Ipc->Policy->TimeOut * 1000; + p->UserConnectionTimeout = (UINT64)p->Ipc->Policy->AutoDisconnect * 1000; + p->UserConnectionTick = Tick64(); + + Copy(p->MsChapV2_ServerResponse, ipc->MsChapV2_ServerResponse, 20); + + ok = true; + + p->AuthOk = true; + } + } + else + { + Debug("Got weird packet when we already have an active IPC! Ipc = 0x%x, AuthOk = 0x%x, Status = 0x%x\n", p->Ipc, p->AuthOk, p->PPPStatus); + ok = p->AuthOk; + } + } + + FreeBuf(b); + } + else + { + Debug("Got invalid MSCHAPv2 packet\n"); + } + + return ok; +} + +// Packet building utilities + +// Build a PPP packet data +BUF *BuildPPPPacketData(PPP_PACKET *pp) +{ + BUF *ret; + UCHAR c; + USHORT us; + // Validate arguments + if (pp == NULL) + { + return NULL; + } + + ret = NewBuf(); + + // Address + c = 0xff; + WriteBuf(ret, &c, 1); + + // Control + c = 0x03; + WriteBuf(ret, &c, 1); + + // Protocol + us = Endian16(pp->Protocol); + WriteBuf(ret, &us, 2); + + if (pp->IsControl) + { + // LCP + BUF *b = BuildLCPData(pp->Lcp); + + WriteBufBuf(ret, b); + + FreeBuf(b); + } + else + { + // Data + WriteBuf(ret, pp->Data, pp->DataSize); + } + + SeekBuf(ret, 0, 0); + + return ret; +} + +// Build the LCP packet data +BUF *BuildLCPData(PPP_LCP *c) +{ + BUF *b; + UCHAR zero = 0; + UINT i; + // Validate arguments + if (c == NULL) + { + return NULL; + } + + b = NewBuf(); + + // Code + WriteBuf(b, &c->Code, 1); + + // ID + WriteBuf(b, &c->Id, 1); + + // Length (to be updated later) + zero = 0; + WriteBuf(b, &zero, 1); + WriteBuf(b, &zero, 1); + + if (c->Data == NULL) + { + // Option List + for (i = 0; i < LIST_NUM(c->OptionList); i++) + { + PPP_OPTION *o = LIST_DATA(c->OptionList, i); + UCHAR sz = o->DataSize + 2; + + WriteBuf(b, &o->Type, 1); + WriteBuf(b, &sz, 1); + + WriteBuf(b, o->Data, o->DataSize); + } + } + else + { + // Data + WriteBuf(b, c->Data, c->DataSize); + } + + SeekBuf(b, 0, 0); + + // Update Length + WRITE_USHORT(((UCHAR *)b->Buf) + 2, b->Size); + + return b; +} + +// Build the MS CHAP v2 challenge packet +PPP_LCP *BuildMSCHAP2ChallengePacket(PPP_SESSION *p) +{ + PPP_LCP *lcp; + BUF *b; + char machine_name[MAX_SIZE]; + UINT64 now = Tick64(); + + // Generate a Server Challenge packet of MS-CHAP v2 + GetMachineHostName(machine_name, sizeof(machine_name)); + + if (p->EapClient == NULL) + { + MsChapV2Server_GenerateChallenge(p->MsChapV2_ServerChallenge); + } + else + { + Copy(p->MsChapV2_ServerChallenge, p->EapClient->MsChapV2Challenge.Chap_ChallengeValue, 16); + } + + p->MsChapV2_PacketId = p->NextId++; + lcp = NewPPPLCP(PPP_CHAP_CODE_CHALLENGE, p->MsChapV2_PacketId); + + b = NewBuf(); + WriteBufChar(b, 16); + WriteBuf(b, p->MsChapV2_ServerChallenge, sizeof(p->MsChapV2_ServerChallenge)); + WriteBuf(b, machine_name, StrLen(machine_name)); + lcp->Data = Clone(b->Buf, b->Size); + lcp->DataSize = b->Size; + FreeBuf(b); + + Debug("Building MS-CHAP v2 Challenge\n"); + + return lcp; +} + +// IPCP packet utilities + +// Set the IP options of PPP to LCP +bool PPPSetIPOptionToLCP(PPP_IPOPTION *o, PPP_LCP *c, bool only_modify) +{ + bool ret = false; + // Validate arguments + if (c == NULL || o == NULL) + { + return false; + } + + ret = PPPSetIPAddressValueToLCP(c, PPP_IPCP_OPTION_IP, &o->IpAddress, only_modify); + + PPPSetIPAddressValueToLCP(c, PPP_IPCP_OPTION_DNS1, &o->DnsServer1, only_modify); + PPPSetIPAddressValueToLCP(c, PPP_IPCP_OPTION_DNS2, &o->DnsServer2, only_modify); + PPPSetIPAddressValueToLCP(c, PPP_IPCP_OPTION_WINS1, &o->WinsServer1, only_modify); + PPPSetIPAddressValueToLCP(c, PPP_IPCP_OPTION_WINS2, &o->WinsServer2, only_modify); + + return ret; +} + +// Get the IP options of PPP from LCP +bool PPPGetIPOptionFromLCP(PPP_IPOPTION *o, PPP_LCP *c) +{ + bool ret; + // Validate arguments + if (c == NULL || o == NULL) + { + return false; + } + + Zero(o, sizeof(PPP_IPOPTION)); + + ret = PPPGetIPAddressValueFromLCP(c, PPP_IPCP_OPTION_IP, &o->IpAddress); + + PPPGetIPAddressValueFromLCP(c, PPP_IPCP_OPTION_DNS1, &o->DnsServer1); + PPPGetIPAddressValueFromLCP(c, PPP_IPCP_OPTION_DNS2, &o->DnsServer2); + PPPGetIPAddressValueFromLCP(c, PPP_IPCP_OPTION_WINS1, &o->WinsServer1); + PPPGetIPAddressValueFromLCP(c, PPP_IPCP_OPTION_WINS2, &o->WinsServer2); + + return ret; +} + +// Set the IP address data to the option list of the LCP +bool PPPSetIPAddressValueToLCP(PPP_LCP *c, UINT type, IP *ip, bool only_modify) +{ + IP ip2; + UINT ui; + // Validate arguments + if (c == NULL || ip == NULL) + { + return false; + } + + ui = IPToUINT(ip); + + if (PPPGetIPAddressValueFromLCP(c, type, &ip2)) + { + PPP_OPTION *opt; + opt = PPPGetOptionValue(c, type); + + if (opt != NULL) + { + if (IsZeroIP(ip) == false) + { + if (CmpIpAddr(&ip2, ip) == 0) + { + // No change + opt->IsAccepted = true; + opt->IsSupported = true; + } + else + { + // Changed + opt->IsAccepted = false; + opt->IsSupported = true; + opt->AltDataSize = 4; + Copy(opt->AltData, &ui, 4); + } + } + else + { + // The parameter itself is not supported + // (if the IP address is 0.0.0.0) + opt->IsSupported = false; + opt->IsAccepted = false; + } + } + + return true; + } + else + { + if (IsZeroIP(ip) == false) + { + // Add as a new item + if (only_modify != false) + { + return false; + } + else + { + PPP_OPTION *opt2 = NewPPPOption(type, &ui, 4); + UCHAR ipstr[MAX_SIZE]; + + opt2->IsAccepted = true; + opt2->IsSupported = true; + Copy(opt2->AltData, opt2->Data, opt2->DataSize); + opt2->AltDataSize = opt2->DataSize; + + Add(c->OptionList, opt2); + IPToStr(ipstr, MAX_SIZE, ip); + + return true; + } + } + else + { + return false; + } + } +} + +// Get the IP address data from the option list of the LCP +bool PPPGetIPAddressValueFromLCP(PPP_LCP *c, UINT type, IP *ip) +{ + PPP_OPTION *opt; + UINT ui; + // Validate arguments + if (c == NULL || ip == NULL) + { + return false; + } + + opt = PPPGetOptionValue(c, type); + if (opt == NULL) + { + return false; + } + + if (opt->DataSize != 4) + { + return false; + } + + opt->IsSupported = true; + + ui = *((UINT *)opt->Data); + + UINTToIP(ip, ui); + + return true; +} + +// EAP packet utilities +bool PPPProcessEAPTlsResponse(PPP_SESSION *p, PPP_EAP *eap_packet, UINT eapTlsSize) +{ + UCHAR *dataBuffer; + UINT dataSize; + UINT tlsLength = 0; + bool isFragmented = false; + PPP_LCP *lcp; + PPP_EAP *eap; + UCHAR flags = PPP_EAP_TLS_FLAG_NONE; + UINT sizeLeft = 0; + Debug("Got EAP-TLS size=%i\n", eapTlsSize); + if (eapTlsSize == 1) + { + // This is an EAP-TLS message ACK + if (p->Eap_TlsCtx.CachedBufferSend != NULL) + { + // We got an ACK to transmit the next fragmented message + dataSize = p->Mru1 - 8 - 1 - 1; // Calculating the maximum payload size (without TlsLength) + sizeLeft = GetMemSize(p->Eap_TlsCtx.CachedBufferSend); + sizeLeft -= (UINT)(p->Eap_TlsCtx.CachedBufferSendPntr - p->Eap_TlsCtx.CachedBufferSend); + + flags = PPP_EAP_TLS_FLAG_FRAGMENTED; // M flag + if (dataSize > sizeLeft) + { + dataSize = sizeLeft; + flags = PPP_EAP_TLS_FLAG_NONE; // Clearing the M flag because it is the last packet + } + lcp = BuildEAPTlsRequest(p->Eap_PacketId++, dataSize, flags); + eap = lcp->Data; + Copy(eap->Tls.TlsDataWithoutLength, p->Eap_TlsCtx.CachedBufferSendPntr, dataSize); + p->Eap_TlsCtx.CachedBufferSendPntr += (UINT64)dataSize; + + if (!PPPSendAndRetransmitRequest(p, PPP_PROTOCOL_EAP, lcp)) + { + PPPSetStatus(p, PPP_STATUS_FAIL); + WHERE; + return false; + } + Debug("Sent EAP-TLS size=%i type=%i flag=%i\n", lcp->DataSize, eap->Type, eap->Tls.Flags); + + if (flags == PPP_EAP_TLS_FLAG_NONE) + { + // As it is the latest message, we need to cleanup + Free(p->Eap_TlsCtx.CachedBufferSend); + p->Eap_TlsCtx.CachedBufferSend = NULL; + p->Eap_TlsCtx.CachedBufferSendPntr = NULL; + } + } + else + { + // It probably should be the final ACK on closed SSL pipe + SyncSslPipe(p->Eap_TlsCtx.SslPipe); + if (p->Eap_TlsCtx.ClientCert.X != NULL) + { + IPC *ipc; + ETHERIP_ID d; + UINT error_code; + + /*if (!p->Eap_TlsCtx.SslPipe->IsDisconnected) + { + dataSize = FifoSize(p->Eap_TlsCtx.SslPipe->RawOut->RecvFifo); + lcp = BuildEAPTlsRequest(p->Eap_PacketId++, dataSize, 0); + eap = lcp->Data; + ReadFifo(p->Eap_TlsCtx.SslPipe->RawOut->RecvFifo, &(eap->Tls.TlsDataWithoutLength), dataSize); + if (!PPPSendAndRetransmitRequest(p, PPP_PROTOCOL_EAP, lcp)) + { + PPPSetStatus(p, PPP_STATUS_FAIL); + WHERE; + return false; + } + Debug("Sent EAP-TLS size=%i type=%i flag=%i\n", lcp->DataSize, eap->Type, eap->Tls.Flags); + return true; + }*/ + + PPPParseUsername(p->Cedar, p->Eap_Identity, &d); + + ipc = NewIPC(p->Cedar, p->ClientSoftwareName, p->Postfix, d.HubName, d.UserName, "", + &error_code, &p->ClientIP, p->ClientPort, &p->ServerIP, p->ServerPort, + p->ClientHostname, p->CryptName, false, p->AdjustMss, NULL, p->Eap_TlsCtx.ClientCert.X, + IPC_LAYER_3); + + if (ipc != NULL) + { + PPP_PACKET *pack; + UINT identificator = p->Eap_PacketId - 1; // THIS IS A HACK TO SUPPORT VPN Client Pro on Android!!! + + p->Ipc = ipc; + PPPSetStatus(p, PPP_STATUS_AUTH_SUCCESS); + + // Just send an EAP-Success + pack = ZeroMalloc(sizeof(PPP_PACKET)); + pack->IsControl = true; + pack->Protocol = PPP_PROTOCOL_EAP; + lcp = NewPPPLCP(PPP_EAP_CODE_SUCCESS, identificator); + pack->Lcp = lcp; + Debug("Sent EAP-TLS size=%i SUCCESS\n", lcp->DataSize); + if (!PPPSendPacketAndFree(p, pack)) + { + PPPSetStatus(p, PPP_STATUS_FAIL); + WHERE; + return false; + } + return true; + } + else + { + PPP_PACKET *pack; + UINT identificator = p->Eap_PacketId - 1; // THIS IS A HACK TO SUPPORT VPN Client Pro on Android!!! + + PPPSetStatus(p, PPP_STATUS_AUTH_FAIL); + + pack = ZeroMalloc(sizeof(PPP_PACKET)); + pack->IsControl = true; + pack->Protocol = PPP_PROTOCOL_EAP; + lcp = NewPPPLCP(PPP_EAP_CODE_FAILURE, identificator); + pack->Lcp = lcp; + Debug("Sent EAP-TLS size=%i FAILURE\n", lcp->DataSize); + if (!PPPSendPacketAndFree(p, pack)) + { + PPPSetStatus(p, PPP_STATUS_FAIL); + WHERE; + return false; + } + return false; + } + } + else + { + // Some clients needs a little help it seems - namely VPN Client Pro on Android + flags |= PPP_EAP_TLS_FLAG_SSLSTARTED; + lcp = BuildEAPTlsRequest(p->Eap_PacketId++, 0, flags); + PPPSetStatus(p, PPP_STATUS_AUTHENTICATING); + if (!PPPSendAndRetransmitRequest(p, PPP_PROTOCOL_EAP, lcp)) + { + PPPSetStatus(p, PPP_STATUS_FAIL); + WHERE; + return false; + } + Debug("Sent EAP-TLS size=%i\n", lcp->DataSize); + return true; + } + } + return true; + } + dataBuffer = eap_packet->Tls.TlsDataWithoutLength; + dataSize = eapTlsSize - 1; + if (eap_packet->Tls.Flags & PPP_EAP_TLS_FLAG_TLS_LENGTH) + { + dataBuffer = eap_packet->Tls.TlsDataWithLength.Data; + dataSize -= 4; + tlsLength = Endian32(eap_packet->Tls.TlsDataWithLength.TlsLength); + } + /*Debug("=======RECV EAP-TLS PACKET DUMP=======\n"); + for (i = 0; i < dataSize; i++) + { + if (i > 0) printf(" "); + Debug("%02X", dataBuffer[i]); + } + Debug("\n=======RECV EAP-TLS PACKET DUMP END=======\n");*/ + if (eap_packet->Tls.Flags & PPP_EAP_TLS_FLAG_FRAGMENTED) + { + isFragmented = true; + } + + if (p->PPPStatus == PPP_STATUS_AUTHENTICATING) + { + // First we initialize the SslPipe if it is not already inited + if (p->Eap_TlsCtx.SslPipe == NULL) + { + p->Eap_TlsCtx.Dh = DhNewFromBits(DH_PARAM_BITS_DEFAULT); + p->Eap_TlsCtx.SslPipe = NewSslPipeEx(true, p->Cedar->ServerX, p->Cedar->ServerK, p->Eap_TlsCtx.Dh, true, &(p->Eap_TlsCtx.ClientCert)); + } + + // If the current frame is fragmented, or it is a possible last of a fragmented series, bufferize it + if (isFragmented || p->Eap_TlsCtx.CachedBufferRecv != NULL) + { + if (p->Eap_TlsCtx.CachedBufferRecv == NULL && tlsLength > 0) + { + p->Eap_TlsCtx.CachedBufferRecv = ZeroMalloc(MAX(dataSize, tlsLength)); + p->Eap_TlsCtx.CachedBufferRecvPntr = p->Eap_TlsCtx.CachedBufferRecv; + } + else if (p->Eap_TlsCtx.CachedBufferRecv == NULL) + { + p->Eap_TlsCtx.CachedBufferRecv = ZeroMalloc(MAX(dataSize, PPP_MRU_MAX * 10)); // 10 MRUs should be enough + p->Eap_TlsCtx.CachedBufferRecvPntr = p->Eap_TlsCtx.CachedBufferRecv; + } + sizeLeft = GetMemSize(p->Eap_TlsCtx.CachedBufferRecv); + sizeLeft -= (UINT)(p->Eap_TlsCtx.CachedBufferRecvPntr - p->Eap_TlsCtx.CachedBufferRecv); + + Copy(p->Eap_TlsCtx.CachedBufferRecvPntr, dataBuffer, MIN(sizeLeft, dataSize)); + + p->Eap_TlsCtx.CachedBufferRecvPntr += MIN(sizeLeft, dataSize); + } + + // If we got a cached buffer, we should feed the FIFOs via it + if (p->Eap_TlsCtx.CachedBufferRecv != NULL) + { + dataBuffer = p->Eap_TlsCtx.CachedBufferRecv; + dataSize = GetMemSize(p->Eap_TlsCtx.CachedBufferRecv); + if (dataSize == MAX_BUFFERING_PACKET_SIZE) + { + dataSize = (UINT)(p->Eap_TlsCtx.CachedBufferRecvPntr - p->Eap_TlsCtx.CachedBufferRecv); + } + } + + // Just acknoweldge that we buffered the fragmented data + if (isFragmented) + { + PPP_LCP *lcp = BuildEAPPacketEx(PPP_EAP_CODE_REQUEST, p->Eap_PacketId++, PPP_EAP_TYPE_TLS, 0); + if (!PPPSendAndRetransmitRequest(p, PPP_PROTOCOL_EAP, lcp)) + { + PPPSetStatus(p, PPP_STATUS_FAIL); + WHERE; + return false; + } + Debug("Sent EAP-TLS size=%i\n", lcp->DataSize); + } + else + { + /*Debug("=======RECV EAP-TLS FIFO DUMP=======\n"); + for (i = 0; i < dataSize; i++) + { + if (i > 0) printf(" "); + Debug("%02X", dataBuffer[i]); + } + Debug("\n=======RECV EAP-TLS PACKET FIFO END=======\n");*/ + WriteFifo(p->Eap_TlsCtx.SslPipe->RawIn->SendFifo, dataBuffer, dataSize); + SyncSslPipe(p->Eap_TlsCtx.SslPipe); + // Delete the cached buffer after we fed it into the pipe + if (p->Eap_TlsCtx.CachedBufferRecv != NULL) + { + Free(p->Eap_TlsCtx.CachedBufferRecv); + p->Eap_TlsCtx.CachedBufferRecv = NULL; + p->Eap_TlsCtx.CachedBufferRecvPntr = NULL; + } + + if (p->Eap_TlsCtx.SslPipe->IsDisconnected == false) + { + dataSize = FifoSize(p->Eap_TlsCtx.SslPipe->RawOut->RecvFifo); + // Do we need to send a fragmented packet? + if (dataSize > p->Mru1 - 8 - 1 - 1) + { + if (p->Eap_TlsCtx.CachedBufferSend == NULL) + { + p->Eap_TlsCtx.CachedBufferSend = ZeroMalloc(dataSize); + p->Eap_TlsCtx.CachedBufferSendPntr = p->Eap_TlsCtx.CachedBufferSend; + } + ReadFifo(p->Eap_TlsCtx.SslPipe->RawOut->RecvFifo, p->Eap_TlsCtx.CachedBufferSend, dataSize); + + // Now send data from the cached buffer with set fragmentation flag and also total TLS Size + tlsLength = dataSize; + dataSize = p->Mru1 - 8 - 1 - 1 - 4; // Calculating the maximum payload size (adjusting for including TlsLength) + flags = PPP_EAP_TLS_FLAG_TLS_LENGTH; // L flag + flags |= PPP_EAP_TLS_FLAG_FRAGMENTED; // M flag + lcp = BuildEAPTlsRequest(p->Eap_PacketId++, dataSize, flags); + eap = lcp->Data; + eap->Tls.TlsDataWithLength.TlsLength = Endian32(tlsLength); + Copy(eap->Tls.TlsDataWithLength.Data, p->Eap_TlsCtx.CachedBufferSend, dataSize); + p->Eap_TlsCtx.CachedBufferSendPntr += dataSize; + if (!PPPSendAndRetransmitRequest(p, PPP_PROTOCOL_EAP, lcp)) + { + PPPSetStatus(p, PPP_STATUS_FAIL); + WHERE; + return false; + } + Debug("Sent EAP-TLS size=%i type=%i flag=%i\n", lcp->DataSize, eap->Type, eap->Tls.Flags); + } + else + { + lcp = BuildEAPTlsRequest(p->Eap_PacketId++, dataSize, 0); + eap = lcp->Data; + ReadFifo(p->Eap_TlsCtx.SslPipe->RawOut->RecvFifo, &(eap->Tls.TlsDataWithoutLength), dataSize); + if (!PPPSendAndRetransmitRequest(p, PPP_PROTOCOL_EAP, lcp)) + { + PPPSetStatus(p, PPP_STATUS_FAIL); + WHERE; + return false; + } + Debug("Sent EAP-TLS size=%i type=%i flag=%i\n", lcp->DataSize, eap->Type, eap->Tls.Flags); + } + } + } + } + else + { + Debug("Got an EAP_TLS packet when not authenticating, ignoring...\n"); + } + return false; +} + +PPP_LCP *BuildEAPPacketEx(UCHAR code, UCHAR id, UCHAR type, UINT datasize) +{ + PPP_EAP *eap_packet; + PPP_LCP *lcp_packet; + UINT lcpDatasize; + lcpDatasize = datasize + sizeof(UCHAR); + eap_packet = ZeroMalloc(lcpDatasize); + eap_packet->Type = type; + lcp_packet = NewPPPLCP(code, id); + lcp_packet->Data = eap_packet; + lcp_packet->DataSize = lcpDatasize; + return lcp_packet; +} + +PPP_LCP *BuildEAPTlsPacketEx(UCHAR code, UCHAR id, UCHAR type, UINT datasize, UCHAR flags) +{ + PPP_LCP *lcp_packet; + PPP_EAP *eap_packet; + UINT tls_datasize = datasize + sizeof(UCHAR); + if (flags & PPP_EAP_TLS_FLAG_TLS_LENGTH) + { + tls_datasize += sizeof(UINT); + } + lcp_packet = BuildEAPPacketEx(code, id, type, tls_datasize); + eap_packet = lcp_packet->Data; + eap_packet->Tls.Flags = flags; + return lcp_packet; +} + +PPP_LCP *BuildEAPTlsRequest(UCHAR id, UINT datasize, UCHAR flags) +{ + return BuildEAPTlsPacketEx(PPP_EAP_CODE_REQUEST, id, PPP_EAP_TYPE_TLS, datasize, flags); +} + +// Other packet utilities + +// Get the option value +PPP_OPTION *PPPGetOptionValue(PPP_LCP *c, UCHAR type) +{ + UINT i; + // Validate arguments + if (c == NULL) + { + return NULL; + } + + for (i = 0; i < LIST_NUM(c->OptionList); i++) + { + PPP_OPTION *t = LIST_DATA(c->OptionList, i); + + if (t->Type == type) + { + return t; + } + } + + return NULL; +} + +// Check whether the Virtual HUB with the specified name exist? +bool IsHubExistsWithLock(CEDAR *cedar, char *hubname) +{ + bool ret = false; + // Validate arguments + if (cedar == NULL || hubname == NULL) + { + return false; + } + + LockList(cedar->HubList); + { + ret = IsHub(cedar, hubname); + } + UnlockList(cedar->HubList); + + return ret; +} + +// Sets the PPP status without overwriting the FAIL status +void PPPSetStatus(PPP_SESSION *p, UINT status) +{ + if (status == PPP_STATUS_FAIL) + { + Debug("SETTING PPP_STATUS_FAIL!!!\n"); + } + if (!PPP_STATUS_IS_UNAVAILABLE(p->PPPStatus) || PPP_STATUS_IS_UNAVAILABLE(status)) + { + p->PPPStatus = status; + } +} + + +// Memory freeing functions + +// Release the PPP session +void FreePPPSession(PPP_SESSION *p) +{ + UINT i; + // Validate arguments + if (p == NULL) + { + return; + } + + // Release the memory + for (i = 0; i < LIST_NUM(p->RecvPacketList); i++) + { + PPP_PACKET *pp = LIST_DATA(p->RecvPacketList, i); + + FreePPPPacket(pp); + } + ReleaseList(p->RecvPacketList); + + for (i = 0; i < LIST_NUM(p->SentReqPacketList); i++) + { + PPP_REQUEST_RESEND *t = LIST_DATA(p->SentReqPacketList, i); + FreePPPPacket(t->Packet); + + Free(t); + } + + ReleaseList(p->SentReqPacketList); + + for (i = 0; i < LIST_NUM(p->DelayedPackets); i++) + { + PPP_DELAYED_PACKET *t = LIST_DATA(p->DelayedPackets, i); + FreePPPPacket(t->Packet); + + Free(t); + } + + ReleaseList(p->DelayedPackets); + + if (p->CurrentPacket != NULL) + { + FreePPPPacket(p->CurrentPacket); + } + + if (p->TubeRecv != NULL) + { + // Record the PPP disconnect reason code for L2TP + p->TubeRecv->IntParam1 = p->DisconnectCauseCode; + p->TubeRecv->IntParam2 = p->DisconnectCauseDirection; + } + + // Freeing EAP-TLS context + if (p->Eap_TlsCtx.CachedBufferRecv != NULL) + { + Free(p->Eap_TlsCtx.CachedBufferRecv); + } + if (p->Eap_TlsCtx.CachedBufferSend != NULL) + { + Free(p->Eap_TlsCtx.CachedBufferSend); + } + if (p->Eap_TlsCtx.SslPipe != NULL) + { + FreeSslPipe(p->Eap_TlsCtx.SslPipe); + } + if (p->Eap_TlsCtx.ClientCert.X != NULL) + { + FreeX(p->Eap_TlsCtx.ClientCert.X); + } + if (p->Eap_TlsCtx.Dh != NULL) + { + DhFree(p->Eap_TlsCtx.Dh); + } + + + FreeTubeFlushList(p->FlushList); + + TubeDisconnect(p->TubeRecv); + TubeDisconnect(p->TubeSend); + + ReleaseCedar(p->Cedar); + + ReleaseTube(p->TubeRecv); + ReleaseTube(p->TubeSend); + + if (p->Ipc != NULL) + { + FreeIPC(p->Ipc); + } + + PPPFreeEapClient(p); + + Free(p); +} + +// Release the LCP +void FreePPPLCP(PPP_LCP *c) +{ + // Validate arguments + if (c == NULL) + { + return; + } + + FreePPPOptionList(c->OptionList); + + Free(c->Data); + + Free(c); +} + +// Release the PPP options list +void FreePPPOptionList(LIST *o) +{ + UINT i; + // Validate arguments + if (o == NULL) + { + return; + } + + for (i = 0; i < LIST_NUM(o); i++) + { + PPP_OPTION *t = LIST_DATA(o, i); + + Free(t); + } + + ReleaseList(o); +} + +// Release the PPP packet +void FreePPPPacket(PPP_PACKET *pp) +{ + FreePPPPacketEx(pp, false); +} + +void FreePPPPacketEx(PPP_PACKET *pp, bool no_free_struct) +{ + // Validate arguments + if (pp == NULL) + { + return; + } + + FreePPPLCP(pp->Lcp); + + Free(pp->Data); + + if (no_free_struct == false) + { + Free(pp); + } +} + +// Free the associated EAP client +void PPPFreeEapClient(PPP_SESSION *p) +{ + if (p == NULL) + { + return; + } + + if (p->EapClient != NULL) + { + ReleaseEapClient(p->EapClient); + p->EapClient = NULL; + } +} + + +// Utility functions used not only in PPP stack + +// Separate into the user name and the Virtual HUB name by analyzing the string +bool PPPParseUsername(CEDAR *cedar, char *src_username, ETHERIP_ID *dst) +{ + UINT i, len, last_at, first_en; + char token1[MAX_SIZE]; // username + char token2[MAX_SIZE]; // hub_name + char src[MAX_SIZE]; + // Validate arguments + Zero(dst, sizeof(ETHERIP_ID)); + if (cedar == NULL || dst == NULL) + { + return false; + } + + StrCpy(src, sizeof(src), src_username); + Trim(src); + + // Search for the first "\\" in the string + len = StrLen(src); + + first_en = SearchStrEx(src, "\\", 0, true); + + if (first_en != INFINITE && first_en >= 1 && (first_en < (len - 1))) + { + StrCpy(token1, sizeof(token1), src + first_en + 1); + StrCpy(token2, sizeof(token2), src); + token2[first_en] = 0; + + // Confirm whether the hubname exists if the virtual HUB name is + // specified like as hubname\username + if (IsHubExistsWithLock(cedar, token2) == false) + { + // If the hubname does not exist, restore to the original name + StrCpy(token1, sizeof(token1), src); + ClearStr(token2, sizeof(token2)); + } + } + else + { + // Search for the separator character's last position in the string + len = StrLen(src); + last_at = INFINITE; + for (i = 0; i < len; i++) + { + char c = src[i]; + + if (c == cedar->UsernameHubSeparator) + { + last_at = i; + } + } + + Zero(token1, sizeof(token1)); + Zero(token2, sizeof(token2)); + + if (last_at == INFINITE) + { + // The separator character is not specifiedd + StrCpy(token1, sizeof(token1), src); + } + else + { + StrCpy(token1, sizeof(token1), src); + token1[last_at] = 0; + + StrCpy(token2, sizeof(token2), src + last_at + 1); + } + + // Check whether such Virtual HUB exists If the virtual HUB name is specified + if (IsEmptyStr(token2) == false) + { + if (IsHubExistsWithLock(cedar, token2) == false) + { + // Because the specified virtual HUB name doesn't exist, it's considered to be a part of the user name + StrCpy(token1, sizeof(token1), src); + + ClearStr(token2, sizeof(token2)); + } + } + } + + if (IsEmptyStr(token2)) + { + // Select the default Virtual HUB if the Virtual HUB name is not specified + StrCpy(token2, sizeof(token2), SERVER_DEFAULT_HUB_NAME); + if (cedar->Server != NULL && cedar->Server->IPsecServer != NULL) + { + Lock(cedar->Server->IPsecServer->LockSettings); + { + IPsecNormalizeServiceSetting(cedar->Server->IPsecServer); + + StrCpy(token2, sizeof(token2), cedar->Server->IPsecServer->Services.L2TP_DefaultHub); + } + Unlock(cedar->Server->IPsecServer->LockSettings); + } + + } + + // Return the results + StrCpy(dst->HubName, sizeof(dst->HubName), token2); + StrCpy(dst->UserName, sizeof(dst->UserName), token1); + + return true; +} + +// Generate the NT hash of the password +void GenerateNtPasswordHash(UCHAR *dst, char *password) +{ + UCHAR *tmp; + UINT tmp_size; + UINT i, len; + // Validate arguments + if (dst == NULL || password == NULL) + { + return; + } + + // Generate a Unicode password + len = StrLen(password); + tmp_size = len * 2; + + tmp = ZeroMalloc(tmp_size); + + for (i = 0; i < len; i++) + { + tmp[i * 2] = password[i]; + } + + // Hashing + HashMd4(dst, tmp, tmp_size); + + Free(tmp); +} + +// Generate the MS-CHAPv2 server-side challenge +void MsChapV2Server_GenerateChallenge(UCHAR *dst) +{ + // Validate arguments + if (dst == NULL) + { + return; + } + + Rand(dst, 16); +} + +// Generate the MS-CHAPv2 client-side challenge +void MsChapV2Client_GenerateChallenge(UCHAR *dst) +{ + // Validate arguments + if (dst == NULL) + { + return; + } + + Rand(dst, 16); +} + +// Generate a 8 bytes challenge +void MsChapV2_GenerateChallenge8(UCHAR *dst, UCHAR *client_challenge, UCHAR *server_challenge, char *username) +{ + BUF *b; + UCHAR hash[SHA1_SIZE]; + char username2[MAX_SIZE]; + char domainname2[MAX_SIZE]; + // Validate arguments + if (dst == NULL || client_challenge == NULL || server_challenge == NULL) + { + return; + } + + b = NewBuf(); + + WriteBuf(b, client_challenge, 16); + WriteBuf(b, server_challenge, 16); + + ParseNtUsername(username, username2, sizeof(username2), domainname2, sizeof(domainname2), true); + + if (IsEmptyStr(username2) == false) + { + WriteBuf(b, username2, StrLen(username2)); + } + + Sha1(hash, b->Buf, b->Size); + + FreeBuf(b); + + Copy(dst, hash, 8); +} + +// Generate the MS-CHAPv2 client response +void MsChapV2Client_GenerateResponse(UCHAR *dst, UCHAR *challenge8, UCHAR *nt_password_hash) +{ + UCHAR password_hash_2[21]; + UCHAR key1[8], key2[8], key3[8]; + // Validate arguments + if (dst == NULL || challenge8 == NULL || nt_password_hash == NULL) + { + return; + } + + Zero(password_hash_2, sizeof(password_hash_2)); + Copy(password_hash_2, nt_password_hash, 16); + + Zero(key1, sizeof(key1)); + Zero(key2, sizeof(key2)); + Zero(key3, sizeof(key3)); + + Copy(key1, password_hash_2 + 0, 7); + Copy(key2, password_hash_2 + 7, 7); + Copy(key3, password_hash_2 + 14, 7); + + DesEcbEncrypt(dst + 0, challenge8, key1); + DesEcbEncrypt(dst + 8, challenge8, key2); + DesEcbEncrypt(dst + 16, challenge8, key3); +} + +// Generate a hash of the hash of the NT password +void GenerateNtPasswordHashHash(UCHAR *dst_hash, UCHAR *src_hash) +{ + // Validate arguments + if (dst_hash == NULL || src_hash == NULL) + { + return; + } + + HashMd4(dst_hash, src_hash, 16); +} + +// Generate the MS-CHAPv2 server response +void MsChapV2Server_GenerateResponse(UCHAR *dst, UCHAR *nt_password_hash_hash, UCHAR *client_response, UCHAR *challenge8) +{ + UCHAR digest[SHA1_SIZE]; + BUF *b; + char *magic1 = "Magic server to client signing constant"; + char *magic2 = "Pad to make it do more than one iteration"; + // Validate arguments + if (dst == NULL || nt_password_hash_hash == NULL || client_response == NULL || challenge8 == NULL) + { + return; + } + + b = NewBuf(); + WriteBuf(b, nt_password_hash_hash, 16); + WriteBuf(b, client_response, 24); + WriteBuf(b, magic1, StrLen(magic1)); + Sha1(digest, b->Buf, b->Size); + FreeBuf(b); + + b = NewBuf(); + WriteBuf(b, digest, sizeof(digest)); + WriteBuf(b, challenge8, 8); + WriteBuf(b, magic2, StrLen(magic2)); + Sha1(dst, b->Buf, b->Size); + FreeBuf(b); +} + +// Verify whether the password matches one that is specified by the user in the MS-CHAPv2 +bool MsChapV2VerityPassword(IPC_MSCHAP_V2_AUTHINFO *d, char *password) +{ + UCHAR ntlm_hash[MD5_SIZE]; + UCHAR challenge8[8]; + UCHAR client_response[24]; + // Validate arguments + if (d == NULL || password == NULL) + { + return false; + } + + GenerateNtPasswordHash(ntlm_hash, password); + MsChapV2_GenerateChallenge8(challenge8, d->MsChapV2_ClientChallenge, d->MsChapV2_ServerChallenge, d->MsChapV2_PPPUsername); + MsChapV2Client_GenerateResponse(client_response, challenge8, ntlm_hash); + + if (Cmp(client_response, d->MsChapV2_ClientResponse, 24) != 0) + { + return false; + } + + return true; +} + +// Estimate the password in the brute force for the request packet of MS-CHAPv2 +char *MsChapV2DoBruteForce(IPC_MSCHAP_V2_AUTHINFO *d, LIST *password_list) +{ + UINT i; + // Validate arguments + if (d == NULL || password_list == NULL) + { + return NULL; + } + + for (i = 0; i < LIST_NUM(password_list); i++) + { + char *s = LIST_DATA(password_list, i); + char tmp[MAX_SIZE]; + UINT j, max; + UINT len; + + StrCpy(tmp, sizeof(tmp), s); + + len = StrLen(tmp); + max = Power(2, MIN(len, 9)); + + for (j = 0; j < max; j++) + { + SetStrCaseAccordingToBits(tmp, j); + if (MsChapV2VerityPassword(d, tmp)) + { + return CopyStr(tmp); + } + } + } + + return NULL; +} diff --git a/src/Cedar/Proto_PPP.h b/src/Cedar/Proto_PPP.h index 8414fec9..b8163d84 100644 --- a/src/Cedar/Proto_PPP.h +++ b/src/Cedar/Proto_PPP.h @@ -1,414 +1,414 @@ -// SoftEther VPN Source Code - Developer Edition Master Branch -// Cedar Communication Module - - -// Proto_PPP.h -// Header of Proto_PPP.c - -#ifndef PROTO_PPP_H -#define PROTO_PPP_H - - -//// Macro -#define PPP_LCP_CODE_IS_NEGATIVE(c) ((c) == PPP_LCP_CODE_NAK || (c) == PPP_LCP_CODE_REJECT || (c) == PPP_LCP_CODE_CODE_REJECT || (c) == PPP_LCP_CODE_PROTOCOL_REJECT) -#define PPP_LCP_CODE_IS_REQUEST(c) ((c) == PPP_LCP_CODE_REQ) -#define PPP_LCP_CODE_IS_RESPONSE(c) ((c) == PPP_LCP_CODE_ACK || (c) == PPP_LCP_CODE_NAK || (c) == PPP_LCP_CODE_REJECT || (c) == PPP_LCP_CODE_PROTOCOL_REJECT) -#define PPP_LCP_CODE_IS_WITH_OPTION_LIST(c) ((c) == PPP_LCP_CODE_REQ || (c) == PPP_LCP_CODE_ACK || (c) == PPP_LCP_CODE_NAK || (c) == PPP_LCP_CODE_REJECT) - -#define PPP_PAP_CODE_IS_REQUEST(c) ((c) == PPP_PAP_CODE_REQ) -#define PPP_PAP_CODE_IS_RESPONSE(c) ((c) == PPP_PAP_CODE_ACK || (c) == PPP_PAP_CODE_NAK) - -#define PPP_CHAP_CODE_IS_REQUEST(c) ((c) == PPP_CHAP_CODE_CHALLENGE || (c) == PPP_CHAP_CODE_SUCCESS || (c) == PPP_CHAP_CODE_FAILURE) -#define PPP_CHAP_CODE_IS_RESPONSE(c) ((c) == PPP_CHAP_CODE_RESPONSE) - -#define PPP_EAP_CODE_IS_REQUEST(c) ((c) == PPP_EAP_CODE_REQUEST) -#define PPP_EAP_CODE_IS_RESPONSE(c) ((c) == PPP_EAP_CODE_RESPONSE || (c) == PPP_EAP_CODE_SUCCESS || (c) == PPP_EAP_CODE_FAILURE) - -#define PPP_CODE_IS_RESPONSE(protocol, c) ((((protocol) == PPP_PROTOCOL_LCP || (protocol) == PPP_PROTOCOL_IPCP || (protocol) == PPP_PROTOCOL_IPV6CP) && PPP_LCP_CODE_IS_RESPONSE(c)) || (((protocol) == PPP_PROTOCOL_PAP) && PPP_PAP_CODE_IS_RESPONSE(c)) || (((protocol) == PPP_PROTOCOL_CHAP) && PPP_CHAP_CODE_IS_RESPONSE(c)) || (((protocol) == PPP_PROTOCOL_EAP) && PPP_EAP_CODE_IS_RESPONSE(c))) -#define PPP_CODE_IS_REQUEST(protocol, c) ((((protocol) == PPP_PROTOCOL_LCP || (protocol) == PPP_PROTOCOL_IPCP || (protocol) == PPP_PROTOCOL_IPV6CP) && PPP_LCP_CODE_IS_REQUEST(c)) || (((protocol) == PPP_PROTOCOL_PAP) && PPP_PAP_CODE_IS_REQUEST(c)) || (((protocol) == PPP_PROTOCOL_CHAP) && PPP_CHAP_CODE_IS_REQUEST(c)) || (((protocol) == PPP_PROTOCOL_EAP) && PPP_EAP_CODE_IS_REQUEST(c))) -#define PPP_CODE_IS_WITH_OPTION_LIST(protocol, c) ((((protocol) == PPP_PROTOCOL_LCP || (protocol) == PPP_PROTOCOL_IPCP || (protocol) == PPP_PROTOCOL_IPV6CP) && PPP_LCP_CODE_IS_WITH_OPTION_LIST(c)) || false) - -#define PPP_IS_SUPPORTED_PROTOCOL(p) ((p) == PPP_PROTOCOL_LCP || (p) == PPP_PROTOCOL_PAP || (p) == PPP_PROTOCOL_CHAP || (p) == PPP_PROTOCOL_IPCP || (p) == PPP_PROTOCOL_IPV6CP || (p) == PPP_PROTOCOL_IP || (p) == PPP_PROTOCOL_IPV6 || (p) == PPP_PROTOCOL_EAP ) - -#define PPP_STATUS_IS_UNAVAILABLE(c) ((c) == PPP_STATUS_FAIL || (c) == PPP_STATUS_AUTH_FAIL || (c) == PPP_STATUS_CLOSING || (c) == PPP_STATUS_CLOSING_WAIT || (c) == PPP_STATUS_CLOSED) - -//// Constants - -// Time-out value -#define PPP_PACKET_RECV_TIMEOUT (15 * 1000) // Timeout until the next packet is received (3/4 of default policy) -#define PPP_PACKET_RESEND_INTERVAL (3 * 1000) // Retransmission interval of the last packet -#define PPP_TERMINATE_TIMEOUT 2000 // Timeout value to complete disconnection after requesting to disconnect in the PPP -#define PPP_ECHO_SEND_INTERVAL 4792 // Transmission interval of PPP Echo Request -#define PPP_DATA_TIMEOUT (20 * 1000) // Communication time-out (from default policy) - -// MRU -#define PPP_MRU_DEFAULT 1500 // Default value -#define PPP_MRU_MIN 100 // Minimum value -#define PPP_MRU_MAX 1500 // Maximum value - -// PPP protocol (for control) -#define PPP_PROTOCOL_LCP 0xc021 -#define PPP_PROTOCOL_PAP 0xc023 -#define PPP_PROTOCOL_IPCP 0x8021 -#define PPP_PROTOCOL_CHAP 0xc223 -#define PPP_PROTOCOL_EAP 0xc227 -#define PPP_PROTOCOL_IPV6CP 0x8057 - -// PPP protocol (for transfer) -#define PPP_PROTOCOL_IP 0x0021 -#define PPP_PROTOCOL_IPV6 0x0057 - -// LCP code -#define PPP_LCP_CODE_REQ 1 -#define PPP_LCP_CODE_ACK 2 -#define PPP_LCP_CODE_NAK 3 -#define PPP_LCP_CODE_REJECT 4 -#define PPP_LCP_CODE_TERMINATE_REQ 5 -#define PPP_LCP_CODE_TERMINATE_ACK 6 -#define PPP_LCP_CODE_CODE_REJECT 7 -#define PPP_LCP_CODE_PROTOCOL_REJECT 8 -#define PPP_LCP_CODE_ECHO_REQUEST 9 -#define PPP_LCP_CODE_ECHO_RESPONSE 10 -#define PPP_LCP_CODE_DROP 11 -#define PPP_LCP_CODE_IDENTIFICATION 12 - -// PAP Code -#define PPP_PAP_CODE_REQ 1 -#define PPP_PAP_CODE_ACK 2 -#define PPP_PAP_CODE_NAK 3 - -// CHAP code -#define PPP_CHAP_CODE_CHALLENGE 1 -#define PPP_CHAP_CODE_RESPONSE 2 -#define PPP_CHAP_CODE_SUCCESS 3 -#define PPP_CHAP_CODE_FAILURE 4 - -// LCP Option Type -#define PPP_LCP_OPTION_MRU 1 -#define PPP_LCP_OPTION_AUTH 3 - -// IPCP option type -#define PPP_IPCP_OPTION_IP 3 -#define PPP_IPCP_OPTION_DNS1 129 -#define PPP_IPCP_OPTION_DNS2 131 -#define PPP_IPCP_OPTION_WINS1 130 -#define PPP_IPCP_OPTION_WINS2 132 - -// IPV6CP option type -#define PPP_IPV6CP_OPTION_EUI 1 - -// EAP codes -#define PPP_EAP_CODE_REQUEST 1 -#define PPP_EAP_CODE_RESPONSE 2 -#define PPP_EAP_CODE_SUCCESS 3 -#define PPP_EAP_CODE_FAILURE 4 - -// EAP types -#define PPP_EAP_TYPE_IDENTITY 1 -#define PPP_EAP_TYPE_NOTIFICATION 2 -#define PPP_EAP_TYPE_NAK 3 -#define PPP_EAP_TYPE_TLS 13 - -// EAP-TLS Flags -#define PPP_EAP_TLS_FLAG_NONE 0 -#define PPP_EAP_TLS_FLAG_TLS_LENGTH 1 << 7 -#define PPP_EAP_TLS_FLAG_FRAGMENTED 1 << 6 -#define PPP_EAP_TLS_FLAG_SSLSTARTED 1 << 5 - -// Authentication protocol -#define PPP_LCP_AUTH_PAP PPP_PROTOCOL_PAP -#define PPP_LCP_AUTH_CHAP PPP_PROTOCOL_CHAP -#define PPP_LCP_AUTH_EAP PPP_PROTOCOL_EAP - -// Algorithm of CHAP -#define PPP_CHAP_ALG_MS_CHAP_V2 0x81 - -// Link status -#define PPP_STATUS_CONNECTED 0x1 -#define PPP_STATUS_BEFORE_AUTH 0x10 -#define PPP_STATUS_AUTHENTICATING 0x11 -#define PPP_STATUS_AUTH_SUCCESS 0x19 -#define PPP_STATUS_NETWORK_LAYER 0x20 -#define PPP_STATUS_CLOSING 0x100 -#define PPP_STATUS_CLOSING_WAIT 0x101 -#define PPP_STATUS_CLOSED 0x110 -#define PPP_STATUS_FAIL 0x1000 -#define PPP_STATUS_AUTH_FAIL 0x1010 - -#define PPP_UNSPECIFIED 0xFFFF - -//// Type - -// IP options used in the PPP -struct PPP_IPOPTION -{ - IP IpAddress; // IP address - IP DnsServer1, DnsServer2; // DNS server address - IP WinsServer1, WinsServer2; // WINS server address -}; - -// PPP packet -struct PPP_PACKET -{ - USHORT Protocol; // Protocol - bool IsControl; // Whether or not the control packet - PPP_LCP *Lcp; // LCP packet data - UINT DataSize; // Data size - void *Data; // Data body -}; - -// PPP LCP packet -struct PPP_LCP -{ - UCHAR Code; // Code - UCHAR Id; // ID - UCHAR MagicNumber[4]; // Magic number - LIST *OptionList; // PPP options list - void *Data; // Data - UINT DataSize; // Data size -}; - -// PPP Options -struct PPP_OPTION -{ - UCHAR Type; // Type of option - UINT DataSize; // Data size - UCHAR Data[254]; // Data - bool IsSupported; // Flag of whether it is supported - bool IsAccepted; // Flag for whether accepted - UCHAR AltData[254]; // Alternate data when it isn't accepted - UINT AltDataSize; // Alternate data size -}; - -#ifdef OS_WIN32 -#pragma pack(push, 1) -#else // OS_WIN32 -#pragma pack(1) -#endif - - -// PPP EAP packet -// EAP is a subset of LCP, sharing Code and Id. The Data field is then mapped to this structure -// We got 8 bytes of size before this structure -struct PPP_EAP -{ - UCHAR Type; - union { - UCHAR Data[0]; - struct PPP_EAP_TLS - { - UCHAR Flags; - union { - UCHAR TlsDataWithoutLength[0]; - struct - { - UINT TlsLength; - UCHAR Data[0]; - } TlsDataWithLength; - }; - } Tls; - }; -} GCC_PACKED; - -#ifdef OS_WIN32 -#pragma pack(pop) -#else // OS_WIN32 -#pragma pack() -#endif - -struct PPP_EAP_TLS_CONTEXT -{ - SSL_PIPE *SslPipe; - DH_CTX *Dh; - struct SslClientCertInfo ClientCert; - UCHAR *CachedBufferRecv; - UCHAR *CachedBufferRecvPntr; - UCHAR *CachedBufferSend; - UCHAR *CachedBufferSendPntr; -}; - -// PPP request resend -struct PPP_REQUEST_RESEND -{ - PPP_PACKET *Packet; - UCHAR Id; - UINT64 ResendTime; - UINT64 TimeoutTime; -}; - -// PPP next packet struct -struct PPP_DELAYED_PACKET -{ - PPP_PACKET *Packet; - UINT DelayTicks; -}; - -// PPP session -struct PPP_SESSION -{ - CEDAR *Cedar; // Cedar - IP ClientIP; // Client IP address - UINT ClientPort; // Client port - IP ServerIP; // Server IP address - UINT ServerPort; // Server port - TUBE *TubeSend; // Sending tube - TUBE *TubeRecv; // Receiving tube - UCHAR NextId; // ID to be used next - UINT Mru1; // MRU (server -> client) - UINT Mru2; // MRU (client -> server) - LIST *RecvPacketList; // Received packet list - bool IsTerminateReceived; // Whether a Terminate has been received - UINT DisconnectCauseCode; // L2TP disconnect cause code - UINT DisconnectCauseDirection; // L2TP disconnect cause direction code - IPC *Ipc; // IPC - bool ClientLCPOptionDetermined; // LCP option from the client has been determined - char Postfix[MAX_SIZE]; // Postfix of the session name - char ClientHostname[MAX_SIZE]; // Client host name - char ClientSoftwareName[MAX_SIZE]; // Client software name - UINT64 NextEchoSendTime; // Time to send Echo Request next - UINT64 LastRecvTime; // Time which the data has been received last - DHCP_OPTION_LIST ClientAddressOption; // Client address option - bool DhcpIpAllocTried; // Whether the request for an IP address is already attempted by DHCP - bool DhcpIpInformTried; // Whether the acquirement for an IP information is already attempted by DHCP - bool DhcpAllocated; // IP address is assigned by DHCP - bool UseStaticIPAddress; // Use a static IP address that is specified by the client - UINT64 DhcpRenewInterval; // DHCP update interval - UINT64 DhcpNextRenewTime; // DHCP renewal time of the next - char CryptName[MAX_SIZE]; // Cipher algorithm name - UINT AdjustMss; // MSS value - TUBE_FLUSH_LIST *FlushList; // Tube Flush List - bool EnableMSCHAPv2; // Enable the MS-CHAP v2 - USHORT AuthProtocol; // Authentication protocol - bool AuthOk; // Flag for whether the authentication was successful - UCHAR MsChapV2_ServerChallenge[16]; // MS-CHAPv2 Server Challenge - UCHAR MsChapV2_ClientChallenge[16]; // MS-CHAPv2 Client Challenge - UCHAR MsChapV2_ClientResponse[24]; // MS-CHAPv2 Client Response - UCHAR MsChapV2_ServerResponse[20]; // MS-CHAPv2 Server Response - UINT MsChapV2_ErrorCode; // Authentication failure error code of MS-CHAPv2 - UINT MsChapV2_PacketId; // MS-CHAPv2 Packet ID - - bool MsChapV2_UseDoubleMsChapV2; // Use the double-MSCHAPv2 technique - EAP_CLIENT *EapClient; // EAP client - - UCHAR ServerInterfaceId[8]; // Server IPv6CP Interface Identifier - UCHAR ClientInterfaceId[8]; // Client IPv6CP Interface Identifier - - UINT PPPStatus; - - // EAP contexts - UINT Eap_Protocol; // Current EAP Protocol used - UINT Eap_PacketId; // EAP Packet ID; - UCHAR Eap_Identity[MAX_SIZE]; // Received from client identity - PPP_EAP_TLS_CONTEXT Eap_TlsCtx; // Context information for EAP TLS. May be possibly reused for EAP TTLS? - - LIST *SentReqPacketList; // Sent requests list - - PPP_PACKET *CurrentPacket; - LIST *DelayedPackets; - - UINT64 PacketRecvTimeout; - UINT64 DataTimeout; - UINT64 UserConnectionTimeout; - UINT64 UserConnectionTick; - - THREAD *SessionThread; // Thread of the PPP session -}; - - - -// Function prototype - -// Main dataloop -void PPPThread(THREAD *thread, void *param); - -// Entry point -PPP_SESSION *NewPPPSession(CEDAR *cedar, IP *client_ip, UINT client_port, IP *server_ip, UINT server_port, TUBE *send_tube, TUBE *recv_tube, char *postfix, char *client_software_name, char *client_hostname, char *crypt_name, UINT adjust_mss); - -// PPP processing functions -bool PPPRejectUnsupportedPacket(PPP_SESSION *p, PPP_PACKET *pp); -bool PPPRejectUnsupportedPacketEx(PPP_SESSION *p, PPP_PACKET *pp, bool force); -bool PPPProcessRetransmissions(PPP_SESSION *p); -bool PPPSendEchoRequest(PPP_SESSION *p); -// Response packets -bool PPPProcessResponsePacket(PPP_SESSION *p, PPP_PACKET *pp, PPP_PACKET *req); -bool PPPProcessLCPResponsePacket(PPP_SESSION *p, PPP_PACKET *pp, PPP_PACKET *req); -bool PPPProcessCHAPResponsePacket(PPP_SESSION *p, PPP_PACKET *pp, PPP_PACKET *req); -bool PPPProcessIPCPResponsePacket(PPP_SESSION *p, PPP_PACKET *pp, PPP_PACKET *req); -bool PPPProcessEAPResponsePacket(PPP_SESSION *p, PPP_PACKET *pp, PPP_PACKET *req); -bool PPPProcessIPv6CPResponsePacket(PPP_SESSION *p, PPP_PACKET *pp, PPP_PACKET *req); -// Request packets -bool PPPProcessRequestPacket(PPP_SESSION *p, PPP_PACKET *pp); -bool PPPProcessLCPRequestPacket(PPP_SESSION *p, PPP_PACKET *pp); -bool PPPProcessPAPRequestPacket(PPP_SESSION *p, PPP_PACKET *pp); -bool PPPProcessIPCPRequestPacket(PPP_SESSION *p, PPP_PACKET *pp); -bool PPPProcessEAPRequestPacket(PPP_SESSION *p, PPP_PACKET *pp); -bool PPPProcessIPv6CPRequestPacket(PPP_SESSION *p, PPP_PACKET *pp); - -// LCP option based packets utility -bool PPPRejectLCPOptions(PPP_SESSION *p, PPP_PACKET *pp); -bool PPPRejectLCPOptionsEx(PPP_SESSION *p, PPP_PACKET *pp, bool simulate); -bool PPPNackLCPOptions(PPP_SESSION *p, PPP_PACKET *pp); -bool PPPNackLCPOptionsEx(PPP_SESSION *p, PPP_PACKET *pp, bool simulate); -bool PPPAckLCPOptions(PPP_SESSION *p, PPP_PACKET *pp); -bool PPPAckLCPOptionsEx(PPP_SESSION *p, PPP_PACKET *pp, bool simulate); - -// PPP networking functions -// Send packets -bool PPPSendAndRetransmitRequest(PPP_SESSION *p, USHORT protocol, PPP_LCP *c); -bool PPPSendPacketAndFree(PPP_SESSION *p, PPP_PACKET *pp); -bool PPPSendPacketEx(PPP_SESSION *p, PPP_PACKET *pp, bool no_flush); -// Receive packets -PPP_PACKET *PPPRecvPacket(PPP_SESSION *p, bool async); -// Helpers for delaying packets -PPP_PACKET *PPPGetNextPacket(PPP_SESSION *p); -void PPPAddNextPacket(PPP_SESSION *p, PPP_PACKET *pp, UINT delay); -int PPPDelayedPacketsComparator(void *a, void *b); -char PPPRelatedPacketComparator(PPP_PACKET *a, PPP_PACKET *b); - -// PPP utility functions -// Packet structures creation utilities -PPP_LCP *NewPPPLCP(UCHAR code, UCHAR id); -PPP_OPTION *NewPPPOption(UCHAR type, void *data, UINT size); -// Packet parse utilities -PPP_PACKET *ParsePPPPacket(void *data, UINT size); -PPP_LCP *PPPParseLCP(USHORT protocol, void *data, UINT size); -bool PPPParseMSCHAP2ResponsePacket(PPP_SESSION *p, PPP_PACKET *req); -// Packet building utilities -BUF *BuildPPPPacketData(PPP_PACKET *pp); -BUF *BuildLCPData(PPP_LCP *c); -PPP_LCP *BuildMSCHAP2ChallengePacket(PPP_SESSION *p); -// IPCP packet utilities -bool PPPGetIPOptionFromLCP(PPP_IPOPTION *o, PPP_LCP *c); -bool PPPSetIPOptionToLCP(PPP_IPOPTION *o, PPP_LCP *c, bool only_modify); -bool PPPGetIPAddressValueFromLCP(PPP_LCP *c, UINT type, IP *ip); -bool PPPSetIPAddressValueToLCP(PPP_LCP *c, UINT type, IP *ip, bool only_modify); -// EAP packet utilities -bool PPPProcessEAPTlsResponse(PPP_SESSION *p, PPP_EAP *eap_packet, UINT eapTlsSize); -PPP_LCP *BuildEAPPacketEx(UCHAR code, UCHAR id, UCHAR type, UINT datasize); -PPP_LCP *BuildEAPTlsPacketEx(UCHAR code, UCHAR id, UCHAR type, UINT datasize, UCHAR flags); -PPP_LCP *BuildEAPTlsRequest(UCHAR id, UINT datasize, UCHAR flags); -// Other packet utilities -PPP_OPTION *PPPGetOptionValue(PPP_LCP *c, UCHAR type); -bool IsHubExistsWithLock(CEDAR *cedar, char *hubname); -void PPPSetStatus(PPP_SESSION *p, UINT status); - -// Memory freeing functions -void FreePPPSession(PPP_SESSION *p); -void FreePPPLCP(PPP_LCP *c); -void FreePPPOptionList(LIST *o); -void FreePPPPacket(PPP_PACKET *pp); -void FreePPPPacketEx(PPP_PACKET *pp, bool no_free_struct); -void PPPFreeEapClient(PPP_SESSION *p); - -// Utility functions used not only in PPP stack -bool PPPParseUsername(CEDAR *cedar, char *src, ETHERIP_ID *dst); -void GenerateNtPasswordHash(UCHAR *dst, char *password); -void GenerateNtPasswordHashHash(UCHAR *dst_hash, UCHAR *src_hash); -void MsChapV2Server_GenerateChallenge(UCHAR *dst); -void MsChapV2_GenerateChallenge8(UCHAR *dst, UCHAR *client_challenge, UCHAR *server_challenge, char *username); -void MsChapV2Client_GenerateResponse(UCHAR *dst, UCHAR *challenge8, UCHAR *nt_password_hash); -void MsChapV2Server_GenerateResponse(UCHAR *dst, UCHAR *nt_password_hash_hash, UCHAR *client_response, UCHAR *challenge8); -bool MsChapV2VerityPassword(IPC_MSCHAP_V2_AUTHINFO *d, char *password); -char *MsChapV2DoBruteForce(IPC_MSCHAP_V2_AUTHINFO *d, LIST *password_list); - -#endif // PROTO_PPP_H +// SoftEther VPN Source Code - Developer Edition Master Branch +// Cedar Communication Module + + +// Proto_PPP.h +// Header of Proto_PPP.c + +#ifndef PROTO_PPP_H +#define PROTO_PPP_H + + +//// Macro +#define PPP_LCP_CODE_IS_NEGATIVE(c) ((c) == PPP_LCP_CODE_NAK || (c) == PPP_LCP_CODE_REJECT || (c) == PPP_LCP_CODE_CODE_REJECT || (c) == PPP_LCP_CODE_PROTOCOL_REJECT) +#define PPP_LCP_CODE_IS_REQUEST(c) ((c) == PPP_LCP_CODE_REQ) +#define PPP_LCP_CODE_IS_RESPONSE(c) ((c) == PPP_LCP_CODE_ACK || (c) == PPP_LCP_CODE_NAK || (c) == PPP_LCP_CODE_REJECT || (c) == PPP_LCP_CODE_PROTOCOL_REJECT) +#define PPP_LCP_CODE_IS_WITH_OPTION_LIST(c) ((c) == PPP_LCP_CODE_REQ || (c) == PPP_LCP_CODE_ACK || (c) == PPP_LCP_CODE_NAK || (c) == PPP_LCP_CODE_REJECT) + +#define PPP_PAP_CODE_IS_REQUEST(c) ((c) == PPP_PAP_CODE_REQ) +#define PPP_PAP_CODE_IS_RESPONSE(c) ((c) == PPP_PAP_CODE_ACK || (c) == PPP_PAP_CODE_NAK) + +#define PPP_CHAP_CODE_IS_REQUEST(c) ((c) == PPP_CHAP_CODE_CHALLENGE || (c) == PPP_CHAP_CODE_SUCCESS || (c) == PPP_CHAP_CODE_FAILURE) +#define PPP_CHAP_CODE_IS_RESPONSE(c) ((c) == PPP_CHAP_CODE_RESPONSE) + +#define PPP_EAP_CODE_IS_REQUEST(c) ((c) == PPP_EAP_CODE_REQUEST) +#define PPP_EAP_CODE_IS_RESPONSE(c) ((c) == PPP_EAP_CODE_RESPONSE || (c) == PPP_EAP_CODE_SUCCESS || (c) == PPP_EAP_CODE_FAILURE) + +#define PPP_CODE_IS_RESPONSE(protocol, c) ((((protocol) == PPP_PROTOCOL_LCP || (protocol) == PPP_PROTOCOL_IPCP || (protocol) == PPP_PROTOCOL_IPV6CP) && PPP_LCP_CODE_IS_RESPONSE(c)) || (((protocol) == PPP_PROTOCOL_PAP) && PPP_PAP_CODE_IS_RESPONSE(c)) || (((protocol) == PPP_PROTOCOL_CHAP) && PPP_CHAP_CODE_IS_RESPONSE(c)) || (((protocol) == PPP_PROTOCOL_EAP) && PPP_EAP_CODE_IS_RESPONSE(c))) +#define PPP_CODE_IS_REQUEST(protocol, c) ((((protocol) == PPP_PROTOCOL_LCP || (protocol) == PPP_PROTOCOL_IPCP || (protocol) == PPP_PROTOCOL_IPV6CP) && PPP_LCP_CODE_IS_REQUEST(c)) || (((protocol) == PPP_PROTOCOL_PAP) && PPP_PAP_CODE_IS_REQUEST(c)) || (((protocol) == PPP_PROTOCOL_CHAP) && PPP_CHAP_CODE_IS_REQUEST(c)) || (((protocol) == PPP_PROTOCOL_EAP) && PPP_EAP_CODE_IS_REQUEST(c))) +#define PPP_CODE_IS_WITH_OPTION_LIST(protocol, c) ((((protocol) == PPP_PROTOCOL_LCP || (protocol) == PPP_PROTOCOL_IPCP || (protocol) == PPP_PROTOCOL_IPV6CP) && PPP_LCP_CODE_IS_WITH_OPTION_LIST(c)) || false) + +#define PPP_IS_SUPPORTED_PROTOCOL(p) ((p) == PPP_PROTOCOL_LCP || (p) == PPP_PROTOCOL_PAP || (p) == PPP_PROTOCOL_CHAP || (p) == PPP_PROTOCOL_IPCP || (p) == PPP_PROTOCOL_IPV6CP || (p) == PPP_PROTOCOL_IP || (p) == PPP_PROTOCOL_IPV6 || (p) == PPP_PROTOCOL_EAP ) + +#define PPP_STATUS_IS_UNAVAILABLE(c) ((c) == PPP_STATUS_FAIL || (c) == PPP_STATUS_AUTH_FAIL || (c) == PPP_STATUS_CLOSING || (c) == PPP_STATUS_CLOSING_WAIT || (c) == PPP_STATUS_CLOSED) + +//// Constants + +// Time-out value +#define PPP_PACKET_RECV_TIMEOUT (15 * 1000) // Timeout until the next packet is received (3/4 of default policy) +#define PPP_PACKET_RESEND_INTERVAL (3 * 1000) // Retransmission interval of the last packet +#define PPP_TERMINATE_TIMEOUT 2000 // Timeout value to complete disconnection after requesting to disconnect in the PPP +#define PPP_ECHO_SEND_INTERVAL 4792 // Transmission interval of PPP Echo Request +#define PPP_DATA_TIMEOUT (20 * 1000) // Communication time-out (from default policy) + +// MRU +#define PPP_MRU_DEFAULT 1500 // Default value +#define PPP_MRU_MIN 100 // Minimum value +#define PPP_MRU_MAX 1500 // Maximum value + +// PPP protocol (for control) +#define PPP_PROTOCOL_LCP 0xc021 +#define PPP_PROTOCOL_PAP 0xc023 +#define PPP_PROTOCOL_IPCP 0x8021 +#define PPP_PROTOCOL_CHAP 0xc223 +#define PPP_PROTOCOL_EAP 0xc227 +#define PPP_PROTOCOL_IPV6CP 0x8057 + +// PPP protocol (for transfer) +#define PPP_PROTOCOL_IP 0x0021 +#define PPP_PROTOCOL_IPV6 0x0057 + +// LCP code +#define PPP_LCP_CODE_REQ 1 +#define PPP_LCP_CODE_ACK 2 +#define PPP_LCP_CODE_NAK 3 +#define PPP_LCP_CODE_REJECT 4 +#define PPP_LCP_CODE_TERMINATE_REQ 5 +#define PPP_LCP_CODE_TERMINATE_ACK 6 +#define PPP_LCP_CODE_CODE_REJECT 7 +#define PPP_LCP_CODE_PROTOCOL_REJECT 8 +#define PPP_LCP_CODE_ECHO_REQUEST 9 +#define PPP_LCP_CODE_ECHO_RESPONSE 10 +#define PPP_LCP_CODE_DROP 11 +#define PPP_LCP_CODE_IDENTIFICATION 12 + +// PAP Code +#define PPP_PAP_CODE_REQ 1 +#define PPP_PAP_CODE_ACK 2 +#define PPP_PAP_CODE_NAK 3 + +// CHAP code +#define PPP_CHAP_CODE_CHALLENGE 1 +#define PPP_CHAP_CODE_RESPONSE 2 +#define PPP_CHAP_CODE_SUCCESS 3 +#define PPP_CHAP_CODE_FAILURE 4 + +// LCP Option Type +#define PPP_LCP_OPTION_MRU 1 +#define PPP_LCP_OPTION_AUTH 3 + +// IPCP option type +#define PPP_IPCP_OPTION_IP 3 +#define PPP_IPCP_OPTION_DNS1 129 +#define PPP_IPCP_OPTION_DNS2 131 +#define PPP_IPCP_OPTION_WINS1 130 +#define PPP_IPCP_OPTION_WINS2 132 + +// IPV6CP option type +#define PPP_IPV6CP_OPTION_EUI 1 + +// EAP codes +#define PPP_EAP_CODE_REQUEST 1 +#define PPP_EAP_CODE_RESPONSE 2 +#define PPP_EAP_CODE_SUCCESS 3 +#define PPP_EAP_CODE_FAILURE 4 + +// EAP types +#define PPP_EAP_TYPE_IDENTITY 1 +#define PPP_EAP_TYPE_NOTIFICATION 2 +#define PPP_EAP_TYPE_NAK 3 +#define PPP_EAP_TYPE_TLS 13 + +// EAP-TLS Flags +#define PPP_EAP_TLS_FLAG_NONE 0 +#define PPP_EAP_TLS_FLAG_TLS_LENGTH 1 << 7 +#define PPP_EAP_TLS_FLAG_FRAGMENTED 1 << 6 +#define PPP_EAP_TLS_FLAG_SSLSTARTED 1 << 5 + +// Authentication protocol +#define PPP_LCP_AUTH_PAP PPP_PROTOCOL_PAP +#define PPP_LCP_AUTH_CHAP PPP_PROTOCOL_CHAP +#define PPP_LCP_AUTH_EAP PPP_PROTOCOL_EAP + +// Algorithm of CHAP +#define PPP_CHAP_ALG_MS_CHAP_V2 0x81 + +// Link status +#define PPP_STATUS_CONNECTED 0x1 +#define PPP_STATUS_BEFORE_AUTH 0x10 +#define PPP_STATUS_AUTHENTICATING 0x11 +#define PPP_STATUS_AUTH_SUCCESS 0x19 +#define PPP_STATUS_NETWORK_LAYER 0x20 +#define PPP_STATUS_CLOSING 0x100 +#define PPP_STATUS_CLOSING_WAIT 0x101 +#define PPP_STATUS_CLOSED 0x110 +#define PPP_STATUS_FAIL 0x1000 +#define PPP_STATUS_AUTH_FAIL 0x1010 + +#define PPP_UNSPECIFIED 0xFFFF + +//// Type + +// IP options used in the PPP +struct PPP_IPOPTION +{ + IP IpAddress; // IP address + IP DnsServer1, DnsServer2; // DNS server address + IP WinsServer1, WinsServer2; // WINS server address +}; + +// PPP packet +struct PPP_PACKET +{ + USHORT Protocol; // Protocol + bool IsControl; // Whether or not the control packet + PPP_LCP *Lcp; // LCP packet data + UINT DataSize; // Data size + void *Data; // Data body +}; + +// PPP LCP packet +struct PPP_LCP +{ + UCHAR Code; // Code + UCHAR Id; // ID + UCHAR MagicNumber[4]; // Magic number + LIST *OptionList; // PPP options list + void *Data; // Data + UINT DataSize; // Data size +}; + +// PPP Options +struct PPP_OPTION +{ + UCHAR Type; // Type of option + UINT DataSize; // Data size + UCHAR Data[254]; // Data + bool IsSupported; // Flag of whether it is supported + bool IsAccepted; // Flag for whether accepted + UCHAR AltData[254]; // Alternate data when it isn't accepted + UINT AltDataSize; // Alternate data size +}; + +#ifdef OS_WIN32 +#pragma pack(push, 1) +#else // OS_WIN32 +#pragma pack(1) +#endif + + +// PPP EAP packet +// EAP is a subset of LCP, sharing Code and Id. The Data field is then mapped to this structure +// We got 8 bytes of size before this structure +struct PPP_EAP +{ + UCHAR Type; + union { + UCHAR Data[0]; + struct PPP_EAP_TLS + { + UCHAR Flags; + union { + UCHAR TlsDataWithoutLength[0]; + struct + { + UINT TlsLength; + UCHAR Data[0]; + } TlsDataWithLength; + }; + } Tls; + }; +} GCC_PACKED; + +#ifdef OS_WIN32 +#pragma pack(pop) +#else // OS_WIN32 +#pragma pack() +#endif + +struct PPP_EAP_TLS_CONTEXT +{ + SSL_PIPE *SslPipe; + DH_CTX *Dh; + struct SslClientCertInfo ClientCert; + UCHAR *CachedBufferRecv; + UCHAR *CachedBufferRecvPntr; + UCHAR *CachedBufferSend; + UCHAR *CachedBufferSendPntr; +}; + +// PPP request resend +struct PPP_REQUEST_RESEND +{ + PPP_PACKET *Packet; + UCHAR Id; + UINT64 ResendTime; + UINT64 TimeoutTime; +}; + +// PPP next packet struct +struct PPP_DELAYED_PACKET +{ + PPP_PACKET *Packet; + UINT DelayTicks; +}; + +// PPP session +struct PPP_SESSION +{ + CEDAR *Cedar; // Cedar + IP ClientIP; // Client IP address + UINT ClientPort; // Client port + IP ServerIP; // Server IP address + UINT ServerPort; // Server port + TUBE *TubeSend; // Sending tube + TUBE *TubeRecv; // Receiving tube + UCHAR NextId; // ID to be used next + UINT Mru1; // MRU (server -> client) + UINT Mru2; // MRU (client -> server) + LIST *RecvPacketList; // Received packet list + bool IsTerminateReceived; // Whether a Terminate has been received + UINT DisconnectCauseCode; // L2TP disconnect cause code + UINT DisconnectCauseDirection; // L2TP disconnect cause direction code + IPC *Ipc; // IPC + bool ClientLCPOptionDetermined; // LCP option from the client has been determined + char Postfix[MAX_SIZE]; // Postfix of the session name + char ClientHostname[MAX_SIZE]; // Client host name + char ClientSoftwareName[MAX_SIZE]; // Client software name + UINT64 NextEchoSendTime; // Time to send Echo Request next + UINT64 LastRecvTime; // Time which the data has been received last + DHCP_OPTION_LIST ClientAddressOption; // Client address option + bool DhcpIpAllocTried; // Whether the request for an IP address is already attempted by DHCP + bool DhcpIpInformTried; // Whether the acquirement for an IP information is already attempted by DHCP + bool DhcpAllocated; // IP address is assigned by DHCP + bool UseStaticIPAddress; // Use a static IP address that is specified by the client + UINT64 DhcpRenewInterval; // DHCP update interval + UINT64 DhcpNextRenewTime; // DHCP renewal time of the next + char CryptName[MAX_SIZE]; // Cipher algorithm name + UINT AdjustMss; // MSS value + TUBE_FLUSH_LIST *FlushList; // Tube Flush List + bool EnableMSCHAPv2; // Enable the MS-CHAP v2 + USHORT AuthProtocol; // Authentication protocol + bool AuthOk; // Flag for whether the authentication was successful + UCHAR MsChapV2_ServerChallenge[16]; // MS-CHAPv2 Server Challenge + UCHAR MsChapV2_ClientChallenge[16]; // MS-CHAPv2 Client Challenge + UCHAR MsChapV2_ClientResponse[24]; // MS-CHAPv2 Client Response + UCHAR MsChapV2_ServerResponse[20]; // MS-CHAPv2 Server Response + UINT MsChapV2_ErrorCode; // Authentication failure error code of MS-CHAPv2 + UINT MsChapV2_PacketId; // MS-CHAPv2 Packet ID + + bool MsChapV2_UseDoubleMsChapV2; // Use the double-MSCHAPv2 technique + EAP_CLIENT *EapClient; // EAP client + + UCHAR ServerInterfaceId[8]; // Server IPv6CP Interface Identifier + UCHAR ClientInterfaceId[8]; // Client IPv6CP Interface Identifier + + UINT PPPStatus; + + // EAP contexts + UINT Eap_Protocol; // Current EAP Protocol used + UINT Eap_PacketId; // EAP Packet ID; + UCHAR Eap_Identity[MAX_SIZE]; // Received from client identity + PPP_EAP_TLS_CONTEXT Eap_TlsCtx; // Context information for EAP TLS. May be possibly reused for EAP TTLS? + + LIST *SentReqPacketList; // Sent requests list + + PPP_PACKET *CurrentPacket; + LIST *DelayedPackets; + + UINT64 PacketRecvTimeout; + UINT64 DataTimeout; + UINT64 UserConnectionTimeout; + UINT64 UserConnectionTick; + + THREAD *SessionThread; // Thread of the PPP session +}; + + + +// Function prototype + +// Main dataloop +void PPPThread(THREAD *thread, void *param); + +// Entry point +PPP_SESSION *NewPPPSession(CEDAR *cedar, IP *client_ip, UINT client_port, IP *server_ip, UINT server_port, TUBE *send_tube, TUBE *recv_tube, char *postfix, char *client_software_name, char *client_hostname, char *crypt_name, UINT adjust_mss); + +// PPP processing functions +bool PPPRejectUnsupportedPacket(PPP_SESSION *p, PPP_PACKET *pp); +bool PPPRejectUnsupportedPacketEx(PPP_SESSION *p, PPP_PACKET *pp, bool force); +bool PPPProcessRetransmissions(PPP_SESSION *p); +bool PPPSendEchoRequest(PPP_SESSION *p); +// Response packets +bool PPPProcessResponsePacket(PPP_SESSION *p, PPP_PACKET *pp, PPP_PACKET *req); +bool PPPProcessLCPResponsePacket(PPP_SESSION *p, PPP_PACKET *pp, PPP_PACKET *req); +bool PPPProcessCHAPResponsePacket(PPP_SESSION *p, PPP_PACKET *pp, PPP_PACKET *req); +bool PPPProcessIPCPResponsePacket(PPP_SESSION *p, PPP_PACKET *pp, PPP_PACKET *req); +bool PPPProcessEAPResponsePacket(PPP_SESSION *p, PPP_PACKET *pp, PPP_PACKET *req); +bool PPPProcessIPv6CPResponsePacket(PPP_SESSION *p, PPP_PACKET *pp, PPP_PACKET *req); +// Request packets +bool PPPProcessRequestPacket(PPP_SESSION *p, PPP_PACKET *pp); +bool PPPProcessLCPRequestPacket(PPP_SESSION *p, PPP_PACKET *pp); +bool PPPProcessPAPRequestPacket(PPP_SESSION *p, PPP_PACKET *pp); +bool PPPProcessIPCPRequestPacket(PPP_SESSION *p, PPP_PACKET *pp); +bool PPPProcessEAPRequestPacket(PPP_SESSION *p, PPP_PACKET *pp); +bool PPPProcessIPv6CPRequestPacket(PPP_SESSION *p, PPP_PACKET *pp); + +// LCP option based packets utility +bool PPPRejectLCPOptions(PPP_SESSION *p, PPP_PACKET *pp); +bool PPPRejectLCPOptionsEx(PPP_SESSION *p, PPP_PACKET *pp, bool simulate); +bool PPPNackLCPOptions(PPP_SESSION *p, PPP_PACKET *pp); +bool PPPNackLCPOptionsEx(PPP_SESSION *p, PPP_PACKET *pp, bool simulate); +bool PPPAckLCPOptions(PPP_SESSION *p, PPP_PACKET *pp); +bool PPPAckLCPOptionsEx(PPP_SESSION *p, PPP_PACKET *pp, bool simulate); + +// PPP networking functions +// Send packets +bool PPPSendAndRetransmitRequest(PPP_SESSION *p, USHORT protocol, PPP_LCP *c); +bool PPPSendPacketAndFree(PPP_SESSION *p, PPP_PACKET *pp); +bool PPPSendPacketEx(PPP_SESSION *p, PPP_PACKET *pp, bool no_flush); +// Receive packets +PPP_PACKET *PPPRecvPacket(PPP_SESSION *p, bool async); +// Helpers for delaying packets +PPP_PACKET *PPPGetNextPacket(PPP_SESSION *p); +void PPPAddNextPacket(PPP_SESSION *p, PPP_PACKET *pp, UINT delay); +int PPPDelayedPacketsComparator(void *a, void *b); +char PPPRelatedPacketComparator(PPP_PACKET *a, PPP_PACKET *b); + +// PPP utility functions +// Packet structures creation utilities +PPP_LCP *NewPPPLCP(UCHAR code, UCHAR id); +PPP_OPTION *NewPPPOption(UCHAR type, void *data, UINT size); +// Packet parse utilities +PPP_PACKET *ParsePPPPacket(void *data, UINT size); +PPP_LCP *PPPParseLCP(USHORT protocol, void *data, UINT size); +bool PPPParseMSCHAP2ResponsePacket(PPP_SESSION *p, PPP_PACKET *req); +// Packet building utilities +BUF *BuildPPPPacketData(PPP_PACKET *pp); +BUF *BuildLCPData(PPP_LCP *c); +PPP_LCP *BuildMSCHAP2ChallengePacket(PPP_SESSION *p); +// IPCP packet utilities +bool PPPGetIPOptionFromLCP(PPP_IPOPTION *o, PPP_LCP *c); +bool PPPSetIPOptionToLCP(PPP_IPOPTION *o, PPP_LCP *c, bool only_modify); +bool PPPGetIPAddressValueFromLCP(PPP_LCP *c, UINT type, IP *ip); +bool PPPSetIPAddressValueToLCP(PPP_LCP *c, UINT type, IP *ip, bool only_modify); +// EAP packet utilities +bool PPPProcessEAPTlsResponse(PPP_SESSION *p, PPP_EAP *eap_packet, UINT eapTlsSize); +PPP_LCP *BuildEAPPacketEx(UCHAR code, UCHAR id, UCHAR type, UINT datasize); +PPP_LCP *BuildEAPTlsPacketEx(UCHAR code, UCHAR id, UCHAR type, UINT datasize, UCHAR flags); +PPP_LCP *BuildEAPTlsRequest(UCHAR id, UINT datasize, UCHAR flags); +// Other packet utilities +PPP_OPTION *PPPGetOptionValue(PPP_LCP *c, UCHAR type); +bool IsHubExistsWithLock(CEDAR *cedar, char *hubname); +void PPPSetStatus(PPP_SESSION *p, UINT status); + +// Memory freeing functions +void FreePPPSession(PPP_SESSION *p); +void FreePPPLCP(PPP_LCP *c); +void FreePPPOptionList(LIST *o); +void FreePPPPacket(PPP_PACKET *pp); +void FreePPPPacketEx(PPP_PACKET *pp, bool no_free_struct); +void PPPFreeEapClient(PPP_SESSION *p); + +// Utility functions used not only in PPP stack +bool PPPParseUsername(CEDAR *cedar, char *src, ETHERIP_ID *dst); +void GenerateNtPasswordHash(UCHAR *dst, char *password); +void GenerateNtPasswordHashHash(UCHAR *dst_hash, UCHAR *src_hash); +void MsChapV2Server_GenerateChallenge(UCHAR *dst); +void MsChapV2_GenerateChallenge8(UCHAR *dst, UCHAR *client_challenge, UCHAR *server_challenge, char *username); +void MsChapV2Client_GenerateResponse(UCHAR *dst, UCHAR *challenge8, UCHAR *nt_password_hash); +void MsChapV2Server_GenerateResponse(UCHAR *dst, UCHAR *nt_password_hash_hash, UCHAR *client_response, UCHAR *challenge8); +bool MsChapV2VerityPassword(IPC_MSCHAP_V2_AUTHINFO *d, char *password); +char *MsChapV2DoBruteForce(IPC_MSCHAP_V2_AUTHINFO *d, LIST *password_list); + +#endif // PROTO_PPP_H diff --git a/src/Cedar/Proto_SSTP.c b/src/Cedar/Proto_SSTP.c index 514ddeda..6e031a0b 100644 --- a/src/Cedar/Proto_SSTP.c +++ b/src/Cedar/Proto_SSTP.c @@ -1,1070 +1,1070 @@ -// SoftEther VPN Source Code - Developer Edition Master Branch -// Cedar Communication Module - - -// Proto_SSTP.c -// SSTP (Microsoft Secure Socket Tunneling Protocol) protocol stack - -#include "CedarPch.h" - -const PROTO_IMPL *SstpGetProtoImpl() -{ - static const PROTO_IMPL impl = - { - SstpName, - SstpOptions, - SstpInit, - SstpFree, - NULL, - SstpProcessData, - NULL - }; - - return &impl; -} - -const char *SstpName() -{ - return "SSTP"; -} - -const PROTO_OPTION *SstpOptions() -{ - static const PROTO_OPTION options[] = - { - { .Name = NULL, .Type = PROTO_OPTION_UNKNOWN } - }; - - return options; -} - -bool SstpInit(void **param, const LIST *options, CEDAR *cedar, INTERRUPT_MANAGER *im, SOCK_EVENT *se, const char *cipher, const char *hostname) -{ - if (param == NULL || options == NULL || cedar == NULL || im == NULL || se == NULL) - { - return false; - } - - Debug("SstpInit(): cipher: %s, hostname: %s\n", cipher, hostname); - - *param = NewSstpServer(cedar, im, se, cipher, hostname); - - return true; -} - -void SstpFree(void *param) -{ - FreeSstpServer(param); -} - -bool SstpProcessData(void *param, TCP_RAW_DATA *in, FIFO *out) -{ - FIFO *recv_fifo; - bool disconnected = false; - SSTP_SERVER *server = param; - - if (server == NULL || in == NULL || out == NULL) - { - return false; - } - - if (server->Status == SSTP_SERVER_STATUS_NOT_INITIALIZED) - { - HTTP_HEADER *header; - char *header_str, date_str[MAX_SIZE]; - - GetHttpDateStr(date_str, sizeof(date_str), SystemTime64()); - - header = NewHttpHeader("HTTP/1.1", "200", "OK"); - AddHttpValue(header, NewHttpValue("Content-Length", "18446744073709551615")); - AddHttpValue(header, NewHttpValue("Server", "Microsoft-HTTPAPI/2.0")); - AddHttpValue(header, NewHttpValue("Date", date_str)); - - header_str = HttpHeaderToStr(header); - - FreeHttpHeader(header); - - if (header_str == NULL) - { - return false; - } - - WriteFifo(out, header_str, StrLen(header_str)); - - Free(header_str); - - Copy(&server->ClientIp, &in->SrcIP, sizeof(server->ClientIp)); - server->ClientPort = in->SrcPort; - Copy(&server->ServerIp, &in->DstIP, sizeof(server->ServerIp)); - server->ServerPort = in->DstPort; - - server->Status = SSTP_SERVER_STATUS_REQUEST_PENGING; - - return true; - } - - recv_fifo = in->Data; - - while (recv_fifo->size >= 4) - { - UCHAR *first4; - bool ok = false; - UINT read_size = 0; - - // Read 4 bytes from the beginning of the received queue. - first4 = ((UCHAR *)recv_fifo->p) + recv_fifo->pos; - if (first4[0] == SSTP_VERSION_1) - { - const USHORT len = READ_USHORT(first4 + 2) & 0xFFF; - if (len >= 4) - { - ok = true; - - if (recv_fifo->size >= len) - { - UCHAR *data; - BLOCK *b; - - read_size = len; - data = Malloc(read_size); - - ReadFifo(recv_fifo, data, read_size); - - b = NewBlock(data, read_size, 0); - - InsertQueue(server->RecvQueue, b); - } - } - } - - if (read_size == 0) - { - break; - } - - if (ok == false) - { - // Bad packet received, trigger disconnection. - disconnected = true; - break; - } - } - - // Process the timer interrupt - SstpProcessInterrupt(server); - - if (server->Disconnected) - { - disconnected = true; - } - - while (true) - { - BLOCK *b = GetNext(server->SendQueue); - if (b == NULL) - { - break; - } - - // Discard the data block if the transmission queue's size is greater than ~2.5 MB. - if (b->PriorityQoS || (FifoSize(out) <= MAX_BUFFERING_PACKET_SIZE)) - { - WriteFifo(out, b->Buf, b->Size); - } - - FreeBlock(b); - } - - if (disconnected) - { - return false; - } - - return true; -} - -// Process the SSTP control packet reception -void SstpProcessControlPacket(SSTP_SERVER *s, SSTP_PACKET *p) -{ - // Validate arguments - if (s == NULL || p == NULL || p->IsControl == false) - { - return; - } - - Debug("SSTP Control Packet Recv: Msg = %u, Num = %u\n", p->MessageType, LIST_NUM(p->AttributeList)); - - switch (p->MessageType) - { - case SSTP_MSG_CALL_CONNECT_REQUEST: // Receive a connection request from a client - if (s->Aborting == false && s->Disconnecting == false) - { - if (s->Status == SSTP_SERVER_STATUS_REQUEST_PENGING) - { - SSTP_ATTRIBUTE *protocol_id = SstpFindAttribute(p, SSTP_ATTRIB_ENCAPSULATED_PROTOCOL_ID); - if (protocol_id != NULL && protocol_id->DataSize == 2 && - READ_USHORT(protocol_id->Data) == SSTP_ENCAPSULATED_PROTOCOL_PPP) - { - // Accept the connection request by the PPP protocol - SSTP_PACKET *ret; - - // Generation of random numbers - Rand(s->SentNonce, SSTP_NONCE_SIZE); - - ret = SstpNewControlPacketWithAnAttribute(SSTP_MSG_CALL_CONNECT_ACK, - SstpNewCryptoBindingRequestAttribute(CERT_HASH_PROTOCOL_SHA256, s->SentNonce)); - - SstpSendPacket(s, ret); - - SstpFreePacket(ret); - - s->Status = SSTP_SERVER_STATUS_CONNECTED_PENDING; - - s->EstablishedCount++; - } - else - { - // Refuse to accept for a connection request other than the PPP protocol - SSTP_PACKET *ret = SstpNewControlPacketWithAnAttribute(SSTP_MSG_CALL_CONNECT_NAK, - SstpNewStatusInfoAttribute(SSTP_ATTRIB_ENCAPSULATED_PROTOCOL_ID, ATTRIB_STATUS_VALUE_NOT_SUPPORTED)); - - SstpSendPacket(s, ret); - - SstpFreePacket(ret); - } - } - } - break; - - case SSTP_MSG_CALL_CONNECTED: // Connection from the client complete - if (s->Aborting == false && s->Disconnecting == false) - { - if (s->Status == SSTP_SERVER_STATUS_CONNECTED_PENDING) - { - s->Status = SSTP_SERVER_STATUS_ESTABLISHED; - - Debug("SSTP Connected.\n"); - } - } - break; - - case SSTP_MSG_CALL_DISCONNECT: // Receive a disconnect request from the client - case SSTP_MSG_CALL_DISCONNECT_ACK: - s->DisconnectRecved = true; - SstpDisconnect(s); - break; - - case SSTP_MSG_CALL_ABORT: // Receive a disconnect request from the client - s->AbortReceived = true; - SstpAbort(s); - break; - } -} - -// Process the SSTP received data packet -void SstpProcessDataPacket(SSTP_SERVER *s, SSTP_PACKET *p) -{ - PPP_SESSION *underlyingSession; - - // Validate arguments - if (s == NULL || p == NULL || p->IsControl) - { - return; - } - - //Debug("SSTP Data Packet Recv: Size = %u\n", p->DataSize); - - if (s->PPPThread == NULL) - { - // Create a thread to initialize the new PPP module - underlyingSession = NewPPPSession(s->Cedar, &s->ClientIp, s->ClientPort, &s->ServerIp, s->ServerPort, - s->TubeSend, s->TubeRecv, SSTP_IPC_POSTFIX, SSTP_IPC_CLIENT_NAME, - s->ClientHostName, s->ClientCipherName, 0); - s->PPPSession = underlyingSession; - s->PPPThread = underlyingSession->SessionThread; - } - - // Pass the received data to the PPP module - TubeSendEx(s->TubeRecv, p->Data, p->DataSize, NULL, true); - s->FlushRecvTube = true; -} - -// Process the SSTP received packet -void SstpProcessPacket(SSTP_SERVER *s, SSTP_PACKET *p) -{ - // Validate arguments - if (s == NULL || p == NULL) - { - return; - } - - s->LastRecvTick = s->Now; - - if (p->IsControl) - { - // Control packet - SstpProcessControlPacket(s, p); - } - else - { - // Data packet - SstpProcessDataPacket(s, p); - } -} - -// Send a SSTP packet -void SstpSendPacket(SSTP_SERVER *s, SSTP_PACKET *p) -{ - BUF *b; - BLOCK *block; - // Validate arguments - if (s == NULL || p == NULL) - { - return; - } - - if (p->IsControl) - { - Debug("SSTP Control Packet Send: Msg = %u, Num = %u\n", p->MessageType, LIST_NUM(p->AttributeList)); - } - else - { - //Debug("SSTP Data Packet Send: Size=%u\n", p->DataSize); - } - - b = SstpBuildPacket(p); - if (b == NULL) - { - return; - } - - block = NewBlock(b->Buf, b->Size, 0); - block->PriorityQoS = p->IsControl; - Free(b); - - InsertQueue(s->SendQueue, block); -} - -// Process the timer interrupt -void SstpProcessInterrupt(SSTP_SERVER *s) -{ - UINT64 sstpTimeout = SSTP_TIMEOUT; - // Validate arguments - if (s == NULL) - { - return; - } - - s->Now = Tick64(); - - s->FlushRecvTube = false; - - // Process the received packet - while (true) - { - BLOCK *b = GetNext(s->RecvQueue); - SSTP_PACKET *p; - - if (b == NULL) - { - break; - } - - p = SstpParsePacket(b->Buf, b->Size); - if (p == NULL) - { - // Disconnect the SSTP since a bad packet received - SstpAbort(s); - } - else - { - // Process the received packet - SstpProcessPacket(s, p); - - SstpFreePacket(p); - } - - FreeBlock(b); - } - - if (s->FlushRecvTube) - { - TubeFlush(s->TubeRecv); - } - - // Transmit a packet that the PPP module is trying to send via the SSTP - while (true) - { - TUBEDATA *d = TubeRecvAsync(s->TubeSend); - SSTP_PACKET *p; - if (d == NULL) - { - break; - } - - p = SstpNewDataPacket(d->Data, d->DataSize); - - SstpSendPacket(s, p); - - SstpFreePacket(p); - - FreeTubeData(d); - } - - if (s->Status == SSTP_SERVER_STATUS_ESTABLISHED) - { - if (s->Disconnecting == false && s->Aborting == false) - { - // Periodic transmission of Echo Request - if (s->NextSendEchoRequestTick == 0 || s->NextSendEchoRequestTick <= s->Now) - { - UINT64 next_interval = (UINT64)(SSTP_ECHO_SEND_INTERVAL_MIN + Rand32() % (SSTP_ECHO_SEND_INTERVAL_MAX - SSTP_ECHO_SEND_INTERVAL_MIN)); - SSTP_PACKET *p; - - s->NextSendEchoRequestTick = s->Now + next_interval; - AddInterrupt(s->Interrupt, s->NextSendEchoRequestTick); - - p = SstpNewControlPacket(SSTP_MSG_ECHO_REQUEST); - - SstpSendPacket(s, p); - - SstpFreePacket(p); - } - } - } - - if (s->PPPSession != NULL && s->PPPSession->DataTimeout > sstpTimeout) - { - sstpTimeout = s->PPPSession->DataTimeout; - } - - if ((s->LastRecvTick + sstpTimeout) <= s->Now) - { - // Disconnect the SSTP because a timeout occurred - SstpAbort(s); - s->Disconnected = true; - } - - if (IsTubeConnected(s->TubeRecv) == false || IsTubeConnected(s->TubeSend) == false) - { - // Disconnect the SSTP since the PPP module is disconnected - SstpDisconnect(s); - } - - if (s->Disconnecting) - { - // Normal disconnection process - if (s->DisconnectSent == false) - { - // Send a Disconnect - SSTP_PACKET *ret = SstpNewControlPacket(s->DisconnectRecved ? SSTP_MSG_CALL_DISCONNECT_ACK : SSTP_MSG_CALL_DISCONNECT); - - SstpSendPacket(s, ret); - - SstpFreePacket(ret); - - s->DisconnectSent = true; - } - } - - if (s->Aborting) - { - // Abnormal disconnection processing - if (s->AbortSent == false) - { - // Send the Abort - SSTP_PACKET *ret = SstpNewControlPacket(SSTP_MSG_CALL_ABORT); - - SstpSendPacket(s, ret); - - SstpFreePacket(ret); - - s->AbortSent = true; - } - } - - if (s->DisconnectSent && s->DisconnectRecved) - { - // Disconnect after exchanging the Disconnect each other - s->Disconnected = true; - } - - if (s->AbortSent && s->AbortReceived) - { - // Disconnect after exchanging the Abort each other - s->Disconnected = true; - } -} - -// Create a new SSTP control packet with an Attribute -SSTP_PACKET *SstpNewControlPacketWithAnAttribute(USHORT message_type, SSTP_ATTRIBUTE *a) -{ - SSTP_PACKET *p = SstpNewControlPacket(message_type); - - if (a != NULL) - { - Add(p->AttributeList, a); - } - - return p; -} - -// Create a new SSTP control packet -SSTP_PACKET *SstpNewControlPacket(USHORT message_type) -{ - SSTP_PACKET *p = ZeroMalloc(sizeof(SSTP_PACKET)); - - p->IsControl = true; - p->MessageType = message_type; - p->Version = SSTP_VERSION_1; - p->AttributeList = NewListFast(NULL); - - return p; -} - -// Create a new SSTP data packet -SSTP_PACKET *SstpNewDataPacket(UCHAR *data, UINT size) -{ - SSTP_PACKET *p = ZeroMalloc(sizeof(SSTP_PACKET)); - - p->IsControl = false; - p->Data = Clone(data, size); - p->DataSize = size; - - return p; -} - -// Get the Attribute with the specified ID from SSTP packet -SSTP_ATTRIBUTE *SstpFindAttribute(SSTP_PACKET *p, UCHAR attribute_id) -{ - UINT i; - // Validate arguments - if (p == NULL) - { - return NULL; - } - - for (i = 0;i < LIST_NUM(p->AttributeList);i++) - { - SSTP_ATTRIBUTE *a = LIST_DATA(p->AttributeList, i); - - if (a->AttributeId == attribute_id) - { - return a; - } - } - - return NULL; -} - -// Disconnect the SSTP normally -void SstpDisconnect(SSTP_SERVER *s) -{ - // Validate arguments - if (s == NULL) - { - return; - } - - s->Disconnecting = true; -} - -// Disconnect the SSTP abnormally -void SstpAbort(SSTP_SERVER *s) -{ - // Validate arguments - if (s == NULL) - { - return; - } - - s->Aborting = true; -} - -// Create a Crypto Binding Request Attribute -SSTP_ATTRIBUTE *SstpNewCryptoBindingRequestAttribute(UCHAR hash_protocol_bitmask, UCHAR *nonce_32bytes) -{ - SSTP_ATTRIBUTE *a; - UCHAR uc; - BUF *b = NewBuf(); - - uc = 0; - WriteBuf(b, &uc, 1); - WriteBuf(b, &uc, 1); - WriteBuf(b, &uc, 1); - WriteBuf(b, &hash_protocol_bitmask, 1); - - WriteBuf(b, nonce_32bytes, SSTP_NONCE_SIZE); - - a = SstpNewAttribute(SSTP_ATTRIB_CRYPTO_BINDING_REQ, b->Buf, b->Size); - - FreeBuf(b); - - return a; -} - -// Create a Status Info Attribute -SSTP_ATTRIBUTE *SstpNewStatusInfoAttribute(UCHAR attrib_id, UINT status) -{ - SSTP_ATTRIBUTE *a; - UCHAR uc; - BUF *b = NewBuf(); - - uc = 0; - WriteBuf(b, &uc, 1); - WriteBuf(b, &uc, 1); - WriteBuf(b, &uc, 1); - WriteBuf(b, &attrib_id, 1); - - WriteBufInt(b, status); - - a = SstpNewAttribute(SSTP_ATTRIB_STATUS_INFO, b->Buf, b->Size); - - FreeBuf(b); - - return a; -} - -// Create a New Attribute -SSTP_ATTRIBUTE *SstpNewAttribute(UCHAR attribute_id, UCHAR *data, UINT data_size) -{ - SSTP_ATTRIBUTE *a = ZeroMalloc(sizeof(SSTP_ATTRIBUTE)); - - a->AttributeId = attribute_id; - a->Data = Clone(data, data_size); - a->DataSize = data_size; - - return a; -} - -// Build the Attribute -BUF *SstpBuildAttribute(SSTP_ATTRIBUTE *a) -{ - UCHAR uc; - USHORT us; - BUF *b; - // Validate arguments - if (a == NULL) - { - return NULL; - } - - b = NewBuf(); - - // Reserved - uc = 0; - WriteBuf(b, &uc, sizeof(UCHAR)); - - // Attribute ID - uc = a->AttributeId; - WriteBuf(b, &uc, sizeof(UCHAR)); - - // LengthPacket - a->TotalLength = a->DataSize + 4; - us = (USHORT)a->TotalLength; - us = Endian16(us); - WriteBuf(b, &us, sizeof(USHORT)); - - // Data - WriteBuf(b, a->Data, a->DataSize); - - return b; -} - -// Build the Attribute list -BUF *SstpBuildAttributeList(LIST *o, USHORT message_type) -{ - UINT i; - BUF *b; - USHORT us; - // Validate arguments - if (o == NULL) - { - return NULL; - } - - b = NewBuf(); - - us = Endian16(message_type); - WriteBuf(b, &us, sizeof(USHORT)); - - us = Endian16((USHORT)LIST_NUM(o)); - WriteBuf(b, &us, sizeof(USHORT)); - - for (i = 0;i < LIST_NUM(o);i++) - { - SSTP_ATTRIBUTE *a = LIST_DATA(o, i); - BUF *ab = SstpBuildAttribute(a); - - if (ab != NULL) - { - WriteBufBuf(b, ab); - - FreeBuf(ab); - } - } - - return b; -} - -// Building the SSTP packet -BUF *SstpBuildPacket(SSTP_PACKET *p) -{ - BUF *b; - UCHAR uc; - USHORT us; - // Validate arguments - if (p == NULL) - { - return NULL; - } - - b = NewBuf(); - - if (p->IsControl) - { - BUF *ab; - - if (p->Data != NULL) - { - Free(p->Data); - } - - ab = SstpBuildAttributeList(p->AttributeList, p->MessageType); - p->Data = ab->Buf; - p->DataSize = ab->Size; - Free(ab); - } - - // Version - uc = SSTP_VERSION_1; - WriteBuf(b, &uc, sizeof(UCHAR)); - - // Flag - uc = p->IsControl ? 1 : 0; - WriteBuf(b, &uc, sizeof(UCHAR)); - - // Length Packet - us = Endian16(p->DataSize + 4); - WriteBuf(b, &us, sizeof(USHORT)); - - // Data - WriteBuf(b, p->Data, p->DataSize); - - return b; -} - -// Parse the SSTP packet -SSTP_PACKET *SstpParsePacket(UCHAR *data, UINT size) -{ - SSTP_PACKET *p; - USHORT len; - // Validate arguments - if (data == NULL || size == 0) - { - return NULL; - } - - if (size < 4) - { - return NULL; - } - - p = ZeroMalloc(sizeof(SSTP_PACKET)); - - // Version - p->Version = *((UCHAR *)data); - data++; - size--; - - if (p->Version != SSTP_VERSION_1) - { - // Invalid version - SstpFreePacket(p); - return NULL; - } - - // Flag - if ((*((UCHAR *)data)) & 0x01) - { - p->IsControl = true; - } - data++; - size--; - - // Length - len = READ_USHORT(data) & 0xFFF; - data += sizeof(USHORT); - size -= sizeof(USHORT); - - if (len < 4) - { - // Invalid size - SstpFreePacket(p); - return NULL; - } - - if (((UINT)(len - 4)) > size) - { - // Oversized - SstpFreePacket(p); - return NULL; - } - - // Data - p->DataSize = len - 4; - p->Data = Clone(data, p->DataSize); - - if (p->IsControl) - { - // Parse the Attribute list - p->AttributeList = SstpParseAttributeList(p->Data, p->DataSize, p); - - if (p->AttributeList == NULL) - { - // Failure of parsing list - SstpFreePacket(p); - return NULL; - } - } - - return p; -} - -// Parse the Attribute list -LIST *SstpParseAttributeList(UCHAR *data, UINT size, SSTP_PACKET *p) -{ - LIST *o; - USHORT us; - UINT num; - // Validate arguments - if (size == 0 || data == NULL || p == NULL) - { - return NULL; - } - - if (size < 4) - { - return NULL; - } - - // Message Type - us = READ_USHORT(data); - p->MessageType = us; - data += sizeof(USHORT); - size -= sizeof(USHORT); - - // Num Attributes - num = READ_USHORT(data); - data += sizeof(USHORT); - size -= sizeof(USHORT); - - // Attributes List - o = NewListFast(NULL); - - while (LIST_NUM(o) < num) - { - SSTP_ATTRIBUTE *a = SstpParseAttribute(data, size); - - if (a == NULL) - { - SstpFreeAttributeList(o); - return NULL; - } - - if (a->TotalLength > size) - { - SstpFreeAttribute(a); - SstpFreeAttributeList(o); - return NULL; - } - - Add(o, a); - - data += a->TotalLength; - size -= a->TotalLength; - } - - return o; -} - -// Parse the Attribute -SSTP_ATTRIBUTE *SstpParseAttribute(UCHAR *data, UINT size) -{ - SSTP_ATTRIBUTE *a; - // Validate arguments - if (data == NULL || size == 0) - { - return NULL; - } - - a = ZeroMalloc(sizeof(SSTP_ATTRIBUTE)); - - if (size < 4) - { - SstpFreeAttribute(a); - return NULL; - } - - data++; - size--; - - // Attribute ID - a->AttributeId = *((UCHAR *)data); - data++; - size--; - - // Length - a->TotalLength = READ_USHORT(data) & 0xFFF; - data += sizeof(USHORT); - size -= sizeof(USHORT); - - if (a->TotalLength < 4) - { - // Length fraud - SstpFreeAttribute(a); - return NULL; - } - - a->DataSize = a->TotalLength - 4; - if (a->DataSize > size) - { - // Length excess - SstpFreeAttribute(a); - return NULL; - } - - a->Data = Clone(data, a->DataSize); - - return a; -} - -// Release the Attribute -void SstpFreeAttribute(SSTP_ATTRIBUTE *a) -{ - // Validate arguments - if (a == NULL) - { - return; - } - - Free(a->Data); - - Free(a); -} - -// Release the Attribute list -void SstpFreeAttributeList(LIST *o) -{ - UINT i; - // Validate arguments - if (o == NULL) - { - return; - } - - for (i = 0;i < LIST_NUM(o);i++) - { - SSTP_ATTRIBUTE *a = LIST_DATA(o, i); - - SstpFreeAttribute(a); - } - - ReleaseList(o); -} - -// Release the SSTP packet -void SstpFreePacket(SSTP_PACKET *p) -{ - // Validate arguments - if (p == NULL) - { - return; - } - - if (p->AttributeList != NULL) - { - SstpFreeAttributeList(p->AttributeList); - } - - if (p->Data != NULL) - { - Free(p->Data); - } - - Free(p); -} - -// Create a SSTP server -SSTP_SERVER *NewSstpServer(CEDAR *cedar, INTERRUPT_MANAGER *im, SOCK_EVENT *se, const char *cipher, const char *hostname) -{ - SSTP_SERVER *s = ZeroMalloc(sizeof(SSTP_SERVER)); - - s->Status = SSTP_SERVER_STATUS_NOT_INITIALIZED; - - s->Now = Tick64(); - s->LastRecvTick = s->Now; - - s->Cedar = cedar; - s->Interrupt = im; - s->SockEvent = se; - - StrCpy(s->ClientHostName, sizeof(s->ClientHostName), hostname); - StrCpy(s->ClientCipherName, sizeof(s->ClientCipherName), cipher); - - NewTubePair(&s->TubeSend, &s->TubeRecv, 0); - SetTubeSockEvent(s->TubeSend, se); - - s->RecvQueue = NewQueueFast(); - s->SendQueue = NewQueueFast(); - - return s; -} - -// Release the SSTP server -void FreeSstpServer(SSTP_SERVER *s) -{ - // Validate arguments - if (s == NULL) - { - return; - } - - TubeDisconnect(s->TubeRecv); - TubeDisconnect(s->TubeSend); - - WaitThread(s->PPPThread, INFINITE); - ReleaseThread(s->PPPThread); - - while (true) - { - BLOCK *b = GetNext(s->RecvQueue); - - if (b == NULL) - { - break; - } - - FreeBlock(b); - } - - while (true) - { - BLOCK *b = GetNext(s->SendQueue); - - if (b == NULL) - { - break; - } - - FreeBlock(b); - } - - ReleaseQueue(s->RecvQueue); - ReleaseQueue(s->SendQueue); - - ReleaseTube(s->TubeSend); - ReleaseTube(s->TubeRecv); - - Free(s); -} +// SoftEther VPN Source Code - Developer Edition Master Branch +// Cedar Communication Module + + +// Proto_SSTP.c +// SSTP (Microsoft Secure Socket Tunneling Protocol) protocol stack + +#include "CedarPch.h" + +const PROTO_IMPL *SstpGetProtoImpl() +{ + static const PROTO_IMPL impl = + { + SstpName, + SstpOptions, + SstpInit, + SstpFree, + NULL, + SstpProcessData, + NULL + }; + + return &impl; +} + +const char *SstpName() +{ + return "SSTP"; +} + +const PROTO_OPTION *SstpOptions() +{ + static const PROTO_OPTION options[] = + { + { .Name = NULL, .Type = PROTO_OPTION_UNKNOWN } + }; + + return options; +} + +bool SstpInit(void **param, const LIST *options, CEDAR *cedar, INTERRUPT_MANAGER *im, SOCK_EVENT *se, const char *cipher, const char *hostname) +{ + if (param == NULL || options == NULL || cedar == NULL || im == NULL || se == NULL) + { + return false; + } + + Debug("SstpInit(): cipher: %s, hostname: %s\n", cipher, hostname); + + *param = NewSstpServer(cedar, im, se, cipher, hostname); + + return true; +} + +void SstpFree(void *param) +{ + FreeSstpServer(param); +} + +bool SstpProcessData(void *param, TCP_RAW_DATA *in, FIFO *out) +{ + FIFO *recv_fifo; + bool disconnected = false; + SSTP_SERVER *server = param; + + if (server == NULL || in == NULL || out == NULL) + { + return false; + } + + if (server->Status == SSTP_SERVER_STATUS_NOT_INITIALIZED) + { + HTTP_HEADER *header; + char *header_str, date_str[MAX_SIZE]; + + GetHttpDateStr(date_str, sizeof(date_str), SystemTime64()); + + header = NewHttpHeader("HTTP/1.1", "200", "OK"); + AddHttpValue(header, NewHttpValue("Content-Length", "18446744073709551615")); + AddHttpValue(header, NewHttpValue("Server", "Microsoft-HTTPAPI/2.0")); + AddHttpValue(header, NewHttpValue("Date", date_str)); + + header_str = HttpHeaderToStr(header); + + FreeHttpHeader(header); + + if (header_str == NULL) + { + return false; + } + + WriteFifo(out, header_str, StrLen(header_str)); + + Free(header_str); + + Copy(&server->ClientIp, &in->SrcIP, sizeof(server->ClientIp)); + server->ClientPort = in->SrcPort; + Copy(&server->ServerIp, &in->DstIP, sizeof(server->ServerIp)); + server->ServerPort = in->DstPort; + + server->Status = SSTP_SERVER_STATUS_REQUEST_PENGING; + + return true; + } + + recv_fifo = in->Data; + + while (recv_fifo->size >= 4) + { + UCHAR *first4; + bool ok = false; + UINT read_size = 0; + + // Read 4 bytes from the beginning of the received queue. + first4 = ((UCHAR *)recv_fifo->p) + recv_fifo->pos; + if (first4[0] == SSTP_VERSION_1) + { + const USHORT len = READ_USHORT(first4 + 2) & 0xFFF; + if (len >= 4) + { + ok = true; + + if (recv_fifo->size >= len) + { + UCHAR *data; + BLOCK *b; + + read_size = len; + data = Malloc(read_size); + + ReadFifo(recv_fifo, data, read_size); + + b = NewBlock(data, read_size, 0); + + InsertQueue(server->RecvQueue, b); + } + } + } + + if (read_size == 0) + { + break; + } + + if (ok == false) + { + // Bad packet received, trigger disconnection. + disconnected = true; + break; + } + } + + // Process the timer interrupt + SstpProcessInterrupt(server); + + if (server->Disconnected) + { + disconnected = true; + } + + while (true) + { + BLOCK *b = GetNext(server->SendQueue); + if (b == NULL) + { + break; + } + + // Discard the data block if the transmission queue's size is greater than ~2.5 MB. + if (b->PriorityQoS || (FifoSize(out) <= MAX_BUFFERING_PACKET_SIZE)) + { + WriteFifo(out, b->Buf, b->Size); + } + + FreeBlock(b); + } + + if (disconnected) + { + return false; + } + + return true; +} + +// Process the SSTP control packet reception +void SstpProcessControlPacket(SSTP_SERVER *s, SSTP_PACKET *p) +{ + // Validate arguments + if (s == NULL || p == NULL || p->IsControl == false) + { + return; + } + + Debug("SSTP Control Packet Recv: Msg = %u, Num = %u\n", p->MessageType, LIST_NUM(p->AttributeList)); + + switch (p->MessageType) + { + case SSTP_MSG_CALL_CONNECT_REQUEST: // Receive a connection request from a client + if (s->Aborting == false && s->Disconnecting == false) + { + if (s->Status == SSTP_SERVER_STATUS_REQUEST_PENGING) + { + SSTP_ATTRIBUTE *protocol_id = SstpFindAttribute(p, SSTP_ATTRIB_ENCAPSULATED_PROTOCOL_ID); + if (protocol_id != NULL && protocol_id->DataSize == 2 && + READ_USHORT(protocol_id->Data) == SSTP_ENCAPSULATED_PROTOCOL_PPP) + { + // Accept the connection request by the PPP protocol + SSTP_PACKET *ret; + + // Generation of random numbers + Rand(s->SentNonce, SSTP_NONCE_SIZE); + + ret = SstpNewControlPacketWithAnAttribute(SSTP_MSG_CALL_CONNECT_ACK, + SstpNewCryptoBindingRequestAttribute(CERT_HASH_PROTOCOL_SHA256, s->SentNonce)); + + SstpSendPacket(s, ret); + + SstpFreePacket(ret); + + s->Status = SSTP_SERVER_STATUS_CONNECTED_PENDING; + + s->EstablishedCount++; + } + else + { + // Refuse to accept for a connection request other than the PPP protocol + SSTP_PACKET *ret = SstpNewControlPacketWithAnAttribute(SSTP_MSG_CALL_CONNECT_NAK, + SstpNewStatusInfoAttribute(SSTP_ATTRIB_ENCAPSULATED_PROTOCOL_ID, ATTRIB_STATUS_VALUE_NOT_SUPPORTED)); + + SstpSendPacket(s, ret); + + SstpFreePacket(ret); + } + } + } + break; + + case SSTP_MSG_CALL_CONNECTED: // Connection from the client complete + if (s->Aborting == false && s->Disconnecting == false) + { + if (s->Status == SSTP_SERVER_STATUS_CONNECTED_PENDING) + { + s->Status = SSTP_SERVER_STATUS_ESTABLISHED; + + Debug("SSTP Connected.\n"); + } + } + break; + + case SSTP_MSG_CALL_DISCONNECT: // Receive a disconnect request from the client + case SSTP_MSG_CALL_DISCONNECT_ACK: + s->DisconnectRecved = true; + SstpDisconnect(s); + break; + + case SSTP_MSG_CALL_ABORT: // Receive a disconnect request from the client + s->AbortReceived = true; + SstpAbort(s); + break; + } +} + +// Process the SSTP received data packet +void SstpProcessDataPacket(SSTP_SERVER *s, SSTP_PACKET *p) +{ + PPP_SESSION *underlyingSession; + + // Validate arguments + if (s == NULL || p == NULL || p->IsControl) + { + return; + } + + //Debug("SSTP Data Packet Recv: Size = %u\n", p->DataSize); + + if (s->PPPThread == NULL) + { + // Create a thread to initialize the new PPP module + underlyingSession = NewPPPSession(s->Cedar, &s->ClientIp, s->ClientPort, &s->ServerIp, s->ServerPort, + s->TubeSend, s->TubeRecv, SSTP_IPC_POSTFIX, SSTP_IPC_CLIENT_NAME, + s->ClientHostName, s->ClientCipherName, 0); + s->PPPSession = underlyingSession; + s->PPPThread = underlyingSession->SessionThread; + } + + // Pass the received data to the PPP module + TubeSendEx(s->TubeRecv, p->Data, p->DataSize, NULL, true); + s->FlushRecvTube = true; +} + +// Process the SSTP received packet +void SstpProcessPacket(SSTP_SERVER *s, SSTP_PACKET *p) +{ + // Validate arguments + if (s == NULL || p == NULL) + { + return; + } + + s->LastRecvTick = s->Now; + + if (p->IsControl) + { + // Control packet + SstpProcessControlPacket(s, p); + } + else + { + // Data packet + SstpProcessDataPacket(s, p); + } +} + +// Send a SSTP packet +void SstpSendPacket(SSTP_SERVER *s, SSTP_PACKET *p) +{ + BUF *b; + BLOCK *block; + // Validate arguments + if (s == NULL || p == NULL) + { + return; + } + + if (p->IsControl) + { + Debug("SSTP Control Packet Send: Msg = %u, Num = %u\n", p->MessageType, LIST_NUM(p->AttributeList)); + } + else + { + //Debug("SSTP Data Packet Send: Size=%u\n", p->DataSize); + } + + b = SstpBuildPacket(p); + if (b == NULL) + { + return; + } + + block = NewBlock(b->Buf, b->Size, 0); + block->PriorityQoS = p->IsControl; + Free(b); + + InsertQueue(s->SendQueue, block); +} + +// Process the timer interrupt +void SstpProcessInterrupt(SSTP_SERVER *s) +{ + UINT64 sstpTimeout = SSTP_TIMEOUT; + // Validate arguments + if (s == NULL) + { + return; + } + + s->Now = Tick64(); + + s->FlushRecvTube = false; + + // Process the received packet + while (true) + { + BLOCK *b = GetNext(s->RecvQueue); + SSTP_PACKET *p; + + if (b == NULL) + { + break; + } + + p = SstpParsePacket(b->Buf, b->Size); + if (p == NULL) + { + // Disconnect the SSTP since a bad packet received + SstpAbort(s); + } + else + { + // Process the received packet + SstpProcessPacket(s, p); + + SstpFreePacket(p); + } + + FreeBlock(b); + } + + if (s->FlushRecvTube) + { + TubeFlush(s->TubeRecv); + } + + // Transmit a packet that the PPP module is trying to send via the SSTP + while (true) + { + TUBEDATA *d = TubeRecvAsync(s->TubeSend); + SSTP_PACKET *p; + if (d == NULL) + { + break; + } + + p = SstpNewDataPacket(d->Data, d->DataSize); + + SstpSendPacket(s, p); + + SstpFreePacket(p); + + FreeTubeData(d); + } + + if (s->Status == SSTP_SERVER_STATUS_ESTABLISHED) + { + if (s->Disconnecting == false && s->Aborting == false) + { + // Periodic transmission of Echo Request + if (s->NextSendEchoRequestTick == 0 || s->NextSendEchoRequestTick <= s->Now) + { + UINT64 next_interval = (UINT64)(SSTP_ECHO_SEND_INTERVAL_MIN + Rand32() % (SSTP_ECHO_SEND_INTERVAL_MAX - SSTP_ECHO_SEND_INTERVAL_MIN)); + SSTP_PACKET *p; + + s->NextSendEchoRequestTick = s->Now + next_interval; + AddInterrupt(s->Interrupt, s->NextSendEchoRequestTick); + + p = SstpNewControlPacket(SSTP_MSG_ECHO_REQUEST); + + SstpSendPacket(s, p); + + SstpFreePacket(p); + } + } + } + + if (s->PPPSession != NULL && s->PPPSession->DataTimeout > sstpTimeout) + { + sstpTimeout = s->PPPSession->DataTimeout; + } + + if ((s->LastRecvTick + sstpTimeout) <= s->Now) + { + // Disconnect the SSTP because a timeout occurred + SstpAbort(s); + s->Disconnected = true; + } + + if (IsTubeConnected(s->TubeRecv) == false || IsTubeConnected(s->TubeSend) == false) + { + // Disconnect the SSTP since the PPP module is disconnected + SstpDisconnect(s); + } + + if (s->Disconnecting) + { + // Normal disconnection process + if (s->DisconnectSent == false) + { + // Send a Disconnect + SSTP_PACKET *ret = SstpNewControlPacket(s->DisconnectRecved ? SSTP_MSG_CALL_DISCONNECT_ACK : SSTP_MSG_CALL_DISCONNECT); + + SstpSendPacket(s, ret); + + SstpFreePacket(ret); + + s->DisconnectSent = true; + } + } + + if (s->Aborting) + { + // Abnormal disconnection processing + if (s->AbortSent == false) + { + // Send the Abort + SSTP_PACKET *ret = SstpNewControlPacket(SSTP_MSG_CALL_ABORT); + + SstpSendPacket(s, ret); + + SstpFreePacket(ret); + + s->AbortSent = true; + } + } + + if (s->DisconnectSent && s->DisconnectRecved) + { + // Disconnect after exchanging the Disconnect each other + s->Disconnected = true; + } + + if (s->AbortSent && s->AbortReceived) + { + // Disconnect after exchanging the Abort each other + s->Disconnected = true; + } +} + +// Create a new SSTP control packet with an Attribute +SSTP_PACKET *SstpNewControlPacketWithAnAttribute(USHORT message_type, SSTP_ATTRIBUTE *a) +{ + SSTP_PACKET *p = SstpNewControlPacket(message_type); + + if (a != NULL) + { + Add(p->AttributeList, a); + } + + return p; +} + +// Create a new SSTP control packet +SSTP_PACKET *SstpNewControlPacket(USHORT message_type) +{ + SSTP_PACKET *p = ZeroMalloc(sizeof(SSTP_PACKET)); + + p->IsControl = true; + p->MessageType = message_type; + p->Version = SSTP_VERSION_1; + p->AttributeList = NewListFast(NULL); + + return p; +} + +// Create a new SSTP data packet +SSTP_PACKET *SstpNewDataPacket(UCHAR *data, UINT size) +{ + SSTP_PACKET *p = ZeroMalloc(sizeof(SSTP_PACKET)); + + p->IsControl = false; + p->Data = Clone(data, size); + p->DataSize = size; + + return p; +} + +// Get the Attribute with the specified ID from SSTP packet +SSTP_ATTRIBUTE *SstpFindAttribute(SSTP_PACKET *p, UCHAR attribute_id) +{ + UINT i; + // Validate arguments + if (p == NULL) + { + return NULL; + } + + for (i = 0;i < LIST_NUM(p->AttributeList);i++) + { + SSTP_ATTRIBUTE *a = LIST_DATA(p->AttributeList, i); + + if (a->AttributeId == attribute_id) + { + return a; + } + } + + return NULL; +} + +// Disconnect the SSTP normally +void SstpDisconnect(SSTP_SERVER *s) +{ + // Validate arguments + if (s == NULL) + { + return; + } + + s->Disconnecting = true; +} + +// Disconnect the SSTP abnormally +void SstpAbort(SSTP_SERVER *s) +{ + // Validate arguments + if (s == NULL) + { + return; + } + + s->Aborting = true; +} + +// Create a Crypto Binding Request Attribute +SSTP_ATTRIBUTE *SstpNewCryptoBindingRequestAttribute(UCHAR hash_protocol_bitmask, UCHAR *nonce_32bytes) +{ + SSTP_ATTRIBUTE *a; + UCHAR uc; + BUF *b = NewBuf(); + + uc = 0; + WriteBuf(b, &uc, 1); + WriteBuf(b, &uc, 1); + WriteBuf(b, &uc, 1); + WriteBuf(b, &hash_protocol_bitmask, 1); + + WriteBuf(b, nonce_32bytes, SSTP_NONCE_SIZE); + + a = SstpNewAttribute(SSTP_ATTRIB_CRYPTO_BINDING_REQ, b->Buf, b->Size); + + FreeBuf(b); + + return a; +} + +// Create a Status Info Attribute +SSTP_ATTRIBUTE *SstpNewStatusInfoAttribute(UCHAR attrib_id, UINT status) +{ + SSTP_ATTRIBUTE *a; + UCHAR uc; + BUF *b = NewBuf(); + + uc = 0; + WriteBuf(b, &uc, 1); + WriteBuf(b, &uc, 1); + WriteBuf(b, &uc, 1); + WriteBuf(b, &attrib_id, 1); + + WriteBufInt(b, status); + + a = SstpNewAttribute(SSTP_ATTRIB_STATUS_INFO, b->Buf, b->Size); + + FreeBuf(b); + + return a; +} + +// Create a New Attribute +SSTP_ATTRIBUTE *SstpNewAttribute(UCHAR attribute_id, UCHAR *data, UINT data_size) +{ + SSTP_ATTRIBUTE *a = ZeroMalloc(sizeof(SSTP_ATTRIBUTE)); + + a->AttributeId = attribute_id; + a->Data = Clone(data, data_size); + a->DataSize = data_size; + + return a; +} + +// Build the Attribute +BUF *SstpBuildAttribute(SSTP_ATTRIBUTE *a) +{ + UCHAR uc; + USHORT us; + BUF *b; + // Validate arguments + if (a == NULL) + { + return NULL; + } + + b = NewBuf(); + + // Reserved + uc = 0; + WriteBuf(b, &uc, sizeof(UCHAR)); + + // Attribute ID + uc = a->AttributeId; + WriteBuf(b, &uc, sizeof(UCHAR)); + + // LengthPacket + a->TotalLength = a->DataSize + 4; + us = (USHORT)a->TotalLength; + us = Endian16(us); + WriteBuf(b, &us, sizeof(USHORT)); + + // Data + WriteBuf(b, a->Data, a->DataSize); + + return b; +} + +// Build the Attribute list +BUF *SstpBuildAttributeList(LIST *o, USHORT message_type) +{ + UINT i; + BUF *b; + USHORT us; + // Validate arguments + if (o == NULL) + { + return NULL; + } + + b = NewBuf(); + + us = Endian16(message_type); + WriteBuf(b, &us, sizeof(USHORT)); + + us = Endian16((USHORT)LIST_NUM(o)); + WriteBuf(b, &us, sizeof(USHORT)); + + for (i = 0;i < LIST_NUM(o);i++) + { + SSTP_ATTRIBUTE *a = LIST_DATA(o, i); + BUF *ab = SstpBuildAttribute(a); + + if (ab != NULL) + { + WriteBufBuf(b, ab); + + FreeBuf(ab); + } + } + + return b; +} + +// Building the SSTP packet +BUF *SstpBuildPacket(SSTP_PACKET *p) +{ + BUF *b; + UCHAR uc; + USHORT us; + // Validate arguments + if (p == NULL) + { + return NULL; + } + + b = NewBuf(); + + if (p->IsControl) + { + BUF *ab; + + if (p->Data != NULL) + { + Free(p->Data); + } + + ab = SstpBuildAttributeList(p->AttributeList, p->MessageType); + p->Data = ab->Buf; + p->DataSize = ab->Size; + Free(ab); + } + + // Version + uc = SSTP_VERSION_1; + WriteBuf(b, &uc, sizeof(UCHAR)); + + // Flag + uc = p->IsControl ? 1 : 0; + WriteBuf(b, &uc, sizeof(UCHAR)); + + // Length Packet + us = Endian16(p->DataSize + 4); + WriteBuf(b, &us, sizeof(USHORT)); + + // Data + WriteBuf(b, p->Data, p->DataSize); + + return b; +} + +// Parse the SSTP packet +SSTP_PACKET *SstpParsePacket(UCHAR *data, UINT size) +{ + SSTP_PACKET *p; + USHORT len; + // Validate arguments + if (data == NULL || size == 0) + { + return NULL; + } + + if (size < 4) + { + return NULL; + } + + p = ZeroMalloc(sizeof(SSTP_PACKET)); + + // Version + p->Version = *((UCHAR *)data); + data++; + size--; + + if (p->Version != SSTP_VERSION_1) + { + // Invalid version + SstpFreePacket(p); + return NULL; + } + + // Flag + if ((*((UCHAR *)data)) & 0x01) + { + p->IsControl = true; + } + data++; + size--; + + // Length + len = READ_USHORT(data) & 0xFFF; + data += sizeof(USHORT); + size -= sizeof(USHORT); + + if (len < 4) + { + // Invalid size + SstpFreePacket(p); + return NULL; + } + + if (((UINT)(len - 4)) > size) + { + // Oversized + SstpFreePacket(p); + return NULL; + } + + // Data + p->DataSize = len - 4; + p->Data = Clone(data, p->DataSize); + + if (p->IsControl) + { + // Parse the Attribute list + p->AttributeList = SstpParseAttributeList(p->Data, p->DataSize, p); + + if (p->AttributeList == NULL) + { + // Failure of parsing list + SstpFreePacket(p); + return NULL; + } + } + + return p; +} + +// Parse the Attribute list +LIST *SstpParseAttributeList(UCHAR *data, UINT size, SSTP_PACKET *p) +{ + LIST *o; + USHORT us; + UINT num; + // Validate arguments + if (size == 0 || data == NULL || p == NULL) + { + return NULL; + } + + if (size < 4) + { + return NULL; + } + + // Message Type + us = READ_USHORT(data); + p->MessageType = us; + data += sizeof(USHORT); + size -= sizeof(USHORT); + + // Num Attributes + num = READ_USHORT(data); + data += sizeof(USHORT); + size -= sizeof(USHORT); + + // Attributes List + o = NewListFast(NULL); + + while (LIST_NUM(o) < num) + { + SSTP_ATTRIBUTE *a = SstpParseAttribute(data, size); + + if (a == NULL) + { + SstpFreeAttributeList(o); + return NULL; + } + + if (a->TotalLength > size) + { + SstpFreeAttribute(a); + SstpFreeAttributeList(o); + return NULL; + } + + Add(o, a); + + data += a->TotalLength; + size -= a->TotalLength; + } + + return o; +} + +// Parse the Attribute +SSTP_ATTRIBUTE *SstpParseAttribute(UCHAR *data, UINT size) +{ + SSTP_ATTRIBUTE *a; + // Validate arguments + if (data == NULL || size == 0) + { + return NULL; + } + + a = ZeroMalloc(sizeof(SSTP_ATTRIBUTE)); + + if (size < 4) + { + SstpFreeAttribute(a); + return NULL; + } + + data++; + size--; + + // Attribute ID + a->AttributeId = *((UCHAR *)data); + data++; + size--; + + // Length + a->TotalLength = READ_USHORT(data) & 0xFFF; + data += sizeof(USHORT); + size -= sizeof(USHORT); + + if (a->TotalLength < 4) + { + // Length fraud + SstpFreeAttribute(a); + return NULL; + } + + a->DataSize = a->TotalLength - 4; + if (a->DataSize > size) + { + // Length excess + SstpFreeAttribute(a); + return NULL; + } + + a->Data = Clone(data, a->DataSize); + + return a; +} + +// Release the Attribute +void SstpFreeAttribute(SSTP_ATTRIBUTE *a) +{ + // Validate arguments + if (a == NULL) + { + return; + } + + Free(a->Data); + + Free(a); +} + +// Release the Attribute list +void SstpFreeAttributeList(LIST *o) +{ + UINT i; + // Validate arguments + if (o == NULL) + { + return; + } + + for (i = 0;i < LIST_NUM(o);i++) + { + SSTP_ATTRIBUTE *a = LIST_DATA(o, i); + + SstpFreeAttribute(a); + } + + ReleaseList(o); +} + +// Release the SSTP packet +void SstpFreePacket(SSTP_PACKET *p) +{ + // Validate arguments + if (p == NULL) + { + return; + } + + if (p->AttributeList != NULL) + { + SstpFreeAttributeList(p->AttributeList); + } + + if (p->Data != NULL) + { + Free(p->Data); + } + + Free(p); +} + +// Create a SSTP server +SSTP_SERVER *NewSstpServer(CEDAR *cedar, INTERRUPT_MANAGER *im, SOCK_EVENT *se, const char *cipher, const char *hostname) +{ + SSTP_SERVER *s = ZeroMalloc(sizeof(SSTP_SERVER)); + + s->Status = SSTP_SERVER_STATUS_NOT_INITIALIZED; + + s->Now = Tick64(); + s->LastRecvTick = s->Now; + + s->Cedar = cedar; + s->Interrupt = im; + s->SockEvent = se; + + StrCpy(s->ClientHostName, sizeof(s->ClientHostName), hostname); + StrCpy(s->ClientCipherName, sizeof(s->ClientCipherName), cipher); + + NewTubePair(&s->TubeSend, &s->TubeRecv, 0); + SetTubeSockEvent(s->TubeSend, se); + + s->RecvQueue = NewQueueFast(); + s->SendQueue = NewQueueFast(); + + return s; +} + +// Release the SSTP server +void FreeSstpServer(SSTP_SERVER *s) +{ + // Validate arguments + if (s == NULL) + { + return; + } + + TubeDisconnect(s->TubeRecv); + TubeDisconnect(s->TubeSend); + + WaitThread(s->PPPThread, INFINITE); + ReleaseThread(s->PPPThread); + + while (true) + { + BLOCK *b = GetNext(s->RecvQueue); + + if (b == NULL) + { + break; + } + + FreeBlock(b); + } + + while (true) + { + BLOCK *b = GetNext(s->SendQueue); + + if (b == NULL) + { + break; + } + + FreeBlock(b); + } + + ReleaseQueue(s->RecvQueue); + ReleaseQueue(s->SendQueue); + + ReleaseTube(s->TubeSend); + ReleaseTube(s->TubeRecv); + + Free(s); +} diff --git a/src/Cedar/Proto_SSTP.h b/src/Cedar/Proto_SSTP.h index adb0347a..e68213d1 100644 --- a/src/Cedar/Proto_SSTP.h +++ b/src/Cedar/Proto_SSTP.h @@ -1,158 +1,158 @@ -// SoftEther VPN Source Code - Developer Edition Master Branch -// Cedar Communication Module - - -// Proto_SSTP.h -// Header of Proto_SSTP.c - -#ifndef PROTO_SSTP_H -#define PROTO_SSTP_H - -//// Constants -#define SSTP_URI "/sra_{BA195980-CD49-458b-9E23-C84EE0ADCD75}/" // SSTP HTTPS URI -#define SSTP_VERSION_1 0x10 // SSTP Version 1.0 -#define MAX_SSTP_PACKET_SIZE 4096 // Maximum packet size -#define SSTP_IPC_CLIENT_NAME "Microsoft SSTP VPN Client" -#define SSTP_IPC_POSTFIX "SSTP" -#define SSTP_ECHO_SEND_INTERVAL_MIN 2500 // Transmission interval of Echo Request (minimum) -#define SSTP_ECHO_SEND_INTERVAL_MAX 4792 // Transmission interval of Echo Request (maximum) -#define SSTP_TIMEOUT 20 * 1000 // Communication time-out of SSTP (from default policy) - -// SSTP Message Type -#define SSTP_MSG_CALL_CONNECT_REQUEST 0x0001 -#define SSTP_MSG_CALL_CONNECT_ACK 0x0002 -#define SSTP_MSG_CALL_CONNECT_NAK 0x0003 -#define SSTP_MSG_CALL_CONNECTED 0x0004 -#define SSTP_MSG_CALL_ABORT 0x0005 -#define SSTP_MSG_CALL_DISCONNECT 0x0006 -#define SSTP_MSG_CALL_DISCONNECT_ACK 0x0007 -#define SSTP_MSG_ECHO_REQUEST 0x0008 -#define SSTP_MSG_ECHO_RESPONSE 0x0009 - -// SSTP Attribute ID -#define SSTP_ATTRIB_NO_ERROR 0x00 -#define SSTP_ATTRIB_ENCAPSULATED_PROTOCOL_ID 0x01 -#define SSTP_ATTRIB_STATUS_INFO 0x02 -#define SSTP_ATTRIB_CRYPTO_BINDING 0x03 -#define SSTP_ATTRIB_CRYPTO_BINDING_REQ 0x04 - -// Protocol ID -#define SSTP_ENCAPSULATED_PROTOCOL_PPP 0x0001 - -// Hash Protocol Bitmask -#define CERT_HASH_PROTOCOL_SHA1 0x01 -#define CERT_HASH_PROTOCOL_SHA256 0x02 - -// Status -#define ATTRIB_STATUS_NO_ERROR 0x00000000 -#define ATTRIB_STATUS_DUPLICATE_ATTRIBUTE 0x00000001 -#define ATTRIB_STATUS_UNRECOGNIZED_ATTRIBUTE 0x00000002 -#define ATTRIB_STATUS_INVALID_ATTRIB_VALUE_LENGTH 0x00000003 -#define ATTRIB_STATUS_VALUE_NOT_SUPPORTED 0x00000004 -#define ATTRIB_STATUS_UNACCEPTED_FRAME_RECEIVED 0x00000005 -#define ATTRIB_STATUS_RETRY_COUNT_EXCEEDED 0x00000006 -#define ATTRIB_STATUS_INVALID_FRAME_RECEIVED 0x00000007 -#define ATTRIB_STATUS_NEGOTIATION_TIMEOUT 0x00000008 -#define ATTRIB_STATUS_ATTRIB_NOT_SUPPORTED_IN_MSG 0x00000009 -#define ATTRIB_STATUS_REQUIRED_ATTRIBUTE_MISSING 0x0000000A -#define ATTRIB_STATUS_STATUS_INFO_NOT_SUPPORTED_IN_MSG 0x0000000B - -// State of SSTP Server -#define SSTP_SERVER_STATUS_REQUEST_PENGING 0 // Connection incomplete -#define SSTP_SERVER_STATUS_CONNECTED_PENDING 1 // Connection completed. Authentication incomplete -#define SSTP_SERVER_STATUS_ESTABLISHED 2 // Connection completed. Communication available -#define SSTP_SERVER_STATUS_NOT_INITIALIZED INFINITE // Connection not accepted yet. - -// Length of Nonce -#define SSTP_NONCE_SIZE 32 // 256 bits - - -//// Type - -// SSTP Attribute -struct SSTP_ATTRIBUTE -{ - UCHAR AttributeId; - UCHAR *Data; - UINT DataSize; - UINT TotalLength; -}; - -// SSTP Packet -struct SSTP_PACKET -{ - UCHAR Version; - bool IsControl; - UCHAR *Data; - UINT DataSize; - USHORT MessageType; - LIST *AttributeList; -}; - -// SSTP Server -struct SSTP_SERVER -{ - CEDAR *Cedar; - UINT64 Now; - IP ClientIp, ServerIp; - UINT ClientPort, ServerPort; - char ClientHostName[MAX_HOST_NAME_LEN + 1]; - char ClientCipherName[MAX_SIZE]; - SOCK_EVENT *SockEvent; - QUEUE *RecvQueue; // Receive queue - QUEUE *SendQueue; // Transmission queue - INTERRUPT_MANAGER *Interrupt; // Interrupt manager - bool Aborting; // Forced disconnection flag - bool AbortSent; // Flag of whether to send the Abort - bool AbortReceived; // Flag of whether the Abort has been received - bool Disconnecting; // Disconnecting flag - bool DisconnectSent; // Flag of whether to send a Disconnect - bool DisconnectRecved; // Flag of whether a Disconnect has been received - bool Disconnected; // Flag as to disconnect - UINT Status; // State - UCHAR SentNonce[SSTP_NONCE_SIZE]; // Random data sent - TUBE *TubeRecv, *TubeSend; // Delivery tube of packets to PPP module - THREAD *PPPThread; // PPP module thread - UINT64 NextSendEchoRequestTick; // Time to send the next Echo Request - UINT64 LastRecvTick; // Tick when some data has received at the end - bool FlushRecvTube; // Flag whether to flush the reception tube - UINT EstablishedCount; // Number of session establishment - PPP_SESSION *PPPSession; // Underlying PPP Session -}; - - -//// Function prototype -const PROTO_IMPL *SstpGetProtoImpl(); -const PROTO_OPTION *SstpOptions(); -const char *SstpName(); -bool SstpInit(void **param, const LIST *options, CEDAR *cedar, INTERRUPT_MANAGER *im, SOCK_EVENT *se, const char *cipher, const char *hostname); -void SstpFree(void *param); -bool SstpProcessData(void *param, TCP_RAW_DATA *in, FIFO *out); - -SSTP_SERVER *NewSstpServer(CEDAR *cedar, INTERRUPT_MANAGER *im, SOCK_EVENT *se, const char *cipher, const char *hostname); -void FreeSstpServer(SSTP_SERVER *s); -void SstpProcessInterrupt(SSTP_SERVER *s); -SSTP_PACKET *SstpParsePacket(UCHAR *data, UINT size); -LIST *SstpParseAttributeList(UCHAR *data, UINT size, SSTP_PACKET *p); -SSTP_ATTRIBUTE *SstpParseAttribute(UCHAR *data, UINT size); -void SstpFreeAttribute(SSTP_ATTRIBUTE *a); -void SstpFreeAttributeList(LIST *o); -void SstpFreePacket(SSTP_PACKET *p); -BUF *SstpBuildPacket(SSTP_PACKET *p); -BUF *SstpBuildAttributeList(LIST *o, USHORT message_type); -BUF *SstpBuildAttribute(SSTP_ATTRIBUTE *a); -void SstpAbort(SSTP_SERVER *s); -void SstpDisconnect(SSTP_SERVER *s); -void SstpProcessPacket(SSTP_SERVER *s, SSTP_PACKET *p); -void SstpProcessControlPacket(SSTP_SERVER *s, SSTP_PACKET *p); -void SstpProcessDataPacket(SSTP_SERVER *s, SSTP_PACKET *p); -SSTP_ATTRIBUTE *SstpFindAttribute(SSTP_PACKET *p, UCHAR attribute_id); -SSTP_ATTRIBUTE *SstpNewAttribute(UCHAR attribute_id, UCHAR *data, UINT data_size); -SSTP_ATTRIBUTE *SstpNewStatusInfoAttribute(UCHAR attrib_id, UINT status); -SSTP_ATTRIBUTE *SstpNewCryptoBindingRequestAttribute(UCHAR hash_protocol_bitmask, UCHAR *nonce_32bytes); -SSTP_PACKET *SstpNewDataPacket(UCHAR *data, UINT size); -SSTP_PACKET *SstpNewControlPacket(USHORT message_type); -SSTP_PACKET *SstpNewControlPacketWithAnAttribute(USHORT message_type, SSTP_ATTRIBUTE *a); -void SstpSendPacket(SSTP_SERVER *s, SSTP_PACKET *p); - -#endif // PROTO_SSTP_H +// SoftEther VPN Source Code - Developer Edition Master Branch +// Cedar Communication Module + + +// Proto_SSTP.h +// Header of Proto_SSTP.c + +#ifndef PROTO_SSTP_H +#define PROTO_SSTP_H + +//// Constants +#define SSTP_URI "/sra_{BA195980-CD49-458b-9E23-C84EE0ADCD75}/" // SSTP HTTPS URI +#define SSTP_VERSION_1 0x10 // SSTP Version 1.0 +#define MAX_SSTP_PACKET_SIZE 4096 // Maximum packet size +#define SSTP_IPC_CLIENT_NAME "Microsoft SSTP VPN Client" +#define SSTP_IPC_POSTFIX "SSTP" +#define SSTP_ECHO_SEND_INTERVAL_MIN 2500 // Transmission interval of Echo Request (minimum) +#define SSTP_ECHO_SEND_INTERVAL_MAX 4792 // Transmission interval of Echo Request (maximum) +#define SSTP_TIMEOUT 20 * 1000 // Communication time-out of SSTP (from default policy) + +// SSTP Message Type +#define SSTP_MSG_CALL_CONNECT_REQUEST 0x0001 +#define SSTP_MSG_CALL_CONNECT_ACK 0x0002 +#define SSTP_MSG_CALL_CONNECT_NAK 0x0003 +#define SSTP_MSG_CALL_CONNECTED 0x0004 +#define SSTP_MSG_CALL_ABORT 0x0005 +#define SSTP_MSG_CALL_DISCONNECT 0x0006 +#define SSTP_MSG_CALL_DISCONNECT_ACK 0x0007 +#define SSTP_MSG_ECHO_REQUEST 0x0008 +#define SSTP_MSG_ECHO_RESPONSE 0x0009 + +// SSTP Attribute ID +#define SSTP_ATTRIB_NO_ERROR 0x00 +#define SSTP_ATTRIB_ENCAPSULATED_PROTOCOL_ID 0x01 +#define SSTP_ATTRIB_STATUS_INFO 0x02 +#define SSTP_ATTRIB_CRYPTO_BINDING 0x03 +#define SSTP_ATTRIB_CRYPTO_BINDING_REQ 0x04 + +// Protocol ID +#define SSTP_ENCAPSULATED_PROTOCOL_PPP 0x0001 + +// Hash Protocol Bitmask +#define CERT_HASH_PROTOCOL_SHA1 0x01 +#define CERT_HASH_PROTOCOL_SHA256 0x02 + +// Status +#define ATTRIB_STATUS_NO_ERROR 0x00000000 +#define ATTRIB_STATUS_DUPLICATE_ATTRIBUTE 0x00000001 +#define ATTRIB_STATUS_UNRECOGNIZED_ATTRIBUTE 0x00000002 +#define ATTRIB_STATUS_INVALID_ATTRIB_VALUE_LENGTH 0x00000003 +#define ATTRIB_STATUS_VALUE_NOT_SUPPORTED 0x00000004 +#define ATTRIB_STATUS_UNACCEPTED_FRAME_RECEIVED 0x00000005 +#define ATTRIB_STATUS_RETRY_COUNT_EXCEEDED 0x00000006 +#define ATTRIB_STATUS_INVALID_FRAME_RECEIVED 0x00000007 +#define ATTRIB_STATUS_NEGOTIATION_TIMEOUT 0x00000008 +#define ATTRIB_STATUS_ATTRIB_NOT_SUPPORTED_IN_MSG 0x00000009 +#define ATTRIB_STATUS_REQUIRED_ATTRIBUTE_MISSING 0x0000000A +#define ATTRIB_STATUS_STATUS_INFO_NOT_SUPPORTED_IN_MSG 0x0000000B + +// State of SSTP Server +#define SSTP_SERVER_STATUS_REQUEST_PENGING 0 // Connection incomplete +#define SSTP_SERVER_STATUS_CONNECTED_PENDING 1 // Connection completed. Authentication incomplete +#define SSTP_SERVER_STATUS_ESTABLISHED 2 // Connection completed. Communication available +#define SSTP_SERVER_STATUS_NOT_INITIALIZED INFINITE // Connection not accepted yet. + +// Length of Nonce +#define SSTP_NONCE_SIZE 32 // 256 bits + + +//// Type + +// SSTP Attribute +struct SSTP_ATTRIBUTE +{ + UCHAR AttributeId; + UCHAR *Data; + UINT DataSize; + UINT TotalLength; +}; + +// SSTP Packet +struct SSTP_PACKET +{ + UCHAR Version; + bool IsControl; + UCHAR *Data; + UINT DataSize; + USHORT MessageType; + LIST *AttributeList; +}; + +// SSTP Server +struct SSTP_SERVER +{ + CEDAR *Cedar; + UINT64 Now; + IP ClientIp, ServerIp; + UINT ClientPort, ServerPort; + char ClientHostName[MAX_HOST_NAME_LEN + 1]; + char ClientCipherName[MAX_SIZE]; + SOCK_EVENT *SockEvent; + QUEUE *RecvQueue; // Receive queue + QUEUE *SendQueue; // Transmission queue + INTERRUPT_MANAGER *Interrupt; // Interrupt manager + bool Aborting; // Forced disconnection flag + bool AbortSent; // Flag of whether to send the Abort + bool AbortReceived; // Flag of whether the Abort has been received + bool Disconnecting; // Disconnecting flag + bool DisconnectSent; // Flag of whether to send a Disconnect + bool DisconnectRecved; // Flag of whether a Disconnect has been received + bool Disconnected; // Flag as to disconnect + UINT Status; // State + UCHAR SentNonce[SSTP_NONCE_SIZE]; // Random data sent + TUBE *TubeRecv, *TubeSend; // Delivery tube of packets to PPP module + THREAD *PPPThread; // PPP module thread + UINT64 NextSendEchoRequestTick; // Time to send the next Echo Request + UINT64 LastRecvTick; // Tick when some data has received at the end + bool FlushRecvTube; // Flag whether to flush the reception tube + UINT EstablishedCount; // Number of session establishment + PPP_SESSION *PPPSession; // Underlying PPP Session +}; + + +//// Function prototype +const PROTO_IMPL *SstpGetProtoImpl(); +const PROTO_OPTION *SstpOptions(); +const char *SstpName(); +bool SstpInit(void **param, const LIST *options, CEDAR *cedar, INTERRUPT_MANAGER *im, SOCK_EVENT *se, const char *cipher, const char *hostname); +void SstpFree(void *param); +bool SstpProcessData(void *param, TCP_RAW_DATA *in, FIFO *out); + +SSTP_SERVER *NewSstpServer(CEDAR *cedar, INTERRUPT_MANAGER *im, SOCK_EVENT *se, const char *cipher, const char *hostname); +void FreeSstpServer(SSTP_SERVER *s); +void SstpProcessInterrupt(SSTP_SERVER *s); +SSTP_PACKET *SstpParsePacket(UCHAR *data, UINT size); +LIST *SstpParseAttributeList(UCHAR *data, UINT size, SSTP_PACKET *p); +SSTP_ATTRIBUTE *SstpParseAttribute(UCHAR *data, UINT size); +void SstpFreeAttribute(SSTP_ATTRIBUTE *a); +void SstpFreeAttributeList(LIST *o); +void SstpFreePacket(SSTP_PACKET *p); +BUF *SstpBuildPacket(SSTP_PACKET *p); +BUF *SstpBuildAttributeList(LIST *o, USHORT message_type); +BUF *SstpBuildAttribute(SSTP_ATTRIBUTE *a); +void SstpAbort(SSTP_SERVER *s); +void SstpDisconnect(SSTP_SERVER *s); +void SstpProcessPacket(SSTP_SERVER *s, SSTP_PACKET *p); +void SstpProcessControlPacket(SSTP_SERVER *s, SSTP_PACKET *p); +void SstpProcessDataPacket(SSTP_SERVER *s, SSTP_PACKET *p); +SSTP_ATTRIBUTE *SstpFindAttribute(SSTP_PACKET *p, UCHAR attribute_id); +SSTP_ATTRIBUTE *SstpNewAttribute(UCHAR attribute_id, UCHAR *data, UINT data_size); +SSTP_ATTRIBUTE *SstpNewStatusInfoAttribute(UCHAR attrib_id, UINT status); +SSTP_ATTRIBUTE *SstpNewCryptoBindingRequestAttribute(UCHAR hash_protocol_bitmask, UCHAR *nonce_32bytes); +SSTP_PACKET *SstpNewDataPacket(UCHAR *data, UINT size); +SSTP_PACKET *SstpNewControlPacket(USHORT message_type); +SSTP_PACKET *SstpNewControlPacketWithAnAttribute(USHORT message_type, SSTP_ATTRIBUTE *a); +void SstpSendPacket(SSTP_SERVER *s, SSTP_PACKET *p); + +#endif // PROTO_SSTP_H diff --git a/src/Cedar/Proto_Win7.c b/src/Cedar/Proto_Win7.c index 48b23aee..7f015d5a 100644 --- a/src/Cedar/Proto_Win7.c +++ b/src/Cedar/Proto_Win7.c @@ -1,469 +1,469 @@ -// SoftEther VPN Source Code - Developer Edition Master Branch -// Cedar Communication Module - - -// Proto_Win7.c -// Initialize the helper module for Windows 7 / Windows 8 / Windows Vista / Windows Server 2008 / Windows Server 2008 R2 / Windows Server 2012 / Windows 10 - -#include - -#ifdef WIN32 - -#define _WIN32_WINNT 0x0600 -#define WINVER 0x0600 -#define INITGUID -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "Proto_Win7Inner.h" -#include - -static IPSEC_WIN7_FUNCTIONS *api = NULL; -static HINSTANCE hDll = NULL; - - -// Initialize the IPsec helper module for Windows 7 -IPSEC_WIN7 *IPsecWin7Init() -{ - IPSEC_WIN7 *w; - FWPM_SESSION0 session; - UINT ret; - FWPM_FILTER0 filter; - UINT64 weight = MAXUINT64; - - Debug("IPsecWin7Init()\n"); - - if (MsIsVista() == false) - { - return NULL; - } - - if (MsIsAdmin() == false) - { - return NULL; - } - - if (IPsecWin7InitApi() == false) - { - return NULL; - } - - // Driver Initialization - if (IPsecWin7InitDriver() == false) - { - return NULL; - } - - // Open the WFP (Dynamic Session) - Zero(&session, sizeof(session)); - session.flags = FWPM_SESSION_FLAG_DYNAMIC; - - w = ZeroMalloc(sizeof(IPSEC_WIN7)); - ret = api->FwpmEngineOpen0(NULL, RPC_C_AUTHN_DEFAULT, NULL, &session, &w->hEngine); - if (ret) - { - Debug("FwpmEngineOpen0 Failed.\n"); - IPsecWin7Free(w); - return NULL; - } - - // Create the Filter (IPv4) - Zero(&filter, sizeof(filter)); - filter.flags = FWPM_FILTER_FLAG_PERMIT_IF_CALLOUT_UNREGISTERED; - filter.layerKey = FWPM_LAYER_INBOUND_IPPACKET_V4; - filter.weight.type = FWP_UINT64; - filter.weight.uint64 = &weight; - filter.action.type = FWP_ACTION_CALLOUT_UNKNOWN; - filter.action.calloutKey = GUID_WFP_CALLOUT_DRIVER_V4; - filter.displayData.name = IPSEC_WIN7_FILTER_TITLE_V4; - ret = api->FwpmFilterAdd0(w->hEngine, &filter, NULL, &w->FilterIPv4Id); - if (ret) - { - Debug("FwpmFilterAdd0 for IPv4 Failed: 0x%X\n", ret); - } - else - { - Debug("FwpmFilterAdd0 for IPv4 Ok.\n"); - } - - // Create the Filter (IPv6) - Zero(&filter, sizeof(filter)); - filter.flags = FWPM_FILTER_FLAG_PERMIT_IF_CALLOUT_UNREGISTERED; - filter.layerKey = FWPM_LAYER_INBOUND_IPPACKET_V6; - filter.weight.type = FWP_UINT64; - filter.weight.uint64 = &weight; - filter.action.type = FWP_ACTION_CALLOUT_UNKNOWN; - filter.action.calloutKey = GUID_WFP_CALLOUT_DRIVER_V6; - filter.displayData.name = IPSEC_WIN7_FILTER_TITLE_V6; - ret = api->FwpmFilterAdd0(w->hEngine, &filter, NULL, &w->FilterIPv6Id); - if (ret) - { - Debug("FwpmFilterAdd0 for IPv6 Failed: 0x%X\n", ret); - } - else - { - Debug("FwpmFilterAdd0 for IPv6 Ok.\n"); - } - - // Open the device of the driver as a file - w->hDriverFile = CreateFileA(WFP_DEVICE_FILE_NAME, GENERIC_READ | GENERIC_WRITE, - FILE_SHARE_READ | FILE_SHARE_WRITE, NULL, OPEN_EXISTING, 0, NULL); - - if (w->hDriverFile == NULL || w->hDriverFile == INVALID_HANDLE_VALUE) - { - Debug("CreateFileA(\"%s\") Failed.\n", WFP_DEVICE_FILE_NAME); - IPsecWin7Free(w); - return NULL; - } - - IPsecWin7UpdateHostIPAddressList(w); - - Debug("IPsecWin7Init() Ok.\n"); - - return w; -} - -// Update the IP address list of the host -void IPsecWin7UpdateHostIPAddressList(IPSEC_WIN7 *w) -{ - LIST *o; - UINT i; - BUF *buf; - UINT retsize; - // Validate arguments - if (w == NULL) - { - return; - } - - o = GetHostIPAddressList(); - if (o == NULL) - { - return; - } - - buf = NewBuf(); - - for (i = 0;i < LIST_NUM(o);i++) - { - IP *ip = LIST_DATA(o, i); - WFP_LOCAL_IP a; - - Zero(&a, sizeof(a)); - - // Exclude any IPs or localhost IP - if (IsZeroIP(ip) == false && IsLocalHostIP(ip) == false) - { - if (IsIP4(ip)) - { - a.IpVersion = 4; - Copy(a.IpAddress.IPv4Address, ip->addr, 4); - } - else - { - a.IpVersion = 6; - Copy(a.IpAddress.IPv6Address, ip->ipv6_addr, 16); - } - - WriteBuf(buf, &a, sizeof(WFP_LOCAL_IP)); - } - } - - if (WriteFile(w->hDriverFile, buf->Buf, buf->Size, &retsize, NULL) == false) - { - Debug("WriteFile to the driver failed. %u\n", GetLastError()); - } - - FreeHostIPAddressList(o); - - FreeBuf(buf); -} - -// Release the module -void IPsecWin7Free(IPSEC_WIN7 *w) -{ - // Validate arguments - if (w == NULL) - { - return; - } - - if (w->hEngine != NULL) - { - api->FwpmEngineClose0(w->hEngine); - } - - if (w->hDriverFile != NULL && w->hDriverFile != INVALID_HANDLE_VALUE) - { - CloseHandle(w->hDriverFile); - } - - Free(w); -} - -// Initialize and start the driver -bool IPsecWin7InitDriver() -{ - bool ret; - void *lock = MsInitGlobalLock("IPsecWin7InitDriver", false); - void *p = MsDisableWow64FileSystemRedirection(); - - MsGlobalLock(lock); - { - ret = IPsecWin7InitDriverInner(); - } - MsGlobalUnlock(lock); - - MsFreeGlobalLock(lock); - - MsRestoreWow64FileSystemRedirection(p); - - Debug("IPsecWin7InitDriver: %u\n", ret); - - return ret; -} -bool IPsecWin7InitDriverInner() -{ - char sys_filename[MAX_PATH]; - bool install_driver = true; - HANDLE hEngine; - UINT ret; - FWPM_SESSION0 session; - UINT id; - FWPM_CALLOUT0 callout; - - Format(sys_filename, sizeof(sys_filename), IPSEC_WIN7_DST_SYS, MsGetSystem32Dir()); - - if (IsFileExists(sys_filename) && MsIsServiceInstalled(IPSEC_WIN7_DRIVER_NAME)) - { - if (GetCurrentIPsecWin7DriverBuild() >= CEDAR_VERSION_BUILD) - { - // Not to install since the latest version has been already installed - install_driver = false; - } - } - - if (install_driver) - { - char src_filename[MAX_PATH]; - - if (MsIsWindows10() == false) - { - Format(src_filename, sizeof(src_filename), - "|DriverPackages\\Wfp\\%s\\pxwfp_%s.sys", - (MsIsX64() ? "x64" : "x86"), (MsIsX64() ? "x64" : "x86")); - } - else - { - Format(src_filename, sizeof(src_filename), - "|DriverPackages\\Wfp_Win10\\%s\\pxwfp_%s.sys", - (MsIsX64() ? "x64" : "x86"), (MsIsX64() ? "x64" : "x86")); - } - - // Copy the driver - if (FileCopy(src_filename, sys_filename) == false) - { - Debug("%s copy failed. %u\n", sys_filename, GetLastError()); - if (IsFileExists(sys_filename) == false) - { - Debug("%s failed. Abort.\n", sys_filename); - return false; - } - } - else - { - Debug("%s copied.\n", sys_filename); - } - - // Set the build number - SetCurrentIPsecWin7DriverBuild(); - } - - // Get whether the device drivers is already installed - if (MsIsServiceInstalled(IPSEC_WIN7_DRIVER_NAME) == false) - { - wchar_t sys_filename_w[MAX_PATH]; - - StrToUni(sys_filename_w, sizeof(sys_filename_w), sys_filename); - - // Run a new installation - if (MsInstallDeviceDriverW(IPSEC_WIN7_DRIVER_NAME, IPSEC_WIN7_DRIVER_TITLE, - sys_filename_w, NULL) == false) - { - // Installation failed - Debug("MsInstallDeviceDriverW failed.\n"); - return false; - } - } - - // Start if the device driver is stopped - if (MsIsServiceRunning(IPSEC_WIN7_DRIVER_NAME) == false) - { - if (MsStartService(IPSEC_WIN7_DRIVER_NAME) == false) - { - // Start failure - Debug("MsStartService failed.\n"); - return false; - } - - Debug("%s service started.\n", IPSEC_WIN7_DRIVER_NAME); - } - else - { - Debug("%s service was already started.\n", IPSEC_WIN7_DRIVER_NAME); - } - - // Open the WFP - Zero(&session, sizeof(session)); - - ret = api->FwpmEngineOpen0(NULL, RPC_C_AUTHN_DEFAULT, NULL, &session, &hEngine); - if (ret) - { - Debug("FwpmEngineOpen0 failed.\n"); - return false; - } - - // Create the Callout Driver (IPv4) - Zero(&callout, sizeof(callout)); - callout.calloutKey = GUID_WFP_CALLOUT_DRIVER_V4; - callout.applicableLayer = FWPM_LAYER_INBOUND_IPPACKET_V4; - callout.displayData.name = IPSEC_WIN7_DRIVER_TITLE_V4; - ret = api->FwpmCalloutAdd0(hEngine, &callout, NULL, &id); - if (ret) - { - Debug("FwpmCalloutAdd0 for IPv4 Failed: 0x%X\n", ret); - } - else - { - Debug("FwpmCalloutAdd0 for IPv4 Ok.\n"); - } - - // Create the Callout Driver (IPv6) - Zero(&callout, sizeof(callout)); - callout.calloutKey = GUID_WFP_CALLOUT_DRIVER_V6; - callout.applicableLayer = FWPM_LAYER_INBOUND_IPPACKET_V6; - callout.displayData.name = IPSEC_WIN7_DRIVER_TITLE_V6; - ret = api->FwpmCalloutAdd0(hEngine, &callout, NULL, &id); - if (ret) - { - Debug("FwpmCalloutAdd0 for IPv6 Failed: 0x%X\n", ret); - } - else - { - Debug("FwpmCalloutAdd0 for IPv6 Ok.\n"); - } - - api->FwpmEngineClose0(hEngine); - - return true; -} - -// Write the build number of the current driver -void SetCurrentIPsecWin7DriverBuild() -{ - MsRegWriteInt(REG_LOCAL_MACHINE, IPSEC_WIN7_DRIVER_REGKEY, - (MsIsWindows10() ? IPSEC_WIN7_DRIVER_BUILDNUMBER_WIN10 : IPSEC_WIN7_DRIVER_BUILDNUMBER), - CEDAR_VERSION_BUILD); -} - -// Get the build number of the current driver -UINT GetCurrentIPsecWin7DriverBuild() -{ - return MsRegReadInt(REG_LOCAL_MACHINE, IPSEC_WIN7_DRIVER_REGKEY, - (MsIsWindows10() ? IPSEC_WIN7_DRIVER_BUILDNUMBER_WIN10 : IPSEC_WIN7_DRIVER_BUILDNUMBER)); -} - -// Initialization of the API -bool IPsecWin7InitApi() -{ - if (api != NULL) - { - return true; - } - - if (hDll == NULL) - { - hDll = LoadLibraryA("FWPUCLNT.DLL"); - } - - if (hDll == NULL) - { - return false; - } - - api = malloc(sizeof(IPSEC_WIN7_FUNCTIONS)); - Zero(api, sizeof(IPSEC_WIN7_FUNCTIONS)); - - api->FwpmEngineOpen0 = - (DWORD (__stdcall *)(const wchar_t *,UINT32,SEC_WINNT_AUTH_IDENTITY_W *,const FWPM_SESSION0 *,HANDLE *)) - GetProcAddress(hDll, "FwpmEngineOpen0"); - - api->FwpmEngineClose0 = - (DWORD (__stdcall *)(HANDLE)) - GetProcAddress(hDll, "FwpmEngineClose0"); - - api->FwpmFreeMemory0 = - (void (__stdcall *)(void **)) - GetProcAddress(hDll, "FwpmFreeMemory0"); - - api->FwpmFilterAdd0 = - (DWORD (__stdcall *)(HANDLE,const FWPM_FILTER0 *,PSECURITY_DESCRIPTOR,UINT64 *)) - GetProcAddress(hDll, "FwpmFilterAdd0"); - - api->IPsecSaContextCreate0 = - (DWORD (__stdcall *)(HANDLE,const IPSEC_TRAFFIC0 *,UINT64 *,UINT64 *)) - GetProcAddress(hDll, "IPsecSaContextCreate0"); - - api->IPsecSaContextGetSpi0 = - (DWORD (__stdcall *)(HANDLE,UINT64,const IPSEC_GETSPI0 *,IPSEC_SA_SPI *)) - GetProcAddress(hDll, "IPsecSaContextGetSpi0"); - - api->IPsecSaContextAddInbound0 = - (DWORD (__stdcall *)(HANDLE,UINT64,const IPSEC_SA_BUNDLE0 *)) - GetProcAddress(hDll, "IPsecSaContextAddInbound0"); - - api->IPsecSaContextAddOutbound0 = - (DWORD (__stdcall *)(HANDLE,UINT64,const IPSEC_SA_BUNDLE0 *)) - GetProcAddress(hDll, "IPsecSaContextAddOutbound0"); - - api->FwpmCalloutAdd0 = - (DWORD (__stdcall *)(HANDLE,const FWPM_CALLOUT0 *,PSECURITY_DESCRIPTOR,UINT32 *)) - GetProcAddress(hDll, "FwpmCalloutAdd0"); - - if (api->FwpmEngineOpen0 == NULL || - api->FwpmEngineClose0 == NULL || - api->FwpmFreeMemory0 == NULL || - api->FwpmFilterAdd0 == NULL || - api->IPsecSaContextCreate0 == NULL || - api->IPsecSaContextGetSpi0 == NULL || - api->IPsecSaContextAddInbound0 == NULL || - api->IPsecSaContextAddOutbound0 == NULL || - api->FwpmCalloutAdd0 == NULL) - { - free(api); - api = NULL; - return false; - } - - return true; -} - -#endif // WIN32 - - +// SoftEther VPN Source Code - Developer Edition Master Branch +// Cedar Communication Module + + +// Proto_Win7.c +// Initialize the helper module for Windows 7 / Windows 8 / Windows Vista / Windows Server 2008 / Windows Server 2008 R2 / Windows Server 2012 / Windows 10 + +#include + +#ifdef WIN32 + +#define _WIN32_WINNT 0x0600 +#define WINVER 0x0600 +#define INITGUID +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "Proto_Win7Inner.h" +#include + +static IPSEC_WIN7_FUNCTIONS *api = NULL; +static HINSTANCE hDll = NULL; + + +// Initialize the IPsec helper module for Windows 7 +IPSEC_WIN7 *IPsecWin7Init() +{ + IPSEC_WIN7 *w; + FWPM_SESSION0 session; + UINT ret; + FWPM_FILTER0 filter; + UINT64 weight = MAXUINT64; + + Debug("IPsecWin7Init()\n"); + + if (MsIsVista() == false) + { + return NULL; + } + + if (MsIsAdmin() == false) + { + return NULL; + } + + if (IPsecWin7InitApi() == false) + { + return NULL; + } + + // Driver Initialization + if (IPsecWin7InitDriver() == false) + { + return NULL; + } + + // Open the WFP (Dynamic Session) + Zero(&session, sizeof(session)); + session.flags = FWPM_SESSION_FLAG_DYNAMIC; + + w = ZeroMalloc(sizeof(IPSEC_WIN7)); + ret = api->FwpmEngineOpen0(NULL, RPC_C_AUTHN_DEFAULT, NULL, &session, &w->hEngine); + if (ret) + { + Debug("FwpmEngineOpen0 Failed.\n"); + IPsecWin7Free(w); + return NULL; + } + + // Create the Filter (IPv4) + Zero(&filter, sizeof(filter)); + filter.flags = FWPM_FILTER_FLAG_PERMIT_IF_CALLOUT_UNREGISTERED; + filter.layerKey = FWPM_LAYER_INBOUND_IPPACKET_V4; + filter.weight.type = FWP_UINT64; + filter.weight.uint64 = &weight; + filter.action.type = FWP_ACTION_CALLOUT_UNKNOWN; + filter.action.calloutKey = GUID_WFP_CALLOUT_DRIVER_V4; + filter.displayData.name = IPSEC_WIN7_FILTER_TITLE_V4; + ret = api->FwpmFilterAdd0(w->hEngine, &filter, NULL, &w->FilterIPv4Id); + if (ret) + { + Debug("FwpmFilterAdd0 for IPv4 Failed: 0x%X\n", ret); + } + else + { + Debug("FwpmFilterAdd0 for IPv4 Ok.\n"); + } + + // Create the Filter (IPv6) + Zero(&filter, sizeof(filter)); + filter.flags = FWPM_FILTER_FLAG_PERMIT_IF_CALLOUT_UNREGISTERED; + filter.layerKey = FWPM_LAYER_INBOUND_IPPACKET_V6; + filter.weight.type = FWP_UINT64; + filter.weight.uint64 = &weight; + filter.action.type = FWP_ACTION_CALLOUT_UNKNOWN; + filter.action.calloutKey = GUID_WFP_CALLOUT_DRIVER_V6; + filter.displayData.name = IPSEC_WIN7_FILTER_TITLE_V6; + ret = api->FwpmFilterAdd0(w->hEngine, &filter, NULL, &w->FilterIPv6Id); + if (ret) + { + Debug("FwpmFilterAdd0 for IPv6 Failed: 0x%X\n", ret); + } + else + { + Debug("FwpmFilterAdd0 for IPv6 Ok.\n"); + } + + // Open the device of the driver as a file + w->hDriverFile = CreateFileA(WFP_DEVICE_FILE_NAME, GENERIC_READ | GENERIC_WRITE, + FILE_SHARE_READ | FILE_SHARE_WRITE, NULL, OPEN_EXISTING, 0, NULL); + + if (w->hDriverFile == NULL || w->hDriverFile == INVALID_HANDLE_VALUE) + { + Debug("CreateFileA(\"%s\") Failed.\n", WFP_DEVICE_FILE_NAME); + IPsecWin7Free(w); + return NULL; + } + + IPsecWin7UpdateHostIPAddressList(w); + + Debug("IPsecWin7Init() Ok.\n"); + + return w; +} + +// Update the IP address list of the host +void IPsecWin7UpdateHostIPAddressList(IPSEC_WIN7 *w) +{ + LIST *o; + UINT i; + BUF *buf; + UINT retsize; + // Validate arguments + if (w == NULL) + { + return; + } + + o = GetHostIPAddressList(); + if (o == NULL) + { + return; + } + + buf = NewBuf(); + + for (i = 0;i < LIST_NUM(o);i++) + { + IP *ip = LIST_DATA(o, i); + WFP_LOCAL_IP a; + + Zero(&a, sizeof(a)); + + // Exclude any IPs or localhost IP + if (IsZeroIP(ip) == false && IsLocalHostIP(ip) == false) + { + if (IsIP4(ip)) + { + a.IpVersion = 4; + Copy(a.IpAddress.IPv4Address, ip->addr, 4); + } + else + { + a.IpVersion = 6; + Copy(a.IpAddress.IPv6Address, ip->ipv6_addr, 16); + } + + WriteBuf(buf, &a, sizeof(WFP_LOCAL_IP)); + } + } + + if (WriteFile(w->hDriverFile, buf->Buf, buf->Size, &retsize, NULL) == false) + { + Debug("WriteFile to the driver failed. %u\n", GetLastError()); + } + + FreeHostIPAddressList(o); + + FreeBuf(buf); +} + +// Release the module +void IPsecWin7Free(IPSEC_WIN7 *w) +{ + // Validate arguments + if (w == NULL) + { + return; + } + + if (w->hEngine != NULL) + { + api->FwpmEngineClose0(w->hEngine); + } + + if (w->hDriverFile != NULL && w->hDriverFile != INVALID_HANDLE_VALUE) + { + CloseHandle(w->hDriverFile); + } + + Free(w); +} + +// Initialize and start the driver +bool IPsecWin7InitDriver() +{ + bool ret; + void *lock = MsInitGlobalLock("IPsecWin7InitDriver", false); + void *p = MsDisableWow64FileSystemRedirection(); + + MsGlobalLock(lock); + { + ret = IPsecWin7InitDriverInner(); + } + MsGlobalUnlock(lock); + + MsFreeGlobalLock(lock); + + MsRestoreWow64FileSystemRedirection(p); + + Debug("IPsecWin7InitDriver: %u\n", ret); + + return ret; +} +bool IPsecWin7InitDriverInner() +{ + char sys_filename[MAX_PATH]; + bool install_driver = true; + HANDLE hEngine; + UINT ret; + FWPM_SESSION0 session; + UINT id; + FWPM_CALLOUT0 callout; + + Format(sys_filename, sizeof(sys_filename), IPSEC_WIN7_DST_SYS, MsGetSystem32Dir()); + + if (IsFileExists(sys_filename) && MsIsServiceInstalled(IPSEC_WIN7_DRIVER_NAME)) + { + if (GetCurrentIPsecWin7DriverBuild() >= CEDAR_VERSION_BUILD) + { + // Not to install since the latest version has been already installed + install_driver = false; + } + } + + if (install_driver) + { + char src_filename[MAX_PATH]; + + if (MsIsWindows10() == false) + { + Format(src_filename, sizeof(src_filename), + "|DriverPackages\\Wfp\\%s\\pxwfp_%s.sys", + (MsIsX64() ? "x64" : "x86"), (MsIsX64() ? "x64" : "x86")); + } + else + { + Format(src_filename, sizeof(src_filename), + "|DriverPackages\\Wfp_Win10\\%s\\pxwfp_%s.sys", + (MsIsX64() ? "x64" : "x86"), (MsIsX64() ? "x64" : "x86")); + } + + // Copy the driver + if (FileCopy(src_filename, sys_filename) == false) + { + Debug("%s copy failed. %u\n", sys_filename, GetLastError()); + if (IsFileExists(sys_filename) == false) + { + Debug("%s failed. Abort.\n", sys_filename); + return false; + } + } + else + { + Debug("%s copied.\n", sys_filename); + } + + // Set the build number + SetCurrentIPsecWin7DriverBuild(); + } + + // Get whether the device drivers is already installed + if (MsIsServiceInstalled(IPSEC_WIN7_DRIVER_NAME) == false) + { + wchar_t sys_filename_w[MAX_PATH]; + + StrToUni(sys_filename_w, sizeof(sys_filename_w), sys_filename); + + // Run a new installation + if (MsInstallDeviceDriverW(IPSEC_WIN7_DRIVER_NAME, IPSEC_WIN7_DRIVER_TITLE, + sys_filename_w, NULL) == false) + { + // Installation failed + Debug("MsInstallDeviceDriverW failed.\n"); + return false; + } + } + + // Start if the device driver is stopped + if (MsIsServiceRunning(IPSEC_WIN7_DRIVER_NAME) == false) + { + if (MsStartService(IPSEC_WIN7_DRIVER_NAME) == false) + { + // Start failure + Debug("MsStartService failed.\n"); + return false; + } + + Debug("%s service started.\n", IPSEC_WIN7_DRIVER_NAME); + } + else + { + Debug("%s service was already started.\n", IPSEC_WIN7_DRIVER_NAME); + } + + // Open the WFP + Zero(&session, sizeof(session)); + + ret = api->FwpmEngineOpen0(NULL, RPC_C_AUTHN_DEFAULT, NULL, &session, &hEngine); + if (ret) + { + Debug("FwpmEngineOpen0 failed.\n"); + return false; + } + + // Create the Callout Driver (IPv4) + Zero(&callout, sizeof(callout)); + callout.calloutKey = GUID_WFP_CALLOUT_DRIVER_V4; + callout.applicableLayer = FWPM_LAYER_INBOUND_IPPACKET_V4; + callout.displayData.name = IPSEC_WIN7_DRIVER_TITLE_V4; + ret = api->FwpmCalloutAdd0(hEngine, &callout, NULL, &id); + if (ret) + { + Debug("FwpmCalloutAdd0 for IPv4 Failed: 0x%X\n", ret); + } + else + { + Debug("FwpmCalloutAdd0 for IPv4 Ok.\n"); + } + + // Create the Callout Driver (IPv6) + Zero(&callout, sizeof(callout)); + callout.calloutKey = GUID_WFP_CALLOUT_DRIVER_V6; + callout.applicableLayer = FWPM_LAYER_INBOUND_IPPACKET_V6; + callout.displayData.name = IPSEC_WIN7_DRIVER_TITLE_V6; + ret = api->FwpmCalloutAdd0(hEngine, &callout, NULL, &id); + if (ret) + { + Debug("FwpmCalloutAdd0 for IPv6 Failed: 0x%X\n", ret); + } + else + { + Debug("FwpmCalloutAdd0 for IPv6 Ok.\n"); + } + + api->FwpmEngineClose0(hEngine); + + return true; +} + +// Write the build number of the current driver +void SetCurrentIPsecWin7DriverBuild() +{ + MsRegWriteInt(REG_LOCAL_MACHINE, IPSEC_WIN7_DRIVER_REGKEY, + (MsIsWindows10() ? IPSEC_WIN7_DRIVER_BUILDNUMBER_WIN10 : IPSEC_WIN7_DRIVER_BUILDNUMBER), + CEDAR_VERSION_BUILD); +} + +// Get the build number of the current driver +UINT GetCurrentIPsecWin7DriverBuild() +{ + return MsRegReadInt(REG_LOCAL_MACHINE, IPSEC_WIN7_DRIVER_REGKEY, + (MsIsWindows10() ? IPSEC_WIN7_DRIVER_BUILDNUMBER_WIN10 : IPSEC_WIN7_DRIVER_BUILDNUMBER)); +} + +// Initialization of the API +bool IPsecWin7InitApi() +{ + if (api != NULL) + { + return true; + } + + if (hDll == NULL) + { + hDll = LoadLibraryA("FWPUCLNT.DLL"); + } + + if (hDll == NULL) + { + return false; + } + + api = malloc(sizeof(IPSEC_WIN7_FUNCTIONS)); + Zero(api, sizeof(IPSEC_WIN7_FUNCTIONS)); + + api->FwpmEngineOpen0 = + (DWORD (__stdcall *)(const wchar_t *,UINT32,SEC_WINNT_AUTH_IDENTITY_W *,const FWPM_SESSION0 *,HANDLE *)) + GetProcAddress(hDll, "FwpmEngineOpen0"); + + api->FwpmEngineClose0 = + (DWORD (__stdcall *)(HANDLE)) + GetProcAddress(hDll, "FwpmEngineClose0"); + + api->FwpmFreeMemory0 = + (void (__stdcall *)(void **)) + GetProcAddress(hDll, "FwpmFreeMemory0"); + + api->FwpmFilterAdd0 = + (DWORD (__stdcall *)(HANDLE,const FWPM_FILTER0 *,PSECURITY_DESCRIPTOR,UINT64 *)) + GetProcAddress(hDll, "FwpmFilterAdd0"); + + api->IPsecSaContextCreate0 = + (DWORD (__stdcall *)(HANDLE,const IPSEC_TRAFFIC0 *,UINT64 *,UINT64 *)) + GetProcAddress(hDll, "IPsecSaContextCreate0"); + + api->IPsecSaContextGetSpi0 = + (DWORD (__stdcall *)(HANDLE,UINT64,const IPSEC_GETSPI0 *,IPSEC_SA_SPI *)) + GetProcAddress(hDll, "IPsecSaContextGetSpi0"); + + api->IPsecSaContextAddInbound0 = + (DWORD (__stdcall *)(HANDLE,UINT64,const IPSEC_SA_BUNDLE0 *)) + GetProcAddress(hDll, "IPsecSaContextAddInbound0"); + + api->IPsecSaContextAddOutbound0 = + (DWORD (__stdcall *)(HANDLE,UINT64,const IPSEC_SA_BUNDLE0 *)) + GetProcAddress(hDll, "IPsecSaContextAddOutbound0"); + + api->FwpmCalloutAdd0 = + (DWORD (__stdcall *)(HANDLE,const FWPM_CALLOUT0 *,PSECURITY_DESCRIPTOR,UINT32 *)) + GetProcAddress(hDll, "FwpmCalloutAdd0"); + + if (api->FwpmEngineOpen0 == NULL || + api->FwpmEngineClose0 == NULL || + api->FwpmFreeMemory0 == NULL || + api->FwpmFilterAdd0 == NULL || + api->IPsecSaContextCreate0 == NULL || + api->IPsecSaContextGetSpi0 == NULL || + api->IPsecSaContextAddInbound0 == NULL || + api->IPsecSaContextAddOutbound0 == NULL || + api->FwpmCalloutAdd0 == NULL) + { + free(api); + api = NULL; + return false; + } + + return true; +} + +#endif // WIN32 + + diff --git a/src/Cedar/Proto_Win7.h b/src/Cedar/Proto_Win7.h index 33d585b1..8cc0ddbd 100644 --- a/src/Cedar/Proto_Win7.h +++ b/src/Cedar/Proto_Win7.h @@ -1,39 +1,39 @@ -// SoftEther VPN Source Code - Developer Edition Master Branch -// Cedar Communication Module - - -// Proto_Win7.h -// Header of Proto_Win7.c - -#ifndef PROTO_WIN7_H -#define PROTO_WIN7_H - -// Constants -#define IPSEC_WIN7_SRC_SYS_X86 "|pxwfp_x86.sys" -#define IPSEC_WIN7_SRC_SYS_X64 "|pxwfp_x64.sys" -#define IPSEC_WIN7_DST_SYS "%s\\drivers\\pxwfp.sys" - -#define IPSEC_WIN7_DRIVER_NAME "pxwfp" -#define IPSEC_WIN7_DRIVER_TITLE L"SoftEther PacketiX VPN IPsec WFP Callout Driver" -#define IPSEC_WIN7_DRIVER_TITLE_V4 L"SoftEther PacketiX VPN IPsec WFP Callout for IPv4" -#define IPSEC_WIN7_DRIVER_TITLE_V6 L"SoftEther PacketiX VPN IPsec WFP Callout for IPv6" -#define IPSEC_WIN7_FILTER_TITLE_V4 CEDAR_PRODUCT_STR_W L" VPN IPsec Filter for IPv4" -#define IPSEC_WIN7_FILTER_TITLE_V6 CEDAR_PRODUCT_STR_W L" VPN IPsec Filter for IPv6" -#define IPSEC_WIN7_DRIVER_REGKEY "SYSTEM\\CurrentControlSet\\services\\pxwfp" -#define IPSEC_WIN7_DRIVER_BUILDNUMBER "CurrentInstalledBuild" -#define IPSEC_WIN7_DRIVER_BUILDNUMBER_WIN10 "CurrentInstalledBuild_Win10" - - -// Function prototype -IPSEC_WIN7 *IPsecWin7Init(); -void IPsecWin7Free(IPSEC_WIN7 *w); -void IPsecWin7UpdateHostIPAddressList(IPSEC_WIN7 *w); - -bool IPsecWin7InitDriver(); -bool IPsecWin7InitDriverInner(); -UINT GetCurrentIPsecWin7DriverBuild(); -void SetCurrentIPsecWin7DriverBuild(); -bool IPsecWin7InitApi(); - - -#endif // PROTO_WIN7_H +// SoftEther VPN Source Code - Developer Edition Master Branch +// Cedar Communication Module + + +// Proto_Win7.h +// Header of Proto_Win7.c + +#ifndef PROTO_WIN7_H +#define PROTO_WIN7_H + +// Constants +#define IPSEC_WIN7_SRC_SYS_X86 "|pxwfp_x86.sys" +#define IPSEC_WIN7_SRC_SYS_X64 "|pxwfp_x64.sys" +#define IPSEC_WIN7_DST_SYS "%s\\drivers\\pxwfp.sys" + +#define IPSEC_WIN7_DRIVER_NAME "pxwfp" +#define IPSEC_WIN7_DRIVER_TITLE L"SoftEther PacketiX VPN IPsec WFP Callout Driver" +#define IPSEC_WIN7_DRIVER_TITLE_V4 L"SoftEther PacketiX VPN IPsec WFP Callout for IPv4" +#define IPSEC_WIN7_DRIVER_TITLE_V6 L"SoftEther PacketiX VPN IPsec WFP Callout for IPv6" +#define IPSEC_WIN7_FILTER_TITLE_V4 CEDAR_PRODUCT_STR_W L" VPN IPsec Filter for IPv4" +#define IPSEC_WIN7_FILTER_TITLE_V6 CEDAR_PRODUCT_STR_W L" VPN IPsec Filter for IPv6" +#define IPSEC_WIN7_DRIVER_REGKEY "SYSTEM\\CurrentControlSet\\services\\pxwfp" +#define IPSEC_WIN7_DRIVER_BUILDNUMBER "CurrentInstalledBuild" +#define IPSEC_WIN7_DRIVER_BUILDNUMBER_WIN10 "CurrentInstalledBuild_Win10" + + +// Function prototype +IPSEC_WIN7 *IPsecWin7Init(); +void IPsecWin7Free(IPSEC_WIN7 *w); +void IPsecWin7UpdateHostIPAddressList(IPSEC_WIN7 *w); + +bool IPsecWin7InitDriver(); +bool IPsecWin7InitDriverInner(); +UINT GetCurrentIPsecWin7DriverBuild(); +void SetCurrentIPsecWin7DriverBuild(); +bool IPsecWin7InitApi(); + + +#endif // PROTO_WIN7_H diff --git a/src/Cedar/Proto_Win7Inner.h b/src/Cedar/Proto_Win7Inner.h index 7a8767be..f451951b 100644 --- a/src/Cedar/Proto_Win7Inner.h +++ b/src/Cedar/Proto_Win7Inner.h @@ -1,77 +1,77 @@ -// SoftEther VPN Source Code - Developer Edition Master Branch -// Cedar Communication Module - - -// Proto_Win7Inner.h -// Internal header of Proto_Win7.c - -#ifndef PROTO_WIN7_INNER_H -#define PROTO_WIN7_INNER_H - -// API function -typedef struct IPSEC_WIN7_FUNCTIONS -{ - DWORD (WINAPI *FwpmEngineOpen0)( - IN OPTIONAL const wchar_t* serverName, - IN UINT32 authnService, - IN OPTIONAL SEC_WINNT_AUTH_IDENTITY_W* authIdentity, - IN OPTIONAL const FWPM_SESSION0* session, - OUT HANDLE* engineHandle - ); - - DWORD (WINAPI *FwpmEngineClose0)(IN HANDLE engineHandle); - - void (WINAPI *FwpmFreeMemory0)(IN OUT void** p); - - DWORD (WINAPI *FwpmFilterAdd0)( - IN HANDLE engineHandle, - IN const FWPM_FILTER0* filter, - IN OPTIONAL PSECURITY_DESCRIPTOR sd, - OUT OPTIONAL UINT64* id - ); - - DWORD (WINAPI *IPsecSaContextCreate0)( - IN HANDLE engineHandle, - IN const IPSEC_TRAFFIC0* outboundTraffic, - OUT OPTIONAL UINT64* inboundFilterId, - OUT UINT64* id - ); - - DWORD (WINAPI *IPsecSaContextGetSpi0)( - IN HANDLE engineHandle, - IN UINT64 id, - IN const IPSEC_GETSPI0* getSpi, - OUT IPSEC_SA_SPI* inboundSpi - ); - - DWORD (WINAPI *IPsecSaContextAddInbound0)( - IN HANDLE engineHandle, - IN UINT64 id, - IN const IPSEC_SA_BUNDLE0* inboundBundle - ); - - DWORD (WINAPI *IPsecSaContextAddOutbound0)( - IN HANDLE engineHandle, - IN UINT64 id, - IN const IPSEC_SA_BUNDLE0* outboundBundle - ); - - DWORD (WINAPI *FwpmCalloutAdd0)( - IN HANDLE engineHandle, - IN const FWPM_CALLOUT0* callout, - IN OPTIONAL PSECURITY_DESCRIPTOR sd, - OUT OPTIONAL UINT32* id - ); - -} IPSEC_WIN7_FUNCTIONS; - -// Instance -struct IPSEC_WIN7 -{ - HANDLE hEngine; - HANDLE hDriverFile; - UINT64 FilterIPv4Id, FilterIPv6Id; -}; - - -#endif // PROTO_WIN7_INNER_H +// SoftEther VPN Source Code - Developer Edition Master Branch +// Cedar Communication Module + + +// Proto_Win7Inner.h +// Internal header of Proto_Win7.c + +#ifndef PROTO_WIN7_INNER_H +#define PROTO_WIN7_INNER_H + +// API function +typedef struct IPSEC_WIN7_FUNCTIONS +{ + DWORD (WINAPI *FwpmEngineOpen0)( + IN OPTIONAL const wchar_t* serverName, + IN UINT32 authnService, + IN OPTIONAL SEC_WINNT_AUTH_IDENTITY_W* authIdentity, + IN OPTIONAL const FWPM_SESSION0* session, + OUT HANDLE* engineHandle + ); + + DWORD (WINAPI *FwpmEngineClose0)(IN HANDLE engineHandle); + + void (WINAPI *FwpmFreeMemory0)(IN OUT void** p); + + DWORD (WINAPI *FwpmFilterAdd0)( + IN HANDLE engineHandle, + IN const FWPM_FILTER0* filter, + IN OPTIONAL PSECURITY_DESCRIPTOR sd, + OUT OPTIONAL UINT64* id + ); + + DWORD (WINAPI *IPsecSaContextCreate0)( + IN HANDLE engineHandle, + IN const IPSEC_TRAFFIC0* outboundTraffic, + OUT OPTIONAL UINT64* inboundFilterId, + OUT UINT64* id + ); + + DWORD (WINAPI *IPsecSaContextGetSpi0)( + IN HANDLE engineHandle, + IN UINT64 id, + IN const IPSEC_GETSPI0* getSpi, + OUT IPSEC_SA_SPI* inboundSpi + ); + + DWORD (WINAPI *IPsecSaContextAddInbound0)( + IN HANDLE engineHandle, + IN UINT64 id, + IN const IPSEC_SA_BUNDLE0* inboundBundle + ); + + DWORD (WINAPI *IPsecSaContextAddOutbound0)( + IN HANDLE engineHandle, + IN UINT64 id, + IN const IPSEC_SA_BUNDLE0* outboundBundle + ); + + DWORD (WINAPI *FwpmCalloutAdd0)( + IN HANDLE engineHandle, + IN const FWPM_CALLOUT0* callout, + IN OPTIONAL PSECURITY_DESCRIPTOR sd, + OUT OPTIONAL UINT32* id + ); + +} IPSEC_WIN7_FUNCTIONS; + +// Instance +struct IPSEC_WIN7 +{ + HANDLE hEngine; + HANDLE hDriverFile; + UINT64 FilterIPv4Id, FilterIPv6Id; +}; + + +#endif // PROTO_WIN7_INNER_H diff --git a/src/Cedar/Protocol.c b/src/Cedar/Protocol.c index f515d593..b3ac5a9d 100644 --- a/src/Cedar/Protocol.c +++ b/src/Cedar/Protocol.c @@ -1,6689 +1,6689 @@ -// SoftEther VPN Source Code - Developer Edition Master Branch -// Cedar Communication Module -// © 2020 Nokia - -// Protocol.c -// SoftEther protocol related routines - -#include "CedarPch.h" - -static UCHAR ssl_packet_start[3] = {0x17, 0x03, 0x00}; - -// Download and save intermediate certificates if necessary -bool DownloadAndSaveIntermediateCertificatesIfNecessary(X *x) -{ - LIST *o; - bool ret = false; - // Validate arguments - if (x == NULL) - { - return false; - } - - if (x->root_cert) - { - return true; - } - - o = NewCertList(true); - - ret = TryGetRootCertChain(o, x, true, NULL); - - FreeCertList(o); - - return ret; -} - -// Attempt to fetch the full chain of the specified cert -bool TryGetRootCertChain(LIST *o, X *x, bool auto_save, X **found_root_x) -{ - bool ret = false; - LIST *chain = NULL; - LIST *current_chain_dir = NULL; - // Validate arguments - if (o == NULL || x == NULL) - { - return false; - } - - chain = NewCertList(false); - - ret = TryGetParentCertFromCertList(o, x, chain); - - if (ret) - { - UINT i; - DIRLIST *dir; - wchar_t dirname[MAX_SIZE]; - wchar_t exedir[MAX_SIZE]; - - GetDbDirW(exedir, sizeof(exedir)); - CombinePathW(dirname, sizeof(dirname), exedir, L"chain_certs"); - MakeDirExW(dirname); - - if (auto_save) - { - // delete the current auto_save files - dir = EnumDirW(dirname); - if (dir != NULL) - { - for (i = 0;i < dir->NumFiles;i++) - { - DIRENT *e = dir->File[i]; - - if (e->Folder == false) - { - if (UniStartWith(e->FileNameW, AUTO_DOWNLOAD_CERTS_PREFIX)) - { - wchar_t tmp[MAX_SIZE]; - - CombinePathW(tmp, sizeof(tmp), dirname, e->FileNameW); - - FileDeleteW(tmp); - } - } - } - - FreeDir(dir); - } - } - - current_chain_dir = NewCertList(false); - AddAllChainCertsToCertList(current_chain_dir); - - for (i = 0;i < LIST_NUM(chain);i++) - { - wchar_t tmp[MAX_SIZE]; - X *xx = LIST_DATA(chain, i); - - GetAllNameFromName(tmp, sizeof(tmp), xx->subject_name); - - Debug("depth = %u, subject = %S\n", i, tmp); - - if (auto_save && CompareX(x, xx) == false && IsXInCertList(current_chain_dir, xx) == false) - { - wchar_t fn[MAX_PATH]; - char hex_a[128]; - wchar_t hex[128]; - UCHAR hash[SHA1_SIZE]; - wchar_t tmp[MAX_SIZE]; - BUF *b; - - GetXDigest(xx, hash, true); - BinToStr(hex_a, sizeof(hex_a), hash, SHA1_SIZE); - StrToUni(hex, sizeof(hex), hex_a); - - UniStrCpy(fn, sizeof(fn), AUTO_DOWNLOAD_CERTS_PREFIX); - UniStrCat(fn, sizeof(fn), hex); - UniStrCat(fn, sizeof(fn), L".cer"); - - CombinePathW(tmp, sizeof(tmp), dirname, fn); - - b = XToBuf(xx, true); - - DumpBufW(b, tmp); - - FreeBuf(b); - } - - if (xx->root_cert) - { - if (found_root_x != NULL) - { - *found_root_x = CloneX(xx); - } - } - } - } - - FreeCertList(chain); - - FreeCertList(current_chain_dir); - - return ret; -} - -// Try get the parent cert -bool TryGetParentCertFromCertList(LIST *o, X *x, LIST *found_chain) -{ - bool ret = false; - X *r; - bool do_free = false; - // Validate arguments - if (o == NULL || x == NULL || found_chain == NULL) - { - return false; - } - - if (LIST_NUM(found_chain) >= FIND_CERT_CHAIN_MAX_DEPTH) - { - return false; - } - - Add(found_chain, CloneX(x)); - - if (x->root_cert) - { - return true; - } - - r = FindCertIssuerFromCertList(o, x); - - if (r == NULL) - { - if (IsEmptyStr(x->issuer_url) == false) - { - r = DownloadCert(x->issuer_url); - - if (CheckXEx(x, r, true, true) && CompareX(x, r) == false) - { - // found - do_free = true; - } - else - { - // invalid - FreeX(r); - r = NULL; - } - } - } - - if (r != NULL) - { - ret = TryGetParentCertFromCertList(o, r, found_chain); - } - - if (do_free) - { - FreeX(r); - } - - return ret; -} - -// Find the issuer of the cert from the cert list -X *FindCertIssuerFromCertList(LIST *o, X *x) -{ - UINT i; - // Validate arguments - if (o == NULL || x == NULL) - { - return NULL; - } - - if (x->root_cert) - { - return NULL; - } - - for (i = 0;i < LIST_NUM(o);i++) - { - X *xx = LIST_DATA(o, i); - - if (CheckXEx(x, xx, true, true)) - { - if (CompareX(x, xx) == false) - { - return xx; - } - } - } - - return NULL; -} - -// Download a cert by using HTTP -X *DownloadCert(char *url) -{ - BUF *b; - URL_DATA url_data; - X *ret = NULL; - // Validate arguments - if (IsEmptyStr(url)) - { - return NULL; - } - - Debug("Trying to download a cert from %s ...\n", url); - - if (ParseUrl(&url_data, url, false, NULL) == false) - { - Debug("Download failed.\n"); - return NULL; - } - - b = HttpRequestEx(&url_data, NULL, CERT_HTTP_DOWNLOAD_TIMEOUT, CERT_HTTP_DOWNLOAD_TIMEOUT, - NULL, false, NULL, NULL, NULL, NULL, NULL, CERT_HTTP_DOWNLOAD_MAXSIZE); - - if (b == NULL) - { - Debug("Download failed.\n"); - return NULL; - } - - ret = BufToX(b, IsBase64(b)); - - FreeBuf(b); - - Debug("Download ok.\n"); - return ret; -} - -// New cert list -LIST *NewCertList(bool load_root_and_chain) -{ - LIST *o; - - o = NewList(NULL); - - if (load_root_and_chain) - { - AddAllRootCertsToCertList(o); - AddAllChainCertsToCertList(o); - } - - return o; -} - -// Free cert list -void FreeCertList(LIST *o) -{ - UINT i; - // Validate arguments - if (o == NULL) - { - return; - } - - for (i = 0;i < LIST_NUM(o);i++) - { - X *x = LIST_DATA(o, i); - - FreeX(x); - } - - ReleaseList(o); -} - -// Check whether the cert is in the cert list -bool IsXInCertList(LIST *o, X *x) -{ - UINT i; - // Validate arguments - if (o == NULL || x == NULL) - { - return false; - } - - for (i = 0;i < LIST_NUM(o);i++) - { - X *xx = LIST_DATA(o, i); - - if (CompareX(x, xx)) - { - return true; - } - } - - return false; -} - -// Add a cert to the cert list -void AddXToCertList(LIST *o, X *x) -{ - // Validate arguments - if (o == NULL || x == NULL) - { - return; - } - - if (IsXInCertList(o, x)) - { - return; - } - - if (CheckXDateNow(x) == false) - { - return; - } - - Add(o, CloneX(x)); -} - -// Add all chain certs to the cert list -void AddAllChainCertsToCertList(LIST *o) -{ - wchar_t dirname[MAX_SIZE]; - wchar_t exedir[MAX_SIZE]; - DIRLIST *dir; - // Validate arguments - if (o == NULL) - { - return; - } - - GetDbDirW(exedir, sizeof(exedir)); - - CombinePathW(dirname, sizeof(dirname), exedir, L"chain_certs"); - - MakeDirExW(dirname); - - dir = EnumDirW(dirname); - - if (dir != NULL) - { - UINT i; - - for (i = 0;i < dir->NumFiles;i++) - { - DIRENT *e = dir->File[i]; - - if (e->Folder == false) - { - wchar_t tmp[MAX_SIZE]; - X *x; - - CombinePathW(tmp, sizeof(tmp), dirname, e->FileNameW); - - x = FileToXW(tmp); - - if (x != NULL) - { - AddXToCertList(o, x); - - FreeX(x); - } - } - } - - FreeDir(dir); - } -} - -// Add all root certs to the cert list -void AddAllRootCertsToCertList(LIST *o) -{ - BUF *buf; - PACK *p; - UINT num_ok = 0, num_error = 0; - // Validate arguments - if (o == NULL) - { - return; - } - - buf = ReadDump(ROOT_CERTS_FILENAME); - if (buf == NULL) - { - return; - } - - p = BufToPack(buf); - - if (p != NULL) - { - UINT num = PackGetIndexCount(p, "cert"); - UINT i; - - for (i = 0;i < num;i++) - { - bool ok = false; - BUF *b = PackGetBufEx(p, "cert", i); - - if (b != NULL) - { - X *x = BufToX(b, false); - - if (x != NULL) - { - AddXToCertList(o, x); - - ok = true; - - FreeX(x); - } - - FreeBuf(b); - } - - if (ok) - { - num_ok++; - } - else - { - num_error++; - } - } - - FreePack(p); - } - - FreeBuf(buf); - - Debug("AddAllRootCertsToCertList: ok=%u error=%u total_list_len=%u\n", num_ok, num_error, LIST_NUM(o)); -} - -// Convert the date of YYYYMMDD format to a number -UINT64 ShortStrToDate64(char *str) -{ - UINT v; - SYSTEMTIME st; - // Validate arguments - if (str == NULL) - { - return 0; - } - - v = ToInt(str); - - Zero(&st, sizeof(st)); - - st.wYear = (v % 100000000) / 10000; - st.wMonth = (v % 10000) / 100; - st.wDay = v % 100; - - return SystemToUINT64(&st); -} - -// Handle the response that is returned from the server in the update client -void UpdateClientThreadProcessResults(UPDATE_CLIENT *c, BUF *b) -{ - bool exit = false; - // Validate arguments - if (c == NULL || b == NULL) - { - return; - } - - SeekBufToBegin(b); - - while (true) - { - char *line = CfgReadNextLine(b); - if (line == NULL) - { - break; - } - - Trim(line); - - if (StartWith(line, "#") == false && IsEmptyStr(line) == false) - { - TOKEN_LIST *t = ParseTokenWithNullStr(line, " \t"); - - if (t != NULL) - { - if (t->NumTokens >= 5) - { - if (StrCmpi(t->Token[0], c->FamilyName) == 0) - { - // Match - UINT64 date = ShortStrToDate64(t->Token[1]); - if (date != 0) - { - UINT build = ToInt(t->Token[2]); - if (build != 0) - { - if (build > c->MyBuild && build > c->LatestBuild && build > c->Setting.LatestIgnoreBuild) - { - c->Callback(c, build, date, t->Token[3], t->Token[4], &c->HaltFlag, c->Param); - - c->LatestBuild = build; - - exit = true; - } - } - } - } - } - - FreeToken(t); - } - } - - Free(line); - - if (exit) - { - break; - } - } -} - -// Update client main process -void UpdateClientThreadMain(UPDATE_CLIENT *c) -{ - char url[MAX_SIZE]; - char id[MAX_SIZE]; - URL_DATA data; - BUF *cert_hash; - UINT ret = 0; - BUF *recv; - // Validate arguments - if (c == NULL) - { - return; - } - - // Generate the URL - Format(url, sizeof(url), IsUseAlternativeHostname() ? UPDATE_SERVER_URL_CHINA : UPDATE_SERVER_URL_GLOBAL, c->FamilyName, c->SoftwareName, c->MyBuild, c->MyLanguage); - - if (IsEmptyStr(c->ClientId) == false) - { - Format(id, sizeof(id), "&id=%s", c->ClientId); - StrCat(url, sizeof(url), id); - } - - // Get a text file at this URL - if (ParseUrl(&data, url, false, NULL) == false) - { - return; - } - - cert_hash = StrToBin(UPDATE_SERVER_CERT_HASH); - - StrCpy(data.SniString, sizeof(data.SniString), DDNS_SNI_VER_STRING); - - recv = HttpRequestEx3(&data, NULL, UPDATE_CONNECT_TIMEOUT, UPDATE_COMM_TIMEOUT, &ret, false, NULL, NULL, - NULL, ((cert_hash != NULL && (cert_hash->Size % SHA1_SIZE) == 0) ? cert_hash->Buf : NULL), - (cert_hash != NULL ? (cert_hash->Size / SHA1_SIZE) : 0), - (bool *)&c->HaltFlag, 0, NULL, NULL); - - FreeBuf(cert_hash); - - if (recv != NULL) - { - UpdateClientThreadProcessResults(c, recv); - - FreeBuf(recv); - } -} - -// Update client main thread -void UpdateClientThreadProc(THREAD *thread, void *param) -{ - UPDATE_CLIENT *c = (UPDATE_CLIENT *)param; - bool first_loop = true; - // Validate arguments - if (thread == NULL || param == NULL) - { - return; - } - - while (true) - { - // Termination check - if (c->HaltFlag) - { - break; - } - - if (first_loop == false) - { - // Wait for the foreground - if (c->IsForegroundCb != NULL) - { - while (true) - { - if (c->HaltFlag) - { - break; - } - - if (c->IsForegroundCb(c, c->Param)) - { - break; - } - - Wait(c->HaltEvent, 1000); - } - } - } - - first_loop = false; - - if (c->HaltFlag) - { - break; - } - - if (c->Setting.DisableCheck == false) - { - UpdateClientThreadMain(c); - } - - // Wait until the next attempt - Wait(c->HaltEvent, GenRandInterval(UPDATE_CHECK_INTERVAL_MIN, UPDATE_CHECK_INTERVAL_MAX)); - } -} - -// Update the configuration of the update client -void SetUpdateClientSetting(UPDATE_CLIENT *c, UPDATE_CLIENT_SETTING *s) -{ - // Validate arguments - if (c == NULL || s == NULL) - { - return; - } - - Copy(&c->Setting, s, sizeof(UPDATE_CLIENT_SETTING)); - - Set(c->HaltEvent); -} - -// Start the update client -UPDATE_CLIENT *NewUpdateClient(UPDATE_NOTIFY_PROC *cb, UPDATE_ISFOREGROUND_PROC *isforeground_cb, void *param, char *family_name, char *software_name, wchar_t *software_title, UINT my_build, UINT64 my_date, char *my_lang, UPDATE_CLIENT_SETTING *current_setting, char *client_id) -{ - UPDATE_CLIENT *c; - // Validate arguments - if (family_name == NULL || software_title == NULL || software_name == NULL || my_build == 0 || - my_lang == NULL || current_setting == NULL || cb == NULL) - { - return NULL; - } - - c = ZeroMalloc(sizeof(UPDATE_CLIENT)); - - c->Callback = cb; - c->IsForegroundCb = isforeground_cb; - - StrCpy(c->ClientId, sizeof(c->ClientId), client_id); - StrCpy(c->FamilyName, sizeof(c->FamilyName), family_name); - StrCpy(c->SoftwareName, sizeof(c->SoftwareName), software_name); - UniStrCpy(c->SoftwareTitle, sizeof(c->SoftwareTitle), software_title); - c->MyBuild = my_build; - c->MyDate = my_date; - StrCpy(c->MyLanguage, sizeof(c->MyLanguage), my_lang); - - Copy(&c->Setting, current_setting, sizeof(c->Setting)); - - c->Param = param; - - c->HaltEvent = NewEvent(); - - // Create a thread - c->Thread = NewThread(UpdateClientThreadProc, c); - - return c; -} - -// Terminate the update client -void FreeUpdateClient(UPDATE_CLIENT *c) -{ - // Validate arguments - if (c == NULL) - { - return; - } - - // Thread stop - c->HaltFlag = true; - Set(c->HaltEvent); - - // Wait for thread termination - WaitThread(c->Thread, INFINITE); - - ReleaseThread(c->Thread); - ReleaseEvent(c->HaltEvent); - - Free(c); -} - -// Generate unique IDs for each machine -void GenerateMachineUniqueHash(void *data) -{ - BUF *b; - char name[64]; - OS_INFO *osinfo; - UINT64 iphash = 0; - // Validate arguments - if (data == NULL) - { - return; - } - - iphash = GetHostIPAddressListHash(); - - b = NewBuf(); - GetMachineName(name, sizeof(name)); - - osinfo = GetOsInfo(); - - WriteBuf(b, name, StrLen(name)); - - WriteBufInt64(b, iphash); - - WriteBuf(b, &osinfo->OsType, sizeof(osinfo->OsType)); - WriteBuf(b, osinfo->KernelName, StrLen(osinfo->KernelName)); - WriteBuf(b, osinfo->KernelVersion, StrLen(osinfo->KernelVersion)); - WriteBuf(b, osinfo->OsProductName, StrLen(osinfo->OsProductName)); - WriteBuf(b, &osinfo->OsServicePack, sizeof(osinfo->OsServicePack)); - WriteBuf(b, osinfo->OsSystemName, StrLen(osinfo->OsSystemName)); - WriteBuf(b, osinfo->OsVendorName, StrLen(osinfo->OsVendorName)); - WriteBuf(b, osinfo->OsVersion, StrLen(osinfo->OsVersion)); - - Sha0(data, b->Buf, b->Size); - - FreeBuf(b); -} - -// Convert a node information to a string -void NodeInfoToStr(wchar_t *str, UINT size, NODE_INFO *info) -{ - char client_ip[128], server_ip[128], proxy_ip[128], unique_id[128]; - // Validate arguments - if (str == NULL || info == NULL) - { - return; - } - - IPToStr4or6(client_ip, sizeof(client_ip), info->ClientIpAddress, info->ClientIpAddress6); - IPToStr4or6(server_ip, sizeof(server_ip), info->ServerIpAddress, info->ServerIpAddress6); - IPToStr4or6(proxy_ip, sizeof(proxy_ip), info->ProxyIpAddress, info->ProxyIpAddress6); - BinToStr(unique_id, sizeof(unique_id), info->UniqueId, sizeof(info->UniqueId)); - - UniFormat(str, size, _UU("LS_NODE_INFO_TAG"), info->ClientProductName, - Endian32(info->ClientProductVer), Endian32(info->ClientProductBuild), - info->ServerProductName, Endian32(info->ServerProductVer), Endian32(info->ServerProductBuild), - info->ClientOsName, info->ClientOsVer, info->ClientOsProductId, - info->ClientHostname, client_ip, Endian32(info->ClientPort), - info->ServerHostname, server_ip, Endian32(info->ServerPort), - info->ProxyHostname, proxy_ip, Endian32(info->ProxyPort), - info->HubName, unique_id); -} - -// Accept the password change -UINT ChangePasswordAccept(CONNECTION *c, PACK *p) -{ - CEDAR *cedar; - UCHAR random[SHA1_SIZE]; - char hubname[MAX_HUBNAME_LEN + 1]; - char username[MAX_USERNAME_LEN + 1]; - UCHAR secure_old_password[SHA1_SIZE]; - UCHAR new_password[SHA1_SIZE]; - UCHAR new_password_ntlm[SHA1_SIZE]; - UCHAR check_secure_old_password[SHA1_SIZE]; - UINT ret = ERR_NO_ERROR; - HUB *hub; - // Validate arguments - if (c == NULL || p == NULL) - { - return ERR_INTERNAL_ERROR; - } - - Copy(random, c->Random, SHA1_SIZE); - if (PackGetStr(p, "hubname", hubname, sizeof(hubname)) == false || - PackGetStr(p, "username", username, sizeof(username)) == false || - PackGetData2(p, "secure_old_password", secure_old_password, sizeof(secure_old_password)) == false || - PackGetData2(p, "new_password", new_password, sizeof(new_password)) == false) - { - return ERR_PROTOCOL_ERROR; - } - - if (PackGetData2(p, "new_password_ntlm", new_password_ntlm, MD5_SIZE) == false) - { - Zero(new_password_ntlm, sizeof(new_password_ntlm)); - } - - cedar = c->Cedar; - - LockHubList(cedar); - { - hub = GetHub(cedar, hubname); - } - UnlockHubList(cedar); - - if (hub == NULL) - { - ret = ERR_HUB_NOT_FOUND; - } - else - { - char tmp[MAX_SIZE]; - - if (GetHubAdminOption(hub, "deny_change_user_password") != 0) - { - ReleaseHub(hub); - return ERR_NOT_ENOUGH_RIGHT; - } - - IPToStr(tmp, sizeof(tmp), &c->FirstSock->RemoteIP); - HLog(hub, "LH_CHANGE_PASSWORD_1", c->Name, tmp); - - AcLock(hub); - { - USER *u = AcGetUser(hub, username); - if (u == NULL) - { - HLog(hub, "LH_CHANGE_PASSWORD_2", c->Name, username); - ret = ERR_OLD_PASSWORD_WRONG; - } - else - { - Lock(u->lock); - { - if (u->AuthType != AUTHTYPE_PASSWORD) - { - // Not a password authentication - HLog(hub, "LH_CHANGE_PASSWORD_3", c->Name, username); - ret = ERR_USER_AUTHTYPE_NOT_PASSWORD; - } - else - { - bool fix_password = false; - if (u->Policy != NULL) - { - fix_password = u->Policy->FixPassword; - } - else - { - if (u->Group != NULL) - { - if (u->Group->Policy != NULL) - { - fix_password = u->Group->Policy->FixPassword; - } - } - } - if (fix_password == false) - { - // Confirmation of the old password - AUTHPASSWORD *pw = (AUTHPASSWORD *)u->AuthData; - - SecurePassword(check_secure_old_password, pw->HashedKey, random); - if (Cmp(check_secure_old_password, secure_old_password, SHA1_SIZE) != 0) - { - // Old password is incorrect - ret = ERR_OLD_PASSWORD_WRONG; - HLog(hub, "LH_CHANGE_PASSWORD_4", c->Name, username); - } - else - { - // Write a new password - if (Cmp(pw->HashedKey, new_password, SHA1_SIZE) != 0 || IsZero(pw->NtLmSecureHash, MD5_SIZE)) - { - Copy(pw->HashedKey, new_password, SHA1_SIZE); - Copy(pw->NtLmSecureHash, new_password_ntlm, MD5_SIZE); - } - HLog(hub, "LH_CHANGE_PASSWORD_5", c->Name, username); - } - } - else - { - // Password change is prohibited - ret = ERR_NOT_ENOUGH_RIGHT; - } - } - } - Unlock(u->lock); - - ReleaseUser(u); - } - } - AcUnlock(hub); - ReleaseHub(hub); - } - - return ret; -} - -// Change the password -UINT ChangePassword(CEDAR *cedar, CLIENT_OPTION *o, char *hubname, char *username, char *old_pass, char *new_pass) -{ - UINT ret = ERR_NO_ERROR; - UCHAR old_password[SHA1_SIZE]; - UCHAR secure_old_password[SHA1_SIZE]; - UCHAR new_password[SHA1_SIZE]; - UCHAR new_password_ntlm[MD5_SIZE]; - SOCK *sock; - SESSION *s; - // Validate arguments - if (cedar == NULL || o == NULL || hubname == NULL || username == NULL || old_pass == NULL || new_pass == NULL) - { - return ERR_INTERNAL_ERROR; - } - - - // Create a session - s = NewRpcSessionEx(cedar, o, &ret, NULL); - - if (s != NULL) - { - PACK *p = NewPack(); - - sock = s->Connection->FirstSock; - - HashPassword(old_password, username, old_pass); - SecurePassword(secure_old_password, old_password, s->Connection->Random); - HashPassword(new_password, username, new_pass); - GenerateNtPasswordHash(new_password_ntlm, new_pass); - - PackAddClientVersion(p, s->Connection); - - PackAddStr(p, "method", "password"); - PackAddStr(p, "hubname", hubname); - PackAddStr(p, "username", username); - PackAddData(p, "secure_old_password", secure_old_password, SHA1_SIZE); - PackAddData(p, "new_password", new_password, SHA1_SIZE); - PackAddData(p, "new_password_ntlm", new_password_ntlm, MD5_SIZE); - - if (HttpClientSend(sock, p)) - { - PACK *p = HttpClientRecv(sock); - if (p == NULL) - { - ret = ERR_DISCONNECTED; - } - else - { - ret = GetErrorFromPack(p); - } - FreePack(p); - } - else - { - ret = ERR_DISCONNECTED; - } - FreePack(p); - - ReleaseSession(s); - } - - return ret; -} - -// Enumerate HUBs -TOKEN_LIST *EnumHub(SESSION *s) -{ - SOCK *sock; - TOKEN_LIST *ret; - PACK *p; - UINT num; - UINT i; - // Validate arguments - if (s == NULL || s->Connection == NULL) - { - return NULL; - } - - sock = s->Connection->FirstSock; - if (sock == NULL) - { - return NULL; - } - - // Set the Timeout - SetTimeout(sock, 10000); - - p = NewPack(); - PackAddStr(p, "method", "enum_hub"); - - PackAddClientVersion(p, s->Connection); - - if (HttpClientSend(sock, p) == false) - { - FreePack(p); - return NULL; - } - FreePack(p); - - p = HttpClientRecv(sock); - if (p == NULL) - { - return NULL; - } - - num = PackGetInt(p, "NumHub"); - ret = ZeroMalloc(sizeof(TOKEN_LIST)); - ret->NumTokens = num; - ret->Token = ZeroMalloc(sizeof(char *) * num); - for (i = 0;i < num;i++) - { - char tmp[MAX_SIZE]; - if (PackGetStrEx(p, "HubName", tmp, sizeof(tmp), i)) - { - ret->Token[i] = CopyStr(tmp); - } - } - FreePack(p); - - return ret; -} - -// Server accepts a connection from client -bool ServerAccept(CONNECTION *c) -{ - bool ret = false; - UINT err; - PACK *p; - char username_real[MAX_SIZE]; - char method[MAX_SIZE]; - char hubname[MAX_SIZE]; - char username[MAX_SIZE]; - char groupname[MAX_SIZE]; - UCHAR session_key[SHA1_SIZE]; - UCHAR ticket[SHA1_SIZE]; - UINT authtype; - POLICY *policy; - UINT assigned_vlan_id = 0; - UCHAR assigned_ipc_mac_address[6]; - HUB *hub; - SESSION *s = NULL; - UINT64 user_expires = 0; - bool use_encrypt; - bool use_compress; - bool half_connection; - UINT adjust_mss; - bool use_udp_acceleration_client; - UINT client_udp_acceleration_max_version = 1; - UINT udp_acceleration_version = 1; - UINT client_rudp_bulk_max_version = 1; - UINT rudp_bulk_version = 1; - bool support_hmac_on_udp_acceleration_client = false; - bool support_udp_accel_fast_disconnect_detect; - bool use_hmac_on_udp_acceleration = false; - bool supress_return_pack_error = false; - IP udp_acceleration_client_ip; - UCHAR udp_acceleration_client_key[UDP_ACCELERATION_COMMON_KEY_SIZE_V1]; - UCHAR udp_acceleration_client_key_v2[UDP_ACCELERATION_COMMON_KEY_SIZE_V2]; - UINT udp_acceleration_client_port; - bool admin_mode = false; - UINT direction; - UINT max_connection; - UINT timeout; - bool no_reconnect_to_session = false; - bool farm_controller = false; - bool farm_member = false; - bool farm_mode = false; - bool require_bridge_routing_mode; - bool require_monitor_mode; - bool support_bulk_on_rudp = false; - bool support_hmac_on_bulk_of_rudp = false; - bool support_udp_recovery = false; - bool enable_bulk_on_rudp = false; - bool enable_udp_recovery = false; - bool enable_hmac_on_bulk_of_rudp = false; - bool use_client_license = false, use_bridge_license = false; - bool local_host_session = false; - char sessionname[MAX_SESSION_NAME_LEN + 1]; - bool is_server_or_bridge = false; - bool qos = false; - bool cluster_dynamic_secure_nat = false; - bool no_save_password = false; - NODE_INFO node; - wchar_t *msg = NULL; - bool suppress_client_update_notification = false; - USER *loggedin_user_object = NULL; - FARM_MEMBER *f = NULL; - SERVER *server = NULL; - POLICY ticketed_policy; - UCHAR unique[SHA1_SIZE], unique2[SHA1_SIZE]; - CEDAR *cedar; - RPC_WINVER winver; - UINT client_id; - bool no_more_users_in_server = false; - UCHAR mschap_v2_server_response_20[20]; - UINT ms_chap_error = 0; - bool is_empty_password = false; - char *error_detail = NULL; - char *error_detail_2 = NULL; - char ctoken_hash_str[64]; - EAP_CLIENT *release_me_eap_client = NULL; - - // Validate arguments - if (c == NULL) - { - return false; - } - - GenerateMachineUniqueHash(unique2); - - Zero(ctoken_hash_str, sizeof(ctoken_hash_str)); - - Zero(assigned_ipc_mac_address, sizeof(assigned_ipc_mac_address)); - - Zero(mschap_v2_server_response_20, sizeof(mschap_v2_server_response_20)); - - Zero(&udp_acceleration_client_ip, sizeof(udp_acceleration_client_ip)); - udp_acceleration_client_port = 0; - Zero(udp_acceleration_client_key, sizeof(udp_acceleration_client_key)); - Zero(udp_acceleration_client_key_v2, sizeof(udp_acceleration_client_key_v2)); - - Zero(&winver, sizeof(winver)); - - StrCpy(groupname, sizeof(groupname), ""); - StrCpy(sessionname, sizeof(sessionname), ""); - - if (IsZero(c->CToken_Hash, SHA1_SIZE) == false) - { - BinToStr(ctoken_hash_str, sizeof(ctoken_hash_str), c->CToken_Hash, SHA1_SIZE); - } - - cedar = c->Cedar; - - // Get the license status - - no_more_users_in_server = SiTooManyUserObjectsInServer(cedar->Server, true); - - c->Status = CONNECTION_STATUS_NEGOTIATION; - - if (c->Cedar->Server != NULL) - { - SERVER *s = c->Cedar->Server; - server = s; - - if (s->ServerType == SERVER_TYPE_FARM_MEMBER) - { - farm_member = true; - farm_mode = true; - } - - if (s->ServerType == SERVER_TYPE_FARM_CONTROLLER) - { - farm_controller = true; - farm_mode = true; - } - } - - // Receive the signature - Debug("Downloading Signature...\n"); - error_detail_2 = NULL; - if (ServerDownloadSignature(c, &error_detail_2) == false) - { - if (c->Type == CONNECTION_TYPE_ADMIN_RPC) - { - c->Err = ERR_NO_ERROR; - } - - if (error_detail_2 == NULL) - { - error_detail = "ServerDownloadSignature"; - } - else - { - error_detail = error_detail_2; - } - - supress_return_pack_error = true; - - goto CLEANUP; - } - - // Send a Hello packet - Debug("Uploading Hello...\n"); - if (ServerUploadHello(c) == false) - { - error_detail = "ServerUploadHello"; - goto CLEANUP; - } - - // Receive the authentication data - Debug("Auth...\n"); - - p = HttpServerRecv(c->FirstSock); - if (p == NULL) - { - // The connection disconnected - c->Err = ERR_DISCONNECTED; - error_detail = "RecvAuth1"; - goto CLEANUP; - } - - if (err = GetErrorFromPack(p)) - { - // An error has occured - FreePack(p); - c->Err = err; - error_detail = "RecvAuth2"; - goto CLEANUP; - } - - // Get the method - if (GetMethodFromPack(p, method, sizeof(method)) == false) - { - // Protocol error - FreePack(p); - c->Err = ERR_PROTOCOL_ERROR; - error_detail = "GetMethodFromPack"; - goto CLEANUP; - } - - // Brand string for the connection limit - { - char tmp[20]; - char *branded_ctos = _SS("BRANDED_C_TO_S"); - PackGetStr(p, "branded_ctos", tmp, sizeof(tmp)); - - if(StrCmpi(method, "login") == 0 && StrLen(branded_ctos) > 0 && StrCmpi(branded_ctos, tmp) != 0) - { - FreePack(p); - c->Err = ERR_BRANDED_C_TO_S; - goto CLEANUP; - } - } - - // Get the client version - PackGetStr(p, "client_str", c->ClientStr, sizeof(c->ClientStr)); - c->ClientVer = PackGetInt(p, "client_ver"); - c->ClientBuild = PackGetInt(p, "client_build"); - - if (SearchStrEx(c->ClientStr, "server", 0, false) != INFINITE || - SearchStrEx(c->ClientStr, "bridge", 0, false) != INFINITE) - { - is_server_or_bridge = true; - } - - // Get the client Windows version - InRpcWinVer(&winver, p); - - DecrementNoSsl(c->Cedar, &c->FirstSock->RemoteIP, 2); - - if (StrCmpi(method, "login") == 0) - { - bool auth_ret = false; - - Debug("Login...\n"); - c->Status = CONNECTION_STATUS_USERAUTH; - - c->Type = CONNECTION_TYPE_LOGIN; - - if (no_more_users_in_server) - { - // There are many users than are allowed in the VPN Server - FreePack(p); - c->Err = ERR_TOO_MANY_USER; - error_detail = "ERR_TOO_MANY_USER"; - goto CLEANUP; - } - - // Such as the client name - if (PackGetStr(p, "hello", c->ClientStr, sizeof(c->ClientStr)) == false) - { - StrCpy(c->ClientStr, sizeof(c->ClientStr), "Unknown"); - } - c->ServerVer = GetCedarVersionNumber(); - c->ServerBuild = CEDAR_VERSION_BUILD; - - // Get the NODE_INFO - Zero(&node, sizeof(node)); - InRpcNodeInfo(&node, p); - - // Protocol - c->Protocol = GetProtocolFromPack(p); - if (c->Protocol == CONNECTION_UDP) - { - // Release the structure of the TCP connection - if (c->Tcp) - { - ReleaseList(c->Tcp->TcpSockList); - Free(c->Tcp); - } - } - - if (GetServerCapsBool(c->Cedar->Server, "b_vpn_client_connect") == false) - { - // VPN client is unable to connect - FreePack(p); - c->Err = ERR_NOT_SUPPORTED; - goto CLEANUP; - } - - - - // Login - if (GetHubnameAndUsernameFromPack(p, username, sizeof(username), hubname, sizeof(hubname)) == false) - { - // Protocol error - FreePack(p); - c->Err = ERR_PROTOCOL_ERROR; - error_detail = "GetHubnameAndUsernameFromPack"; - goto CLEANUP; - } - - if (farm_member) - { - bool ok = false; - UINT authtype; - - authtype = GetAuthTypeFromPack(p); - if (StrCmpi(username, ADMINISTRATOR_USERNAME) == 0 && - authtype == AUTHTYPE_PASSWORD) - { - ok = true; - } - - if (authtype == AUTHTYPE_TICKET) - { - ok = true; - } - - if (ok == false) - { - // Logging on directly to server farm members by - // non-Administrators are prohibited - FreePack(p); - SLog(c->Cedar, "LS_FARMMEMBER_NOT_ADMIN", c->Name, hubname, ADMINISTRATOR_USERNAME, username); - c->Err = ERR_ACCESS_DENIED; - goto CLEANUP; - } - } - - Debug("Username = %s, HubName = %s\n", username, hubname); - LockHubList(c->Cedar); - { - hub = GetHub(c->Cedar, hubname); - } - UnlockHubList(c->Cedar); - if (hub == NULL) - { - // The HUB does not exist - FreePack(p); - c->Err = ERR_HUB_NOT_FOUND; - SLog(c->Cedar, "LS_HUB_NOT_FOUND", c->Name, hubname); - error_detail = "ERR_HUB_NOT_FOUND"; - goto CLEANUP; - } - - if (hub->ForceDisableComm) - { - // Communication function is disabled - FreePack(p); - c->Err = ERR_SERVER_CANT_ACCEPT; - error_detail = "ERR_COMM_DISABLED"; - ReleaseHub(hub); - goto CLEANUP; - } - - if (GetGlobalServerFlag(GSF_DISABLE_AC) == 0) - { - if (hub->HubDb != NULL && c->FirstSock != NULL) - { - IP ip; - - Copy(&ip, &c->FirstSock->RemoteIP, sizeof(IP)); - - if (IsIpDeniedByAcList(&ip, hub->HubDb->AcList)) - { - char ip_str[64]; - // Access denied - ReleaseHub(hub); - hub = NULL; - FreePack(p); - c->Err = ERR_IP_ADDRESS_DENIED; - IPToStr(ip_str, sizeof(ip_str), &ip); - SLog(c->Cedar, "LS_IP_DENIED", c->Name, ip_str); - goto CLEANUP; - } - } - } - - Lock(hub->lock); - { - UINT cert_size = 0; - void *cert_buf = NULL; - USER *user; - USERGROUP *group; - char plain_password[MAX_PASSWORD_LEN + 1]; - RADIUS_LOGIN_OPTION radius_login_opt; - - if (hub->Halt || hub->Offline) - { - // HUB is off-line - FreePack(p); - Unlock(hub->lock); - ReleaseHub(hub); - c->Err = ERR_HUB_STOPPING; - goto CLEANUP; - } - - Zero(&radius_login_opt, sizeof(radius_login_opt)); - - if (hub->Option != NULL) - { - radius_login_opt.In_CheckVLanId = hub->Option->AssignVLanIdByRadiusAttribute; - radius_login_opt.In_DenyNoVlanId = hub->Option->DenyAllRadiusLoginWithNoVlanAssign; - if (hub->Option->UseHubNameAsRadiusNasId) - { - StrCpy(radius_login_opt.NasId, sizeof(radius_login_opt.NasId), hubname); - } - } - - // Get the various flags - use_encrypt = PackGetInt(p, "use_encrypt") == 0 ? false : true; - use_compress = PackGetInt(p, "use_compress") == 0 ? false : true; - max_connection = PackGetInt(p, "max_connection"); - half_connection = PackGetInt(p, "half_connection") == 0 ? false : true; - qos = PackGetInt(p, "qos") ? true : false; - client_id = PackGetInt(p, "client_id"); - adjust_mss = PackGetInt(p, "adjust_mss"); - use_udp_acceleration_client = PackGetBool(p, "use_udp_acceleration"); - client_udp_acceleration_max_version = PackGetInt(p, "udp_acceleration_max_version"); - if (client_udp_acceleration_max_version == 0) - { - client_udp_acceleration_max_version = 1; - } - client_rudp_bulk_max_version = PackGetInt(p, "rudp_bulk_max_version"); - if (client_rudp_bulk_max_version == 0) - { - client_rudp_bulk_max_version = 1; - } - support_hmac_on_udp_acceleration_client = PackGetBool(p, "support_hmac_on_udp_acceleration"); - support_udp_accel_fast_disconnect_detect = PackGetBool(p, "support_udp_accel_fast_disconnect_detect"); - support_bulk_on_rudp = PackGetBool(p, "support_bulk_on_rudp"); - support_hmac_on_bulk_of_rudp = PackGetBool(p, "support_hmac_on_bulk_of_rudp"); - support_udp_recovery = PackGetBool(p, "support_udp_recovery"); - - if (c->IsInProc) - { - char tmp[MAX_SIZE]; - UINT64 ptr; - - ptr = PackGetInt64(p, "release_me_eap_client"); - if (ptr != 0) - { - release_me_eap_client = (EAP_CLIENT *)ptr; - } - - PackGetStr(p, "inproc_postfix", c->InProcPrefix, sizeof(c->InProcPrefix)); - Zero(tmp, sizeof(tmp)); - PackGetStr(p, "inproc_cryptname", tmp, sizeof(tmp)); - c->InProcLayer = PackGetInt(p, "inproc_layer"); - - if (c->FirstSock != NULL) - { - if (IsEmptyStr(c->InProcPrefix) == false) - { - Format(c->FirstSock->UnderlayProtocol, sizeof(c->FirstSock->UnderlayProtocol), SOCK_UNDERLAY_INPROC_EX, c->InProcPrefix); - AddProtocolDetailsStr(c->FirstSock->UnderlayProtocol, sizeof(c->FirstSock->UnderlayProtocol), c->InProcPrefix); - } - } - - if (c->CipherName != NULL) - { - Free(c->CipherName); - } - - c->CipherName = NULL; - - if (IsEmptyStr(tmp) == false) - { - c->CipherName = CopyStr(tmp); - use_encrypt = true; - } - - use_udp_acceleration_client = false; - - Format(radius_login_opt.In_VpnProtocolState, sizeof(radius_login_opt.In_VpnProtocolState), - "L%u:%s", c->InProcLayer, c->InProcPrefix); - } - else - { - if (c->CipherName != NULL) - { - Free(c->CipherName); - } - c->CipherName = NULL; - - if (c->FirstSock != NULL && IsEmptyStr(c->FirstSock->CipherName) == false) - { - c->CipherName = CopyStr(c->FirstSock->CipherName); - } - - Format(radius_login_opt.In_VpnProtocolState, sizeof(radius_login_opt.In_VpnProtocolState), - "L%u:%s", IPC_LAYER_2, "SEVPN"); - } - - if (support_bulk_on_rudp && c->FirstSock != NULL && c->FirstSock->IsRUDPSocket && - c->FirstSock->BulkRecvKey != NULL && c->FirstSock->BulkSendKey != NULL) - { - // Allow UDP bulk transfer if the client side supports - // in the case of using R-UDP Socket - enable_bulk_on_rudp = true; - - enable_hmac_on_bulk_of_rudp = support_hmac_on_bulk_of_rudp; - } - - if (support_udp_recovery && c->FirstSock != NULL && c->FirstSock->IsRUDPSocket) - { - // Allow UDP recovery - enable_udp_recovery = true; - } - - if (use_udp_acceleration_client) - { - PackGetData2(p, "udp_acceleration_client_key", udp_acceleration_client_key, UDP_ACCELERATION_COMMON_KEY_SIZE_V1); - PackGetData2(p, "udp_acceleration_client_key_v2", udp_acceleration_client_key_v2, UDP_ACCELERATION_COMMON_KEY_SIZE_V2); - - // Get the parameters for the UDP acceleration function - if (PackGetIp(p, "udp_acceleration_client_ip", &udp_acceleration_client_ip) == false) - { - use_udp_acceleration_client = false; - } - else - { - if (IsZeroIp(&udp_acceleration_client_ip)) - { - Copy(&udp_acceleration_client_ip, &c->FirstSock->RemoteIP, sizeof(IP)); - } - udp_acceleration_client_port = PackGetInt(p, "udp_acceleration_client_port"); - if (udp_acceleration_client_port == 0) - { - use_udp_acceleration_client = false; - } - } - - use_hmac_on_udp_acceleration = support_hmac_on_udp_acceleration_client; - } - - Debug("use_udp_acceleration_client = %u\n", use_udp_acceleration_client); - Debug("use_hmac_on_udp_acceleration = %u\n", use_hmac_on_udp_acceleration); - - // Request mode - require_bridge_routing_mode = PackGetBool(p, "require_bridge_routing_mode"); - require_monitor_mode = PackGetBool(p, "require_monitor_mode"); - if (require_monitor_mode) - { - qos = false; - } - - if (is_server_or_bridge) - { - require_bridge_routing_mode = true; - } - - // Client unique ID - Zero(unique, sizeof(unique)); - if (PackGetDataSize(p, "unique_id") == SHA1_SIZE) - { - PackGetData(p, "unique_id", unique); - } - - // Get the authentication method - authtype = GetAuthTypeFromPack(p); - - if (1) - { - // Log - char ip1[64], ip2[64], verstr[64]; - wchar_t *authtype_str = _UU("LH_AUTH_UNKNOWN"); - switch (authtype) - { - case CLIENT_AUTHTYPE_ANONYMOUS: - authtype_str = _UU("LH_AUTH_ANONYMOUS"); - break; - case CLIENT_AUTHTYPE_PASSWORD: - authtype_str = _UU("LH_AUTH_PASSWORD"); - break; - case CLIENT_AUTHTYPE_PLAIN_PASSWORD: - authtype_str = _UU("LH_AUTH_PLAIN_PASSWORD"); - break; - case CLIENT_AUTHTYPE_CERT: - authtype_str = _UU("LH_AUTH_CERT"); - break; - case AUTHTYPE_TICKET: - authtype_str = _UU("LH_AUTH_TICKET"); - break; - case AUTHTYPE_OPENVPN_CERT: - authtype_str = _UU("LH_AUTH_OPENVPN_CERT"); - break; - } - IPToStr(ip1, sizeof(ip1), &c->FirstSock->RemoteIP); - IPToStr(ip2, sizeof(ip2), &c->FirstSock->LocalIP); - - Format(verstr, sizeof(verstr), "%u.%02u", c->ClientVer / 100, c->ClientVer % 100); - - HLog(hub, "LH_CONNECT_CLIENT", c->Name, ip1, c->FirstSock->RemoteHostname, c->FirstSock->RemotePort, - c->ClientStr, verstr, c->ClientBuild, authtype_str, username); - } - - // Attempt an anonymous authentication first - auth_ret = SamAuthUserByAnonymous(hub, username); - - if (auth_ret) - { - if (c->IsInProc) - { - IPC_MSCHAP_V2_AUTHINFO mschap; - char password_tmp[MAX_SIZE]; - - Zero(&mschap, sizeof(mschap)); - - Zero(password_tmp, sizeof(password_tmp)); - PackGetStr(p, "plain_password", password_tmp, sizeof(password_tmp)); - - if (ParseAndExtractMsChapV2InfoFromPassword(&mschap, password_tmp)) - { - // Because the server don't know the NTLM hashed password, the bet to the possibility of - // the same character to the user name and empty, search a password of different - // versions of the upper and lower case characters in the case of anonymous authentication. - // Returns the MS-CHAPv2 response by using the password if there is a match. - // Fail the authentication if no match is found. - // (Because, if return a false MS-CHAPv2 Response, PPP client cause an error) - LIST *o = NewListFast(NULL); - char tmp1[MAX_SIZE]; - char tmp2[MAX_SIZE]; - char tmp3[MAX_SIZE]; - char tmp4[MAX_SIZE]; - char *response_pw; - char psk[MAX_SIZE]; - - ParseNtUsername(mschap.MsChapV2_PPPUsername, tmp1, sizeof(tmp1), tmp2, sizeof(tmp2), false); - ParseNtUsername(mschap.MsChapV2_PPPUsername, tmp3, sizeof(tmp3), tmp4, sizeof(tmp4), true); - - Add(o, ""); - Add(o, "-"); - Add(o, "."); - Add(o, "*"); - Add(o, "?"); - Add(o, " "); - Add(o, "p"); - Add(o, "guest"); - Add(o, "anony"); - Add(o, "anonymous"); - Add(o, "password"); - Add(o, "passwd"); - Add(o, "pass"); - Add(o, "pw"); - Add(o, mschap.MsChapV2_PPPUsername); - Add(o, tmp1); - Add(o, tmp2); - Add(o, tmp3); - Add(o, tmp4); - - Zero(psk, sizeof(psk)); - - if (c->Cedar->Server != NULL) - { - SERVER *s = c->Cedar->Server; - - if (s->IPsecServer != NULL) - { - StrCpy(psk, sizeof(psk), s->IPsecServer->Services.IPsec_Secret); - - Add(o, psk); - } - } - - response_pw = MsChapV2DoBruteForce(&mschap, o); - - ReleaseList(o); - - if (response_pw != NULL) - { - UCHAR challenge8[8]; - UCHAR nt_hash[16]; - UCHAR nt_hash_hash[16]; - - GenerateNtPasswordHash(nt_hash, response_pw); - GenerateNtPasswordHashHash(nt_hash_hash, nt_hash); - MsChapV2_GenerateChallenge8(challenge8, mschap.MsChapV2_ClientChallenge, mschap.MsChapV2_ServerChallenge, - mschap.MsChapV2_PPPUsername); - MsChapV2Server_GenerateResponse(mschap_v2_server_response_20, nt_hash_hash, - mschap.MsChapV2_ClientResponse, challenge8); - - Free(response_pw); - } - else - { - auth_ret = false; - } - } - } - - if (auth_ret) - { - // User authentication success by anonymous authentication - HLog(hub, "LH_AUTH_OK", c->Name, username); - is_empty_password = true; - } - } - - if (auth_ret == false) - { - // Attempt other authentication methods if anonymous authentication fails - switch (authtype) - { - case CLIENT_AUTHTYPE_ANONYMOUS: - // Anonymous authentication (this have been already attempted) - break; - - case AUTHTYPE_TICKET: - // Ticket authentication - if (PackGetDataSize(p, "ticket") == SHA1_SIZE) - { - PackGetData(p, "ticket", ticket); - - auth_ret = SiCheckTicket(hub, ticket, username, sizeof(username), username_real, sizeof(username_real), - &ticketed_policy, sessionname, sizeof(sessionname), groupname, sizeof(groupname)); - } - break; - - case CLIENT_AUTHTYPE_PASSWORD: - // Password authentication - if (PackGetDataSize(p, "secure_password") == SHA1_SIZE) - { - POLICY *pol = NULL; - UCHAR secure_password[SHA1_SIZE]; - Zero(secure_password, sizeof(secure_password)); - if (PackGetDataSize(p, "secure_password") == SHA1_SIZE) - { - PackGetData(p, "secure_password", secure_password); - } - auth_ret = SamAuthUserByPassword(hub, username, c->Random, secure_password, NULL, NULL, NULL); - - pol = SamGetUserPolicy(hub, username); - if (pol != NULL) - { - no_save_password = pol->NoSavePassword; - Free(pol); - } - - if(auth_ret){ - // Check whether the password was empty - UCHAR hashed_empty_password[SHA1_SIZE]; - UCHAR secure_empty_password[SHA1_SIZE]; - HashPassword(hashed_empty_password, username, ""); - SecurePassword(secure_empty_password, hashed_empty_password, c->Random); - if(Cmp(secure_password, secure_empty_password, SHA1_SIZE)==0){ - is_empty_password = true; - } - } - } - break; - - case CLIENT_AUTHTYPE_PLAIN_PASSWORD: - { - POLICY *pol = NULL; - - // Plaintext password authentication - Zero(plain_password, sizeof(plain_password)); - PackGetStr(p, "plain_password", plain_password, sizeof(plain_password)); - if (c->IsInProc == false && StartWith(plain_password, IPC_PASSWORD_MSCHAPV2_TAG)) - { - // Do not allow the MS-CHAPv2 authentication other than IPC sessions - Zero(plain_password, sizeof(plain_password)); - } - - if (auth_ret == false) - { - // Attempt a password authentication of normal user - UCHAR secure_password[SHA1_SIZE]; - UCHAR hash_password[SHA1_SIZE]; - bool is_mschap = StartWith(plain_password, IPC_PASSWORD_MSCHAPV2_TAG); - - HashPassword(hash_password, username, plain_password); - SecurePassword(secure_password, hash_password, c->Random); - - if (is_mschap == false) - { - auth_ret = SamAuthUserByPassword(hub, username, c->Random, secure_password, NULL, NULL, NULL); - } - else - { - auth_ret = SamAuthUserByPassword(hub, username, c->Random, secure_password, - plain_password, mschap_v2_server_response_20, &ms_chap_error); - } - - if (auth_ret && pol == NULL) - { - pol = SamGetUserPolicy(hub, username); - } - } - - if (auth_ret == false) - { - // Attempt external authentication registered users - bool fail_ext_user_auth = false; - if (GetGlobalServerFlag(GSF_DISABLE_RADIUS_AUTH) != 0) - { - fail_ext_user_auth = true; - } - - if (fail_ext_user_auth == false) - { - auth_ret = SamAuthUserByPlainPassword(c, hub, username, plain_password, false, mschap_v2_server_response_20, &radius_login_opt); - } - - if (auth_ret && pol == NULL) - { - pol = SamGetUserPolicy(hub, username); - } - } - - if (auth_ret == false) - { - // Attempt external authentication asterisk user - bool b = false; - bool fail_ext_user_auth = false; - - if (GetGlobalServerFlag(GSF_DISABLE_RADIUS_AUTH) != 0) - { - fail_ext_user_auth = true; - } - - if (fail_ext_user_auth == false) - { - AcLock(hub); - { - b = AcIsUser(hub, "*"); - } - AcUnlock(hub); - - // If there is asterisk user, log on as the user - if (b) - { - auth_ret = SamAuthUserByPlainPassword(c, hub, username, plain_password, true, mschap_v2_server_response_20, &radius_login_opt); - if (auth_ret && pol == NULL) - { - pol = SamGetUserPolicy(hub, "*"); - } - } - } - } - - if (pol != NULL) - { - no_save_password = pol->NoSavePassword; - Free(pol); - } - - if(auth_ret){ - // Check whether the password was empty - if(IsEmptyStr(plain_password)){ - is_empty_password = true; - } - } - } - break; - - case CLIENT_AUTHTYPE_CERT: - if (GetGlobalServerFlag(GSF_DISABLE_CERT_AUTH) == 0) - { - // Certificate authentication - cert_size = PackGetDataSize(p, "cert"); - if (cert_size >= 1 && cert_size <= 100000) - { - cert_buf = ZeroMalloc(cert_size); - if (PackGetData(p, "cert", cert_buf)) - { - UCHAR sign[4096 / 8]; - UINT sign_size = PackGetDataSize(p, "sign"); - if (sign_size <= sizeof(sign) && sign_size >= 1) - { - if (PackGetData(p, "sign", sign)) - { - BUF *b = NewBuf(); - X *x; - WriteBuf(b, cert_buf, cert_size); - x = BufToX(b, false); - if (x != NULL && x->is_compatible_bit && - sign_size == (x->bits / 8)) - { - K *k = GetKFromX(x); - // Verify the signature received from the client - if (RsaVerifyEx(c->Random, SHA1_SIZE, sign, k, x->bits)) - { - // Confirmed that the client has had this certificate - // certainly because the signature matched. - // Check whether the certificate is valid. - auth_ret = SamAuthUserByCert(hub, username, x); - if (auth_ret) - { - // Copy the certificate - c->ClientX = CloneX(x); - } - } - else - { - // Authentication failure - } - FreeK(k); - } - FreeX(x); - FreeBuf(b); - } - } - } - Free(cert_buf); - } - } - else - { - // Certificate authentication is not supported in the open source version - HLog(hub, "LH_AUTH_CERT_NOT_SUPPORT_ON_OPEN_SOURCE", c->Name, username); - Unlock(hub->lock); - ReleaseHub(hub); - FreePack(p); - c->Err = ERR_AUTHTYPE_NOT_SUPPORTED; - goto CLEANUP; - } - break; - - case AUTHTYPE_OPENVPN_CERT: - // For OpenVPN; mostly same as CLIENT_AUTHTYPE_CERT, but without - // signature verification, because it was already performed during TLS handshake. - if (c->IsInProc) - { - // Certificate authentication - cert_size = PackGetDataSize(p, "cert"); - if (cert_size >= 1 && cert_size <= 100000) - { - cert_buf = ZeroMalloc(cert_size); - if (PackGetData(p, "cert", cert_buf)) - { - BUF *b = NewBuf(); - X *x; - WriteBuf(b, cert_buf, cert_size); - x = BufToX(b, false); - if (x != NULL && x->is_compatible_bit) - { - Debug("Got to SamAuthUserByCert %s\n", username); // XXX - // Check whether the certificate is valid. - auth_ret = SamAuthUserByCert(hub, username, x); - if (auth_ret) - { - // Copy the certificate - c->ClientX = CloneX(x); - } - } - FreeX(x); - FreeBuf(b); - } - Free(cert_buf); - } - } - else - { - // OpenVPN certificate authentication cannot be used directly by external clients - Unlock(hub->lock); - ReleaseHub(hub); - FreePack(p); - c->Err = ERR_AUTHTYPE_NOT_SUPPORTED; - goto CLEANUP; - } - break; - - default: - // Unknown authentication method - Unlock(hub->lock); - ReleaseHub(hub); - FreePack(p); - c->Err = ERR_AUTHTYPE_NOT_SUPPORTED; - error_detail = "ERR_AUTHTYPE_NOT_SUPPORTED"; - goto CLEANUP; - } - - if (auth_ret == false) - { - // Get client IP to feed tools such as Fail2Ban - char ip[64]; - IPToStr(ip, sizeof(ip), &c->FirstSock->RemoteIP); - // Authentication failure - HLog(hub, "LH_AUTH_NG", c->Name, username, ip); - } - else - { - // Authentication success - HLog(hub, "LH_AUTH_OK", c->Name, username); - } - } - - if (auth_ret == false) - { - // Authentication failure - Unlock(hub->lock); - ReleaseHub(hub); - FreePack(p); - c->Err = ERR_AUTH_FAILED; - if (ms_chap_error != 0) - { - c->Err = ms_chap_error; - } - error_detail = "ERR_AUTH_FAILED"; - goto CLEANUP; - } - else - { - if(is_empty_password) - { - SOCK *s = c->FirstSock; - if (s != NULL && s->RemoteIP.addr[0] != 127) - { - if(StrCmpi(username, ADMINISTRATOR_USERNAME) == 0 || - GetHubAdminOption(hub, "deny_empty_password") != 0) - { - // When the password is empty, remote connection is not acceptable - HLog(hub, "LH_LOCAL_ONLY", c->Name, username); - - Unlock(hub->lock); - ReleaseHub(hub); - FreePack(p); - c->Err = ERR_NULL_PASSWORD_LOCAL_ONLY; - error_detail = "ERR_NULL_PASSWORD_LOCAL_ONLY"; - goto CLEANUP; - } - } - } - } - - policy = NULL; - - // Authentication success - FreePack(p); - - // Check the assigned VLAN ID - if (radius_login_opt.Out_IsRadiusLogin) - { - if (radius_login_opt.In_CheckVLanId) - { - if (radius_login_opt.Out_VLanId != 0) - { - assigned_vlan_id = radius_login_opt.Out_VLanId; - } - - if (radius_login_opt.In_DenyNoVlanId && assigned_vlan_id == 0 || assigned_vlan_id >= 4096) - { - // Deny this session - Unlock(hub->lock); - ReleaseHub(hub); - c->Err = ERR_ACCESS_DENIED; - error_detail = "In_DenyNoVlanId"; - goto CLEANUP; - } - } - } - - // Check the assigned MAC Address - if (radius_login_opt.Out_IsRadiusLogin) - { - Copy(assigned_ipc_mac_address, radius_login_opt.Out_VirtualMacAddress, 6); - } - - if (StrCmpi(username, ADMINISTRATOR_USERNAME) != 0) - { - // Get the policy - if (farm_member == false) - { - bool is_asterisk_user = false; - - // In the case of not a farm member - user = AcGetUser(hub, username); - if (user == NULL) - { - user = AcGetUser(hub, "*"); - if (user == NULL) - { - // User acquisition failure - Unlock(hub->lock); - ReleaseHub(hub); - c->Err = ERR_ACCESS_DENIED; - error_detail = "AcGetUser"; - goto CLEANUP; - } - - is_asterisk_user = true; - } - - policy = NULL; - - Lock(user->lock); - { - if (is_asterisk_user == false) - { - UCHAR associated_mac_address[6]; - - // Get the associated virtual MAC address - if (GetUserMacAddressFromUserNote(associated_mac_address, user->Note)) - { - if (IsZero(assigned_ipc_mac_address, 6)) - { - WHERE; - Copy(assigned_ipc_mac_address, associated_mac_address, 6); - } - } - } - - // Get the expiration date - user_expires = user->ExpireTime; - - StrCpy(username_real, sizeof(username_real), user->Name); - group = user->Group; - if (group != NULL) - { - AddRef(group->ref); - - Lock(group->lock); - { - // Get the group name - StrCpy(groupname, sizeof(groupname), group->Name); - } - Unlock(group->lock); - } - - if (user->Policy != NULL) - { - policy = ClonePolicy(user->Policy); - } - else - { - if (group) - { - Lock(group->lock); - { - if (group->Policy != NULL) - { - policy = ClonePolicy(group->Policy); - } - } - Unlock(group->lock); - } - } - - if (group != NULL) - { - ReleaseGroup(group); - } - } - Unlock(user->lock); - loggedin_user_object = user; - } - else - { - // In the case of farm member - policy = ClonePolicy(&ticketed_policy); - } - } - else - { - // Administrator mode - admin_mode = true; - StrCpy(username_real, sizeof(username_real), ADMINISTRATOR_USERNAME); - - policy = ClonePolicy(GetDefaultPolicy()); - policy->NoBroadcastLimiter = true; - policy->MonitorPort = true; - } - - if (policy == NULL) - { - // Use the default policy - policy = ClonePolicy(GetDefaultPolicy()); - } - - if (policy->MaxConnection == 0) - { - policy->MaxConnection = MAX_TCP_CONNECTION; - } - - if (policy->TimeOut == 0) - { - policy->TimeOut = 20; - } - - if (qos) - { - // VoIP / QoS - if (policy->NoQoS) - { - // Policy does not allow QoS - qos = false; - } - if (GetServerCapsBool(c->Cedar->Server, "b_support_qos") == false) - { - // Server does not support QoS - qos = false; - policy->NoQoS = true; - } - if (GetHubAdminOption(hub, "deny_qos") != 0) - { - // It is prohibited in the management options - qos = false; - policy->NoQoS = true; - } - } - - if (GetHubAdminOption(hub, "max_bitrates_download") != 0) - { - if (policy->MaxDownload == 0) - { - policy->MaxDownload = GetHubAdminOption(hub, "max_bitrates_download"); - } - else - { - UINT r = GetHubAdminOption(hub, "max_bitrates_download"); - policy->MaxDownload = MIN(policy->MaxDownload, r); - } - } - - if (GetHubAdminOption(hub, "max_bitrates_upload") != 0) - { - if (policy->MaxUpload == 0) - { - policy->MaxUpload = GetHubAdminOption(hub, "max_bitrates_upload"); - } - else - { - UINT r = GetHubAdminOption(hub, "max_bitrates_upload"); - policy->MaxUpload = MIN(policy->MaxUpload, r); - } - } - - if (GetHubAdminOption(hub, "deny_bridge") != 0) - { - policy->NoBridge = true; - } - - if (GetHubAdminOption(hub, "deny_routing") != 0) - { - policy->NoRouting = true; - } - - if (c->IsInProc) - { - policy->NoBridge = false; - policy->NoRouting = false; - } - - if (hub->Option->ClientMinimumRequiredBuild > c->ClientBuild && - InStrEx(c->ClientStr, "client", false)) - { - // Build number of the client is too small - HLog(hub, "LH_CLIENT_VERSION_OLD", c->Name, c->ClientBuild, hub->Option->ClientMinimumRequiredBuild); - - Unlock(hub->lock); - ReleaseHub(hub); - c->Err = ERR_VERSION_INVALID; - Free(policy); - error_detail = "ERR_VERSION_INVALID"; - goto CLEANUP; - } - - if (hub->Option->RequiredClientId != 0 && - hub->Option->RequiredClientId != client_id && - InStrEx(c->ClientStr, "client", false)) - { - // Build number of the client is too small - HLog(hub, "LH_CLIENT_ID_REQUIRED", c->Name, client_id, hub->Option->RequiredClientId); - - Unlock(hub->lock); - ReleaseHub(hub); - c->Err = ERR_CLIENT_ID_REQUIRED; - error_detail = "ERR_CLIENT_ID_REQUIRED"; - Free(policy); - goto CLEANUP; - } - - if ((policy->NoSavePassword) || (policy->AutoDisconnect != 0)) - { - if (c->ClientBuild < 6560 && InStrEx(c->ClientStr, "client", false)) - { - // If NoSavePassword policy is specified, - // only supported client can connect - HLog(hub, "LH_CLIENT_VERSION_OLD", c->Name, c->ClientBuild, 6560); - - Unlock(hub->lock); - ReleaseHub(hub); - c->Err = ERR_VERSION_INVALID; - error_detail = "ERR_VERSION_INVALID"; - Free(policy); - goto CLEANUP; - } - } - - if (user_expires != 0 && user_expires <= SystemTime64()) - { - // User expired - HLog(hub, "LH_USER_EXPIRES", c->Name, username); - - Unlock(hub->lock); - ReleaseHub(hub); - c->Err = ERR_ACCESS_DENIED; - error_detail = "LH_USER_EXPIRES"; - Free(policy); - goto CLEANUP; - } - - if (policy->Access == false) - { - // Access is denied - HLog(hub, "LH_POLICY_ACCESS_NG", c->Name, username); - - Unlock(hub->lock); - ReleaseHub(hub); - error_detail = "LH_POLICY_ACCESS_NG"; - c->Err = ERR_ACCESS_DENIED; - Free(policy); - goto CLEANUP; - } - - // Determine the contents of the policy by comparing to - // option presented by client or deny the connection. - // Confirm the connectivity in the monitor-mode first - if (require_monitor_mode && policy->MonitorPort == false) - { - // Can not connect in the monitor port mode - HLog(hub, "LH_POLICY_MONITOR_MODE", c->Name); - - Unlock(hub->lock); - ReleaseHub(hub); - c->Err = ERR_MONITOR_MODE_DENIED; - Free(policy); - error_detail = "ERR_MONITOR_MODE_DENIED"; - goto CLEANUP; - } - - if (policy->MonitorPort) - { - if (require_monitor_mode == false) - { - policy->MonitorPort = false; - } - } - - if (policy->MonitorPort) - { - qos = false; - } - - // Determine whether it can be connected by a bridge / routing mode next - if (require_bridge_routing_mode && - (policy->NoBridge && policy->NoRouting)) - { - // Can not be connected by a bridge / routing mode - HLog(hub, "LH_POLICY_BRIDGE_MODE", c->Name); - - Unlock(hub->lock); - ReleaseHub(hub); - c->Err = ERR_BRIDGE_MODE_DENIED; - error_detail = "ERR_BRIDGE_MODE_DENIED"; - Free(policy); - goto CLEANUP; - } - - if (require_bridge_routing_mode == false) - { - policy->NoBridge = true; - policy->NoRouting = true; - } - - if (Cmp(unique, unique2, SHA1_SIZE) == 0) - { - // It's a localhost session - local_host_session = true; - } - - if (local_host_session == false) - { - // Make further judgment whether localhost session - SOCK *s = c->FirstSock; - - if (s != NULL) - { - if (IsIPMyHost(&s->RemoteIP)) - { - // It's a localhost session - local_host_session = true; - } - } - } - - if (local_host_session) - { - // Permit routing or bridging in the case of localhost session - policy->NoBridge = false; - policy->NoRouting = false; - } - - if (local_host_session == false) - { - - if (policy->NoBridge == false || policy->NoRouting == false) - { - use_bridge_license = true; - } - else - { - use_client_license = true; - } - } - - - if (server != NULL && server->ServerType != SERVER_TYPE_FARM_MEMBER && - policy != NULL) - { - if (GetServerCapsBool(hub->Cedar->Server, "b_support_limit_multilogin")) - { - // Check if the number of concurrent multiple logins limit is specified in the policy - RPC_ENUM_SESSION t; - UINT i, num; - UINT max_logins = policy->MultiLogins; - UINT ao = GetHubAdminOption(hub, "max_multilogins_per_user"); - - if (ao != 0) - { - if (max_logins != 0) - { - max_logins = MIN(max_logins, ao); - } - else - { - max_logins = ao; - } - } - - if (max_logins != 0) - { - Zero(&t, sizeof(t)); - StrCpy(t.HubName, sizeof(t.HubName), hub->Name); - - Unlock(hub->lock); - - SiEnumSessionMain(server, &t); - - Lock(hub->lock); - - num = 0; - - for (i = 0;i < t.NumSession;i++) - { - RPC_ENUM_SESSION_ITEM *e = &t.Sessions[i]; - - if (e->BridgeMode == false && e->Layer3Mode == false && e->LinkMode == false && e->CurrentNumTcp != 0) - { - if (StrCmpi(e->Username, username) == 0 && - (IsZero(e->UniqueId, 16) || Cmp(e->UniqueId, node.UniqueId, 16) != 0)) - { - num++; - } - } - } - - FreeRpcEnumSession(&t); - - if (num >= max_logins) - { - // Can not connect any more - Unlock(hub->lock); - - // Dump a detailed error log - HLog(hub, "LH_TOO_MANY_MULTILOGINS", - c->Name, - username, max_logins, num); - - ReleaseHub(hub); - c->Err = ERR_TOO_MANY_USER_SESSION; - Free(policy); - goto CLEANUP; - } - } - } - } - - if (loggedin_user_object != NULL) - { - // Update the user information - Lock(loggedin_user_object->lock); - { - loggedin_user_object->LastLoginTime = SystemTime64(); - } - Unlock(loggedin_user_object->lock); - } - - // Update the number of log-ins - hub->LastCommTime = hub->LastLoginTime = SystemTime64(); - - if (farm_controller) - { - wchar_t *msg = GetHubMsg(hub); - - Unlock(hub->lock); - - Lock(cedar->CedarSuperLock); - - // In the case of farm controller, choose a farm members to host this HUB - LockList(server->FarmMemberList); - { - HLog(hub, "LH_FARM_SELECT_1", c->Name); - f = SiGetHubHostingMember(server, hub, admin_mode, c); - - if (f == NULL) - { - // Failed in the selection - HLog(hub, "LH_FARM_SELECT_2", c->Name); - UnlockList(server->FarmMemberList); - Unlock(cedar->CedarSuperLock); - ReleaseHub(hub); - c->Err = ERR_COULD_NOT_HOST_HUB_ON_FARM; - Free(policy); - Free(msg); - goto CLEANUP; - } - else - { - if (f->Me == false) - { - UCHAR ticket[SHA1_SIZE]; - PACK *p; - BUF *b; - UINT i; - - SLog(c->Cedar, "LH_FARM_SELECT_4", c->Name, f->hostname); - - // Create a session on the selected server farm member - Rand(ticket, sizeof(ticket)); - SiCallCreateTicket(server, f, hub->Name, - username, username_real, policy, ticket, Inc(hub->SessionCounter), groupname); - - p = NewPack(); - PackAddInt(p, "Redirect", 1); - PackAddIp32(p, "Ip", f->Ip); - for (i = 0;i < f->NumPort;i++) - { - PackAddIntEx(p, "Port", f->Ports[i], i, f->NumPort); - } - PackAddData(p, "Ticket", ticket, sizeof(ticket)); - - if (true) - { - char *utf = CopyUniToUtf(msg); - - PackAddData(p, "Msg", utf, StrLen(utf)); - - Free(utf); - } - - b = XToBuf(f->ServerCert, false); - PackAddBuf(p, "Cert", b); - FreeBuf(b); - - UnlockList(server->FarmMemberList); - Unlock(cedar->CedarSuperLock); - ReleaseHub(hub); - - HttpServerSend(c->FirstSock, p); - FreePack(p); - - c->Err = 0; - Free(policy); - - FreePack(HttpServerRecv(c->FirstSock)); - Free(msg); - goto CLEANUP; - } - else - { - HLog(hub, "LH_FARM_SELECT_3", c->Name); - // Continue the process because myself was selected - UnlockList(server->FarmMemberList); - Unlock(cedar->CedarSuperLock); - f->Point = SiGetPoint(server); - Lock(hub->lock); - Free(msg); - } - } - } - } - - if (admin_mode == false) - { - // Check the maximum number of connections of the HUB - if (hub->Option->MaxSession != 0 && - hub->Option->MaxSession <= Count(hub->NumSessions)) - { - // Can not connect any more - Unlock(hub->lock); - - HLog(hub, "LH_MAX_SESSION", c->Name, hub->Option->MaxSession); - - ReleaseHub(hub); - c->Err = ERR_HUB_IS_BUSY; - Free(policy); - error_detail = "ERR_HUB_IS_BUSY"; - goto CLEANUP; - } - } - - if (use_encrypt == false && c->FirstSock->IsReverseAcceptedSocket) - { - // On VPN Azure, SSL encryption is mandated. - use_encrypt = true; - } - - if (use_client_license || use_bridge_license) - { - // Examine whether not to conflict with the limit of simultaneous connections - // number of sessions defined by the Virtual HUB management options - if ( - (GetHubAdminOption(hub, "max_sessions") != 0 && - (Count(hub->NumSessionsClient) + Count(hub->NumSessionsBridge)) >= GetHubAdminOption(hub, "max_sessions")) - || - (hub->Option->MaxSession != 0 && - (Count(hub->NumSessionsClient) + Count(hub->NumSessionsBridge)) >= hub->Option->MaxSession)) - { - // Can not connect any more - Unlock(hub->lock); - - HLog(hub, "LH_MAX_SESSION", c->Name, GetHubAdminOption(hub, "max_sessions")); - - ReleaseHub(hub); - c->Err = ERR_HUB_IS_BUSY; - Free(policy); - goto CLEANUP; - } - } - - if (use_client_license) - { - // Examine whether not to conflict with the limit of simultaneous connections - // number of sessions(client) defined by the Virtual HUB management options - if (((GetHubAdminOption(hub, "max_sessions_client_bridge_apply") != 0 - ) && - Count(hub->NumSessionsClient) >= GetHubAdminOption(hub, "max_sessions_client") && hub->Cedar->Server != NULL && hub->Cedar->Server->ServerType != SERVER_TYPE_FARM_MEMBER) - || - (hub->FarmMember_MaxSessionClientBridgeApply && - Count(hub->NumSessionsClient) >= hub->FarmMember_MaxSessionClient)) - { - // Can not connect any more - Unlock(hub->lock); - - HLog(hub, "LH_MAX_SESSION_CLIENT", c->Name, GetHubAdminOption(hub, "max_sessions_client")); - - ReleaseHub(hub); - c->Err = ERR_HUB_IS_BUSY; - Free(policy); - goto CLEANUP; - } - } - - if (use_bridge_license) - { - // Examine whether not to conflict with the limit of simultaneous connections - // number of sessions(bridge) defined by the Virtual HUB management options - if (((GetHubAdminOption(hub, "max_sessions_client_bridge_apply") != 0 - ) && - Count(hub->NumSessionsBridge) >= GetHubAdminOption(hub, "max_sessions_bridge") && hub->Cedar->Server != NULL && hub->Cedar->Server->ServerType != SERVER_TYPE_FARM_MEMBER) - || - (hub->FarmMember_MaxSessionClientBridgeApply && - Count(hub->NumSessionsBridge) >= hub->FarmMember_MaxSessionBridge)) - { - // Can not connect any more - Unlock(hub->lock); - - HLog(hub, "LH_MAX_SESSION_BRIDGE", c->Name, GetHubAdminOption(hub, "max_sessions_bridge")); - - ReleaseHub(hub); - c->Err = ERR_HUB_IS_BUSY; - Free(policy); - goto CLEANUP; - } - } - - if (Count(hub->Cedar->CurrentSessions) >= GetServerCapsInt(hub->Cedar->Server, "i_max_sessions")) - { - // Can not connect any more - Unlock(hub->lock); - - HLog(hub, "LH_MAX_SESSION_2", c->Name, GetServerCapsInt(hub->Cedar->Server, "i_max_sessions")); - - ReleaseHub(hub); - c->Err = ERR_HUB_IS_BUSY; - Free(policy); - goto CLEANUP; - } - - // Increment the current number of connections - Inc(hub->NumSessions); - if (use_bridge_license) - { - Inc(hub->NumSessionsBridge); - } - - if (use_client_license) - { - Inc(hub->NumSessionsClient); - } - Inc(hub->Cedar->CurrentSessions); - - // Calculate the time-out period - timeout = policy->TimeOut * 1000; // Convert milliseconds to seconds - if (timeout == 0) - { - timeout = TIMEOUT_DEFAULT; - } - timeout = MIN(timeout, TIMEOUT_MAX); - timeout = MAX(timeout, TIMEOUT_MIN); - - // Update the max_connection according to the policy - max_connection = MIN(max_connection, policy->MaxConnection); - max_connection = MIN(max_connection, MAX_TCP_CONNECTION); - max_connection = MAX(max_connection, 1); - - if (c->FirstSock->IsRUDPSocket) - { - // In the case of TCP-over-UDP - half_connection = false; - - // Disable the QoS - qos = false; - - if (enable_udp_recovery == false) - { - // Disable the session reconnection feature - no_reconnect_to_session = true; - max_connection = 1; - } - else - { - // If the UDP recovery is enabled, permit the session re-connection feature (for 2) - no_reconnect_to_session = false; - max_connection = NUM_TCP_CONNECTION_FOR_UDP_RECOVERY; - } - } - - if (half_connection) - { - // Number of connections should be more than 2 in the case of Half Connection - max_connection = MAX(max_connection, 2); - } - - if (qos) - { - // Number of connections is set to 2 or more when using the VoIP / QoS - max_connection = MAX(max_connection, 2); - if (half_connection) - { - max_connection = MAX(max_connection, 4); - } - } - - c->Status = CONNECTION_STATUS_ESTABLISHED; - - // Remove the connection from Cedar - DelConnection(c->Cedar, c); - - // VLAN ID - if (assigned_vlan_id != 0) - { - if (policy->VLanId == 0) - { - policy->VLanId = assigned_vlan_id; - } - } - - // Create a Session - StrLower(username); - s = NewServerSessionEx(c->Cedar, c, hub, username, policy, c->IsInProc, - (c->IsInProc && IsZero(assigned_ipc_mac_address, 6) == false) ? assigned_ipc_mac_address : NULL); - - s->EnableUdpRecovery = enable_udp_recovery; - s->LocalHostSession = local_host_session; - s->NormalClient = true; - - IPToStr(s->ClientIP, sizeof(s->ClientIP), &c->ClientIp); - - if (c->FirstSock->IsRUDPSocket) - { - // R-UDP session - s->IsRUDPSession = true; - s->RUdpMss = c->FirstSock->RUDP_OptimizedMss; - Debug("ServerAccept(): Optimized MSS Value for R-UDP: %u\n", s->RUdpMss); - AddProtocolDetailsKeyValueInt(s->ProtocolDetails, sizeof(s->ProtocolDetails), "RUDP_MSS", s->RUdpMss); - } - - if (enable_bulk_on_rudp) - { - // Allow bulk transfer on R-UDP - s->EnableBulkOnRUDP = true; - s->EnableHMacOnBulkOfRUDP = enable_hmac_on_bulk_of_rudp; - } - - s->IsAzureSession = c->FirstSock->IsReverseAcceptedSocket; - - StrCpy(s->UnderlayProtocol, sizeof(s->UnderlayProtocol), c->FirstSock->UnderlayProtocol); - - AddProtocolDetailsStr(s->ProtocolDetails, sizeof(s->ProtocolDetails), c->FirstSock->ProtocolDetails); - - if (server != NULL) - { - s->NoSendSignature = server->NoSendSignature; - } - - if (c->IsInProc) - { - s->NoSendSignature = true; - } - - if (c->IsInProc && StrCmpi(c->InProcPrefix, OPENVPN_IPC_POSTFIX_L3) == 0) - { - // OpenVPN L3 session - s->IsOpenVPNL3Session = true; - } - - if (c->IsInProc && StrCmpi(c->InProcPrefix, OPENVPN_IPC_POSTFIX_L2) == 0) - { - // OpenVPN L2 session - s->IsOpenVPNL2Session = true; - } - - // Determine whether the use of UDP acceleration mode - if (use_udp_acceleration_client) - { - s->UseUdpAcceleration = true; - - s->UdpAccelFastDisconnectDetect = support_udp_accel_fast_disconnect_detect; - - udp_acceleration_version = 1; - if (client_udp_acceleration_max_version >= 2) - { - udp_acceleration_version = 2; - } - } - - if (client_rudp_bulk_max_version >= 2) - { - rudp_bulk_version = 2; - } - - if (s->EnableBulkOnRUDP) - { - AddProtocolDetailsKeyValueInt(s->ProtocolDetails, sizeof(s->ProtocolDetails), "RUDP_Bulk_Ver", s->BulkOnRUDPVersion); - } - - if (hub->Option != NULL && hub->Option->DisableUdpAcceleration) - { - s->UseUdpAcceleration = false; - } - - if (IsZeroIP(&c->FirstSock->Reverse_MyServerGlobalIp) == false && - CmpIpAddr(&c->FirstSock->Reverse_MyServerGlobalIp, &c->FirstSock->RemoteIP) == 0) - { - // Disable forcibly the UDP acceleration mode if VPN Server and VPN Client - // are in same LAN in the case of using VPN Azure. - // (Or this may cause infinite loop of packet) - s->UseUdpAcceleration = false; - } - - if (s->UseUdpAcceleration) - { - s->UseHMacOnUdpAcceleration = use_hmac_on_udp_acceleration; - } - - Debug("UseUdpAcceleration = %u\n", s->UseUdpAcceleration); - Debug("UseHMacOnUdpAcceleration = %u\n", s->UseHMacOnUdpAcceleration); - Debug("UdpAccelerationVersion = %u\n", s->UdpAccelerationVersion); - - if (s->UseUdpAcceleration) - { - bool no_nat_t = false; - - - // Initialize the UDP acceleration function - s->UdpAccel = NewUdpAccel(c->Cedar, (c->FirstSock->IsRUDPSocket ? NULL : &c->FirstSock->LocalIP), false, c->FirstSock->IsRUDPSocket, no_nat_t); - if (s->UdpAccel == NULL) - { - s->UseUdpAcceleration = false; - Debug("NewUdpAccel Failed.\n"); - } - else - { - s->UdpAccel->Version = udp_acceleration_version; - - if (UdpAccelInitServer(s->UdpAccel, - s->UdpAccel->Version == 2 ? udp_acceleration_client_key_v2 : udp_acceleration_client_key, - &udp_acceleration_client_ip, udp_acceleration_client_port, &c->FirstSock->RemoteIP) == false) - { - Debug("UdpAccelInitServer Failed.\n"); - s->UseUdpAcceleration = false; - } - - s->UdpAccel->FastDetect = s->UdpAccelFastDisconnectDetect; - - if (use_encrypt == false) - { - s->UdpAccel->PlainTextMode = true; - } - - s->UdpAccel->UseHMac = s->UseHMacOnUdpAcceleration; - - AddProtocolDetailsKeyValueInt(s->ProtocolDetails, sizeof(s->ProtocolDetails), "UDPAccel_Ver", s->UdpAccel->Version); - - AddProtocolDetailsStr(s->ProtocolDetails, sizeof(s->ProtocolDetails), s->UdpAccel->Version > 1 ? "ChaCha20-Poly1305" : "RC4"); - - AddProtocolDetailsKeyValueInt(s->ProtocolDetails, sizeof(s->ProtocolDetails), "UDPAccel_MSS", UdpAccelCalcMss(s->UdpAccel)); - } - } - - s->UseClientLicense = use_client_license; - s->UseBridgeLicense = use_bridge_license; - - s->AdjustMss = adjust_mss; - if (s->AdjustMss != 0) - { - Debug("AdjustMSS: %u\n", s->AdjustMss); - AddProtocolDetailsKeyValueInt(s->ProtocolDetails, sizeof(s->ProtocolDetails), "AdjustMSS", s->AdjustMss); - } - - s->IsBridgeMode = (policy->NoBridge == false) || (policy->NoRouting == false); - s->IsMonitorMode = policy->MonitorPort; - - // Decide whether IPv6 session - s->IPv6Session = false; - - if (node.ClientIpAddress == 0) - { - s->IPv6Session = true; - } - - if (use_bridge_license) - { - Inc(s->Cedar->AssignedBridgeLicense); - } - - if (use_client_license) - { - Inc(s->Cedar->AssignedClientLicense); - } - - if (server != NULL) - { - // Update the total allocation of the number of licenses for Server structure - if (server->ServerType == SERVER_TYPE_STANDALONE) - { - // Update only stand-alone mode - // (Periodically poll in the cluster controller mode) - server->CurrentAssignedClientLicense = Count(s->Cedar->AssignedClientLicense); - server->CurrentAssignedBridgeLicense = Count(s->Cedar->AssignedBridgeLicense); - } - } - - if (StrLen(sessionname) != 0) - { - // Specify the session name - Free(s->Name); - s->Name = CopyStr(sessionname); - } - - { - char ip[128]; - IPToStr(ip, sizeof(ip), &c->FirstSock->RemoteIP); - HLog(hub, "LH_NEW_SESSION", c->Name, s->Name, ip, c->FirstSock->RemotePort, c->FirstSock->UnderlayProtocol, c->FirstSock->ProtocolDetails); - } - - c->Session = s; - s->AdministratorMode = admin_mode; - StrCpy(s->UserNameReal, sizeof(s->UserNameReal), username_real); - StrCpy(s->GroupName, sizeof(s->GroupName), groupname); - - // Get the session key - Copy(session_key, s->SessionKey, SHA1_SIZE); - - // Set the parameters - s->MaxConnection = max_connection; - s->UseEncrypt = use_encrypt; - s->UseCompress = use_compress; - s->HalfConnection = half_connection; - s->Timeout = timeout; - s->QoS = qos; - s->NoReconnectToSession = no_reconnect_to_session; - s->VLanId = policy->VLanId; - - // User name - s->Username = CopyStr(username); - - HLog(hub, "LH_SET_SESSION", s->Name, s->MaxConnection, - s->UseEncrypt ? _UU("L_YES") : _UU("L_NO"), - s->UseCompress ? _UU("L_YES") : _UU("L_NO"), - s->HalfConnection ? _UU("L_YES") : _UU("L_NO"), - s->Timeout / 1000); - - msg = GetHubMsg(hub); - - // Suppress client update notification flag - if (hub->Option != NULL) - { - suppress_client_update_notification = hub->Option->SuppressClientUpdateNotification; - } - } - Unlock(hub->lock); - - // Send a Welcome packet to the client - p = PackWelcome(s); - - PackAddBool(p, "suppress_client_update_notification", suppress_client_update_notification); - - if (s != NULL && s->InProcMode) - { - if (IsZero(mschap_v2_server_response_20, sizeof(mschap_v2_server_response_20)) == false) - { - // MS-CHAPv2 Response - PackAddData(p, "IpcMsChapV2ServerResponse", mschap_v2_server_response_20, sizeof(mschap_v2_server_response_20)); - } - } - - if (true) - { - // A message to be displayed in the VPN Client (Will not be displayed if the VPN Gate Virtual HUB) - char *utf; - wchar_t winver_msg_client[3800]; - wchar_t winver_msg_server[3800]; - UINT tmpsize; - wchar_t *tmp; - RPC_WINVER server_winver; - - GetWinVer(&server_winver); - - Zero(winver_msg_client, sizeof(winver_msg_client)); - Zero(winver_msg_server, sizeof(winver_msg_server)); - - if (IsSupportedWinVer(&winver) == false) - { - SYSTEMTIME st; - - LocalTime(&st); - - UniFormat(winver_msg_client, sizeof(winver_msg_client), _UU("WINVER_ERROR_FORMAT"), - _UU("WINVER_ERROR_PC_LOCAL"), - winver.Title, - _UU("WINVER_ERROR_VPNSERVER"), - SUPPORTED_WINDOWS_LIST, - _UU("WINVER_ERROR_PC_LOCAL"), - _UU("WINVER_ERROR_VPNSERVER"), - _UU("WINVER_ERROR_VPNSERVER"), - _UU("WINVER_ERROR_VPNSERVER"), - st.wYear, st.wMonth); - } - - if (IsSupportedWinVer(&server_winver) == false) - { - SYSTEMTIME st; - - LocalTime(&st); - - UniFormat(winver_msg_server, sizeof(winver_msg_server), _UU("WINVER_ERROR_FORMAT"), - _UU("WINVER_ERROR_PC_REMOTE"), - server_winver.Title, - _UU("WINVER_ERROR_VPNSERVER"), - SUPPORTED_WINDOWS_LIST, - _UU("WINVER_ERROR_PC_REMOTE"), - _UU("WINVER_ERROR_VPNSERVER"), - _UU("WINVER_ERROR_VPNSERVER"), - _UU("WINVER_ERROR_VPNSERVER"), - st.wYear, st.wMonth); - } - - tmpsize = UniStrSize(winver_msg_client) + UniStrSize(winver_msg_server) + UniStrSize(msg) + (16000 + 3000) * sizeof(wchar_t); - - tmp = ZeroMalloc(tmpsize); - - if (IsURLMsg(msg, NULL, 0) == false) - { - - if (s != NULL && s->IsRUDPSession && c != NULL && StrCmpi(hub->Name, VG_HUBNAME) != 0) - { - // Show the warning message if the connection is made by NAT-T - wchar_t *tmp2; - UINT tmp2_size = 2400 * sizeof(wchar_t); - char local_name[128]; - wchar_t local_name_2[128]; - char local_name_3[128]; - - Zero(local_name, sizeof(local_name)); - Zero(local_name_2, sizeof(local_name_2)); - Zero(local_name_3, sizeof(local_name_3)); - - GetMachineName(local_name, sizeof(local_name)); - -#ifdef OS_WIN32 - MsGetComputerNameFullEx(local_name_2, sizeof(local_name_2), true); - - UniToStr(local_name_3, sizeof(local_name_3), local_name_2); - - if (IsEmptyStr(local_name_3) == false) - { - StrCpy(local_name, sizeof(local_name), local_name_3); - } -#endif // OS_WIN32 - - tmp2 = ZeroMalloc(tmp2_size); - UniFormat(tmp2, tmp2_size, _UU(c->ClientBuild >= 9428 ? "NATT_MSG" : "NATT_MSG2"), local_name); - - UniStrCat(tmp, tmpsize, tmp2); - - Free(tmp2); - } - - { - if (GetGlobalServerFlag(GSF_SHOW_OSS_MSG) != 0) - { - UniStrCat(tmp, tmpsize, _UU("OSS_MSG")); - } - } - - { - UniStrCat(tmp, tmpsize, winver_msg_client); - UniStrCat(tmp, tmpsize, winver_msg_server); - } - } - UniStrCat(tmp, tmpsize, msg); - - utf = CopyUniToUtf(tmp); - - PackAddData(p, "Msg", utf, StrLen(utf)); - - Free(tmp); - Free(utf); - } - - Free(msg); - - // Brand string for the connection limit - { - char *branded_cfroms = _SS("BRANDED_C_FROM_S"); - if(StrLen(branded_cfroms) > 0) - { - PackAddStr(p, "branded_cfroms", branded_cfroms); - } - } - - HttpServerSend(c->FirstSock, p); - FreePack(p); - - // Receive a signature - Copy(&c->Session->NodeInfo, &node, sizeof(NODE_INFO)); - - - { - wchar_t tmp[MAX_SIZE * 2]; - NodeInfoToStr(tmp, sizeof(tmp), &s->NodeInfo); - - HLog(hub, "LH_NODE_INFO", s->Name, tmp); - - if (s->VLanId != 0) - { - HLog(hub, "LH_VLAN_ID", s->Name, s->VLanId); - } - } - - // Shift the connection to the tunneling mode - StartTunnelingMode(c); - - // Processing of half-connection mode - if (s->HalfConnection) - { - // The direction of the first socket is client to server - TCPSOCK *ts = (TCPSOCK *)LIST_DATA(c->Tcp->TcpSockList, 0); - ts->Direction = TCP_CLIENT_TO_SERVER; - } - - if (s->Hub->Type == HUB_TYPE_FARM_DYNAMIC && s->Cedar->Server != NULL && s->Cedar->Server->ServerType == SERVER_TYPE_FARM_CONTROLLER) - { - if (s->Hub->BeingOffline == false) - { - // Start the SecureNAT on the dynamic Virtual HUB - EnableSecureNATEx(s->Hub, false, true); - - cluster_dynamic_secure_nat = true; - } - } - - if (s->LocalHostSession) - { - // Update the local MAC address list - RefreshLocalMacAddressList(); - } - - // Discard the user list cache - DeleteAllUserListCache(hub->UserList); - - - // Main routine of the session - Debug("SessionMain()\n"); - s->NumLoginIncrementUserObject = loggedin_user_object; - s->NumLoginIncrementHubObject = s->Hub; - s->NumLoginIncrementTick = Tick64() + (UINT64)NUM_LOGIN_INCREMENT_INTERVAL; - SessionMain(s); - - - // Discard the user list cache - DeleteAllUserListCache(hub->UserList); - - // Decrement the current number of connections - Lock(s->Hub->lock); - { - if (use_bridge_license) - { - Dec(hub->NumSessionsBridge); - } - - if (use_client_license) - { - Dec(hub->NumSessionsClient); - } - - Dec(s->Hub->NumSessions); - Dec(s->Hub->Cedar->CurrentSessions); - - // Decrement the number of licenses - if (use_bridge_license) - { - Dec(s->Cedar->AssignedBridgeLicense); - } - - if (use_client_license) - { - Dec(s->Cedar->AssignedClientLicense); - } - - if (server != NULL) - { - // Update the total allocation of the number of licenses for Server structure - if (server->ServerType == SERVER_TYPE_STANDALONE) - { - // Update only stand-alone mode - // (Periodically polled in the cluster controller mode) - server->CurrentAssignedClientLicense = Count(s->Cedar->AssignedClientLicense); - server->CurrentAssignedBridgeLicense = Count(s->Cedar->AssignedBridgeLicense); - } - } - } - Unlock(s->Hub->lock); - - PrintSessionTotalDataSize(s); - - HLog(s->Hub, "LH_END_SESSION", s->Name, s->TotalSendSizeReal, s->TotalRecvSizeReal); - - if (cluster_dynamic_secure_nat && s->Hub->BeingOffline == false) - { - // Stop the SecureNAT on the dynamic Virtual HUB - EnableSecureNATEx(s->Hub, false, true); - } - - if (s->UdpAccel != NULL) - { - // Release the UDP acceleration - FreeUdpAccel(s->UdpAccel); - s->UdpAccel = NULL; - } - - ReleaseSession(s); - - ret = true; - c->Err = ERR_SESSION_REMOVED; - - ReleaseHub(hub); - - goto CLEANUP; - } - else if (StrCmpi(method, "additional_connect") == 0) - { - SOCK *sock; - TCPSOCK *ts; - UINT dummy; - - c->Type = CONNECTION_TYPE_ADDITIONAL; - - // Additional connection - // Read the session key - if (GetSessionKeyFromPack(p, session_key, &dummy) == false) - { - FreePack(p); - c->Err = ERR_PROTOCOL_ERROR; - goto CLEANUP; - } - - FreePack(p); - - // Get the session from the session key - s = GetSessionFromKey(c->Cedar, session_key); - if (s == NULL || s->Halt || s->NoReconnectToSession) - { - // Session can not be found, or re-connection is prohibited - Debug("Session Not Found.\n"); - c->Err = ERR_SESSION_TIMEOUT; - goto CLEANUP; - } - - // Session is found - Debug("Session Found: %s\n", s->Name); - // Check the protocol of session - c->Err = 0; - Lock(s->lock); - { - if (s->Connection->Protocol != CONNECTION_TCP) - { - c->Err = ERR_INVALID_PROTOCOL; - } - } - Unlock(s->lock); - // Check the current number of connections of the session - Lock(s->Connection->lock); - if (c->Err == 0) - { - if (Count(s->Connection->CurrentNumConnection) > s->MaxConnection) - { - c->Err = ERR_TOO_MANY_CONNECTION; - } - } - if (c->Err != 0) - { - Unlock(s->Connection->lock); - if (c->Err == ERR_TOO_MANY_CONNECTION) - { - Debug("Session TOO MANY CONNECTIONS !!: %u\n", - Count(s->Connection->CurrentNumConnection)); - } - else - { - Debug("Session Invalid Protocol.\n"); - } - ReleaseSession(s); - goto CLEANUP; - } - - // Add the socket of this connection to the connection list of the session (TCP) - sock = c->FirstSock; - - if (sock->IsRUDPSocket && sock->BulkRecvKey != NULL && sock->BulkSendKey != NULL) - { - if (s->BulkRecvKeySize != 0 && s->BulkSendKeySize != 0) - { - // Restore R-UDP bulk send/recv keys for additional connections - Copy(sock->BulkRecvKey->Data, s->BulkRecvKey, s->BulkRecvKeySize); - sock->BulkRecvKey->Size = s->BulkRecvKeySize; - Copy(sock->BulkSendKey->Data, s->BulkSendKey, s->BulkSendKeySize); - sock->BulkSendKey->Size = s->BulkSendKeySize; - } - } - - ts = NewTcpSock(sock); - SetTimeout(sock, CONNECTING_TIMEOUT); - direction = TCP_BOTH; - LockList(s->Connection->Tcp->TcpSockList); - { - if (s->HalfConnection) - { - // In half-connection, directions of the TCP connections are automatically - // adjusted by examining all current direction of the TCP connections - UINT i, c2s, s2c; - c2s = s2c = 0; - for (i = 0;i < LIST_NUM(s->Connection->Tcp->TcpSockList);i++) - { - TCPSOCK *ts = (TCPSOCK *)LIST_DATA(s->Connection->Tcp->TcpSockList, i); - if (ts->Direction == TCP_SERVER_TO_CLIENT) - { - s2c++; - } - else - { - c2s++; - } - } - if (s2c > c2s) - { - direction = TCP_CLIENT_TO_SERVER; - } - else - { - direction = TCP_SERVER_TO_CLIENT; - } - Debug("%u/%u\n", s2c, c2s); - ts->Direction = direction; - } - } - UnlockList(s->Connection->Tcp->TcpSockList); - - // Return a success result - p = PackError(ERR_NO_ERROR); - PackAddInt(p, "direction", direction); - - HttpServerSend(c->FirstSock, p); - FreePack(p); - - SetTimeout(sock, INFINITE); - - LockList(s->Connection->Tcp->TcpSockList); - { - Add(s->Connection->Tcp->TcpSockList, ts); - } - UnlockList(s->Connection->Tcp->TcpSockList); - - // Increment the number of connections - Inc(s->Connection->CurrentNumConnection); - Debug("TCP Connection Incremented: %u\n", Count(s->Connection->CurrentNumConnection)); - - // Issue the Cancel of session - Cancel(s->Cancel1); - - Unlock(s->Connection->lock); - - c->flag1 = true; - - ReleaseSession(s); - - return true; - } - else if (StrCmpi(method, "enum_hub") == 0) - { - // Enumerate the Virtual HUB - UINT i, num; - LIST *o; - o = NewListFast(NULL); - - c->Type = CONNECTION_TYPE_ENUM_HUB; - - FreePack(p); - p = NewPack(); - LockList(c->Cedar->HubList); - { - num = LIST_NUM(c->Cedar->HubList); - for (i = 0;i < num;i++) - { - HUB *h = LIST_DATA(c->Cedar->HubList, i); - if (h->Option != NULL && h->Option->NoEnum == false) - { - Insert(o, CopyStr(h->Name)); - } - } - } - UnlockList(c->Cedar->HubList); - - num = LIST_NUM(o); - for (i = 0;i < num;i++) - { - char *name = LIST_DATA(o, i); - PackAddStrEx(p, "HubName", name, i, num); - Free(name); - } - ReleaseList(o); - PackAddInt(p, "NumHub", num); - - HttpServerSend(c->FirstSock, p); - FreePack(p); - FreePack(HttpServerRecv(c->FirstSock)); - c->Err = 0; - - SLog(c->Cedar, "LS_ENUM_HUB", c->Name, num); - - error_detail = "enum_hub"; - - goto CLEANUP; - } - else if (StrCmpi(method, "farm_connect") == 0) - { - // Server farm connection request - CEDAR *cedar = c->Cedar; - c->Type = CONNECTION_TYPE_FARM_RPC; - c->Err = 0; - if (c->Cedar->Server == NULL) - { - // Unsupported - c->Err = ERR_NOT_FARM_CONTROLLER; - } - else - { - SERVER *s = c->Cedar->Server; - if (s->ServerType != SERVER_TYPE_FARM_CONTROLLER || s->FarmControllerInited == false) - { - // Not a farm controller - SLog(c->Cedar, "LS_FARM_ACCEPT_1", c->Name); - c->Err = ERR_NOT_FARM_CONTROLLER; - } - else - { - UCHAR check_secure_password[SHA1_SIZE]; - UCHAR secure_password[SHA1_SIZE]; - // User authentication - SecurePassword(check_secure_password, s->HashedPassword, c->Random); - if (PackGetDataSize(p, "SecurePassword") == sizeof(secure_password)) - { - PackGetData(p, "SecurePassword", secure_password); - } - else - { - Zero(secure_password, sizeof(secure_password)); - } - - if (Cmp(secure_password, check_secure_password, SHA1_SIZE) != 0) - { - // Password is different - SLog(c->Cedar, "LS_FARM_ACCEPT_2", c->Name); - c->Err = ERR_ACCESS_DENIED; - } - else - { - // Get the certificate - BUF *b; - X *server_x; - - SLog(c->Cedar, "LS_FARM_ACCEPT_3", c->Name); - b = PackGetBuf(p, "ServerCert"); - if (b == NULL) - { - c->Err = ERR_PROTOCOL_ERROR; - } - else - { - server_x = BufToX(b, false); - FreeBuf(b); - if (server_x == NULL) - { - c->Err = ERR_PROTOCOL_ERROR; - } - else - { - UINT ip; - UINT point; - char hostname[MAX_SIZE]; - -#ifdef OS_WIN32 - MsSetThreadPriorityRealtime(); -#endif // OS_WIN32 - - SetTimeout(c->FirstSock, SERVER_CONTROL_TCP_TIMEOUT); - - ip = PackGetIp32(p, "PublicIp"); - point = PackGetInt(p, "Point"); - if (PackGetStr(p, "HostName", hostname, sizeof(hostname))) - { - UINT num_port = PackGetIndexCount(p, "PublicPort"); - if (num_port >= 1 && num_port <= MAX_PUBLIC_PORT_NUM) - { - UINT *ports = ZeroMalloc(sizeof(UINT) * num_port); - UINT i; - - for (i = 0;i < num_port;i++) - { - ports[i] = PackGetIntEx(p, "PublicPort", i); - } - - SiFarmServ(s, c->FirstSock, server_x, ip, num_port, ports, hostname, point, - PackGetInt(p, "Weight"), PackGetInt(p, "MaxSessions")); - - Free(ports); - } - } - - FreeX(server_x); - } - } - } - } - } - FreePack(p); - goto CLEANUP; - } - else if (StrCmpi(method, "admin") == 0 && c->Cedar->Server != NULL) - { - UINT err; - // Administrative RPC connection request - c->Type = CONNECTION_TYPE_ADMIN_RPC; - err = AdminAccept(c, p); - FreePack(p); - if (err != ERR_NO_ERROR) - { - PACK *p = PackError(err); - HttpServerSend(c->FirstSock, p); - FreePack(p); - } - - error_detail = "admin_rpc"; - - goto CLEANUP; - } - else if (StrCmpi(method, "password") == 0) - { - UINT err; - // Password change request - c->Type = CONNECTION_TYPE_PASSWORD; - err = ChangePasswordAccept(c, p); - FreePack(p); - - p = PackError(err); - HttpServerSend(c->FirstSock, p); - FreePack(p); - - error_detail = "change_password"; - - goto CLEANUP; - } - else - { - // Unknown method - FreePack(p); - c->Err = ERR_PROTOCOL_ERROR; - - error_detail = "unknown_method"; - - goto CLEANUP; - } - -CLEANUP: - // Release the user object - if (loggedin_user_object != NULL) - { - ReleaseUser(loggedin_user_object); - } - - - // Error packet transmission - if (supress_return_pack_error == false) - { - p = PackError(c->Err); - PackAddBool(p, "no_save_password", no_save_password); - HttpServerSend(c->FirstSock, p); - FreePack(p); - } - - FreePack(HttpServerRecv(c->FirstSock)); - - SleepThread(25); - - SLog(c->Cedar, "LS_CONNECTION_ERROR", c->Name, GetUniErrorStr(c->Err), c->Err); - - if (release_me_eap_client != NULL) - { - ReleaseEapClient(release_me_eap_client); - } - - return ret; -} - - -// Create a Node information -void CreateNodeInfo(NODE_INFO *info, CONNECTION *c) -{ - SESSION *s; - OS_INFO *os; - char *product_id; - IP ip; - // Validate arguments - if (c == NULL) - { - return; - } - - s = c->Session; - os = GetOsInfo(); - - - - Zero(info, sizeof(NODE_INFO)); - - // Client product name - StrCpy(info->ClientProductName, sizeof(info->ClientProductName), c->ClientStr); - // Client version - info->ClientProductVer = Endian32(c->ClientVer); - // Client build number - info->ClientProductBuild = Endian32(c->ClientBuild); - - // Server product name - StrCpy(info->ServerProductName, sizeof(info->ServerProductName), c->ServerStr); - // Server version - info->ServerProductVer = Endian32(c->ServerVer); - // Server build number - info->ServerProductBuild = Endian32(c->ServerBuild); - - // Client OS name - StrCpy(info->ClientOsName, sizeof(info->ClientOsName), os->OsProductName); - // Client OS version - StrCpy(info->ClientOsVer, sizeof(info->ClientOsVer), os->OsVersion); - // Client OS Product ID - product_id = OSGetProductId(); - StrCpy(info->ClientOsProductId, sizeof(info->ClientOsProductId), product_id); - Free(product_id); - - // Client host name -#ifndef OS_WIN32 - GetMachineName(info->ClientHostname, sizeof(info->ClientHostname)); -#else // OS_WIN32 - if (true) - { - wchar_t namew[256]; - char namea[256]; - - Zero(namew, sizeof(namew)); - MsGetComputerNameFullEx(namew, sizeof(namew), true); - - Zero(namea, sizeof(namea)); - UniToStr(namea, sizeof(namea), namew); - - if (IsEmptyStr(namea)) - { - GetMachineName(namea, sizeof(namea)); - } - - StrCpy(info->ClientHostname, sizeof(info->ClientHostname), namea); - - } -#endif // OS_WIN32 - // Client IP address - if (IsIP6(&c->FirstSock->LocalIP) == false) - { - info->ClientIpAddress = IPToUINT(&c->FirstSock->LocalIP); - } - else - { - Copy(info->ClientIpAddress6, c->FirstSock->LocalIP.ipv6_addr, sizeof(info->ClientIpAddress6)); - } - // Client port number - info->ClientPort = Endian32(c->FirstSock->LocalPort); - - // Server host name - StrCpy(info->ServerHostname, sizeof(info->ServerHostname), c->ServerName); - // Server IP address - if (GetIP(&ip, info->ServerHostname)) - { - if (IsIP6(&ip) == false) - { - info->ServerIpAddress = IPToUINT(&ip); - } - else - { - Copy(info->ServerIpAddress6, ip.ipv6_addr, sizeof(info->ServerIpAddress6)); - } - } - // Server port number - info->ServerPort = Endian32(c->ServerPort); - - if (s->ClientOption->ProxyType == PROXY_SOCKS || s->ClientOption->ProxyType == PROXY_HTTP) - { - // Proxy host name - StrCpy(info->ProxyHostname, sizeof(info->ProxyHostname), s->ClientOption->ProxyName); - - // Proxy Server IP Address - if (IsIP6(&c->FirstSock->RemoteIP) == false) - { - info->ProxyIpAddress = IPToUINT(&c->FirstSock->RemoteIP); - } - else - { - Copy(&info->ProxyIpAddress6, c->FirstSock->RemoteIP.ipv6_addr, sizeof(info->ProxyIpAddress6)); - } - - info->ProxyPort = Endian32(c->FirstSock->RemotePort); - } - - // HUB name - StrCpy(info->HubName, sizeof(info->HubName), s->ClientOption->HubName); - - // Unique ID - Copy(info->UniqueId, c->Cedar->UniqueId, sizeof(info->UniqueId)); -} - -// Connect a socket additionally -SOCK *ClientAdditionalConnectToServer(CONNECTION *c) -{ - SOCK *s; - // Validate arguments - if (c == NULL) - { - return NULL; - } - - // Socket connection - s = ClientConnectGetSocket(c, true); - if (s == NULL) - { - // Connection failure - return NULL; - } - - // Add the socket to the list - LockList(c->ConnectingSocks); - { - Add(c->ConnectingSocks, s); - AddRef(s->ref); - } - UnlockList(c->ConnectingSocks); - - if (c->Session->Halt) - { - // Stop - Disconnect(s); - LockList(c->ConnectingSocks); - { - if (Delete(c->ConnectingSocks, s)) - { - ReleaseSock(s); - } - } - UnlockList(c->ConnectingSocks); - ReleaseSock(s); - return NULL; - } - - // Time-out - SetTimeout(s, CONNECTING_TIMEOUT); - - // Start the SSL communication - if (StartSSLEx(s, NULL, NULL, 0, c->ServerName) == false) - { - // SSL communication failure - Disconnect(s); - LockList(c->ConnectingSocks); - { - if (Delete(c->ConnectingSocks, s)) - { - ReleaseSock(s); - } - } - UnlockList(c->ConnectingSocks); - ReleaseSock(s); - return NULL; - } - - // Check the certificate - if (CompareX(s->RemoteX, c->ServerX) == false) - { - // The certificate is invalid - Disconnect(s); - c->Session->SessionTimeOuted = true; - } - - return s; -} - -// Attempt to sign by the secure device -UINT SecureSign(SECURE_SIGN *sign, UINT device_id, char *pin) -{ - SECURE *sec; - X *x; - // Validate arguments - if (sign == false || pin == NULL || device_id == 0) - { - return ERR_INTERNAL_ERROR; - } - - // Open the device - sec = OpenSec(device_id); - if (sec == NULL) - { - return ERR_SECURE_DEVICE_OPEN_FAILED; - } - - // Open the session - if (OpenSecSession(sec, 0) == false) - { - CloseSec(sec); - return ERR_SECURE_DEVICE_OPEN_FAILED; - } - - // Login - if (LoginSec(sec, pin) == false) - { - CloseSecSession(sec); - CloseSec(sec); - return ERR_SECURE_PIN_LOGIN_FAILED; - } - - // Read the certificate - x = ReadSecCert(sec, sign->SecurePublicCertName); - if (x == NULL) - { - LogoutSec(sec); - CloseSecSession(sec); - CloseSec(sec); - return ERR_SECURE_NO_CERT; - } - - // Sign by the private key - if (SignSec(sec, sign->SecurePrivateKeyName, sign->Signature, sign->Random, SHA1_SIZE) == false) - { - // Signing failure - FreeX(x); - LogoutSec(sec); - CloseSecSession(sec); - CloseSec(sec); - return ERR_SECURE_NO_PRIVATE_KEY; - } - - // Convert the certificate to buffer - sign->ClientCert = x; - - // Log out - LogoutSec(sec); - - // Close the session - CloseSecSession(sec); - - // Close the device - CloseSec(sec); - - // Success - return ERR_NO_ERROR; -} - -// Client connects to the server additionally -bool ClientAdditionalConnect(CONNECTION *c, THREAD *t) -{ - SOCK *s; - PACK *p; - TCPSOCK *ts; - UINT err; - UINT direction; - - // Validate arguments - if (c == NULL) - { - return false; - } - - // Socket connection to the server - s = ClientAdditionalConnectToServer(c); - if (s == NULL) - { - // Failed to connect socket - return false; - } - - if (c->Halt) - { - goto CLEANUP; - } - - // Send a signature - Debug("Uploading Signature...\n"); - if (ClientUploadSignature(s) == false) - { - goto CLEANUP; - } - - if (c->Halt) - { - // Stop - goto CLEANUP; - } - - // Receive a Hello packet - Debug("Downloading Hello...\n"); - if (ClientDownloadHello(c, s) == false) - { - goto CLEANUP; - } - - if (c->Halt) - { - // Stop - goto CLEANUP; - } - - // Send a authentication data for the additional connection - if (ClientUploadAuth2(c, s) == false) - { - // Disconnected - goto CLEANUP; - } - - // Receive a response - p = HttpClientRecv(s); - if (p == NULL) - { - // Disconnected - goto CLEANUP; - } - - err = GetErrorFromPack(p); - direction = PackGetInt(p, "direction"); - - FreePack(p); - p = NULL; - - if (err != 0) - { - // Error has occurred - Debug("Additional Connect Error: %u\n", err); - if (err == ERR_SESSION_TIMEOUT || err == ERR_INVALID_PROTOCOL) - { - // We shall re-connection because it is a fatal error - c->Session->SessionTimeOuted = true; - } - goto CLEANUP; - } - - Debug("Additional Connect Succeed!\n"); - - if (s->IsRUDPSocket && s->BulkRecvKey != NULL && s->BulkSendKey != NULL) - { - // Restore R-UDP bulk send/recv keys for additional connections - if (c->Session->BulkRecvKeySize != 0 && c->Session->BulkSendKeySize != 0) - { - Copy(s->BulkRecvKey->Data, c->Session->BulkRecvKey, c->Session->BulkRecvKeySize); - s->BulkRecvKey->Size = c->Session->BulkRecvKeySize; - - Copy(s->BulkSendKey->Data, c->Session->BulkSendKey, c->Session->BulkSendKeySize); - s->BulkSendKey->Size = c->Session->BulkSendKeySize; - } - } - - // Success the additional connection - // Add to the TcpSockList of the connection - ts = NewTcpSock(s); - - if (c->ServerMode == false) - { - if (c->Session->ClientOption->ConnectionDisconnectSpan != 0) - { - ts->DisconnectTick = Tick64() + c->Session->ClientOption->ConnectionDisconnectSpan * (UINT64)1000; - } - } - - LockList(c->Tcp->TcpSockList); - { - ts->Direction = direction; - Add(c->Tcp->TcpSockList, ts); - } - UnlockList(c->Tcp->TcpSockList); - Debug("TCP Connection Incremented: %u\n", Count(c->CurrentNumConnection)); - - if (c->Session->HalfConnection) - { - Debug("New Half Connection: %s\n", - direction == TCP_SERVER_TO_CLIENT ? "TCP_SERVER_TO_CLIENT" : "TCP_CLIENT_TO_SERVER" - ); - } - - // Issue the Cancel to the session - Cancel(c->Session->Cancel1); - - // Remove the socket from the socket list of connected - LockList(c->ConnectingSocks); - { - if (Delete(c->ConnectingSocks, s)) - { - ReleaseSock(s); - } - } - UnlockList(c->ConnectingSocks); - ReleaseSock(s); - return true; - -CLEANUP: - // Disconnection process - Disconnect(s); - LockList(c->ConnectingSocks); - { - if (Delete(c->ConnectingSocks, s)) - { - ReleaseSock(s); - - } - } - UnlockList(c->ConnectingSocks); - ReleaseSock(s); - return false; -} - -// Secure device signing thread -void ClientSecureSignThread(THREAD *thread, void *param) -{ - SECURE_SIGN_THREAD_PROC *p = (SECURE_SIGN_THREAD_PROC *)param; - // Validate arguments - if (thread == NULL || param == NULL) - { - return; - } - - NoticeThreadInit(thread); - - p->Ok = p->SecureSignProc(p->Connection->Session, p->Connection, p->SecureSign); - p->UserFinished = true; -} - -// Signing with the secure device -bool ClientSecureSign(CONNECTION *c, UCHAR *sign, UCHAR *random, X **x) -{ - SECURE_SIGN_THREAD_PROC *p; - SECURE_SIGN *ss; - SESSION *s; - CLIENT_OPTION *o; - CLIENT_AUTH *a; - THREAD *thread; - UINT64 start; - bool ret; - // Validate arguments - if (c == NULL || sign == NULL || random == NULL || x == NULL) - { - return false; - } - - s = c->Session; - o = s->ClientOption; - a = s->ClientAuth; - - p = ZeroMalloc(sizeof(SECURE_SIGN_THREAD_PROC)); - p->Connection = c; - ss = p->SecureSign = ZeroMallocEx(sizeof(SECURE_SIGN), true); - StrCpy(ss->SecurePrivateKeyName, sizeof(ss->SecurePrivateKeyName), - a->SecurePrivateKeyName); - StrCpy(ss->SecurePublicCertName, sizeof(ss->SecurePublicCertName), - a->SecurePublicCertName); - ss->UseSecureDeviceId = c->Cedar->Client->UseSecureDeviceId; - Copy(ss->Random, random, SHA1_SIZE); - -#ifdef OS_WIN32 - ss->BitmapId = CmGetSecureBitmapId(c->ServerName); -#endif // OS_WIN32 - - p->SecureSignProc = a->SecureSignProc; - - // Create a thread - thread = NewThread(ClientSecureSignThread, p); - WaitThreadInit(thread); - - // Poll every 0.5 seconds until signing is completed or canceled - start = Tick64(); - while (true) - { - if ((Tick64() - start) > CONNECTING_POOLING_SPAN) - { - // Send a NOOP periodically for disconnection prevention - start = Tick64(); - ClientUploadNoop(c); - } - if (p->UserFinished) - { - // User selected - break; - } - WaitThread(thread, 500); - } - ReleaseThread(thread); - - ret = p->Ok; - - if (ret) - { - Copy(sign, ss->Signature, sizeof(ss->Signature)); - *x = ss->ClientCert; - } - - Free(p->SecureSign); - Free(p); - - return ret; -} - -// Server certificate confirmation thread -void ClientCheckServerCertThread(THREAD *thread, void *param) -{ - CHECK_CERT_THREAD_PROC *p = (CHECK_CERT_THREAD_PROC *)param; - // Validate arguments - if (thread == NULL || param == NULL) - { - return; - } - - // Notify the completion of initialization - NoticeThreadInit(thread); - - // Query for the selection to the user - p->Ok = p->CheckCertProc(p->Connection->Session, p->Connection, p->ServerX, &p->Expired); - p->UserSelected = true; -} - -// Client verify the certificate of the server -bool ClientCheckServerCert(CONNECTION *c, bool *expired) -{ - CLIENT_AUTH *auth; - X *x; - CHECK_CERT_THREAD_PROC *p; - THREAD *thread; - CEDAR *cedar; - bool ret; - UINT64 start; - // Validate arguments - if (c == NULL) - { - return false; - } - - if (expired != NULL) - { - *expired = false; - } - - auth = c->Session->ClientAuth; - cedar = c->Cedar; - - if (auth->CheckCertProc == NULL && c->Session->LinkModeClient == false) - { - // No checking function - return true; - } - - if (c->Session->LinkModeClient && c->Session->Link->CheckServerCert == false) - { - // It's in cascade connection mode, but do not check the server certificate - return true; - } - - if (c->UseTicket) - { - // Check the certificate of the redirected VPN server - if (CompareX(c->FirstSock->RemoteX, c->ServerX) == false) - { - return false; - } - else - { - return true; - } - } - - x = CloneX(c->FirstSock->RemoteX); - if (x == NULL) - { - // Strange error occurs - return false; - } - - if (CheckXDateNow(x)) - { - // Check whether it is signed by the root certificate to trust - if (c->Session->LinkModeClient == false) - { - // Normal VPN Client mode - if (CheckSignatureByCa(cedar, x)) - { - // This certificate can be trusted because it is signed - FreeX(x); - return true; - } - } - else - { - // Cascade connection mode - if (CheckSignatureByCaLinkMode(c->Session, x)) - { - // This certificate can be trusted because it is signed - FreeX(x); - return true; - } - } - } - - if (c->Session->LinkModeClient) - { - if (CheckXDateNow(x)) - { - Lock(c->Session->Link->lock); - { - if (c->Session->Link->ServerCert != NULL) - { - if (CompareX(c->Session->Link->ServerCert, x)) - { - Unlock(c->Session->Link->lock); - // Exactly match the certificate that is registered in the cascade configuration - FreeX(x); - return true; - } - } - } - Unlock(c->Session->Link->lock); - } - else - { - if (expired != NULL) - { - *expired = true; - } - } - - // Verification failure at this point in the case of cascade connection mode - FreeX(x); - return false; - } - - p = ZeroMalloc(sizeof(CHECK_CERT_THREAD_PROC)); - p->ServerX = x; - p->CheckCertProc = auth->CheckCertProc; - p->Connection = c; - - // Create a thread - thread = NewThread(ClientCheckServerCertThread, p); - WaitThreadInit(thread); - - // Poll at 0.5-second intervals until the user selects whether the connection - start = Tick64(); - while (true) - { - if ((Tick64() - start) > CONNECTING_POOLING_SPAN) - { - // Send a NOOP periodically for disconnection prevention - start = Tick64(); - ClientUploadNoop(c); - } - if (p->UserSelected) - { - // User-selected - break; - } - WaitThread(thread, 500); - } - - if (expired != NULL) - { - *expired = p->Expired; - } - - ret = p->Ok; - FreeX(p->ServerX); - Free(p); - ReleaseThread(thread); - - return ret; -} - -// Client connects to the server -bool ClientConnect(CONNECTION *c) -{ - bool ret = false; - bool ok = false; - UINT err; - SOCK *s; - PACK *p = NULL; - UINT session_key_32; - SESSION *sess; - char session_name[MAX_SESSION_NAME_LEN + 1]; - char connection_name[MAX_CONNECTION_NAME_LEN + 1]; - UCHAR session_key[SHA1_SIZE]; - POLICY *policy; - bool expired = false; - IP server_ip; - // Validate arguments - if (c == NULL) - { - return false; - } - - sess = c->Session; - - PrintStatus(sess, L"init"); - PrintStatus(sess, _UU("STATUS_1")); - -REDIRECTED: - - // [Connecting] - c->Status = CONNECTION_STATUS_CONNECTING; - c->Session->ClientStatus = CLIENT_STATUS_CONNECTING; - - s = ClientConnectToServer(c); - if (s == NULL) - { - PrintStatus(sess, L"free"); - return false; - } - - Copy(&server_ip, &s->RemoteIP, sizeof(IP)); - - if (c->Halt) - { - // Stop - c->Err = ERR_USER_CANCEL; - goto CLEANUP; - } - - // [Negotiating] - c->Session->ClientStatus = CLIENT_STATUS_NEGOTIATION; - - // Initialize the UDP acceleration function - if (sess->ClientOption != NULL && sess->ClientOption->NoUdpAcceleration == false) - { - if (sess->ClientOption->ProxyType == PROXY_DIRECT) - { - if (s->Type == SOCK_TCP) - { - if (sess->UdpAccel == NULL) - { - bool no_nat_t = false; - - if (sess->ClientOption->PortUDP != 0) - { - // There is no need for NAT-T treatment on my part if the UDP port on the other end is known beforehand - no_nat_t = true; - } - - - sess->UdpAccel = NewUdpAccel(c->Cedar, &s->LocalIP, true, true, no_nat_t); - } - } - } - } - - // Send a signature - Debug("Uploading Signature...\n"); - if (ClientUploadSignature(s) == false) - { - c->Err = ERR_DISCONNECTED; - goto CLEANUP; - } - - if (c->Halt) - { - // Stop - c->Err = ERR_USER_CANCEL; - goto CLEANUP; - } - - PrintStatus(sess, _UU("STATUS_5")); - - // Receive a Hello packet - Debug("Downloading Hello...\n"); - if (ClientDownloadHello(c, s) == false) - { - goto CLEANUP; - } - - if (c->Session->ClientOption != NULL && c->Session->ClientOption->FromAdminPack) - { - if (IsAdminPackSupportedServerProduct(c->ServerStr) == false) - { - c->Err = ERR_NOT_ADMINPACK_SERVER; - goto CLEANUP; - } - } - - if (c->Halt) - { - // Stop - c->Err = ERR_USER_CANCEL; - goto CLEANUP; - } - - Debug("Server Version : %u\n" - "Server String : %s\n" - "Server Build : %u\n" - "Client Version : %u\n" - "Client String : %s\n" - "Client Build : %u\n", - c->ServerVer, c->ServerStr, c->ServerBuild, - c->ClientVer, c->ClientStr, c->ClientBuild); - - // During user authentication - c->Session->ClientStatus = CLIENT_STATUS_AUTH; - - // Verify the server certificate by the client - if (ClientCheckServerCert(c, &expired) == false) - { - if (expired == false) - { - c->Err = ERR_CERT_NOT_TRUSTED; - } - else - { - c->Err = ERR_SERVER_CERT_EXPIRES; - } - - if (c->Session->LinkModeClient == false && c->Err == ERR_CERT_NOT_TRUSTED - && (c->Session->Account == NULL || ! c->Session->Account->RetryOnServerCert)) - { - c->Session->ForceStopFlag = true; - } - - goto CLEANUP; - } - - PrintStatus(sess, _UU("STATUS_6")); - - // Send the authentication data - if (ClientUploadAuth(c) == false) - { - goto CLEANUP; - } - - if (c->Halt) - { - // Stop - c->Err = ERR_USER_CANCEL; - goto CLEANUP; - } - - // Receive a Welcome packet - p = HttpClientRecv(s); - if (p == NULL) - { - c->Err = ERR_DISCONNECTED; - goto CLEANUP; - } - - // Error checking - err = GetErrorFromPack(p); - if (err != 0) - { - // An error has occured - c->Err = err; - c->ClientConnectError_NoSavePassword = PackGetBool(p, "no_save_password"); - goto CLEANUP; - } - - // Branding string check for the connection limit - { - char tmp[20]; - char *branded_cfroms = _SS("BRANDED_C_FROM_S"); - PackGetStr(p, "branded_cfroms", tmp, sizeof(tmp)); - - if(StrLen(branded_cfroms) > 0 && StrCmpi(branded_cfroms, tmp) != 0) - { - c->Err = ERR_BRANDED_C_FROM_S; - goto CLEANUP; - } - } - - if (c->Cedar->Server == NULL) - { - // Suppress client notification flag - if (PackIsValueExists(p, "suppress_client_update_notification")) - { - bool suppress_client_update_notification = PackGetBool(p, "suppress_client_update_notification"); - -#ifdef OS_WIN32 - MsRegWriteIntEx2(REG_LOCAL_MACHINE, PROTO_SUPPRESS_CLIENT_UPDATE_NOTIFICATION_REGKEY, PROTO_SUPPRESS_CLIENT_UPDATE_NOTIFICATION_REGVALUE, - (suppress_client_update_notification ? 1 : 0), false, true); -#endif // OS_WIN32 - } - } - - if (true) - { - // Message retrieval - UINT utf_size; - char *utf; - wchar_t *msg; - - utf_size = PackGetDataSize(p, "Msg"); - utf = ZeroMalloc(utf_size + 8); - PackGetData(p, "Msg", utf); - - msg = CopyUtfToUni(utf); - - if (IsEmptyUniStr(msg) == false) - { - if (c->Session->Client_Message != NULL) - { - Free(c->Session->Client_Message); - } - - c->Session->Client_Message = msg; - } - else - { - Free(msg); - } - - Free(utf); - } - - if (PackGetInt(p, "Redirect") != 0) - { - UINT i; - UINT ip; - UINT num_port; - UINT *ports; - UINT use_port = 0; - UINT current_port = c->ServerPort; - UCHAR ticket[SHA1_SIZE]; - X *server_cert = NULL; - BUF *b; - - // Redirect mode - PrintStatus(sess, _UU("STATUS_8")); - - ip = PackGetIp32(p, "Ip"); - num_port = MAX(MIN(PackGetIndexCount(p, "Port"), MAX_PUBLIC_PORT_NUM), 1); - ports = ZeroMalloc(sizeof(UINT) * num_port); - for (i = 0;i < num_port;i++) - { - ports[i] = PackGetIntEx(p, "Port", i); - } - - // Select a port number - for (i = 0;i < num_port;i++) - { - if (ports[i] == current_port) - { - use_port = current_port; - } - } - if (use_port == 0) - { - use_port = ports[0]; - } - - Free(ports); - - if (PackGetDataSize(p, "Ticket") == SHA1_SIZE) - { - PackGetData(p, "Ticket", ticket); - } - - b = PackGetBuf(p, "Cert"); - if (b != NULL) - { - server_cert = BufToX(b, false); - FreeBuf(b); - } - - if (c->ServerX != NULL) - { - FreeX(c->ServerX); - } - c->ServerX = server_cert; - - IPToStr32(c->ServerName, sizeof(c->ServerName), ip); - c->ServerPort = use_port; - - c->UseTicket = true; - Copy(c->Ticket, ticket, SHA1_SIZE); - - FreePack(p); - - p = NewPack(); - HttpClientSend(s, p); - FreePack(p); - - p = NULL; - - c->FirstSock = NULL; - Disconnect(s); - ReleaseSock(s); - s = NULL; - - goto REDIRECTED; - } - - PrintStatus(sess, _UU("STATUS_7")); - - // Parse the Welcome packet - if (ParseWelcomeFromPack(p, session_name, sizeof(session_name), - connection_name, sizeof(connection_name), &policy) == false) - { - // Parsing failure - c->Err = ERR_PROTOCOL_ERROR; - goto CLEANUP; - } - - // Get the session key - if (GetSessionKeyFromPack(p, session_key, &session_key_32) == false) - { - // Acquisition failure - Free(policy); - policy = NULL; - c->Err = ERR_PROTOCOL_ERROR; - goto CLEANUP; - } - - Copy(c->Session->SessionKey, session_key, SHA1_SIZE); - c->Session->SessionKey32 = session_key_32; - - // Save the contents of the Welcome packet - Debug("session_name: %s, connection_name: %s\n", - session_name, connection_name); - - Lock(c->Session->lock); - { - // Deploy and update connection parameters - sess->EnableUdpRecovery = PackGetBool(p, "enable_udp_recovery"); - c->Session->MaxConnection = PackGetInt(p, "max_connection"); - - if (sess->EnableUdpRecovery == false) - { - c->Session->MaxConnection = MIN(c->Session->MaxConnection, c->Session->ClientOption->MaxConnection); - } - - c->Session->MaxConnection = MIN(c->Session->MaxConnection, MAX_TCP_CONNECTION); - c->Session->MaxConnection = MAX(c->Session->MaxConnection, 1); - c->Session->UseCompress = PackGetInt(p, "use_compress") == 0 ? false : true; - c->Session->UseEncrypt = PackGetInt(p, "use_encrypt") == 0 ? false : true; - c->Session->NoSendSignature = PackGetBool(p, "no_send_signature"); - c->Session->HalfConnection = PackGetInt(p, "half_connection") == 0 ? false : true; - c->Session->IsAzureSession = PackGetInt(p, "is_azure_session") == 0 ? false : true; - c->Session->Timeout = PackGetInt(p, "timeout"); - c->Session->QoS = PackGetInt(p, "qos") == 0 ? false : true; - if (c->Session->QoS) - { - c->Session->MaxConnection = MAX(c->Session->MaxConnection, (UINT)(c->Session->HalfConnection ? 4 : 2)); - } - c->Session->VLanId = PackGetInt(p, "vlan_id"); - - // R-UDP Session ? - c->Session->IsRUDPSession = s->IsRUDPSocket; - - ZeroIP4(&c->Session->AzureRealServerGlobalIp); - - if (c->Session->IsAzureSession) - { - // Disable the life parameter of the connection in the case of VPN Azure relayed session - c->Session->ClientOption->ConnectionDisconnectSpan = 0; - - // Get the AzureRealServerGlobalIp the case of VPN Azure relayed - PackGetIp(p, "azure_real_server_global_ip", &c->Session->AzureRealServerGlobalIp); - } - - if (c->Session->IsRUDPSession) - { - // Disable the life parameter of the connection in the case of R-UDP session - c->Session->ClientOption->ConnectionDisconnectSpan = 0; - - // Disable QoS, etc. in the case of R-UDP session - c->Session->QoS = false; - c->Session->HalfConnection = false; - - if (c->Session->EnableUdpRecovery == false) - { - // Set the number of connection to 1 if UDP recovery is not supported - c->Session->MaxConnection = 1; - } - } - - // Physical communication protocol - StrCpy(c->Session->UnderlayProtocol, sizeof(c->Session->UnderlayProtocol), s->UnderlayProtocol); - - AddProtocolDetailsStr(c->Session->ProtocolDetails, sizeof(c->Session->ProtocolDetails), s->ProtocolDetails); - - if (c->Session->IsAzureSession) - { - StrCpy(c->Session->UnderlayProtocol, sizeof(c->Session->UnderlayProtocol), SOCK_UNDERLAY_AZURE); - - AddProtocolDetailsStr(c->Session->ProtocolDetails, sizeof(c->Session->ProtocolDetails), "VPN Azure"); - } - - if (c->Protocol == CONNECTION_UDP) - { - // In the case of UDP protocol, receive the key from the server - if (PackGetDataSize(p, "udp_send_key") == sizeof(c->Session->UdpSendKey)) - { - PackGetData(p, "udp_send_key", c->Session->UdpSendKey); - } - - if (PackGetDataSize(p, "udp_recv_key") == sizeof(c->Session->UdpRecvKey)) - { - PackGetData(p, "udp_recv_key", c->Session->UdpRecvKey); - } - } - - sess->EnableBulkOnRUDP = false; - sess->EnableHMacOnBulkOfRUDP = false; - if (s != NULL && s->IsRUDPSocket && s->BulkRecvKey != NULL && s->BulkSendKey != NULL) - { - // Bulk transfer on R-UDP - sess->EnableHMacOnBulkOfRUDP = PackGetBool(p, "enable_hmac_on_bulk_of_rudp"); - sess->BulkOnRUDPVersion = PackGetInt(p, "rudp_bulk_version"); - - if (PackGetBool(p, "enable_bulk_on_rudp")) - { - // Receive the key - UCHAR key_send[RUDP_BULK_KEY_SIZE_MAX]; - UCHAR key_recv[RUDP_BULK_KEY_SIZE_MAX]; - - UINT key_size = SHA1_SIZE; - - if (sess->BulkOnRUDPVersion == 2) - { - key_size = RUDP_BULK_KEY_SIZE_V2; - } - - if (PackGetData2(p, "bulk_on_rudp_send_key", key_send, key_size) && - PackGetData2(p, "bulk_on_rudp_recv_key", key_recv, key_size)) - { - sess->EnableBulkOnRUDP = true; - - Copy(s->BulkSendKey->Data, key_send, key_size); - Copy(s->BulkRecvKey->Data, key_recv, key_size); - - s->BulkSendKey->Size = key_size; - s->BulkRecvKey->Size = key_size; - - // Backup R-UDP bulk send/recv keys for additional connections - Copy(sess->BulkSendKey, s->BulkSendKey->Data, s->BulkSendKey->Size); - sess->BulkSendKeySize = s->BulkSendKey->Size; - - Copy(sess->BulkRecvKey, s->BulkRecvKey->Data, s->BulkRecvKey->Size); - sess->BulkRecvKeySize = s->BulkRecvKey->Size; - - AddProtocolDetailsKeyValueInt(sess->ProtocolDetails, sizeof(sess->ProtocolDetails), "RUDP_Bulk_Ver", sess->BulkOnRUDPVersion); - } - } - - sess->EnableHMacOnBulkOfRUDP = PackGetBool(p, "enable_hmac_on_bulk_of_rudp"); - } - - Debug("EnableBulkOnRUDP = %u\n", sess->EnableBulkOnRUDP); - Debug("EnableHMacOnBulkOfRUDP = %u\n", sess->EnableHMacOnBulkOfRUDP); - Debug("EnableUdpRecovery = %u\n", sess->EnableUdpRecovery); - Debug("BulkOnRUDPVersion = %u\n", sess->BulkOnRUDPVersion); - - sess->UseUdpAcceleration = false; - sess->IsUsingUdpAcceleration = false; - sess->UseHMacOnUdpAcceleration = false; - - if (sess->UdpAccel != NULL) - { - sess->UdpAccel->UseHMac = false; - - sess->UdpAccelFastDisconnectDetect = false; - - if (PackGetBool(p, "use_udp_acceleration")) - { - UINT udp_acceleration_version = PackGetInt(p, "udp_acceleration_version"); - IP udp_acceleration_server_ip; - - if (udp_acceleration_version == 0) - { - udp_acceleration_version = 1; - } - - sess->UdpAccelFastDisconnectDetect = PackGetBool(p, "udp_accel_fast_disconnect_detect"); - - if (PackGetIp(p, "udp_acceleration_server_ip", &udp_acceleration_server_ip)) - { - UINT udp_acceleration_server_port = PackGetInt(p, "udp_acceleration_server_port"); - - if (IsZeroIp(&udp_acceleration_server_ip)) - { - Copy(&udp_acceleration_server_ip, &s->RemoteIP, sizeof(IP)); - } - - if (udp_acceleration_server_port != 0) - { - UCHAR udp_acceleration_server_key[UDP_ACCELERATION_COMMON_KEY_SIZE_V1]; - UCHAR udp_acceleration_server_key_v2[UDP_ACCELERATION_COMMON_KEY_SIZE_V2]; - UINT server_cookie = PackGetInt(p, "udp_acceleration_server_cookie"); - UINT client_cookie = PackGetInt(p, "udp_acceleration_client_cookie"); - bool encryption = PackGetBool(p, "udp_acceleration_use_encryption"); - - Zero(udp_acceleration_server_key, sizeof(udp_acceleration_server_key)); - Zero(udp_acceleration_server_key_v2, sizeof(udp_acceleration_server_key_v2)); - - PackGetData2(p, "udp_acceleration_server_key", udp_acceleration_server_key, UDP_ACCELERATION_COMMON_KEY_SIZE_V1); - PackGetData2(p, "udp_acceleration_server_key_v2", udp_acceleration_server_key_v2, UDP_ACCELERATION_COMMON_KEY_SIZE_V2); - - if (server_cookie != 0 && client_cookie != 0) - { - IP remote_ip; - - Copy(&remote_ip, &s->RemoteIP, sizeof(IP)); - - if (IsZeroIp(&c->Session->AzureRealServerGlobalIp) == false) - { - Copy(&remote_ip, &c->Session->AzureRealServerGlobalIp, sizeof(IP)); - } - - sess->UdpAccel->Version = 1; - if (udp_acceleration_version == 2) - { - sess->UdpAccel->Version = 2; - } - - if (UdpAccelInitClient(sess->UdpAccel, - sess->UdpAccel->Version == 2 ? udp_acceleration_server_key_v2 : udp_acceleration_server_key, - &udp_acceleration_server_ip, udp_acceleration_server_port, - server_cookie, client_cookie, &remote_ip) == false) - { - Debug("UdpAccelInitClient failed.\n"); - } - else - { - sess->UseUdpAcceleration = true; - - sess->UdpAccel->FastDetect = sess->UdpAccelFastDisconnectDetect; - - sess->UdpAccel->PlainTextMode = !encryption; - - sess->UseHMacOnUdpAcceleration = PackGetBool(p, "use_hmac_on_udp_acceleration"); - - if (sess->UseHMacOnUdpAcceleration) - { - sess->UdpAccel->UseHMac = true; - } - - AddProtocolDetailsKeyValueInt(sess->ProtocolDetails, sizeof(sess->ProtocolDetails), "UDPAccel_Ver", sess->UdpAccel->Version); - - AddProtocolDetailsStr(sess->ProtocolDetails, sizeof(sess->ProtocolDetails), sess->UdpAccel->Version > 1 ? "ChaCha20-Poly1305" : "RC4"); - - AddProtocolDetailsKeyValueInt(sess->ProtocolDetails, sizeof(sess->ProtocolDetails), "UDPAccel_MSS", UdpAccelCalcMss(sess->UdpAccel)); - } - } - } - } - } - } - } - Unlock(c->Session->lock); - - Debug("UseUdpAcceleration = %u\n", sess->UseUdpAcceleration); - - if (sess->UseUdpAcceleration == false) - { - if (sess->UdpAccel != NULL) - { - FreeUdpAccel(sess->UdpAccel); - sess->UdpAccel = NULL; - } - } - - Lock(c->lock); - { - if (c->Name != NULL) - { - Free(c->Name); - } - c->Name = CopyStr(connection_name); - - // Save the name of a cryptographic algorithm - if (c->CipherName != NULL) - { - Free(c->CipherName); - } - - c->CipherName = CopyStr(c->FirstSock->CipherName); - } - Unlock(c->lock); - - Lock(c->Session->lock); - { - if (c->Session->Name != NULL) - { - Free(c->Session->Name); - } - c->Session->Name = CopyStr(session_name); - - c->Session->Policy = policy; - } - Unlock(c->Session->lock); - - // Discard the Welcome packet - FreePack(p); - p = NULL; - - - // Connection establishment - c->Session->ClientStatus = CLIENT_STATUS_ESTABLISHED; - - // Save the server certificate - if (c->ServerX == NULL) - { - c->ServerX = CloneX(c->FirstSock->RemoteX); - } - - PrintStatus(sess, _UU("STATUS_9")); -#ifdef OS_UNIX - UnixVLanSetState(c->Session->ClientOption->DeviceName, true); -#endif - // Shift the connection to the tunneling mode - StartTunnelingMode(c); - s = NULL; - - if (c->Session->HalfConnection) - { - // Processing in the case of half-connection - TCPSOCK *ts = (TCPSOCK *)LIST_DATA(c->Tcp->TcpSockList, 0); - ts->Direction = TCP_CLIENT_TO_SERVER; - } - - PrintStatus(sess, L"free"); - - CLog(c->Cedar->Client, "LC_CONNECT_2", c->Session->ClientOption->AccountName, - session_name); - - if (c->Session->LinkModeClient && c->Session->Link != NULL) - { - HLog(c->Session->Link->Hub, "LH_CONNECT_2", c->Session->ClientOption->AccountName, session_name); - } - - // Main routine of the session - SessionMain(c->Session); - - ok = true; - - if (c->Err == ERR_USER_CANCEL) - { - ret = true; - } - -CLEANUP: - c->FirstSock = NULL; - - if (sess->UdpAccel != NULL) - { - FreeUdpAccel(sess->UdpAccel); - sess->UdpAccel = NULL; - } - - if (p != NULL) - { - FreePack(p); - } - - Disconnect(s); - ReleaseSock(s); - - Debug("Error: %u\n", c->Err); - - if (ok == false) - { - PrintStatus(sess, L"free"); - } - - return ret; -} - -// Parse the Welcome packet -bool ParseWelcomeFromPack(PACK *p, char *session_name, UINT session_name_size, - char *connection_name, UINT connection_name_size, - POLICY **policy) -{ - // Validate arguments - if (p == NULL || session_name == NULL || connection_name == NULL || policy == NULL) - { - return false; - } - - // Session name - if (PackGetStr(p, "session_name", session_name, session_name_size) == false) - { - return false; - } - - // Connection name - if (PackGetStr(p, "connection_name", connection_name, connection_name_size) == false) - { - return false; - } - - // Policy - *policy = PackGetPolicy(p); - if (*policy == NULL) - { - return false; - } - - return true; -} - -// Generate the Welcome packet -PACK *PackWelcome(SESSION *s) -{ - PACK *p; - // Validate arguments - if (s == NULL) - { - return NULL; - } - - p = NewPack(); - - // Session name - PackAddStr(p, "session_name", s->Name); - - // Connection name - PackAddStr(p, "connection_name", s->Connection->Name); - - // Parameters - PackAddInt(p, "max_connection", s->MaxConnection); - PackAddInt(p, "use_encrypt", s->UseEncrypt == false ? 0 : 1); - PackAddInt(p, "use_compress", s->UseCompress == false ? 0 : 1); - PackAddInt(p, "half_connection", s->HalfConnection == false ? 0 : 1); - PackAddInt(p, "timeout", s->Timeout); - PackAddInt(p, "qos", s->QoS ? 1 : 0); - PackAddInt(p, "is_azure_session", s->IsAzureSession); - - // Session key - PackAddData(p, "session_key", s->SessionKey, SHA1_SIZE); - PackAddInt(p, "session_key_32", s->SessionKey32); - - // Policy - PackAddPolicy(p, s->Policy); - - // VLAN ID - PackAddInt(p, "vlan_id", s->VLanId); - - if (s->Connection->Protocol == CONNECTION_UDP) - { - // In the case of UDP protocol, generate 2 pairs of key - Rand(s->UdpSendKey, sizeof(s->UdpSendKey)); - Rand(s->UdpRecvKey, sizeof(s->UdpRecvKey)); - - // Send to client by exchanging 2 keys - PackAddData(p, "udp_send_key", s->UdpRecvKey, sizeof(s->UdpRecvKey)); - PackAddData(p, "udp_recv_key", s->UdpSendKey, sizeof(s->UdpSendKey)); - } - - // no_send_signature - if (s->NoSendSignature) - { - PackAddBool(p, "no_send_signature", true); - } - - if (s->InProcMode) - { - // MAC address for IPC - PackAddData(p, "IpcMacAddress", s->IpcMacAddress, 6); - - // Virtual HUB name - PackAddStr(p, "IpcHubName", s->Hub->Name); - - // Shared Buffer - s->IpcSessionSharedBuffer = NewSharedBuffer(NULL, sizeof(IPC_SESSION_SHARED_BUFFER_DATA)); - AddRef(s->IpcSessionSharedBuffer->Ref); - - s->IpcSessionShared = s->IpcSessionSharedBuffer->Data; - - PackAddInt64(p, "IpcSessionSharedBuffer", (UINT64)s->IpcSessionSharedBuffer); - } - - if (s->UdpAccel != NULL) - { - // UDP acceleration function - PackAddBool(p, "use_udp_acceleration", true); - PackAddInt(p, "udp_acceleration_version", s->UdpAccel->Version); - PackAddIp(p, "udp_acceleration_server_ip", &s->UdpAccel->MyIp); - PackAddInt(p, "udp_acceleration_server_port", s->UdpAccel->MyPort); - PackAddData(p, "udp_acceleration_server_key", s->UdpAccel->MyKey, sizeof(s->UdpAccel->MyKey)); - PackAddData(p, "udp_acceleration_server_key_v2", s->UdpAccel->MyKey_V2, sizeof(s->UdpAccel->MyKey_V2)); - PackAddInt(p, "udp_acceleration_server_cookie", s->UdpAccel->MyCookie); - PackAddInt(p, "udp_acceleration_client_cookie", s->UdpAccel->YourCookie); - PackAddBool(p, "udp_acceleration_use_encryption", !s->UdpAccel->PlainTextMode); - PackAddBool(p, "use_hmac_on_udp_acceleration", s->UdpAccel->UseHMac); - PackAddBool(p, "udp_accel_fast_disconnect_detect", s->UdpAccelFastDisconnectDetect); - } - - if (s->EnableBulkOnRUDP) - { - // Allow bulk transfer on R-UDP - PackAddBool(p, "enable_bulk_on_rudp", true); - PackAddBool(p, "enable_hmac_on_bulk_of_rudp", s->EnableHMacOnBulkOfRUDP); - PackAddInt(p, "rudp_bulk_version", s->BulkOnRUDPVersion); - - if (s->BulkOnRUDPVersion == 2) - { - PackAddData(p, "bulk_on_rudp_send_key", s->Connection->FirstSock->BulkRecvKey->Data, RUDP_BULK_KEY_SIZE_V2); - s->Connection->FirstSock->BulkRecvKey->Size = RUDP_BULK_KEY_SIZE_V2; - - PackAddData(p, "bulk_on_rudp_recv_key", s->Connection->FirstSock->BulkSendKey->Data, RUDP_BULK_KEY_SIZE_V2); - s->Connection->FirstSock->BulkSendKey->Size = RUDP_BULK_KEY_SIZE_V2; - } - else - { - PackAddData(p, "bulk_on_rudp_send_key", s->Connection->FirstSock->BulkRecvKey->Data, SHA1_SIZE); - s->Connection->FirstSock->BulkRecvKey->Size = SHA1_SIZE; - - PackAddData(p, "bulk_on_rudp_recv_key", s->Connection->FirstSock->BulkSendKey->Data, SHA1_SIZE); - s->Connection->FirstSock->BulkSendKey->Size = SHA1_SIZE; - } - - // Backup R-UDP bulk send/recv keys for additional connections - Copy(s->BulkSendKey, s->Connection->FirstSock->BulkSendKey->Data, - s->Connection->FirstSock->BulkSendKey->Size); - - s->BulkSendKeySize = s->Connection->FirstSock->BulkSendKey->Size; - - Copy(s->BulkRecvKey, s->Connection->FirstSock->BulkRecvKey->Data, - s->Connection->FirstSock->BulkRecvKey->Size); - - s->BulkRecvKeySize = s->Connection->FirstSock->BulkRecvKey->Size; - } - - if (s->IsAzureSession) - { - if (s->Connection != NULL && s->Connection->FirstSock != NULL) - { - SOCK *sock = s->Connection->FirstSock; - - PackAddIp(p, "azure_real_server_global_ip", &sock->Reverse_MyServerGlobalIp); - } - } - - PackAddBool(p, "enable_udp_recovery", s->EnableUdpRecovery); - - return p; -} - -#define PACK_ADD_POLICY_BOOL(name, value) \ - PackAddBool(p, "policy:" name, y->value == false ? 0 : 1) -#define PACK_ADD_POLICY_UINT(name, value) \ - PackAddInt(p, "policy:" name, y->value) -#define PACK_GET_POLICY_BOOL(name, value) \ - y->value = (PackGetBool(p, "policy:" name)) -#define PACK_GET_POLICY_UINT(name, value) \ - y->value = PackGetInt(p, "policy:" name) - -// Get a PACK from the session key -bool GetSessionKeyFromPack(PACK *p, UCHAR *session_key, UINT *session_key_32) -{ - // Validate arguments - if (p == NULL || session_key == NULL || session_key_32 == NULL) - { - return false; - } - - if (PackGetDataSize(p, "session_key") != SHA1_SIZE) - { - return false; - } - if (PackGetData(p, "session_key", session_key) == false) - { - return false; - } - *session_key_32 = PackGetInt(p, "session_key_32"); - - return true; -} - -// Get the policy from the PACK -POLICY *PackGetPolicy(PACK *p) -{ - POLICY *y; - // Validate arguments - if (p == NULL) - { - return NULL; - } - - y = ZeroMalloc(sizeof(POLICY)); - - // Bool value - // Ver 2 - PACK_GET_POLICY_BOOL("Access", Access); - PACK_GET_POLICY_BOOL("DHCPFilter", DHCPFilter); - PACK_GET_POLICY_BOOL("DHCPNoServer", DHCPNoServer); - PACK_GET_POLICY_BOOL("DHCPForce", DHCPForce); - PACK_GET_POLICY_BOOL("NoBridge", NoBridge); - PACK_GET_POLICY_BOOL("NoRouting", NoRouting); - PACK_GET_POLICY_BOOL("PrivacyFilter", PrivacyFilter); - PACK_GET_POLICY_BOOL("NoServer", NoServer); - PACK_GET_POLICY_BOOL("CheckMac", CheckMac); - PACK_GET_POLICY_BOOL("CheckIP", CheckIP); - PACK_GET_POLICY_BOOL("ArpDhcpOnly", ArpDhcpOnly); - PACK_GET_POLICY_BOOL("MonitorPort", MonitorPort); - PACK_GET_POLICY_BOOL("NoBroadcastLimiter", NoBroadcastLimiter); - PACK_GET_POLICY_BOOL("FixPassword", FixPassword); - PACK_GET_POLICY_BOOL("NoQoS", NoQoS); - // Ver 3 - PACK_GET_POLICY_BOOL("RSandRAFilter", RSandRAFilter); - PACK_GET_POLICY_BOOL("RAFilter", RAFilter); - PACK_GET_POLICY_BOOL("DHCPv6Filter", DHCPv6Filter); - PACK_GET_POLICY_BOOL("DHCPv6NoServer", DHCPv6NoServer); - PACK_GET_POLICY_BOOL("NoRoutingV6", NoRoutingV6); - PACK_GET_POLICY_BOOL("CheckIPv6", CheckIPv6); - PACK_GET_POLICY_BOOL("NoServerV6", NoServerV6); - PACK_GET_POLICY_BOOL("NoSavePassword", NoSavePassword); - PACK_GET_POLICY_BOOL("FilterIPv4", FilterIPv4); - PACK_GET_POLICY_BOOL("FilterIPv6", FilterIPv6); - PACK_GET_POLICY_BOOL("FilterNonIP", FilterNonIP); - PACK_GET_POLICY_BOOL("NoIPv6DefaultRouterInRA", NoIPv6DefaultRouterInRA); - PACK_GET_POLICY_BOOL("NoIPv6DefaultRouterInRAWhenIPv6", NoIPv6DefaultRouterInRAWhenIPv6); - - // UINT value - // Ver 2 - PACK_GET_POLICY_UINT("MaxConnection", MaxConnection); - PACK_GET_POLICY_UINT("TimeOut", TimeOut); - PACK_GET_POLICY_UINT("MaxMac", MaxMac); - PACK_GET_POLICY_UINT("MaxIP", MaxIP); - PACK_GET_POLICY_UINT("MaxUpload", MaxUpload); - PACK_GET_POLICY_UINT("MaxDownload", MaxDownload); - PACK_GET_POLICY_UINT("MultiLogins", MultiLogins); - // Ver 3 - PACK_GET_POLICY_UINT("MaxIPv6", MaxIPv6); - PACK_GET_POLICY_UINT("AutoDisconnect", AutoDisconnect); - PACK_GET_POLICY_UINT("VLanId", VLanId); - - // Ver 3 flag - PACK_GET_POLICY_BOOL("Ver3", Ver3); - - return y; -} - -// Insert the policy into the PACK -void PackAddPolicy(PACK *p, POLICY *y) -{ - // Validate arguments - if (p == NULL || y == NULL) - { - return; - } - - // Bool value - // Ver 2 - PACK_ADD_POLICY_BOOL("Access", Access); - PACK_ADD_POLICY_BOOL("DHCPFilter", DHCPFilter); - PACK_ADD_POLICY_BOOL("DHCPNoServer", DHCPNoServer); - PACK_ADD_POLICY_BOOL("DHCPForce", DHCPForce); - PACK_ADD_POLICY_BOOL("NoBridge", NoBridge); - PACK_ADD_POLICY_BOOL("NoRouting", NoRouting); - PACK_ADD_POLICY_BOOL("PrivacyFilter", PrivacyFilter); - PACK_ADD_POLICY_BOOL("NoServer", NoServer); - PACK_ADD_POLICY_BOOL("CheckMac", CheckMac); - PACK_ADD_POLICY_BOOL("CheckIP", CheckIP); - PACK_ADD_POLICY_BOOL("ArpDhcpOnly", ArpDhcpOnly); - PACK_ADD_POLICY_BOOL("MonitorPort", MonitorPort); - PACK_ADD_POLICY_BOOL("NoBroadcastLimiter", NoBroadcastLimiter); - PACK_ADD_POLICY_BOOL("FixPassword", FixPassword); - PACK_ADD_POLICY_BOOL("NoQoS", NoQoS); - // Ver 3 - PACK_ADD_POLICY_BOOL("RSandRAFilter", RSandRAFilter); - PACK_ADD_POLICY_BOOL("RAFilter", RAFilter); - PACK_ADD_POLICY_BOOL("DHCPv6Filter", DHCPv6Filter); - PACK_ADD_POLICY_BOOL("DHCPv6NoServer", DHCPv6NoServer); - PACK_ADD_POLICY_BOOL("NoRoutingV6", NoRoutingV6); - PACK_ADD_POLICY_BOOL("CheckIPv6", CheckIPv6); - PACK_ADD_POLICY_BOOL("NoServerV6", NoServerV6); - PACK_ADD_POLICY_BOOL("NoSavePassword", NoSavePassword); - PACK_ADD_POLICY_BOOL("FilterIPv4", FilterIPv4); - PACK_ADD_POLICY_BOOL("FilterIPv6", FilterIPv6); - PACK_ADD_POLICY_BOOL("FilterNonIP", FilterNonIP); - PACK_ADD_POLICY_BOOL("NoIPv6DefaultRouterInRA", NoIPv6DefaultRouterInRA); - PACK_ADD_POLICY_BOOL("NoIPv6DefaultRouterInRAWhenIPv6", NoIPv6DefaultRouterInRAWhenIPv6); - - // UINT value - // Ver 2 - PACK_ADD_POLICY_UINT("MaxConnection", MaxConnection); - PACK_ADD_POLICY_UINT("TimeOut", TimeOut); - PACK_ADD_POLICY_UINT("MaxMac", MaxMac); - PACK_ADD_POLICY_UINT("MaxIP", MaxIP); - PACK_ADD_POLICY_UINT("MaxUpload", MaxUpload); - PACK_ADD_POLICY_UINT("MaxDownload", MaxDownload); - PACK_ADD_POLICY_UINT("MultiLogins", MultiLogins); - // Ver 3 - PACK_ADD_POLICY_UINT("MaxIPv6", MaxIPv6); - PACK_ADD_POLICY_UINT("AutoDisconnect", AutoDisconnect); - PACK_ADD_POLICY_UINT("VLanId", VLanId); - - // Ver 3 flag - PackAddBool(p, "policy:Ver3", true); -} - -// Upload the authentication data for the additional connection -bool ClientUploadAuth2(CONNECTION *c, SOCK *s) -{ - PACK *p = NULL; - // Validate arguments - if (c == NULL) - { - return false; - } - - p = PackAdditionalConnect(c->Session->SessionKey); - - PackAddClientVersion(p, c); - - if (HttpClientSend(s, p) == false) - { - FreePack(p); - return false; - } - FreePack(p); - - return true; -} - -// Send a NOOP -void ClientUploadNoop(CONNECTION *c) -{ - PACK *p; - // Validate arguments - if (c == NULL) - { - return; - } - - p = PackError(0); - PackAddInt(p, "noop", 1); - (void)HttpClientSend(c->FirstSock, p); - FreePack(p); - - p = HttpClientRecv(c->FirstSock); - if (p != NULL) - { - FreePack(p); - } -} - -// Add client version information to the PACK -void PackAddClientVersion(PACK *p, CONNECTION *c) -{ - // Validate arguments - if (p == NULL || c == NULL) - { - return; - } - - PackAddStr(p, "client_str", c->ClientStr); - PackAddInt(p, "client_ver", c->ClientVer); - PackAddInt(p, "client_build", c->ClientBuild); -} - -// Upload the certificate data for the new connection -bool ClientUploadAuth(CONNECTION *c) -{ - PACK *p = NULL; - CLIENT_AUTH *a; - CLIENT_OPTION *o; - X *x; - bool ret; - NODE_INFO info; - UCHAR secure_password[SHA1_SIZE]; - UCHAR sign[4096 / 8]; - UCHAR unique[SHA1_SIZE]; - RPC_WINVER v; - // Validate arguments - if (c == NULL) - { - return false; - } - - Zero(sign, sizeof(sign)); - - a = c->Session->ClientAuth; - o = c->Session->ClientOption; - - if (c->UseTicket == false) - { - switch (a->AuthType) - { - case CLIENT_AUTHTYPE_ANONYMOUS: - // Anonymous authentication - p = PackLoginWithAnonymous(o->HubName, a->Username); - break; - - case CLIENT_AUTHTYPE_PASSWORD: - // Password authentication - SecurePassword(secure_password, a->HashedPassword, c->Random); - p = PackLoginWithPassword(o->HubName, a->Username, secure_password); - break; - - case CLIENT_AUTHTYPE_PLAIN_PASSWORD: - // Plaintext password authentication - p = PackLoginWithPlainPassword(o->HubName, a->Username, a->PlainPassword); - break; - - case CLIENT_AUTHTYPE_CERT: - // Certificate authentication - if (a->ClientX != NULL && a->ClientX->is_compatible_bit && - a->ClientX->bits != 0 && (a->ClientX->bits / 8) <= sizeof(sign)) - { - if (RsaSignEx(sign, c->Random, SHA1_SIZE, a->ClientK, a->ClientX->bits)) - { - p = PackLoginWithCert(o->HubName, a->Username, a->ClientX, sign, a->ClientX->bits / 8); - c->ClientX = CloneX(a->ClientX); - } - } - break; - - case CLIENT_AUTHTYPE_OPENSSLENGINE: - // Certificate authentication - if (a->ClientX != NULL && a->ClientX->is_compatible_bit && - a->ClientX->bits != 0 && (a->ClientX->bits / 8) <= sizeof(sign)) - { - if (RsaSignEx(sign, c->Random, SHA1_SIZE, a->ClientK, a->ClientX->bits)) - { - p = PackLoginWithCert(o->HubName, a->Username, a->ClientX, sign, a->ClientX->bits / 8); - c->ClientX = CloneX(a->ClientX); - } - } - break; - - - case CLIENT_AUTHTYPE_SECURE: - // Authentication by secure device - if (ClientSecureSign(c, sign, c->Random, &x)) - { - p = PackLoginWithCert(o->HubName, a->Username, x, sign, x->bits / 8); - c->ClientX = CloneX(x); - FreeX(x); - } - else - { - c->Err = ERR_SECURE_DEVICE_OPEN_FAILED; - c->Session->ForceStopFlag = true; - } - break; - } - } - else - { - // Ticket - p = NewPack(); - PackAddStr(p, "method", "login"); - PackAddStr(p, "hubname", o->HubName); - PackAddStr(p, "username", a->Username); - PackAddInt(p, "authtype", AUTHTYPE_TICKET); - PackAddData(p, "ticket", c->Ticket, SHA1_SIZE); - } - - if (p == NULL) - { - // Error - if (c->Err != ERR_SECURE_DEVICE_OPEN_FAILED) - { - c->Err = ERR_PROTOCOL_ERROR; - } - return false; - } - - PackAddClientVersion(p, c); - - // Protocol - PackAddInt(p, "protocol", c->Protocol); - - // Version, etc. - PackAddStr(p, "hello", c->ClientStr); - PackAddInt(p, "version", c->ClientVer); - PackAddInt(p, "build", c->ClientBuild); - PackAddInt(p, "client_id", c->Cedar->ClientId); - - // The maximum number of connections - PackAddInt(p, "max_connection", o->MaxConnection); - // Flag to use of cryptography - PackAddInt(p, "use_encrypt", o->UseEncrypt == false ? 0 : 1); - // Data compression flag - PackAddInt(p, "use_compress", o->UseCompress == false ? 0 : 1); - // Half connection flag - PackAddInt(p, "half_connection", o->HalfConnection == false ? 0 : 1); - - // Bridge / routing mode flag - PackAddBool(p, "require_bridge_routing_mode", o->RequireBridgeRoutingMode); - - // Monitor mode flag - PackAddBool(p, "require_monitor_mode", o->RequireMonitorMode); - - // VoIP / QoS flag - PackAddBool(p, "qos", o->DisableQoS ? false : true); - - // Bulk transfer support - PackAddBool(p, "support_bulk_on_rudp", true); - PackAddBool(p, "support_hmac_on_bulk_of_rudp", true); - - // UDP recovery support - PackAddBool(p, "support_udp_recovery", true); - - // Unique ID - GenerateMachineUniqueHash(unique); - PackAddData(p, "unique_id", unique, SHA1_SIZE); - - // UDP acceleration function using flag - if (o->NoUdpAcceleration == false && c->Session->UdpAccel != NULL) - { - IP my_ip; - - Zero(&my_ip, sizeof(my_ip)); - - PackAddBool(p, "use_udp_acceleration", true); - - PackAddInt(p, "udp_acceleration_version", c->Session->UdpAccel->Version); - - Copy(&my_ip, &c->Session->UdpAccel->MyIp, sizeof(IP)); - if (IsLocalHostIP(&my_ip)) - { - if (IsIP4(&my_ip)) - { - ZeroIP4(&my_ip); - } - else - { - ZeroIP6(&my_ip); - } - } - - PackAddIp(p, "udp_acceleration_client_ip", &my_ip); - PackAddInt(p, "udp_acceleration_client_port", c->Session->UdpAccel->MyPort); - PackAddData(p, "udp_acceleration_client_key", c->Session->UdpAccel->MyKey, UDP_ACCELERATION_COMMON_KEY_SIZE_V1); - PackAddData(p, "udp_acceleration_client_key_v2", c->Session->UdpAccel->MyKey_V2, UDP_ACCELERATION_COMMON_KEY_SIZE_V2); - PackAddBool(p, "support_hmac_on_udp_acceleration", true); - PackAddBool(p, "support_udp_accel_fast_disconnect_detect", true); - PackAddInt(p, "udp_acceleration_max_version", 2); - } - - PackAddInt(p, "rudp_bulk_max_version", 2); - - // Brand string for the connection limit - { - char *branded_ctos = _SS("BRANDED_C_TO_S"); - if(StrLen(branded_ctos) > 0) - { - PackAddStr(p, "branded_ctos", branded_ctos); - } - } - - // Node information - CreateNodeInfo(&info, c); - OutRpcNodeInfo(p, &info); - - // OS information - GetWinVer(&v); - OutRpcWinVer(p, &v); - - ret = HttpClientSend(c->FirstSock, p); - if (ret == false) - { - c->Err = ERR_DISCONNECTED; - } - - FreePack(p); - - return ret; -} - -// Upload the Hello packet -bool ServerUploadHello(CONNECTION *c) -{ - PACK *p; - // Validate arguments - if (c == NULL) - { - return false; - } - - // Random number generation - Rand(c->Random, SHA1_SIZE); - - p = PackHello(c->Random, c->ServerVer, c->ServerBuild, c->ServerStr); - if (HttpServerSend(c->FirstSock, p) == false) - { - FreePack(p); - c->Err = ERR_DISCONNECTED; - return false; - } - - FreePack(p); - - return true; -} - -// Download the Hello packet -bool ClientDownloadHello(CONNECTION *c, SOCK *s) -{ - PACK *p; - UINT err; - UCHAR random[SHA1_SIZE]; - // Validate arguments - if (c == NULL) - { - return false; - } - - // Data reception - p = HttpClientRecv(s); - if (p == NULL) - { - c->Err = ERR_SERVER_IS_NOT_VPN; - return false; - } - - if (err = GetErrorFromPack(p)) - { - // An error has occured - c->Err = err; - FreePack(p); - return false; - } - - // Packet interpretation - if (GetHello(p, random, &c->ServerVer, &c->ServerBuild, c->ServerStr, sizeof(c->ServerStr)) == false) - { - c->Err = ERR_SERVER_IS_NOT_VPN; - FreePack(p); - return false; - } - - if (c->FirstSock == s) - { - Copy(c->Random, random, SHA1_SIZE); - } - - FreePack(p); - - return true; -} - -// Download the signature -bool ServerDownloadSignature(CONNECTION *c, char **error_detail_str) -{ - HTTP_HEADER *h; - UCHAR *data; - UINT data_size; - SOCK *s; - UINT num = 0, max = 19; - SERVER *server; - char *vpn_http_target = HTTP_VPN_TARGET2; - // Validate arguments - if (c == NULL) - { - return false; - } - - server = c->Cedar->Server; - - s = c->FirstSock; - - while (true) - { - bool not_found_error = false; - - num++; - if (num > max) - { - // Disconnect - Disconnect(s); - c->Err = ERR_CLIENT_IS_NOT_VPN; - - *error_detail_str = "HTTP_TOO_MANY_REQUEST"; - return false; - } - // Receive a header - h = RecvHttpHeader(s); - if (h == NULL) - { - c->Err = ERR_CLIENT_IS_NOT_VPN; - if (c->IsJsonRpc) - { - c->Err = ERR_DISCONNECTED; - } - return false; - } - - // Interpret - if (StrCmpi(h->Method, "POST") == 0) - { - // Receive the data since it's POST - data_size = GetContentLength(h); - - if (server->DisableJsonRpcWebApi == false) - { - if (StrCmpi(h->Target, "/api") == 0 || StrCmpi(h->Target, "/api/") == 0) - { - c->IsJsonRpc = true; - c->Type = CONNECTION_TYPE_ADMIN_RPC; - - JsonRpcProcPost(c, s, h, data_size); - - FreeHttpHeader(h); - - if (c->JsonRpcAuthed) - { - num = 0; - } - - continue; - } - else if (StartWith(h->Target, "/admin")) - { - c->IsJsonRpc = true; - c->Type = CONNECTION_TYPE_ADMIN_RPC; - - AdminWebProcPost(c, s, h, data_size, h->Target); - - FreeHttpHeader(h); - - if (c->JsonRpcAuthed) - { - num = 0; - } - - continue; - } - } - - if ((data_size > MAX_WATERMARK_SIZE || data_size < SizeOfWaterMark()) && (data_size != StrLen(HTTP_VPN_TARGET_POSTDATA))) - { - // Data is too large - HttpSendForbidden(s, h->Target, NULL); - FreeHttpHeader(h); - c->Err = ERR_CLIENT_IS_NOT_VPN; - *error_detail_str = "POST_Recv_TooLong"; - return false; - } - data = Malloc(data_size); - if (RecvAll(s, data, data_size, s->SecureMode) == false) - { - // Data reception failure - Free(data); - FreeHttpHeader(h); - c->Err = ERR_DISCONNECTED; - *error_detail_str = "POST_Recv_Failed"; - return false; - } - // Check the Target - if ((StrCmpi(h->Target, vpn_http_target) != 0) || not_found_error) - { - // Target is invalid - HttpSendNotFound(s, h->Target); - Free(data); - FreeHttpHeader(h); - *error_detail_str = "POST_Target_Wrong"; - } - else - { - // Compare posted data with the WaterMark - if ((data_size == StrLen(HTTP_VPN_TARGET_POSTDATA) && (Cmp(data, HTTP_VPN_TARGET_POSTDATA, data_size) == 0)) - || ((data_size >= SizeOfWaterMark()) && Cmp(data, WaterMark, SizeOfWaterMark()) == 0)) - { - // Check the WaterMark - Free(data); - FreeHttpHeader(h); - return true; - } - else - { - // WaterMark is incorrect - HttpSendForbidden(s, h->Target, NULL); - FreeHttpHeader(h); - *error_detail_str = "POST_WaterMark_Error"; - } - } - } - else if (StrCmpi(h->Method, "OPTIONS") == 0) - { - if (server->DisableJsonRpcWebApi == false) - { - if (StrCmpi(h->Target, "/api") == 0 || StrCmpi(h->Target, "/api/") == 0 || StartWith(h->Target, "/admin")) - { - c->IsJsonRpc = true; - c->Type = CONNECTION_TYPE_ADMIN_RPC; - - JsonRpcProcOptions(c, s, h, h->Target); - - FreeHttpHeader(h); - - num = 0; - - continue; - } - } - } - else if (StrCmpi(h->Method, "SSTP_DUPLEX_POST") == 0 && (ProtoEnabled(server->Proto, "SSTP") || s->IsReverseAcceptedSocket) && GetServerCapsBool(server, "b_support_sstp")) - { - // SSTP client is connected - c->WasSstp = true; - - if (StrCmpi(h->Target, SSTP_URI) == 0) - { - bool sstp_ret; - // Accept the SSTP connection - c->Type = CONNECTION_TYPE_OTHER; - - sstp_ret = ProtoHandleConnection(server->Proto, s, "SSTP"); - - c->Err = ERR_DISCONNECTED; - FreeHttpHeader(h); - - if (sstp_ret) - { - *error_detail_str = ""; - } - else - { - *error_detail_str = "SSTP_ABORT"; - } - - return false; - } - else - { - // URI is invalid - HttpSendNotFound(s, h->Target); - *error_detail_str = "SSTP_URL_WRONG"; - } - - FreeHttpHeader(h); - } - else - { - // This should not be a VPN client, but interpret a bit more - if (StrCmpi(h->Method, "GET") != 0 && StrCmpi(h->Method, "HEAD") != 0 - && StrCmpi(h->Method, "POST") != 0) - { - // Unsupported method calls - HttpSendNotImplemented(s, h->Method, h->Target, h->Version); - *error_detail_str = "HTTP_BAD_METHOD"; - } - else - { - if (StrCmpi(h->Target, "/") == 0) - { - // Root directory - BUF *b = NULL; - *error_detail_str = "HTTP_ROOT"; - - if (server->DisableJsonRpcWebApi == false) - { - b = ReadDump("|wwwroot\\index.html"); - } - - if (b != NULL) - { - FreeHttpHeader(h); - h = NewHttpHeader("HTTP/1.1", "202", "OK"); - AddHttpValue(h, NewHttpValue("Content-Type", HTTP_CONTENT_TYPE4)); - AddHttpValue(h, NewHttpValue("Connection", "Keep-Alive")); - AddHttpValue(h, NewHttpValue("Keep-Alive", HTTP_KEEP_ALIVE)); - - PostHttp(c->FirstSock, h, b->Buf, b->Size); - - FreeBuf(b); - } - else - { - HttpSendForbidden(c->FirstSock, h->Target, ""); - } - } - else - { - bool b = false; - - // Show the WebUI if the configuration allow to use the WebUI - if (c->Cedar->Server != NULL && c->Cedar->Server->UseWebUI) - { - WU_WEBPAGE *page; - - // Show the WebUI - page = WuGetPage(h->Target, c->Cedar->WebUI); - - if (page != NULL) - { - PostHttp(s, page->header, page->data, page->size); - b = true; - WuFreeWebPage(page); - } - - } - - if (c->FirstSock->RemoteIP.addr[0] == 127) - { - if (StrCmpi(h->Target, HTTP_SAITAMA) == 0) - { - // Saitama (joke) - FreeHttpHeader(h); - h = NewHttpHeader("HTTP/1.1", "202", "OK"); - AddHttpValue(h, NewHttpValue("Content-Type", HTTP_CONTENT_TYPE3)); - AddHttpValue(h, NewHttpValue("Connection", "Keep-Alive")); - AddHttpValue(h, NewHttpValue("Keep-Alive", HTTP_KEEP_ALIVE)); - PostHttp(s, h, Saitama, SizeOfSaitama()); - b = true; - } - else if (StartWith(h->Target, HTTP_PICTURES)) - { - BUF *buf; - - // Lots of photos - buf = ReadDump("|Pictures.mht"); - - if (buf != NULL) - { - FreeHttpHeader(h); - h = NewHttpHeader("HTTP/1.1", "202", "OK"); - AddHttpValue(h, NewHttpValue("Content-Type", HTTP_CONTENT_TYPE5)); - AddHttpValue(h, NewHttpValue("Connection", "Keep-Alive")); - AddHttpValue(h, NewHttpValue("Keep-Alive", HTTP_KEEP_ALIVE)); - PostHttp(s, h, buf->Buf, buf->Size); - b = true; - - FreeBuf(buf); - } - } - } - - if (b == false) - { - if (server->DisableJsonRpcWebApi == false) - { - if (StartWith(h->Target, "/api?") || StartWith(h->Target, "/api/") || StrCmpi(h->Target, "/api") == 0) - { - c->IsJsonRpc = true; - c->Type = CONNECTION_TYPE_ADMIN_RPC; - - JsonRpcProcGet(c, s, h, h->Target); - - if (c->JsonRpcAuthed) - { - num = 0; - } - - FreeHttpHeader(h); - - continue; - } - else if (StartWith(h->Target, "/admin")) - { - c->IsJsonRpc = true; - c->Type = CONNECTION_TYPE_ADMIN_RPC; - - AdminWebProcGet(c, s, h, h->Target); - - if (c->JsonRpcAuthed) - { - num = 0; - } - - FreeHttpHeader(h); - - continue; - } - } - } - - if (b == false) - { - // Not Found - HttpSendNotFound(s, h->Target); - - *error_detail_str = "HTTP_NOT_FOUND"; - } - } - } - FreeHttpHeader(h); - } - } -} - -// Upload a signature -bool ClientUploadSignature(SOCK *s) -{ - HTTP_HEADER *h; - UINT water_size, rand_size; - UCHAR *water; - char ip_str[128]; - // Validate arguments - if (s == NULL) - { - return false; - } - - IPToStr(ip_str, sizeof(ip_str), &s->RemoteIP); - - h = NewHttpHeader("POST", HTTP_VPN_TARGET2, "HTTP/1.1"); - AddHttpValue(h, NewHttpValue("Host", ip_str)); - AddHttpValue(h, NewHttpValue("Content-Type", HTTP_CONTENT_TYPE3)); - AddHttpValue(h, NewHttpValue("Connection", "Keep-Alive")); - - - - // Generate a watermark - rand_size = Rand32() % (HTTP_PACK_RAND_SIZE_MAX * 2); - water_size = SizeOfWaterMark() + rand_size; - water = Malloc(water_size); - Copy(water, WaterMark, SizeOfWaterMark()); - Rand(&water[SizeOfWaterMark()], rand_size); - - // Upload the watermark data - if (PostHttp(s, h, water, water_size) == false) - { - Free(water); - FreeHttpHeader(h); - return false; - } - - Free(water); - FreeHttpHeader(h); - - return true; -} - -// Establish a connection to the server -SOCK *ClientConnectToServer(CONNECTION *c) -{ - SOCK *s = NULL; - X *x = NULL; - K *k = NULL; - // Validate arguments - if (c == NULL) - { - return NULL; - } - - if (c->Halt) - { - c->Err = ERR_USER_CANCEL; - return NULL; - } - - // Get the socket by connecting - s = ClientConnectGetSocket(c, false); - if (s == NULL) - { - // Connection failure - return NULL; - } - - c->FirstSock = s; - - if (c->Halt) - { - c->Err = ERR_USER_CANCEL; - ReleaseSock(s); - c->FirstSock = NULL; - return NULL; - } - - // Time-out - SetTimeout(s, CONNECTING_TIMEOUT); - - // Start the SSL communication - if (StartSSLEx(s, x, k, 0, c->ServerName) == false) - { - // SSL communication start failure - Disconnect(s); - ReleaseSock(s); - c->FirstSock = NULL; - c->Err = ERR_SERVER_IS_NOT_VPN; - return NULL; - } - - if (s->RemoteX == NULL) - { - // SSL communication start failure - Disconnect(s); - ReleaseSock(s); - c->FirstSock = NULL; - c->Err = ERR_SERVER_IS_NOT_VPN; - return NULL; - } - - return s; -} - -// Return a socket by connecting to the server -SOCK *ClientConnectGetSocket(CONNECTION *c, bool additional_connect) -{ - volatile bool *cancel_flag = NULL; - char hostname[MAX_HOST_NAME_LEN]; - bool save_resolved_ip = false; - CLIENT_OPTION *o; - SESSION *sess; - SOCK *sock = NULL; - IP resolved_ip; - // Validate arguments - if (c == NULL || c->Session == NULL || c->Session->ClientOption == NULL) - { - return NULL; - } - - cancel_flag = &c->Halt; - sess = c->Session; - o = c->Session->ClientOption; - - Zero(&resolved_ip, sizeof(resolved_ip)); - - if (additional_connect == false && c->RestoreServerNameAndPort) - { - // Update server name and port number. - // At the time of writing this comment RestoreServerNameAndPort is never true. - c->RestoreServerNameAndPort = false; - - if (StrCmpi(c->ServerName, o->Hostname) != 0) - { - StrCpy(c->ServerName, sizeof(c->ServerName), o->Hostname); - } - - c->ServerPort = o->Port; - } - - if (IsZeroIP(&sess->ServerIP_CacheForNextConnect) == false) - { - IPToStr(hostname, sizeof(hostname), &sess->ServerIP_CacheForNextConnect); - Debug("ClientConnectGetSocket(): Using cached IP address %s\n", hostname); - } - else - { - IP tmp; - - StrCpy(hostname, sizeof(hostname), o->ProxyType == PROXY_DIRECT ? c->ServerName : o->ProxyName); - - if (StrToIP(&tmp, hostname) == false) - { - // The hostname is not an IP address - save_resolved_ip = true; - } - } - - if (o->ProxyType == PROXY_DIRECT) - { - UINT nat_t_err = 0; - wchar_t tmp[MAX_SIZE]; - UniFormat(tmp, sizeof(tmp), _UU("STATUS_4"), hostname); - PrintStatus(sess, tmp); - - if (o->PortUDP == 0) - { - // If additional_connect == false, enable trying to NAT-T connection - // If additional_connect == true, follow the IsRUDPSession setting in this session - sock = TcpIpConnectEx(hostname, c->ServerPort, - (bool *)cancel_flag, c->hWndForUI, &nat_t_err, (additional_connect ? (!sess->IsRUDPSession) : false), - true, &resolved_ip); - } - else - { - // Mode to connect with R-UDP directly without using NAT-T server when using UDP - IP ip; - if (StrToIP(&ip, hostname)) - { - sock = NewRUDPClientDirect(VPN_RUDP_SVC_NAME, &ip, o->PortUDP, &nat_t_err, - TIMEOUT_TCP_PORT_CHECK, (bool *)cancel_flag, NULL, NULL, 0, false); - - if (sock != NULL) - { - StrCpy(sock->UnderlayProtocol, sizeof(sock->UnderlayProtocol), SOCK_UNDERLAY_NAT_T); - } - } - } - - if (sock == NULL) - { - // Connection failure - if (nat_t_err != RUDP_ERROR_NAT_T_TWO_OR_MORE) - { - c->Err = ERR_CONNECT_FAILED; - } - else - { - c->Err = ERR_NAT_T_TWO_OR_MORE; - } - - return NULL; - } - } - else - { - wchar_t tmp[MAX_SIZE]; - PROXY_PARAM_OUT out; - PROXY_PARAM_IN in; - UINT ret; - - Zero(&in, sizeof(in)); - - in.Timeout = 0; - - StrCpy(in.TargetHostname, sizeof(in.TargetHostname), c->ServerName); - in.TargetPort = c->ServerPort; - - StrCpy(in.Hostname, sizeof(in.Hostname), IsEmptyStr(hostname) ? o->ProxyName : hostname); - in.Port = o->ProxyPort; - - StrCpy(in.Username, sizeof(in.Username), o->ProxyUsername); - StrCpy(in.Password, sizeof(in.Password), o->ProxyPassword); - - StrCpy(in.HttpCustomHeader, sizeof(in.HttpCustomHeader), o->CustomHttpHeader); - StrCpy(in.HttpUserAgent, sizeof(in.HttpUserAgent), c->Cedar->HttpUserAgent); - -#ifdef OS_WIN32 - in.Hwnd = c->hWndForUI; -#endif - - UniFormat(tmp, sizeof(tmp), _UU("STATUS_2"), in.TargetHostname, in.Hostname); - PrintStatus(sess, tmp); - - switch (o->ProxyType) - { - case PROXY_HTTP: - ret = ProxyHttpConnect(&out, &in, cancel_flag); - break; - case PROXY_SOCKS: - ret = ProxySocks4Connect(&out, &in, cancel_flag); - break; - case PROXY_SOCKS5: - ret = ProxySocks5Connect(&out, &in, cancel_flag); - break; - default: - c->Err = ERR_INTERNAL_ERROR; - Debug("ClientConnectGetSocket(): Unknown proxy type: %u!\n", o->ProxyType); - return NULL; - } - - c->Err = ProxyCodeToCedar(ret); - - if (c->Err != ERR_NO_ERROR) - { - Debug("ClientConnectGetSocket(): Connection via proxy server failed with error %u\n", ret); - return NULL; - } - - sock = out.Sock; - - CopyIP(&resolved_ip, &out.ResolvedIp); - } - - if (additional_connect == false || IsZeroIP(&sock->RemoteIP)) - { - if (((sock->IsRUDPSocket || sock->IPv6) && IsZeroIP(&sock->RemoteIP) == false && o->ProxyType == PROXY_DIRECT) || GetIP(&c->Session->ServerIP, hostname) == false) - { - Copy(&c->Session->ServerIP, &sock->RemoteIP, sizeof(c->Session->ServerIP)); - } - } - - if (save_resolved_ip && IsZeroIP(&resolved_ip) == false) - { - Copy(&c->Session->ServerIP_CacheForNextConnect, &resolved_ip, sizeof(c->Session->ServerIP_CacheForNextConnect)); - Debug("ClientConnectGetSocket(): Saved %s IP address %r for future connections.\n", hostname, &resolved_ip); - } - - return sock; -} - -UINT ProxyCodeToCedar(UINT code) -{ - switch (code) - { - case PROXY_ERROR_SUCCESS: - return ERR_NO_ERROR; - case PROXY_ERROR_GENERIC: - case PROXY_ERROR_VERSION: - return ERR_PROXY_ERROR; - case PROXY_ERROR_CANCELED: - return ERR_USER_CANCEL; - case PROXY_ERROR_CONNECTION: - return ERR_PROXY_CONNECT_FAILED; - case PROXY_ERROR_TARGET: - return ERR_CONNECT_FAILED; - case PROXY_ERROR_DISCONNECTED: - return ERR_DISCONNECTED; - case PROXY_ERROR_AUTHENTICATION: - return ERR_PROXY_AUTH_FAILED; - default: - return ERR_INTERNAL_ERROR; - } -} - -// TCP connection function -SOCK *TcpConnectEx3(char *hostname, UINT port, UINT timeout, bool *cancel_flag, void *hWnd, bool no_nat_t, UINT *nat_t_error_code, bool try_start_ssl, IP *ret_ip) -{ -#ifdef OS_WIN32 - if (hWnd == NULL) - { -#endif // OS_WIN32 - return ConnectEx4(hostname, port, timeout, cancel_flag, (no_nat_t ? NULL : VPN_RUDP_SVC_NAME), nat_t_error_code, try_start_ssl, true, ret_ip); -#ifdef OS_WIN32 - } - else - { - return WinConnectEx3((HWND)hWnd, hostname, port, timeout, 0, NULL, NULL, nat_t_error_code, (no_nat_t ? NULL : VPN_RUDP_SVC_NAME), try_start_ssl); - } -#endif // OS_WIN32 -} - -// Connect with TCP/IP -SOCK *TcpIpConnectEx(char *hostname, UINT port, bool *cancel_flag, void *hWnd, UINT *nat_t_error_code, bool no_nat_t, bool try_start_ssl, IP *ret_ip) -{ - SOCK *s = NULL; - UINT dummy_int = 0; - // Validate arguments - if (nat_t_error_code == NULL) - { - nat_t_error_code = &dummy_int; - } - *nat_t_error_code = 0; - if (hostname == NULL || port == 0) - { - return NULL; - } - - s = TcpConnectEx3(hostname, port, 0, cancel_flag, hWnd, no_nat_t, nat_t_error_code, try_start_ssl, ret_ip); - if (s == NULL) - { - return NULL; - } - - return s; -} - -// Protocol routine initialization -void InitProtocol() -{ -} - -// Release the protocol routine -void FreeProtocol() -{ -} - -// Create a Hello packet -PACK *PackHello(void *random, UINT ver, UINT build, char *server_str) -{ - PACK *p; - // Validate arguments - if (random == NULL || server_str == NULL) - { - return NULL; - } - - p = NewPack(); - PackAddStr(p, "hello", server_str); - PackAddInt(p, "version", ver); - PackAddInt(p, "build", build); - PackAddData(p, "random", random, SHA1_SIZE); - - return p; -} - -// Interpret the Hello packet -bool GetHello(PACK *p, void *random, UINT *ver, UINT *build, char *server_str, UINT server_str_size) -{ - // Validate arguments - if (p == NULL || random == NULL || ver == NULL || server_str == NULL) - { - return false; - } - - if (PackGetStr(p, "hello", server_str, server_str_size) == false) - { - return false; - } - *ver = PackGetInt(p, "version"); - *build = PackGetInt(p, "build"); - if (PackGetDataSize(p, "random") != SHA1_SIZE) - { - return false; - } - if (PackGetData(p, "random", random) == false) - { - return false; - } - - return true; -} - -// Get the authentication method from PACK -UINT GetAuthTypeFromPack(PACK *p) -{ - // Validate arguments - if (p == NULL) - { - return 0; - } - - return PackGetInt(p, "authtype"); -} - -// Get the HUB name and the user name from the PACK -bool GetHubnameAndUsernameFromPack(PACK *p, char *username, UINT username_size, - char *hubname, UINT hubname_size) -{ - // Validate arguments - if (p == NULL || username == NULL || hubname == NULL) - { - return false; - } - - if (PackGetStr(p, "username", username, username_size) == false) - { - return false; - } - if (PackGetStr(p, "hubname", hubname, hubname_size) == false) - { - return false; - } - return true; -} - -// Get the protocol from PACK -UINT GetProtocolFromPack(PACK *p) -{ - // Validate arguments - if (p == NULL) - { - return 0; - } - -#if 0 - return PackGetInt(p, "protocol"); -#else - // Limit to the TCP protocol in the current version - return CONNECTION_TCP; -#endif -} - -// Get the method from the PACK -bool GetMethodFromPack(PACK *p, char *method, UINT size) -{ - // Validate arguments - if (p == NULL || method == NULL || size == 0) - { - return false; - } - - return PackGetStr(p, "method", method, size); -} - -// Generate a packet of certificate authentication login -PACK *PackLoginWithCert(char *hubname, char *username, X *x, void *sign, UINT sign_size) -{ - PACK *p; - BUF *b; - // Validate arguments - if (hubname == NULL || username == NULL) - { - return NULL; - } - - p = NewPack(); - PackAddStr(p, "method", "login"); - PackAddStr(p, "hubname", hubname); - PackAddStr(p, "username", username); - PackAddInt(p, "authtype", CLIENT_AUTHTYPE_CERT); - - // Certificate - b = XToBuf(x, false); - PackAddData(p, "cert", b->Buf, b->Size); - FreeBuf(b); - - // Signature data - PackAddData(p, "sign", sign, sign_size); - - return p; -} - -// Generate a packet of plain text password authentication login -PACK *PackLoginWithPlainPassword(char *hubname, char *username, void *plain_password) -{ - PACK *p; - // Validate arguments - if (hubname == NULL || username == NULL) - { - return NULL; - } - - p = NewPack(); - PackAddStr(p, "method", "login"); - PackAddStr(p, "hubname", hubname); - PackAddStr(p, "username", username); - PackAddInt(p, "authtype", CLIENT_AUTHTYPE_PLAIN_PASSWORD); - PackAddStr(p, "plain_password", plain_password); - - return p; -} - -// Generate a packet of OpenVPN certificate login -PACK *PackLoginWithOpenVPNCertificate(char *hubname, char *username, X *x) -{ - PACK *p; - char cn_username[128]; - BUF *cert_buf = NULL; - // Validate arguments - if (hubname == NULL || username == NULL || x == NULL) - { - return NULL; - } - - p = NewPack(); - PackAddStr(p, "method", "login"); - PackAddStr(p, "hubname", hubname); - - if (IsEmptyStr(username)) - { - if (x->subject_name == NULL) - { - FreePack(p); - return NULL; - } - UniToStr(cn_username, sizeof(cn_username), x->subject_name->CommonName); - PackAddStr(p, "username", cn_username); - } - else - { - PackAddStr(p, "username", username); - } - - PackAddInt(p, "authtype", AUTHTYPE_OPENVPN_CERT); - - cert_buf = XToBuf(x, false); - PackAddBuf(p, "cert", cert_buf); - FreeBuf(cert_buf); - - return p; -} - -// Create a packet of password authentication login -PACK *PackLoginWithPassword(char *hubname, char *username, void *secure_password) -{ - PACK *p; - // Validate arguments - if (hubname == NULL || username == NULL) - { - return NULL; - } - - p = NewPack(); - PackAddStr(p, "method", "login"); - PackAddStr(p, "hubname", hubname); - PackAddStr(p, "username", username); - PackAddInt(p, "authtype", CLIENT_AUTHTYPE_PASSWORD); - PackAddData(p, "secure_password", secure_password, SHA1_SIZE); - - return p; -} - -// Create a packet for anonymous login -PACK *PackLoginWithAnonymous(char *hubname, char *username) -{ - PACK *p; - // Validate arguments - if (hubname == NULL || username == NULL) - { - return NULL; - } - - p = NewPack(); - PackAddStr(p, "method", "login"); - PackAddStr(p, "hubname", hubname); - PackAddStr(p, "username", username); - PackAddInt(p, "authtype", CLIENT_AUTHTYPE_ANONYMOUS); - - return p; -} - -// Create a packet for the additional connection -PACK *PackAdditionalConnect(UCHAR *session_key) -{ - PACK *p; - // Validate arguments - if (session_key == NULL) - { - return NULL; - } - - p = NewPack(); - PackAddStr(p, "method", "additional_connect"); - PackAddData(p, "session_key", session_key, SHA1_SIZE); - - return p; -} +// SoftEther VPN Source Code - Developer Edition Master Branch +// Cedar Communication Module +// © 2020 Nokia + +// Protocol.c +// SoftEther protocol related routines + +#include "CedarPch.h" + +static UCHAR ssl_packet_start[3] = {0x17, 0x03, 0x00}; + +// Download and save intermediate certificates if necessary +bool DownloadAndSaveIntermediateCertificatesIfNecessary(X *x) +{ + LIST *o; + bool ret = false; + // Validate arguments + if (x == NULL) + { + return false; + } + + if (x->root_cert) + { + return true; + } + + o = NewCertList(true); + + ret = TryGetRootCertChain(o, x, true, NULL); + + FreeCertList(o); + + return ret; +} + +// Attempt to fetch the full chain of the specified cert +bool TryGetRootCertChain(LIST *o, X *x, bool auto_save, X **found_root_x) +{ + bool ret = false; + LIST *chain = NULL; + LIST *current_chain_dir = NULL; + // Validate arguments + if (o == NULL || x == NULL) + { + return false; + } + + chain = NewCertList(false); + + ret = TryGetParentCertFromCertList(o, x, chain); + + if (ret) + { + UINT i; + DIRLIST *dir; + wchar_t dirname[MAX_SIZE]; + wchar_t exedir[MAX_SIZE]; + + GetDbDirW(exedir, sizeof(exedir)); + CombinePathW(dirname, sizeof(dirname), exedir, L"chain_certs"); + MakeDirExW(dirname); + + if (auto_save) + { + // delete the current auto_save files + dir = EnumDirW(dirname); + if (dir != NULL) + { + for (i = 0;i < dir->NumFiles;i++) + { + DIRENT *e = dir->File[i]; + + if (e->Folder == false) + { + if (UniStartWith(e->FileNameW, AUTO_DOWNLOAD_CERTS_PREFIX)) + { + wchar_t tmp[MAX_SIZE]; + + CombinePathW(tmp, sizeof(tmp), dirname, e->FileNameW); + + FileDeleteW(tmp); + } + } + } + + FreeDir(dir); + } + } + + current_chain_dir = NewCertList(false); + AddAllChainCertsToCertList(current_chain_dir); + + for (i = 0;i < LIST_NUM(chain);i++) + { + wchar_t tmp[MAX_SIZE]; + X *xx = LIST_DATA(chain, i); + + GetAllNameFromName(tmp, sizeof(tmp), xx->subject_name); + + Debug("depth = %u, subject = %S\n", i, tmp); + + if (auto_save && CompareX(x, xx) == false && IsXInCertList(current_chain_dir, xx) == false) + { + wchar_t fn[MAX_PATH]; + char hex_a[128]; + wchar_t hex[128]; + UCHAR hash[SHA1_SIZE]; + wchar_t tmp[MAX_SIZE]; + BUF *b; + + GetXDigest(xx, hash, true); + BinToStr(hex_a, sizeof(hex_a), hash, SHA1_SIZE); + StrToUni(hex, sizeof(hex), hex_a); + + UniStrCpy(fn, sizeof(fn), AUTO_DOWNLOAD_CERTS_PREFIX); + UniStrCat(fn, sizeof(fn), hex); + UniStrCat(fn, sizeof(fn), L".cer"); + + CombinePathW(tmp, sizeof(tmp), dirname, fn); + + b = XToBuf(xx, true); + + DumpBufW(b, tmp); + + FreeBuf(b); + } + + if (xx->root_cert) + { + if (found_root_x != NULL) + { + *found_root_x = CloneX(xx); + } + } + } + } + + FreeCertList(chain); + + FreeCertList(current_chain_dir); + + return ret; +} + +// Try get the parent cert +bool TryGetParentCertFromCertList(LIST *o, X *x, LIST *found_chain) +{ + bool ret = false; + X *r; + bool do_free = false; + // Validate arguments + if (o == NULL || x == NULL || found_chain == NULL) + { + return false; + } + + if (LIST_NUM(found_chain) >= FIND_CERT_CHAIN_MAX_DEPTH) + { + return false; + } + + Add(found_chain, CloneX(x)); + + if (x->root_cert) + { + return true; + } + + r = FindCertIssuerFromCertList(o, x); + + if (r == NULL) + { + if (IsEmptyStr(x->issuer_url) == false) + { + r = DownloadCert(x->issuer_url); + + if (CheckXEx(x, r, true, true) && CompareX(x, r) == false) + { + // found + do_free = true; + } + else + { + // invalid + FreeX(r); + r = NULL; + } + } + } + + if (r != NULL) + { + ret = TryGetParentCertFromCertList(o, r, found_chain); + } + + if (do_free) + { + FreeX(r); + } + + return ret; +} + +// Find the issuer of the cert from the cert list +X *FindCertIssuerFromCertList(LIST *o, X *x) +{ + UINT i; + // Validate arguments + if (o == NULL || x == NULL) + { + return NULL; + } + + if (x->root_cert) + { + return NULL; + } + + for (i = 0;i < LIST_NUM(o);i++) + { + X *xx = LIST_DATA(o, i); + + if (CheckXEx(x, xx, true, true)) + { + if (CompareX(x, xx) == false) + { + return xx; + } + } + } + + return NULL; +} + +// Download a cert by using HTTP +X *DownloadCert(char *url) +{ + BUF *b; + URL_DATA url_data; + X *ret = NULL; + // Validate arguments + if (IsEmptyStr(url)) + { + return NULL; + } + + Debug("Trying to download a cert from %s ...\n", url); + + if (ParseUrl(&url_data, url, false, NULL) == false) + { + Debug("Download failed.\n"); + return NULL; + } + + b = HttpRequestEx(&url_data, NULL, CERT_HTTP_DOWNLOAD_TIMEOUT, CERT_HTTP_DOWNLOAD_TIMEOUT, + NULL, false, NULL, NULL, NULL, NULL, NULL, CERT_HTTP_DOWNLOAD_MAXSIZE); + + if (b == NULL) + { + Debug("Download failed.\n"); + return NULL; + } + + ret = BufToX(b, IsBase64(b)); + + FreeBuf(b); + + Debug("Download ok.\n"); + return ret; +} + +// New cert list +LIST *NewCertList(bool load_root_and_chain) +{ + LIST *o; + + o = NewList(NULL); + + if (load_root_and_chain) + { + AddAllRootCertsToCertList(o); + AddAllChainCertsToCertList(o); + } + + return o; +} + +// Free cert list +void FreeCertList(LIST *o) +{ + UINT i; + // Validate arguments + if (o == NULL) + { + return; + } + + for (i = 0;i < LIST_NUM(o);i++) + { + X *x = LIST_DATA(o, i); + + FreeX(x); + } + + ReleaseList(o); +} + +// Check whether the cert is in the cert list +bool IsXInCertList(LIST *o, X *x) +{ + UINT i; + // Validate arguments + if (o == NULL || x == NULL) + { + return false; + } + + for (i = 0;i < LIST_NUM(o);i++) + { + X *xx = LIST_DATA(o, i); + + if (CompareX(x, xx)) + { + return true; + } + } + + return false; +} + +// Add a cert to the cert list +void AddXToCertList(LIST *o, X *x) +{ + // Validate arguments + if (o == NULL || x == NULL) + { + return; + } + + if (IsXInCertList(o, x)) + { + return; + } + + if (CheckXDateNow(x) == false) + { + return; + } + + Add(o, CloneX(x)); +} + +// Add all chain certs to the cert list +void AddAllChainCertsToCertList(LIST *o) +{ + wchar_t dirname[MAX_SIZE]; + wchar_t exedir[MAX_SIZE]; + DIRLIST *dir; + // Validate arguments + if (o == NULL) + { + return; + } + + GetDbDirW(exedir, sizeof(exedir)); + + CombinePathW(dirname, sizeof(dirname), exedir, L"chain_certs"); + + MakeDirExW(dirname); + + dir = EnumDirW(dirname); + + if (dir != NULL) + { + UINT i; + + for (i = 0;i < dir->NumFiles;i++) + { + DIRENT *e = dir->File[i]; + + if (e->Folder == false) + { + wchar_t tmp[MAX_SIZE]; + X *x; + + CombinePathW(tmp, sizeof(tmp), dirname, e->FileNameW); + + x = FileToXW(tmp); + + if (x != NULL) + { + AddXToCertList(o, x); + + FreeX(x); + } + } + } + + FreeDir(dir); + } +} + +// Add all root certs to the cert list +void AddAllRootCertsToCertList(LIST *o) +{ + BUF *buf; + PACK *p; + UINT num_ok = 0, num_error = 0; + // Validate arguments + if (o == NULL) + { + return; + } + + buf = ReadDump(ROOT_CERTS_FILENAME); + if (buf == NULL) + { + return; + } + + p = BufToPack(buf); + + if (p != NULL) + { + UINT num = PackGetIndexCount(p, "cert"); + UINT i; + + for (i = 0;i < num;i++) + { + bool ok = false; + BUF *b = PackGetBufEx(p, "cert", i); + + if (b != NULL) + { + X *x = BufToX(b, false); + + if (x != NULL) + { + AddXToCertList(o, x); + + ok = true; + + FreeX(x); + } + + FreeBuf(b); + } + + if (ok) + { + num_ok++; + } + else + { + num_error++; + } + } + + FreePack(p); + } + + FreeBuf(buf); + + Debug("AddAllRootCertsToCertList: ok=%u error=%u total_list_len=%u\n", num_ok, num_error, LIST_NUM(o)); +} + +// Convert the date of YYYYMMDD format to a number +UINT64 ShortStrToDate64(char *str) +{ + UINT v; + SYSTEMTIME st; + // Validate arguments + if (str == NULL) + { + return 0; + } + + v = ToInt(str); + + Zero(&st, sizeof(st)); + + st.wYear = (v % 100000000) / 10000; + st.wMonth = (v % 10000) / 100; + st.wDay = v % 100; + + return SystemToUINT64(&st); +} + +// Handle the response that is returned from the server in the update client +void UpdateClientThreadProcessResults(UPDATE_CLIENT *c, BUF *b) +{ + bool exit = false; + // Validate arguments + if (c == NULL || b == NULL) + { + return; + } + + SeekBufToBegin(b); + + while (true) + { + char *line = CfgReadNextLine(b); + if (line == NULL) + { + break; + } + + Trim(line); + + if (StartWith(line, "#") == false && IsEmptyStr(line) == false) + { + TOKEN_LIST *t = ParseTokenWithNullStr(line, " \t"); + + if (t != NULL) + { + if (t->NumTokens >= 5) + { + if (StrCmpi(t->Token[0], c->FamilyName) == 0) + { + // Match + UINT64 date = ShortStrToDate64(t->Token[1]); + if (date != 0) + { + UINT build = ToInt(t->Token[2]); + if (build != 0) + { + if (build > c->MyBuild && build > c->LatestBuild && build > c->Setting.LatestIgnoreBuild) + { + c->Callback(c, build, date, t->Token[3], t->Token[4], &c->HaltFlag, c->Param); + + c->LatestBuild = build; + + exit = true; + } + } + } + } + } + + FreeToken(t); + } + } + + Free(line); + + if (exit) + { + break; + } + } +} + +// Update client main process +void UpdateClientThreadMain(UPDATE_CLIENT *c) +{ + char url[MAX_SIZE]; + char id[MAX_SIZE]; + URL_DATA data; + BUF *cert_hash; + UINT ret = 0; + BUF *recv; + // Validate arguments + if (c == NULL) + { + return; + } + + // Generate the URL + Format(url, sizeof(url), IsUseAlternativeHostname() ? UPDATE_SERVER_URL_CHINA : UPDATE_SERVER_URL_GLOBAL, c->FamilyName, c->SoftwareName, c->MyBuild, c->MyLanguage); + + if (IsEmptyStr(c->ClientId) == false) + { + Format(id, sizeof(id), "&id=%s", c->ClientId); + StrCat(url, sizeof(url), id); + } + + // Get a text file at this URL + if (ParseUrl(&data, url, false, NULL) == false) + { + return; + } + + cert_hash = StrToBin(UPDATE_SERVER_CERT_HASH); + + StrCpy(data.SniString, sizeof(data.SniString), DDNS_SNI_VER_STRING); + + recv = HttpRequestEx3(&data, NULL, UPDATE_CONNECT_TIMEOUT, UPDATE_COMM_TIMEOUT, &ret, false, NULL, NULL, + NULL, ((cert_hash != NULL && (cert_hash->Size % SHA1_SIZE) == 0) ? cert_hash->Buf : NULL), + (cert_hash != NULL ? (cert_hash->Size / SHA1_SIZE) : 0), + (bool *)&c->HaltFlag, 0, NULL, NULL); + + FreeBuf(cert_hash); + + if (recv != NULL) + { + UpdateClientThreadProcessResults(c, recv); + + FreeBuf(recv); + } +} + +// Update client main thread +void UpdateClientThreadProc(THREAD *thread, void *param) +{ + UPDATE_CLIENT *c = (UPDATE_CLIENT *)param; + bool first_loop = true; + // Validate arguments + if (thread == NULL || param == NULL) + { + return; + } + + while (true) + { + // Termination check + if (c->HaltFlag) + { + break; + } + + if (first_loop == false) + { + // Wait for the foreground + if (c->IsForegroundCb != NULL) + { + while (true) + { + if (c->HaltFlag) + { + break; + } + + if (c->IsForegroundCb(c, c->Param)) + { + break; + } + + Wait(c->HaltEvent, 1000); + } + } + } + + first_loop = false; + + if (c->HaltFlag) + { + break; + } + + if (c->Setting.DisableCheck == false) + { + UpdateClientThreadMain(c); + } + + // Wait until the next attempt + Wait(c->HaltEvent, GenRandInterval(UPDATE_CHECK_INTERVAL_MIN, UPDATE_CHECK_INTERVAL_MAX)); + } +} + +// Update the configuration of the update client +void SetUpdateClientSetting(UPDATE_CLIENT *c, UPDATE_CLIENT_SETTING *s) +{ + // Validate arguments + if (c == NULL || s == NULL) + { + return; + } + + Copy(&c->Setting, s, sizeof(UPDATE_CLIENT_SETTING)); + + Set(c->HaltEvent); +} + +// Start the update client +UPDATE_CLIENT *NewUpdateClient(UPDATE_NOTIFY_PROC *cb, UPDATE_ISFOREGROUND_PROC *isforeground_cb, void *param, char *family_name, char *software_name, wchar_t *software_title, UINT my_build, UINT64 my_date, char *my_lang, UPDATE_CLIENT_SETTING *current_setting, char *client_id) +{ + UPDATE_CLIENT *c; + // Validate arguments + if (family_name == NULL || software_title == NULL || software_name == NULL || my_build == 0 || + my_lang == NULL || current_setting == NULL || cb == NULL) + { + return NULL; + } + + c = ZeroMalloc(sizeof(UPDATE_CLIENT)); + + c->Callback = cb; + c->IsForegroundCb = isforeground_cb; + + StrCpy(c->ClientId, sizeof(c->ClientId), client_id); + StrCpy(c->FamilyName, sizeof(c->FamilyName), family_name); + StrCpy(c->SoftwareName, sizeof(c->SoftwareName), software_name); + UniStrCpy(c->SoftwareTitle, sizeof(c->SoftwareTitle), software_title); + c->MyBuild = my_build; + c->MyDate = my_date; + StrCpy(c->MyLanguage, sizeof(c->MyLanguage), my_lang); + + Copy(&c->Setting, current_setting, sizeof(c->Setting)); + + c->Param = param; + + c->HaltEvent = NewEvent(); + + // Create a thread + c->Thread = NewThread(UpdateClientThreadProc, c); + + return c; +} + +// Terminate the update client +void FreeUpdateClient(UPDATE_CLIENT *c) +{ + // Validate arguments + if (c == NULL) + { + return; + } + + // Thread stop + c->HaltFlag = true; + Set(c->HaltEvent); + + // Wait for thread termination + WaitThread(c->Thread, INFINITE); + + ReleaseThread(c->Thread); + ReleaseEvent(c->HaltEvent); + + Free(c); +} + +// Generate unique IDs for each machine +void GenerateMachineUniqueHash(void *data) +{ + BUF *b; + char name[64]; + OS_INFO *osinfo; + UINT64 iphash = 0; + // Validate arguments + if (data == NULL) + { + return; + } + + iphash = GetHostIPAddressListHash(); + + b = NewBuf(); + GetMachineName(name, sizeof(name)); + + osinfo = GetOsInfo(); + + WriteBuf(b, name, StrLen(name)); + + WriteBufInt64(b, iphash); + + WriteBuf(b, &osinfo->OsType, sizeof(osinfo->OsType)); + WriteBuf(b, osinfo->KernelName, StrLen(osinfo->KernelName)); + WriteBuf(b, osinfo->KernelVersion, StrLen(osinfo->KernelVersion)); + WriteBuf(b, osinfo->OsProductName, StrLen(osinfo->OsProductName)); + WriteBuf(b, &osinfo->OsServicePack, sizeof(osinfo->OsServicePack)); + WriteBuf(b, osinfo->OsSystemName, StrLen(osinfo->OsSystemName)); + WriteBuf(b, osinfo->OsVendorName, StrLen(osinfo->OsVendorName)); + WriteBuf(b, osinfo->OsVersion, StrLen(osinfo->OsVersion)); + + Sha0(data, b->Buf, b->Size); + + FreeBuf(b); +} + +// Convert a node information to a string +void NodeInfoToStr(wchar_t *str, UINT size, NODE_INFO *info) +{ + char client_ip[128], server_ip[128], proxy_ip[128], unique_id[128]; + // Validate arguments + if (str == NULL || info == NULL) + { + return; + } + + IPToStr4or6(client_ip, sizeof(client_ip), info->ClientIpAddress, info->ClientIpAddress6); + IPToStr4or6(server_ip, sizeof(server_ip), info->ServerIpAddress, info->ServerIpAddress6); + IPToStr4or6(proxy_ip, sizeof(proxy_ip), info->ProxyIpAddress, info->ProxyIpAddress6); + BinToStr(unique_id, sizeof(unique_id), info->UniqueId, sizeof(info->UniqueId)); + + UniFormat(str, size, _UU("LS_NODE_INFO_TAG"), info->ClientProductName, + Endian32(info->ClientProductVer), Endian32(info->ClientProductBuild), + info->ServerProductName, Endian32(info->ServerProductVer), Endian32(info->ServerProductBuild), + info->ClientOsName, info->ClientOsVer, info->ClientOsProductId, + info->ClientHostname, client_ip, Endian32(info->ClientPort), + info->ServerHostname, server_ip, Endian32(info->ServerPort), + info->ProxyHostname, proxy_ip, Endian32(info->ProxyPort), + info->HubName, unique_id); +} + +// Accept the password change +UINT ChangePasswordAccept(CONNECTION *c, PACK *p) +{ + CEDAR *cedar; + UCHAR random[SHA1_SIZE]; + char hubname[MAX_HUBNAME_LEN + 1]; + char username[MAX_USERNAME_LEN + 1]; + UCHAR secure_old_password[SHA1_SIZE]; + UCHAR new_password[SHA1_SIZE]; + UCHAR new_password_ntlm[SHA1_SIZE]; + UCHAR check_secure_old_password[SHA1_SIZE]; + UINT ret = ERR_NO_ERROR; + HUB *hub; + // Validate arguments + if (c == NULL || p == NULL) + { + return ERR_INTERNAL_ERROR; + } + + Copy(random, c->Random, SHA1_SIZE); + if (PackGetStr(p, "hubname", hubname, sizeof(hubname)) == false || + PackGetStr(p, "username", username, sizeof(username)) == false || + PackGetData2(p, "secure_old_password", secure_old_password, sizeof(secure_old_password)) == false || + PackGetData2(p, "new_password", new_password, sizeof(new_password)) == false) + { + return ERR_PROTOCOL_ERROR; + } + + if (PackGetData2(p, "new_password_ntlm", new_password_ntlm, MD5_SIZE) == false) + { + Zero(new_password_ntlm, sizeof(new_password_ntlm)); + } + + cedar = c->Cedar; + + LockHubList(cedar); + { + hub = GetHub(cedar, hubname); + } + UnlockHubList(cedar); + + if (hub == NULL) + { + ret = ERR_HUB_NOT_FOUND; + } + else + { + char tmp[MAX_SIZE]; + + if (GetHubAdminOption(hub, "deny_change_user_password") != 0) + { + ReleaseHub(hub); + return ERR_NOT_ENOUGH_RIGHT; + } + + IPToStr(tmp, sizeof(tmp), &c->FirstSock->RemoteIP); + HLog(hub, "LH_CHANGE_PASSWORD_1", c->Name, tmp); + + AcLock(hub); + { + USER *u = AcGetUser(hub, username); + if (u == NULL) + { + HLog(hub, "LH_CHANGE_PASSWORD_2", c->Name, username); + ret = ERR_OLD_PASSWORD_WRONG; + } + else + { + Lock(u->lock); + { + if (u->AuthType != AUTHTYPE_PASSWORD) + { + // Not a password authentication + HLog(hub, "LH_CHANGE_PASSWORD_3", c->Name, username); + ret = ERR_USER_AUTHTYPE_NOT_PASSWORD; + } + else + { + bool fix_password = false; + if (u->Policy != NULL) + { + fix_password = u->Policy->FixPassword; + } + else + { + if (u->Group != NULL) + { + if (u->Group->Policy != NULL) + { + fix_password = u->Group->Policy->FixPassword; + } + } + } + if (fix_password == false) + { + // Confirmation of the old password + AUTHPASSWORD *pw = (AUTHPASSWORD *)u->AuthData; + + SecurePassword(check_secure_old_password, pw->HashedKey, random); + if (Cmp(check_secure_old_password, secure_old_password, SHA1_SIZE) != 0) + { + // Old password is incorrect + ret = ERR_OLD_PASSWORD_WRONG; + HLog(hub, "LH_CHANGE_PASSWORD_4", c->Name, username); + } + else + { + // Write a new password + if (Cmp(pw->HashedKey, new_password, SHA1_SIZE) != 0 || IsZero(pw->NtLmSecureHash, MD5_SIZE)) + { + Copy(pw->HashedKey, new_password, SHA1_SIZE); + Copy(pw->NtLmSecureHash, new_password_ntlm, MD5_SIZE); + } + HLog(hub, "LH_CHANGE_PASSWORD_5", c->Name, username); + } + } + else + { + // Password change is prohibited + ret = ERR_NOT_ENOUGH_RIGHT; + } + } + } + Unlock(u->lock); + + ReleaseUser(u); + } + } + AcUnlock(hub); + ReleaseHub(hub); + } + + return ret; +} + +// Change the password +UINT ChangePassword(CEDAR *cedar, CLIENT_OPTION *o, char *hubname, char *username, char *old_pass, char *new_pass) +{ + UINT ret = ERR_NO_ERROR; + UCHAR old_password[SHA1_SIZE]; + UCHAR secure_old_password[SHA1_SIZE]; + UCHAR new_password[SHA1_SIZE]; + UCHAR new_password_ntlm[MD5_SIZE]; + SOCK *sock; + SESSION *s; + // Validate arguments + if (cedar == NULL || o == NULL || hubname == NULL || username == NULL || old_pass == NULL || new_pass == NULL) + { + return ERR_INTERNAL_ERROR; + } + + + // Create a session + s = NewRpcSessionEx(cedar, o, &ret, NULL); + + if (s != NULL) + { + PACK *p = NewPack(); + + sock = s->Connection->FirstSock; + + HashPassword(old_password, username, old_pass); + SecurePassword(secure_old_password, old_password, s->Connection->Random); + HashPassword(new_password, username, new_pass); + GenerateNtPasswordHash(new_password_ntlm, new_pass); + + PackAddClientVersion(p, s->Connection); + + PackAddStr(p, "method", "password"); + PackAddStr(p, "hubname", hubname); + PackAddStr(p, "username", username); + PackAddData(p, "secure_old_password", secure_old_password, SHA1_SIZE); + PackAddData(p, "new_password", new_password, SHA1_SIZE); + PackAddData(p, "new_password_ntlm", new_password_ntlm, MD5_SIZE); + + if (HttpClientSend(sock, p)) + { + PACK *p = HttpClientRecv(sock); + if (p == NULL) + { + ret = ERR_DISCONNECTED; + } + else + { + ret = GetErrorFromPack(p); + } + FreePack(p); + } + else + { + ret = ERR_DISCONNECTED; + } + FreePack(p); + + ReleaseSession(s); + } + + return ret; +} + +// Enumerate HUBs +TOKEN_LIST *EnumHub(SESSION *s) +{ + SOCK *sock; + TOKEN_LIST *ret; + PACK *p; + UINT num; + UINT i; + // Validate arguments + if (s == NULL || s->Connection == NULL) + { + return NULL; + } + + sock = s->Connection->FirstSock; + if (sock == NULL) + { + return NULL; + } + + // Set the Timeout + SetTimeout(sock, 10000); + + p = NewPack(); + PackAddStr(p, "method", "enum_hub"); + + PackAddClientVersion(p, s->Connection); + + if (HttpClientSend(sock, p) == false) + { + FreePack(p); + return NULL; + } + FreePack(p); + + p = HttpClientRecv(sock); + if (p == NULL) + { + return NULL; + } + + num = PackGetInt(p, "NumHub"); + ret = ZeroMalloc(sizeof(TOKEN_LIST)); + ret->NumTokens = num; + ret->Token = ZeroMalloc(sizeof(char *) * num); + for (i = 0;i < num;i++) + { + char tmp[MAX_SIZE]; + if (PackGetStrEx(p, "HubName", tmp, sizeof(tmp), i)) + { + ret->Token[i] = CopyStr(tmp); + } + } + FreePack(p); + + return ret; +} + +// Server accepts a connection from client +bool ServerAccept(CONNECTION *c) +{ + bool ret = false; + UINT err; + PACK *p; + char username_real[MAX_SIZE]; + char method[MAX_SIZE]; + char hubname[MAX_SIZE]; + char username[MAX_SIZE]; + char groupname[MAX_SIZE]; + UCHAR session_key[SHA1_SIZE]; + UCHAR ticket[SHA1_SIZE]; + UINT authtype; + POLICY *policy; + UINT assigned_vlan_id = 0; + UCHAR assigned_ipc_mac_address[6]; + HUB *hub; + SESSION *s = NULL; + UINT64 user_expires = 0; + bool use_encrypt; + bool use_compress; + bool half_connection; + UINT adjust_mss; + bool use_udp_acceleration_client; + UINT client_udp_acceleration_max_version = 1; + UINT udp_acceleration_version = 1; + UINT client_rudp_bulk_max_version = 1; + UINT rudp_bulk_version = 1; + bool support_hmac_on_udp_acceleration_client = false; + bool support_udp_accel_fast_disconnect_detect; + bool use_hmac_on_udp_acceleration = false; + bool supress_return_pack_error = false; + IP udp_acceleration_client_ip; + UCHAR udp_acceleration_client_key[UDP_ACCELERATION_COMMON_KEY_SIZE_V1]; + UCHAR udp_acceleration_client_key_v2[UDP_ACCELERATION_COMMON_KEY_SIZE_V2]; + UINT udp_acceleration_client_port; + bool admin_mode = false; + UINT direction; + UINT max_connection; + UINT timeout; + bool no_reconnect_to_session = false; + bool farm_controller = false; + bool farm_member = false; + bool farm_mode = false; + bool require_bridge_routing_mode; + bool require_monitor_mode; + bool support_bulk_on_rudp = false; + bool support_hmac_on_bulk_of_rudp = false; + bool support_udp_recovery = false; + bool enable_bulk_on_rudp = false; + bool enable_udp_recovery = false; + bool enable_hmac_on_bulk_of_rudp = false; + bool use_client_license = false, use_bridge_license = false; + bool local_host_session = false; + char sessionname[MAX_SESSION_NAME_LEN + 1]; + bool is_server_or_bridge = false; + bool qos = false; + bool cluster_dynamic_secure_nat = false; + bool no_save_password = false; + NODE_INFO node; + wchar_t *msg = NULL; + bool suppress_client_update_notification = false; + USER *loggedin_user_object = NULL; + FARM_MEMBER *f = NULL; + SERVER *server = NULL; + POLICY ticketed_policy; + UCHAR unique[SHA1_SIZE], unique2[SHA1_SIZE]; + CEDAR *cedar; + RPC_WINVER winver; + UINT client_id; + bool no_more_users_in_server = false; + UCHAR mschap_v2_server_response_20[20]; + UINT ms_chap_error = 0; + bool is_empty_password = false; + char *error_detail = NULL; + char *error_detail_2 = NULL; + char ctoken_hash_str[64]; + EAP_CLIENT *release_me_eap_client = NULL; + + // Validate arguments + if (c == NULL) + { + return false; + } + + GenerateMachineUniqueHash(unique2); + + Zero(ctoken_hash_str, sizeof(ctoken_hash_str)); + + Zero(assigned_ipc_mac_address, sizeof(assigned_ipc_mac_address)); + + Zero(mschap_v2_server_response_20, sizeof(mschap_v2_server_response_20)); + + Zero(&udp_acceleration_client_ip, sizeof(udp_acceleration_client_ip)); + udp_acceleration_client_port = 0; + Zero(udp_acceleration_client_key, sizeof(udp_acceleration_client_key)); + Zero(udp_acceleration_client_key_v2, sizeof(udp_acceleration_client_key_v2)); + + Zero(&winver, sizeof(winver)); + + StrCpy(groupname, sizeof(groupname), ""); + StrCpy(sessionname, sizeof(sessionname), ""); + + if (IsZero(c->CToken_Hash, SHA1_SIZE) == false) + { + BinToStr(ctoken_hash_str, sizeof(ctoken_hash_str), c->CToken_Hash, SHA1_SIZE); + } + + cedar = c->Cedar; + + // Get the license status + + no_more_users_in_server = SiTooManyUserObjectsInServer(cedar->Server, true); + + c->Status = CONNECTION_STATUS_NEGOTIATION; + + if (c->Cedar->Server != NULL) + { + SERVER *s = c->Cedar->Server; + server = s; + + if (s->ServerType == SERVER_TYPE_FARM_MEMBER) + { + farm_member = true; + farm_mode = true; + } + + if (s->ServerType == SERVER_TYPE_FARM_CONTROLLER) + { + farm_controller = true; + farm_mode = true; + } + } + + // Receive the signature + Debug("Downloading Signature...\n"); + error_detail_2 = NULL; + if (ServerDownloadSignature(c, &error_detail_2) == false) + { + if (c->Type == CONNECTION_TYPE_ADMIN_RPC) + { + c->Err = ERR_NO_ERROR; + } + + if (error_detail_2 == NULL) + { + error_detail = "ServerDownloadSignature"; + } + else + { + error_detail = error_detail_2; + } + + supress_return_pack_error = true; + + goto CLEANUP; + } + + // Send a Hello packet + Debug("Uploading Hello...\n"); + if (ServerUploadHello(c) == false) + { + error_detail = "ServerUploadHello"; + goto CLEANUP; + } + + // Receive the authentication data + Debug("Auth...\n"); + + p = HttpServerRecv(c->FirstSock); + if (p == NULL) + { + // The connection disconnected + c->Err = ERR_DISCONNECTED; + error_detail = "RecvAuth1"; + goto CLEANUP; + } + + if (err = GetErrorFromPack(p)) + { + // An error has occured + FreePack(p); + c->Err = err; + error_detail = "RecvAuth2"; + goto CLEANUP; + } + + // Get the method + if (GetMethodFromPack(p, method, sizeof(method)) == false) + { + // Protocol error + FreePack(p); + c->Err = ERR_PROTOCOL_ERROR; + error_detail = "GetMethodFromPack"; + goto CLEANUP; + } + + // Brand string for the connection limit + { + char tmp[20]; + char *branded_ctos = _SS("BRANDED_C_TO_S"); + PackGetStr(p, "branded_ctos", tmp, sizeof(tmp)); + + if(StrCmpi(method, "login") == 0 && StrLen(branded_ctos) > 0 && StrCmpi(branded_ctos, tmp) != 0) + { + FreePack(p); + c->Err = ERR_BRANDED_C_TO_S; + goto CLEANUP; + } + } + + // Get the client version + PackGetStr(p, "client_str", c->ClientStr, sizeof(c->ClientStr)); + c->ClientVer = PackGetInt(p, "client_ver"); + c->ClientBuild = PackGetInt(p, "client_build"); + + if (SearchStrEx(c->ClientStr, "server", 0, false) != INFINITE || + SearchStrEx(c->ClientStr, "bridge", 0, false) != INFINITE) + { + is_server_or_bridge = true; + } + + // Get the client Windows version + InRpcWinVer(&winver, p); + + DecrementNoSsl(c->Cedar, &c->FirstSock->RemoteIP, 2); + + if (StrCmpi(method, "login") == 0) + { + bool auth_ret = false; + + Debug("Login...\n"); + c->Status = CONNECTION_STATUS_USERAUTH; + + c->Type = CONNECTION_TYPE_LOGIN; + + if (no_more_users_in_server) + { + // There are many users than are allowed in the VPN Server + FreePack(p); + c->Err = ERR_TOO_MANY_USER; + error_detail = "ERR_TOO_MANY_USER"; + goto CLEANUP; + } + + // Such as the client name + if (PackGetStr(p, "hello", c->ClientStr, sizeof(c->ClientStr)) == false) + { + StrCpy(c->ClientStr, sizeof(c->ClientStr), "Unknown"); + } + c->ServerVer = GetCedarVersionNumber(); + c->ServerBuild = CEDAR_VERSION_BUILD; + + // Get the NODE_INFO + Zero(&node, sizeof(node)); + InRpcNodeInfo(&node, p); + + // Protocol + c->Protocol = GetProtocolFromPack(p); + if (c->Protocol == CONNECTION_UDP) + { + // Release the structure of the TCP connection + if (c->Tcp) + { + ReleaseList(c->Tcp->TcpSockList); + Free(c->Tcp); + } + } + + if (GetServerCapsBool(c->Cedar->Server, "b_vpn_client_connect") == false) + { + // VPN client is unable to connect + FreePack(p); + c->Err = ERR_NOT_SUPPORTED; + goto CLEANUP; + } + + + + // Login + if (GetHubnameAndUsernameFromPack(p, username, sizeof(username), hubname, sizeof(hubname)) == false) + { + // Protocol error + FreePack(p); + c->Err = ERR_PROTOCOL_ERROR; + error_detail = "GetHubnameAndUsernameFromPack"; + goto CLEANUP; + } + + if (farm_member) + { + bool ok = false; + UINT authtype; + + authtype = GetAuthTypeFromPack(p); + if (StrCmpi(username, ADMINISTRATOR_USERNAME) == 0 && + authtype == AUTHTYPE_PASSWORD) + { + ok = true; + } + + if (authtype == AUTHTYPE_TICKET) + { + ok = true; + } + + if (ok == false) + { + // Logging on directly to server farm members by + // non-Administrators are prohibited + FreePack(p); + SLog(c->Cedar, "LS_FARMMEMBER_NOT_ADMIN", c->Name, hubname, ADMINISTRATOR_USERNAME, username); + c->Err = ERR_ACCESS_DENIED; + goto CLEANUP; + } + } + + Debug("Username = %s, HubName = %s\n", username, hubname); + LockHubList(c->Cedar); + { + hub = GetHub(c->Cedar, hubname); + } + UnlockHubList(c->Cedar); + if (hub == NULL) + { + // The HUB does not exist + FreePack(p); + c->Err = ERR_HUB_NOT_FOUND; + SLog(c->Cedar, "LS_HUB_NOT_FOUND", c->Name, hubname); + error_detail = "ERR_HUB_NOT_FOUND"; + goto CLEANUP; + } + + if (hub->ForceDisableComm) + { + // Communication function is disabled + FreePack(p); + c->Err = ERR_SERVER_CANT_ACCEPT; + error_detail = "ERR_COMM_DISABLED"; + ReleaseHub(hub); + goto CLEANUP; + } + + if (GetGlobalServerFlag(GSF_DISABLE_AC) == 0) + { + if (hub->HubDb != NULL && c->FirstSock != NULL) + { + IP ip; + + Copy(&ip, &c->FirstSock->RemoteIP, sizeof(IP)); + + if (IsIpDeniedByAcList(&ip, hub->HubDb->AcList)) + { + char ip_str[64]; + // Access denied + ReleaseHub(hub); + hub = NULL; + FreePack(p); + c->Err = ERR_IP_ADDRESS_DENIED; + IPToStr(ip_str, sizeof(ip_str), &ip); + SLog(c->Cedar, "LS_IP_DENIED", c->Name, ip_str); + goto CLEANUP; + } + } + } + + Lock(hub->lock); + { + UINT cert_size = 0; + void *cert_buf = NULL; + USER *user; + USERGROUP *group; + char plain_password[MAX_PASSWORD_LEN + 1]; + RADIUS_LOGIN_OPTION radius_login_opt; + + if (hub->Halt || hub->Offline) + { + // HUB is off-line + FreePack(p); + Unlock(hub->lock); + ReleaseHub(hub); + c->Err = ERR_HUB_STOPPING; + goto CLEANUP; + } + + Zero(&radius_login_opt, sizeof(radius_login_opt)); + + if (hub->Option != NULL) + { + radius_login_opt.In_CheckVLanId = hub->Option->AssignVLanIdByRadiusAttribute; + radius_login_opt.In_DenyNoVlanId = hub->Option->DenyAllRadiusLoginWithNoVlanAssign; + if (hub->Option->UseHubNameAsRadiusNasId) + { + StrCpy(radius_login_opt.NasId, sizeof(radius_login_opt.NasId), hubname); + } + } + + // Get the various flags + use_encrypt = PackGetInt(p, "use_encrypt") == 0 ? false : true; + use_compress = PackGetInt(p, "use_compress") == 0 ? false : true; + max_connection = PackGetInt(p, "max_connection"); + half_connection = PackGetInt(p, "half_connection") == 0 ? false : true; + qos = PackGetInt(p, "qos") ? true : false; + client_id = PackGetInt(p, "client_id"); + adjust_mss = PackGetInt(p, "adjust_mss"); + use_udp_acceleration_client = PackGetBool(p, "use_udp_acceleration"); + client_udp_acceleration_max_version = PackGetInt(p, "udp_acceleration_max_version"); + if (client_udp_acceleration_max_version == 0) + { + client_udp_acceleration_max_version = 1; + } + client_rudp_bulk_max_version = PackGetInt(p, "rudp_bulk_max_version"); + if (client_rudp_bulk_max_version == 0) + { + client_rudp_bulk_max_version = 1; + } + support_hmac_on_udp_acceleration_client = PackGetBool(p, "support_hmac_on_udp_acceleration"); + support_udp_accel_fast_disconnect_detect = PackGetBool(p, "support_udp_accel_fast_disconnect_detect"); + support_bulk_on_rudp = PackGetBool(p, "support_bulk_on_rudp"); + support_hmac_on_bulk_of_rudp = PackGetBool(p, "support_hmac_on_bulk_of_rudp"); + support_udp_recovery = PackGetBool(p, "support_udp_recovery"); + + if (c->IsInProc) + { + char tmp[MAX_SIZE]; + UINT64 ptr; + + ptr = PackGetInt64(p, "release_me_eap_client"); + if (ptr != 0) + { + release_me_eap_client = (EAP_CLIENT *)ptr; + } + + PackGetStr(p, "inproc_postfix", c->InProcPrefix, sizeof(c->InProcPrefix)); + Zero(tmp, sizeof(tmp)); + PackGetStr(p, "inproc_cryptname", tmp, sizeof(tmp)); + c->InProcLayer = PackGetInt(p, "inproc_layer"); + + if (c->FirstSock != NULL) + { + if (IsEmptyStr(c->InProcPrefix) == false) + { + Format(c->FirstSock->UnderlayProtocol, sizeof(c->FirstSock->UnderlayProtocol), SOCK_UNDERLAY_INPROC_EX, c->InProcPrefix); + AddProtocolDetailsStr(c->FirstSock->UnderlayProtocol, sizeof(c->FirstSock->UnderlayProtocol), c->InProcPrefix); + } + } + + if (c->CipherName != NULL) + { + Free(c->CipherName); + } + + c->CipherName = NULL; + + if (IsEmptyStr(tmp) == false) + { + c->CipherName = CopyStr(tmp); + use_encrypt = true; + } + + use_udp_acceleration_client = false; + + Format(radius_login_opt.In_VpnProtocolState, sizeof(radius_login_opt.In_VpnProtocolState), + "L%u:%s", c->InProcLayer, c->InProcPrefix); + } + else + { + if (c->CipherName != NULL) + { + Free(c->CipherName); + } + c->CipherName = NULL; + + if (c->FirstSock != NULL && IsEmptyStr(c->FirstSock->CipherName) == false) + { + c->CipherName = CopyStr(c->FirstSock->CipherName); + } + + Format(radius_login_opt.In_VpnProtocolState, sizeof(radius_login_opt.In_VpnProtocolState), + "L%u:%s", IPC_LAYER_2, "SEVPN"); + } + + if (support_bulk_on_rudp && c->FirstSock != NULL && c->FirstSock->IsRUDPSocket && + c->FirstSock->BulkRecvKey != NULL && c->FirstSock->BulkSendKey != NULL) + { + // Allow UDP bulk transfer if the client side supports + // in the case of using R-UDP Socket + enable_bulk_on_rudp = true; + + enable_hmac_on_bulk_of_rudp = support_hmac_on_bulk_of_rudp; + } + + if (support_udp_recovery && c->FirstSock != NULL && c->FirstSock->IsRUDPSocket) + { + // Allow UDP recovery + enable_udp_recovery = true; + } + + if (use_udp_acceleration_client) + { + PackGetData2(p, "udp_acceleration_client_key", udp_acceleration_client_key, UDP_ACCELERATION_COMMON_KEY_SIZE_V1); + PackGetData2(p, "udp_acceleration_client_key_v2", udp_acceleration_client_key_v2, UDP_ACCELERATION_COMMON_KEY_SIZE_V2); + + // Get the parameters for the UDP acceleration function + if (PackGetIp(p, "udp_acceleration_client_ip", &udp_acceleration_client_ip) == false) + { + use_udp_acceleration_client = false; + } + else + { + if (IsZeroIp(&udp_acceleration_client_ip)) + { + Copy(&udp_acceleration_client_ip, &c->FirstSock->RemoteIP, sizeof(IP)); + } + udp_acceleration_client_port = PackGetInt(p, "udp_acceleration_client_port"); + if (udp_acceleration_client_port == 0) + { + use_udp_acceleration_client = false; + } + } + + use_hmac_on_udp_acceleration = support_hmac_on_udp_acceleration_client; + } + + Debug("use_udp_acceleration_client = %u\n", use_udp_acceleration_client); + Debug("use_hmac_on_udp_acceleration = %u\n", use_hmac_on_udp_acceleration); + + // Request mode + require_bridge_routing_mode = PackGetBool(p, "require_bridge_routing_mode"); + require_monitor_mode = PackGetBool(p, "require_monitor_mode"); + if (require_monitor_mode) + { + qos = false; + } + + if (is_server_or_bridge) + { + require_bridge_routing_mode = true; + } + + // Client unique ID + Zero(unique, sizeof(unique)); + if (PackGetDataSize(p, "unique_id") == SHA1_SIZE) + { + PackGetData(p, "unique_id", unique); + } + + // Get the authentication method + authtype = GetAuthTypeFromPack(p); + + if (1) + { + // Log + char ip1[64], ip2[64], verstr[64]; + wchar_t *authtype_str = _UU("LH_AUTH_UNKNOWN"); + switch (authtype) + { + case CLIENT_AUTHTYPE_ANONYMOUS: + authtype_str = _UU("LH_AUTH_ANONYMOUS"); + break; + case CLIENT_AUTHTYPE_PASSWORD: + authtype_str = _UU("LH_AUTH_PASSWORD"); + break; + case CLIENT_AUTHTYPE_PLAIN_PASSWORD: + authtype_str = _UU("LH_AUTH_PLAIN_PASSWORD"); + break; + case CLIENT_AUTHTYPE_CERT: + authtype_str = _UU("LH_AUTH_CERT"); + break; + case AUTHTYPE_TICKET: + authtype_str = _UU("LH_AUTH_TICKET"); + break; + case AUTHTYPE_OPENVPN_CERT: + authtype_str = _UU("LH_AUTH_OPENVPN_CERT"); + break; + } + IPToStr(ip1, sizeof(ip1), &c->FirstSock->RemoteIP); + IPToStr(ip2, sizeof(ip2), &c->FirstSock->LocalIP); + + Format(verstr, sizeof(verstr), "%u.%02u", c->ClientVer / 100, c->ClientVer % 100); + + HLog(hub, "LH_CONNECT_CLIENT", c->Name, ip1, c->FirstSock->RemoteHostname, c->FirstSock->RemotePort, + c->ClientStr, verstr, c->ClientBuild, authtype_str, username); + } + + // Attempt an anonymous authentication first + auth_ret = SamAuthUserByAnonymous(hub, username); + + if (auth_ret) + { + if (c->IsInProc) + { + IPC_MSCHAP_V2_AUTHINFO mschap; + char password_tmp[MAX_SIZE]; + + Zero(&mschap, sizeof(mschap)); + + Zero(password_tmp, sizeof(password_tmp)); + PackGetStr(p, "plain_password", password_tmp, sizeof(password_tmp)); + + if (ParseAndExtractMsChapV2InfoFromPassword(&mschap, password_tmp)) + { + // Because the server don't know the NTLM hashed password, the bet to the possibility of + // the same character to the user name and empty, search a password of different + // versions of the upper and lower case characters in the case of anonymous authentication. + // Returns the MS-CHAPv2 response by using the password if there is a match. + // Fail the authentication if no match is found. + // (Because, if return a false MS-CHAPv2 Response, PPP client cause an error) + LIST *o = NewListFast(NULL); + char tmp1[MAX_SIZE]; + char tmp2[MAX_SIZE]; + char tmp3[MAX_SIZE]; + char tmp4[MAX_SIZE]; + char *response_pw; + char psk[MAX_SIZE]; + + ParseNtUsername(mschap.MsChapV2_PPPUsername, tmp1, sizeof(tmp1), tmp2, sizeof(tmp2), false); + ParseNtUsername(mschap.MsChapV2_PPPUsername, tmp3, sizeof(tmp3), tmp4, sizeof(tmp4), true); + + Add(o, ""); + Add(o, "-"); + Add(o, "."); + Add(o, "*"); + Add(o, "?"); + Add(o, " "); + Add(o, "p"); + Add(o, "guest"); + Add(o, "anony"); + Add(o, "anonymous"); + Add(o, "password"); + Add(o, "passwd"); + Add(o, "pass"); + Add(o, "pw"); + Add(o, mschap.MsChapV2_PPPUsername); + Add(o, tmp1); + Add(o, tmp2); + Add(o, tmp3); + Add(o, tmp4); + + Zero(psk, sizeof(psk)); + + if (c->Cedar->Server != NULL) + { + SERVER *s = c->Cedar->Server; + + if (s->IPsecServer != NULL) + { + StrCpy(psk, sizeof(psk), s->IPsecServer->Services.IPsec_Secret); + + Add(o, psk); + } + } + + response_pw = MsChapV2DoBruteForce(&mschap, o); + + ReleaseList(o); + + if (response_pw != NULL) + { + UCHAR challenge8[8]; + UCHAR nt_hash[16]; + UCHAR nt_hash_hash[16]; + + GenerateNtPasswordHash(nt_hash, response_pw); + GenerateNtPasswordHashHash(nt_hash_hash, nt_hash); + MsChapV2_GenerateChallenge8(challenge8, mschap.MsChapV2_ClientChallenge, mschap.MsChapV2_ServerChallenge, + mschap.MsChapV2_PPPUsername); + MsChapV2Server_GenerateResponse(mschap_v2_server_response_20, nt_hash_hash, + mschap.MsChapV2_ClientResponse, challenge8); + + Free(response_pw); + } + else + { + auth_ret = false; + } + } + } + + if (auth_ret) + { + // User authentication success by anonymous authentication + HLog(hub, "LH_AUTH_OK", c->Name, username); + is_empty_password = true; + } + } + + if (auth_ret == false) + { + // Attempt other authentication methods if anonymous authentication fails + switch (authtype) + { + case CLIENT_AUTHTYPE_ANONYMOUS: + // Anonymous authentication (this have been already attempted) + break; + + case AUTHTYPE_TICKET: + // Ticket authentication + if (PackGetDataSize(p, "ticket") == SHA1_SIZE) + { + PackGetData(p, "ticket", ticket); + + auth_ret = SiCheckTicket(hub, ticket, username, sizeof(username), username_real, sizeof(username_real), + &ticketed_policy, sessionname, sizeof(sessionname), groupname, sizeof(groupname)); + } + break; + + case CLIENT_AUTHTYPE_PASSWORD: + // Password authentication + if (PackGetDataSize(p, "secure_password") == SHA1_SIZE) + { + POLICY *pol = NULL; + UCHAR secure_password[SHA1_SIZE]; + Zero(secure_password, sizeof(secure_password)); + if (PackGetDataSize(p, "secure_password") == SHA1_SIZE) + { + PackGetData(p, "secure_password", secure_password); + } + auth_ret = SamAuthUserByPassword(hub, username, c->Random, secure_password, NULL, NULL, NULL); + + pol = SamGetUserPolicy(hub, username); + if (pol != NULL) + { + no_save_password = pol->NoSavePassword; + Free(pol); + } + + if(auth_ret){ + // Check whether the password was empty + UCHAR hashed_empty_password[SHA1_SIZE]; + UCHAR secure_empty_password[SHA1_SIZE]; + HashPassword(hashed_empty_password, username, ""); + SecurePassword(secure_empty_password, hashed_empty_password, c->Random); + if(Cmp(secure_password, secure_empty_password, SHA1_SIZE)==0){ + is_empty_password = true; + } + } + } + break; + + case CLIENT_AUTHTYPE_PLAIN_PASSWORD: + { + POLICY *pol = NULL; + + // Plaintext password authentication + Zero(plain_password, sizeof(plain_password)); + PackGetStr(p, "plain_password", plain_password, sizeof(plain_password)); + if (c->IsInProc == false && StartWith(plain_password, IPC_PASSWORD_MSCHAPV2_TAG)) + { + // Do not allow the MS-CHAPv2 authentication other than IPC sessions + Zero(plain_password, sizeof(plain_password)); + } + + if (auth_ret == false) + { + // Attempt a password authentication of normal user + UCHAR secure_password[SHA1_SIZE]; + UCHAR hash_password[SHA1_SIZE]; + bool is_mschap = StartWith(plain_password, IPC_PASSWORD_MSCHAPV2_TAG); + + HashPassword(hash_password, username, plain_password); + SecurePassword(secure_password, hash_password, c->Random); + + if (is_mschap == false) + { + auth_ret = SamAuthUserByPassword(hub, username, c->Random, secure_password, NULL, NULL, NULL); + } + else + { + auth_ret = SamAuthUserByPassword(hub, username, c->Random, secure_password, + plain_password, mschap_v2_server_response_20, &ms_chap_error); + } + + if (auth_ret && pol == NULL) + { + pol = SamGetUserPolicy(hub, username); + } + } + + if (auth_ret == false) + { + // Attempt external authentication registered users + bool fail_ext_user_auth = false; + if (GetGlobalServerFlag(GSF_DISABLE_RADIUS_AUTH) != 0) + { + fail_ext_user_auth = true; + } + + if (fail_ext_user_auth == false) + { + auth_ret = SamAuthUserByPlainPassword(c, hub, username, plain_password, false, mschap_v2_server_response_20, &radius_login_opt); + } + + if (auth_ret && pol == NULL) + { + pol = SamGetUserPolicy(hub, username); + } + } + + if (auth_ret == false) + { + // Attempt external authentication asterisk user + bool b = false; + bool fail_ext_user_auth = false; + + if (GetGlobalServerFlag(GSF_DISABLE_RADIUS_AUTH) != 0) + { + fail_ext_user_auth = true; + } + + if (fail_ext_user_auth == false) + { + AcLock(hub); + { + b = AcIsUser(hub, "*"); + } + AcUnlock(hub); + + // If there is asterisk user, log on as the user + if (b) + { + auth_ret = SamAuthUserByPlainPassword(c, hub, username, plain_password, true, mschap_v2_server_response_20, &radius_login_opt); + if (auth_ret && pol == NULL) + { + pol = SamGetUserPolicy(hub, "*"); + } + } + } + } + + if (pol != NULL) + { + no_save_password = pol->NoSavePassword; + Free(pol); + } + + if(auth_ret){ + // Check whether the password was empty + if(IsEmptyStr(plain_password)){ + is_empty_password = true; + } + } + } + break; + + case CLIENT_AUTHTYPE_CERT: + if (GetGlobalServerFlag(GSF_DISABLE_CERT_AUTH) == 0) + { + // Certificate authentication + cert_size = PackGetDataSize(p, "cert"); + if (cert_size >= 1 && cert_size <= 100000) + { + cert_buf = ZeroMalloc(cert_size); + if (PackGetData(p, "cert", cert_buf)) + { + UCHAR sign[4096 / 8]; + UINT sign_size = PackGetDataSize(p, "sign"); + if (sign_size <= sizeof(sign) && sign_size >= 1) + { + if (PackGetData(p, "sign", sign)) + { + BUF *b = NewBuf(); + X *x; + WriteBuf(b, cert_buf, cert_size); + x = BufToX(b, false); + if (x != NULL && x->is_compatible_bit && + sign_size == (x->bits / 8)) + { + K *k = GetKFromX(x); + // Verify the signature received from the client + if (RsaVerifyEx(c->Random, SHA1_SIZE, sign, k, x->bits)) + { + // Confirmed that the client has had this certificate + // certainly because the signature matched. + // Check whether the certificate is valid. + auth_ret = SamAuthUserByCert(hub, username, x); + if (auth_ret) + { + // Copy the certificate + c->ClientX = CloneX(x); + } + } + else + { + // Authentication failure + } + FreeK(k); + } + FreeX(x); + FreeBuf(b); + } + } + } + Free(cert_buf); + } + } + else + { + // Certificate authentication is not supported in the open source version + HLog(hub, "LH_AUTH_CERT_NOT_SUPPORT_ON_OPEN_SOURCE", c->Name, username); + Unlock(hub->lock); + ReleaseHub(hub); + FreePack(p); + c->Err = ERR_AUTHTYPE_NOT_SUPPORTED; + goto CLEANUP; + } + break; + + case AUTHTYPE_OPENVPN_CERT: + // For OpenVPN; mostly same as CLIENT_AUTHTYPE_CERT, but without + // signature verification, because it was already performed during TLS handshake. + if (c->IsInProc) + { + // Certificate authentication + cert_size = PackGetDataSize(p, "cert"); + if (cert_size >= 1 && cert_size <= 100000) + { + cert_buf = ZeroMalloc(cert_size); + if (PackGetData(p, "cert", cert_buf)) + { + BUF *b = NewBuf(); + X *x; + WriteBuf(b, cert_buf, cert_size); + x = BufToX(b, false); + if (x != NULL && x->is_compatible_bit) + { + Debug("Got to SamAuthUserByCert %s\n", username); // XXX + // Check whether the certificate is valid. + auth_ret = SamAuthUserByCert(hub, username, x); + if (auth_ret) + { + // Copy the certificate + c->ClientX = CloneX(x); + } + } + FreeX(x); + FreeBuf(b); + } + Free(cert_buf); + } + } + else + { + // OpenVPN certificate authentication cannot be used directly by external clients + Unlock(hub->lock); + ReleaseHub(hub); + FreePack(p); + c->Err = ERR_AUTHTYPE_NOT_SUPPORTED; + goto CLEANUP; + } + break; + + default: + // Unknown authentication method + Unlock(hub->lock); + ReleaseHub(hub); + FreePack(p); + c->Err = ERR_AUTHTYPE_NOT_SUPPORTED; + error_detail = "ERR_AUTHTYPE_NOT_SUPPORTED"; + goto CLEANUP; + } + + if (auth_ret == false) + { + // Get client IP to feed tools such as Fail2Ban + char ip[64]; + IPToStr(ip, sizeof(ip), &c->FirstSock->RemoteIP); + // Authentication failure + HLog(hub, "LH_AUTH_NG", c->Name, username, ip); + } + else + { + // Authentication success + HLog(hub, "LH_AUTH_OK", c->Name, username); + } + } + + if (auth_ret == false) + { + // Authentication failure + Unlock(hub->lock); + ReleaseHub(hub); + FreePack(p); + c->Err = ERR_AUTH_FAILED; + if (ms_chap_error != 0) + { + c->Err = ms_chap_error; + } + error_detail = "ERR_AUTH_FAILED"; + goto CLEANUP; + } + else + { + if(is_empty_password) + { + SOCK *s = c->FirstSock; + if (s != NULL && s->RemoteIP.addr[0] != 127) + { + if(StrCmpi(username, ADMINISTRATOR_USERNAME) == 0 || + GetHubAdminOption(hub, "deny_empty_password") != 0) + { + // When the password is empty, remote connection is not acceptable + HLog(hub, "LH_LOCAL_ONLY", c->Name, username); + + Unlock(hub->lock); + ReleaseHub(hub); + FreePack(p); + c->Err = ERR_NULL_PASSWORD_LOCAL_ONLY; + error_detail = "ERR_NULL_PASSWORD_LOCAL_ONLY"; + goto CLEANUP; + } + } + } + } + + policy = NULL; + + // Authentication success + FreePack(p); + + // Check the assigned VLAN ID + if (radius_login_opt.Out_IsRadiusLogin) + { + if (radius_login_opt.In_CheckVLanId) + { + if (radius_login_opt.Out_VLanId != 0) + { + assigned_vlan_id = radius_login_opt.Out_VLanId; + } + + if (radius_login_opt.In_DenyNoVlanId && assigned_vlan_id == 0 || assigned_vlan_id >= 4096) + { + // Deny this session + Unlock(hub->lock); + ReleaseHub(hub); + c->Err = ERR_ACCESS_DENIED; + error_detail = "In_DenyNoVlanId"; + goto CLEANUP; + } + } + } + + // Check the assigned MAC Address + if (radius_login_opt.Out_IsRadiusLogin) + { + Copy(assigned_ipc_mac_address, radius_login_opt.Out_VirtualMacAddress, 6); + } + + if (StrCmpi(username, ADMINISTRATOR_USERNAME) != 0) + { + // Get the policy + if (farm_member == false) + { + bool is_asterisk_user = false; + + // In the case of not a farm member + user = AcGetUser(hub, username); + if (user == NULL) + { + user = AcGetUser(hub, "*"); + if (user == NULL) + { + // User acquisition failure + Unlock(hub->lock); + ReleaseHub(hub); + c->Err = ERR_ACCESS_DENIED; + error_detail = "AcGetUser"; + goto CLEANUP; + } + + is_asterisk_user = true; + } + + policy = NULL; + + Lock(user->lock); + { + if (is_asterisk_user == false) + { + UCHAR associated_mac_address[6]; + + // Get the associated virtual MAC address + if (GetUserMacAddressFromUserNote(associated_mac_address, user->Note)) + { + if (IsZero(assigned_ipc_mac_address, 6)) + { + WHERE; + Copy(assigned_ipc_mac_address, associated_mac_address, 6); + } + } + } + + // Get the expiration date + user_expires = user->ExpireTime; + + StrCpy(username_real, sizeof(username_real), user->Name); + group = user->Group; + if (group != NULL) + { + AddRef(group->ref); + + Lock(group->lock); + { + // Get the group name + StrCpy(groupname, sizeof(groupname), group->Name); + } + Unlock(group->lock); + } + + if (user->Policy != NULL) + { + policy = ClonePolicy(user->Policy); + } + else + { + if (group) + { + Lock(group->lock); + { + if (group->Policy != NULL) + { + policy = ClonePolicy(group->Policy); + } + } + Unlock(group->lock); + } + } + + if (group != NULL) + { + ReleaseGroup(group); + } + } + Unlock(user->lock); + loggedin_user_object = user; + } + else + { + // In the case of farm member + policy = ClonePolicy(&ticketed_policy); + } + } + else + { + // Administrator mode + admin_mode = true; + StrCpy(username_real, sizeof(username_real), ADMINISTRATOR_USERNAME); + + policy = ClonePolicy(GetDefaultPolicy()); + policy->NoBroadcastLimiter = true; + policy->MonitorPort = true; + } + + if (policy == NULL) + { + // Use the default policy + policy = ClonePolicy(GetDefaultPolicy()); + } + + if (policy->MaxConnection == 0) + { + policy->MaxConnection = MAX_TCP_CONNECTION; + } + + if (policy->TimeOut == 0) + { + policy->TimeOut = 20; + } + + if (qos) + { + // VoIP / QoS + if (policy->NoQoS) + { + // Policy does not allow QoS + qos = false; + } + if (GetServerCapsBool(c->Cedar->Server, "b_support_qos") == false) + { + // Server does not support QoS + qos = false; + policy->NoQoS = true; + } + if (GetHubAdminOption(hub, "deny_qos") != 0) + { + // It is prohibited in the management options + qos = false; + policy->NoQoS = true; + } + } + + if (GetHubAdminOption(hub, "max_bitrates_download") != 0) + { + if (policy->MaxDownload == 0) + { + policy->MaxDownload = GetHubAdminOption(hub, "max_bitrates_download"); + } + else + { + UINT r = GetHubAdminOption(hub, "max_bitrates_download"); + policy->MaxDownload = MIN(policy->MaxDownload, r); + } + } + + if (GetHubAdminOption(hub, "max_bitrates_upload") != 0) + { + if (policy->MaxUpload == 0) + { + policy->MaxUpload = GetHubAdminOption(hub, "max_bitrates_upload"); + } + else + { + UINT r = GetHubAdminOption(hub, "max_bitrates_upload"); + policy->MaxUpload = MIN(policy->MaxUpload, r); + } + } + + if (GetHubAdminOption(hub, "deny_bridge") != 0) + { + policy->NoBridge = true; + } + + if (GetHubAdminOption(hub, "deny_routing") != 0) + { + policy->NoRouting = true; + } + + if (c->IsInProc) + { + policy->NoBridge = false; + policy->NoRouting = false; + } + + if (hub->Option->ClientMinimumRequiredBuild > c->ClientBuild && + InStrEx(c->ClientStr, "client", false)) + { + // Build number of the client is too small + HLog(hub, "LH_CLIENT_VERSION_OLD", c->Name, c->ClientBuild, hub->Option->ClientMinimumRequiredBuild); + + Unlock(hub->lock); + ReleaseHub(hub); + c->Err = ERR_VERSION_INVALID; + Free(policy); + error_detail = "ERR_VERSION_INVALID"; + goto CLEANUP; + } + + if (hub->Option->RequiredClientId != 0 && + hub->Option->RequiredClientId != client_id && + InStrEx(c->ClientStr, "client", false)) + { + // Build number of the client is too small + HLog(hub, "LH_CLIENT_ID_REQUIRED", c->Name, client_id, hub->Option->RequiredClientId); + + Unlock(hub->lock); + ReleaseHub(hub); + c->Err = ERR_CLIENT_ID_REQUIRED; + error_detail = "ERR_CLIENT_ID_REQUIRED"; + Free(policy); + goto CLEANUP; + } + + if ((policy->NoSavePassword) || (policy->AutoDisconnect != 0)) + { + if (c->ClientBuild < 6560 && InStrEx(c->ClientStr, "client", false)) + { + // If NoSavePassword policy is specified, + // only supported client can connect + HLog(hub, "LH_CLIENT_VERSION_OLD", c->Name, c->ClientBuild, 6560); + + Unlock(hub->lock); + ReleaseHub(hub); + c->Err = ERR_VERSION_INVALID; + error_detail = "ERR_VERSION_INVALID"; + Free(policy); + goto CLEANUP; + } + } + + if (user_expires != 0 && user_expires <= SystemTime64()) + { + // User expired + HLog(hub, "LH_USER_EXPIRES", c->Name, username); + + Unlock(hub->lock); + ReleaseHub(hub); + c->Err = ERR_ACCESS_DENIED; + error_detail = "LH_USER_EXPIRES"; + Free(policy); + goto CLEANUP; + } + + if (policy->Access == false) + { + // Access is denied + HLog(hub, "LH_POLICY_ACCESS_NG", c->Name, username); + + Unlock(hub->lock); + ReleaseHub(hub); + error_detail = "LH_POLICY_ACCESS_NG"; + c->Err = ERR_ACCESS_DENIED; + Free(policy); + goto CLEANUP; + } + + // Determine the contents of the policy by comparing to + // option presented by client or deny the connection. + // Confirm the connectivity in the monitor-mode first + if (require_monitor_mode && policy->MonitorPort == false) + { + // Can not connect in the monitor port mode + HLog(hub, "LH_POLICY_MONITOR_MODE", c->Name); + + Unlock(hub->lock); + ReleaseHub(hub); + c->Err = ERR_MONITOR_MODE_DENIED; + Free(policy); + error_detail = "ERR_MONITOR_MODE_DENIED"; + goto CLEANUP; + } + + if (policy->MonitorPort) + { + if (require_monitor_mode == false) + { + policy->MonitorPort = false; + } + } + + if (policy->MonitorPort) + { + qos = false; + } + + // Determine whether it can be connected by a bridge / routing mode next + if (require_bridge_routing_mode && + (policy->NoBridge && policy->NoRouting)) + { + // Can not be connected by a bridge / routing mode + HLog(hub, "LH_POLICY_BRIDGE_MODE", c->Name); + + Unlock(hub->lock); + ReleaseHub(hub); + c->Err = ERR_BRIDGE_MODE_DENIED; + error_detail = "ERR_BRIDGE_MODE_DENIED"; + Free(policy); + goto CLEANUP; + } + + if (require_bridge_routing_mode == false) + { + policy->NoBridge = true; + policy->NoRouting = true; + } + + if (Cmp(unique, unique2, SHA1_SIZE) == 0) + { + // It's a localhost session + local_host_session = true; + } + + if (local_host_session == false) + { + // Make further judgment whether localhost session + SOCK *s = c->FirstSock; + + if (s != NULL) + { + if (IsIPMyHost(&s->RemoteIP)) + { + // It's a localhost session + local_host_session = true; + } + } + } + + if (local_host_session) + { + // Permit routing or bridging in the case of localhost session + policy->NoBridge = false; + policy->NoRouting = false; + } + + if (local_host_session == false) + { + + if (policy->NoBridge == false || policy->NoRouting == false) + { + use_bridge_license = true; + } + else + { + use_client_license = true; + } + } + + + if (server != NULL && server->ServerType != SERVER_TYPE_FARM_MEMBER && + policy != NULL) + { + if (GetServerCapsBool(hub->Cedar->Server, "b_support_limit_multilogin")) + { + // Check if the number of concurrent multiple logins limit is specified in the policy + RPC_ENUM_SESSION t; + UINT i, num; + UINT max_logins = policy->MultiLogins; + UINT ao = GetHubAdminOption(hub, "max_multilogins_per_user"); + + if (ao != 0) + { + if (max_logins != 0) + { + max_logins = MIN(max_logins, ao); + } + else + { + max_logins = ao; + } + } + + if (max_logins != 0) + { + Zero(&t, sizeof(t)); + StrCpy(t.HubName, sizeof(t.HubName), hub->Name); + + Unlock(hub->lock); + + SiEnumSessionMain(server, &t); + + Lock(hub->lock); + + num = 0; + + for (i = 0;i < t.NumSession;i++) + { + RPC_ENUM_SESSION_ITEM *e = &t.Sessions[i]; + + if (e->BridgeMode == false && e->Layer3Mode == false && e->LinkMode == false && e->CurrentNumTcp != 0) + { + if (StrCmpi(e->Username, username) == 0 && + (IsZero(e->UniqueId, 16) || Cmp(e->UniqueId, node.UniqueId, 16) != 0)) + { + num++; + } + } + } + + FreeRpcEnumSession(&t); + + if (num >= max_logins) + { + // Can not connect any more + Unlock(hub->lock); + + // Dump a detailed error log + HLog(hub, "LH_TOO_MANY_MULTILOGINS", + c->Name, + username, max_logins, num); + + ReleaseHub(hub); + c->Err = ERR_TOO_MANY_USER_SESSION; + Free(policy); + goto CLEANUP; + } + } + } + } + + if (loggedin_user_object != NULL) + { + // Update the user information + Lock(loggedin_user_object->lock); + { + loggedin_user_object->LastLoginTime = SystemTime64(); + } + Unlock(loggedin_user_object->lock); + } + + // Update the number of log-ins + hub->LastCommTime = hub->LastLoginTime = SystemTime64(); + + if (farm_controller) + { + wchar_t *msg = GetHubMsg(hub); + + Unlock(hub->lock); + + Lock(cedar->CedarSuperLock); + + // In the case of farm controller, choose a farm members to host this HUB + LockList(server->FarmMemberList); + { + HLog(hub, "LH_FARM_SELECT_1", c->Name); + f = SiGetHubHostingMember(server, hub, admin_mode, c); + + if (f == NULL) + { + // Failed in the selection + HLog(hub, "LH_FARM_SELECT_2", c->Name); + UnlockList(server->FarmMemberList); + Unlock(cedar->CedarSuperLock); + ReleaseHub(hub); + c->Err = ERR_COULD_NOT_HOST_HUB_ON_FARM; + Free(policy); + Free(msg); + goto CLEANUP; + } + else + { + if (f->Me == false) + { + UCHAR ticket[SHA1_SIZE]; + PACK *p; + BUF *b; + UINT i; + + SLog(c->Cedar, "LH_FARM_SELECT_4", c->Name, f->hostname); + + // Create a session on the selected server farm member + Rand(ticket, sizeof(ticket)); + SiCallCreateTicket(server, f, hub->Name, + username, username_real, policy, ticket, Inc(hub->SessionCounter), groupname); + + p = NewPack(); + PackAddInt(p, "Redirect", 1); + PackAddIp32(p, "Ip", f->Ip); + for (i = 0;i < f->NumPort;i++) + { + PackAddIntEx(p, "Port", f->Ports[i], i, f->NumPort); + } + PackAddData(p, "Ticket", ticket, sizeof(ticket)); + + if (true) + { + char *utf = CopyUniToUtf(msg); + + PackAddData(p, "Msg", utf, StrLen(utf)); + + Free(utf); + } + + b = XToBuf(f->ServerCert, false); + PackAddBuf(p, "Cert", b); + FreeBuf(b); + + UnlockList(server->FarmMemberList); + Unlock(cedar->CedarSuperLock); + ReleaseHub(hub); + + HttpServerSend(c->FirstSock, p); + FreePack(p); + + c->Err = 0; + Free(policy); + + FreePack(HttpServerRecv(c->FirstSock)); + Free(msg); + goto CLEANUP; + } + else + { + HLog(hub, "LH_FARM_SELECT_3", c->Name); + // Continue the process because myself was selected + UnlockList(server->FarmMemberList); + Unlock(cedar->CedarSuperLock); + f->Point = SiGetPoint(server); + Lock(hub->lock); + Free(msg); + } + } + } + } + + if (admin_mode == false) + { + // Check the maximum number of connections of the HUB + if (hub->Option->MaxSession != 0 && + hub->Option->MaxSession <= Count(hub->NumSessions)) + { + // Can not connect any more + Unlock(hub->lock); + + HLog(hub, "LH_MAX_SESSION", c->Name, hub->Option->MaxSession); + + ReleaseHub(hub); + c->Err = ERR_HUB_IS_BUSY; + Free(policy); + error_detail = "ERR_HUB_IS_BUSY"; + goto CLEANUP; + } + } + + if (use_encrypt == false && c->FirstSock->IsReverseAcceptedSocket) + { + // On VPN Azure, SSL encryption is mandated. + use_encrypt = true; + } + + if (use_client_license || use_bridge_license) + { + // Examine whether not to conflict with the limit of simultaneous connections + // number of sessions defined by the Virtual HUB management options + if ( + (GetHubAdminOption(hub, "max_sessions") != 0 && + (Count(hub->NumSessionsClient) + Count(hub->NumSessionsBridge)) >= GetHubAdminOption(hub, "max_sessions")) + || + (hub->Option->MaxSession != 0 && + (Count(hub->NumSessionsClient) + Count(hub->NumSessionsBridge)) >= hub->Option->MaxSession)) + { + // Can not connect any more + Unlock(hub->lock); + + HLog(hub, "LH_MAX_SESSION", c->Name, GetHubAdminOption(hub, "max_sessions")); + + ReleaseHub(hub); + c->Err = ERR_HUB_IS_BUSY; + Free(policy); + goto CLEANUP; + } + } + + if (use_client_license) + { + // Examine whether not to conflict with the limit of simultaneous connections + // number of sessions(client) defined by the Virtual HUB management options + if (((GetHubAdminOption(hub, "max_sessions_client_bridge_apply") != 0 + ) && + Count(hub->NumSessionsClient) >= GetHubAdminOption(hub, "max_sessions_client") && hub->Cedar->Server != NULL && hub->Cedar->Server->ServerType != SERVER_TYPE_FARM_MEMBER) + || + (hub->FarmMember_MaxSessionClientBridgeApply && + Count(hub->NumSessionsClient) >= hub->FarmMember_MaxSessionClient)) + { + // Can not connect any more + Unlock(hub->lock); + + HLog(hub, "LH_MAX_SESSION_CLIENT", c->Name, GetHubAdminOption(hub, "max_sessions_client")); + + ReleaseHub(hub); + c->Err = ERR_HUB_IS_BUSY; + Free(policy); + goto CLEANUP; + } + } + + if (use_bridge_license) + { + // Examine whether not to conflict with the limit of simultaneous connections + // number of sessions(bridge) defined by the Virtual HUB management options + if (((GetHubAdminOption(hub, "max_sessions_client_bridge_apply") != 0 + ) && + Count(hub->NumSessionsBridge) >= GetHubAdminOption(hub, "max_sessions_bridge") && hub->Cedar->Server != NULL && hub->Cedar->Server->ServerType != SERVER_TYPE_FARM_MEMBER) + || + (hub->FarmMember_MaxSessionClientBridgeApply && + Count(hub->NumSessionsBridge) >= hub->FarmMember_MaxSessionBridge)) + { + // Can not connect any more + Unlock(hub->lock); + + HLog(hub, "LH_MAX_SESSION_BRIDGE", c->Name, GetHubAdminOption(hub, "max_sessions_bridge")); + + ReleaseHub(hub); + c->Err = ERR_HUB_IS_BUSY; + Free(policy); + goto CLEANUP; + } + } + + if (Count(hub->Cedar->CurrentSessions) >= GetServerCapsInt(hub->Cedar->Server, "i_max_sessions")) + { + // Can not connect any more + Unlock(hub->lock); + + HLog(hub, "LH_MAX_SESSION_2", c->Name, GetServerCapsInt(hub->Cedar->Server, "i_max_sessions")); + + ReleaseHub(hub); + c->Err = ERR_HUB_IS_BUSY; + Free(policy); + goto CLEANUP; + } + + // Increment the current number of connections + Inc(hub->NumSessions); + if (use_bridge_license) + { + Inc(hub->NumSessionsBridge); + } + + if (use_client_license) + { + Inc(hub->NumSessionsClient); + } + Inc(hub->Cedar->CurrentSessions); + + // Calculate the time-out period + timeout = policy->TimeOut * 1000; // Convert milliseconds to seconds + if (timeout == 0) + { + timeout = TIMEOUT_DEFAULT; + } + timeout = MIN(timeout, TIMEOUT_MAX); + timeout = MAX(timeout, TIMEOUT_MIN); + + // Update the max_connection according to the policy + max_connection = MIN(max_connection, policy->MaxConnection); + max_connection = MIN(max_connection, MAX_TCP_CONNECTION); + max_connection = MAX(max_connection, 1); + + if (c->FirstSock->IsRUDPSocket) + { + // In the case of TCP-over-UDP + half_connection = false; + + // Disable the QoS + qos = false; + + if (enable_udp_recovery == false) + { + // Disable the session reconnection feature + no_reconnect_to_session = true; + max_connection = 1; + } + else + { + // If the UDP recovery is enabled, permit the session re-connection feature (for 2) + no_reconnect_to_session = false; + max_connection = NUM_TCP_CONNECTION_FOR_UDP_RECOVERY; + } + } + + if (half_connection) + { + // Number of connections should be more than 2 in the case of Half Connection + max_connection = MAX(max_connection, 2); + } + + if (qos) + { + // Number of connections is set to 2 or more when using the VoIP / QoS + max_connection = MAX(max_connection, 2); + if (half_connection) + { + max_connection = MAX(max_connection, 4); + } + } + + c->Status = CONNECTION_STATUS_ESTABLISHED; + + // Remove the connection from Cedar + DelConnection(c->Cedar, c); + + // VLAN ID + if (assigned_vlan_id != 0) + { + if (policy->VLanId == 0) + { + policy->VLanId = assigned_vlan_id; + } + } + + // Create a Session + StrLower(username); + s = NewServerSessionEx(c->Cedar, c, hub, username, policy, c->IsInProc, + (c->IsInProc && IsZero(assigned_ipc_mac_address, 6) == false) ? assigned_ipc_mac_address : NULL); + + s->EnableUdpRecovery = enable_udp_recovery; + s->LocalHostSession = local_host_session; + s->NormalClient = true; + + IPToStr(s->ClientIP, sizeof(s->ClientIP), &c->ClientIp); + + if (c->FirstSock->IsRUDPSocket) + { + // R-UDP session + s->IsRUDPSession = true; + s->RUdpMss = c->FirstSock->RUDP_OptimizedMss; + Debug("ServerAccept(): Optimized MSS Value for R-UDP: %u\n", s->RUdpMss); + AddProtocolDetailsKeyValueInt(s->ProtocolDetails, sizeof(s->ProtocolDetails), "RUDP_MSS", s->RUdpMss); + } + + if (enable_bulk_on_rudp) + { + // Allow bulk transfer on R-UDP + s->EnableBulkOnRUDP = true; + s->EnableHMacOnBulkOfRUDP = enable_hmac_on_bulk_of_rudp; + } + + s->IsAzureSession = c->FirstSock->IsReverseAcceptedSocket; + + StrCpy(s->UnderlayProtocol, sizeof(s->UnderlayProtocol), c->FirstSock->UnderlayProtocol); + + AddProtocolDetailsStr(s->ProtocolDetails, sizeof(s->ProtocolDetails), c->FirstSock->ProtocolDetails); + + if (server != NULL) + { + s->NoSendSignature = server->NoSendSignature; + } + + if (c->IsInProc) + { + s->NoSendSignature = true; + } + + if (c->IsInProc && StrCmpi(c->InProcPrefix, OPENVPN_IPC_POSTFIX_L3) == 0) + { + // OpenVPN L3 session + s->IsOpenVPNL3Session = true; + } + + if (c->IsInProc && StrCmpi(c->InProcPrefix, OPENVPN_IPC_POSTFIX_L2) == 0) + { + // OpenVPN L2 session + s->IsOpenVPNL2Session = true; + } + + // Determine whether the use of UDP acceleration mode + if (use_udp_acceleration_client) + { + s->UseUdpAcceleration = true; + + s->UdpAccelFastDisconnectDetect = support_udp_accel_fast_disconnect_detect; + + udp_acceleration_version = 1; + if (client_udp_acceleration_max_version >= 2) + { + udp_acceleration_version = 2; + } + } + + if (client_rudp_bulk_max_version >= 2) + { + rudp_bulk_version = 2; + } + + if (s->EnableBulkOnRUDP) + { + AddProtocolDetailsKeyValueInt(s->ProtocolDetails, sizeof(s->ProtocolDetails), "RUDP_Bulk_Ver", s->BulkOnRUDPVersion); + } + + if (hub->Option != NULL && hub->Option->DisableUdpAcceleration) + { + s->UseUdpAcceleration = false; + } + + if (IsZeroIP(&c->FirstSock->Reverse_MyServerGlobalIp) == false && + CmpIpAddr(&c->FirstSock->Reverse_MyServerGlobalIp, &c->FirstSock->RemoteIP) == 0) + { + // Disable forcibly the UDP acceleration mode if VPN Server and VPN Client + // are in same LAN in the case of using VPN Azure. + // (Or this may cause infinite loop of packet) + s->UseUdpAcceleration = false; + } + + if (s->UseUdpAcceleration) + { + s->UseHMacOnUdpAcceleration = use_hmac_on_udp_acceleration; + } + + Debug("UseUdpAcceleration = %u\n", s->UseUdpAcceleration); + Debug("UseHMacOnUdpAcceleration = %u\n", s->UseHMacOnUdpAcceleration); + Debug("UdpAccelerationVersion = %u\n", s->UdpAccelerationVersion); + + if (s->UseUdpAcceleration) + { + bool no_nat_t = false; + + + // Initialize the UDP acceleration function + s->UdpAccel = NewUdpAccel(c->Cedar, (c->FirstSock->IsRUDPSocket ? NULL : &c->FirstSock->LocalIP), false, c->FirstSock->IsRUDPSocket, no_nat_t); + if (s->UdpAccel == NULL) + { + s->UseUdpAcceleration = false; + Debug("NewUdpAccel Failed.\n"); + } + else + { + s->UdpAccel->Version = udp_acceleration_version; + + if (UdpAccelInitServer(s->UdpAccel, + s->UdpAccel->Version == 2 ? udp_acceleration_client_key_v2 : udp_acceleration_client_key, + &udp_acceleration_client_ip, udp_acceleration_client_port, &c->FirstSock->RemoteIP) == false) + { + Debug("UdpAccelInitServer Failed.\n"); + s->UseUdpAcceleration = false; + } + + s->UdpAccel->FastDetect = s->UdpAccelFastDisconnectDetect; + + if (use_encrypt == false) + { + s->UdpAccel->PlainTextMode = true; + } + + s->UdpAccel->UseHMac = s->UseHMacOnUdpAcceleration; + + AddProtocolDetailsKeyValueInt(s->ProtocolDetails, sizeof(s->ProtocolDetails), "UDPAccel_Ver", s->UdpAccel->Version); + + AddProtocolDetailsStr(s->ProtocolDetails, sizeof(s->ProtocolDetails), s->UdpAccel->Version > 1 ? "ChaCha20-Poly1305" : "RC4"); + + AddProtocolDetailsKeyValueInt(s->ProtocolDetails, sizeof(s->ProtocolDetails), "UDPAccel_MSS", UdpAccelCalcMss(s->UdpAccel)); + } + } + + s->UseClientLicense = use_client_license; + s->UseBridgeLicense = use_bridge_license; + + s->AdjustMss = adjust_mss; + if (s->AdjustMss != 0) + { + Debug("AdjustMSS: %u\n", s->AdjustMss); + AddProtocolDetailsKeyValueInt(s->ProtocolDetails, sizeof(s->ProtocolDetails), "AdjustMSS", s->AdjustMss); + } + + s->IsBridgeMode = (policy->NoBridge == false) || (policy->NoRouting == false); + s->IsMonitorMode = policy->MonitorPort; + + // Decide whether IPv6 session + s->IPv6Session = false; + + if (node.ClientIpAddress == 0) + { + s->IPv6Session = true; + } + + if (use_bridge_license) + { + Inc(s->Cedar->AssignedBridgeLicense); + } + + if (use_client_license) + { + Inc(s->Cedar->AssignedClientLicense); + } + + if (server != NULL) + { + // Update the total allocation of the number of licenses for Server structure + if (server->ServerType == SERVER_TYPE_STANDALONE) + { + // Update only stand-alone mode + // (Periodically poll in the cluster controller mode) + server->CurrentAssignedClientLicense = Count(s->Cedar->AssignedClientLicense); + server->CurrentAssignedBridgeLicense = Count(s->Cedar->AssignedBridgeLicense); + } + } + + if (StrLen(sessionname) != 0) + { + // Specify the session name + Free(s->Name); + s->Name = CopyStr(sessionname); + } + + { + char ip[128]; + IPToStr(ip, sizeof(ip), &c->FirstSock->RemoteIP); + HLog(hub, "LH_NEW_SESSION", c->Name, s->Name, ip, c->FirstSock->RemotePort, c->FirstSock->UnderlayProtocol, c->FirstSock->ProtocolDetails); + } + + c->Session = s; + s->AdministratorMode = admin_mode; + StrCpy(s->UserNameReal, sizeof(s->UserNameReal), username_real); + StrCpy(s->GroupName, sizeof(s->GroupName), groupname); + + // Get the session key + Copy(session_key, s->SessionKey, SHA1_SIZE); + + // Set the parameters + s->MaxConnection = max_connection; + s->UseEncrypt = use_encrypt; + s->UseCompress = use_compress; + s->HalfConnection = half_connection; + s->Timeout = timeout; + s->QoS = qos; + s->NoReconnectToSession = no_reconnect_to_session; + s->VLanId = policy->VLanId; + + // User name + s->Username = CopyStr(username); + + HLog(hub, "LH_SET_SESSION", s->Name, s->MaxConnection, + s->UseEncrypt ? _UU("L_YES") : _UU("L_NO"), + s->UseCompress ? _UU("L_YES") : _UU("L_NO"), + s->HalfConnection ? _UU("L_YES") : _UU("L_NO"), + s->Timeout / 1000); + + msg = GetHubMsg(hub); + + // Suppress client update notification flag + if (hub->Option != NULL) + { + suppress_client_update_notification = hub->Option->SuppressClientUpdateNotification; + } + } + Unlock(hub->lock); + + // Send a Welcome packet to the client + p = PackWelcome(s); + + PackAddBool(p, "suppress_client_update_notification", suppress_client_update_notification); + + if (s != NULL && s->InProcMode) + { + if (IsZero(mschap_v2_server_response_20, sizeof(mschap_v2_server_response_20)) == false) + { + // MS-CHAPv2 Response + PackAddData(p, "IpcMsChapV2ServerResponse", mschap_v2_server_response_20, sizeof(mschap_v2_server_response_20)); + } + } + + if (true) + { + // A message to be displayed in the VPN Client (Will not be displayed if the VPN Gate Virtual HUB) + char *utf; + wchar_t winver_msg_client[3800]; + wchar_t winver_msg_server[3800]; + UINT tmpsize; + wchar_t *tmp; + RPC_WINVER server_winver; + + GetWinVer(&server_winver); + + Zero(winver_msg_client, sizeof(winver_msg_client)); + Zero(winver_msg_server, sizeof(winver_msg_server)); + + if (IsSupportedWinVer(&winver) == false) + { + SYSTEMTIME st; + + LocalTime(&st); + + UniFormat(winver_msg_client, sizeof(winver_msg_client), _UU("WINVER_ERROR_FORMAT"), + _UU("WINVER_ERROR_PC_LOCAL"), + winver.Title, + _UU("WINVER_ERROR_VPNSERVER"), + SUPPORTED_WINDOWS_LIST, + _UU("WINVER_ERROR_PC_LOCAL"), + _UU("WINVER_ERROR_VPNSERVER"), + _UU("WINVER_ERROR_VPNSERVER"), + _UU("WINVER_ERROR_VPNSERVER"), + st.wYear, st.wMonth); + } + + if (IsSupportedWinVer(&server_winver) == false) + { + SYSTEMTIME st; + + LocalTime(&st); + + UniFormat(winver_msg_server, sizeof(winver_msg_server), _UU("WINVER_ERROR_FORMAT"), + _UU("WINVER_ERROR_PC_REMOTE"), + server_winver.Title, + _UU("WINVER_ERROR_VPNSERVER"), + SUPPORTED_WINDOWS_LIST, + _UU("WINVER_ERROR_PC_REMOTE"), + _UU("WINVER_ERROR_VPNSERVER"), + _UU("WINVER_ERROR_VPNSERVER"), + _UU("WINVER_ERROR_VPNSERVER"), + st.wYear, st.wMonth); + } + + tmpsize = UniStrSize(winver_msg_client) + UniStrSize(winver_msg_server) + UniStrSize(msg) + (16000 + 3000) * sizeof(wchar_t); + + tmp = ZeroMalloc(tmpsize); + + if (IsURLMsg(msg, NULL, 0) == false) + { + + if (s != NULL && s->IsRUDPSession && c != NULL && StrCmpi(hub->Name, VG_HUBNAME) != 0) + { + // Show the warning message if the connection is made by NAT-T + wchar_t *tmp2; + UINT tmp2_size = 2400 * sizeof(wchar_t); + char local_name[128]; + wchar_t local_name_2[128]; + char local_name_3[128]; + + Zero(local_name, sizeof(local_name)); + Zero(local_name_2, sizeof(local_name_2)); + Zero(local_name_3, sizeof(local_name_3)); + + GetMachineName(local_name, sizeof(local_name)); + +#ifdef OS_WIN32 + MsGetComputerNameFullEx(local_name_2, sizeof(local_name_2), true); + + UniToStr(local_name_3, sizeof(local_name_3), local_name_2); + + if (IsEmptyStr(local_name_3) == false) + { + StrCpy(local_name, sizeof(local_name), local_name_3); + } +#endif // OS_WIN32 + + tmp2 = ZeroMalloc(tmp2_size); + UniFormat(tmp2, tmp2_size, _UU(c->ClientBuild >= 9428 ? "NATT_MSG" : "NATT_MSG2"), local_name); + + UniStrCat(tmp, tmpsize, tmp2); + + Free(tmp2); + } + + { + if (GetGlobalServerFlag(GSF_SHOW_OSS_MSG) != 0) + { + UniStrCat(tmp, tmpsize, _UU("OSS_MSG")); + } + } + + { + UniStrCat(tmp, tmpsize, winver_msg_client); + UniStrCat(tmp, tmpsize, winver_msg_server); + } + } + UniStrCat(tmp, tmpsize, msg); + + utf = CopyUniToUtf(tmp); + + PackAddData(p, "Msg", utf, StrLen(utf)); + + Free(tmp); + Free(utf); + } + + Free(msg); + + // Brand string for the connection limit + { + char *branded_cfroms = _SS("BRANDED_C_FROM_S"); + if(StrLen(branded_cfroms) > 0) + { + PackAddStr(p, "branded_cfroms", branded_cfroms); + } + } + + HttpServerSend(c->FirstSock, p); + FreePack(p); + + // Receive a signature + Copy(&c->Session->NodeInfo, &node, sizeof(NODE_INFO)); + + + { + wchar_t tmp[MAX_SIZE * 2]; + NodeInfoToStr(tmp, sizeof(tmp), &s->NodeInfo); + + HLog(hub, "LH_NODE_INFO", s->Name, tmp); + + if (s->VLanId != 0) + { + HLog(hub, "LH_VLAN_ID", s->Name, s->VLanId); + } + } + + // Shift the connection to the tunneling mode + StartTunnelingMode(c); + + // Processing of half-connection mode + if (s->HalfConnection) + { + // The direction of the first socket is client to server + TCPSOCK *ts = (TCPSOCK *)LIST_DATA(c->Tcp->TcpSockList, 0); + ts->Direction = TCP_CLIENT_TO_SERVER; + } + + if (s->Hub->Type == HUB_TYPE_FARM_DYNAMIC && s->Cedar->Server != NULL && s->Cedar->Server->ServerType == SERVER_TYPE_FARM_CONTROLLER) + { + if (s->Hub->BeingOffline == false) + { + // Start the SecureNAT on the dynamic Virtual HUB + EnableSecureNATEx(s->Hub, false, true); + + cluster_dynamic_secure_nat = true; + } + } + + if (s->LocalHostSession) + { + // Update the local MAC address list + RefreshLocalMacAddressList(); + } + + // Discard the user list cache + DeleteAllUserListCache(hub->UserList); + + + // Main routine of the session + Debug("SessionMain()\n"); + s->NumLoginIncrementUserObject = loggedin_user_object; + s->NumLoginIncrementHubObject = s->Hub; + s->NumLoginIncrementTick = Tick64() + (UINT64)NUM_LOGIN_INCREMENT_INTERVAL; + SessionMain(s); + + + // Discard the user list cache + DeleteAllUserListCache(hub->UserList); + + // Decrement the current number of connections + Lock(s->Hub->lock); + { + if (use_bridge_license) + { + Dec(hub->NumSessionsBridge); + } + + if (use_client_license) + { + Dec(hub->NumSessionsClient); + } + + Dec(s->Hub->NumSessions); + Dec(s->Hub->Cedar->CurrentSessions); + + // Decrement the number of licenses + if (use_bridge_license) + { + Dec(s->Cedar->AssignedBridgeLicense); + } + + if (use_client_license) + { + Dec(s->Cedar->AssignedClientLicense); + } + + if (server != NULL) + { + // Update the total allocation of the number of licenses for Server structure + if (server->ServerType == SERVER_TYPE_STANDALONE) + { + // Update only stand-alone mode + // (Periodically polled in the cluster controller mode) + server->CurrentAssignedClientLicense = Count(s->Cedar->AssignedClientLicense); + server->CurrentAssignedBridgeLicense = Count(s->Cedar->AssignedBridgeLicense); + } + } + } + Unlock(s->Hub->lock); + + PrintSessionTotalDataSize(s); + + HLog(s->Hub, "LH_END_SESSION", s->Name, s->TotalSendSizeReal, s->TotalRecvSizeReal); + + if (cluster_dynamic_secure_nat && s->Hub->BeingOffline == false) + { + // Stop the SecureNAT on the dynamic Virtual HUB + EnableSecureNATEx(s->Hub, false, true); + } + + if (s->UdpAccel != NULL) + { + // Release the UDP acceleration + FreeUdpAccel(s->UdpAccel); + s->UdpAccel = NULL; + } + + ReleaseSession(s); + + ret = true; + c->Err = ERR_SESSION_REMOVED; + + ReleaseHub(hub); + + goto CLEANUP; + } + else if (StrCmpi(method, "additional_connect") == 0) + { + SOCK *sock; + TCPSOCK *ts; + UINT dummy; + + c->Type = CONNECTION_TYPE_ADDITIONAL; + + // Additional connection + // Read the session key + if (GetSessionKeyFromPack(p, session_key, &dummy) == false) + { + FreePack(p); + c->Err = ERR_PROTOCOL_ERROR; + goto CLEANUP; + } + + FreePack(p); + + // Get the session from the session key + s = GetSessionFromKey(c->Cedar, session_key); + if (s == NULL || s->Halt || s->NoReconnectToSession) + { + // Session can not be found, or re-connection is prohibited + Debug("Session Not Found.\n"); + c->Err = ERR_SESSION_TIMEOUT; + goto CLEANUP; + } + + // Session is found + Debug("Session Found: %s\n", s->Name); + // Check the protocol of session + c->Err = 0; + Lock(s->lock); + { + if (s->Connection->Protocol != CONNECTION_TCP) + { + c->Err = ERR_INVALID_PROTOCOL; + } + } + Unlock(s->lock); + // Check the current number of connections of the session + Lock(s->Connection->lock); + if (c->Err == 0) + { + if (Count(s->Connection->CurrentNumConnection) > s->MaxConnection) + { + c->Err = ERR_TOO_MANY_CONNECTION; + } + } + if (c->Err != 0) + { + Unlock(s->Connection->lock); + if (c->Err == ERR_TOO_MANY_CONNECTION) + { + Debug("Session TOO MANY CONNECTIONS !!: %u\n", + Count(s->Connection->CurrentNumConnection)); + } + else + { + Debug("Session Invalid Protocol.\n"); + } + ReleaseSession(s); + goto CLEANUP; + } + + // Add the socket of this connection to the connection list of the session (TCP) + sock = c->FirstSock; + + if (sock->IsRUDPSocket && sock->BulkRecvKey != NULL && sock->BulkSendKey != NULL) + { + if (s->BulkRecvKeySize != 0 && s->BulkSendKeySize != 0) + { + // Restore R-UDP bulk send/recv keys for additional connections + Copy(sock->BulkRecvKey->Data, s->BulkRecvKey, s->BulkRecvKeySize); + sock->BulkRecvKey->Size = s->BulkRecvKeySize; + Copy(sock->BulkSendKey->Data, s->BulkSendKey, s->BulkSendKeySize); + sock->BulkSendKey->Size = s->BulkSendKeySize; + } + } + + ts = NewTcpSock(sock); + SetTimeout(sock, CONNECTING_TIMEOUT); + direction = TCP_BOTH; + LockList(s->Connection->Tcp->TcpSockList); + { + if (s->HalfConnection) + { + // In half-connection, directions of the TCP connections are automatically + // adjusted by examining all current direction of the TCP connections + UINT i, c2s, s2c; + c2s = s2c = 0; + for (i = 0;i < LIST_NUM(s->Connection->Tcp->TcpSockList);i++) + { + TCPSOCK *ts = (TCPSOCK *)LIST_DATA(s->Connection->Tcp->TcpSockList, i); + if (ts->Direction == TCP_SERVER_TO_CLIENT) + { + s2c++; + } + else + { + c2s++; + } + } + if (s2c > c2s) + { + direction = TCP_CLIENT_TO_SERVER; + } + else + { + direction = TCP_SERVER_TO_CLIENT; + } + Debug("%u/%u\n", s2c, c2s); + ts->Direction = direction; + } + } + UnlockList(s->Connection->Tcp->TcpSockList); + + // Return a success result + p = PackError(ERR_NO_ERROR); + PackAddInt(p, "direction", direction); + + HttpServerSend(c->FirstSock, p); + FreePack(p); + + SetTimeout(sock, INFINITE); + + LockList(s->Connection->Tcp->TcpSockList); + { + Add(s->Connection->Tcp->TcpSockList, ts); + } + UnlockList(s->Connection->Tcp->TcpSockList); + + // Increment the number of connections + Inc(s->Connection->CurrentNumConnection); + Debug("TCP Connection Incremented: %u\n", Count(s->Connection->CurrentNumConnection)); + + // Issue the Cancel of session + Cancel(s->Cancel1); + + Unlock(s->Connection->lock); + + c->flag1 = true; + + ReleaseSession(s); + + return true; + } + else if (StrCmpi(method, "enum_hub") == 0) + { + // Enumerate the Virtual HUB + UINT i, num; + LIST *o; + o = NewListFast(NULL); + + c->Type = CONNECTION_TYPE_ENUM_HUB; + + FreePack(p); + p = NewPack(); + LockList(c->Cedar->HubList); + { + num = LIST_NUM(c->Cedar->HubList); + for (i = 0;i < num;i++) + { + HUB *h = LIST_DATA(c->Cedar->HubList, i); + if (h->Option != NULL && h->Option->NoEnum == false) + { + Insert(o, CopyStr(h->Name)); + } + } + } + UnlockList(c->Cedar->HubList); + + num = LIST_NUM(o); + for (i = 0;i < num;i++) + { + char *name = LIST_DATA(o, i); + PackAddStrEx(p, "HubName", name, i, num); + Free(name); + } + ReleaseList(o); + PackAddInt(p, "NumHub", num); + + HttpServerSend(c->FirstSock, p); + FreePack(p); + FreePack(HttpServerRecv(c->FirstSock)); + c->Err = 0; + + SLog(c->Cedar, "LS_ENUM_HUB", c->Name, num); + + error_detail = "enum_hub"; + + goto CLEANUP; + } + else if (StrCmpi(method, "farm_connect") == 0) + { + // Server farm connection request + CEDAR *cedar = c->Cedar; + c->Type = CONNECTION_TYPE_FARM_RPC; + c->Err = 0; + if (c->Cedar->Server == NULL) + { + // Unsupported + c->Err = ERR_NOT_FARM_CONTROLLER; + } + else + { + SERVER *s = c->Cedar->Server; + if (s->ServerType != SERVER_TYPE_FARM_CONTROLLER || s->FarmControllerInited == false) + { + // Not a farm controller + SLog(c->Cedar, "LS_FARM_ACCEPT_1", c->Name); + c->Err = ERR_NOT_FARM_CONTROLLER; + } + else + { + UCHAR check_secure_password[SHA1_SIZE]; + UCHAR secure_password[SHA1_SIZE]; + // User authentication + SecurePassword(check_secure_password, s->HashedPassword, c->Random); + if (PackGetDataSize(p, "SecurePassword") == sizeof(secure_password)) + { + PackGetData(p, "SecurePassword", secure_password); + } + else + { + Zero(secure_password, sizeof(secure_password)); + } + + if (Cmp(secure_password, check_secure_password, SHA1_SIZE) != 0) + { + // Password is different + SLog(c->Cedar, "LS_FARM_ACCEPT_2", c->Name); + c->Err = ERR_ACCESS_DENIED; + } + else + { + // Get the certificate + BUF *b; + X *server_x; + + SLog(c->Cedar, "LS_FARM_ACCEPT_3", c->Name); + b = PackGetBuf(p, "ServerCert"); + if (b == NULL) + { + c->Err = ERR_PROTOCOL_ERROR; + } + else + { + server_x = BufToX(b, false); + FreeBuf(b); + if (server_x == NULL) + { + c->Err = ERR_PROTOCOL_ERROR; + } + else + { + UINT ip; + UINT point; + char hostname[MAX_SIZE]; + +#ifdef OS_WIN32 + MsSetThreadPriorityRealtime(); +#endif // OS_WIN32 + + SetTimeout(c->FirstSock, SERVER_CONTROL_TCP_TIMEOUT); + + ip = PackGetIp32(p, "PublicIp"); + point = PackGetInt(p, "Point"); + if (PackGetStr(p, "HostName", hostname, sizeof(hostname))) + { + UINT num_port = PackGetIndexCount(p, "PublicPort"); + if (num_port >= 1 && num_port <= MAX_PUBLIC_PORT_NUM) + { + UINT *ports = ZeroMalloc(sizeof(UINT) * num_port); + UINT i; + + for (i = 0;i < num_port;i++) + { + ports[i] = PackGetIntEx(p, "PublicPort", i); + } + + SiFarmServ(s, c->FirstSock, server_x, ip, num_port, ports, hostname, point, + PackGetInt(p, "Weight"), PackGetInt(p, "MaxSessions")); + + Free(ports); + } + } + + FreeX(server_x); + } + } + } + } + } + FreePack(p); + goto CLEANUP; + } + else if (StrCmpi(method, "admin") == 0 && c->Cedar->Server != NULL) + { + UINT err; + // Administrative RPC connection request + c->Type = CONNECTION_TYPE_ADMIN_RPC; + err = AdminAccept(c, p); + FreePack(p); + if (err != ERR_NO_ERROR) + { + PACK *p = PackError(err); + HttpServerSend(c->FirstSock, p); + FreePack(p); + } + + error_detail = "admin_rpc"; + + goto CLEANUP; + } + else if (StrCmpi(method, "password") == 0) + { + UINT err; + // Password change request + c->Type = CONNECTION_TYPE_PASSWORD; + err = ChangePasswordAccept(c, p); + FreePack(p); + + p = PackError(err); + HttpServerSend(c->FirstSock, p); + FreePack(p); + + error_detail = "change_password"; + + goto CLEANUP; + } + else + { + // Unknown method + FreePack(p); + c->Err = ERR_PROTOCOL_ERROR; + + error_detail = "unknown_method"; + + goto CLEANUP; + } + +CLEANUP: + // Release the user object + if (loggedin_user_object != NULL) + { + ReleaseUser(loggedin_user_object); + } + + + // Error packet transmission + if (supress_return_pack_error == false) + { + p = PackError(c->Err); + PackAddBool(p, "no_save_password", no_save_password); + HttpServerSend(c->FirstSock, p); + FreePack(p); + } + + FreePack(HttpServerRecv(c->FirstSock)); + + SleepThread(25); + + SLog(c->Cedar, "LS_CONNECTION_ERROR", c->Name, GetUniErrorStr(c->Err), c->Err); + + if (release_me_eap_client != NULL) + { + ReleaseEapClient(release_me_eap_client); + } + + return ret; +} + + +// Create a Node information +void CreateNodeInfo(NODE_INFO *info, CONNECTION *c) +{ + SESSION *s; + OS_INFO *os; + char *product_id; + IP ip; + // Validate arguments + if (c == NULL) + { + return; + } + + s = c->Session; + os = GetOsInfo(); + + + + Zero(info, sizeof(NODE_INFO)); + + // Client product name + StrCpy(info->ClientProductName, sizeof(info->ClientProductName), c->ClientStr); + // Client version + info->ClientProductVer = Endian32(c->ClientVer); + // Client build number + info->ClientProductBuild = Endian32(c->ClientBuild); + + // Server product name + StrCpy(info->ServerProductName, sizeof(info->ServerProductName), c->ServerStr); + // Server version + info->ServerProductVer = Endian32(c->ServerVer); + // Server build number + info->ServerProductBuild = Endian32(c->ServerBuild); + + // Client OS name + StrCpy(info->ClientOsName, sizeof(info->ClientOsName), os->OsProductName); + // Client OS version + StrCpy(info->ClientOsVer, sizeof(info->ClientOsVer), os->OsVersion); + // Client OS Product ID + product_id = OSGetProductId(); + StrCpy(info->ClientOsProductId, sizeof(info->ClientOsProductId), product_id); + Free(product_id); + + // Client host name +#ifndef OS_WIN32 + GetMachineName(info->ClientHostname, sizeof(info->ClientHostname)); +#else // OS_WIN32 + if (true) + { + wchar_t namew[256]; + char namea[256]; + + Zero(namew, sizeof(namew)); + MsGetComputerNameFullEx(namew, sizeof(namew), true); + + Zero(namea, sizeof(namea)); + UniToStr(namea, sizeof(namea), namew); + + if (IsEmptyStr(namea)) + { + GetMachineName(namea, sizeof(namea)); + } + + StrCpy(info->ClientHostname, sizeof(info->ClientHostname), namea); + + } +#endif // OS_WIN32 + // Client IP address + if (IsIP6(&c->FirstSock->LocalIP) == false) + { + info->ClientIpAddress = IPToUINT(&c->FirstSock->LocalIP); + } + else + { + Copy(info->ClientIpAddress6, c->FirstSock->LocalIP.ipv6_addr, sizeof(info->ClientIpAddress6)); + } + // Client port number + info->ClientPort = Endian32(c->FirstSock->LocalPort); + + // Server host name + StrCpy(info->ServerHostname, sizeof(info->ServerHostname), c->ServerName); + // Server IP address + if (GetIP(&ip, info->ServerHostname)) + { + if (IsIP6(&ip) == false) + { + info->ServerIpAddress = IPToUINT(&ip); + } + else + { + Copy(info->ServerIpAddress6, ip.ipv6_addr, sizeof(info->ServerIpAddress6)); + } + } + // Server port number + info->ServerPort = Endian32(c->ServerPort); + + if (s->ClientOption->ProxyType == PROXY_SOCKS || s->ClientOption->ProxyType == PROXY_HTTP) + { + // Proxy host name + StrCpy(info->ProxyHostname, sizeof(info->ProxyHostname), s->ClientOption->ProxyName); + + // Proxy Server IP Address + if (IsIP6(&c->FirstSock->RemoteIP) == false) + { + info->ProxyIpAddress = IPToUINT(&c->FirstSock->RemoteIP); + } + else + { + Copy(&info->ProxyIpAddress6, c->FirstSock->RemoteIP.ipv6_addr, sizeof(info->ProxyIpAddress6)); + } + + info->ProxyPort = Endian32(c->FirstSock->RemotePort); + } + + // HUB name + StrCpy(info->HubName, sizeof(info->HubName), s->ClientOption->HubName); + + // Unique ID + Copy(info->UniqueId, c->Cedar->UniqueId, sizeof(info->UniqueId)); +} + +// Connect a socket additionally +SOCK *ClientAdditionalConnectToServer(CONNECTION *c) +{ + SOCK *s; + // Validate arguments + if (c == NULL) + { + return NULL; + } + + // Socket connection + s = ClientConnectGetSocket(c, true); + if (s == NULL) + { + // Connection failure + return NULL; + } + + // Add the socket to the list + LockList(c->ConnectingSocks); + { + Add(c->ConnectingSocks, s); + AddRef(s->ref); + } + UnlockList(c->ConnectingSocks); + + if (c->Session->Halt) + { + // Stop + Disconnect(s); + LockList(c->ConnectingSocks); + { + if (Delete(c->ConnectingSocks, s)) + { + ReleaseSock(s); + } + } + UnlockList(c->ConnectingSocks); + ReleaseSock(s); + return NULL; + } + + // Time-out + SetTimeout(s, CONNECTING_TIMEOUT); + + // Start the SSL communication + if (StartSSLEx(s, NULL, NULL, 0, c->ServerName) == false) + { + // SSL communication failure + Disconnect(s); + LockList(c->ConnectingSocks); + { + if (Delete(c->ConnectingSocks, s)) + { + ReleaseSock(s); + } + } + UnlockList(c->ConnectingSocks); + ReleaseSock(s); + return NULL; + } + + // Check the certificate + if (CompareX(s->RemoteX, c->ServerX) == false) + { + // The certificate is invalid + Disconnect(s); + c->Session->SessionTimeOuted = true; + } + + return s; +} + +// Attempt to sign by the secure device +UINT SecureSign(SECURE_SIGN *sign, UINT device_id, char *pin) +{ + SECURE *sec; + X *x; + // Validate arguments + if (sign == false || pin == NULL || device_id == 0) + { + return ERR_INTERNAL_ERROR; + } + + // Open the device + sec = OpenSec(device_id); + if (sec == NULL) + { + return ERR_SECURE_DEVICE_OPEN_FAILED; + } + + // Open the session + if (OpenSecSession(sec, 0) == false) + { + CloseSec(sec); + return ERR_SECURE_DEVICE_OPEN_FAILED; + } + + // Login + if (LoginSec(sec, pin) == false) + { + CloseSecSession(sec); + CloseSec(sec); + return ERR_SECURE_PIN_LOGIN_FAILED; + } + + // Read the certificate + x = ReadSecCert(sec, sign->SecurePublicCertName); + if (x == NULL) + { + LogoutSec(sec); + CloseSecSession(sec); + CloseSec(sec); + return ERR_SECURE_NO_CERT; + } + + // Sign by the private key + if (SignSec(sec, sign->SecurePrivateKeyName, sign->Signature, sign->Random, SHA1_SIZE) == false) + { + // Signing failure + FreeX(x); + LogoutSec(sec); + CloseSecSession(sec); + CloseSec(sec); + return ERR_SECURE_NO_PRIVATE_KEY; + } + + // Convert the certificate to buffer + sign->ClientCert = x; + + // Log out + LogoutSec(sec); + + // Close the session + CloseSecSession(sec); + + // Close the device + CloseSec(sec); + + // Success + return ERR_NO_ERROR; +} + +// Client connects to the server additionally +bool ClientAdditionalConnect(CONNECTION *c, THREAD *t) +{ + SOCK *s; + PACK *p; + TCPSOCK *ts; + UINT err; + UINT direction; + + // Validate arguments + if (c == NULL) + { + return false; + } + + // Socket connection to the server + s = ClientAdditionalConnectToServer(c); + if (s == NULL) + { + // Failed to connect socket + return false; + } + + if (c->Halt) + { + goto CLEANUP; + } + + // Send a signature + Debug("Uploading Signature...\n"); + if (ClientUploadSignature(s) == false) + { + goto CLEANUP; + } + + if (c->Halt) + { + // Stop + goto CLEANUP; + } + + // Receive a Hello packet + Debug("Downloading Hello...\n"); + if (ClientDownloadHello(c, s) == false) + { + goto CLEANUP; + } + + if (c->Halt) + { + // Stop + goto CLEANUP; + } + + // Send a authentication data for the additional connection + if (ClientUploadAuth2(c, s) == false) + { + // Disconnected + goto CLEANUP; + } + + // Receive a response + p = HttpClientRecv(s); + if (p == NULL) + { + // Disconnected + goto CLEANUP; + } + + err = GetErrorFromPack(p); + direction = PackGetInt(p, "direction"); + + FreePack(p); + p = NULL; + + if (err != 0) + { + // Error has occurred + Debug("Additional Connect Error: %u\n", err); + if (err == ERR_SESSION_TIMEOUT || err == ERR_INVALID_PROTOCOL) + { + // We shall re-connection because it is a fatal error + c->Session->SessionTimeOuted = true; + } + goto CLEANUP; + } + + Debug("Additional Connect Succeed!\n"); + + if (s->IsRUDPSocket && s->BulkRecvKey != NULL && s->BulkSendKey != NULL) + { + // Restore R-UDP bulk send/recv keys for additional connections + if (c->Session->BulkRecvKeySize != 0 && c->Session->BulkSendKeySize != 0) + { + Copy(s->BulkRecvKey->Data, c->Session->BulkRecvKey, c->Session->BulkRecvKeySize); + s->BulkRecvKey->Size = c->Session->BulkRecvKeySize; + + Copy(s->BulkSendKey->Data, c->Session->BulkSendKey, c->Session->BulkSendKeySize); + s->BulkSendKey->Size = c->Session->BulkSendKeySize; + } + } + + // Success the additional connection + // Add to the TcpSockList of the connection + ts = NewTcpSock(s); + + if (c->ServerMode == false) + { + if (c->Session->ClientOption->ConnectionDisconnectSpan != 0) + { + ts->DisconnectTick = Tick64() + c->Session->ClientOption->ConnectionDisconnectSpan * (UINT64)1000; + } + } + + LockList(c->Tcp->TcpSockList); + { + ts->Direction = direction; + Add(c->Tcp->TcpSockList, ts); + } + UnlockList(c->Tcp->TcpSockList); + Debug("TCP Connection Incremented: %u\n", Count(c->CurrentNumConnection)); + + if (c->Session->HalfConnection) + { + Debug("New Half Connection: %s\n", + direction == TCP_SERVER_TO_CLIENT ? "TCP_SERVER_TO_CLIENT" : "TCP_CLIENT_TO_SERVER" + ); + } + + // Issue the Cancel to the session + Cancel(c->Session->Cancel1); + + // Remove the socket from the socket list of connected + LockList(c->ConnectingSocks); + { + if (Delete(c->ConnectingSocks, s)) + { + ReleaseSock(s); + } + } + UnlockList(c->ConnectingSocks); + ReleaseSock(s); + return true; + +CLEANUP: + // Disconnection process + Disconnect(s); + LockList(c->ConnectingSocks); + { + if (Delete(c->ConnectingSocks, s)) + { + ReleaseSock(s); + + } + } + UnlockList(c->ConnectingSocks); + ReleaseSock(s); + return false; +} + +// Secure device signing thread +void ClientSecureSignThread(THREAD *thread, void *param) +{ + SECURE_SIGN_THREAD_PROC *p = (SECURE_SIGN_THREAD_PROC *)param; + // Validate arguments + if (thread == NULL || param == NULL) + { + return; + } + + NoticeThreadInit(thread); + + p->Ok = p->SecureSignProc(p->Connection->Session, p->Connection, p->SecureSign); + p->UserFinished = true; +} + +// Signing with the secure device +bool ClientSecureSign(CONNECTION *c, UCHAR *sign, UCHAR *random, X **x) +{ + SECURE_SIGN_THREAD_PROC *p; + SECURE_SIGN *ss; + SESSION *s; + CLIENT_OPTION *o; + CLIENT_AUTH *a; + THREAD *thread; + UINT64 start; + bool ret; + // Validate arguments + if (c == NULL || sign == NULL || random == NULL || x == NULL) + { + return false; + } + + s = c->Session; + o = s->ClientOption; + a = s->ClientAuth; + + p = ZeroMalloc(sizeof(SECURE_SIGN_THREAD_PROC)); + p->Connection = c; + ss = p->SecureSign = ZeroMallocEx(sizeof(SECURE_SIGN), true); + StrCpy(ss->SecurePrivateKeyName, sizeof(ss->SecurePrivateKeyName), + a->SecurePrivateKeyName); + StrCpy(ss->SecurePublicCertName, sizeof(ss->SecurePublicCertName), + a->SecurePublicCertName); + ss->UseSecureDeviceId = c->Cedar->Client->UseSecureDeviceId; + Copy(ss->Random, random, SHA1_SIZE); + +#ifdef OS_WIN32 + ss->BitmapId = CmGetSecureBitmapId(c->ServerName); +#endif // OS_WIN32 + + p->SecureSignProc = a->SecureSignProc; + + // Create a thread + thread = NewThread(ClientSecureSignThread, p); + WaitThreadInit(thread); + + // Poll every 0.5 seconds until signing is completed or canceled + start = Tick64(); + while (true) + { + if ((Tick64() - start) > CONNECTING_POOLING_SPAN) + { + // Send a NOOP periodically for disconnection prevention + start = Tick64(); + ClientUploadNoop(c); + } + if (p->UserFinished) + { + // User selected + break; + } + WaitThread(thread, 500); + } + ReleaseThread(thread); + + ret = p->Ok; + + if (ret) + { + Copy(sign, ss->Signature, sizeof(ss->Signature)); + *x = ss->ClientCert; + } + + Free(p->SecureSign); + Free(p); + + return ret; +} + +// Server certificate confirmation thread +void ClientCheckServerCertThread(THREAD *thread, void *param) +{ + CHECK_CERT_THREAD_PROC *p = (CHECK_CERT_THREAD_PROC *)param; + // Validate arguments + if (thread == NULL || param == NULL) + { + return; + } + + // Notify the completion of initialization + NoticeThreadInit(thread); + + // Query for the selection to the user + p->Ok = p->CheckCertProc(p->Connection->Session, p->Connection, p->ServerX, &p->Expired); + p->UserSelected = true; +} + +// Client verify the certificate of the server +bool ClientCheckServerCert(CONNECTION *c, bool *expired) +{ + CLIENT_AUTH *auth; + X *x; + CHECK_CERT_THREAD_PROC *p; + THREAD *thread; + CEDAR *cedar; + bool ret; + UINT64 start; + // Validate arguments + if (c == NULL) + { + return false; + } + + if (expired != NULL) + { + *expired = false; + } + + auth = c->Session->ClientAuth; + cedar = c->Cedar; + + if (auth->CheckCertProc == NULL && c->Session->LinkModeClient == false) + { + // No checking function + return true; + } + + if (c->Session->LinkModeClient && c->Session->Link->CheckServerCert == false) + { + // It's in cascade connection mode, but do not check the server certificate + return true; + } + + if (c->UseTicket) + { + // Check the certificate of the redirected VPN server + if (CompareX(c->FirstSock->RemoteX, c->ServerX) == false) + { + return false; + } + else + { + return true; + } + } + + x = CloneX(c->FirstSock->RemoteX); + if (x == NULL) + { + // Strange error occurs + return false; + } + + if (CheckXDateNow(x)) + { + // Check whether it is signed by the root certificate to trust + if (c->Session->LinkModeClient == false) + { + // Normal VPN Client mode + if (CheckSignatureByCa(cedar, x)) + { + // This certificate can be trusted because it is signed + FreeX(x); + return true; + } + } + else + { + // Cascade connection mode + if (CheckSignatureByCaLinkMode(c->Session, x)) + { + // This certificate can be trusted because it is signed + FreeX(x); + return true; + } + } + } + + if (c->Session->LinkModeClient) + { + if (CheckXDateNow(x)) + { + Lock(c->Session->Link->lock); + { + if (c->Session->Link->ServerCert != NULL) + { + if (CompareX(c->Session->Link->ServerCert, x)) + { + Unlock(c->Session->Link->lock); + // Exactly match the certificate that is registered in the cascade configuration + FreeX(x); + return true; + } + } + } + Unlock(c->Session->Link->lock); + } + else + { + if (expired != NULL) + { + *expired = true; + } + } + + // Verification failure at this point in the case of cascade connection mode + FreeX(x); + return false; + } + + p = ZeroMalloc(sizeof(CHECK_CERT_THREAD_PROC)); + p->ServerX = x; + p->CheckCertProc = auth->CheckCertProc; + p->Connection = c; + + // Create a thread + thread = NewThread(ClientCheckServerCertThread, p); + WaitThreadInit(thread); + + // Poll at 0.5-second intervals until the user selects whether the connection + start = Tick64(); + while (true) + { + if ((Tick64() - start) > CONNECTING_POOLING_SPAN) + { + // Send a NOOP periodically for disconnection prevention + start = Tick64(); + ClientUploadNoop(c); + } + if (p->UserSelected) + { + // User-selected + break; + } + WaitThread(thread, 500); + } + + if (expired != NULL) + { + *expired = p->Expired; + } + + ret = p->Ok; + FreeX(p->ServerX); + Free(p); + ReleaseThread(thread); + + return ret; +} + +// Client connects to the server +bool ClientConnect(CONNECTION *c) +{ + bool ret = false; + bool ok = false; + UINT err; + SOCK *s; + PACK *p = NULL; + UINT session_key_32; + SESSION *sess; + char session_name[MAX_SESSION_NAME_LEN + 1]; + char connection_name[MAX_CONNECTION_NAME_LEN + 1]; + UCHAR session_key[SHA1_SIZE]; + POLICY *policy; + bool expired = false; + IP server_ip; + // Validate arguments + if (c == NULL) + { + return false; + } + + sess = c->Session; + + PrintStatus(sess, L"init"); + PrintStatus(sess, _UU("STATUS_1")); + +REDIRECTED: + + // [Connecting] + c->Status = CONNECTION_STATUS_CONNECTING; + c->Session->ClientStatus = CLIENT_STATUS_CONNECTING; + + s = ClientConnectToServer(c); + if (s == NULL) + { + PrintStatus(sess, L"free"); + return false; + } + + Copy(&server_ip, &s->RemoteIP, sizeof(IP)); + + if (c->Halt) + { + // Stop + c->Err = ERR_USER_CANCEL; + goto CLEANUP; + } + + // [Negotiating] + c->Session->ClientStatus = CLIENT_STATUS_NEGOTIATION; + + // Initialize the UDP acceleration function + if (sess->ClientOption != NULL && sess->ClientOption->NoUdpAcceleration == false) + { + if (sess->ClientOption->ProxyType == PROXY_DIRECT) + { + if (s->Type == SOCK_TCP) + { + if (sess->UdpAccel == NULL) + { + bool no_nat_t = false; + + if (sess->ClientOption->PortUDP != 0) + { + // There is no need for NAT-T treatment on my part if the UDP port on the other end is known beforehand + no_nat_t = true; + } + + + sess->UdpAccel = NewUdpAccel(c->Cedar, &s->LocalIP, true, true, no_nat_t); + } + } + } + } + + // Send a signature + Debug("Uploading Signature...\n"); + if (ClientUploadSignature(s) == false) + { + c->Err = ERR_DISCONNECTED; + goto CLEANUP; + } + + if (c->Halt) + { + // Stop + c->Err = ERR_USER_CANCEL; + goto CLEANUP; + } + + PrintStatus(sess, _UU("STATUS_5")); + + // Receive a Hello packet + Debug("Downloading Hello...\n"); + if (ClientDownloadHello(c, s) == false) + { + goto CLEANUP; + } + + if (c->Session->ClientOption != NULL && c->Session->ClientOption->FromAdminPack) + { + if (IsAdminPackSupportedServerProduct(c->ServerStr) == false) + { + c->Err = ERR_NOT_ADMINPACK_SERVER; + goto CLEANUP; + } + } + + if (c->Halt) + { + // Stop + c->Err = ERR_USER_CANCEL; + goto CLEANUP; + } + + Debug("Server Version : %u\n" + "Server String : %s\n" + "Server Build : %u\n" + "Client Version : %u\n" + "Client String : %s\n" + "Client Build : %u\n", + c->ServerVer, c->ServerStr, c->ServerBuild, + c->ClientVer, c->ClientStr, c->ClientBuild); + + // During user authentication + c->Session->ClientStatus = CLIENT_STATUS_AUTH; + + // Verify the server certificate by the client + if (ClientCheckServerCert(c, &expired) == false) + { + if (expired == false) + { + c->Err = ERR_CERT_NOT_TRUSTED; + } + else + { + c->Err = ERR_SERVER_CERT_EXPIRES; + } + + if (c->Session->LinkModeClient == false && c->Err == ERR_CERT_NOT_TRUSTED + && (c->Session->Account == NULL || ! c->Session->Account->RetryOnServerCert)) + { + c->Session->ForceStopFlag = true; + } + + goto CLEANUP; + } + + PrintStatus(sess, _UU("STATUS_6")); + + // Send the authentication data + if (ClientUploadAuth(c) == false) + { + goto CLEANUP; + } + + if (c->Halt) + { + // Stop + c->Err = ERR_USER_CANCEL; + goto CLEANUP; + } + + // Receive a Welcome packet + p = HttpClientRecv(s); + if (p == NULL) + { + c->Err = ERR_DISCONNECTED; + goto CLEANUP; + } + + // Error checking + err = GetErrorFromPack(p); + if (err != 0) + { + // An error has occured + c->Err = err; + c->ClientConnectError_NoSavePassword = PackGetBool(p, "no_save_password"); + goto CLEANUP; + } + + // Branding string check for the connection limit + { + char tmp[20]; + char *branded_cfroms = _SS("BRANDED_C_FROM_S"); + PackGetStr(p, "branded_cfroms", tmp, sizeof(tmp)); + + if(StrLen(branded_cfroms) > 0 && StrCmpi(branded_cfroms, tmp) != 0) + { + c->Err = ERR_BRANDED_C_FROM_S; + goto CLEANUP; + } + } + + if (c->Cedar->Server == NULL) + { + // Suppress client notification flag + if (PackIsValueExists(p, "suppress_client_update_notification")) + { + bool suppress_client_update_notification = PackGetBool(p, "suppress_client_update_notification"); + +#ifdef OS_WIN32 + MsRegWriteIntEx2(REG_LOCAL_MACHINE, PROTO_SUPPRESS_CLIENT_UPDATE_NOTIFICATION_REGKEY, PROTO_SUPPRESS_CLIENT_UPDATE_NOTIFICATION_REGVALUE, + (suppress_client_update_notification ? 1 : 0), false, true); +#endif // OS_WIN32 + } + } + + if (true) + { + // Message retrieval + UINT utf_size; + char *utf; + wchar_t *msg; + + utf_size = PackGetDataSize(p, "Msg"); + utf = ZeroMalloc(utf_size + 8); + PackGetData(p, "Msg", utf); + + msg = CopyUtfToUni(utf); + + if (IsEmptyUniStr(msg) == false) + { + if (c->Session->Client_Message != NULL) + { + Free(c->Session->Client_Message); + } + + c->Session->Client_Message = msg; + } + else + { + Free(msg); + } + + Free(utf); + } + + if (PackGetInt(p, "Redirect") != 0) + { + UINT i; + UINT ip; + UINT num_port; + UINT *ports; + UINT use_port = 0; + UINT current_port = c->ServerPort; + UCHAR ticket[SHA1_SIZE]; + X *server_cert = NULL; + BUF *b; + + // Redirect mode + PrintStatus(sess, _UU("STATUS_8")); + + ip = PackGetIp32(p, "Ip"); + num_port = MAX(MIN(PackGetIndexCount(p, "Port"), MAX_PUBLIC_PORT_NUM), 1); + ports = ZeroMalloc(sizeof(UINT) * num_port); + for (i = 0;i < num_port;i++) + { + ports[i] = PackGetIntEx(p, "Port", i); + } + + // Select a port number + for (i = 0;i < num_port;i++) + { + if (ports[i] == current_port) + { + use_port = current_port; + } + } + if (use_port == 0) + { + use_port = ports[0]; + } + + Free(ports); + + if (PackGetDataSize(p, "Ticket") == SHA1_SIZE) + { + PackGetData(p, "Ticket", ticket); + } + + b = PackGetBuf(p, "Cert"); + if (b != NULL) + { + server_cert = BufToX(b, false); + FreeBuf(b); + } + + if (c->ServerX != NULL) + { + FreeX(c->ServerX); + } + c->ServerX = server_cert; + + IPToStr32(c->ServerName, sizeof(c->ServerName), ip); + c->ServerPort = use_port; + + c->UseTicket = true; + Copy(c->Ticket, ticket, SHA1_SIZE); + + FreePack(p); + + p = NewPack(); + HttpClientSend(s, p); + FreePack(p); + + p = NULL; + + c->FirstSock = NULL; + Disconnect(s); + ReleaseSock(s); + s = NULL; + + goto REDIRECTED; + } + + PrintStatus(sess, _UU("STATUS_7")); + + // Parse the Welcome packet + if (ParseWelcomeFromPack(p, session_name, sizeof(session_name), + connection_name, sizeof(connection_name), &policy) == false) + { + // Parsing failure + c->Err = ERR_PROTOCOL_ERROR; + goto CLEANUP; + } + + // Get the session key + if (GetSessionKeyFromPack(p, session_key, &session_key_32) == false) + { + // Acquisition failure + Free(policy); + policy = NULL; + c->Err = ERR_PROTOCOL_ERROR; + goto CLEANUP; + } + + Copy(c->Session->SessionKey, session_key, SHA1_SIZE); + c->Session->SessionKey32 = session_key_32; + + // Save the contents of the Welcome packet + Debug("session_name: %s, connection_name: %s\n", + session_name, connection_name); + + Lock(c->Session->lock); + { + // Deploy and update connection parameters + sess->EnableUdpRecovery = PackGetBool(p, "enable_udp_recovery"); + c->Session->MaxConnection = PackGetInt(p, "max_connection"); + + if (sess->EnableUdpRecovery == false) + { + c->Session->MaxConnection = MIN(c->Session->MaxConnection, c->Session->ClientOption->MaxConnection); + } + + c->Session->MaxConnection = MIN(c->Session->MaxConnection, MAX_TCP_CONNECTION); + c->Session->MaxConnection = MAX(c->Session->MaxConnection, 1); + c->Session->UseCompress = PackGetInt(p, "use_compress") == 0 ? false : true; + c->Session->UseEncrypt = PackGetInt(p, "use_encrypt") == 0 ? false : true; + c->Session->NoSendSignature = PackGetBool(p, "no_send_signature"); + c->Session->HalfConnection = PackGetInt(p, "half_connection") == 0 ? false : true; + c->Session->IsAzureSession = PackGetInt(p, "is_azure_session") == 0 ? false : true; + c->Session->Timeout = PackGetInt(p, "timeout"); + c->Session->QoS = PackGetInt(p, "qos") == 0 ? false : true; + if (c->Session->QoS) + { + c->Session->MaxConnection = MAX(c->Session->MaxConnection, (UINT)(c->Session->HalfConnection ? 4 : 2)); + } + c->Session->VLanId = PackGetInt(p, "vlan_id"); + + // R-UDP Session ? + c->Session->IsRUDPSession = s->IsRUDPSocket; + + ZeroIP4(&c->Session->AzureRealServerGlobalIp); + + if (c->Session->IsAzureSession) + { + // Disable the life parameter of the connection in the case of VPN Azure relayed session + c->Session->ClientOption->ConnectionDisconnectSpan = 0; + + // Get the AzureRealServerGlobalIp the case of VPN Azure relayed + PackGetIp(p, "azure_real_server_global_ip", &c->Session->AzureRealServerGlobalIp); + } + + if (c->Session->IsRUDPSession) + { + // Disable the life parameter of the connection in the case of R-UDP session + c->Session->ClientOption->ConnectionDisconnectSpan = 0; + + // Disable QoS, etc. in the case of R-UDP session + c->Session->QoS = false; + c->Session->HalfConnection = false; + + if (c->Session->EnableUdpRecovery == false) + { + // Set the number of connection to 1 if UDP recovery is not supported + c->Session->MaxConnection = 1; + } + } + + // Physical communication protocol + StrCpy(c->Session->UnderlayProtocol, sizeof(c->Session->UnderlayProtocol), s->UnderlayProtocol); + + AddProtocolDetailsStr(c->Session->ProtocolDetails, sizeof(c->Session->ProtocolDetails), s->ProtocolDetails); + + if (c->Session->IsAzureSession) + { + StrCpy(c->Session->UnderlayProtocol, sizeof(c->Session->UnderlayProtocol), SOCK_UNDERLAY_AZURE); + + AddProtocolDetailsStr(c->Session->ProtocolDetails, sizeof(c->Session->ProtocolDetails), "VPN Azure"); + } + + if (c->Protocol == CONNECTION_UDP) + { + // In the case of UDP protocol, receive the key from the server + if (PackGetDataSize(p, "udp_send_key") == sizeof(c->Session->UdpSendKey)) + { + PackGetData(p, "udp_send_key", c->Session->UdpSendKey); + } + + if (PackGetDataSize(p, "udp_recv_key") == sizeof(c->Session->UdpRecvKey)) + { + PackGetData(p, "udp_recv_key", c->Session->UdpRecvKey); + } + } + + sess->EnableBulkOnRUDP = false; + sess->EnableHMacOnBulkOfRUDP = false; + if (s != NULL && s->IsRUDPSocket && s->BulkRecvKey != NULL && s->BulkSendKey != NULL) + { + // Bulk transfer on R-UDP + sess->EnableHMacOnBulkOfRUDP = PackGetBool(p, "enable_hmac_on_bulk_of_rudp"); + sess->BulkOnRUDPVersion = PackGetInt(p, "rudp_bulk_version"); + + if (PackGetBool(p, "enable_bulk_on_rudp")) + { + // Receive the key + UCHAR key_send[RUDP_BULK_KEY_SIZE_MAX]; + UCHAR key_recv[RUDP_BULK_KEY_SIZE_MAX]; + + UINT key_size = SHA1_SIZE; + + if (sess->BulkOnRUDPVersion == 2) + { + key_size = RUDP_BULK_KEY_SIZE_V2; + } + + if (PackGetData2(p, "bulk_on_rudp_send_key", key_send, key_size) && + PackGetData2(p, "bulk_on_rudp_recv_key", key_recv, key_size)) + { + sess->EnableBulkOnRUDP = true; + + Copy(s->BulkSendKey->Data, key_send, key_size); + Copy(s->BulkRecvKey->Data, key_recv, key_size); + + s->BulkSendKey->Size = key_size; + s->BulkRecvKey->Size = key_size; + + // Backup R-UDP bulk send/recv keys for additional connections + Copy(sess->BulkSendKey, s->BulkSendKey->Data, s->BulkSendKey->Size); + sess->BulkSendKeySize = s->BulkSendKey->Size; + + Copy(sess->BulkRecvKey, s->BulkRecvKey->Data, s->BulkRecvKey->Size); + sess->BulkRecvKeySize = s->BulkRecvKey->Size; + + AddProtocolDetailsKeyValueInt(sess->ProtocolDetails, sizeof(sess->ProtocolDetails), "RUDP_Bulk_Ver", sess->BulkOnRUDPVersion); + } + } + + sess->EnableHMacOnBulkOfRUDP = PackGetBool(p, "enable_hmac_on_bulk_of_rudp"); + } + + Debug("EnableBulkOnRUDP = %u\n", sess->EnableBulkOnRUDP); + Debug("EnableHMacOnBulkOfRUDP = %u\n", sess->EnableHMacOnBulkOfRUDP); + Debug("EnableUdpRecovery = %u\n", sess->EnableUdpRecovery); + Debug("BulkOnRUDPVersion = %u\n", sess->BulkOnRUDPVersion); + + sess->UseUdpAcceleration = false; + sess->IsUsingUdpAcceleration = false; + sess->UseHMacOnUdpAcceleration = false; + + if (sess->UdpAccel != NULL) + { + sess->UdpAccel->UseHMac = false; + + sess->UdpAccelFastDisconnectDetect = false; + + if (PackGetBool(p, "use_udp_acceleration")) + { + UINT udp_acceleration_version = PackGetInt(p, "udp_acceleration_version"); + IP udp_acceleration_server_ip; + + if (udp_acceleration_version == 0) + { + udp_acceleration_version = 1; + } + + sess->UdpAccelFastDisconnectDetect = PackGetBool(p, "udp_accel_fast_disconnect_detect"); + + if (PackGetIp(p, "udp_acceleration_server_ip", &udp_acceleration_server_ip)) + { + UINT udp_acceleration_server_port = PackGetInt(p, "udp_acceleration_server_port"); + + if (IsZeroIp(&udp_acceleration_server_ip)) + { + Copy(&udp_acceleration_server_ip, &s->RemoteIP, sizeof(IP)); + } + + if (udp_acceleration_server_port != 0) + { + UCHAR udp_acceleration_server_key[UDP_ACCELERATION_COMMON_KEY_SIZE_V1]; + UCHAR udp_acceleration_server_key_v2[UDP_ACCELERATION_COMMON_KEY_SIZE_V2]; + UINT server_cookie = PackGetInt(p, "udp_acceleration_server_cookie"); + UINT client_cookie = PackGetInt(p, "udp_acceleration_client_cookie"); + bool encryption = PackGetBool(p, "udp_acceleration_use_encryption"); + + Zero(udp_acceleration_server_key, sizeof(udp_acceleration_server_key)); + Zero(udp_acceleration_server_key_v2, sizeof(udp_acceleration_server_key_v2)); + + PackGetData2(p, "udp_acceleration_server_key", udp_acceleration_server_key, UDP_ACCELERATION_COMMON_KEY_SIZE_V1); + PackGetData2(p, "udp_acceleration_server_key_v2", udp_acceleration_server_key_v2, UDP_ACCELERATION_COMMON_KEY_SIZE_V2); + + if (server_cookie != 0 && client_cookie != 0) + { + IP remote_ip; + + Copy(&remote_ip, &s->RemoteIP, sizeof(IP)); + + if (IsZeroIp(&c->Session->AzureRealServerGlobalIp) == false) + { + Copy(&remote_ip, &c->Session->AzureRealServerGlobalIp, sizeof(IP)); + } + + sess->UdpAccel->Version = 1; + if (udp_acceleration_version == 2) + { + sess->UdpAccel->Version = 2; + } + + if (UdpAccelInitClient(sess->UdpAccel, + sess->UdpAccel->Version == 2 ? udp_acceleration_server_key_v2 : udp_acceleration_server_key, + &udp_acceleration_server_ip, udp_acceleration_server_port, + server_cookie, client_cookie, &remote_ip) == false) + { + Debug("UdpAccelInitClient failed.\n"); + } + else + { + sess->UseUdpAcceleration = true; + + sess->UdpAccel->FastDetect = sess->UdpAccelFastDisconnectDetect; + + sess->UdpAccel->PlainTextMode = !encryption; + + sess->UseHMacOnUdpAcceleration = PackGetBool(p, "use_hmac_on_udp_acceleration"); + + if (sess->UseHMacOnUdpAcceleration) + { + sess->UdpAccel->UseHMac = true; + } + + AddProtocolDetailsKeyValueInt(sess->ProtocolDetails, sizeof(sess->ProtocolDetails), "UDPAccel_Ver", sess->UdpAccel->Version); + + AddProtocolDetailsStr(sess->ProtocolDetails, sizeof(sess->ProtocolDetails), sess->UdpAccel->Version > 1 ? "ChaCha20-Poly1305" : "RC4"); + + AddProtocolDetailsKeyValueInt(sess->ProtocolDetails, sizeof(sess->ProtocolDetails), "UDPAccel_MSS", UdpAccelCalcMss(sess->UdpAccel)); + } + } + } + } + } + } + } + Unlock(c->Session->lock); + + Debug("UseUdpAcceleration = %u\n", sess->UseUdpAcceleration); + + if (sess->UseUdpAcceleration == false) + { + if (sess->UdpAccel != NULL) + { + FreeUdpAccel(sess->UdpAccel); + sess->UdpAccel = NULL; + } + } + + Lock(c->lock); + { + if (c->Name != NULL) + { + Free(c->Name); + } + c->Name = CopyStr(connection_name); + + // Save the name of a cryptographic algorithm + if (c->CipherName != NULL) + { + Free(c->CipherName); + } + + c->CipherName = CopyStr(c->FirstSock->CipherName); + } + Unlock(c->lock); + + Lock(c->Session->lock); + { + if (c->Session->Name != NULL) + { + Free(c->Session->Name); + } + c->Session->Name = CopyStr(session_name); + + c->Session->Policy = policy; + } + Unlock(c->Session->lock); + + // Discard the Welcome packet + FreePack(p); + p = NULL; + + + // Connection establishment + c->Session->ClientStatus = CLIENT_STATUS_ESTABLISHED; + + // Save the server certificate + if (c->ServerX == NULL) + { + c->ServerX = CloneX(c->FirstSock->RemoteX); + } + + PrintStatus(sess, _UU("STATUS_9")); +#ifdef OS_UNIX + UnixVLanSetState(c->Session->ClientOption->DeviceName, true); +#endif + // Shift the connection to the tunneling mode + StartTunnelingMode(c); + s = NULL; + + if (c->Session->HalfConnection) + { + // Processing in the case of half-connection + TCPSOCK *ts = (TCPSOCK *)LIST_DATA(c->Tcp->TcpSockList, 0); + ts->Direction = TCP_CLIENT_TO_SERVER; + } + + PrintStatus(sess, L"free"); + + CLog(c->Cedar->Client, "LC_CONNECT_2", c->Session->ClientOption->AccountName, + session_name); + + if (c->Session->LinkModeClient && c->Session->Link != NULL) + { + HLog(c->Session->Link->Hub, "LH_CONNECT_2", c->Session->ClientOption->AccountName, session_name); + } + + // Main routine of the session + SessionMain(c->Session); + + ok = true; + + if (c->Err == ERR_USER_CANCEL) + { + ret = true; + } + +CLEANUP: + c->FirstSock = NULL; + + if (sess->UdpAccel != NULL) + { + FreeUdpAccel(sess->UdpAccel); + sess->UdpAccel = NULL; + } + + if (p != NULL) + { + FreePack(p); + } + + Disconnect(s); + ReleaseSock(s); + + Debug("Error: %u\n", c->Err); + + if (ok == false) + { + PrintStatus(sess, L"free"); + } + + return ret; +} + +// Parse the Welcome packet +bool ParseWelcomeFromPack(PACK *p, char *session_name, UINT session_name_size, + char *connection_name, UINT connection_name_size, + POLICY **policy) +{ + // Validate arguments + if (p == NULL || session_name == NULL || connection_name == NULL || policy == NULL) + { + return false; + } + + // Session name + if (PackGetStr(p, "session_name", session_name, session_name_size) == false) + { + return false; + } + + // Connection name + if (PackGetStr(p, "connection_name", connection_name, connection_name_size) == false) + { + return false; + } + + // Policy + *policy = PackGetPolicy(p); + if (*policy == NULL) + { + return false; + } + + return true; +} + +// Generate the Welcome packet +PACK *PackWelcome(SESSION *s) +{ + PACK *p; + // Validate arguments + if (s == NULL) + { + return NULL; + } + + p = NewPack(); + + // Session name + PackAddStr(p, "session_name", s->Name); + + // Connection name + PackAddStr(p, "connection_name", s->Connection->Name); + + // Parameters + PackAddInt(p, "max_connection", s->MaxConnection); + PackAddInt(p, "use_encrypt", s->UseEncrypt == false ? 0 : 1); + PackAddInt(p, "use_compress", s->UseCompress == false ? 0 : 1); + PackAddInt(p, "half_connection", s->HalfConnection == false ? 0 : 1); + PackAddInt(p, "timeout", s->Timeout); + PackAddInt(p, "qos", s->QoS ? 1 : 0); + PackAddInt(p, "is_azure_session", s->IsAzureSession); + + // Session key + PackAddData(p, "session_key", s->SessionKey, SHA1_SIZE); + PackAddInt(p, "session_key_32", s->SessionKey32); + + // Policy + PackAddPolicy(p, s->Policy); + + // VLAN ID + PackAddInt(p, "vlan_id", s->VLanId); + + if (s->Connection->Protocol == CONNECTION_UDP) + { + // In the case of UDP protocol, generate 2 pairs of key + Rand(s->UdpSendKey, sizeof(s->UdpSendKey)); + Rand(s->UdpRecvKey, sizeof(s->UdpRecvKey)); + + // Send to client by exchanging 2 keys + PackAddData(p, "udp_send_key", s->UdpRecvKey, sizeof(s->UdpRecvKey)); + PackAddData(p, "udp_recv_key", s->UdpSendKey, sizeof(s->UdpSendKey)); + } + + // no_send_signature + if (s->NoSendSignature) + { + PackAddBool(p, "no_send_signature", true); + } + + if (s->InProcMode) + { + // MAC address for IPC + PackAddData(p, "IpcMacAddress", s->IpcMacAddress, 6); + + // Virtual HUB name + PackAddStr(p, "IpcHubName", s->Hub->Name); + + // Shared Buffer + s->IpcSessionSharedBuffer = NewSharedBuffer(NULL, sizeof(IPC_SESSION_SHARED_BUFFER_DATA)); + AddRef(s->IpcSessionSharedBuffer->Ref); + + s->IpcSessionShared = s->IpcSessionSharedBuffer->Data; + + PackAddInt64(p, "IpcSessionSharedBuffer", (UINT64)s->IpcSessionSharedBuffer); + } + + if (s->UdpAccel != NULL) + { + // UDP acceleration function + PackAddBool(p, "use_udp_acceleration", true); + PackAddInt(p, "udp_acceleration_version", s->UdpAccel->Version); + PackAddIp(p, "udp_acceleration_server_ip", &s->UdpAccel->MyIp); + PackAddInt(p, "udp_acceleration_server_port", s->UdpAccel->MyPort); + PackAddData(p, "udp_acceleration_server_key", s->UdpAccel->MyKey, sizeof(s->UdpAccel->MyKey)); + PackAddData(p, "udp_acceleration_server_key_v2", s->UdpAccel->MyKey_V2, sizeof(s->UdpAccel->MyKey_V2)); + PackAddInt(p, "udp_acceleration_server_cookie", s->UdpAccel->MyCookie); + PackAddInt(p, "udp_acceleration_client_cookie", s->UdpAccel->YourCookie); + PackAddBool(p, "udp_acceleration_use_encryption", !s->UdpAccel->PlainTextMode); + PackAddBool(p, "use_hmac_on_udp_acceleration", s->UdpAccel->UseHMac); + PackAddBool(p, "udp_accel_fast_disconnect_detect", s->UdpAccelFastDisconnectDetect); + } + + if (s->EnableBulkOnRUDP) + { + // Allow bulk transfer on R-UDP + PackAddBool(p, "enable_bulk_on_rudp", true); + PackAddBool(p, "enable_hmac_on_bulk_of_rudp", s->EnableHMacOnBulkOfRUDP); + PackAddInt(p, "rudp_bulk_version", s->BulkOnRUDPVersion); + + if (s->BulkOnRUDPVersion == 2) + { + PackAddData(p, "bulk_on_rudp_send_key", s->Connection->FirstSock->BulkRecvKey->Data, RUDP_BULK_KEY_SIZE_V2); + s->Connection->FirstSock->BulkRecvKey->Size = RUDP_BULK_KEY_SIZE_V2; + + PackAddData(p, "bulk_on_rudp_recv_key", s->Connection->FirstSock->BulkSendKey->Data, RUDP_BULK_KEY_SIZE_V2); + s->Connection->FirstSock->BulkSendKey->Size = RUDP_BULK_KEY_SIZE_V2; + } + else + { + PackAddData(p, "bulk_on_rudp_send_key", s->Connection->FirstSock->BulkRecvKey->Data, SHA1_SIZE); + s->Connection->FirstSock->BulkRecvKey->Size = SHA1_SIZE; + + PackAddData(p, "bulk_on_rudp_recv_key", s->Connection->FirstSock->BulkSendKey->Data, SHA1_SIZE); + s->Connection->FirstSock->BulkSendKey->Size = SHA1_SIZE; + } + + // Backup R-UDP bulk send/recv keys for additional connections + Copy(s->BulkSendKey, s->Connection->FirstSock->BulkSendKey->Data, + s->Connection->FirstSock->BulkSendKey->Size); + + s->BulkSendKeySize = s->Connection->FirstSock->BulkSendKey->Size; + + Copy(s->BulkRecvKey, s->Connection->FirstSock->BulkRecvKey->Data, + s->Connection->FirstSock->BulkRecvKey->Size); + + s->BulkRecvKeySize = s->Connection->FirstSock->BulkRecvKey->Size; + } + + if (s->IsAzureSession) + { + if (s->Connection != NULL && s->Connection->FirstSock != NULL) + { + SOCK *sock = s->Connection->FirstSock; + + PackAddIp(p, "azure_real_server_global_ip", &sock->Reverse_MyServerGlobalIp); + } + } + + PackAddBool(p, "enable_udp_recovery", s->EnableUdpRecovery); + + return p; +} + +#define PACK_ADD_POLICY_BOOL(name, value) \ + PackAddBool(p, "policy:" name, y->value == false ? 0 : 1) +#define PACK_ADD_POLICY_UINT(name, value) \ + PackAddInt(p, "policy:" name, y->value) +#define PACK_GET_POLICY_BOOL(name, value) \ + y->value = (PackGetBool(p, "policy:" name)) +#define PACK_GET_POLICY_UINT(name, value) \ + y->value = PackGetInt(p, "policy:" name) + +// Get a PACK from the session key +bool GetSessionKeyFromPack(PACK *p, UCHAR *session_key, UINT *session_key_32) +{ + // Validate arguments + if (p == NULL || session_key == NULL || session_key_32 == NULL) + { + return false; + } + + if (PackGetDataSize(p, "session_key") != SHA1_SIZE) + { + return false; + } + if (PackGetData(p, "session_key", session_key) == false) + { + return false; + } + *session_key_32 = PackGetInt(p, "session_key_32"); + + return true; +} + +// Get the policy from the PACK +POLICY *PackGetPolicy(PACK *p) +{ + POLICY *y; + // Validate arguments + if (p == NULL) + { + return NULL; + } + + y = ZeroMalloc(sizeof(POLICY)); + + // Bool value + // Ver 2 + PACK_GET_POLICY_BOOL("Access", Access); + PACK_GET_POLICY_BOOL("DHCPFilter", DHCPFilter); + PACK_GET_POLICY_BOOL("DHCPNoServer", DHCPNoServer); + PACK_GET_POLICY_BOOL("DHCPForce", DHCPForce); + PACK_GET_POLICY_BOOL("NoBridge", NoBridge); + PACK_GET_POLICY_BOOL("NoRouting", NoRouting); + PACK_GET_POLICY_BOOL("PrivacyFilter", PrivacyFilter); + PACK_GET_POLICY_BOOL("NoServer", NoServer); + PACK_GET_POLICY_BOOL("CheckMac", CheckMac); + PACK_GET_POLICY_BOOL("CheckIP", CheckIP); + PACK_GET_POLICY_BOOL("ArpDhcpOnly", ArpDhcpOnly); + PACK_GET_POLICY_BOOL("MonitorPort", MonitorPort); + PACK_GET_POLICY_BOOL("NoBroadcastLimiter", NoBroadcastLimiter); + PACK_GET_POLICY_BOOL("FixPassword", FixPassword); + PACK_GET_POLICY_BOOL("NoQoS", NoQoS); + // Ver 3 + PACK_GET_POLICY_BOOL("RSandRAFilter", RSandRAFilter); + PACK_GET_POLICY_BOOL("RAFilter", RAFilter); + PACK_GET_POLICY_BOOL("DHCPv6Filter", DHCPv6Filter); + PACK_GET_POLICY_BOOL("DHCPv6NoServer", DHCPv6NoServer); + PACK_GET_POLICY_BOOL("NoRoutingV6", NoRoutingV6); + PACK_GET_POLICY_BOOL("CheckIPv6", CheckIPv6); + PACK_GET_POLICY_BOOL("NoServerV6", NoServerV6); + PACK_GET_POLICY_BOOL("NoSavePassword", NoSavePassword); + PACK_GET_POLICY_BOOL("FilterIPv4", FilterIPv4); + PACK_GET_POLICY_BOOL("FilterIPv6", FilterIPv6); + PACK_GET_POLICY_BOOL("FilterNonIP", FilterNonIP); + PACK_GET_POLICY_BOOL("NoIPv6DefaultRouterInRA", NoIPv6DefaultRouterInRA); + PACK_GET_POLICY_BOOL("NoIPv6DefaultRouterInRAWhenIPv6", NoIPv6DefaultRouterInRAWhenIPv6); + + // UINT value + // Ver 2 + PACK_GET_POLICY_UINT("MaxConnection", MaxConnection); + PACK_GET_POLICY_UINT("TimeOut", TimeOut); + PACK_GET_POLICY_UINT("MaxMac", MaxMac); + PACK_GET_POLICY_UINT("MaxIP", MaxIP); + PACK_GET_POLICY_UINT("MaxUpload", MaxUpload); + PACK_GET_POLICY_UINT("MaxDownload", MaxDownload); + PACK_GET_POLICY_UINT("MultiLogins", MultiLogins); + // Ver 3 + PACK_GET_POLICY_UINT("MaxIPv6", MaxIPv6); + PACK_GET_POLICY_UINT("AutoDisconnect", AutoDisconnect); + PACK_GET_POLICY_UINT("VLanId", VLanId); + + // Ver 3 flag + PACK_GET_POLICY_BOOL("Ver3", Ver3); + + return y; +} + +// Insert the policy into the PACK +void PackAddPolicy(PACK *p, POLICY *y) +{ + // Validate arguments + if (p == NULL || y == NULL) + { + return; + } + + // Bool value + // Ver 2 + PACK_ADD_POLICY_BOOL("Access", Access); + PACK_ADD_POLICY_BOOL("DHCPFilter", DHCPFilter); + PACK_ADD_POLICY_BOOL("DHCPNoServer", DHCPNoServer); + PACK_ADD_POLICY_BOOL("DHCPForce", DHCPForce); + PACK_ADD_POLICY_BOOL("NoBridge", NoBridge); + PACK_ADD_POLICY_BOOL("NoRouting", NoRouting); + PACK_ADD_POLICY_BOOL("PrivacyFilter", PrivacyFilter); + PACK_ADD_POLICY_BOOL("NoServer", NoServer); + PACK_ADD_POLICY_BOOL("CheckMac", CheckMac); + PACK_ADD_POLICY_BOOL("CheckIP", CheckIP); + PACK_ADD_POLICY_BOOL("ArpDhcpOnly", ArpDhcpOnly); + PACK_ADD_POLICY_BOOL("MonitorPort", MonitorPort); + PACK_ADD_POLICY_BOOL("NoBroadcastLimiter", NoBroadcastLimiter); + PACK_ADD_POLICY_BOOL("FixPassword", FixPassword); + PACK_ADD_POLICY_BOOL("NoQoS", NoQoS); + // Ver 3 + PACK_ADD_POLICY_BOOL("RSandRAFilter", RSandRAFilter); + PACK_ADD_POLICY_BOOL("RAFilter", RAFilter); + PACK_ADD_POLICY_BOOL("DHCPv6Filter", DHCPv6Filter); + PACK_ADD_POLICY_BOOL("DHCPv6NoServer", DHCPv6NoServer); + PACK_ADD_POLICY_BOOL("NoRoutingV6", NoRoutingV6); + PACK_ADD_POLICY_BOOL("CheckIPv6", CheckIPv6); + PACK_ADD_POLICY_BOOL("NoServerV6", NoServerV6); + PACK_ADD_POLICY_BOOL("NoSavePassword", NoSavePassword); + PACK_ADD_POLICY_BOOL("FilterIPv4", FilterIPv4); + PACK_ADD_POLICY_BOOL("FilterIPv6", FilterIPv6); + PACK_ADD_POLICY_BOOL("FilterNonIP", FilterNonIP); + PACK_ADD_POLICY_BOOL("NoIPv6DefaultRouterInRA", NoIPv6DefaultRouterInRA); + PACK_ADD_POLICY_BOOL("NoIPv6DefaultRouterInRAWhenIPv6", NoIPv6DefaultRouterInRAWhenIPv6); + + // UINT value + // Ver 2 + PACK_ADD_POLICY_UINT("MaxConnection", MaxConnection); + PACK_ADD_POLICY_UINT("TimeOut", TimeOut); + PACK_ADD_POLICY_UINT("MaxMac", MaxMac); + PACK_ADD_POLICY_UINT("MaxIP", MaxIP); + PACK_ADD_POLICY_UINT("MaxUpload", MaxUpload); + PACK_ADD_POLICY_UINT("MaxDownload", MaxDownload); + PACK_ADD_POLICY_UINT("MultiLogins", MultiLogins); + // Ver 3 + PACK_ADD_POLICY_UINT("MaxIPv6", MaxIPv6); + PACK_ADD_POLICY_UINT("AutoDisconnect", AutoDisconnect); + PACK_ADD_POLICY_UINT("VLanId", VLanId); + + // Ver 3 flag + PackAddBool(p, "policy:Ver3", true); +} + +// Upload the authentication data for the additional connection +bool ClientUploadAuth2(CONNECTION *c, SOCK *s) +{ + PACK *p = NULL; + // Validate arguments + if (c == NULL) + { + return false; + } + + p = PackAdditionalConnect(c->Session->SessionKey); + + PackAddClientVersion(p, c); + + if (HttpClientSend(s, p) == false) + { + FreePack(p); + return false; + } + FreePack(p); + + return true; +} + +// Send a NOOP +void ClientUploadNoop(CONNECTION *c) +{ + PACK *p; + // Validate arguments + if (c == NULL) + { + return; + } + + p = PackError(0); + PackAddInt(p, "noop", 1); + (void)HttpClientSend(c->FirstSock, p); + FreePack(p); + + p = HttpClientRecv(c->FirstSock); + if (p != NULL) + { + FreePack(p); + } +} + +// Add client version information to the PACK +void PackAddClientVersion(PACK *p, CONNECTION *c) +{ + // Validate arguments + if (p == NULL || c == NULL) + { + return; + } + + PackAddStr(p, "client_str", c->ClientStr); + PackAddInt(p, "client_ver", c->ClientVer); + PackAddInt(p, "client_build", c->ClientBuild); +} + +// Upload the certificate data for the new connection +bool ClientUploadAuth(CONNECTION *c) +{ + PACK *p = NULL; + CLIENT_AUTH *a; + CLIENT_OPTION *o; + X *x; + bool ret; + NODE_INFO info; + UCHAR secure_password[SHA1_SIZE]; + UCHAR sign[4096 / 8]; + UCHAR unique[SHA1_SIZE]; + RPC_WINVER v; + // Validate arguments + if (c == NULL) + { + return false; + } + + Zero(sign, sizeof(sign)); + + a = c->Session->ClientAuth; + o = c->Session->ClientOption; + + if (c->UseTicket == false) + { + switch (a->AuthType) + { + case CLIENT_AUTHTYPE_ANONYMOUS: + // Anonymous authentication + p = PackLoginWithAnonymous(o->HubName, a->Username); + break; + + case CLIENT_AUTHTYPE_PASSWORD: + // Password authentication + SecurePassword(secure_password, a->HashedPassword, c->Random); + p = PackLoginWithPassword(o->HubName, a->Username, secure_password); + break; + + case CLIENT_AUTHTYPE_PLAIN_PASSWORD: + // Plaintext password authentication + p = PackLoginWithPlainPassword(o->HubName, a->Username, a->PlainPassword); + break; + + case CLIENT_AUTHTYPE_CERT: + // Certificate authentication + if (a->ClientX != NULL && a->ClientX->is_compatible_bit && + a->ClientX->bits != 0 && (a->ClientX->bits / 8) <= sizeof(sign)) + { + if (RsaSignEx(sign, c->Random, SHA1_SIZE, a->ClientK, a->ClientX->bits)) + { + p = PackLoginWithCert(o->HubName, a->Username, a->ClientX, sign, a->ClientX->bits / 8); + c->ClientX = CloneX(a->ClientX); + } + } + break; + + case CLIENT_AUTHTYPE_OPENSSLENGINE: + // Certificate authentication + if (a->ClientX != NULL && a->ClientX->is_compatible_bit && + a->ClientX->bits != 0 && (a->ClientX->bits / 8) <= sizeof(sign)) + { + if (RsaSignEx(sign, c->Random, SHA1_SIZE, a->ClientK, a->ClientX->bits)) + { + p = PackLoginWithCert(o->HubName, a->Username, a->ClientX, sign, a->ClientX->bits / 8); + c->ClientX = CloneX(a->ClientX); + } + } + break; + + + case CLIENT_AUTHTYPE_SECURE: + // Authentication by secure device + if (ClientSecureSign(c, sign, c->Random, &x)) + { + p = PackLoginWithCert(o->HubName, a->Username, x, sign, x->bits / 8); + c->ClientX = CloneX(x); + FreeX(x); + } + else + { + c->Err = ERR_SECURE_DEVICE_OPEN_FAILED; + c->Session->ForceStopFlag = true; + } + break; + } + } + else + { + // Ticket + p = NewPack(); + PackAddStr(p, "method", "login"); + PackAddStr(p, "hubname", o->HubName); + PackAddStr(p, "username", a->Username); + PackAddInt(p, "authtype", AUTHTYPE_TICKET); + PackAddData(p, "ticket", c->Ticket, SHA1_SIZE); + } + + if (p == NULL) + { + // Error + if (c->Err != ERR_SECURE_DEVICE_OPEN_FAILED) + { + c->Err = ERR_PROTOCOL_ERROR; + } + return false; + } + + PackAddClientVersion(p, c); + + // Protocol + PackAddInt(p, "protocol", c->Protocol); + + // Version, etc. + PackAddStr(p, "hello", c->ClientStr); + PackAddInt(p, "version", c->ClientVer); + PackAddInt(p, "build", c->ClientBuild); + PackAddInt(p, "client_id", c->Cedar->ClientId); + + // The maximum number of connections + PackAddInt(p, "max_connection", o->MaxConnection); + // Flag to use of cryptography + PackAddInt(p, "use_encrypt", o->UseEncrypt == false ? 0 : 1); + // Data compression flag + PackAddInt(p, "use_compress", o->UseCompress == false ? 0 : 1); + // Half connection flag + PackAddInt(p, "half_connection", o->HalfConnection == false ? 0 : 1); + + // Bridge / routing mode flag + PackAddBool(p, "require_bridge_routing_mode", o->RequireBridgeRoutingMode); + + // Monitor mode flag + PackAddBool(p, "require_monitor_mode", o->RequireMonitorMode); + + // VoIP / QoS flag + PackAddBool(p, "qos", o->DisableQoS ? false : true); + + // Bulk transfer support + PackAddBool(p, "support_bulk_on_rudp", true); + PackAddBool(p, "support_hmac_on_bulk_of_rudp", true); + + // UDP recovery support + PackAddBool(p, "support_udp_recovery", true); + + // Unique ID + GenerateMachineUniqueHash(unique); + PackAddData(p, "unique_id", unique, SHA1_SIZE); + + // UDP acceleration function using flag + if (o->NoUdpAcceleration == false && c->Session->UdpAccel != NULL) + { + IP my_ip; + + Zero(&my_ip, sizeof(my_ip)); + + PackAddBool(p, "use_udp_acceleration", true); + + PackAddInt(p, "udp_acceleration_version", c->Session->UdpAccel->Version); + + Copy(&my_ip, &c->Session->UdpAccel->MyIp, sizeof(IP)); + if (IsLocalHostIP(&my_ip)) + { + if (IsIP4(&my_ip)) + { + ZeroIP4(&my_ip); + } + else + { + ZeroIP6(&my_ip); + } + } + + PackAddIp(p, "udp_acceleration_client_ip", &my_ip); + PackAddInt(p, "udp_acceleration_client_port", c->Session->UdpAccel->MyPort); + PackAddData(p, "udp_acceleration_client_key", c->Session->UdpAccel->MyKey, UDP_ACCELERATION_COMMON_KEY_SIZE_V1); + PackAddData(p, "udp_acceleration_client_key_v2", c->Session->UdpAccel->MyKey_V2, UDP_ACCELERATION_COMMON_KEY_SIZE_V2); + PackAddBool(p, "support_hmac_on_udp_acceleration", true); + PackAddBool(p, "support_udp_accel_fast_disconnect_detect", true); + PackAddInt(p, "udp_acceleration_max_version", 2); + } + + PackAddInt(p, "rudp_bulk_max_version", 2); + + // Brand string for the connection limit + { + char *branded_ctos = _SS("BRANDED_C_TO_S"); + if(StrLen(branded_ctos) > 0) + { + PackAddStr(p, "branded_ctos", branded_ctos); + } + } + + // Node information + CreateNodeInfo(&info, c); + OutRpcNodeInfo(p, &info); + + // OS information + GetWinVer(&v); + OutRpcWinVer(p, &v); + + ret = HttpClientSend(c->FirstSock, p); + if (ret == false) + { + c->Err = ERR_DISCONNECTED; + } + + FreePack(p); + + return ret; +} + +// Upload the Hello packet +bool ServerUploadHello(CONNECTION *c) +{ + PACK *p; + // Validate arguments + if (c == NULL) + { + return false; + } + + // Random number generation + Rand(c->Random, SHA1_SIZE); + + p = PackHello(c->Random, c->ServerVer, c->ServerBuild, c->ServerStr); + if (HttpServerSend(c->FirstSock, p) == false) + { + FreePack(p); + c->Err = ERR_DISCONNECTED; + return false; + } + + FreePack(p); + + return true; +} + +// Download the Hello packet +bool ClientDownloadHello(CONNECTION *c, SOCK *s) +{ + PACK *p; + UINT err; + UCHAR random[SHA1_SIZE]; + // Validate arguments + if (c == NULL) + { + return false; + } + + // Data reception + p = HttpClientRecv(s); + if (p == NULL) + { + c->Err = ERR_SERVER_IS_NOT_VPN; + return false; + } + + if (err = GetErrorFromPack(p)) + { + // An error has occured + c->Err = err; + FreePack(p); + return false; + } + + // Packet interpretation + if (GetHello(p, random, &c->ServerVer, &c->ServerBuild, c->ServerStr, sizeof(c->ServerStr)) == false) + { + c->Err = ERR_SERVER_IS_NOT_VPN; + FreePack(p); + return false; + } + + if (c->FirstSock == s) + { + Copy(c->Random, random, SHA1_SIZE); + } + + FreePack(p); + + return true; +} + +// Download the signature +bool ServerDownloadSignature(CONNECTION *c, char **error_detail_str) +{ + HTTP_HEADER *h; + UCHAR *data; + UINT data_size; + SOCK *s; + UINT num = 0, max = 19; + SERVER *server; + char *vpn_http_target = HTTP_VPN_TARGET2; + // Validate arguments + if (c == NULL) + { + return false; + } + + server = c->Cedar->Server; + + s = c->FirstSock; + + while (true) + { + bool not_found_error = false; + + num++; + if (num > max) + { + // Disconnect + Disconnect(s); + c->Err = ERR_CLIENT_IS_NOT_VPN; + + *error_detail_str = "HTTP_TOO_MANY_REQUEST"; + return false; + } + // Receive a header + h = RecvHttpHeader(s); + if (h == NULL) + { + c->Err = ERR_CLIENT_IS_NOT_VPN; + if (c->IsJsonRpc) + { + c->Err = ERR_DISCONNECTED; + } + return false; + } + + // Interpret + if (StrCmpi(h->Method, "POST") == 0) + { + // Receive the data since it's POST + data_size = GetContentLength(h); + + if (server->DisableJsonRpcWebApi == false) + { + if (StrCmpi(h->Target, "/api") == 0 || StrCmpi(h->Target, "/api/") == 0) + { + c->IsJsonRpc = true; + c->Type = CONNECTION_TYPE_ADMIN_RPC; + + JsonRpcProcPost(c, s, h, data_size); + + FreeHttpHeader(h); + + if (c->JsonRpcAuthed) + { + num = 0; + } + + continue; + } + else if (StartWith(h->Target, "/admin")) + { + c->IsJsonRpc = true; + c->Type = CONNECTION_TYPE_ADMIN_RPC; + + AdminWebProcPost(c, s, h, data_size, h->Target); + + FreeHttpHeader(h); + + if (c->JsonRpcAuthed) + { + num = 0; + } + + continue; + } + } + + if ((data_size > MAX_WATERMARK_SIZE || data_size < SizeOfWaterMark()) && (data_size != StrLen(HTTP_VPN_TARGET_POSTDATA))) + { + // Data is too large + HttpSendForbidden(s, h->Target, NULL); + FreeHttpHeader(h); + c->Err = ERR_CLIENT_IS_NOT_VPN; + *error_detail_str = "POST_Recv_TooLong"; + return false; + } + data = Malloc(data_size); + if (RecvAll(s, data, data_size, s->SecureMode) == false) + { + // Data reception failure + Free(data); + FreeHttpHeader(h); + c->Err = ERR_DISCONNECTED; + *error_detail_str = "POST_Recv_Failed"; + return false; + } + // Check the Target + if ((StrCmpi(h->Target, vpn_http_target) != 0) || not_found_error) + { + // Target is invalid + HttpSendNotFound(s, h->Target); + Free(data); + FreeHttpHeader(h); + *error_detail_str = "POST_Target_Wrong"; + } + else + { + // Compare posted data with the WaterMark + if ((data_size == StrLen(HTTP_VPN_TARGET_POSTDATA) && (Cmp(data, HTTP_VPN_TARGET_POSTDATA, data_size) == 0)) + || ((data_size >= SizeOfWaterMark()) && Cmp(data, WaterMark, SizeOfWaterMark()) == 0)) + { + // Check the WaterMark + Free(data); + FreeHttpHeader(h); + return true; + } + else + { + // WaterMark is incorrect + HttpSendForbidden(s, h->Target, NULL); + FreeHttpHeader(h); + *error_detail_str = "POST_WaterMark_Error"; + } + } + } + else if (StrCmpi(h->Method, "OPTIONS") == 0) + { + if (server->DisableJsonRpcWebApi == false) + { + if (StrCmpi(h->Target, "/api") == 0 || StrCmpi(h->Target, "/api/") == 0 || StartWith(h->Target, "/admin")) + { + c->IsJsonRpc = true; + c->Type = CONNECTION_TYPE_ADMIN_RPC; + + JsonRpcProcOptions(c, s, h, h->Target); + + FreeHttpHeader(h); + + num = 0; + + continue; + } + } + } + else if (StrCmpi(h->Method, "SSTP_DUPLEX_POST") == 0 && (ProtoEnabled(server->Proto, "SSTP") || s->IsReverseAcceptedSocket) && GetServerCapsBool(server, "b_support_sstp")) + { + // SSTP client is connected + c->WasSstp = true; + + if (StrCmpi(h->Target, SSTP_URI) == 0) + { + bool sstp_ret; + // Accept the SSTP connection + c->Type = CONNECTION_TYPE_OTHER; + + sstp_ret = ProtoHandleConnection(server->Proto, s, "SSTP"); + + c->Err = ERR_DISCONNECTED; + FreeHttpHeader(h); + + if (sstp_ret) + { + *error_detail_str = ""; + } + else + { + *error_detail_str = "SSTP_ABORT"; + } + + return false; + } + else + { + // URI is invalid + HttpSendNotFound(s, h->Target); + *error_detail_str = "SSTP_URL_WRONG"; + } + + FreeHttpHeader(h); + } + else + { + // This should not be a VPN client, but interpret a bit more + if (StrCmpi(h->Method, "GET") != 0 && StrCmpi(h->Method, "HEAD") != 0 + && StrCmpi(h->Method, "POST") != 0) + { + // Unsupported method calls + HttpSendNotImplemented(s, h->Method, h->Target, h->Version); + *error_detail_str = "HTTP_BAD_METHOD"; + } + else + { + if (StrCmpi(h->Target, "/") == 0) + { + // Root directory + BUF *b = NULL; + *error_detail_str = "HTTP_ROOT"; + + if (server->DisableJsonRpcWebApi == false) + { + b = ReadDump("|wwwroot\\index.html"); + } + + if (b != NULL) + { + FreeHttpHeader(h); + h = NewHttpHeader("HTTP/1.1", "202", "OK"); + AddHttpValue(h, NewHttpValue("Content-Type", HTTP_CONTENT_TYPE4)); + AddHttpValue(h, NewHttpValue("Connection", "Keep-Alive")); + AddHttpValue(h, NewHttpValue("Keep-Alive", HTTP_KEEP_ALIVE)); + + PostHttp(c->FirstSock, h, b->Buf, b->Size); + + FreeBuf(b); + } + else + { + HttpSendForbidden(c->FirstSock, h->Target, ""); + } + } + else + { + bool b = false; + + // Show the WebUI if the configuration allow to use the WebUI + if (c->Cedar->Server != NULL && c->Cedar->Server->UseWebUI) + { + WU_WEBPAGE *page; + + // Show the WebUI + page = WuGetPage(h->Target, c->Cedar->WebUI); + + if (page != NULL) + { + PostHttp(s, page->header, page->data, page->size); + b = true; + WuFreeWebPage(page); + } + + } + + if (c->FirstSock->RemoteIP.addr[0] == 127) + { + if (StrCmpi(h->Target, HTTP_SAITAMA) == 0) + { + // Saitama (joke) + FreeHttpHeader(h); + h = NewHttpHeader("HTTP/1.1", "202", "OK"); + AddHttpValue(h, NewHttpValue("Content-Type", HTTP_CONTENT_TYPE3)); + AddHttpValue(h, NewHttpValue("Connection", "Keep-Alive")); + AddHttpValue(h, NewHttpValue("Keep-Alive", HTTP_KEEP_ALIVE)); + PostHttp(s, h, Saitama, SizeOfSaitama()); + b = true; + } + else if (StartWith(h->Target, HTTP_PICTURES)) + { + BUF *buf; + + // Lots of photos + buf = ReadDump("|Pictures.mht"); + + if (buf != NULL) + { + FreeHttpHeader(h); + h = NewHttpHeader("HTTP/1.1", "202", "OK"); + AddHttpValue(h, NewHttpValue("Content-Type", HTTP_CONTENT_TYPE5)); + AddHttpValue(h, NewHttpValue("Connection", "Keep-Alive")); + AddHttpValue(h, NewHttpValue("Keep-Alive", HTTP_KEEP_ALIVE)); + PostHttp(s, h, buf->Buf, buf->Size); + b = true; + + FreeBuf(buf); + } + } + } + + if (b == false) + { + if (server->DisableJsonRpcWebApi == false) + { + if (StartWith(h->Target, "/api?") || StartWith(h->Target, "/api/") || StrCmpi(h->Target, "/api") == 0) + { + c->IsJsonRpc = true; + c->Type = CONNECTION_TYPE_ADMIN_RPC; + + JsonRpcProcGet(c, s, h, h->Target); + + if (c->JsonRpcAuthed) + { + num = 0; + } + + FreeHttpHeader(h); + + continue; + } + else if (StartWith(h->Target, "/admin")) + { + c->IsJsonRpc = true; + c->Type = CONNECTION_TYPE_ADMIN_RPC; + + AdminWebProcGet(c, s, h, h->Target); + + if (c->JsonRpcAuthed) + { + num = 0; + } + + FreeHttpHeader(h); + + continue; + } + } + } + + if (b == false) + { + // Not Found + HttpSendNotFound(s, h->Target); + + *error_detail_str = "HTTP_NOT_FOUND"; + } + } + } + FreeHttpHeader(h); + } + } +} + +// Upload a signature +bool ClientUploadSignature(SOCK *s) +{ + HTTP_HEADER *h; + UINT water_size, rand_size; + UCHAR *water; + char ip_str[128]; + // Validate arguments + if (s == NULL) + { + return false; + } + + IPToStr(ip_str, sizeof(ip_str), &s->RemoteIP); + + h = NewHttpHeader("POST", HTTP_VPN_TARGET2, "HTTP/1.1"); + AddHttpValue(h, NewHttpValue("Host", ip_str)); + AddHttpValue(h, NewHttpValue("Content-Type", HTTP_CONTENT_TYPE3)); + AddHttpValue(h, NewHttpValue("Connection", "Keep-Alive")); + + + + // Generate a watermark + rand_size = Rand32() % (HTTP_PACK_RAND_SIZE_MAX * 2); + water_size = SizeOfWaterMark() + rand_size; + water = Malloc(water_size); + Copy(water, WaterMark, SizeOfWaterMark()); + Rand(&water[SizeOfWaterMark()], rand_size); + + // Upload the watermark data + if (PostHttp(s, h, water, water_size) == false) + { + Free(water); + FreeHttpHeader(h); + return false; + } + + Free(water); + FreeHttpHeader(h); + + return true; +} + +// Establish a connection to the server +SOCK *ClientConnectToServer(CONNECTION *c) +{ + SOCK *s = NULL; + X *x = NULL; + K *k = NULL; + // Validate arguments + if (c == NULL) + { + return NULL; + } + + if (c->Halt) + { + c->Err = ERR_USER_CANCEL; + return NULL; + } + + // Get the socket by connecting + s = ClientConnectGetSocket(c, false); + if (s == NULL) + { + // Connection failure + return NULL; + } + + c->FirstSock = s; + + if (c->Halt) + { + c->Err = ERR_USER_CANCEL; + ReleaseSock(s); + c->FirstSock = NULL; + return NULL; + } + + // Time-out + SetTimeout(s, CONNECTING_TIMEOUT); + + // Start the SSL communication + if (StartSSLEx(s, x, k, 0, c->ServerName) == false) + { + // SSL communication start failure + Disconnect(s); + ReleaseSock(s); + c->FirstSock = NULL; + c->Err = ERR_SERVER_IS_NOT_VPN; + return NULL; + } + + if (s->RemoteX == NULL) + { + // SSL communication start failure + Disconnect(s); + ReleaseSock(s); + c->FirstSock = NULL; + c->Err = ERR_SERVER_IS_NOT_VPN; + return NULL; + } + + return s; +} + +// Return a socket by connecting to the server +SOCK *ClientConnectGetSocket(CONNECTION *c, bool additional_connect) +{ + volatile bool *cancel_flag = NULL; + char hostname[MAX_HOST_NAME_LEN]; + bool save_resolved_ip = false; + CLIENT_OPTION *o; + SESSION *sess; + SOCK *sock = NULL; + IP resolved_ip; + // Validate arguments + if (c == NULL || c->Session == NULL || c->Session->ClientOption == NULL) + { + return NULL; + } + + cancel_flag = &c->Halt; + sess = c->Session; + o = c->Session->ClientOption; + + Zero(&resolved_ip, sizeof(resolved_ip)); + + if (additional_connect == false && c->RestoreServerNameAndPort) + { + // Update server name and port number. + // At the time of writing this comment RestoreServerNameAndPort is never true. + c->RestoreServerNameAndPort = false; + + if (StrCmpi(c->ServerName, o->Hostname) != 0) + { + StrCpy(c->ServerName, sizeof(c->ServerName), o->Hostname); + } + + c->ServerPort = o->Port; + } + + if (IsZeroIP(&sess->ServerIP_CacheForNextConnect) == false) + { + IPToStr(hostname, sizeof(hostname), &sess->ServerIP_CacheForNextConnect); + Debug("ClientConnectGetSocket(): Using cached IP address %s\n", hostname); + } + else + { + IP tmp; + + StrCpy(hostname, sizeof(hostname), o->ProxyType == PROXY_DIRECT ? c->ServerName : o->ProxyName); + + if (StrToIP(&tmp, hostname) == false) + { + // The hostname is not an IP address + save_resolved_ip = true; + } + } + + if (o->ProxyType == PROXY_DIRECT) + { + UINT nat_t_err = 0; + wchar_t tmp[MAX_SIZE]; + UniFormat(tmp, sizeof(tmp), _UU("STATUS_4"), hostname); + PrintStatus(sess, tmp); + + if (o->PortUDP == 0) + { + // If additional_connect == false, enable trying to NAT-T connection + // If additional_connect == true, follow the IsRUDPSession setting in this session + sock = TcpIpConnectEx(hostname, c->ServerPort, + (bool *)cancel_flag, c->hWndForUI, &nat_t_err, (additional_connect ? (!sess->IsRUDPSession) : false), + true, &resolved_ip); + } + else + { + // Mode to connect with R-UDP directly without using NAT-T server when using UDP + IP ip; + if (StrToIP(&ip, hostname)) + { + sock = NewRUDPClientDirect(VPN_RUDP_SVC_NAME, &ip, o->PortUDP, &nat_t_err, + TIMEOUT_TCP_PORT_CHECK, (bool *)cancel_flag, NULL, NULL, 0, false); + + if (sock != NULL) + { + StrCpy(sock->UnderlayProtocol, sizeof(sock->UnderlayProtocol), SOCK_UNDERLAY_NAT_T); + } + } + } + + if (sock == NULL) + { + // Connection failure + if (nat_t_err != RUDP_ERROR_NAT_T_TWO_OR_MORE) + { + c->Err = ERR_CONNECT_FAILED; + } + else + { + c->Err = ERR_NAT_T_TWO_OR_MORE; + } + + return NULL; + } + } + else + { + wchar_t tmp[MAX_SIZE]; + PROXY_PARAM_OUT out; + PROXY_PARAM_IN in; + UINT ret; + + Zero(&in, sizeof(in)); + + in.Timeout = 0; + + StrCpy(in.TargetHostname, sizeof(in.TargetHostname), c->ServerName); + in.TargetPort = c->ServerPort; + + StrCpy(in.Hostname, sizeof(in.Hostname), IsEmptyStr(hostname) ? o->ProxyName : hostname); + in.Port = o->ProxyPort; + + StrCpy(in.Username, sizeof(in.Username), o->ProxyUsername); + StrCpy(in.Password, sizeof(in.Password), o->ProxyPassword); + + StrCpy(in.HttpCustomHeader, sizeof(in.HttpCustomHeader), o->CustomHttpHeader); + StrCpy(in.HttpUserAgent, sizeof(in.HttpUserAgent), c->Cedar->HttpUserAgent); + +#ifdef OS_WIN32 + in.Hwnd = c->hWndForUI; +#endif + + UniFormat(tmp, sizeof(tmp), _UU("STATUS_2"), in.TargetHostname, in.Hostname); + PrintStatus(sess, tmp); + + switch (o->ProxyType) + { + case PROXY_HTTP: + ret = ProxyHttpConnect(&out, &in, cancel_flag); + break; + case PROXY_SOCKS: + ret = ProxySocks4Connect(&out, &in, cancel_flag); + break; + case PROXY_SOCKS5: + ret = ProxySocks5Connect(&out, &in, cancel_flag); + break; + default: + c->Err = ERR_INTERNAL_ERROR; + Debug("ClientConnectGetSocket(): Unknown proxy type: %u!\n", o->ProxyType); + return NULL; + } + + c->Err = ProxyCodeToCedar(ret); + + if (c->Err != ERR_NO_ERROR) + { + Debug("ClientConnectGetSocket(): Connection via proxy server failed with error %u\n", ret); + return NULL; + } + + sock = out.Sock; + + CopyIP(&resolved_ip, &out.ResolvedIp); + } + + if (additional_connect == false || IsZeroIP(&sock->RemoteIP)) + { + if (((sock->IsRUDPSocket || sock->IPv6) && IsZeroIP(&sock->RemoteIP) == false && o->ProxyType == PROXY_DIRECT) || GetIP(&c->Session->ServerIP, hostname) == false) + { + Copy(&c->Session->ServerIP, &sock->RemoteIP, sizeof(c->Session->ServerIP)); + } + } + + if (save_resolved_ip && IsZeroIP(&resolved_ip) == false) + { + Copy(&c->Session->ServerIP_CacheForNextConnect, &resolved_ip, sizeof(c->Session->ServerIP_CacheForNextConnect)); + Debug("ClientConnectGetSocket(): Saved %s IP address %r for future connections.\n", hostname, &resolved_ip); + } + + return sock; +} + +UINT ProxyCodeToCedar(UINT code) +{ + switch (code) + { + case PROXY_ERROR_SUCCESS: + return ERR_NO_ERROR; + case PROXY_ERROR_GENERIC: + case PROXY_ERROR_VERSION: + return ERR_PROXY_ERROR; + case PROXY_ERROR_CANCELED: + return ERR_USER_CANCEL; + case PROXY_ERROR_CONNECTION: + return ERR_PROXY_CONNECT_FAILED; + case PROXY_ERROR_TARGET: + return ERR_CONNECT_FAILED; + case PROXY_ERROR_DISCONNECTED: + return ERR_DISCONNECTED; + case PROXY_ERROR_AUTHENTICATION: + return ERR_PROXY_AUTH_FAILED; + default: + return ERR_INTERNAL_ERROR; + } +} + +// TCP connection function +SOCK *TcpConnectEx3(char *hostname, UINT port, UINT timeout, bool *cancel_flag, void *hWnd, bool no_nat_t, UINT *nat_t_error_code, bool try_start_ssl, IP *ret_ip) +{ +#ifdef OS_WIN32 + if (hWnd == NULL) + { +#endif // OS_WIN32 + return ConnectEx4(hostname, port, timeout, cancel_flag, (no_nat_t ? NULL : VPN_RUDP_SVC_NAME), nat_t_error_code, try_start_ssl, true, ret_ip); +#ifdef OS_WIN32 + } + else + { + return WinConnectEx3((HWND)hWnd, hostname, port, timeout, 0, NULL, NULL, nat_t_error_code, (no_nat_t ? NULL : VPN_RUDP_SVC_NAME), try_start_ssl); + } +#endif // OS_WIN32 +} + +// Connect with TCP/IP +SOCK *TcpIpConnectEx(char *hostname, UINT port, bool *cancel_flag, void *hWnd, UINT *nat_t_error_code, bool no_nat_t, bool try_start_ssl, IP *ret_ip) +{ + SOCK *s = NULL; + UINT dummy_int = 0; + // Validate arguments + if (nat_t_error_code == NULL) + { + nat_t_error_code = &dummy_int; + } + *nat_t_error_code = 0; + if (hostname == NULL || port == 0) + { + return NULL; + } + + s = TcpConnectEx3(hostname, port, 0, cancel_flag, hWnd, no_nat_t, nat_t_error_code, try_start_ssl, ret_ip); + if (s == NULL) + { + return NULL; + } + + return s; +} + +// Protocol routine initialization +void InitProtocol() +{ +} + +// Release the protocol routine +void FreeProtocol() +{ +} + +// Create a Hello packet +PACK *PackHello(void *random, UINT ver, UINT build, char *server_str) +{ + PACK *p; + // Validate arguments + if (random == NULL || server_str == NULL) + { + return NULL; + } + + p = NewPack(); + PackAddStr(p, "hello", server_str); + PackAddInt(p, "version", ver); + PackAddInt(p, "build", build); + PackAddData(p, "random", random, SHA1_SIZE); + + return p; +} + +// Interpret the Hello packet +bool GetHello(PACK *p, void *random, UINT *ver, UINT *build, char *server_str, UINT server_str_size) +{ + // Validate arguments + if (p == NULL || random == NULL || ver == NULL || server_str == NULL) + { + return false; + } + + if (PackGetStr(p, "hello", server_str, server_str_size) == false) + { + return false; + } + *ver = PackGetInt(p, "version"); + *build = PackGetInt(p, "build"); + if (PackGetDataSize(p, "random") != SHA1_SIZE) + { + return false; + } + if (PackGetData(p, "random", random) == false) + { + return false; + } + + return true; +} + +// Get the authentication method from PACK +UINT GetAuthTypeFromPack(PACK *p) +{ + // Validate arguments + if (p == NULL) + { + return 0; + } + + return PackGetInt(p, "authtype"); +} + +// Get the HUB name and the user name from the PACK +bool GetHubnameAndUsernameFromPack(PACK *p, char *username, UINT username_size, + char *hubname, UINT hubname_size) +{ + // Validate arguments + if (p == NULL || username == NULL || hubname == NULL) + { + return false; + } + + if (PackGetStr(p, "username", username, username_size) == false) + { + return false; + } + if (PackGetStr(p, "hubname", hubname, hubname_size) == false) + { + return false; + } + return true; +} + +// Get the protocol from PACK +UINT GetProtocolFromPack(PACK *p) +{ + // Validate arguments + if (p == NULL) + { + return 0; + } + +#if 0 + return PackGetInt(p, "protocol"); +#else + // Limit to the TCP protocol in the current version + return CONNECTION_TCP; +#endif +} + +// Get the method from the PACK +bool GetMethodFromPack(PACK *p, char *method, UINT size) +{ + // Validate arguments + if (p == NULL || method == NULL || size == 0) + { + return false; + } + + return PackGetStr(p, "method", method, size); +} + +// Generate a packet of certificate authentication login +PACK *PackLoginWithCert(char *hubname, char *username, X *x, void *sign, UINT sign_size) +{ + PACK *p; + BUF *b; + // Validate arguments + if (hubname == NULL || username == NULL) + { + return NULL; + } + + p = NewPack(); + PackAddStr(p, "method", "login"); + PackAddStr(p, "hubname", hubname); + PackAddStr(p, "username", username); + PackAddInt(p, "authtype", CLIENT_AUTHTYPE_CERT); + + // Certificate + b = XToBuf(x, false); + PackAddData(p, "cert", b->Buf, b->Size); + FreeBuf(b); + + // Signature data + PackAddData(p, "sign", sign, sign_size); + + return p; +} + +// Generate a packet of plain text password authentication login +PACK *PackLoginWithPlainPassword(char *hubname, char *username, void *plain_password) +{ + PACK *p; + // Validate arguments + if (hubname == NULL || username == NULL) + { + return NULL; + } + + p = NewPack(); + PackAddStr(p, "method", "login"); + PackAddStr(p, "hubname", hubname); + PackAddStr(p, "username", username); + PackAddInt(p, "authtype", CLIENT_AUTHTYPE_PLAIN_PASSWORD); + PackAddStr(p, "plain_password", plain_password); + + return p; +} + +// Generate a packet of OpenVPN certificate login +PACK *PackLoginWithOpenVPNCertificate(char *hubname, char *username, X *x) +{ + PACK *p; + char cn_username[128]; + BUF *cert_buf = NULL; + // Validate arguments + if (hubname == NULL || username == NULL || x == NULL) + { + return NULL; + } + + p = NewPack(); + PackAddStr(p, "method", "login"); + PackAddStr(p, "hubname", hubname); + + if (IsEmptyStr(username)) + { + if (x->subject_name == NULL) + { + FreePack(p); + return NULL; + } + UniToStr(cn_username, sizeof(cn_username), x->subject_name->CommonName); + PackAddStr(p, "username", cn_username); + } + else + { + PackAddStr(p, "username", username); + } + + PackAddInt(p, "authtype", AUTHTYPE_OPENVPN_CERT); + + cert_buf = XToBuf(x, false); + PackAddBuf(p, "cert", cert_buf); + FreeBuf(cert_buf); + + return p; +} + +// Create a packet of password authentication login +PACK *PackLoginWithPassword(char *hubname, char *username, void *secure_password) +{ + PACK *p; + // Validate arguments + if (hubname == NULL || username == NULL) + { + return NULL; + } + + p = NewPack(); + PackAddStr(p, "method", "login"); + PackAddStr(p, "hubname", hubname); + PackAddStr(p, "username", username); + PackAddInt(p, "authtype", CLIENT_AUTHTYPE_PASSWORD); + PackAddData(p, "secure_password", secure_password, SHA1_SIZE); + + return p; +} + +// Create a packet for anonymous login +PACK *PackLoginWithAnonymous(char *hubname, char *username) +{ + PACK *p; + // Validate arguments + if (hubname == NULL || username == NULL) + { + return NULL; + } + + p = NewPack(); + PackAddStr(p, "method", "login"); + PackAddStr(p, "hubname", hubname); + PackAddStr(p, "username", username); + PackAddInt(p, "authtype", CLIENT_AUTHTYPE_ANONYMOUS); + + return p; +} + +// Create a packet for the additional connection +PACK *PackAdditionalConnect(UCHAR *session_key) +{ + PACK *p; + // Validate arguments + if (session_key == NULL) + { + return NULL; + } + + p = NewPack(); + PackAddStr(p, "method", "additional_connect"); + PackAddData(p, "session_key", session_key, SHA1_SIZE); + + return p; +} diff --git a/src/Cedar/Protocol.h b/src/Cedar/Protocol.h index 260a6b4e..a4b9ba7a 100644 --- a/src/Cedar/Protocol.h +++ b/src/Cedar/Protocol.h @@ -1,180 +1,180 @@ -// SoftEther VPN Source Code - Developer Edition Master Branch -// Cedar Communication Module - - -// Protocol.h -// Header of Protocol.c - -#ifndef PROTOCOL_H -#define PROTOCOL_H - -// The parameters that will be passed to the certificate confirmation thread -struct CHECK_CERT_THREAD_PROC -{ - CONNECTION *Connection; - X *ServerX; - CHECK_CERT_PROC *CheckCertProc; - bool UserSelected; - bool Expired; - bool Ok; -}; - -// The parameters that will be passed to the secure device signature thread -struct SECURE_SIGN_THREAD_PROC -{ - SECURE_SIGN_PROC *SecureSignProc; - CONNECTION *Connection; - SECURE_SIGN *SecureSign; - bool UserFinished; - bool Ok; -}; - -// Signature sending thread parameters -struct SEND_SIGNATURE_PARAM -{ - char Hostname[MAX_PATH]; // Host name - UINT Port; // Port number - BUF *Buffer; // Packet contents -}; - -// Software update client callback -typedef void (UPDATE_NOTIFY_PROC)(UPDATE_CLIENT *c, UINT latest_build, UINT64 latest_date, char *latest_ver, char *url, volatile bool *halt_flag, void *param); -typedef bool (UPDATE_ISFOREGROUND_PROC)(UPDATE_CLIENT *c, void *param); - -// Configure the software update client -struct UPDATE_CLIENT_SETTING -{ - bool DisableCheck; // Disable the update check - UINT LatestIgnoreBuild; // Ignore for earlier or identical to this build number -}; - -// Software update client -struct UPDATE_CLIENT -{ - char FamilyName[MAX_SIZE]; // Product family name - char SoftwareName[MAX_SIZE]; // Software Name - wchar_t SoftwareTitle[MAX_SIZE]; // Software display name - char ClientId[128]; // Client ID - UINT MyBuild; // Build number of myself - UINT64 MyDate; // Build date of myself - char MyLanguage[MAX_SIZE]; // My language - UPDATE_CLIENT_SETTING Setting; // Setting - UINT LatestBuild; // Latest build number that was successfully acquired - volatile bool HaltFlag; // Halting flag - EVENT *HaltEvent; // Halting event - void *Param; // Any parameters - THREAD *Thread; // Thread - UPDATE_NOTIFY_PROC *Callback; // Callback function - UPDATE_ISFOREGROUND_PROC *IsForegroundCb; // Callback function for retrieving whether foreground -}; - -//// Constant related to updating of the software - -// Family -#define UPDATE_FAMILY_NAME _SS("PRODUCT_FAMILY_NAME") - -// Software update server certificate hash -#define UPDATE_SERVER_CERT_HASH DDNS_CERT_HASH - -// URL -#define UPDATE_SERVER_URL_GLOBAL "https://update-check.softether-network.net/update/update.aspx?family=%s&software=%s&mybuild=%u&lang=%s" -#define UPDATE_SERVER_URL_CHINA "https://update-check.uxcom.jp/update/update.aspx?family=%s&software=%s&mybuild=%u&lang=%s" - -// Update check interval -#define UPDATE_CHECK_INTERVAL_MIN (12 * 3600 * 1000) -#define UPDATE_CHECK_INTERVAL_MAX (24 * 7200 * 1000) - -// Connection parameters -#define UPDATE_CONNECT_TIMEOUT 5000 -#define UPDATE_COMM_TIMEOUT 5000 - -// Dynamic root cert fetch function -#define CERT_HTTP_DOWNLOAD_MAXSIZE 65536 -#define CERT_HTTP_DOWNLOAD_TIMEOUT (10 * 1000) -#define ROOT_CERTS_FILENAME "|root_certs.dat" -#define AUTO_DOWNLOAD_CERTS_PREFIX L".autodownload_" -#define FIND_CERT_CHAIN_MAX_DEPTH 16 - -#define PROTO_SUPPRESS_CLIENT_UPDATE_NOTIFICATION_REGKEY "Software\\" GC_REG_COMPANY_NAME "\\" CEDAR_PRODUCT_STR " VPN\\Client Update Notification" -#define PROTO_SUPPRESS_CLIENT_UPDATE_NOTIFICATION_REGVALUE "Suppress" - -// Function prototype -UPDATE_CLIENT *NewUpdateClient(UPDATE_NOTIFY_PROC *cb, UPDATE_ISFOREGROUND_PROC *isforeground_cb, void *param, char *family_name, char *software_name, wchar_t *software_title, UINT my_build, UINT64 my_date, char *my_lang, UPDATE_CLIENT_SETTING *current_setting, char *client_id); -void FreeUpdateClient(UPDATE_CLIENT *c); -void UpdateClientThreadProc(THREAD *thread, void *param); -void UpdateClientThreadMain(UPDATE_CLIENT *c); -void UpdateClientThreadProcessResults(UPDATE_CLIENT *c, BUF *b); -void SetUpdateClientSetting(UPDATE_CLIENT *c, UPDATE_CLIENT_SETTING *s); -UINT64 ShortStrToDate64(char *str); - - -bool ServerAccept(CONNECTION *c); -bool ClientConnect(CONNECTION *c); -SOCK *ClientConnectToServer(CONNECTION *c); -SOCK *TcpIpConnectEx(char *hostname, UINT port, bool *cancel_flag, void *hWnd, UINT *nat_t_error_code, bool no_nat_t, bool try_start_ssl, IP *ret_ip); -bool ClientUploadSignature(SOCK *s); -bool ClientDownloadHello(CONNECTION *c, SOCK *s); -bool ServerDownloadSignature(CONNECTION *c, char **error_detail_str); -bool ServerUploadHello(CONNECTION *c); -bool ClientUploadAuth(CONNECTION *c); -SOCK *ClientConnectGetSocket(CONNECTION *c, bool additional_connect); -SOCK *TcpConnectEx3(char *hostname, UINT port, UINT timeout, bool *cancel_flag, void *hWnd, bool no_nat_t, UINT *nat_t_error_code, bool try_start_ssl, IP *ret_ip); - -UINT ProxyCodeToCedar(UINT code); - -void InitProtocol(); -void FreeProtocol(); - -POLICY *PackGetPolicy(PACK *p); -void PackAddPolicy(PACK *p, POLICY *y); -PACK *PackWelcome(SESSION *s); -PACK *PackHello(void *random, UINT ver, UINT build, char *server_str); -bool GetHello(PACK *p, void *random, UINT *ver, UINT *build, char *server_str, UINT server_str_size); -PACK *PackLoginWithAnonymous(char *hubname, char *username); -PACK *PackLoginWithPassword(char *hubname, char *username, void *secure_password); -PACK *PackLoginWithPlainPassword(char *hubname, char *username, void *plain_password); -PACK *PackLoginWithCert(char *hubname, char *username, X *x, void *sign, UINT sign_size); -PACK *PackLoginWithOpenVPNCertificate(char *hubname, char *username, X *x); -bool GetMethodFromPack(PACK *p, char *method, UINT size); -bool GetHubnameAndUsernameFromPack(PACK *p, char *username, UINT username_size, - char *hubname, UINT hubname_size); -PACK *PackAdditionalConnect(UCHAR *session_key); -UINT GetAuthTypeFromPack(PACK *p); -UINT GetProtocolFromPack(PACK *p); -bool ParseWelcomeFromPack(PACK *p, char *session_name, UINT session_name_size, - char *connection_name, UINT connection_name_size, - POLICY **policy); - - -bool ClientAdditionalConnect(CONNECTION *c, THREAD *t); -SOCK *ClientAdditionalConnectToServer(CONNECTION *c); -bool ClientUploadAuth2(CONNECTION *c, SOCK *s); -bool GetSessionKeyFromPack(PACK *p, UCHAR *session_key, UINT *session_key_32); - -void CreateNodeInfo(NODE_INFO *info, CONNECTION *c); -UINT SecureSign(SECURE_SIGN *sign, UINT device_id, char *pin); -void ClientUploadNoop(CONNECTION *c); -bool ClientCheckServerCert(CONNECTION *c, bool *expired); -void ClientCheckServerCertThread(THREAD *thread, void *param); -bool ClientSecureSign(CONNECTION *c, UCHAR *sign, UCHAR *random, X **x); -void ClientSecureSignThread(THREAD *thread, void *param); -TOKEN_LIST *EnumHub(SESSION *s); -UINT ChangePasswordAccept(CONNECTION *c, PACK *p); -UINT ChangePassword(CEDAR *cedar, CLIENT_OPTION *o, char *hubname, char *username, char *old_pass, char *new_pass); -void PackAddClientVersion(PACK *p, CONNECTION *c); -void NodeInfoToStr(wchar_t *str, UINT size, NODE_INFO *info); -void GenerateMachineUniqueHash(void *data); - -LIST *NewCertList(bool load_root_and_chain); -void FreeCertList(LIST *o); -bool IsXInCertList(LIST *o, X *x); -void AddXToCertList(LIST *o, X *x); -void AddAllRootCertsToCertList(LIST *o); -void AddAllChainCertsToCertList(LIST *o); -X *DownloadCert(char *url); -X *FindCertIssuerFromCertList(LIST *o, X *x); -bool TryGetRootCertChain(LIST *o, X *x, bool auto_save, X **found_root_x); -bool TryGetParentCertFromCertList(LIST *o, X *x, LIST *found_chain); -bool DownloadAndSaveIntermediateCertificatesIfNecessary(X *x); - -#endif // PROTOCOL_H +// SoftEther VPN Source Code - Developer Edition Master Branch +// Cedar Communication Module + + +// Protocol.h +// Header of Protocol.c + +#ifndef PROTOCOL_H +#define PROTOCOL_H + +// The parameters that will be passed to the certificate confirmation thread +struct CHECK_CERT_THREAD_PROC +{ + CONNECTION *Connection; + X *ServerX; + CHECK_CERT_PROC *CheckCertProc; + bool UserSelected; + bool Expired; + bool Ok; +}; + +// The parameters that will be passed to the secure device signature thread +struct SECURE_SIGN_THREAD_PROC +{ + SECURE_SIGN_PROC *SecureSignProc; + CONNECTION *Connection; + SECURE_SIGN *SecureSign; + bool UserFinished; + bool Ok; +}; + +// Signature sending thread parameters +struct SEND_SIGNATURE_PARAM +{ + char Hostname[MAX_PATH]; // Host name + UINT Port; // Port number + BUF *Buffer; // Packet contents +}; + +// Software update client callback +typedef void (UPDATE_NOTIFY_PROC)(UPDATE_CLIENT *c, UINT latest_build, UINT64 latest_date, char *latest_ver, char *url, volatile bool *halt_flag, void *param); +typedef bool (UPDATE_ISFOREGROUND_PROC)(UPDATE_CLIENT *c, void *param); + +// Configure the software update client +struct UPDATE_CLIENT_SETTING +{ + bool DisableCheck; // Disable the update check + UINT LatestIgnoreBuild; // Ignore for earlier or identical to this build number +}; + +// Software update client +struct UPDATE_CLIENT +{ + char FamilyName[MAX_SIZE]; // Product family name + char SoftwareName[MAX_SIZE]; // Software Name + wchar_t SoftwareTitle[MAX_SIZE]; // Software display name + char ClientId[128]; // Client ID + UINT MyBuild; // Build number of myself + UINT64 MyDate; // Build date of myself + char MyLanguage[MAX_SIZE]; // My language + UPDATE_CLIENT_SETTING Setting; // Setting + UINT LatestBuild; // Latest build number that was successfully acquired + volatile bool HaltFlag; // Halting flag + EVENT *HaltEvent; // Halting event + void *Param; // Any parameters + THREAD *Thread; // Thread + UPDATE_NOTIFY_PROC *Callback; // Callback function + UPDATE_ISFOREGROUND_PROC *IsForegroundCb; // Callback function for retrieving whether foreground +}; + +//// Constant related to updating of the software + +// Family +#define UPDATE_FAMILY_NAME _SS("PRODUCT_FAMILY_NAME") + +// Software update server certificate hash +#define UPDATE_SERVER_CERT_HASH DDNS_CERT_HASH + +// URL +#define UPDATE_SERVER_URL_GLOBAL "https://update-check.softether-network.net/update/update.aspx?family=%s&software=%s&mybuild=%u&lang=%s" +#define UPDATE_SERVER_URL_CHINA "https://update-check.uxcom.jp/update/update.aspx?family=%s&software=%s&mybuild=%u&lang=%s" + +// Update check interval +#define UPDATE_CHECK_INTERVAL_MIN (12 * 3600 * 1000) +#define UPDATE_CHECK_INTERVAL_MAX (24 * 7200 * 1000) + +// Connection parameters +#define UPDATE_CONNECT_TIMEOUT 5000 +#define UPDATE_COMM_TIMEOUT 5000 + +// Dynamic root cert fetch function +#define CERT_HTTP_DOWNLOAD_MAXSIZE 65536 +#define CERT_HTTP_DOWNLOAD_TIMEOUT (10 * 1000) +#define ROOT_CERTS_FILENAME "|root_certs.dat" +#define AUTO_DOWNLOAD_CERTS_PREFIX L".autodownload_" +#define FIND_CERT_CHAIN_MAX_DEPTH 16 + +#define PROTO_SUPPRESS_CLIENT_UPDATE_NOTIFICATION_REGKEY "Software\\" GC_REG_COMPANY_NAME "\\" CEDAR_PRODUCT_STR " VPN\\Client Update Notification" +#define PROTO_SUPPRESS_CLIENT_UPDATE_NOTIFICATION_REGVALUE "Suppress" + +// Function prototype +UPDATE_CLIENT *NewUpdateClient(UPDATE_NOTIFY_PROC *cb, UPDATE_ISFOREGROUND_PROC *isforeground_cb, void *param, char *family_name, char *software_name, wchar_t *software_title, UINT my_build, UINT64 my_date, char *my_lang, UPDATE_CLIENT_SETTING *current_setting, char *client_id); +void FreeUpdateClient(UPDATE_CLIENT *c); +void UpdateClientThreadProc(THREAD *thread, void *param); +void UpdateClientThreadMain(UPDATE_CLIENT *c); +void UpdateClientThreadProcessResults(UPDATE_CLIENT *c, BUF *b); +void SetUpdateClientSetting(UPDATE_CLIENT *c, UPDATE_CLIENT_SETTING *s); +UINT64 ShortStrToDate64(char *str); + + +bool ServerAccept(CONNECTION *c); +bool ClientConnect(CONNECTION *c); +SOCK *ClientConnectToServer(CONNECTION *c); +SOCK *TcpIpConnectEx(char *hostname, UINT port, bool *cancel_flag, void *hWnd, UINT *nat_t_error_code, bool no_nat_t, bool try_start_ssl, IP *ret_ip); +bool ClientUploadSignature(SOCK *s); +bool ClientDownloadHello(CONNECTION *c, SOCK *s); +bool ServerDownloadSignature(CONNECTION *c, char **error_detail_str); +bool ServerUploadHello(CONNECTION *c); +bool ClientUploadAuth(CONNECTION *c); +SOCK *ClientConnectGetSocket(CONNECTION *c, bool additional_connect); +SOCK *TcpConnectEx3(char *hostname, UINT port, UINT timeout, bool *cancel_flag, void *hWnd, bool no_nat_t, UINT *nat_t_error_code, bool try_start_ssl, IP *ret_ip); + +UINT ProxyCodeToCedar(UINT code); + +void InitProtocol(); +void FreeProtocol(); + +POLICY *PackGetPolicy(PACK *p); +void PackAddPolicy(PACK *p, POLICY *y); +PACK *PackWelcome(SESSION *s); +PACK *PackHello(void *random, UINT ver, UINT build, char *server_str); +bool GetHello(PACK *p, void *random, UINT *ver, UINT *build, char *server_str, UINT server_str_size); +PACK *PackLoginWithAnonymous(char *hubname, char *username); +PACK *PackLoginWithPassword(char *hubname, char *username, void *secure_password); +PACK *PackLoginWithPlainPassword(char *hubname, char *username, void *plain_password); +PACK *PackLoginWithCert(char *hubname, char *username, X *x, void *sign, UINT sign_size); +PACK *PackLoginWithOpenVPNCertificate(char *hubname, char *username, X *x); +bool GetMethodFromPack(PACK *p, char *method, UINT size); +bool GetHubnameAndUsernameFromPack(PACK *p, char *username, UINT username_size, + char *hubname, UINT hubname_size); +PACK *PackAdditionalConnect(UCHAR *session_key); +UINT GetAuthTypeFromPack(PACK *p); +UINT GetProtocolFromPack(PACK *p); +bool ParseWelcomeFromPack(PACK *p, char *session_name, UINT session_name_size, + char *connection_name, UINT connection_name_size, + POLICY **policy); + + +bool ClientAdditionalConnect(CONNECTION *c, THREAD *t); +SOCK *ClientAdditionalConnectToServer(CONNECTION *c); +bool ClientUploadAuth2(CONNECTION *c, SOCK *s); +bool GetSessionKeyFromPack(PACK *p, UCHAR *session_key, UINT *session_key_32); + +void CreateNodeInfo(NODE_INFO *info, CONNECTION *c); +UINT SecureSign(SECURE_SIGN *sign, UINT device_id, char *pin); +void ClientUploadNoop(CONNECTION *c); +bool ClientCheckServerCert(CONNECTION *c, bool *expired); +void ClientCheckServerCertThread(THREAD *thread, void *param); +bool ClientSecureSign(CONNECTION *c, UCHAR *sign, UCHAR *random, X **x); +void ClientSecureSignThread(THREAD *thread, void *param); +TOKEN_LIST *EnumHub(SESSION *s); +UINT ChangePasswordAccept(CONNECTION *c, PACK *p); +UINT ChangePassword(CEDAR *cedar, CLIENT_OPTION *o, char *hubname, char *username, char *old_pass, char *new_pass); +void PackAddClientVersion(PACK *p, CONNECTION *c); +void NodeInfoToStr(wchar_t *str, UINT size, NODE_INFO *info); +void GenerateMachineUniqueHash(void *data); + +LIST *NewCertList(bool load_root_and_chain); +void FreeCertList(LIST *o); +bool IsXInCertList(LIST *o, X *x); +void AddXToCertList(LIST *o, X *x); +void AddAllRootCertsToCertList(LIST *o); +void AddAllChainCertsToCertList(LIST *o); +X *DownloadCert(char *url); +X *FindCertIssuerFromCertList(LIST *o, X *x); +bool TryGetRootCertChain(LIST *o, X *x, bool auto_save, X **found_root_x); +bool TryGetParentCertFromCertList(LIST *o, X *x, LIST *found_chain); +bool DownloadAndSaveIntermediateCertificatesIfNecessary(X *x); + +#endif // PROTOCOL_H diff --git a/src/Cedar/Radius.c b/src/Cedar/Radius.c index 58c4edbf..9b210f07 100644 --- a/src/Cedar/Radius.c +++ b/src/Cedar/Radius.c @@ -1,2360 +1,2360 @@ -// SoftEther VPN Source Code - Developer Edition Master Branch -// Cedar Communication Module - - -// Radius.c -// Radius authentication module - -#include "CedarPch.h" - -////////// Modern implementation - - -// send PEAP-MSCHAPv2 auth client response -bool PeapClientSendMsChapv2AuthClientResponse(EAP_CLIENT *e, UCHAR *client_response, UCHAR *client_challenge) -{ - bool ret = false; - EAP_MSCHAPV2_RESPONSE msg1; - EAP_MESSAGE msg2; - EAP_MESSAGE msg4; - if (e == NULL || client_response == NULL || client_challenge == NULL) - { - return false; - } - - Zero(&msg1, sizeof(msg1)); - Zero(&msg2, sizeof(msg2)); - Zero(&msg4, sizeof(msg4)); - - msg1.Type = EAP_TYPE_MS_AUTH; - msg1.Chap_Opcode = EAP_MSCHAPV2_OP_RESPONSE; - msg1.Chap_Id = e->MsChapV2Challenge.Chap_Id; - msg1.Chap_Len = Endian16(54 + StrLen(e->Username)); - msg1.Chap_ValueSize = 49; - Copy(msg1.Chap_PeerChallenge, client_challenge, 16); - Copy(msg1.Chap_NtResponse, client_response, 24); - Copy(msg1.Chap_Name, e->Username, MIN(StrLen(e->Username), 255)); - - if (SendPeapPacket(e, &msg1, 59 + StrLen(e->Username)) && - GetRecvPeapMessage(e, &msg2)) - { - if (msg2.Type == EAP_TYPE_MS_AUTH && - ((EAP_MSCHAPV2_GENERAL *)&msg2)->Chap_Opcode == EAP_MSCHAPV2_OP_SUCCESS) - { - EAP_MSCHAPV2_SUCCESS_SERVER *eaps = (EAP_MSCHAPV2_SUCCESS_SERVER *)&msg2; - - if (StartWith(eaps->Message, "S=")) - { - BUF *buf = StrToBin(eaps->Message + 2); - - if (buf && buf->Size == 20) - { - Copy(&e->MsChapV2Success, eaps, sizeof(EAP_MSCHAPV2_SUCCESS_SERVER)); - Copy(e->ServerResponse, buf->Buf, 20); - - if (true) - { - EAP_MSCHAPV2_SUCCESS_CLIENT msg3; - - Zero(&msg3, sizeof(msg3)); - msg3.Type = EAP_TYPE_MS_AUTH; - msg3.Chap_Opcode = EAP_MSCHAPV2_OP_SUCCESS; - - if (SendPeapPacket(e, &msg3, 6) && GetRecvPeapMessage(e, &msg4)) - { - UCHAR *rd = ((UCHAR *)&msg4); - if (rd[4] == 0x01 && rd[8] == 0x21 && rd[9] == 0x80 && - rd[10] == 0x03 && rd[11] == 0x00 && rd[12] == 0x02 && - rd[13] == 0x00 && rd[14] == 0x01) - { - UCHAR reply[15]; - Zero(reply, sizeof(reply)); - reply[4] = 0x02; reply[5] = rd[5]; reply[6] = 0x00; reply[7] = 0x0b; - reply[8] = 0x21; reply[9] = 0x80; reply[10] = 0x03; reply[11] = 0x00; - reply[12] = 0x02; reply[13] = 0x00; reply[14] = 0x01; - if (SendPeapPacket(e, reply, sizeof(reply))) - { - if (e->RecvLastCode == RADIUS_CODE_ACCESS_ACCEPT) - { - ret = true; - } - } - } - } - } - } - - FreeBuf(buf); - } - } - } - - return ret; -} - -// send PEAP-MSCHAPv2 auth request -bool PeapClientSendMsChapv2AuthRequest(EAP_CLIENT *eap) -{ - bool ret = false; - UINT num_retry = 0; - if (eap == NULL) - { - return false; - } - - if (StartPeapClient(eap)) - { - if (StartPeapSslClient(eap)) - { - EAP_MESSAGE recv_msg; - EAP_MESSAGE send_msg; - - if (GetRecvPeapMessage(eap, &recv_msg) && recv_msg.Type == EAP_TYPE_IDENTITY) - { -LABEL_RETRY: - num_retry++; - if (num_retry >= 10) - { - return false; - } - Zero(&send_msg, sizeof(send_msg)); - send_msg.Type = EAP_TYPE_IDENTITY; - send_msg.Len = Endian16(5 + StrLen(eap->Username)); - Copy(send_msg.Data, eap->Username, StrLen(eap->Username)); - - if (SendPeapPacket(eap, &send_msg, 5 + StrLen(eap->Username)) && - GetRecvPeapMessage(eap, &recv_msg)) - { -LABEL_RETRY2: - num_retry++; - if (num_retry >= 10) - { - return false; - } - if (recv_msg.Type == EAP_TYPE_MS_AUTH && - ((EAP_MSCHAPV2_GENERAL *)&recv_msg)->Chap_Opcode == EAP_MSCHAPV2_OP_CHALLENGE) - { - EAP_MSCHAPV2_CHALLENGE *svr_challenge = (EAP_MSCHAPV2_CHALLENGE *)&recv_msg; - - Copy(&eap->MsChapV2Challenge, svr_challenge, sizeof(EAP_MSCHAPV2_CHALLENGE)); - - ret = true; - - eap->PeapMode = true; - } - else if (recv_msg.Type == EAP_TYPE_IDENTITY) - { - UCHAR *rd = ((UCHAR *)&recv_msg); - if (rd[4] == 0x01 && rd[8] == 0x21 && rd[9] == 0x80 && - rd[10] == 0x03 && rd[11] == 0x00 && rd[12] == 0x02 && - rd[13] == 0x00) - { - if (rd[14] == 0x02) - { - // Fail - return false; - } - } - - goto LABEL_RETRY; - } - else - { - EAP_MESSAGE nak; - - Zero(&nak, sizeof(nak)); - nak.Type = EAP_TYPE_LEGACY_NAK; - nak.Data[0] = EAP_TYPE_MS_AUTH; - - if (SendPeapPacket(eap, &nak, 6) && - GetRecvPeapMessage(eap, &recv_msg)) - { - goto LABEL_RETRY2; - } - } - } - } - } - } - return ret; -} - -// Send a PEAP packet (encrypted) -bool SendPeapRawPacket(EAP_CLIENT *e, UCHAR *peap_data, UINT peap_size) -{ - LIST *fragments = NULL; - bool ret = false; - BUF *buf = NULL; - UINT i; - UINT num; - bool send_empty = false; - bool include_len = false; - if (e == NULL) - { - return false; - } - - // divide into 1024 bytes - buf = NewBuf(); - - // size - if ((peap_size + 6 + 2) >= 256) - { - WriteBufInt(buf, peap_size); - include_len = true; - } - - // data - WriteBuf(buf, peap_data, peap_size); - - if (peap_data == NULL) - { - send_empty = true; - } - - SeekBufToBegin(buf); - - fragments = NewListFast(NULL); - for (num = 0;;num++) - { - UCHAR tmp[200]; - EAP_PEAP *send_peap_message; - UINT sz; - - sz = ReadBuf(buf, tmp, sizeof(tmp)); - - if (sz == 0) - { - break; - } - - // add header - send_peap_message = ZeroMalloc(sizeof(EAP_PEAP) + sz); - send_peap_message->Code = EAP_CODE_RESPONSE; - send_peap_message->Id = e->LastRecvEapId + num; - send_peap_message->Len = Endian16((UINT)(((UINT)sizeof(EAP_PEAP) + (UINT)sz))); - send_peap_message->Type = EAP_TYPE_PEAP; - send_peap_message->TlsFlags = 0; - - if (num == 0 && include_len) - { - send_peap_message->TlsFlags |= EAP_TLS_FLAGS_LEN; - } - if (ReadBufRemainSize(buf) != 0) - { - send_peap_message->TlsFlags |= EAP_TLS_FLAGS_MORE_FRAGMENTS; - } - - Copy(((UCHAR *)send_peap_message) + sizeof(EAP_PEAP), tmp, sz); - - Add(fragments, MemToBuf(send_peap_message, sizeof(EAP_PEAP) + sz)); - - Free(send_peap_message); - } - - if (num == 0 && send_empty) - { - Add(fragments, MemToBuf("\0", 1)); - } - - // send each of packets - for (i = 0;i < LIST_NUM(fragments);i++) - { - BUF *b = LIST_DATA(fragments, i); - RADIUS_AVP *eap_avp; - RADIUS_PACKET *response_packet; - - RADIUS_PACKET *send_packet = NewRadiusPacket(RADIUS_CODE_ACCESS_REQUEST, e->NextRadiusPacketId++); - EapSetRadiusGeneralAttributes(send_packet, e); - - if (e->LastStateSize != 0) - { - Add(send_packet->AvpList, NewRadiusAvp(RADIUS_ATTRIBUTE_STATE, 0, 0, - e->LastState, e->LastStateSize)); - } - - if (send_empty == false) - { - eap_avp = NewRadiusAvp(RADIUS_ATTRIBUTE_EAP_MESSAGE, 0, 0, b->Buf, b->Size); - } - else - { - EAP_PEAP empty_peap; - - Zero(&empty_peap, sizeof(empty_peap)); - empty_peap.Code = EAP_CODE_RESPONSE; - empty_peap.Id = e->LastRecvEapId; - empty_peap.Len = Endian16(sizeof(EAP_PEAP)); - empty_peap.Type = EAP_TYPE_PEAP; - - eap_avp = NewRadiusAvp(RADIUS_ATTRIBUTE_EAP_MESSAGE, 0, 0, &empty_peap, sizeof(EAP_PEAP)); - } - - Add(send_packet->AvpList, eap_avp); - - response_packet = EapSendPacketAndRecvResponse(e, send_packet); - - if (response_packet != NULL) - { - e->RecvLastCode = response_packet->Code; - - if (response_packet->Parse_EapMessage != NULL && response_packet->Parse_EapMessage_DataSize >= sizeof(EAP_PEAP)) - { - // Received SSL stream - EAP_PEAP *peap_msg = (EAP_PEAP *)response_packet->Parse_EapMessage; - - if (peap_msg->Type == EAP_TYPE_PEAP) - { - if (peap_msg->TlsFlags & EAP_TLS_FLAGS_LEN) - { - UINT total_size = READ_UINT(((UCHAR *)peap_msg) + sizeof(EAP_PEAP)); - - if (total_size <= (response_packet->Parse_EapMessage_DataSize - sizeof(EAP_PEAP) - sizeof(UINT))) - { - WriteFifo(e->SslPipe->RawIn->SendFifo, ((UCHAR *)peap_msg) + sizeof(EAP_PEAP) + sizeof(UINT), total_size); - } - } - else - { - WriteFifo(e->SslPipe->RawIn->SendFifo, ((UCHAR *)peap_msg) + sizeof(EAP_PEAP), - response_packet->Parse_EapMessage_DataSize - sizeof(EAP_PEAP)); - } - } - } - } - - FreeRadiusPacket(send_packet); - FreeRadiusPacket(response_packet); - } - - FreeBuf(buf); - - if (fragments != NULL) - { - for (i = 0;i < LIST_NUM(fragments);i++) - { - BUF *b = LIST_DATA(fragments, i); - - FreeBuf(b); - } - - ReleaseList(fragments); - } - - SyncSslPipe(e->SslPipe); - - return ret; -} - -// Send an encrypted message of PEAP -bool SendPeapPacket(EAP_CLIENT *e, void *msg, UINT msg_size) -{ - bool ret = false; - FIFO *send_fifo; - FIFO *recv_fifo; - BUF *buf; - EAP_MESSAGE tmpmsg; - if (e == NULL || msg == NULL || msg_size == 0) - { - return false; - } - if (e->SslPipe == NULL) - { - return false; - } - - send_fifo = e->SslPipe->RawOut->RecvFifo; - recv_fifo = e->SslPipe->RawIn->SendFifo; - - Zero(&tmpmsg, sizeof(tmpmsg)); - Copy(&tmpmsg, msg, MIN(msg_size, sizeof(EAP_MESSAGE))); - - WriteFifo(e->SslPipe->SslInOut->SendFifo, &tmpmsg.Type, msg_size - 4); - - SyncSslPipe(e->SslPipe); - - buf = ReadFifoAll(send_fifo); - - while (true) - { - ret = SendPeapRawPacket(e, buf->Buf, buf->Size); - FreeBuf(buf); - - if (send_fifo->size == 0) - { - break; - } - - buf = ReadFifoAll(send_fifo); - } - - return !e->SslPipe->IsDisconnected; -} - -// Start a PEAP SSL client -bool StartPeapSslClient(EAP_CLIENT *e) -{ - bool ret = false; - FIFO *send_fifo; - FIFO *recv_fifo; - BUF *buf; - if (e == NULL) - { - return false; - } - if (e->SslPipe != NULL) - { - return false; - } - - e->SslPipe = NewSslPipe(false, NULL, NULL, NULL); - send_fifo = e->SslPipe->RawOut->RecvFifo; - recv_fifo = e->SslPipe->RawIn->SendFifo; - - SyncSslPipe(e->SslPipe); - - buf = ReadFifoAll(send_fifo); - - while (true) - { - ret = SendPeapRawPacket(e, buf->Buf, buf->Size); - FreeBuf(buf); - - if (send_fifo->size == 0) - { - break; - } - - buf = ReadFifoAll(send_fifo); - } - - SendPeapRawPacket(e, NULL, 0); - - return !e->SslPipe->IsDisconnected; -} - -// Get a received PEAP message (unencrypted) -bool GetRecvPeapMessage(EAP_CLIENT *e, EAP_MESSAGE *msg) -{ - BUF *b; - bool ret = false; - if (e == NULL) - { - return false; - } - if (e->SslPipe == NULL) - { - return false; - } - - b = ReadFifoAll(e->SslPipe->SslInOut->RecvFifo); - - if (b->Size >= 1) - { - Zero(msg, sizeof(EAP_MESSAGE)); - - msg->Len = Endian16(b->Size + 4); - Copy(&msg->Type, b->Buf, MIN(b->Size, 1501)); - - ret = true; - } - - FreeBuf(b); - - return ret; -} - -// Start a PEAP client -bool StartPeapClient(EAP_CLIENT *e) -{ - bool ret = false; - RADIUS_PACKET *request1 = NULL; - RADIUS_PACKET *response1 = NULL; - RADIUS_PACKET *request2 = NULL; - RADIUS_PACKET *response2 = NULL; - EAP_MESSAGE *eap1 = NULL; - EAP_MESSAGE *eap2 = NULL; - if (e == NULL) - { - return false; - } - if (e->SslPipe != NULL) - { - return false; - } - - request1 = NewRadiusPacket(RADIUS_CODE_ACCESS_REQUEST, e->NextRadiusPacketId++); - EapSetRadiusGeneralAttributes(request1, e); - - eap1 = ZeroMalloc(sizeof(EAP_MESSAGE)); - eap1->Code = EAP_CODE_RESPONSE; - eap1->Id = e->LastRecvEapId; - eap1->Len = Endian16(StrLen(e->Username) + 5); - eap1->Type = EAP_TYPE_IDENTITY; - Copy(eap1->Data, e->Username, StrLen(e->Username)); - Add(request1->AvpList, NewRadiusAvp(RADIUS_ATTRIBUTE_EAP_MESSAGE, 0, 0, eap1, StrLen(e->Username) + 5)); - - response1 = EapSendPacketAndRecvResponse(e, request1); - - if (response1 != NULL) - { - if (response1->Parse_EapMessage_DataSize != 0 && response1->Parse_EapMessage != NULL) - { - EAP_MESSAGE *eap = response1->Parse_EapMessage; - if (eap->Code == EAP_CODE_REQUEST) - { - if (eap->Type != EAP_TYPE_PEAP) - { - // Unsupported auth type. Request PEAP. - request2 = NewRadiusPacket(RADIUS_CODE_ACCESS_REQUEST, e->NextRadiusPacketId++); - EapSetRadiusGeneralAttributes(request2, e); - - if (response1->Parse_StateSize != 0) - { - Add(request2->AvpList, NewRadiusAvp(RADIUS_ATTRIBUTE_STATE, 0, 0, - response1->Parse_State, response1->Parse_StateSize)); - } - - eap2 = ZeroMalloc(sizeof(EAP_MESSAGE)); - eap2->Code = EAP_CODE_RESPONSE; - eap2->Id = e->LastRecvEapId; - eap2->Len = Endian16(6); - eap2->Type = EAP_TYPE_LEGACY_NAK; - eap2->Data[0] = EAP_TYPE_PEAP; - - Add(request2->AvpList, NewRadiusAvp(RADIUS_ATTRIBUTE_EAP_MESSAGE, 0, 0, eap2, 6)); - - response2 = EapSendPacketAndRecvResponse(e, request2); - - if (response2 != NULL && response2->Parse_EapMessage_DataSize != 0 && response2->Parse_EapMessage != NULL) - { - eap = response2->Parse_EapMessage; - - if (eap->Code == EAP_CODE_REQUEST && eap->Type == EAP_TYPE_PEAP) - { - goto LABEL_PARSE_PEAP; - } - } - } - else - { - EAP_PEAP *peap; -LABEL_PARSE_PEAP: - peap = (EAP_PEAP *)eap; - - if (peap->TlsFlags == 0x20) - { - ret = true; - } - } - } - } - } - - FreeRadiusPacket(request1); - FreeRadiusPacket(request2); - FreeRadiusPacket(response1); - FreeRadiusPacket(response2); - Free(eap1); - Free(eap2); - - return ret; -} - -// Set RADIUS general attributes -void EapSetRadiusGeneralAttributes(RADIUS_PACKET *r, EAP_CLIENT *e) -{ - UINT ui; - char *str; - if (r == NULL || e == NULL) - { - return; - } - - ui = Endian32(2); - Add(r->AvpList, NewRadiusAvp(RADIUS_ATTRIBUTE_SERVICE_TYPE, 0, 0, &ui, sizeof(UINT))); - - ui = Endian32(1); - Add(r->AvpList, NewRadiusAvp(RADIUS_ATTRIBUTE_FRAMED_PROTOCOL, 0, 0, &ui, sizeof(UINT))); - - ui = Endian32(5); - Add(r->AvpList, NewRadiusAvp(RADIUS_ATTRIBUTE_NAS_PORT_TYPE, 0, 0, &ui, sizeof(UINT))); - - if (IsEmptyStr(e->CalledStationStr) == false) - { - Add(r->AvpList, NewRadiusAvp(RADIUS_ATTRIBUTE_CALLED_STATION_ID, 0, 0, e->CalledStationStr, StrLen(e->CalledStationStr))); - } - - Add(r->AvpList, NewRadiusAvp(RADIUS_ATTRIBUTE_CALLING_STATION_ID, 0, 0, e->ClientIpStr, StrLen(e->ClientIpStr))); - - Add(r->AvpList, NewRadiusAvp(RADIUS_ATTRIBUTE_TUNNEL_CLIENT_ENDPOINT, 0, 0, e->ClientIpStr, StrLen(e->ClientIpStr))); - - Add(r->AvpList, NewRadiusAvp(RADIUS_ATTRIBUTE_USER_NAME, 0, 0, e->Username, StrLen(e->Username))); - - Add(r->AvpList, NewRadiusAvp(RADIUS_ATTRIBUTE_NAS_ID, 0, 0, CEDAR_SERVER_STR, StrLen(CEDAR_SERVER_STR))); - - if (IsEmptyStr(e->In_VpnProtocolState) == false) - { - Add(r->AvpList, NewRadiusAvp(RADIUS_ATTRIBUTE_PROXY_STATE, 0, 0, e->In_VpnProtocolState, StrLen(e->In_VpnProtocolState))); - } - - ui = Endian32(2); - Add(r->AvpList, NewRadiusAvp(RADIUS_ATTRIBUTE_VENDOR_SPECIFIC, RADIUS_VENDOR_MICROSOFT, - RADIUS_MS_NETWORK_ACCESS_SERVER_TYPE, &ui, sizeof(UINT))); - - ui = Endian32(RADIUS_VENDOR_MICROSOFT); - Add(r->AvpList, NewRadiusAvp(RADIUS_ATTRIBUTE_VENDOR_SPECIFIC, RADIUS_VENDOR_MICROSOFT, - RADIUS_MS_RAS_VENDOR, &ui, sizeof(UINT))); - - str = "MSRASV5.20"; - Add(r->AvpList, NewRadiusAvp(RADIUS_ATTRIBUTE_VENDOR_SPECIFIC, RADIUS_VENDOR_MICROSOFT, - RADIUS_MS_VERSION, str, StrLen(str))); - - str = "{5DC53D72-9815-4E97-AC91-339BAFEA6C48}"; - Add(r->AvpList, NewRadiusAvp(RADIUS_ATTRIBUTE_VENDOR_SPECIFIC, RADIUS_VENDOR_MICROSOFT, - RADIUS_MS_RAS_CORRELATION, str, StrLen(str))); - - str = "MSRASV5.20"; - Add(r->AvpList, NewRadiusAvp(RADIUS_ATTRIBUTE_VENDOR_SPECIFIC, RADIUS_VENDOR_MICROSOFT, - RADIUS_MS_RAS_CLIENT_VERSION, str, StrLen(str))); - - str = "MSRASV5.20"; - Add(r->AvpList, NewRadiusAvp(RADIUS_ATTRIBUTE_VENDOR_SPECIFIC, RADIUS_VENDOR_MICROSOFT, - RADIUS_MS_RAS_CLIENT_NAME, str, StrLen(str))); -} - -// Send a MSCHAPv2 client auth response1 -bool EapClientSendMsChapv2AuthClientResponse(EAP_CLIENT *e, UCHAR *client_response, UCHAR *client_challenge) -{ - bool ret = false; - RADIUS_PACKET *request1 = NULL; - RADIUS_PACKET *response1 = NULL; - RADIUS_PACKET *request2 = NULL; - RADIUS_PACKET *response2 = NULL; - EAP_MSCHAPV2_RESPONSE *eap1 = NULL; - EAP_MSCHAPV2_SUCCESS_CLIENT *eap2 = NULL; - if (e == NULL || client_response == NULL || client_challenge == NULL) - { - return false; - } - - request1 = NewRadiusPacket(RADIUS_CODE_ACCESS_REQUEST, e->NextRadiusPacketId++); - EapSetRadiusGeneralAttributes(request1, e); - - if (e->LastStateSize != 0) - { - Add(request1->AvpList, NewRadiusAvp(RADIUS_ATTRIBUTE_STATE, 0, 0, - e->LastState, e->LastStateSize)); - } - - eap1 = ZeroMalloc(sizeof(EAP_MSCHAPV2_RESPONSE)); - eap1->Code = EAP_CODE_RESPONSE; - eap1->Id = e->NextEapId++; - eap1->Len = Endian16(59 + StrLen(e->Username)); - eap1->Type = EAP_TYPE_MS_AUTH; - eap1->Chap_Opcode = EAP_MSCHAPV2_OP_RESPONSE; - eap1->Chap_Id = e->MsChapV2Challenge.Chap_Id; - eap1->Chap_Len = Endian16(54 + StrLen(e->Username)); - eap1->Chap_ValueSize = 49; - Copy(eap1->Chap_PeerChallenge, client_challenge, 16); - Copy(eap1->Chap_NtResponse, client_response, 24); - Copy(eap1->Chap_Name, e->Username, MIN(StrLen(e->Username), 255)); - - Add(request1->AvpList, NewRadiusAvp(RADIUS_ATTRIBUTE_EAP_MESSAGE, 0, 0, eap1, StrLen(e->Username) + 59)); - - response1 = EapSendPacketAndRecvResponse(e, request1); - - if (response1 != NULL) - { - if (response1->Parse_EapMessage_DataSize != 0 && response1->Parse_EapMessage != NULL) - { - EAP_MESSAGE *eap = response1->Parse_EapMessage; - if (eap->Code == EAP_CODE_REQUEST) - { - if (eap->Type == EAP_TYPE_MS_AUTH) - { - if (((EAP_MSCHAPV2_GENERAL *)eap)->Chap_Opcode != EAP_MSCHAPV2_OP_SUCCESS) - { - // Auth fail - } - else - { - // Auth ok - EAP_MSCHAPV2_SUCCESS_SERVER *eaps = (EAP_MSCHAPV2_SUCCESS_SERVER *)eap; - - if (StartWith(eaps->Message, "S=")) - { - BUF *buf = StrToBin(eaps->Message + 2); - - if (buf && buf->Size == 20) - { - Copy(&e->MsChapV2Success, eaps, sizeof(EAP_MSCHAPV2_SUCCESS_SERVER)); - Copy(e->ServerResponse, buf->Buf, 20); - - if (true) - { - // Send the final packet - request2 = NewRadiusPacket(RADIUS_CODE_ACCESS_REQUEST, e->NextRadiusPacketId++); - EapSetRadiusGeneralAttributes(request2, e); - - if (e->LastStateSize != 0) - { - Add(request2->AvpList, NewRadiusAvp(RADIUS_ATTRIBUTE_STATE, 0, 0, - e->LastState, e->LastStateSize)); - } - - eap2 = ZeroMalloc(sizeof(EAP_MSCHAPV2_SUCCESS_CLIENT)); - eap2->Code = EAP_CODE_RESPONSE; - eap2->Id = e->NextEapId++; - eap2->Len = Endian16(6); - eap2->Type = EAP_TYPE_MS_AUTH; - eap2->Chap_Opcode = EAP_MSCHAPV2_OP_SUCCESS; - - Add(request2->AvpList, NewRadiusAvp(RADIUS_ATTRIBUTE_EAP_MESSAGE, 0, 0, eap2, 6)); - - response2 = EapSendPacketAndRecvResponse(e, request2); - - if (response2 != NULL) - { - if (response2->Code == RADIUS_CODE_ACCESS_ACCEPT) - { - ret = true; - } - } - } - } - - FreeBuf(buf); - } - } - } - } - } - } - - FreeRadiusPacket(request1); - FreeRadiusPacket(request2); - FreeRadiusPacket(response1); - FreeRadiusPacket(response2); - Free(eap1); - Free(eap2); - - return ret; -} - -// Send a MSCHAPv2 client auth request -bool EapClientSendMsChapv2AuthRequest(EAP_CLIENT *e) -{ - bool ret = false; - RADIUS_PACKET *request1 = NULL; - RADIUS_PACKET *response1 = NULL; - RADIUS_PACKET *request2 = NULL; - RADIUS_PACKET *response2 = NULL; - EAP_MESSAGE *eap1 = NULL; - EAP_MESSAGE *eap2 = NULL; - if (e == NULL) - { - return false; - } - - request1 = NewRadiusPacket(RADIUS_CODE_ACCESS_REQUEST, e->NextRadiusPacketId++); - EapSetRadiusGeneralAttributes(request1, e); - - eap1 = ZeroMalloc(sizeof(EAP_MESSAGE)); - eap1->Code = EAP_CODE_RESPONSE; - eap1->Id = e->NextEapId++; - eap1->Len = Endian16(StrLen(e->Username) + 5); - eap1->Type = EAP_TYPE_IDENTITY; - Copy(eap1->Data, e->Username, StrLen(e->Username)); - Add(request1->AvpList, NewRadiusAvp(RADIUS_ATTRIBUTE_EAP_MESSAGE, 0, 0, eap1, StrLen(e->Username) + 5)); - - response1 = EapSendPacketAndRecvResponse(e, request1); - - if (response1 != NULL) - { - if (response1->Parse_EapMessage_DataSize != 0 && response1->Parse_EapMessage != NULL) - { - EAP_MESSAGE *eap = response1->Parse_EapMessage; - if (eap->Code == EAP_CODE_REQUEST) - { - if (eap->Type != EAP_TYPE_MS_AUTH) - { - // Unsupported auth type. Request MS-CHAP-v2. - request2 = NewRadiusPacket(RADIUS_CODE_ACCESS_REQUEST, e->NextRadiusPacketId++); - EapSetRadiusGeneralAttributes(request2, e); - - if (response1->Parse_StateSize != 0) - { - Add(request2->AvpList, NewRadiusAvp(RADIUS_ATTRIBUTE_STATE, 0, 0, - response1->Parse_State, response1->Parse_StateSize)); - } - - eap2 = ZeroMalloc(sizeof(EAP_MESSAGE)); - eap2->Code = EAP_CODE_RESPONSE; - eap2->Id = e->NextEapId++; - eap2->Len = Endian16(6); - eap2->Type = EAP_TYPE_LEGACY_NAK; - eap2->Data[0] = EAP_TYPE_MS_AUTH; - - Add(request2->AvpList, NewRadiusAvp(RADIUS_ATTRIBUTE_EAP_MESSAGE, 0, 0, eap2, 6)); - - response2 = EapSendPacketAndRecvResponse(e, request2); - - if (response2 != NULL && response2->Parse_EapMessage_DataSize != 0 && response2->Parse_EapMessage != NULL) - { - eap = response2->Parse_EapMessage; - - if (eap->Code == EAP_CODE_REQUEST && eap->Type == EAP_TYPE_MS_AUTH) - { - goto LABEL_PARSE_EAP; - } - } - } - else - { - EAP_MSCHAPV2_GENERAL *ms_g; -LABEL_PARSE_EAP: - ms_g = (EAP_MSCHAPV2_GENERAL *)eap; - - if (ms_g->Chap_Opcode == EAP_MSCHAPV2_OP_CHALLENGE) - { - EAP_MSCHAPV2_CHALLENGE *ms_c = (EAP_MSCHAPV2_CHALLENGE *)eap; - if (ms_c->Chap_ValueSize == 16) - { - Copy(&e->MsChapV2Challenge, ms_c, sizeof(EAP_MSCHAPV2_CHALLENGE)); - - ret = true; - } - } - } - } - } - } - - FreeRadiusPacket(request1); - FreeRadiusPacket(request2); - FreeRadiusPacket(response1); - FreeRadiusPacket(response2); - Free(eap1); - Free(eap2); - - return ret; -} - -// Send a packet and recv a response -RADIUS_PACKET *EapSendPacketAndRecvResponse(EAP_CLIENT *e, RADIUS_PACKET *r) -{ - SOCKSET set; - UINT64 giveup_tick = 0; - UINT64 next_send_tick = 0; - bool select_inited = false; - bool free_r = false; - RADIUS_PACKET *ret = NULL; - if (e == NULL || r == NULL) - { - return NULL; - } - - ClearBuf(e->PEAP_CurrentReceivingMsg); - e->PEAP_CurrentReceivingTotalSize = 0; - - InitSockSet(&set); - AddSockSet(&set, e->UdpSock); - - while (true) - { - UINT64 now = Tick64(); - UINT wait_time = INFINITE; - bool is_finish = false; - - if (giveup_tick == 0) - { - giveup_tick = now + (UINT64)e->GiveupTimeout; - } - - if (giveup_tick <= now) - { - break; - } - - if (select_inited) - { - UINT num_error = 0; - - while (true) - { - IP from_ip; - UINT from_port; - UINT size; - UCHAR *tmp = e->TmpBuffer; - - size = RecvFrom(e->UdpSock, &from_ip, &from_port, tmp, sizeof(e->TmpBuffer)); - if (size == 0 && e->UdpSock->IgnoreRecvErr == false) - { - // UDP socket error - is_finish = true; - break; - } - else if (size == SOCK_LATER) - { - break; - } - if (size == 0 && e->UdpSock->IgnoreRecvErr) - { - num_error++; - if (num_error >= 100) - { - is_finish = true; - break; - } - } - - // Receive a response packet - if (size != SOCK_LATER && size >= 1) - { - if (CmpIpAddr(&from_ip, &e->ServerIp) == 0 && from_port == e->ServerPort) - { - RADIUS_PACKET *rp = ParseRadiusPacket(tmp, size); - if (rp != NULL) - { - RADIUS_AVP *eap_msg = GetRadiusAvp(rp, RADIUS_ATTRIBUTE_EAP_MESSAGE); - RADIUS_AVP *vlan_avp = GetRadiusAvp(rp, RADIUS_ATTRIBUTE_VLAN_ID); - RADIUS_AVP *framed_interface_id_avp = GetRadiusAvp(rp, RADIUS_ATTRIBUTE_FRAMED_INTERFACE_ID); - if (eap_msg != NULL) - { - e->LastRecvEapId = ((EAP_MESSAGE *)(eap_msg->Data))->Id; - } - - if (framed_interface_id_avp != NULL) - { - // FRAMED_INTERFACE_ID - char tmp_str[64]; - UCHAR mac_address[6]; - - Zero(tmp_str, sizeof(tmp_str)); - Copy(tmp_str, framed_interface_id_avp->Data, MIN(framed_interface_id_avp->DataSize, sizeof(tmp_str) - 1)); - - if (StrToMac(mac_address, tmp_str)) - { - Copy(e->LastRecvVirtualMacAddress, mac_address, 6); - } - } - - if (vlan_avp != NULL) - { - // VLAN ID - UINT vlan_id = 0; - char tmp[32]; - - Zero(tmp, sizeof(tmp)); - - Copy(tmp, vlan_avp->Data, MIN(vlan_avp->DataSize, sizeof(tmp) - 1)); - - vlan_id = ToInt(tmp); - - e->LastRecvVLanId = vlan_id; - } - - // Validate the received packet - if (rp->Parse_EapAuthMessagePos != 0 && rp->Parse_AuthenticatorPos != 0) - { - UCHAR *tmp_buffer = Clone(tmp, size); - UCHAR auth1[16]; - UCHAR auth2[16]; - - Copy(auth1, &tmp_buffer[rp->Parse_EapAuthMessagePos], 16); - - Zero(&tmp_buffer[rp->Parse_EapAuthMessagePos], 16); - Copy(&tmp_buffer[rp->Parse_AuthenticatorPos], r->Authenticator, 16); - - HMacMd5(auth2, e->SharedSecret, StrLen(e->SharedSecret), - tmp_buffer, size); - - if (Cmp(auth1, auth2, 16) == 0) - { - bool send_ack_packet = false; - - // ok - Copy(e->LastState, rp->Parse_State, rp->Parse_StateSize); - e->LastStateSize = rp->Parse_StateSize; - - if (rp->Parse_EapMessage_DataSize != 0 && rp->Parse_EapMessage != NULL) - { - EAP_MESSAGE *eap_msg = (EAP_MESSAGE *)rp->Parse_EapMessage; - - if (eap_msg->Type == EAP_TYPE_PEAP) - { - EAP_PEAP *peap_message = (EAP_PEAP *)eap_msg; - - if (peap_message->TlsFlags & EAP_TLS_FLAGS_MORE_FRAGMENTS || e->PEAP_CurrentReceivingTotalSize != 0) - { - // more fragments: reply ack - RADIUS_PACKET *ack_packet = NewRadiusPacket(RADIUS_CODE_ACCESS_REQUEST, e->NextRadiusPacketId++); - EAP_PEAP *ack_msg = ZeroMalloc(sizeof(EAP_PEAP)); - - EapSetRadiusGeneralAttributes(ack_packet, e); - if (e->LastStateSize != 0) - { - Add(ack_packet->AvpList, NewRadiusAvp(RADIUS_ATTRIBUTE_STATE, 0, 0, - e->LastState, e->LastStateSize)); - } - - ack_msg->Code = EAP_CODE_RESPONSE; - ack_msg->Id = e->LastRecvEapId; - ack_msg->Len = Endian16(6); - ack_msg->Type = EAP_TYPE_PEAP; - ack_msg->TlsFlags = 0; - - Add(ack_packet->AvpList, NewRadiusAvp(RADIUS_ATTRIBUTE_EAP_MESSAGE, 0, 0, - ack_msg, sizeof(EAP_PEAP))); - - next_send_tick = 0; - - if (free_r) - { - FreeRadiusPacket(r); - } - - r = ack_packet; - free_r = true; - - Free(ack_msg); - - send_ack_packet = true; - - if (e->PEAP_CurrentReceivingTotalSize == 0) - { - if (peap_message->TlsFlags & EAP_TLS_FLAGS_LEN) - { - if (Endian16(peap_message->Len) >= 9) - { - UINT total_size = READ_UINT(((UCHAR *)peap_message) + sizeof(EAP_PEAP)); - - if (total_size < 65536) - { - if (rp->Parse_EapMessage_DataSize >= 1) - { - e->PEAP_CurrentReceivingTotalSize = total_size; - - WriteBuf(e->PEAP_CurrentReceivingMsg, - ((UCHAR *)peap_message), - rp->Parse_EapMessage_DataSize); - } - } - } - } - } - else - { - if ((!(peap_message->TlsFlags & EAP_TLS_FLAGS_LEN)) && - rp->Parse_EapMessage_DataSize >= sizeof(EAP_PEAP)) - { - WriteBuf(e->PEAP_CurrentReceivingMsg, - ((UCHAR *)peap_message) + sizeof(EAP_PEAP), - rp->Parse_EapMessage_DataSize - sizeof(EAP_PEAP)); - - if (e->PEAP_CurrentReceivingTotalSize <= e->PEAP_CurrentReceivingMsg->Size) - { - // all fragmented segments are arrived - send_ack_packet = false; - - is_finish = true; - - Free(rp->Parse_EapMessage); - rp->Parse_EapMessage = Clone(e->PEAP_CurrentReceivingMsg->Buf, e->PEAP_CurrentReceivingMsg->Size); - rp->Parse_EapMessage_DataSize = e->PEAP_CurrentReceivingMsg->Size; - } - } - } - } - } - } - - if (send_ack_packet == false) - { - ret = rp; - } - } - - Free(tmp_buffer); - } - - if (ret != NULL) - { - is_finish = true; - break; - } - else - { - FreeRadiusPacket(rp); - } - } - } - } - } - } - - if (is_finish) - { - break; - } - - if (next_send_tick == 0 || next_send_tick <= now) - { - next_send_tick = now + (UINT64)e->ResendTimeout; - - if (EapSendPacket(e, r) == false) - { - is_finish = true; - } - } - - wait_time = MIN(wait_time, (UINT)(next_send_tick - now)); - wait_time = MIN(wait_time, (UINT)(giveup_tick - now)); - wait_time = MAX(wait_time, 1); - - if (is_finish) - { - break; - } - - Select(&set, wait_time, NULL, NULL); - select_inited = true; - } - - if (free_r) - { - FreeRadiusPacket(r); - } - - return ret; -} - -// Send a RADIUS packet -bool EapSendPacket(EAP_CLIENT *e, RADIUS_PACKET *r) -{ - BUF *b; - bool ret = false; - if (e == NULL || r == NULL) - { - return false; - } - - b = GenerateRadiusPacket(r, e->SharedSecret); - if (b != NULL) - { - UINT r = SendTo(e->UdpSock, &e->ServerIp, e->ServerPort, b->Buf, b->Size); - if (!(r == 0 && e->UdpSock->IgnoreSendErr == false)) - { - ret = true; - } - - - FreeBuf(b); - } - - return ret; -} - -// New EAP client -EAP_CLIENT *NewEapClient(IP *server_ip, UINT server_port, char *shared_secret, UINT resend_timeout, UINT giveup_timeout, char *client_ip_str, char *username, char *hubname) -{ - EAP_CLIENT *e; - if (server_ip == NULL) - { - return NULL; - } - if (resend_timeout == 0) - { - resend_timeout = RADIUS_RETRY_INTERVAL; - } - if (giveup_timeout == 0) - { - giveup_timeout = RADIUS_RETRY_TIMEOUT; - } - - e = ZeroMalloc(sizeof(EAP_CLIENT)); - - e->Ref = NewRef(); - - e->NextRadiusPacketId = 1; - - e->UdpSock = NewUDPEx(0, IsIP6(server_ip)); - Copy(&e->ServerIp, server_ip, sizeof(IP)); - e->ServerPort = server_port; - e->ResendTimeout = resend_timeout; - e->GiveupTimeout = giveup_timeout; - StrCpy(e->SharedSecret, sizeof(e->SharedSecret), shared_secret); - - StrCpy(e->CalledStationStr, sizeof(e->CalledStationStr), hubname); - StrCpy(e->ClientIpStr, sizeof(e->ClientIpStr), client_ip_str); - StrCpy(e->Username, sizeof(e->Username), username); - e->LastRecvEapId = 0; - - e->PEAP_CurrentReceivingMsg = NewBuf(); - - return e; -} - -// Free a EAP client -void ReleaseEapClient(EAP_CLIENT *e) -{ - if (e == NULL) - { - return; - } - - if (Release(e->Ref) == 0) - { - CleanupEapClient(e); - } -} -void CleanupEapClient(EAP_CLIENT *e) -{ - if (e == NULL) - { - return; - } - - Disconnect(e->UdpSock); - ReleaseSock(e->UdpSock); - - FreeSslPipe(e->SslPipe); - - FreeBuf(e->PEAP_CurrentReceivingMsg); - - Free(e); -} - -// New RADIUS AVP value -RADIUS_AVP *NewRadiusAvp(UCHAR type, UINT vendor_id, UCHAR vendor_code, void *data, UINT size) -{ - RADIUS_AVP *p = ZeroMalloc(sizeof(RADIUS_AVP)); - - p->Type = type; - p->VendorId = vendor_id; - p->VendorCode = vendor_code; - p->DataSize = (UCHAR)size; - Copy(p->Data, data, (UCHAR)size); - - if (size >= 256) - { - Debug("!! size = %u\n", size); - } - - return p; -} - -// New RADIUS packet -RADIUS_PACKET *NewRadiusPacket(UCHAR code, UCHAR packet_id) -{ - RADIUS_PACKET *r = ZeroMalloc(sizeof(RADIUS_PACKET)); - - r->Code = code; - r->PacketId = packet_id; - - r->AvpList = NewListFast(NULL); - - return r; -} - -// Get RADIUS AVP -RADIUS_AVP *GetRadiusAvp(RADIUS_PACKET *p, UCHAR type) -{ - UINT i; - if (p == NULL) - { - return NULL; - } - - for (i = 0;i < LIST_NUM(p->AvpList);i++) - { - RADIUS_AVP *avp = LIST_DATA(p->AvpList, i); - - if (avp->Type == type) - { - return avp; - } - } - - return NULL; -} - -// Free a RADIUS packet -void FreeRadiusPacket(RADIUS_PACKET *p) -{ - UINT i; - if (p == NULL) - { - return; - } - - if (p->AvpList != NULL) - { - for (i = 0;i < LIST_NUM(p->AvpList);i++) - { - RADIUS_AVP *a = LIST_DATA(p->AvpList, i); - - Free(a); - } - - ReleaseList(p->AvpList); - } - - Free(p->Parse_EapMessage); - - Free(p); -} - -// Generate a RADIUS packet -BUF *GenerateRadiusPacket(RADIUS_PACKET *p, char *shared_secret) -{ - BUF *b; - UINT i; - UCHAR zero16[16]; - UINT len_pos = 0; - UINT eap_auth_pos = 0; - bool exist_eap_msg = false; - bool exist_eap_auth = false; - if (p == NULL) - { - return NULL; - } - - Zero(zero16, sizeof(zero16)); - - // Add EAP message auth packet - for (i = 0;i < LIST_NUM(p->AvpList);i++) - { - RADIUS_AVP *a = (RADIUS_AVP *)LIST_DATA(p->AvpList, i); - - if (a->Type == RADIUS_ATTRIBUTE_EAP_MESSAGE) - { - exist_eap_msg = true; - } - if (a->Type == RADIUS_ATTRIBUTE_EAP_AUTHENTICATOR) - { - exist_eap_auth = true; - } - } - - if (exist_eap_msg && exist_eap_auth == false) - { - RADIUS_AVP *a = NewRadiusAvp(RADIUS_ATTRIBUTE_EAP_AUTHENTICATOR, 0, 0, zero16, sizeof(zero16)); - - Add(p->AvpList, a); - } - - if (IsZero(p->Authenticator, 16)) - { - UCHAR rand16[16]; - - Rand(rand16, sizeof(rand16)); - Copy(p->Authenticator, rand16, 16); - } - - b = NewBuf(); - - WriteBufChar(b, p->Code); - WriteBufChar(b, p->PacketId); - len_pos = b->Current; - WriteBufShort(b, 0); - WriteBuf(b, p->Authenticator, 16); - - for (i = 0;i < LIST_NUM(p->AvpList);i++) - { - RADIUS_AVP *a = (RADIUS_AVP *)LIST_DATA(p->AvpList, i); - - WriteBufChar(b, a->Type); - - if (a->Type != RADIUS_ATTRIBUTE_VENDOR_SPECIFIC) - { - WriteBufChar(b, (UCHAR)((UINT)a->DataSize + 2)); - - if (a->Type == RADIUS_ATTRIBUTE_EAP_AUTHENTICATOR) - { - eap_auth_pos = b->Current; - - if (a->DataSize == 16) - { - Zero(a->Data, sizeof(a->Data)); - } - } - - WriteBuf(b, a->Data, a->DataSize); - } - else - { - WriteBufChar(b, (UCHAR)((UINT)a->DataSize + 8)); - WriteBufInt(b, a->VendorId); - WriteBufChar(b, a->VendorCode); - WriteBufChar(b, (UCHAR)((UINT)a->DataSize + 2)); - WriteBuf(b, a->Data, a->DataSize); - } - } - - WRITE_USHORT(((UCHAR *)b->Buf) + len_pos, b->Size); - - if (eap_auth_pos != 0) - { - UCHAR eap_auth[16]; - - HMacMd5(eap_auth, shared_secret, StrLen(shared_secret), b->Buf, b->Size); - - Copy(((UCHAR *)b->Buf) + eap_auth_pos, eap_auth, 16); - } - - SeekBufToBegin(b); - - return b; -} - -// Parse a RADIUS packet -RADIUS_PACKET *ParseRadiusPacket(void *data, UINT size) -{ - RADIUS_PACKET *p = NULL; - BUF *buf = NULL; - USHORT len; - UCHAR auth[16]; - if (data == NULL || size == 0) - { - return NULL; - } - - p = ZeroMalloc(sizeof(RADIUS_PACKET)); - - p->AvpList = NewListFast(NULL); - - buf = MemToBuf(data, size); - - // Code - p->Code = ReadBufChar(buf); - p->PacketId = ReadBufChar(buf); - len = ReadBufShort(buf); - - p->Parse_AuthenticatorPos = buf->Current; - if (ReadBuf(buf, auth, 16) != 16) - { - goto LABEL_ERROR; - } - - if ((UINT)len < 20) - { - goto LABEL_ERROR; - } - if ((UINT)len > buf->Size) - { - goto LABEL_ERROR; - } - else if ((UINT)len < buf->Size) - { - buf->Size = len; - } - - while (true) - { - RADIUS_AVP a; - UCHAR uc; - UINT data_size; - - Zero(&a, sizeof(a)); - - if (ReadBuf(buf, &a.Type, 1) == 0) - { - break; - } - - if (a.Type != RADIUS_ATTRIBUTE_VENDOR_SPECIFIC) - { - if (ReadBuf(buf, &uc, 1) == 0) - { - break; - } - - data_size = (UINT)uc; - - if (data_size < 2) - { - goto LABEL_ERROR; - } - - data_size -= 2; - - a.DataSize = (UCHAR)data_size; - - if (a.Type == RADIUS_ATTRIBUTE_EAP_AUTHENTICATOR && a.DataSize == 16) - { - p->Parse_EapAuthMessagePos = buf->Current; - } - - if (ReadBuf(buf, a.Data, a.DataSize) != a.DataSize) - { - goto LABEL_ERROR; - } - - if (a.Type == RADIUS_ATTRIBUTE_EAP_MESSAGE && a.DataSize >= 5) - { - UINT sz_tmp = Endian16(((EAP_MESSAGE *)a.Data)->Len); - - if (sz_tmp >= 5 && sz_tmp <= a.DataSize) - { - if (p->Parse_EapMessage == NULL) - { - EAP_MESSAGE *eap = Clone(a.Data, a.DataSize); - - p->Parse_EapMessage_DataSize = sz_tmp; - - p->Parse_EapMessage = eap; - } - } - } - } - else - { - if (ReadBuf(buf, &uc, 1) == 0) - { - break; - } - - data_size = (UINT)uc; - if (data_size < 8) - { - goto LABEL_ERROR; - } - - data_size -= 8; - - a.VendorId = ReadBufInt(buf); - a.VendorCode = ReadBufChar(buf); - if (ReadBuf(buf, &uc, 1) == 0) - { - break; - } - - if (((UINT)uc - 2) != data_size) - { - goto LABEL_ERROR; - } - - a.DataSize = (UINT)data_size; - - if (ReadBuf(buf, a.Data, a.DataSize) != a.DataSize) - { - goto LABEL_ERROR; - } - } - - Add(p->AvpList, Clone(&a, sizeof(RADIUS_AVP))); - } - - FreeBuf(buf); - - if (true) - { - UINT num, i; - RADIUS_AVP *avp = GetRadiusAvp(p, RADIUS_ATTRIBUTE_STATE); - - if (avp != NULL) - { - Copy(p->Parse_State, avp->Data, avp->DataSize); - p->Parse_StateSize = avp->DataSize; - } - - num = 0; - for (i = 0;i < LIST_NUM(p->AvpList);i++) - { - RADIUS_AVP *avp = LIST_DATA(p->AvpList, i); - - if (avp->Type == RADIUS_ATTRIBUTE_EAP_MESSAGE) - { - num++; - } - } - - if (num >= 2) - { - // Reassemble multiple EAP messages - BUF *b = NewBuf(); - - for (i = 0;i < LIST_NUM(p->AvpList);i++) - { - RADIUS_AVP *avp = LIST_DATA(p->AvpList, i); - - if (avp->Type == RADIUS_ATTRIBUTE_EAP_MESSAGE) - { - WriteBuf(b, avp->Data, avp->DataSize); - } - } - - if (Endian16(((EAP_MESSAGE *)b->Buf)->Len) <= b->Size) - { - if (p->Parse_EapMessage != NULL) - { - Free(p->Parse_EapMessage); - } - - p->Parse_EapMessage_DataSize = b->Size; - p->Parse_EapMessage_DataSize = MIN(p->Parse_EapMessage_DataSize, 1500); - p->Parse_EapMessage = Clone(b->Buf, p->Parse_EapMessage_DataSize); - } - - FreeBuf(b); - } - } - - return p; - -LABEL_ERROR: - - FreeRadiusPacket(p); - FreeBuf(buf); - - return NULL; -} - - -////////// Classical implementation - -// Attempts Radius authentication (with specifying retry interval and multiple server) -bool RadiusLogin(CONNECTION *c, char *server, UINT port, UCHAR *secret, UINT secret_size, wchar_t *username, char *password, UINT interval, UCHAR *mschap_v2_server_response_20, - RADIUS_LOGIN_OPTION *opt, char *hubname) -{ - UCHAR random[MD5_SIZE]; - UCHAR id; - BUF *encrypted_password = NULL; - BUF *user_name = NULL; - //IP ip; - bool ret = false; - TOKEN_LIST *token; - UINT i; - LIST *ip_list; - IPC_MSCHAP_V2_AUTHINFO mschap; - bool is_mschap; - char client_ip_str[MAX_SIZE]; - RADIUS_LOGIN_OPTION opt_dummy; - static UINT packet_id = 0; - // Validate arguments - if (server == NULL || port == 0 || (secret_size != 0 && secret == NULL) || username == NULL || password == NULL) - { - return false; - } - - if (opt == NULL) - { - Zero(&opt_dummy, sizeof(opt_dummy)); - - opt = &opt_dummy; - } - - opt->Out_VLanId = 0; - - Zero(client_ip_str, sizeof(client_ip_str)); - if (c != NULL && c->FirstSock != NULL) - { - IPToStr(client_ip_str, sizeof(client_ip_str), &c->FirstSock->RemoteIP); - } - - // Parse the MS-CHAP v2 authentication data - Zero(&mschap, sizeof(mschap)); - is_mschap = ParseAndExtractMsChapV2InfoFromPassword(&mschap, password); - - if (is_mschap && mschap.MsChapV2_EapClient != NULL) - { - // Try the EAP authentication for RADIUS first - EAP_CLIENT *eap = mschap.MsChapV2_EapClient; - - if (IsEmptyStr(opt->In_VpnProtocolState) == false) - { - StrCpy(eap->In_VpnProtocolState, sizeof(eap->In_VpnProtocolState), opt->In_VpnProtocolState); - } - - if (eap->PeapMode == false) - { - ret = EapClientSendMsChapv2AuthClientResponse(eap, mschap.MsChapV2_ClientResponse, - mschap.MsChapV2_ClientChallenge); - } - else - { - ret = PeapClientSendMsChapv2AuthClientResponse(eap, mschap.MsChapV2_ClientResponse, - mschap.MsChapV2_ClientChallenge); - } - - if (ret) - { - Copy(mschap_v2_server_response_20, eap->ServerResponse, 20); - - if (opt->In_CheckVLanId) - { - opt->Out_VLanId = eap->LastRecvVLanId; - } - - Copy(opt->Out_VirtualMacAddress, eap->LastRecvVirtualMacAddress, 6); - - return true; - } - else - { - return false; - } - } - - // Split the server into tokens - token = ParseToken(server, " ,;\t"); - - // Get the IP address of the server - ip_list = NewListFast(NULL); - for(i = 0; i < token->NumTokens; i++) - { - IP *tmp_ip = Malloc(sizeof(IP)); - if (GetIP(tmp_ip, token->Token[i])) - { - Add(ip_list, tmp_ip); - } - else if (GetIPEx(tmp_ip, token->Token[i], true)) - { - Add(ip_list, tmp_ip); - } - else - { - Free(tmp_ip); - } - } - - FreeToken(token); - - if(LIST_NUM(ip_list) == 0) - { - ReleaseList(ip_list); - return false; - } - - // Random number generation - Rand(random, sizeof(random)); - - // ID generation - id = (UCHAR)(packet_id % 254 + 1); - packet_id++; - - if (is_mschap == false) - { - // Encrypt the password - encrypted_password = RadiusEncryptPassword(password, random, secret, secret_size); - if (encrypted_password == NULL) - { - // Encryption failure - - // Release the ip_list - for(i = 0; i < LIST_NUM(ip_list); i++) - { - IP *tmp_ip = LIST_DATA(ip_list, i); - Free(tmp_ip); - } - ReleaseList(ip_list); - return false; - } - } - - // Generate the user name packet - user_name = RadiusCreateUserName(username); - - if (user_name != NULL) - { - // Generate a password packet - BUF *user_password = (is_mschap ? NULL : RadiusCreateUserPassword(encrypted_password->Buf, encrypted_password->Size)); - BUF *nas_id; - - if (IsEmptyStr(opt->NasId)) - { - nas_id = RadiusCreateNasId(CEDAR_SERVER_STR); - } - else - { - nas_id = RadiusCreateNasId(opt->NasId); - } - - if (is_mschap || user_password != NULL) - { - UINT64 start; - UINT64 next_send_time; - UCHAR tmp[MAX_SIZE]; - UINT recv_buf_size = 32768; - UCHAR *recv_buf = MallocEx(recv_buf_size, true); - // Generate an UDP packet - BUF *p = NewBuf(); - UCHAR type = 1; - SOCK *sock; - USHORT sz = 0; - UINT pos = 0; - BOOL *finish = ZeroMallocEx(sizeof(BOOL) * LIST_NUM(ip_list), true); - - Zero(tmp, sizeof(tmp)); - - WriteBuf(p, &type, 1); - WriteBuf(p, &id, 1); - WriteBuf(p, &sz, 2); - WriteBuf(p, random, 16); - WriteBuf(p, user_name->Buf, user_name->Size); - - if (is_mschap == false) - { - UINT ui; - // PAP - WriteBuf(p, user_password->Buf, user_password->Size); - WriteBuf(p, nas_id->Buf, nas_id->Size); - - // Service-Type - ui = Endian32(2); - RadiusAddValue(p, RADIUS_ATTRIBUTE_SERVICE_TYPE, 0, 0, &ui, sizeof(ui)); - - // NAS-Port-Type - ui = Endian32(5); - RadiusAddValue(p, RADIUS_ATTRIBUTE_NAS_PORT_TYPE, 0, 0, &ui, sizeof(ui)); - - // Tunnel-Type - ui = Endian32(1); - RadiusAddValue(p, RADIUS_ATTRIBUTE_TUNNEL_TYPE, 0, 0, &ui, sizeof(ui)); - - // Tunnel-Medium-Type - ui = Endian32(1); - RadiusAddValue(p, RADIUS_ATTRIBUTE_TUNNEL_MEDIUM_TYPE, 0, 0, &ui, sizeof(ui)); - - // Called-Station-ID - VPN Hub Name - if (IsEmptyStr(hubname) == false) - { - RadiusAddValue(p, RADIUS_ATTRIBUTE_CALLED_STATION_ID, 0, 0, hubname, StrLen(hubname)); - } - - // Calling-Station-Id - RadiusAddValue(p, RADIUS_ATTRIBUTE_CALLING_STATION_ID, 0, 0, client_ip_str, StrLen(client_ip_str)); - - // Tunnel-Client-Endpoint - RadiusAddValue(p, RADIUS_ATTRIBUTE_TUNNEL_CLIENT_ENDPOINT, 0, 0, client_ip_str, StrLen(client_ip_str)); - } - else - { - // MS-CHAP v2 - static UINT session_id = 0; - USHORT us; - UINT ui; - char *ms_ras_version = "MSRASV5.20"; - UCHAR ms_chapv2_response[50]; - - // Acct-Session-Id - us = Endian16(session_id % 254 + 1); - session_id++; - RadiusAddValue(p, RADIUS_ATTRIBUTE_ACCT_SESSION_ID, 0, 0, &us, sizeof(us)); - - // NAS-IP-Address - if (c != NULL && c->FirstSock != NULL && c->FirstSock->IPv6 == false) - { - ui = IPToUINT(&c->FirstSock->LocalIP); - RadiusAddValue(p, RADIUS_ATTRIBUTE_NAS_IP, 0, 0, &ui, sizeof(ui)); - } - - // Service-Type - ui = Endian32(2); - RadiusAddValue(p, RADIUS_ATTRIBUTE_SERVICE_TYPE, 0, 0, &ui, sizeof(ui)); - - // MS-RAS-Vendor - ui = Endian32(RADIUS_VENDOR_MICROSOFT); - RadiusAddValue(p, RADIUS_ATTRIBUTE_VENDOR_SPECIFIC, RADIUS_VENDOR_MICROSOFT, RADIUS_MS_RAS_VENDOR, &ui, sizeof(ui)); - - // MS-RAS-Version - RadiusAddValue(p, RADIUS_ATTRIBUTE_VENDOR_SPECIFIC, RADIUS_VENDOR_MICROSOFT, RADIUS_MS_VERSION, ms_ras_version, StrLen(ms_ras_version)); - - // NAS-Port-Type - ui = Endian32(5); - RadiusAddValue(p, RADIUS_ATTRIBUTE_NAS_PORT_TYPE, 0, 0, &ui, sizeof(ui)); - - // Tunnel-Type - ui = Endian32(1); - RadiusAddValue(p, RADIUS_ATTRIBUTE_TUNNEL_TYPE, 0, 0, &ui, sizeof(ui)); - - // Tunnel-Medium-Type - ui = Endian32(1); - RadiusAddValue(p, RADIUS_ATTRIBUTE_TUNNEL_MEDIUM_TYPE, 0, 0, &ui, sizeof(ui)); - - // Called-Station-ID - VPN Hub Name - if (IsEmptyStr(hubname) == false) - { - RadiusAddValue(p, RADIUS_ATTRIBUTE_CALLED_STATION_ID, 0, 0, hubname, StrLen(hubname)); - } - - // Calling-Station-Id - RadiusAddValue(p, RADIUS_ATTRIBUTE_CALLING_STATION_ID, 0, 0, client_ip_str, StrLen(client_ip_str)); - - // Tunnel-Client-Endpoint - RadiusAddValue(p, RADIUS_ATTRIBUTE_TUNNEL_CLIENT_ENDPOINT, 0, 0, client_ip_str, StrLen(client_ip_str)); - - // MS-RAS-Client-Version - RadiusAddValue(p, RADIUS_ATTRIBUTE_VENDOR_SPECIFIC, RADIUS_VENDOR_MICROSOFT, RADIUS_MS_RAS_CLIENT_VERSION, ms_ras_version, StrLen(ms_ras_version)); - - // MS-RAS-Client-Name - RadiusAddValue(p, RADIUS_ATTRIBUTE_VENDOR_SPECIFIC, RADIUS_VENDOR_MICROSOFT, RADIUS_MS_RAS_CLIENT_NAME, client_ip_str, StrLen(client_ip_str)); - - // MS-CHAP-Challenge - RadiusAddValue(p, RADIUS_ATTRIBUTE_VENDOR_SPECIFIC, RADIUS_VENDOR_MICROSOFT, RADIUS_MS_CHAP_CHALLENGE, mschap.MsChapV2_ServerChallenge, sizeof(mschap.MsChapV2_ServerChallenge)); - - // MS-CHAP2-Response - Zero(ms_chapv2_response, sizeof(ms_chapv2_response)); - Copy(ms_chapv2_response + 2, mschap.MsChapV2_ClientChallenge, 16); - Copy(ms_chapv2_response + 2 + 16 + 8, mschap.MsChapV2_ClientResponse, 24); - RadiusAddValue(p, RADIUS_ATTRIBUTE_VENDOR_SPECIFIC, RADIUS_VENDOR_MICROSOFT, RADIUS_MS_CHAP2_RESPONSE, ms_chapv2_response, sizeof(ms_chapv2_response)); - - // NAS-ID - WriteBuf(p, nas_id->Buf, nas_id->Size); - } - - if (IsEmptyStr(opt->In_VpnProtocolState) == false) - { - // Proxy state as protocol details - RadiusAddValue(p, RADIUS_ATTRIBUTE_PROXY_STATE, 0, 0, opt->In_VpnProtocolState, StrLen(opt->In_VpnProtocolState)); - } - - SeekBuf(p, 0, 0); - - WRITE_USHORT(((UCHAR *)p->Buf) + 2, (USHORT)p->Size); - - // Create a socket - sock = NewUDPEx(0, IsIP6(LIST_DATA(ip_list, pos))); - - // Transmission process start - start = Tick64(); - if(interval < RADIUS_RETRY_INTERVAL) - { - interval = RADIUS_RETRY_INTERVAL; - } - else if(interval > RADIUS_RETRY_TIMEOUT) - { - interval = RADIUS_RETRY_TIMEOUT; - } - next_send_time = start + (UINT64)interval; - - while (true) - { - UINT server_port; - UINT recv_size; - //IP server_ip; - SOCKSET set; - UINT64 now; - -SEND_RETRY: - //SendTo(sock, &ip, port, p->Buf, p->Size); - SendTo(sock, LIST_DATA(ip_list, pos), port, p->Buf, p->Size); - - Debug("send to host:%u\n", pos); - - next_send_time = Tick64() + (UINT64)interval; - -RECV_RETRY: - now = Tick64(); - if (next_send_time <= now) - { - // Switch the host to refer - pos++; - pos = pos % LIST_NUM(ip_list); - - goto SEND_RETRY; - } - - if ((start + RADIUS_RETRY_TIMEOUT) < now) - { - // Time-out - break; - } - - InitSockSet(&set); - AddSockSet(&set, sock); - Select(&set, (UINT)(next_send_time - now), NULL, NULL); - - recv_size = RecvFrom(sock, LIST_DATA(ip_list, pos), &server_port, recv_buf, recv_buf_size); - - if (recv_size == 0) - { - Debug("Radius recv_size 0\n"); - finish[pos] = true; - for (i = 0; i < LIST_NUM(ip_list); ++i) - { - if (finish[i] == false) - { - // Switch the host to refer - pos++; - pos = pos % LIST_NUM(ip_list); - goto SEND_RETRY; - } - } - // Failure - break; - } - else if (recv_size == SOCK_LATER) - { - // Waiting - goto RECV_RETRY; - } - else - { - // Check such as the IP address - if (/*Cmp(&server_ip, &ip, sizeof(IP)) != 0 || */server_port != port) - { - goto RECV_RETRY; - } - // Success - if (recv_buf[0] == 2) - { - LIST *o; - BUF *buf = NewBufFromMemory(recv_buf, recv_size); - - ret = true; - - if (is_mschap && mschap_v2_server_response_20 != NULL) - { - // Cutting corners Zurukko - UCHAR signature[] = {0x1A, 0x33, 0x00, 0x00, 0x01, 0x37, 0x1A, 0x2D, 0x00, 0x53, 0x3D, }; - UINT i = SearchBin(recv_buf, 0, recv_buf_size, signature, sizeof(signature)); - - if (i == INFINITE || ((i + sizeof(signature) + 40) > recv_buf_size)) - { - ret = false; - } - else - { - char tmp[MAX_SIZE]; - BUF *b; - - Zero(tmp, sizeof(tmp)); - Copy(tmp, recv_buf + i + sizeof(signature), 40); - - b = StrToBin(tmp); - - if (b != NULL && b->Size == 20) - { - WHERE; - Copy(mschap_v2_server_response_20, b->Buf, 20); - } - else - { - WHERE; - ret = false; - } - - FreeBuf(b); - } - } - - o = RadiusParseOptions(buf); - if (o != NULL) - { - DHCP_OPTION *framed_interface_id_option = GetDhcpOption(o, RADIUS_ATTRIBUTE_FRAMED_INTERFACE_ID); - - if (framed_interface_id_option != NULL) - { - char tmp_str[64]; - UCHAR mac_address[6]; - - Zero(tmp_str, sizeof(tmp_str)); - Copy(tmp_str, framed_interface_id_option->Data, MIN(framed_interface_id_option->Size, sizeof(tmp_str) - 1)); - - if (StrToMac(mac_address, tmp_str)) - { - Copy(opt->Out_VirtualMacAddress, mac_address, 6); - } - } - - if (opt->In_CheckVLanId) - { - DHCP_OPTION *vlan_option = GetDhcpOption(o, RADIUS_ATTRIBUTE_VLAN_ID); - - if (vlan_option != NULL) - { - UINT vlan_id = 0; - char tmp[32]; - - Zero(tmp, sizeof(tmp)); - - Copy(tmp, vlan_option->Data, MIN(vlan_option->Size, sizeof(tmp) - 1)); - - vlan_id = ToInt(tmp); - - opt->Out_VLanId = vlan_id; - } - } - - FreeDhcpOptions(o); - } - - FreeBuf(buf); - } - break; - } - } - - Free(finish); - - // Release the socket - ReleaseSock(sock); - - FreeBuf(p); - FreeBuf(user_password); - - Free(recv_buf); - } - - FreeBuf(nas_id); - FreeBuf(user_name); - } - - // Release the ip_list - for(i = 0; i < LIST_NUM(ip_list); i++) - { - IP *tmp_ip = LIST_DATA(ip_list, i); - Free(tmp_ip); - } - ReleaseList(ip_list); - - // Release the memory - FreeBuf(encrypted_password); - - return ret; -} - -// Parse RADIUS attributes -LIST *RadiusParseOptions(BUF *b) -{ - LIST *o; - UCHAR code; - UCHAR id; - USHORT len; - UCHAR auth[16]; - // Validate arguments - if (b == NULL) - { - return NULL; - } - - o = NewList(NULL); - - ReadBuf(b, &code, 1); - ReadBuf(b, &id, 1); - len = 0; - ReadBuf(b, &len, 2); - len = Endian16(len); - ReadBuf(b, auth, 16); - - while (true) - { - UCHAR attribute_id; - UCHAR size; - UCHAR data[256]; - DHCP_OPTION *d; - - if (ReadBuf(b, &attribute_id, 1) != 1) - { - break; - } - - if (ReadBuf(b, &size, 1) != 1) - { - break; - } - - if (size <= 2) - { - break; - } - - size -= 2; - if (ReadBuf(b, data, size) != size) - { - break; - } - - d = ZeroMalloc(sizeof(DHCP_OPTION)); - d->Id = attribute_id; - d->Size = size; - d->Data = Clone(data, d->Size); - - Add(o, d); - } - - return o; -} - -// Adding Attributes -void RadiusAddValue(BUF *b, UCHAR t, UINT v, UCHAR vt, void *data, UINT size) -{ - UINT len; - // Validate arguments - if (b == NULL || (data == NULL && size != 0)) - { - return; - } - - // type - WriteBufChar(b, t); - - // length - len = 2 + size; - if (t == 26) - { - len += 6; - } - WriteBufChar(b, (UCHAR)len); - - if (t != 26) - { - // value - WriteBuf(b, data, size); - } - else - { - // vendor - WriteBufInt(b, v); - - // vendor type - WriteBufChar(b, vt); - - // length2 - len = size + 2; - WriteBufChar(b, (UCHAR)len); - - // value - WriteBuf(b, data, size); - } -} - -// Create a password attribute for Radius -BUF *RadiusCreateUserPassword(void *data, UINT size) -{ - BUF *b; - UCHAR code, sz; - // Validate arguments - if (size != 0 && data == NULL || size >= 253) - { - return NULL; - } - - b = NewBuf(); - code = 2; - sz = 2 + (UCHAR)size; - WriteBuf(b, &code, 1); - WriteBuf(b, &sz, 1); - WriteBuf(b, data, size); - - return b; -} - -// Generate an ID attribute of Nas -BUF *RadiusCreateNasId(char *name) -{ - BUF *b; - UCHAR code, size; - // Validate arguments - if (name == NULL) - { - return NULL; - } - if (StrLen(name) == 0 || StrLen(name) >= 128) - { - return NULL; - } - - b = NewBuf(); - code = 32; - size = 2 + (UCHAR)StrLen(name); - WriteBuf(b, &code, 1); - WriteBuf(b, &size, 1); - WriteBuf(b, name, StrLen(name)); - - return b; -} - -// Create a user name attribute for Radius -BUF *RadiusCreateUserName(wchar_t *username) -{ - BUF *b; - UCHAR code, size; - UCHAR utf8[254]; - // Validate arguments - if (username == NULL) - { - return NULL; - } - - // Convert the user name to a Unicode string - UniToStr(utf8, sizeof(utf8), username); - utf8[253] = 0; - - b = NewBuf(); - code = 1; - size = 2 + (UCHAR)StrLen(utf8); - WriteBuf(b, &code, 1); - WriteBuf(b, &size, 1); - WriteBuf(b, utf8, StrLen(utf8)); - - return b; -} - -// Encrypt the password for the Radius -BUF *RadiusEncryptPassword(char *password, UCHAR *random, UCHAR *secret, UINT secret_size) -{ - UINT n, i; - BUF *buf; - UCHAR c[16][16]; // Result - UCHAR b[16][16]; // Result - UCHAR p[16][16]; // Password - // Validate arguments - if (password == NULL || random == NULL || (secret_size != 0 && secret == NULL)) - { - return NULL; - } - if (StrLen(password) > 256) - { - // Password is too long - return NULL; - } - - // Initialize - Zero(c, sizeof(c)); - Zero(p, sizeof(p)); - Zero(b, sizeof(b)); - - // Divide the password per 16 characters - Copy(p, password, StrLen(password)); - // Calculate the number of blocks - n = StrLen(password) / 16; - if ((StrLen(password) % 16) != 0) - { - n++; - } - - // Encryption processing - for (i = 0;i < n;i++) - { - // Calculation of b[i] - UINT j; - BUF *tmp = NewBuf(); - WriteBuf(tmp, secret, secret_size); - if (i == 0) - { - WriteBuf(tmp, random, 16); - } - else - { - WriteBuf(tmp, c[i - 1], 16); - } - Md5(b[i], tmp->Buf, tmp->Size); - FreeBuf(tmp); - - // Calculation of c[i] - for (j = 0;j < 16;j++) - { - c[i][j] = p[i][j] ^ b[i][j]; - } - } - - // Return the results - buf = NewBuf(); - WriteBuf(buf, c, n * 16); - return buf; -} - +// SoftEther VPN Source Code - Developer Edition Master Branch +// Cedar Communication Module + + +// Radius.c +// Radius authentication module + +#include "CedarPch.h" + +////////// Modern implementation + + +// send PEAP-MSCHAPv2 auth client response +bool PeapClientSendMsChapv2AuthClientResponse(EAP_CLIENT *e, UCHAR *client_response, UCHAR *client_challenge) +{ + bool ret = false; + EAP_MSCHAPV2_RESPONSE msg1; + EAP_MESSAGE msg2; + EAP_MESSAGE msg4; + if (e == NULL || client_response == NULL || client_challenge == NULL) + { + return false; + } + + Zero(&msg1, sizeof(msg1)); + Zero(&msg2, sizeof(msg2)); + Zero(&msg4, sizeof(msg4)); + + msg1.Type = EAP_TYPE_MS_AUTH; + msg1.Chap_Opcode = EAP_MSCHAPV2_OP_RESPONSE; + msg1.Chap_Id = e->MsChapV2Challenge.Chap_Id; + msg1.Chap_Len = Endian16(54 + StrLen(e->Username)); + msg1.Chap_ValueSize = 49; + Copy(msg1.Chap_PeerChallenge, client_challenge, 16); + Copy(msg1.Chap_NtResponse, client_response, 24); + Copy(msg1.Chap_Name, e->Username, MIN(StrLen(e->Username), 255)); + + if (SendPeapPacket(e, &msg1, 59 + StrLen(e->Username)) && + GetRecvPeapMessage(e, &msg2)) + { + if (msg2.Type == EAP_TYPE_MS_AUTH && + ((EAP_MSCHAPV2_GENERAL *)&msg2)->Chap_Opcode == EAP_MSCHAPV2_OP_SUCCESS) + { + EAP_MSCHAPV2_SUCCESS_SERVER *eaps = (EAP_MSCHAPV2_SUCCESS_SERVER *)&msg2; + + if (StartWith(eaps->Message, "S=")) + { + BUF *buf = StrToBin(eaps->Message + 2); + + if (buf && buf->Size == 20) + { + Copy(&e->MsChapV2Success, eaps, sizeof(EAP_MSCHAPV2_SUCCESS_SERVER)); + Copy(e->ServerResponse, buf->Buf, 20); + + if (true) + { + EAP_MSCHAPV2_SUCCESS_CLIENT msg3; + + Zero(&msg3, sizeof(msg3)); + msg3.Type = EAP_TYPE_MS_AUTH; + msg3.Chap_Opcode = EAP_MSCHAPV2_OP_SUCCESS; + + if (SendPeapPacket(e, &msg3, 6) && GetRecvPeapMessage(e, &msg4)) + { + UCHAR *rd = ((UCHAR *)&msg4); + if (rd[4] == 0x01 && rd[8] == 0x21 && rd[9] == 0x80 && + rd[10] == 0x03 && rd[11] == 0x00 && rd[12] == 0x02 && + rd[13] == 0x00 && rd[14] == 0x01) + { + UCHAR reply[15]; + Zero(reply, sizeof(reply)); + reply[4] = 0x02; reply[5] = rd[5]; reply[6] = 0x00; reply[7] = 0x0b; + reply[8] = 0x21; reply[9] = 0x80; reply[10] = 0x03; reply[11] = 0x00; + reply[12] = 0x02; reply[13] = 0x00; reply[14] = 0x01; + if (SendPeapPacket(e, reply, sizeof(reply))) + { + if (e->RecvLastCode == RADIUS_CODE_ACCESS_ACCEPT) + { + ret = true; + } + } + } + } + } + } + + FreeBuf(buf); + } + } + } + + return ret; +} + +// send PEAP-MSCHAPv2 auth request +bool PeapClientSendMsChapv2AuthRequest(EAP_CLIENT *eap) +{ + bool ret = false; + UINT num_retry = 0; + if (eap == NULL) + { + return false; + } + + if (StartPeapClient(eap)) + { + if (StartPeapSslClient(eap)) + { + EAP_MESSAGE recv_msg; + EAP_MESSAGE send_msg; + + if (GetRecvPeapMessage(eap, &recv_msg) && recv_msg.Type == EAP_TYPE_IDENTITY) + { +LABEL_RETRY: + num_retry++; + if (num_retry >= 10) + { + return false; + } + Zero(&send_msg, sizeof(send_msg)); + send_msg.Type = EAP_TYPE_IDENTITY; + send_msg.Len = Endian16(5 + StrLen(eap->Username)); + Copy(send_msg.Data, eap->Username, StrLen(eap->Username)); + + if (SendPeapPacket(eap, &send_msg, 5 + StrLen(eap->Username)) && + GetRecvPeapMessage(eap, &recv_msg)) + { +LABEL_RETRY2: + num_retry++; + if (num_retry >= 10) + { + return false; + } + if (recv_msg.Type == EAP_TYPE_MS_AUTH && + ((EAP_MSCHAPV2_GENERAL *)&recv_msg)->Chap_Opcode == EAP_MSCHAPV2_OP_CHALLENGE) + { + EAP_MSCHAPV2_CHALLENGE *svr_challenge = (EAP_MSCHAPV2_CHALLENGE *)&recv_msg; + + Copy(&eap->MsChapV2Challenge, svr_challenge, sizeof(EAP_MSCHAPV2_CHALLENGE)); + + ret = true; + + eap->PeapMode = true; + } + else if (recv_msg.Type == EAP_TYPE_IDENTITY) + { + UCHAR *rd = ((UCHAR *)&recv_msg); + if (rd[4] == 0x01 && rd[8] == 0x21 && rd[9] == 0x80 && + rd[10] == 0x03 && rd[11] == 0x00 && rd[12] == 0x02 && + rd[13] == 0x00) + { + if (rd[14] == 0x02) + { + // Fail + return false; + } + } + + goto LABEL_RETRY; + } + else + { + EAP_MESSAGE nak; + + Zero(&nak, sizeof(nak)); + nak.Type = EAP_TYPE_LEGACY_NAK; + nak.Data[0] = EAP_TYPE_MS_AUTH; + + if (SendPeapPacket(eap, &nak, 6) && + GetRecvPeapMessage(eap, &recv_msg)) + { + goto LABEL_RETRY2; + } + } + } + } + } + } + return ret; +} + +// Send a PEAP packet (encrypted) +bool SendPeapRawPacket(EAP_CLIENT *e, UCHAR *peap_data, UINT peap_size) +{ + LIST *fragments = NULL; + bool ret = false; + BUF *buf = NULL; + UINT i; + UINT num; + bool send_empty = false; + bool include_len = false; + if (e == NULL) + { + return false; + } + + // divide into 1024 bytes + buf = NewBuf(); + + // size + if ((peap_size + 6 + 2) >= 256) + { + WriteBufInt(buf, peap_size); + include_len = true; + } + + // data + WriteBuf(buf, peap_data, peap_size); + + if (peap_data == NULL) + { + send_empty = true; + } + + SeekBufToBegin(buf); + + fragments = NewListFast(NULL); + for (num = 0;;num++) + { + UCHAR tmp[200]; + EAP_PEAP *send_peap_message; + UINT sz; + + sz = ReadBuf(buf, tmp, sizeof(tmp)); + + if (sz == 0) + { + break; + } + + // add header + send_peap_message = ZeroMalloc(sizeof(EAP_PEAP) + sz); + send_peap_message->Code = EAP_CODE_RESPONSE; + send_peap_message->Id = e->LastRecvEapId + num; + send_peap_message->Len = Endian16((UINT)(((UINT)sizeof(EAP_PEAP) + (UINT)sz))); + send_peap_message->Type = EAP_TYPE_PEAP; + send_peap_message->TlsFlags = 0; + + if (num == 0 && include_len) + { + send_peap_message->TlsFlags |= EAP_TLS_FLAGS_LEN; + } + if (ReadBufRemainSize(buf) != 0) + { + send_peap_message->TlsFlags |= EAP_TLS_FLAGS_MORE_FRAGMENTS; + } + + Copy(((UCHAR *)send_peap_message) + sizeof(EAP_PEAP), tmp, sz); + + Add(fragments, MemToBuf(send_peap_message, sizeof(EAP_PEAP) + sz)); + + Free(send_peap_message); + } + + if (num == 0 && send_empty) + { + Add(fragments, MemToBuf("\0", 1)); + } + + // send each of packets + for (i = 0;i < LIST_NUM(fragments);i++) + { + BUF *b = LIST_DATA(fragments, i); + RADIUS_AVP *eap_avp; + RADIUS_PACKET *response_packet; + + RADIUS_PACKET *send_packet = NewRadiusPacket(RADIUS_CODE_ACCESS_REQUEST, e->NextRadiusPacketId++); + EapSetRadiusGeneralAttributes(send_packet, e); + + if (e->LastStateSize != 0) + { + Add(send_packet->AvpList, NewRadiusAvp(RADIUS_ATTRIBUTE_STATE, 0, 0, + e->LastState, e->LastStateSize)); + } + + if (send_empty == false) + { + eap_avp = NewRadiusAvp(RADIUS_ATTRIBUTE_EAP_MESSAGE, 0, 0, b->Buf, b->Size); + } + else + { + EAP_PEAP empty_peap; + + Zero(&empty_peap, sizeof(empty_peap)); + empty_peap.Code = EAP_CODE_RESPONSE; + empty_peap.Id = e->LastRecvEapId; + empty_peap.Len = Endian16(sizeof(EAP_PEAP)); + empty_peap.Type = EAP_TYPE_PEAP; + + eap_avp = NewRadiusAvp(RADIUS_ATTRIBUTE_EAP_MESSAGE, 0, 0, &empty_peap, sizeof(EAP_PEAP)); + } + + Add(send_packet->AvpList, eap_avp); + + response_packet = EapSendPacketAndRecvResponse(e, send_packet); + + if (response_packet != NULL) + { + e->RecvLastCode = response_packet->Code; + + if (response_packet->Parse_EapMessage != NULL && response_packet->Parse_EapMessage_DataSize >= sizeof(EAP_PEAP)) + { + // Received SSL stream + EAP_PEAP *peap_msg = (EAP_PEAP *)response_packet->Parse_EapMessage; + + if (peap_msg->Type == EAP_TYPE_PEAP) + { + if (peap_msg->TlsFlags & EAP_TLS_FLAGS_LEN) + { + UINT total_size = READ_UINT(((UCHAR *)peap_msg) + sizeof(EAP_PEAP)); + + if (total_size <= (response_packet->Parse_EapMessage_DataSize - sizeof(EAP_PEAP) - sizeof(UINT))) + { + WriteFifo(e->SslPipe->RawIn->SendFifo, ((UCHAR *)peap_msg) + sizeof(EAP_PEAP) + sizeof(UINT), total_size); + } + } + else + { + WriteFifo(e->SslPipe->RawIn->SendFifo, ((UCHAR *)peap_msg) + sizeof(EAP_PEAP), + response_packet->Parse_EapMessage_DataSize - sizeof(EAP_PEAP)); + } + } + } + } + + FreeRadiusPacket(send_packet); + FreeRadiusPacket(response_packet); + } + + FreeBuf(buf); + + if (fragments != NULL) + { + for (i = 0;i < LIST_NUM(fragments);i++) + { + BUF *b = LIST_DATA(fragments, i); + + FreeBuf(b); + } + + ReleaseList(fragments); + } + + SyncSslPipe(e->SslPipe); + + return ret; +} + +// Send an encrypted message of PEAP +bool SendPeapPacket(EAP_CLIENT *e, void *msg, UINT msg_size) +{ + bool ret = false; + FIFO *send_fifo; + FIFO *recv_fifo; + BUF *buf; + EAP_MESSAGE tmpmsg; + if (e == NULL || msg == NULL || msg_size == 0) + { + return false; + } + if (e->SslPipe == NULL) + { + return false; + } + + send_fifo = e->SslPipe->RawOut->RecvFifo; + recv_fifo = e->SslPipe->RawIn->SendFifo; + + Zero(&tmpmsg, sizeof(tmpmsg)); + Copy(&tmpmsg, msg, MIN(msg_size, sizeof(EAP_MESSAGE))); + + WriteFifo(e->SslPipe->SslInOut->SendFifo, &tmpmsg.Type, msg_size - 4); + + SyncSslPipe(e->SslPipe); + + buf = ReadFifoAll(send_fifo); + + while (true) + { + ret = SendPeapRawPacket(e, buf->Buf, buf->Size); + FreeBuf(buf); + + if (send_fifo->size == 0) + { + break; + } + + buf = ReadFifoAll(send_fifo); + } + + return !e->SslPipe->IsDisconnected; +} + +// Start a PEAP SSL client +bool StartPeapSslClient(EAP_CLIENT *e) +{ + bool ret = false; + FIFO *send_fifo; + FIFO *recv_fifo; + BUF *buf; + if (e == NULL) + { + return false; + } + if (e->SslPipe != NULL) + { + return false; + } + + e->SslPipe = NewSslPipe(false, NULL, NULL, NULL); + send_fifo = e->SslPipe->RawOut->RecvFifo; + recv_fifo = e->SslPipe->RawIn->SendFifo; + + SyncSslPipe(e->SslPipe); + + buf = ReadFifoAll(send_fifo); + + while (true) + { + ret = SendPeapRawPacket(e, buf->Buf, buf->Size); + FreeBuf(buf); + + if (send_fifo->size == 0) + { + break; + } + + buf = ReadFifoAll(send_fifo); + } + + SendPeapRawPacket(e, NULL, 0); + + return !e->SslPipe->IsDisconnected; +} + +// Get a received PEAP message (unencrypted) +bool GetRecvPeapMessage(EAP_CLIENT *e, EAP_MESSAGE *msg) +{ + BUF *b; + bool ret = false; + if (e == NULL) + { + return false; + } + if (e->SslPipe == NULL) + { + return false; + } + + b = ReadFifoAll(e->SslPipe->SslInOut->RecvFifo); + + if (b->Size >= 1) + { + Zero(msg, sizeof(EAP_MESSAGE)); + + msg->Len = Endian16(b->Size + 4); + Copy(&msg->Type, b->Buf, MIN(b->Size, 1501)); + + ret = true; + } + + FreeBuf(b); + + return ret; +} + +// Start a PEAP client +bool StartPeapClient(EAP_CLIENT *e) +{ + bool ret = false; + RADIUS_PACKET *request1 = NULL; + RADIUS_PACKET *response1 = NULL; + RADIUS_PACKET *request2 = NULL; + RADIUS_PACKET *response2 = NULL; + EAP_MESSAGE *eap1 = NULL; + EAP_MESSAGE *eap2 = NULL; + if (e == NULL) + { + return false; + } + if (e->SslPipe != NULL) + { + return false; + } + + request1 = NewRadiusPacket(RADIUS_CODE_ACCESS_REQUEST, e->NextRadiusPacketId++); + EapSetRadiusGeneralAttributes(request1, e); + + eap1 = ZeroMalloc(sizeof(EAP_MESSAGE)); + eap1->Code = EAP_CODE_RESPONSE; + eap1->Id = e->LastRecvEapId; + eap1->Len = Endian16(StrLen(e->Username) + 5); + eap1->Type = EAP_TYPE_IDENTITY; + Copy(eap1->Data, e->Username, StrLen(e->Username)); + Add(request1->AvpList, NewRadiusAvp(RADIUS_ATTRIBUTE_EAP_MESSAGE, 0, 0, eap1, StrLen(e->Username) + 5)); + + response1 = EapSendPacketAndRecvResponse(e, request1); + + if (response1 != NULL) + { + if (response1->Parse_EapMessage_DataSize != 0 && response1->Parse_EapMessage != NULL) + { + EAP_MESSAGE *eap = response1->Parse_EapMessage; + if (eap->Code == EAP_CODE_REQUEST) + { + if (eap->Type != EAP_TYPE_PEAP) + { + // Unsupported auth type. Request PEAP. + request2 = NewRadiusPacket(RADIUS_CODE_ACCESS_REQUEST, e->NextRadiusPacketId++); + EapSetRadiusGeneralAttributes(request2, e); + + if (response1->Parse_StateSize != 0) + { + Add(request2->AvpList, NewRadiusAvp(RADIUS_ATTRIBUTE_STATE, 0, 0, + response1->Parse_State, response1->Parse_StateSize)); + } + + eap2 = ZeroMalloc(sizeof(EAP_MESSAGE)); + eap2->Code = EAP_CODE_RESPONSE; + eap2->Id = e->LastRecvEapId; + eap2->Len = Endian16(6); + eap2->Type = EAP_TYPE_LEGACY_NAK; + eap2->Data[0] = EAP_TYPE_PEAP; + + Add(request2->AvpList, NewRadiusAvp(RADIUS_ATTRIBUTE_EAP_MESSAGE, 0, 0, eap2, 6)); + + response2 = EapSendPacketAndRecvResponse(e, request2); + + if (response2 != NULL && response2->Parse_EapMessage_DataSize != 0 && response2->Parse_EapMessage != NULL) + { + eap = response2->Parse_EapMessage; + + if (eap->Code == EAP_CODE_REQUEST && eap->Type == EAP_TYPE_PEAP) + { + goto LABEL_PARSE_PEAP; + } + } + } + else + { + EAP_PEAP *peap; +LABEL_PARSE_PEAP: + peap = (EAP_PEAP *)eap; + + if (peap->TlsFlags == 0x20) + { + ret = true; + } + } + } + } + } + + FreeRadiusPacket(request1); + FreeRadiusPacket(request2); + FreeRadiusPacket(response1); + FreeRadiusPacket(response2); + Free(eap1); + Free(eap2); + + return ret; +} + +// Set RADIUS general attributes +void EapSetRadiusGeneralAttributes(RADIUS_PACKET *r, EAP_CLIENT *e) +{ + UINT ui; + char *str; + if (r == NULL || e == NULL) + { + return; + } + + ui = Endian32(2); + Add(r->AvpList, NewRadiusAvp(RADIUS_ATTRIBUTE_SERVICE_TYPE, 0, 0, &ui, sizeof(UINT))); + + ui = Endian32(1); + Add(r->AvpList, NewRadiusAvp(RADIUS_ATTRIBUTE_FRAMED_PROTOCOL, 0, 0, &ui, sizeof(UINT))); + + ui = Endian32(5); + Add(r->AvpList, NewRadiusAvp(RADIUS_ATTRIBUTE_NAS_PORT_TYPE, 0, 0, &ui, sizeof(UINT))); + + if (IsEmptyStr(e->CalledStationStr) == false) + { + Add(r->AvpList, NewRadiusAvp(RADIUS_ATTRIBUTE_CALLED_STATION_ID, 0, 0, e->CalledStationStr, StrLen(e->CalledStationStr))); + } + + Add(r->AvpList, NewRadiusAvp(RADIUS_ATTRIBUTE_CALLING_STATION_ID, 0, 0, e->ClientIpStr, StrLen(e->ClientIpStr))); + + Add(r->AvpList, NewRadiusAvp(RADIUS_ATTRIBUTE_TUNNEL_CLIENT_ENDPOINT, 0, 0, e->ClientIpStr, StrLen(e->ClientIpStr))); + + Add(r->AvpList, NewRadiusAvp(RADIUS_ATTRIBUTE_USER_NAME, 0, 0, e->Username, StrLen(e->Username))); + + Add(r->AvpList, NewRadiusAvp(RADIUS_ATTRIBUTE_NAS_ID, 0, 0, CEDAR_SERVER_STR, StrLen(CEDAR_SERVER_STR))); + + if (IsEmptyStr(e->In_VpnProtocolState) == false) + { + Add(r->AvpList, NewRadiusAvp(RADIUS_ATTRIBUTE_PROXY_STATE, 0, 0, e->In_VpnProtocolState, StrLen(e->In_VpnProtocolState))); + } + + ui = Endian32(2); + Add(r->AvpList, NewRadiusAvp(RADIUS_ATTRIBUTE_VENDOR_SPECIFIC, RADIUS_VENDOR_MICROSOFT, + RADIUS_MS_NETWORK_ACCESS_SERVER_TYPE, &ui, sizeof(UINT))); + + ui = Endian32(RADIUS_VENDOR_MICROSOFT); + Add(r->AvpList, NewRadiusAvp(RADIUS_ATTRIBUTE_VENDOR_SPECIFIC, RADIUS_VENDOR_MICROSOFT, + RADIUS_MS_RAS_VENDOR, &ui, sizeof(UINT))); + + str = "MSRASV5.20"; + Add(r->AvpList, NewRadiusAvp(RADIUS_ATTRIBUTE_VENDOR_SPECIFIC, RADIUS_VENDOR_MICROSOFT, + RADIUS_MS_VERSION, str, StrLen(str))); + + str = "{5DC53D72-9815-4E97-AC91-339BAFEA6C48}"; + Add(r->AvpList, NewRadiusAvp(RADIUS_ATTRIBUTE_VENDOR_SPECIFIC, RADIUS_VENDOR_MICROSOFT, + RADIUS_MS_RAS_CORRELATION, str, StrLen(str))); + + str = "MSRASV5.20"; + Add(r->AvpList, NewRadiusAvp(RADIUS_ATTRIBUTE_VENDOR_SPECIFIC, RADIUS_VENDOR_MICROSOFT, + RADIUS_MS_RAS_CLIENT_VERSION, str, StrLen(str))); + + str = "MSRASV5.20"; + Add(r->AvpList, NewRadiusAvp(RADIUS_ATTRIBUTE_VENDOR_SPECIFIC, RADIUS_VENDOR_MICROSOFT, + RADIUS_MS_RAS_CLIENT_NAME, str, StrLen(str))); +} + +// Send a MSCHAPv2 client auth response1 +bool EapClientSendMsChapv2AuthClientResponse(EAP_CLIENT *e, UCHAR *client_response, UCHAR *client_challenge) +{ + bool ret = false; + RADIUS_PACKET *request1 = NULL; + RADIUS_PACKET *response1 = NULL; + RADIUS_PACKET *request2 = NULL; + RADIUS_PACKET *response2 = NULL; + EAP_MSCHAPV2_RESPONSE *eap1 = NULL; + EAP_MSCHAPV2_SUCCESS_CLIENT *eap2 = NULL; + if (e == NULL || client_response == NULL || client_challenge == NULL) + { + return false; + } + + request1 = NewRadiusPacket(RADIUS_CODE_ACCESS_REQUEST, e->NextRadiusPacketId++); + EapSetRadiusGeneralAttributes(request1, e); + + if (e->LastStateSize != 0) + { + Add(request1->AvpList, NewRadiusAvp(RADIUS_ATTRIBUTE_STATE, 0, 0, + e->LastState, e->LastStateSize)); + } + + eap1 = ZeroMalloc(sizeof(EAP_MSCHAPV2_RESPONSE)); + eap1->Code = EAP_CODE_RESPONSE; + eap1->Id = e->NextEapId++; + eap1->Len = Endian16(59 + StrLen(e->Username)); + eap1->Type = EAP_TYPE_MS_AUTH; + eap1->Chap_Opcode = EAP_MSCHAPV2_OP_RESPONSE; + eap1->Chap_Id = e->MsChapV2Challenge.Chap_Id; + eap1->Chap_Len = Endian16(54 + StrLen(e->Username)); + eap1->Chap_ValueSize = 49; + Copy(eap1->Chap_PeerChallenge, client_challenge, 16); + Copy(eap1->Chap_NtResponse, client_response, 24); + Copy(eap1->Chap_Name, e->Username, MIN(StrLen(e->Username), 255)); + + Add(request1->AvpList, NewRadiusAvp(RADIUS_ATTRIBUTE_EAP_MESSAGE, 0, 0, eap1, StrLen(e->Username) + 59)); + + response1 = EapSendPacketAndRecvResponse(e, request1); + + if (response1 != NULL) + { + if (response1->Parse_EapMessage_DataSize != 0 && response1->Parse_EapMessage != NULL) + { + EAP_MESSAGE *eap = response1->Parse_EapMessage; + if (eap->Code == EAP_CODE_REQUEST) + { + if (eap->Type == EAP_TYPE_MS_AUTH) + { + if (((EAP_MSCHAPV2_GENERAL *)eap)->Chap_Opcode != EAP_MSCHAPV2_OP_SUCCESS) + { + // Auth fail + } + else + { + // Auth ok + EAP_MSCHAPV2_SUCCESS_SERVER *eaps = (EAP_MSCHAPV2_SUCCESS_SERVER *)eap; + + if (StartWith(eaps->Message, "S=")) + { + BUF *buf = StrToBin(eaps->Message + 2); + + if (buf && buf->Size == 20) + { + Copy(&e->MsChapV2Success, eaps, sizeof(EAP_MSCHAPV2_SUCCESS_SERVER)); + Copy(e->ServerResponse, buf->Buf, 20); + + if (true) + { + // Send the final packet + request2 = NewRadiusPacket(RADIUS_CODE_ACCESS_REQUEST, e->NextRadiusPacketId++); + EapSetRadiusGeneralAttributes(request2, e); + + if (e->LastStateSize != 0) + { + Add(request2->AvpList, NewRadiusAvp(RADIUS_ATTRIBUTE_STATE, 0, 0, + e->LastState, e->LastStateSize)); + } + + eap2 = ZeroMalloc(sizeof(EAP_MSCHAPV2_SUCCESS_CLIENT)); + eap2->Code = EAP_CODE_RESPONSE; + eap2->Id = e->NextEapId++; + eap2->Len = Endian16(6); + eap2->Type = EAP_TYPE_MS_AUTH; + eap2->Chap_Opcode = EAP_MSCHAPV2_OP_SUCCESS; + + Add(request2->AvpList, NewRadiusAvp(RADIUS_ATTRIBUTE_EAP_MESSAGE, 0, 0, eap2, 6)); + + response2 = EapSendPacketAndRecvResponse(e, request2); + + if (response2 != NULL) + { + if (response2->Code == RADIUS_CODE_ACCESS_ACCEPT) + { + ret = true; + } + } + } + } + + FreeBuf(buf); + } + } + } + } + } + } + + FreeRadiusPacket(request1); + FreeRadiusPacket(request2); + FreeRadiusPacket(response1); + FreeRadiusPacket(response2); + Free(eap1); + Free(eap2); + + return ret; +} + +// Send a MSCHAPv2 client auth request +bool EapClientSendMsChapv2AuthRequest(EAP_CLIENT *e) +{ + bool ret = false; + RADIUS_PACKET *request1 = NULL; + RADIUS_PACKET *response1 = NULL; + RADIUS_PACKET *request2 = NULL; + RADIUS_PACKET *response2 = NULL; + EAP_MESSAGE *eap1 = NULL; + EAP_MESSAGE *eap2 = NULL; + if (e == NULL) + { + return false; + } + + request1 = NewRadiusPacket(RADIUS_CODE_ACCESS_REQUEST, e->NextRadiusPacketId++); + EapSetRadiusGeneralAttributes(request1, e); + + eap1 = ZeroMalloc(sizeof(EAP_MESSAGE)); + eap1->Code = EAP_CODE_RESPONSE; + eap1->Id = e->NextEapId++; + eap1->Len = Endian16(StrLen(e->Username) + 5); + eap1->Type = EAP_TYPE_IDENTITY; + Copy(eap1->Data, e->Username, StrLen(e->Username)); + Add(request1->AvpList, NewRadiusAvp(RADIUS_ATTRIBUTE_EAP_MESSAGE, 0, 0, eap1, StrLen(e->Username) + 5)); + + response1 = EapSendPacketAndRecvResponse(e, request1); + + if (response1 != NULL) + { + if (response1->Parse_EapMessage_DataSize != 0 && response1->Parse_EapMessage != NULL) + { + EAP_MESSAGE *eap = response1->Parse_EapMessage; + if (eap->Code == EAP_CODE_REQUEST) + { + if (eap->Type != EAP_TYPE_MS_AUTH) + { + // Unsupported auth type. Request MS-CHAP-v2. + request2 = NewRadiusPacket(RADIUS_CODE_ACCESS_REQUEST, e->NextRadiusPacketId++); + EapSetRadiusGeneralAttributes(request2, e); + + if (response1->Parse_StateSize != 0) + { + Add(request2->AvpList, NewRadiusAvp(RADIUS_ATTRIBUTE_STATE, 0, 0, + response1->Parse_State, response1->Parse_StateSize)); + } + + eap2 = ZeroMalloc(sizeof(EAP_MESSAGE)); + eap2->Code = EAP_CODE_RESPONSE; + eap2->Id = e->NextEapId++; + eap2->Len = Endian16(6); + eap2->Type = EAP_TYPE_LEGACY_NAK; + eap2->Data[0] = EAP_TYPE_MS_AUTH; + + Add(request2->AvpList, NewRadiusAvp(RADIUS_ATTRIBUTE_EAP_MESSAGE, 0, 0, eap2, 6)); + + response2 = EapSendPacketAndRecvResponse(e, request2); + + if (response2 != NULL && response2->Parse_EapMessage_DataSize != 0 && response2->Parse_EapMessage != NULL) + { + eap = response2->Parse_EapMessage; + + if (eap->Code == EAP_CODE_REQUEST && eap->Type == EAP_TYPE_MS_AUTH) + { + goto LABEL_PARSE_EAP; + } + } + } + else + { + EAP_MSCHAPV2_GENERAL *ms_g; +LABEL_PARSE_EAP: + ms_g = (EAP_MSCHAPV2_GENERAL *)eap; + + if (ms_g->Chap_Opcode == EAP_MSCHAPV2_OP_CHALLENGE) + { + EAP_MSCHAPV2_CHALLENGE *ms_c = (EAP_MSCHAPV2_CHALLENGE *)eap; + if (ms_c->Chap_ValueSize == 16) + { + Copy(&e->MsChapV2Challenge, ms_c, sizeof(EAP_MSCHAPV2_CHALLENGE)); + + ret = true; + } + } + } + } + } + } + + FreeRadiusPacket(request1); + FreeRadiusPacket(request2); + FreeRadiusPacket(response1); + FreeRadiusPacket(response2); + Free(eap1); + Free(eap2); + + return ret; +} + +// Send a packet and recv a response +RADIUS_PACKET *EapSendPacketAndRecvResponse(EAP_CLIENT *e, RADIUS_PACKET *r) +{ + SOCKSET set; + UINT64 giveup_tick = 0; + UINT64 next_send_tick = 0; + bool select_inited = false; + bool free_r = false; + RADIUS_PACKET *ret = NULL; + if (e == NULL || r == NULL) + { + return NULL; + } + + ClearBuf(e->PEAP_CurrentReceivingMsg); + e->PEAP_CurrentReceivingTotalSize = 0; + + InitSockSet(&set); + AddSockSet(&set, e->UdpSock); + + while (true) + { + UINT64 now = Tick64(); + UINT wait_time = INFINITE; + bool is_finish = false; + + if (giveup_tick == 0) + { + giveup_tick = now + (UINT64)e->GiveupTimeout; + } + + if (giveup_tick <= now) + { + break; + } + + if (select_inited) + { + UINT num_error = 0; + + while (true) + { + IP from_ip; + UINT from_port; + UINT size; + UCHAR *tmp = e->TmpBuffer; + + size = RecvFrom(e->UdpSock, &from_ip, &from_port, tmp, sizeof(e->TmpBuffer)); + if (size == 0 && e->UdpSock->IgnoreRecvErr == false) + { + // UDP socket error + is_finish = true; + break; + } + else if (size == SOCK_LATER) + { + break; + } + if (size == 0 && e->UdpSock->IgnoreRecvErr) + { + num_error++; + if (num_error >= 100) + { + is_finish = true; + break; + } + } + + // Receive a response packet + if (size != SOCK_LATER && size >= 1) + { + if (CmpIpAddr(&from_ip, &e->ServerIp) == 0 && from_port == e->ServerPort) + { + RADIUS_PACKET *rp = ParseRadiusPacket(tmp, size); + if (rp != NULL) + { + RADIUS_AVP *eap_msg = GetRadiusAvp(rp, RADIUS_ATTRIBUTE_EAP_MESSAGE); + RADIUS_AVP *vlan_avp = GetRadiusAvp(rp, RADIUS_ATTRIBUTE_VLAN_ID); + RADIUS_AVP *framed_interface_id_avp = GetRadiusAvp(rp, RADIUS_ATTRIBUTE_FRAMED_INTERFACE_ID); + if (eap_msg != NULL) + { + e->LastRecvEapId = ((EAP_MESSAGE *)(eap_msg->Data))->Id; + } + + if (framed_interface_id_avp != NULL) + { + // FRAMED_INTERFACE_ID + char tmp_str[64]; + UCHAR mac_address[6]; + + Zero(tmp_str, sizeof(tmp_str)); + Copy(tmp_str, framed_interface_id_avp->Data, MIN(framed_interface_id_avp->DataSize, sizeof(tmp_str) - 1)); + + if (StrToMac(mac_address, tmp_str)) + { + Copy(e->LastRecvVirtualMacAddress, mac_address, 6); + } + } + + if (vlan_avp != NULL) + { + // VLAN ID + UINT vlan_id = 0; + char tmp[32]; + + Zero(tmp, sizeof(tmp)); + + Copy(tmp, vlan_avp->Data, MIN(vlan_avp->DataSize, sizeof(tmp) - 1)); + + vlan_id = ToInt(tmp); + + e->LastRecvVLanId = vlan_id; + } + + // Validate the received packet + if (rp->Parse_EapAuthMessagePos != 0 && rp->Parse_AuthenticatorPos != 0) + { + UCHAR *tmp_buffer = Clone(tmp, size); + UCHAR auth1[16]; + UCHAR auth2[16]; + + Copy(auth1, &tmp_buffer[rp->Parse_EapAuthMessagePos], 16); + + Zero(&tmp_buffer[rp->Parse_EapAuthMessagePos], 16); + Copy(&tmp_buffer[rp->Parse_AuthenticatorPos], r->Authenticator, 16); + + HMacMd5(auth2, e->SharedSecret, StrLen(e->SharedSecret), + tmp_buffer, size); + + if (Cmp(auth1, auth2, 16) == 0) + { + bool send_ack_packet = false; + + // ok + Copy(e->LastState, rp->Parse_State, rp->Parse_StateSize); + e->LastStateSize = rp->Parse_StateSize; + + if (rp->Parse_EapMessage_DataSize != 0 && rp->Parse_EapMessage != NULL) + { + EAP_MESSAGE *eap_msg = (EAP_MESSAGE *)rp->Parse_EapMessage; + + if (eap_msg->Type == EAP_TYPE_PEAP) + { + EAP_PEAP *peap_message = (EAP_PEAP *)eap_msg; + + if (peap_message->TlsFlags & EAP_TLS_FLAGS_MORE_FRAGMENTS || e->PEAP_CurrentReceivingTotalSize != 0) + { + // more fragments: reply ack + RADIUS_PACKET *ack_packet = NewRadiusPacket(RADIUS_CODE_ACCESS_REQUEST, e->NextRadiusPacketId++); + EAP_PEAP *ack_msg = ZeroMalloc(sizeof(EAP_PEAP)); + + EapSetRadiusGeneralAttributes(ack_packet, e); + if (e->LastStateSize != 0) + { + Add(ack_packet->AvpList, NewRadiusAvp(RADIUS_ATTRIBUTE_STATE, 0, 0, + e->LastState, e->LastStateSize)); + } + + ack_msg->Code = EAP_CODE_RESPONSE; + ack_msg->Id = e->LastRecvEapId; + ack_msg->Len = Endian16(6); + ack_msg->Type = EAP_TYPE_PEAP; + ack_msg->TlsFlags = 0; + + Add(ack_packet->AvpList, NewRadiusAvp(RADIUS_ATTRIBUTE_EAP_MESSAGE, 0, 0, + ack_msg, sizeof(EAP_PEAP))); + + next_send_tick = 0; + + if (free_r) + { + FreeRadiusPacket(r); + } + + r = ack_packet; + free_r = true; + + Free(ack_msg); + + send_ack_packet = true; + + if (e->PEAP_CurrentReceivingTotalSize == 0) + { + if (peap_message->TlsFlags & EAP_TLS_FLAGS_LEN) + { + if (Endian16(peap_message->Len) >= 9) + { + UINT total_size = READ_UINT(((UCHAR *)peap_message) + sizeof(EAP_PEAP)); + + if (total_size < 65536) + { + if (rp->Parse_EapMessage_DataSize >= 1) + { + e->PEAP_CurrentReceivingTotalSize = total_size; + + WriteBuf(e->PEAP_CurrentReceivingMsg, + ((UCHAR *)peap_message), + rp->Parse_EapMessage_DataSize); + } + } + } + } + } + else + { + if ((!(peap_message->TlsFlags & EAP_TLS_FLAGS_LEN)) && + rp->Parse_EapMessage_DataSize >= sizeof(EAP_PEAP)) + { + WriteBuf(e->PEAP_CurrentReceivingMsg, + ((UCHAR *)peap_message) + sizeof(EAP_PEAP), + rp->Parse_EapMessage_DataSize - sizeof(EAP_PEAP)); + + if (e->PEAP_CurrentReceivingTotalSize <= e->PEAP_CurrentReceivingMsg->Size) + { + // all fragmented segments are arrived + send_ack_packet = false; + + is_finish = true; + + Free(rp->Parse_EapMessage); + rp->Parse_EapMessage = Clone(e->PEAP_CurrentReceivingMsg->Buf, e->PEAP_CurrentReceivingMsg->Size); + rp->Parse_EapMessage_DataSize = e->PEAP_CurrentReceivingMsg->Size; + } + } + } + } + } + } + + if (send_ack_packet == false) + { + ret = rp; + } + } + + Free(tmp_buffer); + } + + if (ret != NULL) + { + is_finish = true; + break; + } + else + { + FreeRadiusPacket(rp); + } + } + } + } + } + } + + if (is_finish) + { + break; + } + + if (next_send_tick == 0 || next_send_tick <= now) + { + next_send_tick = now + (UINT64)e->ResendTimeout; + + if (EapSendPacket(e, r) == false) + { + is_finish = true; + } + } + + wait_time = MIN(wait_time, (UINT)(next_send_tick - now)); + wait_time = MIN(wait_time, (UINT)(giveup_tick - now)); + wait_time = MAX(wait_time, 1); + + if (is_finish) + { + break; + } + + Select(&set, wait_time, NULL, NULL); + select_inited = true; + } + + if (free_r) + { + FreeRadiusPacket(r); + } + + return ret; +} + +// Send a RADIUS packet +bool EapSendPacket(EAP_CLIENT *e, RADIUS_PACKET *r) +{ + BUF *b; + bool ret = false; + if (e == NULL || r == NULL) + { + return false; + } + + b = GenerateRadiusPacket(r, e->SharedSecret); + if (b != NULL) + { + UINT r = SendTo(e->UdpSock, &e->ServerIp, e->ServerPort, b->Buf, b->Size); + if (!(r == 0 && e->UdpSock->IgnoreSendErr == false)) + { + ret = true; + } + + + FreeBuf(b); + } + + return ret; +} + +// New EAP client +EAP_CLIENT *NewEapClient(IP *server_ip, UINT server_port, char *shared_secret, UINT resend_timeout, UINT giveup_timeout, char *client_ip_str, char *username, char *hubname) +{ + EAP_CLIENT *e; + if (server_ip == NULL) + { + return NULL; + } + if (resend_timeout == 0) + { + resend_timeout = RADIUS_RETRY_INTERVAL; + } + if (giveup_timeout == 0) + { + giveup_timeout = RADIUS_RETRY_TIMEOUT; + } + + e = ZeroMalloc(sizeof(EAP_CLIENT)); + + e->Ref = NewRef(); + + e->NextRadiusPacketId = 1; + + e->UdpSock = NewUDPEx(0, IsIP6(server_ip)); + Copy(&e->ServerIp, server_ip, sizeof(IP)); + e->ServerPort = server_port; + e->ResendTimeout = resend_timeout; + e->GiveupTimeout = giveup_timeout; + StrCpy(e->SharedSecret, sizeof(e->SharedSecret), shared_secret); + + StrCpy(e->CalledStationStr, sizeof(e->CalledStationStr), hubname); + StrCpy(e->ClientIpStr, sizeof(e->ClientIpStr), client_ip_str); + StrCpy(e->Username, sizeof(e->Username), username); + e->LastRecvEapId = 0; + + e->PEAP_CurrentReceivingMsg = NewBuf(); + + return e; +} + +// Free a EAP client +void ReleaseEapClient(EAP_CLIENT *e) +{ + if (e == NULL) + { + return; + } + + if (Release(e->Ref) == 0) + { + CleanupEapClient(e); + } +} +void CleanupEapClient(EAP_CLIENT *e) +{ + if (e == NULL) + { + return; + } + + Disconnect(e->UdpSock); + ReleaseSock(e->UdpSock); + + FreeSslPipe(e->SslPipe); + + FreeBuf(e->PEAP_CurrentReceivingMsg); + + Free(e); +} + +// New RADIUS AVP value +RADIUS_AVP *NewRadiusAvp(UCHAR type, UINT vendor_id, UCHAR vendor_code, void *data, UINT size) +{ + RADIUS_AVP *p = ZeroMalloc(sizeof(RADIUS_AVP)); + + p->Type = type; + p->VendorId = vendor_id; + p->VendorCode = vendor_code; + p->DataSize = (UCHAR)size; + Copy(p->Data, data, (UCHAR)size); + + if (size >= 256) + { + Debug("!! size = %u\n", size); + } + + return p; +} + +// New RADIUS packet +RADIUS_PACKET *NewRadiusPacket(UCHAR code, UCHAR packet_id) +{ + RADIUS_PACKET *r = ZeroMalloc(sizeof(RADIUS_PACKET)); + + r->Code = code; + r->PacketId = packet_id; + + r->AvpList = NewListFast(NULL); + + return r; +} + +// Get RADIUS AVP +RADIUS_AVP *GetRadiusAvp(RADIUS_PACKET *p, UCHAR type) +{ + UINT i; + if (p == NULL) + { + return NULL; + } + + for (i = 0;i < LIST_NUM(p->AvpList);i++) + { + RADIUS_AVP *avp = LIST_DATA(p->AvpList, i); + + if (avp->Type == type) + { + return avp; + } + } + + return NULL; +} + +// Free a RADIUS packet +void FreeRadiusPacket(RADIUS_PACKET *p) +{ + UINT i; + if (p == NULL) + { + return; + } + + if (p->AvpList != NULL) + { + for (i = 0;i < LIST_NUM(p->AvpList);i++) + { + RADIUS_AVP *a = LIST_DATA(p->AvpList, i); + + Free(a); + } + + ReleaseList(p->AvpList); + } + + Free(p->Parse_EapMessage); + + Free(p); +} + +// Generate a RADIUS packet +BUF *GenerateRadiusPacket(RADIUS_PACKET *p, char *shared_secret) +{ + BUF *b; + UINT i; + UCHAR zero16[16]; + UINT len_pos = 0; + UINT eap_auth_pos = 0; + bool exist_eap_msg = false; + bool exist_eap_auth = false; + if (p == NULL) + { + return NULL; + } + + Zero(zero16, sizeof(zero16)); + + // Add EAP message auth packet + for (i = 0;i < LIST_NUM(p->AvpList);i++) + { + RADIUS_AVP *a = (RADIUS_AVP *)LIST_DATA(p->AvpList, i); + + if (a->Type == RADIUS_ATTRIBUTE_EAP_MESSAGE) + { + exist_eap_msg = true; + } + if (a->Type == RADIUS_ATTRIBUTE_EAP_AUTHENTICATOR) + { + exist_eap_auth = true; + } + } + + if (exist_eap_msg && exist_eap_auth == false) + { + RADIUS_AVP *a = NewRadiusAvp(RADIUS_ATTRIBUTE_EAP_AUTHENTICATOR, 0, 0, zero16, sizeof(zero16)); + + Add(p->AvpList, a); + } + + if (IsZero(p->Authenticator, 16)) + { + UCHAR rand16[16]; + + Rand(rand16, sizeof(rand16)); + Copy(p->Authenticator, rand16, 16); + } + + b = NewBuf(); + + WriteBufChar(b, p->Code); + WriteBufChar(b, p->PacketId); + len_pos = b->Current; + WriteBufShort(b, 0); + WriteBuf(b, p->Authenticator, 16); + + for (i = 0;i < LIST_NUM(p->AvpList);i++) + { + RADIUS_AVP *a = (RADIUS_AVP *)LIST_DATA(p->AvpList, i); + + WriteBufChar(b, a->Type); + + if (a->Type != RADIUS_ATTRIBUTE_VENDOR_SPECIFIC) + { + WriteBufChar(b, (UCHAR)((UINT)a->DataSize + 2)); + + if (a->Type == RADIUS_ATTRIBUTE_EAP_AUTHENTICATOR) + { + eap_auth_pos = b->Current; + + if (a->DataSize == 16) + { + Zero(a->Data, sizeof(a->Data)); + } + } + + WriteBuf(b, a->Data, a->DataSize); + } + else + { + WriteBufChar(b, (UCHAR)((UINT)a->DataSize + 8)); + WriteBufInt(b, a->VendorId); + WriteBufChar(b, a->VendorCode); + WriteBufChar(b, (UCHAR)((UINT)a->DataSize + 2)); + WriteBuf(b, a->Data, a->DataSize); + } + } + + WRITE_USHORT(((UCHAR *)b->Buf) + len_pos, b->Size); + + if (eap_auth_pos != 0) + { + UCHAR eap_auth[16]; + + HMacMd5(eap_auth, shared_secret, StrLen(shared_secret), b->Buf, b->Size); + + Copy(((UCHAR *)b->Buf) + eap_auth_pos, eap_auth, 16); + } + + SeekBufToBegin(b); + + return b; +} + +// Parse a RADIUS packet +RADIUS_PACKET *ParseRadiusPacket(void *data, UINT size) +{ + RADIUS_PACKET *p = NULL; + BUF *buf = NULL; + USHORT len; + UCHAR auth[16]; + if (data == NULL || size == 0) + { + return NULL; + } + + p = ZeroMalloc(sizeof(RADIUS_PACKET)); + + p->AvpList = NewListFast(NULL); + + buf = MemToBuf(data, size); + + // Code + p->Code = ReadBufChar(buf); + p->PacketId = ReadBufChar(buf); + len = ReadBufShort(buf); + + p->Parse_AuthenticatorPos = buf->Current; + if (ReadBuf(buf, auth, 16) != 16) + { + goto LABEL_ERROR; + } + + if ((UINT)len < 20) + { + goto LABEL_ERROR; + } + if ((UINT)len > buf->Size) + { + goto LABEL_ERROR; + } + else if ((UINT)len < buf->Size) + { + buf->Size = len; + } + + while (true) + { + RADIUS_AVP a; + UCHAR uc; + UINT data_size; + + Zero(&a, sizeof(a)); + + if (ReadBuf(buf, &a.Type, 1) == 0) + { + break; + } + + if (a.Type != RADIUS_ATTRIBUTE_VENDOR_SPECIFIC) + { + if (ReadBuf(buf, &uc, 1) == 0) + { + break; + } + + data_size = (UINT)uc; + + if (data_size < 2) + { + goto LABEL_ERROR; + } + + data_size -= 2; + + a.DataSize = (UCHAR)data_size; + + if (a.Type == RADIUS_ATTRIBUTE_EAP_AUTHENTICATOR && a.DataSize == 16) + { + p->Parse_EapAuthMessagePos = buf->Current; + } + + if (ReadBuf(buf, a.Data, a.DataSize) != a.DataSize) + { + goto LABEL_ERROR; + } + + if (a.Type == RADIUS_ATTRIBUTE_EAP_MESSAGE && a.DataSize >= 5) + { + UINT sz_tmp = Endian16(((EAP_MESSAGE *)a.Data)->Len); + + if (sz_tmp >= 5 && sz_tmp <= a.DataSize) + { + if (p->Parse_EapMessage == NULL) + { + EAP_MESSAGE *eap = Clone(a.Data, a.DataSize); + + p->Parse_EapMessage_DataSize = sz_tmp; + + p->Parse_EapMessage = eap; + } + } + } + } + else + { + if (ReadBuf(buf, &uc, 1) == 0) + { + break; + } + + data_size = (UINT)uc; + if (data_size < 8) + { + goto LABEL_ERROR; + } + + data_size -= 8; + + a.VendorId = ReadBufInt(buf); + a.VendorCode = ReadBufChar(buf); + if (ReadBuf(buf, &uc, 1) == 0) + { + break; + } + + if (((UINT)uc - 2) != data_size) + { + goto LABEL_ERROR; + } + + a.DataSize = (UINT)data_size; + + if (ReadBuf(buf, a.Data, a.DataSize) != a.DataSize) + { + goto LABEL_ERROR; + } + } + + Add(p->AvpList, Clone(&a, sizeof(RADIUS_AVP))); + } + + FreeBuf(buf); + + if (true) + { + UINT num, i; + RADIUS_AVP *avp = GetRadiusAvp(p, RADIUS_ATTRIBUTE_STATE); + + if (avp != NULL) + { + Copy(p->Parse_State, avp->Data, avp->DataSize); + p->Parse_StateSize = avp->DataSize; + } + + num = 0; + for (i = 0;i < LIST_NUM(p->AvpList);i++) + { + RADIUS_AVP *avp = LIST_DATA(p->AvpList, i); + + if (avp->Type == RADIUS_ATTRIBUTE_EAP_MESSAGE) + { + num++; + } + } + + if (num >= 2) + { + // Reassemble multiple EAP messages + BUF *b = NewBuf(); + + for (i = 0;i < LIST_NUM(p->AvpList);i++) + { + RADIUS_AVP *avp = LIST_DATA(p->AvpList, i); + + if (avp->Type == RADIUS_ATTRIBUTE_EAP_MESSAGE) + { + WriteBuf(b, avp->Data, avp->DataSize); + } + } + + if (Endian16(((EAP_MESSAGE *)b->Buf)->Len) <= b->Size) + { + if (p->Parse_EapMessage != NULL) + { + Free(p->Parse_EapMessage); + } + + p->Parse_EapMessage_DataSize = b->Size; + p->Parse_EapMessage_DataSize = MIN(p->Parse_EapMessage_DataSize, 1500); + p->Parse_EapMessage = Clone(b->Buf, p->Parse_EapMessage_DataSize); + } + + FreeBuf(b); + } + } + + return p; + +LABEL_ERROR: + + FreeRadiusPacket(p); + FreeBuf(buf); + + return NULL; +} + + +////////// Classical implementation + +// Attempts Radius authentication (with specifying retry interval and multiple server) +bool RadiusLogin(CONNECTION *c, char *server, UINT port, UCHAR *secret, UINT secret_size, wchar_t *username, char *password, UINT interval, UCHAR *mschap_v2_server_response_20, + RADIUS_LOGIN_OPTION *opt, char *hubname) +{ + UCHAR random[MD5_SIZE]; + UCHAR id; + BUF *encrypted_password = NULL; + BUF *user_name = NULL; + //IP ip; + bool ret = false; + TOKEN_LIST *token; + UINT i; + LIST *ip_list; + IPC_MSCHAP_V2_AUTHINFO mschap; + bool is_mschap; + char client_ip_str[MAX_SIZE]; + RADIUS_LOGIN_OPTION opt_dummy; + static UINT packet_id = 0; + // Validate arguments + if (server == NULL || port == 0 || (secret_size != 0 && secret == NULL) || username == NULL || password == NULL) + { + return false; + } + + if (opt == NULL) + { + Zero(&opt_dummy, sizeof(opt_dummy)); + + opt = &opt_dummy; + } + + opt->Out_VLanId = 0; + + Zero(client_ip_str, sizeof(client_ip_str)); + if (c != NULL && c->FirstSock != NULL) + { + IPToStr(client_ip_str, sizeof(client_ip_str), &c->FirstSock->RemoteIP); + } + + // Parse the MS-CHAP v2 authentication data + Zero(&mschap, sizeof(mschap)); + is_mschap = ParseAndExtractMsChapV2InfoFromPassword(&mschap, password); + + if (is_mschap && mschap.MsChapV2_EapClient != NULL) + { + // Try the EAP authentication for RADIUS first + EAP_CLIENT *eap = mschap.MsChapV2_EapClient; + + if (IsEmptyStr(opt->In_VpnProtocolState) == false) + { + StrCpy(eap->In_VpnProtocolState, sizeof(eap->In_VpnProtocolState), opt->In_VpnProtocolState); + } + + if (eap->PeapMode == false) + { + ret = EapClientSendMsChapv2AuthClientResponse(eap, mschap.MsChapV2_ClientResponse, + mschap.MsChapV2_ClientChallenge); + } + else + { + ret = PeapClientSendMsChapv2AuthClientResponse(eap, mschap.MsChapV2_ClientResponse, + mschap.MsChapV2_ClientChallenge); + } + + if (ret) + { + Copy(mschap_v2_server_response_20, eap->ServerResponse, 20); + + if (opt->In_CheckVLanId) + { + opt->Out_VLanId = eap->LastRecvVLanId; + } + + Copy(opt->Out_VirtualMacAddress, eap->LastRecvVirtualMacAddress, 6); + + return true; + } + else + { + return false; + } + } + + // Split the server into tokens + token = ParseToken(server, " ,;\t"); + + // Get the IP address of the server + ip_list = NewListFast(NULL); + for(i = 0; i < token->NumTokens; i++) + { + IP *tmp_ip = Malloc(sizeof(IP)); + if (GetIP(tmp_ip, token->Token[i])) + { + Add(ip_list, tmp_ip); + } + else if (GetIPEx(tmp_ip, token->Token[i], true)) + { + Add(ip_list, tmp_ip); + } + else + { + Free(tmp_ip); + } + } + + FreeToken(token); + + if(LIST_NUM(ip_list) == 0) + { + ReleaseList(ip_list); + return false; + } + + // Random number generation + Rand(random, sizeof(random)); + + // ID generation + id = (UCHAR)(packet_id % 254 + 1); + packet_id++; + + if (is_mschap == false) + { + // Encrypt the password + encrypted_password = RadiusEncryptPassword(password, random, secret, secret_size); + if (encrypted_password == NULL) + { + // Encryption failure + + // Release the ip_list + for(i = 0; i < LIST_NUM(ip_list); i++) + { + IP *tmp_ip = LIST_DATA(ip_list, i); + Free(tmp_ip); + } + ReleaseList(ip_list); + return false; + } + } + + // Generate the user name packet + user_name = RadiusCreateUserName(username); + + if (user_name != NULL) + { + // Generate a password packet + BUF *user_password = (is_mschap ? NULL : RadiusCreateUserPassword(encrypted_password->Buf, encrypted_password->Size)); + BUF *nas_id; + + if (IsEmptyStr(opt->NasId)) + { + nas_id = RadiusCreateNasId(CEDAR_SERVER_STR); + } + else + { + nas_id = RadiusCreateNasId(opt->NasId); + } + + if (is_mschap || user_password != NULL) + { + UINT64 start; + UINT64 next_send_time; + UCHAR tmp[MAX_SIZE]; + UINT recv_buf_size = 32768; + UCHAR *recv_buf = MallocEx(recv_buf_size, true); + // Generate an UDP packet + BUF *p = NewBuf(); + UCHAR type = 1; + SOCK *sock; + USHORT sz = 0; + UINT pos = 0; + BOOL *finish = ZeroMallocEx(sizeof(BOOL) * LIST_NUM(ip_list), true); + + Zero(tmp, sizeof(tmp)); + + WriteBuf(p, &type, 1); + WriteBuf(p, &id, 1); + WriteBuf(p, &sz, 2); + WriteBuf(p, random, 16); + WriteBuf(p, user_name->Buf, user_name->Size); + + if (is_mschap == false) + { + UINT ui; + // PAP + WriteBuf(p, user_password->Buf, user_password->Size); + WriteBuf(p, nas_id->Buf, nas_id->Size); + + // Service-Type + ui = Endian32(2); + RadiusAddValue(p, RADIUS_ATTRIBUTE_SERVICE_TYPE, 0, 0, &ui, sizeof(ui)); + + // NAS-Port-Type + ui = Endian32(5); + RadiusAddValue(p, RADIUS_ATTRIBUTE_NAS_PORT_TYPE, 0, 0, &ui, sizeof(ui)); + + // Tunnel-Type + ui = Endian32(1); + RadiusAddValue(p, RADIUS_ATTRIBUTE_TUNNEL_TYPE, 0, 0, &ui, sizeof(ui)); + + // Tunnel-Medium-Type + ui = Endian32(1); + RadiusAddValue(p, RADIUS_ATTRIBUTE_TUNNEL_MEDIUM_TYPE, 0, 0, &ui, sizeof(ui)); + + // Called-Station-ID - VPN Hub Name + if (IsEmptyStr(hubname) == false) + { + RadiusAddValue(p, RADIUS_ATTRIBUTE_CALLED_STATION_ID, 0, 0, hubname, StrLen(hubname)); + } + + // Calling-Station-Id + RadiusAddValue(p, RADIUS_ATTRIBUTE_CALLING_STATION_ID, 0, 0, client_ip_str, StrLen(client_ip_str)); + + // Tunnel-Client-Endpoint + RadiusAddValue(p, RADIUS_ATTRIBUTE_TUNNEL_CLIENT_ENDPOINT, 0, 0, client_ip_str, StrLen(client_ip_str)); + } + else + { + // MS-CHAP v2 + static UINT session_id = 0; + USHORT us; + UINT ui; + char *ms_ras_version = "MSRASV5.20"; + UCHAR ms_chapv2_response[50]; + + // Acct-Session-Id + us = Endian16(session_id % 254 + 1); + session_id++; + RadiusAddValue(p, RADIUS_ATTRIBUTE_ACCT_SESSION_ID, 0, 0, &us, sizeof(us)); + + // NAS-IP-Address + if (c != NULL && c->FirstSock != NULL && c->FirstSock->IPv6 == false) + { + ui = IPToUINT(&c->FirstSock->LocalIP); + RadiusAddValue(p, RADIUS_ATTRIBUTE_NAS_IP, 0, 0, &ui, sizeof(ui)); + } + + // Service-Type + ui = Endian32(2); + RadiusAddValue(p, RADIUS_ATTRIBUTE_SERVICE_TYPE, 0, 0, &ui, sizeof(ui)); + + // MS-RAS-Vendor + ui = Endian32(RADIUS_VENDOR_MICROSOFT); + RadiusAddValue(p, RADIUS_ATTRIBUTE_VENDOR_SPECIFIC, RADIUS_VENDOR_MICROSOFT, RADIUS_MS_RAS_VENDOR, &ui, sizeof(ui)); + + // MS-RAS-Version + RadiusAddValue(p, RADIUS_ATTRIBUTE_VENDOR_SPECIFIC, RADIUS_VENDOR_MICROSOFT, RADIUS_MS_VERSION, ms_ras_version, StrLen(ms_ras_version)); + + // NAS-Port-Type + ui = Endian32(5); + RadiusAddValue(p, RADIUS_ATTRIBUTE_NAS_PORT_TYPE, 0, 0, &ui, sizeof(ui)); + + // Tunnel-Type + ui = Endian32(1); + RadiusAddValue(p, RADIUS_ATTRIBUTE_TUNNEL_TYPE, 0, 0, &ui, sizeof(ui)); + + // Tunnel-Medium-Type + ui = Endian32(1); + RadiusAddValue(p, RADIUS_ATTRIBUTE_TUNNEL_MEDIUM_TYPE, 0, 0, &ui, sizeof(ui)); + + // Called-Station-ID - VPN Hub Name + if (IsEmptyStr(hubname) == false) + { + RadiusAddValue(p, RADIUS_ATTRIBUTE_CALLED_STATION_ID, 0, 0, hubname, StrLen(hubname)); + } + + // Calling-Station-Id + RadiusAddValue(p, RADIUS_ATTRIBUTE_CALLING_STATION_ID, 0, 0, client_ip_str, StrLen(client_ip_str)); + + // Tunnel-Client-Endpoint + RadiusAddValue(p, RADIUS_ATTRIBUTE_TUNNEL_CLIENT_ENDPOINT, 0, 0, client_ip_str, StrLen(client_ip_str)); + + // MS-RAS-Client-Version + RadiusAddValue(p, RADIUS_ATTRIBUTE_VENDOR_SPECIFIC, RADIUS_VENDOR_MICROSOFT, RADIUS_MS_RAS_CLIENT_VERSION, ms_ras_version, StrLen(ms_ras_version)); + + // MS-RAS-Client-Name + RadiusAddValue(p, RADIUS_ATTRIBUTE_VENDOR_SPECIFIC, RADIUS_VENDOR_MICROSOFT, RADIUS_MS_RAS_CLIENT_NAME, client_ip_str, StrLen(client_ip_str)); + + // MS-CHAP-Challenge + RadiusAddValue(p, RADIUS_ATTRIBUTE_VENDOR_SPECIFIC, RADIUS_VENDOR_MICROSOFT, RADIUS_MS_CHAP_CHALLENGE, mschap.MsChapV2_ServerChallenge, sizeof(mschap.MsChapV2_ServerChallenge)); + + // MS-CHAP2-Response + Zero(ms_chapv2_response, sizeof(ms_chapv2_response)); + Copy(ms_chapv2_response + 2, mschap.MsChapV2_ClientChallenge, 16); + Copy(ms_chapv2_response + 2 + 16 + 8, mschap.MsChapV2_ClientResponse, 24); + RadiusAddValue(p, RADIUS_ATTRIBUTE_VENDOR_SPECIFIC, RADIUS_VENDOR_MICROSOFT, RADIUS_MS_CHAP2_RESPONSE, ms_chapv2_response, sizeof(ms_chapv2_response)); + + // NAS-ID + WriteBuf(p, nas_id->Buf, nas_id->Size); + } + + if (IsEmptyStr(opt->In_VpnProtocolState) == false) + { + // Proxy state as protocol details + RadiusAddValue(p, RADIUS_ATTRIBUTE_PROXY_STATE, 0, 0, opt->In_VpnProtocolState, StrLen(opt->In_VpnProtocolState)); + } + + SeekBuf(p, 0, 0); + + WRITE_USHORT(((UCHAR *)p->Buf) + 2, (USHORT)p->Size); + + // Create a socket + sock = NewUDPEx(0, IsIP6(LIST_DATA(ip_list, pos))); + + // Transmission process start + start = Tick64(); + if(interval < RADIUS_RETRY_INTERVAL) + { + interval = RADIUS_RETRY_INTERVAL; + } + else if(interval > RADIUS_RETRY_TIMEOUT) + { + interval = RADIUS_RETRY_TIMEOUT; + } + next_send_time = start + (UINT64)interval; + + while (true) + { + UINT server_port; + UINT recv_size; + //IP server_ip; + SOCKSET set; + UINT64 now; + +SEND_RETRY: + //SendTo(sock, &ip, port, p->Buf, p->Size); + SendTo(sock, LIST_DATA(ip_list, pos), port, p->Buf, p->Size); + + Debug("send to host:%u\n", pos); + + next_send_time = Tick64() + (UINT64)interval; + +RECV_RETRY: + now = Tick64(); + if (next_send_time <= now) + { + // Switch the host to refer + pos++; + pos = pos % LIST_NUM(ip_list); + + goto SEND_RETRY; + } + + if ((start + RADIUS_RETRY_TIMEOUT) < now) + { + // Time-out + break; + } + + InitSockSet(&set); + AddSockSet(&set, sock); + Select(&set, (UINT)(next_send_time - now), NULL, NULL); + + recv_size = RecvFrom(sock, LIST_DATA(ip_list, pos), &server_port, recv_buf, recv_buf_size); + + if (recv_size == 0) + { + Debug("Radius recv_size 0\n"); + finish[pos] = true; + for (i = 0; i < LIST_NUM(ip_list); ++i) + { + if (finish[i] == false) + { + // Switch the host to refer + pos++; + pos = pos % LIST_NUM(ip_list); + goto SEND_RETRY; + } + } + // Failure + break; + } + else if (recv_size == SOCK_LATER) + { + // Waiting + goto RECV_RETRY; + } + else + { + // Check such as the IP address + if (/*Cmp(&server_ip, &ip, sizeof(IP)) != 0 || */server_port != port) + { + goto RECV_RETRY; + } + // Success + if (recv_buf[0] == 2) + { + LIST *o; + BUF *buf = NewBufFromMemory(recv_buf, recv_size); + + ret = true; + + if (is_mschap && mschap_v2_server_response_20 != NULL) + { + // Cutting corners Zurukko + UCHAR signature[] = {0x1A, 0x33, 0x00, 0x00, 0x01, 0x37, 0x1A, 0x2D, 0x00, 0x53, 0x3D, }; + UINT i = SearchBin(recv_buf, 0, recv_buf_size, signature, sizeof(signature)); + + if (i == INFINITE || ((i + sizeof(signature) + 40) > recv_buf_size)) + { + ret = false; + } + else + { + char tmp[MAX_SIZE]; + BUF *b; + + Zero(tmp, sizeof(tmp)); + Copy(tmp, recv_buf + i + sizeof(signature), 40); + + b = StrToBin(tmp); + + if (b != NULL && b->Size == 20) + { + WHERE; + Copy(mschap_v2_server_response_20, b->Buf, 20); + } + else + { + WHERE; + ret = false; + } + + FreeBuf(b); + } + } + + o = RadiusParseOptions(buf); + if (o != NULL) + { + DHCP_OPTION *framed_interface_id_option = GetDhcpOption(o, RADIUS_ATTRIBUTE_FRAMED_INTERFACE_ID); + + if (framed_interface_id_option != NULL) + { + char tmp_str[64]; + UCHAR mac_address[6]; + + Zero(tmp_str, sizeof(tmp_str)); + Copy(tmp_str, framed_interface_id_option->Data, MIN(framed_interface_id_option->Size, sizeof(tmp_str) - 1)); + + if (StrToMac(mac_address, tmp_str)) + { + Copy(opt->Out_VirtualMacAddress, mac_address, 6); + } + } + + if (opt->In_CheckVLanId) + { + DHCP_OPTION *vlan_option = GetDhcpOption(o, RADIUS_ATTRIBUTE_VLAN_ID); + + if (vlan_option != NULL) + { + UINT vlan_id = 0; + char tmp[32]; + + Zero(tmp, sizeof(tmp)); + + Copy(tmp, vlan_option->Data, MIN(vlan_option->Size, sizeof(tmp) - 1)); + + vlan_id = ToInt(tmp); + + opt->Out_VLanId = vlan_id; + } + } + + FreeDhcpOptions(o); + } + + FreeBuf(buf); + } + break; + } + } + + Free(finish); + + // Release the socket + ReleaseSock(sock); + + FreeBuf(p); + FreeBuf(user_password); + + Free(recv_buf); + } + + FreeBuf(nas_id); + FreeBuf(user_name); + } + + // Release the ip_list + for(i = 0; i < LIST_NUM(ip_list); i++) + { + IP *tmp_ip = LIST_DATA(ip_list, i); + Free(tmp_ip); + } + ReleaseList(ip_list); + + // Release the memory + FreeBuf(encrypted_password); + + return ret; +} + +// Parse RADIUS attributes +LIST *RadiusParseOptions(BUF *b) +{ + LIST *o; + UCHAR code; + UCHAR id; + USHORT len; + UCHAR auth[16]; + // Validate arguments + if (b == NULL) + { + return NULL; + } + + o = NewList(NULL); + + ReadBuf(b, &code, 1); + ReadBuf(b, &id, 1); + len = 0; + ReadBuf(b, &len, 2); + len = Endian16(len); + ReadBuf(b, auth, 16); + + while (true) + { + UCHAR attribute_id; + UCHAR size; + UCHAR data[256]; + DHCP_OPTION *d; + + if (ReadBuf(b, &attribute_id, 1) != 1) + { + break; + } + + if (ReadBuf(b, &size, 1) != 1) + { + break; + } + + if (size <= 2) + { + break; + } + + size -= 2; + if (ReadBuf(b, data, size) != size) + { + break; + } + + d = ZeroMalloc(sizeof(DHCP_OPTION)); + d->Id = attribute_id; + d->Size = size; + d->Data = Clone(data, d->Size); + + Add(o, d); + } + + return o; +} + +// Adding Attributes +void RadiusAddValue(BUF *b, UCHAR t, UINT v, UCHAR vt, void *data, UINT size) +{ + UINT len; + // Validate arguments + if (b == NULL || (data == NULL && size != 0)) + { + return; + } + + // type + WriteBufChar(b, t); + + // length + len = 2 + size; + if (t == 26) + { + len += 6; + } + WriteBufChar(b, (UCHAR)len); + + if (t != 26) + { + // value + WriteBuf(b, data, size); + } + else + { + // vendor + WriteBufInt(b, v); + + // vendor type + WriteBufChar(b, vt); + + // length2 + len = size + 2; + WriteBufChar(b, (UCHAR)len); + + // value + WriteBuf(b, data, size); + } +} + +// Create a password attribute for Radius +BUF *RadiusCreateUserPassword(void *data, UINT size) +{ + BUF *b; + UCHAR code, sz; + // Validate arguments + if (size != 0 && data == NULL || size >= 253) + { + return NULL; + } + + b = NewBuf(); + code = 2; + sz = 2 + (UCHAR)size; + WriteBuf(b, &code, 1); + WriteBuf(b, &sz, 1); + WriteBuf(b, data, size); + + return b; +} + +// Generate an ID attribute of Nas +BUF *RadiusCreateNasId(char *name) +{ + BUF *b; + UCHAR code, size; + // Validate arguments + if (name == NULL) + { + return NULL; + } + if (StrLen(name) == 0 || StrLen(name) >= 128) + { + return NULL; + } + + b = NewBuf(); + code = 32; + size = 2 + (UCHAR)StrLen(name); + WriteBuf(b, &code, 1); + WriteBuf(b, &size, 1); + WriteBuf(b, name, StrLen(name)); + + return b; +} + +// Create a user name attribute for Radius +BUF *RadiusCreateUserName(wchar_t *username) +{ + BUF *b; + UCHAR code, size; + UCHAR utf8[254]; + // Validate arguments + if (username == NULL) + { + return NULL; + } + + // Convert the user name to a Unicode string + UniToStr(utf8, sizeof(utf8), username); + utf8[253] = 0; + + b = NewBuf(); + code = 1; + size = 2 + (UCHAR)StrLen(utf8); + WriteBuf(b, &code, 1); + WriteBuf(b, &size, 1); + WriteBuf(b, utf8, StrLen(utf8)); + + return b; +} + +// Encrypt the password for the Radius +BUF *RadiusEncryptPassword(char *password, UCHAR *random, UCHAR *secret, UINT secret_size) +{ + UINT n, i; + BUF *buf; + UCHAR c[16][16]; // Result + UCHAR b[16][16]; // Result + UCHAR p[16][16]; // Password + // Validate arguments + if (password == NULL || random == NULL || (secret_size != 0 && secret == NULL)) + { + return NULL; + } + if (StrLen(password) > 256) + { + // Password is too long + return NULL; + } + + // Initialize + Zero(c, sizeof(c)); + Zero(p, sizeof(p)); + Zero(b, sizeof(b)); + + // Divide the password per 16 characters + Copy(p, password, StrLen(password)); + // Calculate the number of blocks + n = StrLen(password) / 16; + if ((StrLen(password) % 16) != 0) + { + n++; + } + + // Encryption processing + for (i = 0;i < n;i++) + { + // Calculation of b[i] + UINT j; + BUF *tmp = NewBuf(); + WriteBuf(tmp, secret, secret_size); + if (i == 0) + { + WriteBuf(tmp, random, 16); + } + else + { + WriteBuf(tmp, c[i - 1], 16); + } + Md5(b[i], tmp->Buf, tmp->Size); + FreeBuf(tmp); + + // Calculation of c[i] + for (j = 0;j < 16;j++) + { + c[i][j] = p[i][j] ^ b[i][j]; + } + } + + // Return the results + buf = NewBuf(); + WriteBuf(buf, c, n * 16); + return buf; +} + diff --git a/src/Cedar/Radius.h b/src/Cedar/Radius.h index dbe46051..39af6749 100644 --- a/src/Cedar/Radius.h +++ b/src/Cedar/Radius.h @@ -1,292 +1,292 @@ -// SoftEther VPN Source Code - Developer Edition Master Branch -// Cedar Communication Module - - -// Radius.h -// Header of Radius.c - -#ifndef RADIUS_H -#define RADIUS_H - -#define RADIUS_DEFAULT_PORT 1812 // The default port number -#define RADIUS_RETRY_INTERVAL 1000 // Retransmission interval -#define RADIUS_RETRY_TIMEOUT (15 * 1000) // Time-out period, keep it 2FA friendly -#define RADIUS_INITIAL_EAP_TIMEOUT 1600 // Initial timeout for EAP - - -// RADIUS attributes -#define RADIUS_ATTRIBUTE_USER_NAME 1 -#define RADIUS_ATTRIBUTE_NAS_IP 4 -#define RADIUS_ATTRIBUTE_NAS_PORT 5 -#define RADIUS_ATTRIBUTE_SERVICE_TYPE 6 -#define RADIUS_ATTRIBUTE_FRAMED_PROTOCOL 7 -#define RADIUS_ATTRIBUTE_FRAMED_MTU 12 -#define RADIUS_ATTRIBUTE_STATE 24 -#define RADIUS_ATTRIBUTE_VENDOR_SPECIFIC 26 -#define RADIUS_ATTRIBUTE_CALLED_STATION_ID 30 -#define RADIUS_ATTRIBUTE_CALLING_STATION_ID 31 -#define RADIUS_ATTRIBUTE_NAS_ID 32 -#define RADIUS_ATTRIBUTE_PROXY_STATE 33 -#define RADIUS_ATTRIBUTE_ACCT_SESSION_ID 44 -#define RADIUS_ATTRIBUTE_NAS_PORT_TYPE 61 -#define RADIUS_ATTRIBUTE_TUNNEL_TYPE 64 -#define RADIUS_ATTRIBUTE_TUNNEL_MEDIUM_TYPE 65 -#define RADIUS_ATTRIBUTE_TUNNEL_CLIENT_ENDPOINT 66 -#define RADIUS_ATTRIBUTE_TUNNEL_SERVER_ENDPOINT 67 -#define RADIUS_ATTRIBUTE_EAP_MESSAGE 79 -#define RADIUS_ATTRIBUTE_EAP_AUTHENTICATOR 80 -#define RADIUS_ATTRIBUTE_VLAN_ID 81 -#define RADIUS_ATTRIBUTE_FRAMED_INTERFACE_ID 96 -#define RADIUS_MAX_NAS_ID_LEN 253 - -// RADIUS codes -#define RADIUS_CODE_ACCESS_REQUEST 1 -#define RADIUS_CODE_ACCESS_ACCEPT 2 -#define RADIUS_CODE_ACCESS_REJECT 3 -#define RADIUS_CODE_ACCESS_CHALLENGE 11 - -// RADIUS vendor ID -#define RADIUS_VENDOR_MICROSOFT 311 - -// RADIUS MS attributes -#define RADIUS_MS_RAS_VENDOR 9 -#define RADIUS_MS_CHAP_CHALLENGE 11 -#define RADIUS_MS_VERSION 18 -#define RADIUS_MS_CHAP2_RESPONSE 25 -#define RADIUS_MS_RAS_CLIENT_NAME 34 -#define RADIUS_MS_RAS_CLIENT_VERSION 35 -#define RADIUS_MS_NETWORK_ACCESS_SERVER_TYPE 47 -#define RADIUS_MS_RAS_CORRELATION 56 - -// EAP code -#define EAP_CODE_REQUEST 1 -#define EAP_CODE_RESPONSE 2 -#define EAP_CODE_SUCCESS 3 -#define EAP_CODE_FAILURE 4 - -// EAP type -#define EAP_TYPE_IDENTITY 1 -#define EAP_TYPE_LEGACY_NAK 3 -#define EAP_TYPE_PEAP 25 -#define EAP_TYPE_MS_AUTH 26 - -// MS-CHAPv2 opcodes -#define EAP_MSCHAPV2_OP_CHALLENGE 1 -#define EAP_MSCHAPV2_OP_RESPONSE 2 -#define EAP_MSCHAPV2_OP_SUCCESS 3 - -// EAP-TLS flags -#define EAP_TLS_FLAGS_LEN 0x80 -#define EAP_TLS_FLAGS_MORE_FRAGMENTS 0x40 -#define EAP_TLS_FLAGS_START 0x20 - - -////////// Modern implementation - -#ifdef OS_WIN32 -#pragma pack(push, 1) -#endif // OS_WIN32 - -struct EAP_MESSAGE -{ - UCHAR Code; - UCHAR Id; - USHORT Len; // = sizeof(Data) + 5 - UCHAR Type; - UCHAR Data[1500]; -} GCC_PACKED; - -struct EAP_MSCHAPV2_GENERAL -{ - UCHAR Code; - UCHAR Id; - USHORT Len; // = sizeof(Data) + 5 - UCHAR Type; - UCHAR Chap_Opcode; -} GCC_PACKED; - -struct EAP_MSCHAPV2_CHALLENGE -{ - UCHAR Code; - UCHAR Id; - USHORT Len; // = sizeof(Data) + 5 - UCHAR Type; - UCHAR Chap_Opcode; - UCHAR Chap_Id; - USHORT Chap_Len; - UCHAR Chap_ValueSize; // = 16 - UCHAR Chap_ChallengeValue[16]; - char Chap_Name[256]; -} GCC_PACKED; - -struct EAP_MSCHAPV2_RESPONSE -{ - UCHAR Code; - UCHAR Id; - USHORT Len; // = sizeof(Data) + 5 - UCHAR Type; - UCHAR Chap_Opcode; - UCHAR Chap_Id; - USHORT Chap_Len; - UCHAR Chap_ValueSize; // = 49 - UCHAR Chap_PeerChallenge[16]; - UCHAR Chap_Reserved[8]; - UCHAR Chap_NtResponse[24]; - UCHAR Chap_Flags; - char Chap_Name[256]; -} GCC_PACKED; - -struct EAP_MSCHAPV2_SUCCESS_SERVER -{ - UCHAR Code; - UCHAR Id; - USHORT Len; // = sizeof(Data) + 5 - UCHAR Type; - UCHAR Chap_Opcode; - UCHAR Chap_Id; - USHORT Chap_Len; - char Message[256]; -} GCC_PACKED; - -struct EAP_MSCHAPV2_SUCCESS_CLIENT -{ - UCHAR Code; - UCHAR Id; - USHORT Len; // = sizeof(Data) + 5 - UCHAR Type; - UCHAR Chap_Opcode; -} GCC_PACKED; - -struct EAP_PEAP -{ - UCHAR Code; - UCHAR Id; - USHORT Len; // = sizeof(Data) + 5 - UCHAR Type; - UCHAR TlsFlags; -} GCC_PACKED; - -#ifdef OS_WIN32 -#pragma pack(pop) -#endif // OS_WIN32 - -struct RADIUS_PACKET -{ - UCHAR Code; - UCHAR PacketId; - LIST *AvpList; - UCHAR Authenticator[16]; - - UINT Parse_EapAuthMessagePos; - UINT Parse_AuthenticatorPos; - - EAP_MESSAGE *Parse_EapMessage; - UINT Parse_EapMessage_DataSize; - - UINT Parse_StateSize; - UCHAR Parse_State[256]; -}; - -struct RADIUS_AVP -{ - UCHAR Type; - UINT VendorId; - UCHAR VendorCode; - UCHAR Padding[3]; - UCHAR DataSize; - UCHAR Data[256]; -}; - -struct EAP_CLIENT -{ - REF *Ref; - - SOCK *UdpSock; - IP ServerIp; - UINT ServerPort; - char SharedSecret[MAX_SIZE]; - char ClientIpStr[256]; - char CalledStationStr[256]; - char Username[MAX_USERNAME_LEN + 1]; - UINT ResendTimeout; - UINT GiveupTimeout; - UCHAR TmpBuffer[4096]; - UCHAR NextEapId; - UCHAR LastRecvEapId; - - bool PeapMode; - - UCHAR LastState[256]; - UINT LastStateSize; - - EAP_MSCHAPV2_CHALLENGE MsChapV2Challenge; - EAP_MSCHAPV2_SUCCESS_SERVER MsChapV2Success; - UCHAR ServerResponse[20]; - - SSL_PIPE *SslPipe; - UCHAR NextRadiusPacketId; - - BUF *PEAP_CurrentReceivingMsg; - UINT PEAP_CurrentReceivingTotalSize; - UCHAR RecvLastCode; - - UINT LastRecvVLanId; - UCHAR LastRecvVirtualMacAddress[6]; - - char In_VpnProtocolState[64]; -}; - -void FreeRadiusPacket(RADIUS_PACKET *p); -BUF *GenerateRadiusPacket(RADIUS_PACKET *p, char *shared_secret); -RADIUS_PACKET *ParseRadiusPacket(void *data, UINT size); -RADIUS_PACKET *NewRadiusPacket(UCHAR code, UCHAR packet_id); -RADIUS_AVP *NewRadiusAvp(UCHAR type, UINT vendor_id, UCHAR vendor_code, void *data, UINT size); -RADIUS_AVP *GetRadiusAvp(RADIUS_PACKET *p, UCHAR type); -void RadiusTest(); - - -EAP_CLIENT *NewEapClient(IP *server_ip, UINT server_port, char *shared_secret, UINT resend_timeout, UINT giveup_timeout, char *client_ip_str, char *username, char *hubname); -void ReleaseEapClient(EAP_CLIENT *e); -void CleanupEapClient(EAP_CLIENT *e); -bool EapClientSendMsChapv2AuthRequest(EAP_CLIENT *e); -bool EapClientSendMsChapv2AuthClientResponse(EAP_CLIENT *e, UCHAR *client_response, UCHAR *client_challenge); -void EapSetRadiusGeneralAttributes(RADIUS_PACKET *r, EAP_CLIENT *e); -bool EapSendPacket(EAP_CLIENT *e, RADIUS_PACKET *r); -RADIUS_PACKET *EapSendPacketAndRecvResponse(EAP_CLIENT *e, RADIUS_PACKET *r); - -bool PeapClientSendMsChapv2AuthRequest(EAP_CLIENT *eap); -bool PeapClientSendMsChapv2AuthClientResponse(EAP_CLIENT *e, UCHAR *client_response, UCHAR *client_challenge); - -bool StartPeapClient(EAP_CLIENT *e); -bool StartPeapSslClient(EAP_CLIENT *e); -bool SendPeapRawPacket(EAP_CLIENT *e, UCHAR *peap_data, UINT peap_size); -bool SendPeapPacket(EAP_CLIENT *e, void *msg, UINT msg_size); -bool GetRecvPeapMessage(EAP_CLIENT *e, EAP_MESSAGE *msg); - - -////////// Classical implementation -struct RADIUS_LOGIN_OPTION -{ - bool In_CheckVLanId; - bool In_DenyNoVlanId; - UINT Out_VLanId; - bool Out_IsRadiusLogin; - char NasId[RADIUS_MAX_NAS_ID_LEN + 1]; // NAS-Identifier - char Out_VirtualMacAddress[6]; - char In_VpnProtocolState[64]; -}; - -// Function prototype -bool RadiusLogin(CONNECTION *c, char *server, UINT port, UCHAR *secret, UINT secret_size, wchar_t *username, char *password, UINT interval, UCHAR *mschap_v2_server_response_20, - RADIUS_LOGIN_OPTION *opt, char *hubname); -BUF *RadiusEncryptPassword(char *password, UCHAR *random, UCHAR *secret, UINT secret_size); -BUF *RadiusCreateUserName(wchar_t *username); -BUF *RadiusCreateUserPassword(void *data, UINT size); -BUF *RadiusCreateNasId(char *name); -void RadiusAddValue(BUF *b, UCHAR t, UINT v, UCHAR vt, void *data, UINT size); -LIST *RadiusParseOptions(BUF *b); - -#endif // RADIUS_H - - - +// SoftEther VPN Source Code - Developer Edition Master Branch +// Cedar Communication Module + + +// Radius.h +// Header of Radius.c + +#ifndef RADIUS_H +#define RADIUS_H + +#define RADIUS_DEFAULT_PORT 1812 // The default port number +#define RADIUS_RETRY_INTERVAL 1000 // Retransmission interval +#define RADIUS_RETRY_TIMEOUT (15 * 1000) // Time-out period, keep it 2FA friendly +#define RADIUS_INITIAL_EAP_TIMEOUT 1600 // Initial timeout for EAP + + +// RADIUS attributes +#define RADIUS_ATTRIBUTE_USER_NAME 1 +#define RADIUS_ATTRIBUTE_NAS_IP 4 +#define RADIUS_ATTRIBUTE_NAS_PORT 5 +#define RADIUS_ATTRIBUTE_SERVICE_TYPE 6 +#define RADIUS_ATTRIBUTE_FRAMED_PROTOCOL 7 +#define RADIUS_ATTRIBUTE_FRAMED_MTU 12 +#define RADIUS_ATTRIBUTE_STATE 24 +#define RADIUS_ATTRIBUTE_VENDOR_SPECIFIC 26 +#define RADIUS_ATTRIBUTE_CALLED_STATION_ID 30 +#define RADIUS_ATTRIBUTE_CALLING_STATION_ID 31 +#define RADIUS_ATTRIBUTE_NAS_ID 32 +#define RADIUS_ATTRIBUTE_PROXY_STATE 33 +#define RADIUS_ATTRIBUTE_ACCT_SESSION_ID 44 +#define RADIUS_ATTRIBUTE_NAS_PORT_TYPE 61 +#define RADIUS_ATTRIBUTE_TUNNEL_TYPE 64 +#define RADIUS_ATTRIBUTE_TUNNEL_MEDIUM_TYPE 65 +#define RADIUS_ATTRIBUTE_TUNNEL_CLIENT_ENDPOINT 66 +#define RADIUS_ATTRIBUTE_TUNNEL_SERVER_ENDPOINT 67 +#define RADIUS_ATTRIBUTE_EAP_MESSAGE 79 +#define RADIUS_ATTRIBUTE_EAP_AUTHENTICATOR 80 +#define RADIUS_ATTRIBUTE_VLAN_ID 81 +#define RADIUS_ATTRIBUTE_FRAMED_INTERFACE_ID 96 +#define RADIUS_MAX_NAS_ID_LEN 253 + +// RADIUS codes +#define RADIUS_CODE_ACCESS_REQUEST 1 +#define RADIUS_CODE_ACCESS_ACCEPT 2 +#define RADIUS_CODE_ACCESS_REJECT 3 +#define RADIUS_CODE_ACCESS_CHALLENGE 11 + +// RADIUS vendor ID +#define RADIUS_VENDOR_MICROSOFT 311 + +// RADIUS MS attributes +#define RADIUS_MS_RAS_VENDOR 9 +#define RADIUS_MS_CHAP_CHALLENGE 11 +#define RADIUS_MS_VERSION 18 +#define RADIUS_MS_CHAP2_RESPONSE 25 +#define RADIUS_MS_RAS_CLIENT_NAME 34 +#define RADIUS_MS_RAS_CLIENT_VERSION 35 +#define RADIUS_MS_NETWORK_ACCESS_SERVER_TYPE 47 +#define RADIUS_MS_RAS_CORRELATION 56 + +// EAP code +#define EAP_CODE_REQUEST 1 +#define EAP_CODE_RESPONSE 2 +#define EAP_CODE_SUCCESS 3 +#define EAP_CODE_FAILURE 4 + +// EAP type +#define EAP_TYPE_IDENTITY 1 +#define EAP_TYPE_LEGACY_NAK 3 +#define EAP_TYPE_PEAP 25 +#define EAP_TYPE_MS_AUTH 26 + +// MS-CHAPv2 opcodes +#define EAP_MSCHAPV2_OP_CHALLENGE 1 +#define EAP_MSCHAPV2_OP_RESPONSE 2 +#define EAP_MSCHAPV2_OP_SUCCESS 3 + +// EAP-TLS flags +#define EAP_TLS_FLAGS_LEN 0x80 +#define EAP_TLS_FLAGS_MORE_FRAGMENTS 0x40 +#define EAP_TLS_FLAGS_START 0x20 + + +////////// Modern implementation + +#ifdef OS_WIN32 +#pragma pack(push, 1) +#endif // OS_WIN32 + +struct EAP_MESSAGE +{ + UCHAR Code; + UCHAR Id; + USHORT Len; // = sizeof(Data) + 5 + UCHAR Type; + UCHAR Data[1500]; +} GCC_PACKED; + +struct EAP_MSCHAPV2_GENERAL +{ + UCHAR Code; + UCHAR Id; + USHORT Len; // = sizeof(Data) + 5 + UCHAR Type; + UCHAR Chap_Opcode; +} GCC_PACKED; + +struct EAP_MSCHAPV2_CHALLENGE +{ + UCHAR Code; + UCHAR Id; + USHORT Len; // = sizeof(Data) + 5 + UCHAR Type; + UCHAR Chap_Opcode; + UCHAR Chap_Id; + USHORT Chap_Len; + UCHAR Chap_ValueSize; // = 16 + UCHAR Chap_ChallengeValue[16]; + char Chap_Name[256]; +} GCC_PACKED; + +struct EAP_MSCHAPV2_RESPONSE +{ + UCHAR Code; + UCHAR Id; + USHORT Len; // = sizeof(Data) + 5 + UCHAR Type; + UCHAR Chap_Opcode; + UCHAR Chap_Id; + USHORT Chap_Len; + UCHAR Chap_ValueSize; // = 49 + UCHAR Chap_PeerChallenge[16]; + UCHAR Chap_Reserved[8]; + UCHAR Chap_NtResponse[24]; + UCHAR Chap_Flags; + char Chap_Name[256]; +} GCC_PACKED; + +struct EAP_MSCHAPV2_SUCCESS_SERVER +{ + UCHAR Code; + UCHAR Id; + USHORT Len; // = sizeof(Data) + 5 + UCHAR Type; + UCHAR Chap_Opcode; + UCHAR Chap_Id; + USHORT Chap_Len; + char Message[256]; +} GCC_PACKED; + +struct EAP_MSCHAPV2_SUCCESS_CLIENT +{ + UCHAR Code; + UCHAR Id; + USHORT Len; // = sizeof(Data) + 5 + UCHAR Type; + UCHAR Chap_Opcode; +} GCC_PACKED; + +struct EAP_PEAP +{ + UCHAR Code; + UCHAR Id; + USHORT Len; // = sizeof(Data) + 5 + UCHAR Type; + UCHAR TlsFlags; +} GCC_PACKED; + +#ifdef OS_WIN32 +#pragma pack(pop) +#endif // OS_WIN32 + +struct RADIUS_PACKET +{ + UCHAR Code; + UCHAR PacketId; + LIST *AvpList; + UCHAR Authenticator[16]; + + UINT Parse_EapAuthMessagePos; + UINT Parse_AuthenticatorPos; + + EAP_MESSAGE *Parse_EapMessage; + UINT Parse_EapMessage_DataSize; + + UINT Parse_StateSize; + UCHAR Parse_State[256]; +}; + +struct RADIUS_AVP +{ + UCHAR Type; + UINT VendorId; + UCHAR VendorCode; + UCHAR Padding[3]; + UCHAR DataSize; + UCHAR Data[256]; +}; + +struct EAP_CLIENT +{ + REF *Ref; + + SOCK *UdpSock; + IP ServerIp; + UINT ServerPort; + char SharedSecret[MAX_SIZE]; + char ClientIpStr[256]; + char CalledStationStr[256]; + char Username[MAX_USERNAME_LEN + 1]; + UINT ResendTimeout; + UINT GiveupTimeout; + UCHAR TmpBuffer[4096]; + UCHAR NextEapId; + UCHAR LastRecvEapId; + + bool PeapMode; + + UCHAR LastState[256]; + UINT LastStateSize; + + EAP_MSCHAPV2_CHALLENGE MsChapV2Challenge; + EAP_MSCHAPV2_SUCCESS_SERVER MsChapV2Success; + UCHAR ServerResponse[20]; + + SSL_PIPE *SslPipe; + UCHAR NextRadiusPacketId; + + BUF *PEAP_CurrentReceivingMsg; + UINT PEAP_CurrentReceivingTotalSize; + UCHAR RecvLastCode; + + UINT LastRecvVLanId; + UCHAR LastRecvVirtualMacAddress[6]; + + char In_VpnProtocolState[64]; +}; + +void FreeRadiusPacket(RADIUS_PACKET *p); +BUF *GenerateRadiusPacket(RADIUS_PACKET *p, char *shared_secret); +RADIUS_PACKET *ParseRadiusPacket(void *data, UINT size); +RADIUS_PACKET *NewRadiusPacket(UCHAR code, UCHAR packet_id); +RADIUS_AVP *NewRadiusAvp(UCHAR type, UINT vendor_id, UCHAR vendor_code, void *data, UINT size); +RADIUS_AVP *GetRadiusAvp(RADIUS_PACKET *p, UCHAR type); +void RadiusTest(); + + +EAP_CLIENT *NewEapClient(IP *server_ip, UINT server_port, char *shared_secret, UINT resend_timeout, UINT giveup_timeout, char *client_ip_str, char *username, char *hubname); +void ReleaseEapClient(EAP_CLIENT *e); +void CleanupEapClient(EAP_CLIENT *e); +bool EapClientSendMsChapv2AuthRequest(EAP_CLIENT *e); +bool EapClientSendMsChapv2AuthClientResponse(EAP_CLIENT *e, UCHAR *client_response, UCHAR *client_challenge); +void EapSetRadiusGeneralAttributes(RADIUS_PACKET *r, EAP_CLIENT *e); +bool EapSendPacket(EAP_CLIENT *e, RADIUS_PACKET *r); +RADIUS_PACKET *EapSendPacketAndRecvResponse(EAP_CLIENT *e, RADIUS_PACKET *r); + +bool PeapClientSendMsChapv2AuthRequest(EAP_CLIENT *eap); +bool PeapClientSendMsChapv2AuthClientResponse(EAP_CLIENT *e, UCHAR *client_response, UCHAR *client_challenge); + +bool StartPeapClient(EAP_CLIENT *e); +bool StartPeapSslClient(EAP_CLIENT *e); +bool SendPeapRawPacket(EAP_CLIENT *e, UCHAR *peap_data, UINT peap_size); +bool SendPeapPacket(EAP_CLIENT *e, void *msg, UINT msg_size); +bool GetRecvPeapMessage(EAP_CLIENT *e, EAP_MESSAGE *msg); + + +////////// Classical implementation +struct RADIUS_LOGIN_OPTION +{ + bool In_CheckVLanId; + bool In_DenyNoVlanId; + UINT Out_VLanId; + bool Out_IsRadiusLogin; + char NasId[RADIUS_MAX_NAS_ID_LEN + 1]; // NAS-Identifier + char Out_VirtualMacAddress[6]; + char In_VpnProtocolState[64]; +}; + +// Function prototype +bool RadiusLogin(CONNECTION *c, char *server, UINT port, UCHAR *secret, UINT secret_size, wchar_t *username, char *password, UINT interval, UCHAR *mschap_v2_server_response_20, + RADIUS_LOGIN_OPTION *opt, char *hubname); +BUF *RadiusEncryptPassword(char *password, UCHAR *random, UCHAR *secret, UINT secret_size); +BUF *RadiusCreateUserName(wchar_t *username); +BUF *RadiusCreateUserPassword(void *data, UINT size); +BUF *RadiusCreateNasId(char *name); +void RadiusAddValue(BUF *b, UCHAR t, UINT v, UCHAR vt, void *data, UINT size); +LIST *RadiusParseOptions(BUF *b); + +#endif // RADIUS_H + + + diff --git a/src/Cedar/Remote.c b/src/Cedar/Remote.c index 742c83c3..a230194a 100644 --- a/src/Cedar/Remote.c +++ b/src/Cedar/Remote.c @@ -1,376 +1,376 @@ -// SoftEther VPN Source Code - Developer Edition Master Branch -// Cedar Communication Module - - -// Remote.c -// Remote Procedure Call - -#include "CedarPch.h" - -// End of RPC -void EndRpc(RPC *rpc) -{ - RpcFree(rpc); -} - -// Release the RPC -void RpcFree(RPC *rpc) -{ - RpcFreeEx(rpc, false); -} -void RpcFreeEx(RPC *rpc, bool no_disconnect) -{ - // Validate arguments - if (rpc == NULL) - { - return; - } - - if (no_disconnect == false) - { - Disconnect(rpc->Sock); - } - - ReleaseSock(rpc->Sock); - - DeleteLock(rpc->Lock); - - Free(rpc); -} - -// Get error -UINT RpcGetError(PACK *p) -{ - // Validate arguments - if (p == NULL) - { - return ERR_DISCONNECTED; - } - - return PackGetInt(p, "error_code"); -} - -// Error checking -bool RpcIsOk(PACK *p) -{ - // Validate arguments - if (p == NULL) - { - return false; - } - - if (PackGetInt(p, "error") == 0) - { - return true; - } - else - { - return false; - } -} - -// Error code setting -void RpcError(PACK *p, UINT err) -{ - // Validate arguments - if (p == NULL) - { - return; - } - - PackAddInt(p, "error", 1); - PackAddInt(p, "error_code", err); -} - -// Start the RPC dispatcher -PACK *CallRpcDispatcher(RPC *r, PACK *p) -{ - char func_name[MAX_SIZE]; - // Validate arguments - if (r == NULL || p == NULL) - { - return NULL; - } - - if (PackGetStr(p, "function_name", func_name, sizeof(func_name)) == false) - { - return NULL; - } - - return r->Dispatch(r, func_name, p); -} - -// Wait for the next RPC call -bool RpcRecvNextCall(RPC *r) -{ - UINT size; - void *tmp; - SOCK *s; - BUF *b; - PACK *p; - PACK *ret; - // Validate arguments - if (r == NULL) - { - return false; - } - - s = r->Sock; - - if (RecvAll(s, &size, sizeof(UINT), s->SecureMode) == false) - { - return false; - } - - size = Endian32(size); - - if (size > MAX_PACK_SIZE) - { - return false; - } - - tmp = MallocEx(size, true); - - if (RecvAll(s, tmp, size, s->SecureMode) == false) - { - Free(tmp); - return false; - } - - b = NewBuf(); - WriteBuf(b, tmp, size); - SeekBuf(b, 0, 0); - Free(tmp); - - p = BufToPack(b); - FreeBuf(b); - - if (p == NULL) - { - return false; - } - - ret = CallRpcDispatcher(r, p); - FreePack(p); - - if (ret == NULL) - { - ret = PackError(ERR_NOT_SUPPORTED); - } - - b = PackToBuf(ret); - FreePack(ret); - - size = Endian32(b->Size); - SendAdd(s, &size, sizeof(UINT)); - SendAdd(s, b->Buf, b->Size); - - if (SendNow(s, s->SecureMode) == false) - { - FreeBuf(b); - return false; - } - - FreeBuf(b); - - return true; -} - -// RPC server operation -void RpcServer(RPC *r) -{ - SOCK *s; - // Validate arguments - if (r == NULL) - { - return; - } - - s = r->Sock; - - while (true) - { - // Wait for the next RPC call - if (RpcRecvNextCall(r) == false) - { - // Communication error - break; - } - } -} - -// RPC call -PACK *RpcCall(RPC *r, char *function_name, PACK *p) -{ - PACK *ret; - UINT num_retry = 0; - UINT err = 0; - // Validate arguments - if (r == NULL || function_name == NULL) - { - return NULL; - } - -// Debug("RpcCall: %s\n", function_name); - - Lock(r->Lock); - { - if (p == NULL) - { - p = NewPack(); - } - - PackAddStr(p, "function_name", function_name); - -RETRY: - err = 0; - ret = RpcCallInternal(r, p); - - if (ret == NULL) - { - if (r->IsVpnServer && r->Sock != NULL) - { - if (num_retry < 1) - { - num_retry++; - - // Attempt to reconnect the RPC to the VPN Server - err = AdminReconnect(r); - - if (err == ERR_NO_ERROR) - { - goto RETRY; - } - } - } - } - - FreePack(p); - - if (ret == NULL) - { - if (err == 0) - { - err = ERR_DISCONNECTED; - } - - ret = PackError(err); - PackAddInt(ret, "error_code", err); - } - } - Unlock(r->Lock); - - return ret; -} - -// RPC internal call -PACK *RpcCallInternal(RPC *r, PACK *p) -{ - BUF *b; - UINT size; - PACK *ret; - void *tmp; - // Validate arguments - if (r == NULL || p == NULL) - { - return NULL; - } - - if (r->Sock == NULL) - { - return NULL; - } - - b = PackToBuf(p); - - size = Endian32(b->Size); - SendAdd(r->Sock, &size, sizeof(UINT)); - SendAdd(r->Sock, b->Buf, b->Size); - FreeBuf(b); - - if (SendNow(r->Sock, r->Sock->SecureMode) == false) - { - return NULL; - } - - if (RecvAll(r->Sock, &size, sizeof(UINT), r->Sock->SecureMode) == false) - { - return NULL; - } - - size = Endian32(size); - if (size > MAX_PACK_SIZE) - { - return NULL; - } - - tmp = MallocEx(size, true); - if (RecvAll(r->Sock, tmp, size, r->Sock->SecureMode) == false) - { - Free(tmp); - return NULL; - } - - b = NewBuf(); - WriteBuf(b, tmp, size); - SeekBuf(b, 0, 0); - Free(tmp); - - ret = BufToPack(b); - if (ret == NULL) - { - FreeBuf(b); - return NULL; - } - - FreeBuf(b); - - return ret; -} - -// Start the RPC server -RPC *StartRpcServer(SOCK *s, RPC_DISPATCHER *dispatch, void *param) -{ - RPC *r; - // Validate arguments - if (s == NULL) - { - return NULL; - } - - r = ZeroMallocEx(sizeof(RPC), true); - r->Sock = s; - r->Param = param; - r->Lock = NewLock(); - AddRef(s->ref); - - r->ServerMode = true; - r->Dispatch = dispatch; - - // Name generation - Format(r->Name, sizeof(r->Name), "RPC-%u", s->socket); - - return r; -} - -// Start the RPC client -RPC *StartRpcClient(SOCK *s, void *param) -{ - RPC *r; - // Validate arguments - if (s == NULL) - { - return NULL; - } - - r = ZeroMalloc(sizeof(RPC)); - r->Sock = s; - r->Param = param; - r->Lock = NewLock(); - AddRef(s->ref); - - r->ServerMode = false; - - return r; -} - +// SoftEther VPN Source Code - Developer Edition Master Branch +// Cedar Communication Module + + +// Remote.c +// Remote Procedure Call + +#include "CedarPch.h" + +// End of RPC +void EndRpc(RPC *rpc) +{ + RpcFree(rpc); +} + +// Release the RPC +void RpcFree(RPC *rpc) +{ + RpcFreeEx(rpc, false); +} +void RpcFreeEx(RPC *rpc, bool no_disconnect) +{ + // Validate arguments + if (rpc == NULL) + { + return; + } + + if (no_disconnect == false) + { + Disconnect(rpc->Sock); + } + + ReleaseSock(rpc->Sock); + + DeleteLock(rpc->Lock); + + Free(rpc); +} + +// Get error +UINT RpcGetError(PACK *p) +{ + // Validate arguments + if (p == NULL) + { + return ERR_DISCONNECTED; + } + + return PackGetInt(p, "error_code"); +} + +// Error checking +bool RpcIsOk(PACK *p) +{ + // Validate arguments + if (p == NULL) + { + return false; + } + + if (PackGetInt(p, "error") == 0) + { + return true; + } + else + { + return false; + } +} + +// Error code setting +void RpcError(PACK *p, UINT err) +{ + // Validate arguments + if (p == NULL) + { + return; + } + + PackAddInt(p, "error", 1); + PackAddInt(p, "error_code", err); +} + +// Start the RPC dispatcher +PACK *CallRpcDispatcher(RPC *r, PACK *p) +{ + char func_name[MAX_SIZE]; + // Validate arguments + if (r == NULL || p == NULL) + { + return NULL; + } + + if (PackGetStr(p, "function_name", func_name, sizeof(func_name)) == false) + { + return NULL; + } + + return r->Dispatch(r, func_name, p); +} + +// Wait for the next RPC call +bool RpcRecvNextCall(RPC *r) +{ + UINT size; + void *tmp; + SOCK *s; + BUF *b; + PACK *p; + PACK *ret; + // Validate arguments + if (r == NULL) + { + return false; + } + + s = r->Sock; + + if (RecvAll(s, &size, sizeof(UINT), s->SecureMode) == false) + { + return false; + } + + size = Endian32(size); + + if (size > MAX_PACK_SIZE) + { + return false; + } + + tmp = MallocEx(size, true); + + if (RecvAll(s, tmp, size, s->SecureMode) == false) + { + Free(tmp); + return false; + } + + b = NewBuf(); + WriteBuf(b, tmp, size); + SeekBuf(b, 0, 0); + Free(tmp); + + p = BufToPack(b); + FreeBuf(b); + + if (p == NULL) + { + return false; + } + + ret = CallRpcDispatcher(r, p); + FreePack(p); + + if (ret == NULL) + { + ret = PackError(ERR_NOT_SUPPORTED); + } + + b = PackToBuf(ret); + FreePack(ret); + + size = Endian32(b->Size); + SendAdd(s, &size, sizeof(UINT)); + SendAdd(s, b->Buf, b->Size); + + if (SendNow(s, s->SecureMode) == false) + { + FreeBuf(b); + return false; + } + + FreeBuf(b); + + return true; +} + +// RPC server operation +void RpcServer(RPC *r) +{ + SOCK *s; + // Validate arguments + if (r == NULL) + { + return; + } + + s = r->Sock; + + while (true) + { + // Wait for the next RPC call + if (RpcRecvNextCall(r) == false) + { + // Communication error + break; + } + } +} + +// RPC call +PACK *RpcCall(RPC *r, char *function_name, PACK *p) +{ + PACK *ret; + UINT num_retry = 0; + UINT err = 0; + // Validate arguments + if (r == NULL || function_name == NULL) + { + return NULL; + } + +// Debug("RpcCall: %s\n", function_name); + + Lock(r->Lock); + { + if (p == NULL) + { + p = NewPack(); + } + + PackAddStr(p, "function_name", function_name); + +RETRY: + err = 0; + ret = RpcCallInternal(r, p); + + if (ret == NULL) + { + if (r->IsVpnServer && r->Sock != NULL) + { + if (num_retry < 1) + { + num_retry++; + + // Attempt to reconnect the RPC to the VPN Server + err = AdminReconnect(r); + + if (err == ERR_NO_ERROR) + { + goto RETRY; + } + } + } + } + + FreePack(p); + + if (ret == NULL) + { + if (err == 0) + { + err = ERR_DISCONNECTED; + } + + ret = PackError(err); + PackAddInt(ret, "error_code", err); + } + } + Unlock(r->Lock); + + return ret; +} + +// RPC internal call +PACK *RpcCallInternal(RPC *r, PACK *p) +{ + BUF *b; + UINT size; + PACK *ret; + void *tmp; + // Validate arguments + if (r == NULL || p == NULL) + { + return NULL; + } + + if (r->Sock == NULL) + { + return NULL; + } + + b = PackToBuf(p); + + size = Endian32(b->Size); + SendAdd(r->Sock, &size, sizeof(UINT)); + SendAdd(r->Sock, b->Buf, b->Size); + FreeBuf(b); + + if (SendNow(r->Sock, r->Sock->SecureMode) == false) + { + return NULL; + } + + if (RecvAll(r->Sock, &size, sizeof(UINT), r->Sock->SecureMode) == false) + { + return NULL; + } + + size = Endian32(size); + if (size > MAX_PACK_SIZE) + { + return NULL; + } + + tmp = MallocEx(size, true); + if (RecvAll(r->Sock, tmp, size, r->Sock->SecureMode) == false) + { + Free(tmp); + return NULL; + } + + b = NewBuf(); + WriteBuf(b, tmp, size); + SeekBuf(b, 0, 0); + Free(tmp); + + ret = BufToPack(b); + if (ret == NULL) + { + FreeBuf(b); + return NULL; + } + + FreeBuf(b); + + return ret; +} + +// Start the RPC server +RPC *StartRpcServer(SOCK *s, RPC_DISPATCHER *dispatch, void *param) +{ + RPC *r; + // Validate arguments + if (s == NULL) + { + return NULL; + } + + r = ZeroMallocEx(sizeof(RPC), true); + r->Sock = s; + r->Param = param; + r->Lock = NewLock(); + AddRef(s->ref); + + r->ServerMode = true; + r->Dispatch = dispatch; + + // Name generation + Format(r->Name, sizeof(r->Name), "RPC-%u", s->socket); + + return r; +} + +// Start the RPC client +RPC *StartRpcClient(SOCK *s, void *param) +{ + RPC *r; + // Validate arguments + if (s == NULL) + { + return NULL; + } + + r = ZeroMalloc(sizeof(RPC)); + r->Sock = s; + r->Param = param; + r->Lock = NewLock(); + AddRef(s->ref); + + r->ServerMode = false; + + return r; +} + diff --git a/src/Cedar/Remote.h b/src/Cedar/Remote.h index 49de5056..efdb7f2f 100644 --- a/src/Cedar/Remote.h +++ b/src/Cedar/Remote.h @@ -1,48 +1,48 @@ -// SoftEther VPN Source Code - Developer Edition Master Branch -// Cedar Communication Module - - -// Remote.h -// Header of Remote.c - -#ifndef REMOTE_H -#define REMOTE_H - -// RPC execution function -typedef PACK *(RPC_DISPATCHER)(RPC *r, char *function_name, PACK *p); - -// RPC object -struct RPC -{ - SOCK *Sock; // Socket - bool ServerMode; // Server mode - RPC_DISPATCHER *Dispatch; // Execution routine - void *Param; // Parameters - bool ServerAdminMode; // Server management mode - char HubName[MAX_HUBNAME_LEN + 1]; // Managing HUB name - char Name[MAX_SIZE]; // RPC session name - LOCK *Lock; // Lock - bool IsVpnServer; // Whether VPN Server management RPC - CLIENT_OPTION VpnServerClientOption; - char VpnServerHubName[MAX_HUBNAME_LEN + 1]; - UCHAR VpnServerHashedPassword[SHA1_SIZE]; - char VpnServerClientName[MAX_PATH]; -}; - -// Function prototype -RPC *StartRpcClient(SOCK *s, void *param); -RPC *StartRpcServer(SOCK *s, RPC_DISPATCHER *dispatch, void *param); -PACK *RpcCallInternal(RPC *r, PACK *p); -PACK *RpcCall(RPC *r, char *function_name, PACK *p); -void RpcServer(RPC *r); -bool RpcRecvNextCall(RPC *r); -PACK *CallRpcDispatcher(RPC *r, PACK *p); -void RpcError(PACK *p, UINT err); -bool RpcIsOk(PACK *p); -UINT RpcGetError(PACK *p); -void EndRpc(RPC *rpc); -void RpcFree(RPC *rpc); -void RpcFreeEx(RPC *rpc, bool no_disconnect); - -#endif // REMOTE_H - +// SoftEther VPN Source Code - Developer Edition Master Branch +// Cedar Communication Module + + +// Remote.h +// Header of Remote.c + +#ifndef REMOTE_H +#define REMOTE_H + +// RPC execution function +typedef PACK *(RPC_DISPATCHER)(RPC *r, char *function_name, PACK *p); + +// RPC object +struct RPC +{ + SOCK *Sock; // Socket + bool ServerMode; // Server mode + RPC_DISPATCHER *Dispatch; // Execution routine + void *Param; // Parameters + bool ServerAdminMode; // Server management mode + char HubName[MAX_HUBNAME_LEN + 1]; // Managing HUB name + char Name[MAX_SIZE]; // RPC session name + LOCK *Lock; // Lock + bool IsVpnServer; // Whether VPN Server management RPC + CLIENT_OPTION VpnServerClientOption; + char VpnServerHubName[MAX_HUBNAME_LEN + 1]; + UCHAR VpnServerHashedPassword[SHA1_SIZE]; + char VpnServerClientName[MAX_PATH]; +}; + +// Function prototype +RPC *StartRpcClient(SOCK *s, void *param); +RPC *StartRpcServer(SOCK *s, RPC_DISPATCHER *dispatch, void *param); +PACK *RpcCallInternal(RPC *r, PACK *p); +PACK *RpcCall(RPC *r, char *function_name, PACK *p); +void RpcServer(RPC *r); +bool RpcRecvNextCall(RPC *r); +PACK *CallRpcDispatcher(RPC *r, PACK *p); +void RpcError(PACK *p, UINT err); +bool RpcIsOk(PACK *p); +UINT RpcGetError(PACK *p); +void EndRpc(RPC *rpc); +void RpcFree(RPC *rpc); +void RpcFreeEx(RPC *rpc, bool no_disconnect); + +#endif // REMOTE_H + diff --git a/src/Cedar/SM.c b/src/Cedar/SM.c index c5716b4c..4ab5c756 100644 --- a/src/Cedar/SM.c +++ b/src/Cedar/SM.c @@ -1,20650 +1,20650 @@ -// SoftEther VPN Source Code - Developer Edition Master Branch -// Cedar Communication Module - - -// SM.c -// VPN Server Manager for Win32 - -#include - -#ifdef WIN32 - -#define SM_C -#define CM_C -#define NM_C - -#define _WIN32_WINNT 0x0502 -#define WINVER 0x0502 -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "CMInner.h" -#include "SMInner.h" -#include "NMInner.h" -#include "EMInner.h" -#include "../PenCore/resource.h" - -// Global variable -static SM *sm = NULL; -static bool link_create_now = false; - - -// Proxy Settings dialog initialization -void SmProxyDlgInit(HWND hWnd, INTERNET_SETTING *t) -{ - // Validate arguments - if (hWnd == NULL || t == NULL) - { - return; - } - - Check(hWnd, R_DIRECT_TCP, t->ProxyType == PROXY_DIRECT); - Check(hWnd, R_HTTPS, t->ProxyType == PROXY_HTTP); - Check(hWnd, R_SOCKS, t->ProxyType == PROXY_SOCKS); - Check(hWnd, R_SOCKS5, t->ProxyType == PROXY_SOCKS5); - - SmProxyDlgUpdate(hWnd, t); -} - -// Proxy Settings dialog update -void SmProxyDlgUpdate(HWND hWnd, INTERNET_SETTING *t) -{ - bool ok = false; - // Validate arguments - if (hWnd == NULL || t == NULL) - { - return; - } - - if (t->ProxyType == PROXY_DIRECT) - { - ok = true; - } - else - { - if (IsEmptyStr(t->ProxyHostName) == false && - t->ProxyPort != 0) - { - ok = true; - } - } - - SetEnable(hWnd, IDOK, ok); - - SetEnable(hWnd, B_PROXY_CONFIG, !IsChecked(hWnd, R_DIRECT_TCP)); -} - -// Proxy settings generic dialog procedure -UINT SmProxyDlg(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param) -{ - INTERNET_SETTING *t = (INTERNET_SETTING *)param; - CLIENT_OPTION a; - - switch (msg) - { - case WM_INITDIALOG: - SmProxyDlgInit(hWnd, t); - break; - - case WM_COMMAND: - switch (wParam) - { - case IDOK: - EndDialog(hWnd, 1); - break; - - case IDCANCEL: - Close(hWnd); - break; - - case R_DIRECT_TCP: - case R_HTTPS: - case R_SOCKS: - case R_SOCKS5: - if (IsChecked(hWnd, R_HTTPS)) - { - t->ProxyType = PROXY_HTTP; - } - else if (IsChecked(hWnd, R_SOCKS)) - { - t->ProxyType = PROXY_SOCKS; - } - else if (IsChecked(hWnd, R_SOCKS5)) - { - t->ProxyType = PROXY_SOCKS5; - } - else - { - t->ProxyType = PROXY_DIRECT; - } - - SmProxyDlgUpdate(hWnd, t); - break; - - case B_PROXY_CONFIG: - Zero(&a, sizeof(a)); - - a.ProxyType = t->ProxyType; - StrCpy(a.ProxyName, sizeof(a.ProxyName), t->ProxyHostName); - a.ProxyPort = t->ProxyPort; - StrCpy(a.ProxyUsername, sizeof(a.ProxyUsername), t->ProxyUsername); - StrCpy(a.ProxyPassword, sizeof(a.ProxyPassword), t->ProxyPassword); - StrCpy(a.CustomHttpHeader, sizeof(a.CustomHttpHeader), t->CustomHttpHeader); - - if (CmProxyDlg(hWnd, &a)) - { - t->ProxyType = a.ProxyType; - StrCpy(t->ProxyHostName, sizeof(t->ProxyHostName), a.ProxyName); - t->ProxyPort = a.ProxyPort; - StrCpy(t->ProxyUsername, sizeof(t->ProxyUsername), a.ProxyUsername); - StrCpy(t->ProxyPassword, sizeof(t->ProxyPassword), a.ProxyPassword); - StrCpy(t->CustomHttpHeader, sizeof(t->CustomHttpHeader), a.CustomHttpHeader); - } - - SmProxyDlgUpdate(hWnd, t); - - break; - } - break; - - case WM_CLOSE: - EndDialog(hWnd, 0); - break; - } - - return 0; -} - -// Proxy Settings generic dialog -bool SmProxy(HWND hWnd, INTERNET_SETTING *t) -{ - // Validate arguments - if (t == NULL) - { - return false; - } - - return Dialog(hWnd, D_SM_PROXY, SmProxyDlg, t); -} - -// VPN Azure dialog procedure -UINT SmAzureDlg(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param) -{ - SM_AZURE *a = (SM_AZURE *)param; - - switch (msg) - { - case WM_INITDIALOG: - SmAzureDlgOnInit(hWnd, a); - - SetTimer(hWnd, 1, 1000, NULL); - break; - - case WM_COMMAND: - switch (wParam) - { - case B_CHANGE: - if (SmDDns(hWnd, a->s, false, true)) - { - SmAzureDlgRefresh(hWnd, a); - } - break; - - case B_WEB: - MsExecute(_SS("SE_VPNAZURE_URL"), NULL); - break; - - case R_ENABLE: - case R_DISABLE: - if (IsChecked(hWnd, R_ENABLE) || IsChecked(hWnd, R_DISABLE)) - { - Enable(hWnd, IDCANCEL); - EnableClose(hWnd); - } - - SmAzureSetStatus(hWnd, a); - break; - - case IDOK: - case IDCANCEL: - Close(hWnd); - break; - } - break; - - case WM_TIMER: - switch (wParam) - { - case 1: - if (IsEnable(hWnd, 0)) - { - KillTimer(hWnd, 1); - - SmAzureDlgRefresh(hWnd, a); - - SetTimer(hWnd, 1, 1000, NULL); - } - break; - } - break; - - case WM_CLOSE: - EndDialog(hWnd, 0); - break; - } - - return 0; -} - -// Set the status -void SmAzureSetStatus(HWND hWnd, SM_AZURE *a) -{ - RPC_AZURE_STATUS st; - // Validate arguments - if (hWnd == NULL || a == NULL) - { - return; - } - - Zero(&st, sizeof(st)); - - st.IsEnabled = IsChecked(hWnd, R_ENABLE); - - if (CALL(hWnd, ScSetAzureStatus(a->s->Rpc, &st)) == false) - { - EndDialog(hWnd, 0); - return; - } - - SmAzureDlgRefresh(hWnd, a); -} - -// Initialize the dialog -void SmAzureDlgOnInit(HWND hWnd, SM_AZURE *a) -{ - RPC_AZURE_STATUS st; - UINT current_lang_id; - // Validate arguments - if (hWnd == NULL || a == NULL) - { - return; - } - - SetIcon(hWnd, 0, ICO_AZURE); - - DlgFont(hWnd, S_TITLE, 14, true); - DlgFont(hWnd, R_ENABLE, 0, true); - - SetFont(hWnd, E_HOST, GetFont("Verdana", 10, false, false, false, false)); - - current_lang_id = GetCurrentLangId(); - - // Japanese - SetShow(hWnd, S_BMP_JA, current_lang_id == SE_LANG_JAPANESE); - - // Chinese - SetShow(hWnd, S_BMP_CN, current_lang_id == SE_LANG_CHINESE_ZH); - - // Other languages - SetShow(hWnd, S_BMP_EN, (current_lang_id != SE_LANG_JAPANESE) && (current_lang_id != SE_LANG_CHINESE_ZH)); - - // Apply the current settings - Zero(&st, sizeof(st)); - - if (CALL(hWnd, ScGetAzureStatus(a->s->Rpc, &st)) == false) - { - EndDialog(hWnd, 0); - return; - } - - if (a->OnSetup == false || st.IsEnabled) - { - Check(hWnd, R_ENABLE, st.IsEnabled); - Check(hWnd, R_DISABLE, !st.IsEnabled); - } - else - { - Disable(hWnd, IDCANCEL); - DisableClose(hWnd); - } - - SmAzureDlgRefresh(hWnd, a); -} - -// Update the dialog -void SmAzureDlgRefresh(HWND hWnd, SM_AZURE *a) -{ - RPC_AZURE_STATUS st; - DDNS_CLIENT_STATUS ddns; - char tmp[MAX_SIZE]; - // Validate arguments - if (hWnd == NULL || a == NULL) - { - return; - } - - Zero(&st, sizeof(st)); - Zero(&ddns, sizeof(ddns)); - - if (CALL(hWnd, ScGetAzureStatus(a->s->Rpc, &st)) == false) - { - EndDialog(hWnd, 0); - return; - } - - if (CALL(hWnd, ScGetDDnsClientStatus(a->s->Rpc, &ddns)) == false) - { - EndDialog(hWnd, 0); - return; - } - - if (st.IsEnabled == false) - { - SetText(hWnd, S_STATUS, _UU("SM_AZURE_STATUS_NOT_CONNECTED")); - Disable(hWnd, S_STATUS); - } - else - { - SetText(hWnd, S_STATUS, (st.IsConnected ? _UU("SM_AZURE_STATUS_CONNECTED") : _UU("SM_AZURE_STATUS_NOT_CONNECTED"))); - Enable(hWnd, S_STATUS); - } - - SetShow(hWnd, S_HOSTNAME_BORDER, st.IsEnabled); - SetShow(hWnd, S_HOSTNAME_INFO, st.IsEnabled); - SetShow(hWnd, B_CHANGE, st.IsEnabled); - - if (st.IsEnabled == false || IsEmptyStr(ddns.CurrentHostName)) - { - Hide(hWnd, E_HOST); - } - else - { - StrCpy(tmp, sizeof(tmp), ddns.CurrentHostName); - StrCat(tmp, sizeof(tmp), AZURE_DOMAIN_SUFFIX); - - SetTextA(hWnd, E_HOST, tmp); - - Show(hWnd, E_HOST); - } -} - -// VPN Azure Setup screen -void SmAzure(HWND hWnd, SM_SERVER *s, bool on_setup) -{ - SM_AZURE a; - // Validate arguments - if (s == NULL) - { - return; - } - - Zero(&a, sizeof(a)); - - a.s = s; - a.OnSetup = on_setup; - - Dialog(hWnd, D_SM_AZURE, SmAzureDlg, &a); -} - -// Notification screen about the bridge in VM -UINT SmVmBridgeDlg(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param) -{ - switch (msg) - { - case WM_INITDIALOG: - DlgFont(hWnd, S_TITLE, 14, true); - SetIcon(hWnd, 0, ICO_NIC_ONLINE); - break; - - case WM_COMMAND: - switch (wParam) - { - case IDOK: - case IDCANCEL: - Close(hWnd); - break; - } - break; - - case WM_CLOSE: - EndDialog(hWnd, 0); - break; - } - - return 0; -} - -// Setting screen of VPN over ICMP, etc. -void SmSpecialListener(HWND hWnd, SM_SERVER *s) -{ - // Validate arguments - if (s == NULL) - { - return; - } - - Dialog(hWnd, D_SM_SPECIALLISTENER, SmSpecialListenerDlg, s); -} -UINT SmSpecialListenerDlg(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param) -{ - SM_SERVER *s = (SM_SERVER *)param; - - switch (msg) - { - case WM_INITDIALOG: - SmSpecialListenerDlgInit(hWnd, s); - break; - - case WM_COMMAND: - switch (wParam) - { - case IDOK: - SmSpecialListenerDlgOnOk(hWnd, s); - break; - - case IDCANCEL: - Close(hWnd); - break; - } - break; - - case WM_CLOSE: - EndDialog(hWnd, 0); - break; - } - - return 0; -} -void SmSpecialListenerDlgInit(HWND hWnd, SM_SERVER *s) -{ - RPC_SPECIAL_LISTENER t; - // Validate arguments - if (hWnd == NULL || s == NULL) - { - return; - } - - SetIcon(hWnd, 0, ICO_SPECIALLISTENER); - - DlgFont(hWnd, S_TITLE, 14, true); - DlgFont(hWnd, S_1, 0, true); - DlgFont(hWnd, R_OVER_ICMP, 0, true); - DlgFont(hWnd, R_OVER_DNS, 0, true); - - Zero(&t, sizeof(t)); - - if (CALL(hWnd, ScGetSpecialListener(s->Rpc, &t)) == false) - { - Close(hWnd); - return; - } - - Check(hWnd, R_OVER_ICMP, t.VpnOverIcmpListener); - Check(hWnd, R_OVER_DNS, t.VpnOverDnsListener); -} -void SmSpecialListenerDlgOnOk(HWND hWnd, SM_SERVER *s) -{ - RPC_SPECIAL_LISTENER t; - // Validate arguments - if (hWnd == NULL || s == NULL) - { - return; - } - - Zero(&t, sizeof(t)); - - t.VpnOverIcmpListener = IsChecked(hWnd, R_OVER_ICMP); - t.VpnOverDnsListener = IsChecked(hWnd, R_OVER_DNS); - - if (CALL(hWnd, ScSetSpecialListener(s->Rpc, &t)) == false) - { - return; - } - - EndDialog(hWnd, 1); -} - - -// DDNS dialog -bool SmDDns(HWND hWnd, SM_SERVER *s, bool silent, bool no_change_cert) -{ - SM_DDNS d; - // Validate arguments - if (s == NULL) - { - return false; - } - - Zero(&d, sizeof(d)); - d.s = s; - d.Silent = silent; - d.NoChangeCert = no_change_cert; - - Dialog(hWnd, D_SM_DDNS, SmDDnsDlg, &d); - - return d.Changed; -} -UINT SmDDnsDlg(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param) -{ - SM_DDNS *d = (SM_DDNS *)param; - // Validate arguments - if (hWnd == NULL) - { - return 0; - } - - switch (msg) - { - case WM_INITDIALOG: - SmDDnsDlgInit(hWnd, d); - - SetTimer(hWnd, 1, 1000, NULL); - break; - - case WM_COMMAND: - switch (LOWORD(wParam)) - { - case E_NEWHOST: - SmDDnsDlgUpdate(hWnd, d); - break; - } - - switch (wParam) - { - case IDOK: - SmDDnsDlgOnOk(hWnd, d); - break; - - case B_RESTORE: - // Restore to original - if (d->Status.Err_IPv4 == ERR_NO_ERROR || d->Status.Err_IPv6 == ERR_NO_ERROR) - { - SetTextA(hWnd, E_NEWHOST, d->Status.CurrentHostName); - SmDDnsDlgUpdate(hWnd, d); - FocusEx(hWnd, E_NEWHOST); - } - break; - - case IDCANCEL: - Close(hWnd); - break; - - case B_DISABLE: - d->DoNotPoll = true; - - OnceMsg(hWnd, _UU("SM_DISABLE_DDNS_HINT_CAPTION"), _UU("SM_DISABLE_DDNS_HINT"), false, ICO_INFORMATION); - - d->DoNotPoll = false; - break; - - case B_HINT: - // Hint - if (d->Status.Err_IPv4 == ERR_NO_ERROR || d->Status.Err_IPv6 == ERR_NO_ERROR) - { - wchar_t tmp[MAX_SIZE * 4]; - wchar_t ipv4[MAX_SIZE], ipv6[MAX_SIZE]; - - StrToUni(ipv4, sizeof(ipv4), d->Status.CurrentIPv4); - StrToUni(ipv6, sizeof(ipv6), d->Status.CurrentIPv6); - - if (UniIsEmptyStr(ipv4)) - { - UniStrCpy(ipv4, sizeof(ipv4), _UU("SM_DDNS_FQDN_EMPTY")); - } - - if (UniIsEmptyStr(ipv6)) - { - UniStrCpy(ipv6, sizeof(ipv6), _UU("SM_DDNS_FQDN_EMPTY")); - } - - UniFormat(tmp, sizeof(tmp), - _UU("SM_DDNS_OK_MSG"), - d->Status.CurrentHostName, d->Status.DnsSuffix, - ipv4, ipv6, - d->Status.CurrentHostName, d->Status.DnsSuffix, - d->Status.CurrentHostName, d->Status.DnsSuffix); - - d->DoNotPoll = true; - - OnceMsg(hWnd, _UU("SM_DDNS_OK_TITLE"), tmp, false, ICO_DISPLAY); - - d->DoNotPoll = false; - } - break; - - case B_HINT2: - // Hint2 (for DDNS key) - { - wchar_t tmp[MAX_SIZE * 4]; - wchar_t *keystr; - - keystr = GetText(hWnd, E_KEY); - UniFormat(tmp, sizeof(tmp), _UU("SM_DDNS_KEY_MSG"), keystr); - Free(keystr); - OnceMsg(hWnd, _UU("SM_DDNS_KEY_TITLE"), tmp, false, ICO_DISPLAY); - } - break; - - case B_PROXY: - // Proxy settings - if (true) - { - INTERNET_SETTING t; - - if (CALL(hWnd, ScGetDDnsInternetSetting(d->s->Rpc, &t))) - { - if (SmProxy(hWnd, &t)) - { - if (CALL(hWnd, ScSetDDnsInternetSetting(d->s->Rpc, &t))) - { - SmDDnsRefresh(hWnd, d); - } - } - } - } - break; - } - break; - - case WM_TIMER: - switch (wParam) - { - case 1: - if (IsEnable(hWnd, 0)) - { - KillTimer(hWnd, 1); - - SmDDnsRefresh(hWnd, d); - - SetTimer(hWnd, 1, 1000, NULL); - } - break; - } - break; - - case WM_CLOSE: - if (d->Changed || d->Silent) - { - // Check the server certificate if the host name has been changed - RPC_KEY_PAIR t; - char fqdn[MAX_SIZE]; - bool is_vgs_enabled = false; - - - StrCpy(fqdn, sizeof(fqdn), d->Status.CurrentFqdn); - - if (IsEmptyStr(fqdn) == false) - { - Zero(&t, sizeof(t)); - if (ScGetServerCert(d->s->Rpc, &t) == ERR_NO_ERROR) - { - if (t.Cert != NULL && t.Cert->root_cert && t.Cert->subject_name != NULL && is_vgs_enabled == false) - { - char cn[MAX_SIZE]; - - UniToStr(cn, sizeof(cn), t.Cert->subject_name->CommonName); - - if ((StrCmpi(cn, fqdn) != 0) && (d->NoChangeCert == false)) - { - // Confirm whether the user want to replace the server certificate - if (d->Silent || (MsgBoxEx(hWnd, MB_ICONQUESTION | MB_YESNO, - _UU("SM_DDNS_SERVER_CERT_MSG"), - fqdn, fqdn) == IDYES)) - { - // Re-generate the server certificate - RPC_TEST tt; - - Zero(&tt, sizeof(tt)); - - StrCpy(tt.StrValue, sizeof(tt.StrValue), fqdn); - - SetText(hWnd, IDCANCEL, _UU("CM_VLAN_INSTALLING")); - Refresh(DlgItem(hWnd, IDCANCEL)); - Refresh(hWnd); - DoEvents(NULL); - - if (CALL(hWnd, ScRegenerateServerCert(d->s->Rpc, &tt))) - { - // Confirm whether the user want to save the server certificate - if ((d->Silent == false) && ( - MsgBoxEx(hWnd, MB_ICONINFORMATION | MB_YESNO, - _UU("SM_DDNS_SERVER_CERT_OK"), - fqdn) == IDYES)) - { - // Get the server certificate - RPC_KEY_PAIR t2; - - Zero(&t2, sizeof(t2)); - if (CALL(hWnd, ScGetServerCert(d->s->Rpc, &t2))) - { - wchar_t *name; - wchar_t defname[MAX_PATH]; - - StrToUni(defname, sizeof(defname), fqdn); - UniStrCat(defname, sizeof(defname), L".cer"); - - name = SaveDlg(hWnd, _UU("DLG_CERT_FILES"), _UU("DLG_SAVE_CERT"), defname, L".cer"); - - if (name != NULL) - { - if (XToFileW(t2.Cert, name, true)) - { - MsgBox(hWnd, MB_ICONINFORMATION, _UU("DLG_CERT_SAVE_OK")); - } - else - { - MsgBox(hWnd, MB_ICONSTOP, _UU("DLG_CERT_SAVE_ERROR")); - } - - Free(name); - } - - FreeRpcKeyPair(&t2); - } - } - } - } - } - } - - FreeRpcKeyPair(&t); - } - } - } - - EndDialog(hWnd, 0); - break; - } - - return 0; -} - -// Get the ddns key from the server configuration file -static UINT SmDdnsGetKey(char *key, SM_DDNS *d){ - RPC_CONFIG config; - UINT err; - BUF *buf; - FOLDER *root, *ddnsfolder; - RPC *rpc; - - // Validate arguments - if(d == NULL || d->s == NULL || key == NULL){ - return ERR_INTERNAL_ERROR; - } - - rpc = d->s->Rpc; - - Zero(&config, sizeof(config)); - err = ScGetConfig(d->s->Rpc, &config); - if(err != ERR_NO_ERROR){ - return err; - } - - buf = NewBufFromMemory(config.FileData, StrLen(config.FileData)); - FreeRpcConfig(&config); - - root = CfgBufTextToFolder(buf); - FreeBuf(buf); - - ddnsfolder = CfgGetFolder(root, "DDnsClient"); - err = CfgGetByte(ddnsfolder, "Key", key, 20); - - CfgDeleteFolder(root); - - return (err == 20) ? ERR_NO_ERROR : ERR_INTERNAL_ERROR; -} - -void SmDDnsDlgInit(HWND hWnd, SM_DDNS *d) -{ - char key[20]; - char encodedkey[20 * 4 + 32]; - - // Validate arguments - if (hWnd == NULL || d == NULL) - { - return; - } - - d->DoNotPoll = false; - - SetIcon(hWnd, 0, ICO_DISPLAY); - - DlgFont(hWnd, S_TITLE, 14, true); - - DlgFont(hWnd, S_BOLD, 0, true); - DlgFont(hWnd, S_STATUS3, 0, true); - DlgFont(hWnd, S_STATUS4, 0, true); - DlgFont(hWnd, S_STATUS5, 0, true); - DlgFont(hWnd, S_STATUS6, 0, true); - DlgFont(hWnd, S_STATUS8, 0, true); - - SetFont(hWnd, S_SUFFIX, GetFont("Verdana", 10, false, false, false, false)); - SetFont(hWnd, E_NEWHOST, GetFont("Verdana", 10, false, false, false, false)); - - SetFont(hWnd, E_HOST, GetFont((MsIsWinXPOrGreater() ? "Verdana" : NULL), 10, false, false, false, false)); - SetFont(hWnd, E_IPV4, GetFont((MsIsWinXPOrGreater() ? "Verdana" : NULL), 10, false, false, false, false)); - SetFont(hWnd, E_IPV6, GetFont((MsIsWinXPOrGreater() ? "Verdana" : NULL), 10, false, false, false, false)); - SetFont(hWnd, E_KEY, GetFont((MsIsWinXPOrGreater() ? "Verdana" : NULL), 8, false, false, false, false)); - - DlgFont(hWnd, IDOK, 0, true); - - if (d->Silent) - { - Hide(hWnd, B_DISABLE); - } - - Hide(hWnd, B_PROXY); - - if(SmDdnsGetKey(key, d) == ERR_NO_ERROR){ - encodedkey[ B64_Encode(encodedkey, key, 20) ] = 0; - SetTextA(hWnd, E_KEY, encodedkey); - }else{ - SetText(hWnd, E_KEY, _UU("SM_DDNS_KEY_ERR")); - } - - SmDDnsRefresh(hWnd, d); -} - -void SmDDnsRefresh(HWND hWnd, SM_DDNS *d) -{ - DDNS_CLIENT_STATUS st; - INTERNET_SETTING t; - - // Validate arguments - if (hWnd == NULL || d == NULL) - { - return; - } - - if (d->DoNotPoll) - { - return; - } - - Zero(&st, sizeof(st)); - Zero(&t, sizeof(t)); - - // Get the status - if (CALL(hWnd, ScGetDDnsClientStatus(d->s->Rpc, &st)) == false) - { - Close(hWnd); - return; - } - - ScGetDDnsInternetSetting(d->s->Rpc, &t); - - Copy(&d->Status, &st, sizeof(st)); - - if (IsEmptyStr(st.CurrentFqdn) == false) - { - SetTextA(hWnd, E_HOST, st.CurrentFqdn); - } - else - { - SetText(hWnd, E_HOST, _UU("SM_DDNS_FQDN_EMPTY")); - } - - if (st.Err_IPv4 == ERR_NO_ERROR) - { - SetTextA(hWnd, E_IPV4, st.CurrentIPv4); - } - else - { - if (st.Err_IPv4 == ERR_CONNECT_FAILED) - { - SetText(hWnd, E_IPV4, _UU("SM_DDNS_IPV4_ERROR")); - } - else - { - SetText(hWnd, E_IPV4, _E(st.Err_IPv4)); - } - } - - if (st.Err_IPv6 == ERR_NO_ERROR) - { - SetTextA(hWnd, E_IPV6, st.CurrentIPv6); - } - else - { - if (st.Err_IPv6 == ERR_CONNECT_FAILED) - { - SetText(hWnd, E_IPV6, _UU("SM_DDNS_IPV6_ERROR")); - } - else - { - SetText(hWnd, E_IPV6, _E(st.Err_IPv6)); - } - } - - if (st.Err_IPv4 == ERR_NO_ERROR || st.Err_IPv6 == ERR_NO_ERROR) - { - if (IsEmptyStr(st.DnsSuffix) == false) - { - SetTextA(hWnd, S_SUFFIX, st.DnsSuffix); - } - - Enable(hWnd, S_STATUS6); - Enable(hWnd, E_NEWHOST); - Enable(hWnd, S_SUFFIX); - Enable(hWnd, S_STATUS7); - Enable(hWnd, B_HINT); - } - else - { - SetTextA(hWnd, S_SUFFIX, ""); - - Disable(hWnd, S_STATUS6); - Disable(hWnd, E_NEWHOST); - Disable(hWnd, S_SUFFIX); - Disable(hWnd, S_STATUS7); - Disable(hWnd, B_HINT); - } - - if (GetCapsBool(d->s->CapsList, "b_support_ddns_proxy")) - { - // Show the proxy button - Show(hWnd, B_PROXY); - } - else - { - // Hide the proxy button - Hide(hWnd, B_PROXY); - } - - SmDDnsDlgUpdate(hWnd, d); - - if (d->Flag == false) - { - d->Flag = true; - } - - if (IsEmptyStr(st.CurrentHostName) == false) - { - if (d->HostnameSetFlag == false) - { - d->HostnameSetFlag = true; - - SetTextA(hWnd, E_NEWHOST, st.CurrentHostName); - - FocusEx(hWnd, E_NEWHOST); - } - } -} -void SmDDnsDlgUpdate(HWND hWnd, SM_DDNS *d) -{ - char tmp[MAX_SIZE]; - bool b = false; - - // Validate arguments - if (hWnd == NULL || d == NULL) - { - return; - } - - if (GetTxtA(hWnd, E_NEWHOST, tmp, sizeof(tmp))) - { - Trim(tmp); - - // Get whether the host name have changed - if (IsEmptyStr(tmp) == false) - { - if (StrCmpi(d->Status.CurrentHostName, tmp) != 0) - { - if (d->Status.Err_IPv4 == ERR_NO_ERROR || d->Status.Err_IPv6 == ERR_NO_ERROR) - { - b = true; - } - } - } - } - - SetEnable(hWnd, IDOK, b); - SetEnable(hWnd, B_RESTORE, b); -} -void SmDDnsDlgOnOk(HWND hWnd, SM_DDNS *d) -{ - RPC_TEST t; - // Validate arguments - if (hWnd == NULL || d == NULL) - { - return; - } - - Zero(&t, sizeof(t)); - GetTxtA(hWnd, E_NEWHOST, t.StrValue, sizeof(t.StrValue)); - - if (CALL(hWnd, ScChangeDDnsClientHostname(d->s->Rpc, &t)) == false) - { - return; - } - - d->Changed = true; - - SmDDnsRefresh(hWnd, d); - FocusEx(hWnd, E_NEWHOST); - - MsgBoxEx(hWnd, MB_ICONINFORMATION, _UU("SM_DDNS_OK_MSG2"), t.StrValue); - FocusEx(hWnd, E_NEWHOST); -} - -// Open the OpenVPN dialog -void SmOpenVpn(HWND hWnd, SM_SERVER *s) -{ - // Validate arguments - if (s == NULL) - { - return; - } - - Dialog(hWnd, D_SM_OPENVPN, SmOpenVpnDlg, s); -} - -// OpenVPN dialog -UINT SmOpenVpnDlg(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param) -{ - SM_SERVER *s = (SM_SERVER *)param; - char tmp[MAX_SIZE]; - // Validate arguments - if (hWnd == NULL) - { - return 0; - } - - switch (msg) - { - case WM_INITDIALOG: - SmOpenVpnDlgInit(hWnd, s); - break; - - case WM_COMMAND: - switch (LOWORD(wParam)) - { - case R_OPENVPN: - case R_SSTP: - SmOpenVpnDlgUpdate(hWnd, s); - break; - } - - switch (wParam) - { - case IDOK: - SmOpenVpnDlgOnOk(hWnd, s, false); - break; - - case B_CONFIG: - // Create an OpenVPN configuration - { - OPENVPN_SSTP_CONFIG t2; - RPC_READ_LOG_FILE t; - - Zero(&t2, sizeof(t2)); - - if (CALL(hWnd, ScGetOpenVpnSstpConfig(s->Rpc, &t2))) - { - if (t2.EnableOpenVPN == false) - { - // Enable the OpenVPN first - SmOpenVpnDlgOnOk(hWnd, s, true); - - Disable(hWnd, IDCANCEL); - } - } - else - { - break; - } - - Zero(&t, sizeof(t)); - - if (CALL(hWnd, ScMakeOpenVpnConfigFile(s->Rpc, &t))) - { - // Generate a file name - wchar_t filename[MAX_SIZE]; - char safe_hostname[MAX_SIZE]; - SYSTEMTIME st; - wchar_t *dst; - - MakeSafeFileName(safe_hostname, sizeof(safe_hostname), s->ServerName); - - LocalTime(&st); - - UniFormat(filename, sizeof(filename), - L"OpenVPN_Sample_Config_%S_%04u%02u%02u_%02u%02u%02u.zip", - safe_hostname, - st.wYear, st.wMonth, st.wDay, - st.wHour, st.wMinute, st.wSecond); - - dst = SaveDlg(hWnd, _UU("DLG_ZIP_FILER"), _UU("DLG_SAVE_OPENVPN_CONFIG"), - filename, L".zip"); - - if (dst != NULL) - { - // Save - if (DumpBufW(t.Buffer, dst) == false) - { - // Failure - MsgBoxEx(hWnd, MB_ICONSTOP, _UU("SM_OPENVPN_CONFIG_SAVE_NG"), dst); - } - else - { - // Success - if (MsgBoxEx(hWnd, MB_ICONQUESTION | MB_YESNO, _UU("SM_OPENVPN_CONFIG_SAVE_OK"), dst) == IDYES) - { - if (MsExecuteW(dst, L"") == false) - { - MsgBoxEx(hWnd, MB_ICONINFORMATION, _UU("SM_OPENVPN_CONFIG_OPEN_NG"), dst); - } - } - } - - Free(dst); - } - - FreeRpcReadLogFile(&t); - } - } - break; - - case B_IPSEC: - SmIPsec(hWnd, s); - break; - - case IDCANCEL: - Close(hWnd); - break; - } - break; - - case WM_CLOSE: - EndDialog(hWnd, 0); - break; - } - - return 0; -} -void SmOpenVpnDlgInit(HWND hWnd, SM_SERVER *s) -{ - OPENVPN_SSTP_CONFIG t; - // Validate arguments - if (hWnd == NULL || s == NULL) - { - return; - } - - Zero(&t, sizeof(t)); - if (CALL(hWnd, ScGetOpenVpnSstpConfig(s->Rpc, &t)) == false) - { - Close(hWnd); - return; - } - - Check(hWnd, R_OPENVPN, t.EnableOpenVPN); - Check(hWnd, R_SSTP, t.EnableSSTP); - - SetIcon(hWnd, 0, ICO_OPENVPN); - - DlgFont(hWnd, S_TITLE, 14, true); - - DlgFont(hWnd, R_OPENVPN, 0, true); - DlgFont(hWnd, S_TOOL, 11, true); - DlgFont(hWnd, R_SSTP, 0, true); - - SmOpenVpnDlgUpdate(hWnd, s); -} -void SmOpenVpnDlgUpdate(HWND hWnd, SM_SERVER *s) -{ - bool b1, b2; - // Validate arguments - if (hWnd == NULL || s == NULL) - { - return; - } - - b1 = IsChecked(hWnd, R_OPENVPN); - b2 = IsChecked(hWnd, R_SSTP); - - SetEnable(hWnd, S_TOOL, b1); - SetEnable(hWnd, S_TOOL2, b1); - SetEnable(hWnd, B_CONFIG, b1); - - SetEnable(hWnd, S_SSTP, b2); -} -void SmOpenVpnDlgOnOk(HWND hWnd, SM_SERVER *s, bool no_close) -{ - OPENVPN_SSTP_CONFIG t; - // Validate arguments - if (hWnd == NULL || s == NULL) - { - return; - } - - Zero(&t, sizeof(t)); - - t.EnableOpenVPN = IsChecked(hWnd, R_OPENVPN); - t.EnableSSTP = IsChecked(hWnd, R_SSTP); - - if (CALL(hWnd, ScSetOpenVpnSstpConfig(s->Rpc, &t)) == false) - { - return; - } - - if (no_close == false) - { - EndDialog(hWnd, 1); - } -} - -// Open the EtherIP ID edit dialog -bool SmEtherIpId(HWND hWnd, SM_ETHERIP_ID *t) -{ - // Validate arguments - if (t == NULL) - { - return false; - } - - if (Dialog(hWnd, D_SM_ETHERIP_ID, SmEtherIpIdDlg, t) == 0) - { - return false; - } - - return true; -} - -// EtherIP ID edit dialog procedure -UINT SmEtherIpIdDlg(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param) -{ - SM_ETHERIP_ID *t = (SM_ETHERIP_ID *)param; - // Validate arguments - if (hWnd == NULL) - { - return 0; - } - - switch (msg) - { - case WM_INITDIALOG: - SmEtherIpIdDlgInit(hWnd, t); - break; - - case WM_COMMAND: - switch (LOWORD(wParam)) - { - case E_ID: - case L_HUBNAME: - case E_USERNAME: - SmEtherIpIdDlgUpdate(hWnd, t); - break; - } - - switch (wParam) - { - case IDOK: - SmEtherIpIdDlgOnOk(hWnd, t); - break; - - case IDCANCEL: - Close(hWnd); - break; - } - break; - - case WM_CLOSE: - EndDialog(hWnd, 0); - break; - } - - return 0; -} - -// Initialize the EtherIP ID edit dialog -void SmEtherIpIdDlgInit(HWND hWnd, SM_ETHERIP_ID *t) -{ - RPC_ENUM_HUB tt; - UINT sel_index; - UINT i; - // Validate arguments - if (hWnd == NULL || t == NULL) - { - return; - } - - SetIcon(hWnd, 0, ICO_KEY); - - // Get the current data in the case of edit mode - if (t->EditMode) - { - Zero(&t->Data, sizeof(t->Data)); - StrCpy(t->Data.Id, sizeof(t->Data.Id), t->EditId); - - if (CALL(hWnd, ScGetEtherIpId(t->s->Rpc, &t->Data)) == false) - { - EndDialog(hWnd, 0); - return; - } - } - - // Enumerate the Virtual HUBs - Zero(&tt, sizeof(tt)); - if (CALL(hWnd, ScEnumHub(t->s->Rpc, &tt)) == false) - { - EndDialog(hWnd, 0); - return; - } - - CbReset(hWnd, L_HUBNAME); - CbSetHeight(hWnd, L_HUBNAME, 18); - sel_index = INFINITE; - - for (i = 0;i < tt.NumHub;i++) - { - RPC_ENUM_HUB_ITEM *e = &tt.Hubs[i]; - UINT index; - - index = CbAddStrA(hWnd, L_HUBNAME, e->HubName, 0); - if (sel_index == INFINITE) - { - sel_index = index; - } - - if (t->EditMode) - { - if (StrCmpi(e->HubName, t->Data.HubName) == 0) - { - sel_index = index; - } - } - } - - if (sel_index != INFINITE) - { - CbSelectIndex(hWnd, L_HUBNAME, sel_index); - } - - if (t->EditMode) - { - SetTextA(hWnd, E_ID, t->Data.Id); - SetTextA(hWnd, E_USERNAME, t->Data.UserName); - SetTextA(hWnd, E_PASSWORD, t->Data.Password); - - FocusEx(hWnd, E_PASSWORD); - } - else - { - Focus(hWnd, E_ID); - } - - FreeRpcEnumHub(&tt); - - t->InitCompleted = true; - SmEtherIpIdDlgUpdate(hWnd, t); -} - -// EtherIP ID edit dialog: Click the OK button -void SmEtherIpIdDlgOnOk(HWND hWnd, SM_ETHERIP_ID *t) -{ - // Validate arguments - if (hWnd == NULL || t == NULL) - { - return; - } - - SmEtherIpIdDlgGetSetting(hWnd, t); - - if (t->EditMode) - { - ETHERIP_ID d; - // Delete old items - Zero(&d, sizeof(d)); - - StrCpy(d.Id, sizeof(d.Id), t->EditId); - - ScDeleteEtherIpId(t->s->Rpc, &d); - } - - if (CALL(hWnd, ScAddEtherIpId(t->s->Rpc, &t->Data)) == false) - { - return; - } - - if (t->EditMode == false) - { - MsgBox(hWnd, MB_ICONINFORMATION, _UU("SM_ETHERIP_ADD_OK")); - } - - EndDialog(hWnd, 1); -} - -// EtherIP ID edit dialog: Update the controls -void SmEtherIpIdDlgUpdate(HWND hWnd, SM_ETHERIP_ID *t) -{ - bool ok = true; - // Validate arguments - if (hWnd == NULL || t == NULL) - { - return; - } - - if (t->InitCompleted == false) - { - return; - } - - SmEtherIpIdDlgGetSetting(hWnd, t); - - if (IsEmptyStr(t->Data.Id) || - IsEmptyStr(t->Data.HubName) || - IsEmptyStr(t->Data.UserName)) - { - ok = false; - } - - SetEnable(hWnd, IDOK, ok); -} - -// EtherIP ID edit dialog: Get the current settings -void SmEtherIpIdDlgGetSetting(HWND hWnd, SM_ETHERIP_ID *t) -{ - wchar_t *ws; - // Validate arguments - if (hWnd == NULL || t == NULL) - { - return; - } - - Zero(&t->Data, sizeof(t->Data)); - - GetTxtA(hWnd, E_ID, t->Data.Id, sizeof(t->Data.Id)); - GetTxtA(hWnd, E_USERNAME, t->Data.UserName, sizeof(t->Data.UserName)); - GetTxtA(hWnd, E_PASSWORD, t->Data.Password, sizeof(t->Data.Password)); - - ws = CbGetStr(hWnd, L_HUBNAME); - - if (ws != NULL && IsEmptyUniStr(ws) == false) - { - UniToStr(t->Data.HubName, sizeof(t->Data.HubName), ws); - } - - Free(ws); -} - - -// Open the EtherIP settings dialog -void SmEtherIp(HWND hWnd, SM_SERVER *s) -{ - // Validate arguments - if (s == NULL) - { - return; - } - - Dialog(hWnd, D_SM_ETHERIP, SmEtherIpDlg, s); -} - -// EtherIP Setup dialog procedure -UINT SmEtherIpDlg(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param) -{ - SM_SERVER *s = (SM_SERVER *)param; - NMHDR *n; - char *id; - SM_ETHERIP_ID t; - // Validate arguments - if (hWnd == NULL) - { - return 0; - } - - switch (msg) - { - case WM_INITDIALOG: - SmEtherIpDlgInit(hWnd, s); - break; - - case WM_COMMAND: - switch (wParam) - { - case IDOK: - // Edit - id = LvGetSelectedStrA(hWnd, L_LIST, 0); - if (id != NULL) - { - Zero(&t, sizeof(t)); - StrCpy(t.EditId, sizeof(t.EditId), id); - t.EditMode = true; - t.s = s; - - if (SmEtherIpId(hWnd, &t)) - { - SmEtherIpDlgRefresh(hWnd, s); - } - - Free(id); - } - break; - - case B_ADD: - // Add - Zero(&t, sizeof(t)); - t.s = s; - if (SmEtherIpId(hWnd, &t)) - { - SmEtherIpDlgRefresh(hWnd, s); - } - break; - - case B_DELETE: - // Delete - if (MsgBox(hWnd, MB_ICONQUESTION | MB_YESNO | MB_DEFBUTTON2, _UU("SM_CRL_DELETE_MSG")) == IDYES) - { - id = LvGetSelectedStrA(hWnd, L_LIST, 0); - if (id != NULL) - { - ETHERIP_ID d; - - Zero(&d, sizeof(d)); - - StrCpy(d.Id, sizeof(d.Id), id); - - if (CALL(hWnd, ScDeleteEtherIpId(s->Rpc, &d))) - { - SmEtherIpDlgRefresh(hWnd, s); - } - - Free(id); - } - } - break; - - case IDCANCEL: - // Close - Close(hWnd); - break; - } - break; - - case WM_NOTIFY: - n = (NMHDR *)lParam; - switch (n->idFrom) - { - case L_LIST: - switch (n->code) - { - case LVN_ITEMCHANGED: - SmEtherIpDlgUpdate(hWnd, s); - break; - - case NM_DBLCLK: - Command(hWnd, IDOK); - break; - } - break; - } - break; - - case WM_CLOSE: - EndDialog(hWnd, 0); - break; - } - - return 0; -} - -// EtherIP Setup dialog data update -void SmEtherIpDlgRefresh(HWND hWnd, SM_SERVER *s) -{ - RPC_ENUM_ETHERIP_ID t; - UINT i; - LVB *b; - // Validate arguments - if (hWnd == NULL || s == NULL) - { - return; - } - - // Data update - Zero(&t, sizeof(t)); - - if (CALL(hWnd, ScEnumEtherIpId(s->Rpc, &t)) == false) - { - EndDialog(hWnd, 0); - return; - } - - b = LvInsertStart(); - - for (i = 0;i < t.NumItem;i++) - { - ETHERIP_ID *d = &t.IdList[i]; - wchar_t id[MAX_SIZE], hubname[MAX_SIZE], username[MAX_SIZE]; - - StrToUni(id, sizeof(id), d->Id); - StrToUni(hubname, sizeof(hubname), d->HubName); - StrToUni(username, sizeof(username), d->UserName); - - LvInsertAdd(b, ICO_CASCADE, NULL, 3, id, hubname, username); - } - - LvInsertEnd(b, hWnd, L_LIST); - - FreeRpcEnumEtherIpId(&t); - - SmEtherIpDlgUpdate(hWnd, s); -} - -// Initialize the EtherIP settings dialog -void SmEtherIpDlgInit(HWND hWnd, SM_SERVER *s) -{ - // Validate arguments - if (hWnd == NULL || s == NULL) - { - return; - } - - SetIcon(hWnd, 0, ICO_MACHINE); - DlgFont(hWnd, S_TITLE, 14, true); - DlgFont(hWnd, S_BOLD, 0, true); - - LvInit(hWnd, L_LIST); - LvInsertColumn(hWnd, L_LIST, 0, _UU("SM_ETHERIP_COLUMN_0"), 205); - LvInsertColumn(hWnd, L_LIST, 1, _UU("SM_ETHERIP_COLUMN_1"), 179); - LvInsertColumn(hWnd, L_LIST, 2, _UU("SM_ETHERIP_COLUMN_2"), 154); - - SmEtherIpDlgRefresh(hWnd, s); -} - -// EtherIP Settings dialog controls update -void SmEtherIpDlgUpdate(HWND hWnd, SM_SERVER *s) -{ - // Validate arguments - if (hWnd == NULL || s == NULL) - { - return; - } - - SetEnable(hWnd, IDOK, LvIsSingleSelected(hWnd, L_LIST)); - SetEnable(hWnd, B_DELETE, LvIsSingleSelected(hWnd, L_LIST)); -} - -// IPsec Settings dialog procedure -UINT SmIPsecDlg(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param) -{ - SM_SERVER *s = (SM_SERVER *)param; - // Validate arguments - if (hWnd == NULL) - { - return 0; - } - - switch (msg) - { - case WM_INITDIALOG: - SmIPsecDlgInit(hWnd, s); - break; - - case WM_COMMAND: - switch (LOWORD(wParam)) - { - case R_L2TP_OVER_IPSEC: - case R_L2TP_RAW: - case R_ETHERIP: - case E_SECRET: - case L_HUBNAME: - SmIPsecDlgUpdate(hWnd, s); - break; - } - - switch (wParam) - { - case IDOK: - SmIPsecDlgOnOk(hWnd, s); - break; - - case IDCANCEL: - Close(hWnd); - break; - - case B_DETAIL: - // Advanced Settings dialog for EtherIP function - SmEtherIp(hWnd, s); - break; - } - break; - - case WM_CLOSE: - EndDialog(hWnd, 0); - break; - } - - return 0; -} - -// IPsec Settings dialog: controls update -void SmIPsecDlgUpdate(HWND hWnd, SM_SERVER *s) -{ - IPSEC_SERVICES sl; - bool ok = true; - // Validate arguments - if (hWnd == NULL || s == NULL) - { - return; - } - - SmIPsecDlgGetSetting(hWnd, &sl); - - //SetEnable(hWnd, S_1, sl.L2TP_IPsec || sl.L2TP_Raw); - //SetEnable(hWnd, S_2, sl.L2TP_IPsec || sl.L2TP_Raw); - //SetEnable(hWnd, L_HUBNAME, sl.L2TP_IPsec || sl.L2TP_Raw); - - SetEnable(hWnd, S_PSK, sl.L2TP_IPsec || sl.EtherIP_IPsec); - SetEnable(hWnd, S_PSK2, sl.L2TP_IPsec || sl.EtherIP_IPsec); - SetEnable(hWnd, E_SECRET, sl.L2TP_IPsec || sl.EtherIP_IPsec); - - SetEnable(hWnd, B_DETAIL, sl.EtherIP_IPsec); - - if ((sl.L2TP_IPsec || sl.EtherIP_IPsec) && IsEmptyStr(sl.IPsec_Secret)) - { - ok = false; - } - - SetEnable(hWnd, IDOK, ok); -} - -// Get the IPsec configuration into the structure -void SmIPsecDlgGetSetting(HWND hWnd, IPSEC_SERVICES *sl) -{ - wchar_t *ws; - // Validate arguments - if (hWnd == NULL || sl == NULL) - { - return; - } - - Zero(sl, sizeof(IPSEC_SERVICES)); - - sl->L2TP_IPsec = IsChecked(hWnd, R_L2TP_OVER_IPSEC); - sl->L2TP_Raw = IsChecked(hWnd, R_L2TP_RAW); - sl->EtherIP_IPsec = IsChecked(hWnd, R_ETHERIP); - - ws = CbGetStr(hWnd, L_HUBNAME); - if (ws != NULL && IsEmptyUniStr(ws) == false) - { - UniToStr(sl->L2TP_DefaultHub, sizeof(sl->L2TP_DefaultHub), ws); - } - - Free(ws); - - GetTxtA(hWnd, E_SECRET, sl->IPsec_Secret, sizeof(sl->IPsec_Secret)); -} - -// IPsec Settings dialog initialization -void SmIPsecDlgInit(HWND hWnd, SM_SERVER *s) -{ - IPSEC_SERVICES sl; - RPC_ENUM_HUB t; - UINT i; - UINT sel_index; - // Validate arguments - if (hWnd == NULL || s == NULL) - { - return; - } - - SetIcon(hWnd, 0, ICO_IPSEC); - - DlgFont(hWnd, S_TITLE, 14, true); - SetFont(hWnd, E_SECRET, GetFont("Verdana", 10, false, false, false, false)); - - DlgFont(hWnd, R_L2TP_OVER_IPSEC, 0, true); - DlgFont(hWnd, R_L2TP_RAW, 0, true); - DlgFont(hWnd, R_ETHERIP, 0, true); - - // Get the configuration - Zero(&sl, sizeof(sl)); - if (CALL(hWnd, ScGetIPsecServices(s->Rpc, &sl)) == false) - { - EndDialog(hWnd, 0); - return; - } - - SetTextA(hWnd, E_SECRET, sl.IPsec_Secret); - - Check(hWnd, R_L2TP_OVER_IPSEC, sl.L2TP_IPsec); - Check(hWnd, R_L2TP_RAW, sl.L2TP_Raw); - Check(hWnd, R_ETHERIP, sl.EtherIP_IPsec); - - // Enumerate the Virtual HUBs - Zero(&t, sizeof(t)); - if (CALL(hWnd, ScEnumHub(s->Rpc, &t)) == false) - { - EndDialog(hWnd, 0); - return; - } - - CbReset(hWnd, L_HUBNAME); - CbSetHeight(hWnd, L_HUBNAME, 18); - - sel_index = INFINITE; - for (i = 0;i < t.NumHub;i++) - { - RPC_ENUM_HUB_ITEM *e = &t.Hubs[i]; - UINT index; - - index = CbAddStrA(hWnd, L_HUBNAME, e->HubName, 0); - if (sel_index == INFINITE) - { - sel_index = index; - } - - if (StrCmpi(e->HubName, sl.L2TP_DefaultHub) == 0) - { - sel_index = index; - } - } - - if (sel_index != INFINITE) - { - CbSelectIndex(hWnd, L_HUBNAME, sel_index); - } - - FreeRpcEnumHub(&t); - - SmIPsecDlgUpdate(hWnd, s); -} - -// IPsec Settings dialog: on click the OK button -void SmIPsecDlgOnOk(HWND hWnd, SM_SERVER *s) -{ - IPSEC_SERVICES sl; - // Validate arguments - if (hWnd == NULL || s == NULL) - { - return; - } - - SmIPsecDlgGetSetting(hWnd, &sl); - - // Confirm the length of the PSK - if (StrLen(sl.IPsec_Secret) >= 10) - { - IPSEC_SERVICES sl_old; - if (ScGetIPsecServices(s->Rpc, &sl_old) == ERR_NO_ERROR) - { - if (StrCmp(sl_old.IPsec_Secret, sl.IPsec_Secret) != 0 || ((sl_old.EtherIP_IPsec == false && sl_old.L2TP_IPsec == false))) - { - if (sl.EtherIP_IPsec || sl.L2TP_IPsec) - { - // Show a warning message if it exceeds 10 characters (Only if there is a change) - if (MsgBox(hWnd, MB_ICONEXCLAMATION | MB_YESNO, _UU("SM_IPSEC_PSK_TOO_LONG")) == IDYES) - { - FocusEx(hWnd, E_SECRET); - return; - } - } - } - } - } - - if (CALL(hWnd, ScSetIPsecServices(s->Rpc, &sl)) == false) - { - return; - } - - EndDialog(hWnd, 1); -} - -// Start the IPsec Settings dialog -void SmIPsec(HWND hWnd, SM_SERVER *s) -{ - // Validate arguments - if (s == NULL) - { - return; - } - - Dialog(hWnd, D_SM_IPSEC, SmIPsecDlg, s); -} - -// Message Settings -void SmHubMsg(HWND hWnd, SM_EDIT_HUB *s) -{ - // Validate arguments - if (s == NULL) - { - return; - } - - Dialog(hWnd, D_SM_MSG, SmHubMsgDlg, s); -} - -// Message dialog procedure -UINT SmHubMsgDlg(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param) -{ - SM_EDIT_HUB *s = (SM_EDIT_HUB *)param; - // Validate arguments - if (hWnd == NULL) - { - return 0; - } - - switch (msg) - { - case WM_INITDIALOG: - SmHubMsgDlgInit(hWnd, s); - break; - - case WM_COMMAND: - switch (LOWORD(wParam)) - { - case E_TEXT: - SmHubMsgDlgUpdate(hWnd, s); - break; - } - - switch (wParam) - { - case IDOK: - SmHubMsgDlgOnOk(hWnd, s); - break; - - case IDCANCEL: - Close(hWnd); - break; - - case C_USEMSG: - SmHubMsgDlgUpdate(hWnd, s); - - if (IsChecked(hWnd, C_USEMSG)) - { - FocusEx(hWnd, E_TEXT); - } - break; - } - - break; - - case WM_CLOSE: - EndDialog(hWnd, 0); - break; - } - - return 0; -} - -// Message dialog initialization -void SmHubMsgDlgInit(HWND hWnd, SM_EDIT_HUB *s) -{ - RPC_MSG t; - // Validate arguments - if (hWnd == NULL || s == NULL) - { - return; - } - - if (MsIsVista()) - { - SetFont(hWnd, E_TEXT, GetMeiryoFont()); - } - else - { - DlgFont(hWnd, E_TEXT, 11, false); - } - - FormatText(hWnd, S_MSG_2, s->HubName); - - LimitText(hWnd, E_TEXT, HUB_MAXMSG_LEN); - - Zero(&t, sizeof(t)); - - StrCpy(t.HubName, sizeof(t.HubName), s->HubName); - - if (CALL(hWnd, ScGetHubMsg(s->p->Rpc, &t)) == false) - { - Close(hWnd); - return; - } - - if (UniIsEmptyStr(t.Msg) == false) - { - SetText(hWnd, E_TEXT, t.Msg); - - Check(hWnd, C_USEMSG, true); - } - else - { - Check(hWnd, C_USEMSG, false); - } - - FreeRpcMsg(&t); - - SmHubMsgDlgUpdate(hWnd, s); -} - -// [OK] button -void SmHubMsgDlgOnOk(HWND hWnd, SM_EDIT_HUB *s) -{ - RPC_MSG t; - // Validate arguments - if (hWnd == NULL || s == NULL) - { - return; - } - - Zero(&t, sizeof(t)); - - StrCpy(t.HubName, sizeof(t.HubName), s->HubName); - - if (IsChecked(hWnd, C_USEMSG) == false) - { - t.Msg = CopyUniStr(L""); - } - else - { - t.Msg = GetText(hWnd, E_TEXT); - } - - if (CALL(hWnd, ScSetHubMsg(s->p->Rpc, &t)) == false) - { - return; - } - - FreeRpcMsg(&t); - - EndDialog(hWnd, 1); -} - -// Message dialog update -void SmHubMsgDlgUpdate(HWND hWnd, SM_EDIT_HUB *s) -{ - bool b = true; - // Validate arguments - if (hWnd == NULL || s == NULL) - { - return; - } - - SetEnable(hWnd, E_TEXT, IsChecked(hWnd, C_USEMSG)); - - if (IsChecked(hWnd, C_USEMSG)) - { - wchar_t *s = GetText(hWnd, E_TEXT); - - b = !IsEmptyUniStr(s); - - Free(s); - } - - SetEnable(hWnd, IDOK, b); -} - -// VLAN utility -void SmVLan(HWND hWnd, SM_SERVER *s) -{ - // Validate arguments - if (s == NULL) - { - return; - } - - Dialog(hWnd, D_SM_VLAN, SmVLanDlg, s); -} - -// VLAN dialog -UINT SmVLanDlg(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param) -{ - SM_SERVER *s = (SM_SERVER *)param; - NMHDR *n; - - // Validate arguments - if (hWnd == NULL) - { - return 0; - } - - switch (msg) - { - case WM_INITDIALOG: - SmVLanDlgInit(hWnd, s); - - if (LvNum(hWnd, L_LIST) == 0) - { - Disable(hWnd, L_LIST); - SetTimer(hWnd, 1, 100, NULL); - } - break; - - case WM_TIMER: - switch (wParam) - { - case 1: - KillTimer(hWnd, 1); - - MsgBoxEx(hWnd, MB_ICONINFORMATION, _UU("SM_VLAN_NOTHING"), - s->CurrentSetting->ClientOption.Hostname); - break; - } - break; - - case WM_COMMAND: - switch (wParam) - { - case IDOK: - case IDCANCEL: - Close(hWnd); - break; - - case B_ENABLE: - case B_DISABLE: - { - UINT i = LvGetSelected(hWnd, L_LIST); - if (i != INFINITE) - { - char *name = LvGetStrA(hWnd, L_LIST, i, 0); - - if (IsEmptyStr(name) == false) - { - RPC_TEST t; - - Zero(&t, sizeof(t)); - - StrCpy(t.StrValue, sizeof(t.StrValue), name); - t.IntValue = BOOL_TO_INT(wParam == B_ENABLE); - - if (CALL(hWnd, ScSetEnableEthVLan(s->Rpc, &t))) - { - SmVLanDlgRefresh(hWnd, s); - - if (wParam == B_ENABLE) - { - MsgBoxEx(hWnd, MB_ICONINFORMATION, - _UU("SM_VLAN_MSG_1"), - name, name, name); - } - else - { - MsgBoxEx(hWnd, MB_ICONINFORMATION, - _UU("SM_VLAN_MSG_2"), - name); - } - } - } - - Free(name); - } - break; - } - } - break; - - case WM_NOTIFY: - n = (NMHDR *)lParam; - switch (n->idFrom) - { - case L_LIST: - switch (n->code) - { - case LVN_ITEMCHANGED: - SmVLanDlgUpdate(hWnd, s); - break; - } - break; - } - break; - - case WM_CLOSE: - EndDialog(hWnd, 0); - break; - } - - return 0; -} - -// VLAN dialog initialization -void SmVLanDlgInit(HWND hWnd, SM_SERVER *s) -{ - // Validate arguments - if (hWnd == NULL || s == NULL) - { - return; - } - - LvInit(hWnd, L_LIST); - LvInsertColumn(hWnd, L_LIST, 0, _UU("SM_VLAN_COLUMN_0"), 245); - LvInsertColumn(hWnd, L_LIST, 1, _UU("SM_VLAN_COLUMN_1"), 75); - LvInsertColumn(hWnd, L_LIST, 2, _UU("SM_VLAN_COLUMN_2"), 100); - LvInsertColumn(hWnd, L_LIST, 3, _UU("SM_VLAN_COLUMN_3"), 100); - LvInsertColumn(hWnd, L_LIST, 4, _UU("SM_VLAN_COLUMN_4"), 290); - LvInsertColumn(hWnd, L_LIST, 5, _UU("SM_VLAN_COLUMN_5"), 430); - - SmVLanDlgRefresh(hWnd, s); -} - -// VLAN dialog content update -void SmVLanDlgRefresh(HWND hWnd, SM_SERVER *s) -{ - LVB *b; - RPC_ENUM_ETH_VLAN t; - UINT i; - // Validate arguments - if (hWnd == NULL || s == NULL) - { - return; - } - - Zero(&t, sizeof(t)); - if (CALL(hWnd, ScEnumEthVLan(s->Rpc, &t)) == false) - { - Close(hWnd); - return; - } - - b = LvInsertStart(); - - for (i = 0;i < t.NumItem;i++) - { - RPC_ENUM_ETH_VLAN_ITEM *e = &t.Items[i]; - - if (e->Support) - { - wchar_t tmp0[MAX_SIZE]; - wchar_t tmp1[MAX_SIZE]; - wchar_t tmp2[MAX_SIZE]; - wchar_t *tmp3; - wchar_t tmp4[MAX_SIZE]; - wchar_t tmp5[MAX_SIZE]; - - StrToUni(tmp0, sizeof(tmp0), e->DeviceName); - StrToUni(tmp1, sizeof(tmp1), e->DriverType); - StrToUni(tmp2, sizeof(tmp2), e->DriverName); - tmp3 = (e->Enabled ? _UU("SM_VLAN_YES") : _UU("SM_VLAN_NO")); - StrToUni(tmp4, sizeof(tmp4), e->Guid); - StrToUni(tmp5, sizeof(tmp5), e->DeviceInstanceId); - - LvInsertAdd(b, - e->Enabled ? ICO_NIC_ONLINE : ICO_NIC_OFFLINE, 0, 6, - tmp0, tmp1, tmp2, tmp3, tmp4, tmp5); - } - } - - LvInsertEnd(b, hWnd, L_LIST); - - FreeRpcEnumEthVLan(&t); - - SmVLanDlgUpdate(hWnd, s); -} - -// VLAN dialog control update -void SmVLanDlgUpdate(HWND hWnd, SM_SERVER *s) -{ - // Validate arguments - if (hWnd == NULL || s == NULL) - { - return; - } - - if (LvIsSingleSelected(hWnd, L_LIST) == false) - { - Disable(hWnd, B_ENABLE); - Disable(hWnd, B_DISABLE); - } - else - { - UINT i = LvGetSelected(hWnd, L_LIST); - if (i != INFINITE) - { - wchar_t *s = LvGetStr(hWnd, L_LIST, i, 3); - - if (UniStrCmpi(s, _UU("SM_VLAN_YES")) != 0) - { - Enable(hWnd, B_ENABLE); - Disable(hWnd, B_DISABLE); - } - else - { - Enable(hWnd, B_DISABLE); - Disable(hWnd, B_ENABLE); - } - - Free(s); - } - } -} - -// Examine whether the current state of VPN Server / VPN Bridge is the initial state -bool SmSetupIsNew(SM_SERVER *s) -{ - RPC *rpc; - bool is_bridge; - char hubname[MAX_HUBNAME_LEN + 1]; - bool check_hub = false; - // Validate arguments - if (s == NULL) - { - return false; - } - - if (s->ServerAdminMode == false) - { - return false; - } - - rpc = s->Rpc; - is_bridge =s->Bridge; - - // Server type - if (is_bridge == false) - { - bool b = false; - RPC_SERVER_INFO t; - - Zero(&t, sizeof(t)); - if (ScGetServerInfo(rpc, &t) == ERR_NO_ERROR) - { - if (t.ServerType != SERVER_TYPE_STANDALONE) - { - b = true; - } - - FreeRpcServerInfo(&t); - } - else - { - return false; - } - - if (b) - { - return false; - } - } - - // Local bridge - if (true) - { - RPC_ENUM_LOCALBRIDGE t; - bool b = false; - - Zero(&t, sizeof(t)); - if (ScEnumLocalBridge(rpc, &t) == ERR_NO_ERROR) - { - if (t.NumItem != 0) - { - b = true; - } - FreeRpcEnumLocalBridge(&t); - } - - if (b) - { - return false; - } - } - - // Virtual HUB - - check_hub = false; - - if (is_bridge == false) - { - RPC_ENUM_HUB t; - bool b = false; - - Zero(&t, sizeof(t)); - if (ScEnumHub(rpc, &t) == ERR_NO_ERROR) - { - if (t.NumHub >= 2) - { - b = true; - } - else if (t.NumHub == 1) - { - if (StrCmpi(t.Hubs[0].HubName, SERVER_DEFAULT_HUB_NAME) != 0) - { - b = true; - } - else - { - check_hub = true; - } - } - - FreeRpcEnumHub(&t); - } - - if (b) - { - return false; - } - } - else - { - check_hub = true; - } - - // Status of the virtual HUB - if (is_bridge == false) - { - StrCpy(hubname, sizeof(hubname), SERVER_DEFAULT_HUB_NAME); - } - else - { - StrCpy(hubname, sizeof(hubname), SERVER_DEFAULT_BRIDGE_NAME); - } - - if (check_hub) - { - if (true) - { - // Number of objects in the Virtual HUB - RPC_HUB_STATUS t; - - Zero(&t, sizeof(t)); - StrCpy(t.HubName, sizeof(t.HubName), hubname); - - if (ScGetHubStatus(rpc, &t) == ERR_NO_ERROR) - { - if (t.NumSessions != 0 || t.NumAccessLists != 0 || - t.NumUsers != 0 || t.NumGroups != 0 || - t.NumMacTables != 0 || t.NumIpTables != 0 || - t.SecureNATEnabled) - { - return false; - } - } - else - { - return false; - } - } - - if (true) - { - // Cascade connection - RPC_ENUM_LINK t; - - Zero(&t, sizeof(t)); - StrCpy(t.HubName, sizeof(t.HubName), hubname); - - if (ScEnumLink(rpc, &t) == ERR_NO_ERROR) - { - bool b = false; - - if (t.NumLink != 0) - { - b = true; - } - - FreeRpcEnumLink(&t); - - if (b) - { - return false; - } - } - else - { - return false; - } - } - - if (is_bridge == false) - { - // Certificate list to trust - RPC_HUB_ENUM_CA t; - - Zero(&t, sizeof(t)); - StrCpy(t.HubName, sizeof(t.HubName), hubname); - - if (ScEnumCa(rpc, &t) == ERR_NO_ERROR) - { - bool b = false; - - if (t.NumCa != 0) - { - b = true; - } - - FreeRpcHubEnumCa(&t); - - if (b) - { - return false; - } - } - else - { - return false; - } - } - - if (is_bridge == false) - { - // Certificate revocation list - RPC_ENUM_CRL t; - - Zero(&t, sizeof(t)); - StrCpy(t.HubName, sizeof(t.HubName), hubname); - - if (ScEnumCrl(rpc, &t) == ERR_NO_ERROR) - { - bool b = false; - - if (t.NumItem != 0) - { - b = true; - } - - FreeRpcEnumCrl(&t); - - if (b) - { - return false; - } - } - else - { - return false; - } - } - - if (is_bridge == false) - { - // Authentication server configuration - RPC_RADIUS t; - - Zero(&t, sizeof(t)); - StrCpy(t.HubName, sizeof(t.HubName), hubname); - - if (ScGetHubRadius(rpc, &t) == ERR_NO_ERROR) - { - if (IsEmptyStr(t.RadiusServerName) == false) - { - return false; - } - } - else - { - return false; - } - } - - if (is_bridge == false) - { - // Virtual HUB configuration - RPC_CREATE_HUB t; - - Zero(&t, sizeof(t)); - StrCpy(t.HubName, sizeof(t.HubName), hubname); - - if (ScGetHub(rpc, &t) == ERR_NO_ERROR) - { - if (t.HubOption.NoEnum || t.HubOption.MaxSession != 0 || - t.Online == false) - { - return false; - } - } - else - { - return false; - } - } - - if (is_bridge == false) - { - // IP access control list - RPC_AC_LIST t; - - Zero(&t, sizeof(t)); - StrCpy(t.HubName, sizeof(t.HubName), hubname); - - if (ScGetAcList(rpc, &t) == ERR_NO_ERROR) - { - bool b = false; - if (LIST_NUM(t.o) != 0) - { - b = true; - } - FreeRpcAcList(&t); - - if (b) - { - return false; - } - } - else - { - return false; - } - } - - if (is_bridge == false) - { - // AO - RPC_ADMIN_OPTION t; - - Zero(&t, sizeof(t)); - StrCpy(t.HubName, sizeof(t.HubName), hubname); - - if (ScGetHubAdminOptions(rpc, &t) == ERR_NO_ERROR) - { - bool b = false; - UINT i; - - for (i = 0;i < t.NumItem;i++) - { - if (t.Items[i].Value != 0) - { - b = true; - } - } - - FreeRpcAdminOption(&t); - - if (b) - { - return false; - } - } - else - { - return false; - } - } - } - - // Virtual layer 3 switch - if (is_bridge == false) - { - RPC_ENUM_L3SW t; - bool b = false; - - Zero(&t, sizeof(t)); - if (ScEnumL3Switch(rpc, &t) == ERR_NO_ERROR) - { - if (t.NumItem != 0) - { - b = true; - } - - FreeRpcEnumL3Sw(&t); - } - else - { - return false; - } - - if (b) - { - return false; - } - } - - return true; -} - -// Setup procedure dialog initialization -void SmSetupStepDlgInit(HWND hWnd, SM_SETUP *s) -{ - bool b; - RPC_ENUM_ETH t; - UINT i; - RPC_BRIDGE_SUPPORT bs; - // Validate arguments - if (hWnd == NULL || s == NULL) - { - return; - } - - SetIcon(hWnd, 0, ICO_SETUP); - - DlgFont(hWnd, S_1_1, 0, true); - DlgFont(hWnd, S_2_1, 0, true); - DlgFont(hWnd, S_3_1, 0, true); - - b = false; - if (s->UseRemote) - { - b = true; - } - if (s->UseSite && s->UseSiteEdge == false) - { - b = true; - } - - SetEnable(hWnd, S_1_1, b); - SetEnable(hWnd, S_1_2, b); - SetEnable(hWnd, B_USER, b); - - b = false; - if (s->UseSiteEdge) - { - b = true; - } - - SetEnable(hWnd, S_2_1, b); - SetEnable(hWnd, S_2_2, b); - SetEnable(hWnd, B_CASCADE, b); - - CbReset(hWnd, C_DEVICE); - CbSetHeight(hWnd, C_DEVICE, 18); - - Zero(&t, sizeof(t)); - - CbAddStr(hWnd, C_DEVICE, _UU("SM_SETUP_SELECT"), 0); - - Zero(&bs, sizeof(bs)); - if (CALL(hWnd, ScGetBridgeSupport(s->Rpc, &bs)) == false) - { - return; - } - - if (bs.IsBridgeSupportedOs) - { - // Enumerate the local bridges - if (ScEnumEthernet(s->Rpc, &t) == ERR_NO_ERROR) - { - for (i = 0;i < t.NumItem;i++) - { - wchar_t tmp[MAX_PATH]; - RPC_ENUM_ETH_ITEM *e = &t.Items[i]; - - if (GetCapsBool(s->s->CapsList, "b_support_network_connection_name")) - { - UniFormat(tmp, sizeof(tmp), BRIDGE_NETWORK_CONNECTION_STR, e->NetworkConnectionName, e->DeviceName); - } - else - { - StrToUni(tmp, sizeof(tmp), e->DeviceName); - } - - CbAddStr(hWnd, C_DEVICE, tmp, 1); - } - - FreeRpcEnumEth(&t); - } - Show(hWnd, C_DEVICE); - Hide(hWnd, B_SECURENAT); - } - else - { - RPC_HUB t; - - // Enable the SecureNAT automatically if the local bridge does not work in this environment - SetText(hWnd, S_3_2, _UU("SM_SETUP_STEP_SECURENAT")); - SetText(hWnd, S_3_1, _UU("SM_SETUP_STEP_SECURENAT_TITLE")); - Hide(hWnd, C_DEVICE); - Show(hWnd, B_SECURENAT); - SetIcon(hWnd, S_ICON, ICO_ROUTER); - - Zero(&t, sizeof(t)); - StrCpy(t.HubName, sizeof(t.HubName), s->HubName); - - ScEnableSecureNAT(s->Rpc, &t); - } - - s->Flag1 = false; - s->Flag2 = false; -} - -// Close -void SmSetupOnClose(HWND hWnd, SM_SETUP *s) -{ - wchar_t *tmp; - char name[MAX_PATH]; - RPC_BRIDGE_SUPPORT bs; - // Validate arguments - if (hWnd == NULL || s == NULL) - { - return; - } - - Zero(&bs, sizeof(bs)); - if (CALL(hWnd, ScGetBridgeSupport(s->Rpc, &bs)) == false) - { - return; - } - - if (bs.IsBridgeSupportedOs) - { - // Add a Local Bridge - tmp = CbGetStr(hWnd, C_DEVICE); - - if (tmp != NULL) - { - UniToStr(name, sizeof(name), tmp); - - if (CbGetSelect(hWnd, C_DEVICE) != 0) - { - // Show a warning message if the VPN Server is running in a VM - if (GetCapsBool(s->s->CapsList, "b_is_in_vm")) - { - Dialog(hWnd, D_SM_VMBRIDGE, SmVmBridgeDlg, NULL); - } - - if (GetCapsBool(s->s->CapsList, "b_support_network_connection_name") == false) - { - RPC_LOCALBRIDGE t; - - Zero(&t, sizeof(t)); - t.Active = true; - StrCpy(t.DeviceName, sizeof(t.DeviceName), name); - StrCpy(t.HubName, sizeof(t.HubName), s->HubName); - t.Online = true; - t.TapMode = false; - - if (CALL(hWnd, ScAddLocalBridge(s->Rpc, &t)) == false) - { - Free(tmp); - return; - } - } - else - { - RPC_ENUM_ETH tt; - UINT i; - - Zero(&tt, sizeof(tt)); - if (CALL(hWnd, ScEnumEthernet(s->Rpc, &tt)) == false) - { - Free(tmp); - return; - } - - for (i = 0;i < tt.NumItem;i++) - { - RPC_ENUM_ETH_ITEM *ti = &tt.Items[i]; - wchar_t fullname[MAX_SIZE]; - - UniFormat(fullname, sizeof(fullname), BRIDGE_NETWORK_CONNECTION_STR, ti->NetworkConnectionName, ti->DeviceName); - - if (UniStrCmpi(fullname, tmp) == 0) - { - RPC_LOCALBRIDGE t; - - Zero(&t, sizeof(t)); - t.Active = true; - StrCpy(t.DeviceName, sizeof(t.DeviceName), ti->DeviceName); - StrCpy(t.HubName, sizeof(t.HubName), s->HubName); - t.Online = true; - t.TapMode = false; - - if (CALL(hWnd, ScAddLocalBridge(s->Rpc, &t)) == false) - { - FreeRpcEnumEth(&tt); - Free(tmp); - return; - } - break; - } - } - - FreeRpcEnumEth(&tt); - } - - } - Free(tmp); - } - } - else - { - // Enable the SecureNAT - } - - EndDialog(hWnd, 0); -} - -// Setup Procedure dialog procedure -UINT SmSetupStepDlg(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param) -{ - SM_SETUP *s = (SM_SETUP *)param; - // Validate arguments - if (hWnd == NULL) - { - return 0; - } - - switch (msg) - { - case WM_INITDIALOG: - // Initialize - SmSetupStepDlgInit(hWnd, s); - break; - - case WM_COMMAND: - switch (wParam) - { - case B_USER: - // User creation - if (true) - { - SM_HUB h; - - Zero(&h, sizeof(h)); - h.HubName = s->HubName; - h.p = s->s; - h.Rpc = s->Rpc; - - SmUserListDlgEx(hWnd, &h, NULL, s->Flag1 ? false : true); - - s->Flag1 = true; - } - break; - - case B_CASCADE: - // Create a cascade connection - if (true) - { - SM_HUB h; - - Zero(&h, sizeof(h)); - h.HubName = s->HubName; - h.p = s->s; - h.Rpc = s->Rpc; - - SmLinkDlgEx(hWnd, &h, s->Flag2 ? false : true); - s->Flag2 = true; - } - break; - - case B_SECURENAT: - // Setting the SecureNAT - if (true) - { - SM_HUB h; - - Zero(&h, sizeof(h)); - h.p = s->s; - h.Rpc = s->Rpc; - h.HubName = s->HubName; - - Dialog(hWnd, D_SM_SNAT, SmSNATDlgProc, &h); - } - break; - - case IDCANCEL: - // Close button - Close(hWnd); - break; - } - break; - - case WM_CLOSE: - // Exit - SmSetupOnClose(hWnd, s); - break; - } - - return 0; -} - -// Setup procedure dialog -void SmSetupStep(HWND hWnd, SM_SETUP *s) -{ - // Validate arguments - if (s == NULL) - { - return; - } - - Dialog(hWnd, D_SM_SETUP_STEP, SmSetupStepDlg, s); -} - -// Initialize by setup -bool SmSetupInit(HWND hWnd, SM_SETUP *s) -{ - // Validate arguments - if (s == NULL) - { - return false; - } - - if (s->IsBridge == false) - { - if (SmSetupDeleteAllLayer3(hWnd, s) == false) - { - return false; - } - - if (SmSetupDeleteAllHub(hWnd, s) == false) - { - return false; - } - } - else - { - if (SmSetupDeleteAllObjectInBridgeHub(hWnd, s) == false) - { - return false; - } - } - - SmSetupDeleteAllLocalBridge(hWnd, s); - - if (s->IsBridge == false) - { - // Create a Virtual HUB - RPC_CREATE_HUB t; - char *password = ""; - - Zero(&t, sizeof(t)); - Sha0(t.HashedPassword, password, StrLen(password)); - HashPassword(t.SecurePassword, ADMINISTRATOR_USERNAME, password); - StrCpy(t.HubName, sizeof(t.HubName), s->HubName); - t.HubType = HUB_TYPE_STANDALONE; - t.Online = true; - - if (CALL(hWnd, ScCreateHub(s->Rpc, &t)) == false) - { - return false; - } - } - - return true; -} - -// Remove all objects in the Virtual HUB of the VPN Bridge -bool SmSetupDeleteAllObjectInBridgeHub(HWND hWnd, SM_SETUP *s) -{ - char *hubname = SERVER_DEFAULT_BRIDGE_NAME; - // Validate arguments - if (hWnd == NULL || s == NULL) - { - return false; - } - - if (true) - { - RPC_ENUM_LINK t; - UINT i; - - Zero(&t, sizeof(t)); - StrCpy(t.HubName, sizeof(t.HubName), hubname); - - if (CALL(hWnd, ScEnumLink(s->Rpc, &t)) == false) - { - return false; - } - - for (i = 0;i < t.NumLink;i++) - { - RPC_ENUM_LINK_ITEM *e = &t.Links[i]; - RPC_LINK a; - - Zero(&a, sizeof(a)); - StrCpy(a.HubName, sizeof(a.HubName), hubname); - UniStrCpy(a.AccountName, sizeof(a.AccountName), e->AccountName); - - if (CALL(hWnd, ScDeleteLink(s->Rpc, &a)) == false) - { - FreeRpcEnumLink(&t); - return false; - } - } - - FreeRpcEnumLink(&t); - } - - if (true) - { - RPC_HUB t; - - Zero(&t, sizeof(t)); - StrCpy(t.HubName, sizeof(t.HubName), hubname); - - if (CALL(hWnd, ScDisableSecureNAT(s->Rpc, &t)) == false) - { - return false; - } - } - - return true; -} - -// Delete all Virtual Layer 3 Switches -bool SmSetupDeleteAllLayer3(HWND hWnd, SM_SETUP *s) -{ - RPC_ENUM_L3SW t; - UINT i; - // Validate arguments - if (hWnd == NULL || s == NULL) - { - return false; - } - - Zero(&t, sizeof(t)); - if(CALL(hWnd, ScEnumL3Switch(s->Rpc, &t)) == false) - { - return false; - } - - for (i = 0;i < t.NumItem;i++) - { - RPC_ENUM_L3SW_ITEM *e = &t.Items[i]; - RPC_L3SW tt; - - Zero(&tt, sizeof(tt)); - StrCpy(tt.Name, sizeof(tt.Name), e->Name); - - if (CALL(hWnd, ScDelL3Switch(s->Rpc, &tt)) == false) - { - FreeRpcEnumL3Sw(&t); - return false; - } - } - - FreeRpcEnumL3Sw(&t); - - return true; -} - -// Delete all local bridges -bool SmSetupDeleteAllLocalBridge(HWND hWnd, SM_SETUP *s) -{ - RPC_ENUM_LOCALBRIDGE t; - UINT i; - // Validate arguments - if (hWnd == NULL || s == NULL) - { - return false; - } - - Zero(&t, sizeof(t)); - if (ScEnumLocalBridge(s->Rpc, &t) != ERR_NO_ERROR) - { - return false; - } - - for (i = 0;i < t.NumItem;i++) - { - RPC_LOCALBRIDGE *e = &t.Items[i]; - - if (CALL(hWnd, ScDeleteLocalBridge(s->Rpc, e)) == false) - { - FreeRpcEnumLocalBridge(&t); - return false; - } - } - - FreeRpcEnumLocalBridge(&t); - - return true; -} - -// Delete all Virtual HUBs -bool SmSetupDeleteAllHub(HWND hWnd, SM_SETUP *s) -{ - RPC_ENUM_HUB t; - UINT i; - // Validate arguments - if (hWnd == NULL || s == NULL) - { - return false; - } - - Zero(&t, sizeof(t)); - if (CALL(hWnd, ScEnumHub(s->Rpc, &t)) == false) - { - return false; - } - - for (i = 0;i < t.NumHub;i++) - { - RPC_ENUM_HUB_ITEM *e = &t.Hubs[i]; - RPC_DELETE_HUB tt; - - Zero(&tt, sizeof(tt)); - StrCpy(tt.HubName, sizeof(tt.HubName), e->HubName); - - if (CALL(hWnd, ScDeleteHub(s->Rpc, &tt)) == false) - { - FreeRpcEnumHub(&t); - return false; - } - } - - FreeRpcEnumHub(&t); - - return true; -} - -// Update the control of the Virtual HUB -void SmSetupHubDlgUpdate(HWND hWnd, SM_SETUP *s) -{ - bool ok = true; - char tmp[MAX_HUBNAME_LEN + 1]; - // Validate arguments - if (hWnd == NULL || s == NULL) - { - return; - } - - GetTxtA(hWnd, E_HUBNAME, tmp, sizeof(tmp)); - - if (IsEmptyStr(tmp) || IsSafeStr(tmp) == false) - { - ok = false; - } - - SetEnable(hWnd, IDOK, ok); -} - -// Virtual HUB creation dialog -UINT SmSetupHubDlg(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param) -{ - SM_SETUP *s = (SM_SETUP *)param; - // Validate arguments - if (hWnd == NULL) - { - return 0; - } - - switch (msg) - { - case WM_INITDIALOG: - SetTextA(hWnd, E_HUBNAME, "VPN"); - FocusEx(hWnd, E_HUBNAME); - SmSetupHubDlgUpdate(hWnd, s); - break; - - case WM_COMMAND: - SmSetupHubDlgUpdate(hWnd, s); - - switch (wParam) - { - case IDOK: - GetTxtA(hWnd, E_HUBNAME, s->HubName, sizeof(s->HubName)); - EndDialog(hWnd, true); - break; - - case IDCANCEL: - Close(hWnd); - break; - } - break; - - case WM_CLOSE: - EndDialog(hWnd, 0); - break; - } - - return 0; -} - -// Setup dialog: [Next] button -void SmSetupDlgOnOk(HWND hWnd, SM_SETUP *s) -{ - // Validate arguments - if (hWnd == NULL || s == NULL) - { - return; - } - - if (MsgBox(hWnd, MB_YESNO | MB_ICONEXCLAMATION, _UU("SM_SETUP_WARNING")) == IDNO) - { - return; - } - - s->UseRemote = IsChecked(hWnd, C_REMOTE); - s->UseSite = IsChecked(hWnd, C_SITE); - s->UseSiteEdge = IsChecked(hWnd, C_EDGE); - - if (s->IsBridge) - { - StrCpy(s->HubName, sizeof(s->HubName), SERVER_DEFAULT_BRIDGE_NAME); - } - else - { - if (Dialog(hWnd, D_SM_SETUP_HUB, SmSetupHubDlg, s) == false) - { - return; - } - } - - // Initialize (Wipe existing objects) - if (SmSetupInit(hWnd, s) == false) - { - return; - } - - if (s->IsBridge == false) - { - if (GetCapsBool(s->s->CapsList, "b_support_ddns")) - { - if (s->UseRemote || (s->UseSite && s->UseSiteEdge == false)) - { - DDNS_CLIENT_STATUS st; - - Zero(&st, sizeof(st)); - - if (ScGetDDnsClientStatus(s->s->Rpc, &st) == ERR_NO_ERROR && - IsEmptyStr(st.CurrentHostName) == false) - { - // Display the Dynamic DNS setting screen - SmDDns(hWnd, s->s, true, false); - } - } - } - - // Configure the IPsec if the IPsec feature is available - if (GetCapsBool(s->s->CapsList, "b_support_ipsec") && s->s->IPsecMessageDisplayed == false) - { - // Display a message about IPsec - RPC_TEST flag; - - if (s->UseRemote || (s->UseSite && s->UseSiteEdge == false)) - { - SmIPsec(hWnd, s->s); - } - - Zero(&flag, sizeof(flag)); - flag.IntValue = 9; - ToStr(flag.StrValue, 1); - - ScDebug(s->s->Rpc, &flag); - - s->s->IPsecMessageDisplayed = true; - } - - // Configure the VPN Azure if VPN Azure feature is available - if (GetCapsBool(s->s->CapsList, "b_support_azure")) - { - SmAzure(hWnd, s->s, true); - } - - } - - // Execute the procedure - SmSetupStep(hWnd, s); - - // Close the dialog - EndDialog(hWnd, true); -} - -// Setup dialog: initialization -void SmSetupDlgInit(HWND hWnd, SM_SETUP *s) -{ - // Validate arguments - if (hWnd == NULL || s == NULL) - { - return; - } - - SetIcon(hWnd, 0, ICO_SETUP); - DlgFont(hWnd, S_TITLE, 14, true); - DlgFont(hWnd, C_REMOTE, 0, true); - DlgFont(hWnd, C_SITE, 0, true); - DlgFont(hWnd, C_OTHER, 0, true); - - if (s->IsBridge) - { - SetText(hWnd, B_BOLD, _UU("SM_SETUP_BRIDGE_ONLY")); - SetText(hWnd, C_EDGE, _UU("SM_SETUP_BRIDGE_EDGE")); - - Check(hWnd, C_SITE, true); - Check(hWnd, C_EDGE, true); - Focus(hWnd, C_SITE); - } - - SmSetupDlgUpdate(hWnd, s); -} - -// Setup dialog: update -void SmSetupDlgUpdate(HWND hWnd, SM_SETUP *s) -{ - bool enable_remote = true; - bool enable_site = true; - bool enable_site_center = true; - bool enable_detail = true; - bool ok = true; - // Validate arguments - if (hWnd == NULL || s == NULL) - { - return; - } - - if (s->IsBridge) - { - enable_remote = false; - enable_site_center = false; - enable_detail = false; - } - - if (IsChecked(hWnd, C_OTHER)) - { - ok = false; - } - - SetEnable(hWnd, C_REMOTE, enable_remote && IsChecked(hWnd, C_OTHER) == false); - SetEnable(hWnd, S_REMOTE_1, enable_remote && IsChecked(hWnd, C_OTHER) == false); - - SetEnable(hWnd, C_SITE, enable_site && IsChecked(hWnd, C_OTHER) == false); - SetEnable(hWnd, S_SITE_1, enable_site && IsChecked(hWnd, C_OTHER) == false); - SetEnable(hWnd, S_SITE_2, enable_site && IsChecked(hWnd, C_SITE) && IsChecked(hWnd, C_OTHER) == false); - SetEnable(hWnd, C_CENTER, enable_site && enable_site_center && IsChecked(hWnd, C_SITE) && IsChecked(hWnd, C_OTHER) == false); - SetEnable(hWnd, C_EDGE, enable_site && IsChecked(hWnd, C_SITE) && IsChecked(hWnd, C_OTHER) == false); - - SetEnable(hWnd, C_OTHER, enable_detail); - SetEnable(hWnd, S_OTHER, enable_detail); - - if (IsChecked(hWnd, C_REMOTE) == false && IsChecked(hWnd, C_SITE) == false) - { - ok = false; - } - - if (IsChecked(hWnd, C_SITE)) - { - if (IsChecked(hWnd, C_CENTER) == false && IsChecked(hWnd, C_EDGE) == false) - { - ok = false; - } - } - - SetEnable(hWnd, IDOK, ok); - - SetText(hWnd, S_INFO, - IsChecked(hWnd, C_OTHER) ? _UU("SM_SETUP_INFO_2") : _UU("SM_SETUP_INFO_1")); -} - -// Setup dialog -UINT SmSetupDlg(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param) -{ - SM_SETUP *s = (SM_SETUP *)param; - // Validate arguments - if (hWnd == NULL) - { - return 0; - } - - switch (msg) - { - case WM_INITDIALOG: - SmSetupDlgInit(hWnd, s); - break; - - case WM_COMMAND: - SmSetupDlgUpdate(hWnd, s); - - switch (wParam) - { - case IDOK: - SmSetupDlgOnOk(hWnd, s); - break; - - case IDCANCEL: - Close(hWnd); - break; - } - break; - - case WM_CLOSE: - EndDialog(hWnd, 0); - break; - } - - return 0; -} - -// Setup -bool SmSetup(HWND hWnd, SM_SERVER *s) -{ - SM_SETUP ss; - // Validate arguments - if (s == NULL) - { - return false; - } - - Zero(&ss, sizeof(ss)); - ss.s = s; - ss.IsBridge = ss.s->Bridge; - ss.Rpc = s->Rpc; - - if (Dialog(hWnd, D_SM_SETUP, SmSetupDlg, &ss) == false) - { - return false; - } - - return true; -} - -// License registration process -void SmLicenseAddDlgOnOk(HWND hWnd, SM_SERVER *s) -{ - char tmp[MAX_SIZE]; - // Validate arguments - if (hWnd == NULL || s == NULL) - { - return; - } - - SmLicenseAddDlgGetText(hWnd, tmp, sizeof(tmp)); - - if (LiIsLicenseKey(tmp)) - { - RPC_TEST t; - - Disable(hWnd, IDOK); - Disable(hWnd, IDCANCEL); - - Zero(&t, sizeof(t)); - StrCpy(t.StrValue, sizeof(t.StrValue), tmp); - - if (CALL(hWnd, ScAddLicenseKey(s->Rpc, &t)) == false) - { - FocusEx(hWnd, B_KEY6); - } - else - { - EndDialog(hWnd, true); - } - - Enable(hWnd, IDOK); - Enable(hWnd, IDCANCEL); - } -} - -// Shift treatment of text input -void SmLicenseAddDlgShiftTextItem(HWND hWnd, UINT id1, UINT id2, UINT *next_focus) -{ - char *s; - // Validate arguments - if (hWnd == NULL || next_focus == NULL) - { - return; - } - - s = GetTextA(hWnd, id1); - if (StrLen(s) >= 6) - { - char *s2 = CopyStr(s); - char tmp[MAX_SIZE]; - s2[6] = 0; - SetTextA(hWnd, id1, s2); - Free(s2); - - if (id2 != 0) - { - GetTxtA(hWnd, id2, tmp, sizeof(tmp)); - - StrCat(tmp, sizeof(tmp), s + 6); - ReplaceStrEx(tmp, sizeof(tmp), tmp, "-", "", false); - - SetTextA(hWnd, id2, tmp); - - *next_focus = id2; - } - else - { - *next_focus = IDOK; - } - } - - Free(s); -} - -// Make a text from the input data -void SmLicenseAddDlgGetText(HWND hWnd, char *str, UINT size) -{ - char *k1, *k2, *k3, *k4, *k5, *k6; - // Validate arguments - if (hWnd == NULL || str == NULL) - { - return; - } - - k1 = GetTextA(hWnd, B_KEY1); - k2 = GetTextA(hWnd, B_KEY2); - k3 = GetTextA(hWnd, B_KEY3); - k4 = GetTextA(hWnd, B_KEY4); - k5 = GetTextA(hWnd, B_KEY5); - k6 = GetTextA(hWnd, B_KEY6); - - Format(str, size, "%s-%s-%s-%s-%s-%s", k1, k2, k3, k4, k5, k6); - - Free(k1); - Free(k2); - Free(k3); - Free(k4); - Free(k5); - Free(k6); -} - -// License addition dialog update -void SmLicenseAddDlgUpdate(HWND hWnd, SM_SERVER *s) -{ - UINT next_focus = 0; - char tmp[MAX_SIZE]; - // Validate arguments - if (s == NULL || hWnd == NULL) - { - return; - } - - SmLicenseAddDlgShiftTextItem(hWnd, B_KEY1, B_KEY2, &next_focus); - SmLicenseAddDlgShiftTextItem(hWnd, B_KEY2, B_KEY3, &next_focus); - SmLicenseAddDlgShiftTextItem(hWnd, B_KEY3, B_KEY4, &next_focus); - SmLicenseAddDlgShiftTextItem(hWnd, B_KEY4, B_KEY5, &next_focus); - SmLicenseAddDlgShiftTextItem(hWnd, B_KEY5, B_KEY6, &next_focus); - SmLicenseAddDlgShiftTextItem(hWnd, B_KEY6, 0, &next_focus); - - if ((IsFocus(hWnd, B_KEY1) && GetTextLen(hWnd, B_KEY1, true) <= 5) || - (IsFocus(hWnd, B_KEY2) && GetTextLen(hWnd, B_KEY2, true) <= 5) || - (IsFocus(hWnd, B_KEY3) && GetTextLen(hWnd, B_KEY3, true) <= 5) || - (IsFocus(hWnd, B_KEY4) && GetTextLen(hWnd, B_KEY4, true) <= 5) || - (IsFocus(hWnd, B_KEY5) && GetTextLen(hWnd, B_KEY5, true) <= 5) || - (IsFocus(hWnd, B_KEY6) && GetTextLen(hWnd, B_KEY6, true) <= 5)) - { - next_focus = 0; - } - - if (next_focus != 0) - { - Focus(hWnd, next_focus); - } - - SmLicenseAddDlgGetText(hWnd, tmp, sizeof(tmp)); - - SetEnable(hWnd, IDOK, LiIsLicenseKey(tmp)); -} - -// License addition dialog initialization -void SmLicenseAddDlgInit(HWND hWnd, SM_SERVER *s) -{ - HFONT h; - // Validate arguments - if (hWnd == NULL || s == NULL) - { - return; - } - - h = GetFont("Arial", 10, true, false, false, false); - SetFont(hWnd, B_KEY1, h); - SetFont(hWnd, B_KEY2, h); - SetFont(hWnd, B_KEY3, h); - SetFont(hWnd, B_KEY4, h); - SetFont(hWnd, B_KEY5, h); - SetFont(hWnd, B_KEY6, h); - - DlgFont(hWnd, S_INFO, 10, true); - - SmLicenseAddDlgUpdate(hWnd, s); -} - -// License addition dialog -UINT SmLicenseAddDlg(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param) -{ - SM_SERVER *s = (SM_SERVER *)param; - // Validate arguments - if (hWnd == NULL) - { - return 0; - } - - switch (msg) - { - case WM_INITDIALOG: - SmLicenseAddDlgInit(hWnd, s); - break; - - case WM_COMMAND: - switch (LOWORD(wParam)) - { - case B_KEY1: - case B_KEY2: - case B_KEY3: - case B_KEY4: - case B_KEY5: - case B_KEY6: - switch (HIWORD(wParam)) - { - case EN_CHANGE: - SmLicenseAddDlgUpdate(hWnd, s); - - switch (LOWORD(wParam)) - { - case B_KEY2: - if (GetTextLen(hWnd, B_KEY2, true) == 0) - { - FocusEx(hWnd, B_KEY1); - } - break; - case B_KEY3: - if (GetTextLen(hWnd, B_KEY3, true) == 0) - { - FocusEx(hWnd, B_KEY2); - } - break; - case B_KEY4: - if (GetTextLen(hWnd, B_KEY4, true) == 0) - { - FocusEx(hWnd, B_KEY3); - } - break; - case B_KEY5: - if (GetTextLen(hWnd, B_KEY5, true) == 0) - { - FocusEx(hWnd, B_KEY4); - } - break; - case B_KEY6: - if (GetTextLen(hWnd, B_KEY6, true) == 0) - { - FocusEx(hWnd, B_KEY5); - } - break; - } - break; - } - break; - } - - switch (wParam) - { - case IDOK: - SmLicenseAddDlgOnOk(hWnd, s); - break; - - case IDCANCEL: - Close(hWnd); - break; - } - break; - - case WM_CLOSE: - EndDialog(hWnd, 0); - break; - } - - return 0; -} - -// Add a license -bool SmLicenseAdd(HWND hWnd, SM_SERVER *s) -{ - // Validate arguments - if (s == NULL) - { - return false; - } - - return Dialog(hWnd, D_SM_LICENSE_ADD, SmLicenseAddDlg, s); -} - -// License dialog initialization -void SmLicenseDlgInit(HWND hWnd, SM_SERVER *s) -{ - // Validate arguments - if (hWnd == NULL || s == NULL) - { - return; - } - - SetIcon(hWnd, 0, ICO_CERT); - - DlgFont(hWnd, S_BOLD, 0, true); - DlgFont(hWnd, S_BOLD2, 0, true); - - LvInit(hWnd, L_LIST); - LvSetStyle(hWnd, L_LIST, LVS_EX_GRIDLINES); - LvInsertColumn(hWnd, L_LIST, 0, _UU("SM_LICENSE_COLUMN_1"), 50); - LvInsertColumn(hWnd, L_LIST, 1, _UU("SM_LICENSE_COLUMN_2"), 100); - LvInsertColumn(hWnd, L_LIST, 2, _UU("SM_LICENSE_COLUMN_3"), 290); - LvInsertColumn(hWnd, L_LIST, 3, _UU("SM_LICENSE_COLUMN_4"), 150); - LvInsertColumn(hWnd, L_LIST, 4, _UU("SM_LICENSE_COLUMN_5"), 120); - LvInsertColumn(hWnd, L_LIST, 5, _UU("SM_LICENSE_COLUMN_6"), 250); - LvInsertColumn(hWnd, L_LIST, 6, _UU("SM_LICENSE_COLUMN_7"), 100); - LvInsertColumn(hWnd, L_LIST, 7, _UU("SM_LICENSE_COLUMN_8"), 100); - LvInsertColumn(hWnd, L_LIST, 8, _UU("SM_LICENSE_COLUMN_9"), 100); - - LvInitEx(hWnd, L_STATUS, true); - LvInsertColumn(hWnd, L_STATUS, 0, _UU("SM_STATUS_COLUMN_1"), 100); - LvInsertColumn(hWnd, L_STATUS, 1, _UU("SM_STATUS_COLUMN_2"), 100); - - SmLicenseDlgRefresh(hWnd, s); -} - -// License dialog update -void SmLicenseDlgRefresh(HWND hWnd, SM_SERVER *s) -{ - RPC_ENUM_LICENSE_KEY t; - RPC_LICENSE_STATUS st; - UINT i; - wchar_t tmp[MAX_SIZE]; - LVB *b; - // Validate arguments - if (hWnd == NULL || s == NULL) - { - return; - } - - Zero(&t, sizeof(t)); - - if (CALL(hWnd, ScEnumLicenseKey(s->Rpc, &t)) == false) - { - Close(hWnd); - return; - } - - b = LvInsertStart(); - - for (i = 0;i < t.NumItem;i++) - { - wchar_t tmp1[32], tmp2[LICENSE_KEYSTR_LEN + 1], tmp3[LICENSE_MAX_PRODUCT_NAME_LEN + 1], - *tmp4, tmp5[128], tmp6[LICENSE_LICENSEID_STR_LEN + 1], tmp7[64], - tmp8[64], tmp9[64]; - RPC_ENUM_LICENSE_KEY_ITEM *e = &t.Items[i]; - - UniToStru(tmp1, e->Id); - StrToUni(tmp2, sizeof(tmp2), e->LicenseKey); - StrToUni(tmp3, sizeof(tmp3), e->LicenseName); - tmp4 = LiGetLicenseStatusStr(e->Status); - if (e->Expires == 0) - { - UniStrCpy(tmp5, sizeof(tmp5), _UU("SM_LICENSE_NO_EXPIRES")); - } - else - { - GetDateStrEx64(tmp5, sizeof(tmp5), e->Expires, NULL); - } - StrToUni(tmp6, sizeof(tmp6), e->LicenseId); - UniToStru(tmp7, e->ProductId); - UniFormat(tmp8, sizeof(tmp8), L"%I64u", e->SystemId); - UniToStru(tmp9, e->SerialId); - - LvInsertAdd(b, - e->Status == LICENSE_STATUS_OK ? ICO_PASS : ICO_DISCARD, - (void *)e->Id, 9, - tmp1, tmp2, tmp3, tmp4, tmp5, tmp6, tmp7, tmp8, tmp9); - } - - LvInsertEnd(b, hWnd, L_LIST); - - FreeRpcEnumLicenseKey(&t); - - Zero(&st, sizeof(st)); - - if (CALL(hWnd, ScGetLicenseStatus(s->Rpc, &st)) == false) - { - Close(hWnd); - return; - } - - b = LvInsertStart(); - - if (st.EditionId == LICENSE_EDITION_VPN3_NO_LICENSE) - { - LvInsertAdd(b, 0, NULL, 2, _UU("SM_NO_LICENSE_COLUMN"), _UU("SM_NO_LICENSE")); - } - else - { - // Product edition name - StrToUni(tmp, sizeof(tmp), st.EditionStr); - LvInsertAdd(b, 0, NULL, 2, _UU("SM_LICENSE_STATUS_EDITION"), tmp); - - // Release date - if (st.ReleaseDate != 0) - { - GetDateStrEx64(tmp, sizeof(tmp), st.ReleaseDate, NULL); - LvInsertAdd(b, 0, NULL, 2, _UU("SM_LICENSE_STATUS_RELEASE"), tmp); - } - - // Current system ID - UniFormat(tmp, sizeof(tmp), L"%I64u", st.SystemId); - LvInsertAdd(b, 0, NULL, 2, _UU("SM_LICENSE_STATUS_SYSTEM_ID"), tmp); - - // Expiration date of the current product license - if (st.SystemExpires == 0) - { - UniStrCpy(tmp, sizeof(tmp), _UU("SM_LICENSE_NO_EXPIRES")); - } - else - { - GetDateStrEx64(tmp, sizeof(tmp), st.SystemExpires, NULL); - } - LvInsertAdd(b, 0, NULL, 2, _UU("SM_LICENSE_STATUS_EXPIRES"), tmp); - - // Subscription (support) contract - if (st.NeedSubscription == false) - { - UniStrCpy(tmp, sizeof(tmp), _UU("SM_LICENSE_STATUS_SUBSCRIPTION_NONEED")); - } - else - { - if (st.SubscriptionExpires == 0) - { - UniStrCpy(tmp, sizeof(tmp), _UU("SM_LICENSE_STATUS_SUBSCRIPTION_NONE")); - } - else - { - wchar_t dtstr[MAX_PATH]; - - GetDateStrEx64(dtstr, sizeof(dtstr), st.SubscriptionExpires, NULL); - - UniFormat(tmp, sizeof(tmp), - st.IsSubscriptionExpired ? _UU("SM_LICENSE_STATUS_SUBSCRIPTION_EXPIRED") : _UU("SM_LICENSE_STATUS_SUBSCRIPTION_VALID"), - dtstr); - } - } - LvInsertAdd(b, 0, NULL, 2, _UU("SM_LICENSE_STATUS_SUBSCRIPTION"), tmp); - - if (st.NeedSubscription == false && st.SubscriptionExpires != 0) - { - wchar_t dtstr[MAX_PATH]; - - GetDateStrEx64(dtstr, sizeof(dtstr), st.SubscriptionExpires, NULL); - - LvInsertAdd(b, 0, NULL, 2, _UU("SM_LICENSE_STATUS_SUBSCRIPTION_BUILD_STR"), tmp); - } - - if (st.NeedSubscription && st.SubscriptionExpires != 0) - { - wchar_t dtstr[MAX_PATH]; - - GetDateStrEx64(dtstr, sizeof(dtstr), st.SubscriptionExpires, NULL); - - UniFormat(tmp, sizeof(tmp), _UU("SM_LICENSE_STATUS_SUBSCRIPTION_BUILD_STR"), dtstr); - - LvInsertAdd(b, 0, NULL, 2, _UU("SM_LICENSE_STATUS_SUBSCRIPTION_BUILD"), tmp); - } - - if (GetCapsBool(s->CapsList, "b_vpn3")) - { - // Maximum number of users - if (st.NumUserCreationLicense == INFINITE) - { - UniStrCpy(tmp, sizeof(tmp), _UU("SM_LICENSE_INFINITE")); - } - else - { - UniToStru(tmp, st.NumUserCreationLicense); - } - LvInsertAdd(b, 0, NULL, 2, _UU("SM_LICENSE_NUM_USER"), tmp); - } - - // Available number of concurrent client connections - if (st.NumClientConnectLicense == INFINITE) - { - UniStrCpy(tmp, sizeof(tmp), _UU("SM_LICENSE_INFINITE")); - } - else - { - UniToStru(tmp, st.NumClientConnectLicense); - } - LvInsertAdd(b, 0, NULL, 2, _UU("SM_LICENSE_NUM_CLIENT"), tmp); - - // Available number of concurrent Bridge connections - if (st.NumBridgeConnectLicense == INFINITE) - { - UniStrCpy(tmp, sizeof(tmp), _UU("SM_LICENSE_INFINITE")); - } - else - { - UniToStru(tmp, st.NumBridgeConnectLicense); - } - LvInsertAdd(b, 0, NULL, 2, _UU("SM_LICENSE_NUM_BRIDGE"), tmp); - - // Availability of enterprise features - LvInsertAdd(b, 0, NULL, 2, _UU("SM_LICENSE_STATUS_ENTERPRISE"), - st.AllowEnterpriseFunction ? _UU("SM_LICENSE_STATUS_ENTERPRISE_YES") : _UU("SM_LICENSE_STATUS_ENTERPRISE_NO")); - } - - LvInsertEnd(b, hWnd, L_STATUS); - - if (LvNum(hWnd, L_STATUS) >= 1) - { - LvAutoSize(hWnd, L_STATUS); - } - - SmLicenseDlgUpdate(hWnd, s); -} - -// License dialog control update -void SmLicenseDlgUpdate(HWND hWnd, SM_SERVER *s) -{ - bool b = false; - // Validate arguments - if (hWnd == NULL || s == NULL) - { - return; - } - - b = LvIsSingleSelected(hWnd, L_LIST); - - SetEnable(hWnd, B_DEL, b); - SetEnable(hWnd, IDOK, b); -} - -// License dialog -UINT SmLicenseDlg(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param) -{ - SM_SERVER *s = (SM_SERVER *)param; - NMHDR *n; - // Validate arguments - if (hWnd == NULL) - { - return 0; - } - - switch (msg) - { - case WM_INITDIALOG: - SmLicenseDlgInit(hWnd, s); - break; - - case WM_NOTIFY: - n = (NMHDR *)lParam; - switch (n->code) - { - case LVN_ITEMCHANGED: - switch (n->idFrom) - { - case L_LIST: - case L_STATUS: - SmLicenseDlgUpdate(hWnd, s); - break; - } - break; - } - break; - - case WM_COMMAND: - switch (wParam) - { - case IDOK: - if (IsEnable(hWnd, IDOK)) - { - UINT i = LvGetSelected(hWnd, L_LIST); - - if (i != INFINITE) - { - char *s = LvGetStrA(hWnd, L_LIST, i, 1); - char tmp[MAX_SIZE]; - - Format(tmp, sizeof(tmp), _SS("LICENSE_SUPPORT_URL"), s); - ShellExecute(hWnd, "open", tmp, NULL, NULL, SW_SHOW); - - Free(s); - } - } - break; - - case B_OBTAIN: - ShellExecute(hWnd, "open", _SS("LICENSE_INFO_URL"), NULL, NULL, SW_SHOW); - break; - - case B_ADD: - if (SmLicenseAdd(hWnd, s)) - { - SmLicenseDlgRefresh(hWnd, s); - } - break; - - case B_DEL: - if (IsEnable(hWnd, B_DEL)) - { - UINT id = (UINT)LvGetParam(hWnd, L_LIST, LvGetSelected(hWnd, L_LIST)); - - if (id != 0) - { - if (MsgBox(hWnd, MB_ICONQUESTION | MB_YESNO | MB_DEFBUTTON2, _UU("SM_LICENSE_DELETE_MSG")) == IDYES) - { - RPC_TEST t; - - Zero(&t, sizeof(t)); - t.IntValue = id; - - if (CALL(hWnd, ScDelLicenseKey(s->Rpc, &t))) - { - SmLicenseDlgRefresh(hWnd, s); - } - } - } - } - break; - - case IDCANCEL: - Close(hWnd); - break; - } - break; - - case WM_CLOSE: - EndDialog(hWnd, 0); - break; - } - - LvStandardHandler(hWnd, msg, wParam, lParam, L_LIST); - - return 0; -} - -// Add or Remove license -void SmLicense(HWND hWnd, SM_SERVER *s) -{ - // Validate arguments - if (s == NULL) - { - return; - } - - Dialog(hWnd, D_SM_LICENSE, SmLicenseDlg, s); - - FreeCapsList(s->CapsList); - s->CapsList = ScGetCapsEx(s->Rpc); -} - -// Log storing procedure -UINT SmSaveLogProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param) -{ - SM_READ_LOG_FILE *p = (SM_READ_LOG_FILE *)param; - // Validate arguments - if (hWnd == NULL) - { - return 0; - } - - switch (msg) - { - case WM_INITDIALOG: - FormatText(hWnd, S_INFO, p->filepath); - break; - - case WM_COMMAND: - switch (wParam) - { - case IDOK: - case B_SAVE: - if (p->Buffer != NULL) - { - char filename[MAX_PATH]; - - Format(filename, sizeof(filename), "%s_%s", p->server_name, p->filepath); - ConvertSafeFileName(filename, sizeof(filename), filename); - - if (wParam == IDOK) - { - // Open with an editor - char fullpath[MAX_PATH]; - - Format(fullpath, sizeof(fullpath), "%s\\%s", - MsGetMyTempDir(), filename); - - if (DumpBuf(p->Buffer, fullpath) == false) - { - MsgBoxEx(hWnd, MB_ICONSTOP, _UU("SM_READ_SAVE_TMP_FAILED"), - fullpath); - } - else - { - if (((UINT)ShellExecute(hWnd, "open", fullpath, NULL, NULL, SW_SHOWNORMAL)) > 32) - { - EndDialog(hWnd, true); - } - else - { - MsgBoxEx(hWnd, MB_ICONEXCLAMATION, _UU("SM_READ_SAVE_OPEN_ERROR"), fullpath); - } - } - } - else - { - // Save to a file - wchar_t def[MAX_PATH]; - wchar_t *uni_path; - - StrToUni(def, sizeof(def), filename); - - uni_path = SaveDlg(hWnd, _UU("SM_READ_SAVE_DLG_FILTER"), _UU("SM_READ_SAVE_DLG_TITLE"), - def, L".log"); - - if (uni_path != NULL) - { - char path[MAX_PATH]; - - UniToStr(path, sizeof(path), uni_path); - Free(uni_path); - - if (DumpBuf(p->Buffer, path) == false) - { - MsgBox(hWnd, MB_ICONSTOP, _UU("SM_READ_SAVE_FAILED")); - } - else - { - EndDialog(hWnd, true); - } - } - } - } - break; - - case IDCANCEL: - Close(hWnd); - break; - } - break; - - case WM_CLOSE: - EndDialog(hWnd, false); - break; - } - - return 0; -} - -// Download callback procedure -bool SmReadLogFileProc(DOWNLOAD_PROGRESS *g) -{ - wchar_t tmp[MAX_SIZE]; - char size1[64], size2[64]; - SM_READ_LOG_FILE *p; - HWND hWnd; - // Validate arguments - if (g == NULL) - { - return false; - } - - p = (SM_READ_LOG_FILE *)g->Param; - hWnd = p->hWnd; - - SetPos(hWnd, P_PROGRESS, g->ProgressPercent); - - ToStrByte(size1, sizeof(size1), g->CurrentSize); - ToStrByte(size2, sizeof(size2), g->TotalSize); - UniFormat(tmp, sizeof(tmp), _UU("SM_READ_LOG_FILE_INFO_2"), size2, size1); - - SetText(hWnd, S_INFO, tmp); - - DoEvents(hWnd); - - return p->cancel_flag ? false : true; -} - -// Log file download dialog procedure -UINT SmReadLogFile(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param) -{ - SM_READ_LOG_FILE *p = (SM_READ_LOG_FILE *)param; - BUF *buf; - // Validate arguments - if (hWnd == NULL) - { - return 0; - } - - switch (msg) - { - case WM_INITDIALOG: - p->hWnd = hWnd; - SetFont(hWnd, S_INFO, Font(11, true)); - SetText(hWnd, S_INFO, _UU("SM_READ_LOG_FILE_INFO_1")); - DisableClose(hWnd); - FormatText(hWnd, S_INFO2, p->filepath); - SetRange(hWnd, P_PROGRESS, 0, 100); - - SetTimer(hWnd, 1, 100, NULL); - break; - - case WM_TIMER: - switch (wParam) - { - case 1: - KillTimer(hWnd, 1); - buf = DownloadFileFromServer(p->s->Rpc, p->server_name, p->filepath, p->totalsize, SmReadLogFileProc, p); - if (buf == NULL) - { - if (p->cancel_flag == false) - { - // Download failure - MsgBox(hWnd, MB_ICONSTOP, _UU("SM_READ_LOG_FILE_ERROR")); - } - EndDialog(hWnd, false); - } - else - { - // Download success - p->Buffer = buf; - Dialog(hWnd, D_SM_SAVE_LOG, SmSaveLogProc, p); - FreeBuf(buf); - EndDialog(hWnd, true); - } - break; - } - break; - - case WM_COMMAND: - switch (wParam) - { - case IDCANCEL: - p->cancel_flag = true; - break; - } - break; - } - - return 0; -} - -// Start the download of the log file -void SmLogFileStartDownload(HWND hWnd, SM_SERVER *s, char *server_name, char *filepath, UINT totalsize) -{ - SM_READ_LOG_FILE p; - // Validate arguments - if (hWnd == NULL || server_name == NULL || filepath == NULL || totalsize == 0) - { - return; - } - - Zero(&p, sizeof(p)); - p.filepath = filepath; - p.s = s; - p.server_name = server_name; - p.totalsize = totalsize; - - Dialog(hWnd, D_SM_READ_LOG_FILE, SmReadLogFile, &p); -} - -// Initialize the dialog -void SmLogFileDlgInit(HWND hWnd, SM_SERVER *p) -{ - // Validate arguments - if (hWnd == NULL || p == NULL) - { - return; - } - - SetIcon(hWnd, 0, ICO_LOG2); - - LvInit(hWnd, L_LIST); - - LvInsertColumn(hWnd, L_LIST, 0, _UU("SM_LOG_FILE_COLUMN_1"), 250); - LvInsertColumn(hWnd, L_LIST, 1, _UU("SM_LOG_FILE_COLUMN_2"), 100); - LvInsertColumn(hWnd, L_LIST, 2, _UU("SM_LOG_FILE_COLUMN_3"), 130); - LvInsertColumn(hWnd, L_LIST, 3, _UU("SM_LOG_FILE_COLUMN_4"), 110); - - SmLogFileDlgRefresh(hWnd, p); -} - -// Dialog content update -void SmLogFileDlgRefresh(HWND hWnd, SM_SERVER *p) -{ - UINT i; - LVB *v; - RPC_ENUM_LOG_FILE t; - // Validate arguments - if (hWnd == NULL || p == NULL) - { - return; - } - - Zero(&t, sizeof(t)); - if (CALL(hWnd, ScEnumLogFile(p->Rpc, &t)) == false) - { - Close(hWnd); - return; - } - - v = LvInsertStart(); - - for (i = 0;i < t.NumItem;i++) - { - RPC_ENUM_LOG_FILE_ITEM *e = &t.Items[i]; - wchar_t tmp1[MAX_PATH], tmp2[128], tmp3[128], tmp4[MAX_HOST_NAME_LEN + 1]; - char tmp[MAX_SIZE]; - - StrToUni(tmp1, sizeof(tmp1), e->FilePath); - - ToStrByte(tmp, sizeof(tmp), e->FileSize); - StrToUni(tmp2, sizeof(tmp2), tmp); - - GetDateTimeStr64Uni(tmp3, sizeof(tmp3), SystemToLocal64(e->UpdatedTime)); - - StrToUni(tmp4, sizeof(tmp4), e->ServerName); - - LvInsertAdd(v, ICO_LOG2, (void *)e->FileSize, 4, tmp1, tmp2, tmp3, tmp4); - } - - LvInsertEndEx(v, hWnd, L_LIST, true); - - if (t.NumItem != 0) - { - LvAutoSize(hWnd, L_LIST); - } - - FreeRpcEnumLogFile(&t); - - SmLogFileDlgUpdate(hWnd, p); -} - -// Update the dialog control -void SmLogFileDlgUpdate(HWND hWnd, SM_SERVER *p) -{ - // Validate arguments - if (hWnd == NULL || p == NULL) - { - return; - } - - SetEnable(hWnd, IDOK, LvIsSingleSelected(hWnd, L_LIST)); -} - -// Log file dialog procedure -UINT SmLogFileDlgProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param) -{ - NMHDR *n; - SM_SERVER *p = (SM_SERVER *)param; - // Validate arguments - if (hWnd == NULL) - { - return 0; - } - - switch (msg) - { - case WM_INITDIALOG: - SmLogFileDlgInit(hWnd, p); - break; - - case WM_COMMAND: - switch (wParam) - { - case IDOK: - if (IsEnable(hWnd, IDOK)) - { - UINT i = LvGetSelected(hWnd, L_LIST); - if (i != INFINITE) - { - UINT size = (UINT)LvGetParam(hWnd, L_LIST, i); - char *server_name; - char *filepath; - - server_name = LvGetStrA(hWnd, L_LIST, i, 3); - filepath = LvGetStrA(hWnd, L_LIST, i, 0); - SmLogFileStartDownload(hWnd, p, server_name, filepath, size); - Free(filepath); - Free(server_name); - } - } - break; - - case IDCANCEL: - Close(hWnd); - break; - - case B_REFRESH: - SmLogFileDlgRefresh(hWnd, p); - break; - } - break; - - case WM_NOTIFY: - n = (NMHDR *)lParam; - switch (n->code) - { - case LVN_ITEMCHANGED: - switch (n->idFrom) - { - case L_LIST: - SmLogFileDlgUpdate(hWnd, p); - break; - } - break; - } - break; - - case WM_CLOSE: - EndDialog(hWnd, false); - break; - } - - LvStandardHandler(hWnd, msg, wParam, lParam, L_LIST); - - return 0; -} - -// Initialize the dialog -void SmHubEditAcDlgInit(HWND hWnd, SM_EDIT_AC *p) -{ - // Validate arguments - if (hWnd == NULL || p == NULL) - { - return; - } - - SetEnable(hWnd, R_IPV6, GetCapsBool(p->e->s->p->CapsList, "b_support_ipv6_ac")); - - if (p->id == 0) - { - UINT i, v; - - Check(hWnd, R_SINGLE, true); - Check(hWnd, R_PASS, true); - Check(hWnd, R_IPV4, true); - - v = 0; - - for (i = 0;i < LIST_NUM(p->e->AcList);i++) - { - AC *ac = LIST_DATA(p->e->AcList, i); - - v = MAX(v, ac->Priority); - } - - v += 100; - - SetInt(hWnd, E_PRIORITY, v); - } - else - { - AC *ac = GetAc(p->e->AcList, p->id); - - if (ac == NULL) - { - EndDialog(hWnd, false); - return; - } - - Check(hWnd, R_SINGLE, ac->Masked == false); - Check(hWnd, R_MASKED, ac->Masked); - Check(hWnd, R_IPV4, IsIP4(&ac->IpAddress)); - Check(hWnd, R_IPV6, IsIP6(&ac->IpAddress)); - - if (IsIP4(&ac->IpAddress)) - { - IpSet(hWnd, E_IP, IPToUINT(&ac->IpAddress)); - } - else - { - char tmp[MAX_SIZE]; - - IPToStr(tmp, sizeof(tmp), &ac->IpAddress); - SetTextA(hWnd, E_IPV6, tmp); - } - - if (ac->Masked) - { - if (IsIP4(&ac->IpAddress)) - { - IpSet(hWnd, E_MASK, IPToUINT(&ac->SubnetMask)); - } - else - { - char tmp[MAX_SIZE]; - - MaskToStrEx(tmp, sizeof(tmp), &ac->SubnetMask, false); - - if (IsNum(tmp)) - { - StrCatLeft(tmp, sizeof(tmp), "/"); - } - - SetTextA(hWnd, E_MASKV6, tmp); - } - } - - Check(hWnd, R_PASS, ac->Deny == false); - Check(hWnd, R_DENY, ac->Deny); - SetInt(hWnd, E_PRIORITY, ac->Priority); - - Free(ac); - } - - Focus(hWnd, E_IP); - - SmHubEditAcDlgUpdate(hWnd, p); -} - -// Dialog update -void SmHubEditAcDlgUpdate(HWND hWnd, SM_EDIT_AC *p) -{ - bool b = true; - char tmp[MAX_SIZE]; - // Validate arguments - if (hWnd == NULL || p == NULL) - { - return; - } - - if (IsChecked(hWnd, R_SINGLE)) - { - if (IsChecked(hWnd, R_IPV6) == false) - { - Show(hWnd, E_IP); - Hide(hWnd, E_IPV6); - - if (IpIsFilled(hWnd, E_IP) == false) - { - b = false; - } - - if (IpGet(hWnd, E_IP) == 0 || IpGet(hWnd, E_IP) == 0xffffffff) - { - b = false; - } - } - else - { - Show(hWnd, E_IPV6); - Hide(hWnd, E_IP); - - GetTxtA(hWnd, E_IPV6, tmp, sizeof(tmp)); - - if (IsStrIPv6Address(tmp) == false) - { - b = false; - } - } - - Hide(hWnd, S_MASK); - Hide(hWnd, E_MASK); - Hide(hWnd, E_MASKV6); - } - else - { - if (IsChecked(hWnd, R_IPV6) == false) - { - Show(hWnd, E_IP); - Hide(hWnd, E_IPV6); - - if (IpIsFilled(hWnd, E_IP) == false || IpIsFilled(hWnd, E_MASK) == false) - { - b = false; - } - - if (IpGet(hWnd, E_IP) == 0xffffffff) - { - b = false; - } - } - else - { - char tmp1[MAX_SIZE], tmp2[MAX_SIZE]; - - Show(hWnd, E_IPV6); - Hide(hWnd, E_IP); - - GetTxtA(hWnd, E_IPV6, tmp1, sizeof(tmp1)); - GetTxtA(hWnd, E_MASKV6, tmp2, sizeof(tmp2)); - - if (!(IsIpStr6(tmp1) && IsIpMask6(tmp2))) - { - b = false; - } - } - - Show(hWnd, S_MASK); - SetShow(hWnd, E_MASK, !IsChecked(hWnd, R_IPV6)); - SetShow(hWnd, E_MASKV6, IsChecked(hWnd, R_IPV6)); - } - - if (GetInt(hWnd, E_PRIORITY) == 0) - { - b = false; - } - - SetIcon(hWnd, S_ICON, IsChecked(hWnd, R_PASS) ? ICO_INTERNET : ICO_INTERNET_X); - - SetEnable(hWnd, IDOK, b); -} - -// OK button is clicked in the dialog -void SmHubEditAcDlgOnOk(HWND hWnd, SM_EDIT_AC *p) -{ - AC ac; - char tmp[MAX_SIZE]; - // Validate arguments - if (hWnd == NULL || p == NULL) - { - return; - } - - Zero(&ac, sizeof(ac)); - ac.Deny = IsChecked(hWnd, R_DENY); - ac.Priority = GetInt(hWnd, E_PRIORITY); - - if (IsChecked(hWnd, R_IPV6) == false) - { - UINTToIP(&ac.IpAddress, IpGet(hWnd, E_IP)); - } - else - { - GetTxtA(hWnd, E_IPV6, tmp, sizeof(tmp)); - - StrToIP6(&ac.IpAddress, tmp); - } - - ac.Masked = IsChecked(hWnd, R_MASKED); - - if (ac.Masked) - { - if (IsChecked(hWnd, R_IPV6) == false) - { - UINTToIP(&ac.SubnetMask, IpGet(hWnd, E_MASK)); - } - else - { - GetTxtA(hWnd, E_MASKV6, tmp, sizeof(tmp)); - - StrToMask6(&ac.SubnetMask, tmp); - } - } - - if (p->id != 0) - { - SetAc(p->e->AcList, p->id, &ac); - } - else - { - AddAc(p->e->AcList, &ac); - } - - EndDialog(hWnd, true); -} - -// AC edit dialog -UINT SmHubEditAcDlgProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param) -{ - SM_EDIT_AC *p = (SM_EDIT_AC *)param; - // Validate arguments - if (hWnd == NULL) - { - return 0; - } - - switch (msg) - { - case WM_INITDIALOG: - SmHubEditAcDlgInit(hWnd, p); - break; - - case WM_COMMAND: - switch (LOWORD(wParam)) - { - case R_SINGLE: - case R_MASKED: - case E_IP: - case E_MASK: - case R_PASS: - case R_DENY: - case E_PRIORITY: - case R_IPV4: - case R_IPV6: - case E_IPV6: - case E_MASKV6: - SmHubEditAcDlgUpdate(hWnd, p); - break; - } - - switch (wParam) - { - case R_IPV4: - case R_IPV6: - case R_SINGLE: - case R_MASKED: - if (IsChecked(hWnd, R_IPV6) == false) - { - if (IpIsFilled(hWnd, E_IP)) - { - Focus(hWnd, E_MASK); - } - else - { - Focus(hWnd, E_IP); - } - } - else - { - char tmp[MAX_SIZE]; - - GetTxtA(hWnd, E_IPV6, tmp, sizeof(tmp)); - - if (IsStrIPv6Address(tmp)) - { - FocusEx(hWnd, E_MASKV6); - } - else - { - FocusEx(hWnd, E_IPV6); - } - } - break; - - case IDOK: - SmHubEditAcDlgOnOk(hWnd, p); - break; - - case IDCANCEL: - Close(hWnd); - break; - } - break; - - case WM_CLOSE: - EndDialog(hWnd, false); - break; - } - - return 0; -} - -// Initialize the dialog -void SmHubAcDlgInit(HWND hWnd, SM_EDIT_AC_LIST *p) -{ - // Validate arguments - if (hWnd == NULL || p == NULL) - { - return; - } - - SetIcon(hWnd, 0, ICO_INTERNET); - - FormatText(hWnd, S_TITLE, p->s->HubName); - - LvInit(hWnd, L_LIST); - LvInsertColumn(hWnd, L_LIST, 0, _UU("SM_AC_COLUMN_1"), 40); - LvInsertColumn(hWnd, L_LIST, 1, _UU("SM_AC_COLUMN_2"), 80); - LvInsertColumn(hWnd, L_LIST, 2, _UU("SM_AC_COLUMN_3"), 90); - LvInsertColumn(hWnd, L_LIST, 3, _UU("SM_AC_COLUMN_4"), 170); - - SmHubAcDlgRefresh(hWnd, p); -} - -// Update the dialog control -void SmHubAcDlgUpdate(HWND hWnd, SM_EDIT_AC_LIST *p) -{ - bool b; - // Validate arguments - if (hWnd == NULL || p == NULL) - { - return; - } - - b = LvIsSingleSelected(hWnd, L_LIST); - - SetEnable(hWnd, IDOK, b); - SetEnable(hWnd, B_DELETE, b); -} - -// Dialog content update -void SmHubAcDlgRefresh(HWND hWnd, SM_EDIT_AC_LIST *p) -{ - UINT i; - LVB *v; - // Validate arguments - if (hWnd == NULL || p == NULL) - { - return; - } - - v = LvInsertStart(); - - for (i = 0;i < LIST_NUM(p->AcList);i++) - { - wchar_t tmp1[32], *tmp2, tmp3[MAX_SIZE], tmp4[32]; - char *tmp_str; - AC *ac = LIST_DATA(p->AcList, i); - - UniToStru(tmp1, ac->Id); - tmp2 = ac->Deny ? _UU("SM_AC_DENY") : _UU("SM_AC_PASS"); - tmp_str = GenerateAcStr(ac); - StrToUni(tmp3, sizeof(tmp3), tmp_str); - - Free(tmp_str); - - UniToStru(tmp4, ac->Priority); - - LvInsertAdd(v, ac->Deny ? ICO_INTERNET_X : ICO_INTERNET, - (void *)ac->Id, 4, tmp1, tmp4, tmp2, tmp3); - } - - LvInsertEnd(v, hWnd, L_LIST); - LvSortEx(hWnd, L_LIST, 0, false, true); - - - SmHubAcDlgUpdate(hWnd, p); -} - -// Access control list editing dialog -UINT SmHubAcDlgProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param) -{ - NMHDR *n; - SM_EDIT_AC_LIST *p = (SM_EDIT_AC_LIST *)param; - // Validate arguments - if (hWnd == NULL) - { - return 0; - } - - switch (msg) - { - case WM_INITDIALOG: - SmHubAcDlgInit(hWnd, p); - break; - - case WM_COMMAND: - switch (wParam) - { - case IDOK: - if (IsEnable(hWnd, IDOK)) - { - SM_EDIT_AC s; - Zero(&s, sizeof(s)); - - s.e = p; - s.id = (UINT)LvGetParam(hWnd, L_LIST, LvGetSelected(hWnd, L_LIST)); - - if (Dialog(hWnd, D_SM_AC, SmHubEditAcDlgProc, &s)) - { - SmHubAcDlgRefresh(hWnd, p); - } - } - break; - - case B_ADD: - if (IsEnable(hWnd, B_ADD)) - { - SM_EDIT_AC s; - Zero(&s, sizeof(s)); - - s.e = p; - - if (Dialog(hWnd, D_SM_AC, SmHubEditAcDlgProc, &s)) - { - SmHubAcDlgRefresh(hWnd, p); - } - } - break; - - case B_DELETE: - if (IsEnable(hWnd, B_DELETE)) - { - UINT id = (UINT)LvGetParam(hWnd, L_LIST, LvGetSelected(hWnd, L_LIST)); - - if (DelAc(p->AcList, id)) - { - SmHubAcDlgRefresh(hWnd, p); - } - } - break; - - case B_SAVE: - if (IsEnable(hWnd, B_SAVE)) - { - RPC_AC_LIST t; - - Zero(&t, sizeof(t)); - StrCpy(t.HubName, sizeof(t.HubName), p->s->HubName); - t.o = CloneAcList(p->AcList); - - if (CALL(hWnd, ScSetAcList(p->s->p->Rpc, &t))) - { - EndDialog(hWnd, true); - } - - FreeRpcAcList(&t); - } - break; - - case IDCANCEL: - Close(hWnd); - break; - } - break; - - case WM_NOTIFY: - n = (NMHDR *)lParam; - switch (n->code) - { - case LVN_ITEMCHANGED: - switch (n->idFrom) - { - case L_LIST: - SmHubAcDlgUpdate(hWnd, p); - break; - } - break; - } - break; - - case WM_CLOSE: - EndDialog(hWnd, false); - break; - } - - LvStandardHandler(hWnd, msg, wParam, lParam, L_LIST); - - return 0; -} - -// Access control list editing -void SmHubAc(HWND hWnd, SM_EDIT_HUB *s) -{ - SM_EDIT_AC_LIST p; - RPC_AC_LIST t; - // Validate arguments - if (hWnd == NULL || s == NULL) - { - return; - } - - Zero(&t, sizeof(t)); - StrCpy(t.HubName, sizeof(t.HubName), s->HubName); - - if (CALL(hWnd, ScGetAcList(s->p->Rpc, &t)) == false) - { - return; - } - - Zero(&p, sizeof(p)); - p.s = s; - p.AcList = CloneAcList(t.o); - - FreeRpcAcList(&t); - - Dialog(hWnd, D_SM_AC_LIST, SmHubAcDlgProc, &p); - - FreeAcList(p.AcList); -} - -// Initialize the dialog -void SmEditCrlDlgInit(HWND hWnd, SM_EDIT_CRL *c) -{ - // Validate arguments - if (hWnd == NULL || c == NULL) - { - return; - } - - if (c->NewCrl == false) - { - RPC_CRL t; - CRL *crl; - - Zero(&t, sizeof(t)); - StrCpy(t.HubName, sizeof(t.HubName), c->s->HubName); - t.Key = c->Key; - - if (CALL(hWnd, ScGetCrl(c->s->Rpc, &t)) == false) - { - EndDialog(hWnd, false); - return; - } - - crl = t.Crl; - - SmEditCrlDlgSetName(hWnd, crl->Name); - SmEditCrlDlgSetSerial(hWnd, crl->Serial); - SmEditCrlDlgSetHash(hWnd, crl->DigestMD5, crl->DigestSHA1); - - FreeRpcCrl(&t); - } - - SmEditCrlDlgUpdate(hWnd, c); -} - -// Update the controls -void SmEditCrlDlgUpdate(HWND hWnd, SM_EDIT_CRL *c) -{ - bool b = true; - // Validate arguments - if (hWnd == NULL || c == NULL) - { - return; - } - - SetEnable(hWnd, E_CN, IsChecked(hWnd, R_CN)); - SetEnable(hWnd, E_O, IsChecked(hWnd, R_O)); - SetEnable(hWnd, E_OU, IsChecked(hWnd, R_OU)); - SetEnable(hWnd, E_C, IsChecked(hWnd, R_C)); - SetEnable(hWnd, E_ST, IsChecked(hWnd, R_ST)); - SetEnable(hWnd, E_L, IsChecked(hWnd, R_L)); - SetEnable(hWnd, E_SERI, IsChecked(hWnd, R_SERI)); - SetEnable(hWnd, E_MD5_HASH, IsChecked(hWnd, R_MD5_HASH)); - SetEnable(hWnd, E_SHA1_HASH, IsChecked(hWnd, R_SHA1_HASH)); - - if (IsChecked(hWnd, R_CN)) - { - if (IsEmpty(hWnd, E_CN)) - { - b = false; - } - } - - if (IsChecked(hWnd, R_O)) - { - if (IsEmpty(hWnd, E_O)) - { - b = false; - } - } - - if (IsChecked(hWnd, R_OU)) - { - if (IsEmpty(hWnd, E_OU)) - { - b = false; - } - } - - if (IsChecked(hWnd, R_C)) - { - if (IsEmpty(hWnd, E_C)) - { - b = false; - } - } - - if (IsChecked(hWnd, R_ST)) - { - if (IsEmpty(hWnd, E_ST)) - { - b = false; - } - } - - if (IsChecked(hWnd, R_L)) - { - if (IsEmpty(hWnd, E_L)) - { - b = false; - } - } - - if (IsChecked(hWnd, R_SERI)) - { - char tmp[MAX_SIZE]; - BUF *buf; - - GetTxtA(hWnd, E_SERI, tmp, sizeof(tmp)); - buf = StrToBin(tmp); - - if (buf->Size == 0) - { - b = false; - } - - FreeBuf(buf); - } - - if (IsChecked(hWnd, R_MD5_HASH)) - { - char tmp[MAX_SIZE]; - BUF *buf; - - GetTxtA(hWnd, E_MD5_HASH, tmp, sizeof(tmp)); - buf = StrToBin(tmp); - - if (buf->Size != MD5_SIZE) - { - b = false; - } - - FreeBuf(buf); - } - - if (IsChecked(hWnd, R_SHA1_HASH)) - { - char tmp[MAX_SIZE]; - BUF *buf; - - GetTxtA(hWnd, E_SHA1_HASH, tmp, sizeof(tmp)); - buf = StrToBin(tmp); - - if (buf->Size != SHA1_SIZE) - { - b = false; - } - - FreeBuf(buf); - } - - SetEnable(hWnd, IDOK, b); -} - -// On click the OK button -void SmEditCrlDlgOnOk(HWND hWnd, SM_EDIT_CRL *c) -{ - CRL *crl; - NAME *n; - RPC_CRL t; - bool empty = true; - // Validate arguments - if (hWnd == NULL || c == NULL) - { - return; - } - - crl = ZeroMalloc(sizeof(CRL)); - crl->Name = ZeroMalloc(sizeof(NAME)); - n = crl->Name; - - if (IsChecked(hWnd, R_CN)) - { - n->CommonName = GetText(hWnd, E_CN); - empty = false; - } - - if (IsChecked(hWnd, R_O)) - { - n->Organization = GetText(hWnd, E_O); - empty = false; - } - - if (IsChecked(hWnd, R_OU)) - { - n->Unit = GetText(hWnd, E_OU); - empty = false; - } - - if (IsChecked(hWnd, R_C)) - { - n->Country = GetText(hWnd, E_C); - empty = false; - } - - if (IsChecked(hWnd, R_ST)) - { - n->State = GetText(hWnd, E_ST); - empty = false; - } - - if (IsChecked(hWnd, R_L)) - { - n->Local = GetText(hWnd, E_L); - empty = false; - } - - if (IsChecked(hWnd, R_SERI)) - { - char tmp[MAX_SIZE]; - BUF *b; - - GetTxtA(hWnd, E_SERI, tmp, sizeof(tmp)); - b = StrToBin(tmp); - - if (b != NULL && b->Size >= 1) - { - crl->Serial = NewXSerial(b->Buf, b->Size); - } - - FreeBuf(b); - - empty = false; - } - - if (IsChecked(hWnd, R_MD5_HASH)) - { - char tmp[MAX_SIZE]; - BUF *b; - - GetTxtA(hWnd, E_MD5_HASH, tmp, sizeof(tmp)); - b = StrToBin(tmp); - - if (b != NULL && b->Size == MD5_SIZE) - { - Copy(crl->DigestMD5, b->Buf, MD5_SIZE); - } - - FreeBuf(b); - - empty = false; - } - - if (IsChecked(hWnd, R_SHA1_HASH)) - { - char tmp[MAX_SIZE]; - BUF *b; - - GetTxtA(hWnd, E_SHA1_HASH, tmp, sizeof(tmp)); - b = StrToBin(tmp); - - if (b != NULL && b->Size == SHA1_SIZE) - { - Copy(crl->DigestSHA1, b->Buf, SHA1_SIZE); - } - - FreeBuf(b); - - empty = false; - } - - if (empty) - { - if (MsgBox(hWnd, MB_ICONEXCLAMATION | MB_YESNO | MB_DEFBUTTON2, _UU("SM_CRL_EMPTY_MSG")) == IDNO) - { - return; - } - } - - if (c->NewCrl) - { - Zero(&t, sizeof(t)); - StrCpy(t.HubName, sizeof(t.HubName), c->s->HubName); - t.Crl = crl; - - if (CALL(hWnd, ScAddCrl(c->s->Rpc, &t))) - { - EndDialog(hWnd, true); - } - - FreeRpcCrl(&t); - } - else - { - Zero(&t, sizeof(t)); - StrCpy(t.HubName, sizeof(t.HubName), c->s->HubName); - t.Crl = crl; - t.Key = c->Key; - - if (CALL(hWnd, ScSetCrl(c->s->Rpc, &t))) - { - EndDialog(hWnd, true); - } - - FreeRpcCrl(&t); - } -} - -// Read the certificate -void SmEditCrlDlgOnLoad(HWND hWnd, SM_EDIT_CRL *c) -{ - X *x; - // Validate arguments - if (hWnd == NULL || c == NULL) - { - return; - } - - if (CmLoadXFromFileOrSecureCard(hWnd, &x)) - { - UCHAR md5[MD5_SIZE], sha1[SHA1_SIZE]; - - SmEditCrlDlgSetName(hWnd, x->subject_name); - SmEditCrlDlgSetSerial(hWnd, x->serial); - GetXDigest(x, md5, false); - GetXDigest(x, sha1, true); - SmEditCrlDlgSetHash(hWnd, md5, sha1); - - FreeX(x); - - SmEditCrlDlgUpdate(hWnd, c); - } -} - -// Set the hash information to the dialog -void SmEditCrlDlgSetHash(HWND hWnd, UCHAR *hash_md5, UCHAR *hash_sha1) -{ - char tmp[MAX_SIZE]; - // Validate arguments - if (hWnd == NULL) - { - return; - } - - if (hash_md5 != NULL && IsZero(hash_md5, MD5_SIZE) == false) - { - Check(hWnd, R_MD5_HASH, true); - BinToStrEx(tmp, sizeof(tmp), hash_md5, MD5_SIZE); - SetTextA(hWnd, E_MD5_HASH, tmp); - } - else - { - Check(hWnd, R_MD5_HASH, false); - } - - if (hash_sha1 != NULL && IsZero(hash_sha1, SHA1_SIZE) == false) - { - Check(hWnd, R_SHA1_HASH, true); - BinToStrEx(tmp, sizeof(tmp), hash_sha1, SHA1_SIZE); - SetTextA(hWnd, E_SHA1_HASH, tmp); - } - else - { - Check(hWnd, R_SHA1_HASH, false); - } -} - -// Set the serial number to the dialog -void SmEditCrlDlgSetSerial(HWND hWnd, X_SERIAL *serial) -{ - char tmp[MAX_SIZE]; - // Validate arguments - if (hWnd == NULL || serial == NULL) - { - return; - } - - BinToStrEx(tmp, sizeof(tmp), serial->data, serial->size); - - Check(hWnd, R_SERI, true); - - SetTextA(hWnd, E_SERI, tmp); -} - -// Set the name situation to the dialog -void SmEditCrlDlgSetName(HWND hWnd, NAME *name) -{ - // Validate arguments - if (hWnd == NULL || name == NULL) - { - return; - } - - // CN - if (UniIsEmptyStr(name->CommonName)) - { - Check(hWnd, R_CN, false); - } - else - { - Check(hWnd, R_CN, true); - SetText(hWnd, E_CN, name->CommonName); - } - - // O - if (UniIsEmptyStr(name->Organization)) - { - Check(hWnd, R_O, false); - } - else - { - Check(hWnd, R_O, true); - SetText(hWnd, E_O, name->Organization); - } - - // OU - if (UniIsEmptyStr(name->Unit)) - { - Check(hWnd, R_OU, false); - } - else - { - Check(hWnd, R_OU, true); - SetText(hWnd, E_OU, name->Unit); - } - - // C - if (UniIsEmptyStr(name->Country)) - { - Check(hWnd, R_C, false); - } - else - { - Check(hWnd, R_C, true); - SetText(hWnd, E_C, name->Country); - } - - // ST - if (UniIsEmptyStr(name->State)) - { - Check(hWnd, R_ST, false); - } - else - { - Check(hWnd, R_ST, true); - SetText(hWnd, E_ST, name->State); - } - - // L - if (UniIsEmptyStr(name->Local)) - { - Check(hWnd, R_L, false); - } - else - { - Check(hWnd, R_L, true); - SetText(hWnd, E_L, name->Local); - } -} - -// CRL edit dialog procedure -UINT SmEditCrlDlgProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param) -{ - SM_EDIT_CRL *c = (SM_EDIT_CRL *)param; - // Validate arguments - if (hWnd == NULL) - { - return 0; - } - - switch (msg) - { - case WM_INITDIALOG: - SmEditCrlDlgInit(hWnd, c); - break; - - case WM_COMMAND: - switch (LOWORD(wParam)) - { - case R_CN: - case E_CN: - case R_O: - case E_O: - case R_OU: - case E_OU: - case R_C: - case E_C: - case R_ST: - case E_ST: - case R_L: - case E_L: - case R_SERI: - case E_SERI: - case R_MD5_HASH: - case E_MD5_HASH: - case R_SHA1_HASH: - case E_SHA1_HASH: - SmEditCrlDlgUpdate(hWnd, c); - break; - } - - switch (wParam) - { - case B_LOAD: - SmEditCrlDlgOnLoad(hWnd, c); - break; - - case IDOK: - SmEditCrlDlgOnOk(hWnd, c); - break; - - case IDCANCEL: - Close(hWnd); - break; - - case R_CN: - FocusEx(hWnd, E_CN); - break; - - case R_O: - FocusEx(hWnd, E_O); - break; - - case R_OU: - FocusEx(hWnd, E_OU); - break; - - case R_C: - FocusEx(hWnd, E_C); - break; - - case R_ST: - FocusEx(hWnd, E_ST); - break; - - case R_L: - FocusEx(hWnd, E_L); - break; - - case R_SERI: - FocusEx(hWnd, E_SERI); - break; - - case R_MD5_HASH: - FocusEx(hWnd, E_MD5_HASH); - break; - - case R_SHA1_HASH: - FocusEx(hWnd, E_SHA1_HASH); - break; - } - break; - - case WM_CLOSE: - EndDialog(hWnd, false); - break; - } - - return 0; -} - -// Initialize the dialog -void SmCrlDlgInit(HWND hWnd, SM_HUB *s) -{ - // Validate arguments - if (hWnd == NULL || s == NULL) - { - return; - } - - SetIcon(hWnd, 0, ICO_CERT_X); - - LvInit(hWnd, L_LIST); - LvInsertColumn(hWnd, L_LIST, 0, _UU("SM_CRL_COLUMN_1"), 555); - - SmCrlDlgRefresh(hWnd, s); -} - -// Update the control -void SmCrlDlgUpdate(HWND hWnd, SM_HUB *s) -{ - // Validate arguments - if (hWnd == NULL || s == NULL) - { - return; - } - - SetEnable(hWnd, IDOK, LvIsSingleSelected(hWnd, L_LIST)); - SetEnable(hWnd, B_DELETE, LvIsSingleSelected(hWnd, L_LIST)); -} - -// Content update -void SmCrlDlgRefresh(HWND hWnd, SM_HUB *s) -{ - UINT i; - RPC_ENUM_CRL t; - LVB *v; - // Validate arguments - if (hWnd == NULL || s == NULL) - { - return; - } - - Zero(&t, sizeof(t)); - StrCpy(t.HubName, sizeof(t.HubName), s->HubName); - - if (CALL(hWnd, ScEnumCrl(s->Rpc, &t)) == false) - { - EndDialog(hWnd, false); - return; - } - - v = LvInsertStart(); - - for (i = 0;i < t.NumItem;i++) - { - RPC_ENUM_CRL_ITEM *e = &t.Items[i]; - LvInsertAdd(v, ICO_CERT_X, (void *)e->Key, 1, e->CrlInfo); - } - - LvInsertEndEx(v, hWnd, L_LIST, true); - - if (t.NumItem >= 1) - { - LvAutoSize(hWnd, L_LIST); - } - - FreeRpcEnumCrl(&t); - - SmCrlDlgUpdate(hWnd, s); -} - -// Certificate revocation list dialog procedure -UINT SmCrlDlgProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param) -{ - SM_EDIT_CRL c; - SM_HUB *s = (SM_HUB *)param; - NMHDR *n; - // Validate arguments - if (hWnd == NULL) - { - return 0; - } - - switch (msg) - { - case WM_INITDIALOG: - SmCrlDlgInit(hWnd, s); - break; - - case WM_COMMAND: - switch (wParam) - { - case B_ADD: - Zero(&c, sizeof(c)); - c.NewCrl = true; - c.s = s; - - if (Dialog(hWnd, D_SM_EDIT_CRL, SmEditCrlDlgProc, &c)) - { - SmCrlDlgRefresh(hWnd, s); - } - break; - - case B_DELETE: - if (IsEnable(hWnd, B_DELETE)) - { - if (MsgBox(hWnd, MB_ICONQUESTION | MB_YESNO | MB_DEFBUTTON2, _UU("SM_CRL_DELETE_MSG")) == IDYES) - { - RPC_CRL t; - - Zero(&t, sizeof(t)); - StrCpy(t.HubName, sizeof(t.HubName), s->HubName); - t.Key = (UINT)LvGetParam(hWnd, L_LIST, LvGetSelected(hWnd, L_LIST)); - - if (CALL(hWnd, ScDelCrl(s->Rpc, &t))) - { - SmCrlDlgRefresh(hWnd, s); - } - - FreeRpcCrl(&t); - } - } - break; - - case IDOK: - if (IsEnable(hWnd, IDOK)) - { - SM_EDIT_CRL c; - - Zero(&c, sizeof(c)); - c.NewCrl = false; - c.s = s; - c.Key = (UINT)LvGetParam(hWnd, L_LIST, LvGetSelected(hWnd, L_LIST)); - - if (Dialog(hWnd, D_SM_EDIT_CRL, SmEditCrlDlgProc, &c)) - { - SmCrlDlgRefresh(hWnd, s); - } - } - break; - - case IDCANCEL: - Close(hWnd); - break; - } - break; - - case WM_CLOSE: - EndDialog(hWnd, 0); - break; - - case WM_NOTIFY: - n = (NMHDR *)lParam; - switch (n->code) - { - case LVN_ITEMCHANGED: - switch (n->idFrom) - { - case L_LIST: - SmCrlDlgUpdate(hWnd, s); - break; - } - break; - } - break; - } - - LvStandardHandler(hWnd, msg, wParam, lParam, L_LIST); - - return 0; -} - -// Smart Card Manager -void SmSecureManager(HWND hWnd) -{ - UINT id = SmGetCurrentSecureIdFromReg(); - - if (id == 0) - { - id = SmSelectSecureId(hWnd); - } - - if (id == 0) - { - return; - } - - CmSecureManager(hWnd, id); -} - -// Initialize the dialog -void SmSelectKeyPairDlgInit(HWND hWnd, SM_SECURE_KEYPAIR *k) -{ - SECURE_DEVICE *dev; - // Validate arguments - if (hWnd == NULL || k == NULL) - { - return; - } - - dev = GetSecureDevice(k->Id); - if (dev != NULL) - { - FormatText(hWnd, S_INFO, dev->DeviceName); - } - - LvInit(hWnd, L_CERT); - LvInsertColumn(hWnd, L_CERT, 0, _UU("SEC_MGR_COLUMN1"), 200); - LvInsertColumn(hWnd, L_CERT, 1, _UU("SEC_MGR_COLUMN2"), 110); - - LvInit(hWnd, L_KEY); - LvInsertColumn(hWnd, L_KEY, 0, _UU("SEC_MGR_COLUMN1"), 200); - LvInsertColumn(hWnd, L_KEY, 1, _UU("SEC_MGR_COLUMN2"), 110); - - SetEnable(hWnd, L_CERT, k->UseCert); - SetEnable(hWnd, B_BOLD1, k->UseCert); - SetEnable(hWnd, L_KEY, k->UseKey); - SetEnable(hWnd, B_BOLD2, k->UseKey); - - SetFont(hWnd, B_BOLD1, Font(0, true)); - SetFont(hWnd, B_BOLD2, Font(0, true)); - - SmSelectKeyPairDlgUpdate(hWnd, k); -} - -// Update the dialog control -void SmSelectKeyPairDlgUpdate(HWND hWnd, SM_SECURE_KEYPAIR *k) -{ - bool ok = true; - // Validate arguments - if (hWnd == NULL || k == NULL) - { - return; - } - - if (k->UseCert) - { - if (LvIsSingleSelected(hWnd, L_CERT) == false) - { - ok = false; - } - else - { - char *name = LvGetSelectedStrA(hWnd, L_CERT, 0); - if (name != NULL) - { - if (LvIsSingleSelected(hWnd, L_KEY) == false) - { - if ((k->Flag++) == 0) - { - LvSelect(hWnd, L_KEY, LvSearchStrA(hWnd, L_KEY, 0, name)); - } - } - Free(name); - } - } - } - - if (k->UseKey) - { - if (LvIsSingleSelected(hWnd, L_KEY) == false) - { - ok = false; - } - else - { - char *name = LvGetSelectedStrA(hWnd, L_KEY, 0); - if (name != NULL) - { - if (LvIsSingleSelected(hWnd, L_CERT) == false) - { - if ((k->Flag++) == 0) - { - LvSelect(hWnd, L_CERT, LvSearchStrA(hWnd, L_CERT, 0, name)); - } - } - Free(name); - } - } - } - - SetEnable(hWnd, IDOK, ok); -} - -// Update the contents -void SmSelectKeyPairDlgRefresh(HWND hWnd, SM_SECURE_KEYPAIR *k) -{ - bool ret; - LIST *o; - WINUI_SECURE_BATCH batch[] = - { - {WINUI_SECURE_ENUM_OBJECTS, NULL, false, NULL, NULL, NULL, NULL, NULL, NULL}, - }; - // Validate arguments - if (hWnd == NULL || k == NULL) - { - return; - } - - ret = SecureDeviceWindow(hWnd, batch, sizeof(batch) / sizeof(batch[0]), k->Id, k->BitmapId); - - if (ret == false) - { - Close(hWnd); - return; - } - - o = batch[0].EnumList; - if (o != NULL) - { - if (k->UseCert) - { - CmSecureManagerDlgPrintListEx(hWnd, L_CERT, o, SEC_X); - } - - if (k->UseKey) - { - CmSecureManagerDlgPrintListEx(hWnd, L_KEY, o, SEC_K); - } - - FreeEnumSecObject(o); - } - - // Update the control - SmSelectKeyPairDlgUpdate(hWnd, k); -} - -// Key pair import dialog procedure -UINT SmSelectKeyPairDlg(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param) -{ - NMHDR *n; - SM_SECURE_KEYPAIR *k = (SM_SECURE_KEYPAIR *)param; - char *s1, *s2; - // Validate arguments - if (hWnd == NULL) - { - return 0; - } - - switch (msg) - { - case WM_INITDIALOG: - SmSelectKeyPairDlgInit(hWnd, k); - - SetTimer(hWnd, 1, 1, NULL); - SetTimer(hWnd, 2, 100, NULL); - break; - - case WM_TIMER: - switch (wParam) - { - case 1: - KillTimer(hWnd, 1); - SmSelectKeyPairDlgRefresh(hWnd, k); - break; - - case 2: - SmSelectKeyPairDlgUpdate(hWnd, k); - break; - } - break; - - case WM_COMMAND: - switch (wParam) - { - case IDOK: - s1 = LvGetSelectedStrA(hWnd, L_CERT, 0); - s2 = LvGetSelectedStrA(hWnd, L_KEY, 0); - if (k->UseCert) - { - StrCpy(k->CertName, sizeof(k->CertName), s1); - } - if (k->UseKey) - { - StrCpy(k->KeyName, sizeof(k->KeyName), s2); - } - Free(s1); - Free(s2); - EndDialog(hWnd, true); - break; - - case IDCANCEL: - Close(hWnd); - break; - } - break; - - case WM_CLOSE: - EndDialog(hWnd, 0); - break; - - case WM_NOTIFY: - n = (NMHDR *)lParam; - switch (n->idFrom) - { - case L_CERT: - case L_KEY: - switch (n->code) - { - case LVN_ITEMCHANGED: - SmSelectKeyPairDlgUpdate(hWnd, k); - break; - } - break; - } - break; - } - - return 0; -} - -// Read a key pair from the smart card -bool SmSelectKeyPair(HWND hWnd, char *cert_name, UINT cert_name_size, char *key_name, UINT key_name_size) -{ - return SmSelectKeyPairEx(hWnd, cert_name, cert_name_size, key_name, key_name_size, 0); -} -bool SmSelectKeyPairEx(HWND hWnd, char *cert_name, UINT cert_name_size, char *key_name, UINT key_name_size, UINT bitmap_id) -{ - SM_SECURE_KEYPAIR p; - // Validate arguments - if (hWnd == NULL || (cert_name == NULL && key_name == NULL)) - { - return false; - } - - Zero(&p, sizeof(p)); - p.Id = SmGetCurrentSecureId(hWnd); - if (p.Id == 0) - { - return false; - } - - p.UseCert = (cert_name == NULL) ? false : true; - p.UseKey = (key_name == NULL) ? false : true; - p.BitmapId = bitmap_id; - - if (Dialog(hWnd, D_SM_SELECT_KEYPAIR, SmSelectKeyPairDlg, &p) == false) - { - return false; - } - - if (p.UseCert) - { - StrCpy(cert_name, cert_name_size, p.CertName); - } - if (p.UseKey) - { - StrCpy(key_name, key_name_size, p.KeyName); - } - - return true; -} - -// Make the user select the smart card number -UINT SmSelectSecureId(HWND hWnd) -{ - UINT id = MsRegReadInt(REG_CURRENT_USER, SECURE_MANAGER_KEY, "DeviceId"); - UINT ret; - - if (id != 0 && CheckSecureDeviceId(id) == false) - { - id = 0; - } - - ret = CmSelectSecure(hWnd, id); - if (ret == 0) - { - return 0; - } - - SmWriteSelectSecureIdReg(ret); - - return ret; -} - -// Write the current smart card number to the registry -void SmWriteSelectSecureIdReg(UINT id) -{ - MsRegWriteInt(REG_CURRENT_USER, SECURE_MANAGER_KEY, "DeviceId", id); -} - -// Get the current smart card number -UINT SmGetCurrentSecureId(HWND hWnd) -{ - // Load the current settings - UINT id = MsRegReadInt(REG_CURRENT_USER, SECURE_MANAGER_KEY, "DeviceId"); - - // Check whether it's valid - if (id == 0 || CheckSecureDeviceId(id) == false) - { - // Select a smart card device number if it's invalid - id = SmSelectSecureId(hWnd); - } - - return id; -} - -// Get the current smart card number from the registry -UINT SmGetCurrentSecureIdFromReg() -{ - // Load the current settings - UINT id = MsRegReadInt(REG_CURRENT_USER, SECURE_MANAGER_KEY, "DeviceId"); - - // Check whether normal - if (id == 0 || CheckSecureDeviceId(id) == false) - { - id = 0; - } - - return id; -} - -// Get whether the specified L3 switch started -bool SmL3IsSwActive(SM_SERVER *s, char *name) -{ - bool ret = false; - UINT i; - RPC_ENUM_L3SW t; - // Validate arguments - if (s == NULL || name == NULL) - { - return false; - } - - Zero(&t, sizeof(t)); - if (ScEnumL3Switch(s->Rpc, &t) == ERR_NO_ERROR) - { - for (i = 0;i < t.NumItem;i++) - { - RPC_ENUM_L3SW_ITEM *e = &t.Items[i]; - if (StrCmpi(e->Name, name) == 0) - { - if (e->Active) - { - ret = true; - break; - } - } - } - FreeRpcEnumL3Sw(&t); - } - - return ret; -} - -// Initialize the dialog -void SmL3SwTableDlgInit(HWND hWnd, SM_L3SW *w) -{ - // Validate arguments - if (hWnd == NULL || w == NULL) - { - return; - } - - SmL3SwTableDlgUpdate(hWnd, w); -} - -// Update the control -void SmL3SwTableDlgUpdate(HWND hWnd, SM_L3SW *w) -{ - bool b = true; - UINT ip; - // Validate arguments - if (hWnd == NULL || w == NULL) - { - return; - } - - if (IpIsFilled(hWnd, E_NETWORK) == false || - IpIsFilled(hWnd, E_MASK) == false || - IpIsFilled(hWnd, E_GATEWAY) == false) - { - b = false; - } - - ip = IpGet(hWnd, E_GATEWAY); - if (ip == 0 || ip == 0xffffffff) - { - b = false; - } - - if (GetInt(hWnd, E_METRIC) == 0) - { - b = false; - } - - if (IsNetworkAddress32(IpGet(hWnd, E_NETWORK), IpGet(hWnd, E_MASK)) == false) - { - b = false; - } - - SetEnable(hWnd, IDOK, b); -} - -UINT SmL3SwTableDlg(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param) -{ - SM_L3SW *w = (SM_L3SW *)param; - RPC_L3TABLE t; - - if (hWnd == NULL) - { - return 0; - } - - switch (msg) - { - case WM_INITDIALOG: - SmL3SwTableDlgInit(hWnd, w); - break; - - case WM_COMMAND: - switch (LOWORD(wParam)) - { - case E_NETWORK: - case E_MASK: - case E_GATEWAY: - case E_METRIC: - SmL3SwTableDlgUpdate(hWnd, w); - break; - } - - switch (wParam) - { - case IDOK: - Zero(&t, sizeof(t)); - StrCpy(t.Name, sizeof(t.Name), w->SwitchName); - t.NetworkAddress = IpGet(hWnd, E_NETWORK); - t.SubnetMask = IpGet(hWnd, E_MASK); - t.GatewayAddress = IpGet(hWnd, E_GATEWAY); - t.Metric = GetInt(hWnd, E_METRIC); - - if (CALL(hWnd, ScAddL3Table(w->s->Rpc, &t))) - { - EndDialog(hWnd, 1); - } - break; - - case IDCANCEL: - Close(hWnd); - break; - } - break; - - case WM_CLOSE: - EndDialog(hWnd, 0); - break; - } - - return 0; -} - -// Initialize the dialog -void SmL3SwIfDlgInit(HWND hWnd, SM_L3SW *w) -{ - RPC_ENUM_HUB t; - UINT i; - // Validate arguments - if (hWnd == NULL || w == NULL) - { - return; - } - - Zero(&t, sizeof(t)); - - if (CALL(hWnd, ScEnumHub(w->s->Rpc, &t)) == false) - { - Close(hWnd); - return; - } - - CbReset(hWnd, E_HUBNAME); - CbSetHeight(hWnd, E_HUBNAME, 18); - - for (i = 0;i < t.NumHub;i++) - { - RPC_ENUM_HUB_ITEM *e = &t.Hubs[i]; - - if (e->HubType != HUB_TYPE_FARM_DYNAMIC) - { - CbAddStrA(hWnd, E_HUBNAME, e->HubName, 0); - } - } - - FreeRpcEnumHub(&t); - - SetTextA(hWnd, E_HUBNAME, ""); - - SmL3SwIfDlgUpdate(hWnd, w); -} - -// Update the control -void SmL3SwIfDlgUpdate(HWND hWnd, SM_L3SW *w) -{ - bool b = true; - // Validate arguments - if (hWnd == NULL || w == NULL) - { - return; - } - - if (IsEmpty(hWnd, E_HUBNAME)) - { - b = false; - } - - if (IpIsFilled(hWnd, E_IP) == false || IpIsFilled(hWnd, E_MASK) == false) - { - b = false; - } - - if (IpGet(hWnd, E_IP) == 0 || IpGet(hWnd, E_IP) == 0xffffffff) - { - b = false; - } - - if (IsSubnetMask32(IpGet(hWnd, E_MASK)) == false) - { - b = false; - } - - SetEnable(hWnd, IDOK, b); -} - -// Dialog for adding a virtual interface -UINT SmL3SwIfDlg(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param) -{ - SM_L3SW *w = (SM_L3SW *)param; - char *hubname; - // Validate arguments - if (hWnd == NULL) - { - return 0; - } - - switch (msg) - { - case WM_INITDIALOG: - SmL3SwIfDlgInit(hWnd, w); - - SetTimer(hWnd, 1, 250, NULL); - break; - - case WM_TIMER: - switch (wParam) - { - case 1: - if (IsEnable(hWnd, 0)) - { - SmL3SwIfDlgUpdate(hWnd, w); - } - break; - } - break; - - case WM_COMMAND: - switch (LOWORD(wParam)) - { - case E_HUBNAME: - case E_IP: - case E_MASK: - SmL3SwIfDlgUpdate(hWnd, w); - break; - } - - switch (wParam) - { - case IDOK: - hubname = GetTextA(hWnd, E_HUBNAME); - if (hubname != NULL) - { - RPC_L3IF t; - Zero(&t, sizeof(t)); - StrCpy(t.HubName, sizeof(t.HubName), hubname); - t.IpAddress = IpGet(hWnd, E_IP); - t.SubnetMask = IpGet(hWnd, E_MASK); - StrCpy(t.Name, sizeof(t.Name), w->SwitchName); - - if (CALL(hWnd, ScAddL3If(w->s->Rpc, &t))) - { - EndDialog(hWnd, 1); - } - - Free(hubname); - } - break; - - case IDCANCEL: - Close(hWnd); - break; - } - break; - - case WM_CLOSE: - EndDialog(hWnd, 0); - break; - } - - return 0; -} - -// Initialize -void SmL3SwDlgInit(HWND hWnd, SM_L3SW *w) -{ - // Validate arguments - if (hWnd == NULL || w == NULL) - { - return; - } - - SetIcon(hWnd, 0, ICO_SWITCH_OFFLINE); - - FormatText(hWnd, 0, w->SwitchName); - - SetFont(hWnd, S_BOLD1, Font(0, true)); - SetFont(hWnd, S_BOLD2, Font(0, true)); - - LvInit(hWnd, L_IF); - LvInsertColumn(hWnd, L_IF, 0, _UU("SM_L3_SW_IF_COLUMN1"), 150); - LvInsertColumn(hWnd, L_IF, 1, _UU("SM_L3_SW_IF_COLUMN2"), 150); - LvInsertColumn(hWnd, L_IF, 2, _UU("SM_L3_SW_IF_COLUMN3"), 180); - - LvInit(hWnd, L_TABLE); - LvInsertColumn(hWnd, L_TABLE, 0, _UU("SM_L3_SW_TABLE_COLUMN1"), 130); - LvInsertColumn(hWnd, L_TABLE, 1, _UU("SM_L3_SW_TABLE_COLUMN2"), 130); - LvInsertColumn(hWnd, L_TABLE, 2, _UU("SM_L3_SW_TABLE_COLUMN3"), 130); - LvInsertColumn(hWnd, L_TABLE, 3, _UU("SM_L3_SW_TABLE_COLUMN4"), 100); - - w->Enable = SmL3IsSwActive(w->s, w->SwitchName) ? false : true; - - SmL3SwDlgRefresh(hWnd, w); -} - -// Update the control -void SmL3SwDlgUpdate(HWND hWnd, SM_L3SW *w) -{ - // Validate arguments - if (hWnd == NULL || w == NULL) - { - return; - } - - SetEnable(hWnd, B_ADD_IF, w->s->ServerAdminMode && w->Enable); - SetEnable(hWnd, B_ADD_TABLE, w->s->ServerAdminMode && w->Enable); - SetEnable(hWnd, B_DEL_IF, LvIsSingleSelected(hWnd, L_IF) && w->s->ServerAdminMode && w->Enable); - SetEnable(hWnd, B_DEL_TABLE, LvIsSingleSelected(hWnd, L_TABLE) && w->s->ServerAdminMode && w->Enable); - SetEnable(hWnd, B_START, w->s->ServerAdminMode && w->Enable); - SetEnable(hWnd, B_STOP, w->s->ServerAdminMode && (w->Enable == false)); -} - -// Content update -void SmL3SwDlgRefresh(HWND hWnd, SM_L3SW *w) -{ - UINT i; - wchar_t tmp1[MAX_SIZE]; - wchar_t tmp2[MAX_SIZE]; - wchar_t tmp3[MAX_SIZE]; - wchar_t tmp4[MAX_SIZE]; - // Validate arguments - if (hWnd == NULL || w == NULL) - { - return; - } - - // Virtual interface list - { - RPC_ENUM_L3IF t; - LVB *v; - - Zero(&t, sizeof(t)); - StrCpy(t.Name, sizeof(t.Name), w->SwitchName); - - if (CALL(hWnd, ScEnumL3If(w->s->Rpc, &t)) == false) - { - Close(hWnd); - return; - } - - v = LvInsertStart(); - - for (i = 0;i < t.NumItem;i++) - { - RPC_L3IF *e = &t.Items[i]; - - IPToUniStr32(tmp1, sizeof(tmp1), e->IpAddress); - IPToUniStr32(tmp2, sizeof(tmp2), e->SubnetMask); - StrToUni(tmp3, sizeof(tmp3), e->HubName); - - LvInsertAdd(v, ICO_NIC_ONLINE, NULL, 3, tmp1, tmp2, tmp3); - } - - LvReset(hWnd, L_IF); - - LvInsertEnd(v, hWnd, L_IF); - - FreeRpcEnumL3If(&t); - } - - // Routing Table Entry List - { - RPC_ENUM_L3TABLE t; - LVB *v; - - Zero(&t, sizeof(t)); - StrCpy(t.Name, sizeof(t.Name), w->SwitchName); - - if (CALL(hWnd, ScEnumL3Table(w->s->Rpc, &t)) == false) - { - Close(hWnd); - return; - } - - v = LvInsertStart(); - - for (i = 0;i < t.NumItem;i++) - { - RPC_L3TABLE *e = &t.Items[i]; - - IPToUniStr32(tmp1, sizeof(tmp1), e->NetworkAddress); - IPToUniStr32(tmp2, sizeof(tmp2), e->SubnetMask); - IPToUniStr32(tmp3, sizeof(tmp3), e->GatewayAddress); - UniToStru(tmp4, e->Metric); - - LvInsertAdd(v, ICO_PROTOCOL, NULL, 4, tmp1, tmp2, tmp3, tmp4); - } - - LvReset(hWnd, L_TABLE); - - LvInsertEnd(v, hWnd, L_TABLE); - - FreeRpcEnumL3Table(&t); - } - - SmL3SwDlgUpdate(hWnd, w); -} - -// Edit dialog of L3 switch -UINT SmL3SwDlg(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param) -{ - SM_L3SW *w = (SM_L3SW *)param; - NMHDR *n; - // Validate arguments - if (hWnd == NULL) - { - return 0; - } - - switch (msg) - { - case WM_INITDIALOG: - SmL3SwDlgInit(hWnd, w); - - SetTimer(hWnd, 1, 1000, NULL); - break; - - case WM_TIMER: - switch (wParam) - { - case 1: - if (IsEnable(hWnd, 0)) - { - KillTimer(hWnd, 1); - w->Enable = SmL3IsSwActive(w->s, w->SwitchName) ? false : true; - SmL3SwDlgUpdate(hWnd, w); - SetTimer(hWnd, 1, 1000, NULL); - } - break; - } - break; - - case WM_COMMAND: - switch (wParam) - { - case B_START: - if (IsEnable(hWnd, B_START)) - { - RPC_L3SW t; - - Zero(&t, sizeof(t)); - StrCpy(t.Name, sizeof(t.Name), w->SwitchName); - - if (CALL(hWnd, ScStartL3Switch(w->s->Rpc, &t))) - { - SmL3SwDlgUpdate(hWnd, w); - } - } - break; - - case B_STOP: - if (IsEnable(hWnd, B_STOP)) - { - RPC_L3SW t; - - Zero(&t, sizeof(t)); - StrCpy(t.Name, sizeof(t.Name), w->SwitchName); - - if (CALL(hWnd, ScStopL3Switch(w->s->Rpc, &t))) - { - SmL3SwDlgUpdate(hWnd, w); - } - } - break; - - case B_ADD_IF: - if (Dialog(hWnd, D_SM_L3_SW_IF, SmL3SwIfDlg, w)) - { - SmL3SwDlgRefresh(hWnd, w); - } - break; - - case B_DEL_IF: - if (LvIsSingleSelected(hWnd, L_IF)) - { - RPC_L3IF t; - char *tmp1, *tmp2, *tmp3; - - tmp1 = LvGetSelectedStrA(hWnd, L_IF, 0); - tmp2 = LvGetSelectedStrA(hWnd, L_IF, 1); - tmp3 = LvGetSelectedStrA(hWnd, L_IF, 2); - - Zero(&t, sizeof(t)); - StrCpy(t.Name, sizeof(t.Name), w->SwitchName); - t.IpAddress = StrToIP32(tmp1); - t.SubnetMask = StrToIP32(tmp2); - StrCpy(t.HubName, sizeof(t.HubName), tmp3); - - if (CALL(hWnd, ScDelL3If(w->s->Rpc, &t))) - { - SmL3SwDlgRefresh(hWnd, w); - } - - Free(tmp1); - Free(tmp2); - Free(tmp3); - } - break; - - case B_ADD_TABLE: - if (Dialog(hWnd, D_SM_L3_SW_TABLE, SmL3SwTableDlg, w)) - { - SmL3SwDlgRefresh(hWnd, w); - } - break; - - case B_DEL_TABLE: - if (LvIsSingleSelected(hWnd, L_TABLE)) - { - RPC_L3TABLE t; - char *tmp1, *tmp2, *tmp3, *tmp4; - - tmp1 = LvGetSelectedStrA(hWnd, L_TABLE, 0); - tmp2 = LvGetSelectedStrA(hWnd, L_TABLE, 1); - tmp3 = LvGetSelectedStrA(hWnd, L_TABLE, 2); - tmp4 = LvGetSelectedStrA(hWnd, L_TABLE, 3); - - Zero(&t, sizeof(t)); - StrCpy(t.Name, sizeof(t.Name), w->SwitchName); - t.NetworkAddress = StrToIP32(tmp1); - t.SubnetMask = StrToIP32(tmp2); - t.GatewayAddress = StrToIP32(tmp3); - t.Metric = ToInt(tmp4); - - if (CALL(hWnd, ScDelL3Table(w->s->Rpc, &t))) - { - SmL3SwDlgRefresh(hWnd, w); - } - - Free(tmp1); - Free(tmp2); - Free(tmp3); - Free(tmp4); - } - break; - - case IDCANCEL: - Close(hWnd); - break; - } - break; - - case WM_CLOSE: - EndDialog(hWnd, 0); - break; - - case WM_NOTIFY: - n = (NMHDR *)lParam; - switch (n->idFrom) - { - case L_IF: - case L_TABLE: - switch (n->code) - { - case LVN_ITEMCHANGED: - SmL3SwDlgUpdate(hWnd, w); - break; - } - break; - } - break; - } - - return 0; -} - -// Update the control -void SmL3AddDlgUpdate(HWND hWnd, SM_SERVER *s) -{ - char *tmp; - // Validate arguments - if (hWnd == NULL || s == NULL) - { - return; - } - - tmp = GetTextA(hWnd, E_NAME); - - SetEnable(hWnd, IDOK, IsEmptyStr(tmp) == false && IsSafeStr(tmp)); - - Free(tmp); -} - -// The dialog box to create a new L3 switch -UINT SmL3AddDlg(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param) -{ - SM_SERVER *s = (SM_SERVER *)param; - RPC_L3SW t; - // Validate arguments - if (hWnd == NULL) - { - return 0; - } - - switch (msg) - { - case WM_INITDIALOG: - LimitText(hWnd, E_NAME, MAX_HUBNAME_LEN); - SmL3AddDlgUpdate(hWnd, s); - break; - - case WM_COMMAND: - switch (LOWORD(wParam)) - { - case E_NAME: - SmL3AddDlgUpdate(hWnd, s); - break; - } - - switch (wParam) - { - case IDOK: - Zero(&t, sizeof(t)); - GetTxtA(hWnd, E_NAME, t.Name, sizeof(t.Name)); - if (CALL(hWnd, ScAddL3Switch(s->Rpc, &t))) - { - EndDialog(hWnd, 1); - } - break; - - case IDCANCEL: - Close(hWnd); - break; - } - break; - - case WM_CLOSE: - EndDialog(hWnd, 0); - break; - } - - return 0; -} - -// Initialize the dialog -void SmL3DlgInit(HWND hWnd, SM_SERVER *s) -{ - // Validate arguments - if (hWnd == NULL || s == NULL) - { - return; - } - - SetFont(hWnd, S_BOLD, Font(0, true)); - - SetIcon(hWnd, 0, ICO_SWITCH); - - LvInit(hWnd, L_LIST); - LvInsertColumn(hWnd, L_LIST, 0, _UU("SM_L3_SW_COLUMN1"), 150); - LvInsertColumn(hWnd, L_LIST, 1, _UU("SM_L3_SW_COLUMN2"), 120); - LvInsertColumn(hWnd, L_LIST, 2, _UU("SM_L3_SW_COLUMN3"), 100); - LvInsertColumn(hWnd, L_LIST, 3, _UU("SM_L3_SW_COLUMN4"), 100); - - SmL3DlgRefresh(hWnd, s); -} - -// Update the dialog control -void SmL3DlgUpdate(HWND hWnd, SM_SERVER *s) -{ - bool b = false; - bool active = false; - // Validate arguments - if (hWnd == NULL || s == NULL) - { - return; - } - - if (LvIsSingleSelected(hWnd, L_LIST)) - { - wchar_t *tmp; - UINT i; - b = true; - i = LvGetSelected(hWnd, L_LIST); - if (i != INFINITE) - { - tmp = LvGetStr(hWnd, L_LIST, i, 1); - if (UniStrCmpi(tmp, _UU("SM_L3_SW_ST_F_F")) != 0) - { - active = true; - } - Free(tmp); - } - } - - SetEnable(hWnd, B_START, b && (active == false)); - SetEnable(hWnd, B_STOP, b && (active != false)); - SetEnable(hWnd, IDOK, b); - SetEnable(hWnd, B_DELETE, b); -} - -// Dialog content update -void SmL3DlgRefresh(HWND hWnd, SM_SERVER *s) -{ - RPC_ENUM_L3SW t; - UINT i; - LVB *v; - // Validate arguments - if (hWnd == NULL || s == NULL) - { - return; - } - - Zero(&t, sizeof(t)); - if (CALL(hWnd, ScEnumL3Switch(s->Rpc, &t)) == false) - { - Close(hWnd); - return; - } - - v = LvInsertStart(); - - for (i = 0;i < t.NumItem;i++) - { - RPC_ENUM_L3SW_ITEM *e = &t.Items[i]; - wchar_t tmp1[MAX_SIZE], *tmp2, tmp3[64], tmp4[64]; - - StrToUni(tmp1, sizeof(tmp1), e->Name); - if (e->Active == false) - { - tmp2 = _UU("SM_L3_SW_ST_F_F"); - } - else if (e->Online == false) - { - tmp2 = _UU("SM_L3_SW_ST_T_F"); - } - else - { - tmp2 = _UU("SM_L3_SW_ST_T_T"); - } - UniToStru(tmp3, e->NumInterfaces); - UniToStru(tmp4, e->NumTables); - - LvInsertAdd(v, e->Active ? ICO_SWITCH : ICO_SWITCH_OFFLINE, NULL, - 4, tmp1, tmp2, tmp3, tmp4); - } - - LvInsertEnd(v, hWnd, L_LIST); - - FreeRpcEnumL3Sw(&t); - - SmL3DlgUpdate(hWnd, s); -} - -// L3 dialog procedure -UINT SmL3Dlg(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param) -{ - NMHDR *n; - SM_SERVER *s = (SM_SERVER *)param; - RPC_L3SW t; - char *name; - // Validate arguments - if (hWnd == NULL) - { - return 0; - } - - switch (msg) - { - case WM_INITDIALOG: - SmL3DlgInit(hWnd, s); - - SetTimer(hWnd, 1, 1000, NULL); - break; - - case WM_TIMER: - switch (wParam) - { - case 1: - if (IsEnable(hWnd, 0)) - { - KillTimer(hWnd, 1); - SmL3DlgRefresh(hWnd, s); - SetTimer(hWnd, 1, 1000, NULL); - } - break; - } - break; - - case WM_COMMAND: - switch (wParam) - { - case B_ADD: - // Add - if (Dialog(hWnd, D_SM_L3_ADD, SmL3AddDlg, s)) - { - SmL3DlgRefresh(hWnd, s); - } - break; - - case B_START: - // Operation start - name = LvGetSelectedStrA(hWnd, L_LIST, 0); - if (name != NULL) - { - Zero(&t, sizeof(t)); - StrCpy(t.Name, sizeof(t.Name), name); - - if (CALL(hWnd, ScStartL3Switch(s->Rpc, &t))) - { - SmL3DlgRefresh(hWnd, s); - } - - Free(name); - } - break; - - case B_STOP: - // Operation stop - name = LvGetSelectedStrA(hWnd, L_LIST, 0); - if (name != NULL) - { - Zero(&t, sizeof(t)); - StrCpy(t.Name, sizeof(t.Name), name); - - if (CALL(hWnd, ScStopL3Switch(s->Rpc, &t))) - { - SmL3DlgRefresh(hWnd, s); - } - - Free(name); - } - break; - - case IDOK: - // Edit - if (IsEnable(hWnd, IDOK)) - { - name = LvGetSelectedStrA(hWnd, L_LIST, 0); - if (name != NULL) - { - SM_L3SW w; - Zero(&w, sizeof(w)); - w.s = s; - w.SwitchName = name; - - Dialog(hWnd, D_SM_L3_SW, SmL3SwDlg, &w); - - Free(name); - } - } - break; - - case B_DELETE: - // Delete - name = LvGetSelectedStrA(hWnd, L_LIST, 0); - if (name != NULL) - { - if (MsgBoxEx(hWnd, MB_ICONEXCLAMATION | MB_YESNO | MB_DEFBUTTON2, - _UU("SM_L3_SW_DEL_MSG"), name) == IDYES) - { - Zero(&t, sizeof(t)); - StrCpy(t.Name, sizeof(t.Name), name); - - if (CALL(hWnd, ScDelL3Switch(s->Rpc, &t))) - { - SmL3DlgRefresh(hWnd, s); - } - } - - Free(name); - } - break; - - case IDCANCEL: - // Close - Close(hWnd); - break; - } - break; - - case WM_NOTIFY: - n = (NMHDR *)lParam; - switch (n->idFrom) - { - case L_LIST: - switch (n->code) - { - case LVN_ITEMCHANGED: - SmL3DlgUpdate(hWnd, s); - break; - - case NM_DBLCLK: - Command(hWnd, IDOK); - break; - } - break; - } - break; - - case WM_CLOSE: - EndDialog(hWnd, 0); - break; - } - - return 0; -} - -// L3 dialog -void SmL3(HWND hWnd, SM_SERVER *s) -{ - // Validate arguments - if (s == NULL) - { - return; - } - - Dialog(hWnd, D_SM_L3, SmL3Dlg, s); -} - -// Dialog for management option value -UINT SmHubAdminOptionValueDlg(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param) -{ - SM_EDIT_AO *a = (SM_EDIT_AO *)param; - UINT i; - char tmp[MAX_SIZE]; - // Validate arguments - if (hWnd == NULL) - { - return 0; - } - - switch (msg) - { - case WM_INITDIALOG: - CbReset(hWnd, C_NAME); - for (i = 0;i < a->DefaultOptions.NumItem;i++) - { - wchar_t tmp[MAX_PATH]; - StrToUni(tmp, sizeof(tmp), a->DefaultOptions.Items[i].Name); - CbAddStr(hWnd, C_NAME, tmp, 0); - } - if (a->NewMode == false) - { - char tmp[MAX_SIZE]; - - SetTextA(hWnd, C_NAME, a->Name); - ToStr(tmp, a->Value); - - SetTextA(hWnd, E_VALUE, tmp); - } - else - { - SetTextA(hWnd, C_NAME, ""); - } - SmHubAdminOptionValueDlgUpdate(hWnd, a); - if (a->NewMode == false) - { - FocusEx(hWnd, E_VALUE); - Disable(hWnd, C_NAME); - } - else - { - FocusEx(hWnd, C_NAME); - } - - SetTimer(hWnd, 1, 100, NULL); - break; - - case WM_TIMER: - if (IsEnable(hWnd, 0)) - { - SmHubAdminOptionValueDlgUpdate(hWnd, a); - } - break; - - case WM_COMMAND: - switch (wParam) - { - case IDOK: - if (a->NewMode) - { - GetTxtA(hWnd, C_NAME, a->Name, sizeof(a->Name)); - } - - GetTxtA(hWnd, E_VALUE, tmp, sizeof(tmp)); - a->Value = ToInt(tmp); - - Trim(a->Name); - - if (StartWith(a->Name, "no") || StartWith(a->Name, "allow") || StartWith(a->Name, "deny") - || StartWith(a->Name, "filter") || StartWith(a->Name, "fix") || StartWith(a->Name, "force") - || StartWith(a->Name, "use") || StartWith(a->Name, "b_") || StartWith(a->Name, "is") - || StartWith(a->Name, "manage") || StartWith(a->Name, "yield") - || StartWith(a->Name, "permit") || StartWith(a->Name, "yes") || StartWith(a->Name, "ok") - || StartWith(a->Name, "do") || StartWith(a->Name, "only") || StartWith(a->Name, "disable")) - { - if (StrCmpi(tmp, "0") != 0 && StrCmpi(tmp, "1") != 0) - { - MsgBox(hWnd, MB_ICONEXCLAMATION, _UU("SM_TRUE_OR_FALSE")); - FocusEx(hWnd, E_VALUE); - break; - } - } - - EndDialog(hWnd, true); - break; - - case IDCANCEL: - Close(hWnd); - break; - } - - SmHubAdminOptionValueDlgUpdate(hWnd, a); - - break; - - case WM_CLOSE: - EndDialog(hWnd, false); - break; - } - - return 0; -} - -// Update the dialog controls for management option value -void SmHubAdminOptionValueDlgUpdate(HWND hWnd, SM_EDIT_AO *a) -{ - char tmp[MAX_SIZE]; - // Validate arguments - if (hWnd == NULL || a == NULL) - { - return; - } - - GetTxtA(hWnd, C_NAME, tmp, sizeof(tmp)); - - SetEnable(hWnd, IDOK, IsEmpty(hWnd, C_NAME) == false && IsEmpty(hWnd, E_VALUE) == false && - IsSafeStr(tmp)); -} - -// Initialize -void SmHubAdminOptionDlgInit(HWND hWnd, SM_EDIT_AO *a) -{ - UINT i; - // Validate arguments - if (hWnd == NULL || a == NULL) - { - return; - } - - SetIcon(hWnd, 0, ICO_USER_ADMIN); - - if (a->e->p->ServerAdminMode) - { - a->CanChange = true; - } - else - { - if (a->ExtOption == false) - { - for (i = 0;i < a->CurrentOptions.NumItem;i++) - { - if (StrCmpi(a->CurrentOptions.Items[i].Name, "allow_hub_admin_change_option") == 0) - { - if (a->CurrentOptions.Items[i].Value != 0) - { - a->CanChange = true; - } - } - } - } - else - { - a->CanChange = true; - } - } - - FormatText(hWnd, S_INFO, a->e->HubName); - - DlgFont(hWnd, S_BOLD, 0, true); - - LvInit(hWnd, L_LIST); - LvInsertColumn(hWnd, L_LIST, 0, _UU("SM_AO_COLUMN_1"), 260); - LvInsertColumn(hWnd, L_LIST, 1, _UU("SM_AO_COLUMN_2"), 100); - - for (i = 0;i < a->CurrentOptions.NumItem;i++) - { - ADMIN_OPTION *e = &a->CurrentOptions.Items[i]; - wchar_t tmp1[MAX_SIZE]; - wchar_t tmp2[MAX_SIZE]; - - StrToUni(tmp1, sizeof(tmp1), e->Name); - UniToStru(tmp2, e->Value); - - LvInsert(hWnd, L_LIST, ICO_LOG, NULL, 2, tmp1, tmp2); - - } - - if (a->ExtOption) - { - SetIcon(hWnd, S_ICON, ICO_LINK2); - SetIcon(hWnd, 0, ICO_LINK2); - - SetText(hWnd, 0, _UU("SM_HUBEXT_OPTION_TITLE")); - SetText(hWnd, S_STATIC1, _UU("SM_HUBEXT_OPTION_STATIC1")); - SetText(hWnd, S_STATIC2, _UU("SM_HUBEXT_OPTION_STATIC2")); - } - - // Update the control - SmHubAdminOptionDlgUpdate(hWnd, a); -} - -// Update the control -void SmHubAdminOptionDlgUpdate(HWND hWnd, SM_EDIT_AO *a) -{ - bool b = false; - wchar_t *helpstr; - // Validate arguments - if (hWnd == NULL || a == NULL) - { - return; - } - - helpstr = _UU("HUB_AO_CLICK"); - - SetEnable(hWnd, IDOK, a->CanChange); - SetEnable(hWnd, B_ADD, a->CanChange); - SetEnable(hWnd, B_EDIT, a->CanChange && (LvIsMasked(hWnd, L_LIST) && LvIsMultiMasked(hWnd, L_LIST) == false)); - - if (LvIsMasked(hWnd, L_LIST) && LvIsMultiMasked(hWnd, L_LIST) == false) - { - UINT i; - i = LvGetSelected(hWnd, L_LIST); - - if (a->CanChange) - { - - b = true; - - if (i != INFINITE) - { - char *name = LvGetStrA(hWnd, L_LIST, i, 0); - if (name != NULL) - { - UINT j; - - for (j = 0;j < a->DefaultOptions.NumItem;j++) - { - if (StrCmpi(a->DefaultOptions.Items[j].Name, name) == 0) - { - b = false; - } - } - Free(name); - } - } - } - - if (i != INFINITE) - { - char *name = LvGetStrA(hWnd, L_LIST, i, 0); - if (name != NULL) - { - helpstr = GetHubAdminOptionHelpString(name); - } - Free(name); - } - } - SetEnable(hWnd, B_DELETE, b); - - SetText(hWnd, E_HELP, helpstr); -} - -// Save -void SmHubAdminOptionDlgOk(HWND hWnd, SM_EDIT_AO *a) -{ - UINT i, num; - RPC_ADMIN_OPTION t; - // Validate arguments - if (hWnd == NULL || a == NULL) - { - return; - } - - num = LvNum(hWnd, L_LIST); - - Zero(&t, sizeof(t)); - - StrCpy(t.HubName, sizeof(t.HubName), a->e->HubName); - t.NumItem = num; - t.Items = ZeroMalloc(sizeof(ADMIN_OPTION) * num); - - for (i = 0;i < num;i++) - { - char *name = LvGetStrA(hWnd, L_LIST, i, 0); - char *s_value = LvGetStrA(hWnd, L_LIST, i, 1); - ADMIN_OPTION *a = &t.Items[i]; - - StrCpy(a->Name, sizeof(a->Name), name); - a->Value = ToInt(s_value); - - Free(name); - Free(s_value); - } - - if (a->ExtOption == false) - { - if (CALL(hWnd, ScSetHubAdminOptions(a->e->p->Rpc, &t))) - { - MsgBox(hWnd, MB_ICONINFORMATION, _UU("SM_AO_SET_OK")); - EndDialog(hWnd, true); - } - } - else - { - if (CALL(hWnd, ScSetHubExtOptions(a->e->p->Rpc, &t))) - { - MsgBox(hWnd, MB_ICONINFORMATION, _UU("SM_EXT_OPTION_SET_OK")); - EndDialog(hWnd, true); - } - } - - FreeRpcAdminOption(&t); -} - -// Virtual HUB Management Options dialog -UINT SmHubAdminOptionDlg(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param) -{ - SM_EDIT_AO *a = (SM_EDIT_AO *)param; - NMHDR *n; - UINT i; - // Validate arguments - if (hWnd == NULL) - { - return 0; - } - - switch (msg) - { - case WM_INITDIALOG: - SmHubAdminOptionDlgInit(hWnd, a); - break; - - case WM_COMMAND: - switch (wParam) - { - case B_ADD: - a->NewMode = true; - StrCpy(a->Name, sizeof(a->Name), ""); - a->Value = 0; - if (Dialog(hWnd, D_SM_AO_VALUE, SmHubAdminOptionValueDlg, - a)) - { - wchar_t tmp1[MAX_SIZE]; - wchar_t tmp2[MAX_SIZE]; - StrToUni(tmp1, sizeof(tmp1), a->Name); - UniToStru(tmp2, a->Value); - - LvInsert(hWnd, L_LIST, ICO_LOG, NULL, 2, tmp1, tmp2); - } - break; - - case B_EDIT: - i = LvGetSelected(hWnd, L_LIST); - if (i != INFINITE && a->CanChange) - { - char *name, *value; - name = LvGetStrA(hWnd, L_LIST, i, 0); - value = LvGetStrA(hWnd, L_LIST, i, 1); - a->NewMode = false; - StrCpy(a->Name, sizeof(a->Name), name); - a->Value = ToInt(value); - - if (Dialog(hWnd, D_SM_AO_VALUE, SmHubAdminOptionValueDlg, - a)) - { - char tmp[MAX_PATH]; - ToStr(tmp, a->Value); - LvSetItemA(hWnd, L_LIST, i, 1, tmp); - } - - Free(name); - Free(value); - } - break; - - case B_DELETE: - i = LvGetSelected(hWnd, L_LIST); - if (i != INFINITE) - { - LvDeleteItem(hWnd, L_LIST, i); - } - break; - - case IDCANCEL: - Close(hWnd); - break; - - case IDOK: - SmHubAdminOptionDlgOk(hWnd, a); - break; - } - break; - - case WM_NOTIFY: - n = (NMHDR *)lParam; - switch (n->idFrom) - { - case L_LIST: - switch (n->code) - { - case LVN_ITEMCHANGED: - SmHubAdminOptionDlgUpdate(hWnd, a); - break; - - case NM_DBLCLK: - Command(hWnd, B_EDIT); - break; - } - break; - } - break; - - case WM_CLOSE: - EndDialog(hWnd, 0); - break; - } - - return 0; -} - -// Virtual HUB extended options -void SmHubExtOption(HWND hWnd, SM_EDIT_HUB *e) -{ - SM_EDIT_AO a; - // Validate arguments - if (hWnd == NULL || e == NULL) - { - return; - } - - Zero(&a, sizeof(a)); - a.e = e; - a.ExtOption = true; - - StrCpy(a.CurrentOptions.HubName, sizeof(a.CurrentOptions.HubName), e->HubName); - - // Get the current options on the server - if (CALL(hWnd, ScGetHubExtOptions(e->p->Rpc, &a.CurrentOptions)) == false) - { - return; - } - - Dialog(hWnd, D_SM_ADMIN_OPTION, SmHubAdminOptionDlg, &a); - - FreeRpcAdminOption(&a.CurrentOptions); - FreeRpcAdminOption(&a.DefaultOptions); -} - -// Virtual HUB management options -void SmHubAdminOption(HWND hWnd, SM_EDIT_HUB *e) -{ - SM_EDIT_AO a; - // Validate arguments - if (hWnd == NULL || e == NULL) - { - return; - } - - Zero(&a, sizeof(a)); - a.e = e; - - StrCpy(a.CurrentOptions.HubName, sizeof(a.CurrentOptions.HubName), e->HubName); - - // Get the current options on the server - if (CALL(hWnd, ScGetHubAdminOptions(e->p->Rpc, &a.CurrentOptions)) == false) - { - return; - } - - ScGetDefaultHubAdminOptions(e->p->Rpc, &a.DefaultOptions); - - Dialog(hWnd, D_SM_ADMIN_OPTION, SmHubAdminOptionDlg, &a); - - FreeRpcAdminOption(&a.CurrentOptions); - FreeRpcAdminOption(&a.DefaultOptions); -} - -// Initialize -void SmConfigDlgInit(HWND hWnd, SM_CONFIG *c) -{ - wchar_t *tmp; - UINT tmp_size; - // Validate arguments - if (hWnd == NULL || c == NULL) - { - return; - } - - Focus(hWnd, IDCANCEL); - - SetIcon(hWnd, 0, ICO_MACHINE); - - SetFont(hWnd, E_CONFIG, GetFont(_SS("DEFAULT_FONT_2"), 0, false, false, - false, false)); - - FormatText(hWnd, IDC_INFO, c->s->ServerName); - - // Convert from UTF-8 to Unicode - tmp_size = CalcUtf8ToUni(c->Config.FileData, StrLen(c->Config.FileData)) + 1; - tmp = ZeroMalloc(tmp_size); - Utf8ToUni(tmp, tmp_size, c->Config.FileData, StrLen(c->Config.FileData)); - - SetText(hWnd, E_CONFIG, tmp); - - Free(tmp); -} - -// Config edit dialog -UINT SmConfigDlg(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param) -{ - SM_CONFIG *c = (SM_CONFIG *)param; - char *filename; - wchar_t *filename_unicode; - wchar_t tmp[MAX_SIZE]; - // Validate arguments - if (hWnd == NULL) - { - return 0; - } - - switch (msg) - { - case WM_INITDIALOG: - SmConfigDlgInit(hWnd, c); - break; - - case WM_COMMAND: - switch (wParam) - { - case B_EXPORT: - StrToUni(tmp, sizeof(tmp), c->Config.FileName); - filename_unicode = SaveDlg(hWnd, _UU("DLG_CONFIG_FILES"), _UU("DLG_SAVE_CONFIG"), tmp, L".config"); - if (filename_unicode != NULL) - { - BUF *b = NewBuf(); - filename = CopyUniToStr(filename_unicode); - WriteBuf(b, c->Config.FileData, StrLen(c->Config.FileData)); - if (DumpBuf(b, filename)) - { - MsgBox(hWnd, MB_ICONINFORMATION, _UU("SM_CONFIG_SAVED")); - } - else - { - MsgBox(hWnd, MB_ICONSTOP, _UU("SM_CONFIG_SAVE_FAILED")); - } - FreeBuf(b); - Free(filename); - Free(filename_unicode); - } - break; - - case B_IMPORT: - filename_unicode = OpenDlg(hWnd, _UU("DLG_CONFIG_FILES"), _UU("DLG_OPEN_CONFIG")); - if (filename_unicode != NULL) - { - BUF *b; - filename = CopyUniToStr(filename_unicode); - b = ReadDump(filename); - if (b != NULL) - { - RPC_CONFIG t; - - if (MsgBox(hWnd, MB_ICONQUESTION | MB_YESNO, _UU("SM_CONFIG_CONFIRM")) == IDYES) - { - Zero(&t, sizeof(t)); - t.FileData = ZeroMalloc(b->Size + 1); - Copy(t.FileData, b->Buf, b->Size); - - if (CALL(hWnd, ScSetConfig(c->s->Rpc, &t))) - { - // Success - MsgBox(hWnd, MB_ICONINFORMATION, _UU("SM_CONFIG_WRITE_OK")); - _exit(0); - } - - FreeRpcConfig(&t); - - FreeRpcConfig(&t); - FreeBuf(b); - } - } - else - { - MsgBox(hWnd, MB_ICONSTOP, _UU("SM_CONFIG_OPEN_FAILED")); - } - Free(filename); - Free(filename_unicode); - } - break; - - case IDCANCEL: - Close(hWnd); - break; - - case B_FACTORY: - if (MsgBox(hWnd, MB_ICONWARNING | MB_YESNO | MB_DEFBUTTON2, _UU("SM_FACTORY_DEFAULT_WARNING")) == IDYES) - { - RPC_TEST t; - UINT ret; - - Zero(&t, sizeof(t)); - - t.IntValue = 1; - ret = ScRebootServer(c->s->Rpc, &t); - - if (ret == ERR_DISCONNECTED || ret == ERR_NO_ERROR) - { - MsgBox(hWnd, MB_ICONINFORMATION, _UU("SM_FACTORY_DEFAULT_PERFORMED")); - - exit(0); - } - else - { - CALL(hWnd, ret); - } - } - break; - } - break; - - case WM_CLOSE: - EndDialog(hWnd, 0); - break; - } - - return 0; -} - -// Show the config edit dialog -void SmConfig(HWND hWnd, SM_SERVER *s) -{ - SM_CONFIG c; - // Validate arguments - if (hWnd == NULL || s == NULL) - { - return; - } - - Zero(&c, sizeof(c)); - - c.s = s; - - // Get current config from the server - if (CALL(hWnd, ScGetConfig(s->Rpc, &c.Config)) == false) - { - return; - } - - // Show the dialog - Dialog(hWnd, D_SM_CONFIG, SmConfigDlg, &c); - - // Release - FreeRpcConfig(&c.Config); -} - -// Bridge dialog initialization -UINT SmBridgeDlgInit(HWND hWnd, SM_SERVER *s) -{ - UINT i; - RPC_ENUM_ETH t; - RPC_SERVER_INFO si; - UINT num = 0; - // Validate arguments - if (hWnd == NULL || s == NULL) - { - return 0; - } - - LvInit(hWnd, L_LIST); - LvInsertColumn(hWnd, L_LIST, 0, _UU("SM_BRIDGE_COLUMN_1"), 50); - LvInsertColumn(hWnd, L_LIST, 1, _UU("SM_BRIDGE_COLUMN_2"), 145); - LvInsertColumn(hWnd, L_LIST, 2, _UU("SM_BRIDGE_COLUMN_3"), 300); - LvInsertColumn(hWnd, L_LIST, 3, _UU("SM_BRIDGE_COLUMN_4"), 100); - - SmBridgeDlgRefresh(hWnd, s); - - SetShow(hWnd, B_VLAN, GetCapsBool(s->CapsList, "b_support_eth_vlan")); - - SetIcon(hWnd, 0, ICO_BRIDGE); - - // Get the server information - Zero(&si, sizeof(si)); - ScGetServerInfo(s->Rpc, &si); - if (GetCapsBool(s->CapsList, "b_tap_supported") == false) - { - // Tap does not supported - Hide(hWnd, R_TAP); - Hide(hWnd, S_TAP_1); - Hide(hWnd, E_TAPNAME); - Hide(hWnd, S_TAP_2); - Hide(hWnd, R_BRIDGE); - Hide(hWnd, S_STATIC5); - } - Check(hWnd, R_BRIDGE, true); - FreeRpcServerInfo(&si); - - // Enumerate the Ethernet devices - Zero(&t, sizeof(t)); - ScEnumEthernet(s->Rpc, &t); - - CbReset(hWnd, E_NICNAME); - CbSetHeight(hWnd, E_NICNAME, 18); - - num = t.NumItem; - - for (i = 0;i < t.NumItem;i++) - { - RPC_ENUM_ETH_ITEM *e = &t.Items[i]; - if (GetCapsBool(s->CapsList, "b_support_network_connection_name")) - { - wchar_t ncname[MAX_SIZE * 2]; - UniFormat(ncname, sizeof(ncname), BRIDGE_NETWORK_CONNECTION_STR, e->NetworkConnectionName, e->DeviceName); - CbAddStr(hWnd, E_NICNAME, ncname, 0); - } - else - { - wchar_t *s = CopyStrToUni(e->DeviceName); - CbAddStr(hWnd, E_NICNAME, s, 0); - Free(s); - } - } - - FreeRpcEnumEth(&t); - - // Enumerate the Virtual HUBs - { - RPC_ENUM_HUB t; - Zero(&t, sizeof(t)); - - ScEnumHub(s->Rpc, &t); - - CbReset(hWnd, E_HUBNAME); - CbSetHeight(hWnd, E_HUBNAME, 18); - - for (i = 0;i < t.NumHub;i++) - { - RPC_ENUM_HUB_ITEM *e = &t.Hubs[i]; - wchar_t *s = CopyStrToUni(e->HubName); - - if (e->HubType != HUB_TYPE_FARM_DYNAMIC) - { - CbAddStr(hWnd, E_HUBNAME, s, 0); - } - Free(s); - } - - SetText(hWnd, E_HUBNAME, L""); - - FreeRpcEnumHub(&t); - } - - if (s->Bridge) - { - SetTextA(hWnd, E_HUBNAME, "BRIDGE"); - } - - Focus(hWnd, E_HUBNAME); - - SmBridgeDlgUpdate(hWnd, s); - - SetTimer(hWnd, 1, 1000, NULL); - - return num; -} - -// Bridge dialog control update -void SmBridgeDlgUpdate(HWND hWnd, SM_SERVER *s) -{ - bool ok = true; - // Validate arguments - if (hWnd == NULL || s == NULL) - { - return; - } - - if (LvIsMasked(hWnd, L_LIST) && LvIsMultiMasked(hWnd, L_LIST) == false) - { - Enable(hWnd, B_DELETE); - } - else - { - Disable(hWnd, B_DELETE); - } - - if (IsEmpty(hWnd, E_HUBNAME)) - { - ok = false; - } - - if (IsChecked(hWnd, R_TAP) == false) - { - // Bridge mode - Enable(hWnd, S_ETH_1); - Enable(hWnd, E_NICNAME); - Disable(hWnd, S_TAP_1); - Disable(hWnd, S_TAP_2); - Disable(hWnd, E_TAPNAME); - SetText(hWnd, S_INFO, _UU("SM_BRIDGE_INFO_1")); - SetIcon(hWnd, S_ICON, ICO_NIC_ONLINE); - if (IsEmpty(hWnd, E_NICNAME)) - { - ok = false; - } - } - else - { - char tmp[MAX_SIZE]; - // Tap mode - Disable(hWnd, S_ETH_1); - Disable(hWnd, E_NICNAME); - Enable(hWnd, S_TAP_1); - Enable(hWnd, S_TAP_2); - Enable(hWnd, E_TAPNAME); - SetText(hWnd, S_INFO, _UU("SM_BRIDGE_INFO_2")); - SetIcon(hWnd, S_ICON, ICO_PROTOCOL); - GetTxtA(hWnd, E_TAPNAME, tmp, sizeof(tmp)); - if (IsEmptyStr(tmp)) - { - ok = false; - } - else - { - if (IsSafeStr(tmp) == false) - { - ok = false; - } - if (StrLen(tmp) >= 12) - { - ok = false; - } - } - } - - SetEnable(hWnd, IDOK, ok); -} - -// Bridge dialog update -void SmBridgeDlgRefresh(HWND hWnd, SM_SERVER *s) -{ - LVB *lvb; - RPC_ENUM_LOCALBRIDGE t; - UINT i; - // Validate arguments - if (hWnd == NULL || s == NULL) - { - return; - } - - lvb = LvInsertStart(); - - Zero(&t, sizeof(t)); - - ScEnumLocalBridge(s->Rpc, &t); - - for (i = 0;i < t.NumItem;i++) - { - RPC_LOCALBRIDGE *e = &t.Items[i]; - wchar_t name[MAX_SIZE]; - wchar_t nic[MAX_SIZE]; - wchar_t hub[MAX_SIZE]; - wchar_t *status = _UU("SM_BRIDGE_OFFLINE"); - - UniToStru(name, i + 1); - StrToUni(nic, sizeof(nic), e->DeviceName); - StrToUni(hub, sizeof(hub), e->HubName); - - if (e->Online) - { - status = e->Active ? _UU("SM_BRIDGE_ONLINE") : _UU("SM_BRIDGE_ERROR"); - } - - LvInsertAdd(lvb, e->TapMode == false ? (e->Active ? ICO_NIC_ONLINE : ICO_NIC_OFFLINE) : ICO_PROTOCOL, - NULL, 4, name, hub, nic, status); - } - - FreeRpcEnumLocalBridge(&t); - - LvInsertEnd(lvb, hWnd, L_LIST); - - SmBridgeDlgUpdate(hWnd, s); -} - -// Add a Local Bridge -void SmBridgeDlgOnOk(HWND hWnd, SM_SERVER *s) -{ - char nic[MAX_SIZE]; - char hub[MAX_SIZE]; - RPC_LOCALBRIDGE t; - bool tapmode = false; - // Validate arguments - if (hWnd == NULL || s == NULL) - { - return; - } - - GetTxtA(hWnd, E_HUBNAME, hub, sizeof(hub)); - - Zero(nic, sizeof(nic)); - - if (IsChecked(hWnd, R_TAP) == false) - { - wchar_t nctmp[MAX_SIZE * 2]; - if(GetCapsBool(s->CapsList, "b_support_network_connection_name") && GetTxt(hWnd, E_NICNAME, nctmp, sizeof(nctmp))) - { - RPC_ENUM_ETH et; - UINT i; - Zero(&et, sizeof(et)); - ScEnumEthernet(s->Rpc, &et); - for(i = 0; i < et.NumItem; i++) - { - RPC_ENUM_ETH_ITEM *e = &et.Items[i]; - if(UniIsEmptyStr(e->NetworkConnectionName) == false) - { - wchar_t ncname[MAX_SIZE * 2]; - UniFormat(ncname, sizeof(ncname), BRIDGE_NETWORK_CONNECTION_STR, e->NetworkConnectionName, e->DeviceName); - if(UniStrCmp(ncname, nctmp) == 0) - { - StrCpy(nic, sizeof(nic), e->DeviceName); - break; - } - } - } - FreeRpcEnumEth(&et); - - if (IsEmptyStr(nic)) - { - GetTxtA(hWnd, E_NICNAME, nic, sizeof(nic)); - } - } - else - { - GetTxtA(hWnd, E_NICNAME, nic, sizeof(nic)); - } - } - else - { - tapmode = true; - GetTxtA(hWnd, E_TAPNAME, nic, sizeof(nic)); - } - - Trim(hub); - Trim(nic); - - Zero(&t, sizeof(t)); - StrCpy(t.DeviceName, sizeof(t.DeviceName), nic); - StrCpy(t.HubName, sizeof(t.HubName), hub); - t.TapMode = tapmode; - - if (InStrEx(t.DeviceName, "vpn", false) || InStrEx(t.DeviceName, "tun", false) - || InStrEx(t.DeviceName, "tap", false)) - { - // Trying to make a local bridge to the VPN device - if (MsgBoxEx(hWnd, MB_ICONEXCLAMATION | MB_YESNO | MB_DEFBUTTON2, - _UU("SM_BRIDGE_VPN"), - t.DeviceName) == IDNO) - { - return; - } - } - - // Show a warning message if the VPN Server is running in a VM - if (GetCapsBool(s->CapsList, "b_is_in_vm")) - { - Dialog(hWnd, D_SM_VMBRIDGE, SmVmBridgeDlg, NULL); - } - - // Warning for such as Intel LAN cards - if (tapmode == false) - { - MsgBox(hWnd, MB_ICONINFORMATION, _UU("SM_BRIDGE_INTEL")); - } - - if (CALL(hWnd, ScAddLocalBridge(s->Rpc, &t)) == false) - { - Focus(hWnd, E_HUBNAME); - return; - } - - SetText(hWnd, E_HUBNAME, L""); - Focus(hWnd, E_HUBNAME); - - if (tapmode) - { - SetTextA(hWnd, E_TAPNAME, ""); - } - - SmBridgeDlgRefresh(hWnd, s); - - MsgBox(hWnd, MB_ICONINFORMATION, _UU("SM_BRIDGE_OK")); -} - -// Bridge dialog procedure -UINT SmBridgeDlgProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param) -{ - NMHDR *n; - SM_SERVER *s = (SM_SERVER *)param; - UINT i; - UINT num; - // Validate arguments - if (hWnd == NULL) - { - return 0; - } - - switch (msg) - { - case WM_INITDIALOG: - num = SmBridgeDlgInit(hWnd, s); - - if (num == 0) - { - SetTimer(hWnd, 2, 500, NULL); - } - break; - - case WM_COMMAND: - switch (LOWORD(wParam)) - { - case E_HUBNAME: - case E_NICNAME: - case R_BRIDGE: - case R_TAP: - case E_TAPNAME: - SmBridgeDlgUpdate(hWnd, s); - break; - } - - switch (wParam) - { - case R_BRIDGE: - Focus(hWnd, E_NICNAME); - break; - - case R_TAP: - FocusEx(hWnd, E_TAPNAME); - break; - - case IDOK: - // Add - SmBridgeDlgOnOk(hWnd, s); - break; - - case IDCANCEL: - // Close - Close(hWnd); - break; - - case B_VLAN: - // VLAN utility - SmVLan(hWnd, s); - break; - - case B_DELETE: - // Delete - i = LvGetSelected(hWnd, L_LIST); - if (i != INFINITE) - { - wchar_t *nic, *hub; - wchar_t tmp[MAX_SIZE]; - RPC_LOCALBRIDGE t; - - hub = LvGetStr(hWnd, L_LIST, i, 1); - nic = LvGetStr(hWnd, L_LIST, i, 2); - - UniFormat(tmp, sizeof(tmp), _UU("SM_BRIDGE_DELETE"), - hub, nic); - - if (MsgBox(hWnd, MB_ICONEXCLAMATION | MB_YESNO | MB_DEFBUTTON2, tmp) == IDYES) - { - Zero(&t, sizeof(t)); - UniToStr(t.DeviceName, sizeof(t.DeviceName), nic); - UniToStr(t.HubName, sizeof(t.HubName), hub); - - if (CALL(hWnd, ScDeleteLocalBridge(s->Rpc, &t))) - { - MsgBox(hWnd, MB_ICONINFORMATION, _UU("SM_BRIDGE_DELETE_OK")); - SmBridgeDlgRefresh(hWnd, s); - } - } - - Free(hub); - Free(nic); - } - break; - } - break; - - case WM_TIMER: - switch (wParam) - { - case 1: - if (IsEnable(hWnd, 0)) - { - KillTimer(hWnd, 1); - SmBridgeDlgRefresh(hWnd, s); - SetTimer(hWnd, 1, 1000, NULL); - } - break; - - case 2: - KillTimer(hWnd, 2); - - MsgBox(hWnd, MB_ICONINFORMATION, _UU("SM_NO_BRIDGE_NICS")); - break; - } - break; - - case WM_NOTIFY: - n = (NMHDR *)lParam; - switch (n->code) - { - case LVN_ITEMCHANGED: - switch (n->idFrom) - { - case L_LIST: - SmBridgeDlgUpdate(hWnd, s); - break; - } - break; - } - break; - - case WM_CLOSE: - EndDialog(hWnd, false); - break; - } - - return 0; -} - -// Installation of WinPcap -void SmInstallWinPcap(HWND hWnd, SM_SERVER *s) -{ - wchar_t temp_name[MAX_SIZE]; - IO *io; - BUF *buf; - - // Ask whether the user want to start the installation - if (MsgBox(hWnd, MB_ICONQUESTION | MB_YESNO, _UU("SM_BRIDGE_WPCAP_INSTALL")) == IDNO) - { - return; - } - - // Generate a temporary file name - UniFormat(temp_name, sizeof(temp_name), L"%s\\winpcap_installer.exe", MsGetTempDirW()); - - // Read from hamcore - buf = ReadDump(MsIsNt() ? "|winpcap_installer.exe" : "|winpcap_installer_win9x.exe"); - if (buf == NULL) - { -RES_ERROR: - MsgBox(hWnd, MB_ICONSTOP, _UU("SM_BRIDGE_RESOURCE")); - return; - } - - // Write to a temporary file - io = FileCreateW(temp_name); - if (io == NULL) - { - FreeBuf(buf); - goto RES_ERROR; - } - - FileWrite(io, buf->Buf, buf->Size); - FileClose(io); - - FreeBuf(buf); - - // Run - if (RunW(temp_name, NULL, false, true) == false) - { - // Failure - FileDeleteW(temp_name); - goto RES_ERROR; - } - - FileDeleteW(temp_name); - - if (s == NULL) - { - return; - } - - // Message after completed - if (OS_IS_WINDOWS_NT(GetOsInfo()->OsType) == false) - { - // Need to restart the computer - MsgBox(hWnd, MB_ICONINFORMATION, _UU("SM_BRIDGE_WPCAP_REBOOT1")); - } - else - { - // Need to restart the service - if (MsgBox(hWnd, MB_ICONQUESTION | MB_YESNO, _UU("SM_BRIDGE_WPCAP_REBOOT2")) == IDNO) - { - // Not restart - } - else - { - // Restart - RPC_TEST t; - Zero(&t, sizeof(t)); - ScRebootServer(s->Rpc, &t); - - SleepThread(500); - - Zero(&t, sizeof(t)); - CALL(hWnd, ScTest(s->Rpc, &t)); - } - } -} - -// Bridge dialog -void SmBridgeDlg(HWND hWnd, SM_SERVER *s) -{ - RPC_BRIDGE_SUPPORT t; - // Validate arguments - if (hWnd == NULL || s == NULL) - { - return; - } - - // Examine the bridge support status of the server side first - Zero(&t, sizeof(t)); - if (CALLEX(hWnd, ScGetBridgeSupport(s->Rpc, &t)) != ERR_NO_ERROR) - { - // Not supported because it is old version - MsgBox(hWnd, MB_ICONEXCLAMATION, _UU("SM_BRIDGE_TOO_OLD_VER")); - return; - } - - if (t.IsBridgeSupportedOs == false) - { - // OS does not support the bridge - MsgBox(hWnd, MB_ICONEXCLAMATION, _UU("SM_BRIDGE_UNSUPPORTED")); - return; - } - - if (t.IsWinPcapNeeded) - { - if (s->Rpc->Sock->RemoteIP.addr[0] != 127) - { - // WinPcap is required, but can not do anything because it is in remote control mode - MsgBox(hWnd, MB_ICONINFORMATION, _UU("SM_BRIDGE_WPCAP_REMOTE")); - return; - } - else - { - // WinPcap is required, and it's in local management mode - if (MsIsAdmin()) - { - // The user is an Administrators - SmInstallWinPcap(hWnd, s); - return; - } - else - { - // The user is a non-Administrators - MsgBox(hWnd, MB_ICONINFORMATION, _UU("SM_BRIDGE_WPCAP_ROOT")); - return; - } - } - } - - Dialog(hWnd, D_SM_BRIDGE, SmBridgeDlgProc, s); -} - -// SecureNAT screen update -void SmSNATDlgUpdate(HWND hWnd, SM_HUB *s) -{ - bool b; - RPC_HUB_STATUS t; - // Validate arguments - if (hWnd == NULL || s == NULL) - { - return; - } - - Zero(&t, sizeof(t)); - StrCpy(t.HubName, sizeof(t.HubName), s->HubName); - if (CALL(hWnd, ScGetHubStatus(s->Rpc, &t)) == false) - { - Close(hWnd); - return; - } - - b = t.SecureNATEnabled; - - if (b) - { - Disable(hWnd, B_ENABLE); - Enable(hWnd, B_DISABLE); - Enable(hWnd, B_NAT); - Enable(hWnd, B_DHCP); - Enable(hWnd, B_STATUS); - } - else - { - Enable(hWnd, B_ENABLE); - Disable(hWnd, B_DISABLE); - Disable(hWnd, B_NAT); - Disable(hWnd, B_DHCP); - Disable(hWnd, B_STATUS); - } -} - -// SecureNAT configuration screen -UINT SmSNATDlgProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param) -{ - SM_HUB *s = (SM_HUB *)param; - RPC_HUB t; - // Validate arguments - if (hWnd == NULL) - { - return 0; - } - - switch (msg) - { - case WM_INITDIALOG: - SetIcon(hWnd, 0, ICO_ROUTER); - DlgFont(hWnd, S_WARNING, (_GETLANG() == 0 || _GETLANG() == 2) ? 13 : 10, true); - FormatText(hWnd, S_TITLE, s->HubName); - SmSNATDlgUpdate(hWnd, s); - - SetTimer(hWnd, 1, 1000, NULL); - break; - - case WM_TIMER: - if (wParam == 1) - { - if (IsEnable(hWnd, 0)) - { - KillTimer(hWnd, 1); - - SmSNATDlgUpdate(hWnd, s); - - SetTimer(hWnd, 1, 1000, NULL); - } - } - break; - - case WM_COMMAND: - switch (wParam) - { - case IDCANCEL: - Close(hWnd); - break; - - case B_ENABLE: - if (MsgBox(hWnd, MB_ICONEXCLAMATION | MB_OKCANCEL | MB_DEFBUTTON2, - _UU("SM_SECURE_NAT_MSG")) == IDOK) - { - Zero(&t, sizeof(t)); - StrCpy(t.HubName, sizeof(t.HubName), s->HubName); - CALL(hWnd, ScEnableSecureNAT(s->Rpc, &t)); - SmSNATDlgUpdate(hWnd, s); - } - break; - - case B_DISABLE: - Zero(&t, sizeof(t)); - StrCpy(t.HubName, sizeof(t.HubName), s->HubName); - CALL(hWnd, ScDisableSecureNAT(s->Rpc, &t)); - SmSNATDlgUpdate(hWnd, s); - break; - - case B_CONFIG: - NmEditVhOption(hWnd, s); - break; - - case B_NAT: - NmNat(hWnd, s); - break; - - case B_DHCP: - NmDhcp(hWnd, s); - break; - - case B_STATUS: - SmStatusDlg(hWnd, s->p, s, false, true, _UU("SM_SNAT_STATUS"), ICO_ROUTER, - NULL, NmStatus); - break; - } - break; - - case WM_CLOSE: - EndDialog(hWnd, 0); - break; - } - - return 0; -} - -// Initialize -void SmCreateCertDlgInit(HWND hWnd, SM_CERT *s) -{ - UINT cert_sign; - UINT cert_days; - char *reg_o, *reg_ou, *reg_c, *reg_st, *reg_l; - UINT bits[] = {1024, 1536, 2048, 3072, 4096 }; - UINT i; - UINT last_bit; - // Validate arguments - if (hWnd == NULL || s == NULL) - { - return; - } - - SetTextA(hWnd, E_CN, s->default_cn); - - last_bit = MsRegReadInt(REG_CURRENT_USER, SM_CERT_REG_KEY, "Bits"); - if (last_bit == 0) - { - last_bit = 2048; - } - - CbReset(hWnd, C_BITS); - for (i = 0;i < sizeof(bits) / sizeof(bits[0]);i++) - { - char tmp[MAX_PATH]; - UINT index; - - ToStr(tmp, bits[i]); - - index = CbAddStrA(hWnd, C_BITS, tmp, bits[i]); - } - - CbSelect(hWnd, C_BITS, 1024); - CbSelect(hWnd, C_BITS, last_bit); - - reg_o = MsRegReadStr(REG_CURRENT_USER, SM_CERT_REG_KEY, "O"); - reg_ou = MsRegReadStr(REG_CURRENT_USER, SM_CERT_REG_KEY, "OU"); - reg_c = MsRegReadStr(REG_CURRENT_USER, SM_CERT_REG_KEY, "C"); - reg_st = MsRegReadStr(REG_CURRENT_USER, SM_CERT_REG_KEY, "ST"); - reg_l = MsRegReadStr(REG_CURRENT_USER, SM_CERT_REG_KEY, "L"); - SetTextA(hWnd, E_O, reg_o); - SetTextA(hWnd, E_OU, reg_ou); - SetTextA(hWnd, E_C, reg_c); - SetTextA(hWnd, E_ST, reg_st); - SetTextA(hWnd, E_L, reg_l); - Free(reg_o); - Free(reg_ou); - Free(reg_c); - Free(reg_st); - Free(reg_l); - - LimitText(hWnd, E_C, 2); - - cert_sign = MsRegReadInt(REG_CURRENT_USER, SM_CERT_REG_KEY, "Sign"); - cert_days = MsRegReadInt(REG_CURRENT_USER, SM_CERT_REG_KEY, "Days"); - - Check(hWnd, R_ROOT_CERT, cert_sign ? false : true); - Check(hWnd, R_SIGNED_CERT, cert_sign ? true : false); - - if (cert_days == 0) - { - cert_days = 3650; - } - - SetIntEx(hWnd, E_EXPIRE, cert_days); - - SmCreateCertDlgUpdate(hWnd, s); - - if (s->root_only) - { - Disable(hWnd, R_SIGNED_CERT); - } - - // Font - SetFont(hWnd, E_CN, GetFont((MsIsWinXPOrGreater() ? "Verdana" : NULL), 0, false, false, false, false)); - SetFont(hWnd, E_O, GetFont((MsIsWinXPOrGreater() ? "Verdana" : NULL), 0, false, false, false, false)); - SetFont(hWnd, E_OU, GetFont((MsIsWinXPOrGreater() ? "Verdana" : NULL), 0, false, false, false, false)); - SetFont(hWnd, E_C, GetFont((MsIsWinXPOrGreater() ? "Verdana" : NULL), 0, false, false, false, false)); - SetFont(hWnd, E_ST, GetFont((MsIsWinXPOrGreater() ? "Verdana" : NULL), 0, false, false, false, false)); - SetFont(hWnd, E_L, GetFont((MsIsWinXPOrGreater() ? "Verdana" : NULL), 0, false, false, false, false)); - SetFont(hWnd, E_SERIAL, GetFont((MsIsWinXPOrGreater() ? "Verdana" : NULL), 0, false, false, false, false)); - SetFont(hWnd, E_EXPIRE, GetFont((MsIsWinXPOrGreater() ? "Verdana" : NULL), 0, false, false, false, false)); - SetFont(hWnd, C_BITS, GetFont("Verdana", 0, false, false, false, false)); - - FocusEx(hWnd, E_CN); -} - -// Update -void SmCreateCertDlgUpdate(HWND hWnd, SM_CERT *s) -{ - bool ok = true; - bool b; - UINT i; - // Validate arguments - if (hWnd == NULL || s == NULL) - { - return; - } - - if (IsEmpty(hWnd, E_CN) && IsEmpty(hWnd, E_O) && IsEmpty(hWnd, E_OU) && - IsEmpty(hWnd, E_ST) && IsEmpty(hWnd, E_L)) - { - ok = false; - } - - i = GetInt(hWnd, E_EXPIRE); - if (i == 0 || i >= (365 * 30)) - { - ok = false; - } - - b = IsChecked(hWnd, R_SIGNED_CERT); - - SetEnable(hWnd, S_LOAD_1, b); - SetEnable(hWnd, B_LOAD, b); - SetEnable(hWnd, S_LOAD_2, b); - - if (b && (s->root_k == NULL || s->root_x == NULL)) - { - ok = false; - } - - SetEnable(hWnd, IDOK, ok); -} - -// [OK] button -void SmCreateCertDlgOnOk(HWND hWnd, SM_CERT *s) -{ - wchar_t cn[MAX_SIZE], o[MAX_SIZE], ou[MAX_SIZE], c[MAX_SIZE], st[MAX_SIZE], l[MAX_SIZE]; - char *reg_o, *reg_ou, *reg_c, *reg_st, *reg_l; - UINT days; - bool sign; - char serial[MAX_SIZE * 2]; - X *x; - K *pub; - K *pri; - NAME *n; - X_SERIAL *x_serial; - BUF *buf; - UINT bits; - // Validate arguments - if (hWnd == NULL || s == NULL) - { - return; - } - - GetTxt(hWnd, E_CN, cn, sizeof(cn)); - GetTxt(hWnd, E_O, o, sizeof(o)); - GetTxt(hWnd, E_OU, ou, sizeof(ou)); - GetTxt(hWnd, E_C, c, sizeof(c)); - GetTxt(hWnd, E_ST, st, sizeof(st)); - GetTxt(hWnd, E_L, l, sizeof(l)); - GetTxtA(hWnd, E_SERIAL, serial, sizeof(serial)); - - bits = CbGetSelect(hWnd, C_BITS); - if (bits == INFINITE) - { - bits = 1024; - } - - buf = StrToBin(serial); - if (buf == NULL) - { - return; - } - - if (buf->Size > 1) - { - x_serial = NewXSerial(buf->Buf, buf->Size); - } - else - { - x_serial = NULL; - } - - FreeBuf(buf); - - n = NewName(UniStrLen(cn) ? cn : NULL, - UniStrLen(o) ? o : NULL, - UniStrLen(ou) ? ou : NULL, - UniStrLen(c) ? c : NULL, - UniStrLen(st) ? st : NULL, - UniStrLen(l) ? l : NULL); - - days = GetInt(hWnd, E_EXPIRE); - - sign = IsChecked(hWnd, R_SIGNED_CERT); - - MsRegWriteInt(REG_CURRENT_USER, SM_CERT_REG_KEY, "Sign", sign); - MsRegWriteInt(REG_CURRENT_USER, SM_CERT_REG_KEY, "Days", days); - MsRegWriteInt(REG_CURRENT_USER, SM_CERT_REG_KEY, "Bits", bits); - - RsaGen(&pri, &pub, bits); - - if (sign == false) - { - x = NewRootX(pub, pri, n, days, x_serial); - } - else - { - x = NewX(pub, s->root_k, s->root_x, n, days, x_serial); - } - - FreeName(n); - - FreeXSerial(x_serial); - - if (x == NULL) - { - FreeX(x); - FreeK(pub); - FreeK(pri); - return; - } - - if (s->do_not_save == false) - { - if (SmSaveKeyPairDlg(hWnd, x, pri) == false) - { - FreeX(x); - FreeK(pub); - FreeK(pri); - return; - } - } - - s->x = x; - s->k = pri; - FreeK(pub); - - reg_o = GetTextA(hWnd, E_O); - reg_ou = GetTextA(hWnd, E_OU); - reg_c = GetTextA(hWnd, E_C); - reg_st = GetTextA(hWnd, E_ST); - reg_l = GetTextA(hWnd, E_L); - MsRegWriteStr(REG_CURRENT_USER, SM_CERT_REG_KEY, "O", reg_o); - MsRegWriteStr(REG_CURRENT_USER, SM_CERT_REG_KEY, "OU", reg_ou); - MsRegWriteStr(REG_CURRENT_USER, SM_CERT_REG_KEY, "C", reg_c); - MsRegWriteStr(REG_CURRENT_USER, SM_CERT_REG_KEY, "ST", reg_st); - MsRegWriteStr(REG_CURRENT_USER, SM_CERT_REG_KEY, "L", reg_l); - Free(reg_o); - Free(reg_ou); - Free(reg_c); - Free(reg_st); - Free(reg_l); - - EndDialog(hWnd, true); -} - -// Certificate creation screen -UINT SmCreateCertDlgProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param) -{ - SM_CERT *s = (SM_CERT *)param; - // Validate arguments - if (hWnd == NULL) - { - return 0; - } - - switch (msg) - { - case WM_INITDIALOG: - // Initialize - SmCreateCertDlgInit(hWnd, s); - break; - - case WM_COMMAND: - switch (LOWORD(wParam)) - { - case R_ROOT_CERT: - case R_SIGNED_CERT: - case B_LOAD: - case E_CN: - case E_O: - case E_OU: - case E_C: - case E_ST: - case E_L: - case E_EXPIRE: - SmCreateCertDlgUpdate(hWnd, s); - break; - } - - switch (wParam) - { - case IDOK: - // [OK] button - SmCreateCertDlgOnOk(hWnd, s); - break; - - case R_ROOT_CERT: - if (IsChecked(hWnd, R_ROOT_CERT)) - { - FocusEx(hWnd, E_CN); - } - break; - - case B_LOAD: - // Read a certificate - if (1) - { - X *x; - K *k; - if (CmLoadXAndK(hWnd, &x, &k)) - { - wchar_t tmp[MAX_SIZE]; - FreeX(s->root_x); - FreeK(s->root_k); - s->root_x = x; - s->root_k = k; - - SmGetCertInfoStr(tmp, sizeof(tmp), x); - SetText(hWnd, S_LOAD_2, tmp); - SmCreateCertDlgUpdate(hWnd, s); - } - } - break; - - case IDCANCEL: - // Cancel button - Close(hWnd); - break; - } - break; - - case WM_CLOSE: - EndDialog(hWnd, false); - break; - } - - return 0; -} - -// Certificate tool -bool SmCreateCert(HWND hWnd, X **x, K **k, bool do_not_save, char *default_cn, bool root_only) -{ - bool ret; - SM_CERT s; - Zero(&s, sizeof(s)); - - if (default_cn == NULL) - { - default_cn = ""; - } - - s.default_cn = default_cn; - - s.do_not_save = do_not_save; - - s.root_only = root_only; - - ret = Dialog(hWnd, D_SM_CREATE_CERT, SmCreateCertDlgProc, &s); - - if (ret) - { - if (x != NULL) - { - *x = CloneX(s.x); - } - - if (k != NULL) - { - *k = CloneK(s.k); - } - } - - FreeX(s.x); - FreeK(s.k); - FreeX(s.root_x); - FreeK(s.root_k); - - return ret; -} - -// Initialize -void SmIpTableDlgInit(HWND hWnd, SM_TABLE *s) -{ - // Validate arguments - if (hWnd == NULL || s == NULL) - { - return; - } - - SetIcon(hWnd, 0, ICO_PROTOCOL); - FormatText(hWnd, S_TITLE, s->Hub->HubName); - - if (s->SessionName != NULL) - { - wchar_t tmp[MAX_SIZE]; - wchar_t tmp2[MAX_SIZE]; - GetTxt(hWnd, S_TITLE, tmp, sizeof(tmp)); - UniFormat(tmp2, sizeof(tmp2), _UU("SM_SESSION_FILTER"), s->SessionName); - UniStrCat(tmp, sizeof(tmp), tmp2); - SetText(hWnd, S_TITLE, tmp); - } - - LvInit(hWnd, L_TABLE); - LvInsertColumn(hWnd, L_TABLE, 0, _UU("SM_IP_COLUMN_1"), 190); - LvInsertColumn(hWnd, L_TABLE, 1, _UU("SM_IP_COLUMN_2"), 140); - LvInsertColumn(hWnd, L_TABLE, 2, _UU("SM_IP_COLUMN_3"), 133); - LvInsertColumn(hWnd, L_TABLE, 3, _UU("SM_IP_COLUMN_4"), 133); - LvInsertColumn(hWnd, L_TABLE, 4, _UU("SM_IP_COLUMN_5"), 133); - LvSetStyle(hWnd, L_TABLE, LVS_EX_GRIDLINES); - - SmIpTableDlgRefresh(hWnd, s); -} - -// Update the control -void SmIpTableDlgUpdate(HWND hWnd, SM_TABLE *s) -{ - bool ok = true; - // Validate arguments - if (hWnd == NULL || s == NULL) - { - return; - } - - if (LvIsSelected(hWnd, L_TABLE) == false || LvIsMultiMasked(hWnd, L_TABLE)) - { - ok = false; - } - - SetEnable(hWnd, B_DELETE, ok); -} - -// Content update -void SmIpTableDlgRefresh(HWND hWnd, SM_TABLE *s) -{ - UINT i; - RPC_ENUM_IP_TABLE t; - UINT old_selected = 0; - // Validate arguments - if (hWnd == NULL || s == NULL) - { - return; - } - - Zero(&t, sizeof(t)); - StrCpy(t.HubName, sizeof(t.HubName), s->Hub->HubName); - - if (CALL(hWnd, ScEnumIpTable(s->Rpc, &t)) == false) - { - EndDialog(hWnd, false); - return; - } - - i = LvGetSelected(hWnd, L_TABLE); - if (i != INFINITE) - { - old_selected = (UINT)LvGetParam(hWnd, L_TABLE, i); - } - - LvReset(hWnd, L_TABLE); - - for (i = 0;i < t.NumIpTable;i++) - { - char str[MAX_SIZE]; - wchar_t tmp1[MAX_SIZE]; - wchar_t tmp2[MAX_SIZE]; - wchar_t tmp3[MAX_SIZE]; - wchar_t tmp4[MAX_SIZE]; - wchar_t tmp5[MAX_SIZE]; - RPC_ENUM_IP_TABLE_ITEM *e = &t.IpTables[i]; - - if (s->SessionName == NULL || StrCmpi(e->SessionName, s->SessionName) == 0) - { - StrToUni(tmp1, sizeof(tmp1), e->SessionName); - - if (e->DhcpAllocated == false) - { - IPToStr(str, sizeof(str), &e->IpV6); - StrToUni(tmp2, sizeof(tmp2), str); - } - else - { - IPToStr(str, sizeof(str), &e->IpV6); - UniFormat(tmp2, sizeof(tmp2), _UU("SM_MAC_IP_DHCP"), str); - } - - GetDateTimeStr64Uni(tmp3, sizeof(tmp3), SystemToLocal64(e->CreatedTime)); - - GetDateTimeStr64Uni(tmp4, sizeof(tmp4), SystemToLocal64(e->UpdatedTime)); - - if (StrLen(e->RemoteHostname) == 0) - { - UniStrCpy(tmp5, sizeof(tmp5), _UU("SM_MACIP_LOCAL")); - } - else - { - UniFormat(tmp5, sizeof(tmp5), _UU("SM_MACIP_SERVER"), e->RemoteHostname); - } - - LvInsert(hWnd, L_TABLE, e->DhcpAllocated ? ICO_PROTOCOL_DHCP : ICO_PROTOCOL, (void *)e->Key, 5, - tmp1, tmp2, tmp3, tmp4, tmp5); - } - } - - FreeRpcEnumIpTable(&t); - - if (old_selected != 0) - { - LvSelect(hWnd, L_TABLE, LvSearchParam(hWnd, L_TABLE, (void *)old_selected)); - } - - SmIpTableDlgUpdate(hWnd, s); -} - -// IP address table dialog procedure -UINT SmIpTableDlgProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param) -{ - SM_TABLE *s = (SM_TABLE *)param; - NMHDR *n; - UINT i; - // Validate arguments - if (hWnd == NULL) - { - return 0; - } - - switch (msg) - { - case WM_INITDIALOG: - // Initialize - SmIpTableDlgInit(hWnd, s); - break; - - case WM_COMMAND: - switch (wParam) - { - case B_DELETE: - // Delete - i = LvGetSelected(hWnd, L_TABLE); - if (i != INFINITE) - { - RPC_DELETE_TABLE t; - UINT key = (UINT)LvGetParam(hWnd, L_TABLE, i); - - Zero(&t, sizeof(t)); - StrCpy(t.HubName, sizeof(t.HubName), s->Hub->HubName); - t.Key = key; - if (CALL(hWnd, ScDeleteIpTable(s->Rpc, &t))) - { - LvDeleteItem(hWnd, L_TABLE, i); - } - } - break; - - case B_REFRESH: - // Update - SmIpTableDlgRefresh(hWnd, s); - break; - - case IDCANCEL: - // Cancel button - Close(hWnd); - break; - } - break; - - case WM_NOTIFY: - n = (NMHDR *)lParam; - switch (n->idFrom) - { - case L_TABLE: - switch (n->code) - { - case LVN_ITEMCHANGED: - SmIpTableDlgUpdate(hWnd, s); - break; - } - break; - } - break; - - case WM_CLOSE: - EndDialog(hWnd, false); - break; - } - - LvStandardHandler(hWnd, msg, wParam, lParam, L_TABLE); - - return 0; -} - -// IP address table dialog -void SmIpTableDlg(HWND hWnd, SM_HUB *s, char *session_name) -{ - SM_TABLE t; - // Validate arguments - if (hWnd == NULL || s == NULL) - { - return; - } - - Zero(&t, sizeof(t)); - t.Hub = s; - t.Rpc = s->Rpc; - t.SessionName = session_name; - - Dialog(hWnd, D_SM_IP, SmIpTableDlgProc, &t); -} - - -// Initialize -void SmMacTableDlgInit(HWND hWnd, SM_TABLE *s) -{ - UINT i = 0; - // Validate arguments - if (hWnd == NULL || s == NULL) - { - return; - } - - SetIcon(hWnd, 0, ICO_NIC_ONLINE); - FormatText(hWnd, S_TITLE, s->Hub->HubName); - - if (s->SessionName != NULL) - { - wchar_t tmp[MAX_SIZE]; - wchar_t tmp2[MAX_SIZE]; - GetTxt(hWnd, S_TITLE, tmp, sizeof(tmp)); - UniFormat(tmp2, sizeof(tmp2), _UU("SM_SESSION_FILTER"), s->SessionName); - UniStrCat(tmp, sizeof(tmp), tmp2); - SetText(hWnd, S_TITLE, tmp); - } - - LvInit(hWnd, L_TABLE); - LvInsertColumn(hWnd, L_TABLE, i++, _UU("SM_MAC_COLUMN_1"), 190); - if (GetCapsBool(s->Hub->p->CapsList, "b_support_vlan")) - { - LvInsertColumn(hWnd, L_TABLE, i++, _UU("SM_MAC_COLUMN_1A"), 65); - } - LvInsertColumn(hWnd, L_TABLE, i++, _UU("SM_MAC_COLUMN_2"), 140); - LvInsertColumn(hWnd, L_TABLE, i++, _UU("SM_MAC_COLUMN_3"), 133); - LvInsertColumn(hWnd, L_TABLE, i++, _UU("SM_MAC_COLUMN_4"), 133); - LvInsertColumn(hWnd, L_TABLE, i++, _UU("SM_MAC_COLUMN_5"), 133); - LvSetStyle(hWnd, L_TABLE, LVS_EX_GRIDLINES); - - SmMacTableDlgRefresh(hWnd, s); -} - -// Update the control -void SmMacTableDlgUpdate(HWND hWnd, SM_TABLE *s) -{ - bool ok = true; - // Validate arguments - if (hWnd == NULL || s == NULL) - { - return; - } - - if (LvIsSelected(hWnd, L_TABLE) == false || LvIsMultiMasked(hWnd, L_TABLE)) - { - ok = false; - } - - SetEnable(hWnd, B_DELETE, ok); -} - -// Content update -void SmMacTableDlgRefresh(HWND hWnd, SM_TABLE *s) -{ - UINT i; - RPC_ENUM_MAC_TABLE t; - UINT old_selected = 0; - // Validate arguments - if (hWnd == NULL || s == NULL) - { - return; - } - - Zero(&t, sizeof(t)); - StrCpy(t.HubName, sizeof(t.HubName), s->Hub->HubName); - - if (CALL(hWnd, ScEnumMacTable(s->Rpc, &t)) == false) - { - EndDialog(hWnd, false); - return; - } - - i = LvGetSelected(hWnd, L_TABLE); - if (i != INFINITE) - { - old_selected = (UINT)LvGetParam(hWnd, L_TABLE, i); - } - - LvReset(hWnd, L_TABLE); - - for (i = 0;i < t.NumMacTable;i++) - { - char str[MAX_SIZE]; - wchar_t tmp1[MAX_SIZE]; - wchar_t tmp2[MAX_SIZE]; - wchar_t tmp3[MAX_SIZE]; - wchar_t tmp4[MAX_SIZE]; - wchar_t tmp5[MAX_SIZE]; - wchar_t tmp6[MAX_SIZE]; - RPC_ENUM_MAC_TABLE_ITEM *e = &t.MacTables[i]; - - if (s->SessionName == NULL || StrCmpi(e->SessionName, s->SessionName) == 0) - { - StrToUni(tmp1, sizeof(tmp1), e->SessionName); - - MacToStr(str, sizeof(str), e->MacAddress); - StrToUni(tmp2, sizeof(tmp2), str); - - GetDateTimeStr64Uni(tmp3, sizeof(tmp3), SystemToLocal64(e->CreatedTime)); - - GetDateTimeStr64Uni(tmp4, sizeof(tmp4), SystemToLocal64(e->UpdatedTime)); - - if (StrLen(e->RemoteHostname) == 0) - { - UniStrCpy(tmp5, sizeof(tmp5), _UU("SM_MACIP_LOCAL")); - } - else - { - UniFormat(tmp5, sizeof(tmp5), _UU("SM_MACIP_SERVER"), e->RemoteHostname); - } - - UniToStru(tmp6, e->VlanId); - if (e->VlanId == 0) - { - UniStrCpy(tmp6, sizeof(tmp6), _UU("CM_ST_NONE")); - } - - if (GetCapsBool(s->Hub->p->CapsList, "b_support_vlan")) - { - LvInsert(hWnd, L_TABLE, ICO_NIC_ONLINE, (void *)e->Key, 6, - tmp1, tmp6, tmp2, tmp3, tmp4, tmp5); - } - else - { - LvInsert(hWnd, L_TABLE, ICO_NIC_ONLINE, (void *)e->Key, 5, - tmp1, tmp2, tmp3, tmp4, tmp5); - } - } - } - - FreeRpcEnumMacTable(&t); - - if (old_selected != 0) - { - LvSelect(hWnd, L_TABLE, LvSearchParam(hWnd, L_TABLE, (void *)old_selected)); - } - - SmMacTableDlgUpdate(hWnd, s); -} - -// MAC address table dialog procedure -UINT SmMacTableDlgProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param) -{ - SM_TABLE *s = (SM_TABLE *)param; - NMHDR *n; - UINT i; - // Validate arguments - if (hWnd == NULL) - { - return 0; - } - - switch (msg) - { - case WM_INITDIALOG: - // Initialize - SmMacTableDlgInit(hWnd, s); - break; - - case WM_COMMAND: - switch (wParam) - { - case B_DELETE: - // Delete - i = LvGetSelected(hWnd, L_TABLE); - if (i != INFINITE) - { - RPC_DELETE_TABLE t; - UINT key = (UINT)LvGetParam(hWnd, L_TABLE, i); - - Zero(&t, sizeof(t)); - StrCpy(t.HubName, sizeof(t.HubName), s->Hub->HubName); - t.Key = key; - if (CALL(hWnd, ScDeleteMacTable(s->Rpc, &t))) - { - LvDeleteItem(hWnd, L_TABLE, i); - } - } - break; - - case B_REFRESH: - // Update - SmMacTableDlgRefresh(hWnd, s); - break; - - case IDCANCEL: - // Cancel button - Close(hWnd); - break; - } - break; - - case WM_NOTIFY: - n = (NMHDR *)lParam; - switch (n->idFrom) - { - case L_TABLE: - switch (n->code) - { - case LVN_ITEMCHANGED: - SmMacTableDlgUpdate(hWnd, s); - break; - } - break; - } - break; - - case WM_CLOSE: - EndDialog(hWnd, false); - break; - } - - LvStandardHandler(hWnd, msg, wParam, lParam, L_TABLE); - - return 0; -} - -// MAC address table dialog -void SmMacTableDlg(HWND hWnd, SM_HUB *s, char *session_name) -{ - SM_TABLE t; - // Validate arguments - if (hWnd == NULL || s == NULL) - { - return; - } - - Zero(&t, sizeof(t)); - t.Hub = s; - t.Rpc = s->Rpc; - t.SessionName = session_name; - - Dialog(hWnd, D_SM_MAC, SmMacTableDlgProc, &t); -} - -// Initialize -void SmSessionDlgInit(HWND hWnd, SM_HUB *s) -{ - // Validate arguments - if (hWnd == NULL || s == NULL) - { - return; - } - - SetIcon(hWnd, 0, ICO_VPN); - FormatText(hWnd, 0, s->HubName); - FormatText(hWnd, S_TITLE, s->HubName); - - LvInit(hWnd, L_LIST); - LvInsertColumn(hWnd, L_LIST, 0, _UU("SM_SESS_COLUMN_1"), 176); - LvInsertColumn(hWnd, L_LIST, 1, _UU("SM_SESS_COLUMN_8"), 58); - LvInsertColumn(hWnd, L_LIST, 2, _UU("SM_SESS_COLUMN_2"), 62); - LvInsertColumn(hWnd, L_LIST, 3, _UU("SM_SESS_COLUMN_3"), 78); - LvInsertColumn(hWnd, L_LIST, 4, _UU("SM_SESS_COLUMN_4"), 122); - LvInsertColumn(hWnd, L_LIST, 5, _UU("SM_SESS_COLUMN_5"), 68); - LvInsertColumn(hWnd, L_LIST, 6, _UU("SM_SESS_COLUMN_6"), 100); - LvInsertColumn(hWnd, L_LIST, 7, _UU("SM_SESS_COLUMN_7"), 100); - LvSetStyle(hWnd, L_LIST, LVS_EX_GRIDLINES); - - if (s->p->ServerType == SERVER_TYPE_FARM_CONTROLLER && GetCapsBool(s->p->CapsList, "b_support_cluster_admin") == false) - { - Show(hWnd, S_FARM_INFO_1); - Show(hWnd, S_FARM_INFO_2); - } - - SmSessionDlgRefresh(hWnd, s); -} - -// Update the control -void SmSessionDlgUpdate(HWND hWnd, SM_HUB *s) -{ - bool ok = true; - bool ok2 = true; - // Validate arguments - if (hWnd == NULL || s == NULL) - { - return; - } - - if (LvIsSelected(hWnd, L_LIST) == false || LvIsMultiMasked(hWnd, L_LIST)) - { - ok = false; - ok2 = false; - } - else - { - UINT i = LvGetSelected(hWnd, L_LIST); - if (i != INFINITE) - { - void *p = LvGetParam(hWnd, L_LIST, i); - if (((bool)p) != false) - { - if (GetCapsBool(s->p->CapsList, "b_support_cluster_admin") == false) - { - ok = false; - } - } - } - } - - if (s->p->ServerInfo.ServerBuildInt < 2844) - { - // Old version doesn't support for remote management of the sessions - ok2 = ok; - } - - SetEnable(hWnd, IDOK, ok2); - SetEnable(hWnd, B_DISCONNECT, ok2); - SetEnable(hWnd, B_SESSION_IP_TABLE, ok); - SetEnable(hWnd, B_SESSION_MAC_TABLE, ok); -} - -// Update the list -void SmSessionDlgRefresh(HWND hWnd, SM_HUB *s) -{ - LVB *b; - UINT i; - wchar_t *old_select; - RPC_ENUM_SESSION t; - // Validate arguments - if (hWnd == NULL || s == NULL) - { - return; - } - - Zero(&t, sizeof(t)); - StrCpy(t.HubName, sizeof(t.HubName), s->HubName); - - if (CALL(hWnd, ScEnumSession(s->Rpc, &t)) == false) - { - EndDialog(hWnd, false); - return; - } - - old_select = LvGetSelectedStr(hWnd, L_LIST, 0); - - LvReset(hWnd, L_LIST); - - b = LvInsertStart(); - - for (i = 0;i < t.NumSession;i++) - { - RPC_ENUM_SESSION_ITEM *e = &t.Sessions[i]; - wchar_t tmp1[MAX_SIZE]; - wchar_t *tmp2; - wchar_t tmp3[MAX_SIZE]; - wchar_t tmp4[MAX_SIZE]; - wchar_t tmp5[MAX_SIZE]; - wchar_t tmp6[MAX_SIZE]; - wchar_t tmp7[MAX_SIZE]; - wchar_t tmp8[MAX_SIZE]; - bool free_tmp2 = false; - UINT icon; - - StrToUni(tmp1, sizeof(tmp1), e->Name); - - tmp2 = _UU("SM_SESS_NORMAL"); - icon = ICO_VPN; - if (s->p->ServerType != SERVER_TYPE_STANDALONE) - { - if (e->RemoteSession) - { - tmp2 = ZeroMalloc(MAX_SIZE); - UniFormat(tmp2, MAX_SIZE, _UU("SM_SESS_REMOTE"), e->RemoteHostname); - icon = ICO_VPN; - free_tmp2 = true; - } - else - { - if (StrLen(e->RemoteHostname) == 0) - { - tmp2 = _UU("SM_SESS_LOCAL"); - } - else - { - tmp2 = ZeroMalloc(MAX_SIZE); - UniFormat(tmp2, MAX_SIZE, _UU("SM_SESS_LOCAL_2"), e->RemoteHostname); - free_tmp2 = true; - } - } - } - if (e->LinkMode) - { - if (free_tmp2) - { - Free(tmp2); - free_tmp2 = false; - } - tmp2 = _UU("SM_SESS_LINK"); - icon = ICO_CASCADE; - } - else if (e->SecureNATMode) - { - /*if (free_tmp2) - { - Free(tmp2); - free_tmp2 = false; - } - tmp2 = _UU("SM_SESS_SNAT");*/ - icon = ICO_ROUTER; - } - else if (e->BridgeMode) - { - icon = ICO_BRIDGE; - } - else if (e->Layer3Mode) - { - icon = ICO_SWITCH; - } - - StrToUni(tmp3, sizeof(tmp3), e->Username); - - StrToUni(tmp4, sizeof(tmp4), e->Hostname); - if (e->LinkMode) - { - UniStrCpy(tmp4, sizeof(tmp4), _UU("SM_SESS_LINK_HOSTNAME")); - } - else if (e->SecureNATMode) - { - UniStrCpy(tmp4, sizeof(tmp4), _UU("SM_SESS_SNAT_HOSTNAME")); - } - else if (e->BridgeMode) - { - UniStrCpy(tmp4, sizeof(tmp4), _UU("SM_SESS_BRIDGE_HOSTNAME")); - } - else if (StartWith(e->Username, L3_USERNAME)) - { - UniStrCpy(tmp4, sizeof(tmp4), _UU("SM_SESS_LAYER3_HOSTNAME")); - } - - UniFormat(tmp5, sizeof(tmp5), L"%u / %u", e->CurrentNumTcp, e->MaxNumTcp); - if (e->LinkMode) - { - UniStrCpy(tmp5, sizeof(tmp5), _UU("SM_SESS_LINK_TCP")); - } - else if (e->SecureNATMode) - { - UniStrCpy(tmp5, sizeof(tmp5), _UU("SM_SESS_SNAT_TCP")); - } - else if (e->BridgeMode) - { - UniStrCpy(tmp5, sizeof(tmp5), _UU("SM_SESS_BRIDGE_TCP")); - } - - if (e->VLanId == 0) - { - UniStrCpy(tmp8, sizeof(tmp8), _UU("CM_ST_NO_VLAN")); - } - else - { - UniToStru(tmp8, e->VLanId); - } - - UniToStr3(tmp6, sizeof(tmp6), e->PacketSize); - UniToStr3(tmp7, sizeof(tmp7), e->PacketNum); - - if (icon == ICO_VPN) - { - if (e->Client_BridgeMode) - { - icon = ICO_SESSION_BRIDGE; - } - else if (e->Client_MonitorMode) - { - icon = ICO_SESSION_MONITOR; - } - } - - if (e->IsDormantEnabled && e->IsDormant) - { - icon = ICO_TRAY0; - } - - LvInsertAdd(b, icon, (void *)(e->RemoteSession), 8, tmp1, tmp8, tmp2, tmp3, tmp4, tmp5, tmp6, tmp7); - - if (free_tmp2) - { - Free(tmp2); - } - } - - LvInsertEnd(b, hWnd, L_LIST); - - if (old_select != NULL && UniStrLen(old_select) != 0) - { - UINT i = LvSearchStr(hWnd, L_LIST, 0, old_select); - if (i != INFINITE) - { - LvSelect(hWnd, L_LIST, i); - } - } - - Free(old_select); - - FreeRpcEnumSession(&t); - - SmSessionDlgUpdate(hWnd, s); -} - -// Display the NODE_INFO -void SmPrintNodeInfo(LVB *b, NODE_INFO *info) -{ - wchar_t tmp[MAX_SIZE]; - char str[MAX_SIZE]; - // Validate arguments - if (b == NULL || info == NULL) - { - return; - } - - StrToUni(tmp, sizeof(tmp), info->ClientProductName); - LvInsertAdd(b, 0, NULL, 2, _UU("SM_NODE_CLIENT_NAME"), tmp); - - UniFormat(tmp, sizeof(tmp), L"%u.%02u", Endian32(info->ClientProductVer) / 100, Endian32(info->ClientProductVer) % 100); - LvInsertAdd(b, 0, NULL, 2, _UU("SM_NODE_CLIENT_VER"), tmp); - - UniFormat(tmp, sizeof(tmp), L"Build %u", Endian32(info->ClientProductBuild)); - LvInsertAdd(b, 0, NULL, 2, _UU("SM_NODE_CLIENT_BUILD"), tmp); - - StrToUni(tmp, sizeof(tmp), info->ClientOsName); - LvInsertAdd(b, 0, NULL, 2, _UU("SM_NODE_CLIENT_OS_NAME"), tmp); - - StrToUni(tmp, sizeof(tmp), info->ClientOsVer); - LvInsertAdd(b, 0, NULL, 2, _UU("SM_NODE_CLIENT_OS_VER"), tmp); - - StrToUni(tmp, sizeof(tmp), info->ClientOsProductId); - LvInsertAdd(b, 0, NULL, 2, _UU("SM_NODE_CLIENT_OS_PID"), tmp); - - StrToUni(tmp, sizeof(tmp), info->ClientHostname); - LvInsertAdd(b, 0, NULL, 2, _UU("SM_NODE_CLIENT_HOST"), tmp); - - IPToStr4or6(str, sizeof(str), info->ClientIpAddress, info->ClientIpAddress6); - StrToUni(tmp, sizeof(tmp), str); - LvInsertAdd(b, 0, NULL, 2, _UU("SM_NODE_CLIENT_IP"), tmp); - - UniToStru(tmp, Endian32(info->ClientPort)); - LvInsertAdd(b, 0, NULL, 2, _UU("SM_NODE_CLIENT_PORT"), tmp); - - StrToUni(tmp, sizeof(tmp), info->ServerHostname); - LvInsertAdd(b, 0, NULL, 2, _UU("SM_NODE_SERVER_HOST"), tmp); - - IPToStr4or6(str, sizeof(str), info->ServerIpAddress, info->ServerIpAddress6); - StrToUni(tmp, sizeof(tmp), str); - LvInsertAdd(b, 0, NULL, 2, _UU("SM_NODE_SERVER_IP"), tmp); - - UniToStru(tmp, Endian32(info->ServerPort)); - LvInsertAdd(b, 0, NULL, 2, _UU("SM_NODE_SERVER_PORT"), tmp); - - if (StrLen(info->ProxyHostname) != 0) - { - StrToUni(tmp, sizeof(tmp), info->ProxyHostname); - LvInsertAdd(b, 0, NULL, 2, _UU("SM_NODE_PROXY_HOSTNAME"), tmp); - - IPToStr4or6(str, sizeof(str), info->ProxyIpAddress, info->ProxyIpAddress6); - StrToUni(tmp, sizeof(tmp), str); - LvInsertAdd(b, 0, NULL, 2, _UU("SM_NODE_PROXY_IP"), tmp); - - UniToStru(tmp, Endian32(info->ProxyPort)); - LvInsertAdd(b, 0, NULL, 2, _UU("SM_NODE_PROXY_PORT"), tmp); - } -} - -// Update the session status -bool SmRefreshSessionStatus(HWND hWnd, SM_SERVER *s, void *param) -{ - LVB *b; - SM_SESSION_STATUS *status = (SM_SESSION_STATUS *)param; - RPC_SESSION_STATUS t; - wchar_t tmp[MAX_SIZE]; - char str[MAX_SIZE]; - // Validate arguments - if (hWnd == NULL || s == NULL || param == NULL) - { - return false; - } - - Zero(&t, sizeof(t)); - StrCpy(t.HubName, sizeof(t.HubName), status->Hub->HubName); - StrCpy(t.Name, sizeof(t.Name), status->SessionName); - - if (CALL(hWnd, ScGetSessionStatus(s->Rpc, &t)) == false) - { - return false; - } - - b = LvInsertStart(); - - if (t.ClientIp != 0) - { - IPToStr4or6(str, sizeof(str), t.ClientIp, t.ClientIp6); - StrToUni(tmp, sizeof(tmp), str); - LvInsertAdd(b, 0, NULL, 2, _UU("SM_CLIENT_IP"), tmp); - } - - if (StrLen(t.ClientHostName) != 0) - { - StrToUni(tmp, sizeof(tmp), t.ClientHostName); - LvInsertAdd(b, 0, NULL, 2, _UU("SM_CLIENT_HOSTNAME"), tmp); - } - - StrToUni(tmp, sizeof(tmp), t.Username); - LvInsertAdd(b, 0, NULL, 2, _UU("SM_SESS_STATUS_USERNAME"), tmp); - - if (StrCmpi(t.Username, LINK_USER_NAME_PRINT) != 0 && StrCmpi(t.Username, SNAT_USER_NAME_PRINT) != 0 && StrCmpi(t.Username, BRIDGE_USER_NAME_PRINT) != 0) - { - StrToUni(tmp, sizeof(tmp), t.RealUsername); - LvInsertAdd(b, 0, NULL, 2, _UU("SM_SESS_STATUS_REALUSER"), tmp); - } - - if (IsEmptyStr(t.GroupName) == false) - { - StrToUni(tmp, sizeof(tmp), t.GroupName); - LvInsertAdd(b, 0, NULL, 2, _UU("SM_SESS_STATUS_GROUPNAME"), tmp); - } - - CmPrintStatusToListViewEx(b, &t.Status, true); - - if (StrCmpi(t.Username, LINK_USER_NAME_PRINT) != 0 && StrCmpi(t.Username, SNAT_USER_NAME_PRINT) != 0 && StrCmpi(t.Username, BRIDGE_USER_NAME_PRINT) != 0 && - StartWith(t.Username, L3_USERNAME) == false) - { - SmPrintNodeInfo(b, &t.NodeInfo); - } - - LvInsertEnd(b, hWnd, L_STATUS); - - FreeRpcSessionStatus(&t); - - return true; -} - -// Session Management dialog procedure -UINT SmSessionDlgProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param) -{ - SM_HUB *s = (SM_HUB *)param; - wchar_t *tmp; - wchar_t tmp2[MAX_SIZE]; - char name[MAX_SIZE]; - NMHDR *n; - SM_SESSION_STATUS status; - // Validate arguments - if (hWnd == NULL) - { - return 0; - } - - tmp = LvGetSelectedStr(hWnd, L_LIST, 0); - UniToStr(name, sizeof(name), tmp); - - switch (msg) - { - case WM_INITDIALOG: - // Initialize - SmSessionDlgInit(hWnd, s); - break; - - case WM_COMMAND: - switch (wParam) - { - case IDOK: - if (IsEnable(hWnd, IDOK)) - { - // Session status display - UniFormat(tmp2, sizeof(tmp2), _UU("SM_SESS_STATUS_CAPTION"), name); - Zero(&status, sizeof(status)); - status.Hub = s; - status.SessionName = name; - SmStatusDlg(hWnd, s->p, &status, true, true, tmp2, ICO_VPN, - NULL, SmRefreshSessionStatus); - } - break; - - case B_DISCONNECT: - // Disconnect - if (MsgBoxEx(hWnd, MB_ICONQUESTION | MB_YESNO | MB_DEFBUTTON2, - _UU("SM_SESS_DISCONNECT_MSG"), name) == IDYES) - { - RPC_DELETE_SESSION t; - Zero(&t, sizeof(t)); - StrCpy(t.HubName, sizeof(t.HubName), s->HubName); - StrCpy(t.Name, sizeof(t.Name), name); - - if (CALL(hWnd, ScDeleteSession(s->Rpc, &t))) - { - SmSessionDlgRefresh(hWnd, s); - } - } - break; - - case B_REFRESH: - // Update - SmSessionDlgRefresh(hWnd, s); - break; - - case B_SESSION_IP_TABLE: - // IP table - SmIpTableDlg(hWnd, s, name); - break; - - case B_SESSION_MAC_TABLE: - // MAC table - SmMacTableDlg(hWnd, s, name); - break; - - case B_MAC_TABLE: - // MAC Table List - SmMacTableDlg(hWnd, s, NULL); - break; - - case B_IP_TABLE: - // IP Table List - SmIpTableDlg(hWnd, s, NULL); - break; - - case IDCANCEL: - // Cancel button - Close(hWnd); - break; - } - break; - - case WM_NOTIFY: - n = (NMHDR *)lParam; - switch (n->code) - { - case LVN_ITEMCHANGED: - switch (n->idFrom) - { - case L_LIST: - SmSessionDlgUpdate(hWnd, s); - break; - } - break; - } - break; - - case WM_CLOSE: - EndDialog(hWnd, false); - break; - } - - Free(tmp); - - LvStandardHandler(hWnd, msg, wParam, lParam, L_LIST); - - return 0; -} - -// Session Management dialog -void SmSessionDlg(HWND hWnd, SM_HUB *s) -{ - // Validate arguments - if (hWnd == NULL || s == NULL) - { - return; - } - - Dialog(hWnd, D_SM_SESSION, SmSessionDlgProc, s); -} - -// Certificate List Update -void SmCaDlgRefresh(HWND hWnd, SM_HUB *s) -{ - LVB *b; - UINT i; - RPC_HUB_ENUM_CA t; - // Validate arguments - if (hWnd == NULL || s == NULL) - { - return; - } - - Zero(&t, sizeof(t)); - StrCpy(t.HubName, sizeof(t.HubName), s->HubName); - if (CALL(hWnd, ScEnumCa(s->Rpc, &t)) == false) - { - EndDialog(hWnd, false); - return; - } - - b = LvInsertStart(); - - for (i = 0;i < t.NumCa;i++) - { - wchar_t tmp[MAX_SIZE]; - RPC_HUB_ENUM_CA_ITEM *e = &t.Ca[i]; - - GetDateStrEx64(tmp, sizeof(tmp), SystemToLocal64(e->Expires), NULL); - - LvInsertAdd(b, ICO_SERVER_CERT, (void *)e->Key, 3, - e->SubjectName, e->IssuerName, tmp); - } - - LvInsertEnd(b, hWnd, L_CERT); - - FreeRpcHubEnumCa(&t); - - SmCaDlgUpdate(hWnd, s); -} - -// Initialize -void SmCaDlgInit(HWND hWnd, SM_HUB *s) -{ - // Validate arguments - if (hWnd == NULL || s == NULL) - { - return; - } - - SetIcon(hWnd, 0, ICO_SERVER_CERT); - - LvInit(hWnd, L_CERT); - LvInsertColumn(hWnd, L_CERT, 0, _UU("CM_CERT_COLUMN_1"), 190); - LvInsertColumn(hWnd, L_CERT, 1, _UU("CM_CERT_COLUMN_2"), 190); - LvInsertColumn(hWnd, L_CERT, 2, _UU("CM_CERT_COLUMN_3"), 160); - - SmCaDlgRefresh(hWnd, s); -} - -// Update the control -void SmCaDlgUpdate(HWND hWnd, SM_HUB *s) -{ - // Validate arguments - if (hWnd == NULL || s == NULL) - { - return; - } - - SetEnable(hWnd, B_DELETE, LvIsSelected(hWnd, L_CERT)); - SetEnable(hWnd, IDOK, LvIsSelected(hWnd, L_CERT)); -} - -// OK -void SmCaDlgOnOk(HWND hWnd, SM_HUB *s) -{ - // Validate arguments - if (hWnd == NULL || s == NULL) - { - return; - } -} - -// CA Adding dialog -bool SmCaDlgAdd(HWND hWnd, SM_HUB *s) -{ - X *x; - RPC_HUB_ADD_CA t; - // Validate arguments - if (hWnd == NULL || s == NULL) - { - return false; - } - - if (CmLoadXFromFileOrSecureCard(hWnd, &x) == false) - { - return false; - } - - Zero(&t, sizeof(t)); - StrCpy(t.HubName, sizeof(t.HubName), s->HubName); - t.Cert = x; - - if (CALL(hWnd, ScAddCa(s->Rpc, &t)) == false) - { - return false; - } - - FreeRpcHubAddCa(&t); - - return true; -} - -// CA List dialog procedure -UINT SmCaDlgProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param) -{ - NMHDR *n; - SM_HUB *s = (SM_HUB *)param; - UINT i, key; - // Validate arguments - if (hWnd == NULL) - { - return 0; - } - - switch (msg) - { - case WM_INITDIALOG: - // Initialize - SmCaDlgInit(hWnd, s); - break; - - case WM_COMMAND: - switch (wParam) - { - case B_IMPORT: - // Add - if (SmCaDlgAdd(hWnd, s)) - { - SmCaDlgRefresh(hWnd, s); - } - break; - - case B_DELETE: - // Delete - i = LvGetSelected(hWnd, L_CERT); - if (i != INFINITE) - { - key = (UINT)LvGetParam(hWnd, L_CERT, i); - if (key != 0) - { - if (MsgBox(hWnd, MB_ICONQUESTION | MB_YESNO | MB_DEFBUTTON2, - _UU("CM_CERT_DELETE_MSG")) == IDYES) - { - RPC_HUB_DELETE_CA t; - Zero(&t, sizeof(t)); - StrCpy(t.HubName, sizeof(t.HubName), s->HubName); - t.Key = key; - - if (CALL(hWnd, ScDeleteCa(s->Rpc, &t))) - { - SmCaDlgRefresh(hWnd, s); - } - } - } - } - break; - - case IDOK: - // Display - i = LvGetSelected(hWnd, L_CERT); - if (i != INFINITE) - { - key = (UINT)LvGetParam(hWnd, L_CERT, i); - if (key != 0) - { - RPC_HUB_GET_CA t; - Zero(&t, sizeof(t)); - StrCpy(t.HubName, sizeof(t.HubName), s->HubName); - t.Key = key; - - if (CALL(hWnd, ScGetCa(s->Rpc, &t))) - { - CertDlg(hWnd, t.Cert, NULL, true); - FreeRpcHubGetCa(&t); - } - } - } - break; - - case IDCANCEL: - // Cancel button - Close(hWnd); - break; - } - break; - - case WM_NOTIFY: - n = (NMHDR *)lParam; - switch (n->idFrom) - { - case L_CERT: - switch (n->code) - { - case LVN_ITEMCHANGED: - SmCaDlgUpdate(hWnd, s); - break; - } - break; - } - break; - - case WM_CLOSE: - EndDialog(hWnd, false); - break; - } - - LvStandardHandler(hWnd, msg, wParam, lParam, L_CERT); - - return 0; -} - -// CA List dialog box -void SmCaDlg(HWND hWnd, SM_HUB *s) -{ - // Validate arguments - if (hWnd == NULL || s == NULL) - { - return; - } - - Dialog(hWnd, D_SM_CA, SmCaDlgProc, s); -} - -// Initialize -void SmLogDlgInit(HWND hWnd, SM_HUB *s) -{ - RPC_HUB_LOG t; - // Validate arguments - if (hWnd == NULL || s == NULL) - { - return; - } - - SetIcon(hWnd, 0, ICO_LOG2); - - FormatText(hWnd, S_TITLE, s->HubName); - - CbSetHeight(hWnd, C_SEC_SWITCH, 18); - CbSetHeight(hWnd, C_PACKET_SWITCH, 18); - - // Initialize the control - CbAddStr(hWnd, C_SEC_SWITCH, _UU("SM_LOG_SWITCH_0"), 0); - CbAddStr(hWnd, C_SEC_SWITCH, _UU("SM_LOG_SWITCH_1"), 1); - CbAddStr(hWnd, C_SEC_SWITCH, _UU("SM_LOG_SWITCH_2"), 2); - CbAddStr(hWnd, C_SEC_SWITCH, _UU("SM_LOG_SWITCH_3"), 3); - CbAddStr(hWnd, C_SEC_SWITCH, _UU("SM_LOG_SWITCH_4"), 4); - CbAddStr(hWnd, C_SEC_SWITCH, _UU("SM_LOG_SWITCH_5"), 5); - CbAddStr(hWnd, C_PACKET_SWITCH, _UU("SM_LOG_SWITCH_0"), 0); - CbAddStr(hWnd, C_PACKET_SWITCH, _UU("SM_LOG_SWITCH_1"), 1); - CbAddStr(hWnd, C_PACKET_SWITCH, _UU("SM_LOG_SWITCH_2"), 2); - CbAddStr(hWnd, C_PACKET_SWITCH, _UU("SM_LOG_SWITCH_3"), 3); - CbAddStr(hWnd, C_PACKET_SWITCH, _UU("SM_LOG_SWITCH_4"), 4); - CbAddStr(hWnd, C_PACKET_SWITCH, _UU("SM_LOG_SWITCH_5"), 5); - - // Get the log settings - Zero(&t, sizeof(t)); - StrCpy(t.HubName, sizeof(t.HubName), s->HubName); - if (CALL(hWnd, ScGetHubLog(s->Rpc, &t)) == false) - { - EndDialog(hWnd, false); - return; - } - - Check(hWnd, B_SEC, t.LogSetting.SaveSecurityLog); - CbSelect(hWnd, C_SEC_SWITCH, t.LogSetting.SecurityLogSwitchType); - - Check(hWnd, B_PACKET, t.LogSetting.SavePacketLog); - CbSelect(hWnd, C_PACKET_SWITCH, t.LogSetting.PacketLogSwitchType); - - Check(hWnd, B_PACKET_0_0, t.LogSetting.PacketLogConfig[0] == 0); - Check(hWnd, B_PACKET_0_1, t.LogSetting.PacketLogConfig[0] == 1); - Check(hWnd, B_PACKET_0_2, t.LogSetting.PacketLogConfig[0] == 2); - - Check(hWnd, B_PACKET_1_0, t.LogSetting.PacketLogConfig[1] == 0); - Check(hWnd, B_PACKET_1_1, t.LogSetting.PacketLogConfig[1] == 1); - Check(hWnd, B_PACKET_1_2, t.LogSetting.PacketLogConfig[1] == 2); - - Check(hWnd, B_PACKET_2_0, t.LogSetting.PacketLogConfig[2] == 0); - Check(hWnd, B_PACKET_2_1, t.LogSetting.PacketLogConfig[2] == 1); - Check(hWnd, B_PACKET_2_2, t.LogSetting.PacketLogConfig[2] == 2); - - Check(hWnd, B_PACKET_3_0, t.LogSetting.PacketLogConfig[3] == 0); - Check(hWnd, B_PACKET_3_1, t.LogSetting.PacketLogConfig[3] == 1); - Check(hWnd, B_PACKET_3_2, t.LogSetting.PacketLogConfig[3] == 2); - - Check(hWnd, B_PACKET_4_0, t.LogSetting.PacketLogConfig[4] == 0); - Check(hWnd, B_PACKET_4_1, t.LogSetting.PacketLogConfig[4] == 1); - Check(hWnd, B_PACKET_4_2, t.LogSetting.PacketLogConfig[4] == 2); - - Check(hWnd, B_PACKET_5_0, t.LogSetting.PacketLogConfig[5] == 0); - Check(hWnd, B_PACKET_5_1, t.LogSetting.PacketLogConfig[5] == 1); - Check(hWnd, B_PACKET_5_2, t.LogSetting.PacketLogConfig[5] == 2); - - Check(hWnd, B_PACKET_6_0, t.LogSetting.PacketLogConfig[6] == 0); - Check(hWnd, B_PACKET_6_1, t.LogSetting.PacketLogConfig[6] == 1); - Check(hWnd, B_PACKET_6_2, t.LogSetting.PacketLogConfig[6] == 2); - - Check(hWnd, B_PACKET_7_0, t.LogSetting.PacketLogConfig[7] == 0); - Check(hWnd, B_PACKET_7_1, t.LogSetting.PacketLogConfig[7] == 1); - Check(hWnd, B_PACKET_7_2, t.LogSetting.PacketLogConfig[7] == 2); - - SmLogDlgUpdate(hWnd, s); -} - -// Update the control -void SmLogDlgUpdate(HWND hWnd, SM_HUB *s) -{ - bool b; - // Validate arguments - if (hWnd == NULL || s == NULL) - { - return; - } - - b = IsChecked(hWnd, B_SEC); - SetEnable(hWnd, S_SEC, b); - SetEnable(hWnd, C_SEC_SWITCH, b); - - b = IsChecked(hWnd, B_PACKET); - SetEnable(hWnd, S_PACKET, b); - SetEnable(hWnd, C_PACKET_SWITCH, b); - SetEnable(hWnd, S_PACKET_0, b); - SetEnable(hWnd, S_PACKET_1, b); - SetEnable(hWnd, S_PACKET_2, b); - SetEnable(hWnd, S_PACKET_3, b); - SetEnable(hWnd, S_PACKET_4, b); - SetEnable(hWnd, S_PACKET_5, b); - SetEnable(hWnd, S_PACKET_6, b); - SetEnable(hWnd, S_PACKET_7, b); - SetEnable(hWnd, B_PACKET_0_0, b); SetEnable(hWnd, B_PACKET_0_1, b); SetEnable(hWnd, B_PACKET_0_2, b); - SetEnable(hWnd, B_PACKET_1_0, b); SetEnable(hWnd, B_PACKET_1_1, b); SetEnable(hWnd, B_PACKET_1_2, b); - SetEnable(hWnd, B_PACKET_2_0, b); SetEnable(hWnd, B_PACKET_2_1, b); SetEnable(hWnd, B_PACKET_2_2, b); - SetEnable(hWnd, B_PACKET_3_0, b); SetEnable(hWnd, B_PACKET_3_1, b); SetEnable(hWnd, B_PACKET_3_2, b); - SetEnable(hWnd, B_PACKET_4_0, b); SetEnable(hWnd, B_PACKET_4_1, b); SetEnable(hWnd, B_PACKET_4_2, b); - SetEnable(hWnd, B_PACKET_5_0, b); SetEnable(hWnd, B_PACKET_5_1, b); SetEnable(hWnd, B_PACKET_5_2, b); - SetEnable(hWnd, B_PACKET_6_0, b); SetEnable(hWnd, B_PACKET_6_1, b); SetEnable(hWnd, B_PACKET_6_2, b); - SetEnable(hWnd, B_PACKET_7_0, b); SetEnable(hWnd, B_PACKET_7_1, b); SetEnable(hWnd, B_PACKET_7_2, b); -} - -// OK -void SmLogDlgOnOk(HWND hWnd, SM_HUB *s) -{ - HUB_LOG g; - RPC_HUB_LOG t; - // Validate arguments - if (hWnd == NULL || s == NULL) - { - return; - } - - Zero(&g, sizeof(g)); - g.SaveSecurityLog = IsChecked(hWnd, B_SEC); - g.SavePacketLog = IsChecked(hWnd, B_PACKET); - g.SecurityLogSwitchType = CbGetSelect(hWnd, C_SEC_SWITCH); - g.PacketLogSwitchType = CbGetSelect(hWnd, C_PACKET_SWITCH); - - g.PacketLogConfig[0] = IsChecked(hWnd, B_PACKET_0_0) ? 0 : IsChecked(hWnd, B_PACKET_0_1) ? 1 : 2; - g.PacketLogConfig[1] = IsChecked(hWnd, B_PACKET_1_0) ? 0 : IsChecked(hWnd, B_PACKET_1_1) ? 1 : 2; - g.PacketLogConfig[2] = IsChecked(hWnd, B_PACKET_2_0) ? 0 : IsChecked(hWnd, B_PACKET_2_1) ? 1 : 2; - g.PacketLogConfig[3] = IsChecked(hWnd, B_PACKET_3_0) ? 0 : IsChecked(hWnd, B_PACKET_3_1) ? 1 : 2; - g.PacketLogConfig[4] = IsChecked(hWnd, B_PACKET_4_0) ? 0 : IsChecked(hWnd, B_PACKET_4_1) ? 1 : 2; - g.PacketLogConfig[5] = IsChecked(hWnd, B_PACKET_5_0) ? 0 : IsChecked(hWnd, B_PACKET_5_1) ? 1 : 2; - g.PacketLogConfig[6] = IsChecked(hWnd, B_PACKET_6_0) ? 0 : IsChecked(hWnd, B_PACKET_6_1) ? 1 : 2; - g.PacketLogConfig[7] = IsChecked(hWnd, B_PACKET_7_0) ? 0 : IsChecked(hWnd, B_PACKET_7_1) ? 1 : 2; - - Zero(&t, sizeof(t)); - StrCpy(t.HubName, sizeof(t.HubName), s->HubName); - Copy(&t.LogSetting, &g, sizeof(HUB_LOG)); - - if (CALL(hWnd, ScSetHubLog(s->Rpc, &t)) == false) - { - return; - } - - EndDialog(hWnd, true); -} - -// Log storage settings dialog -UINT SmLogDlg(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param) -{ - SM_HUB *s = (SM_HUB *)param; - // Validate arguments - if (hWnd == NULL) - { - return 0; - } - - switch (msg) - { - case WM_INITDIALOG: - // Initialize - SmLogDlgInit(hWnd, s); - break; - - case WM_COMMAND: - switch (LOWORD(wParam)) - { - case B_SEC: - case B_PACKET: - SmLogDlgUpdate(hWnd, s); - break; - } - - switch (wParam) - { - case IDOK: - // [OK] button - SmLogDlgOnOk(hWnd, s); - break; - - case IDCANCEL: - // Cancel button - Close(hWnd); - break; - } - break; - - case WM_CLOSE: - EndDialog(hWnd, false); - break; - } - - return 0; -} - -// Show the status of the cascade connection -bool SmRefreshLinkStatus(HWND hWnd, SM_SERVER *s, void *param) -{ - SM_LINK *k = (SM_LINK *)param; - RPC_LINK_STATUS t; - LVB *b; - // Validate arguments - if (hWnd == NULL || s == NULL || param == NULL) - { - return false; - } - - Zero(&t, sizeof(t)); - StrCpy(t.HubName, sizeof(t.HubName), k->Hub->HubName); - UniStrCpy(t.AccountName, sizeof(t.AccountName), k->AccountName); - - if (CALL(hWnd, ScGetLinkStatus(s->Rpc, &t)) == false) - { - return false; - } - - b = LvInsertStart(); - - CmPrintStatusToListView(b, &t.Status); - - LvInsertEnd(b, hWnd, L_STATUS); - - FreeRpcLinkStatus(&t); - - return true; -} - -// Edit the link -bool SmLinkEdit(HWND hWnd, SM_HUB *s, wchar_t *name) -{ - CM_ACCOUNT a; - RPC_CREATE_LINK t; - bool ret = false; - // Validate arguments - if (hWnd == NULL || s == NULL || name == NULL) - { - return false; - } - - Zero(&a, sizeof(a)); - Zero(&t, sizeof(t)); - - StrCpy(t.HubName, sizeof(t.HubName), s->HubName); - t.ClientOption = ZeroMalloc(sizeof(CLIENT_OPTION)); - UniStrCpy(t.ClientOption->AccountName, sizeof(t.ClientOption->AccountName), name); - - if (CALL(hWnd, ScGetLink(s->Rpc, &t)) == false) - { - return false; - } - - a.Hub = s; - a.EditMode = true; - a.LinkMode = true; - a.ClientOption = ZeroMalloc(sizeof(CLIENT_OPTION)); - a.OnlineFlag = t.Online; - Copy(a.ClientOption, t.ClientOption, sizeof(CLIENT_OPTION)); - a.ClientAuth = CopyClientAuth(t.ClientAuth); - Copy(&a.Policy, &t.Policy, sizeof(POLICY)); - a.CheckServerCert = t.CheckServerCert; - a.ServerCert = CloneX(t.ServerCert); - a.HideTrustCert = GetCapsBool(s->p->CapsList, "b_support_config_hub"); - FreeRpcCreateLink(&t); - - a.PolicyVer = s->p->PolicyVer; - - if (GetCapsBool(s->p->CapsList, "b_support_cascade_client_cert") == false) - { - a.HideClientCertAuth = true; - } - - a.HideSecureAuth = true; - - ret = CmEditAccountDlg(hWnd, &a); - - FreeX(a.ServerCert); - Free(a.ClientOption); - CiFreeClientAuth(a.ClientAuth); - - return ret; -} - -// Create a new link -bool SmLinkCreate(HWND hWnd, SM_HUB *s) -{ - return SmLinkCreateEx(hWnd, s, false); -} -bool SmLinkCreateEx(HWND hWnd, SM_HUB *s, bool connectNow) -{ - CM_ACCOUNT a; - bool ret = false;; - // Validate arguments - if (hWnd == NULL || s == NULL) - { - return false; - } - - Zero(&a, sizeof(a)); - - a.Hub = s; - a.EditMode = false; - a.LinkMode = true; - a.ClientOption = ZeroMalloc(sizeof(CLIENT_OPTION)); - a.OnlineFlag = false; - a.ClientAuth = ZeroMalloc(sizeof(CLIENT_AUTH)); - a.ClientAuth->AuthType = CLIENT_AUTHTYPE_PASSWORD; - Copy(&a.Policy, GetDefaultPolicy(), sizeof(POLICY)); - a.ClientOption->Port = 443; // Default port number - a.ClientOption->NumRetry = INFINITE; - a.ClientOption->RetryInterval = 15; - a.ClientOption->MaxConnection = 8; - a.ClientOption->UseEncrypt = true; - a.ClientOption->HalfConnection = false; - a.ClientOption->AdditionalConnectionInterval = 1; - a.ClientOption->RequireBridgeRoutingMode = true; - a.Link_ConnectNow = connectNow; - - a.PolicyVer = s->p->PolicyVer; - - if (GetCapsBool(s->p->CapsList, "b_support_cascade_client_cert") == false) - { - a.HideClientCertAuth = true; - } - - a.HideSecureAuth = true; - - ret = CmEditAccountDlg(hWnd, &a); - - FreeX(a.ServerCert); - Free(a.ClientOption); - CiFreeClientAuth(a.ClientAuth); - - return ret; -} - -// Initialize -void SmLinkDlgInit(HWND hWnd, SM_HUB *s) -{ - // Validate arguments - if (hWnd == NULL || s == NULL) - { - return; - } - - SetIcon(hWnd, 0, ICO_LINK); - - FormatText(hWnd, 0, s->HubName); - - LvInit(hWnd, L_LINK); - - LvInsertColumn(hWnd, L_LINK, 0, _UU("SM_LINK_COLUMN_1"), 120); - LvInsertColumn(hWnd, L_LINK, 1, _UU("SM_LINK_COLUMN_2"), 150); - LvInsertColumn(hWnd, L_LINK, 2, _UU("SM_LINK_COLUMN_3"), 180); - LvInsertColumn(hWnd, L_LINK, 3, _UU("SM_LINK_COLUMN_4"), 130); - LvInsertColumn(hWnd, L_LINK, 4, _UU("SM_LINK_COLUMN_5"), 130); - - LvSetStyle(hWnd, L_LINK, LVS_EX_GRIDLINES); - - SmLinkDlgRefresh(hWnd, s); -} - -// Update the controls -void SmLinkDlgUpdate(HWND hWnd, SM_HUB *s) -{ - bool ok = true; - bool online = false; - // Validate arguments - if (hWnd == NULL || s == NULL) - { - return; - } - - if (LvIsSelected(hWnd, L_LINK) == false || LvIsMultiMasked(hWnd, L_LINK)) - { - ok = false; - } - else - { - online = (bool)LvGetParam(hWnd, L_LINK, LvGetSelected(hWnd, L_LINK)); - } - - SetEnable(hWnd, B_EDIT, ok); - SetEnable(hWnd, B_ONLINE, ok && (online == false)); - SetEnable(hWnd, B_OFFLINE, ok && online); - SetEnable(hWnd, IDOK, ok && online); - SetEnable(hWnd, B_DELETE, ok); - SetEnable(hWnd, B_RENAME, ok); -} - -// Content update -void SmLinkDlgRefresh(HWND hWnd, SM_HUB *s) -{ - LVB *b; - RPC_ENUM_LINK t; - UINT i; - // Validate arguments - if (hWnd == NULL || s == NULL) - { - return; - } - - Zero(&t, sizeof(t)); - StrCpy(t.HubName, sizeof(t.HubName), s->HubName); - if (CALL(hWnd, ScEnumLink(s->Rpc, &t)) == false) - { - EndDialog(hWnd, false); - return; - } - - b = LvInsertStart(); - - for (i = 0;i < t.NumLink;i++) - { - RPC_ENUM_LINK_ITEM *e = &t.Links[i]; - wchar_t tmp1[MAX_SIZE]; - wchar_t tmp2[MAX_SIZE]; - wchar_t tmp3[MAX_SIZE]; - wchar_t tmp4[MAX_SIZE]; - UINT icon = ICO_CASCADE; - - GetDateTimeStrEx64(tmp1, sizeof(tmp1), SystemToLocal64(e->ConnectedTime), NULL); - StrToUni(tmp2, sizeof(tmp2), e->Hostname); - StrToUni(tmp3, sizeof(tmp3), e->HubName); - - if (e->Online == false) - { - UniStrCpy(tmp4, sizeof(tmp4), _UU("SM_LINK_STATUS_OFFLINE")); - } - else - { - if (e->Connected) - { - UniStrCpy(tmp4, sizeof(tmp4), _UU("SM_LINK_STATUS_ONLINE")); - } - else - { - if (e->LastError != 0) - { - UniFormat(tmp4, sizeof(tmp4), _UU("SM_LINK_STATUS_ERROR"), e->LastError, _E(e->LastError)); - } - else - { - UniStrCpy(tmp4, sizeof(tmp4), _UU("SM_LINK_CONNECTING")); - } - } - } - - if (e->Online == false) - { - icon = ICO_CASCADE_OFFLINE; - } - else - { - if (e->Connected == false && e->LastError != 0) - { - icon = ICO_CASCADE_ERROR; - } - else - { - icon = ICO_CASCADE; - } - } - - LvInsertAdd(b, - icon, (void *)e->Online, 5, - e->AccountName, tmp4, tmp1, tmp2, tmp3); - } - - LvInsertEnd(b, hWnd, L_LINK); - - FreeRpcEnumLink(&t); - - SmLinkDlgUpdate(hWnd, s); -} - - -// Link List dialog procedure -UINT SmLinkDlgProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param) -{ - SM_HUB *s = (SM_HUB *)param; - wchar_t *str; - NMHDR *n; - NMLVDISPINFOW *disp_info; - NMLVKEYDOWN *key; - // Validate arguments - if (hWnd == NULL) - { - return 0; - } - - str = LvGetSelectedStr(hWnd, L_LINK, 0); - - switch (msg) - { - case WM_INITDIALOG: - // Initialize - SmLinkDlgInit(hWnd, s); - - if (link_create_now) - { - if (SmLinkCreateEx(hWnd, s, true)) - { - SmLinkDlgRefresh(hWnd, s); - } - } - - SetTimer(hWnd, 1, 1000, NULL); - break; - - case WM_TIMER: - switch (wParam) - { - case 1: - if (IsEnable(hWnd, 0)) - { - KillTimer(hWnd, 1); - SmLinkDlgRefresh(hWnd, s); - SetTimer(hWnd, 1, 1000, NULL); - } - break; - } - break; - - case WM_COMMAND: - switch (wParam) - { - case B_CREATE: - // Create new - if (SmLinkCreate(hWnd, s)) - { - SmLinkDlgRefresh(hWnd, s); - } - break; - - case B_EDIT: - // Edit - if (str != NULL) - { - if (SmLinkEdit(hWnd, s, str)) - { - SmLinkDlgRefresh(hWnd, s); - } - } - break; - - case B_ONLINE: - // Online - if (str != NULL) - { - RPC_LINK t; - Zero(&t, sizeof(t)); - UniStrCpy(t.AccountName, sizeof(t.AccountName), str); - StrCpy(t.HubName, sizeof(t.HubName), s->HubName); - - if (CALL(hWnd, ScSetLinkOnline(s->Rpc, &t))) - { - SmLinkDlgRefresh(hWnd, s); - } - } - break; - - case B_OFFLINE: - // Offline - if (str != NULL) - { - RPC_LINK t; - Zero(&t, sizeof(t)); - UniStrCpy(t.AccountName, sizeof(t.AccountName), str); - StrCpy(t.HubName, sizeof(t.HubName), s->HubName); - - if (MsgBoxEx(hWnd, MB_ICONEXCLAMATION | MB_YESNO | MB_DEFBUTTON2, - _UU("SM_LINK_OFFLINE_MSG"), t.AccountName) == IDYES) - { - if (CALL(hWnd, ScSetLinkOffline(s->Rpc, &t))) - { - SmLinkDlgRefresh(hWnd, s); - } - } - } - break; - - case IDOK: - // Status - if (str != NULL) - { - wchar_t tmp[MAX_SIZE]; - SM_LINK t; - Zero(&t, sizeof(t)); - t.Hub = s; - t.AccountName = str; - UniFormat(tmp, sizeof(tmp), _UU("SM_LINK_STATUS_CAPTION"), str); - SmStatusDlg(hWnd, s->p, &t, true, true, tmp, - ICO_CASCADE, NULL, SmRefreshLinkStatus); - } - break; - - case B_DELETE: - // Delete - if (str != NULL) - { - RPC_LINK t; - Zero(&t, sizeof(t)); - UniStrCpy(t.AccountName, sizeof(t.AccountName), str); - StrCpy(t.HubName, sizeof(t.HubName), s->HubName); - - if (MsgBoxEx(hWnd, MB_ICONEXCLAMATION | MB_YESNO | MB_DEFBUTTON2, - _UU("SM_LINK_DELETE_MSG"), t.AccountName) == IDYES) - { - if (CALL(hWnd, ScDeleteLink(s->Rpc, &t))) - { - SmLinkDlgRefresh(hWnd, s); - } - } - } - break; - - case B_REFRESH: - // Update - SmLinkDlgRefresh(hWnd, s); - break; - - case IDCANCEL: - // Cancel button - Close(hWnd); - break; - - case B_RENAME: - // Change the name - Focus(hWnd, L_LINK); - LvRename(hWnd, L_LINK, LvGetSelected(hWnd, L_LINK)); - break; - } - break; - - case WM_NOTIFY: - n = (NMHDR *)lParam; - switch (n->idFrom) - { - case L_LINK: - switch (n->code) - { - case LVN_ITEMCHANGED: - // Change the selection state - SmLinkDlgUpdate(hWnd, s); - break; - - case LVN_ENDLABELEDITW: - // Change the name - disp_info = (NMLVDISPINFOW *)n; - if (disp_info->item.pszText != NULL) - { - wchar_t *new_name = disp_info->item.pszText; - wchar_t *old_name = LvGetStr(hWnd, L_LINK, disp_info->item.iItem, 0); - - if (old_name != NULL) - { - if (UniStrCmp(new_name, old_name) != 0 && UniIsEmptyStr(new_name) == false) - { - RPC_RENAME_LINK t; - Zero(&t, sizeof(t)); - StrCpy(t.HubName, sizeof(t.HubName), s->HubName); - UniStrCpy(t.OldAccountName, sizeof(t.OldAccountName), old_name); - UniStrCpy(t.NewAccountName, sizeof(t.NewAccountName), new_name); - if (CALL(hWnd, ScRenameLink(s->Rpc, &t))) - { - SmLinkDlgRefresh(hWnd, s); - } - } - - Free(old_name); - } - } - break; - - case LVN_KEYDOWN: - // Keypress - key = (NMLVKEYDOWN *)n; - if (key != NULL) - { - bool ctrl, alt; - UINT code = key->wVKey; - ctrl = (GetKeyState(VK_CONTROL) & 0x8000) == 0 ? false : true; - alt = (GetKeyState(VK_MENU) & 0x8000) == 0 ? false : true; - - if (code == VK_F2) - { - Command(hWnd, B_RENAME); - } - } - break; - } - break; - } - break; - - case WM_CLOSE: - EndDialog(hWnd, false); - break; - } - - Free(str); - - LvStandardHandler(hWnd, msg, wParam, lParam, L_LINK); - - return 0; -} - -// Link List dialog -void SmLinkDlg(HWND hWnd, SM_HUB *s) -{ - SmLinkDlgEx(hWnd, s, false); -} -void SmLinkDlgEx(HWND hWnd, SM_HUB *s, bool createNow) -{ - // Validate arguments - if (hWnd == NULL || s == NULL) - { - return; - } - - link_create_now = createNow; - - Dialog(hWnd, D_SM_LINK, SmLinkDlgProc, s); -} - -// Initialize -void SmRadiusDlgInit(HWND hWnd, SM_HUB *s) -{ - RPC_RADIUS t; - // Validate arguments - if (hWnd == NULL || s == NULL) - { - return; - } - - SetIcon(hWnd, 0, ICO_TOWER); - - FormatText(hWnd, S_TITLE, s->HubName); - FormatText(hWnd, S_RADIUS_7, RADIUS_RETRY_INTERVAL, RADIUS_RETRY_TIMEOUT); - - Zero(&t, sizeof(t)); - StrCpy(t.HubName, sizeof(t.HubName), s->HubName); - - if (CALL(hWnd, ScGetHubRadius(s->Rpc, &t)) == false) - { - EndDialog(hWnd, false); - return; - } - - Check(hWnd, R_USE_RADIUS, StrLen(t.RadiusServerName) != 0); - - if (StrLen(t.RadiusServerName) != 0) - { - SetTextA(hWnd, E_HOSTNAME, t.RadiusServerName); - SetIntEx(hWnd, E_PORT, t.RadiusPort); - SetTextA(hWnd, E_SECRET1, t.RadiusSecret); - SetTextA(hWnd, E_SECRET2, t.RadiusSecret); - SetIntEx(hWnd, E_RADIUS_RETRY_INTERVAL, t.RadiusRetryInterval); - FocusEx(hWnd, E_HOSTNAME); - } - else - { - SetInt(hWnd, E_PORT, RADIUS_DEFAULT_PORT); - SetInt(hWnd, E_RADIUS_RETRY_INTERVAL, RADIUS_RETRY_INTERVAL); - } - - SmRadiusDlgUpdate(hWnd, s); -} - -// Update the control -void SmRadiusDlgUpdate(HWND hWnd, SM_HUB *s) -{ - bool ok = true; - bool b, b1; - char tmp1[MAX_SIZE]; - char tmp2[MAX_SIZE]; - // Validate arguments - if (hWnd == NULL || s == NULL) - { - return; - } - - b1 = GetCapsBool(s->p->CapsList, "b_support_radius_retry_interval_and_several_servers"); - if(b1 == false) - { - Hide(hWnd, S_RADIUS_7); - Hide(hWnd, S_RADIUS_8); - Hide(hWnd, S_RADIUS_9); - Hide(hWnd, E_RADIUS_RETRY_INTERVAL); - } - - b = IsChecked(hWnd, R_USE_RADIUS); - - SetEnable(hWnd, S_RADIUS_1, b); - SetEnable(hWnd, S_RADIUS_2, b); - SetEnable(hWnd, S_RADIUS_3, b); - SetEnable(hWnd, S_RADIUS3, b); - SetEnable(hWnd, S_RADIUS_4, b); - SetEnable(hWnd, S_RADIUS_5, b); - SetEnable(hWnd, S_RADIUS_6, b); - SetEnable(hWnd, S_RADIUS_7, b); - SetEnable(hWnd, S_RADIUS_8, b); - SetEnable(hWnd, S_RADIUS_9, b); - SetEnable(hWnd, E_HOSTNAME, b); - SetEnable(hWnd, E_PORT, b); - SetEnable(hWnd, E_SECRET1, b); - SetEnable(hWnd, E_SECRET2, b); - SetEnable(hWnd, E_RADIUS_RETRY_INTERVAL, b); - - if (b) - { - UINT p, m; - GetTxtA(hWnd, E_SECRET1, tmp1, sizeof(tmp1)); - GetTxtA(hWnd, E_SECRET2, tmp2, sizeof(tmp2)); - - if (StrCmp(tmp1, tmp2) != 0) - { - ok = false; - } - - if (IsEmpty(hWnd, E_HOSTNAME)) - { - ok = false; - } - - p = GetInt(hWnd, E_PORT); - - if (p == 0 || p >= 65536) - { - ok = false; - } - - m = GetInt(hWnd, E_RADIUS_RETRY_INTERVAL); - if (m > RADIUS_RETRY_TIMEOUT || m < RADIUS_RETRY_INTERVAL) - { - ok = false; - } - } - - SetEnable(hWnd, IDOK, ok); -} - -// [OK] button -void SmRadiusDlgOnOk(HWND hWnd, SM_HUB *s) -{ - RPC_RADIUS t; - // Validate arguments - if (hWnd == NULL || s == NULL) - { - return; - } - - Zero(&t, sizeof(t)); - StrCpy(t.HubName, sizeof(t.HubName), s->HubName); - - if (IsChecked(hWnd, R_USE_RADIUS)) - { - GetTxtA(hWnd, E_HOSTNAME, t.RadiusServerName, sizeof(t.RadiusServerName)); - t.RadiusPort = GetInt(hWnd, E_PORT); - GetTxtA(hWnd, E_SECRET1,t.RadiusSecret, sizeof(t.RadiusSecret)); - t.RadiusRetryInterval = GetInt(hWnd, E_RADIUS_RETRY_INTERVAL); - } - - if (CALL(hWnd, ScSetHubRadius(s->Rpc, &t)) == false) - { - return; - } - - EndDialog(hWnd, true); -} - - -// Radius dialog procedure -UINT SmRadiusDlgProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param) -{ - SM_HUB *s = (SM_HUB *)param; - // Validate arguments - if (hWnd == NULL) - { - return 0; - } - - switch (msg) - { - case WM_INITDIALOG: - // Initialize - SmRadiusDlgInit(hWnd, s); - break; - - case WM_COMMAND: - switch (LOWORD(wParam)) - { - case E_HOSTNAME: - case E_PORT: - case E_SECRET1: - case E_SECRET2: - case E_RADIUS_RETRY_INTERVAL: - case R_USE_RADIUS: - SmRadiusDlgUpdate(hWnd, s); - break; - } - - switch (wParam) - { - case IDOK: - // [OK] button - SmRadiusDlgOnOk(hWnd, s); - break; - - case IDCANCEL: - // Cancel button - Close(hWnd); - break; - - case R_USE_RADIUS: - if (IsChecked(hWnd, R_USE_RADIUS)) - { - FocusEx(hWnd, E_HOSTNAME); - } - break; - } - break; - - case WM_CLOSE: - EndDialog(hWnd, false); - break; - } - - return 0; -} - -// Radius Setup dialog -void SmRadiusDlg(HWND hWnd, SM_HUB *s) -{ - // Validate arguments - if (hWnd == NULL || s == NULL) - { - return; - } - - Dialog(hWnd, D_SM_RADIUS, SmRadiusDlgProc, s); -} - - -// Initialize -void SmEditAccessInit(HWND hWnd, SM_EDIT_ACCESS *s) -{ - ACCESS *a; - wchar_t tmp[MAX_SIZE]; - // Validate arguments - if (hWnd == NULL || s == NULL) - { - return; - } - - SetIcon(hWnd, 0, ICO_PASS); - - GetTxt(hWnd, 0, tmp, sizeof(tmp)); - - UniStrCat(tmp, sizeof(tmp), s->Access->IsIPv6 ? L" (IPv6)" : L" (IPv4)"); - - SetText(hWnd, 0, tmp); - - s->Inited = false; - a = s->Access; - - SetText(hWnd, E_NOTE, a->Note); - - Check(hWnd, R_DISCARD, a->Discard); - Check(hWnd, R_PASS, a->Discard == false); - SetIntEx(hWnd, E_PRIORITY, a->Priority); - - if (a->IsIPv6 == false) - { - // IPv4 - if (a->SrcIpAddress == 0 && a->SrcSubnetMask == 0) - { - Check(hWnd, R_SRC_ALL, true); - } - else - { - IpSet(hWnd, E_SRC_IP, a->SrcIpAddress); - IpSet(hWnd, E_SRC_MASK, a->SrcSubnetMask); - } - - if (a->DestIpAddress == 0 && a->DestSubnetMask == 0) - { - Check(hWnd, R_DST_ALL, true); - } - else - { - IpSet(hWnd, E_DST_IP, a->DestIpAddress); - IpSet(hWnd, E_DST_MASK, a->DestSubnetMask); - } - } - else - { - // IPv6 - if (IsZeroIP6Addr(&a->SrcIpAddress6) && IsZeroIP6Addr(&a->SrcSubnetMask6)) - { - Check(hWnd, R_SRC_ALL, true); - } - else - { - char tmp[MAX_SIZE]; - - IP6AddrToStr(tmp, sizeof(tmp), &a->SrcIpAddress6); - SetTextA(hWnd, E_SRC_IP_V6, tmp); - - Mask6AddrToStrEx(tmp, sizeof(tmp), &a->SrcSubnetMask6, false); - - if (IsNum(tmp)) - { - StrCatLeft(tmp, sizeof(tmp), "/"); - } - - SetTextA(hWnd, E_SRC_MASK_V6, tmp); - } - - if (IsZeroIP6Addr(&a->DestIpAddress6) && IsZeroIP6Addr(&a->DestSubnetMask6)) - { - Check(hWnd, R_DST_ALL, true); - } - else - { - char tmp[MAX_SIZE]; - - IP6AddrToStr(tmp, sizeof(tmp), &a->DestIpAddress6); - SetTextA(hWnd, E_DST_IP_V6, tmp); - - Mask6AddrToStrEx(tmp, sizeof(tmp), &a->DestSubnetMask6, false); - - if (IsNum(tmp)) - { - StrCatLeft(tmp, sizeof(tmp), "/"); - } - - SetTextA(hWnd, E_DST_MASK_V6, tmp); - } - } - - CbSetHeight(hWnd, C_PROTOCOL, 18); - CbAddStr(hWnd, C_PROTOCOL, _UU("SM_ACCESS_PROTO_1"), 0); - CbAddStr(hWnd, C_PROTOCOL, _UU("SM_ACCESS_PROTO_2"), 0); - CbAddStr(hWnd, C_PROTOCOL, _UU("SM_ACCESS_PROTO_3"), 0); - CbAddStr(hWnd, C_PROTOCOL, _UU("SM_ACCESS_PROTO_4"), 0); - CbAddStr(hWnd, C_PROTOCOL, _UU("SM_ACCESS_PROTO_5"), 0); - CbAddStr(hWnd, C_PROTOCOL, _UU("SM_ACCESS_PROTO_6"), 0); - - switch (a->Protocol) - { - case 0: - CbSelectIndex(hWnd, C_PROTOCOL, 0); - break; - case 6: - CbSelectIndex(hWnd, C_PROTOCOL, 1); - break; - case 17: - CbSelectIndex(hWnd, C_PROTOCOL, 2); - break; - case 1: - CbSelectIndex(hWnd, C_PROTOCOL, 3); - break; - case 58: - CbSelectIndex(hWnd, C_PROTOCOL, 4); - break; - default: - CbSelectIndex(hWnd, C_PROTOCOL, 5); - break; - } - - SetIntEx(hWnd, E_IP_PROTO, a->Protocol); - - SetIntEx(hWnd, E_SRC_PORT_1, a->SrcPortStart); - SetIntEx(hWnd, E_SRC_PORT_2, a->SrcPortEnd); - SetIntEx(hWnd, E_DST_PORT_1, a->DestPortStart); - SetIntEx(hWnd, E_DST_PORT_2, a->DestPortEnd); - - SetTextA(hWnd, E_USERNAME1, a->SrcUsername); - SetTextA(hWnd, E_USERNAME2, a->DestUsername); - - if(a->CheckSrcMac != false) - { - char mac[MAX_SIZE], mask[MAX_SIZE]; - MacToStr(mac, sizeof(mac), a->SrcMacAddress); - MacToStr(mask, sizeof(mask), a->SrcMacMask); - SetTextA(hWnd, E_SRC_MAC, mac); - SetTextA(hWnd, E_SRC_MAC_MASK, mask); - } - if(a->CheckDstMac != false) - { - char mac[MAX_SIZE], mask[MAX_SIZE]; - MacToStr(mac, sizeof(mac), a->DstMacAddress); - MacToStr(mask, sizeof(mask), a->DstMacMask); - SetTextA(hWnd, E_DST_MAC, mac); - SetTextA(hWnd, E_DST_MAC_MASK, mask); - } - Check(hWnd, R_CHECK_SRC_MAC, !a->CheckSrcMac); - Check(hWnd, R_CHECK_DST_MAC, !a->CheckDstMac); - - Check(hWnd, R_CHECK_TCP_STATE, a->CheckTcpState); - if(a->CheckTcpState != false) - { - Check(hWnd, R_ESTABLISHED, a->Established); - Check(hWnd, R_UNESTABLISHED, !a->Established); - } - - if (GetCapsBool(s->Hub->p->CapsList, "b_support_acl_group") == false) - { - SetText(hWnd, S_STATIC11, _UU("D_SM_EDIT_ACCESS@STATIC11_OLD")); - SetText(hWnd, S_STATIC12, _UU("D_SM_EDIT_ACCESS@STATIC12_OLD")); - SetText(hWnd, S_STATIC15, _UU("D_SM_EDIT_ACCESS@STATIC15_OLD")); - } - - SetEnable(hWnd, R_REDIRECT, GetCapsBool(s->Hub->p->CapsList, "b_support_redirect_url_acl")); - Check(hWnd, R_REDIRECT, (IsEmptyStr(a->RedirectUrl) ? false : true)); - - s->Inited = true; - - SmEditAccessUpdate(hWnd, s); -} - -// HTTP Redirection Settings dialog -void SmRedirect(HWND hWnd, SM_EDIT_ACCESS *s) -{ - // Validate arguments - if (s == NULL) - { - return; - } - - Dialog(hWnd, D_SM_REDIRECT, SmRedirectDlg, s); -} -UINT SmRedirectDlg(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param) -{ - SM_EDIT_ACCESS *s = (SM_EDIT_ACCESS *)param; - char tmp[MAX_REDIRECT_URL_LEN + 1]; - - switch (msg) - { - case WM_INITDIALOG: - SmRedirectDlgInit(hWnd, s); - break; - - case WM_COMMAND: - switch (LOWORD(wParam)) - { - case E_URL: - SmRedirectDlgUpdate(hWnd, s); - break; - } - - switch (wParam) - { - case IDOK: - GetTxtA(hWnd, E_URL, tmp, sizeof(tmp)); - - if (StartWith(tmp, "http://") == false && - StartWith(tmp, "https://") == false) - { - MsgBox(hWnd, MB_ICONEXCLAMATION, _UU("SM_ADVANCED_REDIRECT_URL_MSG")); - - FocusEx(hWnd, E_URL); - break; - } - - StrCpy(s->Access->RedirectUrl, sizeof(s->Access->RedirectUrl), tmp); - - EndDialog(hWnd, 1); - break; - - case IDCANCEL: - Close(hWnd); - break; - - case B_HINT: - OnceMsg(hWnd, _UU("SM_ADVANCED_REDIRECT_URL_HINT_TITLE"), - _UU("SM_ADVANCED_REDIRECT_URL_HINT"), false, ICO_INTERNET); - break; - } - break; - - case WM_CLOSE: - EndDialog(hWnd, 0); - break; - } - - return 0; -} -void SmRedirectDlgInit(HWND hWnd, SM_EDIT_ACCESS *s) -{ - ACCESS *a; - // Validate arguments - if (hWnd == NULL || s == NULL) - { - return; - } - - a = s->Access; - - DlgFont(hWnd, S_BOLD, 0, true); - DlgFont(hWnd, S_BOLD2, 0, true); - - SetFont(hWnd, E_SAMPLE1, GetFont("Verdana", 0, false, false, false, false)); - SetFont(hWnd, E_SAMPLE2, GetFont("Verdana", 0, false, false, false, false)); - SetFont(hWnd, E_URL, GetFont("Verdana", 10, false, false, false, false)); - - SetTextA(hWnd, E_SAMPLE1, "http://www.google.com/about/"); - SetTextA(hWnd, E_SAMPLE2, "http://www.google.com/search?q=|secret"); - - SetTextA(hWnd, E_URL, s->Access->RedirectUrl); - - if (IsEmpty(hWnd, E_URL)) - { - SetTextA(hWnd, E_URL, "http://"); - - SetCursorOnRight(hWnd, E_URL); - Focus(hWnd, E_URL); - } - else - { - FocusEx(hWnd, E_URL); - } - - SmRedirectDlgUpdate(hWnd, s); -} -void SmRedirectDlgUpdate(HWND hWnd, SM_EDIT_ACCESS *s) -{ - char tmp[MAX_REDIRECT_URL_LEN + 1]; - bool ok = true; - // Validate arguments - if (hWnd == NULL || s == NULL) - { - return; - } - - GetTxtA(hWnd, E_URL, tmp, sizeof(tmp)); - - if (IsEmptyStr(tmp)) - { - ok = false; - } - - SetEnable(hWnd, IDOK, ok); -} - -// Update the control -void SmEditAccessUpdate(HWND hWnd, SM_EDIT_ACCESS *s) -{ - bool ok = true; - bool tcp; - bool b; - bool check_srcmac, check_dstmac, support_mac; - bool check_state, support_check_state; - char srcmac[MAX_SIZE], srcmac_mask[MAX_SIZE], dstmac[MAX_SIZE], dstmac_mask[MAX_SIZE]; - char tmp[MAX_SIZE]; - wchar_t unitmp[MAX_SIZE]; - ACCESS *a; - // Validate arguments - if (hWnd == NULL || s == NULL) - { - return; - } - - if (s->Inited == false) - { - return; - } - - a = s->Access; - - GetTxt(hWnd, E_NOTE, a->Note, sizeof(a->Note)); - - a->Discard = IsChecked(hWnd, R_DISCARD); - - a->Priority = GetInt(hWnd, E_PRIORITY); - if (a->Priority == 0) - { - ok = false; - } - - - b = IsChecked(hWnd, R_SRC_ALL) ? false : true; - if (b == false) - { - if (a->IsIPv6 == false) - { - a->SrcIpAddress = 0; - a->SrcSubnetMask = 0; - } - else - { - Zero(&a->SrcIpAddress6, sizeof(IPV6_ADDR)); - Zero(&a->SrcSubnetMask6, sizeof(IPV6_ADDR)); - } - } - else - { - if (a->IsIPv6 == false) - { - if (IpIsFilled(hWnd, E_SRC_IP) == false || IpIsFilled(hWnd, E_SRC_MASK) == false) - { - ok = false; - } - else - { - a->SrcIpAddress = IpGet(hWnd, E_SRC_IP); - a->SrcSubnetMask = IpGet(hWnd, E_SRC_MASK); - } - } - else - { - char tmp1[MAX_SIZE]; - char tmp2[MAX_SIZE]; - - GetTxtA(hWnd, E_SRC_IP_V6, tmp1, sizeof(tmp1)); - GetTxtA(hWnd, E_SRC_MASK_V6, tmp2, sizeof(tmp2)); - - if (StrToIP6Addr(&a->SrcIpAddress6, tmp1) == false || - StrToMask6Addr(&a->SrcSubnetMask6, tmp2) == false) - { - ok = false; - } - } - } - SetEnable(hWnd, S_SRC_IP_1, b); - SetEnable(hWnd, S_SRC_IP_2, b); - SetEnable(hWnd, S_SRC_IP_3, b); - SetEnable(hWnd, E_SRC_IP, b); - SetEnable(hWnd, E_SRC_MASK, b); - SetEnable(hWnd, E_SRC_IP_V6, b); - SetEnable(hWnd, E_SRC_MASK_V6, b); - - b = IsChecked(hWnd, R_DST_ALL) ? false : true; - if (b == false) - { - if (a->IsIPv6 == false) - { - a->DestIpAddress = 0; - a->DestSubnetMask = 0; - } - else - { - Zero(&a->DestIpAddress6, sizeof(IPV6_ADDR)); - Zero(&a->DestSubnetMask6, sizeof(IPV6_ADDR)); - } - } - else - { - if (a->IsIPv6 == false) - { - if (IpIsFilled(hWnd, E_DST_IP) == false || IpIsFilled(hWnd, E_DST_MASK) == false) - { - ok = false; - } - else - { - a->DestIpAddress = IpGet(hWnd, E_DST_IP); - a->DestSubnetMask = IpGet(hWnd, E_DST_MASK); - } - } - else - { - char tmp1[MAX_SIZE]; - char tmp2[MAX_SIZE]; - - GetTxtA(hWnd, E_DST_IP_V6, tmp1, sizeof(tmp1)); - GetTxtA(hWnd, E_DST_MASK_V6, tmp2, sizeof(tmp2)); - - if (StrToIP6Addr(&a->DestIpAddress6, tmp1) == false || - StrToMask6Addr(&a->DestSubnetMask6, tmp2) == false) - { - ok = false; - } - } - } - SetEnable(hWnd, S_IP_DST_1, b); - SetEnable(hWnd, S_IP_DST_2, b); - SetEnable(hWnd, S_IP_DST_3, b); - SetEnable(hWnd, E_DST_IP, b); - SetEnable(hWnd, E_DST_MASK, b); - SetEnable(hWnd, E_DST_IP_V6, b); - SetEnable(hWnd, E_DST_MASK_V6, b); - - a->Protocol = GetInt(hWnd, C_PROTOCOL); - - GetTxtA(hWnd, C_PROTOCOL, tmp, sizeof(tmp)); - GetTxt(hWnd, C_PROTOCOL, unitmp, sizeof(unitmp)); - - if (UniStrCmpi(unitmp, _UU("SM_ACCESS_PROTO_6")) == 0 || StrCmpi(tmp, _SS("SM_ACCESS_PROTO_6")) == 0) - { - a->Protocol = GetInt(hWnd, E_IP_PROTO); - - if (IsEmpty(hWnd, E_IP_PROTO)) - { - ok = false; - } - - Enable(hWnd, S_PROTOID); - Enable(hWnd, E_IP_PROTO); - } - else - { - Disable(hWnd, E_IP_PROTO); - Disable(hWnd, S_PROTOID); - } - - tcp = false; - if (a->Protocol == 17 || a->Protocol == 6) - { - tcp = true; - } - - SetEnable(hWnd, S_TCP_1, tcp); - SetEnable(hWnd, S_TCP_2, tcp); - SetEnable(hWnd, S_TCP_3, tcp); - SetEnable(hWnd, S_TCP_4, tcp); - SetEnable(hWnd, S_TCP_5, tcp); - SetEnable(hWnd, S_TCP_6, tcp); - SetEnable(hWnd, S_TCP_7, tcp); - SetEnable(hWnd, E_SRC_PORT_1, tcp); - SetEnable(hWnd, E_SRC_PORT_2, tcp); - SetEnable(hWnd, E_DST_PORT_1, tcp); - SetEnable(hWnd, E_DST_PORT_2, tcp); - - if (tcp == false) - { - a->SrcPortEnd = a->SrcPortStart = a->DestPortEnd = a->DestPortStart = 0; - } - else - { - a->SrcPortStart = GetInt(hWnd, E_SRC_PORT_1); - a->SrcPortEnd = GetInt(hWnd, E_SRC_PORT_2); - a->DestPortStart = GetInt(hWnd, E_DST_PORT_1); - a->DestPortEnd = GetInt(hWnd, E_DST_PORT_2); - - if (a->SrcPortStart != 0) - { - if (a->SrcPortEnd != 0) - { - if (a->SrcPortStart > a->SrcPortEnd) - { - ok = false; - } - } - } - else - { - if (a->SrcPortEnd != 0) - { - ok = false; - } - } - - if (a->DestPortStart != 0) - { - if (a->DestPortEnd != 0) - { - if (a->DestPortStart > a->DestPortEnd) - { - ok = false; - } - } - } - else - { - if (a->DestPortEnd != 0) - { - ok = false; - } - } - - if (a->DestPortEnd < a->DestPortStart) - { - a->DestPortEnd = a->DestPortStart; - } - - if (a->SrcPortEnd < a->SrcPortStart) - { - a->SrcPortEnd = a->SrcPortStart; - } - } - - a->SrcUsernameHash = a->DestUsernameHash = 0; - GetTxtA(hWnd, E_USERNAME1, a->SrcUsername, sizeof(a->SrcUsername)); - GetTxtA(hWnd, E_USERNAME2, a->DestUsername, sizeof(a->DestUsername)); - - if (StartWith(a->SrcUsername, ACCESS_LIST_INCLUDED_PREFIX) == false && - StartWith(a->SrcUsername, ACCESS_LIST_EXCLUDED_PREFIX) == false) - { - MakeSimpleUsernameRemoveNtDomain(a->SrcUsername, sizeof(a->SrcUsername), a->SrcUsername); - } - - if (StartWith(a->DestUsername, ACCESS_LIST_INCLUDED_PREFIX) == false && - StartWith(a->DestUsername, ACCESS_LIST_EXCLUDED_PREFIX) == false) - { - MakeSimpleUsernameRemoveNtDomain(a->DestUsername, sizeof(a->DestUsername), a->DestUsername); - } - - Trim(a->SrcUsername); - /* - if (StrLen(a->SrcUsername) != 0) - { - if (IsUserName(a->SrcUsername) == false) - { - ok = false; - } - }*/ - - Trim(a->DestUsername); - /* - if (StrLen(a->DestUsername) != 0) - { - if (IsUserName(a->DestUsername) == false) - { - ok = false; - } - }*/ - - support_mac = GetCapsBool(s->Hub->p->CapsList, "b_support_check_mac"); - - // Set the source MAC address - check_srcmac = a->CheckSrcMac = support_mac && (IsChecked(hWnd, R_CHECK_SRC_MAC) ? false : true); - if(check_srcmac == false) - { - Zero(a->SrcMacAddress, sizeof(a->SrcMacAddress)); - Zero(a->SrcMacMask, sizeof(a->SrcMacMask)); - } - else - { - GetTxtA(hWnd, E_SRC_MAC, srcmac, sizeof(srcmac)); - GetTxtA(hWnd, E_SRC_MAC_MASK, srcmac_mask, sizeof(srcmac_mask)); - Trim(srcmac); - Trim(srcmac_mask); - if(StrLen(srcmac) != 0 && StrLen(srcmac_mask) != 0) - { - UCHAR mac[6], mask[6]; - if(StrToMac(mac, srcmac) && StrToMac(mask, srcmac_mask)) - { - Copy(a->SrcMacAddress, mac, 6); - Copy(a->SrcMacMask, mask, 6); - } - else - { - ok = false; - } - } - else - { - ok = false; - } - } - SetEnable(hWnd, S_CHECK_SRC_MAC, support_mac); - SetEnable(hWnd, R_CHECK_SRC_MAC, support_mac); - SetEnable(hWnd, S_SRC_MAC, check_srcmac); - SetEnable(hWnd, S_SRC_MAC_MASK, check_srcmac); - SetEnable(hWnd, E_SRC_MAC, check_srcmac); - SetEnable(hWnd, E_SRC_MAC_MASK, check_srcmac); - - // Set the destination MAC address - check_dstmac = a->CheckDstMac = support_mac && (IsChecked(hWnd, R_CHECK_DST_MAC) ? false : true); - if(check_dstmac == false) - { - Zero(a->DstMacAddress, sizeof(a->DstMacAddress)); - Zero(a->DstMacMask, sizeof(a->DstMacMask)); - } - else - { - GetTxtA(hWnd, E_DST_MAC, dstmac, sizeof(dstmac)); - GetTxtA(hWnd, E_DST_MAC_MASK, dstmac_mask, sizeof(dstmac_mask)); - Trim(dstmac); - Trim(dstmac_mask); - if(StrLen(dstmac) != 0 && StrLen(dstmac_mask) != 0) - { - UCHAR mac[6], mask[6]; - if(StrToMac(mac, dstmac) && StrToMac(mask, dstmac_mask)) - { - Copy(a->DstMacAddress, mac, 6); - Copy(a->DstMacMask, mask, 6); - } - else - { - ok = false; - } - } - else - { - ok = false; - } - } - SetEnable(hWnd, S_CHECK_DST_MAC, support_mac); - SetEnable(hWnd, R_CHECK_DST_MAC, support_mac); - SetEnable(hWnd, S_DST_MAC, check_dstmac); - SetEnable(hWnd, S_DST_MAC_MASK, check_dstmac); - SetEnable(hWnd, E_DST_MAC, check_dstmac); - SetEnable(hWnd, E_DST_MAC_MASK, check_dstmac); - - SetEnable(hWnd, S_MAC_NOTE, check_srcmac || check_dstmac); - - // Status of the TCP connection - support_check_state = GetCapsBool(s->Hub->p->CapsList, "b_support_check_tcp_state") && a->Protocol == 6; - SetEnable(hWnd, R_CHECK_TCP_STATE, support_check_state); - check_state = a->CheckTcpState = support_check_state && IsChecked(hWnd, R_CHECK_TCP_STATE); - - a->Established = IsChecked(hWnd, R_ESTABLISHED) && check_state; - SetEnable(hWnd, R_ESTABLISHED, check_state); - SetEnable(hWnd, R_UNESTABLISHED, check_state); - if(check_state != false && IsChecked(hWnd, R_ESTABLISHED) == false && IsChecked(hWnd, R_UNESTABLISHED) == false) - { - ok = false; - } - - // Settings button such as delay - SetEnable(hWnd, B_SIMULATION, a->Discard == false && GetCapsBool(s->Hub->p->CapsList, "b_support_ex_acl")); - - // HTTP redirection settings button - SetEnable(hWnd, B_REDIRECT, IsChecked(hWnd, R_REDIRECT) && (a->Discard == false) && GetCapsBool(s->Hub->p->CapsList, "b_support_redirect_url_acl")); - SetEnable(hWnd, R_REDIRECT, (a->Discard == false) && GetCapsBool(s->Hub->p->CapsList, "b_support_redirect_url_acl")); - - if (IsChecked(hWnd, R_REDIRECT) && (a->Discard == false) && GetCapsBool(s->Hub->p->CapsList, "b_support_redirect_url_acl")) - { - if (IsEmptyStr(a->RedirectUrl)) - { - ok = false; - } - } - - SetEnable(hWnd, IDOK, ok); -} - -// OK Click -void SmEditAccessOnOk(HWND hWnd, SM_EDIT_ACCESS *s) -{ - ACCESS *a; - // Validate arguments - if (hWnd == NULL || s == NULL) - { - return; - } - - a = s->Access; - - SmEditAccessUpdate(hWnd, s); - - if (IsChecked(hWnd, R_REDIRECT) == false || (a->Discard) || GetCapsBool(s->Hub->p->CapsList, "b_support_redirect_url_acl") == false) - { - // Disable the HTTP redirection - ClearStr(a->RedirectUrl, sizeof(a->RedirectUrl)); - } - - EndDialog(hWnd, true); -} - - -// Access list editing dialog -UINT SmEditAccessDlg(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param) -{ - SM_EDIT_ACCESS *s = (SM_EDIT_ACCESS *)param; - UINT ico; - ACCESS *a; - char tmp[MAX_SIZE]; - // Validate arguments - if (hWnd == NULL) - { - return 0; - } - - switch (msg) - { - case WM_INITDIALOG: - // Initialize - SmEditAccessInit(hWnd, s); - - goto REFRESH_ICON; - - case WM_COMMAND: - switch (LOWORD(wParam)) - { - case R_PASS: - case R_DISCARD: - case E_PRIORITY: - case R_SRC_ALL: - case E_SRC_IP: - case E_SRC_MASK: - case R_DST_ALL: - case E_DST_MASK: - case E_SRC_IP_V6: - case E_SRC_MASK_V6: - case E_DST_MASK_V6: - case E_DST_IP_V6: - case C_PROTOCOL: - case E_SRC_PORT_1: - case E_SRC_PORT_2: - case E_DST_PORT_1: - case E_DST_PORT_2: - case E_USERNAME1: - case E_USERNAME2: - case E_IP_PROTO: - case R_CHECK_SRC_MAC: - case E_SRC_MAC: - case E_SRC_MAC_MASK: - case R_CHECK_DST_MAC: - case E_DST_MAC: - case E_DST_MAC_MASK: - case R_CHECK_TCP_STATE: - case R_ESTABLISHED: - case R_UNESTABLISHED: - case R_REDIRECT: - SmEditAccessUpdate(hWnd, s); - break; - } - - switch (wParam) - { - case B_USER1: - if (GetTxtA(hWnd, E_USERNAME1, tmp, sizeof(tmp))) - { - char *ret = SmSelectUserDlgEx(hWnd, s->Hub, tmp, GetCapsBool(s->Hub->p->CapsList, "b_support_acl_group")); - if (ret == NULL) - { - SetTextA(hWnd, E_USERNAME1, ""); - } - else - { - SetTextA(hWnd, E_USERNAME1, ret); - Free(ret); - } - FocusEx(hWnd, E_USERNAME1); - } - break; - - case B_USER2: - if (GetTxtA(hWnd, E_USERNAME2, tmp, sizeof(tmp))) - { - char *ret = SmSelectUserDlgEx(hWnd, s->Hub, tmp, GetCapsBool(s->Hub->p->CapsList, "b_support_acl_group")); - if (ret == NULL) - { - SetTextA(hWnd, E_USERNAME2, ""); - } - else - { - SetTextA(hWnd, E_USERNAME2, ret); - Free(ret); - } - FocusEx(hWnd, E_USERNAME2); - } - break; - - case IDOK: - // [OK] button - SmEditAccessOnOk(hWnd, s); - break; - - case IDCANCEL: - // Cancel button - Close(hWnd); - break; - - case R_SRC_ALL: - if (IsChecked(hWnd, R_SRC_ALL) == false) - { - if (s->Access->IsIPv6) - { - FocusEx(hWnd, E_SRC_IP_V6); - } - else - { - Focus(hWnd, E_SRC_IP); - } - } - break; - - case R_DST_ALL: - if (IsChecked(hWnd, R_DST_ALL) == false) - { - if (s->Access->IsIPv6) - { - FocusEx(hWnd, E_DST_IP_V6); - } - else - { - Focus(hWnd, E_DST_IP); - } - } - break; - case R_CHECK_SRC_MAC: - if(IsChecked(hWnd, R_CHECK_SRC_MAC) == false) - { - Focus(hWnd, E_SRC_MAC); - } - break; - case R_CHECK_DST_MAC: - if(IsChecked(hWnd, R_CHECK_DST_MAC) == false) - { - Focus(hWnd, E_DST_MAC); - } - break; - - case R_PASS: - case R_DISCARD: -REFRESH_ICON: - a = s->Access; - if (a->Discard == false && a->Active == false) - { - ico = ICO_PASS_DISABLE; - } - else if (a->Discard == false && a->Active) - { - ico = ICO_PASS; - } - else if (a->Discard && a->Active == false) - { - ico = ICO_DISCARD_DISABLE; - } - else - { - ico = ICO_DISCARD; - } - - SetIcon(hWnd, S_ICON, ico); - break; - - case B_SIMULATION: - // Simulation - Dialog(hWnd, D_SM_SIMULATION, SmSimulationDlg, s); - break; - - case B_REDIRECT: - // Set the URL to redirect to - SmRedirect(hWnd, s); - SmEditAccessUpdate(hWnd, s); - break; - } - break; - - case WM_CLOSE: - EndDialog(hWnd, false); - break; - } - - return 0; -} - -// Delay, jitter, packet-loss dialog -UINT SmSimulationDlg(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param) -{ - SM_EDIT_ACCESS *s = (SM_EDIT_ACCESS *)param; - // Validate arguments - if (hWnd == NULL) - { - return 0; - } - - switch (msg) - { - case WM_INITDIALOG: - SmSimulationInit(hWnd, s); - break; - - case WM_COMMAND: - switch (LOWORD(wParam)) - { - case E_DELAY: - case E_JITTER: - case E_LOSS: - SmSimulationUpdate(hWnd, s); - break; - } - - switch (wParam) - { - case IDOK: - SmSimulationOnOk(hWnd, s); - break; - - case IDCANCEL: - Close(hWnd); - break; - - case C_DELAY: - SmSimulationUpdate(hWnd, s); - if (IsChecked(hWnd, C_DELAY)) - { - FocusEx(hWnd, E_DELAY); - } - break; - - case C_JITTER: - SmSimulationUpdate(hWnd, s); - if (IsChecked(hWnd, C_JITTER)) - { - FocusEx(hWnd, E_JITTER); - } - break; - - case C_LOSS: - SmSimulationUpdate(hWnd, s); - if (IsChecked(hWnd, C_LOSS)) - { - FocusEx(hWnd, E_LOSS); - } - break; - } - break; - - case WM_CLOSE: - EndDialog(hWnd, false); - break; - } - - return 0; -} - -// Update of delay, jitter, packet-loss dialog -void SmSimulationUpdate(HWND hWnd, SM_EDIT_ACCESS *s) -{ - bool b1, b2, b3; - bool ok = true; - // Validate arguments - if (hWnd == NULL || s == NULL) - { - return; - } - - b1 = IsChecked(hWnd, C_DELAY); - b2 = IsChecked(hWnd, C_JITTER); - b3 = IsChecked(hWnd, C_LOSS); - - SetEnable(hWnd, S_DELAY, b1); - SetEnable(hWnd, S_DELAY2, b1); - SetEnable(hWnd, E_DELAY, b1); - - SetEnable(hWnd, C_JITTER, b1); - - if (b1 == false) - { - b2 = false; - } - - SetEnable(hWnd, S_JITTER, b2); - SetEnable(hWnd, S_JITTER2, b2); - SetEnable(hWnd, E_JITTER, b2); - - SetEnable(hWnd, S_LOSS, b3); - SetEnable(hWnd, S_LOSS2, b3); - SetEnable(hWnd, E_LOSS, b3); - - if (b1) - { - UINT i = GetInt(hWnd, E_DELAY); - if (i == 0 || i > HUB_ACCESSLIST_DELAY_MAX) - { - ok = false; - } - } - - if (b2) - { - UINT i = GetInt(hWnd, E_JITTER); - if (i == 0 || i > HUB_ACCESSLIST_JITTER_MAX) - { - ok = false; - } - } - - if (b3) - { - UINT i = GetInt(hWnd, E_LOSS); - if (i == 0 || i > HUB_ACCESSLIST_LOSS_MAX) - { - ok = false; - } - } - - SetEnable(hWnd, IDOK, ok); -} - -// Initialization of delay, jitter, packet-loss dialog -void SmSimulationInit(HWND hWnd, SM_EDIT_ACCESS *s) -{ - ACCESS *a; - // Validate arguments - if (hWnd == NULL || s == NULL) - { - return; - } - - a = s->Access; - - Check(hWnd, C_DELAY, a->Delay != 0); - Check(hWnd, C_JITTER, a->Jitter != 0); - Check(hWnd, C_LOSS, a->Loss != 0); - - SetIntEx(hWnd, E_DELAY, a->Delay); - if (a->Delay != 0) - { - SetIntEx(hWnd, E_JITTER, a->Jitter); - } - SetIntEx(hWnd, E_LOSS, a->Loss); - - SmSimulationUpdate(hWnd, s); - - if (a->Delay != 0) - { - FocusEx(hWnd, E_DELAY); - } - else - { - Focus(hWnd, C_DELAY); - } -} - -// Saving of delay, jitter, packet-loss dialog -void SmSimulationOnOk(HWND hWnd, SM_EDIT_ACCESS *s) -{ - ACCESS *a; - // Validate arguments - if (hWnd == NULL || s == NULL) - { - return; - } - - a = s->Access; - - a->Jitter = a->Loss = a->Delay = 0; - - if (IsChecked(hWnd, C_DELAY)) - { - a->Delay = GetInt(hWnd, E_DELAY); - } - - if (IsChecked(hWnd, C_JITTER)) - { - a->Jitter = GetInt(hWnd, E_JITTER); - } - - if (IsChecked(hWnd, C_LOSS)) - { - a->Loss = GetInt(hWnd, E_LOSS); - } - - EndDialog(hWnd, 1); -} - -// Edit the access list -bool SmEditAccess(HWND hWnd, SM_ACCESS_LIST *s, ACCESS *a) -{ - SM_EDIT_ACCESS edit; - bool ret; - UINT i; - // Validate arguments - if (hWnd == NULL || s == NULL) - { - return false; - } - - Zero(&edit, sizeof(edit)); - edit.AccessList = s; - edit.EditMode = true; - edit.Access = ZeroMalloc(sizeof(ACCESS)); - edit.Hub = s->Hub; - Copy(edit.Access, a, sizeof(ACCESS)); - - if (edit.Access->IsIPv6 == false) - { - ret = Dialog(hWnd, D_SM_EDIT_ACCESS, SmEditAccessDlg, &edit); - } - else - { - ret = Dialog(hWnd, D_SM_EDIT_ACCESS_V6, SmEditAccessDlg, &edit); - } - - if (ret) - { - Copy(a, edit.Access, sizeof(ACCESS)); - Free(edit.Access); - Sort(s->AccessList); - - // Reassign the ID - for (i = 0;i < LIST_NUM(s->AccessList);i++) - { - ACCESS *a = LIST_DATA(s->AccessList, i); - a->Id = (i + 1); - } - } - else - { - Free(edit.Access); - } - - return ret; -} - -// Clone of the access list -bool SmCloneAccess(HWND hWnd, SM_ACCESS_LIST *s, ACCESS *t) -{ - SM_EDIT_ACCESS edit; - bool ret; - UINT i; - // Validate arguments - if (hWnd == NULL || s == NULL || t == NULL) - { - return false; - } - - Zero(&edit, sizeof(edit)); - edit.AccessList = s; - edit.Access = Clone(t, sizeof(ACCESS)); - edit.Access->Priority = 0; - edit.Hub = s->Hub; - - // Generate a number that does not duplicate with other and is larger than the priority of the cloning original - for (edit.Access->Priority = t->Priority;edit.Access->Priority != INFINITE;edit.Access->Priority++) - { - bool exists = false; - - for (i = 0;i < LIST_NUM(s->AccessList);i++) - { - ACCESS *a = LIST_DATA(s->AccessList, i); - - if (a->Priority == edit.Access->Priority) - { - exists = true; - break; - } - } - - if (exists == false) - { - break; - } - } - - if (edit.Access->IsIPv6 == false) - { - ret = Dialog(hWnd, D_SM_EDIT_ACCESS, SmEditAccessDlg, &edit); - } - else - { - ret = Dialog(hWnd, D_SM_EDIT_ACCESS_V6, SmEditAccessDlg, &edit); - } - - if (ret) - { - Insert(s->AccessList, edit.Access); - - // Reassign the ID - for (i = 0;i < LIST_NUM(s->AccessList);i++) - { - ACCESS *a = LIST_DATA(s->AccessList, i); - a->Id = (i + 1); - } - } - else - { - Free(edit.Access); - } - - return ret; -} - -// Add to Access List -bool SmAddAccess(HWND hWnd, SM_ACCESS_LIST *s, bool ipv6) -{ - SM_EDIT_ACCESS edit; - bool ret; - UINT i; - // Validate arguments - if (hWnd == NULL || s == NULL) - { - return false; - } - - Zero(&edit, sizeof(edit)); - edit.AccessList = s; - edit.Access = ZeroMalloc(sizeof(ACCESS)); - edit.Access->Active = true; - edit.Access->Priority = 0; - edit.Access->IsIPv6 = ipv6; - edit.Hub = s->Hub; - - // Get the new priority - for (i = 0;i < LIST_NUM(s->AccessList);i++) - { - ACCESS *a = LIST_DATA(s->AccessList, i); - edit.Access->Priority = MAX(edit.Access->Priority, a->Priority); - } - - if (edit.Access->Priority == 0) - { - edit.Access->Priority = 900; - } - - edit.Access->Priority += 100; - - if (edit.Access->IsIPv6 == false) - { - ret = Dialog(hWnd, D_SM_EDIT_ACCESS, SmEditAccessDlg, &edit); - } - else - { - ret = Dialog(hWnd, D_SM_EDIT_ACCESS_V6, SmEditAccessDlg, &edit); - } - - if (ret) - { - Insert(s->AccessList, edit.Access); - - // Reassign the ID - for (i = 0;i < LIST_NUM(s->AccessList);i++) - { - ACCESS *a = LIST_DATA(s->AccessList, i); - a->Id = (i + 1); - } - } - else - { - Free(edit.Access); - } - - return ret; -} - -// Initialize -void SmAccessListInit(HWND hWnd, SM_ACCESS_LIST *s) -{ - // Validate arguments - if (hWnd == NULL || s == NULL) - { - return; - } - - SetIcon(hWnd, 0, ICO_PASS); - FormatText(hWnd, S_TITLE, s->Hub->HubName); - - LvInit(hWnd, L_ACCESS_LIST); - LvInsertColumn(hWnd, L_ACCESS_LIST, 0, _UU("SM_ACCESS_COLUMN_0"), 60); - LvInsertColumn(hWnd, L_ACCESS_LIST, 1, _UU("SM_ACCESS_COLUMN_1"), 60); - LvInsertColumn(hWnd, L_ACCESS_LIST, 2, _UU("SM_ACCESS_COLUMN_2"), 60); - LvInsertColumn(hWnd, L_ACCESS_LIST, 3, _UU("SM_ACCESS_COLUMN_3"), 70); - LvInsertColumn(hWnd, L_ACCESS_LIST, 4, _UU("SM_ACCESS_COLUMN_4"), 150); - LvInsertColumn(hWnd, L_ACCESS_LIST, 5, _UU("SM_ACCESS_COLUMN_5"), 600); - - LvSetStyle(hWnd, L_ACCESS_LIST, LVS_EX_GRIDLINES); - - SetEnable(hWnd, B_ADD_V6, GetCapsBool(s->Hub->p->CapsList, "b_support_ipv6_acl")); - - SmAccessListRefresh(hWnd, s); -} - -// Update the control -void SmAccessListUpdate(HWND hWnd, SM_ACCESS_LIST *s) -{ - bool ok = true; - UINT max_access_lists = 0; - // Validate arguments - if (hWnd == NULL || s == NULL) - { - return; - } - - if (LvIsSelected(hWnd, L_ACCESS_LIST) == false || LvIsMultiMasked(hWnd, L_ACCESS_LIST)) - { - ok = false; - } - - SetEnable(hWnd, IDOK, ok); - SetEnable(hWnd, B_DELETE, ok); - SetEnable(hWnd, B_CLONE, ok); - - if (ok == false) - { - SetEnable(hWnd, B_ENABLE, false); - SetEnable(hWnd, B_DISABLE, false); - } - else - { - ACCESS *a = LvGetParam(hWnd, L_ACCESS_LIST, LvGetSelected(hWnd, L_ACCESS_LIST)); - - if (a != NULL) - { - SetEnable(hWnd, B_ENABLE, (a->Active == false)); - SetEnable(hWnd, B_DISABLE, (a->Active == true)); - } - else - { - SetEnable(hWnd, B_ENABLE, false); - SetEnable(hWnd, B_DISABLE, false); - } - } - - max_access_lists = GetCapsInt(s->Hub->p->CapsList, "i_max_access_lists"); - - SetEnable(hWnd, B_CREATE, LIST_NUM(s->AccessList) < max_access_lists); -} - -// Content update -void SmAccessListRefresh(HWND hWnd, SM_ACCESS_LIST *s) -{ - LVB *b; - UINT i; - // Validate arguments - if (hWnd == NULL || s == NULL) - { - return; - } - - b = LvInsertStart(); - - Sort(s->AccessList); - - for (i = 0;i < LIST_NUM(s->AccessList);i++) - { - ACCESS *a = LIST_DATA(s->AccessList, i); - char tmp[MAX_SIZE]; - UINT ico = ICO_PASS; - wchar_t tmp3[MAX_SIZE]; - wchar_t tmp1[MAX_SIZE]; - wchar_t tmp2[MAX_SIZE]; - GetAccessListStr(tmp, sizeof(tmp), a); - UniToStru(tmp1, a->Priority); - StrToUni(tmp2, sizeof(tmp2), tmp); - - if (a->Discard == false && a->Active == false) - { - ico = ICO_PASS_DISABLE; - } - else if (a->Discard == false && a->Active) - { - ico = ICO_PASS; - } - else if (a->Discard && a->Active == false) - { - ico = ICO_DISCARD_DISABLE; - } - else - { - ico = ICO_DISCARD; - } - - UniToStru(tmp3, a->Id); - - LvInsertAdd(b, ico, (void *)a, 6, - tmp3, - a->Discard ? _UU("SM_ACCESS_DISCARD") : _UU("SM_ACCESS_PASS"), - a->Active ? _UU("SM_ACCESS_ENABLE") : _UU("SM_ACCESS_DISABLE"), - tmp1, - a->Note, - tmp2); - } - - LvInsertEnd(b, hWnd, L_ACCESS_LIST); - LvSortEx(hWnd, L_ACCESS_LIST, 0, false, true); - - SmAccessListUpdate(hWnd, s); -} - -// Access List dialog procedure -UINT SmAccessListProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param) -{ - SM_ACCESS_LIST *s = (SM_ACCESS_LIST *)param; - NMHDR *n; - ACCESS *a; - // Validate arguments - if (hWnd == NULL) - { - return 0; - } - - switch (msg) - { - case WM_INITDIALOG: - // Initialize - SmAccessListInit(hWnd, s); - break; - - case WM_COMMAND: - switch (wParam) - { - case B_ADD: - // Add (IPv4) - if (SmAddAccess(hWnd, s, false)) - { - SmAccessListRefresh(hWnd, s); - } - break; - - case B_ADD_V6: - // Add (IPv6) - if (SmAddAccess(hWnd, s, true)) - { - SmAccessListRefresh(hWnd, s); - } - break; - - case IDOK: - // Edit - a = LvGetParam(hWnd, L_ACCESS_LIST, LvGetSelected(hWnd, L_ACCESS_LIST)); - if (a != NULL) - { - if (SmEditAccess(hWnd, s, a)) - { - SmAccessListRefresh(hWnd, s); - } - } - break; - - case B_CLONE: - // Create by cloning - a = LvGetParam(hWnd, L_ACCESS_LIST, LvGetSelected(hWnd, L_ACCESS_LIST)); - if (a != NULL) - { - if (SmCloneAccess(hWnd, s, a)) - { - SmAccessListRefresh(hWnd, s); - } - } - break; - - case B_ENABLE: - a = LvGetParam(hWnd, L_ACCESS_LIST, LvGetSelected(hWnd, L_ACCESS_LIST)); - if (a != NULL) - { - a->Active = true; - SmAccessListRefresh(hWnd, s); - } - break; - - case B_DISABLE: - a = LvGetParam(hWnd, L_ACCESS_LIST, LvGetSelected(hWnd, L_ACCESS_LIST)); - if (a != NULL) - { - a->Active = false; - SmAccessListRefresh(hWnd, s); - } - break; - - case B_DELETE: - // Delete - a = LvGetParam(hWnd, L_ACCESS_LIST, LvGetSelected(hWnd, L_ACCESS_LIST)); - if (a != NULL) - { - UINT i; - if (IsInList(s->AccessList, a)) - { - Delete(s->AccessList, a); - Free(a); - // Reassign the ID - for (i = 0;i < LIST_NUM(s->AccessList);i++) - { - ACCESS *a = LIST_DATA(s->AccessList, i); - a->Id = (i + 1); - } - SmAccessListRefresh(hWnd, s); - } - } - break; - - case B_SAVE: - // Save - { - UINT i; - bool ok; - // Save the access list - RPC_ENUM_ACCESS_LIST t; - Zero(&t, sizeof(t)); - StrCpy(t.HubName, sizeof(t.HubName), s->Hub->HubName); - t.NumAccess = LIST_NUM(s->AccessList); - t.Accesses = ZeroMalloc(sizeof(ACCESS) * t.NumAccess); - for (i = 0;i < LIST_NUM(s->AccessList);i++) - { - ACCESS *access = LIST_DATA(s->AccessList, i); - Copy(&t.Accesses[i], access, sizeof(ACCESS)); - } - - ok = CALL(hWnd, ScSetAccessList(s->Rpc, &t)); - FreeRpcEnumAccessList(&t); - if (ok) - { - EndDialog(hWnd, true); - } - } - break; - - case IDCANCEL: - // Cancel button - Close(hWnd); - break; - } - break; - - case WM_NOTIFY: - n = (NMHDR *)lParam; - switch (n->idFrom) - { - case L_ACCESS_LIST: - switch (n->code) - { - case LVN_ITEMCHANGED: - SmAccessListUpdate(hWnd, s); - break; - } - break; - } - break; - - case WM_CLOSE: - EndDialog(hWnd, false); - break; - } - - LvStandardHandler(hWnd, msg, wParam, lParam, L_ACCESS_LIST); - - return 0; -} - - -// Access List dialog -void SmAccessListDlg(HWND hWnd, SM_HUB *s) -{ - SM_ACCESS_LIST a; - UINT i; - RPC_ENUM_ACCESS_LIST t; - bool ret; - // Validate arguments - if (hWnd == NULL || s == NULL) - { - return; - } - - Zero(&a, sizeof(a)); - a.Hub = s; - a.Rpc = s->Rpc; - - // Get the access list - Zero(&t, sizeof(t)); - StrCpy(t.HubName, sizeof(t.HubName), s->HubName); - if (CALL(hWnd, ScEnumAccess(s->Rpc, &t)) == false) - { - return; - } - - a.AccessList = NewListFast(CmpAccessList); - // Add to the list - for (i = 0;i < t.NumAccess;i++) - { - ACCESS *access = ZeroMalloc(sizeof(ACCESS)); - Copy(access, &t.Accesses[i], sizeof(ACCESS)); - - Add(a.AccessList, access); - } - - // Sort - Sort(a.AccessList); - FreeRpcEnumAccessList(&t); - - // Show the dialog - ret = Dialog(hWnd, D_SM_ACCESS_LIST, SmAccessListProc, &a); - - for (i = 0;i < LIST_NUM(a.AccessList);i++) - { - ACCESS *access = LIST_DATA(a.AccessList, i); - Free(access); - } - ReleaseList(a.AccessList); -} - -// Initialize -void SmEditGroupDlgInit(HWND hWnd, SM_EDIT_GROUP *g) -{ - RPC_SET_GROUP *group; - LVB *b; - // Validate arguments - if (hWnd == NULL || g == NULL) - { - return; - } - - SetIcon(hWnd, 0, ICO_GROUP); - - group = &g->SetGroup; - - if (g->EditMode == false) - { - SetText(hWnd, 0, _UU("SM_EDIT_GROUP_CAPTION_1")); - } - else - { - wchar_t tmp[MAX_SIZE]; - UniFormat(tmp, sizeof(tmp), _UU("SM_EDIT_GROUP_CAPTION_2"), group->Name); - SetText(hWnd, 0, tmp); - } - - SetTextA(hWnd, E_GROUPNAME, group->Name); - SetText(hWnd, E_REALNAME, group->Realname); - SetText(hWnd, E_NOTE, group->Note); - - g->Inited = true; - - if (g->EditMode == false) - { - Disable(hWnd, L_STATUS); - } - else - { - LvInit(hWnd, L_STATUS); - LvInsertColumn(hWnd, L_STATUS, 0, _UU("SM_STATUS_COLUMN_1"), 0); - LvInsertColumn(hWnd, L_STATUS, 1, _UU("SM_STATUS_COLUMN_2"), 0); - LvSetStyle(hWnd, L_STATUS, LVS_EX_GRIDLINES); - - b = LvInsertStart(); - - SmInsertTrafficInfo(b, &group->Traffic); - - LvInsertEnd(b, hWnd, L_STATUS); - - LvAutoSize(hWnd, L_STATUS); - } - - Check(hWnd, R_POLICY, group->Policy != NULL); - - if (g->EditMode) - { - Disable(hWnd, E_GROUPNAME); - FocusEx(hWnd, E_REALNAME); - } - - SmEditGroupDlgUpdate(hWnd, g); -} - -// Update -void SmEditGroupDlgUpdate(HWND hWnd, SM_EDIT_GROUP *g) -{ - bool ok = true; - RPC_SET_GROUP *group; - // Validate arguments - if (hWnd == NULL || g == NULL) - { - return; - } - - if (g->Inited == false) - { - return; - } - - group = &g->SetGroup; - - GetTxtA(hWnd, E_GROUPNAME, group->Name, sizeof(group->Name)); - Trim(group->Name); - - if (IsUserName(group->Name) == false) - { - ok = false; - } - - GetTxt(hWnd, E_REALNAME, group->Realname, sizeof(group->Realname)); - UniTrim(group->Realname); - - GetTxt(hWnd, E_NOTE, group->Note, sizeof(group->Note)); - UniTrim(group->Note); - - SetEnable(hWnd, B_POLICY, IsChecked(hWnd, R_POLICY)); - - if (IsChecked(hWnd, R_POLICY)) - { - if (group->Policy == NULL) - { - ok = false; - } - } - - SetEnable(hWnd, IDOK, ok); -} - -// OK -void SmEditGroupDlgOnOk(HWND hWnd, SM_EDIT_GROUP *g) -{ - RPC_SET_GROUP *group; - RPC_SET_GROUP t; - // Validate arguments - if (hWnd == NULL || g == NULL) - { - return; - } - - SmEditGroupDlgUpdate(hWnd, g); - - group = &g->SetGroup; - - if (IsChecked(hWnd, R_POLICY) == false) - { - if (group->Policy != NULL) - { - Free(group->Policy); - group->Policy = NULL; - } - } - - Zero(&t, sizeof(t)); - Copy(&t, group, sizeof(RPC_SET_GROUP)); - - t.Policy = ClonePolicy(group->Policy); - - if (g->EditMode == false) - { - if (CALL(hWnd, ScCreateGroup(g->Rpc, &t)) == false) - { - FocusEx(hWnd, E_GROUPNAME); - return; - } - } - else - { - if (CALL(hWnd, ScSetGroup(g->Rpc, &t)) == false) - { - return; - } - } - - FreeRpcSetGroup(&t); - - if (g->EditMode == false) - { - MsgBoxEx(hWnd, MB_ICONINFORMATION, _UU("SM_GROUP_CREATED"), group->Name); - } - - EndDialog(hWnd, true); -} - -// Group editing dialog procedure -UINT SmEditGroupDlgProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param) -{ - SM_EDIT_GROUP *g = (SM_EDIT_GROUP *)param; - wchar_t tmp[MAX_SIZE]; - NMHDR *n; - // Validate arguments - if (hWnd == NULL) - { - return 0; - } - - switch (msg) - { - case WM_INITDIALOG: - // Initialize - SmEditGroupDlgInit(hWnd, g); - break; - - case WM_COMMAND: - switch (LOWORD(wParam)) - { - case E_GROUPNAME: - case E_REALNAME: - case E_NOTE: - case R_POLICY: - SmEditGroupDlgUpdate(hWnd, g); - break; - } - - switch (wParam) - { - case IDOK: - // [OK] button - SmEditGroupDlgOnOk(hWnd, g); - break; - - case IDCANCEL: - // Cancel button - Close(hWnd); - break; - - case R_POLICY: - if (IsChecked(hWnd, R_POLICY)) - { - Focus(hWnd, B_POLICY); - } - break; - - case B_POLICY: - // Security policy - UniFormat(tmp, sizeof(tmp), _UU("SM_GROUP_POLICY_CAPTION"), g->SetGroup.Name); - if (g->SetGroup.Policy == NULL) - { - POLICY *p = ClonePolicy(GetDefaultPolicy()); - if (SmPolicyDlgEx2(hWnd, p, tmp, false, g->p->PolicyVer)) - { - g->SetGroup.Policy = p; - SmEditGroupDlgUpdate(hWnd, g); - } - else - { - Free(p); - } - } - else - { - SmPolicyDlgEx2(hWnd, g->SetGroup.Policy, tmp, false, g->p->PolicyVer); - } - break; - } - break; - - case WM_NOTIFY: - n = (NMHDR *)lParam; - switch (n->idFrom) - { - case L_STATUS: - switch (n->code) - { - case LVN_ITEMCHANGED: - SmEditGroupDlgUpdate(hWnd, g); - break; - } - break; - } - break; - - case WM_CLOSE: - EndDialog(hWnd, false); - break; - } - - return 0; -} - -// Group editing dialog -bool SmEditGroupDlg(HWND hWnd, SM_GROUP *s, char *name) -{ - SM_EDIT_GROUP g; - RPC_SET_GROUP *group; - bool ret; - // Validate arguments - if (hWnd == NULL || s == NULL) - { - return false; - } - - Zero(&g, sizeof(g)); - g.EditMode = true; - g.Hub = s->Hub; - g.p = s->p; - g.Rpc = s->Rpc; - - group = &g.SetGroup; - - StrCpy(group->Name, sizeof(group->Name), name); - StrCpy(group->HubName, sizeof(group->HubName), s->Hub->HubName); - - if (CALL(hWnd, ScGetGroup(s->Rpc, group)) == false) - { - return false; - } - - ret = Dialog(hWnd, D_SM_EDIT_GROUP, SmEditGroupDlgProc, &g); - - FreeRpcSetGroup(group); - - return ret; -} - -// Group creation dialog -bool SmCreateGroupDlg(HWND hWnd, SM_GROUP *s) -{ - SM_EDIT_GROUP g; - RPC_SET_GROUP *group; - bool ret; - // Validate arguments - if (hWnd == NULL || s == NULL) - { - return false; - } - - Zero(&g, sizeof(g)); - g.EditMode = false; - g.Hub = s->Hub; - g.p = s->p; - g.Rpc = s->Rpc; - - group = &g.SetGroup; - - StrCpy(group->HubName, sizeof(group->HubName), s->Hub->HubName); - - ret = Dialog(hWnd, D_SM_EDIT_GROUP, SmEditGroupDlgProc, &g); - - FreeRpcSetGroup(group); - - return ret; -} - -// Initialize -void SmGroupListDlgInit(HWND hWnd, SM_GROUP *s) -{ - if (hWnd == NULL || s == NULL) - { - return; - } - - SetIcon(hWnd, 0, ICO_GROUP); - - // Initialize the column - LvInit(hWnd, L_GROUP); - LvInsertColumn(hWnd, L_GROUP, 0, _UU("SM_GROUPLIST_NAME"), 130); - LvInsertColumn(hWnd, L_GROUP, 1, _UU("SM_GROUPLIST_REALNAME"), 130); - LvInsertColumn(hWnd, L_GROUP, 2, _UU("SM_GROUPLIST_NOTE"), 170); - LvInsertColumn(hWnd, L_GROUP, 3, _UU("SM_GROUPLIST_NUMUSERS"), 80); - LvSetStyle(hWnd, L_GROUP, LVS_EX_GRIDLINES); - - FormatText(hWnd, S_TITLE, s->Hub->HubName); - - SmGroupListDlgRefresh(hWnd, s); - - if (s->SelectMode) - { - SetStyle(hWnd, L_GROUP, LVS_SINGLESEL); - } - - if (s->SelectMode) - { - wchar_t tmp[MAX_SIZE]; - SetText(hWnd, IDOK, _UU("SM_SELECT_GROUP")); - - if (s->SelectedGroupName != NULL) - { - UINT i; - StrToUni(tmp, sizeof(tmp), s->SelectedGroupName); - i = LvSearchStr(hWnd, L_GROUP, 0, tmp); - if (i != INFINITE) - { - LvSelect(hWnd, L_GROUP, i); - } - } - } -} - -// Update the controls -void SmGroupListDlgUpdate(HWND hWnd, SM_GROUP *s) -{ - bool ok = true; - if (hWnd == NULL || s == NULL) - { - return; - } - - if (LvIsSelected(hWnd, L_GROUP) == false || LvIsMultiMasked(hWnd, L_GROUP)) - { - ok = false; - } - - SetEnable(hWnd, IDOK, ok); - SetEnable(hWnd, B_USER, ok); - SetEnable(hWnd, B_STATUS, ok); - - if (s->SelectMode == false) - { - SetEnable(hWnd, B_DELETE, ok); - } - else - { - SetEnable(hWnd, B_DELETE, false); - SetEnable(hWnd, B_USER, false); - SetText(hWnd, IDCANCEL, _UU("SM_SELECT_NO_GROUP")); - } -} - -// Content update -void SmGroupListDlgRefresh(HWND hWnd, SM_GROUP *s) -{ - RPC_ENUM_GROUP t; - UINT i; - LVB *b; - if (hWnd == NULL || s == NULL) - { - return; - } - - Zero(&t, sizeof(t)); - StrCpy(t.HubName, sizeof(t.HubName), s->Hub->HubName); - - if (CALL(hWnd, ScEnumGroup(s->Rpc, &t)) == false) - { - return; - } - - b = LvInsertStart(); - - for (i = 0;i < t.NumGroup;i++) - { - wchar_t tmp1[MAX_SIZE]; - wchar_t tmp2[MAX_SIZE]; - RPC_ENUM_GROUP_ITEM *e = &t.Groups[i]; - - StrToUni(tmp1, sizeof(tmp1), e->Name); - UniToStru(tmp2, e->NumUsers); - - LvInsertAdd(b, e->DenyAccess == false ? ICO_GROUP : ICO_GROUP_DENY, - NULL, 4, tmp1, e->Realname, e->Note, tmp2); - } - - LvInsertEnd(b, hWnd, L_GROUP); - - SmGroupListDlgUpdate(hWnd, s); - - FreeRpcEnumGroup(&t); -} - -// Group List dialog procedure -UINT SmGroupListDlgProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param) -{ - SM_GROUP *s = (SM_GROUP *)param; - NMHDR *n; - wchar_t *tmp; - // Validate arguments - if (hWnd == NULL) - { - return 0; - } - - switch (msg) - { - case WM_INITDIALOG: - // Initialize - SmGroupListDlgInit(hWnd, s); - break; - - case WM_COMMAND: - switch (wParam) - { - case B_CREATE: - // Create new - if (SmCreateGroupDlg(hWnd, s)) - { - SmGroupListDlgRefresh(hWnd, s); - } - break; - - case IDOK: - // Edit - tmp = LvGetSelectedStr(hWnd, L_GROUP, 0); - if (tmp != NULL) - { - char name[MAX_SIZE]; - UniToStr(name, sizeof(name), tmp); - - if (s->SelectMode == false) - { - if (SmEditGroupDlg(hWnd, s, name)) - { - SmGroupListDlgRefresh(hWnd, s); - } - } - else - { - s->SelectedGroupName = CopyStr(name); - EndDialog(hWnd, true); - } - Free(tmp); - } - break; - - case B_DELETE: - // Delete - tmp = LvGetSelectedStr(hWnd, L_GROUP, 0); - if (tmp != NULL) - { - char name[MAX_SIZE]; - RPC_DELETE_USER t; - UniToStr(name, sizeof(name), tmp); - - if (MsgBoxEx(hWnd, MB_ICONQUESTION | MB_YESNO | MB_DEFBUTTON2, - _UU("SM_GROUP_DELETE_MSG"), name) == IDYES) - { - Zero(&t, sizeof(t)); - StrCpy(t.HubName, sizeof(t.HubName), s->Hub->HubName); - StrCpy(t.Name, sizeof(t.Name), name); - - if (CALL(hWnd, ScDeleteGroup(s->Rpc, &t))) - { - SmGroupListDlgRefresh(hWnd, s); - } - } - - Free(tmp); - } - break; - - case B_USER: - // Member List - tmp = LvGetSelectedStr(hWnd, L_GROUP, 0); - if (tmp != NULL) - { - char name[MAX_SIZE]; - UniToStr(name, sizeof(name), tmp); - SmUserListDlgEx(hWnd, s->Hub, name, false); - Free(tmp); - } - break; - - case B_REFRESH: - // Update to the latest information - SmGroupListDlgRefresh(hWnd, s); - break; - - case IDCANCEL: - // Cancel button - Close(hWnd); - break; - } - break; - - case WM_NOTIFY: - n = (NMHDR *)lParam; - switch (n->idFrom) - { - case L_GROUP: - switch (n->code) - { - case LVN_ITEMCHANGED: - SmGroupListDlgUpdate(hWnd, s); - break; - } - break; - } - break; - - case WM_CLOSE: - EndDialog(hWnd, false); - break; - } - - LvStandardHandler(hWnd, msg, wParam, lParam, L_GROUP); - - return 0; -} - -// Group List dialog (selection mode) -char *SmSelectGroupDlg(HWND hWnd, SM_HUB *s, char *default_name) -{ - SM_GROUP g; - // Validate arguments - if (hWnd == NULL || s == NULL) - { - return NULL; - } - - Zero(&g, sizeof(g)); - g.Hub = s; - g.p = s->p; - g.Rpc = s->Rpc; - g.SelectMode = true; - g.SelectedGroupName = default_name; - - if (Dialog(hWnd, D_SM_GROUP, SmGroupListDlgProc, &g) == false) - { - return NULL; - } - - return g.SelectedGroupName; -} - -// Group List dialog -void SmGroupListDlg(HWND hWnd, SM_HUB *s) -{ - SM_GROUP g; - // Validate arguments - if (hWnd == NULL || s == NULL) - { - return; - } - - Zero(&g, sizeof(g)); - g.Hub = s; - g.p = s->p; - g.Rpc = s->Rpc; - g.SelectMode = false; - - Dialog(hWnd, D_SM_GROUP, SmGroupListDlgProc, &g); -} - -// Update the user information -bool SmRefreshUserInfo(HWND hWnd, SM_SERVER *s, void *param) -{ - RPC_SET_USER t; - SM_USER_INFO *p = (SM_USER_INFO *)param; - LVB *b; - wchar_t tmp[MAX_SIZE]; - char *username; - - // Validate arguments - if (hWnd == NULL || s == NULL || param == NULL) - { - return false; - } - - username = p->Username; - - Zero(&t, sizeof(t)); - StrCpy(t.HubName, sizeof(t.HubName), p->Hub->HubName); - StrCpy(t.Name, sizeof(t.Name), username); - - if (CALL(hWnd, ScGetUser(s->Rpc, &t)) == false) - { - return false; - } - - b = LvInsertStart(); - - StrToUni(tmp, sizeof(tmp), t.Name); - LvInsertAdd(b, ICO_USER, NULL, 2, _UU("SM_USERINFO_NAME"), tmp); - - if (StrLen(t.GroupName) != 0) - { - StrToUni(tmp, sizeof(tmp), t.GroupName); - LvInsertAdd(b, ICO_GROUP, NULL, 2, _UU("SM_USERINFO_GROUP"), tmp); - } - - GetDateTimeStrEx64(tmp, sizeof(tmp), SystemToLocal64(t.CreatedTime), NULL); - LvInsertAdd(b, ICO_USER_ADMIN, NULL, 2, _UU("SM_USERINFO_CREATE"), tmp); - - GetDateTimeStrEx64(tmp, sizeof(tmp), SystemToLocal64(t.UpdatedTime), NULL); - LvInsertAdd(b, ICO_USER_ADMIN, NULL, 2, _UU("SM_USERINFO_UPDATE"), tmp); - - if (t.ExpireTime != 0) - { - GetDateTimeStrEx64(tmp, sizeof(tmp), SystemToLocal64(t.ExpireTime), NULL); - LvInsertAdd(b, ICO_WARNING, NULL, 2, _UU("SM_USERINFO_EXPIRE"), tmp); - } - - SmInsertTrafficInfo(b, &t.Traffic); - - UniToStru(tmp, t.NumLogin); - LvInsertAdd(b, ICO_LINK, NULL, 2, _UU("SM_USERINFO_NUMLOGIN"), tmp); - - LvInsertEnd(b, hWnd, L_STATUS); - - FreeRpcSetUser(&t); - - return true; -} - -// Initialize -void SmPolicyDlgInit(HWND hWnd, SM_POLICY *s) -{ - CM_POLICY cp; - // Validate arguments - if (hWnd == NULL || s == NULL) - { - return; - } - - SetIcon(hWnd, 0, ICO_MACHINE); - SetText(hWnd, 0, s->Caption); - SetText(hWnd, S_TITLE, s->Caption); - DlgFont(hWnd, S_BOLD, 10, true); - DlgFont(hWnd, S_BOLD2, 10, true); - - DlgFont(hWnd, S_POLICY_TITLE, 11, false); - DlgFont(hWnd, E_POLICY_DESCRIPTION, 10, false); - - Zero(&cp, sizeof(cp)); - cp.Policy = s->Policy; - cp.Extension = true; - - LvInit(hWnd, L_POLICY); - LvInsertColumn(hWnd, L_POLICY, 0, _UU("POL_TITLE_STR"), 250); - LvInsertColumn(hWnd, L_POLICY, 1, _UU("POL_VALUE_STR"), 150); - LvSetStyle(hWnd, L_POLICY, LVS_EX_GRIDLINES); - - CmPolicyDlgPrintEx2(hWnd, &cp, s->CascadeMode, s->Ver); - - LvSelect(hWnd, L_POLICY, 0); - - s->Inited = true; - SmPolicyDlgUpdate(hWnd, s); -} - -// Update -void SmPolicyDlgUpdate(HWND hWnd, SM_POLICY *s) -{ - bool ok = true; - bool value_changed = false; - UINT i; - // Validate arguments - if (hWnd == NULL || s == NULL) - { - return; - } - - if (s->Inited == false) - { - return; - } - - i = LvGetSelected(hWnd, L_POLICY); - if (i != INFINITE) - { - i = (UINT)LvGetParam(hWnd, L_POLICY, i); - } - if (i == INFINITE || i >= NUM_POLICY_ITEM) - { - SetText(hWnd, S_POLICY_TITLE, _UU("SM_POLICY_INIT_TITLE")); - SetText(hWnd, E_POLICY_DESCRIPTION, L""); - Disable(hWnd, S_POLICY_TITLE); - Disable(hWnd, S_BOLD); - Hide(hWnd, S_BOLD2); - Hide(hWnd, R_ENABLE); - Hide(hWnd, R_DISABLE); - Hide(hWnd, R_DEFINE); - Hide(hWnd, E_VALUE); - Hide(hWnd, S_TANI); - Hide(hWnd, S_LIMIT); - } - else - { - POLICY_ITEM *item = &policy_item[i]; - bool changed = false; - wchar_t *tmp = GetText(hWnd, S_POLICY_TITLE); - if (UniStrCmp(tmp, GetPolicyTitle(i)) != 0) - { - changed = true; - } - Free(tmp); - SetText(hWnd, S_POLICY_TITLE, GetPolicyTitle(i)); - SetText(hWnd, E_POLICY_DESCRIPTION, GetPolicyDescription(i)); - Enable(hWnd, S_POLICY_TITLE); - Enable(hWnd, S_BOLD); - Show(hWnd, S_BOLD2); - - if (item->TypeInt == false) - { - Show(hWnd, R_ENABLE); - Show(hWnd, R_DISABLE); - Hide(hWnd, R_DEFINE); - Hide(hWnd, E_VALUE); - Hide(hWnd, S_TANI); - Hide(hWnd, S_LIMIT); - - if (changed) - { - if (POLICY_BOOL(s->Policy, i)) - { - Check(hWnd, R_ENABLE, true); - Check(hWnd, R_DISABLE, false); - } - else - { - Check(hWnd, R_ENABLE, false); - Check(hWnd, R_DISABLE, true); - } - } - - if ((!(POLICY_BOOL(s->Policy, i))) != (!(IsChecked(hWnd, R_ENABLE)))) - { - POLICY_BOOL(s->Policy, i) = IsChecked(hWnd, R_ENABLE); - value_changed = true; - } - } - else - { - wchar_t tmp[MAX_SIZE]; - UINT value; - if (item->AllowZero) - { - if (changed) - { - Check(hWnd, R_DEFINE, POLICY_INT(s->Policy, i) != 0); - Enable(hWnd, R_DEFINE); - SetIntEx(hWnd, E_VALUE, POLICY_INT(s->Policy, i)); - } - - SetEnable(hWnd, E_VALUE, IsChecked(hWnd, R_DEFINE)); - SetEnable(hWnd, S_TANI, IsChecked(hWnd, R_DEFINE)); - SetEnable(hWnd, S_LIMIT, IsChecked(hWnd, R_DEFINE)); - } - else - { - if (changed) - { - Check(hWnd, R_DEFINE, true); - Disable(hWnd, R_DEFINE); - SetInt(hWnd, E_VALUE, POLICY_INT(s->Policy, i)); - } - - SetEnable(hWnd, E_VALUE, IsChecked(hWnd, R_DEFINE)); - SetEnable(hWnd, S_TANI, IsChecked(hWnd, R_DEFINE)); - SetEnable(hWnd, S_LIMIT, IsChecked(hWnd, R_DEFINE)); - } - - UniReplaceStrEx(tmp, sizeof(tmp), _UU(policy_item[i].FormatStr), - L"%u ", L"", false); - UniReplaceStrEx(tmp, sizeof(tmp), tmp, - L"%u", L"", false); - - SetText(hWnd, S_TANI, tmp); - - UniFormat(tmp, sizeof(tmp), _UU("SM_LIMIT_STR"), policy_item[i].MinValue, policy_item[i].MaxValue); - SetText(hWnd, S_LIMIT, tmp); - - Hide(hWnd, R_ENABLE); - Hide(hWnd, R_DISABLE); - Show(hWnd, E_VALUE); - Show(hWnd, R_DEFINE); - Show(hWnd, S_TANI); - Show(hWnd, S_LIMIT); - - value = GetInt(hWnd, E_VALUE); - - if (item->AllowZero && (IsChecked(hWnd, R_DEFINE) == false)) - { - value = 0; - } - else - { - if (value < policy_item[i].MinValue || value > policy_item[i].MaxValue) - { - ok = false; - } - } - - if (ok) - { - if (POLICY_INT(s->Policy, i) != value) - { - POLICY_INT(s->Policy, i) = value; - value_changed = true; - } - } - } - } - - SetEnable(hWnd, IDOK, ok); - SetEnable(hWnd, L_POLICY, ok); - - if (value_changed) - { - CM_POLICY cp; - Zero(&cp, sizeof(cp)); - cp.Policy = s->Policy; - cp.Extension = true; - - CmPolicyDlgPrintEx(hWnd, &cp, s->CascadeMode); - } -} - -// Confirmation -void SmPolicyDlgOk(HWND hWnd, SM_POLICY *s) -{ - // Validate arguments - if (hWnd == NULL || s == NULL) - { - return; - } - - EndDialog(hWnd, true); -} - -// Policy dialog box procedure -UINT SmPolicyDlgProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param) -{ - SM_POLICY *s = (SM_POLICY *)param; - NMHDR *n; - // Validate arguments - if (hWnd == NULL) - { - return 0; - } - - switch (msg) - { - case WM_INITDIALOG: - // Initialize - SmPolicyDlgInit(hWnd, s); - break; - - case WM_COMMAND: - switch (LOWORD(wParam)) - { - case R_DEFINE: - case R_ENABLE: - case R_DISABLE: - case E_VALUE: - SmPolicyDlgUpdate(hWnd, s); - break; - } - - switch (wParam) - { - case IDOK: - // [OK] button - SmPolicyDlgOk(hWnd, s); - break; - - case IDCANCEL: - // Cancel button - Close(hWnd); - break; - - case R_DEFINE: - if (IsChecked(hWnd, R_DEFINE)) - { - FocusEx(hWnd, E_VALUE); - } - break; - } - break; - - case WM_NOTIFY: - n = (NMHDR *)lParam; - switch (n->idFrom) - { - case L_POLICY: - switch (n->code) - { - case LVN_ITEMCHANGED: - SmPolicyDlgUpdate(hWnd, s); - break; - } - break; - } - break; - - case WM_CLOSE: - EndDialog(hWnd, false); - break; - } - - return 0; -} - -// Show Policies dialog box -bool SmPolicyDlg(HWND hWnd, POLICY *p, wchar_t *caption) -{ - return SmPolicyDlgEx(hWnd, p, caption, false); -} -bool SmPolicyDlgEx(HWND hWnd, POLICY *p, wchar_t *caption, bool cascade_mode) -{ - return SmPolicyDlgEx2(hWnd, p, caption, cascade_mode, POLICY_CURRENT_VERSION); -} -bool SmPolicyDlgEx2(HWND hWnd, POLICY *p, wchar_t *caption, bool cascade_mode, UINT ver) -{ - SM_POLICY s; - bool ret; - // Validate arguments - if (hWnd == NULL || p == NULL) - { - return false; - } - - if (caption == NULL) - { - caption = _UU("SM_POLICY_DEF_CAPTION"); - } - - Zero(&s, sizeof(s)); - s.Caption = caption; - s.Policy = ClonePolicy(p); - s.CascadeMode = cascade_mode; - s.Ver = ver; - - ret = Dialog(hWnd, D_SM_POLICY, SmPolicyDlgProc, &s); - - if (ret) - { - Copy(p, s.Policy, sizeof(POLICY)); - } - - Free(s.Policy); - - return ret; -} - -// Edit user confirmed -void SmEditUserDlgOk(HWND hWnd, SM_EDIT_USER *s) -{ - RPC_SET_USER t; - RPC_SET_USER *u; - // Validate arguments - if (hWnd == NULL || s == NULL) - { - return; - } - - SmEditUserDlgUpdate(hWnd, s); - - Zero(&t, sizeof(t)); - u = &s->SetUser; - - StrCpy(t.HubName, sizeof(t.HubName), u->HubName); - StrCpy(t.Name, sizeof(t.Name), u->Name); - StrCpy(t.GroupName, sizeof(t.GroupName), u->GroupName); - UniStrCpy(t.Realname, sizeof(t.Realname), u->Realname); - UniStrCpy(t.Note, sizeof(t.Note), u->Note); - t.ExpireTime = u->ExpireTime; - t.AuthType = u->AuthType; - t.AuthData = CopyAuthData(u->AuthData, t.AuthType); - - if (IsChecked(hWnd, R_POLICY)) - { - t.Policy = ClonePolicy(u->Policy); - } - else - { - t.Policy = NULL; - } - - if (s->EditMode == false) - { - if (CALL(hWnd, ScCreateUser(s->Rpc, &t)) == false) - { - FocusEx(hWnd, E_USERNAME); - return; - } - FreeRpcSetUser(&t); - - MsgBoxEx(hWnd, MB_ICONINFORMATION, _UU("SM_USER_CREATE_OK"), u->Name); - } - else - { - if (CALL(hWnd, ScSetUser(s->Rpc, &t)) == false) - { - FocusEx(hWnd, E_REALNAME); - return; - } - FreeRpcSetUser(&t); - } - - EndDialog(hWnd, true); -} - -// Edit user initialization -void SmEditUserDlgInit(HWND hWnd, SM_EDIT_USER *s) -{ - RPC_SET_USER *u; - wchar_t tmp[MAX_SIZE]; - UINT i; - UINT icons[6] = {ICO_PASS, ICO_KEY, ICO_CERT, ICO_SERVER_CERT, - ICO_TOWER, ICO_LINK}; - RECT rect; - - // Validate arguments - if (hWnd == NULL || s == NULL) - { - return; - } - - SetIcon(hWnd, 0, ICO_USER); - - u = &s->SetUser; - - // Initialize the column - LvInit(hWnd, L_AUTH); - LvSetStyle(hWnd, L_AUTH, LVS_EX_GRIDLINES); - - GetClientRect(DlgItem(hWnd, L_AUTH), &rect); - LvInsertColumn(hWnd, L_AUTH, 0, L"Name", rect.right - rect.left); - - for (i = 0;i < 6;i++) - { - LvInsert(hWnd, L_AUTH, icons[i], (void *)i, 1, SmGetAuthTypeStr(i)); - } - - // User name, etc. - SetTextA(hWnd, E_USERNAME, u->Name); - SetText(hWnd, E_REALNAME, u->Realname); - SetText(hWnd, E_NOTE, u->Note); - - - // Expiration date - if (u->ExpireTime == 0) - { - SYSTEMTIME st; - Check(hWnd, R_EXPIRES, false); - GetLocalTime(&st); - UINT64ToSystem(&st, SystemToUINT64(&st) + (60 * 60 * 24 * 1000)); - st.wHour = st.wMinute = st.wSecond = st.wMilliseconds = 0; - DateTime_SetSystemtime(DlgItem(hWnd, E_EXPIRES_DATE), GDT_VALID, &st); - DateTime_SetSystemtime(DlgItem(hWnd, E_EXPIRES_TIME), GDT_VALID, &st); - } - else - { - SYSTEMTIME st; - UINT64ToSystem(&st, SystemToLocal64(u->ExpireTime)); - Check(hWnd, R_EXPIRES, true); - DateTime_SetSystemtime(DlgItem(hWnd, E_EXPIRES_DATE), GDT_VALID, &st); - DateTime_SetSystemtime(DlgItem(hWnd, E_EXPIRES_TIME), GDT_VALID, &st); - } - - if (GetCurrentOsLangId() == SE_LANG_JAPANESE || GetCurrentOsLangId() == SE_LANG_CHINESE_ZH) - { - SetStyle(hWnd, E_EXPIRES_DATE, DTS_LONGDATEFORMAT); - } - else - { - SetStyle(hWnd, E_EXPIRES_DATE, DTS_SHORTDATEFORMAT); - } - - SetWindowLong(DlgItem(hWnd, E_EXPIRES_TIME), GWL_STYLE, WS_CHILDWINDOW | WS_VISIBLE | WS_TABSTOP | DTS_RIGHTALIGN | DTS_TIMEFORMAT | DTS_UPDOWN); - - // Group name - SetTextA(hWnd, E_GROUP, u->GroupName); - - // Authentication method - LvSelect(hWnd, L_AUTH, u->AuthType); - - SetText(hWnd, S_CERT_INFO, _UU("SM_EDIT_USER_CERT_INFO")); - - switch (u->AuthType) - { - case AUTHTYPE_PASSWORD: - if (s->EditMode) - { - SetTextA(hWnd, E_PASSWORD1, HIDDEN_PASSWORD); - SetTextA(hWnd, E_PASSWORD2, HIDDEN_PASSWORD); - } - break; - - case AUTHTYPE_USERCERT: - SmGetCertInfoStr(tmp, sizeof(tmp), ((AUTHUSERCERT *)u->AuthData)->UserX); - break; - - case AUTHTYPE_ROOTCERT: - if (u->AuthData != NULL) - { - AUTHROOTCERT *c = (AUTHROOTCERT *)u->AuthData; - if (c->CommonName != NULL && UniStrLen(c->CommonName) != 0) - { - Check(hWnd, R_CN, true); - SetText(hWnd, E_CN, c->CommonName); - } - else - { - Check(hWnd, R_CN, false); - } - if (c->Serial != NULL && c->Serial->size != 0) - { - X_SERIAL *s = c->Serial; - char *tmp; - UINT tmp_size = s->size * 3 + 1; - tmp = ZeroMalloc(tmp_size); - BinToStrEx(tmp, tmp_size, s->data, s->size); - SetTextA(hWnd, E_SERIAL, tmp); - Free(tmp); - Check(hWnd, R_SERIAL, true); - } - else - { - Check(hWnd, R_SERIAL, false); - } - } - break; - - case AUTHTYPE_RADIUS: - if (u->AuthData != NULL) - { - AUTHRADIUS *r = (AUTHRADIUS *)u->AuthData; - if (UniStrLen(r->RadiusUsername) != 0) - { - Check(hWnd, R_SET_RADIUS_USERNAME, true); - SetText(hWnd, E_RADIUS_USERNAME, r->RadiusUsername); - } - else - { - Check(hWnd, R_SET_RADIUS_USERNAME, false); - } - } - break; - - case AUTHTYPE_NT: - if (u->AuthData != NULL) - { - AUTHNT *n = (AUTHNT *)u->AuthData; - if (UniStrLen(n->NtUsername) != 0) - { - Check(hWnd, R_SET_RADIUS_USERNAME, true); - SetText(hWnd, E_RADIUS_USERNAME, n->NtUsername); - } - else - { - Check(hWnd, R_SET_RADIUS_USERNAME, false); - } - } - break; - } - - if (u->Policy != NULL) - { - Check(hWnd, R_POLICY, true); - } - - s->Inited = true; - - SmEditUserDlgUpdate(hWnd, s); - - if (s->EditMode == false) - { - Focus(hWnd, E_USERNAME); - SetText(hWnd, 0, _UU("SM_EDIT_USER_CAPTION_1")); - } - else - { - wchar_t tmp[MAX_SIZE]; - UniFormat(tmp, sizeof(tmp), _UU("SM_EDIT_USER_CAPTION_2"), s->SetUser.Name); - SetText(hWnd, 0, tmp); - - Disable(hWnd, E_USERNAME); - FocusEx(hWnd, E_REALNAME); - } - - SetShow(hWnd, S_HINT, (s->EditMode ? false : true)); -} - -// User edit control update -void SmEditUserDlgUpdate(HWND hWnd, SM_EDIT_USER *s) -{ - RPC_SET_USER *u; - bool ok = true; - UINT old_authtype; - char tmp1[MAX_SIZE]; - char tmp2[MAX_SIZE]; - bool authtype_changed = false; - // Validate arguments - if (hWnd == NULL || s == NULL) - { - return; - } - - if (s->Inited == false) - { - return; - } - - u = &s->SetUser; - - // User name - GetTxtA(hWnd, E_USERNAME, u->Name, sizeof(u->Name)); - Trim(u->Name); - if (StrLen(u->Name) == 0 || IsUserName(u->Name) == false) - { - ok = false; - } - - // Real name - GetTxt(hWnd, E_REALNAME, u->Realname, sizeof(u->Realname)); - UniTrim(u->Realname); - - // Note - GetTxt(hWnd, E_NOTE, u->Note, sizeof(u->Note)); - UniTrim(u->Realname); - - // Group - GetTxtA(hWnd, E_GROUP, u->GroupName, sizeof(u->GroupName)); - Trim(u->GroupName); - - // Expiration date - if (IsChecked(hWnd, R_EXPIRES) == false) - { - u->ExpireTime = 0; - Disable(hWnd, E_EXPIRES_DATE); - Disable(hWnd, E_EXPIRES_TIME); - } - else - { - SYSTEMTIME st1, st2; - Enable(hWnd, E_EXPIRES_DATE); - Enable(hWnd, E_EXPIRES_TIME); - DateTime_GetSystemtime(DlgItem(hWnd, E_EXPIRES_DATE), &st1); - DateTime_GetSystemtime(DlgItem(hWnd, E_EXPIRES_TIME), &st2); - st1.wHour = st2.wHour; - st1.wMinute = st2.wMinute; - st1.wSecond = st2.wSecond; - st1.wMilliseconds = st2.wMilliseconds; - u->ExpireTime = LocalToSystem64(SystemToUINT64(&st1)); - } - - // Authentication method - old_authtype = u->AuthType; - u->AuthType = LvGetSelected(hWnd, L_AUTH); - - if (StrCmpi(u->Name, "*") == 0) - { - if (u->AuthType != AUTHTYPE_RADIUS && u->AuthType != AUTHTYPE_NT) - { - ok = false; - } - } - - if (u->AuthType == INFINITE) - { - ok = false; - u->AuthType = 0; - } - if (old_authtype != u->AuthType) - { - authtype_changed = true; - } - - if (authtype_changed) - { - FreeAuthData(old_authtype, u->AuthData); - u->AuthData = NULL; - switch (u->AuthType) - { - case AUTHTYPE_ANONYMOUS: - u->AuthData = NULL; - break; - - case AUTHTYPE_PASSWORD: - u->AuthData = NewPasswordAuthData("", ""); - GetTxtA(hWnd, E_PASSWORD1, tmp1, sizeof(tmp1)); - if (StrCmp(tmp1, HIDDEN_PASSWORD) == 0) - { - SetTextA(hWnd, E_PASSWORD1, ""); - } - GetTxtA(hWnd, E_PASSWORD2, tmp2, sizeof(tmp2)); - if (StrCmp(tmp2, HIDDEN_PASSWORD) == 0) - { - SetTextA(hWnd, E_PASSWORD2, ""); - } - break; - - case AUTHTYPE_USERCERT: - u->AuthData = NewUserCertAuthData(NULL); - SetText(hWnd, S_CERT_INFO, _UU("SM_EDIT_USER_CERT_INFO")); - break; - - case AUTHTYPE_ROOTCERT: - u->AuthData = NewRootCertAuthData(NULL, NULL); - break; - - case AUTHTYPE_NT: - u->AuthData = NewNTAuthData(L""); - break; - - case AUTHTYPE_RADIUS: - u->AuthData = NewRadiusAuthData(L""); - break; - } - } - - SetEnable(hWnd, S_RADIUS_3, (u->AuthType == AUTHTYPE_RADIUS) || (u->AuthType == AUTHTYPE_NT)); - SetEnable(hWnd, R_SET_RADIUS_USERNAME, (u->AuthType == AUTHTYPE_RADIUS) || (u->AuthType == AUTHTYPE_NT)); - SetEnable(hWnd, S_RADIUS_1, (u->AuthType == AUTHTYPE_RADIUS) || (u->AuthType == AUTHTYPE_NT)); - - if (StrCmp(u->Name, "*") == 0) - { - Check(hWnd, R_SET_RADIUS_USERNAME, false); - Disable(hWnd, R_SET_RADIUS_USERNAME); - } - - if ((u->AuthType == AUTHTYPE_RADIUS) || (u->AuthType == AUTHTYPE_NT)) - { - SetEnable(hWnd, E_RADIUS_USERNAME, IsChecked(hWnd, R_SET_RADIUS_USERNAME)); - SetEnable(hWnd, S_RADIUS_2, IsChecked(hWnd, R_SET_RADIUS_USERNAME)); - } - else - { - SetEnable(hWnd, E_RADIUS_USERNAME, false); - SetEnable(hWnd, S_RADIUS_2, false); - } - - SetEnable(hWnd, S_PASSWORD_1, u->AuthType == AUTHTYPE_PASSWORD); - SetEnable(hWnd, S_PASSWORD_2, u->AuthType == AUTHTYPE_PASSWORD); - SetEnable(hWnd, S_PASSWORD_3, u->AuthType == AUTHTYPE_PASSWORD); - SetEnable(hWnd, E_PASSWORD1, u->AuthType == AUTHTYPE_PASSWORD); - SetEnable(hWnd, E_PASSWORD2, u->AuthType == AUTHTYPE_PASSWORD); - - SetEnable(hWnd, S_USER_CERT_1, u->AuthType == AUTHTYPE_USERCERT); - SetEnable(hWnd, S_CERT_INFO, u->AuthType == AUTHTYPE_USERCERT); - SetEnable(hWnd, B_LOAD_CERT, u->AuthType == AUTHTYPE_USERCERT); - - if (u->AuthType == AUTHTYPE_USERCERT) - { - SetEnable(hWnd, B_VIEW_CERT, ((AUTHUSERCERT *)u->AuthData)->UserX != NULL); - } - else - { - SetEnable(hWnd, B_VIEW_CERT, false); - } - - SetEnable(hWnd, S_ROOT_CERT_1, u->AuthType == AUTHTYPE_ROOTCERT); - SetEnable(hWnd, S_ROOT_CERT_2, u->AuthType == AUTHTYPE_ROOTCERT); - SetEnable(hWnd, S_ROOT_CERT_3, u->AuthType == AUTHTYPE_ROOTCERT); - SetEnable(hWnd, R_CN, u->AuthType == AUTHTYPE_ROOTCERT); - SetEnable(hWnd, R_SERIAL, u->AuthType == AUTHTYPE_ROOTCERT); - - if (u->AuthType == AUTHTYPE_ROOTCERT) - { - SetEnable(hWnd, E_CN, IsChecked(hWnd, R_CN)); - SetEnable(hWnd, E_SERIAL, IsChecked(hWnd, R_SERIAL)); - } - else - { - Disable(hWnd, E_CN); - Disable(hWnd, E_SERIAL); - } - - switch (u->AuthType) - { - case AUTHTYPE_PASSWORD: - GetTxtA(hWnd, E_PASSWORD1, tmp1, sizeof(tmp1)); - GetTxtA(hWnd, E_PASSWORD2, tmp2, sizeof(tmp2)); - if (StrCmp(tmp1, tmp2) != 0) - { - ok = false; - } - else - { - if (StrCmp(tmp1, HIDDEN_PASSWORD) != 0) - { - HashPassword(((AUTHPASSWORD *)u->AuthData)->HashedKey, u->Name, tmp1); - GenerateNtPasswordHash(((AUTHPASSWORD *)u->AuthData)->NtLmSecureHash, tmp1); - } - } - break; - - case AUTHTYPE_USERCERT: - if (((AUTHUSERCERT *)u->AuthData)->UserX == NULL) - { - ok = false; - } - break; - - case AUTHTYPE_ROOTCERT: - Free(((AUTHROOTCERT *)u->AuthData)->CommonName); - ((AUTHROOTCERT *)u->AuthData)->CommonName = NULL; - if (IsChecked(hWnd, R_CN) && (IsEmpty(hWnd, E_CN) == false)) - { - ((AUTHROOTCERT *)u->AuthData)->CommonName = GetText(hWnd, E_CN); - UniTrim(((AUTHROOTCERT *)u->AuthData)->CommonName); - } - if (IsChecked(hWnd, R_CN) && ((AUTHROOTCERT *)u->AuthData)->CommonName == NULL) - { - ok = false; - } - FreeXSerial(((AUTHROOTCERT *)u->AuthData)->Serial); - ((AUTHROOTCERT *)u->AuthData)->Serial = NULL; - if (IsChecked(hWnd, R_SERIAL)) - { - char *serial_str = GetTextA(hWnd, E_SERIAL); - if (serial_str != NULL) - { - BUF *b = StrToBin(serial_str); - if (b->Size >= 1) - { - ((AUTHROOTCERT *)u->AuthData)->Serial = NewXSerial(b->Buf, b->Size); - } - FreeBuf(b); - Free(serial_str); - } - } - if (IsChecked(hWnd, R_SERIAL) && ((AUTHROOTCERT *)u->AuthData)->Serial == NULL) - { - ok = false; - } - break; - - case AUTHTYPE_RADIUS: - Free(((AUTHRADIUS *)u->AuthData)->RadiusUsername); - ((AUTHRADIUS *)u->AuthData)->RadiusUsername = NULL; - if (IsChecked(hWnd, R_SET_RADIUS_USERNAME) && (IsEmpty(hWnd, E_RADIUS_USERNAME) == false)) - { - ((AUTHRADIUS *)u->AuthData)->RadiusUsername = GetText(hWnd, E_RADIUS_USERNAME); - } - if (IsChecked(hWnd, R_SET_RADIUS_USERNAME) && ((AUTHRADIUS *)u->AuthData)->RadiusUsername == NULL) - { - ok = false; - } - break; - - case AUTHTYPE_NT: - Free(((AUTHNT *)u->AuthData)->NtUsername); - ((AUTHNT *)u->AuthData)->NtUsername = NULL; - if (IsChecked(hWnd, R_SET_RADIUS_USERNAME) && (IsEmpty(hWnd, E_RADIUS_USERNAME) == false)) - { - ((AUTHNT *)u->AuthData)->NtUsername = GetText(hWnd, E_RADIUS_USERNAME); - } - if (IsChecked(hWnd, R_SET_RADIUS_USERNAME) && ((AUTHNT *)u->AuthData)->NtUsername == NULL) - { - ok = false; - } - break; - } - - SetEnable(hWnd, B_POLICY, IsChecked(hWnd, R_POLICY)); - if (IsChecked(hWnd, R_POLICY)) - { - if (u->Policy == NULL) - { - ok = false; - } - } - - SetEnable(hWnd, IDOK, ok); -} - -// Edit User dialog procedure -UINT SmEditUserDlgProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param) -{ - SM_EDIT_USER *s = (SM_EDIT_USER *)param; - NMHDR *n; - POLICY *policy; - X *x = NULL; - wchar_t tmp[MAX_SIZE]; - char name[MAX_SIZE]; - char *ret; - // Validate arguments - if (hWnd == NULL) - { - return 0; - } - - switch (msg) - { - case WM_INITDIALOG: - // Initialize - SmEditUserDlgInit(hWnd, s); - break; - - case WM_COMMAND: - switch (LOWORD(wParam)) - { - case E_USERNAME: - case E_REALNAME: - case E_NOTE: - case R_EXPIRES: - case E_EXPIRES_DATE: - case E_EXPIRES_TIME: - case E_GROUP: - case L_AUTH: - case R_SET_RADIUS_USERNAME: - case E_RADIUS_USERNAME: - case R_POLICY: - case E_PASSWORD1: - case E_PASSWORD2: - case R_CN: - case E_CN: - case R_SERIAL: - case E_SERIAL: - SmEditUserDlgUpdate(hWnd, s); - break; - } - - switch (wParam) - { - case IDOK: - // [OK] button - SmEditUserDlgOk(hWnd, s); - break; - - case IDCANCEL: - // Cancel button - Close(hWnd); - break; - - case B_POLICY: - UniFormat(tmp, sizeof(tmp), _UU("SM_EDIT_USER_POL_DLG"), s->SetUser.Name); - // Policy - if (s->SetUser.Policy == NULL) - { - policy = ClonePolicy(GetDefaultPolicy()); - if (SmPolicyDlgEx2(hWnd, policy, tmp, false, s->p->PolicyVer)) - { - s->SetUser.Policy = policy; - SmEditUserDlgUpdate(hWnd, s); - } - else - { - Free(policy); - } - } - else - { - SmPolicyDlgEx2(hWnd, s->SetUser.Policy, tmp, false, s->p->PolicyVer); - } - break; - - case B_GROUP: - // Browse for a Group - GetTxtA(hWnd, E_GROUP, name, sizeof(name)); - Trim(name); - ret = SmSelectGroupDlg(hWnd, s->Hub, StrLen(name) == 0 ? NULL : name); - if (ret != NULL) - { - SetTextA(hWnd, E_GROUP, ret); - Free(ret); - } - else - { - SetTextA(hWnd, E_GROUP, ""); - } - FocusEx(hWnd, E_GROUP); - break; - - case B_LOAD_CERT: - // Specify the certificate - if (CmLoadXFromFileOrSecureCard(hWnd, &x)) - { -UPDATE_CERT: - if (s->SetUser.AuthType == AUTHTYPE_USERCERT) - { - wchar_t tmp[MAX_SIZE]; - FreeX(((AUTHUSERCERT *)s->SetUser.AuthData)->UserX); - ((AUTHUSERCERT *)s->SetUser.AuthData)->UserX = x; - SmGetCertInfoStr(tmp, sizeof(tmp), x); - SetText(hWnd, S_CERT_INFO, tmp); - SmEditUserDlgUpdate(hWnd, s); - } - else - { - if (x != NULL) - { - FreeX(x); - x = NULL; - } - } - } - break; - - case B_VIEW_CERT: - // Show the certificate - if (s->SetUser.AuthType == AUTHTYPE_USERCERT) - { - CertDlg(hWnd, ((AUTHUSERCERT *)s->SetUser.AuthData)->UserX, NULL, true); - } - break; - - case B_CREATE: - // Create - GetTxtA(hWnd, E_USERNAME, name, sizeof(name)); - Trim(name); - if (SmCreateCert(hWnd, &x, NULL, false, name, false)) - { - if (s->SetUser.AuthType != AUTHTYPE_USERCERT) - { - LvSelect(hWnd, L_AUTH, 2); - } - goto UPDATE_CERT; - } - break; - - case R_SET_RADIUS_USERNAME: - if (IsChecked(hWnd, R_SET_RADIUS_USERNAME)) - { - FocusEx(hWnd, E_RADIUS_USERNAME); - } - break; - - case R_EXPIRES: - if (IsChecked(hWnd, R_EXPIRES)) - { - Focus(hWnd, E_EXPIRES_DATE); - } - break; - - case R_POLICY: - if (IsChecked(hWnd, R_POLICY)) - { - Focus(hWnd, B_POLICY); - } - break; - - case R_CN: - if (IsChecked(hWnd, R_CN)) - { - Focus(hWnd, E_CN); - } - break; - - case R_SERIAL: - if (IsChecked(hWnd, R_SERIAL)) - { - Focus(hWnd, E_SERIAL); - } - break; - } - break; - - case WM_NOTIFY: - n = (NMHDR *)lParam; - switch (n->idFrom) - { - case L_AUTH: - switch (n->code) - { - case LVN_ITEMCHANGED: - SmEditUserDlgUpdate(hWnd, s); - break; - } - break; - } - break; - - case WM_CLOSE: - EndDialog(hWnd, false); - break; - } - - return 0; -} - -// User editing dialog -bool SmEditUserDlg(HWND hWnd, SM_HUB *s, char *username) -{ - SM_EDIT_USER e; - bool ret; - // Validate arguments - if (hWnd == NULL || s == NULL || username == NULL) - { - return false; - } - - Zero(&e, sizeof(e)); - e.p = s->p; - e.Rpc = s->Rpc; - e.Hub = s; - - // Get the User - StrCpy(e.SetUser.HubName, sizeof(e.SetUser.HubName), e.Hub->HubName); - StrCpy(e.SetUser.Name, sizeof(e.SetUser.Name), username); - - if (CALL(hWnd, ScGetUser(s->Rpc, &e.SetUser)) == false) - { - return false; - } - - e.EditMode = true; - - ret = Dialog(hWnd, D_SM_EDIT_USER, SmEditUserDlgProc, &e); - - FreeRpcSetUser(&e.SetUser); - - return ret; -} - -// New user creation dialog -bool SmCreateUserDlg(HWND hWnd, SM_HUB *s) -{ - SM_EDIT_USER e; - bool ret; - // Validate arguments - if (hWnd == NULL || s == NULL) - { - return false; - } - - Zero(&e, sizeof(e)); - e.EditMode = false; - e.p = s->p; - e.Rpc = s->Rpc; - e.Hub = s; - - // Set up a new user - StrCpy(e.SetUser.HubName, sizeof(e.SetUser.HubName), e.Hub->HubName); - e.SetUser.AuthType = CLIENT_AUTHTYPE_PASSWORD; - e.SetUser.AuthData = NewPasswordAuthData("", ""); - - ret = Dialog(hWnd, D_SM_EDIT_USER, SmEditUserDlgProc, &e); - - FreeRpcSetUser(&e.SetUser); - - return ret; -} - -// Get a string of user authentication method -wchar_t *SmGetAuthTypeStr(UINT id) -{ - return GetAuthTypeStr(id); -} - -// User list initialization -void SmUserListInit(HWND hWnd, SM_USER *s) -{ - wchar_t tmp1[MAX_SIZE]; - wchar_t tmp2[MAX_SIZE]; - // Validate arguments - if (hWnd == NULL || s == NULL) - { - return; - } - - SetIcon(hWnd, 0, ICO_USER); - - // Initialize the column - LvInit(hWnd, L_USER); - LvSetStyle(hWnd, L_USER, LVS_EX_GRIDLINES); - LvInsertColumn(hWnd, L_USER, 0, _UU("SM_USER_COLUMN_1"), 120); - LvInsertColumn(hWnd, L_USER, 1, _UU("SM_USER_COLUMN_2"), 100); - LvInsertColumn(hWnd, L_USER, 2, _UU("SM_USER_COLUMN_3"), 100); - LvInsertColumn(hWnd, L_USER, 3, _UU("SM_USER_COLUMN_4"), 130); - LvInsertColumn(hWnd, L_USER, 4, _UU("SM_USER_COLUMN_5"), 100); - LvInsertColumn(hWnd, L_USER, 5, _UU("SM_USER_COLUMN_6"), 90); - LvInsertColumn(hWnd, L_USER, 6, _UU("SM_USER_COLUMN_7"), 120); - LvInsertColumn(hWnd, L_USER, 7, _UU("SM_LICENSE_COLUMN_5"), 120); - LvInsertColumn(hWnd, L_USER, 8, _UU("SM_SESS_COLUMN_6"), 100); - LvInsertColumn(hWnd, L_USER, 9, _UU("SM_SESS_COLUMN_7"), 100); - - FormatText(hWnd, S_TITLE, s->Hub->HubName); - - if (s->GroupName != NULL) - { - GetTxt(hWnd, 0, tmp1, sizeof(tmp1)); - UniFormat(tmp2, sizeof(tmp2), _UU("SM_GROUP_MEMBER_STR"), s->GroupName); - UniStrCat(tmp1, sizeof(tmp1), tmp2); - SetText(hWnd, S_TITLE, tmp1); - Disable(hWnd, B_CREATE); - } - - if (s->SelectMode) - { - SetStyle(hWnd, L_USER, LVS_SINGLESEL); - } - - SmUserListRefresh(hWnd, s); - - if (s->SelectMode) - { - wchar_t tmp[MAX_SIZE]; - UINT i; - StrToUni(tmp, sizeof(tmp), s->SelectedName); - i = LvSearchStr(hWnd, L_USER, 0, tmp); - if (i != INFINITE) - { - LvSelect(hWnd, L_USER, i); - } - - if (s->AllowGroup) - { - SetText(hWnd, B_DELETE, _UU("SM_SELECT_ALT_GROUP")); - } - } -} - -// User list update -void SmUserListRefresh(HWND hWnd, SM_USER *s) -{ - LVB *b; - RPC_ENUM_USER t; - UINT i; - // Validate arguments - if (hWnd == NULL || s == NULL) - { - return; - } - - Zero(&t, sizeof(t)); - - StrCpy(t.HubName, sizeof(t.HubName), s->Hub->HubName); - if (CALL(hWnd, ScEnumUser(s->Rpc, &t)) == false) - { - EndDialog(hWnd, false); - return; - } - - b = LvInsertStart(); - - for (i = 0;i < t.NumUser;i++) - { - RPC_ENUM_USER_ITEM *e = &t.Users[i]; - wchar_t name[MAX_SIZE]; - wchar_t group[MAX_SIZE]; - wchar_t num[MAX_SIZE]; - wchar_t time[MAX_SIZE]; - wchar_t exp[MAX_SIZE]; - wchar_t num1[64], num2[64]; - - if (s->GroupName != NULL) - { - if (StrCmpi(s->GroupName, e->GroupName) != 0) - { - continue; - } - } - - StrToUni(name, sizeof(name), e->Name); - - if (StrLen(e->GroupName) != 0) - { - StrToUni(group, sizeof(group), e->GroupName); - } - else - { - UniStrCpy(group, sizeof(group), _UU("SM_NO_GROUP")); - } - - UniToStru(num, e->NumLogin); - - GetDateTimeStrEx64(time, sizeof(time), SystemToLocal64(e->LastLoginTime), NULL); - - if (e->IsExpiresFilled == false) - { - UniStrCpy(exp, sizeof(exp), _UU("CM_ST_NONE")); - } - else - { - if (e->Expires == 0) - { - UniStrCpy(exp, sizeof(exp), _UU("SM_LICENSE_NO_EXPIRES")); - } - else - { - GetDateTimeStrEx64(exp, sizeof(exp), SystemToLocal64(e->Expires), NULL); - } - } - - if (e->IsTrafficFilled == false) - { - UniStrCpy(num1, sizeof(num1), _UU("CM_ST_NONE")); - UniStrCpy(num2, sizeof(num2), _UU("CM_ST_NONE")); - } - else - { - UniToStr3(num1, sizeof(num1), - e->Traffic.Recv.BroadcastBytes + e->Traffic.Recv.UnicastBytes + - e->Traffic.Send.BroadcastBytes + e->Traffic.Send.UnicastBytes); - - UniToStr3(num2, sizeof(num2), - e->Traffic.Recv.BroadcastCount + e->Traffic.Recv.UnicastCount + - e->Traffic.Send.BroadcastBytes + e->Traffic.Send.UnicastCount); - } - - LvInsertAdd(b, e->DenyAccess ? ICO_USER_DENY : ICO_USER, NULL, 10, - name, e->Realname, group, e->Note, SmGetAuthTypeStr(e->AuthType), - num, time, exp, num1, num2); - } - - LvInsertEnd(b, hWnd, L_USER); - - FreeRpcEnumUser(&t); - - SmUserListUpdate(hWnd, s); -} - -// User list control update -void SmUserListUpdate(HWND hWnd, SM_USER *s) -{ - bool b = true; - // Validate arguments - if (hWnd == NULL || s == NULL) - { - return; - } - - if (LvIsSelected(hWnd, L_USER) == false || LvIsMultiMasked(hWnd, L_USER)) - { - b = false; - } - - if (s->SelectMode) - { - SetText(hWnd, IDOK, _UU("SM_SELECT_USER")); - SetText(hWnd, IDCANCEL, _UU("SM_SELECT_NO")); - SetText(hWnd, S_TITLE, _UU("SM_PLEASE_SELECT")); - } - - SetEnable(hWnd, IDOK, b); - - SetEnable(hWnd, B_STATUS, b); - SetEnable(hWnd, B_DELETE, (b && s->SelectedName == false) || s->AllowGroup); - SetEnable(hWnd, B_CREATE, s->SelectedName == false); -} - -// User List dialog procedure -UINT SmUserListProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param) -{ - SM_USER *s = (SM_USER *)param; - NMHDR *n; - wchar_t *str; - // Validate arguments - if (hWnd == NULL) - { - return 0; - } - - switch (msg) - { - case WM_INITDIALOG: - // Initialize - SmUserListInit(hWnd, s); - - if (s->CreateNow) - { - // Create instantly - if (IsEnable(hWnd, B_CREATE)) - { - Command(hWnd, B_CREATE); - } - } - break; - - case WM_COMMAND: - switch (wParam) - { - case IDOK: - if (s->SelectMode == false) - { - // Property - str = LvGetSelectedStr(hWnd, L_USER, 0); - if (str != NULL) - { - char name[MAX_SIZE]; - UniToStr(name, sizeof(name), str); - - if (SmEditUserDlg(hWnd, s->Hub, name)) - { - SmUserListRefresh(hWnd, s); - } - - Free(str); - } - } - else - { - // The user has been chosen - str = LvGetSelectedStr(hWnd, L_USER, 0); - if (str != NULL) - { - char name[MAX_SIZE]; - UniToStr(name, sizeof(name), str); - - s->SelectedName = CopyStr(name); - - EndDialog(hWnd, true); - - Free(str); - } - } - break; - - case B_CREATE: - // Create new - if (SmCreateUserDlg(hWnd, s->Hub)) - { - SmUserListRefresh(hWnd, s); - } - break; - - case B_DELETE: - if (s->AllowGroup) - { - // Group selection - EndDialog(hWnd, INFINITE); - } - else - { - // Delete - str = LvGetSelectedStr(hWnd, L_USER, 0); - if (str != NULL) - { - RPC_DELETE_USER t; - char name[MAX_SIZE]; - UniToStr(name, sizeof(name), str); - - Zero(&t, sizeof(t)); - StrCpy(t.HubName, sizeof(t.HubName), s->Hub->HubName); - StrCpy(t.Name, sizeof(t.Name), name); - - if (MsgBoxEx(hWnd, MB_YESNO | MB_DEFBUTTON2 | MB_ICONQUESTION, - _UU("SM_USER_DELETE_MSG"), str) == IDYES) - { - if (CALL(hWnd, ScDeleteUser(s->Rpc, &t))) - { - SmUserListRefresh(hWnd, s); - } - } - - Free(str); - } - } - break; - - case B_STATUS: - // Display the User Information - str = LvGetSelectedStr(hWnd, L_USER, 0); - if (str != NULL) - { - char name[MAX_SIZE]; - wchar_t tmp[MAX_SIZE]; - SM_USER_INFO info; - UniToStr(name, sizeof(name), str); - - UniFormat(tmp, sizeof(tmp), _UU("SM_USERINFO_CAPTION"), name); - - Zero(&info, sizeof(info)); - info.p = s->p; - info.Rpc = s->Rpc; - info.Hub = s->Hub; - info.Username = name; - - SmStatusDlg(hWnd, s->p, &info, false, true, tmp, ICO_USER, NULL, SmRefreshUserInfo); - - Free(str); - } - break; - break; - - case B_REFRESH: - // Update - SmUserListRefresh(hWnd, s); - break; - - case IDCANCEL: - // Cancel button - Close(hWnd); - break; - } - break; - - case WM_NOTIFY: - n = (NMHDR *)lParam; - switch (n->idFrom) - { - case L_USER: - switch (n->code) - { - case LVN_ITEMCHANGED: - // Update the control - SmUserListUpdate(hWnd, s); - break; - } - break; - } - break; - - case WM_CLOSE: - EndDialog(hWnd, false); - break; - } - - LvStandardHandler(hWnd, msg, wParam, lParam, L_USER); - - return 0; -} - -// User List dialog (selection) -char *SmSelectUserDlg(HWND hWnd, SM_HUB *s, char *default_name) -{ - return SmSelectUserDlgEx(hWnd, s, default_name, false); -} -char *SmSelectUserDlgEx(HWND hWnd, SM_HUB *s, char *default_name, bool allow_group) -{ - UINT ret; - SM_USER user; - // Validate arguments - if (hWnd == NULL || s == NULL) - { - return NULL; - } - - Zero(&user, sizeof(user)); - user.Hub = s; - user.p = s->p; - user.Rpc = s->Rpc; - user.GroupName = NULL; - user.SelectedName = default_name; - user.SelectMode = true; - user.AllowGroup = allow_group; - - ret = Dialog(hWnd, D_SM_USER, SmUserListProc, &user); - - if (ret == 0) - { - return NULL; - } - else if (ret == INFINITE) - { - // Select a Group - return SmSelectGroupDlg(hWnd, s, default_name); - } - else - { - return user.SelectedName; - } -} - -// User List dialog (filtered by group name) -void SmUserListDlgEx(HWND hWnd, SM_HUB *s, char *groupname, bool create) -{ - SM_USER user; - // Validate arguments - if (hWnd == NULL || s == NULL) - { - return; - } - - Zero(&user, sizeof(user)); - user.Hub = s; - user.p = s->p; - user.Rpc = s->Rpc; - user.GroupName = groupname; - user.CreateNow = create; - - Dialog(hWnd, D_SM_USER, SmUserListProc, &user); -} - -// User List dialog -void SmUserListDlg(HWND hWnd, SM_HUB *s) -{ - SmUserListDlgEx(hWnd, s, NULL, false); -} - -// Initialize -void SmHubDlgInit(HWND hWnd, SM_HUB *s) -{ - CAPSLIST *caps; - bool support_user, support_group, support_accesslist, support_cascade, - support_log, support_config_hub, support_secure_nat, support_config_radius; - // Validate arguments - if (hWnd == NULL || s == NULL) - { - return; - } - - FormatText(hWnd, 0, s->HubName); - FormatText(hWnd, S_TITLE, s->HubName); - SetIcon(hWnd, 0, ICO_HUB); - DlgFont(hWnd, S_TITLE, 15, true); - - LvInit(hWnd, L_STATUS); - LvSetStyle(hWnd, L_STATUS, LVS_EX_GRIDLINES); - LvInsertColumn(hWnd, L_STATUS, 0, _UU("SM_STATUS_COLUMN_1"), 0); - LvInsertColumn(hWnd, L_STATUS, 1, _UU("SM_STATUS_COLUMN_2"), 0); - - caps = s->p->CapsList; - - support_user = GetCapsInt(caps, "i_max_users_per_hub") == 0 ? false : true; - support_group = GetCapsInt(caps, "i_max_groups_per_hub") == 0 ? false : true; - support_accesslist = GetCapsInt(caps, "i_max_access_lists") == 0 ? false : true; - support_cascade = GetCapsBool(caps, "b_support_cascade"); - support_log = GetCapsBool(caps, "b_support_config_log"); - support_config_hub = GetCapsBool(caps, "b_support_config_hub"); - support_secure_nat = GetCapsBool(caps, "b_support_securenat"); - support_config_radius = GetCapsBool(caps, "b_support_radius"); - - SetEnable(hWnd, B_USER, support_user); - SetEnable(hWnd, S_USER, support_user); - - SetEnable(hWnd, B_GROUP, support_group); - SetEnable(hWnd, S_GROUP, support_group); - - SetEnable(hWnd, B_ACCESS, support_accesslist); - SetEnable(hWnd, S_ACCESS, support_accesslist); - - SetEnable(hWnd, B_PROPERTY, s->p->ServerType != SERVER_TYPE_FARM_MEMBER); - SetEnable(hWnd, S_PROPERTY, s->p->ServerType != SERVER_TYPE_FARM_MEMBER); - - SetEnable(hWnd, B_RADIUS, support_config_radius); - SetEnable(hWnd, S_RADIUS, support_config_radius); - - SetEnable(hWnd, B_LINK, support_cascade); - SetEnable(hWnd, S_LINK, support_cascade); - - SetEnable(hWnd, B_LOG, support_log); - SetEnable(hWnd, S_LOG, support_log); - - SetEnable(hWnd, B_CA, support_config_hub); - SetEnable(hWnd, S_CA, support_config_hub); - - SetEnable(hWnd, B_SNAT, support_secure_nat); - SetEnable(hWnd, S_SNAT, support_secure_nat); - - SetEnable(hWnd, B_CRL, GetCapsBool(caps, "b_support_crl")); - - SetEnable(hWnd, B_LOG_FILE, GetCapsBool(caps, "b_support_read_log")); - - SmHubDlgRefresh(hWnd, s); -} - -// Update the control -void SmHubDlgUpdate(HWND hWnd, SM_HUB *s) -{ - // Validate arguments - if (hWnd == NULL || s == NULL) - { - return; - } -} - -// Content update -void SmHubDlgRefresh(HWND hWnd, SM_HUB *s) -{ - // Validate arguments - if (hWnd == NULL || s == NULL) - { - return; - } - - SmRefreshHubStatus(hWnd, s->p, (void *)s->HubName); - LvAutoSize(hWnd, L_STATUS); - - SmHubDlgUpdate(hWnd, s); -} - -// HUB management dialog -UINT SmHubDlgProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param) -{ - SM_HUB *s = (SM_HUB *)param; - // Validate arguments - if (hWnd == NULL) - { - return 0; - } - - switch (msg) - { - case WM_INITDIALOG: - // Initialize - SmHubDlgInit(hWnd, s); - break; - - case WM_COMMAND: - switch (wParam) - { - case B_USER: - // User - SmUserListDlg(hWnd, s); - SmHubDlgRefresh(hWnd, s); - break; - - case B_GROUP: - // Group - SmGroupListDlg(hWnd, s); - SmHubDlgRefresh(hWnd, s); - break; - - case B_ACCESS: - // Access list - SmAccessListDlg(hWnd, s); - SmHubDlgRefresh(hWnd, s); - break; - - case B_PROPERTY: - // Property - if (SmEditHubDlg(hWnd, s->p, s->HubName)) - { - SmHubDlgRefresh(hWnd, s); - } - break; - - case B_RADIUS: - // Radius - SmRadiusDlg(hWnd, s); - SmHubDlgRefresh(hWnd, s); - break; - - case B_LINK: - // Cascade - SmLinkDlg(hWnd, s); - SmHubDlgRefresh(hWnd, s); - break; - - case B_SESSION: - // Session - SmSessionDlg(hWnd, s); - SmHubDlgRefresh(hWnd, s); - break; - - case B_LOG: - // Log - Dialog(hWnd, D_SM_LOG, SmLogDlg, s); - SmHubDlgRefresh(hWnd, s); - break; - - case B_CA: - // CA - SmCaDlg(hWnd, s); - SmHubDlgRefresh(hWnd, s); - break; - - case IDCANCEL: - // Cancel button - Close(hWnd); - break; - - case B_REFRESH: - // Update - SmHubDlgRefresh(hWnd, s); - break; - - case B_SNAT: - // SecureNAT - Dialog(hWnd, D_SM_SNAT, SmSNATDlgProc, s); - SmHubDlgRefresh(hWnd, s); - break; - - case B_CRL: - // Certificate revocation list - Dialog(hWnd, D_SM_CRL, SmCrlDlgProc, s); - break; - - case B_LOG_FILE: - // Log file - Dialog(hWnd, D_SM_LOG_FILE, SmLogFileDlgProc, s->p); - break; - } - break; - - case WM_CLOSE: - EndDialog(hWnd, false); - break; - } - - return 0; -} - -// Management of HUB -void SmHubDlg(HWND hWnd, SM_HUB *s) -{ - // Validate arguments - if (hWnd == NULL || s == NULL) - { - return; - } - - Dialog(hWnd, D_SM_HUB, SmHubDlgProc, s); -} - -// Change the server password -UINT SmChangeServerPasswordDlg(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param) -{ - SM_SERVER *p = (SM_SERVER *)param; - char tmp1[MAX_SIZE]; - char tmp2[MAX_SIZE]; - UCHAR hash[SHA1_SIZE]; - RPC_SET_PASSWORD t; - SETTING *setting; - // Validate arguments - if (hWnd == NULL) - { - return 0; - } - - switch (msg) - { - case WM_INITDIALOG: - // Initialize - SetIcon(hWnd, 0, ICO_USER_ADMIN); - FormatText(hWnd, 0, p->ServerName); - FormatText(hWnd, S_TITLE, p->ServerName); - Focus(hWnd, E_PASSWORD1); - break; - - case WM_COMMAND: - switch (LOWORD(wParam)) - { - case E_PASSWORD1: - case E_PASSWORD2: - GetTxtA(hWnd, E_PASSWORD1, tmp1, sizeof(tmp1)); - GetTxtA(hWnd, E_PASSWORD2, tmp2, sizeof(tmp2)); - - if (StrLen(tmp1) == 0 || StrLen(tmp2) == 0) - { - Disable(hWnd, IDOK); - } - else - { - Enable(hWnd, IDOK); - } - break; - } - - switch (wParam) - { - case IDOK: - // [OK] button - GetTxtA(hWnd, E_PASSWORD1, tmp1, sizeof(tmp1)); - GetTxtA(hWnd, E_PASSWORD2, tmp2, sizeof(tmp2)); - if (StrCmp(tmp1, tmp2) != 0) - { - MsgBox(hWnd, MB_ICONSTOP, _UU("SM_CHANGE_PASSWORD_1")); - FocusEx(hWnd, E_PASSWORD2); - break; - } - if (StrLen(tmp1) == 0) - { - if (MsgBox(hWnd, MB_ICONEXCLAMATION | MB_YESNO | MB_DEFBUTTON2, _UU("SM_CHANGE_PASSWORD_2")) == IDNO) - { - Focus(hWnd, E_PASSWORD1); - break; - } - } - Zero(&t, sizeof(t)); - Sha0(t.HashedPassword, tmp1, StrLen(tmp1)); - Copy(hash, t.HashedPassword, sizeof(hash)); - if (CALL(hWnd, ScSetServerPassword(p->Rpc, &t)) == false) - { - break; - } - MsgBox(hWnd, MB_ICONINFORMATION, _UU("SM_CHANGE_PASSWORD_3")); - - // Change the password for the connection setting - setting = SmGetSetting(p->CurrentSetting->Title); - if (setting != NULL && sm->TempSetting == NULL) - { - if (IsZero(setting->HashedPassword, SHA1_SIZE) == false) - { - Copy(setting->HashedPassword, hash, SHA1_SIZE); - SmWriteSettingList(); - } - } - - EndDialog(hWnd, true); - break; - - case IDCANCEL: - // Cancel button - Close(hWnd); - break; - } - break; - - case WM_CLOSE: - EndDialog(hWnd, false); - break; - } - - return 0; -} - -// Update the status of the connection to the server farm controller -bool SmRefreshFarmConnectionInfo(HWND hWnd, SM_SERVER *p, void *param) -{ - RPC_FARM_CONNECTION_STATUS t; - LVB *b; - wchar_t tmp[MAX_SIZE]; - char str[MAX_SIZE]; - // Validate arguments - if (hWnd == NULL || p == NULL) - { - return false; - } - - Zero(&t, sizeof(t)); - if (CALL(hWnd, ScGetFarmConnectionStatus(p->Rpc, &t)) == false) - { - return false; - } - - b = LvInsertStart(); - - if (t.Online == false) - { - LvInsertAdd(b, ICO_FARM, NULL, 2, _UU("SM_FC_IP"), _UU("SM_FC_NOT_CONNECTED")); - - LvInsertAdd(b, ICO_PROTOCOL, NULL, 2, _UU("SM_FC_PORT"), _UU("SM_FC_NOT_CONNECTED")); - } - else - { - IPToStr32(str, sizeof(str), t.Ip); - StrToUni(tmp, sizeof(tmp), str); - LvInsertAdd(b, ICO_FARM, NULL, 2, _UU("SM_FC_IP"), tmp); - - UniToStru(tmp, t.Port); - LvInsertAdd(b, ICO_PROTOCOL, NULL, 2, _UU("SM_FC_PORT"), tmp); - } - - LvInsertAdd(b, - t.Online ? ICO_SERVER_ONLINE_EX : ICO_PROTOCOL_X, NULL, 2, - _UU("SM_FC_STATUS"), - t.Online ? _UU("SM_FC_ONLINE") : _UU("SM_FC_OFFLINE")); - - if (t.Online == false) - { - UniFormat(tmp, sizeof(tmp), _UU("SM_FC_ERROR_TAG"), _E(t.LastError), t.LastError); - LvInsertAdd(b, ICO_STOP, NULL, 2, - _UU("SM_FC_LAST_ERROR"), tmp); - } - - GetDateTimeStrEx64(tmp, sizeof(tmp), SystemToLocal64(t.StartedTime), NULL); - LvInsertAdd(b, ICO_INFORMATION, NULL, 2, _UU("SM_FC_START_TIME"), tmp); - - GetDateTimeStrEx64(tmp, sizeof(tmp), SystemToLocal64(t.FirstConnectedTime), NULL); - LvInsertAdd(b, ICO_INFORMATION, NULL, 2, _UU("SM_FC_FIRST_TIME"), tmp); - - //if (t.Online == false) - { - GetDateTimeStrEx64(tmp, sizeof(tmp), SystemToLocal64(t.CurrentConnectedTime), NULL); - LvInsertAdd(b, ICO_INFORMATION, NULL, 2, _UU("SM_FC_CURRENT_TIME"), tmp); - } - - UniToStru(tmp, t.NumTry); - LvInsertAdd(b, ICO_PROTOCOL, NULL, 2, _UU("SM_FC_NUM_TRY"), tmp); - - UniToStru(tmp, t.NumConnected); - LvInsertAdd(b, ICO_PROTOCOL, NULL, 2, _UU("SM_FC_NUM_CONNECTED"), tmp); - - UniToStru(tmp, t.NumFailed); - LvInsertAdd(b, ICO_PROTOCOL, NULL, 2, _UU("SM_FC_NUM_FAILED"), tmp); - - LvInsertEnd(b, hWnd, L_STATUS); - - return true; -} - -// Initialize -void SmFarmMemberDlgInit(HWND hWnd, SM_SERVER *p) -{ - // Validate arguments - if (hWnd == NULL || p == NULL) - { - return; - } - - SetIcon(hWnd, 0, ICO_FARM); - - FormatText(hWnd, S_TITLE, p->ServerName); - - // Initialize the column - LvInit(hWnd, L_FARM_MEMBER); - LvSetStyle(hWnd, L_FARM_MEMBER, LVS_EX_GRIDLINES); - LvInsertColumn(hWnd, L_FARM_MEMBER, 0, _UU("SM_FM_COLUMN_1"), 90); - LvInsertColumn(hWnd, L_FARM_MEMBER, 1, _UU("SM_FM_COLUMN_2"), 150); - LvInsertColumn(hWnd, L_FARM_MEMBER, 2, _UU("SM_FM_COLUMN_3"), 140); - LvInsertColumn(hWnd, L_FARM_MEMBER, 3, _UU("SM_FM_COLUMN_4"), 60); - LvInsertColumn(hWnd, L_FARM_MEMBER, 4, _UU("SM_FM_COLUMN_5"), 80); - LvInsertColumn(hWnd, L_FARM_MEMBER, 5, _UU("SM_FM_COLUMN_6"), 80); - LvInsertColumn(hWnd, L_FARM_MEMBER, 6, _UU("SM_FM_COLUMN_7"), 80); - LvInsertColumn(hWnd, L_FARM_MEMBER, 7, _UU("SM_FM_COLUMN_8"), 160); - LvInsertColumn(hWnd, L_FARM_MEMBER, 8, _UU("SM_FM_COLUMN_9"), 160); - - SmFarmMemberDlgRefresh(hWnd, p); -} - -// Update -void SmFarmMemberDlgUpdate(HWND hWnd, SM_SERVER *p) -{ - // Validate arguments - if (hWnd == NULL || p == NULL) - { - return; - } - - SetEnable(hWnd, IDOK, LvIsSelected(hWnd, L_FARM_MEMBER) && (LvIsMultiMasked(hWnd, L_FARM_MEMBER) == false)); - SetEnable(hWnd, B_CERT, LvIsSelected(hWnd, L_FARM_MEMBER) && (LvIsMultiMasked(hWnd, L_FARM_MEMBER) == false)); -} - -// Content update -void SmFarmMemberDlgRefresh(HWND hWnd, SM_SERVER *p) -{ - RPC_ENUM_FARM t; - UINT i; - // Validate arguments - if (hWnd == NULL || p == NULL) - { - return; - } - - Zero(&t, sizeof(t)); - if (CALL(hWnd, ScEnumFarmMember(p->Rpc, &t)) == false) - { - EndDialog(hWnd, false); - return; - } - - LvReset(hWnd, L_FARM_MEMBER); - - for (i = 0;i < t.NumFarm;i++) - { - RPC_ENUM_FARM_ITEM *e = &t.Farms[i]; - wchar_t tmp1[MAX_SIZE]; - wchar_t tmp2[MAX_SIZE]; - wchar_t tmp3[64]; - wchar_t tmp4[64]; - wchar_t tmp5[64]; - wchar_t tmp6[64]; - wchar_t tmp7[64]; - wchar_t tmp8[64]; - - GetDateTimeStrEx64(tmp1, sizeof(tmp1), SystemToLocal64(e->ConnectedTime), NULL); - StrToUni(tmp2, sizeof(tmp2), e->Hostname); - UniToStru(tmp3, e->Point); - UniToStru(tmp4, e->NumSessions); - UniToStru(tmp5, e->NumTcpConnections); - UniToStru(tmp6, e->NumHubs); - UniToStru(tmp7, e->AssignedClientLicense); - UniToStru(tmp8, e->AssignedBridgeLicense); - - LvInsert(hWnd, L_FARM_MEMBER, e->Controller ? ICO_FARM : ICO_TOWER, (void *)e->Id, 9, - e->Controller ? _UU("SM_FM_CONTROLLER") : _UU("SM_FM_MEMBER"), - tmp1, tmp2, tmp3, tmp4, tmp5, tmp6, tmp7, tmp8); - } - - FreeRpcEnumFarm(&t); - - SmFarmMemberDlgUpdate(hWnd, p); -} - -// [OK] button -void SmFarmMemberDlgOnOk(HWND hWnd, SM_SERVER *p) -{ - // Validate arguments - if (hWnd == NULL || p == NULL) - { - return; - } - -} - -// Display the farm member certificate -void SmFarmMemberCert(HWND hWnd, SM_SERVER *p, UINT id) -{ - RPC_FARM_INFO t; - // Validate arguments - if (hWnd == NULL || p == NULL || id == 0) - { - return; - } - - Zero(&t, sizeof(t)); - t.Id = id; - - if (CALL(hWnd, ScGetFarmInfo(p->Rpc, &t)) == false) - { - return; - } - - CertDlg(hWnd, t.ServerCert, NULL, true); - - FreeRpcFarmInfo(&t); -} - -// Update the farm member information -bool SmRefreshFarmMemberInfo(HWND hWnd, SM_SERVER *p, void *param) -{ - RPC_FARM_INFO t; - UINT id = (UINT)param; - LVB *b; - UINT i; - wchar_t tmp[MAX_SIZE]; - char str[MAX_SIZE]; - // Validate arguments - if (hWnd == NULL || p == NULL || id == 0) - { - return false; - } - - Zero(&t, sizeof(t)); - t.Id = id; - - if (CALL(hWnd, ScGetFarmInfo(p->Rpc, &t)) == false) - { - return false; - } - - b = LvInsertStart(); - - LvInsertAdd(b, ICO_FARM, NULL, 2, _UU("SM_FMINFO_TYPE"), - t.Controller ? _UU("SM_FARM_CONTROLLER") : _UU("SM_FARM_MEMBER")); - - GetDateTimeStrEx64(tmp, sizeof(tmp), SystemToLocal64(t.ConnectedTime), NULL); - LvInsertAdd(b, ICO_INFORMATION, NULL, 2, _UU("SM_FMINFO_CONNECT_TIME"), tmp); - - IPToStr32(str, sizeof(str), t.Ip); - StrToUni(tmp, sizeof(tmp), str); - LvInsertAdd(b, ICO_PROTOCOL, NULL, 2, _UU("SM_FMINFO_IP"), tmp); - - StrToUni(tmp, sizeof(tmp), t.Hostname); - LvInsertAdd(b, ICO_TOWER, NULL, 2, _UU("SM_FMINFO_HOSTNAME"), tmp); - - UniToStru(tmp, t.Point); - LvInsertAdd(b, ICO_TEST, NULL, 2, _UU("SM_FMINFO_POINT"), tmp); - - UniToStru(tmp, t.Weight); - LvInsertAdd(b, ICO_MACHINE, NULL, 2, _UU("SM_FMINFO_WEIGHT"), tmp); - - UniToStru(tmp, t.NumPort); - LvInsertAdd(b, ICO_PROTOCOL, NULL, 2, _UU("SM_FMINFO_NUM_PORT"), tmp); - - for (i = 0;i < t.NumPort;i++) - { - wchar_t tmp2[MAX_SIZE]; - UniFormat(tmp, sizeof(tmp), _UU("SM_FMINFO_PORT"), i + 1); - UniToStru(tmp2, t.Ports[i]); - LvInsertAdd(b, ICO_PROTOCOL, NULL, 2, tmp, tmp2); - } - - UniToStru(tmp, t.NumFarmHub); - LvInsertAdd(b, ICO_HUB_OFFLINE, NULL, 2, _UU("SM_FMINFO_NUM_HUB"), tmp); - - for (i = 0;i < t.NumFarmHub;i++) - { - wchar_t tmp2[MAX_SIZE]; - UniFormat(tmp, sizeof(tmp), _UU("SM_FMINFO_HUB"), i + 1); - UniFormat(tmp2, sizeof(tmp2), - t.FarmHubs[i].DynamicHub ? _UU("SM_FMINFO_HUB_TAG_2") : _UU("SM_FMINFO_HUB_TAG_1"), - t.FarmHubs[i].HubName); - LvInsertAdd(b, ICO_HUB, NULL, 2, tmp, tmp2); - } - - UniToStru(tmp, t.NumSessions); - LvInsertAdd(b, ICO_VPN, NULL, 2, _UU("SM_FMINFO_NUM_SESSION"), tmp); - - UniToStru(tmp, t.NumTcpConnections); - LvInsertAdd(b, ICO_PROTOCOL, NULL, 2, _UU("SM_FMINFO_NUN_CONNECTION"), tmp); - - LvInsertEnd(b, hWnd, L_STATUS); - - FreeRpcFarmInfo(&t); - - return true; -} - -// Farm Member List dialog -UINT SmFarmMemberDlgProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param) -{ - SM_SERVER *p = (SM_SERVER *)param; - NMHDR *n; - UINT i; - // Validate arguments - if (hWnd == NULL) - { - return 0; - } - - switch (msg) - { - case WM_INITDIALOG: - // Initialize - SmFarmMemberDlgInit(hWnd, p); - break; - - case WM_COMMAND: - switch (wParam) - { - case IDOK: - // Display the information of farm members - i = LvGetSelected(hWnd, L_FARM_MEMBER); - if (i != INFINITE) - { - SmStatusDlg(hWnd, p, LvGetParam(hWnd, L_FARM_MEMBER, i), false, true, - _UU("SM_FMINFO_CAPTION"), ICO_FARM, NULL, SmRefreshFarmMemberInfo); - } - break; - - case B_CERT: - // Show the Server Certificate - i = LvGetSelected(hWnd, L_FARM_MEMBER); - if (i != INFINITE) - { - SmFarmMemberCert(hWnd, p, (UINT)LvGetParam(hWnd, L_FARM_MEMBER, i)); - } - break; - - case IDCANCEL: - // Cancel button - Close(hWnd); - break; - - case B_REFRESH: - // Update - SmFarmMemberDlgRefresh(hWnd, p); - break; - } - break; - - case WM_NOTIFY: - n = (NMHDR *)lParam; - switch (n->code) - { - case LVN_ITEMCHANGED: - switch (n->idFrom) - { - case L_FARM_MEMBER: - SmFarmMemberDlgUpdate(hWnd, p); - break; - } - break; - } - break; - - case WM_CLOSE: - EndDialog(hWnd, false); - break; - } - - LvStandardHandler(hWnd, msg, wParam, lParam, L_FARM_MEMBER); - - return 0; -} - -// Initialize the dialog -void SmFarmDlgInit(HWND hWnd, SM_SERVER *p) -{ - RPC_FARM t; - // Validate arguments - if (hWnd == NULL || p == NULL) - { - return; - } - - SetIcon(hWnd, 0, ICO_FARM); - - // Get the current settings - Zero(&t, sizeof(t)); - if (CALL(hWnd, ScGetFarmSetting(p->Rpc, &t)) == false) - { - EndDialog(hWnd, false); - return; - } - - if (t.Weight == 0) - { - t.Weight = FARM_DEFAULT_WEIGHT; - } - - FormatText(hWnd, S_TITLE, p->ServerName); - DlgFont(hWnd, S_CURRENT, 11, true); - - SetText(hWnd, S_CURRENT, GetServerTypeStr(t.ServerType)); - - switch (t.ServerType) - { - case SERVER_TYPE_FARM_CONTROLLER: - Check(hWnd, R_CONTROLLER, true); - break; - - case SERVER_TYPE_FARM_MEMBER: - Check(hWnd, R_MEMBER, true); - break; - - default: - Check(hWnd, R_STANDALONE, true); - break; - } - - SetInt(hWnd, E_WEIGHT, t.Weight); - - if (t.ServerType == SERVER_TYPE_FARM_CONTROLLER) - { - Check(hWnd, R_CONTROLLER_ONLY, t.ControllerOnly); - } - - if (t.ServerType == SERVER_TYPE_FARM_MEMBER) - { - char tmp[MAX_PUBLIC_PORT_NUM * 8]; - UINT i; - if (t.PublicIp != 0) - { - IpSet(hWnd, E_IP, t.PublicIp); - } - StrCpy(tmp, sizeof(tmp), ""); - if (t.NumPort != 0) - { - for (i = 0;i < t.NumPort;i++) - { - Format(tmp, sizeof(tmp), "%s%u", tmp, t.Ports[i]); - if (i != (t.NumPort - 1)) - { - StrCat(tmp, sizeof(tmp), ", "); - } - } - SetTextA(hWnd, E_PORT, tmp); - } - SetTextA(hWnd, E_CONTROLLER, t.ControllerName); - SetIntEx(hWnd, E_CONTROLLER_PORT, t.ControllerPort); - SetTextA(hWnd, E_PASSWORD, HIDDEN_PASSWORD); - } - else - { - // Write the port list - RPC_LISTENER_LIST t; - char tmp[MAX_PUBLIC_PORT_NUM * 8]; - Zero(&t, sizeof(t)); - StrCpy(tmp, sizeof(tmp), ""); - if (CALL(hWnd, ScEnumListener(p->Rpc, &t))) - { - UINT i; - if (t.NumPort != 0) - { - for (i = 0;i < t.NumPort;i++) - { - Format(tmp, sizeof(tmp), "%s%u", tmp, t.Ports[i]); - if (i != (t.NumPort - 1)) - { - StrCat(tmp, sizeof(tmp), ", "); - } - } - SetTextA(hWnd, E_PORT, tmp); - } - FreeRpcListenerList(&t); - } - } - - SmFarmDlgUpdate(hWnd, p); - - FreeRpcFarm(&t); - - Focus(hWnd, IDOK); -} - -// Dialog update -void SmFarmDlgUpdate(HWND hWnd, SM_SERVER *p) -{ - bool ok = true; - bool farm_member_control = false; - char *s; - // Validate arguments - if (hWnd == NULL || p == NULL) - { - return; - } - - if (IsChecked(hWnd, R_MEMBER)) - { - LIST *o; - UINT i = IpGetFilledNum(hWnd, E_IP); - if (i != 0 && i != 4) - { - ok = false; - } - - s = GetTextA(hWnd, E_PORT); - o = StrToPortList(s, true); - if (o == NULL) - { - ok = false; - } - else - { - ReleaseList(o); - } - Free(s); - - if (IsEmpty(hWnd, E_CONTROLLER)) - { - ok = false; - } - - i = GetInt(hWnd, E_CONTROLLER_PORT); - if (i == 0 || i >= 65536) - { - ok = false; - } - - farm_member_control = true; - } - - if (IsChecked(hWnd, R_STANDALONE)) - { - Disable(hWnd, S_1); - Disable(hWnd, S_2); - Disable(hWnd, E_WEIGHT); - } - else - { - Enable(hWnd, S_1); - Enable(hWnd, S_2); - Enable(hWnd, E_WEIGHT); - } - - if (IsChecked(hWnd, R_CONTROLLER)) - { - Enable(hWnd, R_CONTROLLER_ONLY); - } - else - { - Disable(hWnd, R_CONTROLLER_ONLY); - } - - if (IsChecked(hWnd, R_CONTROLLER) || IsChecked(hWnd, R_MEMBER)) - { - if (GetInt(hWnd, E_WEIGHT) == 0) - { - ok = false; - } - } - - SetEnable(hWnd, S_IP_1, farm_member_control); - SetEnable(hWnd, E_IP, farm_member_control); - SetEnable(hWnd, S_IP_2, farm_member_control); - SetEnable(hWnd, S_PORT_1, farm_member_control); - SetEnable(hWnd, E_PORT, farm_member_control); - SetEnable(hWnd, S_PORT_2, farm_member_control); - SetEnable(hWnd, S_PORT_3, farm_member_control); - SetEnable(hWnd, E_CONTROLLER, farm_member_control); - SetEnable(hWnd, S_CONTROLLER, farm_member_control); - SetEnable(hWnd, E_CONTROLLER_PORT, farm_member_control); - SetEnable(hWnd, S_CONTROLLER_PORT, farm_member_control); - SetEnable(hWnd, S_PASSWORD, farm_member_control); - SetEnable(hWnd, E_PASSWORD, farm_member_control); - SetEnable(hWnd, IDOK, ok); -} - -// [OK] button -void SmFarmDlgOnOk(HWND hWnd, SM_SERVER *p) -{ - // Validate arguments - if (hWnd == NULL || p == NULL) - { - return; - } - - // Display the message - if (MsgBox(hWnd, MB_ICONEXCLAMATION | MB_OKCANCEL | MB_DEFBUTTON2, - _UU("SM_FARM_REBOOT_MSG")) == IDOK) - { - RPC_FARM t; - Zero(&t, sizeof(t)); - t.ServerType = SERVER_TYPE_STANDALONE; - if (IsChecked(hWnd, R_CONTROLLER)) - { - t.ServerType = SERVER_TYPE_FARM_CONTROLLER; - } - if (IsChecked(hWnd, R_MEMBER)) - { - t.ServerType = SERVER_TYPE_FARM_MEMBER; - } - - t.ControllerOnly = IsChecked(hWnd, R_CONTROLLER_ONLY); - t.Weight = GetInt(hWnd, E_WEIGHT); - - if (t.ServerType == SERVER_TYPE_FARM_MEMBER) - { - char *s; - char pass[MAX_SIZE]; - t.PublicIp = IpGet(hWnd, E_IP); - s = GetTextA(hWnd, E_PORT); - if (s != NULL) - { - LIST *o = StrToPortList(s, true); - if (o != NULL) - { - UINT i; - t.NumPort = LIST_NUM(o); - t.Ports = ZeroMalloc(sizeof(UINT) * t.NumPort); - for (i = 0;i < t.NumPort;i++) - { - t.Ports[i] = (UINT)LIST_DATA(o, i); - } - ReleaseList(o); - } - Free(s); - } - GetTxtA(hWnd, E_CONTROLLER, t.ControllerName, sizeof(t.ControllerName)); - t.ControllerPort = GetInt(hWnd, E_CONTROLLER_PORT); - GetTxtA(hWnd, E_PASSWORD, pass, sizeof(pass)); - if (StrCmp(pass, HIDDEN_PASSWORD) != 0) - { - Sha0(t.MemberPassword, pass, StrLen(pass)); - } - } - - // Configuration update - if (CALL(hWnd, ScSetFarmSetting(p->Rpc, &t)) == false) - { - return; - } - - FreeRpcFarm(&t); - - EndDialog(hWnd, true); - } -} - -// Server farm dialog procedure -UINT SmFarmDlgProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param) -{ - SM_SERVER *p = (SM_SERVER *)param; - // Validate arguments - if (hWnd == NULL) - { - return 0; - } - - switch (msg) - { - case WM_INITDIALOG: - // Initialize - SmFarmDlgInit(hWnd, p); - break; - - case WM_COMMAND: - switch (LOWORD(wParam)) - { - case R_STANDALONE: - case R_CONTROLLER: - case R_MEMBER: - case E_IP: - case E_PORT: - case E_CONTROLLER: - case E_CONTROLLER_PORT: - case E_PASSWORD: - case R_CONTROLLER_ONLY: - case E_WEIGHT: - SmFarmDlgUpdate(hWnd, p); - break; - } - - switch (wParam) - { - case IDOK: - // [OK] button - SmFarmDlgOnOk(hWnd, p); - break; - - case IDCANCEL: - // Cancel button - Close(hWnd); - break; - - case R_MEMBER: - if (IsChecked(hWnd, R_MEMBER)) - { - Focus(hWnd, E_IP); - } - break; - } - break; - - case WM_CLOSE: - EndDialog(hWnd, false); - break; - } - - return 0; -} - -// Server farm configuration -bool SmFarmDlg(HWND hWnd, SM_SERVER *p) -{ - // Validate arguments - if (hWnd == NULL || p == NULL) - { - return false; - } - - return Dialog(hWnd, D_SM_FARM, SmFarmDlgProc, p); -} - -// Update the connection information -bool SmRefreshConnectionStatus(HWND hWnd, SM_SERVER *p, void *param) -{ - RPC_CONNECTION_INFO t; - SM_CONNECTION_INFO *info = (SM_CONNECTION_INFO *)param; - LVB *b; - wchar_t tmp[MAX_SIZE]; - // Validate arguments - if (hWnd == NULL || p == NULL || param == NULL) - { - return false; - } - - Zero(&t, sizeof(t)); - StrCpy(t.Name, sizeof(t.Name), info->ConnectionName); - if (CALL(hWnd, ScGetConnectionInfo(p->Rpc, &t)) == false) - { - return false; - } - - b = LvInsertStart(); - - StrToUni(tmp, sizeof(tmp), t.Name); - LvInsertAdd(b, ICO_PROTOCOL, NULL, 2, _UU("SM_CONNINFO_NAME"), tmp); - - LvInsertAdd(b, ICO_MACHINE, NULL, 2, _UU("SM_CONNINFO_TYPE"), SmGetConnectionTypeStr(t.Type)); - - StrToUni(tmp, sizeof(tmp), t.Hostname); - LvInsertAdd(b, ICO_FARM, NULL, 2, _UU("SM_CONNINFO_HOSTNAME"), tmp); - - UniToStru(tmp, t.Port); - LvInsertAdd(b, ICO_PROTOCOL, NULL, 2, _UU("SM_CONNINFO_PORT"), tmp); - - GetDateTimeStrEx64(tmp, sizeof(tmp), SystemToLocal64(t.ConnectedTime), NULL); - LvInsertAdd(b, ICO_INFORMATION, NULL, 2, _UU("SM_CONNINFO_TIME"), tmp); - - StrToUni(tmp, sizeof(tmp), t.ServerStr); - LvInsertAdd(b, ICO_VPNSERVER, NULL, 2, _UU("SM_CONNINFO_SERVER_STR"), tmp); - - UniFormat(tmp, sizeof(tmp), L"%u.%02u", t.ServerVer / 100, t.ServerVer % 100); - LvInsertAdd(b, ICO_MACHINE, NULL, 2, _UU("SM_CONNINFO_SERVER_VER"), tmp); - - UniToStru(tmp, t.ServerBuild); - LvInsertAdd(b, ICO_MACHINE, NULL, 2, _UU("SM_CONNINFO_SERVER_BUILD"), tmp); - - if (StrLen(t.ClientStr) != 0) - { - StrToUni(tmp, sizeof(tmp), t.ClientStr); - LvInsertAdd(b, ICO_VPN, NULL, 2, _UU("SM_CONNINFO_CLIENT_STR"), tmp); - - UniFormat(tmp, sizeof(tmp), L"%u.%02u", t.ClientVer / 100, t.ClientVer % 100); - LvInsertAdd(b, ICO_MACHINE, NULL, 2, _UU("SM_CONNINFO_CLIENT_VER"), tmp); - - UniToStru(tmp, t.ClientBuild); - LvInsertAdd(b, ICO_MACHINE, NULL, 2, _UU("SM_CONNINFO_CLIENT_BUILD"), tmp); - } - - LvInsertEnd(b, hWnd, L_STATUS); - - return true; -} - -// Initialize -void SmConnectionDlgInit(HWND hWnd, SM_SERVER *p) -{ - // Validate arguments - if (hWnd == NULL || p == NULL) - { - return; - } - - SetIcon(hWnd, 0, ICO_PROTOCOL); - FormatText(hWnd, S_TITLE, p->ServerName); - - // Initialize the column - LvInit(hWnd, L_LIST); - LvSetStyle(hWnd, L_LIST, LVS_EX_GRIDLINES); - LvInsertColumn(hWnd, L_LIST, 0, _UU("SM_CONN_COLUMN_1"), 90); - LvInsertColumn(hWnd, L_LIST, 1, _UU("SM_CONN_COLUMN_2"), 150); - LvInsertColumn(hWnd, L_LIST, 2, _UU("SM_CONN_COLUMN_3"), 200); - LvInsertColumn(hWnd, L_LIST, 3, _UU("SM_CONN_COLUMN_4"), 80); - - SmConnectionDlgRefresh(hWnd, p); - SmConnectionDlgUpdate(hWnd, p); -} - -// Update -void SmConnectionDlgRefresh(HWND hWnd, SM_SERVER *p) -{ - LVB *b; - UINT i; - RPC_ENUM_CONNECTION t; - // Validate arguments - if (hWnd == NULL || p == NULL) - { - return; - } - - Zero(&t, sizeof(t)); - if (CALL(hWnd, ScEnumConnection(p->Rpc, &t)) == false) - { - EndDialog(hWnd, false); - return; - } - - b = LvInsertStart(); - - for (i = 0;i < t.NumConnection;i++) - { - wchar_t tmp[MAX_SIZE]; - wchar_t name[MAX_SIZE]; - wchar_t datetime[MAX_SIZE]; - RPC_ENUM_CONNECTION_ITEM *e = &t.Connections[i]; - - StrToUni(name, sizeof(name), e->Name); - UniFormat(tmp, sizeof(tmp), _UU("SM_HOSTNAME_AND_PORT"), e->Hostname, e->Port); - GetDateTimeStrEx64(datetime, sizeof(datetime), SystemToLocal64(e->ConnectedTime), NULL); - - LvInsertAdd(b, ICO_PROTOCOL, NULL, 4, name, tmp, datetime, - SmGetConnectionTypeStr(e->Type)); - } - - LvInsertEnd(b, hWnd, L_LIST); - - FreeRpcEnumConnection(&t); -} - -// Update the control -void SmConnectionDlgUpdate(HWND hWnd, SM_SERVER *p) -{ - bool b = false; - // Validate arguments - if (hWnd == NULL || p == NULL) - { - return; - } - - if (LvIsSelected(hWnd, L_LIST) && (LvIsMultiMasked(hWnd, L_LIST) == false)) - { - b = true; - } - - SetEnable(hWnd, IDOK, b); - SetEnable(hWnd, B_DISCONNECT, b && p->ServerAdminMode); -} - -// Connection List procedure -UINT SmConnectionDlgProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param) -{ - SM_SERVER *p = (SM_SERVER *)param; - NMHDR *n; - wchar_t *s; - // Validate arguments - if (hWnd == NULL) - { - return 0; - } - - switch (msg) - { - case WM_INITDIALOG: - // Initialize - SmConnectionDlgInit(hWnd, p); - break; - - case WM_COMMAND: - switch (wParam) - { - case IDOK: - // Show the connection information - s = LvGetSelectedStr(hWnd, L_LIST, 0); - if (s != NULL) - { - wchar_t caption[MAX_SIZE]; - SM_CONNECTION_INFO info; - UniFormat(caption, sizeof(caption), _UU("SM_CONNINFO_CAPTION"), - s); - Zero(&info, sizeof(info)); - info.ConnectionName = CopyUniToStr(s); - info.p = p; - SmStatusDlg(hWnd, p, &info, false, false, caption, ICO_PROTOCOL, - NULL, SmRefreshConnectionStatus); - Free(info.ConnectionName); - Free(s); - } - break; - - case B_DISCONNECT: - // Disconnect - s = LvGetSelectedStr(hWnd, L_LIST, 0); - if (s != NULL) - { - if (MsgBoxEx(hWnd, MB_ICONQUESTION | MB_YESNO | MB_DEFBUTTON2, - _UU("SM_CONN_DISCONNECT_MSG"), s) == IDYES) - { - char tmp[MAX_SIZE]; - RPC_DISCONNECT_CONNECTION t; - - UniToStr(tmp, sizeof(tmp), s); - Zero(&t, sizeof(t)); - StrCpy(t.Name, sizeof(t.Name), tmp); - - if (CALL(hWnd, ScDisconnectConnection(p->Rpc, &t))) - { - SmConnectionDlgRefresh(hWnd, p); - } - } - Free(s); - } - break; - - case B_REFRESH: - // Update to the latest state - SmConnectionDlgRefresh(hWnd, p); - break; - - case IDCANCEL: - // Cancel button - Close(hWnd); - break; - } - break; - - case WM_NOTIFY: - n = (NMHDR *)lParam; - switch (n->idFrom) - { - case L_LIST: - switch (n->code) - { - case LVN_ITEMCHANGED: - SmConnectionDlgUpdate(hWnd, p); - break; - } - break; - } - break; - - case WM_CLOSE: - EndDialog(hWnd, false); - break; - } - - LvStandardHandler(hWnd, msg, wParam, lParam, L_LIST); - - return 0; -} - -// Display the connection list -void SmConnectionDlg(HWND hWnd, SM_SERVER *p) -{ - // Validate arguments - if (hWnd == NULL || p == NULL) - { - return; - } - - Dialog(hWnd, D_SM_CONNECTION, SmConnectionDlgProc, p); -} - -// Get the connection type string -wchar_t *SmGetConnectionTypeStr(UINT type) -{ - return GetConnectionTypeStr(type); -} - -// Update the server information -bool SmRefreshServerInfo(HWND hWnd, SM_SERVER *p, void *param) -{ - RPC_SERVER_INFO t; - LVB *b; - wchar_t tmp[MAX_SIZE]; - // Validate arguments - if (hWnd == NULL || p == NULL) - { - return false; - } - - Zero(&t, sizeof(t)); - if (CALL(hWnd, ScGetServerInfo(p->Rpc, &t)) == false) - { - return false; - } - - b = LvInsertStart(); - - // Product name - StrToUni(tmp, sizeof(tmp), t.ServerProductName); - LvInsertAdd(b, ICO_VPNSERVER, NULL, 2, _UU("SM_INFO_PRODUCT_NAME"), tmp); - - // Version - StrToUni(tmp, sizeof(tmp), t.ServerVersionString); - LvInsertAdd(b, ICO_INFORMATION, NULL, 2, _UU("SM_INFO_VERSION"), tmp); - - // Build - StrToUni(tmp, sizeof(tmp), t.ServerBuildInfoString); - LvInsertAdd(b, ICO_MACHINE, NULL, 2, _UU("SM_INFO_BUILD"), tmp); - - // Host name - StrToUni(tmp, sizeof(tmp), t.ServerHostName); - LvInsertAdd(b, ICO_TOWER, NULL, 2, _UU("SM_INFO_HOSTNAME"), tmp); - - // Type - LvInsertAdd(b, t.ServerType == SERVER_TYPE_STANDALONE ? ICO_SERVER_ONLINE : ICO_FARM, 0, - 2, _UU("SM_ST_SERVER_TYPE"), - GetServerTypeStr(t.ServerType)); - - // OS - StrToUni(tmp, sizeof(tmp), t.OsInfo.OsSystemName); - LvInsertAdd(b, ICO_MACHINE, NULL, 2, _UU("SM_OS_SYSTEM_NAME"), tmp); - - StrToUni(tmp, sizeof(tmp), t.OsInfo.OsProductName); - LvInsertAdd(b, ICO_MACHINE, NULL, 2, _UU("SM_OS_PRODUCT_NAME"), tmp); - - if (t.OsInfo.OsServicePack != 0) - { - UniFormat(tmp, sizeof(tmp), _UU("SM_OS_SP_TAG"), t.OsInfo.OsServicePack); - LvInsertAdd(b, ICO_MACHINE, NULL, 2, _UU("SM_OS_SERVICE_PACK"), tmp); - } - - StrToUni(tmp, sizeof(tmp), t.OsInfo.OsVendorName); - LvInsertAdd(b, ICO_MACHINE, NULL, 2, _UU("SM_OS_VENDER_NAME"), tmp); - - StrToUni(tmp, sizeof(tmp), t.OsInfo.OsVersion); - LvInsertAdd(b, ICO_MACHINE, NULL, 2, _UU("SM_OS_VERSION"), tmp); - - StrToUni(tmp, sizeof(tmp), t.OsInfo.KernelName); - LvInsertAdd(b, ICO_MACHINE, NULL, 2, _UU("SM_OS_KERNEL_NAME"), tmp); - - StrToUni(tmp, sizeof(tmp), t.OsInfo.KernelVersion); - LvInsertAdd(b, ICO_MACHINE, NULL, 2, _UU("SM_OS_KERNEL_VERSION"), tmp); - - SmAddServerCaps(b, p->CapsList); - - LvInsertEnd(b, hWnd, L_STATUS); - - FreeRpcServerInfo(&t); - - return true; -} - -// Display the Caps of the server on the screen -void SmAddServerCaps(LVB *b, CAPSLIST *t) -{ - UINT i; - // Validate arguments - if (b == NULL || t == NULL) - { - return; - } - - for (i = 0;i < LIST_NUM(t->CapsList);i++) - { - CAPS *c = LIST_DATA(t->CapsList, i); - wchar_t title[MAX_SIZE]; - char name[256]; - - Format(name, sizeof(name), "CT_%s", c->Name); - - UniStrCpy(title, sizeof(title), _UU(name)); - - if (UniIsEmptyStr(title)) - { - UniFormat(title, sizeof(title), L"%S", (StrLen(c->Name) >= 2) ? c->Name + 2 : c->Name); - } - - if (StartWith(c->Name, "b_")) - { - bool icon_pass = c->Value == 0 ? false : true; - if (StrCmpi(c->Name, "b_must_install_pcap") == 0) - { - // Invert only the item of WinPcap - icon_pass = !icon_pass; - } - LvInsertAdd(b, icon_pass == false ? ICO_DISCARD : ICO_PASS, - NULL, 2, title, c->Value == 0 ? _UU("CAPS_NO") : _UU("CAPS_YES")); - } - else - { - wchar_t str[64]; - UniToStru(str, c->Value); - LvInsertAdd(b, ICO_PROTOCOL, NULL, 2, title, str); - } - } -} - -// Update the server state -bool SmRefreshServerStatus(HWND hWnd, SM_SERVER *p, void *param) -{ - RPC_SERVER_STATUS t; - LVB *b; - wchar_t tmp[MAX_SIZE]; - char str[MAX_SIZE]; - // Validate arguments - if (hWnd == NULL || p == NULL) - { - return false; - } - - Zero(&t, sizeof(t)); - if (CALL(hWnd, ScGetServerStatus(p->Rpc, &t)) == false) - { - return false; - } - - b = LvInsertStart(); - - // Type of server - LvInsertAdd(b, t.ServerType == SERVER_TYPE_STANDALONE ? ICO_SERVER_ONLINE : ICO_FARM, 0, - 2, _UU("SM_ST_SERVER_TYPE"), - GetServerTypeStr(t.ServerType)); - - // Number of TCP connections - UniToStru(tmp, t.NumTcpConnections); - LvInsertAdd(b, ICO_PROTOCOL, NULL, 2, _UU("SM_ST_NUM_TCP"), tmp); - - if (t.ServerType == SERVER_TYPE_FARM_CONTROLLER) - { - // Number of Local TCP connections - UniToStru(tmp, t.NumTcpConnectionsLocal); - LvInsertAdd(b, ICO_PROTOCOL, NULL, 2, _UU("SM_ST_NUM_TCP_LOCAL"), tmp); - - // Number of remote TCP connections - UniToStru(tmp, t.NumTcpConnectionsRemote); - LvInsertAdd(b, ICO_PROTOCOL, NULL, 2, _UU("SM_ST_NUM_TCP_REMOTE"), tmp); - } - - // Number of Virtual HUBs - UniToStru(tmp, t.NumHubTotal); - LvInsertAdd(b, ICO_HUB, NULL, 2, _UU("SM_ST_NUM_HUB_TOTAL"), tmp); - - if (t.ServerType != SERVER_TYPE_STANDALONE) - { - // Number of static HUBs - UniToStru(tmp, t.NumHubStatic); - LvInsertAdd(b, ICO_HUB, NULL, 2, _UU("SM_ST_NUM_HUB_STATIC"), tmp); - - // Number of Dynamic HUBs - UniToStru(tmp, t.NumHubDynamic); - LvInsertAdd(b, ICO_HUB, NULL, 2, _UU("SM_ST_NUM_HUB_DYNAMIC"), tmp); - } - - // Number of sessions - UniToStru(tmp, t.NumSessionsTotal); - LvInsertAdd(b, ICO_VPN, NULL, 2, _UU("SM_ST_NUM_SESSION_TOTAL"), tmp); - - if (t.ServerType == SERVER_TYPE_FARM_CONTROLLER) - { - // Number of local sessions - UniToStru(tmp, t.NumSessionsLocal); - LvInsertAdd(b, ICO_VPN, NULL, 2, _UU("SM_ST_NUM_SESSION_LOCAL"), tmp); - - // Number of local sessions - UniToStru(tmp, t.NumSessionsRemote); - LvInsertAdd(b, ICO_VPN, NULL, 2, _UU("SM_ST_NUM_SESSION_REMOTE"), tmp); - } - - // Number of MAC table entries - UniToStru(tmp, t.NumMacTables); - LvInsertAdd(b, ICO_MACHINE, NULL, 2, _UU("SM_ST_NUM_MAC_TABLE"), tmp); - - // Number of IP table entries - UniToStru(tmp, t.NumIpTables); - LvInsertAdd(b, ICO_MACHINE, NULL, 2, _UU("SM_ST_NUM_IP_TABLE"), tmp); - - // Number of users - UniToStru(tmp, t.NumUsers); - LvInsertAdd(b, ICO_USER, NULL, 2, _UU("SM_ST_NUM_USERS"), tmp); - - // Number of groups - UniToStru(tmp, t.NumGroups); - LvInsertAdd(b, ICO_GROUP, NULL, 2, _UU("SM_ST_NUM_GROUPS"), tmp); - - // Number of assigned licenses - UniToStru(tmp, t.AssignedClientLicenses); - LvInsertAdd(b, ICO_CERT, NULL, 2, _UU("SM_ST_CLIENT_LICENSE"), tmp); - UniToStru(tmp, t.AssignedBridgeLicenses); - LvInsertAdd(b, ICO_CERT, NULL, 2, _UU("SM_ST_BRIDGE_LICENSE"), tmp); - - if (t.ServerType == SERVER_TYPE_FARM_CONTROLLER) - { - UniToStru(tmp, t.AssignedClientLicensesTotal); - LvInsertAdd(b, ICO_CERT, NULL, 2, _UU("SM_ST_CLIENT_LICENSE_EX"), tmp); - UniToStru(tmp, t.AssignedBridgeLicensesTotal); - LvInsertAdd(b, ICO_CERT, NULL, 2, _UU("SM_ST_BRIDGE_LICENSE_EX"), tmp); - } - - // Traffic - SmInsertTrafficInfo(b, &t.Traffic); - - // Server start-up time - GetDateTimeStrEx64(tmp, sizeof(tmp), SystemToLocal64(t.StartTime), NULL); - LvInsertAdd(b, ICO_NULL, NULL, 2, _UU("SM_ST_START_TIME"), tmp); - - // Current time - GetDateTimeStrMilli64(str, sizeof(str), SystemToLocal64(t.CurrentTime)); - StrToUni(tmp, sizeof(tmp), str); - LvInsertAdd(b, ICO_NULL, NULL, 2, _UU("SM_ST_CURRENT_TIME"), tmp); - - // Tick value - UniFormat(tmp, sizeof(tmp), L"%I64u", t.CurrentTick); - LvInsertAdd(b, ICO_NULL, NULL, 2, _UU("SM_ST_CURRENT_TICK"), tmp); - - // Memory information - if (t.MemInfo.TotalMemory != 0) - { - char vv[128]; - - ToStr3(vv, sizeof(vv), t.MemInfo.TotalMemory); - UniFormat(tmp, sizeof(tmp), _UU("SM_ST_RAM_SIZE_KB"), vv); - LvInsertAdd(b, ICO_MEMORY, NULL, 2, _UU("SM_ST_TOTAL_MEMORY"), tmp); - - ToStr3(vv, sizeof(vv), t.MemInfo.UsedMemory); - UniFormat(tmp, sizeof(tmp), _UU("SM_ST_RAM_SIZE_KB"), vv); - LvInsertAdd(b, ICO_MEMORY, NULL, 2, _UU("SM_ST_USED_MEMORY"), tmp); - - ToStr3(vv, sizeof(vv), t.MemInfo.FreeMemory); - UniFormat(tmp, sizeof(tmp), _UU("SM_ST_RAM_SIZE_KB"), vv); - LvInsertAdd(b, ICO_MEMORY, NULL, 2, _UU("SM_ST_FREE_MEMORY"), tmp); - - ToStr3(vv, sizeof(vv), t.MemInfo.TotalPhys); - UniFormat(tmp, sizeof(tmp), _UU("SM_ST_RAM_SIZE_KB"), vv); - LvInsertAdd(b, ICO_MEMORY, NULL, 2, _UU("SM_ST_TOTAL_PHYS"), tmp); - - ToStr3(vv, sizeof(vv), t.MemInfo.UsedPhys); - UniFormat(tmp, sizeof(tmp), _UU("SM_ST_RAM_SIZE_KB"), vv); - LvInsertAdd(b, ICO_MEMORY, NULL, 2, _UU("SM_ST_USED_PHYS"), tmp); - - ToStr3(vv, sizeof(vv), t.MemInfo.FreePhys); - UniFormat(tmp, sizeof(tmp), _UU("SM_ST_RAM_SIZE_KB"), vv); - LvInsertAdd(b, ICO_MEMORY, NULL, 2, _UU("SM_ST_FREE_PHYS"), tmp); - } - - LvInsertEnd(b, hWnd, L_STATUS); - - return true; -} - -// Initialize -void SmSaveKeyPairDlgInit(HWND hWnd, SM_SAVE_KEY_PAIR *s) -{ - UINT current; - // Validate arguments - if (hWnd == NULL || s == NULL) - { - return; - } - - current = MsRegReadInt(REG_CURRENT_USER, SM_REG_KEY, "SavePkcs12"); - - if (current == 1) - { - Check(hWnd, R_PKCS12, true); - } - else if (current == 2) - { - Check(hWnd, R_SECURE, true); - } - else - { - Check(hWnd, R_X509_AND_KEY, true); - } - - if (MsIsWine()) - { - Disable(hWnd, R_SECURE); - } - - SmSaveKeyPairDlgUpdate(hWnd, s); -} - -// Update -void SmSaveKeyPairDlgUpdate(HWND hWnd, SM_SAVE_KEY_PAIR *s) -{ - SECURE_DEVICE *dev; - bool ok = true; - wchar_t tmp[MAX_SIZE]; - // Validate arguments - if (hWnd == NULL || s == NULL) - { - return; - } - - dev = GetSecureDevice(SmGetCurrentSecureIdFromReg()); - if (dev == NULL) - { - UniStrCpy(tmp, sizeof(tmp), _UU("SEC_CURRENT_NO_DEVICE")); - } - else - { - UniFormat(tmp, sizeof(tmp), _UU("SEC_CURRENT_DEVICE"), dev->DeviceName); - } - - SetText(hWnd, S_INFO, tmp); - - if (IsChecked(hWnd, R_USE_PASS)) - { - char *s1, *s2; - s1 = GetTextA(hWnd, E_PASS1); - s2 = GetTextA(hWnd, E_PASS2); - if (StrCmp(s1, s2) != 0) - { - ok = false; - } - Free(s1); - Free(s2); - } - - if (IsChecked(hWnd, R_SECURE)) - { - if (dev == NULL) - { - ok = false; - } - } - - SetEnable(hWnd, B_SELECT, IsChecked(hWnd, R_SECURE)); - SetEnable(hWnd, B_SECURE_MANAGER, IsChecked(hWnd, R_SECURE)); - SetEnable(hWnd, S_INFO, IsChecked(hWnd, R_SECURE)); - - SetEnable(hWnd, E_PASS1, IsChecked(hWnd, R_USE_PASS) && (IsChecked(hWnd, R_SECURE) == false)); - SetEnable(hWnd, E_PASS2, IsChecked(hWnd, R_USE_PASS) && (IsChecked(hWnd, R_SECURE) == false)); - SetEnable(hWnd, S_PASS1, IsChecked(hWnd, R_USE_PASS) && (IsChecked(hWnd, R_SECURE) == false)); - SetEnable(hWnd, S_PASS2, IsChecked(hWnd, R_USE_PASS) && (IsChecked(hWnd, R_SECURE) == false)); - SetEnable(hWnd, R_USE_PASS, (IsChecked(hWnd, R_SECURE) == false)); - SetEnable(hWnd, S_PASS3, (IsChecked(hWnd, R_SECURE) == false)); - SetEnable(hWnd, S_PASS4, (IsChecked(hWnd, R_SECURE) == false)); - - SetEnable(hWnd, IDOK, ok); -} - -// [OK] button -void SmSaveKeyPairDlgOnOk(HWND hWnd, SM_SAVE_KEY_PAIR *s) -{ - UINT pkcs12; - char pass[MAX_SIZE]; - char *password; - // Validate arguments - if (hWnd == NULL || s == NULL) - { - return; - } - - pkcs12 = 0; - - if (IsChecked(hWnd, R_PKCS12)) - { - pkcs12 = 1; - } - else if (IsChecked(hWnd, R_SECURE)) - { - pkcs12 = 2; - } - MsRegWriteInt(REG_CURRENT_USER, SM_REG_KEY, "SavePkcs12", pkcs12); - - if (pkcs12 != 2) - { - GetTxtA(hWnd, E_PASS1, pass, sizeof(pass)); - - if (StrLen(pass) != 0) - { - password = pass; - } - else - { - password = NULL; - } - - if (pkcs12 == false) - { - // Write to the X509 and KEY - wchar_t *x509_name, *key_name; - x509_name = SaveDlg(hWnd, _UU("DLG_CERT_FILES"), _UU("DLG_SAVE_CERT"), NULL, L".cer"); - if (x509_name == NULL) - { - // Cancel - return; - } - else - { - wchar_t default_key_name[MAX_SIZE]; - UniReplaceStrEx(default_key_name, sizeof(default_key_name), x509_name, - L".cer", L"", false); - UniReplaceStrEx(default_key_name, sizeof(default_key_name), default_key_name, - L".crt", L"", false); - UniStrCat(default_key_name, sizeof(default_key_name), L".key"); - key_name = SaveDlg(hWnd, _UU("DLG_KEY_FILTER"), _UU("DLG_SAVE_KEY"), - default_key_name, L".key"); - if (key_name == NULL) - { - // Cancel - Free(x509_name); - return; - } - else - { - bool ok = true; - wchar_t filename1[MAX_SIZE]; - wchar_t filename2[MAX_SIZE]; - - UniStrCpy(filename1, sizeof(filename1), x509_name); - UniStrCpy(filename2, sizeof(filename2), key_name); - - // Save the certificate - if (XToFileW(s->Cert, filename1, true) == false) - { - MsgBox(hWnd, MB_ICONSTOP, _UU("DLG_CERT_SAVE_ERROR")); - ok = false; - } - else - { - if (KToFileW(s->Key, filename2, true, password) == false) - { - MsgBox(hWnd, MB_ICONSTOP, _UU("DLG_KEY_SAVE_ERROR")); - ok = false; - } - } - - if (ok) - { - MsgBox(hWnd, MB_ICONINFORMATION, _UU("DLG_KEY_PAIR_SAVE_OK")); - EndDialog(hWnd, true); - } - - Free(key_name); - } - Free(x509_name); - } - } - else - { - // Write to the PKCS#12 - wchar_t *name = SaveDlg(hWnd, _UU("DLG_PKCS12_FILTER"), _UU("DLG_SAVE_P12"), NULL, L".p12"); - if (name == NULL) - { - // Cancel - return; - } - else - { - P12 *p12; - wchar_t filename[MAX_SIZE]; - UniStrCpy(filename, sizeof(filename), name); - - // Convert to PKCS#12 - p12 = NewP12(s->Cert, s->Key, pass); - if (p12 == NULL) - { - // Failure - MsgBox(hWnd, MB_ICONSTOP, _UU("DLG_KEY_PAIR_SAVE_ERROR")); - } - else - { - // Save - if (P12ToFileW(p12, filename) == false) - { - // Failure - MsgBox(hWnd, MB_ICONSTOP, _UU("DLG_KEY_PAIR_SAVE_ERROR")); - } - else - { - // Success - MsgBox(hWnd, MB_ICONINFORMATION, _UU("DLG_KEY_PAIR_SAVE_OK")); - EndDialog(hWnd, true); - } - FreeP12(p12); - } - - Free(name); - } - } - } - else - { - char default_name[MAX_SIZE]; - char *object_name; - bool ok = false; - X *x; - K *k; - WINUI_SECURE_BATCH batch[] = - { - {WINUI_SECURE_WRITE_CERT, NULL, true, NULL, NULL, NULL, NULL, NULL, NULL}, - {WINUI_SECURE_WRITE_KEY, NULL, true, NULL, NULL, NULL, NULL, NULL, NULL}, - }; - - x = s->Cert; - k = s->Key; - - // Generate the default name - GetPrintNameFromXA(default_name, sizeof(default_name), x); - ConvertSafeFileName(default_name, sizeof(default_name), default_name); - - object_name = StringDlgA(hWnd, _UU("SEC_OBJECT_NAME_TITLE"), - _UU("SEC_OBJECT_NAME_INFO"), default_name, ICO_CERT, false, false); - - if (object_name != NULL) - { - // Write and enumerate - batch[0].InputX = x; - batch[0].Name = object_name; - batch[1].InputK = k; - batch[1].Name = object_name; - - if (SecureDeviceWindow(hWnd, batch, sizeof(batch) / sizeof(batch[0]), SmGetCurrentSecureIdFromReg(), 0) == false) - { - // Failure - } - else - { - ok = true; - } - - Free(object_name); - } - - if (ok) - { - MsgBox(hWnd, MB_ICONINFORMATION, _UU("SEC_NEW_CERT_IMPORT_OK")); - - EndDialog(hWnd, true); - } - } -} - -// Saving dialog box of the certificate and private key -UINT SmSaveKeyPairDlgProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param) -{ - SM_SAVE_KEY_PAIR *s = (SM_SAVE_KEY_PAIR *)param; - // Validate arguments - if (hWnd == NULL) - { - return 0; - } - - switch (msg) - { - case WM_INITDIALOG: - // Initialize - SmSaveKeyPairDlgInit(hWnd, s); - break; - - case WM_COMMAND: - switch (LOWORD(wParam)) - { - case E_PASS1: - case E_PASS2: - case R_USE_PASS: - case R_SECURE: - case R_X509_AND_KEY: - case R_PKCS12: - SmSaveKeyPairDlgUpdate(hWnd, s); - break; - } - - switch (wParam) - { - case IDOK: - // [OK] button - SmSaveKeyPairDlgOnOk(hWnd, s); - break; - - case IDCANCEL: - // Cancel button - Close(hWnd); - break; - - case R_USE_PASS: - if (IsChecked(hWnd, R_USE_PASS)) - { - FocusEx(hWnd, E_PASS1); - } - break; - - case B_SELECT: - SmSelectSecureId(hWnd); - SmSaveKeyPairDlgUpdate(hWnd, s); - break; - - case B_SECURE_MANAGER: - CmSecureManagerEx(hWnd, SmGetCurrentSecureId(hWnd), true); - SmSaveKeyPairDlgUpdate(hWnd, s); - break; - } - break; - - case WM_CLOSE: - EndDialog(hWnd, false); - break; - } - - return 0; -} - -// Save the certificate and private key -bool SmSaveKeyPairDlg(HWND hWnd, X *x, K *k) -{ - SM_SAVE_KEY_PAIR s; - // Validate arguments - if (hWnd == NULL || x == NULL || k == NULL) - { - return false; - } - - Zero(&s, sizeof(s)); - s.Cert = x; - s.Key = k; - - return Dialog(hWnd, D_SM_SAVE_KEY_PAIR, SmSaveKeyPairDlgProc, &s); -} - -// OK is clicked on the SSL related dialog -void SmSslDlgOnOk(HWND hWnd, SM_SSL *s) -{ - char *name; - RPC_KEEP t; - // Validate arguments - if (hWnd == NULL || s == NULL) - { - return; - } - - if (s->p->ServerAdminMode == false) - { - EndDialog(hWnd, false); - return; - } - - name = GetTextA(hWnd, C_CIPHER); - if (name == NULL) - { - return; - } - else - { - RPC_STR t; - Zero(&t, sizeof(t)); - t.String = name; - - // Set the encryption algorithm - if (CALL(hWnd, ScSetServerCipher(s->p->Rpc, &t)) == false) - { - Focus(hWnd, C_CIPHER); - return; - } - FreeRpcStr(&t); - } - - if (s->SetCertAndKey) - { - // Set the certificate - RPC_KEY_PAIR t; - Zero(&t, sizeof(t)); - - t.Cert = CloneX(s->Cert); - t.Key = CloneK(s->Key); - - if (CALL(hWnd, ScSetServerCert(s->p->Rpc, &t)) == false) - { - return; - } - - if (t.Flag1 == 0) - { - // Show the warning message - MsgBox(hWnd, MB_ICONWARNING, _UU("SM_CERT_NEED_ROOT")); - } - - FreeRpcKeyPair(&t); - - MsgBox(hWnd, MB_ICONINFORMATION, _UU("CM_CERT_SET_MSG")); - } - - Zero(&t, sizeof(t)); - t.UseKeepConnect = IsChecked(hWnd, R_USE_KEEP_CONNECT); - GetTxtA(hWnd, E_HOSTNAME, t.KeepConnectHost, sizeof(t.KeepConnectHost)); - t.KeepConnectPort = GetInt(hWnd, E_PORT); - t.KeepConnectInterval = GetInt(hWnd, E_INTERVAL); - t.KeepConnectProtocol = IsChecked(hWnd, R_UDP) ? 1 : 0; - - CALL(hWnd, ScSetKeep(s->p->Rpc, &t)); - - if (GetCapsBool(s->p->CapsList, "b_support_syslog")) - { - if (s->p->ServerAdminMode) - { - SYSLOG_SETTING set; - - Zero(&set, sizeof(set)); - GetTxtA(hWnd, E_SYSLOG_HOSTNAME, set.Hostname, sizeof(set.Hostname)); - set.Port = GetInt(hWnd, E_SYSLOG_PORT); - set.SaveType = CbGetSelect(hWnd, C_SYSLOG); - - if (CALL(hWnd, ScSetSysLog(s->p->Rpc, &set)) == false) - { - return; - } - } - } - - EndDialog(hWnd, true); -} - -// SSL related dialog initialization -void SmSslDlgInit(HWND hWnd, SM_SSL *s) -{ - UINT i; - TOKEN_LIST *cipher_list; - RPC_KEEP t; - bool private_key_exportable = false; - // Validate arguments - if (hWnd == NULL || s == NULL) - { - return; - } - - if (s->p != NULL) - { - RPC_STR t; - Zero(&t, sizeof(t)); - - SetFont(hWnd, C_CIPHER, GetFont("Tahoma", 8, false, false, false, false)); - CbSetHeight(hWnd, C_CIPHER, 18); - - // Get the list of available encryption algorithms from the server - if (ScGetServerCipherList(s->p->Rpc, &t) == ERR_NO_ERROR) - { - cipher_list = ParseToken(t.String, ";"); - - FreeRpcStr(&t); - Zero(&t, sizeof(t)); - - for (i = 0; i < cipher_list->NumTokens; i++) - { - wchar_t tmp[MAX_SIZE]; - char *name = cipher_list->Token[i]; - StrToUni(tmp, sizeof(tmp), name); - CbAddStr(hWnd, C_CIPHER, tmp, 0); - } - - FreeToken(cipher_list); - } - - // Get the current encryption algorithm's name from the server - if (CALL(hWnd, ScGetServerCipher(s->p->Rpc, &t))) - { - wchar_t tmp[MAX_SIZE]; - StrToUni(tmp, sizeof(tmp), t.String); - SetText(hWnd, C_CIPHER, tmp); - FreeRpcStr(&t); - } - else - { - EndDialog(hWnd, 0); - return; - } - } - - if (s->p != NULL) - { - wchar_t tmp[MAX_SIZE]; - // Get the SSL certificate and private key from the server - RPC_KEY_PAIR t; - s->SetCertAndKey = false; - Zero(&t, sizeof(t)); - if (CALL(hWnd, ScGetServerCert(s->p->Rpc, &t))) - { - // Copy the certificate and key - s->Cert = CloneX(t.Cert); - s->Key = CloneK(t.Key); - - if (t.Key != NULL) - { - private_key_exportable = true; - } - - FreeRpcKeyPair(&t); - } - else - { - EndDialog(hWnd, 0); - return; - } - - // Show the Certificate Information - SmGetCertInfoStr(tmp, sizeof(tmp), s->Cert); - SetText(hWnd, S_CERT_INFO, tmp); - } - - // Password change - SetEnable(hWnd, B_PASSWORD, s->p->ServerAdminMode); - SetEnable(hWnd, S_INFO4, s->p->ServerAdminMode); - - // Enable / disable the button - SetEnable(hWnd, B_IMPORT, s->p->ServerAdminMode); - SetEnable(hWnd, B_EXPORT, s->p->ServerAdminMode && private_key_exportable); - SetEnable(hWnd, B_REGENERATE, s->p->ServerAdminMode); - SetEnable(hWnd, R_USE_KEEP_CONNECT, s->p->ServerAdminMode); - SetEnable(hWnd, B_UPDATE_CONFIG, s->p->Update != NULL); - - if (s->p->ServerAdminMode && GetCapsBool(s->p->CapsList, "b_support_special_listener")) - { - SetEnable(hWnd, B_SPECIALLISTENER, true); - SetEnable(hWnd, S_INFO5, true); - } - else - { - SetEnable(hWnd, B_SPECIALLISTENER, false); - SetEnable(hWnd, S_INFO5, false); - } - - if (s->p->ServerAdminMode == false) - { - Disable(hWnd, C_CIPHER); - } - - if (CALL(hWnd, ScGetKeep(s->p->Rpc, &t))) - { - Check(hWnd, R_USE_KEEP_CONNECT, t.UseKeepConnect); - SetTextA(hWnd, E_HOSTNAME, t.KeepConnectHost); - SetIntEx(hWnd, E_PORT, t.KeepConnectPort); - SetInt(hWnd, E_INTERVAL, t.KeepConnectInterval); - Check(hWnd, R_TCP, t.KeepConnectProtocol == 0); - Check(hWnd, R_UDP, t.KeepConnectProtocol != 0); - } - - CbSetHeight(hWnd, C_SYSLOG, 18); - CbReset(hWnd, C_SYSLOG); - CbAddStr(hWnd, C_SYSLOG, _UU("SM_SYSLOG_0"), SYSLOG_NONE); - CbAddStr(hWnd, C_SYSLOG, _UU("SM_SYSLOG_1"), SYSLOG_SERVER_LOG); - CbAddStr(hWnd, C_SYSLOG, _UU("SM_SYSLOG_2"), SYSLOG_SERVER_AND_HUB_SECURITY_LOG); - CbAddStr(hWnd, C_SYSLOG, _UU("SM_SYSLOG_3"), SYSLOG_SERVER_AND_HUB_ALL_LOG); - - if (GetCapsBool(s->p->CapsList, "b_support_syslog")) - { - SYSLOG_SETTING set; - - SetEnable(hWnd, C_SYSLOG, s->p->ServerAdminMode); - SetEnable(hWnd, E_SYSLOG_HOSTNAME, s->p->ServerAdminMode); - SetEnable(hWnd, E_SYSLOG_PORT, s->p->ServerAdminMode); - SetEnable(hWnd, S_01, s->p->ServerAdminMode); - SetEnable(hWnd, S_02, s->p->ServerAdminMode); - - Zero(&set, sizeof(set)); - - if (CALL(hWnd, ScGetSysLog(s->p->Rpc, &set))) - { - SetTextA(hWnd, E_SYSLOG_HOSTNAME, set.Hostname); - SetInt(hWnd, E_SYSLOG_PORT, set.Port == 0 ? SYSLOG_PORT : set.Port); - CbSelect(hWnd, C_SYSLOG, set.SaveType); - } - } - else - { - Disable(hWnd, C_SYSLOG); - Disable(hWnd, E_SYSLOG_HOSTNAME); - Disable(hWnd, E_SYSLOG_PORT); - Disable(hWnd, S_01); - Disable(hWnd, S_02); - } - - SmSslDlgUpdate(hWnd, s); -} - -// SSL related dialog control update -void SmSslDlgUpdate(HWND hWnd, SM_SSL *s) -{ - bool ok = true; - bool b; - // Validate arguments - if (hWnd == NULL || s == NULL) - { - return; - } - - if (IsChecked(hWnd, R_USE_KEEP_CONNECT)) - { - UINT i; - b = true; - if (IsEmpty(hWnd, E_HOSTNAME)) - { - ok = false; - } - i = GetInt(hWnd, E_PORT); - if (i == 0 || i >= 65536) - { - ok = false; - } - i = GetInt(hWnd, E_INTERVAL); - if (i < 5 || i > 600) - { - ok = false; - } - } - else - { - b = false; - } - - if (IsEnable(hWnd, C_SYSLOG)) - { - UINT i = CbGetSelect(hWnd, C_SYSLOG); - - SetEnable(hWnd, E_SYSLOG_HOSTNAME, i != SYSLOG_NONE); - SetEnable(hWnd, E_SYSLOG_PORT, i != SYSLOG_NONE); - SetEnable(hWnd, S_01, i != SYSLOG_NONE); - SetEnable(hWnd, S_02, i != SYSLOG_NONE); - } - - SetEnable(hWnd, S_HOSTNAME, b); - SetEnable(hWnd, E_HOSTNAME, b); - SetEnable(hWnd, S_PORT, b); - SetEnable(hWnd, E_PORT, b); - SetEnable(hWnd, S_INTERVAL, b); - SetEnable(hWnd, E_INTERVAL, b); - SetEnable(hWnd, S_INTERVAL2, b); - SetEnable(hWnd, S_PROTOCOL, b); - SetEnable(hWnd, R_TCP, b); - SetEnable(hWnd, R_UDP, b); - SetEnable(hWnd, S_INFO, b); - - SetEnable(hWnd, IDOK, ok); -} - -// Get the certificate information string -void SmGetCertInfoStr(wchar_t *str, UINT size, X *x) -{ - wchar_t subject[MAX_SIZE]; - wchar_t issuer[MAX_SIZE]; - wchar_t date[MAX_SIZE]; - // Validate arguments - if (x == NULL || str == NULL) - { - if (str != NULL) - { - str[0] = 0; - } - return; - } - - GetPrintNameFromName(subject, sizeof(subject), x->subject_name); - GetPrintNameFromName(issuer, sizeof(issuer), x->issuer_name); - GetDateStrEx64(date, sizeof(date), x->notAfter, NULL); - - UniFormat(str, size, _UU("CM_CERT_INFO"), subject, issuer, date); -} - -// Regenerate the server certificate -bool SmRegenerateServerCert(HWND hWnd, SM_SERVER *server, char *default_cn, X **x, K **k, bool root_only) -{ - char defcn[MAX_SIZE]; - // Validate arguments - if (server == NULL || x == NULL || k == NULL) - { - return false; - } - - Zero(defcn, sizeof(defcn)); - if (IsEmptyStr(default_cn) == false) - { - StrCpy(defcn, sizeof(defcn), default_cn); - } - - if (IsEmptyStr(defcn)) - { - // If default CN is not specified, copy from the setting of the DDNS server - DDNS_CLIENT_STATUS t; - - Zero(&t, sizeof(t)); - - if (ScGetDDnsClientStatus(server->Rpc, &t) == ERR_NO_ERROR) - { - if (IsEmptyStr(t.CurrentFqdn) == false) - { - StrCpy(defcn, sizeof(defcn), t.CurrentFqdn); - } - } - } - - if (IsEmptyStr(defcn)) - { - // Copy from the certificate information of the current server - RPC_KEY_PAIR t; - - Zero(&t, sizeof(t)); - - if (ScGetServerCert(server->Rpc, &t) == ERR_NO_ERROR) - { - if (t.Cert != NULL) - { - if (t.Cert->subject_name != NULL) - { - UniToStr(defcn, sizeof(defcn), t.Cert->subject_name->CommonName); - } - } - - FreeRpcKeyPair(&t); - } - } - - if (IsEmptyStr(defcn)) - { - // Copy from the destination server name of the current connection settings - StrCpy(defcn, sizeof(defcn), server->ServerName); - } - - // Create a new certificate in the Certificate Creation Tool - if (SmCreateCert(hWnd, x, k, true, defcn, root_only) == false) - { - return false; - } - - return true; -} - -// SSL related dialog procedure -UINT SmSslDlgProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param) -{ - SM_SSL *s = (SM_SSL *)param; - X *x; - K *k; - // Validate arguments - if (hWnd == NULL) - { - return 0; - } - - switch (msg) - { - case WM_INITDIALOG: - // Initialize - SmSslDlgInit(hWnd, s); - break; - - case WM_COMMAND: - switch (LOWORD(wParam)) - { - case R_USE_KEEP_CONNECT: - case E_HOSTNAME: - case E_PORT: - case E_INTERVAL: - case R_TCP: - case R_UDP: - case C_SYSLOG: - case E_SYSLOG_HOSTNAME: - case E_SYSLOG_PORT: - SmSslDlgUpdate(hWnd, s); - break; - } - - switch (wParam) - { - case IDOK: - // [OK] button - SmSslDlgOnOk(hWnd, s); - break; - - case IDCANCEL: - // Cancel button - Close(hWnd); - break; - - case B_UPDATE_CONFIG: - // Update notification setting - ConfigUpdateUi(s->p->Update, hWnd); - break; - - case B_IMPORT: - // Import - if (CmLoadXAndK(hWnd, &x, &k)) - { - wchar_t tmp[MAX_SIZE]; - -LABEL_APPLY_NEW_CERT: - FreeX(s->Cert); - FreeK(s->Key); - s->Cert = x; - s->Key = k; - s->SetCertAndKey = true; - // Show the Certificate Information - SmGetCertInfoStr(tmp, sizeof(tmp), s->Cert); - SetText(hWnd, S_CERT_INFO, tmp); - } - break; - - case B_EXPORT: - // Export - SmSaveKeyPairDlg(hWnd, s->Cert, s->Key); - break; - - case B_VIEW: - // Show the certificate - CertDlg(hWnd, s->Cert, NULL, true); - break; - - case B_SPECIALLISTENER: - // Special listener configuration - SmSpecialListener(hWnd, s->p); - break; - - case B_REGENERATE: - // Regenerating the certificate - if (SmRegenerateServerCert(hWnd, s->p, NULL, &x, &k, false)) - { - // Confirmation message - if (MsgBox(hWnd, MB_ICONEXCLAMATION | MB_YESNO, _UU("SM_REGENERATE_CERT_MSG")) == IDYES) - { - goto LABEL_APPLY_NEW_CERT; - } - else - { - FreeX(x); - FreeK(k); - } - } - break; - - case B_PASSWORD: - // Password change - Dialog(hWnd, D_SM_CHANGE_PASSWORD, SmChangeServerPasswordDlg, s->p); - break; - - case R_USE_KEEP_CONNECT: - if (IsChecked(hWnd, R_USE_KEEP_CONNECT)) - { - FocusEx(hWnd, E_HOSTNAME); - } - break; - } - break; - - case WM_CLOSE: - EndDialog(hWnd, false); - break; - } - - return 0; -} - -// Display the SSL related dialog -void SmSslDlg(HWND hWnd, SM_SERVER *p) -{ - SM_SSL s; - // Validate arguments - if (hWnd == NULL || p == NULL) - { - return; - } - - Zero(&s, sizeof(s)); - s.p = p; - - Dialog(hWnd, D_SM_SSL, SmSslDlgProc, &s); - - // Cleanup - FreeX(s.Cert); - FreeK(s.Key); -} - -// Listener creation dialog procedure -UINT SmCreateListenerDlgProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param) -{ - UINT port; - RPC_LISTENER t; - SM_SERVER *p = (SM_SERVER *)param; - // Validate arguments - if (hWnd == NULL) - { - return 0; - } - - switch (msg) - { - case WM_INITDIALOG: - Focus(hWnd, E_PORT); - Disable(hWnd, IDOK); - break; - - case WM_COMMAND: - switch (LOWORD(wParam)) - { - case E_PORT: - port = GetInt(hWnd, E_PORT); - if (port == 0 || port >= 65536) - { - Disable(hWnd, IDOK); - } - else - { - Enable(hWnd, IDOK); - } - break; - } - - switch (wParam) - { - case IDOK: - port = GetInt(hWnd, E_PORT); - Zero(&t, sizeof(t)); - t.Enable = true; - t.Port = port; - if (CALL(hWnd, ScCreateListener(p->Rpc, &t))) - { - EndDialog(hWnd, true); - } - break; - case IDCANCEL: - Close(hWnd); - } - break; - - case WM_CLOSE: - EndDialog(hWnd, false); - break; - } - - return 0; -} - -// Listener creation dialog -bool SmCreateListenerDlg(HWND hWnd, SM_SERVER *p) -{ - // Validate arguments - if (hWnd == NULL || p == NULL) - { - return false; - } - - return Dialog(hWnd, D_SM_CREATE_LISTENER, SmCreateListenerDlgProc, p); -} - -// HUB edit OK button -void SmEditHubOnOk(HWND hWnd, SM_EDIT_HUB *s) -{ - RPC_CREATE_HUB t; - char pass1[MAX_SIZE]; - char pass2[MAX_SIZE]; - char hubname[MAX_HUBNAME_LEN + 1]; - // Validate arguments - if (hWnd == NULL || s == NULL) - { - return; - } - - Zero(&t, sizeof(t)); - if (s->EditMode) - { - StrCpy(hubname, sizeof(hubname), s->HubName); - StrCpy(t.HubName, sizeof(t.HubName), s->HubName); - } - else - { - GetTxtA(hWnd, E_HUBNAME, t.HubName, sizeof(t.HubName)); - StrCpy(hubname, sizeof(hubname), t.HubName); - } - - GetTxtA(hWnd, E_PASSWORD1, pass1, sizeof(pass1)); - GetTxtA(hWnd, E_PASSWORD2, pass2, sizeof(pass2)); - - if (s->EditMode == false || StrCmp(pass1, HIDDEN_PASSWORD) != 0) - { - Sha0(t.HashedPassword, pass1, StrLen(pass1)); - HashPassword(t.SecurePassword, ADMINISTRATOR_USERNAME, pass1); - } - - if (IsChecked(hWnd, R_LIMIT_MAX_SESSION)) - { - t.HubOption.MaxSession = GetInt(hWnd, E_MAX_SESSION); - } - - t.Online = IsChecked(hWnd, R_ONLINE); - - if (s->p->ServerType == SERVER_TYPE_FARM_CONTROLLER) - { - t.HubType = HUB_TYPE_FARM_STATIC; - if (IsChecked(hWnd, R_DYNAMIC)) - { - t.HubType = HUB_TYPE_FARM_DYNAMIC; - } - } - - t.HubOption.NoEnum = IsChecked(hWnd, R_NO_ENUM); - - if (s->EditMode == false) - { - if (CALL(hWnd, ScCreateHub(s->p->Rpc, &t))) - { - MsgBoxEx(hWnd, MB_ICONINFORMATION, _UU("CM_EDIT_HUB_CREATED"), hubname); - EndDialog(hWnd, true); - } - } - else - { - if (CALL(hWnd, ScSetHub(s->p->Rpc, &t))) - { - EndDialog(hWnd, true); - } - } -} - -// HUB editing update -void SmEditHubUpdate(HWND hWnd, SM_EDIT_HUB *s) -{ - bool ok = true; - char *s1, *s2; - char hubname[MAX_HUBNAME_LEN + 1]; - // Validate arguments - if (hWnd == NULL || s == NULL) - { - return; - } - - s1 = GetTextA(hWnd, E_PASSWORD1); - s2 = GetTextA(hWnd, E_PASSWORD2); - if (StrCmp(s1, s2) != 0) - { - ok = false; - } - Free(s1); - Free(s2); - - GetTxtA(hWnd, E_HUBNAME, hubname, sizeof(hubname)); - Trim(hubname); - if (StrLen(hubname) == 0 || - IsSafeStr(hubname) == false) - { - ok = false; - } - - if (IsChecked(hWnd, R_LIMIT_MAX_SESSION)) - { - Enable(hWnd, E_MAX_SESSION); - Enable(hWnd, S_MAX_SESSION_1); - Enable(hWnd, S_MAX_SESSION_2); - if (GetInt(hWnd, E_MAX_SESSION) == 0) - { - ok = false; - } - } - else - { - Disable(hWnd, E_MAX_SESSION); - Disable(hWnd, S_MAX_SESSION_1); - Disable(hWnd, S_MAX_SESSION_2); - } - - SetEnable(hWnd, IDOK, ok); -} - -// HUB editing initialization -void SmEditHubInit(HWND hWnd, SM_EDIT_HUB *s) -{ - RPC_CREATE_HUB t; - bool b = false; - bool support_extoption = false; - // Validate arguments - if (hWnd == NULL || s == NULL) - { - return; - } - - SetIcon(hWnd, 0, ICO_HUB); - - Zero(&t, sizeof(t)); - - if (s->EditMode == false) - { - // Create new - SetText(hWnd, 0, _UU("CM_EDIT_HUB_1")); - FocusEx(hWnd, E_HUBNAME); - - if (s->p->ServerType == SERVER_TYPE_STANDALONE) - { - // Stand-alone mode - Disable(hWnd, R_STATIC); - Disable(hWnd, R_DYNAMIC); - SetText(hWnd, S_FARM_INFO, _UU("CM_EDIT_HUB_STANDALONE")); - } - else - { - Check(hWnd, R_STATIC, true); - } - - Check(hWnd, R_ONLINE, true); - - Hide(hWnd, B_ACL); - Hide(hWnd, S_ACL); - Hide(hWnd, S_ACL_2); - Hide(hWnd, S_ACL_3); - Hide(hWnd, S_MSG_1); - Hide(hWnd, S_MSG_4); - Hide(hWnd, S_MSG_2); - Hide(hWnd, B_MSG); - } - else - { - // Edit - wchar_t tmp[MAX_SIZE]; - UniFormat(tmp, sizeof(tmp), _UU("CM_EDIT_HUB_2"), s->HubName); - SetText(hWnd, 0, tmp); - SetTextA(hWnd, E_HUBNAME, s->HubName); - Disable(hWnd, E_HUBNAME); - - if (s->p->ServerType == SERVER_TYPE_STANDALONE) - { - // Stand-alone mode - Disable(hWnd, R_STATIC); - Disable(hWnd, R_DYNAMIC); - SetText(hWnd, S_FARM_INFO, _UU("CM_EDIT_HUB_STANDALONE")); - } - - if (s->p->ServerType == SERVER_TYPE_FARM_CONTROLLER) - { - // Controller - if (GetCapsBool(s->p->CapsList, "b_cluster_hub_type_fixed")) - { - Disable(hWnd, R_STATIC); - Disable(hWnd, R_DYNAMIC); - SetText(hWnd, S_FARM_INFO, _UU("CM_EDIT_HUB_TYPE_FIXED")); - } - } - - // Get the HUB information - StrCpy(t.HubName, sizeof(t.HubName), s->HubName); - if (CALL(hWnd, ScGetHub(s->p->Rpc, &t)) == false) - { - EndDialog(hWnd, false); - return; - } - - SetTextA(hWnd, E_PASSWORD1, HIDDEN_PASSWORD); - SetTextA(hWnd, E_PASSWORD2, HIDDEN_PASSWORD); - - if (t.HubOption.MaxSession == 0) - { - Check(hWnd, R_LIMIT_MAX_SESSION, false); - } - else - { - Check(hWnd, R_LIMIT_MAX_SESSION, true); - } - - Check(hWnd, R_NO_ENUM, t.HubOption.NoEnum); - - SetIntEx(hWnd, E_MAX_SESSION, t.HubOption.MaxSession); - - Check(hWnd, R_ONLINE, t.Online); - Check(hWnd, R_OFFLINE, t.Online ? false : true); - - Check(hWnd, R_STATIC, t.HubType == HUB_TYPE_FARM_STATIC); - Check(hWnd, R_DYNAMIC, t.HubType == HUB_TYPE_FARM_DYNAMIC); - - SetShow(hWnd, B_ACL, GetCapsBool(s->p->CapsList, "b_support_ac")); - SetShow(hWnd, S_ACL, GetCapsBool(s->p->CapsList, "b_support_ac")); - SetShow(hWnd, S_ACL_2, GetCapsBool(s->p->CapsList, "b_support_ac")); - SetShow(hWnd, S_ACL_3, GetCapsBool(s->p->CapsList, "b_support_ac")); - - SetShow(hWnd, S_MSG_1, GetCapsBool(s->p->CapsList, "b_support_msg")); - SetShow(hWnd, S_MSG_4, GetCapsBool(s->p->CapsList, "b_support_msg")); - SetShow(hWnd, S_MSG_2, GetCapsBool(s->p->CapsList, "b_support_msg")); - SetShow(hWnd, B_MSG, GetCapsBool(s->p->CapsList, "b_support_msg")); - } - - // Advanced options - if (s->EditMode) - { - support_extoption = GetCapsBool(s->p->CapsList, "b_support_hub_ext_options"); - } - - SetEnable(hWnd, S_STATIC, support_extoption); - SetEnable(hWnd, B_EXTOPTION, support_extoption); - - SetEnable(hWnd, R_NO_ENUM, GetCapsBool(s->p->CapsList, "b_support_hide_hub")); - - SmEditHubUpdate(hWnd, s); - - if (s->EditMode) - { - Focus(hWnd, IDOK); - } - - if (s->EditMode) - { - if (GetCapsBool(s->p->CapsList, "b_support_hub_admin_option")) - { - b = true; - } - } - - SetShow(hWnd, S_AO_1, b); - SetShow(hWnd, S_AO_2, b); - SetShow(hWnd, S_AO_3, b); - SetShow(hWnd, B_ADMINOPTION, b); -} - -// HUB edit procedure -UINT SmEditHubProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param) -{ - SM_EDIT_HUB *s = (SM_EDIT_HUB *)param; - // Validate arguments - if (hWnd == NULL) - { - return 0; - } - - switch (msg) - { - case WM_INITDIALOG: - SmEditHubInit(hWnd, s); - break; - - case WM_COMMAND: - switch (LOWORD(wParam)) - { - case E_PASSWORD1: - case E_PASSWORD2: - case E_HUBNAME: - case R_LIMIT_MAX_SESSION: - case E_MAX_SESSION: - SmEditHubUpdate(hWnd, s); - break; - } - - switch (wParam) - { - case IDOK: - SmEditHubOnOk(hWnd, s); - break; - - case IDCANCEL: - Close(hWnd); - break; - - case R_LIMIT_MAX_SESSION: - if (IsChecked(hWnd, R_LIMIT_MAX_SESSION)) - { - FocusEx(hWnd, E_MAX_SESSION); - } - break; - - case B_ADMINOPTION: - SmHubAdminOption(hWnd, s); - break; - - case B_EXTOPTION: - SmHubExtOption(hWnd, s); - break; - - case B_ACL: - SmHubAc(hWnd, s); - break; - - case B_MSG: - SmHubMsg(hWnd, s); - break; - } - break; - - case WM_CLOSE: - EndDialog(hWnd, false); - break; - } - - return 0; -} - -// HUB edit dialog -bool SmEditHubDlg(HWND hWnd, SM_SERVER *p, char *hubname) -{ - SM_EDIT_HUB s; - // Validate arguments - if (hWnd == NULL || p == NULL) - { - return false; - } - - Zero(&s, sizeof(s)); - s.p = p; - s.EditMode = true; - StrCpy(s.HubName, sizeof(s.HubName), hubname); - - if (p->Bridge == false) - { - return Dialog(hWnd, D_SM_EDIT_HUB, SmEditHubProc, &s); - } - else - { - SmHubExtOption(hWnd, &s); - return false; - } -} - -// HUB creation dialog -bool SmCreateHubDlg(HWND hWnd, SM_SERVER *p) -{ - SM_EDIT_HUB s; - // Validate arguments - if (hWnd == NULL || p == NULL) - { - return false; - } - - Zero(&s, sizeof(s)); - s.p = p; - s.EditMode = false; - - return Dialog(hWnd, D_SM_EDIT_HUB, SmEditHubProc, &s); -} - -// Display the status of the virtual HUB -bool SmRefreshHubStatus(HWND hWnd, SM_SERVER *p, void *param) -{ - RPC_HUB_STATUS t; - // Validate arguments - if (hWnd == NULL || p == NULL || param == NULL) - { - return false; - } - - Zero(&t, sizeof(RPC_HUB_STATUS)); - StrCpy(t.HubName, sizeof(t.HubName), (char *)param); - if (CALL(hWnd, ScGetHubStatus(p->Rpc, &t))) - { - wchar_t *s; - wchar_t tmp[MAX_SIZE]; - LVB *b = LvInsertStart(); - - // HUB name - s = CopyStrToUni((char *)param); - LvInsertAdd(b, ICO_HUB, 0, 2, _UU("SM_HUB_STATUS_HUBNAME"), s); - Free(s); - - // Online - LvInsertAdd(b, t.Online ? ICO_PROTOCOL : ICO_PROTOCOL_X, 0, 2, _UU("SM_HUB_STATUS_ONLINE"), - t.Online ? _UU("SM_HUB_ONLINE") : _UU("SM_HUB_OFFLINE")); - - // Type of HUB - LvInsertAdd(b, t.HubType == HUB_TYPE_STANDALONE ? ICO_TOWER : ICO_FARM, 0, 2, _UU("SM_HUB_TYPE"), - GetHubTypeStr(t.HubType)); - - if (t.HubType == HUB_TYPE_STANDALONE) - { - // Enable / Disable the SecureNAT - LvInsertAdd(b, ICO_ROUTER, NULL, 2, _UU("SM_HUB_SECURE_NAT"), - t.SecureNATEnabled ? _UU("SM_HUB_SECURE_NAT_YES") : _UU("SM_HUB_SECURE_NAT_NO")); - } - - // Other values - UniToStru(tmp, t.NumSessions); - LvInsertAdd(b, ICO_PROTOCOL, 0, 2, _UU("SM_HUB_NUM_SESSIONS"), tmp); - if (t.NumSessionsClient != 0 || t.NumSessionsBridge != 0) - { - UniToStru(tmp, t.NumSessionsClient); - LvInsertAdd(b, ICO_PROTOCOL, 0, 2, _UU("SM_HUB_NUM_SESSIONS_CLIENT"), tmp); - UniToStru(tmp, t.NumSessionsBridge); - LvInsertAdd(b, ICO_PROTOCOL, 0, 2, _UU("SM_HUB_NUM_SESSIONS_BRIDGE"), tmp); - } - - UniToStru(tmp, t.NumAccessLists); - LvInsertAdd(b, ICO_DISCARD, 0, 2, _UU("SM_HUB_NUM_ACCESSES"), tmp); - - if (p->ServerType != SERVER_TYPE_FARM_MEMBER) - { - UniToStru(tmp, t.NumUsers); - LvInsertAdd(b, ICO_USER, 0, 2, _UU("SM_HUB_NUM_USERS"), tmp); - UniToStru(tmp, t.NumGroups); - LvInsertAdd(b, ICO_GROUP, 0, 2, _UU("SM_HUB_NUM_GROUPS"), tmp); - } - - UniToStru(tmp, t.NumMacTables); - LvInsertAdd(b, ICO_MACHINE, 0, 2, _UU("SM_HUB_NUM_MAC_TABLES"), tmp); - UniToStru(tmp, t.NumIpTables); - LvInsertAdd(b, ICO_MACHINE, 0, 2, _UU("SM_HUB_NUM_IP_TABLES"), tmp); - - // Usage status - UniToStru(tmp, t.NumLogin); - LvInsertAdd(b, ICO_KEY, NULL, 2, _UU("SM_HUB_NUM_LOGIN"), tmp); - - if (t.LastLoginTime != 0) - { - GetDateTimeStr64Uni(tmp, sizeof(tmp), SystemToLocal64(t.LastLoginTime)); - } - else - { - UniStrCpy(tmp, sizeof(tmp), _UU("COMMON_UNKNOWN")); - } - LvInsertAdd(b, ICO_DATETIME, NULL, 2, _UU("SM_HUB_LAST_LOGIN_TIME"), tmp); - - if (t.LastCommTime != 0) - { - GetDateTimeStr64Uni(tmp, sizeof(tmp), SystemToLocal64(t.LastCommTime)); - } - else - { - UniStrCpy(tmp, sizeof(tmp), _UU("COMMON_UNKNOWN")); - } - LvInsertAdd(b, ICO_DATETIME, NULL, 2, _UU("SM_HUB_LAST_COMM_TIME"), tmp); - - if (t.CreatedTime != 0) - { - GetDateTimeStr64Uni(tmp, sizeof(tmp), SystemToLocal64(t.CreatedTime)); - } - else - { - UniStrCpy(tmp, sizeof(tmp), _UU("COMMON_UNKNOWN")); - } - LvInsertAdd(b, ICO_DATETIME, NULL, 2, _UU("SM_HUB_CREATED_TIME"), tmp); - - // Traffic information - SmInsertTrafficInfo(b, &t.Traffic); - - LvInsertEnd(b, hWnd, L_STATUS); - } - else - { - return false; - } - - return true; -} - -// Add a traffic information to LVB -void SmInsertTrafficInfo(LVB *b, TRAFFIC *t) -{ - wchar_t tmp[MAX_SIZE]; - char vv[128]; - // Validate arguments - if (b == NULL || t == NULL) - { - return; - } - - // Transmission information - ToStr3(vv, sizeof(vv), t->Send.UnicastCount); - UniFormat(tmp, sizeof(tmp), _UU("SM_ST_NUM_PACKET_STR"), vv); - LvInsertAdd(b, ICO_INFORMATION, 0, 2, _UU("SM_ST_SEND_UCAST_NUM"), tmp); - - ToStr3(vv, sizeof(vv), t->Send.UnicastBytes); - UniFormat(tmp, sizeof(tmp), _UU("SM_ST_SIZE_BYTE_STR"), vv); - LvInsertAdd(b, ICO_INFORMATION, 0, 2, _UU("SM_ST_SEND_UCAST_SIZE"), tmp); - - ToStr3(vv, sizeof(vv), t->Send.BroadcastCount); - UniFormat(tmp, sizeof(tmp), _UU("SM_ST_NUM_PACKET_STR"), vv); - LvInsertAdd(b, ICO_INFORMATION, 0, 2, _UU("SM_ST_SEND_BCAST_NUM"), tmp); - - ToStr3(vv, sizeof(vv), t->Send.BroadcastBytes); - UniFormat(tmp, sizeof(tmp), _UU("SM_ST_SIZE_BYTE_STR"), vv); - LvInsertAdd(b, ICO_INFORMATION, 0, 2, _UU("SM_ST_SEND_BCAST_SIZE"), tmp); - - // Reception information - ToStr3(vv, sizeof(vv), t->Recv.UnicastCount); - UniFormat(tmp, sizeof(tmp), _UU("SM_ST_NUM_PACKET_STR"), vv); - LvInsertAdd(b, ICO_INFORMATION, 0, 2, _UU("SM_ST_RECV_UCAST_NUM"), tmp); - - ToStr3(vv, sizeof(vv), t->Recv.UnicastBytes); - UniFormat(tmp, sizeof(tmp), _UU("SM_ST_SIZE_BYTE_STR"), vv); - LvInsertAdd(b, ICO_INFORMATION, 0, 2, _UU("SM_ST_RECV_UCAST_SIZE"), tmp); - - ToStr3(vv, sizeof(vv), t->Recv.BroadcastCount); - UniFormat(tmp, sizeof(tmp), _UU("SM_ST_NUM_PACKET_STR"), vv); - LvInsertAdd(b, ICO_INFORMATION, 0, 2, _UU("SM_ST_RECV_BCAST_NUM"), tmp); - - ToStr3(vv, sizeof(vv), t->Recv.BroadcastBytes); - UniFormat(tmp, sizeof(tmp), _UU("SM_ST_SIZE_BYTE_STR"), vv); - LvInsertAdd(b, ICO_INFORMATION, 0, 2, _UU("SM_ST_RECV_BCAST_SIZE"), tmp); -} - -// Status display dialog procedure -UINT SmStatusDlgProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param) -{ - SM_STATUS *s = (SM_STATUS *)param; - // Validate arguments - if (hWnd == NULL) - { - return 0; - } - - switch (msg) - { - case WM_INITDIALOG: - // Initialize - LvInitEx(hWnd, L_STATUS, s->NoImage); - LvSetStyle(hWnd, L_STATUS, LVS_EX_GRIDLINES); - SetIcon(hWnd, 0, s->Icon); - SetIcon(hWnd, S_ICON, s->Icon); - SetText(hWnd, 0, s->Caption); - SetText(hWnd, S_TITLE, s->Caption); - DlgFont(hWnd, S_TITLE, 15, true); - if (s->InitProc != NULL) - { - s->InitProc(hWnd, s->p, s->Param); - } - else - { - // Initialize the column - LvInsertColumn(hWnd, L_STATUS, 0, _UU("SM_STATUS_COLUMN_1"), 0); - LvInsertColumn(hWnd, L_STATUS, 1, _UU("SM_STATUS_COLUMN_2"), 0); - } - if (s->RefreshProc(hWnd, s->p, s->Param) == false) - { - Close(hWnd); - } - LvAutoSize(hWnd, L_STATUS); - Focus(hWnd, L_STATUS); - - if (s->show_refresh_button == false) - { - Hide(hWnd, IDOK); - } - - break; - - case WM_COMMAND: - switch (wParam) - { - case IDOK: - // Update - if (s->RefreshProc(hWnd, s->p, s->Param) == false) - { - Close(hWnd); - } - LvAutoSize(hWnd, L_STATUS); - break; - - case IDCANCEL: - Close(hWnd); - break; - } - break; - - case WM_CLOSE: - EndDialog(hWnd, 0); - break; - } - - LvStandardHandler(hWnd, msg, wParam, lParam, L_STATUS); - - return 0; -} - -// Status display dialog -void SmStatusDlg(HWND hWnd, SM_SERVER *p, void *param, bool no_image, bool show_refresh_button, wchar_t *caption, UINT icon, - SM_STATUS_INIT_PROC *init, SM_STATUS_REFRESH_PROC *refresh) -{ - SM_STATUS s; - // Validate arguments - if (hWnd == NULL || p == NULL || refresh == NULL) - { - return; - } - - if (icon == 0) - { - icon = ICO_INFORMATION; - } - if (caption == NULL) - { - caption = _UU("SM_INFORMATION"); - } - - Zero(&s, sizeof(s)); - s.show_refresh_button = show_refresh_button; - s.p = p; - s.NoImage = no_image; - s.Param = param; - s.Icon = icon; - s.Caption = caption; - s.InitProc = init; - s.RefreshProc = refresh; - - Dialog(hWnd, D_SM_STATUS, SmStatusDlgProc, &s); -} - -// Server management dialog update -void SmServerDlgUpdate(HWND hWnd, SM_SERVER *p) -{ - bool hub_selected = false; - bool hub_selected_online = false; - bool hub_selected_offline = false; - bool hub_have_admin_right = false; - bool listener_selected = false; - bool listener_selected_enabled = false; - bool listener_selected_disabled = false; - bool two_or_more_listener = false; - bool bridge; - UINT i; - // Validate arguments - if (hWnd == NULL || p == NULL) - { - return; - } - - bridge = GetCapsBool(p->CapsList, "b_bridge"); - - hub_selected = LvIsSelected(hWnd, L_HUB); - - if (hub_selected) - { - if (p->ServerAdminMode) - { - hub_have_admin_right = true; - } - i = LvGetSelected(hWnd, L_HUB); - if (i != INFINITE) - { - wchar_t *s = LvGetStr(hWnd, L_HUB, i, 1); - if (p->ServerAdminMode == false) - { - char *hubname = LvGetStrA(hWnd, L_HUB, i, 0); - if (hubname != NULL) - { - if (StrCmpi(hubname, p->HubName) == 0) - { - hub_have_admin_right = true; - } - Free(hubname); - } - } - hub_selected_online = (UniStrCmpi(s, _UU("SM_HUB_ONLINE")) == 0); - hub_selected_offline = hub_selected_online ? false : true; - Free(s); - } - } - - listener_selected = LvIsSelected(hWnd, L_LISTENER); - if (listener_selected) - { - wchar_t *s = LvGetSelectedStr(hWnd, L_LISTENER, 1); - if (UniStrCmpi(s, _UU("CM_LISTENER_OFFLINE")) == 0) - { - listener_selected_disabled = true; - } - else - { - listener_selected_enabled = true; - } - Free(s); - } - - if (LvNum(hWnd, L_LISTENER) >= 2) - { - two_or_more_listener = true; - } - - SetEnable(hWnd, IDOK, bridge || (hub_selected && hub_have_admin_right)); - SetEnable(hWnd, B_ONLINE, bridge == false && hub_selected_offline && hub_have_admin_right && p->ServerType != SERVER_TYPE_FARM_MEMBER); - SetEnable(hWnd, B_OFFLINE, bridge == false && hub_selected_online && hub_have_admin_right && p->ServerType != SERVER_TYPE_FARM_MEMBER); - SetEnable(hWnd, B_HUB_STATUS, hub_selected && hub_have_admin_right); - SetEnable(hWnd, B_DELETE, bridge == false && hub_selected && p->ServerAdminMode && p->ServerType != SERVER_TYPE_FARM_MEMBER); - SetEnable(hWnd, B_EDIT, hub_selected && hub_have_admin_right && p->ServerType != SERVER_TYPE_FARM_MEMBER); - SetEnable(hWnd, B_CREATE, bridge == false && p->ServerAdminMode && p->ServerType != SERVER_TYPE_FARM_MEMBER); - - SetEnable(hWnd, B_CREATE_LISTENER, p->ServerAdminMode); - SetEnable(hWnd, B_DELETE_LISTENER, p->ServerAdminMode && listener_selected && two_or_more_listener); - SetEnable(hWnd, B_START, p->ServerAdminMode && listener_selected_disabled); - SetEnable(hWnd, B_STOP, p->ServerAdminMode && listener_selected_enabled); - SetEnable(hWnd, B_FARM, GetCapsBool(p->CapsList, "b_support_cluster") && p->ServerAdminMode && GetCapsBool(p->CapsList, "b_support_vgs_in_client") == false); - SetEnable(hWnd, B_FARM_STATUS, GetCapsBool(p->CapsList, "b_support_cluster") && p->ServerType != SERVER_TYPE_STANDALONE); -} - -// Server management dialog initialization -void SmServerDlgInit(HWND hWnd, SM_SERVER *p) -{ - // Validate arguments - if (hWnd == NULL || p == NULL) - { - return; - } - - // Initialize the column - LvInit(hWnd, L_HUB); - LvSetStyle(hWnd, L_HUB, LVS_EX_GRIDLINES); - LvInsertColumn(hWnd, L_HUB, 0, _UU("SM_HUB_COLUMN_1"), 150); - LvInsertColumn(hWnd, L_HUB, 1, _UU("SM_HUB_COLUMN_2"), 80); - LvInsertColumn(hWnd, L_HUB, 2, _UU("SM_HUB_COLUMN_3"), 80); - LvInsertColumn(hWnd, L_HUB, 3, _UU("SM_HUB_COLUMN_4"), 80); - LvInsertColumn(hWnd, L_HUB, 4, _UU("SM_HUB_COLUMN_5"), 80); - LvInsertColumn(hWnd, L_HUB, 5, _UU("SM_HUB_COLUMN_6"), 80); - LvInsertColumn(hWnd, L_HUB, 6, _UU("SM_HUB_COLUMN_7"), 80); - LvInsertColumn(hWnd, L_HUB, 7, _UU("SM_HUB_COLUMN_8"), 80); - LvInsertColumn(hWnd, L_HUB, 8, _UU("SM_HUB_COLUMN_9"), 80); - LvInsertColumn(hWnd, L_HUB, 9, _UU("SM_HUB_COLUMN_10"), 120); - LvInsertColumn(hWnd, L_HUB, 10, _UU("SM_HUB_COLUMN_11"), 120); - LvInsertColumn(hWnd, L_HUB, 11, _UU("SM_SESS_COLUMN_6"), 100); - LvInsertColumn(hWnd, L_HUB, 12, _UU("SM_SESS_COLUMN_7"), 100); - - LvInit(hWnd, L_LISTENER); - LvSetStyle(hWnd, L_LISTENER, LVS_EX_GRIDLINES); - LvInsertColumn(hWnd, L_LISTENER, 0, _UU("CM_LISTENER_COLUMN_1"), 90); - LvInsertColumn(hWnd, L_LISTENER, 1, _UU("CM_LISTENER_COLUMN_2"), 80); - - SmServerDlgRefresh(hWnd, p); - - if (p->ServerAdminMode == false) - { - // Select the target HUB in the case of the Virtual HUB management mode - wchar_t *s = CopyStrToUni(p->HubName); - LvSelect(hWnd, L_HUB, LvSearchStr(hWnd, L_HUB, 0, s)); - Free(s); - } - else - { - // In the case of whole server management mode - UINT num_hubs = LvNum(hWnd, L_HUB); - - if (num_hubs == 1) - { - // Select the Virtual HUB if Virtual HUB exists only one - LvSelect(hWnd, L_HUB, 0); - } - else - { - // Select the Virtual HUB the last selected if there are some virtual HUBs - char tmp[MAX_SIZE]; - char *hubname; - - Format(tmp, sizeof(tmp), "%s:%u:%s", p->CurrentSetting->ClientOption.Hostname, - p->CurrentSetting->ClientOption.Port, - p->CurrentSetting->ServerAdminMode ? "" : p->CurrentSetting->HubName); - - hubname = MsRegReadStr(REG_CURRENT_USER, SM_LASTHUB_REG_KEY, tmp); - - if (IsEmptyStr(hubname) == false) - { - LvSelect(hWnd, L_HUB, LvSearchStrA(hWnd, L_HUB, 0, hubname)); - } - - Free(hubname); - } - } - - Focus(hWnd, L_HUB); - - SmServerDlgUpdate(hWnd, p); - - if (GetCapsBool(p->CapsList, "b_bridge")) - { - Disable(hWnd, L_HUB); - } - - // Enable Local bridge button, etc. in the case of the Admin of the Server - SetEnable(hWnd, B_BRIDGE, GetCapsBool(p->CapsList, "b_local_bridge") && p->ServerAdminMode && GetCapsBool(p->CapsList, "b_support_vgs_in_client") == false); - SetEnable(hWnd, B_CONNECTION, p->ServerAdminMode); - - // Config R/W button - SetEnable(hWnd, B_CONFIG, GetCapsBool(p->CapsList, "b_support_config_rw") && p->ServerAdminMode && GetCapsBool(p->CapsList, "b_support_vgs_in_client") == false); - - // Layer 3 button - SetEnable(hWnd, B_L3, GetCapsBool(p->CapsList, "b_support_layer3") && p->ServerAdminMode && GetCapsBool(p->CapsList, "b_support_vgs_in_client") == false); - - // License button - SetShow(hWnd, B_LICENSE, GetCapsBool(p->CapsList, "b_support_license") && p->ServerAdminMode); - SetShow(hWnd, S_LICENSE, GetCapsBool(p->CapsList, "b_support_license") && p->ServerAdminMode); - SetShow(hWnd, S_BETA, GetCapsBool(p->CapsList, "b_beta_version") && (IsShow(hWnd, B_LICENSE) == false)); - - // IPsec button - SetEnable(hWnd, B_IPSEC, GetCapsBool(p->CapsList, "b_support_ipsec") && p->ServerAdminMode); - - // OpenVPN, SSTP button - SetEnable(hWnd, B_OPENVPN, GetCapsBool(p->CapsList, "b_support_openvpn") && p->ServerAdminMode); - - // DDNS button - SetEnable(hWnd, B_DDNS, GetCapsBool(p->CapsList, "b_support_ddns") && p->ServerAdminMode); - - // VPN Azure button - SetEnable(hWnd, B_AZURE, GetCapsBool(p->CapsList, "b_support_azure") && p->ServerAdminMode); - - DlgFont(hWnd, S_BETA, 12, false); - SetFont(hWnd, E_DDNS_HOST, GetFont("Verdana", 10, false, false, false, false)); - SetFont(hWnd, E_AZURE_HOST, GetFont("Verdana", 10, false, false, false, false)); - - SetShow(hWnd, B_VPNGATE, false); - SetShow(hWnd, S_ICO_VPNGATE, false); - - DlgFont(hWnd, IDOK, 0, true); -} - -// Server management dialog update -void SmServerDlgRefresh(HWND hWnd, SM_SERVER *p) -{ - RPC_ENUM_HUB t; - RPC_LISTENER_LIST t2; - RPC_PORTS t3; - DDNS_CLIENT_STATUS st; - RPC_AZURE_STATUS sta; - UINT i; - // Validate arguments - if (hWnd == NULL || p == NULL) - { - return; - } - - // Virtual HUB list update - Zero(&t, sizeof(t)); - if (CALL(hWnd, ScEnumHub(p->Rpc, &t))) - { - LVB *b = LvInsertStart(); - for (i = 0;i < t.NumHub;i++) - { - RPC_ENUM_HUB_ITEM *e = &t.Hubs[i]; - wchar_t name[MAX_HUBNAME_LEN + 1]; - wchar_t s1[64], s2[64], s3[64], s4[64], s5[64]; - wchar_t s6[64], s7[128], s8[128]; - wchar_t s9[64], s10[64]; - UINT icon; - - UniToStru(s1, e->NumUsers); - UniToStru(s2, e->NumGroups); - UniToStru(s3, e->NumSessions); - UniToStru(s4, e->NumMacTables); - UniToStru(s5, e->NumIpTables); - - UniToStru(s6, e->NumLogin); - - if (e->LastLoginTime != 0) - { - GetDateTimeStr64Uni(s7, sizeof(s7), SystemToLocal64(e->LastLoginTime)); - } - else - { - UniStrCpy(s7, sizeof(s7), _UU("COMMON_UNKNOWN")); - } - - if (e->LastCommTime != 0) - { - GetDateTimeStr64Uni(s8, sizeof(s8), SystemToLocal64(e->LastCommTime)); - } - else - { - UniStrCpy(s8, sizeof(s8), _UU("COMMON_UNKNOWN")); - } - - StrToUni(name, sizeof(name), e->HubName); - - icon = ICO_HUB; - if (e->Online == false) - { - icon = ICO_HUB_OFFLINE; - } - - if (e->IsTrafficFilled == false) - { - UniStrCpy(s9, sizeof(s9), _UU("CM_ST_NONE")); - UniStrCpy(s10, sizeof(s10), _UU("CM_ST_NONE")); - } - else - { - UniToStr3(s9, sizeof(s9), - e->Traffic.Recv.BroadcastBytes + e->Traffic.Recv.UnicastBytes + - e->Traffic.Send.BroadcastBytes + e->Traffic.Send.UnicastBytes); - - UniToStr3(s10, sizeof(s10), - e->Traffic.Recv.BroadcastCount + e->Traffic.Recv.UnicastCount + - e->Traffic.Send.BroadcastCount + e->Traffic.Send.UnicastCount); - } - - LvInsertAdd(b, - icon, - NULL, - 13, - name, - e->Online ? _UU("SM_HUB_ONLINE") : _UU("SM_HUB_OFFLINE"), - GetHubTypeStr(e->HubType), - s1, s2, s3, s4, s5, s6, s7, s8, s9, s10); - } - LvInsertEnd(b, hWnd, L_HUB); - FreeRpcEnumHub(&t); - } - - // Listener list update - Zero(&t2, sizeof(RPC_LISTENER_LIST)); - if (CALL(hWnd, ScEnumListener(p->Rpc, &t2))) - { - LVB *b = LvInsertStart(); - for (i = 0;i < t2.NumPort;i++) - { - wchar_t tmp[MAX_SIZE]; - wchar_t *status; - UINT icon; - UniFormat(tmp, sizeof(tmp), _UU("CM_LISTENER_TCP_PORT"), t2.Ports[i]); - - status = _UU("CM_LISTENER_ONLINE"); - icon = ICO_PROTOCOL; - if (t2.Errors[i]) - { - status = _UU("CM_LISTENER_ERROR"); - icon = ICO_PROTOCOL_X; - } - else if (t2.Enables[i] == false) - { - status = _UU("CM_LISTENER_OFFLINE"); - icon = ICO_PROTOCOL_OFFLINE; - } - - LvInsertAdd(b, icon, (void *)t2.Ports[i], 2, tmp, status); - } - LvInsertEnd(b, hWnd, L_LISTENER); - FreeRpcListenerList(&t2); - } - - // Get the UDP ports - Zero(&t3, sizeof(RPC_PORTS)); - if (CALL(hWnd, ScGetPortsUDP(p->Rpc, &t3))) - { - char str[MAX_SIZE]; - - Zero(str, sizeof(str)); - - if (t3.Num > 0) - { - UINT i; - - Format(str, sizeof(str), "%u", t3.Ports[0]); - - for (i = 1; i < t3.Num; ++i) - { - char tmp[MAX_SIZE]; - Format(tmp, sizeof(tmp), ", %u", t3.Ports[i]); - StrCat(str, sizeof(str), tmp); - } - } - - SetTextA(hWnd, E_UDP, str); - FreeRpcPorts(&t3); - } - - // Get the DDNS client state - Zero(&st, sizeof(st)); - if (ScGetDDnsClientStatus(p->Rpc, &st) == ERR_NO_ERROR && IsEmptyStr(st.CurrentFqdn) == false) - { - SetTextA(hWnd, E_DDNS_HOST, st.CurrentFqdn); - - Show(hWnd, S_DDNS); - Show(hWnd, E_DDNS_HOST); - } - else - { - Hide(hWnd, S_DDNS); - Hide(hWnd, E_DDNS_HOST); - } - - // VPN Azure client state acquisition - Zero(&sta, sizeof(sta)); - if (ScGetAzureStatus(p->Rpc, &sta) == ERR_NO_ERROR && sta.IsEnabled && IsEmptyStr(st.CurrentFqdn) == false) - { - char tmp[MAX_SIZE]; - - StrCpy(tmp, sizeof(tmp), st.CurrentHostName); - StrCat(tmp, sizeof(tmp), AZURE_DOMAIN_SUFFIX); - - SetTextA(hWnd, E_AZURE_HOST, tmp); - - Show(hWnd, S_AZURE); - Show(hWnd, E_AZURE_HOST); - } - else - { - Hide(hWnd, S_AZURE); - Hide(hWnd, E_AZURE_HOST); - } - - SmServerDlgUpdate(hWnd, p); -} - -// Server management dialog procedure -UINT SmServerDlgProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param) -{ - SM_SERVER *p = (SM_SERVER *)param; - wchar_t *s; - wchar_t tmp[MAX_SIZE]; - NMHDR *n; - UINT i; - // Validate arguments - if (hWnd == NULL) - { - return 0; - } - - switch (msg) - { - case WM_INITDIALOG: - FormatText(hWnd, 0, p->Title); - - if (p->Bridge == false) - { - FormatText(hWnd, S_TITLE, p->ServerName); - } - else - { - UniFormat(tmp, sizeof(tmp), _UU("SM_SERVER_BRIDGE_TITLE"), p->ServerName); - SetText(hWnd, S_TITLE, tmp); - } - - DlgFont(hWnd, S_TITLE, 16, 1); - - SetIcon(hWnd, 0, p->Bridge == false ? ICO_VPNSERVER : ICO_BRIDGE); - - SmServerDlgInit(hWnd, p); - - SetTimer(hWnd, 1, 50, NULL); - - break; - - case WM_COMMAND: - switch (wParam) - { - case IDOK: - // Management - if (IsEnable(hWnd, IDOK)) - { - if (p->Bridge == false) - { - s = LvGetSelectedStr(hWnd, L_HUB, 0); - } - else - { - s = CopyUniStr(L"BRIDGE"); - } - if (s != NULL) - { - char hubname[MAX_HUBNAME_LEN + 1]; - SM_HUB hub; - Zero(&hub, sizeof(hub)); - UniToStr(hubname, sizeof(hubname), s); - hub.p = p; - hub.Rpc = p->Rpc; - hub.HubName = hubname; - SmHubDlg(hWnd, &hub); - //SmServerDlgRefresh(hWnd, p); - Free(s); - } - } - break; - - case B_ONLINE: - // Online - s = LvGetSelectedStr(hWnd, L_HUB, 0); - if (s != NULL) - { - RPC_SET_HUB_ONLINE t; - Zero(&t, sizeof(t)); - UniToStr(t.HubName, sizeof(t.HubName), s); - t.Online = true; - if (CALL(hWnd, ScSetHubOnline(p->Rpc, &t))) - { - SmServerDlgRefresh(hWnd, p); - } - Free(s); - } - break; - - case B_OFFLINE: - // Offline - s = LvGetSelectedStr(hWnd, L_HUB, 0); - if (s != NULL) - { - RPC_SET_HUB_ONLINE t; - Zero(&t, sizeof(t)); - // Confirmation message - if (MsgBoxEx(hWnd, MB_ICONQUESTION | MB_YESNO | MB_DEFBUTTON2, - _UU("CM_OFFLINE_MSG"), s) == IDYES) - { - UniToStr(t.HubName, sizeof(t.HubName), s); - t.Online = false; - if (CALL(hWnd, ScSetHubOnline(p->Rpc, &t))) - { - SmServerDlgRefresh(hWnd, p); - } - } - Free(s); - } - break; - - case B_HUB_STATUS: - // Status of HUB - s = LvGetSelectedStr(hWnd, L_HUB, 0); - if (s != NULL) - { - wchar_t tmp[MAX_SIZE]; - char *hubname = CopyUniToStr(s); - UniFormat(tmp, sizeof(tmp), _UU("SM_HUB_STATUS_CAPTION"), s); - SmStatusDlg(hWnd, p, hubname, false, true, tmp, ICO_HUB, - NULL, SmRefreshHubStatus); - Free(hubname); - Free(s); - } - break; - - case B_CREATE: - // Create a HUB - if (SmCreateHubDlg(hWnd, p)) - { - SmServerDlgRefresh(hWnd, p); - } - break; - - case B_EDIT: - // Edit the HUB - s = LvGetSelectedStr(hWnd, L_HUB, 0); - if (s != NULL) - { - char *name = CopyUniToStr(s); - if (SmEditHubDlg(hWnd, p, name)) - { - SmServerDlgRefresh(hWnd, p); - } - Free(name); - Free(s); - } - break; - - case B_DELETE: - // Delete the HUB - s = LvGetSelectedStr(hWnd, L_HUB, 0); - if (s != NULL) - { - char *name = CopyUniToStr(s); - RPC_DELETE_HUB t; - Zero(&t, sizeof(t)); - StrCpy(t.HubName, sizeof(t.HubName), name); - if (MsgBoxEx(hWnd, MB_ICONEXCLAMATION | MB_YESNO | MB_DEFBUTTON2, _UU("CM_DELETE_HUB_MSG"), name) == IDYES) - { - if (CALL(hWnd, ScDeleteHub(p->Rpc, &t))) - { - SmServerDlgRefresh(hWnd, p); - MsgBoxEx(hWnd, MB_ICONINFORMATION, _UU("CM_HUB_DELETED_MSG"), name); - } - } - Free(name); - Free(s); - } - break; - - case B_CREATE_LISTENER: - // Create a listener - if (SmCreateListenerDlg(hWnd, p)) - { - SmServerDlgRefresh(hWnd, p); - } - break; - - case B_DELETE_LISTENER: - // Remove the listener - i = LvGetSelected(hWnd, L_LISTENER); - if (i != INFINITE) - { - UINT port = (UINT)LvGetParam(hWnd, L_LISTENER, i); - if (MsgBoxEx(hWnd, MB_ICONEXCLAMATION | MB_YESNO | MB_DEFBUTTON2, _UU("CM_DELETE_LISTENER_MSG"), port) == IDYES) - { - RPC_LISTENER t; - Zero(&t, sizeof(t)); - t.Enable = false; - t.Port = port; - - if (CALL(hWnd, ScDeleteListener(p->Rpc, &t))) - { - SmServerDlgRefresh(hWnd, p); - } - } - } - break; - - case B_START: - // Start - i = LvGetSelected(hWnd, L_LISTENER); - if (i != INFINITE) - { - UINT port = (UINT)LvGetParam(hWnd, L_LISTENER, i); - RPC_LISTENER t; - Zero(&t, sizeof(t)); - t.Enable = true; - t.Port = port; - - if (CALL(hWnd, ScEnableListener(p->Rpc, &t))) - { - SmServerDlgRefresh(hWnd, p); - } - } - break; - - case B_STOP: - // Stop - i = LvGetSelected(hWnd, L_LISTENER); - if (i != INFINITE) - { - UINT port = (UINT)LvGetParam(hWnd, L_LISTENER, i); - if (MsgBoxEx(hWnd, MB_ICONQUESTION | MB_YESNO | MB_DEFBUTTON2, _UU("CM_STOP_LISTENER_MSG"), port) == IDYES) - { - RPC_LISTENER t; - Zero(&t, sizeof(t)); - t.Enable = false; - t.Port = port; - - if (CALL(hWnd, ScEnableListener(p->Rpc, &t))) - { - SmServerDlgRefresh(hWnd, p); - } - } - } - break; - - case B_APPLY: - { - // Apply UDP ports - bool ret; - LIST* ports; - RPC_PORTS t; - char tmp[MAX_SIZE]; - - GetTxtA(hWnd, E_UDP, tmp, sizeof(tmp)); - ports = StrToPortList(tmp, false); - - t.Num = LIST_NUM(ports); - if (t.Num > 0) - { - UINT i; - t.Ports = Malloc(sizeof(UINT) * t.Num); - - for (i = 0; i < t.Num; ++i) - { - t.Ports[i] = (UINT)LIST_DATA(ports, i); - } - } - else - { - t.Ports = NULL; - } - - ReleaseList(ports); - - if (CALL(hWnd, ScSetPortsUDP(p->Rpc, &t))) - { - SmServerDlgRefresh(hWnd, p); - } - - Free(t.Ports); - - break; - } - - case B_SSL: - // SSL related - SmSslDlg(hWnd, p); - break; - - case B_STATUS: - // Server status - SmStatusDlg(hWnd, p, p, false, true, _UU("SM_SERVER_STATUS"), ICO_VPNSERVER, - NULL, SmRefreshServerStatus); - break; - - case B_INFO: - // Server Information - SmStatusDlg(hWnd, p, p, false, false, _UU("SM_INFO_TITLE"), ICO_VPNSERVER, - NULL, SmRefreshServerInfo); - break; - - case B_BRIDGE: - // Local bridge configuration - SmBridgeDlg(hWnd, p); - SmServerDlgRefresh(hWnd, p); - break; - - case B_FARM: - // Server farm - if (SmFarmDlg(hWnd, p)) - { - // Close the dialog if the server farm configuration has changed - Close(hWnd); - } - break; - - case B_FARM_STATUS: - // Server farm status - if (p->ServerType == SERVER_TYPE_FARM_CONTROLLER) - { - Dialog(hWnd, D_SM_FARM_MEMBER, SmFarmMemberDlgProc, p); - } - else if (p->ServerType == SERVER_TYPE_FARM_MEMBER) - { - SmStatusDlg(hWnd, p, NULL, false, true, _UU("SM_FC_STATUS_CAPTION"), - ICO_FARM, NULL, SmRefreshFarmConnectionInfo); - } - break; - - case B_CONNECTION: - // TCP connection list - SmConnectionDlg(hWnd, p); - break; - - case B_REFRESH: - // Update to the latest state - SmServerDlgRefresh(hWnd, p); - break; - - case B_CONFIG: - // Config edit - SmConfig(hWnd, p); - break; - - case B_L3: - // L3 switch - SmL3(hWnd, p); - break; - - case B_LICENSE: - // Add or Remove license - SmLicense(hWnd, p); - SmServerDlgUpdate(hWnd, p); - break; - - case B_IPSEC: - // IPsec Settings - SmIPsec(hWnd, p); - break; - - case B_OPENVPN: - // OpenVPN, SSTP setting - SmOpenVpn(hWnd, p); - break; - - case B_DDNS: - // DDNS setting - if (SmDDns(hWnd, p, false, false)) - { - SmServerDlgRefresh(hWnd, p); - } - break; - - case B_AZURE: - // VPN Azure setting - SmAzure(hWnd, p, false); - - SmServerDlgRefresh(hWnd, p); - break; - - - case IDCANCEL: - Close(hWnd); - break; - } - break; - - case WM_CLOSE: - { - // Save the HUB that was selected last - char *hubname = NULL; - char tmp[MAX_SIZE]; - - - Format(tmp, sizeof(tmp), "%s:%u:%s", p->CurrentSetting->ClientOption.Hostname, - p->CurrentSetting->ClientOption.Port, - p->CurrentSetting->ServerAdminMode ? "" : p->CurrentSetting->HubName); - - if (LvIsSingleSelected(hWnd, L_HUB)) - { - hubname = LvGetSelectedStrA(hWnd, L_HUB, 0); - } - - if (IsEmptyStr(hubname) == false) - { - MsRegWriteStr(REG_CURRENT_USER, SM_LASTHUB_REG_KEY, tmp, hubname); - } - else - { - MsRegDeleteValue(REG_CURRENT_USER, SM_LASTHUB_REG_KEY, tmp); - } - - Free(hubname); - - EndDialog(hWnd, false); - } - break; - - case WM_NOTIFY: - n = (NMHDR *)lParam; - switch (n->idFrom) - { - case L_HUB: - switch (n->code) - { - case LVN_ITEMCHANGED: - SmServerDlgUpdate(hWnd, p); - break; - } - break; - case L_LISTENER: - switch (n->code) - { - case LVN_ITEMCHANGED: - SmServerDlgUpdate(hWnd, p); - break; - } - break; - } - break; - - case WM_TIMER: - switch (wParam) - { - case 1: - KillTimer(hWnd, 1); - - if (p->ServerAdminMode) - { - // Prompt the registration if the license key is not registered - RPC_LICENSE_STATUS t; - - Zero(&t, sizeof(t)); - if (p->Bridge == false && GetCapsBool(p->CapsList, "b_support_license")) - { - if (ScGetLicenseStatus(p->Rpc, &t) == ERR_NO_ERROR) - { - if (t.EditionId == LICENSE_EDITION_VPN3_NO_LICENSE || (t.NeedSubscription && t.SubscriptionExpires == 0)) - { - // Valid license key is not registered - - if (MsgBox(hWnd, MB_YESNO | MB_ICONINFORMATION, - _UU("SM_SETUP_NO_LICENSE_KEY")) == IDYES) - { - SmLicense(hWnd, p); - } - } - } - } - } - - SetTimer(hWnd, 2, 150, NULL); - break; - - case 2: - // Setup - KillTimer(hWnd, 2); - - if (SmSetupIsNew(p)) - { - if (SmSetup(hWnd, p)) - { - SmServerDlgRefresh(hWnd, p); - } - } - - SmShowIPSecMessageIfNecessary(hWnd, p); - - SmShowCertRegenerateMessageIfNecessary(hWnd, p); - - SetTimer(hWnd, 3, 150, NULL); - break; - - case 3: - // Message for Administrators - KillTimer(hWnd, 3); - - if (UniIsEmptyStr(p->AdminMsg) == false) - { - wchar_t tmp[MAX_SIZE]; - - UniFormat(tmp, sizeof(tmp), _UU("SM_SERVER_ADMIN_MSG"), p->ServerName); - OnceMsg(hWnd, tmp, p->AdminMsg, true, ICO_VPNSERVER); - } - break; - } - break; - } - - LvStandardHandler(hWnd, msg, wParam, lParam, L_HUB); - - return 0; -} - -// Display the message about the cert -void SmShowCertRegenerateMessageIfNecessary(HWND hWnd, SM_SERVER *p) -{ - // Validate arguments - if (p == NULL) - { - return; - } - - if (p->ServerAdminMode && p->Bridge == false) - { - RPC_KEY_PAIR t; - - Zero(&t, sizeof(t)); - - if (ScGetServerCert(p->Rpc, &t) == ERR_NO_ERROR) - { - if (t.Cert != NULL && t.Cert->has_basic_constraints == false) - { - if (t.Cert->root_cert) - { - if (MsRegReadInt(REG_CURRENT_USER, SM_HIDE_CERT_UPDATE_MSG_KEY, p->ServerName) == 0) - { - if (MsgBox(hWnd, MB_ICONQUESTION | MB_YESNO, _UU("SM_CERT_MESSAGE")) == IDYES) - { - X *x; - K *k; - - // Regenerating the certificate - if (SmRegenerateServerCert(hWnd, p, NULL, &x, &k, false)) - { - // Confirmation message - if (MsgBox(hWnd, MB_ICONEXCLAMATION | MB_YESNO, _UU("SM_REGENERATE_CERT_MSG")) == IDYES) - { - // Set the new certificate and private key - RPC_KEY_PAIR t2; - - Zero(&t2, sizeof(t2)); - - t2.Cert = CloneX(x); - t2.Key = CloneK(k); - - if (CALL(hWnd, ScSetServerCert(p->Rpc, &t2))) - { - FreeRpcKeyPair(&t2); - - MsgBox(hWnd, MB_ICONINFORMATION, _UU("CM_CERT_SET_MSG")); - } - } - - FreeX(x); - FreeK(k); - } - } - else - { - MsRegWriteInt(REG_CURRENT_USER, SM_HIDE_CERT_UPDATE_MSG_KEY, p->ServerName, 1); - } - } - } - } - - FreeRpcKeyPair(&t); - } - } -} - -// Display messages about IPsec, and prompt for the setting -void SmShowIPSecMessageIfNecessary(HWND hWnd, SM_SERVER *p) -{ - // Validate arguments - if (p == NULL) - { - return; - } - - if (GetCapsBool(p->CapsList, "b_support_vgs_in_client") == false) - { - if (GetCapsBool(p->CapsList, "b_support_ipsec") && p->IPsecMessageDisplayed == false) - { - // Display a message about IPsec - RPC_TEST flag; - - if (MsgBox(hWnd, MB_ICONQUESTION | MB_YESNO, _UU("SM_IPSEC_SETUP_QUESTION")) == IDYES) - { - // Display the IPsec dialog - SmIPsec(hWnd, p); - } - - Zero(&flag, sizeof(flag)); - flag.IntValue = 9; - ToStr(flag.StrValue, 1); - - ScDebug(p->Rpc, &flag); - - p->IPsecMessageDisplayed = true; - } - - } -} - -// Connection -void SmConnect(HWND hWnd, SETTING *s) -{ - SmConnectEx(hWnd, s, false); -} -void SmConnectEx(HWND hWnd, SETTING *s, bool is_in_client) -{ - bool ok; - RPC *rpc; - char *pass; - bool empty_password = false; - bool first_bad_password = false; - // Validate arguments - if (s == NULL) - { - return; - } - - // Disable the control - Disable(hWnd, L_SETTING); - Disable(hWnd, B_NEW_SETTING); - Disable(hWnd, B_EDIT_SETTING); - Disable(hWnd, B_DELETE); - Disable(hWnd, IDOK); - Disable(hWnd, B_ABOUT); - Disable(hWnd, IDCANCEL); - Disable(hWnd, B_SECURE_MANAGER); - Disable(hWnd, B_SELECT_SECURE); - Disable(hWnd, B_CERT_TOOL); - - ok = true; - - if (IsZero(s->HashedPassword, SHA1_SIZE)) - { - // Password input screen -ENTER_PASSWORD: - pass = SmPassword(hWnd, s->ClientOption.Hostname); - if (pass != NULL) - { - Sha0(s->HashedPassword, pass, StrLen(pass)); - Free(pass); - ok = true; - } - else - { - ok = false; - } - } - - if (ok) - { - UINT err = ERR_INTERNAL_ERROR; - // Connection - rpc = AdminConnectEx2(sm->Cedar, &s->ClientOption, s->ServerAdminMode ? "" : s->HubName, s->HashedPassword, &err, NULL, - hWnd); - if (rpc == NULL) - { - // An error has occured - if (err != ERR_ACCESS_DENIED || first_bad_password) - { - MsgBox(hWnd, MB_ICONSTOP, _E(err)); - } - if (err == ERR_ACCESS_DENIED) - { - // Password incorrect - first_bad_password = true; - goto ENTER_PASSWORD; - } - else - { - // Other errors - } - } - else - { - UCHAR test[SHA1_SIZE]; - SM_SERVER p; - RPC_SERVER_STATUS status; - RPC_SERVER_INFO info; - SETTING *setting; - RPC_MSG msg; - RPC_TEST flag; - bool cancel = false; - - Sha0(test, "", 0); - - if (Cmp(test, s->HashedPassword, SHA1_SIZE) == 0 || Cmp(test, rpc->VpnServerHashedPassword, SHA1_SIZE) == 0) - { - empty_password = true; - } - - if (sm->TempSetting == NULL) - { - setting = SmGetSetting(s->Title); - if (setting != NULL) - { - if (IsZero(setting->HashedPassword, SHA1_SIZE) == false) - { - Copy(setting->HashedPassword, s->HashedPassword, SHA1_SIZE); - SmWriteSettingList(); - } - } - } - - rpc->ServerAdminMode = s->ServerAdminMode; - if (s->ServerAdminMode == false) - { - StrCpy(rpc->HubName, sizeof(rpc->HubName), s->HubName); - } - - Zero(&p, sizeof(p)); - p.IsInClient = is_in_client; - p.CurrentSetting = s; - p.Rpc = rpc; - p.ServerAdminMode = rpc->ServerAdminMode; - StrCpy(p.ServerName, sizeof(p.ServerName), s->ClientOption.Hostname); - if (p.ServerAdminMode == false) - { - StrCpy(p.HubName, sizeof(p.HubName), rpc->HubName); - } - UniStrCpy(p.Title, sizeof(p.Title), s->Title); - - // Get the type of server - Zero(&status, sizeof(status)); - ScGetServerStatus(rpc, &status); - - p.ServerType = status.ServerType; - - Zero(&info, sizeof(info)); - ScGetServerInfo(rpc, &info); - - Copy(&p.ServerInfo, &info, sizeof(RPC_SERVER_INFO)); - Copy(&p.ServerStatus, &status, sizeof(RPC_SERVER_STATUS)); - - // Get the Admin Msg - Zero(&msg, sizeof(msg)); - if (ScGetAdminMsg(rpc, &msg) == ERR_NO_ERROR) - { - p.AdminMsg = UniCopyStr(msg.Msg); - FreeRpcMsg(&msg); - } - - // IPsec related - Zero(&flag, sizeof(flag)); - flag.IntValue = 8; - if (ScDebug(rpc, &flag) == ERR_NO_ERROR) - { - p.IPsecMessageDisplayed = ToInt(flag.StrValue); - } - else - { - p.IPsecMessageDisplayed = true; - } - - // VGS related - Zero(&flag, sizeof(flag)); - flag.IntValue = 10; - if (ScDebug(rpc, &flag) == ERR_NO_ERROR) - { - p.VgsMessageDisplayed = ToInt(flag.StrValue); - } - else - { - p.VgsMessageDisplayed = true; - } - - // Get the Caps - p.CapsList = ScGetCapsEx(p.Rpc); - - p.Bridge = GetCapsBool(p.CapsList, "b_bridge"); - - if (GetCapsBool(p.CapsList, "b_support_policy_ver_3")) - { - p.PolicyVer = 3; - } - else - { - p.PolicyVer = 2; - } - - if (empty_password && s->ServerAdminMode) - { - // Make the user set a password when a password empty (In the case of server management mode) - if (Dialog(hWnd, D_SM_CHANGE_PASSWORD, SmChangeServerPasswordDlg, &p) == 0) - { - cancel = true; - } - } - - // Server management screen - if (cancel == false) - { - // Update notification initialization - WINUI_UPDATE *update = NULL; - - if (p.ServerAdminMode && is_in_client == false) - { - wchar_t update_software_title[MAX_SIZE]; - char update_software_name[MAX_SIZE]; - char server_name_safe[MAX_HOST_NAME_LEN + 1]; - char family_name[128]; - - MakeSafeFileName(server_name_safe, sizeof(server_name_safe), p.ServerName); - Format(update_software_name, sizeof(update_software_name), (p.Bridge ? NAME_OF_VPN_BRIDGE_TARGET : NAME_OF_VPN_SERVER_TARGET), server_name_safe); - StrLower(update_software_name); - Trim(update_software_name); - - Zero(family_name, sizeof(family_name)); - StrCpy(family_name, sizeof(family_name), p.ServerInfo.ServerFamilyName); - - if (IsEmptyStr(family_name)) - { - if (InStr(p.ServerInfo.ServerProductName, "PacketiX")) - { - StrCpy(family_name, sizeof(family_name), "PacketiX"); - } - else if (InStr(p.ServerInfo.ServerProductName, "UT-VPN") || - InStr(p.ServerInfo.ServerProductName, "SoftEther")) - { - StrCpy(family_name, sizeof(family_name), "softether"); - } - } - - if (IsEmptyStr(family_name) == false) - { - UniFormat(update_software_title, sizeof(update_software_title), _UU(p.Bridge ? "SM_UPDATE_CHECK_TITLE_VPNBRIDGE" : "SM_UPDATE_CHECK_TITLE_VPNSERVER"), - family_name, p.ServerName); - - update = InitUpdateUi(update_software_title, update_software_name, family_name, p.ServerInfo.ServerBuildDate, - p.ServerInfo.ServerBuildInt, p.ServerInfo.ServerVerInt, NULL, false); - } - } - - p.Update = update; - - // Main screen - Dialog(hWnd, D_SM_SERVER, SmServerDlgProc, &p); - - if (p.Update != NULL) - { - FreeUpdateUi(p.Update); - p.Update = NULL; - } - } - - // Disconnect - AdminDisconnect(rpc); - - // Release the Caps - FreeCapsList(p.CapsList); - - Free(p.AdminMsg); - p.AdminMsg = NULL; - - FreeRpcServerInfo(&info); - } - } - - // Enable the control - Enable(hWnd, L_SETTING); - Enable(hWnd, B_NEW_SETTING); - Enable(hWnd, B_EDIT_SETTING); - Enable(hWnd, B_DELETE); - Enable(hWnd, IDOK); - Enable(hWnd, B_ABOUT); - Enable(hWnd, IDCANCEL); - - if (MsIsWine() == false) - { - Enable(hWnd, B_SECURE_MANAGER); - Enable(hWnd, B_SELECT_SECURE); - } - - Enable(hWnd, B_CERT_TOOL); -} - -// Password input dialog -char *SmPassword(HWND hWnd, char *server_name) -{ - char *ret; - UI_PASSWORD_DLG p; - // Validate arguments - if (server_name == NULL) - { - return NULL; - } - - Zero(&p, sizeof(p)); - p.AdminMode = true; - StrCpy(p.ServerName, sizeof(p.ServerName), server_name); - - if (PasswordDlg(hWnd, &p) == false) - { - return NULL; - } - - ret = CopyStr(p.Password); - - return ret; -} - -// Configuration editing dialog initialization -void SmEditSettingDlgInit(HWND hWnd, SM_EDIT_SETTING *p) -{ - SETTING *s; - // Validate arguments - if (hWnd == NULL || p == NULL) - { - return; - } - - p->Inited = false; - - s = p->Setting; - - // Title - if (p->EditMode == false) - { - SetText(hWnd, 0, _UU("SM_EDIT_CAPTION_1")); - } - else - { - wchar_t tmp[MAX_SIZE]; - UniFormat(tmp, sizeof(tmp), _UU("SM_EDIT_CAPTION_2"), s->Title); - SetText(hWnd, 0, tmp); - } - - // Connection setting name - SetText(hWnd, E_ACCOUNT_NAME, s->Title); - - // Host name - SetTextA(hWnd, E_HOSTNAME, s->ClientOption.Hostname); - - // Port number - CbSetHeight(hWnd, C_PORT, 18); - CbAddStr(hWnd, C_PORT, _UU("CM_PORT_1"), 0); - CbAddStr(hWnd, C_PORT, _UU("CM_PORT_2"), 0); - CbAddStr(hWnd, C_PORT, _UU("CM_PORT_3"), 0); - CbAddStr(hWnd, C_PORT, _UU("CM_PORT_4"), 0); - SetIntEx(hWnd, C_PORT, s->ClientOption.Port); - - // Proxy Settings - Check(hWnd, R_DIRECT_TCP, s->ClientOption.ProxyType == PROXY_DIRECT); - Check(hWnd, R_HTTPS, s->ClientOption.ProxyType == PROXY_HTTP); - Check(hWnd, R_SOCKS, s->ClientOption.ProxyType == PROXY_SOCKS); - Check(hWnd, R_SOCKS5, s->ClientOption.ProxyType == PROXY_SOCKS5); - - // Management mode setting - Check(hWnd, R_SERVER_ADMIN, s->ServerAdminMode); - Check(hWnd, R_HUB_ADMIN, s->ServerAdminMode == false ? true : false); - CbSetHeight(hWnd, C_HUBNAME, 18); - SetTextA(hWnd, C_HUBNAME, s->HubName); - - // Password - if (IsZero(s->HashedPassword, SHA1_SIZE)) - { - Check(hWnd, R_NO_SAVE, true); - } - else - { - UCHAR test[SHA1_SIZE]; - - Sha0(test, "", 0); - if (Cmp(test, s->HashedPassword, SHA1_SIZE) != 0) - { - SetTextA(hWnd, E_PASSWORD, HIDDEN_PASSWORD); - } - } - - if (p->EditMode == false) - { - FocusEx(hWnd, E_ACCOUNT_NAME); - } - else - { - FocusEx(hWnd, E_HOSTNAME); - } - - p->Inited = true; - - // Start enumerating the Virtual HUBs - CmEnumHubStart(hWnd, &s->ClientOption); - - SmEditSettingDlgUpdate(hWnd, p); -} - -// Configuration editing dialog update -void SmEditSettingDlgUpdate(HWND hWnd, SM_EDIT_SETTING *p) -{ - bool ok = true; - UINT delete_hub_list = 0; - SETTING *s; - char tmp[MAX_SIZE]; - // Validate arguments - if (hWnd == NULL || p == NULL || p->Inited == false) - { - return; - } - - s = p->Setting; - - GetTxt(hWnd, E_ACCOUNT_NAME, s->Title, sizeof(s->Title)); - UniTrim(s->Title); - - if (UniStrLen(s->Title) == 0) - { - ok = false; - } - - if (IsChecked(hWnd, R_LOCALHOST)) - { - SetTextA(hWnd, E_HOSTNAME, "localhost"); - Disable(hWnd, E_HOSTNAME); - } - else - { - Enable(hWnd, E_HOSTNAME); - } - - GetTxtA(hWnd, E_HOSTNAME, tmp, sizeof(tmp)); - Trim(tmp); - - if (StrCmpi(tmp, s->ClientOption.Hostname) != 0) - { - delete_hub_list++; - } - - StrCpy(s->ClientOption.Hostname, sizeof(s->ClientOption.Hostname), tmp); - - if (StrLen(s->ClientOption.Hostname) == 0) - { - ok = false; - } - - s->ClientOption.Port = GetInt(hWnd, C_PORT); - if (s->ClientOption.Port == 0) - { - ok = false; - } - - if (IsChecked(hWnd, R_DIRECT_TCP)) - { - s->ClientOption.ProxyType = PROXY_DIRECT; - } - else if (IsChecked(hWnd, R_HTTPS)) - { - s->ClientOption.ProxyType = PROXY_HTTP; - } - else - { - s->ClientOption.ProxyType = PROXY_SOCKS; - } - - SetEnable(hWnd, B_PROXY_CONFIG, s->ClientOption.ProxyType != PROXY_DIRECT); - - if (s->ClientOption.ProxyType != PROXY_DIRECT) - { - if (StrLen(s->ClientOption.ProxyName) == 0) - { - ok = false; - } - if (s->ClientOption.ProxyPort == 0) - { - ok = false; - } - } - - s->ServerAdminMode = IsChecked(hWnd, R_SERVER_ADMIN); - - SetEnable(hWnd, C_HUBNAME, s->ServerAdminMode == false ? true : false); - SetEnable(hWnd, S_HUBNAME, s->ServerAdminMode == false ? true : false); - - GetTxtA(hWnd, C_HUBNAME, s->HubName, sizeof(s->HubName)); - Trim(s->HubName); - if (StrLen(s->HubName) == 0) - { - if (s->ServerAdminMode == false) - { - ok = false; - } - } - - if (IsChecked(hWnd, R_NO_SAVE)) - { - Zero(s->HashedPassword, SHA1_SIZE); - SetTextA(hWnd, E_PASSWORD, ""); - Disable(hWnd, E_PASSWORD); - Disable(hWnd, S_PASSWORD); - } - else - { - char tmp[MAX_PASSWORD_LEN + 1]; - Enable(hWnd, E_PASSWORD); - Enable(hWnd, S_PASSWORD); - GetTxtA(hWnd, E_PASSWORD, tmp, sizeof(tmp)); - if (StrCmp(tmp, HIDDEN_PASSWORD) != 0) - { - Sha0(s->HashedPassword, tmp, StrLen(tmp)); - } - } - - if (delete_hub_list) - { - CbReset(hWnd, C_HUBNAME); - } - - SetEnable(hWnd, IDOK, ok); -} - -// Configuration Edit dialog OK button -void SmEditSettingDlgOnOk(HWND hWnd, SM_EDIT_SETTING *p) -{ - // Validate arguments - if (hWnd == NULL || p == NULL) - { - return; - } - - if (p->EditMode == false) - { - // Register new - SETTING *s = ZeroMalloc(sizeof(SETTING)); - Copy(s, p->Setting, sizeof(SETTING)); - if (SmAddSetting(s) == false) - { - MsgBoxEx(hWnd, MB_ICONEXCLAMATION, _UU("SM_SETTING_EXISTS"), s->Title); - Free(s); - FocusEx(hWnd, E_ACCOUNT_NAME); - return; - } - EndDialog(hWnd, true); - } - else - { - // Update registration - SETTING *t = SmGetSetting(p->Setting->Title); - if (t != NULL && t != p->OldSetting) - { - MsgBoxEx(hWnd, MB_ICONEXCLAMATION, _UU("SM_SETTING_EXISTS"), p->Setting->Title); - FocusEx(hWnd, E_ACCOUNT_NAME); - return; - } - - Copy(p->OldSetting, p->Setting, sizeof(SETTING)); - Sort(sm->SettingList); - SmWriteSettingList(); - - EndDialog(hWnd, true); - } -} - -// Settings add / edit dialog -UINT SmEditSettingDlgProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param) -{ - SM_EDIT_SETTING *p = (SM_EDIT_SETTING *)param; - // Validate arguments - if (hWnd == NULL) - { - return 0; - } - - switch (msg) - { - case WM_INITDIALOG: - SmEditSettingDlgInit(hWnd, p); - break; - - case WM_COMMAND: - switch (LOWORD(wParam)) - { - case R_LOCALHOST: - case E_ACCOUNT_NAME: - case E_HOSTNAME: - case C_PORT: - case R_DIRECT_TCP: - case R_HTTPS: - case R_SOCKS: - case R_SOCKS5: - case R_SERVER_ADMIN: - case R_HUB_ADMIN: - case C_HUBNAME: - case E_PASSWORD: - case R_NO_SAVE: - SmEditSettingDlgUpdate(hWnd, p); - break; - } - - if (LOWORD(wParam) == R_LOCALHOST) - { - FocusEx(hWnd, E_HOSTNAME); - } - - switch (LOWORD(wParam)) - { - case E_HOSTNAME: - if (HIWORD(wParam) == EN_KILLFOCUS) - { - CmEnumHubStart(hWnd, &p->Setting->ClientOption); - } - break; - case C_PORT: - if (HIWORD(wParam) == CBN_KILLFOCUS) - { - CmEnumHubStart(hWnd, &p->Setting->ClientOption); - } - break; - case R_DIRECT_TCP: - case R_HTTPS: - case R_SOCKS: - case R_SOCKS5: - if (HIWORD(wParam) == BN_CLICKED) - { - CmEnumHubStart(hWnd, &p->Setting->ClientOption); - } - break; - } - - switch (wParam) - { - case IDOK: - SmEditSettingDlgOnOk(hWnd, p); - break; - - case IDCANCEL: - Close(hWnd); - break; - - case B_PROXY_CONFIG: - // Proxy Settings - if (CmProxyDlg(hWnd, &p->Setting->ClientOption)) - { - UINT n = GetInt(hWnd, C_PORT); - if (p->Setting->ClientOption.ProxyType == PROXY_HTTP && - n != 443) - { - // Show a warning message if the destination port is - // other than 443 in when HTTP proxy is used - if (MsgBoxEx(hWnd, MB_ICONQUESTION | MB_YESNO, _UU("CM_HTTP_PROXY_WARNING"), n) == IDYES) - { - // Change the port number to 443 - SetText(hWnd, C_PORT, _UU("CM_PORT_2")); - } - } - SmEditSettingDlgUpdate(hWnd, p); - CmEnumHubStart(hWnd, &p->Setting->ClientOption); - } - break; - - case R_NO_SAVE: - if (IsChecked(hWnd, R_NO_SAVE) == false) - { - FocusEx(hWnd, E_PASSWORD); - } - break; - } - break; - - case WM_CLOSE: - EndDialog(hWnd, false); - break; - } - - return 0; -} - -// Show the Settings Adding dialog -bool SmAddSettingDlg(HWND hWnd, wchar_t *new_name, UINT new_name_size) -{ - SM_EDIT_SETTING p; - SETTING s; - UINT i; - bool ret; - // Validate arguments - if (hWnd == NULL || new_name == NULL) - { - return false; - } - - Zero(&p, sizeof(p)); - Zero(&s, sizeof(s)); - - s.ClientOption.Port = 443; - - p.EditMode = false; - p.Setting = &s; - - for (i = 1;;i++) - { - wchar_t tmp[MAX_SIZE]; - if (i == 1) - { - UniFormat(tmp, sizeof(tmp), _UU("CM_NEW_ACCOUNT_NAME_1")); - } - else - { - UniFormat(tmp, sizeof(tmp), _UU("CM_NEW_ACCOUNT_NAME_2"), i); - } - - if (SmGetSetting(tmp) == NULL) - { - UniStrCpy(s.Title, sizeof(s.Title), tmp); - Sha0(s.HashedPassword, "", 0); - s.ServerAdminMode = true; - break; - } - } - - ret = Dialog(hWnd, D_SM_EDIT_SETTING, SmEditSettingDlgProc, &p); - - if (ret) - { - UniStrCpy(new_name, new_name_size, s.Title); - } - - return ret; -} - -// Show the settings edit dialog -bool SmEditSettingDlg(HWND hWnd) -{ - SM_EDIT_SETTING p; - SETTING s, *setting; - UINT i; - wchar_t *name; - // Validate arguments - if (hWnd == NULL) - { - return false; - } - - i = LvGetSelected(hWnd, L_SETTING); - if (i == INFINITE) - { - return false; - } - - name = LvGetStr(hWnd, L_SETTING, i, 0); - - setting = SmGetSetting(name); - if (setting == NULL) - { - Free(name); - return false; - } - - Free(name); - - Copy(&s, setting, sizeof(SETTING)); - - Zero(&p, sizeof(p)); - - p.EditMode = true; - p.OldSetting = setting; - p.Setting = &s; - - return Dialog(hWnd, D_SM_EDIT_SETTING, SmEditSettingDlgProc, &p); -} - -// Update the configuration -bool SmCheckNewName(SETTING *s, wchar_t *new_title) -{ - UINT i; - // Validate arguments - if (new_title == NULL) - { - return false; - } - if (s != NULL) - { - if (IsInList(sm->SettingList, s) == false) - { - return false; - } - } - - // Check whether there is the same name in other - for (i = 0;i < LIST_NUM(sm->SettingList);i++) - { - SETTING *t = LIST_DATA(sm->SettingList, i); - - if (s != t) - { - if (UniStrCmpi(t->Title, new_title) == 0) - { - return false; - } - } - } - - return true; -} - -// Delete the configuration -void SmDeleteSetting(wchar_t *title) -{ - SETTING *s; - // Validate arguments - if (title == NULL) - { - return; - } - - s = SmGetSetting(title); - if (s == NULL) - { - return; - } - - Delete(sm->SettingList, s); - Free(s); - Sort(sm->SettingList); - - SmWriteSettingList(); -} - -// Add the settings -bool SmAddSetting(SETTING *s) -{ - // Validate arguments - if (s == NULL) - { - return false; - } - - if (SmGetSetting(s->Title) != NULL) - { - return false; - } - - Insert(sm->SettingList, s); - - SmWriteSettingList(); - - return true; -} - -// Get the configuration -SETTING *SmGetSetting(wchar_t *title) -{ - SETTING s; - // Validate arguments - if (title == NULL) - { - return NULL; - } - - Zero(&s, sizeof(SETTING)); - UniStrCpy(s.Title, sizeof(s.Title), title); - - return (SETTING *)Search(sm->SettingList, &s); -} - -// Comparison of connection settings -int SmCompareSetting(void *p1, void *p2) -{ - SETTING *s1, *s2; - if (p1 == NULL || p2 == NULL) - { - return 0; - } - s1 = *(SETTING **)p1; - s2 = *(SETTING **)p2; - if (s1 == NULL || s2 == NULL) - { - return 0; - } - - return UniStrCmpi(s1->Title, s2->Title); -} - -// Initialize the configuration list -void SmInitSettingList() -{ - sm->SettingList = NewList(SmCompareSetting); - - SmLoadSettingList(); - - SmInitDefaultSettingList(); -} - -// Release the configuration list -void SmFreeSettingList() -{ - UINT i; - - // Write - SmWriteSettingList(); - - for (i = 0;i < LIST_NUM(sm->SettingList);i++) - { - SETTING *s = LIST_DATA(sm->SettingList, i); - Free(s); - } - ReleaseList(sm->SettingList); - - sm->SettingList = NULL; -} - -// Write the configuration list -void SmWriteSettingList() -{ - TOKEN_LIST *t; - UINT i; - - t = MsRegEnumValue(REG_CURRENT_USER, SM_SETTING_REG_KEY); - if (t != NULL) - { - // Remove all existing values - for (i = 0;i < t->NumTokens;i++) - { - char *name = t->Token[i]; - MsRegDeleteValue(REG_CURRENT_USER, SM_SETTING_REG_KEY, name); - } - - FreeToken(t); - } - - for (i = 0;i < LIST_NUM(sm->SettingList);i++) - { - char name[MAX_SIZE]; - SETTING *s = LIST_DATA(sm->SettingList, i); - - // Write - Format(name, sizeof(name), "Setting%u", i + 1); - MsRegWriteBin(REG_CURRENT_USER, SM_SETTING_REG_KEY, name, s, sizeof(SETTING)); - } -} - -// Load the connection list -void SmLoadSettingList() -{ - TOKEN_LIST *t; - UINT i; - char *key_name = SM_SETTING_REG_KEY; - - t = MsRegEnumValue(REG_CURRENT_USER, key_name); - if (t == NULL) - { - key_name = SM_SETTING_REG_KEY_OLD; - t = MsRegEnumValue(REG_CURRENT_USER, key_name); - if (t == NULL) - { - return; - } - } - - for (i = 0;i < t->NumTokens;i++) - { - char *name = t->Token[i]; - BUF *b = MsRegReadBin(REG_CURRENT_USER, key_name, name); - if (b != NULL) - { - if (b->Size == sizeof(SETTING)) - { - SETTING *s = ZeroMalloc(sizeof(SETTING)); - Copy(s, b->Buf, sizeof(SETTING)); - - Add(sm->SettingList, s); - } - FreeBuf(b); - } - } - - FreeToken(t); - - Sort(sm->SettingList); -} - -// Initialize the default setting list -void SmInitDefaultSettingList() -{ - if (LIST_NUM(sm->SettingList) == 0) - { - bool b = false; - LIST *pl = MsGetProcessList(); - - if (pl != NULL) - { - UINT i; - for (i = 0;i < LIST_NUM(pl);i++) - { - MS_PROCESS *p = LIST_DATA(pl, i); - - if (UniInStr(p->ExeFilenameW, L"vpnserver.exe") || UniInStr(p->ExeFilenameW, L"vpnbridge.exe")) - { - b = true; - } - - if (UniInStr(p->ExeFilenameW, L"sevpnserver.exe") || UniInStr(p->ExeFilenameW, L"sevpnbridge.exe")) - { - b = true; - } - - if (UniInStr(p->ExeFilenameW, L"utvpnserver.exe") || UniInStr(p->ExeFilenameW, L"utvpnbridge.exe")) - { - b = true; - } - } - } - - MsFreeProcessList(pl); - - if (b == false) - { - if (MsIsServiceRunning(GC_SVC_NAME_VPNSERVER) || MsIsServiceRunning(GC_SVC_NAME_VPNBRIDGE)) - { - b = true; - } - } - - if (b) - { - SETTING *s = ZeroMalloc(sizeof(SETTING)); - - UniStrCpy(s->Title, sizeof(s->Title), _UU("SM_LOCALHOST")); - s->ServerAdminMode = true; - Sha0(s->HashedPassword, "", 0); - UniStrCpy(s->ClientOption.AccountName, sizeof(s->ClientOption.AccountName), s->Title); - StrCpy(s->ClientOption.Hostname, sizeof(s->ClientOption.Hostname), "localhost"); - s->ClientOption.Port = GC_DEFAULT_PORT; - - Add(sm->SettingList, s); - } - } -} - -// Main dialog initialization -void SmMainDlgInit(HWND hWnd) -{ - wchar_t *last_select; - UINT i = INFINITE; - // Validate arguments - if (hWnd == NULL) - { - return; - } - - SetIcon(hWnd, 0, ICO_VPNSERVER); - - LvInit(hWnd, L_SETTING); - LvSetStyle(hWnd, L_SETTING, LVS_EX_GRIDLINES); - LvInsertColumn(hWnd, L_SETTING, 0, _UU("SM_MAIN_COLUMN_1"), 145); - LvInsertColumn(hWnd, L_SETTING, 1, _UU("SM_MAIN_COLUMN_2"), 129); - LvInsertColumn(hWnd, L_SETTING, 2, _UU("SM_MAIN_COLUMN_3"), 125); - - SmRefreshSetting(hWnd); - - last_select = MsRegReadStrW(REG_CURRENT_USER, SM_REG_KEY, "Last Select"); - if (UniIsEmptyStr(last_select) == false) - { - i = LvSearchStr(hWnd, L_SETTING, 0, last_select); - } - Free(last_select); - - if (i == INFINITE) - { - LvSelect(hWnd, L_SETTING, 0); - } - else - { - LvSelect(hWnd, L_SETTING, i); - } - - DlgFont(hWnd, IDOK, 10, true); - - if (MsIsWine()) - { - Disable(hWnd, B_SECURE_MANAGER); - Disable(hWnd, B_SELECT_SECURE); - } - - Focus(hWnd, L_SETTING); - - SmMainDlgUpdate(hWnd); -} - -// Update the configuration list -void SmRefreshSetting(HWND hWnd) -{ - SmRefreshSettingEx(hWnd, NULL); -} -void SmRefreshSettingEx(HWND hWnd, wchar_t *select_name) -{ - LVB *b; - UINT i; - // Validate arguments - if (hWnd == NULL) - { - return; - } - - b = LvInsertStart(); - - for (i = 0;i < LIST_NUM(sm->SettingList);i++) - { - wchar_t tmp[MAX_SIZE]; - wchar_t tmp2[MAX_SIZE]; - SETTING *s = LIST_DATA(sm->SettingList, i); - - if (s->ServerAdminMode) - { - UniStrCpy(tmp, sizeof(tmp), _UU("SM_MODE_SERVER")); - } - else - { - UniFormat(tmp, sizeof(tmp), _UU("SM_MODE_HUB"), s->HubName); - } - - StrToUni(tmp2, sizeof(tmp2), s->ClientOption.Hostname); - - LvInsertAdd(b, - (s->ServerAdminMode ? ICO_SERVER_ONLINE : ICO_HUB), - NULL, - 3, - s->Title, - tmp2, - tmp); - } - - LvInsertEnd(b, hWnd, L_SETTING); - - if (UniIsEmptyStr(select_name) == false) - { - LvSelect(hWnd, L_SETTING, INFINITE); - LvSelect(hWnd, L_SETTING, LvSearchStr(hWnd, L_SETTING, 0, select_name)); - } -} - -// Main dialog update -void SmMainDlgUpdate(HWND hWnd) -{ - bool ok = true; - // Validate arguments - if (hWnd == NULL) - { - return; - } - - if (LvIsSelected(hWnd, L_SETTING) == false) - { - ok = false; - } - if (LvIsMultiMasked(hWnd, L_SETTING)) - { - ok = false; - } - - SetEnable(hWnd, IDOK, ok); - SetEnable(hWnd, B_EDIT_SETTING, ok); - SetEnable(hWnd, B_DELETE, ok); -} - -// Main window procedure -UINT SmMainDlgProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param) -{ - NMHDR *n; - NMLVDISPINFOW *info; - NMLVKEYDOWN *key; - wchar_t *tmp; - UINT i; - wchar_t new_name[MAX_SIZE]; - // Validate arguments - if (hWnd == NULL) - { - return 0; - } - - switch (msg) - { - case WM_INITDIALOG: - SmMainDlgInit(hWnd); - SetTimer(hWnd, 4, 100, NULL); - - // Updater start - sm->Update = InitUpdateUi(_UU("PRODUCT_NAME_VPN_SMGR"), NAME_OF_VPN_SERVER_MANAGER, NULL, GetCurrentBuildDate(), - CEDAR_VERSION_BUILD, GetCedarVersionNumber(), NULL, false); - break; - - case WM_TIMER: - switch (wParam) - { - case 4: - KillTimer(hWnd, 4); - break; - } - break; - - case WM_COMMAND: - switch (wParam) - { - case IDOK: - DisableUpdateUi(sm->Update); - - // Connection - i = LvGetSelected(hWnd, L_SETTING); - if (i != INFINITE) - { - tmp = LvGetStr(hWnd, L_SETTING, i, 0); - if (tmp != NULL) - { - SETTING *setting = SmGetSetting(tmp); - if (setting != NULL) - { - SETTING s; - - // Record in the registry as the last choice - MsRegWriteStrW(REG_CURRENT_USER, SM_REG_KEY, "Last Select", tmp); - - // Copy the configuration - Copy(&s, setting, sizeof(SETTING)); - SmConnect(hWnd, &s); - } - Free(tmp); - } - } - break; - - case IDCANCEL: - Close(hWnd); - break; - - case B_NEW_SETTING: - DisableUpdateUi(sm->Update); - - // Add - if (SmAddSettingDlg(hWnd, new_name, sizeof(new_name))) - { - SmRefreshSettingEx(hWnd, new_name); - } - break; - - case B_EDIT_SETTING: - DisableUpdateUi(sm->Update); - - // Edit - if (SmEditSettingDlg(hWnd)) - { - SmWriteSettingList(); - SmRefreshSetting(hWnd); - } - - break; - - case B_DELETE: - DisableUpdateUi(sm->Update); - - // Delete - i = LvGetSelected(hWnd, L_SETTING); - if (i != INFINITE) - { - tmp = LvGetStr(hWnd, L_SETTING, i, 0); - if (tmp != NULL) - { - if (MsgBoxEx(hWnd, MB_ICONQUESTION | MB_YESNO | MB_DEFBUTTON2, - _UU("SM_SETTING_DELETE_MSG"), tmp) == IDYES) - { - SmDeleteSetting(tmp); - SmWriteSettingList(); - SmRefreshSetting(hWnd); - } - Free(tmp); - } - } - break; - - case B_ABOUT: - // Version information - AboutEx(hWnd, sm->Cedar, _UU("PRODUCT_NAME_VPN_SMGR"), sm->Update); - break; - - case B_SECURE_MANAGER: - DisableUpdateUi(sm->Update); - - // Smart Card Manager - SmSecureManager(hWnd); - break; - - case B_SELECT_SECURE: - DisableUpdateUi(sm->Update); - - // Smart card selection - SmSelectSecureId(hWnd); - break; - - case B_CERT_TOOL: - DisableUpdateUi(sm->Update); - - // Certificate Creation Tool - SmCreateCert(hWnd, NULL, NULL, false, NULL, false); - break; - } - - break; - - case WM_CLOSE: - // Updater terminate - if (sm->Update != NULL) - { - FreeUpdateUi(sm->Update); - sm->Update = NULL; - } - - EndDialog(hWnd, 0); - break; - - case WM_NOTIFY: - n = (NMHDR *)lParam; - switch (n->idFrom) - { - case L_SETTING: - switch (n->code) - { - case NM_DBLCLK: - Command(hWnd, IDOK); - break; - - case LVN_KEYDOWN: - key = (NMLVKEYDOWN *)n; - if (key != NULL) - { - UINT code = key->wVKey; - switch (code) - { - case VK_F2: - if (LvIsSelected(hWnd, L_SETTING)) - { - LvRename(hWnd, L_SETTING, LvGetSelected(hWnd, L_SETTING)); - } - break; - - case VK_DELETE: - Command(hWnd, B_DELETE); - break; - - case VK_RETURN: - Command(hWnd, IDOK); - break; - } - } - break; - - case LVN_ENDLABELEDITW: - // Change the name - info = (NMLVDISPINFOW *)n; - if (info->item.pszText != NULL) - { - wchar_t *new_name = info->item.pszText; - wchar_t *old_name = LvGetStr(hWnd, L_SETTING, info->item.iItem, 0); - - if (old_name != NULL) - { - if (UniStrCmp(new_name, old_name) != 0 && UniStrLen(new_name) != 0) - { - // Change the name - SETTING *s = SmGetSetting(old_name); - if (s != NULL) - { - if (SmGetSetting(new_name) != NULL) - { - MsgBoxEx(hWnd, MB_ICONEXCLAMATION, _UU("SM_SETTING_EXISTS"), - new_name); - } - else - { - UniStrCpy(s->Title, sizeof(s->Title), new_name); - Sort(sm->SettingList); - SmWriteSettingList(); - LvSetItem(hWnd, L_SETTING, info->item.iItem, 0, new_name); - } - } - } - - Free(old_name); - } - } - break; - - case LVN_ITEMCHANGED: - SmMainDlgUpdate(hWnd); - break; - } - break; - } - break; - } - - LvSortHander(hWnd, msg, wParam, lParam, L_SETTING); - - return 0; -} - -// Main window -void SmMainDlg() -{ - Dialog(NULL, D_SM_MAIN, SmMainDlgProc, NULL); -} - -// Server Manager main process -void MainSM() -{ -// MsgBoxEx(NULL, 0, L"MsIsWine: %u\n", MsIsWine()); - - if (sm->TempSetting == NULL) - { - // Open the main window - SmMainDlg(); - } - else - { - SmConnect(sm->hParentWnd, sm->TempSetting); - } -} - -// Initialize -void InitSM() -{ - InitSMEx(false); -} -void InitSMEx(bool from_cm) -{ - if (sm != NULL) - { - // Already initialized - return; - } - - sm = ZeroMalloc(sizeof(SM)); - - if (from_cm == false) - { - InitWinUi(_UU("SM_TITLE"), _SS("DEFAULT_FONT"), _II("DEFAULT_FONT_SIZE")); - } - - sm->Cedar = NewCedar(NULL, NULL); - - if (from_cm == false) - { - SmInitSettingList(); - InitCM(false); - - // Interpret the command line - SmParseCommandLine(); - } -} - -// Interpret the command line -void SmParseCommandLine() -{ - LIST *o; - CONSOLE *c = NewLocalConsole(NULL, NULL); - wchar_t *cmdline; - PARAM args[] = - { - {"[vpnserver]", NULL, NULL, NULL, NULL,}, - {"HUB", NULL, NULL, NULL, NULL,}, - {"PASSWORD", NULL, NULL, NULL, NULL,}, - {"TITLE", NULL, NULL, NULL, NULL,}, - {"HWND", NULL, NULL, NULL, NULL,}, - }; - if (c == NULL) - { - return; - } - - cmdline = GetCommandLineUniStr(); - - if (UniIsEmptyStr(cmdline) == false) - { - o = ParseCommandList(c, "vpnsmgr", cmdline, args, sizeof(args) / sizeof(args[0])); - if (o != NULL) - { - char *host; - UINT port; - - if (ParseHostPort(GetParamStr(o, "[vpnserver]"), &host, &port, 443)) - { - char *hub = GetParamStr(o, "HUB"); - char *password = GetParamStr(o, "PASSWORD"); - char *title = GetParamStr(o, "TITLE"); - char *hwndstr = GetParamStr(o, "HWND"); - - if (hub == NULL || StrCmpi(hub, "\"") == 0) - { - hub = CopyStr(""); - } - if (password == NULL) - { - password = CopyStr(""); - } - if (title == NULL) - { - title = CopyStr(host); - } - - if (IsEmptyStr(host) == false) - { - SETTING *s = ZeroMalloc(sizeof(SETTING)); - BUF *b; - CLIENT_OPTION *o; - - StrToUni(s->Title, sizeof(s->Title), title); - - if (IsEmptyStr(hub)) - { - s->ServerAdminMode = true; - } - else - { - s->ServerAdminMode = false; - StrCpy(s->HubName, sizeof(s->HubName), hub); - } - - b = StrToBin(password); - if (b == NULL || b->Size != SHA1_SIZE) - { - Sha0(s->HashedPassword, password, StrLen(password)); - } - else - { - Copy(s->HashedPassword, b->Buf, SHA1_SIZE); - } - FreeBuf(b); - - o = &s->ClientOption; - - UniStrCpy(o->AccountName, sizeof(o->AccountName), s->Title); - StrCpy(o->Hostname, sizeof(o->Hostname), host); - o->Port = port; - o->ProxyType = PROXY_DIRECT; - StrCpy(o->DeviceName, sizeof(o->DeviceName), "DUMMY"); - - sm->TempSetting = s; - - if (IsEmptyStr(hwndstr) == false) - { - sm->hParentWnd = (HWND)ToInt64(hwndstr); - } - } - - Free(hwndstr); - Free(title); - Free(hub); - Free(password); - Free(host); - } - } - } - - Free(cmdline); - - c->Free(c); -} - -// Release -void FreeSM() -{ - FreeSMEx(false); -} -void FreeSMEx(bool from_cm) -{ - if (sm == NULL) - { - // Uninitialized - return; - } - - if (from_cm == false) - { - FreeCM(); - - SmFreeSettingList(); - } - - ReleaseCedar(sm->Cedar); - - if (from_cm == false) - { - FreeWinUi(); - } - - if (sm->TempSetting != NULL) - { - Free(sm->TempSetting); - } - - Free(sm); - sm = NULL; -} - -// Running the Server Manager -void SMExec() -{ - InitSM(); - MainSM(); - FreeSM(); -} - -#endif // WIN32 - - +// SoftEther VPN Source Code - Developer Edition Master Branch +// Cedar Communication Module + + +// SM.c +// VPN Server Manager for Win32 + +#include + +#ifdef WIN32 + +#define SM_C +#define CM_C +#define NM_C + +#define _WIN32_WINNT 0x0502 +#define WINVER 0x0502 +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "CMInner.h" +#include "SMInner.h" +#include "NMInner.h" +#include "EMInner.h" +#include "../PenCore/resource.h" + +// Global variable +static SM *sm = NULL; +static bool link_create_now = false; + + +// Proxy Settings dialog initialization +void SmProxyDlgInit(HWND hWnd, INTERNET_SETTING *t) +{ + // Validate arguments + if (hWnd == NULL || t == NULL) + { + return; + } + + Check(hWnd, R_DIRECT_TCP, t->ProxyType == PROXY_DIRECT); + Check(hWnd, R_HTTPS, t->ProxyType == PROXY_HTTP); + Check(hWnd, R_SOCKS, t->ProxyType == PROXY_SOCKS); + Check(hWnd, R_SOCKS5, t->ProxyType == PROXY_SOCKS5); + + SmProxyDlgUpdate(hWnd, t); +} + +// Proxy Settings dialog update +void SmProxyDlgUpdate(HWND hWnd, INTERNET_SETTING *t) +{ + bool ok = false; + // Validate arguments + if (hWnd == NULL || t == NULL) + { + return; + } + + if (t->ProxyType == PROXY_DIRECT) + { + ok = true; + } + else + { + if (IsEmptyStr(t->ProxyHostName) == false && + t->ProxyPort != 0) + { + ok = true; + } + } + + SetEnable(hWnd, IDOK, ok); + + SetEnable(hWnd, B_PROXY_CONFIG, !IsChecked(hWnd, R_DIRECT_TCP)); +} + +// Proxy settings generic dialog procedure +UINT SmProxyDlg(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param) +{ + INTERNET_SETTING *t = (INTERNET_SETTING *)param; + CLIENT_OPTION a; + + switch (msg) + { + case WM_INITDIALOG: + SmProxyDlgInit(hWnd, t); + break; + + case WM_COMMAND: + switch (wParam) + { + case IDOK: + EndDialog(hWnd, 1); + break; + + case IDCANCEL: + Close(hWnd); + break; + + case R_DIRECT_TCP: + case R_HTTPS: + case R_SOCKS: + case R_SOCKS5: + if (IsChecked(hWnd, R_HTTPS)) + { + t->ProxyType = PROXY_HTTP; + } + else if (IsChecked(hWnd, R_SOCKS)) + { + t->ProxyType = PROXY_SOCKS; + } + else if (IsChecked(hWnd, R_SOCKS5)) + { + t->ProxyType = PROXY_SOCKS5; + } + else + { + t->ProxyType = PROXY_DIRECT; + } + + SmProxyDlgUpdate(hWnd, t); + break; + + case B_PROXY_CONFIG: + Zero(&a, sizeof(a)); + + a.ProxyType = t->ProxyType; + StrCpy(a.ProxyName, sizeof(a.ProxyName), t->ProxyHostName); + a.ProxyPort = t->ProxyPort; + StrCpy(a.ProxyUsername, sizeof(a.ProxyUsername), t->ProxyUsername); + StrCpy(a.ProxyPassword, sizeof(a.ProxyPassword), t->ProxyPassword); + StrCpy(a.CustomHttpHeader, sizeof(a.CustomHttpHeader), t->CustomHttpHeader); + + if (CmProxyDlg(hWnd, &a)) + { + t->ProxyType = a.ProxyType; + StrCpy(t->ProxyHostName, sizeof(t->ProxyHostName), a.ProxyName); + t->ProxyPort = a.ProxyPort; + StrCpy(t->ProxyUsername, sizeof(t->ProxyUsername), a.ProxyUsername); + StrCpy(t->ProxyPassword, sizeof(t->ProxyPassword), a.ProxyPassword); + StrCpy(t->CustomHttpHeader, sizeof(t->CustomHttpHeader), a.CustomHttpHeader); + } + + SmProxyDlgUpdate(hWnd, t); + + break; + } + break; + + case WM_CLOSE: + EndDialog(hWnd, 0); + break; + } + + return 0; +} + +// Proxy Settings generic dialog +bool SmProxy(HWND hWnd, INTERNET_SETTING *t) +{ + // Validate arguments + if (t == NULL) + { + return false; + } + + return Dialog(hWnd, D_SM_PROXY, SmProxyDlg, t); +} + +// VPN Azure dialog procedure +UINT SmAzureDlg(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param) +{ + SM_AZURE *a = (SM_AZURE *)param; + + switch (msg) + { + case WM_INITDIALOG: + SmAzureDlgOnInit(hWnd, a); + + SetTimer(hWnd, 1, 1000, NULL); + break; + + case WM_COMMAND: + switch (wParam) + { + case B_CHANGE: + if (SmDDns(hWnd, a->s, false, true)) + { + SmAzureDlgRefresh(hWnd, a); + } + break; + + case B_WEB: + MsExecute(_SS("SE_VPNAZURE_URL"), NULL); + break; + + case R_ENABLE: + case R_DISABLE: + if (IsChecked(hWnd, R_ENABLE) || IsChecked(hWnd, R_DISABLE)) + { + Enable(hWnd, IDCANCEL); + EnableClose(hWnd); + } + + SmAzureSetStatus(hWnd, a); + break; + + case IDOK: + case IDCANCEL: + Close(hWnd); + break; + } + break; + + case WM_TIMER: + switch (wParam) + { + case 1: + if (IsEnable(hWnd, 0)) + { + KillTimer(hWnd, 1); + + SmAzureDlgRefresh(hWnd, a); + + SetTimer(hWnd, 1, 1000, NULL); + } + break; + } + break; + + case WM_CLOSE: + EndDialog(hWnd, 0); + break; + } + + return 0; +} + +// Set the status +void SmAzureSetStatus(HWND hWnd, SM_AZURE *a) +{ + RPC_AZURE_STATUS st; + // Validate arguments + if (hWnd == NULL || a == NULL) + { + return; + } + + Zero(&st, sizeof(st)); + + st.IsEnabled = IsChecked(hWnd, R_ENABLE); + + if (CALL(hWnd, ScSetAzureStatus(a->s->Rpc, &st)) == false) + { + EndDialog(hWnd, 0); + return; + } + + SmAzureDlgRefresh(hWnd, a); +} + +// Initialize the dialog +void SmAzureDlgOnInit(HWND hWnd, SM_AZURE *a) +{ + RPC_AZURE_STATUS st; + UINT current_lang_id; + // Validate arguments + if (hWnd == NULL || a == NULL) + { + return; + } + + SetIcon(hWnd, 0, ICO_AZURE); + + DlgFont(hWnd, S_TITLE, 14, true); + DlgFont(hWnd, R_ENABLE, 0, true); + + SetFont(hWnd, E_HOST, GetFont("Verdana", 10, false, false, false, false)); + + current_lang_id = GetCurrentLangId(); + + // Japanese + SetShow(hWnd, S_BMP_JA, current_lang_id == SE_LANG_JAPANESE); + + // Chinese + SetShow(hWnd, S_BMP_CN, current_lang_id == SE_LANG_CHINESE_ZH); + + // Other languages + SetShow(hWnd, S_BMP_EN, (current_lang_id != SE_LANG_JAPANESE) && (current_lang_id != SE_LANG_CHINESE_ZH)); + + // Apply the current settings + Zero(&st, sizeof(st)); + + if (CALL(hWnd, ScGetAzureStatus(a->s->Rpc, &st)) == false) + { + EndDialog(hWnd, 0); + return; + } + + if (a->OnSetup == false || st.IsEnabled) + { + Check(hWnd, R_ENABLE, st.IsEnabled); + Check(hWnd, R_DISABLE, !st.IsEnabled); + } + else + { + Disable(hWnd, IDCANCEL); + DisableClose(hWnd); + } + + SmAzureDlgRefresh(hWnd, a); +} + +// Update the dialog +void SmAzureDlgRefresh(HWND hWnd, SM_AZURE *a) +{ + RPC_AZURE_STATUS st; + DDNS_CLIENT_STATUS ddns; + char tmp[MAX_SIZE]; + // Validate arguments + if (hWnd == NULL || a == NULL) + { + return; + } + + Zero(&st, sizeof(st)); + Zero(&ddns, sizeof(ddns)); + + if (CALL(hWnd, ScGetAzureStatus(a->s->Rpc, &st)) == false) + { + EndDialog(hWnd, 0); + return; + } + + if (CALL(hWnd, ScGetDDnsClientStatus(a->s->Rpc, &ddns)) == false) + { + EndDialog(hWnd, 0); + return; + } + + if (st.IsEnabled == false) + { + SetText(hWnd, S_STATUS, _UU("SM_AZURE_STATUS_NOT_CONNECTED")); + Disable(hWnd, S_STATUS); + } + else + { + SetText(hWnd, S_STATUS, (st.IsConnected ? _UU("SM_AZURE_STATUS_CONNECTED") : _UU("SM_AZURE_STATUS_NOT_CONNECTED"))); + Enable(hWnd, S_STATUS); + } + + SetShow(hWnd, S_HOSTNAME_BORDER, st.IsEnabled); + SetShow(hWnd, S_HOSTNAME_INFO, st.IsEnabled); + SetShow(hWnd, B_CHANGE, st.IsEnabled); + + if (st.IsEnabled == false || IsEmptyStr(ddns.CurrentHostName)) + { + Hide(hWnd, E_HOST); + } + else + { + StrCpy(tmp, sizeof(tmp), ddns.CurrentHostName); + StrCat(tmp, sizeof(tmp), AZURE_DOMAIN_SUFFIX); + + SetTextA(hWnd, E_HOST, tmp); + + Show(hWnd, E_HOST); + } +} + +// VPN Azure Setup screen +void SmAzure(HWND hWnd, SM_SERVER *s, bool on_setup) +{ + SM_AZURE a; + // Validate arguments + if (s == NULL) + { + return; + } + + Zero(&a, sizeof(a)); + + a.s = s; + a.OnSetup = on_setup; + + Dialog(hWnd, D_SM_AZURE, SmAzureDlg, &a); +} + +// Notification screen about the bridge in VM +UINT SmVmBridgeDlg(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param) +{ + switch (msg) + { + case WM_INITDIALOG: + DlgFont(hWnd, S_TITLE, 14, true); + SetIcon(hWnd, 0, ICO_NIC_ONLINE); + break; + + case WM_COMMAND: + switch (wParam) + { + case IDOK: + case IDCANCEL: + Close(hWnd); + break; + } + break; + + case WM_CLOSE: + EndDialog(hWnd, 0); + break; + } + + return 0; +} + +// Setting screen of VPN over ICMP, etc. +void SmSpecialListener(HWND hWnd, SM_SERVER *s) +{ + // Validate arguments + if (s == NULL) + { + return; + } + + Dialog(hWnd, D_SM_SPECIALLISTENER, SmSpecialListenerDlg, s); +} +UINT SmSpecialListenerDlg(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param) +{ + SM_SERVER *s = (SM_SERVER *)param; + + switch (msg) + { + case WM_INITDIALOG: + SmSpecialListenerDlgInit(hWnd, s); + break; + + case WM_COMMAND: + switch (wParam) + { + case IDOK: + SmSpecialListenerDlgOnOk(hWnd, s); + break; + + case IDCANCEL: + Close(hWnd); + break; + } + break; + + case WM_CLOSE: + EndDialog(hWnd, 0); + break; + } + + return 0; +} +void SmSpecialListenerDlgInit(HWND hWnd, SM_SERVER *s) +{ + RPC_SPECIAL_LISTENER t; + // Validate arguments + if (hWnd == NULL || s == NULL) + { + return; + } + + SetIcon(hWnd, 0, ICO_SPECIALLISTENER); + + DlgFont(hWnd, S_TITLE, 14, true); + DlgFont(hWnd, S_1, 0, true); + DlgFont(hWnd, R_OVER_ICMP, 0, true); + DlgFont(hWnd, R_OVER_DNS, 0, true); + + Zero(&t, sizeof(t)); + + if (CALL(hWnd, ScGetSpecialListener(s->Rpc, &t)) == false) + { + Close(hWnd); + return; + } + + Check(hWnd, R_OVER_ICMP, t.VpnOverIcmpListener); + Check(hWnd, R_OVER_DNS, t.VpnOverDnsListener); +} +void SmSpecialListenerDlgOnOk(HWND hWnd, SM_SERVER *s) +{ + RPC_SPECIAL_LISTENER t; + // Validate arguments + if (hWnd == NULL || s == NULL) + { + return; + } + + Zero(&t, sizeof(t)); + + t.VpnOverIcmpListener = IsChecked(hWnd, R_OVER_ICMP); + t.VpnOverDnsListener = IsChecked(hWnd, R_OVER_DNS); + + if (CALL(hWnd, ScSetSpecialListener(s->Rpc, &t)) == false) + { + return; + } + + EndDialog(hWnd, 1); +} + + +// DDNS dialog +bool SmDDns(HWND hWnd, SM_SERVER *s, bool silent, bool no_change_cert) +{ + SM_DDNS d; + // Validate arguments + if (s == NULL) + { + return false; + } + + Zero(&d, sizeof(d)); + d.s = s; + d.Silent = silent; + d.NoChangeCert = no_change_cert; + + Dialog(hWnd, D_SM_DDNS, SmDDnsDlg, &d); + + return d.Changed; +} +UINT SmDDnsDlg(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param) +{ + SM_DDNS *d = (SM_DDNS *)param; + // Validate arguments + if (hWnd == NULL) + { + return 0; + } + + switch (msg) + { + case WM_INITDIALOG: + SmDDnsDlgInit(hWnd, d); + + SetTimer(hWnd, 1, 1000, NULL); + break; + + case WM_COMMAND: + switch (LOWORD(wParam)) + { + case E_NEWHOST: + SmDDnsDlgUpdate(hWnd, d); + break; + } + + switch (wParam) + { + case IDOK: + SmDDnsDlgOnOk(hWnd, d); + break; + + case B_RESTORE: + // Restore to original + if (d->Status.Err_IPv4 == ERR_NO_ERROR || d->Status.Err_IPv6 == ERR_NO_ERROR) + { + SetTextA(hWnd, E_NEWHOST, d->Status.CurrentHostName); + SmDDnsDlgUpdate(hWnd, d); + FocusEx(hWnd, E_NEWHOST); + } + break; + + case IDCANCEL: + Close(hWnd); + break; + + case B_DISABLE: + d->DoNotPoll = true; + + OnceMsg(hWnd, _UU("SM_DISABLE_DDNS_HINT_CAPTION"), _UU("SM_DISABLE_DDNS_HINT"), false, ICO_INFORMATION); + + d->DoNotPoll = false; + break; + + case B_HINT: + // Hint + if (d->Status.Err_IPv4 == ERR_NO_ERROR || d->Status.Err_IPv6 == ERR_NO_ERROR) + { + wchar_t tmp[MAX_SIZE * 4]; + wchar_t ipv4[MAX_SIZE], ipv6[MAX_SIZE]; + + StrToUni(ipv4, sizeof(ipv4), d->Status.CurrentIPv4); + StrToUni(ipv6, sizeof(ipv6), d->Status.CurrentIPv6); + + if (UniIsEmptyStr(ipv4)) + { + UniStrCpy(ipv4, sizeof(ipv4), _UU("SM_DDNS_FQDN_EMPTY")); + } + + if (UniIsEmptyStr(ipv6)) + { + UniStrCpy(ipv6, sizeof(ipv6), _UU("SM_DDNS_FQDN_EMPTY")); + } + + UniFormat(tmp, sizeof(tmp), + _UU("SM_DDNS_OK_MSG"), + d->Status.CurrentHostName, d->Status.DnsSuffix, + ipv4, ipv6, + d->Status.CurrentHostName, d->Status.DnsSuffix, + d->Status.CurrentHostName, d->Status.DnsSuffix); + + d->DoNotPoll = true; + + OnceMsg(hWnd, _UU("SM_DDNS_OK_TITLE"), tmp, false, ICO_DISPLAY); + + d->DoNotPoll = false; + } + break; + + case B_HINT2: + // Hint2 (for DDNS key) + { + wchar_t tmp[MAX_SIZE * 4]; + wchar_t *keystr; + + keystr = GetText(hWnd, E_KEY); + UniFormat(tmp, sizeof(tmp), _UU("SM_DDNS_KEY_MSG"), keystr); + Free(keystr); + OnceMsg(hWnd, _UU("SM_DDNS_KEY_TITLE"), tmp, false, ICO_DISPLAY); + } + break; + + case B_PROXY: + // Proxy settings + if (true) + { + INTERNET_SETTING t; + + if (CALL(hWnd, ScGetDDnsInternetSetting(d->s->Rpc, &t))) + { + if (SmProxy(hWnd, &t)) + { + if (CALL(hWnd, ScSetDDnsInternetSetting(d->s->Rpc, &t))) + { + SmDDnsRefresh(hWnd, d); + } + } + } + } + break; + } + break; + + case WM_TIMER: + switch (wParam) + { + case 1: + if (IsEnable(hWnd, 0)) + { + KillTimer(hWnd, 1); + + SmDDnsRefresh(hWnd, d); + + SetTimer(hWnd, 1, 1000, NULL); + } + break; + } + break; + + case WM_CLOSE: + if (d->Changed || d->Silent) + { + // Check the server certificate if the host name has been changed + RPC_KEY_PAIR t; + char fqdn[MAX_SIZE]; + bool is_vgs_enabled = false; + + + StrCpy(fqdn, sizeof(fqdn), d->Status.CurrentFqdn); + + if (IsEmptyStr(fqdn) == false) + { + Zero(&t, sizeof(t)); + if (ScGetServerCert(d->s->Rpc, &t) == ERR_NO_ERROR) + { + if (t.Cert != NULL && t.Cert->root_cert && t.Cert->subject_name != NULL && is_vgs_enabled == false) + { + char cn[MAX_SIZE]; + + UniToStr(cn, sizeof(cn), t.Cert->subject_name->CommonName); + + if ((StrCmpi(cn, fqdn) != 0) && (d->NoChangeCert == false)) + { + // Confirm whether the user want to replace the server certificate + if (d->Silent || (MsgBoxEx(hWnd, MB_ICONQUESTION | MB_YESNO, + _UU("SM_DDNS_SERVER_CERT_MSG"), + fqdn, fqdn) == IDYES)) + { + // Re-generate the server certificate + RPC_TEST tt; + + Zero(&tt, sizeof(tt)); + + StrCpy(tt.StrValue, sizeof(tt.StrValue), fqdn); + + SetText(hWnd, IDCANCEL, _UU("CM_VLAN_INSTALLING")); + Refresh(DlgItem(hWnd, IDCANCEL)); + Refresh(hWnd); + DoEvents(NULL); + + if (CALL(hWnd, ScRegenerateServerCert(d->s->Rpc, &tt))) + { + // Confirm whether the user want to save the server certificate + if ((d->Silent == false) && ( + MsgBoxEx(hWnd, MB_ICONINFORMATION | MB_YESNO, + _UU("SM_DDNS_SERVER_CERT_OK"), + fqdn) == IDYES)) + { + // Get the server certificate + RPC_KEY_PAIR t2; + + Zero(&t2, sizeof(t2)); + if (CALL(hWnd, ScGetServerCert(d->s->Rpc, &t2))) + { + wchar_t *name; + wchar_t defname[MAX_PATH]; + + StrToUni(defname, sizeof(defname), fqdn); + UniStrCat(defname, sizeof(defname), L".cer"); + + name = SaveDlg(hWnd, _UU("DLG_CERT_FILES"), _UU("DLG_SAVE_CERT"), defname, L".cer"); + + if (name != NULL) + { + if (XToFileW(t2.Cert, name, true)) + { + MsgBox(hWnd, MB_ICONINFORMATION, _UU("DLG_CERT_SAVE_OK")); + } + else + { + MsgBox(hWnd, MB_ICONSTOP, _UU("DLG_CERT_SAVE_ERROR")); + } + + Free(name); + } + + FreeRpcKeyPair(&t2); + } + } + } + } + } + } + + FreeRpcKeyPair(&t); + } + } + } + + EndDialog(hWnd, 0); + break; + } + + return 0; +} + +// Get the ddns key from the server configuration file +static UINT SmDdnsGetKey(char *key, SM_DDNS *d){ + RPC_CONFIG config; + UINT err; + BUF *buf; + FOLDER *root, *ddnsfolder; + RPC *rpc; + + // Validate arguments + if(d == NULL || d->s == NULL || key == NULL){ + return ERR_INTERNAL_ERROR; + } + + rpc = d->s->Rpc; + + Zero(&config, sizeof(config)); + err = ScGetConfig(d->s->Rpc, &config); + if(err != ERR_NO_ERROR){ + return err; + } + + buf = NewBufFromMemory(config.FileData, StrLen(config.FileData)); + FreeRpcConfig(&config); + + root = CfgBufTextToFolder(buf); + FreeBuf(buf); + + ddnsfolder = CfgGetFolder(root, "DDnsClient"); + err = CfgGetByte(ddnsfolder, "Key", key, 20); + + CfgDeleteFolder(root); + + return (err == 20) ? ERR_NO_ERROR : ERR_INTERNAL_ERROR; +} + +void SmDDnsDlgInit(HWND hWnd, SM_DDNS *d) +{ + char key[20]; + char encodedkey[20 * 4 + 32]; + + // Validate arguments + if (hWnd == NULL || d == NULL) + { + return; + } + + d->DoNotPoll = false; + + SetIcon(hWnd, 0, ICO_DISPLAY); + + DlgFont(hWnd, S_TITLE, 14, true); + + DlgFont(hWnd, S_BOLD, 0, true); + DlgFont(hWnd, S_STATUS3, 0, true); + DlgFont(hWnd, S_STATUS4, 0, true); + DlgFont(hWnd, S_STATUS5, 0, true); + DlgFont(hWnd, S_STATUS6, 0, true); + DlgFont(hWnd, S_STATUS8, 0, true); + + SetFont(hWnd, S_SUFFIX, GetFont("Verdana", 10, false, false, false, false)); + SetFont(hWnd, E_NEWHOST, GetFont("Verdana", 10, false, false, false, false)); + + SetFont(hWnd, E_HOST, GetFont((MsIsWinXPOrGreater() ? "Verdana" : NULL), 10, false, false, false, false)); + SetFont(hWnd, E_IPV4, GetFont((MsIsWinXPOrGreater() ? "Verdana" : NULL), 10, false, false, false, false)); + SetFont(hWnd, E_IPV6, GetFont((MsIsWinXPOrGreater() ? "Verdana" : NULL), 10, false, false, false, false)); + SetFont(hWnd, E_KEY, GetFont((MsIsWinXPOrGreater() ? "Verdana" : NULL), 8, false, false, false, false)); + + DlgFont(hWnd, IDOK, 0, true); + + if (d->Silent) + { + Hide(hWnd, B_DISABLE); + } + + Hide(hWnd, B_PROXY); + + if(SmDdnsGetKey(key, d) == ERR_NO_ERROR){ + encodedkey[ B64_Encode(encodedkey, key, 20) ] = 0; + SetTextA(hWnd, E_KEY, encodedkey); + }else{ + SetText(hWnd, E_KEY, _UU("SM_DDNS_KEY_ERR")); + } + + SmDDnsRefresh(hWnd, d); +} + +void SmDDnsRefresh(HWND hWnd, SM_DDNS *d) +{ + DDNS_CLIENT_STATUS st; + INTERNET_SETTING t; + + // Validate arguments + if (hWnd == NULL || d == NULL) + { + return; + } + + if (d->DoNotPoll) + { + return; + } + + Zero(&st, sizeof(st)); + Zero(&t, sizeof(t)); + + // Get the status + if (CALL(hWnd, ScGetDDnsClientStatus(d->s->Rpc, &st)) == false) + { + Close(hWnd); + return; + } + + ScGetDDnsInternetSetting(d->s->Rpc, &t); + + Copy(&d->Status, &st, sizeof(st)); + + if (IsEmptyStr(st.CurrentFqdn) == false) + { + SetTextA(hWnd, E_HOST, st.CurrentFqdn); + } + else + { + SetText(hWnd, E_HOST, _UU("SM_DDNS_FQDN_EMPTY")); + } + + if (st.Err_IPv4 == ERR_NO_ERROR) + { + SetTextA(hWnd, E_IPV4, st.CurrentIPv4); + } + else + { + if (st.Err_IPv4 == ERR_CONNECT_FAILED) + { + SetText(hWnd, E_IPV4, _UU("SM_DDNS_IPV4_ERROR")); + } + else + { + SetText(hWnd, E_IPV4, _E(st.Err_IPv4)); + } + } + + if (st.Err_IPv6 == ERR_NO_ERROR) + { + SetTextA(hWnd, E_IPV6, st.CurrentIPv6); + } + else + { + if (st.Err_IPv6 == ERR_CONNECT_FAILED) + { + SetText(hWnd, E_IPV6, _UU("SM_DDNS_IPV6_ERROR")); + } + else + { + SetText(hWnd, E_IPV6, _E(st.Err_IPv6)); + } + } + + if (st.Err_IPv4 == ERR_NO_ERROR || st.Err_IPv6 == ERR_NO_ERROR) + { + if (IsEmptyStr(st.DnsSuffix) == false) + { + SetTextA(hWnd, S_SUFFIX, st.DnsSuffix); + } + + Enable(hWnd, S_STATUS6); + Enable(hWnd, E_NEWHOST); + Enable(hWnd, S_SUFFIX); + Enable(hWnd, S_STATUS7); + Enable(hWnd, B_HINT); + } + else + { + SetTextA(hWnd, S_SUFFIX, ""); + + Disable(hWnd, S_STATUS6); + Disable(hWnd, E_NEWHOST); + Disable(hWnd, S_SUFFIX); + Disable(hWnd, S_STATUS7); + Disable(hWnd, B_HINT); + } + + if (GetCapsBool(d->s->CapsList, "b_support_ddns_proxy")) + { + // Show the proxy button + Show(hWnd, B_PROXY); + } + else + { + // Hide the proxy button + Hide(hWnd, B_PROXY); + } + + SmDDnsDlgUpdate(hWnd, d); + + if (d->Flag == false) + { + d->Flag = true; + } + + if (IsEmptyStr(st.CurrentHostName) == false) + { + if (d->HostnameSetFlag == false) + { + d->HostnameSetFlag = true; + + SetTextA(hWnd, E_NEWHOST, st.CurrentHostName); + + FocusEx(hWnd, E_NEWHOST); + } + } +} +void SmDDnsDlgUpdate(HWND hWnd, SM_DDNS *d) +{ + char tmp[MAX_SIZE]; + bool b = false; + + // Validate arguments + if (hWnd == NULL || d == NULL) + { + return; + } + + if (GetTxtA(hWnd, E_NEWHOST, tmp, sizeof(tmp))) + { + Trim(tmp); + + // Get whether the host name have changed + if (IsEmptyStr(tmp) == false) + { + if (StrCmpi(d->Status.CurrentHostName, tmp) != 0) + { + if (d->Status.Err_IPv4 == ERR_NO_ERROR || d->Status.Err_IPv6 == ERR_NO_ERROR) + { + b = true; + } + } + } + } + + SetEnable(hWnd, IDOK, b); + SetEnable(hWnd, B_RESTORE, b); +} +void SmDDnsDlgOnOk(HWND hWnd, SM_DDNS *d) +{ + RPC_TEST t; + // Validate arguments + if (hWnd == NULL || d == NULL) + { + return; + } + + Zero(&t, sizeof(t)); + GetTxtA(hWnd, E_NEWHOST, t.StrValue, sizeof(t.StrValue)); + + if (CALL(hWnd, ScChangeDDnsClientHostname(d->s->Rpc, &t)) == false) + { + return; + } + + d->Changed = true; + + SmDDnsRefresh(hWnd, d); + FocusEx(hWnd, E_NEWHOST); + + MsgBoxEx(hWnd, MB_ICONINFORMATION, _UU("SM_DDNS_OK_MSG2"), t.StrValue); + FocusEx(hWnd, E_NEWHOST); +} + +// Open the OpenVPN dialog +void SmOpenVpn(HWND hWnd, SM_SERVER *s) +{ + // Validate arguments + if (s == NULL) + { + return; + } + + Dialog(hWnd, D_SM_OPENVPN, SmOpenVpnDlg, s); +} + +// OpenVPN dialog +UINT SmOpenVpnDlg(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param) +{ + SM_SERVER *s = (SM_SERVER *)param; + char tmp[MAX_SIZE]; + // Validate arguments + if (hWnd == NULL) + { + return 0; + } + + switch (msg) + { + case WM_INITDIALOG: + SmOpenVpnDlgInit(hWnd, s); + break; + + case WM_COMMAND: + switch (LOWORD(wParam)) + { + case R_OPENVPN: + case R_SSTP: + SmOpenVpnDlgUpdate(hWnd, s); + break; + } + + switch (wParam) + { + case IDOK: + SmOpenVpnDlgOnOk(hWnd, s, false); + break; + + case B_CONFIG: + // Create an OpenVPN configuration + { + OPENVPN_SSTP_CONFIG t2; + RPC_READ_LOG_FILE t; + + Zero(&t2, sizeof(t2)); + + if (CALL(hWnd, ScGetOpenVpnSstpConfig(s->Rpc, &t2))) + { + if (t2.EnableOpenVPN == false) + { + // Enable the OpenVPN first + SmOpenVpnDlgOnOk(hWnd, s, true); + + Disable(hWnd, IDCANCEL); + } + } + else + { + break; + } + + Zero(&t, sizeof(t)); + + if (CALL(hWnd, ScMakeOpenVpnConfigFile(s->Rpc, &t))) + { + // Generate a file name + wchar_t filename[MAX_SIZE]; + char safe_hostname[MAX_SIZE]; + SYSTEMTIME st; + wchar_t *dst; + + MakeSafeFileName(safe_hostname, sizeof(safe_hostname), s->ServerName); + + LocalTime(&st); + + UniFormat(filename, sizeof(filename), + L"OpenVPN_Sample_Config_%S_%04u%02u%02u_%02u%02u%02u.zip", + safe_hostname, + st.wYear, st.wMonth, st.wDay, + st.wHour, st.wMinute, st.wSecond); + + dst = SaveDlg(hWnd, _UU("DLG_ZIP_FILER"), _UU("DLG_SAVE_OPENVPN_CONFIG"), + filename, L".zip"); + + if (dst != NULL) + { + // Save + if (DumpBufW(t.Buffer, dst) == false) + { + // Failure + MsgBoxEx(hWnd, MB_ICONSTOP, _UU("SM_OPENVPN_CONFIG_SAVE_NG"), dst); + } + else + { + // Success + if (MsgBoxEx(hWnd, MB_ICONQUESTION | MB_YESNO, _UU("SM_OPENVPN_CONFIG_SAVE_OK"), dst) == IDYES) + { + if (MsExecuteW(dst, L"") == false) + { + MsgBoxEx(hWnd, MB_ICONINFORMATION, _UU("SM_OPENVPN_CONFIG_OPEN_NG"), dst); + } + } + } + + Free(dst); + } + + FreeRpcReadLogFile(&t); + } + } + break; + + case B_IPSEC: + SmIPsec(hWnd, s); + break; + + case IDCANCEL: + Close(hWnd); + break; + } + break; + + case WM_CLOSE: + EndDialog(hWnd, 0); + break; + } + + return 0; +} +void SmOpenVpnDlgInit(HWND hWnd, SM_SERVER *s) +{ + OPENVPN_SSTP_CONFIG t; + // Validate arguments + if (hWnd == NULL || s == NULL) + { + return; + } + + Zero(&t, sizeof(t)); + if (CALL(hWnd, ScGetOpenVpnSstpConfig(s->Rpc, &t)) == false) + { + Close(hWnd); + return; + } + + Check(hWnd, R_OPENVPN, t.EnableOpenVPN); + Check(hWnd, R_SSTP, t.EnableSSTP); + + SetIcon(hWnd, 0, ICO_OPENVPN); + + DlgFont(hWnd, S_TITLE, 14, true); + + DlgFont(hWnd, R_OPENVPN, 0, true); + DlgFont(hWnd, S_TOOL, 11, true); + DlgFont(hWnd, R_SSTP, 0, true); + + SmOpenVpnDlgUpdate(hWnd, s); +} +void SmOpenVpnDlgUpdate(HWND hWnd, SM_SERVER *s) +{ + bool b1, b2; + // Validate arguments + if (hWnd == NULL || s == NULL) + { + return; + } + + b1 = IsChecked(hWnd, R_OPENVPN); + b2 = IsChecked(hWnd, R_SSTP); + + SetEnable(hWnd, S_TOOL, b1); + SetEnable(hWnd, S_TOOL2, b1); + SetEnable(hWnd, B_CONFIG, b1); + + SetEnable(hWnd, S_SSTP, b2); +} +void SmOpenVpnDlgOnOk(HWND hWnd, SM_SERVER *s, bool no_close) +{ + OPENVPN_SSTP_CONFIG t; + // Validate arguments + if (hWnd == NULL || s == NULL) + { + return; + } + + Zero(&t, sizeof(t)); + + t.EnableOpenVPN = IsChecked(hWnd, R_OPENVPN); + t.EnableSSTP = IsChecked(hWnd, R_SSTP); + + if (CALL(hWnd, ScSetOpenVpnSstpConfig(s->Rpc, &t)) == false) + { + return; + } + + if (no_close == false) + { + EndDialog(hWnd, 1); + } +} + +// Open the EtherIP ID edit dialog +bool SmEtherIpId(HWND hWnd, SM_ETHERIP_ID *t) +{ + // Validate arguments + if (t == NULL) + { + return false; + } + + if (Dialog(hWnd, D_SM_ETHERIP_ID, SmEtherIpIdDlg, t) == 0) + { + return false; + } + + return true; +} + +// EtherIP ID edit dialog procedure +UINT SmEtherIpIdDlg(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param) +{ + SM_ETHERIP_ID *t = (SM_ETHERIP_ID *)param; + // Validate arguments + if (hWnd == NULL) + { + return 0; + } + + switch (msg) + { + case WM_INITDIALOG: + SmEtherIpIdDlgInit(hWnd, t); + break; + + case WM_COMMAND: + switch (LOWORD(wParam)) + { + case E_ID: + case L_HUBNAME: + case E_USERNAME: + SmEtherIpIdDlgUpdate(hWnd, t); + break; + } + + switch (wParam) + { + case IDOK: + SmEtherIpIdDlgOnOk(hWnd, t); + break; + + case IDCANCEL: + Close(hWnd); + break; + } + break; + + case WM_CLOSE: + EndDialog(hWnd, 0); + break; + } + + return 0; +} + +// Initialize the EtherIP ID edit dialog +void SmEtherIpIdDlgInit(HWND hWnd, SM_ETHERIP_ID *t) +{ + RPC_ENUM_HUB tt; + UINT sel_index; + UINT i; + // Validate arguments + if (hWnd == NULL || t == NULL) + { + return; + } + + SetIcon(hWnd, 0, ICO_KEY); + + // Get the current data in the case of edit mode + if (t->EditMode) + { + Zero(&t->Data, sizeof(t->Data)); + StrCpy(t->Data.Id, sizeof(t->Data.Id), t->EditId); + + if (CALL(hWnd, ScGetEtherIpId(t->s->Rpc, &t->Data)) == false) + { + EndDialog(hWnd, 0); + return; + } + } + + // Enumerate the Virtual HUBs + Zero(&tt, sizeof(tt)); + if (CALL(hWnd, ScEnumHub(t->s->Rpc, &tt)) == false) + { + EndDialog(hWnd, 0); + return; + } + + CbReset(hWnd, L_HUBNAME); + CbSetHeight(hWnd, L_HUBNAME, 18); + sel_index = INFINITE; + + for (i = 0;i < tt.NumHub;i++) + { + RPC_ENUM_HUB_ITEM *e = &tt.Hubs[i]; + UINT index; + + index = CbAddStrA(hWnd, L_HUBNAME, e->HubName, 0); + if (sel_index == INFINITE) + { + sel_index = index; + } + + if (t->EditMode) + { + if (StrCmpi(e->HubName, t->Data.HubName) == 0) + { + sel_index = index; + } + } + } + + if (sel_index != INFINITE) + { + CbSelectIndex(hWnd, L_HUBNAME, sel_index); + } + + if (t->EditMode) + { + SetTextA(hWnd, E_ID, t->Data.Id); + SetTextA(hWnd, E_USERNAME, t->Data.UserName); + SetTextA(hWnd, E_PASSWORD, t->Data.Password); + + FocusEx(hWnd, E_PASSWORD); + } + else + { + Focus(hWnd, E_ID); + } + + FreeRpcEnumHub(&tt); + + t->InitCompleted = true; + SmEtherIpIdDlgUpdate(hWnd, t); +} + +// EtherIP ID edit dialog: Click the OK button +void SmEtherIpIdDlgOnOk(HWND hWnd, SM_ETHERIP_ID *t) +{ + // Validate arguments + if (hWnd == NULL || t == NULL) + { + return; + } + + SmEtherIpIdDlgGetSetting(hWnd, t); + + if (t->EditMode) + { + ETHERIP_ID d; + // Delete old items + Zero(&d, sizeof(d)); + + StrCpy(d.Id, sizeof(d.Id), t->EditId); + + ScDeleteEtherIpId(t->s->Rpc, &d); + } + + if (CALL(hWnd, ScAddEtherIpId(t->s->Rpc, &t->Data)) == false) + { + return; + } + + if (t->EditMode == false) + { + MsgBox(hWnd, MB_ICONINFORMATION, _UU("SM_ETHERIP_ADD_OK")); + } + + EndDialog(hWnd, 1); +} + +// EtherIP ID edit dialog: Update the controls +void SmEtherIpIdDlgUpdate(HWND hWnd, SM_ETHERIP_ID *t) +{ + bool ok = true; + // Validate arguments + if (hWnd == NULL || t == NULL) + { + return; + } + + if (t->InitCompleted == false) + { + return; + } + + SmEtherIpIdDlgGetSetting(hWnd, t); + + if (IsEmptyStr(t->Data.Id) || + IsEmptyStr(t->Data.HubName) || + IsEmptyStr(t->Data.UserName)) + { + ok = false; + } + + SetEnable(hWnd, IDOK, ok); +} + +// EtherIP ID edit dialog: Get the current settings +void SmEtherIpIdDlgGetSetting(HWND hWnd, SM_ETHERIP_ID *t) +{ + wchar_t *ws; + // Validate arguments + if (hWnd == NULL || t == NULL) + { + return; + } + + Zero(&t->Data, sizeof(t->Data)); + + GetTxtA(hWnd, E_ID, t->Data.Id, sizeof(t->Data.Id)); + GetTxtA(hWnd, E_USERNAME, t->Data.UserName, sizeof(t->Data.UserName)); + GetTxtA(hWnd, E_PASSWORD, t->Data.Password, sizeof(t->Data.Password)); + + ws = CbGetStr(hWnd, L_HUBNAME); + + if (ws != NULL && IsEmptyUniStr(ws) == false) + { + UniToStr(t->Data.HubName, sizeof(t->Data.HubName), ws); + } + + Free(ws); +} + + +// Open the EtherIP settings dialog +void SmEtherIp(HWND hWnd, SM_SERVER *s) +{ + // Validate arguments + if (s == NULL) + { + return; + } + + Dialog(hWnd, D_SM_ETHERIP, SmEtherIpDlg, s); +} + +// EtherIP Setup dialog procedure +UINT SmEtherIpDlg(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param) +{ + SM_SERVER *s = (SM_SERVER *)param; + NMHDR *n; + char *id; + SM_ETHERIP_ID t; + // Validate arguments + if (hWnd == NULL) + { + return 0; + } + + switch (msg) + { + case WM_INITDIALOG: + SmEtherIpDlgInit(hWnd, s); + break; + + case WM_COMMAND: + switch (wParam) + { + case IDOK: + // Edit + id = LvGetSelectedStrA(hWnd, L_LIST, 0); + if (id != NULL) + { + Zero(&t, sizeof(t)); + StrCpy(t.EditId, sizeof(t.EditId), id); + t.EditMode = true; + t.s = s; + + if (SmEtherIpId(hWnd, &t)) + { + SmEtherIpDlgRefresh(hWnd, s); + } + + Free(id); + } + break; + + case B_ADD: + // Add + Zero(&t, sizeof(t)); + t.s = s; + if (SmEtherIpId(hWnd, &t)) + { + SmEtherIpDlgRefresh(hWnd, s); + } + break; + + case B_DELETE: + // Delete + if (MsgBox(hWnd, MB_ICONQUESTION | MB_YESNO | MB_DEFBUTTON2, _UU("SM_CRL_DELETE_MSG")) == IDYES) + { + id = LvGetSelectedStrA(hWnd, L_LIST, 0); + if (id != NULL) + { + ETHERIP_ID d; + + Zero(&d, sizeof(d)); + + StrCpy(d.Id, sizeof(d.Id), id); + + if (CALL(hWnd, ScDeleteEtherIpId(s->Rpc, &d))) + { + SmEtherIpDlgRefresh(hWnd, s); + } + + Free(id); + } + } + break; + + case IDCANCEL: + // Close + Close(hWnd); + break; + } + break; + + case WM_NOTIFY: + n = (NMHDR *)lParam; + switch (n->idFrom) + { + case L_LIST: + switch (n->code) + { + case LVN_ITEMCHANGED: + SmEtherIpDlgUpdate(hWnd, s); + break; + + case NM_DBLCLK: + Command(hWnd, IDOK); + break; + } + break; + } + break; + + case WM_CLOSE: + EndDialog(hWnd, 0); + break; + } + + return 0; +} + +// EtherIP Setup dialog data update +void SmEtherIpDlgRefresh(HWND hWnd, SM_SERVER *s) +{ + RPC_ENUM_ETHERIP_ID t; + UINT i; + LVB *b; + // Validate arguments + if (hWnd == NULL || s == NULL) + { + return; + } + + // Data update + Zero(&t, sizeof(t)); + + if (CALL(hWnd, ScEnumEtherIpId(s->Rpc, &t)) == false) + { + EndDialog(hWnd, 0); + return; + } + + b = LvInsertStart(); + + for (i = 0;i < t.NumItem;i++) + { + ETHERIP_ID *d = &t.IdList[i]; + wchar_t id[MAX_SIZE], hubname[MAX_SIZE], username[MAX_SIZE]; + + StrToUni(id, sizeof(id), d->Id); + StrToUni(hubname, sizeof(hubname), d->HubName); + StrToUni(username, sizeof(username), d->UserName); + + LvInsertAdd(b, ICO_CASCADE, NULL, 3, id, hubname, username); + } + + LvInsertEnd(b, hWnd, L_LIST); + + FreeRpcEnumEtherIpId(&t); + + SmEtherIpDlgUpdate(hWnd, s); +} + +// Initialize the EtherIP settings dialog +void SmEtherIpDlgInit(HWND hWnd, SM_SERVER *s) +{ + // Validate arguments + if (hWnd == NULL || s == NULL) + { + return; + } + + SetIcon(hWnd, 0, ICO_MACHINE); + DlgFont(hWnd, S_TITLE, 14, true); + DlgFont(hWnd, S_BOLD, 0, true); + + LvInit(hWnd, L_LIST); + LvInsertColumn(hWnd, L_LIST, 0, _UU("SM_ETHERIP_COLUMN_0"), 205); + LvInsertColumn(hWnd, L_LIST, 1, _UU("SM_ETHERIP_COLUMN_1"), 179); + LvInsertColumn(hWnd, L_LIST, 2, _UU("SM_ETHERIP_COLUMN_2"), 154); + + SmEtherIpDlgRefresh(hWnd, s); +} + +// EtherIP Settings dialog controls update +void SmEtherIpDlgUpdate(HWND hWnd, SM_SERVER *s) +{ + // Validate arguments + if (hWnd == NULL || s == NULL) + { + return; + } + + SetEnable(hWnd, IDOK, LvIsSingleSelected(hWnd, L_LIST)); + SetEnable(hWnd, B_DELETE, LvIsSingleSelected(hWnd, L_LIST)); +} + +// IPsec Settings dialog procedure +UINT SmIPsecDlg(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param) +{ + SM_SERVER *s = (SM_SERVER *)param; + // Validate arguments + if (hWnd == NULL) + { + return 0; + } + + switch (msg) + { + case WM_INITDIALOG: + SmIPsecDlgInit(hWnd, s); + break; + + case WM_COMMAND: + switch (LOWORD(wParam)) + { + case R_L2TP_OVER_IPSEC: + case R_L2TP_RAW: + case R_ETHERIP: + case E_SECRET: + case L_HUBNAME: + SmIPsecDlgUpdate(hWnd, s); + break; + } + + switch (wParam) + { + case IDOK: + SmIPsecDlgOnOk(hWnd, s); + break; + + case IDCANCEL: + Close(hWnd); + break; + + case B_DETAIL: + // Advanced Settings dialog for EtherIP function + SmEtherIp(hWnd, s); + break; + } + break; + + case WM_CLOSE: + EndDialog(hWnd, 0); + break; + } + + return 0; +} + +// IPsec Settings dialog: controls update +void SmIPsecDlgUpdate(HWND hWnd, SM_SERVER *s) +{ + IPSEC_SERVICES sl; + bool ok = true; + // Validate arguments + if (hWnd == NULL || s == NULL) + { + return; + } + + SmIPsecDlgGetSetting(hWnd, &sl); + + //SetEnable(hWnd, S_1, sl.L2TP_IPsec || sl.L2TP_Raw); + //SetEnable(hWnd, S_2, sl.L2TP_IPsec || sl.L2TP_Raw); + //SetEnable(hWnd, L_HUBNAME, sl.L2TP_IPsec || sl.L2TP_Raw); + + SetEnable(hWnd, S_PSK, sl.L2TP_IPsec || sl.EtherIP_IPsec); + SetEnable(hWnd, S_PSK2, sl.L2TP_IPsec || sl.EtherIP_IPsec); + SetEnable(hWnd, E_SECRET, sl.L2TP_IPsec || sl.EtherIP_IPsec); + + SetEnable(hWnd, B_DETAIL, sl.EtherIP_IPsec); + + if ((sl.L2TP_IPsec || sl.EtherIP_IPsec) && IsEmptyStr(sl.IPsec_Secret)) + { + ok = false; + } + + SetEnable(hWnd, IDOK, ok); +} + +// Get the IPsec configuration into the structure +void SmIPsecDlgGetSetting(HWND hWnd, IPSEC_SERVICES *sl) +{ + wchar_t *ws; + // Validate arguments + if (hWnd == NULL || sl == NULL) + { + return; + } + + Zero(sl, sizeof(IPSEC_SERVICES)); + + sl->L2TP_IPsec = IsChecked(hWnd, R_L2TP_OVER_IPSEC); + sl->L2TP_Raw = IsChecked(hWnd, R_L2TP_RAW); + sl->EtherIP_IPsec = IsChecked(hWnd, R_ETHERIP); + + ws = CbGetStr(hWnd, L_HUBNAME); + if (ws != NULL && IsEmptyUniStr(ws) == false) + { + UniToStr(sl->L2TP_DefaultHub, sizeof(sl->L2TP_DefaultHub), ws); + } + + Free(ws); + + GetTxtA(hWnd, E_SECRET, sl->IPsec_Secret, sizeof(sl->IPsec_Secret)); +} + +// IPsec Settings dialog initialization +void SmIPsecDlgInit(HWND hWnd, SM_SERVER *s) +{ + IPSEC_SERVICES sl; + RPC_ENUM_HUB t; + UINT i; + UINT sel_index; + // Validate arguments + if (hWnd == NULL || s == NULL) + { + return; + } + + SetIcon(hWnd, 0, ICO_IPSEC); + + DlgFont(hWnd, S_TITLE, 14, true); + SetFont(hWnd, E_SECRET, GetFont("Verdana", 10, false, false, false, false)); + + DlgFont(hWnd, R_L2TP_OVER_IPSEC, 0, true); + DlgFont(hWnd, R_L2TP_RAW, 0, true); + DlgFont(hWnd, R_ETHERIP, 0, true); + + // Get the configuration + Zero(&sl, sizeof(sl)); + if (CALL(hWnd, ScGetIPsecServices(s->Rpc, &sl)) == false) + { + EndDialog(hWnd, 0); + return; + } + + SetTextA(hWnd, E_SECRET, sl.IPsec_Secret); + + Check(hWnd, R_L2TP_OVER_IPSEC, sl.L2TP_IPsec); + Check(hWnd, R_L2TP_RAW, sl.L2TP_Raw); + Check(hWnd, R_ETHERIP, sl.EtherIP_IPsec); + + // Enumerate the Virtual HUBs + Zero(&t, sizeof(t)); + if (CALL(hWnd, ScEnumHub(s->Rpc, &t)) == false) + { + EndDialog(hWnd, 0); + return; + } + + CbReset(hWnd, L_HUBNAME); + CbSetHeight(hWnd, L_HUBNAME, 18); + + sel_index = INFINITE; + for (i = 0;i < t.NumHub;i++) + { + RPC_ENUM_HUB_ITEM *e = &t.Hubs[i]; + UINT index; + + index = CbAddStrA(hWnd, L_HUBNAME, e->HubName, 0); + if (sel_index == INFINITE) + { + sel_index = index; + } + + if (StrCmpi(e->HubName, sl.L2TP_DefaultHub) == 0) + { + sel_index = index; + } + } + + if (sel_index != INFINITE) + { + CbSelectIndex(hWnd, L_HUBNAME, sel_index); + } + + FreeRpcEnumHub(&t); + + SmIPsecDlgUpdate(hWnd, s); +} + +// IPsec Settings dialog: on click the OK button +void SmIPsecDlgOnOk(HWND hWnd, SM_SERVER *s) +{ + IPSEC_SERVICES sl; + // Validate arguments + if (hWnd == NULL || s == NULL) + { + return; + } + + SmIPsecDlgGetSetting(hWnd, &sl); + + // Confirm the length of the PSK + if (StrLen(sl.IPsec_Secret) >= 10) + { + IPSEC_SERVICES sl_old; + if (ScGetIPsecServices(s->Rpc, &sl_old) == ERR_NO_ERROR) + { + if (StrCmp(sl_old.IPsec_Secret, sl.IPsec_Secret) != 0 || ((sl_old.EtherIP_IPsec == false && sl_old.L2TP_IPsec == false))) + { + if (sl.EtherIP_IPsec || sl.L2TP_IPsec) + { + // Show a warning message if it exceeds 10 characters (Only if there is a change) + if (MsgBox(hWnd, MB_ICONEXCLAMATION | MB_YESNO, _UU("SM_IPSEC_PSK_TOO_LONG")) == IDYES) + { + FocusEx(hWnd, E_SECRET); + return; + } + } + } + } + } + + if (CALL(hWnd, ScSetIPsecServices(s->Rpc, &sl)) == false) + { + return; + } + + EndDialog(hWnd, 1); +} + +// Start the IPsec Settings dialog +void SmIPsec(HWND hWnd, SM_SERVER *s) +{ + // Validate arguments + if (s == NULL) + { + return; + } + + Dialog(hWnd, D_SM_IPSEC, SmIPsecDlg, s); +} + +// Message Settings +void SmHubMsg(HWND hWnd, SM_EDIT_HUB *s) +{ + // Validate arguments + if (s == NULL) + { + return; + } + + Dialog(hWnd, D_SM_MSG, SmHubMsgDlg, s); +} + +// Message dialog procedure +UINT SmHubMsgDlg(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param) +{ + SM_EDIT_HUB *s = (SM_EDIT_HUB *)param; + // Validate arguments + if (hWnd == NULL) + { + return 0; + } + + switch (msg) + { + case WM_INITDIALOG: + SmHubMsgDlgInit(hWnd, s); + break; + + case WM_COMMAND: + switch (LOWORD(wParam)) + { + case E_TEXT: + SmHubMsgDlgUpdate(hWnd, s); + break; + } + + switch (wParam) + { + case IDOK: + SmHubMsgDlgOnOk(hWnd, s); + break; + + case IDCANCEL: + Close(hWnd); + break; + + case C_USEMSG: + SmHubMsgDlgUpdate(hWnd, s); + + if (IsChecked(hWnd, C_USEMSG)) + { + FocusEx(hWnd, E_TEXT); + } + break; + } + + break; + + case WM_CLOSE: + EndDialog(hWnd, 0); + break; + } + + return 0; +} + +// Message dialog initialization +void SmHubMsgDlgInit(HWND hWnd, SM_EDIT_HUB *s) +{ + RPC_MSG t; + // Validate arguments + if (hWnd == NULL || s == NULL) + { + return; + } + + if (MsIsVista()) + { + SetFont(hWnd, E_TEXT, GetMeiryoFont()); + } + else + { + DlgFont(hWnd, E_TEXT, 11, false); + } + + FormatText(hWnd, S_MSG_2, s->HubName); + + LimitText(hWnd, E_TEXT, HUB_MAXMSG_LEN); + + Zero(&t, sizeof(t)); + + StrCpy(t.HubName, sizeof(t.HubName), s->HubName); + + if (CALL(hWnd, ScGetHubMsg(s->p->Rpc, &t)) == false) + { + Close(hWnd); + return; + } + + if (UniIsEmptyStr(t.Msg) == false) + { + SetText(hWnd, E_TEXT, t.Msg); + + Check(hWnd, C_USEMSG, true); + } + else + { + Check(hWnd, C_USEMSG, false); + } + + FreeRpcMsg(&t); + + SmHubMsgDlgUpdate(hWnd, s); +} + +// [OK] button +void SmHubMsgDlgOnOk(HWND hWnd, SM_EDIT_HUB *s) +{ + RPC_MSG t; + // Validate arguments + if (hWnd == NULL || s == NULL) + { + return; + } + + Zero(&t, sizeof(t)); + + StrCpy(t.HubName, sizeof(t.HubName), s->HubName); + + if (IsChecked(hWnd, C_USEMSG) == false) + { + t.Msg = CopyUniStr(L""); + } + else + { + t.Msg = GetText(hWnd, E_TEXT); + } + + if (CALL(hWnd, ScSetHubMsg(s->p->Rpc, &t)) == false) + { + return; + } + + FreeRpcMsg(&t); + + EndDialog(hWnd, 1); +} + +// Message dialog update +void SmHubMsgDlgUpdate(HWND hWnd, SM_EDIT_HUB *s) +{ + bool b = true; + // Validate arguments + if (hWnd == NULL || s == NULL) + { + return; + } + + SetEnable(hWnd, E_TEXT, IsChecked(hWnd, C_USEMSG)); + + if (IsChecked(hWnd, C_USEMSG)) + { + wchar_t *s = GetText(hWnd, E_TEXT); + + b = !IsEmptyUniStr(s); + + Free(s); + } + + SetEnable(hWnd, IDOK, b); +} + +// VLAN utility +void SmVLan(HWND hWnd, SM_SERVER *s) +{ + // Validate arguments + if (s == NULL) + { + return; + } + + Dialog(hWnd, D_SM_VLAN, SmVLanDlg, s); +} + +// VLAN dialog +UINT SmVLanDlg(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param) +{ + SM_SERVER *s = (SM_SERVER *)param; + NMHDR *n; + + // Validate arguments + if (hWnd == NULL) + { + return 0; + } + + switch (msg) + { + case WM_INITDIALOG: + SmVLanDlgInit(hWnd, s); + + if (LvNum(hWnd, L_LIST) == 0) + { + Disable(hWnd, L_LIST); + SetTimer(hWnd, 1, 100, NULL); + } + break; + + case WM_TIMER: + switch (wParam) + { + case 1: + KillTimer(hWnd, 1); + + MsgBoxEx(hWnd, MB_ICONINFORMATION, _UU("SM_VLAN_NOTHING"), + s->CurrentSetting->ClientOption.Hostname); + break; + } + break; + + case WM_COMMAND: + switch (wParam) + { + case IDOK: + case IDCANCEL: + Close(hWnd); + break; + + case B_ENABLE: + case B_DISABLE: + { + UINT i = LvGetSelected(hWnd, L_LIST); + if (i != INFINITE) + { + char *name = LvGetStrA(hWnd, L_LIST, i, 0); + + if (IsEmptyStr(name) == false) + { + RPC_TEST t; + + Zero(&t, sizeof(t)); + + StrCpy(t.StrValue, sizeof(t.StrValue), name); + t.IntValue = BOOL_TO_INT(wParam == B_ENABLE); + + if (CALL(hWnd, ScSetEnableEthVLan(s->Rpc, &t))) + { + SmVLanDlgRefresh(hWnd, s); + + if (wParam == B_ENABLE) + { + MsgBoxEx(hWnd, MB_ICONINFORMATION, + _UU("SM_VLAN_MSG_1"), + name, name, name); + } + else + { + MsgBoxEx(hWnd, MB_ICONINFORMATION, + _UU("SM_VLAN_MSG_2"), + name); + } + } + } + + Free(name); + } + break; + } + } + break; + + case WM_NOTIFY: + n = (NMHDR *)lParam; + switch (n->idFrom) + { + case L_LIST: + switch (n->code) + { + case LVN_ITEMCHANGED: + SmVLanDlgUpdate(hWnd, s); + break; + } + break; + } + break; + + case WM_CLOSE: + EndDialog(hWnd, 0); + break; + } + + return 0; +} + +// VLAN dialog initialization +void SmVLanDlgInit(HWND hWnd, SM_SERVER *s) +{ + // Validate arguments + if (hWnd == NULL || s == NULL) + { + return; + } + + LvInit(hWnd, L_LIST); + LvInsertColumn(hWnd, L_LIST, 0, _UU("SM_VLAN_COLUMN_0"), 245); + LvInsertColumn(hWnd, L_LIST, 1, _UU("SM_VLAN_COLUMN_1"), 75); + LvInsertColumn(hWnd, L_LIST, 2, _UU("SM_VLAN_COLUMN_2"), 100); + LvInsertColumn(hWnd, L_LIST, 3, _UU("SM_VLAN_COLUMN_3"), 100); + LvInsertColumn(hWnd, L_LIST, 4, _UU("SM_VLAN_COLUMN_4"), 290); + LvInsertColumn(hWnd, L_LIST, 5, _UU("SM_VLAN_COLUMN_5"), 430); + + SmVLanDlgRefresh(hWnd, s); +} + +// VLAN dialog content update +void SmVLanDlgRefresh(HWND hWnd, SM_SERVER *s) +{ + LVB *b; + RPC_ENUM_ETH_VLAN t; + UINT i; + // Validate arguments + if (hWnd == NULL || s == NULL) + { + return; + } + + Zero(&t, sizeof(t)); + if (CALL(hWnd, ScEnumEthVLan(s->Rpc, &t)) == false) + { + Close(hWnd); + return; + } + + b = LvInsertStart(); + + for (i = 0;i < t.NumItem;i++) + { + RPC_ENUM_ETH_VLAN_ITEM *e = &t.Items[i]; + + if (e->Support) + { + wchar_t tmp0[MAX_SIZE]; + wchar_t tmp1[MAX_SIZE]; + wchar_t tmp2[MAX_SIZE]; + wchar_t *tmp3; + wchar_t tmp4[MAX_SIZE]; + wchar_t tmp5[MAX_SIZE]; + + StrToUni(tmp0, sizeof(tmp0), e->DeviceName); + StrToUni(tmp1, sizeof(tmp1), e->DriverType); + StrToUni(tmp2, sizeof(tmp2), e->DriverName); + tmp3 = (e->Enabled ? _UU("SM_VLAN_YES") : _UU("SM_VLAN_NO")); + StrToUni(tmp4, sizeof(tmp4), e->Guid); + StrToUni(tmp5, sizeof(tmp5), e->DeviceInstanceId); + + LvInsertAdd(b, + e->Enabled ? ICO_NIC_ONLINE : ICO_NIC_OFFLINE, 0, 6, + tmp0, tmp1, tmp2, tmp3, tmp4, tmp5); + } + } + + LvInsertEnd(b, hWnd, L_LIST); + + FreeRpcEnumEthVLan(&t); + + SmVLanDlgUpdate(hWnd, s); +} + +// VLAN dialog control update +void SmVLanDlgUpdate(HWND hWnd, SM_SERVER *s) +{ + // Validate arguments + if (hWnd == NULL || s == NULL) + { + return; + } + + if (LvIsSingleSelected(hWnd, L_LIST) == false) + { + Disable(hWnd, B_ENABLE); + Disable(hWnd, B_DISABLE); + } + else + { + UINT i = LvGetSelected(hWnd, L_LIST); + if (i != INFINITE) + { + wchar_t *s = LvGetStr(hWnd, L_LIST, i, 3); + + if (UniStrCmpi(s, _UU("SM_VLAN_YES")) != 0) + { + Enable(hWnd, B_ENABLE); + Disable(hWnd, B_DISABLE); + } + else + { + Enable(hWnd, B_DISABLE); + Disable(hWnd, B_ENABLE); + } + + Free(s); + } + } +} + +// Examine whether the current state of VPN Server / VPN Bridge is the initial state +bool SmSetupIsNew(SM_SERVER *s) +{ + RPC *rpc; + bool is_bridge; + char hubname[MAX_HUBNAME_LEN + 1]; + bool check_hub = false; + // Validate arguments + if (s == NULL) + { + return false; + } + + if (s->ServerAdminMode == false) + { + return false; + } + + rpc = s->Rpc; + is_bridge =s->Bridge; + + // Server type + if (is_bridge == false) + { + bool b = false; + RPC_SERVER_INFO t; + + Zero(&t, sizeof(t)); + if (ScGetServerInfo(rpc, &t) == ERR_NO_ERROR) + { + if (t.ServerType != SERVER_TYPE_STANDALONE) + { + b = true; + } + + FreeRpcServerInfo(&t); + } + else + { + return false; + } + + if (b) + { + return false; + } + } + + // Local bridge + if (true) + { + RPC_ENUM_LOCALBRIDGE t; + bool b = false; + + Zero(&t, sizeof(t)); + if (ScEnumLocalBridge(rpc, &t) == ERR_NO_ERROR) + { + if (t.NumItem != 0) + { + b = true; + } + FreeRpcEnumLocalBridge(&t); + } + + if (b) + { + return false; + } + } + + // Virtual HUB + + check_hub = false; + + if (is_bridge == false) + { + RPC_ENUM_HUB t; + bool b = false; + + Zero(&t, sizeof(t)); + if (ScEnumHub(rpc, &t) == ERR_NO_ERROR) + { + if (t.NumHub >= 2) + { + b = true; + } + else if (t.NumHub == 1) + { + if (StrCmpi(t.Hubs[0].HubName, SERVER_DEFAULT_HUB_NAME) != 0) + { + b = true; + } + else + { + check_hub = true; + } + } + + FreeRpcEnumHub(&t); + } + + if (b) + { + return false; + } + } + else + { + check_hub = true; + } + + // Status of the virtual HUB + if (is_bridge == false) + { + StrCpy(hubname, sizeof(hubname), SERVER_DEFAULT_HUB_NAME); + } + else + { + StrCpy(hubname, sizeof(hubname), SERVER_DEFAULT_BRIDGE_NAME); + } + + if (check_hub) + { + if (true) + { + // Number of objects in the Virtual HUB + RPC_HUB_STATUS t; + + Zero(&t, sizeof(t)); + StrCpy(t.HubName, sizeof(t.HubName), hubname); + + if (ScGetHubStatus(rpc, &t) == ERR_NO_ERROR) + { + if (t.NumSessions != 0 || t.NumAccessLists != 0 || + t.NumUsers != 0 || t.NumGroups != 0 || + t.NumMacTables != 0 || t.NumIpTables != 0 || + t.SecureNATEnabled) + { + return false; + } + } + else + { + return false; + } + } + + if (true) + { + // Cascade connection + RPC_ENUM_LINK t; + + Zero(&t, sizeof(t)); + StrCpy(t.HubName, sizeof(t.HubName), hubname); + + if (ScEnumLink(rpc, &t) == ERR_NO_ERROR) + { + bool b = false; + + if (t.NumLink != 0) + { + b = true; + } + + FreeRpcEnumLink(&t); + + if (b) + { + return false; + } + } + else + { + return false; + } + } + + if (is_bridge == false) + { + // Certificate list to trust + RPC_HUB_ENUM_CA t; + + Zero(&t, sizeof(t)); + StrCpy(t.HubName, sizeof(t.HubName), hubname); + + if (ScEnumCa(rpc, &t) == ERR_NO_ERROR) + { + bool b = false; + + if (t.NumCa != 0) + { + b = true; + } + + FreeRpcHubEnumCa(&t); + + if (b) + { + return false; + } + } + else + { + return false; + } + } + + if (is_bridge == false) + { + // Certificate revocation list + RPC_ENUM_CRL t; + + Zero(&t, sizeof(t)); + StrCpy(t.HubName, sizeof(t.HubName), hubname); + + if (ScEnumCrl(rpc, &t) == ERR_NO_ERROR) + { + bool b = false; + + if (t.NumItem != 0) + { + b = true; + } + + FreeRpcEnumCrl(&t); + + if (b) + { + return false; + } + } + else + { + return false; + } + } + + if (is_bridge == false) + { + // Authentication server configuration + RPC_RADIUS t; + + Zero(&t, sizeof(t)); + StrCpy(t.HubName, sizeof(t.HubName), hubname); + + if (ScGetHubRadius(rpc, &t) == ERR_NO_ERROR) + { + if (IsEmptyStr(t.RadiusServerName) == false) + { + return false; + } + } + else + { + return false; + } + } + + if (is_bridge == false) + { + // Virtual HUB configuration + RPC_CREATE_HUB t; + + Zero(&t, sizeof(t)); + StrCpy(t.HubName, sizeof(t.HubName), hubname); + + if (ScGetHub(rpc, &t) == ERR_NO_ERROR) + { + if (t.HubOption.NoEnum || t.HubOption.MaxSession != 0 || + t.Online == false) + { + return false; + } + } + else + { + return false; + } + } + + if (is_bridge == false) + { + // IP access control list + RPC_AC_LIST t; + + Zero(&t, sizeof(t)); + StrCpy(t.HubName, sizeof(t.HubName), hubname); + + if (ScGetAcList(rpc, &t) == ERR_NO_ERROR) + { + bool b = false; + if (LIST_NUM(t.o) != 0) + { + b = true; + } + FreeRpcAcList(&t); + + if (b) + { + return false; + } + } + else + { + return false; + } + } + + if (is_bridge == false) + { + // AO + RPC_ADMIN_OPTION t; + + Zero(&t, sizeof(t)); + StrCpy(t.HubName, sizeof(t.HubName), hubname); + + if (ScGetHubAdminOptions(rpc, &t) == ERR_NO_ERROR) + { + bool b = false; + UINT i; + + for (i = 0;i < t.NumItem;i++) + { + if (t.Items[i].Value != 0) + { + b = true; + } + } + + FreeRpcAdminOption(&t); + + if (b) + { + return false; + } + } + else + { + return false; + } + } + } + + // Virtual layer 3 switch + if (is_bridge == false) + { + RPC_ENUM_L3SW t; + bool b = false; + + Zero(&t, sizeof(t)); + if (ScEnumL3Switch(rpc, &t) == ERR_NO_ERROR) + { + if (t.NumItem != 0) + { + b = true; + } + + FreeRpcEnumL3Sw(&t); + } + else + { + return false; + } + + if (b) + { + return false; + } + } + + return true; +} + +// Setup procedure dialog initialization +void SmSetupStepDlgInit(HWND hWnd, SM_SETUP *s) +{ + bool b; + RPC_ENUM_ETH t; + UINT i; + RPC_BRIDGE_SUPPORT bs; + // Validate arguments + if (hWnd == NULL || s == NULL) + { + return; + } + + SetIcon(hWnd, 0, ICO_SETUP); + + DlgFont(hWnd, S_1_1, 0, true); + DlgFont(hWnd, S_2_1, 0, true); + DlgFont(hWnd, S_3_1, 0, true); + + b = false; + if (s->UseRemote) + { + b = true; + } + if (s->UseSite && s->UseSiteEdge == false) + { + b = true; + } + + SetEnable(hWnd, S_1_1, b); + SetEnable(hWnd, S_1_2, b); + SetEnable(hWnd, B_USER, b); + + b = false; + if (s->UseSiteEdge) + { + b = true; + } + + SetEnable(hWnd, S_2_1, b); + SetEnable(hWnd, S_2_2, b); + SetEnable(hWnd, B_CASCADE, b); + + CbReset(hWnd, C_DEVICE); + CbSetHeight(hWnd, C_DEVICE, 18); + + Zero(&t, sizeof(t)); + + CbAddStr(hWnd, C_DEVICE, _UU("SM_SETUP_SELECT"), 0); + + Zero(&bs, sizeof(bs)); + if (CALL(hWnd, ScGetBridgeSupport(s->Rpc, &bs)) == false) + { + return; + } + + if (bs.IsBridgeSupportedOs) + { + // Enumerate the local bridges + if (ScEnumEthernet(s->Rpc, &t) == ERR_NO_ERROR) + { + for (i = 0;i < t.NumItem;i++) + { + wchar_t tmp[MAX_PATH]; + RPC_ENUM_ETH_ITEM *e = &t.Items[i]; + + if (GetCapsBool(s->s->CapsList, "b_support_network_connection_name")) + { + UniFormat(tmp, sizeof(tmp), BRIDGE_NETWORK_CONNECTION_STR, e->NetworkConnectionName, e->DeviceName); + } + else + { + StrToUni(tmp, sizeof(tmp), e->DeviceName); + } + + CbAddStr(hWnd, C_DEVICE, tmp, 1); + } + + FreeRpcEnumEth(&t); + } + Show(hWnd, C_DEVICE); + Hide(hWnd, B_SECURENAT); + } + else + { + RPC_HUB t; + + // Enable the SecureNAT automatically if the local bridge does not work in this environment + SetText(hWnd, S_3_2, _UU("SM_SETUP_STEP_SECURENAT")); + SetText(hWnd, S_3_1, _UU("SM_SETUP_STEP_SECURENAT_TITLE")); + Hide(hWnd, C_DEVICE); + Show(hWnd, B_SECURENAT); + SetIcon(hWnd, S_ICON, ICO_ROUTER); + + Zero(&t, sizeof(t)); + StrCpy(t.HubName, sizeof(t.HubName), s->HubName); + + ScEnableSecureNAT(s->Rpc, &t); + } + + s->Flag1 = false; + s->Flag2 = false; +} + +// Close +void SmSetupOnClose(HWND hWnd, SM_SETUP *s) +{ + wchar_t *tmp; + char name[MAX_PATH]; + RPC_BRIDGE_SUPPORT bs; + // Validate arguments + if (hWnd == NULL || s == NULL) + { + return; + } + + Zero(&bs, sizeof(bs)); + if (CALL(hWnd, ScGetBridgeSupport(s->Rpc, &bs)) == false) + { + return; + } + + if (bs.IsBridgeSupportedOs) + { + // Add a Local Bridge + tmp = CbGetStr(hWnd, C_DEVICE); + + if (tmp != NULL) + { + UniToStr(name, sizeof(name), tmp); + + if (CbGetSelect(hWnd, C_DEVICE) != 0) + { + // Show a warning message if the VPN Server is running in a VM + if (GetCapsBool(s->s->CapsList, "b_is_in_vm")) + { + Dialog(hWnd, D_SM_VMBRIDGE, SmVmBridgeDlg, NULL); + } + + if (GetCapsBool(s->s->CapsList, "b_support_network_connection_name") == false) + { + RPC_LOCALBRIDGE t; + + Zero(&t, sizeof(t)); + t.Active = true; + StrCpy(t.DeviceName, sizeof(t.DeviceName), name); + StrCpy(t.HubName, sizeof(t.HubName), s->HubName); + t.Online = true; + t.TapMode = false; + + if (CALL(hWnd, ScAddLocalBridge(s->Rpc, &t)) == false) + { + Free(tmp); + return; + } + } + else + { + RPC_ENUM_ETH tt; + UINT i; + + Zero(&tt, sizeof(tt)); + if (CALL(hWnd, ScEnumEthernet(s->Rpc, &tt)) == false) + { + Free(tmp); + return; + } + + for (i = 0;i < tt.NumItem;i++) + { + RPC_ENUM_ETH_ITEM *ti = &tt.Items[i]; + wchar_t fullname[MAX_SIZE]; + + UniFormat(fullname, sizeof(fullname), BRIDGE_NETWORK_CONNECTION_STR, ti->NetworkConnectionName, ti->DeviceName); + + if (UniStrCmpi(fullname, tmp) == 0) + { + RPC_LOCALBRIDGE t; + + Zero(&t, sizeof(t)); + t.Active = true; + StrCpy(t.DeviceName, sizeof(t.DeviceName), ti->DeviceName); + StrCpy(t.HubName, sizeof(t.HubName), s->HubName); + t.Online = true; + t.TapMode = false; + + if (CALL(hWnd, ScAddLocalBridge(s->Rpc, &t)) == false) + { + FreeRpcEnumEth(&tt); + Free(tmp); + return; + } + break; + } + } + + FreeRpcEnumEth(&tt); + } + + } + Free(tmp); + } + } + else + { + // Enable the SecureNAT + } + + EndDialog(hWnd, 0); +} + +// Setup Procedure dialog procedure +UINT SmSetupStepDlg(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param) +{ + SM_SETUP *s = (SM_SETUP *)param; + // Validate arguments + if (hWnd == NULL) + { + return 0; + } + + switch (msg) + { + case WM_INITDIALOG: + // Initialize + SmSetupStepDlgInit(hWnd, s); + break; + + case WM_COMMAND: + switch (wParam) + { + case B_USER: + // User creation + if (true) + { + SM_HUB h; + + Zero(&h, sizeof(h)); + h.HubName = s->HubName; + h.p = s->s; + h.Rpc = s->Rpc; + + SmUserListDlgEx(hWnd, &h, NULL, s->Flag1 ? false : true); + + s->Flag1 = true; + } + break; + + case B_CASCADE: + // Create a cascade connection + if (true) + { + SM_HUB h; + + Zero(&h, sizeof(h)); + h.HubName = s->HubName; + h.p = s->s; + h.Rpc = s->Rpc; + + SmLinkDlgEx(hWnd, &h, s->Flag2 ? false : true); + s->Flag2 = true; + } + break; + + case B_SECURENAT: + // Setting the SecureNAT + if (true) + { + SM_HUB h; + + Zero(&h, sizeof(h)); + h.p = s->s; + h.Rpc = s->Rpc; + h.HubName = s->HubName; + + Dialog(hWnd, D_SM_SNAT, SmSNATDlgProc, &h); + } + break; + + case IDCANCEL: + // Close button + Close(hWnd); + break; + } + break; + + case WM_CLOSE: + // Exit + SmSetupOnClose(hWnd, s); + break; + } + + return 0; +} + +// Setup procedure dialog +void SmSetupStep(HWND hWnd, SM_SETUP *s) +{ + // Validate arguments + if (s == NULL) + { + return; + } + + Dialog(hWnd, D_SM_SETUP_STEP, SmSetupStepDlg, s); +} + +// Initialize by setup +bool SmSetupInit(HWND hWnd, SM_SETUP *s) +{ + // Validate arguments + if (s == NULL) + { + return false; + } + + if (s->IsBridge == false) + { + if (SmSetupDeleteAllLayer3(hWnd, s) == false) + { + return false; + } + + if (SmSetupDeleteAllHub(hWnd, s) == false) + { + return false; + } + } + else + { + if (SmSetupDeleteAllObjectInBridgeHub(hWnd, s) == false) + { + return false; + } + } + + SmSetupDeleteAllLocalBridge(hWnd, s); + + if (s->IsBridge == false) + { + // Create a Virtual HUB + RPC_CREATE_HUB t; + char *password = ""; + + Zero(&t, sizeof(t)); + Sha0(t.HashedPassword, password, StrLen(password)); + HashPassword(t.SecurePassword, ADMINISTRATOR_USERNAME, password); + StrCpy(t.HubName, sizeof(t.HubName), s->HubName); + t.HubType = HUB_TYPE_STANDALONE; + t.Online = true; + + if (CALL(hWnd, ScCreateHub(s->Rpc, &t)) == false) + { + return false; + } + } + + return true; +} + +// Remove all objects in the Virtual HUB of the VPN Bridge +bool SmSetupDeleteAllObjectInBridgeHub(HWND hWnd, SM_SETUP *s) +{ + char *hubname = SERVER_DEFAULT_BRIDGE_NAME; + // Validate arguments + if (hWnd == NULL || s == NULL) + { + return false; + } + + if (true) + { + RPC_ENUM_LINK t; + UINT i; + + Zero(&t, sizeof(t)); + StrCpy(t.HubName, sizeof(t.HubName), hubname); + + if (CALL(hWnd, ScEnumLink(s->Rpc, &t)) == false) + { + return false; + } + + for (i = 0;i < t.NumLink;i++) + { + RPC_ENUM_LINK_ITEM *e = &t.Links[i]; + RPC_LINK a; + + Zero(&a, sizeof(a)); + StrCpy(a.HubName, sizeof(a.HubName), hubname); + UniStrCpy(a.AccountName, sizeof(a.AccountName), e->AccountName); + + if (CALL(hWnd, ScDeleteLink(s->Rpc, &a)) == false) + { + FreeRpcEnumLink(&t); + return false; + } + } + + FreeRpcEnumLink(&t); + } + + if (true) + { + RPC_HUB t; + + Zero(&t, sizeof(t)); + StrCpy(t.HubName, sizeof(t.HubName), hubname); + + if (CALL(hWnd, ScDisableSecureNAT(s->Rpc, &t)) == false) + { + return false; + } + } + + return true; +} + +// Delete all Virtual Layer 3 Switches +bool SmSetupDeleteAllLayer3(HWND hWnd, SM_SETUP *s) +{ + RPC_ENUM_L3SW t; + UINT i; + // Validate arguments + if (hWnd == NULL || s == NULL) + { + return false; + } + + Zero(&t, sizeof(t)); + if(CALL(hWnd, ScEnumL3Switch(s->Rpc, &t)) == false) + { + return false; + } + + for (i = 0;i < t.NumItem;i++) + { + RPC_ENUM_L3SW_ITEM *e = &t.Items[i]; + RPC_L3SW tt; + + Zero(&tt, sizeof(tt)); + StrCpy(tt.Name, sizeof(tt.Name), e->Name); + + if (CALL(hWnd, ScDelL3Switch(s->Rpc, &tt)) == false) + { + FreeRpcEnumL3Sw(&t); + return false; + } + } + + FreeRpcEnumL3Sw(&t); + + return true; +} + +// Delete all local bridges +bool SmSetupDeleteAllLocalBridge(HWND hWnd, SM_SETUP *s) +{ + RPC_ENUM_LOCALBRIDGE t; + UINT i; + // Validate arguments + if (hWnd == NULL || s == NULL) + { + return false; + } + + Zero(&t, sizeof(t)); + if (ScEnumLocalBridge(s->Rpc, &t) != ERR_NO_ERROR) + { + return false; + } + + for (i = 0;i < t.NumItem;i++) + { + RPC_LOCALBRIDGE *e = &t.Items[i]; + + if (CALL(hWnd, ScDeleteLocalBridge(s->Rpc, e)) == false) + { + FreeRpcEnumLocalBridge(&t); + return false; + } + } + + FreeRpcEnumLocalBridge(&t); + + return true; +} + +// Delete all Virtual HUBs +bool SmSetupDeleteAllHub(HWND hWnd, SM_SETUP *s) +{ + RPC_ENUM_HUB t; + UINT i; + // Validate arguments + if (hWnd == NULL || s == NULL) + { + return false; + } + + Zero(&t, sizeof(t)); + if (CALL(hWnd, ScEnumHub(s->Rpc, &t)) == false) + { + return false; + } + + for (i = 0;i < t.NumHub;i++) + { + RPC_ENUM_HUB_ITEM *e = &t.Hubs[i]; + RPC_DELETE_HUB tt; + + Zero(&tt, sizeof(tt)); + StrCpy(tt.HubName, sizeof(tt.HubName), e->HubName); + + if (CALL(hWnd, ScDeleteHub(s->Rpc, &tt)) == false) + { + FreeRpcEnumHub(&t); + return false; + } + } + + FreeRpcEnumHub(&t); + + return true; +} + +// Update the control of the Virtual HUB +void SmSetupHubDlgUpdate(HWND hWnd, SM_SETUP *s) +{ + bool ok = true; + char tmp[MAX_HUBNAME_LEN + 1]; + // Validate arguments + if (hWnd == NULL || s == NULL) + { + return; + } + + GetTxtA(hWnd, E_HUBNAME, tmp, sizeof(tmp)); + + if (IsEmptyStr(tmp) || IsSafeStr(tmp) == false) + { + ok = false; + } + + SetEnable(hWnd, IDOK, ok); +} + +// Virtual HUB creation dialog +UINT SmSetupHubDlg(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param) +{ + SM_SETUP *s = (SM_SETUP *)param; + // Validate arguments + if (hWnd == NULL) + { + return 0; + } + + switch (msg) + { + case WM_INITDIALOG: + SetTextA(hWnd, E_HUBNAME, "VPN"); + FocusEx(hWnd, E_HUBNAME); + SmSetupHubDlgUpdate(hWnd, s); + break; + + case WM_COMMAND: + SmSetupHubDlgUpdate(hWnd, s); + + switch (wParam) + { + case IDOK: + GetTxtA(hWnd, E_HUBNAME, s->HubName, sizeof(s->HubName)); + EndDialog(hWnd, true); + break; + + case IDCANCEL: + Close(hWnd); + break; + } + break; + + case WM_CLOSE: + EndDialog(hWnd, 0); + break; + } + + return 0; +} + +// Setup dialog: [Next] button +void SmSetupDlgOnOk(HWND hWnd, SM_SETUP *s) +{ + // Validate arguments + if (hWnd == NULL || s == NULL) + { + return; + } + + if (MsgBox(hWnd, MB_YESNO | MB_ICONEXCLAMATION, _UU("SM_SETUP_WARNING")) == IDNO) + { + return; + } + + s->UseRemote = IsChecked(hWnd, C_REMOTE); + s->UseSite = IsChecked(hWnd, C_SITE); + s->UseSiteEdge = IsChecked(hWnd, C_EDGE); + + if (s->IsBridge) + { + StrCpy(s->HubName, sizeof(s->HubName), SERVER_DEFAULT_BRIDGE_NAME); + } + else + { + if (Dialog(hWnd, D_SM_SETUP_HUB, SmSetupHubDlg, s) == false) + { + return; + } + } + + // Initialize (Wipe existing objects) + if (SmSetupInit(hWnd, s) == false) + { + return; + } + + if (s->IsBridge == false) + { + if (GetCapsBool(s->s->CapsList, "b_support_ddns")) + { + if (s->UseRemote || (s->UseSite && s->UseSiteEdge == false)) + { + DDNS_CLIENT_STATUS st; + + Zero(&st, sizeof(st)); + + if (ScGetDDnsClientStatus(s->s->Rpc, &st) == ERR_NO_ERROR && + IsEmptyStr(st.CurrentHostName) == false) + { + // Display the Dynamic DNS setting screen + SmDDns(hWnd, s->s, true, false); + } + } + } + + // Configure the IPsec if the IPsec feature is available + if (GetCapsBool(s->s->CapsList, "b_support_ipsec") && s->s->IPsecMessageDisplayed == false) + { + // Display a message about IPsec + RPC_TEST flag; + + if (s->UseRemote || (s->UseSite && s->UseSiteEdge == false)) + { + SmIPsec(hWnd, s->s); + } + + Zero(&flag, sizeof(flag)); + flag.IntValue = 9; + ToStr(flag.StrValue, 1); + + ScDebug(s->s->Rpc, &flag); + + s->s->IPsecMessageDisplayed = true; + } + + // Configure the VPN Azure if VPN Azure feature is available + if (GetCapsBool(s->s->CapsList, "b_support_azure")) + { + SmAzure(hWnd, s->s, true); + } + + } + + // Execute the procedure + SmSetupStep(hWnd, s); + + // Close the dialog + EndDialog(hWnd, true); +} + +// Setup dialog: initialization +void SmSetupDlgInit(HWND hWnd, SM_SETUP *s) +{ + // Validate arguments + if (hWnd == NULL || s == NULL) + { + return; + } + + SetIcon(hWnd, 0, ICO_SETUP); + DlgFont(hWnd, S_TITLE, 14, true); + DlgFont(hWnd, C_REMOTE, 0, true); + DlgFont(hWnd, C_SITE, 0, true); + DlgFont(hWnd, C_OTHER, 0, true); + + if (s->IsBridge) + { + SetText(hWnd, B_BOLD, _UU("SM_SETUP_BRIDGE_ONLY")); + SetText(hWnd, C_EDGE, _UU("SM_SETUP_BRIDGE_EDGE")); + + Check(hWnd, C_SITE, true); + Check(hWnd, C_EDGE, true); + Focus(hWnd, C_SITE); + } + + SmSetupDlgUpdate(hWnd, s); +} + +// Setup dialog: update +void SmSetupDlgUpdate(HWND hWnd, SM_SETUP *s) +{ + bool enable_remote = true; + bool enable_site = true; + bool enable_site_center = true; + bool enable_detail = true; + bool ok = true; + // Validate arguments + if (hWnd == NULL || s == NULL) + { + return; + } + + if (s->IsBridge) + { + enable_remote = false; + enable_site_center = false; + enable_detail = false; + } + + if (IsChecked(hWnd, C_OTHER)) + { + ok = false; + } + + SetEnable(hWnd, C_REMOTE, enable_remote && IsChecked(hWnd, C_OTHER) == false); + SetEnable(hWnd, S_REMOTE_1, enable_remote && IsChecked(hWnd, C_OTHER) == false); + + SetEnable(hWnd, C_SITE, enable_site && IsChecked(hWnd, C_OTHER) == false); + SetEnable(hWnd, S_SITE_1, enable_site && IsChecked(hWnd, C_OTHER) == false); + SetEnable(hWnd, S_SITE_2, enable_site && IsChecked(hWnd, C_SITE) && IsChecked(hWnd, C_OTHER) == false); + SetEnable(hWnd, C_CENTER, enable_site && enable_site_center && IsChecked(hWnd, C_SITE) && IsChecked(hWnd, C_OTHER) == false); + SetEnable(hWnd, C_EDGE, enable_site && IsChecked(hWnd, C_SITE) && IsChecked(hWnd, C_OTHER) == false); + + SetEnable(hWnd, C_OTHER, enable_detail); + SetEnable(hWnd, S_OTHER, enable_detail); + + if (IsChecked(hWnd, C_REMOTE) == false && IsChecked(hWnd, C_SITE) == false) + { + ok = false; + } + + if (IsChecked(hWnd, C_SITE)) + { + if (IsChecked(hWnd, C_CENTER) == false && IsChecked(hWnd, C_EDGE) == false) + { + ok = false; + } + } + + SetEnable(hWnd, IDOK, ok); + + SetText(hWnd, S_INFO, + IsChecked(hWnd, C_OTHER) ? _UU("SM_SETUP_INFO_2") : _UU("SM_SETUP_INFO_1")); +} + +// Setup dialog +UINT SmSetupDlg(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param) +{ + SM_SETUP *s = (SM_SETUP *)param; + // Validate arguments + if (hWnd == NULL) + { + return 0; + } + + switch (msg) + { + case WM_INITDIALOG: + SmSetupDlgInit(hWnd, s); + break; + + case WM_COMMAND: + SmSetupDlgUpdate(hWnd, s); + + switch (wParam) + { + case IDOK: + SmSetupDlgOnOk(hWnd, s); + break; + + case IDCANCEL: + Close(hWnd); + break; + } + break; + + case WM_CLOSE: + EndDialog(hWnd, 0); + break; + } + + return 0; +} + +// Setup +bool SmSetup(HWND hWnd, SM_SERVER *s) +{ + SM_SETUP ss; + // Validate arguments + if (s == NULL) + { + return false; + } + + Zero(&ss, sizeof(ss)); + ss.s = s; + ss.IsBridge = ss.s->Bridge; + ss.Rpc = s->Rpc; + + if (Dialog(hWnd, D_SM_SETUP, SmSetupDlg, &ss) == false) + { + return false; + } + + return true; +} + +// License registration process +void SmLicenseAddDlgOnOk(HWND hWnd, SM_SERVER *s) +{ + char tmp[MAX_SIZE]; + // Validate arguments + if (hWnd == NULL || s == NULL) + { + return; + } + + SmLicenseAddDlgGetText(hWnd, tmp, sizeof(tmp)); + + if (LiIsLicenseKey(tmp)) + { + RPC_TEST t; + + Disable(hWnd, IDOK); + Disable(hWnd, IDCANCEL); + + Zero(&t, sizeof(t)); + StrCpy(t.StrValue, sizeof(t.StrValue), tmp); + + if (CALL(hWnd, ScAddLicenseKey(s->Rpc, &t)) == false) + { + FocusEx(hWnd, B_KEY6); + } + else + { + EndDialog(hWnd, true); + } + + Enable(hWnd, IDOK); + Enable(hWnd, IDCANCEL); + } +} + +// Shift treatment of text input +void SmLicenseAddDlgShiftTextItem(HWND hWnd, UINT id1, UINT id2, UINT *next_focus) +{ + char *s; + // Validate arguments + if (hWnd == NULL || next_focus == NULL) + { + return; + } + + s = GetTextA(hWnd, id1); + if (StrLen(s) >= 6) + { + char *s2 = CopyStr(s); + char tmp[MAX_SIZE]; + s2[6] = 0; + SetTextA(hWnd, id1, s2); + Free(s2); + + if (id2 != 0) + { + GetTxtA(hWnd, id2, tmp, sizeof(tmp)); + + StrCat(tmp, sizeof(tmp), s + 6); + ReplaceStrEx(tmp, sizeof(tmp), tmp, "-", "", false); + + SetTextA(hWnd, id2, tmp); + + *next_focus = id2; + } + else + { + *next_focus = IDOK; + } + } + + Free(s); +} + +// Make a text from the input data +void SmLicenseAddDlgGetText(HWND hWnd, char *str, UINT size) +{ + char *k1, *k2, *k3, *k4, *k5, *k6; + // Validate arguments + if (hWnd == NULL || str == NULL) + { + return; + } + + k1 = GetTextA(hWnd, B_KEY1); + k2 = GetTextA(hWnd, B_KEY2); + k3 = GetTextA(hWnd, B_KEY3); + k4 = GetTextA(hWnd, B_KEY4); + k5 = GetTextA(hWnd, B_KEY5); + k6 = GetTextA(hWnd, B_KEY6); + + Format(str, size, "%s-%s-%s-%s-%s-%s", k1, k2, k3, k4, k5, k6); + + Free(k1); + Free(k2); + Free(k3); + Free(k4); + Free(k5); + Free(k6); +} + +// License addition dialog update +void SmLicenseAddDlgUpdate(HWND hWnd, SM_SERVER *s) +{ + UINT next_focus = 0; + char tmp[MAX_SIZE]; + // Validate arguments + if (s == NULL || hWnd == NULL) + { + return; + } + + SmLicenseAddDlgShiftTextItem(hWnd, B_KEY1, B_KEY2, &next_focus); + SmLicenseAddDlgShiftTextItem(hWnd, B_KEY2, B_KEY3, &next_focus); + SmLicenseAddDlgShiftTextItem(hWnd, B_KEY3, B_KEY4, &next_focus); + SmLicenseAddDlgShiftTextItem(hWnd, B_KEY4, B_KEY5, &next_focus); + SmLicenseAddDlgShiftTextItem(hWnd, B_KEY5, B_KEY6, &next_focus); + SmLicenseAddDlgShiftTextItem(hWnd, B_KEY6, 0, &next_focus); + + if ((IsFocus(hWnd, B_KEY1) && GetTextLen(hWnd, B_KEY1, true) <= 5) || + (IsFocus(hWnd, B_KEY2) && GetTextLen(hWnd, B_KEY2, true) <= 5) || + (IsFocus(hWnd, B_KEY3) && GetTextLen(hWnd, B_KEY3, true) <= 5) || + (IsFocus(hWnd, B_KEY4) && GetTextLen(hWnd, B_KEY4, true) <= 5) || + (IsFocus(hWnd, B_KEY5) && GetTextLen(hWnd, B_KEY5, true) <= 5) || + (IsFocus(hWnd, B_KEY6) && GetTextLen(hWnd, B_KEY6, true) <= 5)) + { + next_focus = 0; + } + + if (next_focus != 0) + { + Focus(hWnd, next_focus); + } + + SmLicenseAddDlgGetText(hWnd, tmp, sizeof(tmp)); + + SetEnable(hWnd, IDOK, LiIsLicenseKey(tmp)); +} + +// License addition dialog initialization +void SmLicenseAddDlgInit(HWND hWnd, SM_SERVER *s) +{ + HFONT h; + // Validate arguments + if (hWnd == NULL || s == NULL) + { + return; + } + + h = GetFont("Arial", 10, true, false, false, false); + SetFont(hWnd, B_KEY1, h); + SetFont(hWnd, B_KEY2, h); + SetFont(hWnd, B_KEY3, h); + SetFont(hWnd, B_KEY4, h); + SetFont(hWnd, B_KEY5, h); + SetFont(hWnd, B_KEY6, h); + + DlgFont(hWnd, S_INFO, 10, true); + + SmLicenseAddDlgUpdate(hWnd, s); +} + +// License addition dialog +UINT SmLicenseAddDlg(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param) +{ + SM_SERVER *s = (SM_SERVER *)param; + // Validate arguments + if (hWnd == NULL) + { + return 0; + } + + switch (msg) + { + case WM_INITDIALOG: + SmLicenseAddDlgInit(hWnd, s); + break; + + case WM_COMMAND: + switch (LOWORD(wParam)) + { + case B_KEY1: + case B_KEY2: + case B_KEY3: + case B_KEY4: + case B_KEY5: + case B_KEY6: + switch (HIWORD(wParam)) + { + case EN_CHANGE: + SmLicenseAddDlgUpdate(hWnd, s); + + switch (LOWORD(wParam)) + { + case B_KEY2: + if (GetTextLen(hWnd, B_KEY2, true) == 0) + { + FocusEx(hWnd, B_KEY1); + } + break; + case B_KEY3: + if (GetTextLen(hWnd, B_KEY3, true) == 0) + { + FocusEx(hWnd, B_KEY2); + } + break; + case B_KEY4: + if (GetTextLen(hWnd, B_KEY4, true) == 0) + { + FocusEx(hWnd, B_KEY3); + } + break; + case B_KEY5: + if (GetTextLen(hWnd, B_KEY5, true) == 0) + { + FocusEx(hWnd, B_KEY4); + } + break; + case B_KEY6: + if (GetTextLen(hWnd, B_KEY6, true) == 0) + { + FocusEx(hWnd, B_KEY5); + } + break; + } + break; + } + break; + } + + switch (wParam) + { + case IDOK: + SmLicenseAddDlgOnOk(hWnd, s); + break; + + case IDCANCEL: + Close(hWnd); + break; + } + break; + + case WM_CLOSE: + EndDialog(hWnd, 0); + break; + } + + return 0; +} + +// Add a license +bool SmLicenseAdd(HWND hWnd, SM_SERVER *s) +{ + // Validate arguments + if (s == NULL) + { + return false; + } + + return Dialog(hWnd, D_SM_LICENSE_ADD, SmLicenseAddDlg, s); +} + +// License dialog initialization +void SmLicenseDlgInit(HWND hWnd, SM_SERVER *s) +{ + // Validate arguments + if (hWnd == NULL || s == NULL) + { + return; + } + + SetIcon(hWnd, 0, ICO_CERT); + + DlgFont(hWnd, S_BOLD, 0, true); + DlgFont(hWnd, S_BOLD2, 0, true); + + LvInit(hWnd, L_LIST); + LvSetStyle(hWnd, L_LIST, LVS_EX_GRIDLINES); + LvInsertColumn(hWnd, L_LIST, 0, _UU("SM_LICENSE_COLUMN_1"), 50); + LvInsertColumn(hWnd, L_LIST, 1, _UU("SM_LICENSE_COLUMN_2"), 100); + LvInsertColumn(hWnd, L_LIST, 2, _UU("SM_LICENSE_COLUMN_3"), 290); + LvInsertColumn(hWnd, L_LIST, 3, _UU("SM_LICENSE_COLUMN_4"), 150); + LvInsertColumn(hWnd, L_LIST, 4, _UU("SM_LICENSE_COLUMN_5"), 120); + LvInsertColumn(hWnd, L_LIST, 5, _UU("SM_LICENSE_COLUMN_6"), 250); + LvInsertColumn(hWnd, L_LIST, 6, _UU("SM_LICENSE_COLUMN_7"), 100); + LvInsertColumn(hWnd, L_LIST, 7, _UU("SM_LICENSE_COLUMN_8"), 100); + LvInsertColumn(hWnd, L_LIST, 8, _UU("SM_LICENSE_COLUMN_9"), 100); + + LvInitEx(hWnd, L_STATUS, true); + LvInsertColumn(hWnd, L_STATUS, 0, _UU("SM_STATUS_COLUMN_1"), 100); + LvInsertColumn(hWnd, L_STATUS, 1, _UU("SM_STATUS_COLUMN_2"), 100); + + SmLicenseDlgRefresh(hWnd, s); +} + +// License dialog update +void SmLicenseDlgRefresh(HWND hWnd, SM_SERVER *s) +{ + RPC_ENUM_LICENSE_KEY t; + RPC_LICENSE_STATUS st; + UINT i; + wchar_t tmp[MAX_SIZE]; + LVB *b; + // Validate arguments + if (hWnd == NULL || s == NULL) + { + return; + } + + Zero(&t, sizeof(t)); + + if (CALL(hWnd, ScEnumLicenseKey(s->Rpc, &t)) == false) + { + Close(hWnd); + return; + } + + b = LvInsertStart(); + + for (i = 0;i < t.NumItem;i++) + { + wchar_t tmp1[32], tmp2[LICENSE_KEYSTR_LEN + 1], tmp3[LICENSE_MAX_PRODUCT_NAME_LEN + 1], + *tmp4, tmp5[128], tmp6[LICENSE_LICENSEID_STR_LEN + 1], tmp7[64], + tmp8[64], tmp9[64]; + RPC_ENUM_LICENSE_KEY_ITEM *e = &t.Items[i]; + + UniToStru(tmp1, e->Id); + StrToUni(tmp2, sizeof(tmp2), e->LicenseKey); + StrToUni(tmp3, sizeof(tmp3), e->LicenseName); + tmp4 = LiGetLicenseStatusStr(e->Status); + if (e->Expires == 0) + { + UniStrCpy(tmp5, sizeof(tmp5), _UU("SM_LICENSE_NO_EXPIRES")); + } + else + { + GetDateStrEx64(tmp5, sizeof(tmp5), e->Expires, NULL); + } + StrToUni(tmp6, sizeof(tmp6), e->LicenseId); + UniToStru(tmp7, e->ProductId); + UniFormat(tmp8, sizeof(tmp8), L"%I64u", e->SystemId); + UniToStru(tmp9, e->SerialId); + + LvInsertAdd(b, + e->Status == LICENSE_STATUS_OK ? ICO_PASS : ICO_DISCARD, + (void *)e->Id, 9, + tmp1, tmp2, tmp3, tmp4, tmp5, tmp6, tmp7, tmp8, tmp9); + } + + LvInsertEnd(b, hWnd, L_LIST); + + FreeRpcEnumLicenseKey(&t); + + Zero(&st, sizeof(st)); + + if (CALL(hWnd, ScGetLicenseStatus(s->Rpc, &st)) == false) + { + Close(hWnd); + return; + } + + b = LvInsertStart(); + + if (st.EditionId == LICENSE_EDITION_VPN3_NO_LICENSE) + { + LvInsertAdd(b, 0, NULL, 2, _UU("SM_NO_LICENSE_COLUMN"), _UU("SM_NO_LICENSE")); + } + else + { + // Product edition name + StrToUni(tmp, sizeof(tmp), st.EditionStr); + LvInsertAdd(b, 0, NULL, 2, _UU("SM_LICENSE_STATUS_EDITION"), tmp); + + // Release date + if (st.ReleaseDate != 0) + { + GetDateStrEx64(tmp, sizeof(tmp), st.ReleaseDate, NULL); + LvInsertAdd(b, 0, NULL, 2, _UU("SM_LICENSE_STATUS_RELEASE"), tmp); + } + + // Current system ID + UniFormat(tmp, sizeof(tmp), L"%I64u", st.SystemId); + LvInsertAdd(b, 0, NULL, 2, _UU("SM_LICENSE_STATUS_SYSTEM_ID"), tmp); + + // Expiration date of the current product license + if (st.SystemExpires == 0) + { + UniStrCpy(tmp, sizeof(tmp), _UU("SM_LICENSE_NO_EXPIRES")); + } + else + { + GetDateStrEx64(tmp, sizeof(tmp), st.SystemExpires, NULL); + } + LvInsertAdd(b, 0, NULL, 2, _UU("SM_LICENSE_STATUS_EXPIRES"), tmp); + + // Subscription (support) contract + if (st.NeedSubscription == false) + { + UniStrCpy(tmp, sizeof(tmp), _UU("SM_LICENSE_STATUS_SUBSCRIPTION_NONEED")); + } + else + { + if (st.SubscriptionExpires == 0) + { + UniStrCpy(tmp, sizeof(tmp), _UU("SM_LICENSE_STATUS_SUBSCRIPTION_NONE")); + } + else + { + wchar_t dtstr[MAX_PATH]; + + GetDateStrEx64(dtstr, sizeof(dtstr), st.SubscriptionExpires, NULL); + + UniFormat(tmp, sizeof(tmp), + st.IsSubscriptionExpired ? _UU("SM_LICENSE_STATUS_SUBSCRIPTION_EXPIRED") : _UU("SM_LICENSE_STATUS_SUBSCRIPTION_VALID"), + dtstr); + } + } + LvInsertAdd(b, 0, NULL, 2, _UU("SM_LICENSE_STATUS_SUBSCRIPTION"), tmp); + + if (st.NeedSubscription == false && st.SubscriptionExpires != 0) + { + wchar_t dtstr[MAX_PATH]; + + GetDateStrEx64(dtstr, sizeof(dtstr), st.SubscriptionExpires, NULL); + + LvInsertAdd(b, 0, NULL, 2, _UU("SM_LICENSE_STATUS_SUBSCRIPTION_BUILD_STR"), tmp); + } + + if (st.NeedSubscription && st.SubscriptionExpires != 0) + { + wchar_t dtstr[MAX_PATH]; + + GetDateStrEx64(dtstr, sizeof(dtstr), st.SubscriptionExpires, NULL); + + UniFormat(tmp, sizeof(tmp), _UU("SM_LICENSE_STATUS_SUBSCRIPTION_BUILD_STR"), dtstr); + + LvInsertAdd(b, 0, NULL, 2, _UU("SM_LICENSE_STATUS_SUBSCRIPTION_BUILD"), tmp); + } + + if (GetCapsBool(s->CapsList, "b_vpn3")) + { + // Maximum number of users + if (st.NumUserCreationLicense == INFINITE) + { + UniStrCpy(tmp, sizeof(tmp), _UU("SM_LICENSE_INFINITE")); + } + else + { + UniToStru(tmp, st.NumUserCreationLicense); + } + LvInsertAdd(b, 0, NULL, 2, _UU("SM_LICENSE_NUM_USER"), tmp); + } + + // Available number of concurrent client connections + if (st.NumClientConnectLicense == INFINITE) + { + UniStrCpy(tmp, sizeof(tmp), _UU("SM_LICENSE_INFINITE")); + } + else + { + UniToStru(tmp, st.NumClientConnectLicense); + } + LvInsertAdd(b, 0, NULL, 2, _UU("SM_LICENSE_NUM_CLIENT"), tmp); + + // Available number of concurrent Bridge connections + if (st.NumBridgeConnectLicense == INFINITE) + { + UniStrCpy(tmp, sizeof(tmp), _UU("SM_LICENSE_INFINITE")); + } + else + { + UniToStru(tmp, st.NumBridgeConnectLicense); + } + LvInsertAdd(b, 0, NULL, 2, _UU("SM_LICENSE_NUM_BRIDGE"), tmp); + + // Availability of enterprise features + LvInsertAdd(b, 0, NULL, 2, _UU("SM_LICENSE_STATUS_ENTERPRISE"), + st.AllowEnterpriseFunction ? _UU("SM_LICENSE_STATUS_ENTERPRISE_YES") : _UU("SM_LICENSE_STATUS_ENTERPRISE_NO")); + } + + LvInsertEnd(b, hWnd, L_STATUS); + + if (LvNum(hWnd, L_STATUS) >= 1) + { + LvAutoSize(hWnd, L_STATUS); + } + + SmLicenseDlgUpdate(hWnd, s); +} + +// License dialog control update +void SmLicenseDlgUpdate(HWND hWnd, SM_SERVER *s) +{ + bool b = false; + // Validate arguments + if (hWnd == NULL || s == NULL) + { + return; + } + + b = LvIsSingleSelected(hWnd, L_LIST); + + SetEnable(hWnd, B_DEL, b); + SetEnable(hWnd, IDOK, b); +} + +// License dialog +UINT SmLicenseDlg(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param) +{ + SM_SERVER *s = (SM_SERVER *)param; + NMHDR *n; + // Validate arguments + if (hWnd == NULL) + { + return 0; + } + + switch (msg) + { + case WM_INITDIALOG: + SmLicenseDlgInit(hWnd, s); + break; + + case WM_NOTIFY: + n = (NMHDR *)lParam; + switch (n->code) + { + case LVN_ITEMCHANGED: + switch (n->idFrom) + { + case L_LIST: + case L_STATUS: + SmLicenseDlgUpdate(hWnd, s); + break; + } + break; + } + break; + + case WM_COMMAND: + switch (wParam) + { + case IDOK: + if (IsEnable(hWnd, IDOK)) + { + UINT i = LvGetSelected(hWnd, L_LIST); + + if (i != INFINITE) + { + char *s = LvGetStrA(hWnd, L_LIST, i, 1); + char tmp[MAX_SIZE]; + + Format(tmp, sizeof(tmp), _SS("LICENSE_SUPPORT_URL"), s); + ShellExecute(hWnd, "open", tmp, NULL, NULL, SW_SHOW); + + Free(s); + } + } + break; + + case B_OBTAIN: + ShellExecute(hWnd, "open", _SS("LICENSE_INFO_URL"), NULL, NULL, SW_SHOW); + break; + + case B_ADD: + if (SmLicenseAdd(hWnd, s)) + { + SmLicenseDlgRefresh(hWnd, s); + } + break; + + case B_DEL: + if (IsEnable(hWnd, B_DEL)) + { + UINT id = (UINT)LvGetParam(hWnd, L_LIST, LvGetSelected(hWnd, L_LIST)); + + if (id != 0) + { + if (MsgBox(hWnd, MB_ICONQUESTION | MB_YESNO | MB_DEFBUTTON2, _UU("SM_LICENSE_DELETE_MSG")) == IDYES) + { + RPC_TEST t; + + Zero(&t, sizeof(t)); + t.IntValue = id; + + if (CALL(hWnd, ScDelLicenseKey(s->Rpc, &t))) + { + SmLicenseDlgRefresh(hWnd, s); + } + } + } + } + break; + + case IDCANCEL: + Close(hWnd); + break; + } + break; + + case WM_CLOSE: + EndDialog(hWnd, 0); + break; + } + + LvStandardHandler(hWnd, msg, wParam, lParam, L_LIST); + + return 0; +} + +// Add or Remove license +void SmLicense(HWND hWnd, SM_SERVER *s) +{ + // Validate arguments + if (s == NULL) + { + return; + } + + Dialog(hWnd, D_SM_LICENSE, SmLicenseDlg, s); + + FreeCapsList(s->CapsList); + s->CapsList = ScGetCapsEx(s->Rpc); +} + +// Log storing procedure +UINT SmSaveLogProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param) +{ + SM_READ_LOG_FILE *p = (SM_READ_LOG_FILE *)param; + // Validate arguments + if (hWnd == NULL) + { + return 0; + } + + switch (msg) + { + case WM_INITDIALOG: + FormatText(hWnd, S_INFO, p->filepath); + break; + + case WM_COMMAND: + switch (wParam) + { + case IDOK: + case B_SAVE: + if (p->Buffer != NULL) + { + char filename[MAX_PATH]; + + Format(filename, sizeof(filename), "%s_%s", p->server_name, p->filepath); + ConvertSafeFileName(filename, sizeof(filename), filename); + + if (wParam == IDOK) + { + // Open with an editor + char fullpath[MAX_PATH]; + + Format(fullpath, sizeof(fullpath), "%s\\%s", + MsGetMyTempDir(), filename); + + if (DumpBuf(p->Buffer, fullpath) == false) + { + MsgBoxEx(hWnd, MB_ICONSTOP, _UU("SM_READ_SAVE_TMP_FAILED"), + fullpath); + } + else + { + if (((UINT)ShellExecute(hWnd, "open", fullpath, NULL, NULL, SW_SHOWNORMAL)) > 32) + { + EndDialog(hWnd, true); + } + else + { + MsgBoxEx(hWnd, MB_ICONEXCLAMATION, _UU("SM_READ_SAVE_OPEN_ERROR"), fullpath); + } + } + } + else + { + // Save to a file + wchar_t def[MAX_PATH]; + wchar_t *uni_path; + + StrToUni(def, sizeof(def), filename); + + uni_path = SaveDlg(hWnd, _UU("SM_READ_SAVE_DLG_FILTER"), _UU("SM_READ_SAVE_DLG_TITLE"), + def, L".log"); + + if (uni_path != NULL) + { + char path[MAX_PATH]; + + UniToStr(path, sizeof(path), uni_path); + Free(uni_path); + + if (DumpBuf(p->Buffer, path) == false) + { + MsgBox(hWnd, MB_ICONSTOP, _UU("SM_READ_SAVE_FAILED")); + } + else + { + EndDialog(hWnd, true); + } + } + } + } + break; + + case IDCANCEL: + Close(hWnd); + break; + } + break; + + case WM_CLOSE: + EndDialog(hWnd, false); + break; + } + + return 0; +} + +// Download callback procedure +bool SmReadLogFileProc(DOWNLOAD_PROGRESS *g) +{ + wchar_t tmp[MAX_SIZE]; + char size1[64], size2[64]; + SM_READ_LOG_FILE *p; + HWND hWnd; + // Validate arguments + if (g == NULL) + { + return false; + } + + p = (SM_READ_LOG_FILE *)g->Param; + hWnd = p->hWnd; + + SetPos(hWnd, P_PROGRESS, g->ProgressPercent); + + ToStrByte(size1, sizeof(size1), g->CurrentSize); + ToStrByte(size2, sizeof(size2), g->TotalSize); + UniFormat(tmp, sizeof(tmp), _UU("SM_READ_LOG_FILE_INFO_2"), size2, size1); + + SetText(hWnd, S_INFO, tmp); + + DoEvents(hWnd); + + return p->cancel_flag ? false : true; +} + +// Log file download dialog procedure +UINT SmReadLogFile(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param) +{ + SM_READ_LOG_FILE *p = (SM_READ_LOG_FILE *)param; + BUF *buf; + // Validate arguments + if (hWnd == NULL) + { + return 0; + } + + switch (msg) + { + case WM_INITDIALOG: + p->hWnd = hWnd; + SetFont(hWnd, S_INFO, Font(11, true)); + SetText(hWnd, S_INFO, _UU("SM_READ_LOG_FILE_INFO_1")); + DisableClose(hWnd); + FormatText(hWnd, S_INFO2, p->filepath); + SetRange(hWnd, P_PROGRESS, 0, 100); + + SetTimer(hWnd, 1, 100, NULL); + break; + + case WM_TIMER: + switch (wParam) + { + case 1: + KillTimer(hWnd, 1); + buf = DownloadFileFromServer(p->s->Rpc, p->server_name, p->filepath, p->totalsize, SmReadLogFileProc, p); + if (buf == NULL) + { + if (p->cancel_flag == false) + { + // Download failure + MsgBox(hWnd, MB_ICONSTOP, _UU("SM_READ_LOG_FILE_ERROR")); + } + EndDialog(hWnd, false); + } + else + { + // Download success + p->Buffer = buf; + Dialog(hWnd, D_SM_SAVE_LOG, SmSaveLogProc, p); + FreeBuf(buf); + EndDialog(hWnd, true); + } + break; + } + break; + + case WM_COMMAND: + switch (wParam) + { + case IDCANCEL: + p->cancel_flag = true; + break; + } + break; + } + + return 0; +} + +// Start the download of the log file +void SmLogFileStartDownload(HWND hWnd, SM_SERVER *s, char *server_name, char *filepath, UINT totalsize) +{ + SM_READ_LOG_FILE p; + // Validate arguments + if (hWnd == NULL || server_name == NULL || filepath == NULL || totalsize == 0) + { + return; + } + + Zero(&p, sizeof(p)); + p.filepath = filepath; + p.s = s; + p.server_name = server_name; + p.totalsize = totalsize; + + Dialog(hWnd, D_SM_READ_LOG_FILE, SmReadLogFile, &p); +} + +// Initialize the dialog +void SmLogFileDlgInit(HWND hWnd, SM_SERVER *p) +{ + // Validate arguments + if (hWnd == NULL || p == NULL) + { + return; + } + + SetIcon(hWnd, 0, ICO_LOG2); + + LvInit(hWnd, L_LIST); + + LvInsertColumn(hWnd, L_LIST, 0, _UU("SM_LOG_FILE_COLUMN_1"), 250); + LvInsertColumn(hWnd, L_LIST, 1, _UU("SM_LOG_FILE_COLUMN_2"), 100); + LvInsertColumn(hWnd, L_LIST, 2, _UU("SM_LOG_FILE_COLUMN_3"), 130); + LvInsertColumn(hWnd, L_LIST, 3, _UU("SM_LOG_FILE_COLUMN_4"), 110); + + SmLogFileDlgRefresh(hWnd, p); +} + +// Dialog content update +void SmLogFileDlgRefresh(HWND hWnd, SM_SERVER *p) +{ + UINT i; + LVB *v; + RPC_ENUM_LOG_FILE t; + // Validate arguments + if (hWnd == NULL || p == NULL) + { + return; + } + + Zero(&t, sizeof(t)); + if (CALL(hWnd, ScEnumLogFile(p->Rpc, &t)) == false) + { + Close(hWnd); + return; + } + + v = LvInsertStart(); + + for (i = 0;i < t.NumItem;i++) + { + RPC_ENUM_LOG_FILE_ITEM *e = &t.Items[i]; + wchar_t tmp1[MAX_PATH], tmp2[128], tmp3[128], tmp4[MAX_HOST_NAME_LEN + 1]; + char tmp[MAX_SIZE]; + + StrToUni(tmp1, sizeof(tmp1), e->FilePath); + + ToStrByte(tmp, sizeof(tmp), e->FileSize); + StrToUni(tmp2, sizeof(tmp2), tmp); + + GetDateTimeStr64Uni(tmp3, sizeof(tmp3), SystemToLocal64(e->UpdatedTime)); + + StrToUni(tmp4, sizeof(tmp4), e->ServerName); + + LvInsertAdd(v, ICO_LOG2, (void *)e->FileSize, 4, tmp1, tmp2, tmp3, tmp4); + } + + LvInsertEndEx(v, hWnd, L_LIST, true); + + if (t.NumItem != 0) + { + LvAutoSize(hWnd, L_LIST); + } + + FreeRpcEnumLogFile(&t); + + SmLogFileDlgUpdate(hWnd, p); +} + +// Update the dialog control +void SmLogFileDlgUpdate(HWND hWnd, SM_SERVER *p) +{ + // Validate arguments + if (hWnd == NULL || p == NULL) + { + return; + } + + SetEnable(hWnd, IDOK, LvIsSingleSelected(hWnd, L_LIST)); +} + +// Log file dialog procedure +UINT SmLogFileDlgProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param) +{ + NMHDR *n; + SM_SERVER *p = (SM_SERVER *)param; + // Validate arguments + if (hWnd == NULL) + { + return 0; + } + + switch (msg) + { + case WM_INITDIALOG: + SmLogFileDlgInit(hWnd, p); + break; + + case WM_COMMAND: + switch (wParam) + { + case IDOK: + if (IsEnable(hWnd, IDOK)) + { + UINT i = LvGetSelected(hWnd, L_LIST); + if (i != INFINITE) + { + UINT size = (UINT)LvGetParam(hWnd, L_LIST, i); + char *server_name; + char *filepath; + + server_name = LvGetStrA(hWnd, L_LIST, i, 3); + filepath = LvGetStrA(hWnd, L_LIST, i, 0); + SmLogFileStartDownload(hWnd, p, server_name, filepath, size); + Free(filepath); + Free(server_name); + } + } + break; + + case IDCANCEL: + Close(hWnd); + break; + + case B_REFRESH: + SmLogFileDlgRefresh(hWnd, p); + break; + } + break; + + case WM_NOTIFY: + n = (NMHDR *)lParam; + switch (n->code) + { + case LVN_ITEMCHANGED: + switch (n->idFrom) + { + case L_LIST: + SmLogFileDlgUpdate(hWnd, p); + break; + } + break; + } + break; + + case WM_CLOSE: + EndDialog(hWnd, false); + break; + } + + LvStandardHandler(hWnd, msg, wParam, lParam, L_LIST); + + return 0; +} + +// Initialize the dialog +void SmHubEditAcDlgInit(HWND hWnd, SM_EDIT_AC *p) +{ + // Validate arguments + if (hWnd == NULL || p == NULL) + { + return; + } + + SetEnable(hWnd, R_IPV6, GetCapsBool(p->e->s->p->CapsList, "b_support_ipv6_ac")); + + if (p->id == 0) + { + UINT i, v; + + Check(hWnd, R_SINGLE, true); + Check(hWnd, R_PASS, true); + Check(hWnd, R_IPV4, true); + + v = 0; + + for (i = 0;i < LIST_NUM(p->e->AcList);i++) + { + AC *ac = LIST_DATA(p->e->AcList, i); + + v = MAX(v, ac->Priority); + } + + v += 100; + + SetInt(hWnd, E_PRIORITY, v); + } + else + { + AC *ac = GetAc(p->e->AcList, p->id); + + if (ac == NULL) + { + EndDialog(hWnd, false); + return; + } + + Check(hWnd, R_SINGLE, ac->Masked == false); + Check(hWnd, R_MASKED, ac->Masked); + Check(hWnd, R_IPV4, IsIP4(&ac->IpAddress)); + Check(hWnd, R_IPV6, IsIP6(&ac->IpAddress)); + + if (IsIP4(&ac->IpAddress)) + { + IpSet(hWnd, E_IP, IPToUINT(&ac->IpAddress)); + } + else + { + char tmp[MAX_SIZE]; + + IPToStr(tmp, sizeof(tmp), &ac->IpAddress); + SetTextA(hWnd, E_IPV6, tmp); + } + + if (ac->Masked) + { + if (IsIP4(&ac->IpAddress)) + { + IpSet(hWnd, E_MASK, IPToUINT(&ac->SubnetMask)); + } + else + { + char tmp[MAX_SIZE]; + + MaskToStrEx(tmp, sizeof(tmp), &ac->SubnetMask, false); + + if (IsNum(tmp)) + { + StrCatLeft(tmp, sizeof(tmp), "/"); + } + + SetTextA(hWnd, E_MASKV6, tmp); + } + } + + Check(hWnd, R_PASS, ac->Deny == false); + Check(hWnd, R_DENY, ac->Deny); + SetInt(hWnd, E_PRIORITY, ac->Priority); + + Free(ac); + } + + Focus(hWnd, E_IP); + + SmHubEditAcDlgUpdate(hWnd, p); +} + +// Dialog update +void SmHubEditAcDlgUpdate(HWND hWnd, SM_EDIT_AC *p) +{ + bool b = true; + char tmp[MAX_SIZE]; + // Validate arguments + if (hWnd == NULL || p == NULL) + { + return; + } + + if (IsChecked(hWnd, R_SINGLE)) + { + if (IsChecked(hWnd, R_IPV6) == false) + { + Show(hWnd, E_IP); + Hide(hWnd, E_IPV6); + + if (IpIsFilled(hWnd, E_IP) == false) + { + b = false; + } + + if (IpGet(hWnd, E_IP) == 0 || IpGet(hWnd, E_IP) == 0xffffffff) + { + b = false; + } + } + else + { + Show(hWnd, E_IPV6); + Hide(hWnd, E_IP); + + GetTxtA(hWnd, E_IPV6, tmp, sizeof(tmp)); + + if (IsStrIPv6Address(tmp) == false) + { + b = false; + } + } + + Hide(hWnd, S_MASK); + Hide(hWnd, E_MASK); + Hide(hWnd, E_MASKV6); + } + else + { + if (IsChecked(hWnd, R_IPV6) == false) + { + Show(hWnd, E_IP); + Hide(hWnd, E_IPV6); + + if (IpIsFilled(hWnd, E_IP) == false || IpIsFilled(hWnd, E_MASK) == false) + { + b = false; + } + + if (IpGet(hWnd, E_IP) == 0xffffffff) + { + b = false; + } + } + else + { + char tmp1[MAX_SIZE], tmp2[MAX_SIZE]; + + Show(hWnd, E_IPV6); + Hide(hWnd, E_IP); + + GetTxtA(hWnd, E_IPV6, tmp1, sizeof(tmp1)); + GetTxtA(hWnd, E_MASKV6, tmp2, sizeof(tmp2)); + + if (!(IsIpStr6(tmp1) && IsIpMask6(tmp2))) + { + b = false; + } + } + + Show(hWnd, S_MASK); + SetShow(hWnd, E_MASK, !IsChecked(hWnd, R_IPV6)); + SetShow(hWnd, E_MASKV6, IsChecked(hWnd, R_IPV6)); + } + + if (GetInt(hWnd, E_PRIORITY) == 0) + { + b = false; + } + + SetIcon(hWnd, S_ICON, IsChecked(hWnd, R_PASS) ? ICO_INTERNET : ICO_INTERNET_X); + + SetEnable(hWnd, IDOK, b); +} + +// OK button is clicked in the dialog +void SmHubEditAcDlgOnOk(HWND hWnd, SM_EDIT_AC *p) +{ + AC ac; + char tmp[MAX_SIZE]; + // Validate arguments + if (hWnd == NULL || p == NULL) + { + return; + } + + Zero(&ac, sizeof(ac)); + ac.Deny = IsChecked(hWnd, R_DENY); + ac.Priority = GetInt(hWnd, E_PRIORITY); + + if (IsChecked(hWnd, R_IPV6) == false) + { + UINTToIP(&ac.IpAddress, IpGet(hWnd, E_IP)); + } + else + { + GetTxtA(hWnd, E_IPV6, tmp, sizeof(tmp)); + + StrToIP6(&ac.IpAddress, tmp); + } + + ac.Masked = IsChecked(hWnd, R_MASKED); + + if (ac.Masked) + { + if (IsChecked(hWnd, R_IPV6) == false) + { + UINTToIP(&ac.SubnetMask, IpGet(hWnd, E_MASK)); + } + else + { + GetTxtA(hWnd, E_MASKV6, tmp, sizeof(tmp)); + + StrToMask6(&ac.SubnetMask, tmp); + } + } + + if (p->id != 0) + { + SetAc(p->e->AcList, p->id, &ac); + } + else + { + AddAc(p->e->AcList, &ac); + } + + EndDialog(hWnd, true); +} + +// AC edit dialog +UINT SmHubEditAcDlgProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param) +{ + SM_EDIT_AC *p = (SM_EDIT_AC *)param; + // Validate arguments + if (hWnd == NULL) + { + return 0; + } + + switch (msg) + { + case WM_INITDIALOG: + SmHubEditAcDlgInit(hWnd, p); + break; + + case WM_COMMAND: + switch (LOWORD(wParam)) + { + case R_SINGLE: + case R_MASKED: + case E_IP: + case E_MASK: + case R_PASS: + case R_DENY: + case E_PRIORITY: + case R_IPV4: + case R_IPV6: + case E_IPV6: + case E_MASKV6: + SmHubEditAcDlgUpdate(hWnd, p); + break; + } + + switch (wParam) + { + case R_IPV4: + case R_IPV6: + case R_SINGLE: + case R_MASKED: + if (IsChecked(hWnd, R_IPV6) == false) + { + if (IpIsFilled(hWnd, E_IP)) + { + Focus(hWnd, E_MASK); + } + else + { + Focus(hWnd, E_IP); + } + } + else + { + char tmp[MAX_SIZE]; + + GetTxtA(hWnd, E_IPV6, tmp, sizeof(tmp)); + + if (IsStrIPv6Address(tmp)) + { + FocusEx(hWnd, E_MASKV6); + } + else + { + FocusEx(hWnd, E_IPV6); + } + } + break; + + case IDOK: + SmHubEditAcDlgOnOk(hWnd, p); + break; + + case IDCANCEL: + Close(hWnd); + break; + } + break; + + case WM_CLOSE: + EndDialog(hWnd, false); + break; + } + + return 0; +} + +// Initialize the dialog +void SmHubAcDlgInit(HWND hWnd, SM_EDIT_AC_LIST *p) +{ + // Validate arguments + if (hWnd == NULL || p == NULL) + { + return; + } + + SetIcon(hWnd, 0, ICO_INTERNET); + + FormatText(hWnd, S_TITLE, p->s->HubName); + + LvInit(hWnd, L_LIST); + LvInsertColumn(hWnd, L_LIST, 0, _UU("SM_AC_COLUMN_1"), 40); + LvInsertColumn(hWnd, L_LIST, 1, _UU("SM_AC_COLUMN_2"), 80); + LvInsertColumn(hWnd, L_LIST, 2, _UU("SM_AC_COLUMN_3"), 90); + LvInsertColumn(hWnd, L_LIST, 3, _UU("SM_AC_COLUMN_4"), 170); + + SmHubAcDlgRefresh(hWnd, p); +} + +// Update the dialog control +void SmHubAcDlgUpdate(HWND hWnd, SM_EDIT_AC_LIST *p) +{ + bool b; + // Validate arguments + if (hWnd == NULL || p == NULL) + { + return; + } + + b = LvIsSingleSelected(hWnd, L_LIST); + + SetEnable(hWnd, IDOK, b); + SetEnable(hWnd, B_DELETE, b); +} + +// Dialog content update +void SmHubAcDlgRefresh(HWND hWnd, SM_EDIT_AC_LIST *p) +{ + UINT i; + LVB *v; + // Validate arguments + if (hWnd == NULL || p == NULL) + { + return; + } + + v = LvInsertStart(); + + for (i = 0;i < LIST_NUM(p->AcList);i++) + { + wchar_t tmp1[32], *tmp2, tmp3[MAX_SIZE], tmp4[32]; + char *tmp_str; + AC *ac = LIST_DATA(p->AcList, i); + + UniToStru(tmp1, ac->Id); + tmp2 = ac->Deny ? _UU("SM_AC_DENY") : _UU("SM_AC_PASS"); + tmp_str = GenerateAcStr(ac); + StrToUni(tmp3, sizeof(tmp3), tmp_str); + + Free(tmp_str); + + UniToStru(tmp4, ac->Priority); + + LvInsertAdd(v, ac->Deny ? ICO_INTERNET_X : ICO_INTERNET, + (void *)ac->Id, 4, tmp1, tmp4, tmp2, tmp3); + } + + LvInsertEnd(v, hWnd, L_LIST); + LvSortEx(hWnd, L_LIST, 0, false, true); + + + SmHubAcDlgUpdate(hWnd, p); +} + +// Access control list editing dialog +UINT SmHubAcDlgProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param) +{ + NMHDR *n; + SM_EDIT_AC_LIST *p = (SM_EDIT_AC_LIST *)param; + // Validate arguments + if (hWnd == NULL) + { + return 0; + } + + switch (msg) + { + case WM_INITDIALOG: + SmHubAcDlgInit(hWnd, p); + break; + + case WM_COMMAND: + switch (wParam) + { + case IDOK: + if (IsEnable(hWnd, IDOK)) + { + SM_EDIT_AC s; + Zero(&s, sizeof(s)); + + s.e = p; + s.id = (UINT)LvGetParam(hWnd, L_LIST, LvGetSelected(hWnd, L_LIST)); + + if (Dialog(hWnd, D_SM_AC, SmHubEditAcDlgProc, &s)) + { + SmHubAcDlgRefresh(hWnd, p); + } + } + break; + + case B_ADD: + if (IsEnable(hWnd, B_ADD)) + { + SM_EDIT_AC s; + Zero(&s, sizeof(s)); + + s.e = p; + + if (Dialog(hWnd, D_SM_AC, SmHubEditAcDlgProc, &s)) + { + SmHubAcDlgRefresh(hWnd, p); + } + } + break; + + case B_DELETE: + if (IsEnable(hWnd, B_DELETE)) + { + UINT id = (UINT)LvGetParam(hWnd, L_LIST, LvGetSelected(hWnd, L_LIST)); + + if (DelAc(p->AcList, id)) + { + SmHubAcDlgRefresh(hWnd, p); + } + } + break; + + case B_SAVE: + if (IsEnable(hWnd, B_SAVE)) + { + RPC_AC_LIST t; + + Zero(&t, sizeof(t)); + StrCpy(t.HubName, sizeof(t.HubName), p->s->HubName); + t.o = CloneAcList(p->AcList); + + if (CALL(hWnd, ScSetAcList(p->s->p->Rpc, &t))) + { + EndDialog(hWnd, true); + } + + FreeRpcAcList(&t); + } + break; + + case IDCANCEL: + Close(hWnd); + break; + } + break; + + case WM_NOTIFY: + n = (NMHDR *)lParam; + switch (n->code) + { + case LVN_ITEMCHANGED: + switch (n->idFrom) + { + case L_LIST: + SmHubAcDlgUpdate(hWnd, p); + break; + } + break; + } + break; + + case WM_CLOSE: + EndDialog(hWnd, false); + break; + } + + LvStandardHandler(hWnd, msg, wParam, lParam, L_LIST); + + return 0; +} + +// Access control list editing +void SmHubAc(HWND hWnd, SM_EDIT_HUB *s) +{ + SM_EDIT_AC_LIST p; + RPC_AC_LIST t; + // Validate arguments + if (hWnd == NULL || s == NULL) + { + return; + } + + Zero(&t, sizeof(t)); + StrCpy(t.HubName, sizeof(t.HubName), s->HubName); + + if (CALL(hWnd, ScGetAcList(s->p->Rpc, &t)) == false) + { + return; + } + + Zero(&p, sizeof(p)); + p.s = s; + p.AcList = CloneAcList(t.o); + + FreeRpcAcList(&t); + + Dialog(hWnd, D_SM_AC_LIST, SmHubAcDlgProc, &p); + + FreeAcList(p.AcList); +} + +// Initialize the dialog +void SmEditCrlDlgInit(HWND hWnd, SM_EDIT_CRL *c) +{ + // Validate arguments + if (hWnd == NULL || c == NULL) + { + return; + } + + if (c->NewCrl == false) + { + RPC_CRL t; + CRL *crl; + + Zero(&t, sizeof(t)); + StrCpy(t.HubName, sizeof(t.HubName), c->s->HubName); + t.Key = c->Key; + + if (CALL(hWnd, ScGetCrl(c->s->Rpc, &t)) == false) + { + EndDialog(hWnd, false); + return; + } + + crl = t.Crl; + + SmEditCrlDlgSetName(hWnd, crl->Name); + SmEditCrlDlgSetSerial(hWnd, crl->Serial); + SmEditCrlDlgSetHash(hWnd, crl->DigestMD5, crl->DigestSHA1); + + FreeRpcCrl(&t); + } + + SmEditCrlDlgUpdate(hWnd, c); +} + +// Update the controls +void SmEditCrlDlgUpdate(HWND hWnd, SM_EDIT_CRL *c) +{ + bool b = true; + // Validate arguments + if (hWnd == NULL || c == NULL) + { + return; + } + + SetEnable(hWnd, E_CN, IsChecked(hWnd, R_CN)); + SetEnable(hWnd, E_O, IsChecked(hWnd, R_O)); + SetEnable(hWnd, E_OU, IsChecked(hWnd, R_OU)); + SetEnable(hWnd, E_C, IsChecked(hWnd, R_C)); + SetEnable(hWnd, E_ST, IsChecked(hWnd, R_ST)); + SetEnable(hWnd, E_L, IsChecked(hWnd, R_L)); + SetEnable(hWnd, E_SERI, IsChecked(hWnd, R_SERI)); + SetEnable(hWnd, E_MD5_HASH, IsChecked(hWnd, R_MD5_HASH)); + SetEnable(hWnd, E_SHA1_HASH, IsChecked(hWnd, R_SHA1_HASH)); + + if (IsChecked(hWnd, R_CN)) + { + if (IsEmpty(hWnd, E_CN)) + { + b = false; + } + } + + if (IsChecked(hWnd, R_O)) + { + if (IsEmpty(hWnd, E_O)) + { + b = false; + } + } + + if (IsChecked(hWnd, R_OU)) + { + if (IsEmpty(hWnd, E_OU)) + { + b = false; + } + } + + if (IsChecked(hWnd, R_C)) + { + if (IsEmpty(hWnd, E_C)) + { + b = false; + } + } + + if (IsChecked(hWnd, R_ST)) + { + if (IsEmpty(hWnd, E_ST)) + { + b = false; + } + } + + if (IsChecked(hWnd, R_L)) + { + if (IsEmpty(hWnd, E_L)) + { + b = false; + } + } + + if (IsChecked(hWnd, R_SERI)) + { + char tmp[MAX_SIZE]; + BUF *buf; + + GetTxtA(hWnd, E_SERI, tmp, sizeof(tmp)); + buf = StrToBin(tmp); + + if (buf->Size == 0) + { + b = false; + } + + FreeBuf(buf); + } + + if (IsChecked(hWnd, R_MD5_HASH)) + { + char tmp[MAX_SIZE]; + BUF *buf; + + GetTxtA(hWnd, E_MD5_HASH, tmp, sizeof(tmp)); + buf = StrToBin(tmp); + + if (buf->Size != MD5_SIZE) + { + b = false; + } + + FreeBuf(buf); + } + + if (IsChecked(hWnd, R_SHA1_HASH)) + { + char tmp[MAX_SIZE]; + BUF *buf; + + GetTxtA(hWnd, E_SHA1_HASH, tmp, sizeof(tmp)); + buf = StrToBin(tmp); + + if (buf->Size != SHA1_SIZE) + { + b = false; + } + + FreeBuf(buf); + } + + SetEnable(hWnd, IDOK, b); +} + +// On click the OK button +void SmEditCrlDlgOnOk(HWND hWnd, SM_EDIT_CRL *c) +{ + CRL *crl; + NAME *n; + RPC_CRL t; + bool empty = true; + // Validate arguments + if (hWnd == NULL || c == NULL) + { + return; + } + + crl = ZeroMalloc(sizeof(CRL)); + crl->Name = ZeroMalloc(sizeof(NAME)); + n = crl->Name; + + if (IsChecked(hWnd, R_CN)) + { + n->CommonName = GetText(hWnd, E_CN); + empty = false; + } + + if (IsChecked(hWnd, R_O)) + { + n->Organization = GetText(hWnd, E_O); + empty = false; + } + + if (IsChecked(hWnd, R_OU)) + { + n->Unit = GetText(hWnd, E_OU); + empty = false; + } + + if (IsChecked(hWnd, R_C)) + { + n->Country = GetText(hWnd, E_C); + empty = false; + } + + if (IsChecked(hWnd, R_ST)) + { + n->State = GetText(hWnd, E_ST); + empty = false; + } + + if (IsChecked(hWnd, R_L)) + { + n->Local = GetText(hWnd, E_L); + empty = false; + } + + if (IsChecked(hWnd, R_SERI)) + { + char tmp[MAX_SIZE]; + BUF *b; + + GetTxtA(hWnd, E_SERI, tmp, sizeof(tmp)); + b = StrToBin(tmp); + + if (b != NULL && b->Size >= 1) + { + crl->Serial = NewXSerial(b->Buf, b->Size); + } + + FreeBuf(b); + + empty = false; + } + + if (IsChecked(hWnd, R_MD5_HASH)) + { + char tmp[MAX_SIZE]; + BUF *b; + + GetTxtA(hWnd, E_MD5_HASH, tmp, sizeof(tmp)); + b = StrToBin(tmp); + + if (b != NULL && b->Size == MD5_SIZE) + { + Copy(crl->DigestMD5, b->Buf, MD5_SIZE); + } + + FreeBuf(b); + + empty = false; + } + + if (IsChecked(hWnd, R_SHA1_HASH)) + { + char tmp[MAX_SIZE]; + BUF *b; + + GetTxtA(hWnd, E_SHA1_HASH, tmp, sizeof(tmp)); + b = StrToBin(tmp); + + if (b != NULL && b->Size == SHA1_SIZE) + { + Copy(crl->DigestSHA1, b->Buf, SHA1_SIZE); + } + + FreeBuf(b); + + empty = false; + } + + if (empty) + { + if (MsgBox(hWnd, MB_ICONEXCLAMATION | MB_YESNO | MB_DEFBUTTON2, _UU("SM_CRL_EMPTY_MSG")) == IDNO) + { + return; + } + } + + if (c->NewCrl) + { + Zero(&t, sizeof(t)); + StrCpy(t.HubName, sizeof(t.HubName), c->s->HubName); + t.Crl = crl; + + if (CALL(hWnd, ScAddCrl(c->s->Rpc, &t))) + { + EndDialog(hWnd, true); + } + + FreeRpcCrl(&t); + } + else + { + Zero(&t, sizeof(t)); + StrCpy(t.HubName, sizeof(t.HubName), c->s->HubName); + t.Crl = crl; + t.Key = c->Key; + + if (CALL(hWnd, ScSetCrl(c->s->Rpc, &t))) + { + EndDialog(hWnd, true); + } + + FreeRpcCrl(&t); + } +} + +// Read the certificate +void SmEditCrlDlgOnLoad(HWND hWnd, SM_EDIT_CRL *c) +{ + X *x; + // Validate arguments + if (hWnd == NULL || c == NULL) + { + return; + } + + if (CmLoadXFromFileOrSecureCard(hWnd, &x)) + { + UCHAR md5[MD5_SIZE], sha1[SHA1_SIZE]; + + SmEditCrlDlgSetName(hWnd, x->subject_name); + SmEditCrlDlgSetSerial(hWnd, x->serial); + GetXDigest(x, md5, false); + GetXDigest(x, sha1, true); + SmEditCrlDlgSetHash(hWnd, md5, sha1); + + FreeX(x); + + SmEditCrlDlgUpdate(hWnd, c); + } +} + +// Set the hash information to the dialog +void SmEditCrlDlgSetHash(HWND hWnd, UCHAR *hash_md5, UCHAR *hash_sha1) +{ + char tmp[MAX_SIZE]; + // Validate arguments + if (hWnd == NULL) + { + return; + } + + if (hash_md5 != NULL && IsZero(hash_md5, MD5_SIZE) == false) + { + Check(hWnd, R_MD5_HASH, true); + BinToStrEx(tmp, sizeof(tmp), hash_md5, MD5_SIZE); + SetTextA(hWnd, E_MD5_HASH, tmp); + } + else + { + Check(hWnd, R_MD5_HASH, false); + } + + if (hash_sha1 != NULL && IsZero(hash_sha1, SHA1_SIZE) == false) + { + Check(hWnd, R_SHA1_HASH, true); + BinToStrEx(tmp, sizeof(tmp), hash_sha1, SHA1_SIZE); + SetTextA(hWnd, E_SHA1_HASH, tmp); + } + else + { + Check(hWnd, R_SHA1_HASH, false); + } +} + +// Set the serial number to the dialog +void SmEditCrlDlgSetSerial(HWND hWnd, X_SERIAL *serial) +{ + char tmp[MAX_SIZE]; + // Validate arguments + if (hWnd == NULL || serial == NULL) + { + return; + } + + BinToStrEx(tmp, sizeof(tmp), serial->data, serial->size); + + Check(hWnd, R_SERI, true); + + SetTextA(hWnd, E_SERI, tmp); +} + +// Set the name situation to the dialog +void SmEditCrlDlgSetName(HWND hWnd, NAME *name) +{ + // Validate arguments + if (hWnd == NULL || name == NULL) + { + return; + } + + // CN + if (UniIsEmptyStr(name->CommonName)) + { + Check(hWnd, R_CN, false); + } + else + { + Check(hWnd, R_CN, true); + SetText(hWnd, E_CN, name->CommonName); + } + + // O + if (UniIsEmptyStr(name->Organization)) + { + Check(hWnd, R_O, false); + } + else + { + Check(hWnd, R_O, true); + SetText(hWnd, E_O, name->Organization); + } + + // OU + if (UniIsEmptyStr(name->Unit)) + { + Check(hWnd, R_OU, false); + } + else + { + Check(hWnd, R_OU, true); + SetText(hWnd, E_OU, name->Unit); + } + + // C + if (UniIsEmptyStr(name->Country)) + { + Check(hWnd, R_C, false); + } + else + { + Check(hWnd, R_C, true); + SetText(hWnd, E_C, name->Country); + } + + // ST + if (UniIsEmptyStr(name->State)) + { + Check(hWnd, R_ST, false); + } + else + { + Check(hWnd, R_ST, true); + SetText(hWnd, E_ST, name->State); + } + + // L + if (UniIsEmptyStr(name->Local)) + { + Check(hWnd, R_L, false); + } + else + { + Check(hWnd, R_L, true); + SetText(hWnd, E_L, name->Local); + } +} + +// CRL edit dialog procedure +UINT SmEditCrlDlgProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param) +{ + SM_EDIT_CRL *c = (SM_EDIT_CRL *)param; + // Validate arguments + if (hWnd == NULL) + { + return 0; + } + + switch (msg) + { + case WM_INITDIALOG: + SmEditCrlDlgInit(hWnd, c); + break; + + case WM_COMMAND: + switch (LOWORD(wParam)) + { + case R_CN: + case E_CN: + case R_O: + case E_O: + case R_OU: + case E_OU: + case R_C: + case E_C: + case R_ST: + case E_ST: + case R_L: + case E_L: + case R_SERI: + case E_SERI: + case R_MD5_HASH: + case E_MD5_HASH: + case R_SHA1_HASH: + case E_SHA1_HASH: + SmEditCrlDlgUpdate(hWnd, c); + break; + } + + switch (wParam) + { + case B_LOAD: + SmEditCrlDlgOnLoad(hWnd, c); + break; + + case IDOK: + SmEditCrlDlgOnOk(hWnd, c); + break; + + case IDCANCEL: + Close(hWnd); + break; + + case R_CN: + FocusEx(hWnd, E_CN); + break; + + case R_O: + FocusEx(hWnd, E_O); + break; + + case R_OU: + FocusEx(hWnd, E_OU); + break; + + case R_C: + FocusEx(hWnd, E_C); + break; + + case R_ST: + FocusEx(hWnd, E_ST); + break; + + case R_L: + FocusEx(hWnd, E_L); + break; + + case R_SERI: + FocusEx(hWnd, E_SERI); + break; + + case R_MD5_HASH: + FocusEx(hWnd, E_MD5_HASH); + break; + + case R_SHA1_HASH: + FocusEx(hWnd, E_SHA1_HASH); + break; + } + break; + + case WM_CLOSE: + EndDialog(hWnd, false); + break; + } + + return 0; +} + +// Initialize the dialog +void SmCrlDlgInit(HWND hWnd, SM_HUB *s) +{ + // Validate arguments + if (hWnd == NULL || s == NULL) + { + return; + } + + SetIcon(hWnd, 0, ICO_CERT_X); + + LvInit(hWnd, L_LIST); + LvInsertColumn(hWnd, L_LIST, 0, _UU("SM_CRL_COLUMN_1"), 555); + + SmCrlDlgRefresh(hWnd, s); +} + +// Update the control +void SmCrlDlgUpdate(HWND hWnd, SM_HUB *s) +{ + // Validate arguments + if (hWnd == NULL || s == NULL) + { + return; + } + + SetEnable(hWnd, IDOK, LvIsSingleSelected(hWnd, L_LIST)); + SetEnable(hWnd, B_DELETE, LvIsSingleSelected(hWnd, L_LIST)); +} + +// Content update +void SmCrlDlgRefresh(HWND hWnd, SM_HUB *s) +{ + UINT i; + RPC_ENUM_CRL t; + LVB *v; + // Validate arguments + if (hWnd == NULL || s == NULL) + { + return; + } + + Zero(&t, sizeof(t)); + StrCpy(t.HubName, sizeof(t.HubName), s->HubName); + + if (CALL(hWnd, ScEnumCrl(s->Rpc, &t)) == false) + { + EndDialog(hWnd, false); + return; + } + + v = LvInsertStart(); + + for (i = 0;i < t.NumItem;i++) + { + RPC_ENUM_CRL_ITEM *e = &t.Items[i]; + LvInsertAdd(v, ICO_CERT_X, (void *)e->Key, 1, e->CrlInfo); + } + + LvInsertEndEx(v, hWnd, L_LIST, true); + + if (t.NumItem >= 1) + { + LvAutoSize(hWnd, L_LIST); + } + + FreeRpcEnumCrl(&t); + + SmCrlDlgUpdate(hWnd, s); +} + +// Certificate revocation list dialog procedure +UINT SmCrlDlgProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param) +{ + SM_EDIT_CRL c; + SM_HUB *s = (SM_HUB *)param; + NMHDR *n; + // Validate arguments + if (hWnd == NULL) + { + return 0; + } + + switch (msg) + { + case WM_INITDIALOG: + SmCrlDlgInit(hWnd, s); + break; + + case WM_COMMAND: + switch (wParam) + { + case B_ADD: + Zero(&c, sizeof(c)); + c.NewCrl = true; + c.s = s; + + if (Dialog(hWnd, D_SM_EDIT_CRL, SmEditCrlDlgProc, &c)) + { + SmCrlDlgRefresh(hWnd, s); + } + break; + + case B_DELETE: + if (IsEnable(hWnd, B_DELETE)) + { + if (MsgBox(hWnd, MB_ICONQUESTION | MB_YESNO | MB_DEFBUTTON2, _UU("SM_CRL_DELETE_MSG")) == IDYES) + { + RPC_CRL t; + + Zero(&t, sizeof(t)); + StrCpy(t.HubName, sizeof(t.HubName), s->HubName); + t.Key = (UINT)LvGetParam(hWnd, L_LIST, LvGetSelected(hWnd, L_LIST)); + + if (CALL(hWnd, ScDelCrl(s->Rpc, &t))) + { + SmCrlDlgRefresh(hWnd, s); + } + + FreeRpcCrl(&t); + } + } + break; + + case IDOK: + if (IsEnable(hWnd, IDOK)) + { + SM_EDIT_CRL c; + + Zero(&c, sizeof(c)); + c.NewCrl = false; + c.s = s; + c.Key = (UINT)LvGetParam(hWnd, L_LIST, LvGetSelected(hWnd, L_LIST)); + + if (Dialog(hWnd, D_SM_EDIT_CRL, SmEditCrlDlgProc, &c)) + { + SmCrlDlgRefresh(hWnd, s); + } + } + break; + + case IDCANCEL: + Close(hWnd); + break; + } + break; + + case WM_CLOSE: + EndDialog(hWnd, 0); + break; + + case WM_NOTIFY: + n = (NMHDR *)lParam; + switch (n->code) + { + case LVN_ITEMCHANGED: + switch (n->idFrom) + { + case L_LIST: + SmCrlDlgUpdate(hWnd, s); + break; + } + break; + } + break; + } + + LvStandardHandler(hWnd, msg, wParam, lParam, L_LIST); + + return 0; +} + +// Smart Card Manager +void SmSecureManager(HWND hWnd) +{ + UINT id = SmGetCurrentSecureIdFromReg(); + + if (id == 0) + { + id = SmSelectSecureId(hWnd); + } + + if (id == 0) + { + return; + } + + CmSecureManager(hWnd, id); +} + +// Initialize the dialog +void SmSelectKeyPairDlgInit(HWND hWnd, SM_SECURE_KEYPAIR *k) +{ + SECURE_DEVICE *dev; + // Validate arguments + if (hWnd == NULL || k == NULL) + { + return; + } + + dev = GetSecureDevice(k->Id); + if (dev != NULL) + { + FormatText(hWnd, S_INFO, dev->DeviceName); + } + + LvInit(hWnd, L_CERT); + LvInsertColumn(hWnd, L_CERT, 0, _UU("SEC_MGR_COLUMN1"), 200); + LvInsertColumn(hWnd, L_CERT, 1, _UU("SEC_MGR_COLUMN2"), 110); + + LvInit(hWnd, L_KEY); + LvInsertColumn(hWnd, L_KEY, 0, _UU("SEC_MGR_COLUMN1"), 200); + LvInsertColumn(hWnd, L_KEY, 1, _UU("SEC_MGR_COLUMN2"), 110); + + SetEnable(hWnd, L_CERT, k->UseCert); + SetEnable(hWnd, B_BOLD1, k->UseCert); + SetEnable(hWnd, L_KEY, k->UseKey); + SetEnable(hWnd, B_BOLD2, k->UseKey); + + SetFont(hWnd, B_BOLD1, Font(0, true)); + SetFont(hWnd, B_BOLD2, Font(0, true)); + + SmSelectKeyPairDlgUpdate(hWnd, k); +} + +// Update the dialog control +void SmSelectKeyPairDlgUpdate(HWND hWnd, SM_SECURE_KEYPAIR *k) +{ + bool ok = true; + // Validate arguments + if (hWnd == NULL || k == NULL) + { + return; + } + + if (k->UseCert) + { + if (LvIsSingleSelected(hWnd, L_CERT) == false) + { + ok = false; + } + else + { + char *name = LvGetSelectedStrA(hWnd, L_CERT, 0); + if (name != NULL) + { + if (LvIsSingleSelected(hWnd, L_KEY) == false) + { + if ((k->Flag++) == 0) + { + LvSelect(hWnd, L_KEY, LvSearchStrA(hWnd, L_KEY, 0, name)); + } + } + Free(name); + } + } + } + + if (k->UseKey) + { + if (LvIsSingleSelected(hWnd, L_KEY) == false) + { + ok = false; + } + else + { + char *name = LvGetSelectedStrA(hWnd, L_KEY, 0); + if (name != NULL) + { + if (LvIsSingleSelected(hWnd, L_CERT) == false) + { + if ((k->Flag++) == 0) + { + LvSelect(hWnd, L_CERT, LvSearchStrA(hWnd, L_CERT, 0, name)); + } + } + Free(name); + } + } + } + + SetEnable(hWnd, IDOK, ok); +} + +// Update the contents +void SmSelectKeyPairDlgRefresh(HWND hWnd, SM_SECURE_KEYPAIR *k) +{ + bool ret; + LIST *o; + WINUI_SECURE_BATCH batch[] = + { + {WINUI_SECURE_ENUM_OBJECTS, NULL, false, NULL, NULL, NULL, NULL, NULL, NULL}, + }; + // Validate arguments + if (hWnd == NULL || k == NULL) + { + return; + } + + ret = SecureDeviceWindow(hWnd, batch, sizeof(batch) / sizeof(batch[0]), k->Id, k->BitmapId); + + if (ret == false) + { + Close(hWnd); + return; + } + + o = batch[0].EnumList; + if (o != NULL) + { + if (k->UseCert) + { + CmSecureManagerDlgPrintListEx(hWnd, L_CERT, o, SEC_X); + } + + if (k->UseKey) + { + CmSecureManagerDlgPrintListEx(hWnd, L_KEY, o, SEC_K); + } + + FreeEnumSecObject(o); + } + + // Update the control + SmSelectKeyPairDlgUpdate(hWnd, k); +} + +// Key pair import dialog procedure +UINT SmSelectKeyPairDlg(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param) +{ + NMHDR *n; + SM_SECURE_KEYPAIR *k = (SM_SECURE_KEYPAIR *)param; + char *s1, *s2; + // Validate arguments + if (hWnd == NULL) + { + return 0; + } + + switch (msg) + { + case WM_INITDIALOG: + SmSelectKeyPairDlgInit(hWnd, k); + + SetTimer(hWnd, 1, 1, NULL); + SetTimer(hWnd, 2, 100, NULL); + break; + + case WM_TIMER: + switch (wParam) + { + case 1: + KillTimer(hWnd, 1); + SmSelectKeyPairDlgRefresh(hWnd, k); + break; + + case 2: + SmSelectKeyPairDlgUpdate(hWnd, k); + break; + } + break; + + case WM_COMMAND: + switch (wParam) + { + case IDOK: + s1 = LvGetSelectedStrA(hWnd, L_CERT, 0); + s2 = LvGetSelectedStrA(hWnd, L_KEY, 0); + if (k->UseCert) + { + StrCpy(k->CertName, sizeof(k->CertName), s1); + } + if (k->UseKey) + { + StrCpy(k->KeyName, sizeof(k->KeyName), s2); + } + Free(s1); + Free(s2); + EndDialog(hWnd, true); + break; + + case IDCANCEL: + Close(hWnd); + break; + } + break; + + case WM_CLOSE: + EndDialog(hWnd, 0); + break; + + case WM_NOTIFY: + n = (NMHDR *)lParam; + switch (n->idFrom) + { + case L_CERT: + case L_KEY: + switch (n->code) + { + case LVN_ITEMCHANGED: + SmSelectKeyPairDlgUpdate(hWnd, k); + break; + } + break; + } + break; + } + + return 0; +} + +// Read a key pair from the smart card +bool SmSelectKeyPair(HWND hWnd, char *cert_name, UINT cert_name_size, char *key_name, UINT key_name_size) +{ + return SmSelectKeyPairEx(hWnd, cert_name, cert_name_size, key_name, key_name_size, 0); +} +bool SmSelectKeyPairEx(HWND hWnd, char *cert_name, UINT cert_name_size, char *key_name, UINT key_name_size, UINT bitmap_id) +{ + SM_SECURE_KEYPAIR p; + // Validate arguments + if (hWnd == NULL || (cert_name == NULL && key_name == NULL)) + { + return false; + } + + Zero(&p, sizeof(p)); + p.Id = SmGetCurrentSecureId(hWnd); + if (p.Id == 0) + { + return false; + } + + p.UseCert = (cert_name == NULL) ? false : true; + p.UseKey = (key_name == NULL) ? false : true; + p.BitmapId = bitmap_id; + + if (Dialog(hWnd, D_SM_SELECT_KEYPAIR, SmSelectKeyPairDlg, &p) == false) + { + return false; + } + + if (p.UseCert) + { + StrCpy(cert_name, cert_name_size, p.CertName); + } + if (p.UseKey) + { + StrCpy(key_name, key_name_size, p.KeyName); + } + + return true; +} + +// Make the user select the smart card number +UINT SmSelectSecureId(HWND hWnd) +{ + UINT id = MsRegReadInt(REG_CURRENT_USER, SECURE_MANAGER_KEY, "DeviceId"); + UINT ret; + + if (id != 0 && CheckSecureDeviceId(id) == false) + { + id = 0; + } + + ret = CmSelectSecure(hWnd, id); + if (ret == 0) + { + return 0; + } + + SmWriteSelectSecureIdReg(ret); + + return ret; +} + +// Write the current smart card number to the registry +void SmWriteSelectSecureIdReg(UINT id) +{ + MsRegWriteInt(REG_CURRENT_USER, SECURE_MANAGER_KEY, "DeviceId", id); +} + +// Get the current smart card number +UINT SmGetCurrentSecureId(HWND hWnd) +{ + // Load the current settings + UINT id = MsRegReadInt(REG_CURRENT_USER, SECURE_MANAGER_KEY, "DeviceId"); + + // Check whether it's valid + if (id == 0 || CheckSecureDeviceId(id) == false) + { + // Select a smart card device number if it's invalid + id = SmSelectSecureId(hWnd); + } + + return id; +} + +// Get the current smart card number from the registry +UINT SmGetCurrentSecureIdFromReg() +{ + // Load the current settings + UINT id = MsRegReadInt(REG_CURRENT_USER, SECURE_MANAGER_KEY, "DeviceId"); + + // Check whether normal + if (id == 0 || CheckSecureDeviceId(id) == false) + { + id = 0; + } + + return id; +} + +// Get whether the specified L3 switch started +bool SmL3IsSwActive(SM_SERVER *s, char *name) +{ + bool ret = false; + UINT i; + RPC_ENUM_L3SW t; + // Validate arguments + if (s == NULL || name == NULL) + { + return false; + } + + Zero(&t, sizeof(t)); + if (ScEnumL3Switch(s->Rpc, &t) == ERR_NO_ERROR) + { + for (i = 0;i < t.NumItem;i++) + { + RPC_ENUM_L3SW_ITEM *e = &t.Items[i]; + if (StrCmpi(e->Name, name) == 0) + { + if (e->Active) + { + ret = true; + break; + } + } + } + FreeRpcEnumL3Sw(&t); + } + + return ret; +} + +// Initialize the dialog +void SmL3SwTableDlgInit(HWND hWnd, SM_L3SW *w) +{ + // Validate arguments + if (hWnd == NULL || w == NULL) + { + return; + } + + SmL3SwTableDlgUpdate(hWnd, w); +} + +// Update the control +void SmL3SwTableDlgUpdate(HWND hWnd, SM_L3SW *w) +{ + bool b = true; + UINT ip; + // Validate arguments + if (hWnd == NULL || w == NULL) + { + return; + } + + if (IpIsFilled(hWnd, E_NETWORK) == false || + IpIsFilled(hWnd, E_MASK) == false || + IpIsFilled(hWnd, E_GATEWAY) == false) + { + b = false; + } + + ip = IpGet(hWnd, E_GATEWAY); + if (ip == 0 || ip == 0xffffffff) + { + b = false; + } + + if (GetInt(hWnd, E_METRIC) == 0) + { + b = false; + } + + if (IsNetworkAddress32(IpGet(hWnd, E_NETWORK), IpGet(hWnd, E_MASK)) == false) + { + b = false; + } + + SetEnable(hWnd, IDOK, b); +} + +UINT SmL3SwTableDlg(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param) +{ + SM_L3SW *w = (SM_L3SW *)param; + RPC_L3TABLE t; + + if (hWnd == NULL) + { + return 0; + } + + switch (msg) + { + case WM_INITDIALOG: + SmL3SwTableDlgInit(hWnd, w); + break; + + case WM_COMMAND: + switch (LOWORD(wParam)) + { + case E_NETWORK: + case E_MASK: + case E_GATEWAY: + case E_METRIC: + SmL3SwTableDlgUpdate(hWnd, w); + break; + } + + switch (wParam) + { + case IDOK: + Zero(&t, sizeof(t)); + StrCpy(t.Name, sizeof(t.Name), w->SwitchName); + t.NetworkAddress = IpGet(hWnd, E_NETWORK); + t.SubnetMask = IpGet(hWnd, E_MASK); + t.GatewayAddress = IpGet(hWnd, E_GATEWAY); + t.Metric = GetInt(hWnd, E_METRIC); + + if (CALL(hWnd, ScAddL3Table(w->s->Rpc, &t))) + { + EndDialog(hWnd, 1); + } + break; + + case IDCANCEL: + Close(hWnd); + break; + } + break; + + case WM_CLOSE: + EndDialog(hWnd, 0); + break; + } + + return 0; +} + +// Initialize the dialog +void SmL3SwIfDlgInit(HWND hWnd, SM_L3SW *w) +{ + RPC_ENUM_HUB t; + UINT i; + // Validate arguments + if (hWnd == NULL || w == NULL) + { + return; + } + + Zero(&t, sizeof(t)); + + if (CALL(hWnd, ScEnumHub(w->s->Rpc, &t)) == false) + { + Close(hWnd); + return; + } + + CbReset(hWnd, E_HUBNAME); + CbSetHeight(hWnd, E_HUBNAME, 18); + + for (i = 0;i < t.NumHub;i++) + { + RPC_ENUM_HUB_ITEM *e = &t.Hubs[i]; + + if (e->HubType != HUB_TYPE_FARM_DYNAMIC) + { + CbAddStrA(hWnd, E_HUBNAME, e->HubName, 0); + } + } + + FreeRpcEnumHub(&t); + + SetTextA(hWnd, E_HUBNAME, ""); + + SmL3SwIfDlgUpdate(hWnd, w); +} + +// Update the control +void SmL3SwIfDlgUpdate(HWND hWnd, SM_L3SW *w) +{ + bool b = true; + // Validate arguments + if (hWnd == NULL || w == NULL) + { + return; + } + + if (IsEmpty(hWnd, E_HUBNAME)) + { + b = false; + } + + if (IpIsFilled(hWnd, E_IP) == false || IpIsFilled(hWnd, E_MASK) == false) + { + b = false; + } + + if (IpGet(hWnd, E_IP) == 0 || IpGet(hWnd, E_IP) == 0xffffffff) + { + b = false; + } + + if (IsSubnetMask32(IpGet(hWnd, E_MASK)) == false) + { + b = false; + } + + SetEnable(hWnd, IDOK, b); +} + +// Dialog for adding a virtual interface +UINT SmL3SwIfDlg(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param) +{ + SM_L3SW *w = (SM_L3SW *)param; + char *hubname; + // Validate arguments + if (hWnd == NULL) + { + return 0; + } + + switch (msg) + { + case WM_INITDIALOG: + SmL3SwIfDlgInit(hWnd, w); + + SetTimer(hWnd, 1, 250, NULL); + break; + + case WM_TIMER: + switch (wParam) + { + case 1: + if (IsEnable(hWnd, 0)) + { + SmL3SwIfDlgUpdate(hWnd, w); + } + break; + } + break; + + case WM_COMMAND: + switch (LOWORD(wParam)) + { + case E_HUBNAME: + case E_IP: + case E_MASK: + SmL3SwIfDlgUpdate(hWnd, w); + break; + } + + switch (wParam) + { + case IDOK: + hubname = GetTextA(hWnd, E_HUBNAME); + if (hubname != NULL) + { + RPC_L3IF t; + Zero(&t, sizeof(t)); + StrCpy(t.HubName, sizeof(t.HubName), hubname); + t.IpAddress = IpGet(hWnd, E_IP); + t.SubnetMask = IpGet(hWnd, E_MASK); + StrCpy(t.Name, sizeof(t.Name), w->SwitchName); + + if (CALL(hWnd, ScAddL3If(w->s->Rpc, &t))) + { + EndDialog(hWnd, 1); + } + + Free(hubname); + } + break; + + case IDCANCEL: + Close(hWnd); + break; + } + break; + + case WM_CLOSE: + EndDialog(hWnd, 0); + break; + } + + return 0; +} + +// Initialize +void SmL3SwDlgInit(HWND hWnd, SM_L3SW *w) +{ + // Validate arguments + if (hWnd == NULL || w == NULL) + { + return; + } + + SetIcon(hWnd, 0, ICO_SWITCH_OFFLINE); + + FormatText(hWnd, 0, w->SwitchName); + + SetFont(hWnd, S_BOLD1, Font(0, true)); + SetFont(hWnd, S_BOLD2, Font(0, true)); + + LvInit(hWnd, L_IF); + LvInsertColumn(hWnd, L_IF, 0, _UU("SM_L3_SW_IF_COLUMN1"), 150); + LvInsertColumn(hWnd, L_IF, 1, _UU("SM_L3_SW_IF_COLUMN2"), 150); + LvInsertColumn(hWnd, L_IF, 2, _UU("SM_L3_SW_IF_COLUMN3"), 180); + + LvInit(hWnd, L_TABLE); + LvInsertColumn(hWnd, L_TABLE, 0, _UU("SM_L3_SW_TABLE_COLUMN1"), 130); + LvInsertColumn(hWnd, L_TABLE, 1, _UU("SM_L3_SW_TABLE_COLUMN2"), 130); + LvInsertColumn(hWnd, L_TABLE, 2, _UU("SM_L3_SW_TABLE_COLUMN3"), 130); + LvInsertColumn(hWnd, L_TABLE, 3, _UU("SM_L3_SW_TABLE_COLUMN4"), 100); + + w->Enable = SmL3IsSwActive(w->s, w->SwitchName) ? false : true; + + SmL3SwDlgRefresh(hWnd, w); +} + +// Update the control +void SmL3SwDlgUpdate(HWND hWnd, SM_L3SW *w) +{ + // Validate arguments + if (hWnd == NULL || w == NULL) + { + return; + } + + SetEnable(hWnd, B_ADD_IF, w->s->ServerAdminMode && w->Enable); + SetEnable(hWnd, B_ADD_TABLE, w->s->ServerAdminMode && w->Enable); + SetEnable(hWnd, B_DEL_IF, LvIsSingleSelected(hWnd, L_IF) && w->s->ServerAdminMode && w->Enable); + SetEnable(hWnd, B_DEL_TABLE, LvIsSingleSelected(hWnd, L_TABLE) && w->s->ServerAdminMode && w->Enable); + SetEnable(hWnd, B_START, w->s->ServerAdminMode && w->Enable); + SetEnable(hWnd, B_STOP, w->s->ServerAdminMode && (w->Enable == false)); +} + +// Content update +void SmL3SwDlgRefresh(HWND hWnd, SM_L3SW *w) +{ + UINT i; + wchar_t tmp1[MAX_SIZE]; + wchar_t tmp2[MAX_SIZE]; + wchar_t tmp3[MAX_SIZE]; + wchar_t tmp4[MAX_SIZE]; + // Validate arguments + if (hWnd == NULL || w == NULL) + { + return; + } + + // Virtual interface list + { + RPC_ENUM_L3IF t; + LVB *v; + + Zero(&t, sizeof(t)); + StrCpy(t.Name, sizeof(t.Name), w->SwitchName); + + if (CALL(hWnd, ScEnumL3If(w->s->Rpc, &t)) == false) + { + Close(hWnd); + return; + } + + v = LvInsertStart(); + + for (i = 0;i < t.NumItem;i++) + { + RPC_L3IF *e = &t.Items[i]; + + IPToUniStr32(tmp1, sizeof(tmp1), e->IpAddress); + IPToUniStr32(tmp2, sizeof(tmp2), e->SubnetMask); + StrToUni(tmp3, sizeof(tmp3), e->HubName); + + LvInsertAdd(v, ICO_NIC_ONLINE, NULL, 3, tmp1, tmp2, tmp3); + } + + LvReset(hWnd, L_IF); + + LvInsertEnd(v, hWnd, L_IF); + + FreeRpcEnumL3If(&t); + } + + // Routing Table Entry List + { + RPC_ENUM_L3TABLE t; + LVB *v; + + Zero(&t, sizeof(t)); + StrCpy(t.Name, sizeof(t.Name), w->SwitchName); + + if (CALL(hWnd, ScEnumL3Table(w->s->Rpc, &t)) == false) + { + Close(hWnd); + return; + } + + v = LvInsertStart(); + + for (i = 0;i < t.NumItem;i++) + { + RPC_L3TABLE *e = &t.Items[i]; + + IPToUniStr32(tmp1, sizeof(tmp1), e->NetworkAddress); + IPToUniStr32(tmp2, sizeof(tmp2), e->SubnetMask); + IPToUniStr32(tmp3, sizeof(tmp3), e->GatewayAddress); + UniToStru(tmp4, e->Metric); + + LvInsertAdd(v, ICO_PROTOCOL, NULL, 4, tmp1, tmp2, tmp3, tmp4); + } + + LvReset(hWnd, L_TABLE); + + LvInsertEnd(v, hWnd, L_TABLE); + + FreeRpcEnumL3Table(&t); + } + + SmL3SwDlgUpdate(hWnd, w); +} + +// Edit dialog of L3 switch +UINT SmL3SwDlg(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param) +{ + SM_L3SW *w = (SM_L3SW *)param; + NMHDR *n; + // Validate arguments + if (hWnd == NULL) + { + return 0; + } + + switch (msg) + { + case WM_INITDIALOG: + SmL3SwDlgInit(hWnd, w); + + SetTimer(hWnd, 1, 1000, NULL); + break; + + case WM_TIMER: + switch (wParam) + { + case 1: + if (IsEnable(hWnd, 0)) + { + KillTimer(hWnd, 1); + w->Enable = SmL3IsSwActive(w->s, w->SwitchName) ? false : true; + SmL3SwDlgUpdate(hWnd, w); + SetTimer(hWnd, 1, 1000, NULL); + } + break; + } + break; + + case WM_COMMAND: + switch (wParam) + { + case B_START: + if (IsEnable(hWnd, B_START)) + { + RPC_L3SW t; + + Zero(&t, sizeof(t)); + StrCpy(t.Name, sizeof(t.Name), w->SwitchName); + + if (CALL(hWnd, ScStartL3Switch(w->s->Rpc, &t))) + { + SmL3SwDlgUpdate(hWnd, w); + } + } + break; + + case B_STOP: + if (IsEnable(hWnd, B_STOP)) + { + RPC_L3SW t; + + Zero(&t, sizeof(t)); + StrCpy(t.Name, sizeof(t.Name), w->SwitchName); + + if (CALL(hWnd, ScStopL3Switch(w->s->Rpc, &t))) + { + SmL3SwDlgUpdate(hWnd, w); + } + } + break; + + case B_ADD_IF: + if (Dialog(hWnd, D_SM_L3_SW_IF, SmL3SwIfDlg, w)) + { + SmL3SwDlgRefresh(hWnd, w); + } + break; + + case B_DEL_IF: + if (LvIsSingleSelected(hWnd, L_IF)) + { + RPC_L3IF t; + char *tmp1, *tmp2, *tmp3; + + tmp1 = LvGetSelectedStrA(hWnd, L_IF, 0); + tmp2 = LvGetSelectedStrA(hWnd, L_IF, 1); + tmp3 = LvGetSelectedStrA(hWnd, L_IF, 2); + + Zero(&t, sizeof(t)); + StrCpy(t.Name, sizeof(t.Name), w->SwitchName); + t.IpAddress = StrToIP32(tmp1); + t.SubnetMask = StrToIP32(tmp2); + StrCpy(t.HubName, sizeof(t.HubName), tmp3); + + if (CALL(hWnd, ScDelL3If(w->s->Rpc, &t))) + { + SmL3SwDlgRefresh(hWnd, w); + } + + Free(tmp1); + Free(tmp2); + Free(tmp3); + } + break; + + case B_ADD_TABLE: + if (Dialog(hWnd, D_SM_L3_SW_TABLE, SmL3SwTableDlg, w)) + { + SmL3SwDlgRefresh(hWnd, w); + } + break; + + case B_DEL_TABLE: + if (LvIsSingleSelected(hWnd, L_TABLE)) + { + RPC_L3TABLE t; + char *tmp1, *tmp2, *tmp3, *tmp4; + + tmp1 = LvGetSelectedStrA(hWnd, L_TABLE, 0); + tmp2 = LvGetSelectedStrA(hWnd, L_TABLE, 1); + tmp3 = LvGetSelectedStrA(hWnd, L_TABLE, 2); + tmp4 = LvGetSelectedStrA(hWnd, L_TABLE, 3); + + Zero(&t, sizeof(t)); + StrCpy(t.Name, sizeof(t.Name), w->SwitchName); + t.NetworkAddress = StrToIP32(tmp1); + t.SubnetMask = StrToIP32(tmp2); + t.GatewayAddress = StrToIP32(tmp3); + t.Metric = ToInt(tmp4); + + if (CALL(hWnd, ScDelL3Table(w->s->Rpc, &t))) + { + SmL3SwDlgRefresh(hWnd, w); + } + + Free(tmp1); + Free(tmp2); + Free(tmp3); + Free(tmp4); + } + break; + + case IDCANCEL: + Close(hWnd); + break; + } + break; + + case WM_CLOSE: + EndDialog(hWnd, 0); + break; + + case WM_NOTIFY: + n = (NMHDR *)lParam; + switch (n->idFrom) + { + case L_IF: + case L_TABLE: + switch (n->code) + { + case LVN_ITEMCHANGED: + SmL3SwDlgUpdate(hWnd, w); + break; + } + break; + } + break; + } + + return 0; +} + +// Update the control +void SmL3AddDlgUpdate(HWND hWnd, SM_SERVER *s) +{ + char *tmp; + // Validate arguments + if (hWnd == NULL || s == NULL) + { + return; + } + + tmp = GetTextA(hWnd, E_NAME); + + SetEnable(hWnd, IDOK, IsEmptyStr(tmp) == false && IsSafeStr(tmp)); + + Free(tmp); +} + +// The dialog box to create a new L3 switch +UINT SmL3AddDlg(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param) +{ + SM_SERVER *s = (SM_SERVER *)param; + RPC_L3SW t; + // Validate arguments + if (hWnd == NULL) + { + return 0; + } + + switch (msg) + { + case WM_INITDIALOG: + LimitText(hWnd, E_NAME, MAX_HUBNAME_LEN); + SmL3AddDlgUpdate(hWnd, s); + break; + + case WM_COMMAND: + switch (LOWORD(wParam)) + { + case E_NAME: + SmL3AddDlgUpdate(hWnd, s); + break; + } + + switch (wParam) + { + case IDOK: + Zero(&t, sizeof(t)); + GetTxtA(hWnd, E_NAME, t.Name, sizeof(t.Name)); + if (CALL(hWnd, ScAddL3Switch(s->Rpc, &t))) + { + EndDialog(hWnd, 1); + } + break; + + case IDCANCEL: + Close(hWnd); + break; + } + break; + + case WM_CLOSE: + EndDialog(hWnd, 0); + break; + } + + return 0; +} + +// Initialize the dialog +void SmL3DlgInit(HWND hWnd, SM_SERVER *s) +{ + // Validate arguments + if (hWnd == NULL || s == NULL) + { + return; + } + + SetFont(hWnd, S_BOLD, Font(0, true)); + + SetIcon(hWnd, 0, ICO_SWITCH); + + LvInit(hWnd, L_LIST); + LvInsertColumn(hWnd, L_LIST, 0, _UU("SM_L3_SW_COLUMN1"), 150); + LvInsertColumn(hWnd, L_LIST, 1, _UU("SM_L3_SW_COLUMN2"), 120); + LvInsertColumn(hWnd, L_LIST, 2, _UU("SM_L3_SW_COLUMN3"), 100); + LvInsertColumn(hWnd, L_LIST, 3, _UU("SM_L3_SW_COLUMN4"), 100); + + SmL3DlgRefresh(hWnd, s); +} + +// Update the dialog control +void SmL3DlgUpdate(HWND hWnd, SM_SERVER *s) +{ + bool b = false; + bool active = false; + // Validate arguments + if (hWnd == NULL || s == NULL) + { + return; + } + + if (LvIsSingleSelected(hWnd, L_LIST)) + { + wchar_t *tmp; + UINT i; + b = true; + i = LvGetSelected(hWnd, L_LIST); + if (i != INFINITE) + { + tmp = LvGetStr(hWnd, L_LIST, i, 1); + if (UniStrCmpi(tmp, _UU("SM_L3_SW_ST_F_F")) != 0) + { + active = true; + } + Free(tmp); + } + } + + SetEnable(hWnd, B_START, b && (active == false)); + SetEnable(hWnd, B_STOP, b && (active != false)); + SetEnable(hWnd, IDOK, b); + SetEnable(hWnd, B_DELETE, b); +} + +// Dialog content update +void SmL3DlgRefresh(HWND hWnd, SM_SERVER *s) +{ + RPC_ENUM_L3SW t; + UINT i; + LVB *v; + // Validate arguments + if (hWnd == NULL || s == NULL) + { + return; + } + + Zero(&t, sizeof(t)); + if (CALL(hWnd, ScEnumL3Switch(s->Rpc, &t)) == false) + { + Close(hWnd); + return; + } + + v = LvInsertStart(); + + for (i = 0;i < t.NumItem;i++) + { + RPC_ENUM_L3SW_ITEM *e = &t.Items[i]; + wchar_t tmp1[MAX_SIZE], *tmp2, tmp3[64], tmp4[64]; + + StrToUni(tmp1, sizeof(tmp1), e->Name); + if (e->Active == false) + { + tmp2 = _UU("SM_L3_SW_ST_F_F"); + } + else if (e->Online == false) + { + tmp2 = _UU("SM_L3_SW_ST_T_F"); + } + else + { + tmp2 = _UU("SM_L3_SW_ST_T_T"); + } + UniToStru(tmp3, e->NumInterfaces); + UniToStru(tmp4, e->NumTables); + + LvInsertAdd(v, e->Active ? ICO_SWITCH : ICO_SWITCH_OFFLINE, NULL, + 4, tmp1, tmp2, tmp3, tmp4); + } + + LvInsertEnd(v, hWnd, L_LIST); + + FreeRpcEnumL3Sw(&t); + + SmL3DlgUpdate(hWnd, s); +} + +// L3 dialog procedure +UINT SmL3Dlg(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param) +{ + NMHDR *n; + SM_SERVER *s = (SM_SERVER *)param; + RPC_L3SW t; + char *name; + // Validate arguments + if (hWnd == NULL) + { + return 0; + } + + switch (msg) + { + case WM_INITDIALOG: + SmL3DlgInit(hWnd, s); + + SetTimer(hWnd, 1, 1000, NULL); + break; + + case WM_TIMER: + switch (wParam) + { + case 1: + if (IsEnable(hWnd, 0)) + { + KillTimer(hWnd, 1); + SmL3DlgRefresh(hWnd, s); + SetTimer(hWnd, 1, 1000, NULL); + } + break; + } + break; + + case WM_COMMAND: + switch (wParam) + { + case B_ADD: + // Add + if (Dialog(hWnd, D_SM_L3_ADD, SmL3AddDlg, s)) + { + SmL3DlgRefresh(hWnd, s); + } + break; + + case B_START: + // Operation start + name = LvGetSelectedStrA(hWnd, L_LIST, 0); + if (name != NULL) + { + Zero(&t, sizeof(t)); + StrCpy(t.Name, sizeof(t.Name), name); + + if (CALL(hWnd, ScStartL3Switch(s->Rpc, &t))) + { + SmL3DlgRefresh(hWnd, s); + } + + Free(name); + } + break; + + case B_STOP: + // Operation stop + name = LvGetSelectedStrA(hWnd, L_LIST, 0); + if (name != NULL) + { + Zero(&t, sizeof(t)); + StrCpy(t.Name, sizeof(t.Name), name); + + if (CALL(hWnd, ScStopL3Switch(s->Rpc, &t))) + { + SmL3DlgRefresh(hWnd, s); + } + + Free(name); + } + break; + + case IDOK: + // Edit + if (IsEnable(hWnd, IDOK)) + { + name = LvGetSelectedStrA(hWnd, L_LIST, 0); + if (name != NULL) + { + SM_L3SW w; + Zero(&w, sizeof(w)); + w.s = s; + w.SwitchName = name; + + Dialog(hWnd, D_SM_L3_SW, SmL3SwDlg, &w); + + Free(name); + } + } + break; + + case B_DELETE: + // Delete + name = LvGetSelectedStrA(hWnd, L_LIST, 0); + if (name != NULL) + { + if (MsgBoxEx(hWnd, MB_ICONEXCLAMATION | MB_YESNO | MB_DEFBUTTON2, + _UU("SM_L3_SW_DEL_MSG"), name) == IDYES) + { + Zero(&t, sizeof(t)); + StrCpy(t.Name, sizeof(t.Name), name); + + if (CALL(hWnd, ScDelL3Switch(s->Rpc, &t))) + { + SmL3DlgRefresh(hWnd, s); + } + } + + Free(name); + } + break; + + case IDCANCEL: + // Close + Close(hWnd); + break; + } + break; + + case WM_NOTIFY: + n = (NMHDR *)lParam; + switch (n->idFrom) + { + case L_LIST: + switch (n->code) + { + case LVN_ITEMCHANGED: + SmL3DlgUpdate(hWnd, s); + break; + + case NM_DBLCLK: + Command(hWnd, IDOK); + break; + } + break; + } + break; + + case WM_CLOSE: + EndDialog(hWnd, 0); + break; + } + + return 0; +} + +// L3 dialog +void SmL3(HWND hWnd, SM_SERVER *s) +{ + // Validate arguments + if (s == NULL) + { + return; + } + + Dialog(hWnd, D_SM_L3, SmL3Dlg, s); +} + +// Dialog for management option value +UINT SmHubAdminOptionValueDlg(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param) +{ + SM_EDIT_AO *a = (SM_EDIT_AO *)param; + UINT i; + char tmp[MAX_SIZE]; + // Validate arguments + if (hWnd == NULL) + { + return 0; + } + + switch (msg) + { + case WM_INITDIALOG: + CbReset(hWnd, C_NAME); + for (i = 0;i < a->DefaultOptions.NumItem;i++) + { + wchar_t tmp[MAX_PATH]; + StrToUni(tmp, sizeof(tmp), a->DefaultOptions.Items[i].Name); + CbAddStr(hWnd, C_NAME, tmp, 0); + } + if (a->NewMode == false) + { + char tmp[MAX_SIZE]; + + SetTextA(hWnd, C_NAME, a->Name); + ToStr(tmp, a->Value); + + SetTextA(hWnd, E_VALUE, tmp); + } + else + { + SetTextA(hWnd, C_NAME, ""); + } + SmHubAdminOptionValueDlgUpdate(hWnd, a); + if (a->NewMode == false) + { + FocusEx(hWnd, E_VALUE); + Disable(hWnd, C_NAME); + } + else + { + FocusEx(hWnd, C_NAME); + } + + SetTimer(hWnd, 1, 100, NULL); + break; + + case WM_TIMER: + if (IsEnable(hWnd, 0)) + { + SmHubAdminOptionValueDlgUpdate(hWnd, a); + } + break; + + case WM_COMMAND: + switch (wParam) + { + case IDOK: + if (a->NewMode) + { + GetTxtA(hWnd, C_NAME, a->Name, sizeof(a->Name)); + } + + GetTxtA(hWnd, E_VALUE, tmp, sizeof(tmp)); + a->Value = ToInt(tmp); + + Trim(a->Name); + + if (StartWith(a->Name, "no") || StartWith(a->Name, "allow") || StartWith(a->Name, "deny") + || StartWith(a->Name, "filter") || StartWith(a->Name, "fix") || StartWith(a->Name, "force") + || StartWith(a->Name, "use") || StartWith(a->Name, "b_") || StartWith(a->Name, "is") + || StartWith(a->Name, "manage") || StartWith(a->Name, "yield") + || StartWith(a->Name, "permit") || StartWith(a->Name, "yes") || StartWith(a->Name, "ok") + || StartWith(a->Name, "do") || StartWith(a->Name, "only") || StartWith(a->Name, "disable")) + { + if (StrCmpi(tmp, "0") != 0 && StrCmpi(tmp, "1") != 0) + { + MsgBox(hWnd, MB_ICONEXCLAMATION, _UU("SM_TRUE_OR_FALSE")); + FocusEx(hWnd, E_VALUE); + break; + } + } + + EndDialog(hWnd, true); + break; + + case IDCANCEL: + Close(hWnd); + break; + } + + SmHubAdminOptionValueDlgUpdate(hWnd, a); + + break; + + case WM_CLOSE: + EndDialog(hWnd, false); + break; + } + + return 0; +} + +// Update the dialog controls for management option value +void SmHubAdminOptionValueDlgUpdate(HWND hWnd, SM_EDIT_AO *a) +{ + char tmp[MAX_SIZE]; + // Validate arguments + if (hWnd == NULL || a == NULL) + { + return; + } + + GetTxtA(hWnd, C_NAME, tmp, sizeof(tmp)); + + SetEnable(hWnd, IDOK, IsEmpty(hWnd, C_NAME) == false && IsEmpty(hWnd, E_VALUE) == false && + IsSafeStr(tmp)); +} + +// Initialize +void SmHubAdminOptionDlgInit(HWND hWnd, SM_EDIT_AO *a) +{ + UINT i; + // Validate arguments + if (hWnd == NULL || a == NULL) + { + return; + } + + SetIcon(hWnd, 0, ICO_USER_ADMIN); + + if (a->e->p->ServerAdminMode) + { + a->CanChange = true; + } + else + { + if (a->ExtOption == false) + { + for (i = 0;i < a->CurrentOptions.NumItem;i++) + { + if (StrCmpi(a->CurrentOptions.Items[i].Name, "allow_hub_admin_change_option") == 0) + { + if (a->CurrentOptions.Items[i].Value != 0) + { + a->CanChange = true; + } + } + } + } + else + { + a->CanChange = true; + } + } + + FormatText(hWnd, S_INFO, a->e->HubName); + + DlgFont(hWnd, S_BOLD, 0, true); + + LvInit(hWnd, L_LIST); + LvInsertColumn(hWnd, L_LIST, 0, _UU("SM_AO_COLUMN_1"), 260); + LvInsertColumn(hWnd, L_LIST, 1, _UU("SM_AO_COLUMN_2"), 100); + + for (i = 0;i < a->CurrentOptions.NumItem;i++) + { + ADMIN_OPTION *e = &a->CurrentOptions.Items[i]; + wchar_t tmp1[MAX_SIZE]; + wchar_t tmp2[MAX_SIZE]; + + StrToUni(tmp1, sizeof(tmp1), e->Name); + UniToStru(tmp2, e->Value); + + LvInsert(hWnd, L_LIST, ICO_LOG, NULL, 2, tmp1, tmp2); + + } + + if (a->ExtOption) + { + SetIcon(hWnd, S_ICON, ICO_LINK2); + SetIcon(hWnd, 0, ICO_LINK2); + + SetText(hWnd, 0, _UU("SM_HUBEXT_OPTION_TITLE")); + SetText(hWnd, S_STATIC1, _UU("SM_HUBEXT_OPTION_STATIC1")); + SetText(hWnd, S_STATIC2, _UU("SM_HUBEXT_OPTION_STATIC2")); + } + + // Update the control + SmHubAdminOptionDlgUpdate(hWnd, a); +} + +// Update the control +void SmHubAdminOptionDlgUpdate(HWND hWnd, SM_EDIT_AO *a) +{ + bool b = false; + wchar_t *helpstr; + // Validate arguments + if (hWnd == NULL || a == NULL) + { + return; + } + + helpstr = _UU("HUB_AO_CLICK"); + + SetEnable(hWnd, IDOK, a->CanChange); + SetEnable(hWnd, B_ADD, a->CanChange); + SetEnable(hWnd, B_EDIT, a->CanChange && (LvIsMasked(hWnd, L_LIST) && LvIsMultiMasked(hWnd, L_LIST) == false)); + + if (LvIsMasked(hWnd, L_LIST) && LvIsMultiMasked(hWnd, L_LIST) == false) + { + UINT i; + i = LvGetSelected(hWnd, L_LIST); + + if (a->CanChange) + { + + b = true; + + if (i != INFINITE) + { + char *name = LvGetStrA(hWnd, L_LIST, i, 0); + if (name != NULL) + { + UINT j; + + for (j = 0;j < a->DefaultOptions.NumItem;j++) + { + if (StrCmpi(a->DefaultOptions.Items[j].Name, name) == 0) + { + b = false; + } + } + Free(name); + } + } + } + + if (i != INFINITE) + { + char *name = LvGetStrA(hWnd, L_LIST, i, 0); + if (name != NULL) + { + helpstr = GetHubAdminOptionHelpString(name); + } + Free(name); + } + } + SetEnable(hWnd, B_DELETE, b); + + SetText(hWnd, E_HELP, helpstr); +} + +// Save +void SmHubAdminOptionDlgOk(HWND hWnd, SM_EDIT_AO *a) +{ + UINT i, num; + RPC_ADMIN_OPTION t; + // Validate arguments + if (hWnd == NULL || a == NULL) + { + return; + } + + num = LvNum(hWnd, L_LIST); + + Zero(&t, sizeof(t)); + + StrCpy(t.HubName, sizeof(t.HubName), a->e->HubName); + t.NumItem = num; + t.Items = ZeroMalloc(sizeof(ADMIN_OPTION) * num); + + for (i = 0;i < num;i++) + { + char *name = LvGetStrA(hWnd, L_LIST, i, 0); + char *s_value = LvGetStrA(hWnd, L_LIST, i, 1); + ADMIN_OPTION *a = &t.Items[i]; + + StrCpy(a->Name, sizeof(a->Name), name); + a->Value = ToInt(s_value); + + Free(name); + Free(s_value); + } + + if (a->ExtOption == false) + { + if (CALL(hWnd, ScSetHubAdminOptions(a->e->p->Rpc, &t))) + { + MsgBox(hWnd, MB_ICONINFORMATION, _UU("SM_AO_SET_OK")); + EndDialog(hWnd, true); + } + } + else + { + if (CALL(hWnd, ScSetHubExtOptions(a->e->p->Rpc, &t))) + { + MsgBox(hWnd, MB_ICONINFORMATION, _UU("SM_EXT_OPTION_SET_OK")); + EndDialog(hWnd, true); + } + } + + FreeRpcAdminOption(&t); +} + +// Virtual HUB Management Options dialog +UINT SmHubAdminOptionDlg(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param) +{ + SM_EDIT_AO *a = (SM_EDIT_AO *)param; + NMHDR *n; + UINT i; + // Validate arguments + if (hWnd == NULL) + { + return 0; + } + + switch (msg) + { + case WM_INITDIALOG: + SmHubAdminOptionDlgInit(hWnd, a); + break; + + case WM_COMMAND: + switch (wParam) + { + case B_ADD: + a->NewMode = true; + StrCpy(a->Name, sizeof(a->Name), ""); + a->Value = 0; + if (Dialog(hWnd, D_SM_AO_VALUE, SmHubAdminOptionValueDlg, + a)) + { + wchar_t tmp1[MAX_SIZE]; + wchar_t tmp2[MAX_SIZE]; + StrToUni(tmp1, sizeof(tmp1), a->Name); + UniToStru(tmp2, a->Value); + + LvInsert(hWnd, L_LIST, ICO_LOG, NULL, 2, tmp1, tmp2); + } + break; + + case B_EDIT: + i = LvGetSelected(hWnd, L_LIST); + if (i != INFINITE && a->CanChange) + { + char *name, *value; + name = LvGetStrA(hWnd, L_LIST, i, 0); + value = LvGetStrA(hWnd, L_LIST, i, 1); + a->NewMode = false; + StrCpy(a->Name, sizeof(a->Name), name); + a->Value = ToInt(value); + + if (Dialog(hWnd, D_SM_AO_VALUE, SmHubAdminOptionValueDlg, + a)) + { + char tmp[MAX_PATH]; + ToStr(tmp, a->Value); + LvSetItemA(hWnd, L_LIST, i, 1, tmp); + } + + Free(name); + Free(value); + } + break; + + case B_DELETE: + i = LvGetSelected(hWnd, L_LIST); + if (i != INFINITE) + { + LvDeleteItem(hWnd, L_LIST, i); + } + break; + + case IDCANCEL: + Close(hWnd); + break; + + case IDOK: + SmHubAdminOptionDlgOk(hWnd, a); + break; + } + break; + + case WM_NOTIFY: + n = (NMHDR *)lParam; + switch (n->idFrom) + { + case L_LIST: + switch (n->code) + { + case LVN_ITEMCHANGED: + SmHubAdminOptionDlgUpdate(hWnd, a); + break; + + case NM_DBLCLK: + Command(hWnd, B_EDIT); + break; + } + break; + } + break; + + case WM_CLOSE: + EndDialog(hWnd, 0); + break; + } + + return 0; +} + +// Virtual HUB extended options +void SmHubExtOption(HWND hWnd, SM_EDIT_HUB *e) +{ + SM_EDIT_AO a; + // Validate arguments + if (hWnd == NULL || e == NULL) + { + return; + } + + Zero(&a, sizeof(a)); + a.e = e; + a.ExtOption = true; + + StrCpy(a.CurrentOptions.HubName, sizeof(a.CurrentOptions.HubName), e->HubName); + + // Get the current options on the server + if (CALL(hWnd, ScGetHubExtOptions(e->p->Rpc, &a.CurrentOptions)) == false) + { + return; + } + + Dialog(hWnd, D_SM_ADMIN_OPTION, SmHubAdminOptionDlg, &a); + + FreeRpcAdminOption(&a.CurrentOptions); + FreeRpcAdminOption(&a.DefaultOptions); +} + +// Virtual HUB management options +void SmHubAdminOption(HWND hWnd, SM_EDIT_HUB *e) +{ + SM_EDIT_AO a; + // Validate arguments + if (hWnd == NULL || e == NULL) + { + return; + } + + Zero(&a, sizeof(a)); + a.e = e; + + StrCpy(a.CurrentOptions.HubName, sizeof(a.CurrentOptions.HubName), e->HubName); + + // Get the current options on the server + if (CALL(hWnd, ScGetHubAdminOptions(e->p->Rpc, &a.CurrentOptions)) == false) + { + return; + } + + ScGetDefaultHubAdminOptions(e->p->Rpc, &a.DefaultOptions); + + Dialog(hWnd, D_SM_ADMIN_OPTION, SmHubAdminOptionDlg, &a); + + FreeRpcAdminOption(&a.CurrentOptions); + FreeRpcAdminOption(&a.DefaultOptions); +} + +// Initialize +void SmConfigDlgInit(HWND hWnd, SM_CONFIG *c) +{ + wchar_t *tmp; + UINT tmp_size; + // Validate arguments + if (hWnd == NULL || c == NULL) + { + return; + } + + Focus(hWnd, IDCANCEL); + + SetIcon(hWnd, 0, ICO_MACHINE); + + SetFont(hWnd, E_CONFIG, GetFont(_SS("DEFAULT_FONT_2"), 0, false, false, + false, false)); + + FormatText(hWnd, IDC_INFO, c->s->ServerName); + + // Convert from UTF-8 to Unicode + tmp_size = CalcUtf8ToUni(c->Config.FileData, StrLen(c->Config.FileData)) + 1; + tmp = ZeroMalloc(tmp_size); + Utf8ToUni(tmp, tmp_size, c->Config.FileData, StrLen(c->Config.FileData)); + + SetText(hWnd, E_CONFIG, tmp); + + Free(tmp); +} + +// Config edit dialog +UINT SmConfigDlg(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param) +{ + SM_CONFIG *c = (SM_CONFIG *)param; + char *filename; + wchar_t *filename_unicode; + wchar_t tmp[MAX_SIZE]; + // Validate arguments + if (hWnd == NULL) + { + return 0; + } + + switch (msg) + { + case WM_INITDIALOG: + SmConfigDlgInit(hWnd, c); + break; + + case WM_COMMAND: + switch (wParam) + { + case B_EXPORT: + StrToUni(tmp, sizeof(tmp), c->Config.FileName); + filename_unicode = SaveDlg(hWnd, _UU("DLG_CONFIG_FILES"), _UU("DLG_SAVE_CONFIG"), tmp, L".config"); + if (filename_unicode != NULL) + { + BUF *b = NewBuf(); + filename = CopyUniToStr(filename_unicode); + WriteBuf(b, c->Config.FileData, StrLen(c->Config.FileData)); + if (DumpBuf(b, filename)) + { + MsgBox(hWnd, MB_ICONINFORMATION, _UU("SM_CONFIG_SAVED")); + } + else + { + MsgBox(hWnd, MB_ICONSTOP, _UU("SM_CONFIG_SAVE_FAILED")); + } + FreeBuf(b); + Free(filename); + Free(filename_unicode); + } + break; + + case B_IMPORT: + filename_unicode = OpenDlg(hWnd, _UU("DLG_CONFIG_FILES"), _UU("DLG_OPEN_CONFIG")); + if (filename_unicode != NULL) + { + BUF *b; + filename = CopyUniToStr(filename_unicode); + b = ReadDump(filename); + if (b != NULL) + { + RPC_CONFIG t; + + if (MsgBox(hWnd, MB_ICONQUESTION | MB_YESNO, _UU("SM_CONFIG_CONFIRM")) == IDYES) + { + Zero(&t, sizeof(t)); + t.FileData = ZeroMalloc(b->Size + 1); + Copy(t.FileData, b->Buf, b->Size); + + if (CALL(hWnd, ScSetConfig(c->s->Rpc, &t))) + { + // Success + MsgBox(hWnd, MB_ICONINFORMATION, _UU("SM_CONFIG_WRITE_OK")); + _exit(0); + } + + FreeRpcConfig(&t); + + FreeRpcConfig(&t); + FreeBuf(b); + } + } + else + { + MsgBox(hWnd, MB_ICONSTOP, _UU("SM_CONFIG_OPEN_FAILED")); + } + Free(filename); + Free(filename_unicode); + } + break; + + case IDCANCEL: + Close(hWnd); + break; + + case B_FACTORY: + if (MsgBox(hWnd, MB_ICONWARNING | MB_YESNO | MB_DEFBUTTON2, _UU("SM_FACTORY_DEFAULT_WARNING")) == IDYES) + { + RPC_TEST t; + UINT ret; + + Zero(&t, sizeof(t)); + + t.IntValue = 1; + ret = ScRebootServer(c->s->Rpc, &t); + + if (ret == ERR_DISCONNECTED || ret == ERR_NO_ERROR) + { + MsgBox(hWnd, MB_ICONINFORMATION, _UU("SM_FACTORY_DEFAULT_PERFORMED")); + + exit(0); + } + else + { + CALL(hWnd, ret); + } + } + break; + } + break; + + case WM_CLOSE: + EndDialog(hWnd, 0); + break; + } + + return 0; +} + +// Show the config edit dialog +void SmConfig(HWND hWnd, SM_SERVER *s) +{ + SM_CONFIG c; + // Validate arguments + if (hWnd == NULL || s == NULL) + { + return; + } + + Zero(&c, sizeof(c)); + + c.s = s; + + // Get current config from the server + if (CALL(hWnd, ScGetConfig(s->Rpc, &c.Config)) == false) + { + return; + } + + // Show the dialog + Dialog(hWnd, D_SM_CONFIG, SmConfigDlg, &c); + + // Release + FreeRpcConfig(&c.Config); +} + +// Bridge dialog initialization +UINT SmBridgeDlgInit(HWND hWnd, SM_SERVER *s) +{ + UINT i; + RPC_ENUM_ETH t; + RPC_SERVER_INFO si; + UINT num = 0; + // Validate arguments + if (hWnd == NULL || s == NULL) + { + return 0; + } + + LvInit(hWnd, L_LIST); + LvInsertColumn(hWnd, L_LIST, 0, _UU("SM_BRIDGE_COLUMN_1"), 50); + LvInsertColumn(hWnd, L_LIST, 1, _UU("SM_BRIDGE_COLUMN_2"), 145); + LvInsertColumn(hWnd, L_LIST, 2, _UU("SM_BRIDGE_COLUMN_3"), 300); + LvInsertColumn(hWnd, L_LIST, 3, _UU("SM_BRIDGE_COLUMN_4"), 100); + + SmBridgeDlgRefresh(hWnd, s); + + SetShow(hWnd, B_VLAN, GetCapsBool(s->CapsList, "b_support_eth_vlan")); + + SetIcon(hWnd, 0, ICO_BRIDGE); + + // Get the server information + Zero(&si, sizeof(si)); + ScGetServerInfo(s->Rpc, &si); + if (GetCapsBool(s->CapsList, "b_tap_supported") == false) + { + // Tap does not supported + Hide(hWnd, R_TAP); + Hide(hWnd, S_TAP_1); + Hide(hWnd, E_TAPNAME); + Hide(hWnd, S_TAP_2); + Hide(hWnd, R_BRIDGE); + Hide(hWnd, S_STATIC5); + } + Check(hWnd, R_BRIDGE, true); + FreeRpcServerInfo(&si); + + // Enumerate the Ethernet devices + Zero(&t, sizeof(t)); + ScEnumEthernet(s->Rpc, &t); + + CbReset(hWnd, E_NICNAME); + CbSetHeight(hWnd, E_NICNAME, 18); + + num = t.NumItem; + + for (i = 0;i < t.NumItem;i++) + { + RPC_ENUM_ETH_ITEM *e = &t.Items[i]; + if (GetCapsBool(s->CapsList, "b_support_network_connection_name")) + { + wchar_t ncname[MAX_SIZE * 2]; + UniFormat(ncname, sizeof(ncname), BRIDGE_NETWORK_CONNECTION_STR, e->NetworkConnectionName, e->DeviceName); + CbAddStr(hWnd, E_NICNAME, ncname, 0); + } + else + { + wchar_t *s = CopyStrToUni(e->DeviceName); + CbAddStr(hWnd, E_NICNAME, s, 0); + Free(s); + } + } + + FreeRpcEnumEth(&t); + + // Enumerate the Virtual HUBs + { + RPC_ENUM_HUB t; + Zero(&t, sizeof(t)); + + ScEnumHub(s->Rpc, &t); + + CbReset(hWnd, E_HUBNAME); + CbSetHeight(hWnd, E_HUBNAME, 18); + + for (i = 0;i < t.NumHub;i++) + { + RPC_ENUM_HUB_ITEM *e = &t.Hubs[i]; + wchar_t *s = CopyStrToUni(e->HubName); + + if (e->HubType != HUB_TYPE_FARM_DYNAMIC) + { + CbAddStr(hWnd, E_HUBNAME, s, 0); + } + Free(s); + } + + SetText(hWnd, E_HUBNAME, L""); + + FreeRpcEnumHub(&t); + } + + if (s->Bridge) + { + SetTextA(hWnd, E_HUBNAME, "BRIDGE"); + } + + Focus(hWnd, E_HUBNAME); + + SmBridgeDlgUpdate(hWnd, s); + + SetTimer(hWnd, 1, 1000, NULL); + + return num; +} + +// Bridge dialog control update +void SmBridgeDlgUpdate(HWND hWnd, SM_SERVER *s) +{ + bool ok = true; + // Validate arguments + if (hWnd == NULL || s == NULL) + { + return; + } + + if (LvIsMasked(hWnd, L_LIST) && LvIsMultiMasked(hWnd, L_LIST) == false) + { + Enable(hWnd, B_DELETE); + } + else + { + Disable(hWnd, B_DELETE); + } + + if (IsEmpty(hWnd, E_HUBNAME)) + { + ok = false; + } + + if (IsChecked(hWnd, R_TAP) == false) + { + // Bridge mode + Enable(hWnd, S_ETH_1); + Enable(hWnd, E_NICNAME); + Disable(hWnd, S_TAP_1); + Disable(hWnd, S_TAP_2); + Disable(hWnd, E_TAPNAME); + SetText(hWnd, S_INFO, _UU("SM_BRIDGE_INFO_1")); + SetIcon(hWnd, S_ICON, ICO_NIC_ONLINE); + if (IsEmpty(hWnd, E_NICNAME)) + { + ok = false; + } + } + else + { + char tmp[MAX_SIZE]; + // Tap mode + Disable(hWnd, S_ETH_1); + Disable(hWnd, E_NICNAME); + Enable(hWnd, S_TAP_1); + Enable(hWnd, S_TAP_2); + Enable(hWnd, E_TAPNAME); + SetText(hWnd, S_INFO, _UU("SM_BRIDGE_INFO_2")); + SetIcon(hWnd, S_ICON, ICO_PROTOCOL); + GetTxtA(hWnd, E_TAPNAME, tmp, sizeof(tmp)); + if (IsEmptyStr(tmp)) + { + ok = false; + } + else + { + if (IsSafeStr(tmp) == false) + { + ok = false; + } + if (StrLen(tmp) >= 12) + { + ok = false; + } + } + } + + SetEnable(hWnd, IDOK, ok); +} + +// Bridge dialog update +void SmBridgeDlgRefresh(HWND hWnd, SM_SERVER *s) +{ + LVB *lvb; + RPC_ENUM_LOCALBRIDGE t; + UINT i; + // Validate arguments + if (hWnd == NULL || s == NULL) + { + return; + } + + lvb = LvInsertStart(); + + Zero(&t, sizeof(t)); + + ScEnumLocalBridge(s->Rpc, &t); + + for (i = 0;i < t.NumItem;i++) + { + RPC_LOCALBRIDGE *e = &t.Items[i]; + wchar_t name[MAX_SIZE]; + wchar_t nic[MAX_SIZE]; + wchar_t hub[MAX_SIZE]; + wchar_t *status = _UU("SM_BRIDGE_OFFLINE"); + + UniToStru(name, i + 1); + StrToUni(nic, sizeof(nic), e->DeviceName); + StrToUni(hub, sizeof(hub), e->HubName); + + if (e->Online) + { + status = e->Active ? _UU("SM_BRIDGE_ONLINE") : _UU("SM_BRIDGE_ERROR"); + } + + LvInsertAdd(lvb, e->TapMode == false ? (e->Active ? ICO_NIC_ONLINE : ICO_NIC_OFFLINE) : ICO_PROTOCOL, + NULL, 4, name, hub, nic, status); + } + + FreeRpcEnumLocalBridge(&t); + + LvInsertEnd(lvb, hWnd, L_LIST); + + SmBridgeDlgUpdate(hWnd, s); +} + +// Add a Local Bridge +void SmBridgeDlgOnOk(HWND hWnd, SM_SERVER *s) +{ + char nic[MAX_SIZE]; + char hub[MAX_SIZE]; + RPC_LOCALBRIDGE t; + bool tapmode = false; + // Validate arguments + if (hWnd == NULL || s == NULL) + { + return; + } + + GetTxtA(hWnd, E_HUBNAME, hub, sizeof(hub)); + + Zero(nic, sizeof(nic)); + + if (IsChecked(hWnd, R_TAP) == false) + { + wchar_t nctmp[MAX_SIZE * 2]; + if(GetCapsBool(s->CapsList, "b_support_network_connection_name") && GetTxt(hWnd, E_NICNAME, nctmp, sizeof(nctmp))) + { + RPC_ENUM_ETH et; + UINT i; + Zero(&et, sizeof(et)); + ScEnumEthernet(s->Rpc, &et); + for(i = 0; i < et.NumItem; i++) + { + RPC_ENUM_ETH_ITEM *e = &et.Items[i]; + if(UniIsEmptyStr(e->NetworkConnectionName) == false) + { + wchar_t ncname[MAX_SIZE * 2]; + UniFormat(ncname, sizeof(ncname), BRIDGE_NETWORK_CONNECTION_STR, e->NetworkConnectionName, e->DeviceName); + if(UniStrCmp(ncname, nctmp) == 0) + { + StrCpy(nic, sizeof(nic), e->DeviceName); + break; + } + } + } + FreeRpcEnumEth(&et); + + if (IsEmptyStr(nic)) + { + GetTxtA(hWnd, E_NICNAME, nic, sizeof(nic)); + } + } + else + { + GetTxtA(hWnd, E_NICNAME, nic, sizeof(nic)); + } + } + else + { + tapmode = true; + GetTxtA(hWnd, E_TAPNAME, nic, sizeof(nic)); + } + + Trim(hub); + Trim(nic); + + Zero(&t, sizeof(t)); + StrCpy(t.DeviceName, sizeof(t.DeviceName), nic); + StrCpy(t.HubName, sizeof(t.HubName), hub); + t.TapMode = tapmode; + + if (InStrEx(t.DeviceName, "vpn", false) || InStrEx(t.DeviceName, "tun", false) + || InStrEx(t.DeviceName, "tap", false)) + { + // Trying to make a local bridge to the VPN device + if (MsgBoxEx(hWnd, MB_ICONEXCLAMATION | MB_YESNO | MB_DEFBUTTON2, + _UU("SM_BRIDGE_VPN"), + t.DeviceName) == IDNO) + { + return; + } + } + + // Show a warning message if the VPN Server is running in a VM + if (GetCapsBool(s->CapsList, "b_is_in_vm")) + { + Dialog(hWnd, D_SM_VMBRIDGE, SmVmBridgeDlg, NULL); + } + + // Warning for such as Intel LAN cards + if (tapmode == false) + { + MsgBox(hWnd, MB_ICONINFORMATION, _UU("SM_BRIDGE_INTEL")); + } + + if (CALL(hWnd, ScAddLocalBridge(s->Rpc, &t)) == false) + { + Focus(hWnd, E_HUBNAME); + return; + } + + SetText(hWnd, E_HUBNAME, L""); + Focus(hWnd, E_HUBNAME); + + if (tapmode) + { + SetTextA(hWnd, E_TAPNAME, ""); + } + + SmBridgeDlgRefresh(hWnd, s); + + MsgBox(hWnd, MB_ICONINFORMATION, _UU("SM_BRIDGE_OK")); +} + +// Bridge dialog procedure +UINT SmBridgeDlgProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param) +{ + NMHDR *n; + SM_SERVER *s = (SM_SERVER *)param; + UINT i; + UINT num; + // Validate arguments + if (hWnd == NULL) + { + return 0; + } + + switch (msg) + { + case WM_INITDIALOG: + num = SmBridgeDlgInit(hWnd, s); + + if (num == 0) + { + SetTimer(hWnd, 2, 500, NULL); + } + break; + + case WM_COMMAND: + switch (LOWORD(wParam)) + { + case E_HUBNAME: + case E_NICNAME: + case R_BRIDGE: + case R_TAP: + case E_TAPNAME: + SmBridgeDlgUpdate(hWnd, s); + break; + } + + switch (wParam) + { + case R_BRIDGE: + Focus(hWnd, E_NICNAME); + break; + + case R_TAP: + FocusEx(hWnd, E_TAPNAME); + break; + + case IDOK: + // Add + SmBridgeDlgOnOk(hWnd, s); + break; + + case IDCANCEL: + // Close + Close(hWnd); + break; + + case B_VLAN: + // VLAN utility + SmVLan(hWnd, s); + break; + + case B_DELETE: + // Delete + i = LvGetSelected(hWnd, L_LIST); + if (i != INFINITE) + { + wchar_t *nic, *hub; + wchar_t tmp[MAX_SIZE]; + RPC_LOCALBRIDGE t; + + hub = LvGetStr(hWnd, L_LIST, i, 1); + nic = LvGetStr(hWnd, L_LIST, i, 2); + + UniFormat(tmp, sizeof(tmp), _UU("SM_BRIDGE_DELETE"), + hub, nic); + + if (MsgBox(hWnd, MB_ICONEXCLAMATION | MB_YESNO | MB_DEFBUTTON2, tmp) == IDYES) + { + Zero(&t, sizeof(t)); + UniToStr(t.DeviceName, sizeof(t.DeviceName), nic); + UniToStr(t.HubName, sizeof(t.HubName), hub); + + if (CALL(hWnd, ScDeleteLocalBridge(s->Rpc, &t))) + { + MsgBox(hWnd, MB_ICONINFORMATION, _UU("SM_BRIDGE_DELETE_OK")); + SmBridgeDlgRefresh(hWnd, s); + } + } + + Free(hub); + Free(nic); + } + break; + } + break; + + case WM_TIMER: + switch (wParam) + { + case 1: + if (IsEnable(hWnd, 0)) + { + KillTimer(hWnd, 1); + SmBridgeDlgRefresh(hWnd, s); + SetTimer(hWnd, 1, 1000, NULL); + } + break; + + case 2: + KillTimer(hWnd, 2); + + MsgBox(hWnd, MB_ICONINFORMATION, _UU("SM_NO_BRIDGE_NICS")); + break; + } + break; + + case WM_NOTIFY: + n = (NMHDR *)lParam; + switch (n->code) + { + case LVN_ITEMCHANGED: + switch (n->idFrom) + { + case L_LIST: + SmBridgeDlgUpdate(hWnd, s); + break; + } + break; + } + break; + + case WM_CLOSE: + EndDialog(hWnd, false); + break; + } + + return 0; +} + +// Installation of WinPcap +void SmInstallWinPcap(HWND hWnd, SM_SERVER *s) +{ + wchar_t temp_name[MAX_SIZE]; + IO *io; + BUF *buf; + + // Ask whether the user want to start the installation + if (MsgBox(hWnd, MB_ICONQUESTION | MB_YESNO, _UU("SM_BRIDGE_WPCAP_INSTALL")) == IDNO) + { + return; + } + + // Generate a temporary file name + UniFormat(temp_name, sizeof(temp_name), L"%s\\winpcap_installer.exe", MsGetTempDirW()); + + // Read from hamcore + buf = ReadDump(MsIsNt() ? "|winpcap_installer.exe" : "|winpcap_installer_win9x.exe"); + if (buf == NULL) + { +RES_ERROR: + MsgBox(hWnd, MB_ICONSTOP, _UU("SM_BRIDGE_RESOURCE")); + return; + } + + // Write to a temporary file + io = FileCreateW(temp_name); + if (io == NULL) + { + FreeBuf(buf); + goto RES_ERROR; + } + + FileWrite(io, buf->Buf, buf->Size); + FileClose(io); + + FreeBuf(buf); + + // Run + if (RunW(temp_name, NULL, false, true) == false) + { + // Failure + FileDeleteW(temp_name); + goto RES_ERROR; + } + + FileDeleteW(temp_name); + + if (s == NULL) + { + return; + } + + // Message after completed + if (OS_IS_WINDOWS_NT(GetOsInfo()->OsType) == false) + { + // Need to restart the computer + MsgBox(hWnd, MB_ICONINFORMATION, _UU("SM_BRIDGE_WPCAP_REBOOT1")); + } + else + { + // Need to restart the service + if (MsgBox(hWnd, MB_ICONQUESTION | MB_YESNO, _UU("SM_BRIDGE_WPCAP_REBOOT2")) == IDNO) + { + // Not restart + } + else + { + // Restart + RPC_TEST t; + Zero(&t, sizeof(t)); + ScRebootServer(s->Rpc, &t); + + SleepThread(500); + + Zero(&t, sizeof(t)); + CALL(hWnd, ScTest(s->Rpc, &t)); + } + } +} + +// Bridge dialog +void SmBridgeDlg(HWND hWnd, SM_SERVER *s) +{ + RPC_BRIDGE_SUPPORT t; + // Validate arguments + if (hWnd == NULL || s == NULL) + { + return; + } + + // Examine the bridge support status of the server side first + Zero(&t, sizeof(t)); + if (CALLEX(hWnd, ScGetBridgeSupport(s->Rpc, &t)) != ERR_NO_ERROR) + { + // Not supported because it is old version + MsgBox(hWnd, MB_ICONEXCLAMATION, _UU("SM_BRIDGE_TOO_OLD_VER")); + return; + } + + if (t.IsBridgeSupportedOs == false) + { + // OS does not support the bridge + MsgBox(hWnd, MB_ICONEXCLAMATION, _UU("SM_BRIDGE_UNSUPPORTED")); + return; + } + + if (t.IsWinPcapNeeded) + { + if (s->Rpc->Sock->RemoteIP.addr[0] != 127) + { + // WinPcap is required, but can not do anything because it is in remote control mode + MsgBox(hWnd, MB_ICONINFORMATION, _UU("SM_BRIDGE_WPCAP_REMOTE")); + return; + } + else + { + // WinPcap is required, and it's in local management mode + if (MsIsAdmin()) + { + // The user is an Administrators + SmInstallWinPcap(hWnd, s); + return; + } + else + { + // The user is a non-Administrators + MsgBox(hWnd, MB_ICONINFORMATION, _UU("SM_BRIDGE_WPCAP_ROOT")); + return; + } + } + } + + Dialog(hWnd, D_SM_BRIDGE, SmBridgeDlgProc, s); +} + +// SecureNAT screen update +void SmSNATDlgUpdate(HWND hWnd, SM_HUB *s) +{ + bool b; + RPC_HUB_STATUS t; + // Validate arguments + if (hWnd == NULL || s == NULL) + { + return; + } + + Zero(&t, sizeof(t)); + StrCpy(t.HubName, sizeof(t.HubName), s->HubName); + if (CALL(hWnd, ScGetHubStatus(s->Rpc, &t)) == false) + { + Close(hWnd); + return; + } + + b = t.SecureNATEnabled; + + if (b) + { + Disable(hWnd, B_ENABLE); + Enable(hWnd, B_DISABLE); + Enable(hWnd, B_NAT); + Enable(hWnd, B_DHCP); + Enable(hWnd, B_STATUS); + } + else + { + Enable(hWnd, B_ENABLE); + Disable(hWnd, B_DISABLE); + Disable(hWnd, B_NAT); + Disable(hWnd, B_DHCP); + Disable(hWnd, B_STATUS); + } +} + +// SecureNAT configuration screen +UINT SmSNATDlgProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param) +{ + SM_HUB *s = (SM_HUB *)param; + RPC_HUB t; + // Validate arguments + if (hWnd == NULL) + { + return 0; + } + + switch (msg) + { + case WM_INITDIALOG: + SetIcon(hWnd, 0, ICO_ROUTER); + DlgFont(hWnd, S_WARNING, (_GETLANG() == 0 || _GETLANG() == 2) ? 13 : 10, true); + FormatText(hWnd, S_TITLE, s->HubName); + SmSNATDlgUpdate(hWnd, s); + + SetTimer(hWnd, 1, 1000, NULL); + break; + + case WM_TIMER: + if (wParam == 1) + { + if (IsEnable(hWnd, 0)) + { + KillTimer(hWnd, 1); + + SmSNATDlgUpdate(hWnd, s); + + SetTimer(hWnd, 1, 1000, NULL); + } + } + break; + + case WM_COMMAND: + switch (wParam) + { + case IDCANCEL: + Close(hWnd); + break; + + case B_ENABLE: + if (MsgBox(hWnd, MB_ICONEXCLAMATION | MB_OKCANCEL | MB_DEFBUTTON2, + _UU("SM_SECURE_NAT_MSG")) == IDOK) + { + Zero(&t, sizeof(t)); + StrCpy(t.HubName, sizeof(t.HubName), s->HubName); + CALL(hWnd, ScEnableSecureNAT(s->Rpc, &t)); + SmSNATDlgUpdate(hWnd, s); + } + break; + + case B_DISABLE: + Zero(&t, sizeof(t)); + StrCpy(t.HubName, sizeof(t.HubName), s->HubName); + CALL(hWnd, ScDisableSecureNAT(s->Rpc, &t)); + SmSNATDlgUpdate(hWnd, s); + break; + + case B_CONFIG: + NmEditVhOption(hWnd, s); + break; + + case B_NAT: + NmNat(hWnd, s); + break; + + case B_DHCP: + NmDhcp(hWnd, s); + break; + + case B_STATUS: + SmStatusDlg(hWnd, s->p, s, false, true, _UU("SM_SNAT_STATUS"), ICO_ROUTER, + NULL, NmStatus); + break; + } + break; + + case WM_CLOSE: + EndDialog(hWnd, 0); + break; + } + + return 0; +} + +// Initialize +void SmCreateCertDlgInit(HWND hWnd, SM_CERT *s) +{ + UINT cert_sign; + UINT cert_days; + char *reg_o, *reg_ou, *reg_c, *reg_st, *reg_l; + UINT bits[] = {1024, 1536, 2048, 3072, 4096 }; + UINT i; + UINT last_bit; + // Validate arguments + if (hWnd == NULL || s == NULL) + { + return; + } + + SetTextA(hWnd, E_CN, s->default_cn); + + last_bit = MsRegReadInt(REG_CURRENT_USER, SM_CERT_REG_KEY, "Bits"); + if (last_bit == 0) + { + last_bit = 2048; + } + + CbReset(hWnd, C_BITS); + for (i = 0;i < sizeof(bits) / sizeof(bits[0]);i++) + { + char tmp[MAX_PATH]; + UINT index; + + ToStr(tmp, bits[i]); + + index = CbAddStrA(hWnd, C_BITS, tmp, bits[i]); + } + + CbSelect(hWnd, C_BITS, 1024); + CbSelect(hWnd, C_BITS, last_bit); + + reg_o = MsRegReadStr(REG_CURRENT_USER, SM_CERT_REG_KEY, "O"); + reg_ou = MsRegReadStr(REG_CURRENT_USER, SM_CERT_REG_KEY, "OU"); + reg_c = MsRegReadStr(REG_CURRENT_USER, SM_CERT_REG_KEY, "C"); + reg_st = MsRegReadStr(REG_CURRENT_USER, SM_CERT_REG_KEY, "ST"); + reg_l = MsRegReadStr(REG_CURRENT_USER, SM_CERT_REG_KEY, "L"); + SetTextA(hWnd, E_O, reg_o); + SetTextA(hWnd, E_OU, reg_ou); + SetTextA(hWnd, E_C, reg_c); + SetTextA(hWnd, E_ST, reg_st); + SetTextA(hWnd, E_L, reg_l); + Free(reg_o); + Free(reg_ou); + Free(reg_c); + Free(reg_st); + Free(reg_l); + + LimitText(hWnd, E_C, 2); + + cert_sign = MsRegReadInt(REG_CURRENT_USER, SM_CERT_REG_KEY, "Sign"); + cert_days = MsRegReadInt(REG_CURRENT_USER, SM_CERT_REG_KEY, "Days"); + + Check(hWnd, R_ROOT_CERT, cert_sign ? false : true); + Check(hWnd, R_SIGNED_CERT, cert_sign ? true : false); + + if (cert_days == 0) + { + cert_days = 3650; + } + + SetIntEx(hWnd, E_EXPIRE, cert_days); + + SmCreateCertDlgUpdate(hWnd, s); + + if (s->root_only) + { + Disable(hWnd, R_SIGNED_CERT); + } + + // Font + SetFont(hWnd, E_CN, GetFont((MsIsWinXPOrGreater() ? "Verdana" : NULL), 0, false, false, false, false)); + SetFont(hWnd, E_O, GetFont((MsIsWinXPOrGreater() ? "Verdana" : NULL), 0, false, false, false, false)); + SetFont(hWnd, E_OU, GetFont((MsIsWinXPOrGreater() ? "Verdana" : NULL), 0, false, false, false, false)); + SetFont(hWnd, E_C, GetFont((MsIsWinXPOrGreater() ? "Verdana" : NULL), 0, false, false, false, false)); + SetFont(hWnd, E_ST, GetFont((MsIsWinXPOrGreater() ? "Verdana" : NULL), 0, false, false, false, false)); + SetFont(hWnd, E_L, GetFont((MsIsWinXPOrGreater() ? "Verdana" : NULL), 0, false, false, false, false)); + SetFont(hWnd, E_SERIAL, GetFont((MsIsWinXPOrGreater() ? "Verdana" : NULL), 0, false, false, false, false)); + SetFont(hWnd, E_EXPIRE, GetFont((MsIsWinXPOrGreater() ? "Verdana" : NULL), 0, false, false, false, false)); + SetFont(hWnd, C_BITS, GetFont("Verdana", 0, false, false, false, false)); + + FocusEx(hWnd, E_CN); +} + +// Update +void SmCreateCertDlgUpdate(HWND hWnd, SM_CERT *s) +{ + bool ok = true; + bool b; + UINT i; + // Validate arguments + if (hWnd == NULL || s == NULL) + { + return; + } + + if (IsEmpty(hWnd, E_CN) && IsEmpty(hWnd, E_O) && IsEmpty(hWnd, E_OU) && + IsEmpty(hWnd, E_ST) && IsEmpty(hWnd, E_L)) + { + ok = false; + } + + i = GetInt(hWnd, E_EXPIRE); + if (i == 0 || i >= (365 * 30)) + { + ok = false; + } + + b = IsChecked(hWnd, R_SIGNED_CERT); + + SetEnable(hWnd, S_LOAD_1, b); + SetEnable(hWnd, B_LOAD, b); + SetEnable(hWnd, S_LOAD_2, b); + + if (b && (s->root_k == NULL || s->root_x == NULL)) + { + ok = false; + } + + SetEnable(hWnd, IDOK, ok); +} + +// [OK] button +void SmCreateCertDlgOnOk(HWND hWnd, SM_CERT *s) +{ + wchar_t cn[MAX_SIZE], o[MAX_SIZE], ou[MAX_SIZE], c[MAX_SIZE], st[MAX_SIZE], l[MAX_SIZE]; + char *reg_o, *reg_ou, *reg_c, *reg_st, *reg_l; + UINT days; + bool sign; + char serial[MAX_SIZE * 2]; + X *x; + K *pub; + K *pri; + NAME *n; + X_SERIAL *x_serial; + BUF *buf; + UINT bits; + // Validate arguments + if (hWnd == NULL || s == NULL) + { + return; + } + + GetTxt(hWnd, E_CN, cn, sizeof(cn)); + GetTxt(hWnd, E_O, o, sizeof(o)); + GetTxt(hWnd, E_OU, ou, sizeof(ou)); + GetTxt(hWnd, E_C, c, sizeof(c)); + GetTxt(hWnd, E_ST, st, sizeof(st)); + GetTxt(hWnd, E_L, l, sizeof(l)); + GetTxtA(hWnd, E_SERIAL, serial, sizeof(serial)); + + bits = CbGetSelect(hWnd, C_BITS); + if (bits == INFINITE) + { + bits = 1024; + } + + buf = StrToBin(serial); + if (buf == NULL) + { + return; + } + + if (buf->Size > 1) + { + x_serial = NewXSerial(buf->Buf, buf->Size); + } + else + { + x_serial = NULL; + } + + FreeBuf(buf); + + n = NewName(UniStrLen(cn) ? cn : NULL, + UniStrLen(o) ? o : NULL, + UniStrLen(ou) ? ou : NULL, + UniStrLen(c) ? c : NULL, + UniStrLen(st) ? st : NULL, + UniStrLen(l) ? l : NULL); + + days = GetInt(hWnd, E_EXPIRE); + + sign = IsChecked(hWnd, R_SIGNED_CERT); + + MsRegWriteInt(REG_CURRENT_USER, SM_CERT_REG_KEY, "Sign", sign); + MsRegWriteInt(REG_CURRENT_USER, SM_CERT_REG_KEY, "Days", days); + MsRegWriteInt(REG_CURRENT_USER, SM_CERT_REG_KEY, "Bits", bits); + + RsaGen(&pri, &pub, bits); + + if (sign == false) + { + x = NewRootX(pub, pri, n, days, x_serial); + } + else + { + x = NewX(pub, s->root_k, s->root_x, n, days, x_serial); + } + + FreeName(n); + + FreeXSerial(x_serial); + + if (x == NULL) + { + FreeX(x); + FreeK(pub); + FreeK(pri); + return; + } + + if (s->do_not_save == false) + { + if (SmSaveKeyPairDlg(hWnd, x, pri) == false) + { + FreeX(x); + FreeK(pub); + FreeK(pri); + return; + } + } + + s->x = x; + s->k = pri; + FreeK(pub); + + reg_o = GetTextA(hWnd, E_O); + reg_ou = GetTextA(hWnd, E_OU); + reg_c = GetTextA(hWnd, E_C); + reg_st = GetTextA(hWnd, E_ST); + reg_l = GetTextA(hWnd, E_L); + MsRegWriteStr(REG_CURRENT_USER, SM_CERT_REG_KEY, "O", reg_o); + MsRegWriteStr(REG_CURRENT_USER, SM_CERT_REG_KEY, "OU", reg_ou); + MsRegWriteStr(REG_CURRENT_USER, SM_CERT_REG_KEY, "C", reg_c); + MsRegWriteStr(REG_CURRENT_USER, SM_CERT_REG_KEY, "ST", reg_st); + MsRegWriteStr(REG_CURRENT_USER, SM_CERT_REG_KEY, "L", reg_l); + Free(reg_o); + Free(reg_ou); + Free(reg_c); + Free(reg_st); + Free(reg_l); + + EndDialog(hWnd, true); +} + +// Certificate creation screen +UINT SmCreateCertDlgProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param) +{ + SM_CERT *s = (SM_CERT *)param; + // Validate arguments + if (hWnd == NULL) + { + return 0; + } + + switch (msg) + { + case WM_INITDIALOG: + // Initialize + SmCreateCertDlgInit(hWnd, s); + break; + + case WM_COMMAND: + switch (LOWORD(wParam)) + { + case R_ROOT_CERT: + case R_SIGNED_CERT: + case B_LOAD: + case E_CN: + case E_O: + case E_OU: + case E_C: + case E_ST: + case E_L: + case E_EXPIRE: + SmCreateCertDlgUpdate(hWnd, s); + break; + } + + switch (wParam) + { + case IDOK: + // [OK] button + SmCreateCertDlgOnOk(hWnd, s); + break; + + case R_ROOT_CERT: + if (IsChecked(hWnd, R_ROOT_CERT)) + { + FocusEx(hWnd, E_CN); + } + break; + + case B_LOAD: + // Read a certificate + if (1) + { + X *x; + K *k; + if (CmLoadXAndK(hWnd, &x, &k)) + { + wchar_t tmp[MAX_SIZE]; + FreeX(s->root_x); + FreeK(s->root_k); + s->root_x = x; + s->root_k = k; + + SmGetCertInfoStr(tmp, sizeof(tmp), x); + SetText(hWnd, S_LOAD_2, tmp); + SmCreateCertDlgUpdate(hWnd, s); + } + } + break; + + case IDCANCEL: + // Cancel button + Close(hWnd); + break; + } + break; + + case WM_CLOSE: + EndDialog(hWnd, false); + break; + } + + return 0; +} + +// Certificate tool +bool SmCreateCert(HWND hWnd, X **x, K **k, bool do_not_save, char *default_cn, bool root_only) +{ + bool ret; + SM_CERT s; + Zero(&s, sizeof(s)); + + if (default_cn == NULL) + { + default_cn = ""; + } + + s.default_cn = default_cn; + + s.do_not_save = do_not_save; + + s.root_only = root_only; + + ret = Dialog(hWnd, D_SM_CREATE_CERT, SmCreateCertDlgProc, &s); + + if (ret) + { + if (x != NULL) + { + *x = CloneX(s.x); + } + + if (k != NULL) + { + *k = CloneK(s.k); + } + } + + FreeX(s.x); + FreeK(s.k); + FreeX(s.root_x); + FreeK(s.root_k); + + return ret; +} + +// Initialize +void SmIpTableDlgInit(HWND hWnd, SM_TABLE *s) +{ + // Validate arguments + if (hWnd == NULL || s == NULL) + { + return; + } + + SetIcon(hWnd, 0, ICO_PROTOCOL); + FormatText(hWnd, S_TITLE, s->Hub->HubName); + + if (s->SessionName != NULL) + { + wchar_t tmp[MAX_SIZE]; + wchar_t tmp2[MAX_SIZE]; + GetTxt(hWnd, S_TITLE, tmp, sizeof(tmp)); + UniFormat(tmp2, sizeof(tmp2), _UU("SM_SESSION_FILTER"), s->SessionName); + UniStrCat(tmp, sizeof(tmp), tmp2); + SetText(hWnd, S_TITLE, tmp); + } + + LvInit(hWnd, L_TABLE); + LvInsertColumn(hWnd, L_TABLE, 0, _UU("SM_IP_COLUMN_1"), 190); + LvInsertColumn(hWnd, L_TABLE, 1, _UU("SM_IP_COLUMN_2"), 140); + LvInsertColumn(hWnd, L_TABLE, 2, _UU("SM_IP_COLUMN_3"), 133); + LvInsertColumn(hWnd, L_TABLE, 3, _UU("SM_IP_COLUMN_4"), 133); + LvInsertColumn(hWnd, L_TABLE, 4, _UU("SM_IP_COLUMN_5"), 133); + LvSetStyle(hWnd, L_TABLE, LVS_EX_GRIDLINES); + + SmIpTableDlgRefresh(hWnd, s); +} + +// Update the control +void SmIpTableDlgUpdate(HWND hWnd, SM_TABLE *s) +{ + bool ok = true; + // Validate arguments + if (hWnd == NULL || s == NULL) + { + return; + } + + if (LvIsSelected(hWnd, L_TABLE) == false || LvIsMultiMasked(hWnd, L_TABLE)) + { + ok = false; + } + + SetEnable(hWnd, B_DELETE, ok); +} + +// Content update +void SmIpTableDlgRefresh(HWND hWnd, SM_TABLE *s) +{ + UINT i; + RPC_ENUM_IP_TABLE t; + UINT old_selected = 0; + // Validate arguments + if (hWnd == NULL || s == NULL) + { + return; + } + + Zero(&t, sizeof(t)); + StrCpy(t.HubName, sizeof(t.HubName), s->Hub->HubName); + + if (CALL(hWnd, ScEnumIpTable(s->Rpc, &t)) == false) + { + EndDialog(hWnd, false); + return; + } + + i = LvGetSelected(hWnd, L_TABLE); + if (i != INFINITE) + { + old_selected = (UINT)LvGetParam(hWnd, L_TABLE, i); + } + + LvReset(hWnd, L_TABLE); + + for (i = 0;i < t.NumIpTable;i++) + { + char str[MAX_SIZE]; + wchar_t tmp1[MAX_SIZE]; + wchar_t tmp2[MAX_SIZE]; + wchar_t tmp3[MAX_SIZE]; + wchar_t tmp4[MAX_SIZE]; + wchar_t tmp5[MAX_SIZE]; + RPC_ENUM_IP_TABLE_ITEM *e = &t.IpTables[i]; + + if (s->SessionName == NULL || StrCmpi(e->SessionName, s->SessionName) == 0) + { + StrToUni(tmp1, sizeof(tmp1), e->SessionName); + + if (e->DhcpAllocated == false) + { + IPToStr(str, sizeof(str), &e->IpV6); + StrToUni(tmp2, sizeof(tmp2), str); + } + else + { + IPToStr(str, sizeof(str), &e->IpV6); + UniFormat(tmp2, sizeof(tmp2), _UU("SM_MAC_IP_DHCP"), str); + } + + GetDateTimeStr64Uni(tmp3, sizeof(tmp3), SystemToLocal64(e->CreatedTime)); + + GetDateTimeStr64Uni(tmp4, sizeof(tmp4), SystemToLocal64(e->UpdatedTime)); + + if (StrLen(e->RemoteHostname) == 0) + { + UniStrCpy(tmp5, sizeof(tmp5), _UU("SM_MACIP_LOCAL")); + } + else + { + UniFormat(tmp5, sizeof(tmp5), _UU("SM_MACIP_SERVER"), e->RemoteHostname); + } + + LvInsert(hWnd, L_TABLE, e->DhcpAllocated ? ICO_PROTOCOL_DHCP : ICO_PROTOCOL, (void *)e->Key, 5, + tmp1, tmp2, tmp3, tmp4, tmp5); + } + } + + FreeRpcEnumIpTable(&t); + + if (old_selected != 0) + { + LvSelect(hWnd, L_TABLE, LvSearchParam(hWnd, L_TABLE, (void *)old_selected)); + } + + SmIpTableDlgUpdate(hWnd, s); +} + +// IP address table dialog procedure +UINT SmIpTableDlgProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param) +{ + SM_TABLE *s = (SM_TABLE *)param; + NMHDR *n; + UINT i; + // Validate arguments + if (hWnd == NULL) + { + return 0; + } + + switch (msg) + { + case WM_INITDIALOG: + // Initialize + SmIpTableDlgInit(hWnd, s); + break; + + case WM_COMMAND: + switch (wParam) + { + case B_DELETE: + // Delete + i = LvGetSelected(hWnd, L_TABLE); + if (i != INFINITE) + { + RPC_DELETE_TABLE t; + UINT key = (UINT)LvGetParam(hWnd, L_TABLE, i); + + Zero(&t, sizeof(t)); + StrCpy(t.HubName, sizeof(t.HubName), s->Hub->HubName); + t.Key = key; + if (CALL(hWnd, ScDeleteIpTable(s->Rpc, &t))) + { + LvDeleteItem(hWnd, L_TABLE, i); + } + } + break; + + case B_REFRESH: + // Update + SmIpTableDlgRefresh(hWnd, s); + break; + + case IDCANCEL: + // Cancel button + Close(hWnd); + break; + } + break; + + case WM_NOTIFY: + n = (NMHDR *)lParam; + switch (n->idFrom) + { + case L_TABLE: + switch (n->code) + { + case LVN_ITEMCHANGED: + SmIpTableDlgUpdate(hWnd, s); + break; + } + break; + } + break; + + case WM_CLOSE: + EndDialog(hWnd, false); + break; + } + + LvStandardHandler(hWnd, msg, wParam, lParam, L_TABLE); + + return 0; +} + +// IP address table dialog +void SmIpTableDlg(HWND hWnd, SM_HUB *s, char *session_name) +{ + SM_TABLE t; + // Validate arguments + if (hWnd == NULL || s == NULL) + { + return; + } + + Zero(&t, sizeof(t)); + t.Hub = s; + t.Rpc = s->Rpc; + t.SessionName = session_name; + + Dialog(hWnd, D_SM_IP, SmIpTableDlgProc, &t); +} + + +// Initialize +void SmMacTableDlgInit(HWND hWnd, SM_TABLE *s) +{ + UINT i = 0; + // Validate arguments + if (hWnd == NULL || s == NULL) + { + return; + } + + SetIcon(hWnd, 0, ICO_NIC_ONLINE); + FormatText(hWnd, S_TITLE, s->Hub->HubName); + + if (s->SessionName != NULL) + { + wchar_t tmp[MAX_SIZE]; + wchar_t tmp2[MAX_SIZE]; + GetTxt(hWnd, S_TITLE, tmp, sizeof(tmp)); + UniFormat(tmp2, sizeof(tmp2), _UU("SM_SESSION_FILTER"), s->SessionName); + UniStrCat(tmp, sizeof(tmp), tmp2); + SetText(hWnd, S_TITLE, tmp); + } + + LvInit(hWnd, L_TABLE); + LvInsertColumn(hWnd, L_TABLE, i++, _UU("SM_MAC_COLUMN_1"), 190); + if (GetCapsBool(s->Hub->p->CapsList, "b_support_vlan")) + { + LvInsertColumn(hWnd, L_TABLE, i++, _UU("SM_MAC_COLUMN_1A"), 65); + } + LvInsertColumn(hWnd, L_TABLE, i++, _UU("SM_MAC_COLUMN_2"), 140); + LvInsertColumn(hWnd, L_TABLE, i++, _UU("SM_MAC_COLUMN_3"), 133); + LvInsertColumn(hWnd, L_TABLE, i++, _UU("SM_MAC_COLUMN_4"), 133); + LvInsertColumn(hWnd, L_TABLE, i++, _UU("SM_MAC_COLUMN_5"), 133); + LvSetStyle(hWnd, L_TABLE, LVS_EX_GRIDLINES); + + SmMacTableDlgRefresh(hWnd, s); +} + +// Update the control +void SmMacTableDlgUpdate(HWND hWnd, SM_TABLE *s) +{ + bool ok = true; + // Validate arguments + if (hWnd == NULL || s == NULL) + { + return; + } + + if (LvIsSelected(hWnd, L_TABLE) == false || LvIsMultiMasked(hWnd, L_TABLE)) + { + ok = false; + } + + SetEnable(hWnd, B_DELETE, ok); +} + +// Content update +void SmMacTableDlgRefresh(HWND hWnd, SM_TABLE *s) +{ + UINT i; + RPC_ENUM_MAC_TABLE t; + UINT old_selected = 0; + // Validate arguments + if (hWnd == NULL || s == NULL) + { + return; + } + + Zero(&t, sizeof(t)); + StrCpy(t.HubName, sizeof(t.HubName), s->Hub->HubName); + + if (CALL(hWnd, ScEnumMacTable(s->Rpc, &t)) == false) + { + EndDialog(hWnd, false); + return; + } + + i = LvGetSelected(hWnd, L_TABLE); + if (i != INFINITE) + { + old_selected = (UINT)LvGetParam(hWnd, L_TABLE, i); + } + + LvReset(hWnd, L_TABLE); + + for (i = 0;i < t.NumMacTable;i++) + { + char str[MAX_SIZE]; + wchar_t tmp1[MAX_SIZE]; + wchar_t tmp2[MAX_SIZE]; + wchar_t tmp3[MAX_SIZE]; + wchar_t tmp4[MAX_SIZE]; + wchar_t tmp5[MAX_SIZE]; + wchar_t tmp6[MAX_SIZE]; + RPC_ENUM_MAC_TABLE_ITEM *e = &t.MacTables[i]; + + if (s->SessionName == NULL || StrCmpi(e->SessionName, s->SessionName) == 0) + { + StrToUni(tmp1, sizeof(tmp1), e->SessionName); + + MacToStr(str, sizeof(str), e->MacAddress); + StrToUni(tmp2, sizeof(tmp2), str); + + GetDateTimeStr64Uni(tmp3, sizeof(tmp3), SystemToLocal64(e->CreatedTime)); + + GetDateTimeStr64Uni(tmp4, sizeof(tmp4), SystemToLocal64(e->UpdatedTime)); + + if (StrLen(e->RemoteHostname) == 0) + { + UniStrCpy(tmp5, sizeof(tmp5), _UU("SM_MACIP_LOCAL")); + } + else + { + UniFormat(tmp5, sizeof(tmp5), _UU("SM_MACIP_SERVER"), e->RemoteHostname); + } + + UniToStru(tmp6, e->VlanId); + if (e->VlanId == 0) + { + UniStrCpy(tmp6, sizeof(tmp6), _UU("CM_ST_NONE")); + } + + if (GetCapsBool(s->Hub->p->CapsList, "b_support_vlan")) + { + LvInsert(hWnd, L_TABLE, ICO_NIC_ONLINE, (void *)e->Key, 6, + tmp1, tmp6, tmp2, tmp3, tmp4, tmp5); + } + else + { + LvInsert(hWnd, L_TABLE, ICO_NIC_ONLINE, (void *)e->Key, 5, + tmp1, tmp2, tmp3, tmp4, tmp5); + } + } + } + + FreeRpcEnumMacTable(&t); + + if (old_selected != 0) + { + LvSelect(hWnd, L_TABLE, LvSearchParam(hWnd, L_TABLE, (void *)old_selected)); + } + + SmMacTableDlgUpdate(hWnd, s); +} + +// MAC address table dialog procedure +UINT SmMacTableDlgProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param) +{ + SM_TABLE *s = (SM_TABLE *)param; + NMHDR *n; + UINT i; + // Validate arguments + if (hWnd == NULL) + { + return 0; + } + + switch (msg) + { + case WM_INITDIALOG: + // Initialize + SmMacTableDlgInit(hWnd, s); + break; + + case WM_COMMAND: + switch (wParam) + { + case B_DELETE: + // Delete + i = LvGetSelected(hWnd, L_TABLE); + if (i != INFINITE) + { + RPC_DELETE_TABLE t; + UINT key = (UINT)LvGetParam(hWnd, L_TABLE, i); + + Zero(&t, sizeof(t)); + StrCpy(t.HubName, sizeof(t.HubName), s->Hub->HubName); + t.Key = key; + if (CALL(hWnd, ScDeleteMacTable(s->Rpc, &t))) + { + LvDeleteItem(hWnd, L_TABLE, i); + } + } + break; + + case B_REFRESH: + // Update + SmMacTableDlgRefresh(hWnd, s); + break; + + case IDCANCEL: + // Cancel button + Close(hWnd); + break; + } + break; + + case WM_NOTIFY: + n = (NMHDR *)lParam; + switch (n->idFrom) + { + case L_TABLE: + switch (n->code) + { + case LVN_ITEMCHANGED: + SmMacTableDlgUpdate(hWnd, s); + break; + } + break; + } + break; + + case WM_CLOSE: + EndDialog(hWnd, false); + break; + } + + LvStandardHandler(hWnd, msg, wParam, lParam, L_TABLE); + + return 0; +} + +// MAC address table dialog +void SmMacTableDlg(HWND hWnd, SM_HUB *s, char *session_name) +{ + SM_TABLE t; + // Validate arguments + if (hWnd == NULL || s == NULL) + { + return; + } + + Zero(&t, sizeof(t)); + t.Hub = s; + t.Rpc = s->Rpc; + t.SessionName = session_name; + + Dialog(hWnd, D_SM_MAC, SmMacTableDlgProc, &t); +} + +// Initialize +void SmSessionDlgInit(HWND hWnd, SM_HUB *s) +{ + // Validate arguments + if (hWnd == NULL || s == NULL) + { + return; + } + + SetIcon(hWnd, 0, ICO_VPN); + FormatText(hWnd, 0, s->HubName); + FormatText(hWnd, S_TITLE, s->HubName); + + LvInit(hWnd, L_LIST); + LvInsertColumn(hWnd, L_LIST, 0, _UU("SM_SESS_COLUMN_1"), 176); + LvInsertColumn(hWnd, L_LIST, 1, _UU("SM_SESS_COLUMN_8"), 58); + LvInsertColumn(hWnd, L_LIST, 2, _UU("SM_SESS_COLUMN_2"), 62); + LvInsertColumn(hWnd, L_LIST, 3, _UU("SM_SESS_COLUMN_3"), 78); + LvInsertColumn(hWnd, L_LIST, 4, _UU("SM_SESS_COLUMN_4"), 122); + LvInsertColumn(hWnd, L_LIST, 5, _UU("SM_SESS_COLUMN_5"), 68); + LvInsertColumn(hWnd, L_LIST, 6, _UU("SM_SESS_COLUMN_6"), 100); + LvInsertColumn(hWnd, L_LIST, 7, _UU("SM_SESS_COLUMN_7"), 100); + LvSetStyle(hWnd, L_LIST, LVS_EX_GRIDLINES); + + if (s->p->ServerType == SERVER_TYPE_FARM_CONTROLLER && GetCapsBool(s->p->CapsList, "b_support_cluster_admin") == false) + { + Show(hWnd, S_FARM_INFO_1); + Show(hWnd, S_FARM_INFO_2); + } + + SmSessionDlgRefresh(hWnd, s); +} + +// Update the control +void SmSessionDlgUpdate(HWND hWnd, SM_HUB *s) +{ + bool ok = true; + bool ok2 = true; + // Validate arguments + if (hWnd == NULL || s == NULL) + { + return; + } + + if (LvIsSelected(hWnd, L_LIST) == false || LvIsMultiMasked(hWnd, L_LIST)) + { + ok = false; + ok2 = false; + } + else + { + UINT i = LvGetSelected(hWnd, L_LIST); + if (i != INFINITE) + { + void *p = LvGetParam(hWnd, L_LIST, i); + if (((bool)p) != false) + { + if (GetCapsBool(s->p->CapsList, "b_support_cluster_admin") == false) + { + ok = false; + } + } + } + } + + if (s->p->ServerInfo.ServerBuildInt < 2844) + { + // Old version doesn't support for remote management of the sessions + ok2 = ok; + } + + SetEnable(hWnd, IDOK, ok2); + SetEnable(hWnd, B_DISCONNECT, ok2); + SetEnable(hWnd, B_SESSION_IP_TABLE, ok); + SetEnable(hWnd, B_SESSION_MAC_TABLE, ok); +} + +// Update the list +void SmSessionDlgRefresh(HWND hWnd, SM_HUB *s) +{ + LVB *b; + UINT i; + wchar_t *old_select; + RPC_ENUM_SESSION t; + // Validate arguments + if (hWnd == NULL || s == NULL) + { + return; + } + + Zero(&t, sizeof(t)); + StrCpy(t.HubName, sizeof(t.HubName), s->HubName); + + if (CALL(hWnd, ScEnumSession(s->Rpc, &t)) == false) + { + EndDialog(hWnd, false); + return; + } + + old_select = LvGetSelectedStr(hWnd, L_LIST, 0); + + LvReset(hWnd, L_LIST); + + b = LvInsertStart(); + + for (i = 0;i < t.NumSession;i++) + { + RPC_ENUM_SESSION_ITEM *e = &t.Sessions[i]; + wchar_t tmp1[MAX_SIZE]; + wchar_t *tmp2; + wchar_t tmp3[MAX_SIZE]; + wchar_t tmp4[MAX_SIZE]; + wchar_t tmp5[MAX_SIZE]; + wchar_t tmp6[MAX_SIZE]; + wchar_t tmp7[MAX_SIZE]; + wchar_t tmp8[MAX_SIZE]; + bool free_tmp2 = false; + UINT icon; + + StrToUni(tmp1, sizeof(tmp1), e->Name); + + tmp2 = _UU("SM_SESS_NORMAL"); + icon = ICO_VPN; + if (s->p->ServerType != SERVER_TYPE_STANDALONE) + { + if (e->RemoteSession) + { + tmp2 = ZeroMalloc(MAX_SIZE); + UniFormat(tmp2, MAX_SIZE, _UU("SM_SESS_REMOTE"), e->RemoteHostname); + icon = ICO_VPN; + free_tmp2 = true; + } + else + { + if (StrLen(e->RemoteHostname) == 0) + { + tmp2 = _UU("SM_SESS_LOCAL"); + } + else + { + tmp2 = ZeroMalloc(MAX_SIZE); + UniFormat(tmp2, MAX_SIZE, _UU("SM_SESS_LOCAL_2"), e->RemoteHostname); + free_tmp2 = true; + } + } + } + if (e->LinkMode) + { + if (free_tmp2) + { + Free(tmp2); + free_tmp2 = false; + } + tmp2 = _UU("SM_SESS_LINK"); + icon = ICO_CASCADE; + } + else if (e->SecureNATMode) + { + /*if (free_tmp2) + { + Free(tmp2); + free_tmp2 = false; + } + tmp2 = _UU("SM_SESS_SNAT");*/ + icon = ICO_ROUTER; + } + else if (e->BridgeMode) + { + icon = ICO_BRIDGE; + } + else if (e->Layer3Mode) + { + icon = ICO_SWITCH; + } + + StrToUni(tmp3, sizeof(tmp3), e->Username); + + StrToUni(tmp4, sizeof(tmp4), e->Hostname); + if (e->LinkMode) + { + UniStrCpy(tmp4, sizeof(tmp4), _UU("SM_SESS_LINK_HOSTNAME")); + } + else if (e->SecureNATMode) + { + UniStrCpy(tmp4, sizeof(tmp4), _UU("SM_SESS_SNAT_HOSTNAME")); + } + else if (e->BridgeMode) + { + UniStrCpy(tmp4, sizeof(tmp4), _UU("SM_SESS_BRIDGE_HOSTNAME")); + } + else if (StartWith(e->Username, L3_USERNAME)) + { + UniStrCpy(tmp4, sizeof(tmp4), _UU("SM_SESS_LAYER3_HOSTNAME")); + } + + UniFormat(tmp5, sizeof(tmp5), L"%u / %u", e->CurrentNumTcp, e->MaxNumTcp); + if (e->LinkMode) + { + UniStrCpy(tmp5, sizeof(tmp5), _UU("SM_SESS_LINK_TCP")); + } + else if (e->SecureNATMode) + { + UniStrCpy(tmp5, sizeof(tmp5), _UU("SM_SESS_SNAT_TCP")); + } + else if (e->BridgeMode) + { + UniStrCpy(tmp5, sizeof(tmp5), _UU("SM_SESS_BRIDGE_TCP")); + } + + if (e->VLanId == 0) + { + UniStrCpy(tmp8, sizeof(tmp8), _UU("CM_ST_NO_VLAN")); + } + else + { + UniToStru(tmp8, e->VLanId); + } + + UniToStr3(tmp6, sizeof(tmp6), e->PacketSize); + UniToStr3(tmp7, sizeof(tmp7), e->PacketNum); + + if (icon == ICO_VPN) + { + if (e->Client_BridgeMode) + { + icon = ICO_SESSION_BRIDGE; + } + else if (e->Client_MonitorMode) + { + icon = ICO_SESSION_MONITOR; + } + } + + if (e->IsDormantEnabled && e->IsDormant) + { + icon = ICO_TRAY0; + } + + LvInsertAdd(b, icon, (void *)(e->RemoteSession), 8, tmp1, tmp8, tmp2, tmp3, tmp4, tmp5, tmp6, tmp7); + + if (free_tmp2) + { + Free(tmp2); + } + } + + LvInsertEnd(b, hWnd, L_LIST); + + if (old_select != NULL && UniStrLen(old_select) != 0) + { + UINT i = LvSearchStr(hWnd, L_LIST, 0, old_select); + if (i != INFINITE) + { + LvSelect(hWnd, L_LIST, i); + } + } + + Free(old_select); + + FreeRpcEnumSession(&t); + + SmSessionDlgUpdate(hWnd, s); +} + +// Display the NODE_INFO +void SmPrintNodeInfo(LVB *b, NODE_INFO *info) +{ + wchar_t tmp[MAX_SIZE]; + char str[MAX_SIZE]; + // Validate arguments + if (b == NULL || info == NULL) + { + return; + } + + StrToUni(tmp, sizeof(tmp), info->ClientProductName); + LvInsertAdd(b, 0, NULL, 2, _UU("SM_NODE_CLIENT_NAME"), tmp); + + UniFormat(tmp, sizeof(tmp), L"%u.%02u", Endian32(info->ClientProductVer) / 100, Endian32(info->ClientProductVer) % 100); + LvInsertAdd(b, 0, NULL, 2, _UU("SM_NODE_CLIENT_VER"), tmp); + + UniFormat(tmp, sizeof(tmp), L"Build %u", Endian32(info->ClientProductBuild)); + LvInsertAdd(b, 0, NULL, 2, _UU("SM_NODE_CLIENT_BUILD"), tmp); + + StrToUni(tmp, sizeof(tmp), info->ClientOsName); + LvInsertAdd(b, 0, NULL, 2, _UU("SM_NODE_CLIENT_OS_NAME"), tmp); + + StrToUni(tmp, sizeof(tmp), info->ClientOsVer); + LvInsertAdd(b, 0, NULL, 2, _UU("SM_NODE_CLIENT_OS_VER"), tmp); + + StrToUni(tmp, sizeof(tmp), info->ClientOsProductId); + LvInsertAdd(b, 0, NULL, 2, _UU("SM_NODE_CLIENT_OS_PID"), tmp); + + StrToUni(tmp, sizeof(tmp), info->ClientHostname); + LvInsertAdd(b, 0, NULL, 2, _UU("SM_NODE_CLIENT_HOST"), tmp); + + IPToStr4or6(str, sizeof(str), info->ClientIpAddress, info->ClientIpAddress6); + StrToUni(tmp, sizeof(tmp), str); + LvInsertAdd(b, 0, NULL, 2, _UU("SM_NODE_CLIENT_IP"), tmp); + + UniToStru(tmp, Endian32(info->ClientPort)); + LvInsertAdd(b, 0, NULL, 2, _UU("SM_NODE_CLIENT_PORT"), tmp); + + StrToUni(tmp, sizeof(tmp), info->ServerHostname); + LvInsertAdd(b, 0, NULL, 2, _UU("SM_NODE_SERVER_HOST"), tmp); + + IPToStr4or6(str, sizeof(str), info->ServerIpAddress, info->ServerIpAddress6); + StrToUni(tmp, sizeof(tmp), str); + LvInsertAdd(b, 0, NULL, 2, _UU("SM_NODE_SERVER_IP"), tmp); + + UniToStru(tmp, Endian32(info->ServerPort)); + LvInsertAdd(b, 0, NULL, 2, _UU("SM_NODE_SERVER_PORT"), tmp); + + if (StrLen(info->ProxyHostname) != 0) + { + StrToUni(tmp, sizeof(tmp), info->ProxyHostname); + LvInsertAdd(b, 0, NULL, 2, _UU("SM_NODE_PROXY_HOSTNAME"), tmp); + + IPToStr4or6(str, sizeof(str), info->ProxyIpAddress, info->ProxyIpAddress6); + StrToUni(tmp, sizeof(tmp), str); + LvInsertAdd(b, 0, NULL, 2, _UU("SM_NODE_PROXY_IP"), tmp); + + UniToStru(tmp, Endian32(info->ProxyPort)); + LvInsertAdd(b, 0, NULL, 2, _UU("SM_NODE_PROXY_PORT"), tmp); + } +} + +// Update the session status +bool SmRefreshSessionStatus(HWND hWnd, SM_SERVER *s, void *param) +{ + LVB *b; + SM_SESSION_STATUS *status = (SM_SESSION_STATUS *)param; + RPC_SESSION_STATUS t; + wchar_t tmp[MAX_SIZE]; + char str[MAX_SIZE]; + // Validate arguments + if (hWnd == NULL || s == NULL || param == NULL) + { + return false; + } + + Zero(&t, sizeof(t)); + StrCpy(t.HubName, sizeof(t.HubName), status->Hub->HubName); + StrCpy(t.Name, sizeof(t.Name), status->SessionName); + + if (CALL(hWnd, ScGetSessionStatus(s->Rpc, &t)) == false) + { + return false; + } + + b = LvInsertStart(); + + if (t.ClientIp != 0) + { + IPToStr4or6(str, sizeof(str), t.ClientIp, t.ClientIp6); + StrToUni(tmp, sizeof(tmp), str); + LvInsertAdd(b, 0, NULL, 2, _UU("SM_CLIENT_IP"), tmp); + } + + if (StrLen(t.ClientHostName) != 0) + { + StrToUni(tmp, sizeof(tmp), t.ClientHostName); + LvInsertAdd(b, 0, NULL, 2, _UU("SM_CLIENT_HOSTNAME"), tmp); + } + + StrToUni(tmp, sizeof(tmp), t.Username); + LvInsertAdd(b, 0, NULL, 2, _UU("SM_SESS_STATUS_USERNAME"), tmp); + + if (StrCmpi(t.Username, LINK_USER_NAME_PRINT) != 0 && StrCmpi(t.Username, SNAT_USER_NAME_PRINT) != 0 && StrCmpi(t.Username, BRIDGE_USER_NAME_PRINT) != 0) + { + StrToUni(tmp, sizeof(tmp), t.RealUsername); + LvInsertAdd(b, 0, NULL, 2, _UU("SM_SESS_STATUS_REALUSER"), tmp); + } + + if (IsEmptyStr(t.GroupName) == false) + { + StrToUni(tmp, sizeof(tmp), t.GroupName); + LvInsertAdd(b, 0, NULL, 2, _UU("SM_SESS_STATUS_GROUPNAME"), tmp); + } + + CmPrintStatusToListViewEx(b, &t.Status, true); + + if (StrCmpi(t.Username, LINK_USER_NAME_PRINT) != 0 && StrCmpi(t.Username, SNAT_USER_NAME_PRINT) != 0 && StrCmpi(t.Username, BRIDGE_USER_NAME_PRINT) != 0 && + StartWith(t.Username, L3_USERNAME) == false) + { + SmPrintNodeInfo(b, &t.NodeInfo); + } + + LvInsertEnd(b, hWnd, L_STATUS); + + FreeRpcSessionStatus(&t); + + return true; +} + +// Session Management dialog procedure +UINT SmSessionDlgProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param) +{ + SM_HUB *s = (SM_HUB *)param; + wchar_t *tmp; + wchar_t tmp2[MAX_SIZE]; + char name[MAX_SIZE]; + NMHDR *n; + SM_SESSION_STATUS status; + // Validate arguments + if (hWnd == NULL) + { + return 0; + } + + tmp = LvGetSelectedStr(hWnd, L_LIST, 0); + UniToStr(name, sizeof(name), tmp); + + switch (msg) + { + case WM_INITDIALOG: + // Initialize + SmSessionDlgInit(hWnd, s); + break; + + case WM_COMMAND: + switch (wParam) + { + case IDOK: + if (IsEnable(hWnd, IDOK)) + { + // Session status display + UniFormat(tmp2, sizeof(tmp2), _UU("SM_SESS_STATUS_CAPTION"), name); + Zero(&status, sizeof(status)); + status.Hub = s; + status.SessionName = name; + SmStatusDlg(hWnd, s->p, &status, true, true, tmp2, ICO_VPN, + NULL, SmRefreshSessionStatus); + } + break; + + case B_DISCONNECT: + // Disconnect + if (MsgBoxEx(hWnd, MB_ICONQUESTION | MB_YESNO | MB_DEFBUTTON2, + _UU("SM_SESS_DISCONNECT_MSG"), name) == IDYES) + { + RPC_DELETE_SESSION t; + Zero(&t, sizeof(t)); + StrCpy(t.HubName, sizeof(t.HubName), s->HubName); + StrCpy(t.Name, sizeof(t.Name), name); + + if (CALL(hWnd, ScDeleteSession(s->Rpc, &t))) + { + SmSessionDlgRefresh(hWnd, s); + } + } + break; + + case B_REFRESH: + // Update + SmSessionDlgRefresh(hWnd, s); + break; + + case B_SESSION_IP_TABLE: + // IP table + SmIpTableDlg(hWnd, s, name); + break; + + case B_SESSION_MAC_TABLE: + // MAC table + SmMacTableDlg(hWnd, s, name); + break; + + case B_MAC_TABLE: + // MAC Table List + SmMacTableDlg(hWnd, s, NULL); + break; + + case B_IP_TABLE: + // IP Table List + SmIpTableDlg(hWnd, s, NULL); + break; + + case IDCANCEL: + // Cancel button + Close(hWnd); + break; + } + break; + + case WM_NOTIFY: + n = (NMHDR *)lParam; + switch (n->code) + { + case LVN_ITEMCHANGED: + switch (n->idFrom) + { + case L_LIST: + SmSessionDlgUpdate(hWnd, s); + break; + } + break; + } + break; + + case WM_CLOSE: + EndDialog(hWnd, false); + break; + } + + Free(tmp); + + LvStandardHandler(hWnd, msg, wParam, lParam, L_LIST); + + return 0; +} + +// Session Management dialog +void SmSessionDlg(HWND hWnd, SM_HUB *s) +{ + // Validate arguments + if (hWnd == NULL || s == NULL) + { + return; + } + + Dialog(hWnd, D_SM_SESSION, SmSessionDlgProc, s); +} + +// Certificate List Update +void SmCaDlgRefresh(HWND hWnd, SM_HUB *s) +{ + LVB *b; + UINT i; + RPC_HUB_ENUM_CA t; + // Validate arguments + if (hWnd == NULL || s == NULL) + { + return; + } + + Zero(&t, sizeof(t)); + StrCpy(t.HubName, sizeof(t.HubName), s->HubName); + if (CALL(hWnd, ScEnumCa(s->Rpc, &t)) == false) + { + EndDialog(hWnd, false); + return; + } + + b = LvInsertStart(); + + for (i = 0;i < t.NumCa;i++) + { + wchar_t tmp[MAX_SIZE]; + RPC_HUB_ENUM_CA_ITEM *e = &t.Ca[i]; + + GetDateStrEx64(tmp, sizeof(tmp), SystemToLocal64(e->Expires), NULL); + + LvInsertAdd(b, ICO_SERVER_CERT, (void *)e->Key, 3, + e->SubjectName, e->IssuerName, tmp); + } + + LvInsertEnd(b, hWnd, L_CERT); + + FreeRpcHubEnumCa(&t); + + SmCaDlgUpdate(hWnd, s); +} + +// Initialize +void SmCaDlgInit(HWND hWnd, SM_HUB *s) +{ + // Validate arguments + if (hWnd == NULL || s == NULL) + { + return; + } + + SetIcon(hWnd, 0, ICO_SERVER_CERT); + + LvInit(hWnd, L_CERT); + LvInsertColumn(hWnd, L_CERT, 0, _UU("CM_CERT_COLUMN_1"), 190); + LvInsertColumn(hWnd, L_CERT, 1, _UU("CM_CERT_COLUMN_2"), 190); + LvInsertColumn(hWnd, L_CERT, 2, _UU("CM_CERT_COLUMN_3"), 160); + + SmCaDlgRefresh(hWnd, s); +} + +// Update the control +void SmCaDlgUpdate(HWND hWnd, SM_HUB *s) +{ + // Validate arguments + if (hWnd == NULL || s == NULL) + { + return; + } + + SetEnable(hWnd, B_DELETE, LvIsSelected(hWnd, L_CERT)); + SetEnable(hWnd, IDOK, LvIsSelected(hWnd, L_CERT)); +} + +// OK +void SmCaDlgOnOk(HWND hWnd, SM_HUB *s) +{ + // Validate arguments + if (hWnd == NULL || s == NULL) + { + return; + } +} + +// CA Adding dialog +bool SmCaDlgAdd(HWND hWnd, SM_HUB *s) +{ + X *x; + RPC_HUB_ADD_CA t; + // Validate arguments + if (hWnd == NULL || s == NULL) + { + return false; + } + + if (CmLoadXFromFileOrSecureCard(hWnd, &x) == false) + { + return false; + } + + Zero(&t, sizeof(t)); + StrCpy(t.HubName, sizeof(t.HubName), s->HubName); + t.Cert = x; + + if (CALL(hWnd, ScAddCa(s->Rpc, &t)) == false) + { + return false; + } + + FreeRpcHubAddCa(&t); + + return true; +} + +// CA List dialog procedure +UINT SmCaDlgProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param) +{ + NMHDR *n; + SM_HUB *s = (SM_HUB *)param; + UINT i, key; + // Validate arguments + if (hWnd == NULL) + { + return 0; + } + + switch (msg) + { + case WM_INITDIALOG: + // Initialize + SmCaDlgInit(hWnd, s); + break; + + case WM_COMMAND: + switch (wParam) + { + case B_IMPORT: + // Add + if (SmCaDlgAdd(hWnd, s)) + { + SmCaDlgRefresh(hWnd, s); + } + break; + + case B_DELETE: + // Delete + i = LvGetSelected(hWnd, L_CERT); + if (i != INFINITE) + { + key = (UINT)LvGetParam(hWnd, L_CERT, i); + if (key != 0) + { + if (MsgBox(hWnd, MB_ICONQUESTION | MB_YESNO | MB_DEFBUTTON2, + _UU("CM_CERT_DELETE_MSG")) == IDYES) + { + RPC_HUB_DELETE_CA t; + Zero(&t, sizeof(t)); + StrCpy(t.HubName, sizeof(t.HubName), s->HubName); + t.Key = key; + + if (CALL(hWnd, ScDeleteCa(s->Rpc, &t))) + { + SmCaDlgRefresh(hWnd, s); + } + } + } + } + break; + + case IDOK: + // Display + i = LvGetSelected(hWnd, L_CERT); + if (i != INFINITE) + { + key = (UINT)LvGetParam(hWnd, L_CERT, i); + if (key != 0) + { + RPC_HUB_GET_CA t; + Zero(&t, sizeof(t)); + StrCpy(t.HubName, sizeof(t.HubName), s->HubName); + t.Key = key; + + if (CALL(hWnd, ScGetCa(s->Rpc, &t))) + { + CertDlg(hWnd, t.Cert, NULL, true); + FreeRpcHubGetCa(&t); + } + } + } + break; + + case IDCANCEL: + // Cancel button + Close(hWnd); + break; + } + break; + + case WM_NOTIFY: + n = (NMHDR *)lParam; + switch (n->idFrom) + { + case L_CERT: + switch (n->code) + { + case LVN_ITEMCHANGED: + SmCaDlgUpdate(hWnd, s); + break; + } + break; + } + break; + + case WM_CLOSE: + EndDialog(hWnd, false); + break; + } + + LvStandardHandler(hWnd, msg, wParam, lParam, L_CERT); + + return 0; +} + +// CA List dialog box +void SmCaDlg(HWND hWnd, SM_HUB *s) +{ + // Validate arguments + if (hWnd == NULL || s == NULL) + { + return; + } + + Dialog(hWnd, D_SM_CA, SmCaDlgProc, s); +} + +// Initialize +void SmLogDlgInit(HWND hWnd, SM_HUB *s) +{ + RPC_HUB_LOG t; + // Validate arguments + if (hWnd == NULL || s == NULL) + { + return; + } + + SetIcon(hWnd, 0, ICO_LOG2); + + FormatText(hWnd, S_TITLE, s->HubName); + + CbSetHeight(hWnd, C_SEC_SWITCH, 18); + CbSetHeight(hWnd, C_PACKET_SWITCH, 18); + + // Initialize the control + CbAddStr(hWnd, C_SEC_SWITCH, _UU("SM_LOG_SWITCH_0"), 0); + CbAddStr(hWnd, C_SEC_SWITCH, _UU("SM_LOG_SWITCH_1"), 1); + CbAddStr(hWnd, C_SEC_SWITCH, _UU("SM_LOG_SWITCH_2"), 2); + CbAddStr(hWnd, C_SEC_SWITCH, _UU("SM_LOG_SWITCH_3"), 3); + CbAddStr(hWnd, C_SEC_SWITCH, _UU("SM_LOG_SWITCH_4"), 4); + CbAddStr(hWnd, C_SEC_SWITCH, _UU("SM_LOG_SWITCH_5"), 5); + CbAddStr(hWnd, C_PACKET_SWITCH, _UU("SM_LOG_SWITCH_0"), 0); + CbAddStr(hWnd, C_PACKET_SWITCH, _UU("SM_LOG_SWITCH_1"), 1); + CbAddStr(hWnd, C_PACKET_SWITCH, _UU("SM_LOG_SWITCH_2"), 2); + CbAddStr(hWnd, C_PACKET_SWITCH, _UU("SM_LOG_SWITCH_3"), 3); + CbAddStr(hWnd, C_PACKET_SWITCH, _UU("SM_LOG_SWITCH_4"), 4); + CbAddStr(hWnd, C_PACKET_SWITCH, _UU("SM_LOG_SWITCH_5"), 5); + + // Get the log settings + Zero(&t, sizeof(t)); + StrCpy(t.HubName, sizeof(t.HubName), s->HubName); + if (CALL(hWnd, ScGetHubLog(s->Rpc, &t)) == false) + { + EndDialog(hWnd, false); + return; + } + + Check(hWnd, B_SEC, t.LogSetting.SaveSecurityLog); + CbSelect(hWnd, C_SEC_SWITCH, t.LogSetting.SecurityLogSwitchType); + + Check(hWnd, B_PACKET, t.LogSetting.SavePacketLog); + CbSelect(hWnd, C_PACKET_SWITCH, t.LogSetting.PacketLogSwitchType); + + Check(hWnd, B_PACKET_0_0, t.LogSetting.PacketLogConfig[0] == 0); + Check(hWnd, B_PACKET_0_1, t.LogSetting.PacketLogConfig[0] == 1); + Check(hWnd, B_PACKET_0_2, t.LogSetting.PacketLogConfig[0] == 2); + + Check(hWnd, B_PACKET_1_0, t.LogSetting.PacketLogConfig[1] == 0); + Check(hWnd, B_PACKET_1_1, t.LogSetting.PacketLogConfig[1] == 1); + Check(hWnd, B_PACKET_1_2, t.LogSetting.PacketLogConfig[1] == 2); + + Check(hWnd, B_PACKET_2_0, t.LogSetting.PacketLogConfig[2] == 0); + Check(hWnd, B_PACKET_2_1, t.LogSetting.PacketLogConfig[2] == 1); + Check(hWnd, B_PACKET_2_2, t.LogSetting.PacketLogConfig[2] == 2); + + Check(hWnd, B_PACKET_3_0, t.LogSetting.PacketLogConfig[3] == 0); + Check(hWnd, B_PACKET_3_1, t.LogSetting.PacketLogConfig[3] == 1); + Check(hWnd, B_PACKET_3_2, t.LogSetting.PacketLogConfig[3] == 2); + + Check(hWnd, B_PACKET_4_0, t.LogSetting.PacketLogConfig[4] == 0); + Check(hWnd, B_PACKET_4_1, t.LogSetting.PacketLogConfig[4] == 1); + Check(hWnd, B_PACKET_4_2, t.LogSetting.PacketLogConfig[4] == 2); + + Check(hWnd, B_PACKET_5_0, t.LogSetting.PacketLogConfig[5] == 0); + Check(hWnd, B_PACKET_5_1, t.LogSetting.PacketLogConfig[5] == 1); + Check(hWnd, B_PACKET_5_2, t.LogSetting.PacketLogConfig[5] == 2); + + Check(hWnd, B_PACKET_6_0, t.LogSetting.PacketLogConfig[6] == 0); + Check(hWnd, B_PACKET_6_1, t.LogSetting.PacketLogConfig[6] == 1); + Check(hWnd, B_PACKET_6_2, t.LogSetting.PacketLogConfig[6] == 2); + + Check(hWnd, B_PACKET_7_0, t.LogSetting.PacketLogConfig[7] == 0); + Check(hWnd, B_PACKET_7_1, t.LogSetting.PacketLogConfig[7] == 1); + Check(hWnd, B_PACKET_7_2, t.LogSetting.PacketLogConfig[7] == 2); + + SmLogDlgUpdate(hWnd, s); +} + +// Update the control +void SmLogDlgUpdate(HWND hWnd, SM_HUB *s) +{ + bool b; + // Validate arguments + if (hWnd == NULL || s == NULL) + { + return; + } + + b = IsChecked(hWnd, B_SEC); + SetEnable(hWnd, S_SEC, b); + SetEnable(hWnd, C_SEC_SWITCH, b); + + b = IsChecked(hWnd, B_PACKET); + SetEnable(hWnd, S_PACKET, b); + SetEnable(hWnd, C_PACKET_SWITCH, b); + SetEnable(hWnd, S_PACKET_0, b); + SetEnable(hWnd, S_PACKET_1, b); + SetEnable(hWnd, S_PACKET_2, b); + SetEnable(hWnd, S_PACKET_3, b); + SetEnable(hWnd, S_PACKET_4, b); + SetEnable(hWnd, S_PACKET_5, b); + SetEnable(hWnd, S_PACKET_6, b); + SetEnable(hWnd, S_PACKET_7, b); + SetEnable(hWnd, B_PACKET_0_0, b); SetEnable(hWnd, B_PACKET_0_1, b); SetEnable(hWnd, B_PACKET_0_2, b); + SetEnable(hWnd, B_PACKET_1_0, b); SetEnable(hWnd, B_PACKET_1_1, b); SetEnable(hWnd, B_PACKET_1_2, b); + SetEnable(hWnd, B_PACKET_2_0, b); SetEnable(hWnd, B_PACKET_2_1, b); SetEnable(hWnd, B_PACKET_2_2, b); + SetEnable(hWnd, B_PACKET_3_0, b); SetEnable(hWnd, B_PACKET_3_1, b); SetEnable(hWnd, B_PACKET_3_2, b); + SetEnable(hWnd, B_PACKET_4_0, b); SetEnable(hWnd, B_PACKET_4_1, b); SetEnable(hWnd, B_PACKET_4_2, b); + SetEnable(hWnd, B_PACKET_5_0, b); SetEnable(hWnd, B_PACKET_5_1, b); SetEnable(hWnd, B_PACKET_5_2, b); + SetEnable(hWnd, B_PACKET_6_0, b); SetEnable(hWnd, B_PACKET_6_1, b); SetEnable(hWnd, B_PACKET_6_2, b); + SetEnable(hWnd, B_PACKET_7_0, b); SetEnable(hWnd, B_PACKET_7_1, b); SetEnable(hWnd, B_PACKET_7_2, b); +} + +// OK +void SmLogDlgOnOk(HWND hWnd, SM_HUB *s) +{ + HUB_LOG g; + RPC_HUB_LOG t; + // Validate arguments + if (hWnd == NULL || s == NULL) + { + return; + } + + Zero(&g, sizeof(g)); + g.SaveSecurityLog = IsChecked(hWnd, B_SEC); + g.SavePacketLog = IsChecked(hWnd, B_PACKET); + g.SecurityLogSwitchType = CbGetSelect(hWnd, C_SEC_SWITCH); + g.PacketLogSwitchType = CbGetSelect(hWnd, C_PACKET_SWITCH); + + g.PacketLogConfig[0] = IsChecked(hWnd, B_PACKET_0_0) ? 0 : IsChecked(hWnd, B_PACKET_0_1) ? 1 : 2; + g.PacketLogConfig[1] = IsChecked(hWnd, B_PACKET_1_0) ? 0 : IsChecked(hWnd, B_PACKET_1_1) ? 1 : 2; + g.PacketLogConfig[2] = IsChecked(hWnd, B_PACKET_2_0) ? 0 : IsChecked(hWnd, B_PACKET_2_1) ? 1 : 2; + g.PacketLogConfig[3] = IsChecked(hWnd, B_PACKET_3_0) ? 0 : IsChecked(hWnd, B_PACKET_3_1) ? 1 : 2; + g.PacketLogConfig[4] = IsChecked(hWnd, B_PACKET_4_0) ? 0 : IsChecked(hWnd, B_PACKET_4_1) ? 1 : 2; + g.PacketLogConfig[5] = IsChecked(hWnd, B_PACKET_5_0) ? 0 : IsChecked(hWnd, B_PACKET_5_1) ? 1 : 2; + g.PacketLogConfig[6] = IsChecked(hWnd, B_PACKET_6_0) ? 0 : IsChecked(hWnd, B_PACKET_6_1) ? 1 : 2; + g.PacketLogConfig[7] = IsChecked(hWnd, B_PACKET_7_0) ? 0 : IsChecked(hWnd, B_PACKET_7_1) ? 1 : 2; + + Zero(&t, sizeof(t)); + StrCpy(t.HubName, sizeof(t.HubName), s->HubName); + Copy(&t.LogSetting, &g, sizeof(HUB_LOG)); + + if (CALL(hWnd, ScSetHubLog(s->Rpc, &t)) == false) + { + return; + } + + EndDialog(hWnd, true); +} + +// Log storage settings dialog +UINT SmLogDlg(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param) +{ + SM_HUB *s = (SM_HUB *)param; + // Validate arguments + if (hWnd == NULL) + { + return 0; + } + + switch (msg) + { + case WM_INITDIALOG: + // Initialize + SmLogDlgInit(hWnd, s); + break; + + case WM_COMMAND: + switch (LOWORD(wParam)) + { + case B_SEC: + case B_PACKET: + SmLogDlgUpdate(hWnd, s); + break; + } + + switch (wParam) + { + case IDOK: + // [OK] button + SmLogDlgOnOk(hWnd, s); + break; + + case IDCANCEL: + // Cancel button + Close(hWnd); + break; + } + break; + + case WM_CLOSE: + EndDialog(hWnd, false); + break; + } + + return 0; +} + +// Show the status of the cascade connection +bool SmRefreshLinkStatus(HWND hWnd, SM_SERVER *s, void *param) +{ + SM_LINK *k = (SM_LINK *)param; + RPC_LINK_STATUS t; + LVB *b; + // Validate arguments + if (hWnd == NULL || s == NULL || param == NULL) + { + return false; + } + + Zero(&t, sizeof(t)); + StrCpy(t.HubName, sizeof(t.HubName), k->Hub->HubName); + UniStrCpy(t.AccountName, sizeof(t.AccountName), k->AccountName); + + if (CALL(hWnd, ScGetLinkStatus(s->Rpc, &t)) == false) + { + return false; + } + + b = LvInsertStart(); + + CmPrintStatusToListView(b, &t.Status); + + LvInsertEnd(b, hWnd, L_STATUS); + + FreeRpcLinkStatus(&t); + + return true; +} + +// Edit the link +bool SmLinkEdit(HWND hWnd, SM_HUB *s, wchar_t *name) +{ + CM_ACCOUNT a; + RPC_CREATE_LINK t; + bool ret = false; + // Validate arguments + if (hWnd == NULL || s == NULL || name == NULL) + { + return false; + } + + Zero(&a, sizeof(a)); + Zero(&t, sizeof(t)); + + StrCpy(t.HubName, sizeof(t.HubName), s->HubName); + t.ClientOption = ZeroMalloc(sizeof(CLIENT_OPTION)); + UniStrCpy(t.ClientOption->AccountName, sizeof(t.ClientOption->AccountName), name); + + if (CALL(hWnd, ScGetLink(s->Rpc, &t)) == false) + { + return false; + } + + a.Hub = s; + a.EditMode = true; + a.LinkMode = true; + a.ClientOption = ZeroMalloc(sizeof(CLIENT_OPTION)); + a.OnlineFlag = t.Online; + Copy(a.ClientOption, t.ClientOption, sizeof(CLIENT_OPTION)); + a.ClientAuth = CopyClientAuth(t.ClientAuth); + Copy(&a.Policy, &t.Policy, sizeof(POLICY)); + a.CheckServerCert = t.CheckServerCert; + a.ServerCert = CloneX(t.ServerCert); + a.HideTrustCert = GetCapsBool(s->p->CapsList, "b_support_config_hub"); + FreeRpcCreateLink(&t); + + a.PolicyVer = s->p->PolicyVer; + + if (GetCapsBool(s->p->CapsList, "b_support_cascade_client_cert") == false) + { + a.HideClientCertAuth = true; + } + + a.HideSecureAuth = true; + + ret = CmEditAccountDlg(hWnd, &a); + + FreeX(a.ServerCert); + Free(a.ClientOption); + CiFreeClientAuth(a.ClientAuth); + + return ret; +} + +// Create a new link +bool SmLinkCreate(HWND hWnd, SM_HUB *s) +{ + return SmLinkCreateEx(hWnd, s, false); +} +bool SmLinkCreateEx(HWND hWnd, SM_HUB *s, bool connectNow) +{ + CM_ACCOUNT a; + bool ret = false;; + // Validate arguments + if (hWnd == NULL || s == NULL) + { + return false; + } + + Zero(&a, sizeof(a)); + + a.Hub = s; + a.EditMode = false; + a.LinkMode = true; + a.ClientOption = ZeroMalloc(sizeof(CLIENT_OPTION)); + a.OnlineFlag = false; + a.ClientAuth = ZeroMalloc(sizeof(CLIENT_AUTH)); + a.ClientAuth->AuthType = CLIENT_AUTHTYPE_PASSWORD; + Copy(&a.Policy, GetDefaultPolicy(), sizeof(POLICY)); + a.ClientOption->Port = 443; // Default port number + a.ClientOption->NumRetry = INFINITE; + a.ClientOption->RetryInterval = 15; + a.ClientOption->MaxConnection = 8; + a.ClientOption->UseEncrypt = true; + a.ClientOption->HalfConnection = false; + a.ClientOption->AdditionalConnectionInterval = 1; + a.ClientOption->RequireBridgeRoutingMode = true; + a.Link_ConnectNow = connectNow; + + a.PolicyVer = s->p->PolicyVer; + + if (GetCapsBool(s->p->CapsList, "b_support_cascade_client_cert") == false) + { + a.HideClientCertAuth = true; + } + + a.HideSecureAuth = true; + + ret = CmEditAccountDlg(hWnd, &a); + + FreeX(a.ServerCert); + Free(a.ClientOption); + CiFreeClientAuth(a.ClientAuth); + + return ret; +} + +// Initialize +void SmLinkDlgInit(HWND hWnd, SM_HUB *s) +{ + // Validate arguments + if (hWnd == NULL || s == NULL) + { + return; + } + + SetIcon(hWnd, 0, ICO_LINK); + + FormatText(hWnd, 0, s->HubName); + + LvInit(hWnd, L_LINK); + + LvInsertColumn(hWnd, L_LINK, 0, _UU("SM_LINK_COLUMN_1"), 120); + LvInsertColumn(hWnd, L_LINK, 1, _UU("SM_LINK_COLUMN_2"), 150); + LvInsertColumn(hWnd, L_LINK, 2, _UU("SM_LINK_COLUMN_3"), 180); + LvInsertColumn(hWnd, L_LINK, 3, _UU("SM_LINK_COLUMN_4"), 130); + LvInsertColumn(hWnd, L_LINK, 4, _UU("SM_LINK_COLUMN_5"), 130); + + LvSetStyle(hWnd, L_LINK, LVS_EX_GRIDLINES); + + SmLinkDlgRefresh(hWnd, s); +} + +// Update the controls +void SmLinkDlgUpdate(HWND hWnd, SM_HUB *s) +{ + bool ok = true; + bool online = false; + // Validate arguments + if (hWnd == NULL || s == NULL) + { + return; + } + + if (LvIsSelected(hWnd, L_LINK) == false || LvIsMultiMasked(hWnd, L_LINK)) + { + ok = false; + } + else + { + online = (bool)LvGetParam(hWnd, L_LINK, LvGetSelected(hWnd, L_LINK)); + } + + SetEnable(hWnd, B_EDIT, ok); + SetEnable(hWnd, B_ONLINE, ok && (online == false)); + SetEnable(hWnd, B_OFFLINE, ok && online); + SetEnable(hWnd, IDOK, ok && online); + SetEnable(hWnd, B_DELETE, ok); + SetEnable(hWnd, B_RENAME, ok); +} + +// Content update +void SmLinkDlgRefresh(HWND hWnd, SM_HUB *s) +{ + LVB *b; + RPC_ENUM_LINK t; + UINT i; + // Validate arguments + if (hWnd == NULL || s == NULL) + { + return; + } + + Zero(&t, sizeof(t)); + StrCpy(t.HubName, sizeof(t.HubName), s->HubName); + if (CALL(hWnd, ScEnumLink(s->Rpc, &t)) == false) + { + EndDialog(hWnd, false); + return; + } + + b = LvInsertStart(); + + for (i = 0;i < t.NumLink;i++) + { + RPC_ENUM_LINK_ITEM *e = &t.Links[i]; + wchar_t tmp1[MAX_SIZE]; + wchar_t tmp2[MAX_SIZE]; + wchar_t tmp3[MAX_SIZE]; + wchar_t tmp4[MAX_SIZE]; + UINT icon = ICO_CASCADE; + + GetDateTimeStrEx64(tmp1, sizeof(tmp1), SystemToLocal64(e->ConnectedTime), NULL); + StrToUni(tmp2, sizeof(tmp2), e->Hostname); + StrToUni(tmp3, sizeof(tmp3), e->HubName); + + if (e->Online == false) + { + UniStrCpy(tmp4, sizeof(tmp4), _UU("SM_LINK_STATUS_OFFLINE")); + } + else + { + if (e->Connected) + { + UniStrCpy(tmp4, sizeof(tmp4), _UU("SM_LINK_STATUS_ONLINE")); + } + else + { + if (e->LastError != 0) + { + UniFormat(tmp4, sizeof(tmp4), _UU("SM_LINK_STATUS_ERROR"), e->LastError, _E(e->LastError)); + } + else + { + UniStrCpy(tmp4, sizeof(tmp4), _UU("SM_LINK_CONNECTING")); + } + } + } + + if (e->Online == false) + { + icon = ICO_CASCADE_OFFLINE; + } + else + { + if (e->Connected == false && e->LastError != 0) + { + icon = ICO_CASCADE_ERROR; + } + else + { + icon = ICO_CASCADE; + } + } + + LvInsertAdd(b, + icon, (void *)e->Online, 5, + e->AccountName, tmp4, tmp1, tmp2, tmp3); + } + + LvInsertEnd(b, hWnd, L_LINK); + + FreeRpcEnumLink(&t); + + SmLinkDlgUpdate(hWnd, s); +} + + +// Link List dialog procedure +UINT SmLinkDlgProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param) +{ + SM_HUB *s = (SM_HUB *)param; + wchar_t *str; + NMHDR *n; + NMLVDISPINFOW *disp_info; + NMLVKEYDOWN *key; + // Validate arguments + if (hWnd == NULL) + { + return 0; + } + + str = LvGetSelectedStr(hWnd, L_LINK, 0); + + switch (msg) + { + case WM_INITDIALOG: + // Initialize + SmLinkDlgInit(hWnd, s); + + if (link_create_now) + { + if (SmLinkCreateEx(hWnd, s, true)) + { + SmLinkDlgRefresh(hWnd, s); + } + } + + SetTimer(hWnd, 1, 1000, NULL); + break; + + case WM_TIMER: + switch (wParam) + { + case 1: + if (IsEnable(hWnd, 0)) + { + KillTimer(hWnd, 1); + SmLinkDlgRefresh(hWnd, s); + SetTimer(hWnd, 1, 1000, NULL); + } + break; + } + break; + + case WM_COMMAND: + switch (wParam) + { + case B_CREATE: + // Create new + if (SmLinkCreate(hWnd, s)) + { + SmLinkDlgRefresh(hWnd, s); + } + break; + + case B_EDIT: + // Edit + if (str != NULL) + { + if (SmLinkEdit(hWnd, s, str)) + { + SmLinkDlgRefresh(hWnd, s); + } + } + break; + + case B_ONLINE: + // Online + if (str != NULL) + { + RPC_LINK t; + Zero(&t, sizeof(t)); + UniStrCpy(t.AccountName, sizeof(t.AccountName), str); + StrCpy(t.HubName, sizeof(t.HubName), s->HubName); + + if (CALL(hWnd, ScSetLinkOnline(s->Rpc, &t))) + { + SmLinkDlgRefresh(hWnd, s); + } + } + break; + + case B_OFFLINE: + // Offline + if (str != NULL) + { + RPC_LINK t; + Zero(&t, sizeof(t)); + UniStrCpy(t.AccountName, sizeof(t.AccountName), str); + StrCpy(t.HubName, sizeof(t.HubName), s->HubName); + + if (MsgBoxEx(hWnd, MB_ICONEXCLAMATION | MB_YESNO | MB_DEFBUTTON2, + _UU("SM_LINK_OFFLINE_MSG"), t.AccountName) == IDYES) + { + if (CALL(hWnd, ScSetLinkOffline(s->Rpc, &t))) + { + SmLinkDlgRefresh(hWnd, s); + } + } + } + break; + + case IDOK: + // Status + if (str != NULL) + { + wchar_t tmp[MAX_SIZE]; + SM_LINK t; + Zero(&t, sizeof(t)); + t.Hub = s; + t.AccountName = str; + UniFormat(tmp, sizeof(tmp), _UU("SM_LINK_STATUS_CAPTION"), str); + SmStatusDlg(hWnd, s->p, &t, true, true, tmp, + ICO_CASCADE, NULL, SmRefreshLinkStatus); + } + break; + + case B_DELETE: + // Delete + if (str != NULL) + { + RPC_LINK t; + Zero(&t, sizeof(t)); + UniStrCpy(t.AccountName, sizeof(t.AccountName), str); + StrCpy(t.HubName, sizeof(t.HubName), s->HubName); + + if (MsgBoxEx(hWnd, MB_ICONEXCLAMATION | MB_YESNO | MB_DEFBUTTON2, + _UU("SM_LINK_DELETE_MSG"), t.AccountName) == IDYES) + { + if (CALL(hWnd, ScDeleteLink(s->Rpc, &t))) + { + SmLinkDlgRefresh(hWnd, s); + } + } + } + break; + + case B_REFRESH: + // Update + SmLinkDlgRefresh(hWnd, s); + break; + + case IDCANCEL: + // Cancel button + Close(hWnd); + break; + + case B_RENAME: + // Change the name + Focus(hWnd, L_LINK); + LvRename(hWnd, L_LINK, LvGetSelected(hWnd, L_LINK)); + break; + } + break; + + case WM_NOTIFY: + n = (NMHDR *)lParam; + switch (n->idFrom) + { + case L_LINK: + switch (n->code) + { + case LVN_ITEMCHANGED: + // Change the selection state + SmLinkDlgUpdate(hWnd, s); + break; + + case LVN_ENDLABELEDITW: + // Change the name + disp_info = (NMLVDISPINFOW *)n; + if (disp_info->item.pszText != NULL) + { + wchar_t *new_name = disp_info->item.pszText; + wchar_t *old_name = LvGetStr(hWnd, L_LINK, disp_info->item.iItem, 0); + + if (old_name != NULL) + { + if (UniStrCmp(new_name, old_name) != 0 && UniIsEmptyStr(new_name) == false) + { + RPC_RENAME_LINK t; + Zero(&t, sizeof(t)); + StrCpy(t.HubName, sizeof(t.HubName), s->HubName); + UniStrCpy(t.OldAccountName, sizeof(t.OldAccountName), old_name); + UniStrCpy(t.NewAccountName, sizeof(t.NewAccountName), new_name); + if (CALL(hWnd, ScRenameLink(s->Rpc, &t))) + { + SmLinkDlgRefresh(hWnd, s); + } + } + + Free(old_name); + } + } + break; + + case LVN_KEYDOWN: + // Keypress + key = (NMLVKEYDOWN *)n; + if (key != NULL) + { + bool ctrl, alt; + UINT code = key->wVKey; + ctrl = (GetKeyState(VK_CONTROL) & 0x8000) == 0 ? false : true; + alt = (GetKeyState(VK_MENU) & 0x8000) == 0 ? false : true; + + if (code == VK_F2) + { + Command(hWnd, B_RENAME); + } + } + break; + } + break; + } + break; + + case WM_CLOSE: + EndDialog(hWnd, false); + break; + } + + Free(str); + + LvStandardHandler(hWnd, msg, wParam, lParam, L_LINK); + + return 0; +} + +// Link List dialog +void SmLinkDlg(HWND hWnd, SM_HUB *s) +{ + SmLinkDlgEx(hWnd, s, false); +} +void SmLinkDlgEx(HWND hWnd, SM_HUB *s, bool createNow) +{ + // Validate arguments + if (hWnd == NULL || s == NULL) + { + return; + } + + link_create_now = createNow; + + Dialog(hWnd, D_SM_LINK, SmLinkDlgProc, s); +} + +// Initialize +void SmRadiusDlgInit(HWND hWnd, SM_HUB *s) +{ + RPC_RADIUS t; + // Validate arguments + if (hWnd == NULL || s == NULL) + { + return; + } + + SetIcon(hWnd, 0, ICO_TOWER); + + FormatText(hWnd, S_TITLE, s->HubName); + FormatText(hWnd, S_RADIUS_7, RADIUS_RETRY_INTERVAL, RADIUS_RETRY_TIMEOUT); + + Zero(&t, sizeof(t)); + StrCpy(t.HubName, sizeof(t.HubName), s->HubName); + + if (CALL(hWnd, ScGetHubRadius(s->Rpc, &t)) == false) + { + EndDialog(hWnd, false); + return; + } + + Check(hWnd, R_USE_RADIUS, StrLen(t.RadiusServerName) != 0); + + if (StrLen(t.RadiusServerName) != 0) + { + SetTextA(hWnd, E_HOSTNAME, t.RadiusServerName); + SetIntEx(hWnd, E_PORT, t.RadiusPort); + SetTextA(hWnd, E_SECRET1, t.RadiusSecret); + SetTextA(hWnd, E_SECRET2, t.RadiusSecret); + SetIntEx(hWnd, E_RADIUS_RETRY_INTERVAL, t.RadiusRetryInterval); + FocusEx(hWnd, E_HOSTNAME); + } + else + { + SetInt(hWnd, E_PORT, RADIUS_DEFAULT_PORT); + SetInt(hWnd, E_RADIUS_RETRY_INTERVAL, RADIUS_RETRY_INTERVAL); + } + + SmRadiusDlgUpdate(hWnd, s); +} + +// Update the control +void SmRadiusDlgUpdate(HWND hWnd, SM_HUB *s) +{ + bool ok = true; + bool b, b1; + char tmp1[MAX_SIZE]; + char tmp2[MAX_SIZE]; + // Validate arguments + if (hWnd == NULL || s == NULL) + { + return; + } + + b1 = GetCapsBool(s->p->CapsList, "b_support_radius_retry_interval_and_several_servers"); + if(b1 == false) + { + Hide(hWnd, S_RADIUS_7); + Hide(hWnd, S_RADIUS_8); + Hide(hWnd, S_RADIUS_9); + Hide(hWnd, E_RADIUS_RETRY_INTERVAL); + } + + b = IsChecked(hWnd, R_USE_RADIUS); + + SetEnable(hWnd, S_RADIUS_1, b); + SetEnable(hWnd, S_RADIUS_2, b); + SetEnable(hWnd, S_RADIUS_3, b); + SetEnable(hWnd, S_RADIUS3, b); + SetEnable(hWnd, S_RADIUS_4, b); + SetEnable(hWnd, S_RADIUS_5, b); + SetEnable(hWnd, S_RADIUS_6, b); + SetEnable(hWnd, S_RADIUS_7, b); + SetEnable(hWnd, S_RADIUS_8, b); + SetEnable(hWnd, S_RADIUS_9, b); + SetEnable(hWnd, E_HOSTNAME, b); + SetEnable(hWnd, E_PORT, b); + SetEnable(hWnd, E_SECRET1, b); + SetEnable(hWnd, E_SECRET2, b); + SetEnable(hWnd, E_RADIUS_RETRY_INTERVAL, b); + + if (b) + { + UINT p, m; + GetTxtA(hWnd, E_SECRET1, tmp1, sizeof(tmp1)); + GetTxtA(hWnd, E_SECRET2, tmp2, sizeof(tmp2)); + + if (StrCmp(tmp1, tmp2) != 0) + { + ok = false; + } + + if (IsEmpty(hWnd, E_HOSTNAME)) + { + ok = false; + } + + p = GetInt(hWnd, E_PORT); + + if (p == 0 || p >= 65536) + { + ok = false; + } + + m = GetInt(hWnd, E_RADIUS_RETRY_INTERVAL); + if (m > RADIUS_RETRY_TIMEOUT || m < RADIUS_RETRY_INTERVAL) + { + ok = false; + } + } + + SetEnable(hWnd, IDOK, ok); +} + +// [OK] button +void SmRadiusDlgOnOk(HWND hWnd, SM_HUB *s) +{ + RPC_RADIUS t; + // Validate arguments + if (hWnd == NULL || s == NULL) + { + return; + } + + Zero(&t, sizeof(t)); + StrCpy(t.HubName, sizeof(t.HubName), s->HubName); + + if (IsChecked(hWnd, R_USE_RADIUS)) + { + GetTxtA(hWnd, E_HOSTNAME, t.RadiusServerName, sizeof(t.RadiusServerName)); + t.RadiusPort = GetInt(hWnd, E_PORT); + GetTxtA(hWnd, E_SECRET1,t.RadiusSecret, sizeof(t.RadiusSecret)); + t.RadiusRetryInterval = GetInt(hWnd, E_RADIUS_RETRY_INTERVAL); + } + + if (CALL(hWnd, ScSetHubRadius(s->Rpc, &t)) == false) + { + return; + } + + EndDialog(hWnd, true); +} + + +// Radius dialog procedure +UINT SmRadiusDlgProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param) +{ + SM_HUB *s = (SM_HUB *)param; + // Validate arguments + if (hWnd == NULL) + { + return 0; + } + + switch (msg) + { + case WM_INITDIALOG: + // Initialize + SmRadiusDlgInit(hWnd, s); + break; + + case WM_COMMAND: + switch (LOWORD(wParam)) + { + case E_HOSTNAME: + case E_PORT: + case E_SECRET1: + case E_SECRET2: + case E_RADIUS_RETRY_INTERVAL: + case R_USE_RADIUS: + SmRadiusDlgUpdate(hWnd, s); + break; + } + + switch (wParam) + { + case IDOK: + // [OK] button + SmRadiusDlgOnOk(hWnd, s); + break; + + case IDCANCEL: + // Cancel button + Close(hWnd); + break; + + case R_USE_RADIUS: + if (IsChecked(hWnd, R_USE_RADIUS)) + { + FocusEx(hWnd, E_HOSTNAME); + } + break; + } + break; + + case WM_CLOSE: + EndDialog(hWnd, false); + break; + } + + return 0; +} + +// Radius Setup dialog +void SmRadiusDlg(HWND hWnd, SM_HUB *s) +{ + // Validate arguments + if (hWnd == NULL || s == NULL) + { + return; + } + + Dialog(hWnd, D_SM_RADIUS, SmRadiusDlgProc, s); +} + + +// Initialize +void SmEditAccessInit(HWND hWnd, SM_EDIT_ACCESS *s) +{ + ACCESS *a; + wchar_t tmp[MAX_SIZE]; + // Validate arguments + if (hWnd == NULL || s == NULL) + { + return; + } + + SetIcon(hWnd, 0, ICO_PASS); + + GetTxt(hWnd, 0, tmp, sizeof(tmp)); + + UniStrCat(tmp, sizeof(tmp), s->Access->IsIPv6 ? L" (IPv6)" : L" (IPv4)"); + + SetText(hWnd, 0, tmp); + + s->Inited = false; + a = s->Access; + + SetText(hWnd, E_NOTE, a->Note); + + Check(hWnd, R_DISCARD, a->Discard); + Check(hWnd, R_PASS, a->Discard == false); + SetIntEx(hWnd, E_PRIORITY, a->Priority); + + if (a->IsIPv6 == false) + { + // IPv4 + if (a->SrcIpAddress == 0 && a->SrcSubnetMask == 0) + { + Check(hWnd, R_SRC_ALL, true); + } + else + { + IpSet(hWnd, E_SRC_IP, a->SrcIpAddress); + IpSet(hWnd, E_SRC_MASK, a->SrcSubnetMask); + } + + if (a->DestIpAddress == 0 && a->DestSubnetMask == 0) + { + Check(hWnd, R_DST_ALL, true); + } + else + { + IpSet(hWnd, E_DST_IP, a->DestIpAddress); + IpSet(hWnd, E_DST_MASK, a->DestSubnetMask); + } + } + else + { + // IPv6 + if (IsZeroIP6Addr(&a->SrcIpAddress6) && IsZeroIP6Addr(&a->SrcSubnetMask6)) + { + Check(hWnd, R_SRC_ALL, true); + } + else + { + char tmp[MAX_SIZE]; + + IP6AddrToStr(tmp, sizeof(tmp), &a->SrcIpAddress6); + SetTextA(hWnd, E_SRC_IP_V6, tmp); + + Mask6AddrToStrEx(tmp, sizeof(tmp), &a->SrcSubnetMask6, false); + + if (IsNum(tmp)) + { + StrCatLeft(tmp, sizeof(tmp), "/"); + } + + SetTextA(hWnd, E_SRC_MASK_V6, tmp); + } + + if (IsZeroIP6Addr(&a->DestIpAddress6) && IsZeroIP6Addr(&a->DestSubnetMask6)) + { + Check(hWnd, R_DST_ALL, true); + } + else + { + char tmp[MAX_SIZE]; + + IP6AddrToStr(tmp, sizeof(tmp), &a->DestIpAddress6); + SetTextA(hWnd, E_DST_IP_V6, tmp); + + Mask6AddrToStrEx(tmp, sizeof(tmp), &a->DestSubnetMask6, false); + + if (IsNum(tmp)) + { + StrCatLeft(tmp, sizeof(tmp), "/"); + } + + SetTextA(hWnd, E_DST_MASK_V6, tmp); + } + } + + CbSetHeight(hWnd, C_PROTOCOL, 18); + CbAddStr(hWnd, C_PROTOCOL, _UU("SM_ACCESS_PROTO_1"), 0); + CbAddStr(hWnd, C_PROTOCOL, _UU("SM_ACCESS_PROTO_2"), 0); + CbAddStr(hWnd, C_PROTOCOL, _UU("SM_ACCESS_PROTO_3"), 0); + CbAddStr(hWnd, C_PROTOCOL, _UU("SM_ACCESS_PROTO_4"), 0); + CbAddStr(hWnd, C_PROTOCOL, _UU("SM_ACCESS_PROTO_5"), 0); + CbAddStr(hWnd, C_PROTOCOL, _UU("SM_ACCESS_PROTO_6"), 0); + + switch (a->Protocol) + { + case 0: + CbSelectIndex(hWnd, C_PROTOCOL, 0); + break; + case 6: + CbSelectIndex(hWnd, C_PROTOCOL, 1); + break; + case 17: + CbSelectIndex(hWnd, C_PROTOCOL, 2); + break; + case 1: + CbSelectIndex(hWnd, C_PROTOCOL, 3); + break; + case 58: + CbSelectIndex(hWnd, C_PROTOCOL, 4); + break; + default: + CbSelectIndex(hWnd, C_PROTOCOL, 5); + break; + } + + SetIntEx(hWnd, E_IP_PROTO, a->Protocol); + + SetIntEx(hWnd, E_SRC_PORT_1, a->SrcPortStart); + SetIntEx(hWnd, E_SRC_PORT_2, a->SrcPortEnd); + SetIntEx(hWnd, E_DST_PORT_1, a->DestPortStart); + SetIntEx(hWnd, E_DST_PORT_2, a->DestPortEnd); + + SetTextA(hWnd, E_USERNAME1, a->SrcUsername); + SetTextA(hWnd, E_USERNAME2, a->DestUsername); + + if(a->CheckSrcMac != false) + { + char mac[MAX_SIZE], mask[MAX_SIZE]; + MacToStr(mac, sizeof(mac), a->SrcMacAddress); + MacToStr(mask, sizeof(mask), a->SrcMacMask); + SetTextA(hWnd, E_SRC_MAC, mac); + SetTextA(hWnd, E_SRC_MAC_MASK, mask); + } + if(a->CheckDstMac != false) + { + char mac[MAX_SIZE], mask[MAX_SIZE]; + MacToStr(mac, sizeof(mac), a->DstMacAddress); + MacToStr(mask, sizeof(mask), a->DstMacMask); + SetTextA(hWnd, E_DST_MAC, mac); + SetTextA(hWnd, E_DST_MAC_MASK, mask); + } + Check(hWnd, R_CHECK_SRC_MAC, !a->CheckSrcMac); + Check(hWnd, R_CHECK_DST_MAC, !a->CheckDstMac); + + Check(hWnd, R_CHECK_TCP_STATE, a->CheckTcpState); + if(a->CheckTcpState != false) + { + Check(hWnd, R_ESTABLISHED, a->Established); + Check(hWnd, R_UNESTABLISHED, !a->Established); + } + + if (GetCapsBool(s->Hub->p->CapsList, "b_support_acl_group") == false) + { + SetText(hWnd, S_STATIC11, _UU("D_SM_EDIT_ACCESS@STATIC11_OLD")); + SetText(hWnd, S_STATIC12, _UU("D_SM_EDIT_ACCESS@STATIC12_OLD")); + SetText(hWnd, S_STATIC15, _UU("D_SM_EDIT_ACCESS@STATIC15_OLD")); + } + + SetEnable(hWnd, R_REDIRECT, GetCapsBool(s->Hub->p->CapsList, "b_support_redirect_url_acl")); + Check(hWnd, R_REDIRECT, (IsEmptyStr(a->RedirectUrl) ? false : true)); + + s->Inited = true; + + SmEditAccessUpdate(hWnd, s); +} + +// HTTP Redirection Settings dialog +void SmRedirect(HWND hWnd, SM_EDIT_ACCESS *s) +{ + // Validate arguments + if (s == NULL) + { + return; + } + + Dialog(hWnd, D_SM_REDIRECT, SmRedirectDlg, s); +} +UINT SmRedirectDlg(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param) +{ + SM_EDIT_ACCESS *s = (SM_EDIT_ACCESS *)param; + char tmp[MAX_REDIRECT_URL_LEN + 1]; + + switch (msg) + { + case WM_INITDIALOG: + SmRedirectDlgInit(hWnd, s); + break; + + case WM_COMMAND: + switch (LOWORD(wParam)) + { + case E_URL: + SmRedirectDlgUpdate(hWnd, s); + break; + } + + switch (wParam) + { + case IDOK: + GetTxtA(hWnd, E_URL, tmp, sizeof(tmp)); + + if (StartWith(tmp, "http://") == false && + StartWith(tmp, "https://") == false) + { + MsgBox(hWnd, MB_ICONEXCLAMATION, _UU("SM_ADVANCED_REDIRECT_URL_MSG")); + + FocusEx(hWnd, E_URL); + break; + } + + StrCpy(s->Access->RedirectUrl, sizeof(s->Access->RedirectUrl), tmp); + + EndDialog(hWnd, 1); + break; + + case IDCANCEL: + Close(hWnd); + break; + + case B_HINT: + OnceMsg(hWnd, _UU("SM_ADVANCED_REDIRECT_URL_HINT_TITLE"), + _UU("SM_ADVANCED_REDIRECT_URL_HINT"), false, ICO_INTERNET); + break; + } + break; + + case WM_CLOSE: + EndDialog(hWnd, 0); + break; + } + + return 0; +} +void SmRedirectDlgInit(HWND hWnd, SM_EDIT_ACCESS *s) +{ + ACCESS *a; + // Validate arguments + if (hWnd == NULL || s == NULL) + { + return; + } + + a = s->Access; + + DlgFont(hWnd, S_BOLD, 0, true); + DlgFont(hWnd, S_BOLD2, 0, true); + + SetFont(hWnd, E_SAMPLE1, GetFont("Verdana", 0, false, false, false, false)); + SetFont(hWnd, E_SAMPLE2, GetFont("Verdana", 0, false, false, false, false)); + SetFont(hWnd, E_URL, GetFont("Verdana", 10, false, false, false, false)); + + SetTextA(hWnd, E_SAMPLE1, "http://www.google.com/about/"); + SetTextA(hWnd, E_SAMPLE2, "http://www.google.com/search?q=|secret"); + + SetTextA(hWnd, E_URL, s->Access->RedirectUrl); + + if (IsEmpty(hWnd, E_URL)) + { + SetTextA(hWnd, E_URL, "http://"); + + SetCursorOnRight(hWnd, E_URL); + Focus(hWnd, E_URL); + } + else + { + FocusEx(hWnd, E_URL); + } + + SmRedirectDlgUpdate(hWnd, s); +} +void SmRedirectDlgUpdate(HWND hWnd, SM_EDIT_ACCESS *s) +{ + char tmp[MAX_REDIRECT_URL_LEN + 1]; + bool ok = true; + // Validate arguments + if (hWnd == NULL || s == NULL) + { + return; + } + + GetTxtA(hWnd, E_URL, tmp, sizeof(tmp)); + + if (IsEmptyStr(tmp)) + { + ok = false; + } + + SetEnable(hWnd, IDOK, ok); +} + +// Update the control +void SmEditAccessUpdate(HWND hWnd, SM_EDIT_ACCESS *s) +{ + bool ok = true; + bool tcp; + bool b; + bool check_srcmac, check_dstmac, support_mac; + bool check_state, support_check_state; + char srcmac[MAX_SIZE], srcmac_mask[MAX_SIZE], dstmac[MAX_SIZE], dstmac_mask[MAX_SIZE]; + char tmp[MAX_SIZE]; + wchar_t unitmp[MAX_SIZE]; + ACCESS *a; + // Validate arguments + if (hWnd == NULL || s == NULL) + { + return; + } + + if (s->Inited == false) + { + return; + } + + a = s->Access; + + GetTxt(hWnd, E_NOTE, a->Note, sizeof(a->Note)); + + a->Discard = IsChecked(hWnd, R_DISCARD); + + a->Priority = GetInt(hWnd, E_PRIORITY); + if (a->Priority == 0) + { + ok = false; + } + + + b = IsChecked(hWnd, R_SRC_ALL) ? false : true; + if (b == false) + { + if (a->IsIPv6 == false) + { + a->SrcIpAddress = 0; + a->SrcSubnetMask = 0; + } + else + { + Zero(&a->SrcIpAddress6, sizeof(IPV6_ADDR)); + Zero(&a->SrcSubnetMask6, sizeof(IPV6_ADDR)); + } + } + else + { + if (a->IsIPv6 == false) + { + if (IpIsFilled(hWnd, E_SRC_IP) == false || IpIsFilled(hWnd, E_SRC_MASK) == false) + { + ok = false; + } + else + { + a->SrcIpAddress = IpGet(hWnd, E_SRC_IP); + a->SrcSubnetMask = IpGet(hWnd, E_SRC_MASK); + } + } + else + { + char tmp1[MAX_SIZE]; + char tmp2[MAX_SIZE]; + + GetTxtA(hWnd, E_SRC_IP_V6, tmp1, sizeof(tmp1)); + GetTxtA(hWnd, E_SRC_MASK_V6, tmp2, sizeof(tmp2)); + + if (StrToIP6Addr(&a->SrcIpAddress6, tmp1) == false || + StrToMask6Addr(&a->SrcSubnetMask6, tmp2) == false) + { + ok = false; + } + } + } + SetEnable(hWnd, S_SRC_IP_1, b); + SetEnable(hWnd, S_SRC_IP_2, b); + SetEnable(hWnd, S_SRC_IP_3, b); + SetEnable(hWnd, E_SRC_IP, b); + SetEnable(hWnd, E_SRC_MASK, b); + SetEnable(hWnd, E_SRC_IP_V6, b); + SetEnable(hWnd, E_SRC_MASK_V6, b); + + b = IsChecked(hWnd, R_DST_ALL) ? false : true; + if (b == false) + { + if (a->IsIPv6 == false) + { + a->DestIpAddress = 0; + a->DestSubnetMask = 0; + } + else + { + Zero(&a->DestIpAddress6, sizeof(IPV6_ADDR)); + Zero(&a->DestSubnetMask6, sizeof(IPV6_ADDR)); + } + } + else + { + if (a->IsIPv6 == false) + { + if (IpIsFilled(hWnd, E_DST_IP) == false || IpIsFilled(hWnd, E_DST_MASK) == false) + { + ok = false; + } + else + { + a->DestIpAddress = IpGet(hWnd, E_DST_IP); + a->DestSubnetMask = IpGet(hWnd, E_DST_MASK); + } + } + else + { + char tmp1[MAX_SIZE]; + char tmp2[MAX_SIZE]; + + GetTxtA(hWnd, E_DST_IP_V6, tmp1, sizeof(tmp1)); + GetTxtA(hWnd, E_DST_MASK_V6, tmp2, sizeof(tmp2)); + + if (StrToIP6Addr(&a->DestIpAddress6, tmp1) == false || + StrToMask6Addr(&a->DestSubnetMask6, tmp2) == false) + { + ok = false; + } + } + } + SetEnable(hWnd, S_IP_DST_1, b); + SetEnable(hWnd, S_IP_DST_2, b); + SetEnable(hWnd, S_IP_DST_3, b); + SetEnable(hWnd, E_DST_IP, b); + SetEnable(hWnd, E_DST_MASK, b); + SetEnable(hWnd, E_DST_IP_V6, b); + SetEnable(hWnd, E_DST_MASK_V6, b); + + a->Protocol = GetInt(hWnd, C_PROTOCOL); + + GetTxtA(hWnd, C_PROTOCOL, tmp, sizeof(tmp)); + GetTxt(hWnd, C_PROTOCOL, unitmp, sizeof(unitmp)); + + if (UniStrCmpi(unitmp, _UU("SM_ACCESS_PROTO_6")) == 0 || StrCmpi(tmp, _SS("SM_ACCESS_PROTO_6")) == 0) + { + a->Protocol = GetInt(hWnd, E_IP_PROTO); + + if (IsEmpty(hWnd, E_IP_PROTO)) + { + ok = false; + } + + Enable(hWnd, S_PROTOID); + Enable(hWnd, E_IP_PROTO); + } + else + { + Disable(hWnd, E_IP_PROTO); + Disable(hWnd, S_PROTOID); + } + + tcp = false; + if (a->Protocol == 17 || a->Protocol == 6) + { + tcp = true; + } + + SetEnable(hWnd, S_TCP_1, tcp); + SetEnable(hWnd, S_TCP_2, tcp); + SetEnable(hWnd, S_TCP_3, tcp); + SetEnable(hWnd, S_TCP_4, tcp); + SetEnable(hWnd, S_TCP_5, tcp); + SetEnable(hWnd, S_TCP_6, tcp); + SetEnable(hWnd, S_TCP_7, tcp); + SetEnable(hWnd, E_SRC_PORT_1, tcp); + SetEnable(hWnd, E_SRC_PORT_2, tcp); + SetEnable(hWnd, E_DST_PORT_1, tcp); + SetEnable(hWnd, E_DST_PORT_2, tcp); + + if (tcp == false) + { + a->SrcPortEnd = a->SrcPortStart = a->DestPortEnd = a->DestPortStart = 0; + } + else + { + a->SrcPortStart = GetInt(hWnd, E_SRC_PORT_1); + a->SrcPortEnd = GetInt(hWnd, E_SRC_PORT_2); + a->DestPortStart = GetInt(hWnd, E_DST_PORT_1); + a->DestPortEnd = GetInt(hWnd, E_DST_PORT_2); + + if (a->SrcPortStart != 0) + { + if (a->SrcPortEnd != 0) + { + if (a->SrcPortStart > a->SrcPortEnd) + { + ok = false; + } + } + } + else + { + if (a->SrcPortEnd != 0) + { + ok = false; + } + } + + if (a->DestPortStart != 0) + { + if (a->DestPortEnd != 0) + { + if (a->DestPortStart > a->DestPortEnd) + { + ok = false; + } + } + } + else + { + if (a->DestPortEnd != 0) + { + ok = false; + } + } + + if (a->DestPortEnd < a->DestPortStart) + { + a->DestPortEnd = a->DestPortStart; + } + + if (a->SrcPortEnd < a->SrcPortStart) + { + a->SrcPortEnd = a->SrcPortStart; + } + } + + a->SrcUsernameHash = a->DestUsernameHash = 0; + GetTxtA(hWnd, E_USERNAME1, a->SrcUsername, sizeof(a->SrcUsername)); + GetTxtA(hWnd, E_USERNAME2, a->DestUsername, sizeof(a->DestUsername)); + + if (StartWith(a->SrcUsername, ACCESS_LIST_INCLUDED_PREFIX) == false && + StartWith(a->SrcUsername, ACCESS_LIST_EXCLUDED_PREFIX) == false) + { + MakeSimpleUsernameRemoveNtDomain(a->SrcUsername, sizeof(a->SrcUsername), a->SrcUsername); + } + + if (StartWith(a->DestUsername, ACCESS_LIST_INCLUDED_PREFIX) == false && + StartWith(a->DestUsername, ACCESS_LIST_EXCLUDED_PREFIX) == false) + { + MakeSimpleUsernameRemoveNtDomain(a->DestUsername, sizeof(a->DestUsername), a->DestUsername); + } + + Trim(a->SrcUsername); + /* + if (StrLen(a->SrcUsername) != 0) + { + if (IsUserName(a->SrcUsername) == false) + { + ok = false; + } + }*/ + + Trim(a->DestUsername); + /* + if (StrLen(a->DestUsername) != 0) + { + if (IsUserName(a->DestUsername) == false) + { + ok = false; + } + }*/ + + support_mac = GetCapsBool(s->Hub->p->CapsList, "b_support_check_mac"); + + // Set the source MAC address + check_srcmac = a->CheckSrcMac = support_mac && (IsChecked(hWnd, R_CHECK_SRC_MAC) ? false : true); + if(check_srcmac == false) + { + Zero(a->SrcMacAddress, sizeof(a->SrcMacAddress)); + Zero(a->SrcMacMask, sizeof(a->SrcMacMask)); + } + else + { + GetTxtA(hWnd, E_SRC_MAC, srcmac, sizeof(srcmac)); + GetTxtA(hWnd, E_SRC_MAC_MASK, srcmac_mask, sizeof(srcmac_mask)); + Trim(srcmac); + Trim(srcmac_mask); + if(StrLen(srcmac) != 0 && StrLen(srcmac_mask) != 0) + { + UCHAR mac[6], mask[6]; + if(StrToMac(mac, srcmac) && StrToMac(mask, srcmac_mask)) + { + Copy(a->SrcMacAddress, mac, 6); + Copy(a->SrcMacMask, mask, 6); + } + else + { + ok = false; + } + } + else + { + ok = false; + } + } + SetEnable(hWnd, S_CHECK_SRC_MAC, support_mac); + SetEnable(hWnd, R_CHECK_SRC_MAC, support_mac); + SetEnable(hWnd, S_SRC_MAC, check_srcmac); + SetEnable(hWnd, S_SRC_MAC_MASK, check_srcmac); + SetEnable(hWnd, E_SRC_MAC, check_srcmac); + SetEnable(hWnd, E_SRC_MAC_MASK, check_srcmac); + + // Set the destination MAC address + check_dstmac = a->CheckDstMac = support_mac && (IsChecked(hWnd, R_CHECK_DST_MAC) ? false : true); + if(check_dstmac == false) + { + Zero(a->DstMacAddress, sizeof(a->DstMacAddress)); + Zero(a->DstMacMask, sizeof(a->DstMacMask)); + } + else + { + GetTxtA(hWnd, E_DST_MAC, dstmac, sizeof(dstmac)); + GetTxtA(hWnd, E_DST_MAC_MASK, dstmac_mask, sizeof(dstmac_mask)); + Trim(dstmac); + Trim(dstmac_mask); + if(StrLen(dstmac) != 0 && StrLen(dstmac_mask) != 0) + { + UCHAR mac[6], mask[6]; + if(StrToMac(mac, dstmac) && StrToMac(mask, dstmac_mask)) + { + Copy(a->DstMacAddress, mac, 6); + Copy(a->DstMacMask, mask, 6); + } + else + { + ok = false; + } + } + else + { + ok = false; + } + } + SetEnable(hWnd, S_CHECK_DST_MAC, support_mac); + SetEnable(hWnd, R_CHECK_DST_MAC, support_mac); + SetEnable(hWnd, S_DST_MAC, check_dstmac); + SetEnable(hWnd, S_DST_MAC_MASK, check_dstmac); + SetEnable(hWnd, E_DST_MAC, check_dstmac); + SetEnable(hWnd, E_DST_MAC_MASK, check_dstmac); + + SetEnable(hWnd, S_MAC_NOTE, check_srcmac || check_dstmac); + + // Status of the TCP connection + support_check_state = GetCapsBool(s->Hub->p->CapsList, "b_support_check_tcp_state") && a->Protocol == 6; + SetEnable(hWnd, R_CHECK_TCP_STATE, support_check_state); + check_state = a->CheckTcpState = support_check_state && IsChecked(hWnd, R_CHECK_TCP_STATE); + + a->Established = IsChecked(hWnd, R_ESTABLISHED) && check_state; + SetEnable(hWnd, R_ESTABLISHED, check_state); + SetEnable(hWnd, R_UNESTABLISHED, check_state); + if(check_state != false && IsChecked(hWnd, R_ESTABLISHED) == false && IsChecked(hWnd, R_UNESTABLISHED) == false) + { + ok = false; + } + + // Settings button such as delay + SetEnable(hWnd, B_SIMULATION, a->Discard == false && GetCapsBool(s->Hub->p->CapsList, "b_support_ex_acl")); + + // HTTP redirection settings button + SetEnable(hWnd, B_REDIRECT, IsChecked(hWnd, R_REDIRECT) && (a->Discard == false) && GetCapsBool(s->Hub->p->CapsList, "b_support_redirect_url_acl")); + SetEnable(hWnd, R_REDIRECT, (a->Discard == false) && GetCapsBool(s->Hub->p->CapsList, "b_support_redirect_url_acl")); + + if (IsChecked(hWnd, R_REDIRECT) && (a->Discard == false) && GetCapsBool(s->Hub->p->CapsList, "b_support_redirect_url_acl")) + { + if (IsEmptyStr(a->RedirectUrl)) + { + ok = false; + } + } + + SetEnable(hWnd, IDOK, ok); +} + +// OK Click +void SmEditAccessOnOk(HWND hWnd, SM_EDIT_ACCESS *s) +{ + ACCESS *a; + // Validate arguments + if (hWnd == NULL || s == NULL) + { + return; + } + + a = s->Access; + + SmEditAccessUpdate(hWnd, s); + + if (IsChecked(hWnd, R_REDIRECT) == false || (a->Discard) || GetCapsBool(s->Hub->p->CapsList, "b_support_redirect_url_acl") == false) + { + // Disable the HTTP redirection + ClearStr(a->RedirectUrl, sizeof(a->RedirectUrl)); + } + + EndDialog(hWnd, true); +} + + +// Access list editing dialog +UINT SmEditAccessDlg(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param) +{ + SM_EDIT_ACCESS *s = (SM_EDIT_ACCESS *)param; + UINT ico; + ACCESS *a; + char tmp[MAX_SIZE]; + // Validate arguments + if (hWnd == NULL) + { + return 0; + } + + switch (msg) + { + case WM_INITDIALOG: + // Initialize + SmEditAccessInit(hWnd, s); + + goto REFRESH_ICON; + + case WM_COMMAND: + switch (LOWORD(wParam)) + { + case R_PASS: + case R_DISCARD: + case E_PRIORITY: + case R_SRC_ALL: + case E_SRC_IP: + case E_SRC_MASK: + case R_DST_ALL: + case E_DST_MASK: + case E_SRC_IP_V6: + case E_SRC_MASK_V6: + case E_DST_MASK_V6: + case E_DST_IP_V6: + case C_PROTOCOL: + case E_SRC_PORT_1: + case E_SRC_PORT_2: + case E_DST_PORT_1: + case E_DST_PORT_2: + case E_USERNAME1: + case E_USERNAME2: + case E_IP_PROTO: + case R_CHECK_SRC_MAC: + case E_SRC_MAC: + case E_SRC_MAC_MASK: + case R_CHECK_DST_MAC: + case E_DST_MAC: + case E_DST_MAC_MASK: + case R_CHECK_TCP_STATE: + case R_ESTABLISHED: + case R_UNESTABLISHED: + case R_REDIRECT: + SmEditAccessUpdate(hWnd, s); + break; + } + + switch (wParam) + { + case B_USER1: + if (GetTxtA(hWnd, E_USERNAME1, tmp, sizeof(tmp))) + { + char *ret = SmSelectUserDlgEx(hWnd, s->Hub, tmp, GetCapsBool(s->Hub->p->CapsList, "b_support_acl_group")); + if (ret == NULL) + { + SetTextA(hWnd, E_USERNAME1, ""); + } + else + { + SetTextA(hWnd, E_USERNAME1, ret); + Free(ret); + } + FocusEx(hWnd, E_USERNAME1); + } + break; + + case B_USER2: + if (GetTxtA(hWnd, E_USERNAME2, tmp, sizeof(tmp))) + { + char *ret = SmSelectUserDlgEx(hWnd, s->Hub, tmp, GetCapsBool(s->Hub->p->CapsList, "b_support_acl_group")); + if (ret == NULL) + { + SetTextA(hWnd, E_USERNAME2, ""); + } + else + { + SetTextA(hWnd, E_USERNAME2, ret); + Free(ret); + } + FocusEx(hWnd, E_USERNAME2); + } + break; + + case IDOK: + // [OK] button + SmEditAccessOnOk(hWnd, s); + break; + + case IDCANCEL: + // Cancel button + Close(hWnd); + break; + + case R_SRC_ALL: + if (IsChecked(hWnd, R_SRC_ALL) == false) + { + if (s->Access->IsIPv6) + { + FocusEx(hWnd, E_SRC_IP_V6); + } + else + { + Focus(hWnd, E_SRC_IP); + } + } + break; + + case R_DST_ALL: + if (IsChecked(hWnd, R_DST_ALL) == false) + { + if (s->Access->IsIPv6) + { + FocusEx(hWnd, E_DST_IP_V6); + } + else + { + Focus(hWnd, E_DST_IP); + } + } + break; + case R_CHECK_SRC_MAC: + if(IsChecked(hWnd, R_CHECK_SRC_MAC) == false) + { + Focus(hWnd, E_SRC_MAC); + } + break; + case R_CHECK_DST_MAC: + if(IsChecked(hWnd, R_CHECK_DST_MAC) == false) + { + Focus(hWnd, E_DST_MAC); + } + break; + + case R_PASS: + case R_DISCARD: +REFRESH_ICON: + a = s->Access; + if (a->Discard == false && a->Active == false) + { + ico = ICO_PASS_DISABLE; + } + else if (a->Discard == false && a->Active) + { + ico = ICO_PASS; + } + else if (a->Discard && a->Active == false) + { + ico = ICO_DISCARD_DISABLE; + } + else + { + ico = ICO_DISCARD; + } + + SetIcon(hWnd, S_ICON, ico); + break; + + case B_SIMULATION: + // Simulation + Dialog(hWnd, D_SM_SIMULATION, SmSimulationDlg, s); + break; + + case B_REDIRECT: + // Set the URL to redirect to + SmRedirect(hWnd, s); + SmEditAccessUpdate(hWnd, s); + break; + } + break; + + case WM_CLOSE: + EndDialog(hWnd, false); + break; + } + + return 0; +} + +// Delay, jitter, packet-loss dialog +UINT SmSimulationDlg(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param) +{ + SM_EDIT_ACCESS *s = (SM_EDIT_ACCESS *)param; + // Validate arguments + if (hWnd == NULL) + { + return 0; + } + + switch (msg) + { + case WM_INITDIALOG: + SmSimulationInit(hWnd, s); + break; + + case WM_COMMAND: + switch (LOWORD(wParam)) + { + case E_DELAY: + case E_JITTER: + case E_LOSS: + SmSimulationUpdate(hWnd, s); + break; + } + + switch (wParam) + { + case IDOK: + SmSimulationOnOk(hWnd, s); + break; + + case IDCANCEL: + Close(hWnd); + break; + + case C_DELAY: + SmSimulationUpdate(hWnd, s); + if (IsChecked(hWnd, C_DELAY)) + { + FocusEx(hWnd, E_DELAY); + } + break; + + case C_JITTER: + SmSimulationUpdate(hWnd, s); + if (IsChecked(hWnd, C_JITTER)) + { + FocusEx(hWnd, E_JITTER); + } + break; + + case C_LOSS: + SmSimulationUpdate(hWnd, s); + if (IsChecked(hWnd, C_LOSS)) + { + FocusEx(hWnd, E_LOSS); + } + break; + } + break; + + case WM_CLOSE: + EndDialog(hWnd, false); + break; + } + + return 0; +} + +// Update of delay, jitter, packet-loss dialog +void SmSimulationUpdate(HWND hWnd, SM_EDIT_ACCESS *s) +{ + bool b1, b2, b3; + bool ok = true; + // Validate arguments + if (hWnd == NULL || s == NULL) + { + return; + } + + b1 = IsChecked(hWnd, C_DELAY); + b2 = IsChecked(hWnd, C_JITTER); + b3 = IsChecked(hWnd, C_LOSS); + + SetEnable(hWnd, S_DELAY, b1); + SetEnable(hWnd, S_DELAY2, b1); + SetEnable(hWnd, E_DELAY, b1); + + SetEnable(hWnd, C_JITTER, b1); + + if (b1 == false) + { + b2 = false; + } + + SetEnable(hWnd, S_JITTER, b2); + SetEnable(hWnd, S_JITTER2, b2); + SetEnable(hWnd, E_JITTER, b2); + + SetEnable(hWnd, S_LOSS, b3); + SetEnable(hWnd, S_LOSS2, b3); + SetEnable(hWnd, E_LOSS, b3); + + if (b1) + { + UINT i = GetInt(hWnd, E_DELAY); + if (i == 0 || i > HUB_ACCESSLIST_DELAY_MAX) + { + ok = false; + } + } + + if (b2) + { + UINT i = GetInt(hWnd, E_JITTER); + if (i == 0 || i > HUB_ACCESSLIST_JITTER_MAX) + { + ok = false; + } + } + + if (b3) + { + UINT i = GetInt(hWnd, E_LOSS); + if (i == 0 || i > HUB_ACCESSLIST_LOSS_MAX) + { + ok = false; + } + } + + SetEnable(hWnd, IDOK, ok); +} + +// Initialization of delay, jitter, packet-loss dialog +void SmSimulationInit(HWND hWnd, SM_EDIT_ACCESS *s) +{ + ACCESS *a; + // Validate arguments + if (hWnd == NULL || s == NULL) + { + return; + } + + a = s->Access; + + Check(hWnd, C_DELAY, a->Delay != 0); + Check(hWnd, C_JITTER, a->Jitter != 0); + Check(hWnd, C_LOSS, a->Loss != 0); + + SetIntEx(hWnd, E_DELAY, a->Delay); + if (a->Delay != 0) + { + SetIntEx(hWnd, E_JITTER, a->Jitter); + } + SetIntEx(hWnd, E_LOSS, a->Loss); + + SmSimulationUpdate(hWnd, s); + + if (a->Delay != 0) + { + FocusEx(hWnd, E_DELAY); + } + else + { + Focus(hWnd, C_DELAY); + } +} + +// Saving of delay, jitter, packet-loss dialog +void SmSimulationOnOk(HWND hWnd, SM_EDIT_ACCESS *s) +{ + ACCESS *a; + // Validate arguments + if (hWnd == NULL || s == NULL) + { + return; + } + + a = s->Access; + + a->Jitter = a->Loss = a->Delay = 0; + + if (IsChecked(hWnd, C_DELAY)) + { + a->Delay = GetInt(hWnd, E_DELAY); + } + + if (IsChecked(hWnd, C_JITTER)) + { + a->Jitter = GetInt(hWnd, E_JITTER); + } + + if (IsChecked(hWnd, C_LOSS)) + { + a->Loss = GetInt(hWnd, E_LOSS); + } + + EndDialog(hWnd, 1); +} + +// Edit the access list +bool SmEditAccess(HWND hWnd, SM_ACCESS_LIST *s, ACCESS *a) +{ + SM_EDIT_ACCESS edit; + bool ret; + UINT i; + // Validate arguments + if (hWnd == NULL || s == NULL) + { + return false; + } + + Zero(&edit, sizeof(edit)); + edit.AccessList = s; + edit.EditMode = true; + edit.Access = ZeroMalloc(sizeof(ACCESS)); + edit.Hub = s->Hub; + Copy(edit.Access, a, sizeof(ACCESS)); + + if (edit.Access->IsIPv6 == false) + { + ret = Dialog(hWnd, D_SM_EDIT_ACCESS, SmEditAccessDlg, &edit); + } + else + { + ret = Dialog(hWnd, D_SM_EDIT_ACCESS_V6, SmEditAccessDlg, &edit); + } + + if (ret) + { + Copy(a, edit.Access, sizeof(ACCESS)); + Free(edit.Access); + Sort(s->AccessList); + + // Reassign the ID + for (i = 0;i < LIST_NUM(s->AccessList);i++) + { + ACCESS *a = LIST_DATA(s->AccessList, i); + a->Id = (i + 1); + } + } + else + { + Free(edit.Access); + } + + return ret; +} + +// Clone of the access list +bool SmCloneAccess(HWND hWnd, SM_ACCESS_LIST *s, ACCESS *t) +{ + SM_EDIT_ACCESS edit; + bool ret; + UINT i; + // Validate arguments + if (hWnd == NULL || s == NULL || t == NULL) + { + return false; + } + + Zero(&edit, sizeof(edit)); + edit.AccessList = s; + edit.Access = Clone(t, sizeof(ACCESS)); + edit.Access->Priority = 0; + edit.Hub = s->Hub; + + // Generate a number that does not duplicate with other and is larger than the priority of the cloning original + for (edit.Access->Priority = t->Priority;edit.Access->Priority != INFINITE;edit.Access->Priority++) + { + bool exists = false; + + for (i = 0;i < LIST_NUM(s->AccessList);i++) + { + ACCESS *a = LIST_DATA(s->AccessList, i); + + if (a->Priority == edit.Access->Priority) + { + exists = true; + break; + } + } + + if (exists == false) + { + break; + } + } + + if (edit.Access->IsIPv6 == false) + { + ret = Dialog(hWnd, D_SM_EDIT_ACCESS, SmEditAccessDlg, &edit); + } + else + { + ret = Dialog(hWnd, D_SM_EDIT_ACCESS_V6, SmEditAccessDlg, &edit); + } + + if (ret) + { + Insert(s->AccessList, edit.Access); + + // Reassign the ID + for (i = 0;i < LIST_NUM(s->AccessList);i++) + { + ACCESS *a = LIST_DATA(s->AccessList, i); + a->Id = (i + 1); + } + } + else + { + Free(edit.Access); + } + + return ret; +} + +// Add to Access List +bool SmAddAccess(HWND hWnd, SM_ACCESS_LIST *s, bool ipv6) +{ + SM_EDIT_ACCESS edit; + bool ret; + UINT i; + // Validate arguments + if (hWnd == NULL || s == NULL) + { + return false; + } + + Zero(&edit, sizeof(edit)); + edit.AccessList = s; + edit.Access = ZeroMalloc(sizeof(ACCESS)); + edit.Access->Active = true; + edit.Access->Priority = 0; + edit.Access->IsIPv6 = ipv6; + edit.Hub = s->Hub; + + // Get the new priority + for (i = 0;i < LIST_NUM(s->AccessList);i++) + { + ACCESS *a = LIST_DATA(s->AccessList, i); + edit.Access->Priority = MAX(edit.Access->Priority, a->Priority); + } + + if (edit.Access->Priority == 0) + { + edit.Access->Priority = 900; + } + + edit.Access->Priority += 100; + + if (edit.Access->IsIPv6 == false) + { + ret = Dialog(hWnd, D_SM_EDIT_ACCESS, SmEditAccessDlg, &edit); + } + else + { + ret = Dialog(hWnd, D_SM_EDIT_ACCESS_V6, SmEditAccessDlg, &edit); + } + + if (ret) + { + Insert(s->AccessList, edit.Access); + + // Reassign the ID + for (i = 0;i < LIST_NUM(s->AccessList);i++) + { + ACCESS *a = LIST_DATA(s->AccessList, i); + a->Id = (i + 1); + } + } + else + { + Free(edit.Access); + } + + return ret; +} + +// Initialize +void SmAccessListInit(HWND hWnd, SM_ACCESS_LIST *s) +{ + // Validate arguments + if (hWnd == NULL || s == NULL) + { + return; + } + + SetIcon(hWnd, 0, ICO_PASS); + FormatText(hWnd, S_TITLE, s->Hub->HubName); + + LvInit(hWnd, L_ACCESS_LIST); + LvInsertColumn(hWnd, L_ACCESS_LIST, 0, _UU("SM_ACCESS_COLUMN_0"), 60); + LvInsertColumn(hWnd, L_ACCESS_LIST, 1, _UU("SM_ACCESS_COLUMN_1"), 60); + LvInsertColumn(hWnd, L_ACCESS_LIST, 2, _UU("SM_ACCESS_COLUMN_2"), 60); + LvInsertColumn(hWnd, L_ACCESS_LIST, 3, _UU("SM_ACCESS_COLUMN_3"), 70); + LvInsertColumn(hWnd, L_ACCESS_LIST, 4, _UU("SM_ACCESS_COLUMN_4"), 150); + LvInsertColumn(hWnd, L_ACCESS_LIST, 5, _UU("SM_ACCESS_COLUMN_5"), 600); + + LvSetStyle(hWnd, L_ACCESS_LIST, LVS_EX_GRIDLINES); + + SetEnable(hWnd, B_ADD_V6, GetCapsBool(s->Hub->p->CapsList, "b_support_ipv6_acl")); + + SmAccessListRefresh(hWnd, s); +} + +// Update the control +void SmAccessListUpdate(HWND hWnd, SM_ACCESS_LIST *s) +{ + bool ok = true; + UINT max_access_lists = 0; + // Validate arguments + if (hWnd == NULL || s == NULL) + { + return; + } + + if (LvIsSelected(hWnd, L_ACCESS_LIST) == false || LvIsMultiMasked(hWnd, L_ACCESS_LIST)) + { + ok = false; + } + + SetEnable(hWnd, IDOK, ok); + SetEnable(hWnd, B_DELETE, ok); + SetEnable(hWnd, B_CLONE, ok); + + if (ok == false) + { + SetEnable(hWnd, B_ENABLE, false); + SetEnable(hWnd, B_DISABLE, false); + } + else + { + ACCESS *a = LvGetParam(hWnd, L_ACCESS_LIST, LvGetSelected(hWnd, L_ACCESS_LIST)); + + if (a != NULL) + { + SetEnable(hWnd, B_ENABLE, (a->Active == false)); + SetEnable(hWnd, B_DISABLE, (a->Active == true)); + } + else + { + SetEnable(hWnd, B_ENABLE, false); + SetEnable(hWnd, B_DISABLE, false); + } + } + + max_access_lists = GetCapsInt(s->Hub->p->CapsList, "i_max_access_lists"); + + SetEnable(hWnd, B_CREATE, LIST_NUM(s->AccessList) < max_access_lists); +} + +// Content update +void SmAccessListRefresh(HWND hWnd, SM_ACCESS_LIST *s) +{ + LVB *b; + UINT i; + // Validate arguments + if (hWnd == NULL || s == NULL) + { + return; + } + + b = LvInsertStart(); + + Sort(s->AccessList); + + for (i = 0;i < LIST_NUM(s->AccessList);i++) + { + ACCESS *a = LIST_DATA(s->AccessList, i); + char tmp[MAX_SIZE]; + UINT ico = ICO_PASS; + wchar_t tmp3[MAX_SIZE]; + wchar_t tmp1[MAX_SIZE]; + wchar_t tmp2[MAX_SIZE]; + GetAccessListStr(tmp, sizeof(tmp), a); + UniToStru(tmp1, a->Priority); + StrToUni(tmp2, sizeof(tmp2), tmp); + + if (a->Discard == false && a->Active == false) + { + ico = ICO_PASS_DISABLE; + } + else if (a->Discard == false && a->Active) + { + ico = ICO_PASS; + } + else if (a->Discard && a->Active == false) + { + ico = ICO_DISCARD_DISABLE; + } + else + { + ico = ICO_DISCARD; + } + + UniToStru(tmp3, a->Id); + + LvInsertAdd(b, ico, (void *)a, 6, + tmp3, + a->Discard ? _UU("SM_ACCESS_DISCARD") : _UU("SM_ACCESS_PASS"), + a->Active ? _UU("SM_ACCESS_ENABLE") : _UU("SM_ACCESS_DISABLE"), + tmp1, + a->Note, + tmp2); + } + + LvInsertEnd(b, hWnd, L_ACCESS_LIST); + LvSortEx(hWnd, L_ACCESS_LIST, 0, false, true); + + SmAccessListUpdate(hWnd, s); +} + +// Access List dialog procedure +UINT SmAccessListProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param) +{ + SM_ACCESS_LIST *s = (SM_ACCESS_LIST *)param; + NMHDR *n; + ACCESS *a; + // Validate arguments + if (hWnd == NULL) + { + return 0; + } + + switch (msg) + { + case WM_INITDIALOG: + // Initialize + SmAccessListInit(hWnd, s); + break; + + case WM_COMMAND: + switch (wParam) + { + case B_ADD: + // Add (IPv4) + if (SmAddAccess(hWnd, s, false)) + { + SmAccessListRefresh(hWnd, s); + } + break; + + case B_ADD_V6: + // Add (IPv6) + if (SmAddAccess(hWnd, s, true)) + { + SmAccessListRefresh(hWnd, s); + } + break; + + case IDOK: + // Edit + a = LvGetParam(hWnd, L_ACCESS_LIST, LvGetSelected(hWnd, L_ACCESS_LIST)); + if (a != NULL) + { + if (SmEditAccess(hWnd, s, a)) + { + SmAccessListRefresh(hWnd, s); + } + } + break; + + case B_CLONE: + // Create by cloning + a = LvGetParam(hWnd, L_ACCESS_LIST, LvGetSelected(hWnd, L_ACCESS_LIST)); + if (a != NULL) + { + if (SmCloneAccess(hWnd, s, a)) + { + SmAccessListRefresh(hWnd, s); + } + } + break; + + case B_ENABLE: + a = LvGetParam(hWnd, L_ACCESS_LIST, LvGetSelected(hWnd, L_ACCESS_LIST)); + if (a != NULL) + { + a->Active = true; + SmAccessListRefresh(hWnd, s); + } + break; + + case B_DISABLE: + a = LvGetParam(hWnd, L_ACCESS_LIST, LvGetSelected(hWnd, L_ACCESS_LIST)); + if (a != NULL) + { + a->Active = false; + SmAccessListRefresh(hWnd, s); + } + break; + + case B_DELETE: + // Delete + a = LvGetParam(hWnd, L_ACCESS_LIST, LvGetSelected(hWnd, L_ACCESS_LIST)); + if (a != NULL) + { + UINT i; + if (IsInList(s->AccessList, a)) + { + Delete(s->AccessList, a); + Free(a); + // Reassign the ID + for (i = 0;i < LIST_NUM(s->AccessList);i++) + { + ACCESS *a = LIST_DATA(s->AccessList, i); + a->Id = (i + 1); + } + SmAccessListRefresh(hWnd, s); + } + } + break; + + case B_SAVE: + // Save + { + UINT i; + bool ok; + // Save the access list + RPC_ENUM_ACCESS_LIST t; + Zero(&t, sizeof(t)); + StrCpy(t.HubName, sizeof(t.HubName), s->Hub->HubName); + t.NumAccess = LIST_NUM(s->AccessList); + t.Accesses = ZeroMalloc(sizeof(ACCESS) * t.NumAccess); + for (i = 0;i < LIST_NUM(s->AccessList);i++) + { + ACCESS *access = LIST_DATA(s->AccessList, i); + Copy(&t.Accesses[i], access, sizeof(ACCESS)); + } + + ok = CALL(hWnd, ScSetAccessList(s->Rpc, &t)); + FreeRpcEnumAccessList(&t); + if (ok) + { + EndDialog(hWnd, true); + } + } + break; + + case IDCANCEL: + // Cancel button + Close(hWnd); + break; + } + break; + + case WM_NOTIFY: + n = (NMHDR *)lParam; + switch (n->idFrom) + { + case L_ACCESS_LIST: + switch (n->code) + { + case LVN_ITEMCHANGED: + SmAccessListUpdate(hWnd, s); + break; + } + break; + } + break; + + case WM_CLOSE: + EndDialog(hWnd, false); + break; + } + + LvStandardHandler(hWnd, msg, wParam, lParam, L_ACCESS_LIST); + + return 0; +} + + +// Access List dialog +void SmAccessListDlg(HWND hWnd, SM_HUB *s) +{ + SM_ACCESS_LIST a; + UINT i; + RPC_ENUM_ACCESS_LIST t; + bool ret; + // Validate arguments + if (hWnd == NULL || s == NULL) + { + return; + } + + Zero(&a, sizeof(a)); + a.Hub = s; + a.Rpc = s->Rpc; + + // Get the access list + Zero(&t, sizeof(t)); + StrCpy(t.HubName, sizeof(t.HubName), s->HubName); + if (CALL(hWnd, ScEnumAccess(s->Rpc, &t)) == false) + { + return; + } + + a.AccessList = NewListFast(CmpAccessList); + // Add to the list + for (i = 0;i < t.NumAccess;i++) + { + ACCESS *access = ZeroMalloc(sizeof(ACCESS)); + Copy(access, &t.Accesses[i], sizeof(ACCESS)); + + Add(a.AccessList, access); + } + + // Sort + Sort(a.AccessList); + FreeRpcEnumAccessList(&t); + + // Show the dialog + ret = Dialog(hWnd, D_SM_ACCESS_LIST, SmAccessListProc, &a); + + for (i = 0;i < LIST_NUM(a.AccessList);i++) + { + ACCESS *access = LIST_DATA(a.AccessList, i); + Free(access); + } + ReleaseList(a.AccessList); +} + +// Initialize +void SmEditGroupDlgInit(HWND hWnd, SM_EDIT_GROUP *g) +{ + RPC_SET_GROUP *group; + LVB *b; + // Validate arguments + if (hWnd == NULL || g == NULL) + { + return; + } + + SetIcon(hWnd, 0, ICO_GROUP); + + group = &g->SetGroup; + + if (g->EditMode == false) + { + SetText(hWnd, 0, _UU("SM_EDIT_GROUP_CAPTION_1")); + } + else + { + wchar_t tmp[MAX_SIZE]; + UniFormat(tmp, sizeof(tmp), _UU("SM_EDIT_GROUP_CAPTION_2"), group->Name); + SetText(hWnd, 0, tmp); + } + + SetTextA(hWnd, E_GROUPNAME, group->Name); + SetText(hWnd, E_REALNAME, group->Realname); + SetText(hWnd, E_NOTE, group->Note); + + g->Inited = true; + + if (g->EditMode == false) + { + Disable(hWnd, L_STATUS); + } + else + { + LvInit(hWnd, L_STATUS); + LvInsertColumn(hWnd, L_STATUS, 0, _UU("SM_STATUS_COLUMN_1"), 0); + LvInsertColumn(hWnd, L_STATUS, 1, _UU("SM_STATUS_COLUMN_2"), 0); + LvSetStyle(hWnd, L_STATUS, LVS_EX_GRIDLINES); + + b = LvInsertStart(); + + SmInsertTrafficInfo(b, &group->Traffic); + + LvInsertEnd(b, hWnd, L_STATUS); + + LvAutoSize(hWnd, L_STATUS); + } + + Check(hWnd, R_POLICY, group->Policy != NULL); + + if (g->EditMode) + { + Disable(hWnd, E_GROUPNAME); + FocusEx(hWnd, E_REALNAME); + } + + SmEditGroupDlgUpdate(hWnd, g); +} + +// Update +void SmEditGroupDlgUpdate(HWND hWnd, SM_EDIT_GROUP *g) +{ + bool ok = true; + RPC_SET_GROUP *group; + // Validate arguments + if (hWnd == NULL || g == NULL) + { + return; + } + + if (g->Inited == false) + { + return; + } + + group = &g->SetGroup; + + GetTxtA(hWnd, E_GROUPNAME, group->Name, sizeof(group->Name)); + Trim(group->Name); + + if (IsUserName(group->Name) == false) + { + ok = false; + } + + GetTxt(hWnd, E_REALNAME, group->Realname, sizeof(group->Realname)); + UniTrim(group->Realname); + + GetTxt(hWnd, E_NOTE, group->Note, sizeof(group->Note)); + UniTrim(group->Note); + + SetEnable(hWnd, B_POLICY, IsChecked(hWnd, R_POLICY)); + + if (IsChecked(hWnd, R_POLICY)) + { + if (group->Policy == NULL) + { + ok = false; + } + } + + SetEnable(hWnd, IDOK, ok); +} + +// OK +void SmEditGroupDlgOnOk(HWND hWnd, SM_EDIT_GROUP *g) +{ + RPC_SET_GROUP *group; + RPC_SET_GROUP t; + // Validate arguments + if (hWnd == NULL || g == NULL) + { + return; + } + + SmEditGroupDlgUpdate(hWnd, g); + + group = &g->SetGroup; + + if (IsChecked(hWnd, R_POLICY) == false) + { + if (group->Policy != NULL) + { + Free(group->Policy); + group->Policy = NULL; + } + } + + Zero(&t, sizeof(t)); + Copy(&t, group, sizeof(RPC_SET_GROUP)); + + t.Policy = ClonePolicy(group->Policy); + + if (g->EditMode == false) + { + if (CALL(hWnd, ScCreateGroup(g->Rpc, &t)) == false) + { + FocusEx(hWnd, E_GROUPNAME); + return; + } + } + else + { + if (CALL(hWnd, ScSetGroup(g->Rpc, &t)) == false) + { + return; + } + } + + FreeRpcSetGroup(&t); + + if (g->EditMode == false) + { + MsgBoxEx(hWnd, MB_ICONINFORMATION, _UU("SM_GROUP_CREATED"), group->Name); + } + + EndDialog(hWnd, true); +} + +// Group editing dialog procedure +UINT SmEditGroupDlgProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param) +{ + SM_EDIT_GROUP *g = (SM_EDIT_GROUP *)param; + wchar_t tmp[MAX_SIZE]; + NMHDR *n; + // Validate arguments + if (hWnd == NULL) + { + return 0; + } + + switch (msg) + { + case WM_INITDIALOG: + // Initialize + SmEditGroupDlgInit(hWnd, g); + break; + + case WM_COMMAND: + switch (LOWORD(wParam)) + { + case E_GROUPNAME: + case E_REALNAME: + case E_NOTE: + case R_POLICY: + SmEditGroupDlgUpdate(hWnd, g); + break; + } + + switch (wParam) + { + case IDOK: + // [OK] button + SmEditGroupDlgOnOk(hWnd, g); + break; + + case IDCANCEL: + // Cancel button + Close(hWnd); + break; + + case R_POLICY: + if (IsChecked(hWnd, R_POLICY)) + { + Focus(hWnd, B_POLICY); + } + break; + + case B_POLICY: + // Security policy + UniFormat(tmp, sizeof(tmp), _UU("SM_GROUP_POLICY_CAPTION"), g->SetGroup.Name); + if (g->SetGroup.Policy == NULL) + { + POLICY *p = ClonePolicy(GetDefaultPolicy()); + if (SmPolicyDlgEx2(hWnd, p, tmp, false, g->p->PolicyVer)) + { + g->SetGroup.Policy = p; + SmEditGroupDlgUpdate(hWnd, g); + } + else + { + Free(p); + } + } + else + { + SmPolicyDlgEx2(hWnd, g->SetGroup.Policy, tmp, false, g->p->PolicyVer); + } + break; + } + break; + + case WM_NOTIFY: + n = (NMHDR *)lParam; + switch (n->idFrom) + { + case L_STATUS: + switch (n->code) + { + case LVN_ITEMCHANGED: + SmEditGroupDlgUpdate(hWnd, g); + break; + } + break; + } + break; + + case WM_CLOSE: + EndDialog(hWnd, false); + break; + } + + return 0; +} + +// Group editing dialog +bool SmEditGroupDlg(HWND hWnd, SM_GROUP *s, char *name) +{ + SM_EDIT_GROUP g; + RPC_SET_GROUP *group; + bool ret; + // Validate arguments + if (hWnd == NULL || s == NULL) + { + return false; + } + + Zero(&g, sizeof(g)); + g.EditMode = true; + g.Hub = s->Hub; + g.p = s->p; + g.Rpc = s->Rpc; + + group = &g.SetGroup; + + StrCpy(group->Name, sizeof(group->Name), name); + StrCpy(group->HubName, sizeof(group->HubName), s->Hub->HubName); + + if (CALL(hWnd, ScGetGroup(s->Rpc, group)) == false) + { + return false; + } + + ret = Dialog(hWnd, D_SM_EDIT_GROUP, SmEditGroupDlgProc, &g); + + FreeRpcSetGroup(group); + + return ret; +} + +// Group creation dialog +bool SmCreateGroupDlg(HWND hWnd, SM_GROUP *s) +{ + SM_EDIT_GROUP g; + RPC_SET_GROUP *group; + bool ret; + // Validate arguments + if (hWnd == NULL || s == NULL) + { + return false; + } + + Zero(&g, sizeof(g)); + g.EditMode = false; + g.Hub = s->Hub; + g.p = s->p; + g.Rpc = s->Rpc; + + group = &g.SetGroup; + + StrCpy(group->HubName, sizeof(group->HubName), s->Hub->HubName); + + ret = Dialog(hWnd, D_SM_EDIT_GROUP, SmEditGroupDlgProc, &g); + + FreeRpcSetGroup(group); + + return ret; +} + +// Initialize +void SmGroupListDlgInit(HWND hWnd, SM_GROUP *s) +{ + if (hWnd == NULL || s == NULL) + { + return; + } + + SetIcon(hWnd, 0, ICO_GROUP); + + // Initialize the column + LvInit(hWnd, L_GROUP); + LvInsertColumn(hWnd, L_GROUP, 0, _UU("SM_GROUPLIST_NAME"), 130); + LvInsertColumn(hWnd, L_GROUP, 1, _UU("SM_GROUPLIST_REALNAME"), 130); + LvInsertColumn(hWnd, L_GROUP, 2, _UU("SM_GROUPLIST_NOTE"), 170); + LvInsertColumn(hWnd, L_GROUP, 3, _UU("SM_GROUPLIST_NUMUSERS"), 80); + LvSetStyle(hWnd, L_GROUP, LVS_EX_GRIDLINES); + + FormatText(hWnd, S_TITLE, s->Hub->HubName); + + SmGroupListDlgRefresh(hWnd, s); + + if (s->SelectMode) + { + SetStyle(hWnd, L_GROUP, LVS_SINGLESEL); + } + + if (s->SelectMode) + { + wchar_t tmp[MAX_SIZE]; + SetText(hWnd, IDOK, _UU("SM_SELECT_GROUP")); + + if (s->SelectedGroupName != NULL) + { + UINT i; + StrToUni(tmp, sizeof(tmp), s->SelectedGroupName); + i = LvSearchStr(hWnd, L_GROUP, 0, tmp); + if (i != INFINITE) + { + LvSelect(hWnd, L_GROUP, i); + } + } + } +} + +// Update the controls +void SmGroupListDlgUpdate(HWND hWnd, SM_GROUP *s) +{ + bool ok = true; + if (hWnd == NULL || s == NULL) + { + return; + } + + if (LvIsSelected(hWnd, L_GROUP) == false || LvIsMultiMasked(hWnd, L_GROUP)) + { + ok = false; + } + + SetEnable(hWnd, IDOK, ok); + SetEnable(hWnd, B_USER, ok); + SetEnable(hWnd, B_STATUS, ok); + + if (s->SelectMode == false) + { + SetEnable(hWnd, B_DELETE, ok); + } + else + { + SetEnable(hWnd, B_DELETE, false); + SetEnable(hWnd, B_USER, false); + SetText(hWnd, IDCANCEL, _UU("SM_SELECT_NO_GROUP")); + } +} + +// Content update +void SmGroupListDlgRefresh(HWND hWnd, SM_GROUP *s) +{ + RPC_ENUM_GROUP t; + UINT i; + LVB *b; + if (hWnd == NULL || s == NULL) + { + return; + } + + Zero(&t, sizeof(t)); + StrCpy(t.HubName, sizeof(t.HubName), s->Hub->HubName); + + if (CALL(hWnd, ScEnumGroup(s->Rpc, &t)) == false) + { + return; + } + + b = LvInsertStart(); + + for (i = 0;i < t.NumGroup;i++) + { + wchar_t tmp1[MAX_SIZE]; + wchar_t tmp2[MAX_SIZE]; + RPC_ENUM_GROUP_ITEM *e = &t.Groups[i]; + + StrToUni(tmp1, sizeof(tmp1), e->Name); + UniToStru(tmp2, e->NumUsers); + + LvInsertAdd(b, e->DenyAccess == false ? ICO_GROUP : ICO_GROUP_DENY, + NULL, 4, tmp1, e->Realname, e->Note, tmp2); + } + + LvInsertEnd(b, hWnd, L_GROUP); + + SmGroupListDlgUpdate(hWnd, s); + + FreeRpcEnumGroup(&t); +} + +// Group List dialog procedure +UINT SmGroupListDlgProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param) +{ + SM_GROUP *s = (SM_GROUP *)param; + NMHDR *n; + wchar_t *tmp; + // Validate arguments + if (hWnd == NULL) + { + return 0; + } + + switch (msg) + { + case WM_INITDIALOG: + // Initialize + SmGroupListDlgInit(hWnd, s); + break; + + case WM_COMMAND: + switch (wParam) + { + case B_CREATE: + // Create new + if (SmCreateGroupDlg(hWnd, s)) + { + SmGroupListDlgRefresh(hWnd, s); + } + break; + + case IDOK: + // Edit + tmp = LvGetSelectedStr(hWnd, L_GROUP, 0); + if (tmp != NULL) + { + char name[MAX_SIZE]; + UniToStr(name, sizeof(name), tmp); + + if (s->SelectMode == false) + { + if (SmEditGroupDlg(hWnd, s, name)) + { + SmGroupListDlgRefresh(hWnd, s); + } + } + else + { + s->SelectedGroupName = CopyStr(name); + EndDialog(hWnd, true); + } + Free(tmp); + } + break; + + case B_DELETE: + // Delete + tmp = LvGetSelectedStr(hWnd, L_GROUP, 0); + if (tmp != NULL) + { + char name[MAX_SIZE]; + RPC_DELETE_USER t; + UniToStr(name, sizeof(name), tmp); + + if (MsgBoxEx(hWnd, MB_ICONQUESTION | MB_YESNO | MB_DEFBUTTON2, + _UU("SM_GROUP_DELETE_MSG"), name) == IDYES) + { + Zero(&t, sizeof(t)); + StrCpy(t.HubName, sizeof(t.HubName), s->Hub->HubName); + StrCpy(t.Name, sizeof(t.Name), name); + + if (CALL(hWnd, ScDeleteGroup(s->Rpc, &t))) + { + SmGroupListDlgRefresh(hWnd, s); + } + } + + Free(tmp); + } + break; + + case B_USER: + // Member List + tmp = LvGetSelectedStr(hWnd, L_GROUP, 0); + if (tmp != NULL) + { + char name[MAX_SIZE]; + UniToStr(name, sizeof(name), tmp); + SmUserListDlgEx(hWnd, s->Hub, name, false); + Free(tmp); + } + break; + + case B_REFRESH: + // Update to the latest information + SmGroupListDlgRefresh(hWnd, s); + break; + + case IDCANCEL: + // Cancel button + Close(hWnd); + break; + } + break; + + case WM_NOTIFY: + n = (NMHDR *)lParam; + switch (n->idFrom) + { + case L_GROUP: + switch (n->code) + { + case LVN_ITEMCHANGED: + SmGroupListDlgUpdate(hWnd, s); + break; + } + break; + } + break; + + case WM_CLOSE: + EndDialog(hWnd, false); + break; + } + + LvStandardHandler(hWnd, msg, wParam, lParam, L_GROUP); + + return 0; +} + +// Group List dialog (selection mode) +char *SmSelectGroupDlg(HWND hWnd, SM_HUB *s, char *default_name) +{ + SM_GROUP g; + // Validate arguments + if (hWnd == NULL || s == NULL) + { + return NULL; + } + + Zero(&g, sizeof(g)); + g.Hub = s; + g.p = s->p; + g.Rpc = s->Rpc; + g.SelectMode = true; + g.SelectedGroupName = default_name; + + if (Dialog(hWnd, D_SM_GROUP, SmGroupListDlgProc, &g) == false) + { + return NULL; + } + + return g.SelectedGroupName; +} + +// Group List dialog +void SmGroupListDlg(HWND hWnd, SM_HUB *s) +{ + SM_GROUP g; + // Validate arguments + if (hWnd == NULL || s == NULL) + { + return; + } + + Zero(&g, sizeof(g)); + g.Hub = s; + g.p = s->p; + g.Rpc = s->Rpc; + g.SelectMode = false; + + Dialog(hWnd, D_SM_GROUP, SmGroupListDlgProc, &g); +} + +// Update the user information +bool SmRefreshUserInfo(HWND hWnd, SM_SERVER *s, void *param) +{ + RPC_SET_USER t; + SM_USER_INFO *p = (SM_USER_INFO *)param; + LVB *b; + wchar_t tmp[MAX_SIZE]; + char *username; + + // Validate arguments + if (hWnd == NULL || s == NULL || param == NULL) + { + return false; + } + + username = p->Username; + + Zero(&t, sizeof(t)); + StrCpy(t.HubName, sizeof(t.HubName), p->Hub->HubName); + StrCpy(t.Name, sizeof(t.Name), username); + + if (CALL(hWnd, ScGetUser(s->Rpc, &t)) == false) + { + return false; + } + + b = LvInsertStart(); + + StrToUni(tmp, sizeof(tmp), t.Name); + LvInsertAdd(b, ICO_USER, NULL, 2, _UU("SM_USERINFO_NAME"), tmp); + + if (StrLen(t.GroupName) != 0) + { + StrToUni(tmp, sizeof(tmp), t.GroupName); + LvInsertAdd(b, ICO_GROUP, NULL, 2, _UU("SM_USERINFO_GROUP"), tmp); + } + + GetDateTimeStrEx64(tmp, sizeof(tmp), SystemToLocal64(t.CreatedTime), NULL); + LvInsertAdd(b, ICO_USER_ADMIN, NULL, 2, _UU("SM_USERINFO_CREATE"), tmp); + + GetDateTimeStrEx64(tmp, sizeof(tmp), SystemToLocal64(t.UpdatedTime), NULL); + LvInsertAdd(b, ICO_USER_ADMIN, NULL, 2, _UU("SM_USERINFO_UPDATE"), tmp); + + if (t.ExpireTime != 0) + { + GetDateTimeStrEx64(tmp, sizeof(tmp), SystemToLocal64(t.ExpireTime), NULL); + LvInsertAdd(b, ICO_WARNING, NULL, 2, _UU("SM_USERINFO_EXPIRE"), tmp); + } + + SmInsertTrafficInfo(b, &t.Traffic); + + UniToStru(tmp, t.NumLogin); + LvInsertAdd(b, ICO_LINK, NULL, 2, _UU("SM_USERINFO_NUMLOGIN"), tmp); + + LvInsertEnd(b, hWnd, L_STATUS); + + FreeRpcSetUser(&t); + + return true; +} + +// Initialize +void SmPolicyDlgInit(HWND hWnd, SM_POLICY *s) +{ + CM_POLICY cp; + // Validate arguments + if (hWnd == NULL || s == NULL) + { + return; + } + + SetIcon(hWnd, 0, ICO_MACHINE); + SetText(hWnd, 0, s->Caption); + SetText(hWnd, S_TITLE, s->Caption); + DlgFont(hWnd, S_BOLD, 10, true); + DlgFont(hWnd, S_BOLD2, 10, true); + + DlgFont(hWnd, S_POLICY_TITLE, 11, false); + DlgFont(hWnd, E_POLICY_DESCRIPTION, 10, false); + + Zero(&cp, sizeof(cp)); + cp.Policy = s->Policy; + cp.Extension = true; + + LvInit(hWnd, L_POLICY); + LvInsertColumn(hWnd, L_POLICY, 0, _UU("POL_TITLE_STR"), 250); + LvInsertColumn(hWnd, L_POLICY, 1, _UU("POL_VALUE_STR"), 150); + LvSetStyle(hWnd, L_POLICY, LVS_EX_GRIDLINES); + + CmPolicyDlgPrintEx2(hWnd, &cp, s->CascadeMode, s->Ver); + + LvSelect(hWnd, L_POLICY, 0); + + s->Inited = true; + SmPolicyDlgUpdate(hWnd, s); +} + +// Update +void SmPolicyDlgUpdate(HWND hWnd, SM_POLICY *s) +{ + bool ok = true; + bool value_changed = false; + UINT i; + // Validate arguments + if (hWnd == NULL || s == NULL) + { + return; + } + + if (s->Inited == false) + { + return; + } + + i = LvGetSelected(hWnd, L_POLICY); + if (i != INFINITE) + { + i = (UINT)LvGetParam(hWnd, L_POLICY, i); + } + if (i == INFINITE || i >= NUM_POLICY_ITEM) + { + SetText(hWnd, S_POLICY_TITLE, _UU("SM_POLICY_INIT_TITLE")); + SetText(hWnd, E_POLICY_DESCRIPTION, L""); + Disable(hWnd, S_POLICY_TITLE); + Disable(hWnd, S_BOLD); + Hide(hWnd, S_BOLD2); + Hide(hWnd, R_ENABLE); + Hide(hWnd, R_DISABLE); + Hide(hWnd, R_DEFINE); + Hide(hWnd, E_VALUE); + Hide(hWnd, S_TANI); + Hide(hWnd, S_LIMIT); + } + else + { + POLICY_ITEM *item = &policy_item[i]; + bool changed = false; + wchar_t *tmp = GetText(hWnd, S_POLICY_TITLE); + if (UniStrCmp(tmp, GetPolicyTitle(i)) != 0) + { + changed = true; + } + Free(tmp); + SetText(hWnd, S_POLICY_TITLE, GetPolicyTitle(i)); + SetText(hWnd, E_POLICY_DESCRIPTION, GetPolicyDescription(i)); + Enable(hWnd, S_POLICY_TITLE); + Enable(hWnd, S_BOLD); + Show(hWnd, S_BOLD2); + + if (item->TypeInt == false) + { + Show(hWnd, R_ENABLE); + Show(hWnd, R_DISABLE); + Hide(hWnd, R_DEFINE); + Hide(hWnd, E_VALUE); + Hide(hWnd, S_TANI); + Hide(hWnd, S_LIMIT); + + if (changed) + { + if (POLICY_BOOL(s->Policy, i)) + { + Check(hWnd, R_ENABLE, true); + Check(hWnd, R_DISABLE, false); + } + else + { + Check(hWnd, R_ENABLE, false); + Check(hWnd, R_DISABLE, true); + } + } + + if ((!(POLICY_BOOL(s->Policy, i))) != (!(IsChecked(hWnd, R_ENABLE)))) + { + POLICY_BOOL(s->Policy, i) = IsChecked(hWnd, R_ENABLE); + value_changed = true; + } + } + else + { + wchar_t tmp[MAX_SIZE]; + UINT value; + if (item->AllowZero) + { + if (changed) + { + Check(hWnd, R_DEFINE, POLICY_INT(s->Policy, i) != 0); + Enable(hWnd, R_DEFINE); + SetIntEx(hWnd, E_VALUE, POLICY_INT(s->Policy, i)); + } + + SetEnable(hWnd, E_VALUE, IsChecked(hWnd, R_DEFINE)); + SetEnable(hWnd, S_TANI, IsChecked(hWnd, R_DEFINE)); + SetEnable(hWnd, S_LIMIT, IsChecked(hWnd, R_DEFINE)); + } + else + { + if (changed) + { + Check(hWnd, R_DEFINE, true); + Disable(hWnd, R_DEFINE); + SetInt(hWnd, E_VALUE, POLICY_INT(s->Policy, i)); + } + + SetEnable(hWnd, E_VALUE, IsChecked(hWnd, R_DEFINE)); + SetEnable(hWnd, S_TANI, IsChecked(hWnd, R_DEFINE)); + SetEnable(hWnd, S_LIMIT, IsChecked(hWnd, R_DEFINE)); + } + + UniReplaceStrEx(tmp, sizeof(tmp), _UU(policy_item[i].FormatStr), + L"%u ", L"", false); + UniReplaceStrEx(tmp, sizeof(tmp), tmp, + L"%u", L"", false); + + SetText(hWnd, S_TANI, tmp); + + UniFormat(tmp, sizeof(tmp), _UU("SM_LIMIT_STR"), policy_item[i].MinValue, policy_item[i].MaxValue); + SetText(hWnd, S_LIMIT, tmp); + + Hide(hWnd, R_ENABLE); + Hide(hWnd, R_DISABLE); + Show(hWnd, E_VALUE); + Show(hWnd, R_DEFINE); + Show(hWnd, S_TANI); + Show(hWnd, S_LIMIT); + + value = GetInt(hWnd, E_VALUE); + + if (item->AllowZero && (IsChecked(hWnd, R_DEFINE) == false)) + { + value = 0; + } + else + { + if (value < policy_item[i].MinValue || value > policy_item[i].MaxValue) + { + ok = false; + } + } + + if (ok) + { + if (POLICY_INT(s->Policy, i) != value) + { + POLICY_INT(s->Policy, i) = value; + value_changed = true; + } + } + } + } + + SetEnable(hWnd, IDOK, ok); + SetEnable(hWnd, L_POLICY, ok); + + if (value_changed) + { + CM_POLICY cp; + Zero(&cp, sizeof(cp)); + cp.Policy = s->Policy; + cp.Extension = true; + + CmPolicyDlgPrintEx(hWnd, &cp, s->CascadeMode); + } +} + +// Confirmation +void SmPolicyDlgOk(HWND hWnd, SM_POLICY *s) +{ + // Validate arguments + if (hWnd == NULL || s == NULL) + { + return; + } + + EndDialog(hWnd, true); +} + +// Policy dialog box procedure +UINT SmPolicyDlgProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param) +{ + SM_POLICY *s = (SM_POLICY *)param; + NMHDR *n; + // Validate arguments + if (hWnd == NULL) + { + return 0; + } + + switch (msg) + { + case WM_INITDIALOG: + // Initialize + SmPolicyDlgInit(hWnd, s); + break; + + case WM_COMMAND: + switch (LOWORD(wParam)) + { + case R_DEFINE: + case R_ENABLE: + case R_DISABLE: + case E_VALUE: + SmPolicyDlgUpdate(hWnd, s); + break; + } + + switch (wParam) + { + case IDOK: + // [OK] button + SmPolicyDlgOk(hWnd, s); + break; + + case IDCANCEL: + // Cancel button + Close(hWnd); + break; + + case R_DEFINE: + if (IsChecked(hWnd, R_DEFINE)) + { + FocusEx(hWnd, E_VALUE); + } + break; + } + break; + + case WM_NOTIFY: + n = (NMHDR *)lParam; + switch (n->idFrom) + { + case L_POLICY: + switch (n->code) + { + case LVN_ITEMCHANGED: + SmPolicyDlgUpdate(hWnd, s); + break; + } + break; + } + break; + + case WM_CLOSE: + EndDialog(hWnd, false); + break; + } + + return 0; +} + +// Show Policies dialog box +bool SmPolicyDlg(HWND hWnd, POLICY *p, wchar_t *caption) +{ + return SmPolicyDlgEx(hWnd, p, caption, false); +} +bool SmPolicyDlgEx(HWND hWnd, POLICY *p, wchar_t *caption, bool cascade_mode) +{ + return SmPolicyDlgEx2(hWnd, p, caption, cascade_mode, POLICY_CURRENT_VERSION); +} +bool SmPolicyDlgEx2(HWND hWnd, POLICY *p, wchar_t *caption, bool cascade_mode, UINT ver) +{ + SM_POLICY s; + bool ret; + // Validate arguments + if (hWnd == NULL || p == NULL) + { + return false; + } + + if (caption == NULL) + { + caption = _UU("SM_POLICY_DEF_CAPTION"); + } + + Zero(&s, sizeof(s)); + s.Caption = caption; + s.Policy = ClonePolicy(p); + s.CascadeMode = cascade_mode; + s.Ver = ver; + + ret = Dialog(hWnd, D_SM_POLICY, SmPolicyDlgProc, &s); + + if (ret) + { + Copy(p, s.Policy, sizeof(POLICY)); + } + + Free(s.Policy); + + return ret; +} + +// Edit user confirmed +void SmEditUserDlgOk(HWND hWnd, SM_EDIT_USER *s) +{ + RPC_SET_USER t; + RPC_SET_USER *u; + // Validate arguments + if (hWnd == NULL || s == NULL) + { + return; + } + + SmEditUserDlgUpdate(hWnd, s); + + Zero(&t, sizeof(t)); + u = &s->SetUser; + + StrCpy(t.HubName, sizeof(t.HubName), u->HubName); + StrCpy(t.Name, sizeof(t.Name), u->Name); + StrCpy(t.GroupName, sizeof(t.GroupName), u->GroupName); + UniStrCpy(t.Realname, sizeof(t.Realname), u->Realname); + UniStrCpy(t.Note, sizeof(t.Note), u->Note); + t.ExpireTime = u->ExpireTime; + t.AuthType = u->AuthType; + t.AuthData = CopyAuthData(u->AuthData, t.AuthType); + + if (IsChecked(hWnd, R_POLICY)) + { + t.Policy = ClonePolicy(u->Policy); + } + else + { + t.Policy = NULL; + } + + if (s->EditMode == false) + { + if (CALL(hWnd, ScCreateUser(s->Rpc, &t)) == false) + { + FocusEx(hWnd, E_USERNAME); + return; + } + FreeRpcSetUser(&t); + + MsgBoxEx(hWnd, MB_ICONINFORMATION, _UU("SM_USER_CREATE_OK"), u->Name); + } + else + { + if (CALL(hWnd, ScSetUser(s->Rpc, &t)) == false) + { + FocusEx(hWnd, E_REALNAME); + return; + } + FreeRpcSetUser(&t); + } + + EndDialog(hWnd, true); +} + +// Edit user initialization +void SmEditUserDlgInit(HWND hWnd, SM_EDIT_USER *s) +{ + RPC_SET_USER *u; + wchar_t tmp[MAX_SIZE]; + UINT i; + UINT icons[6] = {ICO_PASS, ICO_KEY, ICO_CERT, ICO_SERVER_CERT, + ICO_TOWER, ICO_LINK}; + RECT rect; + + // Validate arguments + if (hWnd == NULL || s == NULL) + { + return; + } + + SetIcon(hWnd, 0, ICO_USER); + + u = &s->SetUser; + + // Initialize the column + LvInit(hWnd, L_AUTH); + LvSetStyle(hWnd, L_AUTH, LVS_EX_GRIDLINES); + + GetClientRect(DlgItem(hWnd, L_AUTH), &rect); + LvInsertColumn(hWnd, L_AUTH, 0, L"Name", rect.right - rect.left); + + for (i = 0;i < 6;i++) + { + LvInsert(hWnd, L_AUTH, icons[i], (void *)i, 1, SmGetAuthTypeStr(i)); + } + + // User name, etc. + SetTextA(hWnd, E_USERNAME, u->Name); + SetText(hWnd, E_REALNAME, u->Realname); + SetText(hWnd, E_NOTE, u->Note); + + + // Expiration date + if (u->ExpireTime == 0) + { + SYSTEMTIME st; + Check(hWnd, R_EXPIRES, false); + GetLocalTime(&st); + UINT64ToSystem(&st, SystemToUINT64(&st) + (60 * 60 * 24 * 1000)); + st.wHour = st.wMinute = st.wSecond = st.wMilliseconds = 0; + DateTime_SetSystemtime(DlgItem(hWnd, E_EXPIRES_DATE), GDT_VALID, &st); + DateTime_SetSystemtime(DlgItem(hWnd, E_EXPIRES_TIME), GDT_VALID, &st); + } + else + { + SYSTEMTIME st; + UINT64ToSystem(&st, SystemToLocal64(u->ExpireTime)); + Check(hWnd, R_EXPIRES, true); + DateTime_SetSystemtime(DlgItem(hWnd, E_EXPIRES_DATE), GDT_VALID, &st); + DateTime_SetSystemtime(DlgItem(hWnd, E_EXPIRES_TIME), GDT_VALID, &st); + } + + if (GetCurrentOsLangId() == SE_LANG_JAPANESE || GetCurrentOsLangId() == SE_LANG_CHINESE_ZH) + { + SetStyle(hWnd, E_EXPIRES_DATE, DTS_LONGDATEFORMAT); + } + else + { + SetStyle(hWnd, E_EXPIRES_DATE, DTS_SHORTDATEFORMAT); + } + + SetWindowLong(DlgItem(hWnd, E_EXPIRES_TIME), GWL_STYLE, WS_CHILDWINDOW | WS_VISIBLE | WS_TABSTOP | DTS_RIGHTALIGN | DTS_TIMEFORMAT | DTS_UPDOWN); + + // Group name + SetTextA(hWnd, E_GROUP, u->GroupName); + + // Authentication method + LvSelect(hWnd, L_AUTH, u->AuthType); + + SetText(hWnd, S_CERT_INFO, _UU("SM_EDIT_USER_CERT_INFO")); + + switch (u->AuthType) + { + case AUTHTYPE_PASSWORD: + if (s->EditMode) + { + SetTextA(hWnd, E_PASSWORD1, HIDDEN_PASSWORD); + SetTextA(hWnd, E_PASSWORD2, HIDDEN_PASSWORD); + } + break; + + case AUTHTYPE_USERCERT: + SmGetCertInfoStr(tmp, sizeof(tmp), ((AUTHUSERCERT *)u->AuthData)->UserX); + break; + + case AUTHTYPE_ROOTCERT: + if (u->AuthData != NULL) + { + AUTHROOTCERT *c = (AUTHROOTCERT *)u->AuthData; + if (c->CommonName != NULL && UniStrLen(c->CommonName) != 0) + { + Check(hWnd, R_CN, true); + SetText(hWnd, E_CN, c->CommonName); + } + else + { + Check(hWnd, R_CN, false); + } + if (c->Serial != NULL && c->Serial->size != 0) + { + X_SERIAL *s = c->Serial; + char *tmp; + UINT tmp_size = s->size * 3 + 1; + tmp = ZeroMalloc(tmp_size); + BinToStrEx(tmp, tmp_size, s->data, s->size); + SetTextA(hWnd, E_SERIAL, tmp); + Free(tmp); + Check(hWnd, R_SERIAL, true); + } + else + { + Check(hWnd, R_SERIAL, false); + } + } + break; + + case AUTHTYPE_RADIUS: + if (u->AuthData != NULL) + { + AUTHRADIUS *r = (AUTHRADIUS *)u->AuthData; + if (UniStrLen(r->RadiusUsername) != 0) + { + Check(hWnd, R_SET_RADIUS_USERNAME, true); + SetText(hWnd, E_RADIUS_USERNAME, r->RadiusUsername); + } + else + { + Check(hWnd, R_SET_RADIUS_USERNAME, false); + } + } + break; + + case AUTHTYPE_NT: + if (u->AuthData != NULL) + { + AUTHNT *n = (AUTHNT *)u->AuthData; + if (UniStrLen(n->NtUsername) != 0) + { + Check(hWnd, R_SET_RADIUS_USERNAME, true); + SetText(hWnd, E_RADIUS_USERNAME, n->NtUsername); + } + else + { + Check(hWnd, R_SET_RADIUS_USERNAME, false); + } + } + break; + } + + if (u->Policy != NULL) + { + Check(hWnd, R_POLICY, true); + } + + s->Inited = true; + + SmEditUserDlgUpdate(hWnd, s); + + if (s->EditMode == false) + { + Focus(hWnd, E_USERNAME); + SetText(hWnd, 0, _UU("SM_EDIT_USER_CAPTION_1")); + } + else + { + wchar_t tmp[MAX_SIZE]; + UniFormat(tmp, sizeof(tmp), _UU("SM_EDIT_USER_CAPTION_2"), s->SetUser.Name); + SetText(hWnd, 0, tmp); + + Disable(hWnd, E_USERNAME); + FocusEx(hWnd, E_REALNAME); + } + + SetShow(hWnd, S_HINT, (s->EditMode ? false : true)); +} + +// User edit control update +void SmEditUserDlgUpdate(HWND hWnd, SM_EDIT_USER *s) +{ + RPC_SET_USER *u; + bool ok = true; + UINT old_authtype; + char tmp1[MAX_SIZE]; + char tmp2[MAX_SIZE]; + bool authtype_changed = false; + // Validate arguments + if (hWnd == NULL || s == NULL) + { + return; + } + + if (s->Inited == false) + { + return; + } + + u = &s->SetUser; + + // User name + GetTxtA(hWnd, E_USERNAME, u->Name, sizeof(u->Name)); + Trim(u->Name); + if (StrLen(u->Name) == 0 || IsUserName(u->Name) == false) + { + ok = false; + } + + // Real name + GetTxt(hWnd, E_REALNAME, u->Realname, sizeof(u->Realname)); + UniTrim(u->Realname); + + // Note + GetTxt(hWnd, E_NOTE, u->Note, sizeof(u->Note)); + UniTrim(u->Realname); + + // Group + GetTxtA(hWnd, E_GROUP, u->GroupName, sizeof(u->GroupName)); + Trim(u->GroupName); + + // Expiration date + if (IsChecked(hWnd, R_EXPIRES) == false) + { + u->ExpireTime = 0; + Disable(hWnd, E_EXPIRES_DATE); + Disable(hWnd, E_EXPIRES_TIME); + } + else + { + SYSTEMTIME st1, st2; + Enable(hWnd, E_EXPIRES_DATE); + Enable(hWnd, E_EXPIRES_TIME); + DateTime_GetSystemtime(DlgItem(hWnd, E_EXPIRES_DATE), &st1); + DateTime_GetSystemtime(DlgItem(hWnd, E_EXPIRES_TIME), &st2); + st1.wHour = st2.wHour; + st1.wMinute = st2.wMinute; + st1.wSecond = st2.wSecond; + st1.wMilliseconds = st2.wMilliseconds; + u->ExpireTime = LocalToSystem64(SystemToUINT64(&st1)); + } + + // Authentication method + old_authtype = u->AuthType; + u->AuthType = LvGetSelected(hWnd, L_AUTH); + + if (StrCmpi(u->Name, "*") == 0) + { + if (u->AuthType != AUTHTYPE_RADIUS && u->AuthType != AUTHTYPE_NT) + { + ok = false; + } + } + + if (u->AuthType == INFINITE) + { + ok = false; + u->AuthType = 0; + } + if (old_authtype != u->AuthType) + { + authtype_changed = true; + } + + if (authtype_changed) + { + FreeAuthData(old_authtype, u->AuthData); + u->AuthData = NULL; + switch (u->AuthType) + { + case AUTHTYPE_ANONYMOUS: + u->AuthData = NULL; + break; + + case AUTHTYPE_PASSWORD: + u->AuthData = NewPasswordAuthData("", ""); + GetTxtA(hWnd, E_PASSWORD1, tmp1, sizeof(tmp1)); + if (StrCmp(tmp1, HIDDEN_PASSWORD) == 0) + { + SetTextA(hWnd, E_PASSWORD1, ""); + } + GetTxtA(hWnd, E_PASSWORD2, tmp2, sizeof(tmp2)); + if (StrCmp(tmp2, HIDDEN_PASSWORD) == 0) + { + SetTextA(hWnd, E_PASSWORD2, ""); + } + break; + + case AUTHTYPE_USERCERT: + u->AuthData = NewUserCertAuthData(NULL); + SetText(hWnd, S_CERT_INFO, _UU("SM_EDIT_USER_CERT_INFO")); + break; + + case AUTHTYPE_ROOTCERT: + u->AuthData = NewRootCertAuthData(NULL, NULL); + break; + + case AUTHTYPE_NT: + u->AuthData = NewNTAuthData(L""); + break; + + case AUTHTYPE_RADIUS: + u->AuthData = NewRadiusAuthData(L""); + break; + } + } + + SetEnable(hWnd, S_RADIUS_3, (u->AuthType == AUTHTYPE_RADIUS) || (u->AuthType == AUTHTYPE_NT)); + SetEnable(hWnd, R_SET_RADIUS_USERNAME, (u->AuthType == AUTHTYPE_RADIUS) || (u->AuthType == AUTHTYPE_NT)); + SetEnable(hWnd, S_RADIUS_1, (u->AuthType == AUTHTYPE_RADIUS) || (u->AuthType == AUTHTYPE_NT)); + + if (StrCmp(u->Name, "*") == 0) + { + Check(hWnd, R_SET_RADIUS_USERNAME, false); + Disable(hWnd, R_SET_RADIUS_USERNAME); + } + + if ((u->AuthType == AUTHTYPE_RADIUS) || (u->AuthType == AUTHTYPE_NT)) + { + SetEnable(hWnd, E_RADIUS_USERNAME, IsChecked(hWnd, R_SET_RADIUS_USERNAME)); + SetEnable(hWnd, S_RADIUS_2, IsChecked(hWnd, R_SET_RADIUS_USERNAME)); + } + else + { + SetEnable(hWnd, E_RADIUS_USERNAME, false); + SetEnable(hWnd, S_RADIUS_2, false); + } + + SetEnable(hWnd, S_PASSWORD_1, u->AuthType == AUTHTYPE_PASSWORD); + SetEnable(hWnd, S_PASSWORD_2, u->AuthType == AUTHTYPE_PASSWORD); + SetEnable(hWnd, S_PASSWORD_3, u->AuthType == AUTHTYPE_PASSWORD); + SetEnable(hWnd, E_PASSWORD1, u->AuthType == AUTHTYPE_PASSWORD); + SetEnable(hWnd, E_PASSWORD2, u->AuthType == AUTHTYPE_PASSWORD); + + SetEnable(hWnd, S_USER_CERT_1, u->AuthType == AUTHTYPE_USERCERT); + SetEnable(hWnd, S_CERT_INFO, u->AuthType == AUTHTYPE_USERCERT); + SetEnable(hWnd, B_LOAD_CERT, u->AuthType == AUTHTYPE_USERCERT); + + if (u->AuthType == AUTHTYPE_USERCERT) + { + SetEnable(hWnd, B_VIEW_CERT, ((AUTHUSERCERT *)u->AuthData)->UserX != NULL); + } + else + { + SetEnable(hWnd, B_VIEW_CERT, false); + } + + SetEnable(hWnd, S_ROOT_CERT_1, u->AuthType == AUTHTYPE_ROOTCERT); + SetEnable(hWnd, S_ROOT_CERT_2, u->AuthType == AUTHTYPE_ROOTCERT); + SetEnable(hWnd, S_ROOT_CERT_3, u->AuthType == AUTHTYPE_ROOTCERT); + SetEnable(hWnd, R_CN, u->AuthType == AUTHTYPE_ROOTCERT); + SetEnable(hWnd, R_SERIAL, u->AuthType == AUTHTYPE_ROOTCERT); + + if (u->AuthType == AUTHTYPE_ROOTCERT) + { + SetEnable(hWnd, E_CN, IsChecked(hWnd, R_CN)); + SetEnable(hWnd, E_SERIAL, IsChecked(hWnd, R_SERIAL)); + } + else + { + Disable(hWnd, E_CN); + Disable(hWnd, E_SERIAL); + } + + switch (u->AuthType) + { + case AUTHTYPE_PASSWORD: + GetTxtA(hWnd, E_PASSWORD1, tmp1, sizeof(tmp1)); + GetTxtA(hWnd, E_PASSWORD2, tmp2, sizeof(tmp2)); + if (StrCmp(tmp1, tmp2) != 0) + { + ok = false; + } + else + { + if (StrCmp(tmp1, HIDDEN_PASSWORD) != 0) + { + HashPassword(((AUTHPASSWORD *)u->AuthData)->HashedKey, u->Name, tmp1); + GenerateNtPasswordHash(((AUTHPASSWORD *)u->AuthData)->NtLmSecureHash, tmp1); + } + } + break; + + case AUTHTYPE_USERCERT: + if (((AUTHUSERCERT *)u->AuthData)->UserX == NULL) + { + ok = false; + } + break; + + case AUTHTYPE_ROOTCERT: + Free(((AUTHROOTCERT *)u->AuthData)->CommonName); + ((AUTHROOTCERT *)u->AuthData)->CommonName = NULL; + if (IsChecked(hWnd, R_CN) && (IsEmpty(hWnd, E_CN) == false)) + { + ((AUTHROOTCERT *)u->AuthData)->CommonName = GetText(hWnd, E_CN); + UniTrim(((AUTHROOTCERT *)u->AuthData)->CommonName); + } + if (IsChecked(hWnd, R_CN) && ((AUTHROOTCERT *)u->AuthData)->CommonName == NULL) + { + ok = false; + } + FreeXSerial(((AUTHROOTCERT *)u->AuthData)->Serial); + ((AUTHROOTCERT *)u->AuthData)->Serial = NULL; + if (IsChecked(hWnd, R_SERIAL)) + { + char *serial_str = GetTextA(hWnd, E_SERIAL); + if (serial_str != NULL) + { + BUF *b = StrToBin(serial_str); + if (b->Size >= 1) + { + ((AUTHROOTCERT *)u->AuthData)->Serial = NewXSerial(b->Buf, b->Size); + } + FreeBuf(b); + Free(serial_str); + } + } + if (IsChecked(hWnd, R_SERIAL) && ((AUTHROOTCERT *)u->AuthData)->Serial == NULL) + { + ok = false; + } + break; + + case AUTHTYPE_RADIUS: + Free(((AUTHRADIUS *)u->AuthData)->RadiusUsername); + ((AUTHRADIUS *)u->AuthData)->RadiusUsername = NULL; + if (IsChecked(hWnd, R_SET_RADIUS_USERNAME) && (IsEmpty(hWnd, E_RADIUS_USERNAME) == false)) + { + ((AUTHRADIUS *)u->AuthData)->RadiusUsername = GetText(hWnd, E_RADIUS_USERNAME); + } + if (IsChecked(hWnd, R_SET_RADIUS_USERNAME) && ((AUTHRADIUS *)u->AuthData)->RadiusUsername == NULL) + { + ok = false; + } + break; + + case AUTHTYPE_NT: + Free(((AUTHNT *)u->AuthData)->NtUsername); + ((AUTHNT *)u->AuthData)->NtUsername = NULL; + if (IsChecked(hWnd, R_SET_RADIUS_USERNAME) && (IsEmpty(hWnd, E_RADIUS_USERNAME) == false)) + { + ((AUTHNT *)u->AuthData)->NtUsername = GetText(hWnd, E_RADIUS_USERNAME); + } + if (IsChecked(hWnd, R_SET_RADIUS_USERNAME) && ((AUTHNT *)u->AuthData)->NtUsername == NULL) + { + ok = false; + } + break; + } + + SetEnable(hWnd, B_POLICY, IsChecked(hWnd, R_POLICY)); + if (IsChecked(hWnd, R_POLICY)) + { + if (u->Policy == NULL) + { + ok = false; + } + } + + SetEnable(hWnd, IDOK, ok); +} + +// Edit User dialog procedure +UINT SmEditUserDlgProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param) +{ + SM_EDIT_USER *s = (SM_EDIT_USER *)param; + NMHDR *n; + POLICY *policy; + X *x = NULL; + wchar_t tmp[MAX_SIZE]; + char name[MAX_SIZE]; + char *ret; + // Validate arguments + if (hWnd == NULL) + { + return 0; + } + + switch (msg) + { + case WM_INITDIALOG: + // Initialize + SmEditUserDlgInit(hWnd, s); + break; + + case WM_COMMAND: + switch (LOWORD(wParam)) + { + case E_USERNAME: + case E_REALNAME: + case E_NOTE: + case R_EXPIRES: + case E_EXPIRES_DATE: + case E_EXPIRES_TIME: + case E_GROUP: + case L_AUTH: + case R_SET_RADIUS_USERNAME: + case E_RADIUS_USERNAME: + case R_POLICY: + case E_PASSWORD1: + case E_PASSWORD2: + case R_CN: + case E_CN: + case R_SERIAL: + case E_SERIAL: + SmEditUserDlgUpdate(hWnd, s); + break; + } + + switch (wParam) + { + case IDOK: + // [OK] button + SmEditUserDlgOk(hWnd, s); + break; + + case IDCANCEL: + // Cancel button + Close(hWnd); + break; + + case B_POLICY: + UniFormat(tmp, sizeof(tmp), _UU("SM_EDIT_USER_POL_DLG"), s->SetUser.Name); + // Policy + if (s->SetUser.Policy == NULL) + { + policy = ClonePolicy(GetDefaultPolicy()); + if (SmPolicyDlgEx2(hWnd, policy, tmp, false, s->p->PolicyVer)) + { + s->SetUser.Policy = policy; + SmEditUserDlgUpdate(hWnd, s); + } + else + { + Free(policy); + } + } + else + { + SmPolicyDlgEx2(hWnd, s->SetUser.Policy, tmp, false, s->p->PolicyVer); + } + break; + + case B_GROUP: + // Browse for a Group + GetTxtA(hWnd, E_GROUP, name, sizeof(name)); + Trim(name); + ret = SmSelectGroupDlg(hWnd, s->Hub, StrLen(name) == 0 ? NULL : name); + if (ret != NULL) + { + SetTextA(hWnd, E_GROUP, ret); + Free(ret); + } + else + { + SetTextA(hWnd, E_GROUP, ""); + } + FocusEx(hWnd, E_GROUP); + break; + + case B_LOAD_CERT: + // Specify the certificate + if (CmLoadXFromFileOrSecureCard(hWnd, &x)) + { +UPDATE_CERT: + if (s->SetUser.AuthType == AUTHTYPE_USERCERT) + { + wchar_t tmp[MAX_SIZE]; + FreeX(((AUTHUSERCERT *)s->SetUser.AuthData)->UserX); + ((AUTHUSERCERT *)s->SetUser.AuthData)->UserX = x; + SmGetCertInfoStr(tmp, sizeof(tmp), x); + SetText(hWnd, S_CERT_INFO, tmp); + SmEditUserDlgUpdate(hWnd, s); + } + else + { + if (x != NULL) + { + FreeX(x); + x = NULL; + } + } + } + break; + + case B_VIEW_CERT: + // Show the certificate + if (s->SetUser.AuthType == AUTHTYPE_USERCERT) + { + CertDlg(hWnd, ((AUTHUSERCERT *)s->SetUser.AuthData)->UserX, NULL, true); + } + break; + + case B_CREATE: + // Create + GetTxtA(hWnd, E_USERNAME, name, sizeof(name)); + Trim(name); + if (SmCreateCert(hWnd, &x, NULL, false, name, false)) + { + if (s->SetUser.AuthType != AUTHTYPE_USERCERT) + { + LvSelect(hWnd, L_AUTH, 2); + } + goto UPDATE_CERT; + } + break; + + case R_SET_RADIUS_USERNAME: + if (IsChecked(hWnd, R_SET_RADIUS_USERNAME)) + { + FocusEx(hWnd, E_RADIUS_USERNAME); + } + break; + + case R_EXPIRES: + if (IsChecked(hWnd, R_EXPIRES)) + { + Focus(hWnd, E_EXPIRES_DATE); + } + break; + + case R_POLICY: + if (IsChecked(hWnd, R_POLICY)) + { + Focus(hWnd, B_POLICY); + } + break; + + case R_CN: + if (IsChecked(hWnd, R_CN)) + { + Focus(hWnd, E_CN); + } + break; + + case R_SERIAL: + if (IsChecked(hWnd, R_SERIAL)) + { + Focus(hWnd, E_SERIAL); + } + break; + } + break; + + case WM_NOTIFY: + n = (NMHDR *)lParam; + switch (n->idFrom) + { + case L_AUTH: + switch (n->code) + { + case LVN_ITEMCHANGED: + SmEditUserDlgUpdate(hWnd, s); + break; + } + break; + } + break; + + case WM_CLOSE: + EndDialog(hWnd, false); + break; + } + + return 0; +} + +// User editing dialog +bool SmEditUserDlg(HWND hWnd, SM_HUB *s, char *username) +{ + SM_EDIT_USER e; + bool ret; + // Validate arguments + if (hWnd == NULL || s == NULL || username == NULL) + { + return false; + } + + Zero(&e, sizeof(e)); + e.p = s->p; + e.Rpc = s->Rpc; + e.Hub = s; + + // Get the User + StrCpy(e.SetUser.HubName, sizeof(e.SetUser.HubName), e.Hub->HubName); + StrCpy(e.SetUser.Name, sizeof(e.SetUser.Name), username); + + if (CALL(hWnd, ScGetUser(s->Rpc, &e.SetUser)) == false) + { + return false; + } + + e.EditMode = true; + + ret = Dialog(hWnd, D_SM_EDIT_USER, SmEditUserDlgProc, &e); + + FreeRpcSetUser(&e.SetUser); + + return ret; +} + +// New user creation dialog +bool SmCreateUserDlg(HWND hWnd, SM_HUB *s) +{ + SM_EDIT_USER e; + bool ret; + // Validate arguments + if (hWnd == NULL || s == NULL) + { + return false; + } + + Zero(&e, sizeof(e)); + e.EditMode = false; + e.p = s->p; + e.Rpc = s->Rpc; + e.Hub = s; + + // Set up a new user + StrCpy(e.SetUser.HubName, sizeof(e.SetUser.HubName), e.Hub->HubName); + e.SetUser.AuthType = CLIENT_AUTHTYPE_PASSWORD; + e.SetUser.AuthData = NewPasswordAuthData("", ""); + + ret = Dialog(hWnd, D_SM_EDIT_USER, SmEditUserDlgProc, &e); + + FreeRpcSetUser(&e.SetUser); + + return ret; +} + +// Get a string of user authentication method +wchar_t *SmGetAuthTypeStr(UINT id) +{ + return GetAuthTypeStr(id); +} + +// User list initialization +void SmUserListInit(HWND hWnd, SM_USER *s) +{ + wchar_t tmp1[MAX_SIZE]; + wchar_t tmp2[MAX_SIZE]; + // Validate arguments + if (hWnd == NULL || s == NULL) + { + return; + } + + SetIcon(hWnd, 0, ICO_USER); + + // Initialize the column + LvInit(hWnd, L_USER); + LvSetStyle(hWnd, L_USER, LVS_EX_GRIDLINES); + LvInsertColumn(hWnd, L_USER, 0, _UU("SM_USER_COLUMN_1"), 120); + LvInsertColumn(hWnd, L_USER, 1, _UU("SM_USER_COLUMN_2"), 100); + LvInsertColumn(hWnd, L_USER, 2, _UU("SM_USER_COLUMN_3"), 100); + LvInsertColumn(hWnd, L_USER, 3, _UU("SM_USER_COLUMN_4"), 130); + LvInsertColumn(hWnd, L_USER, 4, _UU("SM_USER_COLUMN_5"), 100); + LvInsertColumn(hWnd, L_USER, 5, _UU("SM_USER_COLUMN_6"), 90); + LvInsertColumn(hWnd, L_USER, 6, _UU("SM_USER_COLUMN_7"), 120); + LvInsertColumn(hWnd, L_USER, 7, _UU("SM_LICENSE_COLUMN_5"), 120); + LvInsertColumn(hWnd, L_USER, 8, _UU("SM_SESS_COLUMN_6"), 100); + LvInsertColumn(hWnd, L_USER, 9, _UU("SM_SESS_COLUMN_7"), 100); + + FormatText(hWnd, S_TITLE, s->Hub->HubName); + + if (s->GroupName != NULL) + { + GetTxt(hWnd, 0, tmp1, sizeof(tmp1)); + UniFormat(tmp2, sizeof(tmp2), _UU("SM_GROUP_MEMBER_STR"), s->GroupName); + UniStrCat(tmp1, sizeof(tmp1), tmp2); + SetText(hWnd, S_TITLE, tmp1); + Disable(hWnd, B_CREATE); + } + + if (s->SelectMode) + { + SetStyle(hWnd, L_USER, LVS_SINGLESEL); + } + + SmUserListRefresh(hWnd, s); + + if (s->SelectMode) + { + wchar_t tmp[MAX_SIZE]; + UINT i; + StrToUni(tmp, sizeof(tmp), s->SelectedName); + i = LvSearchStr(hWnd, L_USER, 0, tmp); + if (i != INFINITE) + { + LvSelect(hWnd, L_USER, i); + } + + if (s->AllowGroup) + { + SetText(hWnd, B_DELETE, _UU("SM_SELECT_ALT_GROUP")); + } + } +} + +// User list update +void SmUserListRefresh(HWND hWnd, SM_USER *s) +{ + LVB *b; + RPC_ENUM_USER t; + UINT i; + // Validate arguments + if (hWnd == NULL || s == NULL) + { + return; + } + + Zero(&t, sizeof(t)); + + StrCpy(t.HubName, sizeof(t.HubName), s->Hub->HubName); + if (CALL(hWnd, ScEnumUser(s->Rpc, &t)) == false) + { + EndDialog(hWnd, false); + return; + } + + b = LvInsertStart(); + + for (i = 0;i < t.NumUser;i++) + { + RPC_ENUM_USER_ITEM *e = &t.Users[i]; + wchar_t name[MAX_SIZE]; + wchar_t group[MAX_SIZE]; + wchar_t num[MAX_SIZE]; + wchar_t time[MAX_SIZE]; + wchar_t exp[MAX_SIZE]; + wchar_t num1[64], num2[64]; + + if (s->GroupName != NULL) + { + if (StrCmpi(s->GroupName, e->GroupName) != 0) + { + continue; + } + } + + StrToUni(name, sizeof(name), e->Name); + + if (StrLen(e->GroupName) != 0) + { + StrToUni(group, sizeof(group), e->GroupName); + } + else + { + UniStrCpy(group, sizeof(group), _UU("SM_NO_GROUP")); + } + + UniToStru(num, e->NumLogin); + + GetDateTimeStrEx64(time, sizeof(time), SystemToLocal64(e->LastLoginTime), NULL); + + if (e->IsExpiresFilled == false) + { + UniStrCpy(exp, sizeof(exp), _UU("CM_ST_NONE")); + } + else + { + if (e->Expires == 0) + { + UniStrCpy(exp, sizeof(exp), _UU("SM_LICENSE_NO_EXPIRES")); + } + else + { + GetDateTimeStrEx64(exp, sizeof(exp), SystemToLocal64(e->Expires), NULL); + } + } + + if (e->IsTrafficFilled == false) + { + UniStrCpy(num1, sizeof(num1), _UU("CM_ST_NONE")); + UniStrCpy(num2, sizeof(num2), _UU("CM_ST_NONE")); + } + else + { + UniToStr3(num1, sizeof(num1), + e->Traffic.Recv.BroadcastBytes + e->Traffic.Recv.UnicastBytes + + e->Traffic.Send.BroadcastBytes + e->Traffic.Send.UnicastBytes); + + UniToStr3(num2, sizeof(num2), + e->Traffic.Recv.BroadcastCount + e->Traffic.Recv.UnicastCount + + e->Traffic.Send.BroadcastBytes + e->Traffic.Send.UnicastCount); + } + + LvInsertAdd(b, e->DenyAccess ? ICO_USER_DENY : ICO_USER, NULL, 10, + name, e->Realname, group, e->Note, SmGetAuthTypeStr(e->AuthType), + num, time, exp, num1, num2); + } + + LvInsertEnd(b, hWnd, L_USER); + + FreeRpcEnumUser(&t); + + SmUserListUpdate(hWnd, s); +} + +// User list control update +void SmUserListUpdate(HWND hWnd, SM_USER *s) +{ + bool b = true; + // Validate arguments + if (hWnd == NULL || s == NULL) + { + return; + } + + if (LvIsSelected(hWnd, L_USER) == false || LvIsMultiMasked(hWnd, L_USER)) + { + b = false; + } + + if (s->SelectMode) + { + SetText(hWnd, IDOK, _UU("SM_SELECT_USER")); + SetText(hWnd, IDCANCEL, _UU("SM_SELECT_NO")); + SetText(hWnd, S_TITLE, _UU("SM_PLEASE_SELECT")); + } + + SetEnable(hWnd, IDOK, b); + + SetEnable(hWnd, B_STATUS, b); + SetEnable(hWnd, B_DELETE, (b && s->SelectedName == false) || s->AllowGroup); + SetEnable(hWnd, B_CREATE, s->SelectedName == false); +} + +// User List dialog procedure +UINT SmUserListProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param) +{ + SM_USER *s = (SM_USER *)param; + NMHDR *n; + wchar_t *str; + // Validate arguments + if (hWnd == NULL) + { + return 0; + } + + switch (msg) + { + case WM_INITDIALOG: + // Initialize + SmUserListInit(hWnd, s); + + if (s->CreateNow) + { + // Create instantly + if (IsEnable(hWnd, B_CREATE)) + { + Command(hWnd, B_CREATE); + } + } + break; + + case WM_COMMAND: + switch (wParam) + { + case IDOK: + if (s->SelectMode == false) + { + // Property + str = LvGetSelectedStr(hWnd, L_USER, 0); + if (str != NULL) + { + char name[MAX_SIZE]; + UniToStr(name, sizeof(name), str); + + if (SmEditUserDlg(hWnd, s->Hub, name)) + { + SmUserListRefresh(hWnd, s); + } + + Free(str); + } + } + else + { + // The user has been chosen + str = LvGetSelectedStr(hWnd, L_USER, 0); + if (str != NULL) + { + char name[MAX_SIZE]; + UniToStr(name, sizeof(name), str); + + s->SelectedName = CopyStr(name); + + EndDialog(hWnd, true); + + Free(str); + } + } + break; + + case B_CREATE: + // Create new + if (SmCreateUserDlg(hWnd, s->Hub)) + { + SmUserListRefresh(hWnd, s); + } + break; + + case B_DELETE: + if (s->AllowGroup) + { + // Group selection + EndDialog(hWnd, INFINITE); + } + else + { + // Delete + str = LvGetSelectedStr(hWnd, L_USER, 0); + if (str != NULL) + { + RPC_DELETE_USER t; + char name[MAX_SIZE]; + UniToStr(name, sizeof(name), str); + + Zero(&t, sizeof(t)); + StrCpy(t.HubName, sizeof(t.HubName), s->Hub->HubName); + StrCpy(t.Name, sizeof(t.Name), name); + + if (MsgBoxEx(hWnd, MB_YESNO | MB_DEFBUTTON2 | MB_ICONQUESTION, + _UU("SM_USER_DELETE_MSG"), str) == IDYES) + { + if (CALL(hWnd, ScDeleteUser(s->Rpc, &t))) + { + SmUserListRefresh(hWnd, s); + } + } + + Free(str); + } + } + break; + + case B_STATUS: + // Display the User Information + str = LvGetSelectedStr(hWnd, L_USER, 0); + if (str != NULL) + { + char name[MAX_SIZE]; + wchar_t tmp[MAX_SIZE]; + SM_USER_INFO info; + UniToStr(name, sizeof(name), str); + + UniFormat(tmp, sizeof(tmp), _UU("SM_USERINFO_CAPTION"), name); + + Zero(&info, sizeof(info)); + info.p = s->p; + info.Rpc = s->Rpc; + info.Hub = s->Hub; + info.Username = name; + + SmStatusDlg(hWnd, s->p, &info, false, true, tmp, ICO_USER, NULL, SmRefreshUserInfo); + + Free(str); + } + break; + break; + + case B_REFRESH: + // Update + SmUserListRefresh(hWnd, s); + break; + + case IDCANCEL: + // Cancel button + Close(hWnd); + break; + } + break; + + case WM_NOTIFY: + n = (NMHDR *)lParam; + switch (n->idFrom) + { + case L_USER: + switch (n->code) + { + case LVN_ITEMCHANGED: + // Update the control + SmUserListUpdate(hWnd, s); + break; + } + break; + } + break; + + case WM_CLOSE: + EndDialog(hWnd, false); + break; + } + + LvStandardHandler(hWnd, msg, wParam, lParam, L_USER); + + return 0; +} + +// User List dialog (selection) +char *SmSelectUserDlg(HWND hWnd, SM_HUB *s, char *default_name) +{ + return SmSelectUserDlgEx(hWnd, s, default_name, false); +} +char *SmSelectUserDlgEx(HWND hWnd, SM_HUB *s, char *default_name, bool allow_group) +{ + UINT ret; + SM_USER user; + // Validate arguments + if (hWnd == NULL || s == NULL) + { + return NULL; + } + + Zero(&user, sizeof(user)); + user.Hub = s; + user.p = s->p; + user.Rpc = s->Rpc; + user.GroupName = NULL; + user.SelectedName = default_name; + user.SelectMode = true; + user.AllowGroup = allow_group; + + ret = Dialog(hWnd, D_SM_USER, SmUserListProc, &user); + + if (ret == 0) + { + return NULL; + } + else if (ret == INFINITE) + { + // Select a Group + return SmSelectGroupDlg(hWnd, s, default_name); + } + else + { + return user.SelectedName; + } +} + +// User List dialog (filtered by group name) +void SmUserListDlgEx(HWND hWnd, SM_HUB *s, char *groupname, bool create) +{ + SM_USER user; + // Validate arguments + if (hWnd == NULL || s == NULL) + { + return; + } + + Zero(&user, sizeof(user)); + user.Hub = s; + user.p = s->p; + user.Rpc = s->Rpc; + user.GroupName = groupname; + user.CreateNow = create; + + Dialog(hWnd, D_SM_USER, SmUserListProc, &user); +} + +// User List dialog +void SmUserListDlg(HWND hWnd, SM_HUB *s) +{ + SmUserListDlgEx(hWnd, s, NULL, false); +} + +// Initialize +void SmHubDlgInit(HWND hWnd, SM_HUB *s) +{ + CAPSLIST *caps; + bool support_user, support_group, support_accesslist, support_cascade, + support_log, support_config_hub, support_secure_nat, support_config_radius; + // Validate arguments + if (hWnd == NULL || s == NULL) + { + return; + } + + FormatText(hWnd, 0, s->HubName); + FormatText(hWnd, S_TITLE, s->HubName); + SetIcon(hWnd, 0, ICO_HUB); + DlgFont(hWnd, S_TITLE, 15, true); + + LvInit(hWnd, L_STATUS); + LvSetStyle(hWnd, L_STATUS, LVS_EX_GRIDLINES); + LvInsertColumn(hWnd, L_STATUS, 0, _UU("SM_STATUS_COLUMN_1"), 0); + LvInsertColumn(hWnd, L_STATUS, 1, _UU("SM_STATUS_COLUMN_2"), 0); + + caps = s->p->CapsList; + + support_user = GetCapsInt(caps, "i_max_users_per_hub") == 0 ? false : true; + support_group = GetCapsInt(caps, "i_max_groups_per_hub") == 0 ? false : true; + support_accesslist = GetCapsInt(caps, "i_max_access_lists") == 0 ? false : true; + support_cascade = GetCapsBool(caps, "b_support_cascade"); + support_log = GetCapsBool(caps, "b_support_config_log"); + support_config_hub = GetCapsBool(caps, "b_support_config_hub"); + support_secure_nat = GetCapsBool(caps, "b_support_securenat"); + support_config_radius = GetCapsBool(caps, "b_support_radius"); + + SetEnable(hWnd, B_USER, support_user); + SetEnable(hWnd, S_USER, support_user); + + SetEnable(hWnd, B_GROUP, support_group); + SetEnable(hWnd, S_GROUP, support_group); + + SetEnable(hWnd, B_ACCESS, support_accesslist); + SetEnable(hWnd, S_ACCESS, support_accesslist); + + SetEnable(hWnd, B_PROPERTY, s->p->ServerType != SERVER_TYPE_FARM_MEMBER); + SetEnable(hWnd, S_PROPERTY, s->p->ServerType != SERVER_TYPE_FARM_MEMBER); + + SetEnable(hWnd, B_RADIUS, support_config_radius); + SetEnable(hWnd, S_RADIUS, support_config_radius); + + SetEnable(hWnd, B_LINK, support_cascade); + SetEnable(hWnd, S_LINK, support_cascade); + + SetEnable(hWnd, B_LOG, support_log); + SetEnable(hWnd, S_LOG, support_log); + + SetEnable(hWnd, B_CA, support_config_hub); + SetEnable(hWnd, S_CA, support_config_hub); + + SetEnable(hWnd, B_SNAT, support_secure_nat); + SetEnable(hWnd, S_SNAT, support_secure_nat); + + SetEnable(hWnd, B_CRL, GetCapsBool(caps, "b_support_crl")); + + SetEnable(hWnd, B_LOG_FILE, GetCapsBool(caps, "b_support_read_log")); + + SmHubDlgRefresh(hWnd, s); +} + +// Update the control +void SmHubDlgUpdate(HWND hWnd, SM_HUB *s) +{ + // Validate arguments + if (hWnd == NULL || s == NULL) + { + return; + } +} + +// Content update +void SmHubDlgRefresh(HWND hWnd, SM_HUB *s) +{ + // Validate arguments + if (hWnd == NULL || s == NULL) + { + return; + } + + SmRefreshHubStatus(hWnd, s->p, (void *)s->HubName); + LvAutoSize(hWnd, L_STATUS); + + SmHubDlgUpdate(hWnd, s); +} + +// HUB management dialog +UINT SmHubDlgProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param) +{ + SM_HUB *s = (SM_HUB *)param; + // Validate arguments + if (hWnd == NULL) + { + return 0; + } + + switch (msg) + { + case WM_INITDIALOG: + // Initialize + SmHubDlgInit(hWnd, s); + break; + + case WM_COMMAND: + switch (wParam) + { + case B_USER: + // User + SmUserListDlg(hWnd, s); + SmHubDlgRefresh(hWnd, s); + break; + + case B_GROUP: + // Group + SmGroupListDlg(hWnd, s); + SmHubDlgRefresh(hWnd, s); + break; + + case B_ACCESS: + // Access list + SmAccessListDlg(hWnd, s); + SmHubDlgRefresh(hWnd, s); + break; + + case B_PROPERTY: + // Property + if (SmEditHubDlg(hWnd, s->p, s->HubName)) + { + SmHubDlgRefresh(hWnd, s); + } + break; + + case B_RADIUS: + // Radius + SmRadiusDlg(hWnd, s); + SmHubDlgRefresh(hWnd, s); + break; + + case B_LINK: + // Cascade + SmLinkDlg(hWnd, s); + SmHubDlgRefresh(hWnd, s); + break; + + case B_SESSION: + // Session + SmSessionDlg(hWnd, s); + SmHubDlgRefresh(hWnd, s); + break; + + case B_LOG: + // Log + Dialog(hWnd, D_SM_LOG, SmLogDlg, s); + SmHubDlgRefresh(hWnd, s); + break; + + case B_CA: + // CA + SmCaDlg(hWnd, s); + SmHubDlgRefresh(hWnd, s); + break; + + case IDCANCEL: + // Cancel button + Close(hWnd); + break; + + case B_REFRESH: + // Update + SmHubDlgRefresh(hWnd, s); + break; + + case B_SNAT: + // SecureNAT + Dialog(hWnd, D_SM_SNAT, SmSNATDlgProc, s); + SmHubDlgRefresh(hWnd, s); + break; + + case B_CRL: + // Certificate revocation list + Dialog(hWnd, D_SM_CRL, SmCrlDlgProc, s); + break; + + case B_LOG_FILE: + // Log file + Dialog(hWnd, D_SM_LOG_FILE, SmLogFileDlgProc, s->p); + break; + } + break; + + case WM_CLOSE: + EndDialog(hWnd, false); + break; + } + + return 0; +} + +// Management of HUB +void SmHubDlg(HWND hWnd, SM_HUB *s) +{ + // Validate arguments + if (hWnd == NULL || s == NULL) + { + return; + } + + Dialog(hWnd, D_SM_HUB, SmHubDlgProc, s); +} + +// Change the server password +UINT SmChangeServerPasswordDlg(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param) +{ + SM_SERVER *p = (SM_SERVER *)param; + char tmp1[MAX_SIZE]; + char tmp2[MAX_SIZE]; + UCHAR hash[SHA1_SIZE]; + RPC_SET_PASSWORD t; + SETTING *setting; + // Validate arguments + if (hWnd == NULL) + { + return 0; + } + + switch (msg) + { + case WM_INITDIALOG: + // Initialize + SetIcon(hWnd, 0, ICO_USER_ADMIN); + FormatText(hWnd, 0, p->ServerName); + FormatText(hWnd, S_TITLE, p->ServerName); + Focus(hWnd, E_PASSWORD1); + break; + + case WM_COMMAND: + switch (LOWORD(wParam)) + { + case E_PASSWORD1: + case E_PASSWORD2: + GetTxtA(hWnd, E_PASSWORD1, tmp1, sizeof(tmp1)); + GetTxtA(hWnd, E_PASSWORD2, tmp2, sizeof(tmp2)); + + if (StrLen(tmp1) == 0 || StrLen(tmp2) == 0) + { + Disable(hWnd, IDOK); + } + else + { + Enable(hWnd, IDOK); + } + break; + } + + switch (wParam) + { + case IDOK: + // [OK] button + GetTxtA(hWnd, E_PASSWORD1, tmp1, sizeof(tmp1)); + GetTxtA(hWnd, E_PASSWORD2, tmp2, sizeof(tmp2)); + if (StrCmp(tmp1, tmp2) != 0) + { + MsgBox(hWnd, MB_ICONSTOP, _UU("SM_CHANGE_PASSWORD_1")); + FocusEx(hWnd, E_PASSWORD2); + break; + } + if (StrLen(tmp1) == 0) + { + if (MsgBox(hWnd, MB_ICONEXCLAMATION | MB_YESNO | MB_DEFBUTTON2, _UU("SM_CHANGE_PASSWORD_2")) == IDNO) + { + Focus(hWnd, E_PASSWORD1); + break; + } + } + Zero(&t, sizeof(t)); + Sha0(t.HashedPassword, tmp1, StrLen(tmp1)); + Copy(hash, t.HashedPassword, sizeof(hash)); + if (CALL(hWnd, ScSetServerPassword(p->Rpc, &t)) == false) + { + break; + } + MsgBox(hWnd, MB_ICONINFORMATION, _UU("SM_CHANGE_PASSWORD_3")); + + // Change the password for the connection setting + setting = SmGetSetting(p->CurrentSetting->Title); + if (setting != NULL && sm->TempSetting == NULL) + { + if (IsZero(setting->HashedPassword, SHA1_SIZE) == false) + { + Copy(setting->HashedPassword, hash, SHA1_SIZE); + SmWriteSettingList(); + } + } + + EndDialog(hWnd, true); + break; + + case IDCANCEL: + // Cancel button + Close(hWnd); + break; + } + break; + + case WM_CLOSE: + EndDialog(hWnd, false); + break; + } + + return 0; +} + +// Update the status of the connection to the server farm controller +bool SmRefreshFarmConnectionInfo(HWND hWnd, SM_SERVER *p, void *param) +{ + RPC_FARM_CONNECTION_STATUS t; + LVB *b; + wchar_t tmp[MAX_SIZE]; + char str[MAX_SIZE]; + // Validate arguments + if (hWnd == NULL || p == NULL) + { + return false; + } + + Zero(&t, sizeof(t)); + if (CALL(hWnd, ScGetFarmConnectionStatus(p->Rpc, &t)) == false) + { + return false; + } + + b = LvInsertStart(); + + if (t.Online == false) + { + LvInsertAdd(b, ICO_FARM, NULL, 2, _UU("SM_FC_IP"), _UU("SM_FC_NOT_CONNECTED")); + + LvInsertAdd(b, ICO_PROTOCOL, NULL, 2, _UU("SM_FC_PORT"), _UU("SM_FC_NOT_CONNECTED")); + } + else + { + IPToStr32(str, sizeof(str), t.Ip); + StrToUni(tmp, sizeof(tmp), str); + LvInsertAdd(b, ICO_FARM, NULL, 2, _UU("SM_FC_IP"), tmp); + + UniToStru(tmp, t.Port); + LvInsertAdd(b, ICO_PROTOCOL, NULL, 2, _UU("SM_FC_PORT"), tmp); + } + + LvInsertAdd(b, + t.Online ? ICO_SERVER_ONLINE_EX : ICO_PROTOCOL_X, NULL, 2, + _UU("SM_FC_STATUS"), + t.Online ? _UU("SM_FC_ONLINE") : _UU("SM_FC_OFFLINE")); + + if (t.Online == false) + { + UniFormat(tmp, sizeof(tmp), _UU("SM_FC_ERROR_TAG"), _E(t.LastError), t.LastError); + LvInsertAdd(b, ICO_STOP, NULL, 2, + _UU("SM_FC_LAST_ERROR"), tmp); + } + + GetDateTimeStrEx64(tmp, sizeof(tmp), SystemToLocal64(t.StartedTime), NULL); + LvInsertAdd(b, ICO_INFORMATION, NULL, 2, _UU("SM_FC_START_TIME"), tmp); + + GetDateTimeStrEx64(tmp, sizeof(tmp), SystemToLocal64(t.FirstConnectedTime), NULL); + LvInsertAdd(b, ICO_INFORMATION, NULL, 2, _UU("SM_FC_FIRST_TIME"), tmp); + + //if (t.Online == false) + { + GetDateTimeStrEx64(tmp, sizeof(tmp), SystemToLocal64(t.CurrentConnectedTime), NULL); + LvInsertAdd(b, ICO_INFORMATION, NULL, 2, _UU("SM_FC_CURRENT_TIME"), tmp); + } + + UniToStru(tmp, t.NumTry); + LvInsertAdd(b, ICO_PROTOCOL, NULL, 2, _UU("SM_FC_NUM_TRY"), tmp); + + UniToStru(tmp, t.NumConnected); + LvInsertAdd(b, ICO_PROTOCOL, NULL, 2, _UU("SM_FC_NUM_CONNECTED"), tmp); + + UniToStru(tmp, t.NumFailed); + LvInsertAdd(b, ICO_PROTOCOL, NULL, 2, _UU("SM_FC_NUM_FAILED"), tmp); + + LvInsertEnd(b, hWnd, L_STATUS); + + return true; +} + +// Initialize +void SmFarmMemberDlgInit(HWND hWnd, SM_SERVER *p) +{ + // Validate arguments + if (hWnd == NULL || p == NULL) + { + return; + } + + SetIcon(hWnd, 0, ICO_FARM); + + FormatText(hWnd, S_TITLE, p->ServerName); + + // Initialize the column + LvInit(hWnd, L_FARM_MEMBER); + LvSetStyle(hWnd, L_FARM_MEMBER, LVS_EX_GRIDLINES); + LvInsertColumn(hWnd, L_FARM_MEMBER, 0, _UU("SM_FM_COLUMN_1"), 90); + LvInsertColumn(hWnd, L_FARM_MEMBER, 1, _UU("SM_FM_COLUMN_2"), 150); + LvInsertColumn(hWnd, L_FARM_MEMBER, 2, _UU("SM_FM_COLUMN_3"), 140); + LvInsertColumn(hWnd, L_FARM_MEMBER, 3, _UU("SM_FM_COLUMN_4"), 60); + LvInsertColumn(hWnd, L_FARM_MEMBER, 4, _UU("SM_FM_COLUMN_5"), 80); + LvInsertColumn(hWnd, L_FARM_MEMBER, 5, _UU("SM_FM_COLUMN_6"), 80); + LvInsertColumn(hWnd, L_FARM_MEMBER, 6, _UU("SM_FM_COLUMN_7"), 80); + LvInsertColumn(hWnd, L_FARM_MEMBER, 7, _UU("SM_FM_COLUMN_8"), 160); + LvInsertColumn(hWnd, L_FARM_MEMBER, 8, _UU("SM_FM_COLUMN_9"), 160); + + SmFarmMemberDlgRefresh(hWnd, p); +} + +// Update +void SmFarmMemberDlgUpdate(HWND hWnd, SM_SERVER *p) +{ + // Validate arguments + if (hWnd == NULL || p == NULL) + { + return; + } + + SetEnable(hWnd, IDOK, LvIsSelected(hWnd, L_FARM_MEMBER) && (LvIsMultiMasked(hWnd, L_FARM_MEMBER) == false)); + SetEnable(hWnd, B_CERT, LvIsSelected(hWnd, L_FARM_MEMBER) && (LvIsMultiMasked(hWnd, L_FARM_MEMBER) == false)); +} + +// Content update +void SmFarmMemberDlgRefresh(HWND hWnd, SM_SERVER *p) +{ + RPC_ENUM_FARM t; + UINT i; + // Validate arguments + if (hWnd == NULL || p == NULL) + { + return; + } + + Zero(&t, sizeof(t)); + if (CALL(hWnd, ScEnumFarmMember(p->Rpc, &t)) == false) + { + EndDialog(hWnd, false); + return; + } + + LvReset(hWnd, L_FARM_MEMBER); + + for (i = 0;i < t.NumFarm;i++) + { + RPC_ENUM_FARM_ITEM *e = &t.Farms[i]; + wchar_t tmp1[MAX_SIZE]; + wchar_t tmp2[MAX_SIZE]; + wchar_t tmp3[64]; + wchar_t tmp4[64]; + wchar_t tmp5[64]; + wchar_t tmp6[64]; + wchar_t tmp7[64]; + wchar_t tmp8[64]; + + GetDateTimeStrEx64(tmp1, sizeof(tmp1), SystemToLocal64(e->ConnectedTime), NULL); + StrToUni(tmp2, sizeof(tmp2), e->Hostname); + UniToStru(tmp3, e->Point); + UniToStru(tmp4, e->NumSessions); + UniToStru(tmp5, e->NumTcpConnections); + UniToStru(tmp6, e->NumHubs); + UniToStru(tmp7, e->AssignedClientLicense); + UniToStru(tmp8, e->AssignedBridgeLicense); + + LvInsert(hWnd, L_FARM_MEMBER, e->Controller ? ICO_FARM : ICO_TOWER, (void *)e->Id, 9, + e->Controller ? _UU("SM_FM_CONTROLLER") : _UU("SM_FM_MEMBER"), + tmp1, tmp2, tmp3, tmp4, tmp5, tmp6, tmp7, tmp8); + } + + FreeRpcEnumFarm(&t); + + SmFarmMemberDlgUpdate(hWnd, p); +} + +// [OK] button +void SmFarmMemberDlgOnOk(HWND hWnd, SM_SERVER *p) +{ + // Validate arguments + if (hWnd == NULL || p == NULL) + { + return; + } + +} + +// Display the farm member certificate +void SmFarmMemberCert(HWND hWnd, SM_SERVER *p, UINT id) +{ + RPC_FARM_INFO t; + // Validate arguments + if (hWnd == NULL || p == NULL || id == 0) + { + return; + } + + Zero(&t, sizeof(t)); + t.Id = id; + + if (CALL(hWnd, ScGetFarmInfo(p->Rpc, &t)) == false) + { + return; + } + + CertDlg(hWnd, t.ServerCert, NULL, true); + + FreeRpcFarmInfo(&t); +} + +// Update the farm member information +bool SmRefreshFarmMemberInfo(HWND hWnd, SM_SERVER *p, void *param) +{ + RPC_FARM_INFO t; + UINT id = (UINT)param; + LVB *b; + UINT i; + wchar_t tmp[MAX_SIZE]; + char str[MAX_SIZE]; + // Validate arguments + if (hWnd == NULL || p == NULL || id == 0) + { + return false; + } + + Zero(&t, sizeof(t)); + t.Id = id; + + if (CALL(hWnd, ScGetFarmInfo(p->Rpc, &t)) == false) + { + return false; + } + + b = LvInsertStart(); + + LvInsertAdd(b, ICO_FARM, NULL, 2, _UU("SM_FMINFO_TYPE"), + t.Controller ? _UU("SM_FARM_CONTROLLER") : _UU("SM_FARM_MEMBER")); + + GetDateTimeStrEx64(tmp, sizeof(tmp), SystemToLocal64(t.ConnectedTime), NULL); + LvInsertAdd(b, ICO_INFORMATION, NULL, 2, _UU("SM_FMINFO_CONNECT_TIME"), tmp); + + IPToStr32(str, sizeof(str), t.Ip); + StrToUni(tmp, sizeof(tmp), str); + LvInsertAdd(b, ICO_PROTOCOL, NULL, 2, _UU("SM_FMINFO_IP"), tmp); + + StrToUni(tmp, sizeof(tmp), t.Hostname); + LvInsertAdd(b, ICO_TOWER, NULL, 2, _UU("SM_FMINFO_HOSTNAME"), tmp); + + UniToStru(tmp, t.Point); + LvInsertAdd(b, ICO_TEST, NULL, 2, _UU("SM_FMINFO_POINT"), tmp); + + UniToStru(tmp, t.Weight); + LvInsertAdd(b, ICO_MACHINE, NULL, 2, _UU("SM_FMINFO_WEIGHT"), tmp); + + UniToStru(tmp, t.NumPort); + LvInsertAdd(b, ICO_PROTOCOL, NULL, 2, _UU("SM_FMINFO_NUM_PORT"), tmp); + + for (i = 0;i < t.NumPort;i++) + { + wchar_t tmp2[MAX_SIZE]; + UniFormat(tmp, sizeof(tmp), _UU("SM_FMINFO_PORT"), i + 1); + UniToStru(tmp2, t.Ports[i]); + LvInsertAdd(b, ICO_PROTOCOL, NULL, 2, tmp, tmp2); + } + + UniToStru(tmp, t.NumFarmHub); + LvInsertAdd(b, ICO_HUB_OFFLINE, NULL, 2, _UU("SM_FMINFO_NUM_HUB"), tmp); + + for (i = 0;i < t.NumFarmHub;i++) + { + wchar_t tmp2[MAX_SIZE]; + UniFormat(tmp, sizeof(tmp), _UU("SM_FMINFO_HUB"), i + 1); + UniFormat(tmp2, sizeof(tmp2), + t.FarmHubs[i].DynamicHub ? _UU("SM_FMINFO_HUB_TAG_2") : _UU("SM_FMINFO_HUB_TAG_1"), + t.FarmHubs[i].HubName); + LvInsertAdd(b, ICO_HUB, NULL, 2, tmp, tmp2); + } + + UniToStru(tmp, t.NumSessions); + LvInsertAdd(b, ICO_VPN, NULL, 2, _UU("SM_FMINFO_NUM_SESSION"), tmp); + + UniToStru(tmp, t.NumTcpConnections); + LvInsertAdd(b, ICO_PROTOCOL, NULL, 2, _UU("SM_FMINFO_NUN_CONNECTION"), tmp); + + LvInsertEnd(b, hWnd, L_STATUS); + + FreeRpcFarmInfo(&t); + + return true; +} + +// Farm Member List dialog +UINT SmFarmMemberDlgProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param) +{ + SM_SERVER *p = (SM_SERVER *)param; + NMHDR *n; + UINT i; + // Validate arguments + if (hWnd == NULL) + { + return 0; + } + + switch (msg) + { + case WM_INITDIALOG: + // Initialize + SmFarmMemberDlgInit(hWnd, p); + break; + + case WM_COMMAND: + switch (wParam) + { + case IDOK: + // Display the information of farm members + i = LvGetSelected(hWnd, L_FARM_MEMBER); + if (i != INFINITE) + { + SmStatusDlg(hWnd, p, LvGetParam(hWnd, L_FARM_MEMBER, i), false, true, + _UU("SM_FMINFO_CAPTION"), ICO_FARM, NULL, SmRefreshFarmMemberInfo); + } + break; + + case B_CERT: + // Show the Server Certificate + i = LvGetSelected(hWnd, L_FARM_MEMBER); + if (i != INFINITE) + { + SmFarmMemberCert(hWnd, p, (UINT)LvGetParam(hWnd, L_FARM_MEMBER, i)); + } + break; + + case IDCANCEL: + // Cancel button + Close(hWnd); + break; + + case B_REFRESH: + // Update + SmFarmMemberDlgRefresh(hWnd, p); + break; + } + break; + + case WM_NOTIFY: + n = (NMHDR *)lParam; + switch (n->code) + { + case LVN_ITEMCHANGED: + switch (n->idFrom) + { + case L_FARM_MEMBER: + SmFarmMemberDlgUpdate(hWnd, p); + break; + } + break; + } + break; + + case WM_CLOSE: + EndDialog(hWnd, false); + break; + } + + LvStandardHandler(hWnd, msg, wParam, lParam, L_FARM_MEMBER); + + return 0; +} + +// Initialize the dialog +void SmFarmDlgInit(HWND hWnd, SM_SERVER *p) +{ + RPC_FARM t; + // Validate arguments + if (hWnd == NULL || p == NULL) + { + return; + } + + SetIcon(hWnd, 0, ICO_FARM); + + // Get the current settings + Zero(&t, sizeof(t)); + if (CALL(hWnd, ScGetFarmSetting(p->Rpc, &t)) == false) + { + EndDialog(hWnd, false); + return; + } + + if (t.Weight == 0) + { + t.Weight = FARM_DEFAULT_WEIGHT; + } + + FormatText(hWnd, S_TITLE, p->ServerName); + DlgFont(hWnd, S_CURRENT, 11, true); + + SetText(hWnd, S_CURRENT, GetServerTypeStr(t.ServerType)); + + switch (t.ServerType) + { + case SERVER_TYPE_FARM_CONTROLLER: + Check(hWnd, R_CONTROLLER, true); + break; + + case SERVER_TYPE_FARM_MEMBER: + Check(hWnd, R_MEMBER, true); + break; + + default: + Check(hWnd, R_STANDALONE, true); + break; + } + + SetInt(hWnd, E_WEIGHT, t.Weight); + + if (t.ServerType == SERVER_TYPE_FARM_CONTROLLER) + { + Check(hWnd, R_CONTROLLER_ONLY, t.ControllerOnly); + } + + if (t.ServerType == SERVER_TYPE_FARM_MEMBER) + { + char tmp[MAX_PUBLIC_PORT_NUM * 8]; + UINT i; + if (t.PublicIp != 0) + { + IpSet(hWnd, E_IP, t.PublicIp); + } + StrCpy(tmp, sizeof(tmp), ""); + if (t.NumPort != 0) + { + for (i = 0;i < t.NumPort;i++) + { + Format(tmp, sizeof(tmp), "%s%u", tmp, t.Ports[i]); + if (i != (t.NumPort - 1)) + { + StrCat(tmp, sizeof(tmp), ", "); + } + } + SetTextA(hWnd, E_PORT, tmp); + } + SetTextA(hWnd, E_CONTROLLER, t.ControllerName); + SetIntEx(hWnd, E_CONTROLLER_PORT, t.ControllerPort); + SetTextA(hWnd, E_PASSWORD, HIDDEN_PASSWORD); + } + else + { + // Write the port list + RPC_LISTENER_LIST t; + char tmp[MAX_PUBLIC_PORT_NUM * 8]; + Zero(&t, sizeof(t)); + StrCpy(tmp, sizeof(tmp), ""); + if (CALL(hWnd, ScEnumListener(p->Rpc, &t))) + { + UINT i; + if (t.NumPort != 0) + { + for (i = 0;i < t.NumPort;i++) + { + Format(tmp, sizeof(tmp), "%s%u", tmp, t.Ports[i]); + if (i != (t.NumPort - 1)) + { + StrCat(tmp, sizeof(tmp), ", "); + } + } + SetTextA(hWnd, E_PORT, tmp); + } + FreeRpcListenerList(&t); + } + } + + SmFarmDlgUpdate(hWnd, p); + + FreeRpcFarm(&t); + + Focus(hWnd, IDOK); +} + +// Dialog update +void SmFarmDlgUpdate(HWND hWnd, SM_SERVER *p) +{ + bool ok = true; + bool farm_member_control = false; + char *s; + // Validate arguments + if (hWnd == NULL || p == NULL) + { + return; + } + + if (IsChecked(hWnd, R_MEMBER)) + { + LIST *o; + UINT i = IpGetFilledNum(hWnd, E_IP); + if (i != 0 && i != 4) + { + ok = false; + } + + s = GetTextA(hWnd, E_PORT); + o = StrToPortList(s, true); + if (o == NULL) + { + ok = false; + } + else + { + ReleaseList(o); + } + Free(s); + + if (IsEmpty(hWnd, E_CONTROLLER)) + { + ok = false; + } + + i = GetInt(hWnd, E_CONTROLLER_PORT); + if (i == 0 || i >= 65536) + { + ok = false; + } + + farm_member_control = true; + } + + if (IsChecked(hWnd, R_STANDALONE)) + { + Disable(hWnd, S_1); + Disable(hWnd, S_2); + Disable(hWnd, E_WEIGHT); + } + else + { + Enable(hWnd, S_1); + Enable(hWnd, S_2); + Enable(hWnd, E_WEIGHT); + } + + if (IsChecked(hWnd, R_CONTROLLER)) + { + Enable(hWnd, R_CONTROLLER_ONLY); + } + else + { + Disable(hWnd, R_CONTROLLER_ONLY); + } + + if (IsChecked(hWnd, R_CONTROLLER) || IsChecked(hWnd, R_MEMBER)) + { + if (GetInt(hWnd, E_WEIGHT) == 0) + { + ok = false; + } + } + + SetEnable(hWnd, S_IP_1, farm_member_control); + SetEnable(hWnd, E_IP, farm_member_control); + SetEnable(hWnd, S_IP_2, farm_member_control); + SetEnable(hWnd, S_PORT_1, farm_member_control); + SetEnable(hWnd, E_PORT, farm_member_control); + SetEnable(hWnd, S_PORT_2, farm_member_control); + SetEnable(hWnd, S_PORT_3, farm_member_control); + SetEnable(hWnd, E_CONTROLLER, farm_member_control); + SetEnable(hWnd, S_CONTROLLER, farm_member_control); + SetEnable(hWnd, E_CONTROLLER_PORT, farm_member_control); + SetEnable(hWnd, S_CONTROLLER_PORT, farm_member_control); + SetEnable(hWnd, S_PASSWORD, farm_member_control); + SetEnable(hWnd, E_PASSWORD, farm_member_control); + SetEnable(hWnd, IDOK, ok); +} + +// [OK] button +void SmFarmDlgOnOk(HWND hWnd, SM_SERVER *p) +{ + // Validate arguments + if (hWnd == NULL || p == NULL) + { + return; + } + + // Display the message + if (MsgBox(hWnd, MB_ICONEXCLAMATION | MB_OKCANCEL | MB_DEFBUTTON2, + _UU("SM_FARM_REBOOT_MSG")) == IDOK) + { + RPC_FARM t; + Zero(&t, sizeof(t)); + t.ServerType = SERVER_TYPE_STANDALONE; + if (IsChecked(hWnd, R_CONTROLLER)) + { + t.ServerType = SERVER_TYPE_FARM_CONTROLLER; + } + if (IsChecked(hWnd, R_MEMBER)) + { + t.ServerType = SERVER_TYPE_FARM_MEMBER; + } + + t.ControllerOnly = IsChecked(hWnd, R_CONTROLLER_ONLY); + t.Weight = GetInt(hWnd, E_WEIGHT); + + if (t.ServerType == SERVER_TYPE_FARM_MEMBER) + { + char *s; + char pass[MAX_SIZE]; + t.PublicIp = IpGet(hWnd, E_IP); + s = GetTextA(hWnd, E_PORT); + if (s != NULL) + { + LIST *o = StrToPortList(s, true); + if (o != NULL) + { + UINT i; + t.NumPort = LIST_NUM(o); + t.Ports = ZeroMalloc(sizeof(UINT) * t.NumPort); + for (i = 0;i < t.NumPort;i++) + { + t.Ports[i] = (UINT)LIST_DATA(o, i); + } + ReleaseList(o); + } + Free(s); + } + GetTxtA(hWnd, E_CONTROLLER, t.ControllerName, sizeof(t.ControllerName)); + t.ControllerPort = GetInt(hWnd, E_CONTROLLER_PORT); + GetTxtA(hWnd, E_PASSWORD, pass, sizeof(pass)); + if (StrCmp(pass, HIDDEN_PASSWORD) != 0) + { + Sha0(t.MemberPassword, pass, StrLen(pass)); + } + } + + // Configuration update + if (CALL(hWnd, ScSetFarmSetting(p->Rpc, &t)) == false) + { + return; + } + + FreeRpcFarm(&t); + + EndDialog(hWnd, true); + } +} + +// Server farm dialog procedure +UINT SmFarmDlgProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param) +{ + SM_SERVER *p = (SM_SERVER *)param; + // Validate arguments + if (hWnd == NULL) + { + return 0; + } + + switch (msg) + { + case WM_INITDIALOG: + // Initialize + SmFarmDlgInit(hWnd, p); + break; + + case WM_COMMAND: + switch (LOWORD(wParam)) + { + case R_STANDALONE: + case R_CONTROLLER: + case R_MEMBER: + case E_IP: + case E_PORT: + case E_CONTROLLER: + case E_CONTROLLER_PORT: + case E_PASSWORD: + case R_CONTROLLER_ONLY: + case E_WEIGHT: + SmFarmDlgUpdate(hWnd, p); + break; + } + + switch (wParam) + { + case IDOK: + // [OK] button + SmFarmDlgOnOk(hWnd, p); + break; + + case IDCANCEL: + // Cancel button + Close(hWnd); + break; + + case R_MEMBER: + if (IsChecked(hWnd, R_MEMBER)) + { + Focus(hWnd, E_IP); + } + break; + } + break; + + case WM_CLOSE: + EndDialog(hWnd, false); + break; + } + + return 0; +} + +// Server farm configuration +bool SmFarmDlg(HWND hWnd, SM_SERVER *p) +{ + // Validate arguments + if (hWnd == NULL || p == NULL) + { + return false; + } + + return Dialog(hWnd, D_SM_FARM, SmFarmDlgProc, p); +} + +// Update the connection information +bool SmRefreshConnectionStatus(HWND hWnd, SM_SERVER *p, void *param) +{ + RPC_CONNECTION_INFO t; + SM_CONNECTION_INFO *info = (SM_CONNECTION_INFO *)param; + LVB *b; + wchar_t tmp[MAX_SIZE]; + // Validate arguments + if (hWnd == NULL || p == NULL || param == NULL) + { + return false; + } + + Zero(&t, sizeof(t)); + StrCpy(t.Name, sizeof(t.Name), info->ConnectionName); + if (CALL(hWnd, ScGetConnectionInfo(p->Rpc, &t)) == false) + { + return false; + } + + b = LvInsertStart(); + + StrToUni(tmp, sizeof(tmp), t.Name); + LvInsertAdd(b, ICO_PROTOCOL, NULL, 2, _UU("SM_CONNINFO_NAME"), tmp); + + LvInsertAdd(b, ICO_MACHINE, NULL, 2, _UU("SM_CONNINFO_TYPE"), SmGetConnectionTypeStr(t.Type)); + + StrToUni(tmp, sizeof(tmp), t.Hostname); + LvInsertAdd(b, ICO_FARM, NULL, 2, _UU("SM_CONNINFO_HOSTNAME"), tmp); + + UniToStru(tmp, t.Port); + LvInsertAdd(b, ICO_PROTOCOL, NULL, 2, _UU("SM_CONNINFO_PORT"), tmp); + + GetDateTimeStrEx64(tmp, sizeof(tmp), SystemToLocal64(t.ConnectedTime), NULL); + LvInsertAdd(b, ICO_INFORMATION, NULL, 2, _UU("SM_CONNINFO_TIME"), tmp); + + StrToUni(tmp, sizeof(tmp), t.ServerStr); + LvInsertAdd(b, ICO_VPNSERVER, NULL, 2, _UU("SM_CONNINFO_SERVER_STR"), tmp); + + UniFormat(tmp, sizeof(tmp), L"%u.%02u", t.ServerVer / 100, t.ServerVer % 100); + LvInsertAdd(b, ICO_MACHINE, NULL, 2, _UU("SM_CONNINFO_SERVER_VER"), tmp); + + UniToStru(tmp, t.ServerBuild); + LvInsertAdd(b, ICO_MACHINE, NULL, 2, _UU("SM_CONNINFO_SERVER_BUILD"), tmp); + + if (StrLen(t.ClientStr) != 0) + { + StrToUni(tmp, sizeof(tmp), t.ClientStr); + LvInsertAdd(b, ICO_VPN, NULL, 2, _UU("SM_CONNINFO_CLIENT_STR"), tmp); + + UniFormat(tmp, sizeof(tmp), L"%u.%02u", t.ClientVer / 100, t.ClientVer % 100); + LvInsertAdd(b, ICO_MACHINE, NULL, 2, _UU("SM_CONNINFO_CLIENT_VER"), tmp); + + UniToStru(tmp, t.ClientBuild); + LvInsertAdd(b, ICO_MACHINE, NULL, 2, _UU("SM_CONNINFO_CLIENT_BUILD"), tmp); + } + + LvInsertEnd(b, hWnd, L_STATUS); + + return true; +} + +// Initialize +void SmConnectionDlgInit(HWND hWnd, SM_SERVER *p) +{ + // Validate arguments + if (hWnd == NULL || p == NULL) + { + return; + } + + SetIcon(hWnd, 0, ICO_PROTOCOL); + FormatText(hWnd, S_TITLE, p->ServerName); + + // Initialize the column + LvInit(hWnd, L_LIST); + LvSetStyle(hWnd, L_LIST, LVS_EX_GRIDLINES); + LvInsertColumn(hWnd, L_LIST, 0, _UU("SM_CONN_COLUMN_1"), 90); + LvInsertColumn(hWnd, L_LIST, 1, _UU("SM_CONN_COLUMN_2"), 150); + LvInsertColumn(hWnd, L_LIST, 2, _UU("SM_CONN_COLUMN_3"), 200); + LvInsertColumn(hWnd, L_LIST, 3, _UU("SM_CONN_COLUMN_4"), 80); + + SmConnectionDlgRefresh(hWnd, p); + SmConnectionDlgUpdate(hWnd, p); +} + +// Update +void SmConnectionDlgRefresh(HWND hWnd, SM_SERVER *p) +{ + LVB *b; + UINT i; + RPC_ENUM_CONNECTION t; + // Validate arguments + if (hWnd == NULL || p == NULL) + { + return; + } + + Zero(&t, sizeof(t)); + if (CALL(hWnd, ScEnumConnection(p->Rpc, &t)) == false) + { + EndDialog(hWnd, false); + return; + } + + b = LvInsertStart(); + + for (i = 0;i < t.NumConnection;i++) + { + wchar_t tmp[MAX_SIZE]; + wchar_t name[MAX_SIZE]; + wchar_t datetime[MAX_SIZE]; + RPC_ENUM_CONNECTION_ITEM *e = &t.Connections[i]; + + StrToUni(name, sizeof(name), e->Name); + UniFormat(tmp, sizeof(tmp), _UU("SM_HOSTNAME_AND_PORT"), e->Hostname, e->Port); + GetDateTimeStrEx64(datetime, sizeof(datetime), SystemToLocal64(e->ConnectedTime), NULL); + + LvInsertAdd(b, ICO_PROTOCOL, NULL, 4, name, tmp, datetime, + SmGetConnectionTypeStr(e->Type)); + } + + LvInsertEnd(b, hWnd, L_LIST); + + FreeRpcEnumConnection(&t); +} + +// Update the control +void SmConnectionDlgUpdate(HWND hWnd, SM_SERVER *p) +{ + bool b = false; + // Validate arguments + if (hWnd == NULL || p == NULL) + { + return; + } + + if (LvIsSelected(hWnd, L_LIST) && (LvIsMultiMasked(hWnd, L_LIST) == false)) + { + b = true; + } + + SetEnable(hWnd, IDOK, b); + SetEnable(hWnd, B_DISCONNECT, b && p->ServerAdminMode); +} + +// Connection List procedure +UINT SmConnectionDlgProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param) +{ + SM_SERVER *p = (SM_SERVER *)param; + NMHDR *n; + wchar_t *s; + // Validate arguments + if (hWnd == NULL) + { + return 0; + } + + switch (msg) + { + case WM_INITDIALOG: + // Initialize + SmConnectionDlgInit(hWnd, p); + break; + + case WM_COMMAND: + switch (wParam) + { + case IDOK: + // Show the connection information + s = LvGetSelectedStr(hWnd, L_LIST, 0); + if (s != NULL) + { + wchar_t caption[MAX_SIZE]; + SM_CONNECTION_INFO info; + UniFormat(caption, sizeof(caption), _UU("SM_CONNINFO_CAPTION"), + s); + Zero(&info, sizeof(info)); + info.ConnectionName = CopyUniToStr(s); + info.p = p; + SmStatusDlg(hWnd, p, &info, false, false, caption, ICO_PROTOCOL, + NULL, SmRefreshConnectionStatus); + Free(info.ConnectionName); + Free(s); + } + break; + + case B_DISCONNECT: + // Disconnect + s = LvGetSelectedStr(hWnd, L_LIST, 0); + if (s != NULL) + { + if (MsgBoxEx(hWnd, MB_ICONQUESTION | MB_YESNO | MB_DEFBUTTON2, + _UU("SM_CONN_DISCONNECT_MSG"), s) == IDYES) + { + char tmp[MAX_SIZE]; + RPC_DISCONNECT_CONNECTION t; + + UniToStr(tmp, sizeof(tmp), s); + Zero(&t, sizeof(t)); + StrCpy(t.Name, sizeof(t.Name), tmp); + + if (CALL(hWnd, ScDisconnectConnection(p->Rpc, &t))) + { + SmConnectionDlgRefresh(hWnd, p); + } + } + Free(s); + } + break; + + case B_REFRESH: + // Update to the latest state + SmConnectionDlgRefresh(hWnd, p); + break; + + case IDCANCEL: + // Cancel button + Close(hWnd); + break; + } + break; + + case WM_NOTIFY: + n = (NMHDR *)lParam; + switch (n->idFrom) + { + case L_LIST: + switch (n->code) + { + case LVN_ITEMCHANGED: + SmConnectionDlgUpdate(hWnd, p); + break; + } + break; + } + break; + + case WM_CLOSE: + EndDialog(hWnd, false); + break; + } + + LvStandardHandler(hWnd, msg, wParam, lParam, L_LIST); + + return 0; +} + +// Display the connection list +void SmConnectionDlg(HWND hWnd, SM_SERVER *p) +{ + // Validate arguments + if (hWnd == NULL || p == NULL) + { + return; + } + + Dialog(hWnd, D_SM_CONNECTION, SmConnectionDlgProc, p); +} + +// Get the connection type string +wchar_t *SmGetConnectionTypeStr(UINT type) +{ + return GetConnectionTypeStr(type); +} + +// Update the server information +bool SmRefreshServerInfo(HWND hWnd, SM_SERVER *p, void *param) +{ + RPC_SERVER_INFO t; + LVB *b; + wchar_t tmp[MAX_SIZE]; + // Validate arguments + if (hWnd == NULL || p == NULL) + { + return false; + } + + Zero(&t, sizeof(t)); + if (CALL(hWnd, ScGetServerInfo(p->Rpc, &t)) == false) + { + return false; + } + + b = LvInsertStart(); + + // Product name + StrToUni(tmp, sizeof(tmp), t.ServerProductName); + LvInsertAdd(b, ICO_VPNSERVER, NULL, 2, _UU("SM_INFO_PRODUCT_NAME"), tmp); + + // Version + StrToUni(tmp, sizeof(tmp), t.ServerVersionString); + LvInsertAdd(b, ICO_INFORMATION, NULL, 2, _UU("SM_INFO_VERSION"), tmp); + + // Build + StrToUni(tmp, sizeof(tmp), t.ServerBuildInfoString); + LvInsertAdd(b, ICO_MACHINE, NULL, 2, _UU("SM_INFO_BUILD"), tmp); + + // Host name + StrToUni(tmp, sizeof(tmp), t.ServerHostName); + LvInsertAdd(b, ICO_TOWER, NULL, 2, _UU("SM_INFO_HOSTNAME"), tmp); + + // Type + LvInsertAdd(b, t.ServerType == SERVER_TYPE_STANDALONE ? ICO_SERVER_ONLINE : ICO_FARM, 0, + 2, _UU("SM_ST_SERVER_TYPE"), + GetServerTypeStr(t.ServerType)); + + // OS + StrToUni(tmp, sizeof(tmp), t.OsInfo.OsSystemName); + LvInsertAdd(b, ICO_MACHINE, NULL, 2, _UU("SM_OS_SYSTEM_NAME"), tmp); + + StrToUni(tmp, sizeof(tmp), t.OsInfo.OsProductName); + LvInsertAdd(b, ICO_MACHINE, NULL, 2, _UU("SM_OS_PRODUCT_NAME"), tmp); + + if (t.OsInfo.OsServicePack != 0) + { + UniFormat(tmp, sizeof(tmp), _UU("SM_OS_SP_TAG"), t.OsInfo.OsServicePack); + LvInsertAdd(b, ICO_MACHINE, NULL, 2, _UU("SM_OS_SERVICE_PACK"), tmp); + } + + StrToUni(tmp, sizeof(tmp), t.OsInfo.OsVendorName); + LvInsertAdd(b, ICO_MACHINE, NULL, 2, _UU("SM_OS_VENDER_NAME"), tmp); + + StrToUni(tmp, sizeof(tmp), t.OsInfo.OsVersion); + LvInsertAdd(b, ICO_MACHINE, NULL, 2, _UU("SM_OS_VERSION"), tmp); + + StrToUni(tmp, sizeof(tmp), t.OsInfo.KernelName); + LvInsertAdd(b, ICO_MACHINE, NULL, 2, _UU("SM_OS_KERNEL_NAME"), tmp); + + StrToUni(tmp, sizeof(tmp), t.OsInfo.KernelVersion); + LvInsertAdd(b, ICO_MACHINE, NULL, 2, _UU("SM_OS_KERNEL_VERSION"), tmp); + + SmAddServerCaps(b, p->CapsList); + + LvInsertEnd(b, hWnd, L_STATUS); + + FreeRpcServerInfo(&t); + + return true; +} + +// Display the Caps of the server on the screen +void SmAddServerCaps(LVB *b, CAPSLIST *t) +{ + UINT i; + // Validate arguments + if (b == NULL || t == NULL) + { + return; + } + + for (i = 0;i < LIST_NUM(t->CapsList);i++) + { + CAPS *c = LIST_DATA(t->CapsList, i); + wchar_t title[MAX_SIZE]; + char name[256]; + + Format(name, sizeof(name), "CT_%s", c->Name); + + UniStrCpy(title, sizeof(title), _UU(name)); + + if (UniIsEmptyStr(title)) + { + UniFormat(title, sizeof(title), L"%S", (StrLen(c->Name) >= 2) ? c->Name + 2 : c->Name); + } + + if (StartWith(c->Name, "b_")) + { + bool icon_pass = c->Value == 0 ? false : true; + if (StrCmpi(c->Name, "b_must_install_pcap") == 0) + { + // Invert only the item of WinPcap + icon_pass = !icon_pass; + } + LvInsertAdd(b, icon_pass == false ? ICO_DISCARD : ICO_PASS, + NULL, 2, title, c->Value == 0 ? _UU("CAPS_NO") : _UU("CAPS_YES")); + } + else + { + wchar_t str[64]; + UniToStru(str, c->Value); + LvInsertAdd(b, ICO_PROTOCOL, NULL, 2, title, str); + } + } +} + +// Update the server state +bool SmRefreshServerStatus(HWND hWnd, SM_SERVER *p, void *param) +{ + RPC_SERVER_STATUS t; + LVB *b; + wchar_t tmp[MAX_SIZE]; + char str[MAX_SIZE]; + // Validate arguments + if (hWnd == NULL || p == NULL) + { + return false; + } + + Zero(&t, sizeof(t)); + if (CALL(hWnd, ScGetServerStatus(p->Rpc, &t)) == false) + { + return false; + } + + b = LvInsertStart(); + + // Type of server + LvInsertAdd(b, t.ServerType == SERVER_TYPE_STANDALONE ? ICO_SERVER_ONLINE : ICO_FARM, 0, + 2, _UU("SM_ST_SERVER_TYPE"), + GetServerTypeStr(t.ServerType)); + + // Number of TCP connections + UniToStru(tmp, t.NumTcpConnections); + LvInsertAdd(b, ICO_PROTOCOL, NULL, 2, _UU("SM_ST_NUM_TCP"), tmp); + + if (t.ServerType == SERVER_TYPE_FARM_CONTROLLER) + { + // Number of Local TCP connections + UniToStru(tmp, t.NumTcpConnectionsLocal); + LvInsertAdd(b, ICO_PROTOCOL, NULL, 2, _UU("SM_ST_NUM_TCP_LOCAL"), tmp); + + // Number of remote TCP connections + UniToStru(tmp, t.NumTcpConnectionsRemote); + LvInsertAdd(b, ICO_PROTOCOL, NULL, 2, _UU("SM_ST_NUM_TCP_REMOTE"), tmp); + } + + // Number of Virtual HUBs + UniToStru(tmp, t.NumHubTotal); + LvInsertAdd(b, ICO_HUB, NULL, 2, _UU("SM_ST_NUM_HUB_TOTAL"), tmp); + + if (t.ServerType != SERVER_TYPE_STANDALONE) + { + // Number of static HUBs + UniToStru(tmp, t.NumHubStatic); + LvInsertAdd(b, ICO_HUB, NULL, 2, _UU("SM_ST_NUM_HUB_STATIC"), tmp); + + // Number of Dynamic HUBs + UniToStru(tmp, t.NumHubDynamic); + LvInsertAdd(b, ICO_HUB, NULL, 2, _UU("SM_ST_NUM_HUB_DYNAMIC"), tmp); + } + + // Number of sessions + UniToStru(tmp, t.NumSessionsTotal); + LvInsertAdd(b, ICO_VPN, NULL, 2, _UU("SM_ST_NUM_SESSION_TOTAL"), tmp); + + if (t.ServerType == SERVER_TYPE_FARM_CONTROLLER) + { + // Number of local sessions + UniToStru(tmp, t.NumSessionsLocal); + LvInsertAdd(b, ICO_VPN, NULL, 2, _UU("SM_ST_NUM_SESSION_LOCAL"), tmp); + + // Number of local sessions + UniToStru(tmp, t.NumSessionsRemote); + LvInsertAdd(b, ICO_VPN, NULL, 2, _UU("SM_ST_NUM_SESSION_REMOTE"), tmp); + } + + // Number of MAC table entries + UniToStru(tmp, t.NumMacTables); + LvInsertAdd(b, ICO_MACHINE, NULL, 2, _UU("SM_ST_NUM_MAC_TABLE"), tmp); + + // Number of IP table entries + UniToStru(tmp, t.NumIpTables); + LvInsertAdd(b, ICO_MACHINE, NULL, 2, _UU("SM_ST_NUM_IP_TABLE"), tmp); + + // Number of users + UniToStru(tmp, t.NumUsers); + LvInsertAdd(b, ICO_USER, NULL, 2, _UU("SM_ST_NUM_USERS"), tmp); + + // Number of groups + UniToStru(tmp, t.NumGroups); + LvInsertAdd(b, ICO_GROUP, NULL, 2, _UU("SM_ST_NUM_GROUPS"), tmp); + + // Number of assigned licenses + UniToStru(tmp, t.AssignedClientLicenses); + LvInsertAdd(b, ICO_CERT, NULL, 2, _UU("SM_ST_CLIENT_LICENSE"), tmp); + UniToStru(tmp, t.AssignedBridgeLicenses); + LvInsertAdd(b, ICO_CERT, NULL, 2, _UU("SM_ST_BRIDGE_LICENSE"), tmp); + + if (t.ServerType == SERVER_TYPE_FARM_CONTROLLER) + { + UniToStru(tmp, t.AssignedClientLicensesTotal); + LvInsertAdd(b, ICO_CERT, NULL, 2, _UU("SM_ST_CLIENT_LICENSE_EX"), tmp); + UniToStru(tmp, t.AssignedBridgeLicensesTotal); + LvInsertAdd(b, ICO_CERT, NULL, 2, _UU("SM_ST_BRIDGE_LICENSE_EX"), tmp); + } + + // Traffic + SmInsertTrafficInfo(b, &t.Traffic); + + // Server start-up time + GetDateTimeStrEx64(tmp, sizeof(tmp), SystemToLocal64(t.StartTime), NULL); + LvInsertAdd(b, ICO_NULL, NULL, 2, _UU("SM_ST_START_TIME"), tmp); + + // Current time + GetDateTimeStrMilli64(str, sizeof(str), SystemToLocal64(t.CurrentTime)); + StrToUni(tmp, sizeof(tmp), str); + LvInsertAdd(b, ICO_NULL, NULL, 2, _UU("SM_ST_CURRENT_TIME"), tmp); + + // Tick value + UniFormat(tmp, sizeof(tmp), L"%I64u", t.CurrentTick); + LvInsertAdd(b, ICO_NULL, NULL, 2, _UU("SM_ST_CURRENT_TICK"), tmp); + + // Memory information + if (t.MemInfo.TotalMemory != 0) + { + char vv[128]; + + ToStr3(vv, sizeof(vv), t.MemInfo.TotalMemory); + UniFormat(tmp, sizeof(tmp), _UU("SM_ST_RAM_SIZE_KB"), vv); + LvInsertAdd(b, ICO_MEMORY, NULL, 2, _UU("SM_ST_TOTAL_MEMORY"), tmp); + + ToStr3(vv, sizeof(vv), t.MemInfo.UsedMemory); + UniFormat(tmp, sizeof(tmp), _UU("SM_ST_RAM_SIZE_KB"), vv); + LvInsertAdd(b, ICO_MEMORY, NULL, 2, _UU("SM_ST_USED_MEMORY"), tmp); + + ToStr3(vv, sizeof(vv), t.MemInfo.FreeMemory); + UniFormat(tmp, sizeof(tmp), _UU("SM_ST_RAM_SIZE_KB"), vv); + LvInsertAdd(b, ICO_MEMORY, NULL, 2, _UU("SM_ST_FREE_MEMORY"), tmp); + + ToStr3(vv, sizeof(vv), t.MemInfo.TotalPhys); + UniFormat(tmp, sizeof(tmp), _UU("SM_ST_RAM_SIZE_KB"), vv); + LvInsertAdd(b, ICO_MEMORY, NULL, 2, _UU("SM_ST_TOTAL_PHYS"), tmp); + + ToStr3(vv, sizeof(vv), t.MemInfo.UsedPhys); + UniFormat(tmp, sizeof(tmp), _UU("SM_ST_RAM_SIZE_KB"), vv); + LvInsertAdd(b, ICO_MEMORY, NULL, 2, _UU("SM_ST_USED_PHYS"), tmp); + + ToStr3(vv, sizeof(vv), t.MemInfo.FreePhys); + UniFormat(tmp, sizeof(tmp), _UU("SM_ST_RAM_SIZE_KB"), vv); + LvInsertAdd(b, ICO_MEMORY, NULL, 2, _UU("SM_ST_FREE_PHYS"), tmp); + } + + LvInsertEnd(b, hWnd, L_STATUS); + + return true; +} + +// Initialize +void SmSaveKeyPairDlgInit(HWND hWnd, SM_SAVE_KEY_PAIR *s) +{ + UINT current; + // Validate arguments + if (hWnd == NULL || s == NULL) + { + return; + } + + current = MsRegReadInt(REG_CURRENT_USER, SM_REG_KEY, "SavePkcs12"); + + if (current == 1) + { + Check(hWnd, R_PKCS12, true); + } + else if (current == 2) + { + Check(hWnd, R_SECURE, true); + } + else + { + Check(hWnd, R_X509_AND_KEY, true); + } + + if (MsIsWine()) + { + Disable(hWnd, R_SECURE); + } + + SmSaveKeyPairDlgUpdate(hWnd, s); +} + +// Update +void SmSaveKeyPairDlgUpdate(HWND hWnd, SM_SAVE_KEY_PAIR *s) +{ + SECURE_DEVICE *dev; + bool ok = true; + wchar_t tmp[MAX_SIZE]; + // Validate arguments + if (hWnd == NULL || s == NULL) + { + return; + } + + dev = GetSecureDevice(SmGetCurrentSecureIdFromReg()); + if (dev == NULL) + { + UniStrCpy(tmp, sizeof(tmp), _UU("SEC_CURRENT_NO_DEVICE")); + } + else + { + UniFormat(tmp, sizeof(tmp), _UU("SEC_CURRENT_DEVICE"), dev->DeviceName); + } + + SetText(hWnd, S_INFO, tmp); + + if (IsChecked(hWnd, R_USE_PASS)) + { + char *s1, *s2; + s1 = GetTextA(hWnd, E_PASS1); + s2 = GetTextA(hWnd, E_PASS2); + if (StrCmp(s1, s2) != 0) + { + ok = false; + } + Free(s1); + Free(s2); + } + + if (IsChecked(hWnd, R_SECURE)) + { + if (dev == NULL) + { + ok = false; + } + } + + SetEnable(hWnd, B_SELECT, IsChecked(hWnd, R_SECURE)); + SetEnable(hWnd, B_SECURE_MANAGER, IsChecked(hWnd, R_SECURE)); + SetEnable(hWnd, S_INFO, IsChecked(hWnd, R_SECURE)); + + SetEnable(hWnd, E_PASS1, IsChecked(hWnd, R_USE_PASS) && (IsChecked(hWnd, R_SECURE) == false)); + SetEnable(hWnd, E_PASS2, IsChecked(hWnd, R_USE_PASS) && (IsChecked(hWnd, R_SECURE) == false)); + SetEnable(hWnd, S_PASS1, IsChecked(hWnd, R_USE_PASS) && (IsChecked(hWnd, R_SECURE) == false)); + SetEnable(hWnd, S_PASS2, IsChecked(hWnd, R_USE_PASS) && (IsChecked(hWnd, R_SECURE) == false)); + SetEnable(hWnd, R_USE_PASS, (IsChecked(hWnd, R_SECURE) == false)); + SetEnable(hWnd, S_PASS3, (IsChecked(hWnd, R_SECURE) == false)); + SetEnable(hWnd, S_PASS4, (IsChecked(hWnd, R_SECURE) == false)); + + SetEnable(hWnd, IDOK, ok); +} + +// [OK] button +void SmSaveKeyPairDlgOnOk(HWND hWnd, SM_SAVE_KEY_PAIR *s) +{ + UINT pkcs12; + char pass[MAX_SIZE]; + char *password; + // Validate arguments + if (hWnd == NULL || s == NULL) + { + return; + } + + pkcs12 = 0; + + if (IsChecked(hWnd, R_PKCS12)) + { + pkcs12 = 1; + } + else if (IsChecked(hWnd, R_SECURE)) + { + pkcs12 = 2; + } + MsRegWriteInt(REG_CURRENT_USER, SM_REG_KEY, "SavePkcs12", pkcs12); + + if (pkcs12 != 2) + { + GetTxtA(hWnd, E_PASS1, pass, sizeof(pass)); + + if (StrLen(pass) != 0) + { + password = pass; + } + else + { + password = NULL; + } + + if (pkcs12 == false) + { + // Write to the X509 and KEY + wchar_t *x509_name, *key_name; + x509_name = SaveDlg(hWnd, _UU("DLG_CERT_FILES"), _UU("DLG_SAVE_CERT"), NULL, L".cer"); + if (x509_name == NULL) + { + // Cancel + return; + } + else + { + wchar_t default_key_name[MAX_SIZE]; + UniReplaceStrEx(default_key_name, sizeof(default_key_name), x509_name, + L".cer", L"", false); + UniReplaceStrEx(default_key_name, sizeof(default_key_name), default_key_name, + L".crt", L"", false); + UniStrCat(default_key_name, sizeof(default_key_name), L".key"); + key_name = SaveDlg(hWnd, _UU("DLG_KEY_FILTER"), _UU("DLG_SAVE_KEY"), + default_key_name, L".key"); + if (key_name == NULL) + { + // Cancel + Free(x509_name); + return; + } + else + { + bool ok = true; + wchar_t filename1[MAX_SIZE]; + wchar_t filename2[MAX_SIZE]; + + UniStrCpy(filename1, sizeof(filename1), x509_name); + UniStrCpy(filename2, sizeof(filename2), key_name); + + // Save the certificate + if (XToFileW(s->Cert, filename1, true) == false) + { + MsgBox(hWnd, MB_ICONSTOP, _UU("DLG_CERT_SAVE_ERROR")); + ok = false; + } + else + { + if (KToFileW(s->Key, filename2, true, password) == false) + { + MsgBox(hWnd, MB_ICONSTOP, _UU("DLG_KEY_SAVE_ERROR")); + ok = false; + } + } + + if (ok) + { + MsgBox(hWnd, MB_ICONINFORMATION, _UU("DLG_KEY_PAIR_SAVE_OK")); + EndDialog(hWnd, true); + } + + Free(key_name); + } + Free(x509_name); + } + } + else + { + // Write to the PKCS#12 + wchar_t *name = SaveDlg(hWnd, _UU("DLG_PKCS12_FILTER"), _UU("DLG_SAVE_P12"), NULL, L".p12"); + if (name == NULL) + { + // Cancel + return; + } + else + { + P12 *p12; + wchar_t filename[MAX_SIZE]; + UniStrCpy(filename, sizeof(filename), name); + + // Convert to PKCS#12 + p12 = NewP12(s->Cert, s->Key, pass); + if (p12 == NULL) + { + // Failure + MsgBox(hWnd, MB_ICONSTOP, _UU("DLG_KEY_PAIR_SAVE_ERROR")); + } + else + { + // Save + if (P12ToFileW(p12, filename) == false) + { + // Failure + MsgBox(hWnd, MB_ICONSTOP, _UU("DLG_KEY_PAIR_SAVE_ERROR")); + } + else + { + // Success + MsgBox(hWnd, MB_ICONINFORMATION, _UU("DLG_KEY_PAIR_SAVE_OK")); + EndDialog(hWnd, true); + } + FreeP12(p12); + } + + Free(name); + } + } + } + else + { + char default_name[MAX_SIZE]; + char *object_name; + bool ok = false; + X *x; + K *k; + WINUI_SECURE_BATCH batch[] = + { + {WINUI_SECURE_WRITE_CERT, NULL, true, NULL, NULL, NULL, NULL, NULL, NULL}, + {WINUI_SECURE_WRITE_KEY, NULL, true, NULL, NULL, NULL, NULL, NULL, NULL}, + }; + + x = s->Cert; + k = s->Key; + + // Generate the default name + GetPrintNameFromXA(default_name, sizeof(default_name), x); + ConvertSafeFileName(default_name, sizeof(default_name), default_name); + + object_name = StringDlgA(hWnd, _UU("SEC_OBJECT_NAME_TITLE"), + _UU("SEC_OBJECT_NAME_INFO"), default_name, ICO_CERT, false, false); + + if (object_name != NULL) + { + // Write and enumerate + batch[0].InputX = x; + batch[0].Name = object_name; + batch[1].InputK = k; + batch[1].Name = object_name; + + if (SecureDeviceWindow(hWnd, batch, sizeof(batch) / sizeof(batch[0]), SmGetCurrentSecureIdFromReg(), 0) == false) + { + // Failure + } + else + { + ok = true; + } + + Free(object_name); + } + + if (ok) + { + MsgBox(hWnd, MB_ICONINFORMATION, _UU("SEC_NEW_CERT_IMPORT_OK")); + + EndDialog(hWnd, true); + } + } +} + +// Saving dialog box of the certificate and private key +UINT SmSaveKeyPairDlgProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param) +{ + SM_SAVE_KEY_PAIR *s = (SM_SAVE_KEY_PAIR *)param; + // Validate arguments + if (hWnd == NULL) + { + return 0; + } + + switch (msg) + { + case WM_INITDIALOG: + // Initialize + SmSaveKeyPairDlgInit(hWnd, s); + break; + + case WM_COMMAND: + switch (LOWORD(wParam)) + { + case E_PASS1: + case E_PASS2: + case R_USE_PASS: + case R_SECURE: + case R_X509_AND_KEY: + case R_PKCS12: + SmSaveKeyPairDlgUpdate(hWnd, s); + break; + } + + switch (wParam) + { + case IDOK: + // [OK] button + SmSaveKeyPairDlgOnOk(hWnd, s); + break; + + case IDCANCEL: + // Cancel button + Close(hWnd); + break; + + case R_USE_PASS: + if (IsChecked(hWnd, R_USE_PASS)) + { + FocusEx(hWnd, E_PASS1); + } + break; + + case B_SELECT: + SmSelectSecureId(hWnd); + SmSaveKeyPairDlgUpdate(hWnd, s); + break; + + case B_SECURE_MANAGER: + CmSecureManagerEx(hWnd, SmGetCurrentSecureId(hWnd), true); + SmSaveKeyPairDlgUpdate(hWnd, s); + break; + } + break; + + case WM_CLOSE: + EndDialog(hWnd, false); + break; + } + + return 0; +} + +// Save the certificate and private key +bool SmSaveKeyPairDlg(HWND hWnd, X *x, K *k) +{ + SM_SAVE_KEY_PAIR s; + // Validate arguments + if (hWnd == NULL || x == NULL || k == NULL) + { + return false; + } + + Zero(&s, sizeof(s)); + s.Cert = x; + s.Key = k; + + return Dialog(hWnd, D_SM_SAVE_KEY_PAIR, SmSaveKeyPairDlgProc, &s); +} + +// OK is clicked on the SSL related dialog +void SmSslDlgOnOk(HWND hWnd, SM_SSL *s) +{ + char *name; + RPC_KEEP t; + // Validate arguments + if (hWnd == NULL || s == NULL) + { + return; + } + + if (s->p->ServerAdminMode == false) + { + EndDialog(hWnd, false); + return; + } + + name = GetTextA(hWnd, C_CIPHER); + if (name == NULL) + { + return; + } + else + { + RPC_STR t; + Zero(&t, sizeof(t)); + t.String = name; + + // Set the encryption algorithm + if (CALL(hWnd, ScSetServerCipher(s->p->Rpc, &t)) == false) + { + Focus(hWnd, C_CIPHER); + return; + } + FreeRpcStr(&t); + } + + if (s->SetCertAndKey) + { + // Set the certificate + RPC_KEY_PAIR t; + Zero(&t, sizeof(t)); + + t.Cert = CloneX(s->Cert); + t.Key = CloneK(s->Key); + + if (CALL(hWnd, ScSetServerCert(s->p->Rpc, &t)) == false) + { + return; + } + + if (t.Flag1 == 0) + { + // Show the warning message + MsgBox(hWnd, MB_ICONWARNING, _UU("SM_CERT_NEED_ROOT")); + } + + FreeRpcKeyPair(&t); + + MsgBox(hWnd, MB_ICONINFORMATION, _UU("CM_CERT_SET_MSG")); + } + + Zero(&t, sizeof(t)); + t.UseKeepConnect = IsChecked(hWnd, R_USE_KEEP_CONNECT); + GetTxtA(hWnd, E_HOSTNAME, t.KeepConnectHost, sizeof(t.KeepConnectHost)); + t.KeepConnectPort = GetInt(hWnd, E_PORT); + t.KeepConnectInterval = GetInt(hWnd, E_INTERVAL); + t.KeepConnectProtocol = IsChecked(hWnd, R_UDP) ? 1 : 0; + + CALL(hWnd, ScSetKeep(s->p->Rpc, &t)); + + if (GetCapsBool(s->p->CapsList, "b_support_syslog")) + { + if (s->p->ServerAdminMode) + { + SYSLOG_SETTING set; + + Zero(&set, sizeof(set)); + GetTxtA(hWnd, E_SYSLOG_HOSTNAME, set.Hostname, sizeof(set.Hostname)); + set.Port = GetInt(hWnd, E_SYSLOG_PORT); + set.SaveType = CbGetSelect(hWnd, C_SYSLOG); + + if (CALL(hWnd, ScSetSysLog(s->p->Rpc, &set)) == false) + { + return; + } + } + } + + EndDialog(hWnd, true); +} + +// SSL related dialog initialization +void SmSslDlgInit(HWND hWnd, SM_SSL *s) +{ + UINT i; + TOKEN_LIST *cipher_list; + RPC_KEEP t; + bool private_key_exportable = false; + // Validate arguments + if (hWnd == NULL || s == NULL) + { + return; + } + + if (s->p != NULL) + { + RPC_STR t; + Zero(&t, sizeof(t)); + + SetFont(hWnd, C_CIPHER, GetFont("Tahoma", 8, false, false, false, false)); + CbSetHeight(hWnd, C_CIPHER, 18); + + // Get the list of available encryption algorithms from the server + if (ScGetServerCipherList(s->p->Rpc, &t) == ERR_NO_ERROR) + { + cipher_list = ParseToken(t.String, ";"); + + FreeRpcStr(&t); + Zero(&t, sizeof(t)); + + for (i = 0; i < cipher_list->NumTokens; i++) + { + wchar_t tmp[MAX_SIZE]; + char *name = cipher_list->Token[i]; + StrToUni(tmp, sizeof(tmp), name); + CbAddStr(hWnd, C_CIPHER, tmp, 0); + } + + FreeToken(cipher_list); + } + + // Get the current encryption algorithm's name from the server + if (CALL(hWnd, ScGetServerCipher(s->p->Rpc, &t))) + { + wchar_t tmp[MAX_SIZE]; + StrToUni(tmp, sizeof(tmp), t.String); + SetText(hWnd, C_CIPHER, tmp); + FreeRpcStr(&t); + } + else + { + EndDialog(hWnd, 0); + return; + } + } + + if (s->p != NULL) + { + wchar_t tmp[MAX_SIZE]; + // Get the SSL certificate and private key from the server + RPC_KEY_PAIR t; + s->SetCertAndKey = false; + Zero(&t, sizeof(t)); + if (CALL(hWnd, ScGetServerCert(s->p->Rpc, &t))) + { + // Copy the certificate and key + s->Cert = CloneX(t.Cert); + s->Key = CloneK(t.Key); + + if (t.Key != NULL) + { + private_key_exportable = true; + } + + FreeRpcKeyPair(&t); + } + else + { + EndDialog(hWnd, 0); + return; + } + + // Show the Certificate Information + SmGetCertInfoStr(tmp, sizeof(tmp), s->Cert); + SetText(hWnd, S_CERT_INFO, tmp); + } + + // Password change + SetEnable(hWnd, B_PASSWORD, s->p->ServerAdminMode); + SetEnable(hWnd, S_INFO4, s->p->ServerAdminMode); + + // Enable / disable the button + SetEnable(hWnd, B_IMPORT, s->p->ServerAdminMode); + SetEnable(hWnd, B_EXPORT, s->p->ServerAdminMode && private_key_exportable); + SetEnable(hWnd, B_REGENERATE, s->p->ServerAdminMode); + SetEnable(hWnd, R_USE_KEEP_CONNECT, s->p->ServerAdminMode); + SetEnable(hWnd, B_UPDATE_CONFIG, s->p->Update != NULL); + + if (s->p->ServerAdminMode && GetCapsBool(s->p->CapsList, "b_support_special_listener")) + { + SetEnable(hWnd, B_SPECIALLISTENER, true); + SetEnable(hWnd, S_INFO5, true); + } + else + { + SetEnable(hWnd, B_SPECIALLISTENER, false); + SetEnable(hWnd, S_INFO5, false); + } + + if (s->p->ServerAdminMode == false) + { + Disable(hWnd, C_CIPHER); + } + + if (CALL(hWnd, ScGetKeep(s->p->Rpc, &t))) + { + Check(hWnd, R_USE_KEEP_CONNECT, t.UseKeepConnect); + SetTextA(hWnd, E_HOSTNAME, t.KeepConnectHost); + SetIntEx(hWnd, E_PORT, t.KeepConnectPort); + SetInt(hWnd, E_INTERVAL, t.KeepConnectInterval); + Check(hWnd, R_TCP, t.KeepConnectProtocol == 0); + Check(hWnd, R_UDP, t.KeepConnectProtocol != 0); + } + + CbSetHeight(hWnd, C_SYSLOG, 18); + CbReset(hWnd, C_SYSLOG); + CbAddStr(hWnd, C_SYSLOG, _UU("SM_SYSLOG_0"), SYSLOG_NONE); + CbAddStr(hWnd, C_SYSLOG, _UU("SM_SYSLOG_1"), SYSLOG_SERVER_LOG); + CbAddStr(hWnd, C_SYSLOG, _UU("SM_SYSLOG_2"), SYSLOG_SERVER_AND_HUB_SECURITY_LOG); + CbAddStr(hWnd, C_SYSLOG, _UU("SM_SYSLOG_3"), SYSLOG_SERVER_AND_HUB_ALL_LOG); + + if (GetCapsBool(s->p->CapsList, "b_support_syslog")) + { + SYSLOG_SETTING set; + + SetEnable(hWnd, C_SYSLOG, s->p->ServerAdminMode); + SetEnable(hWnd, E_SYSLOG_HOSTNAME, s->p->ServerAdminMode); + SetEnable(hWnd, E_SYSLOG_PORT, s->p->ServerAdminMode); + SetEnable(hWnd, S_01, s->p->ServerAdminMode); + SetEnable(hWnd, S_02, s->p->ServerAdminMode); + + Zero(&set, sizeof(set)); + + if (CALL(hWnd, ScGetSysLog(s->p->Rpc, &set))) + { + SetTextA(hWnd, E_SYSLOG_HOSTNAME, set.Hostname); + SetInt(hWnd, E_SYSLOG_PORT, set.Port == 0 ? SYSLOG_PORT : set.Port); + CbSelect(hWnd, C_SYSLOG, set.SaveType); + } + } + else + { + Disable(hWnd, C_SYSLOG); + Disable(hWnd, E_SYSLOG_HOSTNAME); + Disable(hWnd, E_SYSLOG_PORT); + Disable(hWnd, S_01); + Disable(hWnd, S_02); + } + + SmSslDlgUpdate(hWnd, s); +} + +// SSL related dialog control update +void SmSslDlgUpdate(HWND hWnd, SM_SSL *s) +{ + bool ok = true; + bool b; + // Validate arguments + if (hWnd == NULL || s == NULL) + { + return; + } + + if (IsChecked(hWnd, R_USE_KEEP_CONNECT)) + { + UINT i; + b = true; + if (IsEmpty(hWnd, E_HOSTNAME)) + { + ok = false; + } + i = GetInt(hWnd, E_PORT); + if (i == 0 || i >= 65536) + { + ok = false; + } + i = GetInt(hWnd, E_INTERVAL); + if (i < 5 || i > 600) + { + ok = false; + } + } + else + { + b = false; + } + + if (IsEnable(hWnd, C_SYSLOG)) + { + UINT i = CbGetSelect(hWnd, C_SYSLOG); + + SetEnable(hWnd, E_SYSLOG_HOSTNAME, i != SYSLOG_NONE); + SetEnable(hWnd, E_SYSLOG_PORT, i != SYSLOG_NONE); + SetEnable(hWnd, S_01, i != SYSLOG_NONE); + SetEnable(hWnd, S_02, i != SYSLOG_NONE); + } + + SetEnable(hWnd, S_HOSTNAME, b); + SetEnable(hWnd, E_HOSTNAME, b); + SetEnable(hWnd, S_PORT, b); + SetEnable(hWnd, E_PORT, b); + SetEnable(hWnd, S_INTERVAL, b); + SetEnable(hWnd, E_INTERVAL, b); + SetEnable(hWnd, S_INTERVAL2, b); + SetEnable(hWnd, S_PROTOCOL, b); + SetEnable(hWnd, R_TCP, b); + SetEnable(hWnd, R_UDP, b); + SetEnable(hWnd, S_INFO, b); + + SetEnable(hWnd, IDOK, ok); +} + +// Get the certificate information string +void SmGetCertInfoStr(wchar_t *str, UINT size, X *x) +{ + wchar_t subject[MAX_SIZE]; + wchar_t issuer[MAX_SIZE]; + wchar_t date[MAX_SIZE]; + // Validate arguments + if (x == NULL || str == NULL) + { + if (str != NULL) + { + str[0] = 0; + } + return; + } + + GetPrintNameFromName(subject, sizeof(subject), x->subject_name); + GetPrintNameFromName(issuer, sizeof(issuer), x->issuer_name); + GetDateStrEx64(date, sizeof(date), x->notAfter, NULL); + + UniFormat(str, size, _UU("CM_CERT_INFO"), subject, issuer, date); +} + +// Regenerate the server certificate +bool SmRegenerateServerCert(HWND hWnd, SM_SERVER *server, char *default_cn, X **x, K **k, bool root_only) +{ + char defcn[MAX_SIZE]; + // Validate arguments + if (server == NULL || x == NULL || k == NULL) + { + return false; + } + + Zero(defcn, sizeof(defcn)); + if (IsEmptyStr(default_cn) == false) + { + StrCpy(defcn, sizeof(defcn), default_cn); + } + + if (IsEmptyStr(defcn)) + { + // If default CN is not specified, copy from the setting of the DDNS server + DDNS_CLIENT_STATUS t; + + Zero(&t, sizeof(t)); + + if (ScGetDDnsClientStatus(server->Rpc, &t) == ERR_NO_ERROR) + { + if (IsEmptyStr(t.CurrentFqdn) == false) + { + StrCpy(defcn, sizeof(defcn), t.CurrentFqdn); + } + } + } + + if (IsEmptyStr(defcn)) + { + // Copy from the certificate information of the current server + RPC_KEY_PAIR t; + + Zero(&t, sizeof(t)); + + if (ScGetServerCert(server->Rpc, &t) == ERR_NO_ERROR) + { + if (t.Cert != NULL) + { + if (t.Cert->subject_name != NULL) + { + UniToStr(defcn, sizeof(defcn), t.Cert->subject_name->CommonName); + } + } + + FreeRpcKeyPair(&t); + } + } + + if (IsEmptyStr(defcn)) + { + // Copy from the destination server name of the current connection settings + StrCpy(defcn, sizeof(defcn), server->ServerName); + } + + // Create a new certificate in the Certificate Creation Tool + if (SmCreateCert(hWnd, x, k, true, defcn, root_only) == false) + { + return false; + } + + return true; +} + +// SSL related dialog procedure +UINT SmSslDlgProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param) +{ + SM_SSL *s = (SM_SSL *)param; + X *x; + K *k; + // Validate arguments + if (hWnd == NULL) + { + return 0; + } + + switch (msg) + { + case WM_INITDIALOG: + // Initialize + SmSslDlgInit(hWnd, s); + break; + + case WM_COMMAND: + switch (LOWORD(wParam)) + { + case R_USE_KEEP_CONNECT: + case E_HOSTNAME: + case E_PORT: + case E_INTERVAL: + case R_TCP: + case R_UDP: + case C_SYSLOG: + case E_SYSLOG_HOSTNAME: + case E_SYSLOG_PORT: + SmSslDlgUpdate(hWnd, s); + break; + } + + switch (wParam) + { + case IDOK: + // [OK] button + SmSslDlgOnOk(hWnd, s); + break; + + case IDCANCEL: + // Cancel button + Close(hWnd); + break; + + case B_UPDATE_CONFIG: + // Update notification setting + ConfigUpdateUi(s->p->Update, hWnd); + break; + + case B_IMPORT: + // Import + if (CmLoadXAndK(hWnd, &x, &k)) + { + wchar_t tmp[MAX_SIZE]; + +LABEL_APPLY_NEW_CERT: + FreeX(s->Cert); + FreeK(s->Key); + s->Cert = x; + s->Key = k; + s->SetCertAndKey = true; + // Show the Certificate Information + SmGetCertInfoStr(tmp, sizeof(tmp), s->Cert); + SetText(hWnd, S_CERT_INFO, tmp); + } + break; + + case B_EXPORT: + // Export + SmSaveKeyPairDlg(hWnd, s->Cert, s->Key); + break; + + case B_VIEW: + // Show the certificate + CertDlg(hWnd, s->Cert, NULL, true); + break; + + case B_SPECIALLISTENER: + // Special listener configuration + SmSpecialListener(hWnd, s->p); + break; + + case B_REGENERATE: + // Regenerating the certificate + if (SmRegenerateServerCert(hWnd, s->p, NULL, &x, &k, false)) + { + // Confirmation message + if (MsgBox(hWnd, MB_ICONEXCLAMATION | MB_YESNO, _UU("SM_REGENERATE_CERT_MSG")) == IDYES) + { + goto LABEL_APPLY_NEW_CERT; + } + else + { + FreeX(x); + FreeK(k); + } + } + break; + + case B_PASSWORD: + // Password change + Dialog(hWnd, D_SM_CHANGE_PASSWORD, SmChangeServerPasswordDlg, s->p); + break; + + case R_USE_KEEP_CONNECT: + if (IsChecked(hWnd, R_USE_KEEP_CONNECT)) + { + FocusEx(hWnd, E_HOSTNAME); + } + break; + } + break; + + case WM_CLOSE: + EndDialog(hWnd, false); + break; + } + + return 0; +} + +// Display the SSL related dialog +void SmSslDlg(HWND hWnd, SM_SERVER *p) +{ + SM_SSL s; + // Validate arguments + if (hWnd == NULL || p == NULL) + { + return; + } + + Zero(&s, sizeof(s)); + s.p = p; + + Dialog(hWnd, D_SM_SSL, SmSslDlgProc, &s); + + // Cleanup + FreeX(s.Cert); + FreeK(s.Key); +} + +// Listener creation dialog procedure +UINT SmCreateListenerDlgProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param) +{ + UINT port; + RPC_LISTENER t; + SM_SERVER *p = (SM_SERVER *)param; + // Validate arguments + if (hWnd == NULL) + { + return 0; + } + + switch (msg) + { + case WM_INITDIALOG: + Focus(hWnd, E_PORT); + Disable(hWnd, IDOK); + break; + + case WM_COMMAND: + switch (LOWORD(wParam)) + { + case E_PORT: + port = GetInt(hWnd, E_PORT); + if (port == 0 || port >= 65536) + { + Disable(hWnd, IDOK); + } + else + { + Enable(hWnd, IDOK); + } + break; + } + + switch (wParam) + { + case IDOK: + port = GetInt(hWnd, E_PORT); + Zero(&t, sizeof(t)); + t.Enable = true; + t.Port = port; + if (CALL(hWnd, ScCreateListener(p->Rpc, &t))) + { + EndDialog(hWnd, true); + } + break; + case IDCANCEL: + Close(hWnd); + } + break; + + case WM_CLOSE: + EndDialog(hWnd, false); + break; + } + + return 0; +} + +// Listener creation dialog +bool SmCreateListenerDlg(HWND hWnd, SM_SERVER *p) +{ + // Validate arguments + if (hWnd == NULL || p == NULL) + { + return false; + } + + return Dialog(hWnd, D_SM_CREATE_LISTENER, SmCreateListenerDlgProc, p); +} + +// HUB edit OK button +void SmEditHubOnOk(HWND hWnd, SM_EDIT_HUB *s) +{ + RPC_CREATE_HUB t; + char pass1[MAX_SIZE]; + char pass2[MAX_SIZE]; + char hubname[MAX_HUBNAME_LEN + 1]; + // Validate arguments + if (hWnd == NULL || s == NULL) + { + return; + } + + Zero(&t, sizeof(t)); + if (s->EditMode) + { + StrCpy(hubname, sizeof(hubname), s->HubName); + StrCpy(t.HubName, sizeof(t.HubName), s->HubName); + } + else + { + GetTxtA(hWnd, E_HUBNAME, t.HubName, sizeof(t.HubName)); + StrCpy(hubname, sizeof(hubname), t.HubName); + } + + GetTxtA(hWnd, E_PASSWORD1, pass1, sizeof(pass1)); + GetTxtA(hWnd, E_PASSWORD2, pass2, sizeof(pass2)); + + if (s->EditMode == false || StrCmp(pass1, HIDDEN_PASSWORD) != 0) + { + Sha0(t.HashedPassword, pass1, StrLen(pass1)); + HashPassword(t.SecurePassword, ADMINISTRATOR_USERNAME, pass1); + } + + if (IsChecked(hWnd, R_LIMIT_MAX_SESSION)) + { + t.HubOption.MaxSession = GetInt(hWnd, E_MAX_SESSION); + } + + t.Online = IsChecked(hWnd, R_ONLINE); + + if (s->p->ServerType == SERVER_TYPE_FARM_CONTROLLER) + { + t.HubType = HUB_TYPE_FARM_STATIC; + if (IsChecked(hWnd, R_DYNAMIC)) + { + t.HubType = HUB_TYPE_FARM_DYNAMIC; + } + } + + t.HubOption.NoEnum = IsChecked(hWnd, R_NO_ENUM); + + if (s->EditMode == false) + { + if (CALL(hWnd, ScCreateHub(s->p->Rpc, &t))) + { + MsgBoxEx(hWnd, MB_ICONINFORMATION, _UU("CM_EDIT_HUB_CREATED"), hubname); + EndDialog(hWnd, true); + } + } + else + { + if (CALL(hWnd, ScSetHub(s->p->Rpc, &t))) + { + EndDialog(hWnd, true); + } + } +} + +// HUB editing update +void SmEditHubUpdate(HWND hWnd, SM_EDIT_HUB *s) +{ + bool ok = true; + char *s1, *s2; + char hubname[MAX_HUBNAME_LEN + 1]; + // Validate arguments + if (hWnd == NULL || s == NULL) + { + return; + } + + s1 = GetTextA(hWnd, E_PASSWORD1); + s2 = GetTextA(hWnd, E_PASSWORD2); + if (StrCmp(s1, s2) != 0) + { + ok = false; + } + Free(s1); + Free(s2); + + GetTxtA(hWnd, E_HUBNAME, hubname, sizeof(hubname)); + Trim(hubname); + if (StrLen(hubname) == 0 || + IsSafeStr(hubname) == false) + { + ok = false; + } + + if (IsChecked(hWnd, R_LIMIT_MAX_SESSION)) + { + Enable(hWnd, E_MAX_SESSION); + Enable(hWnd, S_MAX_SESSION_1); + Enable(hWnd, S_MAX_SESSION_2); + if (GetInt(hWnd, E_MAX_SESSION) == 0) + { + ok = false; + } + } + else + { + Disable(hWnd, E_MAX_SESSION); + Disable(hWnd, S_MAX_SESSION_1); + Disable(hWnd, S_MAX_SESSION_2); + } + + SetEnable(hWnd, IDOK, ok); +} + +// HUB editing initialization +void SmEditHubInit(HWND hWnd, SM_EDIT_HUB *s) +{ + RPC_CREATE_HUB t; + bool b = false; + bool support_extoption = false; + // Validate arguments + if (hWnd == NULL || s == NULL) + { + return; + } + + SetIcon(hWnd, 0, ICO_HUB); + + Zero(&t, sizeof(t)); + + if (s->EditMode == false) + { + // Create new + SetText(hWnd, 0, _UU("CM_EDIT_HUB_1")); + FocusEx(hWnd, E_HUBNAME); + + if (s->p->ServerType == SERVER_TYPE_STANDALONE) + { + // Stand-alone mode + Disable(hWnd, R_STATIC); + Disable(hWnd, R_DYNAMIC); + SetText(hWnd, S_FARM_INFO, _UU("CM_EDIT_HUB_STANDALONE")); + } + else + { + Check(hWnd, R_STATIC, true); + } + + Check(hWnd, R_ONLINE, true); + + Hide(hWnd, B_ACL); + Hide(hWnd, S_ACL); + Hide(hWnd, S_ACL_2); + Hide(hWnd, S_ACL_3); + Hide(hWnd, S_MSG_1); + Hide(hWnd, S_MSG_4); + Hide(hWnd, S_MSG_2); + Hide(hWnd, B_MSG); + } + else + { + // Edit + wchar_t tmp[MAX_SIZE]; + UniFormat(tmp, sizeof(tmp), _UU("CM_EDIT_HUB_2"), s->HubName); + SetText(hWnd, 0, tmp); + SetTextA(hWnd, E_HUBNAME, s->HubName); + Disable(hWnd, E_HUBNAME); + + if (s->p->ServerType == SERVER_TYPE_STANDALONE) + { + // Stand-alone mode + Disable(hWnd, R_STATIC); + Disable(hWnd, R_DYNAMIC); + SetText(hWnd, S_FARM_INFO, _UU("CM_EDIT_HUB_STANDALONE")); + } + + if (s->p->ServerType == SERVER_TYPE_FARM_CONTROLLER) + { + // Controller + if (GetCapsBool(s->p->CapsList, "b_cluster_hub_type_fixed")) + { + Disable(hWnd, R_STATIC); + Disable(hWnd, R_DYNAMIC); + SetText(hWnd, S_FARM_INFO, _UU("CM_EDIT_HUB_TYPE_FIXED")); + } + } + + // Get the HUB information + StrCpy(t.HubName, sizeof(t.HubName), s->HubName); + if (CALL(hWnd, ScGetHub(s->p->Rpc, &t)) == false) + { + EndDialog(hWnd, false); + return; + } + + SetTextA(hWnd, E_PASSWORD1, HIDDEN_PASSWORD); + SetTextA(hWnd, E_PASSWORD2, HIDDEN_PASSWORD); + + if (t.HubOption.MaxSession == 0) + { + Check(hWnd, R_LIMIT_MAX_SESSION, false); + } + else + { + Check(hWnd, R_LIMIT_MAX_SESSION, true); + } + + Check(hWnd, R_NO_ENUM, t.HubOption.NoEnum); + + SetIntEx(hWnd, E_MAX_SESSION, t.HubOption.MaxSession); + + Check(hWnd, R_ONLINE, t.Online); + Check(hWnd, R_OFFLINE, t.Online ? false : true); + + Check(hWnd, R_STATIC, t.HubType == HUB_TYPE_FARM_STATIC); + Check(hWnd, R_DYNAMIC, t.HubType == HUB_TYPE_FARM_DYNAMIC); + + SetShow(hWnd, B_ACL, GetCapsBool(s->p->CapsList, "b_support_ac")); + SetShow(hWnd, S_ACL, GetCapsBool(s->p->CapsList, "b_support_ac")); + SetShow(hWnd, S_ACL_2, GetCapsBool(s->p->CapsList, "b_support_ac")); + SetShow(hWnd, S_ACL_3, GetCapsBool(s->p->CapsList, "b_support_ac")); + + SetShow(hWnd, S_MSG_1, GetCapsBool(s->p->CapsList, "b_support_msg")); + SetShow(hWnd, S_MSG_4, GetCapsBool(s->p->CapsList, "b_support_msg")); + SetShow(hWnd, S_MSG_2, GetCapsBool(s->p->CapsList, "b_support_msg")); + SetShow(hWnd, B_MSG, GetCapsBool(s->p->CapsList, "b_support_msg")); + } + + // Advanced options + if (s->EditMode) + { + support_extoption = GetCapsBool(s->p->CapsList, "b_support_hub_ext_options"); + } + + SetEnable(hWnd, S_STATIC, support_extoption); + SetEnable(hWnd, B_EXTOPTION, support_extoption); + + SetEnable(hWnd, R_NO_ENUM, GetCapsBool(s->p->CapsList, "b_support_hide_hub")); + + SmEditHubUpdate(hWnd, s); + + if (s->EditMode) + { + Focus(hWnd, IDOK); + } + + if (s->EditMode) + { + if (GetCapsBool(s->p->CapsList, "b_support_hub_admin_option")) + { + b = true; + } + } + + SetShow(hWnd, S_AO_1, b); + SetShow(hWnd, S_AO_2, b); + SetShow(hWnd, S_AO_3, b); + SetShow(hWnd, B_ADMINOPTION, b); +} + +// HUB edit procedure +UINT SmEditHubProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param) +{ + SM_EDIT_HUB *s = (SM_EDIT_HUB *)param; + // Validate arguments + if (hWnd == NULL) + { + return 0; + } + + switch (msg) + { + case WM_INITDIALOG: + SmEditHubInit(hWnd, s); + break; + + case WM_COMMAND: + switch (LOWORD(wParam)) + { + case E_PASSWORD1: + case E_PASSWORD2: + case E_HUBNAME: + case R_LIMIT_MAX_SESSION: + case E_MAX_SESSION: + SmEditHubUpdate(hWnd, s); + break; + } + + switch (wParam) + { + case IDOK: + SmEditHubOnOk(hWnd, s); + break; + + case IDCANCEL: + Close(hWnd); + break; + + case R_LIMIT_MAX_SESSION: + if (IsChecked(hWnd, R_LIMIT_MAX_SESSION)) + { + FocusEx(hWnd, E_MAX_SESSION); + } + break; + + case B_ADMINOPTION: + SmHubAdminOption(hWnd, s); + break; + + case B_EXTOPTION: + SmHubExtOption(hWnd, s); + break; + + case B_ACL: + SmHubAc(hWnd, s); + break; + + case B_MSG: + SmHubMsg(hWnd, s); + break; + } + break; + + case WM_CLOSE: + EndDialog(hWnd, false); + break; + } + + return 0; +} + +// HUB edit dialog +bool SmEditHubDlg(HWND hWnd, SM_SERVER *p, char *hubname) +{ + SM_EDIT_HUB s; + // Validate arguments + if (hWnd == NULL || p == NULL) + { + return false; + } + + Zero(&s, sizeof(s)); + s.p = p; + s.EditMode = true; + StrCpy(s.HubName, sizeof(s.HubName), hubname); + + if (p->Bridge == false) + { + return Dialog(hWnd, D_SM_EDIT_HUB, SmEditHubProc, &s); + } + else + { + SmHubExtOption(hWnd, &s); + return false; + } +} + +// HUB creation dialog +bool SmCreateHubDlg(HWND hWnd, SM_SERVER *p) +{ + SM_EDIT_HUB s; + // Validate arguments + if (hWnd == NULL || p == NULL) + { + return false; + } + + Zero(&s, sizeof(s)); + s.p = p; + s.EditMode = false; + + return Dialog(hWnd, D_SM_EDIT_HUB, SmEditHubProc, &s); +} + +// Display the status of the virtual HUB +bool SmRefreshHubStatus(HWND hWnd, SM_SERVER *p, void *param) +{ + RPC_HUB_STATUS t; + // Validate arguments + if (hWnd == NULL || p == NULL || param == NULL) + { + return false; + } + + Zero(&t, sizeof(RPC_HUB_STATUS)); + StrCpy(t.HubName, sizeof(t.HubName), (char *)param); + if (CALL(hWnd, ScGetHubStatus(p->Rpc, &t))) + { + wchar_t *s; + wchar_t tmp[MAX_SIZE]; + LVB *b = LvInsertStart(); + + // HUB name + s = CopyStrToUni((char *)param); + LvInsertAdd(b, ICO_HUB, 0, 2, _UU("SM_HUB_STATUS_HUBNAME"), s); + Free(s); + + // Online + LvInsertAdd(b, t.Online ? ICO_PROTOCOL : ICO_PROTOCOL_X, 0, 2, _UU("SM_HUB_STATUS_ONLINE"), + t.Online ? _UU("SM_HUB_ONLINE") : _UU("SM_HUB_OFFLINE")); + + // Type of HUB + LvInsertAdd(b, t.HubType == HUB_TYPE_STANDALONE ? ICO_TOWER : ICO_FARM, 0, 2, _UU("SM_HUB_TYPE"), + GetHubTypeStr(t.HubType)); + + if (t.HubType == HUB_TYPE_STANDALONE) + { + // Enable / Disable the SecureNAT + LvInsertAdd(b, ICO_ROUTER, NULL, 2, _UU("SM_HUB_SECURE_NAT"), + t.SecureNATEnabled ? _UU("SM_HUB_SECURE_NAT_YES") : _UU("SM_HUB_SECURE_NAT_NO")); + } + + // Other values + UniToStru(tmp, t.NumSessions); + LvInsertAdd(b, ICO_PROTOCOL, 0, 2, _UU("SM_HUB_NUM_SESSIONS"), tmp); + if (t.NumSessionsClient != 0 || t.NumSessionsBridge != 0) + { + UniToStru(tmp, t.NumSessionsClient); + LvInsertAdd(b, ICO_PROTOCOL, 0, 2, _UU("SM_HUB_NUM_SESSIONS_CLIENT"), tmp); + UniToStru(tmp, t.NumSessionsBridge); + LvInsertAdd(b, ICO_PROTOCOL, 0, 2, _UU("SM_HUB_NUM_SESSIONS_BRIDGE"), tmp); + } + + UniToStru(tmp, t.NumAccessLists); + LvInsertAdd(b, ICO_DISCARD, 0, 2, _UU("SM_HUB_NUM_ACCESSES"), tmp); + + if (p->ServerType != SERVER_TYPE_FARM_MEMBER) + { + UniToStru(tmp, t.NumUsers); + LvInsertAdd(b, ICO_USER, 0, 2, _UU("SM_HUB_NUM_USERS"), tmp); + UniToStru(tmp, t.NumGroups); + LvInsertAdd(b, ICO_GROUP, 0, 2, _UU("SM_HUB_NUM_GROUPS"), tmp); + } + + UniToStru(tmp, t.NumMacTables); + LvInsertAdd(b, ICO_MACHINE, 0, 2, _UU("SM_HUB_NUM_MAC_TABLES"), tmp); + UniToStru(tmp, t.NumIpTables); + LvInsertAdd(b, ICO_MACHINE, 0, 2, _UU("SM_HUB_NUM_IP_TABLES"), tmp); + + // Usage status + UniToStru(tmp, t.NumLogin); + LvInsertAdd(b, ICO_KEY, NULL, 2, _UU("SM_HUB_NUM_LOGIN"), tmp); + + if (t.LastLoginTime != 0) + { + GetDateTimeStr64Uni(tmp, sizeof(tmp), SystemToLocal64(t.LastLoginTime)); + } + else + { + UniStrCpy(tmp, sizeof(tmp), _UU("COMMON_UNKNOWN")); + } + LvInsertAdd(b, ICO_DATETIME, NULL, 2, _UU("SM_HUB_LAST_LOGIN_TIME"), tmp); + + if (t.LastCommTime != 0) + { + GetDateTimeStr64Uni(tmp, sizeof(tmp), SystemToLocal64(t.LastCommTime)); + } + else + { + UniStrCpy(tmp, sizeof(tmp), _UU("COMMON_UNKNOWN")); + } + LvInsertAdd(b, ICO_DATETIME, NULL, 2, _UU("SM_HUB_LAST_COMM_TIME"), tmp); + + if (t.CreatedTime != 0) + { + GetDateTimeStr64Uni(tmp, sizeof(tmp), SystemToLocal64(t.CreatedTime)); + } + else + { + UniStrCpy(tmp, sizeof(tmp), _UU("COMMON_UNKNOWN")); + } + LvInsertAdd(b, ICO_DATETIME, NULL, 2, _UU("SM_HUB_CREATED_TIME"), tmp); + + // Traffic information + SmInsertTrafficInfo(b, &t.Traffic); + + LvInsertEnd(b, hWnd, L_STATUS); + } + else + { + return false; + } + + return true; +} + +// Add a traffic information to LVB +void SmInsertTrafficInfo(LVB *b, TRAFFIC *t) +{ + wchar_t tmp[MAX_SIZE]; + char vv[128]; + // Validate arguments + if (b == NULL || t == NULL) + { + return; + } + + // Transmission information + ToStr3(vv, sizeof(vv), t->Send.UnicastCount); + UniFormat(tmp, sizeof(tmp), _UU("SM_ST_NUM_PACKET_STR"), vv); + LvInsertAdd(b, ICO_INFORMATION, 0, 2, _UU("SM_ST_SEND_UCAST_NUM"), tmp); + + ToStr3(vv, sizeof(vv), t->Send.UnicastBytes); + UniFormat(tmp, sizeof(tmp), _UU("SM_ST_SIZE_BYTE_STR"), vv); + LvInsertAdd(b, ICO_INFORMATION, 0, 2, _UU("SM_ST_SEND_UCAST_SIZE"), tmp); + + ToStr3(vv, sizeof(vv), t->Send.BroadcastCount); + UniFormat(tmp, sizeof(tmp), _UU("SM_ST_NUM_PACKET_STR"), vv); + LvInsertAdd(b, ICO_INFORMATION, 0, 2, _UU("SM_ST_SEND_BCAST_NUM"), tmp); + + ToStr3(vv, sizeof(vv), t->Send.BroadcastBytes); + UniFormat(tmp, sizeof(tmp), _UU("SM_ST_SIZE_BYTE_STR"), vv); + LvInsertAdd(b, ICO_INFORMATION, 0, 2, _UU("SM_ST_SEND_BCAST_SIZE"), tmp); + + // Reception information + ToStr3(vv, sizeof(vv), t->Recv.UnicastCount); + UniFormat(tmp, sizeof(tmp), _UU("SM_ST_NUM_PACKET_STR"), vv); + LvInsertAdd(b, ICO_INFORMATION, 0, 2, _UU("SM_ST_RECV_UCAST_NUM"), tmp); + + ToStr3(vv, sizeof(vv), t->Recv.UnicastBytes); + UniFormat(tmp, sizeof(tmp), _UU("SM_ST_SIZE_BYTE_STR"), vv); + LvInsertAdd(b, ICO_INFORMATION, 0, 2, _UU("SM_ST_RECV_UCAST_SIZE"), tmp); + + ToStr3(vv, sizeof(vv), t->Recv.BroadcastCount); + UniFormat(tmp, sizeof(tmp), _UU("SM_ST_NUM_PACKET_STR"), vv); + LvInsertAdd(b, ICO_INFORMATION, 0, 2, _UU("SM_ST_RECV_BCAST_NUM"), tmp); + + ToStr3(vv, sizeof(vv), t->Recv.BroadcastBytes); + UniFormat(tmp, sizeof(tmp), _UU("SM_ST_SIZE_BYTE_STR"), vv); + LvInsertAdd(b, ICO_INFORMATION, 0, 2, _UU("SM_ST_RECV_BCAST_SIZE"), tmp); +} + +// Status display dialog procedure +UINT SmStatusDlgProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param) +{ + SM_STATUS *s = (SM_STATUS *)param; + // Validate arguments + if (hWnd == NULL) + { + return 0; + } + + switch (msg) + { + case WM_INITDIALOG: + // Initialize + LvInitEx(hWnd, L_STATUS, s->NoImage); + LvSetStyle(hWnd, L_STATUS, LVS_EX_GRIDLINES); + SetIcon(hWnd, 0, s->Icon); + SetIcon(hWnd, S_ICON, s->Icon); + SetText(hWnd, 0, s->Caption); + SetText(hWnd, S_TITLE, s->Caption); + DlgFont(hWnd, S_TITLE, 15, true); + if (s->InitProc != NULL) + { + s->InitProc(hWnd, s->p, s->Param); + } + else + { + // Initialize the column + LvInsertColumn(hWnd, L_STATUS, 0, _UU("SM_STATUS_COLUMN_1"), 0); + LvInsertColumn(hWnd, L_STATUS, 1, _UU("SM_STATUS_COLUMN_2"), 0); + } + if (s->RefreshProc(hWnd, s->p, s->Param) == false) + { + Close(hWnd); + } + LvAutoSize(hWnd, L_STATUS); + Focus(hWnd, L_STATUS); + + if (s->show_refresh_button == false) + { + Hide(hWnd, IDOK); + } + + break; + + case WM_COMMAND: + switch (wParam) + { + case IDOK: + // Update + if (s->RefreshProc(hWnd, s->p, s->Param) == false) + { + Close(hWnd); + } + LvAutoSize(hWnd, L_STATUS); + break; + + case IDCANCEL: + Close(hWnd); + break; + } + break; + + case WM_CLOSE: + EndDialog(hWnd, 0); + break; + } + + LvStandardHandler(hWnd, msg, wParam, lParam, L_STATUS); + + return 0; +} + +// Status display dialog +void SmStatusDlg(HWND hWnd, SM_SERVER *p, void *param, bool no_image, bool show_refresh_button, wchar_t *caption, UINT icon, + SM_STATUS_INIT_PROC *init, SM_STATUS_REFRESH_PROC *refresh) +{ + SM_STATUS s; + // Validate arguments + if (hWnd == NULL || p == NULL || refresh == NULL) + { + return; + } + + if (icon == 0) + { + icon = ICO_INFORMATION; + } + if (caption == NULL) + { + caption = _UU("SM_INFORMATION"); + } + + Zero(&s, sizeof(s)); + s.show_refresh_button = show_refresh_button; + s.p = p; + s.NoImage = no_image; + s.Param = param; + s.Icon = icon; + s.Caption = caption; + s.InitProc = init; + s.RefreshProc = refresh; + + Dialog(hWnd, D_SM_STATUS, SmStatusDlgProc, &s); +} + +// Server management dialog update +void SmServerDlgUpdate(HWND hWnd, SM_SERVER *p) +{ + bool hub_selected = false; + bool hub_selected_online = false; + bool hub_selected_offline = false; + bool hub_have_admin_right = false; + bool listener_selected = false; + bool listener_selected_enabled = false; + bool listener_selected_disabled = false; + bool two_or_more_listener = false; + bool bridge; + UINT i; + // Validate arguments + if (hWnd == NULL || p == NULL) + { + return; + } + + bridge = GetCapsBool(p->CapsList, "b_bridge"); + + hub_selected = LvIsSelected(hWnd, L_HUB); + + if (hub_selected) + { + if (p->ServerAdminMode) + { + hub_have_admin_right = true; + } + i = LvGetSelected(hWnd, L_HUB); + if (i != INFINITE) + { + wchar_t *s = LvGetStr(hWnd, L_HUB, i, 1); + if (p->ServerAdminMode == false) + { + char *hubname = LvGetStrA(hWnd, L_HUB, i, 0); + if (hubname != NULL) + { + if (StrCmpi(hubname, p->HubName) == 0) + { + hub_have_admin_right = true; + } + Free(hubname); + } + } + hub_selected_online = (UniStrCmpi(s, _UU("SM_HUB_ONLINE")) == 0); + hub_selected_offline = hub_selected_online ? false : true; + Free(s); + } + } + + listener_selected = LvIsSelected(hWnd, L_LISTENER); + if (listener_selected) + { + wchar_t *s = LvGetSelectedStr(hWnd, L_LISTENER, 1); + if (UniStrCmpi(s, _UU("CM_LISTENER_OFFLINE")) == 0) + { + listener_selected_disabled = true; + } + else + { + listener_selected_enabled = true; + } + Free(s); + } + + if (LvNum(hWnd, L_LISTENER) >= 2) + { + two_or_more_listener = true; + } + + SetEnable(hWnd, IDOK, bridge || (hub_selected && hub_have_admin_right)); + SetEnable(hWnd, B_ONLINE, bridge == false && hub_selected_offline && hub_have_admin_right && p->ServerType != SERVER_TYPE_FARM_MEMBER); + SetEnable(hWnd, B_OFFLINE, bridge == false && hub_selected_online && hub_have_admin_right && p->ServerType != SERVER_TYPE_FARM_MEMBER); + SetEnable(hWnd, B_HUB_STATUS, hub_selected && hub_have_admin_right); + SetEnable(hWnd, B_DELETE, bridge == false && hub_selected && p->ServerAdminMode && p->ServerType != SERVER_TYPE_FARM_MEMBER); + SetEnable(hWnd, B_EDIT, hub_selected && hub_have_admin_right && p->ServerType != SERVER_TYPE_FARM_MEMBER); + SetEnable(hWnd, B_CREATE, bridge == false && p->ServerAdminMode && p->ServerType != SERVER_TYPE_FARM_MEMBER); + + SetEnable(hWnd, B_CREATE_LISTENER, p->ServerAdminMode); + SetEnable(hWnd, B_DELETE_LISTENER, p->ServerAdminMode && listener_selected && two_or_more_listener); + SetEnable(hWnd, B_START, p->ServerAdminMode && listener_selected_disabled); + SetEnable(hWnd, B_STOP, p->ServerAdminMode && listener_selected_enabled); + SetEnable(hWnd, B_FARM, GetCapsBool(p->CapsList, "b_support_cluster") && p->ServerAdminMode && GetCapsBool(p->CapsList, "b_support_vgs_in_client") == false); + SetEnable(hWnd, B_FARM_STATUS, GetCapsBool(p->CapsList, "b_support_cluster") && p->ServerType != SERVER_TYPE_STANDALONE); +} + +// Server management dialog initialization +void SmServerDlgInit(HWND hWnd, SM_SERVER *p) +{ + // Validate arguments + if (hWnd == NULL || p == NULL) + { + return; + } + + // Initialize the column + LvInit(hWnd, L_HUB); + LvSetStyle(hWnd, L_HUB, LVS_EX_GRIDLINES); + LvInsertColumn(hWnd, L_HUB, 0, _UU("SM_HUB_COLUMN_1"), 150); + LvInsertColumn(hWnd, L_HUB, 1, _UU("SM_HUB_COLUMN_2"), 80); + LvInsertColumn(hWnd, L_HUB, 2, _UU("SM_HUB_COLUMN_3"), 80); + LvInsertColumn(hWnd, L_HUB, 3, _UU("SM_HUB_COLUMN_4"), 80); + LvInsertColumn(hWnd, L_HUB, 4, _UU("SM_HUB_COLUMN_5"), 80); + LvInsertColumn(hWnd, L_HUB, 5, _UU("SM_HUB_COLUMN_6"), 80); + LvInsertColumn(hWnd, L_HUB, 6, _UU("SM_HUB_COLUMN_7"), 80); + LvInsertColumn(hWnd, L_HUB, 7, _UU("SM_HUB_COLUMN_8"), 80); + LvInsertColumn(hWnd, L_HUB, 8, _UU("SM_HUB_COLUMN_9"), 80); + LvInsertColumn(hWnd, L_HUB, 9, _UU("SM_HUB_COLUMN_10"), 120); + LvInsertColumn(hWnd, L_HUB, 10, _UU("SM_HUB_COLUMN_11"), 120); + LvInsertColumn(hWnd, L_HUB, 11, _UU("SM_SESS_COLUMN_6"), 100); + LvInsertColumn(hWnd, L_HUB, 12, _UU("SM_SESS_COLUMN_7"), 100); + + LvInit(hWnd, L_LISTENER); + LvSetStyle(hWnd, L_LISTENER, LVS_EX_GRIDLINES); + LvInsertColumn(hWnd, L_LISTENER, 0, _UU("CM_LISTENER_COLUMN_1"), 90); + LvInsertColumn(hWnd, L_LISTENER, 1, _UU("CM_LISTENER_COLUMN_2"), 80); + + SmServerDlgRefresh(hWnd, p); + + if (p->ServerAdminMode == false) + { + // Select the target HUB in the case of the Virtual HUB management mode + wchar_t *s = CopyStrToUni(p->HubName); + LvSelect(hWnd, L_HUB, LvSearchStr(hWnd, L_HUB, 0, s)); + Free(s); + } + else + { + // In the case of whole server management mode + UINT num_hubs = LvNum(hWnd, L_HUB); + + if (num_hubs == 1) + { + // Select the Virtual HUB if Virtual HUB exists only one + LvSelect(hWnd, L_HUB, 0); + } + else + { + // Select the Virtual HUB the last selected if there are some virtual HUBs + char tmp[MAX_SIZE]; + char *hubname; + + Format(tmp, sizeof(tmp), "%s:%u:%s", p->CurrentSetting->ClientOption.Hostname, + p->CurrentSetting->ClientOption.Port, + p->CurrentSetting->ServerAdminMode ? "" : p->CurrentSetting->HubName); + + hubname = MsRegReadStr(REG_CURRENT_USER, SM_LASTHUB_REG_KEY, tmp); + + if (IsEmptyStr(hubname) == false) + { + LvSelect(hWnd, L_HUB, LvSearchStrA(hWnd, L_HUB, 0, hubname)); + } + + Free(hubname); + } + } + + Focus(hWnd, L_HUB); + + SmServerDlgUpdate(hWnd, p); + + if (GetCapsBool(p->CapsList, "b_bridge")) + { + Disable(hWnd, L_HUB); + } + + // Enable Local bridge button, etc. in the case of the Admin of the Server + SetEnable(hWnd, B_BRIDGE, GetCapsBool(p->CapsList, "b_local_bridge") && p->ServerAdminMode && GetCapsBool(p->CapsList, "b_support_vgs_in_client") == false); + SetEnable(hWnd, B_CONNECTION, p->ServerAdminMode); + + // Config R/W button + SetEnable(hWnd, B_CONFIG, GetCapsBool(p->CapsList, "b_support_config_rw") && p->ServerAdminMode && GetCapsBool(p->CapsList, "b_support_vgs_in_client") == false); + + // Layer 3 button + SetEnable(hWnd, B_L3, GetCapsBool(p->CapsList, "b_support_layer3") && p->ServerAdminMode && GetCapsBool(p->CapsList, "b_support_vgs_in_client") == false); + + // License button + SetShow(hWnd, B_LICENSE, GetCapsBool(p->CapsList, "b_support_license") && p->ServerAdminMode); + SetShow(hWnd, S_LICENSE, GetCapsBool(p->CapsList, "b_support_license") && p->ServerAdminMode); + SetShow(hWnd, S_BETA, GetCapsBool(p->CapsList, "b_beta_version") && (IsShow(hWnd, B_LICENSE) == false)); + + // IPsec button + SetEnable(hWnd, B_IPSEC, GetCapsBool(p->CapsList, "b_support_ipsec") && p->ServerAdminMode); + + // OpenVPN, SSTP button + SetEnable(hWnd, B_OPENVPN, GetCapsBool(p->CapsList, "b_support_openvpn") && p->ServerAdminMode); + + // DDNS button + SetEnable(hWnd, B_DDNS, GetCapsBool(p->CapsList, "b_support_ddns") && p->ServerAdminMode); + + // VPN Azure button + SetEnable(hWnd, B_AZURE, GetCapsBool(p->CapsList, "b_support_azure") && p->ServerAdminMode); + + DlgFont(hWnd, S_BETA, 12, false); + SetFont(hWnd, E_DDNS_HOST, GetFont("Verdana", 10, false, false, false, false)); + SetFont(hWnd, E_AZURE_HOST, GetFont("Verdana", 10, false, false, false, false)); + + SetShow(hWnd, B_VPNGATE, false); + SetShow(hWnd, S_ICO_VPNGATE, false); + + DlgFont(hWnd, IDOK, 0, true); +} + +// Server management dialog update +void SmServerDlgRefresh(HWND hWnd, SM_SERVER *p) +{ + RPC_ENUM_HUB t; + RPC_LISTENER_LIST t2; + RPC_PORTS t3; + DDNS_CLIENT_STATUS st; + RPC_AZURE_STATUS sta; + UINT i; + // Validate arguments + if (hWnd == NULL || p == NULL) + { + return; + } + + // Virtual HUB list update + Zero(&t, sizeof(t)); + if (CALL(hWnd, ScEnumHub(p->Rpc, &t))) + { + LVB *b = LvInsertStart(); + for (i = 0;i < t.NumHub;i++) + { + RPC_ENUM_HUB_ITEM *e = &t.Hubs[i]; + wchar_t name[MAX_HUBNAME_LEN + 1]; + wchar_t s1[64], s2[64], s3[64], s4[64], s5[64]; + wchar_t s6[64], s7[128], s8[128]; + wchar_t s9[64], s10[64]; + UINT icon; + + UniToStru(s1, e->NumUsers); + UniToStru(s2, e->NumGroups); + UniToStru(s3, e->NumSessions); + UniToStru(s4, e->NumMacTables); + UniToStru(s5, e->NumIpTables); + + UniToStru(s6, e->NumLogin); + + if (e->LastLoginTime != 0) + { + GetDateTimeStr64Uni(s7, sizeof(s7), SystemToLocal64(e->LastLoginTime)); + } + else + { + UniStrCpy(s7, sizeof(s7), _UU("COMMON_UNKNOWN")); + } + + if (e->LastCommTime != 0) + { + GetDateTimeStr64Uni(s8, sizeof(s8), SystemToLocal64(e->LastCommTime)); + } + else + { + UniStrCpy(s8, sizeof(s8), _UU("COMMON_UNKNOWN")); + } + + StrToUni(name, sizeof(name), e->HubName); + + icon = ICO_HUB; + if (e->Online == false) + { + icon = ICO_HUB_OFFLINE; + } + + if (e->IsTrafficFilled == false) + { + UniStrCpy(s9, sizeof(s9), _UU("CM_ST_NONE")); + UniStrCpy(s10, sizeof(s10), _UU("CM_ST_NONE")); + } + else + { + UniToStr3(s9, sizeof(s9), + e->Traffic.Recv.BroadcastBytes + e->Traffic.Recv.UnicastBytes + + e->Traffic.Send.BroadcastBytes + e->Traffic.Send.UnicastBytes); + + UniToStr3(s10, sizeof(s10), + e->Traffic.Recv.BroadcastCount + e->Traffic.Recv.UnicastCount + + e->Traffic.Send.BroadcastCount + e->Traffic.Send.UnicastCount); + } + + LvInsertAdd(b, + icon, + NULL, + 13, + name, + e->Online ? _UU("SM_HUB_ONLINE") : _UU("SM_HUB_OFFLINE"), + GetHubTypeStr(e->HubType), + s1, s2, s3, s4, s5, s6, s7, s8, s9, s10); + } + LvInsertEnd(b, hWnd, L_HUB); + FreeRpcEnumHub(&t); + } + + // Listener list update + Zero(&t2, sizeof(RPC_LISTENER_LIST)); + if (CALL(hWnd, ScEnumListener(p->Rpc, &t2))) + { + LVB *b = LvInsertStart(); + for (i = 0;i < t2.NumPort;i++) + { + wchar_t tmp[MAX_SIZE]; + wchar_t *status; + UINT icon; + UniFormat(tmp, sizeof(tmp), _UU("CM_LISTENER_TCP_PORT"), t2.Ports[i]); + + status = _UU("CM_LISTENER_ONLINE"); + icon = ICO_PROTOCOL; + if (t2.Errors[i]) + { + status = _UU("CM_LISTENER_ERROR"); + icon = ICO_PROTOCOL_X; + } + else if (t2.Enables[i] == false) + { + status = _UU("CM_LISTENER_OFFLINE"); + icon = ICO_PROTOCOL_OFFLINE; + } + + LvInsertAdd(b, icon, (void *)t2.Ports[i], 2, tmp, status); + } + LvInsertEnd(b, hWnd, L_LISTENER); + FreeRpcListenerList(&t2); + } + + // Get the UDP ports + Zero(&t3, sizeof(RPC_PORTS)); + if (CALL(hWnd, ScGetPortsUDP(p->Rpc, &t3))) + { + char str[MAX_SIZE]; + + Zero(str, sizeof(str)); + + if (t3.Num > 0) + { + UINT i; + + Format(str, sizeof(str), "%u", t3.Ports[0]); + + for (i = 1; i < t3.Num; ++i) + { + char tmp[MAX_SIZE]; + Format(tmp, sizeof(tmp), ", %u", t3.Ports[i]); + StrCat(str, sizeof(str), tmp); + } + } + + SetTextA(hWnd, E_UDP, str); + FreeRpcPorts(&t3); + } + + // Get the DDNS client state + Zero(&st, sizeof(st)); + if (ScGetDDnsClientStatus(p->Rpc, &st) == ERR_NO_ERROR && IsEmptyStr(st.CurrentFqdn) == false) + { + SetTextA(hWnd, E_DDNS_HOST, st.CurrentFqdn); + + Show(hWnd, S_DDNS); + Show(hWnd, E_DDNS_HOST); + } + else + { + Hide(hWnd, S_DDNS); + Hide(hWnd, E_DDNS_HOST); + } + + // VPN Azure client state acquisition + Zero(&sta, sizeof(sta)); + if (ScGetAzureStatus(p->Rpc, &sta) == ERR_NO_ERROR && sta.IsEnabled && IsEmptyStr(st.CurrentFqdn) == false) + { + char tmp[MAX_SIZE]; + + StrCpy(tmp, sizeof(tmp), st.CurrentHostName); + StrCat(tmp, sizeof(tmp), AZURE_DOMAIN_SUFFIX); + + SetTextA(hWnd, E_AZURE_HOST, tmp); + + Show(hWnd, S_AZURE); + Show(hWnd, E_AZURE_HOST); + } + else + { + Hide(hWnd, S_AZURE); + Hide(hWnd, E_AZURE_HOST); + } + + SmServerDlgUpdate(hWnd, p); +} + +// Server management dialog procedure +UINT SmServerDlgProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param) +{ + SM_SERVER *p = (SM_SERVER *)param; + wchar_t *s; + wchar_t tmp[MAX_SIZE]; + NMHDR *n; + UINT i; + // Validate arguments + if (hWnd == NULL) + { + return 0; + } + + switch (msg) + { + case WM_INITDIALOG: + FormatText(hWnd, 0, p->Title); + + if (p->Bridge == false) + { + FormatText(hWnd, S_TITLE, p->ServerName); + } + else + { + UniFormat(tmp, sizeof(tmp), _UU("SM_SERVER_BRIDGE_TITLE"), p->ServerName); + SetText(hWnd, S_TITLE, tmp); + } + + DlgFont(hWnd, S_TITLE, 16, 1); + + SetIcon(hWnd, 0, p->Bridge == false ? ICO_VPNSERVER : ICO_BRIDGE); + + SmServerDlgInit(hWnd, p); + + SetTimer(hWnd, 1, 50, NULL); + + break; + + case WM_COMMAND: + switch (wParam) + { + case IDOK: + // Management + if (IsEnable(hWnd, IDOK)) + { + if (p->Bridge == false) + { + s = LvGetSelectedStr(hWnd, L_HUB, 0); + } + else + { + s = CopyUniStr(L"BRIDGE"); + } + if (s != NULL) + { + char hubname[MAX_HUBNAME_LEN + 1]; + SM_HUB hub; + Zero(&hub, sizeof(hub)); + UniToStr(hubname, sizeof(hubname), s); + hub.p = p; + hub.Rpc = p->Rpc; + hub.HubName = hubname; + SmHubDlg(hWnd, &hub); + //SmServerDlgRefresh(hWnd, p); + Free(s); + } + } + break; + + case B_ONLINE: + // Online + s = LvGetSelectedStr(hWnd, L_HUB, 0); + if (s != NULL) + { + RPC_SET_HUB_ONLINE t; + Zero(&t, sizeof(t)); + UniToStr(t.HubName, sizeof(t.HubName), s); + t.Online = true; + if (CALL(hWnd, ScSetHubOnline(p->Rpc, &t))) + { + SmServerDlgRefresh(hWnd, p); + } + Free(s); + } + break; + + case B_OFFLINE: + // Offline + s = LvGetSelectedStr(hWnd, L_HUB, 0); + if (s != NULL) + { + RPC_SET_HUB_ONLINE t; + Zero(&t, sizeof(t)); + // Confirmation message + if (MsgBoxEx(hWnd, MB_ICONQUESTION | MB_YESNO | MB_DEFBUTTON2, + _UU("CM_OFFLINE_MSG"), s) == IDYES) + { + UniToStr(t.HubName, sizeof(t.HubName), s); + t.Online = false; + if (CALL(hWnd, ScSetHubOnline(p->Rpc, &t))) + { + SmServerDlgRefresh(hWnd, p); + } + } + Free(s); + } + break; + + case B_HUB_STATUS: + // Status of HUB + s = LvGetSelectedStr(hWnd, L_HUB, 0); + if (s != NULL) + { + wchar_t tmp[MAX_SIZE]; + char *hubname = CopyUniToStr(s); + UniFormat(tmp, sizeof(tmp), _UU("SM_HUB_STATUS_CAPTION"), s); + SmStatusDlg(hWnd, p, hubname, false, true, tmp, ICO_HUB, + NULL, SmRefreshHubStatus); + Free(hubname); + Free(s); + } + break; + + case B_CREATE: + // Create a HUB + if (SmCreateHubDlg(hWnd, p)) + { + SmServerDlgRefresh(hWnd, p); + } + break; + + case B_EDIT: + // Edit the HUB + s = LvGetSelectedStr(hWnd, L_HUB, 0); + if (s != NULL) + { + char *name = CopyUniToStr(s); + if (SmEditHubDlg(hWnd, p, name)) + { + SmServerDlgRefresh(hWnd, p); + } + Free(name); + Free(s); + } + break; + + case B_DELETE: + // Delete the HUB + s = LvGetSelectedStr(hWnd, L_HUB, 0); + if (s != NULL) + { + char *name = CopyUniToStr(s); + RPC_DELETE_HUB t; + Zero(&t, sizeof(t)); + StrCpy(t.HubName, sizeof(t.HubName), name); + if (MsgBoxEx(hWnd, MB_ICONEXCLAMATION | MB_YESNO | MB_DEFBUTTON2, _UU("CM_DELETE_HUB_MSG"), name) == IDYES) + { + if (CALL(hWnd, ScDeleteHub(p->Rpc, &t))) + { + SmServerDlgRefresh(hWnd, p); + MsgBoxEx(hWnd, MB_ICONINFORMATION, _UU("CM_HUB_DELETED_MSG"), name); + } + } + Free(name); + Free(s); + } + break; + + case B_CREATE_LISTENER: + // Create a listener + if (SmCreateListenerDlg(hWnd, p)) + { + SmServerDlgRefresh(hWnd, p); + } + break; + + case B_DELETE_LISTENER: + // Remove the listener + i = LvGetSelected(hWnd, L_LISTENER); + if (i != INFINITE) + { + UINT port = (UINT)LvGetParam(hWnd, L_LISTENER, i); + if (MsgBoxEx(hWnd, MB_ICONEXCLAMATION | MB_YESNO | MB_DEFBUTTON2, _UU("CM_DELETE_LISTENER_MSG"), port) == IDYES) + { + RPC_LISTENER t; + Zero(&t, sizeof(t)); + t.Enable = false; + t.Port = port; + + if (CALL(hWnd, ScDeleteListener(p->Rpc, &t))) + { + SmServerDlgRefresh(hWnd, p); + } + } + } + break; + + case B_START: + // Start + i = LvGetSelected(hWnd, L_LISTENER); + if (i != INFINITE) + { + UINT port = (UINT)LvGetParam(hWnd, L_LISTENER, i); + RPC_LISTENER t; + Zero(&t, sizeof(t)); + t.Enable = true; + t.Port = port; + + if (CALL(hWnd, ScEnableListener(p->Rpc, &t))) + { + SmServerDlgRefresh(hWnd, p); + } + } + break; + + case B_STOP: + // Stop + i = LvGetSelected(hWnd, L_LISTENER); + if (i != INFINITE) + { + UINT port = (UINT)LvGetParam(hWnd, L_LISTENER, i); + if (MsgBoxEx(hWnd, MB_ICONQUESTION | MB_YESNO | MB_DEFBUTTON2, _UU("CM_STOP_LISTENER_MSG"), port) == IDYES) + { + RPC_LISTENER t; + Zero(&t, sizeof(t)); + t.Enable = false; + t.Port = port; + + if (CALL(hWnd, ScEnableListener(p->Rpc, &t))) + { + SmServerDlgRefresh(hWnd, p); + } + } + } + break; + + case B_APPLY: + { + // Apply UDP ports + bool ret; + LIST* ports; + RPC_PORTS t; + char tmp[MAX_SIZE]; + + GetTxtA(hWnd, E_UDP, tmp, sizeof(tmp)); + ports = StrToPortList(tmp, false); + + t.Num = LIST_NUM(ports); + if (t.Num > 0) + { + UINT i; + t.Ports = Malloc(sizeof(UINT) * t.Num); + + for (i = 0; i < t.Num; ++i) + { + t.Ports[i] = (UINT)LIST_DATA(ports, i); + } + } + else + { + t.Ports = NULL; + } + + ReleaseList(ports); + + if (CALL(hWnd, ScSetPortsUDP(p->Rpc, &t))) + { + SmServerDlgRefresh(hWnd, p); + } + + Free(t.Ports); + + break; + } + + case B_SSL: + // SSL related + SmSslDlg(hWnd, p); + break; + + case B_STATUS: + // Server status + SmStatusDlg(hWnd, p, p, false, true, _UU("SM_SERVER_STATUS"), ICO_VPNSERVER, + NULL, SmRefreshServerStatus); + break; + + case B_INFO: + // Server Information + SmStatusDlg(hWnd, p, p, false, false, _UU("SM_INFO_TITLE"), ICO_VPNSERVER, + NULL, SmRefreshServerInfo); + break; + + case B_BRIDGE: + // Local bridge configuration + SmBridgeDlg(hWnd, p); + SmServerDlgRefresh(hWnd, p); + break; + + case B_FARM: + // Server farm + if (SmFarmDlg(hWnd, p)) + { + // Close the dialog if the server farm configuration has changed + Close(hWnd); + } + break; + + case B_FARM_STATUS: + // Server farm status + if (p->ServerType == SERVER_TYPE_FARM_CONTROLLER) + { + Dialog(hWnd, D_SM_FARM_MEMBER, SmFarmMemberDlgProc, p); + } + else if (p->ServerType == SERVER_TYPE_FARM_MEMBER) + { + SmStatusDlg(hWnd, p, NULL, false, true, _UU("SM_FC_STATUS_CAPTION"), + ICO_FARM, NULL, SmRefreshFarmConnectionInfo); + } + break; + + case B_CONNECTION: + // TCP connection list + SmConnectionDlg(hWnd, p); + break; + + case B_REFRESH: + // Update to the latest state + SmServerDlgRefresh(hWnd, p); + break; + + case B_CONFIG: + // Config edit + SmConfig(hWnd, p); + break; + + case B_L3: + // L3 switch + SmL3(hWnd, p); + break; + + case B_LICENSE: + // Add or Remove license + SmLicense(hWnd, p); + SmServerDlgUpdate(hWnd, p); + break; + + case B_IPSEC: + // IPsec Settings + SmIPsec(hWnd, p); + break; + + case B_OPENVPN: + // OpenVPN, SSTP setting + SmOpenVpn(hWnd, p); + break; + + case B_DDNS: + // DDNS setting + if (SmDDns(hWnd, p, false, false)) + { + SmServerDlgRefresh(hWnd, p); + } + break; + + case B_AZURE: + // VPN Azure setting + SmAzure(hWnd, p, false); + + SmServerDlgRefresh(hWnd, p); + break; + + + case IDCANCEL: + Close(hWnd); + break; + } + break; + + case WM_CLOSE: + { + // Save the HUB that was selected last + char *hubname = NULL; + char tmp[MAX_SIZE]; + + + Format(tmp, sizeof(tmp), "%s:%u:%s", p->CurrentSetting->ClientOption.Hostname, + p->CurrentSetting->ClientOption.Port, + p->CurrentSetting->ServerAdminMode ? "" : p->CurrentSetting->HubName); + + if (LvIsSingleSelected(hWnd, L_HUB)) + { + hubname = LvGetSelectedStrA(hWnd, L_HUB, 0); + } + + if (IsEmptyStr(hubname) == false) + { + MsRegWriteStr(REG_CURRENT_USER, SM_LASTHUB_REG_KEY, tmp, hubname); + } + else + { + MsRegDeleteValue(REG_CURRENT_USER, SM_LASTHUB_REG_KEY, tmp); + } + + Free(hubname); + + EndDialog(hWnd, false); + } + break; + + case WM_NOTIFY: + n = (NMHDR *)lParam; + switch (n->idFrom) + { + case L_HUB: + switch (n->code) + { + case LVN_ITEMCHANGED: + SmServerDlgUpdate(hWnd, p); + break; + } + break; + case L_LISTENER: + switch (n->code) + { + case LVN_ITEMCHANGED: + SmServerDlgUpdate(hWnd, p); + break; + } + break; + } + break; + + case WM_TIMER: + switch (wParam) + { + case 1: + KillTimer(hWnd, 1); + + if (p->ServerAdminMode) + { + // Prompt the registration if the license key is not registered + RPC_LICENSE_STATUS t; + + Zero(&t, sizeof(t)); + if (p->Bridge == false && GetCapsBool(p->CapsList, "b_support_license")) + { + if (ScGetLicenseStatus(p->Rpc, &t) == ERR_NO_ERROR) + { + if (t.EditionId == LICENSE_EDITION_VPN3_NO_LICENSE || (t.NeedSubscription && t.SubscriptionExpires == 0)) + { + // Valid license key is not registered + + if (MsgBox(hWnd, MB_YESNO | MB_ICONINFORMATION, + _UU("SM_SETUP_NO_LICENSE_KEY")) == IDYES) + { + SmLicense(hWnd, p); + } + } + } + } + } + + SetTimer(hWnd, 2, 150, NULL); + break; + + case 2: + // Setup + KillTimer(hWnd, 2); + + if (SmSetupIsNew(p)) + { + if (SmSetup(hWnd, p)) + { + SmServerDlgRefresh(hWnd, p); + } + } + + SmShowIPSecMessageIfNecessary(hWnd, p); + + SmShowCertRegenerateMessageIfNecessary(hWnd, p); + + SetTimer(hWnd, 3, 150, NULL); + break; + + case 3: + // Message for Administrators + KillTimer(hWnd, 3); + + if (UniIsEmptyStr(p->AdminMsg) == false) + { + wchar_t tmp[MAX_SIZE]; + + UniFormat(tmp, sizeof(tmp), _UU("SM_SERVER_ADMIN_MSG"), p->ServerName); + OnceMsg(hWnd, tmp, p->AdminMsg, true, ICO_VPNSERVER); + } + break; + } + break; + } + + LvStandardHandler(hWnd, msg, wParam, lParam, L_HUB); + + return 0; +} + +// Display the message about the cert +void SmShowCertRegenerateMessageIfNecessary(HWND hWnd, SM_SERVER *p) +{ + // Validate arguments + if (p == NULL) + { + return; + } + + if (p->ServerAdminMode && p->Bridge == false) + { + RPC_KEY_PAIR t; + + Zero(&t, sizeof(t)); + + if (ScGetServerCert(p->Rpc, &t) == ERR_NO_ERROR) + { + if (t.Cert != NULL && t.Cert->has_basic_constraints == false) + { + if (t.Cert->root_cert) + { + if (MsRegReadInt(REG_CURRENT_USER, SM_HIDE_CERT_UPDATE_MSG_KEY, p->ServerName) == 0) + { + if (MsgBox(hWnd, MB_ICONQUESTION | MB_YESNO, _UU("SM_CERT_MESSAGE")) == IDYES) + { + X *x; + K *k; + + // Regenerating the certificate + if (SmRegenerateServerCert(hWnd, p, NULL, &x, &k, false)) + { + // Confirmation message + if (MsgBox(hWnd, MB_ICONEXCLAMATION | MB_YESNO, _UU("SM_REGENERATE_CERT_MSG")) == IDYES) + { + // Set the new certificate and private key + RPC_KEY_PAIR t2; + + Zero(&t2, sizeof(t2)); + + t2.Cert = CloneX(x); + t2.Key = CloneK(k); + + if (CALL(hWnd, ScSetServerCert(p->Rpc, &t2))) + { + FreeRpcKeyPair(&t2); + + MsgBox(hWnd, MB_ICONINFORMATION, _UU("CM_CERT_SET_MSG")); + } + } + + FreeX(x); + FreeK(k); + } + } + else + { + MsRegWriteInt(REG_CURRENT_USER, SM_HIDE_CERT_UPDATE_MSG_KEY, p->ServerName, 1); + } + } + } + } + + FreeRpcKeyPair(&t); + } + } +} + +// Display messages about IPsec, and prompt for the setting +void SmShowIPSecMessageIfNecessary(HWND hWnd, SM_SERVER *p) +{ + // Validate arguments + if (p == NULL) + { + return; + } + + if (GetCapsBool(p->CapsList, "b_support_vgs_in_client") == false) + { + if (GetCapsBool(p->CapsList, "b_support_ipsec") && p->IPsecMessageDisplayed == false) + { + // Display a message about IPsec + RPC_TEST flag; + + if (MsgBox(hWnd, MB_ICONQUESTION | MB_YESNO, _UU("SM_IPSEC_SETUP_QUESTION")) == IDYES) + { + // Display the IPsec dialog + SmIPsec(hWnd, p); + } + + Zero(&flag, sizeof(flag)); + flag.IntValue = 9; + ToStr(flag.StrValue, 1); + + ScDebug(p->Rpc, &flag); + + p->IPsecMessageDisplayed = true; + } + + } +} + +// Connection +void SmConnect(HWND hWnd, SETTING *s) +{ + SmConnectEx(hWnd, s, false); +} +void SmConnectEx(HWND hWnd, SETTING *s, bool is_in_client) +{ + bool ok; + RPC *rpc; + char *pass; + bool empty_password = false; + bool first_bad_password = false; + // Validate arguments + if (s == NULL) + { + return; + } + + // Disable the control + Disable(hWnd, L_SETTING); + Disable(hWnd, B_NEW_SETTING); + Disable(hWnd, B_EDIT_SETTING); + Disable(hWnd, B_DELETE); + Disable(hWnd, IDOK); + Disable(hWnd, B_ABOUT); + Disable(hWnd, IDCANCEL); + Disable(hWnd, B_SECURE_MANAGER); + Disable(hWnd, B_SELECT_SECURE); + Disable(hWnd, B_CERT_TOOL); + + ok = true; + + if (IsZero(s->HashedPassword, SHA1_SIZE)) + { + // Password input screen +ENTER_PASSWORD: + pass = SmPassword(hWnd, s->ClientOption.Hostname); + if (pass != NULL) + { + Sha0(s->HashedPassword, pass, StrLen(pass)); + Free(pass); + ok = true; + } + else + { + ok = false; + } + } + + if (ok) + { + UINT err = ERR_INTERNAL_ERROR; + // Connection + rpc = AdminConnectEx2(sm->Cedar, &s->ClientOption, s->ServerAdminMode ? "" : s->HubName, s->HashedPassword, &err, NULL, + hWnd); + if (rpc == NULL) + { + // An error has occured + if (err != ERR_ACCESS_DENIED || first_bad_password) + { + MsgBox(hWnd, MB_ICONSTOP, _E(err)); + } + if (err == ERR_ACCESS_DENIED) + { + // Password incorrect + first_bad_password = true; + goto ENTER_PASSWORD; + } + else + { + // Other errors + } + } + else + { + UCHAR test[SHA1_SIZE]; + SM_SERVER p; + RPC_SERVER_STATUS status; + RPC_SERVER_INFO info; + SETTING *setting; + RPC_MSG msg; + RPC_TEST flag; + bool cancel = false; + + Sha0(test, "", 0); + + if (Cmp(test, s->HashedPassword, SHA1_SIZE) == 0 || Cmp(test, rpc->VpnServerHashedPassword, SHA1_SIZE) == 0) + { + empty_password = true; + } + + if (sm->TempSetting == NULL) + { + setting = SmGetSetting(s->Title); + if (setting != NULL) + { + if (IsZero(setting->HashedPassword, SHA1_SIZE) == false) + { + Copy(setting->HashedPassword, s->HashedPassword, SHA1_SIZE); + SmWriteSettingList(); + } + } + } + + rpc->ServerAdminMode = s->ServerAdminMode; + if (s->ServerAdminMode == false) + { + StrCpy(rpc->HubName, sizeof(rpc->HubName), s->HubName); + } + + Zero(&p, sizeof(p)); + p.IsInClient = is_in_client; + p.CurrentSetting = s; + p.Rpc = rpc; + p.ServerAdminMode = rpc->ServerAdminMode; + StrCpy(p.ServerName, sizeof(p.ServerName), s->ClientOption.Hostname); + if (p.ServerAdminMode == false) + { + StrCpy(p.HubName, sizeof(p.HubName), rpc->HubName); + } + UniStrCpy(p.Title, sizeof(p.Title), s->Title); + + // Get the type of server + Zero(&status, sizeof(status)); + ScGetServerStatus(rpc, &status); + + p.ServerType = status.ServerType; + + Zero(&info, sizeof(info)); + ScGetServerInfo(rpc, &info); + + Copy(&p.ServerInfo, &info, sizeof(RPC_SERVER_INFO)); + Copy(&p.ServerStatus, &status, sizeof(RPC_SERVER_STATUS)); + + // Get the Admin Msg + Zero(&msg, sizeof(msg)); + if (ScGetAdminMsg(rpc, &msg) == ERR_NO_ERROR) + { + p.AdminMsg = UniCopyStr(msg.Msg); + FreeRpcMsg(&msg); + } + + // IPsec related + Zero(&flag, sizeof(flag)); + flag.IntValue = 8; + if (ScDebug(rpc, &flag) == ERR_NO_ERROR) + { + p.IPsecMessageDisplayed = ToInt(flag.StrValue); + } + else + { + p.IPsecMessageDisplayed = true; + } + + // VGS related + Zero(&flag, sizeof(flag)); + flag.IntValue = 10; + if (ScDebug(rpc, &flag) == ERR_NO_ERROR) + { + p.VgsMessageDisplayed = ToInt(flag.StrValue); + } + else + { + p.VgsMessageDisplayed = true; + } + + // Get the Caps + p.CapsList = ScGetCapsEx(p.Rpc); + + p.Bridge = GetCapsBool(p.CapsList, "b_bridge"); + + if (GetCapsBool(p.CapsList, "b_support_policy_ver_3")) + { + p.PolicyVer = 3; + } + else + { + p.PolicyVer = 2; + } + + if (empty_password && s->ServerAdminMode) + { + // Make the user set a password when a password empty (In the case of server management mode) + if (Dialog(hWnd, D_SM_CHANGE_PASSWORD, SmChangeServerPasswordDlg, &p) == 0) + { + cancel = true; + } + } + + // Server management screen + if (cancel == false) + { + // Update notification initialization + WINUI_UPDATE *update = NULL; + + if (p.ServerAdminMode && is_in_client == false) + { + wchar_t update_software_title[MAX_SIZE]; + char update_software_name[MAX_SIZE]; + char server_name_safe[MAX_HOST_NAME_LEN + 1]; + char family_name[128]; + + MakeSafeFileName(server_name_safe, sizeof(server_name_safe), p.ServerName); + Format(update_software_name, sizeof(update_software_name), (p.Bridge ? NAME_OF_VPN_BRIDGE_TARGET : NAME_OF_VPN_SERVER_TARGET), server_name_safe); + StrLower(update_software_name); + Trim(update_software_name); + + Zero(family_name, sizeof(family_name)); + StrCpy(family_name, sizeof(family_name), p.ServerInfo.ServerFamilyName); + + if (IsEmptyStr(family_name)) + { + if (InStr(p.ServerInfo.ServerProductName, "PacketiX")) + { + StrCpy(family_name, sizeof(family_name), "PacketiX"); + } + else if (InStr(p.ServerInfo.ServerProductName, "UT-VPN") || + InStr(p.ServerInfo.ServerProductName, "SoftEther")) + { + StrCpy(family_name, sizeof(family_name), "softether"); + } + } + + if (IsEmptyStr(family_name) == false) + { + UniFormat(update_software_title, sizeof(update_software_title), _UU(p.Bridge ? "SM_UPDATE_CHECK_TITLE_VPNBRIDGE" : "SM_UPDATE_CHECK_TITLE_VPNSERVER"), + family_name, p.ServerName); + + update = InitUpdateUi(update_software_title, update_software_name, family_name, p.ServerInfo.ServerBuildDate, + p.ServerInfo.ServerBuildInt, p.ServerInfo.ServerVerInt, NULL, false); + } + } + + p.Update = update; + + // Main screen + Dialog(hWnd, D_SM_SERVER, SmServerDlgProc, &p); + + if (p.Update != NULL) + { + FreeUpdateUi(p.Update); + p.Update = NULL; + } + } + + // Disconnect + AdminDisconnect(rpc); + + // Release the Caps + FreeCapsList(p.CapsList); + + Free(p.AdminMsg); + p.AdminMsg = NULL; + + FreeRpcServerInfo(&info); + } + } + + // Enable the control + Enable(hWnd, L_SETTING); + Enable(hWnd, B_NEW_SETTING); + Enable(hWnd, B_EDIT_SETTING); + Enable(hWnd, B_DELETE); + Enable(hWnd, IDOK); + Enable(hWnd, B_ABOUT); + Enable(hWnd, IDCANCEL); + + if (MsIsWine() == false) + { + Enable(hWnd, B_SECURE_MANAGER); + Enable(hWnd, B_SELECT_SECURE); + } + + Enable(hWnd, B_CERT_TOOL); +} + +// Password input dialog +char *SmPassword(HWND hWnd, char *server_name) +{ + char *ret; + UI_PASSWORD_DLG p; + // Validate arguments + if (server_name == NULL) + { + return NULL; + } + + Zero(&p, sizeof(p)); + p.AdminMode = true; + StrCpy(p.ServerName, sizeof(p.ServerName), server_name); + + if (PasswordDlg(hWnd, &p) == false) + { + return NULL; + } + + ret = CopyStr(p.Password); + + return ret; +} + +// Configuration editing dialog initialization +void SmEditSettingDlgInit(HWND hWnd, SM_EDIT_SETTING *p) +{ + SETTING *s; + // Validate arguments + if (hWnd == NULL || p == NULL) + { + return; + } + + p->Inited = false; + + s = p->Setting; + + // Title + if (p->EditMode == false) + { + SetText(hWnd, 0, _UU("SM_EDIT_CAPTION_1")); + } + else + { + wchar_t tmp[MAX_SIZE]; + UniFormat(tmp, sizeof(tmp), _UU("SM_EDIT_CAPTION_2"), s->Title); + SetText(hWnd, 0, tmp); + } + + // Connection setting name + SetText(hWnd, E_ACCOUNT_NAME, s->Title); + + // Host name + SetTextA(hWnd, E_HOSTNAME, s->ClientOption.Hostname); + + // Port number + CbSetHeight(hWnd, C_PORT, 18); + CbAddStr(hWnd, C_PORT, _UU("CM_PORT_1"), 0); + CbAddStr(hWnd, C_PORT, _UU("CM_PORT_2"), 0); + CbAddStr(hWnd, C_PORT, _UU("CM_PORT_3"), 0); + CbAddStr(hWnd, C_PORT, _UU("CM_PORT_4"), 0); + SetIntEx(hWnd, C_PORT, s->ClientOption.Port); + + // Proxy Settings + Check(hWnd, R_DIRECT_TCP, s->ClientOption.ProxyType == PROXY_DIRECT); + Check(hWnd, R_HTTPS, s->ClientOption.ProxyType == PROXY_HTTP); + Check(hWnd, R_SOCKS, s->ClientOption.ProxyType == PROXY_SOCKS); + Check(hWnd, R_SOCKS5, s->ClientOption.ProxyType == PROXY_SOCKS5); + + // Management mode setting + Check(hWnd, R_SERVER_ADMIN, s->ServerAdminMode); + Check(hWnd, R_HUB_ADMIN, s->ServerAdminMode == false ? true : false); + CbSetHeight(hWnd, C_HUBNAME, 18); + SetTextA(hWnd, C_HUBNAME, s->HubName); + + // Password + if (IsZero(s->HashedPassword, SHA1_SIZE)) + { + Check(hWnd, R_NO_SAVE, true); + } + else + { + UCHAR test[SHA1_SIZE]; + + Sha0(test, "", 0); + if (Cmp(test, s->HashedPassword, SHA1_SIZE) != 0) + { + SetTextA(hWnd, E_PASSWORD, HIDDEN_PASSWORD); + } + } + + if (p->EditMode == false) + { + FocusEx(hWnd, E_ACCOUNT_NAME); + } + else + { + FocusEx(hWnd, E_HOSTNAME); + } + + p->Inited = true; + + // Start enumerating the Virtual HUBs + CmEnumHubStart(hWnd, &s->ClientOption); + + SmEditSettingDlgUpdate(hWnd, p); +} + +// Configuration editing dialog update +void SmEditSettingDlgUpdate(HWND hWnd, SM_EDIT_SETTING *p) +{ + bool ok = true; + UINT delete_hub_list = 0; + SETTING *s; + char tmp[MAX_SIZE]; + // Validate arguments + if (hWnd == NULL || p == NULL || p->Inited == false) + { + return; + } + + s = p->Setting; + + GetTxt(hWnd, E_ACCOUNT_NAME, s->Title, sizeof(s->Title)); + UniTrim(s->Title); + + if (UniStrLen(s->Title) == 0) + { + ok = false; + } + + if (IsChecked(hWnd, R_LOCALHOST)) + { + SetTextA(hWnd, E_HOSTNAME, "localhost"); + Disable(hWnd, E_HOSTNAME); + } + else + { + Enable(hWnd, E_HOSTNAME); + } + + GetTxtA(hWnd, E_HOSTNAME, tmp, sizeof(tmp)); + Trim(tmp); + + if (StrCmpi(tmp, s->ClientOption.Hostname) != 0) + { + delete_hub_list++; + } + + StrCpy(s->ClientOption.Hostname, sizeof(s->ClientOption.Hostname), tmp); + + if (StrLen(s->ClientOption.Hostname) == 0) + { + ok = false; + } + + s->ClientOption.Port = GetInt(hWnd, C_PORT); + if (s->ClientOption.Port == 0) + { + ok = false; + } + + if (IsChecked(hWnd, R_DIRECT_TCP)) + { + s->ClientOption.ProxyType = PROXY_DIRECT; + } + else if (IsChecked(hWnd, R_HTTPS)) + { + s->ClientOption.ProxyType = PROXY_HTTP; + } + else + { + s->ClientOption.ProxyType = PROXY_SOCKS; + } + + SetEnable(hWnd, B_PROXY_CONFIG, s->ClientOption.ProxyType != PROXY_DIRECT); + + if (s->ClientOption.ProxyType != PROXY_DIRECT) + { + if (StrLen(s->ClientOption.ProxyName) == 0) + { + ok = false; + } + if (s->ClientOption.ProxyPort == 0) + { + ok = false; + } + } + + s->ServerAdminMode = IsChecked(hWnd, R_SERVER_ADMIN); + + SetEnable(hWnd, C_HUBNAME, s->ServerAdminMode == false ? true : false); + SetEnable(hWnd, S_HUBNAME, s->ServerAdminMode == false ? true : false); + + GetTxtA(hWnd, C_HUBNAME, s->HubName, sizeof(s->HubName)); + Trim(s->HubName); + if (StrLen(s->HubName) == 0) + { + if (s->ServerAdminMode == false) + { + ok = false; + } + } + + if (IsChecked(hWnd, R_NO_SAVE)) + { + Zero(s->HashedPassword, SHA1_SIZE); + SetTextA(hWnd, E_PASSWORD, ""); + Disable(hWnd, E_PASSWORD); + Disable(hWnd, S_PASSWORD); + } + else + { + char tmp[MAX_PASSWORD_LEN + 1]; + Enable(hWnd, E_PASSWORD); + Enable(hWnd, S_PASSWORD); + GetTxtA(hWnd, E_PASSWORD, tmp, sizeof(tmp)); + if (StrCmp(tmp, HIDDEN_PASSWORD) != 0) + { + Sha0(s->HashedPassword, tmp, StrLen(tmp)); + } + } + + if (delete_hub_list) + { + CbReset(hWnd, C_HUBNAME); + } + + SetEnable(hWnd, IDOK, ok); +} + +// Configuration Edit dialog OK button +void SmEditSettingDlgOnOk(HWND hWnd, SM_EDIT_SETTING *p) +{ + // Validate arguments + if (hWnd == NULL || p == NULL) + { + return; + } + + if (p->EditMode == false) + { + // Register new + SETTING *s = ZeroMalloc(sizeof(SETTING)); + Copy(s, p->Setting, sizeof(SETTING)); + if (SmAddSetting(s) == false) + { + MsgBoxEx(hWnd, MB_ICONEXCLAMATION, _UU("SM_SETTING_EXISTS"), s->Title); + Free(s); + FocusEx(hWnd, E_ACCOUNT_NAME); + return; + } + EndDialog(hWnd, true); + } + else + { + // Update registration + SETTING *t = SmGetSetting(p->Setting->Title); + if (t != NULL && t != p->OldSetting) + { + MsgBoxEx(hWnd, MB_ICONEXCLAMATION, _UU("SM_SETTING_EXISTS"), p->Setting->Title); + FocusEx(hWnd, E_ACCOUNT_NAME); + return; + } + + Copy(p->OldSetting, p->Setting, sizeof(SETTING)); + Sort(sm->SettingList); + SmWriteSettingList(); + + EndDialog(hWnd, true); + } +} + +// Settings add / edit dialog +UINT SmEditSettingDlgProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param) +{ + SM_EDIT_SETTING *p = (SM_EDIT_SETTING *)param; + // Validate arguments + if (hWnd == NULL) + { + return 0; + } + + switch (msg) + { + case WM_INITDIALOG: + SmEditSettingDlgInit(hWnd, p); + break; + + case WM_COMMAND: + switch (LOWORD(wParam)) + { + case R_LOCALHOST: + case E_ACCOUNT_NAME: + case E_HOSTNAME: + case C_PORT: + case R_DIRECT_TCP: + case R_HTTPS: + case R_SOCKS: + case R_SOCKS5: + case R_SERVER_ADMIN: + case R_HUB_ADMIN: + case C_HUBNAME: + case E_PASSWORD: + case R_NO_SAVE: + SmEditSettingDlgUpdate(hWnd, p); + break; + } + + if (LOWORD(wParam) == R_LOCALHOST) + { + FocusEx(hWnd, E_HOSTNAME); + } + + switch (LOWORD(wParam)) + { + case E_HOSTNAME: + if (HIWORD(wParam) == EN_KILLFOCUS) + { + CmEnumHubStart(hWnd, &p->Setting->ClientOption); + } + break; + case C_PORT: + if (HIWORD(wParam) == CBN_KILLFOCUS) + { + CmEnumHubStart(hWnd, &p->Setting->ClientOption); + } + break; + case R_DIRECT_TCP: + case R_HTTPS: + case R_SOCKS: + case R_SOCKS5: + if (HIWORD(wParam) == BN_CLICKED) + { + CmEnumHubStart(hWnd, &p->Setting->ClientOption); + } + break; + } + + switch (wParam) + { + case IDOK: + SmEditSettingDlgOnOk(hWnd, p); + break; + + case IDCANCEL: + Close(hWnd); + break; + + case B_PROXY_CONFIG: + // Proxy Settings + if (CmProxyDlg(hWnd, &p->Setting->ClientOption)) + { + UINT n = GetInt(hWnd, C_PORT); + if (p->Setting->ClientOption.ProxyType == PROXY_HTTP && + n != 443) + { + // Show a warning message if the destination port is + // other than 443 in when HTTP proxy is used + if (MsgBoxEx(hWnd, MB_ICONQUESTION | MB_YESNO, _UU("CM_HTTP_PROXY_WARNING"), n) == IDYES) + { + // Change the port number to 443 + SetText(hWnd, C_PORT, _UU("CM_PORT_2")); + } + } + SmEditSettingDlgUpdate(hWnd, p); + CmEnumHubStart(hWnd, &p->Setting->ClientOption); + } + break; + + case R_NO_SAVE: + if (IsChecked(hWnd, R_NO_SAVE) == false) + { + FocusEx(hWnd, E_PASSWORD); + } + break; + } + break; + + case WM_CLOSE: + EndDialog(hWnd, false); + break; + } + + return 0; +} + +// Show the Settings Adding dialog +bool SmAddSettingDlg(HWND hWnd, wchar_t *new_name, UINT new_name_size) +{ + SM_EDIT_SETTING p; + SETTING s; + UINT i; + bool ret; + // Validate arguments + if (hWnd == NULL || new_name == NULL) + { + return false; + } + + Zero(&p, sizeof(p)); + Zero(&s, sizeof(s)); + + s.ClientOption.Port = 443; + + p.EditMode = false; + p.Setting = &s; + + for (i = 1;;i++) + { + wchar_t tmp[MAX_SIZE]; + if (i == 1) + { + UniFormat(tmp, sizeof(tmp), _UU("CM_NEW_ACCOUNT_NAME_1")); + } + else + { + UniFormat(tmp, sizeof(tmp), _UU("CM_NEW_ACCOUNT_NAME_2"), i); + } + + if (SmGetSetting(tmp) == NULL) + { + UniStrCpy(s.Title, sizeof(s.Title), tmp); + Sha0(s.HashedPassword, "", 0); + s.ServerAdminMode = true; + break; + } + } + + ret = Dialog(hWnd, D_SM_EDIT_SETTING, SmEditSettingDlgProc, &p); + + if (ret) + { + UniStrCpy(new_name, new_name_size, s.Title); + } + + return ret; +} + +// Show the settings edit dialog +bool SmEditSettingDlg(HWND hWnd) +{ + SM_EDIT_SETTING p; + SETTING s, *setting; + UINT i; + wchar_t *name; + // Validate arguments + if (hWnd == NULL) + { + return false; + } + + i = LvGetSelected(hWnd, L_SETTING); + if (i == INFINITE) + { + return false; + } + + name = LvGetStr(hWnd, L_SETTING, i, 0); + + setting = SmGetSetting(name); + if (setting == NULL) + { + Free(name); + return false; + } + + Free(name); + + Copy(&s, setting, sizeof(SETTING)); + + Zero(&p, sizeof(p)); + + p.EditMode = true; + p.OldSetting = setting; + p.Setting = &s; + + return Dialog(hWnd, D_SM_EDIT_SETTING, SmEditSettingDlgProc, &p); +} + +// Update the configuration +bool SmCheckNewName(SETTING *s, wchar_t *new_title) +{ + UINT i; + // Validate arguments + if (new_title == NULL) + { + return false; + } + if (s != NULL) + { + if (IsInList(sm->SettingList, s) == false) + { + return false; + } + } + + // Check whether there is the same name in other + for (i = 0;i < LIST_NUM(sm->SettingList);i++) + { + SETTING *t = LIST_DATA(sm->SettingList, i); + + if (s != t) + { + if (UniStrCmpi(t->Title, new_title) == 0) + { + return false; + } + } + } + + return true; +} + +// Delete the configuration +void SmDeleteSetting(wchar_t *title) +{ + SETTING *s; + // Validate arguments + if (title == NULL) + { + return; + } + + s = SmGetSetting(title); + if (s == NULL) + { + return; + } + + Delete(sm->SettingList, s); + Free(s); + Sort(sm->SettingList); + + SmWriteSettingList(); +} + +// Add the settings +bool SmAddSetting(SETTING *s) +{ + // Validate arguments + if (s == NULL) + { + return false; + } + + if (SmGetSetting(s->Title) != NULL) + { + return false; + } + + Insert(sm->SettingList, s); + + SmWriteSettingList(); + + return true; +} + +// Get the configuration +SETTING *SmGetSetting(wchar_t *title) +{ + SETTING s; + // Validate arguments + if (title == NULL) + { + return NULL; + } + + Zero(&s, sizeof(SETTING)); + UniStrCpy(s.Title, sizeof(s.Title), title); + + return (SETTING *)Search(sm->SettingList, &s); +} + +// Comparison of connection settings +int SmCompareSetting(void *p1, void *p2) +{ + SETTING *s1, *s2; + if (p1 == NULL || p2 == NULL) + { + return 0; + } + s1 = *(SETTING **)p1; + s2 = *(SETTING **)p2; + if (s1 == NULL || s2 == NULL) + { + return 0; + } + + return UniStrCmpi(s1->Title, s2->Title); +} + +// Initialize the configuration list +void SmInitSettingList() +{ + sm->SettingList = NewList(SmCompareSetting); + + SmLoadSettingList(); + + SmInitDefaultSettingList(); +} + +// Release the configuration list +void SmFreeSettingList() +{ + UINT i; + + // Write + SmWriteSettingList(); + + for (i = 0;i < LIST_NUM(sm->SettingList);i++) + { + SETTING *s = LIST_DATA(sm->SettingList, i); + Free(s); + } + ReleaseList(sm->SettingList); + + sm->SettingList = NULL; +} + +// Write the configuration list +void SmWriteSettingList() +{ + TOKEN_LIST *t; + UINT i; + + t = MsRegEnumValue(REG_CURRENT_USER, SM_SETTING_REG_KEY); + if (t != NULL) + { + // Remove all existing values + for (i = 0;i < t->NumTokens;i++) + { + char *name = t->Token[i]; + MsRegDeleteValue(REG_CURRENT_USER, SM_SETTING_REG_KEY, name); + } + + FreeToken(t); + } + + for (i = 0;i < LIST_NUM(sm->SettingList);i++) + { + char name[MAX_SIZE]; + SETTING *s = LIST_DATA(sm->SettingList, i); + + // Write + Format(name, sizeof(name), "Setting%u", i + 1); + MsRegWriteBin(REG_CURRENT_USER, SM_SETTING_REG_KEY, name, s, sizeof(SETTING)); + } +} + +// Load the connection list +void SmLoadSettingList() +{ + TOKEN_LIST *t; + UINT i; + char *key_name = SM_SETTING_REG_KEY; + + t = MsRegEnumValue(REG_CURRENT_USER, key_name); + if (t == NULL) + { + key_name = SM_SETTING_REG_KEY_OLD; + t = MsRegEnumValue(REG_CURRENT_USER, key_name); + if (t == NULL) + { + return; + } + } + + for (i = 0;i < t->NumTokens;i++) + { + char *name = t->Token[i]; + BUF *b = MsRegReadBin(REG_CURRENT_USER, key_name, name); + if (b != NULL) + { + if (b->Size == sizeof(SETTING)) + { + SETTING *s = ZeroMalloc(sizeof(SETTING)); + Copy(s, b->Buf, sizeof(SETTING)); + + Add(sm->SettingList, s); + } + FreeBuf(b); + } + } + + FreeToken(t); + + Sort(sm->SettingList); +} + +// Initialize the default setting list +void SmInitDefaultSettingList() +{ + if (LIST_NUM(sm->SettingList) == 0) + { + bool b = false; + LIST *pl = MsGetProcessList(); + + if (pl != NULL) + { + UINT i; + for (i = 0;i < LIST_NUM(pl);i++) + { + MS_PROCESS *p = LIST_DATA(pl, i); + + if (UniInStr(p->ExeFilenameW, L"vpnserver.exe") || UniInStr(p->ExeFilenameW, L"vpnbridge.exe")) + { + b = true; + } + + if (UniInStr(p->ExeFilenameW, L"sevpnserver.exe") || UniInStr(p->ExeFilenameW, L"sevpnbridge.exe")) + { + b = true; + } + + if (UniInStr(p->ExeFilenameW, L"utvpnserver.exe") || UniInStr(p->ExeFilenameW, L"utvpnbridge.exe")) + { + b = true; + } + } + } + + MsFreeProcessList(pl); + + if (b == false) + { + if (MsIsServiceRunning(GC_SVC_NAME_VPNSERVER) || MsIsServiceRunning(GC_SVC_NAME_VPNBRIDGE)) + { + b = true; + } + } + + if (b) + { + SETTING *s = ZeroMalloc(sizeof(SETTING)); + + UniStrCpy(s->Title, sizeof(s->Title), _UU("SM_LOCALHOST")); + s->ServerAdminMode = true; + Sha0(s->HashedPassword, "", 0); + UniStrCpy(s->ClientOption.AccountName, sizeof(s->ClientOption.AccountName), s->Title); + StrCpy(s->ClientOption.Hostname, sizeof(s->ClientOption.Hostname), "localhost"); + s->ClientOption.Port = GC_DEFAULT_PORT; + + Add(sm->SettingList, s); + } + } +} + +// Main dialog initialization +void SmMainDlgInit(HWND hWnd) +{ + wchar_t *last_select; + UINT i = INFINITE; + // Validate arguments + if (hWnd == NULL) + { + return; + } + + SetIcon(hWnd, 0, ICO_VPNSERVER); + + LvInit(hWnd, L_SETTING); + LvSetStyle(hWnd, L_SETTING, LVS_EX_GRIDLINES); + LvInsertColumn(hWnd, L_SETTING, 0, _UU("SM_MAIN_COLUMN_1"), 145); + LvInsertColumn(hWnd, L_SETTING, 1, _UU("SM_MAIN_COLUMN_2"), 129); + LvInsertColumn(hWnd, L_SETTING, 2, _UU("SM_MAIN_COLUMN_3"), 125); + + SmRefreshSetting(hWnd); + + last_select = MsRegReadStrW(REG_CURRENT_USER, SM_REG_KEY, "Last Select"); + if (UniIsEmptyStr(last_select) == false) + { + i = LvSearchStr(hWnd, L_SETTING, 0, last_select); + } + Free(last_select); + + if (i == INFINITE) + { + LvSelect(hWnd, L_SETTING, 0); + } + else + { + LvSelect(hWnd, L_SETTING, i); + } + + DlgFont(hWnd, IDOK, 10, true); + + if (MsIsWine()) + { + Disable(hWnd, B_SECURE_MANAGER); + Disable(hWnd, B_SELECT_SECURE); + } + + Focus(hWnd, L_SETTING); + + SmMainDlgUpdate(hWnd); +} + +// Update the configuration list +void SmRefreshSetting(HWND hWnd) +{ + SmRefreshSettingEx(hWnd, NULL); +} +void SmRefreshSettingEx(HWND hWnd, wchar_t *select_name) +{ + LVB *b; + UINT i; + // Validate arguments + if (hWnd == NULL) + { + return; + } + + b = LvInsertStart(); + + for (i = 0;i < LIST_NUM(sm->SettingList);i++) + { + wchar_t tmp[MAX_SIZE]; + wchar_t tmp2[MAX_SIZE]; + SETTING *s = LIST_DATA(sm->SettingList, i); + + if (s->ServerAdminMode) + { + UniStrCpy(tmp, sizeof(tmp), _UU("SM_MODE_SERVER")); + } + else + { + UniFormat(tmp, sizeof(tmp), _UU("SM_MODE_HUB"), s->HubName); + } + + StrToUni(tmp2, sizeof(tmp2), s->ClientOption.Hostname); + + LvInsertAdd(b, + (s->ServerAdminMode ? ICO_SERVER_ONLINE : ICO_HUB), + NULL, + 3, + s->Title, + tmp2, + tmp); + } + + LvInsertEnd(b, hWnd, L_SETTING); + + if (UniIsEmptyStr(select_name) == false) + { + LvSelect(hWnd, L_SETTING, INFINITE); + LvSelect(hWnd, L_SETTING, LvSearchStr(hWnd, L_SETTING, 0, select_name)); + } +} + +// Main dialog update +void SmMainDlgUpdate(HWND hWnd) +{ + bool ok = true; + // Validate arguments + if (hWnd == NULL) + { + return; + } + + if (LvIsSelected(hWnd, L_SETTING) == false) + { + ok = false; + } + if (LvIsMultiMasked(hWnd, L_SETTING)) + { + ok = false; + } + + SetEnable(hWnd, IDOK, ok); + SetEnable(hWnd, B_EDIT_SETTING, ok); + SetEnable(hWnd, B_DELETE, ok); +} + +// Main window procedure +UINT SmMainDlgProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param) +{ + NMHDR *n; + NMLVDISPINFOW *info; + NMLVKEYDOWN *key; + wchar_t *tmp; + UINT i; + wchar_t new_name[MAX_SIZE]; + // Validate arguments + if (hWnd == NULL) + { + return 0; + } + + switch (msg) + { + case WM_INITDIALOG: + SmMainDlgInit(hWnd); + SetTimer(hWnd, 4, 100, NULL); + + // Updater start + sm->Update = InitUpdateUi(_UU("PRODUCT_NAME_VPN_SMGR"), NAME_OF_VPN_SERVER_MANAGER, NULL, GetCurrentBuildDate(), + CEDAR_VERSION_BUILD, GetCedarVersionNumber(), NULL, false); + break; + + case WM_TIMER: + switch (wParam) + { + case 4: + KillTimer(hWnd, 4); + break; + } + break; + + case WM_COMMAND: + switch (wParam) + { + case IDOK: + DisableUpdateUi(sm->Update); + + // Connection + i = LvGetSelected(hWnd, L_SETTING); + if (i != INFINITE) + { + tmp = LvGetStr(hWnd, L_SETTING, i, 0); + if (tmp != NULL) + { + SETTING *setting = SmGetSetting(tmp); + if (setting != NULL) + { + SETTING s; + + // Record in the registry as the last choice + MsRegWriteStrW(REG_CURRENT_USER, SM_REG_KEY, "Last Select", tmp); + + // Copy the configuration + Copy(&s, setting, sizeof(SETTING)); + SmConnect(hWnd, &s); + } + Free(tmp); + } + } + break; + + case IDCANCEL: + Close(hWnd); + break; + + case B_NEW_SETTING: + DisableUpdateUi(sm->Update); + + // Add + if (SmAddSettingDlg(hWnd, new_name, sizeof(new_name))) + { + SmRefreshSettingEx(hWnd, new_name); + } + break; + + case B_EDIT_SETTING: + DisableUpdateUi(sm->Update); + + // Edit + if (SmEditSettingDlg(hWnd)) + { + SmWriteSettingList(); + SmRefreshSetting(hWnd); + } + + break; + + case B_DELETE: + DisableUpdateUi(sm->Update); + + // Delete + i = LvGetSelected(hWnd, L_SETTING); + if (i != INFINITE) + { + tmp = LvGetStr(hWnd, L_SETTING, i, 0); + if (tmp != NULL) + { + if (MsgBoxEx(hWnd, MB_ICONQUESTION | MB_YESNO | MB_DEFBUTTON2, + _UU("SM_SETTING_DELETE_MSG"), tmp) == IDYES) + { + SmDeleteSetting(tmp); + SmWriteSettingList(); + SmRefreshSetting(hWnd); + } + Free(tmp); + } + } + break; + + case B_ABOUT: + // Version information + AboutEx(hWnd, sm->Cedar, _UU("PRODUCT_NAME_VPN_SMGR"), sm->Update); + break; + + case B_SECURE_MANAGER: + DisableUpdateUi(sm->Update); + + // Smart Card Manager + SmSecureManager(hWnd); + break; + + case B_SELECT_SECURE: + DisableUpdateUi(sm->Update); + + // Smart card selection + SmSelectSecureId(hWnd); + break; + + case B_CERT_TOOL: + DisableUpdateUi(sm->Update); + + // Certificate Creation Tool + SmCreateCert(hWnd, NULL, NULL, false, NULL, false); + break; + } + + break; + + case WM_CLOSE: + // Updater terminate + if (sm->Update != NULL) + { + FreeUpdateUi(sm->Update); + sm->Update = NULL; + } + + EndDialog(hWnd, 0); + break; + + case WM_NOTIFY: + n = (NMHDR *)lParam; + switch (n->idFrom) + { + case L_SETTING: + switch (n->code) + { + case NM_DBLCLK: + Command(hWnd, IDOK); + break; + + case LVN_KEYDOWN: + key = (NMLVKEYDOWN *)n; + if (key != NULL) + { + UINT code = key->wVKey; + switch (code) + { + case VK_F2: + if (LvIsSelected(hWnd, L_SETTING)) + { + LvRename(hWnd, L_SETTING, LvGetSelected(hWnd, L_SETTING)); + } + break; + + case VK_DELETE: + Command(hWnd, B_DELETE); + break; + + case VK_RETURN: + Command(hWnd, IDOK); + break; + } + } + break; + + case LVN_ENDLABELEDITW: + // Change the name + info = (NMLVDISPINFOW *)n; + if (info->item.pszText != NULL) + { + wchar_t *new_name = info->item.pszText; + wchar_t *old_name = LvGetStr(hWnd, L_SETTING, info->item.iItem, 0); + + if (old_name != NULL) + { + if (UniStrCmp(new_name, old_name) != 0 && UniStrLen(new_name) != 0) + { + // Change the name + SETTING *s = SmGetSetting(old_name); + if (s != NULL) + { + if (SmGetSetting(new_name) != NULL) + { + MsgBoxEx(hWnd, MB_ICONEXCLAMATION, _UU("SM_SETTING_EXISTS"), + new_name); + } + else + { + UniStrCpy(s->Title, sizeof(s->Title), new_name); + Sort(sm->SettingList); + SmWriteSettingList(); + LvSetItem(hWnd, L_SETTING, info->item.iItem, 0, new_name); + } + } + } + + Free(old_name); + } + } + break; + + case LVN_ITEMCHANGED: + SmMainDlgUpdate(hWnd); + break; + } + break; + } + break; + } + + LvSortHander(hWnd, msg, wParam, lParam, L_SETTING); + + return 0; +} + +// Main window +void SmMainDlg() +{ + Dialog(NULL, D_SM_MAIN, SmMainDlgProc, NULL); +} + +// Server Manager main process +void MainSM() +{ +// MsgBoxEx(NULL, 0, L"MsIsWine: %u\n", MsIsWine()); + + if (sm->TempSetting == NULL) + { + // Open the main window + SmMainDlg(); + } + else + { + SmConnect(sm->hParentWnd, sm->TempSetting); + } +} + +// Initialize +void InitSM() +{ + InitSMEx(false); +} +void InitSMEx(bool from_cm) +{ + if (sm != NULL) + { + // Already initialized + return; + } + + sm = ZeroMalloc(sizeof(SM)); + + if (from_cm == false) + { + InitWinUi(_UU("SM_TITLE"), _SS("DEFAULT_FONT"), _II("DEFAULT_FONT_SIZE")); + } + + sm->Cedar = NewCedar(NULL, NULL); + + if (from_cm == false) + { + SmInitSettingList(); + InitCM(false); + + // Interpret the command line + SmParseCommandLine(); + } +} + +// Interpret the command line +void SmParseCommandLine() +{ + LIST *o; + CONSOLE *c = NewLocalConsole(NULL, NULL); + wchar_t *cmdline; + PARAM args[] = + { + {"[vpnserver]", NULL, NULL, NULL, NULL,}, + {"HUB", NULL, NULL, NULL, NULL,}, + {"PASSWORD", NULL, NULL, NULL, NULL,}, + {"TITLE", NULL, NULL, NULL, NULL,}, + {"HWND", NULL, NULL, NULL, NULL,}, + }; + if (c == NULL) + { + return; + } + + cmdline = GetCommandLineUniStr(); + + if (UniIsEmptyStr(cmdline) == false) + { + o = ParseCommandList(c, "vpnsmgr", cmdline, args, sizeof(args) / sizeof(args[0])); + if (o != NULL) + { + char *host; + UINT port; + + if (ParseHostPort(GetParamStr(o, "[vpnserver]"), &host, &port, 443)) + { + char *hub = GetParamStr(o, "HUB"); + char *password = GetParamStr(o, "PASSWORD"); + char *title = GetParamStr(o, "TITLE"); + char *hwndstr = GetParamStr(o, "HWND"); + + if (hub == NULL || StrCmpi(hub, "\"") == 0) + { + hub = CopyStr(""); + } + if (password == NULL) + { + password = CopyStr(""); + } + if (title == NULL) + { + title = CopyStr(host); + } + + if (IsEmptyStr(host) == false) + { + SETTING *s = ZeroMalloc(sizeof(SETTING)); + BUF *b; + CLIENT_OPTION *o; + + StrToUni(s->Title, sizeof(s->Title), title); + + if (IsEmptyStr(hub)) + { + s->ServerAdminMode = true; + } + else + { + s->ServerAdminMode = false; + StrCpy(s->HubName, sizeof(s->HubName), hub); + } + + b = StrToBin(password); + if (b == NULL || b->Size != SHA1_SIZE) + { + Sha0(s->HashedPassword, password, StrLen(password)); + } + else + { + Copy(s->HashedPassword, b->Buf, SHA1_SIZE); + } + FreeBuf(b); + + o = &s->ClientOption; + + UniStrCpy(o->AccountName, sizeof(o->AccountName), s->Title); + StrCpy(o->Hostname, sizeof(o->Hostname), host); + o->Port = port; + o->ProxyType = PROXY_DIRECT; + StrCpy(o->DeviceName, sizeof(o->DeviceName), "DUMMY"); + + sm->TempSetting = s; + + if (IsEmptyStr(hwndstr) == false) + { + sm->hParentWnd = (HWND)ToInt64(hwndstr); + } + } + + Free(hwndstr); + Free(title); + Free(hub); + Free(password); + Free(host); + } + } + } + + Free(cmdline); + + c->Free(c); +} + +// Release +void FreeSM() +{ + FreeSMEx(false); +} +void FreeSMEx(bool from_cm) +{ + if (sm == NULL) + { + // Uninitialized + return; + } + + if (from_cm == false) + { + FreeCM(); + + SmFreeSettingList(); + } + + ReleaseCedar(sm->Cedar); + + if (from_cm == false) + { + FreeWinUi(); + } + + if (sm->TempSetting != NULL) + { + Free(sm->TempSetting); + } + + Free(sm); + sm = NULL; +} + +// Running the Server Manager +void SMExec() +{ + InitSM(); + MainSM(); + FreeSM(); +} + +#endif // WIN32 + + diff --git a/src/Cedar/SM.h b/src/Cedar/SM.h index aaa0efc9..694e667e 100644 --- a/src/Cedar/SM.h +++ b/src/Cedar/SM.h @@ -1,15 +1,15 @@ -// SoftEther VPN Source Code - Developer Edition Master Branch -// Cedar Communication Module - - -// SM.h -// Header of SM.c - -#ifndef SM_H -#define SM_H - -void SMExec(); - -#endif // SM_H - - +// SoftEther VPN Source Code - Developer Edition Master Branch +// Cedar Communication Module + + +// SM.h +// Header of SM.c + +#ifndef SM_H +#define SM_H + +void SMExec(); + +#endif // SM_H + + diff --git a/src/Cedar/SMInner.h b/src/Cedar/SMInner.h index b41d2b34..9af622e1 100644 --- a/src/Cedar/SMInner.h +++ b/src/Cedar/SMInner.h @@ -1,723 +1,723 @@ -// SoftEther VPN Source Code - Developer Edition Master Branch -// Cedar Communication Module - - -// SMInner.h -// The internal header of SM.c - -// Constants -#define SM_REG_KEY "Software\\SoftEther VPN Developer Edition\\SoftEther VPN\\Server Manager" -#define SM_CERT_REG_KEY "Software\\SoftEther VPN Developer Edition\\SoftEther VPN\\Server Manager\\Cert Tool" -#define SM_SETTING_REG_KEY "Software\\SoftEther VPN Developer Edition\\SoftEther VPN\\Server Manager\\Settings" -#define SM_LASTHUB_REG_KEY "Software\\SoftEther VPN Developer Edition\\SoftEther VPN\\Server Manager\\Last HUB Name" -#define SM_HIDE_CERT_UPDATE_MSG_KEY "Software\\SoftEther VPN Developer Edition\\SoftEther VPN\\Server Manager\\Hide Cert Update Msg" - -#define NAME_OF_VPN_SERVER_MANAGER "vpnsmgr" -#define NAME_OF_VPN_SERVER_TARGET "vpnserver@%s" -#define NAME_OF_VPN_BRIDGE_TARGET "vpnbridge@%s" - -// Constants (Old value) -#define SM_SETTING_REG_KEY_OLD "Software\\SoftEther Corporation\\PacketiX VPN\\Server Manager\\Settings" - -// Connection setting -typedef struct SETTING -{ - wchar_t Title[MAX_SIZE]; // Setting Name - bool ServerAdminMode; // Server management mode - char HubName[MAX_HUBNAME_LEN + 1]; // HUB name - UCHAR HashedPassword[SHA1_SIZE]; // Password - CLIENT_OPTION ClientOption; // Client Option - UCHAR Reserved[10240 - sizeof(bool) * 8 - SHA1_SIZE]; // Reserved area -} SETTING; - -// Structure declaration -typedef struct SM -{ - CEDAR *Cedar; // Cedar - LIST *SettingList; // Setting List - SETTING *TempSetting; // Temporaly setting - HWND hParentWnd; // Parent window handle - WINUI_UPDATE *Update; // Updater -} SM; - -// Edit connection settings -typedef struct SM_EDIT_SETTING -{ - bool EditMode; // Edit mode - SETTING *OldSetting; // Pointer to the previous settings - SETTING *Setting; // Pointer to the configuration - bool Inited; // Initialized flag -} SM_EDIT_SETTING; - -// Server management dialog -typedef struct SM_SERVER -{ - RPC *Rpc; // RPC - char ServerName[MAX_HOST_NAME_LEN + 1]; // Server name - wchar_t Title[MAX_SIZE]; // Title - bool ServerAdminMode; // Server management mode - char HubName[MAX_HUBNAME_LEN + 1]; // HUB name - UINT ServerType; // Type of server - bool Bridge; // VPN Bridge product - UINT PolicyVer; // Policy version - RPC_SERVER_STATUS ServerStatus; // Server status - RPC_SERVER_INFO ServerInfo; // Server Information - CAPSLIST *CapsList; // Caps list - SETTING *CurrentSetting; // The current connection settings - wchar_t *AdminMsg; // Message for Administrators - bool IPsecMessageDisplayed; // Whether to have already displayed a message about IPsec - bool VgsMessageDisplayed; // Whether to have already displayed a message about VGS - WINUI_UPDATE *Update; // Update notification - bool IsInClient; // Within VPN Client mode -} SM_SERVER; - -typedef void (SM_STATUS_INIT_PROC)(HWND hWnd, SM_SERVER *p, void *param); -typedef bool (SM_STATUS_REFRESH_PROC)(HWND hWnd, SM_SERVER *p, void *param); - -// Information display dialog -typedef struct SM_STATUS -{ - SM_SERVER *p; // Pointer to the P - void *Param; // Parameter - UINT Icon; // Icon - wchar_t *Caption; // Title - bool show_refresh_button; // Show Updates button - bool NoImage; // No image - SM_STATUS_INIT_PROC *InitProc; - SM_STATUS_REFRESH_PROC *RefreshProc; -} SM_STATUS; - -// Virtual HUB edit dialog -typedef struct SM_EDIT_HUB -{ - SM_SERVER *p; // P - bool EditMode; // Edit mode - char HubName[MAX_HUBNAME_LEN + 1]; // HUB name -} SM_EDIT_HUB; - -// SSL related -typedef struct SM_SSL -{ - SM_SERVER *p; // P - X *Cert; // Certificate - K *Key; // Secret key - bool SetCertAndKey; // Set the key -} SM_SSL; - -// Save the certificate -typedef struct SM_SAVE_KEY_PAIR -{ - X *Cert; // Certificate - K *Key; // Secret key - char *Pass; // Passphrase -} SM_SAVE_KEY_PAIR; - -// Connection information -typedef struct SM_CONNECTION_INFO -{ - SM_SERVER *p; // P - char *ConnectionName; // Connection name -} SM_CONNECTION_INFO; - -// Management of HUB -typedef struct SM_HUB -{ - SM_SERVER *p; // P - RPC *Rpc; // RPC - char *HubName; // HUB name - char CurrentPushRouteStr[MAX_DHCP_CLASSLESS_ROUTE_TABLE_STR_SIZE]; // Current editing push routing table string -} SM_HUB; - -// Show the User list -typedef struct SM_USER -{ - SM_SERVER *p; // P - RPC *Rpc; // RPC - SM_HUB *Hub; // HUB - char *GroupName; // Filter by group name - bool SelectMode; // Selection mode - char *SelectedName; // User name of the selected - bool AllowGroup; // Allow selection of group - bool CreateNow; // Create a user immediately -} SM_USER; - -// Edit the User -typedef struct SM_EDIT_USER -{ - bool Inited; // Initialized flag - bool EditMode; // Edit mode - SM_SERVER *p; // P - RPC *Rpc; // RPC - SM_HUB *Hub; // HUB - RPC_SET_USER SetUser; // Configure the User -} SM_EDIT_USER; - -// User information -typedef struct SM_USER_INFO -{ - SM_SERVER *p; // P - RPC *Rpc; // RPC - SM_HUB *Hub; // HUB - char *Username; // Username -} SM_USER_INFO; - -// Policy -typedef struct SM_POLICY -{ - bool Inited; // Initialize - POLICY *Policy; // Policy - wchar_t *Caption; // Title - bool CascadeMode; // Cascade mode - UINT Ver; // Version -} SM_POLICY; - -// Show the Group list -typedef struct SM_GROUP -{ - SM_SERVER *p; // P - RPC *Rpc; // RPC - SM_HUB *Hub; // HUB - bool SelectMode; // Selection mode - char *SelectedGroupName; // Group name of the selected -} SM_GROUP; - -// Edit the Group -typedef struct SM_EDIT_GROUP -{ - bool Inited; // Initialization flag - bool EditMode; // Edit mode - SM_SERVER *p; // P - RPC *Rpc; // RPC - SM_HUB *Hub; // HUB - RPC_SET_GROUP SetGroup; // Group Settings -} SM_EDIT_GROUP; - -// Access list -typedef struct SM_ACCESS_LIST -{ - RPC *Rpc; // RPC - SM_HUB *Hub; // HUB - LIST *AccessList; // Access list -} SM_ACCESS_LIST; - -// Edit the access list -typedef struct SM_EDIT_ACCESS -{ - SM_HUB *Hub; // HUB - bool Inited; // Initialization flag - bool EditMode; // Edit mode - SM_ACCESS_LIST *AccessList; // Access list - ACCESS *Access; // Access list item -} SM_EDIT_ACCESS; - -// Display status of the access list -typedef struct SM_LINK -{ - SM_HUB *Hub; // HUB - wchar_t *AccountName; // Account name -} SM_LINK; - -// Session status -typedef struct SM_SESSION_STATUS -{ - SM_HUB *Hub; // HUB - char *SessionName; // Session name -} SM_SESSION_STATUS; - -// Address table -typedef struct SM_TABLE -{ - SM_HUB *Hub; // HUB - RPC *Rpc; // RPC - char *SessionName; // Session name -} SM_TABLE; - -// Certificate tool -typedef struct SM_CERT -{ - X *x; // Generated certificate - K *k; // Generated secret key - X *root_x; // Root certificate - K *root_k; // Private key of the root certificate - bool do_not_save; // Do not save to the file - char *default_cn; // Default CN - bool root_only; // Only the root certificate -} SM_CERT; - -// Config edit -typedef struct SM_CONFIG -{ - SM_SERVER *s; // SM_SERVER - RPC_CONFIG Config; // Config body -} SM_CONFIG; - -// Hub_admin_option edit -typedef struct SM_EDIT_AO -{ - SM_EDIT_HUB *e; - bool CanChange; - RPC_ADMIN_OPTION CurrentOptions; - RPC_ADMIN_OPTION DefaultOptions; - bool NewMode; - char Name[MAX_ADMIN_OPTION_NAME_LEN + 1]; - UINT Value; - bool ExtOption; -} SM_EDIT_AO; - -// Editing the switch -typedef struct SM_L3SW -{ - SM_SERVER *s; - char *SwitchName; - bool Enable; -} SM_L3SW; - -// Specify the certificate and private key in the smart card -typedef struct SM_SECURE_KEYPAIR -{ - UINT Id; - bool UseCert; - bool UseKey; - char CertName[MAX_SIZE]; - char KeyName[MAX_SIZE]; - bool Flag; - UINT BitmapId; -} SM_SECURE_KEYPAIR; - -// CRL edit -typedef struct SM_EDIT_CRL -{ - SM_HUB *s; - bool NewCrl; - UINT Key; -} SM_EDIT_CRL; - -// AC list edit -typedef struct SM_EDIT_AC_LIST -{ - SM_EDIT_HUB *s; - LIST *AcList; -} SM_EDIT_AC_LIST; - -// AC edit -typedef struct SM_EDIT_AC -{ - SM_EDIT_AC_LIST *e; - UINT id; -} SM_EDIT_AC; - -// Download the log File -typedef struct SM_READ_LOG_FILE -{ - HWND hWnd; - SM_SERVER *s; - char *server_name; - char *filepath; - UINT totalsize; - bool cancel_flag; - BUF *Buffer; -} SM_READ_LOG_FILE; - -// Setup dialog -typedef struct SM_SETUP -{ - SM_SERVER *s; - RPC *Rpc; - bool IsBridge; - bool UseRemote; // Remote Access VPN - bool UseSite; // LAN-to-LAN VPN - bool UseSiteEdge; // VPN Server / Bridge to be installed in each site - char HubName[MAX_HUBNAME_LEN + 1]; // Virtual HUB name - bool Flag1; - bool Flag2; -} SM_SETUP; - -// EtherIP ID edit dialog -typedef struct SM_ETHERIP_ID -{ - SM_SERVER *s; - bool EditMode; - char EditId[MAX_SIZE]; - bool InitCompleted; - ETHERIP_ID Data; -} SM_ETHERIP_ID; - -// DDNS dialog -typedef struct SM_DDNS -{ - SM_SERVER *s; - DDNS_CLIENT_STATUS Status; - bool Flag; - bool HostnameSetFlag; - bool Changed; - bool Silent; - bool NoChangeCert; - bool DoNotPoll; -} SM_DDNS; - -// VPN Azure dialog -typedef struct SM_AZURE -{ - SM_SERVER *s; - bool OnSetup; -} SM_AZURE; - - - -// Function prototype -void InitSM(); -void InitSMEx(bool from_cm); -void SmParseCommandLine(); -void MainSM(); -void FreeSM(); -void FreeSMEx(bool from_cm); -void SmMainDlg(); -UINT SmMainDlgProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param); -void SmMainDlgInit(HWND hWnd); -void SmMainDlgUpdate(HWND hWnd); -void SmInitSettingList(); -void SmFreeSettingList(); -void SmWriteSettingList(); -void SmLoadSettingList(); -void SmInitDefaultSettingList(); -int SmCompareSetting(void *p1, void *p2); -SETTING *SmGetSetting(wchar_t *title); -bool SmAddSetting(SETTING *s); -void SmDeleteSetting(wchar_t *title); -bool SmCheckNewName(SETTING *s, wchar_t *new_title); -void SmRefreshSetting(HWND hWnd); -void SmRefreshSettingEx(HWND hWnd, wchar_t *select_name); -bool SmAddSettingDlg(HWND hWnd, wchar_t *new_name, UINT new_name_size); -bool SmEditSettingDlg(HWND hWnd); -UINT SmEditSettingDlgProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param); -void SmEditSettingDlgInit(HWND hWnd, SM_EDIT_SETTING *p); -void SmEditSettingDlgUpdate(HWND hWnd, SM_EDIT_SETTING *p); -void SmEditSettingDlgOnOk(HWND hWnd, SM_EDIT_SETTING *p); -void SmConnect(HWND hWnd, SETTING *s); -void SmConnectEx(HWND hWnd, SETTING *s, bool is_in_client); -char *SmPassword(HWND hWnd, char *server_name); -UINT SmServerDlgProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param); -void SmServerDlgInit(HWND hWnd, SM_SERVER *p); -void SmServerDlgUpdate(HWND hWnd, SM_SERVER *p); -void SmServerDlgRefresh(HWND hWnd, SM_SERVER *p); -void SmStatusDlg(HWND hWnd, SM_SERVER *p, void *param, bool no_image, bool show_refresh_button, wchar_t *caption, UINT icon, - SM_STATUS_INIT_PROC *init, SM_STATUS_REFRESH_PROC *refresh); -UINT SmStatusDlgProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param); -bool SmRefreshHubStatus(HWND hWnd, SM_SERVER *p, void *param); -void SmInsertTrafficInfo(LVB *b, TRAFFIC *t); -bool SmCreateHubDlg(HWND hWnd, SM_SERVER *p); -bool SmEditHubDlg(HWND hWnd, SM_SERVER *p, char *hubname); -UINT SmEditHubProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param); -void SmEditHubInit(HWND hWnd, SM_EDIT_HUB *s); -void SmEditHubUpdate(HWND hWnd, SM_EDIT_HUB *s); -void SmEditHubOnOk(HWND hWnd, SM_EDIT_HUB *s); -bool SmCreateListenerDlg(HWND hWnd, SM_SERVER *p); -UINT SmCreateListenerDlgProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param); -void SmSslDlg(HWND hWnd, SM_SERVER *p); -UINT SmSslDlgProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param); -void SmSslDlgInit(HWND hWnd, SM_SSL *s); -void SmSslDlgOnOk(HWND hWnd, SM_SSL *s); -void SmSslDlgUpdate(HWND hWnd, SM_SSL *s); -void SmGetCertInfoStr(wchar_t *str, UINT size, X *x); -bool SmRegenerateServerCert(HWND hWnd, SM_SERVER *server, char *default_cn, X **x, K **k, bool root_only); -bool SmSaveKeyPairDlg(HWND hWnd, X *x, K *k); -UINT SmSaveKeyPairDlgProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param); -void SmSaveKeyPairDlgInit(HWND hWnd, SM_SAVE_KEY_PAIR *s); -void SmSaveKeyPairDlgUpdate(HWND hWnd, SM_SAVE_KEY_PAIR *s); -void SmSaveKeyPairDlgOnOk(HWND hWnd, SM_SAVE_KEY_PAIR *s); -bool SmRefreshServerStatus(HWND hWnd, SM_SERVER *p, void *param); -bool SmRefreshServerInfo(HWND hWnd, SM_SERVER *p, void *param); -void SmPrintNodeInfo(LVB *b, NODE_INFO *info); -wchar_t *SmGetConnectionTypeStr(UINT type); -void SmConnectionDlg(HWND hWnd, SM_SERVER *p); -UINT SmConnectionDlgProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param); -void SmConnectionDlgInit(HWND hWnd, SM_SERVER *p); -void SmConnectionDlgRefresh(HWND hWnd, SM_SERVER *p); -void SmConnectionDlgUpdate(HWND hWnd, SM_SERVER *p); -bool SmRefreshConnectionStatus(HWND hWnd, SM_SERVER *p, void *param); -bool SmFarmDlg(HWND hWnd, SM_SERVER *p); -UINT SmFarmDlgProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param); -void SmFarmDlgInit(HWND hWnd, SM_SERVER *p); -void SmFarmDlgUpdate(HWND hWnd, SM_SERVER *p); -void SmFarmDlgOnOk(HWND hWnd, SM_SERVER *p); -UINT SmFarmMemberDlgProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param); -void SmFarmMemberDlgInit(HWND hWnd, SM_SERVER *p); -void SmFarmMemberDlgUpdate(HWND hWnd, SM_SERVER *p); -void SmFarmMemberDlgRefresh(HWND hWnd, SM_SERVER *p); -void SmFarmMemberDlgOnOk(HWND hWnd, SM_SERVER *p); -void SmFarmMemberCert(HWND hWnd, SM_SERVER *p, UINT id); -bool SmRefreshFarmMemberInfo(HWND hWnd, SM_SERVER *p, void *param); -bool SmRefreshFarmConnectionInfo(HWND hWnd, SM_SERVER *p, void *param); -UINT SmChangeServerPasswordDlg(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param); -void SmHubDlg(HWND hWnd, SM_HUB *s); -UINT SmHubDlgProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param); -void SmHubDlgInit(HWND hWnd, SM_HUB *s); -void SmHubDlgUpdate(HWND hWnd, SM_HUB *s); -void SmHubDlgRefresh(HWND hWnd, SM_HUB *s); -void SmUserListDlg(HWND hWnd, SM_HUB *s); -UINT SmUserListProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param); -void SmUserListInit(HWND hWnd, SM_USER *s); -void SmUserListRefresh(HWND hWnd, SM_USER *s); -void SmUserListUpdate(HWND hWnd, SM_USER *s); -wchar_t *SmGetAuthTypeStr(UINT id); -bool SmCreateUserDlg(HWND hWnd, SM_HUB *s); -UINT SmEditUserDlgProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param); -void SmEditUserDlgInit(HWND hWnd, SM_EDIT_USER *s); -void SmEditUserDlgUpdate(HWND hWnd, SM_EDIT_USER *s); -void SmEditUserDlgOk(HWND hWnd, SM_EDIT_USER *s); -bool SmPolicyDlg(HWND hWnd, POLICY *p, wchar_t *caption); -bool SmPolicyDlgEx(HWND hWnd, POLICY *p, wchar_t *caption, bool cascade_mode); -bool SmPolicyDlgEx2(HWND hWnd, POLICY *p, wchar_t *caption, bool cascade_mode, UINT ver); -UINT SmPolicyDlgProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param); -void SmPolicyDlgInit(HWND hWnd, SM_POLICY *s); -void SmPolicyDlgUpdate(HWND hWnd, SM_POLICY *s); -void SmPolicyDlgOk(HWND hWnd, SM_POLICY *s); -bool SmEditUserDlg(HWND hWnd, SM_HUB *s, char *username); -bool SmRefreshUserInfo(HWND hWnd, SM_SERVER *s, void *param); -void SmGroupListDlg(HWND hWnd, SM_HUB *s); -char *SmSelectGroupDlg(HWND hWnd, SM_HUB *s, char *default_name); -UINT SmGroupListDlgProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param); -void SmGroupListDlgInit(HWND hWnd, SM_GROUP *s); -void SmGroupListDlgUpdate(HWND hWnd, SM_GROUP *s); -void SmGroupListDlgRefresh(HWND hWnd, SM_GROUP *s); -bool SmCreateGroupDlg(HWND hWnd, SM_GROUP *s); -bool SmEditGroupDlg(HWND hWnd, SM_GROUP *s, char *name); -UINT SmEditGroupDlgProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param); -void SmEditGroupDlgInit(HWND hWnd, SM_EDIT_GROUP *g); -void SmEditGroupDlgUpdate(HWND hWnd, SM_EDIT_GROUP *g); -void SmEditGroupDlgOnOk(HWND hWnd, SM_EDIT_GROUP *g); -void SmUserListDlgEx(HWND hWnd, SM_HUB *s, char *groupname, bool create); -void SmAccessListDlg(HWND hWnd, SM_HUB *s); -UINT SmAccessListProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param); -void SmAccessListInit(HWND hWnd, SM_ACCESS_LIST *s); -void SmAccessListUpdate(HWND hWnd, SM_ACCESS_LIST *s); -void SmAccessListRefresh(HWND hWnd, SM_ACCESS_LIST *s); -bool SmAddAccess(HWND hWnd, SM_ACCESS_LIST *s, bool ipv6); -bool SmCloneAccess(HWND hWnd, SM_ACCESS_LIST *s, ACCESS *t); -bool SmEditAccess(HWND hWnd, SM_ACCESS_LIST *s, ACCESS *a); -UINT SmEditAccessDlg(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param); -void SmEditAccessInit(HWND hWnd, SM_EDIT_ACCESS *s); -void SmEditAccessUpdate(HWND hWnd, SM_EDIT_ACCESS *s); -void SmEditAccessOnOk(HWND hWnd, SM_EDIT_ACCESS *s); -void SmRedirect(HWND hWnd, SM_EDIT_ACCESS *s); -UINT SmRedirectDlg(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param); -void SmRedirectDlgInit(HWND hWnd, SM_EDIT_ACCESS *s); -void SmRedirectDlgUpdate(HWND hWnd, SM_EDIT_ACCESS *s); -UINT SmSimulationDlg(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param); -void SmSimulationUpdate(HWND hWnd, SM_EDIT_ACCESS *s); -void SmSimulationInit(HWND hWnd, SM_EDIT_ACCESS *s); -void SmSimulationOnOk(HWND hWnd, SM_EDIT_ACCESS *s); -char *SmSelectUserDlg(HWND hWnd, SM_HUB *s, char *default_name); -char *SmSelectUserDlgEx(HWND hWnd, SM_HUB *s, char *default_name, bool allow_group); -void SmRadiusDlg(HWND hWnd, SM_HUB *s); -UINT SmRadiusDlgProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param); -void SmRadiusDlgInit(HWND hWnd, SM_HUB *s); -void SmRadiusDlgUpdate(HWND hWnd, SM_HUB *s); -void SmRadiusDlgOnOk(HWND hWnd, SM_HUB *s); -void SmLinkDlg(HWND hWnd, SM_HUB *s); -void SmLinkDlgEx(HWND hWnd, SM_HUB *s, bool createNow); -UINT SmLinkDlgProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param); -void SmLinkDlgInit(HWND hWnd, SM_HUB *s); -void SmLinkDlgUpdate(HWND hWnd, SM_HUB *s); -void SmLinkDlgRefresh(HWND hWnd, SM_HUB *s); -bool SmLinkCreate(HWND hWnd, SM_HUB *s); -bool SmLinkCreateEx(HWND hWnd, SM_HUB *s, bool connectNow); -bool SmLinkEdit(HWND hWnd, SM_HUB *s, wchar_t *name); -bool SmRefreshLinkStatus(HWND hWnd, SM_SERVER *s, void *param); -UINT SmLogDlg(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param); -void SmLogDlgInit(HWND hWnd, SM_HUB *s); -void SmLogDlgUpdate(HWND hWnd, SM_HUB *s); -void SmLogDlgOnOk(HWND hWnd, SM_HUB *s); -void SmCaDlg(HWND hWnd, SM_HUB *s); -UINT SmCaDlgProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param); -void SmCaDlgInit(HWND hWnd, SM_HUB *s); -void SmCaDlgRefresh(HWND hWnd, SM_HUB *s); -void SmCaDlgUpdate(HWND hWnd, SM_HUB *s); -void SmCaDlgOnOk(HWND hWnd, SM_HUB *s); -bool SmCaDlgAdd(HWND hWnd, SM_HUB *s); -void SmSessionDlg(HWND hWnd, SM_HUB *s); -UINT SmSessionDlgProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param); -void SmSessionDlgInit(HWND hWnd, SM_HUB *s); -void SmSessionDlgUpdate(HWND hWnd, SM_HUB *s); -void SmSessionDlgRefresh(HWND hWnd, SM_HUB *s); -bool SmRefreshSessionStatus(HWND hWnd, SM_SERVER *s, void *param); -void SmMacTableDlg(HWND hWnd, SM_HUB *s, char *session_name); -UINT SmMacTableDlgProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param); -void SmMacTableDlgInit(HWND hWnd, SM_TABLE *s); -void SmMacTableDlgUpdate(HWND hWnd, SM_TABLE *s); -void SmMacTableDlgRefresh(HWND hWnd, SM_TABLE *s); -void SmIpTableDlg(HWND hWnd, SM_HUB *s, char *session_name); -UINT SmIpTableDlgProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param); -void SmIpTableDlgInit(HWND hWnd, SM_TABLE *s); -void SmIpTableDlgUpdate(HWND hWnd, SM_TABLE *s); -void SmIpTableDlgRefresh(HWND hWnd, SM_TABLE *s); -bool SmCreateCert(HWND hWnd, X **x, K **k, bool do_not_save, char *default_cn, bool root_only); -UINT SmCreateCertDlgProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param); -void SmCreateCertDlgInit(HWND hWnd, SM_CERT *s); -void SmCreateCertDlgUpdate(HWND hWnd, SM_CERT *s); -void SmCreateCertDlgOnOk(HWND hWnd, SM_CERT *s); -UINT SmSNATDlgProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param); -void SmSNATDlgUpdate(HWND hWnd, SM_HUB *s); -void SmBridgeDlg(HWND hWnd, SM_SERVER *s); -void SmInstallWinPcap(HWND hWnd, SM_SERVER *s); -UINT SmBridgeDlgProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param); -UINT SmBridgeDlgInit(HWND hWnd, SM_SERVER *s); -void SmBridgeDlgUpdate(HWND hWnd, SM_SERVER *s); -void SmBridgeDlgRefresh(HWND hWnd, SM_SERVER *s); -void SmBridgeDlgOnOk(HWND hWnd, SM_SERVER *s); -void SmAddServerCaps(LVB *b, CAPSLIST *t); -void SmConfig(HWND hWnd, SM_SERVER *s); -UINT SmConfigDlg(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param); -void SmConfigDlgInit(HWND hWnd, SM_CONFIG *c); -void SmHubAdminOption(HWND hWnd, SM_EDIT_HUB *e); -void SmHubExtOption(HWND hWnd, SM_EDIT_HUB *e); -UINT SmHubAdminOptionDlg(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param); -void SmHubAdminOptionDlgUpdate(HWND hWnd, SM_EDIT_AO *a); -void SmHubAdminOptionDlgInit(HWND hWnd, SM_EDIT_AO *a); -void SmHubAdminOptionDlgOk(HWND hWnd, SM_EDIT_AO *a); -UINT SmHubAdminOptionValueDlg(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param); -void SmHubAdminOptionValueDlgUpdate(HWND hWnd, SM_EDIT_AO *a); -void SmL3(HWND hWnd, SM_SERVER *s); -UINT SmL3Dlg(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param); -void SmL3DlgInit(HWND hWnd, SM_SERVER *s); -void SmL3DlgUpdate(HWND hWnd, SM_SERVER *s); -void SmL3DlgRefresh(HWND hWnd, SM_SERVER *s); -UINT SmL3AddDlg(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param); -void SmL3AddDlgUpdate(HWND hWnd, SM_SERVER *s); -UINT SmL3SwDlg(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param); -void SmL3SwDlgInit(HWND hWnd, SM_L3SW *w); -void SmL3SwDlgUpdate(HWND hWnd, SM_L3SW *w); -void SmL3SwDlgRefresh(HWND hWnd, SM_L3SW *w); -UINT SmL3SwIfDlg(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param); -void SmL3SwIfDlgInit(HWND hWnd, SM_L3SW *w); -void SmL3SwIfDlgUpdate(HWND hWnd, SM_L3SW *w); -UINT SmL3SwTableDlg(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param); -void SmL3SwTableDlgInit(HWND hWnd, SM_L3SW *w); -void SmL3SwTableDlgUpdate(HWND hWnd, SM_L3SW *w); -bool SmL3IsSwActive(SM_SERVER *s, char *name); -UINT SmGetCurrentSecureId(HWND hWnd); -UINT SmGetCurrentSecureIdFromReg(); -UINT SmSelectSecureId(HWND hWnd); -void SmWriteSelectSecureIdReg(UINT id); -bool SmSelectKeyPair(HWND hWnd, char *cert_name, UINT cert_name_size, char *key_name, UINT key_name_size); -bool SmSelectKeyPairEx(HWND hWnd, char *cert_name, UINT cert_name_size, char *key_name, UINT key_name_size, UINT bitmap_id); -UINT SmSelectKeyPairDlg(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param); -void SmSelectKeyPairDlgInit(HWND hWnd, SM_SECURE_KEYPAIR *k); -void SmSelectKeyPairDlgUpdate(HWND hWnd, SM_SECURE_KEYPAIR *k); -void SmSelectKeyPairDlgRefresh(HWND hWnd, SM_SECURE_KEYPAIR *k); -void SmSecureManager(HWND hWnd); -UINT SmCrlDlgProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param); -void SmCrlDlgInit(HWND hWnd, SM_HUB *s); -void SmCrlDlgUpdate(HWND hWnd, SM_HUB *s); -void SmCrlDlgRefresh(HWND hWnd, SM_HUB *s); -UINT SmEditCrlDlgProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param); -void SmEditCrlDlgInit(HWND hWnd, SM_EDIT_CRL *c); -void SmEditCrlDlgUpdate(HWND hWnd, SM_EDIT_CRL *c); -void SmEditCrlDlgOnOk(HWND hWnd, SM_EDIT_CRL *c); -void SmEditCrlDlgOnLoad(HWND hWnd, SM_EDIT_CRL *c); -void SmEditCrlDlgSetName(HWND hWnd, NAME *name); -void SmEditCrlDlgSetSerial(HWND hWnd, X_SERIAL *serial); -void SmEditCrlDlgSetHash(HWND hWnd, UCHAR *hash_md5, UCHAR *hash_sha1); -void SmHubAc(HWND hWnd, SM_EDIT_HUB *s); -UINT SmHubAcDlgProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param); -void SmHubAcDlgInit(HWND hWnd, SM_EDIT_AC_LIST *p); -void SmHubAcDlgUpdate(HWND hWnd, SM_EDIT_AC_LIST *p); -void SmHubAcDlgRefresh(HWND hWnd, SM_EDIT_AC_LIST *p); -UINT SmHubEditAcDlgProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param); -void SmHubEditAcDlgInit(HWND hWnd, SM_EDIT_AC *p); -void SmHubEditAcDlgUpdate(HWND hWnd, SM_EDIT_AC *p); -void SmHubEditAcDlgOnOk(HWND hWnd, SM_EDIT_AC *p); -UINT SmLogFileDlgProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param); -void SmLogFileDlgInit(HWND hWnd, SM_SERVER *p); -void SmLogFileDlgRefresh(HWND hWnd, SM_SERVER *p); -void SmLogFileDlgUpdate(HWND hWnd, SM_SERVER *p); -void SmLogFileStartDownload(HWND hWnd, SM_SERVER *s, char *server_name, char *filepath, UINT totalsize); -UINT SmReadLogFile(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param); -bool SmReadLogFileProc(DOWNLOAD_PROGRESS *g); -UINT SmSaveLogProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param); -void SmLicense(HWND hWnd, SM_SERVER *s); -UINT SmLicenseDlg(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param); -void SmLicenseDlgInit(HWND hWnd, SM_SERVER *s); -void SmLicenseDlgRefresh(HWND hWnd, SM_SERVER *s); -void SmLicenseDlgUpdate(HWND hWnd, SM_SERVER *s); -bool SmLicenseAdd(HWND hWnd, SM_SERVER *s); -UINT SmLicenseAddDlg(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param); -void SmLicenseAddDlgInit(HWND hWnd, SM_SERVER *s); -void SmLicenseAddDlgUpdate(HWND hWnd, SM_SERVER *s); -void SmLicenseAddDlgShiftTextItem(HWND hWnd, UINT id1, UINT id2, UINT *next_focus); -void SmLicenseAddDlgGetText(HWND hWnd, char *str, UINT size); -void SmLicenseAddDlgOnOk(HWND hWnd, SM_SERVER *s); -bool SmSetup(HWND hWnd, SM_SERVER *s); -UINT SmSetupDlg(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param); -void SmSetupDlgInit(HWND hWnd, SM_SETUP *s); -void SmSetupDlgUpdate(HWND hWnd, SM_SETUP *s); -void SmSetupDlgOnOk(HWND hWnd, SM_SETUP *s); -UINT SmSetupHubDlg(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param); -void SmSetupHubDlgUpdate(HWND hWnd, SM_SETUP *s); -bool SmSetupInit(HWND hWnd, SM_SETUP *s); -bool SmSetupDeleteAllHub(HWND hWnd, SM_SETUP *s); -bool SmSetupDeleteAllLocalBridge(HWND hWnd, SM_SETUP *s); -bool SmSetupDeleteAllLayer3(HWND hWnd, SM_SETUP *s); -bool SmSetupDeleteAllObjectInBridgeHub(HWND hWnd, SM_SETUP *s); -void SmSetupStep(HWND hWnd, SM_SETUP *s); -UINT SmSetupStepDlg(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param); -void SmSetupStepDlgInit(HWND hWnd, SM_SETUP *s); -void SmSetupOnClose(HWND hWnd, SM_SETUP *s); -bool SmSetupIsNew(SM_SERVER *s); -void SmVLan(HWND hWnd, SM_SERVER *s); -UINT SmVLanDlg(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param); -void SmVLanDlgInit(HWND hWnd, SM_SERVER *s); -void SmVLanDlgRefresh(HWND hWnd, SM_SERVER *s); -void SmVLanDlgUpdate(HWND hWnd, SM_SERVER *s); -void SmHubMsg(HWND hWnd, SM_EDIT_HUB *s); -UINT SmHubMsgDlg(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param); -void SmHubMsgDlgInit(HWND hWnd, SM_EDIT_HUB *s); -void SmHubMsgDlgUpdate(HWND hWnd, SM_EDIT_HUB *s); -void SmHubMsgDlgOnOk(HWND hWnd, SM_EDIT_HUB *s); -void SmIPsec(HWND hWnd, SM_SERVER *s); -UINT SmIPsecDlg(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param); -void SmIPsecDlgInit(HWND hWnd, SM_SERVER *s); -void SmIPsecDlgOnOk(HWND hWnd, SM_SERVER *s); -void SmIPsecDlgUpdate(HWND hWnd, SM_SERVER *s); -void SmIPsecDlgGetSetting(HWND hWnd, IPSEC_SERVICES *sl); -void SmEtherIp(HWND hWnd, SM_SERVER *s); -UINT SmEtherIpDlg(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param); -void SmEtherIpDlgInit(HWND hWnd, SM_SERVER *s); -void SmEtherIpDlgRefresh(HWND hWnd, SM_SERVER *s); -void SmEtherIpDlgUpdate(HWND hWnd, SM_SERVER *s); -bool SmEtherIpId(HWND hWnd, SM_ETHERIP_ID *t); -UINT SmEtherIpIdDlg(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param); -void SmEtherIpIdDlgInit(HWND hWnd, SM_ETHERIP_ID *t); -void SmEtherIpIdDlgOnOk(HWND hWnd, SM_ETHERIP_ID *t); -void SmEtherIpIdDlgUpdate(HWND hWnd, SM_ETHERIP_ID *t); -void SmEtherIpIdDlgGetSetting(HWND hWnd, SM_ETHERIP_ID *t); -bool SmDDns(HWND hWnd, SM_SERVER *s, bool silent, bool no_change_cert); -UINT SmDDnsDlg(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param); -void SmDDnsDlgInit(HWND hWnd, SM_DDNS *d); -void SmDDnsRefresh(HWND hWnd, SM_DDNS *d); -void SmDDnsDlgOnOk(HWND hWnd, SM_DDNS *d); -void SmDDnsDlgUpdate(HWND hWnd, SM_DDNS *d); -void SmOpenVpn(HWND hWnd, SM_SERVER *s); -UINT SmOpenVpnDlg(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param); -void SmOpenVpnDlgInit(HWND hWnd, SM_SERVER *s); -void SmOpenVpnDlgOnOk(HWND hWnd, SM_SERVER *s, bool no_close); -void SmOpenVpnDlgUpdate(HWND hWnd, SM_SERVER *s); -void SmOpenVpn(HWND hWnd, SM_SERVER *s); -void SmSpecialListener(HWND hWnd, SM_SERVER *s); -UINT SmSpecialListenerDlg(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param); -void SmSpecialListenerDlgInit(HWND hWnd, SM_SERVER *s); -void SmSpecialListenerDlgOnOk(HWND hWnd, SM_SERVER *s); -void SmShowIPSecMessageIfNecessary(HWND hWnd, SM_SERVER *p); -void SmShowCertRegenerateMessageIfNecessary(HWND hWnd, SM_SERVER *p); -UINT SmVmBridgeDlg(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param); -void SmAzure(HWND hWnd, SM_SERVER *s, bool on_setup); -UINT SmAzureDlg(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param); -void SmAzureDlgOnInit(HWND hWnd, SM_AZURE *a); -void SmAzureDlgRefresh(HWND hWnd, SM_AZURE *a); -void SmAzureSetStatus(HWND hWnd, SM_AZURE *a); -bool SmProxy(HWND hWnd, INTERNET_SETTING *t); -UINT SmProxyDlg(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param); -void SmProxyDlgInit(HWND hWnd, INTERNET_SETTING *t); -void SmProxyDlgUpdate(HWND hWnd, INTERNET_SETTING *t); - - +// SoftEther VPN Source Code - Developer Edition Master Branch +// Cedar Communication Module + + +// SMInner.h +// The internal header of SM.c + +// Constants +#define SM_REG_KEY "Software\\SoftEther VPN Developer Edition\\SoftEther VPN\\Server Manager" +#define SM_CERT_REG_KEY "Software\\SoftEther VPN Developer Edition\\SoftEther VPN\\Server Manager\\Cert Tool" +#define SM_SETTING_REG_KEY "Software\\SoftEther VPN Developer Edition\\SoftEther VPN\\Server Manager\\Settings" +#define SM_LASTHUB_REG_KEY "Software\\SoftEther VPN Developer Edition\\SoftEther VPN\\Server Manager\\Last HUB Name" +#define SM_HIDE_CERT_UPDATE_MSG_KEY "Software\\SoftEther VPN Developer Edition\\SoftEther VPN\\Server Manager\\Hide Cert Update Msg" + +#define NAME_OF_VPN_SERVER_MANAGER "vpnsmgr" +#define NAME_OF_VPN_SERVER_TARGET "vpnserver@%s" +#define NAME_OF_VPN_BRIDGE_TARGET "vpnbridge@%s" + +// Constants (Old value) +#define SM_SETTING_REG_KEY_OLD "Software\\SoftEther Corporation\\PacketiX VPN\\Server Manager\\Settings" + +// Connection setting +typedef struct SETTING +{ + wchar_t Title[MAX_SIZE]; // Setting Name + bool ServerAdminMode; // Server management mode + char HubName[MAX_HUBNAME_LEN + 1]; // HUB name + UCHAR HashedPassword[SHA1_SIZE]; // Password + CLIENT_OPTION ClientOption; // Client Option + UCHAR Reserved[10240 - sizeof(bool) * 8 - SHA1_SIZE]; // Reserved area +} SETTING; + +// Structure declaration +typedef struct SM +{ + CEDAR *Cedar; // Cedar + LIST *SettingList; // Setting List + SETTING *TempSetting; // Temporaly setting + HWND hParentWnd; // Parent window handle + WINUI_UPDATE *Update; // Updater +} SM; + +// Edit connection settings +typedef struct SM_EDIT_SETTING +{ + bool EditMode; // Edit mode + SETTING *OldSetting; // Pointer to the previous settings + SETTING *Setting; // Pointer to the configuration + bool Inited; // Initialized flag +} SM_EDIT_SETTING; + +// Server management dialog +typedef struct SM_SERVER +{ + RPC *Rpc; // RPC + char ServerName[MAX_HOST_NAME_LEN + 1]; // Server name + wchar_t Title[MAX_SIZE]; // Title + bool ServerAdminMode; // Server management mode + char HubName[MAX_HUBNAME_LEN + 1]; // HUB name + UINT ServerType; // Type of server + bool Bridge; // VPN Bridge product + UINT PolicyVer; // Policy version + RPC_SERVER_STATUS ServerStatus; // Server status + RPC_SERVER_INFO ServerInfo; // Server Information + CAPSLIST *CapsList; // Caps list + SETTING *CurrentSetting; // The current connection settings + wchar_t *AdminMsg; // Message for Administrators + bool IPsecMessageDisplayed; // Whether to have already displayed a message about IPsec + bool VgsMessageDisplayed; // Whether to have already displayed a message about VGS + WINUI_UPDATE *Update; // Update notification + bool IsInClient; // Within VPN Client mode +} SM_SERVER; + +typedef void (SM_STATUS_INIT_PROC)(HWND hWnd, SM_SERVER *p, void *param); +typedef bool (SM_STATUS_REFRESH_PROC)(HWND hWnd, SM_SERVER *p, void *param); + +// Information display dialog +typedef struct SM_STATUS +{ + SM_SERVER *p; // Pointer to the P + void *Param; // Parameter + UINT Icon; // Icon + wchar_t *Caption; // Title + bool show_refresh_button; // Show Updates button + bool NoImage; // No image + SM_STATUS_INIT_PROC *InitProc; + SM_STATUS_REFRESH_PROC *RefreshProc; +} SM_STATUS; + +// Virtual HUB edit dialog +typedef struct SM_EDIT_HUB +{ + SM_SERVER *p; // P + bool EditMode; // Edit mode + char HubName[MAX_HUBNAME_LEN + 1]; // HUB name +} SM_EDIT_HUB; + +// SSL related +typedef struct SM_SSL +{ + SM_SERVER *p; // P + X *Cert; // Certificate + K *Key; // Secret key + bool SetCertAndKey; // Set the key +} SM_SSL; + +// Save the certificate +typedef struct SM_SAVE_KEY_PAIR +{ + X *Cert; // Certificate + K *Key; // Secret key + char *Pass; // Passphrase +} SM_SAVE_KEY_PAIR; + +// Connection information +typedef struct SM_CONNECTION_INFO +{ + SM_SERVER *p; // P + char *ConnectionName; // Connection name +} SM_CONNECTION_INFO; + +// Management of HUB +typedef struct SM_HUB +{ + SM_SERVER *p; // P + RPC *Rpc; // RPC + char *HubName; // HUB name + char CurrentPushRouteStr[MAX_DHCP_CLASSLESS_ROUTE_TABLE_STR_SIZE]; // Current editing push routing table string +} SM_HUB; + +// Show the User list +typedef struct SM_USER +{ + SM_SERVER *p; // P + RPC *Rpc; // RPC + SM_HUB *Hub; // HUB + char *GroupName; // Filter by group name + bool SelectMode; // Selection mode + char *SelectedName; // User name of the selected + bool AllowGroup; // Allow selection of group + bool CreateNow; // Create a user immediately +} SM_USER; + +// Edit the User +typedef struct SM_EDIT_USER +{ + bool Inited; // Initialized flag + bool EditMode; // Edit mode + SM_SERVER *p; // P + RPC *Rpc; // RPC + SM_HUB *Hub; // HUB + RPC_SET_USER SetUser; // Configure the User +} SM_EDIT_USER; + +// User information +typedef struct SM_USER_INFO +{ + SM_SERVER *p; // P + RPC *Rpc; // RPC + SM_HUB *Hub; // HUB + char *Username; // Username +} SM_USER_INFO; + +// Policy +typedef struct SM_POLICY +{ + bool Inited; // Initialize + POLICY *Policy; // Policy + wchar_t *Caption; // Title + bool CascadeMode; // Cascade mode + UINT Ver; // Version +} SM_POLICY; + +// Show the Group list +typedef struct SM_GROUP +{ + SM_SERVER *p; // P + RPC *Rpc; // RPC + SM_HUB *Hub; // HUB + bool SelectMode; // Selection mode + char *SelectedGroupName; // Group name of the selected +} SM_GROUP; + +// Edit the Group +typedef struct SM_EDIT_GROUP +{ + bool Inited; // Initialization flag + bool EditMode; // Edit mode + SM_SERVER *p; // P + RPC *Rpc; // RPC + SM_HUB *Hub; // HUB + RPC_SET_GROUP SetGroup; // Group Settings +} SM_EDIT_GROUP; + +// Access list +typedef struct SM_ACCESS_LIST +{ + RPC *Rpc; // RPC + SM_HUB *Hub; // HUB + LIST *AccessList; // Access list +} SM_ACCESS_LIST; + +// Edit the access list +typedef struct SM_EDIT_ACCESS +{ + SM_HUB *Hub; // HUB + bool Inited; // Initialization flag + bool EditMode; // Edit mode + SM_ACCESS_LIST *AccessList; // Access list + ACCESS *Access; // Access list item +} SM_EDIT_ACCESS; + +// Display status of the access list +typedef struct SM_LINK +{ + SM_HUB *Hub; // HUB + wchar_t *AccountName; // Account name +} SM_LINK; + +// Session status +typedef struct SM_SESSION_STATUS +{ + SM_HUB *Hub; // HUB + char *SessionName; // Session name +} SM_SESSION_STATUS; + +// Address table +typedef struct SM_TABLE +{ + SM_HUB *Hub; // HUB + RPC *Rpc; // RPC + char *SessionName; // Session name +} SM_TABLE; + +// Certificate tool +typedef struct SM_CERT +{ + X *x; // Generated certificate + K *k; // Generated secret key + X *root_x; // Root certificate + K *root_k; // Private key of the root certificate + bool do_not_save; // Do not save to the file + char *default_cn; // Default CN + bool root_only; // Only the root certificate +} SM_CERT; + +// Config edit +typedef struct SM_CONFIG +{ + SM_SERVER *s; // SM_SERVER + RPC_CONFIG Config; // Config body +} SM_CONFIG; + +// Hub_admin_option edit +typedef struct SM_EDIT_AO +{ + SM_EDIT_HUB *e; + bool CanChange; + RPC_ADMIN_OPTION CurrentOptions; + RPC_ADMIN_OPTION DefaultOptions; + bool NewMode; + char Name[MAX_ADMIN_OPTION_NAME_LEN + 1]; + UINT Value; + bool ExtOption; +} SM_EDIT_AO; + +// Editing the switch +typedef struct SM_L3SW +{ + SM_SERVER *s; + char *SwitchName; + bool Enable; +} SM_L3SW; + +// Specify the certificate and private key in the smart card +typedef struct SM_SECURE_KEYPAIR +{ + UINT Id; + bool UseCert; + bool UseKey; + char CertName[MAX_SIZE]; + char KeyName[MAX_SIZE]; + bool Flag; + UINT BitmapId; +} SM_SECURE_KEYPAIR; + +// CRL edit +typedef struct SM_EDIT_CRL +{ + SM_HUB *s; + bool NewCrl; + UINT Key; +} SM_EDIT_CRL; + +// AC list edit +typedef struct SM_EDIT_AC_LIST +{ + SM_EDIT_HUB *s; + LIST *AcList; +} SM_EDIT_AC_LIST; + +// AC edit +typedef struct SM_EDIT_AC +{ + SM_EDIT_AC_LIST *e; + UINT id; +} SM_EDIT_AC; + +// Download the log File +typedef struct SM_READ_LOG_FILE +{ + HWND hWnd; + SM_SERVER *s; + char *server_name; + char *filepath; + UINT totalsize; + bool cancel_flag; + BUF *Buffer; +} SM_READ_LOG_FILE; + +// Setup dialog +typedef struct SM_SETUP +{ + SM_SERVER *s; + RPC *Rpc; + bool IsBridge; + bool UseRemote; // Remote Access VPN + bool UseSite; // LAN-to-LAN VPN + bool UseSiteEdge; // VPN Server / Bridge to be installed in each site + char HubName[MAX_HUBNAME_LEN + 1]; // Virtual HUB name + bool Flag1; + bool Flag2; +} SM_SETUP; + +// EtherIP ID edit dialog +typedef struct SM_ETHERIP_ID +{ + SM_SERVER *s; + bool EditMode; + char EditId[MAX_SIZE]; + bool InitCompleted; + ETHERIP_ID Data; +} SM_ETHERIP_ID; + +// DDNS dialog +typedef struct SM_DDNS +{ + SM_SERVER *s; + DDNS_CLIENT_STATUS Status; + bool Flag; + bool HostnameSetFlag; + bool Changed; + bool Silent; + bool NoChangeCert; + bool DoNotPoll; +} SM_DDNS; + +// VPN Azure dialog +typedef struct SM_AZURE +{ + SM_SERVER *s; + bool OnSetup; +} SM_AZURE; + + + +// Function prototype +void InitSM(); +void InitSMEx(bool from_cm); +void SmParseCommandLine(); +void MainSM(); +void FreeSM(); +void FreeSMEx(bool from_cm); +void SmMainDlg(); +UINT SmMainDlgProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param); +void SmMainDlgInit(HWND hWnd); +void SmMainDlgUpdate(HWND hWnd); +void SmInitSettingList(); +void SmFreeSettingList(); +void SmWriteSettingList(); +void SmLoadSettingList(); +void SmInitDefaultSettingList(); +int SmCompareSetting(void *p1, void *p2); +SETTING *SmGetSetting(wchar_t *title); +bool SmAddSetting(SETTING *s); +void SmDeleteSetting(wchar_t *title); +bool SmCheckNewName(SETTING *s, wchar_t *new_title); +void SmRefreshSetting(HWND hWnd); +void SmRefreshSettingEx(HWND hWnd, wchar_t *select_name); +bool SmAddSettingDlg(HWND hWnd, wchar_t *new_name, UINT new_name_size); +bool SmEditSettingDlg(HWND hWnd); +UINT SmEditSettingDlgProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param); +void SmEditSettingDlgInit(HWND hWnd, SM_EDIT_SETTING *p); +void SmEditSettingDlgUpdate(HWND hWnd, SM_EDIT_SETTING *p); +void SmEditSettingDlgOnOk(HWND hWnd, SM_EDIT_SETTING *p); +void SmConnect(HWND hWnd, SETTING *s); +void SmConnectEx(HWND hWnd, SETTING *s, bool is_in_client); +char *SmPassword(HWND hWnd, char *server_name); +UINT SmServerDlgProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param); +void SmServerDlgInit(HWND hWnd, SM_SERVER *p); +void SmServerDlgUpdate(HWND hWnd, SM_SERVER *p); +void SmServerDlgRefresh(HWND hWnd, SM_SERVER *p); +void SmStatusDlg(HWND hWnd, SM_SERVER *p, void *param, bool no_image, bool show_refresh_button, wchar_t *caption, UINT icon, + SM_STATUS_INIT_PROC *init, SM_STATUS_REFRESH_PROC *refresh); +UINT SmStatusDlgProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param); +bool SmRefreshHubStatus(HWND hWnd, SM_SERVER *p, void *param); +void SmInsertTrafficInfo(LVB *b, TRAFFIC *t); +bool SmCreateHubDlg(HWND hWnd, SM_SERVER *p); +bool SmEditHubDlg(HWND hWnd, SM_SERVER *p, char *hubname); +UINT SmEditHubProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param); +void SmEditHubInit(HWND hWnd, SM_EDIT_HUB *s); +void SmEditHubUpdate(HWND hWnd, SM_EDIT_HUB *s); +void SmEditHubOnOk(HWND hWnd, SM_EDIT_HUB *s); +bool SmCreateListenerDlg(HWND hWnd, SM_SERVER *p); +UINT SmCreateListenerDlgProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param); +void SmSslDlg(HWND hWnd, SM_SERVER *p); +UINT SmSslDlgProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param); +void SmSslDlgInit(HWND hWnd, SM_SSL *s); +void SmSslDlgOnOk(HWND hWnd, SM_SSL *s); +void SmSslDlgUpdate(HWND hWnd, SM_SSL *s); +void SmGetCertInfoStr(wchar_t *str, UINT size, X *x); +bool SmRegenerateServerCert(HWND hWnd, SM_SERVER *server, char *default_cn, X **x, K **k, bool root_only); +bool SmSaveKeyPairDlg(HWND hWnd, X *x, K *k); +UINT SmSaveKeyPairDlgProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param); +void SmSaveKeyPairDlgInit(HWND hWnd, SM_SAVE_KEY_PAIR *s); +void SmSaveKeyPairDlgUpdate(HWND hWnd, SM_SAVE_KEY_PAIR *s); +void SmSaveKeyPairDlgOnOk(HWND hWnd, SM_SAVE_KEY_PAIR *s); +bool SmRefreshServerStatus(HWND hWnd, SM_SERVER *p, void *param); +bool SmRefreshServerInfo(HWND hWnd, SM_SERVER *p, void *param); +void SmPrintNodeInfo(LVB *b, NODE_INFO *info); +wchar_t *SmGetConnectionTypeStr(UINT type); +void SmConnectionDlg(HWND hWnd, SM_SERVER *p); +UINT SmConnectionDlgProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param); +void SmConnectionDlgInit(HWND hWnd, SM_SERVER *p); +void SmConnectionDlgRefresh(HWND hWnd, SM_SERVER *p); +void SmConnectionDlgUpdate(HWND hWnd, SM_SERVER *p); +bool SmRefreshConnectionStatus(HWND hWnd, SM_SERVER *p, void *param); +bool SmFarmDlg(HWND hWnd, SM_SERVER *p); +UINT SmFarmDlgProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param); +void SmFarmDlgInit(HWND hWnd, SM_SERVER *p); +void SmFarmDlgUpdate(HWND hWnd, SM_SERVER *p); +void SmFarmDlgOnOk(HWND hWnd, SM_SERVER *p); +UINT SmFarmMemberDlgProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param); +void SmFarmMemberDlgInit(HWND hWnd, SM_SERVER *p); +void SmFarmMemberDlgUpdate(HWND hWnd, SM_SERVER *p); +void SmFarmMemberDlgRefresh(HWND hWnd, SM_SERVER *p); +void SmFarmMemberDlgOnOk(HWND hWnd, SM_SERVER *p); +void SmFarmMemberCert(HWND hWnd, SM_SERVER *p, UINT id); +bool SmRefreshFarmMemberInfo(HWND hWnd, SM_SERVER *p, void *param); +bool SmRefreshFarmConnectionInfo(HWND hWnd, SM_SERVER *p, void *param); +UINT SmChangeServerPasswordDlg(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param); +void SmHubDlg(HWND hWnd, SM_HUB *s); +UINT SmHubDlgProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param); +void SmHubDlgInit(HWND hWnd, SM_HUB *s); +void SmHubDlgUpdate(HWND hWnd, SM_HUB *s); +void SmHubDlgRefresh(HWND hWnd, SM_HUB *s); +void SmUserListDlg(HWND hWnd, SM_HUB *s); +UINT SmUserListProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param); +void SmUserListInit(HWND hWnd, SM_USER *s); +void SmUserListRefresh(HWND hWnd, SM_USER *s); +void SmUserListUpdate(HWND hWnd, SM_USER *s); +wchar_t *SmGetAuthTypeStr(UINT id); +bool SmCreateUserDlg(HWND hWnd, SM_HUB *s); +UINT SmEditUserDlgProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param); +void SmEditUserDlgInit(HWND hWnd, SM_EDIT_USER *s); +void SmEditUserDlgUpdate(HWND hWnd, SM_EDIT_USER *s); +void SmEditUserDlgOk(HWND hWnd, SM_EDIT_USER *s); +bool SmPolicyDlg(HWND hWnd, POLICY *p, wchar_t *caption); +bool SmPolicyDlgEx(HWND hWnd, POLICY *p, wchar_t *caption, bool cascade_mode); +bool SmPolicyDlgEx2(HWND hWnd, POLICY *p, wchar_t *caption, bool cascade_mode, UINT ver); +UINT SmPolicyDlgProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param); +void SmPolicyDlgInit(HWND hWnd, SM_POLICY *s); +void SmPolicyDlgUpdate(HWND hWnd, SM_POLICY *s); +void SmPolicyDlgOk(HWND hWnd, SM_POLICY *s); +bool SmEditUserDlg(HWND hWnd, SM_HUB *s, char *username); +bool SmRefreshUserInfo(HWND hWnd, SM_SERVER *s, void *param); +void SmGroupListDlg(HWND hWnd, SM_HUB *s); +char *SmSelectGroupDlg(HWND hWnd, SM_HUB *s, char *default_name); +UINT SmGroupListDlgProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param); +void SmGroupListDlgInit(HWND hWnd, SM_GROUP *s); +void SmGroupListDlgUpdate(HWND hWnd, SM_GROUP *s); +void SmGroupListDlgRefresh(HWND hWnd, SM_GROUP *s); +bool SmCreateGroupDlg(HWND hWnd, SM_GROUP *s); +bool SmEditGroupDlg(HWND hWnd, SM_GROUP *s, char *name); +UINT SmEditGroupDlgProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param); +void SmEditGroupDlgInit(HWND hWnd, SM_EDIT_GROUP *g); +void SmEditGroupDlgUpdate(HWND hWnd, SM_EDIT_GROUP *g); +void SmEditGroupDlgOnOk(HWND hWnd, SM_EDIT_GROUP *g); +void SmUserListDlgEx(HWND hWnd, SM_HUB *s, char *groupname, bool create); +void SmAccessListDlg(HWND hWnd, SM_HUB *s); +UINT SmAccessListProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param); +void SmAccessListInit(HWND hWnd, SM_ACCESS_LIST *s); +void SmAccessListUpdate(HWND hWnd, SM_ACCESS_LIST *s); +void SmAccessListRefresh(HWND hWnd, SM_ACCESS_LIST *s); +bool SmAddAccess(HWND hWnd, SM_ACCESS_LIST *s, bool ipv6); +bool SmCloneAccess(HWND hWnd, SM_ACCESS_LIST *s, ACCESS *t); +bool SmEditAccess(HWND hWnd, SM_ACCESS_LIST *s, ACCESS *a); +UINT SmEditAccessDlg(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param); +void SmEditAccessInit(HWND hWnd, SM_EDIT_ACCESS *s); +void SmEditAccessUpdate(HWND hWnd, SM_EDIT_ACCESS *s); +void SmEditAccessOnOk(HWND hWnd, SM_EDIT_ACCESS *s); +void SmRedirect(HWND hWnd, SM_EDIT_ACCESS *s); +UINT SmRedirectDlg(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param); +void SmRedirectDlgInit(HWND hWnd, SM_EDIT_ACCESS *s); +void SmRedirectDlgUpdate(HWND hWnd, SM_EDIT_ACCESS *s); +UINT SmSimulationDlg(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param); +void SmSimulationUpdate(HWND hWnd, SM_EDIT_ACCESS *s); +void SmSimulationInit(HWND hWnd, SM_EDIT_ACCESS *s); +void SmSimulationOnOk(HWND hWnd, SM_EDIT_ACCESS *s); +char *SmSelectUserDlg(HWND hWnd, SM_HUB *s, char *default_name); +char *SmSelectUserDlgEx(HWND hWnd, SM_HUB *s, char *default_name, bool allow_group); +void SmRadiusDlg(HWND hWnd, SM_HUB *s); +UINT SmRadiusDlgProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param); +void SmRadiusDlgInit(HWND hWnd, SM_HUB *s); +void SmRadiusDlgUpdate(HWND hWnd, SM_HUB *s); +void SmRadiusDlgOnOk(HWND hWnd, SM_HUB *s); +void SmLinkDlg(HWND hWnd, SM_HUB *s); +void SmLinkDlgEx(HWND hWnd, SM_HUB *s, bool createNow); +UINT SmLinkDlgProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param); +void SmLinkDlgInit(HWND hWnd, SM_HUB *s); +void SmLinkDlgUpdate(HWND hWnd, SM_HUB *s); +void SmLinkDlgRefresh(HWND hWnd, SM_HUB *s); +bool SmLinkCreate(HWND hWnd, SM_HUB *s); +bool SmLinkCreateEx(HWND hWnd, SM_HUB *s, bool connectNow); +bool SmLinkEdit(HWND hWnd, SM_HUB *s, wchar_t *name); +bool SmRefreshLinkStatus(HWND hWnd, SM_SERVER *s, void *param); +UINT SmLogDlg(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param); +void SmLogDlgInit(HWND hWnd, SM_HUB *s); +void SmLogDlgUpdate(HWND hWnd, SM_HUB *s); +void SmLogDlgOnOk(HWND hWnd, SM_HUB *s); +void SmCaDlg(HWND hWnd, SM_HUB *s); +UINT SmCaDlgProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param); +void SmCaDlgInit(HWND hWnd, SM_HUB *s); +void SmCaDlgRefresh(HWND hWnd, SM_HUB *s); +void SmCaDlgUpdate(HWND hWnd, SM_HUB *s); +void SmCaDlgOnOk(HWND hWnd, SM_HUB *s); +bool SmCaDlgAdd(HWND hWnd, SM_HUB *s); +void SmSessionDlg(HWND hWnd, SM_HUB *s); +UINT SmSessionDlgProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param); +void SmSessionDlgInit(HWND hWnd, SM_HUB *s); +void SmSessionDlgUpdate(HWND hWnd, SM_HUB *s); +void SmSessionDlgRefresh(HWND hWnd, SM_HUB *s); +bool SmRefreshSessionStatus(HWND hWnd, SM_SERVER *s, void *param); +void SmMacTableDlg(HWND hWnd, SM_HUB *s, char *session_name); +UINT SmMacTableDlgProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param); +void SmMacTableDlgInit(HWND hWnd, SM_TABLE *s); +void SmMacTableDlgUpdate(HWND hWnd, SM_TABLE *s); +void SmMacTableDlgRefresh(HWND hWnd, SM_TABLE *s); +void SmIpTableDlg(HWND hWnd, SM_HUB *s, char *session_name); +UINT SmIpTableDlgProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param); +void SmIpTableDlgInit(HWND hWnd, SM_TABLE *s); +void SmIpTableDlgUpdate(HWND hWnd, SM_TABLE *s); +void SmIpTableDlgRefresh(HWND hWnd, SM_TABLE *s); +bool SmCreateCert(HWND hWnd, X **x, K **k, bool do_not_save, char *default_cn, bool root_only); +UINT SmCreateCertDlgProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param); +void SmCreateCertDlgInit(HWND hWnd, SM_CERT *s); +void SmCreateCertDlgUpdate(HWND hWnd, SM_CERT *s); +void SmCreateCertDlgOnOk(HWND hWnd, SM_CERT *s); +UINT SmSNATDlgProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param); +void SmSNATDlgUpdate(HWND hWnd, SM_HUB *s); +void SmBridgeDlg(HWND hWnd, SM_SERVER *s); +void SmInstallWinPcap(HWND hWnd, SM_SERVER *s); +UINT SmBridgeDlgProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param); +UINT SmBridgeDlgInit(HWND hWnd, SM_SERVER *s); +void SmBridgeDlgUpdate(HWND hWnd, SM_SERVER *s); +void SmBridgeDlgRefresh(HWND hWnd, SM_SERVER *s); +void SmBridgeDlgOnOk(HWND hWnd, SM_SERVER *s); +void SmAddServerCaps(LVB *b, CAPSLIST *t); +void SmConfig(HWND hWnd, SM_SERVER *s); +UINT SmConfigDlg(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param); +void SmConfigDlgInit(HWND hWnd, SM_CONFIG *c); +void SmHubAdminOption(HWND hWnd, SM_EDIT_HUB *e); +void SmHubExtOption(HWND hWnd, SM_EDIT_HUB *e); +UINT SmHubAdminOptionDlg(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param); +void SmHubAdminOptionDlgUpdate(HWND hWnd, SM_EDIT_AO *a); +void SmHubAdminOptionDlgInit(HWND hWnd, SM_EDIT_AO *a); +void SmHubAdminOptionDlgOk(HWND hWnd, SM_EDIT_AO *a); +UINT SmHubAdminOptionValueDlg(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param); +void SmHubAdminOptionValueDlgUpdate(HWND hWnd, SM_EDIT_AO *a); +void SmL3(HWND hWnd, SM_SERVER *s); +UINT SmL3Dlg(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param); +void SmL3DlgInit(HWND hWnd, SM_SERVER *s); +void SmL3DlgUpdate(HWND hWnd, SM_SERVER *s); +void SmL3DlgRefresh(HWND hWnd, SM_SERVER *s); +UINT SmL3AddDlg(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param); +void SmL3AddDlgUpdate(HWND hWnd, SM_SERVER *s); +UINT SmL3SwDlg(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param); +void SmL3SwDlgInit(HWND hWnd, SM_L3SW *w); +void SmL3SwDlgUpdate(HWND hWnd, SM_L3SW *w); +void SmL3SwDlgRefresh(HWND hWnd, SM_L3SW *w); +UINT SmL3SwIfDlg(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param); +void SmL3SwIfDlgInit(HWND hWnd, SM_L3SW *w); +void SmL3SwIfDlgUpdate(HWND hWnd, SM_L3SW *w); +UINT SmL3SwTableDlg(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param); +void SmL3SwTableDlgInit(HWND hWnd, SM_L3SW *w); +void SmL3SwTableDlgUpdate(HWND hWnd, SM_L3SW *w); +bool SmL3IsSwActive(SM_SERVER *s, char *name); +UINT SmGetCurrentSecureId(HWND hWnd); +UINT SmGetCurrentSecureIdFromReg(); +UINT SmSelectSecureId(HWND hWnd); +void SmWriteSelectSecureIdReg(UINT id); +bool SmSelectKeyPair(HWND hWnd, char *cert_name, UINT cert_name_size, char *key_name, UINT key_name_size); +bool SmSelectKeyPairEx(HWND hWnd, char *cert_name, UINT cert_name_size, char *key_name, UINT key_name_size, UINT bitmap_id); +UINT SmSelectKeyPairDlg(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param); +void SmSelectKeyPairDlgInit(HWND hWnd, SM_SECURE_KEYPAIR *k); +void SmSelectKeyPairDlgUpdate(HWND hWnd, SM_SECURE_KEYPAIR *k); +void SmSelectKeyPairDlgRefresh(HWND hWnd, SM_SECURE_KEYPAIR *k); +void SmSecureManager(HWND hWnd); +UINT SmCrlDlgProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param); +void SmCrlDlgInit(HWND hWnd, SM_HUB *s); +void SmCrlDlgUpdate(HWND hWnd, SM_HUB *s); +void SmCrlDlgRefresh(HWND hWnd, SM_HUB *s); +UINT SmEditCrlDlgProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param); +void SmEditCrlDlgInit(HWND hWnd, SM_EDIT_CRL *c); +void SmEditCrlDlgUpdate(HWND hWnd, SM_EDIT_CRL *c); +void SmEditCrlDlgOnOk(HWND hWnd, SM_EDIT_CRL *c); +void SmEditCrlDlgOnLoad(HWND hWnd, SM_EDIT_CRL *c); +void SmEditCrlDlgSetName(HWND hWnd, NAME *name); +void SmEditCrlDlgSetSerial(HWND hWnd, X_SERIAL *serial); +void SmEditCrlDlgSetHash(HWND hWnd, UCHAR *hash_md5, UCHAR *hash_sha1); +void SmHubAc(HWND hWnd, SM_EDIT_HUB *s); +UINT SmHubAcDlgProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param); +void SmHubAcDlgInit(HWND hWnd, SM_EDIT_AC_LIST *p); +void SmHubAcDlgUpdate(HWND hWnd, SM_EDIT_AC_LIST *p); +void SmHubAcDlgRefresh(HWND hWnd, SM_EDIT_AC_LIST *p); +UINT SmHubEditAcDlgProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param); +void SmHubEditAcDlgInit(HWND hWnd, SM_EDIT_AC *p); +void SmHubEditAcDlgUpdate(HWND hWnd, SM_EDIT_AC *p); +void SmHubEditAcDlgOnOk(HWND hWnd, SM_EDIT_AC *p); +UINT SmLogFileDlgProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param); +void SmLogFileDlgInit(HWND hWnd, SM_SERVER *p); +void SmLogFileDlgRefresh(HWND hWnd, SM_SERVER *p); +void SmLogFileDlgUpdate(HWND hWnd, SM_SERVER *p); +void SmLogFileStartDownload(HWND hWnd, SM_SERVER *s, char *server_name, char *filepath, UINT totalsize); +UINT SmReadLogFile(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param); +bool SmReadLogFileProc(DOWNLOAD_PROGRESS *g); +UINT SmSaveLogProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param); +void SmLicense(HWND hWnd, SM_SERVER *s); +UINT SmLicenseDlg(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param); +void SmLicenseDlgInit(HWND hWnd, SM_SERVER *s); +void SmLicenseDlgRefresh(HWND hWnd, SM_SERVER *s); +void SmLicenseDlgUpdate(HWND hWnd, SM_SERVER *s); +bool SmLicenseAdd(HWND hWnd, SM_SERVER *s); +UINT SmLicenseAddDlg(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param); +void SmLicenseAddDlgInit(HWND hWnd, SM_SERVER *s); +void SmLicenseAddDlgUpdate(HWND hWnd, SM_SERVER *s); +void SmLicenseAddDlgShiftTextItem(HWND hWnd, UINT id1, UINT id2, UINT *next_focus); +void SmLicenseAddDlgGetText(HWND hWnd, char *str, UINT size); +void SmLicenseAddDlgOnOk(HWND hWnd, SM_SERVER *s); +bool SmSetup(HWND hWnd, SM_SERVER *s); +UINT SmSetupDlg(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param); +void SmSetupDlgInit(HWND hWnd, SM_SETUP *s); +void SmSetupDlgUpdate(HWND hWnd, SM_SETUP *s); +void SmSetupDlgOnOk(HWND hWnd, SM_SETUP *s); +UINT SmSetupHubDlg(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param); +void SmSetupHubDlgUpdate(HWND hWnd, SM_SETUP *s); +bool SmSetupInit(HWND hWnd, SM_SETUP *s); +bool SmSetupDeleteAllHub(HWND hWnd, SM_SETUP *s); +bool SmSetupDeleteAllLocalBridge(HWND hWnd, SM_SETUP *s); +bool SmSetupDeleteAllLayer3(HWND hWnd, SM_SETUP *s); +bool SmSetupDeleteAllObjectInBridgeHub(HWND hWnd, SM_SETUP *s); +void SmSetupStep(HWND hWnd, SM_SETUP *s); +UINT SmSetupStepDlg(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param); +void SmSetupStepDlgInit(HWND hWnd, SM_SETUP *s); +void SmSetupOnClose(HWND hWnd, SM_SETUP *s); +bool SmSetupIsNew(SM_SERVER *s); +void SmVLan(HWND hWnd, SM_SERVER *s); +UINT SmVLanDlg(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param); +void SmVLanDlgInit(HWND hWnd, SM_SERVER *s); +void SmVLanDlgRefresh(HWND hWnd, SM_SERVER *s); +void SmVLanDlgUpdate(HWND hWnd, SM_SERVER *s); +void SmHubMsg(HWND hWnd, SM_EDIT_HUB *s); +UINT SmHubMsgDlg(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param); +void SmHubMsgDlgInit(HWND hWnd, SM_EDIT_HUB *s); +void SmHubMsgDlgUpdate(HWND hWnd, SM_EDIT_HUB *s); +void SmHubMsgDlgOnOk(HWND hWnd, SM_EDIT_HUB *s); +void SmIPsec(HWND hWnd, SM_SERVER *s); +UINT SmIPsecDlg(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param); +void SmIPsecDlgInit(HWND hWnd, SM_SERVER *s); +void SmIPsecDlgOnOk(HWND hWnd, SM_SERVER *s); +void SmIPsecDlgUpdate(HWND hWnd, SM_SERVER *s); +void SmIPsecDlgGetSetting(HWND hWnd, IPSEC_SERVICES *sl); +void SmEtherIp(HWND hWnd, SM_SERVER *s); +UINT SmEtherIpDlg(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param); +void SmEtherIpDlgInit(HWND hWnd, SM_SERVER *s); +void SmEtherIpDlgRefresh(HWND hWnd, SM_SERVER *s); +void SmEtherIpDlgUpdate(HWND hWnd, SM_SERVER *s); +bool SmEtherIpId(HWND hWnd, SM_ETHERIP_ID *t); +UINT SmEtherIpIdDlg(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param); +void SmEtherIpIdDlgInit(HWND hWnd, SM_ETHERIP_ID *t); +void SmEtherIpIdDlgOnOk(HWND hWnd, SM_ETHERIP_ID *t); +void SmEtherIpIdDlgUpdate(HWND hWnd, SM_ETHERIP_ID *t); +void SmEtherIpIdDlgGetSetting(HWND hWnd, SM_ETHERIP_ID *t); +bool SmDDns(HWND hWnd, SM_SERVER *s, bool silent, bool no_change_cert); +UINT SmDDnsDlg(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param); +void SmDDnsDlgInit(HWND hWnd, SM_DDNS *d); +void SmDDnsRefresh(HWND hWnd, SM_DDNS *d); +void SmDDnsDlgOnOk(HWND hWnd, SM_DDNS *d); +void SmDDnsDlgUpdate(HWND hWnd, SM_DDNS *d); +void SmOpenVpn(HWND hWnd, SM_SERVER *s); +UINT SmOpenVpnDlg(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param); +void SmOpenVpnDlgInit(HWND hWnd, SM_SERVER *s); +void SmOpenVpnDlgOnOk(HWND hWnd, SM_SERVER *s, bool no_close); +void SmOpenVpnDlgUpdate(HWND hWnd, SM_SERVER *s); +void SmOpenVpn(HWND hWnd, SM_SERVER *s); +void SmSpecialListener(HWND hWnd, SM_SERVER *s); +UINT SmSpecialListenerDlg(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param); +void SmSpecialListenerDlgInit(HWND hWnd, SM_SERVER *s); +void SmSpecialListenerDlgOnOk(HWND hWnd, SM_SERVER *s); +void SmShowIPSecMessageIfNecessary(HWND hWnd, SM_SERVER *p); +void SmShowCertRegenerateMessageIfNecessary(HWND hWnd, SM_SERVER *p); +UINT SmVmBridgeDlg(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param); +void SmAzure(HWND hWnd, SM_SERVER *s, bool on_setup); +UINT SmAzureDlg(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param); +void SmAzureDlgOnInit(HWND hWnd, SM_AZURE *a); +void SmAzureDlgRefresh(HWND hWnd, SM_AZURE *a); +void SmAzureSetStatus(HWND hWnd, SM_AZURE *a); +bool SmProxy(HWND hWnd, INTERNET_SETTING *t); +UINT SmProxyDlg(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param); +void SmProxyDlgInit(HWND hWnd, INTERNET_SETTING *t); +void SmProxyDlgUpdate(HWND hWnd, INTERNET_SETTING *t); + + diff --git a/src/Cedar/SW.c b/src/Cedar/SW.c index ae3ebae7..d58387f6 100644 --- a/src/Cedar/SW.c +++ b/src/Cedar/SW.c @@ -1,6490 +1,6490 @@ -// SoftEther VPN Source Code - Developer Edition Master Branch -// Cedar Communication Module - - -// SW.c -// Setup Wizard for Win32 - -#include - -#ifdef WIN32 - -#define SM_C -#define CM_C -#define NM_C -#define SW_C - -#define _WIN32_WINNT 0x0502 -#define WINVER 0x0502 -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "CMInner.h" -#include "SMInner.h" -#include "NMInner.h" -#include "EMInner.h" -#include "SWInner.h" -#include "../PenCore/resource.h" - -//// Old MSI product information -// VPN Server -static SW_OLD_MSI old_msi_vpnserver[] = -{ - {"{B5B58F8A-D56C-4f3e-B400-235A6E007101}", "{1BDA6B01-2DB3-478c-AA5B-E973A7DC49A4}"}, - {"{124DDAE2-B9AF-4541-B3EF-B169D9007101}", "{BCDE5CF2-7413-47d0-92E1-F6F2189D8E60}"}, -}; -static SW_OLD_MSI old_msi_vpnclient[] = -{ - {"{54864EDD-4FC6-4269-AA17-3E7C13607101}", "{13ED64E0-532D-4ff0-A3A0-5D700C73259E}"}, - {"{8A215EB7-C5F2-4193-9D7D-1017F1007101}", "{AD593FE5-759E-46c6-9355-29031A8C7D44}"}, -}; -static SW_OLD_MSI old_msi_vpnbridge[] = -{ - {"{58CE8E96-1234-499D-CAFE-3E62261DF211}", "{211FA6A7-1234-4985-CAFE-3DD3E3151E7E}"}, -}; - -// List of file names needed to SFX -static char *sfx_vpn_server_bridge_files[] = -{ - "vpnsetup.exe", - "vpnserver.exe", - "vpnbridge.exe", - "vpnsmgr.exe", - "vpncmd.exe", - "hamcore.se2", -}; -static char *sfx_vpn_client_files[] = -{ - "vpnsetup.exe", - "vpnclient.exe", - "vpncmgr.exe", - "vpncmd.exe", - //"vpninstall.exe", - //"vpnweb.cab", - "hamcore.se2", -}; - -// Global variables to be used out of necessity -static bool g_stop_flag = false; -static HANDLE g_wait_process_handle = NULL; - - -// SFX generation main -bool SwGenSfxModeMain(char *mode, wchar_t *dst) -{ - LIST *o; - bool ret = false; - // Validate arguments - if (mode == NULL || dst == NULL) - { - return false; - } - - o = SwNewSfxFileList(); - - if (SwAddBasicFilesToList(o, mode)) - { - if (SwCompileSfx(o, dst)) - { - ret = true; - } - } - - SwFreeSfxFileList(o); - - return ret; -} - -// Compile the SFX files -bool SwCompileSfx(LIST *o, wchar_t *dst_filename) -{ - bool ret = false; - wchar_t exe_filename[MAX_PATH]; - HINSTANCE hKernel32 = LoadLibraryA("kernel32.dll"); - HANDLE (WINAPI *_BeginUpdateResourceW)(LPCWSTR, BOOL) = NULL; - BOOL (WINAPI *_UpdateResourceA)(HANDLE, LPCSTR, LPCSTR, WORD, LPVOID, DWORD) = NULL; - BOOL (WINAPI *_EndUpdateResourceW)(HANDLE, BOOL) = NULL; - // Validate arguments - if (o == NULL || dst_filename == NULL || hKernel32 == NULL) - { - return false; - } - - // Get the API related to the resource editing - _BeginUpdateResourceW = (HANDLE (__stdcall *)(LPCWSTR,UINT))GetProcAddress(hKernel32, "BeginUpdateResourceW"); - _UpdateResourceA = (UINT (__stdcall *)(HANDLE,LPCSTR,LPCSTR,WORD,LPVOID,DWORD))GetProcAddress(hKernel32, "UpdateResourceA"); - _EndUpdateResourceW = (UINT (__stdcall *)(HANDLE,UINT))GetProcAddress(hKernel32, "EndUpdateResourceW"); - - if (_BeginUpdateResourceW != NULL && _UpdateResourceA != NULL && _EndUpdateResourceW != NULL) - { - // Generate the setup.exe file in the Temp directory - ConbinePathW(exe_filename, sizeof(exe_filename), MsGetMyTempDirW(), L"setup.exe"); - if (FileCopyW(L"vpnsetup.exe", exe_filename)) - { - // Resource updating start - HANDLE h = _BeginUpdateResourceW(exe_filename, false); - - if (h != NULL) - { - UINT i; - bool ok = true; - - for (i = 0;i < LIST_NUM(o);i++) - { - SW_SFX_FILE *f = LIST_DATA(o, i); - BUF *b; - - // Read the original file - b = ReadDumpW(f->DiskFileName); - if (b != NULL) - { - // Add resources - char inner_name[MAX_PATH]; - BUF *b2; - StrCpy(inner_name, sizeof(inner_name), f->InnerFileName); - StrUpper(inner_name); - - if (StrCmpi(inner_name, "hamcore.se2") == 0) - { - // Not to re-compress the hamcore.se2 because they are already compressed - // Prepend "raw_" to file name - Format(inner_name, sizeof(inner_name), "raw_%s", f->InnerFileName); - StrUpper(inner_name); - } - else - { - // Compress - b2 = CompressBuf(b); - FreeBuf(b); - b = b2; - } - - - if (_UpdateResourceA(h, SW_SFX_RESOURCE_TYPE, inner_name, MAKELANGID(LANG_NEUTRAL, SUBLANG_NEUTRAL), - b->Buf, b->Size) == false) - { - ok = false; - } - - FreeBuf(b); - } - - if (ok == false) - { - break; - } - } - - if (ok) - { - // Success to add all resources - if (_EndUpdateResourceW(h, false)) - { - h = NULL; - - // File Copy - if (FileCopyW(exe_filename, dst_filename)) - { - // All succeed - ret = true; - } - } - } - - if (ret == false) - { - // Failed to add resource - if (h != NULL) - { - _EndUpdateResourceW(h, true); - h = NULL; - } - } - - FileDeleteW(exe_filename); - } - } - } - - FreeLibrary(hKernel32); - - return ret; -} - -// Create new item in the SFX compression list -SW_SFX_FILE *SwNewSfxFile(char *inner_file_name, wchar_t *disk_file_name) -{ - SW_SFX_FILE *f = ZeroMalloc(sizeof(SW_SFX_FILE)); - - StrCpy(f->InnerFileName, sizeof(f->InnerFileName), inner_file_name); - UniStrCpy(f->DiskFileName, sizeof(f->DiskFileName), disk_file_name); - - return f; -} - -// Add the basically required files for the components to SFX compressed files list -bool SwAddBasicFilesToList(LIST *o, char *component_name) -{ - UINT i; - // Validate arguments - if (o == NULL || component_name == NULL) - { - return false; - } - - if (StrCmpi(component_name, "vpnserver_vpnbridge") == 0) - { - // VPN Server & VPN Bridge - for (i = 0; i < (sizeof(sfx_vpn_server_bridge_files) / sizeof(char *)); i++) - { - char *name = sfx_vpn_server_bridge_files[i]; - wchar_t name_w[MAX_PATH]; - wchar_t src_file_name[MAX_PATH]; - - StrToUni(name_w, sizeof(name_w), name); - ConbinePathW(src_file_name, sizeof(src_file_name), MsGetExeFileDirW(), name_w); - - Add(o, SwNewSfxFile(name, src_file_name)); - } - } - else if (StrCmpi(component_name, "vpnclient") == 0) - { - // VPN Client - for (i = 0; i < (sizeof(sfx_vpn_client_files) / sizeof(char *)); i++) - { - char *name = sfx_vpn_client_files[i]; - wchar_t name_w[MAX_PATH]; - wchar_t src_file_name[MAX_PATH]; - - StrToUni(name_w, sizeof(name_w), name); - ConbinePathW(src_file_name, sizeof(src_file_name), MsGetExeFileDirW(), name_w); - - Add(o, SwNewSfxFile(name, src_file_name)); - } - } - else - { - return false; - } - - return true; -} - -// Release the SFX file list -void SwFreeSfxFileList(LIST *o) -{ - UINT i; - // Validate arguments - if (o == NULL) - { - return; - } - - for (i = 0;i < LIST_NUM(o);i++) - { - SW_SFX_FILE *f = LIST_DATA(o, i); - - Free(f); - } - - ReleaseList(o); -} - -// Generate the SFX file list -LIST *SwNewSfxFileList() -{ - LIST *o = NewListFast(NULL); - - return o; -} - -// Extract from the SFX files -bool SwSfxExtractFile(HWND hWnd, void *data, UINT size, wchar_t *dst, bool compressed) -{ - IO *io; - bool ret = false; - // Validate arguments - if (data == NULL || size == 0 || dst == NULL) - { - return false; - } - - io = FileCreateW(dst); - - if (compressed == false) - { - // Write uncompressed files as is - ret = FileWrite(io, data, size); - } - else - { - // Unzip when the files are compressed - BUF *src = NewBuf(); - BUF *dst; - - WriteBuf(src, data, size); - - dst = UncompressBuf(src); - - FreeBuf(src); - - ret = FileWrite(io, dst->Buf, dst->Size); - - FreeBuf(dst); - } - - FileClose(io); - - if (ret == false) - { - FileDeleteW(dst); - } - - return ret; -} - -// SFX extraction process -bool SwSfxExtractProcess(HWND hWnd, bool *hide_error_msg) -{ - TOKEN_LIST *t; - UINT i; - bool ret = true; - wchar_t exec_filename[MAX_SIZE]; - bool is_easy_installer = false; - bool dummy_bool = false; - - if (hide_error_msg == NULL) - { - hide_error_msg = &dummy_bool; - } - - *hide_error_msg = false; - - Zero(exec_filename, sizeof(exec_filename)); - - // Enumerate the DATAFILE resources - t = MsEnumResources(NULL, SW_SFX_RESOURCE_TYPE); - - for (i = 0;i < t->NumTokens;i++) - { - char *resource_name = t->Token[i]; - char filename[MAX_PATH]; - wchar_t filename_w[MAX_PATH]; - wchar_t tmp_filename[MAX_PATH]; - HRSRC hr; - bool ok = false; - bool is_compressed = true; - - DoEvents(hWnd); - - if (g_stop_flag) - { - // User cancel - ret = false; - break; - } - - StrCpy(filename, sizeof(filename), resource_name); - - StrLower(filename); - - if (EndWith(filename, ".vpn")) - { - is_easy_installer = true; - } - - if (StartWith(filename, "raw_")) - { - StrToUni(filename_w, sizeof(filename_w), filename + 4); - is_compressed = false; - } - else - { - StrToUni(filename_w, sizeof(filename_w), filename); - } - - ConbinePathW(tmp_filename, sizeof(tmp_filename), MsGetMyTempDirW(), filename_w); - - if (EndWith(filename, "vpnsetup.exe")) - { - UniStrCpy(exec_filename, sizeof(exec_filename), tmp_filename); - } - - // Find the resources - hr = FindResourceA(MsGetCurrentModuleHandle(), resource_name, SW_SFX_RESOURCE_TYPE); - if (hr != NULL) - { - HGLOBAL hg = LoadResource(MsGetCurrentModuleHandle(), hr); - - if (hg != NULL) - { - UINT size = SizeofResource(MsGetCurrentModuleHandle(), hr); - void *ptr = LockResource(hg); - - if (size != 0 && ptr != NULL) - { - if (SwSfxExtractFile(hWnd, ptr, size, tmp_filename, is_compressed)) - { - ok = true; - } - } - } - } - - DoEvents(hWnd); - - if (ok == false) - { - // Failure - ret = false; - break; - } - } - - FreeToken(t); - - if (ret) - { - wchar_t exe_name[MAX_PATH]; - wchar_t *exe_dir = MsGetExeFileDirW(); - - GetFileNameFromFilePathW(exe_name, sizeof(exe_name), MsGetExeFileNameW()); - - } - - if (ret) - { - // Start the vpnsetup.exe - if (UniIsEmptyStr(exec_filename)) - { - ret = false; - } - else - { - void *handle = NULL; - wchar_t params[MAX_SIZE]; - wchar_t *current_params = GetCommandLineUniStr(); - wchar_t tmp[MAX_SIZE]; - char *last_lang; - wchar_t copy_of_me[MAX_PATH]; - - UniStrCpy(params, sizeof(params), current_params); - - // Copy itself to the Temp directory - CombinePathW(copy_of_me, sizeof(copy_of_me), MsGetMyTempDirW(), L"installer.cache"); - if (FileCopyW(MsGetExeFileNameW(), copy_of_me) == false) - { - Zero(copy_of_me, sizeof(copy_of_me)); - } - - // Add a path of this own - UniFormat(tmp, sizeof(tmp), L" /CALLERSFXPATH:\"%s\"", copy_of_me); - UniStrCat(params, sizeof(params), tmp); - - // Add information of whether it's a simple installer - UniFormat(tmp, sizeof(tmp), L" /ISEASYINSTALLER:%u", is_easy_installer); - UniStrCat(params, sizeof(params), tmp); - - UniTrim(params); - - // Specify a language by the lang.config - last_lang = MsRegReadStrEx2(REG_CURRENT_USER, SW_REG_KEY, "Last User Language", false, true); - if (IsEmptyStr(last_lang) == false) - { - wchar_t lang_filename[MAX_PATH]; - BUF *buf; - - CombinePathW(lang_filename, sizeof(lang_filename), MsGetMyTempDirW(), L"lang.config"); - - buf = NewBuf(); - WriteBufLine(buf, ""); - WriteBufLine(buf, last_lang); - WriteBufLine(buf, ""); - DumpBufW(buf, lang_filename); - FreeBuf(buf); - } - Free(last_lang); - - if (MsExecuteEx2W(exec_filename, params, &handle, false) == false) - { - ret = false; - } - else - { - g_wait_process_handle = handle; - } - } - } - - return ret; -} - -// Copy the files of VPN Gate -bool SwSfxCopyVgFiles(HWND hWnd, wchar_t *src, wchar_t *dst) -{ - wchar_t *msg; - wchar_t srcfilename[MAX_PATH]; - wchar_t exefilename[MAX_PATH]; - - GetFileNameFromFilePathW(srcfilename, sizeof(srcfilename), src); - GetFileNameFromFilePathW(exefilename, sizeof(exefilename), MsGetExeFileNameW()); - - if (FileCopyW(src, dst)) - { - return true; - } - - msg = L"The file \"%s\" was not found on the directory which the installer \"%s\" is located on.\r\n\r\n" - L"To continue the installation, the file \"%s\" is required on the same directory.\r\n" - L"If you have extracted the installer from a ZIP archive, you have to also extract the file \"%s\" from the ZIP archive together."; - - MsgBoxEx(hWnd, MB_ICONINFORMATION, msg, srcfilename, exefilename, srcfilename, srcfilename); - - return false; -} - -// SFX extraction dialog procedure -bool CALLBACK SfxModeMainDialogProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam) -{ - UINT ret; - bool hide_msg = false; - switch (msg) - { - case WM_INITDIALOG: - SetTimer(hWnd, 1, 500, NULL); - break; - - case WM_TIMER: - switch (wParam) - { - case 1: - KillTimer(hWnd, 1); - - ret = SW_EXIT_CODE_USER_CANCEL; - if (SwSfxExtractProcess(hWnd, &hide_msg)) - { - ret = 0; - } - else - { - if (g_stop_flag == false) - { - if (hide_msg == false) - { - MsgBoxEx(hWnd, MB_ICONSTOP, L"Fatal Error: Self extracting files to the temporary directory was failed.\r\n\r\n" - L"Please try again after reboot Windows."); - } - } - } - - EndDialog(hWnd, ret); - - break; - } - break; - - case WM_COMMAND: - switch (wParam) - { - case IDOK: - case IDCANCEL: - g_stop_flag = true; - Disable(hWnd, IDCANCEL); - break; - } - break; - - case WM_CLOSE: - break; - } - - return false; -} - -// Main process as SFX mode -UINT SwSfxModeMain() -{ - UINT ret; - // Select either English or Japanese - UINT dialog_id = (MsIsCurrentUserLocaleIdJapanese() ? 10001 : 10002); - - g_wait_process_handle = NULL; - g_stop_flag = false; - - // Show the screen - ret = (UINT)DialogBoxParamA(MsGetCurrentModuleHandle(), MAKEINTRESOURCEA(dialog_id), NULL, (DLGPROC)SfxModeMainDialogProc, 0); - - if (g_wait_process_handle != NULL) - { - // If this have started the vpnsetup.exe, wait for termination of the child process - ret = MsWaitProcessExit(g_wait_process_handle); - } - - return ret; -} - -// Resource name enumeration procedure -bool CALLBACK SwEnumResourceNamesProc(HMODULE hModule, const char *type, char *name, LONG_PTR lParam) -{ - bool *b = (bool *)lParam; - // Validate arguments - if (type == NULL || name == NULL || lParam == 0) - { - return false; - } - - *b = true; - - return true; -} - -// Main process of vpnsetup.exe -UINT SWExec() -{ - UINT ret = 0; - bool is_datafile_exists = false; - - // Examine whether DATAFILE resources are stored in setup.exe that is currently running - EnumResourceNamesA(NULL, SW_SFX_RESOURCE_TYPE, SwEnumResourceNamesProc, (LONG_PTR)(&is_datafile_exists)); - - if (is_datafile_exists) - { - // If DATAFILE resources are stored, extract it as SFX - MayaquaMinimalMode(); - } - -#if defined(_DEBUG) || defined(DEBUG) // In VC++ compilers, the macro is "_DEBUG", not "DEBUG". - // If set memcheck = true, the program will be vitally slow since it will log all malloc() / realloc() / free() calls to find the cause of memory leak. - // For normal debug we set memcheck = false. - // Please set memcheck = true if you want to test the cause of memory leaks. - InitMayaqua(false, true, 0, NULL); -#else - InitMayaqua(false, false, 0, NULL); -#endif - InitCedar(); - - if (is_datafile_exists == false) - { - // Start the Setup Wizard - ret = SWExecMain(); - } - else - { - // SFX mode - ret = SwSfxModeMain(); - } - - FreeCedar(); - FreeMayaqua(); - - return ret; -} - -// Dialog procedure (for copy and paste) -UINT SwDefaultDlg(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, WIZARD *wizard, WIZARD_PAGE *wizard_page, void *param) -{ - SW *sw = (SW *)param; - // Validate arguments - if (hWnd == NULL || sw == NULL) - { - return 0; - } - - switch (msg) - { - case WM_INITDIALOG: - break; - - case WM_WIZ_SHOW: - SetWizardButton(wizard_page, true, true, true, false); - break; - - case WM_WIZ_HIDE: - break; - - case WM_CLOSE: - break; - - case WM_WIZ_NEXT: - break; - - case WM_WIZ_BACK: - break; - - case WM_COMMAND: - switch (wParam) - { - } - break; - } - - return 0; -} - -// Update the file specification dialog -void SwWeb2Update(HWND hWnd, SW *sw, WIZARD *wizard, WIZARD_PAGE *wizard_page) -{ - bool ok = true; - // Validate arguments - if (hWnd == NULL || sw == NULL || wizard_page == NULL || wizard == NULL) - { - return; - } - - if (IsEmptyUniStr(sw->Web_OutFile) || IsEmptyUniStr(sw->Web_SettingFile)) - { - ok = false; - } - - SetText(hWnd, E_SETTING, sw->Web_SettingFile); - SetText(hWnd, E_OUT, sw->Web_OutFile); - - SetWizardButton(wizard_page, ok, true, true, false); -} - -// Update the file specification dialog -void SwEasy2Update(HWND hWnd, SW *sw, WIZARD *wizard, WIZARD_PAGE *wizard_page) -{ - bool ok = true; - // Validate arguments - if (hWnd == NULL || sw == NULL || wizard_page == NULL || wizard == NULL) - { - return; - } - - if (IsEmptyUniStr(sw->Easy_OutFile) || IsEmptyUniStr(sw->Easy_SettingFile)) - { - ok = false; - } - - SetText(hWnd, E_SETTING, sw->Easy_SettingFile); - SetText(hWnd, E_OUT, sw->Easy_OutFile); - - SetWizardButton(wizard_page, ok, true, true, false); -} - -// Generate a SFX file name of the default -void SwGenerateDefaultSfxFileName(wchar_t *name, UINT size) -{ - // Validate arguments - if (name == NULL) - { - return; - } - - UniFormat(name, size, L"easy-" GC_SW_SOFTETHER_PREFIX_W L"vpnclient-v%u.%02u-%u-%04u-%02u-%02u-windows.exe", - CEDAR_VERSION_MAJOR, CEDAR_VERSION_MINOR, CEDAR_VERSION_BUILD, - BUILD_DATE_Y, BUILD_DATE_M, BUILD_DATE_D); -} - -// Generate a ZIP file name of the default -void SwGenerateDefaultZipFileName(wchar_t *name, UINT size) -{ - // Validate arguments - if (name == NULL) - { - return; - } - - UniFormat(name, size, L"web-" GC_SW_SOFTETHER_PREFIX_W L"vpnclient-v%u.%02u-%u-%04u-%02u-%02u-windows.zip", - CEDAR_VERSION_MAJOR, CEDAR_VERSION_MINOR, CEDAR_VERSION_BUILD, - BUILD_DATE_Y, BUILD_DATE_M, BUILD_DATE_D); -} - -// Specify a file -UINT SwEasy2(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, WIZARD *wizard, WIZARD_PAGE *wizard_page, void *param) -{ - SW *sw = (SW *)param; - wchar_t *fn; - wchar_t tmp[MAX_SIZE]; - // Validate arguments - if (hWnd == NULL || sw == NULL) - { - return 0; - } - - switch (msg) - { - case WM_INITDIALOG: - DlgFont(hWnd, S_BOLD1, 10, true); - DlgFont(hWnd, S_BOLD2, 10, true); - - Check(hWnd, B_DELETE_SENSITIVE, sw->Easy_EraseSensitive); - Check(hWnd, B_EASYMODE, sw->Easy_EasyMode); - - break; - - case WM_WIZ_SHOW: - SwEasy2Update(hWnd, sw, wizard, wizard_page); - break; - - case WM_WIZ_HIDE: - break; - - case WM_CLOSE: - break; - - case WM_WIZ_NEXT: - // Save the Settings - MsRegWriteInt(REG_CURRENT_USER, SW_REG_KEY, "Easy_EraseSensitive", sw->Easy_EraseSensitive); - MsRegWriteInt(REG_CURRENT_USER, SW_REG_KEY, "Easy_EasyMode", sw->Easy_EasyMode); - return D_SW_PERFORM; - - case WM_WIZ_BACK: - return D_SW_EASY1; - - case WM_COMMAND: - switch (wParam) - { - case B_DELETE_SENSITIVE: - sw->Easy_EraseSensitive = IsChecked(hWnd, B_DELETE_SENSITIVE); - sw->Easy_EasyMode = IsChecked(hWnd, B_EASYMODE); - break; - - case B_BROWSE_SETTING: - fn = OpenDlg(hWnd, _UU("CM_ACCOUNT_SETTING_FILE"), _UU("CM_ACCOUNT_OPEN_TITLE")); - - if (fn != NULL) - { - // Parse - if (CiTryToParseAccountFile(fn) == false) - { - // Failure - MsgBox(hWnd, MB_ICONEXCLAMATION, _UU("CM_ACCOUNT_PARSE_FAILED")); - } - else - { - // Success - UniStrCpy(sw->Easy_SettingFile, sizeof(sw->Easy_SettingFile), fn); - - SwEasy2Update(hWnd, sw, wizard, wizard_page); - - FocusEx(hWnd, E_SETTING); - } - - Free(fn); - } - break; - - case B_BROWSE_OUT: - SwGenerateDefaultSfxFileName(tmp, sizeof(tmp)); - - fn = SaveDlg(hWnd, _UU("SW_EXE_FILTER"), _UU("DLG_SAVE_FILE"), tmp, L".exe"); - - if (fn != NULL) - { - UniStrCpy(sw->Easy_OutFile, sizeof(sw->Easy_OutFile), fn); - - SwEasy2Update(hWnd, sw, wizard, wizard_page); - } - break; - - case B_HINT: - break; - } - break; - } - - return 0; -} - -// Specify a file -UINT SwWeb2(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, WIZARD *wizard, WIZARD_PAGE *wizard_page, void *param) -{ - SW *sw = (SW *)param; - wchar_t *fn; - wchar_t tmp[MAX_SIZE]; - // Validate arguments - if (hWnd == NULL || sw == NULL) - { - return 0; - } - - switch (msg) - { - case WM_INITDIALOG: - DlgFont(hWnd, S_BOLD1, 10, true); - DlgFont(hWnd, S_BOLD2, 10, true); - - Check(hWnd, B_DELETE_SENSITIVE, sw->Web_EraseSensitive); - Check(hWnd, B_EASYMODE, sw->Web_EasyMode); - - break; - - case WM_WIZ_SHOW: - SwWeb2Update(hWnd, sw, wizard, wizard_page); - break; - - case WM_WIZ_HIDE: - break; - - case WM_CLOSE: - break; - - case WM_WIZ_NEXT: - // Save the settings - MsRegWriteInt(REG_CURRENT_USER, SW_REG_KEY, "Web_EraseSensitive", sw->Web_EraseSensitive); - MsRegWriteInt(REG_CURRENT_USER, SW_REG_KEY, "Web_EasyMode", sw->Web_EasyMode); - return D_SW_PERFORM; - - case WM_WIZ_BACK: - return D_SW_WEB1; - - case WM_COMMAND: - switch (wParam) - { - case B_DELETE_SENSITIVE: - sw->Web_EraseSensitive = IsChecked(hWnd, B_DELETE_SENSITIVE); - sw->Web_EasyMode = IsChecked(hWnd, B_EASYMODE); - break; - - case B_BROWSE_SETTING: - fn = OpenDlg(hWnd, _UU("CM_ACCOUNT_SETTING_FILE"), _UU("CM_ACCOUNT_OPEN_TITLE")); - - if (fn != NULL) - { - // Parse - if (CiTryToParseAccountFile(fn) == false) - { - // Failure - MsgBox(hWnd, MB_ICONEXCLAMATION, _UU("CM_ACCOUNT_PARSE_FAILED")); - } - else - { - // Success - UniStrCpy(sw->Web_SettingFile, sizeof(sw->Web_SettingFile), fn); - - SwWeb2Update(hWnd, sw, wizard, wizard_page); - - FocusEx(hWnd, E_SETTING); - } - - Free(fn); - } - break; - - case B_BROWSE_OUT: - SwGenerateDefaultZipFileName(tmp, sizeof(tmp)); - - fn = SaveDlg(hWnd, _UU("DLG_ZIP_FILER"), _UU("DLG_SAVE_FILE"), tmp, L".zip"); - - if (fn != NULL) - { - UniStrCpy(sw->Web_OutFile, sizeof(sw->Web_OutFile), fn); - - SwWeb2Update(hWnd, sw, wizard, wizard_page); - } - break; - - case B_HINT: - break; - } - break; - } - - return 0; -} - -// Start screen of the Web Installer Creation Wizard -UINT SwWeb1(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, WIZARD *wizard, WIZARD_PAGE *wizard_page, void *param) -{ - SW *sw = (SW *)param; - // Validate arguments - if (hWnd == NULL || sw == NULL) - { - return 0; - } - - switch (msg) - { - case WM_INITDIALOG: - wizard->CloseConfirmMsg = NULL; - DlgFont(hWnd, S_TITLE, 11, true); - break; - - case WM_WIZ_SHOW: - SetWizardButton(wizard_page, true, false, true, false); - break; - - case WM_WIZ_HIDE: - break; - - case WM_CLOSE: - break; - - case WM_WIZ_NEXT: - return D_SW_WEB2; - - case WM_WIZ_BACK: - break; - - case WM_COMMAND: - switch (wParam) - { - } - break; - } - - return 0; -} - -// Start screen of the Simple installer creation wizard -UINT SwEasy1(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, WIZARD *wizard, WIZARD_PAGE *wizard_page, void *param) -{ - SW *sw = (SW *)param; - // Validate arguments - if (hWnd == NULL || sw == NULL) - { - return 0; - } - - switch (msg) - { - case WM_INITDIALOG: - wizard->CloseConfirmMsg = NULL; - DlgFont(hWnd, S_TITLE, 11, true); - break; - - case WM_WIZ_SHOW: - SetWizardButton(wizard_page, true, false, true, false); - break; - - case WM_WIZ_HIDE: - break; - - case WM_CLOSE: - break; - - case WM_WIZ_NEXT: - return D_SW_EASY2; - - case WM_WIZ_BACK: - break; - - case WM_COMMAND: - switch (wParam) - { - } - break; - } - - return 0; -} - -// Get the icon for the language -UINT SwGetLangIcon(char *name) -{ - UINT ret = ICO_NULL; - // Validate arguments - if (name == NULL) - { - return ICO_NULL; - } - - if (StrCmpi(name, "ja") == 0) - { - ret = ICO_LANG_JAPANESE; - } - else if (StrCmpi(name, "en") == 0) - { - ret = ICO_LANG_ENGLISH; - } - else if (StrCmpi(name, "cn") == 0) - { - ret = ICO_LANG_CHINESE; - } - else if (StrCmpi(name, "tw") == 0) - { - ret = ICO_LANG_TRADITIONAL_CHINESE; - } - - return ret; -} - -// Initialize the language list -void SwLang1Init(HWND hWnd, SW *sw) -{ - LVB *b; - UINT i; - SW_COMPONENT *default_select = NULL; - LIST *o; - UINT current_lang = GetCurrentLangId(); - UINT select_index = INFINITE; - // Validate arguments - if (hWnd == NULL || sw == NULL) - { - return; - } - - o = LoadLangList(); - - LvReset(hWnd, L_LIST); - - b = LvInsertStart(); - - for (i = 0;i < LIST_NUM(o);i++) - { - LANGLIST *t = LIST_DATA(o, i); - wchar_t tmp[MAX_SIZE]; - wchar_t tmp2[MAX_SIZE]; - - UniFormat(tmp, sizeof(tmp), L"(%s)", t->TitleLocal); - UniFormat(tmp2, sizeof(tmp2), L" %s", t->TitleEnglish); - - LvInsertAdd(b, SwGetLangIcon(t->Name), (void *)(t->Id + 1), 2, tmp2, tmp); - - if (t->Id == current_lang) - { - select_index = i; - } - } - - LvInsertEnd(b, hWnd, L_LIST); - - if (sw->CurrentComponent == NULL) - { - LvSelectByParam(hWnd, L_LIST, default_select); - } - else - { - LvSelectByParam(hWnd, L_LIST, sw->CurrentComponent); - } - - LvAutoSize(hWnd, L_LIST); - - FreeLangList(o); - - if (select_index != INFINITE) - { - LvSelect(hWnd, L_LIST, select_index); - } - - LvSort(hWnd, L_LIST, 0, false); - - Focus(hWnd, L_LIST); - - // Show the current language - if (true) - { - LANGLIST t; - wchar_t tmp[MAX_SIZE]; - - Zero(&t, sizeof(t)); - GetCurrentLang(&t); - - UniFormat(tmp, sizeof(tmp), L"%s (%s)", t.TitleEnglish, t.TitleLocal); - - SetText(hWnd, E_CURRENT, tmp); - - if (MsIsVista()) - { - SetFont(hWnd, E_CURRENT, GetMeiryoFontEx(11)); - } - else - { - DlgFont(hWnd, E_CURRENT, 11, false); - } - } -} - -// Update of control -void SwLang1Update(HWND hWnd, SW *sw, WIZARD *wizard, WIZARD_PAGE *wizard_page) -{ - UINT id; - // Validate arguments - if (hWnd == NULL || sw == NULL || wizard == NULL || wizard_page == NULL) - { - return; - } - - id = (UINT)LvGetSelectedParam(hWnd, L_LIST); - - if (id == 0) - { - SetWizardButtonEx(wizard_page, false, false, true, false, (MsIsAdmin() == false && sw->IsSystemMode)); - } - else - { - SetWizardButtonEx(wizard_page, true, false, true, false, (MsIsAdmin() == false && sw->IsSystemMode)); - } -} - -// Language setting screen -UINT SwLang1(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, WIZARD *wizard, WIZARD_PAGE *wizard_page, void *param) -{ - SW *sw = (SW *)param; - NMHDR *n; - UINT id; - // Validate arguments - if (hWnd == NULL || sw == NULL) - { - return 0; - } - - switch (msg) - { - case WM_INITDIALOG: - LvInitEx2(hWnd, L_LIST, false, true); - - if (MsIsVista()) - { - SetFont(hWnd, L_LIST, GetMeiryoFontEx(12)); - } - else - { - DlgFont(hWnd, L_LIST, 12, false); - } - - LvInsertColumn(hWnd, L_LIST, 0, L"English Name", 250); - LvInsertColumn(hWnd, L_LIST, 1, L"Local Name", 250); - - SwLang1Update(hWnd, sw, wizard, wizard_page); - break; - - case WM_WIZ_SHOW: - SetWizardButtonEx(wizard_page, true, false, true, false, (MsIsAdmin() == false && sw->IsSystemMode)); - - SwLang1Init(hWnd, sw); - - SwLang1Update(hWnd, sw, wizard, wizard_page); - break; - - case WM_WIZ_HIDE: - break; - - case WM_CLOSE: - break; - - case WM_WIZ_NEXT: - if (SwEnterSingle(sw) == false) - { - // Multiple-starts prevention - MsgBox(hWnd, MB_ICONINFORMATION, _UU("SW_OTHER_INSTANCE_EXISTS")); - break; - } - - if (MsIsNt() == false) - { - // Win9x - MsgBox(hWnd, MB_ICONSTOP, - L"Windows 9x / Me doesn't support multi-language switcing.\r\n\r\nIf you want to switch to another language, please use Windows NT 4.0, 2000 or greater."); - break; - } - - // Get the current selection - id = (UINT)LvGetSelectedParam(hWnd, L_LIST); - if (id != 0) - { - id--; - - if (id == GetCurrentLangId()) - { - // No change - sw->LangNotChanged = true; - - sw->ExitCode = 0; - - return D_SW_ERROR; - } - else - { - wchar_t add_param[MAX_SIZE]; - LIST *o; - LANGLIST *new_lang; - LANGLIST old_lang; - char new_lang_name[MAX_SIZE]; - char old_lang_name[MAX_SIZE]; - - GetCurrentLang(&old_lang); - - o = LoadLangList(); - - if (o == NULL) - { - MsgBox(hWnd, MB_ICONSTOP, _UU("SW_LANG_LIST_LOAD_FAILED")); - break; - } - - new_lang = GetLangById(o, id); - - if (new_lang == NULL) - { - MsgBox(hWnd, MB_ICONSTOP, _UU("SW_LANG_LIST_LOAD_FAILED")); - FreeLangList(o); - break; - } - - StrCpy(new_lang_name, sizeof(new_lang_name), new_lang->Name); - StrCpy(old_lang_name, sizeof(old_lang_name), old_lang.Name); - - FreeLangList(o); - - UniFormat(add_param, sizeof(add_param), L"/LANGID:%u", id); - - if (sw->DoubleClickBlocker) - { - break; - } - - sw->DoubleClickBlocker = true; - - sw->LangId = id; - - if (sw->IsSystemMode == false) - { -LABEL_RUN_CHILD_PROCESS: - // Start the process immediately in the case of user mode - if (SaveLangConfigCurrentDir(new_lang_name) == false) - { - sw->DoubleClickBlocker = false; - MsgBox(hWnd, MB_ICONSTOP, _UU("SW_LANG_SET_FAILED")); - break; - } - - UniStrCat(add_param, sizeof(add_param), L" /LANGNOW:yes"); - if (SwReExecMyself(sw, add_param, false)) - { - // Terminate itself if it succeeds to start the child process - CloseWizard(wizard_page); - break; - } - else - { - // Child process startup failure - sw->DoubleClickBlocker = false; - - // Undo the language setting - SaveLangConfigCurrentDir(old_lang_name); - break; - } - } - - // In the case of system mode - if (MsIsAdmin() == false) - { - if (MsIsVista()) - { - if (sw->IsReExecForUac == false) - { - // If there is no Admin privileges in Vista or later, attempt to acquire Admin rights by UAC first during the first run - UniStrCat(add_param, sizeof(add_param), L" /SETLANGANDREBOOT:true"); - - if (SwReExecMyself(sw, add_param, true)) - { - // Terminate itself if it succeeds to start the child process - CloseWizard(wizard_page); - break; - } - else - { - // Do nothing if it fails to start in the UAC - sw->DoubleClickBlocker = false; - break; - } - } - else - { - // If no Admin privileges after being started by the UAC, jump to the guidance screen indicating it is not Admin - return D_SW_NOT_ADMIN; - } - } - else - { - // Jump to guide screen indicating that it is not the Admin in the case of XP or earlier - return D_SW_NOT_ADMIN; - } - } - else - { - // Start the process if there is a Admin privileges - goto LABEL_RUN_CHILD_PROCESS; - } - } - } - break; - - case WM_WIZ_BACK: - break; - - case WM_COMMAND: - switch (wParam) - { - } - break; - - case WM_NOTIFY: - n = (NMHDR *)lParam; - - switch (n->idFrom) - { - case L_LIST: - switch (n->code) - { - case LVN_ITEMCHANGED: - SwLang1Update(hWnd, sw, wizard, wizard_page); - break; - } - break; - } - - break; - } - - return 0; -} - -// Start the uninstallation -UINT SwUninst1(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, WIZARD *wizard, WIZARD_PAGE *wizard_page, void *param) -{ - SW *sw = (SW *)param; - // Validate arguments - if (hWnd == NULL || sw == NULL) - { - return 0; - } - - switch (msg) - { - case WM_INITDIALOG: - FormatText(hWnd, S_TITLE, sw->CurrentComponent->Title); - FormatText(hWnd, S_WELCOME, sw->CurrentComponent->Title); - break; - - case WM_WIZ_SHOW: - DlgFont(hWnd, S_TITLE, 11, true); - SetWizardButtonEx(wizard_page, true, false, true, false, sw->IsSystemMode); - - sw->DoubleClickBlocker = false; - - break; - - case WM_WIZ_HIDE: - break; - - case WM_CLOSE: - break; - - case WM_WIZ_NEXT: - if (MsgBoxEx(hWnd, MB_ICONQUESTION | MB_YESNO | MB_DEFBUTTON2, _UU("SW_UNINSTALL_CONFIRM"), - sw->CurrentComponent->Title) == IDNO) - { - break; - } - - if (SwEnterSingle(sw) == false) - { - // Multiple-starts prevention - MsgBox(hWnd, MB_ICONINFORMATION, _UU("SW_OTHER_INSTANCE_EXISTS")); - break; - } - - if (sw->DoubleClickBlocker) - { - break; - } - - sw->DoubleClickBlocker = true; - - if (sw->IsSystemMode == false) - { - // Start uninstallation immediately in the case of user mode - return D_SW_PERFORM; - } - - // In the case of system mode - if (MsIsAdmin() == false) - { - if (MsIsVista()) - { - if (sw->IsReExecForUac == false) - { - // If there is no Admin privileges in Vista or later, attempt to acquire Admin rights by UAC first during the first run - if (SwReExecMyself(sw, NULL, true)) - { - // Terminate itself if it succeeds to start the child process - CloseWizard(wizard_page); - break; - } - else - { - // If fail to run in UAC, jump to guide screen indicating that it is not Admin - return D_SW_NOT_ADMIN; - } - } - else - { - // If no Admin privileges after being started by the UAC, jump to the guidance screen indicating it is not Admin - return D_SW_NOT_ADMIN; - } - } - else - { - // Jump to guide screen indicating that it is not the Admin in the case of XP or earlier - return D_SW_NOT_ADMIN; - } - } - else - { - // Start the uninstallation if it has Admin privileges - return D_SW_PERFORM; - } - break; - - case WM_WIZ_BACK: - break; - - case WM_COMMAND: - switch (wParam) - { - } - break; - } - - return 0; -} - -// Completion screen -UINT SwFinish(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, WIZARD *wizard, WIZARD_PAGE *wizard_page, void *param) -{ - SW *sw = (SW *)param; - char tmp[MAX_SIZE]; - // Validate arguments - if (hWnd == NULL || sw == NULL) - { - return 0; - } - - switch (msg) - { - case WM_INITDIALOG: - if (sw->EasyMode) - { - SetIcon(hWnd, S_ICON, ICO_SETUP); - } - else if (sw->WebMode) - { - SetIcon(hWnd, S_ICON, ICO_INTERNET); - } - else - { - FormatText(hWnd, S_INFO, sw->CurrentComponent->Title); - SetIcon(hWnd, S_ICON, sw->CurrentComponent->Icon); - } - - wizard->CloseConfirmMsg = NULL; - - sw->ExitCode = 0; - break; - - case WM_WIZ_SHOW: - if (UniIsEmptyStr(sw->FinishMsg) == false) - { - SetText(hWnd, S_INFO, sw->FinishMsg); - } - - SetWizardButton(wizard_page, true, false, false, true); - - if (sw->HideStartCommand || sw->UninstallMode || sw->LanguageMode || sw->EasyMode || sw->WebMode || UniIsEmptyStr(sw->CurrentComponent->StartExeName)) - { - Hide(hWnd, B_RUN); - sw->Run = false; - } - else - { - SetText(hWnd, B_RUN, sw->CurrentComponent->StartDescription); - Show(hWnd, B_RUN); - Format(tmp, sizeof(tmp), "UI_NoCheck_%s_%u", sw->CurrentComponent->Name, sw->IsSystemMode); - Check(hWnd, B_RUN, !MsRegReadInt(REG_CURRENT_USER, SW_REG_KEY, tmp)); - sw->Run = IsChecked(hWnd, B_RUN); - } - break; - - case WM_WIZ_HIDE: - break; - - case WM_CLOSE: - break; - - case WM_WIZ_NEXT: - break; - - case WM_WIZ_BACK: - break; - - case WM_COMMAND: - switch (wParam) - { - case B_RUN: - if (sw->HideStartCommand || sw->UninstallMode || sw->LanguageMode || sw->EasyMode || sw->WebMode || UniIsEmptyStr(sw->CurrentComponent->StartExeName)) - { - } - else - { - Format(tmp, sizeof(tmp), "UI_NoCheck_%s_%u", sw->CurrentComponent->Name, sw->IsSystemMode); - sw->Run = IsChecked(hWnd, B_RUN); - MsRegWriteInt(REG_CURRENT_USER, SW_REG_KEY, tmp, !sw->Run); - } - break; - } - break; - } - - return 0; -} - -// Error occurring screen -UINT SwError(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, WIZARD *wizard, WIZARD_PAGE *wizard_page, void *param) -{ - SW *sw = (SW *)param; - // Validate arguments - if (hWnd == NULL || sw == NULL) - { - return 0; - } - - switch (msg) - { - case WM_INITDIALOG: - wizard->CloseConfirmMsg = NULL; - - if (sw->EasyMode) - { - SetText(hWnd, S_INFO, _UU("SW_EASY_ERROR_MSG")); - } - else if (sw->WebMode) - { - SetText(hWnd, S_INFO, _UU("SW_WEB_ERROR_MSG")); - } - else - { - FormatText(hWnd, S_INFO, sw->CurrentComponent->Title); - } - - if (sw->MsiRebootRequired) - { - // MSI requires a reboot - wchar_t tmp[MAX_SIZE]; - - SetIcon(hWnd, S_ICON, ICO_INFORMATION); - - UniFormat(tmp, sizeof(tmp), _UU("SW_MSI_UNINSTALL_REBOOT_REQUIRED"), sw->CurrentComponent->Title); - - SetText(hWnd, S_INFO, tmp); - } - - if (sw->LangNotChanged) - { - // Language has not changed - wchar_t tmp[MAX_SIZE]; - - SetIcon(hWnd, S_ICON, ICO_INFORMATION); - - UniFormat(tmp, sizeof(tmp), _UU("SW_LANG_NOT_CHANGED"), sw->CurrentComponent->Title); - - SetText(hWnd, S_INFO, tmp); - } - - break; - - case WM_WIZ_SHOW: - SetWizardButton(wizard_page, true, false, false, true); - break; - - case WM_WIZ_HIDE: - break; - - case WM_CLOSE: - break; - - case WM_WIZ_NEXT: - break; - - case WM_WIZ_BACK: - break; - - case WM_COMMAND: - switch (wParam) - { - } - break; - } - - return 0; -} - -// Execution thread of the setup process -void SwPerformThread(THREAD *thread, void *param) -{ - WIZARD_PAGE *wp = (WIZARD_PAGE *)param; - SW *sw; - SW_COMPONENT *c; - bool ret; - SW_UI ui; - // Validate arguments - if (thread == NULL || param == NULL) - { - return; - } - - sw = (SW *)wp->Wizard->Param; - - sw->ExitCode = SW_EXIT_CODE_INTERNAL_ERROR; - - // Components to be installed - c = sw->CurrentComponent; - - if (sw->EasyMode) - { - // Create a simple installer - ret = SwEasyMain(sw, wp); - } - else if (sw->WebMode) - { - // Create a Web installer - ret = SwWebMain(sw, wp); - } - else if (sw->UninstallMode == false) - { - // Installation - ret = SwInstallMain(sw, wp, c); - } - else - { - // Uninstallation - ret = SwUninstallMain(sw, wp, c); - } - - // Notify the results to the window - Zero(&ui, sizeof(ui)); - ui.Type = (ret ? SW_UI_TYPE_FINISH : SW_UI_TYPE_ERROR); - SwInteractUi(wp, &ui); -} - -// Create a file copy task -SW_TASK_COPY *SwNewCopyTask(wchar_t *srcfilename, wchar_t *dstfilename, wchar_t *srcdir, wchar_t *dstdir, bool overwrite, bool setup_file) -{ - SW_TASK_COPY *ct; - // Validate arguments - if (srcfilename == NULL || srcdir == NULL || dstdir == NULL) - { - return NULL; - } - - ct = ZeroMalloc(sizeof(SW_TASK_COPY)); - - UniStrCpy(ct->SrcFileName, sizeof(ct->SrcFileName), srcfilename); - - if (UniIsEmptyStr(dstfilename)) - { - UniStrCpy(ct->DstFileName, sizeof(ct->DstFileName), srcfilename); - } - else - { - UniStrCpy(ct->DstFileName, sizeof(ct->DstFileName), dstfilename); - } - - UniStrCpy(ct->SrcDir, sizeof(ct->SrcDir), srcdir); - UniStrCpy(ct->DstDir, sizeof(ct->DstDir), dstdir); - - ct->Overwrite = overwrite; - ct->SetupFile = setup_file; - - return ct; -} - -// Release the file copy task -void SwFreeCopyTask(SW_TASK_COPY *ct) -{ - // Validate arguments - if (ct == NULL) - { - return; - } - - Free(ct); -} - -// Create a link creation task -SW_TASK_LINK *SwNewLinkTask(wchar_t *target_dir, wchar_t *target_exe, wchar_t *target_arg, - wchar_t *icon_exe, UINT icon_index, - wchar_t *dest_dir, wchar_t *dest_name, wchar_t *dest_desc, - bool no_delete_dir) -{ - SW_TASK_LINK *lt; - // Validate arguments - if (target_dir == NULL || target_exe == NULL || dest_dir == NULL || dest_name == NULL) - { - return NULL; - } - - lt = ZeroMalloc(sizeof(SW_TASK_LINK)); - - UniStrCpy(lt->TargetDir, sizeof(lt->TargetDir), target_dir); - UniStrCpy(lt->TargetExe, sizeof(lt->TargetExe), target_exe); - UniStrCpy(lt->TargetArg, sizeof(lt->TargetArg), target_arg); - - if (UniIsEmptyStr(icon_exe) == false) - { - UniStrCpy(lt->IconExe, sizeof(lt->IconExe), icon_exe); - } - else - { - UniStrCpy(lt->IconExe, sizeof(lt->IconExe), target_exe); - } - - lt->IconIndex = icon_index; - - UniStrCpy(lt->DestDir, sizeof(lt->DestDir), dest_dir); - UniStrCpy(lt->DestName, sizeof(lt->DestName), dest_name); - UniStrCpy(lt->DestDescription, sizeof(lt->DestDescription), dest_desc); - - lt->NoDeleteDir = no_delete_dir; - - return lt; -} - -// Release the link creation task -void SwFreeLinkTask(SW_TASK_LINK *lt) -{ - // Validate arguments - if (lt == NULL) - { - return; - } - - Free(lt); -} - -// Create a Setup task -SW_TASK *SwNewTask() -{ - SW_TASK *t = ZeroMalloc(sizeof(SW_TASK)); - - t->CopyTasks = NewListFast(NULL); - - t->SetSecurityPaths = NewListFast(NULL); - - t->LinkTasks = NewListFast(NULL); - - return t; -} - -// Release the Setup Tasks -void SwFreeTask(SW_TASK *t) -{ - UINT i; - // Validate arguments - if (t == NULL) - { - return; - } - - for (i = 0;i < LIST_NUM(t->CopyTasks);i++) - { - SW_TASK_COPY *ct = LIST_DATA(t->CopyTasks, i); - - SwFreeCopyTask(ct); - } - - ReleaseList(t->CopyTasks); - - FreeStrList(t->SetSecurityPaths); - - for (i = 0;i < LIST_NUM(t->LinkTasks);i++) - { - SW_TASK_LINK *lt = LIST_DATA(t->LinkTasks, i); - - SwFreeLinkTask(lt); - } - - ReleaseList(t->LinkTasks); - - Free(t); -} - -// Delete the shortcut file -void SwDeleteShortcuts(SW_LOGFILE *logfile) -{ - UINT i; - LIST *o; - // Validate arguments - if (logfile == NULL) - { - return; - } - - o = NewListFast(NULL); - - for (i = 0;i < LIST_NUM(logfile->LogList);i++) - { - SW_LOG *g = LIST_DATA(logfile->LogList, LIST_NUM(logfile->LogList) - i - 1); - - switch (g->Type) - { - case SW_LOG_TYPE_LNK: - FileDeleteW(g->Path); - Add(o, g); - break; - - case SW_LOG_TYPE_LNK_DIR: - SleepThread(100); - DeleteDirW(g->Path); - Add(o, g); - break; - } - } - - for (i = 0;i < LIST_NUM(o);i++) - { - SW_LOG *g = LIST_DATA(o, i); - - Delete(logfile->LogList, g); - - Free(g); - } - - ReleaseList(o); -} - -// Uninstall main -bool SwUninstallMain(SW *sw, WIZARD_PAGE *wp, SW_COMPONENT *c) -{ - bool ok; - wchar_t tmp[MAX_SIZE]; - UINT i; - // Validate arguments - if (sw == NULL || wp == NULL || c == NULL) - { - return false; - } - - SwPerformPrint(wp, _UU("SW_PERFORM_MSG_INIT_UNINST")); - - // Stop the Service - ok = true; - - if (c->InstallService) - { - char svc_title_name[MAX_SIZE]; - wchar_t *svc_title; - - Format(svc_title_name, sizeof(svc_title_name), "SVC_%s_TITLE", c->SvcName); - - svc_title = _UU(svc_title_name); - - if (UniIsEmptyStr(svc_title) == false) - { - if (sw->IsSystemMode && MsIsNt()) - { - // WinNT and system mode - if (MsIsServiceRunning(c->SvcName)) - { - wchar_t svc_exe[MAX_SIZE]; - UINT64 giveup_tick; - UniFormat(tmp, sizeof(tmp), _UU("SW_PERFORM_MSG_STOP_SVC"), svc_title); - SwPerformPrint(wp, tmp); - -LABEL_RETRY_3: - if (MsStopService(c->SvcName) == false) - { - UniFormat(tmp, sizeof(tmp), _UU("SW_PERFORM_MSG_STOP_SVC_ERROR"), svc_title, c->SvcName); - if (SwPerformMsgBox(wp, MB_ICONEXCLAMATION | MB_RETRYCANCEL, tmp) != IDRETRY) - { - // Cancel - ok = false; - } - else - { - if (MsIsServiceRunning(c->SvcName)) - { - goto LABEL_RETRY_3; - } - } - } - - // Wait 5 seconds if stop the service - SleepThread(5000); - - // Wait until the EXE file for the service become ready to write - ConbinePathW(svc_exe, sizeof(svc_exe), sw->InstallDir, c->SvcFileName); - - giveup_tick = Tick64() + (UINT64)10000; - while (IsFileWriteLockedW(svc_exe)) - { - UniFormat(tmp, sizeof(tmp), _UU("SW_PERFORM_MSG_WAIT_FOR_FILE_UNLOCK"), svc_exe); - SwPerformPrint(wp, tmp); - - SleepThread(100); - - if (Tick64() >= giveup_tick) - { - break; - } - } - } - } - else - { - // Win9x or user mode - wchar_t svc_exe[MAX_SIZE]; - UINT64 giveup_tick; - - // Stop the Service - MsStopUserModeSvc(c->SvcName); - SleepThread(3000); - - // Wait until the EXE file for the service become ready to write - ConbinePathW(svc_exe, sizeof(svc_exe), sw->InstallDir, c->SvcFileName); - - giveup_tick = Tick64() + (UINT64)10000; - while (IsFileWriteLockedW(svc_exe)) - { - UniFormat(tmp, sizeof(tmp), _UU("SW_PERFORM_MSG_WAIT_FOR_FILE_UNLOCK"), svc_exe); - SwPerformPrint(wp, tmp); - - SleepThread(100); - - if (Tick64() >= giveup_tick) - { - break; - } - } - } - } - } - - if (ok == false) - { - goto LABEL_CLEANUP; - } - - // Examine preliminary whether the files to be deleted can be written successfully - ok = true; - - SwPerformPrint(wp, _UU("SW_PERFORM_MSG_DELETE_PREPARE")); - - for (i = 0;i < LIST_NUM(sw->LogFile->LogList);i++) - { - SW_LOG *g = LIST_DATA(sw->LogFile->LogList, i); - - if (g->Type == SW_LOG_TYPE_FILE) - { - wchar_t fullpath[MAX_SIZE]; - IO *io; - bool write_ok; - bool new_file; - -LABEL_RETRY_1: - write_ok = new_file = false; - - UniStrCpy(fullpath, sizeof(fullpath), g->Path); - - // If the process with the same name is running, kill it - if (MsKillProcessByExeName(fullpath) != 0) - { - // Wait for 1 second if kill the process - SleepThread(1000); - } - - // Writing check - io = FileOpenExW(fullpath, true, true); - if (io == NULL) - { - io = FileCreateW(fullpath); - new_file = true; - } - if (io != NULL) - { - // Writing OK - write_ok = true; - - FileCloseEx(io, true); - - if (new_file) - { - FileDeleteW(fullpath); - } - } - - if (write_ok == false) - { - // Show an error message if it fails - UniFormat(tmp, sizeof(tmp), _UU("SW_PERFORM_MSG_DELETE_ERROR"), fullpath, c->Title); - if (SwPerformMsgBox(wp, MB_ICONEXCLAMATION | MB_RETRYCANCEL, tmp) != IDRETRY) - { - // Cancel - ok = false; - break; - } - else - { - // Retry - goto LABEL_RETRY_1; - } - } - } - } - - if (ok == false) - { - goto LABEL_CLEANUP; - } - - // Delete the service - if (c->InstallService) - { - char svc_title_name[MAX_SIZE]; - char svc_description_name[MAX_SIZE]; - wchar_t *svc_title; - - Format(svc_title_name, sizeof(svc_title_name), "SVC_%s_TITLE", c->SvcName); - Format(svc_description_name, sizeof(svc_description_name), "SVC_%s_DESCRIPT", c->SvcName); - - svc_title = _UU(svc_title_name); - - if (UniIsEmptyStr(svc_title) == false) - { - if (sw->IsSystemMode == false || MsIsNt() == false) - { - // Win9x or user mode - if (MsIsNt() == false) - { - // Remove the Run key from the registry for Win9x - MsRegDeleteValue(REG_LOCAL_MACHINE, WIN9X_SVC_REGKEY_1, c->SvcName); - MsRegDeleteValue(REG_LOCAL_MACHINE, WIN9X_SVC_REGKEY_2, c->SvcName); - } - } - else - { - // System mode - UniFormat(tmp, sizeof(tmp), _UU("SW_PERFORM_MSG_UNINSTALL_SVC"), svc_title); - SwPerformPrint(wp, tmp); - -LABEL_RETRY_4: - - if (MsIsServiceInstalled(c->SvcName)) - { - // Stop the service if it is running by any chance - MsStopService(c->SvcName); - } - - if (MsIsServiceInstalled(c->SvcName)) - { - // Uninstall the service - if (MsUninstallService(c->SvcName) == false) - { - // Show an error message if it fails - UniFormat(tmp, sizeof(tmp), _UU("SW_PERFORM_MSG_SVC_UNINSTALL_FAILED"), svc_title, c->SvcName); - if (SwPerformMsgBox(wp, MB_ICONEXCLAMATION | MB_RETRYCANCEL, tmp) != IDRETRY) - { - // Cancel - ok = false; - } - else - { - // Retry - goto LABEL_RETRY_4; - } - } - } - } - } - } - - // Delete the shortcut - SwPerformPrint(wp, _UU("SW_PERFORM_MSG_DELETE_LINKS")); - SwDeleteShortcuts(sw->LogFile); - - // Delete the registry, files, and directories - for (i = 0;i < LIST_NUM(sw->LogFile->LogList);i++) - { - SW_LOG *g = LIST_DATA(sw->LogFile->LogList, LIST_NUM(sw->LogFile->LogList) - i - 1); - char tmpa[MAX_SIZE]; - - UniFormat(tmp, sizeof(tmp), _UU("SW_PERFORM_MSG_DELETE"), g->Path); - - switch (g->Type) - { - case SW_LOG_TYPE_FILE: // File - SwPerformPrint(wp, tmp); - FileDeleteW(g->Path); - break; - - case SW_LOG_TYPE_DIR: // Directory - SwPerformPrint(wp, tmp); - SleepThread(100); - DeleteDirW(g->Path); - break; - - case SW_LOG_TYPE_REGISTRY: // Registry - SwPerformPrint(wp, tmp); - UniToStr(tmpa, sizeof(tmpa), g->Path); - MsRegDeleteKeyEx2(REG_LOCAL_MACHINE, tmpa, false, true); - break; - } - } - - // Remove the installed build number from the registry - if (true) - { - char keyname[MAX_SIZE]; - Format(keyname, sizeof(keyname), "%s\\%s", SW_REG_KEY, sw->CurrentComponent->Name); - MsRegDeleteValueEx2(sw->IsSystemMode ? REG_LOCAL_MACHINE : REG_CURRENT_USER, - keyname, "InstalledBuild", false, true); - } - - // Remove the EULA agreement record - MsRegDeleteValueEx2(REG_CURRENT_USER, SW_REG_KEY_EULA, sw->CurrentComponent->Name, false, true); - - SwPerformPrint(wp, _UU("SW_PERFORM_MSG_DELETE_SETUP_INFO")); - - if (c->Id == SW_CMP_VPN_CLIENT) - { - // Remove the UI Helper - MsRegDeleteValueEx2(REG_LOCAL_MACHINE, "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Run", - SW_VPN_CLIENT_UIHELPER_REGVALUE, false, true); - } - - // Remove the installation directory from the registry - if (true) - { - // Remove the installed directory from the registry - char keyname[MAX_SIZE]; - Format(keyname, sizeof(keyname), "%s\\%s", SW_REG_KEY, sw->CurrentComponent->Name); - MsRegDeleteKeyEx2(sw->IsSystemMode ? REG_LOCAL_MACHINE : REG_CURRENT_USER, keyname, false, true); - } - - // Delete the setuplog.dat - if (true) - { - wchar_t setuplog[MAX_PATH]; - - ConbinePathW(setuplog, sizeof(setuplog), MsGetExeDirNameW(), L"setuplog.dat"); - - FileDeleteW(setuplog); - } - - // Delete the existing Virtual Network Adapters - // Currently disabled because of 32bit/64bit problems -#if 0 - if (c->Id == SW_CMP_VPN_CLIENT) - { - if (MsIsNt()) - { - if (!(MsIs64BitWindows() && Is32())) - { - UINT i; - TOKEN_LIST *t; - - SwPerformPrint(wp, _UU("SW_PERFORM_MSG_DELETE_NIC")); - - // Enumeration - t = MsEnumNetworkAdapters(VLAN_ADAPTER_NAME, VLAN_ADAPTER_NAME_OLD); - if (t != NULL) - { - if (t->NumTokens >= 1) - { - if (SwPerformMsgBox(wp, MB_ICONQUESTION | MB_YESNO | MB_DEFBUTTON2, _UU("SW_PERFORM_MSG_DELETE_NIC")) == IDYES) - { - for (i = 0;i < t->NumTokens;i++) - { - char *name = t->Token[i]; - - MsUninstallVLan(name); - } - } - } - - FreeToken(t); - } - } - } - } -#endif - - SwPerformPrint(wp, _UU("SW_PERFORM_MSG_UPDATING")); - - // Notify the update to the system - MsUpdateSystem(); - - // Completion message - SwPerformPrint(wp, _UU("SW_PERFORM_MSG_FINISHED")); - - if (ok == false) - { - goto LABEL_CLEANUP; - } - -LABEL_CLEANUP: - - return ok; -} - -// Create a Task List -void SwDefineTasks(SW *sw, SW_TASK *t, SW_COMPONENT *c) -{ - wchar_t tmp[MAX_SIZE]; - wchar_t src_setup_exe_fullpath[MAX_PATH]; - wchar_t src_setup_exe_dir[MAX_PATH]; - wchar_t src_setup_exe_filename[MAX_PATH]; - wchar_t dir_desktop[MAX_PATH]; - wchar_t dir_startmenu[MAX_PATH]; - wchar_t dir_program[MAX_PATH]; - wchar_t dir_app_program[MAX_PATH]; - wchar_t dir_config_program[MAX_PATH]; - wchar_t dir_admin_tools[MAX_PATH]; - wchar_t dir_config_language[MAX_PATH]; - wchar_t dir_startup[MAX_PATH]; - wchar_t tmp1[MAX_SIZE], tmp2[MAX_SIZE]; - SW_TASK_COPY *setup_exe; - // Validate arguments - if (sw == NULL || t == NULL || c == NULL) - { - return; - } - - //// Organize directory name for creating shortcut - // Desktop - UniStrCpy(dir_desktop, sizeof(dir_desktop), (sw->IsSystemMode ? MsGetCommonDesktopDirW() : MsGetPersonalDesktopDirW())); - // Start menu - UniStrCpy(dir_startmenu, sizeof(dir_startmenu), (sw->IsSystemMode ? MsGetCommonStartMenuDirW() : MsGetPersonalStartMenuDirW())); - // Program - UniStrCpy(dir_program, sizeof(dir_program), (sw->IsSystemMode ? MsGetCommonProgramsDirW() : MsGetPersonalProgramsDirW())); - // Program directory for this application - ConbinePathW(dir_app_program, sizeof(dir_app_program), dir_program, c->LongName); - if (sw->IsSystemMode == false) - { - // User mode - UniStrCat(dir_app_program, sizeof(dir_app_program), _UU("SW_TAG_USERNAME")); - } - // Configuration tool directory - ConbinePathW(dir_config_program, sizeof(dir_config_program), dir_app_program, _UU("SW_DIRNAME_CONFIG_TOOLS")); - // Language configuration directory - ConbinePathW(dir_config_language, sizeof(dir_config_language), dir_app_program, _UU("SW_DIRNAME_LANGUAGE_TOOLS")); - // Directory for System administrator tool - ConbinePathW(dir_admin_tools, sizeof(dir_admin_tools), dir_app_program, _UU("SW_DIRNAME_ADMIN_TOOLS")); - // Startup - UniStrCpy(dir_startup, sizeof(dir_startup), (sw->IsSystemMode ? MsGetCommonStartupDirW() : MsGetPersonalStartupDirW())); - - // Get the path information related to vpnsetup.exe - UniStrCpy(src_setup_exe_fullpath, sizeof(src_setup_exe_fullpath), MsGetExeFileNameW()); - GetDirNameFromFilePathW(src_setup_exe_dir, sizeof(src_setup_exe_dir), src_setup_exe_fullpath); - GetFileNameFromFilePathW(src_setup_exe_filename, sizeof(src_setup_exe_filename), src_setup_exe_fullpath); - - // Add the Setup program (themselves) to the copy list - Add(t->CopyTasks, (setup_exe = SwNewCopyTask(src_setup_exe_filename, - L"vpnsetup.exe", src_setup_exe_dir, sw->InstallDir, true, true))); - - // Generate the file processing list for each component - if (c->Id == SW_CMP_VPN_SERVER) - { - // VPN Server - SW_TASK_COPY *ct; - SW_TASK_COPY *vpnserver, *vpncmd, *vpnsmgr; - - CombinePathW(tmp, sizeof(tmp), sw->InstallDir, L"backup.vpn_server.config"); - Add(t->SetSecurityPaths, CopyUniStr(tmp)); - - vpnserver = SwNewCopyTask(L"vpnserver.exe", NULL, sw->InstallSrc, sw->InstallDir, true, false); - vpncmd = SwNewCopyTask(L"vpncmd.exe", NULL, sw->InstallSrc, sw->InstallDir, true, false); - vpnsmgr = SwNewCopyTask(L"vpnsmgr.exe", NULL, sw->InstallSrc, sw->InstallDir, true, false); - - Add(t->CopyTasks, vpnserver); - Add(t->CopyTasks, vpncmd); - Add(t->CopyTasks, vpnsmgr); - - Add(t->CopyTasks, (ct = SwNewCopyTask(L"|empty.config", L"vpn_server.config", sw->InstallSrc, sw->InstallDir, false, false))); - Add(t->CopyTasks, SwNewCopyTask(L"|backup_dir_readme.txt", L"readme.txt", sw->InstallSrc, tmp, false, false)); - - CombinePathW(tmp, sizeof(tmp), ct->DstDir, ct->DstFileName); - Add(t->SetSecurityPaths, CopyUniStr(tmp)); - - //// Definition of the shortcuts - // Desktop and Start menu - Add(t->LinkTasks, SwNewLinkTask(sw->InstallDir, vpnsmgr->DstFileName, NULL, NULL, 0, dir_desktop, - _UU(sw->IsSystemMode ? "SW_LINK_NAME_VPNSMGR_SHORT" : "SW_LINK_NAME_VPNSMGR_SHORT_UM"), - _UU("SW_LINK_NAME_VPNSMGR_COMMENT"), true)); - Add(t->LinkTasks, SwNewLinkTask(sw->InstallDir, vpnsmgr->DstFileName, NULL, NULL, 0, dir_startmenu, - _UU(sw->IsSystemMode ? "SW_LINK_NAME_VPNSMGR_SHORT" : "SW_LINK_NAME_VPNSMGR_SHORT_UM"), - _UU("SW_LINK_NAME_VPNSMGR_COMMENT"), true)); - - // Programs\PacketiX VPN Server - Add(t->LinkTasks, SwNewLinkTask(sw->InstallDir, vpnsmgr->DstFileName, NULL, NULL, 0, dir_app_program, - _UU("SW_LINK_NAME_VPNSMGR_FULL"), - _UU("SW_LINK_NAME_VPNSMGR_COMMENT"), false)); - Add(t->LinkTasks, SwNewLinkTask(sw->InstallDir, vpncmd->DstFileName, NULL, NULL, 0, dir_app_program, - _UU("SW_LINK_NAME_VPNCMD"), - _UU("SW_LINK_NAME_VPNCMD_COMMENT"), false)); - Add(t->LinkTasks, SwNewLinkTask(sw->InstallDir, vpnserver->DstFileName, L"/traffic", L"vpnsetup.exe", 2, dir_admin_tools, - _UU("SW_LINK_NAME_TRAFFIC"), - _UU("SW_LINK_NAME_TRAFFIC_COMMENT"), false)); - - // Programs\PacketiX VPN Server\Configuration tool - Add(t->LinkTasks, SwNewLinkTask(sw->InstallDir, vpnserver->DstFileName, L"/tcp", L"vpnsetup.exe", 3, dir_config_program, - _UU("SW_LINK_NAME_TCP"), - _UU("SW_LINK_NAME_TCP_COMMENT"), false)); - - if (MsIsWin2000OrGreater()) - { - Add(t->LinkTasks, SwNewLinkTask(MsGetSystem32DirW(), L"services.msc", NULL, L"filemgmt.dll", 0, dir_config_program, - _UU("SW_LINK_NAME_SERVICES"), - _UU("SW_LINK_NAME_SERVICES_COMMENT"), false)); - - if (sw->IsSystemMode) - { - // Debugging information collecting tool - Add(t->LinkTasks, SwNewLinkTask(sw->InstallDir, vpncmd->DstFileName, L"/debug", L"vpnsetup.exe", 4, dir_admin_tools, - _UU("SW_LINK_NAME_DEBUG"), - _UU("SW_LINK_NAME_DEBUG_COMMENT"), false)); - } - } - - if (sw->IsSystemMode == false) - { - // Register to the start-up in the case of user mode - Add(t->LinkTasks, SwNewLinkTask(sw->InstallDir, vpnserver->DstFileName, L"/usermode", NULL, 0, dir_startup, - _UU("SW_LINK_NAME_VPNSERVER_SVC"), - _UU("SW_LINK_NAME_VPNSERVER_SVC_COMMENT"), true)); - } - } - else if (c->Id == SW_CMP_VPN_BRIDGE) - { - // VPN Bridge - SW_TASK_COPY *ct; - SW_TASK_COPY *vpnbridge, *vpncmd, *vpnsmgr; - - CombinePathW(tmp, sizeof(tmp), sw->InstallDir, L"backup.vpn_bridge.config"); - Add(t->SetSecurityPaths, CopyUniStr(tmp)); - - vpnbridge = SwNewCopyTask(L"vpnbridge.exe", NULL, sw->InstallSrc, sw->InstallDir, true, false); - vpncmd = SwNewCopyTask(L"vpncmd.exe", NULL, sw->InstallSrc, sw->InstallDir, true, false); - vpnsmgr = SwNewCopyTask(L"vpnsmgr.exe", NULL, sw->InstallSrc, sw->InstallDir, true, false); - - Add(t->CopyTasks, vpnbridge); - Add(t->CopyTasks, vpncmd); - Add(t->CopyTasks, vpnsmgr); - - Add(t->CopyTasks, (ct = SwNewCopyTask(L"|empty.config", L"vpn_bridge.config", sw->InstallSrc, sw->InstallDir, false, false))); - Add(t->CopyTasks, SwNewCopyTask(L"|backup_dir_readme.txt", L"readme.txt", sw->InstallSrc, tmp, false, false)); - - CombinePathW(tmp, sizeof(tmp), ct->DstDir, ct->DstFileName); - Add(t->SetSecurityPaths, CopyUniStr(tmp)); - - //// Definition of the shortcuts - // Desktop and Start menu - Add(t->LinkTasks, SwNewLinkTask(sw->InstallDir, vpnsmgr->DstFileName, NULL, NULL, 0, dir_desktop, - _UU(sw->IsSystemMode ? "SW_LINK_NAME_VPNSMGR_SHORT" : "SW_LINK_NAME_VPNSMGR_SHORT_UM"), - _UU("SW_LINK_NAME_VPNSMGR_COMMENT"), true)); - Add(t->LinkTasks, SwNewLinkTask(sw->InstallDir, vpnsmgr->DstFileName, NULL, NULL, 0, dir_startmenu, - _UU(sw->IsSystemMode ? "SW_LINK_NAME_VPNSMGR_SHORT" : "SW_LINK_NAME_VPNSMGR_SHORT_UM"), - _UU("SW_LINK_NAME_VPNSMGR_COMMENT"), true)); - - // Programs\PacketiX VPN Bridge - Add(t->LinkTasks, SwNewLinkTask(sw->InstallDir, vpnsmgr->DstFileName, NULL, NULL, 0, dir_app_program, - _UU("SW_LINK_NAME_VPNSMGR_FULL"), - _UU("SW_LINK_NAME_VPNSMGR_COMMENT"), false)); - Add(t->LinkTasks, SwNewLinkTask(sw->InstallDir, vpncmd->DstFileName, NULL, NULL, 0, dir_app_program, - _UU("SW_LINK_NAME_VPNCMD"), - _UU("SW_LINK_NAME_VPNCMD_COMMENT"), false)); - Add(t->LinkTasks, SwNewLinkTask(sw->InstallDir, vpnbridge->DstFileName, L"/traffic", L"vpnsetup.exe", 2, dir_admin_tools, - _UU("SW_LINK_NAME_TRAFFIC"), - _UU("SW_LINK_NAME_TRAFFIC_COMMENT"), false)); - - // Programs\PacketiX VPN Bridge\Configuration tool - Add(t->LinkTasks, SwNewLinkTask(sw->InstallDir, vpnbridge->DstFileName, L"/tcp", L"vpnsetup.exe", 3, dir_config_program, - _UU("SW_LINK_NAME_TCP"), - _UU("SW_LINK_NAME_TCP_COMMENT"), false)); - - if (MsIsWin2000OrGreater()) - { - Add(t->LinkTasks, SwNewLinkTask(MsGetSystem32DirW(), L"services.msc", NULL, L"filemgmt.dll", 0, dir_config_program, - _UU("SW_LINK_NAME_SERVICES"), - _UU("SW_LINK_NAME_SERVICES_COMMENT"), false)); - - if (sw->IsSystemMode) - { - // Debugging information collecting tool - Add(t->LinkTasks, SwNewLinkTask(sw->InstallDir, vpncmd->DstFileName, L"/debug", L"vpnsetup.exe", 4, dir_admin_tools, - _UU("SW_LINK_NAME_DEBUG"), - _UU("SW_LINK_NAME_DEBUG_COMMENT"), false)); - } - } - - if (sw->IsSystemMode == false) - { - // Register to the start-up in the case of user mode - Add(t->LinkTasks, SwNewLinkTask(sw->InstallDir, vpnbridge->DstFileName, L"/usermode", NULL, 0, dir_startup, - _UU("SW_LINK_NAME_VPNBRIDGE_SVC"), - _UU("SW_LINK_NAME_VPNBRIDGE_SVC_COMMENT"), true)); - } - } - else if (c->Id == SW_CMP_VPN_CLIENT) - { - // VPN Client - SW_TASK_COPY *ct; - SW_TASK_COPY *vpnclient, *vpncmd, *vpncmgr; - SW_TASK_COPY *sfx_cache = NULL; - //SW_TASK_COPY *vpnweb; - //SW_TASK_COPY *vpninstall; - wchar_t *src_config_filename; - - CombinePathW(tmp, sizeof(tmp), sw->InstallDir, L"backup.vpn_client.config"); - Add(t->SetSecurityPaths, CopyUniStr(tmp)); - - vpnclient = SwNewCopyTask(L"vpnclient.exe", NULL, sw->InstallSrc, sw->InstallDir, true, false); - vpncmd = SwNewCopyTask(L"vpncmd.exe", NULL, sw->InstallSrc, sw->InstallDir, true, false); - vpncmgr = SwNewCopyTask(L"vpncmgr.exe", NULL, sw->InstallSrc, sw->InstallDir, true, false); - - if (vpncmgr != NULL) - { - CombinePathW(sw->vpncmgr_path, sizeof(sw->vpncmgr_path), - vpncmgr->DstDir, vpncmgr->DstFileName); - } - - if (UniIsEmptyStr(sw->CallerSfxPath) == false) - { - if (IsFileExistsW(sw->CallerSfxPath)) - { - // Cache the calling SFX file body to the installation directory - wchar_t srcname[MAX_PATH]; - wchar_t srcdir[MAX_PATH]; - - GetFileNameFromFilePathW(srcname, sizeof(srcname), sw->CallerSfxPath); - GetDirNameFromFilePathW(srcdir, sizeof(srcdir), sw->CallerSfxPath); - - sfx_cache = SwNewCopyTask(srcname, SW_SFX_CACHE_FILENAME, srcdir, sw->InstallDir, true, false); - } - } - - //vpnweb = SwNewCopyTask(L"vpnweb.cab", NULL, sw->InstallSrc, sw->InstallDir, true, false); - //vpninstall = SwNewCopyTask(L"vpninstall.exe", NULL, sw->InstallSrc, sw->InstallDir, true, false); - - Add(t->CopyTasks, vpnclient); - Add(t->CopyTasks, vpncmd); - Add(t->CopyTasks, vpncmgr); - //Add(t->CopyTasks, vpnweb); - //Add(t->CopyTasks, vpninstall); - - - if (sfx_cache != NULL) - { - Add(t->CopyTasks, sfx_cache); - } - - src_config_filename = L"|empty.config"; - - Add(t->CopyTasks, (ct = SwNewCopyTask(src_config_filename, L"vpn_client.config", sw->InstallSrc, sw->InstallDir, false, false))); - - Add(t->CopyTasks, SwNewCopyTask(L"|backup_dir_readme.txt", L"readme.txt", sw->InstallSrc, tmp, false, false)); - - CombinePathW(tmp, sizeof(tmp), ct->DstDir, ct->DstFileName); - Add(t->SetSecurityPaths, CopyUniStr(tmp)); - - //// Definition of the shortcuts - // Desktop and Start menu - Add(t->LinkTasks, SwNewLinkTask(sw->InstallDir, vpncmgr->DstFileName, NULL, NULL, 0, dir_desktop, - _UU("SW_LINK_NAME_VPNCMGR_SHORT"), - _UU("SW_LINK_NAME_VPNCMGR_COMMENT"), true)); - Add(t->LinkTasks, SwNewLinkTask(sw->InstallDir, vpncmgr->DstFileName, NULL, NULL, 0, dir_startmenu, - _UU("SW_LINK_NAME_VPNCMGR_SHORT"), - _UU("SW_LINK_NAME_VPNCMGR_COMMENT"), true)); - - // Programs\PacketiX VPN Client - Add(t->LinkTasks, SwNewLinkTask(sw->InstallDir, vpncmgr->DstFileName, NULL, NULL, 0, dir_app_program, - _UU("SW_LINK_NAME_VPNCMGR_FULL"), - _UU("SW_LINK_NAME_VPNCMGR_COMMENT"), false)); - Add(t->LinkTasks, SwNewLinkTask(sw->InstallDir, vpncmgr->DstFileName, L"/remote", L"vpnsetup.exe", 1, dir_app_program, - _UU("SW_LINK_NAME_VPNCMGR2_FULL"), - _UU("SW_LINK_NAME_VPNCMGR2_COMMENT"), false)); - Add(t->LinkTasks, SwNewLinkTask(sw->InstallDir, vpncmd->DstFileName, NULL, NULL, 0, dir_app_program, - _UU("SW_LINK_NAME_VPNCMD"), - _UU("SW_LINK_NAME_VPNCMD_COMMENT"), false)); - Add(t->LinkTasks, SwNewLinkTask(sw->InstallDir, vpnclient->DstFileName, L"/traffic", L"vpnsetup.exe", 2, dir_admin_tools, - _UU("SW_LINK_NAME_TRAFFIC"), - _UU("SW_LINK_NAME_TRAFFIC_COMMENT"), false)); - - // Programs\PacketiX VPN Client\Configuration Tools - Add(t->LinkTasks, SwNewLinkTask(sw->InstallDir, vpnclient->DstFileName, L"/tcp", L"vpnsetup.exe", 3, dir_config_program, - _UU("SW_LINK_NAME_TCP"), - _UU("SW_LINK_NAME_TCP_COMMENT"), false)); - - if (MsIsWin2000OrGreater()) - { - Add(t->LinkTasks, SwNewLinkTask(MsGetSystem32DirW(), L"services.msc", NULL, L"filemgmt.dll", 0, dir_config_program, - _UU("SW_LINK_NAME_SERVICES"), - _UU("SW_LINK_NAME_SERVICES_COMMENT"), false)); - - if (sw->IsSystemMode) - { - // Debugging information collecting tool - Add(t->LinkTasks, SwNewLinkTask(sw->InstallDir, vpncmd->DstFileName, L"/debug", L"vpnsetup.exe", 4, dir_admin_tools, - _UU("SW_LINK_NAME_DEBUG"), - _UU("SW_LINK_NAME_DEBUG_COMMENT"), false)); - } - } - - // Programs\PacketiX VPN Client\System administrators tool - if (MsIsNt()) - { - Add(t->LinkTasks, SwNewLinkTask(sw->InstallDir, L"vpnsetup.exe", L"/easy:true", L"vpnsetup.exe", 12, dir_admin_tools, - _UU("SW_LINK_NAME_EASYINSTALLER"), - _UU("SW_LINK_NAME_EASYINSTALLER_COMMENT"), false)); - - Add(t->LinkTasks, SwNewLinkTask(sw->InstallDir, L"vpnsetup.exe", L"/web:true", L"vpnsetup.exe", 1, dir_admin_tools, - _UU("SW_LINK_NAME_WEBINSTALLER"), - _UU("SW_LINK_NAME_WEBINSTALLER_COMMENT"), false)); - } - - // Startup - Add(t->LinkTasks, SwNewLinkTask(sw->InstallDir, vpncmgr->DstFileName, L"/startup", NULL, 0, dir_startup, - _UU("SW_LINK_NAME_VPNCMGRTRAY_FULL"), - _UU("SW_LINK_NAME_VPNCMGRTRAY_COMMENT"), true)); - } - else if (c->Id == SW_CMP_VPN_SMGR) - { - // VPN Server Manager (Tools Only) - SW_TASK_COPY *vpncmd, *vpnsmgr; - - vpncmd = SwNewCopyTask(L"vpncmd.exe", NULL, sw->InstallSrc, sw->InstallDir, true, false); - vpnsmgr = SwNewCopyTask(L"vpnsmgr.exe", NULL, sw->InstallSrc, sw->InstallDir, true, false); - - Add(t->CopyTasks, vpncmd); - Add(t->CopyTasks, vpnsmgr); - - //// Definition of the shortcuts - // Desktop and Start menu - Add(t->LinkTasks, SwNewLinkTask(sw->InstallDir, vpnsmgr->DstFileName, NULL, NULL, 0, dir_desktop, - _UU(sw->IsSystemMode ? "SW_LINK_NAME_VPNSMGR_SHORT_TOOLSONLY" : "SW_LINK_NAME_VPNSMGR_SHORT_TOOLSONLY_UM"), - _UU("SW_LINK_NAME_VPNSMGR_COMMENT"), true)); - Add(t->LinkTasks, SwNewLinkTask(sw->InstallDir, vpnsmgr->DstFileName, NULL, NULL, 0, dir_startmenu, - _UU(sw->IsSystemMode ? "SW_LINK_NAME_VPNSMGR_SHORT_TOOLSONLY" : "SW_LINK_NAME_VPNSMGR_SHORT_TOOLSONLY_UM"), - _UU("SW_LINK_NAME_VPNSMGR_COMMENT"), true)); - - // Programs\PacketiX VPN Server Manager (Tools Only) - Add(t->LinkTasks, SwNewLinkTask(sw->InstallDir, vpnsmgr->DstFileName, NULL, NULL, 0, dir_app_program, - _UU("SW_LINK_NAME_VPNSMGR_FULL"), - _UU("SW_LINK_NAME_VPNSMGR_COMMENT"), false)); - Add(t->LinkTasks, SwNewLinkTask(sw->InstallDir, vpncmd->DstFileName, NULL, NULL, 0, dir_app_program, - _UU("SW_LINK_NAME_VPNCMD"), - _UU("SW_LINK_NAME_VPNCMD_COMMENT"), false)); - } - else if (c->Id == SW_CMP_VPN_CMGR) - { - // VPN Client Manager (Tools Only) - SW_TASK_COPY *vpncmd, *vpncmgr; - - vpncmd = SwNewCopyTask(L"vpncmd.exe", NULL, sw->InstallSrc, sw->InstallDir, true, false); - vpncmgr = SwNewCopyTask(L"vpncmgr.exe", NULL, sw->InstallSrc, sw->InstallDir, true, false); - - Add(t->CopyTasks, vpncmd); - Add(t->CopyTasks, vpncmgr); - - //// Definition of the shortcuts - // Desktop and Start menu - Add(t->LinkTasks, SwNewLinkTask(sw->InstallDir, vpncmgr->DstFileName, L"/remote", L"vpnsetup.exe", 1, dir_desktop, - _UU(sw->IsSystemMode ? "SW_LINK_NAME_VPNCMGRTOOLS_SHORT" : "SW_LINK_NAME_VPNCMGRTOOLS_SHORT_UM"), - _UU("SW_LINK_NAME_VPNCMGR2_COMMENT"), true)); - Add(t->LinkTasks, SwNewLinkTask(sw->InstallDir, vpncmgr->DstFileName, L"/remote", L"vpnsetup.exe", 1, dir_startmenu, - _UU(sw->IsSystemMode ? "SW_LINK_NAME_VPNCMGRTOOLS_SHORT" : "SW_LINK_NAME_VPNCMGRTOOLS_SHORT_UM"), - _UU("SW_LINK_NAME_VPNCMGR2_COMMENT"), true)); - - // Programs\PacketiX VPN Client Manager (Tools Only) - Add(t->LinkTasks, SwNewLinkTask(sw->InstallDir, vpncmgr->DstFileName, L"/remote", L"vpnsetup.exe", 1, dir_app_program, - _UU("SW_LINK_NAME_VPNCMGR2_FULL"), - _UU("SW_LINK_NAME_VPNCMGR2_COMMENT"), false)); - Add(t->LinkTasks, SwNewLinkTask(sw->InstallDir, vpncmd->DstFileName, NULL, NULL, 0, dir_app_program, - _UU("SW_LINK_NAME_VPNCMD"), - _UU("SW_LINK_NAME_VPNCMD_COMMENT"), false)); - } - - // Uninstallation - UniFormat(tmp1, sizeof(tmp1), _UU("SW_LINK_NAME_UNINSTALL"), c->Title); - UniFormat(tmp2, sizeof(tmp2), _UU("SW_LINK_NAME_UNINSTALL_COMMENT"), c->Title); - Add(t->LinkTasks, SwNewLinkTask(setup_exe->DstDir, setup_exe->DstFileName, NULL, NULL, 0, dir_config_program, - tmp1, - tmp2, false)); - - // Language settings (except for Win9x) - if (MsIsNt()) - { - UniFormat(tmp1, sizeof(tmp1), _UU("SW_LINK_NAME_LANGUAGE"), c->Title); - UniFormat(tmp2, sizeof(tmp2), _UU("SW_LINK_NAME_LANGUAGE_COMMENT"), c->Title); - Add(t->LinkTasks, SwNewLinkTask(setup_exe->DstDir, setup_exe->DstFileName, L"/language:yes", - L"vpnsetup.exe", 10, dir_config_language, - tmp1, - tmp2, false)); - } - - // Hamcore! - Add(t->CopyTasks, SwNewCopyTask(L"hamcore.se2", NULL, sw->InstallSrc, sw->InstallDir, true, true)); -} - -// Build the Web installer -bool SwWebMain(SW *sw, WIZARD_PAGE *wp) -{ - bool ret = false; - wchar_t tmp[MAX_SIZE]; - // Validate arguments - if (sw == NULL || wp == NULL) - { - return false; - } - - SwPerformPrint(wp, _UU("SW_PERFORM_MSG_WEB_INIT")); - - if (true) - { - wchar_t installer_src_exe[MAX_PATH]; - wchar_t src_cab[MAX_PATH]; - wchar_t vpninstall_exe[MAX_PATH]; - char inf_path[MAX_PATH]; - char htm_path[MAX_PATH]; - LANGLIST current_lang; - BUF *inf_buf = NULL; - BUF *htm_buf = NULL; - BUF *setting_buf = NULL; - char *inf_data = NULL; - UINT inf_data_size; - char *htm_data = NULL; - UINT htm_data_size; - char ver_major[64]; - char ver_minor[64]; - char ver_build[64]; - char *normal_mode = (sw->Web_EasyMode ? "false" : "true"); - char package_name[MAX_SIZE]; - ZIP_PACKER *z = NULL; - - ToStr(ver_major, CEDAR_VERSION_MAJOR); - ToStr(ver_minor, CEDAR_VERSION_MINOR); - ToStr(ver_build, CEDAR_VERSION_BUILD); - - Format(package_name, sizeof(package_name), - GC_SW_SOFTETHER_PREFIX "vpnclient-v%u.%02u-%u-%04u-%02u-%02u-windows.exe", - CEDAR_VERSION_MAJOR, CEDAR_VERSION_MINOR, CEDAR_VERSION_BUILD, - BUILD_DATE_Y, BUILD_DATE_M, BUILD_DATE_D); - - GetCurrentLang(¤t_lang); - - // Installer cache file - CombinePathW(installer_src_exe, sizeof(installer_src_exe), MsGetExeDirNameW(), SW_SFX_CACHE_FILENAME); - - // Cab file - CombinePathW(src_cab, sizeof(src_cab), MsGetExeDirNameW(), L"vpnweb.cab"); - - // Vpninstall file - CombinePathW(vpninstall_exe, sizeof(vpninstall_exe), MsGetExeDirNameW(), L"vpninstall.exe"); - - // Confirm existence of the file - if (IsFileExistsW(installer_src_exe) == false) - { - UniFormat(tmp, sizeof(tmp), _UU("SW_FILE_NOT_FOUNT"), installer_src_exe); - SwPerformMsgBox(wp, MB_ICONSTOP, tmp); - goto LABEL_CLEANUP; - } - if (IsFileExistsW(src_cab) == false) - { - UniFormat(tmp, sizeof(tmp), _UU("SW_FILE_NOT_FOUNT"), src_cab); - SwPerformMsgBox(wp, MB_ICONSTOP, tmp); - goto LABEL_CLEANUP; - } - if (IsFileExistsW(vpninstall_exe) == false) - { - UniFormat(tmp, sizeof(tmp), _UU("SW_FILE_NOT_FOUNT"), vpninstall_exe); - SwPerformMsgBox(wp, MB_ICONSTOP, tmp); - goto LABEL_CLEANUP; - } - - // Read the configuration file - setting_buf = ReadDumpW(sw->Web_SettingFile); - if (setting_buf != NULL) - { - if (sw->Web_EraseSensitive) - { - // Remove the secret information - CiEraseSensitiveInAccount(setting_buf); - } - } - - // Verify the signature of the installer cache file - if (MsCheckFileDigitalSignatureW(NULL, installer_src_exe, NULL) == false) - { - // Installer cache file is not signed - if (SwPerformMsgBox(wp, MB_ICONEXCLAMATION | MB_YESNO | MB_DEFBUTTON2, - _UU("SW_INSTALLER_CACHE_IS_NOT_SIGNED")) == IDNO) - { - // Cancel - goto LABEL_CLEANUP; - } - } - - // Read the .inf file - Format(inf_path, sizeof(inf_path), "|vpninstall_%s.inf", current_lang.Name); - - inf_buf = ReadDump(inf_path); - if (inf_buf == NULL) - { - goto LABEL_CLEANUP; - } - - inf_data_size = (inf_buf->Size + 1024) * 2; - inf_data = ZeroMalloc(inf_data_size); - Copy(inf_data, inf_buf->Buf, inf_buf->Size); - - ReplaceStrEx(inf_data, inf_data_size, inf_data, "$VER_BUILD$", ver_build, false); - ReplaceStrEx(inf_data, inf_data_size, inf_data, "$PACKAGE_FILENAME$", package_name, false); - ReplaceStrEx(inf_data, inf_data_size, inf_data, "$NORMAL_MODE$", normal_mode, false); - - // Read the .htm file - Format(htm_path, sizeof(htm_path), "|vpnweb_sample_%s.htm", current_lang.Name); - - htm_buf = ReadDump(htm_path); - if (htm_buf == NULL) - { - goto LABEL_CLEANUP; - } - - htm_data_size = (htm_buf->Size + 1024) * 2; - htm_data = ZeroMalloc(htm_data_size); - Copy(htm_data, htm_buf->Buf, htm_buf->Size); - - ReplaceStrEx(htm_data, htm_data_size, htm_data, "$VER_MAJOR$", ver_major, false); - ReplaceStrEx(htm_data, htm_data_size, htm_data, "$VER_MINOR$", ver_minor, false); - ReplaceStrEx(htm_data, htm_data_size, htm_data, "$VER_BUILD$", ver_build, false); - - // Creating a ZIP - z = NewZipPacker(); - - if (ZipAddRealFileW(z, "vpnweb.cab", 0, 0, src_cab) == false || - ZipAddRealFileW(z, "vpninstall.exe", 0, 0, vpninstall_exe) == false || - ZipAddRealFileW(z, package_name, 0, 0, installer_src_exe) == false) - { - goto LABEL_CLEANUP; - } - - ZipAddFileSimple(z, "vpninstall.inf", 0, 0, inf_data, StrLen(inf_data)); - ZipAddFileSimple(z, "index.html", 0, 0, htm_data, StrLen(htm_data)); - ZipAddFileSimple(z, "auto_setting.vpn", 0, 0, setting_buf->Buf, setting_buf->Size); - - // Export - if (ZipWriteW(z, sw->Web_OutFile)) - { - ret = true; - - UniFormat(sw->FinishMsg, sizeof(sw->FinishMsg), - _UU("SW_WEB_FINISHED"), - sw->Web_OutFile); - } - -LABEL_CLEANUP: - FreeZipPacker(z); - FreeBuf(setting_buf); - FreeBuf(inf_buf); - FreeBuf(htm_buf); - Free(inf_data); - Free(htm_data); - } - - - return ret; -} - -// Build a simple installer -bool SwEasyMain(SW *sw, WIZARD_PAGE *wp) -{ - LIST *o; - BUF *b; - bool ret = false; - wchar_t account_tmp[MAX_PATH]; - // Validate arguments - if (sw == NULL || wp == NULL) - { - return false; - } - - SwPerformPrint(wp, _UU("SW_PERFORM_MSG_EASY_INIT")); - - o = SwNewSfxFileList(); - - SwAddBasicFilesToList(o, "vpnclient"); - - // Load a connection setting file - b = ReadDumpW(sw->Easy_SettingFile); - if (b != NULL) - { - if (sw->Easy_EraseSensitive) - { - // Remove secret information - CiEraseSensitiveInAccount(b); - } - - // Save to a temporary folder - CombinePathW(account_tmp, sizeof(account_tmp), MsGetMyTempDirW(), L"vpn_setting.vpn"); - if (DumpBufW(b, account_tmp)) - { - // Add a connection settings to file list of SFX - Add(o, SwNewSfxFile(SW_AUTO_CONNECT_ACCOUNT_FILE_NAME, account_tmp)); - - if (sw->Easy_EasyMode) - { - // Set the connection manager to simple mode - Add(o, SwNewSfxFile(SW_FLAG_EASY_MODE, account_tmp)); - } - - if (SwCompileSfx(o, sw->Easy_OutFile)) - { - ret = true; - } - - FileDeleteW(account_tmp); - } - - FreeBuf(b); - } - - SwFreeSfxFileList(o); - - if (ret) - { - // Completion message - UniFormat(sw->FinishMsg, sizeof(sw->FinishMsg), _UU("SW_EASY_FINISHED_MSG"), sw->Easy_OutFile); - } - - return ret; -} - -// Installation main -bool SwInstallMain(SW *sw, WIZARD_PAGE *wp, SW_COMPONENT *c) -{ - SW_TASK *t; - bool ret = false; - UINT i; - wchar_t tmp[MAX_SIZE * 2]; - bool ok; - // Validate arguments - if (sw == NULL || wp == NULL || c == NULL) - { - return false; - } - - ok = true; - t = NULL; - - // Create a Setup task - SwPerformPrint(wp, _UU("SW_PERFORM_MSG_INIT_TASKS")); - t = SwNewTask(); - - // Create a list of files to be installed - SwDefineTasks(sw, t, c); - - if (sw->LanguageMode) - { - goto LABEL_CREATE_SHORTCUT; - } - - if (sw->OnlyAutoSettingMode) - { - goto LABEL_IMPORT_SETTING; - } - - // Install the SeLow - if (SuIsSupportedOs(true)) - { - // Only in the system mode - if (c->InstallService && sw->IsSystemMode) - { - // Not to install in the case of the VPN Client - bool install_su = false; - - if (c->Id != SW_CMP_VPN_CLIENT) - { - install_su = true; - } - - - if (install_su) - { - bool ret; - - SwPerformPrint(wp, _UU("SW_PERFORM_MSG_INSTALL_SELOW")); - ret = SuInstallDriver(false); - - if (ret == false) - { - if (MsIs64BitWindows() && MsIsWindows10()) - { - void *proc_handle = NULL; - wchar_t exe[MAX_PATH]; - - CombinePathW(exe, sizeof(exe), MsGetExeDirNameW(), L"vpnsetup.exe"); - - if (MsExecuteEx2W(exe, L"/SUINSTMODE:yes", &proc_handle, true)) - { - if (proc_handle != NULL) - { - MsWaitProcessExit(proc_handle); - } - } - } - } - } - } - } - - // Uninstall the old MSI - ok = true; - if (sw->IsSystemMode && c->OldMsiList != NULL) - { - bool reboot_required = false; - - if (SwUninstallOldMsiInstalled(wp->Wizard->hWndWizard, wp, c, &reboot_required) == false) - { - // MSI uninstall Failed - ok = false; - } - else if (reboot_required) - { - // Require to restart - ok = false; - - sw->MsiRebootRequired = true; - } - } - - if (ok == false) - { - goto LABEL_CLEANUP; - } - - // Stop the Service - ok = true; - - if (c->InstallService) - { - char svc_title_name[MAX_SIZE]; - wchar_t *svc_title; - - Format(svc_title_name, sizeof(svc_title_name), "SVC_%s_TITLE", c->SvcName); - - svc_title = _UU(svc_title_name); - - if (UniIsEmptyStr(svc_title) == false) - { - if (sw->IsSystemMode && MsIsNt()) - { - // WinNT and system mode - if (MsIsServiceRunning(c->SvcName)) - { - wchar_t svc_exe[MAX_SIZE]; - UINT64 giveup_tick; - UniFormat(tmp, sizeof(tmp), _UU("SW_PERFORM_MSG_STOP_SVC"), svc_title); - SwPerformPrint(wp, tmp); - -LABEL_RETRY_3: - if (MsStopService(c->SvcName) == false) - { - UniFormat(tmp, sizeof(tmp), _UU("SW_PERFORM_MSG_STOP_SVC_ERROR"), svc_title, c->SvcName); - if (SwPerformMsgBox(wp, MB_ICONEXCLAMATION | MB_RETRYCANCEL, tmp) != IDRETRY) - { - // Cancel - ok = false; - } - else - { - if (MsIsServiceRunning(c->SvcName)) - { - goto LABEL_RETRY_3; - } - } - } - - // Wait for 5 seconds if stopped the service - SleepThread(5000); - - // Wait until the EXE file for the service become ready to write - ConbinePathW(svc_exe, sizeof(svc_exe), sw->InstallDir, c->SvcFileName); - - giveup_tick = Tick64() + (UINT64)10000; - while (IsFileWriteLockedW(svc_exe)) - { - UniFormat(tmp, sizeof(tmp), _UU("SW_PERFORM_MSG_WAIT_FOR_FILE_UNLOCK"), svc_exe); - SwPerformPrint(wp, tmp); - - SleepThread(100); - - if (Tick64() >= giveup_tick) - { - break; - } - } - } - } - else - { - // In the case of Win9x or user mode - wchar_t svc_exe[MAX_SIZE]; - UINT64 giveup_tick; - - // Stop the Service - MsStopUserModeSvc(c->SvcName); - SleepThread(3000); - - // Wait until the EXE file for the service become ready to write - ConbinePathW(svc_exe, sizeof(svc_exe), sw->InstallDir, c->SvcFileName); - - giveup_tick = Tick64() + (UINT64)10000; - while (IsFileWriteLockedW(svc_exe)) - { - UniFormat(tmp, sizeof(tmp), _UU("SW_PERFORM_MSG_WAIT_FOR_FILE_UNLOCK"), svc_exe); - SwPerformPrint(wp, tmp); - - SleepThread(100); - - if (Tick64() >= giveup_tick) - { - break; - } - } - } - } - } - - if (ok == false) - { - goto LABEL_CLEANUP; - } - - // Examine preliminary whether files to be copied are writable successfully - ok = true; - - SwPerformPrint(wp, _UU("SW_PERFORM_MSG_COPY_PREPARE")); - - for (i = 0;i < LIST_NUM(t->CopyTasks);i++) - { - SW_TASK_COPY *ct = LIST_DATA(t->CopyTasks, i); - - wchar_t fullpath[MAX_SIZE]; - IO *io; - bool write_ok; - bool new_file; - bool new_dir; - UINT64 giveup_tick = Tick64() + 30000ULL; - -LABEL_RETRY_1: - new_dir = write_ok = new_file = false; - - CombinePathW(fullpath, sizeof(fullpath), ct->DstDir, ct->DstFileName); - - if (ct->Overwrite == false) - { - // Do not check if overwrite is Off - continue; - } - - // If the process with the same name is running, kill it - if (MsKillProcessByExeName(fullpath) != 0) - { - // Wait for 1 second if killed the process - SleepThread(1000); - } - - new_dir = MakeDirExW(ct->DstDir); - - // Write check - io = FileOpenExW(fullpath, true, true); - if (io == NULL) - { - io = FileCreateW(fullpath); - new_file = true; - } - if (io != NULL) - { - // Writing OK - write_ok = true; - - FileCloseEx(io, true); - - if (new_file) - { - FileDeleteW(fullpath); - } - } - - if (new_dir) - { - DeleteDirW(ct->DstDir); - } - - if (write_ok == false) - { - UINT64 now = Tick64(); - - if (now <= giveup_tick) - { - // Do the auto-retry in 30 seconds - SleepThread(1000); - goto LABEL_RETRY_1; - } - - // Show an error message if it fails - UniFormat(tmp, sizeof(tmp), _UU("SW_PERFORM_MSG_WRITE_ERROR"), fullpath, c->Title); - if (SwPerformMsgBox(wp, MB_ICONEXCLAMATION | MB_RETRYCANCEL, tmp) != IDRETRY) - { - // Cancel - ok = false; - break; - } - else - { - // Retry - goto LABEL_RETRY_1; - } - } - } - - if (ok == false) - { - goto LABEL_CLEANUP; - } - - // File Copy - ok = true; - - for (i = 0;i < LIST_NUM(t->CopyTasks);i++) - { - SW_TASK_COPY *ct = LIST_DATA(t->CopyTasks, i); - wchar_t fullpath_src[MAX_SIZE]; - wchar_t fullpath_dst[MAX_SIZE]; - bool skip; - -LABEL_RETRY_2: - - if (UniStartWith(ct->SrcFileName, L"|") == false) - { - CombinePathW(fullpath_src, sizeof(fullpath_src), ct->SrcDir, ct->SrcFileName); - } - else - { - UniStrCpy(fullpath_src, sizeof(fullpath_src), ct->SrcFileName); - } - - CombinePathW(fullpath_dst, sizeof(fullpath_dst), ct->DstDir, ct->DstFileName); - - UniFormat(tmp, sizeof(tmp), _UU("SW_PERFORM_MSG_COPY_FILE"), fullpath_dst); - SwPerformPrint(wp, tmp); - - skip = false; - - if (ct->Overwrite == false) - { - if (IsFileExistsW(fullpath_dst)) - { - // Do nothing because the destination file already exists - skip = true; - } - } - - if (skip == false) - { - // Create a directory - if (MakeDirExW(ct->DstDir)) - { - SwAddLog(sw, sw->LogFile, SW_LOG_TYPE_DIR, ct->DstDir); - } - - // Copy - if (FileCopyW(fullpath_src, fullpath_dst) == false && ct->Overwrite) - { - // Show an error message if it fails - UniFormat(tmp, sizeof(tmp), _UU("SW_PERFORM_MSG_COPY_ERROR"), fullpath_dst); - if (SwPerformMsgBox(wp, MB_ICONEXCLAMATION | MB_RETRYCANCEL, tmp) != IDRETRY) - { - // Cancel - ok = false; - break; - } - else - { - // Retry - goto LABEL_RETRY_2; - } - } - else - { - if (ct->Overwrite && ct->SetupFile == false) - { - SwAddLog(sw, sw->LogFile, SW_LOG_TYPE_FILE, fullpath_dst); - } - } - } - } - - if (ok == false) - { - goto LABEL_CLEANUP; - } - - - if (sw->IsSystemMode && MsIsNt()) - { - // ACL settings only in the system mode - for (i = 0;i < LIST_NUM(t->SetSecurityPaths);i++) - { - // Security Settings - wchar_t *path = LIST_DATA(t->SetSecurityPaths, i); - - UniFormat(tmp, sizeof(tmp), _UU("SW_PERFORM_MSG_SET_SECURITY"), path); - SwPerformPrint(wp, tmp); - - MsSetFileSecureAcl(path); - } - } - - // Set the language of the destination - if (true) - { - LANGLIST current_lang; - wchar_t langfilename[MAX_PATH]; - - Zero(¤t_lang, sizeof(current_lang)); - GetCurrentLang(¤t_lang); - - ConbinePathW(langfilename, sizeof(langfilename), sw->InstallDir, L"lang.config"); - - SaveLangConfig(langfilename, current_lang.Name); - } - - // Firewall registration - if (true) - { - char dira[MAX_PATH]; - - UniToStr(dira, sizeof(dira), sw->InstallDir); - - RegistWindowsFirewallAllEx(dira); - } - - if (c->Id == SW_CMP_VPN_SERVER || c->Id == SW_CMP_VPN_BRIDGE) - { - // Disable the off-loading - MsDisableNetworkOffloadingEtc(); - } - - // Install the service - ok = true; - - if (c->InstallService) - { - char svc_title_name[MAX_SIZE]; - char svc_description_name[MAX_SIZE]; - wchar_t *svc_title; - - Format(svc_title_name, sizeof(svc_title_name), "SVC_%s_TITLE", c->SvcName); - Format(svc_description_name, sizeof(svc_description_name), "SVC_%s_DESCRIPT", c->SvcName); - - svc_title = _UU(svc_title_name); - - if (UniIsEmptyStr(svc_title) == false) - { - if (sw->IsSystemMode == false || MsIsNt() == false) - { - // Just simply start in user mode or Win9x mode - wchar_t fullpath[MAX_SIZE]; - -LABEL_RETRY_USERMODE_EXEC: - - CombinePathW(fullpath, sizeof(fullpath), sw->InstallDir, c->SvcFileName); - - if (MsExecuteW(fullpath, (MsIsNt() ? L"/usermode" : L"/win9x_service")) == false) - { - UniFormat(tmp, sizeof(tmp), _UU("SW_PERFORM_MSG_SVC_USERMODE_EXEC_FAILED"), fullpath); - - if (SwPerformMsgBox(wp, MB_ICONEXCLAMATION | MB_RETRYCANCEL, tmp) != IDRETRY) - { - // Cancel - ok = false; - } - else - { - // Retry - goto LABEL_RETRY_USERMODE_EXEC; - } - } - else - { - if (MsIsNt() == false) - { - // Register into the registry as a background service in the case of Win9x - wchar_t fullpath2[MAX_SIZE]; - - UniFormat(fullpath2, sizeof(fullpath2), L"\"%s\" /win9x_service", fullpath); - - MsRegWriteStrW(REG_LOCAL_MACHINE, WIN9X_SVC_REGKEY_1, c->SvcName, fullpath2); - MsRegWriteStrW(REG_LOCAL_MACHINE, WIN9X_SVC_REGKEY_2, c->SvcName, fullpath2); - } - } - } - else - { - // System mode - UniFormat(tmp, sizeof(tmp), _UU("SW_PERFORM_MSG_INSTALL_SVC"), svc_title); - SwPerformPrint(wp, tmp); - -LABEL_RETRY_4: - - if (MsIsServiceInstalled(c->SvcName)) - { - // Stop the service if it is running by any chance - MsStopService(c->SvcName); - } - - if (MsIsServiceInstalled(c->SvcName)) - { - // Uninstall the old service - if (MsUninstallService(c->SvcName) == false) - { - // Show an error message if it fails - UniFormat(tmp, sizeof(tmp), _UU("SW_PERFORM_MSG_SVC_UNINSTALL_FAILED"), svc_title, c->SvcName); - if (SwPerformMsgBox(wp, MB_ICONEXCLAMATION | MB_RETRYCANCEL, tmp) != IDRETRY) - { - // Cancel - ok = false; - } - else - { - // Retry - goto LABEL_RETRY_4; - } - } - } - - if (ok) - { - wchar_t fullpath[MAX_SIZE]; - wchar_t fullpath2[MAX_SIZE]; - - CombinePathW(fullpath2, sizeof(fullpath), sw->InstallDir, c->SvcFileName); - UniFormat(fullpath, sizeof(fullpath), L"\"%s\" /service", fullpath2); - - // Install a new service - if (MsInstallServiceW(c->SvcName, svc_title, _UU(svc_description_name), fullpath) == false) - { - // Show the error message if it fails - UniFormat(tmp, sizeof(tmp), _UU("SW_PERFORM_MSG_SVC_INSTALL_FAILED"), svc_title, c->SvcName); - if (SwPerformMsgBox(wp, MB_ICONEXCLAMATION | MB_RETRYCANCEL, tmp) != IDRETRY) - { - // Cancel - ok = false; - } - else - { - // Retry - goto LABEL_RETRY_4; - } - } - else - { - wchar_t wtmp[256]; - - StrToUni(wtmp, sizeof(wtmp), c->SvcName); - SwAddLog(sw, sw->LogFile, SW_LOG_TYPE_SVC, wtmp); - } - } - - if (ok) - { - UniFormat(tmp, sizeof(tmp), _UU("SW_PERFORM_MSG_START_SVC"), svc_title); - SwPerformPrint(wp, tmp); - - MsRegWriteIntEx2(REG_LOCAL_MACHINE, "Software\\" GC_REG_COMPANY_NAME "\\Update Service Config", c->SvcName, 0, false, true); - -LABEL_RETRY_5: - // Start the service - if (MsStartService(c->SvcName) == false) - { - // Show the error message if it fails - UniFormat(tmp, sizeof(tmp), _UU("SW_PERFORM_MSG_START_SVC_ERROR"), svc_title, c->SvcName); - if (SwPerformMsgBox(wp, MB_ICONEXCLAMATION | MB_RETRYCANCEL, tmp) != IDRETRY) - { - // Cancel - ok = false; - } - else - { - // Retry - if (MsIsServiceRunning(c->SvcName) == false) - { - goto LABEL_RETRY_5; - } - } - } - } - } - - if (c->Id == SW_CMP_VPN_CLIENT) - { - // In the VPN Client service, wait until the service port can be connected - SwWaitForVpnClientPortReady(SW_VPNCLIENT_SERVICE_WAIT_READY_TIMEOUT); - } - } - } - - if (ok == false) - { - goto LABEL_CLEANUP; - } - -LABEL_CREATE_SHORTCUT: - - // Create a shortcut - SwInstallShortcuts(sw, wp, c, t); - - if (sw->LanguageMode) - { - // Update the Description of the service if in the language setting mode - if (c->InstallService) - { - char svc_description_name[MAX_SIZE]; - wchar_t *svc_description; - - Format(svc_description_name, sizeof(svc_description_name), "SVC_%s_DESCRIPT", c->SvcName); - - svc_description = _UU(svc_description_name); - - if (UniIsEmptyStr(svc_description) == false) - { - if (sw->IsSystemMode && MsIsNt()) - { - MsSetServiceDescription(c->SvcName, svc_description); - } - } - } - - goto LABEL_REGISTER_UNINSTALL; - } - - if (c->Id == SW_CMP_VPN_CLIENT) - { - // Register the UI Helper in the Run in the case of the VPN Client - wchar_t fullpath[MAX_PATH]; - wchar_t fullcmd[MAX_SIZE]; - - ConbinePathW(fullpath, sizeof(fullpath), sw->InstallDir, c->SvcFileName); - - UniFormat(fullcmd, sizeof(fullcmd), L"\"%s\" /uihelp", fullpath); - - MsRegWriteStrEx2W(REG_LOCAL_MACHINE, "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Run", - SW_VPN_CLIENT_UIHELPER_REGVALUE, fullcmd, false, true); - - // Start the UI Helper - MsExecuteW(fullpath, L"/uihelp"); - - SleepThread(3000); - } - - if (true) - { - // Run the vpncmd and exit immediately - wchar_t fullpath[MAX_PATH]; - - ConbinePathW(fullpath, sizeof(fullpath), sw->InstallDir, (L"vpncmd.exe")); - - RunW(fullpath, L"/?", true, false); - } - - if (c->Id == SW_CMP_VPN_CLIENT) - { - wchar_t dst_vpnclient_exe[MAX_PATH]; - wchar_t vpnclient_arg[MAX_SIZE]; - - ConbinePathW(dst_vpnclient_exe, sizeof(dst_vpnclient_exe), sw->InstallDir, c->SvcFileName); - UniFormat(vpnclient_arg, sizeof(vpnclient_arg), L"\"%s\" \"%%1\"", dst_vpnclient_exe); - - // Register the association to .vpn file in the case of VPN Client - MsRegWriteStrEx2(REG_LOCAL_MACHINE, SW_VPN_CLIENT_EXT_REGKEY, NULL, SW_VPN_CLIENT_EXT_REGVALUE, false, true); - SwAddLogA(sw, sw->LogFile, SW_LOG_TYPE_REGISTRY, SW_VPN_CLIENT_EXT_REGKEY); - - MsRegNewKeyEx2(REG_LOCAL_MACHINE, SW_VPN_CLIENT_EXT_REGKEY_SUB1, false, true); - MsRegNewKeyEx2(REG_LOCAL_MACHINE, SW_VPN_CLIENT_EXT_REGKEY_SUB2, false, true); - SwAddLogA(sw, sw->LogFile, SW_LOG_TYPE_REGISTRY, SW_VPN_CLIENT_EXT_REGKEY_SUB1); - SwAddLogA(sw, sw->LogFile, SW_LOG_TYPE_REGISTRY, SW_VPN_CLIENT_EXT_REGKEY_SUB2); - - MsRegWriteStrEx2(REG_LOCAL_MACHINE, SW_VPN_CLIENT_VPNFILE_REGKEY, NULL, SW_VPN_CLIENT_VPNFILE_REGVALUE, false, true); - SwAddLogA(sw, sw->LogFile, SW_LOG_TYPE_REGISTRY, SW_VPN_CLIENT_VPNFILE_REGKEY); - - MsRegWriteStrEx2W(REG_LOCAL_MACHINE, SW_VPN_CLIENT_VPNFILE_ICON_REGKEY, NULL, dst_vpnclient_exe, false, true); - SwAddLogA(sw, sw->LogFile, SW_LOG_TYPE_REGISTRY, SW_VPN_CLIENT_VPNFILE_ICON_REGKEY); - - MsRegWriteStrEx2W(REG_LOCAL_MACHINE, SW_VPN_CLIENT_VPNFILE_SHELLOPEN_CMD_REGKEY, NULL, vpnclient_arg, false, true); - SwAddLogA(sw, sw->LogFile, SW_LOG_TYPE_REGISTRY, SW_VPN_CLIENT_VPNFILE_SHELLOPEN_CMD_REGKEY_SUB2); - SwAddLogA(sw, sw->LogFile, SW_LOG_TYPE_REGISTRY, SW_VPN_CLIENT_VPNFILE_SHELLOPEN_CMD_REGKEY_SUB1); - SwAddLogA(sw, sw->LogFile, SW_LOG_TYPE_REGISTRY, SW_VPN_CLIENT_VPNFILE_SHELLOPEN_CMD_REGKEY); - } - - if (c->Id == SW_CMP_VPN_CLIENT) - { - // Disable the MMCSS - MsSetMMCSSNetworkThrottlingEnable(false); - } - -LABEL_IMPORT_SETTING: - if (c->Id == SW_CMP_VPN_CLIENT) - { - if (UniIsEmptyStr(sw->auto_setting_path) == false) - { - if (UniIsEmptyStr(sw->vpncmgr_path) == false) - { - if (sw->DisableAutoImport == false) - { - wchar_t tmp_setting_path[MAX_PATH]; - wchar_t arg[MAX_PATH]; - void *handle; - bool easy_mode = IsFileExists(SW_FLAG_EASY_MODE_2); - // Run the vpncmgr, and start a connection by importing the connection configuration file - // Store a connection setting file to stable temporally directory - - SwPerformPrint(wp, _UU("SW_PERFORM_MSG_IMPORTING_ACCOUNT")); - - ConbinePathW(tmp_setting_path, sizeof(tmp_setting_path), MsGetTempDirW(), L"vpn_auto_connect.vpn"); - FileCopyW(sw->auto_setting_path, tmp_setting_path); - - // Start the vpncmgr - UniFormat(arg, sizeof(arg), L"/%S \"%s\"", (easy_mode ? "easy" : "normal"), tmp_setting_path); - handle = MsRunAsUserExW(sw->vpncmgr_path, arg, false); - - if (handle != NULL) - { - sw->HideStartCommand = true; - - CloseHandle(handle); - } - } - } - } - } - - if (sw->OnlyAutoSettingMode) - { - goto LABEL_FINISHED; - } - -LABEL_REGISTER_UNINSTALL: - // Register the uninstall information - if (sw->IsSystemMode) - { - char uninstall_keyname[MAX_SIZE]; - wchar_t uninstall_keyname_w[MAX_SIZE]; - char uninstall_version[MAX_SIZE]; - wchar_t dst_setup_exe[MAX_PATH]; - wchar_t setup_icon[MAX_SIZE]; - wchar_t uninstaller_exe[MAX_PATH]; - SYSTEMTIME st; - char install_date[MAX_PATH]; - - SwPerformPrint(wp, _UU("SW_PERFORM_MSG_REGISTER_UNINSTALL")); - - Zero(&st, sizeof(st)); - LocalTime(&st); - - Format(install_date, sizeof(install_date), "%04u/%02u/%02u", st.wYear, st.wMonth, st.wDay); - - CombinePathW(dst_setup_exe, sizeof(dst_setup_exe), sw->InstallDir, L"vpnsetup.exe"); - - Format(uninstall_keyname, sizeof(uninstall_keyname), - "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\softether_" GC_SW_SOFTETHER_PREFIX "%s", c->Name); - StrToUni(uninstall_keyname_w, sizeof(uninstall_keyname_w), uninstall_keyname); - - GetCedarVersion(uninstall_version, sizeof(uninstall_version)); - - // Display name - MsRegWriteStrEx2W(REG_LOCAL_MACHINE, uninstall_keyname, "DisplayName", c->LongName, - false, true); - - // Version - MsRegWriteStrEx2(REG_LOCAL_MACHINE, uninstall_keyname, "DisplayVersion", uninstall_version, - false, true); - - // Icon - UniFormat(setup_icon, sizeof(setup_icon), L"\"%s\",%u", dst_setup_exe, c->IconExeIndex); - MsRegWriteStrEx2W(REG_LOCAL_MACHINE, uninstall_keyname, "DisplayIcon", setup_icon, - false, true); - - // Information - MsRegWriteIntEx2(REG_LOCAL_MACHINE, uninstall_keyname, "NoModify", 1, false, true); - MsRegWriteIntEx2(REG_LOCAL_MACHINE, uninstall_keyname, "NoRepair", 1, false, true); - - // Link - MsRegWriteStrEx2(REG_LOCAL_MACHINE, uninstall_keyname, "HelpLink", _SS("SW_UNINSTALLINFO_URL"), - false, true); - MsRegWriteStrEx2(REG_LOCAL_MACHINE, uninstall_keyname, "URLInfoAbout", _SS("SW_UNINSTALLINFO_URL"), - false, true); - MsRegWriteStrEx2(REG_LOCAL_MACHINE, uninstall_keyname, "URLUpdateInfo", _SS("SW_UNINSTALLINFO_URL"), - false, true); - - // Publisher - MsRegWriteStrEx2W(REG_LOCAL_MACHINE, uninstall_keyname, "Publisher", _UU("SW_UNINSTALLINFO_PUBLISHER"), - false, true); - - // Date of installation - MsRegWriteStrEx2(REG_LOCAL_MACHINE, uninstall_keyname, "InstallDate", install_date, - false, true); - - // Uninstaller - UniFormat(uninstaller_exe, sizeof(uninstaller_exe), L"\"%s\"", dst_setup_exe); - MsRegWriteStrEx2W(REG_LOCAL_MACHINE, uninstall_keyname, "UninstallString", uninstaller_exe, - false, true); - - if (sw->LanguageMode == false) - { - SwAddLog(sw, sw->LogFile, SW_LOG_TYPE_REGISTRY, uninstall_keyname_w); - } - } - - // Write the log - if (true) - { - wchar_t log_filename[MAX_SIZE]; - -L_RETRY_LOG: - - SwPerformPrint(wp, _UU("SW_PERFORM_MSG_WRITE_LOG")); - - CombinePathW(log_filename, sizeof(log_filename), sw->InstallDir, L"setuplog.dat"); - - if (sw->LanguageMode == false) - { - SwAddLog(sw, sw->LogFile, SW_LOG_TYPE_FILE, log_filename); - } - - sw->LogFile->IsSystemMode = sw->IsSystemMode; - sw->LogFile->Component = sw->CurrentComponent; - sw->LogFile->Build = CEDAR_VERSION_BUILD; - - if (SwSaveLogFile(sw, log_filename, sw->LogFile) == false) - { - // Show the error message if it fails - UINT msgret; - UniFormat(tmp, sizeof(tmp), _UU("SW_PERFORM_MSG_WRITE_LOG_ERROR"), log_filename); - msgret = SwPerformMsgBox(wp, MB_ICONEXCLAMATION | MB_YESNO, tmp); - - if (msgret == IDYES) - { - // Retry - goto L_RETRY_LOG; - } - } - } - - if (true) - { - // Record the installed build number and directory in the registry - char keyname[MAX_SIZE]; - LANGLIST current_lang; - LANGLIST current_os_lang; - - GetCurrentLang(¤t_lang); - GetCurrentLang(¤t_os_lang); - - Format(keyname, sizeof(keyname), "%s\\%s", SW_REG_KEY, sw->CurrentComponent->Name); - MsRegWriteStrEx2W(sw->IsSystemMode ? REG_LOCAL_MACHINE : REG_CURRENT_USER, - keyname, "InstalledDir", sw->InstallDir, false, true); - MsRegWriteIntEx2(sw->IsSystemMode ? REG_LOCAL_MACHINE : REG_CURRENT_USER, - keyname, "InstalledBuild", CEDAR_VERSION_BUILD, false, true); - - // Set the language to registry - MsRegWriteStrEx2(REG_CURRENT_USER, SW_REG_KEY, "Last User Language", - current_lang.Name, false, true); - MsRegWriteStrEx2(REG_CURRENT_USER, SW_REG_KEY, "Last Operating System Language", - current_os_lang.Name, false, true); - - // Save the EULA agreement record - if (sw->EulaAgreed && sw->CurrentEulaHash != 0) - { - MsRegWriteIntEx2(REG_CURRENT_USER, SW_REG_KEY_EULA, sw->CurrentComponent->Name, - sw->CurrentEulaHash, false, true); - } - } - - SwPerformPrint(wp, _UU("SW_PERFORM_MSG_UPDATING")); - - // Notify the update to the system - MsUpdateSystem(); - - if (sw->LanguageMode) - { - // Show a message that the language configuration is complete - wchar_t msg[MAX_SIZE]; - - UniFormat(msg, sizeof(msg), _UU("SW_LANG_OK"), c->Title, c->Title); - - if (c->InstallService) - { - UniStrCat(msg, sizeof(msg), _UU("SW_LANG_OK_SERVICE")); - } - - if (c->Id == SW_CMP_VPN_CLIENT) - { - UniStrCat(msg, sizeof(msg), _UU("SW_LANG_OK_VPNCMGR")); - } - - UniStrCpy(sw->FinishMsg, sizeof(sw->FinishMsg), msg); - } - -LABEL_FINISHED: - - // Completion message - SwPerformPrint(wp, _UU("SW_PERFORM_MSG_FINISHED")); - - ret = true; - -LABEL_CLEANUP: - // Release the task - if (t != NULL) - { - SwFreeTask(t); - } - - return ret; -} - -// Wait for that the listening port of the VPN Client service becomes available -bool SwWaitForVpnClientPortReady(UINT timeout) -{ - UINT64 start, giveup; - bool ret = false; - if (timeout == 0) - { - timeout = SW_VPNCLIENT_SERVICE_WAIT_READY_TIMEOUT; - } - - start = Tick64(); - giveup = start + (UINT64)timeout; - - while (Tick64() < giveup) - { - if (CheckTCPPortEx("localhost", CLIENT_CONFIG_PORT, 1000)) - { - ret = true; - break; - } - - SleepThread(1000); - } - - return ret; -} - -// Create a Shortcut file (Delete the old one) -void SwInstallShortcuts(SW *sw, WIZARD_PAGE *wp, SW_COMPONENT *c, SW_TASK *t) -{ - UINT i; - wchar_t tmp[MAX_SIZE]; - wchar_t setuplog[MAX_PATH]; - LIST *o; - SW_LOGFILE *oldlog; - // Validate arguments - if (sw == NULL || wp == NULL || c == NULL || t == NULL) - { - return; - } - - // If there is an old setup log, read it - CombinePathW(setuplog, sizeof(setuplog), sw->InstallDir, L"setuplog.dat"); - oldlog = SwLoadLogFile(sw, setuplog); - if (oldlog != NULL) - { - SwPerformPrint(wp, _UU("SW_PERFORM_MSG_DELETE_OLD_LINKS")); - - SwDeleteShortcuts(oldlog); - - SwFreeLogFile(oldlog); - } - - // Remove only the shortcut setup log from the current log - o = NewListFast(NULL); - - for (i = 0;i < LIST_NUM(sw->LogFile->LogList);i++) - { - SW_LOG *g = LIST_DATA(sw->LogFile->LogList, i); - - if (g->Type == SW_LOG_TYPE_LNK || g->Type == SW_LOG_TYPE_LNK_DIR) - { - Add(o, g); - } - } - - for (i = 0;i < LIST_NUM(o);i++) - { - SW_LOG *g = LIST_DATA(o, i); - - Delete(sw->LogFile->LogList, g); - - Free(g); - } - - ReleaseList(o); - - for (i = 0;i < LIST_NUM(t->LinkTasks);i++) - { - SW_TASK_LINK *lt = LIST_DATA(t->LinkTasks, i); - wchar_t lnk_fullpath[MAX_SIZE]; - wchar_t lnk_dirname[MAX_SIZE]; - wchar_t target_fullpath[MAX_SIZE]; - wchar_t target_dirname[MAX_SIZE]; - wchar_t icon_fullpath[MAX_SIZE]; - -L_RETRY_LINK: - - SwPerformPrint(wp, _UU("SW_PERFORM_MSG_CREATE_LINKS")); - - // Generate the full path of the LNK file - CombinePathW(lnk_fullpath, sizeof(lnk_fullpath), lt->DestDir, lt->DestName); - UniStrCat(lnk_fullpath, sizeof(lnk_fullpath), L".lnk"); - - // Get the directory name to be saved the LNK file - GetDirNameFromFilePathW(lnk_dirname, sizeof(lnk_dirname), lnk_fullpath); - - // Generate the full path to the link destination - CombinePathW(target_fullpath, sizeof(target_fullpath), lt->TargetDir, lt->TargetExe); - - // Create the full path of the icon - CombinePathW(icon_fullpath, sizeof(icon_fullpath), lt->TargetDir, lt->IconExe); - - // Get the directory name of the full path to the link destination - GetDirNameFromFilePathW(target_dirname, sizeof(target_dirname), target_fullpath); - - // Create a directory - MakeDirExW(lnk_dirname); - if (lt->NoDeleteDir == false) - { - SwAddLog(sw, sw->LogFile, SW_LOG_TYPE_LNK_DIR, lnk_dirname); - } - - // Create the LNK file - if (CreateLink(lnk_fullpath, target_fullpath, target_dirname, lt->TargetArg, - lt->DestDescription, icon_fullpath, lt->IconIndex) == false) - { - // Show the error message if it fails - UINT msgret; - UniFormat(tmp, sizeof(tmp), _UU("SW_PERFORM_MSG_CREATE_LINK_ERROR"), lnk_fullpath); - msgret = SwPerformMsgBox(wp, MB_ICONEXCLAMATION | MB_YESNO, tmp); - - if (msgret == IDYES) - { - // Retry - goto L_RETRY_LINK; - } - } - else - { - SwAddLog(sw, sw->LogFile, SW_LOG_TYPE_LNK, lnk_fullpath); - } - } -} - -// Search component -SW_COMPONENT *SwFindComponent(SW *sw, char *name) -{ - UINT i; - // Validate arguments - if (sw == NULL || IsEmptyStr(name)) - { - return NULL; - } - - for (i = 0;i < LIST_NUM(sw->ComponentList);i++) - { - SW_COMPONENT *c = LIST_DATA(sw->ComponentList, i); - - if (StrCmpi(c->Name, name) == 0) - { - return c; - } - } - - return NULL; -} - -// Release the log file -void SwFreeLogFile(SW_LOGFILE *logfile) -{ - UINT i; - // Validate arguments - if (logfile == NULL) - { - return; - } - - for (i = 0;i < LIST_NUM(logfile->LogList);i++) - { - SW_LOG *g = LIST_DATA(logfile->LogList, i); - - Free(g); - } - - ReleaseList(logfile->LogList); - - Free(logfile); -} - -// Create a new log file -SW_LOGFILE *SwNewLogFile() -{ - SW_LOGFILE *logfile = ZeroMalloc(sizeof(SW_LOGFILE)); - - logfile->LogList = NewListFast(NULL); - - return logfile; -} - -// Read the log file -SW_LOGFILE *SwLoadLogFile(SW *sw, wchar_t *filename) -{ - FOLDER *r = NULL; - FOLDER *items = NULL; - FOLDER *info = NULL; - UINT i; - TOKEN_LIST *t = NULL; - bool is_system_mode = false; - char component_name[MAX_SIZE] = { 0 }; - UINT build; - SW_COMPONENT *c = NULL; - SW_LOGFILE *ret = NULL; - // Validate arguments - if (sw == NULL || filename == NULL) - { - return NULL; - } - - r = CfgReadW(filename); - if (r == NULL) - { - goto LABEL_CLEANUP; - } - - items = CfgGetFolder(r, "Items"); - info = CfgGetFolder(r, "Info"); - if (items == NULL || info == NULL) - { - goto LABEL_CLEANUP; - } - - t = CfgEnumFolderToTokenList(items); - if (t == NULL) - { - goto LABEL_CLEANUP; - } - - // Mode and components - is_system_mode = CfgGetBool(info, "IsSystemMode"); - CfgGetStr(info, "ComponentName", component_name, sizeof(component_name)); - build = CfgGetInt(info, "Build"); - - if (build == 0) - { - goto LABEL_CLEANUP; - } - - c = SwFindComponent(sw, component_name); - if (c == NULL) - { - goto LABEL_CLEANUP; - } - - ret = ZeroMalloc(sizeof(SW_LOGFILE)); - ret->IsSystemMode = is_system_mode; - ret->Component = c; - ret->Build = build; - ret->LogList = NewListFast(NULL); - - // Item List - for (i = 0;i < t->NumTokens;i++) - { - char *name = t->Token[i]; - FOLDER *f = CfgGetFolder(items, name); - - if (f != NULL) - { - UINT type = CfgGetInt(f, "Type"); - wchar_t value[MAX_SIZE]; - - if (CfgGetUniStr(f, "Path", value, sizeof(value))) - { - if (IsEmptyUniStr(value) == false && type != 0) - { - SW_LOG *g = ZeroMalloc(sizeof(SW_LOG)); - - g->Type = type; - UniStrCpy(g->Path, sizeof(g->Path), value); - - Add(ret->LogList, g); - } - } - } - } - -LABEL_CLEANUP: - if (r != NULL) - { - CfgDeleteFolder(r); - } - - if (t != NULL) - { - FreeToken(t); - } - - return ret; -} - -// Save the log file -bool SwSaveLogFile(SW *sw, wchar_t *dst_name, SW_LOGFILE *logfile) -{ - FOLDER *r; - FOLDER *items; - FOLDER *info; - UINT i; - bool ret; - // Validate arguments - if (sw == NULL || dst_name == NULL || logfile == NULL) - { - return false; - } - - r = CfgCreateRoot(); - - items = CfgCreateFolder(r, "Items"); - - info = CfgCreateFolder(r, "Info"); - - CfgAddBool(info, "IsSystemMode", logfile->IsSystemMode); - CfgAddStr(info, "ComponentName", logfile->Component->Name); - CfgAddInt(info, "Build", logfile->Build); - - for (i = 0;i < LIST_NUM(logfile->LogList);i++) - { - FOLDER *f; - SW_LOG *g = LIST_DATA(logfile->LogList, i); - char name[MAX_PATH]; - - Format(name, sizeof(name), "Item%04u", i); - - f = CfgCreateFolder(items, name); - - CfgAddInt(f, "Type", g->Type); - CfgAddUniStr(f, "Path", g->Path); - } - - ret = CfgSaveExW3(NULL, r, dst_name, NULL, true); - - CfgDeleteFolder(r); - - return ret; -} - -// Display the string to the status screen -void SwPerformPrint(WIZARD_PAGE *wp, wchar_t *str) -{ - SW_UI ui; - // Validate arguments - if (wp == NULL || str == NULL) - { - return; - } - - Zero(&ui, sizeof(ui)); - ui.Type = SW_UI_TYPE_PRINT; - ui.Message = str; - - SwInteractUi(wp, &ui); -} - -// Show a message box on the screen -UINT SwPerformMsgBox(WIZARD_PAGE *wp, UINT flags, wchar_t *msg) -{ - SW_UI ui; - // Validate arguments - if (wp == NULL || msg == NULL) - { - return 0; - } - - Zero(&ui, sizeof(ui)); - ui.Type = SW_UI_TYPE_MSGBOX; - ui.Message = msg; - ui.Param = flags; - - return SwInteractUi(wp, &ui); -} - -// Call the UI interaction -UINT SwInteractUi(WIZARD_PAGE *wp, SW_UI *ui) -{ - // Validate arguments - if (wp == NULL || ui == NULL) - { - return 0; - } - - SendMsg(wp->hWndPage, 0, WM_SW_INTERACT_UI, 0xCAFE, (LPARAM)ui); - - SleepThread(50); - - return ui->RetCode; -} - -// UI interaction is called -void SwInteractUiCalled(HWND hWnd, SW *sw, WIZARD_PAGE *wp, SW_UI *ui) -{ - // Validate arguments - if (hWnd == NULL || sw == NULL || wp == NULL || ui == NULL) - { - return; - } - - switch (ui->Type) - { - case SW_UI_TYPE_PRINT: // Display the message - SetText(hWnd, S_STATUS, ui->Message); - break; - - case SW_UI_TYPE_MSGBOX: // Show a message box - ui->RetCode = MsgBox(hWnd, ui->Param, ui->Message); - break; - - case SW_UI_TYPE_FINISH: // Complete - PostMessageA(hWnd, WM_SW_EXIT, 0xCAFE, 1); - break; - - case SW_UI_TYPE_ERROR: // Error - PostMessageA(hWnd, WM_SW_EXIT, 0xCAFE, 0); - break; - } -} - -// Initialize the setup process screen -void SwPerformInit(HWND hWnd, SW *sw, WIZARD_PAGE *wp) -{ - // Validate arguments - if (hWnd == NULL || sw == NULL || wp == NULL) - { - return; - } - - DlgFont(hWnd, S_INFO, 10, true); - - if (sw->EasyMode) - { - SetIcon(hWnd, S_ICON, ICO_SETUP); - - SetText(hWnd, S_INFO, _UU("SW_PERFORM_MSG_EASY_INFO")); - } - else if (sw->WebMode) - { - SetIcon(hWnd, S_ICON, ICO_SETUP); - - SetText(hWnd, S_INFO, _UU("SW_PERFORM_MSG_WEB_INFO")); - } - else - { - SetIcon(hWnd, S_ICON, sw->CurrentComponent->Icon); - - FormatText(hWnd, S_INFO, sw->CurrentComponent->Title); - } - - SetTextA(hWnd, S_STATUS, ""); - - if (MsIsWinXPOrWinVista()) - { - // Display the progress bar for Windows XP or later - SendMsg(hWnd, IDC_PROGRESS1, PBM_SETMARQUEE, TRUE, 100); - SetStyle(hWnd, IDC_PROGRESS1, PBS_MARQUEE); - } - else - { - // Hide the progress bar in the case of Windows 2000 or earlier - Hide(hWnd, IDC_PROGRESS1); - } -} - -// Do the set-up process -UINT SwPerform(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, WIZARD *wizard, WIZARD_PAGE *wizard_page, void *param) -{ - SW *sw = (SW *)param; - // Validate arguments - if (hWnd == NULL || sw == NULL) - { - return 0; - } - - switch (msg) - { - case WM_INITDIALOG: - SwPerformInit(hWnd, sw, wizard_page); - break; - - case WM_WIZ_SHOW: - SetWizardButton(wizard_page, false, false, false, false); - - SetTimer(hWnd, 1, 100, NULL); - break; - - case WM_TIMER: - KillTimer(hWnd, 1); - - // Main thread execution - if (sw->PerformThread == NULL) - { - sw->PerformThread = NewThread(SwPerformThread, wizard_page); - } - break; - - case WM_WIZ_HIDE: - break; - - case WM_CLOSE: - break; - - case WM_WIZ_NEXT: - break; - - case WM_WIZ_BACK: - break; - - case WM_SW_INTERACT_UI: - // UI interaction is called - if (wParam == 0xCAFE) - { - SwInteractUiCalled(hWnd, sw, wizard_page, (SW_UI *)lParam); - } - break; - - case WM_COMMAND: - switch (wParam) - { - } - break; - - case WM_SW_EXIT: - // Close this screen since the process completed - if (wParam == 0xCAFE) - { - JumpWizard(wizard_page, (lParam == 0 ? D_SW_ERROR : D_SW_FINISH)); - - if (sw->PerformThread != NULL) - { - WaitThread(sw->PerformThread, INFINITE); - ReleaseThread(sw->PerformThread); - sw->PerformThread = NULL; - } - } - break; - } - - return 0; -} - -// Final confirmation screen -UINT SwReady(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, WIZARD *wizard, WIZARD_PAGE *wizard_page, void *param) -{ - SW *sw = (SW *)param; - // Validate arguments - if (hWnd == NULL || sw == NULL) - { - return 0; - } - - switch (msg) - { - case WM_INITDIALOG: - FormatText(hWnd, S_INFO, sw->CurrentComponent->Title); - break; - - case WM_WIZ_SHOW: - SetWizardButton(wizard_page, true, true, true, false); - break; - - case WM_WIZ_HIDE: - break; - - case WM_CLOSE: - break; - - case WM_WIZ_NEXT: - return D_SW_PERFORM; - - case WM_WIZ_BACK: - return D_SW_DIR; - - case WM_COMMAND: - switch (wParam) - { - } - break; - } - - return 0; -} - -// Uninstall all the old MSI products -bool SwUninstallOldMsiInstalled(HWND hWnd, WIZARD_PAGE *wp, SW_COMPONENT *c, bool *reboot_required) -{ - UINT i; - bool dummy_bool = false; - // Validate arguments - if (c == NULL || wp == NULL) - { - return true; - } - if (reboot_required == NULL) - { - reboot_required = &dummy_bool; - } - - *reboot_required = false; - - if (c->OldMsiList == NULL) - { - return true; - } - - for (i = 0;i < c->NumOldMsi;i++) - { - SW_OLD_MSI *m = &c->OldMsiList[i]; - wchar_t tmp[MAX_SIZE]; - - if (MsGetMsiInstalledDir(m->ComponentCode, tmp, sizeof(tmp))) - { - bool rr = false; - wchar_t msg[MAX_SIZE]; - -LABEL_RETRY: - - UniFormat(msg, sizeof(msg), _UU("SW_PERFORM_MSG_UNINSTALL_MSI"), c->Title); - SwPerformPrint(wp, msg); - - if (MsMsiUninstall(m->ProductCode, hWnd, &rr) == false) - { - UniFormat(msg, sizeof(msg), _UU("SW_MSI_UNINSTALL_FAILED"), c->Title, m->ProductCode); - - if (SwPerformMsgBox(wp, MB_ICONEXCLAMATION | MB_RETRYCANCEL, msg) == IDRETRY) - { - goto LABEL_RETRY; - } - - return false; - } - else - { - if (rr) - { - *reboot_required = true; - return true; - } - } - } - } - - return true; -} - -// Get the directory where the old MSI products are installed -wchar_t *SwGetOldMsiInstalledDir(SW_COMPONENT *c) -{ - UINT i; - // Validate arguments - if (c == NULL) - { - return NULL; - } - - if (c->OldMsiList == NULL) - { - return NULL; - } - - for (i = 0;i < c->NumOldMsi;i++) - { - SW_OLD_MSI *m = &c->OldMsiList[i]; - wchar_t tmp[MAX_SIZE]; - - if (MsGetMsiInstalledDir(m->ComponentCode, tmp, sizeof(tmp))) - { - return UniCopyStr(tmp); - } - } - - return NULL; -} - -// Initialize the default installation directory -void SwInitDefaultInstallDir(SW *sw) -{ - char keyname[MAX_SIZE]; - wchar_t *reg_dir_system; - wchar_t *reg_dir_user; - wchar_t *msi_dir_system = NULL; - // Validate arguments - if (sw == NULL) - { - return; - } - - msi_dir_system = SwGetOldMsiInstalledDir(sw->CurrentComponent); - - Format(keyname, sizeof(keyname), "%s\\%s", SW_REG_KEY, sw->CurrentComponent->Name); - - if (UniIsEmptyStr(msi_dir_system) == false) - { - MsRegWriteStrEx2W(REG_LOCAL_MACHINE, keyname, "InstalledDir", msi_dir_system, false, true); - } - - reg_dir_system = MsRegReadStrEx2W(REG_LOCAL_MACHINE, keyname, "InstalledDir", false, true); - reg_dir_user = MsRegReadStrEx2W(REG_CURRENT_USER, keyname, "InstalledDir", false, true); - - // Generate a directory name in the case of system mode - CombinePathW(sw->DefaultInstallDir_System, sizeof(sw->DefaultInstallDir_System), - MsGetProgramFilesDirX64W(), sw->CurrentComponent->DefaultDirName); - - // Generate a directory name in the case of user mode - CombinePathW(sw->DefaultInstallDir_User, sizeof(sw->DefaultInstallDir_User), - MsGetPersonalAppDataDirW(), sw->CurrentComponent->DefaultDirName); - - if (UniIsEmptyStr(reg_dir_system) == false) - { - UniStrCpy(sw->DefaultInstallDir_System, sizeof(sw->DefaultInstallDir_System), reg_dir_system); - } - - if (UniIsEmptyStr(reg_dir_user) == false) - { - UniStrCpy(sw->DefaultInstallDir_User, sizeof(sw->DefaultInstallDir_User), reg_dir_user); - } - - if (MsIsNt() == false) - { - // Set to system mode for Win9x - sw->IsSystemMode = true; - } - - if (MsIsAdmin() == false) - { - sw->IsAvailableSystemMode = false; - sw->IsAvailableUserMode = true; - } - else if (MsIsNt() == false) - { - sw->IsAvailableSystemMode = true; - sw->IsAvailableUserMode = false; - } - else - { - sw->IsAvailableSystemMode = true; - sw->IsAvailableUserMode = !sw->CurrentComponent->SystemModeOnly; - } - - sw->ShowWarningForUserMode = sw->CurrentComponent->InstallService; - - Free(reg_dir_system); - Free(reg_dir_user); - Free(msi_dir_system); -} - -// Update the installation directory setting screen -void SwDirUpdate(HWND hWnd, SW *sw, WIZARD_PAGE *wizard_page) -{ - bool user_mode_selected; - bool show_custom; - bool change_dir; - // Validate arguments - if (hWnd == NULL || sw == NULL || wizard_page == NULL) - { - return; - } - - change_dir = IsChecked(hWnd, R_CUSTOM); - - SetShow(hWnd, S_DEST, change_dir); - SetShow(hWnd, E_DIR, change_dir); - SetShow(hWnd, B_BROWSE, change_dir); - - show_custom = IsChecked(hWnd, R_SHOWCUSTOM); - - SetShow(hWnd, R_FOR_SYSTEM, show_custom); - SetShow(hWnd, R_FOR_USER, show_custom); - - user_mode_selected = IsChecked(hWnd, R_FOR_USER); - - SetText(hWnd, R_DEFAULT, user_mode_selected ? sw->DefaultInstallDir_User : sw->DefaultInstallDir_System); - - if (user_mode_selected == false) - { - Hide(hWnd, S_WARNING); - Hide(hWnd, S_WARNING2); - } - else - { - SetShow(hWnd, S_WARNING, sw->ShowWarningForUserMode); - SetShow(hWnd, S_WARNING2, sw->ShowWarningForUserMode); - } - - SetEnable(hWnd, R_SHOWCUSTOM, !user_mode_selected); - - DlgFont(hWnd, R_DEFAULT, 0, !change_dir); -} - -// Check the directory name planned to be created newly -bool SwCheckNewDirName(wchar_t *name) -{ - char tmp[MAX_SIZE]; - UCHAR rand[16]; - wchar_t testname[MAX_SIZE]; - IO *io; - bool new_dir; - // Validate arguments - if (name == NULL) - { - return false; - } - - // Create a directory - new_dir = MakeDirExW(name); - - // Writes the appropriate files - Rand(rand, sizeof(rand)); - BinToStr(tmp, sizeof(tmp), rand, sizeof(rand)); - UniFormat(testname, sizeof(testname), L"%s\\%S.dat", name, tmp); - - io = FileCreateW(testname); - - if (io == NULL) - { - return false; - } - - FileClose(io); - - FileDeleteW(testname); - - if (new_dir) - { - DeleteDirW(name); - } - - return true; -} - -// Set the installation directory -UINT SwDir(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, WIZARD *wizard, WIZARD_PAGE *wizard_page, void *param) -{ - SW *sw = (SW *)param; - wchar_t tmp[MAX_SIZE]; - wchar_t setuplog[MAX_SIZE]; - wchar_t *s; - SW_LOGFILE *logfile; - bool is_system_mode; - bool skip_ver_check = false; - // Validate arguments - if (hWnd == NULL || sw == NULL) - { - return 0; - } - - switch (msg) - { - case WM_INITDIALOG: - SetIcon(hWnd, S_ICON, sw->CurrentComponent->Icon); - - SwInitDefaultInstallDir(sw); - - FormatText(hWnd, S_INFO, sw->CurrentComponent->Title); - FormatText(hWnd, R_FOR_USER, MsGetUserNameW()); - FormatText(hWnd, S_WARNING, MsGetUserNameW(), sw->CurrentComponent->Title); - - Check(hWnd, R_FOR_SYSTEM, sw->IsSystemMode); - Check(hWnd, R_FOR_USER, !sw->IsSystemMode); - - if (sw->IsSystemMode == false) - { - Check(hWnd, R_SHOWCUSTOM, true); - } - - SetText(hWnd, E_DIR, sw->IsSystemMode ? sw->DefaultInstallDir_System : sw->DefaultInstallDir_User); - - Check(hWnd, R_DEFAULT, true); - - SetEnable(hWnd, R_FOR_SYSTEM, sw->IsAvailableSystemMode); - SetEnable(hWnd, R_FOR_USER, sw->IsAvailableUserMode); - - SwDirUpdate(hWnd, sw, wizard_page); - - break; - - case WM_WIZ_SHOW: - SetWizardButton(wizard_page, true, false, true, false); - - SwDirUpdate(hWnd, sw, wizard_page); - break; - - case WM_WIZ_HIDE: - break; - - case WM_CLOSE: - break; - - case WM_WIZ_NEXT: - if (IsChecked(hWnd, R_CUSTOM)) - { - GetTxt(hWnd, E_DIR, tmp, sizeof(tmp)); - } - else - { - if (IsChecked(hWnd, R_FOR_SYSTEM)) - { - UniStrCpy(tmp, sizeof(tmp), sw->DefaultInstallDir_System); - } - else - { - UniStrCpy(tmp, sizeof(tmp), sw->DefaultInstallDir_User); - } - } - - is_system_mode = IsChecked(hWnd, R_FOR_SYSTEM); - - if (is_system_mode == false) - { - if (sw->CurrentComponent->InstallService) - { - if (MsIsServiceInstalled(sw->CurrentComponent->SvcName)) - { - // If the type of installation is user mode and the same software - // is running in system mode already, warn about it - if (MsgBoxEx(hWnd, MB_ICONEXCLAMATION | MB_YESNO | MB_DEFBUTTON2, _UU("SW_SYSTEM_MODE_ALREADY_INSTALLED"), - sw->CurrentComponent->Title) == IDNO) - { - break; - } - } - } - } - - UniTrim(tmp); - - Win32NukuEnW(tmp, sizeof(tmp), tmp); - - // Check Length - if (UniStrLen(tmp) > 110) - { - MsgBox(hWnd, MB_ICONEXCLAMATION, _UU("SW_DIR_MORE_THAN_110")); - FocusEx(hWnd, E_DIR); - break; - } - - // Check whether it's a full path - if (UniStartWith(tmp, L"\\\\") == false && - (tmp[1] != L':' || tmp[2] != L'\\')) - { - MsgBoxEx(hWnd, MB_ICONEXCLAMATION, _UU("SW_DIR_IS_NOT_FULLPATH"), tmp); - FocusEx(hWnd, E_DIR); - break; - } - - NormalizePathW(tmp, sizeof(tmp), tmp); - - // Check the type of the drive - if (IsChecked(hWnd, R_FOR_SYSTEM)) - { - // System mode service is installed only on the hard disk - bool ok = true; - - if (UniStartWith(tmp, L"\\\\")) - { - ok = false; - } - else - { - char tmpa[MAX_SIZE]; - UINT ret; - - UniToStr(tmpa, sizeof(tmpa), tmp); - - tmpa[3] = 0; - - ret = GetDriveTypeA(tmpa); - - if (ret != DRIVE_FIXED && ret != DRIVE_RAMDISK) - { - ok = false; - } - } - - if (ok == false) - { - MsgBoxEx(hWnd, MB_ICONEXCLAMATION, _UU("SW_DIR_IS_NOT_HDD"), tmp, sw->CurrentComponent->Title); - FocusEx(hWnd, E_DIR); - break; - } - } - - // Write check - if (SwCheckNewDirName(tmp) == false) - { - MsgBoxEx(hWnd, MB_ICONEXCLAMATION, _UU("SW_DIR_WRITE_ERROR"), tmp); - FocusEx(hWnd, E_DIR); - break; - } - - // Analyze if there is a setuplog.dat on destination - CombinePathW(setuplog, sizeof(setuplog), tmp, L"setuplog.dat"); - logfile = SwLoadLogFile(sw, setuplog); - if (logfile == NULL && IsFileExistsW(setuplog)) - { - MsgBoxEx(hWnd, MB_ICONEXCLAMATION, _UU("SW_DIR_DST_IS_BROKEN"), setuplog); - FocusEx(hWnd, E_DIR); - break; - } - - if (logfile != NULL && (logfile->Build > CEDAR_VERSION_BUILD) && UniIsEmptyStr(sw->auto_setting_path) == false && - sw->CurrentComponent->Id == SW_CMP_VPN_CLIENT && logfile->Component->Id == SW_CMP_VPN_CLIENT) - { - // In the case of the VPN Client, show a message if a newer version is installed and - // the automatic connection setting by simple installer should be applied - if (MsgBox(hWnd, MB_ICONINFORMATION | MB_OKCANCEL, _UU("SW_DIR_DST_IS_NEWER_2")) == IDCANCEL) - { - // Cancel - FocusEx(hWnd, E_DIR); - break; - } - - skip_ver_check = true; - } - - if (logfile != NULL) - { - wchar_t *errmsg = NULL; - if (logfile->Component != sw->CurrentComponent) - { - errmsg = _UU("SW_DIR_DST_IS_OTHER_PRODUCT"); - } - else if ((skip_ver_check == false) && (logfile->Build > CEDAR_VERSION_BUILD)) - { - errmsg = _UU("SW_DIR_DST_IS_NEWER"); - } - else if (logfile->IsSystemMode && is_system_mode == false) - { - errmsg = _UU("SW_DIR_DST_IS_SYSTEM_MODE"); - } - else if (logfile->IsSystemMode == false && is_system_mode) - { - errmsg = _UU("SW_DIR_DST_IS_USER_MODE"); - } - - SwFreeLogFile(logfile); - - if (errmsg != NULL) - { - MsgBox(hWnd, MB_ICONEXCLAMATION, errmsg); - FocusEx(hWnd, E_DIR); - break; - } - } - - // Check whether installation destination and installation source are not same - if (UniStrCmpi(tmp, sw->InstallSrc) == 0) - { - MsgBoxEx(hWnd, MB_ICONEXCLAMATION, _UU("SW_DIR_DST_IS_SAME_TO_SRC"), tmp); - FocusEx(hWnd, E_DIR); - break; - } - - UniStrCpy(sw->InstallDir, sizeof(sw->InstallDir), tmp); - sw->IsSystemMode = IsChecked(hWnd, R_FOR_SYSTEM); - - sw->OnlyAutoSettingMode = skip_ver_check; - - return D_SW_READY; - - case WM_WIZ_BACK: - break; - - case WM_COMMAND: - switch (wParam) - { - case R_DEFAULT: - case R_CUSTOM: - case R_SHOWCUSTOM: - case R_FOR_SYSTEM: - case R_FOR_USER: - SwDirUpdate(hWnd, sw, wizard_page); - break; - } - - switch (wParam) - { - case R_FOR_SYSTEM: - SetText(hWnd, E_DIR, sw->DefaultInstallDir_System); - break; - - case R_FOR_USER: - SetText(hWnd, E_DIR, sw->DefaultInstallDir_User); - break; - - case B_BROWSE: - GetTxt(hWnd, E_DIR, tmp, sizeof(tmp)); - s = FolderDlgW(hWnd, _UU("SW_DIR_SELECT"), tmp); - - if (s != NULL) - { - if (UniEndWith(s, sw->CurrentComponent->DefaultDirName)) - { - UniStrCpy(tmp, sizeof(tmp), s); - } - else - { - CombinePathW(tmp, sizeof(tmp), s, sw->CurrentComponent->DefaultDirName); - } - - SetText(hWnd, E_DIR, tmp); - FocusEx(hWnd, E_DIR); - - Free(s); - } - break; - } - - break; - } - - return 0; -} - -// Warning screen -UINT SwWarning(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, WIZARD *wizard, WIZARD_PAGE *wizard_page, void *param) -{ - SW *sw = (SW *)param; - BUF *b; - UCHAR c = 0; - wchar_t *str; - char warning_filename[MAX_PATH]; - LANGLIST t; - // Validate arguments - if (hWnd == NULL || sw == NULL) - { - return 0; - } - - switch (msg) - { - case WM_INITDIALOG: - break; - - case WM_WIZ_SHOW: - DlgFont(hWnd, B_AGREE, 0, true); - - GetCurrentLang(&t); - - SetFont(hWnd, E_TEXT, GetFont((t.Id == SE_LANG_JAPANESE && MsIsWindows7()) ? "Meiryo UI" : NULL, 10, false , false, false, false)); - - Format(warning_filename, sizeof(warning_filename), "|warning_%s.txt", t.Name); - b = ReadDump(warning_filename); - - SeekBuf(b, b->Size, 0); - c = 0; - WriteBuf(b, &c, 1); - - str = CopyUtfToUni(b->Buf); - - UniIsEmptyStr(str); - - SetText(hWnd, E_TEXT, str); - - FreeBuf(b); - - Free(str); - - UnselectEdit(hWnd, E_TEXT); - - Focus(hWnd, E_TEXT); - - SetWizardButton(wizard_page, true, true, true, false); - break; - - case WM_WIZ_HIDE: - break; - - case WM_CLOSE: - break; - - case WM_WIZ_NEXT: - if (SwEnterSingle(sw) == false) - { - // Multiple-starts prevention - MsgBox(hWnd, MB_ICONINFORMATION, _UU("SW_OTHER_INSTANCE_EXISTS")); - break; - } - return D_SW_DIR; - - case WM_WIZ_BACK: - return D_SW_EULA; - - case WM_COMMAND: - break; - } - - return 0; -} - -// Update the license agreement screen -void SwEulaUpdate(HWND hWnd, SW *sw, WIZARD *wizard, WIZARD_PAGE *wizard_page) -{ - // Validate arguments - if (hWnd == NULL || sw == NULL || wizard == NULL || wizard_page == NULL) - { - return; - } - - sw->EulaAgreed = IsChecked(hWnd, B_AGREE); - - if (sw->EulaAgreed == false) - { - // Delete the agreement record in the case of non-agreement for the EULA - MsRegDeleteValueEx2(REG_CURRENT_USER, SW_REG_KEY_EULA, sw->CurrentComponent->Name, false, true); - } - - SetWizardButton(wizard_page, sw->EulaAgreed, true, true, false); -} - -// License Agreement -UINT SwEula(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, WIZARD *wizard, WIZARD_PAGE *wizard_page, void *param) -{ - SW *sw = (SW *)param; - BUF *b; - UCHAR c = 0; - wchar_t *str; - // Validate arguments - if (hWnd == NULL || sw == NULL) - { - return 0; - } - - switch (msg) - { - case WM_INITDIALOG: - break; - - case WM_WIZ_SHOW: - SetFont(hWnd, E_TEXT, GetFont((MsIsWindows7() ? "Segoe UI" : "Verdana"), 10, false, false, false, false)); - //DlgFont(hWnd, B_AGREE, 10, true); - - b = ReadDump("|eula.txt"); - - SeekBuf(b, b->Size, 0); - c = 0; - WriteBuf(b, &c, 1); - - str = CopyUtfToUni(b->Buf); - - UniIsEmptyStr(str); - - SetText(hWnd, E_TEXT, str); - - sw->CurrentEulaHash = HashToUINT(b->Buf, b->Size); - - FreeBuf(b); - - Free(str); - - if (sw->CurrentComponent != NULL && sw->CurrentEulaHash != 0 && sw->CurrentEulaHash == MsRegReadIntEx2(REG_CURRENT_USER, SW_REG_KEY_EULA, sw->CurrentComponent->Name, false, true)) - { - // Check the consent check box in advance if the user accepts the same EULA during the last installation - sw->EulaAgreed = true; - } - - Check(hWnd, B_AGREE, sw->EulaAgreed); - - UnselectEdit(hWnd, E_TEXT); - - Focus(hWnd, E_TEXT); - - SwEulaUpdate(hWnd, sw, wizard, wizard_page); - break; - - case WM_WIZ_HIDE: - break; - - case WM_CLOSE: - break; - - case WM_WIZ_NEXT: - SwEulaUpdate(hWnd, sw, wizard, wizard_page); - - if (sw->EulaAgreed) - { - return D_SW_WARNING; - } - break; - - case WM_WIZ_BACK: - sw->EulaAgreed = false; - return D_SW_COMPONENTS; - - case WM_COMMAND: - switch (wParam) - { - case B_AGREE: - SwEulaUpdate(hWnd, sw, wizard, wizard_page); - break; - } - break; - } - - return 0; -} - -// Initialize a component list -void SwComponentsInit(HWND hWnd, SW *sw) -{ - LVB *b; - UINT i; - SW_COMPONENT *default_select = NULL; - // Validate arguments - if (hWnd == NULL || sw == NULL) - { - return; - } - - LvReset(hWnd, L_LIST); - - b = LvInsertStart(); - - for (i = 0;i < LIST_NUM(sw->ComponentList);i++) - { - SW_COMPONENT *c = LIST_DATA(sw->ComponentList, i); - - if (c->Detected) - { - wchar_t tmp[MAX_SIZE]; - - UniFormat(tmp, sizeof(tmp), L" %s", c->Title); - - LvInsertAdd(b, c->Icon, c, 1, tmp); - - if (c->SystemModeOnly == false || MsIsAdmin()) - { - if (default_select == NULL) - { - default_select = c; - } - } - } - } - - LvInsertEnd(b, hWnd, L_LIST); - - if (sw->CurrentComponent == NULL) - { - LvSelectByParam(hWnd, L_LIST, default_select); - } - else - { - LvSelectByParam(hWnd, L_LIST, sw->CurrentComponent); - } - - Focus(hWnd, L_LIST); -} - -// Update the Component Selection screen -void SwComponentsUpdate(HWND hWnd, SW *sw, WIZARD *wizard, WIZARD_PAGE *wizard_page) -{ - SW_COMPONENT *c; - // Validate arguments - if (hWnd == NULL || sw == NULL || wizard == NULL || wizard_page == NULL) - { - return; - } - - c = (SW_COMPONENT *)LvGetSelectedParam(hWnd, L_LIST); - - if (c == NULL) - { - Hide(hWnd, S_TITLE); - Hide(hWnd, S_DESCRIPTION); - Hide(hWnd, S_ICON); - - SetWizardButton(wizard_page, false, true, true, false); - } - else - { - wchar_t tmp[MAX_SIZE]; - - if (c->SystemModeOnly && MsIsAdmin() == false) - { - // Components to be installed only in system mode is set to unselectable - SetText(hWnd, S_TITLE, _UU("SW_COMPONENTS_REQUIRE_ADMIN")); - UniFormat(tmp, sizeof(tmp), _UU("SW_COMPONENTS_REQUIRE_ADMIN_TEXT"), c->Title); - SetText(hWnd, S_DESCRIPTION, tmp); - SetIcon(hWnd, S_ICON, ICO_WARNING); - - SetWizardButton(wizard_page, false, true, true, false); - } - else - { - // Show the description of the component - UniFormat(tmp, sizeof(tmp), _UU("SW_COMPONENTS_ABOUT_TAG"), c->Title); - SetText(hWnd, S_TITLE, tmp); - SetText(hWnd, S_DESCRIPTION, c->Description); - SetIcon(hWnd, S_ICON, c->Icon); - - SetWizardButton(wizard_page, true, true, true, false); - } - - Show(hWnd, S_TITLE); - Show(hWnd, S_DESCRIPTION); - Show(hWnd, S_ICON); - } -} - -// Component selection screen -UINT SwComponents(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, WIZARD *wizard, WIZARD_PAGE *wizard_page, void *param) -{ - SW *sw = (SW *)param; - NMHDR *n; - SW_COMPONENT *c; - // Validate arguments - if (hWnd == NULL || sw == NULL) - { - return 0; - } - - switch (msg) - { - case WM_INITDIALOG: - LvInitEx2(hWnd, L_LIST, false, true); - - if (MsIsVista()) - { - SetFont(hWnd, L_LIST, GetMeiryoFontEx(12)); - SetFont(hWnd, S_TITLE, GetMeiryoFontEx(11)); - } - else - { - DlgFont(hWnd, L_LIST, 12, false); - DlgFont(hWnd, S_TITLE, 11, false); - } - - LvInsertColumn(hWnd, L_LIST, 0, L"Component", 515); - break; - - case WM_WIZ_SHOW: - SetWizardButton(wizard_page, true, true, true, false); - - SwComponentsInit(hWnd, sw); - - SwComponentsUpdate(hWnd, sw, wizard, wizard_page); - - break; - - case WM_WIZ_HIDE: - break; - - case WM_CLOSE: - break; - - case WM_WIZ_NEXT: - c = (SW_COMPONENT *)LvGetSelectedParam(hWnd, L_LIST); - - if (c != NULL) - { - if (SwCheckOs(sw, c) == false) - { - // OS Check Failed - MsgBoxEx(hWnd, MB_ICONEXCLAMATION, _UU("SW_OS_FAILED"), c->Title); - break; - } - - sw->CurrentComponent = c; - - if (sw->CurrentComponent->SystemModeOnly == false || MsIsAdmin()) - { - if (sw->CurrentComponent->Id == SW_CMP_VPN_SERVER && MsIsServiceInstalled(GC_SVC_NAME_VPNBRIDGE)) - { - // The user is trying to install the VPN Server but, VPN Bridge already exists - if (MsgBox(hWnd, MB_ICONEXCLAMATION | MB_YESNO | MB_DEFBUTTON2, _UU("SW_NOTICE_VPNBRIDGE_IS_INSTALLED")) == IDNO) - { - break; - } - } - else if (sw->CurrentComponent->Id == SW_CMP_VPN_BRIDGE && MsIsServiceInstalled(GC_SVC_NAME_VPNSERVER)) - { - // The user is trying to install the VPN Bridge, but a VPN Server already exists - if (MsgBox(hWnd, MB_ICONEXCLAMATION | MB_YESNO | MB_DEFBUTTON2, _UU("SW_NOTICE_VPNSERVER_IS_INSTALLED")) == IDNO) - { - break; - } - } - - // Continue - return D_SW_EULA; - } - } - break; - - case WM_WIZ_BACK: - if (MsIsAdmin()) - { - return D_SW_WELCOME; - } - else - { - return D_SW_MODE; - } - break; - - case WM_COMMAND: - switch (wParam) - { - } - break; - - case WM_NOTIFY: - n = (NMHDR *)lParam; - - switch (n->idFrom) - { - case L_LIST: - switch (n->code) - { - case LVN_ITEMCHANGED: - SwComponentsUpdate(hWnd, sw, wizard, wizard_page); - break; - } - break; - } - - break; - } - - return 0; -} - -// Screen that is displayed when the user don't have administrative privileges -UINT SwNotAdminDlg(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, WIZARD *wizard, WIZARD_PAGE *wizard_page, void *param) -{ - SW *sw = (SW *)param; - // Validate arguments - if (hWnd == NULL || sw == NULL) - { - return 0; - } - - switch (msg) - { - case WM_INITDIALOG: - break; - - case WM_WIZ_SHOW: - FormatText(hWnd, S_INFO, MsGetUserNameW()); - - SetShow(hWnd, S_INFO2, (sw->UninstallMode ? false : true)); - - SetWizardButton(wizard_page, true, ((sw->UninstallMode && sw->IsReExecForUac) ? false : true), true, true); - break; - - case WM_WIZ_HIDE: - break; - - case WM_CLOSE: - break; - - case WM_WIZ_NEXT: - break; - - case WM_WIZ_BACK: - if (sw->UninstallMode == false) - { - return D_SW_MODE; - } - else - { - return D_SW_UNINST1; - } - break; - - case WM_COMMAND: - switch (wParam) - { - } - break; - } - - return 0; -} - -// Choose the setup mode -UINT SwModeDlg(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, WIZARD *wizard, WIZARD_PAGE *wizard_page, void *param) -{ - SW *sw = (SW *)param; - // Validate arguments - if (hWnd == NULL || sw == NULL) - { - return 0; - } - - switch (msg) - { - case WM_INITDIALOG: - break; - - case WM_WIZ_SHOW: - SetWizardButton(wizard_page, true, true, true, false); - FormatText(hWnd, S_USER, MsGetUserNameW()); - - // Choose the initial state - Check(hWnd, R_SYSTEM, sw->IsSystemMode); - Check(hWnd, R_USER, !sw->IsSystemMode); - - Focus(hWnd, (sw->IsSystemMode ? R_SYSTEM : R_USER)); - - sw->DoubleClickBlocker = false; - SetUacIcon(hWnd, S_UAC); - - break; - - case WM_WIZ_HIDE: - break; - - case WM_CLOSE: - break; - - case WM_WIZ_NEXT: - // Mode - sw->IsSystemMode = IsChecked(hWnd, R_SYSTEM); - - if (sw->DoubleClickBlocker) - { - break; - } - - sw->DoubleClickBlocker = true; - - if (sw->IsSystemMode) - { - if (MsIsVista() && MsIsAdmin() == false && sw->IsReExecForUac == false) - { - // If UAC is available and this isn't invoked via UAC, - // give the user a chance to get administrator privileges on UAC start again - if (SwReExecMyself(sw, NULL, true)) - { - // Terminate itself if it succeeds to start the child process - CloseWizard(wizard_page); - } - else - { - // Jump to screen prompts to re-start as a administrator if it fails to start the child process - return D_SW_NOT_ADMIN; - } - } - else - { - if (MsIsAdmin()) - { - // Jump to the component list screen if the user has administrator privileges - return D_SW_COMPONENTS; - } - else - { - // Jump to screen prompts to re-start as a administrator if the user doesn't have administrator privileges - return D_SW_NOT_ADMIN; - } - } - } - else - { - // Jump to the component list screen - return D_SW_COMPONENTS; - } - - break; - - case WM_WIZ_BACK: - return D_SW_WELCOME; - - case WM_COMMAND: - switch (wParam) - { - } - break; - } - - return 0; -} - -// Welcome screen -UINT SwWelcomeDlg(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, WIZARD *wizard, WIZARD_PAGE *wizard_page, void *param) -{ - SW *sw = (SW *)param; - // Validate arguments - if (hWnd == NULL || sw == NULL) - { - return 0; - } - - switch (msg) - { - case WM_INITDIALOG: - break; - - case WM_WIZ_SHOW: - DlgFont(hWnd, S_WELCOME, 10, false); - DlgFont(hWnd, S_TITLE, 11, true); - SetWizardButtonEx(wizard_page, true, false, true, false, true); - - sw->DoubleClickBlocker = false; - - break; - - case WM_WIZ_HIDE: - break; - - case WM_CLOSE: - break; - - case WM_WIZ_NEXT: - if (MsIsKB3033929RequiredAndMissing()) - { - // KB3033929 is missing - if (MsgBoxEx(hWnd, MB_ICONINFORMATION | MB_OKCANCEL, _UU("SW_KB3033929_REQUIRED")) == IDCANCEL) - { - break; - } - } - - if (sw->DoubleClickBlocker) - { - break; - } - - sw->DoubleClickBlocker = true; - - if (MsIsAdmin() == false) - { - if (MsIsVista()) - { - if (sw->IsReExecForUac == false) - { - // If there is no Admin privileges in Vista or later, attempt to acquire Admin rights by UAC first during the first run - if (SwReExecMyself(sw, NULL, true)) - { - // Terminate itself if it succeeds to start the child process - CloseWizard(wizard_page); - break; - } - else - { - // Jump to mode selection screen if it fails to start the - // child process (including user presses the cancel of UAC) - return D_SW_MODE; - } - } - else - { - // Jump to mode selection screen when the user don't have Admin rights after being activated by UAC - return D_SW_MODE; - } - } - else - { - // Jump to the mode selection screen in the case of older than Vista - return D_SW_MODE; - } - } - else - { - // Skip to the component list screen if the user has Admin privileges - return D_SW_COMPONENTS; - } - break; - - case WM_WIZ_BACK: - break; - - case WM_COMMAND: - switch (wParam) - { - } - break; - } - - return 0; -} - -// Restart itself -bool SwReExecMyself(SW *sw, wchar_t *additional_params, bool as_admin) -{ - wchar_t *current_params; - wchar_t new_param[MAX_SIZE]; - void *handle; - bool ret = false; - // Validate arguments - if (sw == NULL) - { - return false; - } - if (sw->ReExecProcessHandle != NULL) - { - return false; - } - - current_params = GetCommandLineUniStr(); - - if (IsEmptyUniStr(additional_params)) - { - additional_params = L""; - } - - UniFormat(new_param, sizeof(new_param), L"%s %s %s", current_params, (as_admin ? L"/UAC:true" : L""), additional_params); - - UniTrim(new_param); - - handle = NULL; - ret = MsExecuteEx2W(MsGetExeFileNameW(), new_param, &handle, as_admin); - - Free(current_params); - - if (ret == false) - { - return false; - } - - sw->ReExecProcessHandle = handle; - - return true; -} - -// Show the UI -void SwUiMain(SW *sw) -{ - WIZARD *w; - wchar_t verstr[MAX_SIZE]; - char ver[MAX_SIZE]; - // Validate arguments - if (sw == NULL) - { - return; - } - - // Define the wizard UI - GetCedarVersion(ver, sizeof(ver)); - UniFormat(verstr, sizeof(verstr), _UU("SW_TITLE"), ver); - - w = NewWizard(ICO_SETUP, BMP_SELOGO49x49, verstr, sw); - - w->CloseConfirmMsg = _UU("SW_EXIT_CONFIRM"); - - AddWizardPage(w, NewWizardPage(D_SW_WELCOME, SwWelcomeDlg, _UU("SW_WELCOME_TITLE"))); - AddWizardPage(w, NewWizardPage(D_SW_MODE, SwModeDlg, _UU("SW_MODE_TITLE"))); - AddWizardPage(w, NewWizardPage(D_SW_NOT_ADMIN, SwNotAdminDlg, _UU("SW_NOT_ADMIN_TITLE"))); - AddWizardPage(w, NewWizardPage(D_SW_COMPONENTS, SwComponents, _UU("SW_COMPONENTS_TITLE"))); - AddWizardPage(w, NewWizardPage(D_SW_EULA, SwEula, _UU("SW_EULA_TITLE"))); - AddWizardPage(w, NewWizardPage(D_SW_WARNING, SwWarning, _UU("SW_WARNING_TITLE"))); - AddWizardPage(w, NewWizardPage(D_SW_DIR, SwDir, _UU("SW_DIR_TITLE"))); - AddWizardPage(w, NewWizardPage(D_SW_READY, SwReady, _UU("SW_READY_TITLE"))); - AddWizardPage(w, NewWizardPage(D_SW_PERFORM, SwPerform, _UU("SW_PERFORM_TITLE"))); - AddWizardPage(w, NewWizardPage(D_SW_ERROR, SwError, _UU("SW_ERROR_TITLE"))); - AddWizardPage(w, NewWizardPage(D_SW_FINISH, SwFinish, _UU("SW_FINISH_TITLE"))); - AddWizardPage(w, NewWizardPage(D_SW_UNINST1, SwUninst1, _UU("SW_UNINST1_TITLE"))); - AddWizardPage(w, NewWizardPage(D_SW_LANG1, SwLang1, _UU("SW_LANG1_TITLE"))); - AddWizardPage(w, NewWizardPage(D_SW_EASY1, SwEasy1, _UU("SW_EASY1_TITLE"))); - AddWizardPage(w, NewWizardPage(D_SW_EASY2, SwEasy2, _UU("SW_EASY2_TITLE"))); - AddWizardPage(w, NewWizardPage(D_SW_WEB1, SwWeb1, _UU("SW_WEB1_TITLE"))); - AddWizardPage(w, NewWizardPage(D_SW_WEB2, SwWeb2, _UU("SW_WEB2_TITLE"))); - - if (MsIsVista()) - { - w->IsAreoStyle = true; - } - - if (sw->UninstallMode) - { - // Uninstall mode - UINT start_page = D_SW_UNINST1; - - if (sw->IsReExecForUac) - { - // In the case of this have been executed for UAC - if (MsIsAdmin()) - { - // Uninstall - start_page = D_SW_PERFORM; - } - else - { - // Error screen - start_page = D_SW_NOT_ADMIN; - } - } - - ShowWizard(NULL, w, start_page); - } - else if (sw->WebMode) - { - // Web installer creation mode - UINT start_page = D_SW_WEB1; - - ShowWizard(NULL, w, start_page); - } - else if (sw->EasyMode) - { - // Simple installer creation mode - UINT start_page = D_SW_EASY1; - - ShowWizard(NULL, w, start_page); - } - else if (sw->LanguageMode) - { - // Language setting mode - UINT start_page = D_SW_LANG1; - - w->CloseConfirmMsg = NULL; - - if (sw->IsReExecForUac) - { - // In the case of this have been executed for UAC - if (MsIsAdmin()) - { - // Do the language setting - start_page = D_SW_PERFORM; - } - else - { - // Error screen - start_page = D_SW_NOT_ADMIN; - } - } - else - { - if (sw->LangNow) - { - // If not via UAC but Lang Now is set - start_page = D_SW_PERFORM; - } - } - - if (sw->SetLangAndReboot && sw->LangNow == false) - { - // Restart myself immediately by changing the lang.config - LIST *o = LoadLangList(); - - if (o == NULL) - { - MsgBox(NULL, MB_ICONSTOP, _UU("SW_LANG_LIST_LOAD_FAILED")); - } - else - { - LANGLIST *new_lang = GetLangById(o, sw->LangId); - LANGLIST old_lang; - - Zero(&old_lang, sizeof(old_lang)); - GetCurrentLang(&old_lang); - - if (new_lang == NULL) - { - MsgBox(NULL, MB_ICONSTOP, _UU("SW_LANG_LIST_LOAD_FAILED")); - } - else - { - if (SaveLangConfigCurrentDir(new_lang->Name) == false) - { - MsgBox(NULL, MB_ICONSTOP, _UU("SW_LANG_SET_FAILED")); - } - else - { - if (SwReExecMyself(sw, L"/LANGNOW:true ", false) == false) - { - SaveLangConfigCurrentDir(old_lang.Name); - - MsgBox(NULL, MB_ICONSTOP, _UU("SW_CHILD_PROCESS_ERROR")); - - sw->ExitCode = SW_EXIT_CODE_INTERNAL_ERROR; - } - } - } - - FreeLangList(o); - } - } - else - { - // Show the wizard - ShowWizard(NULL, w, start_page); - } - } - else - { - // Installation mode - UINT start_page = D_SW_WELCOME; - - if (sw->IsReExecForUac) - { - // In the case of this have been executed for UAC - if (MsIsAdmin()) - { - // Jump to component list if the user have system administrator privileges - start_page = D_SW_COMPONENTS; - } - else - { - // Jump to the setup mode selection screen when fail - // to get admin privileges even executed by enabling UAC - start_page = D_SW_MODE; - } - } - - ShowWizard(NULL, w, start_page); - - if (sw->Run) - { - // Auto run the app - wchar_t tmp[MAX_PATH]; - HANDLE h; - UNI_TOKEN_LIST *t; - - t = UniParseToken(sw->CurrentComponent->StartExeName, L" "); - - if (t != NULL) - { - wchar_t exe[MAX_PATH]; - wchar_t arg[MAX_PATH]; - - Zero(exe, sizeof(exe)); - Zero(arg, sizeof(arg)); - - if (t->NumTokens >= 1) - { - UniStrCpy(exe, sizeof(exe), t->Token[0]); - } - if (t->NumTokens >= 2) - { - UniStrCpy(arg, sizeof(arg), t->Token[1]); - } - - if (UniIsEmptyStr(exe) == false) - { - CombinePathW(tmp, sizeof(tmp), sw->InstallDir, exe); - - h = MsRunAsUserExW(tmp, arg, false); - if (h != NULL) - { - CloseHandle(h); - } - } - - UniFreeToken(t); - } - } - } - - FreeWizard(w); -} - -// Release the component -void SwFreeComponent(SW_COMPONENT *c) -{ - // Validate arguments - if (c == NULL) - { - return; - } - - FreeStrList(c->NeedFiles); - Free(c->Name); - Free(c->SvcName); - Free(c->LongName); - Free(c->Title); - Free(c->Description); - Free(c->DefaultDirName); - Free(c->SvcFileName); - Free(c->StartExeName); - Free(c->StartDescription); - - Free(c); -} - -// Create a component -SW_COMPONENT *SwNewComponent(char *name, char *svc_name, UINT id, UINT icon, UINT icon_index, wchar_t *svc_filename, - wchar_t *long_name, bool system_mode_only, UINT num_files, char *files[], - wchar_t *start_exe_name, wchar_t *start_description, - SW_OLD_MSI *old_msis, UINT num_old_msis) -{ - SW_COMPONENT *c; - UINT i; - char tmp[MAX_SIZE]; - // Validate arguments - if (name == NULL || files == NULL || long_name == NULL) - { - return NULL; - } - if (svc_name == NULL) - { - svc_name = name; - } - - c = ZeroMalloc(sizeof(SW_COMPONENT)); - - c->Id = id; - - c->NeedFiles = NewListFast(NULL); - - for (i = 0;i < num_files;i++) - { - Add(c->NeedFiles, CopyStr(files[i])); - } - - c->SystemModeOnly = system_mode_only; - c->Name = CopyStr(name); - c->SvcName = CopyStr(svc_name); - c->DefaultDirName = CopyUniStr(long_name); - c->LongName = CopyUniStr(long_name); - - Format(tmp, sizeof(tmp), "SW_COMPONENT_%s_TITLE", name); - c->Title = CopyUniStr(_UU(tmp)); - - Format(tmp, sizeof(tmp), "SW_COMPONENT_%s_DESCRIPTION", name); - c->Description = CopyUniStr(_UU(tmp)); - - c->Icon = icon; - c->IconExeIndex = icon_index; - - if (UniIsEmptyStr(svc_filename) == false) - { - c->InstallService = true; - c->SvcFileName = UniCopyStr(svc_filename); - } - - if (UniIsEmptyStr(start_exe_name) == false && UniIsEmptyStr(start_description) == false) - { - c->StartExeName = UniCopyStr(start_exe_name); - c->StartDescription = UniCopyStr(start_description); - } - - c->OldMsiList = old_msis; - c->NumOldMsi = num_old_msis; - - return c; -} - -// Examine the OS requirements -bool SwCheckOs(SW *sw, SW_COMPONENT *c) -{ - // Validate arguments - if (sw == NULL || c == NULL) - { - return false; - } - - if (c->Id == SW_CMP_VPN_CLIENT) - { - OS_INFO *info = GetOsInfo(); - - if (OS_IS_WINDOWS_NT(info->OsType)) - { - if (MsIsWin2000OrGreater() == false) - { - // It doesn't work with WinNT 4.0 - return false; - } - } - else - { - if (GET_KETA(info->OsType, 100) <= 1) - { - // It doesn't work with Win95 - return false; - } - else if (info->OsType == OSTYPE_WINDOWS_98) - { - if (EndWith(info->OsVersion, "A") == false) - { - // It doesn't work in Win98 First Edition - return false; - } - } - } - } - - return true; -} - -// Define the component -void SwDefineComponents(SW *sw) -{ - SW_COMPONENT *c; - char *vpn_server_files[] = - { - "vpnserver.exe", - "vpnsmgr.exe", - "vpncmd.exe", - "hamcore.se2", - }; - char *vpn_client_files[] = - { - "vpnclient.exe", - "vpncmgr.exe", - "vpncmd.exe", - "hamcore.se2", - }; - char *vpn_bridge_files[] = - { - "vpnbridge.exe", - "vpnsmgr.exe", - "vpncmd.exe", - "hamcore.se2", - }; - char *vpn_smgr_files[] = - { - "vpnsmgr.exe", - "vpncmd.exe", - "hamcore.se2", - }; - char *vpn_cmgr_files[] = - { - "vpncmgr.exe", - "vpncmd.exe", - "hamcore.se2", - }; - // Validate arguments - if (sw == NULL) - { - return; - } - - // VPN Server - c = SwNewComponent(SW_NAME_VPNSERVER, GC_SVC_NAME_VPNSERVER, SW_CMP_VPN_SERVER, ICO_VPNSERVER, 5, L"vpnserver.exe", - SW_LONG_VPNSERVER, false, sizeof(vpn_server_files) / sizeof(char *), vpn_server_files, - L"vpnsmgr.exe", _UU("SW_RUN_TEXT_VPNSMGR"), - old_msi_vpnserver, sizeof(old_msi_vpnserver) / sizeof(SW_OLD_MSI)); - Add(sw->ComponentList, c); - - // VPN Client - c = SwNewComponent(SW_NAME_VPNCLIENT, GC_SVC_NAME_VPNCLIENT, SW_CMP_VPN_CLIENT, ICO_VPN, 6, L"vpnclient.exe", - SW_LONG_VPNCLIENT, true, sizeof(vpn_client_files) / sizeof(char *), vpn_client_files, - L"vpncmgr.exe", _UU("SW_RUN_TEXT_VPNCMGR"), - old_msi_vpnclient, sizeof(old_msi_vpnclient) / sizeof(SW_OLD_MSI)); - -#ifdef GC_ENABLE_VPNGATE -#endif // GC_ENABLE_VPNGATE - - Add(sw->ComponentList, c); - - // VPN Bridge - c = SwNewComponent(SW_NAME_VPNBRIDGE, GC_SVC_NAME_VPNBRIDGE, SW_CMP_VPN_BRIDGE, ICO_CASCADE, 7, L"vpnbridge.exe", - SW_LONG_VPNBRIDGE, false, sizeof(vpn_bridge_files) / sizeof(char *), vpn_bridge_files, - L"vpnsmgr.exe", _UU("SW_RUN_TEXT_VPNSMGR"), - old_msi_vpnbridge, sizeof(old_msi_vpnbridge) / sizeof(SW_OLD_MSI)); - Add(sw->ComponentList, c); - - // VPN Server Manager (Tools Only) - c = SwNewComponent(SW_NAME_VPNSMGR, NULL, SW_CMP_VPN_SMGR, ICO_USER_ADMIN, 8, NULL, - SW_LONG_VPNSMGR, false, sizeof(vpn_smgr_files) / sizeof(char *), vpn_smgr_files, - L"vpnsmgr.exe", _UU("SW_RUN_TEXT_VPNSMGR"), - NULL, 0); - Add(sw->ComponentList, c); - - // VPN Client Manager (Tools Only) - c = SwNewComponent(SW_NAME_VPNCMGR, NULL, SW_CMP_VPN_CMGR, ICO_INTERNET, 9, NULL, - SW_LONG_VPNCMGR, false, sizeof(vpn_cmgr_files) / sizeof(char *), vpn_cmgr_files, - L"vpncmgr.exe /remote", _UU("SW_RUN_TEXT_VPNCMGR"), - NULL, 0); - Add(sw->ComponentList, c); -} - -// Detect the available components -void SwDetectComponents(SW *sw) -{ - UINT i; - // Validate arguments - if (sw == NULL) - { - return; - } - - for (i = 0;i < LIST_NUM(sw->ComponentList);i++) - { - SW_COMPONENT *c = LIST_DATA(sw->ComponentList, i); - - c->Detected = SwIsComponentDetected(sw, c); - } - - // Determine whether the automatic connection configuration file exists in the same directory - if (true) - { - wchar_t tmp[MAX_PATH]; - - ConbinePathW(tmp, sizeof(tmp), MsGetExeDirNameW(), SW_AUTO_CONNECT_ACCOUNT_FILE_NAME_W); - - if (IsFileExistsW(tmp)) - { - // Exist - UniStrCpy(sw->auto_setting_path, sizeof(sw->auto_setting_path), tmp); - } - } -} - -// Determine whether detection of the component is successful -bool SwIsComponentDetected(SW *sw, SW_COMPONENT *c) -{ - UINT i; - bool ret = true; - // Validate arguments - if (sw == NULL || c == NULL) - { - return false; - } - - for (i = 0;i < LIST_NUM(c->NeedFiles);i++) - { - char *name = LIST_DATA(c->NeedFiles, i); - wchar_t name_w[MAX_SIZE]; - wchar_t fullpath[MAX_SIZE]; - - StrToUni(name_w, sizeof(name_w), name); - - CombinePathW(fullpath, sizeof(fullpath), sw->InstallSrc, name_w); - - if (IsFileExistsW(fullpath) == false) - { - ret = false; - break; - } - } - - if (c->InstallService == false) - { - if (sw->IsEasyInstaller || sw->IsWebInstaller) - { - // Prevent installing only management tool - // for Web installer or a simple installer - ret = false; - } - } - - return ret; -} - -// Add a new log -void SwAddLog(SW *sw, SW_LOGFILE *logfile, UINT type, wchar_t *path) -{ - SW_LOG *g; - // Validate arguments - if (sw == NULL || path == NULL || logfile == NULL) - { - return; - } - - g = ZeroMalloc(sizeof(SW_LOG)); - g->Type = type; - UniStrCpy(g->Path, sizeof(g->Path), path); - - Add(logfile->LogList, g); -} -void SwAddLogA(SW *sw, SW_LOGFILE *logfile, UINT type, char *path) -{ - wchar_t *w; - // Validate arguments - if (sw == NULL || path == NULL || logfile == NULL) - { - return; - } - - w = CopyStrToUni(path); - - SwAddLog(sw, logfile, type, w); - - Free(w); -} - -// Create a SW -SW *NewSw() -{ - SW *sw = ZeroMalloc(sizeof(SW)); - - sw->IsSystemMode = true; - - sw->ComponentList = NewListFast(NULL); - - sw->ExitCode = SW_EXIT_CODE_USER_CANCEL; - - UniStrCpy(sw->InstallSrc, sizeof(sw->InstallSrc), MsGetExeDirNameW()); - - SwDefineComponents(sw); - - return sw; -} - -// Release the SW -UINT FreeSw(SW *sw) -{ - UINT i; - UINT ret; - // Validate arguments - if (sw == NULL) - { - return SW_EXIT_CODE_INTERNAL_ERROR; - } - - SwLeaveSingle(sw); - - for (i = 0;i < LIST_NUM(sw->ComponentList);i++) - { - SW_COMPONENT *c = LIST_DATA(sw->ComponentList, i); - - SwFreeComponent(c); - } - - ReleaseList(sw->ComponentList); - - SwFreeLogFile(sw->LogFile); - - if (sw->ReExecProcessHandle != NULL) - { - // If you have started the child process, wait for the termination of child process - sw->ExitCode = MsWaitProcessExit(sw->ReExecProcessHandle); - } - - ret = sw->ExitCode; - - Free(sw); - - return ret; -} - -// Exit the multi-starts prevention mode -void SwLeaveSingle(SW *sw) -{ - // Validate arguments - if (sw == NULL) - { - return; - } - - if (sw->Single != NULL) - { - FreeSingleInstance(sw->Single); - sw->Single = NULL; - } -} - -// Enter multiple-starts prevention mode -bool SwEnterSingle(SW *sw) -{ - // Validate arguments - if (sw == NULL) - { - return false; - } - - if (sw->Single != NULL) - { - return true; - } - - sw->Single = NewSingleInstance(SW_SINGLE_INSTANCE_NAME); - - if (sw->Single == NULL) - { - return false; - } - - return true; -} - -// Parse the command line -void SwParseCommandLine(SW *sw) -{ - CONSOLE *c; - wchar_t *cmdline; - LIST *o; - PARAM args[] = - { - {"UAC", NULL, NULL, NULL, NULL, }, - {"LANGUAGE", NULL, NULL, NULL, NULL, }, - {"LANGID", NULL, NULL, NULL, NULL, }, - {"LANGNOW", NULL, NULL, NULL, NULL, }, - {"SETLANGANDREBOOT", NULL, NULL, NULL, NULL, }, - {"EASY", NULL, NULL, NULL, NULL, }, - {"WEB", NULL, NULL, NULL, NULL, }, - {"SFXMODE", NULL, NULL, NULL, NULL, }, - {"SFXOUT", NULL, NULL, NULL, NULL, }, - {"HIDESTARTCOMMAND", NULL, NULL, NULL, NULL, }, - {"CALLERSFXPATH", NULL, NULL, NULL, NULL, }, - {"ISEASYINSTALLER", NULL, NULL, NULL, NULL, }, - {"DISABLEAUTOIMPORT", NULL, NULL, NULL, NULL, }, - {"ISWEBINSTALLER", NULL, NULL, NULL, NULL, }, - {"SUINSTMODE", NULL, NULL, NULL, NULL, }, - }; - // Validate arguments - if (sw == NULL) - { - return; - } - - c = NewLocalConsole(NULL, NULL); - if (c == NULL) - { - return; - } - - cmdline = GetCommandLineUniStr(); - - if (UniIsEmptyStr(cmdline) == false) - { - o = ParseCommandList(c, "setup", cmdline, args, sizeof(args) / sizeof(args[0])); - - if (o != NULL) - { - sw->IsReExecForUac = GetParamYes(o, "UAC"); - sw->LanguageMode = GetParamYes(o, "LANGUAGE"); - sw->LangId = GetParamInt(o, "LANGID"); - sw->LangNow = GetParamYes(o, "LANGNOW"); - sw->SetLangAndReboot = GetParamYes(o, "SETLANGANDREBOOT"); - sw->HideStartCommand = GetParamYes(o, "HIDESTARTCOMMAND"); - sw->SuInstMode = GetParamYes(o, "SUINSTMODE"); - - // Special mode - if (sw->LanguageMode == false) - { - sw->EasyMode = GetParamYes(o, "EASY"); - - if (sw->EasyMode == false) - { - sw->WebMode = GetParamYes(o, "WEB"); - } - } - - StrCpy(sw->SfxMode, sizeof(sw->SfxMode), GetParamStr(o, "SFXMODE")); - UniStrCpy(sw->SfxOut, sizeof(sw->SfxOut), GetParamUniStr(o, "SFXOUT")); - UniStrCpy(sw->CallerSfxPath, sizeof(sw->CallerSfxPath), GetParamUniStr(o, "CALLERSFXPATH")); - sw->IsEasyInstaller = GetParamYes(o, "ISEASYINSTALLER"); - sw->IsWebInstaller = GetParamYes(o, "ISWEBINSTALLER"); - sw->DisableAutoImport = GetParamYes(o, "DISABLEAUTOIMPORT"); - - FreeParamValueList(o); - } - } - - Free(cmdline); - - c->Free(c); -} - -// Start the Setup Wizard -UINT SWExecMain() -{ - SW *sw; - UINT ret; - SW_LOGFILE *logfile = NULL; - wchar_t verstr[MAX_SIZE]; - char ver[MAX_SIZE]; - - // Define the wizard UI - GetCedarVersion(ver, sizeof(ver)); - UniFormat(verstr, sizeof(verstr), _UU("SW_TITLE"), ver); - - InitWinUi(verstr, _SS("DEFAULT_FONT"), _II("DEFAULT_FONT_SIZE")); - - // Create a SW - sw = NewSw(); - - // Read the setting - sw->Easy_EraseSensitive = MsRegReadInt(REG_CURRENT_USER, SW_REG_KEY, "Easy_EraseSensitive"); - sw->Easy_EasyMode = MsRegReadInt(REG_CURRENT_USER, SW_REG_KEY, "Easy_EasyMode"); - sw->Web_EraseSensitive = MsRegReadInt(REG_CURRENT_USER, SW_REG_KEY, "Web_EraseSensitive"); - sw->Web_EasyMode = MsRegReadInt(REG_CURRENT_USER, SW_REG_KEY, "Web_EasyMode"); - - // Parse the command line - SwParseCommandLine(sw); - - // Test! - //sw->WebMode = true; - - // Detect the installable components - SwDetectComponents(sw); - - if (IsEmptyStr(sw->SfxMode) == false && UniIsEmptyStr(sw->SfxOut) == false) - { - // SFX generation mode - if (SwGenSfxModeMain(sw->SfxMode, sw->SfxOut)) - { - // Success - sw->ExitCode = 0; - } - } - else if (sw->SuInstMode) - { - // SuInst mode - sw->ExitCode = 0; - if (SuInstallDriver(false) == false) - { - sw->ExitCode = SW_EXIT_CODE_INTERNAL_ERROR; - } - } - else - { - // Normal mode - // Load setuplog.dat - if (IsFileExistsW(L"@" L"setuplog.dat") && (logfile = SwLoadLogFile(sw, L"@" L"setuplog.dat")) == NULL) - { - // Setuplog.dat is broken - MsgBox(NULL, MB_ICONSTOP, _UU("SW_SETUPLOG_CORRUPTED")); - } - else - { - sw->LogFile = logfile; - if (sw->LogFile == NULL) - { - // Setuplog.dat does not exist - sw->LogFile = SwNewLogFile(); - } - else - { - // When setuplog.dat exists, it is in either of language-setting-change-mode, simple-installer-creation-mode, uninstall-mode - sw->CurrentComponent = sw->LogFile->Component; - sw->IsSystemMode = sw->LogFile->IsSystemMode; - UniStrCpy(sw->InstallDir, sizeof(sw->InstallDir), MsGetExeDirNameW()); - - if (sw->LanguageMode == false && sw->EasyMode == false && sw->WebMode == false) - { - // Uninstall mode - sw->UninstallMode = true; - } - } - - // UI main - SwUiMain(sw); - } - } - - // Release the SW - ret = FreeSw(sw); - - FreeWinUi(); - - return ret; -} - - -#endif // WIN32 - - - +// SoftEther VPN Source Code - Developer Edition Master Branch +// Cedar Communication Module + + +// SW.c +// Setup Wizard for Win32 + +#include + +#ifdef WIN32 + +#define SM_C +#define CM_C +#define NM_C +#define SW_C + +#define _WIN32_WINNT 0x0502 +#define WINVER 0x0502 +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "CMInner.h" +#include "SMInner.h" +#include "NMInner.h" +#include "EMInner.h" +#include "SWInner.h" +#include "../PenCore/resource.h" + +//// Old MSI product information +// VPN Server +static SW_OLD_MSI old_msi_vpnserver[] = +{ + {"{B5B58F8A-D56C-4f3e-B400-235A6E007101}", "{1BDA6B01-2DB3-478c-AA5B-E973A7DC49A4}"}, + {"{124DDAE2-B9AF-4541-B3EF-B169D9007101}", "{BCDE5CF2-7413-47d0-92E1-F6F2189D8E60}"}, +}; +static SW_OLD_MSI old_msi_vpnclient[] = +{ + {"{54864EDD-4FC6-4269-AA17-3E7C13607101}", "{13ED64E0-532D-4ff0-A3A0-5D700C73259E}"}, + {"{8A215EB7-C5F2-4193-9D7D-1017F1007101}", "{AD593FE5-759E-46c6-9355-29031A8C7D44}"}, +}; +static SW_OLD_MSI old_msi_vpnbridge[] = +{ + {"{58CE8E96-1234-499D-CAFE-3E62261DF211}", "{211FA6A7-1234-4985-CAFE-3DD3E3151E7E}"}, +}; + +// List of file names needed to SFX +static char *sfx_vpn_server_bridge_files[] = +{ + "vpnsetup.exe", + "vpnserver.exe", + "vpnbridge.exe", + "vpnsmgr.exe", + "vpncmd.exe", + "hamcore.se2", +}; +static char *sfx_vpn_client_files[] = +{ + "vpnsetup.exe", + "vpnclient.exe", + "vpncmgr.exe", + "vpncmd.exe", + //"vpninstall.exe", + //"vpnweb.cab", + "hamcore.se2", +}; + +// Global variables to be used out of necessity +static bool g_stop_flag = false; +static HANDLE g_wait_process_handle = NULL; + + +// SFX generation main +bool SwGenSfxModeMain(char *mode, wchar_t *dst) +{ + LIST *o; + bool ret = false; + // Validate arguments + if (mode == NULL || dst == NULL) + { + return false; + } + + o = SwNewSfxFileList(); + + if (SwAddBasicFilesToList(o, mode)) + { + if (SwCompileSfx(o, dst)) + { + ret = true; + } + } + + SwFreeSfxFileList(o); + + return ret; +} + +// Compile the SFX files +bool SwCompileSfx(LIST *o, wchar_t *dst_filename) +{ + bool ret = false; + wchar_t exe_filename[MAX_PATH]; + HINSTANCE hKernel32 = LoadLibraryA("kernel32.dll"); + HANDLE (WINAPI *_BeginUpdateResourceW)(LPCWSTR, BOOL) = NULL; + BOOL (WINAPI *_UpdateResourceA)(HANDLE, LPCSTR, LPCSTR, WORD, LPVOID, DWORD) = NULL; + BOOL (WINAPI *_EndUpdateResourceW)(HANDLE, BOOL) = NULL; + // Validate arguments + if (o == NULL || dst_filename == NULL || hKernel32 == NULL) + { + return false; + } + + // Get the API related to the resource editing + _BeginUpdateResourceW = (HANDLE (__stdcall *)(LPCWSTR,UINT))GetProcAddress(hKernel32, "BeginUpdateResourceW"); + _UpdateResourceA = (UINT (__stdcall *)(HANDLE,LPCSTR,LPCSTR,WORD,LPVOID,DWORD))GetProcAddress(hKernel32, "UpdateResourceA"); + _EndUpdateResourceW = (UINT (__stdcall *)(HANDLE,UINT))GetProcAddress(hKernel32, "EndUpdateResourceW"); + + if (_BeginUpdateResourceW != NULL && _UpdateResourceA != NULL && _EndUpdateResourceW != NULL) + { + // Generate the setup.exe file in the Temp directory + ConbinePathW(exe_filename, sizeof(exe_filename), MsGetMyTempDirW(), L"setup.exe"); + if (FileCopyW(L"vpnsetup.exe", exe_filename)) + { + // Resource updating start + HANDLE h = _BeginUpdateResourceW(exe_filename, false); + + if (h != NULL) + { + UINT i; + bool ok = true; + + for (i = 0;i < LIST_NUM(o);i++) + { + SW_SFX_FILE *f = LIST_DATA(o, i); + BUF *b; + + // Read the original file + b = ReadDumpW(f->DiskFileName); + if (b != NULL) + { + // Add resources + char inner_name[MAX_PATH]; + BUF *b2; + StrCpy(inner_name, sizeof(inner_name), f->InnerFileName); + StrUpper(inner_name); + + if (StrCmpi(inner_name, "hamcore.se2") == 0) + { + // Not to re-compress the hamcore.se2 because they are already compressed + // Prepend "raw_" to file name + Format(inner_name, sizeof(inner_name), "raw_%s", f->InnerFileName); + StrUpper(inner_name); + } + else + { + // Compress + b2 = CompressBuf(b); + FreeBuf(b); + b = b2; + } + + + if (_UpdateResourceA(h, SW_SFX_RESOURCE_TYPE, inner_name, MAKELANGID(LANG_NEUTRAL, SUBLANG_NEUTRAL), + b->Buf, b->Size) == false) + { + ok = false; + } + + FreeBuf(b); + } + + if (ok == false) + { + break; + } + } + + if (ok) + { + // Success to add all resources + if (_EndUpdateResourceW(h, false)) + { + h = NULL; + + // File Copy + if (FileCopyW(exe_filename, dst_filename)) + { + // All succeed + ret = true; + } + } + } + + if (ret == false) + { + // Failed to add resource + if (h != NULL) + { + _EndUpdateResourceW(h, true); + h = NULL; + } + } + + FileDeleteW(exe_filename); + } + } + } + + FreeLibrary(hKernel32); + + return ret; +} + +// Create new item in the SFX compression list +SW_SFX_FILE *SwNewSfxFile(char *inner_file_name, wchar_t *disk_file_name) +{ + SW_SFX_FILE *f = ZeroMalloc(sizeof(SW_SFX_FILE)); + + StrCpy(f->InnerFileName, sizeof(f->InnerFileName), inner_file_name); + UniStrCpy(f->DiskFileName, sizeof(f->DiskFileName), disk_file_name); + + return f; +} + +// Add the basically required files for the components to SFX compressed files list +bool SwAddBasicFilesToList(LIST *o, char *component_name) +{ + UINT i; + // Validate arguments + if (o == NULL || component_name == NULL) + { + return false; + } + + if (StrCmpi(component_name, "vpnserver_vpnbridge") == 0) + { + // VPN Server & VPN Bridge + for (i = 0; i < (sizeof(sfx_vpn_server_bridge_files) / sizeof(char *)); i++) + { + char *name = sfx_vpn_server_bridge_files[i]; + wchar_t name_w[MAX_PATH]; + wchar_t src_file_name[MAX_PATH]; + + StrToUni(name_w, sizeof(name_w), name); + ConbinePathW(src_file_name, sizeof(src_file_name), MsGetExeFileDirW(), name_w); + + Add(o, SwNewSfxFile(name, src_file_name)); + } + } + else if (StrCmpi(component_name, "vpnclient") == 0) + { + // VPN Client + for (i = 0; i < (sizeof(sfx_vpn_client_files) / sizeof(char *)); i++) + { + char *name = sfx_vpn_client_files[i]; + wchar_t name_w[MAX_PATH]; + wchar_t src_file_name[MAX_PATH]; + + StrToUni(name_w, sizeof(name_w), name); + ConbinePathW(src_file_name, sizeof(src_file_name), MsGetExeFileDirW(), name_w); + + Add(o, SwNewSfxFile(name, src_file_name)); + } + } + else + { + return false; + } + + return true; +} + +// Release the SFX file list +void SwFreeSfxFileList(LIST *o) +{ + UINT i; + // Validate arguments + if (o == NULL) + { + return; + } + + for (i = 0;i < LIST_NUM(o);i++) + { + SW_SFX_FILE *f = LIST_DATA(o, i); + + Free(f); + } + + ReleaseList(o); +} + +// Generate the SFX file list +LIST *SwNewSfxFileList() +{ + LIST *o = NewListFast(NULL); + + return o; +} + +// Extract from the SFX files +bool SwSfxExtractFile(HWND hWnd, void *data, UINT size, wchar_t *dst, bool compressed) +{ + IO *io; + bool ret = false; + // Validate arguments + if (data == NULL || size == 0 || dst == NULL) + { + return false; + } + + io = FileCreateW(dst); + + if (compressed == false) + { + // Write uncompressed files as is + ret = FileWrite(io, data, size); + } + else + { + // Unzip when the files are compressed + BUF *src = NewBuf(); + BUF *dst; + + WriteBuf(src, data, size); + + dst = UncompressBuf(src); + + FreeBuf(src); + + ret = FileWrite(io, dst->Buf, dst->Size); + + FreeBuf(dst); + } + + FileClose(io); + + if (ret == false) + { + FileDeleteW(dst); + } + + return ret; +} + +// SFX extraction process +bool SwSfxExtractProcess(HWND hWnd, bool *hide_error_msg) +{ + TOKEN_LIST *t; + UINT i; + bool ret = true; + wchar_t exec_filename[MAX_SIZE]; + bool is_easy_installer = false; + bool dummy_bool = false; + + if (hide_error_msg == NULL) + { + hide_error_msg = &dummy_bool; + } + + *hide_error_msg = false; + + Zero(exec_filename, sizeof(exec_filename)); + + // Enumerate the DATAFILE resources + t = MsEnumResources(NULL, SW_SFX_RESOURCE_TYPE); + + for (i = 0;i < t->NumTokens;i++) + { + char *resource_name = t->Token[i]; + char filename[MAX_PATH]; + wchar_t filename_w[MAX_PATH]; + wchar_t tmp_filename[MAX_PATH]; + HRSRC hr; + bool ok = false; + bool is_compressed = true; + + DoEvents(hWnd); + + if (g_stop_flag) + { + // User cancel + ret = false; + break; + } + + StrCpy(filename, sizeof(filename), resource_name); + + StrLower(filename); + + if (EndWith(filename, ".vpn")) + { + is_easy_installer = true; + } + + if (StartWith(filename, "raw_")) + { + StrToUni(filename_w, sizeof(filename_w), filename + 4); + is_compressed = false; + } + else + { + StrToUni(filename_w, sizeof(filename_w), filename); + } + + ConbinePathW(tmp_filename, sizeof(tmp_filename), MsGetMyTempDirW(), filename_w); + + if (EndWith(filename, "vpnsetup.exe")) + { + UniStrCpy(exec_filename, sizeof(exec_filename), tmp_filename); + } + + // Find the resources + hr = FindResourceA(MsGetCurrentModuleHandle(), resource_name, SW_SFX_RESOURCE_TYPE); + if (hr != NULL) + { + HGLOBAL hg = LoadResource(MsGetCurrentModuleHandle(), hr); + + if (hg != NULL) + { + UINT size = SizeofResource(MsGetCurrentModuleHandle(), hr); + void *ptr = LockResource(hg); + + if (size != 0 && ptr != NULL) + { + if (SwSfxExtractFile(hWnd, ptr, size, tmp_filename, is_compressed)) + { + ok = true; + } + } + } + } + + DoEvents(hWnd); + + if (ok == false) + { + // Failure + ret = false; + break; + } + } + + FreeToken(t); + + if (ret) + { + wchar_t exe_name[MAX_PATH]; + wchar_t *exe_dir = MsGetExeFileDirW(); + + GetFileNameFromFilePathW(exe_name, sizeof(exe_name), MsGetExeFileNameW()); + + } + + if (ret) + { + // Start the vpnsetup.exe + if (UniIsEmptyStr(exec_filename)) + { + ret = false; + } + else + { + void *handle = NULL; + wchar_t params[MAX_SIZE]; + wchar_t *current_params = GetCommandLineUniStr(); + wchar_t tmp[MAX_SIZE]; + char *last_lang; + wchar_t copy_of_me[MAX_PATH]; + + UniStrCpy(params, sizeof(params), current_params); + + // Copy itself to the Temp directory + CombinePathW(copy_of_me, sizeof(copy_of_me), MsGetMyTempDirW(), L"installer.cache"); + if (FileCopyW(MsGetExeFileNameW(), copy_of_me) == false) + { + Zero(copy_of_me, sizeof(copy_of_me)); + } + + // Add a path of this own + UniFormat(tmp, sizeof(tmp), L" /CALLERSFXPATH:\"%s\"", copy_of_me); + UniStrCat(params, sizeof(params), tmp); + + // Add information of whether it's a simple installer + UniFormat(tmp, sizeof(tmp), L" /ISEASYINSTALLER:%u", is_easy_installer); + UniStrCat(params, sizeof(params), tmp); + + UniTrim(params); + + // Specify a language by the lang.config + last_lang = MsRegReadStrEx2(REG_CURRENT_USER, SW_REG_KEY, "Last User Language", false, true); + if (IsEmptyStr(last_lang) == false) + { + wchar_t lang_filename[MAX_PATH]; + BUF *buf; + + CombinePathW(lang_filename, sizeof(lang_filename), MsGetMyTempDirW(), L"lang.config"); + + buf = NewBuf(); + WriteBufLine(buf, ""); + WriteBufLine(buf, last_lang); + WriteBufLine(buf, ""); + DumpBufW(buf, lang_filename); + FreeBuf(buf); + } + Free(last_lang); + + if (MsExecuteEx2W(exec_filename, params, &handle, false) == false) + { + ret = false; + } + else + { + g_wait_process_handle = handle; + } + } + } + + return ret; +} + +// Copy the files of VPN Gate +bool SwSfxCopyVgFiles(HWND hWnd, wchar_t *src, wchar_t *dst) +{ + wchar_t *msg; + wchar_t srcfilename[MAX_PATH]; + wchar_t exefilename[MAX_PATH]; + + GetFileNameFromFilePathW(srcfilename, sizeof(srcfilename), src); + GetFileNameFromFilePathW(exefilename, sizeof(exefilename), MsGetExeFileNameW()); + + if (FileCopyW(src, dst)) + { + return true; + } + + msg = L"The file \"%s\" was not found on the directory which the installer \"%s\" is located on.\r\n\r\n" + L"To continue the installation, the file \"%s\" is required on the same directory.\r\n" + L"If you have extracted the installer from a ZIP archive, you have to also extract the file \"%s\" from the ZIP archive together."; + + MsgBoxEx(hWnd, MB_ICONINFORMATION, msg, srcfilename, exefilename, srcfilename, srcfilename); + + return false; +} + +// SFX extraction dialog procedure +bool CALLBACK SfxModeMainDialogProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam) +{ + UINT ret; + bool hide_msg = false; + switch (msg) + { + case WM_INITDIALOG: + SetTimer(hWnd, 1, 500, NULL); + break; + + case WM_TIMER: + switch (wParam) + { + case 1: + KillTimer(hWnd, 1); + + ret = SW_EXIT_CODE_USER_CANCEL; + if (SwSfxExtractProcess(hWnd, &hide_msg)) + { + ret = 0; + } + else + { + if (g_stop_flag == false) + { + if (hide_msg == false) + { + MsgBoxEx(hWnd, MB_ICONSTOP, L"Fatal Error: Self extracting files to the temporary directory was failed.\r\n\r\n" + L"Please try again after reboot Windows."); + } + } + } + + EndDialog(hWnd, ret); + + break; + } + break; + + case WM_COMMAND: + switch (wParam) + { + case IDOK: + case IDCANCEL: + g_stop_flag = true; + Disable(hWnd, IDCANCEL); + break; + } + break; + + case WM_CLOSE: + break; + } + + return false; +} + +// Main process as SFX mode +UINT SwSfxModeMain() +{ + UINT ret; + // Select either English or Japanese + UINT dialog_id = (MsIsCurrentUserLocaleIdJapanese() ? 10001 : 10002); + + g_wait_process_handle = NULL; + g_stop_flag = false; + + // Show the screen + ret = (UINT)DialogBoxParamA(MsGetCurrentModuleHandle(), MAKEINTRESOURCEA(dialog_id), NULL, (DLGPROC)SfxModeMainDialogProc, 0); + + if (g_wait_process_handle != NULL) + { + // If this have started the vpnsetup.exe, wait for termination of the child process + ret = MsWaitProcessExit(g_wait_process_handle); + } + + return ret; +} + +// Resource name enumeration procedure +bool CALLBACK SwEnumResourceNamesProc(HMODULE hModule, const char *type, char *name, LONG_PTR lParam) +{ + bool *b = (bool *)lParam; + // Validate arguments + if (type == NULL || name == NULL || lParam == 0) + { + return false; + } + + *b = true; + + return true; +} + +// Main process of vpnsetup.exe +UINT SWExec() +{ + UINT ret = 0; + bool is_datafile_exists = false; + + // Examine whether DATAFILE resources are stored in setup.exe that is currently running + EnumResourceNamesA(NULL, SW_SFX_RESOURCE_TYPE, SwEnumResourceNamesProc, (LONG_PTR)(&is_datafile_exists)); + + if (is_datafile_exists) + { + // If DATAFILE resources are stored, extract it as SFX + MayaquaMinimalMode(); + } + +#if defined(_DEBUG) || defined(DEBUG) // In VC++ compilers, the macro is "_DEBUG", not "DEBUG". + // If set memcheck = true, the program will be vitally slow since it will log all malloc() / realloc() / free() calls to find the cause of memory leak. + // For normal debug we set memcheck = false. + // Please set memcheck = true if you want to test the cause of memory leaks. + InitMayaqua(false, true, 0, NULL); +#else + InitMayaqua(false, false, 0, NULL); +#endif + InitCedar(); + + if (is_datafile_exists == false) + { + // Start the Setup Wizard + ret = SWExecMain(); + } + else + { + // SFX mode + ret = SwSfxModeMain(); + } + + FreeCedar(); + FreeMayaqua(); + + return ret; +} + +// Dialog procedure (for copy and paste) +UINT SwDefaultDlg(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, WIZARD *wizard, WIZARD_PAGE *wizard_page, void *param) +{ + SW *sw = (SW *)param; + // Validate arguments + if (hWnd == NULL || sw == NULL) + { + return 0; + } + + switch (msg) + { + case WM_INITDIALOG: + break; + + case WM_WIZ_SHOW: + SetWizardButton(wizard_page, true, true, true, false); + break; + + case WM_WIZ_HIDE: + break; + + case WM_CLOSE: + break; + + case WM_WIZ_NEXT: + break; + + case WM_WIZ_BACK: + break; + + case WM_COMMAND: + switch (wParam) + { + } + break; + } + + return 0; +} + +// Update the file specification dialog +void SwWeb2Update(HWND hWnd, SW *sw, WIZARD *wizard, WIZARD_PAGE *wizard_page) +{ + bool ok = true; + // Validate arguments + if (hWnd == NULL || sw == NULL || wizard_page == NULL || wizard == NULL) + { + return; + } + + if (IsEmptyUniStr(sw->Web_OutFile) || IsEmptyUniStr(sw->Web_SettingFile)) + { + ok = false; + } + + SetText(hWnd, E_SETTING, sw->Web_SettingFile); + SetText(hWnd, E_OUT, sw->Web_OutFile); + + SetWizardButton(wizard_page, ok, true, true, false); +} + +// Update the file specification dialog +void SwEasy2Update(HWND hWnd, SW *sw, WIZARD *wizard, WIZARD_PAGE *wizard_page) +{ + bool ok = true; + // Validate arguments + if (hWnd == NULL || sw == NULL || wizard_page == NULL || wizard == NULL) + { + return; + } + + if (IsEmptyUniStr(sw->Easy_OutFile) || IsEmptyUniStr(sw->Easy_SettingFile)) + { + ok = false; + } + + SetText(hWnd, E_SETTING, sw->Easy_SettingFile); + SetText(hWnd, E_OUT, sw->Easy_OutFile); + + SetWizardButton(wizard_page, ok, true, true, false); +} + +// Generate a SFX file name of the default +void SwGenerateDefaultSfxFileName(wchar_t *name, UINT size) +{ + // Validate arguments + if (name == NULL) + { + return; + } + + UniFormat(name, size, L"easy-" GC_SW_SOFTETHER_PREFIX_W L"vpnclient-v%u.%02u-%u-%04u-%02u-%02u-windows.exe", + CEDAR_VERSION_MAJOR, CEDAR_VERSION_MINOR, CEDAR_VERSION_BUILD, + BUILD_DATE_Y, BUILD_DATE_M, BUILD_DATE_D); +} + +// Generate a ZIP file name of the default +void SwGenerateDefaultZipFileName(wchar_t *name, UINT size) +{ + // Validate arguments + if (name == NULL) + { + return; + } + + UniFormat(name, size, L"web-" GC_SW_SOFTETHER_PREFIX_W L"vpnclient-v%u.%02u-%u-%04u-%02u-%02u-windows.zip", + CEDAR_VERSION_MAJOR, CEDAR_VERSION_MINOR, CEDAR_VERSION_BUILD, + BUILD_DATE_Y, BUILD_DATE_M, BUILD_DATE_D); +} + +// Specify a file +UINT SwEasy2(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, WIZARD *wizard, WIZARD_PAGE *wizard_page, void *param) +{ + SW *sw = (SW *)param; + wchar_t *fn; + wchar_t tmp[MAX_SIZE]; + // Validate arguments + if (hWnd == NULL || sw == NULL) + { + return 0; + } + + switch (msg) + { + case WM_INITDIALOG: + DlgFont(hWnd, S_BOLD1, 10, true); + DlgFont(hWnd, S_BOLD2, 10, true); + + Check(hWnd, B_DELETE_SENSITIVE, sw->Easy_EraseSensitive); + Check(hWnd, B_EASYMODE, sw->Easy_EasyMode); + + break; + + case WM_WIZ_SHOW: + SwEasy2Update(hWnd, sw, wizard, wizard_page); + break; + + case WM_WIZ_HIDE: + break; + + case WM_CLOSE: + break; + + case WM_WIZ_NEXT: + // Save the Settings + MsRegWriteInt(REG_CURRENT_USER, SW_REG_KEY, "Easy_EraseSensitive", sw->Easy_EraseSensitive); + MsRegWriteInt(REG_CURRENT_USER, SW_REG_KEY, "Easy_EasyMode", sw->Easy_EasyMode); + return D_SW_PERFORM; + + case WM_WIZ_BACK: + return D_SW_EASY1; + + case WM_COMMAND: + switch (wParam) + { + case B_DELETE_SENSITIVE: + sw->Easy_EraseSensitive = IsChecked(hWnd, B_DELETE_SENSITIVE); + sw->Easy_EasyMode = IsChecked(hWnd, B_EASYMODE); + break; + + case B_BROWSE_SETTING: + fn = OpenDlg(hWnd, _UU("CM_ACCOUNT_SETTING_FILE"), _UU("CM_ACCOUNT_OPEN_TITLE")); + + if (fn != NULL) + { + // Parse + if (CiTryToParseAccountFile(fn) == false) + { + // Failure + MsgBox(hWnd, MB_ICONEXCLAMATION, _UU("CM_ACCOUNT_PARSE_FAILED")); + } + else + { + // Success + UniStrCpy(sw->Easy_SettingFile, sizeof(sw->Easy_SettingFile), fn); + + SwEasy2Update(hWnd, sw, wizard, wizard_page); + + FocusEx(hWnd, E_SETTING); + } + + Free(fn); + } + break; + + case B_BROWSE_OUT: + SwGenerateDefaultSfxFileName(tmp, sizeof(tmp)); + + fn = SaveDlg(hWnd, _UU("SW_EXE_FILTER"), _UU("DLG_SAVE_FILE"), tmp, L".exe"); + + if (fn != NULL) + { + UniStrCpy(sw->Easy_OutFile, sizeof(sw->Easy_OutFile), fn); + + SwEasy2Update(hWnd, sw, wizard, wizard_page); + } + break; + + case B_HINT: + break; + } + break; + } + + return 0; +} + +// Specify a file +UINT SwWeb2(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, WIZARD *wizard, WIZARD_PAGE *wizard_page, void *param) +{ + SW *sw = (SW *)param; + wchar_t *fn; + wchar_t tmp[MAX_SIZE]; + // Validate arguments + if (hWnd == NULL || sw == NULL) + { + return 0; + } + + switch (msg) + { + case WM_INITDIALOG: + DlgFont(hWnd, S_BOLD1, 10, true); + DlgFont(hWnd, S_BOLD2, 10, true); + + Check(hWnd, B_DELETE_SENSITIVE, sw->Web_EraseSensitive); + Check(hWnd, B_EASYMODE, sw->Web_EasyMode); + + break; + + case WM_WIZ_SHOW: + SwWeb2Update(hWnd, sw, wizard, wizard_page); + break; + + case WM_WIZ_HIDE: + break; + + case WM_CLOSE: + break; + + case WM_WIZ_NEXT: + // Save the settings + MsRegWriteInt(REG_CURRENT_USER, SW_REG_KEY, "Web_EraseSensitive", sw->Web_EraseSensitive); + MsRegWriteInt(REG_CURRENT_USER, SW_REG_KEY, "Web_EasyMode", sw->Web_EasyMode); + return D_SW_PERFORM; + + case WM_WIZ_BACK: + return D_SW_WEB1; + + case WM_COMMAND: + switch (wParam) + { + case B_DELETE_SENSITIVE: + sw->Web_EraseSensitive = IsChecked(hWnd, B_DELETE_SENSITIVE); + sw->Web_EasyMode = IsChecked(hWnd, B_EASYMODE); + break; + + case B_BROWSE_SETTING: + fn = OpenDlg(hWnd, _UU("CM_ACCOUNT_SETTING_FILE"), _UU("CM_ACCOUNT_OPEN_TITLE")); + + if (fn != NULL) + { + // Parse + if (CiTryToParseAccountFile(fn) == false) + { + // Failure + MsgBox(hWnd, MB_ICONEXCLAMATION, _UU("CM_ACCOUNT_PARSE_FAILED")); + } + else + { + // Success + UniStrCpy(sw->Web_SettingFile, sizeof(sw->Web_SettingFile), fn); + + SwWeb2Update(hWnd, sw, wizard, wizard_page); + + FocusEx(hWnd, E_SETTING); + } + + Free(fn); + } + break; + + case B_BROWSE_OUT: + SwGenerateDefaultZipFileName(tmp, sizeof(tmp)); + + fn = SaveDlg(hWnd, _UU("DLG_ZIP_FILER"), _UU("DLG_SAVE_FILE"), tmp, L".zip"); + + if (fn != NULL) + { + UniStrCpy(sw->Web_OutFile, sizeof(sw->Web_OutFile), fn); + + SwWeb2Update(hWnd, sw, wizard, wizard_page); + } + break; + + case B_HINT: + break; + } + break; + } + + return 0; +} + +// Start screen of the Web Installer Creation Wizard +UINT SwWeb1(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, WIZARD *wizard, WIZARD_PAGE *wizard_page, void *param) +{ + SW *sw = (SW *)param; + // Validate arguments + if (hWnd == NULL || sw == NULL) + { + return 0; + } + + switch (msg) + { + case WM_INITDIALOG: + wizard->CloseConfirmMsg = NULL; + DlgFont(hWnd, S_TITLE, 11, true); + break; + + case WM_WIZ_SHOW: + SetWizardButton(wizard_page, true, false, true, false); + break; + + case WM_WIZ_HIDE: + break; + + case WM_CLOSE: + break; + + case WM_WIZ_NEXT: + return D_SW_WEB2; + + case WM_WIZ_BACK: + break; + + case WM_COMMAND: + switch (wParam) + { + } + break; + } + + return 0; +} + +// Start screen of the Simple installer creation wizard +UINT SwEasy1(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, WIZARD *wizard, WIZARD_PAGE *wizard_page, void *param) +{ + SW *sw = (SW *)param; + // Validate arguments + if (hWnd == NULL || sw == NULL) + { + return 0; + } + + switch (msg) + { + case WM_INITDIALOG: + wizard->CloseConfirmMsg = NULL; + DlgFont(hWnd, S_TITLE, 11, true); + break; + + case WM_WIZ_SHOW: + SetWizardButton(wizard_page, true, false, true, false); + break; + + case WM_WIZ_HIDE: + break; + + case WM_CLOSE: + break; + + case WM_WIZ_NEXT: + return D_SW_EASY2; + + case WM_WIZ_BACK: + break; + + case WM_COMMAND: + switch (wParam) + { + } + break; + } + + return 0; +} + +// Get the icon for the language +UINT SwGetLangIcon(char *name) +{ + UINT ret = ICO_NULL; + // Validate arguments + if (name == NULL) + { + return ICO_NULL; + } + + if (StrCmpi(name, "ja") == 0) + { + ret = ICO_LANG_JAPANESE; + } + else if (StrCmpi(name, "en") == 0) + { + ret = ICO_LANG_ENGLISH; + } + else if (StrCmpi(name, "cn") == 0) + { + ret = ICO_LANG_CHINESE; + } + else if (StrCmpi(name, "tw") == 0) + { + ret = ICO_LANG_TRADITIONAL_CHINESE; + } + + return ret; +} + +// Initialize the language list +void SwLang1Init(HWND hWnd, SW *sw) +{ + LVB *b; + UINT i; + SW_COMPONENT *default_select = NULL; + LIST *o; + UINT current_lang = GetCurrentLangId(); + UINT select_index = INFINITE; + // Validate arguments + if (hWnd == NULL || sw == NULL) + { + return; + } + + o = LoadLangList(); + + LvReset(hWnd, L_LIST); + + b = LvInsertStart(); + + for (i = 0;i < LIST_NUM(o);i++) + { + LANGLIST *t = LIST_DATA(o, i); + wchar_t tmp[MAX_SIZE]; + wchar_t tmp2[MAX_SIZE]; + + UniFormat(tmp, sizeof(tmp), L"(%s)", t->TitleLocal); + UniFormat(tmp2, sizeof(tmp2), L" %s", t->TitleEnglish); + + LvInsertAdd(b, SwGetLangIcon(t->Name), (void *)(t->Id + 1), 2, tmp2, tmp); + + if (t->Id == current_lang) + { + select_index = i; + } + } + + LvInsertEnd(b, hWnd, L_LIST); + + if (sw->CurrentComponent == NULL) + { + LvSelectByParam(hWnd, L_LIST, default_select); + } + else + { + LvSelectByParam(hWnd, L_LIST, sw->CurrentComponent); + } + + LvAutoSize(hWnd, L_LIST); + + FreeLangList(o); + + if (select_index != INFINITE) + { + LvSelect(hWnd, L_LIST, select_index); + } + + LvSort(hWnd, L_LIST, 0, false); + + Focus(hWnd, L_LIST); + + // Show the current language + if (true) + { + LANGLIST t; + wchar_t tmp[MAX_SIZE]; + + Zero(&t, sizeof(t)); + GetCurrentLang(&t); + + UniFormat(tmp, sizeof(tmp), L"%s (%s)", t.TitleEnglish, t.TitleLocal); + + SetText(hWnd, E_CURRENT, tmp); + + if (MsIsVista()) + { + SetFont(hWnd, E_CURRENT, GetMeiryoFontEx(11)); + } + else + { + DlgFont(hWnd, E_CURRENT, 11, false); + } + } +} + +// Update of control +void SwLang1Update(HWND hWnd, SW *sw, WIZARD *wizard, WIZARD_PAGE *wizard_page) +{ + UINT id; + // Validate arguments + if (hWnd == NULL || sw == NULL || wizard == NULL || wizard_page == NULL) + { + return; + } + + id = (UINT)LvGetSelectedParam(hWnd, L_LIST); + + if (id == 0) + { + SetWizardButtonEx(wizard_page, false, false, true, false, (MsIsAdmin() == false && sw->IsSystemMode)); + } + else + { + SetWizardButtonEx(wizard_page, true, false, true, false, (MsIsAdmin() == false && sw->IsSystemMode)); + } +} + +// Language setting screen +UINT SwLang1(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, WIZARD *wizard, WIZARD_PAGE *wizard_page, void *param) +{ + SW *sw = (SW *)param; + NMHDR *n; + UINT id; + // Validate arguments + if (hWnd == NULL || sw == NULL) + { + return 0; + } + + switch (msg) + { + case WM_INITDIALOG: + LvInitEx2(hWnd, L_LIST, false, true); + + if (MsIsVista()) + { + SetFont(hWnd, L_LIST, GetMeiryoFontEx(12)); + } + else + { + DlgFont(hWnd, L_LIST, 12, false); + } + + LvInsertColumn(hWnd, L_LIST, 0, L"English Name", 250); + LvInsertColumn(hWnd, L_LIST, 1, L"Local Name", 250); + + SwLang1Update(hWnd, sw, wizard, wizard_page); + break; + + case WM_WIZ_SHOW: + SetWizardButtonEx(wizard_page, true, false, true, false, (MsIsAdmin() == false && sw->IsSystemMode)); + + SwLang1Init(hWnd, sw); + + SwLang1Update(hWnd, sw, wizard, wizard_page); + break; + + case WM_WIZ_HIDE: + break; + + case WM_CLOSE: + break; + + case WM_WIZ_NEXT: + if (SwEnterSingle(sw) == false) + { + // Multiple-starts prevention + MsgBox(hWnd, MB_ICONINFORMATION, _UU("SW_OTHER_INSTANCE_EXISTS")); + break; + } + + if (MsIsNt() == false) + { + // Win9x + MsgBox(hWnd, MB_ICONSTOP, + L"Windows 9x / Me doesn't support multi-language switcing.\r\n\r\nIf you want to switch to another language, please use Windows NT 4.0, 2000 or greater."); + break; + } + + // Get the current selection + id = (UINT)LvGetSelectedParam(hWnd, L_LIST); + if (id != 0) + { + id--; + + if (id == GetCurrentLangId()) + { + // No change + sw->LangNotChanged = true; + + sw->ExitCode = 0; + + return D_SW_ERROR; + } + else + { + wchar_t add_param[MAX_SIZE]; + LIST *o; + LANGLIST *new_lang; + LANGLIST old_lang; + char new_lang_name[MAX_SIZE]; + char old_lang_name[MAX_SIZE]; + + GetCurrentLang(&old_lang); + + o = LoadLangList(); + + if (o == NULL) + { + MsgBox(hWnd, MB_ICONSTOP, _UU("SW_LANG_LIST_LOAD_FAILED")); + break; + } + + new_lang = GetLangById(o, id); + + if (new_lang == NULL) + { + MsgBox(hWnd, MB_ICONSTOP, _UU("SW_LANG_LIST_LOAD_FAILED")); + FreeLangList(o); + break; + } + + StrCpy(new_lang_name, sizeof(new_lang_name), new_lang->Name); + StrCpy(old_lang_name, sizeof(old_lang_name), old_lang.Name); + + FreeLangList(o); + + UniFormat(add_param, sizeof(add_param), L"/LANGID:%u", id); + + if (sw->DoubleClickBlocker) + { + break; + } + + sw->DoubleClickBlocker = true; + + sw->LangId = id; + + if (sw->IsSystemMode == false) + { +LABEL_RUN_CHILD_PROCESS: + // Start the process immediately in the case of user mode + if (SaveLangConfigCurrentDir(new_lang_name) == false) + { + sw->DoubleClickBlocker = false; + MsgBox(hWnd, MB_ICONSTOP, _UU("SW_LANG_SET_FAILED")); + break; + } + + UniStrCat(add_param, sizeof(add_param), L" /LANGNOW:yes"); + if (SwReExecMyself(sw, add_param, false)) + { + // Terminate itself if it succeeds to start the child process + CloseWizard(wizard_page); + break; + } + else + { + // Child process startup failure + sw->DoubleClickBlocker = false; + + // Undo the language setting + SaveLangConfigCurrentDir(old_lang_name); + break; + } + } + + // In the case of system mode + if (MsIsAdmin() == false) + { + if (MsIsVista()) + { + if (sw->IsReExecForUac == false) + { + // If there is no Admin privileges in Vista or later, attempt to acquire Admin rights by UAC first during the first run + UniStrCat(add_param, sizeof(add_param), L" /SETLANGANDREBOOT:true"); + + if (SwReExecMyself(sw, add_param, true)) + { + // Terminate itself if it succeeds to start the child process + CloseWizard(wizard_page); + break; + } + else + { + // Do nothing if it fails to start in the UAC + sw->DoubleClickBlocker = false; + break; + } + } + else + { + // If no Admin privileges after being started by the UAC, jump to the guidance screen indicating it is not Admin + return D_SW_NOT_ADMIN; + } + } + else + { + // Jump to guide screen indicating that it is not the Admin in the case of XP or earlier + return D_SW_NOT_ADMIN; + } + } + else + { + // Start the process if there is a Admin privileges + goto LABEL_RUN_CHILD_PROCESS; + } + } + } + break; + + case WM_WIZ_BACK: + break; + + case WM_COMMAND: + switch (wParam) + { + } + break; + + case WM_NOTIFY: + n = (NMHDR *)lParam; + + switch (n->idFrom) + { + case L_LIST: + switch (n->code) + { + case LVN_ITEMCHANGED: + SwLang1Update(hWnd, sw, wizard, wizard_page); + break; + } + break; + } + + break; + } + + return 0; +} + +// Start the uninstallation +UINT SwUninst1(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, WIZARD *wizard, WIZARD_PAGE *wizard_page, void *param) +{ + SW *sw = (SW *)param; + // Validate arguments + if (hWnd == NULL || sw == NULL) + { + return 0; + } + + switch (msg) + { + case WM_INITDIALOG: + FormatText(hWnd, S_TITLE, sw->CurrentComponent->Title); + FormatText(hWnd, S_WELCOME, sw->CurrentComponent->Title); + break; + + case WM_WIZ_SHOW: + DlgFont(hWnd, S_TITLE, 11, true); + SetWizardButtonEx(wizard_page, true, false, true, false, sw->IsSystemMode); + + sw->DoubleClickBlocker = false; + + break; + + case WM_WIZ_HIDE: + break; + + case WM_CLOSE: + break; + + case WM_WIZ_NEXT: + if (MsgBoxEx(hWnd, MB_ICONQUESTION | MB_YESNO | MB_DEFBUTTON2, _UU("SW_UNINSTALL_CONFIRM"), + sw->CurrentComponent->Title) == IDNO) + { + break; + } + + if (SwEnterSingle(sw) == false) + { + // Multiple-starts prevention + MsgBox(hWnd, MB_ICONINFORMATION, _UU("SW_OTHER_INSTANCE_EXISTS")); + break; + } + + if (sw->DoubleClickBlocker) + { + break; + } + + sw->DoubleClickBlocker = true; + + if (sw->IsSystemMode == false) + { + // Start uninstallation immediately in the case of user mode + return D_SW_PERFORM; + } + + // In the case of system mode + if (MsIsAdmin() == false) + { + if (MsIsVista()) + { + if (sw->IsReExecForUac == false) + { + // If there is no Admin privileges in Vista or later, attempt to acquire Admin rights by UAC first during the first run + if (SwReExecMyself(sw, NULL, true)) + { + // Terminate itself if it succeeds to start the child process + CloseWizard(wizard_page); + break; + } + else + { + // If fail to run in UAC, jump to guide screen indicating that it is not Admin + return D_SW_NOT_ADMIN; + } + } + else + { + // If no Admin privileges after being started by the UAC, jump to the guidance screen indicating it is not Admin + return D_SW_NOT_ADMIN; + } + } + else + { + // Jump to guide screen indicating that it is not the Admin in the case of XP or earlier + return D_SW_NOT_ADMIN; + } + } + else + { + // Start the uninstallation if it has Admin privileges + return D_SW_PERFORM; + } + break; + + case WM_WIZ_BACK: + break; + + case WM_COMMAND: + switch (wParam) + { + } + break; + } + + return 0; +} + +// Completion screen +UINT SwFinish(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, WIZARD *wizard, WIZARD_PAGE *wizard_page, void *param) +{ + SW *sw = (SW *)param; + char tmp[MAX_SIZE]; + // Validate arguments + if (hWnd == NULL || sw == NULL) + { + return 0; + } + + switch (msg) + { + case WM_INITDIALOG: + if (sw->EasyMode) + { + SetIcon(hWnd, S_ICON, ICO_SETUP); + } + else if (sw->WebMode) + { + SetIcon(hWnd, S_ICON, ICO_INTERNET); + } + else + { + FormatText(hWnd, S_INFO, sw->CurrentComponent->Title); + SetIcon(hWnd, S_ICON, sw->CurrentComponent->Icon); + } + + wizard->CloseConfirmMsg = NULL; + + sw->ExitCode = 0; + break; + + case WM_WIZ_SHOW: + if (UniIsEmptyStr(sw->FinishMsg) == false) + { + SetText(hWnd, S_INFO, sw->FinishMsg); + } + + SetWizardButton(wizard_page, true, false, false, true); + + if (sw->HideStartCommand || sw->UninstallMode || sw->LanguageMode || sw->EasyMode || sw->WebMode || UniIsEmptyStr(sw->CurrentComponent->StartExeName)) + { + Hide(hWnd, B_RUN); + sw->Run = false; + } + else + { + SetText(hWnd, B_RUN, sw->CurrentComponent->StartDescription); + Show(hWnd, B_RUN); + Format(tmp, sizeof(tmp), "UI_NoCheck_%s_%u", sw->CurrentComponent->Name, sw->IsSystemMode); + Check(hWnd, B_RUN, !MsRegReadInt(REG_CURRENT_USER, SW_REG_KEY, tmp)); + sw->Run = IsChecked(hWnd, B_RUN); + } + break; + + case WM_WIZ_HIDE: + break; + + case WM_CLOSE: + break; + + case WM_WIZ_NEXT: + break; + + case WM_WIZ_BACK: + break; + + case WM_COMMAND: + switch (wParam) + { + case B_RUN: + if (sw->HideStartCommand || sw->UninstallMode || sw->LanguageMode || sw->EasyMode || sw->WebMode || UniIsEmptyStr(sw->CurrentComponent->StartExeName)) + { + } + else + { + Format(tmp, sizeof(tmp), "UI_NoCheck_%s_%u", sw->CurrentComponent->Name, sw->IsSystemMode); + sw->Run = IsChecked(hWnd, B_RUN); + MsRegWriteInt(REG_CURRENT_USER, SW_REG_KEY, tmp, !sw->Run); + } + break; + } + break; + } + + return 0; +} + +// Error occurring screen +UINT SwError(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, WIZARD *wizard, WIZARD_PAGE *wizard_page, void *param) +{ + SW *sw = (SW *)param; + // Validate arguments + if (hWnd == NULL || sw == NULL) + { + return 0; + } + + switch (msg) + { + case WM_INITDIALOG: + wizard->CloseConfirmMsg = NULL; + + if (sw->EasyMode) + { + SetText(hWnd, S_INFO, _UU("SW_EASY_ERROR_MSG")); + } + else if (sw->WebMode) + { + SetText(hWnd, S_INFO, _UU("SW_WEB_ERROR_MSG")); + } + else + { + FormatText(hWnd, S_INFO, sw->CurrentComponent->Title); + } + + if (sw->MsiRebootRequired) + { + // MSI requires a reboot + wchar_t tmp[MAX_SIZE]; + + SetIcon(hWnd, S_ICON, ICO_INFORMATION); + + UniFormat(tmp, sizeof(tmp), _UU("SW_MSI_UNINSTALL_REBOOT_REQUIRED"), sw->CurrentComponent->Title); + + SetText(hWnd, S_INFO, tmp); + } + + if (sw->LangNotChanged) + { + // Language has not changed + wchar_t tmp[MAX_SIZE]; + + SetIcon(hWnd, S_ICON, ICO_INFORMATION); + + UniFormat(tmp, sizeof(tmp), _UU("SW_LANG_NOT_CHANGED"), sw->CurrentComponent->Title); + + SetText(hWnd, S_INFO, tmp); + } + + break; + + case WM_WIZ_SHOW: + SetWizardButton(wizard_page, true, false, false, true); + break; + + case WM_WIZ_HIDE: + break; + + case WM_CLOSE: + break; + + case WM_WIZ_NEXT: + break; + + case WM_WIZ_BACK: + break; + + case WM_COMMAND: + switch (wParam) + { + } + break; + } + + return 0; +} + +// Execution thread of the setup process +void SwPerformThread(THREAD *thread, void *param) +{ + WIZARD_PAGE *wp = (WIZARD_PAGE *)param; + SW *sw; + SW_COMPONENT *c; + bool ret; + SW_UI ui; + // Validate arguments + if (thread == NULL || param == NULL) + { + return; + } + + sw = (SW *)wp->Wizard->Param; + + sw->ExitCode = SW_EXIT_CODE_INTERNAL_ERROR; + + // Components to be installed + c = sw->CurrentComponent; + + if (sw->EasyMode) + { + // Create a simple installer + ret = SwEasyMain(sw, wp); + } + else if (sw->WebMode) + { + // Create a Web installer + ret = SwWebMain(sw, wp); + } + else if (sw->UninstallMode == false) + { + // Installation + ret = SwInstallMain(sw, wp, c); + } + else + { + // Uninstallation + ret = SwUninstallMain(sw, wp, c); + } + + // Notify the results to the window + Zero(&ui, sizeof(ui)); + ui.Type = (ret ? SW_UI_TYPE_FINISH : SW_UI_TYPE_ERROR); + SwInteractUi(wp, &ui); +} + +// Create a file copy task +SW_TASK_COPY *SwNewCopyTask(wchar_t *srcfilename, wchar_t *dstfilename, wchar_t *srcdir, wchar_t *dstdir, bool overwrite, bool setup_file) +{ + SW_TASK_COPY *ct; + // Validate arguments + if (srcfilename == NULL || srcdir == NULL || dstdir == NULL) + { + return NULL; + } + + ct = ZeroMalloc(sizeof(SW_TASK_COPY)); + + UniStrCpy(ct->SrcFileName, sizeof(ct->SrcFileName), srcfilename); + + if (UniIsEmptyStr(dstfilename)) + { + UniStrCpy(ct->DstFileName, sizeof(ct->DstFileName), srcfilename); + } + else + { + UniStrCpy(ct->DstFileName, sizeof(ct->DstFileName), dstfilename); + } + + UniStrCpy(ct->SrcDir, sizeof(ct->SrcDir), srcdir); + UniStrCpy(ct->DstDir, sizeof(ct->DstDir), dstdir); + + ct->Overwrite = overwrite; + ct->SetupFile = setup_file; + + return ct; +} + +// Release the file copy task +void SwFreeCopyTask(SW_TASK_COPY *ct) +{ + // Validate arguments + if (ct == NULL) + { + return; + } + + Free(ct); +} + +// Create a link creation task +SW_TASK_LINK *SwNewLinkTask(wchar_t *target_dir, wchar_t *target_exe, wchar_t *target_arg, + wchar_t *icon_exe, UINT icon_index, + wchar_t *dest_dir, wchar_t *dest_name, wchar_t *dest_desc, + bool no_delete_dir) +{ + SW_TASK_LINK *lt; + // Validate arguments + if (target_dir == NULL || target_exe == NULL || dest_dir == NULL || dest_name == NULL) + { + return NULL; + } + + lt = ZeroMalloc(sizeof(SW_TASK_LINK)); + + UniStrCpy(lt->TargetDir, sizeof(lt->TargetDir), target_dir); + UniStrCpy(lt->TargetExe, sizeof(lt->TargetExe), target_exe); + UniStrCpy(lt->TargetArg, sizeof(lt->TargetArg), target_arg); + + if (UniIsEmptyStr(icon_exe) == false) + { + UniStrCpy(lt->IconExe, sizeof(lt->IconExe), icon_exe); + } + else + { + UniStrCpy(lt->IconExe, sizeof(lt->IconExe), target_exe); + } + + lt->IconIndex = icon_index; + + UniStrCpy(lt->DestDir, sizeof(lt->DestDir), dest_dir); + UniStrCpy(lt->DestName, sizeof(lt->DestName), dest_name); + UniStrCpy(lt->DestDescription, sizeof(lt->DestDescription), dest_desc); + + lt->NoDeleteDir = no_delete_dir; + + return lt; +} + +// Release the link creation task +void SwFreeLinkTask(SW_TASK_LINK *lt) +{ + // Validate arguments + if (lt == NULL) + { + return; + } + + Free(lt); +} + +// Create a Setup task +SW_TASK *SwNewTask() +{ + SW_TASK *t = ZeroMalloc(sizeof(SW_TASK)); + + t->CopyTasks = NewListFast(NULL); + + t->SetSecurityPaths = NewListFast(NULL); + + t->LinkTasks = NewListFast(NULL); + + return t; +} + +// Release the Setup Tasks +void SwFreeTask(SW_TASK *t) +{ + UINT i; + // Validate arguments + if (t == NULL) + { + return; + } + + for (i = 0;i < LIST_NUM(t->CopyTasks);i++) + { + SW_TASK_COPY *ct = LIST_DATA(t->CopyTasks, i); + + SwFreeCopyTask(ct); + } + + ReleaseList(t->CopyTasks); + + FreeStrList(t->SetSecurityPaths); + + for (i = 0;i < LIST_NUM(t->LinkTasks);i++) + { + SW_TASK_LINK *lt = LIST_DATA(t->LinkTasks, i); + + SwFreeLinkTask(lt); + } + + ReleaseList(t->LinkTasks); + + Free(t); +} + +// Delete the shortcut file +void SwDeleteShortcuts(SW_LOGFILE *logfile) +{ + UINT i; + LIST *o; + // Validate arguments + if (logfile == NULL) + { + return; + } + + o = NewListFast(NULL); + + for (i = 0;i < LIST_NUM(logfile->LogList);i++) + { + SW_LOG *g = LIST_DATA(logfile->LogList, LIST_NUM(logfile->LogList) - i - 1); + + switch (g->Type) + { + case SW_LOG_TYPE_LNK: + FileDeleteW(g->Path); + Add(o, g); + break; + + case SW_LOG_TYPE_LNK_DIR: + SleepThread(100); + DeleteDirW(g->Path); + Add(o, g); + break; + } + } + + for (i = 0;i < LIST_NUM(o);i++) + { + SW_LOG *g = LIST_DATA(o, i); + + Delete(logfile->LogList, g); + + Free(g); + } + + ReleaseList(o); +} + +// Uninstall main +bool SwUninstallMain(SW *sw, WIZARD_PAGE *wp, SW_COMPONENT *c) +{ + bool ok; + wchar_t tmp[MAX_SIZE]; + UINT i; + // Validate arguments + if (sw == NULL || wp == NULL || c == NULL) + { + return false; + } + + SwPerformPrint(wp, _UU("SW_PERFORM_MSG_INIT_UNINST")); + + // Stop the Service + ok = true; + + if (c->InstallService) + { + char svc_title_name[MAX_SIZE]; + wchar_t *svc_title; + + Format(svc_title_name, sizeof(svc_title_name), "SVC_%s_TITLE", c->SvcName); + + svc_title = _UU(svc_title_name); + + if (UniIsEmptyStr(svc_title) == false) + { + if (sw->IsSystemMode && MsIsNt()) + { + // WinNT and system mode + if (MsIsServiceRunning(c->SvcName)) + { + wchar_t svc_exe[MAX_SIZE]; + UINT64 giveup_tick; + UniFormat(tmp, sizeof(tmp), _UU("SW_PERFORM_MSG_STOP_SVC"), svc_title); + SwPerformPrint(wp, tmp); + +LABEL_RETRY_3: + if (MsStopService(c->SvcName) == false) + { + UniFormat(tmp, sizeof(tmp), _UU("SW_PERFORM_MSG_STOP_SVC_ERROR"), svc_title, c->SvcName); + if (SwPerformMsgBox(wp, MB_ICONEXCLAMATION | MB_RETRYCANCEL, tmp) != IDRETRY) + { + // Cancel + ok = false; + } + else + { + if (MsIsServiceRunning(c->SvcName)) + { + goto LABEL_RETRY_3; + } + } + } + + // Wait 5 seconds if stop the service + SleepThread(5000); + + // Wait until the EXE file for the service become ready to write + ConbinePathW(svc_exe, sizeof(svc_exe), sw->InstallDir, c->SvcFileName); + + giveup_tick = Tick64() + (UINT64)10000; + while (IsFileWriteLockedW(svc_exe)) + { + UniFormat(tmp, sizeof(tmp), _UU("SW_PERFORM_MSG_WAIT_FOR_FILE_UNLOCK"), svc_exe); + SwPerformPrint(wp, tmp); + + SleepThread(100); + + if (Tick64() >= giveup_tick) + { + break; + } + } + } + } + else + { + // Win9x or user mode + wchar_t svc_exe[MAX_SIZE]; + UINT64 giveup_tick; + + // Stop the Service + MsStopUserModeSvc(c->SvcName); + SleepThread(3000); + + // Wait until the EXE file for the service become ready to write + ConbinePathW(svc_exe, sizeof(svc_exe), sw->InstallDir, c->SvcFileName); + + giveup_tick = Tick64() + (UINT64)10000; + while (IsFileWriteLockedW(svc_exe)) + { + UniFormat(tmp, sizeof(tmp), _UU("SW_PERFORM_MSG_WAIT_FOR_FILE_UNLOCK"), svc_exe); + SwPerformPrint(wp, tmp); + + SleepThread(100); + + if (Tick64() >= giveup_tick) + { + break; + } + } + } + } + } + + if (ok == false) + { + goto LABEL_CLEANUP; + } + + // Examine preliminary whether the files to be deleted can be written successfully + ok = true; + + SwPerformPrint(wp, _UU("SW_PERFORM_MSG_DELETE_PREPARE")); + + for (i = 0;i < LIST_NUM(sw->LogFile->LogList);i++) + { + SW_LOG *g = LIST_DATA(sw->LogFile->LogList, i); + + if (g->Type == SW_LOG_TYPE_FILE) + { + wchar_t fullpath[MAX_SIZE]; + IO *io; + bool write_ok; + bool new_file; + +LABEL_RETRY_1: + write_ok = new_file = false; + + UniStrCpy(fullpath, sizeof(fullpath), g->Path); + + // If the process with the same name is running, kill it + if (MsKillProcessByExeName(fullpath) != 0) + { + // Wait for 1 second if kill the process + SleepThread(1000); + } + + // Writing check + io = FileOpenExW(fullpath, true, true); + if (io == NULL) + { + io = FileCreateW(fullpath); + new_file = true; + } + if (io != NULL) + { + // Writing OK + write_ok = true; + + FileCloseEx(io, true); + + if (new_file) + { + FileDeleteW(fullpath); + } + } + + if (write_ok == false) + { + // Show an error message if it fails + UniFormat(tmp, sizeof(tmp), _UU("SW_PERFORM_MSG_DELETE_ERROR"), fullpath, c->Title); + if (SwPerformMsgBox(wp, MB_ICONEXCLAMATION | MB_RETRYCANCEL, tmp) != IDRETRY) + { + // Cancel + ok = false; + break; + } + else + { + // Retry + goto LABEL_RETRY_1; + } + } + } + } + + if (ok == false) + { + goto LABEL_CLEANUP; + } + + // Delete the service + if (c->InstallService) + { + char svc_title_name[MAX_SIZE]; + char svc_description_name[MAX_SIZE]; + wchar_t *svc_title; + + Format(svc_title_name, sizeof(svc_title_name), "SVC_%s_TITLE", c->SvcName); + Format(svc_description_name, sizeof(svc_description_name), "SVC_%s_DESCRIPT", c->SvcName); + + svc_title = _UU(svc_title_name); + + if (UniIsEmptyStr(svc_title) == false) + { + if (sw->IsSystemMode == false || MsIsNt() == false) + { + // Win9x or user mode + if (MsIsNt() == false) + { + // Remove the Run key from the registry for Win9x + MsRegDeleteValue(REG_LOCAL_MACHINE, WIN9X_SVC_REGKEY_1, c->SvcName); + MsRegDeleteValue(REG_LOCAL_MACHINE, WIN9X_SVC_REGKEY_2, c->SvcName); + } + } + else + { + // System mode + UniFormat(tmp, sizeof(tmp), _UU("SW_PERFORM_MSG_UNINSTALL_SVC"), svc_title); + SwPerformPrint(wp, tmp); + +LABEL_RETRY_4: + + if (MsIsServiceInstalled(c->SvcName)) + { + // Stop the service if it is running by any chance + MsStopService(c->SvcName); + } + + if (MsIsServiceInstalled(c->SvcName)) + { + // Uninstall the service + if (MsUninstallService(c->SvcName) == false) + { + // Show an error message if it fails + UniFormat(tmp, sizeof(tmp), _UU("SW_PERFORM_MSG_SVC_UNINSTALL_FAILED"), svc_title, c->SvcName); + if (SwPerformMsgBox(wp, MB_ICONEXCLAMATION | MB_RETRYCANCEL, tmp) != IDRETRY) + { + // Cancel + ok = false; + } + else + { + // Retry + goto LABEL_RETRY_4; + } + } + } + } + } + } + + // Delete the shortcut + SwPerformPrint(wp, _UU("SW_PERFORM_MSG_DELETE_LINKS")); + SwDeleteShortcuts(sw->LogFile); + + // Delete the registry, files, and directories + for (i = 0;i < LIST_NUM(sw->LogFile->LogList);i++) + { + SW_LOG *g = LIST_DATA(sw->LogFile->LogList, LIST_NUM(sw->LogFile->LogList) - i - 1); + char tmpa[MAX_SIZE]; + + UniFormat(tmp, sizeof(tmp), _UU("SW_PERFORM_MSG_DELETE"), g->Path); + + switch (g->Type) + { + case SW_LOG_TYPE_FILE: // File + SwPerformPrint(wp, tmp); + FileDeleteW(g->Path); + break; + + case SW_LOG_TYPE_DIR: // Directory + SwPerformPrint(wp, tmp); + SleepThread(100); + DeleteDirW(g->Path); + break; + + case SW_LOG_TYPE_REGISTRY: // Registry + SwPerformPrint(wp, tmp); + UniToStr(tmpa, sizeof(tmpa), g->Path); + MsRegDeleteKeyEx2(REG_LOCAL_MACHINE, tmpa, false, true); + break; + } + } + + // Remove the installed build number from the registry + if (true) + { + char keyname[MAX_SIZE]; + Format(keyname, sizeof(keyname), "%s\\%s", SW_REG_KEY, sw->CurrentComponent->Name); + MsRegDeleteValueEx2(sw->IsSystemMode ? REG_LOCAL_MACHINE : REG_CURRENT_USER, + keyname, "InstalledBuild", false, true); + } + + // Remove the EULA agreement record + MsRegDeleteValueEx2(REG_CURRENT_USER, SW_REG_KEY_EULA, sw->CurrentComponent->Name, false, true); + + SwPerformPrint(wp, _UU("SW_PERFORM_MSG_DELETE_SETUP_INFO")); + + if (c->Id == SW_CMP_VPN_CLIENT) + { + // Remove the UI Helper + MsRegDeleteValueEx2(REG_LOCAL_MACHINE, "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Run", + SW_VPN_CLIENT_UIHELPER_REGVALUE, false, true); + } + + // Remove the installation directory from the registry + if (true) + { + // Remove the installed directory from the registry + char keyname[MAX_SIZE]; + Format(keyname, sizeof(keyname), "%s\\%s", SW_REG_KEY, sw->CurrentComponent->Name); + MsRegDeleteKeyEx2(sw->IsSystemMode ? REG_LOCAL_MACHINE : REG_CURRENT_USER, keyname, false, true); + } + + // Delete the setuplog.dat + if (true) + { + wchar_t setuplog[MAX_PATH]; + + ConbinePathW(setuplog, sizeof(setuplog), MsGetExeDirNameW(), L"setuplog.dat"); + + FileDeleteW(setuplog); + } + + // Delete the existing Virtual Network Adapters + // Currently disabled because of 32bit/64bit problems +#if 0 + if (c->Id == SW_CMP_VPN_CLIENT) + { + if (MsIsNt()) + { + if (!(MsIs64BitWindows() && Is32())) + { + UINT i; + TOKEN_LIST *t; + + SwPerformPrint(wp, _UU("SW_PERFORM_MSG_DELETE_NIC")); + + // Enumeration + t = MsEnumNetworkAdapters(VLAN_ADAPTER_NAME, VLAN_ADAPTER_NAME_OLD); + if (t != NULL) + { + if (t->NumTokens >= 1) + { + if (SwPerformMsgBox(wp, MB_ICONQUESTION | MB_YESNO | MB_DEFBUTTON2, _UU("SW_PERFORM_MSG_DELETE_NIC")) == IDYES) + { + for (i = 0;i < t->NumTokens;i++) + { + char *name = t->Token[i]; + + MsUninstallVLan(name); + } + } + } + + FreeToken(t); + } + } + } + } +#endif + + SwPerformPrint(wp, _UU("SW_PERFORM_MSG_UPDATING")); + + // Notify the update to the system + MsUpdateSystem(); + + // Completion message + SwPerformPrint(wp, _UU("SW_PERFORM_MSG_FINISHED")); + + if (ok == false) + { + goto LABEL_CLEANUP; + } + +LABEL_CLEANUP: + + return ok; +} + +// Create a Task List +void SwDefineTasks(SW *sw, SW_TASK *t, SW_COMPONENT *c) +{ + wchar_t tmp[MAX_SIZE]; + wchar_t src_setup_exe_fullpath[MAX_PATH]; + wchar_t src_setup_exe_dir[MAX_PATH]; + wchar_t src_setup_exe_filename[MAX_PATH]; + wchar_t dir_desktop[MAX_PATH]; + wchar_t dir_startmenu[MAX_PATH]; + wchar_t dir_program[MAX_PATH]; + wchar_t dir_app_program[MAX_PATH]; + wchar_t dir_config_program[MAX_PATH]; + wchar_t dir_admin_tools[MAX_PATH]; + wchar_t dir_config_language[MAX_PATH]; + wchar_t dir_startup[MAX_PATH]; + wchar_t tmp1[MAX_SIZE], tmp2[MAX_SIZE]; + SW_TASK_COPY *setup_exe; + // Validate arguments + if (sw == NULL || t == NULL || c == NULL) + { + return; + } + + //// Organize directory name for creating shortcut + // Desktop + UniStrCpy(dir_desktop, sizeof(dir_desktop), (sw->IsSystemMode ? MsGetCommonDesktopDirW() : MsGetPersonalDesktopDirW())); + // Start menu + UniStrCpy(dir_startmenu, sizeof(dir_startmenu), (sw->IsSystemMode ? MsGetCommonStartMenuDirW() : MsGetPersonalStartMenuDirW())); + // Program + UniStrCpy(dir_program, sizeof(dir_program), (sw->IsSystemMode ? MsGetCommonProgramsDirW() : MsGetPersonalProgramsDirW())); + // Program directory for this application + ConbinePathW(dir_app_program, sizeof(dir_app_program), dir_program, c->LongName); + if (sw->IsSystemMode == false) + { + // User mode + UniStrCat(dir_app_program, sizeof(dir_app_program), _UU("SW_TAG_USERNAME")); + } + // Configuration tool directory + ConbinePathW(dir_config_program, sizeof(dir_config_program), dir_app_program, _UU("SW_DIRNAME_CONFIG_TOOLS")); + // Language configuration directory + ConbinePathW(dir_config_language, sizeof(dir_config_language), dir_app_program, _UU("SW_DIRNAME_LANGUAGE_TOOLS")); + // Directory for System administrator tool + ConbinePathW(dir_admin_tools, sizeof(dir_admin_tools), dir_app_program, _UU("SW_DIRNAME_ADMIN_TOOLS")); + // Startup + UniStrCpy(dir_startup, sizeof(dir_startup), (sw->IsSystemMode ? MsGetCommonStartupDirW() : MsGetPersonalStartupDirW())); + + // Get the path information related to vpnsetup.exe + UniStrCpy(src_setup_exe_fullpath, sizeof(src_setup_exe_fullpath), MsGetExeFileNameW()); + GetDirNameFromFilePathW(src_setup_exe_dir, sizeof(src_setup_exe_dir), src_setup_exe_fullpath); + GetFileNameFromFilePathW(src_setup_exe_filename, sizeof(src_setup_exe_filename), src_setup_exe_fullpath); + + // Add the Setup program (themselves) to the copy list + Add(t->CopyTasks, (setup_exe = SwNewCopyTask(src_setup_exe_filename, + L"vpnsetup.exe", src_setup_exe_dir, sw->InstallDir, true, true))); + + // Generate the file processing list for each component + if (c->Id == SW_CMP_VPN_SERVER) + { + // VPN Server + SW_TASK_COPY *ct; + SW_TASK_COPY *vpnserver, *vpncmd, *vpnsmgr; + + CombinePathW(tmp, sizeof(tmp), sw->InstallDir, L"backup.vpn_server.config"); + Add(t->SetSecurityPaths, CopyUniStr(tmp)); + + vpnserver = SwNewCopyTask(L"vpnserver.exe", NULL, sw->InstallSrc, sw->InstallDir, true, false); + vpncmd = SwNewCopyTask(L"vpncmd.exe", NULL, sw->InstallSrc, sw->InstallDir, true, false); + vpnsmgr = SwNewCopyTask(L"vpnsmgr.exe", NULL, sw->InstallSrc, sw->InstallDir, true, false); + + Add(t->CopyTasks, vpnserver); + Add(t->CopyTasks, vpncmd); + Add(t->CopyTasks, vpnsmgr); + + Add(t->CopyTasks, (ct = SwNewCopyTask(L"|empty.config", L"vpn_server.config", sw->InstallSrc, sw->InstallDir, false, false))); + Add(t->CopyTasks, SwNewCopyTask(L"|backup_dir_readme.txt", L"readme.txt", sw->InstallSrc, tmp, false, false)); + + CombinePathW(tmp, sizeof(tmp), ct->DstDir, ct->DstFileName); + Add(t->SetSecurityPaths, CopyUniStr(tmp)); + + //// Definition of the shortcuts + // Desktop and Start menu + Add(t->LinkTasks, SwNewLinkTask(sw->InstallDir, vpnsmgr->DstFileName, NULL, NULL, 0, dir_desktop, + _UU(sw->IsSystemMode ? "SW_LINK_NAME_VPNSMGR_SHORT" : "SW_LINK_NAME_VPNSMGR_SHORT_UM"), + _UU("SW_LINK_NAME_VPNSMGR_COMMENT"), true)); + Add(t->LinkTasks, SwNewLinkTask(sw->InstallDir, vpnsmgr->DstFileName, NULL, NULL, 0, dir_startmenu, + _UU(sw->IsSystemMode ? "SW_LINK_NAME_VPNSMGR_SHORT" : "SW_LINK_NAME_VPNSMGR_SHORT_UM"), + _UU("SW_LINK_NAME_VPNSMGR_COMMENT"), true)); + + // Programs\PacketiX VPN Server + Add(t->LinkTasks, SwNewLinkTask(sw->InstallDir, vpnsmgr->DstFileName, NULL, NULL, 0, dir_app_program, + _UU("SW_LINK_NAME_VPNSMGR_FULL"), + _UU("SW_LINK_NAME_VPNSMGR_COMMENT"), false)); + Add(t->LinkTasks, SwNewLinkTask(sw->InstallDir, vpncmd->DstFileName, NULL, NULL, 0, dir_app_program, + _UU("SW_LINK_NAME_VPNCMD"), + _UU("SW_LINK_NAME_VPNCMD_COMMENT"), false)); + Add(t->LinkTasks, SwNewLinkTask(sw->InstallDir, vpnserver->DstFileName, L"/traffic", L"vpnsetup.exe", 2, dir_admin_tools, + _UU("SW_LINK_NAME_TRAFFIC"), + _UU("SW_LINK_NAME_TRAFFIC_COMMENT"), false)); + + // Programs\PacketiX VPN Server\Configuration tool + Add(t->LinkTasks, SwNewLinkTask(sw->InstallDir, vpnserver->DstFileName, L"/tcp", L"vpnsetup.exe", 3, dir_config_program, + _UU("SW_LINK_NAME_TCP"), + _UU("SW_LINK_NAME_TCP_COMMENT"), false)); + + if (MsIsWin2000OrGreater()) + { + Add(t->LinkTasks, SwNewLinkTask(MsGetSystem32DirW(), L"services.msc", NULL, L"filemgmt.dll", 0, dir_config_program, + _UU("SW_LINK_NAME_SERVICES"), + _UU("SW_LINK_NAME_SERVICES_COMMENT"), false)); + + if (sw->IsSystemMode) + { + // Debugging information collecting tool + Add(t->LinkTasks, SwNewLinkTask(sw->InstallDir, vpncmd->DstFileName, L"/debug", L"vpnsetup.exe", 4, dir_admin_tools, + _UU("SW_LINK_NAME_DEBUG"), + _UU("SW_LINK_NAME_DEBUG_COMMENT"), false)); + } + } + + if (sw->IsSystemMode == false) + { + // Register to the start-up in the case of user mode + Add(t->LinkTasks, SwNewLinkTask(sw->InstallDir, vpnserver->DstFileName, L"/usermode", NULL, 0, dir_startup, + _UU("SW_LINK_NAME_VPNSERVER_SVC"), + _UU("SW_LINK_NAME_VPNSERVER_SVC_COMMENT"), true)); + } + } + else if (c->Id == SW_CMP_VPN_BRIDGE) + { + // VPN Bridge + SW_TASK_COPY *ct; + SW_TASK_COPY *vpnbridge, *vpncmd, *vpnsmgr; + + CombinePathW(tmp, sizeof(tmp), sw->InstallDir, L"backup.vpn_bridge.config"); + Add(t->SetSecurityPaths, CopyUniStr(tmp)); + + vpnbridge = SwNewCopyTask(L"vpnbridge.exe", NULL, sw->InstallSrc, sw->InstallDir, true, false); + vpncmd = SwNewCopyTask(L"vpncmd.exe", NULL, sw->InstallSrc, sw->InstallDir, true, false); + vpnsmgr = SwNewCopyTask(L"vpnsmgr.exe", NULL, sw->InstallSrc, sw->InstallDir, true, false); + + Add(t->CopyTasks, vpnbridge); + Add(t->CopyTasks, vpncmd); + Add(t->CopyTasks, vpnsmgr); + + Add(t->CopyTasks, (ct = SwNewCopyTask(L"|empty.config", L"vpn_bridge.config", sw->InstallSrc, sw->InstallDir, false, false))); + Add(t->CopyTasks, SwNewCopyTask(L"|backup_dir_readme.txt", L"readme.txt", sw->InstallSrc, tmp, false, false)); + + CombinePathW(tmp, sizeof(tmp), ct->DstDir, ct->DstFileName); + Add(t->SetSecurityPaths, CopyUniStr(tmp)); + + //// Definition of the shortcuts + // Desktop and Start menu + Add(t->LinkTasks, SwNewLinkTask(sw->InstallDir, vpnsmgr->DstFileName, NULL, NULL, 0, dir_desktop, + _UU(sw->IsSystemMode ? "SW_LINK_NAME_VPNSMGR_SHORT" : "SW_LINK_NAME_VPNSMGR_SHORT_UM"), + _UU("SW_LINK_NAME_VPNSMGR_COMMENT"), true)); + Add(t->LinkTasks, SwNewLinkTask(sw->InstallDir, vpnsmgr->DstFileName, NULL, NULL, 0, dir_startmenu, + _UU(sw->IsSystemMode ? "SW_LINK_NAME_VPNSMGR_SHORT" : "SW_LINK_NAME_VPNSMGR_SHORT_UM"), + _UU("SW_LINK_NAME_VPNSMGR_COMMENT"), true)); + + // Programs\PacketiX VPN Bridge + Add(t->LinkTasks, SwNewLinkTask(sw->InstallDir, vpnsmgr->DstFileName, NULL, NULL, 0, dir_app_program, + _UU("SW_LINK_NAME_VPNSMGR_FULL"), + _UU("SW_LINK_NAME_VPNSMGR_COMMENT"), false)); + Add(t->LinkTasks, SwNewLinkTask(sw->InstallDir, vpncmd->DstFileName, NULL, NULL, 0, dir_app_program, + _UU("SW_LINK_NAME_VPNCMD"), + _UU("SW_LINK_NAME_VPNCMD_COMMENT"), false)); + Add(t->LinkTasks, SwNewLinkTask(sw->InstallDir, vpnbridge->DstFileName, L"/traffic", L"vpnsetup.exe", 2, dir_admin_tools, + _UU("SW_LINK_NAME_TRAFFIC"), + _UU("SW_LINK_NAME_TRAFFIC_COMMENT"), false)); + + // Programs\PacketiX VPN Bridge\Configuration tool + Add(t->LinkTasks, SwNewLinkTask(sw->InstallDir, vpnbridge->DstFileName, L"/tcp", L"vpnsetup.exe", 3, dir_config_program, + _UU("SW_LINK_NAME_TCP"), + _UU("SW_LINK_NAME_TCP_COMMENT"), false)); + + if (MsIsWin2000OrGreater()) + { + Add(t->LinkTasks, SwNewLinkTask(MsGetSystem32DirW(), L"services.msc", NULL, L"filemgmt.dll", 0, dir_config_program, + _UU("SW_LINK_NAME_SERVICES"), + _UU("SW_LINK_NAME_SERVICES_COMMENT"), false)); + + if (sw->IsSystemMode) + { + // Debugging information collecting tool + Add(t->LinkTasks, SwNewLinkTask(sw->InstallDir, vpncmd->DstFileName, L"/debug", L"vpnsetup.exe", 4, dir_admin_tools, + _UU("SW_LINK_NAME_DEBUG"), + _UU("SW_LINK_NAME_DEBUG_COMMENT"), false)); + } + } + + if (sw->IsSystemMode == false) + { + // Register to the start-up in the case of user mode + Add(t->LinkTasks, SwNewLinkTask(sw->InstallDir, vpnbridge->DstFileName, L"/usermode", NULL, 0, dir_startup, + _UU("SW_LINK_NAME_VPNBRIDGE_SVC"), + _UU("SW_LINK_NAME_VPNBRIDGE_SVC_COMMENT"), true)); + } + } + else if (c->Id == SW_CMP_VPN_CLIENT) + { + // VPN Client + SW_TASK_COPY *ct; + SW_TASK_COPY *vpnclient, *vpncmd, *vpncmgr; + SW_TASK_COPY *sfx_cache = NULL; + //SW_TASK_COPY *vpnweb; + //SW_TASK_COPY *vpninstall; + wchar_t *src_config_filename; + + CombinePathW(tmp, sizeof(tmp), sw->InstallDir, L"backup.vpn_client.config"); + Add(t->SetSecurityPaths, CopyUniStr(tmp)); + + vpnclient = SwNewCopyTask(L"vpnclient.exe", NULL, sw->InstallSrc, sw->InstallDir, true, false); + vpncmd = SwNewCopyTask(L"vpncmd.exe", NULL, sw->InstallSrc, sw->InstallDir, true, false); + vpncmgr = SwNewCopyTask(L"vpncmgr.exe", NULL, sw->InstallSrc, sw->InstallDir, true, false); + + if (vpncmgr != NULL) + { + CombinePathW(sw->vpncmgr_path, sizeof(sw->vpncmgr_path), + vpncmgr->DstDir, vpncmgr->DstFileName); + } + + if (UniIsEmptyStr(sw->CallerSfxPath) == false) + { + if (IsFileExistsW(sw->CallerSfxPath)) + { + // Cache the calling SFX file body to the installation directory + wchar_t srcname[MAX_PATH]; + wchar_t srcdir[MAX_PATH]; + + GetFileNameFromFilePathW(srcname, sizeof(srcname), sw->CallerSfxPath); + GetDirNameFromFilePathW(srcdir, sizeof(srcdir), sw->CallerSfxPath); + + sfx_cache = SwNewCopyTask(srcname, SW_SFX_CACHE_FILENAME, srcdir, sw->InstallDir, true, false); + } + } + + //vpnweb = SwNewCopyTask(L"vpnweb.cab", NULL, sw->InstallSrc, sw->InstallDir, true, false); + //vpninstall = SwNewCopyTask(L"vpninstall.exe", NULL, sw->InstallSrc, sw->InstallDir, true, false); + + Add(t->CopyTasks, vpnclient); + Add(t->CopyTasks, vpncmd); + Add(t->CopyTasks, vpncmgr); + //Add(t->CopyTasks, vpnweb); + //Add(t->CopyTasks, vpninstall); + + + if (sfx_cache != NULL) + { + Add(t->CopyTasks, sfx_cache); + } + + src_config_filename = L"|empty.config"; + + Add(t->CopyTasks, (ct = SwNewCopyTask(src_config_filename, L"vpn_client.config", sw->InstallSrc, sw->InstallDir, false, false))); + + Add(t->CopyTasks, SwNewCopyTask(L"|backup_dir_readme.txt", L"readme.txt", sw->InstallSrc, tmp, false, false)); + + CombinePathW(tmp, sizeof(tmp), ct->DstDir, ct->DstFileName); + Add(t->SetSecurityPaths, CopyUniStr(tmp)); + + //// Definition of the shortcuts + // Desktop and Start menu + Add(t->LinkTasks, SwNewLinkTask(sw->InstallDir, vpncmgr->DstFileName, NULL, NULL, 0, dir_desktop, + _UU("SW_LINK_NAME_VPNCMGR_SHORT"), + _UU("SW_LINK_NAME_VPNCMGR_COMMENT"), true)); + Add(t->LinkTasks, SwNewLinkTask(sw->InstallDir, vpncmgr->DstFileName, NULL, NULL, 0, dir_startmenu, + _UU("SW_LINK_NAME_VPNCMGR_SHORT"), + _UU("SW_LINK_NAME_VPNCMGR_COMMENT"), true)); + + // Programs\PacketiX VPN Client + Add(t->LinkTasks, SwNewLinkTask(sw->InstallDir, vpncmgr->DstFileName, NULL, NULL, 0, dir_app_program, + _UU("SW_LINK_NAME_VPNCMGR_FULL"), + _UU("SW_LINK_NAME_VPNCMGR_COMMENT"), false)); + Add(t->LinkTasks, SwNewLinkTask(sw->InstallDir, vpncmgr->DstFileName, L"/remote", L"vpnsetup.exe", 1, dir_app_program, + _UU("SW_LINK_NAME_VPNCMGR2_FULL"), + _UU("SW_LINK_NAME_VPNCMGR2_COMMENT"), false)); + Add(t->LinkTasks, SwNewLinkTask(sw->InstallDir, vpncmd->DstFileName, NULL, NULL, 0, dir_app_program, + _UU("SW_LINK_NAME_VPNCMD"), + _UU("SW_LINK_NAME_VPNCMD_COMMENT"), false)); + Add(t->LinkTasks, SwNewLinkTask(sw->InstallDir, vpnclient->DstFileName, L"/traffic", L"vpnsetup.exe", 2, dir_admin_tools, + _UU("SW_LINK_NAME_TRAFFIC"), + _UU("SW_LINK_NAME_TRAFFIC_COMMENT"), false)); + + // Programs\PacketiX VPN Client\Configuration Tools + Add(t->LinkTasks, SwNewLinkTask(sw->InstallDir, vpnclient->DstFileName, L"/tcp", L"vpnsetup.exe", 3, dir_config_program, + _UU("SW_LINK_NAME_TCP"), + _UU("SW_LINK_NAME_TCP_COMMENT"), false)); + + if (MsIsWin2000OrGreater()) + { + Add(t->LinkTasks, SwNewLinkTask(MsGetSystem32DirW(), L"services.msc", NULL, L"filemgmt.dll", 0, dir_config_program, + _UU("SW_LINK_NAME_SERVICES"), + _UU("SW_LINK_NAME_SERVICES_COMMENT"), false)); + + if (sw->IsSystemMode) + { + // Debugging information collecting tool + Add(t->LinkTasks, SwNewLinkTask(sw->InstallDir, vpncmd->DstFileName, L"/debug", L"vpnsetup.exe", 4, dir_admin_tools, + _UU("SW_LINK_NAME_DEBUG"), + _UU("SW_LINK_NAME_DEBUG_COMMENT"), false)); + } + } + + // Programs\PacketiX VPN Client\System administrators tool + if (MsIsNt()) + { + Add(t->LinkTasks, SwNewLinkTask(sw->InstallDir, L"vpnsetup.exe", L"/easy:true", L"vpnsetup.exe", 12, dir_admin_tools, + _UU("SW_LINK_NAME_EASYINSTALLER"), + _UU("SW_LINK_NAME_EASYINSTALLER_COMMENT"), false)); + + Add(t->LinkTasks, SwNewLinkTask(sw->InstallDir, L"vpnsetup.exe", L"/web:true", L"vpnsetup.exe", 1, dir_admin_tools, + _UU("SW_LINK_NAME_WEBINSTALLER"), + _UU("SW_LINK_NAME_WEBINSTALLER_COMMENT"), false)); + } + + // Startup + Add(t->LinkTasks, SwNewLinkTask(sw->InstallDir, vpncmgr->DstFileName, L"/startup", NULL, 0, dir_startup, + _UU("SW_LINK_NAME_VPNCMGRTRAY_FULL"), + _UU("SW_LINK_NAME_VPNCMGRTRAY_COMMENT"), true)); + } + else if (c->Id == SW_CMP_VPN_SMGR) + { + // VPN Server Manager (Tools Only) + SW_TASK_COPY *vpncmd, *vpnsmgr; + + vpncmd = SwNewCopyTask(L"vpncmd.exe", NULL, sw->InstallSrc, sw->InstallDir, true, false); + vpnsmgr = SwNewCopyTask(L"vpnsmgr.exe", NULL, sw->InstallSrc, sw->InstallDir, true, false); + + Add(t->CopyTasks, vpncmd); + Add(t->CopyTasks, vpnsmgr); + + //// Definition of the shortcuts + // Desktop and Start menu + Add(t->LinkTasks, SwNewLinkTask(sw->InstallDir, vpnsmgr->DstFileName, NULL, NULL, 0, dir_desktop, + _UU(sw->IsSystemMode ? "SW_LINK_NAME_VPNSMGR_SHORT_TOOLSONLY" : "SW_LINK_NAME_VPNSMGR_SHORT_TOOLSONLY_UM"), + _UU("SW_LINK_NAME_VPNSMGR_COMMENT"), true)); + Add(t->LinkTasks, SwNewLinkTask(sw->InstallDir, vpnsmgr->DstFileName, NULL, NULL, 0, dir_startmenu, + _UU(sw->IsSystemMode ? "SW_LINK_NAME_VPNSMGR_SHORT_TOOLSONLY" : "SW_LINK_NAME_VPNSMGR_SHORT_TOOLSONLY_UM"), + _UU("SW_LINK_NAME_VPNSMGR_COMMENT"), true)); + + // Programs\PacketiX VPN Server Manager (Tools Only) + Add(t->LinkTasks, SwNewLinkTask(sw->InstallDir, vpnsmgr->DstFileName, NULL, NULL, 0, dir_app_program, + _UU("SW_LINK_NAME_VPNSMGR_FULL"), + _UU("SW_LINK_NAME_VPNSMGR_COMMENT"), false)); + Add(t->LinkTasks, SwNewLinkTask(sw->InstallDir, vpncmd->DstFileName, NULL, NULL, 0, dir_app_program, + _UU("SW_LINK_NAME_VPNCMD"), + _UU("SW_LINK_NAME_VPNCMD_COMMENT"), false)); + } + else if (c->Id == SW_CMP_VPN_CMGR) + { + // VPN Client Manager (Tools Only) + SW_TASK_COPY *vpncmd, *vpncmgr; + + vpncmd = SwNewCopyTask(L"vpncmd.exe", NULL, sw->InstallSrc, sw->InstallDir, true, false); + vpncmgr = SwNewCopyTask(L"vpncmgr.exe", NULL, sw->InstallSrc, sw->InstallDir, true, false); + + Add(t->CopyTasks, vpncmd); + Add(t->CopyTasks, vpncmgr); + + //// Definition of the shortcuts + // Desktop and Start menu + Add(t->LinkTasks, SwNewLinkTask(sw->InstallDir, vpncmgr->DstFileName, L"/remote", L"vpnsetup.exe", 1, dir_desktop, + _UU(sw->IsSystemMode ? "SW_LINK_NAME_VPNCMGRTOOLS_SHORT" : "SW_LINK_NAME_VPNCMGRTOOLS_SHORT_UM"), + _UU("SW_LINK_NAME_VPNCMGR2_COMMENT"), true)); + Add(t->LinkTasks, SwNewLinkTask(sw->InstallDir, vpncmgr->DstFileName, L"/remote", L"vpnsetup.exe", 1, dir_startmenu, + _UU(sw->IsSystemMode ? "SW_LINK_NAME_VPNCMGRTOOLS_SHORT" : "SW_LINK_NAME_VPNCMGRTOOLS_SHORT_UM"), + _UU("SW_LINK_NAME_VPNCMGR2_COMMENT"), true)); + + // Programs\PacketiX VPN Client Manager (Tools Only) + Add(t->LinkTasks, SwNewLinkTask(sw->InstallDir, vpncmgr->DstFileName, L"/remote", L"vpnsetup.exe", 1, dir_app_program, + _UU("SW_LINK_NAME_VPNCMGR2_FULL"), + _UU("SW_LINK_NAME_VPNCMGR2_COMMENT"), false)); + Add(t->LinkTasks, SwNewLinkTask(sw->InstallDir, vpncmd->DstFileName, NULL, NULL, 0, dir_app_program, + _UU("SW_LINK_NAME_VPNCMD"), + _UU("SW_LINK_NAME_VPNCMD_COMMENT"), false)); + } + + // Uninstallation + UniFormat(tmp1, sizeof(tmp1), _UU("SW_LINK_NAME_UNINSTALL"), c->Title); + UniFormat(tmp2, sizeof(tmp2), _UU("SW_LINK_NAME_UNINSTALL_COMMENT"), c->Title); + Add(t->LinkTasks, SwNewLinkTask(setup_exe->DstDir, setup_exe->DstFileName, NULL, NULL, 0, dir_config_program, + tmp1, + tmp2, false)); + + // Language settings (except for Win9x) + if (MsIsNt()) + { + UniFormat(tmp1, sizeof(tmp1), _UU("SW_LINK_NAME_LANGUAGE"), c->Title); + UniFormat(tmp2, sizeof(tmp2), _UU("SW_LINK_NAME_LANGUAGE_COMMENT"), c->Title); + Add(t->LinkTasks, SwNewLinkTask(setup_exe->DstDir, setup_exe->DstFileName, L"/language:yes", + L"vpnsetup.exe", 10, dir_config_language, + tmp1, + tmp2, false)); + } + + // Hamcore! + Add(t->CopyTasks, SwNewCopyTask(L"hamcore.se2", NULL, sw->InstallSrc, sw->InstallDir, true, true)); +} + +// Build the Web installer +bool SwWebMain(SW *sw, WIZARD_PAGE *wp) +{ + bool ret = false; + wchar_t tmp[MAX_SIZE]; + // Validate arguments + if (sw == NULL || wp == NULL) + { + return false; + } + + SwPerformPrint(wp, _UU("SW_PERFORM_MSG_WEB_INIT")); + + if (true) + { + wchar_t installer_src_exe[MAX_PATH]; + wchar_t src_cab[MAX_PATH]; + wchar_t vpninstall_exe[MAX_PATH]; + char inf_path[MAX_PATH]; + char htm_path[MAX_PATH]; + LANGLIST current_lang; + BUF *inf_buf = NULL; + BUF *htm_buf = NULL; + BUF *setting_buf = NULL; + char *inf_data = NULL; + UINT inf_data_size; + char *htm_data = NULL; + UINT htm_data_size; + char ver_major[64]; + char ver_minor[64]; + char ver_build[64]; + char *normal_mode = (sw->Web_EasyMode ? "false" : "true"); + char package_name[MAX_SIZE]; + ZIP_PACKER *z = NULL; + + ToStr(ver_major, CEDAR_VERSION_MAJOR); + ToStr(ver_minor, CEDAR_VERSION_MINOR); + ToStr(ver_build, CEDAR_VERSION_BUILD); + + Format(package_name, sizeof(package_name), + GC_SW_SOFTETHER_PREFIX "vpnclient-v%u.%02u-%u-%04u-%02u-%02u-windows.exe", + CEDAR_VERSION_MAJOR, CEDAR_VERSION_MINOR, CEDAR_VERSION_BUILD, + BUILD_DATE_Y, BUILD_DATE_M, BUILD_DATE_D); + + GetCurrentLang(¤t_lang); + + // Installer cache file + CombinePathW(installer_src_exe, sizeof(installer_src_exe), MsGetExeDirNameW(), SW_SFX_CACHE_FILENAME); + + // Cab file + CombinePathW(src_cab, sizeof(src_cab), MsGetExeDirNameW(), L"vpnweb.cab"); + + // Vpninstall file + CombinePathW(vpninstall_exe, sizeof(vpninstall_exe), MsGetExeDirNameW(), L"vpninstall.exe"); + + // Confirm existence of the file + if (IsFileExistsW(installer_src_exe) == false) + { + UniFormat(tmp, sizeof(tmp), _UU("SW_FILE_NOT_FOUNT"), installer_src_exe); + SwPerformMsgBox(wp, MB_ICONSTOP, tmp); + goto LABEL_CLEANUP; + } + if (IsFileExistsW(src_cab) == false) + { + UniFormat(tmp, sizeof(tmp), _UU("SW_FILE_NOT_FOUNT"), src_cab); + SwPerformMsgBox(wp, MB_ICONSTOP, tmp); + goto LABEL_CLEANUP; + } + if (IsFileExistsW(vpninstall_exe) == false) + { + UniFormat(tmp, sizeof(tmp), _UU("SW_FILE_NOT_FOUNT"), vpninstall_exe); + SwPerformMsgBox(wp, MB_ICONSTOP, tmp); + goto LABEL_CLEANUP; + } + + // Read the configuration file + setting_buf = ReadDumpW(sw->Web_SettingFile); + if (setting_buf != NULL) + { + if (sw->Web_EraseSensitive) + { + // Remove the secret information + CiEraseSensitiveInAccount(setting_buf); + } + } + + // Verify the signature of the installer cache file + if (MsCheckFileDigitalSignatureW(NULL, installer_src_exe, NULL) == false) + { + // Installer cache file is not signed + if (SwPerformMsgBox(wp, MB_ICONEXCLAMATION | MB_YESNO | MB_DEFBUTTON2, + _UU("SW_INSTALLER_CACHE_IS_NOT_SIGNED")) == IDNO) + { + // Cancel + goto LABEL_CLEANUP; + } + } + + // Read the .inf file + Format(inf_path, sizeof(inf_path), "|vpninstall_%s.inf", current_lang.Name); + + inf_buf = ReadDump(inf_path); + if (inf_buf == NULL) + { + goto LABEL_CLEANUP; + } + + inf_data_size = (inf_buf->Size + 1024) * 2; + inf_data = ZeroMalloc(inf_data_size); + Copy(inf_data, inf_buf->Buf, inf_buf->Size); + + ReplaceStrEx(inf_data, inf_data_size, inf_data, "$VER_BUILD$", ver_build, false); + ReplaceStrEx(inf_data, inf_data_size, inf_data, "$PACKAGE_FILENAME$", package_name, false); + ReplaceStrEx(inf_data, inf_data_size, inf_data, "$NORMAL_MODE$", normal_mode, false); + + // Read the .htm file + Format(htm_path, sizeof(htm_path), "|vpnweb_sample_%s.htm", current_lang.Name); + + htm_buf = ReadDump(htm_path); + if (htm_buf == NULL) + { + goto LABEL_CLEANUP; + } + + htm_data_size = (htm_buf->Size + 1024) * 2; + htm_data = ZeroMalloc(htm_data_size); + Copy(htm_data, htm_buf->Buf, htm_buf->Size); + + ReplaceStrEx(htm_data, htm_data_size, htm_data, "$VER_MAJOR$", ver_major, false); + ReplaceStrEx(htm_data, htm_data_size, htm_data, "$VER_MINOR$", ver_minor, false); + ReplaceStrEx(htm_data, htm_data_size, htm_data, "$VER_BUILD$", ver_build, false); + + // Creating a ZIP + z = NewZipPacker(); + + if (ZipAddRealFileW(z, "vpnweb.cab", 0, 0, src_cab) == false || + ZipAddRealFileW(z, "vpninstall.exe", 0, 0, vpninstall_exe) == false || + ZipAddRealFileW(z, package_name, 0, 0, installer_src_exe) == false) + { + goto LABEL_CLEANUP; + } + + ZipAddFileSimple(z, "vpninstall.inf", 0, 0, inf_data, StrLen(inf_data)); + ZipAddFileSimple(z, "index.html", 0, 0, htm_data, StrLen(htm_data)); + ZipAddFileSimple(z, "auto_setting.vpn", 0, 0, setting_buf->Buf, setting_buf->Size); + + // Export + if (ZipWriteW(z, sw->Web_OutFile)) + { + ret = true; + + UniFormat(sw->FinishMsg, sizeof(sw->FinishMsg), + _UU("SW_WEB_FINISHED"), + sw->Web_OutFile); + } + +LABEL_CLEANUP: + FreeZipPacker(z); + FreeBuf(setting_buf); + FreeBuf(inf_buf); + FreeBuf(htm_buf); + Free(inf_data); + Free(htm_data); + } + + + return ret; +} + +// Build a simple installer +bool SwEasyMain(SW *sw, WIZARD_PAGE *wp) +{ + LIST *o; + BUF *b; + bool ret = false; + wchar_t account_tmp[MAX_PATH]; + // Validate arguments + if (sw == NULL || wp == NULL) + { + return false; + } + + SwPerformPrint(wp, _UU("SW_PERFORM_MSG_EASY_INIT")); + + o = SwNewSfxFileList(); + + SwAddBasicFilesToList(o, "vpnclient"); + + // Load a connection setting file + b = ReadDumpW(sw->Easy_SettingFile); + if (b != NULL) + { + if (sw->Easy_EraseSensitive) + { + // Remove secret information + CiEraseSensitiveInAccount(b); + } + + // Save to a temporary folder + CombinePathW(account_tmp, sizeof(account_tmp), MsGetMyTempDirW(), L"vpn_setting.vpn"); + if (DumpBufW(b, account_tmp)) + { + // Add a connection settings to file list of SFX + Add(o, SwNewSfxFile(SW_AUTO_CONNECT_ACCOUNT_FILE_NAME, account_tmp)); + + if (sw->Easy_EasyMode) + { + // Set the connection manager to simple mode + Add(o, SwNewSfxFile(SW_FLAG_EASY_MODE, account_tmp)); + } + + if (SwCompileSfx(o, sw->Easy_OutFile)) + { + ret = true; + } + + FileDeleteW(account_tmp); + } + + FreeBuf(b); + } + + SwFreeSfxFileList(o); + + if (ret) + { + // Completion message + UniFormat(sw->FinishMsg, sizeof(sw->FinishMsg), _UU("SW_EASY_FINISHED_MSG"), sw->Easy_OutFile); + } + + return ret; +} + +// Installation main +bool SwInstallMain(SW *sw, WIZARD_PAGE *wp, SW_COMPONENT *c) +{ + SW_TASK *t; + bool ret = false; + UINT i; + wchar_t tmp[MAX_SIZE * 2]; + bool ok; + // Validate arguments + if (sw == NULL || wp == NULL || c == NULL) + { + return false; + } + + ok = true; + t = NULL; + + // Create a Setup task + SwPerformPrint(wp, _UU("SW_PERFORM_MSG_INIT_TASKS")); + t = SwNewTask(); + + // Create a list of files to be installed + SwDefineTasks(sw, t, c); + + if (sw->LanguageMode) + { + goto LABEL_CREATE_SHORTCUT; + } + + if (sw->OnlyAutoSettingMode) + { + goto LABEL_IMPORT_SETTING; + } + + // Install the SeLow + if (SuIsSupportedOs(true)) + { + // Only in the system mode + if (c->InstallService && sw->IsSystemMode) + { + // Not to install in the case of the VPN Client + bool install_su = false; + + if (c->Id != SW_CMP_VPN_CLIENT) + { + install_su = true; + } + + + if (install_su) + { + bool ret; + + SwPerformPrint(wp, _UU("SW_PERFORM_MSG_INSTALL_SELOW")); + ret = SuInstallDriver(false); + + if (ret == false) + { + if (MsIs64BitWindows() && MsIsWindows10()) + { + void *proc_handle = NULL; + wchar_t exe[MAX_PATH]; + + CombinePathW(exe, sizeof(exe), MsGetExeDirNameW(), L"vpnsetup.exe"); + + if (MsExecuteEx2W(exe, L"/SUINSTMODE:yes", &proc_handle, true)) + { + if (proc_handle != NULL) + { + MsWaitProcessExit(proc_handle); + } + } + } + } + } + } + } + + // Uninstall the old MSI + ok = true; + if (sw->IsSystemMode && c->OldMsiList != NULL) + { + bool reboot_required = false; + + if (SwUninstallOldMsiInstalled(wp->Wizard->hWndWizard, wp, c, &reboot_required) == false) + { + // MSI uninstall Failed + ok = false; + } + else if (reboot_required) + { + // Require to restart + ok = false; + + sw->MsiRebootRequired = true; + } + } + + if (ok == false) + { + goto LABEL_CLEANUP; + } + + // Stop the Service + ok = true; + + if (c->InstallService) + { + char svc_title_name[MAX_SIZE]; + wchar_t *svc_title; + + Format(svc_title_name, sizeof(svc_title_name), "SVC_%s_TITLE", c->SvcName); + + svc_title = _UU(svc_title_name); + + if (UniIsEmptyStr(svc_title) == false) + { + if (sw->IsSystemMode && MsIsNt()) + { + // WinNT and system mode + if (MsIsServiceRunning(c->SvcName)) + { + wchar_t svc_exe[MAX_SIZE]; + UINT64 giveup_tick; + UniFormat(tmp, sizeof(tmp), _UU("SW_PERFORM_MSG_STOP_SVC"), svc_title); + SwPerformPrint(wp, tmp); + +LABEL_RETRY_3: + if (MsStopService(c->SvcName) == false) + { + UniFormat(tmp, sizeof(tmp), _UU("SW_PERFORM_MSG_STOP_SVC_ERROR"), svc_title, c->SvcName); + if (SwPerformMsgBox(wp, MB_ICONEXCLAMATION | MB_RETRYCANCEL, tmp) != IDRETRY) + { + // Cancel + ok = false; + } + else + { + if (MsIsServiceRunning(c->SvcName)) + { + goto LABEL_RETRY_3; + } + } + } + + // Wait for 5 seconds if stopped the service + SleepThread(5000); + + // Wait until the EXE file for the service become ready to write + ConbinePathW(svc_exe, sizeof(svc_exe), sw->InstallDir, c->SvcFileName); + + giveup_tick = Tick64() + (UINT64)10000; + while (IsFileWriteLockedW(svc_exe)) + { + UniFormat(tmp, sizeof(tmp), _UU("SW_PERFORM_MSG_WAIT_FOR_FILE_UNLOCK"), svc_exe); + SwPerformPrint(wp, tmp); + + SleepThread(100); + + if (Tick64() >= giveup_tick) + { + break; + } + } + } + } + else + { + // In the case of Win9x or user mode + wchar_t svc_exe[MAX_SIZE]; + UINT64 giveup_tick; + + // Stop the Service + MsStopUserModeSvc(c->SvcName); + SleepThread(3000); + + // Wait until the EXE file for the service become ready to write + ConbinePathW(svc_exe, sizeof(svc_exe), sw->InstallDir, c->SvcFileName); + + giveup_tick = Tick64() + (UINT64)10000; + while (IsFileWriteLockedW(svc_exe)) + { + UniFormat(tmp, sizeof(tmp), _UU("SW_PERFORM_MSG_WAIT_FOR_FILE_UNLOCK"), svc_exe); + SwPerformPrint(wp, tmp); + + SleepThread(100); + + if (Tick64() >= giveup_tick) + { + break; + } + } + } + } + } + + if (ok == false) + { + goto LABEL_CLEANUP; + } + + // Examine preliminary whether files to be copied are writable successfully + ok = true; + + SwPerformPrint(wp, _UU("SW_PERFORM_MSG_COPY_PREPARE")); + + for (i = 0;i < LIST_NUM(t->CopyTasks);i++) + { + SW_TASK_COPY *ct = LIST_DATA(t->CopyTasks, i); + + wchar_t fullpath[MAX_SIZE]; + IO *io; + bool write_ok; + bool new_file; + bool new_dir; + UINT64 giveup_tick = Tick64() + 30000ULL; + +LABEL_RETRY_1: + new_dir = write_ok = new_file = false; + + CombinePathW(fullpath, sizeof(fullpath), ct->DstDir, ct->DstFileName); + + if (ct->Overwrite == false) + { + // Do not check if overwrite is Off + continue; + } + + // If the process with the same name is running, kill it + if (MsKillProcessByExeName(fullpath) != 0) + { + // Wait for 1 second if killed the process + SleepThread(1000); + } + + new_dir = MakeDirExW(ct->DstDir); + + // Write check + io = FileOpenExW(fullpath, true, true); + if (io == NULL) + { + io = FileCreateW(fullpath); + new_file = true; + } + if (io != NULL) + { + // Writing OK + write_ok = true; + + FileCloseEx(io, true); + + if (new_file) + { + FileDeleteW(fullpath); + } + } + + if (new_dir) + { + DeleteDirW(ct->DstDir); + } + + if (write_ok == false) + { + UINT64 now = Tick64(); + + if (now <= giveup_tick) + { + // Do the auto-retry in 30 seconds + SleepThread(1000); + goto LABEL_RETRY_1; + } + + // Show an error message if it fails + UniFormat(tmp, sizeof(tmp), _UU("SW_PERFORM_MSG_WRITE_ERROR"), fullpath, c->Title); + if (SwPerformMsgBox(wp, MB_ICONEXCLAMATION | MB_RETRYCANCEL, tmp) != IDRETRY) + { + // Cancel + ok = false; + break; + } + else + { + // Retry + goto LABEL_RETRY_1; + } + } + } + + if (ok == false) + { + goto LABEL_CLEANUP; + } + + // File Copy + ok = true; + + for (i = 0;i < LIST_NUM(t->CopyTasks);i++) + { + SW_TASK_COPY *ct = LIST_DATA(t->CopyTasks, i); + wchar_t fullpath_src[MAX_SIZE]; + wchar_t fullpath_dst[MAX_SIZE]; + bool skip; + +LABEL_RETRY_2: + + if (UniStartWith(ct->SrcFileName, L"|") == false) + { + CombinePathW(fullpath_src, sizeof(fullpath_src), ct->SrcDir, ct->SrcFileName); + } + else + { + UniStrCpy(fullpath_src, sizeof(fullpath_src), ct->SrcFileName); + } + + CombinePathW(fullpath_dst, sizeof(fullpath_dst), ct->DstDir, ct->DstFileName); + + UniFormat(tmp, sizeof(tmp), _UU("SW_PERFORM_MSG_COPY_FILE"), fullpath_dst); + SwPerformPrint(wp, tmp); + + skip = false; + + if (ct->Overwrite == false) + { + if (IsFileExistsW(fullpath_dst)) + { + // Do nothing because the destination file already exists + skip = true; + } + } + + if (skip == false) + { + // Create a directory + if (MakeDirExW(ct->DstDir)) + { + SwAddLog(sw, sw->LogFile, SW_LOG_TYPE_DIR, ct->DstDir); + } + + // Copy + if (FileCopyW(fullpath_src, fullpath_dst) == false && ct->Overwrite) + { + // Show an error message if it fails + UniFormat(tmp, sizeof(tmp), _UU("SW_PERFORM_MSG_COPY_ERROR"), fullpath_dst); + if (SwPerformMsgBox(wp, MB_ICONEXCLAMATION | MB_RETRYCANCEL, tmp) != IDRETRY) + { + // Cancel + ok = false; + break; + } + else + { + // Retry + goto LABEL_RETRY_2; + } + } + else + { + if (ct->Overwrite && ct->SetupFile == false) + { + SwAddLog(sw, sw->LogFile, SW_LOG_TYPE_FILE, fullpath_dst); + } + } + } + } + + if (ok == false) + { + goto LABEL_CLEANUP; + } + + + if (sw->IsSystemMode && MsIsNt()) + { + // ACL settings only in the system mode + for (i = 0;i < LIST_NUM(t->SetSecurityPaths);i++) + { + // Security Settings + wchar_t *path = LIST_DATA(t->SetSecurityPaths, i); + + UniFormat(tmp, sizeof(tmp), _UU("SW_PERFORM_MSG_SET_SECURITY"), path); + SwPerformPrint(wp, tmp); + + MsSetFileSecureAcl(path); + } + } + + // Set the language of the destination + if (true) + { + LANGLIST current_lang; + wchar_t langfilename[MAX_PATH]; + + Zero(¤t_lang, sizeof(current_lang)); + GetCurrentLang(¤t_lang); + + ConbinePathW(langfilename, sizeof(langfilename), sw->InstallDir, L"lang.config"); + + SaveLangConfig(langfilename, current_lang.Name); + } + + // Firewall registration + if (true) + { + char dira[MAX_PATH]; + + UniToStr(dira, sizeof(dira), sw->InstallDir); + + RegistWindowsFirewallAllEx(dira); + } + + if (c->Id == SW_CMP_VPN_SERVER || c->Id == SW_CMP_VPN_BRIDGE) + { + // Disable the off-loading + MsDisableNetworkOffloadingEtc(); + } + + // Install the service + ok = true; + + if (c->InstallService) + { + char svc_title_name[MAX_SIZE]; + char svc_description_name[MAX_SIZE]; + wchar_t *svc_title; + + Format(svc_title_name, sizeof(svc_title_name), "SVC_%s_TITLE", c->SvcName); + Format(svc_description_name, sizeof(svc_description_name), "SVC_%s_DESCRIPT", c->SvcName); + + svc_title = _UU(svc_title_name); + + if (UniIsEmptyStr(svc_title) == false) + { + if (sw->IsSystemMode == false || MsIsNt() == false) + { + // Just simply start in user mode or Win9x mode + wchar_t fullpath[MAX_SIZE]; + +LABEL_RETRY_USERMODE_EXEC: + + CombinePathW(fullpath, sizeof(fullpath), sw->InstallDir, c->SvcFileName); + + if (MsExecuteW(fullpath, (MsIsNt() ? L"/usermode" : L"/win9x_service")) == false) + { + UniFormat(tmp, sizeof(tmp), _UU("SW_PERFORM_MSG_SVC_USERMODE_EXEC_FAILED"), fullpath); + + if (SwPerformMsgBox(wp, MB_ICONEXCLAMATION | MB_RETRYCANCEL, tmp) != IDRETRY) + { + // Cancel + ok = false; + } + else + { + // Retry + goto LABEL_RETRY_USERMODE_EXEC; + } + } + else + { + if (MsIsNt() == false) + { + // Register into the registry as a background service in the case of Win9x + wchar_t fullpath2[MAX_SIZE]; + + UniFormat(fullpath2, sizeof(fullpath2), L"\"%s\" /win9x_service", fullpath); + + MsRegWriteStrW(REG_LOCAL_MACHINE, WIN9X_SVC_REGKEY_1, c->SvcName, fullpath2); + MsRegWriteStrW(REG_LOCAL_MACHINE, WIN9X_SVC_REGKEY_2, c->SvcName, fullpath2); + } + } + } + else + { + // System mode + UniFormat(tmp, sizeof(tmp), _UU("SW_PERFORM_MSG_INSTALL_SVC"), svc_title); + SwPerformPrint(wp, tmp); + +LABEL_RETRY_4: + + if (MsIsServiceInstalled(c->SvcName)) + { + // Stop the service if it is running by any chance + MsStopService(c->SvcName); + } + + if (MsIsServiceInstalled(c->SvcName)) + { + // Uninstall the old service + if (MsUninstallService(c->SvcName) == false) + { + // Show an error message if it fails + UniFormat(tmp, sizeof(tmp), _UU("SW_PERFORM_MSG_SVC_UNINSTALL_FAILED"), svc_title, c->SvcName); + if (SwPerformMsgBox(wp, MB_ICONEXCLAMATION | MB_RETRYCANCEL, tmp) != IDRETRY) + { + // Cancel + ok = false; + } + else + { + // Retry + goto LABEL_RETRY_4; + } + } + } + + if (ok) + { + wchar_t fullpath[MAX_SIZE]; + wchar_t fullpath2[MAX_SIZE]; + + CombinePathW(fullpath2, sizeof(fullpath), sw->InstallDir, c->SvcFileName); + UniFormat(fullpath, sizeof(fullpath), L"\"%s\" /service", fullpath2); + + // Install a new service + if (MsInstallServiceW(c->SvcName, svc_title, _UU(svc_description_name), fullpath) == false) + { + // Show the error message if it fails + UniFormat(tmp, sizeof(tmp), _UU("SW_PERFORM_MSG_SVC_INSTALL_FAILED"), svc_title, c->SvcName); + if (SwPerformMsgBox(wp, MB_ICONEXCLAMATION | MB_RETRYCANCEL, tmp) != IDRETRY) + { + // Cancel + ok = false; + } + else + { + // Retry + goto LABEL_RETRY_4; + } + } + else + { + wchar_t wtmp[256]; + + StrToUni(wtmp, sizeof(wtmp), c->SvcName); + SwAddLog(sw, sw->LogFile, SW_LOG_TYPE_SVC, wtmp); + } + } + + if (ok) + { + UniFormat(tmp, sizeof(tmp), _UU("SW_PERFORM_MSG_START_SVC"), svc_title); + SwPerformPrint(wp, tmp); + + MsRegWriteIntEx2(REG_LOCAL_MACHINE, "Software\\" GC_REG_COMPANY_NAME "\\Update Service Config", c->SvcName, 0, false, true); + +LABEL_RETRY_5: + // Start the service + if (MsStartService(c->SvcName) == false) + { + // Show the error message if it fails + UniFormat(tmp, sizeof(tmp), _UU("SW_PERFORM_MSG_START_SVC_ERROR"), svc_title, c->SvcName); + if (SwPerformMsgBox(wp, MB_ICONEXCLAMATION | MB_RETRYCANCEL, tmp) != IDRETRY) + { + // Cancel + ok = false; + } + else + { + // Retry + if (MsIsServiceRunning(c->SvcName) == false) + { + goto LABEL_RETRY_5; + } + } + } + } + } + + if (c->Id == SW_CMP_VPN_CLIENT) + { + // In the VPN Client service, wait until the service port can be connected + SwWaitForVpnClientPortReady(SW_VPNCLIENT_SERVICE_WAIT_READY_TIMEOUT); + } + } + } + + if (ok == false) + { + goto LABEL_CLEANUP; + } + +LABEL_CREATE_SHORTCUT: + + // Create a shortcut + SwInstallShortcuts(sw, wp, c, t); + + if (sw->LanguageMode) + { + // Update the Description of the service if in the language setting mode + if (c->InstallService) + { + char svc_description_name[MAX_SIZE]; + wchar_t *svc_description; + + Format(svc_description_name, sizeof(svc_description_name), "SVC_%s_DESCRIPT", c->SvcName); + + svc_description = _UU(svc_description_name); + + if (UniIsEmptyStr(svc_description) == false) + { + if (sw->IsSystemMode && MsIsNt()) + { + MsSetServiceDescription(c->SvcName, svc_description); + } + } + } + + goto LABEL_REGISTER_UNINSTALL; + } + + if (c->Id == SW_CMP_VPN_CLIENT) + { + // Register the UI Helper in the Run in the case of the VPN Client + wchar_t fullpath[MAX_PATH]; + wchar_t fullcmd[MAX_SIZE]; + + ConbinePathW(fullpath, sizeof(fullpath), sw->InstallDir, c->SvcFileName); + + UniFormat(fullcmd, sizeof(fullcmd), L"\"%s\" /uihelp", fullpath); + + MsRegWriteStrEx2W(REG_LOCAL_MACHINE, "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Run", + SW_VPN_CLIENT_UIHELPER_REGVALUE, fullcmd, false, true); + + // Start the UI Helper + MsExecuteW(fullpath, L"/uihelp"); + + SleepThread(3000); + } + + if (true) + { + // Run the vpncmd and exit immediately + wchar_t fullpath[MAX_PATH]; + + ConbinePathW(fullpath, sizeof(fullpath), sw->InstallDir, (L"vpncmd.exe")); + + RunW(fullpath, L"/?", true, false); + } + + if (c->Id == SW_CMP_VPN_CLIENT) + { + wchar_t dst_vpnclient_exe[MAX_PATH]; + wchar_t vpnclient_arg[MAX_SIZE]; + + ConbinePathW(dst_vpnclient_exe, sizeof(dst_vpnclient_exe), sw->InstallDir, c->SvcFileName); + UniFormat(vpnclient_arg, sizeof(vpnclient_arg), L"\"%s\" \"%%1\"", dst_vpnclient_exe); + + // Register the association to .vpn file in the case of VPN Client + MsRegWriteStrEx2(REG_LOCAL_MACHINE, SW_VPN_CLIENT_EXT_REGKEY, NULL, SW_VPN_CLIENT_EXT_REGVALUE, false, true); + SwAddLogA(sw, sw->LogFile, SW_LOG_TYPE_REGISTRY, SW_VPN_CLIENT_EXT_REGKEY); + + MsRegNewKeyEx2(REG_LOCAL_MACHINE, SW_VPN_CLIENT_EXT_REGKEY_SUB1, false, true); + MsRegNewKeyEx2(REG_LOCAL_MACHINE, SW_VPN_CLIENT_EXT_REGKEY_SUB2, false, true); + SwAddLogA(sw, sw->LogFile, SW_LOG_TYPE_REGISTRY, SW_VPN_CLIENT_EXT_REGKEY_SUB1); + SwAddLogA(sw, sw->LogFile, SW_LOG_TYPE_REGISTRY, SW_VPN_CLIENT_EXT_REGKEY_SUB2); + + MsRegWriteStrEx2(REG_LOCAL_MACHINE, SW_VPN_CLIENT_VPNFILE_REGKEY, NULL, SW_VPN_CLIENT_VPNFILE_REGVALUE, false, true); + SwAddLogA(sw, sw->LogFile, SW_LOG_TYPE_REGISTRY, SW_VPN_CLIENT_VPNFILE_REGKEY); + + MsRegWriteStrEx2W(REG_LOCAL_MACHINE, SW_VPN_CLIENT_VPNFILE_ICON_REGKEY, NULL, dst_vpnclient_exe, false, true); + SwAddLogA(sw, sw->LogFile, SW_LOG_TYPE_REGISTRY, SW_VPN_CLIENT_VPNFILE_ICON_REGKEY); + + MsRegWriteStrEx2W(REG_LOCAL_MACHINE, SW_VPN_CLIENT_VPNFILE_SHELLOPEN_CMD_REGKEY, NULL, vpnclient_arg, false, true); + SwAddLogA(sw, sw->LogFile, SW_LOG_TYPE_REGISTRY, SW_VPN_CLIENT_VPNFILE_SHELLOPEN_CMD_REGKEY_SUB2); + SwAddLogA(sw, sw->LogFile, SW_LOG_TYPE_REGISTRY, SW_VPN_CLIENT_VPNFILE_SHELLOPEN_CMD_REGKEY_SUB1); + SwAddLogA(sw, sw->LogFile, SW_LOG_TYPE_REGISTRY, SW_VPN_CLIENT_VPNFILE_SHELLOPEN_CMD_REGKEY); + } + + if (c->Id == SW_CMP_VPN_CLIENT) + { + // Disable the MMCSS + MsSetMMCSSNetworkThrottlingEnable(false); + } + +LABEL_IMPORT_SETTING: + if (c->Id == SW_CMP_VPN_CLIENT) + { + if (UniIsEmptyStr(sw->auto_setting_path) == false) + { + if (UniIsEmptyStr(sw->vpncmgr_path) == false) + { + if (sw->DisableAutoImport == false) + { + wchar_t tmp_setting_path[MAX_PATH]; + wchar_t arg[MAX_PATH]; + void *handle; + bool easy_mode = IsFileExists(SW_FLAG_EASY_MODE_2); + // Run the vpncmgr, and start a connection by importing the connection configuration file + // Store a connection setting file to stable temporally directory + + SwPerformPrint(wp, _UU("SW_PERFORM_MSG_IMPORTING_ACCOUNT")); + + ConbinePathW(tmp_setting_path, sizeof(tmp_setting_path), MsGetTempDirW(), L"vpn_auto_connect.vpn"); + FileCopyW(sw->auto_setting_path, tmp_setting_path); + + // Start the vpncmgr + UniFormat(arg, sizeof(arg), L"/%S \"%s\"", (easy_mode ? "easy" : "normal"), tmp_setting_path); + handle = MsRunAsUserExW(sw->vpncmgr_path, arg, false); + + if (handle != NULL) + { + sw->HideStartCommand = true; + + CloseHandle(handle); + } + } + } + } + } + + if (sw->OnlyAutoSettingMode) + { + goto LABEL_FINISHED; + } + +LABEL_REGISTER_UNINSTALL: + // Register the uninstall information + if (sw->IsSystemMode) + { + char uninstall_keyname[MAX_SIZE]; + wchar_t uninstall_keyname_w[MAX_SIZE]; + char uninstall_version[MAX_SIZE]; + wchar_t dst_setup_exe[MAX_PATH]; + wchar_t setup_icon[MAX_SIZE]; + wchar_t uninstaller_exe[MAX_PATH]; + SYSTEMTIME st; + char install_date[MAX_PATH]; + + SwPerformPrint(wp, _UU("SW_PERFORM_MSG_REGISTER_UNINSTALL")); + + Zero(&st, sizeof(st)); + LocalTime(&st); + + Format(install_date, sizeof(install_date), "%04u/%02u/%02u", st.wYear, st.wMonth, st.wDay); + + CombinePathW(dst_setup_exe, sizeof(dst_setup_exe), sw->InstallDir, L"vpnsetup.exe"); + + Format(uninstall_keyname, sizeof(uninstall_keyname), + "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\softether_" GC_SW_SOFTETHER_PREFIX "%s", c->Name); + StrToUni(uninstall_keyname_w, sizeof(uninstall_keyname_w), uninstall_keyname); + + GetCedarVersion(uninstall_version, sizeof(uninstall_version)); + + // Display name + MsRegWriteStrEx2W(REG_LOCAL_MACHINE, uninstall_keyname, "DisplayName", c->LongName, + false, true); + + // Version + MsRegWriteStrEx2(REG_LOCAL_MACHINE, uninstall_keyname, "DisplayVersion", uninstall_version, + false, true); + + // Icon + UniFormat(setup_icon, sizeof(setup_icon), L"\"%s\",%u", dst_setup_exe, c->IconExeIndex); + MsRegWriteStrEx2W(REG_LOCAL_MACHINE, uninstall_keyname, "DisplayIcon", setup_icon, + false, true); + + // Information + MsRegWriteIntEx2(REG_LOCAL_MACHINE, uninstall_keyname, "NoModify", 1, false, true); + MsRegWriteIntEx2(REG_LOCAL_MACHINE, uninstall_keyname, "NoRepair", 1, false, true); + + // Link + MsRegWriteStrEx2(REG_LOCAL_MACHINE, uninstall_keyname, "HelpLink", _SS("SW_UNINSTALLINFO_URL"), + false, true); + MsRegWriteStrEx2(REG_LOCAL_MACHINE, uninstall_keyname, "URLInfoAbout", _SS("SW_UNINSTALLINFO_URL"), + false, true); + MsRegWriteStrEx2(REG_LOCAL_MACHINE, uninstall_keyname, "URLUpdateInfo", _SS("SW_UNINSTALLINFO_URL"), + false, true); + + // Publisher + MsRegWriteStrEx2W(REG_LOCAL_MACHINE, uninstall_keyname, "Publisher", _UU("SW_UNINSTALLINFO_PUBLISHER"), + false, true); + + // Date of installation + MsRegWriteStrEx2(REG_LOCAL_MACHINE, uninstall_keyname, "InstallDate", install_date, + false, true); + + // Uninstaller + UniFormat(uninstaller_exe, sizeof(uninstaller_exe), L"\"%s\"", dst_setup_exe); + MsRegWriteStrEx2W(REG_LOCAL_MACHINE, uninstall_keyname, "UninstallString", uninstaller_exe, + false, true); + + if (sw->LanguageMode == false) + { + SwAddLog(sw, sw->LogFile, SW_LOG_TYPE_REGISTRY, uninstall_keyname_w); + } + } + + // Write the log + if (true) + { + wchar_t log_filename[MAX_SIZE]; + +L_RETRY_LOG: + + SwPerformPrint(wp, _UU("SW_PERFORM_MSG_WRITE_LOG")); + + CombinePathW(log_filename, sizeof(log_filename), sw->InstallDir, L"setuplog.dat"); + + if (sw->LanguageMode == false) + { + SwAddLog(sw, sw->LogFile, SW_LOG_TYPE_FILE, log_filename); + } + + sw->LogFile->IsSystemMode = sw->IsSystemMode; + sw->LogFile->Component = sw->CurrentComponent; + sw->LogFile->Build = CEDAR_VERSION_BUILD; + + if (SwSaveLogFile(sw, log_filename, sw->LogFile) == false) + { + // Show the error message if it fails + UINT msgret; + UniFormat(tmp, sizeof(tmp), _UU("SW_PERFORM_MSG_WRITE_LOG_ERROR"), log_filename); + msgret = SwPerformMsgBox(wp, MB_ICONEXCLAMATION | MB_YESNO, tmp); + + if (msgret == IDYES) + { + // Retry + goto L_RETRY_LOG; + } + } + } + + if (true) + { + // Record the installed build number and directory in the registry + char keyname[MAX_SIZE]; + LANGLIST current_lang; + LANGLIST current_os_lang; + + GetCurrentLang(¤t_lang); + GetCurrentLang(¤t_os_lang); + + Format(keyname, sizeof(keyname), "%s\\%s", SW_REG_KEY, sw->CurrentComponent->Name); + MsRegWriteStrEx2W(sw->IsSystemMode ? REG_LOCAL_MACHINE : REG_CURRENT_USER, + keyname, "InstalledDir", sw->InstallDir, false, true); + MsRegWriteIntEx2(sw->IsSystemMode ? REG_LOCAL_MACHINE : REG_CURRENT_USER, + keyname, "InstalledBuild", CEDAR_VERSION_BUILD, false, true); + + // Set the language to registry + MsRegWriteStrEx2(REG_CURRENT_USER, SW_REG_KEY, "Last User Language", + current_lang.Name, false, true); + MsRegWriteStrEx2(REG_CURRENT_USER, SW_REG_KEY, "Last Operating System Language", + current_os_lang.Name, false, true); + + // Save the EULA agreement record + if (sw->EulaAgreed && sw->CurrentEulaHash != 0) + { + MsRegWriteIntEx2(REG_CURRENT_USER, SW_REG_KEY_EULA, sw->CurrentComponent->Name, + sw->CurrentEulaHash, false, true); + } + } + + SwPerformPrint(wp, _UU("SW_PERFORM_MSG_UPDATING")); + + // Notify the update to the system + MsUpdateSystem(); + + if (sw->LanguageMode) + { + // Show a message that the language configuration is complete + wchar_t msg[MAX_SIZE]; + + UniFormat(msg, sizeof(msg), _UU("SW_LANG_OK"), c->Title, c->Title); + + if (c->InstallService) + { + UniStrCat(msg, sizeof(msg), _UU("SW_LANG_OK_SERVICE")); + } + + if (c->Id == SW_CMP_VPN_CLIENT) + { + UniStrCat(msg, sizeof(msg), _UU("SW_LANG_OK_VPNCMGR")); + } + + UniStrCpy(sw->FinishMsg, sizeof(sw->FinishMsg), msg); + } + +LABEL_FINISHED: + + // Completion message + SwPerformPrint(wp, _UU("SW_PERFORM_MSG_FINISHED")); + + ret = true; + +LABEL_CLEANUP: + // Release the task + if (t != NULL) + { + SwFreeTask(t); + } + + return ret; +} + +// Wait for that the listening port of the VPN Client service becomes available +bool SwWaitForVpnClientPortReady(UINT timeout) +{ + UINT64 start, giveup; + bool ret = false; + if (timeout == 0) + { + timeout = SW_VPNCLIENT_SERVICE_WAIT_READY_TIMEOUT; + } + + start = Tick64(); + giveup = start + (UINT64)timeout; + + while (Tick64() < giveup) + { + if (CheckTCPPortEx("localhost", CLIENT_CONFIG_PORT, 1000)) + { + ret = true; + break; + } + + SleepThread(1000); + } + + return ret; +} + +// Create a Shortcut file (Delete the old one) +void SwInstallShortcuts(SW *sw, WIZARD_PAGE *wp, SW_COMPONENT *c, SW_TASK *t) +{ + UINT i; + wchar_t tmp[MAX_SIZE]; + wchar_t setuplog[MAX_PATH]; + LIST *o; + SW_LOGFILE *oldlog; + // Validate arguments + if (sw == NULL || wp == NULL || c == NULL || t == NULL) + { + return; + } + + // If there is an old setup log, read it + CombinePathW(setuplog, sizeof(setuplog), sw->InstallDir, L"setuplog.dat"); + oldlog = SwLoadLogFile(sw, setuplog); + if (oldlog != NULL) + { + SwPerformPrint(wp, _UU("SW_PERFORM_MSG_DELETE_OLD_LINKS")); + + SwDeleteShortcuts(oldlog); + + SwFreeLogFile(oldlog); + } + + // Remove only the shortcut setup log from the current log + o = NewListFast(NULL); + + for (i = 0;i < LIST_NUM(sw->LogFile->LogList);i++) + { + SW_LOG *g = LIST_DATA(sw->LogFile->LogList, i); + + if (g->Type == SW_LOG_TYPE_LNK || g->Type == SW_LOG_TYPE_LNK_DIR) + { + Add(o, g); + } + } + + for (i = 0;i < LIST_NUM(o);i++) + { + SW_LOG *g = LIST_DATA(o, i); + + Delete(sw->LogFile->LogList, g); + + Free(g); + } + + ReleaseList(o); + + for (i = 0;i < LIST_NUM(t->LinkTasks);i++) + { + SW_TASK_LINK *lt = LIST_DATA(t->LinkTasks, i); + wchar_t lnk_fullpath[MAX_SIZE]; + wchar_t lnk_dirname[MAX_SIZE]; + wchar_t target_fullpath[MAX_SIZE]; + wchar_t target_dirname[MAX_SIZE]; + wchar_t icon_fullpath[MAX_SIZE]; + +L_RETRY_LINK: + + SwPerformPrint(wp, _UU("SW_PERFORM_MSG_CREATE_LINKS")); + + // Generate the full path of the LNK file + CombinePathW(lnk_fullpath, sizeof(lnk_fullpath), lt->DestDir, lt->DestName); + UniStrCat(lnk_fullpath, sizeof(lnk_fullpath), L".lnk"); + + // Get the directory name to be saved the LNK file + GetDirNameFromFilePathW(lnk_dirname, sizeof(lnk_dirname), lnk_fullpath); + + // Generate the full path to the link destination + CombinePathW(target_fullpath, sizeof(target_fullpath), lt->TargetDir, lt->TargetExe); + + // Create the full path of the icon + CombinePathW(icon_fullpath, sizeof(icon_fullpath), lt->TargetDir, lt->IconExe); + + // Get the directory name of the full path to the link destination + GetDirNameFromFilePathW(target_dirname, sizeof(target_dirname), target_fullpath); + + // Create a directory + MakeDirExW(lnk_dirname); + if (lt->NoDeleteDir == false) + { + SwAddLog(sw, sw->LogFile, SW_LOG_TYPE_LNK_DIR, lnk_dirname); + } + + // Create the LNK file + if (CreateLink(lnk_fullpath, target_fullpath, target_dirname, lt->TargetArg, + lt->DestDescription, icon_fullpath, lt->IconIndex) == false) + { + // Show the error message if it fails + UINT msgret; + UniFormat(tmp, sizeof(tmp), _UU("SW_PERFORM_MSG_CREATE_LINK_ERROR"), lnk_fullpath); + msgret = SwPerformMsgBox(wp, MB_ICONEXCLAMATION | MB_YESNO, tmp); + + if (msgret == IDYES) + { + // Retry + goto L_RETRY_LINK; + } + } + else + { + SwAddLog(sw, sw->LogFile, SW_LOG_TYPE_LNK, lnk_fullpath); + } + } +} + +// Search component +SW_COMPONENT *SwFindComponent(SW *sw, char *name) +{ + UINT i; + // Validate arguments + if (sw == NULL || IsEmptyStr(name)) + { + return NULL; + } + + for (i = 0;i < LIST_NUM(sw->ComponentList);i++) + { + SW_COMPONENT *c = LIST_DATA(sw->ComponentList, i); + + if (StrCmpi(c->Name, name) == 0) + { + return c; + } + } + + return NULL; +} + +// Release the log file +void SwFreeLogFile(SW_LOGFILE *logfile) +{ + UINT i; + // Validate arguments + if (logfile == NULL) + { + return; + } + + for (i = 0;i < LIST_NUM(logfile->LogList);i++) + { + SW_LOG *g = LIST_DATA(logfile->LogList, i); + + Free(g); + } + + ReleaseList(logfile->LogList); + + Free(logfile); +} + +// Create a new log file +SW_LOGFILE *SwNewLogFile() +{ + SW_LOGFILE *logfile = ZeroMalloc(sizeof(SW_LOGFILE)); + + logfile->LogList = NewListFast(NULL); + + return logfile; +} + +// Read the log file +SW_LOGFILE *SwLoadLogFile(SW *sw, wchar_t *filename) +{ + FOLDER *r = NULL; + FOLDER *items = NULL; + FOLDER *info = NULL; + UINT i; + TOKEN_LIST *t = NULL; + bool is_system_mode = false; + char component_name[MAX_SIZE] = { 0 }; + UINT build; + SW_COMPONENT *c = NULL; + SW_LOGFILE *ret = NULL; + // Validate arguments + if (sw == NULL || filename == NULL) + { + return NULL; + } + + r = CfgReadW(filename); + if (r == NULL) + { + goto LABEL_CLEANUP; + } + + items = CfgGetFolder(r, "Items"); + info = CfgGetFolder(r, "Info"); + if (items == NULL || info == NULL) + { + goto LABEL_CLEANUP; + } + + t = CfgEnumFolderToTokenList(items); + if (t == NULL) + { + goto LABEL_CLEANUP; + } + + // Mode and components + is_system_mode = CfgGetBool(info, "IsSystemMode"); + CfgGetStr(info, "ComponentName", component_name, sizeof(component_name)); + build = CfgGetInt(info, "Build"); + + if (build == 0) + { + goto LABEL_CLEANUP; + } + + c = SwFindComponent(sw, component_name); + if (c == NULL) + { + goto LABEL_CLEANUP; + } + + ret = ZeroMalloc(sizeof(SW_LOGFILE)); + ret->IsSystemMode = is_system_mode; + ret->Component = c; + ret->Build = build; + ret->LogList = NewListFast(NULL); + + // Item List + for (i = 0;i < t->NumTokens;i++) + { + char *name = t->Token[i]; + FOLDER *f = CfgGetFolder(items, name); + + if (f != NULL) + { + UINT type = CfgGetInt(f, "Type"); + wchar_t value[MAX_SIZE]; + + if (CfgGetUniStr(f, "Path", value, sizeof(value))) + { + if (IsEmptyUniStr(value) == false && type != 0) + { + SW_LOG *g = ZeroMalloc(sizeof(SW_LOG)); + + g->Type = type; + UniStrCpy(g->Path, sizeof(g->Path), value); + + Add(ret->LogList, g); + } + } + } + } + +LABEL_CLEANUP: + if (r != NULL) + { + CfgDeleteFolder(r); + } + + if (t != NULL) + { + FreeToken(t); + } + + return ret; +} + +// Save the log file +bool SwSaveLogFile(SW *sw, wchar_t *dst_name, SW_LOGFILE *logfile) +{ + FOLDER *r; + FOLDER *items; + FOLDER *info; + UINT i; + bool ret; + // Validate arguments + if (sw == NULL || dst_name == NULL || logfile == NULL) + { + return false; + } + + r = CfgCreateRoot(); + + items = CfgCreateFolder(r, "Items"); + + info = CfgCreateFolder(r, "Info"); + + CfgAddBool(info, "IsSystemMode", logfile->IsSystemMode); + CfgAddStr(info, "ComponentName", logfile->Component->Name); + CfgAddInt(info, "Build", logfile->Build); + + for (i = 0;i < LIST_NUM(logfile->LogList);i++) + { + FOLDER *f; + SW_LOG *g = LIST_DATA(logfile->LogList, i); + char name[MAX_PATH]; + + Format(name, sizeof(name), "Item%04u", i); + + f = CfgCreateFolder(items, name); + + CfgAddInt(f, "Type", g->Type); + CfgAddUniStr(f, "Path", g->Path); + } + + ret = CfgSaveExW3(NULL, r, dst_name, NULL, true); + + CfgDeleteFolder(r); + + return ret; +} + +// Display the string to the status screen +void SwPerformPrint(WIZARD_PAGE *wp, wchar_t *str) +{ + SW_UI ui; + // Validate arguments + if (wp == NULL || str == NULL) + { + return; + } + + Zero(&ui, sizeof(ui)); + ui.Type = SW_UI_TYPE_PRINT; + ui.Message = str; + + SwInteractUi(wp, &ui); +} + +// Show a message box on the screen +UINT SwPerformMsgBox(WIZARD_PAGE *wp, UINT flags, wchar_t *msg) +{ + SW_UI ui; + // Validate arguments + if (wp == NULL || msg == NULL) + { + return 0; + } + + Zero(&ui, sizeof(ui)); + ui.Type = SW_UI_TYPE_MSGBOX; + ui.Message = msg; + ui.Param = flags; + + return SwInteractUi(wp, &ui); +} + +// Call the UI interaction +UINT SwInteractUi(WIZARD_PAGE *wp, SW_UI *ui) +{ + // Validate arguments + if (wp == NULL || ui == NULL) + { + return 0; + } + + SendMsg(wp->hWndPage, 0, WM_SW_INTERACT_UI, 0xCAFE, (LPARAM)ui); + + SleepThread(50); + + return ui->RetCode; +} + +// UI interaction is called +void SwInteractUiCalled(HWND hWnd, SW *sw, WIZARD_PAGE *wp, SW_UI *ui) +{ + // Validate arguments + if (hWnd == NULL || sw == NULL || wp == NULL || ui == NULL) + { + return; + } + + switch (ui->Type) + { + case SW_UI_TYPE_PRINT: // Display the message + SetText(hWnd, S_STATUS, ui->Message); + break; + + case SW_UI_TYPE_MSGBOX: // Show a message box + ui->RetCode = MsgBox(hWnd, ui->Param, ui->Message); + break; + + case SW_UI_TYPE_FINISH: // Complete + PostMessageA(hWnd, WM_SW_EXIT, 0xCAFE, 1); + break; + + case SW_UI_TYPE_ERROR: // Error + PostMessageA(hWnd, WM_SW_EXIT, 0xCAFE, 0); + break; + } +} + +// Initialize the setup process screen +void SwPerformInit(HWND hWnd, SW *sw, WIZARD_PAGE *wp) +{ + // Validate arguments + if (hWnd == NULL || sw == NULL || wp == NULL) + { + return; + } + + DlgFont(hWnd, S_INFO, 10, true); + + if (sw->EasyMode) + { + SetIcon(hWnd, S_ICON, ICO_SETUP); + + SetText(hWnd, S_INFO, _UU("SW_PERFORM_MSG_EASY_INFO")); + } + else if (sw->WebMode) + { + SetIcon(hWnd, S_ICON, ICO_SETUP); + + SetText(hWnd, S_INFO, _UU("SW_PERFORM_MSG_WEB_INFO")); + } + else + { + SetIcon(hWnd, S_ICON, sw->CurrentComponent->Icon); + + FormatText(hWnd, S_INFO, sw->CurrentComponent->Title); + } + + SetTextA(hWnd, S_STATUS, ""); + + if (MsIsWinXPOrWinVista()) + { + // Display the progress bar for Windows XP or later + SendMsg(hWnd, IDC_PROGRESS1, PBM_SETMARQUEE, TRUE, 100); + SetStyle(hWnd, IDC_PROGRESS1, PBS_MARQUEE); + } + else + { + // Hide the progress bar in the case of Windows 2000 or earlier + Hide(hWnd, IDC_PROGRESS1); + } +} + +// Do the set-up process +UINT SwPerform(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, WIZARD *wizard, WIZARD_PAGE *wizard_page, void *param) +{ + SW *sw = (SW *)param; + // Validate arguments + if (hWnd == NULL || sw == NULL) + { + return 0; + } + + switch (msg) + { + case WM_INITDIALOG: + SwPerformInit(hWnd, sw, wizard_page); + break; + + case WM_WIZ_SHOW: + SetWizardButton(wizard_page, false, false, false, false); + + SetTimer(hWnd, 1, 100, NULL); + break; + + case WM_TIMER: + KillTimer(hWnd, 1); + + // Main thread execution + if (sw->PerformThread == NULL) + { + sw->PerformThread = NewThread(SwPerformThread, wizard_page); + } + break; + + case WM_WIZ_HIDE: + break; + + case WM_CLOSE: + break; + + case WM_WIZ_NEXT: + break; + + case WM_WIZ_BACK: + break; + + case WM_SW_INTERACT_UI: + // UI interaction is called + if (wParam == 0xCAFE) + { + SwInteractUiCalled(hWnd, sw, wizard_page, (SW_UI *)lParam); + } + break; + + case WM_COMMAND: + switch (wParam) + { + } + break; + + case WM_SW_EXIT: + // Close this screen since the process completed + if (wParam == 0xCAFE) + { + JumpWizard(wizard_page, (lParam == 0 ? D_SW_ERROR : D_SW_FINISH)); + + if (sw->PerformThread != NULL) + { + WaitThread(sw->PerformThread, INFINITE); + ReleaseThread(sw->PerformThread); + sw->PerformThread = NULL; + } + } + break; + } + + return 0; +} + +// Final confirmation screen +UINT SwReady(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, WIZARD *wizard, WIZARD_PAGE *wizard_page, void *param) +{ + SW *sw = (SW *)param; + // Validate arguments + if (hWnd == NULL || sw == NULL) + { + return 0; + } + + switch (msg) + { + case WM_INITDIALOG: + FormatText(hWnd, S_INFO, sw->CurrentComponent->Title); + break; + + case WM_WIZ_SHOW: + SetWizardButton(wizard_page, true, true, true, false); + break; + + case WM_WIZ_HIDE: + break; + + case WM_CLOSE: + break; + + case WM_WIZ_NEXT: + return D_SW_PERFORM; + + case WM_WIZ_BACK: + return D_SW_DIR; + + case WM_COMMAND: + switch (wParam) + { + } + break; + } + + return 0; +} + +// Uninstall all the old MSI products +bool SwUninstallOldMsiInstalled(HWND hWnd, WIZARD_PAGE *wp, SW_COMPONENT *c, bool *reboot_required) +{ + UINT i; + bool dummy_bool = false; + // Validate arguments + if (c == NULL || wp == NULL) + { + return true; + } + if (reboot_required == NULL) + { + reboot_required = &dummy_bool; + } + + *reboot_required = false; + + if (c->OldMsiList == NULL) + { + return true; + } + + for (i = 0;i < c->NumOldMsi;i++) + { + SW_OLD_MSI *m = &c->OldMsiList[i]; + wchar_t tmp[MAX_SIZE]; + + if (MsGetMsiInstalledDir(m->ComponentCode, tmp, sizeof(tmp))) + { + bool rr = false; + wchar_t msg[MAX_SIZE]; + +LABEL_RETRY: + + UniFormat(msg, sizeof(msg), _UU("SW_PERFORM_MSG_UNINSTALL_MSI"), c->Title); + SwPerformPrint(wp, msg); + + if (MsMsiUninstall(m->ProductCode, hWnd, &rr) == false) + { + UniFormat(msg, sizeof(msg), _UU("SW_MSI_UNINSTALL_FAILED"), c->Title, m->ProductCode); + + if (SwPerformMsgBox(wp, MB_ICONEXCLAMATION | MB_RETRYCANCEL, msg) == IDRETRY) + { + goto LABEL_RETRY; + } + + return false; + } + else + { + if (rr) + { + *reboot_required = true; + return true; + } + } + } + } + + return true; +} + +// Get the directory where the old MSI products are installed +wchar_t *SwGetOldMsiInstalledDir(SW_COMPONENT *c) +{ + UINT i; + // Validate arguments + if (c == NULL) + { + return NULL; + } + + if (c->OldMsiList == NULL) + { + return NULL; + } + + for (i = 0;i < c->NumOldMsi;i++) + { + SW_OLD_MSI *m = &c->OldMsiList[i]; + wchar_t tmp[MAX_SIZE]; + + if (MsGetMsiInstalledDir(m->ComponentCode, tmp, sizeof(tmp))) + { + return UniCopyStr(tmp); + } + } + + return NULL; +} + +// Initialize the default installation directory +void SwInitDefaultInstallDir(SW *sw) +{ + char keyname[MAX_SIZE]; + wchar_t *reg_dir_system; + wchar_t *reg_dir_user; + wchar_t *msi_dir_system = NULL; + // Validate arguments + if (sw == NULL) + { + return; + } + + msi_dir_system = SwGetOldMsiInstalledDir(sw->CurrentComponent); + + Format(keyname, sizeof(keyname), "%s\\%s", SW_REG_KEY, sw->CurrentComponent->Name); + + if (UniIsEmptyStr(msi_dir_system) == false) + { + MsRegWriteStrEx2W(REG_LOCAL_MACHINE, keyname, "InstalledDir", msi_dir_system, false, true); + } + + reg_dir_system = MsRegReadStrEx2W(REG_LOCAL_MACHINE, keyname, "InstalledDir", false, true); + reg_dir_user = MsRegReadStrEx2W(REG_CURRENT_USER, keyname, "InstalledDir", false, true); + + // Generate a directory name in the case of system mode + CombinePathW(sw->DefaultInstallDir_System, sizeof(sw->DefaultInstallDir_System), + MsGetProgramFilesDirX64W(), sw->CurrentComponent->DefaultDirName); + + // Generate a directory name in the case of user mode + CombinePathW(sw->DefaultInstallDir_User, sizeof(sw->DefaultInstallDir_User), + MsGetPersonalAppDataDirW(), sw->CurrentComponent->DefaultDirName); + + if (UniIsEmptyStr(reg_dir_system) == false) + { + UniStrCpy(sw->DefaultInstallDir_System, sizeof(sw->DefaultInstallDir_System), reg_dir_system); + } + + if (UniIsEmptyStr(reg_dir_user) == false) + { + UniStrCpy(sw->DefaultInstallDir_User, sizeof(sw->DefaultInstallDir_User), reg_dir_user); + } + + if (MsIsNt() == false) + { + // Set to system mode for Win9x + sw->IsSystemMode = true; + } + + if (MsIsAdmin() == false) + { + sw->IsAvailableSystemMode = false; + sw->IsAvailableUserMode = true; + } + else if (MsIsNt() == false) + { + sw->IsAvailableSystemMode = true; + sw->IsAvailableUserMode = false; + } + else + { + sw->IsAvailableSystemMode = true; + sw->IsAvailableUserMode = !sw->CurrentComponent->SystemModeOnly; + } + + sw->ShowWarningForUserMode = sw->CurrentComponent->InstallService; + + Free(reg_dir_system); + Free(reg_dir_user); + Free(msi_dir_system); +} + +// Update the installation directory setting screen +void SwDirUpdate(HWND hWnd, SW *sw, WIZARD_PAGE *wizard_page) +{ + bool user_mode_selected; + bool show_custom; + bool change_dir; + // Validate arguments + if (hWnd == NULL || sw == NULL || wizard_page == NULL) + { + return; + } + + change_dir = IsChecked(hWnd, R_CUSTOM); + + SetShow(hWnd, S_DEST, change_dir); + SetShow(hWnd, E_DIR, change_dir); + SetShow(hWnd, B_BROWSE, change_dir); + + show_custom = IsChecked(hWnd, R_SHOWCUSTOM); + + SetShow(hWnd, R_FOR_SYSTEM, show_custom); + SetShow(hWnd, R_FOR_USER, show_custom); + + user_mode_selected = IsChecked(hWnd, R_FOR_USER); + + SetText(hWnd, R_DEFAULT, user_mode_selected ? sw->DefaultInstallDir_User : sw->DefaultInstallDir_System); + + if (user_mode_selected == false) + { + Hide(hWnd, S_WARNING); + Hide(hWnd, S_WARNING2); + } + else + { + SetShow(hWnd, S_WARNING, sw->ShowWarningForUserMode); + SetShow(hWnd, S_WARNING2, sw->ShowWarningForUserMode); + } + + SetEnable(hWnd, R_SHOWCUSTOM, !user_mode_selected); + + DlgFont(hWnd, R_DEFAULT, 0, !change_dir); +} + +// Check the directory name planned to be created newly +bool SwCheckNewDirName(wchar_t *name) +{ + char tmp[MAX_SIZE]; + UCHAR rand[16]; + wchar_t testname[MAX_SIZE]; + IO *io; + bool new_dir; + // Validate arguments + if (name == NULL) + { + return false; + } + + // Create a directory + new_dir = MakeDirExW(name); + + // Writes the appropriate files + Rand(rand, sizeof(rand)); + BinToStr(tmp, sizeof(tmp), rand, sizeof(rand)); + UniFormat(testname, sizeof(testname), L"%s\\%S.dat", name, tmp); + + io = FileCreateW(testname); + + if (io == NULL) + { + return false; + } + + FileClose(io); + + FileDeleteW(testname); + + if (new_dir) + { + DeleteDirW(name); + } + + return true; +} + +// Set the installation directory +UINT SwDir(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, WIZARD *wizard, WIZARD_PAGE *wizard_page, void *param) +{ + SW *sw = (SW *)param; + wchar_t tmp[MAX_SIZE]; + wchar_t setuplog[MAX_SIZE]; + wchar_t *s; + SW_LOGFILE *logfile; + bool is_system_mode; + bool skip_ver_check = false; + // Validate arguments + if (hWnd == NULL || sw == NULL) + { + return 0; + } + + switch (msg) + { + case WM_INITDIALOG: + SetIcon(hWnd, S_ICON, sw->CurrentComponent->Icon); + + SwInitDefaultInstallDir(sw); + + FormatText(hWnd, S_INFO, sw->CurrentComponent->Title); + FormatText(hWnd, R_FOR_USER, MsGetUserNameW()); + FormatText(hWnd, S_WARNING, MsGetUserNameW(), sw->CurrentComponent->Title); + + Check(hWnd, R_FOR_SYSTEM, sw->IsSystemMode); + Check(hWnd, R_FOR_USER, !sw->IsSystemMode); + + if (sw->IsSystemMode == false) + { + Check(hWnd, R_SHOWCUSTOM, true); + } + + SetText(hWnd, E_DIR, sw->IsSystemMode ? sw->DefaultInstallDir_System : sw->DefaultInstallDir_User); + + Check(hWnd, R_DEFAULT, true); + + SetEnable(hWnd, R_FOR_SYSTEM, sw->IsAvailableSystemMode); + SetEnable(hWnd, R_FOR_USER, sw->IsAvailableUserMode); + + SwDirUpdate(hWnd, sw, wizard_page); + + break; + + case WM_WIZ_SHOW: + SetWizardButton(wizard_page, true, false, true, false); + + SwDirUpdate(hWnd, sw, wizard_page); + break; + + case WM_WIZ_HIDE: + break; + + case WM_CLOSE: + break; + + case WM_WIZ_NEXT: + if (IsChecked(hWnd, R_CUSTOM)) + { + GetTxt(hWnd, E_DIR, tmp, sizeof(tmp)); + } + else + { + if (IsChecked(hWnd, R_FOR_SYSTEM)) + { + UniStrCpy(tmp, sizeof(tmp), sw->DefaultInstallDir_System); + } + else + { + UniStrCpy(tmp, sizeof(tmp), sw->DefaultInstallDir_User); + } + } + + is_system_mode = IsChecked(hWnd, R_FOR_SYSTEM); + + if (is_system_mode == false) + { + if (sw->CurrentComponent->InstallService) + { + if (MsIsServiceInstalled(sw->CurrentComponent->SvcName)) + { + // If the type of installation is user mode and the same software + // is running in system mode already, warn about it + if (MsgBoxEx(hWnd, MB_ICONEXCLAMATION | MB_YESNO | MB_DEFBUTTON2, _UU("SW_SYSTEM_MODE_ALREADY_INSTALLED"), + sw->CurrentComponent->Title) == IDNO) + { + break; + } + } + } + } + + UniTrim(tmp); + + Win32NukuEnW(tmp, sizeof(tmp), tmp); + + // Check Length + if (UniStrLen(tmp) > 110) + { + MsgBox(hWnd, MB_ICONEXCLAMATION, _UU("SW_DIR_MORE_THAN_110")); + FocusEx(hWnd, E_DIR); + break; + } + + // Check whether it's a full path + if (UniStartWith(tmp, L"\\\\") == false && + (tmp[1] != L':' || tmp[2] != L'\\')) + { + MsgBoxEx(hWnd, MB_ICONEXCLAMATION, _UU("SW_DIR_IS_NOT_FULLPATH"), tmp); + FocusEx(hWnd, E_DIR); + break; + } + + NormalizePathW(tmp, sizeof(tmp), tmp); + + // Check the type of the drive + if (IsChecked(hWnd, R_FOR_SYSTEM)) + { + // System mode service is installed only on the hard disk + bool ok = true; + + if (UniStartWith(tmp, L"\\\\")) + { + ok = false; + } + else + { + char tmpa[MAX_SIZE]; + UINT ret; + + UniToStr(tmpa, sizeof(tmpa), tmp); + + tmpa[3] = 0; + + ret = GetDriveTypeA(tmpa); + + if (ret != DRIVE_FIXED && ret != DRIVE_RAMDISK) + { + ok = false; + } + } + + if (ok == false) + { + MsgBoxEx(hWnd, MB_ICONEXCLAMATION, _UU("SW_DIR_IS_NOT_HDD"), tmp, sw->CurrentComponent->Title); + FocusEx(hWnd, E_DIR); + break; + } + } + + // Write check + if (SwCheckNewDirName(tmp) == false) + { + MsgBoxEx(hWnd, MB_ICONEXCLAMATION, _UU("SW_DIR_WRITE_ERROR"), tmp); + FocusEx(hWnd, E_DIR); + break; + } + + // Analyze if there is a setuplog.dat on destination + CombinePathW(setuplog, sizeof(setuplog), tmp, L"setuplog.dat"); + logfile = SwLoadLogFile(sw, setuplog); + if (logfile == NULL && IsFileExistsW(setuplog)) + { + MsgBoxEx(hWnd, MB_ICONEXCLAMATION, _UU("SW_DIR_DST_IS_BROKEN"), setuplog); + FocusEx(hWnd, E_DIR); + break; + } + + if (logfile != NULL && (logfile->Build > CEDAR_VERSION_BUILD) && UniIsEmptyStr(sw->auto_setting_path) == false && + sw->CurrentComponent->Id == SW_CMP_VPN_CLIENT && logfile->Component->Id == SW_CMP_VPN_CLIENT) + { + // In the case of the VPN Client, show a message if a newer version is installed and + // the automatic connection setting by simple installer should be applied + if (MsgBox(hWnd, MB_ICONINFORMATION | MB_OKCANCEL, _UU("SW_DIR_DST_IS_NEWER_2")) == IDCANCEL) + { + // Cancel + FocusEx(hWnd, E_DIR); + break; + } + + skip_ver_check = true; + } + + if (logfile != NULL) + { + wchar_t *errmsg = NULL; + if (logfile->Component != sw->CurrentComponent) + { + errmsg = _UU("SW_DIR_DST_IS_OTHER_PRODUCT"); + } + else if ((skip_ver_check == false) && (logfile->Build > CEDAR_VERSION_BUILD)) + { + errmsg = _UU("SW_DIR_DST_IS_NEWER"); + } + else if (logfile->IsSystemMode && is_system_mode == false) + { + errmsg = _UU("SW_DIR_DST_IS_SYSTEM_MODE"); + } + else if (logfile->IsSystemMode == false && is_system_mode) + { + errmsg = _UU("SW_DIR_DST_IS_USER_MODE"); + } + + SwFreeLogFile(logfile); + + if (errmsg != NULL) + { + MsgBox(hWnd, MB_ICONEXCLAMATION, errmsg); + FocusEx(hWnd, E_DIR); + break; + } + } + + // Check whether installation destination and installation source are not same + if (UniStrCmpi(tmp, sw->InstallSrc) == 0) + { + MsgBoxEx(hWnd, MB_ICONEXCLAMATION, _UU("SW_DIR_DST_IS_SAME_TO_SRC"), tmp); + FocusEx(hWnd, E_DIR); + break; + } + + UniStrCpy(sw->InstallDir, sizeof(sw->InstallDir), tmp); + sw->IsSystemMode = IsChecked(hWnd, R_FOR_SYSTEM); + + sw->OnlyAutoSettingMode = skip_ver_check; + + return D_SW_READY; + + case WM_WIZ_BACK: + break; + + case WM_COMMAND: + switch (wParam) + { + case R_DEFAULT: + case R_CUSTOM: + case R_SHOWCUSTOM: + case R_FOR_SYSTEM: + case R_FOR_USER: + SwDirUpdate(hWnd, sw, wizard_page); + break; + } + + switch (wParam) + { + case R_FOR_SYSTEM: + SetText(hWnd, E_DIR, sw->DefaultInstallDir_System); + break; + + case R_FOR_USER: + SetText(hWnd, E_DIR, sw->DefaultInstallDir_User); + break; + + case B_BROWSE: + GetTxt(hWnd, E_DIR, tmp, sizeof(tmp)); + s = FolderDlgW(hWnd, _UU("SW_DIR_SELECT"), tmp); + + if (s != NULL) + { + if (UniEndWith(s, sw->CurrentComponent->DefaultDirName)) + { + UniStrCpy(tmp, sizeof(tmp), s); + } + else + { + CombinePathW(tmp, sizeof(tmp), s, sw->CurrentComponent->DefaultDirName); + } + + SetText(hWnd, E_DIR, tmp); + FocusEx(hWnd, E_DIR); + + Free(s); + } + break; + } + + break; + } + + return 0; +} + +// Warning screen +UINT SwWarning(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, WIZARD *wizard, WIZARD_PAGE *wizard_page, void *param) +{ + SW *sw = (SW *)param; + BUF *b; + UCHAR c = 0; + wchar_t *str; + char warning_filename[MAX_PATH]; + LANGLIST t; + // Validate arguments + if (hWnd == NULL || sw == NULL) + { + return 0; + } + + switch (msg) + { + case WM_INITDIALOG: + break; + + case WM_WIZ_SHOW: + DlgFont(hWnd, B_AGREE, 0, true); + + GetCurrentLang(&t); + + SetFont(hWnd, E_TEXT, GetFont((t.Id == SE_LANG_JAPANESE && MsIsWindows7()) ? "Meiryo UI" : NULL, 10, false , false, false, false)); + + Format(warning_filename, sizeof(warning_filename), "|warning_%s.txt", t.Name); + b = ReadDump(warning_filename); + + SeekBuf(b, b->Size, 0); + c = 0; + WriteBuf(b, &c, 1); + + str = CopyUtfToUni(b->Buf); + + UniIsEmptyStr(str); + + SetText(hWnd, E_TEXT, str); + + FreeBuf(b); + + Free(str); + + UnselectEdit(hWnd, E_TEXT); + + Focus(hWnd, E_TEXT); + + SetWizardButton(wizard_page, true, true, true, false); + break; + + case WM_WIZ_HIDE: + break; + + case WM_CLOSE: + break; + + case WM_WIZ_NEXT: + if (SwEnterSingle(sw) == false) + { + // Multiple-starts prevention + MsgBox(hWnd, MB_ICONINFORMATION, _UU("SW_OTHER_INSTANCE_EXISTS")); + break; + } + return D_SW_DIR; + + case WM_WIZ_BACK: + return D_SW_EULA; + + case WM_COMMAND: + break; + } + + return 0; +} + +// Update the license agreement screen +void SwEulaUpdate(HWND hWnd, SW *sw, WIZARD *wizard, WIZARD_PAGE *wizard_page) +{ + // Validate arguments + if (hWnd == NULL || sw == NULL || wizard == NULL || wizard_page == NULL) + { + return; + } + + sw->EulaAgreed = IsChecked(hWnd, B_AGREE); + + if (sw->EulaAgreed == false) + { + // Delete the agreement record in the case of non-agreement for the EULA + MsRegDeleteValueEx2(REG_CURRENT_USER, SW_REG_KEY_EULA, sw->CurrentComponent->Name, false, true); + } + + SetWizardButton(wizard_page, sw->EulaAgreed, true, true, false); +} + +// License Agreement +UINT SwEula(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, WIZARD *wizard, WIZARD_PAGE *wizard_page, void *param) +{ + SW *sw = (SW *)param; + BUF *b; + UCHAR c = 0; + wchar_t *str; + // Validate arguments + if (hWnd == NULL || sw == NULL) + { + return 0; + } + + switch (msg) + { + case WM_INITDIALOG: + break; + + case WM_WIZ_SHOW: + SetFont(hWnd, E_TEXT, GetFont((MsIsWindows7() ? "Segoe UI" : "Verdana"), 10, false, false, false, false)); + //DlgFont(hWnd, B_AGREE, 10, true); + + b = ReadDump("|eula.txt"); + + SeekBuf(b, b->Size, 0); + c = 0; + WriteBuf(b, &c, 1); + + str = CopyUtfToUni(b->Buf); + + UniIsEmptyStr(str); + + SetText(hWnd, E_TEXT, str); + + sw->CurrentEulaHash = HashToUINT(b->Buf, b->Size); + + FreeBuf(b); + + Free(str); + + if (sw->CurrentComponent != NULL && sw->CurrentEulaHash != 0 && sw->CurrentEulaHash == MsRegReadIntEx2(REG_CURRENT_USER, SW_REG_KEY_EULA, sw->CurrentComponent->Name, false, true)) + { + // Check the consent check box in advance if the user accepts the same EULA during the last installation + sw->EulaAgreed = true; + } + + Check(hWnd, B_AGREE, sw->EulaAgreed); + + UnselectEdit(hWnd, E_TEXT); + + Focus(hWnd, E_TEXT); + + SwEulaUpdate(hWnd, sw, wizard, wizard_page); + break; + + case WM_WIZ_HIDE: + break; + + case WM_CLOSE: + break; + + case WM_WIZ_NEXT: + SwEulaUpdate(hWnd, sw, wizard, wizard_page); + + if (sw->EulaAgreed) + { + return D_SW_WARNING; + } + break; + + case WM_WIZ_BACK: + sw->EulaAgreed = false; + return D_SW_COMPONENTS; + + case WM_COMMAND: + switch (wParam) + { + case B_AGREE: + SwEulaUpdate(hWnd, sw, wizard, wizard_page); + break; + } + break; + } + + return 0; +} + +// Initialize a component list +void SwComponentsInit(HWND hWnd, SW *sw) +{ + LVB *b; + UINT i; + SW_COMPONENT *default_select = NULL; + // Validate arguments + if (hWnd == NULL || sw == NULL) + { + return; + } + + LvReset(hWnd, L_LIST); + + b = LvInsertStart(); + + for (i = 0;i < LIST_NUM(sw->ComponentList);i++) + { + SW_COMPONENT *c = LIST_DATA(sw->ComponentList, i); + + if (c->Detected) + { + wchar_t tmp[MAX_SIZE]; + + UniFormat(tmp, sizeof(tmp), L" %s", c->Title); + + LvInsertAdd(b, c->Icon, c, 1, tmp); + + if (c->SystemModeOnly == false || MsIsAdmin()) + { + if (default_select == NULL) + { + default_select = c; + } + } + } + } + + LvInsertEnd(b, hWnd, L_LIST); + + if (sw->CurrentComponent == NULL) + { + LvSelectByParam(hWnd, L_LIST, default_select); + } + else + { + LvSelectByParam(hWnd, L_LIST, sw->CurrentComponent); + } + + Focus(hWnd, L_LIST); +} + +// Update the Component Selection screen +void SwComponentsUpdate(HWND hWnd, SW *sw, WIZARD *wizard, WIZARD_PAGE *wizard_page) +{ + SW_COMPONENT *c; + // Validate arguments + if (hWnd == NULL || sw == NULL || wizard == NULL || wizard_page == NULL) + { + return; + } + + c = (SW_COMPONENT *)LvGetSelectedParam(hWnd, L_LIST); + + if (c == NULL) + { + Hide(hWnd, S_TITLE); + Hide(hWnd, S_DESCRIPTION); + Hide(hWnd, S_ICON); + + SetWizardButton(wizard_page, false, true, true, false); + } + else + { + wchar_t tmp[MAX_SIZE]; + + if (c->SystemModeOnly && MsIsAdmin() == false) + { + // Components to be installed only in system mode is set to unselectable + SetText(hWnd, S_TITLE, _UU("SW_COMPONENTS_REQUIRE_ADMIN")); + UniFormat(tmp, sizeof(tmp), _UU("SW_COMPONENTS_REQUIRE_ADMIN_TEXT"), c->Title); + SetText(hWnd, S_DESCRIPTION, tmp); + SetIcon(hWnd, S_ICON, ICO_WARNING); + + SetWizardButton(wizard_page, false, true, true, false); + } + else + { + // Show the description of the component + UniFormat(tmp, sizeof(tmp), _UU("SW_COMPONENTS_ABOUT_TAG"), c->Title); + SetText(hWnd, S_TITLE, tmp); + SetText(hWnd, S_DESCRIPTION, c->Description); + SetIcon(hWnd, S_ICON, c->Icon); + + SetWizardButton(wizard_page, true, true, true, false); + } + + Show(hWnd, S_TITLE); + Show(hWnd, S_DESCRIPTION); + Show(hWnd, S_ICON); + } +} + +// Component selection screen +UINT SwComponents(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, WIZARD *wizard, WIZARD_PAGE *wizard_page, void *param) +{ + SW *sw = (SW *)param; + NMHDR *n; + SW_COMPONENT *c; + // Validate arguments + if (hWnd == NULL || sw == NULL) + { + return 0; + } + + switch (msg) + { + case WM_INITDIALOG: + LvInitEx2(hWnd, L_LIST, false, true); + + if (MsIsVista()) + { + SetFont(hWnd, L_LIST, GetMeiryoFontEx(12)); + SetFont(hWnd, S_TITLE, GetMeiryoFontEx(11)); + } + else + { + DlgFont(hWnd, L_LIST, 12, false); + DlgFont(hWnd, S_TITLE, 11, false); + } + + LvInsertColumn(hWnd, L_LIST, 0, L"Component", 515); + break; + + case WM_WIZ_SHOW: + SetWizardButton(wizard_page, true, true, true, false); + + SwComponentsInit(hWnd, sw); + + SwComponentsUpdate(hWnd, sw, wizard, wizard_page); + + break; + + case WM_WIZ_HIDE: + break; + + case WM_CLOSE: + break; + + case WM_WIZ_NEXT: + c = (SW_COMPONENT *)LvGetSelectedParam(hWnd, L_LIST); + + if (c != NULL) + { + if (SwCheckOs(sw, c) == false) + { + // OS Check Failed + MsgBoxEx(hWnd, MB_ICONEXCLAMATION, _UU("SW_OS_FAILED"), c->Title); + break; + } + + sw->CurrentComponent = c; + + if (sw->CurrentComponent->SystemModeOnly == false || MsIsAdmin()) + { + if (sw->CurrentComponent->Id == SW_CMP_VPN_SERVER && MsIsServiceInstalled(GC_SVC_NAME_VPNBRIDGE)) + { + // The user is trying to install the VPN Server but, VPN Bridge already exists + if (MsgBox(hWnd, MB_ICONEXCLAMATION | MB_YESNO | MB_DEFBUTTON2, _UU("SW_NOTICE_VPNBRIDGE_IS_INSTALLED")) == IDNO) + { + break; + } + } + else if (sw->CurrentComponent->Id == SW_CMP_VPN_BRIDGE && MsIsServiceInstalled(GC_SVC_NAME_VPNSERVER)) + { + // The user is trying to install the VPN Bridge, but a VPN Server already exists + if (MsgBox(hWnd, MB_ICONEXCLAMATION | MB_YESNO | MB_DEFBUTTON2, _UU("SW_NOTICE_VPNSERVER_IS_INSTALLED")) == IDNO) + { + break; + } + } + + // Continue + return D_SW_EULA; + } + } + break; + + case WM_WIZ_BACK: + if (MsIsAdmin()) + { + return D_SW_WELCOME; + } + else + { + return D_SW_MODE; + } + break; + + case WM_COMMAND: + switch (wParam) + { + } + break; + + case WM_NOTIFY: + n = (NMHDR *)lParam; + + switch (n->idFrom) + { + case L_LIST: + switch (n->code) + { + case LVN_ITEMCHANGED: + SwComponentsUpdate(hWnd, sw, wizard, wizard_page); + break; + } + break; + } + + break; + } + + return 0; +} + +// Screen that is displayed when the user don't have administrative privileges +UINT SwNotAdminDlg(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, WIZARD *wizard, WIZARD_PAGE *wizard_page, void *param) +{ + SW *sw = (SW *)param; + // Validate arguments + if (hWnd == NULL || sw == NULL) + { + return 0; + } + + switch (msg) + { + case WM_INITDIALOG: + break; + + case WM_WIZ_SHOW: + FormatText(hWnd, S_INFO, MsGetUserNameW()); + + SetShow(hWnd, S_INFO2, (sw->UninstallMode ? false : true)); + + SetWizardButton(wizard_page, true, ((sw->UninstallMode && sw->IsReExecForUac) ? false : true), true, true); + break; + + case WM_WIZ_HIDE: + break; + + case WM_CLOSE: + break; + + case WM_WIZ_NEXT: + break; + + case WM_WIZ_BACK: + if (sw->UninstallMode == false) + { + return D_SW_MODE; + } + else + { + return D_SW_UNINST1; + } + break; + + case WM_COMMAND: + switch (wParam) + { + } + break; + } + + return 0; +} + +// Choose the setup mode +UINT SwModeDlg(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, WIZARD *wizard, WIZARD_PAGE *wizard_page, void *param) +{ + SW *sw = (SW *)param; + // Validate arguments + if (hWnd == NULL || sw == NULL) + { + return 0; + } + + switch (msg) + { + case WM_INITDIALOG: + break; + + case WM_WIZ_SHOW: + SetWizardButton(wizard_page, true, true, true, false); + FormatText(hWnd, S_USER, MsGetUserNameW()); + + // Choose the initial state + Check(hWnd, R_SYSTEM, sw->IsSystemMode); + Check(hWnd, R_USER, !sw->IsSystemMode); + + Focus(hWnd, (sw->IsSystemMode ? R_SYSTEM : R_USER)); + + sw->DoubleClickBlocker = false; + SetUacIcon(hWnd, S_UAC); + + break; + + case WM_WIZ_HIDE: + break; + + case WM_CLOSE: + break; + + case WM_WIZ_NEXT: + // Mode + sw->IsSystemMode = IsChecked(hWnd, R_SYSTEM); + + if (sw->DoubleClickBlocker) + { + break; + } + + sw->DoubleClickBlocker = true; + + if (sw->IsSystemMode) + { + if (MsIsVista() && MsIsAdmin() == false && sw->IsReExecForUac == false) + { + // If UAC is available and this isn't invoked via UAC, + // give the user a chance to get administrator privileges on UAC start again + if (SwReExecMyself(sw, NULL, true)) + { + // Terminate itself if it succeeds to start the child process + CloseWizard(wizard_page); + } + else + { + // Jump to screen prompts to re-start as a administrator if it fails to start the child process + return D_SW_NOT_ADMIN; + } + } + else + { + if (MsIsAdmin()) + { + // Jump to the component list screen if the user has administrator privileges + return D_SW_COMPONENTS; + } + else + { + // Jump to screen prompts to re-start as a administrator if the user doesn't have administrator privileges + return D_SW_NOT_ADMIN; + } + } + } + else + { + // Jump to the component list screen + return D_SW_COMPONENTS; + } + + break; + + case WM_WIZ_BACK: + return D_SW_WELCOME; + + case WM_COMMAND: + switch (wParam) + { + } + break; + } + + return 0; +} + +// Welcome screen +UINT SwWelcomeDlg(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, WIZARD *wizard, WIZARD_PAGE *wizard_page, void *param) +{ + SW *sw = (SW *)param; + // Validate arguments + if (hWnd == NULL || sw == NULL) + { + return 0; + } + + switch (msg) + { + case WM_INITDIALOG: + break; + + case WM_WIZ_SHOW: + DlgFont(hWnd, S_WELCOME, 10, false); + DlgFont(hWnd, S_TITLE, 11, true); + SetWizardButtonEx(wizard_page, true, false, true, false, true); + + sw->DoubleClickBlocker = false; + + break; + + case WM_WIZ_HIDE: + break; + + case WM_CLOSE: + break; + + case WM_WIZ_NEXT: + if (MsIsKB3033929RequiredAndMissing()) + { + // KB3033929 is missing + if (MsgBoxEx(hWnd, MB_ICONINFORMATION | MB_OKCANCEL, _UU("SW_KB3033929_REQUIRED")) == IDCANCEL) + { + break; + } + } + + if (sw->DoubleClickBlocker) + { + break; + } + + sw->DoubleClickBlocker = true; + + if (MsIsAdmin() == false) + { + if (MsIsVista()) + { + if (sw->IsReExecForUac == false) + { + // If there is no Admin privileges in Vista or later, attempt to acquire Admin rights by UAC first during the first run + if (SwReExecMyself(sw, NULL, true)) + { + // Terminate itself if it succeeds to start the child process + CloseWizard(wizard_page); + break; + } + else + { + // Jump to mode selection screen if it fails to start the + // child process (including user presses the cancel of UAC) + return D_SW_MODE; + } + } + else + { + // Jump to mode selection screen when the user don't have Admin rights after being activated by UAC + return D_SW_MODE; + } + } + else + { + // Jump to the mode selection screen in the case of older than Vista + return D_SW_MODE; + } + } + else + { + // Skip to the component list screen if the user has Admin privileges + return D_SW_COMPONENTS; + } + break; + + case WM_WIZ_BACK: + break; + + case WM_COMMAND: + switch (wParam) + { + } + break; + } + + return 0; +} + +// Restart itself +bool SwReExecMyself(SW *sw, wchar_t *additional_params, bool as_admin) +{ + wchar_t *current_params; + wchar_t new_param[MAX_SIZE]; + void *handle; + bool ret = false; + // Validate arguments + if (sw == NULL) + { + return false; + } + if (sw->ReExecProcessHandle != NULL) + { + return false; + } + + current_params = GetCommandLineUniStr(); + + if (IsEmptyUniStr(additional_params)) + { + additional_params = L""; + } + + UniFormat(new_param, sizeof(new_param), L"%s %s %s", current_params, (as_admin ? L"/UAC:true" : L""), additional_params); + + UniTrim(new_param); + + handle = NULL; + ret = MsExecuteEx2W(MsGetExeFileNameW(), new_param, &handle, as_admin); + + Free(current_params); + + if (ret == false) + { + return false; + } + + sw->ReExecProcessHandle = handle; + + return true; +} + +// Show the UI +void SwUiMain(SW *sw) +{ + WIZARD *w; + wchar_t verstr[MAX_SIZE]; + char ver[MAX_SIZE]; + // Validate arguments + if (sw == NULL) + { + return; + } + + // Define the wizard UI + GetCedarVersion(ver, sizeof(ver)); + UniFormat(verstr, sizeof(verstr), _UU("SW_TITLE"), ver); + + w = NewWizard(ICO_SETUP, BMP_SELOGO49x49, verstr, sw); + + w->CloseConfirmMsg = _UU("SW_EXIT_CONFIRM"); + + AddWizardPage(w, NewWizardPage(D_SW_WELCOME, SwWelcomeDlg, _UU("SW_WELCOME_TITLE"))); + AddWizardPage(w, NewWizardPage(D_SW_MODE, SwModeDlg, _UU("SW_MODE_TITLE"))); + AddWizardPage(w, NewWizardPage(D_SW_NOT_ADMIN, SwNotAdminDlg, _UU("SW_NOT_ADMIN_TITLE"))); + AddWizardPage(w, NewWizardPage(D_SW_COMPONENTS, SwComponents, _UU("SW_COMPONENTS_TITLE"))); + AddWizardPage(w, NewWizardPage(D_SW_EULA, SwEula, _UU("SW_EULA_TITLE"))); + AddWizardPage(w, NewWizardPage(D_SW_WARNING, SwWarning, _UU("SW_WARNING_TITLE"))); + AddWizardPage(w, NewWizardPage(D_SW_DIR, SwDir, _UU("SW_DIR_TITLE"))); + AddWizardPage(w, NewWizardPage(D_SW_READY, SwReady, _UU("SW_READY_TITLE"))); + AddWizardPage(w, NewWizardPage(D_SW_PERFORM, SwPerform, _UU("SW_PERFORM_TITLE"))); + AddWizardPage(w, NewWizardPage(D_SW_ERROR, SwError, _UU("SW_ERROR_TITLE"))); + AddWizardPage(w, NewWizardPage(D_SW_FINISH, SwFinish, _UU("SW_FINISH_TITLE"))); + AddWizardPage(w, NewWizardPage(D_SW_UNINST1, SwUninst1, _UU("SW_UNINST1_TITLE"))); + AddWizardPage(w, NewWizardPage(D_SW_LANG1, SwLang1, _UU("SW_LANG1_TITLE"))); + AddWizardPage(w, NewWizardPage(D_SW_EASY1, SwEasy1, _UU("SW_EASY1_TITLE"))); + AddWizardPage(w, NewWizardPage(D_SW_EASY2, SwEasy2, _UU("SW_EASY2_TITLE"))); + AddWizardPage(w, NewWizardPage(D_SW_WEB1, SwWeb1, _UU("SW_WEB1_TITLE"))); + AddWizardPage(w, NewWizardPage(D_SW_WEB2, SwWeb2, _UU("SW_WEB2_TITLE"))); + + if (MsIsVista()) + { + w->IsAreoStyle = true; + } + + if (sw->UninstallMode) + { + // Uninstall mode + UINT start_page = D_SW_UNINST1; + + if (sw->IsReExecForUac) + { + // In the case of this have been executed for UAC + if (MsIsAdmin()) + { + // Uninstall + start_page = D_SW_PERFORM; + } + else + { + // Error screen + start_page = D_SW_NOT_ADMIN; + } + } + + ShowWizard(NULL, w, start_page); + } + else if (sw->WebMode) + { + // Web installer creation mode + UINT start_page = D_SW_WEB1; + + ShowWizard(NULL, w, start_page); + } + else if (sw->EasyMode) + { + // Simple installer creation mode + UINT start_page = D_SW_EASY1; + + ShowWizard(NULL, w, start_page); + } + else if (sw->LanguageMode) + { + // Language setting mode + UINT start_page = D_SW_LANG1; + + w->CloseConfirmMsg = NULL; + + if (sw->IsReExecForUac) + { + // In the case of this have been executed for UAC + if (MsIsAdmin()) + { + // Do the language setting + start_page = D_SW_PERFORM; + } + else + { + // Error screen + start_page = D_SW_NOT_ADMIN; + } + } + else + { + if (sw->LangNow) + { + // If not via UAC but Lang Now is set + start_page = D_SW_PERFORM; + } + } + + if (sw->SetLangAndReboot && sw->LangNow == false) + { + // Restart myself immediately by changing the lang.config + LIST *o = LoadLangList(); + + if (o == NULL) + { + MsgBox(NULL, MB_ICONSTOP, _UU("SW_LANG_LIST_LOAD_FAILED")); + } + else + { + LANGLIST *new_lang = GetLangById(o, sw->LangId); + LANGLIST old_lang; + + Zero(&old_lang, sizeof(old_lang)); + GetCurrentLang(&old_lang); + + if (new_lang == NULL) + { + MsgBox(NULL, MB_ICONSTOP, _UU("SW_LANG_LIST_LOAD_FAILED")); + } + else + { + if (SaveLangConfigCurrentDir(new_lang->Name) == false) + { + MsgBox(NULL, MB_ICONSTOP, _UU("SW_LANG_SET_FAILED")); + } + else + { + if (SwReExecMyself(sw, L"/LANGNOW:true ", false) == false) + { + SaveLangConfigCurrentDir(old_lang.Name); + + MsgBox(NULL, MB_ICONSTOP, _UU("SW_CHILD_PROCESS_ERROR")); + + sw->ExitCode = SW_EXIT_CODE_INTERNAL_ERROR; + } + } + } + + FreeLangList(o); + } + } + else + { + // Show the wizard + ShowWizard(NULL, w, start_page); + } + } + else + { + // Installation mode + UINT start_page = D_SW_WELCOME; + + if (sw->IsReExecForUac) + { + // In the case of this have been executed for UAC + if (MsIsAdmin()) + { + // Jump to component list if the user have system administrator privileges + start_page = D_SW_COMPONENTS; + } + else + { + // Jump to the setup mode selection screen when fail + // to get admin privileges even executed by enabling UAC + start_page = D_SW_MODE; + } + } + + ShowWizard(NULL, w, start_page); + + if (sw->Run) + { + // Auto run the app + wchar_t tmp[MAX_PATH]; + HANDLE h; + UNI_TOKEN_LIST *t; + + t = UniParseToken(sw->CurrentComponent->StartExeName, L" "); + + if (t != NULL) + { + wchar_t exe[MAX_PATH]; + wchar_t arg[MAX_PATH]; + + Zero(exe, sizeof(exe)); + Zero(arg, sizeof(arg)); + + if (t->NumTokens >= 1) + { + UniStrCpy(exe, sizeof(exe), t->Token[0]); + } + if (t->NumTokens >= 2) + { + UniStrCpy(arg, sizeof(arg), t->Token[1]); + } + + if (UniIsEmptyStr(exe) == false) + { + CombinePathW(tmp, sizeof(tmp), sw->InstallDir, exe); + + h = MsRunAsUserExW(tmp, arg, false); + if (h != NULL) + { + CloseHandle(h); + } + } + + UniFreeToken(t); + } + } + } + + FreeWizard(w); +} + +// Release the component +void SwFreeComponent(SW_COMPONENT *c) +{ + // Validate arguments + if (c == NULL) + { + return; + } + + FreeStrList(c->NeedFiles); + Free(c->Name); + Free(c->SvcName); + Free(c->LongName); + Free(c->Title); + Free(c->Description); + Free(c->DefaultDirName); + Free(c->SvcFileName); + Free(c->StartExeName); + Free(c->StartDescription); + + Free(c); +} + +// Create a component +SW_COMPONENT *SwNewComponent(char *name, char *svc_name, UINT id, UINT icon, UINT icon_index, wchar_t *svc_filename, + wchar_t *long_name, bool system_mode_only, UINT num_files, char *files[], + wchar_t *start_exe_name, wchar_t *start_description, + SW_OLD_MSI *old_msis, UINT num_old_msis) +{ + SW_COMPONENT *c; + UINT i; + char tmp[MAX_SIZE]; + // Validate arguments + if (name == NULL || files == NULL || long_name == NULL) + { + return NULL; + } + if (svc_name == NULL) + { + svc_name = name; + } + + c = ZeroMalloc(sizeof(SW_COMPONENT)); + + c->Id = id; + + c->NeedFiles = NewListFast(NULL); + + for (i = 0;i < num_files;i++) + { + Add(c->NeedFiles, CopyStr(files[i])); + } + + c->SystemModeOnly = system_mode_only; + c->Name = CopyStr(name); + c->SvcName = CopyStr(svc_name); + c->DefaultDirName = CopyUniStr(long_name); + c->LongName = CopyUniStr(long_name); + + Format(tmp, sizeof(tmp), "SW_COMPONENT_%s_TITLE", name); + c->Title = CopyUniStr(_UU(tmp)); + + Format(tmp, sizeof(tmp), "SW_COMPONENT_%s_DESCRIPTION", name); + c->Description = CopyUniStr(_UU(tmp)); + + c->Icon = icon; + c->IconExeIndex = icon_index; + + if (UniIsEmptyStr(svc_filename) == false) + { + c->InstallService = true; + c->SvcFileName = UniCopyStr(svc_filename); + } + + if (UniIsEmptyStr(start_exe_name) == false && UniIsEmptyStr(start_description) == false) + { + c->StartExeName = UniCopyStr(start_exe_name); + c->StartDescription = UniCopyStr(start_description); + } + + c->OldMsiList = old_msis; + c->NumOldMsi = num_old_msis; + + return c; +} + +// Examine the OS requirements +bool SwCheckOs(SW *sw, SW_COMPONENT *c) +{ + // Validate arguments + if (sw == NULL || c == NULL) + { + return false; + } + + if (c->Id == SW_CMP_VPN_CLIENT) + { + OS_INFO *info = GetOsInfo(); + + if (OS_IS_WINDOWS_NT(info->OsType)) + { + if (MsIsWin2000OrGreater() == false) + { + // It doesn't work with WinNT 4.0 + return false; + } + } + else + { + if (GET_KETA(info->OsType, 100) <= 1) + { + // It doesn't work with Win95 + return false; + } + else if (info->OsType == OSTYPE_WINDOWS_98) + { + if (EndWith(info->OsVersion, "A") == false) + { + // It doesn't work in Win98 First Edition + return false; + } + } + } + } + + return true; +} + +// Define the component +void SwDefineComponents(SW *sw) +{ + SW_COMPONENT *c; + char *vpn_server_files[] = + { + "vpnserver.exe", + "vpnsmgr.exe", + "vpncmd.exe", + "hamcore.se2", + }; + char *vpn_client_files[] = + { + "vpnclient.exe", + "vpncmgr.exe", + "vpncmd.exe", + "hamcore.se2", + }; + char *vpn_bridge_files[] = + { + "vpnbridge.exe", + "vpnsmgr.exe", + "vpncmd.exe", + "hamcore.se2", + }; + char *vpn_smgr_files[] = + { + "vpnsmgr.exe", + "vpncmd.exe", + "hamcore.se2", + }; + char *vpn_cmgr_files[] = + { + "vpncmgr.exe", + "vpncmd.exe", + "hamcore.se2", + }; + // Validate arguments + if (sw == NULL) + { + return; + } + + // VPN Server + c = SwNewComponent(SW_NAME_VPNSERVER, GC_SVC_NAME_VPNSERVER, SW_CMP_VPN_SERVER, ICO_VPNSERVER, 5, L"vpnserver.exe", + SW_LONG_VPNSERVER, false, sizeof(vpn_server_files) / sizeof(char *), vpn_server_files, + L"vpnsmgr.exe", _UU("SW_RUN_TEXT_VPNSMGR"), + old_msi_vpnserver, sizeof(old_msi_vpnserver) / sizeof(SW_OLD_MSI)); + Add(sw->ComponentList, c); + + // VPN Client + c = SwNewComponent(SW_NAME_VPNCLIENT, GC_SVC_NAME_VPNCLIENT, SW_CMP_VPN_CLIENT, ICO_VPN, 6, L"vpnclient.exe", + SW_LONG_VPNCLIENT, true, sizeof(vpn_client_files) / sizeof(char *), vpn_client_files, + L"vpncmgr.exe", _UU("SW_RUN_TEXT_VPNCMGR"), + old_msi_vpnclient, sizeof(old_msi_vpnclient) / sizeof(SW_OLD_MSI)); + +#ifdef GC_ENABLE_VPNGATE +#endif // GC_ENABLE_VPNGATE + + Add(sw->ComponentList, c); + + // VPN Bridge + c = SwNewComponent(SW_NAME_VPNBRIDGE, GC_SVC_NAME_VPNBRIDGE, SW_CMP_VPN_BRIDGE, ICO_CASCADE, 7, L"vpnbridge.exe", + SW_LONG_VPNBRIDGE, false, sizeof(vpn_bridge_files) / sizeof(char *), vpn_bridge_files, + L"vpnsmgr.exe", _UU("SW_RUN_TEXT_VPNSMGR"), + old_msi_vpnbridge, sizeof(old_msi_vpnbridge) / sizeof(SW_OLD_MSI)); + Add(sw->ComponentList, c); + + // VPN Server Manager (Tools Only) + c = SwNewComponent(SW_NAME_VPNSMGR, NULL, SW_CMP_VPN_SMGR, ICO_USER_ADMIN, 8, NULL, + SW_LONG_VPNSMGR, false, sizeof(vpn_smgr_files) / sizeof(char *), vpn_smgr_files, + L"vpnsmgr.exe", _UU("SW_RUN_TEXT_VPNSMGR"), + NULL, 0); + Add(sw->ComponentList, c); + + // VPN Client Manager (Tools Only) + c = SwNewComponent(SW_NAME_VPNCMGR, NULL, SW_CMP_VPN_CMGR, ICO_INTERNET, 9, NULL, + SW_LONG_VPNCMGR, false, sizeof(vpn_cmgr_files) / sizeof(char *), vpn_cmgr_files, + L"vpncmgr.exe /remote", _UU("SW_RUN_TEXT_VPNCMGR"), + NULL, 0); + Add(sw->ComponentList, c); +} + +// Detect the available components +void SwDetectComponents(SW *sw) +{ + UINT i; + // Validate arguments + if (sw == NULL) + { + return; + } + + for (i = 0;i < LIST_NUM(sw->ComponentList);i++) + { + SW_COMPONENT *c = LIST_DATA(sw->ComponentList, i); + + c->Detected = SwIsComponentDetected(sw, c); + } + + // Determine whether the automatic connection configuration file exists in the same directory + if (true) + { + wchar_t tmp[MAX_PATH]; + + ConbinePathW(tmp, sizeof(tmp), MsGetExeDirNameW(), SW_AUTO_CONNECT_ACCOUNT_FILE_NAME_W); + + if (IsFileExistsW(tmp)) + { + // Exist + UniStrCpy(sw->auto_setting_path, sizeof(sw->auto_setting_path), tmp); + } + } +} + +// Determine whether detection of the component is successful +bool SwIsComponentDetected(SW *sw, SW_COMPONENT *c) +{ + UINT i; + bool ret = true; + // Validate arguments + if (sw == NULL || c == NULL) + { + return false; + } + + for (i = 0;i < LIST_NUM(c->NeedFiles);i++) + { + char *name = LIST_DATA(c->NeedFiles, i); + wchar_t name_w[MAX_SIZE]; + wchar_t fullpath[MAX_SIZE]; + + StrToUni(name_w, sizeof(name_w), name); + + CombinePathW(fullpath, sizeof(fullpath), sw->InstallSrc, name_w); + + if (IsFileExistsW(fullpath) == false) + { + ret = false; + break; + } + } + + if (c->InstallService == false) + { + if (sw->IsEasyInstaller || sw->IsWebInstaller) + { + // Prevent installing only management tool + // for Web installer or a simple installer + ret = false; + } + } + + return ret; +} + +// Add a new log +void SwAddLog(SW *sw, SW_LOGFILE *logfile, UINT type, wchar_t *path) +{ + SW_LOG *g; + // Validate arguments + if (sw == NULL || path == NULL || logfile == NULL) + { + return; + } + + g = ZeroMalloc(sizeof(SW_LOG)); + g->Type = type; + UniStrCpy(g->Path, sizeof(g->Path), path); + + Add(logfile->LogList, g); +} +void SwAddLogA(SW *sw, SW_LOGFILE *logfile, UINT type, char *path) +{ + wchar_t *w; + // Validate arguments + if (sw == NULL || path == NULL || logfile == NULL) + { + return; + } + + w = CopyStrToUni(path); + + SwAddLog(sw, logfile, type, w); + + Free(w); +} + +// Create a SW +SW *NewSw() +{ + SW *sw = ZeroMalloc(sizeof(SW)); + + sw->IsSystemMode = true; + + sw->ComponentList = NewListFast(NULL); + + sw->ExitCode = SW_EXIT_CODE_USER_CANCEL; + + UniStrCpy(sw->InstallSrc, sizeof(sw->InstallSrc), MsGetExeDirNameW()); + + SwDefineComponents(sw); + + return sw; +} + +// Release the SW +UINT FreeSw(SW *sw) +{ + UINT i; + UINT ret; + // Validate arguments + if (sw == NULL) + { + return SW_EXIT_CODE_INTERNAL_ERROR; + } + + SwLeaveSingle(sw); + + for (i = 0;i < LIST_NUM(sw->ComponentList);i++) + { + SW_COMPONENT *c = LIST_DATA(sw->ComponentList, i); + + SwFreeComponent(c); + } + + ReleaseList(sw->ComponentList); + + SwFreeLogFile(sw->LogFile); + + if (sw->ReExecProcessHandle != NULL) + { + // If you have started the child process, wait for the termination of child process + sw->ExitCode = MsWaitProcessExit(sw->ReExecProcessHandle); + } + + ret = sw->ExitCode; + + Free(sw); + + return ret; +} + +// Exit the multi-starts prevention mode +void SwLeaveSingle(SW *sw) +{ + // Validate arguments + if (sw == NULL) + { + return; + } + + if (sw->Single != NULL) + { + FreeSingleInstance(sw->Single); + sw->Single = NULL; + } +} + +// Enter multiple-starts prevention mode +bool SwEnterSingle(SW *sw) +{ + // Validate arguments + if (sw == NULL) + { + return false; + } + + if (sw->Single != NULL) + { + return true; + } + + sw->Single = NewSingleInstance(SW_SINGLE_INSTANCE_NAME); + + if (sw->Single == NULL) + { + return false; + } + + return true; +} + +// Parse the command line +void SwParseCommandLine(SW *sw) +{ + CONSOLE *c; + wchar_t *cmdline; + LIST *o; + PARAM args[] = + { + {"UAC", NULL, NULL, NULL, NULL, }, + {"LANGUAGE", NULL, NULL, NULL, NULL, }, + {"LANGID", NULL, NULL, NULL, NULL, }, + {"LANGNOW", NULL, NULL, NULL, NULL, }, + {"SETLANGANDREBOOT", NULL, NULL, NULL, NULL, }, + {"EASY", NULL, NULL, NULL, NULL, }, + {"WEB", NULL, NULL, NULL, NULL, }, + {"SFXMODE", NULL, NULL, NULL, NULL, }, + {"SFXOUT", NULL, NULL, NULL, NULL, }, + {"HIDESTARTCOMMAND", NULL, NULL, NULL, NULL, }, + {"CALLERSFXPATH", NULL, NULL, NULL, NULL, }, + {"ISEASYINSTALLER", NULL, NULL, NULL, NULL, }, + {"DISABLEAUTOIMPORT", NULL, NULL, NULL, NULL, }, + {"ISWEBINSTALLER", NULL, NULL, NULL, NULL, }, + {"SUINSTMODE", NULL, NULL, NULL, NULL, }, + }; + // Validate arguments + if (sw == NULL) + { + return; + } + + c = NewLocalConsole(NULL, NULL); + if (c == NULL) + { + return; + } + + cmdline = GetCommandLineUniStr(); + + if (UniIsEmptyStr(cmdline) == false) + { + o = ParseCommandList(c, "setup", cmdline, args, sizeof(args) / sizeof(args[0])); + + if (o != NULL) + { + sw->IsReExecForUac = GetParamYes(o, "UAC"); + sw->LanguageMode = GetParamYes(o, "LANGUAGE"); + sw->LangId = GetParamInt(o, "LANGID"); + sw->LangNow = GetParamYes(o, "LANGNOW"); + sw->SetLangAndReboot = GetParamYes(o, "SETLANGANDREBOOT"); + sw->HideStartCommand = GetParamYes(o, "HIDESTARTCOMMAND"); + sw->SuInstMode = GetParamYes(o, "SUINSTMODE"); + + // Special mode + if (sw->LanguageMode == false) + { + sw->EasyMode = GetParamYes(o, "EASY"); + + if (sw->EasyMode == false) + { + sw->WebMode = GetParamYes(o, "WEB"); + } + } + + StrCpy(sw->SfxMode, sizeof(sw->SfxMode), GetParamStr(o, "SFXMODE")); + UniStrCpy(sw->SfxOut, sizeof(sw->SfxOut), GetParamUniStr(o, "SFXOUT")); + UniStrCpy(sw->CallerSfxPath, sizeof(sw->CallerSfxPath), GetParamUniStr(o, "CALLERSFXPATH")); + sw->IsEasyInstaller = GetParamYes(o, "ISEASYINSTALLER"); + sw->IsWebInstaller = GetParamYes(o, "ISWEBINSTALLER"); + sw->DisableAutoImport = GetParamYes(o, "DISABLEAUTOIMPORT"); + + FreeParamValueList(o); + } + } + + Free(cmdline); + + c->Free(c); +} + +// Start the Setup Wizard +UINT SWExecMain() +{ + SW *sw; + UINT ret; + SW_LOGFILE *logfile = NULL; + wchar_t verstr[MAX_SIZE]; + char ver[MAX_SIZE]; + + // Define the wizard UI + GetCedarVersion(ver, sizeof(ver)); + UniFormat(verstr, sizeof(verstr), _UU("SW_TITLE"), ver); + + InitWinUi(verstr, _SS("DEFAULT_FONT"), _II("DEFAULT_FONT_SIZE")); + + // Create a SW + sw = NewSw(); + + // Read the setting + sw->Easy_EraseSensitive = MsRegReadInt(REG_CURRENT_USER, SW_REG_KEY, "Easy_EraseSensitive"); + sw->Easy_EasyMode = MsRegReadInt(REG_CURRENT_USER, SW_REG_KEY, "Easy_EasyMode"); + sw->Web_EraseSensitive = MsRegReadInt(REG_CURRENT_USER, SW_REG_KEY, "Web_EraseSensitive"); + sw->Web_EasyMode = MsRegReadInt(REG_CURRENT_USER, SW_REG_KEY, "Web_EasyMode"); + + // Parse the command line + SwParseCommandLine(sw); + + // Test! + //sw->WebMode = true; + + // Detect the installable components + SwDetectComponents(sw); + + if (IsEmptyStr(sw->SfxMode) == false && UniIsEmptyStr(sw->SfxOut) == false) + { + // SFX generation mode + if (SwGenSfxModeMain(sw->SfxMode, sw->SfxOut)) + { + // Success + sw->ExitCode = 0; + } + } + else if (sw->SuInstMode) + { + // SuInst mode + sw->ExitCode = 0; + if (SuInstallDriver(false) == false) + { + sw->ExitCode = SW_EXIT_CODE_INTERNAL_ERROR; + } + } + else + { + // Normal mode + // Load setuplog.dat + if (IsFileExistsW(L"@" L"setuplog.dat") && (logfile = SwLoadLogFile(sw, L"@" L"setuplog.dat")) == NULL) + { + // Setuplog.dat is broken + MsgBox(NULL, MB_ICONSTOP, _UU("SW_SETUPLOG_CORRUPTED")); + } + else + { + sw->LogFile = logfile; + if (sw->LogFile == NULL) + { + // Setuplog.dat does not exist + sw->LogFile = SwNewLogFile(); + } + else + { + // When setuplog.dat exists, it is in either of language-setting-change-mode, simple-installer-creation-mode, uninstall-mode + sw->CurrentComponent = sw->LogFile->Component; + sw->IsSystemMode = sw->LogFile->IsSystemMode; + UniStrCpy(sw->InstallDir, sizeof(sw->InstallDir), MsGetExeDirNameW()); + + if (sw->LanguageMode == false && sw->EasyMode == false && sw->WebMode == false) + { + // Uninstall mode + sw->UninstallMode = true; + } + } + + // UI main + SwUiMain(sw); + } + } + + // Release the SW + ret = FreeSw(sw); + + FreeWinUi(); + + return ret; +} + + +#endif // WIN32 + + + diff --git a/src/Cedar/SW.h b/src/Cedar/SW.h index 718ee3f2..0ab83eb9 100644 --- a/src/Cedar/SW.h +++ b/src/Cedar/SW.h @@ -1,25 +1,25 @@ -// SoftEther VPN Source Code - Developer Edition Master Branch -// Cedar Communication Module - - -// SW.h -// Header of SW.c - -#ifndef SW_H -#define SW_H - -#define SW_REG_KEY "Software\\" GC_REG_COMPANY_NAME "\\Setup Wizard Settings" - - -UINT SWExec(); -UINT SWExecMain(); -LIST *SwNewSfxFileList(); -void SwFreeSfxFileList(LIST *o); -bool SwAddBasicFilesToList(LIST *o, char *component_name); -bool SwCompileSfx(LIST *o, wchar_t *dst_filename); -bool SwGenSfxModeMain(char *mode, wchar_t *dst); -bool SwWaitForVpnClientPortReady(UINT timeout); - -#endif // SW_H - - +// SoftEther VPN Source Code - Developer Edition Master Branch +// Cedar Communication Module + + +// SW.h +// Header of SW.c + +#ifndef SW_H +#define SW_H + +#define SW_REG_KEY "Software\\" GC_REG_COMPANY_NAME "\\Setup Wizard Settings" + + +UINT SWExec(); +UINT SWExecMain(); +LIST *SwNewSfxFileList(); +void SwFreeSfxFileList(LIST *o); +bool SwAddBasicFilesToList(LIST *o, char *component_name); +bool SwCompileSfx(LIST *o, wchar_t *dst_filename); +bool SwGenSfxModeMain(char *mode, wchar_t *dst); +bool SwWaitForVpnClientPortReady(UINT timeout); + +#endif // SW_H + + diff --git a/src/Cedar/SWInner.h b/src/Cedar/SWInner.h index a1617ddf..bc92913b 100644 --- a/src/Cedar/SWInner.h +++ b/src/Cedar/SWInner.h @@ -1,346 +1,346 @@ -// SoftEther VPN Source Code - Developer Edition Master Branch -// Cedar Communication Module - - -// SWInner.h -// Header of SW.c (for internal use) - -#ifndef SW_INNER_H -#define SW_INNER_H - -// Component string -#define SW_NAME_VPNSERVER "vpnserver" -#define SW_LONG_VPNSERVER _UU("SW_LONG_VPNSERVER") - -#define SW_NAME_VPNCLIENT "vpnclient" -#define SW_LONG_VPNCLIENT _UU("SW_LONG_VPNCLIENT") - -#define SW_NAME_VPNBRIDGE "vpnbridge" -#define SW_LONG_VPNBRIDGE _UU("SW_LONG_VPNBRIDGE") - -#define SW_NAME_VPNSMGR "vpnsmgr" -#define SW_LONG_VPNSMGR _UU("SW_LONG_VPNSMGR") - -#define SW_NAME_VPNCMGR "vpncmgr" -#define SW_LONG_VPNCMGR _UU("SW_LONG_VPNCMGR") - -#define SW_VPN_CLIENT_UIHELPER_REGVALUE GC_SW_UIHELPER_REGVALUE - -#define SW_VPN_CLIENT_EXT_REGKEY "SOFTWARE\\Classes\\.vpn" -#define SW_VPN_CLIENT_EXT_REGVALUE "vpnfile" -#define SW_VPN_CLIENT_EXT_REGKEY_SUB1 "SOFTWARE\\Classes\\.vpn\\vpnfile" -#define SW_VPN_CLIENT_EXT_REGKEY_SUB2 "SOFTWARE\\Classes\\.vpn\\vpnfile\\ShellNew" - -#define SW_VPN_CLIENT_VPNFILE_REGKEY "SOFTWARE\\Classes\\vpnfile" -#define SW_VPN_CLIENT_VPNFILE_REGVALUE "VPN Client Connection Setting File" -#define SW_VPN_CLIENT_VPNFILE_ICON_REGKEY "SOFTWARE\\Classes\\vpnfile\\DefaultIcon" -#define SW_VPN_CLIENT_VPNFILE_SHELLOPEN_CMD_REGKEY "SOFTWARE\\Classes\\vpnfile\\shell\\open\\command" -#define SW_VPN_CLIENT_VPNFILE_SHELLOPEN_CMD_REGKEY_SUB1 "SOFTWARE\\Classes\\vpnfile\\shell\\open" -#define SW_VPN_CLIENT_VPNFILE_SHELLOPEN_CMD_REGKEY_SUB2 "SOFTWARE\\Classes\\vpnfile\\shell" - -#define SW_REG_KEY_EULA "Software\\" GC_REG_COMPANY_NAME "\\Setup Wizard Settings\\Eula" - - -// Component ID -#define SW_CMP_VPN_SERVER 1 // VPN Server -#define SW_CMP_VPN_CLIENT 2 // VPN Client -#define SW_CMP_VPN_BRIDGE 3 // VPN Bridge -#define SW_CMP_VPN_SMGR 4 // VPN Server Manager (Tools Only) -#define SW_CMP_VPN_CMGR 5 // VPN Client Manager (Tools Only) - -// Exit code -#define SW_EXIT_CODE_USER_CANCEL 1000000001 // Cancel by the user -#define SW_EXIT_CODE_INTERNAL_ERROR 1000000002 // Internal error - -// Special messages to be used in the setup wizard -#define WM_SW_BASE (WM_APP + 251) -#define WM_SW_INTERACT_UI (WM_SW_BASE + 0) // UI processing -#define WM_SW_EXIT (WM_SW_BASE + 1) // Close - -// Automatic connection setting file -#define SW_AUTO_CONNECT_ACCOUNT_FILE_NAME "auto_connect.vpn" -#define SW_AUTO_CONNECT_ACCOUNT_FILE_NAME_W L"auto_connect.vpn" - -// Installer cache file to be stored in the VPN Client installation folder -#define SW_SFX_CACHE_FILENAME L"installer.cache" - -// Flag file -#define SW_FLAG_EASY_MODE "easy_mode.flag" -#define SW_FLAG_EASY_MODE_2 "@easy_mode.flag" - -// Multiple-starts prevention name -#define SW_SINGLE_INSTANCE_NAME "SoftEther_VPN_Setup_Wizard" - -// Time to wait for the VPN Client service startup -#define SW_VPNCLIENT_SERVICE_WAIT_READY_TIMEOUT (30 * 1000) - -// UI interaction -typedef struct SW_UI -{ - UINT Type; // Type - wchar_t *Message; // Message string - UINT Param; // Parameters - UINT RetCode; // Return value -} SW_UI; - -// Type of UI interaction -#define SW_UI_TYPE_PRINT 0 // Display the message -#define SW_UI_TYPE_MSGBOX 1 // Show a message box -#define SW_UI_TYPE_FINISH 2 // Completion -#define SW_UI_TYPE_ERROR 3 // Error - -// Resource type of the file stored in the setup.exe -#define SW_SFX_RESOURCE_TYPE "DATAFILE" - -// Code of old MSI -typedef struct SW_OLD_MSI -{ - char *ProductCode; // Product code - char *ComponentCode; // Component code -} SW_OLD_MSI; - -// Component -typedef struct SW_COMPONENT -{ - UINT Id; // ID - bool Detected; // Whether it has been detected as an installation source - LIST *NeedFiles; // Necessary files - char *Name; // Internal name - char *SvcName; // Service name - wchar_t *Title; // Display name - wchar_t *Description; // Detail - wchar_t *DefaultDirName; // Installation directory name of the default - wchar_t *LongName; // Long name - UINT Icon; // Icon - UINT IconExeIndex; // The index number of the icon within the Setup.exe - bool SystemModeOnly; // Only system mode - bool InstallService; // Installation of service - wchar_t *SvcFileName; // Service file name - wchar_t *StartExeName; // Start EXE file name - wchar_t *StartDescription; // Description of the running software - SW_OLD_MSI *OldMsiList; // Old MSI Product List - UINT NumOldMsi; // The number of old MSI Product List - bool CopyVGDat; // Copy of the VPN Gate DAT file -} SW_COMPONENT; - -// File copy task -typedef struct SW_TASK_COPY -{ - wchar_t SrcFileName[MAX_SIZE]; // Original file name - wchar_t DstFileName[MAX_SIZE]; // Destination file name - wchar_t SrcDir[MAX_SIZE]; // Source directory - wchar_t DstDir[MAX_SIZE]; // Destination directory - bool Overwrite; // Override flag - bool SetupFile; // Setup file flag -} SW_TASK_COPY; - -// Link creation task -typedef struct SW_TASK_LINK -{ - wchar_t TargetDir[MAX_SIZE]; // Target directory - wchar_t TargetExe[MAX_SIZE]; // Target EXE file name - wchar_t TargetArg[MAX_SIZE]; // Arguments to pass to the target - wchar_t IconExe[MAX_SIZE]; // Icon EXE file name - UINT IconIndex; // Icon Index number - wchar_t DestDir[MAX_SIZE]; // Directory name to be created - wchar_t DestName[MAX_SIZE]; // File name to be created - wchar_t DestDescription[MAX_SIZE]; // Description string - bool NoDeleteDir; // Do not delete the directory on uninstall -} SW_TASK_LINK; - -// Setup Tasks -typedef struct SW_TASK -{ - LIST *CopyTasks; // File copy task - LIST *SetSecurityPaths; // List of paths to set the security - LIST *LinkTasks; // Link creation task -} SW_TASK; - -// Setup log -typedef struct SW_LOG -{ - UINT Type; // Type of log - wchar_t Path[MAX_PATH]; // Path -} SW_LOG; - -// Type of setup log -#define SW_LOG_TYPE_FILE 1 // File -#define SW_LOG_TYPE_DIR 2 // Directory -#define SW_LOG_TYPE_REGISTRY 3 // Registry -#define SW_LOG_TYPE_LNK 4 // Shortcut file -#define SW_LOG_TYPE_LNK_DIR 5 // Shortcut directory -#define SW_LOG_TYPE_SVC 6 // Service - -// Setup log files -typedef struct SW_LOGFILE -{ - LIST *LogList; // List of log - bool IsSystemMode; // Whether the system mode - UINT Build; // Build Number - SW_COMPONENT *Component; // Component -} SW_LOGFILE; - -// SFX file -typedef struct SW_SFX_FILE -{ - char InnerFileName[MAX_PATH]; // Internal file name - wchar_t DiskFileName[MAX_PATH]; // File name of the disk -} SW_SFX_FILE; - -// SW instance -typedef struct SW -{ - LIST *ComponentList; // List of components - wchar_t InstallSrc[MAX_SIZE]; // Source directory - bool IsSystemMode; // Whether the system mode - bool UninstallMode; // Uninstall mode - UINT ExitCode; // Exit code - void *ReExecProcessHandle; // Child process handle of a result of the re-run itself - bool IsReExecForUac; // Whether the process was re-run for UAC handling - SW_COMPONENT *CurrentComponent; // Component that is currently selected - bool EulaAgreed; // Whether the user accepted the license agreement - bool DoubleClickBlocker; // Double-click blocker - bool LanguageMode; // Language setting mode - UINT LangId; // Language ID in the language setting mode - bool SetLangAndReboot; // Prompt to restart after making the language setting - bool LangNow; // Start the language setting process right now - bool EasyMode; // Simple installer creation mode - bool WebMode; // Web installer creation mode - bool OnlyAutoSettingMode; // Apply only mode of connection settings of VPN Client - - INSTANCE *Single; // Multiple-starts check - wchar_t DefaultInstallDir_System[MAX_PATH]; // Default system installation directory - wchar_t DefaultInstallDir_User[MAX_PATH]; // Default user installation directory - bool IsAvailableSystemMode; // Whether the system mode is selectable - bool IsAvailableUserMode; // Whether the user mode is selectable - bool ShowWarningForUserMode; // Whether to display a warning for the user-mode - wchar_t InstallDir[MAX_PATH]; // Destination directory - THREAD *PerformThread; // Set up processing thread - bool Run; // Whether to start the tool after Setup finishes - SW_LOGFILE *LogFile; // Log file - bool MsiRebootRequired; // Need to be re-started as a result of MSI - bool LangNotChanged; // Language has not changed - wchar_t FinishMsg[MAX_SIZE * 2]; // Completion message - wchar_t Easy_SettingFile[MAX_PATH]; // Connection settings file name of the Simple installer creation kit: - wchar_t Easy_OutFile[MAX_PATH]; // Destination file name of the simple installer creation kit - bool Easy_EraseSensitive; // Simple installer creation kit: Delete the confidential information - bool Easy_EasyMode; // Simple installer creation kit: simple mode - wchar_t Web_SettingFile[MAX_PATH]; // Connection setting file name for the Web installer creation Kit - wchar_t Web_OutFile[MAX_PATH]; // Destination file name of the Web installer creation Kit - bool Web_EraseSensitive; // Web installer creation Kit: removing confidential information - bool Web_EasyMode; // Web installer creation kit: simple mode - wchar_t vpncmgr_path[MAX_PATH]; // Path of vpncmgr.exe - wchar_t auto_setting_path[MAX_PATH]; // Path of automatic connection setting - bool HideStartCommand; // Not to show the option to start the program on installation complete screen - char SfxMode[MAX_SIZE]; // SFX generation mode - wchar_t SfxOut[MAX_PATH]; // SFX destination - wchar_t CallerSfxPath[MAX_PATH]; // Calling SFX path - bool IsEasyInstaller; // Whether the calling SFX was built by the simple installer creation kit - bool IsWebInstaller; // Whether Web installer - bool DisableAutoImport; // Not to use the automatic import process - bool SuInstMode; // SuInst mode - UINT CurrentEulaHash; // Hash of the license agreement -} SW; - - -// Function prototype -SW *NewSw(); -UINT FreeSw(SW *sw); - -void SwDefineComponents(SW *sw); -SW_COMPONENT *SwNewComponent(char *name, char *svc_name, UINT id, UINT icon, UINT icon_index, wchar_t *svc_filename, - wchar_t *long_name, bool system_mode_only, UINT num_files, char *files[], - wchar_t *start_exe_name, wchar_t *start_description, - SW_OLD_MSI *old_msis, UINT num_old_msis); -void SwFreeComponent(SW_COMPONENT *c); -void SwDetectComponents(SW *sw); -bool SwIsComponentDetected(SW *sw, SW_COMPONENT *c); -void SwParseCommandLine(SW *sw); -SW_COMPONENT *SwFindComponent(SW *sw, char *name); - -void SwInitDefaultInstallDir(SW *sw); -void SwUiMain(SW *sw); -bool SwCheckNewDirName(wchar_t *name); -wchar_t *SwGetOldMsiInstalledDir(SW_COMPONENT *c); -bool SwUninstallOldMsiInstalled(HWND hWnd, WIZARD_PAGE *wp, SW_COMPONENT *c, bool *reboot_required); - -bool SwReExecMyself(SW *sw, wchar_t *additional_params, bool as_admin); - -SW_TASK *SwNewTask(); -void SwFreeTask(SW_TASK *t); -SW_TASK_COPY *SwNewCopyTask(wchar_t *srcfilename, wchar_t *dstfilename, wchar_t *srcdir, wchar_t *dstdir, bool overwrite, bool setup_file); -void SwFreeCopyTask(SW_TASK_COPY *ct); -void SwDefineTasks(SW *sw, SW_TASK *t, SW_COMPONENT *c); -SW_TASK_LINK *SwNewLinkTask(wchar_t *target_dir, wchar_t *target_exe, wchar_t *target_arg, - wchar_t *icon_exe, UINT icon_index, - wchar_t *dest_dir, wchar_t *dest_name, wchar_t *dest_desc, - bool no_delete_dir); -void SwFreeLinkTask(SW_TASK_LINK *lt); - -void SwAddLog(SW *sw, SW_LOGFILE *logfile, UINT type, wchar_t *path); -void SwAddLogA(SW *sw, SW_LOGFILE *logfile, UINT type, char *path); -bool SwSaveLogFile(SW *sw, wchar_t *dst_name, SW_LOGFILE *logfile); -SW_LOGFILE *SwLoadLogFile(SW *sw, wchar_t *filename); -SW_LOGFILE *SwNewLogFile(); -void SwFreeLogFile(SW_LOGFILE *logfile); - -void SwInstallShortcuts(SW *sw, WIZARD_PAGE *wp, SW_COMPONENT *c, SW_TASK *t); -void SwDeleteShortcuts(SW_LOGFILE *logfile); - -bool SwCheckOs(SW *sw, SW_COMPONENT *c); - -bool SwEnterSingle(SW *sw); -void SwLeaveSingle(SW *sw); - -UINT SwWelcomeDlg(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, WIZARD *wizard, WIZARD_PAGE *wizard_page, void *param); -UINT SwModeDlg(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, WIZARD *wizard, WIZARD_PAGE *wizard_page, void *param); -UINT SwNotAdminDlg(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, WIZARD *wizard, WIZARD_PAGE *wizard_page, void *param); -UINT SwComponents(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, WIZARD *wizard, WIZARD_PAGE *wizard_page, void *param); -void SwComponentsInit(HWND hWnd, SW *sw); -void SwComponentsUpdate(HWND hWnd, SW *sw, WIZARD *wizard, WIZARD_PAGE *wizard_page); -UINT SwEula(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, WIZARD *wizard, WIZARD_PAGE *wizard_page, void *param); -void SwEulaUpdate(HWND hWnd, SW *sw, WIZARD *wizard, WIZARD_PAGE *wizard_page); -UINT SwDir(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, WIZARD *wizard, WIZARD_PAGE *wizard_page, void *param); -void SwDirUpdate(HWND hWnd, SW *sw, WIZARD_PAGE *wizard_page); -UINT SwReady(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, WIZARD *wizard, WIZARD_PAGE *wizard_page, void *param); -UINT SwPerform(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, WIZARD *wizard, WIZARD_PAGE *wizard_page, void *param); -void SwPerformInit(HWND hWnd, SW *sw, WIZARD_PAGE *wp); -void SwPerformThread(THREAD *thread, void *param); -void SwPerformPrint(WIZARD_PAGE *wp, wchar_t *str); -UINT SwPerformMsgBox(WIZARD_PAGE *wp, UINT flags, wchar_t *msg); -UINT SwInteractUi(WIZARD_PAGE *wp, SW_UI *ui); -void SwInteractUiCalled(HWND hWnd, SW *sw, WIZARD_PAGE *wp, SW_UI *ui); -bool SwInstallMain(SW *sw, WIZARD_PAGE *wp, SW_COMPONENT *c); -UINT SwError(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, WIZARD *wizard, WIZARD_PAGE *wizard_page, void *param); -UINT SwFinish(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, WIZARD *wizard, WIZARD_PAGE *wizard_page, void *param); -UINT SwUninst1(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, WIZARD *wizard, WIZARD_PAGE *wizard_page, void *param); -bool SwUninstallMain(SW *sw, WIZARD_PAGE *wp, SW_COMPONENT *c); -UINT SwLang1(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, WIZARD *wizard, WIZARD_PAGE *wizard_page, void *param); -void SwLang1Init(HWND hWnd, SW *sw); -UINT SwGetLangIcon(char *name); -void SwLang1Update(HWND hWnd, SW *sw, WIZARD *wizard, WIZARD_PAGE *wizard_page); -UINT SwEasy1(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, WIZARD *wizard, WIZARD_PAGE *wizard_page, void *param); -UINT SwEasy2(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, WIZARD *wizard, WIZARD_PAGE *wizard_page, void *param); -void SwEasy2Update(HWND hWnd, SW *sw, WIZARD *wizard, WIZARD_PAGE *wizard_page); -bool SwEasyMain(SW *sw, WIZARD_PAGE *wp); -UINT SwWeb1(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, WIZARD *wizard, WIZARD_PAGE *wizard_page, void *param); -UINT SwWeb2(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, WIZARD *wizard, WIZARD_PAGE *wizard_page, void *param); -void SwWeb2Update(HWND hWnd, SW *sw, WIZARD *wizard, WIZARD_PAGE *wizard_page); -bool SwWebMain(SW *sw, WIZARD_PAGE *wp); - - -void SwGenerateDefaultSfxFileName(wchar_t *name, UINT size); -void SwGenerateDefaultZipFileName(wchar_t *name, UINT size); - -bool CALLBACK SwEnumResourceNamesProc(HMODULE hModule, const char *type, char *name, LONG_PTR lParam); - -UINT SwSfxModeMain(); -bool CALLBACK SfxModeMainDialogProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam); -bool SwSfxExtractProcess(HWND hWnd, bool *hide_error_msg); -bool SwSfxExtractFile(HWND hWnd, void *data, UINT size, wchar_t *dst, bool compressed); -SW_SFX_FILE *SwNewSfxFile(char *inner_file_name, wchar_t *disk_file_name); -bool SwSfxCopyVgFiles(HWND hWnd, wchar_t *src, wchar_t *dst); - -#endif // SW_INNER_H - - +// SoftEther VPN Source Code - Developer Edition Master Branch +// Cedar Communication Module + + +// SWInner.h +// Header of SW.c (for internal use) + +#ifndef SW_INNER_H +#define SW_INNER_H + +// Component string +#define SW_NAME_VPNSERVER "vpnserver" +#define SW_LONG_VPNSERVER _UU("SW_LONG_VPNSERVER") + +#define SW_NAME_VPNCLIENT "vpnclient" +#define SW_LONG_VPNCLIENT _UU("SW_LONG_VPNCLIENT") + +#define SW_NAME_VPNBRIDGE "vpnbridge" +#define SW_LONG_VPNBRIDGE _UU("SW_LONG_VPNBRIDGE") + +#define SW_NAME_VPNSMGR "vpnsmgr" +#define SW_LONG_VPNSMGR _UU("SW_LONG_VPNSMGR") + +#define SW_NAME_VPNCMGR "vpncmgr" +#define SW_LONG_VPNCMGR _UU("SW_LONG_VPNCMGR") + +#define SW_VPN_CLIENT_UIHELPER_REGVALUE GC_SW_UIHELPER_REGVALUE + +#define SW_VPN_CLIENT_EXT_REGKEY "SOFTWARE\\Classes\\.vpn" +#define SW_VPN_CLIENT_EXT_REGVALUE "vpnfile" +#define SW_VPN_CLIENT_EXT_REGKEY_SUB1 "SOFTWARE\\Classes\\.vpn\\vpnfile" +#define SW_VPN_CLIENT_EXT_REGKEY_SUB2 "SOFTWARE\\Classes\\.vpn\\vpnfile\\ShellNew" + +#define SW_VPN_CLIENT_VPNFILE_REGKEY "SOFTWARE\\Classes\\vpnfile" +#define SW_VPN_CLIENT_VPNFILE_REGVALUE "VPN Client Connection Setting File" +#define SW_VPN_CLIENT_VPNFILE_ICON_REGKEY "SOFTWARE\\Classes\\vpnfile\\DefaultIcon" +#define SW_VPN_CLIENT_VPNFILE_SHELLOPEN_CMD_REGKEY "SOFTWARE\\Classes\\vpnfile\\shell\\open\\command" +#define SW_VPN_CLIENT_VPNFILE_SHELLOPEN_CMD_REGKEY_SUB1 "SOFTWARE\\Classes\\vpnfile\\shell\\open" +#define SW_VPN_CLIENT_VPNFILE_SHELLOPEN_CMD_REGKEY_SUB2 "SOFTWARE\\Classes\\vpnfile\\shell" + +#define SW_REG_KEY_EULA "Software\\" GC_REG_COMPANY_NAME "\\Setup Wizard Settings\\Eula" + + +// Component ID +#define SW_CMP_VPN_SERVER 1 // VPN Server +#define SW_CMP_VPN_CLIENT 2 // VPN Client +#define SW_CMP_VPN_BRIDGE 3 // VPN Bridge +#define SW_CMP_VPN_SMGR 4 // VPN Server Manager (Tools Only) +#define SW_CMP_VPN_CMGR 5 // VPN Client Manager (Tools Only) + +// Exit code +#define SW_EXIT_CODE_USER_CANCEL 1000000001 // Cancel by the user +#define SW_EXIT_CODE_INTERNAL_ERROR 1000000002 // Internal error + +// Special messages to be used in the setup wizard +#define WM_SW_BASE (WM_APP + 251) +#define WM_SW_INTERACT_UI (WM_SW_BASE + 0) // UI processing +#define WM_SW_EXIT (WM_SW_BASE + 1) // Close + +// Automatic connection setting file +#define SW_AUTO_CONNECT_ACCOUNT_FILE_NAME "auto_connect.vpn" +#define SW_AUTO_CONNECT_ACCOUNT_FILE_NAME_W L"auto_connect.vpn" + +// Installer cache file to be stored in the VPN Client installation folder +#define SW_SFX_CACHE_FILENAME L"installer.cache" + +// Flag file +#define SW_FLAG_EASY_MODE "easy_mode.flag" +#define SW_FLAG_EASY_MODE_2 "@easy_mode.flag" + +// Multiple-starts prevention name +#define SW_SINGLE_INSTANCE_NAME "SoftEther_VPN_Setup_Wizard" + +// Time to wait for the VPN Client service startup +#define SW_VPNCLIENT_SERVICE_WAIT_READY_TIMEOUT (30 * 1000) + +// UI interaction +typedef struct SW_UI +{ + UINT Type; // Type + wchar_t *Message; // Message string + UINT Param; // Parameters + UINT RetCode; // Return value +} SW_UI; + +// Type of UI interaction +#define SW_UI_TYPE_PRINT 0 // Display the message +#define SW_UI_TYPE_MSGBOX 1 // Show a message box +#define SW_UI_TYPE_FINISH 2 // Completion +#define SW_UI_TYPE_ERROR 3 // Error + +// Resource type of the file stored in the setup.exe +#define SW_SFX_RESOURCE_TYPE "DATAFILE" + +// Code of old MSI +typedef struct SW_OLD_MSI +{ + char *ProductCode; // Product code + char *ComponentCode; // Component code +} SW_OLD_MSI; + +// Component +typedef struct SW_COMPONENT +{ + UINT Id; // ID + bool Detected; // Whether it has been detected as an installation source + LIST *NeedFiles; // Necessary files + char *Name; // Internal name + char *SvcName; // Service name + wchar_t *Title; // Display name + wchar_t *Description; // Detail + wchar_t *DefaultDirName; // Installation directory name of the default + wchar_t *LongName; // Long name + UINT Icon; // Icon + UINT IconExeIndex; // The index number of the icon within the Setup.exe + bool SystemModeOnly; // Only system mode + bool InstallService; // Installation of service + wchar_t *SvcFileName; // Service file name + wchar_t *StartExeName; // Start EXE file name + wchar_t *StartDescription; // Description of the running software + SW_OLD_MSI *OldMsiList; // Old MSI Product List + UINT NumOldMsi; // The number of old MSI Product List + bool CopyVGDat; // Copy of the VPN Gate DAT file +} SW_COMPONENT; + +// File copy task +typedef struct SW_TASK_COPY +{ + wchar_t SrcFileName[MAX_SIZE]; // Original file name + wchar_t DstFileName[MAX_SIZE]; // Destination file name + wchar_t SrcDir[MAX_SIZE]; // Source directory + wchar_t DstDir[MAX_SIZE]; // Destination directory + bool Overwrite; // Override flag + bool SetupFile; // Setup file flag +} SW_TASK_COPY; + +// Link creation task +typedef struct SW_TASK_LINK +{ + wchar_t TargetDir[MAX_SIZE]; // Target directory + wchar_t TargetExe[MAX_SIZE]; // Target EXE file name + wchar_t TargetArg[MAX_SIZE]; // Arguments to pass to the target + wchar_t IconExe[MAX_SIZE]; // Icon EXE file name + UINT IconIndex; // Icon Index number + wchar_t DestDir[MAX_SIZE]; // Directory name to be created + wchar_t DestName[MAX_SIZE]; // File name to be created + wchar_t DestDescription[MAX_SIZE]; // Description string + bool NoDeleteDir; // Do not delete the directory on uninstall +} SW_TASK_LINK; + +// Setup Tasks +typedef struct SW_TASK +{ + LIST *CopyTasks; // File copy task + LIST *SetSecurityPaths; // List of paths to set the security + LIST *LinkTasks; // Link creation task +} SW_TASK; + +// Setup log +typedef struct SW_LOG +{ + UINT Type; // Type of log + wchar_t Path[MAX_PATH]; // Path +} SW_LOG; + +// Type of setup log +#define SW_LOG_TYPE_FILE 1 // File +#define SW_LOG_TYPE_DIR 2 // Directory +#define SW_LOG_TYPE_REGISTRY 3 // Registry +#define SW_LOG_TYPE_LNK 4 // Shortcut file +#define SW_LOG_TYPE_LNK_DIR 5 // Shortcut directory +#define SW_LOG_TYPE_SVC 6 // Service + +// Setup log files +typedef struct SW_LOGFILE +{ + LIST *LogList; // List of log + bool IsSystemMode; // Whether the system mode + UINT Build; // Build Number + SW_COMPONENT *Component; // Component +} SW_LOGFILE; + +// SFX file +typedef struct SW_SFX_FILE +{ + char InnerFileName[MAX_PATH]; // Internal file name + wchar_t DiskFileName[MAX_PATH]; // File name of the disk +} SW_SFX_FILE; + +// SW instance +typedef struct SW +{ + LIST *ComponentList; // List of components + wchar_t InstallSrc[MAX_SIZE]; // Source directory + bool IsSystemMode; // Whether the system mode + bool UninstallMode; // Uninstall mode + UINT ExitCode; // Exit code + void *ReExecProcessHandle; // Child process handle of a result of the re-run itself + bool IsReExecForUac; // Whether the process was re-run for UAC handling + SW_COMPONENT *CurrentComponent; // Component that is currently selected + bool EulaAgreed; // Whether the user accepted the license agreement + bool DoubleClickBlocker; // Double-click blocker + bool LanguageMode; // Language setting mode + UINT LangId; // Language ID in the language setting mode + bool SetLangAndReboot; // Prompt to restart after making the language setting + bool LangNow; // Start the language setting process right now + bool EasyMode; // Simple installer creation mode + bool WebMode; // Web installer creation mode + bool OnlyAutoSettingMode; // Apply only mode of connection settings of VPN Client + + INSTANCE *Single; // Multiple-starts check + wchar_t DefaultInstallDir_System[MAX_PATH]; // Default system installation directory + wchar_t DefaultInstallDir_User[MAX_PATH]; // Default user installation directory + bool IsAvailableSystemMode; // Whether the system mode is selectable + bool IsAvailableUserMode; // Whether the user mode is selectable + bool ShowWarningForUserMode; // Whether to display a warning for the user-mode + wchar_t InstallDir[MAX_PATH]; // Destination directory + THREAD *PerformThread; // Set up processing thread + bool Run; // Whether to start the tool after Setup finishes + SW_LOGFILE *LogFile; // Log file + bool MsiRebootRequired; // Need to be re-started as a result of MSI + bool LangNotChanged; // Language has not changed + wchar_t FinishMsg[MAX_SIZE * 2]; // Completion message + wchar_t Easy_SettingFile[MAX_PATH]; // Connection settings file name of the Simple installer creation kit: + wchar_t Easy_OutFile[MAX_PATH]; // Destination file name of the simple installer creation kit + bool Easy_EraseSensitive; // Simple installer creation kit: Delete the confidential information + bool Easy_EasyMode; // Simple installer creation kit: simple mode + wchar_t Web_SettingFile[MAX_PATH]; // Connection setting file name for the Web installer creation Kit + wchar_t Web_OutFile[MAX_PATH]; // Destination file name of the Web installer creation Kit + bool Web_EraseSensitive; // Web installer creation Kit: removing confidential information + bool Web_EasyMode; // Web installer creation kit: simple mode + wchar_t vpncmgr_path[MAX_PATH]; // Path of vpncmgr.exe + wchar_t auto_setting_path[MAX_PATH]; // Path of automatic connection setting + bool HideStartCommand; // Not to show the option to start the program on installation complete screen + char SfxMode[MAX_SIZE]; // SFX generation mode + wchar_t SfxOut[MAX_PATH]; // SFX destination + wchar_t CallerSfxPath[MAX_PATH]; // Calling SFX path + bool IsEasyInstaller; // Whether the calling SFX was built by the simple installer creation kit + bool IsWebInstaller; // Whether Web installer + bool DisableAutoImport; // Not to use the automatic import process + bool SuInstMode; // SuInst mode + UINT CurrentEulaHash; // Hash of the license agreement +} SW; + + +// Function prototype +SW *NewSw(); +UINT FreeSw(SW *sw); + +void SwDefineComponents(SW *sw); +SW_COMPONENT *SwNewComponent(char *name, char *svc_name, UINT id, UINT icon, UINT icon_index, wchar_t *svc_filename, + wchar_t *long_name, bool system_mode_only, UINT num_files, char *files[], + wchar_t *start_exe_name, wchar_t *start_description, + SW_OLD_MSI *old_msis, UINT num_old_msis); +void SwFreeComponent(SW_COMPONENT *c); +void SwDetectComponents(SW *sw); +bool SwIsComponentDetected(SW *sw, SW_COMPONENT *c); +void SwParseCommandLine(SW *sw); +SW_COMPONENT *SwFindComponent(SW *sw, char *name); + +void SwInitDefaultInstallDir(SW *sw); +void SwUiMain(SW *sw); +bool SwCheckNewDirName(wchar_t *name); +wchar_t *SwGetOldMsiInstalledDir(SW_COMPONENT *c); +bool SwUninstallOldMsiInstalled(HWND hWnd, WIZARD_PAGE *wp, SW_COMPONENT *c, bool *reboot_required); + +bool SwReExecMyself(SW *sw, wchar_t *additional_params, bool as_admin); + +SW_TASK *SwNewTask(); +void SwFreeTask(SW_TASK *t); +SW_TASK_COPY *SwNewCopyTask(wchar_t *srcfilename, wchar_t *dstfilename, wchar_t *srcdir, wchar_t *dstdir, bool overwrite, bool setup_file); +void SwFreeCopyTask(SW_TASK_COPY *ct); +void SwDefineTasks(SW *sw, SW_TASK *t, SW_COMPONENT *c); +SW_TASK_LINK *SwNewLinkTask(wchar_t *target_dir, wchar_t *target_exe, wchar_t *target_arg, + wchar_t *icon_exe, UINT icon_index, + wchar_t *dest_dir, wchar_t *dest_name, wchar_t *dest_desc, + bool no_delete_dir); +void SwFreeLinkTask(SW_TASK_LINK *lt); + +void SwAddLog(SW *sw, SW_LOGFILE *logfile, UINT type, wchar_t *path); +void SwAddLogA(SW *sw, SW_LOGFILE *logfile, UINT type, char *path); +bool SwSaveLogFile(SW *sw, wchar_t *dst_name, SW_LOGFILE *logfile); +SW_LOGFILE *SwLoadLogFile(SW *sw, wchar_t *filename); +SW_LOGFILE *SwNewLogFile(); +void SwFreeLogFile(SW_LOGFILE *logfile); + +void SwInstallShortcuts(SW *sw, WIZARD_PAGE *wp, SW_COMPONENT *c, SW_TASK *t); +void SwDeleteShortcuts(SW_LOGFILE *logfile); + +bool SwCheckOs(SW *sw, SW_COMPONENT *c); + +bool SwEnterSingle(SW *sw); +void SwLeaveSingle(SW *sw); + +UINT SwWelcomeDlg(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, WIZARD *wizard, WIZARD_PAGE *wizard_page, void *param); +UINT SwModeDlg(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, WIZARD *wizard, WIZARD_PAGE *wizard_page, void *param); +UINT SwNotAdminDlg(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, WIZARD *wizard, WIZARD_PAGE *wizard_page, void *param); +UINT SwComponents(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, WIZARD *wizard, WIZARD_PAGE *wizard_page, void *param); +void SwComponentsInit(HWND hWnd, SW *sw); +void SwComponentsUpdate(HWND hWnd, SW *sw, WIZARD *wizard, WIZARD_PAGE *wizard_page); +UINT SwEula(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, WIZARD *wizard, WIZARD_PAGE *wizard_page, void *param); +void SwEulaUpdate(HWND hWnd, SW *sw, WIZARD *wizard, WIZARD_PAGE *wizard_page); +UINT SwDir(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, WIZARD *wizard, WIZARD_PAGE *wizard_page, void *param); +void SwDirUpdate(HWND hWnd, SW *sw, WIZARD_PAGE *wizard_page); +UINT SwReady(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, WIZARD *wizard, WIZARD_PAGE *wizard_page, void *param); +UINT SwPerform(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, WIZARD *wizard, WIZARD_PAGE *wizard_page, void *param); +void SwPerformInit(HWND hWnd, SW *sw, WIZARD_PAGE *wp); +void SwPerformThread(THREAD *thread, void *param); +void SwPerformPrint(WIZARD_PAGE *wp, wchar_t *str); +UINT SwPerformMsgBox(WIZARD_PAGE *wp, UINT flags, wchar_t *msg); +UINT SwInteractUi(WIZARD_PAGE *wp, SW_UI *ui); +void SwInteractUiCalled(HWND hWnd, SW *sw, WIZARD_PAGE *wp, SW_UI *ui); +bool SwInstallMain(SW *sw, WIZARD_PAGE *wp, SW_COMPONENT *c); +UINT SwError(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, WIZARD *wizard, WIZARD_PAGE *wizard_page, void *param); +UINT SwFinish(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, WIZARD *wizard, WIZARD_PAGE *wizard_page, void *param); +UINT SwUninst1(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, WIZARD *wizard, WIZARD_PAGE *wizard_page, void *param); +bool SwUninstallMain(SW *sw, WIZARD_PAGE *wp, SW_COMPONENT *c); +UINT SwLang1(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, WIZARD *wizard, WIZARD_PAGE *wizard_page, void *param); +void SwLang1Init(HWND hWnd, SW *sw); +UINT SwGetLangIcon(char *name); +void SwLang1Update(HWND hWnd, SW *sw, WIZARD *wizard, WIZARD_PAGE *wizard_page); +UINT SwEasy1(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, WIZARD *wizard, WIZARD_PAGE *wizard_page, void *param); +UINT SwEasy2(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, WIZARD *wizard, WIZARD_PAGE *wizard_page, void *param); +void SwEasy2Update(HWND hWnd, SW *sw, WIZARD *wizard, WIZARD_PAGE *wizard_page); +bool SwEasyMain(SW *sw, WIZARD_PAGE *wp); +UINT SwWeb1(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, WIZARD *wizard, WIZARD_PAGE *wizard_page, void *param); +UINT SwWeb2(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, WIZARD *wizard, WIZARD_PAGE *wizard_page, void *param); +void SwWeb2Update(HWND hWnd, SW *sw, WIZARD *wizard, WIZARD_PAGE *wizard_page); +bool SwWebMain(SW *sw, WIZARD_PAGE *wp); + + +void SwGenerateDefaultSfxFileName(wchar_t *name, UINT size); +void SwGenerateDefaultZipFileName(wchar_t *name, UINT size); + +bool CALLBACK SwEnumResourceNamesProc(HMODULE hModule, const char *type, char *name, LONG_PTR lParam); + +UINT SwSfxModeMain(); +bool CALLBACK SfxModeMainDialogProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam); +bool SwSfxExtractProcess(HWND hWnd, bool *hide_error_msg); +bool SwSfxExtractFile(HWND hWnd, void *data, UINT size, wchar_t *dst, bool compressed); +SW_SFX_FILE *SwNewSfxFile(char *inner_file_name, wchar_t *disk_file_name); +bool SwSfxCopyVgFiles(HWND hWnd, wchar_t *src, wchar_t *dst); + +#endif // SW_INNER_H + + diff --git a/src/Cedar/Sam.c b/src/Cedar/Sam.c index 3836dc5e..2cca73a8 100644 --- a/src/Cedar/Sam.c +++ b/src/Cedar/Sam.c @@ -1,1004 +1,1004 @@ -// SoftEther VPN Source Code - Developer Edition Master Branch -// Cedar Communication Module - - -// Sam.c -// Security Accounts Manager - -#include "CedarPch.h" - - -int base64_enc_len(unsigned int plainLen) { - unsigned int n = plainLen; - return (n + 2 - ((n + 2) % 3)) / 3 * 4; -} - -PID OpenChildProcess(const char* path, char* const parameter[], int fd[] ) -{ -#ifdef OS_WIN32 - // not implemented - return -1; -#else // OS_WIN32 - // UNIX - int fds[2][2]; - PID pid; - - if (path == NULL || parameter == NULL || fd == NULL) - { - return (PID)-1; - } - - if (pipe(fds[0]) != 0) - { - return (PID)-1; - } - - if (pipe(fds[1]) != 0) - { - close(fds[0][0]); - close(fds[0][1]); - - return (PID)-1; - } - - pid = fork(); - if (pid == (PID)0) { - int iError; - - close(fds[0][1]); - close(fds[1][0]); - - if (dup2(fds[0][0], fileno(stdin)) < 0 || dup2(fds[1][1], fileno(stdout)) < 0 ) - { - close(fds[0][0]); - close(fds[1][1]); - - _exit(EXIT_FAILURE); - } - - iError = execvp(path, parameter); - - // We should never come here - close(fds[0][0]); - close(fds[1][1]); - - _exit(iError); - } - else if (pid > (PID)0) - { - close(fds[0][0]); - close(fds[1][1]); - - fd[0] = fds[1][0]; - fd[1] = fds[0][1]; - - return pid; - } - else - { - close(fds[0][0]); - close(fds[1][1]); - - close(fds[0][1]); - close(fds[1][0]); - - return -1; - } -#endif // OS_WIN32 -} - -void CloseChildProcess(PID pid, int* fd ) -{ -#ifdef OS_WIN32 - // not implemented -#else // OS_WIN32 - if( fd != 0 ) - { - close(fd[0]); - close(fd[1]); - } - - if( pid > 0 ) - { - kill(pid, SIGTERM); - } -#endif // OS_WIN32 -} - -bool SmbAuthenticate(char* name, char* password, char* domainname, char* groupname, UINT timeout, UCHAR* challenge8, UCHAR* MsChapV2_ClientResponse, UCHAR* nt_pw_hash_hash) -{ - bool auth = false; - int fds[2]; - FILE* out, *in; - PID pid; - char buffer[255]; - char ntlm_timeout[32]; - char* proc_parameter[6]; - - // DNS Name 255 chars + OU names are limited to 64 characters + cmdline 32 + 1 - char requiremember[352]; - - if (name == NULL || password == NULL || domainname == NULL || groupname == NULL) - { - Debug("Sam.c - SmbAuthenticate - wrong password parameter\n"); - return false; - } - - if (password[0] == '\0' && (challenge8 == NULL || MsChapV2_ClientResponse == NULL || nt_pw_hash_hash == NULL)) - { - Debug("Sam.c - SmbAuthenticate - wrong MsCHAPv2 parameter\n"); - return false; - } - - Zero(buffer, sizeof(buffer)); - - // Truncate string if unsafe char - EnSafeStr(domainname, '\0'); - - if (strlen(domainname) > 255) - { - // there is no domainname longer then 255 chars! - // http://tools.ietf.org/html/rfc1035 section 2.3.4 - domainname[255] = '\0'; - } - - // set timeout to 15 minutes even if timeout is disabled, to prevent ntlm_auth from hung up - if (timeout <= 0 || timeout > 900) - { - timeout = 999; - } - - snprintf(ntlm_timeout, sizeof(ntlm_timeout), "%is", timeout); - Debug("Sam.c - timeout for ntlm_auth %s\n", ntlm_timeout); - - proc_parameter[0] = "timeout"; - proc_parameter[1] = ntlm_timeout; - proc_parameter[2] = "ntlm_auth"; - proc_parameter[3] = "--helper-protocol=ntlm-server-1"; - proc_parameter[4] = 0; - - if (strlen(groupname) > 1) - { - // Truncate string if unsafe char - EnSafeStr(groupname, '\0'); - - snprintf(requiremember, sizeof(requiremember), "--require-membership-of=%s\\%s", domainname, groupname); - - proc_parameter[4] = requiremember; - proc_parameter[5] = 0; - } - - pid = OpenChildProcess("timeout", proc_parameter, fds); - - if (pid < 0) - { - Debug("Sam.c - SmbCheckLogon - error fork child process (ntlm_auth)\n"); - return false; - } - - out = fdopen(fds[1], "w"); - if (out == 0) - { - CloseChildProcess(pid, fds); - - Debug("Sam.c - cant open out pipe (ntlm_auth)\n"); - return false; - } - - in = fdopen(fds[0], "r"); - if (in == 0) - { - fclose(out); - CloseChildProcess(pid, fds); - - Debug("Sam.c - cant open in pipe (ntlm_auth)\n"); - return false; - } - - if (base64_enc_len((unsigned int)strlen(name)) < sizeof(buffer)-1 && - base64_enc_len((unsigned int)strlen(password)) < sizeof(buffer)-1 && - base64_enc_len((unsigned int)strlen(domainname)) < sizeof(buffer)-1) - { - char answer[300]; - - unsigned int end = B64_Encode(buffer, name, (int)strlen(name)); - buffer[end] = '\0'; - fputs("Username:: ", out); - fputs(buffer, out); - fputs("\n", out); - Debug("Username: %s\n", buffer); - buffer[0] = 0; - - end = B64_Encode(buffer, domainname, (int)strlen(domainname)); - buffer[end] = '\0'; - fputs("NT-Domain:: ", out); - fputs(buffer, out); - fputs("\n", out); - Debug("NT-Domain: %s\n", buffer); - buffer[0] = 0; - - if (password[0] != '\0') - { - Debug("Password authentication\n"); - end = B64_Encode(buffer, password, (int)strlen(password)); - buffer[end] = '\0'; - fputs("Password:: ", out); - fputs(buffer, out); - fputs("\n", out); - Debug("Password: %s\n", buffer); - buffer[0] = 0; - } - else - { - char* mschapv2_client_response; - char* base64_challenge8; - - Debug("MsChapV2 authentication\n"); - mschapv2_client_response = CopyBinToStr(MsChapV2_ClientResponse, 24); - end = B64_Encode(buffer, mschapv2_client_response, 48); - buffer[end] = '\0'; - fputs("NT-Response:: ", out); - fputs(buffer, out); - fputs("\n", out); - Debug("NT-Response:: %s\n", buffer); - buffer[0] = 0; - Free(mschapv2_client_response); - - base64_challenge8 = CopyBinToStr(challenge8, 8); - end = B64_Encode(buffer, base64_challenge8 , 16); - buffer[end] = '\0'; - fputs("LANMAN-Challenge:: ", out); - fputs(buffer, out); - fputs("\n", out); - Debug("LANMAN-Challenge:: %s\n", buffer); - buffer[0] = 0; - Free(base64_challenge8); - - fputs("Request-User-Session-Key: Yes\n", out); - } - - // Start authentication - fputs( ".\n", out ); - fflush (out); - // Request send! - - Zero(answer, sizeof(answer)); - - while (fgets(answer, sizeof(answer)-1, in)) - { - char* response_parameter; - - if (strncmp(answer, ".\n", sizeof(answer)-1 ) == 0) - { - break; - } - - /* Indicates a base64 encoded structure */ - response_parameter = strstr(answer, ":: "); - if (!response_parameter) { - char* newline; - - response_parameter = strstr(answer, ": "); - - if (!response_parameter) { - continue; - } - - response_parameter[0] ='\0'; - response_parameter++; - response_parameter[0] ='\0'; - response_parameter++; - - newline = strstr(response_parameter, "\n"); - if( newline ) - newline[0] = '\0'; - } else { - response_parameter[0] ='\0'; - response_parameter++; - response_parameter[0] ='\0'; - response_parameter++; - response_parameter[0] ='\0'; - response_parameter++; - - end = Decode64(response_parameter, response_parameter); - response_parameter[end] = '\0'; - } - - if (strncmp(answer, "Authenticated", sizeof(answer)-1 ) == 0) - { - if (strcmp(response_parameter, "Yes") == 0) - { - Debug("Authenticated!\n"); - auth = true; - } - else if (strcmp(response_parameter, "No") == 0) - { - Debug("Authentication failed!\n"); - auth = false; - } - } - else if (strncmp(answer, "User-Session-Key", sizeof(answer)-1 ) == 0) - { - if (nt_pw_hash_hash != NULL) - { - BUF* Buf = StrToBin(response_parameter); - Copy(nt_pw_hash_hash, Buf->Buf, 16); - FreeBuf(Buf); - } - } - } - } - - fclose(in); - fclose(out); - - CloseChildProcess(pid, fds); - - return auth; -} - - -bool SmbCheckLogon(char* name, char* password, char* domainname, char* groupname, UINT timeout) -{ - return SmbAuthenticate(name, password, domainname, groupname, timeout, NULL, NULL, NULL); -} - -bool SmbPerformMsChapV2Auth(char* name, char* domainname, char* groupname, UCHAR* challenge8, UCHAR* MsChapV2_ClientResponse, UCHAR* nt_pw_hash_hash, UINT timeout) -{ - return SmbAuthenticate(name, "", domainname, groupname, timeout, challenge8, MsChapV2_ClientResponse, nt_pw_hash_hash); -} - -// Password encryption -void SecurePassword(void *secure_password, void *password, void *random) -{ - BUF *b; - // Validate arguments - if (secure_password == NULL || password == NULL || random == NULL) - { - return; - } - - b = NewBuf(); - WriteBuf(b, password, SHA1_SIZE); - WriteBuf(b, random, SHA1_SIZE); - Sha0(secure_password, b->Buf, b->Size); - - FreeBuf(b); -} - -// Generate 160bit random number -void GenRandom(void *random) -{ - // Validate arguments - if (random == NULL) - { - return; - } - - Rand(random, SHA1_SIZE); -} - -// Anonymous authentication of user -bool SamAuthUserByAnonymous(HUB *h, char *username) -{ - bool b = false; - // Validate arguments - if (h == NULL || username == NULL) - { - return false; - } - - AcLock(h); - { - USER *u = AcGetUser(h, username); - if (u) - { - Lock(u->lock); - { - if (u->AuthType == AUTHTYPE_ANONYMOUS) - { - b = true; - } - } - Unlock(u->lock); - } - ReleaseUser(u); - } - AcUnlock(h); - - return b; -} - -// Plaintext password authentication of user -bool SamAuthUserByPlainPassword(CONNECTION *c, HUB *hub, char *username, char *password, bool ast, UCHAR *mschap_v2_server_response_20, RADIUS_LOGIN_OPTION *opt) -{ - bool b = false; - wchar_t *name = NULL; - wchar_t *groupname = NULL; - UINT timeout = 90; - bool auth_by_nt = false; - HUB *h; - // Validate arguments - if (hub == NULL || c == NULL || username == NULL) - { - return false; - } - - if (GetGlobalServerFlag(GSF_DISABLE_RADIUS_AUTH) != 0) - { - return false; - } - - h = hub; - - AddRef(h->ref); - - // Get the user name on authentication system - AcLock(hub); - { - USER *u; - u = AcGetUser(hub, ast == false ? username : "*"); - if (u) - { - Lock(u->lock); - { - if (u->AuthType == AUTHTYPE_RADIUS) - { - // Radius authentication - AUTHRADIUS *auth = (AUTHRADIUS *)u->AuthData; - if (ast || auth->RadiusUsername == NULL || UniStrLen(auth->RadiusUsername) == 0) - { - if( IsEmptyStr(h->RadiusRealm) == false ) - { - char name_and_realm[MAX_SIZE]; - StrCpy(name_and_realm, sizeof(name_and_realm), username); - StrCat(name_and_realm, sizeof(name_and_realm), "@"); - StrCat(name_and_realm, sizeof(name_and_realm), h->RadiusRealm); - name = CopyStrToUni(name_and_realm); - } - else - { - name = CopyStrToUni(username); - } - } - else - { - name = CopyUniStr(auth->RadiusUsername); - } - auth_by_nt = false; - } - else if (u->AuthType == AUTHTYPE_NT) - { - // NT authentication - AUTHNT *auth = (AUTHNT *)u->AuthData; - if (ast || auth->NtUsername == NULL || UniStrLen(auth->NtUsername) == 0) - { - name = CopyStrToUni(username); - } - else - { - name = CopyUniStr(auth->NtUsername); - } - - groupname = CopyStrToUni(u->GroupName); - - if (u->Policy) - { - timeout = u->Policy->TimeOut; - } - - auth_by_nt = true; - } - } - Unlock(u->lock); - ReleaseUser(u); - } - } - AcUnlock(hub); - - if (name != NULL) - { - if (auth_by_nt == false) - { - // Radius authentication - char radius_server_addr[MAX_SIZE]; - UINT radius_server_port; - char radius_secret[MAX_SIZE]; - char suffix_filter[MAX_SIZE]; - wchar_t suffix_filter_w[MAX_SIZE]; - UINT interval; - - Zero(suffix_filter, sizeof(suffix_filter)); - Zero(suffix_filter_w, sizeof(suffix_filter_w)); - - // Get the Radius server information - if (GetRadiusServerEx2(hub, radius_server_addr, sizeof(radius_server_addr), &radius_server_port, radius_secret, sizeof(radius_secret), &interval, suffix_filter, sizeof(suffix_filter))) - { - Unlock(hub->lock); - - StrToUni(suffix_filter_w, sizeof(suffix_filter_w), suffix_filter); - - if (UniIsEmptyStr(suffix_filter_w) || UniEndWith(name, suffix_filter_w)) - { - // Attempt to login - b = RadiusLogin(c, radius_server_addr, radius_server_port, - radius_secret, StrLen(radius_secret), - name, password, interval, mschap_v2_server_response_20, opt, hub->Name); - - if (b) - { - if (opt != NULL) - { - opt->Out_IsRadiusLogin = true; - } - } - } - - Lock(hub->lock); - } - else - { - HLog(hub, "LH_NO_RADIUS_SETTING", name); - } - } - else - { - // NT authentication -#ifdef OS_WIN32 - IPC_MSCHAP_V2_AUTHINFO mschap; - Unlock(hub->lock); - - if (ParseAndExtractMsChapV2InfoFromPassword(&mschap, password) == false) - { - // Plaintext password authentication - b = MsCheckLogon(name, password); - } - else - { - UCHAR challenge8[8]; - UCHAR nt_pw_hash_hash[16]; - char nt_name[MAX_SIZE]; - - UniToStr(nt_name, sizeof(nt_name), name); - - // MS-CHAPv2 authentication - MsChapV2_GenerateChallenge8(challenge8, mschap.MsChapV2_ClientChallenge, - mschap.MsChapV2_ServerChallenge, - mschap.MsChapV2_PPPUsername); - - Debug("MsChapV2_PPPUsername = %s, nt_name = %s\n", mschap.MsChapV2_PPPUsername, nt_name); - - b = MsPerformMsChapV2AuthByLsa(nt_name, challenge8, mschap.MsChapV2_ClientResponse, nt_pw_hash_hash); - - if (b) - { - if (mschap_v2_server_response_20 != NULL) - { - MsChapV2Server_GenerateResponse(mschap_v2_server_response_20, nt_pw_hash_hash, - mschap.MsChapV2_ClientResponse, challenge8); - } - } - } - - Lock(hub->lock); -#else // OS_WIN32 - // Unix / Samba Winbind - - IPC_MSCHAP_V2_AUTHINFO mschap; - Unlock(hub->lock); - - char nt_name[MAX_SIZE]; - char nt_username[MAX_SIZE]; - char nt_groupname[MAX_SIZE]; - char nt_domainname[MAX_SIZE]; - UCHAR challenge8[8]; - UCHAR nt_pw_hash_hash[16]; - - nt_groupname[0] = 0; - - UniToStr(nt_name, sizeof(nt_name), name); - - if (groupname != NULL) - UniToStr(nt_groupname, sizeof(nt_groupname), groupname); - - ParseNtUsername(nt_name, nt_username, sizeof(nt_username), nt_domainname, sizeof(nt_domainname), false); - - if (ParseAndExtractMsChapV2InfoFromPassword(&mschap, password) == false) - { - // Plaintext password authentication - b = SmbCheckLogon(nt_username, password, nt_domainname, nt_groupname, timeout); - } - else - { - // MS-CHAPv2 authentication - MsChapV2_GenerateChallenge8(challenge8, mschap.MsChapV2_ClientChallenge, - mschap.MsChapV2_ServerChallenge, - mschap.MsChapV2_PPPUsername); - - Debug("MsChapV2_PPPUsername = %s, nt_name = %s\n", mschap.MsChapV2_PPPUsername, nt_name); - - b = SmbPerformMsChapV2Auth(nt_username, nt_domainname, nt_groupname, challenge8, mschap.MsChapV2_ClientResponse, nt_pw_hash_hash, timeout); - - if (b) - { - if (mschap_v2_server_response_20 != NULL) - { - MsChapV2Server_GenerateResponse(mschap_v2_server_response_20, nt_pw_hash_hash, - mschap.MsChapV2_ClientResponse, challenge8); - } - } - } - - Lock(hub->lock); -#endif // OS_WIN32 / OS_LINUX - } - - // Memory release - if( groupname != NULL ) - Free(groupname); - Free(name); - } - - ReleaseHub(h); - - return b; -} - -// Certificate authentication of user -bool SamAuthUserByCert(HUB *h, char *username, X *x) -{ - bool b = false; - // Validate arguments - if (h == NULL || username == NULL || x == NULL) - { - return false; - } - - if (GetGlobalServerFlag(GSF_DISABLE_CERT_AUTH) != 0) - { - return false; - } - - // Check expiration date - if (CheckXDateNow(x) == false) - { - return false; - } - - // Check the Certification Revocation List - if (IsValidCertInHub(h, x) == false) - { - // Bad - wchar_t tmp[MAX_SIZE * 2]; - - // Log the contents of the certificate - GetAllNameFromX(tmp, sizeof(tmp), x); - - HLog(h, "LH_AUTH_NG_CERT", username, tmp); - return false; - } - - AcLock(h); - { - USER *u; - u = AcGetUser(h, username); - if (u) - { - Lock(u->lock); - { - if (u->AuthType == AUTHTYPE_USERCERT) - { - // Check whether to matche with the registered certificate - AUTHUSERCERT *auth = (AUTHUSERCERT *)u->AuthData; - if (CompareX(auth->UserX, x)) - { - b = true; - } - } - else if (u->AuthType == AUTHTYPE_ROOTCERT) - { - // Check whether the certificate has been signed by the root certificate - AUTHROOTCERT *auth = (AUTHROOTCERT *)u->AuthData; - if (h->HubDb != NULL) - { - LockList(h->HubDb->RootCertList); - { - X *root_cert; - root_cert = GetIssuerFromList(h->HubDb->RootCertList, x); - if (root_cert != NULL) - { - b = true; - if (auth->CommonName != NULL && UniIsEmptyStr(auth->CommonName) == false) - { - // Compare the CN - if (UniStrCmpi(x->subject_name->CommonName, auth->CommonName) != 0) - { - b = false; - } - } - if (auth->Serial != NULL && auth->Serial->size >= 1) - { - // Compare the serial number - if (CompareXSerial(x->serial, auth->Serial) == false) - { - b = false; - } - } - } - } - UnlockList(h->HubDb->RootCertList); - } - } - } - Unlock(u->lock); - ReleaseUser(u); - } - } - AcUnlock(h); - - if (b) - { - wchar_t tmp[MAX_SIZE * 2]; - - // Log the contents of the certificate - GetAllNameFromX(tmp, sizeof(tmp), x); - - HLog(h, "LH_AUTH_OK_CERT", username, tmp); - } - - return b; -} - -// Get the root certificate that signed the specified certificate from the list -X *GetIssuerFromList(LIST *cert_list, X *cert) -{ - UINT i; - X *ret = NULL; - // Validate arguments - if (cert_list == NULL || cert == NULL) - { - return NULL; - } - - for (i = 0;i < LIST_NUM(cert_list);i++) - { - X *x = LIST_DATA(cert_list, i); - // Name comparison - if (CheckXDateNow(x)) - { - if (CompareName(x->subject_name, cert->issuer_name)) - { - // Get the public key of the root certificate - K *k = GetKFromX(x); - - if (k != NULL) - { - // Check the signature - if (CheckSignature(cert, k)) - { - ret = x; - } - FreeK(k); - } - } - } - if (CompareX(x, cert)) - { - // Complete identical - ret = x; - } - } - - return ret; -} - -// Get the policy to be applied for the user -POLICY *SamGetUserPolicy(HUB *h, char *username) -{ - POLICY *ret = NULL; - // Validate arguments - if (h == NULL || username == NULL) - { - return NULL; - } - - AcLock(h); - { - USER *u; - u = AcGetUser(h, username); - if (u) - { - USERGROUP *g = NULL; - Lock(u->lock); - { - if (u->Policy != NULL) - { - ret = ClonePolicy(u->Policy); - } - - g = u->Group; - - if (g != NULL) - { - AddRef(g->ref); - } - } - Unlock(u->lock); - - ReleaseUser(u); - u = NULL; - - if (ret == NULL) - { - if (g != NULL) - { - Lock(g->lock); - { - ret = ClonePolicy(g->Policy); - } - Unlock(g->lock); - } - } - - if (g != NULL) - { - ReleaseGroup(g); - } - } - } - AcUnlock(h); - - return ret; -} - -// Password authentication of user -bool SamAuthUserByPassword(HUB *h, char *username, void *random, void *secure_password, char *mschap_v2_password, UCHAR *mschap_v2_server_response_20, UINT *err) -{ - bool b = false; - UCHAR secure_password_check[SHA1_SIZE]; - bool is_mschap = false; - IPC_MSCHAP_V2_AUTHINFO mschap; - UINT dummy = 0; - // Validate arguments - if (h == NULL || username == NULL || secure_password == NULL) - { - return false; - } - if (err == NULL) - { - err = &dummy; - } - - *err = 0; - - Zero(&mschap, sizeof(mschap)); - - is_mschap = ParseAndExtractMsChapV2InfoFromPassword(&mschap, mschap_v2_password); - - if (StrCmpi(username, ADMINISTRATOR_USERNAME) == 0) - { - // Administrator mode - SecurePassword(secure_password_check, h->SecurePassword, random); - if (Cmp(secure_password_check, secure_password, SHA1_SIZE) == 0) - { - return true; - } - else - { - return false; - } - } - - AcLock(h); - { - USER *u; - u = AcGetUser(h, username); - if (u) - { - Lock(u->lock); - { - if (u->AuthType == AUTHTYPE_PASSWORD) - { - AUTHPASSWORD *auth = (AUTHPASSWORD *)u->AuthData; - - if (is_mschap == false) - { - // Normal password authentication - SecurePassword(secure_password_check, auth->HashedKey, random); - if (Cmp(secure_password_check, secure_password, SHA1_SIZE) == 0) - { - b = true; - } - } - else - { - // MS-CHAP v2 authentication via PPP - UCHAR challenge8[8]; - UCHAR client_response[24]; - - if (IsZero(auth->NtLmSecureHash, MD5_SIZE)) - { - // NTLM hash is not registered in the user account - *err = ERR_MSCHAP2_PASSWORD_NEED_RESET; - } - else - { - UCHAR nt_pw_hash_hash[16]; - Zero(challenge8, sizeof(challenge8)); - Zero(client_response, sizeof(client_response)); - - MsChapV2_GenerateChallenge8(challenge8, mschap.MsChapV2_ClientChallenge, mschap.MsChapV2_ServerChallenge, - mschap.MsChapV2_PPPUsername); - - MsChapV2Client_GenerateResponse(client_response, challenge8, auth->NtLmSecureHash); - - if (Cmp(client_response, mschap.MsChapV2_ClientResponse, 24) == 0) - { - // Hash matched - b = true; - - // Calculate the response - GenerateNtPasswordHashHash(nt_pw_hash_hash, auth->NtLmSecureHash); - MsChapV2Server_GenerateResponse(mschap_v2_server_response_20, nt_pw_hash_hash, - client_response, challenge8); - } - } - } - } - } - Unlock(u->lock); - ReleaseUser(u); - } - } - AcUnlock(h); - - return b; -} - -// Make sure that the user exists -bool SamIsUser(HUB *h, char *username) -{ - bool b; - // Validate arguments - if (h == NULL || username == NULL) - { - return false; - } - - AcLock(h); - { - b = AcIsUser(h, username); - } - AcUnlock(h); - - return b; -} - -// Get the type of authentication used by the user -UINT SamGetUserAuthType(HUB *h, char *username) -{ - UINT authtype; - // Validate arguments - if (h == NULL || username == NULL) - { - return INFINITE; - } - - AcLock(h); - { - USER *u = AcGetUser(h, username); - if (u == NULL) - { - authtype = INFINITE; - } - else - { - authtype = u->AuthType; - ReleaseUser(u); - } - } - AcUnlock(h); - - return authtype; -} - +// SoftEther VPN Source Code - Developer Edition Master Branch +// Cedar Communication Module + + +// Sam.c +// Security Accounts Manager + +#include "CedarPch.h" + + +int base64_enc_len(unsigned int plainLen) { + unsigned int n = plainLen; + return (n + 2 - ((n + 2) % 3)) / 3 * 4; +} + +PID OpenChildProcess(const char* path, char* const parameter[], int fd[] ) +{ +#ifdef OS_WIN32 + // not implemented + return -1; +#else // OS_WIN32 + // UNIX + int fds[2][2]; + PID pid; + + if (path == NULL || parameter == NULL || fd == NULL) + { + return (PID)-1; + } + + if (pipe(fds[0]) != 0) + { + return (PID)-1; + } + + if (pipe(fds[1]) != 0) + { + close(fds[0][0]); + close(fds[0][1]); + + return (PID)-1; + } + + pid = fork(); + if (pid == (PID)0) { + int iError; + + close(fds[0][1]); + close(fds[1][0]); + + if (dup2(fds[0][0], fileno(stdin)) < 0 || dup2(fds[1][1], fileno(stdout)) < 0 ) + { + close(fds[0][0]); + close(fds[1][1]); + + _exit(EXIT_FAILURE); + } + + iError = execvp(path, parameter); + + // We should never come here + close(fds[0][0]); + close(fds[1][1]); + + _exit(iError); + } + else if (pid > (PID)0) + { + close(fds[0][0]); + close(fds[1][1]); + + fd[0] = fds[1][0]; + fd[1] = fds[0][1]; + + return pid; + } + else + { + close(fds[0][0]); + close(fds[1][1]); + + close(fds[0][1]); + close(fds[1][0]); + + return -1; + } +#endif // OS_WIN32 +} + +void CloseChildProcess(PID pid, int* fd ) +{ +#ifdef OS_WIN32 + // not implemented +#else // OS_WIN32 + if( fd != 0 ) + { + close(fd[0]); + close(fd[1]); + } + + if( pid > 0 ) + { + kill(pid, SIGTERM); + } +#endif // OS_WIN32 +} + +bool SmbAuthenticate(char* name, char* password, char* domainname, char* groupname, UINT timeout, UCHAR* challenge8, UCHAR* MsChapV2_ClientResponse, UCHAR* nt_pw_hash_hash) +{ + bool auth = false; + int fds[2]; + FILE* out, *in; + PID pid; + char buffer[255]; + char ntlm_timeout[32]; + char* proc_parameter[6]; + + // DNS Name 255 chars + OU names are limited to 64 characters + cmdline 32 + 1 + char requiremember[352]; + + if (name == NULL || password == NULL || domainname == NULL || groupname == NULL) + { + Debug("Sam.c - SmbAuthenticate - wrong password parameter\n"); + return false; + } + + if (password[0] == '\0' && (challenge8 == NULL || MsChapV2_ClientResponse == NULL || nt_pw_hash_hash == NULL)) + { + Debug("Sam.c - SmbAuthenticate - wrong MsCHAPv2 parameter\n"); + return false; + } + + Zero(buffer, sizeof(buffer)); + + // Truncate string if unsafe char + EnSafeStr(domainname, '\0'); + + if (strlen(domainname) > 255) + { + // there is no domainname longer then 255 chars! + // http://tools.ietf.org/html/rfc1035 section 2.3.4 + domainname[255] = '\0'; + } + + // set timeout to 15 minutes even if timeout is disabled, to prevent ntlm_auth from hung up + if (timeout <= 0 || timeout > 900) + { + timeout = 999; + } + + snprintf(ntlm_timeout, sizeof(ntlm_timeout), "%is", timeout); + Debug("Sam.c - timeout for ntlm_auth %s\n", ntlm_timeout); + + proc_parameter[0] = "timeout"; + proc_parameter[1] = ntlm_timeout; + proc_parameter[2] = "ntlm_auth"; + proc_parameter[3] = "--helper-protocol=ntlm-server-1"; + proc_parameter[4] = 0; + + if (strlen(groupname) > 1) + { + // Truncate string if unsafe char + EnSafeStr(groupname, '\0'); + + snprintf(requiremember, sizeof(requiremember), "--require-membership-of=%s\\%s", domainname, groupname); + + proc_parameter[4] = requiremember; + proc_parameter[5] = 0; + } + + pid = OpenChildProcess("timeout", proc_parameter, fds); + + if (pid < 0) + { + Debug("Sam.c - SmbCheckLogon - error fork child process (ntlm_auth)\n"); + return false; + } + + out = fdopen(fds[1], "w"); + if (out == 0) + { + CloseChildProcess(pid, fds); + + Debug("Sam.c - cant open out pipe (ntlm_auth)\n"); + return false; + } + + in = fdopen(fds[0], "r"); + if (in == 0) + { + fclose(out); + CloseChildProcess(pid, fds); + + Debug("Sam.c - cant open in pipe (ntlm_auth)\n"); + return false; + } + + if (base64_enc_len((unsigned int)strlen(name)) < sizeof(buffer)-1 && + base64_enc_len((unsigned int)strlen(password)) < sizeof(buffer)-1 && + base64_enc_len((unsigned int)strlen(domainname)) < sizeof(buffer)-1) + { + char answer[300]; + + unsigned int end = B64_Encode(buffer, name, (int)strlen(name)); + buffer[end] = '\0'; + fputs("Username:: ", out); + fputs(buffer, out); + fputs("\n", out); + Debug("Username: %s\n", buffer); + buffer[0] = 0; + + end = B64_Encode(buffer, domainname, (int)strlen(domainname)); + buffer[end] = '\0'; + fputs("NT-Domain:: ", out); + fputs(buffer, out); + fputs("\n", out); + Debug("NT-Domain: %s\n", buffer); + buffer[0] = 0; + + if (password[0] != '\0') + { + Debug("Password authentication\n"); + end = B64_Encode(buffer, password, (int)strlen(password)); + buffer[end] = '\0'; + fputs("Password:: ", out); + fputs(buffer, out); + fputs("\n", out); + Debug("Password: %s\n", buffer); + buffer[0] = 0; + } + else + { + char* mschapv2_client_response; + char* base64_challenge8; + + Debug("MsChapV2 authentication\n"); + mschapv2_client_response = CopyBinToStr(MsChapV2_ClientResponse, 24); + end = B64_Encode(buffer, mschapv2_client_response, 48); + buffer[end] = '\0'; + fputs("NT-Response:: ", out); + fputs(buffer, out); + fputs("\n", out); + Debug("NT-Response:: %s\n", buffer); + buffer[0] = 0; + Free(mschapv2_client_response); + + base64_challenge8 = CopyBinToStr(challenge8, 8); + end = B64_Encode(buffer, base64_challenge8 , 16); + buffer[end] = '\0'; + fputs("LANMAN-Challenge:: ", out); + fputs(buffer, out); + fputs("\n", out); + Debug("LANMAN-Challenge:: %s\n", buffer); + buffer[0] = 0; + Free(base64_challenge8); + + fputs("Request-User-Session-Key: Yes\n", out); + } + + // Start authentication + fputs( ".\n", out ); + fflush (out); + // Request send! + + Zero(answer, sizeof(answer)); + + while (fgets(answer, sizeof(answer)-1, in)) + { + char* response_parameter; + + if (strncmp(answer, ".\n", sizeof(answer)-1 ) == 0) + { + break; + } + + /* Indicates a base64 encoded structure */ + response_parameter = strstr(answer, ":: "); + if (!response_parameter) { + char* newline; + + response_parameter = strstr(answer, ": "); + + if (!response_parameter) { + continue; + } + + response_parameter[0] ='\0'; + response_parameter++; + response_parameter[0] ='\0'; + response_parameter++; + + newline = strstr(response_parameter, "\n"); + if( newline ) + newline[0] = '\0'; + } else { + response_parameter[0] ='\0'; + response_parameter++; + response_parameter[0] ='\0'; + response_parameter++; + response_parameter[0] ='\0'; + response_parameter++; + + end = Decode64(response_parameter, response_parameter); + response_parameter[end] = '\0'; + } + + if (strncmp(answer, "Authenticated", sizeof(answer)-1 ) == 0) + { + if (strcmp(response_parameter, "Yes") == 0) + { + Debug("Authenticated!\n"); + auth = true; + } + else if (strcmp(response_parameter, "No") == 0) + { + Debug("Authentication failed!\n"); + auth = false; + } + } + else if (strncmp(answer, "User-Session-Key", sizeof(answer)-1 ) == 0) + { + if (nt_pw_hash_hash != NULL) + { + BUF* Buf = StrToBin(response_parameter); + Copy(nt_pw_hash_hash, Buf->Buf, 16); + FreeBuf(Buf); + } + } + } + } + + fclose(in); + fclose(out); + + CloseChildProcess(pid, fds); + + return auth; +} + + +bool SmbCheckLogon(char* name, char* password, char* domainname, char* groupname, UINT timeout) +{ + return SmbAuthenticate(name, password, domainname, groupname, timeout, NULL, NULL, NULL); +} + +bool SmbPerformMsChapV2Auth(char* name, char* domainname, char* groupname, UCHAR* challenge8, UCHAR* MsChapV2_ClientResponse, UCHAR* nt_pw_hash_hash, UINT timeout) +{ + return SmbAuthenticate(name, "", domainname, groupname, timeout, challenge8, MsChapV2_ClientResponse, nt_pw_hash_hash); +} + +// Password encryption +void SecurePassword(void *secure_password, void *password, void *random) +{ + BUF *b; + // Validate arguments + if (secure_password == NULL || password == NULL || random == NULL) + { + return; + } + + b = NewBuf(); + WriteBuf(b, password, SHA1_SIZE); + WriteBuf(b, random, SHA1_SIZE); + Sha0(secure_password, b->Buf, b->Size); + + FreeBuf(b); +} + +// Generate 160bit random number +void GenRandom(void *random) +{ + // Validate arguments + if (random == NULL) + { + return; + } + + Rand(random, SHA1_SIZE); +} + +// Anonymous authentication of user +bool SamAuthUserByAnonymous(HUB *h, char *username) +{ + bool b = false; + // Validate arguments + if (h == NULL || username == NULL) + { + return false; + } + + AcLock(h); + { + USER *u = AcGetUser(h, username); + if (u) + { + Lock(u->lock); + { + if (u->AuthType == AUTHTYPE_ANONYMOUS) + { + b = true; + } + } + Unlock(u->lock); + } + ReleaseUser(u); + } + AcUnlock(h); + + return b; +} + +// Plaintext password authentication of user +bool SamAuthUserByPlainPassword(CONNECTION *c, HUB *hub, char *username, char *password, bool ast, UCHAR *mschap_v2_server_response_20, RADIUS_LOGIN_OPTION *opt) +{ + bool b = false; + wchar_t *name = NULL; + wchar_t *groupname = NULL; + UINT timeout = 90; + bool auth_by_nt = false; + HUB *h; + // Validate arguments + if (hub == NULL || c == NULL || username == NULL) + { + return false; + } + + if (GetGlobalServerFlag(GSF_DISABLE_RADIUS_AUTH) != 0) + { + return false; + } + + h = hub; + + AddRef(h->ref); + + // Get the user name on authentication system + AcLock(hub); + { + USER *u; + u = AcGetUser(hub, ast == false ? username : "*"); + if (u) + { + Lock(u->lock); + { + if (u->AuthType == AUTHTYPE_RADIUS) + { + // Radius authentication + AUTHRADIUS *auth = (AUTHRADIUS *)u->AuthData; + if (ast || auth->RadiusUsername == NULL || UniStrLen(auth->RadiusUsername) == 0) + { + if( IsEmptyStr(h->RadiusRealm) == false ) + { + char name_and_realm[MAX_SIZE]; + StrCpy(name_and_realm, sizeof(name_and_realm), username); + StrCat(name_and_realm, sizeof(name_and_realm), "@"); + StrCat(name_and_realm, sizeof(name_and_realm), h->RadiusRealm); + name = CopyStrToUni(name_and_realm); + } + else + { + name = CopyStrToUni(username); + } + } + else + { + name = CopyUniStr(auth->RadiusUsername); + } + auth_by_nt = false; + } + else if (u->AuthType == AUTHTYPE_NT) + { + // NT authentication + AUTHNT *auth = (AUTHNT *)u->AuthData; + if (ast || auth->NtUsername == NULL || UniStrLen(auth->NtUsername) == 0) + { + name = CopyStrToUni(username); + } + else + { + name = CopyUniStr(auth->NtUsername); + } + + groupname = CopyStrToUni(u->GroupName); + + if (u->Policy) + { + timeout = u->Policy->TimeOut; + } + + auth_by_nt = true; + } + } + Unlock(u->lock); + ReleaseUser(u); + } + } + AcUnlock(hub); + + if (name != NULL) + { + if (auth_by_nt == false) + { + // Radius authentication + char radius_server_addr[MAX_SIZE]; + UINT radius_server_port; + char radius_secret[MAX_SIZE]; + char suffix_filter[MAX_SIZE]; + wchar_t suffix_filter_w[MAX_SIZE]; + UINT interval; + + Zero(suffix_filter, sizeof(suffix_filter)); + Zero(suffix_filter_w, sizeof(suffix_filter_w)); + + // Get the Radius server information + if (GetRadiusServerEx2(hub, radius_server_addr, sizeof(radius_server_addr), &radius_server_port, radius_secret, sizeof(radius_secret), &interval, suffix_filter, sizeof(suffix_filter))) + { + Unlock(hub->lock); + + StrToUni(suffix_filter_w, sizeof(suffix_filter_w), suffix_filter); + + if (UniIsEmptyStr(suffix_filter_w) || UniEndWith(name, suffix_filter_w)) + { + // Attempt to login + b = RadiusLogin(c, radius_server_addr, radius_server_port, + radius_secret, StrLen(radius_secret), + name, password, interval, mschap_v2_server_response_20, opt, hub->Name); + + if (b) + { + if (opt != NULL) + { + opt->Out_IsRadiusLogin = true; + } + } + } + + Lock(hub->lock); + } + else + { + HLog(hub, "LH_NO_RADIUS_SETTING", name); + } + } + else + { + // NT authentication +#ifdef OS_WIN32 + IPC_MSCHAP_V2_AUTHINFO mschap; + Unlock(hub->lock); + + if (ParseAndExtractMsChapV2InfoFromPassword(&mschap, password) == false) + { + // Plaintext password authentication + b = MsCheckLogon(name, password); + } + else + { + UCHAR challenge8[8]; + UCHAR nt_pw_hash_hash[16]; + char nt_name[MAX_SIZE]; + + UniToStr(nt_name, sizeof(nt_name), name); + + // MS-CHAPv2 authentication + MsChapV2_GenerateChallenge8(challenge8, mschap.MsChapV2_ClientChallenge, + mschap.MsChapV2_ServerChallenge, + mschap.MsChapV2_PPPUsername); + + Debug("MsChapV2_PPPUsername = %s, nt_name = %s\n", mschap.MsChapV2_PPPUsername, nt_name); + + b = MsPerformMsChapV2AuthByLsa(nt_name, challenge8, mschap.MsChapV2_ClientResponse, nt_pw_hash_hash); + + if (b) + { + if (mschap_v2_server_response_20 != NULL) + { + MsChapV2Server_GenerateResponse(mschap_v2_server_response_20, nt_pw_hash_hash, + mschap.MsChapV2_ClientResponse, challenge8); + } + } + } + + Lock(hub->lock); +#else // OS_WIN32 + // Unix / Samba Winbind + + IPC_MSCHAP_V2_AUTHINFO mschap; + Unlock(hub->lock); + + char nt_name[MAX_SIZE]; + char nt_username[MAX_SIZE]; + char nt_groupname[MAX_SIZE]; + char nt_domainname[MAX_SIZE]; + UCHAR challenge8[8]; + UCHAR nt_pw_hash_hash[16]; + + nt_groupname[0] = 0; + + UniToStr(nt_name, sizeof(nt_name), name); + + if (groupname != NULL) + UniToStr(nt_groupname, sizeof(nt_groupname), groupname); + + ParseNtUsername(nt_name, nt_username, sizeof(nt_username), nt_domainname, sizeof(nt_domainname), false); + + if (ParseAndExtractMsChapV2InfoFromPassword(&mschap, password) == false) + { + // Plaintext password authentication + b = SmbCheckLogon(nt_username, password, nt_domainname, nt_groupname, timeout); + } + else + { + // MS-CHAPv2 authentication + MsChapV2_GenerateChallenge8(challenge8, mschap.MsChapV2_ClientChallenge, + mschap.MsChapV2_ServerChallenge, + mschap.MsChapV2_PPPUsername); + + Debug("MsChapV2_PPPUsername = %s, nt_name = %s\n", mschap.MsChapV2_PPPUsername, nt_name); + + b = SmbPerformMsChapV2Auth(nt_username, nt_domainname, nt_groupname, challenge8, mschap.MsChapV2_ClientResponse, nt_pw_hash_hash, timeout); + + if (b) + { + if (mschap_v2_server_response_20 != NULL) + { + MsChapV2Server_GenerateResponse(mschap_v2_server_response_20, nt_pw_hash_hash, + mschap.MsChapV2_ClientResponse, challenge8); + } + } + } + + Lock(hub->lock); +#endif // OS_WIN32 / OS_LINUX + } + + // Memory release + if( groupname != NULL ) + Free(groupname); + Free(name); + } + + ReleaseHub(h); + + return b; +} + +// Certificate authentication of user +bool SamAuthUserByCert(HUB *h, char *username, X *x) +{ + bool b = false; + // Validate arguments + if (h == NULL || username == NULL || x == NULL) + { + return false; + } + + if (GetGlobalServerFlag(GSF_DISABLE_CERT_AUTH) != 0) + { + return false; + } + + // Check expiration date + if (CheckXDateNow(x) == false) + { + return false; + } + + // Check the Certification Revocation List + if (IsValidCertInHub(h, x) == false) + { + // Bad + wchar_t tmp[MAX_SIZE * 2]; + + // Log the contents of the certificate + GetAllNameFromX(tmp, sizeof(tmp), x); + + HLog(h, "LH_AUTH_NG_CERT", username, tmp); + return false; + } + + AcLock(h); + { + USER *u; + u = AcGetUser(h, username); + if (u) + { + Lock(u->lock); + { + if (u->AuthType == AUTHTYPE_USERCERT) + { + // Check whether to matche with the registered certificate + AUTHUSERCERT *auth = (AUTHUSERCERT *)u->AuthData; + if (CompareX(auth->UserX, x)) + { + b = true; + } + } + else if (u->AuthType == AUTHTYPE_ROOTCERT) + { + // Check whether the certificate has been signed by the root certificate + AUTHROOTCERT *auth = (AUTHROOTCERT *)u->AuthData; + if (h->HubDb != NULL) + { + LockList(h->HubDb->RootCertList); + { + X *root_cert; + root_cert = GetIssuerFromList(h->HubDb->RootCertList, x); + if (root_cert != NULL) + { + b = true; + if (auth->CommonName != NULL && UniIsEmptyStr(auth->CommonName) == false) + { + // Compare the CN + if (UniStrCmpi(x->subject_name->CommonName, auth->CommonName) != 0) + { + b = false; + } + } + if (auth->Serial != NULL && auth->Serial->size >= 1) + { + // Compare the serial number + if (CompareXSerial(x->serial, auth->Serial) == false) + { + b = false; + } + } + } + } + UnlockList(h->HubDb->RootCertList); + } + } + } + Unlock(u->lock); + ReleaseUser(u); + } + } + AcUnlock(h); + + if (b) + { + wchar_t tmp[MAX_SIZE * 2]; + + // Log the contents of the certificate + GetAllNameFromX(tmp, sizeof(tmp), x); + + HLog(h, "LH_AUTH_OK_CERT", username, tmp); + } + + return b; +} + +// Get the root certificate that signed the specified certificate from the list +X *GetIssuerFromList(LIST *cert_list, X *cert) +{ + UINT i; + X *ret = NULL; + // Validate arguments + if (cert_list == NULL || cert == NULL) + { + return NULL; + } + + for (i = 0;i < LIST_NUM(cert_list);i++) + { + X *x = LIST_DATA(cert_list, i); + // Name comparison + if (CheckXDateNow(x)) + { + if (CompareName(x->subject_name, cert->issuer_name)) + { + // Get the public key of the root certificate + K *k = GetKFromX(x); + + if (k != NULL) + { + // Check the signature + if (CheckSignature(cert, k)) + { + ret = x; + } + FreeK(k); + } + } + } + if (CompareX(x, cert)) + { + // Complete identical + ret = x; + } + } + + return ret; +} + +// Get the policy to be applied for the user +POLICY *SamGetUserPolicy(HUB *h, char *username) +{ + POLICY *ret = NULL; + // Validate arguments + if (h == NULL || username == NULL) + { + return NULL; + } + + AcLock(h); + { + USER *u; + u = AcGetUser(h, username); + if (u) + { + USERGROUP *g = NULL; + Lock(u->lock); + { + if (u->Policy != NULL) + { + ret = ClonePolicy(u->Policy); + } + + g = u->Group; + + if (g != NULL) + { + AddRef(g->ref); + } + } + Unlock(u->lock); + + ReleaseUser(u); + u = NULL; + + if (ret == NULL) + { + if (g != NULL) + { + Lock(g->lock); + { + ret = ClonePolicy(g->Policy); + } + Unlock(g->lock); + } + } + + if (g != NULL) + { + ReleaseGroup(g); + } + } + } + AcUnlock(h); + + return ret; +} + +// Password authentication of user +bool SamAuthUserByPassword(HUB *h, char *username, void *random, void *secure_password, char *mschap_v2_password, UCHAR *mschap_v2_server_response_20, UINT *err) +{ + bool b = false; + UCHAR secure_password_check[SHA1_SIZE]; + bool is_mschap = false; + IPC_MSCHAP_V2_AUTHINFO mschap; + UINT dummy = 0; + // Validate arguments + if (h == NULL || username == NULL || secure_password == NULL) + { + return false; + } + if (err == NULL) + { + err = &dummy; + } + + *err = 0; + + Zero(&mschap, sizeof(mschap)); + + is_mschap = ParseAndExtractMsChapV2InfoFromPassword(&mschap, mschap_v2_password); + + if (StrCmpi(username, ADMINISTRATOR_USERNAME) == 0) + { + // Administrator mode + SecurePassword(secure_password_check, h->SecurePassword, random); + if (Cmp(secure_password_check, secure_password, SHA1_SIZE) == 0) + { + return true; + } + else + { + return false; + } + } + + AcLock(h); + { + USER *u; + u = AcGetUser(h, username); + if (u) + { + Lock(u->lock); + { + if (u->AuthType == AUTHTYPE_PASSWORD) + { + AUTHPASSWORD *auth = (AUTHPASSWORD *)u->AuthData; + + if (is_mschap == false) + { + // Normal password authentication + SecurePassword(secure_password_check, auth->HashedKey, random); + if (Cmp(secure_password_check, secure_password, SHA1_SIZE) == 0) + { + b = true; + } + } + else + { + // MS-CHAP v2 authentication via PPP + UCHAR challenge8[8]; + UCHAR client_response[24]; + + if (IsZero(auth->NtLmSecureHash, MD5_SIZE)) + { + // NTLM hash is not registered in the user account + *err = ERR_MSCHAP2_PASSWORD_NEED_RESET; + } + else + { + UCHAR nt_pw_hash_hash[16]; + Zero(challenge8, sizeof(challenge8)); + Zero(client_response, sizeof(client_response)); + + MsChapV2_GenerateChallenge8(challenge8, mschap.MsChapV2_ClientChallenge, mschap.MsChapV2_ServerChallenge, + mschap.MsChapV2_PPPUsername); + + MsChapV2Client_GenerateResponse(client_response, challenge8, auth->NtLmSecureHash); + + if (Cmp(client_response, mschap.MsChapV2_ClientResponse, 24) == 0) + { + // Hash matched + b = true; + + // Calculate the response + GenerateNtPasswordHashHash(nt_pw_hash_hash, auth->NtLmSecureHash); + MsChapV2Server_GenerateResponse(mschap_v2_server_response_20, nt_pw_hash_hash, + client_response, challenge8); + } + } + } + } + } + Unlock(u->lock); + ReleaseUser(u); + } + } + AcUnlock(h); + + return b; +} + +// Make sure that the user exists +bool SamIsUser(HUB *h, char *username) +{ + bool b; + // Validate arguments + if (h == NULL || username == NULL) + { + return false; + } + + AcLock(h); + { + b = AcIsUser(h, username); + } + AcUnlock(h); + + return b; +} + +// Get the type of authentication used by the user +UINT SamGetUserAuthType(HUB *h, char *username) +{ + UINT authtype; + // Validate arguments + if (h == NULL || username == NULL) + { + return INFINITE; + } + + AcLock(h); + { + USER *u = AcGetUser(h, username); + if (u == NULL) + { + authtype = INFINITE; + } + else + { + authtype = u->AuthType; + ReleaseUser(u); + } + } + AcUnlock(h); + + return authtype; +} + diff --git a/src/Cedar/Sam.h b/src/Cedar/Sam.h index 88a9bac6..7dab7dcd 100644 --- a/src/Cedar/Sam.h +++ b/src/Cedar/Sam.h @@ -1,26 +1,26 @@ -// SoftEther VPN Source Code - Developer Edition Master Branch -// Cedar Communication Module - - -// Sam.h -// Header of Sam.c - -#ifndef SAM_H -#define SAM_H - - -// Function prototype -bool SamIsUser(HUB *h, char *username); -UINT SamGetUserAuthType(HUB *h, char *username); -bool SamAuthUserByPassword(HUB *h, char *username, void *random, void *secure_password, char *mschap_v2_password, UCHAR *mschap_v2_server_response_20, UINT *err); -bool SamAuthUserByAnonymous(HUB *h, char *username); -bool SamAuthUserByCert(HUB *h, char *username, X *x); -bool SamAuthUserByPlainPassword(CONNECTION *c, HUB *hub, char *username, char *password, bool ast, UCHAR *mschap_v2_server_response_20, RADIUS_LOGIN_OPTION *opt); -POLICY *SamGetUserPolicy(HUB *h, char *username); - -void GenRandom(void *random); -void SecurePassword(void *secure_password, void *password, void *random); -X *GetIssuerFromList(LIST *cert_list, X *cert); - -#endif // SAM_H - +// SoftEther VPN Source Code - Developer Edition Master Branch +// Cedar Communication Module + + +// Sam.h +// Header of Sam.c + +#ifndef SAM_H +#define SAM_H + + +// Function prototype +bool SamIsUser(HUB *h, char *username); +UINT SamGetUserAuthType(HUB *h, char *username); +bool SamAuthUserByPassword(HUB *h, char *username, void *random, void *secure_password, char *mschap_v2_password, UCHAR *mschap_v2_server_response_20, UINT *err); +bool SamAuthUserByAnonymous(HUB *h, char *username); +bool SamAuthUserByCert(HUB *h, char *username, X *x); +bool SamAuthUserByPlainPassword(CONNECTION *c, HUB *hub, char *username, char *password, bool ast, UCHAR *mschap_v2_server_response_20, RADIUS_LOGIN_OPTION *opt); +POLICY *SamGetUserPolicy(HUB *h, char *username); + +void GenRandom(void *random); +void SecurePassword(void *secure_password, void *password, void *random); +X *GetIssuerFromList(LIST *cert_list, X *cert); + +#endif // SAM_H + diff --git a/src/Cedar/SeLowUser.c b/src/Cedar/SeLowUser.c index e8b45014..9c3fc33b 100644 --- a/src/Cedar/SeLowUser.c +++ b/src/Cedar/SeLowUser.c @@ -1,979 +1,979 @@ -// SoftEther VPN Source Code - Developer Edition Master Branch -// SeLow: SoftEther Lightweight Network Protocol - - -// SeLowUser.c -// SoftEther Lightweight Network Protocol User-mode Library - -#include - -#ifdef WIN32 - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -// Load the drivers hive -bool SuLoadDriversHive() -{ - wchar_t config_dir[MAX_PATH]; - wchar_t filename[MAX_PATH]; - if (MsIsWindows10() == false) - { - return false; - } - - MsEnablePrivilege(SE_RESTORE_NAME, true); - MsEnablePrivilege(SE_BACKUP_NAME, true); - - CombinePathW(config_dir, sizeof(config_dir), MsGetSystem32DirW(), L"config"); - CombinePathW(filename, sizeof(filename), config_dir, L"DRIVERS"); - - return MsRegLoadHive(REG_LOCAL_MACHINE, L"DRIVERS", filename); -} - -// Unload the drivers hive -bool SuUnloadDriversHive() -{ - // todo: always failed. - if (MsIsWindows10() == false) - { - return false; - } - - return MsRegUnloadHive(REG_LOCAL_MACHINE, L"DRIVERS"); -} - -// Delete garbage inf files -void SuDeleteGarbageInfs() -{ - void *wow; - bool load_hive = false; - Debug("SuDeleteGarbageInfs()\n"); - - wow = MsDisableWow64FileSystemRedirection(); - - load_hive = SuLoadDriversHive(); - Debug("SuLoadDriversHive: %u\n", load_hive); - - SuDeleteGarbageInfsInner(); - - /* - if (load_hive) - { - Debug("SuUnloadDriversHive: %u\n", SuUnloadDriversHive()); - }*/ - - MsRestoreWow64FileSystemRedirection(wow); -} -void SuDeleteGarbageInfsInner() -{ - char *base_key_name = "DRIVERS\\DriverDatabase\\DriverPackages"; - TOKEN_LIST *keys; - HINSTANCE hSetupApiDll = NULL; - BOOL (WINAPI *_SetupUninstallOEMInfA)(PCSTR, DWORD, PVOID) = NULL; - - if (MsIsWindows10() == false) - { - return; - } - - hSetupApiDll = LoadLibraryA("setupapi.dll"); - if (hSetupApiDll == NULL) - { - return; - } - - _SetupUninstallOEMInfA = - (UINT (__stdcall *)(PCSTR,DWORD,PVOID)) - GetProcAddress(hSetupApiDll, "SetupUninstallOEMInfA"); - - if (_SetupUninstallOEMInfA != NULL) - { - keys = MsRegEnumKeyEx2(REG_LOCAL_MACHINE, base_key_name, false, true); - - if (keys != NULL) - { - char full_key[MAX_PATH]; - UINT i; - - for (i = 0;i < keys->NumTokens;i++) - { - char *oem_name, *inf_name, *provider; - - Format(full_key, sizeof(full_key), "%s\\%s", base_key_name, keys->Token[i]); - - oem_name = MsRegReadStrEx2(REG_LOCAL_MACHINE, full_key, "", false, true); - inf_name = MsRegReadStrEx2(REG_LOCAL_MACHINE, full_key, "InfName", false, true); - provider = MsRegReadStrEx2(REG_LOCAL_MACHINE, full_key, "Provider", false, true); - - if (IsEmptyStr(oem_name) == false && IsEmptyStr(inf_name) == false) - { - if (StartWith(oem_name, "oem")) - { - if (StartWith(inf_name, "selow")) - { - if (InStr(provider, "softether")) - { - Debug("Delete OEM INF %s (%s): %u\n", - oem_name, inf_name, - _SetupUninstallOEMInfA(oem_name, 0x00000001, NULL)); - } - } - } - } - - Free(oem_name); - Free(inf_name); - Free(provider); - } - - FreeToken(keys); - } - } - - if (hSetupApiDll != NULL) - { - FreeLibrary(hSetupApiDll); - } -} - -// Install the driver -bool SuInstallDriver(bool force) -{ - bool ret; - void *wow; - - wow = MsDisableWow64FileSystemRedirection(); - - ret = SuInstallDriverInner(force); - - MsRestoreWow64FileSystemRedirection(wow); - - return ret; -} -bool SuInstallDriverInner(bool force) -{ - wchar_t sys_fullpath[MAX_PATH]; - UINT current_sl_ver = 0; - bool ret = false; - wchar_t src_cat[MAX_PATH]; - wchar_t src_inf[MAX_PATH]; - wchar_t src_sys[MAX_PATH]; - wchar_t dst_cat[MAX_PATH]; - wchar_t dst_inf[MAX_PATH]; - wchar_t dst_sys[MAX_PATH]; - wchar_t tmp_dir[MAX_PATH]; - char *cpu_type = MsIsX64() ? "x64" : "x86"; - - if (SuIsSupportedOs(true) == false) - { - // Unsupported OS - return false; - } - - CombinePathW(tmp_dir, sizeof(tmp_dir), MsGetWindowsDirW(), L"Temp"); - MakeDirExW(tmp_dir); - - UniStrCat(tmp_dir, sizeof(tmp_dir), L"\\selowtmp"); - MakeDirExW(tmp_dir); - - // Confirm whether the driver is currently installed - CombinePathW(sys_fullpath, sizeof(sys_fullpath), MsGetSystem32DirW(), L"drivers\\SeLow_%S.sys"); - UniFormat(sys_fullpath, sizeof(sys_fullpath), sys_fullpath, cpu_type); - - if (IsFileExistsW(sys_fullpath)) - { - char *path; - - // Read the current version from the registry - current_sl_ver = MsRegReadIntEx2(REG_LOCAL_MACHINE, SL_REG_KEY_NAME, - (MsIsWindows10() ? SL_REG_VER_VALUE_WIN10 : SL_REG_VER_VALUE), - false, true); - - path = MsRegReadStrEx2(REG_LOCAL_MACHINE, SL_REG_KEY_NAME, "ImagePath", false, true); - - if (IsEmptyStr(path) || IsFileExists(path) == false || MsIsServiceInstalled(SL_PROTOCOL_NAME) == false) - { - current_sl_ver = 0; - } - - Free(path); - } - - if (force == false && current_sl_ver >= SL_VER) - { - // Newer version has already been installed - Debug("Newer SeLow is Installed. %u >= %u\n", current_sl_ver, SL_VER); - return true; - } - - // Copy necessary files to a temporary directory - UniFormat(src_sys, sizeof(src_sys), L"|DriverPackages\\%S\\%S\\SeLow_%S.sys", - (MsIsWindows10() ? "SeLow_Win10" : "SeLow_Win8"), - cpu_type, cpu_type); - if (MsIsWindows8() == false) - { - // Windows Vista and Windows 7 uses SHA-1 catalog files - UniFormat(src_cat, sizeof(src_cat), L"|DriverPackages\\SeLow_Win8\\%S\\inf.cat", cpu_type); - } - else - { - // Windows 8 or above uses SHA-256 catalog files - UniFormat(src_cat, sizeof(src_cat), L"|DriverPackages\\SeLow_Win8\\%S\\inf2.cat", cpu_type); - - if (MsIsWindows10()) - { - // Windows 10 uses WHQL catalog files - UniFormat(src_cat, sizeof(src_cat), L"|DriverPackages\\SeLow_Win10\\%S\\SeLow_Win10_%S.cat", cpu_type, cpu_type); - } - } - UniFormat(src_inf, sizeof(src_inf), L"|DriverPackages\\%S\\%S\\SeLow_%S.inf", - (MsIsWindows10() ? "SeLow_Win10" : "SeLow_Win8"), - cpu_type, cpu_type); - - UniFormat(dst_sys, sizeof(dst_cat), L"%s\\SeLow_%S.sys", tmp_dir, cpu_type); - UniFormat(dst_cat, sizeof(dst_cat), L"%s\\SeLow_%S_%S.cat", tmp_dir, - (MsIsWindows10() ? "Win10" : "Win8"), - cpu_type); - - UniFormat(dst_inf, sizeof(dst_inf), L"%s\\SeLow_%S.inf", tmp_dir, cpu_type); - - if (FileCopyW(src_sys, dst_sys) && - FileCopyW(src_cat, dst_cat) && - FileCopyW(src_inf, dst_inf)) - { - NO_WARNING *nw; - - nw = MsInitNoWarningEx(SL_USER_AUTO_PUSH_TIMER); - - if (MsIsWindows10()) - { - if (MsIsServiceInstalled(SL_PROTOCOL_NAME) == false && MsIsServiceRunning(SL_PROTOCOL_NAME) == false) - { - // On Windows 10, if there are no SwLow service installed, then uinstall the protocol driver first. - // TODO: currently do nothing. On some versions of Windows 10 beta builds it is necessary to do something... - } - } - - if (MsIsWindows10()) - { - // Delete garbage INFs - SuDeleteGarbageInfs(); - } - - // Call the installer - if (InstallNdisProtocolDriver(dst_inf, L"SeLow", SL_USER_INSTALL_LOCK_TIMEOUT) == false) - { - Debug("InstallNdisProtocolDriver Error.\n"); - } - else - { - Debug("InstallNdisProtocolDriver Ok.\n"); - - // Copy manually because there are cases where .sys file is not copied successfully for some reason - Debug("SuCopySysFile from %S to %s: ret = %u\n", src_sys, sys_fullpath, SuCopySysFile(src_sys, sys_fullpath)); - - ret = true; - - // Write the version number into the registry - MsRegWriteIntEx2(REG_LOCAL_MACHINE, SL_REG_KEY_NAME, - (MsIsWindows10() ? SL_REG_VER_VALUE_WIN10 : SL_REG_VER_VALUE), - SL_VER, false, true); - - // Set to automatic startup - MsRegWriteIntEx2(REG_LOCAL_MACHINE, SL_REG_KEY_NAME, "Start", SERVICE_SYSTEM_START, false, true); - } - - MsFreeNoWarning(nw); - } - else - { - Debug("Fail Copying Files.\n"); - } - - if (ret) - { - // If the service is installed this time, start and wait until the enumeration is completed - SuFree(SuInitEx(180 * 1000)); - } - - return ret; -} - -// Copy a sys file -bool SuCopySysFile(wchar_t *src, wchar_t *dst) -{ - wchar_t dst_rename[MAX_PATH]; - UINT i; - if (src == NULL || dst == NULL) - { - return false; - } - if (FileCopyW(src, dst)) - { - for (i = 1;i <= 100;i++) - { - UniFormat(dst_rename, sizeof(dst_rename), L"%s.old%u", dst, i); - - FileDeleteW(dst_rename); - } - - return true; - } - - for (i = 1;;i++) - { - UniFormat(dst_rename, sizeof(dst_rename), L"%s.old%u", dst, i); - - if (IsFileExistsW(dst_rename) == false) - { - break; - } - - if (i >= 100) - { - return false; - } - } - - if (MoveFileW(dst, dst_rename) == false) - { - return false; - } - - if (FileCopyW(src, dst)) - { - for (i = 1;i <= 100;i++) - { - UniFormat(dst_rename, sizeof(dst_rename), L"%s.old%u", dst, i); - - FileDeleteW(dst_rename); - } - - return true; - } - - MoveFileW(dst_rename, dst); - - return false; -} - -// Get whether the current OS is supported by SeLow -bool SuIsSupportedOs(bool on_install) -{ - if (MsRegReadIntEx2(REG_LOCAL_MACHINE, SL_REG_KEY_NAME, "EnableSeLow", false, true) != 0) - { - // Force enable - return true; - } - - if (MsRegReadIntEx2(REG_LOCAL_MACHINE, SL_REG_KEY_NAME, "DisableSeLow", false, true) != 0) - { - // Force disable - return false; - } - - if (MsIsWindows10()) - { - // Windows 10 or later are always supported. - return true; - } - - if (on_install) - { - // If Microsoft Routing and Remote Access service is running, - // then return false. - if (MsIsServiceRunning("RemoteAccess")) - { - return false; - } - } - - // If the Su driver is currently running, - // then return true. - if (MsIsServiceRunning(SL_PROTOCOL_NAME)) - { - return true; - } - - // Currently Windows 8.1 or later are supported - if (MsIsWindows81() == false) - { - return false; - } - - if (on_install == false) - { - // If Microsoft Routing and Remote Access service is running, - // then return false. - if (MsIsServiceRunning("RemoteAccess")) - { - return false; - } - } - - return true; -} - -// Write the next packet to the driver -bool SuPutPacket(SU_ADAPTER *a, void *buf, UINT size) -{ - // Validate arguments - if (a == NULL) - { - return false; - } - if (a->Halt) - { - return false; - } - if (size > MAX_PACKET_SIZE) - { - return false; - } - - // First, examine whether the current buffer is full - if ((SL_NUM_PACKET(a->PutBuffer) >= SL_MAX_PACKET_EXCHANGE) || - (buf == NULL && SL_NUM_PACKET(a->PutBuffer) != 0)) - { - // Write all current packets to the driver - if (SuPutPacketsToDriver(a) == false) - { - return false; - } - - SL_NUM_PACKET(a->PutBuffer) = 0; - } - - // Add the next packet to the buffer - if (buf != NULL) - { - UINT i = SL_NUM_PACKET(a->PutBuffer); - SL_NUM_PACKET(a->PutBuffer)++; - - SL_SIZE_OF_PACKET(a->PutBuffer, i) = size; - Copy(SL_ADDR_OF_PACKET(a->PutBuffer, i), buf, size); - - Free(buf); - } - - return true; -} - -// Write all current packets to the driver -bool SuPutPacketsToDriver(SU_ADAPTER *a) -{ - DWORD write_size; - // Validate arguments - if (a == NULL) - { - return false; - } - if (a->Halt) - { - return false; - } - - if (WriteFile(a->hFile, a->PutBuffer, SL_EXCHANGE_BUFFER_SIZE, &write_size, NULL) == false) - { - a->Halt = true; - - SuCloseAdapterHandleInner(a); - return false; - } - - if (write_size != SL_EXCHANGE_BUFFER_SIZE) - { - a->Halt = true; - return false; - } - - return true; -} - -// Read the next packet from the driver -bool SuGetNextPacket(SU_ADAPTER *a, void **buf, UINT *size) -{ - // Validate arguments - if (a == NULL || buf == NULL || size == NULL) - { - return false; - } - - if (a->Halt) - { - return false; - } - - while (true) - { - if (a->CurrentPacketCount < SL_NUM_PACKET(a->GetBuffer)) - { - // There are still packets that have been already read - *size = SL_SIZE_OF_PACKET(a->GetBuffer, a->CurrentPacketCount); - *buf = Malloc(*size); - Copy(*buf, SL_ADDR_OF_PACKET(a->GetBuffer, a->CurrentPacketCount), *size); - - // Increment the packet number - a->CurrentPacketCount++; - - return true; - } - else - { - // Read the next packet from the driver - if (SuGetPacketsFromDriver(a) == false) - { - return false; - } - - if (SL_NUM_PACKET(a->GetBuffer) == 0) - { - // Packet is not received yet - *buf = NULL; - *size = 0; - return true; - } - - a->CurrentPacketCount = 0; - } - } -} - -// Read the next packet from the driver -bool SuGetPacketsFromDriver(SU_ADAPTER *a) -{ - DWORD read_size; - // Validate arguments - if (a == NULL) - { - return false; - } - - if (a->Halt) - { - return false; - } - - if (ReadFile(a->hFile, a->GetBuffer, SL_EXCHANGE_BUFFER_SIZE, &read_size, NULL) == false) - { - a->Halt = true; - - SuCloseAdapterHandleInner(a); - return false; - } - - if (read_size != SL_EXCHANGE_BUFFER_SIZE) - { - a->Halt = true; - return false; - } - - return true; -} - -// Close the adapter -void SuCloseAdapter(SU_ADAPTER *a) -{ - // Validate arguments - if (a == NULL) - { - return; - } - - if (a->hEvent != NULL) - { - CloseHandle(a->hEvent); - } - - if (a->hFile != INVALID_HANDLE_VALUE) - { - CloseHandle(a->hFile); - a->hFile = INVALID_HANDLE_VALUE; - } - - Free(a); -} - -// Close the adapter handle -void SuCloseAdapterHandleInner(SU_ADAPTER *a) -{ - return;//////////// **************** - // Validate arguments - if (a == NULL) - { - return; - } - - if (a->hFile != INVALID_HANDLE_VALUE) - { - CloseHandle(a->hFile); - a->hFile = INVALID_HANDLE_VALUE; - } -} - -// Open the adapter -SU_ADAPTER *SuOpenAdapter(SU *u, char *adapter_id) -{ - char filename[MAX_PATH]; - void *h; - SU_ADAPTER *a; - SL_IOCTL_EVENT_NAME t; - UINT read_size; - // Validate arguments - if (u == NULL || adapter_id == NULL) - { - return NULL; - } - - Format(filename, sizeof(filename), SL_ADAPTER_DEVICE_FILENAME_WIN32, adapter_id); - - h = CreateFileA(filename, GENERIC_READ | GENERIC_WRITE, - FILE_SHARE_READ | FILE_SHARE_WRITE, NULL, OPEN_EXISTING, 0, NULL); - - if (h == INVALID_HANDLE_VALUE) - { - Debug("Create File %s failed. %u\n", filename, GetLastError()); - return NULL; - } - else - { - Debug("Create File %s ok.\n", filename); - } - - a = ZeroMalloc(sizeof(SU_ADAPTER)); - - StrCpy(a->AdapterId, sizeof(a->AdapterId), adapter_id); - StrCpy(a->DeviceName, sizeof(a->DeviceName), filename); - - a->hFile = h; - - Zero(&t, sizeof(t)); - - // Get the event name - if (DeviceIoControl(h, SL_IOCTL_GET_EVENT_NAME, &t, sizeof(t), &t, sizeof(t), &read_size, NULL) == false) - { - // Acquisition failure - SuCloseAdapter(a); - return NULL; - } - - Debug("Event Name: %s\n", t.EventNameWin32); - - // Get the event - a->hEvent = OpenEvent(EVENT_ALL_ACCESS, FALSE, t.EventNameWin32); - - if (a->hEvent == NULL) - { - // Acquisition failure - SuCloseAdapter(a); - return NULL; - } - - return a; -} - -// Enumerate adapters -TOKEN_LIST *SuEnumAdapters(SU *u) -{ - UINT i; - UINT ret_size; - TOKEN_LIST *ret; - // Validate arguments - if (u == NULL) - { - return NullToken(); - } - - Zero(&u->AdapterInfoList, sizeof(u->AdapterInfoList)); - if (ReadFile(u->hFile, &u->AdapterInfoList, sizeof(u->AdapterInfoList), - &ret_size, NULL) == false || - u->AdapterInfoList.Signature != SL_SIGNATURE) - { - Debug("SuEnumAdapters: ReadFile error.\n"); - return NullToken(); - } - - ret = ZeroMalloc(sizeof(TOKEN_LIST)); - - ret->NumTokens = u->AdapterInfoList.NumAdapters; - ret->Token = ZeroMalloc(sizeof(char *) * ret->NumTokens); - Debug("SuEnumAdapters: u->AdapterInfoList.NumAdapters = %u\n", u->AdapterInfoList.NumAdapters); - - for (i = 0;i < ret->NumTokens;i++) - { - ret->Token[i] = CopyUniToStr(u->AdapterInfoList.Adapters[i].AdapterId); - - UniPrint(L"%s %u %S\n", - u->AdapterInfoList.Adapters[i].AdapterId, - u->AdapterInfoList.Adapters[i].MtuSize, - u->AdapterInfoList.Adapters[i].FriendlyName); - } - - return ret; -} - -// Create an adapters list -LIST *SuGetAdapterList(SU *u) -{ - LIST *ret; - UINT read_size; - UINT i; - // Validate arguments - if (u == NULL) - { - return NULL; - } - - ret = NewList(SuCmpAdapterList); - - // Enumerate adapters - Zero(&u->AdapterInfoList, sizeof(u->AdapterInfoList)); - if (ReadFile(u->hFile, &u->AdapterInfoList, sizeof(u->AdapterInfoList), - &read_size, NULL) == false || - u->AdapterInfoList.Signature != SL_SIGNATURE) - { - SuFreeAdapterList(ret); - return NULL; - } - - for (i = 0;i < u->AdapterInfoList.NumAdapters;i++) - { - SL_ADAPTER_INFO *info = &u->AdapterInfoList.Adapters[i]; - SU_ADAPTER_LIST *a = SuAdapterInfoToAdapterList(info); - - if (a != NULL) - { - Add(ret, a); - } - } - - // Sort - Sort(ret); - - return ret; -} - -// Comparison function of the adapter list -int SuCmpAdapterList(void *p1, void *p2) -{ - int r; - SU_ADAPTER_LIST *a1, *a2; - if (p1 == NULL || p2 == NULL) - { - return 0; - } - a1 = *(SU_ADAPTER_LIST **)p1; - a2 = *(SU_ADAPTER_LIST **)p2; - if (a1 == NULL || a2 == NULL) - { - return 0; - } - - r = StrCmpi(a1->SortKey, a2->SortKey); - if (r != 0) - { - return 0; - } - - return StrCmpi(a1->Guid, a2->Guid); -} - -// Release the adapter list -void SuFreeAdapterList(LIST *o) -{ - UINT i; - // Validate arguments - if (o == NULL) - { - return; - } - - for (i = 0;i < LIST_NUM(o);i++) - { - SU_ADAPTER_LIST *a = LIST_DATA(o, i); - - Free(a); - } - - ReleaseList(o); -} - -// Create an adapter list item -SU_ADAPTER_LIST *SuAdapterInfoToAdapterList(SL_ADAPTER_INFO *info) -{ - SU_ADAPTER_LIST t; - char tmp[MAX_SIZE]; - // Validate arguments - if (info == NULL) - { - return NULL; - } - - Zero(&t, sizeof(t)); - Copy(&t.Info, info, sizeof(SL_ADAPTER_INFO)); - - UniToStr(tmp, sizeof(tmp), info->AdapterId); - if (IsEmptyStr(tmp) || IsEmptyStr(info->FriendlyName) || StartWith(tmp, SL_ADAPTER_ID_PREFIX) == false) - { - // Name is invalid - return NULL; - } - - // GUID (Part after "SELOW_A_" prefix) - StrCpy(t.Guid, sizeof(t.Guid), tmp + StrLen(SL_ADAPTER_ID_PREFIX)); - - // Name - StrCpy(t.Name, sizeof(t.Name), tmp); - - // Key for sort - if (GetClassRegKeyWin32(t.SortKey, sizeof(t.SortKey), tmp, sizeof(tmp), t.Guid) == false) - { - // Can not be found - return NULL; - } - - return Clone(&t, sizeof(t)); -} - -// Initialize the driver -SU *SuInit() -{ - return SuInitEx(0); -} -SU *SuInitEx(UINT wait_for_bind_complete_tick) -{ - void *h; - SU *u; - UINT read_size; - bool flag = false; - UINT64 giveup_tick = 0; - static bool flag2 = false; // flag2 must be global - - if (SuIsSupportedOs(false) == false) - { - // Unsupported OS - return NULL; - } - -LABEL_RETRY: - - // Open the device driver - h = CreateFileA(SL_BASIC_DEVICE_FILENAME_WIN32, GENERIC_READ | GENERIC_WRITE, - FILE_SHARE_READ | FILE_SHARE_WRITE, NULL, OPEN_EXISTING, 0, NULL); - - if (h == INVALID_HANDLE_VALUE) - { - Debug("CreateFileA(%s) Failed.\n", SL_BASIC_DEVICE_FILENAME_WIN32); - - // Start the service if it fails to start the device driver - if (flag == false) - { - if (MsStartService(SL_PROTOCOL_NAME) == false) - { - Debug("MsStartService(%s) Failed.\n", SL_PROTOCOL_NAME); - - if (MsIsWindows10()) - { - if (flag2 == false) - { - flag2 = true; - - if (SuInstallDriver(true)) - { - goto LABEL_RETRY; - } - } - } - } - else - { - Debug("MsStartService(%s) Ok.\n", SL_PROTOCOL_NAME); - flag = true; - - goto LABEL_RETRY; - } - } - return NULL; - } - - //Debug("CreateFileA(%s) Ok.\n", SL_BASIC_DEVICE_FILENAME_WIN32); - - u = ZeroMalloc(sizeof(SU)); - - giveup_tick = Tick64() + (UINT64)wait_for_bind_complete_tick; - - if (wait_for_bind_complete_tick == 0) - { - if (ReadFile(h, &u->AdapterInfoList, sizeof(u->AdapterInfoList), &read_size, NULL) == false || - u->AdapterInfoList.Signature != SL_SIGNATURE) - { - // Signature reception failure - Debug("Bad Signature.\n"); - - Free(u); - CloseHandle(h); - - return NULL; - } - } - else - { - while (giveup_tick >= Tick64()) - { - // Wait until the enumeration is completed - if (ReadFile(h, &u->AdapterInfoList, sizeof(u->AdapterInfoList), &read_size, NULL) == false || - u->AdapterInfoList.Signature != SL_SIGNATURE) - { - // Signature reception failure - Debug("Bad Signature.\n"); - - Free(u); - CloseHandle(h); - - return NULL; - } - - if (u->AdapterInfoList.EnumCompleted) - { - // Complete enumeration - Debug("Bind Completed! %u\n", u->AdapterInfoList.EnumCompleted); - break; - } - - // Incomplete enumeration - Debug("Waiting for Bind Complete.\n"); - - SleepThread(25); - } - } - - u->hFile = h; - - return u; -} - -// Release the driver -void SuFree(SU *u) -{ - // Validate arguments - if (u == NULL) - { - return; - } - - CloseHandle(u->hFile); - - Free(u); -} - -#endif // WIN32 - +// SoftEther VPN Source Code - Developer Edition Master Branch +// SeLow: SoftEther Lightweight Network Protocol + + +// SeLowUser.c +// SoftEther Lightweight Network Protocol User-mode Library + +#include + +#ifdef WIN32 + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +// Load the drivers hive +bool SuLoadDriversHive() +{ + wchar_t config_dir[MAX_PATH]; + wchar_t filename[MAX_PATH]; + if (MsIsWindows10() == false) + { + return false; + } + + MsEnablePrivilege(SE_RESTORE_NAME, true); + MsEnablePrivilege(SE_BACKUP_NAME, true); + + CombinePathW(config_dir, sizeof(config_dir), MsGetSystem32DirW(), L"config"); + CombinePathW(filename, sizeof(filename), config_dir, L"DRIVERS"); + + return MsRegLoadHive(REG_LOCAL_MACHINE, L"DRIVERS", filename); +} + +// Unload the drivers hive +bool SuUnloadDriversHive() +{ + // todo: always failed. + if (MsIsWindows10() == false) + { + return false; + } + + return MsRegUnloadHive(REG_LOCAL_MACHINE, L"DRIVERS"); +} + +// Delete garbage inf files +void SuDeleteGarbageInfs() +{ + void *wow; + bool load_hive = false; + Debug("SuDeleteGarbageInfs()\n"); + + wow = MsDisableWow64FileSystemRedirection(); + + load_hive = SuLoadDriversHive(); + Debug("SuLoadDriversHive: %u\n", load_hive); + + SuDeleteGarbageInfsInner(); + + /* + if (load_hive) + { + Debug("SuUnloadDriversHive: %u\n", SuUnloadDriversHive()); + }*/ + + MsRestoreWow64FileSystemRedirection(wow); +} +void SuDeleteGarbageInfsInner() +{ + char *base_key_name = "DRIVERS\\DriverDatabase\\DriverPackages"; + TOKEN_LIST *keys; + HINSTANCE hSetupApiDll = NULL; + BOOL (WINAPI *_SetupUninstallOEMInfA)(PCSTR, DWORD, PVOID) = NULL; + + if (MsIsWindows10() == false) + { + return; + } + + hSetupApiDll = LoadLibraryA("setupapi.dll"); + if (hSetupApiDll == NULL) + { + return; + } + + _SetupUninstallOEMInfA = + (UINT (__stdcall *)(PCSTR,DWORD,PVOID)) + GetProcAddress(hSetupApiDll, "SetupUninstallOEMInfA"); + + if (_SetupUninstallOEMInfA != NULL) + { + keys = MsRegEnumKeyEx2(REG_LOCAL_MACHINE, base_key_name, false, true); + + if (keys != NULL) + { + char full_key[MAX_PATH]; + UINT i; + + for (i = 0;i < keys->NumTokens;i++) + { + char *oem_name, *inf_name, *provider; + + Format(full_key, sizeof(full_key), "%s\\%s", base_key_name, keys->Token[i]); + + oem_name = MsRegReadStrEx2(REG_LOCAL_MACHINE, full_key, "", false, true); + inf_name = MsRegReadStrEx2(REG_LOCAL_MACHINE, full_key, "InfName", false, true); + provider = MsRegReadStrEx2(REG_LOCAL_MACHINE, full_key, "Provider", false, true); + + if (IsEmptyStr(oem_name) == false && IsEmptyStr(inf_name) == false) + { + if (StartWith(oem_name, "oem")) + { + if (StartWith(inf_name, "selow")) + { + if (InStr(provider, "softether")) + { + Debug("Delete OEM INF %s (%s): %u\n", + oem_name, inf_name, + _SetupUninstallOEMInfA(oem_name, 0x00000001, NULL)); + } + } + } + } + + Free(oem_name); + Free(inf_name); + Free(provider); + } + + FreeToken(keys); + } + } + + if (hSetupApiDll != NULL) + { + FreeLibrary(hSetupApiDll); + } +} + +// Install the driver +bool SuInstallDriver(bool force) +{ + bool ret; + void *wow; + + wow = MsDisableWow64FileSystemRedirection(); + + ret = SuInstallDriverInner(force); + + MsRestoreWow64FileSystemRedirection(wow); + + return ret; +} +bool SuInstallDriverInner(bool force) +{ + wchar_t sys_fullpath[MAX_PATH]; + UINT current_sl_ver = 0; + bool ret = false; + wchar_t src_cat[MAX_PATH]; + wchar_t src_inf[MAX_PATH]; + wchar_t src_sys[MAX_PATH]; + wchar_t dst_cat[MAX_PATH]; + wchar_t dst_inf[MAX_PATH]; + wchar_t dst_sys[MAX_PATH]; + wchar_t tmp_dir[MAX_PATH]; + char *cpu_type = MsIsX64() ? "x64" : "x86"; + + if (SuIsSupportedOs(true) == false) + { + // Unsupported OS + return false; + } + + CombinePathW(tmp_dir, sizeof(tmp_dir), MsGetWindowsDirW(), L"Temp"); + MakeDirExW(tmp_dir); + + UniStrCat(tmp_dir, sizeof(tmp_dir), L"\\selowtmp"); + MakeDirExW(tmp_dir); + + // Confirm whether the driver is currently installed + CombinePathW(sys_fullpath, sizeof(sys_fullpath), MsGetSystem32DirW(), L"drivers\\SeLow_%S.sys"); + UniFormat(sys_fullpath, sizeof(sys_fullpath), sys_fullpath, cpu_type); + + if (IsFileExistsW(sys_fullpath)) + { + char *path; + + // Read the current version from the registry + current_sl_ver = MsRegReadIntEx2(REG_LOCAL_MACHINE, SL_REG_KEY_NAME, + (MsIsWindows10() ? SL_REG_VER_VALUE_WIN10 : SL_REG_VER_VALUE), + false, true); + + path = MsRegReadStrEx2(REG_LOCAL_MACHINE, SL_REG_KEY_NAME, "ImagePath", false, true); + + if (IsEmptyStr(path) || IsFileExists(path) == false || MsIsServiceInstalled(SL_PROTOCOL_NAME) == false) + { + current_sl_ver = 0; + } + + Free(path); + } + + if (force == false && current_sl_ver >= SL_VER) + { + // Newer version has already been installed + Debug("Newer SeLow is Installed. %u >= %u\n", current_sl_ver, SL_VER); + return true; + } + + // Copy necessary files to a temporary directory + UniFormat(src_sys, sizeof(src_sys), L"|DriverPackages\\%S\\%S\\SeLow_%S.sys", + (MsIsWindows10() ? "SeLow_Win10" : "SeLow_Win8"), + cpu_type, cpu_type); + if (MsIsWindows8() == false) + { + // Windows Vista and Windows 7 uses SHA-1 catalog files + UniFormat(src_cat, sizeof(src_cat), L"|DriverPackages\\SeLow_Win8\\%S\\inf.cat", cpu_type); + } + else + { + // Windows 8 or above uses SHA-256 catalog files + UniFormat(src_cat, sizeof(src_cat), L"|DriverPackages\\SeLow_Win8\\%S\\inf2.cat", cpu_type); + + if (MsIsWindows10()) + { + // Windows 10 uses WHQL catalog files + UniFormat(src_cat, sizeof(src_cat), L"|DriverPackages\\SeLow_Win10\\%S\\SeLow_Win10_%S.cat", cpu_type, cpu_type); + } + } + UniFormat(src_inf, sizeof(src_inf), L"|DriverPackages\\%S\\%S\\SeLow_%S.inf", + (MsIsWindows10() ? "SeLow_Win10" : "SeLow_Win8"), + cpu_type, cpu_type); + + UniFormat(dst_sys, sizeof(dst_cat), L"%s\\SeLow_%S.sys", tmp_dir, cpu_type); + UniFormat(dst_cat, sizeof(dst_cat), L"%s\\SeLow_%S_%S.cat", tmp_dir, + (MsIsWindows10() ? "Win10" : "Win8"), + cpu_type); + + UniFormat(dst_inf, sizeof(dst_inf), L"%s\\SeLow_%S.inf", tmp_dir, cpu_type); + + if (FileCopyW(src_sys, dst_sys) && + FileCopyW(src_cat, dst_cat) && + FileCopyW(src_inf, dst_inf)) + { + NO_WARNING *nw; + + nw = MsInitNoWarningEx(SL_USER_AUTO_PUSH_TIMER); + + if (MsIsWindows10()) + { + if (MsIsServiceInstalled(SL_PROTOCOL_NAME) == false && MsIsServiceRunning(SL_PROTOCOL_NAME) == false) + { + // On Windows 10, if there are no SwLow service installed, then uinstall the protocol driver first. + // TODO: currently do nothing. On some versions of Windows 10 beta builds it is necessary to do something... + } + } + + if (MsIsWindows10()) + { + // Delete garbage INFs + SuDeleteGarbageInfs(); + } + + // Call the installer + if (InstallNdisProtocolDriver(dst_inf, L"SeLow", SL_USER_INSTALL_LOCK_TIMEOUT) == false) + { + Debug("InstallNdisProtocolDriver Error.\n"); + } + else + { + Debug("InstallNdisProtocolDriver Ok.\n"); + + // Copy manually because there are cases where .sys file is not copied successfully for some reason + Debug("SuCopySysFile from %S to %s: ret = %u\n", src_sys, sys_fullpath, SuCopySysFile(src_sys, sys_fullpath)); + + ret = true; + + // Write the version number into the registry + MsRegWriteIntEx2(REG_LOCAL_MACHINE, SL_REG_KEY_NAME, + (MsIsWindows10() ? SL_REG_VER_VALUE_WIN10 : SL_REG_VER_VALUE), + SL_VER, false, true); + + // Set to automatic startup + MsRegWriteIntEx2(REG_LOCAL_MACHINE, SL_REG_KEY_NAME, "Start", SERVICE_SYSTEM_START, false, true); + } + + MsFreeNoWarning(nw); + } + else + { + Debug("Fail Copying Files.\n"); + } + + if (ret) + { + // If the service is installed this time, start and wait until the enumeration is completed + SuFree(SuInitEx(180 * 1000)); + } + + return ret; +} + +// Copy a sys file +bool SuCopySysFile(wchar_t *src, wchar_t *dst) +{ + wchar_t dst_rename[MAX_PATH]; + UINT i; + if (src == NULL || dst == NULL) + { + return false; + } + if (FileCopyW(src, dst)) + { + for (i = 1;i <= 100;i++) + { + UniFormat(dst_rename, sizeof(dst_rename), L"%s.old%u", dst, i); + + FileDeleteW(dst_rename); + } + + return true; + } + + for (i = 1;;i++) + { + UniFormat(dst_rename, sizeof(dst_rename), L"%s.old%u", dst, i); + + if (IsFileExistsW(dst_rename) == false) + { + break; + } + + if (i >= 100) + { + return false; + } + } + + if (MoveFileW(dst, dst_rename) == false) + { + return false; + } + + if (FileCopyW(src, dst)) + { + for (i = 1;i <= 100;i++) + { + UniFormat(dst_rename, sizeof(dst_rename), L"%s.old%u", dst, i); + + FileDeleteW(dst_rename); + } + + return true; + } + + MoveFileW(dst_rename, dst); + + return false; +} + +// Get whether the current OS is supported by SeLow +bool SuIsSupportedOs(bool on_install) +{ + if (MsRegReadIntEx2(REG_LOCAL_MACHINE, SL_REG_KEY_NAME, "EnableSeLow", false, true) != 0) + { + // Force enable + return true; + } + + if (MsRegReadIntEx2(REG_LOCAL_MACHINE, SL_REG_KEY_NAME, "DisableSeLow", false, true) != 0) + { + // Force disable + return false; + } + + if (MsIsWindows10()) + { + // Windows 10 or later are always supported. + return true; + } + + if (on_install) + { + // If Microsoft Routing and Remote Access service is running, + // then return false. + if (MsIsServiceRunning("RemoteAccess")) + { + return false; + } + } + + // If the Su driver is currently running, + // then return true. + if (MsIsServiceRunning(SL_PROTOCOL_NAME)) + { + return true; + } + + // Currently Windows 8.1 or later are supported + if (MsIsWindows81() == false) + { + return false; + } + + if (on_install == false) + { + // If Microsoft Routing and Remote Access service is running, + // then return false. + if (MsIsServiceRunning("RemoteAccess")) + { + return false; + } + } + + return true; +} + +// Write the next packet to the driver +bool SuPutPacket(SU_ADAPTER *a, void *buf, UINT size) +{ + // Validate arguments + if (a == NULL) + { + return false; + } + if (a->Halt) + { + return false; + } + if (size > MAX_PACKET_SIZE) + { + return false; + } + + // First, examine whether the current buffer is full + if ((SL_NUM_PACKET(a->PutBuffer) >= SL_MAX_PACKET_EXCHANGE) || + (buf == NULL && SL_NUM_PACKET(a->PutBuffer) != 0)) + { + // Write all current packets to the driver + if (SuPutPacketsToDriver(a) == false) + { + return false; + } + + SL_NUM_PACKET(a->PutBuffer) = 0; + } + + // Add the next packet to the buffer + if (buf != NULL) + { + UINT i = SL_NUM_PACKET(a->PutBuffer); + SL_NUM_PACKET(a->PutBuffer)++; + + SL_SIZE_OF_PACKET(a->PutBuffer, i) = size; + Copy(SL_ADDR_OF_PACKET(a->PutBuffer, i), buf, size); + + Free(buf); + } + + return true; +} + +// Write all current packets to the driver +bool SuPutPacketsToDriver(SU_ADAPTER *a) +{ + DWORD write_size; + // Validate arguments + if (a == NULL) + { + return false; + } + if (a->Halt) + { + return false; + } + + if (WriteFile(a->hFile, a->PutBuffer, SL_EXCHANGE_BUFFER_SIZE, &write_size, NULL) == false) + { + a->Halt = true; + + SuCloseAdapterHandleInner(a); + return false; + } + + if (write_size != SL_EXCHANGE_BUFFER_SIZE) + { + a->Halt = true; + return false; + } + + return true; +} + +// Read the next packet from the driver +bool SuGetNextPacket(SU_ADAPTER *a, void **buf, UINT *size) +{ + // Validate arguments + if (a == NULL || buf == NULL || size == NULL) + { + return false; + } + + if (a->Halt) + { + return false; + } + + while (true) + { + if (a->CurrentPacketCount < SL_NUM_PACKET(a->GetBuffer)) + { + // There are still packets that have been already read + *size = SL_SIZE_OF_PACKET(a->GetBuffer, a->CurrentPacketCount); + *buf = Malloc(*size); + Copy(*buf, SL_ADDR_OF_PACKET(a->GetBuffer, a->CurrentPacketCount), *size); + + // Increment the packet number + a->CurrentPacketCount++; + + return true; + } + else + { + // Read the next packet from the driver + if (SuGetPacketsFromDriver(a) == false) + { + return false; + } + + if (SL_NUM_PACKET(a->GetBuffer) == 0) + { + // Packet is not received yet + *buf = NULL; + *size = 0; + return true; + } + + a->CurrentPacketCount = 0; + } + } +} + +// Read the next packet from the driver +bool SuGetPacketsFromDriver(SU_ADAPTER *a) +{ + DWORD read_size; + // Validate arguments + if (a == NULL) + { + return false; + } + + if (a->Halt) + { + return false; + } + + if (ReadFile(a->hFile, a->GetBuffer, SL_EXCHANGE_BUFFER_SIZE, &read_size, NULL) == false) + { + a->Halt = true; + + SuCloseAdapterHandleInner(a); + return false; + } + + if (read_size != SL_EXCHANGE_BUFFER_SIZE) + { + a->Halt = true; + return false; + } + + return true; +} + +// Close the adapter +void SuCloseAdapter(SU_ADAPTER *a) +{ + // Validate arguments + if (a == NULL) + { + return; + } + + if (a->hEvent != NULL) + { + CloseHandle(a->hEvent); + } + + if (a->hFile != INVALID_HANDLE_VALUE) + { + CloseHandle(a->hFile); + a->hFile = INVALID_HANDLE_VALUE; + } + + Free(a); +} + +// Close the adapter handle +void SuCloseAdapterHandleInner(SU_ADAPTER *a) +{ + return;//////////// **************** + // Validate arguments + if (a == NULL) + { + return; + } + + if (a->hFile != INVALID_HANDLE_VALUE) + { + CloseHandle(a->hFile); + a->hFile = INVALID_HANDLE_VALUE; + } +} + +// Open the adapter +SU_ADAPTER *SuOpenAdapter(SU *u, char *adapter_id) +{ + char filename[MAX_PATH]; + void *h; + SU_ADAPTER *a; + SL_IOCTL_EVENT_NAME t; + UINT read_size; + // Validate arguments + if (u == NULL || adapter_id == NULL) + { + return NULL; + } + + Format(filename, sizeof(filename), SL_ADAPTER_DEVICE_FILENAME_WIN32, adapter_id); + + h = CreateFileA(filename, GENERIC_READ | GENERIC_WRITE, + FILE_SHARE_READ | FILE_SHARE_WRITE, NULL, OPEN_EXISTING, 0, NULL); + + if (h == INVALID_HANDLE_VALUE) + { + Debug("Create File %s failed. %u\n", filename, GetLastError()); + return NULL; + } + else + { + Debug("Create File %s ok.\n", filename); + } + + a = ZeroMalloc(sizeof(SU_ADAPTER)); + + StrCpy(a->AdapterId, sizeof(a->AdapterId), adapter_id); + StrCpy(a->DeviceName, sizeof(a->DeviceName), filename); + + a->hFile = h; + + Zero(&t, sizeof(t)); + + // Get the event name + if (DeviceIoControl(h, SL_IOCTL_GET_EVENT_NAME, &t, sizeof(t), &t, sizeof(t), &read_size, NULL) == false) + { + // Acquisition failure + SuCloseAdapter(a); + return NULL; + } + + Debug("Event Name: %s\n", t.EventNameWin32); + + // Get the event + a->hEvent = OpenEvent(EVENT_ALL_ACCESS, FALSE, t.EventNameWin32); + + if (a->hEvent == NULL) + { + // Acquisition failure + SuCloseAdapter(a); + return NULL; + } + + return a; +} + +// Enumerate adapters +TOKEN_LIST *SuEnumAdapters(SU *u) +{ + UINT i; + UINT ret_size; + TOKEN_LIST *ret; + // Validate arguments + if (u == NULL) + { + return NullToken(); + } + + Zero(&u->AdapterInfoList, sizeof(u->AdapterInfoList)); + if (ReadFile(u->hFile, &u->AdapterInfoList, sizeof(u->AdapterInfoList), + &ret_size, NULL) == false || + u->AdapterInfoList.Signature != SL_SIGNATURE) + { + Debug("SuEnumAdapters: ReadFile error.\n"); + return NullToken(); + } + + ret = ZeroMalloc(sizeof(TOKEN_LIST)); + + ret->NumTokens = u->AdapterInfoList.NumAdapters; + ret->Token = ZeroMalloc(sizeof(char *) * ret->NumTokens); + Debug("SuEnumAdapters: u->AdapterInfoList.NumAdapters = %u\n", u->AdapterInfoList.NumAdapters); + + for (i = 0;i < ret->NumTokens;i++) + { + ret->Token[i] = CopyUniToStr(u->AdapterInfoList.Adapters[i].AdapterId); + + UniPrint(L"%s %u %S\n", + u->AdapterInfoList.Adapters[i].AdapterId, + u->AdapterInfoList.Adapters[i].MtuSize, + u->AdapterInfoList.Adapters[i].FriendlyName); + } + + return ret; +} + +// Create an adapters list +LIST *SuGetAdapterList(SU *u) +{ + LIST *ret; + UINT read_size; + UINT i; + // Validate arguments + if (u == NULL) + { + return NULL; + } + + ret = NewList(SuCmpAdapterList); + + // Enumerate adapters + Zero(&u->AdapterInfoList, sizeof(u->AdapterInfoList)); + if (ReadFile(u->hFile, &u->AdapterInfoList, sizeof(u->AdapterInfoList), + &read_size, NULL) == false || + u->AdapterInfoList.Signature != SL_SIGNATURE) + { + SuFreeAdapterList(ret); + return NULL; + } + + for (i = 0;i < u->AdapterInfoList.NumAdapters;i++) + { + SL_ADAPTER_INFO *info = &u->AdapterInfoList.Adapters[i]; + SU_ADAPTER_LIST *a = SuAdapterInfoToAdapterList(info); + + if (a != NULL) + { + Add(ret, a); + } + } + + // Sort + Sort(ret); + + return ret; +} + +// Comparison function of the adapter list +int SuCmpAdapterList(void *p1, void *p2) +{ + int r; + SU_ADAPTER_LIST *a1, *a2; + if (p1 == NULL || p2 == NULL) + { + return 0; + } + a1 = *(SU_ADAPTER_LIST **)p1; + a2 = *(SU_ADAPTER_LIST **)p2; + if (a1 == NULL || a2 == NULL) + { + return 0; + } + + r = StrCmpi(a1->SortKey, a2->SortKey); + if (r != 0) + { + return 0; + } + + return StrCmpi(a1->Guid, a2->Guid); +} + +// Release the adapter list +void SuFreeAdapterList(LIST *o) +{ + UINT i; + // Validate arguments + if (o == NULL) + { + return; + } + + for (i = 0;i < LIST_NUM(o);i++) + { + SU_ADAPTER_LIST *a = LIST_DATA(o, i); + + Free(a); + } + + ReleaseList(o); +} + +// Create an adapter list item +SU_ADAPTER_LIST *SuAdapterInfoToAdapterList(SL_ADAPTER_INFO *info) +{ + SU_ADAPTER_LIST t; + char tmp[MAX_SIZE]; + // Validate arguments + if (info == NULL) + { + return NULL; + } + + Zero(&t, sizeof(t)); + Copy(&t.Info, info, sizeof(SL_ADAPTER_INFO)); + + UniToStr(tmp, sizeof(tmp), info->AdapterId); + if (IsEmptyStr(tmp) || IsEmptyStr(info->FriendlyName) || StartWith(tmp, SL_ADAPTER_ID_PREFIX) == false) + { + // Name is invalid + return NULL; + } + + // GUID (Part after "SELOW_A_" prefix) + StrCpy(t.Guid, sizeof(t.Guid), tmp + StrLen(SL_ADAPTER_ID_PREFIX)); + + // Name + StrCpy(t.Name, sizeof(t.Name), tmp); + + // Key for sort + if (GetClassRegKeyWin32(t.SortKey, sizeof(t.SortKey), tmp, sizeof(tmp), t.Guid) == false) + { + // Can not be found + return NULL; + } + + return Clone(&t, sizeof(t)); +} + +// Initialize the driver +SU *SuInit() +{ + return SuInitEx(0); +} +SU *SuInitEx(UINT wait_for_bind_complete_tick) +{ + void *h; + SU *u; + UINT read_size; + bool flag = false; + UINT64 giveup_tick = 0; + static bool flag2 = false; // flag2 must be global + + if (SuIsSupportedOs(false) == false) + { + // Unsupported OS + return NULL; + } + +LABEL_RETRY: + + // Open the device driver + h = CreateFileA(SL_BASIC_DEVICE_FILENAME_WIN32, GENERIC_READ | GENERIC_WRITE, + FILE_SHARE_READ | FILE_SHARE_WRITE, NULL, OPEN_EXISTING, 0, NULL); + + if (h == INVALID_HANDLE_VALUE) + { + Debug("CreateFileA(%s) Failed.\n", SL_BASIC_DEVICE_FILENAME_WIN32); + + // Start the service if it fails to start the device driver + if (flag == false) + { + if (MsStartService(SL_PROTOCOL_NAME) == false) + { + Debug("MsStartService(%s) Failed.\n", SL_PROTOCOL_NAME); + + if (MsIsWindows10()) + { + if (flag2 == false) + { + flag2 = true; + + if (SuInstallDriver(true)) + { + goto LABEL_RETRY; + } + } + } + } + else + { + Debug("MsStartService(%s) Ok.\n", SL_PROTOCOL_NAME); + flag = true; + + goto LABEL_RETRY; + } + } + return NULL; + } + + //Debug("CreateFileA(%s) Ok.\n", SL_BASIC_DEVICE_FILENAME_WIN32); + + u = ZeroMalloc(sizeof(SU)); + + giveup_tick = Tick64() + (UINT64)wait_for_bind_complete_tick; + + if (wait_for_bind_complete_tick == 0) + { + if (ReadFile(h, &u->AdapterInfoList, sizeof(u->AdapterInfoList), &read_size, NULL) == false || + u->AdapterInfoList.Signature != SL_SIGNATURE) + { + // Signature reception failure + Debug("Bad Signature.\n"); + + Free(u); + CloseHandle(h); + + return NULL; + } + } + else + { + while (giveup_tick >= Tick64()) + { + // Wait until the enumeration is completed + if (ReadFile(h, &u->AdapterInfoList, sizeof(u->AdapterInfoList), &read_size, NULL) == false || + u->AdapterInfoList.Signature != SL_SIGNATURE) + { + // Signature reception failure + Debug("Bad Signature.\n"); + + Free(u); + CloseHandle(h); + + return NULL; + } + + if (u->AdapterInfoList.EnumCompleted) + { + // Complete enumeration + Debug("Bind Completed! %u\n", u->AdapterInfoList.EnumCompleted); + break; + } + + // Incomplete enumeration + Debug("Waiting for Bind Complete.\n"); + + SleepThread(25); + } + } + + u->hFile = h; + + return u; +} + +// Release the driver +void SuFree(SU *u) +{ + // Validate arguments + if (u == NULL) + { + return; + } + + CloseHandle(u->hFile); + + Free(u); +} + +#endif // WIN32 + diff --git a/src/Cedar/SeLowUser.h b/src/Cedar/SeLowUser.h index 92ad9465..519c8768 100644 --- a/src/Cedar/SeLowUser.h +++ b/src/Cedar/SeLowUser.h @@ -1,80 +1,80 @@ -// SoftEther VPN Source Code - Developer Edition Master Branch -// SeLow: SoftEther Lightweight Network Protocol - - -// SeLowUser.h -// Header for SeLowUser.c - -#ifndef SELOWUSER_H -#define SELOWUSER_H - -#include - -//// Macro -#define SL_USER_INSTALL_LOCK_TIMEOUT 60000 // Lock acquisition timeout -#define SL_USER_AUTO_PUSH_TIMER 60000 // Timer to start the installation automatically - -//// Type - -// SU -struct SU -{ - void *hFile; // File handle - SL_ADAPTER_INFO_LIST AdapterInfoList; // Adapter list cache -}; - -// Adapter -struct SU_ADAPTER -{ - char AdapterId[MAX_PATH]; // Adapter ID - char DeviceName[MAX_PATH]; // Device name - void *hFile; // File handle - void *hEvent; // Event handle - bool Halt; - UINT CurrentPacketCount; - UCHAR GetBuffer[SL_EXCHANGE_BUFFER_SIZE]; // Read buffer - UCHAR PutBuffer[SL_EXCHANGE_BUFFER_SIZE]; // Write buffer -}; - -// Adapter list items -struct SU_ADAPTER_LIST -{ - SL_ADAPTER_INFO Info; // Adapter information - char Guid[128]; // GUID - char Name[MAX_SIZE]; // Name - char SortKey[MAX_SIZE]; // Sort key -}; - - -//// Function prototype -SU *SuInit(); -SU *SuInitEx(UINT wait_for_bind_complete_tick); -void SuFree(SU *u); -TOKEN_LIST *SuEnumAdapters(SU *u); -SU_ADAPTER *SuOpenAdapter(SU *u, char *adapter_id); -void SuCloseAdapter(SU_ADAPTER *a); -void SuCloseAdapterHandleInner(SU_ADAPTER *a); -bool SuGetPacketsFromDriver(SU_ADAPTER *a); -bool SuGetNextPacket(SU_ADAPTER *a, void **buf, UINT *size); -bool SuPutPacketsToDriver(SU_ADAPTER *a); -bool SuPutPacket(SU_ADAPTER *a, void *buf, UINT size); - -SU_ADAPTER_LIST *SuAdapterInfoToAdapterList(SL_ADAPTER_INFO *info); -LIST *SuGetAdapterList(SU *u); -void SuFreeAdapterList(LIST *o); -int SuCmpAdapterList(void *p1, void *p2); - -bool SuInstallDriver(bool force); -bool SuInstallDriverInner(bool force); -bool SuIsSupportedOs(bool on_install); -bool SuCopySysFile(wchar_t *src, wchar_t *dst); - -void SuDeleteGarbageInfs(); -void SuDeleteGarbageInfsInner(); -bool SuLoadDriversHive(); -bool SuUnloadDriversHive(); - -#endif // SELOWUSER_H - - - +// SoftEther VPN Source Code - Developer Edition Master Branch +// SeLow: SoftEther Lightweight Network Protocol + + +// SeLowUser.h +// Header for SeLowUser.c + +#ifndef SELOWUSER_H +#define SELOWUSER_H + +#include + +//// Macro +#define SL_USER_INSTALL_LOCK_TIMEOUT 60000 // Lock acquisition timeout +#define SL_USER_AUTO_PUSH_TIMER 60000 // Timer to start the installation automatically + +//// Type + +// SU +struct SU +{ + void *hFile; // File handle + SL_ADAPTER_INFO_LIST AdapterInfoList; // Adapter list cache +}; + +// Adapter +struct SU_ADAPTER +{ + char AdapterId[MAX_PATH]; // Adapter ID + char DeviceName[MAX_PATH]; // Device name + void *hFile; // File handle + void *hEvent; // Event handle + bool Halt; + UINT CurrentPacketCount; + UCHAR GetBuffer[SL_EXCHANGE_BUFFER_SIZE]; // Read buffer + UCHAR PutBuffer[SL_EXCHANGE_BUFFER_SIZE]; // Write buffer +}; + +// Adapter list items +struct SU_ADAPTER_LIST +{ + SL_ADAPTER_INFO Info; // Adapter information + char Guid[128]; // GUID + char Name[MAX_SIZE]; // Name + char SortKey[MAX_SIZE]; // Sort key +}; + + +//// Function prototype +SU *SuInit(); +SU *SuInitEx(UINT wait_for_bind_complete_tick); +void SuFree(SU *u); +TOKEN_LIST *SuEnumAdapters(SU *u); +SU_ADAPTER *SuOpenAdapter(SU *u, char *adapter_id); +void SuCloseAdapter(SU_ADAPTER *a); +void SuCloseAdapterHandleInner(SU_ADAPTER *a); +bool SuGetPacketsFromDriver(SU_ADAPTER *a); +bool SuGetNextPacket(SU_ADAPTER *a, void **buf, UINT *size); +bool SuPutPacketsToDriver(SU_ADAPTER *a); +bool SuPutPacket(SU_ADAPTER *a, void *buf, UINT size); + +SU_ADAPTER_LIST *SuAdapterInfoToAdapterList(SL_ADAPTER_INFO *info); +LIST *SuGetAdapterList(SU *u); +void SuFreeAdapterList(LIST *o); +int SuCmpAdapterList(void *p1, void *p2); + +bool SuInstallDriver(bool force); +bool SuInstallDriverInner(bool force); +bool SuIsSupportedOs(bool on_install); +bool SuCopySysFile(wchar_t *src, wchar_t *dst); + +void SuDeleteGarbageInfs(); +void SuDeleteGarbageInfsInner(); +bool SuLoadDriversHive(); +bool SuUnloadDriversHive(); + +#endif // SELOWUSER_H + + + diff --git a/src/Cedar/SecureInfo.c b/src/Cedar/SecureInfo.c index a2ece05b..a99ab014 100644 --- a/src/Cedar/SecureInfo.c +++ b/src/Cedar/SecureInfo.c @@ -1,10 +1,10 @@ -// SoftEther VPN Source Code - Developer Edition Master Branch -// Cedar Communication Module - - -// SecureInfo.c -// Code related to a secure VPN tunnel data for system administrators - -#include "CedarPch.h" - - +// SoftEther VPN Source Code - Developer Edition Master Branch +// Cedar Communication Module + + +// SecureInfo.c +// Code related to a secure VPN tunnel data for system administrators + +#include "CedarPch.h" + + diff --git a/src/Cedar/SecureInfo.h b/src/Cedar/SecureInfo.h index 1a7c8057..b9402387 100644 --- a/src/Cedar/SecureInfo.h +++ b/src/Cedar/SecureInfo.h @@ -1,14 +1,14 @@ -// SoftEther VPN Source Code - Developer Edition Master Branch -// Cedar Communication Module - - -// SecureInfo.h -// Header of SecureInfo.c - -#ifndef SECUREINFO_H -#define SECUREINFO_H - - -#endif // SECUREINFO_H - - +// SoftEther VPN Source Code - Developer Edition Master Branch +// Cedar Communication Module + + +// SecureInfo.h +// Header of SecureInfo.c + +#ifndef SECUREINFO_H +#define SECUREINFO_H + + +#endif // SECUREINFO_H + + diff --git a/src/Cedar/SecureNAT.c b/src/Cedar/SecureNAT.c index bbcfed3a..9d28d8ea 100644 --- a/src/Cedar/SecureNAT.c +++ b/src/Cedar/SecureNAT.c @@ -1,148 +1,148 @@ -// SoftEther VPN Source Code - Developer Edition Master Branch -// Cedar Communication Module - - -// SecureNAT.c -// SecureNAT code - -#include "CedarPch.h" - -// SecureNAT server-side thread -void SnSecureNATThread(THREAD *t, void *param) -{ - SNAT *s; - CONNECTION *c; - SESSION *se; - POLICY *policy; - HUB *h; - // Validate arguments - if (t == NULL || param == NULL) - { - return; - } - - s = (SNAT *)param; - // Create a server connection - c = NewServerConnection(s->Cedar, NULL, t); - c->Protocol = CONNECTION_HUB_SECURE_NAT; - - // Apply the default policy - policy = ClonePolicy(GetDefaultPolicy()); - - // Not to limit the number of broadcast - policy->NoBroadcastLimiter = true; - - h = s->Hub; - AddRef(h->ref); - - // create a server session - se = NewServerSession(s->Cedar, c, s->Hub, SNAT_USER_NAME, policy); - se->SecureNATMode = true; - se->SecureNAT = s; - c->Session = se; - ReleaseConnection(c); - - HLog(se->Hub, "LH_NAT_START", se->Name); - - // User name - se->Username = CopyStr(SNAT_USER_NAME_PRINT); - - s->Session = se; - AddRef(se->ref); - - // Notification initialization completion - NoticeThreadInit(t); - - ReleaseCancel(s->Nat->Virtual->Cancel); - s->Nat->Virtual->Cancel = se->Cancel1; - AddRef(se->Cancel1->ref); - - if (s->Nat->Virtual->NativeNat != NULL) - { - CANCEL *old_cancel = NULL; - - Lock(s->Nat->Virtual->NativeNat->CancelLock); - { - if (s->Nat->Virtual->NativeNat->Cancel != NULL) - { - old_cancel = s->Nat->Virtual->NativeNat->Cancel; - - s->Nat->Virtual->NativeNat->Cancel = se->Cancel1; - - AddRef(se->Cancel1->ref); - } - } - Unlock(s->Nat->Virtual->NativeNat->CancelLock); - - if (old_cancel != NULL) - { - ReleaseCancel(old_cancel); - } - } - - // Main function of the session - Debug("SecureNAT Start.\n"); - SessionMain(se); - Debug("SecureNAT Stop.\n"); - - HLog(se->Hub, "LH_NAT_STOP"); - - ReleaseHub(h); - - ReleaseSession(se); -} - -// Release the SecureNAT -void SnFreeSecureNAT(SNAT *s) -{ - // Validate arguments - if (s == NULL) - { - return; - } - - // Stop the session - StopSession(s->Session); - ReleaseSession(s->Session); - - // Virtual machine release - Virtual_Free(s->Nat->Virtual); - - // NAT release - NiFreeNat(s->Nat); - - DeleteLock(s->lock); - - Free(s); -} - -// Create a new SecureNAT -SNAT *SnNewSecureNAT(HUB *h, VH_OPTION *o) -{ - SNAT *s; - THREAD *t; - // Validate arguments - if (h == NULL || o == NULL) - { - return NULL; - } - - s = ZeroMalloc(sizeof(SNAT)); - s->Cedar = h->Cedar; - s->Hub = h; - s->lock = NewLock(); - - // Create a NAT - s->Nat = NiNewNatEx(s, o); - - // Initialize the virtual machine - VirtualInit(s->Nat->Virtual); - - // Create a thread - t = NewThread(SnSecureNATThread, s); - WaitThreadInit(t); - ReleaseThread(t); - - return s; -} - +// SoftEther VPN Source Code - Developer Edition Master Branch +// Cedar Communication Module + + +// SecureNAT.c +// SecureNAT code + +#include "CedarPch.h" + +// SecureNAT server-side thread +void SnSecureNATThread(THREAD *t, void *param) +{ + SNAT *s; + CONNECTION *c; + SESSION *se; + POLICY *policy; + HUB *h; + // Validate arguments + if (t == NULL || param == NULL) + { + return; + } + + s = (SNAT *)param; + // Create a server connection + c = NewServerConnection(s->Cedar, NULL, t); + c->Protocol = CONNECTION_HUB_SECURE_NAT; + + // Apply the default policy + policy = ClonePolicy(GetDefaultPolicy()); + + // Not to limit the number of broadcast + policy->NoBroadcastLimiter = true; + + h = s->Hub; + AddRef(h->ref); + + // create a server session + se = NewServerSession(s->Cedar, c, s->Hub, SNAT_USER_NAME, policy); + se->SecureNATMode = true; + se->SecureNAT = s; + c->Session = se; + ReleaseConnection(c); + + HLog(se->Hub, "LH_NAT_START", se->Name); + + // User name + se->Username = CopyStr(SNAT_USER_NAME_PRINT); + + s->Session = se; + AddRef(se->ref); + + // Notification initialization completion + NoticeThreadInit(t); + + ReleaseCancel(s->Nat->Virtual->Cancel); + s->Nat->Virtual->Cancel = se->Cancel1; + AddRef(se->Cancel1->ref); + + if (s->Nat->Virtual->NativeNat != NULL) + { + CANCEL *old_cancel = NULL; + + Lock(s->Nat->Virtual->NativeNat->CancelLock); + { + if (s->Nat->Virtual->NativeNat->Cancel != NULL) + { + old_cancel = s->Nat->Virtual->NativeNat->Cancel; + + s->Nat->Virtual->NativeNat->Cancel = se->Cancel1; + + AddRef(se->Cancel1->ref); + } + } + Unlock(s->Nat->Virtual->NativeNat->CancelLock); + + if (old_cancel != NULL) + { + ReleaseCancel(old_cancel); + } + } + + // Main function of the session + Debug("SecureNAT Start.\n"); + SessionMain(se); + Debug("SecureNAT Stop.\n"); + + HLog(se->Hub, "LH_NAT_STOP"); + + ReleaseHub(h); + + ReleaseSession(se); +} + +// Release the SecureNAT +void SnFreeSecureNAT(SNAT *s) +{ + // Validate arguments + if (s == NULL) + { + return; + } + + // Stop the session + StopSession(s->Session); + ReleaseSession(s->Session); + + // Virtual machine release + Virtual_Free(s->Nat->Virtual); + + // NAT release + NiFreeNat(s->Nat); + + DeleteLock(s->lock); + + Free(s); +} + +// Create a new SecureNAT +SNAT *SnNewSecureNAT(HUB *h, VH_OPTION *o) +{ + SNAT *s; + THREAD *t; + // Validate arguments + if (h == NULL || o == NULL) + { + return NULL; + } + + s = ZeroMalloc(sizeof(SNAT)); + s->Cedar = h->Cedar; + s->Hub = h; + s->lock = NewLock(); + + // Create a NAT + s->Nat = NiNewNatEx(s, o); + + // Initialize the virtual machine + VirtualInit(s->Nat->Virtual); + + // Create a thread + t = NewThread(SnSecureNATThread, s); + WaitThreadInit(t); + ReleaseThread(t); + + return s; +} + diff --git a/src/Cedar/SecureNAT.h b/src/Cedar/SecureNAT.h index 756a16ad..b5d8b932 100644 --- a/src/Cedar/SecureNAT.h +++ b/src/Cedar/SecureNAT.h @@ -1,28 +1,28 @@ -// SoftEther VPN Source Code - Developer Edition Master Branch -// Cedar Communication Module - - -// SecureNAT.h -// Header of SecureNAT.c - -#ifndef SECURENAT_H -#define SECURENAT_H - -struct SNAT -{ - LOCK *lock; // Lock - CEDAR *Cedar; // Cedar - HUB *Hub; // HUB - SESSION *Session; // Session - POLICY *Policy; // Policy - NAT *Nat; // NAT -}; - - -SNAT *SnNewSecureNAT(HUB *h, VH_OPTION *o); -void SnFreeSecureNAT(SNAT *s); -void SnSecureNATThread(THREAD *t, void *param); - - -#endif // SECURENAT_H - +// SoftEther VPN Source Code - Developer Edition Master Branch +// Cedar Communication Module + + +// SecureNAT.h +// Header of SecureNAT.c + +#ifndef SECURENAT_H +#define SECURENAT_H + +struct SNAT +{ + LOCK *lock; // Lock + CEDAR *Cedar; // Cedar + HUB *Hub; // HUB + SESSION *Session; // Session + POLICY *Policy; // Policy + NAT *Nat; // NAT +}; + + +SNAT *SnNewSecureNAT(HUB *h, VH_OPTION *o); +void SnFreeSecureNAT(SNAT *s); +void SnSecureNATThread(THREAD *t, void *param); + + +#endif // SECURENAT_H + diff --git a/src/Cedar/Server.c b/src/Cedar/Server.c index f606fd29..ac426265 100644 --- a/src/Cedar/Server.c +++ b/src/Cedar/Server.c @@ -1,10833 +1,10833 @@ -// SoftEther VPN Source Code - Developer Edition Master Branch -// Cedar Communication Module - - -// Server.c -// VPN Server module - -#include "CedarPch.h" - -static SERVER *server = NULL; -static LOCK *server_lock = NULL; -char *SERVER_CONFIG_FILE_NAME = "$vpn_server.config"; -char *SERVER_CONFIG_FILE_NAME_IN_CLIENT = "$vpn_gate_svc.config"; -char *SERVER_CONFIG_FILE_NAME_IN_CLIENT_RELAY = "$vpn_gate_relay.config"; -char *BRIDGE_CONFIG_FILE_NAME = "$vpn_bridge.config"; -char *SERVER_CONFIG_TEMPLATE_NAME = "$vpn_server_template.config"; -char *BRIDGE_CONFIG_TEMPLATE_NAME = "$vpn_server_template.config"; - -static bool server_reset_setting = false; - -static volatile UINT global_server_flags[NUM_GLOBAL_SERVER_FLAGS] = {0}; - -UINT vpn_global_parameters[NUM_GLOBAL_PARAMS] = {0}; - -// Get whether the number of user objects that are registered in the VPN Server is too many -bool SiTooManyUserObjectsInServer(SERVER *s, bool oneMore) -{ - return false; -} - -typedef struct SI_DEBUG_PROC_LIST -{ - UINT Id; - char *Description; - char *Args; - SI_DEBUG_PROC *Proc; -} SI_DEBUG_PROC_LIST; - -// Debugging function -UINT SiDebug(SERVER *s, RPC_TEST *ret, UINT i, char *str) -{ - SI_DEBUG_PROC_LIST proc_list[] = - { - {1, "Hello World", "", SiDebugProcHelloWorld}, - {2, "Terminate process now", "", SiDebugProcExit}, - {3, "Write memory dumpfile", "", SiDebugProcDump}, - {4, "Restore process priority", "", SiDebugProcRestorePriority}, - {5, "Set the process priority high", "", SiDebugProcSetHighPriority}, - {6, "Get the .exe filename of the process", "", SiDebugProcGetExeFileName}, - {7, "Crash the process", "", SiDebugProcCrash}, - {8, "Get IPsecMessageDisplayed Flag", "", SiDebugProcGetIPsecMessageDisplayedValue}, - {9, "Set IPsecMessageDisplayed Flag", "", SiDebugProcSetIPsecMessageDisplayedValue}, - {10, "Get VgsMessageDisplayed Flag", "", SiDebugProcGetVgsMessageDisplayedValue}, - {11, "Set VgsMessageDisplayed Flag", "", SiDebugProcSetVgsMessageDisplayedValue}, - {12, "Get the current TCP send queue length", "", SiDebugProcGetCurrentTcpSendQueueLength}, - {13, "Get the current GetIP thread count", "", SiDebugProcGetCurrentGetIPThreadCount}, - }; - UINT num_proc_list = sizeof(proc_list) / sizeof(proc_list[0]); - UINT j; - UINT ret_value = ERR_NO_ERROR; - // Validate arguments - if (s == NULL || ret == NULL) - { - return ERR_INVALID_PARAMETER; - } - - if (i == 0) - { - char tmp[MAX_SIZE]; - Zero(ret, sizeof(RPC_TEST)); - - StrCat(ret->StrValue, sizeof(ret->StrValue), - "\n--- Debug Functions List --\n"); - - for (j = 0;j < num_proc_list;j++) - { - SI_DEBUG_PROC_LIST *p = &proc_list[j]; - - if (IsEmptyStr(p->Args) == false) - { - Format(tmp, sizeof(tmp), - " %u: %s - Usage: %u /ARG:\"%s\"\n", - p->Id, p->Description, p->Id, p->Args); - } - else - { - Format(tmp, sizeof(tmp), - " %u: %s - Usage: %u\n", - p->Id, p->Description, p->Id); - } - - StrCat(ret->StrValue, sizeof(ret->StrValue), tmp); - } - } - else - { - ret_value = ERR_NOT_SUPPORTED; - - for (j = 0;j < num_proc_list;j++) - { - SI_DEBUG_PROC_LIST *p = &proc_list[j]; - - if (p->Id == i) - { - ret_value = p->Proc(s, str, ret->StrValue, sizeof(ret->StrValue)); - - if (ret_value == ERR_NO_ERROR && IsEmptyStr(ret->StrValue)) - { - StrCpy(ret->StrValue, sizeof(ret->StrValue), "Ok."); - } - break; - } - } - } - - return ret_value; -} -UINT SiDebugProcHelloWorld(SERVER *s, char *in_str, char *ret_str, UINT ret_str_size) -{ - // Validate arguments - if (s == NULL || in_str == NULL || ret_str == NULL) - { - return ERR_INVALID_PARAMETER; - } - - Format(ret_str, ret_str_size, "Hello World %s\n", in_str); - - return ERR_NO_ERROR; -} -UINT SiDebugProcExit(SERVER *s, char *in_str, char *ret_str, UINT ret_str_size) -{ - // Validate arguments - if (s == NULL || in_str == NULL || ret_str == NULL) - { - return ERR_INVALID_PARAMETER; - } - - _exit(1); - - return ERR_NO_ERROR; -} -UINT SiDebugProcDump(SERVER *s, char *in_str, char *ret_str, UINT ret_str_size) -{ - // Validate arguments - if (s == NULL || in_str == NULL || ret_str == NULL) - { - return ERR_INVALID_PARAMETER; - } - -#ifdef OS_WIN32 - MsWriteMinidump(NULL, NULL); -#else // OS_WIN32 - return ERR_NOT_SUPPORTED; -#endif // OS_WIN32 - - return ERR_NO_ERROR; -} -UINT SiDebugProcRestorePriority(SERVER *s, char *in_str, char *ret_str, UINT ret_str_size) -{ - // Validate arguments - if (s == NULL || in_str == NULL || ret_str == NULL) - { - return ERR_INVALID_PARAMETER; - } - - OSRestorePriority(); - - return ERR_NO_ERROR; -} -UINT SiDebugProcSetHighPriority(SERVER *s, char *in_str, char *ret_str, UINT ret_str_size) -{ - // Validate arguments - if (s == NULL || in_str == NULL || ret_str == NULL) - { - return ERR_INVALID_PARAMETER; - } - - OSSetHighPriority(); - - return ERR_NO_ERROR; -} -UINT SiDebugProcGetExeFileName(SERVER *s, char *in_str, char *ret_str, UINT ret_str_size) -{ - // Validate arguments - if (s == NULL || in_str == NULL || ret_str == NULL) - { - return ERR_INVALID_PARAMETER; - } - - GetExeName(ret_str, ret_str_size); - - return ERR_NO_ERROR; -} -UINT SiDebugProcCrash(SERVER *s, char *in_str, char *ret_str, UINT ret_str_size) -{ - // Validate arguments - if (s == NULL || in_str == NULL || ret_str == NULL) - { - return ERR_INVALID_PARAMETER; - } - - CrashNow(); - - return ERR_NO_ERROR; -} -UINT SiDebugProcGetIPsecMessageDisplayedValue(SERVER *s, char *in_str, char *ret_str, UINT ret_str_size) -{ - // Validate arguments - if (s == NULL || in_str == NULL || ret_str == NULL) - { - return ERR_INVALID_PARAMETER; - } - - ToStr(ret_str, s->IPsecMessageDisplayed); - - return ERR_NO_ERROR; -} -UINT SiDebugProcSetIPsecMessageDisplayedValue(SERVER *s, char *in_str, char *ret_str, UINT ret_str_size) -{ - // Validate arguments - if (s == NULL || in_str == NULL || ret_str == NULL) - { - return ERR_INVALID_PARAMETER; - } - - s->IPsecMessageDisplayed = ToInt(in_str); - - return ERR_NO_ERROR; -} -UINT SiDebugProcGetVgsMessageDisplayedValue(SERVER *s, char *in_str, char *ret_str, UINT ret_str_size) -{ - // Validate arguments - if (s == NULL || in_str == NULL || ret_str == NULL) - { - return ERR_INVALID_PARAMETER; - } - -#if 0 - if (VgDoNotPopupMessage() == false) - { - ToStr(ret_str, s->VgsMessageDisplayed); - } - else - { - ToStr(ret_str, 1); - } -#else - // Do not show the VGS message in VPN Server of the current version - ToStr(ret_str, 1); -#endif - - return ERR_NO_ERROR; -} -UINT SiDebugProcGetCurrentTcpSendQueueLength(SERVER *s, char *in_str, char *ret_str, UINT ret_str_size) -{ - char tmp1[64], tmp2[64], tmp3[64]; - // Validate arguments - if (s == NULL || in_str == NULL || ret_str == NULL) - { - return ERR_INVALID_PARAMETER; - } - - ToStr3(tmp1, 0, CedarGetCurrentTcpQueueSize(s->Cedar)); - ToStr3(tmp2, 0, CedarGetQueueBudgetConsuming(s->Cedar)); - ToStr3(tmp3, 0, CedarGetFifoBudgetConsuming(s->Cedar)); - - Format(ret_str, 0, - "CurrentTcpQueueSize = %s\n" - "QueueBudgetConsuming = %s\n" - "FifoBudgetConsuming = %s\n", - tmp1, tmp2, tmp3); - - return ERR_NO_ERROR; -} -UINT SiDebugProcGetCurrentGetIPThreadCount(SERVER *s, char *in_str, char *ret_str, UINT ret_str_size) -{ - char tmp1[64], tmp2[64]; - // Validate arguments - if (s == NULL || in_str == NULL || ret_str == NULL) - { - return ERR_INVALID_PARAMETER; - } - - ToStr3(tmp1, 0, GetCurrentGetIpThreadNum()); - ToStr3(tmp2, 0, GetGetIpThreadMaxNum()); - - Format(ret_str, 0, - "Current threads = %s\n" - "Quota = %s\n", - tmp1, tmp2); - - return ERR_NO_ERROR; -} -UINT SiDebugProcSetVgsMessageDisplayedValue(SERVER *s, char *in_str, char *ret_str, UINT ret_str_size) -{ - // Validate arguments - if (s == NULL || in_str == NULL || ret_str == NULL) - { - return ERR_INVALID_PARAMETER; - } - - - return ERR_NO_ERROR; -} - -// Write the debug log -void SiDebugLog(SERVER *s, char *msg) -{ - // Validate arguments - if (s == NULL || msg == NULL) - { - return; - } - - if (s->DebugLog != NULL) - { - WriteTinyLog(s->DebugLog, msg); - } -} - -// Deadlock inspection main -void SiCheckDeadLockMain(SERVER *s, UINT timeout) -{ - CEDAR *cedar; - // Validate arguments - if (s == NULL) - { - return; - } - - //Debug("SiCheckDeadLockMain Start.\n"); - - - cedar = s->Cedar; - - if (s->ServerListenerList != NULL) - { - CheckDeadLock(s->ServerListenerList->lock, timeout, "s->ServerListenerList->lock"); - } - - CheckDeadLock(s->lock, timeout, "s->lock"); - - if (s->FarmMemberList != NULL) - { - CheckDeadLock(s->FarmMemberList->lock, timeout, "s->FarmMemberList->lock"); - } - - if (s->HubCreateHistoryList != NULL) - { - CheckDeadLock(s->HubCreateHistoryList->lock, timeout, "s->HubCreateHistoryList->lock"); - } - - CheckDeadLock(s->CapsCacheLock, timeout, "s->CapsCacheLock"); - - CheckDeadLock(s->TasksFromFarmControllerLock, timeout, "s->TasksFromFarmControllerLock"); - - if (cedar != NULL) - { - if (cedar->HubList != NULL) - { - CheckDeadLock(cedar->HubList->lock, timeout, "cedar->HubList->lock"); - } - - if (cedar->ListenerList != NULL) - { - UINT i; - LIST *o = NewListFast(NULL); - - CheckDeadLock(cedar->ListenerList->lock, timeout, "cedar->ListenerList->lock"); - - LockList(cedar->ListenerList); - { - for (i = 0;i < LIST_NUM(cedar->ListenerList);i++) - { - LISTENER *r = LIST_DATA(cedar->ListenerList, i); - - AddRef(r->ref); - - Add(o, r); - } - } - UnlockList(cedar->ListenerList); - - for (i = 0;i < LIST_NUM(o);i++) - { - LISTENER *r = LIST_DATA(o, i); - - - ReleaseListener(r); - } - - ReleaseList(o); - } - - if (cedar->ConnectionList != NULL) - { - CheckDeadLock(cedar->ConnectionList->lock, timeout, "cedar->ConnectionList->lock"); - } - - if (cedar->CaList != NULL) - { - CheckDeadLock(cedar->CaList->lock, timeout, "cedar->CaList->lock"); - } - - if (cedar->TrafficLock != NULL) - { - CheckDeadLock(cedar->TrafficLock, timeout, "cedar->TrafficLock"); - } - - if (cedar->TrafficDiffList != NULL) - { - CheckDeadLock(cedar->TrafficDiffList->lock, timeout, "cedar->TrafficDiffList->lock"); - } - - if (cedar->LocalBridgeList != NULL) - { - CheckDeadLock(cedar->LocalBridgeList->lock, timeout, "cedar->LocalBridgeList->lock"); - } - - if (cedar->L3SwList != NULL) - { - CheckDeadLock(cedar->L3SwList->lock, timeout, "cedar->L3SwList->lock"); - } - } - - //Debug("SiCheckDeadLockMain Finish.\n"); -} - -// Deadlock check thread -void SiDeadLockCheckThread(THREAD *t, void *param) -{ - SERVER *s = (SERVER *)param; - // Validate arguments - if (s == NULL || t == NULL) - { - return; - } - - while (true) - { - Wait(s->DeadLockWaitEvent, SERVER_DEADLOCK_CHECK_SPAN); - - if (s->HaltDeadLockThread) - { - break; - } - - SiCheckDeadLockMain(s, SERVER_DEADLOCK_CHECK_TIMEOUT); - } -} - -// Initialize the deadlock check -void SiInitDeadLockCheck(SERVER *s) -{ - // Validate arguments - if (s == NULL) - { - return; - } - if (s->DisableDeadLockCheck) - { - return; - } - - s->HaltDeadLockThread = false; - s->DeadLockWaitEvent = NewEvent(); - s->DeadLockCheckThread = NewThread(SiDeadLockCheckThread, s); -} - -// Release the deadlock check -void SiFreeDeadLockCheck(SERVER *s) -{ - // Validate arguments - if (s == NULL) - { - return; - } - - if (s->DeadLockCheckThread == NULL) - { - return; - } - - s->HaltDeadLockThread = true; - Set(s->DeadLockWaitEvent); - - WaitThread(s->DeadLockCheckThread, INFINITE); - - ReleaseThread(s->DeadLockCheckThread); - s->DeadLockCheckThread = NULL; - - ReleaseEvent(s->DeadLockWaitEvent); - s->DeadLockWaitEvent = NULL; - - s->HaltDeadLockThread = false; -} - -// Check whether the specified virtual HUB has been registered to creation history -bool SiIsHubRegistedOnCreateHistory(SERVER *s, char *name) -{ - UINT i; - bool ret = false; - // Validate arguments - if (s == NULL || name == NULL) - { - return false; - } - - SiDeleteOldHubCreateHistory(s); - - LockList(s->HubCreateHistoryList); - { - for (i = 0;i < LIST_NUM(s->HubCreateHistoryList);i++) - { - SERVER_HUB_CREATE_HISTORY *h = LIST_DATA(s->HubCreateHistoryList, i); - - if (StrCmpi(h->HubName, name) == 0) - { - ret = true; - break; - } - } - } - UnlockList(s->HubCreateHistoryList); - - return ret; -} - -// Delete the Virtual HUB creation history -void SiDelHubCreateHistory(SERVER *s, char *name) -{ - UINT i; - // Validate arguments - if (s == NULL || name == NULL) - { - return; - } - - LockList(s->HubCreateHistoryList); - { - SERVER_HUB_CREATE_HISTORY *hh = NULL; - for (i = 0;i < LIST_NUM(s->HubCreateHistoryList);i++) - { - SERVER_HUB_CREATE_HISTORY *h = LIST_DATA(s->HubCreateHistoryList, i); - - if (StrCmpi(h->HubName, name) == 0) - { - Delete(s->HubCreateHistoryList, h); - Free(h); - break; - } - } - } - UnlockList(s->HubCreateHistoryList); - - SiDeleteOldHubCreateHistory(s); -} - -// Register to the Virtual HUB creation history -void SiAddHubCreateHistory(SERVER *s, char *name) -{ - UINT i; - // Validate arguments - if (s == NULL || name == NULL) - { - return; - } - - LockList(s->HubCreateHistoryList); - { - SERVER_HUB_CREATE_HISTORY *hh = NULL; - for (i = 0;i < LIST_NUM(s->HubCreateHistoryList);i++) - { - SERVER_HUB_CREATE_HISTORY *h = LIST_DATA(s->HubCreateHistoryList, i); - - if (StrCmpi(h->HubName, name) == 0) - { - hh = h; - break; - } - } - - if (hh == NULL) - { - hh = ZeroMalloc(sizeof(SERVER_HUB_CREATE_HISTORY)); - StrCpy(hh->HubName, sizeof(hh->HubName), name); - - Add(s->HubCreateHistoryList, hh); - } - - hh->CreatedTime = Tick64(); - } - UnlockList(s->HubCreateHistoryList); - - SiDeleteOldHubCreateHistory(s); -} - -// Delete outdated Virtual HUB creation histories -void SiDeleteOldHubCreateHistory(SERVER *s) -{ - UINT i; - LIST *o; - // Validate arguments - if (s == NULL) - { - return; - } - - LockList(s->HubCreateHistoryList); - { - o = NewListFast(NULL); - - for (i = 0;i < LIST_NUM(s->HubCreateHistoryList);i++) - { - SERVER_HUB_CREATE_HISTORY *h = LIST_DATA(s->HubCreateHistoryList, i); - - if ((h->CreatedTime + ((UINT64)TICKET_EXPIRES)) <= Tick64()) - { - // Expired - Add(o, h); - } - } - - for (i = 0;i < LIST_NUM(o);i++) - { - SERVER_HUB_CREATE_HISTORY *h = LIST_DATA(o, i); - - Delete(s->HubCreateHistoryList, h); - - Free(h); - } - - ReleaseList(o); - } - UnlockList(s->HubCreateHistoryList); -} - -// Initialize the Virtual HUB creation history -void SiInitHubCreateHistory(SERVER *s) -{ - // Validate arguments - if (s == NULL) - { - return; - } - - s->HubCreateHistoryList = NewList(NULL); -} - -// Release the Virtual HUB creation history -void SiFreeHubCreateHistory(SERVER *s) -{ - UINT i; - // Validate arguments - if (s == NULL) - { - return; - } - - for (i = 0;i < LIST_NUM(s->HubCreateHistoryList);i++) - { - SERVER_HUB_CREATE_HISTORY *h = LIST_DATA(s->HubCreateHistoryList, i); - - Free(h); - } - - ReleaseList(s->HubCreateHistoryList); - - s->HubCreateHistoryList = NULL; -} - -// Identify whether the server can be connected from the VPN Client that is -// created by the installer creating kit of Admin Pack -bool IsAdminPackSupportedServerProduct(char *name) -{ - return true; -} - - -// Get the saving status of syslog -UINT SiGetSysLogSaveStatus(SERVER *s) -{ - SYSLOG_SETTING set; - // Validate arguments - if (s == NULL) - { - return SYSLOG_NONE; - } - - SiGetSysLogSetting(s, &set); - - return set.SaveType; -} - -// Send a syslog -void SiWriteSysLog(SERVER *s, char *typestr, char *hubname, wchar_t *message) -{ - wchar_t tmp[1024]; - char machinename[MAX_HOST_NAME_LEN + 1]; - char datetime[MAX_PATH]; - SYSTEMTIME st; - // Validate arguments - if (s == NULL || typestr == NULL || message == NULL) - { - return; - } - - if (GetGlobalServerFlag(GSF_DISABLE_SYSLOG) != 0) - { - return; - } - - // Host name - GetMachineName(machinename, sizeof(machinename)); - - // Date and time - LocalTime(&st); - if(s->StrictSyslogDatetimeFormat){ - GetDateTimeStrRFC3339(datetime, sizeof(datetime), &st, GetCurrentTimezone()); - }else{ - GetDateTimeStrMilli(datetime, sizeof(datetime), &st); - } - - if (IsEmptyStr(hubname) == false) - { - UniFormat(tmp, sizeof(tmp), L"[%S/VPN/%S] (%S) <%S>: %s", - machinename, hubname, datetime, typestr, message); - } - else - { - UniFormat(tmp, sizeof(tmp), L"[%S/VPN] (%S) <%S>: %s", - machinename, datetime, typestr, message); - } - - Debug("Syslog send: %S\n",tmp); - - SendSysLog(s->Syslog, tmp); -} - -// Write the syslog configuration -void SiSetSysLogSetting(SERVER *s, SYSLOG_SETTING *setting) -{ - SYSLOG_SETTING set; - // Validate arguments - if (s == NULL || setting == NULL) - { - return; - } - - Zero(&set, sizeof(set)); - Copy(&set, setting, sizeof(SYSLOG_SETTING)); - - if (IsEmptyStr(set.Hostname) || set.Port == 0) - { - set.SaveType = SYSLOG_NONE; - } - - Lock(s->SyslogLock); - { - Copy(&s->SyslogSetting, &set, sizeof(SYSLOG_SETTING)); - - SetSysLog(s->Syslog, set.Hostname, set.Port); - } - Unlock(s->SyslogLock); -} - -// Read the syslog configuration -void SiGetSysLogSetting(SERVER *s, SYSLOG_SETTING *setting) -{ - // Validate arguments - if (s == NULL || setting == NULL) - { - return; - } - - //Lock(s->SyslogLock); - { - Copy(setting, &s->SyslogSetting, sizeof(SYSLOG_SETTING)); - } - //Unlock(s->SyslogLock); -} - - -// Get the server product name -void GetServerProductName(SERVER *s, char *name, UINT size) -{ - char *cpu; - // Validate arguments - if (s == NULL || name == NULL) - { - return; - } - - GetServerProductNameInternal(s, name, size); - -#ifdef CPU_64 - cpu = " (64 bit)"; -#else // CPU_64 - cpu = " (32 bit)"; -#endif // CPU_64 - - StrCat(name, size, cpu); - - StrCat(name, size, " (Open Source)"); -} -void GetServerProductNameInternal(SERVER *s, char *name, UINT size) -{ - // Validate arguments - if (s == NULL || name == NULL) - { - return; - } - -#ifdef BETA_NUMBER - if (s->Cedar->Bridge) - { - StrCpy(name, size, CEDAR_BRIDGE_STR); - } - else - { - StrCpy(name, size, CEDAR_BETA_SERVER); - } - return; -#else // BETA_NUMBER - if (s->Cedar->Bridge) - { - StrCpy(name, size, CEDAR_BRIDGE_STR); - } - else - { - StrCpy(name, size, CEDAR_SERVER_STR); - } -#endif // BETA_NUMBER -} - -// Check whether the log file with the specified name is contained in the enumerated list -bool CheckLogFileNameFromEnumList(LIST *o, char *name, char *server_name) -{ - LOG_FILE t; - // Validate arguments - if (o == NULL || name == NULL || server_name == NULL) - { - return false; - } - - Zero(&t, sizeof(t)); - StrCpy(t.Path, sizeof(t.Path), name); - StrCpy(t.ServerName, sizeof(t.ServerName), server_name); - - if (Search(o, &t) == NULL) - { - return false; - } - - return true; -} - -// Release the log file enumeration -void FreeEnumLogFile(LIST *o) -{ - UINT i; - // Validate arguments - if (o == NULL) - { - return; - } - - for (i = 0;i < LIST_NUM(o);i++) - { - LOG_FILE *f = LIST_DATA(o, i); - - Free(f); - } - - ReleaseList(o); -} - -// Enumerate the log files associated with the virtual HUB (All logs are listed in the case of server administrator) -LIST *EnumLogFile(char *hubname) -{ - char exe_dir[MAX_PATH]; - char tmp[MAX_PATH]; - LIST *o = NewListFast(CmpLogFile); - DIRLIST *dir; - - if (StrLen(hubname) == 0) - { - hubname = NULL; - } - - GetLogDir(exe_dir, sizeof(exe_dir)); - - // Enumerate in the server_log - if (hubname == NULL) - { - EnumLogFileDir(o, SERVER_LOG_DIR); - } - - // Enumerate in the packet_log - Format(tmp, sizeof(tmp), "%s/"HUB_PACKET_LOG_DIR, exe_dir); - - if (hubname == NULL) - { - dir = EnumDir(tmp); - if (dir != NULL) - { - UINT i; - for (i = 0;i < dir->NumFiles;i++) - { - DIRENT *e = dir->File[i]; - - if (e->Folder) - { - char dir_name[MAX_PATH]; - Format(dir_name, sizeof(dir_name), HUB_PACKET_LOG_DIR"/%s", e->FileName); - EnumLogFileDir(o, dir_name); - } - } - - FreeDir(dir); - } - } - else - { - char dir_name[MAX_PATH]; - - Format(dir_name, sizeof(dir_name), HUB_PACKET_LOG_DIR"/%s", hubname); - - EnumLogFileDir(o, dir_name); - } - - // Enumerate in the security_log - Format(tmp, sizeof(tmp), "%s/"HUB_SECURITY_LOG_DIR, exe_dir); - - if (hubname == NULL) - { - dir = EnumDir(tmp); - if (dir != NULL) - { - UINT i; - for (i = 0;i < dir->NumFiles;i++) - { - DIRENT *e = dir->File[i]; - - if (e->Folder) - { - char dir_name[MAX_PATH]; - - Format(dir_name, sizeof(dir_name), HUB_SECURITY_LOG_DIR"/%s", e->FileName); - - EnumLogFileDir(o, dir_name); - } - } - - FreeDir(dir); - } - } - else - { - char dir_name[MAX_PATH]; - - Format(dir_name, sizeof(dir_name), HUB_SECURITY_LOG_DIR"/%s", hubname); - - EnumLogFileDir(o, dir_name); - } - - return o; -} - -// Enumerate log files in the specified directory -void EnumLogFileDir(LIST *o, char *dirname) -{ - UINT i; - char exe_dir[MAX_PATH]; - char dir_full_path[MAX_PATH]; - DIRLIST *dir; - // Validate arguments - if (o == NULL || dirname == NULL) - { - return; - } - - GetLogDir(exe_dir, sizeof(exe_dir)); - Format(dir_full_path, sizeof(dir_full_path), "%s/%s", exe_dir, dirname); - - dir = EnumDir(dir_full_path); - if (dir == NULL) - { - return; - } - - for (i = 0;i < dir->NumFiles;i++) - { - DIRENT *e = dir->File[i]; - - if (e->Folder == false && e->FileSize > 0) - { - char full_path[MAX_PATH]; - char file_path[MAX_PATH]; - - Format(file_path, sizeof(file_path), "%s/%s", dirname, e->FileName); - Format(full_path, sizeof(full_path), "%s/%s", exe_dir, file_path); - - if (EndWith(file_path, ".log")) - { - LOG_FILE *f = ZeroMalloc(sizeof(LOG_FILE)); - - StrCpy(f->Path, sizeof(f->Path), file_path); - f->FileSize = (UINT)(MIN(e->FileSize, 0xffffffffUL)); - f->UpdatedTime = e->UpdateDate; - - GetMachineName(f->ServerName, sizeof(f->ServerName)); - - Insert(o, f); - } - } - } - - FreeDir(dir); -} - -// Log file list entry comparison -int CmpLogFile(void *p1, void *p2) -{ - LOG_FILE *f1, *f2; - UINT i; - if (p1 == NULL || p2 == NULL) - { - return 0; - } - f1 = *(LOG_FILE **)p1; - f2 = *(LOG_FILE **)p2; - if (f1 == NULL || f2 == NULL) - { - return 0; - } - - i = StrCmpi(f1->Path, f2->Path); - if (i != 0) - { - return i; - } - - return StrCmpi(f1->ServerName, f2->ServerName); -} - -// Get the Caps of the server -UINT GetServerCapsInt(SERVER *s, char *name) -{ - CAPSLIST t; - UINT ret; - // Validate arguments - if (s == NULL || name == NULL) - { - return 0; - } - - Zero(&t, sizeof(t)); - GetServerCaps(s, &t); - - ret = GetCapsInt(&t, name); - - return ret; -} -bool GetServerCapsBool(SERVER *s, char *name) -{ - return (GetServerCapsInt(s, name) == 0) ? false : true; -} - -// Initialize the Caps cache of the server -void InitServerCapsCache(SERVER *s) -{ - // Validate arguments - if (s == NULL) - { - return; - } - - s->CapsCacheLock = NewLock(); - s->CapsListCache = NULL; -} - -// Release the Caps cache of the server -void FreeServerCapsCache(SERVER *s) -{ - // Validate arguments - if (s == NULL) - { - return; - } - - if (s->CapsListCache != NULL) - { - FreeCapsList(s->CapsListCache); - s->CapsListCache = NULL; - } - DeleteLock(s->CapsCacheLock); -} - -// Dispose the Caps cache of the server -void DestroyServerCapsCache(SERVER *s) -{ - // Validate arguments - if (s == NULL) - { - return; - } - - Lock(s->CapsCacheLock); - { - if (s->CapsListCache != NULL) - { - FreeCapsList(s->CapsListCache); - s->CapsListCache = NULL; - } - } - Unlock(s->CapsCacheLock); -} - -// Flush the Caps list for this server -void FlushServerCaps(SERVER *s) -{ - CAPSLIST t; - // Validate arguments - if (s == NULL) - { - return; - } - - DestroyServerCapsCache(s); - - Zero(&t, sizeof(t)); - GetServerCaps(s, &t); -} - -// Get the Caps list for this server -void GetServerCaps(SERVER *s, CAPSLIST *t) -{ - // Validate arguments - if (s == NULL || t == NULL) - { - return; - } - - Lock(s->CapsCacheLock); - { - - if (s->CapsListCache == NULL) - { - s->CapsListCache = ZeroMalloc(sizeof(CAPSLIST)); - GetServerCapsMain(s, s->CapsListCache); - } - - Copy(t, s->CapsListCache, sizeof(CAPSLIST)); - } - Unlock(s->CapsCacheLock); -} - -// Update the global server flags -void UpdateGlobalServerFlags(SERVER *s, CAPSLIST *t) -{ - bool is_restricted = false; - // Validate arguments - if (s == NULL || t == NULL) - { - return; - } - - is_restricted = SiIsEnterpriseFunctionsRestrictedOnOpenSource(s->Cedar); - - SetGlobalServerFlag(GSF_DISABLE_PUSH_ROUTE, is_restricted); - SetGlobalServerFlag(GSF_DISABLE_RADIUS_AUTH, is_restricted); - SetGlobalServerFlag(GSF_DISABLE_CERT_AUTH, is_restricted); - SetGlobalServerFlag(GSF_DISABLE_DEEP_LOGGING, is_restricted); - SetGlobalServerFlag(GSF_DISABLE_AC, is_restricted); - SetGlobalServerFlag(GSF_DISABLE_SYSLOG, is_restricted); -} - -// Set a global server flag -void SetGlobalServerFlag(UINT index, UINT value) -{ - // Validate arguments - if (index >= NUM_GLOBAL_SERVER_FLAGS) - { - return; - } - - global_server_flags[index] = value; -} - -// Get a global server flag -UINT GetGlobalServerFlag(UINT index) -{ - // Validate arguments - if (index >= NUM_GLOBAL_SERVER_FLAGS) - { - return 0; - } - - return global_server_flags[index]; -} - -// Main of the acquisition of Caps of the server -void GetServerCapsMain(SERVER *s, CAPSLIST *t) -{ - bool is_restricted = false; - - // Validate arguments - if (s == NULL || t == NULL) - { - return; - } - - is_restricted = SiIsEnterpriseFunctionsRestrictedOnOpenSource(s->Cedar); - - // Initialize - InitCapsList(t); - - // Maximum Ethernet packet size - AddCapsInt(t, "i_max_packet_size", MAX_PACKET_SIZE); - - if (s->Cedar->Bridge == false) - { - UINT max_sessions, max_clients, max_bridges, max_user_creations; - - max_clients = INFINITE; - max_bridges = INFINITE; - max_sessions = SERVER_MAX_SESSIONS_FOR_CARRIER_EDITION; - max_user_creations = INFINITE; - - // Maximum number of virtual HUBs - AddCapsInt(t, "i_max_hubs", SERVER_MAX_SESSIONS_FOR_CARRIER_EDITION); - - // The maximum number of concurrent sessions - AddCapsInt(t, "i_max_sessions", max_sessions); - - // Maximum number of creatable users - AddCapsInt(t, "i_max_user_creation", max_user_creations); - - // Maximum number of clients - AddCapsInt(t, "i_max_clients", max_clients); - - // Maximum number of bridges - AddCapsInt(t, "i_max_bridges", max_bridges); - - if (s->ServerType != SERVER_TYPE_FARM_MEMBER) - { - // Maximum number of registrable users / Virtual HUB - AddCapsInt(t, "i_max_users_per_hub", MAX_USERS); - - // Maximum number of registrable groups / Virtual HUB - AddCapsInt(t, "i_max_groups_per_hub", MAX_GROUPS); - - // Maximum number of registrable access list entries / Virtual HUB - AddCapsInt(t, "i_max_access_lists", MAX_ACCESSLISTS); - } - else - { - // Maximum number of registrable users / Virtual HUB - AddCapsInt(t, "i_max_users_per_hub", 0); - - // Maximum number of registrable groups / Virtual HUB - AddCapsInt(t, "i_max_groups_per_hub", 0); - - // Maximum number of registrable access list entries / Virtual HUB - AddCapsInt(t, "i_max_access_lists", 0); - } - - // The policy related to multiple logins - AddCapsBool(t, "b_support_limit_multilogin", true); - - // QoS / VoIP - AddCapsBool(t, "b_support_qos", true); - - // syslog - AddCapsBool(t, "b_support_syslog", true); - - // IPsec - // (Only works in stand-alone mode currently) - AddCapsBool(t, "b_support_ipsec", (s->ServerType == SERVER_TYPE_STANDALONE)); - - // SSTP - // (Only works in stand-alone mode currently) - AddCapsBool(t, "b_support_sstp", (s->ServerType == SERVER_TYPE_STANDALONE)); - - // OpenVPN - // (Only works in stand-alone mode currently) - AddCapsBool(t, "b_support_openvpn", (s->ServerType == SERVER_TYPE_STANDALONE)); - - // DDNS - AddCapsBool(t, "b_support_ddns", (s->DDnsClient != NULL)); - - if (s->DDnsClient != NULL) - { - // DDNS via Proxy - AddCapsBool(t, "b_support_ddns_proxy", true); - } - - // VPN over ICMP, VPN over DNS - AddCapsBool(t, "b_support_special_listener", true); - } - else - { - // Maximum number of virtual HUBs - AddCapsInt(t, "i_max_hubs", 0); - - // The maximum number of concurrent sessions - AddCapsInt(t, "i_max_sessions", 0); - - // Maximum number of clients - AddCapsInt(t, "i_max_clients", 0); - - // Maximum number of bridges - AddCapsInt(t, "i_max_bridges", 0); - - // Maximum number of registrable users / Virtual HUB - AddCapsInt(t, "i_max_users_per_hub", 0); - - // Maximum number of registrable groups / Virtual HUB - AddCapsInt(t, "i_max_groups_per_hub", 0); - - // Maximum number of registrable access list entries / Virtual HUB - AddCapsInt(t, "i_max_access_lists", 0); - - // QoS / VoIP - AddCapsBool(t, "b_support_qos", true); - - // syslog - AddCapsBool(t, "b_support_syslog", true); - - // IPsec - AddCapsBool(t, "b_support_ipsec", false); - - // SSTP - AddCapsBool(t, "b_support_sstp", false); - - // OpenVPN - AddCapsBool(t, "b_support_openvpn", false); - - // DDNS - AddCapsBool(t, "b_support_ddns", false); - - // VPN over ICMP, VPN over DNS - AddCapsBool(t, "b_support_special_listener", false); - } - - // Changing the type of Virtual HUB in cluster is prohibited - AddCapsBool(t, "b_cluster_hub_type_fixed", true); - - // Maximum MAC address table size / Virtual HUB - AddCapsInt(t, "i_max_mac_tables", MAX_MAC_TABLES); - - // Maximum IP address table size / Virtual HUB - AddCapsInt(t, "i_max_ip_tables", MAX_IP_TABLES); - - // SecureNAT function is available - AddCapsBool(t, "b_support_securenat", true); - - // Pushing routing table function of SecureNAT Virtual DHCP Server is available - AddCapsBool(t, "b_suppport_push_route", !is_restricted); - AddCapsBool(t, "b_suppport_push_route_config", true); - - if (s->ServerType != SERVER_TYPE_STANDALONE) - { - AddCapsBool(t, "b_virtual_nat_disabled", true); - } - - // Maximum NAT table size / Virtual HUB - AddCapsInt(t, "i_max_secnat_tables", NAT_MAX_SESSIONS); - - // Cascade connection - if (s->ServerType == SERVER_TYPE_STANDALONE) - { - AddCapsBool(t, "b_support_cascade", true); - } - else - { - AddCapsBool(t, "b_support_cascade", false); - } - - if (s->Cedar->Bridge) - { - // Bridge mode - AddCapsBool(t, "b_bridge", true); - } - else if (s->ServerType == SERVER_TYPE_STANDALONE) - { - // Stand-alone mode - AddCapsBool(t, "b_standalone", true); - } - else if (s->ServerType == SERVER_TYPE_FARM_CONTROLLER) - { - // Cluster controller mode - AddCapsBool(t, "b_cluster_controller", true); - } - else - { - // Cluster member mode - AddCapsBool(t, "b_cluster_member", true); - } - - // Virtual HUB is modifiable - AddCapsBool(t, "b_support_config_hub", s->ServerType != SERVER_TYPE_FARM_MEMBER && - s->Cedar->Bridge == false); - - // VPN client can be connected - AddCapsBool(t, "b_vpn_client_connect", s->Cedar->Bridge == false ? true : false); - - // External authentication server is available - AddCapsBool(t, "b_support_radius", s->ServerType != SERVER_TYPE_FARM_MEMBER && - s->Cedar->Bridge == false); - - // Local-bridge function is available - AddCapsBool(t, "b_local_bridge", IsBridgeSupported()); - - if (OS_IS_WINDOWS(GetOsInfo()->OsType)) - { - // Packet capture driver is not installed - AddCapsBool(t, "b_must_install_pcap", IsEthSupported() == false ? true : false); - } - else - { - // Regard that the driver is installed in the Linux version - AddCapsBool(t, "b_must_install_pcap", false); - } - - if (IsBridgeSupported()) - { - // TUN / TAP device availability (Linux and BSD) - const UINT OsType = GetOsInfo()->OsType; - AddCapsBool(t, "b_tap_supported", OsType == OSTYPE_LINUX || OsType == OSTYPE_BSD); - } - - // Cascade connection - if (s->ServerType == SERVER_TYPE_STANDALONE) - { - AddCapsBool(t, "b_support_cascade", true); - } - else - { - AddCapsBool(t, "b_support_cascade", false); - } - - // Server authentication can be used in cascade connection - AddCapsBool(t, "b_support_cascade_cert", true); - - // the log file settings is modifiable - AddCapsBool(t, "b_support_config_log", s->ServerType != SERVER_TYPE_FARM_MEMBER); - - // Automatic deletion of log file is available - AddCapsBool(t, "b_support_autodelete", true); - - // Config file operation is available - AddCapsBool(t, "b_support_config_rw", true); - - // Attribute of each Virtual HUB can be set - AddCapsBool(t, "b_support_hub_admin_option", true); - - // Client certificate can be set in a cascade connection - AddCapsBool(t, "b_support_cascade_client_cert", true); - - // Virtual HUB can be hidden - AddCapsBool(t, "b_support_hide_hub", true); - - // Integrated management - AddCapsBool(t, "b_support_cluster_admin", true); - - // Flag of open-source version - AddCapsBool(t, "b_is_softether", true); - - if (s->Cedar->Bridge == false) - { - - // The virtual layer 3 switch function is available - AddCapsBool(t, "b_support_layer3", true); - - AddCapsInt(t, "i_max_l3_sw", MAX_NUM_L3_SWITCH); - AddCapsInt(t, "i_max_l3_if", MAX_NUM_L3_IF); - AddCapsInt(t, "i_max_l3_table", MAX_NUM_L3_TABLE); - - // Can act as a part of a cluster - AddCapsBool(t, "b_support_cluster", true); - } - else - { - AddCapsBool(t, "b_support_layer3", false); - - AddCapsInt(t, "i_max_l3_sw", 0); - AddCapsInt(t, "i_max_l3_if", 0); - AddCapsInt(t, "i_max_l3_table", 0); - - AddCapsBool(t, "b_support_cluster", false); - } - - if (s->ServerType != SERVER_TYPE_FARM_MEMBER && s->Cedar->Bridge == false) - { - // Support for CRL - AddCapsBool(t, "b_support_crl", true); - - // Supports AC - AddCapsBool(t, "b_support_ac", true); - } - - // Supports downloading a log file - AddCapsBool(t, "b_support_read_log", true); - - // Cascade connection can be renamed - AddCapsBool(t, "b_support_rename_cascade", true); - - - if (s->Cedar->Beta) - { - // Beta version - AddCapsBool(t, "b_beta_version", true); - } - - // VM discrimination - AddCapsBool(t, "b_is_in_vm", s->IsInVm); - - // Support for display name of the network connection for the local bridge -#ifdef OS_WIN32 - if (IsBridgeSupported() && IsNt() && GetOsInfo()->OsType >= OSTYPE_WINDOWS_2000_PROFESSIONAL) - { - AddCapsBool(t, "b_support_network_connection_name", true); - } -#else // OS_WIN32 - if (IsBridgeSupported() && EthIsInterfaceDescriptionSupportedUnix()) - { - AddCapsBool(t, "b_support_network_connection_name", true); - } -#endif // OS_WIN32 - - // Support for MAC address filtering - AddCapsBool(t, "b_support_check_mac", true); - - // Support for status check of the TCP connection - AddCapsBool(t, "b_support_check_tcp_state", true); - - // Can specify multiple server and retry intervals in Radius authentication - AddCapsBool(t, "b_support_radius_retry_interval_and_several_servers", s->ServerType != SERVER_TYPE_FARM_MEMBER && - s->Cedar->Bridge == false); - - // Can manage the ID of the tagged VLAN in the MAC address table - AddCapsBool(t, "b_support_vlan", true); - - // Support for Virtual HUB extended options - if ((s->Cedar->Bridge == false) && - (s->ServerType == SERVER_TYPE_STANDALONE || s->ServerType == SERVER_TYPE_FARM_CONTROLLER)) - { - AddCapsBool(t, "b_support_hub_ext_options", true); - } - else - { - AddCapsBool(t, "b_support_hub_ext_options", false); - } - - // Support for Security Policy version 3.0 - AddCapsBool(t, "b_support_policy_ver_3", true); - - // Support for IPv6 access list - AddCapsBool(t, "b_support_ipv6_acl", true); - - // Support for setting of delay, jitter and packet loss in the access list - AddCapsBool(t, "b_support_ex_acl", true); - - // Support for URL redirection in the access list - AddCapsBool(t, "b_support_redirect_url_acl", true); - - // Supports the specification by the group name in the access list - AddCapsBool(t, "b_support_acl_group", true); - - // Support for IPv6 in connection source IP restriction list - AddCapsBool(t, "b_support_ipv6_ac", true); - - // Support for VLAN tagged packet transmission configuration tool - AddCapsBool(t, "b_support_eth_vlan", (OS_IS_WINDOWS_NT(GetOsType()) && GET_KETA(GetOsType(), 100) >= 2)); - - // Support for the message display function when the VPN connect to the Virtual HUB - AddCapsBool(t, "b_support_msg", true); - - // UDP acceleration feature - AddCapsBool(t, "b_support_udp_acceleration", true); - - // AES acceleration function - AddCapsBool(t, "b_support_aes_ni", IsAesNiSupported()); - -#ifdef OS_WIN32 - // SeLow driver - AddCapsBool(t, "b_using_selow_driver", Win32IsUsingSeLow()); -#endif // OS_WIN32 - - // VPN Azure function - AddCapsBool(t, "b_support_azure", SiIsAzureSupported(s)); - - // VPN3 - AddCapsBool(t, "b_vpn3", true); - - // VPN4 - AddCapsBool(t, "b_vpn4", true); - - - UpdateGlobalServerFlags(s, t); -} - -// SYSLOG_SETTING -void InRpcSysLogSetting(SYSLOG_SETTING *t, PACK *p) -{ - // Validate arguments - if (t == NULL || p == NULL) - { - return; - } - - Zero(t, sizeof(SYSLOG_SETTING)); - t->SaveType = PackGetInt(p, "SaveType"); - t->Port = PackGetInt(p, "Port"); - PackGetStr(p, "Hostname", t->Hostname, sizeof(t->Hostname)); -} -void OutRpcSysLogSetting(PACK *p, SYSLOG_SETTING *t) -{ - // Validate arguments - if (t == NULL || p == NULL) - { - return; - } - - PackAddInt(p, "SaveType", t->SaveType); - PackAddInt(p, "Port", t->Port); - PackAddStr(p, "Hostname", t->Hostname); -} - -// CAPSLIST -void InitCapsList(CAPSLIST *t) -{ - // Validate arguments - if (t == NULL) - { - return; - } - - Zero(t, sizeof(CAPSLIST)); - t->CapsList = NewListFast(NULL); -} -void InRpcCapsList(CAPSLIST *t, PACK *p) -{ - UINT i; - // Validate arguments - if (t == NULL || p == NULL) - { - return; - } - - Zero(t, sizeof(CAPSLIST)); - t->CapsList = NewListFast(CompareCaps); - - for (i = 0;i < LIST_NUM(p->elements);i++) - { - ELEMENT *e = LIST_DATA(p->elements, i); - - if (StartWith(e->name, "caps_") && e->type == VALUE_INT && e->num_value == 1) - { - CAPS *c = NewCaps(e->name + 5, e->values[0]->IntValue); - Insert(t->CapsList, c); - } - } -} -void OutRpcCapsList(PACK *p, CAPSLIST *t) -{ - UINT i; - // Validate arguments - if (t == NULL || p == NULL) - { - return; - } - - PackSetCurrentJsonGroupName(p, "CapsList"); - for (i = 0;i < LIST_NUM(t->CapsList);i++) - { - char tmp[MAX_SIZE]; - char ct_key[MAX_PATH]; - wchar_t ct_description[MAX_PATH]; - wchar_t *w; - CAPS *c = LIST_DATA(t->CapsList, i); - - Format(tmp, sizeof(tmp), "caps_%s", c->Name); - - Format(ct_key, sizeof(ct_key), "CT_%s", c->Name); - - Zero(ct_description, sizeof(ct_description)); - w = _UU(ct_key); - if (UniIsEmptyStr(w) == false) - { - UniStrCpy(ct_description, sizeof(ct_description), w); - } - else - { - StrToUni(ct_description, sizeof(ct_description), c->Name); - } - - PackAddInt(p, tmp, c->Value); - - PackAddStrEx(p, "CapsName", c->Name, i, LIST_NUM(t->CapsList)); - PackAddIntEx(p, "CapsValue", c->Value, i, LIST_NUM(t->CapsList)); - PackAddUniStrEx(p, "CapsDescrption", ct_description, i, LIST_NUM(t->CapsList)); - } - PackSetCurrentJsonGroupName(p, NULL); -} -void FreeRpcCapsList(CAPSLIST *t) -{ - UINT i; - // Validate arguments - if (t == NULL) - { - return; - } - - for (i = 0;i < LIST_NUM(t->CapsList);i++) - { - CAPS *c = LIST_DATA(t->CapsList, i); - - FreeCaps(c); - } - - ReleaseList(t->CapsList); -} - -// Add a bool type to Caps list -void AddCapsBool(CAPSLIST *caps, char *name, bool b) -{ - CAPS *c; - // Validate arguments - if (caps == NULL || name == NULL) - { - return; - } - - c = NewCaps(name, b == false ? 0 : 1); - AddCaps(caps, c); -} - -// Add the int type to Caps list -void AddCapsInt(CAPSLIST *caps, char *name, UINT i) -{ - CAPS *c; - // Validate arguments - if (caps == NULL || name == NULL) - { - return; - } - - c = NewCaps(name, i); - AddCaps(caps, c); -} - -// Get the int type from the Caps list -UINT GetCapsInt(CAPSLIST *caps, char *name) -{ - CAPS *c; - // Validate arguments - if (caps == NULL || name == NULL) - { - return 0; - } - - c = GetCaps(caps, name); - if (c == NULL) - { - return 0; - } - - return c->Value; -} - -// Get bool type from the Caps list -bool GetCapsBool(CAPSLIST *caps, char *name) -{ - CAPS *c; - // Validate arguments - if (caps == NULL || name == NULL) - { - return false; - } - - c = GetCaps(caps, name); - if (c == NULL) - { - return false; - } - - return c->Value == 0 ? false : true; -} - -// Release the Caps list -void FreeCapsList(CAPSLIST *caps) -{ - UINT i; - // Validate arguments - if (caps == NULL) - { - return; - } - - for (i = 0;i < LIST_NUM(caps->CapsList);i++) - { - CAPS *c = LIST_DATA(caps->CapsList, i); - - FreeCaps(c); - } - - ReleaseList(caps->CapsList); - Free(caps); -} - -// Get the Caps -CAPS *GetCaps(CAPSLIST *caps, char *name) -{ - UINT i; - // Validate arguments - if (caps == NULL || name == NULL) - { - return NULL; - } - - for (i = 0;i < LIST_NUM(caps->CapsList);i++) - { - CAPS *c = LIST_DATA(caps->CapsList, i); - - if (StrCmpi(c->Name, name) == 0) - { - return c; - } - } - - return NULL; -} - -// Add to the Caps -void AddCaps(CAPSLIST *caps, CAPS *c) -{ - // Validate arguments - if (caps == NULL || c == NULL) - { - return; - } - - Insert(caps->CapsList, c); -} - -// Comparison of Caps -int CompareCaps(void *p1, void *p2) -{ - CAPS *c1, *c2; - if (p1 == NULL || p2 == NULL) - { - return 0; - } - c1 = *(CAPS **)p1; - c2 = *(CAPS **)p2; - if (c1 == NULL || c2 == NULL) - { - return 0; - } - - return StrCmpi(c1->Name, c2->Name); -} - -// Create a Caps list -CAPSLIST *NewCapsList() -{ - CAPSLIST *caps = ZeroMalloc(sizeof(CAPSLIST)); - - caps->CapsList = NewListFast(CompareCaps); - - return caps; -} - -// Release the Caps -void FreeCaps(CAPS *c) -{ - // Validate arguments - if (c == NULL) - { - return; - } - - Free(c->Name); - Free(c); -} - -// Create a Caps -CAPS *NewCaps(char *name, UINT value) -{ - CAPS *c; - // Validate arguments - if (name == NULL) - { - return NULL; - } - - c = ZeroMalloc(sizeof(CAPS)); - c->Name = CopyStr(name); - c->Value = value; - - return c; -} - -// Calculate the score from the current number of connections and weight -UINT SiCalcPoint(SERVER *s, UINT num, UINT weight) -{ - UINT server_max_sessions = SERVER_MAX_SESSIONS; - if (s == NULL) - { - return 0; - } - if (weight == 0) - { - weight = 100; - } - - server_max_sessions = GetServerCapsInt(s, "i_max_sessions"); - - if (server_max_sessions == 0) - { - // Avoid divide by zero - server_max_sessions = 1; - } - - return (UINT)(((double)server_max_sessions - - MIN((double)num * 100.0 / (double)weight, (double)server_max_sessions)) - * (double)FARM_BASE_POINT / (double)server_max_sessions); -} - -// Get the server score -UINT SiGetPoint(SERVER *s) -{ - UINT num_session; - // Validate arguments - if (s == NULL) - { - return 0; - } - - num_session = Count(s->Cedar->CurrentSessions); - - return SiCalcPoint(s, num_session, s->Weight); -} - -// Generate the default certificate -void SiGenerateDefaultCert(X **server_x, K **server_k) -{ - SiGenerateDefaultCertEx(server_x, server_k, NULL); -} -void SiGenerateDefaultCertEx(X **server_x, K **server_k, char *common_name) -{ - X *x; - K *private_key, *public_key; - NAME *name; - char tmp[MAX_SIZE]; - wchar_t cn[MAX_SIZE]; - // Validate arguments - if (server_x == NULL || server_k == NULL) - { - return; - } - - // Create a key pair - RsaGen(&private_key, &public_key, 2048); - - if (IsEmptyStr(common_name)) - { - // Get the host name - StrCpy(tmp, sizeof(tmp), "server.softether.vpn"); - GetMachineName(tmp, sizeof(tmp)); - StrToUni(cn, sizeof(cn), tmp); - } - else - { - StrToUni(cn, sizeof(cn), common_name); - } - - name = NewName(cn, cn, cn, - L"US", NULL, NULL); - x = NewRootX(public_key, private_key, name, GetDaysUntil2038Ex(), NULL); - - *server_x = x; - *server_k = private_key; - - FreeName(name); - - FreeK(public_key); -} - -// Set the server certificate to default -void SiInitDefaultServerCert(SERVER *s) -{ - X *x = NULL; - K *k = NULL; - // Validate arguments - if (s == NULL) - { - return; - } - - // Generate a server certificate and private key - SiGenerateDefaultCert(&x, &k); - - // Configure - SetCedarCert(s->Cedar, x, k); - - FreeX(x); - FreeK(k); -} - -// Set the encryption algorithm name to default -void SiInitCipherName(SERVER *s) -{ - // Validate arguments - if (s == NULL) - { - return; - } - - SetCedarCipherList(s->Cedar, SERVER_DEFAULT_CIPHER_NAME); -} - -// Initialize the listener list -void SiInitListenerList(SERVER *s) -{ - // Validate arguments - if (s == NULL) - { - return; - } - - SiLockListenerList(s); - { - { - // Register the 4 ports (443, 992, 1194, 8888) as the default port - SiAddListener(s, SERVER_DEF_PORTS_1, true); - SiAddListener(s, SERVER_DEF_PORTS_2, true); - SiAddListener(s, SERVER_DEF_PORTS_3, true); - SiAddListener(s, SERVER_DEF_PORTS_4, true); - } - } - SiUnlockListenerList(s); -} - -// Remove the listener -bool SiDeleteListener(SERVER *s, UINT port) -{ - SERVER_LISTENER *e; - // Validate arguments - if (s == NULL || port == 0) - { - return false; - } - - e = SiGetListener(s, port); - if (e == NULL) - { - return false; - } - - // Stop if still alive - SiDisableListener(s, port); - - if (e->Listener != NULL) - { - ReleaseListener(e->Listener); - } - - Delete(s->ServerListenerList, e); - Free(e); - - return true; -} - -// Compare the SERVER_LISTENER -int CompareServerListener(void *p1, void *p2) -{ - SERVER_LISTENER *s1, *s2; - if (p1 == NULL || p2 == NULL) - { - return 0; - } - s1 = *(SERVER_LISTENER **)p1; - s2 = *(SERVER_LISTENER **)p2; - if (s1 == NULL || s2 == NULL) - { - return 0; - } - - if (s1->Port > s2->Port) - { - return 1; - } - else if (s1->Port < s2->Port) - { - return -1; - } - else - { - return 0; - } -} - -// Stop the listener -bool SiDisableListener(SERVER *s, UINT port) -{ - SERVER_LISTENER *e; - // Validate arguments - if (s == NULL || port == 0) - { - return false; - } - - // Get the listener - e = SiGetListener(s, port); - if (e == NULL) - { - return false; - } - - if (e->Enabled == false || e->Listener == NULL) - { - // Already stopped - return true; - } - - // Stop the listener - StopListener(e->Listener); - - // Release the listener - ReleaseListener(e->Listener); - e->Listener = NULL; - - e->Enabled = false; - - return true; -} - -// Start the listener -bool SiEnableListener(SERVER *s, UINT port) -{ - SERVER_LISTENER *e; - // Validate arguments - if (s == NULL || port == 0) - { - return false; - } - - // Get the listener - e = SiGetListener(s, port); - if (e == NULL) - { - return false; - } - - if (e->Enabled) - { - // It has already started - return true; - } - - // Create a listener - e->Listener = NewListener(s->Cedar, LISTENER_TCP, e->Port); - if (e->Listener == NULL) - { - // Failure - return false; - } - - e->Listener->DisableDos = e->DisableDos; - - e->Enabled = true; - - return true; -} - -// Get the listener -SERVER_LISTENER *SiGetListener(SERVER *s, UINT port) -{ - UINT i; - // Validate arguments - if (s == NULL || port == 0) - { - return NULL; - } - - for (i = 0;i < LIST_NUM(s->ServerListenerList);i++) - { - SERVER_LISTENER *e = LIST_DATA(s->ServerListenerList, i); - if (e->Port == port) - { - return e; - } - } - - return NULL; -} - -// Add a listener -bool SiAddListener(SERVER *s, UINT port, bool enabled) -{ - return SiAddListenerEx(s, port, enabled, false); -} -bool SiAddListenerEx(SERVER *s, UINT port, bool enabled, bool disable_dos) -{ - SERVER_LISTENER *e; - UINT i; - // Validate arguments - if (s == NULL || port == 0) - { - return false; - } - - // Check whether the listener exists already - for (i = 0;i < LIST_NUM(s->ServerListenerList);i++) - { - e = LIST_DATA(s->ServerListenerList, i); - if (e->Port == port) - { - // Already exist - return false; - } - } - - // Register by initializing a new listener - e = ZeroMalloc(sizeof(SERVER_LISTENER)); - e->Enabled = enabled; - e->Port = port; - e->DisableDos = disable_dos; - - if (e->Enabled) - { - // Create a listener - e->Listener = NewListener(s->Cedar, LISTENER_TCP, e->Port); - if (e->Listener != NULL) - { - e->Listener->DisableDos = e->DisableDos; - } - } - - Insert(s->ServerListenerList, e); - - return true; -} - -// Lock the listener list -void SiLockListenerList(SERVER *s) -{ - // Validate arguments - if (s == NULL) - { - return; - } - - LockList(s->ServerListenerList); -} - -// Unlock the listener list -void SiUnlockListenerList(SERVER *s) -{ - // Validate arguments - if (s == NULL) - { - return; - } - - UnlockList(s->ServerListenerList); -} - -// Set the default value of the Virtual HUB options -void SiSetDefaultHubOption(HUB_OPTION *o) -{ - // Validate arguments - if (o == NULL) - { - return; - } - - o->MaxSession = 0; - o->VlanTypeId = MAC_PROTO_TAGVLAN; - o->NoIPv6DefaultRouterInRAWhenIPv6 = true; - o->ManageOnlyPrivateIP = true; - o->ManageOnlyLocalUnicastIPv6 = true; - o->NoMacAddressLog = true; - o->NoDhcpPacketLogOutsideHub = true; - o->AccessListIncludeFileCacheLifetime = ACCESS_LIST_INCLUDE_FILE_CACHE_LIFETIME; - o->RemoveDefGwOnDhcpForLocalhost = true; - o->FloodingSendQueueBufferQuota = DEFAULT_FLOODING_QUEUE_LENGTH; -} - -// Create a default virtual HUB -void SiInitDefaultHubList(SERVER *s) -{ - HUB *h; - HUB_OPTION o; - HUB_LOG g; - // Validate arguments - if (s == NULL) - { - return; - } - - Zero(&o, sizeof(o)); - - // Configure a default Virtual HUB management options - SiSetDefaultHubOption(&o); - - h = NewHub(s->Cedar, s->Cedar->Bridge == false ? SERVER_DEFAULT_HUB_NAME : SERVER_DEFAULT_BRIDGE_NAME, &o); - h->CreatedTime = SystemTime64(); - AddHub(s->Cedar, h); - - if (s->Cedar->Bridge) - { - // Randomize the password - Rand(h->HashedPassword, sizeof(h->HashedPassword)); - Rand(h->SecurePassword, sizeof(h->SecurePassword)); - } - - h->Offline = true; - SetHubOnline(h); - - // Log settings - SiSetDefaultLogSetting(&g); - SetHubLogSetting(h, &g); - - ReleaseHub(h); -} - -// Set the log settings to default -void SiSetDefaultLogSetting(HUB_LOG *g) -{ - // Validate arguments - if (g == NULL) - { - return; - } - - Zero(g, sizeof(HUB_LOG)); - g->SaveSecurityLog = true; - g->SecurityLogSwitchType = LOG_SWITCH_DAY; - g->SavePacketLog = true; - g->PacketLogSwitchType = LOG_SWITCH_DAY; - g->PacketLogConfig[PACKET_LOG_TCP_CONN] = - g->PacketLogConfig[PACKET_LOG_DHCP] = PACKET_LOG_HEADER; -} - -// Set the initial configuration -void SiLoadInitialConfiguration(SERVER *s) -{ - RPC_KEEP k; - // Validate arguments - if (s == NULL) - { - return; - } - - // Auto saving interval related - s->AutoSaveConfigSpan = SERVER_FILE_SAVE_INTERVAL_DEFAULT; - s->BackupConfigOnlyWhenModified = true; - - s->Weight = FARM_DEFAULT_WEIGHT; - - SiLoadGlobalParamsCfg(NULL); - - // KEEP related - Zero(&k, sizeof(k)); - - { - k.UseKeepConnect = true; - } - k.KeepConnectPort = 80; - StrCpy(k.KeepConnectHost, sizeof(k.KeepConnectHost), CLIENT_DEFAULT_KEEPALIVE_HOST); - k.KeepConnectInterval = KEEP_INTERVAL_DEFAULT * 1000; - k.KeepConnectProtocol = CONNECTION_UDP; - - Lock(s->Keep->lock); - { - KEEP *keep = s->Keep; - keep->Enable = k.UseKeepConnect; - keep->Server = true; - StrCpy(keep->ServerName, sizeof(keep->ServerName), k.KeepConnectHost); - keep->ServerPort = k.KeepConnectPort; - keep->UdpMode = k.KeepConnectProtocol; - keep->Interval = k.KeepConnectInterval; - } - Unlock(s->Keep->lock); - - // Initialize the password - { - Sha0(s->HashedPassword, "", 0); - } - - // Set the encryption algorithm name to default - SiInitCipherName(s); - - // Set the server certificate to default - SiInitDefaultServerCert(s); - - // Set the character which separates the username from the hub name - s->Cedar->UsernameHubSeparator = DEFAULT_USERNAME_HUB_SEPARATOR; - - // Create a default HUB - { - SiInitDefaultHubList(s); - } - - if (s->Cedar->Bridge == false) - { - // Create a DDNS client - s->DDnsClient = NewDDNSClient(s->Cedar, NULL, NULL); - } - - - // Set the listener list to default setting - SiInitListenerList(s); - - if (s->Cedar->Bridge) - { - // NAT traversal can not be used in the bridge environment - s->DisableNatTraversal = true; - } - else - { - // Disable VPN-over-ICMP and VPN-over-DNS by default - s->EnableVpnOverIcmp = false; - s->EnableVpnOverDns = false; - - { - LIST *ports = s->PortsUDP; - - AddInt(ports, SERVER_DEF_PORTS_1); - AddInt(ports, SERVER_DEF_PORTS_2); - AddInt(ports, SERVER_DEF_PORTS_3); - AddInt(ports, SERVER_DEF_PORTS_4); - - ProtoSetUdpPorts(s->Proto, ports); - } - } - - s->Eraser = NewEraser(s->Logger, 0); -} - -// Check whether the ports required for VPN-over-ICMP can be opened -bool SiCanOpenVpnOverIcmpPort() -{ - // Whether the ICMP can be opened - SOCK *s = NewUDP(MAKE_SPECIAL_PORT(IP_PROTO_ICMPV4)); - - if (s == NULL) - { - // Failure - return false; - } - - Disconnect(s); - ReleaseSock(s); - - return true; -} - -// Check whether the ports required for VPN-over-DNS can be opened -bool SiCanOpenVpnOverDnsPort() -{ - // Whether UDP Port 53 can be listen on - SOCK *s = NewUDP(53); - - if (s == NULL) - { - // Listening failure - return false; - } - - Disconnect(s); - ReleaseSock(s); - - return true; -} - -// Read the configuration file (main) -bool SiLoadConfigurationFileMain(SERVER *s, FOLDER *root) -{ - // Validate arguments - if (s == NULL || root == NULL) - { - return false; - } - - return SiLoadConfigurationCfg(s, root); -} - -// Read the configuration file -bool SiLoadConfigurationFile(SERVER *s) -{ - // Validate arguments - bool ret = false; - FOLDER *root; - char *server_config_filename = SERVER_CONFIG_FILE_NAME; - if (s == NULL) - { - return false; - } - - - s->CfgRw = NewCfgRwEx2A(&root, - s->Cedar->Bridge == false ? server_config_filename : BRIDGE_CONFIG_FILE_NAME, false, - s->Cedar->Bridge == false ? SERVER_CONFIG_TEMPLATE_NAME : BRIDGE_CONFIG_TEMPLATE_NAME); - - if (server_reset_setting) - { - CfgDeleteFolder(root); - root = NULL; - server_reset_setting = false; - } - - if (root == NULL) - { - return false; - } - - ret = SiLoadConfigurationFileMain(s, root); - - CfgDeleteFolder(root); - - return ret; -} - -// Initialize the configuration -void SiInitConfiguration(SERVER *s) -{ - // Validate arguments - if (s == NULL) - { - return; - } - - s->AutoSaveConfigSpan = SERVER_FILE_SAVE_INTERVAL_DEFAULT; - s->BackupConfigOnlyWhenModified = true; - - if (s->Cedar->Bridge == false) - { - // Protocols handler - s->Proto = ProtoNew(s->Cedar); - // IPsec server - s->IPsecServer = NewIPsecServer(s->Cedar); - } - - SLog(s->Cedar, "LS_LOAD_CONFIG_1"); - if (SiLoadConfigurationFile(s) == false) - { - // Ethernet initialization - InitEth(); - - SLog(s->Cedar, "LS_LOAD_CONFIG_3"); - SiLoadInitialConfiguration(s); - - SetFifoCurrentReallocMemSize(MEM_FIFO_REALLOC_MEM_SIZE); - - server_reset_setting = false; - } - else - { - SLog(s->Cedar, "LS_LOAD_CONFIG_2"); - } - - s->CfgRw->DontBackup = s->DontBackupConfig; - - // The arp_filter in Linux - if (GetOsInfo()->OsType == OSTYPE_LINUX) - { - if (s->NoLinuxArpFilter == false) - { - SetLinuxArpFilter(); - } - } - - if (s->DisableDosProtection) - { - DisableDosProtect(); - } - else - { - EnableDosProtect(); - } - - s->AutoSaveConfigSpanSaved = s->AutoSaveConfigSpan; - - // Create a VPN Azure client - if (s->DDnsClient != NULL && s->Cedar->Bridge == false && s->ServerType == SERVER_TYPE_STANDALONE) - { - s->AzureClient = NewAzureClient(s->Cedar, s); - - AcSetEnable(s->AzureClient, s->EnableVpnAzure); - } - - // Reduce the storage interval in the case of user mode -#ifdef OS_WIN32 - if (MsIsUserMode()) - { - s->AutoSaveConfigSpan = MIN(s->AutoSaveConfigSpan, SERVER_FILE_SAVE_INTERVAL_USERMODE); - } -#endif //OS_WIN32 - - // Create a saving thread - SLog(s->Cedar, "LS_INIT_SAVE_THREAD", s->AutoSaveConfigSpan / 1000); - s->SaveHaltEvent = NewEvent(); - s->SaveThread = NewThread(SiSaverThread, s); -} - -// Set the state of Enabled / Disabled of Azure Client -void SiSetAzureEnable(SERVER *s, bool enabled) -{ - // Validate arguments - if (s == NULL) - { - return; - } - - if (s->AzureClient != NULL) - { - AcSetEnable(s->AzureClient, enabled); - } - - s->EnableVpnAzure = enabled; -} - -// Apply the Config to the Azure Client -void SiApplyAzureConfig(SERVER *s, DDNS_CLIENT_STATUS *ddns_status) -{ - // Validate arguments - if (s == NULL) - { - return; - } - - AcApplyCurrentConfig(s->AzureClient, ddns_status); -} - -// Get whether the Azure Client is enabled -bool SiIsAzureEnabled(SERVER *s) -{ - // Validate arguments - if (s == NULL) - { - return false; - } - - if (s->AzureClient == NULL) - { - return false; - } - - return s->EnableVpnAzure; -} - -// Get whether the Azure Client is supported -bool SiIsAzureSupported(SERVER *s) -{ - // Validate arguments - if (s == NULL) - { - return false; - } - - if (s->AzureClient == NULL) - { - return false; - } - - return true; -} - -// Read the server settings from the CFG -bool SiLoadConfigurationCfg(SERVER *s, FOLDER *root) -{ - FOLDER *f1, *f2, *f3, *f4, *f5, *f6, *f7, *f8, *f; - // Validate arguments - if (s == NULL || root == NULL) - { - return false; - } - - f = NULL; - - - f1 = CfgGetFolder(root, "ServerConfiguration"); - f2 = CfgGetFolder(root, "VirtualHUB"); - f3 = CfgGetFolder(root, "ListenerList"); - f4 = CfgGetFolder(root, "LocalBridgeList"); - f5 = CfgGetFolder(root, "VirtualLayer3SwitchList"); - f6 = CfgGetFolder(root, "LicenseManager"); - f7 = CfgGetFolder(root, "IPsec"); - f8 = CfgGetFolder(root, "DDnsClient"); - - if (f1 == NULL) - { - SLog(s->Cedar, "LS_BAD_CONFIG"); - return false; - } - -#ifdef OS_WIN32 - if (f4 != NULL) - { - // Read the flag of using the SeLow driver - bool b = true; - - if (CfgIsItem(f4, "EnableSoftEtherKernelModeDriver")) - { - b = CfgGetBool(f4, "EnableSoftEtherKernelModeDriver"); - } - - Win32SetEnableSeLow(b); - } -#endif // OS_WIN32 - - // Ethernet initialization - InitEth(); - - s->ConfigRevision = CfgGetInt(root, "ConfigRevision"); - - if (s->Cedar->Bridge == false && f6 != NULL) - { - if (GetServerCapsBool(s, "b_support_license")) - { - SiLoadLicenseManager(s, f6); - } - } - - DestroyServerCapsCache(s); - - SiLoadServerCfg(s, f1); - - if (s->ServerType != SERVER_TYPE_FARM_MEMBER) - { - SiLoadHubs(s, f2); - } - - SiLoadListeners(s, f3); - - if (f4 != NULL) - { - SiLoadLocalBridges(s, f4); - } - - if (s->Cedar->Bridge == false && f5 != NULL) - { - SiLoadL3Switchs(s, f5); - } - - if (f7 != NULL && GetServerCapsBool(s, "b_support_ipsec")) - { - SiLoadIPsec(s, f7); - } - - if (s->Cedar->Bridge == false) - { - if (f8 == NULL) - { - // Create a DDNS client with a new key - s->DDnsClient = NewDDNSClient(s->Cedar, NULL, NULL); - } - else - { - // Create by reading the setting of the DDNS client - UCHAR key[SHA1_SIZE]; - if (CfgGetBool(f8, "Disabled")) - { - // Disabled - } - else - { - char machine_name[MAX_SIZE]; - char machine_name2[MAX_SIZE]; - INTERNET_SETTING t; - BUF *pw; - - // Proxy Setting - Zero(&t, sizeof(t)); - t.ProxyType = CfgGetInt(f8, "ProxyType"); - CfgGetStr(f8, "ProxyHostName", t.ProxyHostName, sizeof(t.ProxyHostName)); - t.ProxyPort = CfgGetInt(f8, "ProxyPort"); - CfgGetStr(f8, "ProxyUsername", t.ProxyUsername, sizeof(t.ProxyUsername)); - pw = CfgGetBuf(f8, "ProxyPassword"); - if (pw != NULL) - { - char *pw_str = DecryptPassword(pw); - StrCpy(t.ProxyPassword, sizeof(t.ProxyPassword), pw_str); - - Free(pw_str); - FreeBuf(pw); - } - - CfgGetStr(f8, "CustomHttpHeader", t.CustomHttpHeader, sizeof(t.CustomHttpHeader)); - - GetMachineHostName(machine_name, sizeof(machine_name)); - - CfgGetStr(f8, "LocalHostname", machine_name2, sizeof(machine_name2)); - - if (CfgGetByte(f8, "Key", key, sizeof(key)) != sizeof(key) || StrCmpi(machine_name, machine_name2) != 0) - { - // Create a DDNS client with a new key - s->DDnsClient = NewDDNSClient(s->Cedar, NULL, &t); - } - else - { - // Create the DDNS client with stored key - s->DDnsClient = NewDDNSClient(s->Cedar, key, &t); - } - } - } - } - - - { - HUB *h = NULL; - - // Remove the virtual HUB "VPNGATE" when VGS disabled - LockHubList(s->Cedar); - { - h = GetHub(s->Cedar, VG_HUBNAME); - } - UnlockHubList(s->Cedar); - - if (h != NULL) - { - StopHub(h); - DelHub(s->Cedar, h); - ReleaseHub(h); - } - } - - s->IPsecMessageDisplayed = CfgGetBool(root, "IPsecMessageDisplayed"); - - - return true; -} - -// Write the listener configuration -void SiWriteListenerCfg(FOLDER *f, SERVER_LISTENER *r) -{ - // Validate arguments - if (f == NULL || r == NULL) - { - return; - } - - CfgAddBool(f, "Enabled", r->Enabled); - CfgAddInt(f, "Port", r->Port); - CfgAddBool(f, "DisableDos", r->DisableDos); -} - -// Read the listener configuration -void SiLoadListenerCfg(SERVER *s, FOLDER *f) -{ - bool enable; - UINT port; - bool disable_dos; - // Validate arguments - if (s == NULL || f == NULL) - { - return; - } - - enable = CfgGetBool(f, "Enabled"); - port = CfgGetInt(f, "Port"); - disable_dos = CfgGetBool(f, "DisableDos"); - - if (port == 0) - { - return; - } - - SiAddListenerEx(s, port, enable, disable_dos); -} - -// Read the listener list -void SiLoadListeners(SERVER *s, FOLDER *f) -{ - TOKEN_LIST *t; - UINT i; - // Validate arguments - if (s == NULL || f == NULL) - { - return; - } - - t = CfgEnumFolderToTokenList(f); - for (i = 0;i < t->NumTokens;i++) - { - FOLDER *ff = CfgGetFolder(f, t->Token[i]); - if (ff != NULL) - { - SiLoadListenerCfg(s, ff); - } - } - FreeToken(t); -} - -// Write the listener list -void SiWriteListeners(FOLDER *f, SERVER *s) -{ - // Validate arguments - if (f == NULL || s == NULL) - { - return; - } - - LockList(s->ServerListenerList); - { - UINT i; - for (i = 0;i < LIST_NUM(s->ServerListenerList);i++) - { - SERVER_LISTENER *r = LIST_DATA(s->ServerListenerList, i); - char name[MAX_SIZE]; - Format(name, sizeof(name), "Listener%u", i); - SiWriteListenerCfg(CfgCreateFolder(f, name), r); - } - } - UnlockList(s->ServerListenerList); -} - -// Write the bridge -void SiWriteLocalBridgeCfg(FOLDER *f, LOCALBRIDGE *br) -{ - // Validate arguments - if (f == NULL || br == NULL) - { - return; - } - - CfgAddStr(f, "DeviceName", br->DeviceName); - CfgAddStr(f, "HubName", br->HubName); - CfgAddBool(f, "NoPromiscuousMode", br->Local); - CfgAddBool(f, "MonitorMode", br->Monitor); - CfgAddBool(f, "LimitBroadcast", br->LimitBroadcast); - - if (OS_IS_UNIX(GetOsInfo()->OsType)) - { - CfgAddBool(f, "TapMode", br->TapMode); - - if (br->TapMode) - { - char tmp[MAX_SIZE]; - MacToStr(tmp, sizeof(tmp), br->TapMacAddress); - CfgAddStr(f, "TapMacAddress", tmp); - } - } -} - -// Write the bridge list -void SiWriteLocalBridges(FOLDER *f, SERVER *s) -{ - // Validate arguments - if (s == NULL || f == NULL) - { - return; - } - -#ifdef OS_WIN32 - CfgAddBool(f, "ShowAllInterfaces", Win32EthGetShowAllIf()); - - CfgAddBool(f, "EnableSoftEtherKernelModeDriver", Win32GetEnableSeLow()); -#endif // OS_WIN32 - -#ifdef UNIX_LINUX - CfgAddBool(f, "DoNotDisableOffloading", GetGlobalServerFlag(GSF_LOCALBRIDGE_NO_DISABLE_OFFLOAD)); -#endif // UNIX_LINUX - - LockList(s->Cedar->LocalBridgeList); - { - UINT i; - for (i = 0;i < LIST_NUM(s->Cedar->LocalBridgeList);i++) - { - LOCALBRIDGE *br = LIST_DATA(s->Cedar->LocalBridgeList, i); - char name[MAX_SIZE]; - - Format(name, sizeof(name), "LocalBridge%u", i); - SiWriteLocalBridgeCfg(CfgCreateFolder(f, name), br); - } - } - UnlockList(s->Cedar->LocalBridgeList); -} - -// Read the bridge -void SiLoadLocalBridgeCfg(SERVER *s, FOLDER *f) -{ - char hub[MAX_SIZE]; - char nic[MAX_SIZE]; - bool tapmode = false; - UCHAR tapaddr[6]; - // Validate arguments - if (s == NULL || f == NULL) - { - return; - } - - Zero(hub, sizeof(hub)); - Zero(nic, sizeof(nic)); - - CfgGetStr(f, "HubName", hub, sizeof(hub)); - CfgGetStr(f, "DeviceName", nic, sizeof(nic)); - - if (IsEmptyStr(hub) || IsEmptyStr(nic) - ) - { - return; - } - - if (OS_IS_UNIX(GetOsInfo()->OsType)) - { - if (CfgGetBool(f, "TapMode")) - { - char tmp[MAX_SIZE]; - tapmode = true; - Zero(tapaddr, sizeof(tapaddr)); - if (CfgGetStr(f, "TapMacAddress", tmp, sizeof(tmp))) - { - BUF *b; - b = StrToBin(tmp); - if (b != NULL && b->Size == 6) - { - Copy(tapaddr, b->Buf, sizeof(tapaddr)); - } - FreeBuf(b); - } - } - } - - AddLocalBridge(s->Cedar, hub, nic, CfgGetBool(f, "NoPromiscuousMode"), CfgGetBool(f, "MonitorMode"), - tapmode, tapaddr, CfgGetBool(f, "LimitBroadcast")); -} - -// Read the bridge list -void SiLoadLocalBridges(SERVER *s, FOLDER *f) -{ - TOKEN_LIST *t; - UINT i; - // Validate arguments - if (s == NULL || f == NULL) - { - return; - } - -#ifdef OS_WIN32 - Win32EthSetShowAllIf(CfgGetBool(f, "ShowAllInterfaces")); -#endif // OS_WIN32 - -#ifdef UNIX_LINUX - SetGlobalServerFlag(GSF_LOCALBRIDGE_NO_DISABLE_OFFLOAD, CfgGetBool(f, "DoNotDisableOffloading")); -#endif // UNIX_LINUX - - t = CfgEnumFolderToTokenList(f); - - for (i = 0;i < t->NumTokens;i++) - { - char *name = t->Token[i]; - - SiLoadLocalBridgeCfg(s, CfgGetFolder(f, name)); - } - - FreeToken(t); -} - -// Increment the configuration revision of the server -void IncrementServerConfigRevision(SERVER *s) -{ - // Validate arguments - if (s == NULL) - { - return; - } - - s->ConfigRevision++; -} - -// Write the server settings to CFG -FOLDER *SiWriteConfigurationToCfg(SERVER *s) -{ - FOLDER *root; - char region[128]; - // Validate arguments - if (s == NULL) - { - return NULL; - } - - root = CfgCreateFolder(NULL, TAG_ROOT); - - SiGetCurrentRegion(s->Cedar, region, sizeof(region)); - - CfgAddStr(root, "Region", region); - - CfgAddInt(root, "ConfigRevision", s->ConfigRevision); - - SiWriteListeners(CfgCreateFolder(root, "ListenerList"), s); - - SiWriteLocalBridges(CfgCreateFolder(root, "LocalBridgeList"), s); - - SiWriteServerCfg(CfgCreateFolder(root, "ServerConfiguration"), s); - - - if (s->UpdatedServerType != SERVER_TYPE_FARM_MEMBER) - { - SiWriteHubs(CfgCreateFolder(root, "VirtualHUB"), s); - } - - if (s->Cedar->Bridge == false) - { - SiWriteL3Switchs(CfgCreateFolder(root, "VirtualLayer3SwitchList"), s); - - if (GetServerCapsBool(s, "b_support_license")) - { - SiWriteLicenseManager(CfgCreateFolder(root, "LicenseManager"), s); - } - } - - if (s->Led) - { - CfgAddBool(root, "Led", true); - CfgAddBool(root, "LedSpecial", s->LedSpecial); - } - - if (GetServerCapsBool(s, "b_support_ipsec")) - { - SiWriteIPsec(CfgCreateFolder(root, "IPsec"), s); - } - - if (s->Cedar->Bridge == false) - { - FOLDER *ddns_folder = CfgCreateFolder(root, "DDnsClient"); - - if (s->DDnsClient == NULL) - { - // Disabled - CfgAddBool(ddns_folder, "Disabled", true); - } - else - { - char machine_name[MAX_SIZE]; - BUF *pw; - INTERNET_SETTING *t; - // Enabled - CfgAddBool(ddns_folder, "Disabled", false); - CfgAddByte(ddns_folder, "Key", s->DDnsClient->Key, SHA1_SIZE); - - GetMachineHostName(machine_name, sizeof(machine_name)); - CfgAddStr(ddns_folder, "LocalHostname", machine_name); - - t = &s->DDnsClient->InternetSetting; - - CfgAddInt(ddns_folder, "ProxyType", t->ProxyType); - CfgAddStr(ddns_folder, "ProxyHostName", t->ProxyHostName); - CfgAddInt(ddns_folder, "ProxyPort", t->ProxyPort); - CfgAddStr(ddns_folder, "ProxyUsername", t->ProxyUsername); - - if (IsEmptyStr(t->ProxyPassword) == false) - { - pw = EncryptPassword(t->ProxyPassword); - - CfgAddBuf(ddns_folder, "ProxyPassword", pw); - - FreeBuf(pw); - } - - CfgAddStr(ddns_folder, "CustomHttpHeader", t->CustomHttpHeader); - } - } - - CfgAddBool(root, "IPsecMessageDisplayed", s->IPsecMessageDisplayed); - - - return root; -} - -// Read the policy -void SiLoadPolicyCfg(POLICY *p, FOLDER *f) -{ - // Validate arguments - if (f == NULL || p == NULL) - { - return; - } - - Zero(p, sizeof(POLICY)); - - // Ver 2 - p->Access = CfgGetBool(f, "Access"); - p->DHCPFilter = CfgGetBool(f, "DHCPFilter"); - p->DHCPNoServer = CfgGetBool(f, "DHCPNoServer"); - p->DHCPForce = CfgGetBool(f, "DHCPForce"); - p->NoBridge = CfgGetBool(f, "NoBridge"); - p->NoRouting = CfgGetBool(f, "NoRouting"); - p->CheckMac = CfgGetBool(f, "CheckMac"); - p->CheckIP = CfgGetBool(f, "CheckIP"); - p->ArpDhcpOnly = CfgGetBool(f, "ArpDhcpOnly"); - p->PrivacyFilter = CfgGetBool(f, "PrivacyFilter"); - p->NoServer = CfgGetBool(f, "NoServer"); - p->NoBroadcastLimiter = CfgGetBool(f, "NoBroadcastLimiter"); - p->MonitorPort = CfgGetBool(f, "MonitorPort"); - p->MaxConnection = CfgGetInt(f, "MaxConnection"); - p->TimeOut = CfgGetInt(f, "TimeOut"); - p->MaxMac = CfgGetInt(f, "MaxMac"); - p->MaxIP = CfgGetInt(f, "MaxIP"); - p->MaxUpload = CfgGetInt(f, "MaxUpload"); - p->MaxDownload = CfgGetInt(f, "MaxDownload"); - p->FixPassword = CfgGetBool(f, "FixPassword"); - p->MultiLogins = CfgGetInt(f, "MultiLogins"); - p->NoQoS = CfgGetBool(f, "NoQoS"); - - // Ver 3 - p->RSandRAFilter = CfgGetBool(f, "RSandRAFilter"); - p->RAFilter = CfgGetBool(f, "RAFilter"); - p->DHCPv6Filter = CfgGetBool(f, "DHCPv6Filter"); - p->DHCPv6NoServer = CfgGetBool(f, "DHCPv6NoServer"); - p->NoRoutingV6 = CfgGetBool(f, "NoRoutingV6"); - p->CheckIPv6 = CfgGetBool(f, "CheckIPv6"); - p->NoServerV6 = CfgGetBool(f, "NoServerV6"); - p->MaxIPv6 = CfgGetInt(f, "MaxIPv6"); - p->NoSavePassword = CfgGetBool(f, "NoSavePassword"); - p->AutoDisconnect = CfgGetInt(f, "AutoDisconnect"); - p->FilterIPv4 = CfgGetBool(f, "FilterIPv4"); - p->FilterIPv6 = CfgGetBool(f, "FilterIPv6"); - p->FilterNonIP = CfgGetBool(f, "FilterNonIP"); - p->NoIPv6DefaultRouterInRA = CfgGetBool(f, "NoIPv6DefaultRouterInRA"); - p->NoIPv6DefaultRouterInRAWhenIPv6 = CfgGetBool(f, "NoIPv6DefaultRouterInRAWhenIPv6"); - p->VLanId = CfgGetInt(f, "VLanId"); -} - -// Write the policy -void SiWritePolicyCfg(FOLDER *f, POLICY *p, bool cascade_mode) -{ - // Validate arguments - if (f == NULL || p == NULL) - { - return; - } - - // Ver 2.0 - if (cascade_mode == false) - { - CfgAddBool(f, "Access", p->Access); - } - - CfgAddBool(f, "DHCPFilter", p->DHCPFilter); - CfgAddBool(f, "DHCPNoServer", p->DHCPNoServer); - CfgAddBool(f, "DHCPForce", p->DHCPForce); - - if (cascade_mode == false) - { - CfgAddBool(f, "NoBridge", p->NoBridge); - CfgAddBool(f, "NoRouting", p->NoRouting); - } - - CfgAddBool(f, "CheckMac", p->CheckMac); - CfgAddBool(f, "CheckIP", p->CheckIP); - CfgAddBool(f, "ArpDhcpOnly", p->ArpDhcpOnly); - - if (cascade_mode == false) - { - CfgAddBool(f, "PrivacyFilter", p->PrivacyFilter); - } - - CfgAddBool(f, "NoServer", p->NoServer); - CfgAddBool(f, "NoBroadcastLimiter", p->NoBroadcastLimiter); - - if (cascade_mode == false) - { - CfgAddBool(f, "MonitorPort", p->MonitorPort); - CfgAddInt(f, "MaxConnection", p->MaxConnection); - CfgAddInt(f, "TimeOut", p->TimeOut); - } - - CfgAddInt(f, "MaxMac", p->MaxMac); - CfgAddInt(f, "MaxIP", p->MaxIP); - CfgAddInt(f, "MaxUpload", p->MaxUpload); - CfgAddInt(f, "MaxDownload", p->MaxDownload); - - if (cascade_mode == false) - { - CfgAddBool(f, "FixPassword", p->FixPassword); - CfgAddInt(f, "MultiLogins", p->MultiLogins); - CfgAddBool(f, "NoQoS", p->NoQoS); - } - - // Ver 3.0 - CfgAddBool(f, "RSandRAFilter", p->RSandRAFilter); - CfgAddBool(f, "RAFilter", p->RAFilter); - CfgAddBool(f, "DHCPv6Filter", p->DHCPv6Filter); - CfgAddBool(f, "DHCPv6NoServer", p->DHCPv6NoServer); - - if (cascade_mode == false) - { - CfgAddBool(f, "NoRoutingV6", p->NoRoutingV6); - } - - CfgAddBool(f, "CheckIPv6", p->CheckIPv6); - CfgAddBool(f, "NoServerV6", p->NoServerV6); - CfgAddInt(f, "MaxIPv6", p->MaxIPv6); - - if (cascade_mode == false) - { - CfgAddBool(f, "NoSavePassword", p->NoSavePassword); - CfgAddInt(f, "AutoDisconnect", p->AutoDisconnect); - } - - CfgAddBool(f, "FilterIPv4", p->FilterIPv4); - CfgAddBool(f, "FilterIPv6", p->FilterIPv6); - CfgAddBool(f, "FilterNonIP", p->FilterNonIP); - CfgAddBool(f, "NoIPv6DefaultRouterInRA", p->NoIPv6DefaultRouterInRA); - CfgAddBool(f, "NoIPv6DefaultRouterInRAWhenIPv6", p->NoIPv6DefaultRouterInRAWhenIPv6); - CfgAddInt(f, "VLanId", p->VLanId); -} - -// Write the link information of the Virtual HUB -void SiWriteHubLinkCfg(FOLDER *f, LINK *k) -{ - // Validate arguments - if (f == NULL || k == NULL) - { - return; - } - - Lock(k->lock); - { - // Online - CfgAddBool(f, "Online", k->Offline ? false : true); - - // Client options - CiWriteClientOption(CfgCreateFolder(f, "ClientOption"), k->Option); - - // Client authentication data - CiWriteClientAuth(CfgCreateFolder(f, "ClientAuth"), k->Auth); - - // Policy - if (k->Policy != NULL) - { - SiWritePolicyCfg(CfgCreateFolder(f, "Policy"), k->Policy, true); - } - - CfgAddBool(f, "CheckServerCert", k->CheckServerCert); - - if (k->ServerCert != NULL) - { - BUF *b = XToBuf(k->ServerCert, false); - CfgAddBuf(f, "ServerCert", b); - FreeBuf(b); - } - } - Unlock(k->lock); -} - -// Read the link information -void SiLoadHubLinkCfg(FOLDER *f, HUB *h) -{ - bool online; - CLIENT_OPTION *o; - CLIENT_AUTH *a; - FOLDER *pf; - POLICY p; - LINK *k; - // Validate arguments - if (f == NULL || h == NULL) - { - return; - } - - pf = CfgGetFolder(f, "Policy"); - if (pf == NULL) - { - return; - } - - SiLoadPolicyCfg(&p, pf); - - online = CfgGetBool(f, "Online"); - - o = CiLoadClientOption(CfgGetFolder(f, "ClientOption")); - a = CiLoadClientAuth(CfgGetFolder(f, "ClientAuth")); - if (o == NULL || a == NULL) - { - Free(o); - CiFreeClientAuth(a); - return; - } - - k = NewLink(h->Cedar, h, o, a, &p); - if (k != NULL) - { - BUF *b; - k->CheckServerCert = CfgGetBool(f, "CheckServerCert"); - b = CfgGetBuf(f, "ServerCert"); - if (b != NULL) - { - k->ServerCert = BufToX(b, false); - FreeBuf(b); - } - - if (online) - { - k->Offline = true; - SetLinkOnline(k); - } - else - { - k->Offline = false; - SetLinkOffline(k); - } - ReleaseLink(k); - } - - Free(o); - CiFreeClientAuth(a); -} - -// Write the SecureNAT of the Virtual HUB -void SiWriteSecureNAT(HUB *h, FOLDER *f) -{ - // Validate arguments - if (h == NULL || f == NULL) - { - return; - } - - CfgAddBool(f, "Disabled", h->EnableSecureNAT ? false : true); - - NiWriteVhOptionEx(h->SecureNATOption, f); -} - -// Read the administration options for the virtual HUB -void SiLoadHubAdminOptions(HUB *h, FOLDER *f) -{ - TOKEN_LIST *t; - // Validate arguments - if (h == NULL || f == NULL) - { - return; - } - - t = CfgEnumItemToTokenList(f); - if (t != NULL) - { - UINT i; - - LockList(h->AdminOptionList); - { - DeleteAllHubAdminOption(h, false); - - for (i = 0;i < t->NumTokens;i++) - { - char *name = t->Token[i]; - ADMIN_OPTION *a; - UINT value = CfgGetInt(f, name);; - - Trim(name); - - a = ZeroMalloc(sizeof(ADMIN_OPTION)); - StrCpy(a->Name, sizeof(a->Name), name); - a->Value = value; - - Insert(h->AdminOptionList, a); - } - - AddHubAdminOptionsDefaults(h, false); - } - UnlockList(h->AdminOptionList); - - FreeToken(t); - } -} - -// Write the administration options for the virtual HUB -void SiWriteHubAdminOptions(FOLDER *f, HUB *h) -{ - // Validate arguments - if (f == NULL || h == NULL) - { - return; - } - - LockList(h->AdminOptionList); - { - UINT i; - for (i = 0;i < LIST_NUM(h->AdminOptionList);i++) - { - ADMIN_OPTION *a = LIST_DATA(h->AdminOptionList, i); - - CfgAddInt(f, a->Name, a->Value); - } - } - UnlockList(h->AdminOptionList); -} - -// Write the link list of the Virtual HUB -void SiWriteHubLinks(FOLDER *f, HUB *h) -{ - // Validate arguments - if (f == NULL || h == NULL) - { - return; - } - - LockList(h->LinkList); - { - UINT i; - for (i = 0;i < LIST_NUM(h->LinkList);i++) - { - LINK *k = LIST_DATA(h->LinkList, i); - char name[MAX_SIZE]; - Format(name, sizeof(name), "Cascade%u", i); - SiWriteHubLinkCfg(CfgCreateFolder(f, name), k); - } - } - UnlockList(h->LinkList); -} - -// Read the link list -void SiLoadHubLinks(HUB *h, FOLDER *f) -{ - TOKEN_LIST *t; - UINT i; - // Validate arguments - if (h == NULL || f == NULL) - { - return; - } - - t = CfgEnumFolderToTokenList(f); - - for (i = 0;i < t->NumTokens;i++) - { - char *name = t->Token[i]; - SiLoadHubLinkCfg(CfgGetFolder(f, name), h); - } - - FreeToken(t); -} - -// Write an item of the access list -void SiWriteHubAccessCfg(FOLDER *f, ACCESS *a) -{ - // Validate arguments - if (f == NULL || a == NULL) - { - return; - } - - CfgAddUniStr(f, "Note", a->Note); - CfgAddBool(f, "Active", a->Active); - CfgAddInt(f, "Priority", a->Priority); - CfgAddBool(f, "Discard", a->Discard); - CfgAddBool(f, "IsIPv6", a->IsIPv6); - - if (a->IsIPv6 == false) - { - CfgAddIp32(f, "SrcIpAddress", a->SrcIpAddress); - CfgAddIp32(f, "SrcSubnetMask", a->SrcSubnetMask); - CfgAddIp32(f, "DestIpAddress", a->DestIpAddress); - CfgAddIp32(f, "DestSubnetMask", a->DestSubnetMask); - } - else - { - CfgAddIp6Addr(f, "SrcIpAddress6", &a->SrcIpAddress6); - CfgAddIp6Addr(f, "SrcSubnetMask6", &a->SrcSubnetMask6); - CfgAddIp6Addr(f, "DestIpAddress6", &a->DestIpAddress6); - CfgAddIp6Addr(f, "DestSubnetMask6", &a->DestSubnetMask6); - } - - CfgAddInt(f, "Protocol", a->Protocol); - CfgAddInt(f, "SrcPortStart", a->SrcPortStart); - CfgAddInt(f, "SrcPortEnd", a->SrcPortEnd); - CfgAddInt(f, "DestPortStart", a->DestPortStart); - CfgAddInt(f, "DestPortEnd", a->DestPortEnd); - CfgAddStr(f, "SrcUsername", a->SrcUsername); - CfgAddStr(f, "DestUsername", a->DestUsername); - CfgAddBool(f, "CheckSrcMac", a->CheckSrcMac); - - if (a->CheckSrcMac) - { - char tmp[MAX_PATH]; - - MacToStr(tmp, sizeof(tmp), a->SrcMacAddress); - CfgAddStr(f, "SrcMacAddress", tmp); - - MacToStr(tmp, sizeof(tmp), a->SrcMacMask); - CfgAddStr(f, "SrcMacMask", tmp); - } - - CfgAddBool(f, "CheckDstMac", a->CheckDstMac); - - if (a->CheckDstMac) - { - char tmp[MAX_PATH]; - - MacToStr(tmp, sizeof(tmp), a->DstMacAddress); - CfgAddStr(f, "DstMacAddress", tmp); - - MacToStr(tmp, sizeof(tmp), a->DstMacMask); - CfgAddStr(f, "DstMacMask", tmp); - } - - CfgAddBool(f, "CheckTcpState", a->CheckTcpState); - CfgAddBool(f, "Established", a->Established); - - CfgAddStr(f, "RedirectUrl", a->RedirectUrl); - - CfgAddInt(f, "Delay", a->Delay); - CfgAddInt(f, "Jitter", a->Jitter); - CfgAddInt(f, "Loss", a->Loss); -} - -// Read an item of the access list -void SiLoadHubAccessCfg(HUB *h, FOLDER *f) -{ - ACCESS a; - char tmp[MAX_PATH]; - // Validate arguments - if (h == NULL || f == NULL) - { - return; - } - - Zero(&a, sizeof(a)); - - CfgGetUniStr(f, "Note", a.Note, sizeof(a.Note)); - a.Active = CfgGetBool(f, "Active"); - a.Priority = CfgGetInt(f, "Priority"); - a.Discard = CfgGetBool(f, "Discard"); - a.IsIPv6 = CfgGetBool(f, "IsIPv6"); - - if (a.IsIPv6 == false) - { - a.SrcIpAddress = CfgGetIp32(f, "SrcIpAddress"); - a.SrcSubnetMask = CfgGetIp32(f, "SrcSubnetMask"); - a.DestIpAddress = CfgGetIp32(f, "DestIpAddress"); - a.DestSubnetMask = CfgGetIp32(f, "DestSubnetMask"); - } - else - { - CfgGetIp6Addr(f, "SrcIpAddress6", &a.SrcIpAddress6); - CfgGetIp6Addr(f, "SrcSubnetMask6", &a.SrcSubnetMask6); - CfgGetIp6Addr(f, "DestIpAddress6", &a.DestIpAddress6); - CfgGetIp6Addr(f, "DestSubnetMask6", &a.DestSubnetMask6); - } - - a.Protocol = CfgGetInt(f, "Protocol"); - a.SrcPortStart = CfgGetInt(f, "SrcPortStart"); - a.SrcPortEnd = CfgGetInt(f, "SrcPortEnd"); - a.DestPortStart = CfgGetInt(f, "DestPortStart"); - a.DestPortEnd = CfgGetInt(f, "DestPortEnd"); - CfgGetStr(f, "SrcUsername", a.SrcUsername, sizeof(a.SrcUsername)); - CfgGetStr(f, "DestUsername", a.DestUsername, sizeof(a.DestUsername)); - a.CheckSrcMac = CfgGetBool(f, "CheckSrcMac"); - - if (CfgGetByte(f, "SrcMacAddress", a.SrcMacAddress, sizeof(a.SrcMacAddress)) == 0) - { - CfgGetStr(f, "SrcMacAddress", tmp, sizeof(tmp)); - if (StrToMac(a.SrcMacAddress, tmp) == false) - { - a.CheckSrcMac = false; - } - } - - if (CfgGetByte(f, "SrcMacMask", a.SrcMacMask, sizeof(a.SrcMacMask)) == 0) - { - CfgGetStr(f, "SrcMacMask", tmp, sizeof(tmp)); - if (StrToMac(a.SrcMacMask, tmp) == false) - { - a.CheckSrcMac = false; - } - } - - a.CheckDstMac = CfgGetBool(f, "CheckDstMac"); - - if (CfgGetByte(f, "DstMacAddress", a.DstMacAddress, sizeof(a.DstMacAddress)) == 0) - { - CfgGetStr(f, "DstMacAddress", tmp, sizeof(tmp)); - if (StrToMac(a.DstMacAddress, tmp) == false) - { - a.CheckDstMac = false; - } - } - - if (CfgGetByte(f, "DstMacMask", a.DstMacMask, sizeof(a.DstMacMask)) == 0) - { - CfgGetStr(f, "DstMacMask", tmp, sizeof(tmp)); - if (StrToMac(a.DstMacMask, tmp) == false) - { - a.CheckDstMac = false; - } - } - - a.CheckTcpState = CfgGetBool(f, "CheckTcpState"); - a.Established = CfgGetBool(f, "Established"); - a.Delay = MAKESURE(CfgGetInt(f, "Delay"), 0, HUB_ACCESSLIST_DELAY_MAX); - a.Jitter = MAKESURE(CfgGetInt(f, "Jitter"), 0, HUB_ACCESSLIST_JITTER_MAX); - a.Loss = MAKESURE(CfgGetInt(f, "Loss"), 0, HUB_ACCESSLIST_LOSS_MAX); - - CfgGetStr(f, "RedirectUrl", a.RedirectUrl, sizeof(a.RedirectUrl)); - - AddAccessList(h, &a); -} - -// Write the access list -void SiWriteHubAccessLists(FOLDER *f, HUB *h) -{ - // Validate arguments - if (f == NULL || h == NULL) - { - return; - } - - LockList(h->AccessList); - { - UINT i; - for (i = 0;i < LIST_NUM(h->AccessList);i++) - { - ACCESS *a = LIST_DATA(h->AccessList, i); - char name[MAX_SIZE]; - ToStr(name, a->Id); - SiWriteHubAccessCfg(CfgCreateFolder(f, name), a); - } - } - UnlockList(h->AccessList); -} - -// Read the access list -void SiLoadHubAccessLists(HUB *h, FOLDER *f) -{ - TOKEN_LIST *t; - UINT i; - // Validate arguments - if (f == NULL || h == NULL) - { - return; - } - - t = CfgEnumFolderToTokenList(f); - - for (i = 0;i < t->NumTokens;i++) - { - char *name = t->Token[i]; - SiLoadHubAccessCfg(h, CfgGetFolder(f, name)); - } - - FreeToken(t); -} - -// Read the HUB_OPTION -void SiLoadHubOptionCfg(FOLDER *f, HUB_OPTION *o) -{ - char tmp[MAX_SIZE]; - // Validate arguments - if (f == NULL || o == NULL) - { - return; - } - - o->MaxSession = CfgGetInt(f, "MaxSession"); - o->NoArpPolling = CfgGetBool(f, "NoArpPolling"); - o->NoIPv6AddrPolling = CfgGetBool(f, "NoIPv6AddrPolling"); - o->NoIpTable = CfgGetBool(f, "NoIpTable"); - o->NoEnum = CfgGetBool(f, "NoEnum"); - o->FilterPPPoE = CfgGetBool(f, "FilterPPPoE"); - o->FilterOSPF = CfgGetBool(f, "FilterOSPF"); - o->FilterIPv4 = CfgGetBool(f, "FilterIPv4"); - o->FilterIPv6 = CfgGetBool(f, "FilterIPv6"); - o->FilterNonIP = CfgGetBool(f, "FilterNonIP"); - o->FilterBPDU = CfgGetBool(f, "FilterBPDU"); - o->NoIPv4PacketLog = CfgGetBool(f, "NoIPv4PacketLog"); - o->NoIPv6PacketLog = CfgGetBool(f, "NoIPv6PacketLog"); - o->NoIPv6DefaultRouterInRAWhenIPv6 = CfgGetBool(f, "NoIPv6DefaultRouterInRAWhenIPv6"); - o->DisableIPParsing = CfgGetBool(f, "DisableIPParsing"); - o->YieldAfterStorePacket = CfgGetBool(f, "YieldAfterStorePacket"); - o->NoSpinLockForPacketDelay = CfgGetBool(f, "NoSpinLockForPacketDelay"); - o->BroadcastStormDetectionThreshold = CfgGetInt(f, "BroadcastStormDetectionThreshold"); - o->ClientMinimumRequiredBuild = CfgGetInt(f, "ClientMinimumRequiredBuild"); - o->RequiredClientId = CfgGetInt(f, "RequiredClientId"); - o->NoManageVlanId = CfgGetBool(f, "NoManageVlanId"); - o->VlanTypeId = 0; - if (CfgGetStr(f, "VlanTypeId", tmp, sizeof(tmp))) - { - o->VlanTypeId = HexToInt(tmp); - } - if (o->VlanTypeId == 0) - { - o->VlanTypeId = MAC_PROTO_TAGVLAN; - } - o->FixForDLinkBPDU = CfgGetBool(f, "FixForDLinkBPDU"); - o->BroadcastLimiterStrictMode = CfgGetBool(f, "BroadcastLimiterStrictMode"); - o->MaxLoggedPacketsPerMinute = CfgGetInt(f, "MaxLoggedPacketsPerMinute"); - if (CfgIsItem(f, "FloodingSendQueueBufferQuota")) - { - o->FloodingSendQueueBufferQuota = CfgGetInt(f, "FloodingSendQueueBufferQuota"); - } - else - { - o->FloodingSendQueueBufferQuota = DEFAULT_FLOODING_QUEUE_LENGTH; - } - o->DoNotSaveHeavySecurityLogs = CfgGetBool(f, "DoNotSaveHeavySecurityLogs"); - - if (CfgIsItem(f, "DropBroadcastsInPrivacyFilterMode")) - { - o->DropBroadcastsInPrivacyFilterMode = CfgGetBool(f, "DropBroadcastsInPrivacyFilterMode"); - } - else - { - o->DropBroadcastsInPrivacyFilterMode = true; - } - - if (CfgIsItem(f, "DropArpInPrivacyFilterMode")) - { - o->DropArpInPrivacyFilterMode = CfgGetBool(f, "DropArpInPrivacyFilterMode"); - } - else - { - o->DropArpInPrivacyFilterMode = true; - } - - o->NoLookBPDUBridgeId = CfgGetBool(f, "NoLookBPDUBridgeId"); - o->AdjustTcpMssValue = CfgGetInt(f, "AdjustTcpMssValue"); - o->DisableAdjustTcpMss = CfgGetBool(f, "DisableAdjustTcpMss"); - if (CfgIsItem(f, "NoDhcpPacketLogOutsideHub")) - { - o->NoDhcpPacketLogOutsideHub = CfgGetBool(f, "NoDhcpPacketLogOutsideHub"); - } - else - { - o->NoDhcpPacketLogOutsideHub = true; - } - o->DisableHttpParsing = CfgGetBool(f, "DisableHttpParsing"); - o->DisableUdpAcceleration = CfgGetBool(f, "DisableUdpAcceleration"); - o->DisableUdpFilterForLocalBridgeNic = CfgGetBool(f, "DisableUdpFilterForLocalBridgeNic"); - o->ApplyIPv4AccessListOnArpPacket = CfgGetBool(f, "ApplyIPv4AccessListOnArpPacket"); - if (CfgIsItem(f, "RemoveDefGwOnDhcpForLocalhost")) - { - o->RemoveDefGwOnDhcpForLocalhost = CfgGetBool(f, "RemoveDefGwOnDhcpForLocalhost"); - } - else - { - o->RemoveDefGwOnDhcpForLocalhost = true; - } - o->SecureNAT_MaxTcpSessionsPerIp = CfgGetInt(f, "SecureNAT_MaxTcpSessionsPerIp"); - o->SecureNAT_MaxTcpSynSentPerIp = CfgGetInt(f, "SecureNAT_MaxTcpSynSentPerIp"); - o->SecureNAT_MaxUdpSessionsPerIp = CfgGetInt(f, "SecureNAT_MaxUdpSessionsPerIp"); - o->SecureNAT_MaxDnsSessionsPerIp = CfgGetInt(f, "SecureNAT_MaxDnsSessionsPerIp"); - o->SecureNAT_MaxIcmpSessionsPerIp = CfgGetInt(f, "SecureNAT_MaxIcmpSessionsPerIp"); - o->AccessListIncludeFileCacheLifetime = CfgGetInt(f, "AccessListIncludeFileCacheLifetime"); - - if (o->AccessListIncludeFileCacheLifetime == 0) - { - o->AccessListIncludeFileCacheLifetime = ACCESS_LIST_INCLUDE_FILE_CACHE_LIFETIME; - } - - o->DisableKernelModeSecureNAT = CfgGetBool(f, "DisableKernelModeSecureNAT"); - o->DisableIpRawModeSecureNAT = CfgGetBool(f, "DisableIpRawModeSecureNAT"); - o->DisableUserModeSecureNAT = CfgGetBool(f, "DisableUserModeSecureNAT"); - o->DisableCheckMacOnLocalBridge = CfgGetBool(f, "DisableCheckMacOnLocalBridge"); - o->DisableCorrectIpOffloadChecksum = CfgGetBool(f, "DisableCorrectIpOffloadChecksum"); - o->SuppressClientUpdateNotification = CfgGetBool(f, "SuppressClientUpdateNotification"); - o->AssignVLanIdByRadiusAttribute = CfgGetBool(f, "AssignVLanIdByRadiusAttribute"); - o->DenyAllRadiusLoginWithNoVlanAssign = CfgGetBool(f, "DenyAllRadiusLoginWithNoVlanAssign"); - o->SecureNAT_RandomizeAssignIp = CfgGetBool(f, "SecureNAT_RandomizeAssignIp"); - o->DetectDormantSessionInterval = CfgGetInt(f, "DetectDormantSessionInterval"); - o->NoPhysicalIPOnPacketLog = CfgGetBool(f, "NoPhysicalIPOnPacketLog"); - o->UseHubNameAsDhcpUserClassOption = CfgGetBool(f, "UseHubNameAsDhcpUserClassOption"); - o->UseHubNameAsRadiusNasId = CfgGetBool(f, "UseHubNameAsRadiusNasId"); - - // Enabled by default - if (CfgIsItem(f, "ManageOnlyPrivateIP")) - { - o->ManageOnlyPrivateIP = CfgGetBool(f, "ManageOnlyPrivateIP"); - } - else - { - o->ManageOnlyPrivateIP = true; - } - if (CfgIsItem(f, "ManageOnlyLocalUnicastIPv6")) - { - o->ManageOnlyLocalUnicastIPv6 = CfgGetBool(f, "ManageOnlyLocalUnicastIPv6"); - } - else - { - o->ManageOnlyLocalUnicastIPv6 = true; - } - if (CfgIsItem(f, "NoMacAddressLog")) - { - o->NoMacAddressLog = CfgGetBool(f, "NoMacAddressLog"); - } - else - { - o->NoMacAddressLog = true; - } -} - -// Write the HUB_OPTION -void SiWriteHubOptionCfg(FOLDER *f, HUB_OPTION *o) -{ - char tmp[MAX_SIZE]; - // Validate arguments - if (f == NULL || o == NULL) - { - return; - } - - CfgAddInt(f, "MaxSession", o->MaxSession); - CfgAddBool(f, "NoArpPolling", o->NoArpPolling); - CfgAddBool(f, "NoIPv6AddrPolling", o->NoIPv6AddrPolling); - CfgAddBool(f, "NoIpTable", o->NoIpTable); - CfgAddBool(f, "NoEnum", o->NoEnum); - CfgAddBool(f, "FilterPPPoE", o->FilterPPPoE); - CfgAddBool(f, "FilterOSPF", o->FilterOSPF); - CfgAddBool(f, "FilterIPv4", o->FilterIPv4); - CfgAddBool(f, "FilterIPv6", o->FilterIPv6); - CfgAddBool(f, "FilterNonIP", o->FilterNonIP); - CfgAddBool(f, "NoIPv4PacketLog", o->NoIPv4PacketLog); - CfgAddBool(f, "NoIPv6PacketLog", o->NoIPv6PacketLog); - CfgAddBool(f, "FilterBPDU", o->FilterBPDU); - CfgAddBool(f, "NoIPv6DefaultRouterInRAWhenIPv6", o->NoIPv6DefaultRouterInRAWhenIPv6); - CfgAddBool(f, "NoMacAddressLog", o->NoMacAddressLog); - CfgAddBool(f, "ManageOnlyPrivateIP", o->ManageOnlyPrivateIP); - CfgAddBool(f, "ManageOnlyLocalUnicastIPv6", o->ManageOnlyLocalUnicastIPv6); - CfgAddBool(f, "DisableIPParsing", o->DisableIPParsing); - CfgAddBool(f, "YieldAfterStorePacket", o->YieldAfterStorePacket); - CfgAddBool(f, "NoSpinLockForPacketDelay", o->NoSpinLockForPacketDelay); - CfgAddInt(f, "BroadcastStormDetectionThreshold", o->BroadcastStormDetectionThreshold); - CfgAddInt(f, "ClientMinimumRequiredBuild", o->ClientMinimumRequiredBuild); - CfgAddInt(f, "RequiredClientId", o->RequiredClientId); - CfgAddBool(f, "NoManageVlanId", o->NoManageVlanId); - Format(tmp, sizeof(tmp), "0x%x", o->VlanTypeId); - CfgAddStr(f, "VlanTypeId", tmp); - if (o->FixForDLinkBPDU) - { - CfgAddBool(f, "FixForDLinkBPDU", o->FixForDLinkBPDU); - } - CfgAddBool(f, "BroadcastLimiterStrictMode", o->BroadcastLimiterStrictMode); - CfgAddInt(f, "MaxLoggedPacketsPerMinute", o->MaxLoggedPacketsPerMinute); - CfgAddInt(f, "FloodingSendQueueBufferQuota", o->FloodingSendQueueBufferQuota); - CfgAddBool(f, "DoNotSaveHeavySecurityLogs", o->DoNotSaveHeavySecurityLogs); - CfgAddBool(f, "DropBroadcastsInPrivacyFilterMode", o->DropBroadcastsInPrivacyFilterMode); - CfgAddBool(f, "DropArpInPrivacyFilterMode", o->DropArpInPrivacyFilterMode); - CfgAddBool(f, "SuppressClientUpdateNotification", o->SuppressClientUpdateNotification); - CfgAddBool(f, "AssignVLanIdByRadiusAttribute", o->AssignVLanIdByRadiusAttribute); - CfgAddBool(f, "DenyAllRadiusLoginWithNoVlanAssign", o->DenyAllRadiusLoginWithNoVlanAssign); - CfgAddBool(f, "SecureNAT_RandomizeAssignIp", o->SecureNAT_RandomizeAssignIp); - CfgAddBool(f, "NoPhysicalIPOnPacketLog", o->NoPhysicalIPOnPacketLog); - CfgAddInt(f, "DetectDormantSessionInterval", o->DetectDormantSessionInterval); - CfgAddBool(f, "NoLookBPDUBridgeId", o->NoLookBPDUBridgeId); - CfgAddInt(f, "AdjustTcpMssValue", o->AdjustTcpMssValue); - CfgAddBool(f, "DisableAdjustTcpMss", o->DisableAdjustTcpMss); - CfgAddBool(f, "NoDhcpPacketLogOutsideHub", o->NoDhcpPacketLogOutsideHub); - CfgAddBool(f, "DisableHttpParsing", o->DisableHttpParsing); - CfgAddBool(f, "DisableUdpAcceleration", o->DisableUdpAcceleration); - CfgAddBool(f, "DisableUdpFilterForLocalBridgeNic", o->DisableUdpFilterForLocalBridgeNic); - CfgAddBool(f, "ApplyIPv4AccessListOnArpPacket", o->ApplyIPv4AccessListOnArpPacket); - CfgAddBool(f, "RemoveDefGwOnDhcpForLocalhost", o->RemoveDefGwOnDhcpForLocalhost); - CfgAddInt(f, "SecureNAT_MaxTcpSessionsPerIp", o->SecureNAT_MaxTcpSessionsPerIp); - CfgAddInt(f, "SecureNAT_MaxTcpSynSentPerIp", o->SecureNAT_MaxTcpSynSentPerIp); - CfgAddInt(f, "SecureNAT_MaxUdpSessionsPerIp", o->SecureNAT_MaxUdpSessionsPerIp); - CfgAddInt(f, "SecureNAT_MaxDnsSessionsPerIp", o->SecureNAT_MaxDnsSessionsPerIp); - CfgAddInt(f, "SecureNAT_MaxIcmpSessionsPerIp", o->SecureNAT_MaxIcmpSessionsPerIp); - CfgAddInt(f, "AccessListIncludeFileCacheLifetime", o->AccessListIncludeFileCacheLifetime); - CfgAddBool(f, "DisableKernelModeSecureNAT", o->DisableKernelModeSecureNAT); - CfgAddBool(f, "DisableIpRawModeSecureNAT", o->DisableIpRawModeSecureNAT); - CfgAddBool(f, "DisableUserModeSecureNAT", o->DisableUserModeSecureNAT); - CfgAddBool(f, "DisableCheckMacOnLocalBridge", o->DisableCheckMacOnLocalBridge); - CfgAddBool(f, "DisableCorrectIpOffloadChecksum", o->DisableCorrectIpOffloadChecksum); - CfgAddBool(f, "UseHubNameAsDhcpUserClassOption", o->UseHubNameAsDhcpUserClassOption); - CfgAddBool(f, "UseHubNameAsRadiusNasId", o->UseHubNameAsRadiusNasId); -} - -// Write the user -void SiWriteUserCfg(FOLDER *f, USER *u) -{ - BUF *b; - AUTHPASSWORD *password; - AUTHRADIUS *radius; - AUTHNT *nt; - AUTHUSERCERT *usercert; - AUTHROOTCERT *rootcert; - // Validate arguments - if (f == NULL || u == NULL) - { - return; - } - - Lock(u->lock); - { - CfgAddUniStr(f, "RealName", u->RealName); - CfgAddUniStr(f, "Note", u->Note); - if (u->Group != NULL) - { - CfgAddStr(f, "GroupName", u->GroupName); - } - CfgAddInt64(f, "CreatedTime", u->CreatedTime); - CfgAddInt64(f, "UpdatedTime", u->UpdatedTime); - CfgAddInt64(f, "ExpireTime", u->ExpireTime); - CfgAddInt64(f, "LastLoginTime", u->LastLoginTime); - CfgAddInt(f, "NumLogin", u->NumLogin); - if (u->Policy != NULL) - { - SiWritePolicyCfg(CfgCreateFolder(f, "Policy"), u->Policy, false); - } - SiWriteTraffic(f, "Traffic", u->Traffic); - - CfgAddInt(f, "AuthType", u->AuthType); - if (u->AuthData != NULL) - { - switch (u->AuthType) - { - case AUTHTYPE_ANONYMOUS: - break; - - case AUTHTYPE_PASSWORD: - password = (AUTHPASSWORD *)u->AuthData; - CfgAddByte(f, "AuthPassword", password->HashedKey, sizeof(password->HashedKey)); - - if (IsZero(password->NtLmSecureHash, sizeof(password->NtLmSecureHash)) == false) - { - CfgAddByte(f, "AuthNtLmSecureHash", password->NtLmSecureHash, sizeof(password->NtLmSecureHash)); - } - break; - - case AUTHTYPE_NT: - nt = (AUTHNT *)u->AuthData; - CfgAddUniStr(f, "AuthNtUserName", nt->NtUsername); - break; - - case AUTHTYPE_RADIUS: - radius = (AUTHRADIUS *)u->AuthData; - CfgAddUniStr(f, "AuthRadiusUsername", radius->RadiusUsername); - break; - - case AUTHTYPE_USERCERT: - usercert = (AUTHUSERCERT *)u->AuthData; - b = XToBuf(usercert->UserX, false); - if (b != NULL) - { - CfgAddBuf(f, "AuthUserCert", b); - FreeBuf(b); - } - break; - - case AUTHTYPE_ROOTCERT: - rootcert = (AUTHROOTCERT *)u->AuthData; - if (rootcert->Serial != NULL && rootcert->Serial->size >= 1) - { - CfgAddByte(f, "AuthSerial", rootcert->Serial->data, rootcert->Serial->size); - } - if (rootcert->CommonName != NULL && UniIsEmptyStr(rootcert->CommonName) == false) - { - CfgAddUniStr(f, "AuthCommonName", rootcert->CommonName); - } - break; - } - } - } - Unlock(u->lock); -} - -// Read an user -void SiLoadUserCfg(HUB *h, FOLDER *f) -{ - char *username; - wchar_t realname[MAX_SIZE]; - wchar_t note[MAX_SIZE]; - char groupname[MAX_SIZE]; - FOLDER *pf; - UINT64 created_time; - UINT64 updated_time; - UINT64 expire_time; - UINT64 last_login_time; - UINT num_login; - POLICY p; - TRAFFIC t; - BUF *b; - UINT authtype; - void *authdata; - X_SERIAL *serial = NULL; - wchar_t common_name[MAX_SIZE]; - UCHAR hashed_password[SHA1_SIZE]; - UCHAR md4_password[MD5_SIZE]; - wchar_t tmp[MAX_SIZE]; - USER *u; - USERGROUP *g; - // Validate arguments - if (h == NULL || f == NULL) - { - return; - } - - username = f->Name; - CfgGetUniStr(f, "RealName", realname, sizeof(realname)); - CfgGetUniStr(f, "Note", note, sizeof(note)); - CfgGetStr(f, "GroupName", groupname, sizeof(groupname)); - - created_time = CfgGetInt64(f, "CreatedTime"); - updated_time = CfgGetInt64(f, "UpdatedTime"); - expire_time = CfgGetInt64(f, "ExpireTime"); - last_login_time = CfgGetInt64(f, "LastLoginTime"); - num_login = CfgGetInt(f, "NumLogin"); - pf = CfgGetFolder(f, "Policy"); - if (pf != NULL) - { - SiLoadPolicyCfg(&p, pf); - } - SiLoadTraffic(f, "Traffic", &t); - - authtype = CfgGetInt(f, "AuthType"); - authdata = NULL; - - switch (authtype) - { - case AUTHTYPE_PASSWORD: - Zero(hashed_password, sizeof(hashed_password)); - Zero(md4_password, sizeof(md4_password)); - CfgGetByte(f, "AuthPassword", hashed_password, sizeof(hashed_password)); - CfgGetByte(f, "AuthNtLmSecureHash", md4_password, sizeof(md4_password)); - authdata = NewPasswordAuthDataRaw(hashed_password, md4_password); - break; - - case AUTHTYPE_NT: - if (CfgGetUniStr(f, "AuthNtUserName", tmp, sizeof(tmp))) - { - authdata = NewNTAuthData(tmp); - } - else - { - authdata = NewNTAuthData(NULL); - } - break; - - case AUTHTYPE_RADIUS: - if (CfgGetUniStr(f, "AuthRadiusUsername", tmp, sizeof(tmp))) - { - authdata = NewRadiusAuthData(tmp); - } - else - { - authdata = NewRadiusAuthData(NULL); - } - break; - - case AUTHTYPE_USERCERT: - b = CfgGetBuf(f, "AuthUserCert"); - if (b != NULL) - { - X *x = BufToX(b, false); - if (x != NULL) - { - authdata = NewUserCertAuthData(x); - FreeX(x); - } - FreeBuf(b); - } - break; - - case AUTHTYPE_ROOTCERT: - b = CfgGetBuf(f, "AuthSerial"); - if (b != NULL) - { - serial = NewXSerial(b->Buf, b->Size); - FreeBuf(b); - } - CfgGetUniStr(f, "AuthCommonName", common_name, sizeof(common_name)); - authdata = NewRootCertAuthData(serial, common_name); - break; - } - - // Add an user - AcLock(h); - { - if (StrLen(groupname) > 0) - { - g = AcGetGroup(h, groupname); - } - else - { - g = NULL; - } - - u = NewUser(username, realname, note, authtype, authdata); - if (u != NULL) - { - if (g != NULL) - { - JoinUserToGroup(u, g); - } - - SetUserTraffic(u, &t); - - if (pf != NULL) - { - SetUserPolicy(u, &p); - } - - Lock(u->lock); - { - u->CreatedTime = created_time; - u->UpdatedTime = updated_time; - u->ExpireTime = expire_time; - u->LastLoginTime = last_login_time; - u->NumLogin = num_login; - } - Unlock(u->lock); - - AcAddUser(h, u); - - ReleaseUser(u); - } - - if (g != NULL) - { - ReleaseGroup(g); - } - } - AcUnlock(h); - - if (serial != NULL) - { - FreeXSerial(serial); - } -} - -// Write the user list -void SiWriteUserList(FOLDER *f, LIST *o) -{ - // Validate arguments - if (f == NULL || o == NULL) - { - return; - } - - LockList(o); - { - UINT i; - for (i = 0;i < LIST_NUM(o);i++) - { - USER *u = LIST_DATA(o, i); - SiWriteUserCfg(CfgCreateFolder(f, u->Name), u); - } - } - UnlockList(o); -} - -// Read the user list -void SiLoadUserList(HUB *h, FOLDER *f) -{ - TOKEN_LIST *t; - UINT i; - char *name; - // Validate arguments - if (f == NULL || h == NULL) - { - return; - } - - t = CfgEnumFolderToTokenList(f); - - for (i = 0;i < t->NumTokens;i++) - { - FOLDER *ff; - name = t->Token[i]; - ff = CfgGetFolder(f, name); - SiLoadUserCfg(h, ff); - } - - FreeToken(t); -} - -// Write the group information -void SiWriteGroupCfg(FOLDER *f, USERGROUP *g) -{ - // Validate arguments - if (f == NULL || g == NULL) - { - return; - } - - Lock(g->lock); - { - CfgAddUniStr(f, "RealName", g->RealName); - CfgAddUniStr(f, "Note", g->Note); - if (g->Policy != NULL) - { - SiWritePolicyCfg(CfgCreateFolder(f, "Policy"), g->Policy, false); - } - SiWriteTraffic(f, "Traffic", g->Traffic); - } - Unlock(g->lock); -} - -// Read the group information -void SiLoadGroupCfg(HUB *h, FOLDER *f) -{ - wchar_t realname[MAX_SIZE]; - wchar_t note[MAX_SIZE]; - char *name; - FOLDER *pf; - POLICY p; - TRAFFIC t; - USERGROUP *g; - // Validate arguments - if (h == NULL || f == NULL) - { - return; - } - - name = f->Name; - - CfgGetUniStr(f, "RealName", realname, sizeof(realname)); - CfgGetUniStr(f, "Note", note, sizeof(note)); - - pf = CfgGetFolder(f, "Policy"); - if (pf != NULL) - { - SiLoadPolicyCfg(&p, pf); - } - - SiLoadTraffic(f, "Traffic", &t); - - g = NewGroup(name, realname, note); - if (g == NULL) - { - return; - } - - if (pf != NULL) - { - SetGroupPolicy(g, &p); - } - - SetGroupTraffic(g, &t); - - AcLock(h); - { - AcAddGroup(h, g); - } - AcUnlock(h); - - ReleaseGroup(g); -} - -// Write the group list -void SiWriteGroupList(FOLDER *f, LIST *o) -{ - // Validate arguments - if (f == NULL || o == NULL) - { - return; - } - - LockList(o); - { - UINT i; - for (i = 0;i < LIST_NUM(o);i++) - { - USERGROUP *g = LIST_DATA(o, i); - SiWriteGroupCfg(CfgCreateFolder(f, g->Name), g); - } - } - UnlockList(o); -} - -// Read the group List -void SiLoadGroupList(HUB *h, FOLDER *f) -{ - TOKEN_LIST *t; - UINT i; - char *name; - // Validate arguments - if (f == NULL || h == NULL) - { - return; - } - - t = CfgEnumFolderToTokenList(f); - - for (i = 0;i < t->NumTokens;i++) - { - name = t->Token[i]; - SiLoadGroupCfg(h, CfgGetFolder(f, name)); - } - - FreeToken(t); -} - -// Write the AC list -void SiWriteAcList(FOLDER *f, LIST *o) -{ - // Validate arguments - if (f == NULL || o == NULL) - { - return; - } - - LockList(o); - { - UINT i; - for (i = 0;i < LIST_NUM(o);i++) - { - char name[MAX_SIZE]; - AC *ac = LIST_DATA(o, i); - FOLDER *ff; - - Format(name, sizeof(name), "Acl%u", i + 1); - - ff = CfgCreateFolder(f, name); - - CfgAddBool(ff, "Deny", ac->Deny); - CfgAddInt(ff, "Priority", ac->Priority); - CfgAddIp(ff, "IpAddress", &ac->IpAddress); - - if (ac->Masked) - { - CfgAddIp(ff, "NetMask", &ac->SubnetMask); - } - } - } - UnlockList(o); -} - -// Read the AC list -void SiLoadAcList(LIST *o, FOLDER *f) -{ - // Validate arguments - if (o == NULL || f == NULL) - { - return; - } - - LockList(o); - { - TOKEN_LIST *t = CfgEnumFolderToTokenList(f); - - if (t != NULL) - { - UINT i; - - for (i = 0;i < t->NumTokens;i++) - { - FOLDER *ff = CfgGetFolder(f, t->Token[i]); - - if (ff != NULL) - { - AC ac; - - Zero(&ac, sizeof(ac)); - ac.Deny = CfgGetBool(ff, "Deny"); - ac.Priority = CfgGetInt(ff, "Priority"); - CfgGetIp(ff, "IpAddress", &ac.IpAddress); - - if (CfgGetIp(ff, "NetMask", &ac.SubnetMask)) - { - ac.Masked = true; - } - - AddAc(o, &ac); - } - } - - FreeToken(t); - } - } - UnlockList(o); -} - -// Write the certificate revocation list -void SiWriteCrlList(FOLDER *f, LIST *o) -{ - // Validate arguments - if (f == NULL || o == NULL) - { - return; - } - - LockList(o); - { - UINT i; - for (i = 0;i < LIST_NUM(o);i++) - { - char name[MAX_SIZE]; - CRL *crl = LIST_DATA(o, i); - FOLDER *ff; - NAME *n; - - Format(name, sizeof(name), "Crl%u", i); - - ff = CfgCreateFolder(f, name); - n = crl->Name; - - if (UniIsEmptyStr(n->CommonName) == false) - { - CfgAddUniStr(ff, "CommonName", n->CommonName); - } - - if (UniIsEmptyStr(n->Organization) == false) - { - CfgAddUniStr(ff, "Organization", n->Organization); - } - - if (UniIsEmptyStr(n->Unit) == false) - { - CfgAddUniStr(ff, "Unit", n->Unit); - } - - if (UniIsEmptyStr(n->Country) == false) - { - CfgAddUniStr(ff, "Country", n->Country); - } - - if (UniIsEmptyStr(n->State) == false) - { - CfgAddUniStr(ff, "State", n->State); - } - - if (UniIsEmptyStr(n->Local) == false) - { - CfgAddUniStr(ff, "Local", n->Local); - } - - if (IsZero(crl->DigestMD5, MD5_SIZE) == false) - { - char tmp[MAX_SIZE]; - - BinToStr(tmp, sizeof(tmp), crl->DigestMD5, MD5_SIZE); - CfgAddStr(ff, "DigestMD5", tmp); - } - - if (IsZero(crl->DigestSHA1, SHA1_SIZE) == false) - { - char tmp[MAX_SIZE]; - - BinToStr(tmp, sizeof(tmp), crl->DigestSHA1, SHA1_SIZE); - CfgAddStr(ff, "DigestSHA1", tmp); - } - - if (crl->Serial != NULL) - { - char tmp[MAX_SIZE]; - - BinToStr(tmp, sizeof(tmp), crl->Serial->data, crl->Serial->size); - CfgAddStr(ff, "Serial", tmp); - } - } - } - UnlockList(o); -} - -// Read the certificate revocation list -void SiLoadCrlList(LIST *o, FOLDER *f) -{ - // Validate arguments - if (o == NULL || f == NULL) - { - return; - } - - LockList(o); - { - UINT i; - TOKEN_LIST *t; - - t = CfgEnumFolderToTokenList(f); - - for (i = 0;i < t->NumTokens;i++) - { - CRL *crl; - FOLDER *ff = CfgGetFolder(f, t->Token[i]); - wchar_t cn[MAX_SIZE], org[MAX_SIZE], u[MAX_SIZE], c[MAX_SIZE], - st[MAX_SIZE], l[MAX_SIZE]; - char tmp[MAX_SIZE]; - - if (ff != NULL) - { - BUF *b; - - crl = ZeroMalloc(sizeof(CRL)); - - CfgGetUniStr(ff, "CommonName", cn, sizeof(cn)); - CfgGetUniStr(ff, "Organization", org, sizeof(org)); - CfgGetUniStr(ff, "Unit", u, sizeof(u)); - CfgGetUniStr(ff, "Country", c, sizeof(c)); - CfgGetUniStr(ff, "State", st, sizeof(st)); - CfgGetUniStr(ff, "Local", l, sizeof(l)); - - crl->Name = NewName(cn, org, u, c, st, l); - - if (CfgGetStr(ff, "Serial", tmp, sizeof(tmp))) - { - b = StrToBin(tmp); - - if (b != NULL) - { - if (b->Size >= 1) - { - crl->Serial = NewXSerial(b->Buf, b->Size); - } - - FreeBuf(b); - } - } - - if (CfgGetStr(ff, "DigestMD5", tmp, sizeof(tmp))) - { - b = StrToBin(tmp); - - if (b != NULL) - { - if (b->Size == MD5_SIZE) - { - Copy(crl->DigestMD5, b->Buf, MD5_SIZE); - } - - FreeBuf(b); - } - } - - if (CfgGetStr(ff, "DigestSHA1", tmp, sizeof(tmp))) - { - b = StrToBin(tmp); - - if (b != NULL) - { - if (b->Size == SHA1_SIZE) - { - Copy(crl->DigestSHA1, b->Buf, SHA1_SIZE); - } - - FreeBuf(b); - } - } - - Insert(o, crl); - } - } - - FreeToken(t); - } - UnlockList(o); -} - -// Write the certificates list -void SiWriteCertList(FOLDER *f, LIST *o) -{ - // Validate arguments - if (f == NULL || o == NULL) - { - return; - } - - LockList(o); - { - UINT i; - X *x; - for (i = 0;i < LIST_NUM(o);i++) - { - char name[MAX_SIZE]; - BUF *b; - x = LIST_DATA(o, i); - Format(name, sizeof(name), "Cert%u", i); - b = XToBuf(x, false); - if (b != NULL) - { - CfgAddBuf(CfgCreateFolder(f, name), "X509", b); - FreeBuf(b); - } - } - } - UnlockList(o); -} - -// Read the certificates list -void SiLoadCertList(LIST *o, FOLDER *f) -{ - // Validate arguments - if (o == NULL || f == NULL) - { - return; - } - - LockList(o); - { - UINT i; - TOKEN_LIST *t; - - t = CfgEnumFolderToTokenList(f); - - for (i = 0;i < t->NumTokens;i++) - { - FOLDER *ff = CfgGetFolder(f, t->Token[i]); - BUF *b; - - b = CfgGetBuf(ff, "X509"); - if (b != NULL) - { - X *x = BufToX(b, false); - if (x != NULL) - { - Insert(o, x); - } - FreeBuf(b); - } - } - - FreeToken(t); - } - UnlockList(o); -} - -// Write the database -void SiWriteHubDb(FOLDER *f, HUBDB *db, bool no_save_ac_list) -{ - // Validate arguments - if (f == NULL || db == NULL) - { - return; - } - - SiWriteUserList(CfgCreateFolder(f, "UserList"), db->UserList); - SiWriteGroupList(CfgCreateFolder(f, "GroupList"), db->GroupList); - SiWriteCertList(CfgCreateFolder(f, "CertList"), db->RootCertList); - SiWriteCrlList(CfgCreateFolder(f, "CrlList"), db->CrlList); - - if (no_save_ac_list == false) - { - SiWriteAcList(CfgCreateFolder(f, "IPAccessControlList"), db->AcList); - } -} - -// Read the database -void SiLoadHubDb(HUB *h, FOLDER *f) -{ - // Validate arguments - if (f == NULL || h == NULL) - { - return; - } - - SiLoadGroupList(h, CfgGetFolder(f, "GroupList")); - SiLoadUserList(h, CfgGetFolder(f, "UserList")); - - if (h->HubDb != NULL) - { - SiLoadCertList(h->HubDb->RootCertList, CfgGetFolder(f, "CertList")); - SiLoadCrlList(h->HubDb->CrlList, CfgGetFolder(f, "CrlList")); - SiLoadAcList(h->HubDb->AcList, CfgGetFolder(f, "IPAccessControlList")); - } -} - -// Write the Virtual HUB setting -void SiWriteHubCfg(FOLDER *f, HUB *h) -{ - // Validate arguments - if (f == NULL || h == NULL) - { - return; - } - - // Radius server name - Lock(h->RadiusOptionLock); - { - if (h->RadiusServerName != NULL) - { - CfgAddStr(f, "RadiusServerName", h->RadiusServerName); - CfgAddBuf(f, "RadiusSecret", h->RadiusSecret); - } - CfgAddInt(f, "RadiusServerPort", h->RadiusServerPort); - CfgAddInt(f, "RadiusRetryInterval", h->RadiusRetryInterval); - CfgAddStr(f, "RadiusSuffixFilter", h->RadiusSuffixFilter); - CfgAddStr(f, "RadiusRealm", h->RadiusRealm); - - CfgAddBool(f, "RadiusConvertAllMsChapv2AuthRequestToEap", h->RadiusConvertAllMsChapv2AuthRequestToEap); - CfgAddBool(f, "RadiusUsePeapInsteadOfEap", h->RadiusUsePeapInsteadOfEap); - } - Unlock(h->RadiusOptionLock); - - // Password - CfgAddByte(f, "HashedPassword", h->HashedPassword, sizeof(h->HashedPassword)); - CfgAddByte(f, "SecurePassword", h->SecurePassword, sizeof(h->SecurePassword)); - - // Online / Offline flag - if (h->Cedar->Bridge == false) - { - CfgAddBool(f, "Online", (h->Offline && (h->HubIsOnlineButHalting == false)) ? false : true); - } - - // Traffic information - SiWriteTraffic(f, "Traffic", h->Traffic); - - // HUB options - SiWriteHubOptionCfg(CfgCreateFolder(f, "Option"), h->Option); - - // Message - { - FOLDER *folder = CfgCreateFolder(f, "Message"); - - if (IsEmptyUniStr(h->Msg) == false) - { - CfgAddUniStr(folder, "MessageText", h->Msg); - } - } - - // HUB_LOG - SiWriteHubLogCfg(CfgCreateFolder(f, "LogSetting"), &h->LogSetting); - - if (h->Type == HUB_TYPE_STANDALONE) - { - // Link list - SiWriteHubLinks(CfgCreateFolder(f, "CascadeList"), h); - } - - if (h->Type != HUB_TYPE_FARM_STATIC) - { - if (GetServerCapsBool(h->Cedar->Server, "b_support_securenat")) - { - // SecureNAT - SiWriteSecureNAT(h, CfgCreateFolder(f, "SecureNAT")); - } - } - - // Access list - SiWriteHubAccessLists(CfgCreateFolder(f, "AccessList"), h); - - // Administration options - SiWriteHubAdminOptions(CfgCreateFolder(f, "AdminOption"), h); - - // Type of HUB - CfgAddInt(f, "Type", h->Type); - - // Database - if (h->Cedar->Bridge == false) - { - SiWriteHubDb(CfgCreateFolder(f, "SecurityAccountDatabase"), h->HubDb, - false - ); - } - - // Usage status - CfgAddInt64(f, "LastCommTime", h->LastCommTime); - CfgAddInt64(f, "LastLoginTime", h->LastLoginTime); - CfgAddInt64(f, "CreatedTime", h->CreatedTime); - CfgAddInt(f, "NumLogin", h->NumLogin); -} - -// Read the logging options -void SiLoadHubLogCfg(HUB_LOG *g, FOLDER *f) -{ - // Validate arguments - if (f == NULL || g == NULL) - { - return; - } - - Zero(g, sizeof(HUB_LOG)); - g->SaveSecurityLog = CfgGetBool(f, "SaveSecurityLog"); - g->SecurityLogSwitchType = CfgGetInt(f, "SecurityLogSwitchType"); - g->SavePacketLog = CfgGetBool(f, "SavePacketLog"); - g->PacketLogSwitchType = CfgGetInt(f, "PacketLogSwitchType"); - - g->PacketLogConfig[PACKET_LOG_TCP_CONN] = CfgGetInt(f, "PACKET_LOG_TCP_CONN"); - g->PacketLogConfig[PACKET_LOG_TCP] = CfgGetInt(f, "PACKET_LOG_TCP"); - g->PacketLogConfig[PACKET_LOG_DHCP] = CfgGetInt(f, "PACKET_LOG_DHCP"); - g->PacketLogConfig[PACKET_LOG_UDP] = CfgGetInt(f, "PACKET_LOG_UDP"); - g->PacketLogConfig[PACKET_LOG_ICMP] = CfgGetInt(f, "PACKET_LOG_ICMP"); - g->PacketLogConfig[PACKET_LOG_IP] = CfgGetInt(f, "PACKET_LOG_IP"); - g->PacketLogConfig[PACKET_LOG_ARP] = CfgGetInt(f, "PACKET_LOG_ARP"); - g->PacketLogConfig[PACKET_LOG_ETHERNET] = CfgGetInt(f, "PACKET_LOG_ETHERNET"); -} - -// Write the logging options -void SiWriteHubLogCfg(FOLDER *f, HUB_LOG *g) -{ - SiWriteHubLogCfgEx(f, g, false); -} -void SiWriteHubLogCfgEx(FOLDER *f, HUB_LOG *g, bool el_mode) -{ - // Validate arguments - if (f == NULL || g == NULL) - { - return; - } - - if (el_mode == false) - { - CfgAddBool(f, "SaveSecurityLog", g->SaveSecurityLog); - CfgAddInt(f, "SecurityLogSwitchType", g->SecurityLogSwitchType); - CfgAddBool(f, "SavePacketLog", g->SavePacketLog); - } - - CfgAddInt(f, "PacketLogSwitchType", g->PacketLogSwitchType); - - CfgAddInt(f, "PACKET_LOG_TCP_CONN", g->PacketLogConfig[PACKET_LOG_TCP_CONN]); - CfgAddInt(f, "PACKET_LOG_TCP", g->PacketLogConfig[PACKET_LOG_TCP]); - CfgAddInt(f, "PACKET_LOG_DHCP", g->PacketLogConfig[PACKET_LOG_DHCP]); - CfgAddInt(f, "PACKET_LOG_UDP", g->PacketLogConfig[PACKET_LOG_UDP]); - CfgAddInt(f, "PACKET_LOG_ICMP", g->PacketLogConfig[PACKET_LOG_ICMP]); - CfgAddInt(f, "PACKET_LOG_IP", g->PacketLogConfig[PACKET_LOG_IP]); - CfgAddInt(f, "PACKET_LOG_ARP", g->PacketLogConfig[PACKET_LOG_ARP]); - CfgAddInt(f, "PACKET_LOG_ETHERNET", g->PacketLogConfig[PACKET_LOG_ETHERNET]); -} - -// Read the Virtual HUB settings -void SiLoadHubCfg(SERVER *s, FOLDER *f, char *name) -{ - HUB *h; - CEDAR *c; - HUB_OPTION o; - bool online; - UINT hub_old_type = 0; - // Validate arguments - if (s == NULL || f == NULL || name == NULL) - { - return; - } - - c = s->Cedar; - - // Get the option - Zero(&o, sizeof(o)); - SiLoadHubOptionCfg(CfgGetFolder(f, "Option"), &o); - - // Create a HUB - h = NewHub(c, name, &o); - if (h != NULL) - { - HUB_LOG g; - // Radius server settings - Lock(h->RadiusOptionLock); - { - char name[MAX_SIZE]; - BUF *secret; - UINT port; - UINT interval; - - port = CfgGetInt(f, "RadiusServerPort"); - interval = CfgGetInt(f, "RadiusRetryInterval"); - - CfgGetStr(f, "RadiusSuffixFilter", h->RadiusSuffixFilter, sizeof(h->RadiusSuffixFilter)); - CfgGetStr(f, "RadiusRealm", h->RadiusRealm, sizeof(h->RadiusRealm)); - - h->RadiusConvertAllMsChapv2AuthRequestToEap = CfgGetBool(f, "RadiusConvertAllMsChapv2AuthRequestToEap"); - h->RadiusUsePeapInsteadOfEap = CfgGetBool(f, "RadiusUsePeapInsteadOfEap"); - - if (interval == 0) - { - interval = RADIUS_RETRY_INTERVAL; - } - - if (port != 0 && CfgGetStr(f, "RadiusServerName", name, sizeof(name))) - { - secret = CfgGetBuf(f, "RadiusSecret"); - if (secret != NULL) - { - char secret_str[MAX_SIZE]; - Zero(secret_str, sizeof(secret_str)); - if (secret->Size < sizeof(secret_str)) - { - Copy(secret_str, secret->Buf, secret->Size); - } - secret_str[sizeof(secret_str) - 1] = 0; - //SetRadiusServer(h, name, port, secret_str); - SetRadiusServerEx(h, name, port, secret_str, interval); - FreeBuf(secret); - } - } - } - Unlock(h->RadiusOptionLock); - - // Password - if (CfgGetByte(f, "HashedPassword", h->HashedPassword, sizeof(h->HashedPassword)) != sizeof(h->HashedPassword)) - { - Sha0(h->HashedPassword, "", 0); - } - if (CfgGetByte(f, "SecurePassword", h->SecurePassword, sizeof(h->SecurePassword)) != sizeof(h->SecurePassword)) - { - HashPassword(h->SecurePassword, ADMINISTRATOR_USERNAME, ""); - } - - // Log Settings - Zero(&g, sizeof(g)); - SiLoadHubLogCfg(&g, CfgGetFolder(f, "LogSetting")); - SetHubLogSetting(h, &g); - - // Online / Offline flag - if (h->Cedar->Bridge == false) - { - online = CfgGetBool(f, "Online"); - } - else - { - online = true; - } - - // Traffic information - SiLoadTraffic(f, "Traffic", h->Traffic); - - // Access list - SiLoadHubAccessLists(h, CfgGetFolder(f, "AccessList")); - - // Type of HUB - hub_old_type = h->Type = CfgGetInt(f, "Type"); - - if (s->ServerType == SERVER_TYPE_STANDALONE) - { - if (h->Type != HUB_TYPE_STANDALONE) - { - // Change the type of all HUB to a stand-alone if the server is a stand-alone - h->Type = HUB_TYPE_STANDALONE; - } - } - else - { - if (h->Type == HUB_TYPE_STANDALONE) - { - // If the server is a farm controller, change the type of HUB to the farm supported types - h->Type = HUB_TYPE_FARM_DYNAMIC; - } - } - - if (h->Type == HUB_TYPE_FARM_DYNAMIC) - { - h->CurrentVersion = h->LastVersion = 1; - } - - // Message - { - FOLDER *folder = CfgGetFolder(f, "Message"); - if (folder != NULL) - { - wchar_t *tmp = Malloc(sizeof(wchar_t) * (HUB_MAXMSG_LEN + 1)); - if (CfgGetUniStr(folder, "MessageText", tmp, sizeof(wchar_t) * (HUB_MAXMSG_LEN + 1))) - { - SetHubMsg(h, tmp); - } - Free(tmp); - } - } - - // Link list - if (h->Type == HUB_TYPE_STANDALONE) - { - // The link list is used only on stand-alone HUB - // In VPN Gate hubs, don't load this - { - SiLoadHubLinks(h, CfgGetFolder(f, "CascadeList")); - } - } - - // SecureNAT - if (GetServerCapsBool(h->Cedar->Server, "b_support_securenat")) - { - if (h->Type == HUB_TYPE_STANDALONE || h->Type == HUB_TYPE_FARM_DYNAMIC) - { - // SecureNAT is used only in the case of dynamic HUB or standalone HUB - SiLoadSecureNAT(h, CfgGetFolder(f, "SecureNAT")); - - if (h->Type != HUB_TYPE_STANDALONE && h->Cedar != NULL && h->Cedar->Server != NULL && - h->Cedar->Server->ServerType == SERVER_TYPE_FARM_CONTROLLER) - { - NiClearUnsupportedVhOptionForDynamicHub(h->SecureNATOption, - hub_old_type == HUB_TYPE_STANDALONE); - } - - } - } - - // Administration options - SiLoadHubAdminOptions(h, CfgGetFolder(f, "AdminOption")); - - // Database - if (h->Cedar->Bridge == false) - { - SiLoadHubDb(h, CfgGetFolder(f, "SecurityAccountDatabase")); - } - - // Usage status - h->LastCommTime = CfgGetInt64(f, "LastCommTime"); - if (h->LastCommTime == 0) - { - h->LastCommTime = SystemTime64(); - } - h->LastLoginTime = CfgGetInt64(f, "LastLoginTime"); - if (h->LastLoginTime == 0) - { - h->LastLoginTime = SystemTime64(); - } - h->CreatedTime = CfgGetInt64(f, "CreatedTime"); - h->NumLogin = CfgGetInt(f, "NumLogin"); - - // Start the operation of the HUB - AddHub(c, h); - - if (online) - { - h->Offline = true; - SetHubOnline(h); - } - else - { - h->Offline = false; - SetHubOffline(h); - } - - WaitLogFlush(h->SecurityLogger); - WaitLogFlush(h->PacketLogger); - - ReleaseHub(h); - } -} - -// Read the SecureNAT configuration -void SiLoadSecureNAT(HUB *h, FOLDER *f) -{ - VH_OPTION o; - // Validate arguments - if (h == NULL || f == NULL) - { - return; - } - - // Read the VH_OPTION - NiLoadVhOptionEx(&o, f); - - // Set the VH_OPTION - Copy(h->SecureNATOption, &o, sizeof(VH_OPTION)); - - EnableSecureNAT(h, CfgGetBool(f, "Disabled") ? false : true); -} - -// Read the virtual layer 3 switch settings -void SiLoadL3SwitchCfg(L3SW *sw, FOLDER *f) -{ - UINT i; - FOLDER *if_folder, *table_folder; - TOKEN_LIST *t; - bool active = false; - // Validate arguments - if (sw == NULL || f == NULL) - { - return; - } - - active = CfgGetBool(f, "Active"); - - // Interface list - if_folder = CfgGetFolder(f, "InterfaceList"); - if (if_folder != NULL) - { - t = CfgEnumFolderToTokenList(if_folder); - if (t != NULL) - { - for (i = 0;i < t->NumTokens;i++) - { - FOLDER *ff = CfgGetFolder(if_folder, t->Token[i]); - char name[MAX_HUBNAME_LEN + 1]; - UINT ip, subnet; - - CfgGetStr(ff, "HubName", name, sizeof(name)); - ip = CfgGetIp32(ff, "IpAddress"); - subnet = CfgGetIp32(ff, "SubnetMask"); - - { - L3AddIf(sw, name, ip, subnet); - } - } - FreeToken(t); - } - } - - // Routing table - table_folder = CfgGetFolder(f, "RoutingTable"); - if (table_folder != NULL) - { - t = CfgEnumFolderToTokenList(table_folder); - if (t != NULL) - { - for (i = 0;i < t->NumTokens;i++) - { - FOLDER *ff = CfgGetFolder(table_folder, t->Token[i]); - L3TABLE tbl; - - Zero(&tbl, sizeof(tbl)); - tbl.NetworkAddress = CfgGetIp32(ff, "NetworkAddress"); - tbl.SubnetMask = CfgGetIp32(ff, "SubnetMask"); - tbl.GatewayAddress = CfgGetIp32(ff, "GatewayAddress"); - tbl.Metric = CfgGetInt(ff, "Metric"); - - L3AddTable(sw, &tbl); - } - FreeToken(t); - } - } - - if (active) - { - L3SwStart(sw); - } -} - -// Write the virtual layer 3 switch settings -void SiWriteL3SwitchCfg(FOLDER *f, L3SW *sw) -{ - UINT i; - FOLDER *if_folder, *table_folder; - char tmp[MAX_SIZE]; - // Validate arguments - if (f == NULL || sw == NULL) - { - return; - } - - // Active flag - CfgAddBool(f, "Active", sw->Active); - - // Interface list - if_folder = CfgCreateFolder(f, "InterfaceList"); - for (i = 0;i < LIST_NUM(sw->IfList);i++) - { - L3IF *e = LIST_DATA(sw->IfList, i); - FOLDER *ff; - - Format(tmp, sizeof(tmp), "Interface%u", i); - ff = CfgCreateFolder(if_folder, tmp); - - CfgAddStr(ff, "HubName", e->HubName); - CfgAddIp32(ff, "IpAddress", e->IpAddress); - CfgAddIp32(ff, "SubnetMask", e->SubnetMask); - } - - // Routing table - table_folder = CfgCreateFolder(f, "RoutingTable"); - for (i = 0;i < LIST_NUM(sw->TableList);i++) - { - L3TABLE *e = LIST_DATA(sw->TableList, i); - FOLDER *ff; - - Format(tmp, sizeof(tmp), "Entry%u", i); - ff = CfgCreateFolder(table_folder, tmp); - - CfgAddIp32(ff, "NetworkAddress", e->NetworkAddress); - CfgAddIp32(ff, "SubnetMask", e->SubnetMask); - CfgAddIp32(ff, "GatewayAddress", e->GatewayAddress); - CfgAddInt(ff, "Metric", e->Metric); - } -} - -// Read the Virtual Layer 3 switch list -void SiLoadL3Switchs(SERVER *s, FOLDER *f) -{ - UINT i; - TOKEN_LIST *t; - CEDAR *c; - // Validate arguments - if (s == NULL || f == NULL) - { - return; - } - c = s->Cedar; - - t = CfgEnumFolderToTokenList(f); - if (t != NULL) - { - for (i = 0;i < t->NumTokens;i++) - { - char *name = t->Token[i]; - L3SW *sw = L3AddSw(c, name); - - SiLoadL3SwitchCfg(sw, CfgGetFolder(f, name)); - - ReleaseL3Sw(sw); - } - } - FreeToken(t); -} - -// Write the Virtual Layer 3 switch list -void SiWriteL3Switchs(FOLDER *f, SERVER *s) -{ - UINT i; - FOLDER *folder; - CEDAR *c; - // Validate arguments - if (f == NULL || s == NULL) - { - return; - } - c = s->Cedar; - - LockList(c->L3SwList); - { - for (i = 0;i < LIST_NUM(c->L3SwList);i++) - { - L3SW *sw = LIST_DATA(c->L3SwList, i); - - Lock(sw->lock); - { - folder = CfgCreateFolder(f, sw->Name); - - SiWriteL3SwitchCfg(folder, sw); - } - Unlock(sw->lock); - } - } - UnlockList(c->L3SwList); -} - -// Read the IPsec server configuration -void SiLoadIPsec(SERVER *s, FOLDER *f) -{ - IPSEC_SERVICES sl; - FOLDER *list_folder; - // Validate arguments - if (s == NULL || f == NULL) - { - return; - } - - Zero(&sl, sizeof(sl)); - - CfgGetStr(f, "IPsec_Secret", sl.IPsec_Secret, sizeof(sl.IPsec_Secret)); - CfgGetStr(f, "L2TP_DefaultHub", sl.L2TP_DefaultHub, sizeof(sl.L2TP_DefaultHub)); - - if (s->ServerType == SERVER_TYPE_STANDALONE) - { - // IPsec feature only be enabled on a standalone server - sl.L2TP_Raw = CfgGetBool(f, "L2TP_Raw"); - sl.L2TP_IPsec = CfgGetBool(f, "L2TP_IPsec"); - sl.EtherIP_IPsec = CfgGetBool(f, "EtherIP_IPsec"); - } - - IPsecServerSetServices(s->IPsecServer, &sl); - - list_folder = CfgGetFolder(f, "EtherIP_IDSettingsList"); - - if (list_folder != NULL) - { - TOKEN_LIST *t = CfgEnumFolderToTokenList(list_folder); - if (t != NULL) - { - UINT i; - - for (i = 0;i < t->NumTokens;i++) - { - char *name = t->Token[i]; - FOLDER *f = CfgGetFolder(list_folder, name); - - if (f != NULL) - { - ETHERIP_ID d; - BUF *b; - - Zero(&d, sizeof(d)); - - StrCpy(d.Id, sizeof(d.Id), name); - CfgGetStr(f, "HubName", d.HubName, sizeof(d.HubName)); - CfgGetStr(f, "UserName", d.UserName, sizeof(d.UserName)); - - b = CfgGetBuf(f, "EncryptedPassword"); - if (b != NULL) - { - char *pass = DecryptPassword2(b); - - StrCpy(d.Password, sizeof(d.Password), pass); - - Free(pass); - - AddEtherIPId(s->IPsecServer, &d); - - FreeBuf(b); - } - } - } - - FreeToken(t); - } - } -} - -// Write the IPsec server configuration -void SiWriteIPsec(FOLDER *f, SERVER *s) -{ - IPSEC_SERVICES sl; - FOLDER *list_folder; - UINT i; - // Validate arguments - if (s == NULL || f == NULL) - { - return; - } - - if (s->IPsecServer == NULL) - { - return; - } - - Zero(&sl, sizeof(sl)); - IPsecServerGetServices(s->IPsecServer, &sl); - - CfgAddStr(f, "IPsec_Secret", sl.IPsec_Secret); - CfgAddStr(f, "L2TP_DefaultHub", sl.L2TP_DefaultHub); - - CfgAddBool(f, "L2TP_Raw", sl.L2TP_Raw); - CfgAddBool(f, "L2TP_IPsec", sl.L2TP_IPsec); - CfgAddBool(f, "EtherIP_IPsec", sl.EtherIP_IPsec); - - list_folder = CfgCreateFolder(f, "EtherIP_IDSettingsList"); - - Lock(s->IPsecServer->LockSettings); - { - for (i = 0;i < LIST_NUM(s->IPsecServer->EtherIPIdList);i++) - { - ETHERIP_ID *d = LIST_DATA(s->IPsecServer->EtherIPIdList, i); - FOLDER *f; - BUF *b; - - f = CfgCreateFolder(list_folder, d->Id); - - CfgAddStr(f, "HubName", d->HubName); - CfgAddStr(f, "UserName", d->UserName); - - b = EncryptPassword2(d->Password); - - CfgAddBuf(f, "EncryptedPassword", b); - - FreeBuf(b); - } - } - Unlock(s->IPsecServer->LockSettings); -} - -// Write the license list -void SiWriteLicenseManager(FOLDER *f, SERVER *s) -{ -} - -// Read the license list -void SiLoadLicenseManager(SERVER *s, FOLDER *f) -{ -} - -// Write the Virtual HUB list -void SiWriteHubs(FOLDER *f, SERVER *s) -{ - UINT i; - FOLDER *hub_folder; - CEDAR *c; - UINT num; - HUB **hubs; - // Validate arguments - if (f == NULL || s == NULL) - { - return; - } - c = s->Cedar; - - LockList(c->HubList); - { - hubs = ToArray(c->HubList); - num = LIST_NUM(c->HubList); - - for (i = 0;i < num;i++) - { - AddRef(hubs[i]->ref); - } - } - UnlockList(c->HubList); - - for (i = 0;i < num;i++) - { - HUB *h = hubs[i]; - - Lock(h->lock); - { - hub_folder = CfgCreateFolder(f, h->Name); - SiWriteHubCfg(hub_folder, h); - } - Unlock(h->lock); - - ReleaseHub(h); - - if ((i % 30) == 1) - { - YieldCpu(); - } - } - - Free(hubs); -} - -// Read the Virtual HUB list -void SiLoadHubs(SERVER *s, FOLDER *f) -{ - UINT i; - FOLDER *hub_folder; - TOKEN_LIST *t; - bool b = false; - // Validate arguments - if (f == NULL || s == NULL) - { - return; - } - - t = CfgEnumFolderToTokenList(f); - for (i = 0;i < t->NumTokens;i++) - { - char *name = t->Token[i]; - - - if (s->Cedar->Bridge) - { - if (StrCmpi(name, SERVER_DEFAULT_BRIDGE_NAME) == 0) - { - // Read only the setting of Virtual HUB named "BRIDGE" - // in the case of the Bridge - b = true; - } - else - { - continue; - } - } - hub_folder = CfgGetFolder(f, name); - if (hub_folder != NULL) - { - SiLoadHubCfg(s, hub_folder, name); - } - } - FreeToken(t); - - if (s->Cedar->Bridge && b == false) - { - // If there isn't "BRIDGE" virtual HUB setting, create it newly - SiInitDefaultHubList(s); - } -} - -// Read the server-specific settings -void SiLoadServerCfg(SERVER *s, FOLDER *f) -{ - BUF *b; - CEDAR *c; - char tmp[MAX_SIZE]; - X *x = NULL; - K *k = NULL; - FOLDER *params_folder; - UINT i; - // Validate arguments - if (s == NULL || f == NULL) - { - return; - } - - // Save interval related - s->AutoSaveConfigSpan = CfgGetInt(f, "AutoSaveConfigSpan") * 1000; - if (s->AutoSaveConfigSpan == 0) - { - s->AutoSaveConfigSpan = SERVER_FILE_SAVE_INTERVAL_DEFAULT; - } - else - { - s->AutoSaveConfigSpan = MAKESURE(s->AutoSaveConfigSpan, SERVER_FILE_SAVE_INTERVAL_MIN, SERVER_FILE_SAVE_INTERVAL_MAX); - } - - i = CfgGetInt(f, "MaxConcurrentDnsClientThreads"); - if (i != 0) - { - SetGetIpThreadMaxNum(i); - } - else - { - SetGetIpThreadMaxNum(DEFAULT_GETIP_THREAD_MAX_NUM); - } - - s->DontBackupConfig = CfgGetBool(f, "DontBackupConfig"); - - CfgGetIp(f, "ListenIP", &s->ListenIP); - ProtoSetListenIP(s->Proto, &s->ListenIP); - - if (CfgIsItem(f, "BackupConfigOnlyWhenModified")) - { - s->BackupConfigOnlyWhenModified = CfgGetBool(f, "BackupConfigOnlyWhenModified"); - } - else - { - s->BackupConfigOnlyWhenModified = true; - } - - // Server log switch type - if (CfgIsItem(f, "ServerLogSwitchType")) - { - UINT st = CfgGetInt(f, "ServerLogSwitchType"); - - SetLogSwitchType(s->Logger, st); - } - - SetMaxLogSize(CfgGetInt64(f, "LoggerMaxLogSize")); - - params_folder = CfgGetFolder(f, "GlobalParams"); - SiLoadGlobalParamsCfg(params_folder); - - c = s->Cedar; - Lock(c->lock); - { - FOLDER *ff; - { - UINT i; - LIST *ports; - - // Load and set UDP ports - CfgGetStr(f, "PortsUDP", tmp, sizeof(tmp)); - NormalizeIntListStr(tmp, sizeof(tmp), tmp, true, ", "); - - ports = StrToIntList(tmp, true); - for (i = 0; i < LIST_NUM(ports); ++i) - { - AddInt(s->PortsUDP, *(UINT *)LIST_DATA(ports, i)); - } - ReleaseIntList(ports); - - ProtoSetUdpPorts(s->Proto, s->PortsUDP); - } - { - RPC_KEEP k; - - // Keep-alive related - Zero(&k, sizeof(k)); - k.UseKeepConnect = CfgGetBool(f, "UseKeepConnect"); - CfgGetStr(f, "KeepConnectHost", k.KeepConnectHost, sizeof(k.KeepConnectHost)); - k.KeepConnectPort = CfgGetInt(f, "KeepConnectPort"); - k.KeepConnectProtocol = CfgGetInt(f, "KeepConnectProtocol"); - k.KeepConnectInterval = CfgGetInt(f, "KeepConnectInterval") * 1000; - if (k.KeepConnectPort == 0) - { - k.KeepConnectPort = 80; - } - if (StrLen(k.KeepConnectHost) == 0) - { - StrCpy(k.KeepConnectHost, sizeof(k.KeepConnectHost), CLIENT_DEFAULT_KEEPALIVE_HOST); - } - if (k.KeepConnectInterval == 0) - { - k.KeepConnectInterval = KEEP_INTERVAL_DEFAULT * 1000; - } - if (k.KeepConnectInterval < 5000) - { - k.KeepConnectInterval = 5000; - } - if (k.KeepConnectInterval > 600000) - { - k.KeepConnectInterval = 600000; - } - - Lock(s->Keep->lock); - { - KEEP *keep = s->Keep; - keep->Enable = k.UseKeepConnect; - keep->Server = true; - StrCpy(keep->ServerName, sizeof(keep->ServerName), k.KeepConnectHost); - keep->ServerPort = k.KeepConnectPort; - keep->UdpMode = k.KeepConnectProtocol; - keep->Interval = k.KeepConnectInterval; - } - Unlock(s->Keep->lock); - } - - // syslog - ff = CfgGetFolder(f, "SyslogSettings"); - if (ff != NULL && GetServerCapsBool(s, "b_support_syslog")) - { - SYSLOG_SETTING set; - - Zero(&set, sizeof(set)); - - set.SaveType = CfgGetInt(ff, "SaveType"); - CfgGetStr(ff, "HostName", set.Hostname, sizeof(set.Hostname)); - set.Port = CfgGetInt(ff, "Port"); - - SiSetSysLogSetting(s, &set); - } - - // Proto - ff = CfgGetFolder(f, "Proto"); - if (ff != NULL) - { - SiLoadProtoCfg(s->Proto, ff); - } - - // Whether to disable the IPv6 listener - s->Cedar->DisableIPv6Listener = CfgGetBool(f, "DisableIPv6Listener"); - - // DoS - s->DisableDosProtection = CfgGetBool(f, "DisableDosProtection"); - - // Num Connections Per IP - SetMaxConnectionsPerIp(CfgGetInt(f, "MaxConnectionsPerIP")); - - // MaxUnestablishedConnections - SetMaxUnestablishedConnections(CfgGetInt(f, "MaxUnestablishedConnections")); - - // DeadLock - s->DisableDeadLockCheck = CfgGetBool(f, "DisableDeadLockCheck"); - - // Eraser - SetEraserCheckInterval(CfgGetInt(f, "AutoDeleteCheckIntervalSecs")); - s->Eraser = NewEraser(s->Logger, CfgGetInt64(f, "AutoDeleteCheckDiskFreeSpaceMin")); - - // WebUI - s->UseWebUI = CfgGetBool(f, "UseWebUI"); - - - // WebTimePage - s->UseWebTimePage = CfgGetBool(f, "UseWebTimePage"); - - // NoLinuxArpFilter - s->NoLinuxArpFilter = CfgGetBool(f, "NoLinuxArpFilter"); - - // NoHighPriorityProcess - s->NoHighPriorityProcess = CfgGetBool(f, "NoHighPriorityProcess"); - - // NoDebugDump - s->NoDebugDump = CfgGetBool(f, "NoDebugDump"); - if (s->NoDebugDump) - { -#ifdef OS_WIN32 - MsSetEnableMinidump(false); -#endif // OS_WIN32 - } - - // Disable the NAT-traversal feature - s->DisableNatTraversal = CfgGetBool(f, "DisableNatTraversal"); - - // Disable IPsec's aggressive mode - s->DisableIPsecAggressiveMode = CfgGetBool(f, "DisableIPsecAggressiveMode"); - - if (s->Cedar->Bridge == false) - { - // Enable the VPN-over-ICMP - if (CfgIsItem(f, "EnableVpnOverIcmp")) - { - s->EnableVpnOverIcmp = CfgGetBool(f, "EnableVpnOverIcmp"); - } - else - { - s->EnableVpnOverIcmp = false; - } - - // Enable the VPN-over-DNS - if (CfgIsItem(f, "EnableVpnOverDns")) - { - s->EnableVpnOverDns = CfgGetBool(f, "EnableVpnOverDns"); - } - else - { - s->EnableVpnOverDns = false; - } - } - - // Debug log - s->SaveDebugLog = CfgGetBool(f, "SaveDebugLog"); - if (s->SaveDebugLog) - { - s->DebugLog = NewTinyLog(); - } - - // Let the client not to send a signature - s->NoSendSignature = CfgGetBool(f, "NoSendSignature"); - - // Server certificate - b = CfgGetBuf(f, "ServerCert"); - if (b != NULL) - { - x = BufToX(b, false); - FreeBuf(b); - } - - // Server private key - b = CfgGetBuf(f, "ServerKey"); - if (b != NULL) - { - k = BufToK(b, true, false, NULL); - FreeBuf(b); - } - - if (x == NULL || k == NULL || CheckXandK(x, k) == false) - { - FreeX(x); - FreeK(k); - SiGenerateDefaultCert(&x, &k); - - SetCedarCert(c, x, k); - - FreeX(x); - FreeK(k); - } - else - { - SetCedarCert(c, x, k); - - FreeX(x); - FreeK(k); - } - - // Character which separates the username from the hub name - if (CfgGetStr(f, "UsernameHubSeparator", tmp, sizeof(tmp))) - { - c->UsernameHubSeparator = IsPrintableAsciiChar(tmp[0]) ? tmp[0] : DEFAULT_USERNAME_HUB_SEPARATOR; - } - - // Cipher Name - if (CfgGetStr(f, "CipherName", tmp, sizeof(tmp))) - { - StrUpper(tmp); - SetCedarCipherList(c, tmp); - } - - // Traffic information - Lock(c->TrafficLock); - { - SiLoadTraffic(f, "ServerTraffic", c->Traffic); - } - Unlock(c->TrafficLock); - - // Type of server - s->UpdatedServerType = s->ServerType = CfgGetInt(f, "ServerType"); - - // Password - if (CfgGetByte(f, "HashedPassword", s->HashedPassword, sizeof(s->HashedPassword)) != sizeof(s->HashedPassword)) - { - Sha0(s->HashedPassword, "", 0); - } - - if (s->ServerType != SERVER_TYPE_STANDALONE) - { - // Performance ratio of the server - s->Weight = CfgGetInt(f, "ClusterMemberWeight"); - if (s->Weight == 0) - { - s->Weight = FARM_DEFAULT_WEIGHT; - } - } - else - { - s->Weight = FARM_DEFAULT_WEIGHT; - } - - if (s->ServerType == SERVER_TYPE_FARM_CONTROLLER) - { - s->ControllerOnly = CfgGetBool(f, "ControllerOnly"); - } - - if (s->ServerType != SERVER_TYPE_STANDALONE) - { - // NAT traversal can not be used in a cluster environment - s->DisableNatTraversal = true; - } - - if (s->Cedar->Bridge) - { - // NAT traversal function can not be used in the bridge environment - s->DisableNatTraversal = true; - } - - if (CfgGetStr(f, "PortsUDP", tmp, sizeof(tmp))) - { - UINT i; - TOKEN_LIST *tokens; - LIST *ports = s->PortsUDP; - - for (i = 0; i < LIST_NUM(ports); ++i) - { - Free(LIST_DATA(ports, i)); - } - DeleteAll(ports); - - NormalizeIntListStr(tmp, sizeof(tmp), tmp, true, ", "); - - tokens = ParseTokenWithoutNullStr(tmp, ", "); - for (i = 0; i < tokens->NumTokens; ++i) - { - char *str = tokens->Token[i]; - if (IsNum(str)) - { - InsertIntDistinct(ports, ToInt(str)); - } - } - FreeToken(tokens); - } - - if (s->ServerType == SERVER_TYPE_FARM_MEMBER) - { - char tmp[6 * MAX_PUBLIC_PORT_NUM + 1]; - // Load the settings item in the case of farm members - CfgGetStr(f, "ControllerName", s->ControllerName, sizeof(s->ControllerName)); - s->ControllerPort = CfgGetInt(f, "ControllerPort"); - CfgGetByte(f, "MemberPassword", s->MemberPassword, SHA1_SIZE); - s->PublicIp = CfgGetIp32(f, "PublicIp"); - if (CfgGetStr(f, "PublicPorts", tmp, sizeof(tmp))) - { - TOKEN_LIST *t = ParseToken(tmp, ", "); - UINT i; - s->NumPublicPort = t->NumTokens; - s->PublicPorts = ZeroMalloc(s->NumPublicPort * sizeof(UINT)); - for (i = 0;i < s->NumPublicPort;i++) - { - s->PublicPorts[i] = ToInt(t->Token[i]); - } - FreeToken(t); - } - } - - // Configuration of VPN Azure Client - s->EnableVpnAzure = CfgGetBool(f, "EnableVpnAzure"); - - // Disable GetHostName when accepting TCP - s->DisableGetHostNameWhenAcceptTcp = CfgGetBool(f, "DisableGetHostNameWhenAcceptTcp"); - - if (s->DisableGetHostNameWhenAcceptTcp) - { - DisableGetHostNameWhenAcceptInit(); - } - - // Disable core dump on UNIX - s->DisableCoreDumpOnUnix = CfgGetBool(f, "DisableCoreDumpOnUnix"); - - // Disable session reconnect - SetGlobalServerFlag(GSF_DISABLE_SESSION_RECONNECT, CfgGetBool(f, "DisableSessionReconnect")); - - c->SslAcceptSettings.Tls_Disable1_0 = CfgGetBool(f, "Tls_Disable1_0"); - c->SslAcceptSettings.Tls_Disable1_1 = CfgGetBool(f, "Tls_Disable1_1"); - c->SslAcceptSettings.Tls_Disable1_2 = CfgGetBool(f, "Tls_Disable1_2"); - c->SslAcceptSettings.Tls_Disable1_3 = CfgGetBool(f, "Tls_Disable1_3"); - c->SslAcceptSettings.Override_Security_Level = CfgGetBool(f, "Override_Security_Level"); - c->SslAcceptSettings.Override_Security_Level_Value = CfgGetInt(f, "Override_Security_Level_Value"); - - s->StrictSyslogDatetimeFormat = CfgGetBool(f, "StrictSyslogDatetimeFormat"); - - // Disable JSON-RPC Web API - s->DisableJsonRpcWebApi = CfgGetBool(f, "DisableJsonRpcWebApi"); - - // Bits of Diffie-Hellman parameters - c->DhParamBits = CfgGetInt(f, "DhParamBits"); - if (c->DhParamBits == 0) - { - c->DhParamBits = DH_PARAM_BITS_DEFAULT; - } - - SetDhParam(DhNewFromBits(c->DhParamBits)); - } - Unlock(c->lock); - -#ifdef OS_UNIX - if (s->DisableCoreDumpOnUnix) - { - UnixDisableCoreDump(); - } -#endif // OS_UNIX -} - -// Load global params -void SiLoadGlobalParamsCfg(FOLDER *f) -{ - SiLoadGlobalParamItem(GP_MAX_SEND_SOCKET_QUEUE_SIZE, CfgGetInt(f, "MAX_SEND_SOCKET_QUEUE_SIZE")); - SiLoadGlobalParamItem(GP_MIN_SEND_SOCKET_QUEUE_SIZE, CfgGetInt(f, "MIN_SEND_SOCKET_QUEUE_SIZE")); - SiLoadGlobalParamItem(GP_MAX_SEND_SOCKET_QUEUE_NUM, CfgGetInt(f, "MAX_SEND_SOCKET_QUEUE_NUM")); - SiLoadGlobalParamItem(GP_SELECT_TIME, CfgGetInt(f, "SELECT_TIME")); - SiLoadGlobalParamItem(GP_SELECT_TIME_FOR_NAT, CfgGetInt(f, "SELECT_TIME_FOR_NAT")); - SiLoadGlobalParamItem(GP_MAX_STORED_QUEUE_NUM, CfgGetInt(f, "MAX_STORED_QUEUE_NUM")); - SiLoadGlobalParamItem(GP_MAX_BUFFERING_PACKET_SIZE, CfgGetInt(f, "MAX_BUFFERING_PACKET_SIZE")); - SiLoadGlobalParamItem(GP_HUB_ARP_SEND_INTERVAL, CfgGetInt(f, "HUB_ARP_SEND_INTERVAL")); - SiLoadGlobalParamItem(GP_MAC_TABLE_EXPIRE_TIME, CfgGetInt(f, "MAC_TABLE_EXPIRE_TIME")); - SiLoadGlobalParamItem(GP_IP_TABLE_EXPIRE_TIME, CfgGetInt(f, "IP_TABLE_EXPIRE_TIME")); - SiLoadGlobalParamItem(GP_IP_TABLE_EXPIRE_TIME_DHCP, CfgGetInt(f, "IP_TABLE_EXPIRE_TIME_DHCP")); - SiLoadGlobalParamItem(GP_STORM_CHECK_SPAN, CfgGetInt(f, "STORM_CHECK_SPAN")); - SiLoadGlobalParamItem(GP_STORM_DISCARD_VALUE_START, CfgGetInt(f, "STORM_DISCARD_VALUE_START")); - SiLoadGlobalParamItem(GP_STORM_DISCARD_VALUE_END, CfgGetInt(f, "STORM_DISCARD_VALUE_END")); - SiLoadGlobalParamItem(GP_MAX_MAC_TABLES, CfgGetInt(f, "MAX_MAC_TABLES")); - SiLoadGlobalParamItem(GP_MAX_IP_TABLES, CfgGetInt(f, "MAX_IP_TABLES")); - SiLoadGlobalParamItem(GP_MAX_HUB_LINKS, CfgGetInt(f, "MAX_HUB_LINKS")); - SiLoadGlobalParamItem(GP_MEM_FIFO_REALLOC_MEM_SIZE, CfgGetInt(f, "MEM_FIFO_REALLOC_MEM_SIZE")); - SiLoadGlobalParamItem(GP_QUEUE_BUDGET, CfgGetInt(f, "QUEUE_BUDGET")); - SiLoadGlobalParamItem(GP_FIFO_BUDGET, CfgGetInt(f, "FIFO_BUDGET")); - - SetFifoCurrentReallocMemSize(MEM_FIFO_REALLOC_MEM_SIZE); -} - -// Load global param itesm -void SiLoadGlobalParamItem(UINT id, UINT value) -{ - // Validate arguments - if (id == 0) - { - return; - } - - vpn_global_parameters[id] = value; -} - -// Write global params -void SiWriteGlobalParamsCfg(FOLDER *f) -{ - // Validate arguments - if (f == NULL) - { - return; - } - - CfgAddInt(f, "MAX_SEND_SOCKET_QUEUE_SIZE", MAX_SEND_SOCKET_QUEUE_SIZE); - CfgAddInt(f, "MIN_SEND_SOCKET_QUEUE_SIZE", MIN_SEND_SOCKET_QUEUE_SIZE); - CfgAddInt(f, "MAX_SEND_SOCKET_QUEUE_NUM", MAX_SEND_SOCKET_QUEUE_NUM); - CfgAddInt(f, "SELECT_TIME", SELECT_TIME); - CfgAddInt(f, "SELECT_TIME_FOR_NAT", SELECT_TIME_FOR_NAT); - CfgAddInt(f, "MAX_STORED_QUEUE_NUM", MAX_STORED_QUEUE_NUM); - CfgAddInt(f, "MAX_BUFFERING_PACKET_SIZE", MAX_BUFFERING_PACKET_SIZE); - CfgAddInt(f, "HUB_ARP_SEND_INTERVAL", HUB_ARP_SEND_INTERVAL); - CfgAddInt(f, "MAC_TABLE_EXPIRE_TIME", MAC_TABLE_EXPIRE_TIME); - CfgAddInt(f, "IP_TABLE_EXPIRE_TIME", IP_TABLE_EXPIRE_TIME); - CfgAddInt(f, "IP_TABLE_EXPIRE_TIME_DHCP", IP_TABLE_EXPIRE_TIME_DHCP); - CfgAddInt(f, "STORM_CHECK_SPAN", STORM_CHECK_SPAN); - CfgAddInt(f, "STORM_DISCARD_VALUE_START", STORM_DISCARD_VALUE_START); - CfgAddInt(f, "STORM_DISCARD_VALUE_END", STORM_DISCARD_VALUE_END); - CfgAddInt(f, "MAX_MAC_TABLES", MAX_MAC_TABLES); - CfgAddInt(f, "MAX_IP_TABLES", MAX_IP_TABLES); - CfgAddInt(f, "MAX_HUB_LINKS", MAX_HUB_LINKS); - CfgAddInt(f, "MEM_FIFO_REALLOC_MEM_SIZE", MEM_FIFO_REALLOC_MEM_SIZE); - CfgAddInt(f, "QUEUE_BUDGET", QUEUE_BUDGET); - CfgAddInt(f, "FIFO_BUDGET", FIFO_BUDGET); -} - -// Write the server-specific settings -void SiWriteServerCfg(FOLDER *f, SERVER *s) -{ - BUF *b; - CEDAR *c; - FOLDER *params_folder; - // Validate arguments - if (f == NULL || s == NULL) - { - return; - } - - CfgAddInt(f, "MaxConcurrentDnsClientThreads", GetGetIpThreadMaxNum()); - - CfgAddInt(f, "CurrentBuild", s->Cedar->Build); - - CfgAddInt(f, "AutoSaveConfigSpan", s->AutoSaveConfigSpanSaved / 1000); - - CfgAddBool(f, "DontBackupConfig", s->DontBackupConfig); - CfgAddBool(f, "BackupConfigOnlyWhenModified", s->BackupConfigOnlyWhenModified); - - CfgAddIp(f, "ListenIP", &s->ListenIP); - - { - char str[MAX_SIZE]; - IntListToStr(str, sizeof(str), s->PortsUDP, ", "); - CfgAddStr(f, "PortsUDP", str); - } - - if (s->Logger != NULL) - { - CfgAddInt(f, "ServerLogSwitchType", s->Logger->SwitchType); - } - - CfgAddInt64(f, "LoggerMaxLogSize", GetMaxLogSize()); - - params_folder = CfgCreateFolder(f, "GlobalParams"); - - if (params_folder != NULL) - { - SiWriteGlobalParamsCfg(params_folder); - } - - c = s->Cedar; - - Lock(c->lock); - { - FOLDER *ff; - Lock(s->Keep->lock); - { - KEEP *k = s->Keep; - CfgAddBool(f, "UseKeepConnect", k->Enable); - CfgAddStr(f, "KeepConnectHost", k->ServerName); - CfgAddInt(f, "KeepConnectPort", k->ServerPort); - CfgAddInt(f, "KeepConnectProtocol", k->UdpMode); - CfgAddInt(f, "KeepConnectInterval", k->Interval / 1000); - } - Unlock(s->Keep->lock); - - // syslog - ff = CfgCreateFolder(f, "SyslogSettings"); - if (ff != NULL) - { - SYSLOG_SETTING set; - - SiGetSysLogSetting(s, &set); - - CfgAddInt(ff, "SaveType", set.SaveType); - CfgAddStr(ff, "HostName", set.Hostname); - CfgAddInt(ff, "Port", set.Port); - } - - // Proto - ff = CfgCreateFolder(f, "Proto"); - if (ff != NULL) - { - SiWriteProtoCfg(ff, s->Proto); - } - - // IPv6 listener disable setting - CfgAddBool(f, "DisableIPv6Listener", s->Cedar->DisableIPv6Listener); - - // DoS - CfgAddBool(f, "DisableDosProtection", s->DisableDosProtection); - - // MaxConnectionsPerIP - CfgAddInt(f, "MaxConnectionsPerIP", GetMaxConnectionsPerIp()); - - // MaxUnestablishedConnections - CfgAddInt(f, "MaxUnestablishedConnections", GetMaxUnestablishedConnections()); - - // DeadLock - CfgAddBool(f, "DisableDeadLockCheck", s->DisableDeadLockCheck); - - // Eraser related - CfgAddInt64(f, "AutoDeleteCheckDiskFreeSpaceMin", s->Eraser->MinFreeSpace); - CfgAddInt(f, "AutoDeleteCheckIntervalSecs", GetEraserCheckInterval()); - - // WebUI - CfgAddBool(f, "UseWebUI", s->UseWebUI); - - - // NoLinuxArpFilter - if (GetOsInfo()->OsType == OSTYPE_LINUX) - { - CfgAddBool(f, "NoLinuxArpFilter", s->NoLinuxArpFilter); - } - - // NoHighPriorityProcess - CfgAddBool(f, "NoHighPriorityProcess", s->NoHighPriorityProcess); - -#ifdef OS_WIN32 - CfgAddBool(f, "NoDebugDump", s->NoDebugDump); -#endif // OS_WIN32 - - if (s->ServerType == SERVER_TYPE_STANDALONE) - { - if (c->Bridge == false) - { - // Disable the NAT-traversal feature - CfgAddBool(f, "DisableNatTraversal", s->DisableNatTraversal); - } - } - - CfgAddBool(f, "DisableIPsecAggressiveMode", s->DisableIPsecAggressiveMode); - - if (c->Bridge == false) - { - // VPN over ICMP - CfgAddBool(f, "EnableVpnOverIcmp", s->EnableVpnOverIcmp); - - // VPN over DNS - CfgAddBool(f, "EnableVpnOverDns", s->EnableVpnOverDns); - } - - // WebTimePage - CfgAddBool(f, "UseWebTimePage", s->UseWebTimePage); - - // Debug log - CfgAddBool(f, "SaveDebugLog", s->SaveDebugLog); - - // Let the client not to send a signature - CfgAddBool(f, "NoSendSignature", s->NoSendSignature); - - // Server certificate - b = XToBuf(c->ServerX, false); - CfgAddBuf(f, "ServerCert", b); - FreeBuf(b); - - // Server private key - b = KToBuf(c->ServerK, false, NULL); - CfgAddBuf(f, "ServerKey", b); - FreeBuf(b); - - { - // Character which separates the username from the hub name - char str[2]; - StrCpy(str, sizeof(str), &c->UsernameHubSeparator); - CfgAddStr(f, "UsernameHubSeparator", str); - } - - // Traffic information - Lock(c->TrafficLock); - { - SiWriteTraffic(f, "ServerTraffic", c->Traffic); - } - Unlock(c->TrafficLock); - - // Type of server - if (s->Cedar->Bridge == false) - { - CfgAddInt(f, "ServerType", s->UpdatedServerType); - } - - // Cipher Name - CfgAddStr(f, "CipherName", s->Cedar->CipherList); - - // Password - CfgAddByte(f, "HashedPassword", s->HashedPassword, sizeof(s->HashedPassword)); - - if (s->UpdatedServerType == SERVER_TYPE_FARM_MEMBER) - { - char tmp[6 * MAX_PUBLIC_PORT_NUM + 1]; - UINT i; - // Setting items in the case of farm members - CfgAddStr(f, "ControllerName", s->ControllerName); - CfgAddInt(f, "ControllerPort", s->ControllerPort); - CfgAddByte(f, "MemberPassword", s->MemberPassword, SHA1_SIZE); - CfgAddIp32(f, "PublicIp", s->PublicIp); - tmp[0] = 0; - for (i = 0;i < s->NumPublicPort;i++) - { - char tmp2[MAX_SIZE]; - ToStr(tmp2, s->PublicPorts[i]); - StrCat(tmp, sizeof(tmp), tmp2); - StrCat(tmp, sizeof(tmp), ","); - } - if (StrLen(tmp) >= 1) - { - if (tmp[StrLen(tmp) - 1] == ',') - { - tmp[StrLen(tmp) - 1] = 0; - } - } - CfgAddStr(f, "PublicPorts", tmp); - } - - if (s->UpdatedServerType != SERVER_TYPE_STANDALONE) - { - CfgAddInt(f, "ClusterMemberWeight", s->Weight); - } - - if (s->UpdatedServerType == SERVER_TYPE_FARM_CONTROLLER) - { - CfgAddBool(f, "ControllerOnly", s->ControllerOnly); - } - - // VPN Azure Client - if (s->AzureClient != NULL) - { - CfgAddBool(f, "EnableVpnAzure", s->EnableVpnAzure); - } - - CfgAddBool(f, "DisableGetHostNameWhenAcceptTcp", s->DisableGetHostNameWhenAcceptTcp); - CfgAddBool(f, "DisableCoreDumpOnUnix", s->DisableCoreDumpOnUnix); - - CfgAddBool(f, "Tls_Disable1_0", c->SslAcceptSettings.Tls_Disable1_0); - CfgAddBool(f, "Tls_Disable1_1", c->SslAcceptSettings.Tls_Disable1_1); - CfgAddBool(f, "Tls_Disable1_2", c->SslAcceptSettings.Tls_Disable1_2); - CfgAddBool(f, "Tls_Disable1_3", c->SslAcceptSettings.Tls_Disable1_3); - CfgAddBool(f, "Override_Security_Level", c->SslAcceptSettings.Override_Security_Level); - CfgAddInt(f, "Override_Security_Level_Value", c->SslAcceptSettings.Override_Security_Level_Value); - CfgAddInt(f, "DhParamBits", c->DhParamBits); - - // Disable session reconnect - CfgAddBool(f, "DisableSessionReconnect", GetGlobalServerFlag(GSF_DISABLE_SESSION_RECONNECT)); - - CfgAddBool(f, "StrictSyslogDatetimeFormat", s->StrictSyslogDatetimeFormat); - - // Disable JSON-RPC Web API - CfgAddBool(f, "DisableJsonRpcWebApi", s->DisableJsonRpcWebApi); - } - Unlock(c->lock); -} - -void SiLoadProtoCfg(PROTO *p, FOLDER *f) -{ - UINT i; - - if (p == NULL || f == NULL) - { - return; - } - - for (i = 0; i < LIST_NUM(p->Containers); ++i) - { - UINT j; - const PROTO_CONTAINER *container = LIST_DATA(p->Containers, i); - LIST *options = container->Options; - FOLDER *ff = CfgGetFolder(f, container->Name); - if (ff == NULL) - { - continue; - } - - LockList(options); - - for (j = 0; j < LIST_NUM(options); ++j) - { - PROTO_OPTION *option = LIST_DATA(options, j); - switch (option->Type) - { - case PROTO_OPTION_BOOL: - option->Bool = CfgGetBool(ff, option->Name); - break; - case PROTO_OPTION_STRING: - { - UINT size; - char buf[MAX_SIZE]; - if (CfgGetStr(ff, option->Name, buf, sizeof(buf)) == false) - { - continue; - } - - size = StrLen(buf) + 1; - option->String = ReAlloc(option->String, size); - StrCpy(option->String, size, buf); - - break; - } - default: - Debug("SiLoadProtoCfg(): unhandled option type %u!\n", option->Type); - } - } - - UnlockList(options); - } -} - -void SiWriteProtoCfg(FOLDER *f, PROTO *p) -{ - UINT i; - - if (f == NULL || p == NULL) - { - return; - } - - for (i = 0; i < LIST_NUM(p->Containers); ++i) - { - UINT j; - const PROTO_CONTAINER *container = LIST_DATA(p->Containers, i); - LIST *options = container->Options; - FOLDER *ff = CfgCreateFolder(f, container->Name); - - LockList(options); - - for (j = 0; j < LIST_NUM(options); ++j) - { - const PROTO_OPTION *option = LIST_DATA(options, j); - switch (option->Type) - { - case PROTO_OPTION_BOOL: - CfgAddBool(ff, option->Name, option->Bool); - break; - case PROTO_OPTION_STRING: - CfgAddStr(ff, option->Name, option->String); - break; - default: - Debug("SiWriteProtoCfg(): unhandled option type %u!\n", option->Type); - } - } - - UnlockList(options); - } -} - -// Read the traffic information -void SiLoadTraffic(FOLDER *parent, char *name, TRAFFIC *t) -{ - FOLDER *f; - // Validate arguments - if (t != NULL) - { - Zero(t, sizeof(TRAFFIC)); - } - if (parent == NULL || name == NULL || t == NULL) - { - return; - } - - f = CfgGetFolder(parent, name); - - if (f == NULL) - { - return; - } - - SiLoadTrafficInner(f, "SendTraffic", &t->Send); - SiLoadTrafficInner(f, "RecvTraffic", &t->Recv); -} -void SiLoadTrafficInner(FOLDER *parent, char *name, TRAFFIC_ENTRY *e) -{ - FOLDER *f; - // Validate arguments - if (e != NULL) - { - Zero(e, sizeof(TRAFFIC_ENTRY)); - } - if (parent == NULL || name == NULL || e == NULL) - { - return; - } - - f = CfgGetFolder(parent, name); - if (f == NULL) - { - return; - } - - e->BroadcastCount = CfgGetInt64(f, "BroadcastCount"); - e->BroadcastBytes = CfgGetInt64(f, "BroadcastBytes"); - e->UnicastCount = CfgGetInt64(f, "UnicastCount"); - e->UnicastBytes = CfgGetInt64(f, "UnicastBytes"); -} - -// Write the traffic information -void SiWriteTraffic(FOLDER *parent, char *name, TRAFFIC *t) -{ - FOLDER *f; - // Validate arguments - if (parent == NULL || name == NULL || t == NULL) - { - return; - } - - f = CfgCreateFolder(parent, name); - - SiWriteTrafficInner(f, "SendTraffic", &t->Send); - SiWriteTrafficInner(f, "RecvTraffic", &t->Recv); -} -void SiWriteTrafficInner(FOLDER *parent, char *name, TRAFFIC_ENTRY *e) -{ - FOLDER *f; - // Validate arguments - if (parent == NULL || name == NULL || e == NULL) - { - return; - } - - f = CfgCreateFolder(parent, name); - CfgAddInt64(f, "BroadcastCount", e->BroadcastCount); - CfgAddInt64(f, "BroadcastBytes", e->BroadcastBytes); - CfgAddInt64(f, "UnicastCount", e->UnicastCount); - CfgAddInt64(f, "UnicastBytes", e->UnicastBytes); -} - -// Thread for writing configuration file -void SiSaverThread(THREAD *thread, void *param) -{ - SERVER *s = (SERVER *)param; - // Validate arguments - if (thread == NULL || param == NULL) - { - return; - } - - while (s->Halt == false) - { - // Save to the configuration file - if (s->NoMoreSave == false) - { - SiWriteConfigurationFile(s); - } - - Wait(s->SaveHaltEvent, s->AutoSaveConfigSpan); - } -} - -// Write to the configuration file -UINT SiWriteConfigurationFile(SERVER *s) -{ - UINT ret; - // Validate arguments - if (s == NULL) - { - return 0; - } - - if (s->CfgRw == NULL) - { - return 0; - } - - if (s->NoMoreSave) - { - return 0; - } - - Lock(s->SaveCfgLock); - { - FOLDER *f; - - Debug("save: SiWriteConfigurationToCfg() start.\n"); - f = SiWriteConfigurationToCfg(s); - Debug("save: SiWriteConfigurationToCfg() finished.\n"); - - Debug("save: SaveCfgRw() start.\n"); - ret = SaveCfgRwEx(s->CfgRw, f, s->BackupConfigOnlyWhenModified ? s->ConfigRevision : INFINITE); - Debug("save: SaveCfgRw() finished.\n"); - - Debug("save: CfgDeleteFolder() start.\n"); - CfgDeleteFolder(f); - Debug("save: CfgDeleteFolder() finished.\n"); - } - Unlock(s->SaveCfgLock); - - return ret; -} - -// Release the configuration -void SiFreeConfiguration(SERVER *s) -{ - // Validate arguments - if (s == NULL) - { - return; - } - - // Write to the configuration file - SiWriteConfigurationFile(s); - - // Terminate the configuration file saving thread - s->NoMoreSave = true; - s->Halt = true; - Set(s->SaveHaltEvent); - WaitThread(s->SaveThread, INFINITE); - - ReleaseEvent(s->SaveHaltEvent); - ReleaseThread(s->SaveThread); - - s->SaveHaltEvent = NULL; - s->SaveThread = NULL; - - // Stop the protocols handler - if (s->Proto != NULL) - { - ProtoDelete(s->Proto); - } - - // Stop the IPsec server - if (s->IPsecServer != NULL) - { - FreeIPsecServer(s->IPsecServer); - s->IPsecServer = NULL; - } - - // Terminate the DDNS client - if (s->DDnsClient != NULL) - { - FreeDDNSClient(s->DDnsClient); - s->DDnsClient = NULL; - } - - // Terminate the VPN Azure client - if (s->AzureClient != NULL) - { - FreeAzureClient(s->AzureClient); - s->AzureClient = NULL; - } - - FreeCfgRw(s->CfgRw); - s->CfgRw = NULL; - - // Release the Ethernet - FreeEth(); -} - -// Initialize the StXxx related function -void StInit() -{ - if (server_lock != NULL) - { - return; - } - - server_lock = NewLock(); -} - -// Release the StXxx related function -void StFree() -{ - DeleteLock(server_lock); - server_lock = NULL; -} - -// Start the server -void StStartServer(bool bridge) -{ - Lock(server_lock); - { - if (server != NULL) - { - // It has already started - Unlock(server_lock); - return; - } - - // Create a server - server = SiNewServer(bridge); - } - Unlock(server_lock); - -// StartCedarLog(); -} - -// Stop the server -void StStopServer() -{ - Lock(server_lock); - { - if (server == NULL) - { - // Not started - Unlock(server_lock); - return; - } - - // Release the server - SiReleaseServer(server); - server = NULL; - } - Unlock(server_lock); - - StopCedarLog(); -} - -// Set the type of server -void SiSetServerType(SERVER *s, UINT type, - UINT ip, UINT num_port, UINT *ports, - char *controller_name, UINT controller_port, UCHAR *password, UINT weight, bool controller_only) -{ - bool bridge; - // Validate arguments - if (s == NULL) - { - return; - } - if (type == SERVER_TYPE_FARM_MEMBER && - (num_port == 0 || ports == NULL || controller_name == NULL || - controller_port == 0 || password == NULL || num_port > MAX_PUBLIC_PORT_NUM)) - { - return; - } - if (weight == 0) - { - weight = FARM_DEFAULT_WEIGHT; - } - - bridge = s->Cedar->Bridge; - - Lock(s->lock); - { - // Update types - s->UpdatedServerType = type; - - s->Weight = weight; - - // Set the value - if (type == SERVER_TYPE_FARM_MEMBER) - { - StrCpy(s->ControllerName, sizeof(s->ControllerName), controller_name); - s->ControllerPort = controller_port; - if (IsZero(password, SHA1_SIZE) == false) - { - Copy(s->MemberPassword, password, SHA1_SIZE); - } - s->PublicIp = ip; - s->NumPublicPort = num_port; - if (s->PublicPorts != NULL) - { - Free(s->PublicPorts); - } - s->PublicPorts = ZeroMalloc(num_port * sizeof(UINT)); - Copy(s->PublicPorts, ports, num_port * sizeof(UINT)); - } - - if (type == SERVER_TYPE_FARM_CONTROLLER) - { - s->ControllerOnly = controller_only; - } - } - Unlock(s->lock); - - // Restart the server - SiRebootServer(bridge); -} - -// Thread to restart the server -void SiRebootServerThread(THREAD *thread, void *param) -{ - // Validate arguments - if (thread == NULL) - { - return; - } - - if (server == NULL) - { - return; - } - - // Stop the server - StStopServer(); - - // Start the server - StStartServer((bool)param); -} - -// Restart the server -void SiRebootServer(bool bridge) -{ - SiRebootServerEx(bridge, false); -} -void SiRebootServerEx(bool bridge, bool reset_setting) -{ - THREAD *t; - - server_reset_setting = reset_setting; - - t = NewThread(SiRebootServerThread, (void *)bridge); - ReleaseThread(t); -} - -// Set the state of the special listener -void SiApplySpecialListenerStatus(SERVER *s) -{ - // Validate arguments - if (s == NULL) - { - return; - } - - if (s->DynListenerDns != NULL) - { - *s->DynListenerDns->EnablePtr = s->EnableVpnOverDns; - ApplyDynamicListener(s->DynListenerDns); - } - - if (s->DynListenerIcmp != NULL) - { - *s->DynListenerIcmp->EnablePtr = s->EnableVpnOverIcmp; - ApplyDynamicListener(s->DynListenerIcmp); - } -} - -// Stop all listeners -void SiStopAllListener(SERVER *s) -{ - // Validate arguments - if (s == NULL) - { - return; - } - - SiLockListenerList(s); - { - UINT i; - LIST *o = NewListFast(NULL); - for (i = 0;i < LIST_NUM(s->ServerListenerList);i++) - { - SERVER_LISTENER *e = LIST_DATA(s->ServerListenerList, i); - Add(o, e); - } - - for (i = 0;i < LIST_NUM(o);i++) - { - SERVER_LISTENER *e = LIST_DATA(o, i); - SiDeleteListener(s, e->Port); - } - - ReleaseList(o); - } - SiUnlockListenerList(s); - - ReleaseList(s->ServerListenerList); - - // Stop the VPN over ICMP listener - FreeDynamicListener(s->DynListenerIcmp); - s->DynListenerIcmp = NULL; - - // Stop the VPN over DNS listener - FreeDynamicListener(s->DynListenerDns); - s->DynListenerDns = NULL; -} - -// Clean-up the server -void SiCleanupServer(SERVER *s) -{ - UINT i; - CEDAR *c; - LISTENER **listener_list; - UINT num_listener; - HUB **hub_list; - UINT num_hub; - // Validate arguments - if (s == NULL) - { - return; - } - - SiFreeDeadLockCheck(s); - - - c = s->Cedar; - - if (s->ServerType == SERVER_TYPE_FARM_MEMBER) - { - // In the case of farm members, stop the connection to the farm controller - SLog(c, "LS_STOP_FARM_MEMBER"); - SiStopConnectToController(s->FarmController); - s->FarmController = NULL; - SLog(c, "LS_STOP_FARM_MEMBER_2"); - } - - IncrementServerConfigRevision(s); - - SLog(c, "LS_END_2"); - - SLog(c, "LS_STOP_ALL_LISTENER"); - // Stop all listeners - LockList(c->ListenerList); - { - listener_list = ToArray(c->ListenerList); - num_listener = LIST_NUM(c->ListenerList); - for (i = 0;i < num_listener;i++) - { - AddRef(listener_list[i]->ref); - } - } - UnlockList(c->ListenerList); - - for (i = 0;i < num_listener;i++) - { - StopListener(listener_list[i]); - ReleaseListener(listener_list[i]); - } - Free(listener_list); - SLog(c, "LS_STOP_ALL_LISTENER_2"); - - SLog(c, "LS_STOP_ALL_HUB"); - // Stop all HUBs - LockList(c->HubList); - { - hub_list = ToArray(c->HubList); - num_hub = LIST_NUM(c->HubList); - for (i = 0;i < num_hub;i++) - { - AddRef(hub_list[i]->ref); - } - } - UnlockList(c->HubList); - - for (i = 0;i < num_hub;i++) - { - StopHub(hub_list[i]); - ReleaseHub(hub_list[i]); - } - Free(hub_list); - SLog(c, "LS_STOP_ALL_HUB_2"); - - // Release the configuration - SiFreeConfiguration(s); - - // Stop the Cedar - SLog(c, "LS_STOP_CEDAR"); - StopCedar(s->Cedar); - SLog(c, "LS_STOP_CEDAR_2"); - - // Stop all listeners - SiStopAllListener(s); - - ReleaseIntList(s->PortsUDP); - - if (s->ServerType == SERVER_TYPE_FARM_CONTROLLER) - { - // In the case of farm controller - UINT i; - - SLog(c, "LS_STOP_FARM_CONTROL"); - - // Stop the farm controling - SiStopFarmControl(s); - - // Release the farm member information - ReleaseList(s->FarmMemberList); - s->FarmMemberList = NULL; - - for (i = 0;i < LIST_NUM(s->Me->HubList);i++) - { - Free(LIST_DATA(s->Me->HubList, i)); - } - ReleaseList(s->Me->HubList); - - Free(s->Me); - - SLog(c, "LS_STOP_FARM_CONTROL_2"); - } - - if (s->PublicPorts != NULL) - { - Free(s->PublicPorts); - } - - SLog(s->Cedar, "LS_END_1"); - SLog(s->Cedar, "L_LINE"); - -#ifdef ENABLE_AZURE_SERVER - if (s->AzureServer != NULL) - { - FreeAzureServer(s->AzureServer); - } -#endif // ENABLE_AZURE_SERVER - - ReleaseCedar(s->Cedar); - DeleteLock(s->lock); - DeleteLock(s->SaveCfgLock); - - StopKeep(s->Keep); - - FreeEraser(s->Eraser); - - - FreeLog(s->Logger); - - FreeSysLog(s->Syslog); - DeleteLock(s->SyslogLock); - - FreeServerCapsCache(s); - - SiFreeHubCreateHistory(s); - - // Stop the debug log - FreeTinyLog(s->DebugLog); - - DeleteLock(s->TasksFromFarmControllerLock); - DeleteLock(s->OpenVpnSstpConfigLock); - - - Free(s); -} - -// Release the server -void SiReleaseServer(SERVER *s) -{ - // Validate arguments - if (s == NULL) - { - return; - } - - if (Release(s->ref) == 0) - { - SiCleanupServer(s); - } -} - -// Get the URL of the member selector -bool SiGetMemberSelectorUrl(char *url, UINT url_size) -{ - BUF *b; - bool ret = false; - // Validate arguments - if (url == NULL) - { - return false; - } - - b = ReadDump(MEMBER_SELECTOR_TXT_FILENAME); - if (b == NULL) - { - return false; - } - - while (true) - { - char *line = CfgReadNextLine(b); - if (line == NULL) - { - break; - } - - Trim(line); - - if (IsEmptyStr(line) == false && ret == false) - { - StrCpy(url, url_size, line); - ret = true; - } - - Free(line); - } - - FreeBuf(b); - - return ret; -} - -// Specify the farm member for the next processing -FARM_MEMBER *SiGetNextFarmMember(SERVER *s, CONNECTION *c, HUB *h) -{ - UINT i, num; - UINT min_point = 0; - FARM_MEMBER *ret = NULL; - PACK *p; - char url[MAX_SIZE]; - // Validate arguments - if (s == NULL || s->ServerType != SERVER_TYPE_FARM_CONTROLLER || c == NULL || h == NULL) - { - return NULL; - } - - num = LIST_NUM(s->FarmMemberList); - if (num == 0) - { - return NULL; - } - - if (SiGetMemberSelectorUrl(url, sizeof(url))) - { - UINT64 ret_key = 0; - // Generate the data for the member selector - p = NewPack(); - for (i = 0;i < num;i++) - { - UINT num_sessions; - UINT max_sessions; - FARM_MEMBER *f = LIST_DATA(s->FarmMemberList, i); - bool do_not_select = false; - if (s->ControllerOnly) - { - if (f->Me) - { - // No to select myself in the case of ControllerOnly - do_not_select = true; - } - } - - if (f->Me == false) - { - num_sessions = f->NumSessions; - max_sessions = f->MaxSessions; - } - else - { - num_sessions = Count(s->Cedar->CurrentSessions); - max_sessions = GetServerCapsInt(s, "i_max_sessions"); - } - - if (max_sessions == 0) - { - max_sessions = GetServerCapsInt(s, "i_max_sessions"); - } - - if (num_sessions >= max_sessions) - { - do_not_select = true; - } - - if (true) - { - UINT point = f->Point; - char public_ip_str[MAX_SIZE]; - - IPToStr32(public_ip_str, sizeof(public_ip_str), f->Ip); - - PackAddIntEx(p, "Point", point, i, num); - PackAddInt64Ex(p, "Key", (UINT64)f, i, num); - PackAddStrEx(p, "Hostname", f->hostname, i, num); - PackAddStrEx(p, "PublicIp", public_ip_str, i, num); - PackAddIntEx(p, "NumSessions", num_sessions, i, num); - PackAddIntEx(p, "MaxSessions", max_sessions, i, num); - PackAddIntEx(p, "AssignedClientLicense", f->AssignedClientLicense, i, num); - PackAddIntEx(p, "AssignedBridgeLicense", f->AssignedBridgeLicense, i, num); - PackAddIntEx(p, "Weight", f->Weight, i, num); - PackAddDataEx(p, "RandomKey", f->RandomKey, SHA1_SIZE, i, num); - PackAddIntEx(p, "NumTcpConnections", f->NumTcpConnections, i, num); - PackAddIntEx(p, "NumHubs", LIST_NUM(f->HubList), i, num); - PackAddBoolEx(p, "Me", f->Me, i, num); - PackAddTime64Ex(p, "ConnectedTime", f->ConnectedTime, i, num); - PackAddInt64Ex(p, "SystemId", f->SystemId, i, num); - PackAddBoolEx(p, "DoNotSelect", do_not_select, i, num); - } - } - - if (true) - { - char client_ip_str[MAX_SIZE]; - UINT client_port = 0; - UINT server_port = 0; - SOCK *s = c->FirstSock; - - Zero(client_ip_str, sizeof(client_ip_str)); - if (s != NULL) - { - IPToStr(client_ip_str, sizeof(client_ip_str), &s->RemoteIP); - client_port = s->RemotePort; - server_port = s->LocalPort; - } - - PackAddStr(p, "ClientIp", client_ip_str); - PackAddInt(p, "ClientPort", client_port); - PackAddInt(p, "ServerPort", server_port); - - PackAddInt(p, "ClientBuild", c->ClientBuild); - PackAddStr(p, "CipherName", c->CipherName); - PackAddStr(p, "ClientStr", c->ClientStr); - PackAddInt(p, "ClientVer", c->ClientVer); - PackAddTime64(p, "ConnectedTime", Tick64ToTime64(c->ConnectedTick)); - - PackAddStr(p, "HubName", h->Name); - PackAddBool(p, "StaticHub", h->Type == HUB_TYPE_FARM_STATIC); - } - - PackAddInt(p, "NumMembers", num); - - // Make the member selector choose a member - UnlockList(s->FarmMemberList); - Unlock(s->Cedar->CedarSuperLock); - { - PACK *ret; - - Debug("Calling %s ...\n", url); - - ret = WpcCall(url, NULL, MEMBER_SELECTOR_CONNECT_TIMEOUT, MEMBER_SELECTOR_DATA_TIMEOUT, - "Select", p, NULL, NULL, NULL); - - if (GetErrorFromPack(ret) == ERR_NO_ERROR) - { - ret_key = PackGetInt64(ret, "Key"); - Debug("Ret Key = %I64u\n", ret_key); - } - else - { - Debug("Error: %u\n", GetErrorFromPack(ret)); - } - - FreePack(ret); - } - Lock(s->Cedar->CedarSuperLock); - LockList(s->FarmMemberList); - - FreePack(p); - - if (ret_key != 0) - { - FARM_MEMBER *f = (FARM_MEMBER *)ret_key; - if (IsInList(s->FarmMemberList, f)) - { - Debug("Farm Member Selected by Selector: %s\n", f->hostname); - - return f; - } - else - { - Debug("Farm Member Key = %I64u Not Found.\n", ret_key); - } - } - else - { - // The member selector failed to select a member - return NULL; - } - } - - num = LIST_NUM(s->FarmMemberList); - if (num == 0) - { - return NULL; - } - - for (i = 0;i < num;i++) - { - UINT num_sessions; - UINT max_sessions; - FARM_MEMBER *f = LIST_DATA(s->FarmMemberList, i); - if (s->ControllerOnly) - { - if (f->Me) - { - // No to select myself in the case of ControllerOnly - continue; - } - } - - if (f->Me == false) - { - num_sessions = f->NumSessions; - max_sessions = f->MaxSessions; - } - else - { - num_sessions = Count(s->Cedar->CurrentSessions); - max_sessions = GetServerCapsInt(s, "i_max_sessions"); - } - - if (max_sessions == 0) - { - max_sessions = GetServerCapsInt(s, "i_max_sessions"); - } - - if (num_sessions < max_sessions) - { - if (f->Point >= min_point) - { - min_point = f->Point; - ret = f; - } - } - } - - return ret; -} - -// Receive a HUB enumeration directive -void SiCalledEnumHub(SERVER *s, PACK *p, PACK *req) -{ - UINT i; - CEDAR *c; - // Validate arguments - if (s == NULL || p == NULL || req == NULL) - { - return; - } - - - c = s->Cedar; - - LockList(c->HubList); - { - UINT num = LIST_NUM(c->HubList); - for (i = 0;i < num;i++) - { - HUB *h = LIST_DATA(c->HubList, i); - Lock(h->lock); - { - PackAddStrEx(p, "HubName", h->Name, i, num); - PackAddIntEx(p, "HubType", h->Type, i, num); - PackAddIntEx(p, "NumSession", Count(h->NumSessions), i, num); - - PackAddIntEx(p, "NumSessions", LIST_NUM(h->SessionList), i, num); - PackAddIntEx(p, "NumSessionsClient", Count(h->NumSessionsClient), i, num); - PackAddIntEx(p, "NumSessionsBridge", Count(h->NumSessionsBridge), i, num); - - PackAddIntEx(p, "NumMacTables", HASH_LIST_NUM(h->MacHashTable), i, num); - - PackAddIntEx(p, "NumIpTables", LIST_NUM(h->IpTable), i, num); - - PackAddTime64Ex(p, "LastCommTime", h->LastCommTime, i, num); - PackAddTime64Ex(p, "CreatedTime", h->CreatedTime, i, num); - } - Unlock(h->lock); - } - } - UnlockList(c->HubList); - - PackAddInt(p, "Point", SiGetPoint(s)); - PackAddInt(p, "NumTcpConnections", Count(s->Cedar->CurrentTcpConnections)); - PackAddInt(p, "NumTotalSessions", Count(s->Cedar->CurrentSessions)); - PackAddInt(p, "MaxSessions", GetServerCapsInt(s, "i_max_sessions")); - - PackAddInt(p, "AssignedClientLicense", Count(s->Cedar->AssignedClientLicense)); - PackAddInt(p, "AssignedBridgeLicense", Count(s->Cedar->AssignedBridgeLicense)); - - PackAddData(p, "RandomKey", s->MyRandomKey, SHA1_SIZE); - - - Lock(c->TrafficLock); - { - OutRpcTraffic(p, c->Traffic); - } - Unlock(c->TrafficLock); - - LockList(c->TrafficDiffList); - { - UINT num = LIST_NUM(c->TrafficDiffList); - UINT i; - - for (i = 0;i < num;i++) - { - TRAFFIC_DIFF *d = LIST_DATA(c->TrafficDiffList, i); - - PackAddIntEx(p, "TdType", d->Type, i, num); - PackAddStrEx(p, "TdHubName", d->HubName, i, num); - PackAddStrEx(p, "TdName", d->Name, i, num); - - OutRpcTrafficEx(&d->Traffic, p, i, num); - - Free(d->HubName); - Free(d->Name); - Free(d); - } - - DeleteAll(c->TrafficDiffList); - } - UnlockList(c->TrafficDiffList); -} - -// Receive a HUB delete directive -void SiCalledDeleteHub(SERVER *s, PACK *p) -{ - char name[MAX_SIZE]; - HUB *h; - // Validate arguments - if (s == NULL || p == NULL) - { - return; - } - - if (PackGetStr(p, "HubName", name, sizeof(name)) == false) - { - return; - } - - LockHubList(s->Cedar); - - h = GetHub(s->Cedar, name); - if (h == NULL) - { - UnlockHubList(s->Cedar); - return; - } - UnlockHubList(s->Cedar); - - SetHubOffline(h); - - LockHubList(s->Cedar); - - DelHubEx(s->Cedar, h, true); - - UnlockHubList(s->Cedar); - - ReleaseHub(h); -} - -// Receive a HUB update directive -void SiCalledUpdateHub(SERVER *s, PACK *p) -{ - char name[MAX_SIZE]; - UINT type; - HUB_OPTION o; - HUB_LOG log; - bool save_packet_log; - UINT packet_log_switch_type; - UINT packet_log_config[NUM_PACKET_LOG]; - bool save_security_log; - bool type_changed = false; - UINT security_log_switch_type; - UINT i; - HUB *h; - // Validate arguments - if (s == NULL || p == NULL) - { - return; - } - - PackGetStr(p, "HubName", name, sizeof(name)); - type = PackGetInt(p, "HubType"); - Zero(&o, sizeof(o)); - o.MaxSession = PackGetInt(p, "MaxSession"); - o.NoArpPolling = PackGetBool(p, "NoArpPolling"); - o.NoIPv6AddrPolling = PackGetBool(p, "NoIPv6AddrPolling"); - o.FilterPPPoE = PackGetBool(p, "FilterPPPoE"); - o.YieldAfterStorePacket = PackGetBool(p, "YieldAfterStorePacket"); - o.NoSpinLockForPacketDelay = PackGetBool(p, "NoSpinLockForPacketDelay"); - o.BroadcastStormDetectionThreshold = PackGetInt(p, "BroadcastStormDetectionThreshold"); - o.ClientMinimumRequiredBuild = PackGetInt(p, "ClientMinimumRequiredBuild"); - o.FixForDLinkBPDU = PackGetBool(p, "FixForDLinkBPDU"); - o.BroadcastLimiterStrictMode = PackGetBool(p, "BroadcastLimiterStrictMode"); - o.NoLookBPDUBridgeId = PackGetBool(p, "NoLookBPDUBridgeId"); - o.NoManageVlanId = PackGetBool(p, "NoManageVlanId"); - o.MaxLoggedPacketsPerMinute = PackGetInt(p, "MaxLoggedPacketsPerMinute"); - o.FloodingSendQueueBufferQuota = PackGetInt(p, "FloodingSendQueueBufferQuota"); - o.DoNotSaveHeavySecurityLogs = PackGetBool(p, "DoNotSaveHeavySecurityLogs"); - o.DropBroadcastsInPrivacyFilterMode = PackGetBool(p, "DropBroadcastsInPrivacyFilterMode"); - o.DropArpInPrivacyFilterMode = PackGetBool(p, "DropArpInPrivacyFilterMode"); - o.SuppressClientUpdateNotification = PackGetBool(p, "SuppressClientUpdateNotification"); - o.AssignVLanIdByRadiusAttribute = PackGetBool(p, "AssignVLanIdByRadiusAttribute"); - o.DenyAllRadiusLoginWithNoVlanAssign = PackGetBool(p, "DenyAllRadiusLoginWithNoVlanAssign"); - o.SecureNAT_RandomizeAssignIp = PackGetBool(p, "SecureNAT_RandomizeAssignIp"); - o.DetectDormantSessionInterval = PackGetInt(p, "DetectDormantSessionInterval"); - o.VlanTypeId = PackGetInt(p, "VlanTypeId"); - o.NoPhysicalIPOnPacketLog = PackGetBool(p, "NoPhysicalIPOnPacketLog"); - if (o.VlanTypeId == 0) - { - o.VlanTypeId = MAC_PROTO_TAGVLAN; - } - o.FilterOSPF = PackGetBool(p, "FilterOSPF"); - o.FilterIPv4 = PackGetBool(p, "FilterIPv4"); - o.FilterIPv6 = PackGetBool(p, "FilterIPv6"); - o.FilterNonIP = PackGetBool(p, "FilterNonIP"); - o.NoIPv4PacketLog = PackGetBool(p, "NoIPv4PacketLog"); - o.NoIPv6PacketLog = PackGetBool(p, "NoIPv6PacketLog"); - o.FilterBPDU = PackGetBool(p, "FilterBPDU"); - o.NoIPv6DefaultRouterInRAWhenIPv6 = PackGetBool(p, "NoIPv6DefaultRouterInRAWhenIPv6"); - o.NoMacAddressLog = PackGetBool(p, "NoMacAddressLog"); - o.ManageOnlyPrivateIP = PackGetBool(p, "ManageOnlyPrivateIP"); - o.ManageOnlyLocalUnicastIPv6 = PackGetBool(p, "ManageOnlyLocalUnicastIPv6"); - o.DisableIPParsing = PackGetBool(p, "DisableIPParsing"); - o.NoIpTable = PackGetBool(p, "NoIpTable"); - o.NoEnum = PackGetBool(p, "NoEnum"); - o.AdjustTcpMssValue = PackGetInt(p, "AdjustTcpMssValue"); - o.DisableAdjustTcpMss = PackGetBool(p, "DisableAdjustTcpMss"); - o.NoDhcpPacketLogOutsideHub = PackGetBool(p, "NoDhcpPacketLogOutsideHub"); - o.DisableHttpParsing = PackGetBool(p, "DisableHttpParsing"); - o.DisableUdpAcceleration = PackGetBool(p, "DisableUdpAcceleration"); - o.DisableUdpFilterForLocalBridgeNic = PackGetBool(p, "DisableUdpFilterForLocalBridgeNic"); - o.ApplyIPv4AccessListOnArpPacket = PackGetBool(p, "ApplyIPv4AccessListOnArpPacket"); - o.RemoveDefGwOnDhcpForLocalhost = PackGetBool(p, "RemoveDefGwOnDhcpForLocalhost"); - o.SecureNAT_MaxTcpSessionsPerIp = PackGetInt(p, "SecureNAT_MaxTcpSessionsPerIp"); - o.SecureNAT_MaxTcpSynSentPerIp = PackGetInt(p, "SecureNAT_MaxTcpSynSentPerIp"); - o.SecureNAT_MaxUdpSessionsPerIp = PackGetInt(p, "SecureNAT_MaxUdpSessionsPerIp"); - o.SecureNAT_MaxDnsSessionsPerIp = PackGetInt(p, "SecureNAT_MaxDnsSessionsPerIp"); - o.SecureNAT_MaxIcmpSessionsPerIp = PackGetInt(p, "SecureNAT_MaxIcmpSessionsPerIp"); - o.AccessListIncludeFileCacheLifetime = PackGetInt(p, "AccessListIncludeFileCacheLifetime"); - if (o.AccessListIncludeFileCacheLifetime == 0) - { - o.AccessListIncludeFileCacheLifetime = ACCESS_LIST_INCLUDE_FILE_CACHE_LIFETIME; - } - o.DisableKernelModeSecureNAT = PackGetBool(p, "DisableKernelModeSecureNAT"); - o.DisableIpRawModeSecureNAT = PackGetBool(p, "DisableIpRawModeSecureNAT"); - o.DisableUserModeSecureNAT = PackGetBool(p, "DisableUserModeSecureNAT"); - o.DisableCheckMacOnLocalBridge = PackGetBool(p, "DisableCheckMacOnLocalBridge"); - o.DisableCorrectIpOffloadChecksum = PackGetBool(p, "DisableCorrectIpOffloadChecksum"); - o.UseHubNameAsDhcpUserClassOption = PackGetBool(p, "UseHubNameAsDhcpUserClassOption"); - o.UseHubNameAsRadiusNasId = PackGetBool(p, "UseHubNameAsRadiusNasId"); - - save_packet_log = PackGetInt(p, "SavePacketLog"); - packet_log_switch_type = PackGetInt(p, "PacketLogSwitchType"); - for (i = 0;i < NUM_PACKET_LOG;i++) - { - packet_log_config[i] = PackGetIntEx(p, "PacketLogConfig", i); - } - save_security_log = PackGetInt(p, "SaveSecurityLog"); - security_log_switch_type = PackGetInt(p, "SecurityLogSwitchType"); - - Zero(&log, sizeof(log)); - log.SavePacketLog = save_packet_log; - log.PacketLogSwitchType = packet_log_switch_type; - Copy(log.PacketLogConfig, packet_log_config, sizeof(log.PacketLogConfig)); - log.SaveSecurityLog = save_security_log; - log.SecurityLogSwitchType = security_log_switch_type; - - h = GetHub(s->Cedar, name); - if (h == NULL) - { - return; - } - - h->FarmMember_MaxSessionClient = PackGetInt(p, "MaxSessionClient"); - h->FarmMember_MaxSessionBridge = PackGetInt(p, "MaxSessionBridge"); - h->FarmMember_MaxSessionClientBridgeApply = PackGetBool(p, "MaxSessionClientBridgeApply"); - - if (h->FarmMember_MaxSessionClientBridgeApply == false) - { - h->FarmMember_MaxSessionClient = INFINITE; - h->FarmMember_MaxSessionBridge = INFINITE; - } - - Lock(h->lock); - { - Copy(h->Option, &o, sizeof(HUB_OPTION)); - PackGetData2(p, "SecurePassword", h->SecurePassword, SHA1_SIZE); - PackGetData2(p, "HashedPassword", h->HashedPassword, SHA1_SIZE); - } - Unlock(h->lock); - - SetHubLogSetting(h, &log); - - if (h->Type != type) - { - h->Type = type; - type_changed = true; - } - - LockList(h->AccessList); - { - UINT i; - for (i = 0;i < LIST_NUM(h->AccessList);i++) - { - ACCESS *a = LIST_DATA(h->AccessList, i); - Free(a); - } - DeleteAll(h->AccessList); - } - UnlockList(h->AccessList); - - for (i = 0;i < SiNumAccessFromPack(p);i++) - { - ACCESS *a = SiPackToAccess(p, i); - AddAccessList(h, a); - Free(a); - } - - if (PackGetBool(p, "EnableSecureNAT")) - { - VH_OPTION t; - bool changed; - - InVhOption(&t, p); - - changed = Cmp(h->SecureNATOption, &t, sizeof(VH_OPTION)) == 0 ? false : true; - Copy(h->SecureNATOption, &t, sizeof(VH_OPTION)); - - EnableSecureNAT(h, true); - - if (changed) - { - Lock(h->lock_online); - { - if (h->SecureNAT != NULL) - { - SetVirtualHostOption(h->SecureNAT->Nat->Virtual, &t); - Debug("SiCalledUpdateHub: SecureNAT Updated.\n"); - } - } - Unlock(h->lock_online); - } - } - else - { - EnableSecureNAT(h, false); - Debug("SiCalledUpdateHub: SecureNAT Disabled.\n"); - } - - if (type_changed) - { - // Remove all sessions since the type of HUB has been changed - if (h->Offline == false) - { - SetHubOffline(h); - SetHubOnline(h); - } - } - - ReleaseHub(h); -} - -// Inspect the ticket -bool SiCheckTicket(HUB *h, UCHAR *ticket, char *username, UINT username_size, char *usernamereal, UINT usernamereal_size, POLICY *policy, char *sessionname, UINT sessionname_size, char *groupname, UINT groupname_size) -{ - bool ret = false; - // Validate arguments - if (h == NULL || ticket == NULL || username == NULL || usernamereal == NULL || policy == NULL || sessionname == NULL) - { - return false; - } - - LockList(h->TicketList); - { - UINT i; - for (i = 0;i < LIST_NUM(h->TicketList);i++) - { - TICKET *t = LIST_DATA(h->TicketList, i); - if (Cmp(t->Ticket, ticket, SHA1_SIZE) == 0) - { - ret = true; - StrCpy(username, username_size, t->Username); - StrCpy(usernamereal, usernamereal_size, t->UsernameReal); - StrCpy(sessionname, sessionname_size, t->SessionName); - StrCpy(groupname, groupname_size, t->GroupName); - Copy(policy, &t->Policy, sizeof(POLICY)); - Delete(h->TicketList, t); - Free(t); - break; - } - } - } - UnlockList(h->TicketList); - - return ret; -} - -// Receive a MAC address deletion directive -void SiCalledDeleteMacTable(SERVER *s, PACK *p) -{ - UINT key; - char hubname[MAX_HUBNAME_LEN + 1]; - HUB *h; - // Validate arguments - if (s == NULL || p == NULL) - { - return; - } - - if (PackGetStr(p, "HubName", hubname, sizeof(hubname)) == false) - { - return; - } - key = PackGetInt(p, "Key"); - - LockHubList(s->Cedar); - { - h = GetHub(s->Cedar, hubname); - } - UnlockHubList(s->Cedar); - - if (h == NULL) - { - return; - } - - LockHashList(h->MacHashTable); - { - MAC_TABLE_ENTRY *e = HashListKeyToPointer(h->MacHashTable, key); - DeleteHash(h->MacHashTable, e); - Free(e); - } - UnlockHashList(h->MacHashTable); - - ReleaseHub(h); -} - -// Receive an IP address delete directive -void SiCalledDeleteIpTable(SERVER *s, PACK *p) -{ - UINT key; - char hubname[MAX_HUBNAME_LEN + 1]; - HUB *h; - // Validate arguments - if (s == NULL || p == NULL) - { - return; - } - - if (PackGetStr(p, "HubName", hubname, sizeof(hubname)) == false) - { - return; - } - key = PackGetInt(p, "Key"); - - LockHubList(s->Cedar); - { - h = GetHub(s->Cedar, hubname); - } - UnlockHubList(s->Cedar); - - if (h == NULL) - { - return; - } - - LockList(h->IpTable); - { - if (IsInList(h->IpTable, (void *)key)) - { - IP_TABLE_ENTRY *e = (IP_TABLE_ENTRY *)key; - Delete(h->IpTable, e); - Free(e); - } - } - UnlockList(h->IpTable); - - ReleaseHub(h); -} - -// Receive a session deletion directive -void SiCalledDeleteSession(SERVER *s, PACK *p) -{ - char name[MAX_SESSION_NAME_LEN + 1]; - char hubname[MAX_HUBNAME_LEN + 1]; - HUB *h; - SESSION *sess; - // Validate arguments - if (s == NULL || p == NULL) - { - return; - } - - if (PackGetStr(p, "HubName", hubname, sizeof(hubname)) == false) - { - return; - } - if (PackGetStr(p, "SessionName", name, sizeof(name)) == false) - { - return; - } - - LockHubList(s->Cedar); - { - h = GetHub(s->Cedar, hubname); - } - UnlockHubList(s->Cedar); - - if (h == NULL) - { - return; - } - - sess = GetSessionByName(h, name); - - if (sess != NULL) - { - if (sess->BridgeMode == false && sess->LinkModeServer == false && sess->SecureNATMode == false) - { - StopSession(sess); - } - ReleaseSession(sess); - } - - ReleaseHub(h); -} - -// Receive a log file reading directive -PACK *SiCalledReadLogFile(SERVER *s, PACK *p) -{ - RPC_READ_LOG_FILE t; - PACK *ret; - char filepath[MAX_PATH]; - UINT offset; - // Validate arguments - if (s == NULL || p == NULL) - { - return NULL; - } - - PackGetStr(p, "FilePath", filepath, sizeof(filepath)); - offset = PackGetInt(p, "Offset"); - - Zero(&t, sizeof(t)); - - SiReadLocalLogFile(s, filepath, offset, &t); - - ret = NewPack(); - - OutRpcReadLogFile(ret, &t); - FreeRpcReadLogFile(&t); - - return ret; -} - -// Receive a log file enumeration directive -PACK *SiCalledEnumLogFileList(SERVER *s, PACK *p) -{ - RPC_ENUM_LOG_FILE t; - PACK *ret; - char hubname[MAX_HUBNAME_LEN + 1]; - // Validate arguments - if (s == NULL || p == NULL) - { - return NULL; - } - - PackGetStr(p, "HubName", hubname, sizeof(hubname)); - - Zero(&t, sizeof(t)); - - SiEnumLocalLogFileList(s, hubname, &t); - - ret = NewPack(); - - OutRpcEnumLogFile(ret, &t); - FreeRpcEnumLogFile(&t); - - return ret; -} - -// Receive a session information directive -PACK *SiCalledGetSessionStatus(SERVER *s, PACK *p) -{ - RPC_SESSION_STATUS t; - ADMIN a; - PACK *ret; - // Validate arguments - if (s == NULL || p == NULL) - { - return NULL; - } - - Zero(&t, sizeof(t)); - InRpcSessionStatus(&t, p); - - Zero(&a, sizeof(a)); - a.Server = s; - a.ServerAdmin = true; - - if (StGetSessionStatus(&a, &t) != ERR_NO_ERROR) - { - FreeRpcSessionStatus(&t); - return NULL; - } - - ret = NewPack(); - - OutRpcSessionStatus(ret, &t); - - FreeRpcSessionStatus(&t); - - return ret; -} - -// IP table enumeration directive -PACK *SiCalledEnumIpTable(SERVER *s, PACK *p) -{ - char hubname[MAX_HUBNAME_LEN + 1]; - RPC_ENUM_IP_TABLE t; - PACK *ret; - // Validate arguments - if (s == NULL || p == NULL) - { - return NewPack(); - } - if (PackGetStr(p, "HubName", hubname, sizeof(hubname)) == false) - { - return NewPack(); - } - Zero(&t, sizeof(t)); - - SiEnumIpTable(s, hubname, &t); - - ret = NewPack(); - OutRpcEnumIpTable(ret, &t); - FreeRpcEnumIpTable(&t); - - return ret; -} - -// MAC table enumeration directive -PACK *SiCalledEnumMacTable(SERVER *s, PACK *p) -{ - char hubname[MAX_HUBNAME_LEN + 1]; - RPC_ENUM_MAC_TABLE t; - PACK *ret; - // Validate arguments - if (s == NULL || p == NULL) - { - return NewPack(); - } - if (PackGetStr(p, "HubName", hubname, sizeof(hubname)) == false) - { - return NewPack(); - } - Zero(&t, sizeof(t)); - - SiEnumMacTable(s, hubname, &t); - - ret = NewPack(); - OutRpcEnumMacTable(ret, &t); - FreeRpcEnumMacTable(&t); - - return ret; -} - -// NAT status acquisition directive -PACK *SiCalledGetNatStatus(SERVER *s, PACK *p) -{ - char hubname[MAX_HUBNAME_LEN + 1]; - RPC_NAT_STATUS t; - PACK *ret; - HUB *h; - // Validate arguments - if (s == NULL || p == NULL) - { - return NewPack(); - } - if (PackGetStr(p, "HubName", hubname, sizeof(hubname)) == false) - { - return NewPack(); - } - Zero(&t, sizeof(t)); - - LockHubList(s->Cedar); - { - h = GetHub(s->Cedar, hubname); - } - UnlockHubList(s->Cedar); - - if (h != NULL) - { - Lock(h->lock_online); - { - if (h->SecureNAT != NULL) - { - NtGetStatus(h->SecureNAT->Nat, &t); - } - } - Unlock(h->lock_online); - } - - ReleaseHub(h); - - ret = NewPack(); - OutRpcNatStatus(ret, &t); - FreeRpcNatStatus(&t); - - return ret; -} - -// DHCP table enumeration directive -PACK *SiCalledEnumDhcp(SERVER *s, PACK *p) -{ - char hubname[MAX_HUBNAME_LEN + 1]; - RPC_ENUM_DHCP t; - PACK *ret; - HUB *h; - // Validate arguments - if (s == NULL || p == NULL) - { - return NewPack(); - } - if (PackGetStr(p, "HubName", hubname, sizeof(hubname)) == false) - { - return NewPack(); - } - Zero(&t, sizeof(t)); - - LockHubList(s->Cedar); - { - h = GetHub(s->Cedar, hubname); - } - UnlockHubList(s->Cedar); - - if (h != NULL) - { - Lock(h->lock_online); - { - if (h->SecureNAT != NULL) - { - NtEnumDhcpList(h->SecureNAT->Nat, &t); - } - } - Unlock(h->lock_online); - } - - ReleaseHub(h); - - ret = NewPack(); - OutRpcEnumDhcp(ret, &t); - FreeRpcEnumDhcp(&t); - - return ret; -} - -// NAT table enumeration directive -PACK *SiCalledEnumNat(SERVER *s, PACK *p) -{ - char hubname[MAX_HUBNAME_LEN + 1]; - RPC_ENUM_NAT t; - PACK *ret; - HUB *h; - // Validate arguments - if (s == NULL || p == NULL) - { - return NewPack(); - } - if (PackGetStr(p, "HubName", hubname, sizeof(hubname)) == false) - { - return NewPack(); - } - Zero(&t, sizeof(t)); - - LockHubList(s->Cedar); - { - h = GetHub(s->Cedar, hubname); - } - UnlockHubList(s->Cedar); - - if (h != NULL) - { - Lock(h->lock_online); - { - if (h->SecureNAT != NULL) - { - NtEnumNatList(h->SecureNAT->Nat, &t); - } - } - Unlock(h->lock_online); - } - - ReleaseHub(h); - - ret = NewPack(); - OutRpcEnumNat(ret, &t); - FreeRpcEnumNat(&t); - - return ret; -} - -// Receive a session enumeration directive -PACK *SiCalledEnumSession(SERVER *s, PACK *p) -{ - char hubname[MAX_HUBNAME_LEN + 1]; - RPC_ENUM_SESSION t; - PACK *ret; - // Validate arguments - if (s == NULL || p == NULL) - { - return NewPack(); - } - if (PackGetStr(p, "HubName", hubname, sizeof(hubname)) == false) - { - return NewPack(); - } - Zero(&t, sizeof(t)); - - SiEnumLocalSession(s, hubname, &t); - - ret = NewPack(); - OutRpcEnumSession(ret, &t); - FreeRpcEnumSession(&t); - - return ret; -} - -// Receive a ticket creation directive -PACK *SiCalledCreateTicket(SERVER *s, PACK *p) -{ - char username[MAX_SIZE]; - char hubname[MAX_SIZE]; - char groupname[MAX_SIZE]; - char realusername[MAX_SIZE]; - char sessionname[MAX_SESSION_NAME_LEN + 1]; - POLICY policy; - UCHAR ticket[SHA1_SIZE]; - char ticket_str[MAX_SIZE]; - HUB *h; - UINT i; - PACK *ret; - TICKET *t; - // Validate arguments - if (s == NULL || p == NULL) - { - return NewPack(); - } - - PackGetStr(p, "UserName", username, sizeof(username)); - PackGetStr(p, "GroupName", groupname, sizeof(groupname)); - PackGetStr(p, "HubName", hubname, sizeof(hubname)); - PackGetStr(p, "RealUserName", realusername, sizeof(realusername)); - PackGetStr(p, "SessionName", sessionname, sizeof(sessionname)); - - InRpcPolicy(&policy, p); - if (PackGetDataSize(p, "Ticket") == SHA1_SIZE) - { - PackGetData(p, "Ticket", ticket); - } - - BinToStr(ticket_str, sizeof(ticket_str), ticket, SHA1_SIZE); - - SLog(s->Cedar, "LS_TICKET_2", hubname, username, realusername, sessionname, - ticket_str, TICKET_EXPIRES / 1000); - - // Get the HUB - h = GetHub(s->Cedar, hubname); - if (h == NULL) - { - return NewPack(); - } - - LockList(h->TicketList); - { - LIST *o = NewListFast(NULL); - // Discard old tickets - for (i = 0;i < LIST_NUM(h->TicketList);i++) - { - TICKET *t = LIST_DATA(h->TicketList, i); - if ((t->CreatedTick + TICKET_EXPIRES) < Tick64()) - { - Add(o, t); - } - } - for (i = 0;i < LIST_NUM(o);i++) - { - TICKET *t = LIST_DATA(o, i); - Delete(h->TicketList, t); - Free(t); - } - ReleaseList(o); - - // Create a ticket - t = ZeroMalloc(sizeof(TICKET)); - t->CreatedTick = Tick64(); - Copy(&t->Policy, &policy, sizeof(POLICY)); - Copy(t->Ticket, ticket, SHA1_SIZE); - StrCpy(t->Username, sizeof(t->Username), username); - StrCpy(t->UsernameReal, sizeof(t->UsernameReal), realusername); - StrCpy(t->GroupName, sizeof(t->GroupName), groupname); - StrCpy(t->SessionName, sizeof(t->SessionName), sessionname); - - Add(h->TicketList, t); - } - UnlockList(h->TicketList); - - ReleaseHub(h); - - ret = NewPack(); - - PackAddInt(ret, "Point", SiGetPoint(s)); - - return ret; -} - -// Receive a HUB creation directive -void SiCalledCreateHub(SERVER *s, PACK *p) -{ - char name[MAX_SIZE]; - UINT type; - HUB_OPTION o; - HUB_LOG log; - bool save_packet_log; - UINT packet_log_switch_type; - UINT packet_log_config[NUM_PACKET_LOG]; - bool save_security_log; - UINT security_log_switch_type; - UINT i; - HUB *h; - // Validate arguments - if (s == NULL || p == NULL) - { - return; - } - - PackGetStr(p, "HubName", name, sizeof(name)); - type = PackGetInt(p, "HubType"); - Zero(&o, sizeof(o)); - o.MaxSession = PackGetInt(p, "MaxSession"); - save_packet_log = PackGetInt(p, "SavePacketLog"); - packet_log_switch_type = PackGetInt(p, "PacketLogSwitchType"); - for (i = 0;i < NUM_PACKET_LOG;i++) - { - packet_log_config[i] = PackGetIntEx(p, "PacketLogConfig", i); - } - save_security_log = PackGetInt(p, "SaveSecurityLog"); - security_log_switch_type = PackGetInt(p, "SecurityLogSwitchType"); - - Zero(&log, sizeof(log)); - log.SavePacketLog = save_packet_log; - log.PacketLogSwitchType = packet_log_switch_type; - Copy(log.PacketLogConfig, packet_log_config, sizeof(log.PacketLogConfig)); - log.SaveSecurityLog = save_security_log; - log.SecurityLogSwitchType = security_log_switch_type; - - h = NewHub(s->Cedar, name, &o); - h->LastCommTime = h->LastLoginTime = h->CreatedTime = 0; - SetHubLogSetting(h, &log); - h->Type = type; - h->FarmMember_MaxSessionClient = PackGetInt(p, "MaxSessionClient"); - h->FarmMember_MaxSessionBridge = PackGetInt(p, "MaxSessionBridge"); - h->FarmMember_MaxSessionClientBridgeApply = PackGetBool(p, "MaxSessionClientBridgeApply"); - - if (h->FarmMember_MaxSessionClientBridgeApply == false) - { - h->FarmMember_MaxSessionClient = INFINITE; - h->FarmMember_MaxSessionBridge = INFINITE; - } - - PackGetData2(p, "SecurePassword", h->SecurePassword, SHA1_SIZE); - PackGetData2(p, "HashedPassword", h->HashedPassword, SHA1_SIZE); - - for (i = 0;i < SiNumAccessFromPack(p);i++) - { - ACCESS *a = SiPackToAccess(p, i); - AddAccessList(h, a); - Free(a); - } - - if (PackGetBool(p, "EnableSecureNAT")) - { - VH_OPTION t; - - InVhOption(&t, p); - - Copy(h->SecureNATOption, &t, sizeof(VH_OPTION)); - EnableSecureNAT(h, true); - - Debug("SiCalledCreateHub: SecureNAT Created.\n"); - } - - AddHub(s->Cedar, h); - h->Offline = true; - SetHubOnline(h); - - ReleaseHub(h); -} - -// Farm control thread -void SiFarmControlThread(THREAD *thread, void *param) -{ - SERVER *s; - CEDAR *c; - EVENT *e; - LIST *o; - UINT i; - char tmp[MAX_PATH]; - // Validate arguments - if (thread == NULL || param == NULL) - { - return; - } - - s = (SERVER *)param; - c = s->Cedar; - e = s->FarmControlThreadHaltEvent; - - while (true) - { - Lock(c->CedarSuperLock); - - // Enumerate HUB list which is hosted by each farm member - Format(tmp, sizeof(tmp), "CONTROLLER: %s %u", __FILE__, __LINE__); - SiDebugLog(s, tmp); - - LockList(s->FarmMemberList); - { - UINT i; - UINT num; - UINT assigned_client_license = 0; - UINT assigned_bridge_license = 0; - LIST *fm_list = NewListFast(NULL); - - Format(tmp, sizeof(tmp), "CONTROLLER: %s %u", __FILE__, __LINE__); - SiDebugLog(s, tmp); - - num = 0; - - while (true) - { - bool escape = true; - for (i = 0;i < LIST_NUM(s->FarmMemberList);i++) - { - FARM_MEMBER *f = LIST_DATA(s->FarmMemberList, i); - - if (IsInList(fm_list, f) == false) - { - SiCallEnumHub(s, f); - // Get the total number of sessions across the server farm - num += f->NumSessions; - - assigned_client_license += f->AssignedClientLicense; - assigned_bridge_license += f->AssignedBridgeLicense; - - escape = false; - - Add(fm_list, f); - break; - } - } - - if (escape) - { - break; - } - - UnlockList(s->FarmMemberList); - LockList(s->FarmMemberList); - } - - ReleaseList(fm_list); - - s->CurrentTotalNumSessionsOnFarm = num; - - // Update the number of assigned licenses - s->CurrentAssignedBridgeLicense = assigned_bridge_license; - s->CurrentAssignedClientLicense = assigned_client_license; - - Format(tmp, sizeof(tmp), "CONTROLLER: %s %u", __FILE__, __LINE__); - SiDebugLog(s, tmp); - } - UnlockList(s->FarmMemberList); - - Format(tmp, sizeof(tmp), "CONTROLLER: %s %u", __FILE__, __LINE__); - SiDebugLog(s, tmp); - - o = NewListFast(NULL); - - Format(tmp, sizeof(tmp), "CONTROLLER: %s %u", __FILE__, __LINE__); - SiDebugLog(s, tmp); - - // Emit an update notification for each HUB - LockList(c->HubList); - { - UINT i; - for (i = 0;i < LIST_NUM(c->HubList);i++) - { - HUB *h = LIST_DATA(c->HubList, i); - AddRef(h->ref); - Add(o, h); - } - } - UnlockList(c->HubList); - - Format(tmp, sizeof(tmp), "CONTROLLER: %s %u", __FILE__, __LINE__); - SiDebugLog(s, tmp); - - for (i = 0;i < LIST_NUM(o);i++) - { - HUB *h = LIST_DATA(o, i); - SiHubUpdateProc(h); - ReleaseHub(h); - } - - Format(tmp, sizeof(tmp), "CONTROLLER: %s %u", __FILE__, __LINE__); - SiDebugLog(s, tmp); - - ReleaseList(o); - - Unlock(c->CedarSuperLock); - - Wait(e, SERVER_FARM_CONTROL_INTERVAL); - if (s->Halt) - { - break; - } - } -} - -// Start the farm controling -void SiStartFarmControl(SERVER *s) -{ - // Validate arguments - if (s == NULL || s->ServerType != SERVER_TYPE_FARM_CONTROLLER) - { - return; - } - - s->FarmControlThreadHaltEvent = NewEvent(); - s->FarmControlThread = NewThread(SiFarmControlThread, s); -} - -// Stop the farm controling -void SiStopFarmControl(SERVER *s) -{ - // Validate arguments - if (s == NULL || s->ServerType != SERVER_TYPE_FARM_CONTROLLER) - { - return; - } - - Set(s->FarmControlThreadHaltEvent); - WaitThread(s->FarmControlThread, INFINITE); - ReleaseEvent(s->FarmControlThreadHaltEvent); - ReleaseThread(s->FarmControlThread); -} - -// HUB enumeration directive -void SiCallEnumHub(SERVER *s, FARM_MEMBER *f) -{ - CEDAR *c; - // Validate arguments - if (s == NULL || f == NULL) - { - return; - } - - c = s->Cedar; - - if (f->Me) - { - - // Enumerate local HUBs - LockList(f->HubList); - { - // For a local HUB, re-enumerate by erasing all STATIC HUB list once first - UINT i; - LIST *o = NewListFast(NULL); - for (i = 0;i < LIST_NUM(f->HubList);i++) - { - HUB_LIST *h = LIST_DATA(f->HubList, i); - if (h->DynamicHub == false) - { - Add(o, h); - } - } - - // Clear all the STATIC HUB - for (i = 0;i < LIST_NUM(o);i++) - { - HUB_LIST *h = LIST_DATA(o, i); - Free(h); - Delete(f->HubList, h); - } - ReleaseList(o); - - // Second, stop DYNAMIC HUBs without user - o = NewListFast(NULL); - for (i = 0;i < LIST_NUM(f->HubList);i++) - { - HUB_LIST *h = LIST_DATA(f->HubList, i); - if (h->DynamicHub == true) - { - LockList(c->HubList); - { - HUB *hub = GetHub(s->Cedar, h->Name); - if (hub != NULL) - { - if (Count(hub->NumSessions) == 0 || hub->Type != HUB_TYPE_FARM_DYNAMIC) - { - Add(o, h); - } - ReleaseHub(hub); - } - } - UnlockList(c->HubList); - } - } - - for (i = 0;i < LIST_NUM(o);i++) - { - HUB_LIST *h = LIST_DATA(o, i); - Debug("Delete HUB: %s\n", h->Name); - Free(h); - Delete(f->HubList, h); - } - - ReleaseList(o); - - // Set the enumeration results - LockList(c->HubList); - { - for (i = 0;i < LIST_NUM(c->HubList);i++) - { - HUB *h = LIST_DATA(c->HubList, i); - if (h->Offline == false) - { - if (h->Type == HUB_TYPE_FARM_STATIC) - { - HUB_LIST *hh = ZeroMalloc(sizeof(HUB_LIST)); - hh->FarmMember = f; - hh->DynamicHub = false; - StrCpy(hh->Name, sizeof(hh->Name), h->Name); - Add(f->HubList, hh); - - LockList(h->SessionList); - { - hh->NumSessions = LIST_NUM(h->SessionList); - hh->NumSessionsBridge = Count(h->NumSessionsBridge); - hh->NumSessionsClient = Count(h->NumSessionsClient); - } - UnlockList(h->SessionList); - - LockHashList(h->MacHashTable); - { - hh->NumMacTables = HASH_LIST_NUM(h->MacHashTable); - } - UnlockHashList(h->MacHashTable); - - LockList(h->IpTable); - { - hh->NumIpTables = LIST_NUM(h->IpTable); - } - UnlockList(h->IpTable); - } - } - } - } - UnlockList(c->HubList); - } - UnlockList(f->HubList); - - // Point - f->Point = SiGetPoint(s); - f->NumSessions = Count(s->Cedar->CurrentSessions); - f->MaxSessions = GetServerCapsInt(s, "i_max_sessions"); - f->NumTcpConnections = Count(s->Cedar->CurrentTcpConnections); - - Lock(s->Cedar->TrafficLock); - { - Copy(&f->Traffic, s->Cedar->Traffic, sizeof(TRAFFIC)); - } - Unlock(s->Cedar->TrafficLock); - - f->AssignedBridgeLicense = Count(s->Cedar->AssignedBridgeLicense); - f->AssignedClientLicense = Count(s->Cedar->AssignedClientLicense); - - Copy(f->RandomKey, s->MyRandomKey, SHA1_SIZE); - - - Debug("Server %s: Point %u\n", f->hostname, f->Point); - } - else - { - // Enumerate HUBs which are remote member - PACK *p = NewPack(); - UINT i, num, j; - LIST *o = NewListFast(NULL); - - num = 0; - - for (i = 0;i < LIST_NUM(s->FarmMemberList);i++) - { - FARM_MEMBER *f = LIST_DATA(s->FarmMemberList, i); - - if (IsZero(f->RandomKey, SHA1_SIZE) == false && f->SystemId != 0) - { - num++; - } - } - - j = 0; - - for (i = 0;i < LIST_NUM(s->FarmMemberList);i++) - { - FARM_MEMBER *f = LIST_DATA(s->FarmMemberList, i); - - if (IsZero(f->RandomKey, SHA1_SIZE) == false && f->SystemId != 0) - { - PackAddDataEx(p, "MemberRandomKey", f->RandomKey, SHA1_SIZE, j, num); - PackAddInt64Ex(p, "MemberSystemId", f->SystemId, j, num); - j++; - } - } - PackAddInt(p, "MemberSystemIdNum", num); - - p = SiCallTask(f, p, "enumhub"); - if (p != NULL) - { - LockList(f->HubList); - { - UINT i; - // Erase the list - for (i = 0;i < LIST_NUM(f->HubList);i++) - { - HUB_LIST *hh = LIST_DATA(f->HubList, i); - Free(hh); - } - DeleteAll(f->HubList); - - for (i = 0;i < PackGetIndexCount(p, "HubName");i++) - { - HUB_LIST *hh = ZeroMalloc(sizeof(HUB_LIST)); - UINT num; - UINT64 LastCommTime; - - PackGetStrEx(p, "HubName", hh->Name, sizeof(hh->Name), i); - num = PackGetIntEx(p, "NumSession", i); - hh->DynamicHub = ((PackGetIntEx(p, "HubType", i) == HUB_TYPE_FARM_DYNAMIC) ? true : false); - hh->FarmMember = f; - hh->NumSessions = PackGetIntEx(p, "NumSessions", i); - hh->NumSessionsClient = PackGetIntEx(p, "NumSessionsClient", i); - hh->NumSessionsBridge = PackGetIntEx(p, "NumSessionsBridge", i); - hh->NumIpTables = PackGetIntEx(p, "NumIpTables", i); - hh->NumMacTables = PackGetIntEx(p, "NumMacTables", i); - LastCommTime = PackGetInt64Ex(p, "LastCommTime", i); - Add(f->HubList, hh); - //Debug("%s\n", hh->Name); - - LockList(c->HubList); - { - HUB *h = GetHub(c, hh->Name); - - if (h != NULL) - { - // Update the LastCommTime of the Virtual HUB - Lock(h->lock); - { - if (h->LastCommTime < LastCommTime) - { - h->LastCommTime = LastCommTime; - } - } - Unlock(h->lock); - - ReleaseHub(h); - } - } - UnlockList(c->HubList); - - if (hh->DynamicHub && num >= 1) - { - // It is not necessary to be registered in the virtual HUB creation - // history list because user session is already connected. - // Remove from the Virtual HUB creation history list - SiDelHubCreateHistory(s, hh->Name); - } - - if (hh->DynamicHub && num == 0) - { - // Check the Virtual HUB creation history list. - // If it is created within 60 seconds of the most recent - // in the case of Virtual HUB which the first user is not - // connected yet, not to remove because there is no user - if (SiIsHubRegistedOnCreateHistory(s, hh->Name) == false) - { - // Stop because all uses have gone in the dynamic HUB - HUB *h; - LockList(c->HubList); - { - h = GetHub(c, hh->Name); - } - UnlockList(c->HubList); - - if (h != NULL) - { - Add(o, h); - } - } - } - } - } - UnlockList(f->HubList); - f->Point = PackGetInt(p, "Point"); - Debug("Server %s: Point %u\n", f->hostname, f->Point); - f->NumSessions = PackGetInt(p, "NumTotalSessions"); - if (f->NumSessions == 0) - { - f->NumSessions = PackGetInt(p, "NumSessions"); - } - f->MaxSessions = PackGetInt(p, "MaxSessions"); - f->NumTcpConnections = PackGetInt(p, "NumTcpConnections"); - InRpcTraffic(&f->Traffic, p); - - f->AssignedBridgeLicense = PackGetInt(p, "AssignedBridgeLicense"); - f->AssignedClientLicense = PackGetInt(p, "AssignedClientLicense"); - - if (PackGetDataSize(p, "RandomKey") == SHA1_SIZE) - { - PackGetData(p, "RandomKey", f->RandomKey); - } - - f->SystemId = PackGetInt64(p, "SystemId"); - - // Apply the traffic difference information - num = PackGetIndexCount(p, "TdType"); - for (i = 0;i < num;i++) - { - TRAFFIC traffic; - UINT type; - HUB *h; - char name[MAX_SIZE]; - char hubname[MAX_SIZE]; - - type = PackGetIntEx(p, "TdType", i); - PackGetStrEx(p, "TdName", name, sizeof(name), i); - PackGetStrEx(p, "TdHubName", hubname, sizeof(hubname), i); - InRpcTrafficEx(&traffic, p, i); - - LockList(c->HubList); - { - h = GetHub(c, hubname); - if (h != NULL) - { - if (type == TRAFFIC_DIFF_HUB) - { - Lock(h->TrafficLock); - { - AddTraffic(h->Traffic, &traffic); - } - Unlock(h->TrafficLock); - } - else - { - AcLock(h); - { - USER *u = AcGetUser(h, name); - if (u != NULL) - { - Lock(u->lock); - { - AddTraffic(u->Traffic, &traffic); - } - Unlock(u->lock); - if (u->Group != NULL) - { - Lock(u->Group->lock); - { - AddTraffic(u->Group->Traffic, &traffic); - } - Unlock(u->Group->lock); - } - ReleaseUser(u); - } - } - AcUnlock(h); - } - ReleaseHub(h); - } - UnlockList(c->HubList); - } - } - - FreePack(p); - } - - for (i = 0;i < LIST_NUM(o);i++) - { - HUB *h = LIST_DATA(o, i); - SiCallDeleteHub(s, f, h); - Debug("Delete HUB: %s\n", h->Name); - ReleaseHub(h); - } - - ReleaseList(o); - } -} - -// Send a session information directive -bool SiCallGetSessionStatus(SERVER *s, FARM_MEMBER *f, RPC_SESSION_STATUS *t) -{ - PACK *p; - // Validate arguments - if (s == NULL || f == NULL) - { - return false; - } - - p = NewPack(); - OutRpcSessionStatus(p, t); - FreeRpcSessionStatus(t); - Zero(t, sizeof(RPC_SESSION_STATUS)); - - p = SiCallTask(f, p, "getsessionstatus"); - - if (p == NULL) - { - return false; - } - - InRpcSessionStatus(t, p); - FreePack(p); - - return true; -} - -// Log file reading directive -bool SiCallReadLogFile(SERVER *s, FARM_MEMBER *f, RPC_READ_LOG_FILE *t) -{ - PACK *p; - // Validate arguments - if (s == NULL || f == NULL) - { - return false; - } - - p = NewPack(); - OutRpcReadLogFile(p, t); - FreeRpcReadLogFile(t); - Zero(t, sizeof(RPC_READ_LOG_FILE)); - - p = SiCallTask(f, p, "readlogfile"); - - if (p == NULL) - { - return false; - } - - InRpcReadLogFile(t, p); - FreePack(p); - - return true; -} - -// Log file enumeration directive -bool SiCallEnumLogFileList(SERVER *s, FARM_MEMBER *f, RPC_ENUM_LOG_FILE *t, char *hubname) -{ - PACK *p; - // Validate arguments - if (s == NULL || f == NULL) - { - return false; - } - - p = NewPack(); - OutRpcEnumLogFile(p, t); - FreeRpcEnumLogFile(t); - Zero(t, sizeof(RPC_ENUM_LOG_FILE)); - - PackAddStr(p, "HubName", hubname); - - p = SiCallTask(f, p, "enumlogfilelist"); - - if (p == NULL) - { - return false; - } - - InRpcEnumLogFile(t, p); - FreePack(p); - - return true; -} - -// HUB delete directive -void SiCallDeleteHub(SERVER *s, FARM_MEMBER *f, HUB *h) -{ - PACK *p; - UINT i; - // Validate arguments - if (s == NULL || f == NULL) - { - return; - } - - if (f->Me == false) - { - p = NewPack(); - - PackAddStr(p, "HubName", h->Name); - - p = SiCallTask(f, p, "deletehub"); - FreePack(p); - } - - LockList(f->HubList); - { - for (i = 0;i < LIST_NUM(f->HubList);i++) - { - HUB_LIST *hh = LIST_DATA(f->HubList, i); - if (StrCmpi(hh->Name, h->Name) == 0) - { - Free(hh); - Delete(f->HubList, hh); - } - } - } - UnlockList(f->HubList); -} - -// Submit a HUB update directive -void SiCallUpdateHub(SERVER *s, FARM_MEMBER *f, HUB *h) -{ - PACK *p; - // Validate arguments - if (s == NULL || f == NULL) - { - return; - } - - if (f->Me == false) - { - p = NewPack(); - - SiPackAddCreateHub(p, h); - - p = SiCallTask(f, p, "updatehub"); - FreePack(p); - } -} - -// Send a ticket creation directive -void SiCallCreateTicket(SERVER *s, FARM_MEMBER *f, char *hubname, char *username, char *realusername, POLICY *policy, UCHAR *ticket, UINT counter, char *groupname) -{ - PACK *p; - char name[MAX_SESSION_NAME_LEN + 1]; - char hub_name_upper[MAX_SIZE]; - char user_name_upper[MAX_USERNAME_LEN + 1]; - char ticket_str[MAX_SIZE]; - UINT point; - // Validate arguments - if (s == NULL || f == NULL || realusername == NULL || hubname == NULL || username == NULL || policy == NULL || ticket == NULL) - { - return; - } - if (groupname == NULL) - { - groupname = ""; - } - - p = NewPack(); - PackAddStr(p, "HubName", hubname); - PackAddStr(p, "UserName", username); - PackAddStr(p, "groupname", groupname); - PackAddStr(p, "RealUserName", realusername); - OutRpcPolicy(p, policy); - PackAddData(p, "Ticket", ticket, SHA1_SIZE); - - BinToStr(ticket_str, sizeof(ticket_str), ticket, SHA1_SIZE); - - StrCpy(hub_name_upper, sizeof(hub_name_upper), hubname); - StrUpper(hub_name_upper); - StrCpy(user_name_upper, sizeof(user_name_upper), username); - StrUpper(user_name_upper); - Format(name, sizeof(name), "SID-%s-%u", user_name_upper, - counter); - PackAddStr(p, "SessionName", name); - - p = SiCallTask(f, p, "createticket"); - - SLog(s->Cedar, "LS_TICKET_1", f->hostname, hubname, username, realusername, name, ticket_str); - - point = PackGetInt(p, "Point"); - if (point != 0) - { - f->Point = point; - f->NumSessions++; - } - - FreePack(p); -} - -// Send a MAC address deletion directive -void SiCallDeleteMacTable(SERVER *s, FARM_MEMBER *f, char *hubname, UINT key) -{ - PACK *p; - // Validate arguments - if (s == NULL || f == NULL || hubname == NULL) - { - return; - } - - p = NewPack(); - PackAddStr(p, "HubName", hubname); - PackAddInt(p, "Key", key); - - p = SiCallTask(f, p, "deletemactable"); - - FreePack(p); -} - -// Send an IP address delete directive -void SiCallDeleteIpTable(SERVER *s, FARM_MEMBER *f, char *hubname, UINT key) -{ - PACK *p; - // Validate arguments - if (s == NULL || f == NULL || hubname == NULL) - { - return; - } - - p = NewPack(); - PackAddStr(p, "HubName", hubname); - PackAddInt(p, "Key", key); - - p = SiCallTask(f, p, "deleteiptable"); - - FreePack(p); -} - -// Send a session deletion directive -void SiCallDeleteSession(SERVER *s, FARM_MEMBER *f, char *hubname, char *session_name) -{ - PACK *p; - // Validate arguments - if (s == NULL || f == NULL || hubname == NULL || session_name == NULL) - { - return; - } - - p = NewPack(); - PackAddStr(p, "HubName", hubname); - PackAddStr(p, "SessionName", session_name); - - p = SiCallTask(f, p, "deletesession"); - - FreePack(p); -} - -// Send an IP table enumeration directive -void SiCallEnumIpTable(SERVER *s, FARM_MEMBER *f, char *hubname, RPC_ENUM_IP_TABLE *t) -{ - PACK *p; - UINT i; - // Validate arguments - if (s == NULL || f == NULL || hubname == NULL || t == NULL) - { - return; - } - - p = NewPack(); - PackAddStr(p, "HubName", hubname); - - p = SiCallTask(f, p, "enumiptable"); - - Zero(t, sizeof(RPC_ENUM_IP_TABLE)); - InRpcEnumIpTable(t, p); - - for (i = 0;i < t->NumIpTable;i++) - { - t->IpTables[i].RemoteItem = true; - StrCpy(t->IpTables[i].RemoteHostname, sizeof(t->IpTables[i].RemoteHostname), - f->hostname); - } - - FreePack(p); -} - -// Submit a MAC table enumeration directive -void SiCallEnumMacTable(SERVER *s, FARM_MEMBER *f, char *hubname, RPC_ENUM_MAC_TABLE *t) -{ - PACK *p; - UINT i; - // Validate arguments - if (s == NULL || f == NULL || hubname == NULL || t == NULL) - { - return; - } - - p = NewPack(); - PackAddStr(p, "HubName", hubname); - - p = SiCallTask(f, p, "enummactable"); - - Zero(t, sizeof(RPC_ENUM_MAC_TABLE)); - InRpcEnumMacTable(t, p); - - for (i = 0;i < t->NumMacTable;i++) - { - t->MacTables[i].RemoteItem = true; - StrCpy(t->MacTables[i].RemoteHostname, sizeof(t->MacTables[i].RemoteHostname), - f->hostname); - } - - FreePack(p); -} - -// Send a SecureNAT status acquisition directive -void SiCallGetNatStatus(SERVER *s, FARM_MEMBER *f, char *hubname, RPC_NAT_STATUS *t) -{ - PACK *p; - // Validate arguments - if (s == NULL || f == NULL || hubname == NULL || t == NULL) - { - return; - } - - p = NewPack(); - PackAddStr(p, "HubName", hubname); - - p = SiCallTask(f, p, "getnatstatus"); - - Zero(t, sizeof(RPC_NAT_STATUS)); - InRpcNatStatus(t, p); - - FreePack(p); -} - -// Submit a DHCP entry enumeration directive -void SiCallEnumDhcp(SERVER *s, FARM_MEMBER *f, char *hubname, RPC_ENUM_DHCP *t) -{ - PACK *p; - // Validate arguments - if (s == NULL || f == NULL || hubname == NULL || t == NULL) - { - return; - } - - p = NewPack(); - PackAddStr(p, "HubName", hubname); - - p = SiCallTask(f, p, "enumdhcp"); - - Zero(t, sizeof(RPC_ENUM_DHCP)); - InRpcEnumDhcp(t, p); - - FreePack(p); -} - -// Submit a NAT entry enumeration directive -void SiCallEnumNat(SERVER *s, FARM_MEMBER *f, char *hubname, RPC_ENUM_NAT *t) -{ - PACK *p; - // Validate arguments - if (s == NULL || f == NULL || hubname == NULL || t == NULL) - { - return; - } - - p = NewPack(); - PackAddStr(p, "HubName", hubname); - - p = SiCallTask(f, p, "enumnat"); - - Zero(t, sizeof(RPC_ENUM_NAT)); - InRpcEnumNat(t, p); - - FreePack(p); -} - -// Send a session enumeration directive -void SiCallEnumSession(SERVER *s, FARM_MEMBER *f, char *hubname, RPC_ENUM_SESSION *t) -{ - PACK *p; - UINT i; - // Validate arguments - if (s == NULL || f == NULL || hubname == NULL || t == NULL) - { - return; - } - - p = NewPack(); - PackAddStr(p, "HubName", hubname); - - p = SiCallTask(f, p, "enumsession"); - - Zero(t, sizeof(RPC_ENUM_SESSION)); - InRpcEnumSession(t, p); - - for (i = 0;i < t->NumSession;i++) - { - t->Sessions[i].RemoteSession = true; - StrCpy(t->Sessions[i].RemoteHostname, sizeof(t->Sessions[i].RemoteHostname), - f->hostname); - } - - FreePack(p); -} - -// Send a HUB creation directive -void SiCallCreateHub(SERVER *s, FARM_MEMBER *f, HUB *h) -{ - PACK *p; - HUB_LIST *hh; - // Validate arguments - if (s == NULL || f == NULL) - { - return; - } - - if (f->Me == false) - { - p = NewPack(); - - SiPackAddCreateHub(p, h); - - p = SiCallTask(f, p, "createhub"); - FreePack(p); - } - - hh = ZeroMalloc(sizeof(HUB_LIST)); - hh->DynamicHub = (h->Type == HUB_TYPE_FARM_DYNAMIC ? true : false); - StrCpy(hh->Name, sizeof(hh->Name), h->Name); - hh->FarmMember = f; - - LockList(f->HubList); - { - bool exists = false; - UINT i; - for (i = 0;i < LIST_NUM(f->HubList);i++) - { - HUB_LIST *t = LIST_DATA(f->HubList, i); - if (StrCmpi(t->Name, hh->Name) == 0) - { - exists = true; - } - } - if (exists == false) - { - Add(f->HubList, hh); - } - else - { - Free(hh); - } - } - UnlockList(f->HubList); -} - -// Write the PACK for creating HUB -void SiPackAddCreateHub(PACK *p, HUB *h) -{ - UINT i; - UINT max_session; - SERVER *s; - - - // Validate arguments - if (p == NULL || h == NULL) - { - return; - } - - - s = h->Cedar->Server; - if (s != NULL) - { - } - - PackAddStr(p, "HubName", h->Name); - PackAddInt(p, "HubType", h->Type); - - max_session = h->Option->MaxSession; - - if (GetHubAdminOption(h, "max_sessions") != 0) - { - if (max_session == 0) - { - max_session = GetHubAdminOption(h, "max_sessions"); - } - else - { - UINT r = GetHubAdminOption(h, "max_sessions"); - max_session = MIN(max_session, r); - } - } - - PackAddInt(p, "MaxSession", max_session); - - if (GetHubAdminOption(h, "max_sessions_client_bridge_apply") != 0 - ) - { - PackAddInt(p, "MaxSessionClient", GetHubAdminOption(h, "max_sessions_client")); - PackAddInt(p, "MaxSessionBridge", GetHubAdminOption(h, "max_sessions_bridge")); - PackAddBool(p, "MaxSessionClientBridgeApply", true); - } - else - { - PackAddInt(p, "MaxSessionClient", INFINITE); - PackAddInt(p, "MaxSessionBridge", INFINITE); - } - - PackAddBool(p, "NoArpPolling", h->Option->NoArpPolling); - PackAddBool(p, "NoIPv6AddrPolling", h->Option->NoIPv6AddrPolling); - PackAddBool(p, "NoIpTable", h->Option->NoIpTable); - PackAddBool(p, "NoEnum", h->Option->NoEnum); - PackAddBool(p, "FilterPPPoE", h->Option->FilterPPPoE); - PackAddBool(p, "YieldAfterStorePacket", h->Option->YieldAfterStorePacket); - PackAddBool(p, "NoSpinLockForPacketDelay", h->Option->NoSpinLockForPacketDelay); - PackAddInt(p, "BroadcastStormDetectionThreshold", h->Option->BroadcastStormDetectionThreshold); - PackAddInt(p, "MaxLoggedPacketsPerMinute", h->Option->MaxLoggedPacketsPerMinute); - PackAddInt(p, "FloodingSendQueueBufferQuota", h->Option->FloodingSendQueueBufferQuota); - PackAddBool(p, "DoNotSaveHeavySecurityLogs", h->Option->DoNotSaveHeavySecurityLogs); - PackAddBool(p, "DropBroadcastsInPrivacyFilterMode", h->Option->DropBroadcastsInPrivacyFilterMode); - PackAddBool(p, "DropArpInPrivacyFilterMode", h->Option->DropArpInPrivacyFilterMode); - PackAddBool(p, "SuppressClientUpdateNotification", h->Option->SuppressClientUpdateNotification); - PackAddBool(p, "AssignVLanIdByRadiusAttribute", h->Option->AssignVLanIdByRadiusAttribute); - PackAddBool(p, "DenyAllRadiusLoginWithNoVlanAssign", h->Option->DenyAllRadiusLoginWithNoVlanAssign); - PackAddInt(p, "ClientMinimumRequiredBuild", h->Option->ClientMinimumRequiredBuild); - PackAddBool(p, "SecureNAT_RandomizeAssignIp", h->Option->SecureNAT_RandomizeAssignIp); - PackAddBool(p, "NoPhysicalIPOnPacketLog", h->Option->NoPhysicalIPOnPacketLog); - PackAddInt(p, "DetectDormantSessionInterval", h->Option->DetectDormantSessionInterval); - PackAddBool(p, "FixForDLinkBPDU", h->Option->FixForDLinkBPDU); - PackAddBool(p, "BroadcastLimiterStrictMode", h->Option->BroadcastLimiterStrictMode); - PackAddBool(p, "NoLookBPDUBridgeId", h->Option->NoLookBPDUBridgeId); - PackAddBool(p, "NoManageVlanId", h->Option->NoManageVlanId); - PackAddInt(p, "VlanTypeId", h->Option->VlanTypeId); - PackAddBool(p, "FilterOSPF", h->Option->FilterOSPF); - PackAddBool(p, "FilterIPv4", h->Option->FilterIPv4); - PackAddBool(p, "FilterIPv6", h->Option->FilterIPv6); - PackAddBool(p, "FilterNonIP", h->Option->FilterNonIP); - PackAddBool(p, "NoIPv4PacketLog", h->Option->NoIPv4PacketLog); - PackAddBool(p, "NoIPv6PacketLog", h->Option->NoIPv6PacketLog); - PackAddBool(p, "FilterBPDU", h->Option->FilterBPDU); - PackAddBool(p, "NoIPv6DefaultRouterInRAWhenIPv6", h->Option->NoIPv6DefaultRouterInRAWhenIPv6); - PackAddBool(p, "NoMacAddressLog", h->Option->NoMacAddressLog); - PackAddBool(p, "ManageOnlyPrivateIP", h->Option->ManageOnlyPrivateIP); - PackAddBool(p, "ManageOnlyLocalUnicastIPv6", h->Option->ManageOnlyLocalUnicastIPv6); - PackAddBool(p, "DisableIPParsing", h->Option->DisableIPParsing); - PackAddInt(p, "AdjustTcpMssValue", h->Option->AdjustTcpMssValue); - PackAddBool(p, "DisableAdjustTcpMss", h->Option->DisableAdjustTcpMss); - PackAddBool(p, "NoDhcpPacketLogOutsideHub", h->Option->NoDhcpPacketLogOutsideHub); - PackAddBool(p, "DisableHttpParsing", h->Option->DisableHttpParsing); - PackAddBool(p, "DisableUdpAcceleration", h->Option->DisableUdpAcceleration); - PackAddBool(p, "DisableUdpFilterForLocalBridgeNic", h->Option->DisableUdpFilterForLocalBridgeNic); - PackAddBool(p, "ApplyIPv4AccessListOnArpPacket", h->Option->ApplyIPv4AccessListOnArpPacket); - PackAddBool(p, "RemoveDefGwOnDhcpForLocalhost", h->Option->RemoveDefGwOnDhcpForLocalhost); - - PackAddInt(p, "SecureNAT_MaxTcpSessionsPerIp", h->Option->SecureNAT_MaxTcpSessionsPerIp); - PackAddInt(p, "SecureNAT_MaxTcpSynSentPerIp", h->Option->SecureNAT_MaxTcpSynSentPerIp); - PackAddInt(p, "SecureNAT_MaxUdpSessionsPerIp", h->Option->SecureNAT_MaxUdpSessionsPerIp); - PackAddInt(p, "SecureNAT_MaxDnsSessionsPerIp", h->Option->SecureNAT_MaxDnsSessionsPerIp); - PackAddInt(p, "SecureNAT_MaxIcmpSessionsPerIp", h->Option->SecureNAT_MaxIcmpSessionsPerIp); - PackAddInt(p, "AccessListIncludeFileCacheLifetime", h->Option->AccessListIncludeFileCacheLifetime); - PackAddBool(p, "DisableKernelModeSecureNAT", h->Option->DisableKernelModeSecureNAT); - PackAddBool(p, "DisableIpRawModeSecureNAT", h->Option->DisableIpRawModeSecureNAT); - PackAddBool(p, "DisableUserModeSecureNAT", h->Option->DisableUserModeSecureNAT); - PackAddBool(p, "DisableCheckMacOnLocalBridge", h->Option->DisableCheckMacOnLocalBridge); - PackAddBool(p, "DisableCorrectIpOffloadChecksum", h->Option->DisableCorrectIpOffloadChecksum); - - PackAddInt(p, "SavePacketLog", h->LogSetting.SavePacketLog); - PackAddInt(p, "PacketLogSwitchType", h->LogSetting.PacketLogSwitchType); - for (i = 0;i < NUM_PACKET_LOG;i++) - { - PackAddIntEx(p, "PacketLogConfig", h->LogSetting.PacketLogConfig[i], i, NUM_PACKET_LOG); - } - PackAddInt(p, "SaveSecurityLog", h->LogSetting.SaveSecurityLog); - PackAddInt(p, "SecurityLogSwitchType", h->LogSetting.SecurityLogSwitchType); - PackAddData(p, "HashedPassword", h->HashedPassword, SHA1_SIZE); - PackAddData(p, "SecurePassword", h->SecurePassword, SHA1_SIZE); - PackAddBool(p, "UseHubNameAsDhcpUserClassOption", h->Option->UseHubNameAsDhcpUserClassOption); - PackAddBool(p, "UseHubNameAsRadiusNasId", h->Option->UseHubNameAsRadiusNasId); - - SiAccessListToPack(p, h->AccessList); - - if (h->EnableSecureNAT) - { - PackAddBool(p, "EnableSecureNAT", h->EnableSecureNAT); - OutVhOption(p, h->SecureNATOption); - } -} - -// Setting of the HUB has been updated -void SiHubUpdateProc(HUB *h) -{ - SERVER *s; - UINT i; - // Validate arguments - if (h == NULL || h->Cedar == NULL || h->Cedar->Server == NULL || h->Cedar->Server->ServerType != SERVER_TYPE_FARM_CONTROLLER) - { - return; - } - - s = h->Cedar->Server; - - if (s->FarmMemberList == NULL) - { - return; - } - - if (h->LastVersion != h->CurrentVersion || h->CurrentVersion == 0) - { - LIST *fm_list; - if (h->CurrentVersion == 0) - { - h->CurrentVersion = 1; - } - h->LastVersion = h->CurrentVersion; - - Debug("SiHubUpdateProc HUB=%s, Ver=%u, Type=%u, Offline=%u\n", h->Name, h->CurrentVersion, - h->Type, h->Offline); - - fm_list = NewListFast(NULL); - - LockList(s->FarmMemberList); - { - while (true) - { - bool escape = true; - // Update the HUB on all members - for (i = 0;i < LIST_NUM(s->FarmMemberList);i++) - { - FARM_MEMBER *f = LIST_DATA(s->FarmMemberList, i); - - if (IsInList(fm_list, f) == false) - { - Add(fm_list, f); - escape = false; - - if (f->Me == false) - { - SiCallUpdateHub(s, f, h); - } - - break; - } - } - - if (escape) - { - break; - } - - UnlockList(s->FarmMemberList); - LockList(s->FarmMemberList); - } - } - UnlockList(s->FarmMemberList); - - ReleaseList(fm_list); - } - - if (h->Offline == false) - { - SiHubOnlineProc(h); - } -} - -// HUB turns to online -void SiHubOnlineProc(HUB *h) -{ - SERVER *s; - UINT i; - // Validate arguments - if (h == NULL || h->Cedar->Server == NULL || h->Cedar->Server->ServerType != SERVER_TYPE_FARM_CONTROLLER) - { - // Process only on the farm controller - return; - } - - s = h->Cedar->Server; - - if (s->FarmMemberList == NULL) - { - return; - } - - LockList(s->FarmMemberList); - { - if (h->Type == HUB_TYPE_FARM_STATIC) - { - // Static HUB - // Create the HUB on all members - for (i = 0;i < LIST_NUM(s->FarmMemberList);i++) - { - UINT j; - bool exists = false; - FARM_MEMBER *f = LIST_DATA(s->FarmMemberList, i); - - LockList(f->HubList); - { - for (j = 0;j < LIST_NUM(f->HubList);j++) - { - HUB_LIST *hh = LIST_DATA(f->HubList, j); - if (StrCmpi(hh->Name, h->Name) == 0) - { - exists = true; - } - } - } - UnlockList(f->HubList); - - if (exists == false) - { - SiCallCreateHub(s, f, h); - } - } - } - } - UnlockList(s->FarmMemberList); -} - -// HUB turns to offline -void SiHubOfflineProc(HUB *h) -{ - SERVER *s; - char hubname[MAX_HUBNAME_LEN + 1]; - UINT i; - LIST *fm_list; - // Validate arguments - if (h == NULL || h->Cedar->Server == NULL || h->Cedar->Server->ServerType != SERVER_TYPE_FARM_CONTROLLER) - { - // Process only on the farm controller - return; - } - - s = h->Cedar->Server; - - if (s->FarmMemberList == NULL) - { - return; - } - - StrCpy(hubname, sizeof(hubname), h->Name); - - fm_list = NewListFast(NULL); - - LockList(s->FarmMemberList); - { - while (true) - { - bool escape = true; - - // Stop the HUB on all members - for (i = 0;i < LIST_NUM(s->FarmMemberList);i++) - { - FARM_MEMBER *f = LIST_DATA(s->FarmMemberList, i); - - if (IsInList(fm_list, f) == false) - { - Add(fm_list, f); - escape = false; - - SiCallDeleteHub(s, f, h); - - break; - } - } - - if (escape) - { - break; - } - - UnlockList(s->FarmMemberList); - LockList(s->FarmMemberList); - } - } - UnlockList(s->FarmMemberList); - - ReleaseList(fm_list); -} - -// Convert an access to PACK -void SiAccessToPack(PACK *p, ACCESS *a, UINT i, UINT total) -{ - // Validate arguments - if (p == NULL || a == NULL) - { - return; - } - - PackAddUniStrEx(p, "Note", a->Note, i, total); - PackAddIntEx(p, "Active", a->Active, i, total); - PackAddIntEx(p, "Priority", a->Priority, i, total); - PackAddIntEx(p, "Discard", a->Discard, i, total); - if (a->IsIPv6) - { - PackAddIp32Ex(p, "SrcIpAddress", 0xFDFFFFDF, i, total); - PackAddIp32Ex(p, "SrcSubnetMask", 0xFFFFFFFF, i, total); - PackAddIp32Ex(p, "DestIpAddress", 0xFDFFFFDF, i, total); - PackAddIp32Ex(p, "DestSubnetMask", 0xFFFFFFFF, i, total); - } - else - { - PackAddIp32Ex(p, "SrcIpAddress", a->SrcIpAddress, i, total); - PackAddIp32Ex(p, "SrcSubnetMask", a->SrcSubnetMask, i, total); - PackAddIp32Ex(p, "DestIpAddress", a->DestIpAddress, i, total); - PackAddIp32Ex(p, "DestSubnetMask", a->DestSubnetMask, i, total); - } - PackAddIntEx(p, "Protocol", a->Protocol, i, total); - PackAddIntEx(p, "SrcPortStart", a->SrcPortStart, i, total); - PackAddIntEx(p, "SrcPortEnd", a->SrcPortEnd, i, total); - PackAddIntEx(p, "DestPortStart", a->DestPortStart, i, total); - PackAddIntEx(p, "DestPortEnd", a->DestPortEnd, i, total); - PackAddStrEx(p, "SrcUsername", a->SrcUsername, i, total); - PackAddStrEx(p, "DestUsername", a->DestUsername, i, total); - PackAddBoolEx(p, "CheckSrcMac", a->CheckSrcMac, i, total); - PackAddDataEx(p, "SrcMacAddress", a->SrcMacAddress, sizeof(a->SrcMacAddress), i, total); - PackAddDataEx(p, "SrcMacMask", a->SrcMacMask, sizeof(a->SrcMacMask), i, total); - PackAddBoolEx(p, "CheckDstMac", a->CheckDstMac, i, total); - PackAddDataEx(p, "DstMacAddress", a->DstMacAddress, sizeof(a->DstMacAddress), i, total); - PackAddDataEx(p, "DstMacMask", a->DstMacMask, sizeof(a->DstMacMask), i, total); - PackAddBoolEx(p, "CheckTcpState", a->CheckTcpState, i, total); - PackAddBoolEx(p, "Established", a->Established, i, total); - PackAddIntEx(p, "Delay", a->Delay, i, total); - PackAddIntEx(p, "Jitter", a->Jitter, i, total); - PackAddIntEx(p, "Loss", a->Loss, i, total); - PackAddStrEx(p, "RedirectUrl", a->RedirectUrl, i, total); - PackAddBoolEx(p, "IsIPv6", a->IsIPv6, i, total); - if (a->IsIPv6) - { - PackAddIp6AddrEx(p, "SrcIpAddress6", &a->SrcIpAddress6, i, total); - PackAddIp6AddrEx(p, "SrcSubnetMask6", &a->SrcSubnetMask6, i, total); - PackAddIp6AddrEx(p, "DestIpAddress6", &a->DestIpAddress6, i, total); - PackAddIp6AddrEx(p, "DestSubnetMask6", &a->DestSubnetMask6, i, total); - } - else - { - IPV6_ADDR zero; - - Zero(&zero, sizeof(zero)); - - PackAddIp6AddrEx(p, "SrcIpAddress6", &zero, i, total); - PackAddIp6AddrEx(p, "SrcSubnetMask6", &zero, i, total); - PackAddIp6AddrEx(p, "DestIpAddress6", &zero, i, total); - PackAddIp6AddrEx(p, "DestSubnetMask6", &zero, i, total); - } -} - -// Get number of access contained in the PACK -UINT SiNumAccessFromPack(PACK *p) -{ - // Validate arguments - if (p == NULL) - { - return 0; - } - - return PackGetIndexCount(p, "Active"); -} - -// Convert the PACK to access -ACCESS *SiPackToAccess(PACK *p, UINT i) -{ - ACCESS *a; - // Validate arguments - if (p == NULL) - { - return NULL; - } - - a = ZeroMalloc(sizeof(ACCESS)); - - PackGetUniStrEx(p, "Note", a->Note, sizeof(a->Note), i); - a->Active = PackGetIntEx(p, "Active", i); - a->Priority = PackGetIntEx(p, "Priority", i); - a->Discard = PackGetIntEx(p, "Discard", i); - a->SrcIpAddress = PackGetIp32Ex(p, "SrcIpAddress", i); - a->SrcSubnetMask = PackGetIp32Ex(p, "SrcSubnetMask", i); - a->DestIpAddress = PackGetIp32Ex(p, "DestIpAddress", i); - a->DestSubnetMask = PackGetIp32Ex(p, "DestSubnetMask", i); - a->Protocol = PackGetIntEx(p, "Protocol", i); - a->SrcPortStart = PackGetIntEx(p, "SrcPortStart", i); - a->SrcPortEnd = PackGetIntEx(p, "SrcPortEnd", i); - a->DestPortStart = PackGetIntEx(p, "DestPortStart", i); - a->DestPortEnd = PackGetIntEx(p, "DestPortEnd", i); - PackGetStrEx(p, "SrcUsername", a->SrcUsername, sizeof(a->SrcUsername), i); - PackGetStrEx(p, "DestUsername", a->DestUsername, sizeof(a->DestUsername), i); - a->CheckSrcMac = PackGetBoolEx(p, "CheckSrcMac", i); - PackGetDataEx2(p, "SrcMacAddress", a->SrcMacAddress, sizeof(a->SrcMacAddress), i); - PackGetDataEx2(p, "SrcMacMask", a->SrcMacMask, sizeof(a->SrcMacMask), i); - a->CheckDstMac = PackGetBoolEx(p, "CheckDstMac", i); - PackGetDataEx2(p, "DstMacAddress", a->DstMacAddress, sizeof(a->DstMacAddress), i); - PackGetDataEx2(p, "DstMacMask", a->DstMacMask, sizeof(a->DstMacMask), i); - a->CheckTcpState = PackGetBoolEx(p, "CheckTcpState", i); - a->Established = PackGetBoolEx(p, "Established", i); - a->Delay = PackGetIntEx(p, "Delay", i); - a->Jitter = PackGetIntEx(p, "Jitter", i); - a->Loss = PackGetIntEx(p, "Loss", i); - a->IsIPv6 = PackGetBoolEx(p, "IsIPv6", i); - PackGetStrEx(p, "RedirectUrl", a->RedirectUrl, sizeof(a->RedirectUrl), i); - if (a->IsIPv6) - { - PackGetIp6AddrEx(p, "SrcIpAddress6", &a->SrcIpAddress6, i); - PackGetIp6AddrEx(p, "SrcSubnetMask6", &a->SrcSubnetMask6, i); - PackGetIp6AddrEx(p, "DestIpAddress6", &a->DestIpAddress6, i); - PackGetIp6AddrEx(p, "DestSubnetMask6", &a->DestSubnetMask6, i); - } - - return a; -} - -// Convert the PACK to an access list -void SiAccessListToPack(PACK *p, LIST *o) -{ - // Validate arguments - if (p == NULL || o == NULL) - { - return; - } - - LockList(o); - { - UINT i; - for (i = 0;i < LIST_NUM(o);i++) - { - ACCESS *a = LIST_DATA(o, i); - SiAccessToPack(p, a, i, LIST_NUM(o)); - } - } - UnlockList(o); -} - -// Get the member that is hosting the specified HUB -FARM_MEMBER *SiGetHubHostingMember(SERVER *s, HUB *h, bool admin_mode, CONNECTION *c) -{ - FARM_MEMBER *ret = NULL; - char name[MAX_SIZE]; - UINT i; - // Validate arguments - if (s == NULL || h == NULL || c == NULL) - { - return NULL; - } - - StrCpy(name, sizeof(name), h->Name); - - if (h->Type == HUB_TYPE_FARM_STATIC) - { - // It is good to select any member in the case of static HUB - if (admin_mode == false) - { - ret = SiGetNextFarmMember(s, c, h); - } - else - { - UINT i; - ret = NULL; - - for (i = 0;i < LIST_NUM(s->FarmMemberList);i++) - { - FARM_MEMBER *f = LIST_DATA(s->FarmMemberList, i); - if (f->Me) - { - ret = f; - break; - } - } - } - } - else - { - // Examine whether there is a member that is hosting the HUB already in the case of dynamic HUB - for (i = 0;i < LIST_NUM(s->FarmMemberList);i++) - { - FARM_MEMBER *f = LIST_DATA(s->FarmMemberList, i); - HUB_LIST *hh, t; - StrCpy(t.Name, sizeof(t.Name), name); - LockList(f->HubList); - { - hh = Search(f->HubList, &t); - if (hh != NULL) - { - // Found - ret = f; - } - } - UnlockList(f->HubList); - } - - if (ret == NULL) - { - // Let host the new HUB - FARM_MEMBER *f; - - // Select the member to host - ret = SiGetNextFarmMember(s, c, h); - - f = ret; - if (f != NULL) - { - // HUB creation directive - SiAddHubCreateHistory(s, name); - SiCallCreateHub(s, f, h); - SiCallUpdateHub(s, f, h); - } - } - } - - return ret; -} - -// Task is called -PACK *SiCalledTask(FARM_CONTROLLER *f, PACK *p, char *taskname) -{ - PACK *ret; - SERVER *s; - // Validate arguments - if (f == NULL || p == NULL || taskname == NULL) - { - return NULL; - } - - ret = NULL; - s = f->Server; - - if (StrCmpi(taskname, "noop") == 0) - { - // NO OPERATION - ret = NewPack(); - } - else - { - Debug("Task Called: [%s].\n", taskname); - if (StrCmpi(taskname, "createhub") == 0) - { - SiCalledCreateHub(s, p); - ret = NewPack(); - } - else if (StrCmpi(taskname, "deletehub") == 0) - { - SiCalledDeleteHub(s, p); - ret = NewPack(); - } - else if (StrCmpi(taskname, "enumhub") == 0) - { - ret = NewPack(); - SiCalledEnumHub(s, ret, p); - } - else if (StrCmpi(taskname, "updatehub") == 0) - { - SiCalledUpdateHub(s, p); - ret = NewPack(); - } - else if (StrCmpi(taskname, "createticket") == 0) - { - ret = SiCalledCreateTicket(s, p); - } - else if (StrCmpi(taskname, "enumnat") == 0) - { - ret = SiCalledEnumNat(s, p); - } - else if (StrCmpi(taskname, "enumdhcp") == 0) - { - ret = SiCalledEnumDhcp(s, p); - } - else if (StrCmpi(taskname, "getnatstatus") == 0) - { - ret = SiCalledGetNatStatus(s, p); - } - else if (StrCmpi(taskname, "enumsession") == 0) - { - ret = SiCalledEnumSession(s, p); - } - else if (StrCmpi(taskname, "deletesession") == 0) - { - SiCalledDeleteSession(s, p); - ret = NewPack(); - } - else if (StrCmpi(taskname, "deletemactable") == 0) - { - SiCalledDeleteMacTable(s, p); - ret = NewPack(); - } - else if (StrCmpi(taskname, "deleteiptable") == 0) - { - SiCalledDeleteIpTable(s, p); - ret = NewPack(); - } - else if (StrCmpi(taskname, "enummactable") == 0) - { - ret = SiCalledEnumMacTable(s, p); - } - else if (StrCmpi(taskname, "enumiptable") == 0) - { - ret = SiCalledEnumIpTable(s, p); - } - else if (StrCmpi(taskname, "getsessionstatus") == 0) - { - ret = SiCalledGetSessionStatus(s, p); - } - else if (StrCmpi(taskname, "enumlogfilelist") == 0) - { - ret = SiCalledEnumLogFileList(s, p); - } - else if (StrCmpi(taskname, "readlogfile") == 0) - { - ret = SiCalledReadLogFile(s, p); - } - } - - return ret; -} - -// Call the task -PACK *SiCallTask(FARM_MEMBER *f, PACK *p, char *taskname) -{ - PACK *ret; - char tmp[MAX_PATH]; - // Validate arguments - if (f == NULL || p == NULL || taskname == NULL) - { - return NULL; - } - - PackAddStr(p, "taskname", taskname); - - Debug("Call Task [%s] (%s)\n", taskname, f->hostname); - - Format(tmp, sizeof(tmp), "CLUSTER_CALL: Entering Call [%s] to %s", taskname, f->hostname); - SiDebugLog(f->Cedar->Server, tmp); - - ret = SiExecTask(f, p); - - Format(tmp, sizeof(tmp), "CLUSTER_CALL: Leaving Call [%s] to %s", taskname, f->hostname); - SiDebugLog(f->Cedar->Server, tmp); - - return ret; -} - -// Task listening procedure (Main Process) -void SiAcceptTasksFromControllerMain(FARM_CONTROLLER *f, SOCK *sock) -{ - PACK *request; - PACK *response; - char taskname[MAX_SIZE]; - // Validate arguments - if (f == NULL || sock == NULL) - { - return; - } - - f->IsConnected = true; - - while (true) - { - bool ret; - // Receive the PACK - request = HttpClientRecv(sock); - if (request == NULL) - { - // Disconnect - break; - } - - response = NULL; - - // Get the name - if (PackGetStr(request, "taskname", taskname, sizeof(taskname))) - { - Lock(f->Server->TasksFromFarmControllerLock); - { - response = SiCalledTask(f, request, taskname); - } - Unlock(f->Server->TasksFromFarmControllerLock); - } - - FreePack(request); - - // Return a response - if (response == NULL) - { - response = NewPack(); - } - else - { - PackAddInt(response, "succeed", 1); - } - - ret = HttpClientSend(sock, response); - FreePack(response); - - if (ret == false) - { - // Disconnect - break; - } - } - - f->IsConnected = false; -} - -// Task waiting procedure -void SiAcceptTasksFromController(FARM_CONTROLLER *f, SOCK *sock) -{ - UINT i; - HUB **hubs; - UINT num_hubs; - CEDAR *c; - SERVER *s; - // Validate arguments - if (f == NULL || sock == NULL) - { - return; - } - - s = f->Server; - c = s->Cedar; - - // Main process - SiAcceptTasksFromControllerMain(f, sock); - - // Stop all Virtual HUBs since the connection to the controller is disconnected - LockList(c->HubList); - { - hubs = ToArray(c->HubList); - num_hubs = LIST_NUM(c->HubList); - for (i = 0;i < num_hubs;i++) - { - AddRef(hubs[i]->ref); - } - } - UnlockList(c->HubList); - - for (i = 0;i < num_hubs;i++) - { - SetHubOffline(hubs[i]); - DelHub(c, hubs[i]); - ReleaseHub(hubs[i]); - } - - Free(hubs); -} - -// Execute the task -PACK *SiExecTask(FARM_MEMBER *f, PACK *p) -{ - FARM_TASK *t; - // Validate arguments - if (f == NULL || p == NULL) - { - return NULL; - } - - t = SiFarmServPostTask(f, p); - if (t == NULL) - { - return NULL; - } - - return SiFarmServWaitTask(t); -} - -// Task queuing -FARM_TASK *SiFarmServPostTask(FARM_MEMBER *f, PACK *request) -{ - FARM_TASK *t; - // Validate arguments - if (f == NULL || request == NULL) - { - return NULL; - } - - t = ZeroMalloc(sizeof(FARM_TASK)); - t->CompleteEvent = NewEvent(); - t->Request = request; - - LockQueue(f->TaskQueue); - { - if (f->Halting) - { - // Halting (failure) - UnlockQueue(f->TaskQueue); - ReleaseEvent(t->CompleteEvent); - Free(t); - return NULL; - } - - InsertQueue(f->TaskQueue, t); - } - UnlockQueue(f->TaskQueue); - - Set(f->TaskPostEvent); - - return t; -} - -// Wait for task results -PACK *SiFarmServWaitTask(FARM_TASK *t) -{ - PACK *response; - // Validate arguments - if (t == NULL) - { - return NULL; - } - - Wait(t->CompleteEvent, INFINITE); - ReleaseEvent(t->CompleteEvent); - FreePack(t->Request); - - response = t->Response; - Free(t); - - if (PackGetInt(response, "succeed") == 0) - { - // Task calling fails for any reason - FreePack(response); - return NULL; - } - - return response; -} - -// Server farm processing main -void SiFarmServMain(SERVER *server, SOCK *sock, FARM_MEMBER *f) -{ - UINT wait_time = SERVER_CONTROL_TCP_TIMEOUT / 2; - bool send_noop = false; - UINT i; - CEDAR *c; - // Validate arguments - if (server == NULL || sock == NULL || f == NULL) - { - Debug("SiFarmServMain Failed.\n"); - return; - } - - Debug("SiFarmServMain Started.\n"); - - c = server->Cedar; - - // Send a directive to create all static HUBs at the stage - // where the members have been connected to the controller - LockList(c->HubList); - { - for (i = 0;i < LIST_NUM(c->HubList);i++) - { - HUB *h = LIST_DATA(c->HubList, i); - if (h->Offline == false) - { - if (h->Type == HUB_TYPE_FARM_STATIC) - { - PACK *p; - HUB_LIST *hh; - p = NewPack(); - SiPackAddCreateHub(p, h); - PackAddStr(p, "taskname", "createhub"); - HttpServerSend(sock, p); - FreePack(p); - p = HttpServerRecv(sock); - FreePack(p); - - p = NewPack(); - SiPackAddCreateHub(p, h); - PackAddStr(p, "taskname", "updatehub"); - HttpServerSend(sock, p); - FreePack(p); - p = HttpServerRecv(sock); - FreePack(p); - - hh = ZeroMalloc(sizeof(HUB_LIST)); - hh->DynamicHub = false; - hh->FarmMember = f; - StrCpy(hh->Name, sizeof(hh->Name), h->Name); - LockList(f->HubList); - { - Add(f->HubList, hh); - } - UnlockList(f->HubList); - } - } - } - } - UnlockList(c->HubList); - - Debug("SiFarmServMain: while (true)\n"); - - while (true) - { - FARM_TASK *t; - UINT64 tick; - - do - { - // Check whether a new task arrived - LockQueue(f->TaskQueue); - { - t = GetNext(f->TaskQueue); - } - UnlockQueue(f->TaskQueue); - - if (t != NULL) - { - // Handle this task - PACK *p = t->Request; - bool ret; - - // Transmission - ret = HttpServerSend(sock, p); - send_noop = false; - - if (ret == false) - { - // Disconnected - // Cancel this task - Set(t->CompleteEvent); - goto DISCONNECTED; - } - - // Receive - p = HttpServerRecvEx(sock, FIRM_SERV_RECV_PACK_MAX_SIZE); - - t->Response = p; - Set(t->CompleteEvent); - - if (p == NULL) - { - // Avoid infinite loop - Disconnect(sock); - goto DISCONNECTED; - } - } - } - while (t != NULL); - - if (send_noop) - { - // Send a NOOP - PACK *p; - bool ret; - p = NewPack(); - PackAddStr(p, "taskname", "noop"); - - ret = HttpServerSend(sock, p); - FreePack(p); - - if (ret == false) - { - goto DISCONNECTED; - } - - p = HttpServerRecv(sock); - if (p == NULL) - { - goto DISCONNECTED; - } - - FreePack(p); - } - - tick = Tick64(); - - while (true) - { - bool break_flag; - if ((tick + wait_time) <= Tick64()) - { - break; - } - - Wait(f->TaskPostEvent, 250); - - break_flag = false; - LockQueue(f->TaskQueue); - { - if (f->TaskQueue->num_item != 0) - { - break_flag = true; - } - } - UnlockQueue(f->TaskQueue); - - if (break_flag || f->Halting || server->Halt) - { - break; - } - } - send_noop = true; - } - -DISCONNECTED: - - Debug("SiFarmServMain: DISCONNECTED\n"); - - f->Halting = true; - // Cancel all outstanding tasks - LockQueue(f->TaskQueue); - { - FARM_TASK *t; - - while (t = GetNext(f->TaskQueue)) - { - Set(t->CompleteEvent); - } - } - UnlockQueue(f->TaskQueue); -} - -// Farm server function that handles the connection from farm members -void SiFarmServ(SERVER *server, SOCK *sock, X *cert, UINT ip, UINT num_port, UINT *ports, char *hostname, UINT point, UINT weight, UINT max_sessions) -{ - PACK *p; - FARM_MEMBER *f; - UINT i; - char tmp[MAX_SIZE]; - // Validate arguments - if (server == NULL || sock == NULL || cert == NULL || num_port == 0 || ports == NULL || hostname == NULL) - { - return; - } - - if (weight == 0) - { - weight = FARM_DEFAULT_WEIGHT; - } - - if (max_sessions == 0) - { - max_sessions = SERVER_MAX_SESSIONS; - } - - if (ip == 0) - { - // If the public IP address is not specified, specify the connection - // source IP address of this farm member server - ip = IPToUINT(&sock->RemoteIP); - } - - IPToStr32(tmp, sizeof(tmp), ip); - SLog(server->Cedar, "LS_FARM_SERV_START", tmp, hostname); - - // Inform the success - p = NewPack(); - HttpServerSend(sock, p); - FreePack(p); - - IPToStr32(tmp, sizeof(tmp), ip); - Debug("Farm Member %s Connected. IP: %s\n", hostname, tmp); - - SetTimeout(sock, SERVER_CONTROL_TCP_TIMEOUT); - - f = ZeroMalloc(sizeof(FARM_MEMBER)); - f->Cedar = server->Cedar; - f->Ip = ip; - f->NumPort = num_port; - f->Ports = ports; - StrCpy(f->hostname, sizeof(f->hostname), hostname); - f->ServerCert = cert; - f->ConnectedTime = SystemTime64(); - f->Weight = weight; - f->MaxSessions = max_sessions; - - f->HubList = NewList(CompareHubList); - f->Point = point; - - f->TaskQueue = NewQueue(); - f->TaskPostEvent = NewEvent(); - - // Add to the list - LockList(server->FarmMemberList); - { - Add(server->FarmMemberList, f); - } - UnlockList(server->FarmMemberList); - - // Main process - SiFarmServMain(server, sock, f); - - // Remove from the list - LockList(server->FarmMemberList); - { - Delete(server->FarmMemberList, f); - } - UnlockList(server->FarmMemberList); - - ReleaseQueue(f->TaskQueue); - ReleaseEvent(f->TaskPostEvent); - - for (i = 0;i < LIST_NUM(f->HubList);i++) - { - HUB_LIST *hh = LIST_DATA(f->HubList, i); - Free(hh); - } - - ReleaseList(f->HubList); - - Free(f); - - SLog(server->Cedar, "LS_FARM_SERV_END", hostname); -} - -// Search in HUB list -int CompareHubList(void *p1, void *p2) -{ - HUB_LIST *h1, *h2; - if (p1 == NULL || p2 == NULL) - { - return 0; - } - h1 = *(HUB_LIST **)p1; - h2 = *(HUB_LIST **)p2; - if (h1 == NULL || h2 == NULL) - { - return 0; - } - return StrCmpi(h1->Name, h2->Name); -} - -// Connection thread to the controller -void SiConnectToControllerThread(THREAD *thread, void *param) -{ - FARM_CONTROLLER *f; - SESSION *s; - CONNECTION *c; - SERVER *server; - bool first_failed; - // Validate arguments - if (thread == NULL || param == NULL) - { - return; - } - -#ifdef OS_WIN32 - MsSetThreadPriorityRealtime(); -#endif // OS_WIN32 - - f = (FARM_CONTROLLER *)param; - f->Thread = thread; - AddRef(f->Thread->ref); - NoticeThreadInit(thread); - - f->StartedTime = SystemTime64(); - - server = f->Server; - - SLog(server->Cedar, "LS_FARM_CONNECT_1", server->ControllerName); - - first_failed = true; - - while (true) - { - // Attempt to connect - CLIENT_OPTION o; - - f->LastError = ERR_TRYING_TO_CONNECT; - - Zero(&o, sizeof(CLIENT_OPTION)); - StrCpy(o.Hostname, sizeof(o.Hostname), server->ControllerName); - o.Port = server->ControllerPort; - f->NumTry++; - - Debug("Try to Connect %s (Controller).\n", server->ControllerName); - - s = NewRpcSessionEx(server->Cedar, &o, NULL, CEDAR_SERVER_FARM_STR); - - if (s != NULL) - { - // Connection success: send the authentication data - PACK *p = NewPack(); - UCHAR secure_password[SHA1_SIZE]; - BUF *b; - - c = s->Connection; - - Lock(f->lock); - { - f->Sock = c->FirstSock; - AddRef(f->Sock->ref); - SetTimeout(f->Sock, SERVER_CONTROL_TCP_TIMEOUT); - } - Unlock(f->lock); - - // Method - PackAddStr(p, "method", "farm_connect"); - PackAddClientVersion(p, s->Connection); - - // Password - SecurePassword(secure_password, server->MemberPassword, s->Connection->Random); - PackAddData(p, "SecurePassword", secure_password, sizeof(secure_password)); - - Lock(server->Cedar->lock); - { - b = XToBuf(server->Cedar->ServerX, false); - } - Unlock(server->Cedar->lock); - - if (b != NULL) - { - char tmp[MAX_SIZE]; - bool ret; - UINT i; - // Server certificate - PackAddBuf(p, "ServerCert", b); - FreeBuf(b); - - // Maximum number of sessions - PackAddInt(p, "MaxSessions", GetServerCapsInt(server, "i_max_sessions")); - - // Point - PackAddInt(p, "Point", SiGetPoint(server)); - PackAddInt(p, "Weight", server->Weight); - - // Host name - GetMachineName(tmp, sizeof(tmp)); - PackAddStr(p, "HostName", tmp); - - // Public IP - PackAddIp32(p, "PublicIp", server->PublicIp); - - // Public port - for (i = 0;i < server->NumPublicPort;i++) - { - PackAddIntEx(p, "PublicPort", server->PublicPorts[i], i, server->NumPublicPort); - } - - ret = HttpClientSend(c->FirstSock, p); - - if (ret) - { - PACK *p; - UINT err = ERR_PROTOCOL_ERROR; - - first_failed = true; - p = HttpClientRecv(c->FirstSock); - if (p != NULL && (err = GetErrorFromPack(p)) == 0) - { - // Successful connection - SLog(server->Cedar, "LS_FARM_START"); - f->CurrentConnectedTime = SystemTime64(); - if (f->FirstConnectedTime == 0) - { - f->FirstConnectedTime = SystemTime64(); - } - f->NumConnected++; - Debug("Connect Succeed.\n"); - f->Online = true; - - // Main process - SiAcceptTasksFromController(f, c->FirstSock); - - f->Online = false; - } - else - { - // Error - f->LastError = err; - SLog(server->Cedar, "LS_FARM_CONNECT_2", server->ControllerName, - GetUniErrorStr(err), err); - } - FreePack(p); - } - else - { - f->LastError = ERR_DISCONNECTED; - - if (first_failed) - { - SLog(server->Cedar, "LS_FARM_CONNECT_3", server->ControllerName, RETRY_CONNECT_TO_CONTROLLER_INTERVAL / 1000); - first_failed = false; - } - } - } - - FreePack(p); - - // Disconnect - Lock(f->lock); - { - if (f->Sock != NULL) - { - ReleaseSock(f->Sock); - f->Sock = NULL; - } - } - Unlock(f->lock); - - ReleaseSession(s); - s = NULL; - - if (f->LastError == ERR_TRYING_TO_CONNECT) - { - f->LastError = ERR_DISCONNECTED; - } - } - else - { - // Connection failure - f->LastError = ERR_CONNECT_TO_FARM_CONTROLLER; - - if (first_failed) - { - SLog(server->Cedar, "LS_FARM_CONNECT_3", server->ControllerName, RETRY_CONNECT_TO_CONTROLLER_INTERVAL / 1000); - first_failed = false; - } - } - - Debug("Controller Disconnected. ERROR = %S\n", _E(f->LastError)); - - f->NumFailed = f->NumTry - f->NumConnected; - - // Wait for event - Wait(f->HaltEvent, RETRY_CONNECT_TO_CONTROLLER_INTERVAL); - - if (f->Halt) - { - // Halting flag - break; - } - } - - SLog(server->Cedar, "LS_FARM_DISCONNECT"); -} - -// Disconnect the connection to the controller -void SiStopConnectToController(FARM_CONTROLLER *f) -{ - // Validate arguments - if (f == NULL) - { - return; - } - - f->Halt = true; - - // Stop the connection - Lock(f->lock); - { - Disconnect(f->Sock); - } - Unlock(f->lock); - - Set(f->HaltEvent); - - // Wait for the thread termination - WaitThread(f->Thread, INFINITE); - ReleaseThread(f->Thread); - - DeleteLock(f->lock); - ReleaseEvent(f->HaltEvent); - - Free(f); -} - -// Start a connection to the controller -FARM_CONTROLLER *SiStartConnectToController(SERVER *s) -{ - FARM_CONTROLLER *f; - THREAD *t; - // Validate arguments - if (s == NULL) - { - return NULL; - } - - f = ZeroMalloc(sizeof(FARM_CONTROLLER)); - f->Server = s; - f->LastError = ERR_TRYING_TO_CONNECT; - f->HaltEvent = NewEvent(); - f->lock = NewLock(); - - t = NewThread(SiConnectToControllerThread, f); - WaitThreadInit(t); - ReleaseThread(t); - - return f; -} - -// Get the current version -void SiGetCurrentRegion(CEDAR *c, char *region, UINT region_size) -{ - ClearStr(region, region_size); - // Validate arguments - if (c == NULL || region == NULL) - { - return; - } - - Lock(c->CurrentRegionLock); - { - StrCpy(region, region_size, c->CurrentRegion); - } - Unlock(c->CurrentRegionLock); - - if (IsEmptyStr(region)) - { - if (GetCurrentLangId() == SE_LANG_JAPANESE) - { - StrCpy(region, region_size, "JP"); - } - else if (GetCurrentLangId() == SE_LANG_CHINESE_ZH) - { - StrCpy(region, region_size, "CN"); - } - } -} - -// Check whether some enterprise functions are restricted -// -// ** Hints by Daiyuu Nobori, written on March 19, 2014 ** -// -// The following 'enterprise functions' are implemented on SoftEther VPN Server -// since March 19, 2014. However, these functions are disabled on -// SoftEther VPN Servers which run in Japan and China. -// -// - RADIUS / NT Domain user authentication -// - RSA certificate authentication -// - Deep-inspect packet logging -// - Source IP address control list -// - syslog transfer -// -// The SoftEther VPN Project intentionally disables these functions for users -// in Japan and China. The reason is: Daiyuu Nobori, the chief author of -// SoftEther VPN, has been liable to observe the existing agreements and -// restrictions between him and some companies. The agreements have regulated -// the region-limited restriction to implement and distribute the above -// enterprise functions on the SoftEther VPN open-source program. -// -// Therefore, the SoftEther VPN Project distributes the binary program and -// the source code with the "SiIsEnterpriseFunctionsRestrictedOnOpenSource" -// function. This function identifies whether the SoftEther VPN Server -// program is running in either Japan or China. If the restricted region is -// detected, then the above enterprise functions will be disabled. -// -// Please note that the above restriction has been imposed only on the -// original binaries and source codes from the SoftEther VPN Project. -// Anyone, except Daiyuu Nobori, who understands and writes the C language -// program can remove this restriction at his own risk. -// -bool SiIsEnterpriseFunctionsRestrictedOnOpenSource(CEDAR *c) -{ - char region[128]; - bool ret = false; - // Validate arguments - if (c == NULL) - { - return false; - } - - - SiGetCurrentRegion(c, region, sizeof(region)); - - if (StrCmpi(region, "JP") == 0 || StrCmpi(region, "CN") == 0) - { - ret = true; - } - - return ret; -} - -// Update the current region -void SiUpdateCurrentRegion(CEDAR *c, char *region, bool force_update) -{ - bool changed = false; - // Validate arguments - if (c == NULL) - { - return; - } - - if (IsEmptyStr(region) == false) - { - Lock(c->CurrentRegionLock); - { - if (StrCmpi(c->CurrentRegion, region) != 0) - { - StrCpy(c->CurrentRegion, sizeof(c->CurrentRegion), region); - changed = true; - } - } - Unlock(c->CurrentRegionLock); - } - - if (force_update) - { - changed = true; - } - - if (changed) - { - FlushServerCaps(c->Server); - } -} - -// Create a server -SERVER *SiNewServer(bool bridge) -{ - return SiNewServerEx(bridge, false, false); -} -SERVER *SiNewServerEx(bool bridge, bool in_client_inner_server, bool relay_server) -{ - SERVER *s; - LISTENER *inproc; - LISTENER *azure; - LISTENER *rudp; - - SetGetIpThreadMaxNum(DEFAULT_GETIP_THREAD_MAX_NUM); - - s = ZeroMalloc(sizeof(SERVER)); - - SetEraserCheckInterval(0); - - SiInitHubCreateHistory(s); - - InitServerCapsCache(s); - - Rand(s->MyRandomKey, sizeof(s->MyRandomKey)); - - s->lock = NewLock(); - - - s->OpenVpnSstpConfigLock = NewLock(); - s->SaveCfgLock = NewLock(); - s->ref = NewRef(); - s->Cedar = NewCedar(NULL, NULL); - s->Cedar->Server = s; - - -#ifdef OS_WIN32 - s->IsInVm = MsIsInVm(); -#else // OS_WIN32 - s->IsInVm = UnixIsInVm(); -#endif // OS_WIN32 - -#ifdef ENABLE_AZURE_SERVER - if (IsFileExists("@azureserver.config")) - { - DisableRDUPServerGlobally(); - s->AzureServer = NewAzureServer(s->Cedar); - - SleepThread(500); - } -#endif // ENABLE_AZURE_SERVER - - s->Cedar->CheckExpires = true; - s->ServerListenerList = NewList(CompareServerListener); - s->PortsUDP = NewIntList(true); - s->StartTime = SystemTime64(); - s->TasksFromFarmControllerLock = NewLock(); - - if (bridge) - { - SetCedarVpnBridge(s->Cedar); - } - -#ifdef OS_WIN32 - if (IsHamMode() == false) - { - RegistWindowsFirewallAll(); - } -#endif - - s->Keep = StartKeep(); - - // Log related - MakeDir(bridge == false ? SERVER_LOG_DIR_NAME : BRIDGE_LOG_DIR_NAME); - s->Logger = NewLog(bridge == false ? SERVER_LOG_DIR_NAME : BRIDGE_LOG_DIR_NAME, SERVER_LOG_PERFIX, LOG_SWITCH_DAY); - - SLog(s->Cedar, "L_LINE"); - SLog(s->Cedar, "LS_START_2", s->Cedar->ServerStr, s->Cedar->VerString); - SLog(s->Cedar, "LS_START_3", s->Cedar->BuildInfo); - SLog(s->Cedar, "LS_START_UTF8"); - SLog(s->Cedar, "LS_START_1"); - - - - // Initialize the configuration - SiInitConfiguration(s); - - s->Syslog = NewSysLog(NULL, 0, &s->Cedar->Server->ListenIP); - s->SyslogLock = NewLock(); - - SetFifoCurrentReallocMemSize(MEM_FIFO_REALLOC_MEM_SIZE); - - - // Raise the priority - if (s->NoHighPriorityProcess == false) - { - OSSetHighPriority(); - } - -#ifdef OS_UNIX - UnixSetHighOomScore(); -#endif // OS_UNIX - - if (s->ServerType == SERVER_TYPE_FARM_MEMBER) - { - // Start a connection to the controller - s->FarmController = SiStartConnectToController(s); - } - else if (s->ServerType == SERVER_TYPE_FARM_CONTROLLER) - { - FARM_MEMBER *f; - // Start operating as a controller - s->FarmMemberList = NewList(NULL); - - f = ZeroMalloc(sizeof(FARM_MEMBER)); - f->Cedar = s->Cedar; - GetMachineName(f->hostname, sizeof(f->hostname)); - f->Me = true; - f->HubList = NewList(CompareHubList); - f->Weight = s->Weight; - - s->Me = f; - - Add(s->FarmMemberList, f); - - SiStartFarmControl(s); - - s->FarmControllerInited = true; - } - - // Start a in-processlistener - inproc = NewListener(s->Cedar, LISTENER_INPROC, 0); - ReleaseListener(inproc); - - // Start a listener for Azure - if (s->AzureClient != NULL) - { - azure = NewListener(s->Cedar, LISTENER_REVERSE, 0); - ReleaseListener(azure); - } - - // Start a R-UDP listener - if (s->DisableNatTraversal == false && s->Cedar->Bridge == false) - { - rudp = NewListenerEx4(s->Cedar, LISTENER_RUDP, 0, TCPAcceptedThread, NULL, false, false, - &s->NatTGlobalUdpPort, RAND_PORT_ID_SERVER_LISTEN); - ReleaseListener(rudp); - } - - // Start a VPN-over-ICMP listener - s->DynListenerIcmp = NewDynamicListener(s->Cedar, &s->EnableVpnOverIcmp, LISTENER_ICMP, 0); - - // Start a VPN-over-DNS listener - s->DynListenerDns = NewDynamicListener(s->Cedar, &s->EnableVpnOverDns, LISTENER_DNS, 53); - - - SiInitDeadLockCheck(s); - - SiUpdateCurrentRegion(s->Cedar, "", true); - - return s; -} - +// SoftEther VPN Source Code - Developer Edition Master Branch +// Cedar Communication Module + + +// Server.c +// VPN Server module + +#include "CedarPch.h" + +static SERVER *server = NULL; +static LOCK *server_lock = NULL; +char *SERVER_CONFIG_FILE_NAME = "$vpn_server.config"; +char *SERVER_CONFIG_FILE_NAME_IN_CLIENT = "$vpn_gate_svc.config"; +char *SERVER_CONFIG_FILE_NAME_IN_CLIENT_RELAY = "$vpn_gate_relay.config"; +char *BRIDGE_CONFIG_FILE_NAME = "$vpn_bridge.config"; +char *SERVER_CONFIG_TEMPLATE_NAME = "$vpn_server_template.config"; +char *BRIDGE_CONFIG_TEMPLATE_NAME = "$vpn_server_template.config"; + +static bool server_reset_setting = false; + +static volatile UINT global_server_flags[NUM_GLOBAL_SERVER_FLAGS] = {0}; + +UINT vpn_global_parameters[NUM_GLOBAL_PARAMS] = {0}; + +// Get whether the number of user objects that are registered in the VPN Server is too many +bool SiTooManyUserObjectsInServer(SERVER *s, bool oneMore) +{ + return false; +} + +typedef struct SI_DEBUG_PROC_LIST +{ + UINT Id; + char *Description; + char *Args; + SI_DEBUG_PROC *Proc; +} SI_DEBUG_PROC_LIST; + +// Debugging function +UINT SiDebug(SERVER *s, RPC_TEST *ret, UINT i, char *str) +{ + SI_DEBUG_PROC_LIST proc_list[] = + { + {1, "Hello World", "", SiDebugProcHelloWorld}, + {2, "Terminate process now", "", SiDebugProcExit}, + {3, "Write memory dumpfile", "", SiDebugProcDump}, + {4, "Restore process priority", "", SiDebugProcRestorePriority}, + {5, "Set the process priority high", "", SiDebugProcSetHighPriority}, + {6, "Get the .exe filename of the process", "", SiDebugProcGetExeFileName}, + {7, "Crash the process", "", SiDebugProcCrash}, + {8, "Get IPsecMessageDisplayed Flag", "", SiDebugProcGetIPsecMessageDisplayedValue}, + {9, "Set IPsecMessageDisplayed Flag", "", SiDebugProcSetIPsecMessageDisplayedValue}, + {10, "Get VgsMessageDisplayed Flag", "", SiDebugProcGetVgsMessageDisplayedValue}, + {11, "Set VgsMessageDisplayed Flag", "", SiDebugProcSetVgsMessageDisplayedValue}, + {12, "Get the current TCP send queue length", "", SiDebugProcGetCurrentTcpSendQueueLength}, + {13, "Get the current GetIP thread count", "", SiDebugProcGetCurrentGetIPThreadCount}, + }; + UINT num_proc_list = sizeof(proc_list) / sizeof(proc_list[0]); + UINT j; + UINT ret_value = ERR_NO_ERROR; + // Validate arguments + if (s == NULL || ret == NULL) + { + return ERR_INVALID_PARAMETER; + } + + if (i == 0) + { + char tmp[MAX_SIZE]; + Zero(ret, sizeof(RPC_TEST)); + + StrCat(ret->StrValue, sizeof(ret->StrValue), + "\n--- Debug Functions List --\n"); + + for (j = 0;j < num_proc_list;j++) + { + SI_DEBUG_PROC_LIST *p = &proc_list[j]; + + if (IsEmptyStr(p->Args) == false) + { + Format(tmp, sizeof(tmp), + " %u: %s - Usage: %u /ARG:\"%s\"\n", + p->Id, p->Description, p->Id, p->Args); + } + else + { + Format(tmp, sizeof(tmp), + " %u: %s - Usage: %u\n", + p->Id, p->Description, p->Id); + } + + StrCat(ret->StrValue, sizeof(ret->StrValue), tmp); + } + } + else + { + ret_value = ERR_NOT_SUPPORTED; + + for (j = 0;j < num_proc_list;j++) + { + SI_DEBUG_PROC_LIST *p = &proc_list[j]; + + if (p->Id == i) + { + ret_value = p->Proc(s, str, ret->StrValue, sizeof(ret->StrValue)); + + if (ret_value == ERR_NO_ERROR && IsEmptyStr(ret->StrValue)) + { + StrCpy(ret->StrValue, sizeof(ret->StrValue), "Ok."); + } + break; + } + } + } + + return ret_value; +} +UINT SiDebugProcHelloWorld(SERVER *s, char *in_str, char *ret_str, UINT ret_str_size) +{ + // Validate arguments + if (s == NULL || in_str == NULL || ret_str == NULL) + { + return ERR_INVALID_PARAMETER; + } + + Format(ret_str, ret_str_size, "Hello World %s\n", in_str); + + return ERR_NO_ERROR; +} +UINT SiDebugProcExit(SERVER *s, char *in_str, char *ret_str, UINT ret_str_size) +{ + // Validate arguments + if (s == NULL || in_str == NULL || ret_str == NULL) + { + return ERR_INVALID_PARAMETER; + } + + _exit(1); + + return ERR_NO_ERROR; +} +UINT SiDebugProcDump(SERVER *s, char *in_str, char *ret_str, UINT ret_str_size) +{ + // Validate arguments + if (s == NULL || in_str == NULL || ret_str == NULL) + { + return ERR_INVALID_PARAMETER; + } + +#ifdef OS_WIN32 + MsWriteMinidump(NULL, NULL); +#else // OS_WIN32 + return ERR_NOT_SUPPORTED; +#endif // OS_WIN32 + + return ERR_NO_ERROR; +} +UINT SiDebugProcRestorePriority(SERVER *s, char *in_str, char *ret_str, UINT ret_str_size) +{ + // Validate arguments + if (s == NULL || in_str == NULL || ret_str == NULL) + { + return ERR_INVALID_PARAMETER; + } + + OSRestorePriority(); + + return ERR_NO_ERROR; +} +UINT SiDebugProcSetHighPriority(SERVER *s, char *in_str, char *ret_str, UINT ret_str_size) +{ + // Validate arguments + if (s == NULL || in_str == NULL || ret_str == NULL) + { + return ERR_INVALID_PARAMETER; + } + + OSSetHighPriority(); + + return ERR_NO_ERROR; +} +UINT SiDebugProcGetExeFileName(SERVER *s, char *in_str, char *ret_str, UINT ret_str_size) +{ + // Validate arguments + if (s == NULL || in_str == NULL || ret_str == NULL) + { + return ERR_INVALID_PARAMETER; + } + + GetExeName(ret_str, ret_str_size); + + return ERR_NO_ERROR; +} +UINT SiDebugProcCrash(SERVER *s, char *in_str, char *ret_str, UINT ret_str_size) +{ + // Validate arguments + if (s == NULL || in_str == NULL || ret_str == NULL) + { + return ERR_INVALID_PARAMETER; + } + + CrashNow(); + + return ERR_NO_ERROR; +} +UINT SiDebugProcGetIPsecMessageDisplayedValue(SERVER *s, char *in_str, char *ret_str, UINT ret_str_size) +{ + // Validate arguments + if (s == NULL || in_str == NULL || ret_str == NULL) + { + return ERR_INVALID_PARAMETER; + } + + ToStr(ret_str, s->IPsecMessageDisplayed); + + return ERR_NO_ERROR; +} +UINT SiDebugProcSetIPsecMessageDisplayedValue(SERVER *s, char *in_str, char *ret_str, UINT ret_str_size) +{ + // Validate arguments + if (s == NULL || in_str == NULL || ret_str == NULL) + { + return ERR_INVALID_PARAMETER; + } + + s->IPsecMessageDisplayed = ToInt(in_str); + + return ERR_NO_ERROR; +} +UINT SiDebugProcGetVgsMessageDisplayedValue(SERVER *s, char *in_str, char *ret_str, UINT ret_str_size) +{ + // Validate arguments + if (s == NULL || in_str == NULL || ret_str == NULL) + { + return ERR_INVALID_PARAMETER; + } + +#if 0 + if (VgDoNotPopupMessage() == false) + { + ToStr(ret_str, s->VgsMessageDisplayed); + } + else + { + ToStr(ret_str, 1); + } +#else + // Do not show the VGS message in VPN Server of the current version + ToStr(ret_str, 1); +#endif + + return ERR_NO_ERROR; +} +UINT SiDebugProcGetCurrentTcpSendQueueLength(SERVER *s, char *in_str, char *ret_str, UINT ret_str_size) +{ + char tmp1[64], tmp2[64], tmp3[64]; + // Validate arguments + if (s == NULL || in_str == NULL || ret_str == NULL) + { + return ERR_INVALID_PARAMETER; + } + + ToStr3(tmp1, 0, CedarGetCurrentTcpQueueSize(s->Cedar)); + ToStr3(tmp2, 0, CedarGetQueueBudgetConsuming(s->Cedar)); + ToStr3(tmp3, 0, CedarGetFifoBudgetConsuming(s->Cedar)); + + Format(ret_str, 0, + "CurrentTcpQueueSize = %s\n" + "QueueBudgetConsuming = %s\n" + "FifoBudgetConsuming = %s\n", + tmp1, tmp2, tmp3); + + return ERR_NO_ERROR; +} +UINT SiDebugProcGetCurrentGetIPThreadCount(SERVER *s, char *in_str, char *ret_str, UINT ret_str_size) +{ + char tmp1[64], tmp2[64]; + // Validate arguments + if (s == NULL || in_str == NULL || ret_str == NULL) + { + return ERR_INVALID_PARAMETER; + } + + ToStr3(tmp1, 0, GetCurrentGetIpThreadNum()); + ToStr3(tmp2, 0, GetGetIpThreadMaxNum()); + + Format(ret_str, 0, + "Current threads = %s\n" + "Quota = %s\n", + tmp1, tmp2); + + return ERR_NO_ERROR; +} +UINT SiDebugProcSetVgsMessageDisplayedValue(SERVER *s, char *in_str, char *ret_str, UINT ret_str_size) +{ + // Validate arguments + if (s == NULL || in_str == NULL || ret_str == NULL) + { + return ERR_INVALID_PARAMETER; + } + + + return ERR_NO_ERROR; +} + +// Write the debug log +void SiDebugLog(SERVER *s, char *msg) +{ + // Validate arguments + if (s == NULL || msg == NULL) + { + return; + } + + if (s->DebugLog != NULL) + { + WriteTinyLog(s->DebugLog, msg); + } +} + +// Deadlock inspection main +void SiCheckDeadLockMain(SERVER *s, UINT timeout) +{ + CEDAR *cedar; + // Validate arguments + if (s == NULL) + { + return; + } + + //Debug("SiCheckDeadLockMain Start.\n"); + + + cedar = s->Cedar; + + if (s->ServerListenerList != NULL) + { + CheckDeadLock(s->ServerListenerList->lock, timeout, "s->ServerListenerList->lock"); + } + + CheckDeadLock(s->lock, timeout, "s->lock"); + + if (s->FarmMemberList != NULL) + { + CheckDeadLock(s->FarmMemberList->lock, timeout, "s->FarmMemberList->lock"); + } + + if (s->HubCreateHistoryList != NULL) + { + CheckDeadLock(s->HubCreateHistoryList->lock, timeout, "s->HubCreateHistoryList->lock"); + } + + CheckDeadLock(s->CapsCacheLock, timeout, "s->CapsCacheLock"); + + CheckDeadLock(s->TasksFromFarmControllerLock, timeout, "s->TasksFromFarmControllerLock"); + + if (cedar != NULL) + { + if (cedar->HubList != NULL) + { + CheckDeadLock(cedar->HubList->lock, timeout, "cedar->HubList->lock"); + } + + if (cedar->ListenerList != NULL) + { + UINT i; + LIST *o = NewListFast(NULL); + + CheckDeadLock(cedar->ListenerList->lock, timeout, "cedar->ListenerList->lock"); + + LockList(cedar->ListenerList); + { + for (i = 0;i < LIST_NUM(cedar->ListenerList);i++) + { + LISTENER *r = LIST_DATA(cedar->ListenerList, i); + + AddRef(r->ref); + + Add(o, r); + } + } + UnlockList(cedar->ListenerList); + + for (i = 0;i < LIST_NUM(o);i++) + { + LISTENER *r = LIST_DATA(o, i); + + + ReleaseListener(r); + } + + ReleaseList(o); + } + + if (cedar->ConnectionList != NULL) + { + CheckDeadLock(cedar->ConnectionList->lock, timeout, "cedar->ConnectionList->lock"); + } + + if (cedar->CaList != NULL) + { + CheckDeadLock(cedar->CaList->lock, timeout, "cedar->CaList->lock"); + } + + if (cedar->TrafficLock != NULL) + { + CheckDeadLock(cedar->TrafficLock, timeout, "cedar->TrafficLock"); + } + + if (cedar->TrafficDiffList != NULL) + { + CheckDeadLock(cedar->TrafficDiffList->lock, timeout, "cedar->TrafficDiffList->lock"); + } + + if (cedar->LocalBridgeList != NULL) + { + CheckDeadLock(cedar->LocalBridgeList->lock, timeout, "cedar->LocalBridgeList->lock"); + } + + if (cedar->L3SwList != NULL) + { + CheckDeadLock(cedar->L3SwList->lock, timeout, "cedar->L3SwList->lock"); + } + } + + //Debug("SiCheckDeadLockMain Finish.\n"); +} + +// Deadlock check thread +void SiDeadLockCheckThread(THREAD *t, void *param) +{ + SERVER *s = (SERVER *)param; + // Validate arguments + if (s == NULL || t == NULL) + { + return; + } + + while (true) + { + Wait(s->DeadLockWaitEvent, SERVER_DEADLOCK_CHECK_SPAN); + + if (s->HaltDeadLockThread) + { + break; + } + + SiCheckDeadLockMain(s, SERVER_DEADLOCK_CHECK_TIMEOUT); + } +} + +// Initialize the deadlock check +void SiInitDeadLockCheck(SERVER *s) +{ + // Validate arguments + if (s == NULL) + { + return; + } + if (s->DisableDeadLockCheck) + { + return; + } + + s->HaltDeadLockThread = false; + s->DeadLockWaitEvent = NewEvent(); + s->DeadLockCheckThread = NewThread(SiDeadLockCheckThread, s); +} + +// Release the deadlock check +void SiFreeDeadLockCheck(SERVER *s) +{ + // Validate arguments + if (s == NULL) + { + return; + } + + if (s->DeadLockCheckThread == NULL) + { + return; + } + + s->HaltDeadLockThread = true; + Set(s->DeadLockWaitEvent); + + WaitThread(s->DeadLockCheckThread, INFINITE); + + ReleaseThread(s->DeadLockCheckThread); + s->DeadLockCheckThread = NULL; + + ReleaseEvent(s->DeadLockWaitEvent); + s->DeadLockWaitEvent = NULL; + + s->HaltDeadLockThread = false; +} + +// Check whether the specified virtual HUB has been registered to creation history +bool SiIsHubRegistedOnCreateHistory(SERVER *s, char *name) +{ + UINT i; + bool ret = false; + // Validate arguments + if (s == NULL || name == NULL) + { + return false; + } + + SiDeleteOldHubCreateHistory(s); + + LockList(s->HubCreateHistoryList); + { + for (i = 0;i < LIST_NUM(s->HubCreateHistoryList);i++) + { + SERVER_HUB_CREATE_HISTORY *h = LIST_DATA(s->HubCreateHistoryList, i); + + if (StrCmpi(h->HubName, name) == 0) + { + ret = true; + break; + } + } + } + UnlockList(s->HubCreateHistoryList); + + return ret; +} + +// Delete the Virtual HUB creation history +void SiDelHubCreateHistory(SERVER *s, char *name) +{ + UINT i; + // Validate arguments + if (s == NULL || name == NULL) + { + return; + } + + LockList(s->HubCreateHistoryList); + { + SERVER_HUB_CREATE_HISTORY *hh = NULL; + for (i = 0;i < LIST_NUM(s->HubCreateHistoryList);i++) + { + SERVER_HUB_CREATE_HISTORY *h = LIST_DATA(s->HubCreateHistoryList, i); + + if (StrCmpi(h->HubName, name) == 0) + { + Delete(s->HubCreateHistoryList, h); + Free(h); + break; + } + } + } + UnlockList(s->HubCreateHistoryList); + + SiDeleteOldHubCreateHistory(s); +} + +// Register to the Virtual HUB creation history +void SiAddHubCreateHistory(SERVER *s, char *name) +{ + UINT i; + // Validate arguments + if (s == NULL || name == NULL) + { + return; + } + + LockList(s->HubCreateHistoryList); + { + SERVER_HUB_CREATE_HISTORY *hh = NULL; + for (i = 0;i < LIST_NUM(s->HubCreateHistoryList);i++) + { + SERVER_HUB_CREATE_HISTORY *h = LIST_DATA(s->HubCreateHistoryList, i); + + if (StrCmpi(h->HubName, name) == 0) + { + hh = h; + break; + } + } + + if (hh == NULL) + { + hh = ZeroMalloc(sizeof(SERVER_HUB_CREATE_HISTORY)); + StrCpy(hh->HubName, sizeof(hh->HubName), name); + + Add(s->HubCreateHistoryList, hh); + } + + hh->CreatedTime = Tick64(); + } + UnlockList(s->HubCreateHistoryList); + + SiDeleteOldHubCreateHistory(s); +} + +// Delete outdated Virtual HUB creation histories +void SiDeleteOldHubCreateHistory(SERVER *s) +{ + UINT i; + LIST *o; + // Validate arguments + if (s == NULL) + { + return; + } + + LockList(s->HubCreateHistoryList); + { + o = NewListFast(NULL); + + for (i = 0;i < LIST_NUM(s->HubCreateHistoryList);i++) + { + SERVER_HUB_CREATE_HISTORY *h = LIST_DATA(s->HubCreateHistoryList, i); + + if ((h->CreatedTime + ((UINT64)TICKET_EXPIRES)) <= Tick64()) + { + // Expired + Add(o, h); + } + } + + for (i = 0;i < LIST_NUM(o);i++) + { + SERVER_HUB_CREATE_HISTORY *h = LIST_DATA(o, i); + + Delete(s->HubCreateHistoryList, h); + + Free(h); + } + + ReleaseList(o); + } + UnlockList(s->HubCreateHistoryList); +} + +// Initialize the Virtual HUB creation history +void SiInitHubCreateHistory(SERVER *s) +{ + // Validate arguments + if (s == NULL) + { + return; + } + + s->HubCreateHistoryList = NewList(NULL); +} + +// Release the Virtual HUB creation history +void SiFreeHubCreateHistory(SERVER *s) +{ + UINT i; + // Validate arguments + if (s == NULL) + { + return; + } + + for (i = 0;i < LIST_NUM(s->HubCreateHistoryList);i++) + { + SERVER_HUB_CREATE_HISTORY *h = LIST_DATA(s->HubCreateHistoryList, i); + + Free(h); + } + + ReleaseList(s->HubCreateHistoryList); + + s->HubCreateHistoryList = NULL; +} + +// Identify whether the server can be connected from the VPN Client that is +// created by the installer creating kit of Admin Pack +bool IsAdminPackSupportedServerProduct(char *name) +{ + return true; +} + + +// Get the saving status of syslog +UINT SiGetSysLogSaveStatus(SERVER *s) +{ + SYSLOG_SETTING set; + // Validate arguments + if (s == NULL) + { + return SYSLOG_NONE; + } + + SiGetSysLogSetting(s, &set); + + return set.SaveType; +} + +// Send a syslog +void SiWriteSysLog(SERVER *s, char *typestr, char *hubname, wchar_t *message) +{ + wchar_t tmp[1024]; + char machinename[MAX_HOST_NAME_LEN + 1]; + char datetime[MAX_PATH]; + SYSTEMTIME st; + // Validate arguments + if (s == NULL || typestr == NULL || message == NULL) + { + return; + } + + if (GetGlobalServerFlag(GSF_DISABLE_SYSLOG) != 0) + { + return; + } + + // Host name + GetMachineName(machinename, sizeof(machinename)); + + // Date and time + LocalTime(&st); + if(s->StrictSyslogDatetimeFormat){ + GetDateTimeStrRFC3339(datetime, sizeof(datetime), &st, GetCurrentTimezone()); + }else{ + GetDateTimeStrMilli(datetime, sizeof(datetime), &st); + } + + if (IsEmptyStr(hubname) == false) + { + UniFormat(tmp, sizeof(tmp), L"[%S/VPN/%S] (%S) <%S>: %s", + machinename, hubname, datetime, typestr, message); + } + else + { + UniFormat(tmp, sizeof(tmp), L"[%S/VPN] (%S) <%S>: %s", + machinename, datetime, typestr, message); + } + + Debug("Syslog send: %S\n",tmp); + + SendSysLog(s->Syslog, tmp); +} + +// Write the syslog configuration +void SiSetSysLogSetting(SERVER *s, SYSLOG_SETTING *setting) +{ + SYSLOG_SETTING set; + // Validate arguments + if (s == NULL || setting == NULL) + { + return; + } + + Zero(&set, sizeof(set)); + Copy(&set, setting, sizeof(SYSLOG_SETTING)); + + if (IsEmptyStr(set.Hostname) || set.Port == 0) + { + set.SaveType = SYSLOG_NONE; + } + + Lock(s->SyslogLock); + { + Copy(&s->SyslogSetting, &set, sizeof(SYSLOG_SETTING)); + + SetSysLog(s->Syslog, set.Hostname, set.Port); + } + Unlock(s->SyslogLock); +} + +// Read the syslog configuration +void SiGetSysLogSetting(SERVER *s, SYSLOG_SETTING *setting) +{ + // Validate arguments + if (s == NULL || setting == NULL) + { + return; + } + + //Lock(s->SyslogLock); + { + Copy(setting, &s->SyslogSetting, sizeof(SYSLOG_SETTING)); + } + //Unlock(s->SyslogLock); +} + + +// Get the server product name +void GetServerProductName(SERVER *s, char *name, UINT size) +{ + char *cpu; + // Validate arguments + if (s == NULL || name == NULL) + { + return; + } + + GetServerProductNameInternal(s, name, size); + +#ifdef CPU_64 + cpu = " (64 bit)"; +#else // CPU_64 + cpu = " (32 bit)"; +#endif // CPU_64 + + StrCat(name, size, cpu); + + StrCat(name, size, " (Open Source)"); +} +void GetServerProductNameInternal(SERVER *s, char *name, UINT size) +{ + // Validate arguments + if (s == NULL || name == NULL) + { + return; + } + +#ifdef BETA_NUMBER + if (s->Cedar->Bridge) + { + StrCpy(name, size, CEDAR_BRIDGE_STR); + } + else + { + StrCpy(name, size, CEDAR_BETA_SERVER); + } + return; +#else // BETA_NUMBER + if (s->Cedar->Bridge) + { + StrCpy(name, size, CEDAR_BRIDGE_STR); + } + else + { + StrCpy(name, size, CEDAR_SERVER_STR); + } +#endif // BETA_NUMBER +} + +// Check whether the log file with the specified name is contained in the enumerated list +bool CheckLogFileNameFromEnumList(LIST *o, char *name, char *server_name) +{ + LOG_FILE t; + // Validate arguments + if (o == NULL || name == NULL || server_name == NULL) + { + return false; + } + + Zero(&t, sizeof(t)); + StrCpy(t.Path, sizeof(t.Path), name); + StrCpy(t.ServerName, sizeof(t.ServerName), server_name); + + if (Search(o, &t) == NULL) + { + return false; + } + + return true; +} + +// Release the log file enumeration +void FreeEnumLogFile(LIST *o) +{ + UINT i; + // Validate arguments + if (o == NULL) + { + return; + } + + for (i = 0;i < LIST_NUM(o);i++) + { + LOG_FILE *f = LIST_DATA(o, i); + + Free(f); + } + + ReleaseList(o); +} + +// Enumerate the log files associated with the virtual HUB (All logs are listed in the case of server administrator) +LIST *EnumLogFile(char *hubname) +{ + char exe_dir[MAX_PATH]; + char tmp[MAX_PATH]; + LIST *o = NewListFast(CmpLogFile); + DIRLIST *dir; + + if (StrLen(hubname) == 0) + { + hubname = NULL; + } + + GetLogDir(exe_dir, sizeof(exe_dir)); + + // Enumerate in the server_log + if (hubname == NULL) + { + EnumLogFileDir(o, SERVER_LOG_DIR); + } + + // Enumerate in the packet_log + Format(tmp, sizeof(tmp), "%s/"HUB_PACKET_LOG_DIR, exe_dir); + + if (hubname == NULL) + { + dir = EnumDir(tmp); + if (dir != NULL) + { + UINT i; + for (i = 0;i < dir->NumFiles;i++) + { + DIRENT *e = dir->File[i]; + + if (e->Folder) + { + char dir_name[MAX_PATH]; + Format(dir_name, sizeof(dir_name), HUB_PACKET_LOG_DIR"/%s", e->FileName); + EnumLogFileDir(o, dir_name); + } + } + + FreeDir(dir); + } + } + else + { + char dir_name[MAX_PATH]; + + Format(dir_name, sizeof(dir_name), HUB_PACKET_LOG_DIR"/%s", hubname); + + EnumLogFileDir(o, dir_name); + } + + // Enumerate in the security_log + Format(tmp, sizeof(tmp), "%s/"HUB_SECURITY_LOG_DIR, exe_dir); + + if (hubname == NULL) + { + dir = EnumDir(tmp); + if (dir != NULL) + { + UINT i; + for (i = 0;i < dir->NumFiles;i++) + { + DIRENT *e = dir->File[i]; + + if (e->Folder) + { + char dir_name[MAX_PATH]; + + Format(dir_name, sizeof(dir_name), HUB_SECURITY_LOG_DIR"/%s", e->FileName); + + EnumLogFileDir(o, dir_name); + } + } + + FreeDir(dir); + } + } + else + { + char dir_name[MAX_PATH]; + + Format(dir_name, sizeof(dir_name), HUB_SECURITY_LOG_DIR"/%s", hubname); + + EnumLogFileDir(o, dir_name); + } + + return o; +} + +// Enumerate log files in the specified directory +void EnumLogFileDir(LIST *o, char *dirname) +{ + UINT i; + char exe_dir[MAX_PATH]; + char dir_full_path[MAX_PATH]; + DIRLIST *dir; + // Validate arguments + if (o == NULL || dirname == NULL) + { + return; + } + + GetLogDir(exe_dir, sizeof(exe_dir)); + Format(dir_full_path, sizeof(dir_full_path), "%s/%s", exe_dir, dirname); + + dir = EnumDir(dir_full_path); + if (dir == NULL) + { + return; + } + + for (i = 0;i < dir->NumFiles;i++) + { + DIRENT *e = dir->File[i]; + + if (e->Folder == false && e->FileSize > 0) + { + char full_path[MAX_PATH]; + char file_path[MAX_PATH]; + + Format(file_path, sizeof(file_path), "%s/%s", dirname, e->FileName); + Format(full_path, sizeof(full_path), "%s/%s", exe_dir, file_path); + + if (EndWith(file_path, ".log")) + { + LOG_FILE *f = ZeroMalloc(sizeof(LOG_FILE)); + + StrCpy(f->Path, sizeof(f->Path), file_path); + f->FileSize = (UINT)(MIN(e->FileSize, 0xffffffffUL)); + f->UpdatedTime = e->UpdateDate; + + GetMachineName(f->ServerName, sizeof(f->ServerName)); + + Insert(o, f); + } + } + } + + FreeDir(dir); +} + +// Log file list entry comparison +int CmpLogFile(void *p1, void *p2) +{ + LOG_FILE *f1, *f2; + UINT i; + if (p1 == NULL || p2 == NULL) + { + return 0; + } + f1 = *(LOG_FILE **)p1; + f2 = *(LOG_FILE **)p2; + if (f1 == NULL || f2 == NULL) + { + return 0; + } + + i = StrCmpi(f1->Path, f2->Path); + if (i != 0) + { + return i; + } + + return StrCmpi(f1->ServerName, f2->ServerName); +} + +// Get the Caps of the server +UINT GetServerCapsInt(SERVER *s, char *name) +{ + CAPSLIST t; + UINT ret; + // Validate arguments + if (s == NULL || name == NULL) + { + return 0; + } + + Zero(&t, sizeof(t)); + GetServerCaps(s, &t); + + ret = GetCapsInt(&t, name); + + return ret; +} +bool GetServerCapsBool(SERVER *s, char *name) +{ + return (GetServerCapsInt(s, name) == 0) ? false : true; +} + +// Initialize the Caps cache of the server +void InitServerCapsCache(SERVER *s) +{ + // Validate arguments + if (s == NULL) + { + return; + } + + s->CapsCacheLock = NewLock(); + s->CapsListCache = NULL; +} + +// Release the Caps cache of the server +void FreeServerCapsCache(SERVER *s) +{ + // Validate arguments + if (s == NULL) + { + return; + } + + if (s->CapsListCache != NULL) + { + FreeCapsList(s->CapsListCache); + s->CapsListCache = NULL; + } + DeleteLock(s->CapsCacheLock); +} + +// Dispose the Caps cache of the server +void DestroyServerCapsCache(SERVER *s) +{ + // Validate arguments + if (s == NULL) + { + return; + } + + Lock(s->CapsCacheLock); + { + if (s->CapsListCache != NULL) + { + FreeCapsList(s->CapsListCache); + s->CapsListCache = NULL; + } + } + Unlock(s->CapsCacheLock); +} + +// Flush the Caps list for this server +void FlushServerCaps(SERVER *s) +{ + CAPSLIST t; + // Validate arguments + if (s == NULL) + { + return; + } + + DestroyServerCapsCache(s); + + Zero(&t, sizeof(t)); + GetServerCaps(s, &t); +} + +// Get the Caps list for this server +void GetServerCaps(SERVER *s, CAPSLIST *t) +{ + // Validate arguments + if (s == NULL || t == NULL) + { + return; + } + + Lock(s->CapsCacheLock); + { + + if (s->CapsListCache == NULL) + { + s->CapsListCache = ZeroMalloc(sizeof(CAPSLIST)); + GetServerCapsMain(s, s->CapsListCache); + } + + Copy(t, s->CapsListCache, sizeof(CAPSLIST)); + } + Unlock(s->CapsCacheLock); +} + +// Update the global server flags +void UpdateGlobalServerFlags(SERVER *s, CAPSLIST *t) +{ + bool is_restricted = false; + // Validate arguments + if (s == NULL || t == NULL) + { + return; + } + + is_restricted = SiIsEnterpriseFunctionsRestrictedOnOpenSource(s->Cedar); + + SetGlobalServerFlag(GSF_DISABLE_PUSH_ROUTE, is_restricted); + SetGlobalServerFlag(GSF_DISABLE_RADIUS_AUTH, is_restricted); + SetGlobalServerFlag(GSF_DISABLE_CERT_AUTH, is_restricted); + SetGlobalServerFlag(GSF_DISABLE_DEEP_LOGGING, is_restricted); + SetGlobalServerFlag(GSF_DISABLE_AC, is_restricted); + SetGlobalServerFlag(GSF_DISABLE_SYSLOG, is_restricted); +} + +// Set a global server flag +void SetGlobalServerFlag(UINT index, UINT value) +{ + // Validate arguments + if (index >= NUM_GLOBAL_SERVER_FLAGS) + { + return; + } + + global_server_flags[index] = value; +} + +// Get a global server flag +UINT GetGlobalServerFlag(UINT index) +{ + // Validate arguments + if (index >= NUM_GLOBAL_SERVER_FLAGS) + { + return 0; + } + + return global_server_flags[index]; +} + +// Main of the acquisition of Caps of the server +void GetServerCapsMain(SERVER *s, CAPSLIST *t) +{ + bool is_restricted = false; + + // Validate arguments + if (s == NULL || t == NULL) + { + return; + } + + is_restricted = SiIsEnterpriseFunctionsRestrictedOnOpenSource(s->Cedar); + + // Initialize + InitCapsList(t); + + // Maximum Ethernet packet size + AddCapsInt(t, "i_max_packet_size", MAX_PACKET_SIZE); + + if (s->Cedar->Bridge == false) + { + UINT max_sessions, max_clients, max_bridges, max_user_creations; + + max_clients = INFINITE; + max_bridges = INFINITE; + max_sessions = SERVER_MAX_SESSIONS_FOR_CARRIER_EDITION; + max_user_creations = INFINITE; + + // Maximum number of virtual HUBs + AddCapsInt(t, "i_max_hubs", SERVER_MAX_SESSIONS_FOR_CARRIER_EDITION); + + // The maximum number of concurrent sessions + AddCapsInt(t, "i_max_sessions", max_sessions); + + // Maximum number of creatable users + AddCapsInt(t, "i_max_user_creation", max_user_creations); + + // Maximum number of clients + AddCapsInt(t, "i_max_clients", max_clients); + + // Maximum number of bridges + AddCapsInt(t, "i_max_bridges", max_bridges); + + if (s->ServerType != SERVER_TYPE_FARM_MEMBER) + { + // Maximum number of registrable users / Virtual HUB + AddCapsInt(t, "i_max_users_per_hub", MAX_USERS); + + // Maximum number of registrable groups / Virtual HUB + AddCapsInt(t, "i_max_groups_per_hub", MAX_GROUPS); + + // Maximum number of registrable access list entries / Virtual HUB + AddCapsInt(t, "i_max_access_lists", MAX_ACCESSLISTS); + } + else + { + // Maximum number of registrable users / Virtual HUB + AddCapsInt(t, "i_max_users_per_hub", 0); + + // Maximum number of registrable groups / Virtual HUB + AddCapsInt(t, "i_max_groups_per_hub", 0); + + // Maximum number of registrable access list entries / Virtual HUB + AddCapsInt(t, "i_max_access_lists", 0); + } + + // The policy related to multiple logins + AddCapsBool(t, "b_support_limit_multilogin", true); + + // QoS / VoIP + AddCapsBool(t, "b_support_qos", true); + + // syslog + AddCapsBool(t, "b_support_syslog", true); + + // IPsec + // (Only works in stand-alone mode currently) + AddCapsBool(t, "b_support_ipsec", (s->ServerType == SERVER_TYPE_STANDALONE)); + + // SSTP + // (Only works in stand-alone mode currently) + AddCapsBool(t, "b_support_sstp", (s->ServerType == SERVER_TYPE_STANDALONE)); + + // OpenVPN + // (Only works in stand-alone mode currently) + AddCapsBool(t, "b_support_openvpn", (s->ServerType == SERVER_TYPE_STANDALONE)); + + // DDNS + AddCapsBool(t, "b_support_ddns", (s->DDnsClient != NULL)); + + if (s->DDnsClient != NULL) + { + // DDNS via Proxy + AddCapsBool(t, "b_support_ddns_proxy", true); + } + + // VPN over ICMP, VPN over DNS + AddCapsBool(t, "b_support_special_listener", true); + } + else + { + // Maximum number of virtual HUBs + AddCapsInt(t, "i_max_hubs", 0); + + // The maximum number of concurrent sessions + AddCapsInt(t, "i_max_sessions", 0); + + // Maximum number of clients + AddCapsInt(t, "i_max_clients", 0); + + // Maximum number of bridges + AddCapsInt(t, "i_max_bridges", 0); + + // Maximum number of registrable users / Virtual HUB + AddCapsInt(t, "i_max_users_per_hub", 0); + + // Maximum number of registrable groups / Virtual HUB + AddCapsInt(t, "i_max_groups_per_hub", 0); + + // Maximum number of registrable access list entries / Virtual HUB + AddCapsInt(t, "i_max_access_lists", 0); + + // QoS / VoIP + AddCapsBool(t, "b_support_qos", true); + + // syslog + AddCapsBool(t, "b_support_syslog", true); + + // IPsec + AddCapsBool(t, "b_support_ipsec", false); + + // SSTP + AddCapsBool(t, "b_support_sstp", false); + + // OpenVPN + AddCapsBool(t, "b_support_openvpn", false); + + // DDNS + AddCapsBool(t, "b_support_ddns", false); + + // VPN over ICMP, VPN over DNS + AddCapsBool(t, "b_support_special_listener", false); + } + + // Changing the type of Virtual HUB in cluster is prohibited + AddCapsBool(t, "b_cluster_hub_type_fixed", true); + + // Maximum MAC address table size / Virtual HUB + AddCapsInt(t, "i_max_mac_tables", MAX_MAC_TABLES); + + // Maximum IP address table size / Virtual HUB + AddCapsInt(t, "i_max_ip_tables", MAX_IP_TABLES); + + // SecureNAT function is available + AddCapsBool(t, "b_support_securenat", true); + + // Pushing routing table function of SecureNAT Virtual DHCP Server is available + AddCapsBool(t, "b_suppport_push_route", !is_restricted); + AddCapsBool(t, "b_suppport_push_route_config", true); + + if (s->ServerType != SERVER_TYPE_STANDALONE) + { + AddCapsBool(t, "b_virtual_nat_disabled", true); + } + + // Maximum NAT table size / Virtual HUB + AddCapsInt(t, "i_max_secnat_tables", NAT_MAX_SESSIONS); + + // Cascade connection + if (s->ServerType == SERVER_TYPE_STANDALONE) + { + AddCapsBool(t, "b_support_cascade", true); + } + else + { + AddCapsBool(t, "b_support_cascade", false); + } + + if (s->Cedar->Bridge) + { + // Bridge mode + AddCapsBool(t, "b_bridge", true); + } + else if (s->ServerType == SERVER_TYPE_STANDALONE) + { + // Stand-alone mode + AddCapsBool(t, "b_standalone", true); + } + else if (s->ServerType == SERVER_TYPE_FARM_CONTROLLER) + { + // Cluster controller mode + AddCapsBool(t, "b_cluster_controller", true); + } + else + { + // Cluster member mode + AddCapsBool(t, "b_cluster_member", true); + } + + // Virtual HUB is modifiable + AddCapsBool(t, "b_support_config_hub", s->ServerType != SERVER_TYPE_FARM_MEMBER && + s->Cedar->Bridge == false); + + // VPN client can be connected + AddCapsBool(t, "b_vpn_client_connect", s->Cedar->Bridge == false ? true : false); + + // External authentication server is available + AddCapsBool(t, "b_support_radius", s->ServerType != SERVER_TYPE_FARM_MEMBER && + s->Cedar->Bridge == false); + + // Local-bridge function is available + AddCapsBool(t, "b_local_bridge", IsBridgeSupported()); + + if (OS_IS_WINDOWS(GetOsInfo()->OsType)) + { + // Packet capture driver is not installed + AddCapsBool(t, "b_must_install_pcap", IsEthSupported() == false ? true : false); + } + else + { + // Regard that the driver is installed in the Linux version + AddCapsBool(t, "b_must_install_pcap", false); + } + + if (IsBridgeSupported()) + { + // TUN / TAP device availability (Linux and BSD) + const UINT OsType = GetOsInfo()->OsType; + AddCapsBool(t, "b_tap_supported", OsType == OSTYPE_LINUX || OsType == OSTYPE_BSD); + } + + // Cascade connection + if (s->ServerType == SERVER_TYPE_STANDALONE) + { + AddCapsBool(t, "b_support_cascade", true); + } + else + { + AddCapsBool(t, "b_support_cascade", false); + } + + // Server authentication can be used in cascade connection + AddCapsBool(t, "b_support_cascade_cert", true); + + // the log file settings is modifiable + AddCapsBool(t, "b_support_config_log", s->ServerType != SERVER_TYPE_FARM_MEMBER); + + // Automatic deletion of log file is available + AddCapsBool(t, "b_support_autodelete", true); + + // Config file operation is available + AddCapsBool(t, "b_support_config_rw", true); + + // Attribute of each Virtual HUB can be set + AddCapsBool(t, "b_support_hub_admin_option", true); + + // Client certificate can be set in a cascade connection + AddCapsBool(t, "b_support_cascade_client_cert", true); + + // Virtual HUB can be hidden + AddCapsBool(t, "b_support_hide_hub", true); + + // Integrated management + AddCapsBool(t, "b_support_cluster_admin", true); + + // Flag of open-source version + AddCapsBool(t, "b_is_softether", true); + + if (s->Cedar->Bridge == false) + { + + // The virtual layer 3 switch function is available + AddCapsBool(t, "b_support_layer3", true); + + AddCapsInt(t, "i_max_l3_sw", MAX_NUM_L3_SWITCH); + AddCapsInt(t, "i_max_l3_if", MAX_NUM_L3_IF); + AddCapsInt(t, "i_max_l3_table", MAX_NUM_L3_TABLE); + + // Can act as a part of a cluster + AddCapsBool(t, "b_support_cluster", true); + } + else + { + AddCapsBool(t, "b_support_layer3", false); + + AddCapsInt(t, "i_max_l3_sw", 0); + AddCapsInt(t, "i_max_l3_if", 0); + AddCapsInt(t, "i_max_l3_table", 0); + + AddCapsBool(t, "b_support_cluster", false); + } + + if (s->ServerType != SERVER_TYPE_FARM_MEMBER && s->Cedar->Bridge == false) + { + // Support for CRL + AddCapsBool(t, "b_support_crl", true); + + // Supports AC + AddCapsBool(t, "b_support_ac", true); + } + + // Supports downloading a log file + AddCapsBool(t, "b_support_read_log", true); + + // Cascade connection can be renamed + AddCapsBool(t, "b_support_rename_cascade", true); + + + if (s->Cedar->Beta) + { + // Beta version + AddCapsBool(t, "b_beta_version", true); + } + + // VM discrimination + AddCapsBool(t, "b_is_in_vm", s->IsInVm); + + // Support for display name of the network connection for the local bridge +#ifdef OS_WIN32 + if (IsBridgeSupported() && IsNt() && GetOsInfo()->OsType >= OSTYPE_WINDOWS_2000_PROFESSIONAL) + { + AddCapsBool(t, "b_support_network_connection_name", true); + } +#else // OS_WIN32 + if (IsBridgeSupported() && EthIsInterfaceDescriptionSupportedUnix()) + { + AddCapsBool(t, "b_support_network_connection_name", true); + } +#endif // OS_WIN32 + + // Support for MAC address filtering + AddCapsBool(t, "b_support_check_mac", true); + + // Support for status check of the TCP connection + AddCapsBool(t, "b_support_check_tcp_state", true); + + // Can specify multiple server and retry intervals in Radius authentication + AddCapsBool(t, "b_support_radius_retry_interval_and_several_servers", s->ServerType != SERVER_TYPE_FARM_MEMBER && + s->Cedar->Bridge == false); + + // Can manage the ID of the tagged VLAN in the MAC address table + AddCapsBool(t, "b_support_vlan", true); + + // Support for Virtual HUB extended options + if ((s->Cedar->Bridge == false) && + (s->ServerType == SERVER_TYPE_STANDALONE || s->ServerType == SERVER_TYPE_FARM_CONTROLLER)) + { + AddCapsBool(t, "b_support_hub_ext_options", true); + } + else + { + AddCapsBool(t, "b_support_hub_ext_options", false); + } + + // Support for Security Policy version 3.0 + AddCapsBool(t, "b_support_policy_ver_3", true); + + // Support for IPv6 access list + AddCapsBool(t, "b_support_ipv6_acl", true); + + // Support for setting of delay, jitter and packet loss in the access list + AddCapsBool(t, "b_support_ex_acl", true); + + // Support for URL redirection in the access list + AddCapsBool(t, "b_support_redirect_url_acl", true); + + // Supports the specification by the group name in the access list + AddCapsBool(t, "b_support_acl_group", true); + + // Support for IPv6 in connection source IP restriction list + AddCapsBool(t, "b_support_ipv6_ac", true); + + // Support for VLAN tagged packet transmission configuration tool + AddCapsBool(t, "b_support_eth_vlan", (OS_IS_WINDOWS_NT(GetOsType()) && GET_KETA(GetOsType(), 100) >= 2)); + + // Support for the message display function when the VPN connect to the Virtual HUB + AddCapsBool(t, "b_support_msg", true); + + // UDP acceleration feature + AddCapsBool(t, "b_support_udp_acceleration", true); + + // AES acceleration function + AddCapsBool(t, "b_support_aes_ni", IsAesNiSupported()); + +#ifdef OS_WIN32 + // SeLow driver + AddCapsBool(t, "b_using_selow_driver", Win32IsUsingSeLow()); +#endif // OS_WIN32 + + // VPN Azure function + AddCapsBool(t, "b_support_azure", SiIsAzureSupported(s)); + + // VPN3 + AddCapsBool(t, "b_vpn3", true); + + // VPN4 + AddCapsBool(t, "b_vpn4", true); + + + UpdateGlobalServerFlags(s, t); +} + +// SYSLOG_SETTING +void InRpcSysLogSetting(SYSLOG_SETTING *t, PACK *p) +{ + // Validate arguments + if (t == NULL || p == NULL) + { + return; + } + + Zero(t, sizeof(SYSLOG_SETTING)); + t->SaveType = PackGetInt(p, "SaveType"); + t->Port = PackGetInt(p, "Port"); + PackGetStr(p, "Hostname", t->Hostname, sizeof(t->Hostname)); +} +void OutRpcSysLogSetting(PACK *p, SYSLOG_SETTING *t) +{ + // Validate arguments + if (t == NULL || p == NULL) + { + return; + } + + PackAddInt(p, "SaveType", t->SaveType); + PackAddInt(p, "Port", t->Port); + PackAddStr(p, "Hostname", t->Hostname); +} + +// CAPSLIST +void InitCapsList(CAPSLIST *t) +{ + // Validate arguments + if (t == NULL) + { + return; + } + + Zero(t, sizeof(CAPSLIST)); + t->CapsList = NewListFast(NULL); +} +void InRpcCapsList(CAPSLIST *t, PACK *p) +{ + UINT i; + // Validate arguments + if (t == NULL || p == NULL) + { + return; + } + + Zero(t, sizeof(CAPSLIST)); + t->CapsList = NewListFast(CompareCaps); + + for (i = 0;i < LIST_NUM(p->elements);i++) + { + ELEMENT *e = LIST_DATA(p->elements, i); + + if (StartWith(e->name, "caps_") && e->type == VALUE_INT && e->num_value == 1) + { + CAPS *c = NewCaps(e->name + 5, e->values[0]->IntValue); + Insert(t->CapsList, c); + } + } +} +void OutRpcCapsList(PACK *p, CAPSLIST *t) +{ + UINT i; + // Validate arguments + if (t == NULL || p == NULL) + { + return; + } + + PackSetCurrentJsonGroupName(p, "CapsList"); + for (i = 0;i < LIST_NUM(t->CapsList);i++) + { + char tmp[MAX_SIZE]; + char ct_key[MAX_PATH]; + wchar_t ct_description[MAX_PATH]; + wchar_t *w; + CAPS *c = LIST_DATA(t->CapsList, i); + + Format(tmp, sizeof(tmp), "caps_%s", c->Name); + + Format(ct_key, sizeof(ct_key), "CT_%s", c->Name); + + Zero(ct_description, sizeof(ct_description)); + w = _UU(ct_key); + if (UniIsEmptyStr(w) == false) + { + UniStrCpy(ct_description, sizeof(ct_description), w); + } + else + { + StrToUni(ct_description, sizeof(ct_description), c->Name); + } + + PackAddInt(p, tmp, c->Value); + + PackAddStrEx(p, "CapsName", c->Name, i, LIST_NUM(t->CapsList)); + PackAddIntEx(p, "CapsValue", c->Value, i, LIST_NUM(t->CapsList)); + PackAddUniStrEx(p, "CapsDescrption", ct_description, i, LIST_NUM(t->CapsList)); + } + PackSetCurrentJsonGroupName(p, NULL); +} +void FreeRpcCapsList(CAPSLIST *t) +{ + UINT i; + // Validate arguments + if (t == NULL) + { + return; + } + + for (i = 0;i < LIST_NUM(t->CapsList);i++) + { + CAPS *c = LIST_DATA(t->CapsList, i); + + FreeCaps(c); + } + + ReleaseList(t->CapsList); +} + +// Add a bool type to Caps list +void AddCapsBool(CAPSLIST *caps, char *name, bool b) +{ + CAPS *c; + // Validate arguments + if (caps == NULL || name == NULL) + { + return; + } + + c = NewCaps(name, b == false ? 0 : 1); + AddCaps(caps, c); +} + +// Add the int type to Caps list +void AddCapsInt(CAPSLIST *caps, char *name, UINT i) +{ + CAPS *c; + // Validate arguments + if (caps == NULL || name == NULL) + { + return; + } + + c = NewCaps(name, i); + AddCaps(caps, c); +} + +// Get the int type from the Caps list +UINT GetCapsInt(CAPSLIST *caps, char *name) +{ + CAPS *c; + // Validate arguments + if (caps == NULL || name == NULL) + { + return 0; + } + + c = GetCaps(caps, name); + if (c == NULL) + { + return 0; + } + + return c->Value; +} + +// Get bool type from the Caps list +bool GetCapsBool(CAPSLIST *caps, char *name) +{ + CAPS *c; + // Validate arguments + if (caps == NULL || name == NULL) + { + return false; + } + + c = GetCaps(caps, name); + if (c == NULL) + { + return false; + } + + return c->Value == 0 ? false : true; +} + +// Release the Caps list +void FreeCapsList(CAPSLIST *caps) +{ + UINT i; + // Validate arguments + if (caps == NULL) + { + return; + } + + for (i = 0;i < LIST_NUM(caps->CapsList);i++) + { + CAPS *c = LIST_DATA(caps->CapsList, i); + + FreeCaps(c); + } + + ReleaseList(caps->CapsList); + Free(caps); +} + +// Get the Caps +CAPS *GetCaps(CAPSLIST *caps, char *name) +{ + UINT i; + // Validate arguments + if (caps == NULL || name == NULL) + { + return NULL; + } + + for (i = 0;i < LIST_NUM(caps->CapsList);i++) + { + CAPS *c = LIST_DATA(caps->CapsList, i); + + if (StrCmpi(c->Name, name) == 0) + { + return c; + } + } + + return NULL; +} + +// Add to the Caps +void AddCaps(CAPSLIST *caps, CAPS *c) +{ + // Validate arguments + if (caps == NULL || c == NULL) + { + return; + } + + Insert(caps->CapsList, c); +} + +// Comparison of Caps +int CompareCaps(void *p1, void *p2) +{ + CAPS *c1, *c2; + if (p1 == NULL || p2 == NULL) + { + return 0; + } + c1 = *(CAPS **)p1; + c2 = *(CAPS **)p2; + if (c1 == NULL || c2 == NULL) + { + return 0; + } + + return StrCmpi(c1->Name, c2->Name); +} + +// Create a Caps list +CAPSLIST *NewCapsList() +{ + CAPSLIST *caps = ZeroMalloc(sizeof(CAPSLIST)); + + caps->CapsList = NewListFast(CompareCaps); + + return caps; +} + +// Release the Caps +void FreeCaps(CAPS *c) +{ + // Validate arguments + if (c == NULL) + { + return; + } + + Free(c->Name); + Free(c); +} + +// Create a Caps +CAPS *NewCaps(char *name, UINT value) +{ + CAPS *c; + // Validate arguments + if (name == NULL) + { + return NULL; + } + + c = ZeroMalloc(sizeof(CAPS)); + c->Name = CopyStr(name); + c->Value = value; + + return c; +} + +// Calculate the score from the current number of connections and weight +UINT SiCalcPoint(SERVER *s, UINT num, UINT weight) +{ + UINT server_max_sessions = SERVER_MAX_SESSIONS; + if (s == NULL) + { + return 0; + } + if (weight == 0) + { + weight = 100; + } + + server_max_sessions = GetServerCapsInt(s, "i_max_sessions"); + + if (server_max_sessions == 0) + { + // Avoid divide by zero + server_max_sessions = 1; + } + + return (UINT)(((double)server_max_sessions - + MIN((double)num * 100.0 / (double)weight, (double)server_max_sessions)) + * (double)FARM_BASE_POINT / (double)server_max_sessions); +} + +// Get the server score +UINT SiGetPoint(SERVER *s) +{ + UINT num_session; + // Validate arguments + if (s == NULL) + { + return 0; + } + + num_session = Count(s->Cedar->CurrentSessions); + + return SiCalcPoint(s, num_session, s->Weight); +} + +// Generate the default certificate +void SiGenerateDefaultCert(X **server_x, K **server_k) +{ + SiGenerateDefaultCertEx(server_x, server_k, NULL); +} +void SiGenerateDefaultCertEx(X **server_x, K **server_k, char *common_name) +{ + X *x; + K *private_key, *public_key; + NAME *name; + char tmp[MAX_SIZE]; + wchar_t cn[MAX_SIZE]; + // Validate arguments + if (server_x == NULL || server_k == NULL) + { + return; + } + + // Create a key pair + RsaGen(&private_key, &public_key, 2048); + + if (IsEmptyStr(common_name)) + { + // Get the host name + StrCpy(tmp, sizeof(tmp), "server.softether.vpn"); + GetMachineName(tmp, sizeof(tmp)); + StrToUni(cn, sizeof(cn), tmp); + } + else + { + StrToUni(cn, sizeof(cn), common_name); + } + + name = NewName(cn, cn, cn, + L"US", NULL, NULL); + x = NewRootX(public_key, private_key, name, GetDaysUntil2038Ex(), NULL); + + *server_x = x; + *server_k = private_key; + + FreeName(name); + + FreeK(public_key); +} + +// Set the server certificate to default +void SiInitDefaultServerCert(SERVER *s) +{ + X *x = NULL; + K *k = NULL; + // Validate arguments + if (s == NULL) + { + return; + } + + // Generate a server certificate and private key + SiGenerateDefaultCert(&x, &k); + + // Configure + SetCedarCert(s->Cedar, x, k); + + FreeX(x); + FreeK(k); +} + +// Set the encryption algorithm name to default +void SiInitCipherName(SERVER *s) +{ + // Validate arguments + if (s == NULL) + { + return; + } + + SetCedarCipherList(s->Cedar, SERVER_DEFAULT_CIPHER_NAME); +} + +// Initialize the listener list +void SiInitListenerList(SERVER *s) +{ + // Validate arguments + if (s == NULL) + { + return; + } + + SiLockListenerList(s); + { + { + // Register the 4 ports (443, 992, 1194, 8888) as the default port + SiAddListener(s, SERVER_DEF_PORTS_1, true); + SiAddListener(s, SERVER_DEF_PORTS_2, true); + SiAddListener(s, SERVER_DEF_PORTS_3, true); + SiAddListener(s, SERVER_DEF_PORTS_4, true); + } + } + SiUnlockListenerList(s); +} + +// Remove the listener +bool SiDeleteListener(SERVER *s, UINT port) +{ + SERVER_LISTENER *e; + // Validate arguments + if (s == NULL || port == 0) + { + return false; + } + + e = SiGetListener(s, port); + if (e == NULL) + { + return false; + } + + // Stop if still alive + SiDisableListener(s, port); + + if (e->Listener != NULL) + { + ReleaseListener(e->Listener); + } + + Delete(s->ServerListenerList, e); + Free(e); + + return true; +} + +// Compare the SERVER_LISTENER +int CompareServerListener(void *p1, void *p2) +{ + SERVER_LISTENER *s1, *s2; + if (p1 == NULL || p2 == NULL) + { + return 0; + } + s1 = *(SERVER_LISTENER **)p1; + s2 = *(SERVER_LISTENER **)p2; + if (s1 == NULL || s2 == NULL) + { + return 0; + } + + if (s1->Port > s2->Port) + { + return 1; + } + else if (s1->Port < s2->Port) + { + return -1; + } + else + { + return 0; + } +} + +// Stop the listener +bool SiDisableListener(SERVER *s, UINT port) +{ + SERVER_LISTENER *e; + // Validate arguments + if (s == NULL || port == 0) + { + return false; + } + + // Get the listener + e = SiGetListener(s, port); + if (e == NULL) + { + return false; + } + + if (e->Enabled == false || e->Listener == NULL) + { + // Already stopped + return true; + } + + // Stop the listener + StopListener(e->Listener); + + // Release the listener + ReleaseListener(e->Listener); + e->Listener = NULL; + + e->Enabled = false; + + return true; +} + +// Start the listener +bool SiEnableListener(SERVER *s, UINT port) +{ + SERVER_LISTENER *e; + // Validate arguments + if (s == NULL || port == 0) + { + return false; + } + + // Get the listener + e = SiGetListener(s, port); + if (e == NULL) + { + return false; + } + + if (e->Enabled) + { + // It has already started + return true; + } + + // Create a listener + e->Listener = NewListener(s->Cedar, LISTENER_TCP, e->Port); + if (e->Listener == NULL) + { + // Failure + return false; + } + + e->Listener->DisableDos = e->DisableDos; + + e->Enabled = true; + + return true; +} + +// Get the listener +SERVER_LISTENER *SiGetListener(SERVER *s, UINT port) +{ + UINT i; + // Validate arguments + if (s == NULL || port == 0) + { + return NULL; + } + + for (i = 0;i < LIST_NUM(s->ServerListenerList);i++) + { + SERVER_LISTENER *e = LIST_DATA(s->ServerListenerList, i); + if (e->Port == port) + { + return e; + } + } + + return NULL; +} + +// Add a listener +bool SiAddListener(SERVER *s, UINT port, bool enabled) +{ + return SiAddListenerEx(s, port, enabled, false); +} +bool SiAddListenerEx(SERVER *s, UINT port, bool enabled, bool disable_dos) +{ + SERVER_LISTENER *e; + UINT i; + // Validate arguments + if (s == NULL || port == 0) + { + return false; + } + + // Check whether the listener exists already + for (i = 0;i < LIST_NUM(s->ServerListenerList);i++) + { + e = LIST_DATA(s->ServerListenerList, i); + if (e->Port == port) + { + // Already exist + return false; + } + } + + // Register by initializing a new listener + e = ZeroMalloc(sizeof(SERVER_LISTENER)); + e->Enabled = enabled; + e->Port = port; + e->DisableDos = disable_dos; + + if (e->Enabled) + { + // Create a listener + e->Listener = NewListener(s->Cedar, LISTENER_TCP, e->Port); + if (e->Listener != NULL) + { + e->Listener->DisableDos = e->DisableDos; + } + } + + Insert(s->ServerListenerList, e); + + return true; +} + +// Lock the listener list +void SiLockListenerList(SERVER *s) +{ + // Validate arguments + if (s == NULL) + { + return; + } + + LockList(s->ServerListenerList); +} + +// Unlock the listener list +void SiUnlockListenerList(SERVER *s) +{ + // Validate arguments + if (s == NULL) + { + return; + } + + UnlockList(s->ServerListenerList); +} + +// Set the default value of the Virtual HUB options +void SiSetDefaultHubOption(HUB_OPTION *o) +{ + // Validate arguments + if (o == NULL) + { + return; + } + + o->MaxSession = 0; + o->VlanTypeId = MAC_PROTO_TAGVLAN; + o->NoIPv6DefaultRouterInRAWhenIPv6 = true; + o->ManageOnlyPrivateIP = true; + o->ManageOnlyLocalUnicastIPv6 = true; + o->NoMacAddressLog = true; + o->NoDhcpPacketLogOutsideHub = true; + o->AccessListIncludeFileCacheLifetime = ACCESS_LIST_INCLUDE_FILE_CACHE_LIFETIME; + o->RemoveDefGwOnDhcpForLocalhost = true; + o->FloodingSendQueueBufferQuota = DEFAULT_FLOODING_QUEUE_LENGTH; +} + +// Create a default virtual HUB +void SiInitDefaultHubList(SERVER *s) +{ + HUB *h; + HUB_OPTION o; + HUB_LOG g; + // Validate arguments + if (s == NULL) + { + return; + } + + Zero(&o, sizeof(o)); + + // Configure a default Virtual HUB management options + SiSetDefaultHubOption(&o); + + h = NewHub(s->Cedar, s->Cedar->Bridge == false ? SERVER_DEFAULT_HUB_NAME : SERVER_DEFAULT_BRIDGE_NAME, &o); + h->CreatedTime = SystemTime64(); + AddHub(s->Cedar, h); + + if (s->Cedar->Bridge) + { + // Randomize the password + Rand(h->HashedPassword, sizeof(h->HashedPassword)); + Rand(h->SecurePassword, sizeof(h->SecurePassword)); + } + + h->Offline = true; + SetHubOnline(h); + + // Log settings + SiSetDefaultLogSetting(&g); + SetHubLogSetting(h, &g); + + ReleaseHub(h); +} + +// Set the log settings to default +void SiSetDefaultLogSetting(HUB_LOG *g) +{ + // Validate arguments + if (g == NULL) + { + return; + } + + Zero(g, sizeof(HUB_LOG)); + g->SaveSecurityLog = true; + g->SecurityLogSwitchType = LOG_SWITCH_DAY; + g->SavePacketLog = true; + g->PacketLogSwitchType = LOG_SWITCH_DAY; + g->PacketLogConfig[PACKET_LOG_TCP_CONN] = + g->PacketLogConfig[PACKET_LOG_DHCP] = PACKET_LOG_HEADER; +} + +// Set the initial configuration +void SiLoadInitialConfiguration(SERVER *s) +{ + RPC_KEEP k; + // Validate arguments + if (s == NULL) + { + return; + } + + // Auto saving interval related + s->AutoSaveConfigSpan = SERVER_FILE_SAVE_INTERVAL_DEFAULT; + s->BackupConfigOnlyWhenModified = true; + + s->Weight = FARM_DEFAULT_WEIGHT; + + SiLoadGlobalParamsCfg(NULL); + + // KEEP related + Zero(&k, sizeof(k)); + + { + k.UseKeepConnect = true; + } + k.KeepConnectPort = 80; + StrCpy(k.KeepConnectHost, sizeof(k.KeepConnectHost), CLIENT_DEFAULT_KEEPALIVE_HOST); + k.KeepConnectInterval = KEEP_INTERVAL_DEFAULT * 1000; + k.KeepConnectProtocol = CONNECTION_UDP; + + Lock(s->Keep->lock); + { + KEEP *keep = s->Keep; + keep->Enable = k.UseKeepConnect; + keep->Server = true; + StrCpy(keep->ServerName, sizeof(keep->ServerName), k.KeepConnectHost); + keep->ServerPort = k.KeepConnectPort; + keep->UdpMode = k.KeepConnectProtocol; + keep->Interval = k.KeepConnectInterval; + } + Unlock(s->Keep->lock); + + // Initialize the password + { + Sha0(s->HashedPassword, "", 0); + } + + // Set the encryption algorithm name to default + SiInitCipherName(s); + + // Set the server certificate to default + SiInitDefaultServerCert(s); + + // Set the character which separates the username from the hub name + s->Cedar->UsernameHubSeparator = DEFAULT_USERNAME_HUB_SEPARATOR; + + // Create a default HUB + { + SiInitDefaultHubList(s); + } + + if (s->Cedar->Bridge == false) + { + // Create a DDNS client + s->DDnsClient = NewDDNSClient(s->Cedar, NULL, NULL); + } + + + // Set the listener list to default setting + SiInitListenerList(s); + + if (s->Cedar->Bridge) + { + // NAT traversal can not be used in the bridge environment + s->DisableNatTraversal = true; + } + else + { + // Disable VPN-over-ICMP and VPN-over-DNS by default + s->EnableVpnOverIcmp = false; + s->EnableVpnOverDns = false; + + { + LIST *ports = s->PortsUDP; + + AddInt(ports, SERVER_DEF_PORTS_1); + AddInt(ports, SERVER_DEF_PORTS_2); + AddInt(ports, SERVER_DEF_PORTS_3); + AddInt(ports, SERVER_DEF_PORTS_4); + + ProtoSetUdpPorts(s->Proto, ports); + } + } + + s->Eraser = NewEraser(s->Logger, 0); +} + +// Check whether the ports required for VPN-over-ICMP can be opened +bool SiCanOpenVpnOverIcmpPort() +{ + // Whether the ICMP can be opened + SOCK *s = NewUDP(MAKE_SPECIAL_PORT(IP_PROTO_ICMPV4)); + + if (s == NULL) + { + // Failure + return false; + } + + Disconnect(s); + ReleaseSock(s); + + return true; +} + +// Check whether the ports required for VPN-over-DNS can be opened +bool SiCanOpenVpnOverDnsPort() +{ + // Whether UDP Port 53 can be listen on + SOCK *s = NewUDP(53); + + if (s == NULL) + { + // Listening failure + return false; + } + + Disconnect(s); + ReleaseSock(s); + + return true; +} + +// Read the configuration file (main) +bool SiLoadConfigurationFileMain(SERVER *s, FOLDER *root) +{ + // Validate arguments + if (s == NULL || root == NULL) + { + return false; + } + + return SiLoadConfigurationCfg(s, root); +} + +// Read the configuration file +bool SiLoadConfigurationFile(SERVER *s) +{ + // Validate arguments + bool ret = false; + FOLDER *root; + char *server_config_filename = SERVER_CONFIG_FILE_NAME; + if (s == NULL) + { + return false; + } + + + s->CfgRw = NewCfgRwEx2A(&root, + s->Cedar->Bridge == false ? server_config_filename : BRIDGE_CONFIG_FILE_NAME, false, + s->Cedar->Bridge == false ? SERVER_CONFIG_TEMPLATE_NAME : BRIDGE_CONFIG_TEMPLATE_NAME); + + if (server_reset_setting) + { + CfgDeleteFolder(root); + root = NULL; + server_reset_setting = false; + } + + if (root == NULL) + { + return false; + } + + ret = SiLoadConfigurationFileMain(s, root); + + CfgDeleteFolder(root); + + return ret; +} + +// Initialize the configuration +void SiInitConfiguration(SERVER *s) +{ + // Validate arguments + if (s == NULL) + { + return; + } + + s->AutoSaveConfigSpan = SERVER_FILE_SAVE_INTERVAL_DEFAULT; + s->BackupConfigOnlyWhenModified = true; + + if (s->Cedar->Bridge == false) + { + // Protocols handler + s->Proto = ProtoNew(s->Cedar); + // IPsec server + s->IPsecServer = NewIPsecServer(s->Cedar); + } + + SLog(s->Cedar, "LS_LOAD_CONFIG_1"); + if (SiLoadConfigurationFile(s) == false) + { + // Ethernet initialization + InitEth(); + + SLog(s->Cedar, "LS_LOAD_CONFIG_3"); + SiLoadInitialConfiguration(s); + + SetFifoCurrentReallocMemSize(MEM_FIFO_REALLOC_MEM_SIZE); + + server_reset_setting = false; + } + else + { + SLog(s->Cedar, "LS_LOAD_CONFIG_2"); + } + + s->CfgRw->DontBackup = s->DontBackupConfig; + + // The arp_filter in Linux + if (GetOsInfo()->OsType == OSTYPE_LINUX) + { + if (s->NoLinuxArpFilter == false) + { + SetLinuxArpFilter(); + } + } + + if (s->DisableDosProtection) + { + DisableDosProtect(); + } + else + { + EnableDosProtect(); + } + + s->AutoSaveConfigSpanSaved = s->AutoSaveConfigSpan; + + // Create a VPN Azure client + if (s->DDnsClient != NULL && s->Cedar->Bridge == false && s->ServerType == SERVER_TYPE_STANDALONE) + { + s->AzureClient = NewAzureClient(s->Cedar, s); + + AcSetEnable(s->AzureClient, s->EnableVpnAzure); + } + + // Reduce the storage interval in the case of user mode +#ifdef OS_WIN32 + if (MsIsUserMode()) + { + s->AutoSaveConfigSpan = MIN(s->AutoSaveConfigSpan, SERVER_FILE_SAVE_INTERVAL_USERMODE); + } +#endif //OS_WIN32 + + // Create a saving thread + SLog(s->Cedar, "LS_INIT_SAVE_THREAD", s->AutoSaveConfigSpan / 1000); + s->SaveHaltEvent = NewEvent(); + s->SaveThread = NewThread(SiSaverThread, s); +} + +// Set the state of Enabled / Disabled of Azure Client +void SiSetAzureEnable(SERVER *s, bool enabled) +{ + // Validate arguments + if (s == NULL) + { + return; + } + + if (s->AzureClient != NULL) + { + AcSetEnable(s->AzureClient, enabled); + } + + s->EnableVpnAzure = enabled; +} + +// Apply the Config to the Azure Client +void SiApplyAzureConfig(SERVER *s, DDNS_CLIENT_STATUS *ddns_status) +{ + // Validate arguments + if (s == NULL) + { + return; + } + + AcApplyCurrentConfig(s->AzureClient, ddns_status); +} + +// Get whether the Azure Client is enabled +bool SiIsAzureEnabled(SERVER *s) +{ + // Validate arguments + if (s == NULL) + { + return false; + } + + if (s->AzureClient == NULL) + { + return false; + } + + return s->EnableVpnAzure; +} + +// Get whether the Azure Client is supported +bool SiIsAzureSupported(SERVER *s) +{ + // Validate arguments + if (s == NULL) + { + return false; + } + + if (s->AzureClient == NULL) + { + return false; + } + + return true; +} + +// Read the server settings from the CFG +bool SiLoadConfigurationCfg(SERVER *s, FOLDER *root) +{ + FOLDER *f1, *f2, *f3, *f4, *f5, *f6, *f7, *f8, *f; + // Validate arguments + if (s == NULL || root == NULL) + { + return false; + } + + f = NULL; + + + f1 = CfgGetFolder(root, "ServerConfiguration"); + f2 = CfgGetFolder(root, "VirtualHUB"); + f3 = CfgGetFolder(root, "ListenerList"); + f4 = CfgGetFolder(root, "LocalBridgeList"); + f5 = CfgGetFolder(root, "VirtualLayer3SwitchList"); + f6 = CfgGetFolder(root, "LicenseManager"); + f7 = CfgGetFolder(root, "IPsec"); + f8 = CfgGetFolder(root, "DDnsClient"); + + if (f1 == NULL) + { + SLog(s->Cedar, "LS_BAD_CONFIG"); + return false; + } + +#ifdef OS_WIN32 + if (f4 != NULL) + { + // Read the flag of using the SeLow driver + bool b = true; + + if (CfgIsItem(f4, "EnableSoftEtherKernelModeDriver")) + { + b = CfgGetBool(f4, "EnableSoftEtherKernelModeDriver"); + } + + Win32SetEnableSeLow(b); + } +#endif // OS_WIN32 + + // Ethernet initialization + InitEth(); + + s->ConfigRevision = CfgGetInt(root, "ConfigRevision"); + + if (s->Cedar->Bridge == false && f6 != NULL) + { + if (GetServerCapsBool(s, "b_support_license")) + { + SiLoadLicenseManager(s, f6); + } + } + + DestroyServerCapsCache(s); + + SiLoadServerCfg(s, f1); + + if (s->ServerType != SERVER_TYPE_FARM_MEMBER) + { + SiLoadHubs(s, f2); + } + + SiLoadListeners(s, f3); + + if (f4 != NULL) + { + SiLoadLocalBridges(s, f4); + } + + if (s->Cedar->Bridge == false && f5 != NULL) + { + SiLoadL3Switchs(s, f5); + } + + if (f7 != NULL && GetServerCapsBool(s, "b_support_ipsec")) + { + SiLoadIPsec(s, f7); + } + + if (s->Cedar->Bridge == false) + { + if (f8 == NULL) + { + // Create a DDNS client with a new key + s->DDnsClient = NewDDNSClient(s->Cedar, NULL, NULL); + } + else + { + // Create by reading the setting of the DDNS client + UCHAR key[SHA1_SIZE]; + if (CfgGetBool(f8, "Disabled")) + { + // Disabled + } + else + { + char machine_name[MAX_SIZE]; + char machine_name2[MAX_SIZE]; + INTERNET_SETTING t; + BUF *pw; + + // Proxy Setting + Zero(&t, sizeof(t)); + t.ProxyType = CfgGetInt(f8, "ProxyType"); + CfgGetStr(f8, "ProxyHostName", t.ProxyHostName, sizeof(t.ProxyHostName)); + t.ProxyPort = CfgGetInt(f8, "ProxyPort"); + CfgGetStr(f8, "ProxyUsername", t.ProxyUsername, sizeof(t.ProxyUsername)); + pw = CfgGetBuf(f8, "ProxyPassword"); + if (pw != NULL) + { + char *pw_str = DecryptPassword(pw); + StrCpy(t.ProxyPassword, sizeof(t.ProxyPassword), pw_str); + + Free(pw_str); + FreeBuf(pw); + } + + CfgGetStr(f8, "CustomHttpHeader", t.CustomHttpHeader, sizeof(t.CustomHttpHeader)); + + GetMachineHostName(machine_name, sizeof(machine_name)); + + CfgGetStr(f8, "LocalHostname", machine_name2, sizeof(machine_name2)); + + if (CfgGetByte(f8, "Key", key, sizeof(key)) != sizeof(key) || StrCmpi(machine_name, machine_name2) != 0) + { + // Create a DDNS client with a new key + s->DDnsClient = NewDDNSClient(s->Cedar, NULL, &t); + } + else + { + // Create the DDNS client with stored key + s->DDnsClient = NewDDNSClient(s->Cedar, key, &t); + } + } + } + } + + + { + HUB *h = NULL; + + // Remove the virtual HUB "VPNGATE" when VGS disabled + LockHubList(s->Cedar); + { + h = GetHub(s->Cedar, VG_HUBNAME); + } + UnlockHubList(s->Cedar); + + if (h != NULL) + { + StopHub(h); + DelHub(s->Cedar, h); + ReleaseHub(h); + } + } + + s->IPsecMessageDisplayed = CfgGetBool(root, "IPsecMessageDisplayed"); + + + return true; +} + +// Write the listener configuration +void SiWriteListenerCfg(FOLDER *f, SERVER_LISTENER *r) +{ + // Validate arguments + if (f == NULL || r == NULL) + { + return; + } + + CfgAddBool(f, "Enabled", r->Enabled); + CfgAddInt(f, "Port", r->Port); + CfgAddBool(f, "DisableDos", r->DisableDos); +} + +// Read the listener configuration +void SiLoadListenerCfg(SERVER *s, FOLDER *f) +{ + bool enable; + UINT port; + bool disable_dos; + // Validate arguments + if (s == NULL || f == NULL) + { + return; + } + + enable = CfgGetBool(f, "Enabled"); + port = CfgGetInt(f, "Port"); + disable_dos = CfgGetBool(f, "DisableDos"); + + if (port == 0) + { + return; + } + + SiAddListenerEx(s, port, enable, disable_dos); +} + +// Read the listener list +void SiLoadListeners(SERVER *s, FOLDER *f) +{ + TOKEN_LIST *t; + UINT i; + // Validate arguments + if (s == NULL || f == NULL) + { + return; + } + + t = CfgEnumFolderToTokenList(f); + for (i = 0;i < t->NumTokens;i++) + { + FOLDER *ff = CfgGetFolder(f, t->Token[i]); + if (ff != NULL) + { + SiLoadListenerCfg(s, ff); + } + } + FreeToken(t); +} + +// Write the listener list +void SiWriteListeners(FOLDER *f, SERVER *s) +{ + // Validate arguments + if (f == NULL || s == NULL) + { + return; + } + + LockList(s->ServerListenerList); + { + UINT i; + for (i = 0;i < LIST_NUM(s->ServerListenerList);i++) + { + SERVER_LISTENER *r = LIST_DATA(s->ServerListenerList, i); + char name[MAX_SIZE]; + Format(name, sizeof(name), "Listener%u", i); + SiWriteListenerCfg(CfgCreateFolder(f, name), r); + } + } + UnlockList(s->ServerListenerList); +} + +// Write the bridge +void SiWriteLocalBridgeCfg(FOLDER *f, LOCALBRIDGE *br) +{ + // Validate arguments + if (f == NULL || br == NULL) + { + return; + } + + CfgAddStr(f, "DeviceName", br->DeviceName); + CfgAddStr(f, "HubName", br->HubName); + CfgAddBool(f, "NoPromiscuousMode", br->Local); + CfgAddBool(f, "MonitorMode", br->Monitor); + CfgAddBool(f, "LimitBroadcast", br->LimitBroadcast); + + if (OS_IS_UNIX(GetOsInfo()->OsType)) + { + CfgAddBool(f, "TapMode", br->TapMode); + + if (br->TapMode) + { + char tmp[MAX_SIZE]; + MacToStr(tmp, sizeof(tmp), br->TapMacAddress); + CfgAddStr(f, "TapMacAddress", tmp); + } + } +} + +// Write the bridge list +void SiWriteLocalBridges(FOLDER *f, SERVER *s) +{ + // Validate arguments + if (s == NULL || f == NULL) + { + return; + } + +#ifdef OS_WIN32 + CfgAddBool(f, "ShowAllInterfaces", Win32EthGetShowAllIf()); + + CfgAddBool(f, "EnableSoftEtherKernelModeDriver", Win32GetEnableSeLow()); +#endif // OS_WIN32 + +#ifdef UNIX_LINUX + CfgAddBool(f, "DoNotDisableOffloading", GetGlobalServerFlag(GSF_LOCALBRIDGE_NO_DISABLE_OFFLOAD)); +#endif // UNIX_LINUX + + LockList(s->Cedar->LocalBridgeList); + { + UINT i; + for (i = 0;i < LIST_NUM(s->Cedar->LocalBridgeList);i++) + { + LOCALBRIDGE *br = LIST_DATA(s->Cedar->LocalBridgeList, i); + char name[MAX_SIZE]; + + Format(name, sizeof(name), "LocalBridge%u", i); + SiWriteLocalBridgeCfg(CfgCreateFolder(f, name), br); + } + } + UnlockList(s->Cedar->LocalBridgeList); +} + +// Read the bridge +void SiLoadLocalBridgeCfg(SERVER *s, FOLDER *f) +{ + char hub[MAX_SIZE]; + char nic[MAX_SIZE]; + bool tapmode = false; + UCHAR tapaddr[6]; + // Validate arguments + if (s == NULL || f == NULL) + { + return; + } + + Zero(hub, sizeof(hub)); + Zero(nic, sizeof(nic)); + + CfgGetStr(f, "HubName", hub, sizeof(hub)); + CfgGetStr(f, "DeviceName", nic, sizeof(nic)); + + if (IsEmptyStr(hub) || IsEmptyStr(nic) + ) + { + return; + } + + if (OS_IS_UNIX(GetOsInfo()->OsType)) + { + if (CfgGetBool(f, "TapMode")) + { + char tmp[MAX_SIZE]; + tapmode = true; + Zero(tapaddr, sizeof(tapaddr)); + if (CfgGetStr(f, "TapMacAddress", tmp, sizeof(tmp))) + { + BUF *b; + b = StrToBin(tmp); + if (b != NULL && b->Size == 6) + { + Copy(tapaddr, b->Buf, sizeof(tapaddr)); + } + FreeBuf(b); + } + } + } + + AddLocalBridge(s->Cedar, hub, nic, CfgGetBool(f, "NoPromiscuousMode"), CfgGetBool(f, "MonitorMode"), + tapmode, tapaddr, CfgGetBool(f, "LimitBroadcast")); +} + +// Read the bridge list +void SiLoadLocalBridges(SERVER *s, FOLDER *f) +{ + TOKEN_LIST *t; + UINT i; + // Validate arguments + if (s == NULL || f == NULL) + { + return; + } + +#ifdef OS_WIN32 + Win32EthSetShowAllIf(CfgGetBool(f, "ShowAllInterfaces")); +#endif // OS_WIN32 + +#ifdef UNIX_LINUX + SetGlobalServerFlag(GSF_LOCALBRIDGE_NO_DISABLE_OFFLOAD, CfgGetBool(f, "DoNotDisableOffloading")); +#endif // UNIX_LINUX + + t = CfgEnumFolderToTokenList(f); + + for (i = 0;i < t->NumTokens;i++) + { + char *name = t->Token[i]; + + SiLoadLocalBridgeCfg(s, CfgGetFolder(f, name)); + } + + FreeToken(t); +} + +// Increment the configuration revision of the server +void IncrementServerConfigRevision(SERVER *s) +{ + // Validate arguments + if (s == NULL) + { + return; + } + + s->ConfigRevision++; +} + +// Write the server settings to CFG +FOLDER *SiWriteConfigurationToCfg(SERVER *s) +{ + FOLDER *root; + char region[128]; + // Validate arguments + if (s == NULL) + { + return NULL; + } + + root = CfgCreateFolder(NULL, TAG_ROOT); + + SiGetCurrentRegion(s->Cedar, region, sizeof(region)); + + CfgAddStr(root, "Region", region); + + CfgAddInt(root, "ConfigRevision", s->ConfigRevision); + + SiWriteListeners(CfgCreateFolder(root, "ListenerList"), s); + + SiWriteLocalBridges(CfgCreateFolder(root, "LocalBridgeList"), s); + + SiWriteServerCfg(CfgCreateFolder(root, "ServerConfiguration"), s); + + + if (s->UpdatedServerType != SERVER_TYPE_FARM_MEMBER) + { + SiWriteHubs(CfgCreateFolder(root, "VirtualHUB"), s); + } + + if (s->Cedar->Bridge == false) + { + SiWriteL3Switchs(CfgCreateFolder(root, "VirtualLayer3SwitchList"), s); + + if (GetServerCapsBool(s, "b_support_license")) + { + SiWriteLicenseManager(CfgCreateFolder(root, "LicenseManager"), s); + } + } + + if (s->Led) + { + CfgAddBool(root, "Led", true); + CfgAddBool(root, "LedSpecial", s->LedSpecial); + } + + if (GetServerCapsBool(s, "b_support_ipsec")) + { + SiWriteIPsec(CfgCreateFolder(root, "IPsec"), s); + } + + if (s->Cedar->Bridge == false) + { + FOLDER *ddns_folder = CfgCreateFolder(root, "DDnsClient"); + + if (s->DDnsClient == NULL) + { + // Disabled + CfgAddBool(ddns_folder, "Disabled", true); + } + else + { + char machine_name[MAX_SIZE]; + BUF *pw; + INTERNET_SETTING *t; + // Enabled + CfgAddBool(ddns_folder, "Disabled", false); + CfgAddByte(ddns_folder, "Key", s->DDnsClient->Key, SHA1_SIZE); + + GetMachineHostName(machine_name, sizeof(machine_name)); + CfgAddStr(ddns_folder, "LocalHostname", machine_name); + + t = &s->DDnsClient->InternetSetting; + + CfgAddInt(ddns_folder, "ProxyType", t->ProxyType); + CfgAddStr(ddns_folder, "ProxyHostName", t->ProxyHostName); + CfgAddInt(ddns_folder, "ProxyPort", t->ProxyPort); + CfgAddStr(ddns_folder, "ProxyUsername", t->ProxyUsername); + + if (IsEmptyStr(t->ProxyPassword) == false) + { + pw = EncryptPassword(t->ProxyPassword); + + CfgAddBuf(ddns_folder, "ProxyPassword", pw); + + FreeBuf(pw); + } + + CfgAddStr(ddns_folder, "CustomHttpHeader", t->CustomHttpHeader); + } + } + + CfgAddBool(root, "IPsecMessageDisplayed", s->IPsecMessageDisplayed); + + + return root; +} + +// Read the policy +void SiLoadPolicyCfg(POLICY *p, FOLDER *f) +{ + // Validate arguments + if (f == NULL || p == NULL) + { + return; + } + + Zero(p, sizeof(POLICY)); + + // Ver 2 + p->Access = CfgGetBool(f, "Access"); + p->DHCPFilter = CfgGetBool(f, "DHCPFilter"); + p->DHCPNoServer = CfgGetBool(f, "DHCPNoServer"); + p->DHCPForce = CfgGetBool(f, "DHCPForce"); + p->NoBridge = CfgGetBool(f, "NoBridge"); + p->NoRouting = CfgGetBool(f, "NoRouting"); + p->CheckMac = CfgGetBool(f, "CheckMac"); + p->CheckIP = CfgGetBool(f, "CheckIP"); + p->ArpDhcpOnly = CfgGetBool(f, "ArpDhcpOnly"); + p->PrivacyFilter = CfgGetBool(f, "PrivacyFilter"); + p->NoServer = CfgGetBool(f, "NoServer"); + p->NoBroadcastLimiter = CfgGetBool(f, "NoBroadcastLimiter"); + p->MonitorPort = CfgGetBool(f, "MonitorPort"); + p->MaxConnection = CfgGetInt(f, "MaxConnection"); + p->TimeOut = CfgGetInt(f, "TimeOut"); + p->MaxMac = CfgGetInt(f, "MaxMac"); + p->MaxIP = CfgGetInt(f, "MaxIP"); + p->MaxUpload = CfgGetInt(f, "MaxUpload"); + p->MaxDownload = CfgGetInt(f, "MaxDownload"); + p->FixPassword = CfgGetBool(f, "FixPassword"); + p->MultiLogins = CfgGetInt(f, "MultiLogins"); + p->NoQoS = CfgGetBool(f, "NoQoS"); + + // Ver 3 + p->RSandRAFilter = CfgGetBool(f, "RSandRAFilter"); + p->RAFilter = CfgGetBool(f, "RAFilter"); + p->DHCPv6Filter = CfgGetBool(f, "DHCPv6Filter"); + p->DHCPv6NoServer = CfgGetBool(f, "DHCPv6NoServer"); + p->NoRoutingV6 = CfgGetBool(f, "NoRoutingV6"); + p->CheckIPv6 = CfgGetBool(f, "CheckIPv6"); + p->NoServerV6 = CfgGetBool(f, "NoServerV6"); + p->MaxIPv6 = CfgGetInt(f, "MaxIPv6"); + p->NoSavePassword = CfgGetBool(f, "NoSavePassword"); + p->AutoDisconnect = CfgGetInt(f, "AutoDisconnect"); + p->FilterIPv4 = CfgGetBool(f, "FilterIPv4"); + p->FilterIPv6 = CfgGetBool(f, "FilterIPv6"); + p->FilterNonIP = CfgGetBool(f, "FilterNonIP"); + p->NoIPv6DefaultRouterInRA = CfgGetBool(f, "NoIPv6DefaultRouterInRA"); + p->NoIPv6DefaultRouterInRAWhenIPv6 = CfgGetBool(f, "NoIPv6DefaultRouterInRAWhenIPv6"); + p->VLanId = CfgGetInt(f, "VLanId"); +} + +// Write the policy +void SiWritePolicyCfg(FOLDER *f, POLICY *p, bool cascade_mode) +{ + // Validate arguments + if (f == NULL || p == NULL) + { + return; + } + + // Ver 2.0 + if (cascade_mode == false) + { + CfgAddBool(f, "Access", p->Access); + } + + CfgAddBool(f, "DHCPFilter", p->DHCPFilter); + CfgAddBool(f, "DHCPNoServer", p->DHCPNoServer); + CfgAddBool(f, "DHCPForce", p->DHCPForce); + + if (cascade_mode == false) + { + CfgAddBool(f, "NoBridge", p->NoBridge); + CfgAddBool(f, "NoRouting", p->NoRouting); + } + + CfgAddBool(f, "CheckMac", p->CheckMac); + CfgAddBool(f, "CheckIP", p->CheckIP); + CfgAddBool(f, "ArpDhcpOnly", p->ArpDhcpOnly); + + if (cascade_mode == false) + { + CfgAddBool(f, "PrivacyFilter", p->PrivacyFilter); + } + + CfgAddBool(f, "NoServer", p->NoServer); + CfgAddBool(f, "NoBroadcastLimiter", p->NoBroadcastLimiter); + + if (cascade_mode == false) + { + CfgAddBool(f, "MonitorPort", p->MonitorPort); + CfgAddInt(f, "MaxConnection", p->MaxConnection); + CfgAddInt(f, "TimeOut", p->TimeOut); + } + + CfgAddInt(f, "MaxMac", p->MaxMac); + CfgAddInt(f, "MaxIP", p->MaxIP); + CfgAddInt(f, "MaxUpload", p->MaxUpload); + CfgAddInt(f, "MaxDownload", p->MaxDownload); + + if (cascade_mode == false) + { + CfgAddBool(f, "FixPassword", p->FixPassword); + CfgAddInt(f, "MultiLogins", p->MultiLogins); + CfgAddBool(f, "NoQoS", p->NoQoS); + } + + // Ver 3.0 + CfgAddBool(f, "RSandRAFilter", p->RSandRAFilter); + CfgAddBool(f, "RAFilter", p->RAFilter); + CfgAddBool(f, "DHCPv6Filter", p->DHCPv6Filter); + CfgAddBool(f, "DHCPv6NoServer", p->DHCPv6NoServer); + + if (cascade_mode == false) + { + CfgAddBool(f, "NoRoutingV6", p->NoRoutingV6); + } + + CfgAddBool(f, "CheckIPv6", p->CheckIPv6); + CfgAddBool(f, "NoServerV6", p->NoServerV6); + CfgAddInt(f, "MaxIPv6", p->MaxIPv6); + + if (cascade_mode == false) + { + CfgAddBool(f, "NoSavePassword", p->NoSavePassword); + CfgAddInt(f, "AutoDisconnect", p->AutoDisconnect); + } + + CfgAddBool(f, "FilterIPv4", p->FilterIPv4); + CfgAddBool(f, "FilterIPv6", p->FilterIPv6); + CfgAddBool(f, "FilterNonIP", p->FilterNonIP); + CfgAddBool(f, "NoIPv6DefaultRouterInRA", p->NoIPv6DefaultRouterInRA); + CfgAddBool(f, "NoIPv6DefaultRouterInRAWhenIPv6", p->NoIPv6DefaultRouterInRAWhenIPv6); + CfgAddInt(f, "VLanId", p->VLanId); +} + +// Write the link information of the Virtual HUB +void SiWriteHubLinkCfg(FOLDER *f, LINK *k) +{ + // Validate arguments + if (f == NULL || k == NULL) + { + return; + } + + Lock(k->lock); + { + // Online + CfgAddBool(f, "Online", k->Offline ? false : true); + + // Client options + CiWriteClientOption(CfgCreateFolder(f, "ClientOption"), k->Option); + + // Client authentication data + CiWriteClientAuth(CfgCreateFolder(f, "ClientAuth"), k->Auth); + + // Policy + if (k->Policy != NULL) + { + SiWritePolicyCfg(CfgCreateFolder(f, "Policy"), k->Policy, true); + } + + CfgAddBool(f, "CheckServerCert", k->CheckServerCert); + + if (k->ServerCert != NULL) + { + BUF *b = XToBuf(k->ServerCert, false); + CfgAddBuf(f, "ServerCert", b); + FreeBuf(b); + } + } + Unlock(k->lock); +} + +// Read the link information +void SiLoadHubLinkCfg(FOLDER *f, HUB *h) +{ + bool online; + CLIENT_OPTION *o; + CLIENT_AUTH *a; + FOLDER *pf; + POLICY p; + LINK *k; + // Validate arguments + if (f == NULL || h == NULL) + { + return; + } + + pf = CfgGetFolder(f, "Policy"); + if (pf == NULL) + { + return; + } + + SiLoadPolicyCfg(&p, pf); + + online = CfgGetBool(f, "Online"); + + o = CiLoadClientOption(CfgGetFolder(f, "ClientOption")); + a = CiLoadClientAuth(CfgGetFolder(f, "ClientAuth")); + if (o == NULL || a == NULL) + { + Free(o); + CiFreeClientAuth(a); + return; + } + + k = NewLink(h->Cedar, h, o, a, &p); + if (k != NULL) + { + BUF *b; + k->CheckServerCert = CfgGetBool(f, "CheckServerCert"); + b = CfgGetBuf(f, "ServerCert"); + if (b != NULL) + { + k->ServerCert = BufToX(b, false); + FreeBuf(b); + } + + if (online) + { + k->Offline = true; + SetLinkOnline(k); + } + else + { + k->Offline = false; + SetLinkOffline(k); + } + ReleaseLink(k); + } + + Free(o); + CiFreeClientAuth(a); +} + +// Write the SecureNAT of the Virtual HUB +void SiWriteSecureNAT(HUB *h, FOLDER *f) +{ + // Validate arguments + if (h == NULL || f == NULL) + { + return; + } + + CfgAddBool(f, "Disabled", h->EnableSecureNAT ? false : true); + + NiWriteVhOptionEx(h->SecureNATOption, f); +} + +// Read the administration options for the virtual HUB +void SiLoadHubAdminOptions(HUB *h, FOLDER *f) +{ + TOKEN_LIST *t; + // Validate arguments + if (h == NULL || f == NULL) + { + return; + } + + t = CfgEnumItemToTokenList(f); + if (t != NULL) + { + UINT i; + + LockList(h->AdminOptionList); + { + DeleteAllHubAdminOption(h, false); + + for (i = 0;i < t->NumTokens;i++) + { + char *name = t->Token[i]; + ADMIN_OPTION *a; + UINT value = CfgGetInt(f, name);; + + Trim(name); + + a = ZeroMalloc(sizeof(ADMIN_OPTION)); + StrCpy(a->Name, sizeof(a->Name), name); + a->Value = value; + + Insert(h->AdminOptionList, a); + } + + AddHubAdminOptionsDefaults(h, false); + } + UnlockList(h->AdminOptionList); + + FreeToken(t); + } +} + +// Write the administration options for the virtual HUB +void SiWriteHubAdminOptions(FOLDER *f, HUB *h) +{ + // Validate arguments + if (f == NULL || h == NULL) + { + return; + } + + LockList(h->AdminOptionList); + { + UINT i; + for (i = 0;i < LIST_NUM(h->AdminOptionList);i++) + { + ADMIN_OPTION *a = LIST_DATA(h->AdminOptionList, i); + + CfgAddInt(f, a->Name, a->Value); + } + } + UnlockList(h->AdminOptionList); +} + +// Write the link list of the Virtual HUB +void SiWriteHubLinks(FOLDER *f, HUB *h) +{ + // Validate arguments + if (f == NULL || h == NULL) + { + return; + } + + LockList(h->LinkList); + { + UINT i; + for (i = 0;i < LIST_NUM(h->LinkList);i++) + { + LINK *k = LIST_DATA(h->LinkList, i); + char name[MAX_SIZE]; + Format(name, sizeof(name), "Cascade%u", i); + SiWriteHubLinkCfg(CfgCreateFolder(f, name), k); + } + } + UnlockList(h->LinkList); +} + +// Read the link list +void SiLoadHubLinks(HUB *h, FOLDER *f) +{ + TOKEN_LIST *t; + UINT i; + // Validate arguments + if (h == NULL || f == NULL) + { + return; + } + + t = CfgEnumFolderToTokenList(f); + + for (i = 0;i < t->NumTokens;i++) + { + char *name = t->Token[i]; + SiLoadHubLinkCfg(CfgGetFolder(f, name), h); + } + + FreeToken(t); +} + +// Write an item of the access list +void SiWriteHubAccessCfg(FOLDER *f, ACCESS *a) +{ + // Validate arguments + if (f == NULL || a == NULL) + { + return; + } + + CfgAddUniStr(f, "Note", a->Note); + CfgAddBool(f, "Active", a->Active); + CfgAddInt(f, "Priority", a->Priority); + CfgAddBool(f, "Discard", a->Discard); + CfgAddBool(f, "IsIPv6", a->IsIPv6); + + if (a->IsIPv6 == false) + { + CfgAddIp32(f, "SrcIpAddress", a->SrcIpAddress); + CfgAddIp32(f, "SrcSubnetMask", a->SrcSubnetMask); + CfgAddIp32(f, "DestIpAddress", a->DestIpAddress); + CfgAddIp32(f, "DestSubnetMask", a->DestSubnetMask); + } + else + { + CfgAddIp6Addr(f, "SrcIpAddress6", &a->SrcIpAddress6); + CfgAddIp6Addr(f, "SrcSubnetMask6", &a->SrcSubnetMask6); + CfgAddIp6Addr(f, "DestIpAddress6", &a->DestIpAddress6); + CfgAddIp6Addr(f, "DestSubnetMask6", &a->DestSubnetMask6); + } + + CfgAddInt(f, "Protocol", a->Protocol); + CfgAddInt(f, "SrcPortStart", a->SrcPortStart); + CfgAddInt(f, "SrcPortEnd", a->SrcPortEnd); + CfgAddInt(f, "DestPortStart", a->DestPortStart); + CfgAddInt(f, "DestPortEnd", a->DestPortEnd); + CfgAddStr(f, "SrcUsername", a->SrcUsername); + CfgAddStr(f, "DestUsername", a->DestUsername); + CfgAddBool(f, "CheckSrcMac", a->CheckSrcMac); + + if (a->CheckSrcMac) + { + char tmp[MAX_PATH]; + + MacToStr(tmp, sizeof(tmp), a->SrcMacAddress); + CfgAddStr(f, "SrcMacAddress", tmp); + + MacToStr(tmp, sizeof(tmp), a->SrcMacMask); + CfgAddStr(f, "SrcMacMask", tmp); + } + + CfgAddBool(f, "CheckDstMac", a->CheckDstMac); + + if (a->CheckDstMac) + { + char tmp[MAX_PATH]; + + MacToStr(tmp, sizeof(tmp), a->DstMacAddress); + CfgAddStr(f, "DstMacAddress", tmp); + + MacToStr(tmp, sizeof(tmp), a->DstMacMask); + CfgAddStr(f, "DstMacMask", tmp); + } + + CfgAddBool(f, "CheckTcpState", a->CheckTcpState); + CfgAddBool(f, "Established", a->Established); + + CfgAddStr(f, "RedirectUrl", a->RedirectUrl); + + CfgAddInt(f, "Delay", a->Delay); + CfgAddInt(f, "Jitter", a->Jitter); + CfgAddInt(f, "Loss", a->Loss); +} + +// Read an item of the access list +void SiLoadHubAccessCfg(HUB *h, FOLDER *f) +{ + ACCESS a; + char tmp[MAX_PATH]; + // Validate arguments + if (h == NULL || f == NULL) + { + return; + } + + Zero(&a, sizeof(a)); + + CfgGetUniStr(f, "Note", a.Note, sizeof(a.Note)); + a.Active = CfgGetBool(f, "Active"); + a.Priority = CfgGetInt(f, "Priority"); + a.Discard = CfgGetBool(f, "Discard"); + a.IsIPv6 = CfgGetBool(f, "IsIPv6"); + + if (a.IsIPv6 == false) + { + a.SrcIpAddress = CfgGetIp32(f, "SrcIpAddress"); + a.SrcSubnetMask = CfgGetIp32(f, "SrcSubnetMask"); + a.DestIpAddress = CfgGetIp32(f, "DestIpAddress"); + a.DestSubnetMask = CfgGetIp32(f, "DestSubnetMask"); + } + else + { + CfgGetIp6Addr(f, "SrcIpAddress6", &a.SrcIpAddress6); + CfgGetIp6Addr(f, "SrcSubnetMask6", &a.SrcSubnetMask6); + CfgGetIp6Addr(f, "DestIpAddress6", &a.DestIpAddress6); + CfgGetIp6Addr(f, "DestSubnetMask6", &a.DestSubnetMask6); + } + + a.Protocol = CfgGetInt(f, "Protocol"); + a.SrcPortStart = CfgGetInt(f, "SrcPortStart"); + a.SrcPortEnd = CfgGetInt(f, "SrcPortEnd"); + a.DestPortStart = CfgGetInt(f, "DestPortStart"); + a.DestPortEnd = CfgGetInt(f, "DestPortEnd"); + CfgGetStr(f, "SrcUsername", a.SrcUsername, sizeof(a.SrcUsername)); + CfgGetStr(f, "DestUsername", a.DestUsername, sizeof(a.DestUsername)); + a.CheckSrcMac = CfgGetBool(f, "CheckSrcMac"); + + if (CfgGetByte(f, "SrcMacAddress", a.SrcMacAddress, sizeof(a.SrcMacAddress)) == 0) + { + CfgGetStr(f, "SrcMacAddress", tmp, sizeof(tmp)); + if (StrToMac(a.SrcMacAddress, tmp) == false) + { + a.CheckSrcMac = false; + } + } + + if (CfgGetByte(f, "SrcMacMask", a.SrcMacMask, sizeof(a.SrcMacMask)) == 0) + { + CfgGetStr(f, "SrcMacMask", tmp, sizeof(tmp)); + if (StrToMac(a.SrcMacMask, tmp) == false) + { + a.CheckSrcMac = false; + } + } + + a.CheckDstMac = CfgGetBool(f, "CheckDstMac"); + + if (CfgGetByte(f, "DstMacAddress", a.DstMacAddress, sizeof(a.DstMacAddress)) == 0) + { + CfgGetStr(f, "DstMacAddress", tmp, sizeof(tmp)); + if (StrToMac(a.DstMacAddress, tmp) == false) + { + a.CheckDstMac = false; + } + } + + if (CfgGetByte(f, "DstMacMask", a.DstMacMask, sizeof(a.DstMacMask)) == 0) + { + CfgGetStr(f, "DstMacMask", tmp, sizeof(tmp)); + if (StrToMac(a.DstMacMask, tmp) == false) + { + a.CheckDstMac = false; + } + } + + a.CheckTcpState = CfgGetBool(f, "CheckTcpState"); + a.Established = CfgGetBool(f, "Established"); + a.Delay = MAKESURE(CfgGetInt(f, "Delay"), 0, HUB_ACCESSLIST_DELAY_MAX); + a.Jitter = MAKESURE(CfgGetInt(f, "Jitter"), 0, HUB_ACCESSLIST_JITTER_MAX); + a.Loss = MAKESURE(CfgGetInt(f, "Loss"), 0, HUB_ACCESSLIST_LOSS_MAX); + + CfgGetStr(f, "RedirectUrl", a.RedirectUrl, sizeof(a.RedirectUrl)); + + AddAccessList(h, &a); +} + +// Write the access list +void SiWriteHubAccessLists(FOLDER *f, HUB *h) +{ + // Validate arguments + if (f == NULL || h == NULL) + { + return; + } + + LockList(h->AccessList); + { + UINT i; + for (i = 0;i < LIST_NUM(h->AccessList);i++) + { + ACCESS *a = LIST_DATA(h->AccessList, i); + char name[MAX_SIZE]; + ToStr(name, a->Id); + SiWriteHubAccessCfg(CfgCreateFolder(f, name), a); + } + } + UnlockList(h->AccessList); +} + +// Read the access list +void SiLoadHubAccessLists(HUB *h, FOLDER *f) +{ + TOKEN_LIST *t; + UINT i; + // Validate arguments + if (f == NULL || h == NULL) + { + return; + } + + t = CfgEnumFolderToTokenList(f); + + for (i = 0;i < t->NumTokens;i++) + { + char *name = t->Token[i]; + SiLoadHubAccessCfg(h, CfgGetFolder(f, name)); + } + + FreeToken(t); +} + +// Read the HUB_OPTION +void SiLoadHubOptionCfg(FOLDER *f, HUB_OPTION *o) +{ + char tmp[MAX_SIZE]; + // Validate arguments + if (f == NULL || o == NULL) + { + return; + } + + o->MaxSession = CfgGetInt(f, "MaxSession"); + o->NoArpPolling = CfgGetBool(f, "NoArpPolling"); + o->NoIPv6AddrPolling = CfgGetBool(f, "NoIPv6AddrPolling"); + o->NoIpTable = CfgGetBool(f, "NoIpTable"); + o->NoEnum = CfgGetBool(f, "NoEnum"); + o->FilterPPPoE = CfgGetBool(f, "FilterPPPoE"); + o->FilterOSPF = CfgGetBool(f, "FilterOSPF"); + o->FilterIPv4 = CfgGetBool(f, "FilterIPv4"); + o->FilterIPv6 = CfgGetBool(f, "FilterIPv6"); + o->FilterNonIP = CfgGetBool(f, "FilterNonIP"); + o->FilterBPDU = CfgGetBool(f, "FilterBPDU"); + o->NoIPv4PacketLog = CfgGetBool(f, "NoIPv4PacketLog"); + o->NoIPv6PacketLog = CfgGetBool(f, "NoIPv6PacketLog"); + o->NoIPv6DefaultRouterInRAWhenIPv6 = CfgGetBool(f, "NoIPv6DefaultRouterInRAWhenIPv6"); + o->DisableIPParsing = CfgGetBool(f, "DisableIPParsing"); + o->YieldAfterStorePacket = CfgGetBool(f, "YieldAfterStorePacket"); + o->NoSpinLockForPacketDelay = CfgGetBool(f, "NoSpinLockForPacketDelay"); + o->BroadcastStormDetectionThreshold = CfgGetInt(f, "BroadcastStormDetectionThreshold"); + o->ClientMinimumRequiredBuild = CfgGetInt(f, "ClientMinimumRequiredBuild"); + o->RequiredClientId = CfgGetInt(f, "RequiredClientId"); + o->NoManageVlanId = CfgGetBool(f, "NoManageVlanId"); + o->VlanTypeId = 0; + if (CfgGetStr(f, "VlanTypeId", tmp, sizeof(tmp))) + { + o->VlanTypeId = HexToInt(tmp); + } + if (o->VlanTypeId == 0) + { + o->VlanTypeId = MAC_PROTO_TAGVLAN; + } + o->FixForDLinkBPDU = CfgGetBool(f, "FixForDLinkBPDU"); + o->BroadcastLimiterStrictMode = CfgGetBool(f, "BroadcastLimiterStrictMode"); + o->MaxLoggedPacketsPerMinute = CfgGetInt(f, "MaxLoggedPacketsPerMinute"); + if (CfgIsItem(f, "FloodingSendQueueBufferQuota")) + { + o->FloodingSendQueueBufferQuota = CfgGetInt(f, "FloodingSendQueueBufferQuota"); + } + else + { + o->FloodingSendQueueBufferQuota = DEFAULT_FLOODING_QUEUE_LENGTH; + } + o->DoNotSaveHeavySecurityLogs = CfgGetBool(f, "DoNotSaveHeavySecurityLogs"); + + if (CfgIsItem(f, "DropBroadcastsInPrivacyFilterMode")) + { + o->DropBroadcastsInPrivacyFilterMode = CfgGetBool(f, "DropBroadcastsInPrivacyFilterMode"); + } + else + { + o->DropBroadcastsInPrivacyFilterMode = true; + } + + if (CfgIsItem(f, "DropArpInPrivacyFilterMode")) + { + o->DropArpInPrivacyFilterMode = CfgGetBool(f, "DropArpInPrivacyFilterMode"); + } + else + { + o->DropArpInPrivacyFilterMode = true; + } + + o->NoLookBPDUBridgeId = CfgGetBool(f, "NoLookBPDUBridgeId"); + o->AdjustTcpMssValue = CfgGetInt(f, "AdjustTcpMssValue"); + o->DisableAdjustTcpMss = CfgGetBool(f, "DisableAdjustTcpMss"); + if (CfgIsItem(f, "NoDhcpPacketLogOutsideHub")) + { + o->NoDhcpPacketLogOutsideHub = CfgGetBool(f, "NoDhcpPacketLogOutsideHub"); + } + else + { + o->NoDhcpPacketLogOutsideHub = true; + } + o->DisableHttpParsing = CfgGetBool(f, "DisableHttpParsing"); + o->DisableUdpAcceleration = CfgGetBool(f, "DisableUdpAcceleration"); + o->DisableUdpFilterForLocalBridgeNic = CfgGetBool(f, "DisableUdpFilterForLocalBridgeNic"); + o->ApplyIPv4AccessListOnArpPacket = CfgGetBool(f, "ApplyIPv4AccessListOnArpPacket"); + if (CfgIsItem(f, "RemoveDefGwOnDhcpForLocalhost")) + { + o->RemoveDefGwOnDhcpForLocalhost = CfgGetBool(f, "RemoveDefGwOnDhcpForLocalhost"); + } + else + { + o->RemoveDefGwOnDhcpForLocalhost = true; + } + o->SecureNAT_MaxTcpSessionsPerIp = CfgGetInt(f, "SecureNAT_MaxTcpSessionsPerIp"); + o->SecureNAT_MaxTcpSynSentPerIp = CfgGetInt(f, "SecureNAT_MaxTcpSynSentPerIp"); + o->SecureNAT_MaxUdpSessionsPerIp = CfgGetInt(f, "SecureNAT_MaxUdpSessionsPerIp"); + o->SecureNAT_MaxDnsSessionsPerIp = CfgGetInt(f, "SecureNAT_MaxDnsSessionsPerIp"); + o->SecureNAT_MaxIcmpSessionsPerIp = CfgGetInt(f, "SecureNAT_MaxIcmpSessionsPerIp"); + o->AccessListIncludeFileCacheLifetime = CfgGetInt(f, "AccessListIncludeFileCacheLifetime"); + + if (o->AccessListIncludeFileCacheLifetime == 0) + { + o->AccessListIncludeFileCacheLifetime = ACCESS_LIST_INCLUDE_FILE_CACHE_LIFETIME; + } + + o->DisableKernelModeSecureNAT = CfgGetBool(f, "DisableKernelModeSecureNAT"); + o->DisableIpRawModeSecureNAT = CfgGetBool(f, "DisableIpRawModeSecureNAT"); + o->DisableUserModeSecureNAT = CfgGetBool(f, "DisableUserModeSecureNAT"); + o->DisableCheckMacOnLocalBridge = CfgGetBool(f, "DisableCheckMacOnLocalBridge"); + o->DisableCorrectIpOffloadChecksum = CfgGetBool(f, "DisableCorrectIpOffloadChecksum"); + o->SuppressClientUpdateNotification = CfgGetBool(f, "SuppressClientUpdateNotification"); + o->AssignVLanIdByRadiusAttribute = CfgGetBool(f, "AssignVLanIdByRadiusAttribute"); + o->DenyAllRadiusLoginWithNoVlanAssign = CfgGetBool(f, "DenyAllRadiusLoginWithNoVlanAssign"); + o->SecureNAT_RandomizeAssignIp = CfgGetBool(f, "SecureNAT_RandomizeAssignIp"); + o->DetectDormantSessionInterval = CfgGetInt(f, "DetectDormantSessionInterval"); + o->NoPhysicalIPOnPacketLog = CfgGetBool(f, "NoPhysicalIPOnPacketLog"); + o->UseHubNameAsDhcpUserClassOption = CfgGetBool(f, "UseHubNameAsDhcpUserClassOption"); + o->UseHubNameAsRadiusNasId = CfgGetBool(f, "UseHubNameAsRadiusNasId"); + + // Enabled by default + if (CfgIsItem(f, "ManageOnlyPrivateIP")) + { + o->ManageOnlyPrivateIP = CfgGetBool(f, "ManageOnlyPrivateIP"); + } + else + { + o->ManageOnlyPrivateIP = true; + } + if (CfgIsItem(f, "ManageOnlyLocalUnicastIPv6")) + { + o->ManageOnlyLocalUnicastIPv6 = CfgGetBool(f, "ManageOnlyLocalUnicastIPv6"); + } + else + { + o->ManageOnlyLocalUnicastIPv6 = true; + } + if (CfgIsItem(f, "NoMacAddressLog")) + { + o->NoMacAddressLog = CfgGetBool(f, "NoMacAddressLog"); + } + else + { + o->NoMacAddressLog = true; + } +} + +// Write the HUB_OPTION +void SiWriteHubOptionCfg(FOLDER *f, HUB_OPTION *o) +{ + char tmp[MAX_SIZE]; + // Validate arguments + if (f == NULL || o == NULL) + { + return; + } + + CfgAddInt(f, "MaxSession", o->MaxSession); + CfgAddBool(f, "NoArpPolling", o->NoArpPolling); + CfgAddBool(f, "NoIPv6AddrPolling", o->NoIPv6AddrPolling); + CfgAddBool(f, "NoIpTable", o->NoIpTable); + CfgAddBool(f, "NoEnum", o->NoEnum); + CfgAddBool(f, "FilterPPPoE", o->FilterPPPoE); + CfgAddBool(f, "FilterOSPF", o->FilterOSPF); + CfgAddBool(f, "FilterIPv4", o->FilterIPv4); + CfgAddBool(f, "FilterIPv6", o->FilterIPv6); + CfgAddBool(f, "FilterNonIP", o->FilterNonIP); + CfgAddBool(f, "NoIPv4PacketLog", o->NoIPv4PacketLog); + CfgAddBool(f, "NoIPv6PacketLog", o->NoIPv6PacketLog); + CfgAddBool(f, "FilterBPDU", o->FilterBPDU); + CfgAddBool(f, "NoIPv6DefaultRouterInRAWhenIPv6", o->NoIPv6DefaultRouterInRAWhenIPv6); + CfgAddBool(f, "NoMacAddressLog", o->NoMacAddressLog); + CfgAddBool(f, "ManageOnlyPrivateIP", o->ManageOnlyPrivateIP); + CfgAddBool(f, "ManageOnlyLocalUnicastIPv6", o->ManageOnlyLocalUnicastIPv6); + CfgAddBool(f, "DisableIPParsing", o->DisableIPParsing); + CfgAddBool(f, "YieldAfterStorePacket", o->YieldAfterStorePacket); + CfgAddBool(f, "NoSpinLockForPacketDelay", o->NoSpinLockForPacketDelay); + CfgAddInt(f, "BroadcastStormDetectionThreshold", o->BroadcastStormDetectionThreshold); + CfgAddInt(f, "ClientMinimumRequiredBuild", o->ClientMinimumRequiredBuild); + CfgAddInt(f, "RequiredClientId", o->RequiredClientId); + CfgAddBool(f, "NoManageVlanId", o->NoManageVlanId); + Format(tmp, sizeof(tmp), "0x%x", o->VlanTypeId); + CfgAddStr(f, "VlanTypeId", tmp); + if (o->FixForDLinkBPDU) + { + CfgAddBool(f, "FixForDLinkBPDU", o->FixForDLinkBPDU); + } + CfgAddBool(f, "BroadcastLimiterStrictMode", o->BroadcastLimiterStrictMode); + CfgAddInt(f, "MaxLoggedPacketsPerMinute", o->MaxLoggedPacketsPerMinute); + CfgAddInt(f, "FloodingSendQueueBufferQuota", o->FloodingSendQueueBufferQuota); + CfgAddBool(f, "DoNotSaveHeavySecurityLogs", o->DoNotSaveHeavySecurityLogs); + CfgAddBool(f, "DropBroadcastsInPrivacyFilterMode", o->DropBroadcastsInPrivacyFilterMode); + CfgAddBool(f, "DropArpInPrivacyFilterMode", o->DropArpInPrivacyFilterMode); + CfgAddBool(f, "SuppressClientUpdateNotification", o->SuppressClientUpdateNotification); + CfgAddBool(f, "AssignVLanIdByRadiusAttribute", o->AssignVLanIdByRadiusAttribute); + CfgAddBool(f, "DenyAllRadiusLoginWithNoVlanAssign", o->DenyAllRadiusLoginWithNoVlanAssign); + CfgAddBool(f, "SecureNAT_RandomizeAssignIp", o->SecureNAT_RandomizeAssignIp); + CfgAddBool(f, "NoPhysicalIPOnPacketLog", o->NoPhysicalIPOnPacketLog); + CfgAddInt(f, "DetectDormantSessionInterval", o->DetectDormantSessionInterval); + CfgAddBool(f, "NoLookBPDUBridgeId", o->NoLookBPDUBridgeId); + CfgAddInt(f, "AdjustTcpMssValue", o->AdjustTcpMssValue); + CfgAddBool(f, "DisableAdjustTcpMss", o->DisableAdjustTcpMss); + CfgAddBool(f, "NoDhcpPacketLogOutsideHub", o->NoDhcpPacketLogOutsideHub); + CfgAddBool(f, "DisableHttpParsing", o->DisableHttpParsing); + CfgAddBool(f, "DisableUdpAcceleration", o->DisableUdpAcceleration); + CfgAddBool(f, "DisableUdpFilterForLocalBridgeNic", o->DisableUdpFilterForLocalBridgeNic); + CfgAddBool(f, "ApplyIPv4AccessListOnArpPacket", o->ApplyIPv4AccessListOnArpPacket); + CfgAddBool(f, "RemoveDefGwOnDhcpForLocalhost", o->RemoveDefGwOnDhcpForLocalhost); + CfgAddInt(f, "SecureNAT_MaxTcpSessionsPerIp", o->SecureNAT_MaxTcpSessionsPerIp); + CfgAddInt(f, "SecureNAT_MaxTcpSynSentPerIp", o->SecureNAT_MaxTcpSynSentPerIp); + CfgAddInt(f, "SecureNAT_MaxUdpSessionsPerIp", o->SecureNAT_MaxUdpSessionsPerIp); + CfgAddInt(f, "SecureNAT_MaxDnsSessionsPerIp", o->SecureNAT_MaxDnsSessionsPerIp); + CfgAddInt(f, "SecureNAT_MaxIcmpSessionsPerIp", o->SecureNAT_MaxIcmpSessionsPerIp); + CfgAddInt(f, "AccessListIncludeFileCacheLifetime", o->AccessListIncludeFileCacheLifetime); + CfgAddBool(f, "DisableKernelModeSecureNAT", o->DisableKernelModeSecureNAT); + CfgAddBool(f, "DisableIpRawModeSecureNAT", o->DisableIpRawModeSecureNAT); + CfgAddBool(f, "DisableUserModeSecureNAT", o->DisableUserModeSecureNAT); + CfgAddBool(f, "DisableCheckMacOnLocalBridge", o->DisableCheckMacOnLocalBridge); + CfgAddBool(f, "DisableCorrectIpOffloadChecksum", o->DisableCorrectIpOffloadChecksum); + CfgAddBool(f, "UseHubNameAsDhcpUserClassOption", o->UseHubNameAsDhcpUserClassOption); + CfgAddBool(f, "UseHubNameAsRadiusNasId", o->UseHubNameAsRadiusNasId); +} + +// Write the user +void SiWriteUserCfg(FOLDER *f, USER *u) +{ + BUF *b; + AUTHPASSWORD *password; + AUTHRADIUS *radius; + AUTHNT *nt; + AUTHUSERCERT *usercert; + AUTHROOTCERT *rootcert; + // Validate arguments + if (f == NULL || u == NULL) + { + return; + } + + Lock(u->lock); + { + CfgAddUniStr(f, "RealName", u->RealName); + CfgAddUniStr(f, "Note", u->Note); + if (u->Group != NULL) + { + CfgAddStr(f, "GroupName", u->GroupName); + } + CfgAddInt64(f, "CreatedTime", u->CreatedTime); + CfgAddInt64(f, "UpdatedTime", u->UpdatedTime); + CfgAddInt64(f, "ExpireTime", u->ExpireTime); + CfgAddInt64(f, "LastLoginTime", u->LastLoginTime); + CfgAddInt(f, "NumLogin", u->NumLogin); + if (u->Policy != NULL) + { + SiWritePolicyCfg(CfgCreateFolder(f, "Policy"), u->Policy, false); + } + SiWriteTraffic(f, "Traffic", u->Traffic); + + CfgAddInt(f, "AuthType", u->AuthType); + if (u->AuthData != NULL) + { + switch (u->AuthType) + { + case AUTHTYPE_ANONYMOUS: + break; + + case AUTHTYPE_PASSWORD: + password = (AUTHPASSWORD *)u->AuthData; + CfgAddByte(f, "AuthPassword", password->HashedKey, sizeof(password->HashedKey)); + + if (IsZero(password->NtLmSecureHash, sizeof(password->NtLmSecureHash)) == false) + { + CfgAddByte(f, "AuthNtLmSecureHash", password->NtLmSecureHash, sizeof(password->NtLmSecureHash)); + } + break; + + case AUTHTYPE_NT: + nt = (AUTHNT *)u->AuthData; + CfgAddUniStr(f, "AuthNtUserName", nt->NtUsername); + break; + + case AUTHTYPE_RADIUS: + radius = (AUTHRADIUS *)u->AuthData; + CfgAddUniStr(f, "AuthRadiusUsername", radius->RadiusUsername); + break; + + case AUTHTYPE_USERCERT: + usercert = (AUTHUSERCERT *)u->AuthData; + b = XToBuf(usercert->UserX, false); + if (b != NULL) + { + CfgAddBuf(f, "AuthUserCert", b); + FreeBuf(b); + } + break; + + case AUTHTYPE_ROOTCERT: + rootcert = (AUTHROOTCERT *)u->AuthData; + if (rootcert->Serial != NULL && rootcert->Serial->size >= 1) + { + CfgAddByte(f, "AuthSerial", rootcert->Serial->data, rootcert->Serial->size); + } + if (rootcert->CommonName != NULL && UniIsEmptyStr(rootcert->CommonName) == false) + { + CfgAddUniStr(f, "AuthCommonName", rootcert->CommonName); + } + break; + } + } + } + Unlock(u->lock); +} + +// Read an user +void SiLoadUserCfg(HUB *h, FOLDER *f) +{ + char *username; + wchar_t realname[MAX_SIZE]; + wchar_t note[MAX_SIZE]; + char groupname[MAX_SIZE]; + FOLDER *pf; + UINT64 created_time; + UINT64 updated_time; + UINT64 expire_time; + UINT64 last_login_time; + UINT num_login; + POLICY p; + TRAFFIC t; + BUF *b; + UINT authtype; + void *authdata; + X_SERIAL *serial = NULL; + wchar_t common_name[MAX_SIZE]; + UCHAR hashed_password[SHA1_SIZE]; + UCHAR md4_password[MD5_SIZE]; + wchar_t tmp[MAX_SIZE]; + USER *u; + USERGROUP *g; + // Validate arguments + if (h == NULL || f == NULL) + { + return; + } + + username = f->Name; + CfgGetUniStr(f, "RealName", realname, sizeof(realname)); + CfgGetUniStr(f, "Note", note, sizeof(note)); + CfgGetStr(f, "GroupName", groupname, sizeof(groupname)); + + created_time = CfgGetInt64(f, "CreatedTime"); + updated_time = CfgGetInt64(f, "UpdatedTime"); + expire_time = CfgGetInt64(f, "ExpireTime"); + last_login_time = CfgGetInt64(f, "LastLoginTime"); + num_login = CfgGetInt(f, "NumLogin"); + pf = CfgGetFolder(f, "Policy"); + if (pf != NULL) + { + SiLoadPolicyCfg(&p, pf); + } + SiLoadTraffic(f, "Traffic", &t); + + authtype = CfgGetInt(f, "AuthType"); + authdata = NULL; + + switch (authtype) + { + case AUTHTYPE_PASSWORD: + Zero(hashed_password, sizeof(hashed_password)); + Zero(md4_password, sizeof(md4_password)); + CfgGetByte(f, "AuthPassword", hashed_password, sizeof(hashed_password)); + CfgGetByte(f, "AuthNtLmSecureHash", md4_password, sizeof(md4_password)); + authdata = NewPasswordAuthDataRaw(hashed_password, md4_password); + break; + + case AUTHTYPE_NT: + if (CfgGetUniStr(f, "AuthNtUserName", tmp, sizeof(tmp))) + { + authdata = NewNTAuthData(tmp); + } + else + { + authdata = NewNTAuthData(NULL); + } + break; + + case AUTHTYPE_RADIUS: + if (CfgGetUniStr(f, "AuthRadiusUsername", tmp, sizeof(tmp))) + { + authdata = NewRadiusAuthData(tmp); + } + else + { + authdata = NewRadiusAuthData(NULL); + } + break; + + case AUTHTYPE_USERCERT: + b = CfgGetBuf(f, "AuthUserCert"); + if (b != NULL) + { + X *x = BufToX(b, false); + if (x != NULL) + { + authdata = NewUserCertAuthData(x); + FreeX(x); + } + FreeBuf(b); + } + break; + + case AUTHTYPE_ROOTCERT: + b = CfgGetBuf(f, "AuthSerial"); + if (b != NULL) + { + serial = NewXSerial(b->Buf, b->Size); + FreeBuf(b); + } + CfgGetUniStr(f, "AuthCommonName", common_name, sizeof(common_name)); + authdata = NewRootCertAuthData(serial, common_name); + break; + } + + // Add an user + AcLock(h); + { + if (StrLen(groupname) > 0) + { + g = AcGetGroup(h, groupname); + } + else + { + g = NULL; + } + + u = NewUser(username, realname, note, authtype, authdata); + if (u != NULL) + { + if (g != NULL) + { + JoinUserToGroup(u, g); + } + + SetUserTraffic(u, &t); + + if (pf != NULL) + { + SetUserPolicy(u, &p); + } + + Lock(u->lock); + { + u->CreatedTime = created_time; + u->UpdatedTime = updated_time; + u->ExpireTime = expire_time; + u->LastLoginTime = last_login_time; + u->NumLogin = num_login; + } + Unlock(u->lock); + + AcAddUser(h, u); + + ReleaseUser(u); + } + + if (g != NULL) + { + ReleaseGroup(g); + } + } + AcUnlock(h); + + if (serial != NULL) + { + FreeXSerial(serial); + } +} + +// Write the user list +void SiWriteUserList(FOLDER *f, LIST *o) +{ + // Validate arguments + if (f == NULL || o == NULL) + { + return; + } + + LockList(o); + { + UINT i; + for (i = 0;i < LIST_NUM(o);i++) + { + USER *u = LIST_DATA(o, i); + SiWriteUserCfg(CfgCreateFolder(f, u->Name), u); + } + } + UnlockList(o); +} + +// Read the user list +void SiLoadUserList(HUB *h, FOLDER *f) +{ + TOKEN_LIST *t; + UINT i; + char *name; + // Validate arguments + if (f == NULL || h == NULL) + { + return; + } + + t = CfgEnumFolderToTokenList(f); + + for (i = 0;i < t->NumTokens;i++) + { + FOLDER *ff; + name = t->Token[i]; + ff = CfgGetFolder(f, name); + SiLoadUserCfg(h, ff); + } + + FreeToken(t); +} + +// Write the group information +void SiWriteGroupCfg(FOLDER *f, USERGROUP *g) +{ + // Validate arguments + if (f == NULL || g == NULL) + { + return; + } + + Lock(g->lock); + { + CfgAddUniStr(f, "RealName", g->RealName); + CfgAddUniStr(f, "Note", g->Note); + if (g->Policy != NULL) + { + SiWritePolicyCfg(CfgCreateFolder(f, "Policy"), g->Policy, false); + } + SiWriteTraffic(f, "Traffic", g->Traffic); + } + Unlock(g->lock); +} + +// Read the group information +void SiLoadGroupCfg(HUB *h, FOLDER *f) +{ + wchar_t realname[MAX_SIZE]; + wchar_t note[MAX_SIZE]; + char *name; + FOLDER *pf; + POLICY p; + TRAFFIC t; + USERGROUP *g; + // Validate arguments + if (h == NULL || f == NULL) + { + return; + } + + name = f->Name; + + CfgGetUniStr(f, "RealName", realname, sizeof(realname)); + CfgGetUniStr(f, "Note", note, sizeof(note)); + + pf = CfgGetFolder(f, "Policy"); + if (pf != NULL) + { + SiLoadPolicyCfg(&p, pf); + } + + SiLoadTraffic(f, "Traffic", &t); + + g = NewGroup(name, realname, note); + if (g == NULL) + { + return; + } + + if (pf != NULL) + { + SetGroupPolicy(g, &p); + } + + SetGroupTraffic(g, &t); + + AcLock(h); + { + AcAddGroup(h, g); + } + AcUnlock(h); + + ReleaseGroup(g); +} + +// Write the group list +void SiWriteGroupList(FOLDER *f, LIST *o) +{ + // Validate arguments + if (f == NULL || o == NULL) + { + return; + } + + LockList(o); + { + UINT i; + for (i = 0;i < LIST_NUM(o);i++) + { + USERGROUP *g = LIST_DATA(o, i); + SiWriteGroupCfg(CfgCreateFolder(f, g->Name), g); + } + } + UnlockList(o); +} + +// Read the group List +void SiLoadGroupList(HUB *h, FOLDER *f) +{ + TOKEN_LIST *t; + UINT i; + char *name; + // Validate arguments + if (f == NULL || h == NULL) + { + return; + } + + t = CfgEnumFolderToTokenList(f); + + for (i = 0;i < t->NumTokens;i++) + { + name = t->Token[i]; + SiLoadGroupCfg(h, CfgGetFolder(f, name)); + } + + FreeToken(t); +} + +// Write the AC list +void SiWriteAcList(FOLDER *f, LIST *o) +{ + // Validate arguments + if (f == NULL || o == NULL) + { + return; + } + + LockList(o); + { + UINT i; + for (i = 0;i < LIST_NUM(o);i++) + { + char name[MAX_SIZE]; + AC *ac = LIST_DATA(o, i); + FOLDER *ff; + + Format(name, sizeof(name), "Acl%u", i + 1); + + ff = CfgCreateFolder(f, name); + + CfgAddBool(ff, "Deny", ac->Deny); + CfgAddInt(ff, "Priority", ac->Priority); + CfgAddIp(ff, "IpAddress", &ac->IpAddress); + + if (ac->Masked) + { + CfgAddIp(ff, "NetMask", &ac->SubnetMask); + } + } + } + UnlockList(o); +} + +// Read the AC list +void SiLoadAcList(LIST *o, FOLDER *f) +{ + // Validate arguments + if (o == NULL || f == NULL) + { + return; + } + + LockList(o); + { + TOKEN_LIST *t = CfgEnumFolderToTokenList(f); + + if (t != NULL) + { + UINT i; + + for (i = 0;i < t->NumTokens;i++) + { + FOLDER *ff = CfgGetFolder(f, t->Token[i]); + + if (ff != NULL) + { + AC ac; + + Zero(&ac, sizeof(ac)); + ac.Deny = CfgGetBool(ff, "Deny"); + ac.Priority = CfgGetInt(ff, "Priority"); + CfgGetIp(ff, "IpAddress", &ac.IpAddress); + + if (CfgGetIp(ff, "NetMask", &ac.SubnetMask)) + { + ac.Masked = true; + } + + AddAc(o, &ac); + } + } + + FreeToken(t); + } + } + UnlockList(o); +} + +// Write the certificate revocation list +void SiWriteCrlList(FOLDER *f, LIST *o) +{ + // Validate arguments + if (f == NULL || o == NULL) + { + return; + } + + LockList(o); + { + UINT i; + for (i = 0;i < LIST_NUM(o);i++) + { + char name[MAX_SIZE]; + CRL *crl = LIST_DATA(o, i); + FOLDER *ff; + NAME *n; + + Format(name, sizeof(name), "Crl%u", i); + + ff = CfgCreateFolder(f, name); + n = crl->Name; + + if (UniIsEmptyStr(n->CommonName) == false) + { + CfgAddUniStr(ff, "CommonName", n->CommonName); + } + + if (UniIsEmptyStr(n->Organization) == false) + { + CfgAddUniStr(ff, "Organization", n->Organization); + } + + if (UniIsEmptyStr(n->Unit) == false) + { + CfgAddUniStr(ff, "Unit", n->Unit); + } + + if (UniIsEmptyStr(n->Country) == false) + { + CfgAddUniStr(ff, "Country", n->Country); + } + + if (UniIsEmptyStr(n->State) == false) + { + CfgAddUniStr(ff, "State", n->State); + } + + if (UniIsEmptyStr(n->Local) == false) + { + CfgAddUniStr(ff, "Local", n->Local); + } + + if (IsZero(crl->DigestMD5, MD5_SIZE) == false) + { + char tmp[MAX_SIZE]; + + BinToStr(tmp, sizeof(tmp), crl->DigestMD5, MD5_SIZE); + CfgAddStr(ff, "DigestMD5", tmp); + } + + if (IsZero(crl->DigestSHA1, SHA1_SIZE) == false) + { + char tmp[MAX_SIZE]; + + BinToStr(tmp, sizeof(tmp), crl->DigestSHA1, SHA1_SIZE); + CfgAddStr(ff, "DigestSHA1", tmp); + } + + if (crl->Serial != NULL) + { + char tmp[MAX_SIZE]; + + BinToStr(tmp, sizeof(tmp), crl->Serial->data, crl->Serial->size); + CfgAddStr(ff, "Serial", tmp); + } + } + } + UnlockList(o); +} + +// Read the certificate revocation list +void SiLoadCrlList(LIST *o, FOLDER *f) +{ + // Validate arguments + if (o == NULL || f == NULL) + { + return; + } + + LockList(o); + { + UINT i; + TOKEN_LIST *t; + + t = CfgEnumFolderToTokenList(f); + + for (i = 0;i < t->NumTokens;i++) + { + CRL *crl; + FOLDER *ff = CfgGetFolder(f, t->Token[i]); + wchar_t cn[MAX_SIZE], org[MAX_SIZE], u[MAX_SIZE], c[MAX_SIZE], + st[MAX_SIZE], l[MAX_SIZE]; + char tmp[MAX_SIZE]; + + if (ff != NULL) + { + BUF *b; + + crl = ZeroMalloc(sizeof(CRL)); + + CfgGetUniStr(ff, "CommonName", cn, sizeof(cn)); + CfgGetUniStr(ff, "Organization", org, sizeof(org)); + CfgGetUniStr(ff, "Unit", u, sizeof(u)); + CfgGetUniStr(ff, "Country", c, sizeof(c)); + CfgGetUniStr(ff, "State", st, sizeof(st)); + CfgGetUniStr(ff, "Local", l, sizeof(l)); + + crl->Name = NewName(cn, org, u, c, st, l); + + if (CfgGetStr(ff, "Serial", tmp, sizeof(tmp))) + { + b = StrToBin(tmp); + + if (b != NULL) + { + if (b->Size >= 1) + { + crl->Serial = NewXSerial(b->Buf, b->Size); + } + + FreeBuf(b); + } + } + + if (CfgGetStr(ff, "DigestMD5", tmp, sizeof(tmp))) + { + b = StrToBin(tmp); + + if (b != NULL) + { + if (b->Size == MD5_SIZE) + { + Copy(crl->DigestMD5, b->Buf, MD5_SIZE); + } + + FreeBuf(b); + } + } + + if (CfgGetStr(ff, "DigestSHA1", tmp, sizeof(tmp))) + { + b = StrToBin(tmp); + + if (b != NULL) + { + if (b->Size == SHA1_SIZE) + { + Copy(crl->DigestSHA1, b->Buf, SHA1_SIZE); + } + + FreeBuf(b); + } + } + + Insert(o, crl); + } + } + + FreeToken(t); + } + UnlockList(o); +} + +// Write the certificates list +void SiWriteCertList(FOLDER *f, LIST *o) +{ + // Validate arguments + if (f == NULL || o == NULL) + { + return; + } + + LockList(o); + { + UINT i; + X *x; + for (i = 0;i < LIST_NUM(o);i++) + { + char name[MAX_SIZE]; + BUF *b; + x = LIST_DATA(o, i); + Format(name, sizeof(name), "Cert%u", i); + b = XToBuf(x, false); + if (b != NULL) + { + CfgAddBuf(CfgCreateFolder(f, name), "X509", b); + FreeBuf(b); + } + } + } + UnlockList(o); +} + +// Read the certificates list +void SiLoadCertList(LIST *o, FOLDER *f) +{ + // Validate arguments + if (o == NULL || f == NULL) + { + return; + } + + LockList(o); + { + UINT i; + TOKEN_LIST *t; + + t = CfgEnumFolderToTokenList(f); + + for (i = 0;i < t->NumTokens;i++) + { + FOLDER *ff = CfgGetFolder(f, t->Token[i]); + BUF *b; + + b = CfgGetBuf(ff, "X509"); + if (b != NULL) + { + X *x = BufToX(b, false); + if (x != NULL) + { + Insert(o, x); + } + FreeBuf(b); + } + } + + FreeToken(t); + } + UnlockList(o); +} + +// Write the database +void SiWriteHubDb(FOLDER *f, HUBDB *db, bool no_save_ac_list) +{ + // Validate arguments + if (f == NULL || db == NULL) + { + return; + } + + SiWriteUserList(CfgCreateFolder(f, "UserList"), db->UserList); + SiWriteGroupList(CfgCreateFolder(f, "GroupList"), db->GroupList); + SiWriteCertList(CfgCreateFolder(f, "CertList"), db->RootCertList); + SiWriteCrlList(CfgCreateFolder(f, "CrlList"), db->CrlList); + + if (no_save_ac_list == false) + { + SiWriteAcList(CfgCreateFolder(f, "IPAccessControlList"), db->AcList); + } +} + +// Read the database +void SiLoadHubDb(HUB *h, FOLDER *f) +{ + // Validate arguments + if (f == NULL || h == NULL) + { + return; + } + + SiLoadGroupList(h, CfgGetFolder(f, "GroupList")); + SiLoadUserList(h, CfgGetFolder(f, "UserList")); + + if (h->HubDb != NULL) + { + SiLoadCertList(h->HubDb->RootCertList, CfgGetFolder(f, "CertList")); + SiLoadCrlList(h->HubDb->CrlList, CfgGetFolder(f, "CrlList")); + SiLoadAcList(h->HubDb->AcList, CfgGetFolder(f, "IPAccessControlList")); + } +} + +// Write the Virtual HUB setting +void SiWriteHubCfg(FOLDER *f, HUB *h) +{ + // Validate arguments + if (f == NULL || h == NULL) + { + return; + } + + // Radius server name + Lock(h->RadiusOptionLock); + { + if (h->RadiusServerName != NULL) + { + CfgAddStr(f, "RadiusServerName", h->RadiusServerName); + CfgAddBuf(f, "RadiusSecret", h->RadiusSecret); + } + CfgAddInt(f, "RadiusServerPort", h->RadiusServerPort); + CfgAddInt(f, "RadiusRetryInterval", h->RadiusRetryInterval); + CfgAddStr(f, "RadiusSuffixFilter", h->RadiusSuffixFilter); + CfgAddStr(f, "RadiusRealm", h->RadiusRealm); + + CfgAddBool(f, "RadiusConvertAllMsChapv2AuthRequestToEap", h->RadiusConvertAllMsChapv2AuthRequestToEap); + CfgAddBool(f, "RadiusUsePeapInsteadOfEap", h->RadiusUsePeapInsteadOfEap); + } + Unlock(h->RadiusOptionLock); + + // Password + CfgAddByte(f, "HashedPassword", h->HashedPassword, sizeof(h->HashedPassword)); + CfgAddByte(f, "SecurePassword", h->SecurePassword, sizeof(h->SecurePassword)); + + // Online / Offline flag + if (h->Cedar->Bridge == false) + { + CfgAddBool(f, "Online", (h->Offline && (h->HubIsOnlineButHalting == false)) ? false : true); + } + + // Traffic information + SiWriteTraffic(f, "Traffic", h->Traffic); + + // HUB options + SiWriteHubOptionCfg(CfgCreateFolder(f, "Option"), h->Option); + + // Message + { + FOLDER *folder = CfgCreateFolder(f, "Message"); + + if (IsEmptyUniStr(h->Msg) == false) + { + CfgAddUniStr(folder, "MessageText", h->Msg); + } + } + + // HUB_LOG + SiWriteHubLogCfg(CfgCreateFolder(f, "LogSetting"), &h->LogSetting); + + if (h->Type == HUB_TYPE_STANDALONE) + { + // Link list + SiWriteHubLinks(CfgCreateFolder(f, "CascadeList"), h); + } + + if (h->Type != HUB_TYPE_FARM_STATIC) + { + if (GetServerCapsBool(h->Cedar->Server, "b_support_securenat")) + { + // SecureNAT + SiWriteSecureNAT(h, CfgCreateFolder(f, "SecureNAT")); + } + } + + // Access list + SiWriteHubAccessLists(CfgCreateFolder(f, "AccessList"), h); + + // Administration options + SiWriteHubAdminOptions(CfgCreateFolder(f, "AdminOption"), h); + + // Type of HUB + CfgAddInt(f, "Type", h->Type); + + // Database + if (h->Cedar->Bridge == false) + { + SiWriteHubDb(CfgCreateFolder(f, "SecurityAccountDatabase"), h->HubDb, + false + ); + } + + // Usage status + CfgAddInt64(f, "LastCommTime", h->LastCommTime); + CfgAddInt64(f, "LastLoginTime", h->LastLoginTime); + CfgAddInt64(f, "CreatedTime", h->CreatedTime); + CfgAddInt(f, "NumLogin", h->NumLogin); +} + +// Read the logging options +void SiLoadHubLogCfg(HUB_LOG *g, FOLDER *f) +{ + // Validate arguments + if (f == NULL || g == NULL) + { + return; + } + + Zero(g, sizeof(HUB_LOG)); + g->SaveSecurityLog = CfgGetBool(f, "SaveSecurityLog"); + g->SecurityLogSwitchType = CfgGetInt(f, "SecurityLogSwitchType"); + g->SavePacketLog = CfgGetBool(f, "SavePacketLog"); + g->PacketLogSwitchType = CfgGetInt(f, "PacketLogSwitchType"); + + g->PacketLogConfig[PACKET_LOG_TCP_CONN] = CfgGetInt(f, "PACKET_LOG_TCP_CONN"); + g->PacketLogConfig[PACKET_LOG_TCP] = CfgGetInt(f, "PACKET_LOG_TCP"); + g->PacketLogConfig[PACKET_LOG_DHCP] = CfgGetInt(f, "PACKET_LOG_DHCP"); + g->PacketLogConfig[PACKET_LOG_UDP] = CfgGetInt(f, "PACKET_LOG_UDP"); + g->PacketLogConfig[PACKET_LOG_ICMP] = CfgGetInt(f, "PACKET_LOG_ICMP"); + g->PacketLogConfig[PACKET_LOG_IP] = CfgGetInt(f, "PACKET_LOG_IP"); + g->PacketLogConfig[PACKET_LOG_ARP] = CfgGetInt(f, "PACKET_LOG_ARP"); + g->PacketLogConfig[PACKET_LOG_ETHERNET] = CfgGetInt(f, "PACKET_LOG_ETHERNET"); +} + +// Write the logging options +void SiWriteHubLogCfg(FOLDER *f, HUB_LOG *g) +{ + SiWriteHubLogCfgEx(f, g, false); +} +void SiWriteHubLogCfgEx(FOLDER *f, HUB_LOG *g, bool el_mode) +{ + // Validate arguments + if (f == NULL || g == NULL) + { + return; + } + + if (el_mode == false) + { + CfgAddBool(f, "SaveSecurityLog", g->SaveSecurityLog); + CfgAddInt(f, "SecurityLogSwitchType", g->SecurityLogSwitchType); + CfgAddBool(f, "SavePacketLog", g->SavePacketLog); + } + + CfgAddInt(f, "PacketLogSwitchType", g->PacketLogSwitchType); + + CfgAddInt(f, "PACKET_LOG_TCP_CONN", g->PacketLogConfig[PACKET_LOG_TCP_CONN]); + CfgAddInt(f, "PACKET_LOG_TCP", g->PacketLogConfig[PACKET_LOG_TCP]); + CfgAddInt(f, "PACKET_LOG_DHCP", g->PacketLogConfig[PACKET_LOG_DHCP]); + CfgAddInt(f, "PACKET_LOG_UDP", g->PacketLogConfig[PACKET_LOG_UDP]); + CfgAddInt(f, "PACKET_LOG_ICMP", g->PacketLogConfig[PACKET_LOG_ICMP]); + CfgAddInt(f, "PACKET_LOG_IP", g->PacketLogConfig[PACKET_LOG_IP]); + CfgAddInt(f, "PACKET_LOG_ARP", g->PacketLogConfig[PACKET_LOG_ARP]); + CfgAddInt(f, "PACKET_LOG_ETHERNET", g->PacketLogConfig[PACKET_LOG_ETHERNET]); +} + +// Read the Virtual HUB settings +void SiLoadHubCfg(SERVER *s, FOLDER *f, char *name) +{ + HUB *h; + CEDAR *c; + HUB_OPTION o; + bool online; + UINT hub_old_type = 0; + // Validate arguments + if (s == NULL || f == NULL || name == NULL) + { + return; + } + + c = s->Cedar; + + // Get the option + Zero(&o, sizeof(o)); + SiLoadHubOptionCfg(CfgGetFolder(f, "Option"), &o); + + // Create a HUB + h = NewHub(c, name, &o); + if (h != NULL) + { + HUB_LOG g; + // Radius server settings + Lock(h->RadiusOptionLock); + { + char name[MAX_SIZE]; + BUF *secret; + UINT port; + UINT interval; + + port = CfgGetInt(f, "RadiusServerPort"); + interval = CfgGetInt(f, "RadiusRetryInterval"); + + CfgGetStr(f, "RadiusSuffixFilter", h->RadiusSuffixFilter, sizeof(h->RadiusSuffixFilter)); + CfgGetStr(f, "RadiusRealm", h->RadiusRealm, sizeof(h->RadiusRealm)); + + h->RadiusConvertAllMsChapv2AuthRequestToEap = CfgGetBool(f, "RadiusConvertAllMsChapv2AuthRequestToEap"); + h->RadiusUsePeapInsteadOfEap = CfgGetBool(f, "RadiusUsePeapInsteadOfEap"); + + if (interval == 0) + { + interval = RADIUS_RETRY_INTERVAL; + } + + if (port != 0 && CfgGetStr(f, "RadiusServerName", name, sizeof(name))) + { + secret = CfgGetBuf(f, "RadiusSecret"); + if (secret != NULL) + { + char secret_str[MAX_SIZE]; + Zero(secret_str, sizeof(secret_str)); + if (secret->Size < sizeof(secret_str)) + { + Copy(secret_str, secret->Buf, secret->Size); + } + secret_str[sizeof(secret_str) - 1] = 0; + //SetRadiusServer(h, name, port, secret_str); + SetRadiusServerEx(h, name, port, secret_str, interval); + FreeBuf(secret); + } + } + } + Unlock(h->RadiusOptionLock); + + // Password + if (CfgGetByte(f, "HashedPassword", h->HashedPassword, sizeof(h->HashedPassword)) != sizeof(h->HashedPassword)) + { + Sha0(h->HashedPassword, "", 0); + } + if (CfgGetByte(f, "SecurePassword", h->SecurePassword, sizeof(h->SecurePassword)) != sizeof(h->SecurePassword)) + { + HashPassword(h->SecurePassword, ADMINISTRATOR_USERNAME, ""); + } + + // Log Settings + Zero(&g, sizeof(g)); + SiLoadHubLogCfg(&g, CfgGetFolder(f, "LogSetting")); + SetHubLogSetting(h, &g); + + // Online / Offline flag + if (h->Cedar->Bridge == false) + { + online = CfgGetBool(f, "Online"); + } + else + { + online = true; + } + + // Traffic information + SiLoadTraffic(f, "Traffic", h->Traffic); + + // Access list + SiLoadHubAccessLists(h, CfgGetFolder(f, "AccessList")); + + // Type of HUB + hub_old_type = h->Type = CfgGetInt(f, "Type"); + + if (s->ServerType == SERVER_TYPE_STANDALONE) + { + if (h->Type != HUB_TYPE_STANDALONE) + { + // Change the type of all HUB to a stand-alone if the server is a stand-alone + h->Type = HUB_TYPE_STANDALONE; + } + } + else + { + if (h->Type == HUB_TYPE_STANDALONE) + { + // If the server is a farm controller, change the type of HUB to the farm supported types + h->Type = HUB_TYPE_FARM_DYNAMIC; + } + } + + if (h->Type == HUB_TYPE_FARM_DYNAMIC) + { + h->CurrentVersion = h->LastVersion = 1; + } + + // Message + { + FOLDER *folder = CfgGetFolder(f, "Message"); + if (folder != NULL) + { + wchar_t *tmp = Malloc(sizeof(wchar_t) * (HUB_MAXMSG_LEN + 1)); + if (CfgGetUniStr(folder, "MessageText", tmp, sizeof(wchar_t) * (HUB_MAXMSG_LEN + 1))) + { + SetHubMsg(h, tmp); + } + Free(tmp); + } + } + + // Link list + if (h->Type == HUB_TYPE_STANDALONE) + { + // The link list is used only on stand-alone HUB + // In VPN Gate hubs, don't load this + { + SiLoadHubLinks(h, CfgGetFolder(f, "CascadeList")); + } + } + + // SecureNAT + if (GetServerCapsBool(h->Cedar->Server, "b_support_securenat")) + { + if (h->Type == HUB_TYPE_STANDALONE || h->Type == HUB_TYPE_FARM_DYNAMIC) + { + // SecureNAT is used only in the case of dynamic HUB or standalone HUB + SiLoadSecureNAT(h, CfgGetFolder(f, "SecureNAT")); + + if (h->Type != HUB_TYPE_STANDALONE && h->Cedar != NULL && h->Cedar->Server != NULL && + h->Cedar->Server->ServerType == SERVER_TYPE_FARM_CONTROLLER) + { + NiClearUnsupportedVhOptionForDynamicHub(h->SecureNATOption, + hub_old_type == HUB_TYPE_STANDALONE); + } + + } + } + + // Administration options + SiLoadHubAdminOptions(h, CfgGetFolder(f, "AdminOption")); + + // Database + if (h->Cedar->Bridge == false) + { + SiLoadHubDb(h, CfgGetFolder(f, "SecurityAccountDatabase")); + } + + // Usage status + h->LastCommTime = CfgGetInt64(f, "LastCommTime"); + if (h->LastCommTime == 0) + { + h->LastCommTime = SystemTime64(); + } + h->LastLoginTime = CfgGetInt64(f, "LastLoginTime"); + if (h->LastLoginTime == 0) + { + h->LastLoginTime = SystemTime64(); + } + h->CreatedTime = CfgGetInt64(f, "CreatedTime"); + h->NumLogin = CfgGetInt(f, "NumLogin"); + + // Start the operation of the HUB + AddHub(c, h); + + if (online) + { + h->Offline = true; + SetHubOnline(h); + } + else + { + h->Offline = false; + SetHubOffline(h); + } + + WaitLogFlush(h->SecurityLogger); + WaitLogFlush(h->PacketLogger); + + ReleaseHub(h); + } +} + +// Read the SecureNAT configuration +void SiLoadSecureNAT(HUB *h, FOLDER *f) +{ + VH_OPTION o; + // Validate arguments + if (h == NULL || f == NULL) + { + return; + } + + // Read the VH_OPTION + NiLoadVhOptionEx(&o, f); + + // Set the VH_OPTION + Copy(h->SecureNATOption, &o, sizeof(VH_OPTION)); + + EnableSecureNAT(h, CfgGetBool(f, "Disabled") ? false : true); +} + +// Read the virtual layer 3 switch settings +void SiLoadL3SwitchCfg(L3SW *sw, FOLDER *f) +{ + UINT i; + FOLDER *if_folder, *table_folder; + TOKEN_LIST *t; + bool active = false; + // Validate arguments + if (sw == NULL || f == NULL) + { + return; + } + + active = CfgGetBool(f, "Active"); + + // Interface list + if_folder = CfgGetFolder(f, "InterfaceList"); + if (if_folder != NULL) + { + t = CfgEnumFolderToTokenList(if_folder); + if (t != NULL) + { + for (i = 0;i < t->NumTokens;i++) + { + FOLDER *ff = CfgGetFolder(if_folder, t->Token[i]); + char name[MAX_HUBNAME_LEN + 1]; + UINT ip, subnet; + + CfgGetStr(ff, "HubName", name, sizeof(name)); + ip = CfgGetIp32(ff, "IpAddress"); + subnet = CfgGetIp32(ff, "SubnetMask"); + + { + L3AddIf(sw, name, ip, subnet); + } + } + FreeToken(t); + } + } + + // Routing table + table_folder = CfgGetFolder(f, "RoutingTable"); + if (table_folder != NULL) + { + t = CfgEnumFolderToTokenList(table_folder); + if (t != NULL) + { + for (i = 0;i < t->NumTokens;i++) + { + FOLDER *ff = CfgGetFolder(table_folder, t->Token[i]); + L3TABLE tbl; + + Zero(&tbl, sizeof(tbl)); + tbl.NetworkAddress = CfgGetIp32(ff, "NetworkAddress"); + tbl.SubnetMask = CfgGetIp32(ff, "SubnetMask"); + tbl.GatewayAddress = CfgGetIp32(ff, "GatewayAddress"); + tbl.Metric = CfgGetInt(ff, "Metric"); + + L3AddTable(sw, &tbl); + } + FreeToken(t); + } + } + + if (active) + { + L3SwStart(sw); + } +} + +// Write the virtual layer 3 switch settings +void SiWriteL3SwitchCfg(FOLDER *f, L3SW *sw) +{ + UINT i; + FOLDER *if_folder, *table_folder; + char tmp[MAX_SIZE]; + // Validate arguments + if (f == NULL || sw == NULL) + { + return; + } + + // Active flag + CfgAddBool(f, "Active", sw->Active); + + // Interface list + if_folder = CfgCreateFolder(f, "InterfaceList"); + for (i = 0;i < LIST_NUM(sw->IfList);i++) + { + L3IF *e = LIST_DATA(sw->IfList, i); + FOLDER *ff; + + Format(tmp, sizeof(tmp), "Interface%u", i); + ff = CfgCreateFolder(if_folder, tmp); + + CfgAddStr(ff, "HubName", e->HubName); + CfgAddIp32(ff, "IpAddress", e->IpAddress); + CfgAddIp32(ff, "SubnetMask", e->SubnetMask); + } + + // Routing table + table_folder = CfgCreateFolder(f, "RoutingTable"); + for (i = 0;i < LIST_NUM(sw->TableList);i++) + { + L3TABLE *e = LIST_DATA(sw->TableList, i); + FOLDER *ff; + + Format(tmp, sizeof(tmp), "Entry%u", i); + ff = CfgCreateFolder(table_folder, tmp); + + CfgAddIp32(ff, "NetworkAddress", e->NetworkAddress); + CfgAddIp32(ff, "SubnetMask", e->SubnetMask); + CfgAddIp32(ff, "GatewayAddress", e->GatewayAddress); + CfgAddInt(ff, "Metric", e->Metric); + } +} + +// Read the Virtual Layer 3 switch list +void SiLoadL3Switchs(SERVER *s, FOLDER *f) +{ + UINT i; + TOKEN_LIST *t; + CEDAR *c; + // Validate arguments + if (s == NULL || f == NULL) + { + return; + } + c = s->Cedar; + + t = CfgEnumFolderToTokenList(f); + if (t != NULL) + { + for (i = 0;i < t->NumTokens;i++) + { + char *name = t->Token[i]; + L3SW *sw = L3AddSw(c, name); + + SiLoadL3SwitchCfg(sw, CfgGetFolder(f, name)); + + ReleaseL3Sw(sw); + } + } + FreeToken(t); +} + +// Write the Virtual Layer 3 switch list +void SiWriteL3Switchs(FOLDER *f, SERVER *s) +{ + UINT i; + FOLDER *folder; + CEDAR *c; + // Validate arguments + if (f == NULL || s == NULL) + { + return; + } + c = s->Cedar; + + LockList(c->L3SwList); + { + for (i = 0;i < LIST_NUM(c->L3SwList);i++) + { + L3SW *sw = LIST_DATA(c->L3SwList, i); + + Lock(sw->lock); + { + folder = CfgCreateFolder(f, sw->Name); + + SiWriteL3SwitchCfg(folder, sw); + } + Unlock(sw->lock); + } + } + UnlockList(c->L3SwList); +} + +// Read the IPsec server configuration +void SiLoadIPsec(SERVER *s, FOLDER *f) +{ + IPSEC_SERVICES sl; + FOLDER *list_folder; + // Validate arguments + if (s == NULL || f == NULL) + { + return; + } + + Zero(&sl, sizeof(sl)); + + CfgGetStr(f, "IPsec_Secret", sl.IPsec_Secret, sizeof(sl.IPsec_Secret)); + CfgGetStr(f, "L2TP_DefaultHub", sl.L2TP_DefaultHub, sizeof(sl.L2TP_DefaultHub)); + + if (s->ServerType == SERVER_TYPE_STANDALONE) + { + // IPsec feature only be enabled on a standalone server + sl.L2TP_Raw = CfgGetBool(f, "L2TP_Raw"); + sl.L2TP_IPsec = CfgGetBool(f, "L2TP_IPsec"); + sl.EtherIP_IPsec = CfgGetBool(f, "EtherIP_IPsec"); + } + + IPsecServerSetServices(s->IPsecServer, &sl); + + list_folder = CfgGetFolder(f, "EtherIP_IDSettingsList"); + + if (list_folder != NULL) + { + TOKEN_LIST *t = CfgEnumFolderToTokenList(list_folder); + if (t != NULL) + { + UINT i; + + for (i = 0;i < t->NumTokens;i++) + { + char *name = t->Token[i]; + FOLDER *f = CfgGetFolder(list_folder, name); + + if (f != NULL) + { + ETHERIP_ID d; + BUF *b; + + Zero(&d, sizeof(d)); + + StrCpy(d.Id, sizeof(d.Id), name); + CfgGetStr(f, "HubName", d.HubName, sizeof(d.HubName)); + CfgGetStr(f, "UserName", d.UserName, sizeof(d.UserName)); + + b = CfgGetBuf(f, "EncryptedPassword"); + if (b != NULL) + { + char *pass = DecryptPassword2(b); + + StrCpy(d.Password, sizeof(d.Password), pass); + + Free(pass); + + AddEtherIPId(s->IPsecServer, &d); + + FreeBuf(b); + } + } + } + + FreeToken(t); + } + } +} + +// Write the IPsec server configuration +void SiWriteIPsec(FOLDER *f, SERVER *s) +{ + IPSEC_SERVICES sl; + FOLDER *list_folder; + UINT i; + // Validate arguments + if (s == NULL || f == NULL) + { + return; + } + + if (s->IPsecServer == NULL) + { + return; + } + + Zero(&sl, sizeof(sl)); + IPsecServerGetServices(s->IPsecServer, &sl); + + CfgAddStr(f, "IPsec_Secret", sl.IPsec_Secret); + CfgAddStr(f, "L2TP_DefaultHub", sl.L2TP_DefaultHub); + + CfgAddBool(f, "L2TP_Raw", sl.L2TP_Raw); + CfgAddBool(f, "L2TP_IPsec", sl.L2TP_IPsec); + CfgAddBool(f, "EtherIP_IPsec", sl.EtherIP_IPsec); + + list_folder = CfgCreateFolder(f, "EtherIP_IDSettingsList"); + + Lock(s->IPsecServer->LockSettings); + { + for (i = 0;i < LIST_NUM(s->IPsecServer->EtherIPIdList);i++) + { + ETHERIP_ID *d = LIST_DATA(s->IPsecServer->EtherIPIdList, i); + FOLDER *f; + BUF *b; + + f = CfgCreateFolder(list_folder, d->Id); + + CfgAddStr(f, "HubName", d->HubName); + CfgAddStr(f, "UserName", d->UserName); + + b = EncryptPassword2(d->Password); + + CfgAddBuf(f, "EncryptedPassword", b); + + FreeBuf(b); + } + } + Unlock(s->IPsecServer->LockSettings); +} + +// Write the license list +void SiWriteLicenseManager(FOLDER *f, SERVER *s) +{ +} + +// Read the license list +void SiLoadLicenseManager(SERVER *s, FOLDER *f) +{ +} + +// Write the Virtual HUB list +void SiWriteHubs(FOLDER *f, SERVER *s) +{ + UINT i; + FOLDER *hub_folder; + CEDAR *c; + UINT num; + HUB **hubs; + // Validate arguments + if (f == NULL || s == NULL) + { + return; + } + c = s->Cedar; + + LockList(c->HubList); + { + hubs = ToArray(c->HubList); + num = LIST_NUM(c->HubList); + + for (i = 0;i < num;i++) + { + AddRef(hubs[i]->ref); + } + } + UnlockList(c->HubList); + + for (i = 0;i < num;i++) + { + HUB *h = hubs[i]; + + Lock(h->lock); + { + hub_folder = CfgCreateFolder(f, h->Name); + SiWriteHubCfg(hub_folder, h); + } + Unlock(h->lock); + + ReleaseHub(h); + + if ((i % 30) == 1) + { + YieldCpu(); + } + } + + Free(hubs); +} + +// Read the Virtual HUB list +void SiLoadHubs(SERVER *s, FOLDER *f) +{ + UINT i; + FOLDER *hub_folder; + TOKEN_LIST *t; + bool b = false; + // Validate arguments + if (f == NULL || s == NULL) + { + return; + } + + t = CfgEnumFolderToTokenList(f); + for (i = 0;i < t->NumTokens;i++) + { + char *name = t->Token[i]; + + + if (s->Cedar->Bridge) + { + if (StrCmpi(name, SERVER_DEFAULT_BRIDGE_NAME) == 0) + { + // Read only the setting of Virtual HUB named "BRIDGE" + // in the case of the Bridge + b = true; + } + else + { + continue; + } + } + hub_folder = CfgGetFolder(f, name); + if (hub_folder != NULL) + { + SiLoadHubCfg(s, hub_folder, name); + } + } + FreeToken(t); + + if (s->Cedar->Bridge && b == false) + { + // If there isn't "BRIDGE" virtual HUB setting, create it newly + SiInitDefaultHubList(s); + } +} + +// Read the server-specific settings +void SiLoadServerCfg(SERVER *s, FOLDER *f) +{ + BUF *b; + CEDAR *c; + char tmp[MAX_SIZE]; + X *x = NULL; + K *k = NULL; + FOLDER *params_folder; + UINT i; + // Validate arguments + if (s == NULL || f == NULL) + { + return; + } + + // Save interval related + s->AutoSaveConfigSpan = CfgGetInt(f, "AutoSaveConfigSpan") * 1000; + if (s->AutoSaveConfigSpan == 0) + { + s->AutoSaveConfigSpan = SERVER_FILE_SAVE_INTERVAL_DEFAULT; + } + else + { + s->AutoSaveConfigSpan = MAKESURE(s->AutoSaveConfigSpan, SERVER_FILE_SAVE_INTERVAL_MIN, SERVER_FILE_SAVE_INTERVAL_MAX); + } + + i = CfgGetInt(f, "MaxConcurrentDnsClientThreads"); + if (i != 0) + { + SetGetIpThreadMaxNum(i); + } + else + { + SetGetIpThreadMaxNum(DEFAULT_GETIP_THREAD_MAX_NUM); + } + + s->DontBackupConfig = CfgGetBool(f, "DontBackupConfig"); + + CfgGetIp(f, "ListenIP", &s->ListenIP); + ProtoSetListenIP(s->Proto, &s->ListenIP); + + if (CfgIsItem(f, "BackupConfigOnlyWhenModified")) + { + s->BackupConfigOnlyWhenModified = CfgGetBool(f, "BackupConfigOnlyWhenModified"); + } + else + { + s->BackupConfigOnlyWhenModified = true; + } + + // Server log switch type + if (CfgIsItem(f, "ServerLogSwitchType")) + { + UINT st = CfgGetInt(f, "ServerLogSwitchType"); + + SetLogSwitchType(s->Logger, st); + } + + SetMaxLogSize(CfgGetInt64(f, "LoggerMaxLogSize")); + + params_folder = CfgGetFolder(f, "GlobalParams"); + SiLoadGlobalParamsCfg(params_folder); + + c = s->Cedar; + Lock(c->lock); + { + FOLDER *ff; + { + UINT i; + LIST *ports; + + // Load and set UDP ports + CfgGetStr(f, "PortsUDP", tmp, sizeof(tmp)); + NormalizeIntListStr(tmp, sizeof(tmp), tmp, true, ", "); + + ports = StrToIntList(tmp, true); + for (i = 0; i < LIST_NUM(ports); ++i) + { + AddInt(s->PortsUDP, *(UINT *)LIST_DATA(ports, i)); + } + ReleaseIntList(ports); + + ProtoSetUdpPorts(s->Proto, s->PortsUDP); + } + { + RPC_KEEP k; + + // Keep-alive related + Zero(&k, sizeof(k)); + k.UseKeepConnect = CfgGetBool(f, "UseKeepConnect"); + CfgGetStr(f, "KeepConnectHost", k.KeepConnectHost, sizeof(k.KeepConnectHost)); + k.KeepConnectPort = CfgGetInt(f, "KeepConnectPort"); + k.KeepConnectProtocol = CfgGetInt(f, "KeepConnectProtocol"); + k.KeepConnectInterval = CfgGetInt(f, "KeepConnectInterval") * 1000; + if (k.KeepConnectPort == 0) + { + k.KeepConnectPort = 80; + } + if (StrLen(k.KeepConnectHost) == 0) + { + StrCpy(k.KeepConnectHost, sizeof(k.KeepConnectHost), CLIENT_DEFAULT_KEEPALIVE_HOST); + } + if (k.KeepConnectInterval == 0) + { + k.KeepConnectInterval = KEEP_INTERVAL_DEFAULT * 1000; + } + if (k.KeepConnectInterval < 5000) + { + k.KeepConnectInterval = 5000; + } + if (k.KeepConnectInterval > 600000) + { + k.KeepConnectInterval = 600000; + } + + Lock(s->Keep->lock); + { + KEEP *keep = s->Keep; + keep->Enable = k.UseKeepConnect; + keep->Server = true; + StrCpy(keep->ServerName, sizeof(keep->ServerName), k.KeepConnectHost); + keep->ServerPort = k.KeepConnectPort; + keep->UdpMode = k.KeepConnectProtocol; + keep->Interval = k.KeepConnectInterval; + } + Unlock(s->Keep->lock); + } + + // syslog + ff = CfgGetFolder(f, "SyslogSettings"); + if (ff != NULL && GetServerCapsBool(s, "b_support_syslog")) + { + SYSLOG_SETTING set; + + Zero(&set, sizeof(set)); + + set.SaveType = CfgGetInt(ff, "SaveType"); + CfgGetStr(ff, "HostName", set.Hostname, sizeof(set.Hostname)); + set.Port = CfgGetInt(ff, "Port"); + + SiSetSysLogSetting(s, &set); + } + + // Proto + ff = CfgGetFolder(f, "Proto"); + if (ff != NULL) + { + SiLoadProtoCfg(s->Proto, ff); + } + + // Whether to disable the IPv6 listener + s->Cedar->DisableIPv6Listener = CfgGetBool(f, "DisableIPv6Listener"); + + // DoS + s->DisableDosProtection = CfgGetBool(f, "DisableDosProtection"); + + // Num Connections Per IP + SetMaxConnectionsPerIp(CfgGetInt(f, "MaxConnectionsPerIP")); + + // MaxUnestablishedConnections + SetMaxUnestablishedConnections(CfgGetInt(f, "MaxUnestablishedConnections")); + + // DeadLock + s->DisableDeadLockCheck = CfgGetBool(f, "DisableDeadLockCheck"); + + // Eraser + SetEraserCheckInterval(CfgGetInt(f, "AutoDeleteCheckIntervalSecs")); + s->Eraser = NewEraser(s->Logger, CfgGetInt64(f, "AutoDeleteCheckDiskFreeSpaceMin")); + + // WebUI + s->UseWebUI = CfgGetBool(f, "UseWebUI"); + + + // WebTimePage + s->UseWebTimePage = CfgGetBool(f, "UseWebTimePage"); + + // NoLinuxArpFilter + s->NoLinuxArpFilter = CfgGetBool(f, "NoLinuxArpFilter"); + + // NoHighPriorityProcess + s->NoHighPriorityProcess = CfgGetBool(f, "NoHighPriorityProcess"); + + // NoDebugDump + s->NoDebugDump = CfgGetBool(f, "NoDebugDump"); + if (s->NoDebugDump) + { +#ifdef OS_WIN32 + MsSetEnableMinidump(false); +#endif // OS_WIN32 + } + + // Disable the NAT-traversal feature + s->DisableNatTraversal = CfgGetBool(f, "DisableNatTraversal"); + + // Disable IPsec's aggressive mode + s->DisableIPsecAggressiveMode = CfgGetBool(f, "DisableIPsecAggressiveMode"); + + if (s->Cedar->Bridge == false) + { + // Enable the VPN-over-ICMP + if (CfgIsItem(f, "EnableVpnOverIcmp")) + { + s->EnableVpnOverIcmp = CfgGetBool(f, "EnableVpnOverIcmp"); + } + else + { + s->EnableVpnOverIcmp = false; + } + + // Enable the VPN-over-DNS + if (CfgIsItem(f, "EnableVpnOverDns")) + { + s->EnableVpnOverDns = CfgGetBool(f, "EnableVpnOverDns"); + } + else + { + s->EnableVpnOverDns = false; + } + } + + // Debug log + s->SaveDebugLog = CfgGetBool(f, "SaveDebugLog"); + if (s->SaveDebugLog) + { + s->DebugLog = NewTinyLog(); + } + + // Let the client not to send a signature + s->NoSendSignature = CfgGetBool(f, "NoSendSignature"); + + // Server certificate + b = CfgGetBuf(f, "ServerCert"); + if (b != NULL) + { + x = BufToX(b, false); + FreeBuf(b); + } + + // Server private key + b = CfgGetBuf(f, "ServerKey"); + if (b != NULL) + { + k = BufToK(b, true, false, NULL); + FreeBuf(b); + } + + if (x == NULL || k == NULL || CheckXandK(x, k) == false) + { + FreeX(x); + FreeK(k); + SiGenerateDefaultCert(&x, &k); + + SetCedarCert(c, x, k); + + FreeX(x); + FreeK(k); + } + else + { + SetCedarCert(c, x, k); + + FreeX(x); + FreeK(k); + } + + // Character which separates the username from the hub name + if (CfgGetStr(f, "UsernameHubSeparator", tmp, sizeof(tmp))) + { + c->UsernameHubSeparator = IsPrintableAsciiChar(tmp[0]) ? tmp[0] : DEFAULT_USERNAME_HUB_SEPARATOR; + } + + // Cipher Name + if (CfgGetStr(f, "CipherName", tmp, sizeof(tmp))) + { + StrUpper(tmp); + SetCedarCipherList(c, tmp); + } + + // Traffic information + Lock(c->TrafficLock); + { + SiLoadTraffic(f, "ServerTraffic", c->Traffic); + } + Unlock(c->TrafficLock); + + // Type of server + s->UpdatedServerType = s->ServerType = CfgGetInt(f, "ServerType"); + + // Password + if (CfgGetByte(f, "HashedPassword", s->HashedPassword, sizeof(s->HashedPassword)) != sizeof(s->HashedPassword)) + { + Sha0(s->HashedPassword, "", 0); + } + + if (s->ServerType != SERVER_TYPE_STANDALONE) + { + // Performance ratio of the server + s->Weight = CfgGetInt(f, "ClusterMemberWeight"); + if (s->Weight == 0) + { + s->Weight = FARM_DEFAULT_WEIGHT; + } + } + else + { + s->Weight = FARM_DEFAULT_WEIGHT; + } + + if (s->ServerType == SERVER_TYPE_FARM_CONTROLLER) + { + s->ControllerOnly = CfgGetBool(f, "ControllerOnly"); + } + + if (s->ServerType != SERVER_TYPE_STANDALONE) + { + // NAT traversal can not be used in a cluster environment + s->DisableNatTraversal = true; + } + + if (s->Cedar->Bridge) + { + // NAT traversal function can not be used in the bridge environment + s->DisableNatTraversal = true; + } + + if (CfgGetStr(f, "PortsUDP", tmp, sizeof(tmp))) + { + UINT i; + TOKEN_LIST *tokens; + LIST *ports = s->PortsUDP; + + for (i = 0; i < LIST_NUM(ports); ++i) + { + Free(LIST_DATA(ports, i)); + } + DeleteAll(ports); + + NormalizeIntListStr(tmp, sizeof(tmp), tmp, true, ", "); + + tokens = ParseTokenWithoutNullStr(tmp, ", "); + for (i = 0; i < tokens->NumTokens; ++i) + { + char *str = tokens->Token[i]; + if (IsNum(str)) + { + InsertIntDistinct(ports, ToInt(str)); + } + } + FreeToken(tokens); + } + + if (s->ServerType == SERVER_TYPE_FARM_MEMBER) + { + char tmp[6 * MAX_PUBLIC_PORT_NUM + 1]; + // Load the settings item in the case of farm members + CfgGetStr(f, "ControllerName", s->ControllerName, sizeof(s->ControllerName)); + s->ControllerPort = CfgGetInt(f, "ControllerPort"); + CfgGetByte(f, "MemberPassword", s->MemberPassword, SHA1_SIZE); + s->PublicIp = CfgGetIp32(f, "PublicIp"); + if (CfgGetStr(f, "PublicPorts", tmp, sizeof(tmp))) + { + TOKEN_LIST *t = ParseToken(tmp, ", "); + UINT i; + s->NumPublicPort = t->NumTokens; + s->PublicPorts = ZeroMalloc(s->NumPublicPort * sizeof(UINT)); + for (i = 0;i < s->NumPublicPort;i++) + { + s->PublicPorts[i] = ToInt(t->Token[i]); + } + FreeToken(t); + } + } + + // Configuration of VPN Azure Client + s->EnableVpnAzure = CfgGetBool(f, "EnableVpnAzure"); + + // Disable GetHostName when accepting TCP + s->DisableGetHostNameWhenAcceptTcp = CfgGetBool(f, "DisableGetHostNameWhenAcceptTcp"); + + if (s->DisableGetHostNameWhenAcceptTcp) + { + DisableGetHostNameWhenAcceptInit(); + } + + // Disable core dump on UNIX + s->DisableCoreDumpOnUnix = CfgGetBool(f, "DisableCoreDumpOnUnix"); + + // Disable session reconnect + SetGlobalServerFlag(GSF_DISABLE_SESSION_RECONNECT, CfgGetBool(f, "DisableSessionReconnect")); + + c->SslAcceptSettings.Tls_Disable1_0 = CfgGetBool(f, "Tls_Disable1_0"); + c->SslAcceptSettings.Tls_Disable1_1 = CfgGetBool(f, "Tls_Disable1_1"); + c->SslAcceptSettings.Tls_Disable1_2 = CfgGetBool(f, "Tls_Disable1_2"); + c->SslAcceptSettings.Tls_Disable1_3 = CfgGetBool(f, "Tls_Disable1_3"); + c->SslAcceptSettings.Override_Security_Level = CfgGetBool(f, "Override_Security_Level"); + c->SslAcceptSettings.Override_Security_Level_Value = CfgGetInt(f, "Override_Security_Level_Value"); + + s->StrictSyslogDatetimeFormat = CfgGetBool(f, "StrictSyslogDatetimeFormat"); + + // Disable JSON-RPC Web API + s->DisableJsonRpcWebApi = CfgGetBool(f, "DisableJsonRpcWebApi"); + + // Bits of Diffie-Hellman parameters + c->DhParamBits = CfgGetInt(f, "DhParamBits"); + if (c->DhParamBits == 0) + { + c->DhParamBits = DH_PARAM_BITS_DEFAULT; + } + + SetDhParam(DhNewFromBits(c->DhParamBits)); + } + Unlock(c->lock); + +#ifdef OS_UNIX + if (s->DisableCoreDumpOnUnix) + { + UnixDisableCoreDump(); + } +#endif // OS_UNIX +} + +// Load global params +void SiLoadGlobalParamsCfg(FOLDER *f) +{ + SiLoadGlobalParamItem(GP_MAX_SEND_SOCKET_QUEUE_SIZE, CfgGetInt(f, "MAX_SEND_SOCKET_QUEUE_SIZE")); + SiLoadGlobalParamItem(GP_MIN_SEND_SOCKET_QUEUE_SIZE, CfgGetInt(f, "MIN_SEND_SOCKET_QUEUE_SIZE")); + SiLoadGlobalParamItem(GP_MAX_SEND_SOCKET_QUEUE_NUM, CfgGetInt(f, "MAX_SEND_SOCKET_QUEUE_NUM")); + SiLoadGlobalParamItem(GP_SELECT_TIME, CfgGetInt(f, "SELECT_TIME")); + SiLoadGlobalParamItem(GP_SELECT_TIME_FOR_NAT, CfgGetInt(f, "SELECT_TIME_FOR_NAT")); + SiLoadGlobalParamItem(GP_MAX_STORED_QUEUE_NUM, CfgGetInt(f, "MAX_STORED_QUEUE_NUM")); + SiLoadGlobalParamItem(GP_MAX_BUFFERING_PACKET_SIZE, CfgGetInt(f, "MAX_BUFFERING_PACKET_SIZE")); + SiLoadGlobalParamItem(GP_HUB_ARP_SEND_INTERVAL, CfgGetInt(f, "HUB_ARP_SEND_INTERVAL")); + SiLoadGlobalParamItem(GP_MAC_TABLE_EXPIRE_TIME, CfgGetInt(f, "MAC_TABLE_EXPIRE_TIME")); + SiLoadGlobalParamItem(GP_IP_TABLE_EXPIRE_TIME, CfgGetInt(f, "IP_TABLE_EXPIRE_TIME")); + SiLoadGlobalParamItem(GP_IP_TABLE_EXPIRE_TIME_DHCP, CfgGetInt(f, "IP_TABLE_EXPIRE_TIME_DHCP")); + SiLoadGlobalParamItem(GP_STORM_CHECK_SPAN, CfgGetInt(f, "STORM_CHECK_SPAN")); + SiLoadGlobalParamItem(GP_STORM_DISCARD_VALUE_START, CfgGetInt(f, "STORM_DISCARD_VALUE_START")); + SiLoadGlobalParamItem(GP_STORM_DISCARD_VALUE_END, CfgGetInt(f, "STORM_DISCARD_VALUE_END")); + SiLoadGlobalParamItem(GP_MAX_MAC_TABLES, CfgGetInt(f, "MAX_MAC_TABLES")); + SiLoadGlobalParamItem(GP_MAX_IP_TABLES, CfgGetInt(f, "MAX_IP_TABLES")); + SiLoadGlobalParamItem(GP_MAX_HUB_LINKS, CfgGetInt(f, "MAX_HUB_LINKS")); + SiLoadGlobalParamItem(GP_MEM_FIFO_REALLOC_MEM_SIZE, CfgGetInt(f, "MEM_FIFO_REALLOC_MEM_SIZE")); + SiLoadGlobalParamItem(GP_QUEUE_BUDGET, CfgGetInt(f, "QUEUE_BUDGET")); + SiLoadGlobalParamItem(GP_FIFO_BUDGET, CfgGetInt(f, "FIFO_BUDGET")); + + SetFifoCurrentReallocMemSize(MEM_FIFO_REALLOC_MEM_SIZE); +} + +// Load global param itesm +void SiLoadGlobalParamItem(UINT id, UINT value) +{ + // Validate arguments + if (id == 0) + { + return; + } + + vpn_global_parameters[id] = value; +} + +// Write global params +void SiWriteGlobalParamsCfg(FOLDER *f) +{ + // Validate arguments + if (f == NULL) + { + return; + } + + CfgAddInt(f, "MAX_SEND_SOCKET_QUEUE_SIZE", MAX_SEND_SOCKET_QUEUE_SIZE); + CfgAddInt(f, "MIN_SEND_SOCKET_QUEUE_SIZE", MIN_SEND_SOCKET_QUEUE_SIZE); + CfgAddInt(f, "MAX_SEND_SOCKET_QUEUE_NUM", MAX_SEND_SOCKET_QUEUE_NUM); + CfgAddInt(f, "SELECT_TIME", SELECT_TIME); + CfgAddInt(f, "SELECT_TIME_FOR_NAT", SELECT_TIME_FOR_NAT); + CfgAddInt(f, "MAX_STORED_QUEUE_NUM", MAX_STORED_QUEUE_NUM); + CfgAddInt(f, "MAX_BUFFERING_PACKET_SIZE", MAX_BUFFERING_PACKET_SIZE); + CfgAddInt(f, "HUB_ARP_SEND_INTERVAL", HUB_ARP_SEND_INTERVAL); + CfgAddInt(f, "MAC_TABLE_EXPIRE_TIME", MAC_TABLE_EXPIRE_TIME); + CfgAddInt(f, "IP_TABLE_EXPIRE_TIME", IP_TABLE_EXPIRE_TIME); + CfgAddInt(f, "IP_TABLE_EXPIRE_TIME_DHCP", IP_TABLE_EXPIRE_TIME_DHCP); + CfgAddInt(f, "STORM_CHECK_SPAN", STORM_CHECK_SPAN); + CfgAddInt(f, "STORM_DISCARD_VALUE_START", STORM_DISCARD_VALUE_START); + CfgAddInt(f, "STORM_DISCARD_VALUE_END", STORM_DISCARD_VALUE_END); + CfgAddInt(f, "MAX_MAC_TABLES", MAX_MAC_TABLES); + CfgAddInt(f, "MAX_IP_TABLES", MAX_IP_TABLES); + CfgAddInt(f, "MAX_HUB_LINKS", MAX_HUB_LINKS); + CfgAddInt(f, "MEM_FIFO_REALLOC_MEM_SIZE", MEM_FIFO_REALLOC_MEM_SIZE); + CfgAddInt(f, "QUEUE_BUDGET", QUEUE_BUDGET); + CfgAddInt(f, "FIFO_BUDGET", FIFO_BUDGET); +} + +// Write the server-specific settings +void SiWriteServerCfg(FOLDER *f, SERVER *s) +{ + BUF *b; + CEDAR *c; + FOLDER *params_folder; + // Validate arguments + if (f == NULL || s == NULL) + { + return; + } + + CfgAddInt(f, "MaxConcurrentDnsClientThreads", GetGetIpThreadMaxNum()); + + CfgAddInt(f, "CurrentBuild", s->Cedar->Build); + + CfgAddInt(f, "AutoSaveConfigSpan", s->AutoSaveConfigSpanSaved / 1000); + + CfgAddBool(f, "DontBackupConfig", s->DontBackupConfig); + CfgAddBool(f, "BackupConfigOnlyWhenModified", s->BackupConfigOnlyWhenModified); + + CfgAddIp(f, "ListenIP", &s->ListenIP); + + { + char str[MAX_SIZE]; + IntListToStr(str, sizeof(str), s->PortsUDP, ", "); + CfgAddStr(f, "PortsUDP", str); + } + + if (s->Logger != NULL) + { + CfgAddInt(f, "ServerLogSwitchType", s->Logger->SwitchType); + } + + CfgAddInt64(f, "LoggerMaxLogSize", GetMaxLogSize()); + + params_folder = CfgCreateFolder(f, "GlobalParams"); + + if (params_folder != NULL) + { + SiWriteGlobalParamsCfg(params_folder); + } + + c = s->Cedar; + + Lock(c->lock); + { + FOLDER *ff; + Lock(s->Keep->lock); + { + KEEP *k = s->Keep; + CfgAddBool(f, "UseKeepConnect", k->Enable); + CfgAddStr(f, "KeepConnectHost", k->ServerName); + CfgAddInt(f, "KeepConnectPort", k->ServerPort); + CfgAddInt(f, "KeepConnectProtocol", k->UdpMode); + CfgAddInt(f, "KeepConnectInterval", k->Interval / 1000); + } + Unlock(s->Keep->lock); + + // syslog + ff = CfgCreateFolder(f, "SyslogSettings"); + if (ff != NULL) + { + SYSLOG_SETTING set; + + SiGetSysLogSetting(s, &set); + + CfgAddInt(ff, "SaveType", set.SaveType); + CfgAddStr(ff, "HostName", set.Hostname); + CfgAddInt(ff, "Port", set.Port); + } + + // Proto + ff = CfgCreateFolder(f, "Proto"); + if (ff != NULL) + { + SiWriteProtoCfg(ff, s->Proto); + } + + // IPv6 listener disable setting + CfgAddBool(f, "DisableIPv6Listener", s->Cedar->DisableIPv6Listener); + + // DoS + CfgAddBool(f, "DisableDosProtection", s->DisableDosProtection); + + // MaxConnectionsPerIP + CfgAddInt(f, "MaxConnectionsPerIP", GetMaxConnectionsPerIp()); + + // MaxUnestablishedConnections + CfgAddInt(f, "MaxUnestablishedConnections", GetMaxUnestablishedConnections()); + + // DeadLock + CfgAddBool(f, "DisableDeadLockCheck", s->DisableDeadLockCheck); + + // Eraser related + CfgAddInt64(f, "AutoDeleteCheckDiskFreeSpaceMin", s->Eraser->MinFreeSpace); + CfgAddInt(f, "AutoDeleteCheckIntervalSecs", GetEraserCheckInterval()); + + // WebUI + CfgAddBool(f, "UseWebUI", s->UseWebUI); + + + // NoLinuxArpFilter + if (GetOsInfo()->OsType == OSTYPE_LINUX) + { + CfgAddBool(f, "NoLinuxArpFilter", s->NoLinuxArpFilter); + } + + // NoHighPriorityProcess + CfgAddBool(f, "NoHighPriorityProcess", s->NoHighPriorityProcess); + +#ifdef OS_WIN32 + CfgAddBool(f, "NoDebugDump", s->NoDebugDump); +#endif // OS_WIN32 + + if (s->ServerType == SERVER_TYPE_STANDALONE) + { + if (c->Bridge == false) + { + // Disable the NAT-traversal feature + CfgAddBool(f, "DisableNatTraversal", s->DisableNatTraversal); + } + } + + CfgAddBool(f, "DisableIPsecAggressiveMode", s->DisableIPsecAggressiveMode); + + if (c->Bridge == false) + { + // VPN over ICMP + CfgAddBool(f, "EnableVpnOverIcmp", s->EnableVpnOverIcmp); + + // VPN over DNS + CfgAddBool(f, "EnableVpnOverDns", s->EnableVpnOverDns); + } + + // WebTimePage + CfgAddBool(f, "UseWebTimePage", s->UseWebTimePage); + + // Debug log + CfgAddBool(f, "SaveDebugLog", s->SaveDebugLog); + + // Let the client not to send a signature + CfgAddBool(f, "NoSendSignature", s->NoSendSignature); + + // Server certificate + b = XToBuf(c->ServerX, false); + CfgAddBuf(f, "ServerCert", b); + FreeBuf(b); + + // Server private key + b = KToBuf(c->ServerK, false, NULL); + CfgAddBuf(f, "ServerKey", b); + FreeBuf(b); + + { + // Character which separates the username from the hub name + char str[2]; + StrCpy(str, sizeof(str), &c->UsernameHubSeparator); + CfgAddStr(f, "UsernameHubSeparator", str); + } + + // Traffic information + Lock(c->TrafficLock); + { + SiWriteTraffic(f, "ServerTraffic", c->Traffic); + } + Unlock(c->TrafficLock); + + // Type of server + if (s->Cedar->Bridge == false) + { + CfgAddInt(f, "ServerType", s->UpdatedServerType); + } + + // Cipher Name + CfgAddStr(f, "CipherName", s->Cedar->CipherList); + + // Password + CfgAddByte(f, "HashedPassword", s->HashedPassword, sizeof(s->HashedPassword)); + + if (s->UpdatedServerType == SERVER_TYPE_FARM_MEMBER) + { + char tmp[6 * MAX_PUBLIC_PORT_NUM + 1]; + UINT i; + // Setting items in the case of farm members + CfgAddStr(f, "ControllerName", s->ControllerName); + CfgAddInt(f, "ControllerPort", s->ControllerPort); + CfgAddByte(f, "MemberPassword", s->MemberPassword, SHA1_SIZE); + CfgAddIp32(f, "PublicIp", s->PublicIp); + tmp[0] = 0; + for (i = 0;i < s->NumPublicPort;i++) + { + char tmp2[MAX_SIZE]; + ToStr(tmp2, s->PublicPorts[i]); + StrCat(tmp, sizeof(tmp), tmp2); + StrCat(tmp, sizeof(tmp), ","); + } + if (StrLen(tmp) >= 1) + { + if (tmp[StrLen(tmp) - 1] == ',') + { + tmp[StrLen(tmp) - 1] = 0; + } + } + CfgAddStr(f, "PublicPorts", tmp); + } + + if (s->UpdatedServerType != SERVER_TYPE_STANDALONE) + { + CfgAddInt(f, "ClusterMemberWeight", s->Weight); + } + + if (s->UpdatedServerType == SERVER_TYPE_FARM_CONTROLLER) + { + CfgAddBool(f, "ControllerOnly", s->ControllerOnly); + } + + // VPN Azure Client + if (s->AzureClient != NULL) + { + CfgAddBool(f, "EnableVpnAzure", s->EnableVpnAzure); + } + + CfgAddBool(f, "DisableGetHostNameWhenAcceptTcp", s->DisableGetHostNameWhenAcceptTcp); + CfgAddBool(f, "DisableCoreDumpOnUnix", s->DisableCoreDumpOnUnix); + + CfgAddBool(f, "Tls_Disable1_0", c->SslAcceptSettings.Tls_Disable1_0); + CfgAddBool(f, "Tls_Disable1_1", c->SslAcceptSettings.Tls_Disable1_1); + CfgAddBool(f, "Tls_Disable1_2", c->SslAcceptSettings.Tls_Disable1_2); + CfgAddBool(f, "Tls_Disable1_3", c->SslAcceptSettings.Tls_Disable1_3); + CfgAddBool(f, "Override_Security_Level", c->SslAcceptSettings.Override_Security_Level); + CfgAddInt(f, "Override_Security_Level_Value", c->SslAcceptSettings.Override_Security_Level_Value); + CfgAddInt(f, "DhParamBits", c->DhParamBits); + + // Disable session reconnect + CfgAddBool(f, "DisableSessionReconnect", GetGlobalServerFlag(GSF_DISABLE_SESSION_RECONNECT)); + + CfgAddBool(f, "StrictSyslogDatetimeFormat", s->StrictSyslogDatetimeFormat); + + // Disable JSON-RPC Web API + CfgAddBool(f, "DisableJsonRpcWebApi", s->DisableJsonRpcWebApi); + } + Unlock(c->lock); +} + +void SiLoadProtoCfg(PROTO *p, FOLDER *f) +{ + UINT i; + + if (p == NULL || f == NULL) + { + return; + } + + for (i = 0; i < LIST_NUM(p->Containers); ++i) + { + UINT j; + const PROTO_CONTAINER *container = LIST_DATA(p->Containers, i); + LIST *options = container->Options; + FOLDER *ff = CfgGetFolder(f, container->Name); + if (ff == NULL) + { + continue; + } + + LockList(options); + + for (j = 0; j < LIST_NUM(options); ++j) + { + PROTO_OPTION *option = LIST_DATA(options, j); + switch (option->Type) + { + case PROTO_OPTION_BOOL: + option->Bool = CfgGetBool(ff, option->Name); + break; + case PROTO_OPTION_STRING: + { + UINT size; + char buf[MAX_SIZE]; + if (CfgGetStr(ff, option->Name, buf, sizeof(buf)) == false) + { + continue; + } + + size = StrLen(buf) + 1; + option->String = ReAlloc(option->String, size); + StrCpy(option->String, size, buf); + + break; + } + default: + Debug("SiLoadProtoCfg(): unhandled option type %u!\n", option->Type); + } + } + + UnlockList(options); + } +} + +void SiWriteProtoCfg(FOLDER *f, PROTO *p) +{ + UINT i; + + if (f == NULL || p == NULL) + { + return; + } + + for (i = 0; i < LIST_NUM(p->Containers); ++i) + { + UINT j; + const PROTO_CONTAINER *container = LIST_DATA(p->Containers, i); + LIST *options = container->Options; + FOLDER *ff = CfgCreateFolder(f, container->Name); + + LockList(options); + + for (j = 0; j < LIST_NUM(options); ++j) + { + const PROTO_OPTION *option = LIST_DATA(options, j); + switch (option->Type) + { + case PROTO_OPTION_BOOL: + CfgAddBool(ff, option->Name, option->Bool); + break; + case PROTO_OPTION_STRING: + CfgAddStr(ff, option->Name, option->String); + break; + default: + Debug("SiWriteProtoCfg(): unhandled option type %u!\n", option->Type); + } + } + + UnlockList(options); + } +} + +// Read the traffic information +void SiLoadTraffic(FOLDER *parent, char *name, TRAFFIC *t) +{ + FOLDER *f; + // Validate arguments + if (t != NULL) + { + Zero(t, sizeof(TRAFFIC)); + } + if (parent == NULL || name == NULL || t == NULL) + { + return; + } + + f = CfgGetFolder(parent, name); + + if (f == NULL) + { + return; + } + + SiLoadTrafficInner(f, "SendTraffic", &t->Send); + SiLoadTrafficInner(f, "RecvTraffic", &t->Recv); +} +void SiLoadTrafficInner(FOLDER *parent, char *name, TRAFFIC_ENTRY *e) +{ + FOLDER *f; + // Validate arguments + if (e != NULL) + { + Zero(e, sizeof(TRAFFIC_ENTRY)); + } + if (parent == NULL || name == NULL || e == NULL) + { + return; + } + + f = CfgGetFolder(parent, name); + if (f == NULL) + { + return; + } + + e->BroadcastCount = CfgGetInt64(f, "BroadcastCount"); + e->BroadcastBytes = CfgGetInt64(f, "BroadcastBytes"); + e->UnicastCount = CfgGetInt64(f, "UnicastCount"); + e->UnicastBytes = CfgGetInt64(f, "UnicastBytes"); +} + +// Write the traffic information +void SiWriteTraffic(FOLDER *parent, char *name, TRAFFIC *t) +{ + FOLDER *f; + // Validate arguments + if (parent == NULL || name == NULL || t == NULL) + { + return; + } + + f = CfgCreateFolder(parent, name); + + SiWriteTrafficInner(f, "SendTraffic", &t->Send); + SiWriteTrafficInner(f, "RecvTraffic", &t->Recv); +} +void SiWriteTrafficInner(FOLDER *parent, char *name, TRAFFIC_ENTRY *e) +{ + FOLDER *f; + // Validate arguments + if (parent == NULL || name == NULL || e == NULL) + { + return; + } + + f = CfgCreateFolder(parent, name); + CfgAddInt64(f, "BroadcastCount", e->BroadcastCount); + CfgAddInt64(f, "BroadcastBytes", e->BroadcastBytes); + CfgAddInt64(f, "UnicastCount", e->UnicastCount); + CfgAddInt64(f, "UnicastBytes", e->UnicastBytes); +} + +// Thread for writing configuration file +void SiSaverThread(THREAD *thread, void *param) +{ + SERVER *s = (SERVER *)param; + // Validate arguments + if (thread == NULL || param == NULL) + { + return; + } + + while (s->Halt == false) + { + // Save to the configuration file + if (s->NoMoreSave == false) + { + SiWriteConfigurationFile(s); + } + + Wait(s->SaveHaltEvent, s->AutoSaveConfigSpan); + } +} + +// Write to the configuration file +UINT SiWriteConfigurationFile(SERVER *s) +{ + UINT ret; + // Validate arguments + if (s == NULL) + { + return 0; + } + + if (s->CfgRw == NULL) + { + return 0; + } + + if (s->NoMoreSave) + { + return 0; + } + + Lock(s->SaveCfgLock); + { + FOLDER *f; + + Debug("save: SiWriteConfigurationToCfg() start.\n"); + f = SiWriteConfigurationToCfg(s); + Debug("save: SiWriteConfigurationToCfg() finished.\n"); + + Debug("save: SaveCfgRw() start.\n"); + ret = SaveCfgRwEx(s->CfgRw, f, s->BackupConfigOnlyWhenModified ? s->ConfigRevision : INFINITE); + Debug("save: SaveCfgRw() finished.\n"); + + Debug("save: CfgDeleteFolder() start.\n"); + CfgDeleteFolder(f); + Debug("save: CfgDeleteFolder() finished.\n"); + } + Unlock(s->SaveCfgLock); + + return ret; +} + +// Release the configuration +void SiFreeConfiguration(SERVER *s) +{ + // Validate arguments + if (s == NULL) + { + return; + } + + // Write to the configuration file + SiWriteConfigurationFile(s); + + // Terminate the configuration file saving thread + s->NoMoreSave = true; + s->Halt = true; + Set(s->SaveHaltEvent); + WaitThread(s->SaveThread, INFINITE); + + ReleaseEvent(s->SaveHaltEvent); + ReleaseThread(s->SaveThread); + + s->SaveHaltEvent = NULL; + s->SaveThread = NULL; + + // Stop the protocols handler + if (s->Proto != NULL) + { + ProtoDelete(s->Proto); + } + + // Stop the IPsec server + if (s->IPsecServer != NULL) + { + FreeIPsecServer(s->IPsecServer); + s->IPsecServer = NULL; + } + + // Terminate the DDNS client + if (s->DDnsClient != NULL) + { + FreeDDNSClient(s->DDnsClient); + s->DDnsClient = NULL; + } + + // Terminate the VPN Azure client + if (s->AzureClient != NULL) + { + FreeAzureClient(s->AzureClient); + s->AzureClient = NULL; + } + + FreeCfgRw(s->CfgRw); + s->CfgRw = NULL; + + // Release the Ethernet + FreeEth(); +} + +// Initialize the StXxx related function +void StInit() +{ + if (server_lock != NULL) + { + return; + } + + server_lock = NewLock(); +} + +// Release the StXxx related function +void StFree() +{ + DeleteLock(server_lock); + server_lock = NULL; +} + +// Start the server +void StStartServer(bool bridge) +{ + Lock(server_lock); + { + if (server != NULL) + { + // It has already started + Unlock(server_lock); + return; + } + + // Create a server + server = SiNewServer(bridge); + } + Unlock(server_lock); + +// StartCedarLog(); +} + +// Stop the server +void StStopServer() +{ + Lock(server_lock); + { + if (server == NULL) + { + // Not started + Unlock(server_lock); + return; + } + + // Release the server + SiReleaseServer(server); + server = NULL; + } + Unlock(server_lock); + + StopCedarLog(); +} + +// Set the type of server +void SiSetServerType(SERVER *s, UINT type, + UINT ip, UINT num_port, UINT *ports, + char *controller_name, UINT controller_port, UCHAR *password, UINT weight, bool controller_only) +{ + bool bridge; + // Validate arguments + if (s == NULL) + { + return; + } + if (type == SERVER_TYPE_FARM_MEMBER && + (num_port == 0 || ports == NULL || controller_name == NULL || + controller_port == 0 || password == NULL || num_port > MAX_PUBLIC_PORT_NUM)) + { + return; + } + if (weight == 0) + { + weight = FARM_DEFAULT_WEIGHT; + } + + bridge = s->Cedar->Bridge; + + Lock(s->lock); + { + // Update types + s->UpdatedServerType = type; + + s->Weight = weight; + + // Set the value + if (type == SERVER_TYPE_FARM_MEMBER) + { + StrCpy(s->ControllerName, sizeof(s->ControllerName), controller_name); + s->ControllerPort = controller_port; + if (IsZero(password, SHA1_SIZE) == false) + { + Copy(s->MemberPassword, password, SHA1_SIZE); + } + s->PublicIp = ip; + s->NumPublicPort = num_port; + if (s->PublicPorts != NULL) + { + Free(s->PublicPorts); + } + s->PublicPorts = ZeroMalloc(num_port * sizeof(UINT)); + Copy(s->PublicPorts, ports, num_port * sizeof(UINT)); + } + + if (type == SERVER_TYPE_FARM_CONTROLLER) + { + s->ControllerOnly = controller_only; + } + } + Unlock(s->lock); + + // Restart the server + SiRebootServer(bridge); +} + +// Thread to restart the server +void SiRebootServerThread(THREAD *thread, void *param) +{ + // Validate arguments + if (thread == NULL) + { + return; + } + + if (server == NULL) + { + return; + } + + // Stop the server + StStopServer(); + + // Start the server + StStartServer((bool)param); +} + +// Restart the server +void SiRebootServer(bool bridge) +{ + SiRebootServerEx(bridge, false); +} +void SiRebootServerEx(bool bridge, bool reset_setting) +{ + THREAD *t; + + server_reset_setting = reset_setting; + + t = NewThread(SiRebootServerThread, (void *)bridge); + ReleaseThread(t); +} + +// Set the state of the special listener +void SiApplySpecialListenerStatus(SERVER *s) +{ + // Validate arguments + if (s == NULL) + { + return; + } + + if (s->DynListenerDns != NULL) + { + *s->DynListenerDns->EnablePtr = s->EnableVpnOverDns; + ApplyDynamicListener(s->DynListenerDns); + } + + if (s->DynListenerIcmp != NULL) + { + *s->DynListenerIcmp->EnablePtr = s->EnableVpnOverIcmp; + ApplyDynamicListener(s->DynListenerIcmp); + } +} + +// Stop all listeners +void SiStopAllListener(SERVER *s) +{ + // Validate arguments + if (s == NULL) + { + return; + } + + SiLockListenerList(s); + { + UINT i; + LIST *o = NewListFast(NULL); + for (i = 0;i < LIST_NUM(s->ServerListenerList);i++) + { + SERVER_LISTENER *e = LIST_DATA(s->ServerListenerList, i); + Add(o, e); + } + + for (i = 0;i < LIST_NUM(o);i++) + { + SERVER_LISTENER *e = LIST_DATA(o, i); + SiDeleteListener(s, e->Port); + } + + ReleaseList(o); + } + SiUnlockListenerList(s); + + ReleaseList(s->ServerListenerList); + + // Stop the VPN over ICMP listener + FreeDynamicListener(s->DynListenerIcmp); + s->DynListenerIcmp = NULL; + + // Stop the VPN over DNS listener + FreeDynamicListener(s->DynListenerDns); + s->DynListenerDns = NULL; +} + +// Clean-up the server +void SiCleanupServer(SERVER *s) +{ + UINT i; + CEDAR *c; + LISTENER **listener_list; + UINT num_listener; + HUB **hub_list; + UINT num_hub; + // Validate arguments + if (s == NULL) + { + return; + } + + SiFreeDeadLockCheck(s); + + + c = s->Cedar; + + if (s->ServerType == SERVER_TYPE_FARM_MEMBER) + { + // In the case of farm members, stop the connection to the farm controller + SLog(c, "LS_STOP_FARM_MEMBER"); + SiStopConnectToController(s->FarmController); + s->FarmController = NULL; + SLog(c, "LS_STOP_FARM_MEMBER_2"); + } + + IncrementServerConfigRevision(s); + + SLog(c, "LS_END_2"); + + SLog(c, "LS_STOP_ALL_LISTENER"); + // Stop all listeners + LockList(c->ListenerList); + { + listener_list = ToArray(c->ListenerList); + num_listener = LIST_NUM(c->ListenerList); + for (i = 0;i < num_listener;i++) + { + AddRef(listener_list[i]->ref); + } + } + UnlockList(c->ListenerList); + + for (i = 0;i < num_listener;i++) + { + StopListener(listener_list[i]); + ReleaseListener(listener_list[i]); + } + Free(listener_list); + SLog(c, "LS_STOP_ALL_LISTENER_2"); + + SLog(c, "LS_STOP_ALL_HUB"); + // Stop all HUBs + LockList(c->HubList); + { + hub_list = ToArray(c->HubList); + num_hub = LIST_NUM(c->HubList); + for (i = 0;i < num_hub;i++) + { + AddRef(hub_list[i]->ref); + } + } + UnlockList(c->HubList); + + for (i = 0;i < num_hub;i++) + { + StopHub(hub_list[i]); + ReleaseHub(hub_list[i]); + } + Free(hub_list); + SLog(c, "LS_STOP_ALL_HUB_2"); + + // Release the configuration + SiFreeConfiguration(s); + + // Stop the Cedar + SLog(c, "LS_STOP_CEDAR"); + StopCedar(s->Cedar); + SLog(c, "LS_STOP_CEDAR_2"); + + // Stop all listeners + SiStopAllListener(s); + + ReleaseIntList(s->PortsUDP); + + if (s->ServerType == SERVER_TYPE_FARM_CONTROLLER) + { + // In the case of farm controller + UINT i; + + SLog(c, "LS_STOP_FARM_CONTROL"); + + // Stop the farm controling + SiStopFarmControl(s); + + // Release the farm member information + ReleaseList(s->FarmMemberList); + s->FarmMemberList = NULL; + + for (i = 0;i < LIST_NUM(s->Me->HubList);i++) + { + Free(LIST_DATA(s->Me->HubList, i)); + } + ReleaseList(s->Me->HubList); + + Free(s->Me); + + SLog(c, "LS_STOP_FARM_CONTROL_2"); + } + + if (s->PublicPorts != NULL) + { + Free(s->PublicPorts); + } + + SLog(s->Cedar, "LS_END_1"); + SLog(s->Cedar, "L_LINE"); + +#ifdef ENABLE_AZURE_SERVER + if (s->AzureServer != NULL) + { + FreeAzureServer(s->AzureServer); + } +#endif // ENABLE_AZURE_SERVER + + ReleaseCedar(s->Cedar); + DeleteLock(s->lock); + DeleteLock(s->SaveCfgLock); + + StopKeep(s->Keep); + + FreeEraser(s->Eraser); + + + FreeLog(s->Logger); + + FreeSysLog(s->Syslog); + DeleteLock(s->SyslogLock); + + FreeServerCapsCache(s); + + SiFreeHubCreateHistory(s); + + // Stop the debug log + FreeTinyLog(s->DebugLog); + + DeleteLock(s->TasksFromFarmControllerLock); + DeleteLock(s->OpenVpnSstpConfigLock); + + + Free(s); +} + +// Release the server +void SiReleaseServer(SERVER *s) +{ + // Validate arguments + if (s == NULL) + { + return; + } + + if (Release(s->ref) == 0) + { + SiCleanupServer(s); + } +} + +// Get the URL of the member selector +bool SiGetMemberSelectorUrl(char *url, UINT url_size) +{ + BUF *b; + bool ret = false; + // Validate arguments + if (url == NULL) + { + return false; + } + + b = ReadDump(MEMBER_SELECTOR_TXT_FILENAME); + if (b == NULL) + { + return false; + } + + while (true) + { + char *line = CfgReadNextLine(b); + if (line == NULL) + { + break; + } + + Trim(line); + + if (IsEmptyStr(line) == false && ret == false) + { + StrCpy(url, url_size, line); + ret = true; + } + + Free(line); + } + + FreeBuf(b); + + return ret; +} + +// Specify the farm member for the next processing +FARM_MEMBER *SiGetNextFarmMember(SERVER *s, CONNECTION *c, HUB *h) +{ + UINT i, num; + UINT min_point = 0; + FARM_MEMBER *ret = NULL; + PACK *p; + char url[MAX_SIZE]; + // Validate arguments + if (s == NULL || s->ServerType != SERVER_TYPE_FARM_CONTROLLER || c == NULL || h == NULL) + { + return NULL; + } + + num = LIST_NUM(s->FarmMemberList); + if (num == 0) + { + return NULL; + } + + if (SiGetMemberSelectorUrl(url, sizeof(url))) + { + UINT64 ret_key = 0; + // Generate the data for the member selector + p = NewPack(); + for (i = 0;i < num;i++) + { + UINT num_sessions; + UINT max_sessions; + FARM_MEMBER *f = LIST_DATA(s->FarmMemberList, i); + bool do_not_select = false; + if (s->ControllerOnly) + { + if (f->Me) + { + // No to select myself in the case of ControllerOnly + do_not_select = true; + } + } + + if (f->Me == false) + { + num_sessions = f->NumSessions; + max_sessions = f->MaxSessions; + } + else + { + num_sessions = Count(s->Cedar->CurrentSessions); + max_sessions = GetServerCapsInt(s, "i_max_sessions"); + } + + if (max_sessions == 0) + { + max_sessions = GetServerCapsInt(s, "i_max_sessions"); + } + + if (num_sessions >= max_sessions) + { + do_not_select = true; + } + + if (true) + { + UINT point = f->Point; + char public_ip_str[MAX_SIZE]; + + IPToStr32(public_ip_str, sizeof(public_ip_str), f->Ip); + + PackAddIntEx(p, "Point", point, i, num); + PackAddInt64Ex(p, "Key", (UINT64)f, i, num); + PackAddStrEx(p, "Hostname", f->hostname, i, num); + PackAddStrEx(p, "PublicIp", public_ip_str, i, num); + PackAddIntEx(p, "NumSessions", num_sessions, i, num); + PackAddIntEx(p, "MaxSessions", max_sessions, i, num); + PackAddIntEx(p, "AssignedClientLicense", f->AssignedClientLicense, i, num); + PackAddIntEx(p, "AssignedBridgeLicense", f->AssignedBridgeLicense, i, num); + PackAddIntEx(p, "Weight", f->Weight, i, num); + PackAddDataEx(p, "RandomKey", f->RandomKey, SHA1_SIZE, i, num); + PackAddIntEx(p, "NumTcpConnections", f->NumTcpConnections, i, num); + PackAddIntEx(p, "NumHubs", LIST_NUM(f->HubList), i, num); + PackAddBoolEx(p, "Me", f->Me, i, num); + PackAddTime64Ex(p, "ConnectedTime", f->ConnectedTime, i, num); + PackAddInt64Ex(p, "SystemId", f->SystemId, i, num); + PackAddBoolEx(p, "DoNotSelect", do_not_select, i, num); + } + } + + if (true) + { + char client_ip_str[MAX_SIZE]; + UINT client_port = 0; + UINT server_port = 0; + SOCK *s = c->FirstSock; + + Zero(client_ip_str, sizeof(client_ip_str)); + if (s != NULL) + { + IPToStr(client_ip_str, sizeof(client_ip_str), &s->RemoteIP); + client_port = s->RemotePort; + server_port = s->LocalPort; + } + + PackAddStr(p, "ClientIp", client_ip_str); + PackAddInt(p, "ClientPort", client_port); + PackAddInt(p, "ServerPort", server_port); + + PackAddInt(p, "ClientBuild", c->ClientBuild); + PackAddStr(p, "CipherName", c->CipherName); + PackAddStr(p, "ClientStr", c->ClientStr); + PackAddInt(p, "ClientVer", c->ClientVer); + PackAddTime64(p, "ConnectedTime", Tick64ToTime64(c->ConnectedTick)); + + PackAddStr(p, "HubName", h->Name); + PackAddBool(p, "StaticHub", h->Type == HUB_TYPE_FARM_STATIC); + } + + PackAddInt(p, "NumMembers", num); + + // Make the member selector choose a member + UnlockList(s->FarmMemberList); + Unlock(s->Cedar->CedarSuperLock); + { + PACK *ret; + + Debug("Calling %s ...\n", url); + + ret = WpcCall(url, NULL, MEMBER_SELECTOR_CONNECT_TIMEOUT, MEMBER_SELECTOR_DATA_TIMEOUT, + "Select", p, NULL, NULL, NULL); + + if (GetErrorFromPack(ret) == ERR_NO_ERROR) + { + ret_key = PackGetInt64(ret, "Key"); + Debug("Ret Key = %I64u\n", ret_key); + } + else + { + Debug("Error: %u\n", GetErrorFromPack(ret)); + } + + FreePack(ret); + } + Lock(s->Cedar->CedarSuperLock); + LockList(s->FarmMemberList); + + FreePack(p); + + if (ret_key != 0) + { + FARM_MEMBER *f = (FARM_MEMBER *)ret_key; + if (IsInList(s->FarmMemberList, f)) + { + Debug("Farm Member Selected by Selector: %s\n", f->hostname); + + return f; + } + else + { + Debug("Farm Member Key = %I64u Not Found.\n", ret_key); + } + } + else + { + // The member selector failed to select a member + return NULL; + } + } + + num = LIST_NUM(s->FarmMemberList); + if (num == 0) + { + return NULL; + } + + for (i = 0;i < num;i++) + { + UINT num_sessions; + UINT max_sessions; + FARM_MEMBER *f = LIST_DATA(s->FarmMemberList, i); + if (s->ControllerOnly) + { + if (f->Me) + { + // No to select myself in the case of ControllerOnly + continue; + } + } + + if (f->Me == false) + { + num_sessions = f->NumSessions; + max_sessions = f->MaxSessions; + } + else + { + num_sessions = Count(s->Cedar->CurrentSessions); + max_sessions = GetServerCapsInt(s, "i_max_sessions"); + } + + if (max_sessions == 0) + { + max_sessions = GetServerCapsInt(s, "i_max_sessions"); + } + + if (num_sessions < max_sessions) + { + if (f->Point >= min_point) + { + min_point = f->Point; + ret = f; + } + } + } + + return ret; +} + +// Receive a HUB enumeration directive +void SiCalledEnumHub(SERVER *s, PACK *p, PACK *req) +{ + UINT i; + CEDAR *c; + // Validate arguments + if (s == NULL || p == NULL || req == NULL) + { + return; + } + + + c = s->Cedar; + + LockList(c->HubList); + { + UINT num = LIST_NUM(c->HubList); + for (i = 0;i < num;i++) + { + HUB *h = LIST_DATA(c->HubList, i); + Lock(h->lock); + { + PackAddStrEx(p, "HubName", h->Name, i, num); + PackAddIntEx(p, "HubType", h->Type, i, num); + PackAddIntEx(p, "NumSession", Count(h->NumSessions), i, num); + + PackAddIntEx(p, "NumSessions", LIST_NUM(h->SessionList), i, num); + PackAddIntEx(p, "NumSessionsClient", Count(h->NumSessionsClient), i, num); + PackAddIntEx(p, "NumSessionsBridge", Count(h->NumSessionsBridge), i, num); + + PackAddIntEx(p, "NumMacTables", HASH_LIST_NUM(h->MacHashTable), i, num); + + PackAddIntEx(p, "NumIpTables", LIST_NUM(h->IpTable), i, num); + + PackAddTime64Ex(p, "LastCommTime", h->LastCommTime, i, num); + PackAddTime64Ex(p, "CreatedTime", h->CreatedTime, i, num); + } + Unlock(h->lock); + } + } + UnlockList(c->HubList); + + PackAddInt(p, "Point", SiGetPoint(s)); + PackAddInt(p, "NumTcpConnections", Count(s->Cedar->CurrentTcpConnections)); + PackAddInt(p, "NumTotalSessions", Count(s->Cedar->CurrentSessions)); + PackAddInt(p, "MaxSessions", GetServerCapsInt(s, "i_max_sessions")); + + PackAddInt(p, "AssignedClientLicense", Count(s->Cedar->AssignedClientLicense)); + PackAddInt(p, "AssignedBridgeLicense", Count(s->Cedar->AssignedBridgeLicense)); + + PackAddData(p, "RandomKey", s->MyRandomKey, SHA1_SIZE); + + + Lock(c->TrafficLock); + { + OutRpcTraffic(p, c->Traffic); + } + Unlock(c->TrafficLock); + + LockList(c->TrafficDiffList); + { + UINT num = LIST_NUM(c->TrafficDiffList); + UINT i; + + for (i = 0;i < num;i++) + { + TRAFFIC_DIFF *d = LIST_DATA(c->TrafficDiffList, i); + + PackAddIntEx(p, "TdType", d->Type, i, num); + PackAddStrEx(p, "TdHubName", d->HubName, i, num); + PackAddStrEx(p, "TdName", d->Name, i, num); + + OutRpcTrafficEx(&d->Traffic, p, i, num); + + Free(d->HubName); + Free(d->Name); + Free(d); + } + + DeleteAll(c->TrafficDiffList); + } + UnlockList(c->TrafficDiffList); +} + +// Receive a HUB delete directive +void SiCalledDeleteHub(SERVER *s, PACK *p) +{ + char name[MAX_SIZE]; + HUB *h; + // Validate arguments + if (s == NULL || p == NULL) + { + return; + } + + if (PackGetStr(p, "HubName", name, sizeof(name)) == false) + { + return; + } + + LockHubList(s->Cedar); + + h = GetHub(s->Cedar, name); + if (h == NULL) + { + UnlockHubList(s->Cedar); + return; + } + UnlockHubList(s->Cedar); + + SetHubOffline(h); + + LockHubList(s->Cedar); + + DelHubEx(s->Cedar, h, true); + + UnlockHubList(s->Cedar); + + ReleaseHub(h); +} + +// Receive a HUB update directive +void SiCalledUpdateHub(SERVER *s, PACK *p) +{ + char name[MAX_SIZE]; + UINT type; + HUB_OPTION o; + HUB_LOG log; + bool save_packet_log; + UINT packet_log_switch_type; + UINT packet_log_config[NUM_PACKET_LOG]; + bool save_security_log; + bool type_changed = false; + UINT security_log_switch_type; + UINT i; + HUB *h; + // Validate arguments + if (s == NULL || p == NULL) + { + return; + } + + PackGetStr(p, "HubName", name, sizeof(name)); + type = PackGetInt(p, "HubType"); + Zero(&o, sizeof(o)); + o.MaxSession = PackGetInt(p, "MaxSession"); + o.NoArpPolling = PackGetBool(p, "NoArpPolling"); + o.NoIPv6AddrPolling = PackGetBool(p, "NoIPv6AddrPolling"); + o.FilterPPPoE = PackGetBool(p, "FilterPPPoE"); + o.YieldAfterStorePacket = PackGetBool(p, "YieldAfterStorePacket"); + o.NoSpinLockForPacketDelay = PackGetBool(p, "NoSpinLockForPacketDelay"); + o.BroadcastStormDetectionThreshold = PackGetInt(p, "BroadcastStormDetectionThreshold"); + o.ClientMinimumRequiredBuild = PackGetInt(p, "ClientMinimumRequiredBuild"); + o.FixForDLinkBPDU = PackGetBool(p, "FixForDLinkBPDU"); + o.BroadcastLimiterStrictMode = PackGetBool(p, "BroadcastLimiterStrictMode"); + o.NoLookBPDUBridgeId = PackGetBool(p, "NoLookBPDUBridgeId"); + o.NoManageVlanId = PackGetBool(p, "NoManageVlanId"); + o.MaxLoggedPacketsPerMinute = PackGetInt(p, "MaxLoggedPacketsPerMinute"); + o.FloodingSendQueueBufferQuota = PackGetInt(p, "FloodingSendQueueBufferQuota"); + o.DoNotSaveHeavySecurityLogs = PackGetBool(p, "DoNotSaveHeavySecurityLogs"); + o.DropBroadcastsInPrivacyFilterMode = PackGetBool(p, "DropBroadcastsInPrivacyFilterMode"); + o.DropArpInPrivacyFilterMode = PackGetBool(p, "DropArpInPrivacyFilterMode"); + o.SuppressClientUpdateNotification = PackGetBool(p, "SuppressClientUpdateNotification"); + o.AssignVLanIdByRadiusAttribute = PackGetBool(p, "AssignVLanIdByRadiusAttribute"); + o.DenyAllRadiusLoginWithNoVlanAssign = PackGetBool(p, "DenyAllRadiusLoginWithNoVlanAssign"); + o.SecureNAT_RandomizeAssignIp = PackGetBool(p, "SecureNAT_RandomizeAssignIp"); + o.DetectDormantSessionInterval = PackGetInt(p, "DetectDormantSessionInterval"); + o.VlanTypeId = PackGetInt(p, "VlanTypeId"); + o.NoPhysicalIPOnPacketLog = PackGetBool(p, "NoPhysicalIPOnPacketLog"); + if (o.VlanTypeId == 0) + { + o.VlanTypeId = MAC_PROTO_TAGVLAN; + } + o.FilterOSPF = PackGetBool(p, "FilterOSPF"); + o.FilterIPv4 = PackGetBool(p, "FilterIPv4"); + o.FilterIPv6 = PackGetBool(p, "FilterIPv6"); + o.FilterNonIP = PackGetBool(p, "FilterNonIP"); + o.NoIPv4PacketLog = PackGetBool(p, "NoIPv4PacketLog"); + o.NoIPv6PacketLog = PackGetBool(p, "NoIPv6PacketLog"); + o.FilterBPDU = PackGetBool(p, "FilterBPDU"); + o.NoIPv6DefaultRouterInRAWhenIPv6 = PackGetBool(p, "NoIPv6DefaultRouterInRAWhenIPv6"); + o.NoMacAddressLog = PackGetBool(p, "NoMacAddressLog"); + o.ManageOnlyPrivateIP = PackGetBool(p, "ManageOnlyPrivateIP"); + o.ManageOnlyLocalUnicastIPv6 = PackGetBool(p, "ManageOnlyLocalUnicastIPv6"); + o.DisableIPParsing = PackGetBool(p, "DisableIPParsing"); + o.NoIpTable = PackGetBool(p, "NoIpTable"); + o.NoEnum = PackGetBool(p, "NoEnum"); + o.AdjustTcpMssValue = PackGetInt(p, "AdjustTcpMssValue"); + o.DisableAdjustTcpMss = PackGetBool(p, "DisableAdjustTcpMss"); + o.NoDhcpPacketLogOutsideHub = PackGetBool(p, "NoDhcpPacketLogOutsideHub"); + o.DisableHttpParsing = PackGetBool(p, "DisableHttpParsing"); + o.DisableUdpAcceleration = PackGetBool(p, "DisableUdpAcceleration"); + o.DisableUdpFilterForLocalBridgeNic = PackGetBool(p, "DisableUdpFilterForLocalBridgeNic"); + o.ApplyIPv4AccessListOnArpPacket = PackGetBool(p, "ApplyIPv4AccessListOnArpPacket"); + o.RemoveDefGwOnDhcpForLocalhost = PackGetBool(p, "RemoveDefGwOnDhcpForLocalhost"); + o.SecureNAT_MaxTcpSessionsPerIp = PackGetInt(p, "SecureNAT_MaxTcpSessionsPerIp"); + o.SecureNAT_MaxTcpSynSentPerIp = PackGetInt(p, "SecureNAT_MaxTcpSynSentPerIp"); + o.SecureNAT_MaxUdpSessionsPerIp = PackGetInt(p, "SecureNAT_MaxUdpSessionsPerIp"); + o.SecureNAT_MaxDnsSessionsPerIp = PackGetInt(p, "SecureNAT_MaxDnsSessionsPerIp"); + o.SecureNAT_MaxIcmpSessionsPerIp = PackGetInt(p, "SecureNAT_MaxIcmpSessionsPerIp"); + o.AccessListIncludeFileCacheLifetime = PackGetInt(p, "AccessListIncludeFileCacheLifetime"); + if (o.AccessListIncludeFileCacheLifetime == 0) + { + o.AccessListIncludeFileCacheLifetime = ACCESS_LIST_INCLUDE_FILE_CACHE_LIFETIME; + } + o.DisableKernelModeSecureNAT = PackGetBool(p, "DisableKernelModeSecureNAT"); + o.DisableIpRawModeSecureNAT = PackGetBool(p, "DisableIpRawModeSecureNAT"); + o.DisableUserModeSecureNAT = PackGetBool(p, "DisableUserModeSecureNAT"); + o.DisableCheckMacOnLocalBridge = PackGetBool(p, "DisableCheckMacOnLocalBridge"); + o.DisableCorrectIpOffloadChecksum = PackGetBool(p, "DisableCorrectIpOffloadChecksum"); + o.UseHubNameAsDhcpUserClassOption = PackGetBool(p, "UseHubNameAsDhcpUserClassOption"); + o.UseHubNameAsRadiusNasId = PackGetBool(p, "UseHubNameAsRadiusNasId"); + + save_packet_log = PackGetInt(p, "SavePacketLog"); + packet_log_switch_type = PackGetInt(p, "PacketLogSwitchType"); + for (i = 0;i < NUM_PACKET_LOG;i++) + { + packet_log_config[i] = PackGetIntEx(p, "PacketLogConfig", i); + } + save_security_log = PackGetInt(p, "SaveSecurityLog"); + security_log_switch_type = PackGetInt(p, "SecurityLogSwitchType"); + + Zero(&log, sizeof(log)); + log.SavePacketLog = save_packet_log; + log.PacketLogSwitchType = packet_log_switch_type; + Copy(log.PacketLogConfig, packet_log_config, sizeof(log.PacketLogConfig)); + log.SaveSecurityLog = save_security_log; + log.SecurityLogSwitchType = security_log_switch_type; + + h = GetHub(s->Cedar, name); + if (h == NULL) + { + return; + } + + h->FarmMember_MaxSessionClient = PackGetInt(p, "MaxSessionClient"); + h->FarmMember_MaxSessionBridge = PackGetInt(p, "MaxSessionBridge"); + h->FarmMember_MaxSessionClientBridgeApply = PackGetBool(p, "MaxSessionClientBridgeApply"); + + if (h->FarmMember_MaxSessionClientBridgeApply == false) + { + h->FarmMember_MaxSessionClient = INFINITE; + h->FarmMember_MaxSessionBridge = INFINITE; + } + + Lock(h->lock); + { + Copy(h->Option, &o, sizeof(HUB_OPTION)); + PackGetData2(p, "SecurePassword", h->SecurePassword, SHA1_SIZE); + PackGetData2(p, "HashedPassword", h->HashedPassword, SHA1_SIZE); + } + Unlock(h->lock); + + SetHubLogSetting(h, &log); + + if (h->Type != type) + { + h->Type = type; + type_changed = true; + } + + LockList(h->AccessList); + { + UINT i; + for (i = 0;i < LIST_NUM(h->AccessList);i++) + { + ACCESS *a = LIST_DATA(h->AccessList, i); + Free(a); + } + DeleteAll(h->AccessList); + } + UnlockList(h->AccessList); + + for (i = 0;i < SiNumAccessFromPack(p);i++) + { + ACCESS *a = SiPackToAccess(p, i); + AddAccessList(h, a); + Free(a); + } + + if (PackGetBool(p, "EnableSecureNAT")) + { + VH_OPTION t; + bool changed; + + InVhOption(&t, p); + + changed = Cmp(h->SecureNATOption, &t, sizeof(VH_OPTION)) == 0 ? false : true; + Copy(h->SecureNATOption, &t, sizeof(VH_OPTION)); + + EnableSecureNAT(h, true); + + if (changed) + { + Lock(h->lock_online); + { + if (h->SecureNAT != NULL) + { + SetVirtualHostOption(h->SecureNAT->Nat->Virtual, &t); + Debug("SiCalledUpdateHub: SecureNAT Updated.\n"); + } + } + Unlock(h->lock_online); + } + } + else + { + EnableSecureNAT(h, false); + Debug("SiCalledUpdateHub: SecureNAT Disabled.\n"); + } + + if (type_changed) + { + // Remove all sessions since the type of HUB has been changed + if (h->Offline == false) + { + SetHubOffline(h); + SetHubOnline(h); + } + } + + ReleaseHub(h); +} + +// Inspect the ticket +bool SiCheckTicket(HUB *h, UCHAR *ticket, char *username, UINT username_size, char *usernamereal, UINT usernamereal_size, POLICY *policy, char *sessionname, UINT sessionname_size, char *groupname, UINT groupname_size) +{ + bool ret = false; + // Validate arguments + if (h == NULL || ticket == NULL || username == NULL || usernamereal == NULL || policy == NULL || sessionname == NULL) + { + return false; + } + + LockList(h->TicketList); + { + UINT i; + for (i = 0;i < LIST_NUM(h->TicketList);i++) + { + TICKET *t = LIST_DATA(h->TicketList, i); + if (Cmp(t->Ticket, ticket, SHA1_SIZE) == 0) + { + ret = true; + StrCpy(username, username_size, t->Username); + StrCpy(usernamereal, usernamereal_size, t->UsernameReal); + StrCpy(sessionname, sessionname_size, t->SessionName); + StrCpy(groupname, groupname_size, t->GroupName); + Copy(policy, &t->Policy, sizeof(POLICY)); + Delete(h->TicketList, t); + Free(t); + break; + } + } + } + UnlockList(h->TicketList); + + return ret; +} + +// Receive a MAC address deletion directive +void SiCalledDeleteMacTable(SERVER *s, PACK *p) +{ + UINT key; + char hubname[MAX_HUBNAME_LEN + 1]; + HUB *h; + // Validate arguments + if (s == NULL || p == NULL) + { + return; + } + + if (PackGetStr(p, "HubName", hubname, sizeof(hubname)) == false) + { + return; + } + key = PackGetInt(p, "Key"); + + LockHubList(s->Cedar); + { + h = GetHub(s->Cedar, hubname); + } + UnlockHubList(s->Cedar); + + if (h == NULL) + { + return; + } + + LockHashList(h->MacHashTable); + { + MAC_TABLE_ENTRY *e = HashListKeyToPointer(h->MacHashTable, key); + DeleteHash(h->MacHashTable, e); + Free(e); + } + UnlockHashList(h->MacHashTable); + + ReleaseHub(h); +} + +// Receive an IP address delete directive +void SiCalledDeleteIpTable(SERVER *s, PACK *p) +{ + UINT key; + char hubname[MAX_HUBNAME_LEN + 1]; + HUB *h; + // Validate arguments + if (s == NULL || p == NULL) + { + return; + } + + if (PackGetStr(p, "HubName", hubname, sizeof(hubname)) == false) + { + return; + } + key = PackGetInt(p, "Key"); + + LockHubList(s->Cedar); + { + h = GetHub(s->Cedar, hubname); + } + UnlockHubList(s->Cedar); + + if (h == NULL) + { + return; + } + + LockList(h->IpTable); + { + if (IsInList(h->IpTable, (void *)key)) + { + IP_TABLE_ENTRY *e = (IP_TABLE_ENTRY *)key; + Delete(h->IpTable, e); + Free(e); + } + } + UnlockList(h->IpTable); + + ReleaseHub(h); +} + +// Receive a session deletion directive +void SiCalledDeleteSession(SERVER *s, PACK *p) +{ + char name[MAX_SESSION_NAME_LEN + 1]; + char hubname[MAX_HUBNAME_LEN + 1]; + HUB *h; + SESSION *sess; + // Validate arguments + if (s == NULL || p == NULL) + { + return; + } + + if (PackGetStr(p, "HubName", hubname, sizeof(hubname)) == false) + { + return; + } + if (PackGetStr(p, "SessionName", name, sizeof(name)) == false) + { + return; + } + + LockHubList(s->Cedar); + { + h = GetHub(s->Cedar, hubname); + } + UnlockHubList(s->Cedar); + + if (h == NULL) + { + return; + } + + sess = GetSessionByName(h, name); + + if (sess != NULL) + { + if (sess->BridgeMode == false && sess->LinkModeServer == false && sess->SecureNATMode == false) + { + StopSession(sess); + } + ReleaseSession(sess); + } + + ReleaseHub(h); +} + +// Receive a log file reading directive +PACK *SiCalledReadLogFile(SERVER *s, PACK *p) +{ + RPC_READ_LOG_FILE t; + PACK *ret; + char filepath[MAX_PATH]; + UINT offset; + // Validate arguments + if (s == NULL || p == NULL) + { + return NULL; + } + + PackGetStr(p, "FilePath", filepath, sizeof(filepath)); + offset = PackGetInt(p, "Offset"); + + Zero(&t, sizeof(t)); + + SiReadLocalLogFile(s, filepath, offset, &t); + + ret = NewPack(); + + OutRpcReadLogFile(ret, &t); + FreeRpcReadLogFile(&t); + + return ret; +} + +// Receive a log file enumeration directive +PACK *SiCalledEnumLogFileList(SERVER *s, PACK *p) +{ + RPC_ENUM_LOG_FILE t; + PACK *ret; + char hubname[MAX_HUBNAME_LEN + 1]; + // Validate arguments + if (s == NULL || p == NULL) + { + return NULL; + } + + PackGetStr(p, "HubName", hubname, sizeof(hubname)); + + Zero(&t, sizeof(t)); + + SiEnumLocalLogFileList(s, hubname, &t); + + ret = NewPack(); + + OutRpcEnumLogFile(ret, &t); + FreeRpcEnumLogFile(&t); + + return ret; +} + +// Receive a session information directive +PACK *SiCalledGetSessionStatus(SERVER *s, PACK *p) +{ + RPC_SESSION_STATUS t; + ADMIN a; + PACK *ret; + // Validate arguments + if (s == NULL || p == NULL) + { + return NULL; + } + + Zero(&t, sizeof(t)); + InRpcSessionStatus(&t, p); + + Zero(&a, sizeof(a)); + a.Server = s; + a.ServerAdmin = true; + + if (StGetSessionStatus(&a, &t) != ERR_NO_ERROR) + { + FreeRpcSessionStatus(&t); + return NULL; + } + + ret = NewPack(); + + OutRpcSessionStatus(ret, &t); + + FreeRpcSessionStatus(&t); + + return ret; +} + +// IP table enumeration directive +PACK *SiCalledEnumIpTable(SERVER *s, PACK *p) +{ + char hubname[MAX_HUBNAME_LEN + 1]; + RPC_ENUM_IP_TABLE t; + PACK *ret; + // Validate arguments + if (s == NULL || p == NULL) + { + return NewPack(); + } + if (PackGetStr(p, "HubName", hubname, sizeof(hubname)) == false) + { + return NewPack(); + } + Zero(&t, sizeof(t)); + + SiEnumIpTable(s, hubname, &t); + + ret = NewPack(); + OutRpcEnumIpTable(ret, &t); + FreeRpcEnumIpTable(&t); + + return ret; +} + +// MAC table enumeration directive +PACK *SiCalledEnumMacTable(SERVER *s, PACK *p) +{ + char hubname[MAX_HUBNAME_LEN + 1]; + RPC_ENUM_MAC_TABLE t; + PACK *ret; + // Validate arguments + if (s == NULL || p == NULL) + { + return NewPack(); + } + if (PackGetStr(p, "HubName", hubname, sizeof(hubname)) == false) + { + return NewPack(); + } + Zero(&t, sizeof(t)); + + SiEnumMacTable(s, hubname, &t); + + ret = NewPack(); + OutRpcEnumMacTable(ret, &t); + FreeRpcEnumMacTable(&t); + + return ret; +} + +// NAT status acquisition directive +PACK *SiCalledGetNatStatus(SERVER *s, PACK *p) +{ + char hubname[MAX_HUBNAME_LEN + 1]; + RPC_NAT_STATUS t; + PACK *ret; + HUB *h; + // Validate arguments + if (s == NULL || p == NULL) + { + return NewPack(); + } + if (PackGetStr(p, "HubName", hubname, sizeof(hubname)) == false) + { + return NewPack(); + } + Zero(&t, sizeof(t)); + + LockHubList(s->Cedar); + { + h = GetHub(s->Cedar, hubname); + } + UnlockHubList(s->Cedar); + + if (h != NULL) + { + Lock(h->lock_online); + { + if (h->SecureNAT != NULL) + { + NtGetStatus(h->SecureNAT->Nat, &t); + } + } + Unlock(h->lock_online); + } + + ReleaseHub(h); + + ret = NewPack(); + OutRpcNatStatus(ret, &t); + FreeRpcNatStatus(&t); + + return ret; +} + +// DHCP table enumeration directive +PACK *SiCalledEnumDhcp(SERVER *s, PACK *p) +{ + char hubname[MAX_HUBNAME_LEN + 1]; + RPC_ENUM_DHCP t; + PACK *ret; + HUB *h; + // Validate arguments + if (s == NULL || p == NULL) + { + return NewPack(); + } + if (PackGetStr(p, "HubName", hubname, sizeof(hubname)) == false) + { + return NewPack(); + } + Zero(&t, sizeof(t)); + + LockHubList(s->Cedar); + { + h = GetHub(s->Cedar, hubname); + } + UnlockHubList(s->Cedar); + + if (h != NULL) + { + Lock(h->lock_online); + { + if (h->SecureNAT != NULL) + { + NtEnumDhcpList(h->SecureNAT->Nat, &t); + } + } + Unlock(h->lock_online); + } + + ReleaseHub(h); + + ret = NewPack(); + OutRpcEnumDhcp(ret, &t); + FreeRpcEnumDhcp(&t); + + return ret; +} + +// NAT table enumeration directive +PACK *SiCalledEnumNat(SERVER *s, PACK *p) +{ + char hubname[MAX_HUBNAME_LEN + 1]; + RPC_ENUM_NAT t; + PACK *ret; + HUB *h; + // Validate arguments + if (s == NULL || p == NULL) + { + return NewPack(); + } + if (PackGetStr(p, "HubName", hubname, sizeof(hubname)) == false) + { + return NewPack(); + } + Zero(&t, sizeof(t)); + + LockHubList(s->Cedar); + { + h = GetHub(s->Cedar, hubname); + } + UnlockHubList(s->Cedar); + + if (h != NULL) + { + Lock(h->lock_online); + { + if (h->SecureNAT != NULL) + { + NtEnumNatList(h->SecureNAT->Nat, &t); + } + } + Unlock(h->lock_online); + } + + ReleaseHub(h); + + ret = NewPack(); + OutRpcEnumNat(ret, &t); + FreeRpcEnumNat(&t); + + return ret; +} + +// Receive a session enumeration directive +PACK *SiCalledEnumSession(SERVER *s, PACK *p) +{ + char hubname[MAX_HUBNAME_LEN + 1]; + RPC_ENUM_SESSION t; + PACK *ret; + // Validate arguments + if (s == NULL || p == NULL) + { + return NewPack(); + } + if (PackGetStr(p, "HubName", hubname, sizeof(hubname)) == false) + { + return NewPack(); + } + Zero(&t, sizeof(t)); + + SiEnumLocalSession(s, hubname, &t); + + ret = NewPack(); + OutRpcEnumSession(ret, &t); + FreeRpcEnumSession(&t); + + return ret; +} + +// Receive a ticket creation directive +PACK *SiCalledCreateTicket(SERVER *s, PACK *p) +{ + char username[MAX_SIZE]; + char hubname[MAX_SIZE]; + char groupname[MAX_SIZE]; + char realusername[MAX_SIZE]; + char sessionname[MAX_SESSION_NAME_LEN + 1]; + POLICY policy; + UCHAR ticket[SHA1_SIZE]; + char ticket_str[MAX_SIZE]; + HUB *h; + UINT i; + PACK *ret; + TICKET *t; + // Validate arguments + if (s == NULL || p == NULL) + { + return NewPack(); + } + + PackGetStr(p, "UserName", username, sizeof(username)); + PackGetStr(p, "GroupName", groupname, sizeof(groupname)); + PackGetStr(p, "HubName", hubname, sizeof(hubname)); + PackGetStr(p, "RealUserName", realusername, sizeof(realusername)); + PackGetStr(p, "SessionName", sessionname, sizeof(sessionname)); + + InRpcPolicy(&policy, p); + if (PackGetDataSize(p, "Ticket") == SHA1_SIZE) + { + PackGetData(p, "Ticket", ticket); + } + + BinToStr(ticket_str, sizeof(ticket_str), ticket, SHA1_SIZE); + + SLog(s->Cedar, "LS_TICKET_2", hubname, username, realusername, sessionname, + ticket_str, TICKET_EXPIRES / 1000); + + // Get the HUB + h = GetHub(s->Cedar, hubname); + if (h == NULL) + { + return NewPack(); + } + + LockList(h->TicketList); + { + LIST *o = NewListFast(NULL); + // Discard old tickets + for (i = 0;i < LIST_NUM(h->TicketList);i++) + { + TICKET *t = LIST_DATA(h->TicketList, i); + if ((t->CreatedTick + TICKET_EXPIRES) < Tick64()) + { + Add(o, t); + } + } + for (i = 0;i < LIST_NUM(o);i++) + { + TICKET *t = LIST_DATA(o, i); + Delete(h->TicketList, t); + Free(t); + } + ReleaseList(o); + + // Create a ticket + t = ZeroMalloc(sizeof(TICKET)); + t->CreatedTick = Tick64(); + Copy(&t->Policy, &policy, sizeof(POLICY)); + Copy(t->Ticket, ticket, SHA1_SIZE); + StrCpy(t->Username, sizeof(t->Username), username); + StrCpy(t->UsernameReal, sizeof(t->UsernameReal), realusername); + StrCpy(t->GroupName, sizeof(t->GroupName), groupname); + StrCpy(t->SessionName, sizeof(t->SessionName), sessionname); + + Add(h->TicketList, t); + } + UnlockList(h->TicketList); + + ReleaseHub(h); + + ret = NewPack(); + + PackAddInt(ret, "Point", SiGetPoint(s)); + + return ret; +} + +// Receive a HUB creation directive +void SiCalledCreateHub(SERVER *s, PACK *p) +{ + char name[MAX_SIZE]; + UINT type; + HUB_OPTION o; + HUB_LOG log; + bool save_packet_log; + UINT packet_log_switch_type; + UINT packet_log_config[NUM_PACKET_LOG]; + bool save_security_log; + UINT security_log_switch_type; + UINT i; + HUB *h; + // Validate arguments + if (s == NULL || p == NULL) + { + return; + } + + PackGetStr(p, "HubName", name, sizeof(name)); + type = PackGetInt(p, "HubType"); + Zero(&o, sizeof(o)); + o.MaxSession = PackGetInt(p, "MaxSession"); + save_packet_log = PackGetInt(p, "SavePacketLog"); + packet_log_switch_type = PackGetInt(p, "PacketLogSwitchType"); + for (i = 0;i < NUM_PACKET_LOG;i++) + { + packet_log_config[i] = PackGetIntEx(p, "PacketLogConfig", i); + } + save_security_log = PackGetInt(p, "SaveSecurityLog"); + security_log_switch_type = PackGetInt(p, "SecurityLogSwitchType"); + + Zero(&log, sizeof(log)); + log.SavePacketLog = save_packet_log; + log.PacketLogSwitchType = packet_log_switch_type; + Copy(log.PacketLogConfig, packet_log_config, sizeof(log.PacketLogConfig)); + log.SaveSecurityLog = save_security_log; + log.SecurityLogSwitchType = security_log_switch_type; + + h = NewHub(s->Cedar, name, &o); + h->LastCommTime = h->LastLoginTime = h->CreatedTime = 0; + SetHubLogSetting(h, &log); + h->Type = type; + h->FarmMember_MaxSessionClient = PackGetInt(p, "MaxSessionClient"); + h->FarmMember_MaxSessionBridge = PackGetInt(p, "MaxSessionBridge"); + h->FarmMember_MaxSessionClientBridgeApply = PackGetBool(p, "MaxSessionClientBridgeApply"); + + if (h->FarmMember_MaxSessionClientBridgeApply == false) + { + h->FarmMember_MaxSessionClient = INFINITE; + h->FarmMember_MaxSessionBridge = INFINITE; + } + + PackGetData2(p, "SecurePassword", h->SecurePassword, SHA1_SIZE); + PackGetData2(p, "HashedPassword", h->HashedPassword, SHA1_SIZE); + + for (i = 0;i < SiNumAccessFromPack(p);i++) + { + ACCESS *a = SiPackToAccess(p, i); + AddAccessList(h, a); + Free(a); + } + + if (PackGetBool(p, "EnableSecureNAT")) + { + VH_OPTION t; + + InVhOption(&t, p); + + Copy(h->SecureNATOption, &t, sizeof(VH_OPTION)); + EnableSecureNAT(h, true); + + Debug("SiCalledCreateHub: SecureNAT Created.\n"); + } + + AddHub(s->Cedar, h); + h->Offline = true; + SetHubOnline(h); + + ReleaseHub(h); +} + +// Farm control thread +void SiFarmControlThread(THREAD *thread, void *param) +{ + SERVER *s; + CEDAR *c; + EVENT *e; + LIST *o; + UINT i; + char tmp[MAX_PATH]; + // Validate arguments + if (thread == NULL || param == NULL) + { + return; + } + + s = (SERVER *)param; + c = s->Cedar; + e = s->FarmControlThreadHaltEvent; + + while (true) + { + Lock(c->CedarSuperLock); + + // Enumerate HUB list which is hosted by each farm member + Format(tmp, sizeof(tmp), "CONTROLLER: %s %u", __FILE__, __LINE__); + SiDebugLog(s, tmp); + + LockList(s->FarmMemberList); + { + UINT i; + UINT num; + UINT assigned_client_license = 0; + UINT assigned_bridge_license = 0; + LIST *fm_list = NewListFast(NULL); + + Format(tmp, sizeof(tmp), "CONTROLLER: %s %u", __FILE__, __LINE__); + SiDebugLog(s, tmp); + + num = 0; + + while (true) + { + bool escape = true; + for (i = 0;i < LIST_NUM(s->FarmMemberList);i++) + { + FARM_MEMBER *f = LIST_DATA(s->FarmMemberList, i); + + if (IsInList(fm_list, f) == false) + { + SiCallEnumHub(s, f); + // Get the total number of sessions across the server farm + num += f->NumSessions; + + assigned_client_license += f->AssignedClientLicense; + assigned_bridge_license += f->AssignedBridgeLicense; + + escape = false; + + Add(fm_list, f); + break; + } + } + + if (escape) + { + break; + } + + UnlockList(s->FarmMemberList); + LockList(s->FarmMemberList); + } + + ReleaseList(fm_list); + + s->CurrentTotalNumSessionsOnFarm = num; + + // Update the number of assigned licenses + s->CurrentAssignedBridgeLicense = assigned_bridge_license; + s->CurrentAssignedClientLicense = assigned_client_license; + + Format(tmp, sizeof(tmp), "CONTROLLER: %s %u", __FILE__, __LINE__); + SiDebugLog(s, tmp); + } + UnlockList(s->FarmMemberList); + + Format(tmp, sizeof(tmp), "CONTROLLER: %s %u", __FILE__, __LINE__); + SiDebugLog(s, tmp); + + o = NewListFast(NULL); + + Format(tmp, sizeof(tmp), "CONTROLLER: %s %u", __FILE__, __LINE__); + SiDebugLog(s, tmp); + + // Emit an update notification for each HUB + LockList(c->HubList); + { + UINT i; + for (i = 0;i < LIST_NUM(c->HubList);i++) + { + HUB *h = LIST_DATA(c->HubList, i); + AddRef(h->ref); + Add(o, h); + } + } + UnlockList(c->HubList); + + Format(tmp, sizeof(tmp), "CONTROLLER: %s %u", __FILE__, __LINE__); + SiDebugLog(s, tmp); + + for (i = 0;i < LIST_NUM(o);i++) + { + HUB *h = LIST_DATA(o, i); + SiHubUpdateProc(h); + ReleaseHub(h); + } + + Format(tmp, sizeof(tmp), "CONTROLLER: %s %u", __FILE__, __LINE__); + SiDebugLog(s, tmp); + + ReleaseList(o); + + Unlock(c->CedarSuperLock); + + Wait(e, SERVER_FARM_CONTROL_INTERVAL); + if (s->Halt) + { + break; + } + } +} + +// Start the farm controling +void SiStartFarmControl(SERVER *s) +{ + // Validate arguments + if (s == NULL || s->ServerType != SERVER_TYPE_FARM_CONTROLLER) + { + return; + } + + s->FarmControlThreadHaltEvent = NewEvent(); + s->FarmControlThread = NewThread(SiFarmControlThread, s); +} + +// Stop the farm controling +void SiStopFarmControl(SERVER *s) +{ + // Validate arguments + if (s == NULL || s->ServerType != SERVER_TYPE_FARM_CONTROLLER) + { + return; + } + + Set(s->FarmControlThreadHaltEvent); + WaitThread(s->FarmControlThread, INFINITE); + ReleaseEvent(s->FarmControlThreadHaltEvent); + ReleaseThread(s->FarmControlThread); +} + +// HUB enumeration directive +void SiCallEnumHub(SERVER *s, FARM_MEMBER *f) +{ + CEDAR *c; + // Validate arguments + if (s == NULL || f == NULL) + { + return; + } + + c = s->Cedar; + + if (f->Me) + { + + // Enumerate local HUBs + LockList(f->HubList); + { + // For a local HUB, re-enumerate by erasing all STATIC HUB list once first + UINT i; + LIST *o = NewListFast(NULL); + for (i = 0;i < LIST_NUM(f->HubList);i++) + { + HUB_LIST *h = LIST_DATA(f->HubList, i); + if (h->DynamicHub == false) + { + Add(o, h); + } + } + + // Clear all the STATIC HUB + for (i = 0;i < LIST_NUM(o);i++) + { + HUB_LIST *h = LIST_DATA(o, i); + Free(h); + Delete(f->HubList, h); + } + ReleaseList(o); + + // Second, stop DYNAMIC HUBs without user + o = NewListFast(NULL); + for (i = 0;i < LIST_NUM(f->HubList);i++) + { + HUB_LIST *h = LIST_DATA(f->HubList, i); + if (h->DynamicHub == true) + { + LockList(c->HubList); + { + HUB *hub = GetHub(s->Cedar, h->Name); + if (hub != NULL) + { + if (Count(hub->NumSessions) == 0 || hub->Type != HUB_TYPE_FARM_DYNAMIC) + { + Add(o, h); + } + ReleaseHub(hub); + } + } + UnlockList(c->HubList); + } + } + + for (i = 0;i < LIST_NUM(o);i++) + { + HUB_LIST *h = LIST_DATA(o, i); + Debug("Delete HUB: %s\n", h->Name); + Free(h); + Delete(f->HubList, h); + } + + ReleaseList(o); + + // Set the enumeration results + LockList(c->HubList); + { + for (i = 0;i < LIST_NUM(c->HubList);i++) + { + HUB *h = LIST_DATA(c->HubList, i); + if (h->Offline == false) + { + if (h->Type == HUB_TYPE_FARM_STATIC) + { + HUB_LIST *hh = ZeroMalloc(sizeof(HUB_LIST)); + hh->FarmMember = f; + hh->DynamicHub = false; + StrCpy(hh->Name, sizeof(hh->Name), h->Name); + Add(f->HubList, hh); + + LockList(h->SessionList); + { + hh->NumSessions = LIST_NUM(h->SessionList); + hh->NumSessionsBridge = Count(h->NumSessionsBridge); + hh->NumSessionsClient = Count(h->NumSessionsClient); + } + UnlockList(h->SessionList); + + LockHashList(h->MacHashTable); + { + hh->NumMacTables = HASH_LIST_NUM(h->MacHashTable); + } + UnlockHashList(h->MacHashTable); + + LockList(h->IpTable); + { + hh->NumIpTables = LIST_NUM(h->IpTable); + } + UnlockList(h->IpTable); + } + } + } + } + UnlockList(c->HubList); + } + UnlockList(f->HubList); + + // Point + f->Point = SiGetPoint(s); + f->NumSessions = Count(s->Cedar->CurrentSessions); + f->MaxSessions = GetServerCapsInt(s, "i_max_sessions"); + f->NumTcpConnections = Count(s->Cedar->CurrentTcpConnections); + + Lock(s->Cedar->TrafficLock); + { + Copy(&f->Traffic, s->Cedar->Traffic, sizeof(TRAFFIC)); + } + Unlock(s->Cedar->TrafficLock); + + f->AssignedBridgeLicense = Count(s->Cedar->AssignedBridgeLicense); + f->AssignedClientLicense = Count(s->Cedar->AssignedClientLicense); + + Copy(f->RandomKey, s->MyRandomKey, SHA1_SIZE); + + + Debug("Server %s: Point %u\n", f->hostname, f->Point); + } + else + { + // Enumerate HUBs which are remote member + PACK *p = NewPack(); + UINT i, num, j; + LIST *o = NewListFast(NULL); + + num = 0; + + for (i = 0;i < LIST_NUM(s->FarmMemberList);i++) + { + FARM_MEMBER *f = LIST_DATA(s->FarmMemberList, i); + + if (IsZero(f->RandomKey, SHA1_SIZE) == false && f->SystemId != 0) + { + num++; + } + } + + j = 0; + + for (i = 0;i < LIST_NUM(s->FarmMemberList);i++) + { + FARM_MEMBER *f = LIST_DATA(s->FarmMemberList, i); + + if (IsZero(f->RandomKey, SHA1_SIZE) == false && f->SystemId != 0) + { + PackAddDataEx(p, "MemberRandomKey", f->RandomKey, SHA1_SIZE, j, num); + PackAddInt64Ex(p, "MemberSystemId", f->SystemId, j, num); + j++; + } + } + PackAddInt(p, "MemberSystemIdNum", num); + + p = SiCallTask(f, p, "enumhub"); + if (p != NULL) + { + LockList(f->HubList); + { + UINT i; + // Erase the list + for (i = 0;i < LIST_NUM(f->HubList);i++) + { + HUB_LIST *hh = LIST_DATA(f->HubList, i); + Free(hh); + } + DeleteAll(f->HubList); + + for (i = 0;i < PackGetIndexCount(p, "HubName");i++) + { + HUB_LIST *hh = ZeroMalloc(sizeof(HUB_LIST)); + UINT num; + UINT64 LastCommTime; + + PackGetStrEx(p, "HubName", hh->Name, sizeof(hh->Name), i); + num = PackGetIntEx(p, "NumSession", i); + hh->DynamicHub = ((PackGetIntEx(p, "HubType", i) == HUB_TYPE_FARM_DYNAMIC) ? true : false); + hh->FarmMember = f; + hh->NumSessions = PackGetIntEx(p, "NumSessions", i); + hh->NumSessionsClient = PackGetIntEx(p, "NumSessionsClient", i); + hh->NumSessionsBridge = PackGetIntEx(p, "NumSessionsBridge", i); + hh->NumIpTables = PackGetIntEx(p, "NumIpTables", i); + hh->NumMacTables = PackGetIntEx(p, "NumMacTables", i); + LastCommTime = PackGetInt64Ex(p, "LastCommTime", i); + Add(f->HubList, hh); + //Debug("%s\n", hh->Name); + + LockList(c->HubList); + { + HUB *h = GetHub(c, hh->Name); + + if (h != NULL) + { + // Update the LastCommTime of the Virtual HUB + Lock(h->lock); + { + if (h->LastCommTime < LastCommTime) + { + h->LastCommTime = LastCommTime; + } + } + Unlock(h->lock); + + ReleaseHub(h); + } + } + UnlockList(c->HubList); + + if (hh->DynamicHub && num >= 1) + { + // It is not necessary to be registered in the virtual HUB creation + // history list because user session is already connected. + // Remove from the Virtual HUB creation history list + SiDelHubCreateHistory(s, hh->Name); + } + + if (hh->DynamicHub && num == 0) + { + // Check the Virtual HUB creation history list. + // If it is created within 60 seconds of the most recent + // in the case of Virtual HUB which the first user is not + // connected yet, not to remove because there is no user + if (SiIsHubRegistedOnCreateHistory(s, hh->Name) == false) + { + // Stop because all uses have gone in the dynamic HUB + HUB *h; + LockList(c->HubList); + { + h = GetHub(c, hh->Name); + } + UnlockList(c->HubList); + + if (h != NULL) + { + Add(o, h); + } + } + } + } + } + UnlockList(f->HubList); + f->Point = PackGetInt(p, "Point"); + Debug("Server %s: Point %u\n", f->hostname, f->Point); + f->NumSessions = PackGetInt(p, "NumTotalSessions"); + if (f->NumSessions == 0) + { + f->NumSessions = PackGetInt(p, "NumSessions"); + } + f->MaxSessions = PackGetInt(p, "MaxSessions"); + f->NumTcpConnections = PackGetInt(p, "NumTcpConnections"); + InRpcTraffic(&f->Traffic, p); + + f->AssignedBridgeLicense = PackGetInt(p, "AssignedBridgeLicense"); + f->AssignedClientLicense = PackGetInt(p, "AssignedClientLicense"); + + if (PackGetDataSize(p, "RandomKey") == SHA1_SIZE) + { + PackGetData(p, "RandomKey", f->RandomKey); + } + + f->SystemId = PackGetInt64(p, "SystemId"); + + // Apply the traffic difference information + num = PackGetIndexCount(p, "TdType"); + for (i = 0;i < num;i++) + { + TRAFFIC traffic; + UINT type; + HUB *h; + char name[MAX_SIZE]; + char hubname[MAX_SIZE]; + + type = PackGetIntEx(p, "TdType", i); + PackGetStrEx(p, "TdName", name, sizeof(name), i); + PackGetStrEx(p, "TdHubName", hubname, sizeof(hubname), i); + InRpcTrafficEx(&traffic, p, i); + + LockList(c->HubList); + { + h = GetHub(c, hubname); + if (h != NULL) + { + if (type == TRAFFIC_DIFF_HUB) + { + Lock(h->TrafficLock); + { + AddTraffic(h->Traffic, &traffic); + } + Unlock(h->TrafficLock); + } + else + { + AcLock(h); + { + USER *u = AcGetUser(h, name); + if (u != NULL) + { + Lock(u->lock); + { + AddTraffic(u->Traffic, &traffic); + } + Unlock(u->lock); + if (u->Group != NULL) + { + Lock(u->Group->lock); + { + AddTraffic(u->Group->Traffic, &traffic); + } + Unlock(u->Group->lock); + } + ReleaseUser(u); + } + } + AcUnlock(h); + } + ReleaseHub(h); + } + UnlockList(c->HubList); + } + } + + FreePack(p); + } + + for (i = 0;i < LIST_NUM(o);i++) + { + HUB *h = LIST_DATA(o, i); + SiCallDeleteHub(s, f, h); + Debug("Delete HUB: %s\n", h->Name); + ReleaseHub(h); + } + + ReleaseList(o); + } +} + +// Send a session information directive +bool SiCallGetSessionStatus(SERVER *s, FARM_MEMBER *f, RPC_SESSION_STATUS *t) +{ + PACK *p; + // Validate arguments + if (s == NULL || f == NULL) + { + return false; + } + + p = NewPack(); + OutRpcSessionStatus(p, t); + FreeRpcSessionStatus(t); + Zero(t, sizeof(RPC_SESSION_STATUS)); + + p = SiCallTask(f, p, "getsessionstatus"); + + if (p == NULL) + { + return false; + } + + InRpcSessionStatus(t, p); + FreePack(p); + + return true; +} + +// Log file reading directive +bool SiCallReadLogFile(SERVER *s, FARM_MEMBER *f, RPC_READ_LOG_FILE *t) +{ + PACK *p; + // Validate arguments + if (s == NULL || f == NULL) + { + return false; + } + + p = NewPack(); + OutRpcReadLogFile(p, t); + FreeRpcReadLogFile(t); + Zero(t, sizeof(RPC_READ_LOG_FILE)); + + p = SiCallTask(f, p, "readlogfile"); + + if (p == NULL) + { + return false; + } + + InRpcReadLogFile(t, p); + FreePack(p); + + return true; +} + +// Log file enumeration directive +bool SiCallEnumLogFileList(SERVER *s, FARM_MEMBER *f, RPC_ENUM_LOG_FILE *t, char *hubname) +{ + PACK *p; + // Validate arguments + if (s == NULL || f == NULL) + { + return false; + } + + p = NewPack(); + OutRpcEnumLogFile(p, t); + FreeRpcEnumLogFile(t); + Zero(t, sizeof(RPC_ENUM_LOG_FILE)); + + PackAddStr(p, "HubName", hubname); + + p = SiCallTask(f, p, "enumlogfilelist"); + + if (p == NULL) + { + return false; + } + + InRpcEnumLogFile(t, p); + FreePack(p); + + return true; +} + +// HUB delete directive +void SiCallDeleteHub(SERVER *s, FARM_MEMBER *f, HUB *h) +{ + PACK *p; + UINT i; + // Validate arguments + if (s == NULL || f == NULL) + { + return; + } + + if (f->Me == false) + { + p = NewPack(); + + PackAddStr(p, "HubName", h->Name); + + p = SiCallTask(f, p, "deletehub"); + FreePack(p); + } + + LockList(f->HubList); + { + for (i = 0;i < LIST_NUM(f->HubList);i++) + { + HUB_LIST *hh = LIST_DATA(f->HubList, i); + if (StrCmpi(hh->Name, h->Name) == 0) + { + Free(hh); + Delete(f->HubList, hh); + } + } + } + UnlockList(f->HubList); +} + +// Submit a HUB update directive +void SiCallUpdateHub(SERVER *s, FARM_MEMBER *f, HUB *h) +{ + PACK *p; + // Validate arguments + if (s == NULL || f == NULL) + { + return; + } + + if (f->Me == false) + { + p = NewPack(); + + SiPackAddCreateHub(p, h); + + p = SiCallTask(f, p, "updatehub"); + FreePack(p); + } +} + +// Send a ticket creation directive +void SiCallCreateTicket(SERVER *s, FARM_MEMBER *f, char *hubname, char *username, char *realusername, POLICY *policy, UCHAR *ticket, UINT counter, char *groupname) +{ + PACK *p; + char name[MAX_SESSION_NAME_LEN + 1]; + char hub_name_upper[MAX_SIZE]; + char user_name_upper[MAX_USERNAME_LEN + 1]; + char ticket_str[MAX_SIZE]; + UINT point; + // Validate arguments + if (s == NULL || f == NULL || realusername == NULL || hubname == NULL || username == NULL || policy == NULL || ticket == NULL) + { + return; + } + if (groupname == NULL) + { + groupname = ""; + } + + p = NewPack(); + PackAddStr(p, "HubName", hubname); + PackAddStr(p, "UserName", username); + PackAddStr(p, "groupname", groupname); + PackAddStr(p, "RealUserName", realusername); + OutRpcPolicy(p, policy); + PackAddData(p, "Ticket", ticket, SHA1_SIZE); + + BinToStr(ticket_str, sizeof(ticket_str), ticket, SHA1_SIZE); + + StrCpy(hub_name_upper, sizeof(hub_name_upper), hubname); + StrUpper(hub_name_upper); + StrCpy(user_name_upper, sizeof(user_name_upper), username); + StrUpper(user_name_upper); + Format(name, sizeof(name), "SID-%s-%u", user_name_upper, + counter); + PackAddStr(p, "SessionName", name); + + p = SiCallTask(f, p, "createticket"); + + SLog(s->Cedar, "LS_TICKET_1", f->hostname, hubname, username, realusername, name, ticket_str); + + point = PackGetInt(p, "Point"); + if (point != 0) + { + f->Point = point; + f->NumSessions++; + } + + FreePack(p); +} + +// Send a MAC address deletion directive +void SiCallDeleteMacTable(SERVER *s, FARM_MEMBER *f, char *hubname, UINT key) +{ + PACK *p; + // Validate arguments + if (s == NULL || f == NULL || hubname == NULL) + { + return; + } + + p = NewPack(); + PackAddStr(p, "HubName", hubname); + PackAddInt(p, "Key", key); + + p = SiCallTask(f, p, "deletemactable"); + + FreePack(p); +} + +// Send an IP address delete directive +void SiCallDeleteIpTable(SERVER *s, FARM_MEMBER *f, char *hubname, UINT key) +{ + PACK *p; + // Validate arguments + if (s == NULL || f == NULL || hubname == NULL) + { + return; + } + + p = NewPack(); + PackAddStr(p, "HubName", hubname); + PackAddInt(p, "Key", key); + + p = SiCallTask(f, p, "deleteiptable"); + + FreePack(p); +} + +// Send a session deletion directive +void SiCallDeleteSession(SERVER *s, FARM_MEMBER *f, char *hubname, char *session_name) +{ + PACK *p; + // Validate arguments + if (s == NULL || f == NULL || hubname == NULL || session_name == NULL) + { + return; + } + + p = NewPack(); + PackAddStr(p, "HubName", hubname); + PackAddStr(p, "SessionName", session_name); + + p = SiCallTask(f, p, "deletesession"); + + FreePack(p); +} + +// Send an IP table enumeration directive +void SiCallEnumIpTable(SERVER *s, FARM_MEMBER *f, char *hubname, RPC_ENUM_IP_TABLE *t) +{ + PACK *p; + UINT i; + // Validate arguments + if (s == NULL || f == NULL || hubname == NULL || t == NULL) + { + return; + } + + p = NewPack(); + PackAddStr(p, "HubName", hubname); + + p = SiCallTask(f, p, "enumiptable"); + + Zero(t, sizeof(RPC_ENUM_IP_TABLE)); + InRpcEnumIpTable(t, p); + + for (i = 0;i < t->NumIpTable;i++) + { + t->IpTables[i].RemoteItem = true; + StrCpy(t->IpTables[i].RemoteHostname, sizeof(t->IpTables[i].RemoteHostname), + f->hostname); + } + + FreePack(p); +} + +// Submit a MAC table enumeration directive +void SiCallEnumMacTable(SERVER *s, FARM_MEMBER *f, char *hubname, RPC_ENUM_MAC_TABLE *t) +{ + PACK *p; + UINT i; + // Validate arguments + if (s == NULL || f == NULL || hubname == NULL || t == NULL) + { + return; + } + + p = NewPack(); + PackAddStr(p, "HubName", hubname); + + p = SiCallTask(f, p, "enummactable"); + + Zero(t, sizeof(RPC_ENUM_MAC_TABLE)); + InRpcEnumMacTable(t, p); + + for (i = 0;i < t->NumMacTable;i++) + { + t->MacTables[i].RemoteItem = true; + StrCpy(t->MacTables[i].RemoteHostname, sizeof(t->MacTables[i].RemoteHostname), + f->hostname); + } + + FreePack(p); +} + +// Send a SecureNAT status acquisition directive +void SiCallGetNatStatus(SERVER *s, FARM_MEMBER *f, char *hubname, RPC_NAT_STATUS *t) +{ + PACK *p; + // Validate arguments + if (s == NULL || f == NULL || hubname == NULL || t == NULL) + { + return; + } + + p = NewPack(); + PackAddStr(p, "HubName", hubname); + + p = SiCallTask(f, p, "getnatstatus"); + + Zero(t, sizeof(RPC_NAT_STATUS)); + InRpcNatStatus(t, p); + + FreePack(p); +} + +// Submit a DHCP entry enumeration directive +void SiCallEnumDhcp(SERVER *s, FARM_MEMBER *f, char *hubname, RPC_ENUM_DHCP *t) +{ + PACK *p; + // Validate arguments + if (s == NULL || f == NULL || hubname == NULL || t == NULL) + { + return; + } + + p = NewPack(); + PackAddStr(p, "HubName", hubname); + + p = SiCallTask(f, p, "enumdhcp"); + + Zero(t, sizeof(RPC_ENUM_DHCP)); + InRpcEnumDhcp(t, p); + + FreePack(p); +} + +// Submit a NAT entry enumeration directive +void SiCallEnumNat(SERVER *s, FARM_MEMBER *f, char *hubname, RPC_ENUM_NAT *t) +{ + PACK *p; + // Validate arguments + if (s == NULL || f == NULL || hubname == NULL || t == NULL) + { + return; + } + + p = NewPack(); + PackAddStr(p, "HubName", hubname); + + p = SiCallTask(f, p, "enumnat"); + + Zero(t, sizeof(RPC_ENUM_NAT)); + InRpcEnumNat(t, p); + + FreePack(p); +} + +// Send a session enumeration directive +void SiCallEnumSession(SERVER *s, FARM_MEMBER *f, char *hubname, RPC_ENUM_SESSION *t) +{ + PACK *p; + UINT i; + // Validate arguments + if (s == NULL || f == NULL || hubname == NULL || t == NULL) + { + return; + } + + p = NewPack(); + PackAddStr(p, "HubName", hubname); + + p = SiCallTask(f, p, "enumsession"); + + Zero(t, sizeof(RPC_ENUM_SESSION)); + InRpcEnumSession(t, p); + + for (i = 0;i < t->NumSession;i++) + { + t->Sessions[i].RemoteSession = true; + StrCpy(t->Sessions[i].RemoteHostname, sizeof(t->Sessions[i].RemoteHostname), + f->hostname); + } + + FreePack(p); +} + +// Send a HUB creation directive +void SiCallCreateHub(SERVER *s, FARM_MEMBER *f, HUB *h) +{ + PACK *p; + HUB_LIST *hh; + // Validate arguments + if (s == NULL || f == NULL) + { + return; + } + + if (f->Me == false) + { + p = NewPack(); + + SiPackAddCreateHub(p, h); + + p = SiCallTask(f, p, "createhub"); + FreePack(p); + } + + hh = ZeroMalloc(sizeof(HUB_LIST)); + hh->DynamicHub = (h->Type == HUB_TYPE_FARM_DYNAMIC ? true : false); + StrCpy(hh->Name, sizeof(hh->Name), h->Name); + hh->FarmMember = f; + + LockList(f->HubList); + { + bool exists = false; + UINT i; + for (i = 0;i < LIST_NUM(f->HubList);i++) + { + HUB_LIST *t = LIST_DATA(f->HubList, i); + if (StrCmpi(t->Name, hh->Name) == 0) + { + exists = true; + } + } + if (exists == false) + { + Add(f->HubList, hh); + } + else + { + Free(hh); + } + } + UnlockList(f->HubList); +} + +// Write the PACK for creating HUB +void SiPackAddCreateHub(PACK *p, HUB *h) +{ + UINT i; + UINT max_session; + SERVER *s; + + + // Validate arguments + if (p == NULL || h == NULL) + { + return; + } + + + s = h->Cedar->Server; + if (s != NULL) + { + } + + PackAddStr(p, "HubName", h->Name); + PackAddInt(p, "HubType", h->Type); + + max_session = h->Option->MaxSession; + + if (GetHubAdminOption(h, "max_sessions") != 0) + { + if (max_session == 0) + { + max_session = GetHubAdminOption(h, "max_sessions"); + } + else + { + UINT r = GetHubAdminOption(h, "max_sessions"); + max_session = MIN(max_session, r); + } + } + + PackAddInt(p, "MaxSession", max_session); + + if (GetHubAdminOption(h, "max_sessions_client_bridge_apply") != 0 + ) + { + PackAddInt(p, "MaxSessionClient", GetHubAdminOption(h, "max_sessions_client")); + PackAddInt(p, "MaxSessionBridge", GetHubAdminOption(h, "max_sessions_bridge")); + PackAddBool(p, "MaxSessionClientBridgeApply", true); + } + else + { + PackAddInt(p, "MaxSessionClient", INFINITE); + PackAddInt(p, "MaxSessionBridge", INFINITE); + } + + PackAddBool(p, "NoArpPolling", h->Option->NoArpPolling); + PackAddBool(p, "NoIPv6AddrPolling", h->Option->NoIPv6AddrPolling); + PackAddBool(p, "NoIpTable", h->Option->NoIpTable); + PackAddBool(p, "NoEnum", h->Option->NoEnum); + PackAddBool(p, "FilterPPPoE", h->Option->FilterPPPoE); + PackAddBool(p, "YieldAfterStorePacket", h->Option->YieldAfterStorePacket); + PackAddBool(p, "NoSpinLockForPacketDelay", h->Option->NoSpinLockForPacketDelay); + PackAddInt(p, "BroadcastStormDetectionThreshold", h->Option->BroadcastStormDetectionThreshold); + PackAddInt(p, "MaxLoggedPacketsPerMinute", h->Option->MaxLoggedPacketsPerMinute); + PackAddInt(p, "FloodingSendQueueBufferQuota", h->Option->FloodingSendQueueBufferQuota); + PackAddBool(p, "DoNotSaveHeavySecurityLogs", h->Option->DoNotSaveHeavySecurityLogs); + PackAddBool(p, "DropBroadcastsInPrivacyFilterMode", h->Option->DropBroadcastsInPrivacyFilterMode); + PackAddBool(p, "DropArpInPrivacyFilterMode", h->Option->DropArpInPrivacyFilterMode); + PackAddBool(p, "SuppressClientUpdateNotification", h->Option->SuppressClientUpdateNotification); + PackAddBool(p, "AssignVLanIdByRadiusAttribute", h->Option->AssignVLanIdByRadiusAttribute); + PackAddBool(p, "DenyAllRadiusLoginWithNoVlanAssign", h->Option->DenyAllRadiusLoginWithNoVlanAssign); + PackAddInt(p, "ClientMinimumRequiredBuild", h->Option->ClientMinimumRequiredBuild); + PackAddBool(p, "SecureNAT_RandomizeAssignIp", h->Option->SecureNAT_RandomizeAssignIp); + PackAddBool(p, "NoPhysicalIPOnPacketLog", h->Option->NoPhysicalIPOnPacketLog); + PackAddInt(p, "DetectDormantSessionInterval", h->Option->DetectDormantSessionInterval); + PackAddBool(p, "FixForDLinkBPDU", h->Option->FixForDLinkBPDU); + PackAddBool(p, "BroadcastLimiterStrictMode", h->Option->BroadcastLimiterStrictMode); + PackAddBool(p, "NoLookBPDUBridgeId", h->Option->NoLookBPDUBridgeId); + PackAddBool(p, "NoManageVlanId", h->Option->NoManageVlanId); + PackAddInt(p, "VlanTypeId", h->Option->VlanTypeId); + PackAddBool(p, "FilterOSPF", h->Option->FilterOSPF); + PackAddBool(p, "FilterIPv4", h->Option->FilterIPv4); + PackAddBool(p, "FilterIPv6", h->Option->FilterIPv6); + PackAddBool(p, "FilterNonIP", h->Option->FilterNonIP); + PackAddBool(p, "NoIPv4PacketLog", h->Option->NoIPv4PacketLog); + PackAddBool(p, "NoIPv6PacketLog", h->Option->NoIPv6PacketLog); + PackAddBool(p, "FilterBPDU", h->Option->FilterBPDU); + PackAddBool(p, "NoIPv6DefaultRouterInRAWhenIPv6", h->Option->NoIPv6DefaultRouterInRAWhenIPv6); + PackAddBool(p, "NoMacAddressLog", h->Option->NoMacAddressLog); + PackAddBool(p, "ManageOnlyPrivateIP", h->Option->ManageOnlyPrivateIP); + PackAddBool(p, "ManageOnlyLocalUnicastIPv6", h->Option->ManageOnlyLocalUnicastIPv6); + PackAddBool(p, "DisableIPParsing", h->Option->DisableIPParsing); + PackAddInt(p, "AdjustTcpMssValue", h->Option->AdjustTcpMssValue); + PackAddBool(p, "DisableAdjustTcpMss", h->Option->DisableAdjustTcpMss); + PackAddBool(p, "NoDhcpPacketLogOutsideHub", h->Option->NoDhcpPacketLogOutsideHub); + PackAddBool(p, "DisableHttpParsing", h->Option->DisableHttpParsing); + PackAddBool(p, "DisableUdpAcceleration", h->Option->DisableUdpAcceleration); + PackAddBool(p, "DisableUdpFilterForLocalBridgeNic", h->Option->DisableUdpFilterForLocalBridgeNic); + PackAddBool(p, "ApplyIPv4AccessListOnArpPacket", h->Option->ApplyIPv4AccessListOnArpPacket); + PackAddBool(p, "RemoveDefGwOnDhcpForLocalhost", h->Option->RemoveDefGwOnDhcpForLocalhost); + + PackAddInt(p, "SecureNAT_MaxTcpSessionsPerIp", h->Option->SecureNAT_MaxTcpSessionsPerIp); + PackAddInt(p, "SecureNAT_MaxTcpSynSentPerIp", h->Option->SecureNAT_MaxTcpSynSentPerIp); + PackAddInt(p, "SecureNAT_MaxUdpSessionsPerIp", h->Option->SecureNAT_MaxUdpSessionsPerIp); + PackAddInt(p, "SecureNAT_MaxDnsSessionsPerIp", h->Option->SecureNAT_MaxDnsSessionsPerIp); + PackAddInt(p, "SecureNAT_MaxIcmpSessionsPerIp", h->Option->SecureNAT_MaxIcmpSessionsPerIp); + PackAddInt(p, "AccessListIncludeFileCacheLifetime", h->Option->AccessListIncludeFileCacheLifetime); + PackAddBool(p, "DisableKernelModeSecureNAT", h->Option->DisableKernelModeSecureNAT); + PackAddBool(p, "DisableIpRawModeSecureNAT", h->Option->DisableIpRawModeSecureNAT); + PackAddBool(p, "DisableUserModeSecureNAT", h->Option->DisableUserModeSecureNAT); + PackAddBool(p, "DisableCheckMacOnLocalBridge", h->Option->DisableCheckMacOnLocalBridge); + PackAddBool(p, "DisableCorrectIpOffloadChecksum", h->Option->DisableCorrectIpOffloadChecksum); + + PackAddInt(p, "SavePacketLog", h->LogSetting.SavePacketLog); + PackAddInt(p, "PacketLogSwitchType", h->LogSetting.PacketLogSwitchType); + for (i = 0;i < NUM_PACKET_LOG;i++) + { + PackAddIntEx(p, "PacketLogConfig", h->LogSetting.PacketLogConfig[i], i, NUM_PACKET_LOG); + } + PackAddInt(p, "SaveSecurityLog", h->LogSetting.SaveSecurityLog); + PackAddInt(p, "SecurityLogSwitchType", h->LogSetting.SecurityLogSwitchType); + PackAddData(p, "HashedPassword", h->HashedPassword, SHA1_SIZE); + PackAddData(p, "SecurePassword", h->SecurePassword, SHA1_SIZE); + PackAddBool(p, "UseHubNameAsDhcpUserClassOption", h->Option->UseHubNameAsDhcpUserClassOption); + PackAddBool(p, "UseHubNameAsRadiusNasId", h->Option->UseHubNameAsRadiusNasId); + + SiAccessListToPack(p, h->AccessList); + + if (h->EnableSecureNAT) + { + PackAddBool(p, "EnableSecureNAT", h->EnableSecureNAT); + OutVhOption(p, h->SecureNATOption); + } +} + +// Setting of the HUB has been updated +void SiHubUpdateProc(HUB *h) +{ + SERVER *s; + UINT i; + // Validate arguments + if (h == NULL || h->Cedar == NULL || h->Cedar->Server == NULL || h->Cedar->Server->ServerType != SERVER_TYPE_FARM_CONTROLLER) + { + return; + } + + s = h->Cedar->Server; + + if (s->FarmMemberList == NULL) + { + return; + } + + if (h->LastVersion != h->CurrentVersion || h->CurrentVersion == 0) + { + LIST *fm_list; + if (h->CurrentVersion == 0) + { + h->CurrentVersion = 1; + } + h->LastVersion = h->CurrentVersion; + + Debug("SiHubUpdateProc HUB=%s, Ver=%u, Type=%u, Offline=%u\n", h->Name, h->CurrentVersion, + h->Type, h->Offline); + + fm_list = NewListFast(NULL); + + LockList(s->FarmMemberList); + { + while (true) + { + bool escape = true; + // Update the HUB on all members + for (i = 0;i < LIST_NUM(s->FarmMemberList);i++) + { + FARM_MEMBER *f = LIST_DATA(s->FarmMemberList, i); + + if (IsInList(fm_list, f) == false) + { + Add(fm_list, f); + escape = false; + + if (f->Me == false) + { + SiCallUpdateHub(s, f, h); + } + + break; + } + } + + if (escape) + { + break; + } + + UnlockList(s->FarmMemberList); + LockList(s->FarmMemberList); + } + } + UnlockList(s->FarmMemberList); + + ReleaseList(fm_list); + } + + if (h->Offline == false) + { + SiHubOnlineProc(h); + } +} + +// HUB turns to online +void SiHubOnlineProc(HUB *h) +{ + SERVER *s; + UINT i; + // Validate arguments + if (h == NULL || h->Cedar->Server == NULL || h->Cedar->Server->ServerType != SERVER_TYPE_FARM_CONTROLLER) + { + // Process only on the farm controller + return; + } + + s = h->Cedar->Server; + + if (s->FarmMemberList == NULL) + { + return; + } + + LockList(s->FarmMemberList); + { + if (h->Type == HUB_TYPE_FARM_STATIC) + { + // Static HUB + // Create the HUB on all members + for (i = 0;i < LIST_NUM(s->FarmMemberList);i++) + { + UINT j; + bool exists = false; + FARM_MEMBER *f = LIST_DATA(s->FarmMemberList, i); + + LockList(f->HubList); + { + for (j = 0;j < LIST_NUM(f->HubList);j++) + { + HUB_LIST *hh = LIST_DATA(f->HubList, j); + if (StrCmpi(hh->Name, h->Name) == 0) + { + exists = true; + } + } + } + UnlockList(f->HubList); + + if (exists == false) + { + SiCallCreateHub(s, f, h); + } + } + } + } + UnlockList(s->FarmMemberList); +} + +// HUB turns to offline +void SiHubOfflineProc(HUB *h) +{ + SERVER *s; + char hubname[MAX_HUBNAME_LEN + 1]; + UINT i; + LIST *fm_list; + // Validate arguments + if (h == NULL || h->Cedar->Server == NULL || h->Cedar->Server->ServerType != SERVER_TYPE_FARM_CONTROLLER) + { + // Process only on the farm controller + return; + } + + s = h->Cedar->Server; + + if (s->FarmMemberList == NULL) + { + return; + } + + StrCpy(hubname, sizeof(hubname), h->Name); + + fm_list = NewListFast(NULL); + + LockList(s->FarmMemberList); + { + while (true) + { + bool escape = true; + + // Stop the HUB on all members + for (i = 0;i < LIST_NUM(s->FarmMemberList);i++) + { + FARM_MEMBER *f = LIST_DATA(s->FarmMemberList, i); + + if (IsInList(fm_list, f) == false) + { + Add(fm_list, f); + escape = false; + + SiCallDeleteHub(s, f, h); + + break; + } + } + + if (escape) + { + break; + } + + UnlockList(s->FarmMemberList); + LockList(s->FarmMemberList); + } + } + UnlockList(s->FarmMemberList); + + ReleaseList(fm_list); +} + +// Convert an access to PACK +void SiAccessToPack(PACK *p, ACCESS *a, UINT i, UINT total) +{ + // Validate arguments + if (p == NULL || a == NULL) + { + return; + } + + PackAddUniStrEx(p, "Note", a->Note, i, total); + PackAddIntEx(p, "Active", a->Active, i, total); + PackAddIntEx(p, "Priority", a->Priority, i, total); + PackAddIntEx(p, "Discard", a->Discard, i, total); + if (a->IsIPv6) + { + PackAddIp32Ex(p, "SrcIpAddress", 0xFDFFFFDF, i, total); + PackAddIp32Ex(p, "SrcSubnetMask", 0xFFFFFFFF, i, total); + PackAddIp32Ex(p, "DestIpAddress", 0xFDFFFFDF, i, total); + PackAddIp32Ex(p, "DestSubnetMask", 0xFFFFFFFF, i, total); + } + else + { + PackAddIp32Ex(p, "SrcIpAddress", a->SrcIpAddress, i, total); + PackAddIp32Ex(p, "SrcSubnetMask", a->SrcSubnetMask, i, total); + PackAddIp32Ex(p, "DestIpAddress", a->DestIpAddress, i, total); + PackAddIp32Ex(p, "DestSubnetMask", a->DestSubnetMask, i, total); + } + PackAddIntEx(p, "Protocol", a->Protocol, i, total); + PackAddIntEx(p, "SrcPortStart", a->SrcPortStart, i, total); + PackAddIntEx(p, "SrcPortEnd", a->SrcPortEnd, i, total); + PackAddIntEx(p, "DestPortStart", a->DestPortStart, i, total); + PackAddIntEx(p, "DestPortEnd", a->DestPortEnd, i, total); + PackAddStrEx(p, "SrcUsername", a->SrcUsername, i, total); + PackAddStrEx(p, "DestUsername", a->DestUsername, i, total); + PackAddBoolEx(p, "CheckSrcMac", a->CheckSrcMac, i, total); + PackAddDataEx(p, "SrcMacAddress", a->SrcMacAddress, sizeof(a->SrcMacAddress), i, total); + PackAddDataEx(p, "SrcMacMask", a->SrcMacMask, sizeof(a->SrcMacMask), i, total); + PackAddBoolEx(p, "CheckDstMac", a->CheckDstMac, i, total); + PackAddDataEx(p, "DstMacAddress", a->DstMacAddress, sizeof(a->DstMacAddress), i, total); + PackAddDataEx(p, "DstMacMask", a->DstMacMask, sizeof(a->DstMacMask), i, total); + PackAddBoolEx(p, "CheckTcpState", a->CheckTcpState, i, total); + PackAddBoolEx(p, "Established", a->Established, i, total); + PackAddIntEx(p, "Delay", a->Delay, i, total); + PackAddIntEx(p, "Jitter", a->Jitter, i, total); + PackAddIntEx(p, "Loss", a->Loss, i, total); + PackAddStrEx(p, "RedirectUrl", a->RedirectUrl, i, total); + PackAddBoolEx(p, "IsIPv6", a->IsIPv6, i, total); + if (a->IsIPv6) + { + PackAddIp6AddrEx(p, "SrcIpAddress6", &a->SrcIpAddress6, i, total); + PackAddIp6AddrEx(p, "SrcSubnetMask6", &a->SrcSubnetMask6, i, total); + PackAddIp6AddrEx(p, "DestIpAddress6", &a->DestIpAddress6, i, total); + PackAddIp6AddrEx(p, "DestSubnetMask6", &a->DestSubnetMask6, i, total); + } + else + { + IPV6_ADDR zero; + + Zero(&zero, sizeof(zero)); + + PackAddIp6AddrEx(p, "SrcIpAddress6", &zero, i, total); + PackAddIp6AddrEx(p, "SrcSubnetMask6", &zero, i, total); + PackAddIp6AddrEx(p, "DestIpAddress6", &zero, i, total); + PackAddIp6AddrEx(p, "DestSubnetMask6", &zero, i, total); + } +} + +// Get number of access contained in the PACK +UINT SiNumAccessFromPack(PACK *p) +{ + // Validate arguments + if (p == NULL) + { + return 0; + } + + return PackGetIndexCount(p, "Active"); +} + +// Convert the PACK to access +ACCESS *SiPackToAccess(PACK *p, UINT i) +{ + ACCESS *a; + // Validate arguments + if (p == NULL) + { + return NULL; + } + + a = ZeroMalloc(sizeof(ACCESS)); + + PackGetUniStrEx(p, "Note", a->Note, sizeof(a->Note), i); + a->Active = PackGetIntEx(p, "Active", i); + a->Priority = PackGetIntEx(p, "Priority", i); + a->Discard = PackGetIntEx(p, "Discard", i); + a->SrcIpAddress = PackGetIp32Ex(p, "SrcIpAddress", i); + a->SrcSubnetMask = PackGetIp32Ex(p, "SrcSubnetMask", i); + a->DestIpAddress = PackGetIp32Ex(p, "DestIpAddress", i); + a->DestSubnetMask = PackGetIp32Ex(p, "DestSubnetMask", i); + a->Protocol = PackGetIntEx(p, "Protocol", i); + a->SrcPortStart = PackGetIntEx(p, "SrcPortStart", i); + a->SrcPortEnd = PackGetIntEx(p, "SrcPortEnd", i); + a->DestPortStart = PackGetIntEx(p, "DestPortStart", i); + a->DestPortEnd = PackGetIntEx(p, "DestPortEnd", i); + PackGetStrEx(p, "SrcUsername", a->SrcUsername, sizeof(a->SrcUsername), i); + PackGetStrEx(p, "DestUsername", a->DestUsername, sizeof(a->DestUsername), i); + a->CheckSrcMac = PackGetBoolEx(p, "CheckSrcMac", i); + PackGetDataEx2(p, "SrcMacAddress", a->SrcMacAddress, sizeof(a->SrcMacAddress), i); + PackGetDataEx2(p, "SrcMacMask", a->SrcMacMask, sizeof(a->SrcMacMask), i); + a->CheckDstMac = PackGetBoolEx(p, "CheckDstMac", i); + PackGetDataEx2(p, "DstMacAddress", a->DstMacAddress, sizeof(a->DstMacAddress), i); + PackGetDataEx2(p, "DstMacMask", a->DstMacMask, sizeof(a->DstMacMask), i); + a->CheckTcpState = PackGetBoolEx(p, "CheckTcpState", i); + a->Established = PackGetBoolEx(p, "Established", i); + a->Delay = PackGetIntEx(p, "Delay", i); + a->Jitter = PackGetIntEx(p, "Jitter", i); + a->Loss = PackGetIntEx(p, "Loss", i); + a->IsIPv6 = PackGetBoolEx(p, "IsIPv6", i); + PackGetStrEx(p, "RedirectUrl", a->RedirectUrl, sizeof(a->RedirectUrl), i); + if (a->IsIPv6) + { + PackGetIp6AddrEx(p, "SrcIpAddress6", &a->SrcIpAddress6, i); + PackGetIp6AddrEx(p, "SrcSubnetMask6", &a->SrcSubnetMask6, i); + PackGetIp6AddrEx(p, "DestIpAddress6", &a->DestIpAddress6, i); + PackGetIp6AddrEx(p, "DestSubnetMask6", &a->DestSubnetMask6, i); + } + + return a; +} + +// Convert the PACK to an access list +void SiAccessListToPack(PACK *p, LIST *o) +{ + // Validate arguments + if (p == NULL || o == NULL) + { + return; + } + + LockList(o); + { + UINT i; + for (i = 0;i < LIST_NUM(o);i++) + { + ACCESS *a = LIST_DATA(o, i); + SiAccessToPack(p, a, i, LIST_NUM(o)); + } + } + UnlockList(o); +} + +// Get the member that is hosting the specified HUB +FARM_MEMBER *SiGetHubHostingMember(SERVER *s, HUB *h, bool admin_mode, CONNECTION *c) +{ + FARM_MEMBER *ret = NULL; + char name[MAX_SIZE]; + UINT i; + // Validate arguments + if (s == NULL || h == NULL || c == NULL) + { + return NULL; + } + + StrCpy(name, sizeof(name), h->Name); + + if (h->Type == HUB_TYPE_FARM_STATIC) + { + // It is good to select any member in the case of static HUB + if (admin_mode == false) + { + ret = SiGetNextFarmMember(s, c, h); + } + else + { + UINT i; + ret = NULL; + + for (i = 0;i < LIST_NUM(s->FarmMemberList);i++) + { + FARM_MEMBER *f = LIST_DATA(s->FarmMemberList, i); + if (f->Me) + { + ret = f; + break; + } + } + } + } + else + { + // Examine whether there is a member that is hosting the HUB already in the case of dynamic HUB + for (i = 0;i < LIST_NUM(s->FarmMemberList);i++) + { + FARM_MEMBER *f = LIST_DATA(s->FarmMemberList, i); + HUB_LIST *hh, t; + StrCpy(t.Name, sizeof(t.Name), name); + LockList(f->HubList); + { + hh = Search(f->HubList, &t); + if (hh != NULL) + { + // Found + ret = f; + } + } + UnlockList(f->HubList); + } + + if (ret == NULL) + { + // Let host the new HUB + FARM_MEMBER *f; + + // Select the member to host + ret = SiGetNextFarmMember(s, c, h); + + f = ret; + if (f != NULL) + { + // HUB creation directive + SiAddHubCreateHistory(s, name); + SiCallCreateHub(s, f, h); + SiCallUpdateHub(s, f, h); + } + } + } + + return ret; +} + +// Task is called +PACK *SiCalledTask(FARM_CONTROLLER *f, PACK *p, char *taskname) +{ + PACK *ret; + SERVER *s; + // Validate arguments + if (f == NULL || p == NULL || taskname == NULL) + { + return NULL; + } + + ret = NULL; + s = f->Server; + + if (StrCmpi(taskname, "noop") == 0) + { + // NO OPERATION + ret = NewPack(); + } + else + { + Debug("Task Called: [%s].\n", taskname); + if (StrCmpi(taskname, "createhub") == 0) + { + SiCalledCreateHub(s, p); + ret = NewPack(); + } + else if (StrCmpi(taskname, "deletehub") == 0) + { + SiCalledDeleteHub(s, p); + ret = NewPack(); + } + else if (StrCmpi(taskname, "enumhub") == 0) + { + ret = NewPack(); + SiCalledEnumHub(s, ret, p); + } + else if (StrCmpi(taskname, "updatehub") == 0) + { + SiCalledUpdateHub(s, p); + ret = NewPack(); + } + else if (StrCmpi(taskname, "createticket") == 0) + { + ret = SiCalledCreateTicket(s, p); + } + else if (StrCmpi(taskname, "enumnat") == 0) + { + ret = SiCalledEnumNat(s, p); + } + else if (StrCmpi(taskname, "enumdhcp") == 0) + { + ret = SiCalledEnumDhcp(s, p); + } + else if (StrCmpi(taskname, "getnatstatus") == 0) + { + ret = SiCalledGetNatStatus(s, p); + } + else if (StrCmpi(taskname, "enumsession") == 0) + { + ret = SiCalledEnumSession(s, p); + } + else if (StrCmpi(taskname, "deletesession") == 0) + { + SiCalledDeleteSession(s, p); + ret = NewPack(); + } + else if (StrCmpi(taskname, "deletemactable") == 0) + { + SiCalledDeleteMacTable(s, p); + ret = NewPack(); + } + else if (StrCmpi(taskname, "deleteiptable") == 0) + { + SiCalledDeleteIpTable(s, p); + ret = NewPack(); + } + else if (StrCmpi(taskname, "enummactable") == 0) + { + ret = SiCalledEnumMacTable(s, p); + } + else if (StrCmpi(taskname, "enumiptable") == 0) + { + ret = SiCalledEnumIpTable(s, p); + } + else if (StrCmpi(taskname, "getsessionstatus") == 0) + { + ret = SiCalledGetSessionStatus(s, p); + } + else if (StrCmpi(taskname, "enumlogfilelist") == 0) + { + ret = SiCalledEnumLogFileList(s, p); + } + else if (StrCmpi(taskname, "readlogfile") == 0) + { + ret = SiCalledReadLogFile(s, p); + } + } + + return ret; +} + +// Call the task +PACK *SiCallTask(FARM_MEMBER *f, PACK *p, char *taskname) +{ + PACK *ret; + char tmp[MAX_PATH]; + // Validate arguments + if (f == NULL || p == NULL || taskname == NULL) + { + return NULL; + } + + PackAddStr(p, "taskname", taskname); + + Debug("Call Task [%s] (%s)\n", taskname, f->hostname); + + Format(tmp, sizeof(tmp), "CLUSTER_CALL: Entering Call [%s] to %s", taskname, f->hostname); + SiDebugLog(f->Cedar->Server, tmp); + + ret = SiExecTask(f, p); + + Format(tmp, sizeof(tmp), "CLUSTER_CALL: Leaving Call [%s] to %s", taskname, f->hostname); + SiDebugLog(f->Cedar->Server, tmp); + + return ret; +} + +// Task listening procedure (Main Process) +void SiAcceptTasksFromControllerMain(FARM_CONTROLLER *f, SOCK *sock) +{ + PACK *request; + PACK *response; + char taskname[MAX_SIZE]; + // Validate arguments + if (f == NULL || sock == NULL) + { + return; + } + + f->IsConnected = true; + + while (true) + { + bool ret; + // Receive the PACK + request = HttpClientRecv(sock); + if (request == NULL) + { + // Disconnect + break; + } + + response = NULL; + + // Get the name + if (PackGetStr(request, "taskname", taskname, sizeof(taskname))) + { + Lock(f->Server->TasksFromFarmControllerLock); + { + response = SiCalledTask(f, request, taskname); + } + Unlock(f->Server->TasksFromFarmControllerLock); + } + + FreePack(request); + + // Return a response + if (response == NULL) + { + response = NewPack(); + } + else + { + PackAddInt(response, "succeed", 1); + } + + ret = HttpClientSend(sock, response); + FreePack(response); + + if (ret == false) + { + // Disconnect + break; + } + } + + f->IsConnected = false; +} + +// Task waiting procedure +void SiAcceptTasksFromController(FARM_CONTROLLER *f, SOCK *sock) +{ + UINT i; + HUB **hubs; + UINT num_hubs; + CEDAR *c; + SERVER *s; + // Validate arguments + if (f == NULL || sock == NULL) + { + return; + } + + s = f->Server; + c = s->Cedar; + + // Main process + SiAcceptTasksFromControllerMain(f, sock); + + // Stop all Virtual HUBs since the connection to the controller is disconnected + LockList(c->HubList); + { + hubs = ToArray(c->HubList); + num_hubs = LIST_NUM(c->HubList); + for (i = 0;i < num_hubs;i++) + { + AddRef(hubs[i]->ref); + } + } + UnlockList(c->HubList); + + for (i = 0;i < num_hubs;i++) + { + SetHubOffline(hubs[i]); + DelHub(c, hubs[i]); + ReleaseHub(hubs[i]); + } + + Free(hubs); +} + +// Execute the task +PACK *SiExecTask(FARM_MEMBER *f, PACK *p) +{ + FARM_TASK *t; + // Validate arguments + if (f == NULL || p == NULL) + { + return NULL; + } + + t = SiFarmServPostTask(f, p); + if (t == NULL) + { + return NULL; + } + + return SiFarmServWaitTask(t); +} + +// Task queuing +FARM_TASK *SiFarmServPostTask(FARM_MEMBER *f, PACK *request) +{ + FARM_TASK *t; + // Validate arguments + if (f == NULL || request == NULL) + { + return NULL; + } + + t = ZeroMalloc(sizeof(FARM_TASK)); + t->CompleteEvent = NewEvent(); + t->Request = request; + + LockQueue(f->TaskQueue); + { + if (f->Halting) + { + // Halting (failure) + UnlockQueue(f->TaskQueue); + ReleaseEvent(t->CompleteEvent); + Free(t); + return NULL; + } + + InsertQueue(f->TaskQueue, t); + } + UnlockQueue(f->TaskQueue); + + Set(f->TaskPostEvent); + + return t; +} + +// Wait for task results +PACK *SiFarmServWaitTask(FARM_TASK *t) +{ + PACK *response; + // Validate arguments + if (t == NULL) + { + return NULL; + } + + Wait(t->CompleteEvent, INFINITE); + ReleaseEvent(t->CompleteEvent); + FreePack(t->Request); + + response = t->Response; + Free(t); + + if (PackGetInt(response, "succeed") == 0) + { + // Task calling fails for any reason + FreePack(response); + return NULL; + } + + return response; +} + +// Server farm processing main +void SiFarmServMain(SERVER *server, SOCK *sock, FARM_MEMBER *f) +{ + UINT wait_time = SERVER_CONTROL_TCP_TIMEOUT / 2; + bool send_noop = false; + UINT i; + CEDAR *c; + // Validate arguments + if (server == NULL || sock == NULL || f == NULL) + { + Debug("SiFarmServMain Failed.\n"); + return; + } + + Debug("SiFarmServMain Started.\n"); + + c = server->Cedar; + + // Send a directive to create all static HUBs at the stage + // where the members have been connected to the controller + LockList(c->HubList); + { + for (i = 0;i < LIST_NUM(c->HubList);i++) + { + HUB *h = LIST_DATA(c->HubList, i); + if (h->Offline == false) + { + if (h->Type == HUB_TYPE_FARM_STATIC) + { + PACK *p; + HUB_LIST *hh; + p = NewPack(); + SiPackAddCreateHub(p, h); + PackAddStr(p, "taskname", "createhub"); + HttpServerSend(sock, p); + FreePack(p); + p = HttpServerRecv(sock); + FreePack(p); + + p = NewPack(); + SiPackAddCreateHub(p, h); + PackAddStr(p, "taskname", "updatehub"); + HttpServerSend(sock, p); + FreePack(p); + p = HttpServerRecv(sock); + FreePack(p); + + hh = ZeroMalloc(sizeof(HUB_LIST)); + hh->DynamicHub = false; + hh->FarmMember = f; + StrCpy(hh->Name, sizeof(hh->Name), h->Name); + LockList(f->HubList); + { + Add(f->HubList, hh); + } + UnlockList(f->HubList); + } + } + } + } + UnlockList(c->HubList); + + Debug("SiFarmServMain: while (true)\n"); + + while (true) + { + FARM_TASK *t; + UINT64 tick; + + do + { + // Check whether a new task arrived + LockQueue(f->TaskQueue); + { + t = GetNext(f->TaskQueue); + } + UnlockQueue(f->TaskQueue); + + if (t != NULL) + { + // Handle this task + PACK *p = t->Request; + bool ret; + + // Transmission + ret = HttpServerSend(sock, p); + send_noop = false; + + if (ret == false) + { + // Disconnected + // Cancel this task + Set(t->CompleteEvent); + goto DISCONNECTED; + } + + // Receive + p = HttpServerRecvEx(sock, FIRM_SERV_RECV_PACK_MAX_SIZE); + + t->Response = p; + Set(t->CompleteEvent); + + if (p == NULL) + { + // Avoid infinite loop + Disconnect(sock); + goto DISCONNECTED; + } + } + } + while (t != NULL); + + if (send_noop) + { + // Send a NOOP + PACK *p; + bool ret; + p = NewPack(); + PackAddStr(p, "taskname", "noop"); + + ret = HttpServerSend(sock, p); + FreePack(p); + + if (ret == false) + { + goto DISCONNECTED; + } + + p = HttpServerRecv(sock); + if (p == NULL) + { + goto DISCONNECTED; + } + + FreePack(p); + } + + tick = Tick64(); + + while (true) + { + bool break_flag; + if ((tick + wait_time) <= Tick64()) + { + break; + } + + Wait(f->TaskPostEvent, 250); + + break_flag = false; + LockQueue(f->TaskQueue); + { + if (f->TaskQueue->num_item != 0) + { + break_flag = true; + } + } + UnlockQueue(f->TaskQueue); + + if (break_flag || f->Halting || server->Halt) + { + break; + } + } + send_noop = true; + } + +DISCONNECTED: + + Debug("SiFarmServMain: DISCONNECTED\n"); + + f->Halting = true; + // Cancel all outstanding tasks + LockQueue(f->TaskQueue); + { + FARM_TASK *t; + + while (t = GetNext(f->TaskQueue)) + { + Set(t->CompleteEvent); + } + } + UnlockQueue(f->TaskQueue); +} + +// Farm server function that handles the connection from farm members +void SiFarmServ(SERVER *server, SOCK *sock, X *cert, UINT ip, UINT num_port, UINT *ports, char *hostname, UINT point, UINT weight, UINT max_sessions) +{ + PACK *p; + FARM_MEMBER *f; + UINT i; + char tmp[MAX_SIZE]; + // Validate arguments + if (server == NULL || sock == NULL || cert == NULL || num_port == 0 || ports == NULL || hostname == NULL) + { + return; + } + + if (weight == 0) + { + weight = FARM_DEFAULT_WEIGHT; + } + + if (max_sessions == 0) + { + max_sessions = SERVER_MAX_SESSIONS; + } + + if (ip == 0) + { + // If the public IP address is not specified, specify the connection + // source IP address of this farm member server + ip = IPToUINT(&sock->RemoteIP); + } + + IPToStr32(tmp, sizeof(tmp), ip); + SLog(server->Cedar, "LS_FARM_SERV_START", tmp, hostname); + + // Inform the success + p = NewPack(); + HttpServerSend(sock, p); + FreePack(p); + + IPToStr32(tmp, sizeof(tmp), ip); + Debug("Farm Member %s Connected. IP: %s\n", hostname, tmp); + + SetTimeout(sock, SERVER_CONTROL_TCP_TIMEOUT); + + f = ZeroMalloc(sizeof(FARM_MEMBER)); + f->Cedar = server->Cedar; + f->Ip = ip; + f->NumPort = num_port; + f->Ports = ports; + StrCpy(f->hostname, sizeof(f->hostname), hostname); + f->ServerCert = cert; + f->ConnectedTime = SystemTime64(); + f->Weight = weight; + f->MaxSessions = max_sessions; + + f->HubList = NewList(CompareHubList); + f->Point = point; + + f->TaskQueue = NewQueue(); + f->TaskPostEvent = NewEvent(); + + // Add to the list + LockList(server->FarmMemberList); + { + Add(server->FarmMemberList, f); + } + UnlockList(server->FarmMemberList); + + // Main process + SiFarmServMain(server, sock, f); + + // Remove from the list + LockList(server->FarmMemberList); + { + Delete(server->FarmMemberList, f); + } + UnlockList(server->FarmMemberList); + + ReleaseQueue(f->TaskQueue); + ReleaseEvent(f->TaskPostEvent); + + for (i = 0;i < LIST_NUM(f->HubList);i++) + { + HUB_LIST *hh = LIST_DATA(f->HubList, i); + Free(hh); + } + + ReleaseList(f->HubList); + + Free(f); + + SLog(server->Cedar, "LS_FARM_SERV_END", hostname); +} + +// Search in HUB list +int CompareHubList(void *p1, void *p2) +{ + HUB_LIST *h1, *h2; + if (p1 == NULL || p2 == NULL) + { + return 0; + } + h1 = *(HUB_LIST **)p1; + h2 = *(HUB_LIST **)p2; + if (h1 == NULL || h2 == NULL) + { + return 0; + } + return StrCmpi(h1->Name, h2->Name); +} + +// Connection thread to the controller +void SiConnectToControllerThread(THREAD *thread, void *param) +{ + FARM_CONTROLLER *f; + SESSION *s; + CONNECTION *c; + SERVER *server; + bool first_failed; + // Validate arguments + if (thread == NULL || param == NULL) + { + return; + } + +#ifdef OS_WIN32 + MsSetThreadPriorityRealtime(); +#endif // OS_WIN32 + + f = (FARM_CONTROLLER *)param; + f->Thread = thread; + AddRef(f->Thread->ref); + NoticeThreadInit(thread); + + f->StartedTime = SystemTime64(); + + server = f->Server; + + SLog(server->Cedar, "LS_FARM_CONNECT_1", server->ControllerName); + + first_failed = true; + + while (true) + { + // Attempt to connect + CLIENT_OPTION o; + + f->LastError = ERR_TRYING_TO_CONNECT; + + Zero(&o, sizeof(CLIENT_OPTION)); + StrCpy(o.Hostname, sizeof(o.Hostname), server->ControllerName); + o.Port = server->ControllerPort; + f->NumTry++; + + Debug("Try to Connect %s (Controller).\n", server->ControllerName); + + s = NewRpcSessionEx(server->Cedar, &o, NULL, CEDAR_SERVER_FARM_STR); + + if (s != NULL) + { + // Connection success: send the authentication data + PACK *p = NewPack(); + UCHAR secure_password[SHA1_SIZE]; + BUF *b; + + c = s->Connection; + + Lock(f->lock); + { + f->Sock = c->FirstSock; + AddRef(f->Sock->ref); + SetTimeout(f->Sock, SERVER_CONTROL_TCP_TIMEOUT); + } + Unlock(f->lock); + + // Method + PackAddStr(p, "method", "farm_connect"); + PackAddClientVersion(p, s->Connection); + + // Password + SecurePassword(secure_password, server->MemberPassword, s->Connection->Random); + PackAddData(p, "SecurePassword", secure_password, sizeof(secure_password)); + + Lock(server->Cedar->lock); + { + b = XToBuf(server->Cedar->ServerX, false); + } + Unlock(server->Cedar->lock); + + if (b != NULL) + { + char tmp[MAX_SIZE]; + bool ret; + UINT i; + // Server certificate + PackAddBuf(p, "ServerCert", b); + FreeBuf(b); + + // Maximum number of sessions + PackAddInt(p, "MaxSessions", GetServerCapsInt(server, "i_max_sessions")); + + // Point + PackAddInt(p, "Point", SiGetPoint(server)); + PackAddInt(p, "Weight", server->Weight); + + // Host name + GetMachineName(tmp, sizeof(tmp)); + PackAddStr(p, "HostName", tmp); + + // Public IP + PackAddIp32(p, "PublicIp", server->PublicIp); + + // Public port + for (i = 0;i < server->NumPublicPort;i++) + { + PackAddIntEx(p, "PublicPort", server->PublicPorts[i], i, server->NumPublicPort); + } + + ret = HttpClientSend(c->FirstSock, p); + + if (ret) + { + PACK *p; + UINT err = ERR_PROTOCOL_ERROR; + + first_failed = true; + p = HttpClientRecv(c->FirstSock); + if (p != NULL && (err = GetErrorFromPack(p)) == 0) + { + // Successful connection + SLog(server->Cedar, "LS_FARM_START"); + f->CurrentConnectedTime = SystemTime64(); + if (f->FirstConnectedTime == 0) + { + f->FirstConnectedTime = SystemTime64(); + } + f->NumConnected++; + Debug("Connect Succeed.\n"); + f->Online = true; + + // Main process + SiAcceptTasksFromController(f, c->FirstSock); + + f->Online = false; + } + else + { + // Error + f->LastError = err; + SLog(server->Cedar, "LS_FARM_CONNECT_2", server->ControllerName, + GetUniErrorStr(err), err); + } + FreePack(p); + } + else + { + f->LastError = ERR_DISCONNECTED; + + if (first_failed) + { + SLog(server->Cedar, "LS_FARM_CONNECT_3", server->ControllerName, RETRY_CONNECT_TO_CONTROLLER_INTERVAL / 1000); + first_failed = false; + } + } + } + + FreePack(p); + + // Disconnect + Lock(f->lock); + { + if (f->Sock != NULL) + { + ReleaseSock(f->Sock); + f->Sock = NULL; + } + } + Unlock(f->lock); + + ReleaseSession(s); + s = NULL; + + if (f->LastError == ERR_TRYING_TO_CONNECT) + { + f->LastError = ERR_DISCONNECTED; + } + } + else + { + // Connection failure + f->LastError = ERR_CONNECT_TO_FARM_CONTROLLER; + + if (first_failed) + { + SLog(server->Cedar, "LS_FARM_CONNECT_3", server->ControllerName, RETRY_CONNECT_TO_CONTROLLER_INTERVAL / 1000); + first_failed = false; + } + } + + Debug("Controller Disconnected. ERROR = %S\n", _E(f->LastError)); + + f->NumFailed = f->NumTry - f->NumConnected; + + // Wait for event + Wait(f->HaltEvent, RETRY_CONNECT_TO_CONTROLLER_INTERVAL); + + if (f->Halt) + { + // Halting flag + break; + } + } + + SLog(server->Cedar, "LS_FARM_DISCONNECT"); +} + +// Disconnect the connection to the controller +void SiStopConnectToController(FARM_CONTROLLER *f) +{ + // Validate arguments + if (f == NULL) + { + return; + } + + f->Halt = true; + + // Stop the connection + Lock(f->lock); + { + Disconnect(f->Sock); + } + Unlock(f->lock); + + Set(f->HaltEvent); + + // Wait for the thread termination + WaitThread(f->Thread, INFINITE); + ReleaseThread(f->Thread); + + DeleteLock(f->lock); + ReleaseEvent(f->HaltEvent); + + Free(f); +} + +// Start a connection to the controller +FARM_CONTROLLER *SiStartConnectToController(SERVER *s) +{ + FARM_CONTROLLER *f; + THREAD *t; + // Validate arguments + if (s == NULL) + { + return NULL; + } + + f = ZeroMalloc(sizeof(FARM_CONTROLLER)); + f->Server = s; + f->LastError = ERR_TRYING_TO_CONNECT; + f->HaltEvent = NewEvent(); + f->lock = NewLock(); + + t = NewThread(SiConnectToControllerThread, f); + WaitThreadInit(t); + ReleaseThread(t); + + return f; +} + +// Get the current version +void SiGetCurrentRegion(CEDAR *c, char *region, UINT region_size) +{ + ClearStr(region, region_size); + // Validate arguments + if (c == NULL || region == NULL) + { + return; + } + + Lock(c->CurrentRegionLock); + { + StrCpy(region, region_size, c->CurrentRegion); + } + Unlock(c->CurrentRegionLock); + + if (IsEmptyStr(region)) + { + if (GetCurrentLangId() == SE_LANG_JAPANESE) + { + StrCpy(region, region_size, "JP"); + } + else if (GetCurrentLangId() == SE_LANG_CHINESE_ZH) + { + StrCpy(region, region_size, "CN"); + } + } +} + +// Check whether some enterprise functions are restricted +// +// ** Hints by Daiyuu Nobori, written on March 19, 2014 ** +// +// The following 'enterprise functions' are implemented on SoftEther VPN Server +// since March 19, 2014. However, these functions are disabled on +// SoftEther VPN Servers which run in Japan and China. +// +// - RADIUS / NT Domain user authentication +// - RSA certificate authentication +// - Deep-inspect packet logging +// - Source IP address control list +// - syslog transfer +// +// The SoftEther VPN Project intentionally disables these functions for users +// in Japan and China. The reason is: Daiyuu Nobori, the chief author of +// SoftEther VPN, has been liable to observe the existing agreements and +// restrictions between him and some companies. The agreements have regulated +// the region-limited restriction to implement and distribute the above +// enterprise functions on the SoftEther VPN open-source program. +// +// Therefore, the SoftEther VPN Project distributes the binary program and +// the source code with the "SiIsEnterpriseFunctionsRestrictedOnOpenSource" +// function. This function identifies whether the SoftEther VPN Server +// program is running in either Japan or China. If the restricted region is +// detected, then the above enterprise functions will be disabled. +// +// Please note that the above restriction has been imposed only on the +// original binaries and source codes from the SoftEther VPN Project. +// Anyone, except Daiyuu Nobori, who understands and writes the C language +// program can remove this restriction at his own risk. +// +bool SiIsEnterpriseFunctionsRestrictedOnOpenSource(CEDAR *c) +{ + char region[128]; + bool ret = false; + // Validate arguments + if (c == NULL) + { + return false; + } + + + SiGetCurrentRegion(c, region, sizeof(region)); + + if (StrCmpi(region, "JP") == 0 || StrCmpi(region, "CN") == 0) + { + ret = true; + } + + return ret; +} + +// Update the current region +void SiUpdateCurrentRegion(CEDAR *c, char *region, bool force_update) +{ + bool changed = false; + // Validate arguments + if (c == NULL) + { + return; + } + + if (IsEmptyStr(region) == false) + { + Lock(c->CurrentRegionLock); + { + if (StrCmpi(c->CurrentRegion, region) != 0) + { + StrCpy(c->CurrentRegion, sizeof(c->CurrentRegion), region); + changed = true; + } + } + Unlock(c->CurrentRegionLock); + } + + if (force_update) + { + changed = true; + } + + if (changed) + { + FlushServerCaps(c->Server); + } +} + +// Create a server +SERVER *SiNewServer(bool bridge) +{ + return SiNewServerEx(bridge, false, false); +} +SERVER *SiNewServerEx(bool bridge, bool in_client_inner_server, bool relay_server) +{ + SERVER *s; + LISTENER *inproc; + LISTENER *azure; + LISTENER *rudp; + + SetGetIpThreadMaxNum(DEFAULT_GETIP_THREAD_MAX_NUM); + + s = ZeroMalloc(sizeof(SERVER)); + + SetEraserCheckInterval(0); + + SiInitHubCreateHistory(s); + + InitServerCapsCache(s); + + Rand(s->MyRandomKey, sizeof(s->MyRandomKey)); + + s->lock = NewLock(); + + + s->OpenVpnSstpConfigLock = NewLock(); + s->SaveCfgLock = NewLock(); + s->ref = NewRef(); + s->Cedar = NewCedar(NULL, NULL); + s->Cedar->Server = s; + + +#ifdef OS_WIN32 + s->IsInVm = MsIsInVm(); +#else // OS_WIN32 + s->IsInVm = UnixIsInVm(); +#endif // OS_WIN32 + +#ifdef ENABLE_AZURE_SERVER + if (IsFileExists("@azureserver.config")) + { + DisableRDUPServerGlobally(); + s->AzureServer = NewAzureServer(s->Cedar); + + SleepThread(500); + } +#endif // ENABLE_AZURE_SERVER + + s->Cedar->CheckExpires = true; + s->ServerListenerList = NewList(CompareServerListener); + s->PortsUDP = NewIntList(true); + s->StartTime = SystemTime64(); + s->TasksFromFarmControllerLock = NewLock(); + + if (bridge) + { + SetCedarVpnBridge(s->Cedar); + } + +#ifdef OS_WIN32 + if (IsHamMode() == false) + { + RegistWindowsFirewallAll(); + } +#endif + + s->Keep = StartKeep(); + + // Log related + MakeDir(bridge == false ? SERVER_LOG_DIR_NAME : BRIDGE_LOG_DIR_NAME); + s->Logger = NewLog(bridge == false ? SERVER_LOG_DIR_NAME : BRIDGE_LOG_DIR_NAME, SERVER_LOG_PERFIX, LOG_SWITCH_DAY); + + SLog(s->Cedar, "L_LINE"); + SLog(s->Cedar, "LS_START_2", s->Cedar->ServerStr, s->Cedar->VerString); + SLog(s->Cedar, "LS_START_3", s->Cedar->BuildInfo); + SLog(s->Cedar, "LS_START_UTF8"); + SLog(s->Cedar, "LS_START_1"); + + + + // Initialize the configuration + SiInitConfiguration(s); + + s->Syslog = NewSysLog(NULL, 0, &s->Cedar->Server->ListenIP); + s->SyslogLock = NewLock(); + + SetFifoCurrentReallocMemSize(MEM_FIFO_REALLOC_MEM_SIZE); + + + // Raise the priority + if (s->NoHighPriorityProcess == false) + { + OSSetHighPriority(); + } + +#ifdef OS_UNIX + UnixSetHighOomScore(); +#endif // OS_UNIX + + if (s->ServerType == SERVER_TYPE_FARM_MEMBER) + { + // Start a connection to the controller + s->FarmController = SiStartConnectToController(s); + } + else if (s->ServerType == SERVER_TYPE_FARM_CONTROLLER) + { + FARM_MEMBER *f; + // Start operating as a controller + s->FarmMemberList = NewList(NULL); + + f = ZeroMalloc(sizeof(FARM_MEMBER)); + f->Cedar = s->Cedar; + GetMachineName(f->hostname, sizeof(f->hostname)); + f->Me = true; + f->HubList = NewList(CompareHubList); + f->Weight = s->Weight; + + s->Me = f; + + Add(s->FarmMemberList, f); + + SiStartFarmControl(s); + + s->FarmControllerInited = true; + } + + // Start a in-processlistener + inproc = NewListener(s->Cedar, LISTENER_INPROC, 0); + ReleaseListener(inproc); + + // Start a listener for Azure + if (s->AzureClient != NULL) + { + azure = NewListener(s->Cedar, LISTENER_REVERSE, 0); + ReleaseListener(azure); + } + + // Start a R-UDP listener + if (s->DisableNatTraversal == false && s->Cedar->Bridge == false) + { + rudp = NewListenerEx4(s->Cedar, LISTENER_RUDP, 0, TCPAcceptedThread, NULL, false, false, + &s->NatTGlobalUdpPort, RAND_PORT_ID_SERVER_LISTEN); + ReleaseListener(rudp); + } + + // Start a VPN-over-ICMP listener + s->DynListenerIcmp = NewDynamicListener(s->Cedar, &s->EnableVpnOverIcmp, LISTENER_ICMP, 0); + + // Start a VPN-over-DNS listener + s->DynListenerDns = NewDynamicListener(s->Cedar, &s->EnableVpnOverDns, LISTENER_DNS, 53); + + + SiInitDeadLockCheck(s); + + SiUpdateCurrentRegion(s->Cedar, "", true); + + return s; +} + diff --git a/src/Cedar/Server.h b/src/Cedar/Server.h index a8a41a37..430632de 100644 --- a/src/Cedar/Server.h +++ b/src/Cedar/Server.h @@ -1,637 +1,637 @@ -// SoftEther VPN Source Code - Developer Edition Master Branch -// Cedar Communication Module - - -// Server.h -// Header of Server.c - -#ifndef SERVER_H -#define SERVER_H - -// Default ports -#define SERVER_DEF_PORTS_1 443 -#define SERVER_DEF_PORTS_2 992 -#define SERVER_DEF_PORTS_3 1194 -#define SERVER_DEF_PORTS_4 GC_DEFAULT_PORT - -#define SERVER_DEF_PORTS_INCLIENT_1 995 -#define SERVER_DEF_PORTS_INCLIENT_2 465 -#define SERVER_DEF_PORTS_INCLIENT_3 9008 // for admin (in client) -#define SERVER_DEF_PORTS_INCLIENT_4 1195 - -#define SERVER_DEF_PORTS_INCLIENT_DYN_MIN 1201 -#define SERVER_DEF_PORTS_INCLIENT_DYN_MAX 1999 - -extern char *SERVER_CONFIG_FILE_NAME; -// This is set to an invalid OpenSSL cipher specification by default. -// The server will default to a list of sane and secure modern ciphers. -#define SERVER_DEFAULT_CIPHER_NAME "~DEFAULT~" -#define SERVER_DEFAULT_CERT_DAYS (365 * 10) -#define SERVER_DEFAULT_HUB_NAME "DEFAULT" -#define SERVER_DEFAULT_BRIDGE_NAME "BRIDGE" -#define SERVER_CONTROL_TCP_TIMEOUT (60 * 1000) -#define SERVER_FARM_CONTROL_INTERVAL (10 * 1000) - -#define SERVER_FILE_SAVE_INTERVAL_DEFAULT (5 * 60 * 1000) -#define SERVER_FILE_SAVE_INTERVAL_MIN (5 * 1000) -#define SERVER_FILE_SAVE_INTERVAL_MAX (3600 * 1000) -#define SERVER_FILE_SAVE_INTERVAL_USERMODE (1 * 60 * 1000) - -#define SERVER_LICENSE_VIOLATION_SPAN (SERVER_FARM_CONTROL_INTERVAL * 2) - - -#define SERVER_DEADLOCK_CHECK_SPAN (2 * 60 * 1000) -#define SERVER_DEADLOCK_CHECK_TIMEOUT (10 * 60 * 1000) - - -#define RETRY_CONNECT_TO_CONTROLLER_INTERVAL (1 * 1000) - -#define MAX_PUBLIC_PORT_NUM 128 - -#define MEMBER_SELECTOR_TXT_FILENAME "$member_selector.config" -#define MEMBER_SELECTOR_CONNECT_TIMEOUT 2000 -#define MEMBER_SELECTOR_DATA_TIMEOUT 5000 - -#define FIRM_SERV_RECV_PACK_MAX_SIZE (100 * 1024 * 1024) - -// Virtual HUB list hosted by each farm member -struct HUB_LIST -{ - struct FARM_MEMBER *FarmMember; // Farm member - bool DynamicHub; // Dynamic HUB - char Name[MAX_HUBNAME_LEN + 1]; // HUB Name - UINT NumSessions; // Number of sessions - UINT NumSessionsClient; // Number of client sessions - UINT NumSessionsBridge; // Number of bridge sessions - UINT NumMacTables; // Number of MAC table entries - UINT NumIpTables; // Number of IP table entries -}; - -// Task -struct FARM_TASK -{ - EVENT *CompleteEvent; // Completion notice - PACK *Request; // Request - PACK *Response; // Response - FARM_MEMBER *FarmMember; // Destination farm member - char TaskName[MAX_PATH]; // Task name - char HostName[MAX_PATH]; // Host name -}; - -// Farm member -struct FARM_MEMBER -{ - CEDAR *Cedar; // Cedar - UINT64 ConnectedTime; // Connection date and time - UINT Me; // Myself - UINT Ip; // IP address - UINT NumPort; // Number of port numbers - UINT *Ports; // Port number - char hostname[MAX_HOST_NAME_LEN + 1]; // Host name - X *ServerCert; // Server certificate - LIST *HubList; // Virtual HUB list - QUEUE *TaskQueue; // Task queue - EVENT *TaskPostEvent; // Task queuing event - UINT Point; // Point - volatile bool Halting; // Stopped - UINT NumSessions; // Number of sessions - UINT MaxSessions; // Maximum number of sessions - UINT NumTcpConnections; // Number of TCP connections - TRAFFIC Traffic; // Traffic information - UINT AssignedClientLicense; // Number of assigned client licenses - UINT AssignedBridgeLicense; // Number of assigned bridge licenses - UINT Weight; // Performance ratio - UCHAR RandomKey[SHA1_SIZE]; // Random number key (license check) - UINT64 SystemId; // System ID (license check) -}; - -// Connection to the farm controller -struct FARM_CONTROLLER -{ - LOCK *lock; // Lock - struct SERVER *Server; // Server - THREAD *Thread; // Thread - SOCK *Sock; // Socket - SESSION *Session; // Session - volatile bool Halt; // Halting flag - EVENT *HaltEvent; // Halting event - UINT LastError; // Last error - bool Online; // Online flag - UINT64 StartedTime; // Connection start time - UINT64 CurrentConnectedTime; // Connection time of this time - UINT64 FirstConnectedTime; // First connection time - UINT NumConnected; // Number of connection count - UINT NumTry; // Number of trials - UINT NumFailed; // Connection failure count - bool IsConnected; // Whether it's connected -}; - -// Server listener -struct SERVER_LISTENER -{ - UINT Port; // Port number - bool Enabled; // Active flag - LISTENER *Listener; // Listener object - bool DisableDos; // Disable the DoS detection -}; - -// Syslog configuration -struct SYSLOG_SETTING -{ - UINT SaveType; // Save type - char Hostname[MAX_HOST_NAME_LEN + 1]; // Host name - UINT Port; // Port number -}; - -// Setting of SSTP and OpenVPN -struct OPENVPN_SSTP_CONFIG -{ - bool EnableOpenVPN; // OpenVPN is enabled - bool EnableSSTP; // SSTP is enabled -}; - -// Server object -struct SERVER -{ - UINT ServerType; // Type of server - UINT UpdatedServerType; // Type of updated server - LIST *ServerListenerList; // Server listener list - LIST *PortsUDP; // The ports used by Proto's UDP listener - UCHAR HashedPassword[SHA1_SIZE]; // Password - char ControllerName[MAX_HOST_NAME_LEN + 1]; // Controller name - UINT ControllerPort; // Controller port - UINT Weight; // Performance ratio - bool ControllerOnly; // Only controller function - UCHAR MemberPassword[SHA1_SIZE]; // Password for farm members - UINT PublicIp; // Public IP - UINT NumPublicPort; // Number of public ports - UINT *PublicPorts; // Public port array - UINT64 StartTime; // Start-up time - UINT AutoSaveConfigSpan; // Auto save interval - UINT AutoSaveConfigSpanSaved; // Auto save interval (stored value) - bool DontBackupConfig; // Do not save a backup of the configuration automatically - bool BackupConfigOnlyWhenModified; // Save a backup of the configuration only if there is a modification - UINT ConfigRevision; // Configuration file revision - bool DisableDosProtection; // Disable the DoS attack protection - UCHAR MyRandomKey[SHA1_SIZE]; // Their own random key - bool FarmControllerInited; // Initialization of farm controller has been completed - bool DisableDeadLockCheck; // Disable the deadlock check - bool UseWebUI; // Use the WebUI - bool SaveDebugLog; // Save the debug log - bool NoSendSignature; // Let the client not to send a signature - bool UseWebTimePage; // Use WebTimePage - bool NoLinuxArpFilter; // Not to set arp_filter in Linux - bool NoHighPriorityProcess; // Not to raise the priority of the process - bool NoDebugDump; // Not to output the debug dump - bool DisableNatTraversal; // Disable the NAT-traversal feature - bool EnableVpnOverIcmp; // VPN over ICMP is enabled - bool EnableVpnOverDns; // VPN over DNS is enabled - bool NoMoreSave; // Do not save any more - bool EnableConditionalAccept; // Apply the Conditional Accept the Listener - bool EnableLegacySSL; // Enable Legacy SSL - bool DisableIPsecAggressiveMode; // Disable IPsec's aggressive mode - - volatile bool Halt; // Halting flag - LOCK *lock; // Lock - REF *ref; // Reference counter - CEDAR *Cedar; // Cedar - CFG_RW *CfgRw; // Configuration file R/W - LOCK *SaveCfgLock; // Settings saving lock - EVENT *SaveHaltEvent; // Saving thread halting event - THREAD *SaveThread; // Settings saving thread - FARM_CONTROLLER *FarmController; // Farm controller - LOCK *TasksFromFarmControllerLock; // Lock while processing tasks from farm controller - LIST *FarmMemberList; // Farm members list - FARM_MEMBER *Me; // Register myself as a farm member - THREAD *FarmControlThread; // Farm control thread - EVENT *FarmControlThreadHaltEvent; // Farm control thread halting event - LIST *HubCreateHistoryList; // Virtual HUB creation history list - - KEEP *Keep; // Maintaining connections - LOG *Logger; // Server logger - ERASER *Eraser; // Eraser - - bool Led; // Use the LED display board - bool LedSpecial; // LED Special - - UINT CurrentTotalNumSessionsOnFarm; // Total number of sessions in this server farm - UINT CurrentAssignedClientLicense; // Current number of assigned client licenses - UINT CurrentAssignedBridgeLicense; // Current number of assigned bridge license - - - LOCK *SyslogLock; // The lock of the syslog configuration - SYSLOG_SETTING SyslogSetting; // Syslog configuration - SLOG *Syslog; // Syslog object - - LOCK *CapsCacheLock; // Lock for Caps cache - CAPSLIST *CapsListCache; // Caps cache - UINT LicenseHash; // Hash value of the license list - - bool SnapshotInited; - EVENT *SnapshotHaltEvent; // Snapshot halting event - volatile bool HaltSnapshot; // Snapshot halting flag - THREAD *SnapshotThread; // Snapshot thread - LOG *SnapshotLogger; // Snapshot logger - UINT64 LastSnapshotTime; // Time that the last snapshot created - - THREAD *DeadLockCheckThread; // Deadlock check thread - volatile bool HaltDeadLockThread; // Halting flag - EVENT *DeadLockWaitEvent; // Waiting Event - - PROTO *Proto; // Protocols handler - IPSEC_SERVER *IPsecServer; // IPsec server function - DDNS_CLIENT *DDnsClient; // DDNS client feature - LOCK *OpenVpnSstpConfigLock; // Lock OpenVPN and SSTP configuration - - AZURE_CLIENT *AzureClient; // VPN Azure client - bool EnableVpnAzure; // Flag whether VPN Azure client is enabled - - bool DisableGetHostNameWhenAcceptTcp; // Disable GetHostName when accepting TCP - bool DisableCoreDumpOnUnix; // Disable core dump on UNIX - - TINY_LOG *DebugLog; // Debug log - - DYNAMIC_LISTENER *DynListenerIcmp; // VPN over ICMP listener - DYNAMIC_LISTENER *DynListenerDns; // VPN over DNS listener - - bool IPsecMessageDisplayed; // Flag for whether the message about IPsec is displayed - - bool IsInVm; // Whether I'm within the VM - - - - volatile UINT NatTGlobalUdpPort; // NAT-T global UDP port - - IP ListenIP; // Listen IP - bool StrictSyslogDatetimeFormat; // Make syslog datetime format strict RFC3164 - bool DisableJsonRpcWebApi; // Disable JSON-RPC Web API -}; - - -// Enumerate sessions * -struct RPC_ENUM_SESSION -{ - char HubName[MAX_HUBNAME_LEN + 1]; // HUB Name - UINT NumSession; // Number of sessions - struct RPC_ENUM_SESSION_ITEM *Sessions; // Session list -}; - -// Session status * -struct RPC_SESSION_STATUS -{ - char HubName[MAX_HUBNAME_LEN + 1]; // HUB Name - char Name[MAX_SESSION_NAME_LEN + 1]; // Session name - char Username[MAX_USERNAME_LEN + 1]; // User name - char RealUsername[MAX_USERNAME_LEN + 1]; // Real user name - char GroupName[MAX_USERNAME_LEN + 1]; // Group name - bool LinkMode; // Link mode - RPC_CLIENT_GET_CONNECTION_STATUS Status; // Status - UINT ClientIp; // Client IP address - UCHAR ClientIp6[16]; // Client IPv6 address - IP ClientIpAddress; // Client IP address (IPv4/IPv6) - char ClientHostName[MAX_HOST_NAME_LEN + 1]; // Client host name - NODE_INFO NodeInfo; // Node information -}; - - -// Type of server -#define SERVER_TYPE_STANDALONE 0 // Stand-alone server -#define SERVER_TYPE_FARM_CONTROLLER 1 // Farm controller server -#define SERVER_TYPE_FARM_MEMBER 2 // Farm member server - - -// Caps related -struct CAPS -{ - char *Name; // Name - UINT Value; // Value -}; -struct CAPSLIST -{ - LIST *CapsList; // Caps list -}; - -// Log file -struct LOG_FILE -{ - char Path[MAX_PATH]; // Path name - char ServerName[MAX_HOST_NAME_LEN + 1]; // Server name - UINT FileSize; // File size - UINT64 UpdatedTime; // Updating date -}; - - -// Global server flags -#define NUM_GLOBAL_SERVER_FLAGS 128 -#define GSF_DISABLE_PUSH_ROUTE 1 -#define GSF_DISABLE_RADIUS_AUTH 2 -#define GSF_DISABLE_CERT_AUTH 3 -#define GSF_DISABLE_DEEP_LOGGING 4 -#define GSF_DISABLE_AC 5 -#define GSF_DISABLE_SYSLOG 6 -#define GSF_SHOW_OSS_MSG 7 -#define GSF_LOCALBRIDGE_NO_DISABLE_OFFLOAD 8 -#define GSF_DISABLE_SESSION_RECONNECT 9 - -// Global parameters -#define NUM_GLOBAL_PARAMS 128 -#define GP_MAX_SEND_SOCKET_QUEUE_SIZE 1 -#define GP_MIN_SEND_SOCKET_QUEUE_SIZE 2 -#define GP_MAX_SEND_SOCKET_QUEUE_NUM 3 -#define GP_SELECT_TIME 4 -#define GP_SELECT_TIME_FOR_NAT 5 -#define GP_MAX_STORED_QUEUE_NUM 6 -#define GP_MAX_BUFFERING_PACKET_SIZE 7 -#define GP_HUB_ARP_SEND_INTERVAL 8 -#define GP_MAC_TABLE_EXPIRE_TIME 9 -#define GP_IP_TABLE_EXPIRE_TIME 10 -#define GP_IP_TABLE_EXPIRE_TIME_DHCP 11 -#define GP_STORM_CHECK_SPAN 12 -#define GP_STORM_DISCARD_VALUE_START 13 -#define GP_STORM_DISCARD_VALUE_END 14 -#define GP_MAX_MAC_TABLES 15 -#define GP_MAX_IP_TABLES 16 -#define GP_MAX_HUB_LINKS 17 -#define GP_MEM_FIFO_REALLOC_MEM_SIZE 18 -#define GP_QUEUE_BUDGET 19 -#define GP_FIFO_BUDGET 20 - -extern UINT vpn_global_parameters[NUM_GLOBAL_PARAMS]; - -#define VPN_GP(id, default_value) ((UINT)(vpn_global_parameters[(id)] != 0 ? vpn_global_parameters[(id)] : (default_value))) - - - -// Virtual HUB creation history -struct SERVER_HUB_CREATE_HISTORY -{ - char HubName[MAX_HUBNAME_LEN + 1]; - UINT64 CreatedTime; -}; - -// Function prototype declaration -SERVER *SiNewServer(bool bridge); -SERVER *SiNewServerEx(bool bridge, bool in_client_inner_server, bool relay_server); -void SiReleaseServer(SERVER *s); -void SiCleanupServer(SERVER *s); -void StStartServer(bool bridge); -void StStopServer(); -void SiInitConfiguration(SERVER *s); -void SiFreeConfiguration(SERVER *s); -UINT SiWriteConfigurationFile(SERVER *s); -void SiLoadInitialConfiguration(SERVER *s); -bool SiLoadConfigurationFile(SERVER *s); -bool SiLoadConfigurationFileMain(SERVER *s, FOLDER *root); -void SiInitDefaultServerCert(SERVER *s); -void SiInitCipherName(SERVER *s); -void SiGenerateDefaultCert(X **server_x, K **server_k); -void SiGenerateDefaultCertEx(X **server_x, K **server_k, char *common_name); -void SiInitListenerList(SERVER *s); -void SiLockListenerList(SERVER *s); -void SiUnlockListenerList(SERVER *s); -bool SiAddListener(SERVER *s, UINT port, bool enabled); -bool SiAddListenerEx(SERVER *s, UINT port, bool enabled, bool disable_dos); -bool SiEnableListener(SERVER *s, UINT port); -bool SiDisableListener(SERVER *s, UINT port); -bool SiDeleteListener(SERVER *s, UINT port); -SERVER_LISTENER *SiGetListener(SERVER *s, UINT port); -int CompareServerListener(void *p1, void *p2); -void SiStopAllListener(SERVER *s); -void SiInitDefaultHubList(SERVER *s); -void SiSetDefaultHubOption(HUB_OPTION *o); -FOLDER *SiWriteConfigurationToCfg(SERVER *s); -bool SiLoadConfigurationCfg(SERVER *s, FOLDER *root); -void SiWriteLocalBridges(FOLDER *f, SERVER *s); -void SiLoadLocalBridges(SERVER *s, FOLDER *f); -void SiWriteLocalBridgeCfg(FOLDER *f, LOCALBRIDGE *br); -void SiLoadLocalBridgeCfg(SERVER *s, FOLDER *f); -void SiWriteListeners(FOLDER *f, SERVER *s); -void SiLoadListeners(SERVER *s, FOLDER *f); -void SiWriteListenerCfg(FOLDER *f, SERVER_LISTENER *r); -void SiLoadListenerCfg(SERVER *s, FOLDER *f); -void SiWriteServerCfg(FOLDER *f, SERVER *s); -void SiLoadServerCfg(SERVER *s, FOLDER *f); -void SiWriteGlobalParamsCfg(FOLDER *f); -void SiLoadGlobalParamsCfg(FOLDER *f); -void SiLoadGlobalParamItem(UINT id, UINT value); -void SiLoadProtoCfg(PROTO *p, FOLDER *f); -void SiWriteProtoCfg(FOLDER *f, PROTO *p); -void SiWriteTraffic(FOLDER *parent, char *name, TRAFFIC *t); -void SiWriteTrafficInner(FOLDER *parent, char *name, TRAFFIC_ENTRY *e); -void SiLoadTrafficInner(FOLDER *parent, char *name, TRAFFIC_ENTRY *e); -void SiLoadTraffic(FOLDER *parent, char *name, TRAFFIC *t); -void SiSaverThread(THREAD *thread, void *param); -void SiLoadLicenseManager(SERVER *s, FOLDER *f); -void SiWriteLicenseManager(FOLDER *f, SERVER *s); -void SiLoadL3Switchs(SERVER *s, FOLDER *f); -void SiLoadL3SwitchCfg(L3SW *sw, FOLDER *f); -void SiWriteL3Switchs(FOLDER *f, SERVER *s); -void SiWriteL3SwitchCfg(FOLDER *f, L3SW *sw); -void SiLoadIPsec(SERVER *s, FOLDER *f); -void SiWriteIPsec(FOLDER *f, SERVER *s); -void SiWriteHubs(FOLDER *f, SERVER *s); -void SiLoadHubs(SERVER *s, FOLDER *f); -void SiWriteHubCfg(FOLDER *f, HUB *h); -void SiLoadHubCfg(SERVER *s, FOLDER *f, char *name); -void SiLoadHubLogCfg(HUB_LOG *g, FOLDER *f); -void SiWriteHubOptionCfg(FOLDER *f, HUB_OPTION *o); -void SiWriteHubLogCfg(FOLDER *f, HUB_LOG *g); -void SiWriteHubLogCfgEx(FOLDER *f, HUB_LOG *g, bool el_mode); -void SiLoadHubOptionCfg(FOLDER *f, HUB_OPTION *o); -void SiWriteHubLinks(FOLDER *f, HUB *h); -void SiLoadHubLinks(HUB *h, FOLDER *f); -void SiWriteHubAdminOptions(FOLDER *f, HUB *h); -void SiLoadHubAdminOptions(HUB *h, FOLDER *f); -void SiWriteHubLinkCfg(FOLDER *f, LINK *k); -void SiLoadHubLinkCfg(FOLDER *f, HUB *h); -void SiWriteHubAccessLists(FOLDER *f, HUB *h); -void SiLoadHubAccessLists(HUB *h, FOLDER *f); -void SiWriteHubAccessCfg(FOLDER *f, ACCESS *a); -void SiLoadHubAccessCfg(HUB *h, FOLDER *f); -void SiWriteHubDb(FOLDER *f, HUBDB *db, bool no_save_ac_list); -void SiLoadHubDb(HUB *h, FOLDER *f); -void SiWriteUserList(FOLDER *f, LIST *o); -void SiLoadUserList(HUB *h, FOLDER *f); -void SiWriteUserCfg(FOLDER *f, USER *u); -void SiLoadUserCfg(HUB *h, FOLDER *f); -void SiWriteGroupList(FOLDER *f, LIST *o); -void SiLoadGroupList(HUB *h, FOLDER *f); -void SiWriteGroupCfg(FOLDER *f, USERGROUP *g); -void SiLoadGroupCfg(HUB *h, FOLDER *f); -void SiWriteCertList(FOLDER *f, LIST *o); -void SiLoadCertList(LIST *o, FOLDER *f); -void SiWriteCrlList(FOLDER *f, LIST *o); -void SiLoadCrlList(LIST *o, FOLDER *f); -void SiWriteAcList(FOLDER *f, LIST *o); -void SiLoadAcList(LIST *o, FOLDER *f); -void SiWritePolicyCfg(FOLDER *f, POLICY *p, bool cascade_mode); -void SiLoadPolicyCfg(POLICY *p, FOLDER *f); -void SiLoadSecureNAT(HUB *h, FOLDER *f); -void SiWriteSecureNAT(HUB *h, FOLDER *f); -void SiRebootServerEx(bool bridge, bool reset_setting); -void SiRebootServer(bool bridge); -void SiRebootServerThread(THREAD *thread, void *param); -void StInit(); -void StFree(); -void SiSetServerType(SERVER *s, UINT type, - UINT ip, UINT num_port, UINT *ports, - char *controller_name, UINT controller_port, UCHAR *password, UINT weight, bool controller_only); -FARM_CONTROLLER *SiStartConnectToController(SERVER *s); -void SiStopConnectToController(FARM_CONTROLLER *f); -void SiFarmServ(SERVER *server, SOCK *sock, X *cert, UINT ip, UINT num_port, UINT *ports, char *hostname, UINT point, UINT weight, UINT max_sessions); -int CompareHubList(void *p1, void *p2); -void SiFarmServMain(SERVER *server, SOCK *sock, FARM_MEMBER *f); -FARM_TASK *SiFarmServPostTask(FARM_MEMBER *f, PACK *request); -PACK *SiFarmServWaitTask(FARM_TASK *t); -PACK *SiExecTask(FARM_MEMBER *f, PACK *p); -PACK *SiCallTask(FARM_MEMBER *f, PACK *p, char *taskname); -void SiAcceptTasksFromController(FARM_CONTROLLER *f, SOCK *sock); -void SiAcceptTasksFromControllerMain(FARM_CONTROLLER *f, SOCK *sock); -PACK *SiCalledTask(FARM_CONTROLLER *f, PACK *p, char *taskname); -void SiHubOnlineProc(HUB *h); -void SiHubOfflineProc(HUB *h); -FARM_MEMBER *SiGetNextFarmMember(SERVER *s, CONNECTION *c, HUB *h); -bool SiGetMemberSelectorUrl(char *url, UINT url_size); -void SiCallCreateHub(SERVER *s, FARM_MEMBER *f, HUB *h); -void SiCallUpdateHub(SERVER *s, FARM_MEMBER *f, HUB *h); -void SiCallDeleteHub(SERVER *s, FARM_MEMBER *f, HUB *h); -void SiCallEnumSession(SERVER *s, FARM_MEMBER *f, char *hubname, RPC_ENUM_SESSION *t); -void SiCallEnumNat(SERVER *s, FARM_MEMBER *f, char *hubname, RPC_ENUM_NAT *t); -void SiCallEnumDhcp(SERVER *s, FARM_MEMBER *f, char *hubname, RPC_ENUM_DHCP *t); -void SiCallGetNatStatus(SERVER *s, FARM_MEMBER *f, char *hubname, RPC_NAT_STATUS *t); -void SiCallEnumMacTable(SERVER *s, FARM_MEMBER *f, char *hubname, RPC_ENUM_MAC_TABLE *t); -void SiCallEnumIpTable(SERVER *s, FARM_MEMBER *f, char *hubname, RPC_ENUM_IP_TABLE *t); -void SiCallDeleteSession(SERVER *s, FARM_MEMBER *f, char *hubname, char *session_name); -void SiCallCreateTicket(SERVER *s, FARM_MEMBER *f, char *hubname, char *username, char *realusername, POLICY *policy, UCHAR *ticket, UINT counter, char *groupname); -void SiCallDeleteMacTable(SERVER *s, FARM_MEMBER *f, char *hubname, UINT key); -void SiCallDeleteIpTable(SERVER *s, FARM_MEMBER *f, char *hubname, UINT key); -void SiCalledCreateHub(SERVER *s, PACK *p); -void SiCalledUpdateHub(SERVER *s, PACK *p); -void SiCalledDeleteHub(SERVER *s, PACK *p); -void SiCalledDeleteSession(SERVER *s, PACK *p); -void SiCalledDeleteMacTable(SERVER *s, PACK *p); -void SiCalledDeleteIpTable(SERVER *s, PACK *p); -PACK *SiCalledCreateTicket(SERVER *s, PACK *p); -PACK *SiCalledEnumSession(SERVER *s, PACK *p); -PACK *SiCalledEnumNat(SERVER *s, PACK *p); -PACK *SiCalledEnumDhcp(SERVER *s, PACK *p); -PACK *SiCalledGetNatStatus(SERVER *s, PACK *p); -PACK *SiCalledEnumMacTable(SERVER *s, PACK *p); -PACK *SiCalledEnumIpTable(SERVER *s, PACK *p); -void SiCalledEnumHub(SERVER *s, PACK *p, PACK *req); -void SiPackAddCreateHub(PACK *p, HUB *h); -FARM_MEMBER *SiGetHubHostingMember(SERVER *s, HUB *h, bool admin_mode, CONNECTION *c); -void SiCallEnumHub(SERVER *s, FARM_MEMBER *f); -void SiStartFarmControl(SERVER *s); -void SiStopFarmControl(SERVER *s); -void SiFarmControlThread(THREAD *thread, void *param); -void SiAccessListToPack(PACK *p, LIST *o); -void SiAccessToPack(PACK *p, ACCESS *a, UINT i, UINT total); -ACCESS *SiPackToAccess(PACK *p, UINT i); -UINT SiNumAccessFromPack(PACK *p); -void SiHubUpdateProc(HUB *h); -bool SiCheckTicket(HUB *h, UCHAR *ticket, char *username, UINT username_size, char *usernamereal, UINT usernamereal_size, POLICY *policy, char *sessionname, UINT sessionname_size, char *groupname, UINT groupname_size); -UINT SiGetPoint(SERVER *s); -UINT SiCalcPoint(SERVER *s, UINT num, UINT weight); -bool SiCallGetSessionStatus(SERVER *s, FARM_MEMBER *f, RPC_SESSION_STATUS *t); -PACK *SiCalledGetSessionStatus(SERVER *s, PACK *p); -bool SiCallEnumLogFileList(SERVER *s, FARM_MEMBER *f, RPC_ENUM_LOG_FILE *t, char *hubname); -PACK *SiCalledEnumLogFileList(SERVER *s, PACK *p); -bool SiCallReadLogFile(SERVER *s, FARM_MEMBER *f, RPC_READ_LOG_FILE *t); -PACK *SiCalledReadLogFile(SERVER *s, PACK *p); -int CmpLogFile(void *p1, void *p2); -LIST *EnumLogFile(char *hubname); -void EnumLogFileDir(LIST *o, char *dirname); -void FreeEnumLogFile(LIST *o); -bool CheckLogFileNameFromEnumList(LIST *o, char *name, char *server_name); -void IncrementServerConfigRevision(SERVER *s); -void GetServerProductName(SERVER *s, char *name, UINT size); -void GetServerProductNameInternal(SERVER *s, char *name, UINT size); - - -void SiSetSysLogSetting(SERVER *s, SYSLOG_SETTING *setting); -void SiGetSysLogSetting(SERVER *s, SYSLOG_SETTING *setting); -void SiWriteSysLog(SERVER *s, char *typestr, char *hubname, wchar_t *message); -UINT SiGetSysLogSaveStatus(SERVER *s); -void SiInitDeadLockCheck(SERVER *s); -void SiFreeDeadLockCheck(SERVER *s); -void SiDeadLockCheckThread(THREAD *t, void *param); -void SiCheckDeadLockMain(SERVER *s, UINT timeout); -void SiDebugLog(SERVER *s, char *msg); -UINT SiDebug(SERVER *s, RPC_TEST *ret, UINT i, char *str); -UINT SiDebugProcHelloWorld(SERVER *s, char *in_str, char *ret_str, UINT ret_str_size); -UINT SiDebugProcExit(SERVER *s, char *in_str, char *ret_str, UINT ret_str_size); -UINT SiDebugProcDump(SERVER *s, char *in_str, char *ret_str, UINT ret_str_size); -UINT SiDebugProcRestorePriority(SERVER *s, char *in_str, char *ret_str, UINT ret_str_size); -UINT SiDebugProcSetHighPriority(SERVER *s, char *in_str, char *ret_str, UINT ret_str_size); -UINT SiDebugProcGetExeFileName(SERVER *s, char *in_str, char *ret_str, UINT ret_str_size); -UINT SiDebugProcCrash(SERVER *s, char *in_str, char *ret_str, UINT ret_str_size); -UINT SiDebugProcGetIPsecMessageDisplayedValue(SERVER *s, char *in_str, char *ret_str, UINT ret_str_size); -UINT SiDebugProcSetIPsecMessageDisplayedValue(SERVER *s, char *in_str, char *ret_str, UINT ret_str_size); -UINT SiDebugProcGetVgsMessageDisplayedValue(SERVER *s, char *in_str, char *ret_str, UINT ret_str_size); -UINT SiDebugProcSetVgsMessageDisplayedValue(SERVER *s, char *in_str, char *ret_str, UINT ret_str_size); -UINT SiDebugProcGetCurrentTcpSendQueueLength(SERVER *s, char *in_str, char *ret_str, UINT ret_str_size); -UINT SiDebugProcGetCurrentGetIPThreadCount(SERVER *s, char *in_str, char *ret_str, UINT ret_str_size); - -typedef UINT (SI_DEBUG_PROC)(SERVER *s, char *in_str, char *ret_str, UINT ret_str_size); - -CAPS *NewCaps(char *name, UINT value); -void FreeCaps(CAPS *c); -CAPSLIST *NewCapsList(); -int CompareCaps(void *p1, void *p2); -void AddCaps(CAPSLIST *caps, CAPS *c); -CAPS *GetCaps(CAPSLIST *caps, char *name); -void FreeCapsList(CAPSLIST *caps); -bool GetCapsBool(CAPSLIST *caps, char *name); -UINT GetCapsInt(CAPSLIST *caps, char *name); -void AddCapsBool(CAPSLIST *caps, char *name, bool b); -void AddCapsInt(CAPSLIST *caps, char *name, UINT i); -void InRpcCapsList(CAPSLIST *t, PACK *p); -void OutRpcCapsList(PACK *p, CAPSLIST *t); -void FreeRpcCapsList(CAPSLIST *t); -void InitCapsList(CAPSLIST *t); -void InRpcSysLogSetting(SYSLOG_SETTING *t, PACK *p); -void OutRpcSysLogSetting(PACK *p, SYSLOG_SETTING *t); - -void GetServerCaps(SERVER *s, CAPSLIST *t); -void FlushServerCaps(SERVER *s); -bool GetServerCapsBool(SERVER *s, char *name); -UINT GetServerCapsInt(SERVER *s, char *name); -void GetServerCapsMain(SERVER *s, CAPSLIST *t); -void InitServerCapsCache(SERVER *s); -void FreeServerCapsCache(SERVER *s); -void DestroyServerCapsCache(SERVER *s); - -void SetGlobalServerFlag(UINT index, UINT value); -UINT GetGlobalServerFlag(UINT index); -void UpdateGlobalServerFlags(SERVER *s, CAPSLIST *t); - - -bool IsAdminPackSupportedServerProduct(char *name); - -void SiInitHubCreateHistory(SERVER *s); -void SiFreeHubCreateHistory(SERVER *s); -void SiDeleteOldHubCreateHistory(SERVER *s); -void SiAddHubCreateHistory(SERVER *s, char *name); -void SiDelHubCreateHistory(SERVER *s, char *name); -bool SiIsHubRegistedOnCreateHistory(SERVER *s, char *name); - -bool SiTooManyUserObjectsInServer(SERVER *s, bool oneMore); - -bool SiCanOpenVpnOverDnsPort(); -bool SiCanOpenVpnOverIcmpPort(); -void SiApplySpecialListenerStatus(SERVER *s); - -bool SiIsAzureEnabled(SERVER *s); -bool SiIsAzureSupported(SERVER *s); -void SiApplyAzureConfig(SERVER *s, DDNS_CLIENT_STATUS *ddns_status); -void SiSetAzureEnable(SERVER *s, bool enabled); - -void SiUpdateCurrentRegion(CEDAR *c, char *region, bool force_update); -void SiGetCurrentRegion(CEDAR *c, char *region, UINT region_size); -bool SiIsEnterpriseFunctionsRestrictedOnOpenSource(CEDAR *c); - -#endif // SERVER_H - - - +// SoftEther VPN Source Code - Developer Edition Master Branch +// Cedar Communication Module + + +// Server.h +// Header of Server.c + +#ifndef SERVER_H +#define SERVER_H + +// Default ports +#define SERVER_DEF_PORTS_1 443 +#define SERVER_DEF_PORTS_2 992 +#define SERVER_DEF_PORTS_3 1194 +#define SERVER_DEF_PORTS_4 GC_DEFAULT_PORT + +#define SERVER_DEF_PORTS_INCLIENT_1 995 +#define SERVER_DEF_PORTS_INCLIENT_2 465 +#define SERVER_DEF_PORTS_INCLIENT_3 9008 // for admin (in client) +#define SERVER_DEF_PORTS_INCLIENT_4 1195 + +#define SERVER_DEF_PORTS_INCLIENT_DYN_MIN 1201 +#define SERVER_DEF_PORTS_INCLIENT_DYN_MAX 1999 + +extern char *SERVER_CONFIG_FILE_NAME; +// This is set to an invalid OpenSSL cipher specification by default. +// The server will default to a list of sane and secure modern ciphers. +#define SERVER_DEFAULT_CIPHER_NAME "~DEFAULT~" +#define SERVER_DEFAULT_CERT_DAYS (365 * 10) +#define SERVER_DEFAULT_HUB_NAME "DEFAULT" +#define SERVER_DEFAULT_BRIDGE_NAME "BRIDGE" +#define SERVER_CONTROL_TCP_TIMEOUT (60 * 1000) +#define SERVER_FARM_CONTROL_INTERVAL (10 * 1000) + +#define SERVER_FILE_SAVE_INTERVAL_DEFAULT (5 * 60 * 1000) +#define SERVER_FILE_SAVE_INTERVAL_MIN (5 * 1000) +#define SERVER_FILE_SAVE_INTERVAL_MAX (3600 * 1000) +#define SERVER_FILE_SAVE_INTERVAL_USERMODE (1 * 60 * 1000) + +#define SERVER_LICENSE_VIOLATION_SPAN (SERVER_FARM_CONTROL_INTERVAL * 2) + + +#define SERVER_DEADLOCK_CHECK_SPAN (2 * 60 * 1000) +#define SERVER_DEADLOCK_CHECK_TIMEOUT (10 * 60 * 1000) + + +#define RETRY_CONNECT_TO_CONTROLLER_INTERVAL (1 * 1000) + +#define MAX_PUBLIC_PORT_NUM 128 + +#define MEMBER_SELECTOR_TXT_FILENAME "$member_selector.config" +#define MEMBER_SELECTOR_CONNECT_TIMEOUT 2000 +#define MEMBER_SELECTOR_DATA_TIMEOUT 5000 + +#define FIRM_SERV_RECV_PACK_MAX_SIZE (100 * 1024 * 1024) + +// Virtual HUB list hosted by each farm member +struct HUB_LIST +{ + struct FARM_MEMBER *FarmMember; // Farm member + bool DynamicHub; // Dynamic HUB + char Name[MAX_HUBNAME_LEN + 1]; // HUB Name + UINT NumSessions; // Number of sessions + UINT NumSessionsClient; // Number of client sessions + UINT NumSessionsBridge; // Number of bridge sessions + UINT NumMacTables; // Number of MAC table entries + UINT NumIpTables; // Number of IP table entries +}; + +// Task +struct FARM_TASK +{ + EVENT *CompleteEvent; // Completion notice + PACK *Request; // Request + PACK *Response; // Response + FARM_MEMBER *FarmMember; // Destination farm member + char TaskName[MAX_PATH]; // Task name + char HostName[MAX_PATH]; // Host name +}; + +// Farm member +struct FARM_MEMBER +{ + CEDAR *Cedar; // Cedar + UINT64 ConnectedTime; // Connection date and time + UINT Me; // Myself + UINT Ip; // IP address + UINT NumPort; // Number of port numbers + UINT *Ports; // Port number + char hostname[MAX_HOST_NAME_LEN + 1]; // Host name + X *ServerCert; // Server certificate + LIST *HubList; // Virtual HUB list + QUEUE *TaskQueue; // Task queue + EVENT *TaskPostEvent; // Task queuing event + UINT Point; // Point + volatile bool Halting; // Stopped + UINT NumSessions; // Number of sessions + UINT MaxSessions; // Maximum number of sessions + UINT NumTcpConnections; // Number of TCP connections + TRAFFIC Traffic; // Traffic information + UINT AssignedClientLicense; // Number of assigned client licenses + UINT AssignedBridgeLicense; // Number of assigned bridge licenses + UINT Weight; // Performance ratio + UCHAR RandomKey[SHA1_SIZE]; // Random number key (license check) + UINT64 SystemId; // System ID (license check) +}; + +// Connection to the farm controller +struct FARM_CONTROLLER +{ + LOCK *lock; // Lock + struct SERVER *Server; // Server + THREAD *Thread; // Thread + SOCK *Sock; // Socket + SESSION *Session; // Session + volatile bool Halt; // Halting flag + EVENT *HaltEvent; // Halting event + UINT LastError; // Last error + bool Online; // Online flag + UINT64 StartedTime; // Connection start time + UINT64 CurrentConnectedTime; // Connection time of this time + UINT64 FirstConnectedTime; // First connection time + UINT NumConnected; // Number of connection count + UINT NumTry; // Number of trials + UINT NumFailed; // Connection failure count + bool IsConnected; // Whether it's connected +}; + +// Server listener +struct SERVER_LISTENER +{ + UINT Port; // Port number + bool Enabled; // Active flag + LISTENER *Listener; // Listener object + bool DisableDos; // Disable the DoS detection +}; + +// Syslog configuration +struct SYSLOG_SETTING +{ + UINT SaveType; // Save type + char Hostname[MAX_HOST_NAME_LEN + 1]; // Host name + UINT Port; // Port number +}; + +// Setting of SSTP and OpenVPN +struct OPENVPN_SSTP_CONFIG +{ + bool EnableOpenVPN; // OpenVPN is enabled + bool EnableSSTP; // SSTP is enabled +}; + +// Server object +struct SERVER +{ + UINT ServerType; // Type of server + UINT UpdatedServerType; // Type of updated server + LIST *ServerListenerList; // Server listener list + LIST *PortsUDP; // The ports used by Proto's UDP listener + UCHAR HashedPassword[SHA1_SIZE]; // Password + char ControllerName[MAX_HOST_NAME_LEN + 1]; // Controller name + UINT ControllerPort; // Controller port + UINT Weight; // Performance ratio + bool ControllerOnly; // Only controller function + UCHAR MemberPassword[SHA1_SIZE]; // Password for farm members + UINT PublicIp; // Public IP + UINT NumPublicPort; // Number of public ports + UINT *PublicPorts; // Public port array + UINT64 StartTime; // Start-up time + UINT AutoSaveConfigSpan; // Auto save interval + UINT AutoSaveConfigSpanSaved; // Auto save interval (stored value) + bool DontBackupConfig; // Do not save a backup of the configuration automatically + bool BackupConfigOnlyWhenModified; // Save a backup of the configuration only if there is a modification + UINT ConfigRevision; // Configuration file revision + bool DisableDosProtection; // Disable the DoS attack protection + UCHAR MyRandomKey[SHA1_SIZE]; // Their own random key + bool FarmControllerInited; // Initialization of farm controller has been completed + bool DisableDeadLockCheck; // Disable the deadlock check + bool UseWebUI; // Use the WebUI + bool SaveDebugLog; // Save the debug log + bool NoSendSignature; // Let the client not to send a signature + bool UseWebTimePage; // Use WebTimePage + bool NoLinuxArpFilter; // Not to set arp_filter in Linux + bool NoHighPriorityProcess; // Not to raise the priority of the process + bool NoDebugDump; // Not to output the debug dump + bool DisableNatTraversal; // Disable the NAT-traversal feature + bool EnableVpnOverIcmp; // VPN over ICMP is enabled + bool EnableVpnOverDns; // VPN over DNS is enabled + bool NoMoreSave; // Do not save any more + bool EnableConditionalAccept; // Apply the Conditional Accept the Listener + bool EnableLegacySSL; // Enable Legacy SSL + bool DisableIPsecAggressiveMode; // Disable IPsec's aggressive mode + + volatile bool Halt; // Halting flag + LOCK *lock; // Lock + REF *ref; // Reference counter + CEDAR *Cedar; // Cedar + CFG_RW *CfgRw; // Configuration file R/W + LOCK *SaveCfgLock; // Settings saving lock + EVENT *SaveHaltEvent; // Saving thread halting event + THREAD *SaveThread; // Settings saving thread + FARM_CONTROLLER *FarmController; // Farm controller + LOCK *TasksFromFarmControllerLock; // Lock while processing tasks from farm controller + LIST *FarmMemberList; // Farm members list + FARM_MEMBER *Me; // Register myself as a farm member + THREAD *FarmControlThread; // Farm control thread + EVENT *FarmControlThreadHaltEvent; // Farm control thread halting event + LIST *HubCreateHistoryList; // Virtual HUB creation history list + + KEEP *Keep; // Maintaining connections + LOG *Logger; // Server logger + ERASER *Eraser; // Eraser + + bool Led; // Use the LED display board + bool LedSpecial; // LED Special + + UINT CurrentTotalNumSessionsOnFarm; // Total number of sessions in this server farm + UINT CurrentAssignedClientLicense; // Current number of assigned client licenses + UINT CurrentAssignedBridgeLicense; // Current number of assigned bridge license + + + LOCK *SyslogLock; // The lock of the syslog configuration + SYSLOG_SETTING SyslogSetting; // Syslog configuration + SLOG *Syslog; // Syslog object + + LOCK *CapsCacheLock; // Lock for Caps cache + CAPSLIST *CapsListCache; // Caps cache + UINT LicenseHash; // Hash value of the license list + + bool SnapshotInited; + EVENT *SnapshotHaltEvent; // Snapshot halting event + volatile bool HaltSnapshot; // Snapshot halting flag + THREAD *SnapshotThread; // Snapshot thread + LOG *SnapshotLogger; // Snapshot logger + UINT64 LastSnapshotTime; // Time that the last snapshot created + + THREAD *DeadLockCheckThread; // Deadlock check thread + volatile bool HaltDeadLockThread; // Halting flag + EVENT *DeadLockWaitEvent; // Waiting Event + + PROTO *Proto; // Protocols handler + IPSEC_SERVER *IPsecServer; // IPsec server function + DDNS_CLIENT *DDnsClient; // DDNS client feature + LOCK *OpenVpnSstpConfigLock; // Lock OpenVPN and SSTP configuration + + AZURE_CLIENT *AzureClient; // VPN Azure client + bool EnableVpnAzure; // Flag whether VPN Azure client is enabled + + bool DisableGetHostNameWhenAcceptTcp; // Disable GetHostName when accepting TCP + bool DisableCoreDumpOnUnix; // Disable core dump on UNIX + + TINY_LOG *DebugLog; // Debug log + + DYNAMIC_LISTENER *DynListenerIcmp; // VPN over ICMP listener + DYNAMIC_LISTENER *DynListenerDns; // VPN over DNS listener + + bool IPsecMessageDisplayed; // Flag for whether the message about IPsec is displayed + + bool IsInVm; // Whether I'm within the VM + + + + volatile UINT NatTGlobalUdpPort; // NAT-T global UDP port + + IP ListenIP; // Listen IP + bool StrictSyslogDatetimeFormat; // Make syslog datetime format strict RFC3164 + bool DisableJsonRpcWebApi; // Disable JSON-RPC Web API +}; + + +// Enumerate sessions * +struct RPC_ENUM_SESSION +{ + char HubName[MAX_HUBNAME_LEN + 1]; // HUB Name + UINT NumSession; // Number of sessions + struct RPC_ENUM_SESSION_ITEM *Sessions; // Session list +}; + +// Session status * +struct RPC_SESSION_STATUS +{ + char HubName[MAX_HUBNAME_LEN + 1]; // HUB Name + char Name[MAX_SESSION_NAME_LEN + 1]; // Session name + char Username[MAX_USERNAME_LEN + 1]; // User name + char RealUsername[MAX_USERNAME_LEN + 1]; // Real user name + char GroupName[MAX_USERNAME_LEN + 1]; // Group name + bool LinkMode; // Link mode + RPC_CLIENT_GET_CONNECTION_STATUS Status; // Status + UINT ClientIp; // Client IP address + UCHAR ClientIp6[16]; // Client IPv6 address + IP ClientIpAddress; // Client IP address (IPv4/IPv6) + char ClientHostName[MAX_HOST_NAME_LEN + 1]; // Client host name + NODE_INFO NodeInfo; // Node information +}; + + +// Type of server +#define SERVER_TYPE_STANDALONE 0 // Stand-alone server +#define SERVER_TYPE_FARM_CONTROLLER 1 // Farm controller server +#define SERVER_TYPE_FARM_MEMBER 2 // Farm member server + + +// Caps related +struct CAPS +{ + char *Name; // Name + UINT Value; // Value +}; +struct CAPSLIST +{ + LIST *CapsList; // Caps list +}; + +// Log file +struct LOG_FILE +{ + char Path[MAX_PATH]; // Path name + char ServerName[MAX_HOST_NAME_LEN + 1]; // Server name + UINT FileSize; // File size + UINT64 UpdatedTime; // Updating date +}; + + +// Global server flags +#define NUM_GLOBAL_SERVER_FLAGS 128 +#define GSF_DISABLE_PUSH_ROUTE 1 +#define GSF_DISABLE_RADIUS_AUTH 2 +#define GSF_DISABLE_CERT_AUTH 3 +#define GSF_DISABLE_DEEP_LOGGING 4 +#define GSF_DISABLE_AC 5 +#define GSF_DISABLE_SYSLOG 6 +#define GSF_SHOW_OSS_MSG 7 +#define GSF_LOCALBRIDGE_NO_DISABLE_OFFLOAD 8 +#define GSF_DISABLE_SESSION_RECONNECT 9 + +// Global parameters +#define NUM_GLOBAL_PARAMS 128 +#define GP_MAX_SEND_SOCKET_QUEUE_SIZE 1 +#define GP_MIN_SEND_SOCKET_QUEUE_SIZE 2 +#define GP_MAX_SEND_SOCKET_QUEUE_NUM 3 +#define GP_SELECT_TIME 4 +#define GP_SELECT_TIME_FOR_NAT 5 +#define GP_MAX_STORED_QUEUE_NUM 6 +#define GP_MAX_BUFFERING_PACKET_SIZE 7 +#define GP_HUB_ARP_SEND_INTERVAL 8 +#define GP_MAC_TABLE_EXPIRE_TIME 9 +#define GP_IP_TABLE_EXPIRE_TIME 10 +#define GP_IP_TABLE_EXPIRE_TIME_DHCP 11 +#define GP_STORM_CHECK_SPAN 12 +#define GP_STORM_DISCARD_VALUE_START 13 +#define GP_STORM_DISCARD_VALUE_END 14 +#define GP_MAX_MAC_TABLES 15 +#define GP_MAX_IP_TABLES 16 +#define GP_MAX_HUB_LINKS 17 +#define GP_MEM_FIFO_REALLOC_MEM_SIZE 18 +#define GP_QUEUE_BUDGET 19 +#define GP_FIFO_BUDGET 20 + +extern UINT vpn_global_parameters[NUM_GLOBAL_PARAMS]; + +#define VPN_GP(id, default_value) ((UINT)(vpn_global_parameters[(id)] != 0 ? vpn_global_parameters[(id)] : (default_value))) + + + +// Virtual HUB creation history +struct SERVER_HUB_CREATE_HISTORY +{ + char HubName[MAX_HUBNAME_LEN + 1]; + UINT64 CreatedTime; +}; + +// Function prototype declaration +SERVER *SiNewServer(bool bridge); +SERVER *SiNewServerEx(bool bridge, bool in_client_inner_server, bool relay_server); +void SiReleaseServer(SERVER *s); +void SiCleanupServer(SERVER *s); +void StStartServer(bool bridge); +void StStopServer(); +void SiInitConfiguration(SERVER *s); +void SiFreeConfiguration(SERVER *s); +UINT SiWriteConfigurationFile(SERVER *s); +void SiLoadInitialConfiguration(SERVER *s); +bool SiLoadConfigurationFile(SERVER *s); +bool SiLoadConfigurationFileMain(SERVER *s, FOLDER *root); +void SiInitDefaultServerCert(SERVER *s); +void SiInitCipherName(SERVER *s); +void SiGenerateDefaultCert(X **server_x, K **server_k); +void SiGenerateDefaultCertEx(X **server_x, K **server_k, char *common_name); +void SiInitListenerList(SERVER *s); +void SiLockListenerList(SERVER *s); +void SiUnlockListenerList(SERVER *s); +bool SiAddListener(SERVER *s, UINT port, bool enabled); +bool SiAddListenerEx(SERVER *s, UINT port, bool enabled, bool disable_dos); +bool SiEnableListener(SERVER *s, UINT port); +bool SiDisableListener(SERVER *s, UINT port); +bool SiDeleteListener(SERVER *s, UINT port); +SERVER_LISTENER *SiGetListener(SERVER *s, UINT port); +int CompareServerListener(void *p1, void *p2); +void SiStopAllListener(SERVER *s); +void SiInitDefaultHubList(SERVER *s); +void SiSetDefaultHubOption(HUB_OPTION *o); +FOLDER *SiWriteConfigurationToCfg(SERVER *s); +bool SiLoadConfigurationCfg(SERVER *s, FOLDER *root); +void SiWriteLocalBridges(FOLDER *f, SERVER *s); +void SiLoadLocalBridges(SERVER *s, FOLDER *f); +void SiWriteLocalBridgeCfg(FOLDER *f, LOCALBRIDGE *br); +void SiLoadLocalBridgeCfg(SERVER *s, FOLDER *f); +void SiWriteListeners(FOLDER *f, SERVER *s); +void SiLoadListeners(SERVER *s, FOLDER *f); +void SiWriteListenerCfg(FOLDER *f, SERVER_LISTENER *r); +void SiLoadListenerCfg(SERVER *s, FOLDER *f); +void SiWriteServerCfg(FOLDER *f, SERVER *s); +void SiLoadServerCfg(SERVER *s, FOLDER *f); +void SiWriteGlobalParamsCfg(FOLDER *f); +void SiLoadGlobalParamsCfg(FOLDER *f); +void SiLoadGlobalParamItem(UINT id, UINT value); +void SiLoadProtoCfg(PROTO *p, FOLDER *f); +void SiWriteProtoCfg(FOLDER *f, PROTO *p); +void SiWriteTraffic(FOLDER *parent, char *name, TRAFFIC *t); +void SiWriteTrafficInner(FOLDER *parent, char *name, TRAFFIC_ENTRY *e); +void SiLoadTrafficInner(FOLDER *parent, char *name, TRAFFIC_ENTRY *e); +void SiLoadTraffic(FOLDER *parent, char *name, TRAFFIC *t); +void SiSaverThread(THREAD *thread, void *param); +void SiLoadLicenseManager(SERVER *s, FOLDER *f); +void SiWriteLicenseManager(FOLDER *f, SERVER *s); +void SiLoadL3Switchs(SERVER *s, FOLDER *f); +void SiLoadL3SwitchCfg(L3SW *sw, FOLDER *f); +void SiWriteL3Switchs(FOLDER *f, SERVER *s); +void SiWriteL3SwitchCfg(FOLDER *f, L3SW *sw); +void SiLoadIPsec(SERVER *s, FOLDER *f); +void SiWriteIPsec(FOLDER *f, SERVER *s); +void SiWriteHubs(FOLDER *f, SERVER *s); +void SiLoadHubs(SERVER *s, FOLDER *f); +void SiWriteHubCfg(FOLDER *f, HUB *h); +void SiLoadHubCfg(SERVER *s, FOLDER *f, char *name); +void SiLoadHubLogCfg(HUB_LOG *g, FOLDER *f); +void SiWriteHubOptionCfg(FOLDER *f, HUB_OPTION *o); +void SiWriteHubLogCfg(FOLDER *f, HUB_LOG *g); +void SiWriteHubLogCfgEx(FOLDER *f, HUB_LOG *g, bool el_mode); +void SiLoadHubOptionCfg(FOLDER *f, HUB_OPTION *o); +void SiWriteHubLinks(FOLDER *f, HUB *h); +void SiLoadHubLinks(HUB *h, FOLDER *f); +void SiWriteHubAdminOptions(FOLDER *f, HUB *h); +void SiLoadHubAdminOptions(HUB *h, FOLDER *f); +void SiWriteHubLinkCfg(FOLDER *f, LINK *k); +void SiLoadHubLinkCfg(FOLDER *f, HUB *h); +void SiWriteHubAccessLists(FOLDER *f, HUB *h); +void SiLoadHubAccessLists(HUB *h, FOLDER *f); +void SiWriteHubAccessCfg(FOLDER *f, ACCESS *a); +void SiLoadHubAccessCfg(HUB *h, FOLDER *f); +void SiWriteHubDb(FOLDER *f, HUBDB *db, bool no_save_ac_list); +void SiLoadHubDb(HUB *h, FOLDER *f); +void SiWriteUserList(FOLDER *f, LIST *o); +void SiLoadUserList(HUB *h, FOLDER *f); +void SiWriteUserCfg(FOLDER *f, USER *u); +void SiLoadUserCfg(HUB *h, FOLDER *f); +void SiWriteGroupList(FOLDER *f, LIST *o); +void SiLoadGroupList(HUB *h, FOLDER *f); +void SiWriteGroupCfg(FOLDER *f, USERGROUP *g); +void SiLoadGroupCfg(HUB *h, FOLDER *f); +void SiWriteCertList(FOLDER *f, LIST *o); +void SiLoadCertList(LIST *o, FOLDER *f); +void SiWriteCrlList(FOLDER *f, LIST *o); +void SiLoadCrlList(LIST *o, FOLDER *f); +void SiWriteAcList(FOLDER *f, LIST *o); +void SiLoadAcList(LIST *o, FOLDER *f); +void SiWritePolicyCfg(FOLDER *f, POLICY *p, bool cascade_mode); +void SiLoadPolicyCfg(POLICY *p, FOLDER *f); +void SiLoadSecureNAT(HUB *h, FOLDER *f); +void SiWriteSecureNAT(HUB *h, FOLDER *f); +void SiRebootServerEx(bool bridge, bool reset_setting); +void SiRebootServer(bool bridge); +void SiRebootServerThread(THREAD *thread, void *param); +void StInit(); +void StFree(); +void SiSetServerType(SERVER *s, UINT type, + UINT ip, UINT num_port, UINT *ports, + char *controller_name, UINT controller_port, UCHAR *password, UINT weight, bool controller_only); +FARM_CONTROLLER *SiStartConnectToController(SERVER *s); +void SiStopConnectToController(FARM_CONTROLLER *f); +void SiFarmServ(SERVER *server, SOCK *sock, X *cert, UINT ip, UINT num_port, UINT *ports, char *hostname, UINT point, UINT weight, UINT max_sessions); +int CompareHubList(void *p1, void *p2); +void SiFarmServMain(SERVER *server, SOCK *sock, FARM_MEMBER *f); +FARM_TASK *SiFarmServPostTask(FARM_MEMBER *f, PACK *request); +PACK *SiFarmServWaitTask(FARM_TASK *t); +PACK *SiExecTask(FARM_MEMBER *f, PACK *p); +PACK *SiCallTask(FARM_MEMBER *f, PACK *p, char *taskname); +void SiAcceptTasksFromController(FARM_CONTROLLER *f, SOCK *sock); +void SiAcceptTasksFromControllerMain(FARM_CONTROLLER *f, SOCK *sock); +PACK *SiCalledTask(FARM_CONTROLLER *f, PACK *p, char *taskname); +void SiHubOnlineProc(HUB *h); +void SiHubOfflineProc(HUB *h); +FARM_MEMBER *SiGetNextFarmMember(SERVER *s, CONNECTION *c, HUB *h); +bool SiGetMemberSelectorUrl(char *url, UINT url_size); +void SiCallCreateHub(SERVER *s, FARM_MEMBER *f, HUB *h); +void SiCallUpdateHub(SERVER *s, FARM_MEMBER *f, HUB *h); +void SiCallDeleteHub(SERVER *s, FARM_MEMBER *f, HUB *h); +void SiCallEnumSession(SERVER *s, FARM_MEMBER *f, char *hubname, RPC_ENUM_SESSION *t); +void SiCallEnumNat(SERVER *s, FARM_MEMBER *f, char *hubname, RPC_ENUM_NAT *t); +void SiCallEnumDhcp(SERVER *s, FARM_MEMBER *f, char *hubname, RPC_ENUM_DHCP *t); +void SiCallGetNatStatus(SERVER *s, FARM_MEMBER *f, char *hubname, RPC_NAT_STATUS *t); +void SiCallEnumMacTable(SERVER *s, FARM_MEMBER *f, char *hubname, RPC_ENUM_MAC_TABLE *t); +void SiCallEnumIpTable(SERVER *s, FARM_MEMBER *f, char *hubname, RPC_ENUM_IP_TABLE *t); +void SiCallDeleteSession(SERVER *s, FARM_MEMBER *f, char *hubname, char *session_name); +void SiCallCreateTicket(SERVER *s, FARM_MEMBER *f, char *hubname, char *username, char *realusername, POLICY *policy, UCHAR *ticket, UINT counter, char *groupname); +void SiCallDeleteMacTable(SERVER *s, FARM_MEMBER *f, char *hubname, UINT key); +void SiCallDeleteIpTable(SERVER *s, FARM_MEMBER *f, char *hubname, UINT key); +void SiCalledCreateHub(SERVER *s, PACK *p); +void SiCalledUpdateHub(SERVER *s, PACK *p); +void SiCalledDeleteHub(SERVER *s, PACK *p); +void SiCalledDeleteSession(SERVER *s, PACK *p); +void SiCalledDeleteMacTable(SERVER *s, PACK *p); +void SiCalledDeleteIpTable(SERVER *s, PACK *p); +PACK *SiCalledCreateTicket(SERVER *s, PACK *p); +PACK *SiCalledEnumSession(SERVER *s, PACK *p); +PACK *SiCalledEnumNat(SERVER *s, PACK *p); +PACK *SiCalledEnumDhcp(SERVER *s, PACK *p); +PACK *SiCalledGetNatStatus(SERVER *s, PACK *p); +PACK *SiCalledEnumMacTable(SERVER *s, PACK *p); +PACK *SiCalledEnumIpTable(SERVER *s, PACK *p); +void SiCalledEnumHub(SERVER *s, PACK *p, PACK *req); +void SiPackAddCreateHub(PACK *p, HUB *h); +FARM_MEMBER *SiGetHubHostingMember(SERVER *s, HUB *h, bool admin_mode, CONNECTION *c); +void SiCallEnumHub(SERVER *s, FARM_MEMBER *f); +void SiStartFarmControl(SERVER *s); +void SiStopFarmControl(SERVER *s); +void SiFarmControlThread(THREAD *thread, void *param); +void SiAccessListToPack(PACK *p, LIST *o); +void SiAccessToPack(PACK *p, ACCESS *a, UINT i, UINT total); +ACCESS *SiPackToAccess(PACK *p, UINT i); +UINT SiNumAccessFromPack(PACK *p); +void SiHubUpdateProc(HUB *h); +bool SiCheckTicket(HUB *h, UCHAR *ticket, char *username, UINT username_size, char *usernamereal, UINT usernamereal_size, POLICY *policy, char *sessionname, UINT sessionname_size, char *groupname, UINT groupname_size); +UINT SiGetPoint(SERVER *s); +UINT SiCalcPoint(SERVER *s, UINT num, UINT weight); +bool SiCallGetSessionStatus(SERVER *s, FARM_MEMBER *f, RPC_SESSION_STATUS *t); +PACK *SiCalledGetSessionStatus(SERVER *s, PACK *p); +bool SiCallEnumLogFileList(SERVER *s, FARM_MEMBER *f, RPC_ENUM_LOG_FILE *t, char *hubname); +PACK *SiCalledEnumLogFileList(SERVER *s, PACK *p); +bool SiCallReadLogFile(SERVER *s, FARM_MEMBER *f, RPC_READ_LOG_FILE *t); +PACK *SiCalledReadLogFile(SERVER *s, PACK *p); +int CmpLogFile(void *p1, void *p2); +LIST *EnumLogFile(char *hubname); +void EnumLogFileDir(LIST *o, char *dirname); +void FreeEnumLogFile(LIST *o); +bool CheckLogFileNameFromEnumList(LIST *o, char *name, char *server_name); +void IncrementServerConfigRevision(SERVER *s); +void GetServerProductName(SERVER *s, char *name, UINT size); +void GetServerProductNameInternal(SERVER *s, char *name, UINT size); + + +void SiSetSysLogSetting(SERVER *s, SYSLOG_SETTING *setting); +void SiGetSysLogSetting(SERVER *s, SYSLOG_SETTING *setting); +void SiWriteSysLog(SERVER *s, char *typestr, char *hubname, wchar_t *message); +UINT SiGetSysLogSaveStatus(SERVER *s); +void SiInitDeadLockCheck(SERVER *s); +void SiFreeDeadLockCheck(SERVER *s); +void SiDeadLockCheckThread(THREAD *t, void *param); +void SiCheckDeadLockMain(SERVER *s, UINT timeout); +void SiDebugLog(SERVER *s, char *msg); +UINT SiDebug(SERVER *s, RPC_TEST *ret, UINT i, char *str); +UINT SiDebugProcHelloWorld(SERVER *s, char *in_str, char *ret_str, UINT ret_str_size); +UINT SiDebugProcExit(SERVER *s, char *in_str, char *ret_str, UINT ret_str_size); +UINT SiDebugProcDump(SERVER *s, char *in_str, char *ret_str, UINT ret_str_size); +UINT SiDebugProcRestorePriority(SERVER *s, char *in_str, char *ret_str, UINT ret_str_size); +UINT SiDebugProcSetHighPriority(SERVER *s, char *in_str, char *ret_str, UINT ret_str_size); +UINT SiDebugProcGetExeFileName(SERVER *s, char *in_str, char *ret_str, UINT ret_str_size); +UINT SiDebugProcCrash(SERVER *s, char *in_str, char *ret_str, UINT ret_str_size); +UINT SiDebugProcGetIPsecMessageDisplayedValue(SERVER *s, char *in_str, char *ret_str, UINT ret_str_size); +UINT SiDebugProcSetIPsecMessageDisplayedValue(SERVER *s, char *in_str, char *ret_str, UINT ret_str_size); +UINT SiDebugProcGetVgsMessageDisplayedValue(SERVER *s, char *in_str, char *ret_str, UINT ret_str_size); +UINT SiDebugProcSetVgsMessageDisplayedValue(SERVER *s, char *in_str, char *ret_str, UINT ret_str_size); +UINT SiDebugProcGetCurrentTcpSendQueueLength(SERVER *s, char *in_str, char *ret_str, UINT ret_str_size); +UINT SiDebugProcGetCurrentGetIPThreadCount(SERVER *s, char *in_str, char *ret_str, UINT ret_str_size); + +typedef UINT (SI_DEBUG_PROC)(SERVER *s, char *in_str, char *ret_str, UINT ret_str_size); + +CAPS *NewCaps(char *name, UINT value); +void FreeCaps(CAPS *c); +CAPSLIST *NewCapsList(); +int CompareCaps(void *p1, void *p2); +void AddCaps(CAPSLIST *caps, CAPS *c); +CAPS *GetCaps(CAPSLIST *caps, char *name); +void FreeCapsList(CAPSLIST *caps); +bool GetCapsBool(CAPSLIST *caps, char *name); +UINT GetCapsInt(CAPSLIST *caps, char *name); +void AddCapsBool(CAPSLIST *caps, char *name, bool b); +void AddCapsInt(CAPSLIST *caps, char *name, UINT i); +void InRpcCapsList(CAPSLIST *t, PACK *p); +void OutRpcCapsList(PACK *p, CAPSLIST *t); +void FreeRpcCapsList(CAPSLIST *t); +void InitCapsList(CAPSLIST *t); +void InRpcSysLogSetting(SYSLOG_SETTING *t, PACK *p); +void OutRpcSysLogSetting(PACK *p, SYSLOG_SETTING *t); + +void GetServerCaps(SERVER *s, CAPSLIST *t); +void FlushServerCaps(SERVER *s); +bool GetServerCapsBool(SERVER *s, char *name); +UINT GetServerCapsInt(SERVER *s, char *name); +void GetServerCapsMain(SERVER *s, CAPSLIST *t); +void InitServerCapsCache(SERVER *s); +void FreeServerCapsCache(SERVER *s); +void DestroyServerCapsCache(SERVER *s); + +void SetGlobalServerFlag(UINT index, UINT value); +UINT GetGlobalServerFlag(UINT index); +void UpdateGlobalServerFlags(SERVER *s, CAPSLIST *t); + + +bool IsAdminPackSupportedServerProduct(char *name); + +void SiInitHubCreateHistory(SERVER *s); +void SiFreeHubCreateHistory(SERVER *s); +void SiDeleteOldHubCreateHistory(SERVER *s); +void SiAddHubCreateHistory(SERVER *s, char *name); +void SiDelHubCreateHistory(SERVER *s, char *name); +bool SiIsHubRegistedOnCreateHistory(SERVER *s, char *name); + +bool SiTooManyUserObjectsInServer(SERVER *s, bool oneMore); + +bool SiCanOpenVpnOverDnsPort(); +bool SiCanOpenVpnOverIcmpPort(); +void SiApplySpecialListenerStatus(SERVER *s); + +bool SiIsAzureEnabled(SERVER *s); +bool SiIsAzureSupported(SERVER *s); +void SiApplyAzureConfig(SERVER *s, DDNS_CLIENT_STATUS *ddns_status); +void SiSetAzureEnable(SERVER *s, bool enabled); + +void SiUpdateCurrentRegion(CEDAR *c, char *region, bool force_update); +void SiGetCurrentRegion(CEDAR *c, char *region, UINT region_size); +bool SiIsEnterpriseFunctionsRestrictedOnOpenSource(CEDAR *c); + +#endif // SERVER_H + + + diff --git a/src/Cedar/Session.c b/src/Cedar/Session.c index 21b6aefe..c4762125 100644 --- a/src/Cedar/Session.c +++ b/src/Cedar/Session.c @@ -1,2465 +1,2465 @@ -// SoftEther VPN Source Code - Developer Edition Master Branch -// Cedar Communication Module -// © 2020 Nokia - -// Session.c -// Session Manager - -#include "CedarPch.h" - -// Main routine of the session -void SessionMain(SESSION *s) -{ - CONNECTION *c; - POLICY *policy; - UINT64 now; - UINT i = 0; - PACKET_ADAPTER *pa; - bool pa_inited = false; - UINT packet_size; - void *packet; - bool packet_put; - bool pa_fail = false; - UINT test = 0; - bool update_hub_last_comm = false; - UINT err = ERR_SESSION_TIMEOUT; - UINT64 next_black_list_check = 0; - UINT64 next_update_hub_last_comm = 0; - UINT64 auto_disconnect_tick = 0; - bool block_all_packets = false; - UINT64 next_check_block_all_packets = 0; - TRAFFIC t; - SOCK *msgdlg_sock = NULL; - SOCK *nicinfo_sock = NULL; - bool is_server_session = false; - bool lock_receive_blocks_queue = false; - UINT static_ip = 0; - - // Validate arguments - if (s == NULL) - { - return; - } - - Debug("SessionMain: %s\n", s->Name); - - Notify(s, CLIENT_NOTIFY_ACCOUNT_CHANGED); - - // Generate a string from the session key - BinToStr(s->SessionKeyStr, sizeof(s->SessionKeyStr), s->SessionKey, sizeof(s->SessionKey)); - - // Reset the number of retries - s->CurrentRetryCount = 0; - s->ConnectSucceed = true; - s->SessionTimeOuted = false; - s->NumDisconnected = 0; - - c = s->Connection; - policy = s->Policy; - - // Initialize the packet adapter -#ifdef OS_WIN32 - if (s->IsVPNClientAndVLAN_Win32) - { - MsBeginVLanCard(); - - if (MsIsVLanCardShouldStop()) - { - err = ERR_SUSPENDING; - goto CLEANUP; - } - } -#endif // OS_WIN32 - - pa = s->PacketAdapter; - if (pa->Init(s) == false) - { - // Initialization Failed - if (s->VLanDeviceErrorCount >= 2) - { - s->ForceStopFlag = true; - } - else - { - s->VLanDeviceErrorCount++; - } - err = ERR_DEVICE_DRIVER_ERROR; - goto CLEANUP; - } - pa_inited = true; - - if (s->BridgeMode == false) - { - s->Cancel2 = pa->GetCancel(s); - } - else - { - CANCEL *c = pa->GetCancel(s); - CANCEL *old = s->Cancel1; - s->Cancel1 = c; - ReleaseCancel(old); - } - - s->RetryFlag = false; - - s->LastCommTime = Tick64(); - if (s->ServerMode == false) - { - s->NextConnectionTime = Tick64() + (UINT64)((UINT64)s->ClientOption->AdditionalConnectionInterval * (UINT64)1000); - } - - s->NumConnectionsEstablished++; - s->CurrentConnectionEstablishTime = Tick64(); - if (s->FirstConnectionEstablisiedTime == 0) /* !!! Do not correct the spelling to keep the backward protocol compatibility !!! */ - { - s->FirstConnectionEstablisiedTime = Tick64(); /* !!! Do not correct the spelling to keep the backward protocol compatibility !!! */ - } - - if (s->ServerMode == false && s->Cedar->Client != NULL) - { - if (s->Policy != NULL) - { - if (s->Policy->AutoDisconnect) - { - auto_disconnect_tick = s->CurrentConnectionEstablishTime + - (UINT64)s->Policy->AutoDisconnect * 1000ULL; - } - } - } - - s->LastIncrementTraffic = Tick64(); - - c->Err = ERR_SESSION_TIMEOUT; - s->VLanDeviceErrorCount = 0; - - s->LastTryAddConnectTime = Tick64(); - - Notify(s, CLIENT_NOTIFY_ACCOUNT_CHANGED); - - if (policy != NULL) - { - // Determine the mode by referencing the contents of the policy - if (policy->MonitorPort) - { - s->IsMonitorMode = true; - } - - if (policy->NoRouting == false || policy->NoBridge == false) - { - s->IsBridgeMode = true; - } - } - - if (s->ServerMode == false && s->Cedar->Client != NULL) - { - if (IsEmptyUniStr(s->Client_Message) == false) - { - UI_MSG_DLG dlg; - - Zero(&dlg, sizeof(dlg)); - if (s->ClientOption != NULL) - { - StrCpy(dlg.HubName, sizeof(dlg.HubName), s->ClientOption->HubName); - StrCpy(dlg.ServerName, sizeof(dlg.ServerName), s->ClientOption->Hostname); - } - - dlg.Msg = s->Client_Message; - - msgdlg_sock = CncMsgDlg(&dlg); - } - - if (s->Win32HideNicInfoWindow == false) - { - UI_NICINFO info; - - Zero(&info, sizeof(info)); - if (s->ClientOption != NULL) - { - StrCpy(info.NicName, sizeof(info.NicName), s->ClientOption->DeviceName); - UniStrCpy(info.AccountName, sizeof(info.AccountName), s->ClientOption->AccountName); - } - - nicinfo_sock = CncNicInfo(&info); - } - } - - is_server_session = s->ServerMode; - - lock_receive_blocks_queue = s->LinkModeServer; - - now = Tick64(); - - while (true) - { - Zero(&t, sizeof(t)); - - - if (next_update_hub_last_comm == 0 || - (next_update_hub_last_comm <= now)) - { - next_update_hub_last_comm = now + 1000; - - if (s->Hub != NULL) - { - if (update_hub_last_comm) - { - Lock(s->Hub->lock); - { - s->Hub->LastCommTime = SystemTime64(); - } - Unlock(s->Hub->lock); - - update_hub_last_comm = false; - } - } - } - - - if (is_server_session && s->LinkModeServer == false && s->SecureNATMode == false && s->BridgeMode == false && s->L3SwitchMode == false) - { - if (s->Hub != NULL && s->Hub->ForceDisableComm) - { - // Disconnect the session forcibly because the ForceDisableComm flag is set - err = ERR_SERVER_CANT_ACCEPT; - pa_fail = true; - } - } - - if (s->InProcMode) - { - if (c->TubeSock == NULL || IsTubeConnected(c->TubeSock->SendTube) == false || IsTubeConnected(c->TubeSock->RecvTube) == false) - { - // Disconnection occurs in the in-process mode - err = ERR_DISCONNECTED; - pa_fail = true; - } - } - - if (s->IsRUDPSession) - { - if (s->NumDisconnected >= 1 && s->EnableUdpRecovery == false) - { - // Disconnection occurs in the R-UDP session (UDP recovery is invalid) - err = ERR_DISCONNECTED; - pa_fail = true; - } - } - - // Chance of additional connection - if (is_server_session == false) - { - if (GetGlobalServerFlag(GSF_DISABLE_SESSION_RECONNECT) == false) - { - ClientAdditionalConnectChance(s); - } - } - - // Receive a block - ConnectionReceive(c, s->Cancel1, s->Cancel2); - - // Get the current time - now = Tick64(); - - if (s->UseUdpAcceleration && s->UdpAccel != NULL && s->UdpAccel->FatalError) - { - // A serious error occurs during sending any data on UDP socket - // in the case of using UDP acceleration function - err = ERR_DISCONNECTED; - pa_fail = true; - } - -#ifdef OS_WIN32 - if (s->IsVPNClientAndVLAN_Win32) - { - if (MsIsVLanCardShouldStop()) - { - // System is suspending - err = ERR_SUSPENDING; - pa_fail = true; - } - } -#endif // OS_WIN32 - - // Pass the received block to the PacketAdapter - if (lock_receive_blocks_queue) - { - LockQueue(c->ReceivedBlocks); - } - { - BLOCK *b; - packet_put = false; - while (true) - { - b = GetNext(c->ReceivedBlocks); - if (b == NULL) - { - break; - } - - PROBE_DATA2("GetNext", b->Buf, b->Size); - - update_hub_last_comm = true; - - if (b->Size >= 14) - { - UINT ip; - if( (ip = PrepareDHCPRequestForStaticIPv4( s, b )) != 0 ) - { - // Remember the static IP address to remove it from the leased IP address list later - static_ip = ip; - } - - if (b->Buf[0] & 0x01) - { - if (is_server_session == false) - { - t.Recv.BroadcastCount++; - t.Recv.BroadcastBytes += (UINT64)b->Size; - } - else - { - t.Send.BroadcastCount++; - t.Send.BroadcastBytes += (UINT64)b->Size; - } - } - else - { - if (is_server_session == false) - { - t.Recv.UnicastCount++; - t.Recv.UnicastBytes += (UINT64)b->Size; - } - else - { - t.Send.UnicastCount++; - t.Send.UnicastBytes += (UINT64)b->Size; - } - } - } - - packet_put = true; - PROBE_DATA2("pa->PutPacket", b->Buf, b->Size); - if (pa->PutPacket(s, b->Buf, b->Size) == false) - { - pa_fail = true; - err = ERR_DEVICE_DRIVER_ERROR; - Free(b->Buf); - Debug(" Error: pa->PutPacket(Packet) Failed.\n"); - } - Free(b); - } - - if (true /* packet_put || is_server_session 2014.7.23 for optimizing */) - { - PROBE_DATA2("pa->PutPacket", NULL, 0); - if (pa->PutPacket(s, NULL, 0) == false) - { - Debug(" Error: pa->PutPacket(NULL) Failed.\n"); - pa_fail = true; - err = ERR_DEVICE_DRIVER_ERROR; - } - } - } - if (lock_receive_blocks_queue) - { - UnlockQueue(c->ReceivedBlocks); - } - - // Add the packet to be transmitted to SendBlocks by acquiring from PacketAdapter - { - UINT i, max_num = MAX_SEND_SOCKET_QUEUE_NUM; - i = 0; - while (packet_size = pa->GetNextPacket(s, &packet)) - { - BLOCK *b; - if (packet_size == INFINITE) - { - err = ERR_DEVICE_DRIVER_ERROR; - pa_fail = true; - Debug(" Error: pa->GetNextPacket() Failed.\n"); - break; - } - - update_hub_last_comm = true; - - if ((c->CurrentSendQueueSize > MAX_BUFFERING_PACKET_SIZE) || - block_all_packets) - { -// WHERE; - // Discard because it exceeded the buffer size limit - Free(packet); - } - else - { - bool priority; - QUEUE *q = NULL; - // Buffering - if (packet_size >= 14) - { - UCHAR *buf = (UCHAR *)packet; - if (buf[0] & 0x01) - { - if (is_server_session == false) - { - t.Send.BroadcastCount++; - t.Send.BroadcastBytes += (UINT64)packet_size; - } - else - { - t.Recv.BroadcastCount++; - t.Recv.BroadcastBytes += (UINT64)packet_size; - } - } - else - { - if (is_server_session == false) - { - t.Send.UnicastCount++; - t.Send.UnicastBytes += (UINT64)packet_size; - } - else - { - t.Recv.UnicastCount++; - t.Recv.UnicastBytes += (UINT64)packet_size; - } - } - } - priority = IsPriorityHighestPacketForQoS(packet, packet_size); - - b = NewBlock(packet, packet_size, s->UseCompress ? 1 : 0); - b->PriorityQoS = priority; - - if (b->PriorityQoS && c->Protocol == CONNECTION_TCP && s->QoS) - { - q = c->SendBlocks2; - } - else - { - q = c->SendBlocks; - } - - if (q->num_item > MAX_STORED_QUEUE_NUM) - { - q = NULL; - } - - if (q != NULL) - { - c->CurrentSendQueueSize += b->Size; - InsertQueue(q, b); - } - else - { - FreeBlock(b); - } - } - - if ((i % 16) == 0) - { - int diff = ((int)c->CurrentSendQueueSize) - ((int)c->LastPacketQueueSize); - CedarAddCurrentTcpQueueSize(c->Cedar, diff); - c->LastPacketQueueSize = c->CurrentSendQueueSize; - } - - i++; - if (i >= max_num) - { - break; - } - } - } - - AddTrafficForSession(s, &t); - - if (true) - { - int diff = ((int)c->CurrentSendQueueSize) - ((int)c->LastPacketQueueSize); - CedarAddCurrentTcpQueueSize(c->Cedar, diff); - c->LastPacketQueueSize = c->CurrentSendQueueSize; - } - - now = Tick64(); - - // Send a block - ConnectionSend(c, now); - - // Determine the automatic disconnection - if (auto_disconnect_tick != 0 && auto_disconnect_tick <= now) - { - err = ERR_AUTO_DISCONNECTED; - s->CurrentRetryCount = INFINITE; - break; - } - - // Stop determination - if (s->Halt) - { - if (s->ForceStopFlag) - { - err = ERR_USER_CANCEL; - } - break; - } - - // Increments the number of logins for user object and Virtual HUB object. - // (It's incremented only if the time 30 seconds passed after connection. - // If not do this, it will be incremented on DoS attacks or any error.) - if (s->NumLoginIncrementTick != 0 && s->NumLoginIncrementTick <= now) - { - s->NumLoginIncrementTick = 0; - - if (s->NumLoginIncrementHubObject != NULL) - { - s->NumLoginIncrementHubObject->NumLogin++; - } - - if (s->NumLoginIncrementUserObject != NULL) - { - s->NumLoginIncrementUserObject->NumLogin++; - } - } - - if (is_server_session) - { - HUB *hub; - - // Update of traffic data of the user - if ((s->LastIncrementTraffic + INCREMENT_TRAFFIC_INTERVAL) <= now) - { - IncrementUserTraffic(s->Hub, s->UserNameReal, s); - s->LastIncrementTraffic = now; - } - - hub = s->Hub; - - if (hub != NULL) - { - if ((hub->LastIncrementTraffic + INCREMENT_TRAFFIC_INTERVAL) <= now) - { - hub->LastIncrementTraffic = now; - IncrementHubTraffic(s->Hub); - } - } - } - - if (s->LinkModeServer == false && s->SecureNATMode == false && s->BridgeMode == false && s->L3SwitchMode == false && s->InProcMode == false) - { - bool timeouted = false; - - if ((now > s->LastCommTime) && ((now - s->LastCommTime) >= ((UINT64)s->Timeout))) - { - // When communication is not possible for the predetermined time - timeouted = true; - WHERE; - } - - if (c->Protocol == CONNECTION_TCP) - { - if (GetGlobalServerFlag(GSF_DISABLE_SESSION_RECONNECT)) - { - UINT num_tcp_connections = Count(c->CurrentNumConnection); - - if (num_tcp_connections == 0) - { - // All TCP connections are disconnected. - // Terminate the session immediately. - timeouted = true; - } - } - } - - if (is_server_session == false && s->ClientOption != NULL && s->ClientOption->ConnectionDisconnectSpan == 0) - { - if (LIST_NUM(s->Connection->Tcp->TcpSockList) < s->MaxConnection) - { - if ((s->LastTryAddConnectTime + - (UINT64)(s->ClientOption->AdditionalConnectionInterval * 1000 * 2 + CONNECTING_TIMEOUT * 2)) - <= Tick64()) - { - if (s->IsRUDPSession == false || LIST_NUM(s->Connection->Tcp->TcpSockList) == 0) - { - timeouted = true; - WHERE; - } - } - } - } - - if (timeouted) - { - // Timeout occurs - Debug("** Session Timeouted.\n"); - s->SessionTimeOuted = true; - err = ERR_SESSION_TIMEOUT; - } - } - - // Time-out decision - if (pa_fail || s->SessionTimeOuted) - { - s->Halt = true; - s->RetryFlag = true; // Retry flag - break; - } - } - -CLEANUP: - Debug("Session %s Finishing...\n", s->Name); - - // Remove from the session list of the HUB - if (s->ServerMode) - { - // Update the user information - IncrementUserTraffic(s->Hub, s->UserNameReal, s); - - // Clear the DHCP lease record if assigned as a static client IP address - ClearDHCPLeaseRecordForIPv4(s, static_ip); - - DelSession(s->Hub, s); - } - - s->ConnectSucceed = false; - Notify(s, CLIENT_NOTIFY_ACCOUNT_CHANGED); - - if (s->Connection) - { - int diff = -((int)s->Connection->LastTcpQueueSize); - s->Connection->LastTcpQueueSize = 0; - s->Connection->Halt = true; - CedarAddCurrentTcpQueueSize(s->Cedar, diff); - - diff = ((int)c->CurrentSendQueueSize) - ((int)c->LastPacketQueueSize); - CedarAddCurrentTcpQueueSize(c->Cedar, diff); - c->LastPacketQueueSize = c->CurrentSendQueueSize; - } - - // Release the packet adapter - if (pa_inited) - { - pa->Free(s); - } - -#ifdef OS_WIN32 - if (s->IsVPNClientAndVLAN_Win32) - { - MsEndVLanCard(); - } -#endif // OS_WIN32 - - if (s->ServerMode == false) - { - // Cancel to make all additional connection - StopAllAdditionalConnectThread(s->Connection); - } - - if (s->BridgeMode) - { - // Terminate the bridge - if (s->Bridge->Active) - { - CloseEth(s->Bridge->Eth); - s->Bridge->Eth = NULL; - } - } - - if (s->Cancel2 != NULL) - { - // Release the Cancel 2 - ReleaseCancel(s->Cancel2); - s->Cancel2 = NULL; - } - - // Terminate the connection - EndTunnelingMode(c); - - if (nicinfo_sock != NULL) - { - CncNicInfoFree(nicinfo_sock); - } - - if (msgdlg_sock != NULL) - { - CndMsgDlgFree(msgdlg_sock); - } - - c->Err = err; -} - -// Get the time for the next delayed packet -UINT GetNextDelayedPacketTickDiff(SESSION *s) -{ - UINT i; - UINT ret = 0x7fffffff; - UINT64 now; - // Validate arguments - if (s == NULL) - { - return 0; - } - - if (LIST_NUM(s->DelayedPacketList) >= 1) - { - now = TickHighres64(); - - LockList(s->DelayedPacketList); - { - for (i = 0;i < LIST_NUM(s->DelayedPacketList);i++) - { - PKT *p = LIST_DATA(s->DelayedPacketList, i); - UINT64 t = p->DelayedForwardTick; - UINT d = 0x7fffffff; - - if (now >= t) - { - d = 0; - } - else - { - d = (UINT)(t - now); - } - - ret = MIN(ret, d); - } - } - UnlockList(s->DelayedPacketList); - } - - return ret; -} - -// Determine whether the packet have priority in the VoIP / QoS function -bool IsPriorityHighestPacketForQoS(void *data, UINT size) -{ - UCHAR *buf; - // Validate arguments - if (data == NULL) - { - return false; - } - - buf = (UCHAR *)data; - if (size >= 16) - { - if (buf[12] == 0x08 && buf[13] == 0x00 && buf[15] != 0x00 && buf[15] != 0x08) - { - // IPv4 packet and ToS != 0 - return true; - } - - if (size >= 34 && size <= 128) - { - if (buf[12] == 0x08 && buf[13] == 0x00 && buf[23] == 0x01) - { - // IMCPv4 packet - return true; - } - } - } - - return false; -} - -// Update the traffic information of the user -void IncrementUserTraffic(HUB *hub, char *username, SESSION *s) -{ - TRAFFIC report_traffic; - // Validate arguments - if (hub == NULL || username == NULL || s == NULL) - { - return; - } - - Lock(s->TrafficLock); - { - // Calculate the traffic information (difference between last time) to be reported - report_traffic.Send.BroadcastBytes = - s->Traffic->Send.BroadcastBytes - s->OldTraffic->Send.BroadcastBytes; - report_traffic.Send.BroadcastCount = - s->Traffic->Send.BroadcastCount - s->OldTraffic->Send.BroadcastCount; - report_traffic.Send.UnicastBytes = - s->Traffic->Send.UnicastBytes - s->OldTraffic->Send.UnicastBytes; - report_traffic.Send.UnicastCount = - s->Traffic->Send.UnicastCount - s->OldTraffic->Send.UnicastCount; - report_traffic.Recv.BroadcastBytes = - s->Traffic->Recv.BroadcastBytes - s->OldTraffic->Recv.BroadcastBytes; - report_traffic.Recv.BroadcastCount = - s->Traffic->Recv.BroadcastCount - s->OldTraffic->Recv.BroadcastCount; - report_traffic.Recv.UnicastBytes = - s->Traffic->Recv.UnicastBytes - s->OldTraffic->Recv.UnicastBytes; - report_traffic.Recv.UnicastCount = - s->Traffic->Recv.UnicastCount - s->OldTraffic->Recv.UnicastCount; - Copy(s->OldTraffic, s->Traffic, sizeof(TRAFFIC)); - - if (hub->FarmMember == false) - { - // Update the user information in the local database if it is not a farm member - AcLock(hub); - { - USER *u = AcGetUser(hub, username); - if (u != NULL) - { - Lock(u->lock); - { - AddTraffic(u->Traffic, &report_traffic); - } - Unlock(u->lock); - if (u->Group != NULL) - { - Lock(u->Group->lock); - { - AddTraffic(u->Group->Traffic, &report_traffic); - } - Unlock(u->Group->lock); - } - ReleaseUser(u); - } - } - AcUnlock(hub); - } - else - { - // Update the traffic difference report list in the case of farm member - AddTrafficDiff(hub, username, TRAFFIC_DIFF_USER, &report_traffic); - } - } - Unlock(s->TrafficLock); -} - -// Cumulate the traffic information of the connection -void AddTrafficForSession(SESSION *s, TRAFFIC *t) -{ - HUB *h; - TRAFFIC t2; - // Validate arguments - if (s == NULL || t == NULL) - { - return; - } - - Lock(s->TrafficLock); - { - AddTraffic(s->Traffic, t); - } - Unlock(s->TrafficLock); - - if (s->ServerMode) - { - Copy(&t2.Recv, &t->Send, sizeof(TRAFFIC_ENTRY)); - Copy(&t2.Send, &t->Recv, sizeof(TRAFFIC_ENTRY)); - Lock(s->Cedar->TrafficLock); - { - AddTraffic(s->Cedar->Traffic, &t2); - } - Unlock(s->Cedar->TrafficLock); - - h = s->Hub; - Lock(h->TrafficLock); - { - AddTraffic(h->Traffic, &t2); - } - Unlock(h->TrafficLock); - } -} - -// A chance to establish an additional connection for client -void ClientAdditionalConnectChance(SESSION *s) -{ - // Validate arguments - if (s == NULL) - { - return; - } - - if (s->ServerMode) - { - // Do not connect additionally in the server mode - return; - } - if (s->Connection->Protocol != CONNECTION_TCP) - { - // Connect additionally only in the case of TCP protocol - return; - } - if (s->IsRUDPSession && s->EnableUdpRecovery == false) - { - // Do not connect additionally if the UDP recovery is disabled in the case of R-UDP session - return; - } - - if (s->IsRUDPSession && (s->Connection->AdditionalConnectionFailedCounter > MAX_ADDITIONAL_CONNECTION_FAILED_COUNTER)) - { - // Not to make a large amount of repeated connection retry within a certain time in the case of R-UDP session - return; - } - - while (true) - { - if (s->Halt) - { - return; - } - // Consider whether there is a need to put an additional connection - // by examining the number of current connections and MaxConnection property - if (Count(s->Connection->CurrentNumConnection) < s->MaxConnection) - { - // Get the current time - UINT64 now = Tick64(); - - // Examine the NextConnectionTime, and if the time passed, - // attempt to make a connection - if (s->NextConnectionTime == 0 || - s->ClientOption->AdditionalConnectionInterval == 0 || - (s->NextConnectionTime <= now)) - { - // Start the work to put an additional connection - s->NextConnectionTime = now + ((UINT64)s->ClientOption->AdditionalConnectionInterval * (UINT64)1000); - SessionAdditionalConnect(s); - } - else - { - break; - } - } - else - { - break; - } - } -} - -// Release the packet adapter -void FreePacketAdapter(PACKET_ADAPTER *pa) -{ - // Validate arguments - if (pa == NULL) - { - return; - } - - Free(pa); -} - -// Create a new packet adapter -PACKET_ADAPTER *NewPacketAdapter(PA_INIT *init, PA_GETCANCEL *getcancel, PA_GETNEXTPACKET *getnext, - PA_PUTPACKET *put, PA_FREE *free) -{ - PACKET_ADAPTER *pa; - // Validate arguments - if (init == NULL || getcancel == NULL || getnext == NULL || put == NULL || free == NULL) - { - return NULL; - } - - pa = ZeroMalloc(sizeof(PACKET_ADAPTER)); - - pa->Init = init; - pa->Free = free; - pa->GetCancel = getcancel; - pa->GetNextPacket = getnext; - pa->PutPacket = put; - - return pa; -} - -// Thread for putting an additional connection -void ClientAdditionalThread(THREAD *t, void *param) -{ - SESSION *s; - CONNECTION *c; - // Validate arguments - if (t == NULL || param == NULL) - { - return; - } - - s = (SESSION *)param; - - s->LastTryAddConnectTime = Tick64(); - - c = s->Connection; - // Increment of connection counter - Inc(c->CurrentNumConnection); - LockList(c->ConnectingThreads); - { - // Add to processing thread - Add(c->ConnectingThreads, t); - AddRef(t->ref); - } - UnlockList(c->ConnectingThreads); - - // Notify the completion of initialization - NoticeThreadInit(t); - - Debug("Additional Connection #%u\n", Count(c->CurrentNumConnection)); - - // Put an additional connection - if (ClientAdditionalConnect(c, t) == false) - { - // Decrement the counter which is currently processing - Dec(c->CurrentNumConnection); - - if (c->AdditionalConnectionFailedCounter == 0) - { - c->LastCounterResetTick = Tick64(); - } - - c->AdditionalConnectionFailedCounter++; - - if ((c->LastCounterResetTick + (UINT64)ADDITIONAL_CONNECTION_COUNTER_RESET_INTERVAL) <= Tick64()) - { - // Reset the number of failures periodically - c->AdditionalConnectionFailedCounter = 0; - c->LastCounterResetTick = Tick64(); - } - } - else - { - s->LastTryAddConnectTime = Tick64(); - c->AdditionalConnectionFailedCounter = 0; - c->LastCounterResetTick = Tick64(); - } - - // Remove from the processing thread - LockList(c->ConnectingThreads); - { - // Remove from the processing thread - if (Delete(c->ConnectingThreads, t)) - { - ReleaseThread(t); - } - } - UnlockList(c->ConnectingThreads); - ReleaseSession(s); -} - -// Put an additional connection from the client to the server -void SessionAdditionalConnect(SESSION *s) -{ - THREAD *t; - // Validate arguments - if (s == NULL) - { - return; - } - - // s->LastTryAddConnectTime = Tick64(); - - AddRef(s->ref); - t = NewThread(ClientAdditionalThread, (void *)s); - WaitThreadInit(t); - ReleaseThread(t); -} - -// Connect the client session to the server -bool SessionConnect(SESSION *s) -{ - CONNECTION *c; - bool ret = false; - // Validate arguments - if (s == NULL) - { - return false; - } - - s->ClientStatus = CLIENT_STATUS_CONNECTING; - - Debug("SessionConnect() Started.\n"); - - // Initialize the session - Lock(s->lock); - { - s->Err = ERR_NO_ERROR; - if (s->Policy != NULL) - { - Free(s->Policy); - s->Policy = NULL; - } - } - Unlock(s->lock); - - s->CancelConnect = false; - - // Create a Client Connection - c = NewClientConnection(s); - s->Connection = c; - - // Connect the client to the server - ret = ClientConnect(c); - s->Err = c->Err; - - s->CancelConnect = false; - - if (s->Cedar->Client != NULL) - { - if (s->Policy != NULL) - { - if (s->Policy->NoSavePassword) - { - s->Client_NoSavePassword = true; - - if (s->Account != NULL) - { - Lock(s->Account->lock); - { - if (s->Account->ClientAuth != NULL) - { - if (s->Account->ClientAuth->AuthType == AUTHTYPE_PASSWORD || - s->Account->ClientAuth->AuthType == AUTHTYPE_RADIUS) - { - Zero(s->Account->ClientAuth->HashedPassword, sizeof(s->Account->ClientAuth->HashedPassword)); - Zero(s->Account->ClientAuth->PlainPassword, sizeof(s->Account->ClientAuth->PlainPassword)); - } - } - } - Unlock(s->Account->lock); - - CiSaveConfigurationFile(s->Cedar->Client); - } - } - } - } - - if (c->ClientConnectError_NoSavePassword) - { - s->Client_NoSavePassword = true; - } - - // Release the client connection - s->Connection = NULL; - ReleaseConnection(c); - - Lock(s->lock); - { - if (s->Policy != NULL) - { - Free(s->Policy); - s->Policy = NULL; - } - } - Unlock(s->lock); - - return ret; -} - -// Stop the session -void StopSession(SESSION *s) -{ - StopSessionEx(s, false); -} -void StopSessionEx(SESSION *s, bool no_wait) -{ - // Validate arguments - if (s == NULL) - { - return; - } - - // Halting flag - s->UserCanceled = true; - s->CancelConnect = true; - s->Halt = true; - - Debug("Stop Session %s\n", s->Name); - - // Cancel - Cancel(s->Cancel1); - - // Event - Set(s->HaltEvent); - - // Server and client mode - if (s->Connection) - { - CONNECTION *c = s->Connection; - AddRef(c->ref); - StopConnection(c, no_wait); - ReleaseConnection(c); - } - - // Wait until the stop - if (no_wait == false) - { - while (true) - { - s->ForceStopFlag = true; - s->Halt = true; - if (WaitThread(s->Thread, 20)) - { - break; - } - } - } - else - { - s->ForceStopFlag = true; - s->Halt = true; - } -} - -// Cleanup the session -void CleanupSession(SESSION *s) -{ - // Validate arguments - if (s == NULL) - { - return; - } - - // Release the delayed packet list - if (s->DelayedPacketList != NULL) - { - UINT i; - for (i = 0;i < LIST_NUM(s->DelayedPacketList);i++) - { - PKT *p = LIST_DATA(s->DelayedPacketList, i); - - Free(p->PacketData); - FreePacket(p); - } - - ReleaseList(s->DelayedPacketList); - } - - // Release the client connection options - if (s->ClientOption != NULL) - { -#ifdef OS_UNIX - UnixVLanSetState(s->ClientOption->DeviceName, false); -#endif - Free(s->ClientOption); - } - - // Release the client authentication data - if (s->ClientAuth != NULL) - { - if (s->ClientAuth->ClientX != NULL) - { - FreeX(s->ClientAuth->ClientX); - } - if (s->ClientAuth->ClientX != NULL) - { - FreeK(s->ClientAuth->ClientK); - } - Free(s->ClientAuth); - } - - FreeTraffic(s->Traffic); - Free(s->Name); - - if (s->Thread != NULL) - { - ReleaseThread(s->Thread); - } - - DeleteLock(s->lock); - - ReleaseEvent(s->HaltEvent); - - if (s->Cancel1) - { - ReleaseCancel(s->Cancel1); - } - - if (s->Cancel2) - { - ReleaseCancel(s->Cancel2); - } - - if (s->Policy) - { - Free(s->Policy); - } - - if (s->Connection) - { - ReleaseConnection(s->Connection); - } - - Free(s->Username); - - if (s->PacketAdapter) - { - FreePacketAdapter(s->PacketAdapter); - } - - if (s->OldTraffic != NULL) - { - FreeTraffic(s->OldTraffic); - } - - DeleteLock(s->TrafficLock); - - if (s->CancelList != NULL) - { - ReleaseCancelList(s->CancelList); - } - - if (s->Client_Message != NULL) - { - Free(s->Client_Message); - } - - DeleteCounter(s->LoggingRecordCount); - - ReleaseSharedBuffer(s->IpcSessionSharedBuffer); - - Free(s); -} - -// Release the session -void ReleaseSession(SESSION *s) -{ - // Validate arguments - if (s == NULL) - { - return; - } - - if (Release(s->ref) == 0) - { - CleanupSession(s); - } -} - -// Display the total data transfer size of the session -void PrintSessionTotalDataSize(SESSION *s) -{ - // Validate arguments - if (s == NULL) - { - return; - } - - Debug( - "-- SESSION TOTAL PKT INFORMATION --\n\n" - " TotalSendSize: %I64u\n" - " TotalSendSizeReal: %I64u\n" - " TotalRecvSize: %I64u\n" - " TotalRecvSizeReal: %I64u\n" - " Compression Rate: %.2f%% (Send)\n" - " %.2f%% (Recv)\n", - s->TotalSendSize, s->TotalSendSizeReal, - s->TotalRecvSize, s->TotalRecvSizeReal, - (float)((double)s->TotalSendSizeReal / (double)s->TotalSendSize * 100.0f), - (float)((double)s->TotalRecvSizeReal / (double)s->TotalRecvSize * 100.0f) - ); - -} - -// Client thread -void ClientThread(THREAD *t, void *param) -{ - SESSION *s; - bool use_password_dlg; - bool no_save_password = false; - bool is_vpngate_connection = false; - CEDAR *cedar; - bool num_active_sessions_incremented = false; - // Validate arguments - if (t == NULL || param == NULL) - { - return; - } - - Debug("ClientThread 0x%x Started.\n", t); - - s = (SESSION *)param; - AddRef(s->ref); - s->Thread = t; - AddRef(t->ref); - - if (s->LinkModeClient == false) - { - CiIncrementNumActiveSessions(); - num_active_sessions_incremented = true; - } - - NoticeThreadInit(t); - - cedar = s->Cedar; - - s->ClientStatus = CLIENT_STATUS_CONNECTING; - s->RetryFlag = true; - s->CurrentRetryCount = 0; - - Notify(s, CLIENT_NOTIFY_ACCOUNT_CHANGED); - - if (s->Cedar->Client != NULL) - { - no_save_password = s->Cedar->Client->DontSavePassword; - } - - s->Win32HideConnectWindow = s->ClientOption->HideStatusWindow; - s->Win32HideNicInfoWindow = s->ClientOption->HideNicInfoWindow; - - - while (true) - { - Zero(&s->ServerIP_CacheForNextConnect, sizeof(IP)); - - if (s->Link != NULL && ((*s->Link->StopAllLinkFlag) || s->Link->Halting)) - { - s->Err = ERR_USER_CANCEL; - break; - } - - CLog(s->Cedar->Client, "LC_CONNECT_1", s->ClientOption->AccountName, s->CurrentRetryCount + 1); - if (s->LinkModeClient && s->Link != NULL) - { - HLog(s->Link->Hub, "LH_CONNECT_1", s->ClientOption->AccountName, s->CurrentRetryCount + 1); - } - - Debug("Trying to Connect to Server... (%u / %u)\n", s->CurrentRetryCount + 0, - s->ClientOption->NumRetry); - - // Initialize -// s->TotalRecvSize = s->TotalRecvSizeReal = -// s->TotalSendSize = s->TotalSendSizeReal = 0; - s->NextConnectionTime = 0; - - // Connect - s->ClientStatus = CLIENT_STATUS_CONNECTING; - s->Halt = false; - SessionConnect(s); - if (s->UserCanceled) - { - s->Err = ERR_USER_CANCEL; - } - Debug("Disconnected. Err = %u : %S\n", s->Err, _E(s->Err)); - - PrintSessionTotalDataSize(s); - - CLog(s->Cedar->Client, "LC_CONNECT_ERROR", s->ClientOption->AccountName, - GetUniErrorStr(s->Err), s->Err); -#ifdef OS_UNIX - UnixVLanSetState(s->ClientOption->DeviceName, false); -#endif - if (s->LinkModeClient && s->Link != NULL) - { - HLog(s->Link->Hub, "LH_CONNECT_ERROR", s->ClientOption->AccountName, - GetUniErrorStr(s->Err), s->Err); - } - - s->ClientStatus = CLIENT_STATUS_RETRY; - - if (s->Link != NULL) - { - ((LINK *)s->Link)->LastError = s->Err; - } - - if (s->Halt && (s->RetryFlag == false) || s->ForceStopFlag) - { - // Must be aborted - if (s->Err == ERR_DEVICE_DRIVER_ERROR) - { -#ifdef OS_WIN32 - wchar_t tmp[MAX_SIZE]; - if (s->Account != NULL && s->Cedar->Client != NULL) - { - UniFormat(tmp, sizeof(tmp), _UU("ERRDLG_DEVICE_ERROR"), s->ClientOption->DeviceName, - s->Err, _E(s->Err)); - MsgBox(NULL, 0x10000 | 0x40000 | 0x200000 | 0x30, tmp); - } -#endif // OS_WIN32 - } - break; - } - // Determine whether to display the password re-entry dialog - use_password_dlg = false; - - if (s->Account != NULL && s->Cedar->Client != NULL) - { -#ifdef OS_WIN32 - if (s->ClientAuth->AuthType == CLIENT_AUTHTYPE_PASSWORD || s->ClientAuth->AuthType == CLIENT_AUTHTYPE_PLAIN_PASSWORD) - { - if (s->Err == ERR_AUTH_FAILED || s->Err == ERR_PROXY_AUTH_FAILED) - { - use_password_dlg = true; - } - } -#endif // OS_WIN32 - } - - // Failed to connect or the connection is disconnected - // Wait for retry interval - if (use_password_dlg == false) - { - UINT retry_interval = s->RetryInterval; - - if (s->LinkModeClient) - { - UINT current_num_links = Count(s->Cedar->CurrentActiveLinks); - UINT max_retry_interval = MAX(1000 * current_num_links, retry_interval); - - retry_interval += retry_interval * MIN(s->CurrentRetryCount, 1000); - retry_interval = MIN(retry_interval, max_retry_interval); - - // On the cascade client, adjust the retry_interval. (+/- 20%) - if (retry_interval >= 1000 && retry_interval <= (60 * 60 * 1000)) - { - retry_interval = (retry_interval * 8 / 10) + (Rand32() % (retry_interval * 4 / 10)); - } - } - - if (s->Err == ERR_HUB_IS_BUSY || s->Err == ERR_LICENSE_ERROR || - s->Err == ERR_HUB_STOPPING || s->Err == ERR_TOO_MANY_USER_SESSION) - { - retry_interval = RETRY_INTERVAL_SPECIAL; - } - - if (s->CurrentRetryCount >= s->ClientOption->NumRetry) - { - // Retry count excess - -#ifndef OS_WIN32 - - break; - -#else // OS_WIN32 - - if (s->Win32HideConnectWindow == false && - s->Cedar->Client != NULL && s->Account != NULL) - { - // Show a reconnection dialog - UI_CONNECTERROR_DLG p; - Zero(&p, sizeof(p)); - UniStrCpy(p.AccountName, sizeof(p.AccountName), s->ClientOption->AccountName); - StrCpy(p.ServerName, sizeof(p.ServerName), s->ClientOption->Hostname); - p.Err = s->Err; - p.CurrentRetryCount = s->CurrentRetryCount + 1; - s->Halt = false; - p.RetryLimit = 0; - p.RetryIntervalSec = 0; - p.CancelEvent = s->HaltEvent; - p.HideWindow = s->Win32HideConnectWindow; - if (CncConnectErrorDlg(s, &p) == false) - { - // Abort - break; - } - else - { - s->Win32HideConnectWindow = p.HideWindow; - goto SKIP; - } - } - else - { - break; - } - -#endif - } - -#ifndef OS_WIN32 - - // Simple wait - Wait(s->HaltEvent, retry_interval); - -#else // OS_WIN32 - - if (s->Win32HideConnectWindow == false && - s->Cedar->Client != NULL && s->Account != NULL) - { - // Show a reconnection dialog - UI_CONNECTERROR_DLG p; - Zero(&p, sizeof(p)); - UniStrCpy(p.AccountName, sizeof(p.AccountName), s->ClientOption->AccountName); - StrCpy(p.ServerName, sizeof(p.ServerName), s->ClientOption->Hostname); - p.Err = s->Err; - p.CurrentRetryCount = s->CurrentRetryCount + 1; - p.RetryLimit = s->ClientOption->NumRetry; - p.RetryIntervalSec = retry_interval; - p.CancelEvent = s->HaltEvent; - s->Halt = false; - p.HideWindow = s->Win32HideConnectWindow; - if (CncConnectErrorDlg(s, &p) == false) - { - // Abort - break; - } - s->Win32HideConnectWindow = p.HideWindow; - } - else - { - // Simple wait - Wait(s->HaltEvent, s->RetryInterval); - } - -#endif // OS_WIN32 - } - else - { -#ifdef OS_WIN32 - // Wait for re-entry the password - UI_PASSWORD_DLG p; - Zero(&p, sizeof(p)); - if (s->Client_NoSavePassword == false) - { - p.ShowNoSavePassword = true; - } - p.NoSavePassword = no_save_password; - p.CancelEvent = s->HaltEvent; - if (s->Err == ERR_PROXY_AUTH_FAILED) - { - p.ProxyServer = true; - } - - if (p.ProxyServer) - { - StrCpy(p.Username, sizeof(p.Username), s->ClientOption->ProxyUsername); - StrCpy(p.Password, sizeof(p.Password), s->ClientOption->ProxyPassword); - StrCpy(p.ServerName, sizeof(p.ServerName), s->ClientOption->ProxyName); - } - else - { - bool empty = false; - - StrCpy(p.Username, sizeof(p.Username), s->ClientAuth->Username); - if (s->ClientAuth->AuthType == AUTHTYPE_RADIUS) - { - if (StrLen(s->ClientAuth->PlainPassword) == 0) - { - empty = true; - } - } - else if (s->ClientAuth->AuthType == AUTHTYPE_PASSWORD) - { - if (IsZero(s->ClientAuth->HashedPassword, sizeof(s->ClientAuth->HashedPassword))) - { - empty = true; - } - } - - StrCpy(p.Password, sizeof(p.Password), empty ? "" : HIDDEN_PASSWORD); - StrCpy(p.ServerName, sizeof(p.ServerName), s->ClientOption->Hostname); - } - - p.RetryIntervalSec = s->RetryInterval / 1000; - p.Type = s->ClientAuth->AuthType; - - // Display the password re-entry dialog - if (CncPasswordDlg(s, &p) == false) - { - // Abort the connection - break; - } - else - { - // Overwrite the user name - if (p.ProxyServer) - { - // User name of the proxy - StrCpy(s->ClientOption->ProxyUsername, sizeof(s->ClientOption->ProxyUsername), p.Username); - } - else - { - // The user name for connecting to the server - StrCpy(s->ClientAuth->Username, sizeof(s->ClientAuth->Username), p.Username); - s->ClientAuth->AuthType = p.Type; - } - - if (StrCmp(p.Password, HIDDEN_PASSWORD) != 0) - { - // Password is re-entered - if (p.ProxyServer) - { - // Password for the proxy server - StrCpy(s->ClientOption->ProxyPassword, sizeof(s->ClientOption->ProxyPassword), p.Password); - } - else - { - if (s->ClientAuth->AuthType == CLIENT_AUTHTYPE_PLAIN_PASSWORD) - { - // Plaintext password authentication - StrCpy(s->ClientAuth->PlainPassword, sizeof(s->ClientAuth->PlainPassword), p.Password); - } - else - { - // Encrypted password authentication - HashPassword(s->ClientAuth->HashedPassword, s->ClientAuth->Username, p.Password); - } - } - } - - no_save_password = p.NoSavePassword; - - if (s->Account != NULL && s->Cedar->Client != NULL) - { - s->Cedar->Client->DontSavePassword = no_save_password; - if (p.NoSavePassword == false) - { - // Update the account database of the client - if (p.ProxyServer == false) - { - // Update the Server connection information - ACCOUNT *a = s->Account; - Lock(a->lock); - { - CiFreeClientAuth(a->ClientAuth); - a->ClientAuth = CopyClientAuth(s->ClientAuth); - } - Unlock(a->lock); - CiSaveConfigurationFile(s->Cedar->Client); - } - else - { - // Update the proxy connection information - ACCOUNT *a = s->Account; - Lock(a->lock); - { - Copy(a->ClientOption, s->ClientOption, sizeof(CLIENT_OPTION)); - } - Unlock(a->lock); - CiSaveConfigurationFile(s->Cedar->Client); - } - } - } - } -#endif // OS_WIN32 - } - -SKIP: - // Increase the number of retries - if (s->ConnectSucceed == false) - { - s->CurrentRetryCount++; - } - - if (s->ForceStopFlag) - { - break; - } - } - - Debug("Session Halt.\n"); - - s->ClientStatus = CLIENT_STATUS_IDLE; - - // Regard as that the session is ended here - if (s->Account != NULL) - { - s->Account->ClientSession = NULL; - ReleaseSession(s); - } - - Notify(s, CLIENT_NOTIFY_ACCOUNT_CHANGED); - - - ReleaseSession(s); - - if (num_active_sessions_incremented) - { - CiDecrementNumActiveSessions(); - } -} - -// Create an RPC session -SESSION *NewRpcSession(CEDAR *cedar, CLIENT_OPTION *option) -{ - return NewRpcSessionEx(cedar, option, NULL, NULL); -} -SESSION *NewRpcSessionEx(CEDAR *cedar, CLIENT_OPTION *option, UINT *err, char *client_str) -{ - return NewRpcSessionEx2(cedar, option, err, client_str, NULL); -} -SESSION *NewRpcSessionEx2(CEDAR *cedar, CLIENT_OPTION *option, UINT *err, char *client_str, void *hWnd) -{ - SESSION *s; - CONNECTION *c; - SOCK *sock; - // Validate arguments - if (cedar == NULL || option == NULL) - { - return NULL; - } - - s = ZeroMalloc(sizeof(SESSION)); - - s->LoggingRecordCount = NewCounter(); - s->lock = NewLock(); - s->ref = NewRef(); - s->Cedar = cedar; - s->ServerMode = false; - s->Name = CopyStr("CLIENT_RPC_SESSION"); - s->CreatedTime = s->LastCommTime = Tick64(); - s->Traffic = NewTraffic(); - s->HaltEvent = NewEvent(); - s->TrafficLock = NewLock(); - s->Cancel1 = NewCancel(); - - // Copy the client connection options - s->ClientOption = Malloc(sizeof(CLIENT_OPTION)); - Copy(s->ClientOption, option, sizeof(CLIENT_OPTION)); - - s->MaxConnection = option->MaxConnection; - s->UseEncrypt = option->UseEncrypt; - s->UseCompress = option->UseCompress; - - // Create a connection - c = s->Connection = NewClientConnectionEx(s, client_str, cedar->Version, cedar->Build); - c->hWndForUI = hWnd; - - // Connect to the server - sock = ClientConnectToServer(c); - if (sock == NULL) - { - // Connection failure - if (err != NULL) - { - *err = c->Err; - } - ReleaseSession(s); - return NULL; - } - - // Send a signature - if (ClientUploadSignature(sock) == false) - { - // Failure - if (err != NULL) - { - *err = c->Err; - } - ReleaseSession(s); - return NULL; - } - - // Receive a Hello packet - if (ClientDownloadHello(c, sock) == false) - { - // Failure - if (err != NULL) - { - *err = c->Err; - } - ReleaseSession(s); - return NULL; - } - - return s; -} - -// Create a client session -SESSION *NewClientSessionEx(CEDAR *cedar, CLIENT_OPTION *option, CLIENT_AUTH *auth, PACKET_ADAPTER *pa, ACCOUNT *account) -{ - SESSION *s; - THREAD *t; - // Validate arguments - if (cedar == NULL || option == NULL || auth == NULL || pa == NULL || - (auth->AuthType == CLIENT_AUTHTYPE_SECURE && auth->SecureSignProc == NULL)) - { - return NULL; - } - - // Initialize the SESSION object - s = ZeroMalloc(sizeof(SESSION)); - - s->LoggingRecordCount = NewCounter(); - - s->lock = NewLock(); - s->ref = NewRef(); - s->Cedar = cedar; - s->ServerMode = false; - s->Name = CopyStr("CLIENT_SESSION"); - s->CreatedTime = s->LastCommTime = Tick64(); - s->Traffic = NewTraffic(); - s->HaltEvent = NewEvent(); - s->PacketAdapter = pa; - s->TrafficLock = NewLock(); - s->OldTraffic = NewTraffic(); - s->Cancel1 = NewCancel(); - s->CancelList = NewCancelList(); - - // Copy the client connection options - s->ClientOption = Malloc(sizeof(CLIENT_OPTION)); - Copy(s->ClientOption, option, sizeof(CLIENT_OPTION)); - - if (GetGlobalServerFlag(GSF_DISABLE_SESSION_RECONNECT)) - { - s->ClientOption->DisableQoS = true; - s->ClientOption->MaxConnection = 1; - s->ClientOption->HalfConnection = false; - } - - s->MaxConnection = option->MaxConnection; - s->UseEncrypt = option->UseEncrypt; - s->UseCompress = option->UseCompress; - - // Set the retry interval - s->RetryInterval = MAKESURE(option->RetryInterval, 0, 4000000) * 1000; - s->RetryInterval = MAKESURE(s->RetryInterval, MIN_RETRY_INTERVAL, MAX_RETRY_INTERVAL); - - // Interval for additional connection creation is at least 1 second - s->ClientOption->AdditionalConnectionInterval = MAX(s->ClientOption->AdditionalConnectionInterval, 1); - - // Hold whether the virtual LAN card is used in client mode - s->ClientModeAndUseVLan = (StrLen(s->ClientOption->DeviceName) == 0) ? false : true; - - if (s->ClientOption->NoRoutingTracking) - { - s->ClientModeAndUseVLan = false; - } - - if (pa->Id == PACKET_ADAPTER_ID_VLAN_WIN32) - { - s->IsVPNClientAndVLAN_Win32 = true; - } - - if (StrLen(option->DeviceName) == 0) - { - // NAT mode - s->ClientModeAndUseVLan = false; - s->VirtualHost = true; - } - - if (OS_IS_WINDOWS_9X(GetOsInfo()->OsType)) - { - // Prohibit the half-duplex mode in the case of Win9x - s->ClientOption->HalfConnection = false; - } - - // Copy the client authentication data - s->ClientAuth = Malloc(sizeof(CLIENT_AUTH)); - Copy(s->ClientAuth, auth, sizeof(CLIENT_AUTH)); - - // Clone the certificate and the private key - if (s->ClientAuth->ClientX != NULL) - { - s->ClientAuth->ClientX = CloneX(s->ClientAuth->ClientX); - } - if (s->ClientAuth->ClientK != NULL) - { - if (s->ClientAuth->AuthType != CLIENT_AUTHTYPE_OPENSSLENGINE) - { - s->ClientAuth->ClientK = CloneK(s->ClientAuth->ClientK); - } - else - { - s->ClientAuth->ClientK = OpensslEngineToK(s->ClientAuth->OpensslEnginePrivateKeyName, s->ClientAuth->OpensslEngineName); - } - } - - if (StrCmpi(s->ClientOption->DeviceName, LINK_DEVICE_NAME) == 0) - { - // Link client mode - s->LinkModeClient = true; - s->Link = (LINK *)s->PacketAdapter->Param; - } - - if (StrCmpi(s->ClientOption->DeviceName, SNAT_DEVICE_NAME) == 0) - { - // SecureNAT mode - s->SecureNATMode = true; - } - - if (StrCmpi(s->ClientOption->DeviceName, BRIDGE_DEVICE_NAME) == 0) - { - // Bridge mode - s->BridgeMode = true; - } - - if (s->VirtualHost) - { - VH *v = (VH *)s->PacketAdapter->Param; - - // Add the session object to VH - v->Session = s; - AddRef(s->ref); - } - - s->Account = account; - - if (s->ClientAuth->AuthType == CLIENT_AUTHTYPE_SECURE) - { - // Do not retry in the case of a smart card authentication - s->ClientOption->NumRetry = 0; - } - - // Create a client thread - t = NewThread(ClientThread, (void *)s); - WaitThreadInit(t); - ReleaseThread(t); - - return s; -} -SESSION *NewClientSession(CEDAR *cedar, CLIENT_OPTION *option, CLIENT_AUTH *auth, PACKET_ADAPTER *pa) -{ - return NewClientSessionEx(cedar, option, auth, pa, NULL); -} - -// Get the session from the session key -SESSION *GetSessionFromKey(CEDAR *cedar, UCHAR *session_key) -{ - HUB *h; - UINT i, j; - // Validate arguments - if (cedar == NULL || session_key == NULL) - { - return NULL; - } - - LockList(cedar->HubList); - { - for (i = 0;i < LIST_NUM(cedar->HubList);i++) - { - h = LIST_DATA(cedar->HubList, i); - LockList(h->SessionList); - { - for (j = 0;j < LIST_NUM(h->SessionList);j++) - { - SESSION *s = LIST_DATA(h->SessionList, j); - Lock(s->lock); - { - if (Cmp(s->SessionKey, session_key, SHA1_SIZE) == 0) - { - // Session found - AddRef(s->ref); - - // Unlock - Unlock(s->lock); - UnlockList(h->SessionList); - UnlockList(cedar->HubList); - return s; - } - } - Unlock(s->lock); - } - } - UnlockList(h->SessionList); - } - } - UnlockList(cedar->HubList); - - return NULL; -} - -// Create a new session key -void NewSessionKey(CEDAR *cedar, UCHAR *session_key, UINT *session_key_32) -{ - // Validate arguments - if (cedar == NULL || session_key == NULL || session_key_32 == NULL) - { - return; - } - - Rand(session_key, SHA1_SIZE); - *session_key_32 = Rand32(); -} - -bool if_init(SESSION *s); -CANCEL *if_getcancel(SESSION *s); -UINT if_getnext(SESSION *s, void **data); -bool if_putpacket(SESSION *s, void *data, UINT size); -void if_free(SESSION *s); - - -// Create a server session -SESSION *NewServerSession(CEDAR *cedar, CONNECTION *c, HUB *h, char *username, POLICY *policy) -{ - return NewServerSessionEx(cedar, c, h, username, policy, false, NULL); -} -SESSION *NewServerSessionEx(CEDAR *cedar, CONNECTION *c, HUB *h, char *username, POLICY *policy, bool inproc_mode, UCHAR *ipc_mac_address) -{ - SESSION *s; - char name[MAX_SIZE]; - char hub_name_upper[MAX_SIZE]; - char user_name_upper[MAX_USERNAME_LEN + 1]; - // Validate arguments - if (cedar == NULL || c == NULL || h == NULL || username == NULL || policy == NULL) - { - return NULL; - } - - // Initialize the SESSION object - s = ZeroMalloc(sizeof(SESSION)); - - s->LoggingRecordCount = NewCounter(); - s->lock = NewLock(); - s->ref = NewRef(); - s->Cedar = cedar; - s->ServerMode = true; - s->CreatedTime = s->LastCommTime = Tick64(); - s->Traffic = NewTraffic(); - s->HaltEvent = NewEvent(); - s->Cancel1 = NewCancel(); - s->CancelList = NewCancelList(); - s->Thread = c->Thread; - s->TrafficLock = NewLock(); - s->OldTraffic = NewTraffic(); - s->QoS = GetServerCapsBool(cedar->Server, "b_support_qos"); - AddRef(s->Thread->ref); - s->Hub = h; - s->ClientStatus = CLIENT_STATUS_ESTABLISHED; - - // Delayed packet list - s->DelayedPacketList = NewList(NULL); - - // Packet adapter for the HUB - s->PacketAdapter = GetHubPacketAdapter(); - - s->Connection = c; - AddRef(c->ref); - - // Determine the new session name - StrCpy(hub_name_upper, sizeof(hub_name_upper), h->Name); - StrUpper(hub_name_upper); - StrCpy(user_name_upper, sizeof(user_name_upper), username); - StrUpper(user_name_upper); - - if ((StrCmpi(username, ADMINISTRATOR_USERNAME) != 0) && (StrCmpi(username, BRIDGE_USER_NAME) != 0) || (cedar->Server == NULL || cedar->Server->ServerType == SERVER_TYPE_STANDALONE)) - { - if (IsEmptyStr(c->InProcPrefix)) - { - Format(name, sizeof(name), "SID-%s-%u", user_name_upper, Inc(h->SessionCounter)); - } - else - { - Format(name, sizeof(name), "SID-%s-[%s]-%u", user_name_upper, c->InProcPrefix, Inc(h->SessionCounter)); - } - - if (h->IsVgsHub || h->IsVgsSuperRelayHub) - { - UCHAR rand[5]; - char tmp[32]; - - Rand(rand, sizeof(rand)); - - BinToStr(tmp, sizeof(tmp), rand, sizeof(rand)); - - StrCat(name, sizeof(name), "-"); - StrCat(name, sizeof(name), tmp); - } - } - else - { - UCHAR rand[SHA1_SIZE]; - char tmp[MAX_SIZE]; - Rand(rand, sizeof(rand)); - BinToStr(tmp, sizeof(tmp), rand, 3); - - if (StrCmpi(username, BRIDGE_USER_NAME) != 0) - { - Format(name, sizeof(name), "SID-%s-%s", user_name_upper, - tmp); - } - else - { - char pc_name[MAX_SIZE]; - TOKEN_LIST *t; - - GetMachineName(tmp, sizeof(tmp)); - t = ParseToken(tmp, "."); - if (t->NumTokens >= 1) - { - StrCpy(pc_name, sizeof(pc_name), t->Token[0]); - } - else - { - StrCpy(pc_name, sizeof(pc_name), "pc"); - } - FreeToken(t); - - StrUpper(pc_name); - - Format(name, sizeof(name), "SID-%s-%s-%u", user_name_upper, pc_name, - Inc(h->SessionCounter)); - } - } - - s->Name = CopyStr(name); - s->Policy = policy; - s->InProcMode = inproc_mode; - - // Add a SESSION to the HUB - AddSession(h, s); - - // Create a key - NewSessionKey(cedar, s->SessionKey, &s->SessionKey32); - - // Generate a MAC address for IPC - if (s->InProcMode) - { - if (ipc_mac_address != NULL) - { - Copy(s->IpcMacAddress, ipc_mac_address, 6); - } - else - { - char tmp[MAX_SIZE]; - char machine[MAX_SIZE]; - UCHAR hash[SHA1_SIZE]; - - GetMachineName(machine, sizeof(machine)); - - Format(tmp, sizeof(tmp), "%s@%s@%u", machine, h->Name, s->UniqueId); - - StrUpper(tmp); - Trim(tmp); - - Sha0(hash, tmp, StrLen(tmp)); - - s->IpcMacAddress[0] = 0xCA; - s->IpcMacAddress[1] = hash[1]; - s->IpcMacAddress[2] = hash[2]; - s->IpcMacAddress[3] = hash[3]; - s->IpcMacAddress[4] = hash[4]; - s->IpcMacAddress[5] = hash[5]; - - MacToStr(tmp, sizeof(tmp), s->IpcMacAddress); - Debug("MAC Address for IPC: %s\n", tmp); - } - } - - return s; -} - -// Check whether the specified MAC address is IPC address -bool IsIpcMacAddress(UCHAR *mac) -{ - // Validate arguments - if (mac == NULL) - { - return false; - } - - if (mac[0] == 0xCA) - { - return true; - } - - return false; -} - -// Display the status on the client -void PrintStatus(SESSION *s, wchar_t *str) -{ - // Validate arguments - if (s == NULL || str == NULL || s->Account == NULL || s->Cedar->Client == NULL - || s->Account->StatusPrinter == NULL) - { - return; - } - - // Inform the status to the callback function - s->Account->StatusPrinter(s, str); -} - -// Create a cancellation list -LIST *NewCancelList() -{ - return NewList(NULL); -} - -// Add a Cancel to the cancellation list -void AddCancelList(LIST *o, CANCEL *c) -{ - UINT i; - // Validate arguments - if (o == NULL || c == NULL) - { - return; - } - - for (i = 0;i < LIST_NUM(o);i++) - { - CANCEL *t = LIST_DATA(o, i); - if (t == c) - { - return; - } - } - - AddRef(c->ref); - Add(o, c); -} - -// Issue all cancellations in the cancellation list -void CancelList(LIST *o) -{ - UINT i; - // Validate arguments - if (o == NULL) - { - return; - } - - for (i = 0;i < LIST_NUM(o);i++) - { - CANCEL *c = LIST_DATA(o, i); - Cancel(c); - ReleaseCancel(c); - } - - DeleteAll(o); -} - -// Release the cancellation list -void ReleaseCancelList(LIST *o) -{ - UINT i; - // Validate arguments - if (o == NULL) - { - return; - } - - for (i = 0;i < LIST_NUM(o);i++) - { - CANCEL *c = LIST_DATA(o, i); - ReleaseCancel(c); - } - - ReleaseList(o); -} - -// Notify to the client -void Notify(SESSION *s, UINT code) -{ - // Validate arguments - if (s == NULL || s->Account == NULL || s->Cedar->Client == NULL) - { - return; - } - - CiNotify(s->Cedar->Client); -} - - -UINT PrepareDHCPRequestForStaticIPv4(SESSION *s, BLOCK *b) -{ - PKT *pkt = NULL; - DHCPV4_HEADER *dhcp = NULL; - UCHAR *data = NULL; - UINT size = 0; - UINT dhcp_header_size = 0; - UINT dhcp_data_offset = 0; - UINT magic_cookie = Endian32(DHCP_MAGIC_COOKIE); - DHCP_OPTION_LIST *opt = NULL; - USER *user = NULL; - UINT ret_ip = 0; - - if ((s->Username == NULL) || (StrLen(s->Username) == 0) || (StrCmpi(s->Username, SNAT_USER_NAME_PRINT) == 0) || - (StrCmpi( s->Username, BRIDGE_USER_NAME_PRINT) == 0) || (StrCmpi(s->Username, LINK_USER_NAME_PRINT) == 0)) - { - return ret_ip; - } - - pkt = ParsePacket(b->Buf, b->Size); - if (pkt == NULL) - { - return ret_ip; - } - - if (pkt->TypeL3 == L3_IPV4 && pkt->TypeL4 == L4_UDP && pkt->TypeL7 == L7_DHCPV4) - { - if (pkt->L7.DHCPv4Header->OpCode != 1) - { - goto CLEANUP_TP; - } - - dhcp = pkt->L7.DHCPv4Header; - dhcp_header_size = sizeof(DHCPV4_HEADER); - dhcp_data_offset = (UINT)(((UCHAR *)pkt->L7.DHCPv4Header) - ((UCHAR *)pkt->MacHeader) + dhcp_header_size); - data = ((UCHAR *)dhcp) + dhcp_header_size; - size = pkt->PacketSize - dhcp_data_offset; - - if (dhcp_header_size < 5) - { - goto CLEANUP_TP; - } - - // Search for Magic Cookie - while (size >= 5) - { - if (Cmp(data, &magic_cookie, sizeof(magic_cookie)) == 0) - { - // Found - data += 4; - size -= 4; - opt = ParseDhcpOptionList(data, size); - break; - } - - ++data; - --size; - } - - if (opt == NULL) - { - goto CLEANUP_TP; - } - - if (opt->Opcode == DHCP_DISCOVER || opt->Opcode == DHCP_REQUEST) - { - if (s->Hub != NULL) - { - user = AcGetUser( s->Hub, s->Username ); - if (user != NULL) - { - dhcp->ServerIP = GetUserIPv4AddressFromUserNote32(user->Note); - ReleaseUser(user); - if (s->Hub->SecureNAT != NULL && s->Hub->SecureNAT->Nat != NULL) - { - VH *v = s->Hub->SecureNAT->Nat->Virtual; - if (v != NULL && v->UseDhcp == true && v->DhcpLeaseList != NULL) - { - DHCP_LEASE *d = SearchDhcpLeaseByIp(v, dhcp->ServerIP); - - // The given static IP address is not used - it's OK - if (d == NULL) - { - ret_ip = dhcp->ServerIP; - } - } - } - } - } - } - } - -CLEANUP_TP: - if (opt != NULL) - { - Free(opt); - } - - if (pkt != NULL) - { - FreePacket(pkt); - } - - return ret_ip; -} - -void ClearDHCPLeaseRecordForIPv4(SESSION *s, UINT static_ip) -{ - if (s == NULL || static_ip == 0) - { - return; - } - - if (s->Hub == NULL || s->Hub->SecureNAT == NULL || s->Hub->SecureNAT->Nat == NULL) - { - return; - } - - VH *v = s->Hub->SecureNAT->Nat->Virtual; - if (v == NULL || v->DhcpLeaseList == NULL) - { - return; - } - - DHCP_LEASE *d = SearchDhcpLeaseByIp(v, static_ip); - if (d == NULL) - { - return; - } - - LockList(v->DhcpLeaseList); - { - FreeDhcpLease(d); - Delete(v->DhcpLeaseList, d); - } - UnlockList( v->DhcpLeaseList); -} +// SoftEther VPN Source Code - Developer Edition Master Branch +// Cedar Communication Module +// © 2020 Nokia + +// Session.c +// Session Manager + +#include "CedarPch.h" + +// Main routine of the session +void SessionMain(SESSION *s) +{ + CONNECTION *c; + POLICY *policy; + UINT64 now; + UINT i = 0; + PACKET_ADAPTER *pa; + bool pa_inited = false; + UINT packet_size; + void *packet; + bool packet_put; + bool pa_fail = false; + UINT test = 0; + bool update_hub_last_comm = false; + UINT err = ERR_SESSION_TIMEOUT; + UINT64 next_black_list_check = 0; + UINT64 next_update_hub_last_comm = 0; + UINT64 auto_disconnect_tick = 0; + bool block_all_packets = false; + UINT64 next_check_block_all_packets = 0; + TRAFFIC t; + SOCK *msgdlg_sock = NULL; + SOCK *nicinfo_sock = NULL; + bool is_server_session = false; + bool lock_receive_blocks_queue = false; + UINT static_ip = 0; + + // Validate arguments + if (s == NULL) + { + return; + } + + Debug("SessionMain: %s\n", s->Name); + + Notify(s, CLIENT_NOTIFY_ACCOUNT_CHANGED); + + // Generate a string from the session key + BinToStr(s->SessionKeyStr, sizeof(s->SessionKeyStr), s->SessionKey, sizeof(s->SessionKey)); + + // Reset the number of retries + s->CurrentRetryCount = 0; + s->ConnectSucceed = true; + s->SessionTimeOuted = false; + s->NumDisconnected = 0; + + c = s->Connection; + policy = s->Policy; + + // Initialize the packet adapter +#ifdef OS_WIN32 + if (s->IsVPNClientAndVLAN_Win32) + { + MsBeginVLanCard(); + + if (MsIsVLanCardShouldStop()) + { + err = ERR_SUSPENDING; + goto CLEANUP; + } + } +#endif // OS_WIN32 + + pa = s->PacketAdapter; + if (pa->Init(s) == false) + { + // Initialization Failed + if (s->VLanDeviceErrorCount >= 2) + { + s->ForceStopFlag = true; + } + else + { + s->VLanDeviceErrorCount++; + } + err = ERR_DEVICE_DRIVER_ERROR; + goto CLEANUP; + } + pa_inited = true; + + if (s->BridgeMode == false) + { + s->Cancel2 = pa->GetCancel(s); + } + else + { + CANCEL *c = pa->GetCancel(s); + CANCEL *old = s->Cancel1; + s->Cancel1 = c; + ReleaseCancel(old); + } + + s->RetryFlag = false; + + s->LastCommTime = Tick64(); + if (s->ServerMode == false) + { + s->NextConnectionTime = Tick64() + (UINT64)((UINT64)s->ClientOption->AdditionalConnectionInterval * (UINT64)1000); + } + + s->NumConnectionsEstablished++; + s->CurrentConnectionEstablishTime = Tick64(); + if (s->FirstConnectionEstablisiedTime == 0) /* !!! Do not correct the spelling to keep the backward protocol compatibility !!! */ + { + s->FirstConnectionEstablisiedTime = Tick64(); /* !!! Do not correct the spelling to keep the backward protocol compatibility !!! */ + } + + if (s->ServerMode == false && s->Cedar->Client != NULL) + { + if (s->Policy != NULL) + { + if (s->Policy->AutoDisconnect) + { + auto_disconnect_tick = s->CurrentConnectionEstablishTime + + (UINT64)s->Policy->AutoDisconnect * 1000ULL; + } + } + } + + s->LastIncrementTraffic = Tick64(); + + c->Err = ERR_SESSION_TIMEOUT; + s->VLanDeviceErrorCount = 0; + + s->LastTryAddConnectTime = Tick64(); + + Notify(s, CLIENT_NOTIFY_ACCOUNT_CHANGED); + + if (policy != NULL) + { + // Determine the mode by referencing the contents of the policy + if (policy->MonitorPort) + { + s->IsMonitorMode = true; + } + + if (policy->NoRouting == false || policy->NoBridge == false) + { + s->IsBridgeMode = true; + } + } + + if (s->ServerMode == false && s->Cedar->Client != NULL) + { + if (IsEmptyUniStr(s->Client_Message) == false) + { + UI_MSG_DLG dlg; + + Zero(&dlg, sizeof(dlg)); + if (s->ClientOption != NULL) + { + StrCpy(dlg.HubName, sizeof(dlg.HubName), s->ClientOption->HubName); + StrCpy(dlg.ServerName, sizeof(dlg.ServerName), s->ClientOption->Hostname); + } + + dlg.Msg = s->Client_Message; + + msgdlg_sock = CncMsgDlg(&dlg); + } + + if (s->Win32HideNicInfoWindow == false) + { + UI_NICINFO info; + + Zero(&info, sizeof(info)); + if (s->ClientOption != NULL) + { + StrCpy(info.NicName, sizeof(info.NicName), s->ClientOption->DeviceName); + UniStrCpy(info.AccountName, sizeof(info.AccountName), s->ClientOption->AccountName); + } + + nicinfo_sock = CncNicInfo(&info); + } + } + + is_server_session = s->ServerMode; + + lock_receive_blocks_queue = s->LinkModeServer; + + now = Tick64(); + + while (true) + { + Zero(&t, sizeof(t)); + + + if (next_update_hub_last_comm == 0 || + (next_update_hub_last_comm <= now)) + { + next_update_hub_last_comm = now + 1000; + + if (s->Hub != NULL) + { + if (update_hub_last_comm) + { + Lock(s->Hub->lock); + { + s->Hub->LastCommTime = SystemTime64(); + } + Unlock(s->Hub->lock); + + update_hub_last_comm = false; + } + } + } + + + if (is_server_session && s->LinkModeServer == false && s->SecureNATMode == false && s->BridgeMode == false && s->L3SwitchMode == false) + { + if (s->Hub != NULL && s->Hub->ForceDisableComm) + { + // Disconnect the session forcibly because the ForceDisableComm flag is set + err = ERR_SERVER_CANT_ACCEPT; + pa_fail = true; + } + } + + if (s->InProcMode) + { + if (c->TubeSock == NULL || IsTubeConnected(c->TubeSock->SendTube) == false || IsTubeConnected(c->TubeSock->RecvTube) == false) + { + // Disconnection occurs in the in-process mode + err = ERR_DISCONNECTED; + pa_fail = true; + } + } + + if (s->IsRUDPSession) + { + if (s->NumDisconnected >= 1 && s->EnableUdpRecovery == false) + { + // Disconnection occurs in the R-UDP session (UDP recovery is invalid) + err = ERR_DISCONNECTED; + pa_fail = true; + } + } + + // Chance of additional connection + if (is_server_session == false) + { + if (GetGlobalServerFlag(GSF_DISABLE_SESSION_RECONNECT) == false) + { + ClientAdditionalConnectChance(s); + } + } + + // Receive a block + ConnectionReceive(c, s->Cancel1, s->Cancel2); + + // Get the current time + now = Tick64(); + + if (s->UseUdpAcceleration && s->UdpAccel != NULL && s->UdpAccel->FatalError) + { + // A serious error occurs during sending any data on UDP socket + // in the case of using UDP acceleration function + err = ERR_DISCONNECTED; + pa_fail = true; + } + +#ifdef OS_WIN32 + if (s->IsVPNClientAndVLAN_Win32) + { + if (MsIsVLanCardShouldStop()) + { + // System is suspending + err = ERR_SUSPENDING; + pa_fail = true; + } + } +#endif // OS_WIN32 + + // Pass the received block to the PacketAdapter + if (lock_receive_blocks_queue) + { + LockQueue(c->ReceivedBlocks); + } + { + BLOCK *b; + packet_put = false; + while (true) + { + b = GetNext(c->ReceivedBlocks); + if (b == NULL) + { + break; + } + + PROBE_DATA2("GetNext", b->Buf, b->Size); + + update_hub_last_comm = true; + + if (b->Size >= 14) + { + UINT ip; + if( (ip = PrepareDHCPRequestForStaticIPv4( s, b )) != 0 ) + { + // Remember the static IP address to remove it from the leased IP address list later + static_ip = ip; + } + + if (b->Buf[0] & 0x01) + { + if (is_server_session == false) + { + t.Recv.BroadcastCount++; + t.Recv.BroadcastBytes += (UINT64)b->Size; + } + else + { + t.Send.BroadcastCount++; + t.Send.BroadcastBytes += (UINT64)b->Size; + } + } + else + { + if (is_server_session == false) + { + t.Recv.UnicastCount++; + t.Recv.UnicastBytes += (UINT64)b->Size; + } + else + { + t.Send.UnicastCount++; + t.Send.UnicastBytes += (UINT64)b->Size; + } + } + } + + packet_put = true; + PROBE_DATA2("pa->PutPacket", b->Buf, b->Size); + if (pa->PutPacket(s, b->Buf, b->Size) == false) + { + pa_fail = true; + err = ERR_DEVICE_DRIVER_ERROR; + Free(b->Buf); + Debug(" Error: pa->PutPacket(Packet) Failed.\n"); + } + Free(b); + } + + if (true /* packet_put || is_server_session 2014.7.23 for optimizing */) + { + PROBE_DATA2("pa->PutPacket", NULL, 0); + if (pa->PutPacket(s, NULL, 0) == false) + { + Debug(" Error: pa->PutPacket(NULL) Failed.\n"); + pa_fail = true; + err = ERR_DEVICE_DRIVER_ERROR; + } + } + } + if (lock_receive_blocks_queue) + { + UnlockQueue(c->ReceivedBlocks); + } + + // Add the packet to be transmitted to SendBlocks by acquiring from PacketAdapter + { + UINT i, max_num = MAX_SEND_SOCKET_QUEUE_NUM; + i = 0; + while (packet_size = pa->GetNextPacket(s, &packet)) + { + BLOCK *b; + if (packet_size == INFINITE) + { + err = ERR_DEVICE_DRIVER_ERROR; + pa_fail = true; + Debug(" Error: pa->GetNextPacket() Failed.\n"); + break; + } + + update_hub_last_comm = true; + + if ((c->CurrentSendQueueSize > MAX_BUFFERING_PACKET_SIZE) || + block_all_packets) + { +// WHERE; + // Discard because it exceeded the buffer size limit + Free(packet); + } + else + { + bool priority; + QUEUE *q = NULL; + // Buffering + if (packet_size >= 14) + { + UCHAR *buf = (UCHAR *)packet; + if (buf[0] & 0x01) + { + if (is_server_session == false) + { + t.Send.BroadcastCount++; + t.Send.BroadcastBytes += (UINT64)packet_size; + } + else + { + t.Recv.BroadcastCount++; + t.Recv.BroadcastBytes += (UINT64)packet_size; + } + } + else + { + if (is_server_session == false) + { + t.Send.UnicastCount++; + t.Send.UnicastBytes += (UINT64)packet_size; + } + else + { + t.Recv.UnicastCount++; + t.Recv.UnicastBytes += (UINT64)packet_size; + } + } + } + priority = IsPriorityHighestPacketForQoS(packet, packet_size); + + b = NewBlock(packet, packet_size, s->UseCompress ? 1 : 0); + b->PriorityQoS = priority; + + if (b->PriorityQoS && c->Protocol == CONNECTION_TCP && s->QoS) + { + q = c->SendBlocks2; + } + else + { + q = c->SendBlocks; + } + + if (q->num_item > MAX_STORED_QUEUE_NUM) + { + q = NULL; + } + + if (q != NULL) + { + c->CurrentSendQueueSize += b->Size; + InsertQueue(q, b); + } + else + { + FreeBlock(b); + } + } + + if ((i % 16) == 0) + { + int diff = ((int)c->CurrentSendQueueSize) - ((int)c->LastPacketQueueSize); + CedarAddCurrentTcpQueueSize(c->Cedar, diff); + c->LastPacketQueueSize = c->CurrentSendQueueSize; + } + + i++; + if (i >= max_num) + { + break; + } + } + } + + AddTrafficForSession(s, &t); + + if (true) + { + int diff = ((int)c->CurrentSendQueueSize) - ((int)c->LastPacketQueueSize); + CedarAddCurrentTcpQueueSize(c->Cedar, diff); + c->LastPacketQueueSize = c->CurrentSendQueueSize; + } + + now = Tick64(); + + // Send a block + ConnectionSend(c, now); + + // Determine the automatic disconnection + if (auto_disconnect_tick != 0 && auto_disconnect_tick <= now) + { + err = ERR_AUTO_DISCONNECTED; + s->CurrentRetryCount = INFINITE; + break; + } + + // Stop determination + if (s->Halt) + { + if (s->ForceStopFlag) + { + err = ERR_USER_CANCEL; + } + break; + } + + // Increments the number of logins for user object and Virtual HUB object. + // (It's incremented only if the time 30 seconds passed after connection. + // If not do this, it will be incremented on DoS attacks or any error.) + if (s->NumLoginIncrementTick != 0 && s->NumLoginIncrementTick <= now) + { + s->NumLoginIncrementTick = 0; + + if (s->NumLoginIncrementHubObject != NULL) + { + s->NumLoginIncrementHubObject->NumLogin++; + } + + if (s->NumLoginIncrementUserObject != NULL) + { + s->NumLoginIncrementUserObject->NumLogin++; + } + } + + if (is_server_session) + { + HUB *hub; + + // Update of traffic data of the user + if ((s->LastIncrementTraffic + INCREMENT_TRAFFIC_INTERVAL) <= now) + { + IncrementUserTraffic(s->Hub, s->UserNameReal, s); + s->LastIncrementTraffic = now; + } + + hub = s->Hub; + + if (hub != NULL) + { + if ((hub->LastIncrementTraffic + INCREMENT_TRAFFIC_INTERVAL) <= now) + { + hub->LastIncrementTraffic = now; + IncrementHubTraffic(s->Hub); + } + } + } + + if (s->LinkModeServer == false && s->SecureNATMode == false && s->BridgeMode == false && s->L3SwitchMode == false && s->InProcMode == false) + { + bool timeouted = false; + + if ((now > s->LastCommTime) && ((now - s->LastCommTime) >= ((UINT64)s->Timeout))) + { + // When communication is not possible for the predetermined time + timeouted = true; + WHERE; + } + + if (c->Protocol == CONNECTION_TCP) + { + if (GetGlobalServerFlag(GSF_DISABLE_SESSION_RECONNECT)) + { + UINT num_tcp_connections = Count(c->CurrentNumConnection); + + if (num_tcp_connections == 0) + { + // All TCP connections are disconnected. + // Terminate the session immediately. + timeouted = true; + } + } + } + + if (is_server_session == false && s->ClientOption != NULL && s->ClientOption->ConnectionDisconnectSpan == 0) + { + if (LIST_NUM(s->Connection->Tcp->TcpSockList) < s->MaxConnection) + { + if ((s->LastTryAddConnectTime + + (UINT64)(s->ClientOption->AdditionalConnectionInterval * 1000 * 2 + CONNECTING_TIMEOUT * 2)) + <= Tick64()) + { + if (s->IsRUDPSession == false || LIST_NUM(s->Connection->Tcp->TcpSockList) == 0) + { + timeouted = true; + WHERE; + } + } + } + } + + if (timeouted) + { + // Timeout occurs + Debug("** Session Timeouted.\n"); + s->SessionTimeOuted = true; + err = ERR_SESSION_TIMEOUT; + } + } + + // Time-out decision + if (pa_fail || s->SessionTimeOuted) + { + s->Halt = true; + s->RetryFlag = true; // Retry flag + break; + } + } + +CLEANUP: + Debug("Session %s Finishing...\n", s->Name); + + // Remove from the session list of the HUB + if (s->ServerMode) + { + // Update the user information + IncrementUserTraffic(s->Hub, s->UserNameReal, s); + + // Clear the DHCP lease record if assigned as a static client IP address + ClearDHCPLeaseRecordForIPv4(s, static_ip); + + DelSession(s->Hub, s); + } + + s->ConnectSucceed = false; + Notify(s, CLIENT_NOTIFY_ACCOUNT_CHANGED); + + if (s->Connection) + { + int diff = -((int)s->Connection->LastTcpQueueSize); + s->Connection->LastTcpQueueSize = 0; + s->Connection->Halt = true; + CedarAddCurrentTcpQueueSize(s->Cedar, diff); + + diff = ((int)c->CurrentSendQueueSize) - ((int)c->LastPacketQueueSize); + CedarAddCurrentTcpQueueSize(c->Cedar, diff); + c->LastPacketQueueSize = c->CurrentSendQueueSize; + } + + // Release the packet adapter + if (pa_inited) + { + pa->Free(s); + } + +#ifdef OS_WIN32 + if (s->IsVPNClientAndVLAN_Win32) + { + MsEndVLanCard(); + } +#endif // OS_WIN32 + + if (s->ServerMode == false) + { + // Cancel to make all additional connection + StopAllAdditionalConnectThread(s->Connection); + } + + if (s->BridgeMode) + { + // Terminate the bridge + if (s->Bridge->Active) + { + CloseEth(s->Bridge->Eth); + s->Bridge->Eth = NULL; + } + } + + if (s->Cancel2 != NULL) + { + // Release the Cancel 2 + ReleaseCancel(s->Cancel2); + s->Cancel2 = NULL; + } + + // Terminate the connection + EndTunnelingMode(c); + + if (nicinfo_sock != NULL) + { + CncNicInfoFree(nicinfo_sock); + } + + if (msgdlg_sock != NULL) + { + CndMsgDlgFree(msgdlg_sock); + } + + c->Err = err; +} + +// Get the time for the next delayed packet +UINT GetNextDelayedPacketTickDiff(SESSION *s) +{ + UINT i; + UINT ret = 0x7fffffff; + UINT64 now; + // Validate arguments + if (s == NULL) + { + return 0; + } + + if (LIST_NUM(s->DelayedPacketList) >= 1) + { + now = TickHighres64(); + + LockList(s->DelayedPacketList); + { + for (i = 0;i < LIST_NUM(s->DelayedPacketList);i++) + { + PKT *p = LIST_DATA(s->DelayedPacketList, i); + UINT64 t = p->DelayedForwardTick; + UINT d = 0x7fffffff; + + if (now >= t) + { + d = 0; + } + else + { + d = (UINT)(t - now); + } + + ret = MIN(ret, d); + } + } + UnlockList(s->DelayedPacketList); + } + + return ret; +} + +// Determine whether the packet have priority in the VoIP / QoS function +bool IsPriorityHighestPacketForQoS(void *data, UINT size) +{ + UCHAR *buf; + // Validate arguments + if (data == NULL) + { + return false; + } + + buf = (UCHAR *)data; + if (size >= 16) + { + if (buf[12] == 0x08 && buf[13] == 0x00 && buf[15] != 0x00 && buf[15] != 0x08) + { + // IPv4 packet and ToS != 0 + return true; + } + + if (size >= 34 && size <= 128) + { + if (buf[12] == 0x08 && buf[13] == 0x00 && buf[23] == 0x01) + { + // IMCPv4 packet + return true; + } + } + } + + return false; +} + +// Update the traffic information of the user +void IncrementUserTraffic(HUB *hub, char *username, SESSION *s) +{ + TRAFFIC report_traffic; + // Validate arguments + if (hub == NULL || username == NULL || s == NULL) + { + return; + } + + Lock(s->TrafficLock); + { + // Calculate the traffic information (difference between last time) to be reported + report_traffic.Send.BroadcastBytes = + s->Traffic->Send.BroadcastBytes - s->OldTraffic->Send.BroadcastBytes; + report_traffic.Send.BroadcastCount = + s->Traffic->Send.BroadcastCount - s->OldTraffic->Send.BroadcastCount; + report_traffic.Send.UnicastBytes = + s->Traffic->Send.UnicastBytes - s->OldTraffic->Send.UnicastBytes; + report_traffic.Send.UnicastCount = + s->Traffic->Send.UnicastCount - s->OldTraffic->Send.UnicastCount; + report_traffic.Recv.BroadcastBytes = + s->Traffic->Recv.BroadcastBytes - s->OldTraffic->Recv.BroadcastBytes; + report_traffic.Recv.BroadcastCount = + s->Traffic->Recv.BroadcastCount - s->OldTraffic->Recv.BroadcastCount; + report_traffic.Recv.UnicastBytes = + s->Traffic->Recv.UnicastBytes - s->OldTraffic->Recv.UnicastBytes; + report_traffic.Recv.UnicastCount = + s->Traffic->Recv.UnicastCount - s->OldTraffic->Recv.UnicastCount; + Copy(s->OldTraffic, s->Traffic, sizeof(TRAFFIC)); + + if (hub->FarmMember == false) + { + // Update the user information in the local database if it is not a farm member + AcLock(hub); + { + USER *u = AcGetUser(hub, username); + if (u != NULL) + { + Lock(u->lock); + { + AddTraffic(u->Traffic, &report_traffic); + } + Unlock(u->lock); + if (u->Group != NULL) + { + Lock(u->Group->lock); + { + AddTraffic(u->Group->Traffic, &report_traffic); + } + Unlock(u->Group->lock); + } + ReleaseUser(u); + } + } + AcUnlock(hub); + } + else + { + // Update the traffic difference report list in the case of farm member + AddTrafficDiff(hub, username, TRAFFIC_DIFF_USER, &report_traffic); + } + } + Unlock(s->TrafficLock); +} + +// Cumulate the traffic information of the connection +void AddTrafficForSession(SESSION *s, TRAFFIC *t) +{ + HUB *h; + TRAFFIC t2; + // Validate arguments + if (s == NULL || t == NULL) + { + return; + } + + Lock(s->TrafficLock); + { + AddTraffic(s->Traffic, t); + } + Unlock(s->TrafficLock); + + if (s->ServerMode) + { + Copy(&t2.Recv, &t->Send, sizeof(TRAFFIC_ENTRY)); + Copy(&t2.Send, &t->Recv, sizeof(TRAFFIC_ENTRY)); + Lock(s->Cedar->TrafficLock); + { + AddTraffic(s->Cedar->Traffic, &t2); + } + Unlock(s->Cedar->TrafficLock); + + h = s->Hub; + Lock(h->TrafficLock); + { + AddTraffic(h->Traffic, &t2); + } + Unlock(h->TrafficLock); + } +} + +// A chance to establish an additional connection for client +void ClientAdditionalConnectChance(SESSION *s) +{ + // Validate arguments + if (s == NULL) + { + return; + } + + if (s->ServerMode) + { + // Do not connect additionally in the server mode + return; + } + if (s->Connection->Protocol != CONNECTION_TCP) + { + // Connect additionally only in the case of TCP protocol + return; + } + if (s->IsRUDPSession && s->EnableUdpRecovery == false) + { + // Do not connect additionally if the UDP recovery is disabled in the case of R-UDP session + return; + } + + if (s->IsRUDPSession && (s->Connection->AdditionalConnectionFailedCounter > MAX_ADDITIONAL_CONNECTION_FAILED_COUNTER)) + { + // Not to make a large amount of repeated connection retry within a certain time in the case of R-UDP session + return; + } + + while (true) + { + if (s->Halt) + { + return; + } + // Consider whether there is a need to put an additional connection + // by examining the number of current connections and MaxConnection property + if (Count(s->Connection->CurrentNumConnection) < s->MaxConnection) + { + // Get the current time + UINT64 now = Tick64(); + + // Examine the NextConnectionTime, and if the time passed, + // attempt to make a connection + if (s->NextConnectionTime == 0 || + s->ClientOption->AdditionalConnectionInterval == 0 || + (s->NextConnectionTime <= now)) + { + // Start the work to put an additional connection + s->NextConnectionTime = now + ((UINT64)s->ClientOption->AdditionalConnectionInterval * (UINT64)1000); + SessionAdditionalConnect(s); + } + else + { + break; + } + } + else + { + break; + } + } +} + +// Release the packet adapter +void FreePacketAdapter(PACKET_ADAPTER *pa) +{ + // Validate arguments + if (pa == NULL) + { + return; + } + + Free(pa); +} + +// Create a new packet adapter +PACKET_ADAPTER *NewPacketAdapter(PA_INIT *init, PA_GETCANCEL *getcancel, PA_GETNEXTPACKET *getnext, + PA_PUTPACKET *put, PA_FREE *free) +{ + PACKET_ADAPTER *pa; + // Validate arguments + if (init == NULL || getcancel == NULL || getnext == NULL || put == NULL || free == NULL) + { + return NULL; + } + + pa = ZeroMalloc(sizeof(PACKET_ADAPTER)); + + pa->Init = init; + pa->Free = free; + pa->GetCancel = getcancel; + pa->GetNextPacket = getnext; + pa->PutPacket = put; + + return pa; +} + +// Thread for putting an additional connection +void ClientAdditionalThread(THREAD *t, void *param) +{ + SESSION *s; + CONNECTION *c; + // Validate arguments + if (t == NULL || param == NULL) + { + return; + } + + s = (SESSION *)param; + + s->LastTryAddConnectTime = Tick64(); + + c = s->Connection; + // Increment of connection counter + Inc(c->CurrentNumConnection); + LockList(c->ConnectingThreads); + { + // Add to processing thread + Add(c->ConnectingThreads, t); + AddRef(t->ref); + } + UnlockList(c->ConnectingThreads); + + // Notify the completion of initialization + NoticeThreadInit(t); + + Debug("Additional Connection #%u\n", Count(c->CurrentNumConnection)); + + // Put an additional connection + if (ClientAdditionalConnect(c, t) == false) + { + // Decrement the counter which is currently processing + Dec(c->CurrentNumConnection); + + if (c->AdditionalConnectionFailedCounter == 0) + { + c->LastCounterResetTick = Tick64(); + } + + c->AdditionalConnectionFailedCounter++; + + if ((c->LastCounterResetTick + (UINT64)ADDITIONAL_CONNECTION_COUNTER_RESET_INTERVAL) <= Tick64()) + { + // Reset the number of failures periodically + c->AdditionalConnectionFailedCounter = 0; + c->LastCounterResetTick = Tick64(); + } + } + else + { + s->LastTryAddConnectTime = Tick64(); + c->AdditionalConnectionFailedCounter = 0; + c->LastCounterResetTick = Tick64(); + } + + // Remove from the processing thread + LockList(c->ConnectingThreads); + { + // Remove from the processing thread + if (Delete(c->ConnectingThreads, t)) + { + ReleaseThread(t); + } + } + UnlockList(c->ConnectingThreads); + ReleaseSession(s); +} + +// Put an additional connection from the client to the server +void SessionAdditionalConnect(SESSION *s) +{ + THREAD *t; + // Validate arguments + if (s == NULL) + { + return; + } + + // s->LastTryAddConnectTime = Tick64(); + + AddRef(s->ref); + t = NewThread(ClientAdditionalThread, (void *)s); + WaitThreadInit(t); + ReleaseThread(t); +} + +// Connect the client session to the server +bool SessionConnect(SESSION *s) +{ + CONNECTION *c; + bool ret = false; + // Validate arguments + if (s == NULL) + { + return false; + } + + s->ClientStatus = CLIENT_STATUS_CONNECTING; + + Debug("SessionConnect() Started.\n"); + + // Initialize the session + Lock(s->lock); + { + s->Err = ERR_NO_ERROR; + if (s->Policy != NULL) + { + Free(s->Policy); + s->Policy = NULL; + } + } + Unlock(s->lock); + + s->CancelConnect = false; + + // Create a Client Connection + c = NewClientConnection(s); + s->Connection = c; + + // Connect the client to the server + ret = ClientConnect(c); + s->Err = c->Err; + + s->CancelConnect = false; + + if (s->Cedar->Client != NULL) + { + if (s->Policy != NULL) + { + if (s->Policy->NoSavePassword) + { + s->Client_NoSavePassword = true; + + if (s->Account != NULL) + { + Lock(s->Account->lock); + { + if (s->Account->ClientAuth != NULL) + { + if (s->Account->ClientAuth->AuthType == AUTHTYPE_PASSWORD || + s->Account->ClientAuth->AuthType == AUTHTYPE_RADIUS) + { + Zero(s->Account->ClientAuth->HashedPassword, sizeof(s->Account->ClientAuth->HashedPassword)); + Zero(s->Account->ClientAuth->PlainPassword, sizeof(s->Account->ClientAuth->PlainPassword)); + } + } + } + Unlock(s->Account->lock); + + CiSaveConfigurationFile(s->Cedar->Client); + } + } + } + } + + if (c->ClientConnectError_NoSavePassword) + { + s->Client_NoSavePassword = true; + } + + // Release the client connection + s->Connection = NULL; + ReleaseConnection(c); + + Lock(s->lock); + { + if (s->Policy != NULL) + { + Free(s->Policy); + s->Policy = NULL; + } + } + Unlock(s->lock); + + return ret; +} + +// Stop the session +void StopSession(SESSION *s) +{ + StopSessionEx(s, false); +} +void StopSessionEx(SESSION *s, bool no_wait) +{ + // Validate arguments + if (s == NULL) + { + return; + } + + // Halting flag + s->UserCanceled = true; + s->CancelConnect = true; + s->Halt = true; + + Debug("Stop Session %s\n", s->Name); + + // Cancel + Cancel(s->Cancel1); + + // Event + Set(s->HaltEvent); + + // Server and client mode + if (s->Connection) + { + CONNECTION *c = s->Connection; + AddRef(c->ref); + StopConnection(c, no_wait); + ReleaseConnection(c); + } + + // Wait until the stop + if (no_wait == false) + { + while (true) + { + s->ForceStopFlag = true; + s->Halt = true; + if (WaitThread(s->Thread, 20)) + { + break; + } + } + } + else + { + s->ForceStopFlag = true; + s->Halt = true; + } +} + +// Cleanup the session +void CleanupSession(SESSION *s) +{ + // Validate arguments + if (s == NULL) + { + return; + } + + // Release the delayed packet list + if (s->DelayedPacketList != NULL) + { + UINT i; + for (i = 0;i < LIST_NUM(s->DelayedPacketList);i++) + { + PKT *p = LIST_DATA(s->DelayedPacketList, i); + + Free(p->PacketData); + FreePacket(p); + } + + ReleaseList(s->DelayedPacketList); + } + + // Release the client connection options + if (s->ClientOption != NULL) + { +#ifdef OS_UNIX + UnixVLanSetState(s->ClientOption->DeviceName, false); +#endif + Free(s->ClientOption); + } + + // Release the client authentication data + if (s->ClientAuth != NULL) + { + if (s->ClientAuth->ClientX != NULL) + { + FreeX(s->ClientAuth->ClientX); + } + if (s->ClientAuth->ClientX != NULL) + { + FreeK(s->ClientAuth->ClientK); + } + Free(s->ClientAuth); + } + + FreeTraffic(s->Traffic); + Free(s->Name); + + if (s->Thread != NULL) + { + ReleaseThread(s->Thread); + } + + DeleteLock(s->lock); + + ReleaseEvent(s->HaltEvent); + + if (s->Cancel1) + { + ReleaseCancel(s->Cancel1); + } + + if (s->Cancel2) + { + ReleaseCancel(s->Cancel2); + } + + if (s->Policy) + { + Free(s->Policy); + } + + if (s->Connection) + { + ReleaseConnection(s->Connection); + } + + Free(s->Username); + + if (s->PacketAdapter) + { + FreePacketAdapter(s->PacketAdapter); + } + + if (s->OldTraffic != NULL) + { + FreeTraffic(s->OldTraffic); + } + + DeleteLock(s->TrafficLock); + + if (s->CancelList != NULL) + { + ReleaseCancelList(s->CancelList); + } + + if (s->Client_Message != NULL) + { + Free(s->Client_Message); + } + + DeleteCounter(s->LoggingRecordCount); + + ReleaseSharedBuffer(s->IpcSessionSharedBuffer); + + Free(s); +} + +// Release the session +void ReleaseSession(SESSION *s) +{ + // Validate arguments + if (s == NULL) + { + return; + } + + if (Release(s->ref) == 0) + { + CleanupSession(s); + } +} + +// Display the total data transfer size of the session +void PrintSessionTotalDataSize(SESSION *s) +{ + // Validate arguments + if (s == NULL) + { + return; + } + + Debug( + "-- SESSION TOTAL PKT INFORMATION --\n\n" + " TotalSendSize: %I64u\n" + " TotalSendSizeReal: %I64u\n" + " TotalRecvSize: %I64u\n" + " TotalRecvSizeReal: %I64u\n" + " Compression Rate: %.2f%% (Send)\n" + " %.2f%% (Recv)\n", + s->TotalSendSize, s->TotalSendSizeReal, + s->TotalRecvSize, s->TotalRecvSizeReal, + (float)((double)s->TotalSendSizeReal / (double)s->TotalSendSize * 100.0f), + (float)((double)s->TotalRecvSizeReal / (double)s->TotalRecvSize * 100.0f) + ); + +} + +// Client thread +void ClientThread(THREAD *t, void *param) +{ + SESSION *s; + bool use_password_dlg; + bool no_save_password = false; + bool is_vpngate_connection = false; + CEDAR *cedar; + bool num_active_sessions_incremented = false; + // Validate arguments + if (t == NULL || param == NULL) + { + return; + } + + Debug("ClientThread 0x%x Started.\n", t); + + s = (SESSION *)param; + AddRef(s->ref); + s->Thread = t; + AddRef(t->ref); + + if (s->LinkModeClient == false) + { + CiIncrementNumActiveSessions(); + num_active_sessions_incremented = true; + } + + NoticeThreadInit(t); + + cedar = s->Cedar; + + s->ClientStatus = CLIENT_STATUS_CONNECTING; + s->RetryFlag = true; + s->CurrentRetryCount = 0; + + Notify(s, CLIENT_NOTIFY_ACCOUNT_CHANGED); + + if (s->Cedar->Client != NULL) + { + no_save_password = s->Cedar->Client->DontSavePassword; + } + + s->Win32HideConnectWindow = s->ClientOption->HideStatusWindow; + s->Win32HideNicInfoWindow = s->ClientOption->HideNicInfoWindow; + + + while (true) + { + Zero(&s->ServerIP_CacheForNextConnect, sizeof(IP)); + + if (s->Link != NULL && ((*s->Link->StopAllLinkFlag) || s->Link->Halting)) + { + s->Err = ERR_USER_CANCEL; + break; + } + + CLog(s->Cedar->Client, "LC_CONNECT_1", s->ClientOption->AccountName, s->CurrentRetryCount + 1); + if (s->LinkModeClient && s->Link != NULL) + { + HLog(s->Link->Hub, "LH_CONNECT_1", s->ClientOption->AccountName, s->CurrentRetryCount + 1); + } + + Debug("Trying to Connect to Server... (%u / %u)\n", s->CurrentRetryCount + 0, + s->ClientOption->NumRetry); + + // Initialize +// s->TotalRecvSize = s->TotalRecvSizeReal = +// s->TotalSendSize = s->TotalSendSizeReal = 0; + s->NextConnectionTime = 0; + + // Connect + s->ClientStatus = CLIENT_STATUS_CONNECTING; + s->Halt = false; + SessionConnect(s); + if (s->UserCanceled) + { + s->Err = ERR_USER_CANCEL; + } + Debug("Disconnected. Err = %u : %S\n", s->Err, _E(s->Err)); + + PrintSessionTotalDataSize(s); + + CLog(s->Cedar->Client, "LC_CONNECT_ERROR", s->ClientOption->AccountName, + GetUniErrorStr(s->Err), s->Err); +#ifdef OS_UNIX + UnixVLanSetState(s->ClientOption->DeviceName, false); +#endif + if (s->LinkModeClient && s->Link != NULL) + { + HLog(s->Link->Hub, "LH_CONNECT_ERROR", s->ClientOption->AccountName, + GetUniErrorStr(s->Err), s->Err); + } + + s->ClientStatus = CLIENT_STATUS_RETRY; + + if (s->Link != NULL) + { + ((LINK *)s->Link)->LastError = s->Err; + } + + if (s->Halt && (s->RetryFlag == false) || s->ForceStopFlag) + { + // Must be aborted + if (s->Err == ERR_DEVICE_DRIVER_ERROR) + { +#ifdef OS_WIN32 + wchar_t tmp[MAX_SIZE]; + if (s->Account != NULL && s->Cedar->Client != NULL) + { + UniFormat(tmp, sizeof(tmp), _UU("ERRDLG_DEVICE_ERROR"), s->ClientOption->DeviceName, + s->Err, _E(s->Err)); + MsgBox(NULL, 0x10000 | 0x40000 | 0x200000 | 0x30, tmp); + } +#endif // OS_WIN32 + } + break; + } + // Determine whether to display the password re-entry dialog + use_password_dlg = false; + + if (s->Account != NULL && s->Cedar->Client != NULL) + { +#ifdef OS_WIN32 + if (s->ClientAuth->AuthType == CLIENT_AUTHTYPE_PASSWORD || s->ClientAuth->AuthType == CLIENT_AUTHTYPE_PLAIN_PASSWORD) + { + if (s->Err == ERR_AUTH_FAILED || s->Err == ERR_PROXY_AUTH_FAILED) + { + use_password_dlg = true; + } + } +#endif // OS_WIN32 + } + + // Failed to connect or the connection is disconnected + // Wait for retry interval + if (use_password_dlg == false) + { + UINT retry_interval = s->RetryInterval; + + if (s->LinkModeClient) + { + UINT current_num_links = Count(s->Cedar->CurrentActiveLinks); + UINT max_retry_interval = MAX(1000 * current_num_links, retry_interval); + + retry_interval += retry_interval * MIN(s->CurrentRetryCount, 1000); + retry_interval = MIN(retry_interval, max_retry_interval); + + // On the cascade client, adjust the retry_interval. (+/- 20%) + if (retry_interval >= 1000 && retry_interval <= (60 * 60 * 1000)) + { + retry_interval = (retry_interval * 8 / 10) + (Rand32() % (retry_interval * 4 / 10)); + } + } + + if (s->Err == ERR_HUB_IS_BUSY || s->Err == ERR_LICENSE_ERROR || + s->Err == ERR_HUB_STOPPING || s->Err == ERR_TOO_MANY_USER_SESSION) + { + retry_interval = RETRY_INTERVAL_SPECIAL; + } + + if (s->CurrentRetryCount >= s->ClientOption->NumRetry) + { + // Retry count excess + +#ifndef OS_WIN32 + + break; + +#else // OS_WIN32 + + if (s->Win32HideConnectWindow == false && + s->Cedar->Client != NULL && s->Account != NULL) + { + // Show a reconnection dialog + UI_CONNECTERROR_DLG p; + Zero(&p, sizeof(p)); + UniStrCpy(p.AccountName, sizeof(p.AccountName), s->ClientOption->AccountName); + StrCpy(p.ServerName, sizeof(p.ServerName), s->ClientOption->Hostname); + p.Err = s->Err; + p.CurrentRetryCount = s->CurrentRetryCount + 1; + s->Halt = false; + p.RetryLimit = 0; + p.RetryIntervalSec = 0; + p.CancelEvent = s->HaltEvent; + p.HideWindow = s->Win32HideConnectWindow; + if (CncConnectErrorDlg(s, &p) == false) + { + // Abort + break; + } + else + { + s->Win32HideConnectWindow = p.HideWindow; + goto SKIP; + } + } + else + { + break; + } + +#endif + } + +#ifndef OS_WIN32 + + // Simple wait + Wait(s->HaltEvent, retry_interval); + +#else // OS_WIN32 + + if (s->Win32HideConnectWindow == false && + s->Cedar->Client != NULL && s->Account != NULL) + { + // Show a reconnection dialog + UI_CONNECTERROR_DLG p; + Zero(&p, sizeof(p)); + UniStrCpy(p.AccountName, sizeof(p.AccountName), s->ClientOption->AccountName); + StrCpy(p.ServerName, sizeof(p.ServerName), s->ClientOption->Hostname); + p.Err = s->Err; + p.CurrentRetryCount = s->CurrentRetryCount + 1; + p.RetryLimit = s->ClientOption->NumRetry; + p.RetryIntervalSec = retry_interval; + p.CancelEvent = s->HaltEvent; + s->Halt = false; + p.HideWindow = s->Win32HideConnectWindow; + if (CncConnectErrorDlg(s, &p) == false) + { + // Abort + break; + } + s->Win32HideConnectWindow = p.HideWindow; + } + else + { + // Simple wait + Wait(s->HaltEvent, s->RetryInterval); + } + +#endif // OS_WIN32 + } + else + { +#ifdef OS_WIN32 + // Wait for re-entry the password + UI_PASSWORD_DLG p; + Zero(&p, sizeof(p)); + if (s->Client_NoSavePassword == false) + { + p.ShowNoSavePassword = true; + } + p.NoSavePassword = no_save_password; + p.CancelEvent = s->HaltEvent; + if (s->Err == ERR_PROXY_AUTH_FAILED) + { + p.ProxyServer = true; + } + + if (p.ProxyServer) + { + StrCpy(p.Username, sizeof(p.Username), s->ClientOption->ProxyUsername); + StrCpy(p.Password, sizeof(p.Password), s->ClientOption->ProxyPassword); + StrCpy(p.ServerName, sizeof(p.ServerName), s->ClientOption->ProxyName); + } + else + { + bool empty = false; + + StrCpy(p.Username, sizeof(p.Username), s->ClientAuth->Username); + if (s->ClientAuth->AuthType == AUTHTYPE_RADIUS) + { + if (StrLen(s->ClientAuth->PlainPassword) == 0) + { + empty = true; + } + } + else if (s->ClientAuth->AuthType == AUTHTYPE_PASSWORD) + { + if (IsZero(s->ClientAuth->HashedPassword, sizeof(s->ClientAuth->HashedPassword))) + { + empty = true; + } + } + + StrCpy(p.Password, sizeof(p.Password), empty ? "" : HIDDEN_PASSWORD); + StrCpy(p.ServerName, sizeof(p.ServerName), s->ClientOption->Hostname); + } + + p.RetryIntervalSec = s->RetryInterval / 1000; + p.Type = s->ClientAuth->AuthType; + + // Display the password re-entry dialog + if (CncPasswordDlg(s, &p) == false) + { + // Abort the connection + break; + } + else + { + // Overwrite the user name + if (p.ProxyServer) + { + // User name of the proxy + StrCpy(s->ClientOption->ProxyUsername, sizeof(s->ClientOption->ProxyUsername), p.Username); + } + else + { + // The user name for connecting to the server + StrCpy(s->ClientAuth->Username, sizeof(s->ClientAuth->Username), p.Username); + s->ClientAuth->AuthType = p.Type; + } + + if (StrCmp(p.Password, HIDDEN_PASSWORD) != 0) + { + // Password is re-entered + if (p.ProxyServer) + { + // Password for the proxy server + StrCpy(s->ClientOption->ProxyPassword, sizeof(s->ClientOption->ProxyPassword), p.Password); + } + else + { + if (s->ClientAuth->AuthType == CLIENT_AUTHTYPE_PLAIN_PASSWORD) + { + // Plaintext password authentication + StrCpy(s->ClientAuth->PlainPassword, sizeof(s->ClientAuth->PlainPassword), p.Password); + } + else + { + // Encrypted password authentication + HashPassword(s->ClientAuth->HashedPassword, s->ClientAuth->Username, p.Password); + } + } + } + + no_save_password = p.NoSavePassword; + + if (s->Account != NULL && s->Cedar->Client != NULL) + { + s->Cedar->Client->DontSavePassword = no_save_password; + if (p.NoSavePassword == false) + { + // Update the account database of the client + if (p.ProxyServer == false) + { + // Update the Server connection information + ACCOUNT *a = s->Account; + Lock(a->lock); + { + CiFreeClientAuth(a->ClientAuth); + a->ClientAuth = CopyClientAuth(s->ClientAuth); + } + Unlock(a->lock); + CiSaveConfigurationFile(s->Cedar->Client); + } + else + { + // Update the proxy connection information + ACCOUNT *a = s->Account; + Lock(a->lock); + { + Copy(a->ClientOption, s->ClientOption, sizeof(CLIENT_OPTION)); + } + Unlock(a->lock); + CiSaveConfigurationFile(s->Cedar->Client); + } + } + } + } +#endif // OS_WIN32 + } + +SKIP: + // Increase the number of retries + if (s->ConnectSucceed == false) + { + s->CurrentRetryCount++; + } + + if (s->ForceStopFlag) + { + break; + } + } + + Debug("Session Halt.\n"); + + s->ClientStatus = CLIENT_STATUS_IDLE; + + // Regard as that the session is ended here + if (s->Account != NULL) + { + s->Account->ClientSession = NULL; + ReleaseSession(s); + } + + Notify(s, CLIENT_NOTIFY_ACCOUNT_CHANGED); + + + ReleaseSession(s); + + if (num_active_sessions_incremented) + { + CiDecrementNumActiveSessions(); + } +} + +// Create an RPC session +SESSION *NewRpcSession(CEDAR *cedar, CLIENT_OPTION *option) +{ + return NewRpcSessionEx(cedar, option, NULL, NULL); +} +SESSION *NewRpcSessionEx(CEDAR *cedar, CLIENT_OPTION *option, UINT *err, char *client_str) +{ + return NewRpcSessionEx2(cedar, option, err, client_str, NULL); +} +SESSION *NewRpcSessionEx2(CEDAR *cedar, CLIENT_OPTION *option, UINT *err, char *client_str, void *hWnd) +{ + SESSION *s; + CONNECTION *c; + SOCK *sock; + // Validate arguments + if (cedar == NULL || option == NULL) + { + return NULL; + } + + s = ZeroMalloc(sizeof(SESSION)); + + s->LoggingRecordCount = NewCounter(); + s->lock = NewLock(); + s->ref = NewRef(); + s->Cedar = cedar; + s->ServerMode = false; + s->Name = CopyStr("CLIENT_RPC_SESSION"); + s->CreatedTime = s->LastCommTime = Tick64(); + s->Traffic = NewTraffic(); + s->HaltEvent = NewEvent(); + s->TrafficLock = NewLock(); + s->Cancel1 = NewCancel(); + + // Copy the client connection options + s->ClientOption = Malloc(sizeof(CLIENT_OPTION)); + Copy(s->ClientOption, option, sizeof(CLIENT_OPTION)); + + s->MaxConnection = option->MaxConnection; + s->UseEncrypt = option->UseEncrypt; + s->UseCompress = option->UseCompress; + + // Create a connection + c = s->Connection = NewClientConnectionEx(s, client_str, cedar->Version, cedar->Build); + c->hWndForUI = hWnd; + + // Connect to the server + sock = ClientConnectToServer(c); + if (sock == NULL) + { + // Connection failure + if (err != NULL) + { + *err = c->Err; + } + ReleaseSession(s); + return NULL; + } + + // Send a signature + if (ClientUploadSignature(sock) == false) + { + // Failure + if (err != NULL) + { + *err = c->Err; + } + ReleaseSession(s); + return NULL; + } + + // Receive a Hello packet + if (ClientDownloadHello(c, sock) == false) + { + // Failure + if (err != NULL) + { + *err = c->Err; + } + ReleaseSession(s); + return NULL; + } + + return s; +} + +// Create a client session +SESSION *NewClientSessionEx(CEDAR *cedar, CLIENT_OPTION *option, CLIENT_AUTH *auth, PACKET_ADAPTER *pa, ACCOUNT *account) +{ + SESSION *s; + THREAD *t; + // Validate arguments + if (cedar == NULL || option == NULL || auth == NULL || pa == NULL || + (auth->AuthType == CLIENT_AUTHTYPE_SECURE && auth->SecureSignProc == NULL)) + { + return NULL; + } + + // Initialize the SESSION object + s = ZeroMalloc(sizeof(SESSION)); + + s->LoggingRecordCount = NewCounter(); + + s->lock = NewLock(); + s->ref = NewRef(); + s->Cedar = cedar; + s->ServerMode = false; + s->Name = CopyStr("CLIENT_SESSION"); + s->CreatedTime = s->LastCommTime = Tick64(); + s->Traffic = NewTraffic(); + s->HaltEvent = NewEvent(); + s->PacketAdapter = pa; + s->TrafficLock = NewLock(); + s->OldTraffic = NewTraffic(); + s->Cancel1 = NewCancel(); + s->CancelList = NewCancelList(); + + // Copy the client connection options + s->ClientOption = Malloc(sizeof(CLIENT_OPTION)); + Copy(s->ClientOption, option, sizeof(CLIENT_OPTION)); + + if (GetGlobalServerFlag(GSF_DISABLE_SESSION_RECONNECT)) + { + s->ClientOption->DisableQoS = true; + s->ClientOption->MaxConnection = 1; + s->ClientOption->HalfConnection = false; + } + + s->MaxConnection = option->MaxConnection; + s->UseEncrypt = option->UseEncrypt; + s->UseCompress = option->UseCompress; + + // Set the retry interval + s->RetryInterval = MAKESURE(option->RetryInterval, 0, 4000000) * 1000; + s->RetryInterval = MAKESURE(s->RetryInterval, MIN_RETRY_INTERVAL, MAX_RETRY_INTERVAL); + + // Interval for additional connection creation is at least 1 second + s->ClientOption->AdditionalConnectionInterval = MAX(s->ClientOption->AdditionalConnectionInterval, 1); + + // Hold whether the virtual LAN card is used in client mode + s->ClientModeAndUseVLan = (StrLen(s->ClientOption->DeviceName) == 0) ? false : true; + + if (s->ClientOption->NoRoutingTracking) + { + s->ClientModeAndUseVLan = false; + } + + if (pa->Id == PACKET_ADAPTER_ID_VLAN_WIN32) + { + s->IsVPNClientAndVLAN_Win32 = true; + } + + if (StrLen(option->DeviceName) == 0) + { + // NAT mode + s->ClientModeAndUseVLan = false; + s->VirtualHost = true; + } + + if (OS_IS_WINDOWS_9X(GetOsInfo()->OsType)) + { + // Prohibit the half-duplex mode in the case of Win9x + s->ClientOption->HalfConnection = false; + } + + // Copy the client authentication data + s->ClientAuth = Malloc(sizeof(CLIENT_AUTH)); + Copy(s->ClientAuth, auth, sizeof(CLIENT_AUTH)); + + // Clone the certificate and the private key + if (s->ClientAuth->ClientX != NULL) + { + s->ClientAuth->ClientX = CloneX(s->ClientAuth->ClientX); + } + if (s->ClientAuth->ClientK != NULL) + { + if (s->ClientAuth->AuthType != CLIENT_AUTHTYPE_OPENSSLENGINE) + { + s->ClientAuth->ClientK = CloneK(s->ClientAuth->ClientK); + } + else + { + s->ClientAuth->ClientK = OpensslEngineToK(s->ClientAuth->OpensslEnginePrivateKeyName, s->ClientAuth->OpensslEngineName); + } + } + + if (StrCmpi(s->ClientOption->DeviceName, LINK_DEVICE_NAME) == 0) + { + // Link client mode + s->LinkModeClient = true; + s->Link = (LINK *)s->PacketAdapter->Param; + } + + if (StrCmpi(s->ClientOption->DeviceName, SNAT_DEVICE_NAME) == 0) + { + // SecureNAT mode + s->SecureNATMode = true; + } + + if (StrCmpi(s->ClientOption->DeviceName, BRIDGE_DEVICE_NAME) == 0) + { + // Bridge mode + s->BridgeMode = true; + } + + if (s->VirtualHost) + { + VH *v = (VH *)s->PacketAdapter->Param; + + // Add the session object to VH + v->Session = s; + AddRef(s->ref); + } + + s->Account = account; + + if (s->ClientAuth->AuthType == CLIENT_AUTHTYPE_SECURE) + { + // Do not retry in the case of a smart card authentication + s->ClientOption->NumRetry = 0; + } + + // Create a client thread + t = NewThread(ClientThread, (void *)s); + WaitThreadInit(t); + ReleaseThread(t); + + return s; +} +SESSION *NewClientSession(CEDAR *cedar, CLIENT_OPTION *option, CLIENT_AUTH *auth, PACKET_ADAPTER *pa) +{ + return NewClientSessionEx(cedar, option, auth, pa, NULL); +} + +// Get the session from the session key +SESSION *GetSessionFromKey(CEDAR *cedar, UCHAR *session_key) +{ + HUB *h; + UINT i, j; + // Validate arguments + if (cedar == NULL || session_key == NULL) + { + return NULL; + } + + LockList(cedar->HubList); + { + for (i = 0;i < LIST_NUM(cedar->HubList);i++) + { + h = LIST_DATA(cedar->HubList, i); + LockList(h->SessionList); + { + for (j = 0;j < LIST_NUM(h->SessionList);j++) + { + SESSION *s = LIST_DATA(h->SessionList, j); + Lock(s->lock); + { + if (Cmp(s->SessionKey, session_key, SHA1_SIZE) == 0) + { + // Session found + AddRef(s->ref); + + // Unlock + Unlock(s->lock); + UnlockList(h->SessionList); + UnlockList(cedar->HubList); + return s; + } + } + Unlock(s->lock); + } + } + UnlockList(h->SessionList); + } + } + UnlockList(cedar->HubList); + + return NULL; +} + +// Create a new session key +void NewSessionKey(CEDAR *cedar, UCHAR *session_key, UINT *session_key_32) +{ + // Validate arguments + if (cedar == NULL || session_key == NULL || session_key_32 == NULL) + { + return; + } + + Rand(session_key, SHA1_SIZE); + *session_key_32 = Rand32(); +} + +bool if_init(SESSION *s); +CANCEL *if_getcancel(SESSION *s); +UINT if_getnext(SESSION *s, void **data); +bool if_putpacket(SESSION *s, void *data, UINT size); +void if_free(SESSION *s); + + +// Create a server session +SESSION *NewServerSession(CEDAR *cedar, CONNECTION *c, HUB *h, char *username, POLICY *policy) +{ + return NewServerSessionEx(cedar, c, h, username, policy, false, NULL); +} +SESSION *NewServerSessionEx(CEDAR *cedar, CONNECTION *c, HUB *h, char *username, POLICY *policy, bool inproc_mode, UCHAR *ipc_mac_address) +{ + SESSION *s; + char name[MAX_SIZE]; + char hub_name_upper[MAX_SIZE]; + char user_name_upper[MAX_USERNAME_LEN + 1]; + // Validate arguments + if (cedar == NULL || c == NULL || h == NULL || username == NULL || policy == NULL) + { + return NULL; + } + + // Initialize the SESSION object + s = ZeroMalloc(sizeof(SESSION)); + + s->LoggingRecordCount = NewCounter(); + s->lock = NewLock(); + s->ref = NewRef(); + s->Cedar = cedar; + s->ServerMode = true; + s->CreatedTime = s->LastCommTime = Tick64(); + s->Traffic = NewTraffic(); + s->HaltEvent = NewEvent(); + s->Cancel1 = NewCancel(); + s->CancelList = NewCancelList(); + s->Thread = c->Thread; + s->TrafficLock = NewLock(); + s->OldTraffic = NewTraffic(); + s->QoS = GetServerCapsBool(cedar->Server, "b_support_qos"); + AddRef(s->Thread->ref); + s->Hub = h; + s->ClientStatus = CLIENT_STATUS_ESTABLISHED; + + // Delayed packet list + s->DelayedPacketList = NewList(NULL); + + // Packet adapter for the HUB + s->PacketAdapter = GetHubPacketAdapter(); + + s->Connection = c; + AddRef(c->ref); + + // Determine the new session name + StrCpy(hub_name_upper, sizeof(hub_name_upper), h->Name); + StrUpper(hub_name_upper); + StrCpy(user_name_upper, sizeof(user_name_upper), username); + StrUpper(user_name_upper); + + if ((StrCmpi(username, ADMINISTRATOR_USERNAME) != 0) && (StrCmpi(username, BRIDGE_USER_NAME) != 0) || (cedar->Server == NULL || cedar->Server->ServerType == SERVER_TYPE_STANDALONE)) + { + if (IsEmptyStr(c->InProcPrefix)) + { + Format(name, sizeof(name), "SID-%s-%u", user_name_upper, Inc(h->SessionCounter)); + } + else + { + Format(name, sizeof(name), "SID-%s-[%s]-%u", user_name_upper, c->InProcPrefix, Inc(h->SessionCounter)); + } + + if (h->IsVgsHub || h->IsVgsSuperRelayHub) + { + UCHAR rand[5]; + char tmp[32]; + + Rand(rand, sizeof(rand)); + + BinToStr(tmp, sizeof(tmp), rand, sizeof(rand)); + + StrCat(name, sizeof(name), "-"); + StrCat(name, sizeof(name), tmp); + } + } + else + { + UCHAR rand[SHA1_SIZE]; + char tmp[MAX_SIZE]; + Rand(rand, sizeof(rand)); + BinToStr(tmp, sizeof(tmp), rand, 3); + + if (StrCmpi(username, BRIDGE_USER_NAME) != 0) + { + Format(name, sizeof(name), "SID-%s-%s", user_name_upper, + tmp); + } + else + { + char pc_name[MAX_SIZE]; + TOKEN_LIST *t; + + GetMachineName(tmp, sizeof(tmp)); + t = ParseToken(tmp, "."); + if (t->NumTokens >= 1) + { + StrCpy(pc_name, sizeof(pc_name), t->Token[0]); + } + else + { + StrCpy(pc_name, sizeof(pc_name), "pc"); + } + FreeToken(t); + + StrUpper(pc_name); + + Format(name, sizeof(name), "SID-%s-%s-%u", user_name_upper, pc_name, + Inc(h->SessionCounter)); + } + } + + s->Name = CopyStr(name); + s->Policy = policy; + s->InProcMode = inproc_mode; + + // Add a SESSION to the HUB + AddSession(h, s); + + // Create a key + NewSessionKey(cedar, s->SessionKey, &s->SessionKey32); + + // Generate a MAC address for IPC + if (s->InProcMode) + { + if (ipc_mac_address != NULL) + { + Copy(s->IpcMacAddress, ipc_mac_address, 6); + } + else + { + char tmp[MAX_SIZE]; + char machine[MAX_SIZE]; + UCHAR hash[SHA1_SIZE]; + + GetMachineName(machine, sizeof(machine)); + + Format(tmp, sizeof(tmp), "%s@%s@%u", machine, h->Name, s->UniqueId); + + StrUpper(tmp); + Trim(tmp); + + Sha0(hash, tmp, StrLen(tmp)); + + s->IpcMacAddress[0] = 0xCA; + s->IpcMacAddress[1] = hash[1]; + s->IpcMacAddress[2] = hash[2]; + s->IpcMacAddress[3] = hash[3]; + s->IpcMacAddress[4] = hash[4]; + s->IpcMacAddress[5] = hash[5]; + + MacToStr(tmp, sizeof(tmp), s->IpcMacAddress); + Debug("MAC Address for IPC: %s\n", tmp); + } + } + + return s; +} + +// Check whether the specified MAC address is IPC address +bool IsIpcMacAddress(UCHAR *mac) +{ + // Validate arguments + if (mac == NULL) + { + return false; + } + + if (mac[0] == 0xCA) + { + return true; + } + + return false; +} + +// Display the status on the client +void PrintStatus(SESSION *s, wchar_t *str) +{ + // Validate arguments + if (s == NULL || str == NULL || s->Account == NULL || s->Cedar->Client == NULL + || s->Account->StatusPrinter == NULL) + { + return; + } + + // Inform the status to the callback function + s->Account->StatusPrinter(s, str); +} + +// Create a cancellation list +LIST *NewCancelList() +{ + return NewList(NULL); +} + +// Add a Cancel to the cancellation list +void AddCancelList(LIST *o, CANCEL *c) +{ + UINT i; + // Validate arguments + if (o == NULL || c == NULL) + { + return; + } + + for (i = 0;i < LIST_NUM(o);i++) + { + CANCEL *t = LIST_DATA(o, i); + if (t == c) + { + return; + } + } + + AddRef(c->ref); + Add(o, c); +} + +// Issue all cancellations in the cancellation list +void CancelList(LIST *o) +{ + UINT i; + // Validate arguments + if (o == NULL) + { + return; + } + + for (i = 0;i < LIST_NUM(o);i++) + { + CANCEL *c = LIST_DATA(o, i); + Cancel(c); + ReleaseCancel(c); + } + + DeleteAll(o); +} + +// Release the cancellation list +void ReleaseCancelList(LIST *o) +{ + UINT i; + // Validate arguments + if (o == NULL) + { + return; + } + + for (i = 0;i < LIST_NUM(o);i++) + { + CANCEL *c = LIST_DATA(o, i); + ReleaseCancel(c); + } + + ReleaseList(o); +} + +// Notify to the client +void Notify(SESSION *s, UINT code) +{ + // Validate arguments + if (s == NULL || s->Account == NULL || s->Cedar->Client == NULL) + { + return; + } + + CiNotify(s->Cedar->Client); +} + + +UINT PrepareDHCPRequestForStaticIPv4(SESSION *s, BLOCK *b) +{ + PKT *pkt = NULL; + DHCPV4_HEADER *dhcp = NULL; + UCHAR *data = NULL; + UINT size = 0; + UINT dhcp_header_size = 0; + UINT dhcp_data_offset = 0; + UINT magic_cookie = Endian32(DHCP_MAGIC_COOKIE); + DHCP_OPTION_LIST *opt = NULL; + USER *user = NULL; + UINT ret_ip = 0; + + if ((s->Username == NULL) || (StrLen(s->Username) == 0) || (StrCmpi(s->Username, SNAT_USER_NAME_PRINT) == 0) || + (StrCmpi( s->Username, BRIDGE_USER_NAME_PRINT) == 0) || (StrCmpi(s->Username, LINK_USER_NAME_PRINT) == 0)) + { + return ret_ip; + } + + pkt = ParsePacket(b->Buf, b->Size); + if (pkt == NULL) + { + return ret_ip; + } + + if (pkt->TypeL3 == L3_IPV4 && pkt->TypeL4 == L4_UDP && pkt->TypeL7 == L7_DHCPV4) + { + if (pkt->L7.DHCPv4Header->OpCode != 1) + { + goto CLEANUP_TP; + } + + dhcp = pkt->L7.DHCPv4Header; + dhcp_header_size = sizeof(DHCPV4_HEADER); + dhcp_data_offset = (UINT)(((UCHAR *)pkt->L7.DHCPv4Header) - ((UCHAR *)pkt->MacHeader) + dhcp_header_size); + data = ((UCHAR *)dhcp) + dhcp_header_size; + size = pkt->PacketSize - dhcp_data_offset; + + if (dhcp_header_size < 5) + { + goto CLEANUP_TP; + } + + // Search for Magic Cookie + while (size >= 5) + { + if (Cmp(data, &magic_cookie, sizeof(magic_cookie)) == 0) + { + // Found + data += 4; + size -= 4; + opt = ParseDhcpOptionList(data, size); + break; + } + + ++data; + --size; + } + + if (opt == NULL) + { + goto CLEANUP_TP; + } + + if (opt->Opcode == DHCP_DISCOVER || opt->Opcode == DHCP_REQUEST) + { + if (s->Hub != NULL) + { + user = AcGetUser( s->Hub, s->Username ); + if (user != NULL) + { + dhcp->ServerIP = GetUserIPv4AddressFromUserNote32(user->Note); + ReleaseUser(user); + if (s->Hub->SecureNAT != NULL && s->Hub->SecureNAT->Nat != NULL) + { + VH *v = s->Hub->SecureNAT->Nat->Virtual; + if (v != NULL && v->UseDhcp == true && v->DhcpLeaseList != NULL) + { + DHCP_LEASE *d = SearchDhcpLeaseByIp(v, dhcp->ServerIP); + + // The given static IP address is not used - it's OK + if (d == NULL) + { + ret_ip = dhcp->ServerIP; + } + } + } + } + } + } + } + +CLEANUP_TP: + if (opt != NULL) + { + Free(opt); + } + + if (pkt != NULL) + { + FreePacket(pkt); + } + + return ret_ip; +} + +void ClearDHCPLeaseRecordForIPv4(SESSION *s, UINT static_ip) +{ + if (s == NULL || static_ip == 0) + { + return; + } + + if (s->Hub == NULL || s->Hub->SecureNAT == NULL || s->Hub->SecureNAT->Nat == NULL) + { + return; + } + + VH *v = s->Hub->SecureNAT->Nat->Virtual; + if (v == NULL || v->DhcpLeaseList == NULL) + { + return; + } + + DHCP_LEASE *d = SearchDhcpLeaseByIp(v, static_ip); + if (d == NULL) + { + return; + } + + LockList(v->DhcpLeaseList); + { + FreeDhcpLease(d); + Delete(v->DhcpLeaseList, d); + } + UnlockList( v->DhcpLeaseList); +} diff --git a/src/Cedar/Session.h b/src/Cedar/Session.h index 15dc2322..30788201 100644 --- a/src/Cedar/Session.h +++ b/src/Cedar/Session.h @@ -1,348 +1,348 @@ -// SoftEther VPN Source Code - Developer Edition Master Branch -// Cedar Communication Module - - -// Session.h -// Header of Session.c - -#ifndef SESSION_H -#define SESSION_H - - -// Interval to increment the number of logins after the connection -#define NUM_LOGIN_INCREMENT_INTERVAL (30 * 1000) - -// Packet adapter function -typedef bool (PA_INIT)(SESSION *s); -typedef CANCEL *(PA_GETCANCEL)(SESSION *s); -typedef UINT (PA_GETNEXTPACKET)(SESSION *s, void **data); -typedef bool (PA_PUTPACKET)(SESSION *s, void *data, UINT size); -typedef void (PA_FREE)(SESSION *s); - -// Client related function -typedef void (CLIENT_STATUS_PRINTER)(SESSION *s, wchar_t *status); - -// Node information -struct NODE_INFO -{ - char ClientProductName[64]; // Client product name - UINT ClientProductVer; // Client version - UINT ClientProductBuild; // Client build number - char ServerProductName[64]; // Server product name - UINT ServerProductVer; // Server version - UINT ServerProductBuild; // Server build number - char ClientOsName[64]; // Client OS name - char ClientOsVer[128]; // Client OS version - char ClientOsProductId[64]; // Client OS Product ID - char ClientHostname[64]; // Client host name - UINT ClientIpAddress; // Client IP address - UINT ClientPort; // Client port number - char ServerHostname[64]; // Server host name - UINT ServerIpAddress; // Server IP address - UINT ServerPort; // Server port number - char ProxyHostname[64]; // Proxy host name - UINT ProxyIpAddress; // Proxy Server IP Address - UINT ProxyPort; // Proxy port number - char HubName[64]; // HUB name - UCHAR UniqueId[16]; // Unique ID - // The following is for IPv6 support - UCHAR ClientIpAddress6[16]; // Client IPv6 address - UCHAR ServerIpAddress6[16]; // Server IP address - UCHAR ProxyIpAddress6[16]; // Proxy Server IP Address - char Padding[304 - (16 * 3)]; // Padding -}; - -// Packet adapter -struct PACKET_ADAPTER -{ - PA_INIT *Init; - PA_GETCANCEL *GetCancel; - PA_GETNEXTPACKET *GetNextPacket; - PA_PUTPACKET *PutPacket; - PA_FREE *Free; - void *Param; - UINT Id; -}; - -// Packet Adapter IDs -#define PACKET_ADAPTER_ID_VLAN_WIN32 1 - - -// Session structure -struct SESSION -{ - LOCK *lock; // Lock - REF *ref; // Reference counter - CEDAR *Cedar; // Cedar - bool LocalHostSession; // Local host session - bool ServerMode; // Server mode session - bool NormalClient; // Connecting session from a regular client (not such as localbridge) - bool LinkModeClient; // Link mode client - bool LinkModeServer; // Link mode server - bool SecureNATMode; // SecureNAT session - bool BridgeMode; // Bridge session - bool BridgeIsEthLoopbackBlock; // Loopback is disabled on the Ethernet level - bool VirtualHost; // Virtual host mode - bool L3SwitchMode; // Layer-3 switch mode - bool InProcMode; // In-process mode - THREAD *Thread; // Management thread - CONNECTION *Connection; // Connection - char ClientIP[64]; // Client IP - CLIENT_OPTION *ClientOption; // Client connection options - CLIENT_AUTH *ClientAuth; // Client authentication data - volatile bool Halt; // Halting flag - volatile bool CancelConnect; // Cancel the connection - EVENT *HaltEvent; // Halting event - UINT Err; // Error value - HUB *Hub; // HUB - CANCEL *Cancel1; // Cancel object 1 - CANCEL *Cancel2; // Cancel object 2 - PACKET_ADAPTER *PacketAdapter; // Packet adapter - UCHAR UdpSendKey[16]; // UDP encryption key for transmission - UCHAR UdpRecvKey[16]; // UDP encryption key for reception - UINT ClientStatus; // Client Status - bool RetryFlag; // Retry flag (client) - bool ForceStopFlag; // Forced stop flag (client) - UINT CurrentRetryCount; // Current retry counter (client) - UINT RetryInterval; // Retry interval (client) - bool ConnectSucceed; // Connection success flag (client) - bool SessionTimeOuted; // Session times out - UINT Timeout; // Time-out period - UINT64 NextConnectionTime; // Time to put next additional connection - IP ServerIP; // IP address of the server - bool ClientModeAndUseVLan; // Use a virtual LAN card in client mode - LOCK *TrafficLock; // Traffic data lock - LINK *Link; // A reference to the link object - SNAT *SecureNAT; // A reference to the SecureNAT object - BRIDGE *Bridge; // A reference to the Bridge object - NODE_INFO NodeInfo; // Node information - UINT64 LastIncrementTraffic; // Last time that updated the traffic data of the user - bool AdministratorMode; // Administrator mode - LIST *CancelList; // Cancellation list - L3IF *L3If; // Layer-3 interface - IP DefaultDns; // IP address of the default DNS server - bool IPv6Session; // IPv6 session (Physical communication is IPv6) - UINT VLanId; // VLAN ID - UINT UniqueId; // Unique ID - UCHAR IpcMacAddress[6]; // MAC address for IPC - UCHAR Padding[2]; - - IP ServerIP_CacheForNextConnect; // Server IP, cached for next connect - - UINT64 CreatedTime; // Creation date and time - UINT64 LastCommTime; // Last communication date and time - UINT64 LastCommTimeForDormant; // Last communication date and time (for dormant) - TRAFFIC *Traffic; // Traffic data - TRAFFIC *OldTraffic; // Old traffic data - UINT64 TotalSendSize; // Total transmitted data size - UINT64 TotalRecvSize; // Total received data size - UINT64 TotalSendSizeReal; // Total transmitted data size (no compression) - UINT64 TotalRecvSizeReal; // Total received data size (no compression) - char *Name; // Session name - char *Username; // User name - char UserNameReal[MAX_USERNAME_LEN + 1]; // User name (real) - char GroupName[MAX_USERNAME_LEN + 1]; // Group name - POLICY *Policy; // Policy - UCHAR SessionKey[SHA1_SIZE]; // Session key - UINT SessionKey32; // 32bit session key - char SessionKeyStr[64]; // Session key string - UINT MaxConnection; // Maximum number of concurrent TCP connections - bool UseEncrypt; // Use encrypted communication - bool UseCompress; // Use data compression - bool HalfConnection; // Half connection mode - bool QoS; // VoIP / QoS - bool NoSendSignature; // Do not send a signature - bool IsOpenVPNL3Session; // Whether OpenVPN L3 session - bool IsOpenVPNL2Session; // Whether OpenVPN L2 session - UINT NumDisconnected; // Number of socket disconnection - bool NoReconnectToSession; // Disable to reconnect to the session - char UnderlayProtocol[64]; // Physical communication protocol - char ProtocolDetails[256]; // Protocol details - /* !!! Do not correct the spelling to keep the backward protocol compatibility !!! */ - UINT64 FirstConnectionEstablisiedTime; // Connection completion time of the first connection - UINT64 CurrentConnectionEstablishTime; // Completion time of this connection - UINT NumConnectionsEstablished; // Number of connections established so far - UINT AdjustMss; // MSS adjustment value - bool IsVPNClientAndVLAN_Win32; // Is the VPN Client session with a VLAN card (Win32) - - bool IsRUDPSession; // Whether R-UDP session - UINT RUdpMss; // The value of the MSS should be applied while the R-UDP is used - bool EnableBulkOnRUDP; // Allow the bulk transfer in the R-UDP session - UINT BulkOnRUDPVersion; // RUDP Bulk version - bool EnableHMacOnBulkOfRUDP; // Use the HMAC to sign the bulk transfer of R-UDP session - bool EnableUdpRecovery; // Enable the R-UDP recovery - - bool UseUdpAcceleration; // Use of UDP acceleration mode - UINT UdpAccelerationVersion; // UDP acceleration version - bool UseHMacOnUdpAcceleration; // Use the HMAC in the UDP acceleration mode - UDP_ACCEL *UdpAccel; // UDP acceleration - bool IsUsingUdpAcceleration; // Flag of whether the UDP acceleration is used - UINT UdpAccelMss; // MSS value to be applied while the UDP acceleration is used - bool UdpAccelFastDisconnectDetect; // Fast disconnection detection is enabled - - bool IsAzureSession; // Whether the session via VPN Azure - IP AzureRealServerGlobalIp; // Real global IP of the server-side in the case of session via VPN Azure - - ACCOUNT *Account; // Client account - UINT VLanDeviceErrorCount; // Number of times that the error occurred in the virtual LAN card - bool Win32HideConnectWindow; // Hide the status window - bool Win32HideNicInfoWindow; // Hide the NIC information window - bool UserCanceled; // Canceled by the user - UINT64 LastTryAddConnectTime; // Last time that attempted to add a connection - - bool IsMonitorMode; // Whether the monitor mode - bool IsBridgeMode; // Whether the bridge mode - bool UseClientLicense; // Number of assigned client licenses - bool UseBridgeLicense; // Number of assigned bridge licenses - - COUNTER *LoggingRecordCount; // Counter for the number of logging records - - bool FreeInfoShowed; // Whether a warning about Free Edition has already displayed - - bool Client_NoSavePassword; // Prohibit the password saving - wchar_t *Client_Message; // Message that has been sent from the server - - LIST *DelayedPacketList; // Delayed packet list - UINT Flag1; - - USER *NumLoginIncrementUserObject; // User objects to increment the number of logins - HUB *NumLoginIncrementHubObject; // Virtual HUB object to increment the number of logins - UINT64 NumLoginIncrementTick; // Time to perform increment a number of log - - bool FirstTimeHttpRedirect; // Redirect HTTP only for the first time - char FirstTimeHttpRedirectUrl[128]; // URL for redirection only the first time - UINT FirstTimeHttpAccessCheckIp; // IP address for access checking - - UCHAR BulkSendKey[RUDP_BULK_KEY_SIZE_MAX]; // RUDP Bulk Send Key - UINT BulkSendKeySize; // RUDP Bulk Send Key size - UCHAR BulkRecvKey[RUDP_BULK_KEY_SIZE_MAX]; // RUDP Bulk Recv Key - UINT BulkRecvKeySize; // RUDP Bulk Recv Key size - - // To examine the maximum number of allowed logging target packets per minute - UINT64 MaxLoggedPacketsPerMinuteStartTick; // Inspection start time - UINT CurrentNumPackets; // Current number of packets - - // Measures for D-Link bug - UINT64 LastDLinkSTPPacketSendTick; // Last D-Link STP packet transmission time - UCHAR LastDLinkSTPPacketDataHash[MD5_SIZE]; // Last D-Link STP packet hash - - SHARED_BUFFER *IpcSessionSharedBuffer; // A shared buffer between IPC and Session - IPC_SESSION_SHARED_BUFFER_DATA *IpcSessionShared; // Shared data between IPC and Session -}; - -// Password dialog -struct UI_PASSWORD_DLG -{ - UINT Type; // Type of password - char Username[MAX_USERNAME_LEN + 1]; // User name - char Password[MAX_PASSWORD_LEN + 1]; // Password - char ServerName[MAX_HOST_NAME_LEN + 1]; // Server name - UINT RetryIntervalSec; // Time to retry - EVENT *CancelEvent; // Event to cancel the dialog display - bool ProxyServer; // The authentication by the proxy server - UINT64 StartTick; // Start time - bool AdminMode; // Administrative mode - bool ShowNoSavePassword; // Whether to display a check box that does not save the password - bool NoSavePassword; // Mode that not to save the password - SOCK *Sock; // Socket -}; - -// Message dialog -struct UI_MSG_DLG -{ - char ServerName[MAX_HOST_NAME_LEN + 1]; // Server name - char HubName[MAX_HUBNAME_LEN + 1]; // Virtual HUB name - wchar_t *Msg; // Body - SOCK *Sock; // Socket - bool Halt; // Flag to close -}; - -// NIC information -struct UI_NICINFO -{ - wchar_t AccountName[MAX_SIZE]; // Connection setting name - char NicName[MAX_SIZE]; // Virtual NIC name - - SOCK *Sock; // Socket - bool Halt; // Flag to close - ROUTE_CHANGE *RouteChange; // Routing table change notification - UINT CurrentIcon; // Current icon - UINT64 CloseAfterTime; // Close automatically -}; - -// Connection Error dialog -struct UI_CONNECTERROR_DLG -{ - EVENT *CancelEvent; // Event to cancel the dialog display - wchar_t AccountName[MAX_ACCOUNT_NAME_LEN + 1]; // Account name - char ServerName[MAX_HOST_NAME_LEN + 1]; // Server name - UINT Err; // Error code - UINT CurrentRetryCount; // Current retry count - UINT RetryLimit; // Limit of the number of retries - UINT64 StartTick; // Start time - UINT RetryIntervalSec; // Time to retry - bool HideWindow; // Hide the window - SOCK *Sock; // Socket -}; - -// Server certificate checking dialog -struct UI_CHECKCERT -{ - wchar_t AccountName[MAX_ACCOUNT_NAME_LEN + 1]; // Account name - char ServerName[MAX_HOST_NAME_LEN + 1]; // Server name - X *x; // Server certificate - X *parent_x; // Parent certificate - X *old_x; // Certificate of previous - bool DiffWarning; // Display a warning of certificate forgery - bool Ok; // Connection permission flag - bool SaveServerCert; // Save the server certificate - SESSION *Session; // Session - volatile bool Halt; // Halting flag - SOCK *Sock; // Socket -}; - - -// Function prototype -SESSION *NewClientSessionEx(CEDAR *cedar, CLIENT_OPTION *option, CLIENT_AUTH *auth, PACKET_ADAPTER *pa, struct ACCOUNT *account); -SESSION *NewClientSession(CEDAR *cedar, CLIENT_OPTION *option, CLIENT_AUTH *auth, PACKET_ADAPTER *pa); -SESSION *NewRpcSession(CEDAR *cedar, CLIENT_OPTION *option); -SESSION *NewRpcSessionEx(CEDAR *cedar, CLIENT_OPTION *option, UINT *err, char *client_str); -SESSION *NewRpcSessionEx2(CEDAR *cedar, CLIENT_OPTION *option, UINT *err, char *client_str, void *hWnd); -SESSION *NewServerSession(CEDAR *cedar, CONNECTION *c, HUB *h, char *username, POLICY *policy); -SESSION *NewServerSessionEx(CEDAR *cedar, CONNECTION *c, HUB *h, char *username, POLICY *policy, bool inproc_mode, UCHAR *ipc_mac_address); -void ClientThread(THREAD *t, void *param); -void ReleaseSession(SESSION *s); -void CleanupSession(SESSION *s); -void StopSession(SESSION *s); -void StopSessionEx(SESSION *s, bool no_wait); -bool SessionConnect(SESSION *s); -bool ClientConnect(CONNECTION *c); -PACKET_ADAPTER *NewPacketAdapter(PA_INIT *init, PA_GETCANCEL *getcancel, PA_GETNEXTPACKET *getnext, - PA_PUTPACKET *put, PA_FREE *free); -void FreePacketAdapter(PACKET_ADAPTER *pa); -void SessionMain(SESSION *s); -void NewSessionKey(CEDAR *cedar, UCHAR *session_key, UINT *session_key_32); -SESSION *GetSessionFromKey(CEDAR *cedar, UCHAR *session_key); -bool IsIpcMacAddress(UCHAR *mac); -void ClientAdditionalConnectChance(SESSION *s); -void SessionAdditionalConnect(SESSION *s); -void ClientAdditionalThread(THREAD *t, void *param); -void PrintSessionTotalDataSize(SESSION *s); -void AddTrafficForSession(SESSION *s, TRAFFIC *t); -void IncrementUserTraffic(HUB *hub, char *username, SESSION *s); -void Notify(SESSION *s, UINT code); -void PrintStatus(SESSION *s, wchar_t *str); -LIST *NewCancelList(); -void ReleaseCancelList(LIST *o); -void AddCancelList(LIST *o, CANCEL *c); -void CancelList(LIST *o); -bool IsPriorityHighestPacketForQoS(void *data, UINT size); -UINT GetNextDelayedPacketTickDiff(SESSION *s); - -UINT PrepareDHCPRequestForStaticIPv4(SESSION *s, BLOCK *b); -void ClearDHCPLeaseRecordForIPv4(SESSION *s, UINT static_ip); - -#endif // SESSION_H - - - +// SoftEther VPN Source Code - Developer Edition Master Branch +// Cedar Communication Module + + +// Session.h +// Header of Session.c + +#ifndef SESSION_H +#define SESSION_H + + +// Interval to increment the number of logins after the connection +#define NUM_LOGIN_INCREMENT_INTERVAL (30 * 1000) + +// Packet adapter function +typedef bool (PA_INIT)(SESSION *s); +typedef CANCEL *(PA_GETCANCEL)(SESSION *s); +typedef UINT (PA_GETNEXTPACKET)(SESSION *s, void **data); +typedef bool (PA_PUTPACKET)(SESSION *s, void *data, UINT size); +typedef void (PA_FREE)(SESSION *s); + +// Client related function +typedef void (CLIENT_STATUS_PRINTER)(SESSION *s, wchar_t *status); + +// Node information +struct NODE_INFO +{ + char ClientProductName[64]; // Client product name + UINT ClientProductVer; // Client version + UINT ClientProductBuild; // Client build number + char ServerProductName[64]; // Server product name + UINT ServerProductVer; // Server version + UINT ServerProductBuild; // Server build number + char ClientOsName[64]; // Client OS name + char ClientOsVer[128]; // Client OS version + char ClientOsProductId[64]; // Client OS Product ID + char ClientHostname[64]; // Client host name + UINT ClientIpAddress; // Client IP address + UINT ClientPort; // Client port number + char ServerHostname[64]; // Server host name + UINT ServerIpAddress; // Server IP address + UINT ServerPort; // Server port number + char ProxyHostname[64]; // Proxy host name + UINT ProxyIpAddress; // Proxy Server IP Address + UINT ProxyPort; // Proxy port number + char HubName[64]; // HUB name + UCHAR UniqueId[16]; // Unique ID + // The following is for IPv6 support + UCHAR ClientIpAddress6[16]; // Client IPv6 address + UCHAR ServerIpAddress6[16]; // Server IP address + UCHAR ProxyIpAddress6[16]; // Proxy Server IP Address + char Padding[304 - (16 * 3)]; // Padding +}; + +// Packet adapter +struct PACKET_ADAPTER +{ + PA_INIT *Init; + PA_GETCANCEL *GetCancel; + PA_GETNEXTPACKET *GetNextPacket; + PA_PUTPACKET *PutPacket; + PA_FREE *Free; + void *Param; + UINT Id; +}; + +// Packet Adapter IDs +#define PACKET_ADAPTER_ID_VLAN_WIN32 1 + + +// Session structure +struct SESSION +{ + LOCK *lock; // Lock + REF *ref; // Reference counter + CEDAR *Cedar; // Cedar + bool LocalHostSession; // Local host session + bool ServerMode; // Server mode session + bool NormalClient; // Connecting session from a regular client (not such as localbridge) + bool LinkModeClient; // Link mode client + bool LinkModeServer; // Link mode server + bool SecureNATMode; // SecureNAT session + bool BridgeMode; // Bridge session + bool BridgeIsEthLoopbackBlock; // Loopback is disabled on the Ethernet level + bool VirtualHost; // Virtual host mode + bool L3SwitchMode; // Layer-3 switch mode + bool InProcMode; // In-process mode + THREAD *Thread; // Management thread + CONNECTION *Connection; // Connection + char ClientIP[64]; // Client IP + CLIENT_OPTION *ClientOption; // Client connection options + CLIENT_AUTH *ClientAuth; // Client authentication data + volatile bool Halt; // Halting flag + volatile bool CancelConnect; // Cancel the connection + EVENT *HaltEvent; // Halting event + UINT Err; // Error value + HUB *Hub; // HUB + CANCEL *Cancel1; // Cancel object 1 + CANCEL *Cancel2; // Cancel object 2 + PACKET_ADAPTER *PacketAdapter; // Packet adapter + UCHAR UdpSendKey[16]; // UDP encryption key for transmission + UCHAR UdpRecvKey[16]; // UDP encryption key for reception + UINT ClientStatus; // Client Status + bool RetryFlag; // Retry flag (client) + bool ForceStopFlag; // Forced stop flag (client) + UINT CurrentRetryCount; // Current retry counter (client) + UINT RetryInterval; // Retry interval (client) + bool ConnectSucceed; // Connection success flag (client) + bool SessionTimeOuted; // Session times out + UINT Timeout; // Time-out period + UINT64 NextConnectionTime; // Time to put next additional connection + IP ServerIP; // IP address of the server + bool ClientModeAndUseVLan; // Use a virtual LAN card in client mode + LOCK *TrafficLock; // Traffic data lock + LINK *Link; // A reference to the link object + SNAT *SecureNAT; // A reference to the SecureNAT object + BRIDGE *Bridge; // A reference to the Bridge object + NODE_INFO NodeInfo; // Node information + UINT64 LastIncrementTraffic; // Last time that updated the traffic data of the user + bool AdministratorMode; // Administrator mode + LIST *CancelList; // Cancellation list + L3IF *L3If; // Layer-3 interface + IP DefaultDns; // IP address of the default DNS server + bool IPv6Session; // IPv6 session (Physical communication is IPv6) + UINT VLanId; // VLAN ID + UINT UniqueId; // Unique ID + UCHAR IpcMacAddress[6]; // MAC address for IPC + UCHAR Padding[2]; + + IP ServerIP_CacheForNextConnect; // Server IP, cached for next connect + + UINT64 CreatedTime; // Creation date and time + UINT64 LastCommTime; // Last communication date and time + UINT64 LastCommTimeForDormant; // Last communication date and time (for dormant) + TRAFFIC *Traffic; // Traffic data + TRAFFIC *OldTraffic; // Old traffic data + UINT64 TotalSendSize; // Total transmitted data size + UINT64 TotalRecvSize; // Total received data size + UINT64 TotalSendSizeReal; // Total transmitted data size (no compression) + UINT64 TotalRecvSizeReal; // Total received data size (no compression) + char *Name; // Session name + char *Username; // User name + char UserNameReal[MAX_USERNAME_LEN + 1]; // User name (real) + char GroupName[MAX_USERNAME_LEN + 1]; // Group name + POLICY *Policy; // Policy + UCHAR SessionKey[SHA1_SIZE]; // Session key + UINT SessionKey32; // 32bit session key + char SessionKeyStr[64]; // Session key string + UINT MaxConnection; // Maximum number of concurrent TCP connections + bool UseEncrypt; // Use encrypted communication + bool UseCompress; // Use data compression + bool HalfConnection; // Half connection mode + bool QoS; // VoIP / QoS + bool NoSendSignature; // Do not send a signature + bool IsOpenVPNL3Session; // Whether OpenVPN L3 session + bool IsOpenVPNL2Session; // Whether OpenVPN L2 session + UINT NumDisconnected; // Number of socket disconnection + bool NoReconnectToSession; // Disable to reconnect to the session + char UnderlayProtocol[64]; // Physical communication protocol + char ProtocolDetails[256]; // Protocol details + /* !!! Do not correct the spelling to keep the backward protocol compatibility !!! */ + UINT64 FirstConnectionEstablisiedTime; // Connection completion time of the first connection + UINT64 CurrentConnectionEstablishTime; // Completion time of this connection + UINT NumConnectionsEstablished; // Number of connections established so far + UINT AdjustMss; // MSS adjustment value + bool IsVPNClientAndVLAN_Win32; // Is the VPN Client session with a VLAN card (Win32) + + bool IsRUDPSession; // Whether R-UDP session + UINT RUdpMss; // The value of the MSS should be applied while the R-UDP is used + bool EnableBulkOnRUDP; // Allow the bulk transfer in the R-UDP session + UINT BulkOnRUDPVersion; // RUDP Bulk version + bool EnableHMacOnBulkOfRUDP; // Use the HMAC to sign the bulk transfer of R-UDP session + bool EnableUdpRecovery; // Enable the R-UDP recovery + + bool UseUdpAcceleration; // Use of UDP acceleration mode + UINT UdpAccelerationVersion; // UDP acceleration version + bool UseHMacOnUdpAcceleration; // Use the HMAC in the UDP acceleration mode + UDP_ACCEL *UdpAccel; // UDP acceleration + bool IsUsingUdpAcceleration; // Flag of whether the UDP acceleration is used + UINT UdpAccelMss; // MSS value to be applied while the UDP acceleration is used + bool UdpAccelFastDisconnectDetect; // Fast disconnection detection is enabled + + bool IsAzureSession; // Whether the session via VPN Azure + IP AzureRealServerGlobalIp; // Real global IP of the server-side in the case of session via VPN Azure + + ACCOUNT *Account; // Client account + UINT VLanDeviceErrorCount; // Number of times that the error occurred in the virtual LAN card + bool Win32HideConnectWindow; // Hide the status window + bool Win32HideNicInfoWindow; // Hide the NIC information window + bool UserCanceled; // Canceled by the user + UINT64 LastTryAddConnectTime; // Last time that attempted to add a connection + + bool IsMonitorMode; // Whether the monitor mode + bool IsBridgeMode; // Whether the bridge mode + bool UseClientLicense; // Number of assigned client licenses + bool UseBridgeLicense; // Number of assigned bridge licenses + + COUNTER *LoggingRecordCount; // Counter for the number of logging records + + bool FreeInfoShowed; // Whether a warning about Free Edition has already displayed + + bool Client_NoSavePassword; // Prohibit the password saving + wchar_t *Client_Message; // Message that has been sent from the server + + LIST *DelayedPacketList; // Delayed packet list + UINT Flag1; + + USER *NumLoginIncrementUserObject; // User objects to increment the number of logins + HUB *NumLoginIncrementHubObject; // Virtual HUB object to increment the number of logins + UINT64 NumLoginIncrementTick; // Time to perform increment a number of log + + bool FirstTimeHttpRedirect; // Redirect HTTP only for the first time + char FirstTimeHttpRedirectUrl[128]; // URL for redirection only the first time + UINT FirstTimeHttpAccessCheckIp; // IP address for access checking + + UCHAR BulkSendKey[RUDP_BULK_KEY_SIZE_MAX]; // RUDP Bulk Send Key + UINT BulkSendKeySize; // RUDP Bulk Send Key size + UCHAR BulkRecvKey[RUDP_BULK_KEY_SIZE_MAX]; // RUDP Bulk Recv Key + UINT BulkRecvKeySize; // RUDP Bulk Recv Key size + + // To examine the maximum number of allowed logging target packets per minute + UINT64 MaxLoggedPacketsPerMinuteStartTick; // Inspection start time + UINT CurrentNumPackets; // Current number of packets + + // Measures for D-Link bug + UINT64 LastDLinkSTPPacketSendTick; // Last D-Link STP packet transmission time + UCHAR LastDLinkSTPPacketDataHash[MD5_SIZE]; // Last D-Link STP packet hash + + SHARED_BUFFER *IpcSessionSharedBuffer; // A shared buffer between IPC and Session + IPC_SESSION_SHARED_BUFFER_DATA *IpcSessionShared; // Shared data between IPC and Session +}; + +// Password dialog +struct UI_PASSWORD_DLG +{ + UINT Type; // Type of password + char Username[MAX_USERNAME_LEN + 1]; // User name + char Password[MAX_PASSWORD_LEN + 1]; // Password + char ServerName[MAX_HOST_NAME_LEN + 1]; // Server name + UINT RetryIntervalSec; // Time to retry + EVENT *CancelEvent; // Event to cancel the dialog display + bool ProxyServer; // The authentication by the proxy server + UINT64 StartTick; // Start time + bool AdminMode; // Administrative mode + bool ShowNoSavePassword; // Whether to display a check box that does not save the password + bool NoSavePassword; // Mode that not to save the password + SOCK *Sock; // Socket +}; + +// Message dialog +struct UI_MSG_DLG +{ + char ServerName[MAX_HOST_NAME_LEN + 1]; // Server name + char HubName[MAX_HUBNAME_LEN + 1]; // Virtual HUB name + wchar_t *Msg; // Body + SOCK *Sock; // Socket + bool Halt; // Flag to close +}; + +// NIC information +struct UI_NICINFO +{ + wchar_t AccountName[MAX_SIZE]; // Connection setting name + char NicName[MAX_SIZE]; // Virtual NIC name + + SOCK *Sock; // Socket + bool Halt; // Flag to close + ROUTE_CHANGE *RouteChange; // Routing table change notification + UINT CurrentIcon; // Current icon + UINT64 CloseAfterTime; // Close automatically +}; + +// Connection Error dialog +struct UI_CONNECTERROR_DLG +{ + EVENT *CancelEvent; // Event to cancel the dialog display + wchar_t AccountName[MAX_ACCOUNT_NAME_LEN + 1]; // Account name + char ServerName[MAX_HOST_NAME_LEN + 1]; // Server name + UINT Err; // Error code + UINT CurrentRetryCount; // Current retry count + UINT RetryLimit; // Limit of the number of retries + UINT64 StartTick; // Start time + UINT RetryIntervalSec; // Time to retry + bool HideWindow; // Hide the window + SOCK *Sock; // Socket +}; + +// Server certificate checking dialog +struct UI_CHECKCERT +{ + wchar_t AccountName[MAX_ACCOUNT_NAME_LEN + 1]; // Account name + char ServerName[MAX_HOST_NAME_LEN + 1]; // Server name + X *x; // Server certificate + X *parent_x; // Parent certificate + X *old_x; // Certificate of previous + bool DiffWarning; // Display a warning of certificate forgery + bool Ok; // Connection permission flag + bool SaveServerCert; // Save the server certificate + SESSION *Session; // Session + volatile bool Halt; // Halting flag + SOCK *Sock; // Socket +}; + + +// Function prototype +SESSION *NewClientSessionEx(CEDAR *cedar, CLIENT_OPTION *option, CLIENT_AUTH *auth, PACKET_ADAPTER *pa, struct ACCOUNT *account); +SESSION *NewClientSession(CEDAR *cedar, CLIENT_OPTION *option, CLIENT_AUTH *auth, PACKET_ADAPTER *pa); +SESSION *NewRpcSession(CEDAR *cedar, CLIENT_OPTION *option); +SESSION *NewRpcSessionEx(CEDAR *cedar, CLIENT_OPTION *option, UINT *err, char *client_str); +SESSION *NewRpcSessionEx2(CEDAR *cedar, CLIENT_OPTION *option, UINT *err, char *client_str, void *hWnd); +SESSION *NewServerSession(CEDAR *cedar, CONNECTION *c, HUB *h, char *username, POLICY *policy); +SESSION *NewServerSessionEx(CEDAR *cedar, CONNECTION *c, HUB *h, char *username, POLICY *policy, bool inproc_mode, UCHAR *ipc_mac_address); +void ClientThread(THREAD *t, void *param); +void ReleaseSession(SESSION *s); +void CleanupSession(SESSION *s); +void StopSession(SESSION *s); +void StopSessionEx(SESSION *s, bool no_wait); +bool SessionConnect(SESSION *s); +bool ClientConnect(CONNECTION *c); +PACKET_ADAPTER *NewPacketAdapter(PA_INIT *init, PA_GETCANCEL *getcancel, PA_GETNEXTPACKET *getnext, + PA_PUTPACKET *put, PA_FREE *free); +void FreePacketAdapter(PACKET_ADAPTER *pa); +void SessionMain(SESSION *s); +void NewSessionKey(CEDAR *cedar, UCHAR *session_key, UINT *session_key_32); +SESSION *GetSessionFromKey(CEDAR *cedar, UCHAR *session_key); +bool IsIpcMacAddress(UCHAR *mac); +void ClientAdditionalConnectChance(SESSION *s); +void SessionAdditionalConnect(SESSION *s); +void ClientAdditionalThread(THREAD *t, void *param); +void PrintSessionTotalDataSize(SESSION *s); +void AddTrafficForSession(SESSION *s, TRAFFIC *t); +void IncrementUserTraffic(HUB *hub, char *username, SESSION *s); +void Notify(SESSION *s, UINT code); +void PrintStatus(SESSION *s, wchar_t *str); +LIST *NewCancelList(); +void ReleaseCancelList(LIST *o); +void AddCancelList(LIST *o, CANCEL *c); +void CancelList(LIST *o); +bool IsPriorityHighestPacketForQoS(void *data, UINT size); +UINT GetNextDelayedPacketTickDiff(SESSION *s); + +UINT PrepareDHCPRequestForStaticIPv4(SESSION *s, BLOCK *b); +void ClearDHCPLeaseRecordForIPv4(SESSION *s, UINT static_ip); + +#endif // SESSION_H + + + diff --git a/src/Cedar/UT.c b/src/Cedar/UT.c index 27873169..816a210d 100644 --- a/src/Cedar/UT.c +++ b/src/Cedar/UT.c @@ -1,309 +1,309 @@ -// SoftEther VPN Source Code - Developer Edition Master Branch -// Cedar Communication Module - - -// UT.c -// SoftEther Network Utility For Win32 - -#include - -#ifdef WIN32 - -#define UT_C - -#define _WIN32_WINNT 0x0502 -#define WINVER 0x0502 -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "../PenCore/resource.h" - -static char *selected_adapter = NULL; - -// Update status -void UtSpeedMeterDlgRefreshStatus(HWND hWnd) -{ - char *title; - MS_ADAPTER *a; - UINT i; - // Validate arguments - if (hWnd == NULL) - { - return; - } - - title = selected_adapter; - - a = MsGetAdapter(title); - if (a == NULL) - { - LbReset(hWnd, L_STATUS); - Disable(hWnd, L_STATUS); - } - else - { - LVB *b; - wchar_t tmp[MAX_SIZE]; - wchar_t tmp2[MAX_SIZE]; - char str[MAX_SIZE]; - b = LvInsertStart(); - - UniStrCpy(tmp, sizeof(tmp), a->TitleW); - LvInsertAdd(b, 0, NULL, 2, _UU("UT_SM_ST_TITLE"), tmp); - - StrToUni(tmp, sizeof(tmp), a->Guid); - LvInsertAdd(b, 0, NULL, 2, _UU("UT_SM_ST_GUID"), tmp); - - LvInsertAdd(b, 0, NULL, 2, _UU("UT_SM_ST_TYPE"), MsGetAdapterTypeStr(a->Type)); - - LvInsertAdd(b, 0, NULL, 2, _UU("UT_SM_ST_TYPE2"), (!a->IsNotEthernetLan ? _UU("SEC_YES") : _UU("SEC_NO"))); - - LvInsertAdd(b, 0, NULL, 2, _UU("UT_SM_ST_STATUS"), MsGetAdapterStatusStr(a->Status)); - - UniToStr3(tmp, sizeof(tmp), a->Mtu); - LvInsertAdd(b, 0, NULL, 2, _UU("UT_SM_ST_MTU"), tmp); - - UniToStr3(tmp, sizeof(tmp), a->Speed); - LvInsertAdd(b, 0, NULL, 2, _UU("UT_SM_ST_SPEED"), tmp); - - Zero(str, sizeof(str)); - BinToStrEx2(str, sizeof(str), a->Address, a->AddressSize, '-'); - StrToUni(tmp, sizeof(tmp), str); - LvInsertAdd(b, 0, NULL, 2, _UU("UT_SM_ST_ADDRESS"), tmp); - - UniToStr3(tmp, sizeof(tmp), a->RecvBytes); - LvInsertAdd(b, 0, NULL, 2, _UU("UT_SM_ST_RECV_BYTES"), tmp); - - UniToStr3(tmp, sizeof(tmp), a->RecvPacketsBroadcast); - LvInsertAdd(b, 0, NULL, 2, _UU("UT_SM_ST_RECV_BCASTS"), tmp); - - UniToStr3(tmp, sizeof(tmp), a->RecvPacketsUnicast); - LvInsertAdd(b, 0, NULL, 2, _UU("UT_SM_ST_RECV_UNICASTS"), tmp); - - UniToStr3(tmp, sizeof(tmp), a->SendBytes); - LvInsertAdd(b, 0, NULL, 2, _UU("UT_SM_ST_SEND_BYTES"), tmp); - - UniToStr3(tmp, sizeof(tmp), a->SendPacketsBroadcast); - LvInsertAdd(b, 0, NULL, 2, _UU("UT_SM_ST_SEND_BCASTS"), tmp); - - UniToStr3(tmp, sizeof(tmp), a->SendPacketsUnicast); - LvInsertAdd(b, 0, NULL, 2, _UU("UT_SM_ST_SEND_UNICASTS"), tmp); - - for (i = 0;i < a->NumIpAddress;i++) - { - UniFormat(tmp2, sizeof(tmp2), _UU("UT_SM_ST_IP"), i + 1); - IPToUniStr(tmp, sizeof(tmp), &a->IpAddresses[i]); - LvInsertAdd(b, 0, NULL, 2, tmp2, tmp); - - UniFormat(tmp2, sizeof(tmp2), _UU("UT_SM_ST_SUBNET"), i + 1); - IPToUniStr(tmp, sizeof(tmp), &a->SubnetMasks[i]); - LvInsertAdd(b, 0, NULL, 2, tmp2, tmp); - } - - for (i = 0;i < a->NumGateway;i++) - { - UniFormat(tmp2, sizeof(tmp2), _UU("UT_SM_ST_GATEWAY"), i + 1); - IPToUniStr(tmp, sizeof(tmp), &a->Gateways[i]); - LvInsertAdd(b, 0, NULL, 2, tmp2, tmp); - } - - if (a->UseDhcp) - { - IPToUniStr(tmp, sizeof(tmp), &a->DhcpServer); - LvInsertAdd(b, 0, NULL, 2, _UU("UT_SM_ST_DHCP"), tmp); - - GetDateTimeStrEx64(tmp, sizeof(tmp), a->DhcpLeaseStart, NULL); - LvInsertAdd(b, 0, NULL, 2, _UU("UT_SM_ST_DHCP_1"), tmp); - - GetDateTimeStrEx64(tmp, sizeof(tmp), a->DhcpLeaseExpires, NULL); - LvInsertAdd(b, 0, NULL, 2, _UU("UT_SM_ST_DHCP_2"), tmp); - } - - if (a->UseWins) - { - IPToUniStr(tmp, sizeof(tmp), &a->PrimaryWinsServer); - LvInsertAdd(b, 0, NULL, 2, _UU("UT_SM_ST_WINS_1"), tmp); - - IPToUniStr(tmp, sizeof(tmp), &a->SecondaryWinsServer); - LvInsertAdd(b, 0, NULL, 2, _UU("UT_SM_ST_WINS_2"), tmp); - } - - LvInsertEnd(b, hWnd, L_STATUS); - Enable(hWnd, L_STATUS); - - MsFreeAdapter(a); - } - -} - -static bool g_ut_adapter_list_updating = false; - -// Update the adapter list -void UtSpeedMeterDlgRefreshList(HWND hWnd) -{ - wchar_t *old; - MS_ADAPTER_LIST *o; - UINT i; - // Validate arguments - if (hWnd == NULL) - { - return; - } - - if (g_ut_adapter_list_updating) - { - return; - } - g_ut_adapter_list_updating = true; - - // Get the current selection - old = GetText(hWnd, E_LIST); - if (old != NULL) - { - if (UniStrLen(old) == 0) - { - Free(old); - old = NULL; - } - } - - o = MsCreateAdapterList(); - CbReset(hWnd, E_LIST); - CbSetHeight(hWnd, E_LIST, 18); - - for (i = 0;i < o->Num;i++) - { - wchar_t tmp[MAX_SIZE]; - MS_ADAPTER *a = o->Adapters[i]; - - if (a->Info) - { - StrToUni(tmp, sizeof(tmp), a->Title); - CbAddStr(hWnd, E_LIST, tmp, 0); - } - } - - - // Re-select the previous selection - if (old != NULL) - { - CbSelectIndex(hWnd, E_LIST, CbFindStr(hWnd, E_LIST, old)); - Free(old); - } - - MsFreeAdapterList(o); - - g_ut_adapter_list_updating = false; -} - -// Speedometer dialog control update -void UtSpeedMeterDlgUpdate(HWND hWnd) -{ - // Validate arguments - if (hWnd == NULL) - { - return; - } -} - -// Speedometer dialog initialization -void UtSpeedMeterDlgInit(HWND hWnd) -{ - // Validate arguments - if (hWnd == NULL) - { - return; - } - - LvInitEx(hWnd, L_STATUS, true); - LvInsertColumn(hWnd, L_STATUS, 0, _UU("UT_SM_COLUMN_1"), 150); - LvInsertColumn(hWnd, L_STATUS, 1, _UU("UT_SM_COLUMN_2"), 290); - - UtSpeedMeterDlgRefreshList(hWnd); - selected_adapter = GetTextA(hWnd, E_LIST); - UtSpeedMeterDlgRefreshStatus(hWnd); - UtSpeedMeterDlgUpdate(hWnd); -} - -// Speedometer dialog -UINT UtSpeedMeterDlgProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param) -{ - // Validate arguments - if (hWnd == NULL) - { - return 0; - } - - switch (msg) - { - case WM_INITDIALOG: - SetIcon(hWnd, 0, ICO_NIC_ONLINE); - UtSpeedMeterDlgInit(hWnd); - SetTimer(hWnd, 1, SPEED_METER_REFRESH_INTERVAL, NULL); - break; - - case WM_TIMER: - switch (wParam) - { - case 1: - KillTimer(hWnd, 1); - UtSpeedMeterDlgRefreshStatus(hWnd); - UtSpeedMeterDlgUpdate(hWnd); - SetTimer(hWnd, 1, SPEED_METER_REFRESH_INTERVAL, NULL); - break; - } - break; - - case WM_COMMAND: - if (HIWORD(wParam) == CBN_SELCHANGE) { - Free(selected_adapter); - selected_adapter = GetTextA(hWnd, E_LIST); - UtSpeedMeterDlgUpdate(hWnd); - } else { - switch (wParam) - { - case B_REFRESH: - UtSpeedMeterDlgRefreshList(hWnd); - Free(selected_adapter); - selected_adapter = GetTextA(hWnd, E_LIST); - UtSpeedMeterDlgUpdate(hWnd); - break; - - case IDCANCEL: - Close(hWnd); - break; - } - } - break; - - case WM_CLOSE: - Free(selected_adapter); - selected_adapter = NULL; - EndDialog(hWnd, 0); - break; - } - - return 0; -} - -// Speedometer -void UtSpeedMeterEx(void *hWnd) -{ - Dialog((HWND)hWnd, D_SPEEDMETER, UtSpeedMeterDlgProc, NULL); -} - -#endif // WIN32 - +// SoftEther VPN Source Code - Developer Edition Master Branch +// Cedar Communication Module + + +// UT.c +// SoftEther Network Utility For Win32 + +#include + +#ifdef WIN32 + +#define UT_C + +#define _WIN32_WINNT 0x0502 +#define WINVER 0x0502 +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "../PenCore/resource.h" + +static char *selected_adapter = NULL; + +// Update status +void UtSpeedMeterDlgRefreshStatus(HWND hWnd) +{ + char *title; + MS_ADAPTER *a; + UINT i; + // Validate arguments + if (hWnd == NULL) + { + return; + } + + title = selected_adapter; + + a = MsGetAdapter(title); + if (a == NULL) + { + LbReset(hWnd, L_STATUS); + Disable(hWnd, L_STATUS); + } + else + { + LVB *b; + wchar_t tmp[MAX_SIZE]; + wchar_t tmp2[MAX_SIZE]; + char str[MAX_SIZE]; + b = LvInsertStart(); + + UniStrCpy(tmp, sizeof(tmp), a->TitleW); + LvInsertAdd(b, 0, NULL, 2, _UU("UT_SM_ST_TITLE"), tmp); + + StrToUni(tmp, sizeof(tmp), a->Guid); + LvInsertAdd(b, 0, NULL, 2, _UU("UT_SM_ST_GUID"), tmp); + + LvInsertAdd(b, 0, NULL, 2, _UU("UT_SM_ST_TYPE"), MsGetAdapterTypeStr(a->Type)); + + LvInsertAdd(b, 0, NULL, 2, _UU("UT_SM_ST_TYPE2"), (!a->IsNotEthernetLan ? _UU("SEC_YES") : _UU("SEC_NO"))); + + LvInsertAdd(b, 0, NULL, 2, _UU("UT_SM_ST_STATUS"), MsGetAdapterStatusStr(a->Status)); + + UniToStr3(tmp, sizeof(tmp), a->Mtu); + LvInsertAdd(b, 0, NULL, 2, _UU("UT_SM_ST_MTU"), tmp); + + UniToStr3(tmp, sizeof(tmp), a->Speed); + LvInsertAdd(b, 0, NULL, 2, _UU("UT_SM_ST_SPEED"), tmp); + + Zero(str, sizeof(str)); + BinToStrEx2(str, sizeof(str), a->Address, a->AddressSize, '-'); + StrToUni(tmp, sizeof(tmp), str); + LvInsertAdd(b, 0, NULL, 2, _UU("UT_SM_ST_ADDRESS"), tmp); + + UniToStr3(tmp, sizeof(tmp), a->RecvBytes); + LvInsertAdd(b, 0, NULL, 2, _UU("UT_SM_ST_RECV_BYTES"), tmp); + + UniToStr3(tmp, sizeof(tmp), a->RecvPacketsBroadcast); + LvInsertAdd(b, 0, NULL, 2, _UU("UT_SM_ST_RECV_BCASTS"), tmp); + + UniToStr3(tmp, sizeof(tmp), a->RecvPacketsUnicast); + LvInsertAdd(b, 0, NULL, 2, _UU("UT_SM_ST_RECV_UNICASTS"), tmp); + + UniToStr3(tmp, sizeof(tmp), a->SendBytes); + LvInsertAdd(b, 0, NULL, 2, _UU("UT_SM_ST_SEND_BYTES"), tmp); + + UniToStr3(tmp, sizeof(tmp), a->SendPacketsBroadcast); + LvInsertAdd(b, 0, NULL, 2, _UU("UT_SM_ST_SEND_BCASTS"), tmp); + + UniToStr3(tmp, sizeof(tmp), a->SendPacketsUnicast); + LvInsertAdd(b, 0, NULL, 2, _UU("UT_SM_ST_SEND_UNICASTS"), tmp); + + for (i = 0;i < a->NumIpAddress;i++) + { + UniFormat(tmp2, sizeof(tmp2), _UU("UT_SM_ST_IP"), i + 1); + IPToUniStr(tmp, sizeof(tmp), &a->IpAddresses[i]); + LvInsertAdd(b, 0, NULL, 2, tmp2, tmp); + + UniFormat(tmp2, sizeof(tmp2), _UU("UT_SM_ST_SUBNET"), i + 1); + IPToUniStr(tmp, sizeof(tmp), &a->SubnetMasks[i]); + LvInsertAdd(b, 0, NULL, 2, tmp2, tmp); + } + + for (i = 0;i < a->NumGateway;i++) + { + UniFormat(tmp2, sizeof(tmp2), _UU("UT_SM_ST_GATEWAY"), i + 1); + IPToUniStr(tmp, sizeof(tmp), &a->Gateways[i]); + LvInsertAdd(b, 0, NULL, 2, tmp2, tmp); + } + + if (a->UseDhcp) + { + IPToUniStr(tmp, sizeof(tmp), &a->DhcpServer); + LvInsertAdd(b, 0, NULL, 2, _UU("UT_SM_ST_DHCP"), tmp); + + GetDateTimeStrEx64(tmp, sizeof(tmp), a->DhcpLeaseStart, NULL); + LvInsertAdd(b, 0, NULL, 2, _UU("UT_SM_ST_DHCP_1"), tmp); + + GetDateTimeStrEx64(tmp, sizeof(tmp), a->DhcpLeaseExpires, NULL); + LvInsertAdd(b, 0, NULL, 2, _UU("UT_SM_ST_DHCP_2"), tmp); + } + + if (a->UseWins) + { + IPToUniStr(tmp, sizeof(tmp), &a->PrimaryWinsServer); + LvInsertAdd(b, 0, NULL, 2, _UU("UT_SM_ST_WINS_1"), tmp); + + IPToUniStr(tmp, sizeof(tmp), &a->SecondaryWinsServer); + LvInsertAdd(b, 0, NULL, 2, _UU("UT_SM_ST_WINS_2"), tmp); + } + + LvInsertEnd(b, hWnd, L_STATUS); + Enable(hWnd, L_STATUS); + + MsFreeAdapter(a); + } + +} + +static bool g_ut_adapter_list_updating = false; + +// Update the adapter list +void UtSpeedMeterDlgRefreshList(HWND hWnd) +{ + wchar_t *old; + MS_ADAPTER_LIST *o; + UINT i; + // Validate arguments + if (hWnd == NULL) + { + return; + } + + if (g_ut_adapter_list_updating) + { + return; + } + g_ut_adapter_list_updating = true; + + // Get the current selection + old = GetText(hWnd, E_LIST); + if (old != NULL) + { + if (UniStrLen(old) == 0) + { + Free(old); + old = NULL; + } + } + + o = MsCreateAdapterList(); + CbReset(hWnd, E_LIST); + CbSetHeight(hWnd, E_LIST, 18); + + for (i = 0;i < o->Num;i++) + { + wchar_t tmp[MAX_SIZE]; + MS_ADAPTER *a = o->Adapters[i]; + + if (a->Info) + { + StrToUni(tmp, sizeof(tmp), a->Title); + CbAddStr(hWnd, E_LIST, tmp, 0); + } + } + + + // Re-select the previous selection + if (old != NULL) + { + CbSelectIndex(hWnd, E_LIST, CbFindStr(hWnd, E_LIST, old)); + Free(old); + } + + MsFreeAdapterList(o); + + g_ut_adapter_list_updating = false; +} + +// Speedometer dialog control update +void UtSpeedMeterDlgUpdate(HWND hWnd) +{ + // Validate arguments + if (hWnd == NULL) + { + return; + } +} + +// Speedometer dialog initialization +void UtSpeedMeterDlgInit(HWND hWnd) +{ + // Validate arguments + if (hWnd == NULL) + { + return; + } + + LvInitEx(hWnd, L_STATUS, true); + LvInsertColumn(hWnd, L_STATUS, 0, _UU("UT_SM_COLUMN_1"), 150); + LvInsertColumn(hWnd, L_STATUS, 1, _UU("UT_SM_COLUMN_2"), 290); + + UtSpeedMeterDlgRefreshList(hWnd); + selected_adapter = GetTextA(hWnd, E_LIST); + UtSpeedMeterDlgRefreshStatus(hWnd); + UtSpeedMeterDlgUpdate(hWnd); +} + +// Speedometer dialog +UINT UtSpeedMeterDlgProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param) +{ + // Validate arguments + if (hWnd == NULL) + { + return 0; + } + + switch (msg) + { + case WM_INITDIALOG: + SetIcon(hWnd, 0, ICO_NIC_ONLINE); + UtSpeedMeterDlgInit(hWnd); + SetTimer(hWnd, 1, SPEED_METER_REFRESH_INTERVAL, NULL); + break; + + case WM_TIMER: + switch (wParam) + { + case 1: + KillTimer(hWnd, 1); + UtSpeedMeterDlgRefreshStatus(hWnd); + UtSpeedMeterDlgUpdate(hWnd); + SetTimer(hWnd, 1, SPEED_METER_REFRESH_INTERVAL, NULL); + break; + } + break; + + case WM_COMMAND: + if (HIWORD(wParam) == CBN_SELCHANGE) { + Free(selected_adapter); + selected_adapter = GetTextA(hWnd, E_LIST); + UtSpeedMeterDlgUpdate(hWnd); + } else { + switch (wParam) + { + case B_REFRESH: + UtSpeedMeterDlgRefreshList(hWnd); + Free(selected_adapter); + selected_adapter = GetTextA(hWnd, E_LIST); + UtSpeedMeterDlgUpdate(hWnd); + break; + + case IDCANCEL: + Close(hWnd); + break; + } + } + break; + + case WM_CLOSE: + Free(selected_adapter); + selected_adapter = NULL; + EndDialog(hWnd, 0); + break; + } + + return 0; +} + +// Speedometer +void UtSpeedMeterEx(void *hWnd) +{ + Dialog((HWND)hWnd, D_SPEEDMETER, UtSpeedMeterDlgProc, NULL); +} + +#endif // WIN32 + diff --git a/src/Cedar/UT.h b/src/Cedar/UT.h index d4415a6e..e6f7858d 100644 --- a/src/Cedar/UT.h +++ b/src/Cedar/UT.h @@ -1,31 +1,31 @@ -// SoftEther VPN Source Code - Developer Edition Master Branch -// Cedar Communication Module - - -// UT.h -// Header of UT.c - -#ifndef UT_H -#define UT_H - -// Constant -#define SPEED_METER_REFRESH_INTERVAL 500 - -#ifdef UT_C -// For internal declaration - -// Function prototype -UINT UtSpeedMeterDlgProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param); -void UtSpeedMeterDlgInit(HWND hWnd); -void UtSpeedMeterDlgRefreshList(HWND hWnd); -void UtSpeedMeterDlgRefreshStatus(HWND hWnd); -void UtSpeedMeterDlgUpdate(HWND hWnd); -void UtSpeedMeterDlgRefreshStatus(HWND hWnd); - -#endif // UT_C - -// Function prototype -void UtSpeedMeterEx(void *hWnd); - -#endif // UT_H - +// SoftEther VPN Source Code - Developer Edition Master Branch +// Cedar Communication Module + + +// UT.h +// Header of UT.c + +#ifndef UT_H +#define UT_H + +// Constant +#define SPEED_METER_REFRESH_INTERVAL 500 + +#ifdef UT_C +// For internal declaration + +// Function prototype +UINT UtSpeedMeterDlgProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param); +void UtSpeedMeterDlgInit(HWND hWnd); +void UtSpeedMeterDlgRefreshList(HWND hWnd); +void UtSpeedMeterDlgRefreshStatus(HWND hWnd); +void UtSpeedMeterDlgUpdate(HWND hWnd); +void UtSpeedMeterDlgRefreshStatus(HWND hWnd); + +#endif // UT_C + +// Function prototype +void UtSpeedMeterEx(void *hWnd); + +#endif // UT_H + diff --git a/src/Cedar/UdpAccel.c b/src/Cedar/UdpAccel.c index 5915c4b6..428aee59 100644 --- a/src/Cedar/UdpAccel.c +++ b/src/Cedar/UdpAccel.c @@ -1,1141 +1,1141 @@ -// SoftEther VPN Source Code - Developer Edition Master Branch -// Cedar Communication Module - - -// UdpAccel.c -// UDP acceleration function - -#include "CedarPch.h" - -// Polling process -void UdpAccelPoll(UDP_ACCEL *a) -{ - IP nat_t_ip; - UINT num_ignore_errors = 0; - UCHAR *tmp; - // Validate arguments - if (a == NULL) - { - return; - } - - tmp = a->TmpBuf; - - Lock(a->NatT_Lock); - { - Copy(&nat_t_ip, &a->NatT_IP, sizeof(IP)); - } - Unlock(a->NatT_Lock); - - if (IsZeroIp(&nat_t_ip) == false) - { - // Release the thread which gets the IP address of the NAT-T server because it is no longer needed - if (a->NatT_GetIpThread != NULL) - { - WaitThread(a->NatT_GetIpThread, INFINITE); - ReleaseThread(a->NatT_GetIpThread); - a->NatT_GetIpThread = NULL; - } - } - - // Receive a new UDP packet - while (true) - { - IP src_ip; - UINT src_port; - UINT ret; - - ret = RecvFrom(a->UdpSock, &src_ip, &src_port, tmp, UDP_ACCELERATION_TMP_BUF_SIZE); - - if (ret != 0 && ret != SOCK_LATER) - { - if (a->UseUdpIpQuery && a->UdpIpQueryPacketSize >= 8 && CmpIpAddr(&a->UdpIpQueryHost, &src_ip) == 0 && - src_port == a->UdpIpQueryPort) - { - // Receive a response of the query for IP and port number - IP my_ip = {0}; - UINT myport = 0; - BUF *b = MemToBuf(a->UdpIpQueryPacketData, a->UdpIpQueryPacketSize); - - - FreeBuf(b); - } - else if (IsZeroIp(&nat_t_ip) == false && CmpIpAddr(&nat_t_ip, &src_ip) == 0 && - src_port == UDP_NAT_T_PORT) - { - // Receive a response from the NAT-T server - IP my_ip; - UINT myport; - - if (RUDPParseIPAndPortStr(tmp, ret, &my_ip, &myport)) - { - if (myport >= 1 && myport <= 65535) - { - if (a->MyPortByNatTServer != myport) - { - a->MyPortByNatTServer = myport; - a->MyPortByNatTServerChanged = true; - a->CommToNatT_NumFail = 0; - - Debug("NAT-T: MyPort = %u\n", myport); - } - } - } -/* - BUF *b = NewBuf(); - PACK *p; - - WriteBuf(b, tmp, ret); - SeekBufToBegin(b); - - p = BufToPack(b); - if (p != NULL) - { - if (PackCmpStr(p, "opcode", "query_for_nat_traversal")) - { - if (PackGetBool(p, "ok")) - { - if (PackGetInt64(p, "tran_id") == a->NatT_TranId) - { - UINT myport = PackGetInt(p, "your_port"); - - if (myport >= 1 && myport <= 65535) - { - if (a->MyPortByNatTServer != myport) - { - a->MyPortByNatTServer = myport; - a->MyPortByNatTServerChanged = true; - - Debug("NAT-T: MyPort = %u\n", myport); - } - } - } - } - } - - FreePack(p); - } - - FreeBuf(b);*/ - } - else - { - BLOCK *b = UdpAccelProcessRecvPacket(a, tmp, ret, &src_ip, src_port); - - //Debug("UDP Recv: %u %u %u\n", ret, (b == NULL ? 0 : b->Size), (b == NULL ? 0 : b->Compressed)); - - /*if (b != NULL) - { - char tmp[MAX_SIZE * 10]; - BinToStr(tmp, sizeof(tmp), b->Buf, b->Size); - Debug("Recv Pkt: %s\n", tmp); - }*/ - - if (b != NULL) - { - // Receive a packet - InsertQueue(a->RecvBlockQueue, b); - } - } - } - else - { - if (ret == 0) - { - if (a->UdpSock->IgnoreRecvErr == false) - { - // Serious UDP reception error occurs - a->FatalError = true; - break; - } - - if ((num_ignore_errors++) >= MAX_NUM_IGNORE_ERRORS) - { - a->FatalError = true; - break; - } - } - else - { - // SOCK_LATER - break; - } - } - } - - // Send a Keep-Alive packet - if (a->NextSendKeepAlive == 0 || (a->NextSendKeepAlive <= a->Now) || a->YourPortByNatTServerChanged) - { - a->YourPortByNatTServerChanged = false; - - if (UdpAccelIsSendReady(a, false)) - { - UINT rand_interval; - - if (a->FastDetect == false) - { - rand_interval = rand() % (UDP_ACCELERATION_KEEPALIVE_INTERVAL_MAX - UDP_ACCELERATION_KEEPALIVE_INTERVAL_MIN) + UDP_ACCELERATION_KEEPALIVE_INTERVAL_MIN; - } - else - { - rand_interval = rand() % (UDP_ACCELERATION_KEEPALIVE_INTERVAL_MAX_FAST - UDP_ACCELERATION_KEEPALIVE_INTERVAL_MIN_FAST) + UDP_ACCELERATION_KEEPALIVE_INTERVAL_MIN_FAST; - } - - a->NextSendKeepAlive = a->Now + (UINT64)rand_interval; - - //Debug("UDP KeepAlive\n"); - - UdpAccelSend(a, NULL, 0, false, 1000, false); - } - } - - // Send a NAT-T request packet (Only if the connection by UDP has not be established yet) - if (a->NoNatT == false) - { - // In the usual case - if (IsZeroIp(&nat_t_ip) == false) - { - if (UdpAccelIsSendReady(a, true) == false) - { - if (a->NextPerformNatTTick == 0 || (a->NextPerformNatTTick <= a->Now)) - { - UINT rand_interval; - UCHAR c = 'B'; - - a->CommToNatT_NumFail++; - - rand_interval = UDP_NAT_T_INTERVAL_INITIAL * MIN(a->CommToNatT_NumFail, UDP_NAT_T_INTERVAL_FAIL_MAX); - //PACK *p = NewPack(); - //BUF *b; - - if (a->MyPortByNatTServer != 0) - { - rand_interval = GenRandInterval(UDP_NAT_T_INTERVAL_MIN, UDP_NAT_T_INTERVAL_MAX); - } - - a->NextPerformNatTTick = a->Now + (UINT64)rand_interval; - - // Generate the request packet - /*PackAddStr(p, "description", UDP_NAT_T_SIGNATURE); - PackAddStr(p, "opcode", "query_for_nat_traversal"); - PackAddInt64(p, "tran_id", a->NatT_TranId); - b = PackToBuf(p); - FreePack(p);*/ - - // Send the request packet - SendTo(a->UdpSock, &nat_t_ip, UDP_NAT_T_PORT, &c, 1); - - //FreeBuf(b); - } - } - else - { - a->NextPerformNatTTick = 0; - a->CommToNatT_NumFail = 0; - } - } - } - else - { - // NAT_T is disabled, but there is a reference host (such as VGC) - if (a->UseUdpIpQuery || a->UseSuperRelayQuery) - { - } - } -} - -// Send a packet block -void UdpAccelSendBlock(UDP_ACCEL *a, BLOCK *b) -{ - // Validate arguments - if (a == NULL || b == NULL) - { - return; - } - - UdpAccelSend(a, b->Buf, b->Size, b->Compressed ? 1 : 0, a->MaxUdpPacketSize, b->PriorityQoS); -} - -// Calculate the best MSS -UINT UdpAccelCalcMss(UDP_ACCEL *a) -{ - UINT ret; - - // Validate arguments - if (a == NULL) - { - return 0; - } - - ret = MTU_FOR_PPPOE; - - // IPv4 - if (a->IsIPv6) - { - ret -= 40; - } - else - { - ret -= 20; - } - - // UDP - ret -= 8; - - if (a->PlainTextMode == false) - { - // IV - ret -= UDP_ACCELERATION_PACKET_IV_SIZE_V1; - } - - // Cookie - ret -= sizeof(UINT); - - // My Tick - ret -= sizeof(UINT64); - - // Your Tick - ret -= sizeof(UINT64); - - // Size - ret -= sizeof(USHORT); - - // Compress Flag - ret -= sizeof(UCHAR); - - if (a->PlainTextMode == false) - { - // Verify - ret -= UDP_ACCELERATION_PACKET_IV_SIZE_V1; - } - - // Ethernet header (communication packets) - ret -= 14; - - // IPv4 Header (communication packets) - ret -= 20; - - // TCP header (communication packet) - ret -= 20; - - return ret; -} - -// Send -void UdpAccelSend(UDP_ACCEL *a, UCHAR *data, UINT data_size, UCHAR flag, UINT max_size, bool high_priority) -{ - UCHAR buffer[UDP_ACCELERATION_TMP_BUF_SIZE]; - UCHAR *buf = buffer; - UINT size = 0; - UINT64 tmp; - UINT ret; - // Validate arguments - if (a == NULL || (data_size != 0 && data == NULL)) - { - return; - } - if (max_size == 0) - { - max_size = INFINITE; - } - - if (a->PlainTextMode == false) - { - if (a->Version > 1) - { - Copy(buf, a->NextIv_V2, UDP_ACCELERATION_PACKET_IV_SIZE_V2); - - buf += UDP_ACCELERATION_PACKET_IV_SIZE_V2; - size += UDP_ACCELERATION_PACKET_IV_SIZE_V2; - } - else - { - Copy(buf, a->NextIv, UDP_ACCELERATION_PACKET_IV_SIZE_V1); - - buf += UDP_ACCELERATION_PACKET_IV_SIZE_V1; - size += UDP_ACCELERATION_PACKET_IV_SIZE_V1; - } - } - - // Cookie - tmp = Endian32(a->YourCookie); - Copy(buf, &tmp, sizeof(UINT)); - buf += sizeof(UINT); - size += sizeof(UINT); - - // My tick - tmp = Endian64(a->Now == 0 ? 1ULL : a->Now); - Copy(buf, &tmp, sizeof(UINT64)); - buf += sizeof(UINT64); - size += sizeof(UINT64); - - // Your tick - tmp = Endian64(a->LastRecvYourTick); - Copy(buf, &tmp, sizeof(UINT64)); - buf += sizeof(UINT64); - size += sizeof(UINT64); - - // Size - tmp = Endian16(data_size); - Copy(buf, &tmp, sizeof(USHORT)); - buf += sizeof(USHORT); - size += sizeof(USHORT); - - // Flag - Copy(buf, &flag, sizeof(UCHAR)); - buf += sizeof(UCHAR); - size += sizeof(UCHAR); - - // Data - Copy(buf, data, data_size); - buf += data_size; - size += data_size; - - if (a->PlainTextMode == false) - { - // Add padding to make protocol identification harder to accomplish - const UINT current_total_size = size + (a->Version > 1 ? UDP_ACCELERATION_PACKET_MAC_SIZE_V2 : UDP_ACCELERATION_PACKET_IV_SIZE_V1); - if (current_total_size < max_size) - { - UCHAR pad[UDP_ACCELERATION_MAX_PADDING_SIZE]; - UINT pad_size = MIN(max_size - current_total_size, UDP_ACCELERATION_MAX_PADDING_SIZE); - pad_size = rand() % pad_size; - Zero(pad, sizeof(pad)); - Copy(buf, pad, pad_size); - buf += pad_size; - size += pad_size; - } - - if (a->Version > 1) - { - const UINT inner_size = size - UDP_ACCELERATION_PACKET_IV_SIZE_V2; - UCHAR *inner = buffer + UDP_ACCELERATION_PACKET_IV_SIZE_V2; - - ret = CipherProcessAead(a->CipherEncrypt, a->NextIv_V2, inner + inner_size, UDP_ACCELERATION_PACKET_MAC_SIZE_V2, inner, inner, inner_size, NULL, 0); - if (ret == 0) - { - Debug("UdpAccelSend(): CipherProcessAead() failed!\n"); - return; - } - - Copy(a->NextIv_V2, inner, UDP_ACCELERATION_PACKET_IV_SIZE_V2); - - // Tag (appended to the buffer by CipherProcessAead()) - size += UDP_ACCELERATION_PACKET_MAC_SIZE_V2; - } - else - { - UCHAR *inner = buffer + UDP_ACCELERATION_PACKET_IV_SIZE_V1; - UCHAR key[UDP_ACCELERATION_PACKET_KEY_SIZE_V1]; - const UINT inner_size = size; // We don't have to subtract because we add below - CRYPT *c; - - // Simple integrity check system: we fill some bytes with zeroes. - // The remote host verifies whether all the zeroes are present. - Zero(buf, UDP_ACCELERATION_PACKET_IV_SIZE_V1); - buf += UDP_ACCELERATION_PACKET_IV_SIZE_V1; - size += UDP_ACCELERATION_PACKET_IV_SIZE_V1; - - UdpAccelCalcKeyV1(key, a->MyKey, a->NextIv); - - c = NewCrypt(key, UDP_ACCELERATION_PACKET_KEY_SIZE_V1); - Encrypt(c, inner, inner, inner_size); - FreeCrypt(c); - - Copy(a->NextIv, buf - UDP_ACCELERATION_PACKET_IV_SIZE_V1, UDP_ACCELERATION_PACKET_IV_SIZE_V1); - } - } - - SetSockHighPriority(a->UdpSock, high_priority); - - ret = SendTo(a->UdpSock, &a->YourIp, a->YourPort, buffer, size); - if (ret == 0 && a->UdpSock->IgnoreSendErr == false) - { - a->FatalError = true; - Debug("UdpAccelSend(): SendTo() failed! IP: %r, port: %u, size: %u\n", &a->YourIp, a->YourPort, size); - return; - } - - if (data_size > 0 || UdpAccelIsSendReady(a, true)) - { - return; - } - - if (a->YourPortByNatTServer != 0 && a->YourPortByNatTServer != a->YourPort) - { - ret = SendTo(a->UdpSock, &a->YourIp, a->YourPortByNatTServer, buffer, size); - if (ret == 0 && a->UdpSock->IgnoreSendErr == false) - { - a->FatalError = true; - Debug("UdpAccelSend(): SendTo() failed! IP: %r, port: %u, size: %u\n", &a->YourIp, a->YourPortByNatTServer, size); - return; - } - } - - if (UdpAccelIsSendReady(a, true)) - { - return; - } - - if (IsZeroIP(&a->YourIp2) == false && CmpIpAddr(&a->YourIp, &a->YourIp2) != 0) - { - // We sent the packet, but the remote host didn't reply. - // It may be behind a NAT, let's try to send the packet to the alternative IP address. - ret = SendTo(a->UdpSock, &a->YourIp2, a->YourPort, buffer, size); - if (ret == 0 && a->UdpSock->IgnoreSendErr == false) - { - a->FatalError = true; - Debug("UdpAccelSend(): SendTo() failed! IP: %r, port: %u, size: %u\n", &a->YourIp2, a->YourPort, size); - return; - } - - if (a->YourPortByNatTServer != 0 && a->YourPortByNatTServer != a->YourPort) - { - ret = SendTo(a->UdpSock, &a->YourIp2, a->YourPortByNatTServer, buffer, size); - if (ret == 0 && a->UdpSock->IgnoreSendErr == false) - { - a->FatalError = true; - Debug("UdpAccelSend(): SendTo() failed! IP: %r, port: %u, size: %u\n", &a->YourIp2, a->YourPortByNatTServer, size); - return; - } - } - } -} - -// Determine whether transmission is possible -bool UdpAccelIsSendReady(UDP_ACCEL *a, bool check_keepalive) -{ - UINT64 timeout_value; - // Validate arguments - if (a == NULL) - { - return false; - } - - if (a->Inited == false) - { - return false; - } - - if (a->YourPort == 0) - { - return false; - } - - if (IsZeroIp(&a->YourIp)) - { - return false; - } - - timeout_value = UDP_ACCELERATION_KEEPALIVE_TIMEOUT; - - if (a->FastDetect) - { - timeout_value = UDP_ACCELERATION_KEEPALIVE_TIMEOUT_FAST; - } - - if (check_keepalive) - { - if (a->LastRecvTick == 0 || ((a->LastRecvTick + timeout_value) < a->Now)) - { - a->FirstStableReceiveTick = 0; - return false; - } - else - { - if ((a->FirstStableReceiveTick + (UINT64)UDP_ACCELERATION_REQUIRE_CONTINUOUS) <= a->Now) - { - return true; - } - else - { - return false; - } - } - } - - return true; -} - -// Process the received packet -BLOCK *UdpAccelProcessRecvPacket(UDP_ACCEL *a, UCHAR *buf, UINT size, IP *src_ip, UINT src_port) -{ - UINT64 my_tick, your_tick; - UINT inner_size; - UCHAR *inner_data = NULL; - bool compress_flag; - UCHAR raw_flag; - BLOCK *b = NULL; - UINT cookie; - // Validate arguments - if (a == NULL || buf == NULL || size == 0 || src_ip == NULL) - { - return NULL; - } - - if (a->PlainTextMode == false) - { - UCHAR *iv = buf; - - if (a->Version > 1) - { - UINT data_size; - - if (size < UDP_ACCELERATION_PACKET_IV_SIZE_V2) - { - return NULL; - } - - buf += UDP_ACCELERATION_PACKET_IV_SIZE_V2; - size -= UDP_ACCELERATION_PACKET_IV_SIZE_V2; - - if (size < UDP_ACCELERATION_PACKET_MAC_SIZE_V2) - { - return NULL; - } - - data_size = size - UDP_ACCELERATION_PACKET_MAC_SIZE_V2; - - if (CipherProcessAead(a->CipherDecrypt, iv, buf + data_size, UDP_ACCELERATION_PACKET_MAC_SIZE_V2, buf, buf, data_size, NULL, 0) == 0) - { - Debug("UdpAccelProcessRecvPacket(): CipherProcessAead() failed!\n"); - return NULL; - } - - size -= UDP_ACCELERATION_PACKET_MAC_SIZE_V2; - } - else - { - UCHAR key[UDP_ACCELERATION_PACKET_KEY_SIZE_V1]; - CRYPT *c; - - if (size < UDP_ACCELERATION_PACKET_IV_SIZE_V1) - { - return NULL; - } - - buf += UDP_ACCELERATION_PACKET_IV_SIZE_V1; - size -= UDP_ACCELERATION_PACKET_IV_SIZE_V1; - - UdpAccelCalcKeyV1(key, a->YourKey, iv); - - c = NewCrypt(key, UDP_ACCELERATION_PACKET_KEY_SIZE_V1); - Encrypt(c, buf, buf, size); - FreeCrypt(c); - } - } - - // Cookie - if (size < sizeof(UINT)) - { - return NULL; - } - cookie = READ_UINT(buf); - buf += sizeof(UINT); - size -= sizeof(UINT); - - if (cookie != a->MyCookie) - { - return NULL; - } - - // My tick - if (size < sizeof(UINT64)) - { - return NULL; - } - my_tick = READ_UINT64(buf); - buf += sizeof(UINT64); - size -= sizeof(UINT64); - - // Your tick - if (size < sizeof(UINT64)) - { - return NULL; - } - your_tick = READ_UINT64(buf); - buf += sizeof(UINT64); - size -= sizeof(UINT64); - - // Inner data size - if (size < sizeof(USHORT)) - { - return NULL; - } - inner_size = READ_USHORT(buf); - buf += sizeof(USHORT); - size -= sizeof(USHORT); - - // Flag - if (size < sizeof(UCHAR)) - { - return NULL; - } - if (a->ReadRawFlagMode == false) - { - compress_flag = *((UCHAR *)buf); - } - else - { - raw_flag = *((UCHAR *)buf); - } - - buf += sizeof(UCHAR); - size -= sizeof(UCHAR); - - if (size < inner_size) - { - return NULL; - } - - // Inner_data - if (inner_size >= 1) - { - inner_data = buf; - buf += inner_size; - size -= inner_size; - } - - if (a->PlainTextMode == false) - { - // Verify packet integrity - if (a->Version == 1) - { - UINT pad_size; - - if (size < UDP_ACCELERATION_PACKET_IV_SIZE_V1) - { - return false; - } - - pad_size = size - UDP_ACCELERATION_PACKET_IV_SIZE_V1; - buf += pad_size; - size -= pad_size; - - if (size != UDP_ACCELERATION_PACKET_IV_SIZE_V1) - { - return NULL; - } - - if (IsZero(buf, UDP_ACCELERATION_PACKET_IV_SIZE_V1) == false) - { - return NULL; - } - } - } - - if (my_tick < a->LastRecvYourTick) - { - if ((a->LastRecvYourTick - my_tick) >= ((UINT64)UDP_ACCELERATION_WINDOW_SIZE_MSEC)) - { - return NULL; - } - } - - a->LastRecvMyTick = MAX(a->LastRecvMyTick, your_tick); - a->LastRecvYourTick = MAX(a->LastRecvYourTick, my_tick); - - if (inner_size >= 1) - { - b = NewBlock(Clone(inner_data, inner_size), inner_size, a->ReadRawFlagMode == false ? (compress_flag ? -1 : 0) : 0); - if (a->ReadRawFlagMode) - { - b->RawFlagRetUdpAccel = raw_flag; - } - } - - if (a->LastSetSrcIpAndPortTick < a->LastRecvYourTick) - { - a->LastSetSrcIpAndPortTick = a->LastRecvYourTick; - - Copy(&a->YourIp, src_ip, sizeof(IP)); - a->YourPort = src_port; - } - - if (a->LastRecvMyTick != 0) - { - if ((a->LastRecvMyTick + (UINT64)(UDP_ACCELERATION_WINDOW_SIZE_MSEC)) >= a->Now) - { - a->LastRecvTick = a->Now; - - a->IsReachedOnce = true; - - if (a->FirstStableReceiveTick == 0) - { - a->FirstStableReceiveTick = a->Now; - } - } - } - - return b; -} - -// Calculate V1 key -void UdpAccelCalcKeyV1(UCHAR *key, UCHAR *common_key, UCHAR *iv) -{ - UCHAR tmp[UDP_ACCELERATION_COMMON_KEY_SIZE_V1 + UDP_ACCELERATION_PACKET_IV_SIZE_V1]; - // Validate arguments - if (key == NULL || common_key == NULL || iv == NULL) - { - return; - } - - Copy(tmp, common_key, UDP_ACCELERATION_COMMON_KEY_SIZE_V1); - Copy(tmp + UDP_ACCELERATION_COMMON_KEY_SIZE_V1, iv, UDP_ACCELERATION_PACKET_IV_SIZE_V1); - - Sha1(key, tmp, sizeof(tmp)); -} - -// Set the current time -void UdpAccelSetTick(UDP_ACCEL *a, UINT64 tick64) -{ - // Validate arguments - if (a == NULL) - { - return; - } - - a->Now = tick64; -} - -// Initialize the server-side -bool UdpAccelInitServer(UDP_ACCEL *a, UCHAR *client_key, IP *client_ip, UINT client_port, IP *client_ip_2) -{ - char tmp[MAX_SIZE]; - // Validate arguments - if (a == NULL || client_key == NULL) - { - return false; - } - - IPToStr(tmp, sizeof(tmp), client_ip); - Debug("UdpAccelInitServer(): version: %u, client IP: %s, client port: %u, server cookie: %u, client cookie: %u\n", a->Version, tmp, client_port, a->MyCookie, a->YourCookie); - - if (IsIP6(client_ip) != a->IsIPv6) - { - return false; - } - - if (a->Version > 1) - { - a->CipherEncrypt = NewCipher("ChaCha20-Poly1305"); - a->CipherDecrypt = NewCipher("ChaCha20-Poly1305"); - - SetCipherKey(a->CipherEncrypt, a->MyKey_V2, true); - SetCipherKey(a->CipherDecrypt, client_key, false); - } - else - { - Copy(a->YourKey, client_key, sizeof(a->YourKey)); - } - - Copy(&a->YourIp, client_ip, sizeof(IP)); - Copy(&a->YourIp2, client_ip_2, sizeof(IP)); - a->YourPort = client_port; - - a->Now = Tick64(); - - a->Inited = true; - - return true; -} - -// Initialize the client-side -bool UdpAccelInitClient(UDP_ACCEL *a, UCHAR *server_key, IP *server_ip, UINT server_port, UINT server_cookie, UINT client_cookie, IP *server_ip_2) -{ - char tmp[MAX_SIZE]; - // Validate arguments - if (a == NULL || server_key == NULL || server_ip == NULL || server_port == 0) - { - return false; - } - - IPToStr(tmp, sizeof(tmp), server_ip); - Debug("UdpAccelInitClient(): version: %u, client IP: %s, client port: %u, server cookie: %u, client cookie: %u\n", a->Version, tmp, server_port, server_cookie, client_cookie); - - if (IsIP6(server_ip) != a->IsIPv6) - { - return false; - } - - if (a->Version > 1) - { - a->CipherEncrypt = NewCipher("ChaCha20-Poly1305"); - a->CipherDecrypt = NewCipher("ChaCha20-Poly1305"); - - SetCipherKey(a->CipherEncrypt, a->MyKey_V2, true); - SetCipherKey(a->CipherDecrypt, server_key, false); - } - else - { - Copy(a->YourKey, server_key, sizeof(a->YourKey)); - } - - Copy(&a->YourIp, server_ip, sizeof(IP)); - Copy(&a->YourIp2, server_ip_2, sizeof(IP)); - a->YourPort = server_port; - - a->Now = Tick64(); - - a->MyCookie = client_cookie; - a->YourCookie = server_cookie; - - a->Inited = true; - - return true; -} - -// Create a new UDP acceleration function -UDP_ACCEL *NewUdpAccel(CEDAR *cedar, IP *ip, bool client_mode, bool random_port, bool no_nat_t) -{ - UDP_ACCEL *a; - SOCK *s; - UINT max_udp_size; - bool is_in_cedar_port_list = false; - - if (IsZeroIP(ip)) - { - ip = NULL; - } - - if (client_mode || random_port) - { - // Use a appropriate vacant port number in the case of using random port or client mode - s = NewUDPEx3(0, ip); - } - else - { - // Specify in the range in the case of server mode - UINT i; - s = NULL; - - LockList(cedar->UdpPortList); - { - for (i = UDP_SERVER_PORT_LOWER;i <= UDP_SERVER_PORT_HIGHER;i++) - { - if (IsIntInList(cedar->UdpPortList, i) == false) - { - s = NewUDPEx3(i, ip); - - if (s != NULL) - { - is_in_cedar_port_list = true; - break; - } - } - } - - if (s == NULL) - { - // Leave the port selection to the OS because the available port is not found within the range - s = NewUDPEx3(0, ip); - } - - if (s != NULL && is_in_cedar_port_list) - { - AddIntDistinct(cedar->UdpPortList, i); - } - } - UnlockList(cedar->UdpPortList); - } - - if (s == NULL) - { - return NULL; - } - - a = ZeroMalloc(sizeof(UDP_ACCEL)); - - a->Cedar = cedar; - AddRef(a->Cedar->ref); - - a->NoNatT = no_nat_t; - - a->Version = 1; - - a->NatT_TranId = Rand64(); - - a->CreatedTick = Tick64(); - - a->IsInCedarPortList = is_in_cedar_port_list; - - a->ClientMode = client_mode; - - a->Now = Tick64(); - a->UdpSock = s; - - Rand(a->MyKey, sizeof(a->MyKey)); - Rand(a->MyKey_V2, sizeof(a->MyKey_V2)); - - Copy(&a->MyIp, ip, sizeof(IP)); - a->MyPort = s->LocalPort; - - a->IsIPv6 = IsIP6(ip); - - if (a->IsIPv6) - { - a->NoNatT = true; - } - - a->RecvBlockQueue = NewQueue(); - - Rand(a->NextIv, sizeof(a->NextIv)); - Rand(a->NextIv_V2, sizeof(a->NextIv_V2)); - - do - { - a->MyCookie = Rand32(); - } - while (a->MyCookie == 0); - - do - { - a->YourCookie = Rand32(); - } - while (a->MyCookie == 0 || a->MyCookie == a->YourCookie); - - // Calculate the maximum transmittable UDP packet size - max_udp_size = MTU_FOR_PPPOE; - - if (a->IsIPv6 == false) - { - // IPv4 - max_udp_size -= 20; - } - else - { - // IPv6 - max_udp_size -= 40; - } - - // UDP - max_udp_size -= 8; - - a->MaxUdpPacketSize = max_udp_size; - - Debug("Udp Accel My Port = %u\n", a->MyPort); - - // Initialize the NAT-T server IP address acquisition thread - a->NatT_Lock = NewLock(); - a->NatT_HaltEvent = NewEvent(); - - if (a->NoNatT == false) - { - a->NatT_GetIpThread = NewThread(NatT_GetIpThread, a); - } - - return a; -} - -// NAT-T server IP address acquisition thread -void NatT_GetIpThread(THREAD *thread, void *param) -{ - UDP_ACCEL *a; - char hostname[MAX_SIZE]; - static IP dummy_ip = {0}; - UINT num_retry = 0; - // Validate arguments - if (thread == NULL || param == NULL) - { - return; - } - - a = (UDP_ACCEL *)param; - - if (IsZeroIP(&dummy_ip)) - { - SetIP(&dummy_ip, 11, Rand8(), Rand8(), Rand8()); - } - - RUDPGetRegisterHostNameByIP(hostname, sizeof(hostname), &dummy_ip); - - while (a->NatT_Halt == false) - { - IP ip; - UINT wait_time = UDP_NAT_T_GET_IP_INTERVAL; - - // Get the IP address - bool ret = GetIP4Ex(&ip, hostname, 0, &a->NatT_Halt); - - if (ret && (IsZeroIp(&ip) == false)) - { - char tmp[128]; - - // Success to get - Lock(a->NatT_Lock); - { - Copy(&a->NatT_IP, &ip, sizeof(IP)); - } - Unlock(a->NatT_Lock); - - IPToStr(tmp, sizeof(tmp), &ip); - Debug("NAT-T IP Address Resolved: %s = %s\n", hostname, tmp); - - a->NatT_IP_Changed = true; - - break; - } - - // Fail to get - num_retry++; - - wait_time = (UINT)(MIN((UINT64)UDP_NAT_T_GET_IP_INTERVAL * (UINT64)num_retry, (UINT64)UDP_NAT_T_GET_IP_INTERVAL_MAX)); - - Wait(a->NatT_HaltEvent, wait_time); - } -} - -// Release the UDP acceleration function -void FreeUdpAccel(UDP_ACCEL *a) -{ - // Validate arguments - if (a == NULL) - { - return; - } - - while (true) - { - BLOCK *b = GetNext(a->RecvBlockQueue); - - if (b == NULL) - { - break; - } - - FreeBlock(b); - } - - ReleaseQueue(a->RecvBlockQueue); - - ReleaseSock(a->UdpSock); - - if (a->IsInCedarPortList) - { - LockList(a->Cedar->UdpPortList); - { - DelInt(a->Cedar->UdpPortList, a->MyPort); - } - UnlockList(a->Cedar->UdpPortList); - } - - // Release of NAT-T related - a->NatT_Halt = true; - Set(a->NatT_HaltEvent); - - if (a->NatT_GetIpThread != NULL) - { - WaitThread(a->NatT_GetIpThread, INFINITE); - ReleaseThread(a->NatT_GetIpThread); - } - - ReleaseEvent(a->NatT_HaltEvent); - DeleteLock(a->NatT_Lock); - - ReleaseCedar(a->Cedar); - - FreeCipher(a->CipherEncrypt); - FreeCipher(a->CipherDecrypt); - - Free(a); -} +// SoftEther VPN Source Code - Developer Edition Master Branch +// Cedar Communication Module + + +// UdpAccel.c +// UDP acceleration function + +#include "CedarPch.h" + +// Polling process +void UdpAccelPoll(UDP_ACCEL *a) +{ + IP nat_t_ip; + UINT num_ignore_errors = 0; + UCHAR *tmp; + // Validate arguments + if (a == NULL) + { + return; + } + + tmp = a->TmpBuf; + + Lock(a->NatT_Lock); + { + Copy(&nat_t_ip, &a->NatT_IP, sizeof(IP)); + } + Unlock(a->NatT_Lock); + + if (IsZeroIp(&nat_t_ip) == false) + { + // Release the thread which gets the IP address of the NAT-T server because it is no longer needed + if (a->NatT_GetIpThread != NULL) + { + WaitThread(a->NatT_GetIpThread, INFINITE); + ReleaseThread(a->NatT_GetIpThread); + a->NatT_GetIpThread = NULL; + } + } + + // Receive a new UDP packet + while (true) + { + IP src_ip; + UINT src_port; + UINT ret; + + ret = RecvFrom(a->UdpSock, &src_ip, &src_port, tmp, UDP_ACCELERATION_TMP_BUF_SIZE); + + if (ret != 0 && ret != SOCK_LATER) + { + if (a->UseUdpIpQuery && a->UdpIpQueryPacketSize >= 8 && CmpIpAddr(&a->UdpIpQueryHost, &src_ip) == 0 && + src_port == a->UdpIpQueryPort) + { + // Receive a response of the query for IP and port number + IP my_ip = {0}; + UINT myport = 0; + BUF *b = MemToBuf(a->UdpIpQueryPacketData, a->UdpIpQueryPacketSize); + + + FreeBuf(b); + } + else if (IsZeroIp(&nat_t_ip) == false && CmpIpAddr(&nat_t_ip, &src_ip) == 0 && + src_port == UDP_NAT_T_PORT) + { + // Receive a response from the NAT-T server + IP my_ip; + UINT myport; + + if (RUDPParseIPAndPortStr(tmp, ret, &my_ip, &myport)) + { + if (myport >= 1 && myport <= 65535) + { + if (a->MyPortByNatTServer != myport) + { + a->MyPortByNatTServer = myport; + a->MyPortByNatTServerChanged = true; + a->CommToNatT_NumFail = 0; + + Debug("NAT-T: MyPort = %u\n", myport); + } + } + } +/* + BUF *b = NewBuf(); + PACK *p; + + WriteBuf(b, tmp, ret); + SeekBufToBegin(b); + + p = BufToPack(b); + if (p != NULL) + { + if (PackCmpStr(p, "opcode", "query_for_nat_traversal")) + { + if (PackGetBool(p, "ok")) + { + if (PackGetInt64(p, "tran_id") == a->NatT_TranId) + { + UINT myport = PackGetInt(p, "your_port"); + + if (myport >= 1 && myport <= 65535) + { + if (a->MyPortByNatTServer != myport) + { + a->MyPortByNatTServer = myport; + a->MyPortByNatTServerChanged = true; + + Debug("NAT-T: MyPort = %u\n", myport); + } + } + } + } + } + + FreePack(p); + } + + FreeBuf(b);*/ + } + else + { + BLOCK *b = UdpAccelProcessRecvPacket(a, tmp, ret, &src_ip, src_port); + + //Debug("UDP Recv: %u %u %u\n", ret, (b == NULL ? 0 : b->Size), (b == NULL ? 0 : b->Compressed)); + + /*if (b != NULL) + { + char tmp[MAX_SIZE * 10]; + BinToStr(tmp, sizeof(tmp), b->Buf, b->Size); + Debug("Recv Pkt: %s\n", tmp); + }*/ + + if (b != NULL) + { + // Receive a packet + InsertQueue(a->RecvBlockQueue, b); + } + } + } + else + { + if (ret == 0) + { + if (a->UdpSock->IgnoreRecvErr == false) + { + // Serious UDP reception error occurs + a->FatalError = true; + break; + } + + if ((num_ignore_errors++) >= MAX_NUM_IGNORE_ERRORS) + { + a->FatalError = true; + break; + } + } + else + { + // SOCK_LATER + break; + } + } + } + + // Send a Keep-Alive packet + if (a->NextSendKeepAlive == 0 || (a->NextSendKeepAlive <= a->Now) || a->YourPortByNatTServerChanged) + { + a->YourPortByNatTServerChanged = false; + + if (UdpAccelIsSendReady(a, false)) + { + UINT rand_interval; + + if (a->FastDetect == false) + { + rand_interval = rand() % (UDP_ACCELERATION_KEEPALIVE_INTERVAL_MAX - UDP_ACCELERATION_KEEPALIVE_INTERVAL_MIN) + UDP_ACCELERATION_KEEPALIVE_INTERVAL_MIN; + } + else + { + rand_interval = rand() % (UDP_ACCELERATION_KEEPALIVE_INTERVAL_MAX_FAST - UDP_ACCELERATION_KEEPALIVE_INTERVAL_MIN_FAST) + UDP_ACCELERATION_KEEPALIVE_INTERVAL_MIN_FAST; + } + + a->NextSendKeepAlive = a->Now + (UINT64)rand_interval; + + //Debug("UDP KeepAlive\n"); + + UdpAccelSend(a, NULL, 0, false, 1000, false); + } + } + + // Send a NAT-T request packet (Only if the connection by UDP has not be established yet) + if (a->NoNatT == false) + { + // In the usual case + if (IsZeroIp(&nat_t_ip) == false) + { + if (UdpAccelIsSendReady(a, true) == false) + { + if (a->NextPerformNatTTick == 0 || (a->NextPerformNatTTick <= a->Now)) + { + UINT rand_interval; + UCHAR c = 'B'; + + a->CommToNatT_NumFail++; + + rand_interval = UDP_NAT_T_INTERVAL_INITIAL * MIN(a->CommToNatT_NumFail, UDP_NAT_T_INTERVAL_FAIL_MAX); + //PACK *p = NewPack(); + //BUF *b; + + if (a->MyPortByNatTServer != 0) + { + rand_interval = GenRandInterval(UDP_NAT_T_INTERVAL_MIN, UDP_NAT_T_INTERVAL_MAX); + } + + a->NextPerformNatTTick = a->Now + (UINT64)rand_interval; + + // Generate the request packet + /*PackAddStr(p, "description", UDP_NAT_T_SIGNATURE); + PackAddStr(p, "opcode", "query_for_nat_traversal"); + PackAddInt64(p, "tran_id", a->NatT_TranId); + b = PackToBuf(p); + FreePack(p);*/ + + // Send the request packet + SendTo(a->UdpSock, &nat_t_ip, UDP_NAT_T_PORT, &c, 1); + + //FreeBuf(b); + } + } + else + { + a->NextPerformNatTTick = 0; + a->CommToNatT_NumFail = 0; + } + } + } + else + { + // NAT_T is disabled, but there is a reference host (such as VGC) + if (a->UseUdpIpQuery || a->UseSuperRelayQuery) + { + } + } +} + +// Send a packet block +void UdpAccelSendBlock(UDP_ACCEL *a, BLOCK *b) +{ + // Validate arguments + if (a == NULL || b == NULL) + { + return; + } + + UdpAccelSend(a, b->Buf, b->Size, b->Compressed ? 1 : 0, a->MaxUdpPacketSize, b->PriorityQoS); +} + +// Calculate the best MSS +UINT UdpAccelCalcMss(UDP_ACCEL *a) +{ + UINT ret; + + // Validate arguments + if (a == NULL) + { + return 0; + } + + ret = MTU_FOR_PPPOE; + + // IPv4 + if (a->IsIPv6) + { + ret -= 40; + } + else + { + ret -= 20; + } + + // UDP + ret -= 8; + + if (a->PlainTextMode == false) + { + // IV + ret -= UDP_ACCELERATION_PACKET_IV_SIZE_V1; + } + + // Cookie + ret -= sizeof(UINT); + + // My Tick + ret -= sizeof(UINT64); + + // Your Tick + ret -= sizeof(UINT64); + + // Size + ret -= sizeof(USHORT); + + // Compress Flag + ret -= sizeof(UCHAR); + + if (a->PlainTextMode == false) + { + // Verify + ret -= UDP_ACCELERATION_PACKET_IV_SIZE_V1; + } + + // Ethernet header (communication packets) + ret -= 14; + + // IPv4 Header (communication packets) + ret -= 20; + + // TCP header (communication packet) + ret -= 20; + + return ret; +} + +// Send +void UdpAccelSend(UDP_ACCEL *a, UCHAR *data, UINT data_size, UCHAR flag, UINT max_size, bool high_priority) +{ + UCHAR buffer[UDP_ACCELERATION_TMP_BUF_SIZE]; + UCHAR *buf = buffer; + UINT size = 0; + UINT64 tmp; + UINT ret; + // Validate arguments + if (a == NULL || (data_size != 0 && data == NULL)) + { + return; + } + if (max_size == 0) + { + max_size = INFINITE; + } + + if (a->PlainTextMode == false) + { + if (a->Version > 1) + { + Copy(buf, a->NextIv_V2, UDP_ACCELERATION_PACKET_IV_SIZE_V2); + + buf += UDP_ACCELERATION_PACKET_IV_SIZE_V2; + size += UDP_ACCELERATION_PACKET_IV_SIZE_V2; + } + else + { + Copy(buf, a->NextIv, UDP_ACCELERATION_PACKET_IV_SIZE_V1); + + buf += UDP_ACCELERATION_PACKET_IV_SIZE_V1; + size += UDP_ACCELERATION_PACKET_IV_SIZE_V1; + } + } + + // Cookie + tmp = Endian32(a->YourCookie); + Copy(buf, &tmp, sizeof(UINT)); + buf += sizeof(UINT); + size += sizeof(UINT); + + // My tick + tmp = Endian64(a->Now == 0 ? 1ULL : a->Now); + Copy(buf, &tmp, sizeof(UINT64)); + buf += sizeof(UINT64); + size += sizeof(UINT64); + + // Your tick + tmp = Endian64(a->LastRecvYourTick); + Copy(buf, &tmp, sizeof(UINT64)); + buf += sizeof(UINT64); + size += sizeof(UINT64); + + // Size + tmp = Endian16(data_size); + Copy(buf, &tmp, sizeof(USHORT)); + buf += sizeof(USHORT); + size += sizeof(USHORT); + + // Flag + Copy(buf, &flag, sizeof(UCHAR)); + buf += sizeof(UCHAR); + size += sizeof(UCHAR); + + // Data + Copy(buf, data, data_size); + buf += data_size; + size += data_size; + + if (a->PlainTextMode == false) + { + // Add padding to make protocol identification harder to accomplish + const UINT current_total_size = size + (a->Version > 1 ? UDP_ACCELERATION_PACKET_MAC_SIZE_V2 : UDP_ACCELERATION_PACKET_IV_SIZE_V1); + if (current_total_size < max_size) + { + UCHAR pad[UDP_ACCELERATION_MAX_PADDING_SIZE]; + UINT pad_size = MIN(max_size - current_total_size, UDP_ACCELERATION_MAX_PADDING_SIZE); + pad_size = rand() % pad_size; + Zero(pad, sizeof(pad)); + Copy(buf, pad, pad_size); + buf += pad_size; + size += pad_size; + } + + if (a->Version > 1) + { + const UINT inner_size = size - UDP_ACCELERATION_PACKET_IV_SIZE_V2; + UCHAR *inner = buffer + UDP_ACCELERATION_PACKET_IV_SIZE_V2; + + ret = CipherProcessAead(a->CipherEncrypt, a->NextIv_V2, inner + inner_size, UDP_ACCELERATION_PACKET_MAC_SIZE_V2, inner, inner, inner_size, NULL, 0); + if (ret == 0) + { + Debug("UdpAccelSend(): CipherProcessAead() failed!\n"); + return; + } + + Copy(a->NextIv_V2, inner, UDP_ACCELERATION_PACKET_IV_SIZE_V2); + + // Tag (appended to the buffer by CipherProcessAead()) + size += UDP_ACCELERATION_PACKET_MAC_SIZE_V2; + } + else + { + UCHAR *inner = buffer + UDP_ACCELERATION_PACKET_IV_SIZE_V1; + UCHAR key[UDP_ACCELERATION_PACKET_KEY_SIZE_V1]; + const UINT inner_size = size; // We don't have to subtract because we add below + CRYPT *c; + + // Simple integrity check system: we fill some bytes with zeroes. + // The remote host verifies whether all the zeroes are present. + Zero(buf, UDP_ACCELERATION_PACKET_IV_SIZE_V1); + buf += UDP_ACCELERATION_PACKET_IV_SIZE_V1; + size += UDP_ACCELERATION_PACKET_IV_SIZE_V1; + + UdpAccelCalcKeyV1(key, a->MyKey, a->NextIv); + + c = NewCrypt(key, UDP_ACCELERATION_PACKET_KEY_SIZE_V1); + Encrypt(c, inner, inner, inner_size); + FreeCrypt(c); + + Copy(a->NextIv, buf - UDP_ACCELERATION_PACKET_IV_SIZE_V1, UDP_ACCELERATION_PACKET_IV_SIZE_V1); + } + } + + SetSockHighPriority(a->UdpSock, high_priority); + + ret = SendTo(a->UdpSock, &a->YourIp, a->YourPort, buffer, size); + if (ret == 0 && a->UdpSock->IgnoreSendErr == false) + { + a->FatalError = true; + Debug("UdpAccelSend(): SendTo() failed! IP: %r, port: %u, size: %u\n", &a->YourIp, a->YourPort, size); + return; + } + + if (data_size > 0 || UdpAccelIsSendReady(a, true)) + { + return; + } + + if (a->YourPortByNatTServer != 0 && a->YourPortByNatTServer != a->YourPort) + { + ret = SendTo(a->UdpSock, &a->YourIp, a->YourPortByNatTServer, buffer, size); + if (ret == 0 && a->UdpSock->IgnoreSendErr == false) + { + a->FatalError = true; + Debug("UdpAccelSend(): SendTo() failed! IP: %r, port: %u, size: %u\n", &a->YourIp, a->YourPortByNatTServer, size); + return; + } + } + + if (UdpAccelIsSendReady(a, true)) + { + return; + } + + if (IsZeroIP(&a->YourIp2) == false && CmpIpAddr(&a->YourIp, &a->YourIp2) != 0) + { + // We sent the packet, but the remote host didn't reply. + // It may be behind a NAT, let's try to send the packet to the alternative IP address. + ret = SendTo(a->UdpSock, &a->YourIp2, a->YourPort, buffer, size); + if (ret == 0 && a->UdpSock->IgnoreSendErr == false) + { + a->FatalError = true; + Debug("UdpAccelSend(): SendTo() failed! IP: %r, port: %u, size: %u\n", &a->YourIp2, a->YourPort, size); + return; + } + + if (a->YourPortByNatTServer != 0 && a->YourPortByNatTServer != a->YourPort) + { + ret = SendTo(a->UdpSock, &a->YourIp2, a->YourPortByNatTServer, buffer, size); + if (ret == 0 && a->UdpSock->IgnoreSendErr == false) + { + a->FatalError = true; + Debug("UdpAccelSend(): SendTo() failed! IP: %r, port: %u, size: %u\n", &a->YourIp2, a->YourPortByNatTServer, size); + return; + } + } + } +} + +// Determine whether transmission is possible +bool UdpAccelIsSendReady(UDP_ACCEL *a, bool check_keepalive) +{ + UINT64 timeout_value; + // Validate arguments + if (a == NULL) + { + return false; + } + + if (a->Inited == false) + { + return false; + } + + if (a->YourPort == 0) + { + return false; + } + + if (IsZeroIp(&a->YourIp)) + { + return false; + } + + timeout_value = UDP_ACCELERATION_KEEPALIVE_TIMEOUT; + + if (a->FastDetect) + { + timeout_value = UDP_ACCELERATION_KEEPALIVE_TIMEOUT_FAST; + } + + if (check_keepalive) + { + if (a->LastRecvTick == 0 || ((a->LastRecvTick + timeout_value) < a->Now)) + { + a->FirstStableReceiveTick = 0; + return false; + } + else + { + if ((a->FirstStableReceiveTick + (UINT64)UDP_ACCELERATION_REQUIRE_CONTINUOUS) <= a->Now) + { + return true; + } + else + { + return false; + } + } + } + + return true; +} + +// Process the received packet +BLOCK *UdpAccelProcessRecvPacket(UDP_ACCEL *a, UCHAR *buf, UINT size, IP *src_ip, UINT src_port) +{ + UINT64 my_tick, your_tick; + UINT inner_size; + UCHAR *inner_data = NULL; + bool compress_flag; + UCHAR raw_flag; + BLOCK *b = NULL; + UINT cookie; + // Validate arguments + if (a == NULL || buf == NULL || size == 0 || src_ip == NULL) + { + return NULL; + } + + if (a->PlainTextMode == false) + { + UCHAR *iv = buf; + + if (a->Version > 1) + { + UINT data_size; + + if (size < UDP_ACCELERATION_PACKET_IV_SIZE_V2) + { + return NULL; + } + + buf += UDP_ACCELERATION_PACKET_IV_SIZE_V2; + size -= UDP_ACCELERATION_PACKET_IV_SIZE_V2; + + if (size < UDP_ACCELERATION_PACKET_MAC_SIZE_V2) + { + return NULL; + } + + data_size = size - UDP_ACCELERATION_PACKET_MAC_SIZE_V2; + + if (CipherProcessAead(a->CipherDecrypt, iv, buf + data_size, UDP_ACCELERATION_PACKET_MAC_SIZE_V2, buf, buf, data_size, NULL, 0) == 0) + { + Debug("UdpAccelProcessRecvPacket(): CipherProcessAead() failed!\n"); + return NULL; + } + + size -= UDP_ACCELERATION_PACKET_MAC_SIZE_V2; + } + else + { + UCHAR key[UDP_ACCELERATION_PACKET_KEY_SIZE_V1]; + CRYPT *c; + + if (size < UDP_ACCELERATION_PACKET_IV_SIZE_V1) + { + return NULL; + } + + buf += UDP_ACCELERATION_PACKET_IV_SIZE_V1; + size -= UDP_ACCELERATION_PACKET_IV_SIZE_V1; + + UdpAccelCalcKeyV1(key, a->YourKey, iv); + + c = NewCrypt(key, UDP_ACCELERATION_PACKET_KEY_SIZE_V1); + Encrypt(c, buf, buf, size); + FreeCrypt(c); + } + } + + // Cookie + if (size < sizeof(UINT)) + { + return NULL; + } + cookie = READ_UINT(buf); + buf += sizeof(UINT); + size -= sizeof(UINT); + + if (cookie != a->MyCookie) + { + return NULL; + } + + // My tick + if (size < sizeof(UINT64)) + { + return NULL; + } + my_tick = READ_UINT64(buf); + buf += sizeof(UINT64); + size -= sizeof(UINT64); + + // Your tick + if (size < sizeof(UINT64)) + { + return NULL; + } + your_tick = READ_UINT64(buf); + buf += sizeof(UINT64); + size -= sizeof(UINT64); + + // Inner data size + if (size < sizeof(USHORT)) + { + return NULL; + } + inner_size = READ_USHORT(buf); + buf += sizeof(USHORT); + size -= sizeof(USHORT); + + // Flag + if (size < sizeof(UCHAR)) + { + return NULL; + } + if (a->ReadRawFlagMode == false) + { + compress_flag = *((UCHAR *)buf); + } + else + { + raw_flag = *((UCHAR *)buf); + } + + buf += sizeof(UCHAR); + size -= sizeof(UCHAR); + + if (size < inner_size) + { + return NULL; + } + + // Inner_data + if (inner_size >= 1) + { + inner_data = buf; + buf += inner_size; + size -= inner_size; + } + + if (a->PlainTextMode == false) + { + // Verify packet integrity + if (a->Version == 1) + { + UINT pad_size; + + if (size < UDP_ACCELERATION_PACKET_IV_SIZE_V1) + { + return false; + } + + pad_size = size - UDP_ACCELERATION_PACKET_IV_SIZE_V1; + buf += pad_size; + size -= pad_size; + + if (size != UDP_ACCELERATION_PACKET_IV_SIZE_V1) + { + return NULL; + } + + if (IsZero(buf, UDP_ACCELERATION_PACKET_IV_SIZE_V1) == false) + { + return NULL; + } + } + } + + if (my_tick < a->LastRecvYourTick) + { + if ((a->LastRecvYourTick - my_tick) >= ((UINT64)UDP_ACCELERATION_WINDOW_SIZE_MSEC)) + { + return NULL; + } + } + + a->LastRecvMyTick = MAX(a->LastRecvMyTick, your_tick); + a->LastRecvYourTick = MAX(a->LastRecvYourTick, my_tick); + + if (inner_size >= 1) + { + b = NewBlock(Clone(inner_data, inner_size), inner_size, a->ReadRawFlagMode == false ? (compress_flag ? -1 : 0) : 0); + if (a->ReadRawFlagMode) + { + b->RawFlagRetUdpAccel = raw_flag; + } + } + + if (a->LastSetSrcIpAndPortTick < a->LastRecvYourTick) + { + a->LastSetSrcIpAndPortTick = a->LastRecvYourTick; + + Copy(&a->YourIp, src_ip, sizeof(IP)); + a->YourPort = src_port; + } + + if (a->LastRecvMyTick != 0) + { + if ((a->LastRecvMyTick + (UINT64)(UDP_ACCELERATION_WINDOW_SIZE_MSEC)) >= a->Now) + { + a->LastRecvTick = a->Now; + + a->IsReachedOnce = true; + + if (a->FirstStableReceiveTick == 0) + { + a->FirstStableReceiveTick = a->Now; + } + } + } + + return b; +} + +// Calculate V1 key +void UdpAccelCalcKeyV1(UCHAR *key, UCHAR *common_key, UCHAR *iv) +{ + UCHAR tmp[UDP_ACCELERATION_COMMON_KEY_SIZE_V1 + UDP_ACCELERATION_PACKET_IV_SIZE_V1]; + // Validate arguments + if (key == NULL || common_key == NULL || iv == NULL) + { + return; + } + + Copy(tmp, common_key, UDP_ACCELERATION_COMMON_KEY_SIZE_V1); + Copy(tmp + UDP_ACCELERATION_COMMON_KEY_SIZE_V1, iv, UDP_ACCELERATION_PACKET_IV_SIZE_V1); + + Sha1(key, tmp, sizeof(tmp)); +} + +// Set the current time +void UdpAccelSetTick(UDP_ACCEL *a, UINT64 tick64) +{ + // Validate arguments + if (a == NULL) + { + return; + } + + a->Now = tick64; +} + +// Initialize the server-side +bool UdpAccelInitServer(UDP_ACCEL *a, UCHAR *client_key, IP *client_ip, UINT client_port, IP *client_ip_2) +{ + char tmp[MAX_SIZE]; + // Validate arguments + if (a == NULL || client_key == NULL) + { + return false; + } + + IPToStr(tmp, sizeof(tmp), client_ip); + Debug("UdpAccelInitServer(): version: %u, client IP: %s, client port: %u, server cookie: %u, client cookie: %u\n", a->Version, tmp, client_port, a->MyCookie, a->YourCookie); + + if (IsIP6(client_ip) != a->IsIPv6) + { + return false; + } + + if (a->Version > 1) + { + a->CipherEncrypt = NewCipher("ChaCha20-Poly1305"); + a->CipherDecrypt = NewCipher("ChaCha20-Poly1305"); + + SetCipherKey(a->CipherEncrypt, a->MyKey_V2, true); + SetCipherKey(a->CipherDecrypt, client_key, false); + } + else + { + Copy(a->YourKey, client_key, sizeof(a->YourKey)); + } + + Copy(&a->YourIp, client_ip, sizeof(IP)); + Copy(&a->YourIp2, client_ip_2, sizeof(IP)); + a->YourPort = client_port; + + a->Now = Tick64(); + + a->Inited = true; + + return true; +} + +// Initialize the client-side +bool UdpAccelInitClient(UDP_ACCEL *a, UCHAR *server_key, IP *server_ip, UINT server_port, UINT server_cookie, UINT client_cookie, IP *server_ip_2) +{ + char tmp[MAX_SIZE]; + // Validate arguments + if (a == NULL || server_key == NULL || server_ip == NULL || server_port == 0) + { + return false; + } + + IPToStr(tmp, sizeof(tmp), server_ip); + Debug("UdpAccelInitClient(): version: %u, client IP: %s, client port: %u, server cookie: %u, client cookie: %u\n", a->Version, tmp, server_port, server_cookie, client_cookie); + + if (IsIP6(server_ip) != a->IsIPv6) + { + return false; + } + + if (a->Version > 1) + { + a->CipherEncrypt = NewCipher("ChaCha20-Poly1305"); + a->CipherDecrypt = NewCipher("ChaCha20-Poly1305"); + + SetCipherKey(a->CipherEncrypt, a->MyKey_V2, true); + SetCipherKey(a->CipherDecrypt, server_key, false); + } + else + { + Copy(a->YourKey, server_key, sizeof(a->YourKey)); + } + + Copy(&a->YourIp, server_ip, sizeof(IP)); + Copy(&a->YourIp2, server_ip_2, sizeof(IP)); + a->YourPort = server_port; + + a->Now = Tick64(); + + a->MyCookie = client_cookie; + a->YourCookie = server_cookie; + + a->Inited = true; + + return true; +} + +// Create a new UDP acceleration function +UDP_ACCEL *NewUdpAccel(CEDAR *cedar, IP *ip, bool client_mode, bool random_port, bool no_nat_t) +{ + UDP_ACCEL *a; + SOCK *s; + UINT max_udp_size; + bool is_in_cedar_port_list = false; + + if (IsZeroIP(ip)) + { + ip = NULL; + } + + if (client_mode || random_port) + { + // Use a appropriate vacant port number in the case of using random port or client mode + s = NewUDPEx3(0, ip); + } + else + { + // Specify in the range in the case of server mode + UINT i; + s = NULL; + + LockList(cedar->UdpPortList); + { + for (i = UDP_SERVER_PORT_LOWER;i <= UDP_SERVER_PORT_HIGHER;i++) + { + if (IsIntInList(cedar->UdpPortList, i) == false) + { + s = NewUDPEx3(i, ip); + + if (s != NULL) + { + is_in_cedar_port_list = true; + break; + } + } + } + + if (s == NULL) + { + // Leave the port selection to the OS because the available port is not found within the range + s = NewUDPEx3(0, ip); + } + + if (s != NULL && is_in_cedar_port_list) + { + AddIntDistinct(cedar->UdpPortList, i); + } + } + UnlockList(cedar->UdpPortList); + } + + if (s == NULL) + { + return NULL; + } + + a = ZeroMalloc(sizeof(UDP_ACCEL)); + + a->Cedar = cedar; + AddRef(a->Cedar->ref); + + a->NoNatT = no_nat_t; + + a->Version = 1; + + a->NatT_TranId = Rand64(); + + a->CreatedTick = Tick64(); + + a->IsInCedarPortList = is_in_cedar_port_list; + + a->ClientMode = client_mode; + + a->Now = Tick64(); + a->UdpSock = s; + + Rand(a->MyKey, sizeof(a->MyKey)); + Rand(a->MyKey_V2, sizeof(a->MyKey_V2)); + + Copy(&a->MyIp, ip, sizeof(IP)); + a->MyPort = s->LocalPort; + + a->IsIPv6 = IsIP6(ip); + + if (a->IsIPv6) + { + a->NoNatT = true; + } + + a->RecvBlockQueue = NewQueue(); + + Rand(a->NextIv, sizeof(a->NextIv)); + Rand(a->NextIv_V2, sizeof(a->NextIv_V2)); + + do + { + a->MyCookie = Rand32(); + } + while (a->MyCookie == 0); + + do + { + a->YourCookie = Rand32(); + } + while (a->MyCookie == 0 || a->MyCookie == a->YourCookie); + + // Calculate the maximum transmittable UDP packet size + max_udp_size = MTU_FOR_PPPOE; + + if (a->IsIPv6 == false) + { + // IPv4 + max_udp_size -= 20; + } + else + { + // IPv6 + max_udp_size -= 40; + } + + // UDP + max_udp_size -= 8; + + a->MaxUdpPacketSize = max_udp_size; + + Debug("Udp Accel My Port = %u\n", a->MyPort); + + // Initialize the NAT-T server IP address acquisition thread + a->NatT_Lock = NewLock(); + a->NatT_HaltEvent = NewEvent(); + + if (a->NoNatT == false) + { + a->NatT_GetIpThread = NewThread(NatT_GetIpThread, a); + } + + return a; +} + +// NAT-T server IP address acquisition thread +void NatT_GetIpThread(THREAD *thread, void *param) +{ + UDP_ACCEL *a; + char hostname[MAX_SIZE]; + static IP dummy_ip = {0}; + UINT num_retry = 0; + // Validate arguments + if (thread == NULL || param == NULL) + { + return; + } + + a = (UDP_ACCEL *)param; + + if (IsZeroIP(&dummy_ip)) + { + SetIP(&dummy_ip, 11, Rand8(), Rand8(), Rand8()); + } + + RUDPGetRegisterHostNameByIP(hostname, sizeof(hostname), &dummy_ip); + + while (a->NatT_Halt == false) + { + IP ip; + UINT wait_time = UDP_NAT_T_GET_IP_INTERVAL; + + // Get the IP address + bool ret = GetIP4Ex(&ip, hostname, 0, &a->NatT_Halt); + + if (ret && (IsZeroIp(&ip) == false)) + { + char tmp[128]; + + // Success to get + Lock(a->NatT_Lock); + { + Copy(&a->NatT_IP, &ip, sizeof(IP)); + } + Unlock(a->NatT_Lock); + + IPToStr(tmp, sizeof(tmp), &ip); + Debug("NAT-T IP Address Resolved: %s = %s\n", hostname, tmp); + + a->NatT_IP_Changed = true; + + break; + } + + // Fail to get + num_retry++; + + wait_time = (UINT)(MIN((UINT64)UDP_NAT_T_GET_IP_INTERVAL * (UINT64)num_retry, (UINT64)UDP_NAT_T_GET_IP_INTERVAL_MAX)); + + Wait(a->NatT_HaltEvent, wait_time); + } +} + +// Release the UDP acceleration function +void FreeUdpAccel(UDP_ACCEL *a) +{ + // Validate arguments + if (a == NULL) + { + return; + } + + while (true) + { + BLOCK *b = GetNext(a->RecvBlockQueue); + + if (b == NULL) + { + break; + } + + FreeBlock(b); + } + + ReleaseQueue(a->RecvBlockQueue); + + ReleaseSock(a->UdpSock); + + if (a->IsInCedarPortList) + { + LockList(a->Cedar->UdpPortList); + { + DelInt(a->Cedar->UdpPortList, a->MyPort); + } + UnlockList(a->Cedar->UdpPortList); + } + + // Release of NAT-T related + a->NatT_Halt = true; + Set(a->NatT_HaltEvent); + + if (a->NatT_GetIpThread != NULL) + { + WaitThread(a->NatT_GetIpThread, INFINITE); + ReleaseThread(a->NatT_GetIpThread); + } + + ReleaseEvent(a->NatT_HaltEvent); + DeleteLock(a->NatT_Lock); + + ReleaseCedar(a->Cedar); + + FreeCipher(a->CipherEncrypt); + FreeCipher(a->CipherDecrypt); + + Free(a); +} diff --git a/src/Cedar/UdpAccel.h b/src/Cedar/UdpAccel.h index b9d88c0e..b79cab3b 100644 --- a/src/Cedar/UdpAccel.h +++ b/src/Cedar/UdpAccel.h @@ -1,127 +1,127 @@ -// SoftEther VPN Source Code - Developer Edition Master Branch -// Cedar Communication Module - - -// UdpAccel.h -// Header of UdpAccel.c - -#ifndef UDPACCEL_H -#define UDPACCEL_H - -// Constants -#define UDP_ACCELERATION_COMMON_KEY_SIZE_V1 20 // V1: Common key size -#define UDP_ACCELERATION_PACKET_KEY_SIZE_V1 20 // V1: Key size for the packet -#define UDP_ACCELERATION_PACKET_IV_SIZE_V1 20 // V1: IV size for the packet - -#define UDP_ACCELERATION_COMMON_KEY_SIZE_V2 128 // V2: Common key size -#define UDP_ACCELERATION_PACKET_IV_SIZE_V2 12 // V2: IV size for the packet -#define UDP_ACCELERATION_PACKET_MAC_SIZE_V2 16 // V2: MAC size for the packet - -#define UDP_ACCELERATION_TMP_BUF_SIZE 2048 // Temporary buffer size -#define UDP_ACCELERATION_WINDOW_SIZE_MSEC (30 * 1000) // Receive window size (in milliseconds) - -#define UDP_ACCELERATION_SUPPORTED_MAX_PAYLOAD_SIZE 1600 // Maximum supported payload size -#define UDP_ACCELERATION_MAX_PADDING_SIZE 32 // Maximum padding size - -#define UDP_ACCELERATION_REQUIRE_CONTINUOUS (10 * 1000) // Not to use if stable communication is not continued at least for this time - -// Time constant for Build 8534 or earlier -#define UDP_ACCELERATION_KEEPALIVE_INTERVAL_MIN (1 * 1000) // Keep Alive Interval (minimum) -#define UDP_ACCELERATION_KEEPALIVE_INTERVAL_MAX (3 * 1000) // Keep Alive Interval (maximum) -#define UDP_ACCELERATION_KEEPALIVE_TIMEOUT (9 * 1000) // Time to disconnect time by non-communication - -// Time constant for Build 8535 or later -#define UDP_ACCELERATION_KEEPALIVE_INTERVAL_MIN_FAST (500) // Keep Alive Interval (minimum) -#define UDP_ACCELERATION_KEEPALIVE_INTERVAL_MAX_FAST (1000) // Keep Alive Interval (maximum) -#define UDP_ACCELERATION_KEEPALIVE_TIMEOUT_FAST (2100) // Time to disconnect time by non-communication - -// Range of port numbers -#define UDP_SERVER_PORT_LOWER 40000 // Minimum port -#define UDP_SERVER_PORT_HIGHER 44999 // Maximum port - -// NAT-T port signature to be embedded in the Keep Alive of the session -#define UDP_NAT_T_PORT_SIGNATURE_IN_KEEP_ALIVE "NATT_MY_PORT" - -// UDP Acceleration Mode -struct UDP_ACCEL -{ - CEDAR *Cedar; // Cedar - bool NoNatT; // Not to communicate with the NAT-T server (To communicate with the query server instead) - bool ClientMode; // Whether client mode - bool IsInCedarPortList; // Whether included in the port list of the Cedar - UINT64 Now; // Current time - CIPHER *CipherEncrypt; // Encryption context - CIPHER *CipherDecrypt; // Decryption context - UCHAR MyKey[UDP_ACCELERATION_COMMON_KEY_SIZE_V1]; // Send-direction common key - UCHAR YourKey[UDP_ACCELERATION_COMMON_KEY_SIZE_V1]; // Receive-direction common key - SOCK *UdpSock; // UDP socket - UINT MyPort; // My port number - UINT YourPort; // Port number of the other party - IP MyIp; // My IP address - IP YourIp; // IP address of the other party - IP YourIp2; // IP address of the other party (second) - bool IsIPv6; // Whether it's an IPv6 - UCHAR TmpBuf[UDP_ACCELERATION_TMP_BUF_SIZE]; // Temporary buffer - UINT64 LastRecvYourTick; // Opponent's tick value of the last reception - UINT64 LastRecvMyTick; // My tick value of the last reception - QUEUE *RecvBlockQueue; // Reception block queue - bool UseHMac; // Flag to use the HMAC - bool PlainTextMode; // No encryption - UINT64 LastSetSrcIpAndPortTick; // Opponent's tick ??value at the time of storing the IP address and port number of the opponent at the end - UINT64 LastRecvTick; // Tick when data has received at the end - UINT64 NextSendKeepAlive; // Next time to send a KeepAlive packet - UCHAR NextIv[UDP_ACCELERATION_PACKET_IV_SIZE_V1]; // IV to be used next - UINT MyCookie; // My cookie - UINT YourCookie; // Cookie of the other party - bool Inited; // Initialized flag - UINT Mss; // Optimal MSS - UINT MaxUdpPacketSize; // Get the maximum transmittable UDP size - LOCK *NatT_Lock; // Lock the IP address field of NAT-T server - IP NatT_IP; // IP address of the NAT-T server - THREAD *NatT_GetIpThread; // IP address acquisition thread of NAT-T server - bool NatT_Halt; // Halting flag of IP address acquisition thread of NAT-T server - EVENT *NatT_HaltEvent; // Halting event of IP address acquisition thread of NAT-T server - UINT64 NextPerformNatTTick; // Time to communicate with NAT-T server next time - UINT CommToNatT_NumFail; // Number of failures to communicate with NAT-T server - UINT MyPortByNatTServer; // Self port number which is received from the NAT-T server - bool MyPortByNatTServerChanged; // The self port number which is received from the NAT-T server changes - UINT YourPortByNatTServer; // Port number of the opponent that was found via the NAT-T server - bool YourPortByNatTServerChanged; // Port number of the opponent that was found via the NAT-T server has been changed - bool FatalError; // A fatal error occurred - bool NatT_IP_Changed; // IP address of the NAT-T server has changed - UINT64 NatT_TranId; // Transaction ID to be exchanged with the NAT-T server - bool IsReachedOnce; // It is true if it succeeds in mutual transmission and reception of packets at least once - UINT64 CreatedTick; // Object creation time - bool FastDetect; // Fast disconnection detection mode - UINT64 FirstStableReceiveTick; // Start time of current stable continued receivable period - bool UseSuperRelayQuery; // Use the super relay query - bool UseUdpIpQuery; // Use the self IP address query by UDP - IP UdpIpQueryHost; // Host for the self IP address query by UDP - UINT UdpIpQueryPort; // Port number for self IP address for query by UDP - UCHAR UdpIpQueryPacketData[16]; // Query packet data (final transmission) - UINT UdpIpQueryPacketSize; // Query packet data size (final transmission) - UCHAR UdpHostUniqueKey[SHA1_SIZE]; // Unique key for UDP self endpoint query - UINT Version; // Version - UCHAR MyKey_V2[UDP_ACCELERATION_COMMON_KEY_SIZE_V2]; // Send-direction common key (version 2) - UCHAR NextIv_V2[UDP_ACCELERATION_PACKET_IV_SIZE_V2]; // IV to be used next (version 2) - bool ReadRawFlagMode; // Read raw flag mode -}; - -// Function prototype -UDP_ACCEL *NewUdpAccel(CEDAR *cedar, IP *ip, bool client_mode, bool random_port, bool no_nat_t); -void FreeUdpAccel(UDP_ACCEL *a); -bool UdpAccelInitClient(UDP_ACCEL *a, UCHAR *server_key, IP *server_ip, UINT server_port, UINT server_cookie, UINT client_cookie, IP *server_ip_2); -bool UdpAccelInitServer(UDP_ACCEL *a, UCHAR *client_key, IP *client_ip, UINT client_port, IP *client_ip_2); -void UdpAccelPoll(UDP_ACCEL *a); -void UdpAccelSetTick(UDP_ACCEL *a, UINT64 tick64); -BLOCK *UdpAccelProcessRecvPacket(UDP_ACCEL *a, UCHAR *buf, UINT size, IP *src_ip, UINT src_port); -void UdpAccelCalcKeyV1(UCHAR *key, UCHAR *common_key, UCHAR *iv); -bool UdpAccelIsSendReady(UDP_ACCEL *a, bool check_keepalive); -void UdpAccelSend(UDP_ACCEL *a, UCHAR *data, UINT data_size, UCHAR flag, UINT max_size, bool high_priority); -void UdpAccelSendBlock(UDP_ACCEL *a, BLOCK *b); -UINT UdpAccelCalcMss(UDP_ACCEL *a); -void NatT_GetIpThread(THREAD *thread, void *param); - -#endif // UDPACCEL_H - - +// SoftEther VPN Source Code - Developer Edition Master Branch +// Cedar Communication Module + + +// UdpAccel.h +// Header of UdpAccel.c + +#ifndef UDPACCEL_H +#define UDPACCEL_H + +// Constants +#define UDP_ACCELERATION_COMMON_KEY_SIZE_V1 20 // V1: Common key size +#define UDP_ACCELERATION_PACKET_KEY_SIZE_V1 20 // V1: Key size for the packet +#define UDP_ACCELERATION_PACKET_IV_SIZE_V1 20 // V1: IV size for the packet + +#define UDP_ACCELERATION_COMMON_KEY_SIZE_V2 128 // V2: Common key size +#define UDP_ACCELERATION_PACKET_IV_SIZE_V2 12 // V2: IV size for the packet +#define UDP_ACCELERATION_PACKET_MAC_SIZE_V2 16 // V2: MAC size for the packet + +#define UDP_ACCELERATION_TMP_BUF_SIZE 2048 // Temporary buffer size +#define UDP_ACCELERATION_WINDOW_SIZE_MSEC (30 * 1000) // Receive window size (in milliseconds) + +#define UDP_ACCELERATION_SUPPORTED_MAX_PAYLOAD_SIZE 1600 // Maximum supported payload size +#define UDP_ACCELERATION_MAX_PADDING_SIZE 32 // Maximum padding size + +#define UDP_ACCELERATION_REQUIRE_CONTINUOUS (10 * 1000) // Not to use if stable communication is not continued at least for this time + +// Time constant for Build 8534 or earlier +#define UDP_ACCELERATION_KEEPALIVE_INTERVAL_MIN (1 * 1000) // Keep Alive Interval (minimum) +#define UDP_ACCELERATION_KEEPALIVE_INTERVAL_MAX (3 * 1000) // Keep Alive Interval (maximum) +#define UDP_ACCELERATION_KEEPALIVE_TIMEOUT (9 * 1000) // Time to disconnect time by non-communication + +// Time constant for Build 8535 or later +#define UDP_ACCELERATION_KEEPALIVE_INTERVAL_MIN_FAST (500) // Keep Alive Interval (minimum) +#define UDP_ACCELERATION_KEEPALIVE_INTERVAL_MAX_FAST (1000) // Keep Alive Interval (maximum) +#define UDP_ACCELERATION_KEEPALIVE_TIMEOUT_FAST (2100) // Time to disconnect time by non-communication + +// Range of port numbers +#define UDP_SERVER_PORT_LOWER 40000 // Minimum port +#define UDP_SERVER_PORT_HIGHER 44999 // Maximum port + +// NAT-T port signature to be embedded in the Keep Alive of the session +#define UDP_NAT_T_PORT_SIGNATURE_IN_KEEP_ALIVE "NATT_MY_PORT" + +// UDP Acceleration Mode +struct UDP_ACCEL +{ + CEDAR *Cedar; // Cedar + bool NoNatT; // Not to communicate with the NAT-T server (To communicate with the query server instead) + bool ClientMode; // Whether client mode + bool IsInCedarPortList; // Whether included in the port list of the Cedar + UINT64 Now; // Current time + CIPHER *CipherEncrypt; // Encryption context + CIPHER *CipherDecrypt; // Decryption context + UCHAR MyKey[UDP_ACCELERATION_COMMON_KEY_SIZE_V1]; // Send-direction common key + UCHAR YourKey[UDP_ACCELERATION_COMMON_KEY_SIZE_V1]; // Receive-direction common key + SOCK *UdpSock; // UDP socket + UINT MyPort; // My port number + UINT YourPort; // Port number of the other party + IP MyIp; // My IP address + IP YourIp; // IP address of the other party + IP YourIp2; // IP address of the other party (second) + bool IsIPv6; // Whether it's an IPv6 + UCHAR TmpBuf[UDP_ACCELERATION_TMP_BUF_SIZE]; // Temporary buffer + UINT64 LastRecvYourTick; // Opponent's tick value of the last reception + UINT64 LastRecvMyTick; // My tick value of the last reception + QUEUE *RecvBlockQueue; // Reception block queue + bool UseHMac; // Flag to use the HMAC + bool PlainTextMode; // No encryption + UINT64 LastSetSrcIpAndPortTick; // Opponent's tick ??value at the time of storing the IP address and port number of the opponent at the end + UINT64 LastRecvTick; // Tick when data has received at the end + UINT64 NextSendKeepAlive; // Next time to send a KeepAlive packet + UCHAR NextIv[UDP_ACCELERATION_PACKET_IV_SIZE_V1]; // IV to be used next + UINT MyCookie; // My cookie + UINT YourCookie; // Cookie of the other party + bool Inited; // Initialized flag + UINT Mss; // Optimal MSS + UINT MaxUdpPacketSize; // Get the maximum transmittable UDP size + LOCK *NatT_Lock; // Lock the IP address field of NAT-T server + IP NatT_IP; // IP address of the NAT-T server + THREAD *NatT_GetIpThread; // IP address acquisition thread of NAT-T server + bool NatT_Halt; // Halting flag of IP address acquisition thread of NAT-T server + EVENT *NatT_HaltEvent; // Halting event of IP address acquisition thread of NAT-T server + UINT64 NextPerformNatTTick; // Time to communicate with NAT-T server next time + UINT CommToNatT_NumFail; // Number of failures to communicate with NAT-T server + UINT MyPortByNatTServer; // Self port number which is received from the NAT-T server + bool MyPortByNatTServerChanged; // The self port number which is received from the NAT-T server changes + UINT YourPortByNatTServer; // Port number of the opponent that was found via the NAT-T server + bool YourPortByNatTServerChanged; // Port number of the opponent that was found via the NAT-T server has been changed + bool FatalError; // A fatal error occurred + bool NatT_IP_Changed; // IP address of the NAT-T server has changed + UINT64 NatT_TranId; // Transaction ID to be exchanged with the NAT-T server + bool IsReachedOnce; // It is true if it succeeds in mutual transmission and reception of packets at least once + UINT64 CreatedTick; // Object creation time + bool FastDetect; // Fast disconnection detection mode + UINT64 FirstStableReceiveTick; // Start time of current stable continued receivable period + bool UseSuperRelayQuery; // Use the super relay query + bool UseUdpIpQuery; // Use the self IP address query by UDP + IP UdpIpQueryHost; // Host for the self IP address query by UDP + UINT UdpIpQueryPort; // Port number for self IP address for query by UDP + UCHAR UdpIpQueryPacketData[16]; // Query packet data (final transmission) + UINT UdpIpQueryPacketSize; // Query packet data size (final transmission) + UCHAR UdpHostUniqueKey[SHA1_SIZE]; // Unique key for UDP self endpoint query + UINT Version; // Version + UCHAR MyKey_V2[UDP_ACCELERATION_COMMON_KEY_SIZE_V2]; // Send-direction common key (version 2) + UCHAR NextIv_V2[UDP_ACCELERATION_PACKET_IV_SIZE_V2]; // IV to be used next (version 2) + bool ReadRawFlagMode; // Read raw flag mode +}; + +// Function prototype +UDP_ACCEL *NewUdpAccel(CEDAR *cedar, IP *ip, bool client_mode, bool random_port, bool no_nat_t); +void FreeUdpAccel(UDP_ACCEL *a); +bool UdpAccelInitClient(UDP_ACCEL *a, UCHAR *server_key, IP *server_ip, UINT server_port, UINT server_cookie, UINT client_cookie, IP *server_ip_2); +bool UdpAccelInitServer(UDP_ACCEL *a, UCHAR *client_key, IP *client_ip, UINT client_port, IP *client_ip_2); +void UdpAccelPoll(UDP_ACCEL *a); +void UdpAccelSetTick(UDP_ACCEL *a, UINT64 tick64); +BLOCK *UdpAccelProcessRecvPacket(UDP_ACCEL *a, UCHAR *buf, UINT size, IP *src_ip, UINT src_port); +void UdpAccelCalcKeyV1(UCHAR *key, UCHAR *common_key, UCHAR *iv); +bool UdpAccelIsSendReady(UDP_ACCEL *a, bool check_keepalive); +void UdpAccelSend(UDP_ACCEL *a, UCHAR *data, UINT data_size, UCHAR flag, UINT max_size, bool high_priority); +void UdpAccelSendBlock(UDP_ACCEL *a, BLOCK *b); +UINT UdpAccelCalcMss(UDP_ACCEL *a); +void NatT_GetIpThread(THREAD *thread, void *param); + +#endif // UDPACCEL_H + + diff --git a/src/Cedar/VG.c b/src/Cedar/VG.c index 8c930e7e..0dbd0837 100644 --- a/src/Cedar/VG.c +++ b/src/Cedar/VG.c @@ -1,25 +1,25 @@ -// SoftEther VPN Source Code - Developer Edition Master Branch -// Cedar Communication Module - - -// VG.c -// VPN Gate Plugin Main Implementation - -#include "CedarPch.h" - - -bool InitVg() -{ - return false; -} - -void FreeVg() -{ -} - -void VgUseStaticLink() -{ -} - - - +// SoftEther VPN Source Code - Developer Edition Master Branch +// Cedar Communication Module + + +// VG.c +// VPN Gate Plugin Main Implementation + +#include "CedarPch.h" + + +bool InitVg() +{ + return false; +} + +void FreeVg() +{ +} + +void VgUseStaticLink() +{ +} + + + diff --git a/src/Cedar/VG.h b/src/Cedar/VG.h index cf01357e..8982bc69 100644 --- a/src/Cedar/VG.h +++ b/src/Cedar/VG.h @@ -1,21 +1,21 @@ -// SoftEther VPN Source Code - Developer Edition Master Branch -// Cedar Communication Module - - -// VG.h -// Header for VG.c - -#ifndef VG_H -#define VG_H - -#define VG_HUBNAME "VPNGATE" - - -bool InitVg(); -void FreeVg(); -void VgUseStaticLink(); - -#endif // VG_H - - - +// SoftEther VPN Source Code - Developer Edition Master Branch +// Cedar Communication Module + + +// VG.h +// Header for VG.c + +#ifndef VG_H +#define VG_H + +#define VG_HUBNAME "VPNGATE" + + +bool InitVg(); +void FreeVg(); +void VgUseStaticLink(); + +#endif // VG_H + + + diff --git a/src/Cedar/VLan.c b/src/Cedar/VLan.c index 0d7a9f01..649c172c 100644 --- a/src/Cedar/VLan.c +++ b/src/Cedar/VLan.c @@ -1,28 +1,28 @@ -// SoftEther VPN Source Code - Developer Edition Master Branch -// Cedar Communication Module - - -// VLan.c -// Virtual LAN card adapter manipulation library - -#include - -#define VLAN_C - -#ifdef WIN32 -#define OS_WIN32 -#endif - -#ifdef OS_WIN32 - -// For Win32 -#include "VLanWin32.c" - -#else - -// For UNIX -#include "VLanUnix.c" - -#endif // OS_WIN32 - - +// SoftEther VPN Source Code - Developer Edition Master Branch +// Cedar Communication Module + + +// VLan.c +// Virtual LAN card adapter manipulation library + +#include + +#define VLAN_C + +#ifdef WIN32 +#define OS_WIN32 +#endif + +#ifdef OS_WIN32 + +// For Win32 +#include "VLanWin32.c" + +#else + +// For UNIX +#include "VLanUnix.c" + +#endif // OS_WIN32 + + diff --git a/src/Cedar/VLan.h b/src/Cedar/VLan.h index 51408422..07d8c28c 100644 --- a/src/Cedar/VLan.h +++ b/src/Cedar/VLan.h @@ -1,32 +1,32 @@ -// SoftEther VPN Source Code - Developer Edition Master Branch -// Cedar Communication Module - - -// VLan.h -// Header of VLan.c - -#ifndef VLAN_H -#define VLAN_H - -// Parameters related to VLAN -struct VLAN_PARAM -{ - UCHAR MacAddress[6]; - UCHAR Padding[2]; -}; - -#ifdef OS_WIN32 - -// For Win32 -#include - -#else // OS_WIN32 - -// For UNIX -#include - -#endif // OS_WIN32 - -#endif // VLAN_H - - +// SoftEther VPN Source Code - Developer Edition Master Branch +// Cedar Communication Module + + +// VLan.h +// Header of VLan.c + +#ifndef VLAN_H +#define VLAN_H + +// Parameters related to VLAN +struct VLAN_PARAM +{ + UCHAR MacAddress[6]; + UCHAR Padding[2]; +}; + +#ifdef OS_WIN32 + +// For Win32 +#include + +#else // OS_WIN32 + +// For UNIX +#include + +#endif // OS_WIN32 + +#endif // VLAN_H + + diff --git a/src/Cedar/VLanUnix.c b/src/Cedar/VLanUnix.c index 2af36793..e30a7d42 100644 --- a/src/Cedar/VLanUnix.c +++ b/src/Cedar/VLanUnix.c @@ -1,821 +1,821 @@ -// SoftEther VPN Source Code - Developer Edition Master Branch -// Cedar Communication Module - - -// VLanUnix.c -// Virtual device driver library for UNIX - -#include - -#ifdef VLAN_C - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#ifdef UNIX_BSD -#ifdef UNIX_OPENBSD -#include -#else // UNIX_OPENBSD -#include -#endif // UNIX_OPENBSD -#endif // UNIX_BSD - -#ifdef OS_UNIX - -static LIST *unix_vlan = NULL; - -#ifndef NO_VLAN - -// Get the PACKET_ADAPTER -PACKET_ADAPTER *VLanGetPacketAdapter() -{ - PACKET_ADAPTER *pa; - - pa = NewPacketAdapter(VLanPaInit, VLanPaGetCancel, - VLanPaGetNextPacket, VLanPaPutPacket, VLanPaFree); - if (pa == NULL) - { - return NULL; - } - - return pa; -} - -// PA initialization -bool VLanPaInit(SESSION *s) -{ - VLAN *v; - // Validate arguments - if (s == NULL) - { - return false; - } - - // Connect to the driver - v = NewVLan(s->ClientOption->DeviceName, NULL); - if (v == NULL) - { - // Failure - return false; - } - - s->PacketAdapter->Param = v; - - return true; -} - -// Get the cancel object -CANCEL *VLanPaGetCancel(SESSION *s) -{ - VLAN *v; - // Validate arguments - if ((s == NULL) || ((v = s->PacketAdapter->Param) == NULL)) - { - return NULL; - } - - return VLanGetCancel(v); -} - -// Release the packet adapter -void VLanPaFree(SESSION *s) -{ - VLAN *v; - // Validate arguments - if ((s == NULL) || ((v = s->PacketAdapter->Param) == NULL)) - { - return; - } - - // End the virtual LAN card - FreeVLan(v); - - s->PacketAdapter->Param = NULL; -} - -// Write a packet -bool VLanPaPutPacket(SESSION *s, void *data, UINT size) -{ - VLAN *v; - // Validate arguments - if ((s == NULL) || ((v = s->PacketAdapter->Param) == NULL)) - { - return false; - } - - return VLanPutPacket(v, data, size); -} - -// Get the next packet -UINT VLanPaGetNextPacket(SESSION *s, void **data) -{ - VLAN *v; - UINT size; - // Validate arguments - if (data == NULL || (s == NULL) || ((v = s->PacketAdapter->Param) == NULL)) - { - return INFINITE; - } - - if (VLanGetNextPacket(v, data, &size) == false) - { - return INFINITE; - } - - return size; -} - -// Write a packet to the virtual LAN card -bool VLanPutPacket(VLAN *v, void *buf, UINT size) -{ - UINT ret; - // Validate arguments - if (v == NULL) - { - return false; - } - if (v->Halt) - { - return false; - } - if (size > MAX_PACKET_SIZE) - { - return false; - } - if (buf == NULL || size == 0) - { - if (buf != NULL) - { - Free(buf); - } - return true; - } - - ret = write(v->fd, buf, size); - - if (ret >= 1) - { - Free(buf); - return true; - } - - if (errno == EAGAIN || ret == 0) - { - Free(buf); - return true; - } - - return false; -} - -// Get the next packet from the virtual LAN card -bool VLanGetNextPacket(VLAN *v, void **buf, UINT *size) -{ - UCHAR tmp[TAP_READ_BUF_SIZE]; - int ret; - // Validate arguments - if (v == NULL || buf == NULL || size == 0) - { - return false; - } - if (v->Halt) - { - return false; - } - - // Read - ret = read(v->fd, tmp, sizeof(tmp)); - - if (ret == 0 || - (ret == -1 && errno == EAGAIN)) - { - // No packet - *buf = NULL; - *size = 0; - return true; - } - else if (ret == -1 || ret > TAP_READ_BUF_SIZE) - { - // Error - return false; - } - else - { - // Reading packet success - *buf = Malloc(ret); - Copy(*buf, tmp, ret); - *size = ret; - return true; - } -} - -// Get the cancel object -CANCEL *VLanGetCancel(VLAN *v) -{ - CANCEL *c; - int fd; - int yes = 0; - // Validate arguments - if (v == NULL) - { - return NULL; - } - - c = NewCancel(); - UnixDeletePipe(c->pipe_read, c->pipe_write); - c->pipe_read = c->pipe_write = -1; - - fd = v->fd; - - UnixSetSocketNonBlockingMode(fd, true); - - c->SpecialFlag = true; - c->pipe_read = fd; - - return c; -} - -// Close the Virtual LAN card -void FreeVLan(VLAN *v) -{ - // Validate arguments - if (v == NULL) - { - return; - } - - Free(v->InstanceName); - - Free(v); -} - -// Create a tap -VLAN *NewTap(char *name, char *mac_address, bool create_up) -{ - int fd; - VLAN *v; - // Validate arguments - if (name == NULL || mac_address == NULL) - { - return NULL; - } - - fd = UnixCreateTapDeviceEx(name, "tap", mac_address, create_up); - if (fd == -1) - { - return NULL; - } - - v = ZeroMalloc(sizeof(VLAN)); - v->Halt = false; - v->InstanceName = CopyStr(name); - v->fd = fd; - - return v; -} - -// Close the tap -void FreeTap(VLAN *v) -{ - // Validate arguments - if (v == NULL) - { - return; - } - - close(v->fd); - FreeVLan(v); -} - -// Get the Virtual LAN card list -VLAN *NewVLan(char *instance_name, VLAN_PARAM *param) -{ - int fd; - VLAN *v; - // Validate arguments - if (instance_name == NULL) - { - return NULL; - } - - // Open the tap - fd = UnixVLanGet(instance_name); - if (fd == -1) - { - return NULL; - } - - v = ZeroMalloc(sizeof(VLAN)); - v->Halt = false; - v->InstanceName = CopyStr(instance_name); - v->fd = fd; - - return v; -} - -// Generate TUN interface name -void GenerateTunName(char *name, char *prefix, char *tun_name, size_t tun_name_len) -{ - char instance_name_lower[MAX_SIZE]; - - // Generate the device name - StrCpy(instance_name_lower, sizeof(instance_name_lower), name); - Trim(instance_name_lower); - StrLower(instance_name_lower); - Format(tun_name, tun_name_len, "%s_%s", prefix, instance_name_lower); - - tun_name[15] = 0; -} -// Create a tap device -int UnixCreateTapDeviceEx(char *name, char *prefix, UCHAR *mac_address, bool create_up) -{ - int fd = -1, s = -1; - char tap_name[MAX_SIZE], tap_path[MAX_SIZE]; - struct ifreq ifr; - - // Validate arguments - if (name == NULL) - { - return -1; - } - - GenerateTunName(name, prefix, tap_name, sizeof(tap_name)); - - // Open the tun / tap -#ifndef UNIX_BSD - if (GetOsInfo()->OsType == OSTYPE_LINUX) - { - // Linux - if (IsFile(TAP_FILENAME_1) == false) - { - char tmp[MAX_SIZE]; - - Format(tmp, sizeof(tmp), "%s c 10 200", TAP_FILENAME_1); - Run("mknod", tmp, true, true); - - Format(tmp, sizeof(tmp), "600 %s", TAP_FILENAME_1); - Run("chmod", tmp, true, true); - } - } - - fd = open(TAP_FILENAME_1, O_RDWR); - if (fd == -1) - { - // Failure - fd = open(TAP_FILENAME_2, O_RDWR); - if (fd == -1) - { - return -1; - } - } -#else // UNIX_BSD - { - sprintf(tap_path, "%s", TAP_DIR TAP_NAME); - for (int i = 0; i < TAP_MAX; i++) { - sprintf(tap_path + StrLen(TAP_DIR TAP_NAME), "%d", i); - fd = open(tap_path, O_RDWR); - if (fd != -1) - { - break; - } - } - - if (fd == -1) - { - return -1; - } - } -#endif // UNIX_BSD - -#ifdef UNIX_LINUX - // Create a TAP device for Linux - - // Set the name and the flags - Zero(&ifr, sizeof(ifr)); - StrCpy(ifr.ifr_name, sizeof(ifr.ifr_name), tap_name); - ifr.ifr_flags = IFF_TAP | IFF_NO_PI; - - if (ioctl(fd, TUNSETIFF, &ifr) == -1) - { - // Failure - close(fd); - return -1; - } - - s = socket(AF_INET, SOCK_DGRAM, 0); - if (s != -1) - { - // Set the MAC address - if (mac_address != NULL) - { - Zero(&ifr, sizeof(ifr)); - StrCpy(ifr.ifr_name, sizeof(ifr.ifr_name), tap_name); - ifr.ifr_hwaddr.sa_family = ARPHRD_ETHER; - Copy(&ifr.ifr_hwaddr.sa_data, mac_address, ETHER_ADDR_LEN); - ioctl(s, SIOCSIFHWADDR, &ifr); - } - - if (create_up) - { - Zero(&ifr, sizeof(ifr)); - StrCpy(ifr.ifr_name, sizeof(ifr.ifr_name), tap_name); - ioctl(s, SIOCGIFFLAGS, &ifr); - ifr.ifr_flags |= IFF_UP; - ioctl(s, SIOCSIFFLAGS, &ifr); - } - - close(s); - } -#endif // UNIX_LINUX - -#ifdef UNIX_BSD - // Create a TAP device for BSD - Zero(&ifr, sizeof(ifr)); - - // Get the current name - StrCpy(ifr.ifr_name, sizeof(ifr.ifr_name), tap_path + StrLen(TAP_DIR)); - - s = socket(AF_INET, SOCK_DGRAM, 0); - if (s != -1) - { - // Set the name, if possible -#ifdef SIOCSIFNAME - ifr.ifr_data = tap_name; - ioctl(s, SIOCSIFNAME, &ifr); -#else // SIOCSIFNAME - StrCpy(tap_name, sizeof(tap_name), ifr.ifr_name); -#endif // SIOCSIFNAME - - // Set the MAC address - if (mac_address != NULL) - { - Zero(&ifr, sizeof(ifr)); - StrCpy(ifr.ifr_name, sizeof(ifr.ifr_name), tap_name); - ifr.ifr_addr.sa_len = ETHER_ADDR_LEN; - ifr.ifr_addr.sa_family = AF_LINK; - Copy(&ifr.ifr_addr.sa_data, mac_address, ETHER_ADDR_LEN); - ioctl(s, SIOCSIFLLADDR, &ifr); - } - - if (create_up) - { - Zero(&ifr, sizeof(ifr)); - StrCpy(ifr.ifr_name, sizeof(ifr.ifr_name), tap_name); - ioctl(s, SIOCGIFFLAGS, &ifr); - ifr.ifr_flags |= IFF_UP; - ioctl(s, SIOCSIFFLAGS, &ifr); - } - - close(s); - } -#endif // UNIX_BSD - -#ifdef UNIX_SOLARIS - // Create a TAP device for Solaris - { - int ip_fd; - int tun_fd; - int ppa; - - tun_fd = open(tap_name, O_RDWR); - if (tun_fd == -1) - { - // Failure - close(fd); - return -1; - } - - ip_fd = open("/dev/ip", O_RDWR); - if (ip_fd == -1) - { - // Failure - close(tun_fd); - close(fd); - return -1; - } - - ppa = -1; - ppa = ioctl(tun_fd, TUNNEWPPA, ppa); - if (ppa == -1) - { - // Failure - close(tun_fd); - close(fd); - close(ip_fd); - return -1; - } - - if (ioctl(fd, I_PUSH, "ip") < 0) - { - // Failure - close(tun_fd); - close(fd); - close(ip_fd); - return -1; - } - - if (ioctl(fd, IF_UNITSEL, (char *)&ppa) < 0) - { - // Failure - close(tun_fd); - close(fd); - close(ip_fd); - return -1; - } - - if (ioctl(ip_fd, I_LINK, fd) < 0) - { - // Failure - close(tun_fd); - close(fd); - close(ip_fd); - return -1; - } - - close(tun_fd); - close(ip_fd); - } -#endif // UNIX_SOLARIS - - return fd; -} -int UnixCreateTapDevice(char *name, UCHAR *mac_address, bool create_up) -{ - return UnixCreateTapDeviceEx(name, "vpn", mac_address, create_up); -} - -// Close the tap device -void UnixCloseTapDevice(int fd) -{ - // Validate arguments - if (fd == -1) - { - return; - } - - close(fd); -} - -#else // NO_VLAN - -void UnixCloseTapDevice(int fd) -{ -} - -int UnixCreateTapDeviceEx(char *name, char *prefix, UCHAR *mac_address, bool create_up) -{ - return -1; -} -int UnixCreateTapDevice(char *name, UCHAR *mac_address, bool create_up) -{ - return -1; -} - -#endif // NO_VLAN - -// Comparison of the VLAN list entries -int UnixCompareVLan(void *p1, void *p2) -{ - UNIX_VLAN_LIST *v1, *v2; - if (p1 == NULL || p2 == NULL) - { - return 0; - } - v1 = *(UNIX_VLAN_LIST **)p1; - v2 = *(UNIX_VLAN_LIST **)p2; - if (v1 == NULL || v2 == NULL) - { - return 0; - } - - return StrCmpi(v1->Name, v2->Name); -} - -// Initialize the VLAN list -void UnixVLanInit() -{ - unix_vlan = NewList(UnixCompareVLan); -} - -// Create a VLAN -bool UnixVLanCreateEx(char *name, char *prefix, UCHAR *mac_address, bool create_up) -{ - // Validate arguments - char tmp[MAX_SIZE]; - if (name == NULL) - { - return false; - } - - StrCpy(tmp, sizeof(tmp), name); - Trim(tmp); - name = tmp; - - LockList(unix_vlan); - { - UNIX_VLAN_LIST *t, tt; - int fd; - - // Check whether a device with the same name exists - Zero(&tt, sizeof(tt)); - StrCpy(tt.Name, sizeof(tt.Name), name); - - t = Search(unix_vlan, &tt); - if (t != NULL) - { - // Already exist - UnlockList(unix_vlan); - return false; - } - - // Create a tap device - fd = UnixCreateTapDeviceEx(name, prefix, mac_address, create_up); - if (fd == -1) - { - // Failure to create - UnlockList(unix_vlan); - return false; - } - - t = ZeroMalloc(sizeof(UNIX_VLAN_LIST)); - t->fd = fd; - StrCpy(t->Name, sizeof(t->Name), name); - - Insert(unix_vlan, t); - } - UnlockList(unix_vlan); - - return true; -} -bool UnixVLanCreate(char *name, UCHAR *mac_address, bool create_up) -{ - return UnixVLanCreateEx(name, "vpn", mac_address, create_up); -} - -// Set a VLAN up/down -bool UnixVLanSetState(char* name, bool state_up) -{ -#ifdef UNIX_LINUX - UNIX_VLAN_LIST *t, tt; - struct ifreq ifr; - int s; - char eth_name[MAX_SIZE]; - - LockList(unix_vlan); - { - int result; - // Find a device with the same name - Zero(&tt, sizeof(tt)); - StrCpy(tt.Name, sizeof(tt.Name), name); - - t = Search(unix_vlan, &tt); - if (t == NULL) - { - // No such device - UnlockList(unix_vlan); - return false; - } - - GenerateTunName(name, "vpn", eth_name, sizeof(eth_name)); - Zero(&ifr, sizeof(ifr)); - StrCpy(ifr.ifr_name, sizeof(ifr.ifr_name), eth_name); - - s = socket(AF_INET, SOCK_DGRAM, 0); - if (s == -1) - { - // Failed to create socket - UnlockList(unix_vlan); - return false; - } - - ioctl(s, SIOCGIFFLAGS, &ifr); - if (state_up) - { - ifr.ifr_flags |= IFF_UP; - } - else - { - ifr.ifr_flags &= ~IFF_UP; - } - result = ioctl(s, SIOCSIFFLAGS, &ifr); - close(s); - } - UnlockList(unix_vlan); -#endif // UNIX_LINUX - - return true; -} - -// Enumerate VLANs -TOKEN_LIST *UnixVLanEnum() -{ - TOKEN_LIST *ret; - UINT i; - if (unix_vlan == NULL) - { - return NullToken(); - } - - ret = ZeroMalloc(sizeof(TOKEN_LIST)); - - LockList(unix_vlan); - { - ret->NumTokens = LIST_NUM(unix_vlan); - ret->Token = ZeroMalloc(sizeof(char *) * ret->NumTokens); - - for (i = 0;i < ret->NumTokens;i++) - { - UNIX_VLAN_LIST *t = LIST_DATA(unix_vlan, i); - - ret->Token[i] = CopyStr(t->Name); - } - } - UnlockList(unix_vlan); - - return ret; -} - -// Delete the VLAN -void UnixVLanDelete(char *name) -{ - // Validate arguments - if (name == NULL || unix_vlan == NULL) - { - return; - } - - LockList(unix_vlan); - { - UINT i; - UNIX_VLAN_LIST *t, tt; - - Zero(&tt, sizeof(tt)); - StrCpy(tt.Name, sizeof(tt.Name), name); - - t = Search(unix_vlan, &tt); - if (t != NULL) - { - UnixCloseTapDevice(t->fd); - Delete(unix_vlan, t); - Free(t); - } - } - UnlockList(unix_vlan); -} - -// Get the VLAN -int UnixVLanGet(char *name) -{ - int fd = -1; - // Validate arguments - if (name == NULL || unix_vlan == NULL) - { - return -1; - } - - LockList(unix_vlan); - { - UINT i; - UNIX_VLAN_LIST *t, tt; - - Zero(&tt, sizeof(tt)); - StrCpy(tt.Name, sizeof(tt.Name), name); - - t = Search(unix_vlan, &tt); - if (t != NULL) - { - fd = t->fd; - } - } - UnlockList(unix_vlan); - - return fd; -} - -// Release the VLAN list -void UnixVLanFree() -{ - UINT i; - - for (i = 0;i < LIST_NUM(unix_vlan);i++) - { - UNIX_VLAN_LIST *t = LIST_DATA(unix_vlan, i); - - UnixCloseTapDevice(t->fd); - Free(t); - } - - ReleaseList(unix_vlan); - unix_vlan = NULL; -} - -#endif // OS_UNIX - -#endif // VLAN_C - +// SoftEther VPN Source Code - Developer Edition Master Branch +// Cedar Communication Module + + +// VLanUnix.c +// Virtual device driver library for UNIX + +#include + +#ifdef VLAN_C + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#ifdef UNIX_BSD +#ifdef UNIX_OPENBSD +#include +#else // UNIX_OPENBSD +#include +#endif // UNIX_OPENBSD +#endif // UNIX_BSD + +#ifdef OS_UNIX + +static LIST *unix_vlan = NULL; + +#ifndef NO_VLAN + +// Get the PACKET_ADAPTER +PACKET_ADAPTER *VLanGetPacketAdapter() +{ + PACKET_ADAPTER *pa; + + pa = NewPacketAdapter(VLanPaInit, VLanPaGetCancel, + VLanPaGetNextPacket, VLanPaPutPacket, VLanPaFree); + if (pa == NULL) + { + return NULL; + } + + return pa; +} + +// PA initialization +bool VLanPaInit(SESSION *s) +{ + VLAN *v; + // Validate arguments + if (s == NULL) + { + return false; + } + + // Connect to the driver + v = NewVLan(s->ClientOption->DeviceName, NULL); + if (v == NULL) + { + // Failure + return false; + } + + s->PacketAdapter->Param = v; + + return true; +} + +// Get the cancel object +CANCEL *VLanPaGetCancel(SESSION *s) +{ + VLAN *v; + // Validate arguments + if ((s == NULL) || ((v = s->PacketAdapter->Param) == NULL)) + { + return NULL; + } + + return VLanGetCancel(v); +} + +// Release the packet adapter +void VLanPaFree(SESSION *s) +{ + VLAN *v; + // Validate arguments + if ((s == NULL) || ((v = s->PacketAdapter->Param) == NULL)) + { + return; + } + + // End the virtual LAN card + FreeVLan(v); + + s->PacketAdapter->Param = NULL; +} + +// Write a packet +bool VLanPaPutPacket(SESSION *s, void *data, UINT size) +{ + VLAN *v; + // Validate arguments + if ((s == NULL) || ((v = s->PacketAdapter->Param) == NULL)) + { + return false; + } + + return VLanPutPacket(v, data, size); +} + +// Get the next packet +UINT VLanPaGetNextPacket(SESSION *s, void **data) +{ + VLAN *v; + UINT size; + // Validate arguments + if (data == NULL || (s == NULL) || ((v = s->PacketAdapter->Param) == NULL)) + { + return INFINITE; + } + + if (VLanGetNextPacket(v, data, &size) == false) + { + return INFINITE; + } + + return size; +} + +// Write a packet to the virtual LAN card +bool VLanPutPacket(VLAN *v, void *buf, UINT size) +{ + UINT ret; + // Validate arguments + if (v == NULL) + { + return false; + } + if (v->Halt) + { + return false; + } + if (size > MAX_PACKET_SIZE) + { + return false; + } + if (buf == NULL || size == 0) + { + if (buf != NULL) + { + Free(buf); + } + return true; + } + + ret = write(v->fd, buf, size); + + if (ret >= 1) + { + Free(buf); + return true; + } + + if (errno == EAGAIN || ret == 0) + { + Free(buf); + return true; + } + + return false; +} + +// Get the next packet from the virtual LAN card +bool VLanGetNextPacket(VLAN *v, void **buf, UINT *size) +{ + UCHAR tmp[TAP_READ_BUF_SIZE]; + int ret; + // Validate arguments + if (v == NULL || buf == NULL || size == 0) + { + return false; + } + if (v->Halt) + { + return false; + } + + // Read + ret = read(v->fd, tmp, sizeof(tmp)); + + if (ret == 0 || + (ret == -1 && errno == EAGAIN)) + { + // No packet + *buf = NULL; + *size = 0; + return true; + } + else if (ret == -1 || ret > TAP_READ_BUF_SIZE) + { + // Error + return false; + } + else + { + // Reading packet success + *buf = Malloc(ret); + Copy(*buf, tmp, ret); + *size = ret; + return true; + } +} + +// Get the cancel object +CANCEL *VLanGetCancel(VLAN *v) +{ + CANCEL *c; + int fd; + int yes = 0; + // Validate arguments + if (v == NULL) + { + return NULL; + } + + c = NewCancel(); + UnixDeletePipe(c->pipe_read, c->pipe_write); + c->pipe_read = c->pipe_write = -1; + + fd = v->fd; + + UnixSetSocketNonBlockingMode(fd, true); + + c->SpecialFlag = true; + c->pipe_read = fd; + + return c; +} + +// Close the Virtual LAN card +void FreeVLan(VLAN *v) +{ + // Validate arguments + if (v == NULL) + { + return; + } + + Free(v->InstanceName); + + Free(v); +} + +// Create a tap +VLAN *NewTap(char *name, char *mac_address, bool create_up) +{ + int fd; + VLAN *v; + // Validate arguments + if (name == NULL || mac_address == NULL) + { + return NULL; + } + + fd = UnixCreateTapDeviceEx(name, "tap", mac_address, create_up); + if (fd == -1) + { + return NULL; + } + + v = ZeroMalloc(sizeof(VLAN)); + v->Halt = false; + v->InstanceName = CopyStr(name); + v->fd = fd; + + return v; +} + +// Close the tap +void FreeTap(VLAN *v) +{ + // Validate arguments + if (v == NULL) + { + return; + } + + close(v->fd); + FreeVLan(v); +} + +// Get the Virtual LAN card list +VLAN *NewVLan(char *instance_name, VLAN_PARAM *param) +{ + int fd; + VLAN *v; + // Validate arguments + if (instance_name == NULL) + { + return NULL; + } + + // Open the tap + fd = UnixVLanGet(instance_name); + if (fd == -1) + { + return NULL; + } + + v = ZeroMalloc(sizeof(VLAN)); + v->Halt = false; + v->InstanceName = CopyStr(instance_name); + v->fd = fd; + + return v; +} + +// Generate TUN interface name +void GenerateTunName(char *name, char *prefix, char *tun_name, size_t tun_name_len) +{ + char instance_name_lower[MAX_SIZE]; + + // Generate the device name + StrCpy(instance_name_lower, sizeof(instance_name_lower), name); + Trim(instance_name_lower); + StrLower(instance_name_lower); + Format(tun_name, tun_name_len, "%s_%s", prefix, instance_name_lower); + + tun_name[15] = 0; +} +// Create a tap device +int UnixCreateTapDeviceEx(char *name, char *prefix, UCHAR *mac_address, bool create_up) +{ + int fd = -1, s = -1; + char tap_name[MAX_SIZE], tap_path[MAX_SIZE]; + struct ifreq ifr; + + // Validate arguments + if (name == NULL) + { + return -1; + } + + GenerateTunName(name, prefix, tap_name, sizeof(tap_name)); + + // Open the tun / tap +#ifndef UNIX_BSD + if (GetOsInfo()->OsType == OSTYPE_LINUX) + { + // Linux + if (IsFile(TAP_FILENAME_1) == false) + { + char tmp[MAX_SIZE]; + + Format(tmp, sizeof(tmp), "%s c 10 200", TAP_FILENAME_1); + Run("mknod", tmp, true, true); + + Format(tmp, sizeof(tmp), "600 %s", TAP_FILENAME_1); + Run("chmod", tmp, true, true); + } + } + + fd = open(TAP_FILENAME_1, O_RDWR); + if (fd == -1) + { + // Failure + fd = open(TAP_FILENAME_2, O_RDWR); + if (fd == -1) + { + return -1; + } + } +#else // UNIX_BSD + { + sprintf(tap_path, "%s", TAP_DIR TAP_NAME); + for (int i = 0; i < TAP_MAX; i++) { + sprintf(tap_path + StrLen(TAP_DIR TAP_NAME), "%d", i); + fd = open(tap_path, O_RDWR); + if (fd != -1) + { + break; + } + } + + if (fd == -1) + { + return -1; + } + } +#endif // UNIX_BSD + +#ifdef UNIX_LINUX + // Create a TAP device for Linux + + // Set the name and the flags + Zero(&ifr, sizeof(ifr)); + StrCpy(ifr.ifr_name, sizeof(ifr.ifr_name), tap_name); + ifr.ifr_flags = IFF_TAP | IFF_NO_PI; + + if (ioctl(fd, TUNSETIFF, &ifr) == -1) + { + // Failure + close(fd); + return -1; + } + + s = socket(AF_INET, SOCK_DGRAM, 0); + if (s != -1) + { + // Set the MAC address + if (mac_address != NULL) + { + Zero(&ifr, sizeof(ifr)); + StrCpy(ifr.ifr_name, sizeof(ifr.ifr_name), tap_name); + ifr.ifr_hwaddr.sa_family = ARPHRD_ETHER; + Copy(&ifr.ifr_hwaddr.sa_data, mac_address, ETHER_ADDR_LEN); + ioctl(s, SIOCSIFHWADDR, &ifr); + } + + if (create_up) + { + Zero(&ifr, sizeof(ifr)); + StrCpy(ifr.ifr_name, sizeof(ifr.ifr_name), tap_name); + ioctl(s, SIOCGIFFLAGS, &ifr); + ifr.ifr_flags |= IFF_UP; + ioctl(s, SIOCSIFFLAGS, &ifr); + } + + close(s); + } +#endif // UNIX_LINUX + +#ifdef UNIX_BSD + // Create a TAP device for BSD + Zero(&ifr, sizeof(ifr)); + + // Get the current name + StrCpy(ifr.ifr_name, sizeof(ifr.ifr_name), tap_path + StrLen(TAP_DIR)); + + s = socket(AF_INET, SOCK_DGRAM, 0); + if (s != -1) + { + // Set the name, if possible +#ifdef SIOCSIFNAME + ifr.ifr_data = tap_name; + ioctl(s, SIOCSIFNAME, &ifr); +#else // SIOCSIFNAME + StrCpy(tap_name, sizeof(tap_name), ifr.ifr_name); +#endif // SIOCSIFNAME + + // Set the MAC address + if (mac_address != NULL) + { + Zero(&ifr, sizeof(ifr)); + StrCpy(ifr.ifr_name, sizeof(ifr.ifr_name), tap_name); + ifr.ifr_addr.sa_len = ETHER_ADDR_LEN; + ifr.ifr_addr.sa_family = AF_LINK; + Copy(&ifr.ifr_addr.sa_data, mac_address, ETHER_ADDR_LEN); + ioctl(s, SIOCSIFLLADDR, &ifr); + } + + if (create_up) + { + Zero(&ifr, sizeof(ifr)); + StrCpy(ifr.ifr_name, sizeof(ifr.ifr_name), tap_name); + ioctl(s, SIOCGIFFLAGS, &ifr); + ifr.ifr_flags |= IFF_UP; + ioctl(s, SIOCSIFFLAGS, &ifr); + } + + close(s); + } +#endif // UNIX_BSD + +#ifdef UNIX_SOLARIS + // Create a TAP device for Solaris + { + int ip_fd; + int tun_fd; + int ppa; + + tun_fd = open(tap_name, O_RDWR); + if (tun_fd == -1) + { + // Failure + close(fd); + return -1; + } + + ip_fd = open("/dev/ip", O_RDWR); + if (ip_fd == -1) + { + // Failure + close(tun_fd); + close(fd); + return -1; + } + + ppa = -1; + ppa = ioctl(tun_fd, TUNNEWPPA, ppa); + if (ppa == -1) + { + // Failure + close(tun_fd); + close(fd); + close(ip_fd); + return -1; + } + + if (ioctl(fd, I_PUSH, "ip") < 0) + { + // Failure + close(tun_fd); + close(fd); + close(ip_fd); + return -1; + } + + if (ioctl(fd, IF_UNITSEL, (char *)&ppa) < 0) + { + // Failure + close(tun_fd); + close(fd); + close(ip_fd); + return -1; + } + + if (ioctl(ip_fd, I_LINK, fd) < 0) + { + // Failure + close(tun_fd); + close(fd); + close(ip_fd); + return -1; + } + + close(tun_fd); + close(ip_fd); + } +#endif // UNIX_SOLARIS + + return fd; +} +int UnixCreateTapDevice(char *name, UCHAR *mac_address, bool create_up) +{ + return UnixCreateTapDeviceEx(name, "vpn", mac_address, create_up); +} + +// Close the tap device +void UnixCloseTapDevice(int fd) +{ + // Validate arguments + if (fd == -1) + { + return; + } + + close(fd); +} + +#else // NO_VLAN + +void UnixCloseTapDevice(int fd) +{ +} + +int UnixCreateTapDeviceEx(char *name, char *prefix, UCHAR *mac_address, bool create_up) +{ + return -1; +} +int UnixCreateTapDevice(char *name, UCHAR *mac_address, bool create_up) +{ + return -1; +} + +#endif // NO_VLAN + +// Comparison of the VLAN list entries +int UnixCompareVLan(void *p1, void *p2) +{ + UNIX_VLAN_LIST *v1, *v2; + if (p1 == NULL || p2 == NULL) + { + return 0; + } + v1 = *(UNIX_VLAN_LIST **)p1; + v2 = *(UNIX_VLAN_LIST **)p2; + if (v1 == NULL || v2 == NULL) + { + return 0; + } + + return StrCmpi(v1->Name, v2->Name); +} + +// Initialize the VLAN list +void UnixVLanInit() +{ + unix_vlan = NewList(UnixCompareVLan); +} + +// Create a VLAN +bool UnixVLanCreateEx(char *name, char *prefix, UCHAR *mac_address, bool create_up) +{ + // Validate arguments + char tmp[MAX_SIZE]; + if (name == NULL) + { + return false; + } + + StrCpy(tmp, sizeof(tmp), name); + Trim(tmp); + name = tmp; + + LockList(unix_vlan); + { + UNIX_VLAN_LIST *t, tt; + int fd; + + // Check whether a device with the same name exists + Zero(&tt, sizeof(tt)); + StrCpy(tt.Name, sizeof(tt.Name), name); + + t = Search(unix_vlan, &tt); + if (t != NULL) + { + // Already exist + UnlockList(unix_vlan); + return false; + } + + // Create a tap device + fd = UnixCreateTapDeviceEx(name, prefix, mac_address, create_up); + if (fd == -1) + { + // Failure to create + UnlockList(unix_vlan); + return false; + } + + t = ZeroMalloc(sizeof(UNIX_VLAN_LIST)); + t->fd = fd; + StrCpy(t->Name, sizeof(t->Name), name); + + Insert(unix_vlan, t); + } + UnlockList(unix_vlan); + + return true; +} +bool UnixVLanCreate(char *name, UCHAR *mac_address, bool create_up) +{ + return UnixVLanCreateEx(name, "vpn", mac_address, create_up); +} + +// Set a VLAN up/down +bool UnixVLanSetState(char* name, bool state_up) +{ +#ifdef UNIX_LINUX + UNIX_VLAN_LIST *t, tt; + struct ifreq ifr; + int s; + char eth_name[MAX_SIZE]; + + LockList(unix_vlan); + { + int result; + // Find a device with the same name + Zero(&tt, sizeof(tt)); + StrCpy(tt.Name, sizeof(tt.Name), name); + + t = Search(unix_vlan, &tt); + if (t == NULL) + { + // No such device + UnlockList(unix_vlan); + return false; + } + + GenerateTunName(name, "vpn", eth_name, sizeof(eth_name)); + Zero(&ifr, sizeof(ifr)); + StrCpy(ifr.ifr_name, sizeof(ifr.ifr_name), eth_name); + + s = socket(AF_INET, SOCK_DGRAM, 0); + if (s == -1) + { + // Failed to create socket + UnlockList(unix_vlan); + return false; + } + + ioctl(s, SIOCGIFFLAGS, &ifr); + if (state_up) + { + ifr.ifr_flags |= IFF_UP; + } + else + { + ifr.ifr_flags &= ~IFF_UP; + } + result = ioctl(s, SIOCSIFFLAGS, &ifr); + close(s); + } + UnlockList(unix_vlan); +#endif // UNIX_LINUX + + return true; +} + +// Enumerate VLANs +TOKEN_LIST *UnixVLanEnum() +{ + TOKEN_LIST *ret; + UINT i; + if (unix_vlan == NULL) + { + return NullToken(); + } + + ret = ZeroMalloc(sizeof(TOKEN_LIST)); + + LockList(unix_vlan); + { + ret->NumTokens = LIST_NUM(unix_vlan); + ret->Token = ZeroMalloc(sizeof(char *) * ret->NumTokens); + + for (i = 0;i < ret->NumTokens;i++) + { + UNIX_VLAN_LIST *t = LIST_DATA(unix_vlan, i); + + ret->Token[i] = CopyStr(t->Name); + } + } + UnlockList(unix_vlan); + + return ret; +} + +// Delete the VLAN +void UnixVLanDelete(char *name) +{ + // Validate arguments + if (name == NULL || unix_vlan == NULL) + { + return; + } + + LockList(unix_vlan); + { + UINT i; + UNIX_VLAN_LIST *t, tt; + + Zero(&tt, sizeof(tt)); + StrCpy(tt.Name, sizeof(tt.Name), name); + + t = Search(unix_vlan, &tt); + if (t != NULL) + { + UnixCloseTapDevice(t->fd); + Delete(unix_vlan, t); + Free(t); + } + } + UnlockList(unix_vlan); +} + +// Get the VLAN +int UnixVLanGet(char *name) +{ + int fd = -1; + // Validate arguments + if (name == NULL || unix_vlan == NULL) + { + return -1; + } + + LockList(unix_vlan); + { + UINT i; + UNIX_VLAN_LIST *t, tt; + + Zero(&tt, sizeof(tt)); + StrCpy(tt.Name, sizeof(tt.Name), name); + + t = Search(unix_vlan, &tt); + if (t != NULL) + { + fd = t->fd; + } + } + UnlockList(unix_vlan); + + return fd; +} + +// Release the VLAN list +void UnixVLanFree() +{ + UINT i; + + for (i = 0;i < LIST_NUM(unix_vlan);i++) + { + UNIX_VLAN_LIST *t = LIST_DATA(unix_vlan, i); + + UnixCloseTapDevice(t->fd); + Free(t); + } + + ReleaseList(unix_vlan); + unix_vlan = NULL; +} + +#endif // OS_UNIX + +#endif // VLAN_C + diff --git a/src/Cedar/VLanUnix.h b/src/Cedar/VLanUnix.h index 04b1c8d3..40949868 100644 --- a/src/Cedar/VLanUnix.h +++ b/src/Cedar/VLanUnix.h @@ -1,66 +1,66 @@ -// SoftEther VPN Source Code - Developer Edition Master Branch -// Cedar Communication Module - - -// VLanUnix.h -// Header of VLanUnix.c - -#ifndef VLANUNIX_H -#define VLANUNIX_H - -// Constant -#define TAP_READ_BUF_SIZE 1600 - -#ifndef NO_VLAN - -// VLAN structure -struct VLAN -{ - volatile bool Halt; // Halt flag - char *InstanceName; // Instance name - int fd; // File -}; - -// Function prototype -VLAN *NewVLan(char *instance_name, VLAN_PARAM *param); -VLAN *NewTap(char *name, char *mac_address, bool create_up); -void FreeVLan(VLAN *v); -void FreeTap(VLAN *v); -CANCEL *VLanGetCancel(VLAN *v); -bool VLanGetNextPacket(VLAN *v, void **buf, UINT *size); -bool VLanPutPacket(VLAN *v, void *buf, UINT size); - -PACKET_ADAPTER *VLanGetPacketAdapter(); -bool VLanPaInit(SESSION *s); -CANCEL *VLanPaGetCancel(SESSION *s); -UINT VLanPaGetNextPacket(SESSION *s, void **data); -bool VLanPaPutPacket(SESSION *s, void *data, UINT size); -void VLanPaFree(SESSION *s); - -#else // NO_VLAN - -#define VLanGetPacketAdapter NullGetPacketAdapter - -#endif // NO_VLAN - -struct UNIX_VLAN_LIST -{ - char Name[MAX_SIZE]; // Device name - int fd; // fd -}; - -int UnixCreateTapDevice(char *name, UCHAR *mac_address, bool create_up); -int UnixCreateTapDeviceEx(char *name, char *prefix, UCHAR *mac_address, bool create_up); -void UnixCloseTapDevice(int fd); -void UnixVLanInit(); -void UnixVLanFree(); -bool UnixVLanCreate(char *name, UCHAR *mac_address, bool create_up); -bool UnixVLanCreateEx(char *name, char *prefix, UCHAR *mac_address, bool create_up); -TOKEN_LIST *UnixVLanEnum(); -void UnixVLanDelete(char *name); -bool UnixVLanSetState(char* name, bool state_up); -int UnixVLanGet(char *name); -int UnixCompareVLan(void *p1, void *p2); - -#endif // VLANUNIX_H - +// SoftEther VPN Source Code - Developer Edition Master Branch +// Cedar Communication Module + + +// VLanUnix.h +// Header of VLanUnix.c + +#ifndef VLANUNIX_H +#define VLANUNIX_H + +// Constant +#define TAP_READ_BUF_SIZE 1600 + +#ifndef NO_VLAN + +// VLAN structure +struct VLAN +{ + volatile bool Halt; // Halt flag + char *InstanceName; // Instance name + int fd; // File +}; + +// Function prototype +VLAN *NewVLan(char *instance_name, VLAN_PARAM *param); +VLAN *NewTap(char *name, char *mac_address, bool create_up); +void FreeVLan(VLAN *v); +void FreeTap(VLAN *v); +CANCEL *VLanGetCancel(VLAN *v); +bool VLanGetNextPacket(VLAN *v, void **buf, UINT *size); +bool VLanPutPacket(VLAN *v, void *buf, UINT size); + +PACKET_ADAPTER *VLanGetPacketAdapter(); +bool VLanPaInit(SESSION *s); +CANCEL *VLanPaGetCancel(SESSION *s); +UINT VLanPaGetNextPacket(SESSION *s, void **data); +bool VLanPaPutPacket(SESSION *s, void *data, UINT size); +void VLanPaFree(SESSION *s); + +#else // NO_VLAN + +#define VLanGetPacketAdapter NullGetPacketAdapter + +#endif // NO_VLAN + +struct UNIX_VLAN_LIST +{ + char Name[MAX_SIZE]; // Device name + int fd; // fd +}; + +int UnixCreateTapDevice(char *name, UCHAR *mac_address, bool create_up); +int UnixCreateTapDeviceEx(char *name, char *prefix, UCHAR *mac_address, bool create_up); +void UnixCloseTapDevice(int fd); +void UnixVLanInit(); +void UnixVLanFree(); +bool UnixVLanCreate(char *name, UCHAR *mac_address, bool create_up); +bool UnixVLanCreateEx(char *name, char *prefix, UCHAR *mac_address, bool create_up); +TOKEN_LIST *UnixVLanEnum(); +void UnixVLanDelete(char *name); +bool UnixVLanSetState(char* name, bool state_up); +int UnixVLanGet(char *name); +int UnixCompareVLan(void *p1, void *p2); + +#endif // VLANUNIX_H + diff --git a/src/Cedar/VLanWin32.c b/src/Cedar/VLanWin32.c index 5932af27..773aa664 100644 --- a/src/Cedar/VLanWin32.c +++ b/src/Cedar/VLanWin32.c @@ -1,1514 +1,1514 @@ -// SoftEther VPN Source Code - Developer Edition Master Branch -// Cedar Communication Module - - -// VLanWin32.c -// Virtual device driver library for Win32 - -#include - -#ifdef VLAN_C - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#ifdef OS_WIN32 - -typedef DWORD(CALLBACK* OPENVXDHANDLE)(HANDLE); - -// Get the version information of Windows -void Win32GetWinVer(RPC_WINVER *v) -{ - // Validate arguments - if (v == NULL) - { - return; - } - - Zero(v, sizeof(RPC_WINVER)); - - v->IsWindows = true; - - if (OS_IS_WINDOWS_NT(GetOsType()) == false) - { - // Windows 9x - OSVERSIONINFO os; - Zero(&os, sizeof(os)); - os.dwOSVersionInfoSize = sizeof(os); - GetVersionEx(&os); - - v->Build = LOWORD(os.dwBuildNumber); - v->VerMajor = os.dwMajorVersion; - v->VerMinor = os.dwMinorVersion; - - Format(v->Title, sizeof(v->Title), "%s %s", - GetOsInfo()->OsProductName, - GetOsInfo()->OsVersion); - Trim(v->Title); - } - else - { - // Windows NT 4.0 SP6 or later - OSVERSIONINFOEX os; - Zero(&os, sizeof(os)); - os.dwOSVersionInfoSize = sizeof(os); - Win32GetVersionExInternal((LPOSVERSIONINFOA)&os); - - v->IsNT = true; - v->Build = os.dwBuildNumber; - v->ServicePack = os.wServicePackMajor; - - if (os.wProductType != VER_NT_WORKSTATION) - { - v->IsServer = true; - } - v->VerMajor = os.dwMajorVersion; - v->VerMinor = os.dwMinorVersion; - - if (GetOsInfo()->OsServicePack == 0) - { - StrCpy(v->Title, sizeof(v->Title), GetOsInfo()->OsProductName); - } - else - { - Format(v->Title, sizeof(v->Title), "%s Service Pack %u", - GetOsInfo()->OsProductName, - GetOsInfo()->OsServicePack); - } - Trim(v->Title); - - if (InStr(GetOsInfo()->OsVersion, "rc") || - InStr(GetOsInfo()->OsVersion, "beta")) - { - v->IsBeta = true; - } - } -} - -// Release the DHCP addresses of all virtual LAN cards -void Win32ReleaseAllDhcp9x(bool wait) -{ - TOKEN_LIST *t; - UINT i; - - t = MsEnumNetworkAdapters(VLAN_ADAPTER_NAME, VLAN_ADAPTER_NAME_OLD); - if (t == NULL) - { - return; - } - - for (i = 0;i < t->NumTokens;i++) - { - char *name = t->Token[i]; - UINT id = GetInstanceId(name); - if (id != 0) - { - Win32ReleaseDhcp9x(id, wait); - } - } - - FreeToken(t); -} - -// Routing table tracking main -void RouteTrackingMain(SESSION *s) -{ - ROUTE_TRACKING *t; - UINT64 now; - ROUTE_TABLE *table; - ROUTE_ENTRY *rs; - bool changed = false; - bool check = false; - bool any_modified = false; - // Validate arguments - if (s == NULL) - { - return; - } - if (s->ClientModeAndUseVLan == false) - { - return; - } - - // Get the state - t = ((VLAN *)s->PacketAdapter->Param)->RouteState; - if (t == NULL) - { - return; - } - - // Current time - PROBE_STR("RouteTrackingMain 1"); - now = Tick64(); - - if (t->RouteChange != NULL) - { - if (t->NextRouteChangeCheckTime == 0 || - t->NextRouteChangeCheckTime <= now) - { - t->NextRouteChangeCheckTime = now + 1000ULL; - - check = IsRouteChanged(t->RouteChange); - - if (check) - { - Debug("*** Routing Table Changed ***\n"); - t->NextTrackingTime = 0; - } - } - } - if (t->NextTrackingTime != 0 && t->NextTrackingTime > now) - { - if (s->UseUdpAcceleration && s->UdpAccel != NULL && s->UdpAccel->NatT_IP_Changed) - { - // Check always if the IP address of the NAT-T server has changed - } - else - { - PROBE_STR("RouteTrackingMain 2"); - return; - } - } - PROBE_STR("RouteTrackingMain 3"); - - if (s->UseUdpAcceleration && s->UdpAccel != NULL) - { - IP nat_t_ip; - - s->UdpAccel->NatT_IP_Changed = false; - - Zero(&nat_t_ip, sizeof(nat_t_ip)); - - Lock(s->UdpAccel->NatT_Lock); - { - Copy(&nat_t_ip, &s->UdpAccel->NatT_IP, sizeof(IP)); - } - Unlock(s->UdpAccel->NatT_Lock); - - // Add a route to the NAT-T server - if (IsZeroIp(&nat_t_ip) == false) - { - if (t->RouteToNatTServer == NULL) - { - if (t->RouteToEight != NULL) - { - ROUTE_ENTRY *e = Clone(t->RouteToEight, sizeof(ROUTE_ENTRY)); - char ip_str[64]; - char ip_str2[64]; - - Copy(&e->DestIP, &nat_t_ip, sizeof(IP)); - e->Metric = e->OldIfMetric; - - IPToStr(ip_str, sizeof(ip_str), &e->DestIP); - IPToStr(ip_str2, sizeof(ip_str2), &e->GatewayIP); - - t->RouteToNatTServer = e; - - if (AddRouteEntry(t->RouteToNatTServer)) - { - Debug("Adding Static Route to %s via %s metric %u: ok.\n", ip_str, ip_str2, e->Metric); - } - else - { - FreeRouteEntry(t->RouteToNatTServer); - t->RouteToNatTServer = NULL; - } - } - } - } - } - - // Get the current routing table - table = GetRouteTable(); - rs = t->RouteToServer; - if (table != NULL) - { - UINT i; - bool route_to_server_erased = true; - bool is_vlan_want_to_be_default_gateway = false; - UINT vlan_default_gateway_metric = 0; - UINT other_if_default_gateway_metric_min = INFINITE; - - // Get whether the routing table have been changed - if (t->LastRoutingTableHash != table->HashedValue) - { - t->LastRoutingTableHash = table->HashedValue; - changed = true; - } - - //DebugPrintRouteTable(table); - - // Scan the routing table - for (i = 0;i < table->NumEntry;i++) - { - ROUTE_ENTRY *e = table->Entry[i]; - - if (rs != NULL) - { - if (CmpIpAddr(&e->DestIP, &rs->DestIP) == 0 && - CmpIpAddr(&e->DestMask, &rs->DestMask) == 0 -// && CmpIpAddr(&e->GatewayIP, &rs->GatewayIP) == 0 -// && e->InterfaceID == rs->InterfaceID && -// e->LocalRouting == rs->LocalRouting && -// e->Metric == rs->Metric - ) - { - // Routing entry to the server that added at the time of connection is found - route_to_server_erased = false; - } - } - - // Search for the default gateway - if (IPToUINT(&e->DestIP) == 0 && - IPToUINT(&e->DestMask) == 0) - { - Debug("e->InterfaceID = %u, t->VLanInterfaceId = %u\n", - e->InterfaceID, t->VLanInterfaceId); - - if (e->InterfaceID == t->VLanInterfaceId) - { - // The virtual LAN card think that he want to be a default gateway - is_vlan_want_to_be_default_gateway = true; - vlan_default_gateway_metric = e->Metric; - - if (vlan_default_gateway_metric >= 2 && - t->OldDefaultGatewayMetric == (vlan_default_gateway_metric - 1)) - { - // Restore because the PPP server rewrites - // the routing table selfishly - DeleteRouteEntry(e); - e->Metric--; - AddRouteEntry(e); - Debug("** Restore metric destroyed by PPP.\n"); - - any_modified = true; - } - - // Keep this entry - if (t->DefaultGatewayByVLan != NULL) - { - // Delete if there is one added last time - FreeRouteEntry(t->DefaultGatewayByVLan); - } - - t->DefaultGatewayByVLan = ZeroMalloc(sizeof(ROUTE_ENTRY)); - Copy(t->DefaultGatewayByVLan, e, sizeof(ROUTE_ENTRY)); - - t->OldDefaultGatewayMetric = vlan_default_gateway_metric; - } - else - { - // There are default gateway other than the virtual LAN card - // Save the metric value of the default gateway - if (other_if_default_gateway_metric_min > e->Metric) - { - // Ignore the metric value of all PPP connection in the case of Windows Vista - if (MsIsVista() == false || e->PPPConnection == false) - { - other_if_default_gateway_metric_min = e->Metric; - } - else - { - // a PPP is used to Connect to the network - // in using Windows Vista - t->VistaAndUsingPPP = true; - } - } - } - } - } - - if (t->VistaAndUsingPPP) - { - if (t->DefaultGatewayByVLan != NULL) - { - if (is_vlan_want_to_be_default_gateway) - { - if (t->VistaOldDefaultGatewayByVLan == NULL || Cmp(t->VistaOldDefaultGatewayByVLan, t->DefaultGatewayByVLan, sizeof(ROUTE_ENTRY)) != 0) - { - ROUTE_ENTRY *e; - // Add the route of 0.0.0.0/1 and 128.0.0.0/1 - // to the system if the virtual LAN card should be - // the default gateway in the case of the connection - // using PPP in Windows Vista - - if (t->VistaOldDefaultGatewayByVLan != NULL) - { - FreeRouteEntry(t->VistaOldDefaultGatewayByVLan); - } - - if (t->VistaDefaultGateway1 != NULL) - { - DeleteRouteEntry(t->VistaDefaultGateway1); - FreeRouteEntry(t->VistaDefaultGateway1); - - DeleteRouteEntry(t->VistaDefaultGateway2); - FreeRouteEntry(t->VistaDefaultGateway2); - } - - t->VistaOldDefaultGatewayByVLan = Clone(t->DefaultGatewayByVLan, sizeof(ROUTE_ENTRY)); - - e = Clone(t->DefaultGatewayByVLan, sizeof(ROUTE_ENTRY)); - SetIP(&e->DestIP, 0, 0, 0, 0); - SetIP(&e->DestMask, 128, 0, 0, 0); - t->VistaDefaultGateway1 = e; - - e = Clone(t->DefaultGatewayByVLan, sizeof(ROUTE_ENTRY)); - SetIP(&e->DestIP, 128, 0, 0, 0); - SetIP(&e->DestMask, 128, 0, 0, 0); - t->VistaDefaultGateway2 = e; - - AddRouteEntry(t->VistaDefaultGateway1); - AddRouteEntry(t->VistaDefaultGateway2); - - Debug("Vista PPP Fix Route Table Added.\n"); - - any_modified = true; - } - } - else - { - if (t->VistaOldDefaultGatewayByVLan != NULL) - { - FreeRouteEntry(t->VistaOldDefaultGatewayByVLan); - t->VistaOldDefaultGatewayByVLan = NULL; - } - - if (t->VistaDefaultGateway1 != NULL) - { - Debug("Vista PPP Fix Route Table Deleted.\n"); - DeleteRouteEntry(t->VistaDefaultGateway1); - FreeRouteEntry(t->VistaDefaultGateway1); - - DeleteRouteEntry(t->VistaDefaultGateway2); - FreeRouteEntry(t->VistaDefaultGateway2); - - any_modified = true; - - t->VistaDefaultGateway1 = t->VistaDefaultGateway2 = NULL; - } - } - } - } - - // If the virtual LAN card want to be the default gateway and - // there is no LAN card with smaller metric of 0.0.0.0/0 than - // the virtual LAN card, delete other default gateway entries - // to elect the virtual LAN card as the default gateway -// Debug("is_vlan_want_to_be_default_gateway = %u, rs = %u, route_to_server_erased = %u, other_if_default_gateway_metric_min = %u, vlan_default_gateway_metric = %u\n", -// is_vlan_want_to_be_default_gateway, rs, route_to_server_erased, other_if_default_gateway_metric_min, vlan_default_gateway_metric); - if (is_vlan_want_to_be_default_gateway && (rs != NULL && route_to_server_erased == false) && - other_if_default_gateway_metric_min >= vlan_default_gateway_metric) - { - // Scan the routing table again - for (i = 0;i < table->NumEntry;i++) - { - ROUTE_ENTRY *e = table->Entry[i]; - - if (e->InterfaceID != t->VLanInterfaceId) - { - if (IPToUINT(&e->DestIP) == 0 && - IPToUINT(&e->DestMask) == 0) - { - char str[64]; - // Default gateway is found - ROUTE_ENTRY *r = ZeroMalloc(sizeof(ROUTE_ENTRY)); - - Copy(r, e, sizeof(ROUTE_ENTRY)); - - // Put in the queue - InsertQueue(t->DeletedDefaultGateway, r); - - // Delete this gateway entry once - DeleteRouteEntry(e); - - IPToStr(str, sizeof(str), &e->GatewayIP); - Debug("Default Gateway %s Deleted.\n", str); - - any_modified = true; - } - } - } - } - - if (rs != NULL && route_to_server_erased) - { - // Physical entry to the server has disappeared - Debug("Route to Server entry ERASED !!!\n"); - - // Forced disconnection (reconnection enabled) - s->RetryFlag = true; - s->Halt = true; - } - - // Release the routing table - FreeRouteTable(table); - } - - // Set the time to perform the next track - if (t->NextTrackingTimeAdd == 0 || changed) - { - t->NextTrackingTimeAdd = TRACKING_INTERVAL_INITIAL; - } - else - { - UINT64 max_value = TRACKING_INTERVAL_MAX; - if (t->RouteChange != NULL) - { - max_value = TRACKING_INTERVAL_MAX_RC; - } - - t->NextTrackingTimeAdd += TRACKING_INTERVAL_ADD; - - if (t->NextTrackingTimeAdd >= max_value) - { - t->NextTrackingTimeAdd = max_value; - } - } - //Debug("t->NextTrackingTimeAdd = %I64u\n", t->NextTrackingTimeAdd); - t->NextTrackingTime = now + t->NextTrackingTimeAdd; - - if (any_modified) - { - // Clear the DNS cache - Win32FlushDnsCache(); - } -} - -// Start tracking of the routing table -void RouteTrackingStart(SESSION *s) -{ - VLAN *v; - ROUTE_TRACKING *t; - UINT if_id = 0; - ROUTE_ENTRY *e; - ROUTE_ENTRY *dns = NULL; - ROUTE_ENTRY *route_to_real_server_global = NULL; - char tmp[64]; - UINT exclude_if_id = 0; - bool already_exists = false; - bool already_exists_by_other_account = false; - IP eight; - // Validate arguments - if (s == NULL) - { - return; - } - - v = (VLAN *)s->PacketAdapter->Param; - if (v->RouteState != NULL) - { - return; - } - - // Get the interface ID of the virtual LAN card - if_id = GetInstanceId(v->InstanceName); - Debug("[InstanceId of %s] = 0x%x\n", v->InstanceName, if_id); - - if (MsIsVista()) - { - // The routing table by the virtual LAN card body should be - // excluded explicitly in Windows Vista - exclude_if_id = if_id; - } - - // Get the route to the server - e = GetBestRouteEntryEx(&s->ServerIP, exclude_if_id); - if (e == NULL) - { - // Acquisition failure - Debug("Failed to get GetBestRouteEntry().\n"); - return; - } - IPToStr(tmp, sizeof(tmp), &e->GatewayIP); - Debug("GetBestRouteEntry() Succeed. [Gateway: %s]\n", tmp); - - // Add a route - if (MsIsVista()) - { - e->Metric = e->OldIfMetric; - } - if (AddRouteEntryEx(e, &already_exists) == false) - { - FreeRouteEntry(e); - e = NULL; - } - Debug("already_exists: %u\n", already_exists); - - if (already_exists) - { - if (s->Cedar->Client != NULL && s->Account != NULL) - { - UINT i; - ACCOUNT *a; - for (i = 0;i < LIST_NUM(s->Cedar->Client->AccountList);i++) - { - a = LIST_DATA(s->Cedar->Client->AccountList, i); - Lock(a->lock); - { - SESSION *sess = a->ClientSession; - if (sess != NULL && sess != s) - { - VLAN *v = sess->PacketAdapter->Param; - if (v != NULL) - { - ROUTE_TRACKING *tr = v->RouteState; - if (tr != NULL && e != NULL) - { - if (Cmp(tr->RouteToServer, e, sizeof(ROUTE_ENTRY)) == 0) - { - already_exists_by_other_account = true; - } - } - } - } - } - Unlock(a->lock); - } - } - - if (already_exists_by_other_account) - { - Debug("already_exists_by_other_account = %u\n", already_exists_by_other_account); - already_exists = false; - } - } - - // Get the routing table to the DNS server - // (If the DNS server is this PC itself, there's no need to get) - if (IsZeroIP(&s->DefaultDns) == false) - { - if (IsMyIPAddress(&s->DefaultDns) == false) - { - dns = GetBestRouteEntryEx(&s->DefaultDns, exclude_if_id); - if (dns == NULL) - { - // Getting failure - Debug("Failed to get GetBestRouteEntry DNS.\n"); - } - else - { - // Add a route - if (MsIsVista()) - { - dns->Metric = dns->OldIfMetric; - - if (AddRouteEntry(dns) == false) - { - FreeRouteEntry(dns); - dns = NULL; - } - } - } - } - } - - if (s->IsAzureSession && IsZeroIP(&s->AzureRealServerGlobalIp) == false) - { - // Add also a static route to the real server in the case of via VPN Azure - if (IsMyIPAddress(&s->AzureRealServerGlobalIp) == false) - { - route_to_real_server_global = GetBestRouteEntryEx(&s->AzureRealServerGlobalIp, exclude_if_id); - - if (route_to_real_server_global != NULL) - { - if (MsIsVista()) - { - route_to_real_server_global->Metric = route_to_real_server_global->OldIfMetric; - } - - if (AddRouteEntry(route_to_real_server_global) == false) - { - FreeRouteEntry(route_to_real_server_global); - route_to_real_server_global = NULL; - } - } - } - } - - // Initialize - if (s->Cedar->Client != NULL && s->Account != NULL) - { - Lock(s->Account->lock); - } - - t = ZeroMalloc(sizeof(ROUTE_TRACKING)); - v->RouteState = t; - - t->RouteToServerAlreadyExists = already_exists; - t->RouteToServer = e; - t->RouteToDefaultDns = dns; - t->RouteToRealServerGlobal = route_to_real_server_global; - t->VLanInterfaceId = if_id; - t->NextTrackingTime = 0; - t->DeletedDefaultGateway = NewQueue(); - t->OldDefaultGatewayMetric = 0x7fffffff; - - if (s->Cedar->Client != NULL && s->Account != NULL) - { - Unlock(s->Account->lock); - } - - // Get the route to 8.8.8.8 - SetIP(&eight, 8, 8, 8, 8); - t->RouteToEight = GetBestRouteEntryEx(&eight, exclude_if_id); - - // Get the current default DNS server to detect network changes - GetDefaultDns(&t->OldDnsServer); - - // Get as soon as releasing the IP address in the case of using DHCP - if (IsNt()) - { - char tmp[MAX_SIZE]; - MS_ADAPTER *a; - - Format(tmp, sizeof(tmp), VLAN_ADAPTER_NAME_TAG, v->InstanceName); - a = MsGetAdapter(tmp); - - if (a != NULL) - { - if (a->UseDhcp) - { - bool ret = Win32ReleaseAddressByGuidEx(a->Guid, 100); - Debug("*** Win32ReleaseAddressByGuidEx = %u\n", ret); - - ret = Win32RenewAddressByGuidEx(a->Guid, 100); - Debug("*** Win32RenewAddressByGuidEx = %u\n", ret); - } - - MsFreeAdapter(a); - } - } - else - { - // For Win9x - Win32RenewDhcp9x(if_id); - } - - // Clear the DNS cache - Win32FlushDnsCache(); - - // Detect a change in the routing table (for only supported OS) - t->RouteChange = NewRouteChange(); - Debug("t->RouteChange = 0x%p\n", t->RouteChange); -} - -// End the tracking of the routing table -void RouteTrackingStop(SESSION *s, ROUTE_TRACKING *t) -{ - ROUTE_ENTRY *e; - ROUTE_TABLE *table; - IP dns_ip; - bool network_has_changed = false; - bool do_not_delete_routing_entry = false; - // Validate arguments - if (s == NULL || t == NULL) - { - return; - } - - Zero(&dns_ip, sizeof(dns_ip)); - - // Remove the default gateway added by the virtual LAN card - if (MsIsVista() == false) - { - if (t->DefaultGatewayByVLan != NULL) - { - Debug("Default Gateway by VLAN was deleted.\n"); - DeleteRouteEntry(t->DefaultGatewayByVLan); - } - - if (t->VistaOldDefaultGatewayByVLan != NULL) - { - FreeRouteEntry(t->VistaOldDefaultGatewayByVLan); - } - } - - if (t->DefaultGatewayByVLan != NULL) - { - FreeRouteEntry(t->DefaultGatewayByVLan); - t->DefaultGatewayByVLan = NULL; - } - - if (t->VistaDefaultGateway1 != NULL) - { - Debug("Vista PPP Fix Route Table Deleted.\n"); - DeleteRouteEntry(t->VistaDefaultGateway1); - FreeRouteEntry(t->VistaDefaultGateway1); - - DeleteRouteEntry(t->VistaDefaultGateway2); - FreeRouteEntry(t->VistaDefaultGateway2); - } - - if (MsIsNt() == false) - { - // Only in the case of Windows 9x, release the DHCP address of the virtual LAN card - Win32ReleaseDhcp9x(t->VLanInterfaceId, false); - } - - // Clear the DNS cache - Win32FlushDnsCache(); - - if (s->Cedar->Client != NULL && s->Account != NULL) - { - UINT i; - ACCOUNT *a; - for (i = 0;i < LIST_NUM(s->Cedar->Client->AccountList);i++) - { - a = LIST_DATA(s->Cedar->Client->AccountList, i); - Lock(a->lock); - { - SESSION *sess = a->ClientSession; - if (sess != NULL && sess != s) - { - VLAN *v = sess->PacketAdapter->Param; - if (v != NULL) - { - ROUTE_TRACKING *tr = v->RouteState; - if (tr != NULL) - { - if (Cmp(tr->RouteToServer, t->RouteToServer, sizeof(ROUTE_ENTRY)) == 0) - { - do_not_delete_routing_entry = true; - } - } - } - } - } - Unlock(a->lock); - } - - Lock(s->Account->lock); - } - - if (do_not_delete_routing_entry == false) - { - // Delete the route that is added firstly - if (t->RouteToServerAlreadyExists == false) - { - DeleteRouteEntry(t->RouteToServer); - } - - DeleteRouteEntry(t->RouteToDefaultDns); - - DeleteRouteEntry(t->RouteToNatTServer); - - DeleteRouteEntry(t->RouteToRealServerGlobal); - } - - FreeRouteEntry(t->RouteToDefaultDns); - FreeRouteEntry(t->RouteToServer); - FreeRouteEntry(t->RouteToEight); - FreeRouteEntry(t->RouteToNatTServer); - FreeRouteEntry(t->RouteToRealServerGlobal); - t->RouteToDefaultDns = t->RouteToServer = t->RouteToEight = - t->RouteToNatTServer = t->RouteToRealServerGlobal = NULL; - - if (s->Cedar->Client != NULL && s->Account != NULL) - { - Unlock(s->Account->lock); - } - -#if 0 - // Get the current DNS server - if (GetDefaultDns(&dns_ip)) - { - if (IPToUINT(&t->OldDnsServer) != 0) - { - if (IPToUINT(&t->OldDnsServer) != IPToUINT(&dns_ip)) - { - char s1[MAX_SIZE], s2[MAX_SIZE]; - network_has_changed = true; - IPToStr(s1, sizeof(s1), &t->OldDnsServer); - IPToStr(s2, sizeof(s2), &dns_ip); - Debug("Old Dns: %s, New Dns: %s\n", - s1, s2); - } - } - } - - if (network_has_changed == false) - { - Debug("Network: not changed.\n"); - } - else - { - Debug("Network: Changed.\n"); - } - -#endif - - // Get the current routing table - table = GetRouteTable(); - - // Restore the routing table which has been removed so far - while (e = GetNext(t->DeletedDefaultGateway)) - { - bool restore = true; - UINT i; - // If the restoring routing entry is a default gateway and - // the existing routing table contains another default gateway - // on the interface, give up restoring the entry - if (IPToUINT(&e->DestIP) == 0 && IPToUINT(&e->DestMask) == 0) - { - for (i = 0;i < table->NumEntry;i++) - { - ROUTE_ENTRY *r = table->Entry[i]; - if (IPToUINT(&r->DestIP) == 0 && IPToUINT(&r->DestMask) == 0) - { - if (r->InterfaceID == e->InterfaceID) - { - restore = false; - } - } - } - if (network_has_changed) - { - restore = false; - } - } - - if (restore) - { - // Routing table restoration - AddRouteEntry(e); - } - - // Memory release - FreeRouteEntry(e); - } - - // Release - FreeRouteTable(table); - ReleaseQueue(t->DeletedDefaultGateway); - - FreeRouteChange(t->RouteChange); - - Free(t); -} - -// Get the instance ID of the virtual LAN card -UINT GetInstanceId(char *name) -{ - char tmp[MAX_SIZE]; - UINT id = 0; - // Validate arguments - if (name == NULL) - { - return 0; - } - - Format(tmp, sizeof(tmp), VLAN_ADAPTER_NAME_TAG, name); - - id = GetVLanInterfaceID(tmp); - if (id != 0) - { - return id; - } - else - { - Format(tmp, sizeof(tmp), VLAN_ADAPTER_NAME_TAG_OLD, name); - - id = GetVLanInterfaceID(tmp); - return id; - } -} - -// Get the instance list of virtual LAN card -INSTANCE_LIST *GetInstanceList() -{ - INSTANCE_LIST *n = ZeroMalloc(sizeof(INSTANCE_LIST)); - - // Enumeration - char **ss = EnumVLan(VLAN_ADAPTER_NAME); - - if (ss == NULL) - { - // Failure - n->NumInstance = 0; - n->InstanceName = Malloc(0); - return n; - } - else - { - UINT i, num; - i = num = 0; - while (true) - { - if (ss[i++] == NULL) - { - break; - } - num++; - } - i = 0; - n->NumInstance = num; - n->InstanceName = (char **)ZeroMalloc(sizeof(char *) * n->NumInstance); - for (i = 0;i < num;i++) - { - char *s = ss[i] + StrLen(VLAN_ADAPTER_NAME) + StrLen(" - "); - if (StrLen(ss[i]) > StrLen(VLAN_ADAPTER_NAME) + StrLen(" - ")) - { - n->InstanceName[i] = CopyStr(s); - } - } - FreeEnumVLan(ss); - } - - ss = EnumVLan(VLAN_ADAPTER_NAME_OLD); - if (ss != NULL) - { - UINT i, num, j; - - i = num = 0; - while (true) - { - if (ss[i++] == NULL) - { - break; - } - num++; - } - j = n->NumInstance; - n->NumInstance += num; - n->InstanceName = (char **)ReAlloc(n->InstanceName, sizeof(char) * n->NumInstance); - for (i = 0;i < num;i++) - { - char *s = ss[i] + StrLen(VLAN_ADAPTER_NAME_OLD) + StrLen(" - "); - if (StrLen(ss[i]) > StrLen(VLAN_ADAPTER_NAME_OLD) + StrLen(" - ")) - { - n->InstanceName[j] = CopyStr(s); - } - j++; - } - FreeEnumVLan(ss); - } - - return n; -} - -// Release the instance list -void FreeInstanceList(INSTANCE_LIST *n) -{ - UINT i; - // Validate arguments - if (n == NULL) - { - return; - } - - for (i = 0;i < n->NumInstance;i++) - { - Free(n->InstanceName[i]); - } - Free(n->InstanceName); - Free(n); -} - -// Release the packet adapter -void VLanPaFree(SESSION *s) -{ - VLAN *v; - ROUTE_TRACKING *t; - // Validate arguments - if ((s == NULL) || ((v = s->PacketAdapter->Param) == NULL)) - { - return; - } - - // Release the IP address if you are using DHCP - if (IsNt()) - { - char tmp[MAX_SIZE]; - MS_ADAPTER *a; - UINT64 now = Tick64(); - UINT64 suspend_tick = MsGetSuspendModeBeginTick(); - - if (suspend_tick == 0 || (suspend_tick + (UINT64)(30 * 1000)) < now) - { - Format(tmp, sizeof(tmp), VLAN_ADAPTER_NAME_TAG, v->InstanceName); - a = MsGetAdapter(tmp); - - if (a != NULL) - { - if (a->UseDhcp) - { - bool ret = Win32ReleaseAddressByGuidEx(a->Guid, 50); - Debug("*** Win32ReleaseAddressByGuid = %u\n", ret); - } - - MsFreeAdapter(a); - } - } - } - - t = v->RouteState; - // End the virtual LAN card - FreeVLan(v); - - // End the routing table tracking - if (s->ClientModeAndUseVLan) - { - RouteTrackingStop(s, t); - } - s->PacketAdapter->Param = NULL; -} - - -// Write a packet -bool VLanPaPutPacket(SESSION *s, void *data, UINT size) -{ - VLAN *v; - // Validate arguments - if ((s == NULL) || ((v = s->PacketAdapter->Param) == NULL)) - { - return false; - } - - return VLanPutPacket(v, data, size); -} - -// Get the next packet -UINT VLanPaGetNextPacket(SESSION *s, void **data) -{ - VLAN *v; - UINT size; - // Validate arguments - if (data == NULL || (s == NULL) || ((v = s->PacketAdapter->Param) == NULL)) - { - return 0; - } - - RouteTrackingMain(s); - - if (VLanGetNextPacket(v, data, &size) == false) - { - return INFINITE; - } - - return size; -} - -// Get the cancel object -CANCEL *VLanPaGetCancel(SESSION *s) -{ - VLAN *v; - // Validate arguments - if ((s == NULL) || ((v = s->PacketAdapter->Param) == NULL)) - { - return NULL; - } - - return VLanGetCancel(v); -} - -// Initialize the packet adapter -bool VLanPaInit(SESSION *s) -{ - VLAN *v; - // Validate arguments - if ((s == NULL)/* || (s->ServerMode != false) || (s->ClientOption == NULL)*/) - { - return false; - } - - // Get the IP address of the DNS server at the time just before the connection - if (s->ClientModeAndUseVLan) - { - Zero(&s->DefaultDns, sizeof(IP)); - GetDefaultDns(&s->DefaultDns); - } - - // Normalize the setting of interface metric of the default gateway - if (s->ClientModeAndUseVLan) - { - if (MsIsVista()) - { - MsNormalizeInterfaceDefaultGatewaySettings(VLAN_ADAPTER_NAME_TAG, s->ClientOption->DeviceName); - MsNormalizeInterfaceDefaultGatewaySettings(VLAN_ADAPTER_NAME_TAG_OLD, s->ClientOption->DeviceName); - } - } - - // Connect to the driver - v = NewVLan(s->ClientOption->DeviceName, NULL); - if (v == NULL) - { - // Failure - return false; - } - - s->PacketAdapter->Param = v; - - // Routing table tracking start - if (s->ClientModeAndUseVLan) - { - RouteTrackingStart(s); - } - - return true; -} - -// Get the packet adapter of the VLAN -PACKET_ADAPTER *VLanGetPacketAdapter() -{ - PACKET_ADAPTER *pa; - - pa = NewPacketAdapter(VLanPaInit, VLanPaGetCancel, - VLanPaGetNextPacket, VLanPaPutPacket, VLanPaFree); - if (pa == NULL) - { - return NULL; - } - - pa->Id = PACKET_ADAPTER_ID_VLAN_WIN32; - - return pa; -} - - -// Write the next received packet to the driver -bool VLanPutPacket(VLAN *v, void *buf, UINT size) -{ - // Validate arguments - if (v == NULL) - { - return false; - } - if (v->Halt) - { - return false; - } - if (size > MAX_PACKET_SIZE) - { - return false; - } - - // First, examine whether the current buffer is full - if ((NEO_NUM_PACKET(v->PutBuffer) >= NEO_MAX_PACKET_EXCHANGE) || - (buf == NULL && NEO_NUM_PACKET(v->PutBuffer) != 0)) - { -#ifdef USE_PROBE - { - char tmp[MAX_SIZE]; - snprintf(tmp, sizeof(tmp), "VLanPutPacket: NEO_NUM_PACKET(v->PutBuffer) = %u", NEO_NUM_PACKET(v->PutBuffer)); - PROBE_DATA2(tmp, NULL, 0); - } -#endif // USE_PROBE - // Write a packet to the driver - if (VLanPutPacketsToDriver(v) == false) - { - return false; - } - NEO_NUM_PACKET(v->PutBuffer) = 0; - } - - // Add the next packet to the buffer - if (buf != NULL) - { - UINT i = NEO_NUM_PACKET(v->PutBuffer); - NEO_NUM_PACKET(v->PutBuffer)++; - - NEO_SIZE_OF_PACKET(v->PutBuffer, i) = size; - Copy(NEO_ADDR_OF_PACKET(v->PutBuffer, i), buf, size); - Free(buf); - } - - return true; -} - -// Read the next sent packet from the driver -bool VLanGetNextPacket(VLAN *v, void **buf, UINT *size) -{ - // Validate arguments - if (v == NULL || buf == NULL || size == NULL) - { - return false; - } - if (v->Halt) - { - return false; - } - - PROBE_STR("VLanGetNextPacket"); - - while (true) - { - if (v->CurrentPacketCount < NEO_NUM_PACKET(v->GetBuffer)) - { - // There are still packets that have been read already - *size = NEO_SIZE_OF_PACKET(v->GetBuffer, v->CurrentPacketCount); - *buf = MallocFast(*size); - Copy(*buf, NEO_ADDR_OF_PACKET(v->GetBuffer, v->CurrentPacketCount), *size); - - // Increment the packet number - v->CurrentPacketCount++; - - return true; - } - else - { - // Read the next packet from the driver - if (VLanGetPacketsFromDriver(v) == false) - { - return false; - } - - if (NEO_NUM_PACKET(v->GetBuffer) == 0) - { - // Packet is not received currently - *buf = NULL; - *size = 0; - return true; - } - - v->CurrentPacketCount = 0; - } - } -} - -// Write all the current packets to the driver -bool VLanPutPacketsToDriver(VLAN *v) -{ - DWORD write_size; - // Validate arguments - if (v == NULL) - { - return false; - } - if (v->Halt) - { - return false; - } - - if (v->Win9xMode == false) - { - // Windows NT - PROBE_STR("VLanPutPacketsToDriver: WriteFile"); - if (WriteFile(v->Handle, v->PutBuffer, NEO_EXCHANGE_BUFFER_SIZE, &write_size, - NULL) == false) - { - v->Halt = true; - return false; - } - PROBE_STR("VLanPutPacketsToDriver: WriteFile Completed."); - - if (write_size != NEO_EXCHANGE_BUFFER_SIZE) - { - v->Halt = true; - return false; - } - } - else - { - // Windows 9x - if (DeviceIoControl(v->Handle, NEO_IOCTL_PUT_PACKET, v->PutBuffer, - NEO_EXCHANGE_BUFFER_SIZE, NULL, 0, &write_size, NULL) == false) - { - v->Halt = true; - return false; - } - } - - return true; -} - -// Read the next packet from the driver -bool VLanGetPacketsFromDriver(VLAN *v) -{ - DWORD read_size; - // Validate arguments - if (v == NULL) - { - return false; - } - if (v->Halt) - { - return false; - } - - if (v->Win9xMode == false) - { - // Windows NT - PROBE_STR("VLanGetPacketsFromDriver: ReadFile"); - if (ReadFile(v->Handle, v->GetBuffer, NEO_EXCHANGE_BUFFER_SIZE, - &read_size, NULL) == false) - { - v->Halt = true; - return false; - } - } - else - { - // Windows 9x - if (DeviceIoControl(v->Handle, NEO_IOCTL_GET_PACKET, NULL, 0, - v->GetBuffer, NEO_EXCHANGE_BUFFER_SIZE, &read_size, NULL) == false) - { - v->Halt = true; - return false; - } - } - - if (read_size != NEO_EXCHANGE_BUFFER_SIZE) - { - v->Halt = true; - return false; - } - - return true; -} - -// Get the cancel object -CANCEL *VLanGetCancel(VLAN *v) -{ - CANCEL *c; - // Validate arguments - if (v == NULL) - { - return NULL; - } - - // Create a cancel object - c = NewCancel(); - c->SpecialFlag = true; - CloseHandle(c->hEvent); - - c->hEvent = v->Event; - - return c; -} - -// Release the VLAN object -void FreeVLan(VLAN *v) -{ - // Validate arguments - if (v == NULL) - { - return; - } - - // Close the handle - CloseHandle(v->Event); - CloseHandle(v->Handle); - - // Memory release - Free(v->InstanceName); - Free(v->EventNameWin32); - Free(v->DeviceNameWin32); - Free(v->PutBuffer); - Free(v->GetBuffer); - Free(v); -} - -// Create a VLAN object -VLAN *NewVLan(char *instance_name, VLAN_PARAM *param) -{ - VLAN *v; - HANDLE h = INVALID_HANDLE_VALUE; - HANDLE e = INVALID_HANDLE_VALUE; - char tmp[MAX_SIZE]; - char name_upper[MAX_SIZE]; - // Validate arguments - if (instance_name == NULL) - { - return NULL; - } - - v = ZeroMalloc(sizeof(VLAN)); - - if (OS_IS_WINDOWS_9X(GetOsInfo()->OsType)) - { - v->Win9xMode = true; - } - - // Initialize the name - Format(name_upper, sizeof(name_upper), "%s", instance_name); - StrUpper(name_upper); - v->InstanceName = CopyStr(name_upper); - Format(tmp, sizeof(tmp), NDIS_NEO_DEVICE_FILE_NAME, v->InstanceName); - v->DeviceNameWin32 = CopyStr(tmp); - - if (v->Win9xMode == false) - { - Format(tmp, sizeof(tmp), NDIS_NEO_EVENT_NAME_WIN32, v->InstanceName); - v->EventNameWin32 = CopyStr(tmp); - } - - // Connect to the device - h = CreateFile(v->DeviceNameWin32, - GENERIC_READ | GENERIC_WRITE, - 0, - NULL, - OPEN_EXISTING, - 0, - NULL); - if (h == INVALID_HANDLE_VALUE) - { - // Connection failure - goto CLEANUP; - } - - if (v->Win9xMode == false) - { - // Connect to the event - e = OpenEvent(SYNCHRONIZE, FALSE, v->EventNameWin32); - if (e == INVALID_HANDLE_VALUE) - { - // Connection failure - goto CLEANUP; - } - } - else - { - OPENVXDHANDLE OpenVxDHandle; - DWORD vxd_handle; - UINT bytes_returned; - - OpenVxDHandle = (OPENVXDHANDLE)GetProcAddress(GetModuleHandle("KERNEL32"), - "OpenVxDHandle"); - - // Deliver to the driver by creating an event - e = CreateEvent(NULL, FALSE, FALSE, NULL); - vxd_handle = (DWORD)OpenVxDHandle(e); - - DeviceIoControl(h, NEO_IOCTL_SET_EVENT, &vxd_handle, sizeof(DWORD), - NULL, 0, &bytes_returned, NULL); - } - - v->Event = e; - v->Handle = h; - - v->GetBuffer = ZeroMalloc(NEO_EXCHANGE_BUFFER_SIZE); - v->PutBuffer = ZeroMalloc(NEO_EXCHANGE_BUFFER_SIZE); - - return v; - -CLEANUP: - if (h != INVALID_HANDLE_VALUE) - { - CloseHandle(h); - } - if (e != INVALID_HANDLE_VALUE) - { - CloseHandle(e); - } - - Free(v->InstanceName); - Free(v->EventNameWin32); - Free(v->DeviceNameWin32); - Free(v); - - return NULL; -} - -#endif // OS_WIN32 - -#endif //VLAN_C - +// SoftEther VPN Source Code - Developer Edition Master Branch +// Cedar Communication Module + + +// VLanWin32.c +// Virtual device driver library for Win32 + +#include + +#ifdef VLAN_C + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#ifdef OS_WIN32 + +typedef DWORD(CALLBACK* OPENVXDHANDLE)(HANDLE); + +// Get the version information of Windows +void Win32GetWinVer(RPC_WINVER *v) +{ + // Validate arguments + if (v == NULL) + { + return; + } + + Zero(v, sizeof(RPC_WINVER)); + + v->IsWindows = true; + + if (OS_IS_WINDOWS_NT(GetOsType()) == false) + { + // Windows 9x + OSVERSIONINFO os; + Zero(&os, sizeof(os)); + os.dwOSVersionInfoSize = sizeof(os); + GetVersionEx(&os); + + v->Build = LOWORD(os.dwBuildNumber); + v->VerMajor = os.dwMajorVersion; + v->VerMinor = os.dwMinorVersion; + + Format(v->Title, sizeof(v->Title), "%s %s", + GetOsInfo()->OsProductName, + GetOsInfo()->OsVersion); + Trim(v->Title); + } + else + { + // Windows NT 4.0 SP6 or later + OSVERSIONINFOEX os; + Zero(&os, sizeof(os)); + os.dwOSVersionInfoSize = sizeof(os); + Win32GetVersionExInternal((LPOSVERSIONINFOA)&os); + + v->IsNT = true; + v->Build = os.dwBuildNumber; + v->ServicePack = os.wServicePackMajor; + + if (os.wProductType != VER_NT_WORKSTATION) + { + v->IsServer = true; + } + v->VerMajor = os.dwMajorVersion; + v->VerMinor = os.dwMinorVersion; + + if (GetOsInfo()->OsServicePack == 0) + { + StrCpy(v->Title, sizeof(v->Title), GetOsInfo()->OsProductName); + } + else + { + Format(v->Title, sizeof(v->Title), "%s Service Pack %u", + GetOsInfo()->OsProductName, + GetOsInfo()->OsServicePack); + } + Trim(v->Title); + + if (InStr(GetOsInfo()->OsVersion, "rc") || + InStr(GetOsInfo()->OsVersion, "beta")) + { + v->IsBeta = true; + } + } +} + +// Release the DHCP addresses of all virtual LAN cards +void Win32ReleaseAllDhcp9x(bool wait) +{ + TOKEN_LIST *t; + UINT i; + + t = MsEnumNetworkAdapters(VLAN_ADAPTER_NAME, VLAN_ADAPTER_NAME_OLD); + if (t == NULL) + { + return; + } + + for (i = 0;i < t->NumTokens;i++) + { + char *name = t->Token[i]; + UINT id = GetInstanceId(name); + if (id != 0) + { + Win32ReleaseDhcp9x(id, wait); + } + } + + FreeToken(t); +} + +// Routing table tracking main +void RouteTrackingMain(SESSION *s) +{ + ROUTE_TRACKING *t; + UINT64 now; + ROUTE_TABLE *table; + ROUTE_ENTRY *rs; + bool changed = false; + bool check = false; + bool any_modified = false; + // Validate arguments + if (s == NULL) + { + return; + } + if (s->ClientModeAndUseVLan == false) + { + return; + } + + // Get the state + t = ((VLAN *)s->PacketAdapter->Param)->RouteState; + if (t == NULL) + { + return; + } + + // Current time + PROBE_STR("RouteTrackingMain 1"); + now = Tick64(); + + if (t->RouteChange != NULL) + { + if (t->NextRouteChangeCheckTime == 0 || + t->NextRouteChangeCheckTime <= now) + { + t->NextRouteChangeCheckTime = now + 1000ULL; + + check = IsRouteChanged(t->RouteChange); + + if (check) + { + Debug("*** Routing Table Changed ***\n"); + t->NextTrackingTime = 0; + } + } + } + if (t->NextTrackingTime != 0 && t->NextTrackingTime > now) + { + if (s->UseUdpAcceleration && s->UdpAccel != NULL && s->UdpAccel->NatT_IP_Changed) + { + // Check always if the IP address of the NAT-T server has changed + } + else + { + PROBE_STR("RouteTrackingMain 2"); + return; + } + } + PROBE_STR("RouteTrackingMain 3"); + + if (s->UseUdpAcceleration && s->UdpAccel != NULL) + { + IP nat_t_ip; + + s->UdpAccel->NatT_IP_Changed = false; + + Zero(&nat_t_ip, sizeof(nat_t_ip)); + + Lock(s->UdpAccel->NatT_Lock); + { + Copy(&nat_t_ip, &s->UdpAccel->NatT_IP, sizeof(IP)); + } + Unlock(s->UdpAccel->NatT_Lock); + + // Add a route to the NAT-T server + if (IsZeroIp(&nat_t_ip) == false) + { + if (t->RouteToNatTServer == NULL) + { + if (t->RouteToEight != NULL) + { + ROUTE_ENTRY *e = Clone(t->RouteToEight, sizeof(ROUTE_ENTRY)); + char ip_str[64]; + char ip_str2[64]; + + Copy(&e->DestIP, &nat_t_ip, sizeof(IP)); + e->Metric = e->OldIfMetric; + + IPToStr(ip_str, sizeof(ip_str), &e->DestIP); + IPToStr(ip_str2, sizeof(ip_str2), &e->GatewayIP); + + t->RouteToNatTServer = e; + + if (AddRouteEntry(t->RouteToNatTServer)) + { + Debug("Adding Static Route to %s via %s metric %u: ok.\n", ip_str, ip_str2, e->Metric); + } + else + { + FreeRouteEntry(t->RouteToNatTServer); + t->RouteToNatTServer = NULL; + } + } + } + } + } + + // Get the current routing table + table = GetRouteTable(); + rs = t->RouteToServer; + if (table != NULL) + { + UINT i; + bool route_to_server_erased = true; + bool is_vlan_want_to_be_default_gateway = false; + UINT vlan_default_gateway_metric = 0; + UINT other_if_default_gateway_metric_min = INFINITE; + + // Get whether the routing table have been changed + if (t->LastRoutingTableHash != table->HashedValue) + { + t->LastRoutingTableHash = table->HashedValue; + changed = true; + } + + //DebugPrintRouteTable(table); + + // Scan the routing table + for (i = 0;i < table->NumEntry;i++) + { + ROUTE_ENTRY *e = table->Entry[i]; + + if (rs != NULL) + { + if (CmpIpAddr(&e->DestIP, &rs->DestIP) == 0 && + CmpIpAddr(&e->DestMask, &rs->DestMask) == 0 +// && CmpIpAddr(&e->GatewayIP, &rs->GatewayIP) == 0 +// && e->InterfaceID == rs->InterfaceID && +// e->LocalRouting == rs->LocalRouting && +// e->Metric == rs->Metric + ) + { + // Routing entry to the server that added at the time of connection is found + route_to_server_erased = false; + } + } + + // Search for the default gateway + if (IPToUINT(&e->DestIP) == 0 && + IPToUINT(&e->DestMask) == 0) + { + Debug("e->InterfaceID = %u, t->VLanInterfaceId = %u\n", + e->InterfaceID, t->VLanInterfaceId); + + if (e->InterfaceID == t->VLanInterfaceId) + { + // The virtual LAN card think that he want to be a default gateway + is_vlan_want_to_be_default_gateway = true; + vlan_default_gateway_metric = e->Metric; + + if (vlan_default_gateway_metric >= 2 && + t->OldDefaultGatewayMetric == (vlan_default_gateway_metric - 1)) + { + // Restore because the PPP server rewrites + // the routing table selfishly + DeleteRouteEntry(e); + e->Metric--; + AddRouteEntry(e); + Debug("** Restore metric destroyed by PPP.\n"); + + any_modified = true; + } + + // Keep this entry + if (t->DefaultGatewayByVLan != NULL) + { + // Delete if there is one added last time + FreeRouteEntry(t->DefaultGatewayByVLan); + } + + t->DefaultGatewayByVLan = ZeroMalloc(sizeof(ROUTE_ENTRY)); + Copy(t->DefaultGatewayByVLan, e, sizeof(ROUTE_ENTRY)); + + t->OldDefaultGatewayMetric = vlan_default_gateway_metric; + } + else + { + // There are default gateway other than the virtual LAN card + // Save the metric value of the default gateway + if (other_if_default_gateway_metric_min > e->Metric) + { + // Ignore the metric value of all PPP connection in the case of Windows Vista + if (MsIsVista() == false || e->PPPConnection == false) + { + other_if_default_gateway_metric_min = e->Metric; + } + else + { + // a PPP is used to Connect to the network + // in using Windows Vista + t->VistaAndUsingPPP = true; + } + } + } + } + } + + if (t->VistaAndUsingPPP) + { + if (t->DefaultGatewayByVLan != NULL) + { + if (is_vlan_want_to_be_default_gateway) + { + if (t->VistaOldDefaultGatewayByVLan == NULL || Cmp(t->VistaOldDefaultGatewayByVLan, t->DefaultGatewayByVLan, sizeof(ROUTE_ENTRY)) != 0) + { + ROUTE_ENTRY *e; + // Add the route of 0.0.0.0/1 and 128.0.0.0/1 + // to the system if the virtual LAN card should be + // the default gateway in the case of the connection + // using PPP in Windows Vista + + if (t->VistaOldDefaultGatewayByVLan != NULL) + { + FreeRouteEntry(t->VistaOldDefaultGatewayByVLan); + } + + if (t->VistaDefaultGateway1 != NULL) + { + DeleteRouteEntry(t->VistaDefaultGateway1); + FreeRouteEntry(t->VistaDefaultGateway1); + + DeleteRouteEntry(t->VistaDefaultGateway2); + FreeRouteEntry(t->VistaDefaultGateway2); + } + + t->VistaOldDefaultGatewayByVLan = Clone(t->DefaultGatewayByVLan, sizeof(ROUTE_ENTRY)); + + e = Clone(t->DefaultGatewayByVLan, sizeof(ROUTE_ENTRY)); + SetIP(&e->DestIP, 0, 0, 0, 0); + SetIP(&e->DestMask, 128, 0, 0, 0); + t->VistaDefaultGateway1 = e; + + e = Clone(t->DefaultGatewayByVLan, sizeof(ROUTE_ENTRY)); + SetIP(&e->DestIP, 128, 0, 0, 0); + SetIP(&e->DestMask, 128, 0, 0, 0); + t->VistaDefaultGateway2 = e; + + AddRouteEntry(t->VistaDefaultGateway1); + AddRouteEntry(t->VistaDefaultGateway2); + + Debug("Vista PPP Fix Route Table Added.\n"); + + any_modified = true; + } + } + else + { + if (t->VistaOldDefaultGatewayByVLan != NULL) + { + FreeRouteEntry(t->VistaOldDefaultGatewayByVLan); + t->VistaOldDefaultGatewayByVLan = NULL; + } + + if (t->VistaDefaultGateway1 != NULL) + { + Debug("Vista PPP Fix Route Table Deleted.\n"); + DeleteRouteEntry(t->VistaDefaultGateway1); + FreeRouteEntry(t->VistaDefaultGateway1); + + DeleteRouteEntry(t->VistaDefaultGateway2); + FreeRouteEntry(t->VistaDefaultGateway2); + + any_modified = true; + + t->VistaDefaultGateway1 = t->VistaDefaultGateway2 = NULL; + } + } + } + } + + // If the virtual LAN card want to be the default gateway and + // there is no LAN card with smaller metric of 0.0.0.0/0 than + // the virtual LAN card, delete other default gateway entries + // to elect the virtual LAN card as the default gateway +// Debug("is_vlan_want_to_be_default_gateway = %u, rs = %u, route_to_server_erased = %u, other_if_default_gateway_metric_min = %u, vlan_default_gateway_metric = %u\n", +// is_vlan_want_to_be_default_gateway, rs, route_to_server_erased, other_if_default_gateway_metric_min, vlan_default_gateway_metric); + if (is_vlan_want_to_be_default_gateway && (rs != NULL && route_to_server_erased == false) && + other_if_default_gateway_metric_min >= vlan_default_gateway_metric) + { + // Scan the routing table again + for (i = 0;i < table->NumEntry;i++) + { + ROUTE_ENTRY *e = table->Entry[i]; + + if (e->InterfaceID != t->VLanInterfaceId) + { + if (IPToUINT(&e->DestIP) == 0 && + IPToUINT(&e->DestMask) == 0) + { + char str[64]; + // Default gateway is found + ROUTE_ENTRY *r = ZeroMalloc(sizeof(ROUTE_ENTRY)); + + Copy(r, e, sizeof(ROUTE_ENTRY)); + + // Put in the queue + InsertQueue(t->DeletedDefaultGateway, r); + + // Delete this gateway entry once + DeleteRouteEntry(e); + + IPToStr(str, sizeof(str), &e->GatewayIP); + Debug("Default Gateway %s Deleted.\n", str); + + any_modified = true; + } + } + } + } + + if (rs != NULL && route_to_server_erased) + { + // Physical entry to the server has disappeared + Debug("Route to Server entry ERASED !!!\n"); + + // Forced disconnection (reconnection enabled) + s->RetryFlag = true; + s->Halt = true; + } + + // Release the routing table + FreeRouteTable(table); + } + + // Set the time to perform the next track + if (t->NextTrackingTimeAdd == 0 || changed) + { + t->NextTrackingTimeAdd = TRACKING_INTERVAL_INITIAL; + } + else + { + UINT64 max_value = TRACKING_INTERVAL_MAX; + if (t->RouteChange != NULL) + { + max_value = TRACKING_INTERVAL_MAX_RC; + } + + t->NextTrackingTimeAdd += TRACKING_INTERVAL_ADD; + + if (t->NextTrackingTimeAdd >= max_value) + { + t->NextTrackingTimeAdd = max_value; + } + } + //Debug("t->NextTrackingTimeAdd = %I64u\n", t->NextTrackingTimeAdd); + t->NextTrackingTime = now + t->NextTrackingTimeAdd; + + if (any_modified) + { + // Clear the DNS cache + Win32FlushDnsCache(); + } +} + +// Start tracking of the routing table +void RouteTrackingStart(SESSION *s) +{ + VLAN *v; + ROUTE_TRACKING *t; + UINT if_id = 0; + ROUTE_ENTRY *e; + ROUTE_ENTRY *dns = NULL; + ROUTE_ENTRY *route_to_real_server_global = NULL; + char tmp[64]; + UINT exclude_if_id = 0; + bool already_exists = false; + bool already_exists_by_other_account = false; + IP eight; + // Validate arguments + if (s == NULL) + { + return; + } + + v = (VLAN *)s->PacketAdapter->Param; + if (v->RouteState != NULL) + { + return; + } + + // Get the interface ID of the virtual LAN card + if_id = GetInstanceId(v->InstanceName); + Debug("[InstanceId of %s] = 0x%x\n", v->InstanceName, if_id); + + if (MsIsVista()) + { + // The routing table by the virtual LAN card body should be + // excluded explicitly in Windows Vista + exclude_if_id = if_id; + } + + // Get the route to the server + e = GetBestRouteEntryEx(&s->ServerIP, exclude_if_id); + if (e == NULL) + { + // Acquisition failure + Debug("Failed to get GetBestRouteEntry().\n"); + return; + } + IPToStr(tmp, sizeof(tmp), &e->GatewayIP); + Debug("GetBestRouteEntry() Succeed. [Gateway: %s]\n", tmp); + + // Add a route + if (MsIsVista()) + { + e->Metric = e->OldIfMetric; + } + if (AddRouteEntryEx(e, &already_exists) == false) + { + FreeRouteEntry(e); + e = NULL; + } + Debug("already_exists: %u\n", already_exists); + + if (already_exists) + { + if (s->Cedar->Client != NULL && s->Account != NULL) + { + UINT i; + ACCOUNT *a; + for (i = 0;i < LIST_NUM(s->Cedar->Client->AccountList);i++) + { + a = LIST_DATA(s->Cedar->Client->AccountList, i); + Lock(a->lock); + { + SESSION *sess = a->ClientSession; + if (sess != NULL && sess != s) + { + VLAN *v = sess->PacketAdapter->Param; + if (v != NULL) + { + ROUTE_TRACKING *tr = v->RouteState; + if (tr != NULL && e != NULL) + { + if (Cmp(tr->RouteToServer, e, sizeof(ROUTE_ENTRY)) == 0) + { + already_exists_by_other_account = true; + } + } + } + } + } + Unlock(a->lock); + } + } + + if (already_exists_by_other_account) + { + Debug("already_exists_by_other_account = %u\n", already_exists_by_other_account); + already_exists = false; + } + } + + // Get the routing table to the DNS server + // (If the DNS server is this PC itself, there's no need to get) + if (IsZeroIP(&s->DefaultDns) == false) + { + if (IsMyIPAddress(&s->DefaultDns) == false) + { + dns = GetBestRouteEntryEx(&s->DefaultDns, exclude_if_id); + if (dns == NULL) + { + // Getting failure + Debug("Failed to get GetBestRouteEntry DNS.\n"); + } + else + { + // Add a route + if (MsIsVista()) + { + dns->Metric = dns->OldIfMetric; + + if (AddRouteEntry(dns) == false) + { + FreeRouteEntry(dns); + dns = NULL; + } + } + } + } + } + + if (s->IsAzureSession && IsZeroIP(&s->AzureRealServerGlobalIp) == false) + { + // Add also a static route to the real server in the case of via VPN Azure + if (IsMyIPAddress(&s->AzureRealServerGlobalIp) == false) + { + route_to_real_server_global = GetBestRouteEntryEx(&s->AzureRealServerGlobalIp, exclude_if_id); + + if (route_to_real_server_global != NULL) + { + if (MsIsVista()) + { + route_to_real_server_global->Metric = route_to_real_server_global->OldIfMetric; + } + + if (AddRouteEntry(route_to_real_server_global) == false) + { + FreeRouteEntry(route_to_real_server_global); + route_to_real_server_global = NULL; + } + } + } + } + + // Initialize + if (s->Cedar->Client != NULL && s->Account != NULL) + { + Lock(s->Account->lock); + } + + t = ZeroMalloc(sizeof(ROUTE_TRACKING)); + v->RouteState = t; + + t->RouteToServerAlreadyExists = already_exists; + t->RouteToServer = e; + t->RouteToDefaultDns = dns; + t->RouteToRealServerGlobal = route_to_real_server_global; + t->VLanInterfaceId = if_id; + t->NextTrackingTime = 0; + t->DeletedDefaultGateway = NewQueue(); + t->OldDefaultGatewayMetric = 0x7fffffff; + + if (s->Cedar->Client != NULL && s->Account != NULL) + { + Unlock(s->Account->lock); + } + + // Get the route to 8.8.8.8 + SetIP(&eight, 8, 8, 8, 8); + t->RouteToEight = GetBestRouteEntryEx(&eight, exclude_if_id); + + // Get the current default DNS server to detect network changes + GetDefaultDns(&t->OldDnsServer); + + // Get as soon as releasing the IP address in the case of using DHCP + if (IsNt()) + { + char tmp[MAX_SIZE]; + MS_ADAPTER *a; + + Format(tmp, sizeof(tmp), VLAN_ADAPTER_NAME_TAG, v->InstanceName); + a = MsGetAdapter(tmp); + + if (a != NULL) + { + if (a->UseDhcp) + { + bool ret = Win32ReleaseAddressByGuidEx(a->Guid, 100); + Debug("*** Win32ReleaseAddressByGuidEx = %u\n", ret); + + ret = Win32RenewAddressByGuidEx(a->Guid, 100); + Debug("*** Win32RenewAddressByGuidEx = %u\n", ret); + } + + MsFreeAdapter(a); + } + } + else + { + // For Win9x + Win32RenewDhcp9x(if_id); + } + + // Clear the DNS cache + Win32FlushDnsCache(); + + // Detect a change in the routing table (for only supported OS) + t->RouteChange = NewRouteChange(); + Debug("t->RouteChange = 0x%p\n", t->RouteChange); +} + +// End the tracking of the routing table +void RouteTrackingStop(SESSION *s, ROUTE_TRACKING *t) +{ + ROUTE_ENTRY *e; + ROUTE_TABLE *table; + IP dns_ip; + bool network_has_changed = false; + bool do_not_delete_routing_entry = false; + // Validate arguments + if (s == NULL || t == NULL) + { + return; + } + + Zero(&dns_ip, sizeof(dns_ip)); + + // Remove the default gateway added by the virtual LAN card + if (MsIsVista() == false) + { + if (t->DefaultGatewayByVLan != NULL) + { + Debug("Default Gateway by VLAN was deleted.\n"); + DeleteRouteEntry(t->DefaultGatewayByVLan); + } + + if (t->VistaOldDefaultGatewayByVLan != NULL) + { + FreeRouteEntry(t->VistaOldDefaultGatewayByVLan); + } + } + + if (t->DefaultGatewayByVLan != NULL) + { + FreeRouteEntry(t->DefaultGatewayByVLan); + t->DefaultGatewayByVLan = NULL; + } + + if (t->VistaDefaultGateway1 != NULL) + { + Debug("Vista PPP Fix Route Table Deleted.\n"); + DeleteRouteEntry(t->VistaDefaultGateway1); + FreeRouteEntry(t->VistaDefaultGateway1); + + DeleteRouteEntry(t->VistaDefaultGateway2); + FreeRouteEntry(t->VistaDefaultGateway2); + } + + if (MsIsNt() == false) + { + // Only in the case of Windows 9x, release the DHCP address of the virtual LAN card + Win32ReleaseDhcp9x(t->VLanInterfaceId, false); + } + + // Clear the DNS cache + Win32FlushDnsCache(); + + if (s->Cedar->Client != NULL && s->Account != NULL) + { + UINT i; + ACCOUNT *a; + for (i = 0;i < LIST_NUM(s->Cedar->Client->AccountList);i++) + { + a = LIST_DATA(s->Cedar->Client->AccountList, i); + Lock(a->lock); + { + SESSION *sess = a->ClientSession; + if (sess != NULL && sess != s) + { + VLAN *v = sess->PacketAdapter->Param; + if (v != NULL) + { + ROUTE_TRACKING *tr = v->RouteState; + if (tr != NULL) + { + if (Cmp(tr->RouteToServer, t->RouteToServer, sizeof(ROUTE_ENTRY)) == 0) + { + do_not_delete_routing_entry = true; + } + } + } + } + } + Unlock(a->lock); + } + + Lock(s->Account->lock); + } + + if (do_not_delete_routing_entry == false) + { + // Delete the route that is added firstly + if (t->RouteToServerAlreadyExists == false) + { + DeleteRouteEntry(t->RouteToServer); + } + + DeleteRouteEntry(t->RouteToDefaultDns); + + DeleteRouteEntry(t->RouteToNatTServer); + + DeleteRouteEntry(t->RouteToRealServerGlobal); + } + + FreeRouteEntry(t->RouteToDefaultDns); + FreeRouteEntry(t->RouteToServer); + FreeRouteEntry(t->RouteToEight); + FreeRouteEntry(t->RouteToNatTServer); + FreeRouteEntry(t->RouteToRealServerGlobal); + t->RouteToDefaultDns = t->RouteToServer = t->RouteToEight = + t->RouteToNatTServer = t->RouteToRealServerGlobal = NULL; + + if (s->Cedar->Client != NULL && s->Account != NULL) + { + Unlock(s->Account->lock); + } + +#if 0 + // Get the current DNS server + if (GetDefaultDns(&dns_ip)) + { + if (IPToUINT(&t->OldDnsServer) != 0) + { + if (IPToUINT(&t->OldDnsServer) != IPToUINT(&dns_ip)) + { + char s1[MAX_SIZE], s2[MAX_SIZE]; + network_has_changed = true; + IPToStr(s1, sizeof(s1), &t->OldDnsServer); + IPToStr(s2, sizeof(s2), &dns_ip); + Debug("Old Dns: %s, New Dns: %s\n", + s1, s2); + } + } + } + + if (network_has_changed == false) + { + Debug("Network: not changed.\n"); + } + else + { + Debug("Network: Changed.\n"); + } + +#endif + + // Get the current routing table + table = GetRouteTable(); + + // Restore the routing table which has been removed so far + while (e = GetNext(t->DeletedDefaultGateway)) + { + bool restore = true; + UINT i; + // If the restoring routing entry is a default gateway and + // the existing routing table contains another default gateway + // on the interface, give up restoring the entry + if (IPToUINT(&e->DestIP) == 0 && IPToUINT(&e->DestMask) == 0) + { + for (i = 0;i < table->NumEntry;i++) + { + ROUTE_ENTRY *r = table->Entry[i]; + if (IPToUINT(&r->DestIP) == 0 && IPToUINT(&r->DestMask) == 0) + { + if (r->InterfaceID == e->InterfaceID) + { + restore = false; + } + } + } + if (network_has_changed) + { + restore = false; + } + } + + if (restore) + { + // Routing table restoration + AddRouteEntry(e); + } + + // Memory release + FreeRouteEntry(e); + } + + // Release + FreeRouteTable(table); + ReleaseQueue(t->DeletedDefaultGateway); + + FreeRouteChange(t->RouteChange); + + Free(t); +} + +// Get the instance ID of the virtual LAN card +UINT GetInstanceId(char *name) +{ + char tmp[MAX_SIZE]; + UINT id = 0; + // Validate arguments + if (name == NULL) + { + return 0; + } + + Format(tmp, sizeof(tmp), VLAN_ADAPTER_NAME_TAG, name); + + id = GetVLanInterfaceID(tmp); + if (id != 0) + { + return id; + } + else + { + Format(tmp, sizeof(tmp), VLAN_ADAPTER_NAME_TAG_OLD, name); + + id = GetVLanInterfaceID(tmp); + return id; + } +} + +// Get the instance list of virtual LAN card +INSTANCE_LIST *GetInstanceList() +{ + INSTANCE_LIST *n = ZeroMalloc(sizeof(INSTANCE_LIST)); + + // Enumeration + char **ss = EnumVLan(VLAN_ADAPTER_NAME); + + if (ss == NULL) + { + // Failure + n->NumInstance = 0; + n->InstanceName = Malloc(0); + return n; + } + else + { + UINT i, num; + i = num = 0; + while (true) + { + if (ss[i++] == NULL) + { + break; + } + num++; + } + i = 0; + n->NumInstance = num; + n->InstanceName = (char **)ZeroMalloc(sizeof(char *) * n->NumInstance); + for (i = 0;i < num;i++) + { + char *s = ss[i] + StrLen(VLAN_ADAPTER_NAME) + StrLen(" - "); + if (StrLen(ss[i]) > StrLen(VLAN_ADAPTER_NAME) + StrLen(" - ")) + { + n->InstanceName[i] = CopyStr(s); + } + } + FreeEnumVLan(ss); + } + + ss = EnumVLan(VLAN_ADAPTER_NAME_OLD); + if (ss != NULL) + { + UINT i, num, j; + + i = num = 0; + while (true) + { + if (ss[i++] == NULL) + { + break; + } + num++; + } + j = n->NumInstance; + n->NumInstance += num; + n->InstanceName = (char **)ReAlloc(n->InstanceName, sizeof(char) * n->NumInstance); + for (i = 0;i < num;i++) + { + char *s = ss[i] + StrLen(VLAN_ADAPTER_NAME_OLD) + StrLen(" - "); + if (StrLen(ss[i]) > StrLen(VLAN_ADAPTER_NAME_OLD) + StrLen(" - ")) + { + n->InstanceName[j] = CopyStr(s); + } + j++; + } + FreeEnumVLan(ss); + } + + return n; +} + +// Release the instance list +void FreeInstanceList(INSTANCE_LIST *n) +{ + UINT i; + // Validate arguments + if (n == NULL) + { + return; + } + + for (i = 0;i < n->NumInstance;i++) + { + Free(n->InstanceName[i]); + } + Free(n->InstanceName); + Free(n); +} + +// Release the packet adapter +void VLanPaFree(SESSION *s) +{ + VLAN *v; + ROUTE_TRACKING *t; + // Validate arguments + if ((s == NULL) || ((v = s->PacketAdapter->Param) == NULL)) + { + return; + } + + // Release the IP address if you are using DHCP + if (IsNt()) + { + char tmp[MAX_SIZE]; + MS_ADAPTER *a; + UINT64 now = Tick64(); + UINT64 suspend_tick = MsGetSuspendModeBeginTick(); + + if (suspend_tick == 0 || (suspend_tick + (UINT64)(30 * 1000)) < now) + { + Format(tmp, sizeof(tmp), VLAN_ADAPTER_NAME_TAG, v->InstanceName); + a = MsGetAdapter(tmp); + + if (a != NULL) + { + if (a->UseDhcp) + { + bool ret = Win32ReleaseAddressByGuidEx(a->Guid, 50); + Debug("*** Win32ReleaseAddressByGuid = %u\n", ret); + } + + MsFreeAdapter(a); + } + } + } + + t = v->RouteState; + // End the virtual LAN card + FreeVLan(v); + + // End the routing table tracking + if (s->ClientModeAndUseVLan) + { + RouteTrackingStop(s, t); + } + s->PacketAdapter->Param = NULL; +} + + +// Write a packet +bool VLanPaPutPacket(SESSION *s, void *data, UINT size) +{ + VLAN *v; + // Validate arguments + if ((s == NULL) || ((v = s->PacketAdapter->Param) == NULL)) + { + return false; + } + + return VLanPutPacket(v, data, size); +} + +// Get the next packet +UINT VLanPaGetNextPacket(SESSION *s, void **data) +{ + VLAN *v; + UINT size; + // Validate arguments + if (data == NULL || (s == NULL) || ((v = s->PacketAdapter->Param) == NULL)) + { + return 0; + } + + RouteTrackingMain(s); + + if (VLanGetNextPacket(v, data, &size) == false) + { + return INFINITE; + } + + return size; +} + +// Get the cancel object +CANCEL *VLanPaGetCancel(SESSION *s) +{ + VLAN *v; + // Validate arguments + if ((s == NULL) || ((v = s->PacketAdapter->Param) == NULL)) + { + return NULL; + } + + return VLanGetCancel(v); +} + +// Initialize the packet adapter +bool VLanPaInit(SESSION *s) +{ + VLAN *v; + // Validate arguments + if ((s == NULL)/* || (s->ServerMode != false) || (s->ClientOption == NULL)*/) + { + return false; + } + + // Get the IP address of the DNS server at the time just before the connection + if (s->ClientModeAndUseVLan) + { + Zero(&s->DefaultDns, sizeof(IP)); + GetDefaultDns(&s->DefaultDns); + } + + // Normalize the setting of interface metric of the default gateway + if (s->ClientModeAndUseVLan) + { + if (MsIsVista()) + { + MsNormalizeInterfaceDefaultGatewaySettings(VLAN_ADAPTER_NAME_TAG, s->ClientOption->DeviceName); + MsNormalizeInterfaceDefaultGatewaySettings(VLAN_ADAPTER_NAME_TAG_OLD, s->ClientOption->DeviceName); + } + } + + // Connect to the driver + v = NewVLan(s->ClientOption->DeviceName, NULL); + if (v == NULL) + { + // Failure + return false; + } + + s->PacketAdapter->Param = v; + + // Routing table tracking start + if (s->ClientModeAndUseVLan) + { + RouteTrackingStart(s); + } + + return true; +} + +// Get the packet adapter of the VLAN +PACKET_ADAPTER *VLanGetPacketAdapter() +{ + PACKET_ADAPTER *pa; + + pa = NewPacketAdapter(VLanPaInit, VLanPaGetCancel, + VLanPaGetNextPacket, VLanPaPutPacket, VLanPaFree); + if (pa == NULL) + { + return NULL; + } + + pa->Id = PACKET_ADAPTER_ID_VLAN_WIN32; + + return pa; +} + + +// Write the next received packet to the driver +bool VLanPutPacket(VLAN *v, void *buf, UINT size) +{ + // Validate arguments + if (v == NULL) + { + return false; + } + if (v->Halt) + { + return false; + } + if (size > MAX_PACKET_SIZE) + { + return false; + } + + // First, examine whether the current buffer is full + if ((NEO_NUM_PACKET(v->PutBuffer) >= NEO_MAX_PACKET_EXCHANGE) || + (buf == NULL && NEO_NUM_PACKET(v->PutBuffer) != 0)) + { +#ifdef USE_PROBE + { + char tmp[MAX_SIZE]; + snprintf(tmp, sizeof(tmp), "VLanPutPacket: NEO_NUM_PACKET(v->PutBuffer) = %u", NEO_NUM_PACKET(v->PutBuffer)); + PROBE_DATA2(tmp, NULL, 0); + } +#endif // USE_PROBE + // Write a packet to the driver + if (VLanPutPacketsToDriver(v) == false) + { + return false; + } + NEO_NUM_PACKET(v->PutBuffer) = 0; + } + + // Add the next packet to the buffer + if (buf != NULL) + { + UINT i = NEO_NUM_PACKET(v->PutBuffer); + NEO_NUM_PACKET(v->PutBuffer)++; + + NEO_SIZE_OF_PACKET(v->PutBuffer, i) = size; + Copy(NEO_ADDR_OF_PACKET(v->PutBuffer, i), buf, size); + Free(buf); + } + + return true; +} + +// Read the next sent packet from the driver +bool VLanGetNextPacket(VLAN *v, void **buf, UINT *size) +{ + // Validate arguments + if (v == NULL || buf == NULL || size == NULL) + { + return false; + } + if (v->Halt) + { + return false; + } + + PROBE_STR("VLanGetNextPacket"); + + while (true) + { + if (v->CurrentPacketCount < NEO_NUM_PACKET(v->GetBuffer)) + { + // There are still packets that have been read already + *size = NEO_SIZE_OF_PACKET(v->GetBuffer, v->CurrentPacketCount); + *buf = MallocFast(*size); + Copy(*buf, NEO_ADDR_OF_PACKET(v->GetBuffer, v->CurrentPacketCount), *size); + + // Increment the packet number + v->CurrentPacketCount++; + + return true; + } + else + { + // Read the next packet from the driver + if (VLanGetPacketsFromDriver(v) == false) + { + return false; + } + + if (NEO_NUM_PACKET(v->GetBuffer) == 0) + { + // Packet is not received currently + *buf = NULL; + *size = 0; + return true; + } + + v->CurrentPacketCount = 0; + } + } +} + +// Write all the current packets to the driver +bool VLanPutPacketsToDriver(VLAN *v) +{ + DWORD write_size; + // Validate arguments + if (v == NULL) + { + return false; + } + if (v->Halt) + { + return false; + } + + if (v->Win9xMode == false) + { + // Windows NT + PROBE_STR("VLanPutPacketsToDriver: WriteFile"); + if (WriteFile(v->Handle, v->PutBuffer, NEO_EXCHANGE_BUFFER_SIZE, &write_size, + NULL) == false) + { + v->Halt = true; + return false; + } + PROBE_STR("VLanPutPacketsToDriver: WriteFile Completed."); + + if (write_size != NEO_EXCHANGE_BUFFER_SIZE) + { + v->Halt = true; + return false; + } + } + else + { + // Windows 9x + if (DeviceIoControl(v->Handle, NEO_IOCTL_PUT_PACKET, v->PutBuffer, + NEO_EXCHANGE_BUFFER_SIZE, NULL, 0, &write_size, NULL) == false) + { + v->Halt = true; + return false; + } + } + + return true; +} + +// Read the next packet from the driver +bool VLanGetPacketsFromDriver(VLAN *v) +{ + DWORD read_size; + // Validate arguments + if (v == NULL) + { + return false; + } + if (v->Halt) + { + return false; + } + + if (v->Win9xMode == false) + { + // Windows NT + PROBE_STR("VLanGetPacketsFromDriver: ReadFile"); + if (ReadFile(v->Handle, v->GetBuffer, NEO_EXCHANGE_BUFFER_SIZE, + &read_size, NULL) == false) + { + v->Halt = true; + return false; + } + } + else + { + // Windows 9x + if (DeviceIoControl(v->Handle, NEO_IOCTL_GET_PACKET, NULL, 0, + v->GetBuffer, NEO_EXCHANGE_BUFFER_SIZE, &read_size, NULL) == false) + { + v->Halt = true; + return false; + } + } + + if (read_size != NEO_EXCHANGE_BUFFER_SIZE) + { + v->Halt = true; + return false; + } + + return true; +} + +// Get the cancel object +CANCEL *VLanGetCancel(VLAN *v) +{ + CANCEL *c; + // Validate arguments + if (v == NULL) + { + return NULL; + } + + // Create a cancel object + c = NewCancel(); + c->SpecialFlag = true; + CloseHandle(c->hEvent); + + c->hEvent = v->Event; + + return c; +} + +// Release the VLAN object +void FreeVLan(VLAN *v) +{ + // Validate arguments + if (v == NULL) + { + return; + } + + // Close the handle + CloseHandle(v->Event); + CloseHandle(v->Handle); + + // Memory release + Free(v->InstanceName); + Free(v->EventNameWin32); + Free(v->DeviceNameWin32); + Free(v->PutBuffer); + Free(v->GetBuffer); + Free(v); +} + +// Create a VLAN object +VLAN *NewVLan(char *instance_name, VLAN_PARAM *param) +{ + VLAN *v; + HANDLE h = INVALID_HANDLE_VALUE; + HANDLE e = INVALID_HANDLE_VALUE; + char tmp[MAX_SIZE]; + char name_upper[MAX_SIZE]; + // Validate arguments + if (instance_name == NULL) + { + return NULL; + } + + v = ZeroMalloc(sizeof(VLAN)); + + if (OS_IS_WINDOWS_9X(GetOsInfo()->OsType)) + { + v->Win9xMode = true; + } + + // Initialize the name + Format(name_upper, sizeof(name_upper), "%s", instance_name); + StrUpper(name_upper); + v->InstanceName = CopyStr(name_upper); + Format(tmp, sizeof(tmp), NDIS_NEO_DEVICE_FILE_NAME, v->InstanceName); + v->DeviceNameWin32 = CopyStr(tmp); + + if (v->Win9xMode == false) + { + Format(tmp, sizeof(tmp), NDIS_NEO_EVENT_NAME_WIN32, v->InstanceName); + v->EventNameWin32 = CopyStr(tmp); + } + + // Connect to the device + h = CreateFile(v->DeviceNameWin32, + GENERIC_READ | GENERIC_WRITE, + 0, + NULL, + OPEN_EXISTING, + 0, + NULL); + if (h == INVALID_HANDLE_VALUE) + { + // Connection failure + goto CLEANUP; + } + + if (v->Win9xMode == false) + { + // Connect to the event + e = OpenEvent(SYNCHRONIZE, FALSE, v->EventNameWin32); + if (e == INVALID_HANDLE_VALUE) + { + // Connection failure + goto CLEANUP; + } + } + else + { + OPENVXDHANDLE OpenVxDHandle; + DWORD vxd_handle; + UINT bytes_returned; + + OpenVxDHandle = (OPENVXDHANDLE)GetProcAddress(GetModuleHandle("KERNEL32"), + "OpenVxDHandle"); + + // Deliver to the driver by creating an event + e = CreateEvent(NULL, FALSE, FALSE, NULL); + vxd_handle = (DWORD)OpenVxDHandle(e); + + DeviceIoControl(h, NEO_IOCTL_SET_EVENT, &vxd_handle, sizeof(DWORD), + NULL, 0, &bytes_returned, NULL); + } + + v->Event = e; + v->Handle = h; + + v->GetBuffer = ZeroMalloc(NEO_EXCHANGE_BUFFER_SIZE); + v->PutBuffer = ZeroMalloc(NEO_EXCHANGE_BUFFER_SIZE); + + return v; + +CLEANUP: + if (h != INVALID_HANDLE_VALUE) + { + CloseHandle(h); + } + if (e != INVALID_HANDLE_VALUE) + { + CloseHandle(e); + } + + Free(v->InstanceName); + Free(v->EventNameWin32); + Free(v->DeviceNameWin32); + Free(v); + + return NULL; +} + +#endif // OS_WIN32 + +#endif //VLAN_C + diff --git a/src/Cedar/VLanWin32.h b/src/Cedar/VLanWin32.h index 2e8c092c..f351d57e 100644 --- a/src/Cedar/VLanWin32.h +++ b/src/Cedar/VLanWin32.h @@ -1,94 +1,94 @@ -// SoftEther VPN Source Code - Developer Edition Master Branch -// Cedar Communication Module - - -// VLanWin32.h -// Header of VLanWin32.c - -#ifndef VLANWIN32_H -#define VLANWIN32_H - -// Routing table tracking timer -#define TRACKING_INTERVAL_INITIAL 444 // Initial -#define TRACKING_INTERVAL_ADD 444 // Adding value -#define TRACKING_INTERVAL_MAX 12345 // Maximum value -#define TRACKING_INTERVAL_MAX_RC 87654 // Maximum value (OS which change detection mechanism enabled) - - -typedef void *HANDLE; - -// Routing tracking state machine -struct ROUTE_TRACKING -{ - UINT VLanInterfaceId; - ROUTE_ENTRY *RouteToServer; - bool RouteToServerAlreadyExists; - ROUTE_ENTRY *DefaultGatewayByVLan; - ROUTE_ENTRY *VistaDefaultGateway1, *VistaDefaultGateway2, *VistaOldDefaultGatewayByVLan; - ROUTE_ENTRY *RouteToDefaultDns; - ROUTE_ENTRY *RouteToEight; - ROUTE_ENTRY *RouteToNatTServer; - ROUTE_ENTRY *RouteToRealServerGlobal; - UINT64 NextTrackingTime; - UINT64 NextTrackingTimeAdd; - UINT64 NextRouteChangeCheckTime; - UINT LastRoutingTableHash; - QUEUE *DeletedDefaultGateway; - UINT OldDefaultGatewayMetric; - IP OldDnsServer; - bool VistaAndUsingPPP; - ROUTE_CHANGE *RouteChange; -}; - -// VLAN structure -struct VLAN -{ - volatile bool Halt; // Halting flag - bool Win9xMode; // Windows 9x - char *InstanceName; // Instance name - char *DeviceNameWin32; // Win32 device name - char *EventNameWin32; // Win32 event name - HANDLE Handle; // Device driver file - HANDLE Event; // Handle of the event - void *GetBuffer; // Sent packet capturing buffer - UINT CurrentPacketCount; // Packet number to be read next - void *PutBuffer; // Buffer for writing received packet - ROUTE_TRACKING *RouteState; // Routing tracking state machine -}; - -// Instance list -struct INSTANCE_LIST -{ - UINT NumInstance; - char **InstanceName; -}; - - -// Function prototype -VLAN *NewVLan(char *instance_name, VLAN_PARAM *param); -void FreeVLan(VLAN *v); -CANCEL *VLanGetCancel(VLAN *v); -bool VLanGetNextPacket(VLAN *v, void **buf, UINT *size); -bool VLanGetPacketsFromDriver(VLAN *v); -bool VLanPutPacketsToDriver(VLAN *v); -bool VLanPutPacket(VLAN *v, void *buf, UINT size); - -PACKET_ADAPTER *VLanGetPacketAdapter(); -bool VLanPaInit(SESSION *s); -CANCEL *VLanPaGetCancel(SESSION *s); -UINT VLanPaGetNextPacket(SESSION *s, void **data); -bool VLanPaPutPacket(SESSION *s, void *data, UINT size); -void VLanPaFree(SESSION *s); - -INSTANCE_LIST *GetInstanceList(); -void FreeInstanceList(INSTANCE_LIST *n); -UINT GetInstanceId(char *name); - -void RouteTrackingStart(SESSION *s); -void RouteTrackingStop(SESSION *s, ROUTE_TRACKING *t); -void RouteTrackingMain(SESSION *s); -void Win32ReleaseAllDhcp9x(bool wait); - -void Win32GetWinVer(RPC_WINVER *v); - -#endif // VLANWIN32_H +// SoftEther VPN Source Code - Developer Edition Master Branch +// Cedar Communication Module + + +// VLanWin32.h +// Header of VLanWin32.c + +#ifndef VLANWIN32_H +#define VLANWIN32_H + +// Routing table tracking timer +#define TRACKING_INTERVAL_INITIAL 444 // Initial +#define TRACKING_INTERVAL_ADD 444 // Adding value +#define TRACKING_INTERVAL_MAX 12345 // Maximum value +#define TRACKING_INTERVAL_MAX_RC 87654 // Maximum value (OS which change detection mechanism enabled) + + +typedef void *HANDLE; + +// Routing tracking state machine +struct ROUTE_TRACKING +{ + UINT VLanInterfaceId; + ROUTE_ENTRY *RouteToServer; + bool RouteToServerAlreadyExists; + ROUTE_ENTRY *DefaultGatewayByVLan; + ROUTE_ENTRY *VistaDefaultGateway1, *VistaDefaultGateway2, *VistaOldDefaultGatewayByVLan; + ROUTE_ENTRY *RouteToDefaultDns; + ROUTE_ENTRY *RouteToEight; + ROUTE_ENTRY *RouteToNatTServer; + ROUTE_ENTRY *RouteToRealServerGlobal; + UINT64 NextTrackingTime; + UINT64 NextTrackingTimeAdd; + UINT64 NextRouteChangeCheckTime; + UINT LastRoutingTableHash; + QUEUE *DeletedDefaultGateway; + UINT OldDefaultGatewayMetric; + IP OldDnsServer; + bool VistaAndUsingPPP; + ROUTE_CHANGE *RouteChange; +}; + +// VLAN structure +struct VLAN +{ + volatile bool Halt; // Halting flag + bool Win9xMode; // Windows 9x + char *InstanceName; // Instance name + char *DeviceNameWin32; // Win32 device name + char *EventNameWin32; // Win32 event name + HANDLE Handle; // Device driver file + HANDLE Event; // Handle of the event + void *GetBuffer; // Sent packet capturing buffer + UINT CurrentPacketCount; // Packet number to be read next + void *PutBuffer; // Buffer for writing received packet + ROUTE_TRACKING *RouteState; // Routing tracking state machine +}; + +// Instance list +struct INSTANCE_LIST +{ + UINT NumInstance; + char **InstanceName; +}; + + +// Function prototype +VLAN *NewVLan(char *instance_name, VLAN_PARAM *param); +void FreeVLan(VLAN *v); +CANCEL *VLanGetCancel(VLAN *v); +bool VLanGetNextPacket(VLAN *v, void **buf, UINT *size); +bool VLanGetPacketsFromDriver(VLAN *v); +bool VLanPutPacketsToDriver(VLAN *v); +bool VLanPutPacket(VLAN *v, void *buf, UINT size); + +PACKET_ADAPTER *VLanGetPacketAdapter(); +bool VLanPaInit(SESSION *s); +CANCEL *VLanPaGetCancel(SESSION *s); +UINT VLanPaGetNextPacket(SESSION *s, void **data); +bool VLanPaPutPacket(SESSION *s, void *data, UINT size); +void VLanPaFree(SESSION *s); + +INSTANCE_LIST *GetInstanceList(); +void FreeInstanceList(INSTANCE_LIST *n); +UINT GetInstanceId(char *name); + +void RouteTrackingStart(SESSION *s); +void RouteTrackingStop(SESSION *s, ROUTE_TRACKING *t); +void RouteTrackingMain(SESSION *s); +void Win32ReleaseAllDhcp9x(bool wait); + +void Win32GetWinVer(RPC_WINVER *v); + +#endif // VLANWIN32_H diff --git a/src/Cedar/Virtual.c b/src/Cedar/Virtual.c index ddae4dea..ec33c5c8 100644 --- a/src/Cedar/Virtual.c +++ b/src/Cedar/Virtual.c @@ -1,10370 +1,10370 @@ -// SoftEther VPN Source Code - Developer Edition Master Branch -// Cedar Communication Module - - -// Virtual.c -// User-mode virtual host program - -#include "CedarPch.h" - -static UCHAR broadcast[6] = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff}; -static char v_vgs_hostname[256] = {0}; - -static char secure_nat_target_hostname[MAX_SIZE] = {0}; - -// Specify the destination host name to be used for connectivity testing in SecureNAT -void NnSetSecureNatTargetHostname(char *name) -{ - // Validate arguments - if (name == NULL) - { - return; - } - - StrCpy(secure_nat_target_hostname, sizeof(secure_nat_target_hostname), name); -} - -// Delete the oldest NAT session if necessary -void NnDeleteOldestNatSessionIfNecessary(NATIVE_NAT *t, UINT ip, UINT protocol) -{ - UINT current_num; - UINT max_sessions = 0; - // Validate arguments - if (t == NULL) - { - return; - } - - if (t->v->HubOption != NULL) - { - HUB_OPTION *o = t->v->HubOption; - - switch (protocol) - { - case NAT_TCP: - max_sessions = o->SecureNAT_MaxTcpSessionsPerIp; - break; - - case NAT_UDP: - max_sessions = o->SecureNAT_MaxUdpSessionsPerIp; - break; - - case NAT_ICMP: - max_sessions = o->SecureNAT_MaxIcmpSessionsPerIp; - break; - } - } - - if (max_sessions == 0) - { - return; - } - - current_num = NnGetNumNatEntriesPerIp(t, ip, protocol); - - if (current_num >= max_sessions) - { - NnDeleteOldestNatSession(t, ip, protocol); - } -} - -// Delete the oldest NAT session -void NnDeleteOldestNatSession(NATIVE_NAT *t, UINT ip, UINT protocol) -{ - NATIVE_NAT_ENTRY *e; - // Validate arguments - if (t == NULL) - { - return; - } - - e = NnGetOldestNatEntryOfIp(t, ip, protocol); - - if (e != NULL) - { - NnDeleteSession(t, e); - } -} - -// Get the oldest NAT session -NATIVE_NAT_ENTRY *NnGetOldestNatEntryOfIp(NATIVE_NAT *t, UINT ip, UINT protocol) -{ - UINT i; - NATIVE_NAT_ENTRY *oldest = NULL; - UINT64 oldest_tick = 0xFFFFFFFFFFFFFFFFULL; - // Validate arguments - if (t == NULL) - { - return NULL; - } - - for (i = 0; i < LIST_NUM(t->NatTableForRecv->AllList); i++) - { - NATIVE_NAT_ENTRY *e = LIST_DATA(t->NatTableForRecv->AllList, i); - - if (e->SrcIp == ip) - { - if (e->Protocol == protocol) - { - if (e->LastCommTime <= oldest_tick) - { - oldest_tick = e->LastCommTime; - oldest = e; - } - } - } - } - - return oldest; -} - -// Get the number of NAT sessions per IP address -UINT NnGetNumNatEntriesPerIp(NATIVE_NAT *t, UINT src_ip, UINT protocol) -{ - UINT ret = 0; - UINT i; - // Validate arguments - if (t == NULL) - { - return 0; - } - - for (i = 0; i < LIST_NUM(t->NatTableForRecv->AllList); i++) - { - NATIVE_NAT_ENTRY *e = LIST_DATA(t->NatTableForRecv->AllList, i); - - if (e->SrcIp == src_ip) - { - if (e->Protocol == protocol) - { - ret++; - } - } - } - - return ret; -} - -// Delete the old NAT sessions -void NnDeleteOldSessions(NATIVE_NAT *t) -{ - UINT i; - LIST *o; - UINT64 now; - // Validate arguments - if (t == NULL) - { - return; - } - - o = NULL; - now = t->v->Now; - - for (i = 0; i < LIST_NUM(t->NatTableForSend->AllList); i++) - { - NATIVE_NAT_ENTRY *e = LIST_DATA(t->NatTableForSend->AllList, i); - UINT64 timeout; - - if (e->Status == NAT_TCP_CONNECTED || e->Status == NAT_TCP_ESTABLISHED) - { - timeout = e->LastCommTime + (UINT64)(e->Protocol == NAT_TCP ? t->v->NatTcpTimeout : t->v->NatUdpTimeout); - } - else - { - timeout = e->LastCommTime + (UINT64)NN_TIMEOUT_FOR_UNESTBALISHED_TCP; - } - - if (timeout < now) - { - // Time-out occurs - if (o == NULL) - { - o = NewListFast(NULL); - } - - Add(o, e); - } - } - - if (o != NULL) - { - for (i = 0; i < LIST_NUM(o); i++) - { - NATIVE_NAT_ENTRY *e = LIST_DATA(o, i); - - NnDeleteSession(t, e); - } - - ReleaseList(o); - } -} - -// Delete the NAT entry -void NnDeleteSession(NATIVE_NAT *t, NATIVE_NAT_ENTRY *e) -{ - // Validate arguments - if (t == NULL || e == NULL) - { - return; - } - - switch (e->Protocol) - { - case NAT_TCP: - // Send a RST to the client side - SendTcp(t->v, e->DestIp, e->DestPort, e->SrcIp, e->SrcPort, - e->LastAck, e->LastSeq + (e->Status == NAT_TCP_CONNECTING ? 1 : 0), TCP_RST | TCP_ACK, 0, 0, NULL, 0); - - NLog(t->v, "LH_NAT_TCP_DELETED", e->Id); - break; - - case NAT_UDP: - NLog(t->v, "LH_NAT_UDP_DELETED", e->Id); - break; - - case NAT_ICMP: - Debug("NAT ICMP %u Deleted.\n", e->Id); - break; - } - - DeleteHash(t->NatTableForSend, e); - DeleteHash(t->NatTableForRecv, e); - - Free(e); -} - -// Poll the IP combining object -void NnPollingIpCombine(NATIVE_NAT *t) -{ - LIST *o; - UINT i; - // Validate arguments - if (t == NULL) - { - return; - } - - // Discard the old combining object - o = NULL; - for (i = 0; i < LIST_NUM(t->IpCombine); i++) - { - IP_COMBINE *c = LIST_DATA(t->IpCombine, i); - - if (c->Expire < t->v->Now) - { - if (o == NULL) - { - o = NewListFast(NULL); - } - Add(o, c); - } - } - - if (o != NULL) - { - for (i = 0; i < LIST_NUM(o); i++) - { - IP_COMBINE *c = LIST_DATA(o, i); - - // Remove from the list - Delete(t->IpCombine, c); - - // Release the memory - NnFreeIpCombine(t, c); - } - ReleaseList(o); - } -} - -// Combine the IP packet received to the IP combining object -void NnCombineIp(NATIVE_NAT *t, IP_COMBINE *c, UINT offset, void *data, UINT size, bool last_packet, UCHAR *head_ip_header_data, UINT head_ip_header_size) -{ - UINT i; - IP_PART *p; - UINT need_size; - UINT data_size_delta; - // Validate arguments - if (c == NULL || data == NULL) - { - return; - } - - // Check the size and offset - if ((offset + size) > 65535) - { - // Do not process a packet larger than 64Kbytes - return; - } - - if (last_packet == false && c->Size != 0) - { - if ((offset + size) > c->Size) - { - // Do not process a packet larger than the packet size - return; - } - } - - if (head_ip_header_data != NULL && head_ip_header_size >= sizeof(IPV4_HEADER)) - { - if (c->HeadIpHeaderData == NULL) - { - c->HeadIpHeaderData = Clone(head_ip_header_data, head_ip_header_size); - c->HeadIpHeaderDataSize = head_ip_header_size; - } - } - - need_size = offset + size; - data_size_delta = c->DataReserved; - // Ensure sufficient if the buffer is insufficient - while (c->DataReserved < need_size) - { - c->DataReserved = c->DataReserved * 4; - c->Data = ReAlloc(c->Data, c->DataReserved); - } - data_size_delta = c->DataReserved - data_size_delta; - t->CurrentIpQuota += data_size_delta; - - // Overwrite the data into the buffer - Copy(((UCHAR *)c->Data) + offset, data, size); - - if (last_packet) - { - // If No More Fragment packet arrives, the size of this datagram is finalized - c->Size = offset + size; - } - - // Check the overlap between the region which is represented by the offset and size of the - // existing received list and the region which is represented by the offset and size - for (i = 0; i < LIST_NUM(c->IpParts); i++) - { - UINT moving_size; - IP_PART *p = LIST_DATA(c->IpParts, i); - - // Check the overlapping between the existing area and head area - if ((p->Offset <= offset) && ((p->Offset + p->Size) > offset)) - { - // Compress behind the offset of this packet since a duplication is - // found in the first part with the existing packet and this packet - - if ((offset + size) <= (p->Offset + p->Size)) - { - // This packet is buried in the existing packet - size = 0; - } - else - { - // Retral region is not overlapped - moving_size = p->Offset + p->Size - offset; - offset += moving_size; - size -= moving_size; - } - } - if ((p->Offset < (offset + size)) && ((p->Offset + p->Size) >= (offset + size))) - { - // Compress the size of this packet forward because a duplication is - // found between the posterior portion the existing packet and this packet - - moving_size = p->Offset + p->Size - offset - size; - size -= moving_size; - } - - if ((p->Offset >= offset) && ((p->Offset + p->Size) <= (offset + size))) - { - // This packet was overwritten to completely hunched over a existing packet - p->Size = 0; - } - } - - if (size != 0) - { - // Register this packet - p = ZeroMalloc(sizeof(IP_PART)); - - p->Offset = offset; - p->Size = size; - - Add(c->IpParts, p); - } - - if (c->Size != 0) - { - // Get the total size of the data portion list already received - UINT total_size = 0; - UINT i; - - for (i = 0; i < LIST_NUM(c->IpParts); i++) - { - IP_PART *p = LIST_DATA(c->IpParts, i); - - total_size += p->Size; - } - - if (total_size == c->Size) - { - // Received whole of the IP packet - //Debug("Combine: %u\n", total_size); - NnIpReceived(t, c->SrcIP, c->DestIP, c->Protocol, c->Data, c->Size, c->Ttl, - c->HeadIpHeaderData, c->HeadIpHeaderDataSize, c->MaxL3Size); - - // Release the combining object - NnFreeIpCombine(t, c); - - // Remove from the combining object list - Delete(t->IpCombine, c); - } - } -} - -// Release the IP combining object -void NnFreeIpCombine(NATIVE_NAT *t, IP_COMBINE *c) -{ - UINT i; - // Validate arguments - if (c == NULL) - { - return; - } - - // Release the data - t->CurrentIpQuota -= c->DataReserved; - Free(c->Data); - - // Release the partial list - for (i = 0; i < LIST_NUM(c->IpParts); i++) - { - IP_PART *p = LIST_DATA(c->IpParts, i); - - Free(p); - } - - Free(c->HeadIpHeaderData); - - ReleaseList(c->IpParts); - Free(c); -} - -// Search the IP combining list -IP_COMBINE *NnSearchIpCombine(NATIVE_NAT *t, UINT src_ip, UINT dest_ip, USHORT id, UCHAR protocol) -{ - IP_COMBINE *c, tt; - // Validate arguments - if (t == NULL) - { - return NULL; - } - - tt.DestIP = dest_ip; - tt.SrcIP = src_ip; - tt.Id = id; - tt.Protocol = protocol; - - c = Search(t->IpCombine, &tt); - - return c; -} - -// Insert by creating a new object to the IP combining list -IP_COMBINE *NnInsertIpCombine(NATIVE_NAT *t, UINT src_ip, UINT dest_ip, USHORT id, UCHAR protocol, bool mac_broadcast, UCHAR ttl, bool src_is_localmac) -{ - IP_COMBINE *c; - // Validate arguments - if (t == NULL) - { - return NULL; - } - - // Examine the quota - if ((t->CurrentIpQuota + IP_COMBINE_INITIAL_BUF_SIZE) > IP_COMBINE_WAIT_QUEUE_SIZE_QUOTA) - { - // IP packet can not be stored any more - return NULL; - } - - c = ZeroMalloc(sizeof(IP_COMBINE)); - c->SrcIsLocalMacAddr = src_is_localmac; - c->DestIP = dest_ip; - c->SrcIP = src_ip; - c->Id = id; - c->Expire = t->v->Now + (UINT64)IP_COMBINE_TIMEOUT; - c->Size = 0; - c->IpParts = NewList(NULL); - c->Protocol = protocol; - c->MacBroadcast = mac_broadcast; - c->Ttl = ttl; - - // Secure the memory - c->DataReserved = IP_COMBINE_INITIAL_BUF_SIZE; - c->Data = Malloc(c->DataReserved); - t->CurrentIpQuota += c->DataReserved; - - Insert(t->IpCombine, c); - - return c; -} - -// Initialize the IP combining list -void NnInitIpCombineList(NATIVE_NAT *t) -{ - // Validate arguments - if (t == NULL) - { - return; - } - - t->IpCombine = NewList(CompareIpCombine); -} - -// Release the IP combining list -void NnFreeIpCombineList(NATIVE_NAT *t) -{ - UINT i; - // Validate arguments - if (t == NULL) - { - return; - } - - for (i = 0; i < LIST_NUM(t->IpCombine); i++) - { - IP_COMBINE *c = LIST_DATA(t->IpCombine, i); - - NnFreeIpCombine(t, c); - } - - ReleaseList(t->IpCombine); -} - -// A TCP packet is received -void NnTcpReceived(NATIVE_NAT *t, UINT src_ip, UINT dest_ip, void *data, UINT size, UCHAR ttl, UINT max_l3_size) -{ - TCP_HEADER *tcp; - UCHAR *payload; - UINT payload_size; - UINT tcp_header_size; - // Validate arguments - if (t == NULL || data == NULL) - { - return; - } - - // TCP header - if (size < sizeof(TCP_HEADER)) - { - return; - } - - tcp = (TCP_HEADER *)data; - - // Get the TCP header size - tcp_header_size = TCP_GET_HEADER_SIZE(tcp) * 4; - if (size < tcp_header_size || tcp_header_size < sizeof(TCP_HEADER)) - { - return; - } - - // Payload - payload = ((UCHAR *)data) + tcp_header_size; - payload_size = size - tcp_header_size; - - // Search the port from the NAT table - if (true) - { - NATIVE_NAT_ENTRY tt; - NATIVE_NAT_ENTRY *e; - - NnSetNat(&tt, NAT_TCP, 0, 0, src_ip, Endian16(tcp->SrcPort), dest_ip, Endian16(tcp->DstPort)); - - e = SearchHash(t->NatTableForRecv, &tt); - - if (e != NULL) - { - // Last communication time - e->LastCommTime = t->v->Now; - e->TotalRecv += (UINT64)size; - - // Rewrite the TCP header - tcp->Checksum = 0; - tcp->DstPort = Endian16(e->SrcPort); - - if (tcp->Flag & TCP_FIN || tcp->Flag & TCP_RST) - { - // Disconnect - e->Status = NAT_TCP_WAIT_DISCONNECT; - } - - if (tcp->Flag & TCP_SYN && tcp->Flag & TCP_ACK) - { - // Connection complete - if (e->Status != NAT_TCP_WAIT_DISCONNECT) - { - e->Status = NAT_TCP_ESTABLISHED; - } - } - - e->LastSeq = Endian32(tcp->AckNumber); - e->LastAck = Endian32(tcp->SeqNumber); - - // Checksum recalculation - tcp->Checksum = CalcChecksumForIPv4(src_ip, e->SrcIp, IP_PROTO_TCP, tcp, size, 0); - - // IP transmission - SendIp(t->v, e->SrcIp, src_ip, IP_PROTO_TCP, tcp, size); - } - } -} - -// An ICMP packet has been received -void NnIcmpReceived(NATIVE_NAT *t, UINT src_ip, UINT dest_ip, void *data, UINT size, UCHAR ttl, UINT max_l3_size) -{ - ICMP_HEADER *icmp; - // Validate arguments - if (t == NULL || data == NULL) - { - return; - } - if (ttl == 0) - { - ttl = 1; - } - - // ICMP header - if (size < sizeof(ICMP_HEADER)) - { - return; - } - - icmp = (ICMP_HEADER *)data; - - if (icmp->Type == ICMP_TYPE_ECHO_RESPONSE) - { - UCHAR *payload; - UINT payload_size; - ICMP_ECHO *echo; - NATIVE_NAT_ENTRY tt, *e; - - // Echo Response - echo = (ICMP_ECHO *)(((UCHAR *)data) + sizeof(ICMP_HEADER)); - - if (size < (sizeof(ICMP_HEADER) + sizeof(ICMP_ECHO))) - { - return; - } - - payload = ((UCHAR *)data) + sizeof(ICMP_HEADER) + sizeof(ICMP_ECHO); - payload_size = size - (sizeof(ICMP_HEADER) + sizeof(ICMP_ECHO)); - - // Search the NAT - NnSetNat(&tt, NAT_ICMP, 0, 0, 0, 0, dest_ip, Endian16(echo->Identifier)); - - e = SearchHash(t->NatTableForRecv, &tt); - - if (e != NULL) - { - // Rewrite the header - icmp->Checksum = 0; - echo->Identifier = Endian16(e->SrcPort); - icmp->Checksum = IpChecksum(icmp, size); - - e->LastCommTime = t->v->Now; - e->TotalRecv += (UINT64)size; - - // Transmission - SendIpEx(t->v, e->SrcIp, src_ip, IP_PROTO_ICMPV4, icmp, size, MAX(ttl - 1, 1)); - } - } - else if (icmp->Type == ICMP_TYPE_ECHO_REQUEST) - { - UCHAR *payload; - UINT payload_size; - ICMP_ECHO *echo; - - // Echo Response - echo = (ICMP_ECHO *)(((UCHAR *)data) + sizeof(ICMP_HEADER)); - - if (size < (sizeof(ICMP_HEADER) + sizeof(ICMP_ECHO))) - { - return; - } - - payload = ((UCHAR *)data) + sizeof(ICMP_HEADER) + sizeof(ICMP_ECHO); - payload_size = size - (sizeof(ICMP_HEADER) + sizeof(ICMP_ECHO)); - - if (dest_ip == t->PublicIP) - { - // Respond as soon as the Echo Request is received at the public side interface - ICMP_HEADER *ret_icmp; - ICMP_ECHO *ret_echo; - UINT ret_size = sizeof(ICMP_HEADER) + sizeof(ICMP_ECHO) + payload_size; - - ret_icmp = ZeroMalloc(ret_size); - ret_echo = (ICMP_ECHO *)(((UCHAR *)ret_icmp) + sizeof(ICMP_HEADER)); - - ret_icmp->Type = ICMP_TYPE_ECHO_RESPONSE; - ret_icmp->Code = icmp->Code; - - ret_echo->Identifier = echo->Identifier; - ret_echo->SeqNo = echo->SeqNo; - - Copy((UCHAR *)ret_icmp + sizeof(ICMP_HEADER) + sizeof(ICMP_ECHO), - payload, payload_size); - - ret_icmp->Checksum = IpChecksum(ret_icmp, ret_size); - - NnIpSendForInternet(t, IP_PROTO_ICMPV4, 0, dest_ip, src_ip, ret_icmp, ret_size, max_l3_size); - - Free(ret_icmp); - } - } - else - { - if (icmp->Type == ICMP_TYPE_DESTINATION_UNREACHABLE || icmp->Type == ICMP_TYPE_TIME_EXCEEDED) - { - // Rewrite the Src IP of the IPv4 header of the ICMP response packet - if (size >= (sizeof(ICMP_HEADER) + sizeof(ICMP_ECHO) + sizeof(IPV4_HEADER))) - { - IPV4_HEADER *orig_ipv4 = (IPV4_HEADER *)(((UCHAR *)data) + sizeof(ICMP_HEADER) + sizeof(ICMP_ECHO)); - UINT orig_ipv4_size = size - (sizeof(ICMP_HEADER) + sizeof(ICMP_ECHO)); - - UINT orig_ipv4_header_size = GetIpHeaderSize((UCHAR *)orig_ipv4, orig_ipv4_size); - - if (orig_ipv4_header_size >= sizeof(IPV4_HEADER) && orig_ipv4_size >= orig_ipv4_header_size) - { - if (orig_ipv4->Protocol == IP_PROTO_ICMPV4) - { - // Search the inner ICMP header - UINT inner_icmp_size = orig_ipv4_size - orig_ipv4_header_size; - - if (inner_icmp_size >= (sizeof(ICMP_HEADER) + sizeof(ICMP_ECHO))) - { - ICMP_HEADER *inner_icmp = (ICMP_HEADER *)(((UCHAR *)data) + - sizeof(ICMP_HEADER) + sizeof(ICMP_ECHO) + orig_ipv4_header_size); - - if (inner_icmp->Type == ICMP_TYPE_ECHO_REQUEST) - { - ICMP_ECHO *inner_echo = (ICMP_ECHO *)(((UCHAR *)inner_icmp) + sizeof(ICMP_HEADER)); - NATIVE_NAT_ENTRY tt, *e; - - // Search for the existing NAT table entry - NnSetNat(&tt, NAT_ICMP, 0, 0, 0, 0, orig_ipv4->SrcIP, Endian16(inner_echo->Identifier)); - - e = SearchHash(t->NatTableForRecv, &tt); - - if (e != NULL) - { - e->LastCommTime = t->v->Now; - - // Rewrite the inner IP packet and the ICMP header according to the NAT table - inner_echo->Identifier = Endian16(e->SrcPort); - inner_icmp->Checksum = 0; - - orig_ipv4->SrcIP = e->SrcIp; - - orig_ipv4->Checksum = 0; - orig_ipv4->Checksum = IpChecksum(orig_ipv4, orig_ipv4_header_size); - - // Rewrite the outer ICMP header - if (true) - { - UCHAR *payload; - UINT payload_size; - ICMP_ECHO *echo; - - // Echo Response - echo = (ICMP_ECHO *)(((UCHAR *)data) + sizeof(ICMP_HEADER)); - - if (size < (sizeof(ICMP_HEADER) + sizeof(ICMP_ECHO))) - { - return; - } - - payload = ((UCHAR *)data) + sizeof(ICMP_HEADER) + sizeof(ICMP_ECHO); - payload_size = size - (sizeof(ICMP_HEADER) + sizeof(ICMP_ECHO)); - - // Rewrite the header - icmp->Checksum = 0; - echo->Identifier = Endian16(e->SrcPort); - icmp->Checksum = IpChecksum(icmp, size); - - // Transmission - SendIpEx(t->v, e->SrcIp, src_ip, IP_PROTO_ICMPV4, icmp, size, MAX(ttl - 1, 1)); - } - } - } - } - } - } - } - } - } -} - -// An UDP packet has been received -void NnUdpReceived(NATIVE_NAT *t, UINT src_ip, UINT dest_ip, void *data, UINT size, UCHAR ttl, UINT max_l3_size) -{ - UDP_HEADER *udp; - UCHAR *payload; - UINT payload_size; - // Validate arguments - if (t == NULL || data == NULL) - { - return; - } - - // UDP header - if (size <= sizeof(UDP_HEADER)) - { - return; - } - - udp = (UDP_HEADER *)data; - - // Payload - payload = ((UCHAR *)data) + sizeof(UDP_HEADER); - payload_size = size - sizeof(UDP_HEADER); - - // Inspect the payload size - if (payload_size < (Endian16(udp->PacketLength) - sizeof(UDP_HEADER))) - { - return; - } - - // Truncate the payload - payload_size = Endian16(udp->PacketLength) - sizeof(UDP_HEADER); - - // Search the port number from the NAT table - if (true) - { - NATIVE_NAT_ENTRY tt; - NATIVE_NAT_ENTRY *e; - - NnSetNat(&tt, NAT_UDP, 0, 0, 0, 0, dest_ip, Endian16(udp->DstPort)); - - e = SearchHash(t->NatTableForRecv, &tt); - - if (e != NULL) - { - // Last communication time - e->LastCommTime = t->v->Now; - e->TotalRecv += (UINT64)payload_size; - - // Deliver to the client by rewriting the port number - SendUdp(t->v, e->SrcIp, e->SrcPort, src_ip, Endian16(udp->SrcPort), - payload, payload_size); - } - } -} - -// A combined IP packet is received -void NnIpReceived(NATIVE_NAT *t, UINT src_ip, UINT dest_ip, UINT protocol, void *data, UINT size, - UCHAR ttl, UCHAR *ip_header, UINT ip_header_size, UINT max_l3_size) -{ - // Validate arguments - if (t == NULL || data == NULL) - { - return; - } - - if (dest_ip != t->PublicIP) - { - // Destination IP is not a unicast - return; - } - - switch (protocol) - { - case IP_PROTO_UDP: - // UDP - NnUdpReceived(t, src_ip, dest_ip, data, size, ttl, max_l3_size); - break; - - case IP_PROTO_TCP: - // TCP - NnTcpReceived(t, src_ip, dest_ip, data, size, ttl, max_l3_size); - break; - - case IP_PROTO_ICMPV4: - // ICMP - NnIcmpReceived(t, src_ip, dest_ip, data, size, ttl, max_l3_size); - break; - } -} - -// Received an IP packet -void NnFragmentedIpReceived(NATIVE_NAT *t, PKT *packet) -{ - IPV4_HEADER *ip; - void *data; - UINT data_size_recved; - UINT size; - UINT ipv4_header_size; - bool last_packet = false; - UINT l3_size = 0; - UCHAR *head_ip_header_data = NULL; - UINT head_ip_header_size = 0; - // Validate arguments - if (t == NULL || packet == NULL) - { - return; - } - - ip = packet->L3.IPv4Header; - - // Get the size of the IPv4 header - ipv4_header_size = IPV4_GET_HEADER_LEN(packet->L3.IPv4Header) * 4; - head_ip_header_size = ipv4_header_size; - - // Get the pointer to the data - data = ((UCHAR *)packet->L3.PointerL3) + ipv4_header_size; - - // Get the data size - size = l3_size = Endian16(ip->TotalLength); - if (size <= ipv4_header_size) - { - // There is no data - return; - } - size -= ipv4_header_size; - - // Get the size of data actually received - data_size_recved = packet->PacketSize - (ipv4_header_size + MAC_HEADER_SIZE); - if (data_size_recved < size) - { - // Data insufficient (It may be missing on the way) - return; - } - - if (IPV4_GET_OFFSET(ip) == 0 && (IPV4_GET_FLAGS(ip) & 0x01) == 0) - { - // Because this packet has not been fragmented, it can be passed to the upper layer immediately - head_ip_header_data = (UCHAR *)packet->L3.IPv4Header; - NnIpReceived(t, ip->SrcIP, ip->DstIP, ip->Protocol, data, size, ip->TimeToLive, - head_ip_header_data, head_ip_header_size, l3_size); - } - else - { - // This packet is necessary to combine because it is fragmented - UINT offset = IPV4_GET_OFFSET(ip) * 8; - IP_COMBINE *c = NnSearchIpCombine(t, ip->SrcIP, ip->DstIP, Endian16(ip->Identification), ip->Protocol); - - if (offset == 0) - { - head_ip_header_data = (UCHAR *)packet->L3.IPv4Header; - } - - last_packet = ((IPV4_GET_FLAGS(ip) & 0x01) == 0 ? true : false); - - if (c != NULL) - { - // It is the second or subsequent packet - c->MaxL3Size = MAX(c->MaxL3Size, l3_size); - NnCombineIp(t, c, offset, data, size, last_packet, head_ip_header_data, head_ip_header_size); - } - else - { - // Create a combining object because it is the first packet - c = NnInsertIpCombine( - t, ip->SrcIP, ip->DstIP, Endian16(ip->Identification), ip->Protocol, packet->BroadcastPacket, - ip->TimeToLive, false); - if (c != NULL) - { - c->MaxL3Size = MAX(c->MaxL3Size, l3_size); - NnCombineIp(t, c, offset, data, size, last_packet, head_ip_header_data, head_ip_header_size); - } - } - } -} - -// Layer 2 packet processing -void NnLayer2(NATIVE_NAT *t, PKT *packet) -{ - // Validate arguments - if (t == NULL || packet == NULL) - { - return; - } - - if (packet->TypeL3 == L3_IPV4) - { - // IPv4 - NnFragmentedIpReceived(t, packet); - } -} - -// Extract the received packets of native NAT, and deliver it to the VPN client -void NnPoll(NATIVE_NAT *t) -{ - // Validate arguments - if (t == NULL) - { - return; - } - - LockQueue(t->RecvQueue); - { - while (true) - { - PKT *pkt = GetNext(t->RecvQueue); - - if (pkt == NULL) - { - break; - } - - NnLayer2(t, pkt); - - FreePacketWithData(pkt); - } - } - UnlockQueue(t->RecvQueue); - - if (t->SendStateChanged) - { - TUBE *halt_tube = NULL; - - Lock(t->Lock); - { - if (t->HaltTube != NULL) - { - halt_tube = t->HaltTube; - - AddRef(halt_tube->Ref); - } - } - Unlock(t->Lock); - - if (halt_tube != NULL) - { - TubeFlushEx(halt_tube, true); - - t->SendStateChanged = false; - - ReleaseTube(halt_tube); - } - } - - NnPollingIpCombine(t); - - NnDeleteOldSessions(t); -} - -// Send a fragmented IP packet to the Internet -void NnIpSendFragmentedForInternet(NATIVE_NAT *t, UCHAR ip_protocol, UINT src_ip, UINT dest_ip, USHORT id, USHORT total_size, - USHORT offset, void *data, UINT size, UCHAR ttl) -{ - UCHAR *buf; - IPV4_HEADER *ip; - BLOCK *b; - // Validate arguments - if (t == NULL || data == NULL) - { - return; - } - - // Memory allocation - buf = Malloc(size + IP_HEADER_SIZE); - ip = (IPV4_HEADER *)&buf[0]; - - // IP header construction - ip->VersionAndHeaderLength = 0; - IPV4_SET_VERSION(ip, 4); - IPV4_SET_HEADER_LEN(ip, (IP_HEADER_SIZE / 4)); - ip->TypeOfService = DEFAULT_IP_TOS; - ip->TotalLength = Endian16((USHORT)(size + IP_HEADER_SIZE)); - ip->Identification = Endian16(id); - ip->FlagsAndFragmentOffset[0] = ip->FlagsAndFragmentOffset[1] = 0; - IPV4_SET_OFFSET(ip, (offset / 8)); - if ((offset + size) >= total_size) - { - IPV4_SET_FLAGS(ip, 0x00); - } - else - { - IPV4_SET_FLAGS(ip, 0x01); - } - ip->TimeToLive = (ttl == 0 ? DEFAULT_IP_TTL : ttl); - ip->Protocol = ip_protocol; - ip->Checksum = 0; - ip->SrcIP = src_ip; - ip->DstIP = dest_ip; - - // Checksum calculation - ip->Checksum = IpChecksum(ip, IP_HEADER_SIZE); - - // Data copy - Copy(buf + IP_HEADER_SIZE, data, size); - - // Transmission - b = NewBlock(buf, size + IP_HEADER_SIZE, 0); - - LockQueue(t->SendQueue); - { - if (t->SendQueue->num_item <= NN_MAX_QUEUE_LENGTH) - { - InsertQueue(t->SendQueue, b); - - t->SendStateChanged = true; - } - else - { - FreeBlock(b); - } - } - UnlockQueue(t->SendQueue); -} - -// Send an IP packet to the Internet -void NnIpSendForInternet(NATIVE_NAT *t, UCHAR ip_protocol, UCHAR ttl, UINT src_ip, UINT dest_ip, void *data, UINT size, UINT max_l3_size) -{ - UINT mss = 0; - UCHAR *buf; - USHORT offset; - USHORT id; - USHORT total_size; - UINT size_of_this_packet; - // Validate arguments - if (t == NULL || data == NULL) - { - return; - } - - // Maximum segment size - if (max_l3_size > IP_HEADER_SIZE) - { - mss = max_l3_size - IP_HEADER_SIZE; - } - - if (mss == 0) - { - mss = t->v->IpMss; - } - - mss = MAX(mss, 1000); - - // Buffer - buf = (UCHAR *)data; - - // ID - id = (t->NextId++); - - // Total size - total_size = (USHORT)size; - - // Start to fragment - offset = 0; - - while (true) - { - bool last_packet = false; - // Get the size of this packet - size_of_this_packet = MIN((USHORT)mss, (total_size - offset)); - if ((offset + (USHORT)size_of_this_packet) == total_size) - { - last_packet = true; - } - - // Transmit the fragmented packet - NnIpSendFragmentedForInternet(t, ip_protocol, src_ip, dest_ip, id, total_size, offset, - buf + offset, size_of_this_packet, ttl); - if (last_packet) - { - break; - } - - offset += (USHORT)size_of_this_packet; - } -} - -// Communication of ICMP towards the Internet -void NnIcmpEchoRecvForInternet(VH *v, UINT src_ip, UINT dest_ip, void *data, UINT size, UCHAR ttl, void *icmp_data, UINT icmp_size, UCHAR *ip_header, UINT ip_header_size, UINT max_l3_size) -{ - NATIVE_NAT_ENTRY tt; - NATIVE_NAT_ENTRY *e; - NATIVE_NAT *t; - USHORT src_port; - ICMP_HEADER *old_icmp_header; - ICMP_ECHO *old_icmp_echo; - ICMP_HEADER *icmp; - ICMP_ECHO *echo; - UCHAR *payload_data; - UINT payload_size; - // Validate arguments - if (NnIsActive(v) == false || icmp_data == NULL) - { - return; - } - - t = v->NativeNat; - - old_icmp_header = (ICMP_HEADER *)icmp_data; - old_icmp_echo = (ICMP_ECHO *)(((UCHAR *)icmp_data) + sizeof(ICMP_HEADER)); - - if (size < (sizeof(ICMP_HEADER) + sizeof(ICMP_ECHO))) - { - return; - } - - payload_data = ((UCHAR *)icmp_data) + (sizeof(ICMP_HEADER) + sizeof(ICMP_ECHO)); - payload_size = icmp_size - (sizeof(ICMP_HEADER) + sizeof(ICMP_ECHO)); - - if (dest_ip == v->HostIP) - { - // Respond because it is addressed to me - VirtualIcmpEchoSendResponse(v, dest_ip, src_ip, Endian16(old_icmp_echo->Identifier), - Endian16(old_icmp_echo->SeqNo), payload_data, payload_size); - - return; - } - - if (ttl <= 1) - { - // Reply the Time Exceeded immediately for the packet whose TTL is 1 - UINT reply_size = sizeof(ICMP_HEADER) + 4 + ip_header_size + 8; - UCHAR *reply_data = ZeroMalloc(reply_size); - ICMP_HEADER *icmp = (ICMP_HEADER *)reply_data; - icmp->Type = ICMP_TYPE_TIME_EXCEEDED; - icmp->Code = ICMP_CODE_TTL_EXCEEDED_IN_TRANSIT; - Copy(reply_data + sizeof(ICMP_HEADER) + 4, ip_header, ip_header_size); - Copy(reply_data + sizeof(ICMP_HEADER) + 4 + ip_header_size, icmp_data, MIN(icmp_size, 8)); - - icmp->Checksum = IpChecksum(icmp, reply_size); - - SendIp(v, src_ip, v->HostIP, IP_PROTO_ICMPV4, reply_data, reply_size); - - Free(reply_data); - - return; - } - - src_port = Endian16(old_icmp_echo->Identifier); - - // Search whether there is an existing session - NnSetNat(&tt, NAT_ICMP, src_ip, src_port, 0, 0, 0, 0); - - e = SearchHash(t->NatTableForSend, &tt); - - if (e == NULL) - { - // Create a new session because there is no existing one - UINT public_port; - - if (CanCreateNewNatEntry(v) == false) - { - // Can not make any more - return; - } - - NnDeleteOldestNatSessionIfNecessary(t, src_ip, NAT_ICMP); - - // Get a free port - public_port = NnMapNewPublicPort(t, NAT_ICMP, 0, 0, t->PublicIP); - if (public_port == 0) - { - // There are no free ports - return; - } - - e = ZeroMalloc(sizeof(NATIVE_NAT_ENTRY)); - - e->Status = NAT_TCP_ESTABLISHED; - - e->HashCodeForSend = INFINITE; - e->HashCodeForRecv = INFINITE; - e->Id = Inc(v->Counter); - e->Protocol = NAT_ICMP; - e->SrcIp = src_ip; - e->SrcPort = src_port; - e->DestIp = 0; - e->DestPort = 0; - e->PublicIp = t->PublicIP; - e->PublicPort = public_port; - - e->CreatedTime = v->Now; - e->LastCommTime = v->Now; - - // Add to the list - AddHash(t->NatTableForSend, e); - AddHash(t->NatTableForRecv, e); - - // Log - if (true) - { - IP ip1, ip2; - char s1[MAX_SIZE], s2[MAX_SIZE]; - UINTToIP(&ip1, src_ip); - UINTToIP(&ip2, dest_ip); - IPToStr(s1, 0, &ip1); - IPToStr(s2, 0, &ip2); - - Debug("ICMP Session %u: %s:0x%x -> %s:0x%x\n", e->Id, s1, src_port, s2, public_port); - } - } - - // Rebuild the ICMP header - icmp = ZeroMalloc(sizeof(ICMP_HEADER) + sizeof(ICMP_ECHO) + payload_size); - icmp->Code = old_icmp_header->Code; - icmp->Type = old_icmp_header->Type; - icmp->Checksum = 0; - - echo = (ICMP_ECHO *)(((UCHAR *)icmp) + sizeof(ICMP_HEADER)); - echo->SeqNo = old_icmp_echo->SeqNo; - echo->Identifier = Endian16(e->PublicPort); - - Copy(((UCHAR *)icmp) + sizeof(ICMP_HEADER) + sizeof(ICMP_ECHO), payload_data, payload_size); - - icmp->Checksum = IpChecksum(icmp, sizeof(ICMP_HEADER) + sizeof(ICMP_ECHO) + payload_size); - - e->TotalSent += (UINT64)payload_size; - e->LastCommTime = v->Now; - - // Send to the Internet - NnIpSendForInternet(t, IP_PROTO_ICMPV4, ttl - 1, e->PublicIp, dest_ip, icmp, sizeof(ICMP_HEADER) + sizeof(ICMP_ECHO) + payload_size, max_l3_size); - - Free(icmp); -} - -// Communication of UDP towards the Internet -void NnUdpRecvForInternet(VH *v, UINT src_ip, UINT src_port, UINT dest_ip, UINT dest_port, void *data, UINT size, UINT max_l3_size) -{ - NATIVE_NAT_ENTRY tt; - NATIVE_NAT_ENTRY *e; - NATIVE_NAT *t; - UDP_HEADER *udp; - // Validate arguments - if (NnIsActive(v) == false || data == NULL) - { - return; - } - - t = v->NativeNat; - - // Search whether there is an existing session - NnSetNat(&tt, NAT_UDP, src_ip, src_port, 0, 0, 0, 0); - - e = SearchHash(t->NatTableForSend, &tt); - - if (e == NULL) - { - // Create a new session because there is no existing one - UINT public_port; - - if (CanCreateNewNatEntry(v) == false) - { - // Can not make any more - return; - } - - NnDeleteOldestNatSessionIfNecessary(t, src_ip, NAT_UDP); - - // Get a free port - public_port = NnMapNewPublicPort(t, NAT_UDP, 0, 0, t->PublicIP); - if (public_port == 0) - { - // There are no free ports - return; - } - - e = ZeroMalloc(sizeof(NATIVE_NAT_ENTRY)); - - e->Status = NAT_TCP_ESTABLISHED; - - e->HashCodeForSend = INFINITE; - e->HashCodeForRecv = INFINITE; - e->Id = Inc(v->Counter); - e->Protocol = NAT_UDP; - e->SrcIp = src_ip; - e->SrcPort = src_port; - e->DestIp = 0; - e->DestPort = 0; - e->PublicIp = t->PublicIP; - e->PublicPort = public_port; - - e->CreatedTime = v->Now; - e->LastCommTime = v->Now; - - // Add to the list - AddHash(t->NatTableForSend, e); - AddHash(t->NatTableForRecv, e); - - // Log - if (true) - { - IP ip1, ip2; - char s1[MAX_SIZE], s2[MAX_SIZE]; - UINTToIP(&ip1, src_ip); - UINTToIP(&ip2, dest_ip); - IPToStr(s1, 0, &ip1); - IPToStr(s2, 0, &ip2); - - NLog(v, "LH_NAT_UDP_CREATED", e->Id, s1, src_port, s2, dest_port); - } - } - - // Rebuild the UDP header - udp = ZeroMalloc(sizeof(UDP_HEADER) + size); - - udp->SrcPort = Endian16(e->PublicPort); - udp->DstPort = Endian16(dest_port); - udp->PacketLength = Endian16((USHORT)sizeof(UDP_HEADER) + size); - - Copy(((UCHAR *)udp) + sizeof(UDP_HEADER), data, size); - - udp->Checksum = CalcChecksumForIPv4(e->PublicIp, dest_ip, IP_PROTO_UDP, udp, sizeof(UDP_HEADER) + size, 0); - - e->TotalSent += (UINT64)size; - e->LastCommTime = v->Now; - - // Send to the Internet - NnIpSendForInternet(t, IP_PROTO_UDP, 127, e->PublicIp, dest_ip, udp, sizeof(UDP_HEADER) + size, max_l3_size); - - Free(udp); -} - -// Communication of TCP towards the Internet -void NnTcpRecvForInternet(VH *v, UINT src_ip, UINT src_port, UINT dest_ip, UINT dest_port, TCP_HEADER *old_tcp, void *data, UINT size, UINT max_l3_size) -{ - NATIVE_NAT_ENTRY tt; - NATIVE_NAT_ENTRY *e; - NATIVE_NAT *t; - UINT tcp_header_size; - TCP_HEADER *tcp; - // Validate arguments - if (NnIsActive(v) == false || old_tcp == NULL || data == NULL) - { - return; - } - - t = v->NativeNat; - - // Search whether there is an existing session - NnSetNat(&tt, NAT_TCP, src_ip, src_port, dest_ip, dest_port, 0, 0); - - e = SearchHash(t->NatTableForSend, &tt); - - if (e == NULL) - { - // Create a new session because there is no existing one - UINT public_port; - - if (((old_tcp->Flag & TCP_SYN) && ((old_tcp->Flag & TCP_ACK) == 0)) == false) - { - // If there is no existing session, pass through only for SYN packet - return; - } - - if (CanCreateNewNatEntry(v) == false) - { - // Can not make any more - return; - } - - NnDeleteOldestNatSessionIfNecessary(t, src_ip, NAT_TCP); - - // Get a free port - public_port = NnMapNewPublicPort(t, NAT_TCP, dest_ip, dest_port, t->PublicIP); - if (public_port == 0) - { - // There are no free ports - return; - } - - e = ZeroMalloc(sizeof(NATIVE_NAT_ENTRY)); - - e->HashCodeForSend = INFINITE; - e->HashCodeForRecv = INFINITE; - e->Id = Inc(v->Counter); - e->Status = NAT_TCP_CONNECTING; - e->Protocol = NAT_TCP; - e->SrcIp = src_ip; - e->SrcPort = src_port; - e->DestIp = dest_ip; - e->DestPort = dest_port; - e->PublicIp = t->PublicIP; - e->PublicPort = public_port; - - e->CreatedTime = v->Now; - e->LastCommTime = v->Now; - - // Add to the list - AddHash(t->NatTableForSend, e); - AddHash(t->NatTableForRecv, e); - - // Log - if (true) - { - IP ip1, ip2; - char s1[MAX_SIZE], s2[MAX_SIZE]; - UINTToIP(&ip1, src_ip); - UINTToIP(&ip2, dest_ip); - IPToStr(s1, 0, &ip1); - IPToStr(s2, 0, &ip2); - - NLog(v, "LH_NAT_TCP_CREATED", e->Id, s1, src_port, s2, dest_port); - } - } - - // Update the last communication time - e->LastCommTime = v->Now; - - e->TotalSent += (UINT64)size; - - tcp_header_size = TCP_GET_HEADER_SIZE(old_tcp) * 4; - - // Create a new TCP packet - tcp = ZeroMalloc(tcp_header_size + size); - - // Copy the old TCP header - Copy(tcp, old_tcp, tcp_header_size); - - if (tcp->Flag & TCP_RST || tcp->Flag & TCP_FIN) - { - // Disconnect - e->Status = NAT_TCP_WAIT_DISCONNECT; - } - - // Rewrite the TCP header - tcp->Checksum = 0; - tcp->SrcPort = Endian16(e->PublicPort); - - e->LastSeq = Endian32(tcp->SeqNumber); - e->LastAck = Endian32(tcp->AckNumber); - - // Payload - Copy(((UCHAR *)tcp) + tcp_header_size, data, size); - - // Checksum calculation - tcp->Checksum = CalcChecksumForIPv4(e->PublicIp, dest_ip, IP_PROTO_TCP, tcp, tcp_header_size + size, 0); - - // Send to the Internet - NnIpSendForInternet(t, IP_PROTO_TCP, 127, e->PublicIp, dest_ip, tcp, tcp_header_size + size, max_l3_size); - - Free(tcp); -} - -// Assign a new public-side port -UINT NnMapNewPublicPort(NATIVE_NAT *t, UINT protocol, UINT dest_ip, UINT dest_port, UINT public_ip) -{ - UINT i; - UINT base_port; - UINT port_start = 1025; - UINT port_end = 65500; - // Validate arguments - if (t == NULL) - { - return 0; - } - - if (t->IsRawIpMode) - { - port_start = NN_RAW_IP_PORT_START; - port_end = NN_RAW_IP_PORT_END; - } - - base_port = Rand32() % (port_end - port_start) + port_start; - - for (i = 0; i < (port_end - port_start); i++) - { - UINT port; - NATIVE_NAT_ENTRY tt; - NATIVE_NAT *e; - - port = base_port + i; - if (port > port_end) - { - port = port - port_end + port_start; - } - - // Is this port vacant? - NnSetNat(&tt, protocol, 0, 0, dest_ip, dest_port, public_ip, port); - - e = SearchHash(t->NatTableForRecv, &tt); - - if (e == NULL) - { - // Free port is found - return port; - } - } - - return 0; -} - -// Examine whether the native NAT is available -bool NnIsActive(VH *v) -{ - return NnIsActiveEx(v, NULL); -} -bool NnIsActiveEx(VH *v, bool *is_ipraw_mode) -{ - // Validate arguments - if (v == NULL) - { - return false; - } - - if (v->NativeNat == NULL) - { - return false; - } - - if (v->NativeNat->PublicIP == 0) - { - return false; - } - - if (v->NativeNat->Active) - { - if (is_ipraw_mode != NULL) - { - *is_ipraw_mode = v->NativeNat->IsRawIpMode; - } - } - - return v->NativeNat->Active; -} - -// Native NAT main loop -void NnMainLoop(NATIVE_NAT *t, NATIVE_STACK *a) -{ - IPC *ipc; - TUBE *tubes[3]; - UINT num_tubes = 0; - UINT64 next_poll_tick = 0; - INTERRUPT_MANAGER *interrupt; - USHORT dns_src_port = 0; - USHORT dns_tran_id = 0; - USHORT tcp_src_port = 0; - UINT tcp_seq = 0; - IP yahoo_ip; - bool wait_for_dns = false; - UINT64 tcp_last_recv_tick = 0; - UINT dhcp_renew_interval; - UINT64 next_dhcp_renew_tick = 0; - // Validate arguments - if (t == NULL || a == NULL) - { - return; - } - - dhcp_renew_interval = a->CurrentDhcpOptionList.LeaseTime; - - if (dhcp_renew_interval == 0) - { - dhcp_renew_interval = IPC_DHCP_DEFAULT_LEASE; - } - - dhcp_renew_interval = MAX(dhcp_renew_interval, IPC_DHCP_MIN_LEASE) / 2; - - interrupt = NewInterruptManager(); - - ipc = a->Ipc; - - tubes[num_tubes++] = ipc->Sock->RecvTube; - //tubes[num_tubes++] = ipc->Sock->SendTube; // bug 2015.10.01 remove - tubes[num_tubes++] = t->HaltTube; - - Zero(&yahoo_ip, sizeof(yahoo_ip)); - - next_poll_tick = Tick64() + (UINT64)NN_POLL_CONNECTIVITY_INTERVAL; - AddInterrupt(interrupt, next_poll_tick); - - tcp_last_recv_tick = Tick64(); - next_dhcp_renew_tick = Tick64() + (UINT64)dhcp_renew_interval * 1000; - AddInterrupt(interrupt, next_dhcp_renew_tick); - - while (t->Halt == false && t->v->UseNat) - { - UINT64 now = Tick64(); - bool call_cancel = false; - bool state_changed = false; - UINT wait_interval; - - if (t->v->HubOption != NULL) - { - if (t->IsRawIpMode == false && t->v->HubOption->DisableKernelModeSecureNAT) - { - break; - } - if (t->IsRawIpMode && t->v->HubOption->DisableIpRawModeSecureNAT) - { - break; - } - } - - IPCFlushArpTable(ipc); - call_cancel = false; - -LABEL_RESTART: - state_changed = false; - - if (next_poll_tick == 0 || next_poll_tick <= now) - { - BUF *dns_query; - - dns_src_port = NnGenSrcPort(a->IsIpRawMode); - dns_tran_id = Rand16(); - - // Start a connectivity check periodically - dns_query = NnBuildIpPacket(NnBuildUdpPacket(NnBuildDnsQueryPacket(NN_CHECK_HOSTNAME, dns_tran_id), - IPToUINT(&ipc->ClientIPAddress), dns_src_port, IPToUINT(&a->DnsServerIP), 53), - IPToUINT(&ipc->ClientIPAddress), IPToUINT(&a->DnsServerIP), IP_PROTO_UDP, 0); - - IPCSendIPv4(ipc, dns_query->Buf, dns_query->Size); - - wait_for_dns = true; - - FreeBuf(dns_query); - - next_poll_tick = now + (UINT64)NN_POLL_CONNECTIVITY_INTERVAL; - AddInterrupt(interrupt, next_poll_tick); - } - - if (next_dhcp_renew_tick == 0 || next_dhcp_renew_tick <= now) - { - IP ip; - - UINTToIP(&ip, a->CurrentDhcpOptionList.ServerAddress); - - IPCDhcpRenewIP(ipc, &ip); - - next_dhcp_renew_tick = now + (UINT64)dhcp_renew_interval * 1000; - AddInterrupt(interrupt, next_dhcp_renew_tick); - } - - // Send an IP packet to IPC - LockQueue(t->SendQueue); - { - while (true) - { - BLOCK *b = GetNext(t->SendQueue); - - if (b == NULL) - { - break; - } - - IPCSendIPv4(ipc, b->Buf, b->Size); - - state_changed = true; - - FreeBlock(b); - } - } - UnlockQueue(t->SendQueue); - - // Happy processing - IPCProcessL3EventsIPv4Only(ipc); - - LockQueue(t->RecvQueue); - { - while (true) - { - // Receive an IP packet from IPC - BLOCK *b = IPCRecvIPv4(ipc); - PKT *pkt; - - if (b == NULL) - { - // Can not receive any more - break; - } - - // Parse the packet - pkt = ParsePacketIPv4WithDummyMacHeader(b->Buf, b->Size); - - FreeBlock(b); - - if (pkt != NULL) - { - bool no_store = false; - - // Read the contents of the packet first, to determine whether it is a response for the connectivity test packet - if (wait_for_dns) - { - if (pkt->TypeL3 == L3_IPV4 && pkt->TypeL4 == L4_UDP && - pkt->L3.IPv4Header->SrcIP == IPToUINT(&a->DnsServerIP) && - pkt->L3.IPv4Header->DstIP == IPToUINT(&ipc->ClientIPAddress) && - pkt->L4.UDPHeader->SrcPort == Endian16(53) && pkt->L4.UDPHeader->DstPort == Endian16(dns_src_port)) - { - DNSV4_HEADER *dns_header = (DNSV4_HEADER *)pkt->Payload; - if (pkt->PayloadSize >= sizeof(DNSV4_HEADER)) - { - if (dns_header->TransactionId == Endian16(dns_tran_id)) - { - IP ret_ip; - - if (NnParseDnsResponsePacket(pkt->Payload, pkt->PayloadSize, &ret_ip)) - { - BUF *tcp_query; - - Copy(&yahoo_ip, &ret_ip, sizeof(IP)); - - //SetIP(&yahoo_ip, 192, 168, 2, 32); - - // DNS response has been received - no_store = true; - - tcp_src_port = NnGenSrcPort(a->IsIpRawMode); - - // Generate a TCP connection attempt packet - tcp_seq = Rand32(); - tcp_query = NnBuildIpPacket(NnBuildTcpPacket(NewBuf(), IPToUINT(&ipc->ClientIPAddress), tcp_src_port, - IPToUINT(&yahoo_ip), 80, tcp_seq, 0, TCP_SYN, 8192, 1414), - IPToUINT(&ipc->ClientIPAddress), IPToUINT(&yahoo_ip), IP_PROTO_TCP, 0); - - IPCSendIPv4(ipc, tcp_query->Buf, tcp_query->Size); - - FreeBuf(tcp_query); - - wait_for_dns = false; - } - } - } - } - } - - if (pkt->TypeL3 == L3_IPV4 && pkt->TypeL4 == L4_TCP && - pkt->L3.IPv4Header->SrcIP == IPToUINT(&yahoo_ip) && - pkt->L3.IPv4Header->DstIP == IPToUINT(&ipc->ClientIPAddress) && - pkt->L4.TCPHeader->SrcPort == Endian16(80) && pkt->L4.TCPHeader->DstPort == Endian16(tcp_src_port)) - { - TCP_HEADER *tcp_header = (TCP_HEADER *)pkt->L4.TCPHeader; - if ((tcp_header->Flag & TCP_SYN) && (tcp_header->Flag & TCP_ACK)) - { - // There was a TCP response - BUF *tcp_query; - UINT recv_seq = Endian32(tcp_header->SeqNumber) + 1; - - no_store = true; - - // Send a RST - tcp_query = NnBuildIpPacket(NnBuildTcpPacket(NewBuf(), IPToUINT(&ipc->ClientIPAddress), tcp_src_port, - IPToUINT(&yahoo_ip), 80, tcp_seq + 1, recv_seq, TCP_RST | TCP_ACK, 8192, 0), - IPToUINT(&ipc->ClientIPAddress), IPToUINT(&yahoo_ip), IP_PROTO_TCP, 0); - - IPCSendIPv4(ipc, tcp_query->Buf, tcp_query->Size); - - FreeBuf(tcp_query); - - tcp_last_recv_tick = now; - } - } - - if (t->RecvQueue->num_item > NN_MAX_QUEUE_LENGTH) - { - no_store = true; - } - - if (no_store == false) - { - // Put in the queue - InsertQueue(t->RecvQueue, pkt); - call_cancel = true; - state_changed = true; - } - else - { - // Release the packet - FreePacketWithData(pkt); - } - } - } - } - UnlockQueue(t->RecvQueue); - - if (state_changed) - { - goto LABEL_RESTART; - } - - if (call_cancel) - { - CANCEL *c = NULL; - - Lock(t->CancelLock); - { - c = t->Cancel; - - AddRef(c->ref); - } - Unlock(t->CancelLock); - - Cancel(c); - - ReleaseCancel(c); - } - - if (IsTubeConnected(ipc->Sock->RecvTube) == false || IsTubeConnected(ipc->Sock->SendTube) == false) - { - // Disconnected - break; - } - - if ((tcp_last_recv_tick + (UINT64)NN_POLL_CONNECTIVITY_TIMEOUT) < now) - { - // Connectivity test has timed out because a certain period of time has elapsed - Debug("NN_POLL_CONNECTIVITY_TIMEOUT\n"); - break; - } - - wait_interval = GetNextIntervalForInterrupt(interrupt); - wait_interval = MIN(wait_interval, 1234); - - if (wait_interval != 0) - { - WaitForTubes(tubes, num_tubes, wait_interval); - } - } - - FreeInterruptManager(interrupt); -} - -// Build an IP packet -BUF *NnBuildIpPacket(BUF *payload, UINT src_ip, UINT dst_ip, UCHAR protocol, UCHAR ttl) -{ - BUF *ret = NewBuf(); - IPV4_HEADER h; - - if (ttl == 0) - { - ttl = 127; - } - - // IP header - Zero(&h, sizeof(h)); - IPV4_SET_VERSION(&h, 4); - IPV4_SET_HEADER_LEN(&h, sizeof(IPV4_HEADER) / 4); - h.TotalLength = Endian16((USHORT)sizeof(IPV4_HEADER) + payload->Size); - h.Identification = Rand16(); - h.TimeToLive = ttl; - h.Protocol = protocol; - h.SrcIP = src_ip; - h.DstIP = dst_ip; - - h.Checksum = IpChecksum(&h, sizeof(h)); - - WriteBuf(ret, &h, sizeof(h)); - WriteBufBuf(ret, payload); - - SeekBufToBegin(ret); - - FreeBuf(payload); - - return ret; -} - -// Build an UDP packet -BUF *NnBuildUdpPacket(BUF *payload, UINT src_ip, USHORT src_port, UINT dst_ip, USHORT dst_port) -{ - BUF *ret = NewBuf(); - BUF *phbuf = NewBuf(); - UDPV4_PSEUDO_HEADER ph; - UDP_HEADER h; - - // UDP pseudo header - Zero(&ph, sizeof(ph)); - - ph.SrcIP = src_ip; - ph.DstIP = dst_ip; - ph.SrcPort = Endian16(src_port); - ph.DstPort = Endian16(dst_port); - ph.Protocol = IP_PROTO_UDP; - ph.PacketLength1 = ph.PacketLength2 = Endian16(payload->Size + (USHORT)sizeof(UDP_HEADER)); - - WriteBuf(phbuf, &ph, sizeof(ph)); - WriteBufBuf(phbuf, payload); - - // UDP header - Zero(&h, sizeof(h)); - h.SrcPort = Endian16(src_port); - h.DstPort = Endian16(dst_port); - h.PacketLength = Endian16(payload->Size + (USHORT)sizeof(UDP_HEADER)); - h.Checksum = IpChecksum(phbuf->Buf, phbuf->Size); - - WriteBuf(ret, &h, sizeof(h)); - WriteBuf(ret, payload->Buf, payload->Size); - - SeekBufToBegin(ret); - - FreeBuf(payload); - FreeBuf(phbuf); - - return ret; -} - -// Build a TCP packet -BUF *NnBuildTcpPacket(BUF *payload, UINT src_ip, USHORT src_port, UINT dst_ip, USHORT dst_port, UINT seq, UINT ack, UINT flag, UINT window_size, UINT mss) -{ - BUF *ret; - IPV4_PSEUDO_HEADER *vh; - TCP_HEADER *tcp; - static UCHAR tcp_mss_option[] = {0x02, 0x04, 0x00, 0x00, 0x01, 0x01, 0x01, 0x00}; - UINT header_size = TCP_HEADER_SIZE; - UINT total_size; - - // Memory allocation - vh = Malloc(sizeof(IPV4_PSEUDO_HEADER) + TCP_HEADER_SIZE + payload->Size + 32); - tcp = (TCP_HEADER *)(((UCHAR *)vh) + sizeof(IPV4_PSEUDO_HEADER)); - - if (mss != 0) - { - USHORT *mss_size; - mss_size = (USHORT *)(&tcp_mss_option[2]); - *mss_size = Endian16((USHORT)mss); - header_size += sizeof(tcp_mss_option); - } - - total_size = header_size + payload->Size; - - // Pseudo header generation - vh->SrcIP = src_ip; - vh->DstIP = dst_ip; - vh->Reserved = 0; - vh->Protocol = IP_PROTO_TCP; - vh->PacketLength = Endian16((USHORT)total_size); - - // TCP header generation - tcp->SrcPort = Endian16((USHORT)src_port); - tcp->DstPort = Endian16((USHORT)dst_port); - tcp->SeqNumber = Endian32(seq); - tcp->AckNumber = Endian32(ack); - tcp->HeaderSizeAndReserved = 0; - TCP_SET_HEADER_SIZE(tcp, (UCHAR)(header_size / 4)); - tcp->Flag = (UCHAR)flag; - tcp->WindowSize = Endian16((USHORT)window_size); - tcp->Checksum = 0; - tcp->UrgentPointer = 0; - - // Copy the option values - if (mss != 0) - { - Copy(((UCHAR *)tcp) + TCP_HEADER_SIZE, tcp_mss_option, sizeof(tcp_mss_option)); - } - - // Data copy - Copy(((UCHAR *)tcp) + header_size, payload->Buf, payload->Size); - - // Checksum calculation - tcp->Checksum = IpChecksum(vh, total_size + 12); - - ret = NewBufFromMemory(tcp, total_size); - - Free(vh); - - FreeBuf(payload); - - return ret; -} - -// Build a DNS query packet -BUF *NnBuildDnsQueryPacket(char *hostname, USHORT tran_id) -{ - BUF *buf = NewBuf(); - DNSV4_HEADER header; - - Zero(&header, sizeof(header)); - - header.TransactionId = Endian16(tran_id); - header.Flag1 = 0x01; - header.Flag2 = 0x00; - header.NumQuery = Endian16(1); - - WriteBuf(buf, &header, sizeof(header)); - - BuildDnsQueryPacket(buf, hostname, false); - - SeekBufToBegin(buf); - - return buf; -} - -// Read a DNS record -BUF *NnReadDnsRecord(BUF *buf, bool answer, USHORT *ret_type, USHORT *ret_class) -{ - USHORT type; - USHORT clas; - UINT ttl; - BUF *ret = NULL; - // Validate arguments - if (buf == NULL) - { - return NULL; - } - - // Read the DNS label - if (NnReadDnsLabel(buf) == false) - { - return false; - } - - // Type and Class - if (ReadBuf(buf, &type, sizeof(USHORT)) != sizeof(USHORT)) - { - return false; - } - - if (ret_type != NULL) - { - *ret_type = Endian16(type); - } - - if (ReadBuf(buf, &clas, sizeof(USHORT)) != sizeof(USHORT)) - { - return false; - } - - if (ret_class != NULL) - { - *ret_class = Endian16(clas); - } - - if (answer) - { - USHORT data_len; - UCHAR *data; - - // TTL - if (ReadBuf(buf, &ttl, sizeof(UINT)) != sizeof(UINT)) - { - return false; - } - - // data_len - if (ReadBuf(buf, &data_len, sizeof(USHORT)) != sizeof(USHORT)) - { - return false; - } - - data_len = Endian16(data_len); - - // data - data = Malloc(data_len); - if (ReadBuf(buf, data, data_len) != data_len) - { - Free(data); - return false; - } - - ret = NewBufFromMemory(data, data_len); - - Free(data); - } - else - { - ret = NewBuf(); - } - - return ret; -} - -// Read the DNS label -bool NnReadDnsLabel(BUF *buf) -{ - UCHAR c; - UCHAR tmp[256]; - // Validate arguments - if (buf == NULL) - { - return false; - } - -LABEL_START: - - if (ReadBuf(buf, &c, 1) != 1) - { - return false; - } - - if (c == 0) - { - return true; - } - - if (c & 0xC0) - { - // Compression label - if (ReadBuf(buf, &c, 1) != 1) - { - return false; - } - else - { - return true; - } - } - else - { - // Usual label - if (ReadBuf(buf, tmp, c) != c) - { - return false; - } - else - { - goto LABEL_START; - } - } - -} - -// Parse the DNS response packet -bool NnParseDnsResponsePacket(UCHAR *data, UINT size, IP *ret_ip) -{ - BUF *buf = NewBufFromMemory(data, size); - bool ret = false; - DNSV4_HEADER h; - - if (ReadBuf(buf, &h, sizeof(h)) == sizeof(h)) - { - UINT num_questions = Endian16(h.NumQuery); - UINT num_answers = Endian16(h.AnswerRRs); - UINT i; - - for (i = 0; i < num_questions; i++) - { - BUF *r = NnReadDnsRecord(buf, false, NULL, NULL); - - if (r != NULL) - { - FreeBuf(r); - } - else - { - goto LABEL_CLEANUP; - } - } - - for (i = 0; i < num_answers; i++) - { - USHORT tp, cl; - BUF *r = NnReadDnsRecord(buf, true, &tp, &cl); - - if (r != NULL) - { - if (tp == 0x0001 && cl == 0x0001 && r->Size == 4) - { - ret = true; - - if (ret_ip != NULL) - { - Zero(ret_ip, sizeof(IP)); - - Copy(ret_ip->addr, r->Buf, 4); - } - } - - FreeBuf(r); - } - else - { - goto LABEL_CLEANUP; - } - } - } - -LABEL_CLEANUP: - FreeBuf(buf); - - return ret; -} - -// Test the connectivity of the stack to the Internet -bool NnTestConnectivity(NATIVE_STACK *a, TUBE *halt_tube) -{ - BUF *dns_query; - BUF *dns_query2; - bool ok = false; - USHORT dns_tran_id = Rand16(); - UINT64 next_send_tick = 0; - UINT64 giveup_time; - IPC *ipc; - INTERRUPT_MANAGER *interrupt; - TUBE *tubes[3]; - UINT num_tubes = 0; - IP yahoo_ip; - IP my_priv_ip; - UINT num_send_dns = 0; - IP using_dns; - UINT src_port = 0; - // Validate arguments - if (a == NULL) - { - return false; - } - - src_port = NnGenSrcPort(a->IsIpRawMode); - - Copy(&using_dns, &a->DnsServerIP, sizeof(IP)); - - // Get my physical IP - if (a->IsIpRawMode) - { - if (GetMyPrivateIP(&my_priv_ip, false) == false) - { - Debug("NnTestConnectivity: GetMyPrivateIP failed.\n"); - return false; - } - else - { - Debug("NnTestConnectivity: GetMyPrivateIP ok: %r\n", &my_priv_ip); - - if (a->Eth != NULL) - { - Copy(&a->Eth->MyPhysicalIPForce, &my_priv_ip, sizeof(IP)); - } - } - } - - ipc = a->Ipc; - interrupt = NewInterruptManager(); - - tubes[num_tubes++] = ipc->Sock->RecvTube; - tubes[num_tubes++] = ipc->Sock->SendTube; - - if (halt_tube != NULL) - { - tubes[num_tubes++] = halt_tube; - } - - Zero(&yahoo_ip, sizeof(yahoo_ip)); - - // Try to get an IP address of www.yahoo.com - dns_query = NnBuildIpPacket(NnBuildUdpPacket(NnBuildDnsQueryPacket(NN_CHECK_HOSTNAME, dns_tran_id), - IPToUINT(&ipc->ClientIPAddress), src_port, IPToUINT(&a->DnsServerIP), 53), - IPToUINT(&ipc->ClientIPAddress), IPToUINT(&a->DnsServerIP), IP_PROTO_UDP, 0); - - dns_query2 = NnBuildIpPacket(NnBuildUdpPacket(NnBuildDnsQueryPacket(NN_CHECK_HOSTNAME, dns_tran_id), - IPToUINT(&ipc->ClientIPAddress), src_port, IPToUINT(&a->DnsServerIP), 53), - IPToUINT(&ipc->ClientIPAddress), IPToUINT(&a->DnsServerIP2), IP_PROTO_UDP, 0); - - giveup_time = Tick64() + NN_CHECK_CONNECTIVITY_TIMEOUT; - AddInterrupt(interrupt, giveup_time); - while (true) - { - UINT64 now = Tick64(); - - IPCFlushArpTable(a->Ipc); - - if (now >= giveup_time) - { - break; - } - - // Send a packet periodically - if (next_send_tick == 0 || next_send_tick <= now) - { - next_send_tick = now + (UINT64)NN_CHECK_CONNECTIVITY_INTERVAL; - - AddInterrupt(interrupt, next_send_tick); - - if ((num_send_dns % 2) == 0) - { - IPCSendIPv4(ipc, dns_query->Buf, dns_query->Size); - } - else - { - IPCSendIPv4(ipc, dns_query2->Buf, dns_query2->Size); - } - - num_send_dns++; - } - - // Happy processing - IPCProcessL3EventsIPv4Only(ipc); - - while (true) - { - // Receive a packet - BLOCK *b = IPCRecvIPv4(ipc); - PKT *pkt; - - if (b == NULL) - { - break; - } - - // Parse the packet - pkt = ParsePacketIPv4WithDummyMacHeader(b->Buf, b->Size); - - if (pkt != NULL) - { - if (pkt->TypeL3 == L3_IPV4 && pkt->TypeL4 == L4_UDP && - (pkt->L3.IPv4Header->SrcIP == IPToUINT(&a->DnsServerIP) || - pkt->L3.IPv4Header->SrcIP == IPToUINT(&a->DnsServerIP2)) && - pkt->L3.IPv4Header->DstIP == IPToUINT(&ipc->ClientIPAddress) && - pkt->L4.UDPHeader->SrcPort == Endian16(53) && pkt->L4.UDPHeader->DstPort == Endian16(src_port)) - { - DNSV4_HEADER *dns_header = (DNSV4_HEADER *)pkt->Payload; - if (pkt->PayloadSize >= sizeof(DNSV4_HEADER)) - { - if (dns_header->TransactionId == Endian16(dns_tran_id)) - { - IP ret_ip; - - if (NnParseDnsResponsePacket(pkt->Payload, pkt->PayloadSize, &ret_ip)) - { - UINTToIP(&using_dns, pkt->L3.IPv4Header->SrcIP); - Debug("NativeStack: Using DNS: %r\n", &using_dns); - - Copy(&yahoo_ip, &ret_ip, sizeof(IP)); - } - } - } - } - } - - FreePacketWithData(pkt); - FreeBlock(b); - } - - if ((halt_tube != NULL && IsTubeConnected(halt_tube) == false) || - IsTubeConnected(ipc->Sock->SendTube) == false || IsTubeConnected(ipc->Sock->RecvTube) == false) - { - // Disconnected - break; - } - - if (IsZeroIP(&yahoo_ip) == false) - { - // There is a response - break; - } - - // Keep the CPU waiting - WaitForTubes(tubes, num_tubes, GetNextIntervalForInterrupt(interrupt)); - } - - FreeBuf(dns_query); - FreeBuf(dns_query2); - - if (IsZeroIP(&yahoo_ip) == false) - { - BUF *tcp_query; - UINT seq = Rand32(); - bool tcp_get_response = false; - UINT recv_seq = 0; - - // Since the IP address of www.yahoo.com has gotten, try to connect by TCP - giveup_time = Tick64() + NN_CHECK_CONNECTIVITY_TIMEOUT; - AddInterrupt(interrupt, giveup_time); - - // Generate a TCP packet - tcp_query = NnBuildIpPacket(NnBuildTcpPacket(NewBuf(), IPToUINT(&ipc->ClientIPAddress), src_port, - IPToUINT(&yahoo_ip), 80, seq, 0, TCP_SYN, 8192, 1414), - IPToUINT(&ipc->ClientIPAddress), IPToUINT(&yahoo_ip), IP_PROTO_TCP, 0); - - Debug("Test TCP to %r\n", &yahoo_ip); - - next_send_tick = 0; - - while (true) - { - UINT64 now = Tick64(); - - IPCFlushArpTable(a->Ipc); - - if (now >= giveup_time) - { - break; - } - - // Send the packet periodically - if (next_send_tick == 0 || next_send_tick <= now) - { - next_send_tick = now + (UINT64)NN_CHECK_CONNECTIVITY_INTERVAL; - - AddInterrupt(interrupt, next_send_tick); - - IPCSendIPv4(ipc, tcp_query->Buf, tcp_query->Size); - } - - // Happy procedure - IPCProcessL3EventsIPv4Only(ipc); - - while (true) - { - // Receive a packet - BLOCK *b = IPCRecvIPv4(ipc); - PKT *pkt; - - if (b == NULL) - { - break; - } - - // Parse the packet - pkt = ParsePacketIPv4WithDummyMacHeader(b->Buf, b->Size); - - if (pkt != NULL) - { - if (pkt->TypeL3 == L3_IPV4 && pkt->TypeL4 == L4_TCP && - pkt->L3.IPv4Header->SrcIP == IPToUINT(&yahoo_ip) && - pkt->L3.IPv4Header->DstIP == IPToUINT(&ipc->ClientIPAddress) && - pkt->L4.TCPHeader->SrcPort == Endian16(80) && pkt->L4.TCPHeader->DstPort == Endian16(src_port)) - { - TCP_HEADER *tcp_header = (TCP_HEADER *)pkt->L4.TCPHeader; - if ((tcp_header->Flag & TCP_SYN) && (tcp_header->Flag & TCP_ACK)) - { - // There was a TCP response - tcp_get_response = true; - recv_seq = Endian32(tcp_header->SeqNumber); - } - } - } - - FreePacketWithData(pkt); - FreeBlock(b); - } - - if ((halt_tube != NULL && IsTubeConnected(halt_tube) == false) || - IsTubeConnected(ipc->Sock->SendTube) == false || IsTubeConnected(ipc->Sock->RecvTube) == false) - { - // Disconnected - break; - } - - if (tcp_get_response) - { - WHERE; - break; - } - - // Keep the CPU waiting - WaitForTubes(tubes, num_tubes, GetNextIntervalForInterrupt(interrupt)); - } - - FreeBuf(tcp_query); - - // Send a RST - if (recv_seq != 0) - { - recv_seq++; - } - - tcp_query = NnBuildIpPacket(NnBuildTcpPacket(NewBuf(), IPToUINT(&ipc->ClientIPAddress), src_port, - IPToUINT(&yahoo_ip), 80, seq + 1, recv_seq, TCP_RST | TCP_ACK, 8192, 0), - IPToUINT(&ipc->ClientIPAddress), IPToUINT(&yahoo_ip), IP_PROTO_TCP, 0); - - IPCSendIPv4(ipc, tcp_query->Buf, tcp_query->Size); - - FreeBuf(tcp_query); - - SleepThread(100); - - if (tcp_get_response) - { - ok = true; - } - } - - FreeInterruptManager(interrupt); - - if (ok) - { - if (IsZeroIP(&using_dns) == false) - { - Copy(&a->DnsServerIP, &using_dns, sizeof(IP)); - } - - if (a->IsIpRawMode) - { - if (NsStartIpTablesTracking(a) == false) - { - Debug("NsStartIpTablesTracking failed.\n"); - ok = false; - } - } - } - - return ok; -} - -// Generate source port number by a random number -UINT NnGenSrcPort(bool raw_ip_mode) -{ - if (raw_ip_mode == false) - { - return 1025 + Rand32() % (65500 - 1025); - } - else - { - return NN_RAW_IP_PORT_START + Rand32() % (NN_RAW_IP_PORT_END - NN_RAW_IP_PORT_START); - } -} - -// Get a next good interface for the native NAT -NATIVE_STACK *NnGetNextInterface(NATIVE_NAT *t) -{ - NATIVE_STACK *ret = NULL; - UINT current_hash; - TOKEN_LIST *device_list; - UINT i; - char tmp[MAX_SIZE]; - char *dev_name; - UINT current_ip_hash; - // Validate arguments - if (t == NULL) - { - return NULL; - } - - t->NextWaitTimeForRetry = NN_NEXT_WAIT_TIME_FOR_DEVICE_ENUM * MIN((t->FailedCount + 1), NN_NEXT_WAIT_TIME_MAX_FAIL_COUNT); - - // Get the device list - device_list = GetEthListEx(NULL, - !(t->v->HubOption != NULL && t->v->HubOption->DisableKernelModeSecureNAT), - !(t->v->HubOption != NULL && t->v->HubOption->DisableIpRawModeSecureNAT)); - - if (device_list == NULL || device_list->NumTokens == 0) - { - // Device list acquisition failure (Or no device acquired as a result) - FreeToken(device_list); - t->FailedCount++; - return NULL; - } - - current_hash = GetEthDeviceHash(); - current_ip_hash = GetHostIPAddressHash32(); - - if (t->LastInterfaceDeviceHash != current_hash || t->LastHostAddressHash != current_ip_hash) - { - // Device list is altered from the previous search - t->LastInterfaceIndex = INFINITE; - t->FailedCount = 0; - } - - t->LastInterfaceDeviceHash = current_hash; - t->LastHostAddressHash = current_ip_hash; - - if (t->LastInterfaceIndex == INFINITE) - { - i = 0; - } - else - { - i = t->LastInterfaceIndex + 1; - if (i >= device_list->NumTokens) - { - i = 0; - } - } - - if ((i + 1) == device_list->NumTokens) - { - // Searched to the end - t->LastInterfaceIndex = INFINITE; - - // Increase the number of search failures by one - t->FailedCount++; - } - else - { - // It is not the end yet - t->LastInterfaceIndex = i; - t->NextWaitTimeForRetry = 0; - } - - dev_name = device_list->Token[i]; - - if (IsInLinesFile(NN_NO_NATIVE_NAT_FILENAME, dev_name, true) == false) - { - // Try to open the device - BinToStr(tmp, sizeof(tmp), t->v->MacAddress, 6); - ret = NewNativeStack(NULL, dev_name, tmp); - - if (ret != NULL) - { - // Test whether an IP address can be obtained from a DHCP server - DHCP_OPTION_LIST opt; - - Copy(t->CurrentMacAddress, ret->Ipc->MacAddress, 6); - - Zero(&opt, sizeof(opt)); - - BinToStr(tmp, sizeof(tmp), ret->MacAddress, 6); - Format(ret->Ipc->ClientHostname, sizeof(ret->Ipc->ClientHostname), NN_HOSTNAME_FORMAT, tmp); - StrLower(ret->Ipc->ClientHostname); - - Debug("IPCDhcpAllocateIP for %s\n", ret->DeviceName); - if (IPCDhcpAllocateIP(ret->Ipc, &opt, t->HaltTube2)) - { - char client_ip[64]; - char dhcp_ip[64]; - char client_mask[64]; - char gateway_ip[64]; - - IP ip; - IP subnet; - IP gw; - - IPToStr32(client_ip, sizeof(client_ip), opt.ClientAddress); - IPToStr32(client_mask, sizeof(client_mask), opt.SubnetMask); - IPToStr32(dhcp_ip, sizeof(dhcp_ip), opt.ServerAddress); - IPToStr32(gateway_ip, sizeof(gateway_ip), opt.Gateway); - - Debug("DHCP: client_ip=%s, client_mask=%s, dhcp_ip=%s, gateway_ip=%s\n", - client_ip, client_mask, dhcp_ip, gateway_ip); - - Copy(&ret->CurrentDhcpOptionList, &opt, sizeof(DHCP_OPTION_LIST)); - - // IP parameter settings - UINTToIP(&ip, opt.ClientAddress); - UINTToIP(&subnet, opt.SubnetMask); - UINTToIP(&gw, opt.Gateway); - - IPCSetIPv4Parameters(ret->Ipc, &ip, &subnet, &gw, &opt.ClasslessRoute); - - // Determine the DNS server to use - UINTToIP(&ret->DnsServerIP, opt.DnsServer); - UINTToIP(&ret->DnsServerIP2, opt.DnsServer2); - if (IsZeroIP(&ret->DnsServerIP)) - { - // Use 8.8.8.8 instead If the DNS is not assigned from the DHCP server - SetIP(&ret->DnsServerIP, 8, 8, 8, 8); - } - if (IsZeroIP(&ret->DnsServerIP2)) - { - // Use 8.8.4.4 instead If the DNS is not assigned from the DHCP server - SetIP(&ret->DnsServerIP2, 8, 8, 4, 4); - } - - // Connectivity test - // (always fail if the default gateway is not set) - if (opt.Gateway != 0 && - NnTestConnectivity(ret, t->HaltTube2)) - { - // Reset the number of search failures - t->FailedCount = 0; - Debug("Connectivity OK.\n"); - } - else - { - Debug("Connectivity Failed.\n"); - FreeNativeStack(ret); - ret = NULL; - } - } - else - { - Debug("DHCP Failed.\n"); - FreeNativeStack(ret); - ret = NULL; - - Zero(t->CurrentMacAddress, sizeof(t->CurrentMacAddress)); - } - } - } - - FreeToken(device_list); - - return ret; -} - -// Native NAT thread -void NativeNatThread(THREAD *thread, void *param) -{ - NATIVE_NAT *t = (NATIVE_NAT *)param; - void *wait_handle = InitWaitUntilHostIPAddressChanged(); - // Validate arguments - if (thread == NULL || param == NULL) - { - return; - } - - while (t->Halt == false) - { - NATIVE_STACK *a; - - while (t->v->UseNat == false || t->v->HubOption == NULL || (t->v->HubOption->DisableKernelModeSecureNAT && t->v->HubOption->DisableIpRawModeSecureNAT)) - { - if (t->Halt) - { - break; - } - - // If the NAT is disabled, wait until it becomes enabled - Wait(t->HaltEvent, 1234); - } - - if (t->Halt) - { - break; - } - - // Get a next good native NAT stack - Debug("NnGetNextInterface Start.\n"); - - NnClearQueue(t); - - a = NnGetNextInterface(t); - - if (a != NULL) - { - char macstr[64]; - // Acquisition success - Debug("NnGetNextInterface Ok: %s\n", a->DeviceName); - - t->IsRawIpMode = a->IsIpRawMode; - - Lock(t->Lock); - { - if (a->Sock1 != NULL) - { - t->HaltTube = a->Sock2->RecvTube; - - if (t->HaltTube != NULL) - { - AddRef(t->HaltTube->Ref); - } - } - } - Unlock(t->Lock); - - NnClearQueue(t); - - t->PublicIP = IPToUINT(&a->Ipc->ClientIPAddress); - t->Active = true; - - - Debug("NnMainLoop Start.\n"); - MacToStr(macstr, sizeof(macstr), a->Ipc->MacAddress); - NLog(t->v, "LH_KERNEL_MODE_START", a->DeviceName, - &a->Ipc->ClientIPAddress, &a->Ipc->SubnetMask, &a->Ipc->DefaultGateway, &a->Ipc->BroadcastAddress, - macstr, &a->CurrentDhcpOptionList.ServerAddress, &a->DnsServerIP); - NnMainLoop(t, a); - Debug("NnMainLoop End.\n"); - - t->IsRawIpMode = false; - - t->Active = false; - t->PublicIP = 0; - - - NnClearQueue(t); - - // Close the stack - Lock(t->Lock); - { - if (t->HaltTube != NULL) - { - ReleaseTube(t->HaltTube); - t->HaltTube = NULL; - } - } - Unlock(t->Lock); - FreeNativeStack(a); - - Zero(t->CurrentMacAddress, 6); - } - else - { - Debug("NnGetNextInterface Failed.\n"); - } - - // Wait for a certain period of time - if (t->NextWaitTimeForRetry != 0) - { - WaitUntilHostIPAddressChanged(wait_handle, t->HaltEvent, t->NextWaitTimeForRetry, 1000); - } - } - - FreeWaitUntilHostIPAddressChanged(wait_handle); -} - -// Erase the contents of the queue for transmission and reception -void NnClearQueue(NATIVE_NAT *t) -{ - // Validate arguments - if (t == NULL) - { - return; - } - - LockQueue(t->SendQueue); - { - while (true) - { - BLOCK *b = GetNext(t->SendQueue); - - if (b == NULL) - { - break; - } - - FreeBlock(b); - } - } - UnlockQueue(t->SendQueue); - - LockQueue(t->RecvQueue); - { - while (true) - { - PKT *p = GetNext(t->RecvQueue); - - if (p == NULL) - { - break; - } - - FreePacketWithData(p); - } - } - UnlockQueue(t->RecvQueue); -} - -// Structure setting function to search for native NAT -void NnSetNat(NATIVE_NAT_ENTRY *e, UINT protocol, UINT src_ip, UINT src_port, UINT dest_ip, UINT dest_port, UINT pub_ip, UINT pub_port) -{ - // Validate arguments - if (e == NULL) - { - return; - } - - Zero(e, sizeof(NATIVE_NAT_ENTRY)); - - e->Protocol = protocol; - e->SrcIp = src_ip; - e->SrcPort = src_port; - e->DestIp = dest_ip; - e->DestPort = dest_port; - e->PublicIp = pub_ip; - e->PublicPort = pub_port; - e->HashCodeForSend = e->HashCodeForRecv = INFINITE; -} - -// Get the hash code of the native NAT table (receiving direction) -UINT GetHashNativeNatTableForRecv(void *p) -{ - UINT r; - NATIVE_NAT_ENTRY *e = (NATIVE_NAT_ENTRY *)p; - if (e == NULL) - { - return 0; - } - - if (e->HashCodeForRecv != INFINITE) - { - return e->HashCodeForRecv; - } - - r = 0; - - r += e->Protocol; - r += e->PublicIp; - r += e->PublicPort; - - if (e->Protocol == NAT_TCP) - { - r += e->DestIp; - r += e->DestPort; - } - - e->HashCodeForRecv = r; - - return r; -} - -// Comparison function of native NAT table (receiving direction) -int CmpNativeNatTableForRecv(void *p1, void *p2) -{ - int r; - NATIVE_NAT_ENTRY *e1, *e2; - if (p1 == NULL || p2 == NULL) - { - return 0; - } - e1 = *(NATIVE_NAT_ENTRY **)p1; - e2 = *(NATIVE_NAT_ENTRY **)p2; - if (e1 == NULL || e2 == NULL) - { - return 0; - } - - r = COMPARE_RET(e1->Protocol, e2->Protocol); - if (r != 0) - { - return r; - } - - r = COMPARE_RET(e1->PublicIp, e2->PublicIp); - if (r != 0) - { - return r; - } - - r = COMPARE_RET(e1->PublicPort, e2->PublicPort); - if (r != 0) - { - return r; - } - - if (e1->Protocol == NAT_TCP) - { - r = COMPARE_RET(e1->DestIp, e2->DestIp); - if (r != 0) - { - return r; - } - - r = COMPARE_RET(e1->DestPort, e2->DestPort); - if (r != 0) - { - return r; - } - } - - return 0; -} - -// Get the hash code of the native NAT table (transmit direction) -UINT GetHashNativeNatTableForSend(void *p) -{ - UINT r; - NATIVE_NAT_ENTRY *e = (NATIVE_NAT_ENTRY *)p; - if (e == NULL) - { - return 0; - } - - if (e->HashCodeForSend != INFINITE) - { - return e->HashCodeForSend; - } - - r = 0; - - r += e->Protocol; - r += e->SrcIp; - r += e->SrcPort; - - if (e->Protocol == NAT_TCP) - { - r += e->DestIp; - r += e->DestPort; - } - - e->HashCodeForSend = r; - - return r; -} - -// Comparison function of native NAT table (transmit direction) -int CmpNativeNatTableForSend(void *p1, void *p2) -{ - int r; - NATIVE_NAT_ENTRY *e1, *e2; - if (p1 == NULL || p2 == NULL) - { - return 0; - } - e1 = *(NATIVE_NAT_ENTRY **)p1; - e2 = *(NATIVE_NAT_ENTRY **)p2; - if (e1 == NULL || e2 == NULL) - { - return 0; - } - - r = COMPARE_RET(e1->Protocol, e2->Protocol); - if (r != 0) - { - return r; - } - - r = COMPARE_RET(e1->SrcIp, e2->SrcIp); - if (r != 0) - { - return r; - } - - r = COMPARE_RET(e1->SrcPort, e2->SrcPort); - if (r != 0) - { - return r; - } - - if (e1->Protocol == NAT_TCP) - { - r = COMPARE_RET(e1->DestIp, e2->DestIp); - if (r != 0) - { - return r; - } - - r = COMPARE_RET(e1->DestPort, e2->DestPort); - if (r != 0) - { - return r; - } - } - - return 0; -} - -// Start the native NAT -NATIVE_NAT *NewNativeNat(VH *v) -{ - NATIVE_NAT *t; - // Validate arguments - if (v == NULL) - { - return NULL; - } - - t = ZeroMalloc(sizeof(NATIVE_NAT)); - - t->v = v; - - t->Cancel = v->Cancel; - AddRef(t->Cancel->ref); - - // Data structure initialization - t->LastInterfaceIndex = INFINITE; - t->SendQueue = NewQueue(); - t->RecvQueue = NewQueue(); - NnInitIpCombineList(t); - - t->Lock = NewLock(); - - t->CancelLock = NewLock(); - - t->HaltEvent = NewEvent(); - - NewTubePair(&t->HaltTube2, &t->HaltTube3, 0); - - // Create a NAT table - t->NatTableForSend = NewHashList(GetHashNativeNatTableForSend, CmpNativeNatTableForSend, 11, true); - t->NatTableForRecv = NewHashList(GetHashNativeNatTableForRecv, CmpNativeNatTableForRecv, 11, true); - - t->Thread = NewThread(NativeNatThread, t); - - return t; -} - -// Stop the native NAT -void FreeNativeNat(NATIVE_NAT *t) -{ - TUBE *tube; - UINT i; - // Validate arguments - if (t == NULL) - { - return; - } - - t->Halt = true; - - Lock(t->Lock); - { - tube = t->HaltTube; - - if (tube != NULL) - { - AddRef(tube->Ref); - } - } - Unlock(t->Lock); - - if (tube != NULL) - { - TubeFlushEx(tube, true); - - SleepThread(100); - - TubeDisconnect(tube); - - ReleaseTube(tube); - } - - TubeDisconnect(t->HaltTube2); - TubeDisconnect(t->HaltTube3); - - Set(t->HaltEvent); - - WaitThread(t->Thread, INFINITE); - - ReleaseThread(t->Thread); - - DeleteLock(t->Lock); - - DeleteLock(t->CancelLock); - - ReleaseEvent(t->HaltEvent); - - ReleaseTube(t->HaltTube2); - ReleaseTube(t->HaltTube3); - - NnClearQueue(t); - - ReleaseQueue(t->RecvQueue); - ReleaseQueue(t->SendQueue); - - ReleaseCancel(t->Cancel); - - // Release the NAT table - for (i = 0; i < LIST_NUM(t->NatTableForSend->AllList); i++) - { - NATIVE_NAT_ENTRY *e = LIST_DATA(t->NatTableForSend->AllList, i); - - Free(e); - } - - ReleaseHashList(t->NatTableForSend); - ReleaseHashList(t->NatTableForRecv); - - NnFreeIpCombineList(t); - - Free(t); -} - -// Take the log of Virtual Host -void VLog(VH *v, char *str) -{ - // Not take!! - return; -} - -// Disconnect the NAT entry immediately -void DisconnectNatEntryNow(VH *v, NAT_ENTRY *e) -{ - // Validate arguments - if (v == NULL || e == NULL) - { - return; - } - - if (e->DisconnectNow == false) - { - e->DisconnectNow = true; - - SetSockEvent(v->SockEvent); - } -} - -// Get the NAT entry with specified source IP address and the oldest last communication time -NAT_ENTRY *GetOldestNatEntryOfIp(VH *v, UINT ip, UINT protocol) -{ - UINT i; - NAT_ENTRY *oldest = NULL; - UINT64 oldest_tick = 0xFFFFFFFFFFFFFFFFULL; - // Validate arguments - if (v == NULL) - { - return NULL; - } - - for (i = 0; i < LIST_NUM(v->NatTable); i++) - { - NAT_ENTRY *e = LIST_DATA(v->NatTable, i); - - if (e->DisconnectNow == false) - { - if (e->SrcIp == ip) - { - if (e->Protocol == protocol) - { - if (protocol != NAT_TCP || e->TcpStatus != NAT_TCP_CONNECTING) - { - if (e->LastCommTime <= oldest_tick) - { - oldest_tick = e->LastCommTime; - oldest = e; - } - } - } - } - } - } - - return oldest; -} - -// Get the number of current NAT entries per IP address -UINT GetNumNatEntriesPerIp(VH *v, UINT ip, UINT protocol, bool tcp_syn_sent) -{ - UINT ret = 0; - UINT i; - // Validate arguments - if (v == NULL) - { - return 0; - } - - for (i = 0; i < LIST_NUM(v->NatTable); i++) - { - NAT_ENTRY *e = LIST_DATA(v->NatTable, i); - - if (e->DisconnectNow == false) - { - if (e->SrcIp == ip) - { - if (e->Protocol == protocol) - { - bool ok = false; - - if (protocol == NAT_TCP) - { - if (tcp_syn_sent) - { - if (e->TcpStatus == NAT_TCP_CONNECTING) - { - ok = true; - } - } - else - { - if (e->TcpStatus != NAT_TCP_CONNECTING) - { - ok = true; - } - } - } - else - { - ok = true; - } - - if (ok) - { - ret++; - } - } - } - } - } - - return ret; -} - -// Check whether the NAT is available -bool CanCreateNewNatEntry(VH *v) -{ - // Validate arguments - if (v == NULL) - { - return false; - } - - if (v->UseNat == false) - { - // NAT stopped - return false; - } - - if (NnIsActive(v) && v->NativeNat != NULL && v->NativeNat->NatTableForRecv != NULL) - { - if (v->NativeNat->NatTableForRecv->AllList->num_item > NAT_MAX_SESSIONS_KERNEL) - { - // Number of sessions exceeded (kernel mode) - return false; - } - } - else - { - if (v->NatTable->num_item > NAT_MAX_SESSIONS) - { - // Number of sessions exceeded (user mode) - return false; - } - } - - return true; -} - -// Set a pointer to the Virtual HUB options -void NatSetHubOption(VH *v, HUB_OPTION *o) -{ - // Validate arguments - if (v == NULL) - { - return; - } - - v->HubOption = o; -} - -// Get a pointer to the Virtual HUB options -HUB_OPTION *NatGetHubOption(VH *v) -{ - // Validate arguments - if (v == NULL) - { - return NULL; - } - - return v->HubOption; -} - -// The main function of NAT processing thread -void NatThreadMain(VH *v) -{ - bool halt_flag; - // Validate arguments - if (v == NULL) - { - return; - } - - v->TmpBuf = Malloc(NAT_TMPBUF_SIZE); - - while (true) - { - // Wait until the next event is set - WaitSockEvent(v->SockEvent, SELECT_TIME); - - halt_flag = false; - - LockVirtual(v); - { - // Process on all NAT sessions - UINT i, num; - - v->Now = Tick64(); - v->NatDoCancelFlag = false; - -LIST_ELEMENT_DELETED: - num = LIST_NUM(v->NatTable); - for (i = 0; i < num; i++) - { - NAT_ENTRY *n = LIST_DATA(v->NatTable, i); - - switch (n->Protocol) - { - case NAT_TCP: // TCP - if (NatTransactTcp(v, n) == false) - { - goto LIST_ELEMENT_DELETED; - } - break; - - case NAT_UDP: // UDP - if (NatTransactUdp(v, n) == false) - { - goto LIST_ELEMENT_DELETED; - } - break; - - case NAT_ICMP: // ICMP - if (NatTransactIcmp(v, n) == false) - { - goto LIST_ELEMENT_DELETED; - } - break; - - case NAT_DNS: // DNS - if (NatTransactDns(v, n) == false) - { - goto LIST_ELEMENT_DELETED; - } - break; - } - } - - if (v->NatDoCancelFlag) - { - // Hit the cancel of the parent thread - Cancel(v->Cancel); - } - - // Halting flag check - if (v->HaltNat) - { - halt_flag = true; - } - } - UnlockVirtual(v); - - if (halt_flag) - { - // Terminate the thread by disconnecting all entries forcibly - LockVirtual(v); - { - UINT num = LIST_NUM(v->NatTable); - NAT_ENTRY **nn = ToArray(v->NatTable); - UINT i; - - for (i = 0; i < num; i++) - { - NAT_ENTRY *n = nn[i]; - n->DisconnectNow = true; - - switch (n->Protocol) - { - case NAT_TCP: // TCP - NatTransactTcp(v, n); - break; - - case NAT_UDP: // UDP - NatTransactUdp(v, n); - break; - - case NAT_ICMP: // ICMP - NatTransactIcmp(v, n); - break; - - case NAT_DNS: // DNS - NatTransactDns(v, n); - break; - } - } - - Free(nn); - } - UnlockVirtual(v); - break; - } - } - - Free(v->TmpBuf); -} - -// DNS: Thread to get the IP address -void NatGetIPThread(THREAD *t, void *param) -{ - NAT_DNS_QUERY *q; - // Validate arguments - if (t == NULL || param == NULL) - { - return; - } - - q = (NAT_DNS_QUERY *)param; - AddWaitThread(t); - - q->Ok = GetIP(&q->Ip, q->Hostname); - - DelWaitThread(t); - - if (Release(q->ref) == 0) - { - Free(q); - } -} - -// DNS: Get an IP address from host name -bool NatGetIP(IP *ip, char *hostname) -{ - TOKEN_LIST *t; - bool ret = false; - // Validate arguments - if (ip == NULL || hostname == NULL) - { - return false; - } - - t = ParseToken(hostname, "."); - if (t == NULL) - { - return false; - } - if (t->NumTokens == 0) - { - FreeToken(t); - return false; - } - - if (t->NumTokens == 1) - { - ret = GetIP(ip, hostname); - } - else - { - char *hostname2 = t->Token[0]; - NAT_DNS_QUERY *q1, *q2; - THREAD *t1, *t2; - - q1 = ZeroMalloc(sizeof(NAT_DNS_QUERY)); - q2 = ZeroMalloc(sizeof(NAT_DNS_QUERY)); - q1->ref = NewRef(); - q2->ref = NewRef(); - AddRef(q1->ref); - AddRef(q2->ref); - StrCpy(q1->Hostname, sizeof(q1->Hostname), hostname); - StrCpy(q2->Hostname, sizeof(q2->Hostname), hostname2); - - t1 = NewThread(NatGetIPThread, q1); - t2 = NewThread(NatGetIPThread, q2); - - WaitThread(t1, NAT_DNS_QUERY_TIMEOUT); - - if (q1->Ok) - { - ret = true; - Copy(ip, &q1->Ip, sizeof(IP)); - } - else - { - WaitThread(t2, NAT_DNS_QUERY_TIMEOUT); - if (q1->Ok) - { - ret = true; - Copy(ip, &q1->Ip, sizeof(IP)); - } - else if (q2->Ok) - { - ret = true; - Copy(ip, &q2->Ip, sizeof(IP)); - } - } - - ReleaseThread(t1); - ReleaseThread(t2); - - if (Release(q1->ref) == 0) - { - Free(q1); - } - if (Release(q2->ref) == 0) - { - Free(q2); - } - } - - FreeToken(t); - - return ret; -} - -// DNS query function -void NatDnsThread(THREAD *t, void *param) -{ - NAT_ENTRY *n; - IP ip; - // Validate arguments - if (t == NULL || param == NULL) - { - return; - } - n = (NAT_ENTRY *)param; - - // Notify the initialization completion - NoticeThreadInit(t); - - // Run processing - if (EndWith(n->DnsTargetHostName, ".in-addr.arpa") == false) - { - // Forward resolution - if (NatGetIP(&ip, n->DnsTargetHostName)) - { - // Forward resolution success - Copy(&n->DnsResponseIp, &ip, sizeof(IP)); - n->DnsOk = true; - } - } - else - { - // Reverse resolution - IP ip; - n->DnsGetIpFromHost = true; // Set the reverse resolution flag - // Convert a *.in-addr.arpa string to an IP address - if (ArpaToIP(&ip, n->DnsTargetHostName)) - { - // Reverse resolution process - char tmp[256]; - if (GetHostName(tmp, sizeof(tmp), &ip)) - { - // Reverse resolution success - n->DnsResponseHostName = CopyStr(tmp); - n->DnsOk = true; - } - } - } - - // Notify the results - n->DnsFinished = true; - - SetSockEvent(n->v->SockEvent); -} - -// Convert a reverse resolution address to an IP address -bool ArpaToIP(IP *ip, char *str) -{ - TOKEN_LIST *token; - bool ret = false; - // Validate arguments - if (ip == NULL || str == NULL) - { - return false; - } - - // Token conversion - token = ParseToken(str, "."); - if (token->NumTokens == 6) - { - // Convert the token [0, 1, 2, 3] to IP - UINT i; - Zero(ip, sizeof(IP)); - for (i = 0; i < 4; i++) - { - ip->addr[i] = (UCHAR)ToInt(token->Token[3 - i]); - } - ret = true; - } - - FreeToken(token); - - if (IPToUINT(ip) == 0) - { - ret = false; - } - - return ret; -} - -// Handle a DNS entry -bool NatTransactDns(VH *v, NAT_ENTRY *n) -{ - // Validate arguments - if (v == NULL || n == NULL) - { - return true; - } - - if (n->DisconnectNow) - { - goto DISCONNECT; - } - - if (n->DnsThread == NULL && n->DnsFinished == false) - { - // Create a thread - THREAD *t = NewThread(NatDnsThread, (void *)n); - WaitThreadInit(t); - n->DnsThread = t; - } - else - { - // Wait for the result - if (n->DnsFinished) - { - // Results have been received - WaitThread(n->DnsThread, INFINITE); - ReleaseThread(n->DnsThread); - n->DnsThread = NULL; - // Notify to the main thread - v->NatDoCancelFlag = true; - } - } - - return true; - -DISCONNECT: - - // Releasing process - if (n->DnsThread != NULL) - { - WaitThread(n->DnsThread, INFINITE); - ReleaseThread(n->DnsThread); - n->DnsThread = NULL; - } - - if (n->DnsTargetHostName != NULL) - { - Free(n->DnsTargetHostName); - n->DnsTargetHostName = NULL; - } - - if (n->DnsResponseHostName != NULL) - { - Free(n->DnsResponseHostName); - n->DnsResponseHostName = NULL; - } - - DeleteLock(n->lock); - Delete(v->NatTable, n); - Free(n); - - return false; -} - -// ICMP thread procedure -void NatIcmpThreadProc(THREAD *thread, void *param) -{ - NAT_ENTRY *n; - ICMP_RESULT *ret = NULL; - USHORT src_id = 0, src_seqno = 0; - // Validate arguments - if (thread == NULL || param == NULL) - { - return; - } - - n = (NAT_ENTRY *)param; - - if (n->IcmpQueryBlock) - { - UCHAR *data = n->IcmpQueryBlock->Buf; - UINT size = n->IcmpQueryBlock->Size; - - if (size >= (sizeof(ICMP_HEADER) + sizeof(ICMP_ECHO))) - { - ICMP_HEADER *icmp = (ICMP_HEADER *)data; - ICMP_ECHO *echo = (ICMP_ECHO *)(data + sizeof(ICMP_HEADER)); - - if (icmp->Type == ICMP_TYPE_ECHO_REQUEST && icmp->Code == 0) - { - UCHAR *icmp_payload = data + sizeof(ICMP_HEADER) + sizeof(ICMP_ECHO); - UINT icmp_payload_size = size - sizeof(ICMP_HEADER) - sizeof(ICMP_ECHO); - IP dest_ip; - - src_id = Endian16(echo->Identifier); - src_seqno = Endian16(echo->SeqNo); - - UINTToIP(&dest_ip, n->DestIp); - - // Send a query by using the ICMP API - ret = IcmpApiEchoSend(&dest_ip, n->IcmpQueryBlock->Ttl, - icmp_payload, icmp_payload_size, NAT_ICMP_TIMEOUT_WITH_API); - } - } - } - - if (ret != NULL && ret->Timeout == false) - { - // Convert to an IPv4 + ICMP packet since the result of ICMP API was obtained - IPV4_HEADER ipv4; - ICMP_HEADER icmp; - ICMP_ECHO echo; - BUF *buf = NewBuf(); - - // IPv4 header - Zero(&ipv4, sizeof(ipv4)); - IPV4_SET_VERSION(&ipv4, 4); - IPV4_SET_HEADER_LEN(&ipv4, sizeof(IPV4_HEADER) / 4); - ipv4.TimeToLive = ret->Ttl; - ipv4.Protocol = IP_PROTO_ICMPV4; - ipv4.SrcIP = IPToUINT(&ret->IpAddress); - ipv4.DstIP = 0x01010101; - - - // ICMP header - Zero(&icmp, sizeof(icmp)); - Zero(&echo, sizeof(echo)); - - if (ret->Ok) - { - // Normal response - echo.Identifier = Endian16(src_id); - echo.SeqNo = Endian16(src_seqno); - - ipv4.TotalLength = Endian16((USHORT)(sizeof(ipv4) + sizeof(icmp) + sizeof(echo) + ret->DataSize)); - - WriteBuf(buf, &ipv4, sizeof(ipv4)); - WriteBuf(buf, &icmp, sizeof(icmp)); - WriteBuf(buf, &echo, sizeof(echo)); - WriteBuf(buf, ret->Data, ret->DataSize); - } - else - { - // Error reply - icmp.Type = ret->Type; - icmp.Code = ret->Code; - echo.Identifier = Endian16(src_id); - echo.SeqNo = Endian16(src_seqno); - - ipv4.TotalLength = Endian16((USHORT)(sizeof(ipv4) + sizeof(icmp) + sizeof(echo) + n->IcmpOriginalCopySize)); - - WriteBuf(buf, &ipv4, sizeof(ipv4)); - WriteBuf(buf, &icmp, sizeof(icmp)); - WriteBuf(buf, &echo, sizeof(echo)); - - // Copy of the original packet to be included in the response packet - WriteBuf(buf, n->IcmpOriginalCopy, n->IcmpOriginalCopySize); - } - - n->IcmpResponseBlock = NewBlock(Clone(buf->Buf, buf->Size), buf->Size, 0); - n->IcmpResponseBlock->Ttl = ret->Ttl; - - FreeBuf(buf); - } - IcmpApiFreeResult(ret); - - // Inform the completion of the processing - n->IcmpTaskFinished = true; - SetSockEvent(n->v->SockEvent); -} - -// Process ICMP entry -bool NatTransactIcmp(VH *v, NAT_ENTRY *n) -{ - void *buf; - UINT recv_size; - BLOCK *block; - IP dest_ip; - UINT num_ignore_errors = 0; - UINT dest_port = 0; - // Validate arguments - if (v == NULL || n == NULL) - { - return true; - } - - dest_port = n->DestPort; - - if (n->DisconnectNow) - { - goto DISCONNECT; - } - - if (v->IcmpRawSocketOk) - { - // Environment that the Raw sockets are available - if (n->UdpSocketCreated == false) - { - // Create a UDP socket - n->Sock = NewUDP(MAKE_SPECIAL_PORT(IP_PROTO_ICMPV4)); - if (n->Sock == NULL) - { - // Socket creation failure - goto DISCONNECT; - } - else - { - n->PublicIp = IPToUINT(&n->Sock->LocalIP); - n->PublicPort = n->Sock->LocalPort; - - JoinSockToSockEvent(n->Sock, v->SockEvent); - n->UdpSocketCreated = true; - } - } - } - else - { - // Create a thread for using ICMP API if Raw sockets are not available - if (n->IcmpThread == NULL) - { - if (n->UdpSendQueue->num_item >= 1) - { - // Since UdpSendQueue contains only 1 query, get a first query - // and create a thread and pass the query to the thread - BLOCK *block = GetNext(n->UdpSendQueue); - - n->IcmpQueryBlock = block; - - n->IcmpThread = NewThread(NatIcmpThreadProc, n); - } - } - - if (n->IcmpTaskFinished) - { - if (n->IcmpResponseBlock != NULL) - { - // Because there was a response from the thread that calls ICMP API, pass this result to the stack - block = n->IcmpResponseBlock; - n->IcmpResponseBlock = NULL; - InsertQueue(n->UdpRecvQueue, block); - v->NatDoCancelFlag = true; - n->LastCommTime = v->Now; - } - else - { - // Disconnect immediately when it fails - goto DISCONNECT; - } - } - - // Examine whether this session timed-out - if ((n->LastCommTime + (UINT64)NAT_ICMP_TIMEOUT_WITH_API) < v->Now || n->LastCommTime > v->Now) - { - // Time-out - goto DISCONNECT; - } - - return true; - } - - // Following are processed only for if the raw sockets are available - buf = v->TmpBuf; - UINTToIP(&dest_ip, n->DestIp); - - // Try to receive data from the UDP socket - while (true) - { - IP src_ip; - UINT src_port; - recv_size = RecvFrom(n->Sock, &src_ip, &src_port, buf, 65536); - - if (recv_size == SOCK_LATER) - { - // Packet has not arrived - break; - } - else if (recv_size == 0) - { - Debug("ICMP ERROR\n"); - // Error? - if (n->Sock->IgnoreRecvErr == false) - { - // A fatal error occurred - goto DISCONNECT; - } - else - { - if ((num_ignore_errors++) >= MAX_NUM_IGNORE_ERRORS) - { - goto DISCONNECT; - } - } - } - else - { - // Analyze the arriving packet - ICMP_RESULT *ret = IcmpParseResult(&dest_ip, n->SrcPort, 0, buf, recv_size); - - if (ret != NULL) - { - if ((ret->Ok && CmpIpAddr(&ret->IpAddress, &dest_ip) == 0) || - (ret->DataSize >= sizeof(IPV4_HEADER) && ((IPV4_HEADER *)ret->Data)->DstIP == n->DestIp)) - { - // Insert to the queue - void *data = Malloc(recv_size); - Copy(data, buf, recv_size); - block = NewBlock(data, recv_size, 0); - InsertQueue(n->UdpRecvQueue, block); - v->NatDoCancelFlag = true; - n->LastCommTime = v->Now; - } - - IcmpFreeResult(ret); - } - } - } - - // Try to send data to the UDP socket - while (block = GetNext(n->UdpSendQueue)) - { - // Assemble the Echo header and ICMP header - UINT send_size; - - SetTtl(n->Sock, block->Ttl); - send_size = SendTo(n->Sock, &dest_ip, dest_port, block->Buf, block->Size); - - FreeBlock(block); - if (send_size == 0) - { - Debug("ICMP ERROR\n"); - // Determine whether a fatal error - if (n->Sock->IgnoreSendErr == false) - { - // A fatal error occurred - goto DISCONNECT; - } - } - else - { - n->LastCommTime = v->Now; - } - } - - // Examine whether this session timed-out - if ((n->LastCommTime + (UINT64)NAT_ICMP_TIMEOUT) < v->Now || n->LastCommTime > v->Now) - { - // Time-out - goto DISCONNECT; - } - - return true; - -DISCONNECT: - // Disconnect this session - if (n->UdpSocketCreated) - { - // Close the socket - Disconnect(n->Sock); - ReleaseSock(n->Sock); - n->Sock = NULL; - } - - // Terminate if the thread has been created - if (n->IcmpThread != NULL) - { - WaitThread(n->IcmpThread, INFINITE); - ReleaseThread(n->IcmpThread); - n->IcmpThread = NULL; - } - - // Delete the entry - DeleteNatIcmp(v, n); - - return false; -} - -// Process the UDP entry -bool NatTransactUdp(VH *v, NAT_ENTRY *n) -{ - void *buf; - UINT recv_size; - BLOCK *block; - IP dest_ip; - UINT num_ignore_errors; - UINT dest_port = 0; - // Validate arguments - if (v == NULL || n == NULL) - { - return true; - } - - dest_port = n->DestPort; - - if (n->DisconnectNow) - { - goto DISCONNECT; - } - - if (n->UdpSocketCreated == false) - { - // Create a UDP socket - n->Sock = NewUDP(0); - if (n->Sock == NULL) - { - // Socket creation failure - goto DISCONNECT; - } - else - { - n->PublicIp = IPToUINT(&n->Sock->LocalIP); - n->PublicPort = n->Sock->LocalPort; - - JoinSockToSockEvent(n->Sock, v->SockEvent); - n->UdpSocketCreated = true; - } - } - - buf = v->TmpBuf; - if (n->ProxyDns == false) - { - UINTToIP(&dest_ip, n->DestIp); - } - else - { - UINTToIP(&dest_ip, n->DestIpProxy); - } - - num_ignore_errors = 0; - - // Try to receive data from the UDP socket - while (true) - { - IP src_ip; - UINT src_port; - recv_size = RecvFrom(n->Sock, &src_ip, &src_port, buf, 65536); - - if (recv_size == SOCK_LATER) - { - // Packet has not arrived - break; - } - else if (recv_size == 0) - { - // Error? - if (n->Sock->IgnoreRecvErr == false) - { - // A fatal error occurred - goto DISCONNECT; - } - else - { - if ((num_ignore_errors++) > MAX_NUM_IGNORE_ERRORS) - { - goto DISCONNECT; - } - } - } - else - { - // Packet arrives. Check the source IP - if (IPToUINT(&src_ip) == n->DestIp || n->DestIp == 0xFFFFFFFF || (IPToUINT(&src_ip) == n->DestIpProxy && n->ProxyDns) && src_port == n->DestPort) - { - // Insert to the queue - void *data = Malloc(recv_size); - Copy(data, buf, recv_size); - block = NewBlock(data, recv_size, 0); - - if (block != NULL) - { - if (src_port == SPECIAL_UDP_PORT_WSD || src_port == SPECIAL_UDP_PORT_SSDP) - { - // Make believe there is a response from the host really in the case of WSD packet - block->Param1 = IPToUINT(&src_ip); - } - } - - InsertQueue(n->UdpRecvQueue, block); - v->NatDoCancelFlag = true; - n->LastCommTime = v->Now; - } - } - } - - // Try to send data to the UDP socket - while (block = GetNext(n->UdpSendQueue)) - { - UINT send_size; - bool is_nbtdgm = false; - LIST *local_ip_list = NULL; - - if (dest_port == SPECIAL_UDP_PORT_NBTDGM) - { - // Determine whether NetBIOS Datagram packet - NBTDG_HEADER *nh = (NBTDG_HEADER *)block->Buf; - - if (nh != NULL && block->Size >= sizeof(NBTDG_HEADER)) - { - if (nh->SrcIP == n->SrcIp && Endian16(nh->SrcPort) == n->SrcPort) - { - local_ip_list = GetHostIPAddressList(); - - if (local_ip_list != NULL) - { - is_nbtdgm = true; - } - } - } - } - - if (is_nbtdgm == false) - { - // Normal UDP packet - send_size = SendTo(n->Sock, &dest_ip, dest_port, block->Buf, block->Size); - } - else - { - // IP address and port number is embedded in the NetBIOS Datagram Packet. - // Transfer by rewriting it properly - UINT i; - - for (i = 0; i < LIST_NUM(local_ip_list); i++) - { - IP *my_ip = LIST_DATA(local_ip_list, i); - - if (IsIP4(my_ip) && IsZeroIp(my_ip) == false && IsLocalHostIP(my_ip) == false) - { - NBTDG_HEADER *nh = (NBTDG_HEADER *)block->Buf; - - nh->SrcIP = IPToUINT(my_ip); - nh->SrcPort = Endian16(n->PublicPort); - - send_size = SendTo(n->Sock, &dest_ip, dest_port, block->Buf, block->Size); - } - } - } - - if (local_ip_list != NULL) - { - FreeHostIPAddressList(local_ip_list); - } - - FreeBlock(block); - if (send_size == 0) - { - // Determining whether a fatal error - if (n->Sock->IgnoreSendErr == false) - { - // A fatal error occurred - goto DISCONNECT; - } - } - else - { - n->LastCommTime = v->Now; - } - } - - // Examine whether this session timed-out - if ((n->LastCommTime + (UINT64)v->NatUdpTimeout) < v->Now || n->LastCommTime > v->Now) - { - // Time-out - goto DISCONNECT; - } - - return true; - -DISCONNECT: - // Disconnect this session - if (n->UdpSocketCreated) - { - // Close the socket - Disconnect(n->Sock); - ReleaseSock(n->Sock); - n->Sock = NULL; - } - - // Delete the entry - DeleteNatUdp(v, n); - - return false; -} - -// Thread to make a connection to the TCP host -void NatTcpConnectThread(THREAD *t, void *p) -{ - NAT_ENTRY *n = (NAT_ENTRY *)p; - IP ip; - char hostname[MAX_SIZE]; - UINT port_number; - SOCK *sock; - SOCK_EVENT *e; - // Validate arguments - if (n == NULL || t == NULL) - { - return; - } - - UINTToIP(&ip, n->DestIp); - IPToStr(hostname, sizeof(hostname), &ip); - port_number = n->DestPort; - e = n->v->SockEvent; - AddRef(e->ref); - - // Notify the initialization completion - NoticeThreadInit(t); - - // Attempt to connect to the TCP host - Debug("NatTcpConnect Connecting to %s:%u\n", hostname, port_number); - sock = ConnectEx3(hostname, port_number, 0, &n->NatTcpCancelFlag, NULL, NULL, false, true); - if (sock == NULL) - { - // Connection failure - n->TcpMakeConnectionFailed = true; - } - else - { - // Successful connection - n->TcpMakeConnectionSucceed = true; - } - n->Sock = sock; - JoinSockToSockEvent(sock, e); - SetSockEvent(e); - - ReleaseSockEvent(e); -} - -// Create a thread for trying to connect to the TCP host -void CreateNatTcpConnectThread(VH *v, NAT_ENTRY *n) -{ - // Validate arguments - if (v == NULL || n == NULL) - { - return; - } - - // Create a thread - n->NatTcpConnectThread = NewThread(NatTcpConnectThread, (void *)n); - - // Wait for a thread initialization completion - WaitThreadInit(n->NatTcpConnectThread); -} - -// Handle the TCP entry -bool NatTransactTcp(VH *v, NAT_ENTRY *n) -{ - char str[MAX_SIZE]; - bool timeouted = false; - // Validate arguments - if (v == NULL || n == NULL) - { - return false; - } - - if (n->DisconnectNow) - { - goto DISCONNECT; - } - - // Process by state of the TCP - switch (n->TcpStatus) - { - case NAT_TCP_CONNECTING: // Waiting for connection - if (n->NatTcpConnectThread == NULL) - { - // Start a connection by creating a connection thread - CreateNatTcpConnectThread(v, n); - } - else - { - // Wait for the result of the connection thread that has already started - if (n->TcpMakeConnectionFailed || n->TcpMakeConnectionSucceed) - { - // Use the results because operation thread has already finished - WaitThread(n->NatTcpConnectThread, INFINITE); - ReleaseThread(n->NatTcpConnectThread); - n->NatTcpConnectThread = NULL; - - if (n->TcpMakeConnectionSucceed) - { - // Connection is successful, and a Sock was created - n->TcpStatus = NAT_TCP_CONNECTED; - IPToStr32(str, sizeof(str), n->DestIp); - NLog(v, "LH_NAT_TCP_SUCCEED", n->Id, n->Sock->RemoteHostname, str, n->DestPort); - } - else - { - // Failed to connect - n->TcpStatus = NAT_TCP_SEND_RESET; - IPToStr32(str, sizeof(str), n->DestIp); - NLog(v, "LH_NAT_TCP_FAILED", n->Id, str, n->DestPort); - } - v->NatDoCancelFlag = true; - } - } - break; - - case NAT_TCP_CONNECTED: // TCP socket connection completed. Negotiating with the client host - break; - - case NAT_TCP_SEND_RESET: // TCP communication disconnection: Send a RST to the client host - break; - - case NAT_TCP_ESTABLISHED: // TCP connection established - { - UINT old_send_fifo_size = 0; - - // Transmit to the socket if there is data in the receive buffer - while (n->RecvFifo->size > 0) - { - UINT sent_size = Send(n->Sock, ((UCHAR *)n->RecvFifo->p) + n->RecvFifo->pos, - n->RecvFifo->size, false); - if (sent_size == 0) - { - // Communication has been disconnected - n->TcpFinished = true; - v->NatDoCancelFlag = true; - break; - } - else if (sent_size == SOCK_LATER) - { - // Blocking - break; - } - else - { - // Successful transmission - ReadFifo(n->RecvFifo, NULL, sent_size); - n->SendAckNext = true; - - if (false) - { - IP ip; - - n->test_TotalSent += sent_size; - - UINTToIP(&ip, n->DestIp); - Debug("TCP %u: %r:%u %u\n", n->Id, &ip, n->DestPort, (UINT)n->test_TotalSent); - } - } - } - - old_send_fifo_size = FifoSize(n->SendFifo); - - // Write to the transmission buffer by obtaining data from the socket - while (true) - { - void *buf = (void *)v->TmpBuf; - UINT want_to_recv_size = 0; - UINT recv_size; - // Calculate the size of wanting to receive - if (n->SendFifo->size < NAT_SEND_BUF_SIZE) - { - // Still can receive - want_to_recv_size = MIN(NAT_SEND_BUF_SIZE - n->SendFifo->size, NAT_TMPBUF_SIZE); - } - if (want_to_recv_size == 0) - { - SetNoNeedToRead(n->Sock); - break; - } - recv_size = Recv(n->Sock, buf, want_to_recv_size, false); - if (recv_size == 0) - { - // Communication has been disconnected - n->TcpFinished = true; - v->NatDoCancelFlag = true; - if (n->TcpDisconnected == false) - { - Disconnect(n->Sock); - n->TcpDisconnected = true; - } - break; - } - else if (recv_size == SOCK_LATER) - { - // Blocking - break; - } - else - { - // Successful reception - WriteFifo(n->SendFifo, buf, recv_size); - v->NatDoCancelFlag = true; - } - } - - if (old_send_fifo_size == 0 && FifoSize(n->SendFifo) != 0) - { - // Reset the time data for timeout when the data is newly queued - // in the empty transmission buffer in the transmission process - n->TcpLastRecvAckTime = v->Now; - } - - // Raise a transmission time-out if a certain period of time elapsed - // after receiving the last ACK, and the transmission buffer is not - // empty, and the reception window size of other party is not 0 - if ((n->TcpLastRecvAckTime + (UINT64)VIRTUAL_TCP_SEND_TIMEOUT) < v->Now) - { - if (FifoSize(n->SendFifo) != 0 && n->TcpSendWindowSize != 0) - { - timeouted = true; - } - } - } - break; - - } - - // Timeout Detection - if ((n->LastCommTime + (UINT64)v->NatTcpTimeout) < v->Now || n->LastCommTime > v->Now) - { - timeouted = true; - } - - if (timeouted) - { - // Time-out occurs, the session close - n->TcpStatus = NAT_TCP_SEND_RESET; - v->NatDoCancelFlag = true; - } - - return true; - -DISCONNECT: // Disconnect and session disposal - DeleteNatTcp(v, n); - - return false; -} - -// Delete the entry of TCP NAT -void DeleteNatTcp(VH *v, NAT_ENTRY *n) -{ - // Validate arguments - if (v == NULL || n == NULL) - { - return; - } - - NLog(v, "LH_NAT_TCP_DELETED", n->Id); - - // Shutdown of connection thread - if (n->NatTcpConnectThread != NULL) - { - n->NatTcpCancelFlag = true; - - WaitThread(n->NatTcpConnectThread, INFINITE); - ReleaseThread(n->NatTcpConnectThread); - n->NatTcpConnectThread = NULL; - } - if (n->Sock != NULL) - { - // Disconnect the socket - Disconnect(n->Sock); - ReleaseSock(n->Sock); - n->Sock = NULL; - } - - // Release the window memory - if (n->TcpRecvWindow != NULL) - { - ReleaseFifo(n->TcpRecvWindow); - n->TcpRecvWindow = NULL; - } - - // Release the window reception list - if (n->TcpRecvList != NULL) - { - UINT i; - for (i = 0; i < LIST_NUM(n->TcpRecvList); i++) - { - IP_PART *p = LIST_DATA(n->TcpRecvList, i); - Free(p); - } - ReleaseList(n->TcpRecvList); - n->TcpRecvList = NULL; - } - - // FIFO release - ReleaseFifo(n->SendFifo); - ReleaseFifo(n->RecvFifo); - - // Delete from the NAT entry - Delete(v->NatTable, n); - - DeleteLock(n->lock); - - // Release the memory - Free(n); - - Debug("NAT_ENTRY: DeleteNatTcp\n"); -} - -// NAT processing thread -void NatThread(THREAD *t, void *param) -{ - // Validate arguments - if (t == NULL || param == NULL) - { - return; - } - - // Notify the initialization completion - NoticeThreadInit(t); - - NatThreadMain((VH *)param); -} - -// Send a beacon packet -void SendBeacon(VH *v) -{ - UINT dest_ip; - ARPV4_HEADER arp; - static char beacon_str[] = - "SecureNAT Virtual TCP/IP Stack Beacon"; - // Validate arguments - if (v == NULL) - { - return; - } - - // Send an UDP - dest_ip = (v->HostIP & v->HostMask) | (~v->HostMask); - SendUdp(v, dest_ip, 7, v->HostIP, 7, beacon_str, sizeof(beacon_str)); - - // Build the ARP header - arp.HardwareType = Endian16(ARP_HARDWARE_TYPE_ETHERNET); - arp.ProtocolType = Endian16(MAC_PROTO_IPV4); - arp.HardwareSize = 6; - arp.ProtocolSize = 4; - arp.Operation = Endian16(ARP_OPERATION_RESPONSE); - Copy(arp.SrcAddress, v->MacAddress, 6); - arp.SrcIP = v->HostIP; - arp.TargetAddress[0] = - arp.TargetAddress[1] = - arp.TargetAddress[2] = - arp.TargetAddress[3] = - arp.TargetAddress[4] = - arp.TargetAddress[5] = 0xff; - arp.TargetIP = dest_ip; - - // Transmission - VirtualLayer2Send(v, broadcast, v->MacAddress, MAC_PROTO_ARPV4, &arp, sizeof(arp)); -} - -// Send a TCP packet -void SendTcp(VH *v, UINT src_ip, UINT src_port, UINT dest_ip, UINT dest_port, UINT seq, UINT ack, UINT flag, UINT window_size, UINT mss, void *data, UINT size) -{ - static UCHAR tcp_mss_option[] = {0x02, 0x04, 0x00, 0x00, 0x01, 0x01, 0x01, 0x00}; - IPV4_PSEUDO_HEADER *vh; - TCP_HEADER *tcp; - UINT header_size = TCP_HEADER_SIZE; - UINT total_size; - // Validate arguments - if (v == NULL || (size != 0 && data == NULL)) - { - return; - } - - // Memory allocation - vh = Malloc(sizeof(IPV4_PSEUDO_HEADER) + TCP_HEADER_SIZE + size + 32); - tcp = (TCP_HEADER *)(((UCHAR *)vh) + sizeof(IPV4_PSEUDO_HEADER)); - - if (mss != 0) - { - USHORT *mss_size; - mss_size = (USHORT *)(&tcp_mss_option[2]); - *mss_size = Endian16((USHORT)mss); - header_size += sizeof(tcp_mss_option); - } - - total_size = header_size + size; - if (total_size > 65536) - { - // Packet is too long - Free(vh); - return; - } - - // Pseudo header generation - vh->SrcIP = src_ip; - vh->DstIP = dest_ip; - vh->Reserved = 0; - vh->Protocol = IP_PROTO_TCP; - vh->PacketLength = Endian16((USHORT)total_size); - - // TCP header generation - tcp->SrcPort = Endian16((USHORT)src_port); - tcp->DstPort = Endian16((USHORT)dest_port); - tcp->SeqNumber = Endian32(seq); - tcp->AckNumber = Endian32(ack); - tcp->HeaderSizeAndReserved = 0; - TCP_SET_HEADER_SIZE(tcp, (UCHAR)(header_size / 4)); - tcp->Flag = (UCHAR)flag; - tcp->WindowSize = Endian16((USHORT)window_size); - tcp->Checksum = 0; - tcp->UrgentPointer = 0; - - // Copy the option values - if (mss != 0) - { - Copy(((UCHAR *)tcp) + TCP_HEADER_SIZE, tcp_mss_option, sizeof(tcp_mss_option)); - } - - // Data copy - Copy(((UCHAR *)tcp) + header_size, data, size); - - // Checksum calculation - tcp->Checksum = IpChecksum(vh, total_size + 12); - - // Submit as an IP packet - SendIp(v, dest_ip, src_ip, IP_PROTO_TCP, tcp, total_size); - - // Release the memory - Free(vh); -} - -// Polling process of TCP -void PollingNatTcp(VH *v, NAT_ENTRY *n) -{ - // Validate arguments - if (v == NULL || n == NULL) - { - return; - } - - switch (n->TcpStatus) - { - case NAT_TCP_CONNECTING: // Socket connecting: nothing to do - break; - - case NAT_TCP_CONNECTED: // The socket connected: process SYN + ACK, ACK - if ((n->LastSynAckSentTime > v->Now) || n->LastSynAckSentTime == 0 || ((n->LastSynAckSentTime + (UINT64)(NAT_TCP_SYNACK_SEND_TIMEOUT * (UINT64)(n->SynAckSentCount + 1)) <= v->Now))) - { - n->LastSynAckSentTime = v->Now; - // Send a SYN + ACK - SendTcp(v, n->DestIp, n->DestPort, n->SrcIp, n->SrcPort, - (UINT)(n->SendSeqInit + n->SendSeq), - (UINT)(n->RecvSeqInit + n->RecvSeq), - TCP_SYN | TCP_ACK, n->TcpRecvWindowSize, - v->TcpMss, NULL, 0); - n->SynAckSentCount++; - } - break; - - case NAT_TCP_SEND_RESET: // Reset the connection - // Send a RST - if (n->TcpFinished == false || n->TcpForceReset) - { - SendTcp(v, n->DestIp, n->DestPort, n->SrcIp, n->SrcPort, - (UINT)(n->SendSeq + n->SendSeqInit), - (UINT)(n->SendSeq + n->SendSeqInit), - TCP_RST, 0, - 0, NULL, 0); - // Disconnect - n->TcpStatus = NAT_TCP_WAIT_DISCONNECT; - n->DisconnectNow = true; - } - else - { - // Send FINs for NAT_FIN_SEND_MAX_COUNT times - if (n->FinSentTime == 0 || (n->FinSentTime > v->Now) || (n->FinSentTime + NAT_FIN_SEND_INTERVAL * (n->FinSentCount + 1)) < v->Now) - { - SendTcp(v, n->DestIp, n->DestPort, n->SrcIp, n->SrcPort, - (UINT)(n->SendSeq + n->SendSeqInit), - (UINT)(n->RecvSeq + n->RecvSeqInit), - TCP_ACK | TCP_FIN, 0, - 0, NULL, 0); - n->FinSentTime = v->Now; - n->FinSentSeq = (UINT)(n->SendSeq + n->SendSeqInit); - n->FinSentCount++; - if (n->FinSentCount >= NAT_FIN_SEND_MAX_COUNT) - { - n->TcpFinished = false; - } - } - } - break; - - case NAT_TCP_ESTABLISHED: // Connection established - { - UINT send_data_size; - UINT current_pointer; - UINT notice_window_size_value = 0; - UINT buf_free_bytes = 0; - // Determine the value of the window size to be notified - if (FifoSize(n->RecvFifo) < NAT_RECV_BUF_SIZE) - { - buf_free_bytes = NAT_RECV_BUF_SIZE - FifoSize(n->RecvFifo); - } - notice_window_size_value = MIN(n->TcpRecvWindowSize, buf_free_bytes); - if (n->LastSentKeepAliveTime == 0 || - (n->LastSentKeepAliveTime + (UINT64)NAT_ACK_KEEPALIVE_SPAN) < v->Now || - (n->LastSentKeepAliveTime > v->Now)) - { - if (n->LastSentKeepAliveTime != 0) - { - // Send an ACK packet for Keep-Alive - SendTcp(v, n->DestIp, n->DestPort, n->SrcIp, n->SrcPort, - (UINT)(n->SendSeqInit + n->SendSeq), - (UINT)(n->RecvSeqInit + n->RecvSeq) - 1, - TCP_ACK, - notice_window_size_value, - 0, - NULL, - 0); - } - n->LastSentKeepAliveTime = v->Now; - } - if (n->TcpLastSentTime == 0 || - (n->TcpLastSentTime > v->Now) || - ((n->TcpLastSentTime + (UINT64)n->TcpSendTimeoutSpan) < v->Now) || - n->SendAckNext) - { - // If there is data to send, send the data - // Calculate the segment size to be transmitted - send_data_size = n->TcpSendWindowSize; - if (send_data_size > (n->TcpSendCWnd * n->TcpSendMaxSegmentSize)) - { - // Apply the cwnd value - send_data_size = n->TcpSendCWnd * n->TcpSendMaxSegmentSize; - } - if (send_data_size > n->SendFifo->size) - { - // Can not be sent over the data that is currently held - send_data_size = n->SendFifo->size; - } - if (send_data_size >= 1) - { - // Transmit the fragmented segments - current_pointer = 0; - while (send_data_size > 0) - { - UINT send_segment_size = MIN(n->TcpSendMaxSegmentSize, send_data_size); - void *send_segment = (void *)(((UCHAR *)n->SendFifo->p) + n->SendFifo->pos + current_pointer); - SendTcp(v, n->DestIp, n->DestPort, n->SrcIp, n->SrcPort, - (UINT)(n->SendSeqInit + n->SendSeq + (UINT64)current_pointer), - (UINT)(n->RecvSeqInit + n->RecvSeq), - TCP_ACK | TCP_PSH, - notice_window_size_value, - 0, - send_segment, - send_segment_size); - current_pointer += send_segment_size; - send_data_size -= send_segment_size; - } - // Record the transmission time - n->TcpLastSentTime = v->Now; - // Record the stream size to be transmitted this time - n->SendMissionSize = current_pointer; - n->CurrentSendingMission = true; - // RTT measurement - if (n->CalcRTTStartTime == 0) - { - n->CalcRTTStartTime = v->Now; - n->CalcRTTStartValue = n->SendSeq + current_pointer - 1; - } - if (n->RetransmissionUsedFlag == false) - { - n->RetransmissionUsedFlag = true; - } - else - { - // Congestion is detected - if (n->TcpSendCWnd > 2) - { - n->TcpSendCWnd--; - } - } - } - else if (n->SendAckNext) - { - // Send only an ACK - SendTcp(v, n->DestIp, n->DestPort, n->SrcIp, n->SrcPort, - (UINT)(n->SendSeqInit + n->SendSeq), - (UINT)(n->RecvSeqInit + n->RecvSeq), - TCP_ACK, - notice_window_size_value, - 0, - NULL, - 0); - } - n->SendAckNext = false; - } - if (n->TcpFinished) - { - // Disconnect if all data transmission has completed - if (n->SendFifo->size == 0 && n->RecvFifo->size == 0) - { - n->TcpStatus = NAT_TCP_SEND_RESET; - } - } - } - break; - } -} - -// Reception of TCP packets addressed to the Internet -void TcpRecvForInternet(VH *v, UINT src_ip, UINT src_port, UINT dest_ip, UINT dest_port, TCP_HEADER *tcp, void *data, UINT size, UINT max_l3_size) -{ - NAT_ENTRY *n, t; - UINT seq, ack; - UINT64 seq64 = 0, ack64 = 0; - // Validate arguments - if (v == NULL || tcp == NULL || data == NULL) - { - return; - } - - if (NnIsActive(v)) - { - NnTcpRecvForInternet(v, src_ip, src_port, dest_ip, dest_port, tcp, data, size, max_l3_size); - return; - } - - seq = Endian32(tcp->SeqNumber); - ack = Endian32(tcp->AckNumber); - - if (v->HubOption != NULL && v->HubOption->DisableUserModeSecureNAT) - { - // Disable User-mode NAT - SendTcp(v, dest_ip, dest_port, src_ip, src_port, - 0, seq + 1, TCP_RST | TCP_ACK, 0, 0, NULL, 0); - return; - } - - // Search for a session for this packet from the NAT table - SetNat(&t, NAT_TCP, src_ip, src_port, dest_ip, dest_port, 0, 0); - n = SearchNat(v, &t); - - if (n == NULL) - { - // There is no existing session - // Allow through only SYN packet - if ((tcp->Flag & TCP_SYN) && ((tcp->Flag & TCP_ACK) == false)) - { - TCP_OPTION o; - // Create a new session - n = CreateNatTcp(v, src_ip, src_port, dest_ip, dest_port); - if (n == NULL) - { - // Return the RST if it was not possible to create - SendTcp(v, dest_ip, dest_port, src_ip, src_port, - 0, seq + 1, TCP_RST | TCP_ACK, 0, 0, NULL, 0); - return; - } - - // Get the options - ParseTcpOption(&o, ((UCHAR *)tcp) + TCP_HEADER_SIZE, TCP_GET_HEADER_SIZE(tcp) * 4 - TCP_HEADER_SIZE); - if (o.MaxSegmentSize == 0) - { - o.MaxSegmentSize = v->TcpMss; - } - - Debug("TCP SYN: MSS=%u, WS=%u\n", o.MaxSegmentSize, o.WindowScaling); - - // Initial sequence number - n->RecvSeqInit = (UINT64)Endian32(tcp->SeqNumber); - n->RecvSeq = 1; - - n->TcpSendMaxSegmentSize = o.MaxSegmentSize; - n->TcpRecvWindowSize = NAT_TCP_RECV_WINDOW_SIZE; - n->TcpSendWindowSize = (UINT)Endian16(tcp->WindowSize); - if (o.WindowScaling != 0) - { - if (o.WindowScaling > 14) - { - o.WindowScaling = 14; - } - n->TcpSendWindowSize = (n->TcpSendWindowSize << o.WindowScaling); - } - } - } - - if (n == NULL) - { - // Return a RST since a packet which is not registered in the NAT entry arrived - SendTcp(v, dest_ip, dest_port, src_ip, src_port, - ack, ack, TCP_RST, 0, 0, NULL, 0); - return; - } - - n->TcpLastRecvAckTime = v->Now; - - switch (n->TcpStatus) - { - case NAT_TCP_SEND_RESET: // Disconnect the connection by sending a RST - if ((tcp->Flag & TCP_ACK) && ((tcp->Flag & TCP_SYN) == false)) - { - if (n->FinSentCount >= 1) - { - if (ack == (n->FinSentSeq + 1)) - { - n->TcpForceReset = true; - } - } - } - break; - - case NAT_TCP_CONNECTED: // Socket connection completion: SYN + ACK, ACK processing - if ((tcp->Flag & TCP_ACK) && ((tcp->Flag & TCP_SYN) == false)) - { - if (seq == (UINT)(n->RecvSeqInit + n->RecvSeq) && - ack == (UINT)(n->SendSeqInit + n->SendSeq + 1)) - { - // Handshake complete since the ACK packet came back - n->SendSeq++; // SYN packet consumes the seq by 1 - Debug("TCP Connection Established.\n"); - n->TcpStatus = NAT_TCP_ESTABLISHED; - // Initialize the congestion window size - n->TcpSendCWnd = 1; - n->LastCommTime = v->Now; - } - else - { - goto TCP_RESET; - } - } - else if (tcp->Flag & TCP_RST) - { -TCP_RESET: - // Receive a RST - Debug("TCP Connection Reseted.\n"); - n->TcpStatus = NAT_TCP_SEND_RESET; - } - break; - - case NAT_TCP_ESTABLISHED: // Connection established - if (tcp->Flag & TCP_FIN) - { - // Complete the connection - n->TcpFinished = true; - } - if (tcp->Flag & TCP_RST) - { - // Receive a RST - goto TCP_RESET; - } - else if (tcp->Flag & TCP_ACK) - { - TCP_OPTION opt; - n->LastCommTime = v->Now; - // Get the options, such as window size - n->TcpSendWindowSize = Endian16(tcp->WindowSize); - ParseTcpOption(&opt, ((UCHAR *)tcp) + TCP_HEADER_SIZE, TCP_GET_HEADER_SIZE(tcp) * 4 - TCP_HEADER_SIZE); - if (opt.WindowScaling != 0) - { - if (opt.WindowScaling > 14) - { - opt.WindowScaling = 14; - } - n->TcpSendWindowSize = (n->TcpSendWindowSize << opt.WindowScaling); - } - // First, process the received ACK - // Store the end position of the stream that has received the acknowledgment to ack64 - ack64 = n->SendSeq + (UINT64)ack - (n->SendSeqInit + n->SendSeq) % X32; - if ((n->SendSeqInit + n->SendSeq) % X32 > ack) - { - if (((n->SendSeqInit + n->SendSeq) % X32 - ack) >= 0x80000000) - { - ack64 = n->SendSeq + (UINT64)ack + X32 - (n->SendSeqInit + n->SendSeq) % X32; - } - } - if (ack64 > n->SendSeq) - { - // Reception of 1 byte or more seems to have been completed by the client - UINT slide_offset = (UINT)(ack64 - n->SendSeq); // Sliding size of the window - if (slide_offset == 0 || slide_offset > n->TcpSendWindowSize || slide_offset > n->SendFifo->size) - { - // Ignore because the offset value of acknowledgment is - // larger than the size that should have been sent so far - } - else - { - // RTT measurement - if (n->CalcRTTStartTime != 0) - { - if (n->CalcRTTStartValue < ack64) - { - UINT time_span; - if (v->Now > n->CalcRTTStartTime) - { - time_span = (UINT)(v->Now - n->CalcRTTStartTime); - } - else - { - time_span = 100; - } - n->CalcRTTStartTime = 0; - - // Smoothing - n->CurrentRTT = - (UINT) - ( - ((UINT64)n->CurrentRTT * (UINT64)9 + - (UINT64)time_span * (UINT64)1) / (UINT64)10 - ); - n->TcpSendTimeoutSpan = n->CurrentRTT * 2; - } - } - // Reduce the transmission size - n->SendMissionSize -= slide_offset; - if (n->SendMissionSize == 0) - { - // Try to increase the transmission segment size because - // all segments to be sent this time have been sent - if (n->TcpSendCWnd < 65536) - { - n->TcpSendCWnd++; - } - n->CurrentSendingMission = false; - n->TcpLastSentTime = 0; - n->RetransmissionUsedFlag = false; - } - // Slide the buffer - n->SendSeq += slide_offset; - ReadFifo(n->SendFifo, NULL, slide_offset); - // Send further by the size of confirmed transmission completion by the ACK this time - if (n->SendMissionSize != 0 && false) - { - UINT notice_window_size_value = 0; - UINT send_data_size; - UINT buf_free_bytes; - UINT send_offset = n->SendMissionSize; - // Determine the value of the window size to be notified - if (FifoSize(n->RecvFifo) < NAT_RECV_BUF_SIZE) - { - buf_free_bytes = NAT_RECV_BUF_SIZE - FifoSize(n->RecvFifo); - } - notice_window_size_value = MIN(n->TcpRecvWindowSize, buf_free_bytes); - // Calculate the segment size to be transmitted - send_data_size = n->TcpSendWindowSize; - if (send_data_size > (n->TcpSendCWnd * n->TcpSendMaxSegmentSize)) - { - // Apply the cwnd value - send_data_size = n->TcpSendCWnd * n->TcpSendMaxSegmentSize; - } - if (n->SendFifo->size > send_offset) - { - send_data_size = MIN(send_data_size, n->SendFifo->size - send_offset); - send_data_size = MIN(send_data_size, slide_offset); - } - else - { - send_data_size = 0; - } - if (send_data_size >= 1) - { - // Transmit the fragmented segments - UINT current_pointer = 0; - while (send_data_size > 0) - { - UINT send_segment_size = MIN(n->TcpSendMaxSegmentSize, send_data_size); - void *send_segment = (void *)(( - (UCHAR *)n->SendFifo->p) + n->SendFifo->pos + - current_pointer + send_offset); - - SendTcp(v, n->DestIp, n->DestPort, n->SrcIp, n->SrcPort, - (UINT)(n->SendSeqInit + n->SendSeq + (UINT64)current_pointer - + (UINT)send_offset), - (UINT)(n->RecvSeqInit + n->RecvSeq), - TCP_ACK | TCP_PSH, - notice_window_size_value, - 0, - send_segment, - send_segment_size); - current_pointer += send_segment_size; - send_data_size -= send_segment_size; - } - n->SendMissionSize += current_pointer; - n->CurrentSendingMission = true; - n->TcpLastSentTime = v->Now; - // RTT measurement - if (n->CalcRTTStartTime == 0) - { - n->CalcRTTStartTime = v->Now; - n->CalcRTTStartValue = n->SendSeq + current_pointer - 1; - } - } - } - // Event occurs - SetSockEvent(v->SockEvent); - } - } - // Next, receive the data - seq64 = n->RecvSeq + (UINT64)seq - (n->RecvSeqInit + n->RecvSeq) % X32; - if ((n->RecvSeqInit + n->RecvSeq) % X32 > seq) - { - if (((n->RecvSeqInit + n->RecvSeq) % X32 - seq) >= 0x80000000) - { - seq64 = n->RecvSeq + (UINT64)seq + X32 - (n->RecvSeqInit + n->RecvSeq) % X32; - } - } - // Position of the starting point of the data from the client is in the seq64 at this time - if (seq64 >= n->RecvSeq && (seq64 + size) <= (n->RecvSeq + n->TcpRecvWindowSize)) - { - if (size >= 1) - { - // One or more bytes of data has been received within the receive window - UINT offset = (UINT)(seq64 - n->RecvSeq); - UINT i; - IP_PART *me; - if (n->TcpRecvWindow == NULL) - { - n->TcpRecvWindow = NewFifo(); - } - if (n->TcpRecvList == NULL) - { - n->TcpRecvList = NewListFast(NULL); - } - // Add to the list by overwriting arriving packets to the buffer - if (FifoSize(n->TcpRecvWindow) < (offset + size)) - { - // Buffer size expansion - WriteFifo(n->TcpRecvWindow, NULL, offset + size - FifoSize(n->TcpRecvWindow)); - } - Copy(((UCHAR *)n->TcpRecvWindow->p) + n->TcpRecvWindow->pos + - offset, data, size); - me = ZeroMalloc(sizeof(IP_PART)); - me->Offset = offset; - me->Size = size; - for (i = 0; i < LIST_NUM(n->TcpRecvList); i++) - { - IP_PART *p = LIST_DATA(n->TcpRecvList, i); - // If there are overlapped region, remove these - if (p->Size != 0) - { - if (me->Offset <= p->Offset && (me->Offset + me->Size) >= (p->Offset + p->Size)) - { - // This packet completely overwrite the existing packet - p->Size = 0; - } - else if (me->Offset >= p->Offset && (me->Offset + me->Size) <= (p->Offset + p->Size)) - { - // Existing packet completely override this packet - me->Size = 0; - } - else if (me->Offset > p->Offset && me->Offset < (p->Offset + p->Size) && - (me->Offset + me->Size) > (p->Offset + p->Size)) - { - // Partially overlapped - p->Size -= p->Offset + p->Size - me->Offset; - } - else if (me->Offset < p->Offset && (me->Offset + size) > p->Offset && (me->Offset + size) < (p->Offset + p->Size)) - { - // Partially overlapped - me->Size -= me->Offset + me->Size - p->Offset; - } - } - } - if (me->Size == 0) - { - Free(me); - } - else - { - Add(n->TcpRecvList, me); - } -KILL_NULL_FIRST: - // Remove all blank items from reception list - for (i = 0; i < LIST_NUM(n->TcpRecvList); i++) - { - IP_PART *p = LIST_DATA(n->TcpRecvList, i); - if (p->Size == 0) - { - Delete(n->TcpRecvList, p); - Free(p); - goto KILL_NULL_FIRST; - } - } -SCAN_FIRST: - // Extract if there is something starting at offset 0 in the received list - for (i = 0; i < LIST_NUM(n->TcpRecvList); i++) - { - IP_PART *p = LIST_DATA(n->TcpRecvList, i); - UINT sz; - if (p->Offset == 0) - { - // Since a data block starts with 0 is found, - // slide it left by that amount and write the buffer - // for extracting data to the FIFO - sz = p->Size; - WriteFifo(n->RecvFifo, ((UCHAR *)n->TcpRecvWindow->p) + n->TcpRecvWindow->pos, sz); - // Release from the list - Delete(n->TcpRecvList, p); - Free(p); - ReadFifo(n->TcpRecvWindow, NULL, sz); - // Slide all the items to the left - for (i = 0; i < LIST_NUM(n->TcpRecvList); i++) - { - p = LIST_DATA(n->TcpRecvList, i); - p->Offset -= sz; - } - // Update the parameters of the TCB - n->RecvSeq += (UINT64)sz; - SetSockEvent(v->SockEvent); - n->SendAckNext = true; - // Re-scan from the beginning - goto SCAN_FIRST; - } - } - } - } - } - break; - } - - SetSockEvent(v->SockEvent); -} - -// Parse the TCP options -void ParseTcpOption(TCP_OPTION *o, void *data, UINT size) -{ - UCHAR *buf = (UCHAR *)data; - UINT i = 0; - UINT value_size = 0; - UINT value_id = 0; - UCHAR value[128]; - // Validate arguments - if (o == NULL || data == NULL) - { - return; - } - - Zero(o, sizeof(TCP_OPTION)); - - while(i < size) - { - if (buf[i] == 0) - { - return; - } - else if (buf[i] == 1) - { - i++; - continue; - } - else - { - value_id = buf[i]; - i++; - if (i >= size) - { - return; - } - value_size = buf[i]; - if (value_size <= 1 || value_size > sizeof(value)) - { - return; - } - i++; - if (i >= size) - { - return; - } - value_size -= 2; - - Copy(value, &buf[i], value_size); - i += value_size; - if (i > size) - { - return; - } - - switch (value_id) - { - case 2: // MSS - if (value_size == 2) - { - USHORT *mss = (USHORT *)value; - o->MaxSegmentSize = Endian16(*mss); - } - break; - - case 3: // WSS - if (value_size == 1) - { - UCHAR *wss = (UCHAR *)value; - o->WindowScaling = *wss; - } - break; - - } - } - } -} - -// Create a new NAT TCP session -NAT_ENTRY *CreateNatTcp(VH *v, UINT src_ip, UINT src_port, UINT dest_ip, UINT dest_port) -{ - NAT_ENTRY *n; - HUB_OPTION *o; - // Validate arguments - if (v == NULL) - { - return NULL; - } - - if (CanCreateNewNatEntry(v) == false) - { - return NULL; - } - - o = NatGetHubOption(v); - - // Fail immediately if the connection with SYN_SENT are too many - if (o != NULL && o->SecureNAT_MaxTcpSynSentPerIp != 0) - { - if (GetNumNatEntriesPerIp(v, src_ip, NAT_TCP, true) >= o->SecureNAT_MaxTcpSynSentPerIp) - { - return NULL; - } - } - - // If the connections other than SYN_SENT are too many, delete old ones - if (o != NULL && o->SecureNAT_MaxTcpSessionsPerIp != 0) - { - if (GetNumNatEntriesPerIp(v, src_ip, NAT_TCP, false) >= o->SecureNAT_MaxTcpSessionsPerIp) - { - NAT_ENTRY *oldest = GetOldestNatEntryOfIp(v, src_ip, NAT_TCP); - - if (oldest != NULL) - { - DisconnectNatEntryNow(v, oldest); - } - } - } - - // Create a NAT entry - n = ZeroMalloc(sizeof(NAT_ENTRY)); - n->Id = Inc(v->Counter); - n->v = v; - n->lock = NewLock(); - n->Protocol = NAT_TCP; - n->SrcIp = src_ip; - n->SrcPort = src_port; - n->DestIp = dest_ip; - n->DestPort = dest_port; - n->CreatedTime = n->LastCommTime = v->Now; - n->TcpLastRecvAckTime = v->Now; - n->Sock = NULL; - n->DisconnectNow = false; - n->TcpSendMaxSegmentSize = n->TcpRecvMaxSegmentSize = v->TcpMss; - - n->SendFifo = NewFifo(); - n->RecvFifo = NewFifo(); - - n->TcpStatus = NAT_TCP_CONNECTING; - - n->SendSeqInit = Rand32(); - n->CurrentRTT = NAT_INITIAL_RTT_VALUE; - n->TcpSendTimeoutSpan = n->CurrentRTT * 2; - - // Add to the NAT table - Add(v->NatTable, n); - - -#if 1 - { - IP ip1, ip2; - char s1[MAX_SIZE], s2[MAX_SIZE]; - UINTToIP(&ip1, src_ip); - UINTToIP(&ip2, dest_ip); - IPToStr(s1, 0, &ip1); - IPToStr(s2, 0, &ip2); - Debug("NAT_ENTRY: CreateNatTcp %s %u -> %s %u\n", s1, src_port, s2, dest_port); - - NLog(v, "LH_NAT_TCP_CREATED", n->Id, s1, src_port, s2, dest_port); - } -#endif - - return n; -} - -// Received TCP packets from the virtual network -void VirtualTcpReceived(VH *v, UINT src_ip, UINT dest_ip, void *data, UINT size, UINT max_l3_size) -{ - TCP_HEADER *tcp; - UINT src_port, dest_port; - UINT header_size, buf_size; - void *buf; - IP ip1, ip2; - // Validate arguments - if (v == NULL || data == NULL) - { - return; - } - - // Get the header - if (size < TCP_HEADER_SIZE) - { - // Size is too small - return; - } - tcp = (TCP_HEADER *)data; - src_port = Endian16(tcp->SrcPort); - dest_port = Endian16(tcp->DstPort); - if (src_port == 0 || dest_port == 0) - { - // Port number is invalid - return; - } - if (src_ip == dest_ip || src_ip == 0 || src_ip == 0xffffffff || dest_ip == 0 || dest_ip == 0xffffffff) - { - // IP address is invalid - return; - } - UINTToIP(&ip1, src_ip); - UINTToIP(&ip2, dest_ip); - if (ip1.addr[0] == 127 || ip2.addr[0] == 127) - { - // Loopback IP address can not be specified - return; - } - if (IsInNetwork(dest_ip, v->HostIP, v->HostMask)) - { - // Ignore the packets toward the network of the virtual LAN side - return; - } - // Get the header size - header_size = TCP_GET_HEADER_SIZE(tcp) * 4; - if (size < header_size) - { - // Header size is invalid - return; - } - // Get the address and size of the buffer - buf_size = size - header_size; - buf = (void *)(((UCHAR *)data) + header_size); - - TcpRecvForInternet(v, src_ip, src_port, dest_ip, dest_port, tcp, buf, buf_size, max_l3_size); -} - -// NAT ICMP polling -void PollingNatIcmp(VH *v, NAT_ENTRY *n) -{ - // Validate arguments - if (v == NULL || n == NULL) - { - return; - } - - // Process if there are any packets in the receive queue - if (n->UdpRecvQueue->num_item != 0) - { - BLOCK *block; - - // Send all ICMP packets to the virtual network - while (block = GetNext(n->UdpRecvQueue)) - { - // Rewrite the destination IP address of the returned packet to the IP address of the client - UCHAR *data; - UINT size; - - data = (UCHAR *)block->Buf; - size = block->Size; - - if (size >= sizeof(IPV4_HEADER)) - { - IPV4_HEADER *ipv4 = (IPV4_HEADER *)data; - UINT ipv4_header_size = GetIpHeaderSize((UCHAR *)ipv4, size); - - if (ipv4_header_size >= sizeof(IPV4_HEADER) && (Endian16(ipv4->TotalLength) >= ipv4_header_size)) - { - UCHAR *ipv4_payload = data + ipv4_header_size; - UINT ipv4_payload_size = Endian16(ipv4->TotalLength) - ipv4_header_size; - - if (ipv4_payload_size >= sizeof(ICMP_HEADER) + sizeof(ICMP_ECHO)) - { - ICMP_HEADER *icmp = (ICMP_HEADER *)(data + ipv4_header_size); - UINT icmp_size = ipv4_payload_size; - - if (icmp->Type == ICMP_TYPE_DESTINATION_UNREACHABLE || icmp->Type == ICMP_TYPE_TIME_EXCEEDED) - { - // Rewrite the Src IP of the IPv4 header of the ICMP response packet - if (icmp_size >= (sizeof(ICMP_HEADER) + sizeof(ICMP_ECHO) + sizeof(IPV4_HEADER))) - { - IPV4_HEADER *orig_ipv4 = (IPV4_HEADER *)(data + ipv4_header_size + sizeof(ICMP_HEADER) + sizeof(ICMP_ECHO)); - UINT orig_ipv4_size = icmp_size - (sizeof(ICMP_HEADER) + sizeof(ICMP_ECHO)); - - UINT orig_ipv4_header_size = GetIpHeaderSize((UCHAR *)orig_ipv4, orig_ipv4_size); - - if (orig_ipv4_header_size >= sizeof(IPV4_HEADER)) - { - orig_ipv4->SrcIP = n->SrcIp; - orig_ipv4->Checksum = 0; - orig_ipv4->Checksum = IpChecksum(orig_ipv4, orig_ipv4_header_size); - } - } - } - - // Recalculate the checksum of ICMP - icmp->Checksum = IpChecksum(icmp, icmp_size); - - SendIpEx(v, n->SrcIp, ipv4->SrcIP, ipv4->Protocol, ipv4_payload, ipv4_payload_size, - MAX(ipv4->TimeToLive - 1, 1)); - } - } - } - - FreeBlock(block); - } - - if (v->IcmpRawSocketOk == false) - { - // Release the NAT entry as soon as the results is received in the case of using ICMP API - n->DisconnectNow = true; - } - } -} - -// NAT UDP polling -void PoolingNatUdp(VH *v, NAT_ENTRY *n) -{ - // Validate arguments - if (v == NULL || n == NULL) - { - return; - } - - // Process if there are any packets in the receive queue - if (n->UdpRecvQueue->num_item != 0) - { - BLOCK *block; - - // Send all UDP packets to the virtual network - while (block = GetNext(n->UdpRecvQueue)) - { - UINT src_ip = n->DestIp; - - if (src_ip == 0xFFFFFFFF) - { - src_ip = v->HostIP; - } - - if (block->Param1 != 0) - { - src_ip = block->Param1; - } - - SendUdp(v, n->SrcIp, n->SrcPort, src_ip, n->DestPort, - block->Buf, block->Size); - - FreeBlock(block); - } - } -} - -// NAT polling -void PoolingNat(VH *v) -{ - UINT i; - // Validate arguments - if (v == NULL) - { - return; - } - - if (NnIsActive(v)) - { - // Poll whether the packet comes from native NAT - NnPoll(v->NativeNat); - } - - // Process by scanning the all NAT entries - for (i = 0; i < LIST_NUM(v->NatTable); i++) - { - NAT_ENTRY *n = LIST_DATA(v->NatTable, i); - - switch (n->Protocol) - { - case NAT_TCP: - PollingNatTcp(v, n); - break; - - case NAT_UDP: - PoolingNatUdp(v, n); - break; - - case NAT_ICMP: - PollingNatIcmp(v, n); - break; - - case NAT_DNS: - PollingNatDns(v, n); - break; - } - } -} - -// Comparison function of the NAT table entry -int CompareNat(void *p1, void *p2) -{ - NAT_ENTRY *n1, *n2; - if (p1 == NULL || p2 == NULL) - { - return 0; - } - n1 = *(NAT_ENTRY **)p1; - n2 = *(NAT_ENTRY **)p2; - if (n1 == n2) - { - return 0; - } - - if (n1->SrcIp > n2->SrcIp) return 1; - else if (n1->SrcIp < n2->SrcIp) return -1; - else if (n1->DestIp > n2->DestIp) return 1; - else if (n1->DestIp < n2->DestIp) return -1; - else if (n1->SrcPort > n2->SrcPort) return 1; - else if (n1->SrcPort < n2->SrcPort) return -1; - else if (n1->DestPort > n2->DestPort) return 1; - else if (n1->DestPort < n2->DestPort) return -1; - else if (n1->Protocol > n2->Protocol) return 1; - else if (n1->Protocol < n2->Protocol) return -1; - else return 0; -} - -// Configure the NAT structure -void SetNat(NAT_ENTRY *n, UINT protocol, UINT src_ip, UINT src_port, UINT dest_ip, UINT dest_port, UINT public_ip, UINT public_port) -{ - // Validate arguments - if (n == NULL) - { - return; - } - - n->Protocol = protocol; - n->SrcIp = src_ip; - n->SrcPort = src_port; - n->DestIp = dest_ip; - n->DestPort = dest_port; - n->PublicIp = public_ip; - n->PublicPort = public_port; -} - -// Initialize the NAT -void InitNat(VH *v) -{ - // Validate arguments - if (v == NULL) - { - return; - } - - // Create a NAT table - v->NatTable = NewList(CompareNat); - - // Create a socket event - v->SockEvent = NewSockEvent(); - - // Create the NAT thread - v->HaltNat = false; - v->NatThread = NewThread(NatThread, (void *)v); - WaitThreadInit(v->NatThread); - - if (IsEthSupported()) - { - // Start a native NAT if access to the layer 2 Ethernet is supported - v->NativeNat = NewNativeNat(v); - } -} - -// Release the NAT -void FreeNat(VH *v) -{ - // Validate arguments - if (v == NULL) - { - return; - } - - // Stop the native NAT - if (v->NativeNat != NULL) - { - FreeNativeNat(v->NativeNat); - v->NativeNat = NULL; - } - - // Stop the NAT thread - v->HaltNat = true; - SetSockEvent(v->SockEvent); - WaitThread(v->NatThread, INFINITE); - ReleaseThread(v->NatThread); - v->NatThread = NULL; - ReleaseSockEvent(v->SockEvent); - v->SockEvent = NULL; - - // Release the NAT table - ReleaseList(v->NatTable); -} - -// Search the NAT table -NAT_ENTRY *SearchNat(VH *v, NAT_ENTRY *target) -{ - NAT_ENTRY *n; - // Validate arguments - if (v == NULL || target == NULL) - { - return NULL; - } - - // Binary search - n = (NAT_ENTRY *)Search(v->NatTable, target); - - return n; -} - -// Delete the UDP NAT entry -void DeleteNatUdp(VH *v, NAT_ENTRY *n) -{ - BLOCK *block; - // Validate arguments - if (v == NULL || n == NULL) - { - return; - } - - NLog(v, "LH_NAT_UDP_DELETED", n->Id); - - // Release all queues - while (block = GetNext(n->UdpRecvQueue)) - { - FreeBlock(block); - } - ReleaseQueue(n->UdpRecvQueue); - while (block = GetNext(n->UdpSendQueue)) - { - FreeBlock(block); - } - ReleaseQueue(n->UdpSendQueue); - - // Release the socket - if (n->Sock != NULL) - { - Disconnect(n->Sock); - ReleaseSock(n->Sock); - n->Sock = NULL; - } - - DeleteLock(n->lock); - - // Remove from the table - Delete(v->NatTable, n); - - // Release the memory - Free(n); - - Debug("NAT: DeleteNatUdp\n"); - -} - -// Delete the ICMP NAT entry -void DeleteNatIcmp(VH *v, NAT_ENTRY *n) -{ - BLOCK *block; - // Validate arguments - if (v == NULL || n == NULL) - { - return; - } - - //NLog(v, "LH_NAT_ICMP_DELETED", n->Id); - - // Release all queues - while (block = GetNext(n->UdpRecvQueue)) - { - FreeBlock(block); - } - ReleaseQueue(n->UdpRecvQueue); - while (block = GetNext(n->UdpSendQueue)) - { - FreeBlock(block); - } - ReleaseQueue(n->UdpSendQueue); - - if (n->IcmpQueryBlock != NULL) - { - FreeBlock(n->IcmpQueryBlock); - } - - if (n->IcmpResponseBlock != NULL) - { - FreeBlock(n->IcmpResponseBlock); - } - - if (n->IcmpOriginalCopy != NULL) - { - Free(n->IcmpOriginalCopy); - } - - // Release the socket - if (n->Sock != NULL) - { - Disconnect(n->Sock); - ReleaseSock(n->Sock); - n->Sock = NULL; - } - - DeleteLock(n->lock); - - // Remove from the table - Delete(v->NatTable, n); - - // Release the memory - Free(n); - - Debug("NAT: DeleteNatIcmp\n"); - -} - -// Create a NAT ICMP entry -NAT_ENTRY *CreateNatIcmp(VH *v, UINT src_ip, UINT src_port, UINT dest_ip, UINT dest_port, UCHAR *original_copy, UINT original_copy_size) -{ - NAT_ENTRY *n; - HUB_OPTION *o; - // Validate arguments - if (v == NULL || original_copy == NULL || original_copy_size == 0) - { - return NULL; - } - - if (CanCreateNewNatEntry(v) == false) - { - return NULL; - } - - o = NatGetHubOption(v); - if (o != NULL && o->SecureNAT_MaxIcmpSessionsPerIp != 0) - { - if (GetNumNatEntriesPerIp(v, src_ip, NAT_ICMP, false) >= o->SecureNAT_MaxIcmpSessionsPerIp) - { - NAT_ENTRY *oldest = GetOldestNatEntryOfIp(v, src_ip, NAT_ICMP); - - if (oldest != NULL) - { - DisconnectNatEntryNow(v, oldest); - } - } - } - - n = ZeroMalloc(sizeof(NAT_ENTRY)); - n->Id = Inc(v->Counter); - n->v = v; - n->lock = NewLock(); - n->Protocol = NAT_ICMP; - n->SrcIp = src_ip; - n->SrcPort = src_port; - n->DestIp = dest_ip; - n->DestPort = dest_port; - - n->CreatedTime = n->LastCommTime = v->Now; - - n->UdpSendQueue = NewQueue(); - n->UdpRecvQueue = NewQueue(); - - n->UdpSocketCreated = false; - - n->IcmpOriginalCopy = Clone(original_copy, original_copy_size); - n->IcmpOriginalCopySize = original_copy_size; - - SetSockEvent(v->SockEvent); - -#if 1 - { - IP ip1, ip2; - char s1[MAX_SIZE], s2[MAX_SIZE]; - UINTToIP(&ip1, src_ip); - UINTToIP(&ip2, dest_ip); - IPToStr(s1, 0, &ip1); - IPToStr(s2, 0, &ip2); - Debug("NAT_ENTRY: CreateNatIcmp %s %u -> %s %u\n", s1, src_port, s2, dest_port); - - //NLog(v, "LH_NAT_ICMP_CREATED", n->Id, s1, s2, src_port); - } -#endif - - Add(v->NatTable, n); - - return n; -} - -// Create a NAT UDP entry -NAT_ENTRY *CreateNatUdp(VH *v, UINT src_ip, UINT src_port, UINT dest_ip, UINT dest_port, UINT dns_proxy_ip) -{ - NAT_ENTRY *n; - HUB_OPTION *o; - // Validate arguments - if (v == NULL) - { - return NULL; - } - - if (CanCreateNewNatEntry(v) == false) - { - return NULL; - } - - o = NatGetHubOption(v); - if (o != NULL && o->SecureNAT_MaxTcpSessionsPerIp != 0) - { - if (GetNumNatEntriesPerIp(v, src_ip, NAT_UDP, false) >= o->SecureNAT_MaxUdpSessionsPerIp) - { - NAT_ENTRY *oldest = GetOldestNatEntryOfIp(v, src_ip, NAT_UDP); - - if (oldest != NULL) - { - DisconnectNatEntryNow(v, oldest); - } - } - } - - n = ZeroMalloc(sizeof(NAT_ENTRY)); - n->Id = Inc(v->Counter); - n->v = v; - n->lock = NewLock(); - n->Protocol = NAT_UDP; - n->SrcIp = src_ip; - n->SrcPort = src_port; - n->DestIp = dest_ip; - n->DestPort = dest_port; - - if (dns_proxy_ip != 0) - { - n->ProxyDns = true; - n->DestIpProxy = dns_proxy_ip; - } - - n->CreatedTime = n->LastCommTime = v->Now; - - n->UdpSendQueue = NewQueue(); - n->UdpRecvQueue = NewQueue(); - - n->UdpSocketCreated = false; - - SetSockEvent(v->SockEvent); - -#if 1 - { - IP ip1, ip2; - char s1[MAX_SIZE], s2[MAX_SIZE]; - UINTToIP(&ip1, src_ip); - UINTToIP(&ip2, dest_ip); - IPToStr(s1, 0, &ip1); - IPToStr(s2, 0, &ip2); - Debug("NAT_ENTRY: CreateNatUdp %s %u -> %s %u\n", s1, src_port, s2, dest_port); - - NLog(v, "LH_NAT_UDP_CREATED", n->Id, s1, src_port, s2, dest_port); - } -#endif - - Add(v->NatTable, n); - - return n; -} - -// Ignore for NetBIOS name registration packet -bool IsNetbiosRegistrationPacket(UCHAR *buf, UINT size) -{ - // Validate arguments - if (buf == NULL || size == 0) - { - return false; - } - - if (size >= 4) - { - USHORT us = *((USHORT *)(buf + 2)); - - us = Endian16(us); - - if (((us & 0x7800) >> 11) == 5) - { - return true; - } - } - - return false; -} - -// Generate the encoded NetBIOS name -void EncodeNetBiosName(UCHAR *dst, char *src) -{ - char tmp[17]; - UINT i; - UINT copy_len; - UINT wp; - // Validate arguments - if (dst == NULL || src == NULL) - { - return; - } - - for (i = 0; i < 16; i++) - { - tmp[i] = ' '; - } - tmp[16] = 0; - - copy_len = StrLen(src); - if (copy_len > 16) - { - copy_len = 16; - } - - Copy(tmp, src, copy_len); - - wp = 0; - - tmp[15] = 0; - - for (i = 0; i < 16; i++) - { - char c = tmp[i]; - char *s = CharToNetBiosStr(c); - - dst[wp++] = s[0]; - dst[wp++] = s[1]; - } -} - -// Convert the string to NetBIOS characters -char *CharToNetBiosStr(char c) -{ - c = ToUpper(c); - - switch (c) - { - case '\0': - return "AA"; - case 'A': - return "EB"; - case 'B': - return "EC"; - case 'C': - return "ED"; - case 'D': - return "EE"; - case 'E': - return "EF"; - case 'F': - return "EG"; - case 'G': - return "EH"; - case 'H': - return "EI"; - case 'I': - return "EJ"; - case 'J': - return "EK"; - case 'K': - return "EL"; - case 'L': - return "EM"; - case 'M': - return "EN"; - case 'N': - return "EO"; - case 'O': - return "EP"; - case 'P': - return "FA"; - case 'Q': - return "FB"; - case 'R': - return "FC"; - case 'S': - return "FD"; - case 'T': - return "FE"; - case 'U': - return "FF"; - case 'V': - return "FG"; - case 'W': - return "FH"; - case 'X': - return "FI"; - case 'Y': - return "FJ"; - case 'Z': - return "FK"; - case '0': - return "DA"; - case '1': - return "DB"; - case '2': - return "DC"; - case '3': - return "DD"; - case '4': - return "DE"; - case '5': - return "DF"; - case '6': - return "DG"; - case '7': - return "DH"; - case '8': - return "DI"; - case '9': - return "DJ"; - case ' ': - return "CA"; - case '!': - return "CB"; - case '\"': - return "CC"; - case '#': - return "CD"; - case '$': - return "CE"; - case '%': - return "CF"; - case '&': - return "CG"; - case '\'': - return "CH"; - case '(': - return "CI"; - case ')': - return "CJ"; - case '*': - return "CK"; - case '+': - return "CL"; - case ',': - return "CM"; - case '-': - return "CN"; - case '.': - return "CO"; - case '=': - return "DN"; - case ':': - return "DK"; - case ';': - return "DL"; - case '@': - return "EA"; - case '^': - return "FO"; - case '_': - return "FP"; - case '{': - return "HL"; - case '}': - return "HN"; - case '~': - return "HO"; - } - - return "CA"; -} - -// Process if a NetBIOS name resolution packet for the my host name -bool ProcessNetBiosNameQueryPacketForMyself(VH *v, UINT src_ip, UINT src_port, UINT dest_ip, UINT dest_port, void *data, UINT size) -{ - BUF *rb; - USHORT tran_id; - USHORT flags; - USHORT num_query; - USHORT zero1, zero2, zero3; - UCHAR name_size; - UCHAR encoded_name[32]; - UCHAR node_type; - USHORT type, classid; - UCHAR my_pc_encoded_name[32]; - bool ret = false; - // Validate arguments - if (v == NULL || data == NULL) - { - return false; - } - - rb = NewBufFromMemory(data, size); - - ReadBuf(rb, &tran_id, sizeof(USHORT)); - - ReadBuf(rb, &flags, sizeof(USHORT)); - flags = Endian16(flags); - - ReadBuf(rb, &num_query, sizeof(USHORT)); - num_query = Endian16(num_query); - - ReadBuf(rb, &zero1, sizeof(USHORT)); - ReadBuf(rb, &zero2, sizeof(USHORT)); - ReadBuf(rb, &zero3, sizeof(USHORT)); - - ReadBuf(rb, &name_size, 1); - - ReadBuf(rb, encoded_name, 32); - - ReadBuf(rb, &node_type, 1); - - ReadBuf(rb, &type, sizeof(USHORT)); - type = Endian16(type); - - if (ReadBuf(rb, &classid, sizeof(USHORT)) == sizeof(USHORT)) - { - classid = Endian16(classid); - - if (((flags >> 11) & 0x0F) == 0 && - num_query == 1 && name_size == 0x20 && - zero1 == 0 && zero2 == 0 && zero3 == 0 && node_type == 0 && type == 0x0020 && classid == 0x0001) - { - char my_pcname[MAX_SIZE]; - - // Get the encoded name of this PC - Zero(my_pcname, sizeof(my_pcname)); - GetMachineHostName(my_pcname, sizeof(my_pcname)); - - EncodeNetBiosName(my_pc_encoded_name, my_pcname); - - if (Cmp(my_pc_encoded_name, encoded_name, 30) == 0) - { - // Assemble the response packet since the name resolution packet which targets this PC name received - BUF *sb = NewBuf(); - USHORT us; - UINT ui; - LIST *ip_list; - BUF *ip_list_buf; - bool found = false; - - WriteBuf(sb, &tran_id, sizeof(USHORT)); - - flags = Endian16(0x8500); - WriteBuf(sb, &flags, sizeof(USHORT)); - - num_query = 0; - WriteBuf(sb, &num_query, sizeof(USHORT)); - - us = Endian16(1); - WriteBuf(sb, &us, sizeof(USHORT)); - - us = 0; - WriteBuf(sb, &us, sizeof(USHORT)); - WriteBuf(sb, &us, sizeof(USHORT)); - - name_size = 0x20; - WriteBuf(sb, &name_size, 1); - - WriteBuf(sb, encoded_name, 32); - - node_type = 0; - WriteBuf(sb, &node_type, 1); - - type = Endian16(type); - classid = Endian16(classid); - - WriteBuf(sb, &type, sizeof(USHORT)); - WriteBuf(sb, &classid, sizeof(USHORT)); - - ui = Endian32((UINT)(Tick64() / 1000ULL)); - WriteBuf(sb, &ui, sizeof(UINT)); - - ip_list_buf = NewBuf(); - - ip_list = GetHostIPAddressList(); - if (ip_list != NULL) - { - UINT i; - - // Return only private IP if there is a private IP - for (i = 0; i < LIST_NUM(ip_list); i++) - { - IP *ip = LIST_DATA(ip_list, i); - - if (IsIP4(ip) && IsLocalHostIP4(ip) == false && IsZeroIp(ip) == false) - { - if (IsIPPrivate(ip)) - { - USHORT flags = Endian16(0x4000); - UINT ip_uint = IPToUINT(ip); - - WriteBuf(ip_list_buf, &flags, sizeof(USHORT)); - WriteBuf(ip_list_buf, &ip_uint, sizeof(UINT)); - - found = true; - } - } - } - - if (found == false) - { - // Return all IP if no private IP are found - for (i = 0; i < LIST_NUM(ip_list); i++) - { - IP *ip = LIST_DATA(ip_list, i); - - if (IsIP4(ip) && IsLocalHostIP4(ip) == false && IsZeroIp(ip) == false) - { - USHORT flags = Endian16(0x4000); - UINT ip_uint = IPToUINT(ip); - - WriteBuf(ip_list_buf, &flags, sizeof(USHORT)); - WriteBuf(ip_list_buf, &ip_uint, sizeof(UINT)); - - found = true; - } - } - } - - FreeHostIPAddressList(ip_list); - } - - us = Endian16(ip_list_buf->Size); - WriteBuf(sb, &us, sizeof(USHORT)); - - WriteBufBuf(sb, ip_list_buf); - - SendUdp(v, src_ip, src_port, v->HostIP, dest_port, sb->Buf, sb->Size); - - FreeBuf(ip_list_buf); - - FreeBuf(sb); - - WHERE; - } - } - } - - FreeBuf(rb); - - return ret; -} - -// Process the NetBIOS broadcast packet -void UdpRecvForNetBiosBroadcast(VH *v, UINT src_ip, UINT src_port, UINT dest_ip, UINT dest_port, void *data, UINT size, bool dns_proxy, bool unicast) -{ - // Validate arguments - if (data == NULL || v == NULL) - { - return; - } - - // Ignore for NetBIOS name registration packet - if (IsNetbiosRegistrationPacket(data, size) == false) - { - if (unicast == false) - { - dest_ip = 0xFFFFFFFF; - } - - if (ProcessNetBiosNameQueryPacketForMyself(v, src_ip, src_port, dest_ip, dest_port, data, size) == false) - { - UdpRecvForInternet(v, src_ip, src_port, dest_ip, dest_port, data, size, false); - } - } -} - -// Process the UDP packet to the Internet -void UdpRecvForInternet(VH *v, UINT src_ip, UINT src_port, UINT dest_ip, UINT dest_port, void *data, UINT size, bool dns_proxy) -{ - NAT_ENTRY *n, t; - BLOCK *block; - void *buf; - UINT dns_ip = 0; - // Validate arguments - if (data == NULL || v == NULL) - { - return; - } - - if (dns_proxy) - { - // Get the DNS server of the proxy to connect to - IP ip; - char tmp[MAX_SIZE]; - if (GetDefaultDns(&ip) == false) - { - // Failure - Debug("Failed to GetDefaultDns()\n"); - return; - } - dns_ip = IPToUINT(&ip); - IPToStr(tmp, sizeof(tmp), &ip); - Debug("Redirect to DNS Server %s\n", tmp); - } - - // Examine whether the NAT entry for this packet has already been created - SetNat(&t, NAT_UDP, src_ip, src_port, dest_ip, dest_port, 0, 0); - n = SearchNat(v, &t); - - if (n == NULL) - { - // Create a NAT entry because it is the first packet - n = CreateNatUdp(v, src_ip, src_port, dest_ip, dest_port, dns_proxy ? dns_ip : 0); - if (n == NULL) - { - // Entry creation failed - return; - } - - if (dns_proxy) - { - n->ProxyDns = true; - n->DestIpProxy = dns_ip; - } - } - - // Set the event by inserting the packet into the queue - buf = Malloc(size); - Copy(buf, data, size); - block = NewBlock(buf, size, 0); - InsertQueue(n->UdpSendQueue, block); - - SetSockEvent(v->SockEvent); -} - -// Attempt to interpret the DNS packet -bool ParseDnsPacket(VH *v, UINT src_ip, UINT src_port, UINT dest_ip, UINT dest_port, void *data, UINT size) -{ - return ParseDnsPacketEx(v, src_ip, src_port, dest_ip, dest_port, data, size, NULL); -} -bool ParseDnsPacketEx(VH *v, UINT src_ip, UINT src_port, UINT dest_ip, UINT dest_port, void *data, UINT size, DNS_PARSED_PACKET *parsed_result) -{ - DNSV4_HEADER *dns; - NAT_ENTRY *nat; - UINT transaction_id; - void *query_data; - UINT query_data_size; - char hostname[256]; - // Validate arguments - if (v == NULL || data == NULL || size == 0) - { - return false; - } - - // Check the header size - if (size < sizeof(DNSV4_HEADER)) - { - // Undersize - return false; - } - - // DNS header acquisition - dns = (DNSV4_HEADER *)data; - transaction_id = Endian16(dns->TransactionId); - if ((dns->Flag1 & 78) != 0 || (dns->Flag1 & 0x80) != 0) - { - // Illegal opcode - return false; - } - if (Endian16(dns->NumQuery) != 1) - { - // Number of queries is invalid - return false; - } - - query_data = ((UCHAR *)dns) + sizeof(DNSV4_HEADER); - query_data_size = size - sizeof(DNSV4_HEADER); - - // Interpret the query - if (ParseDnsQuery(hostname, sizeof(hostname), query_data, query_data_size) == false) - { - // Interpretation fails - return false; - } - - if (parsed_result != NULL) - { - // Only analyse without processing - Zero(parsed_result, sizeof(DNS_PARSED_PACKET)); - StrCpy(parsed_result->Hostname, sizeof(parsed_result->Hostname), hostname); - parsed_result->TransactionId = transaction_id; - - return true; - } - - // Create a DNS entry - nat = CreateNatDns(v, src_ip, src_port, dest_ip, dest_port, transaction_id, - false, hostname); - - if (nat == false) - { - return false; - } - - return true; -} - -// Send the NAT DNS response packet -void SendNatDnsResponse(VH *v, NAT_ENTRY *n) -{ - BUF *b; - UINT dns_header_size; - DNSV4_HEADER *dns; - UINT src_ip; - // Validate arguments - if (n == NULL || v == NULL) - { - return; - } - - // Generate the data - b = NewBuf(); - - // Add a Query - if (n->DnsGetIpFromHost == false) - { - BuildDnsQueryPacket(b, n->DnsTargetHostName, false); - } - else - { - BuildDnsQueryPacket(b, n->DnsTargetHostName, true); - } - - // Add a Response - if (n->DnsOk) - { - if (n->DnsGetIpFromHost == false) - { - BuildDnsResponsePacketA(b, &n->DnsResponseIp); - } - else - { - BuildDnsResponsePacketPtr(b, n->DnsResponseHostName); - } - } - - // Generate a DNS header - dns_header_size = sizeof(DNSV4_HEADER) + b->Size; - - dns = ZeroMalloc(dns_header_size); - dns->TransactionId = Endian16((USHORT)n->DnsTransactionId); - - // Generate a response flag - if (n->DnsOk) - { - dns->Flag1 = 0x85; - dns->Flag2 = 0x80; - } - else - { - dns->Flag1 = 0x85; - dns->Flag2 = 0x83; - } - - dns->NumQuery = Endian16(1); - dns->AnswerRRs = Endian16(n->DnsOk != false ? 1 : 0); - dns->AuthorityRRs = 0; - dns->AdditionalRRs = 0; - - // Settings, such as the source IP address - src_ip = n->DestIp; - if (src_ip == Endian32(SPECIAL_IPV4_ADDR_LLMNR_DEST) && n->DestPort == SPECIAL_UDP_PORT_LLMNR) - { - // Make a unicast response in the case of LLMNR packet - src_ip = v->HostIP; - - dns->Flag1 = 0x84; - dns->Flag2 = 0x00; - } - - // Copy data - Copy(((UCHAR *)dns) + sizeof(DNSV4_HEADER), b->Buf, b->Size); - - // Send this packet - SendUdp(v, n->SrcIp, n->SrcPort, src_ip, n->DestPort, dns, dns_header_size); - - // Release the memory - Free(dns); - FreeBuf(b); -} - -// Generate a DNS response packet (host name) -void BuildDnsResponsePacketPtr(BUF *b, char *hostname) -{ - USHORT magic; - USHORT type, clas; - UINT ttl; - USHORT len; - BUF *c; - // Validate arguments - if (b == NULL || hostname == NULL) - { - return; - } - - magic = Endian16(0xc00c); - type = Endian16(0x000c); - clas = Endian16(0x0001); - ttl = Endian32(NAT_DNS_RESPONSE_TTL); - - c = BuildDnsHostName(hostname); - if (c == NULL) - { - return; - } - len = Endian16((USHORT)c->Size); - - WriteBuf(b, &magic, 2); - WriteBuf(b, &type, 2); - WriteBuf(b, &clas, 2); - WriteBuf(b, &ttl, 4); - WriteBuf(b, &len, 2); - WriteBuf(b, c->Buf, c->Size); - FreeBuf(c); -} - -// Generate a DNS response packet (host IP address) -void BuildDnsResponsePacketA(BUF *b, IP *ip) -{ - UINT ip_addr; - USHORT magic; - USHORT type, clas; - UINT ttl; - USHORT len; - // Validate arguments - if (b == NULL || ip == NULL) - { - return; - } - - ip_addr = IPToUINT(ip); - magic = Endian16(0xc00c); - type = Endian16(0x0001); - clas = Endian16(0x0001); - ttl = Endian32(NAT_DNS_RESPONSE_TTL); - len = Endian16((USHORT)sizeof(ttl)); - - WriteBuf(b, &magic, sizeof(magic)); - WriteBuf(b, &type, sizeof(type)); - WriteBuf(b, &clas, sizeof(clas)); - WriteBuf(b, &ttl, sizeof(ttl)); - WriteBuf(b, &len, sizeof(len)); - WriteBuf(b, &ip_addr, sizeof(ip_addr)); -} - -// Generate a DNS query data packet -void BuildDnsQueryPacket(BUF *b, char *hostname, bool ptr) -{ - USHORT val; - BUF *c; - // Validate arguments - if (b == NULL || hostname == NULL) - { - return; - } - - // Convert the host name to a buffer - c = BuildDnsHostName(hostname); - if (c == NULL) - { - return; - } - - WriteBuf(b, c->Buf, c->Size); - FreeBuf(c); - - // Type and class - if (ptr == false) - { - val = Endian16(0x0001); - } - else - { - val = Endian16(0x000c); - } - WriteBuf(b, &val, 2); - - val = Endian16(0x0001); - WriteBuf(b, &val, 2); -} - -// Generate a DNS host name buffer -BUF *BuildDnsHostName(char *hostname) -{ - UINT i; - UCHAR size; - TOKEN_LIST *token; - BUF *b; - // Validate arguments - if (hostname == NULL) - { - return NULL; - } - - // Split the host name into tokens - token = ParseToken(hostname, "."); - if (token == NULL) - { - return NULL; - } - - b = NewBuf(); - - // Add a host string - for (i = 0; i < token->NumTokens; i++) - { - size = (UCHAR)StrLen(token->Token[i]); - WriteBuf(b, &size, 1); - WriteBuf(b, token->Token[i], size); - } - - // NULL character - size = 0; - WriteBuf(b, &size, 1); - - SeekBuf(b, 0, 0); - - FreeToken(token); - - return b; -} - -// Process the NAT DNS entry -void PollingNatDns(VH *v, NAT_ENTRY *n) -{ - // Validate arguments - if (v == NULL || n == NULL) - { - return; - } - - if (n->DnsFinished) - { - if (n->DnsPollingFlag == false) - { - n->DnsPollingFlag = true; - // Process has been completed - SendNatDnsResponse(v, n); - - // Terminating - n->DisconnectNow = true; - } - } -} - -// Create a NAT DNS entry -NAT_ENTRY *CreateNatDns(VH *v, UINT src_ip, UINT src_port, UINT dest_ip, UINT dest_port, - UINT transaction_id, bool dns_get_ip_from_host, char *dns_target_host_name) -{ - NAT_ENTRY *n; - HUB_OPTION *o; - // Validate arguments - if (v == NULL || dns_target_host_name == NULL) - { - return NULL; - } - - if (CanCreateNewNatEntry(v) == false) - { - return NULL; - } - - o = NatGetHubOption(v); - if (o != NULL && o->SecureNAT_MaxDnsSessionsPerIp != 0) - { - if (GetNumNatEntriesPerIp(v, src_ip, NAT_DNS, false) >= o->SecureNAT_MaxDnsSessionsPerIp) - { - NAT_ENTRY *oldest = GetOldestNatEntryOfIp(v, src_ip, NAT_DNS); - - if (oldest != NULL) - { - DisconnectNatEntryNow(v, oldest); - } - } - } - - n = ZeroMalloc(sizeof(NAT_ENTRY)); - n->Id = Inc(v->Counter); - n->v = v; - n->lock = NewLock(); - n->Protocol = NAT_DNS; - n->SrcIp = src_ip; - n->SrcPort = src_port; - n->DestIp = dest_ip; - n->DestPort = dest_port; - n->DnsTransactionId = transaction_id; - n->CreatedTime = n->LastCommTime = v->Now; - n->DisconnectNow = false; - - n->DnsGetIpFromHost = false; - n->DnsTargetHostName = CopyStr(dns_target_host_name); - - Add(v->NatTable, n); - -#if 1 - { - IP ip1, ip2; - char s1[MAX_SIZE], s2[MAX_SIZE]; - UINTToIP(&ip1, src_ip); - UINTToIP(&ip2, dest_ip); - IPToStr(s1, 0, &ip1); - IPToStr(s2, 0, &ip2); - Debug("NAT_ENTRY: CreateNatDns %s %u -> %s %u\n", s1, src_port, s2, dest_port); - } -#endif - - - return n; -} - -// Set the VGS host name -void SetDnsProxyVgsHostname(char *hostname) -{ - // Validate arguments - if (hostname == NULL) - { - return; - } - - StrCpy(v_vgs_hostname, sizeof(v_vgs_hostname), hostname); -} - -// Operate as a DNS proxy -void DnsProxy(VH *v, UINT src_ip, UINT src_port, UINT dest_ip, UINT dest_port, void *data, UINT size) -{ - // Validate arguments - if (v == NULL || data == NULL || size == 0) - { - return; - } - - if (dest_port == SPECIAL_UDP_PORT_LLMNR) - { - // Process by analyzing the DNS query in the case of LLMNR - ParseDnsPacket(v, src_ip, src_port, dest_ip, dest_port, data, size); - } - else - { - // Forward the packet as it is in the case of a normal DNS packet - if (IsEmptyStr(v_vgs_hostname) == false) - { - // Response by proxy in the case of trying to get the IP of the VGS - DNS_PARSED_PACKET p; - - Zero(&p, sizeof(p)); - if (ParseDnsPacketEx(v, src_ip, src_port, dest_ip, dest_port, data, size, &p)) - { - if (StrCmpi(p.Hostname, "254.254.211.10.in-addr.arpa") == 0) - { - NAT_ENTRY n; - - Zero(&n, sizeof(n)); - n.DnsTargetHostName = p.Hostname; - n.DnsGetIpFromHost = true; - n.DnsResponseHostName = v_vgs_hostname; - n.DnsTransactionId = p.TransactionId; - n.DnsOk = true; - n.DestIp = dest_ip; - n.SrcIp = src_ip; - n.DestPort = dest_port; - n.SrcPort = src_port; - - SendNatDnsResponse(v, &n); - return; - } - } - } - - UdpRecvForInternet(v, src_ip, src_port, dest_ip, dest_port, data, size, true); - } -} - -// Process the LLMNR query -void UdpRecvLlmnr(VH *v, UINT src_ip, UINT src_port, UINT dest_ip, UINT dest_port, void *data, UINT size) -{ - // Validate arguments - if (data == NULL || v == NULL) - { - return; - } - - if (dest_port == SPECIAL_UDP_PORT_LLMNR) - { - // DNS proxy start - DnsProxy(v, src_ip, src_port, dest_ip, dest_port, data, size); - } -} - -// Process the UDP packet to the virtual host -void UdpRecvForMe(VH *v, UINT src_ip, UINT src_port, UINT dest_ip, UINT dest_port, void *data, UINT size) -{ - // Validate arguments - if (data == NULL || v == NULL) - { - return; - } - - if (dest_port == NAT_DNS_PROXY_PORT) - { - // DNS proxy start - DnsProxy(v, src_ip, src_port, dest_ip, dest_port, data, size); - } -} - -// Process the UDP broadcast packet -void UdpRecvForBroadcast(VH *v, UINT src_ip, UINT src_port, UINT dest_ip, UINT dest_port, void *data, UINT size) -{ - // Validate arguments - if (data == NULL || v == NULL) - { - return; - } -} - -// An UDP packet has been received -void VirtualUdpReceived(VH *v, UINT src_ip, UINT dest_ip, void *data, UINT size, bool mac_broadcast, bool is_localmac, UINT max_l3_size) -{ - UDP_HEADER *udp; - UINT packet_length; - void *buf; - UINT buf_size; - UINT src_port, dest_port; - // Validate arguments - if (v == NULL || data == NULL) - { - return; - } - - // Check the header - udp = (UDP_HEADER *)data; - if (size < UDP_HEADER_SIZE) - { - return; - } - packet_length = Endian16(udp->PacketLength); - if (packet_length != size) - { - return; - } - buf = ((UCHAR *)data) + UDP_HEADER_SIZE; - buf_size = size - UDP_HEADER_SIZE; - src_port = Endian16(udp->SrcPort); - dest_port = Endian16(udp->DstPort); - // Check the port number - if (dest_port == 0) - { - // Port number is invalid - return; - } - - // Determine whether it's broadcast packet or packet addressed to myself - if (dest_ip == v->HostIP) - { - // IP packet addressed to myself has arrived - UdpRecvForMe(v, src_ip, src_port, dest_ip, dest_port, buf, buf_size); - } - else if ((mac_broadcast || dest_ip == Endian32(0xE00000FC)) && dest_port == SPECIAL_UDP_PORT_LLMNR) - { - if (is_localmac == false) - { - // Packet addressed to 224.0.0.252 (LLMNR) arrives - UdpRecvLlmnr(v, src_ip, src_port, dest_ip, dest_port, buf, buf_size); - } - } - else if (mac_broadcast && (dest_port == SPECIAL_UDP_PORT_WSD || dest_port == SPECIAL_UDP_PORT_SSDP)) - { - if (is_localmac == false) - { - // WS-Discovery packet arrives - UdpRecvForInternet(v, src_ip, src_port, 0xFFFFFFFF, dest_port, buf, buf_size, false); - } - } - else if (mac_broadcast && (dest_port == SPECIAL_UDP_PORT_NBTDGM || dest_port == SPECIAL_UDP_PORT_NBTNS)) - { - if (is_localmac == false) - { - // NetBIOS Broadcast packet arrived - UdpRecvForNetBiosBroadcast(v, src_ip, src_port, dest_ip, dest_port, buf, buf_size, false, false); - } - } - else if (mac_broadcast || dest_ip == 0xffffffff || dest_ip == GetBroadcastAddress(v->HostIP, v->HostMask)) - { - if (is_localmac == false) - { - // Broadcast packet arrived - UdpRecvForBroadcast(v, src_ip, src_port, dest_ip, dest_port, buf, buf_size); - } - } - else if (IsInNetwork(dest_ip, v->HostIP, v->HostMask) == false) - { - // Packets to other than local address (that is on the Internet) has been received - if (NnIsActive(v) == false) - { - if (v->HubOption != NULL && v->HubOption->DisableUserModeSecureNAT) - { - // User-mode NAT is disabled - return; - } - - // User-mode NAT - UdpRecvForInternet(v, src_ip, src_port, dest_ip, dest_port, buf, buf_size, false); - } - else - { - // Kernel-mode NAT - NnUdpRecvForInternet(v, src_ip, src_port, dest_ip, dest_port, buf, buf_size, max_l3_size); - } - } - else - { - // Local address has arrived. Ignore it - } -} - -// Determine the network address of the subnet to which the specified IP address belongs -UINT GetNetworkAddress(UINT addr, UINT mask) -{ - return (addr & mask); -} - -// Determine the broadcast address of the subnet to which the specified IP address belongs -UINT GetBroadcastAddress(UINT addr, UINT mask) -{ - return ((addr & mask) | (~mask)); -} -void GetBroadcastAddress4(IP *dst, IP *addr, IP *mask) -{ - // Validate arguments - if (dst == NULL || IsIP4(addr) == false || IsIP4(mask) == false) - { - Zero(dst, sizeof(IP)); - return; - } - - UINTToIP(dst, GetBroadcastAddress(IPToUINT(addr), IPToUINT(mask))); -} - -// Determine whether the specified IP address belongs to the sub-network that is -// represented by a another specified network address and a subnet mask -bool IsInNetwork(UINT uni_addr, UINT network_addr, UINT mask) -{ - if (GetNetworkAddress(uni_addr, mask) == GetNetworkAddress(network_addr, mask)) - { - return true; - } - return false; -} - -// Send an UDP packet -void SendUdp(VH *v, UINT dest_ip, UINT dest_port, UINT src_ip, UINT src_port, void *data, UINT size) -{ - UDPV4_PSEUDO_HEADER *vh; - UDP_HEADER *udp; - UINT udp_packet_length = UDP_HEADER_SIZE + size; - USHORT checksum; - // Validate arguments - if (v == NULL || data == NULL) - { - return; - } - if (udp_packet_length > 65536) - { - return; - } - - // Generate a virtual header - vh = Malloc(sizeof(UDPV4_PSEUDO_HEADER) + size); - udp = (UDP_HEADER *)(((UCHAR *)vh) + 12); - - vh->SrcIP = src_ip; - vh->DstIP = dest_ip; - vh->Reserved = 0; - vh->Protocol = IP_PROTO_UDP; - vh->PacketLength1 = Endian16((USHORT)udp_packet_length); - udp->SrcPort = Endian16((USHORT)src_port); - udp->DstPort = Endian16((USHORT)dest_port); - udp->PacketLength = Endian16((USHORT)udp_packet_length); - udp->Checksum = 0; - - // Copy data - Copy(((UCHAR *)udp) + UDP_HEADER_SIZE, data, size); - - // Calculate the checksum - checksum = IpChecksum(vh, udp_packet_length + 12); - if (checksum == 0x0000) - { - checksum = 0xffff; - } - udp->Checksum = checksum; - - // Send a packet - SendIp(v, dest_ip, src_ip, IP_PROTO_UDP, udp, udp_packet_length); - - // Release the memory - Free(vh); -} - -// Poll the IP combining object -void PollingIpCombine(VH *v) -{ - LIST *o; - UINT i; - // Validate arguments - if (v == NULL) - { - return; - } - - // Discard the old combining object - o = NULL; - for (i = 0; i < LIST_NUM(v->IpCombine); i++) - { - IP_COMBINE *c = LIST_DATA(v->IpCombine, i); - - if (c->Expire < v->Now) - { - if (o == NULL) - { - o = NewListFast(NULL); - } - Add(o, c); - } - } - - if (o != NULL) - { - for (i = 0; i < LIST_NUM(o); i++) - { - IP_COMBINE *c = LIST_DATA(o, i); - - // Remove from the list - Delete(v->IpCombine, c); - - // Release the memory - FreeIpCombine(v, c); - } - ReleaseList(o); - } -} - -// Send an ICMP packet -void VirtualIcmpSend(VH *v, UINT src_ip, UINT dst_ip, void *data, UINT size) -{ - ICMP_HEADER *icmp; - void *data_buf; - // Validate arguments - if (v == NULL || data == NULL) - { - return; - } - - // Build the header - icmp = ZeroMalloc(sizeof(ICMP_HEADER) + size); - // Data copy - data_buf = ((UCHAR *)icmp) + sizeof(ICMP_HEADER); - Copy(data_buf, data, size); - // Other - icmp->Checksum = 0; - icmp->Code = 0; - icmp->Type = ICMP_TYPE_ECHO_RESPONSE; - // Checksum - icmp->Checksum = IpChecksum(icmp, sizeof(ICMP_HEADER) + size); - - // IP packet transmission - SendIp(v, dst_ip, src_ip, IP_PROTO_ICMPV4, icmp, sizeof(ICMP_HEADER) + size); - - // Release the memory - Free(icmp); -} - -// Send the ICMP Echo Response packet -void VirtualIcmpEchoSendResponse(VH *v, UINT src_ip, UINT dst_ip, USHORT id, USHORT seq_no, void *data, UINT size) -{ - ICMP_ECHO *e; - // Validate arguments - if (v == NULL || data == NULL) - { - return; - } - - // Build the header - e = ZeroMalloc(sizeof(ICMP_ECHO) + size); - e->Identifier = Endian16(id); - e->SeqNo = Endian16(seq_no); - - // Data copy - Copy(((UCHAR *)e) + sizeof(ICMP_ECHO), data, size); - - // Send an ICMP - VirtualIcmpSend(v, src_ip, dst_ip, e, sizeof(ICMP_ECHO) + size); - - // Release the memory - Free(e); -} - -// Treat the ICMP Echo Request packet with a Raw Socket -void VirtualIcmpEchoRequestReceivedRaw(VH *v, UINT src_ip, UINT dst_ip, void *data, UINT size, UCHAR ttl, void *icmp_data, UINT icmp_size, UCHAR *ip_header, UINT ip_header_size) -{ - ICMP_ECHO *echo; - UINT data_size; - void *data_buf; - USHORT id, seq_no; - void *buf; - BLOCK *block; - // Validate arguments - if (v == NULL || data == NULL || icmp_data == NULL || ip_header == NULL) - { - return; - } - if (ttl == 0) - { - ttl = 1; - } - - echo = (ICMP_ECHO *)data; - - // Echo size check - if (size < sizeof(ICMP_ECHO)) - { - // Insufficient data - return; - } - - id = Endian16(echo->Identifier); - seq_no = Endian16(echo->SeqNo); - - // Data size - data_size = size - sizeof(ICMP_ECHO); - - // Data body - data_buf = ((UCHAR *)data) + sizeof(ICMP_ECHO); - - if (dst_ip == v->HostIP) - { - // Respond because it is addressed to me - VirtualIcmpEchoSendResponse(v, v->HostIP, src_ip, id, seq_no, data_buf, data_size); - } - else if (IsInNetwork(dst_ip, v->HostIP, v->HostMask) == false) - { - NAT_ENTRY *n = NULL, t; - // Process by creating a NAT entry because it is addressed to the Internet - - if (ttl <= 1) - { - // Reply the Time Exceeded immediately for the packet whose TTL is 1 - UINT reply_size = sizeof(ICMP_HEADER) + 4 + ip_header_size + 8; - UCHAR *reply_data = ZeroMalloc(reply_size); - ICMP_HEADER *icmp = (ICMP_HEADER *)reply_data; - icmp->Type = ICMP_TYPE_TIME_EXCEEDED; - icmp->Code = ICMP_CODE_TTL_EXCEEDED_IN_TRANSIT; - Copy(reply_data + sizeof(ICMP_HEADER) + 4, ip_header, ip_header_size); - Copy(reply_data + sizeof(ICMP_HEADER) + 4 + ip_header_size, icmp_data, MIN(icmp_size, 8)); - - icmp->Checksum = IpChecksum(icmp, reply_size); - - SendIp(v, src_ip, v->HostIP, IP_PROTO_ICMPV4, reply_data, reply_size); - - Free(reply_data); - } - else - { - SetNat(&t, NAT_ICMP, src_ip, id, dst_ip, id, 0, 0); - - if (v->IcmpRawSocketOk) - { - // Examine whether a NAT entry for this packet has already been created - n = SearchNat(v, &t); - } - - if (n == NULL) - { - // Create a NAT entry because it is the first packet - n = CreateNatIcmp(v, src_ip, id, dst_ip, id, (UCHAR *)ip_header, ip_header_size + 8); - - if (n == NULL) - { - // Entry creation failed - return; - } - } - - // Set the event by inserting the packet into the queue - buf = Malloc(icmp_size); - Copy(buf, icmp_data, icmp_size); - block = NewBlock(buf, icmp_size, 0); - block->Ttl = MAKESURE(ttl - 1, 1, 255); - InsertQueue(n->UdpSendQueue, block); - - SetSockEvent(v->SockEvent); - } - } -} - -// Receive an ICMP Echo Request packet -void VirtualIcmpEchoRequestReceived(VH *v, UINT src_ip, UINT dst_ip, void *data, UINT size, UCHAR ttl, void *icmp_data, UINT icmp_size, UCHAR *ip_header, UINT ip_header_size, UINT max_l3_size) -{ - ICMP_ECHO *echo; - UINT data_size; - void *data_buf; - USHORT id, seq_no; - // Validate arguments - if (v == NULL || data == NULL || icmp_data == NULL) - { - return; - } - - //Debug("ICMP: %u\n", size); - - if (NnIsActive(v)) - { - // Process by the Native NAT - NnIcmpEchoRecvForInternet(v, src_ip, dst_ip, data, size, ttl, icmp_data, icmp_size, - ip_header, ip_header_size, max_l3_size); - return; - } - - if (v->HubOption != NULL && v->HubOption->DisableUserModeSecureNAT) - { - // User-mode NAT is disabled - return; - } - - if (v->IcmpRawSocketOk || v->IcmpApiOk) - { - // Process in the Raw Socket - VirtualIcmpEchoRequestReceivedRaw(v, src_ip, dst_ip, data, size, ttl, icmp_data, icmp_size, - ip_header, ip_header_size); - return; - } - - // Returns the fake ICMP forcibly if any of Native NAT or Raw Socket can not be used - - echo = (ICMP_ECHO *)data; - - // Echo size check - if (size < sizeof(ICMP_ECHO)) - { - // Insufficient data - return; - } - - id = Endian16(echo->Identifier); - seq_no = Endian16(echo->SeqNo); - - // Data size - data_size = size - sizeof(ICMP_ECHO); - - // Data body - data_buf = ((UCHAR *)data) + sizeof(ICMP_ECHO); - - // Return the ICMP Echo Response - VirtualIcmpEchoSendResponse(v, dst_ip, src_ip, id, seq_no, data_buf, data_size); -} - -// An ICMP packet has been received -void VirtualIcmpReceived(VH *v, UINT src_ip, UINT dst_ip, void *data, UINT size, UCHAR ttl, UCHAR *ip_header, UINT ip_header_size, UINT max_l3_size) -{ - ICMP_HEADER *icmp; - UINT msg_size; - USHORT checksum_calc, checksum_original; - // Validate arguments - if (v == NULL || data == NULL) - { - return; - } - - // Size check - if (size < sizeof(ICMP_HEADER)) - { - return; - } - - // ICMP header - icmp = (ICMP_HEADER *)data; - - // Get the ICMP message size - msg_size = size - sizeof(ICMP_HEADER); - - // Check the checksum of the ICMP header - checksum_original = icmp->Checksum; - icmp->Checksum = 0; - checksum_calc = IpChecksum(data, size); - icmp->Checksum = checksum_original; - - if (checksum_calc != checksum_original) - { - // Checksum is invalid - Debug("ICMP CheckSum Failed.\n"); - return; - } - - // Identified by the opcode - switch (icmp->Type) - { - case ICMP_TYPE_ECHO_REQUEST: // ICMP Echo request - VirtualIcmpEchoRequestReceived(v, src_ip, dst_ip, ((UCHAR *)data) + sizeof(ICMP_HEADER), msg_size, ttl, - icmp, size, ip_header, ip_header_size, max_l3_size); - break; - - case ICMP_TYPE_ECHO_RESPONSE: // ICMP Echo response - // Do Nothing - break; - } -} - -// Received an IP packet -void IpReceived(VH *v, UINT src_ip, UINT dest_ip, UINT protocol, void *data, UINT size, bool mac_broadcast, UCHAR ttl, UCHAR *ip_header, UINT ip_header_size, bool is_local_mac, UINT max_l3_size) -{ - // Validate arguments - if (v == NULL || data == NULL) - { - return; - } - - // Deliver the data to the supported high-level protocol - switch (protocol) - { - case IP_PROTO_ICMPV4: // ICMPv4 - if (mac_broadcast == false) - { - VirtualIcmpReceived(v, src_ip, dest_ip, data, size, ttl, ip_header, ip_header_size, max_l3_size); - } - break; - - case IP_PROTO_TCP: // TCP - if (mac_broadcast == false) - { - VirtualTcpReceived(v, src_ip, dest_ip, data, size, max_l3_size); - } - break; - - case IP_PROTO_UDP: // UDP - VirtualUdpReceived(v, src_ip, dest_ip, data, size, mac_broadcast, is_local_mac, max_l3_size); - break; - } -} - -// Combine the IP packet received to the IP combining object -void CombineIp(VH *v, IP_COMBINE *c, UINT offset, void *data, UINT size, bool last_packet, UCHAR *head_ip_header_data, UINT head_ip_header_size) -{ - UINT i; - IP_PART *p; - UINT need_size; - UINT data_size_delta; - // Validate arguments - if (c == NULL || data == NULL) - { - return; - } - - // Check the size and offset - if ((offset + size) > 65535) - { - // Do not process packet larger than 64Kbytes - return; - } - - if (last_packet == false && c->Size != 0) - { - if ((offset + size) > c->Size) - { - // Do not process the packet larger than the packet size - return; - } - } - - if (head_ip_header_data != NULL && head_ip_header_size >= sizeof(IPV4_HEADER)) - { - if (c->HeadIpHeaderData == NULL) - { - c->HeadIpHeaderData = Clone(head_ip_header_data, head_ip_header_size); - c->HeadIpHeaderDataSize = head_ip_header_size; - } - } - - need_size = offset + size; - data_size_delta = c->DataReserved; - // Ensure sufficient if the buffer is insufficient - while (c->DataReserved < need_size) - { - c->DataReserved = c->DataReserved * 4; - c->Data = ReAlloc(c->Data, c->DataReserved); - } - data_size_delta = c->DataReserved - data_size_delta; - v->CurrentIpQuota += data_size_delta; - - // Overwrite the data into the buffer - Copy(((UCHAR *)c->Data) + offset, data, size); - - if (last_packet) - { - // If No More Fragment packet arrives, the size of this datagram is finalized - c->Size = offset + size; - } - - // Check the overlap between the region which is represented by the offset and size of the - // existing received list and the region which is represented by the offset and size - for (i = 0; i < LIST_NUM(c->IpParts); i++) - { - UINT moving_size; - IP_PART *p = LIST_DATA(c->IpParts, i); - - // Check the overlapping between the existing area and head area - if ((p->Offset <= offset) && ((p->Offset + p->Size) > offset)) - { - // Compress behind the offset of this packet since a duplication is - // found in the first part with the existing packet and this packet - - if ((offset + size) <= (p->Offset + p->Size)) - { - // This packet is buried in the existing packet - size = 0; - } - else - { - // Retral region is not overlapped - moving_size = p->Offset + p->Size - offset; - offset += moving_size; - size -= moving_size; - } - } - if ((p->Offset < (offset + size)) && ((p->Offset + p->Size) >= (offset + size))) - { - // Compress the size of this packet forward because a duplication is - // found between the posterior portion the existing packet and this packet - - moving_size = p->Offset + p->Size - offset - size; - size -= moving_size; - } - - if ((p->Offset >= offset) && ((p->Offset + p->Size) <= (offset + size))) - { - // This packet was overwritten to completely cover an existing packet - p->Size = 0; - } - } - - if (size != 0) - { - // Register this packet - p = ZeroMalloc(sizeof(IP_PART)); - - p->Offset = offset; - p->Size = size; - - Add(c->IpParts, p); - } - - if (c->Size != 0) - { - // Get the total size of the data portion list already received - UINT total_size = 0; - UINT i; - - for (i = 0; i < LIST_NUM(c->IpParts); i++) - { - IP_PART *p = LIST_DATA(c->IpParts, i); - - total_size += p->Size; - } - - if (total_size == c->Size) - { - // Received all of the IP packet - IpReceived(v, c->SrcIP, c->DestIP, c->Protocol, c->Data, c->Size, c->MacBroadcast, c->Ttl, - c->HeadIpHeaderData, c->HeadIpHeaderDataSize, c->SrcIsLocalMacAddr, c->MaxL3Size); - - // Release the combining object - FreeIpCombine(v, c); - - // Remove from the combining object list - Delete(v->IpCombine, c); - } - } -} - -// Release the IP combining object -void FreeIpCombine(VH *v, IP_COMBINE *c) -{ - UINT i; - // Validate arguments - if (c == NULL) - { - return; - } - - // Release the data - v->CurrentIpQuota -= c->DataReserved; - Free(c->Data); - - // Release the partial list - for (i = 0; i < LIST_NUM(c->IpParts); i++) - { - IP_PART *p = LIST_DATA(c->IpParts, i); - - Free(p); - } - - Free(c->HeadIpHeaderData); - - ReleaseList(c->IpParts); - Free(c); -} - -// Search the IP combining list -IP_COMBINE *SearchIpCombine(VH *v, UINT src_ip, UINT dest_ip, USHORT id, UCHAR protocol) -{ - IP_COMBINE *c, t; - // Validate arguments - if (v == NULL) - { - return NULL; - } - - t.DestIP = dest_ip; - t.SrcIP = src_ip; - t.Id = id; - t.Protocol = protocol; - - c = Search(v->IpCombine, &t); - - return c; -} - -// Insert by creating a new object to the IP combining list -IP_COMBINE *InsertIpCombine(VH *v, UINT src_ip, UINT dest_ip, USHORT id, UCHAR protocol, bool mac_broadcast, UCHAR ttl, bool src_is_localmac) -{ - IP_COMBINE *c; - // Validate arguments - if (v == NULL) - { - return NULL; - } - - // Examine the quota - if ((v->CurrentIpQuota + IP_COMBINE_INITIAL_BUF_SIZE) > IP_COMBINE_WAIT_QUEUE_SIZE_QUOTA) - { - // IP packet can not be stored any more - return NULL; - } - - c = ZeroMalloc(sizeof(IP_COMBINE)); - c->SrcIsLocalMacAddr = src_is_localmac; - c->DestIP = dest_ip; - c->SrcIP = src_ip; - c->Id = id; - c->Expire = v->Now + (UINT64)IP_COMBINE_TIMEOUT; - c->Size = 0; - c->IpParts = NewList(NULL); - c->Protocol = protocol; - c->MacBroadcast = mac_broadcast; - c->Ttl = ttl; - - // Secure the memory - c->DataReserved = IP_COMBINE_INITIAL_BUF_SIZE; - c->Data = Malloc(c->DataReserved); - v->CurrentIpQuota += c->DataReserved; - - Insert(v->IpCombine, c); - - return c; -} - -// Initialize the IP combining list -void InitIpCombineList(VH *v) -{ - // Validate arguments - if (v == NULL) - { - return; - } - - v->IpCombine = NewList(CompareIpCombine); -} - -// Release the IP combining list -void FreeIpCombineList(VH *v) -{ - UINT i; - // Validate arguments - if (v == NULL) - { - return; - } - - for (i = 0; i < LIST_NUM(v->IpCombine); i++) - { - IP_COMBINE *c = LIST_DATA(v->IpCombine, i); - - FreeIpCombine(v, c); - } - - ReleaseList(v->IpCombine); -} - -// Comparison of IP combining list entry -int CompareIpCombine(void *p1, void *p2) -{ - IP_COMBINE *c1, *c2; - if (p1 == NULL || p2 == NULL) - { - return 0; - } - c1 = *(IP_COMBINE **)p1; - c2 = *(IP_COMBINE **)p2; - if (c1 == NULL || c2 == NULL) - { - return 0; - } - if (c1->Id > c2->Id) - { - return 1; - } - else if (c1->Id < c2->Id) - { - return -1; - } - else if (c1->DestIP > c2->DestIP) - { - return 1; - } - else if (c1->DestIP < c2->DestIP) - { - return -1; - } - else if (c1->SrcIP > c2->SrcIP) - { - return 1; - } - else if (c1->SrcIP < c2->SrcIP) - { - return -1; - } - else if (c1->Protocol > c2->Protocol) - { - return 1; - } - else if (c1->Protocol < c2->Protocol) - { - return -1; - } - return 0; -} - -// Received an IP packet -void VirtualIpReceived(VH *v, PKT *packet) -{ - IPV4_HEADER *ip; - void *data; - UINT data_size_recved; - UINT size; - UINT ipv4_header_size; - bool last_packet; - UCHAR *head_ip_header_data = NULL; - UINT head_ip_header_size = 0; - bool is_local_mac = false; - UINT ip_l3_size; - // Validate arguments - if (v == NULL || packet == NULL) - { - return; - } - - ip = packet->L3.IPv4Header; - - if (packet->BroadcastPacket) - { - is_local_mac = IsMacAddressLocalFast(packet->MacAddressSrc); - } - - // Get the size of the IPv4 header - ipv4_header_size = IPV4_GET_HEADER_LEN(packet->L3.IPv4Header) * 4; - head_ip_header_size = ipv4_header_size; - - // Calculate the checksum of the IPv4 header - if (IpCheckChecksum(ip) == false) - { - return; - } - - // Get a pointer to the data - data = ((UCHAR *)packet->L3.PointerL3) + ipv4_header_size; - - // Register to the ARP table - ArpIpWasKnown(v, packet->L3.IPv4Header->SrcIP, packet->MacAddressSrc); - - // Get the data size - size = ip_l3_size = Endian16(ip->TotalLength); - if (size <= ipv4_header_size) - { - // There is no data - return; - } - size -= ipv4_header_size; - - // Get the size of data actually received - data_size_recved = packet->PacketSize - (ipv4_header_size + MAC_HEADER_SIZE); - if (data_size_recved < size) - { - // Data insufficient (It may be missing on the way) - return; - } - - if (IPV4_GET_OFFSET(ip) == 0 && (IPV4_GET_FLAGS(ip) & 0x01) == 0) - { - // Because this packet has not been fragmented, it can be delivered to the upper layer immediately - head_ip_header_data = (UCHAR *)packet->L3.IPv4Header; - IpReceived(v, ip->SrcIP, ip->DstIP, ip->Protocol, data, size, packet->BroadcastPacket, ip->TimeToLive, - head_ip_header_data, head_ip_header_size, is_local_mac, ip_l3_size); - } - else - { - // This packet is necessary to combine because it is fragmented - UINT offset = IPV4_GET_OFFSET(ip) * 8; - IP_COMBINE *c = SearchIpCombine(v, ip->SrcIP, ip->DstIP, Endian16(ip->Identification), ip->Protocol); - - if (offset == 0) - { - head_ip_header_data = (UCHAR *)packet->L3.IPv4Header; - } - - last_packet = ((IPV4_GET_FLAGS(ip) & 0x01) == 0 ? true : false); - - if (c != NULL) - { - // It is the second or subsequent packet - c->MaxL3Size = MAX(c->MaxL3Size, ip_l3_size); - CombineIp(v, c, offset, data, size, last_packet, head_ip_header_data, head_ip_header_size); - } - else - { - // Create a combining object because it is the first packet - c = InsertIpCombine( - v, ip->SrcIP, ip->DstIP, Endian16(ip->Identification), ip->Protocol, packet->BroadcastPacket, - ip->TimeToLive, is_local_mac); - if (c != NULL) - { - c->MaxL3Size = ip_l3_size; - - CombineIp(v, c, offset, data, size, last_packet, head_ip_header_data, head_ip_header_size); - } - } - } -} - -// Send the waiting IP packets from the specified IP address -void SendWaitingIp(VH *v, UCHAR *mac, UINT dest_ip) -{ - UINT i; - LIST *o = NULL; - // Validate arguments - if (v == NULL || mac == NULL) - { - return; - } - - // Get a target list - for (i = 0; i < LIST_NUM(v->IpWaitTable); i++) - { - IP_WAIT *w = LIST_DATA(v->IpWaitTable, i); - - if (w->DestIP == dest_ip) - { - if (o == NULL) - { - o = NewListFast(NULL); - } - Add(o, w); - } - } - - // Send the target packets at once - if (o != NULL) - { - for (i = 0; i < LIST_NUM(o); i++) - { - IP_WAIT *w = LIST_DATA(o, i); - - // Transmission processing - VirtualIpSend(v, mac, w->Data, w->Size); - - // Remove from the list - Delete(v->IpWaitTable, w); - - // Release the memory - Free(w->Data); - Free(w); - } - - ReleaseList(o); - } -} - -// Remove the old IP waiting table entries -void DeleteOldIpWaitTable(VH *v) -{ - UINT i; - LIST *o = NULL; - // Validate arguments - if (v == NULL) - { - return; - } - - // Get the deleting list - for (i = 0; i < LIST_NUM(v->IpWaitTable); i++) - { - IP_WAIT *w = LIST_DATA(v->IpWaitTable, i); - - if (w->Expire < v->Now) - { - if (o == NULL) - { - o = NewListFast(NULL); - } - Add(o, w); - } - } - - // Delete all at once - if (o != NULL) - { - for (i = 0; i < LIST_NUM(o); i++) - { - IP_WAIT *w = LIST_DATA(o, i); - - // Remove from the list - Delete(v->IpWaitTable, w); - - // Release the memory - Free(w->Data); - Free(w); - } - ReleaseList(o); - } -} - -// Poll the IP waiting table -void PollingIpWaitTable(VH *v) -{ - // Delete the old table entries - DeleteOldIpWaitTable(v); -} - -// Insert the IP packet to the IP waiting table -void InsertIpWaitTable(VH *v, UINT dest_ip, UINT src_ip, void *data, UINT size) -{ - IP_WAIT *w; - // Validate arguments - if (v == NULL || data == NULL || size == 0) - { - return; - } - - w = ZeroMalloc(sizeof(IP_WAIT)); - w->Data = data; - w->Size = size; - w->SrcIP = src_ip; - w->DestIP = dest_ip; - w->Expire = v->Now + (UINT64)IP_WAIT_FOR_ARP_TIMEOUT; - - Add(v->IpWaitTable, w); -} - -// Initialize the IP waiting table -void InitIpWaitTable(VH *v) -{ - // Validate arguments - if (v == NULL) - { - return; - } - - v->IpWaitTable = NewList(NULL); -} - -// Release the IP waiting table -void FreeIpWaitTable(VH *v) -{ - UINT i; - // Validate arguments - if (v == NULL) - { - return; - } - - for (i = 0; i < LIST_NUM(v->IpWaitTable); i++) - { - IP_WAIT *w = LIST_DATA(v->IpWaitTable, i); - - Free(w->Data); - Free(w); - } - - ReleaseList(v->IpWaitTable); -} - -// MAC address for the IP address is found because something such as an ARP Response arrives -void ArpIpWasKnown(VH *v, UINT ip, UCHAR *mac) -{ - // Validate arguments - if (v == NULL || mac == NULL) - { - return; - } - - // If there is a query for this IP address in the ARP queue, delete it - DeleteArpWaitTable(v, ip); - - // Update or register in the ARP table - InsertArpTable(v, mac, ip); - - // Send the IP packets waiting in the IP waiting list - SendWaitingIp(v, mac, ip); -} - -// Re-issue ARPs by checking the ARP waiting list -void PollingArpWaitTable(VH *v) -{ - UINT i; - LIST *o; - // Validate arguments - if (v == NULL) - { - return; - } - - // Initialize the deletion list - o = NULL; - - // Scan whole ARP waiting list - for (i = 0; i < LIST_NUM(v->ArpWaitTable); i++) - { - ARP_WAIT *w = LIST_DATA(v->ArpWaitTable, i); - - if (w->GiveupTime < v->Now || (w->GiveupTime - 100 * 1000) > v->Now) - { - // Give up the sending of ARP - if (o == NULL) - { - o = NewListFast(NULL); - } - Add(o, w); - } - else - { - if (w->TimeoutTime < v->Now) - { - // Send an ARP again - VirtualArpSendRequest(v, w->IpAddress); - - // Set the next timeout time - w->TimeoutTime = v->Now + (UINT64)w->NextTimeoutTimeValue; - // Increase the ARP transmission interval of the second and subsequent - w->NextTimeoutTimeValue = w->NextTimeoutTimeValue + ARP_REQUEST_TIMEOUT; - } - } - } - - // Remove if there is a ARP waiting record to be deleted - if (o != NULL) - { - for (i = 0; i < LIST_NUM(o); i++) - { - ARP_WAIT *w = LIST_DATA(o, i); - - DeleteArpWaitTable(v, w->IpAddress); - } - ReleaseList(o); - } -} - -// Issue an ARP -void SendArp(VH *v, UINT ip) -{ - ARP_WAIT *w; - // Validate arguments - if (v == NULL) - { - return; - } - - // Examine whether the destination IP address has been registered in the ARP waiting list first - w = SearchArpWaitTable(v, ip); - if (w != NULL) - { - // Do not do anything because it is already registered - return; - } - - // Send an ARP packet first - VirtualArpSendRequest(v, ip); - - // Register in the ARP waiting list - w = ZeroMalloc(sizeof(ARP_WAIT)); - w->GiveupTime = v->Now + (UINT64)ARP_REQUEST_GIVEUP; - w->TimeoutTime = v->Now + (UINT64)ARP_REQUEST_TIMEOUT; - w->NextTimeoutTimeValue = ARP_REQUEST_TIMEOUT; - w->IpAddress = ip; - - InsertArpWaitTable(v, w); -} - -// Delete the ARP waiting table -void DeleteArpWaitTable(VH *v, UINT ip) -{ - ARP_WAIT *w; - // Validate arguments - if (v == NULL) - { - return; - } - - w = SearchArpWaitTable(v, ip); - if (w == NULL) - { - return; - } - Delete(v->ArpWaitTable, w); - - Free(w); -} - -// Search the ARP waiting table -ARP_WAIT *SearchArpWaitTable(VH *v, UINT ip) -{ - ARP_WAIT *w, t; - // Validate arguments - if (v == NULL) - { - return NULL; - } - - t.IpAddress = ip; - w = Search(v->ArpWaitTable, &t); - - return w; -} - -// Register in the ARP waiting table -void InsertArpWaitTable(VH *v, ARP_WAIT *w) -{ - // Validate arguments - if (v == NULL || w == NULL) - { - return; - } - - Add(v->ArpWaitTable, w); -} - -// Initialize the ARP waiting table -void InitArpWaitTable(VH *v) -{ - // Validate arguments - if (v == NULL) - { - return; - } - - v->ArpWaitTable = NewList(CompareArpWaitTable); -} - -// Release the ARP waiting table -void FreeArpWaitTable(VH *v) -{ - UINT i; - // Validate arguments - if (v == NULL) - { - return; - } - - for (i = 0; i < LIST_NUM(v->ArpWaitTable); i++) - { - ARP_WAIT *w = LIST_DATA(v->ArpWaitTable, i); - - Free(w); - } - - ReleaseList(v->ArpWaitTable); -} - -// Insert an entry in the ARP table -void InsertArpTable(VH *v, UCHAR *mac, UINT ip) -{ - ARP_ENTRY *e, t; - // Validate arguments - if (v == NULL || mac == NULL || ip == 0 || ip == 0xffffffff || IsMacBroadcast(mac) || IsMacInvalid(mac)) - { - return; - } - - // Check whether the same IP address is not already registered - t.IpAddress = ip; - e = Search(v->ArpTable, &t); - if (e != NULL) - { - // Override this simply because it was registered - if (Cmp(e->MacAddress, mac, 6) != 0) - { - e->Created = v->Now; - Copy(e->MacAddress, mac, 6); - } - e->Expire = v->Now + (UINT64)ARP_ENTRY_EXPIRES; - } - else - { - // Create a new entry - e = ZeroMalloc(sizeof(ARP_ENTRY)); - - e->Created = v->Now; - e->Expire = v->Now + (UINT64)ARP_ENTRY_EXPIRES; - Copy(e->MacAddress, mac, 6); - e->IpAddress = ip; - - Add(v->ArpTable, e); - } -} - -// Poll the ARP table -void PollingArpTable(VH *v) -{ - // Validate arguments - if (v == NULL) - { - return; - } - - if (v->Now > v->NextArpTablePolling) - { - v->NextArpTablePolling = v->Now + (UINT64)ARP_ENTRY_POLLING_TIME; - RefreshArpTable(v); - } -} - -// Remove the old ARP entries -void RefreshArpTable(VH *v) -{ - UINT i; - LIST *o; - // Validate arguments - if (v == NULL) - { - return; - } - - o = NewListFast(NULL); - for (i = 0; i < LIST_NUM(v->ArpTable); i++) - { - ARP_ENTRY *e = LIST_DATA(v->ArpTable, i); - - // Check for expired - if (e->Expire < v->Now) - { - // Expired - Add(o, e); - } - } - - // Remove expired entries at once - for (i = 0; i < LIST_NUM(o); i++) - { - ARP_ENTRY *e = LIST_DATA(o, i); - - Delete(v->ArpTable, e); - Free(e); - } - - ReleaseList(o); -} - -// Search the ARP table -ARP_ENTRY *SearchArpTable(VH *v, UINT ip) -{ - ARP_ENTRY *e, t; - // Validate arguments - if (v == NULL) - { - return NULL; - } - - t.IpAddress = ip; - e = Search(v->ArpTable, &t); - - return e; -} - -// Initialize the ARP table -void InitArpTable(VH *v) -{ - // Validate arguments - if (v == NULL) - { - return; - } - - v->ArpTable = NewList(CompareArpTable); -} - -// Release the ARP table -void FreeArpTable(VH *v) -{ - UINT i; - // Validate arguments - if (v == NULL) - { - return; - } - - // Delete all entries - for (i = 0; i < LIST_NUM(v->ArpTable); i++) - { - ARP_ENTRY *e = LIST_DATA(v->ArpTable, i); - Free(e); - } - ReleaseList(v->ArpTable); -} - -// Comparison of the ARP waiting table entry -int CompareArpWaitTable(void *p1, void *p2) -{ - ARP_WAIT *e1, *e2; - if (p1 == NULL || p2 == NULL) - { - return 0; - } - e1 = *(ARP_WAIT **)p1; - e2 = *(ARP_WAIT **)p2; - if (e1 == NULL || e2 == NULL) - { - return 0; - } - - if (e1->IpAddress > e2->IpAddress) - { - return 1; - } - else if (e1->IpAddress < e2->IpAddress) - { - return -1; - } - return 0; -} - -// Comparison of the ARP table entry -int CompareArpTable(void *p1, void *p2) -{ - ARP_ENTRY *e1, *e2; - if (p1 == NULL || p2 == NULL) - { - return 0; - } - e1 = *(ARP_ENTRY **)p1; - e2 = *(ARP_ENTRY **)p2; - if (e1 == NULL || e2 == NULL) - { - return 0; - } - - if (e1->IpAddress > e2->IpAddress) - { - return 1; - } - else if (e1->IpAddress < e2->IpAddress) - { - return -1; - } - return 0; -} - -// Initialize the virtual host -bool VirtualInit(VH *v) -{ - // Initialize the log - v->Logger = NULL; - - LockVirtual(v); - { - // Initialize - v->Cancel = NewCancel(); - v->SendQueue = NewQueue(); - } - UnlockVirtual(v); - - // Counter reset - v->Counter->c = 0; - v->DhcpId = 0; - - // Initialize the ARP table - InitArpTable(v); - - // Initialize the ARP waiting table - InitArpWaitTable(v); - - // Initialize the IP waiting table - InitIpWaitTable(v); - - // Initialize the IP combining list - InitIpCombineList(v); - - // Initialize the NAT - InitNat(v); - - // Initialize the DHCP server - InitDhcpServer(v); - - // Other initialization - v->flag1 = false; - v->NextArpTablePolling = Tick64() + (UINT64)ARP_ENTRY_POLLING_TIME; - v->CurrentIpQuota = 0; - v->Active = true; - - return true; -} -bool VirtualPaInit(SESSION *s) -{ - VH *v; - // Validate arguments - if (s == NULL || (v = (VH *)s->PacketAdapter->Param) == NULL) - { - return false; - } - - return VirtualInit(v); -} - -// Get the cancel object of the virtual host -CANCEL *VirtualPaGetCancel(SESSION *s) -{ - VH *v; - // Validate arguments - if (s == NULL || (v = (VH *)s->PacketAdapter->Param) == NULL) - { - return NULL; - } - - AddRef(v->Cancel->ref); - return v->Cancel; -} - -// Get the next packet from the virtual host -UINT VirtualGetNextPacket(VH *v, void **data) -{ - UINT ret = 0; - -START: - // Examine the transmission queue - LockQueue(v->SendQueue); - { - BLOCK *block = GetNext(v->SendQueue); - - if (block != NULL) - { - // There is a packet - ret = block->Size; - *data = block->Buf; - // Discard the structure - Free(block); - } - } - UnlockQueue(v->SendQueue); - - if (ret == 0) - { - LockVirtual(v); - { - v->Now = Tick64(); - // Polling process - VirtualPolling(v); - } - UnlockVirtual(v); - if (v->SendQueue->num_item != 0) - { - goto START; - } - } - - return ret; -} -UINT VirtualPaGetNextPacket(SESSION *s, void **data) -{ - VH *v; - // Validate arguments - if (s == NULL || (v = (VH *)s->PacketAdapter->Param) == NULL) - { - return INFINITE; - } - - return VirtualGetNextPacket(v, data); -} - -// Polling process (Always called once in a SessionMain loop) -void VirtualPolling(VH *v) -{ - // Validate arguments - if (v == NULL) - { - return; - } - - // DHCP polling - PollingDhcpServer(v); - - // NAT polling - PoolingNat(v); - - // Clear the old ARP table entries - PollingArpTable(v); - - // Poll the ARP waiting list - PollingArpWaitTable(v); - - // Poll the IP waiting list - PollingIpWaitTable(v); - - // Poll the IP combining list - PollingIpCombine(v); - - // Beacon transmission procedure - PollingBeacon(v); -} - -// Beacon transmission procedure -void PollingBeacon(VH *v) -{ - // Validate arguments - if (v == NULL) - { - return; - } - - if (v->LastSendBeacon == 0 || - ((v->LastSendBeacon + BEACON_SEND_INTERVAL) <= Tick64())) - { - v->LastSendBeacon = Tick64(); - - SendBeacon(v); - } -} - -// Send a Layer-2 packet -void VirtualLayer2Send(VH *v, UCHAR *dest_mac, UCHAR *src_mac, USHORT protocol, void *data, UINT size) -{ - MAC_HEADER *mac_header; - UCHAR *buf; - BLOCK *block; - // Validate arguments - if (v == NULL || dest_mac == NULL || src_mac == NULL || data == NULL || size > (MAX_PACKET_SIZE - sizeof(MAC_HEADER))) - { - return; - } - - // Create buffer - buf = Malloc(MAC_HEADER_SIZE + size); - - // MAC header - mac_header = (MAC_HEADER *)&buf[0]; - Copy(mac_header->DestAddress, dest_mac, 6); - Copy(mac_header->SrcAddress, src_mac, 6); - mac_header->Protocol = Endian16(protocol); - - // Copy data - Copy(&buf[sizeof(MAC_HEADER)], data, size); - - // Size - size += sizeof(MAC_HEADER); - - // Generate the packet - block = NewBlock(buf, size, 0); - - // Insert into the queue - LockQueue(v->SendQueue); - { - InsertQueue(v->SendQueue, block); - } - UnlockQueue(v->SendQueue); - - // Cancel - Cancel(v->Cancel); -} - -// Send an IP packet (with automatic fragmentation) -void SendIp(VH *v, UINT dest_ip, UINT src_ip, UCHAR protocol, void *data, UINT size) -{ - SendIpEx(v, dest_ip, src_ip, protocol, data, size, 0); -} -void SendIpEx(VH *v, UINT dest_ip, UINT src_ip, UCHAR protocol, void *data, UINT size, UCHAR ttl) -{ - UINT mss; - UCHAR *buf; - USHORT offset; - USHORT id; - USHORT total_size; - UINT size_of_this_packet; - // Validate arguments - if (v == NULL || data == NULL || size == 0 || size > MAX_IP_DATA_SIZE_TOTAL) - { - return; - } - - // Maximum segment size - mss = v->IpMss; - - // Buffer - buf = (UCHAR *)data; - - // ID - id = (v->NextId++); - - // Total size - total_size = (USHORT)size; - - // Start to split - offset = 0; - - while (true) - { - bool last_packet = false; - // Gets the size of this packet - size_of_this_packet = MIN((USHORT)mss, (total_size - offset)); - if ((offset + (USHORT)size_of_this_packet) == total_size) - { - last_packet = true; - } - - // Transmit the fragmented packet - SendFragmentedIp(v, dest_ip, src_ip, id, - total_size, offset, protocol, buf + offset, size_of_this_packet, NULL, ttl); - if (last_packet) - { - break; - } - - offset += (USHORT)size_of_this_packet; - } -} - -// Reserve to send the fragmented IP packet -void SendFragmentedIp(VH *v, UINT dest_ip, UINT src_ip, USHORT id, USHORT total_size, USHORT offset, UCHAR protocol, void *data, UINT size, UCHAR *dest_mac, UCHAR ttl) -{ - UCHAR *buf; - IPV4_HEADER *ip; - ARP_ENTRY *arp; - // Validate arguments - if (v == NULL || data == NULL || size == 0) - { - return; - } - - // Memory allocation - buf = Malloc(size + IP_HEADER_SIZE); - ip = (IPV4_HEADER *)&buf[0]; - - // IP header construction - ip->VersionAndHeaderLength = 0; - IPV4_SET_VERSION(ip, 4); - IPV4_SET_HEADER_LEN(ip, (IP_HEADER_SIZE / 4)); - ip->TypeOfService = DEFAULT_IP_TOS; - ip->TotalLength = Endian16((USHORT)(size + IP_HEADER_SIZE)); - ip->Identification = Endian16(id); - ip->FlagsAndFragmentOffset[0] = ip->FlagsAndFragmentOffset[1] = 0; - IPV4_SET_OFFSET(ip, (offset / 8)); - if ((offset + size) >= total_size) - { - IPV4_SET_FLAGS(ip, 0x00); - } - else - { - IPV4_SET_FLAGS(ip, 0x01); - } - ip->TimeToLive = (ttl == 0 ? DEFAULT_IP_TTL : ttl); - ip->Protocol = protocol; - ip->Checksum = 0; - ip->SrcIP = src_ip; - ip->DstIP = dest_ip; - - // Checksum calculation - ip->Checksum = IpChecksum(ip, IP_HEADER_SIZE); - - // Data copy - Copy(buf + IP_HEADER_SIZE, data, size); - - if (dest_mac == NULL) - { - if (ip->DstIP == 0xffffffff || - (IsInNetwork(ip->DstIP, v->HostIP, v->HostMask) && (ip->DstIP & (~v->HostMask)) == (~v->HostMask))) - { - // Broadcast address - dest_mac = broadcast; - } - else - { - // Send an ARP query if the destination MAC address is unknown - arp = SearchArpTable(v, dest_ip); - if (arp != NULL) - { - dest_mac = arp->MacAddress; - } - } - } - if (dest_mac != NULL) - { - // Send the packet immediately - VirtualIpSend(v, dest_mac, buf, size + IP_HEADER_SIZE); - - // Packet data may be released - Free(buf); - } - else - { - // Because this packet still can not be transferred, add it to the IP waiting table - InsertIpWaitTable(v, dest_ip, src_ip, buf, size + IP_HEADER_SIZE); - - // Issue an ARP - SendArp(v, dest_ip); - } -} - -// Send an IP packet (fragmented) -void VirtualIpSend(VH *v, UCHAR *dest_mac, void *data, UINT size) -{ - // Validate arguments - if (v == NULL || dest_mac == NULL || data == NULL || size == 0) - { - return; - } - - // Transmission - VirtualLayer2Send(v, dest_mac, v->MacAddress, MAC_PROTO_IPV4, data, size); -} - -// Send an ARP request packet -void VirtualArpSendRequest(VH *v, UINT dest_ip) -{ - ARPV4_HEADER arp; - // Validate arguments - if (v == NULL) - { - return; - } - - // Build the ARP header - arp.HardwareType = Endian16(ARP_HARDWARE_TYPE_ETHERNET); - arp.ProtocolType = Endian16(MAC_PROTO_IPV4); - arp.HardwareSize = 6; - arp.ProtocolSize = 4; - arp.Operation = Endian16(ARP_OPERATION_REQUEST); - Copy(arp.SrcAddress, v->MacAddress, 6); - arp.SrcIP = v->HostIP; - Zero(&arp.TargetAddress, 6); - arp.TargetIP = dest_ip; - - // Transmission - VirtualLayer2Send(v, broadcast, v->MacAddress, MAC_PROTO_ARPV4, &arp, sizeof(arp)); -} - -// Send an ARP response packet -void VirtualArpSendResponse(VH *v, UCHAR *dest_mac, UINT dest_ip, UINT src_ip) -{ - ARPV4_HEADER arp; - // Validate arguments - if (v == NULL || dest_mac == NULL) - { - return; - } - - // Build the ARP header - arp.HardwareType = Endian16(ARP_HARDWARE_TYPE_ETHERNET); - arp.ProtocolType = Endian16(MAC_PROTO_IPV4); - arp.HardwareSize = 6; - arp.ProtocolSize = 4; - arp.Operation = Endian16(ARP_OPERATION_RESPONSE); - Copy(arp.SrcAddress, v->MacAddress, 6); - Copy(arp.TargetAddress, dest_mac, 6); - arp.SrcIP = src_ip; - arp.TargetIP = dest_ip; - - // Transmission - VirtualLayer2Send(v, dest_mac, v->MacAddress, MAC_PROTO_ARPV4, &arp, sizeof(ARPV4_HEADER)); -} - -// An ARP request packet was received -void VirtualArpResponseRequest(VH *v, PKT *packet) -{ - ARPV4_HEADER *arp; - // Validate arguments - if (v == NULL || packet == NULL) - { - return; - } - - arp = packet->L3.ARPv4Header; - - // Memory the information of the host IP address and the MAC address of the other party - ArpIpWasKnown(v, arp->SrcIP, arp->SrcAddress); - - // Search whether it matches with the IP address of this host - if (v->HostIP == arp->TargetIP) - { - // Respond since the match - VirtualArpSendResponse(v, arp->SrcAddress, arp->SrcIP, v->HostIP); - return; - } - // Do nothing if it doesn't match -} - -// An ARP response packet is received -void VirtualArpResponseReceived(VH *v, PKT *packet) -{ - ARPV4_HEADER *arp; - // Validate arguments - if (v == NULL || packet == NULL) - { - return; - } - - arp = packet->L3.ARPv4Header; - - // Regard this information as known information - ArpIpWasKnown(v, arp->SrcIP, arp->SrcAddress); -} - -// Received an ARP packet -void VirtualArpReceived(VH *v, PKT *packet) -{ - ARPV4_HEADER *arp; - // Validate arguments - if (v == NULL || packet == NULL) - { - return; - } - - arp = packet->L3.ARPv4Header; - - if (Endian16(arp->HardwareType) != ARP_HARDWARE_TYPE_ETHERNET) - { - // Ignore if hardware type is other than Ethernet - return; - } - if (Endian16(arp->ProtocolType) != MAC_PROTO_IPV4) - { - // Ignore if the protocol type is a non-IPv4 - return; - } - if (arp->HardwareSize != 6 || arp->ProtocolSize != 4) - { - // Ignore because the size of protocol address or hardware address is invalid - return; - } - // Check the source MAC address - if (Cmp(arp->SrcAddress, packet->MacAddressSrc, 6) != 0) - { - // MAC address in the MAC header and the MAC address of the ARP packet are different - return; - } - - switch (Endian16(arp->Operation)) - { - case ARP_OPERATION_REQUEST: // ARP request - VirtualArpResponseRequest(v, packet); - break; - - case ARP_OPERATION_RESPONSE: // ARP response - VirtualArpResponseReceived(v, packet); - break; - } -} - -// Release the DHCP server -void FreeDhcpServer(VH *v) -{ - UINT i; - // Validate arguments - if (v == NULL) - { - return; - } - - // Empty the leases lists - for (i = 0; i < LIST_NUM(v->DhcpLeaseList); ++i) - { - DHCP_LEASE *d = LIST_DATA(v->DhcpLeaseList, i); - FreeDhcpLease(d); - } - - ReleaseList(v->DhcpLeaseList); - v->DhcpLeaseList = NULL; - - for (i = 0; i < LIST_NUM(v->DhcpPendingLeaseList); ++i) - { - DHCP_LEASE *d = LIST_DATA(v->DhcpPendingLeaseList, i); - FreeDhcpLease(d); - } - - ReleaseList(v->DhcpPendingLeaseList); - v->DhcpPendingLeaseList = NULL; -} - -// Initialize the DHCP server -void InitDhcpServer(VH *v) -{ - // Validate arguments - if (v == NULL) - { - return; - } - - // Create a list - v->DhcpLeaseList = NewList(CompareDhcpLeaseList); - v->DhcpPendingLeaseList = NewList(CompareDhcpLeaseList); -} - -// Search for a pending DHCP lease item by the IP address -DHCP_LEASE *SearchDhcpPendingLeaseByIp(VH *v, UINT ip) -{ - UINT i; - // Validate arguments - if (v == NULL) - { - return NULL; - } - - for (i = 0; i < LIST_NUM(v->DhcpPendingLeaseList); ++i) - { - DHCP_LEASE *d = LIST_DATA(v->DhcpPendingLeaseList, i); - if (d->IpAddress == ip) - { - return d; - } - } - - return NULL; -} - -// Search for a DHCP lease item by the IP address -DHCP_LEASE *SearchDhcpLeaseByIp(VH *v, UINT ip) -{ - UINT i; - // Validate arguments - if (v == NULL) - { - return NULL; - } - - for (i = 0; i < LIST_NUM(v->DhcpLeaseList); ++i) - { - DHCP_LEASE *d = LIST_DATA(v->DhcpLeaseList, i); - if (d->IpAddress == ip) - { - return d; - } - } - - return NULL; -} - -// Search for a pending DHCP lease item by the MAC address -DHCP_LEASE *SearchDhcpPendingLeaseByMac(VH *v, UCHAR *mac) -{ - DHCP_LEASE *d, t; - // Validate arguments - if (v == NULL || mac == NULL) - { - return NULL; - } - - Copy(&t.MacAddress, mac, 6); - d = Search(v->DhcpPendingLeaseList, &t); - - return d; -} - -// Search for a DHCP lease item by the MAC address -DHCP_LEASE *SearchDhcpLeaseByMac(VH *v, UCHAR *mac) -{ - DHCP_LEASE *d, t; - // Validate arguments - if (v == NULL || mac == NULL) - { - return NULL; - } - - Copy(&t.MacAddress, mac, 6); - d = Search(v->DhcpLeaseList, &t); - - return d; -} - -// Release the DHCP lease item -void FreeDhcpLease(DHCP_LEASE *d) -{ - // Validate arguments - if (d == NULL) - { - return; - } - - Free(d->Hostname); - Free(d); -} - -// Create a DHCP lease item -DHCP_LEASE *NewDhcpLease(UINT expire, UCHAR *mac_address, UINT ip, UINT mask, char *hostname) -{ - DHCP_LEASE *d; - // Validate arguments - if (mac_address == NULL || hostname == NULL) - { - return NULL; - } - - d = ZeroMalloc(sizeof(DHCP_LEASE)); - d->LeasedTime = (UINT64)Tick64(); - if (expire == INFINITE) - { - d->ExpireTime = INFINITE; - } - else - { - d->ExpireTime = d->LeasedTime + (UINT64)expire; - } - d->IpAddress = ip; - d->Mask = mask; - d->Hostname = CopyStr(hostname); - Copy(d->MacAddress, mac_address, 6); - - - return d; -} - -// Comparison of the items in the DHCP list -int CompareDhcpLeaseList(void *p1, void *p2) -{ - DHCP_LEASE *d1, *d2; - // Validate arguments - if (p1 == NULL || p2 == NULL) - { - return 0; - } - d1 = *(DHCP_LEASE **)p1; - d2 = *(DHCP_LEASE **)p2; - if (d1 == NULL || d2 == NULL) - { - return 0; - } - - return Cmp(d1->MacAddress, d2->MacAddress, 6); -} - -// Poll the DHCP server -void PollingDhcpServer(VH *v) -{ - UINT i; - // Validate arguments - if (v == NULL) - { - return; - } - - if (v->LastDhcpPolling != 0) - { - if ((v->LastDhcpPolling + (UINT64)DHCP_POLLING_INTERVAL) > v->Now && - v->LastDhcpPolling < v->Now) - { - return; - } - } - v->LastDhcpPolling = v->Now; - -LIST_CLEANUP: - for (i = 0; i < LIST_NUM(v->DhcpLeaseList); ++i) - { - DHCP_LEASE *d = LIST_DATA(v->DhcpLeaseList, i); - - if (d->ExpireTime < v->Now) - { - FreeDhcpLease(d); - Delete(v->DhcpLeaseList, d); - goto LIST_CLEANUP; - } - } - -PENDING_LIST_CLEANUP: - // Remove expired entries - for (i = 0; i < LIST_NUM(v->DhcpPendingLeaseList); ++i) - { - DHCP_LEASE *d = LIST_DATA(v->DhcpPendingLeaseList, i); - - if (d->ExpireTime < v->Now) - { - FreeDhcpLease(d); - Delete(v->DhcpPendingLeaseList, d); - goto PENDING_LIST_CLEANUP; - } - } -} - -// Correspond to the DHCP REQUEST -UINT ServeDhcpRequest(VH *v, UCHAR *mac, UINT request_ip) -{ - return ServeDhcpRequestEx(v, mac, request_ip, false); -} - -UINT ServeDhcpRequestEx(VH *v, UCHAR *mac, UINT request_ip, bool is_static_ip) -{ - UINT ret; - // Validate arguments - if (v == NULL || mac == NULL) - { - return 0; - } - - ret = ServeDhcpDiscoverEx(v, mac, request_ip, is_static_ip); - if (ret != request_ip) - { - if (request_ip != 0) - { - // Raise an error if the requested IP address cannot to be assigned - return 0; - } - } - - return ret; -} - -// Correspond to the DHCP DISCOVER -UINT ServeDhcpDiscover(VH *v, UCHAR *mac, UINT request_ip) -{ - UINT ret = 0; - // Validate arguments - if (v == NULL || mac == NULL) - { - return 0; - } - - if (request_ip != 0) - { - // IP address is specified - DHCP_LEASE *d = SearchDhcpLeaseByIp(v, request_ip); - if (d == NULL) - { - d = SearchDhcpPendingLeaseByIp(v, request_ip); - } - - if (d != NULL) - { - // If an entry for the same IP address already exists, - // check whether it is a request from the same MAC address - if (Cmp(mac, d->MacAddress, 6) == 0) - { - // Examine whether the specified IP address is within the range of assignment - if (Endian32(v->DhcpIpStart) <= Endian32(request_ip) && - Endian32(request_ip) <= Endian32(v->DhcpIpEnd)) - { - // Accept if within the range - ret = request_ip; - } - } - } - else - { - // Examine whether the specified IP address is within the range of assignment - if (Endian32(v->DhcpIpStart) <= Endian32(request_ip) && - Endian32(request_ip) <= Endian32(v->DhcpIpEnd)) - { - // Accept if within the range - ret = request_ip; - } - else - { - // Propose an IP in the range since it's a Discover although It is out of range - } - } - } - - if (ret == 0) - { - // If there is any entry with the same MAC address - // that are already registered, use it with priority - DHCP_LEASE *d = SearchDhcpLeaseByMac(v, mac); - if (d == NULL) - { - d = SearchDhcpPendingLeaseByMac(v, mac); - } - - if (d != NULL) - { - // Examine whether the found IP address is in the allocation region - if (Endian32(v->DhcpIpStart) <= Endian32(d->IpAddress) && - Endian32(d->IpAddress) <= Endian32(v->DhcpIpEnd)) - { - // Use the IP address if it's found within the range - ret = d->IpAddress; - } - } - } - - if (ret == 0) - { - // Take an appropriate IP addresses that can be assigned newly - HUB_OPTION *opt = NatGetHubOption(v); - - if (opt != NULL && opt->SecureNAT_RandomizeAssignIp) - { - ret = GetFreeDhcpIpAddressByRandom(v, mac); - } - else - { - ret = GetFreeDhcpIpAddress(v); - } - } - - return ret; -} - -UINT ServeDhcpDiscoverEx(VH *v, UCHAR *mac, UINT request_ip, bool is_static_ip) -{ - if (is_static_ip == false) - { - return ServeDhcpDiscover(v, mac, request_ip ); - } - - if (v == NULL || mac == NULL || request_ip == 0) - { - return 0; - } - - DHCP_LEASE *d = SearchDhcpLeaseByIp(v, request_ip); - if (d != NULL) - { - // The requested IP address is used already - return 0; - } - - // For static IP, the requested IP address must NOT be within the range of the DHCP pool - if (Endian32(request_ip) < Endian32(v->DhcpIpStart) || Endian32(request_ip) > Endian32(v->DhcpIpEnd)) - { - return request_ip; - } - - return 0; -} - -// Take an appropriate IP addresses that can be assigned newly -UINT GetFreeDhcpIpAddress(VH *v) -{ - UINT ip_start, ip_end; - UINT i; - // Validate arguments - if (v == NULL) - { - return 0; - } - - ip_start = Endian32(v->DhcpIpStart); - ip_end = Endian32(v->DhcpIpEnd); - - for (i = ip_start; i <= ip_end; i++) - { - UINT ip = Endian32(i); - if (SearchDhcpLeaseByIp(v, ip) == NULL && SearchDhcpPendingLeaseByIp(v, ip) == NULL) - { - // A free IP address is found - return ip; - } - } - - // There is no free address - return 0; -} - -// Take an appropriate IP addresses that can be assigned newly (random) -UINT GetFreeDhcpIpAddressByRandom(VH *v, UCHAR *mac) -{ - UINT ip_start, ip_end; - UINT i; - UINT num_retry; - // Validate arguments - if (v == NULL || mac == NULL) - { - return 0; - } - - ip_start = Endian32(v->DhcpIpStart); - ip_end = Endian32(v->DhcpIpEnd); - - if (ip_start > ip_end) - { - return 0; - } - - num_retry = (ip_end - ip_start + 1) * 2; - num_retry = MIN(num_retry, 65536 * 2); - - for (i = 0; i < num_retry; i++) - { - UCHAR rand_seed[sizeof(UINT) + 6]; - UCHAR hash[16]; - UINT rand_int; - UINT new_ip; - - WRITE_UINT(&rand_seed[0], i); - Copy(rand_seed + sizeof(UINT), mac, 6); - - Md5(hash, rand_seed, sizeof(rand_seed)); - - rand_int = READ_UINT(hash); - - new_ip = Endian32(ip_start + (rand_int % (ip_end - ip_start + 1))); - - if (SearchDhcpLeaseByIp(v, new_ip) == NULL && SearchDhcpPendingLeaseByIp(v, new_ip) == NULL) - { - // A free IP address is found - return new_ip; - } - } - - // There is no free address - return 0; -} - -// Virtual DHCP Server -void VirtualDhcpServer(VH *v, PKT *p) -{ - DHCPV4_HEADER *dhcp; - UCHAR *data; - UINT size; - UINT dhcp_header_size; - UINT dhcp_data_offset; - UINT tran_id; - UINT magic_cookie = Endian32(DHCP_MAGIC_COOKIE); - bool ok; - DHCP_OPTION_LIST *opt; - // Validate arguments - if (v == NULL || p == NULL) - { - return; - } - - if (v->NativeNat != NULL) - { - if (Cmp(p->MacAddressSrc, v->NativeNat->CurrentMacAddress, 6) == 0) - { - // DHCP server is kept from responding for the native NAT interface - // ** Not be needed to return yet ** - //return; - } - } - - dhcp = p->L7.DHCPv4Header; - - tran_id = Endian32(dhcp->TransactionId); - - // Get the DHCP data and size - dhcp_header_size = sizeof(DHCPV4_HEADER); - dhcp_data_offset = (UINT)(((UCHAR *)p->L7.DHCPv4Header) - ((UCHAR *)p->MacHeader) + dhcp_header_size); - data = ((UCHAR *)dhcp) + dhcp_header_size; - size = p->PacketSize - dhcp_data_offset; - if (dhcp_header_size < 5) - { - // Data size is invalid - return; - } - - // Search for Magic Cookie - ok = false; - while (size >= 5) - { - if (Cmp(data, &magic_cookie, sizeof(magic_cookie)) == 0) - { - // Found - data += 4; - size -= 4; - ok = true; - break; - } - data++; - size--; - } - - if (ok == false) - { - // The packet is invalid - return; - } - - // Parse DHCP options list - opt = ParseDhcpOptionList(data, size); - if (opt == NULL) - { - // The packet is invalid - return; - } - - if (StartWith(opt->Hostname, NN_HOSTNAME_STARTWITH) || StartWith(opt->Hostname, NN_HOSTNAME_STARTWITH2)) - { - Free(opt); - return; - } - - if (dhcp->OpCode == 1 && (opt->Opcode == DHCP_DISCOVER || opt->Opcode == DHCP_REQUEST || opt->Opcode == DHCP_INFORM)) - { - // Operate as the server - UINT ip = 0, ip_static = dhcp->ServerIP; - dhcp->ServerIP = 0; - - if (opt->RequestedIp == 0) - { - opt->RequestedIp = (ip_static ? ip_static : p->L3.IPv4Header->SrcIP); - } - if (opt->Opcode == DHCP_DISCOVER) - { - // Return an IP address that can be used - ip = ServeDhcpDiscoverEx(v, p->MacAddressSrc, opt->RequestedIp, ip_static); - } - else if (opt->Opcode == DHCP_REQUEST) - { - // Determine the IP address - if (ip_static && opt->RequestedIp != ip_static) - { - // Don't allow opt->RequestedIp other than the IP written in user's note - ip = 0; - } - else - { - ip = ServeDhcpRequestEx(v, p->MacAddressSrc, opt->RequestedIp, ip_static); - } - } - - if (ip != 0 || opt->Opcode == DHCP_INFORM) - { - // Respond if there is providable IP address - - if (opt->Opcode == DHCP_REQUEST) - { - DHCP_LEASE *d; - char client_mac[MAX_SIZE]; - char client_ip[MAX_SIZE]; - - // Remove old records with the same IP address - d = SearchDhcpLeaseByIp(v, ip); - if (d != NULL) - { - FreeDhcpLease(d); - Delete(v->DhcpLeaseList, d); - } - - d = SearchDhcpPendingLeaseByIp(v, ip); - if (d != NULL) - { - FreeDhcpLease(d); - Delete(v->DhcpPendingLeaseList, d); - } - - // Create a new entry - d = NewDhcpLease(v->DhcpExpire, p->MacAddressSrc, ip, v->DhcpMask, opt->Hostname); - d->Id = ++v->DhcpId; - Add(v->DhcpLeaseList, d); - - MacToStr(client_mac, sizeof(client_mac), d->MacAddress); - IPToStr32(client_ip, sizeof(client_ip), d->IpAddress); - - NLog(v, "LH_NAT_DHCP_CREATED", d->Id, client_mac, client_ip, d->Hostname, v->DhcpExpire / 1000); - } - - // Respond - if (true) - { - DHCP_OPTION_LIST ret; - LIST *o; - Zero(&ret, sizeof(ret)); - - ret.Opcode = (opt->Opcode == DHCP_DISCOVER ? DHCP_OFFER : DHCP_ACK); - ret.ServerAddress = v->HostIP; - if (v->DhcpExpire == INFINITE) - { - ret.LeaseTime = INFINITE; - } - else - { - ret.LeaseTime = Endian32(v->DhcpExpire / 1000); - } - - if (opt->Opcode == DHCP_INFORM) - { - ret.LeaseTime = 0; - } - - StrCpy(ret.DomainName, sizeof(ret.DomainName), v->DhcpDomain); - ret.SubnetMask = v->DhcpMask; - ret.DnsServer = v->DhcpDns; - ret.DnsServer2 = v->DhcpDns2; - ret.Gateway = v->DhcpGateway; - - if (GetGlobalServerFlag(GSF_DISABLE_PUSH_ROUTE) == 0) - { - Copy(&ret.ClasslessRoute, &v->PushRoute, sizeof(DHCP_CLASSLESS_ROUTE_TABLE)); - - if (IsIpcMacAddress(p->MacAddressSrc)) - { - if (ret.Gateway == 0) - { - // If the default gateway is not specified, add the static routing table - // entry for the local IP subnet - // (for PPP clients) - IP dhcp_ip; - IP dhcp_mask; - IP dhcp_network; - - UINTToIP(&dhcp_ip, ip); - - if (ip == 0) - { - UINTToIP(&dhcp_ip, p->L3.IPv4Header->SrcIP); - } - - UINTToIP(&dhcp_mask, v->DhcpMask); - - IPAnd4(&dhcp_network, &dhcp_ip, &dhcp_mask); - - if (GetBestClasslessRoute(&ret.ClasslessRoute, &dhcp_ip) == NULL) - { - if (ret.ClasslessRoute.NumExistingRoutes < MAX_DHCP_CLASSLESS_ROUTE_ENTRIES) - { - DHCP_CLASSLESS_ROUTE *cr = &ret.ClasslessRoute.Entries[ret.ClasslessRoute.NumExistingRoutes]; - - cr->Exists = true; - - UINTToIP(&cr->Gateway, v->HostIP); - - if (v->UseNat == false && ret.ClasslessRoute.NumExistingRoutes >= 1) - { - Copy(&cr->Gateway, &ret.ClasslessRoute.Entries[0].Gateway, sizeof(IP)); - } - - Copy(&cr->Network, &dhcp_network, sizeof(IP)); - Copy(&cr->SubnetMask, &dhcp_mask, sizeof(IP)); - cr->SubnetMaskLen = SubnetMaskToInt(&dhcp_mask); - - ret.ClasslessRoute.NumExistingRoutes++; - } - } - } - } - } - - if (opt->Opcode != DHCP_INFORM) - { - char client_mac[MAX_SIZE]; - char client_ip[64]; - IP ips; - - BinToStr(client_mac, sizeof(client_mac), p->MacAddressSrc, 6); - UINTToIP(&ips, ip); - IPToStr(client_ip, sizeof(client_ip), &ips); - - if (ret.Opcode == DHCP_OFFER) - { - // DHCP_OFFER - DHCP_LEASE *d = NewDhcpLease(5000, p->MacAddressSrc, ip, v->DhcpMask, opt->Hostname); - d->Id = LIST_NUM(v->DhcpPendingLeaseList); - Add(v->DhcpPendingLeaseList, d); - - Debug("VirtualDhcpServer(): %s has been marked as pending for %s\n", client_ip, client_mac); - } - else - { - // DHCP_ACK - Debug("VirtualDhcpServer(): %s has been assigned to %s\n", client_ip, client_mac); - } - } - - // Build a DHCP option - o = BuildDhcpOption(&ret); - if (o != NULL) - { - BUF *b = BuildDhcpOptionsBuf(o); - if (b != NULL) - { - UINT dest_ip = p->L3.IPv4Header->SrcIP; - if (dest_ip == 0) - { - dest_ip = 0xffffffff; - } - // Transmission - VirtualDhcpSend(v, tran_id, dest_ip, Endian16(p->L4.UDPHeader->SrcPort), - ip, dhcp->ClientMacAddress, b, dhcp->HardwareType, dhcp->HardwareAddressSize); - - // Release the memory - FreeBuf(b); - } - FreeDhcpOptions(o); - } - } - } - else - { - // There is no IP address that can be provided - DHCP_OPTION_LIST ret; - LIST *o; - Zero(&ret, sizeof(ret)); - - ret.Opcode = DHCP_NACK; - ret.ServerAddress = v->HostIP; - StrCpy(ret.DomainName, sizeof(ret.DomainName), v->DhcpDomain); - ret.SubnetMask = v->DhcpMask; - - // Build the DHCP option - o = BuildDhcpOption(&ret); - if (o != NULL) - { - BUF *b = BuildDhcpOptionsBuf(o); - if (b != NULL) - { - UINT dest_ip = p->L3.IPv4Header->SrcIP; - if (dest_ip == 0) - { - dest_ip = 0xffffffff; - } - // Transmission - VirtualDhcpSend(v, tran_id, dest_ip, Endian16(p->L4.UDPHeader->SrcPort), - ip, dhcp->ClientMacAddress, b, dhcp->HardwareType, dhcp->HardwareAddressSize); - - // Release the memory - FreeBuf(b); - } - FreeDhcpOptions(o); - } - } - } - - // Release the memory - Free(opt); -} - -// Submit the DHCP response packet -void VirtualDhcpSend(VH *v, UINT tran_id, UINT dest_ip, UINT dest_port, - UINT new_ip, UCHAR *client_mac, BUF *b, UINT hw_type, UINT hw_addr_size) -{ - UINT blank_size = 128 + 64; - UINT dhcp_packet_size; - UINT magic = Endian32(DHCP_MAGIC_COOKIE); - DHCPV4_HEADER *dhcp; - void *magic_cookie_addr; - void *buffer_addr; - // Validate arguments - if (v == NULL || b == NULL) - { - return; - } - - // Calculate the DHCP packet size - dhcp_packet_size = blank_size + sizeof(DHCPV4_HEADER) + sizeof(magic) + b->Size; - - if (dhcp_packet_size < DHCP_MIN_SIZE) - { - // Padding - dhcp_packet_size = DHCP_MIN_SIZE; - } - - // Create a header - dhcp = ZeroMalloc(dhcp_packet_size); - - dhcp->OpCode = 2; - dhcp->HardwareType = hw_type; - dhcp->HardwareAddressSize = hw_addr_size; - dhcp->Hops = 0; - dhcp->TransactionId = Endian32(tran_id); - dhcp->Seconds = 0; - dhcp->Flags = 0; - dhcp->YourIP = new_ip; - dhcp->ServerIP = v->HostIP; - Copy(dhcp->ClientMacAddress, client_mac, 6); - - // Calculate the address - magic_cookie_addr = (((UCHAR *)dhcp) + sizeof(DHCPV4_HEADER) + blank_size); - buffer_addr = ((UCHAR *)magic_cookie_addr) + sizeof(magic); - - // Magic Cookie - Copy(magic_cookie_addr, &magic, sizeof(magic)); - - // Buffer - Copy(buffer_addr, b->Buf, b->Size); - - // Transmission - SendUdp(v, dest_ip, dest_port, v->HostIP, NAT_DHCP_SERVER_PORT, dhcp, dhcp_packet_size); - - Free(dhcp); -} - -// Virtual host: Process the Layer2 -void VirtualLayer2(VH *v, PKT *packet) -{ - bool ok; - // Validate arguments - if (packet == NULL || v == NULL) - { - return; - } - - // Packet filter - if (VirtualLayer2Filter(v, packet) == false) - { - // Packet was ignored - return; - } - - ok = false; - if (packet->TypeL3 == L3_IPV4 && packet->TypeL4 == L4_UDP && packet->TypeL7 == L7_DHCPV4) - { - if (v->UseDhcp) - { - // A special treatment on the DHCP packet - if (packet->BroadcastPacket || Cmp(packet->MacAddressDest, v->MacAddress, 6) == 0) - { - // Virtual DHCP server processing - VirtualDhcpServer(v, packet); - ok = true; - } - } - } - - if (ok == false) - { - // The process for each supported protocol - switch (packet->TypeL3) - { - case L3_ARPV4: // ARPv4 - VirtualArpReceived(v, packet); - break; - - case L3_IPV4: // IPv4 - VirtualIpReceived(v, packet); - break; - } - } -} - -// Packet filter (Blocking packets to other than me) -bool VirtualLayer2Filter(VH *v, PKT *packet) -{ - // Validate arguments - if (v == NULL || packet == NULL) - { - return false; - } - - // Pass through if broadcast packet - if (packet->BroadcastPacket) - { - return true; - } - - // Ignore if the sender of the packet is myself - if (Cmp(packet->MacAddressSrc, v->MacAddress, 6) == 0) - { - return false; - } - // Pass through in the case of a packet addressed to me - if (Cmp(packet->MacAddressDest, v->MacAddress, 6) == 0) - { - return true; - } - - // Discard if the other packets - return false; -} - -// The virtual host is made to receive a packet -bool VirtualPutPacket(VH *v, void *data, UINT size) -{ - if (data == NULL) - { - // Flush - v->flag1 = false; - - if (v->NativeNat != NULL) - { - if (v->NativeNat->SendStateChanged) - { - TUBE *halt_tube = NULL; - - Lock(v->NativeNat->Lock); - { - if (v->NativeNat->HaltTube != NULL) - { - halt_tube = v->NativeNat->HaltTube; - - AddRef(halt_tube->Ref); - } - } - Unlock(v->NativeNat->Lock); - - if (halt_tube != NULL) - { - TubeFlushEx(halt_tube, true); - - v->NativeNat->SendStateChanged = false; - - ReleaseTube(halt_tube); - } - } - } - } - else - { - // Interpret the received packet - PKT *packet = ParsePacket(data, size); - - if (v->flag1 == false) - { - v->flag1 = true; - v->Now = Tick64(); - } - - // Lock the entire virtual machine in here - LockVirtual(v); - { - if (packet != NULL) - { - // Process the Layer-2 - VirtualLayer2(v, packet); - - // Release the packet structure - FreePacket(packet); - } - } - UnlockVirtual(v); - - Free(data); - } - - return true; -} -bool VirtualPaPutPacket(SESSION *s, void *data, UINT size) -{ - VH *v; - // Validate arguments - if (s == NULL || (v = (VH *)s->PacketAdapter->Param) == NULL) - { - return false; - } - - return VirtualPutPacket(v, data, size); -} - -// Get the options for the virtual host -void GetVirtualHostOption(VH *v, VH_OPTION *o) -{ - // Validate arguments - if (v == NULL) - { - return; - } - - LockVirtual(v); - { - Zero(o, sizeof(VH_OPTION)); - - // MAC address - Copy(o->MacAddress, v->MacAddress, 6); - - // Host information - UINTToIP(&o->Ip, v->HostIP); - UINTToIP(&o->Mask, v->HostMask); - - o->Mtu = v->Mtu; - - // NAT timeout information - o->NatTcpTimeout = v->NatTcpTimeout / 1000; - o->NatUdpTimeout = v->NatUdpTimeout / 1000; - - // NAT using flag - o->UseNat = v->UseNat; - - // DHCP using flag - o->UseDhcp = v->UseDhcp; - - // IP address range for DHCP distribution - UINTToIP(&o->DhcpLeaseIPStart, v->DhcpIpStart); - UINTToIP(&o->DhcpLeaseIPEnd, v->DhcpIpEnd); - - // Subnet mask - UINTToIP(&o->DhcpSubnetMask, v->DhcpMask); - - // Expiration date - if (v->DhcpExpire != INFINITE) - { - o->DhcpExpireTimeSpan = v->DhcpExpire / 1000; - } - else - { - o->DhcpExpireTimeSpan = INFINITE; - } - - // Gateway address - UINTToIP(&o->DhcpGatewayAddress, v->DhcpGateway); - - // DNS server address - UINTToIP(&o->DhcpDnsServerAddress, v->DhcpDns); - UINTToIP(&o->DhcpDnsServerAddress2, v->DhcpDns2); - - // Domain name - StrCpy(o->DhcpDomainName, sizeof(o->DhcpDomainName), v->DhcpDomain); - - // Save a log - o->SaveLog = v->SaveLog; - - // Pushing route option - BuildClasslessRouteTableStr(o->DhcpPushRoutes, sizeof(o->DhcpPushRoutes), &v->PushRoute); - o->ApplyDhcpPushRoutes = true; - } - UnlockVirtual(v); -} - -// Set the option to the virtual host -void SetVirtualHostOption(VH *v, VH_OPTION *vo) -{ - UINT i; - // Validate arguments - if (v == NULL || vo == NULL) - { - return; - } - - LockVirtual(v); - { - // Set the MAC address - for (i = 0; i < 6; i++) - { - if (vo->MacAddress[i] != 0) - { - Copy(v->MacAddress, vo->MacAddress, 6); - break; - } - } - - // Set the host information list - v->HostIP = IPToUINT(&vo->Ip); - v->HostMask = IPToUINT(&vo->Mask); - - // Set the MTU, MMS - v->Mtu = MIN(vo->Mtu, MAX_L3_DATA_SIZE); - if (v->Mtu == 0) - { - v->Mtu = MAX_L3_DATA_SIZE; - } - v->Mtu = MAX(v->Mtu, TCP_HEADER_SIZE + IP_HEADER_SIZE + MAC_HEADER_SIZE + 8); - v->IpMss = ((v->Mtu - IP_HEADER_SIZE) / 8) * 8; - v->TcpMss = ((v->IpMss - TCP_HEADER_SIZE) / 8) * 8; - v->UdpMss = ((v->IpMss - UDP_HEADER_SIZE) / 8) * 8; - - if (vo->NatTcpTimeout != 0) - { - v->NatTcpTimeout = MIN(vo->NatTcpTimeout, 4000000) * 1000; - } - if (vo->NatUdpTimeout != 0) - { - v->NatUdpTimeout = MIN(vo->NatUdpTimeout, 4000000) * 1000; - } - v->NatTcpTimeout = MAKESURE(v->NatTcpTimeout, NAT_TCP_MIN_TIMEOUT, NAT_TCP_MAX_TIMEOUT); - v->NatUdpTimeout = MAKESURE(v->NatUdpTimeout, NAT_UDP_MIN_TIMEOUT, NAT_UDP_MAX_TIMEOUT); - Debug("Timeout: %d , %d\n", v->NatTcpTimeout, v->NatUdpTimeout); - - // NAT using flag - v->UseNat = vo->UseNat; - - // DHCP using flag - v->UseDhcp = vo->UseDhcp; - - // Expiration date - if (vo->DhcpExpireTimeSpan == 0 || vo->DhcpExpireTimeSpan == INFINITE) - { - v->DhcpExpire = INFINITE; - } - else - { - v->DhcpExpire = MAKESURE(DHCP_MIN_EXPIRE_TIMESPAN, - MIN(vo->DhcpExpireTimeSpan * 1000, 2000000000), - INFINITE); - } - - // Address range to be distributed - v->DhcpIpStart = IPToUINT(&vo->DhcpLeaseIPStart); - v->DhcpIpEnd = IPToUINT(&vo->DhcpLeaseIPEnd); - if (Endian32(v->DhcpIpEnd) < Endian32(v->DhcpIpStart)) - { - v->DhcpIpEnd = v->DhcpIpStart; - } - - // Subnet mask - v->DhcpMask = IPToUINT(&vo->DhcpSubnetMask); - - // Gateway address - v->DhcpGateway = IPToUINT(&vo->DhcpGatewayAddress); - - // DNS server address - v->DhcpDns = IPToUINT(&vo->DhcpDnsServerAddress); - v->DhcpDns2 = IPToUINT(&vo->DhcpDnsServerAddress2); - - // Domain name - StrCpy(v->DhcpDomain, sizeof(v->DhcpDomain), vo->DhcpDomainName); - - // Save a log - v->SaveLog = vo->SaveLog; - - // DHCP routing table pushing setting - if (vo->ApplyDhcpPushRoutes) - { - DHCP_CLASSLESS_ROUTE_TABLE rt; - - Zero(&rt, sizeof(rt)); - - if (ParseClasslessRouteTableStr(&rt, vo->DhcpPushRoutes)) - { - Copy(&v->PushRoute, &rt, sizeof(DHCP_CLASSLESS_ROUTE_TABLE)); - } - } - } - UnlockVirtual(v); -} - -// Release the virtual host -void Virtual_Free(VH *v) -{ - // Release the DHCP server - FreeDhcpServer(v); - - // NAT release - FreeNat(v); - - LockVirtual(v); - { - // Release the IP combining list - FreeIpCombineList(v); - - // Release the IP waiting table - FreeIpWaitTable(v); - - // Release the ARP waiting table - FreeArpWaitTable(v); - - // Release the ARP table - FreeArpTable(v); - - // Release the transmission queue - LockQueue(v->SendQueue); - { - BLOCK *block; - - // Release all queues - while (block = GetNext(v->SendQueue)) - { - FreeBlock(block); - } - } - UnlockQueue(v->SendQueue); - ReleaseQueue(v->SendQueue); - v->SendQueue = NULL; - - // Release the cancel object - ReleaseCancel(v->Cancel); - - v->Active = false; - } - UnlockVirtual(v); - - // Release the logger - FreeLog(v->Logger); -} -void VirtualPaFree(SESSION *s) -{ - VH *v; - // Validate arguments - if (s == NULL || (v = (VH *)s->PacketAdapter->Param) == NULL) - { - return; - } - - Virtual_Free(v); -} - -// Release the virtual host -void ReleaseVirtual(VH *v) -{ - // Validate arguments - if (v == NULL) - { - return; - } - - if (Release(v->ref) == 0) - { - CleanupVirtual(v); - } -} - -// Lock the virtual host -void LockVirtual(VH *v) -{ - // Validate arguments - if (v == NULL) - { - return; - } - - Lock(v->lock); -} - -// Unlock the virtual host -void UnlockVirtual(VH *v) -{ - // Validate arguments - if (v == NULL) - { - return; - } - - Unlock(v->lock); -} - -// Cleanup the virtual host -void CleanupVirtual(VH *v) -{ - // Validate arguments - if (v == NULL) - { - return; - } - - if (v->Session != NULL) - { - ReleaseSession(v->Session); - } - - DeleteCounter(v->Counter); - DeleteLock(v->lock); - - Free(v); -} - -// Stop the virtual host -void StopVirtualHost(VH *v) -{ - SESSION *s; - // Validate arguments - if (v == NULL) - { - return; - } - - // Get the session corresponding to the virtual host - LockVirtual(v); - { - s = v->Session; - if (s != NULL) - { - AddRef(s->ref); - } - } - UnlockVirtual(v); - - if (s == NULL) - { - // This session is already stopped - return; - } - - // Stop Session - StopSession(s); - - ReleaseSession(s); -} - -// Create a new virtual host -VH *NewVirtualHost(CEDAR *cedar, CLIENT_OPTION *option, CLIENT_AUTH *auth, VH_OPTION *vh_option) -{ - return NewVirtualHostEx(cedar, option, auth, vh_option, NULL); -} -VH *NewVirtualHostEx(CEDAR *cedar, CLIENT_OPTION *option, CLIENT_AUTH *auth, VH_OPTION *vh_option, NAT *nat) -{ - VH *v; - SOCK *s; - // Validate arguments - if (vh_option == NULL) - { - return NULL; - } - - // Create a VH - v = ZeroMalloc(sizeof(VH)); - v->ref = NewRef(); - v->lock = NewLock(); - v->Counter = NewCounter(); - - v->nat = nat; - - // Examine whether ICMP Raw Socket can be created - s = NewUDP4(MAKE_SPECIAL_PORT(IP_PROTO_ICMPV4), NULL); - if (s != NULL) - { - if (s->IsTtlSupported) - { - v->IcmpRawSocketOk = true; - } - - ReleaseSock(s); - } - - if (v->IcmpRawSocketOk == false) - { - if (IsIcmpApiSupported()) - { - v->IcmpApiOk = true; - } - } - - // Set the options - SetVirtualHostOption(v, vh_option); - - return v; -} - -// Generate a random MAC address -void GenMacAddress(UCHAR *mac) -{ - UCHAR rand_data[32]; - UINT64 now; - BUF *b; - UCHAR hash[SHA1_SIZE]; - // Validate arguments - if (mac == NULL) - { - return; - } - - // Get the current time - now = SystemTime64(); - - // Generate a random number - Rand(rand_data, sizeof(rand_data)); - - // Add to the buffer - b = NewBuf(); - WriteBuf(b, &now, sizeof(now)); - WriteBuf(b, rand_data, sizeof(rand_data)); - - // Hash - Sha0(hash, b->Buf, b->Size); - - // Generate a MAC address - mac[0] = 0x5E; - mac[1] = hash[0]; - mac[2] = hash[1]; - mac[3] = hash[2]; - mac[4] = hash[3]; - mac[5] = hash[4]; - - FreeBuf(b); -} - -// Get a packet of virtual host adapter -PACKET_ADAPTER *VirtualGetPacketAdapter() -{ - return NewPacketAdapter(VirtualPaInit, VirtualPaGetCancel, - VirtualPaGetNextPacket, VirtualPaPutPacket, VirtualPaFree); -} - - +// SoftEther VPN Source Code - Developer Edition Master Branch +// Cedar Communication Module + + +// Virtual.c +// User-mode virtual host program + +#include "CedarPch.h" + +static UCHAR broadcast[6] = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff}; +static char v_vgs_hostname[256] = {0}; + +static char secure_nat_target_hostname[MAX_SIZE] = {0}; + +// Specify the destination host name to be used for connectivity testing in SecureNAT +void NnSetSecureNatTargetHostname(char *name) +{ + // Validate arguments + if (name == NULL) + { + return; + } + + StrCpy(secure_nat_target_hostname, sizeof(secure_nat_target_hostname), name); +} + +// Delete the oldest NAT session if necessary +void NnDeleteOldestNatSessionIfNecessary(NATIVE_NAT *t, UINT ip, UINT protocol) +{ + UINT current_num; + UINT max_sessions = 0; + // Validate arguments + if (t == NULL) + { + return; + } + + if (t->v->HubOption != NULL) + { + HUB_OPTION *o = t->v->HubOption; + + switch (protocol) + { + case NAT_TCP: + max_sessions = o->SecureNAT_MaxTcpSessionsPerIp; + break; + + case NAT_UDP: + max_sessions = o->SecureNAT_MaxUdpSessionsPerIp; + break; + + case NAT_ICMP: + max_sessions = o->SecureNAT_MaxIcmpSessionsPerIp; + break; + } + } + + if (max_sessions == 0) + { + return; + } + + current_num = NnGetNumNatEntriesPerIp(t, ip, protocol); + + if (current_num >= max_sessions) + { + NnDeleteOldestNatSession(t, ip, protocol); + } +} + +// Delete the oldest NAT session +void NnDeleteOldestNatSession(NATIVE_NAT *t, UINT ip, UINT protocol) +{ + NATIVE_NAT_ENTRY *e; + // Validate arguments + if (t == NULL) + { + return; + } + + e = NnGetOldestNatEntryOfIp(t, ip, protocol); + + if (e != NULL) + { + NnDeleteSession(t, e); + } +} + +// Get the oldest NAT session +NATIVE_NAT_ENTRY *NnGetOldestNatEntryOfIp(NATIVE_NAT *t, UINT ip, UINT protocol) +{ + UINT i; + NATIVE_NAT_ENTRY *oldest = NULL; + UINT64 oldest_tick = 0xFFFFFFFFFFFFFFFFULL; + // Validate arguments + if (t == NULL) + { + return NULL; + } + + for (i = 0; i < LIST_NUM(t->NatTableForRecv->AllList); i++) + { + NATIVE_NAT_ENTRY *e = LIST_DATA(t->NatTableForRecv->AllList, i); + + if (e->SrcIp == ip) + { + if (e->Protocol == protocol) + { + if (e->LastCommTime <= oldest_tick) + { + oldest_tick = e->LastCommTime; + oldest = e; + } + } + } + } + + return oldest; +} + +// Get the number of NAT sessions per IP address +UINT NnGetNumNatEntriesPerIp(NATIVE_NAT *t, UINT src_ip, UINT protocol) +{ + UINT ret = 0; + UINT i; + // Validate arguments + if (t == NULL) + { + return 0; + } + + for (i = 0; i < LIST_NUM(t->NatTableForRecv->AllList); i++) + { + NATIVE_NAT_ENTRY *e = LIST_DATA(t->NatTableForRecv->AllList, i); + + if (e->SrcIp == src_ip) + { + if (e->Protocol == protocol) + { + ret++; + } + } + } + + return ret; +} + +// Delete the old NAT sessions +void NnDeleteOldSessions(NATIVE_NAT *t) +{ + UINT i; + LIST *o; + UINT64 now; + // Validate arguments + if (t == NULL) + { + return; + } + + o = NULL; + now = t->v->Now; + + for (i = 0; i < LIST_NUM(t->NatTableForSend->AllList); i++) + { + NATIVE_NAT_ENTRY *e = LIST_DATA(t->NatTableForSend->AllList, i); + UINT64 timeout; + + if (e->Status == NAT_TCP_CONNECTED || e->Status == NAT_TCP_ESTABLISHED) + { + timeout = e->LastCommTime + (UINT64)(e->Protocol == NAT_TCP ? t->v->NatTcpTimeout : t->v->NatUdpTimeout); + } + else + { + timeout = e->LastCommTime + (UINT64)NN_TIMEOUT_FOR_UNESTBALISHED_TCP; + } + + if (timeout < now) + { + // Time-out occurs + if (o == NULL) + { + o = NewListFast(NULL); + } + + Add(o, e); + } + } + + if (o != NULL) + { + for (i = 0; i < LIST_NUM(o); i++) + { + NATIVE_NAT_ENTRY *e = LIST_DATA(o, i); + + NnDeleteSession(t, e); + } + + ReleaseList(o); + } +} + +// Delete the NAT entry +void NnDeleteSession(NATIVE_NAT *t, NATIVE_NAT_ENTRY *e) +{ + // Validate arguments + if (t == NULL || e == NULL) + { + return; + } + + switch (e->Protocol) + { + case NAT_TCP: + // Send a RST to the client side + SendTcp(t->v, e->DestIp, e->DestPort, e->SrcIp, e->SrcPort, + e->LastAck, e->LastSeq + (e->Status == NAT_TCP_CONNECTING ? 1 : 0), TCP_RST | TCP_ACK, 0, 0, NULL, 0); + + NLog(t->v, "LH_NAT_TCP_DELETED", e->Id); + break; + + case NAT_UDP: + NLog(t->v, "LH_NAT_UDP_DELETED", e->Id); + break; + + case NAT_ICMP: + Debug("NAT ICMP %u Deleted.\n", e->Id); + break; + } + + DeleteHash(t->NatTableForSend, e); + DeleteHash(t->NatTableForRecv, e); + + Free(e); +} + +// Poll the IP combining object +void NnPollingIpCombine(NATIVE_NAT *t) +{ + LIST *o; + UINT i; + // Validate arguments + if (t == NULL) + { + return; + } + + // Discard the old combining object + o = NULL; + for (i = 0; i < LIST_NUM(t->IpCombine); i++) + { + IP_COMBINE *c = LIST_DATA(t->IpCombine, i); + + if (c->Expire < t->v->Now) + { + if (o == NULL) + { + o = NewListFast(NULL); + } + Add(o, c); + } + } + + if (o != NULL) + { + for (i = 0; i < LIST_NUM(o); i++) + { + IP_COMBINE *c = LIST_DATA(o, i); + + // Remove from the list + Delete(t->IpCombine, c); + + // Release the memory + NnFreeIpCombine(t, c); + } + ReleaseList(o); + } +} + +// Combine the IP packet received to the IP combining object +void NnCombineIp(NATIVE_NAT *t, IP_COMBINE *c, UINT offset, void *data, UINT size, bool last_packet, UCHAR *head_ip_header_data, UINT head_ip_header_size) +{ + UINT i; + IP_PART *p; + UINT need_size; + UINT data_size_delta; + // Validate arguments + if (c == NULL || data == NULL) + { + return; + } + + // Check the size and offset + if ((offset + size) > 65535) + { + // Do not process a packet larger than 64Kbytes + return; + } + + if (last_packet == false && c->Size != 0) + { + if ((offset + size) > c->Size) + { + // Do not process a packet larger than the packet size + return; + } + } + + if (head_ip_header_data != NULL && head_ip_header_size >= sizeof(IPV4_HEADER)) + { + if (c->HeadIpHeaderData == NULL) + { + c->HeadIpHeaderData = Clone(head_ip_header_data, head_ip_header_size); + c->HeadIpHeaderDataSize = head_ip_header_size; + } + } + + need_size = offset + size; + data_size_delta = c->DataReserved; + // Ensure sufficient if the buffer is insufficient + while (c->DataReserved < need_size) + { + c->DataReserved = c->DataReserved * 4; + c->Data = ReAlloc(c->Data, c->DataReserved); + } + data_size_delta = c->DataReserved - data_size_delta; + t->CurrentIpQuota += data_size_delta; + + // Overwrite the data into the buffer + Copy(((UCHAR *)c->Data) + offset, data, size); + + if (last_packet) + { + // If No More Fragment packet arrives, the size of this datagram is finalized + c->Size = offset + size; + } + + // Check the overlap between the region which is represented by the offset and size of the + // existing received list and the region which is represented by the offset and size + for (i = 0; i < LIST_NUM(c->IpParts); i++) + { + UINT moving_size; + IP_PART *p = LIST_DATA(c->IpParts, i); + + // Check the overlapping between the existing area and head area + if ((p->Offset <= offset) && ((p->Offset + p->Size) > offset)) + { + // Compress behind the offset of this packet since a duplication is + // found in the first part with the existing packet and this packet + + if ((offset + size) <= (p->Offset + p->Size)) + { + // This packet is buried in the existing packet + size = 0; + } + else + { + // Retral region is not overlapped + moving_size = p->Offset + p->Size - offset; + offset += moving_size; + size -= moving_size; + } + } + if ((p->Offset < (offset + size)) && ((p->Offset + p->Size) >= (offset + size))) + { + // Compress the size of this packet forward because a duplication is + // found between the posterior portion the existing packet and this packet + + moving_size = p->Offset + p->Size - offset - size; + size -= moving_size; + } + + if ((p->Offset >= offset) && ((p->Offset + p->Size) <= (offset + size))) + { + // This packet was overwritten to completely hunched over a existing packet + p->Size = 0; + } + } + + if (size != 0) + { + // Register this packet + p = ZeroMalloc(sizeof(IP_PART)); + + p->Offset = offset; + p->Size = size; + + Add(c->IpParts, p); + } + + if (c->Size != 0) + { + // Get the total size of the data portion list already received + UINT total_size = 0; + UINT i; + + for (i = 0; i < LIST_NUM(c->IpParts); i++) + { + IP_PART *p = LIST_DATA(c->IpParts, i); + + total_size += p->Size; + } + + if (total_size == c->Size) + { + // Received whole of the IP packet + //Debug("Combine: %u\n", total_size); + NnIpReceived(t, c->SrcIP, c->DestIP, c->Protocol, c->Data, c->Size, c->Ttl, + c->HeadIpHeaderData, c->HeadIpHeaderDataSize, c->MaxL3Size); + + // Release the combining object + NnFreeIpCombine(t, c); + + // Remove from the combining object list + Delete(t->IpCombine, c); + } + } +} + +// Release the IP combining object +void NnFreeIpCombine(NATIVE_NAT *t, IP_COMBINE *c) +{ + UINT i; + // Validate arguments + if (c == NULL) + { + return; + } + + // Release the data + t->CurrentIpQuota -= c->DataReserved; + Free(c->Data); + + // Release the partial list + for (i = 0; i < LIST_NUM(c->IpParts); i++) + { + IP_PART *p = LIST_DATA(c->IpParts, i); + + Free(p); + } + + Free(c->HeadIpHeaderData); + + ReleaseList(c->IpParts); + Free(c); +} + +// Search the IP combining list +IP_COMBINE *NnSearchIpCombine(NATIVE_NAT *t, UINT src_ip, UINT dest_ip, USHORT id, UCHAR protocol) +{ + IP_COMBINE *c, tt; + // Validate arguments + if (t == NULL) + { + return NULL; + } + + tt.DestIP = dest_ip; + tt.SrcIP = src_ip; + tt.Id = id; + tt.Protocol = protocol; + + c = Search(t->IpCombine, &tt); + + return c; +} + +// Insert by creating a new object to the IP combining list +IP_COMBINE *NnInsertIpCombine(NATIVE_NAT *t, UINT src_ip, UINT dest_ip, USHORT id, UCHAR protocol, bool mac_broadcast, UCHAR ttl, bool src_is_localmac) +{ + IP_COMBINE *c; + // Validate arguments + if (t == NULL) + { + return NULL; + } + + // Examine the quota + if ((t->CurrentIpQuota + IP_COMBINE_INITIAL_BUF_SIZE) > IP_COMBINE_WAIT_QUEUE_SIZE_QUOTA) + { + // IP packet can not be stored any more + return NULL; + } + + c = ZeroMalloc(sizeof(IP_COMBINE)); + c->SrcIsLocalMacAddr = src_is_localmac; + c->DestIP = dest_ip; + c->SrcIP = src_ip; + c->Id = id; + c->Expire = t->v->Now + (UINT64)IP_COMBINE_TIMEOUT; + c->Size = 0; + c->IpParts = NewList(NULL); + c->Protocol = protocol; + c->MacBroadcast = mac_broadcast; + c->Ttl = ttl; + + // Secure the memory + c->DataReserved = IP_COMBINE_INITIAL_BUF_SIZE; + c->Data = Malloc(c->DataReserved); + t->CurrentIpQuota += c->DataReserved; + + Insert(t->IpCombine, c); + + return c; +} + +// Initialize the IP combining list +void NnInitIpCombineList(NATIVE_NAT *t) +{ + // Validate arguments + if (t == NULL) + { + return; + } + + t->IpCombine = NewList(CompareIpCombine); +} + +// Release the IP combining list +void NnFreeIpCombineList(NATIVE_NAT *t) +{ + UINT i; + // Validate arguments + if (t == NULL) + { + return; + } + + for (i = 0; i < LIST_NUM(t->IpCombine); i++) + { + IP_COMBINE *c = LIST_DATA(t->IpCombine, i); + + NnFreeIpCombine(t, c); + } + + ReleaseList(t->IpCombine); +} + +// A TCP packet is received +void NnTcpReceived(NATIVE_NAT *t, UINT src_ip, UINT dest_ip, void *data, UINT size, UCHAR ttl, UINT max_l3_size) +{ + TCP_HEADER *tcp; + UCHAR *payload; + UINT payload_size; + UINT tcp_header_size; + // Validate arguments + if (t == NULL || data == NULL) + { + return; + } + + // TCP header + if (size < sizeof(TCP_HEADER)) + { + return; + } + + tcp = (TCP_HEADER *)data; + + // Get the TCP header size + tcp_header_size = TCP_GET_HEADER_SIZE(tcp) * 4; + if (size < tcp_header_size || tcp_header_size < sizeof(TCP_HEADER)) + { + return; + } + + // Payload + payload = ((UCHAR *)data) + tcp_header_size; + payload_size = size - tcp_header_size; + + // Search the port from the NAT table + if (true) + { + NATIVE_NAT_ENTRY tt; + NATIVE_NAT_ENTRY *e; + + NnSetNat(&tt, NAT_TCP, 0, 0, src_ip, Endian16(tcp->SrcPort), dest_ip, Endian16(tcp->DstPort)); + + e = SearchHash(t->NatTableForRecv, &tt); + + if (e != NULL) + { + // Last communication time + e->LastCommTime = t->v->Now; + e->TotalRecv += (UINT64)size; + + // Rewrite the TCP header + tcp->Checksum = 0; + tcp->DstPort = Endian16(e->SrcPort); + + if (tcp->Flag & TCP_FIN || tcp->Flag & TCP_RST) + { + // Disconnect + e->Status = NAT_TCP_WAIT_DISCONNECT; + } + + if (tcp->Flag & TCP_SYN && tcp->Flag & TCP_ACK) + { + // Connection complete + if (e->Status != NAT_TCP_WAIT_DISCONNECT) + { + e->Status = NAT_TCP_ESTABLISHED; + } + } + + e->LastSeq = Endian32(tcp->AckNumber); + e->LastAck = Endian32(tcp->SeqNumber); + + // Checksum recalculation + tcp->Checksum = CalcChecksumForIPv4(src_ip, e->SrcIp, IP_PROTO_TCP, tcp, size, 0); + + // IP transmission + SendIp(t->v, e->SrcIp, src_ip, IP_PROTO_TCP, tcp, size); + } + } +} + +// An ICMP packet has been received +void NnIcmpReceived(NATIVE_NAT *t, UINT src_ip, UINT dest_ip, void *data, UINT size, UCHAR ttl, UINT max_l3_size) +{ + ICMP_HEADER *icmp; + // Validate arguments + if (t == NULL || data == NULL) + { + return; + } + if (ttl == 0) + { + ttl = 1; + } + + // ICMP header + if (size < sizeof(ICMP_HEADER)) + { + return; + } + + icmp = (ICMP_HEADER *)data; + + if (icmp->Type == ICMP_TYPE_ECHO_RESPONSE) + { + UCHAR *payload; + UINT payload_size; + ICMP_ECHO *echo; + NATIVE_NAT_ENTRY tt, *e; + + // Echo Response + echo = (ICMP_ECHO *)(((UCHAR *)data) + sizeof(ICMP_HEADER)); + + if (size < (sizeof(ICMP_HEADER) + sizeof(ICMP_ECHO))) + { + return; + } + + payload = ((UCHAR *)data) + sizeof(ICMP_HEADER) + sizeof(ICMP_ECHO); + payload_size = size - (sizeof(ICMP_HEADER) + sizeof(ICMP_ECHO)); + + // Search the NAT + NnSetNat(&tt, NAT_ICMP, 0, 0, 0, 0, dest_ip, Endian16(echo->Identifier)); + + e = SearchHash(t->NatTableForRecv, &tt); + + if (e != NULL) + { + // Rewrite the header + icmp->Checksum = 0; + echo->Identifier = Endian16(e->SrcPort); + icmp->Checksum = IpChecksum(icmp, size); + + e->LastCommTime = t->v->Now; + e->TotalRecv += (UINT64)size; + + // Transmission + SendIpEx(t->v, e->SrcIp, src_ip, IP_PROTO_ICMPV4, icmp, size, MAX(ttl - 1, 1)); + } + } + else if (icmp->Type == ICMP_TYPE_ECHO_REQUEST) + { + UCHAR *payload; + UINT payload_size; + ICMP_ECHO *echo; + + // Echo Response + echo = (ICMP_ECHO *)(((UCHAR *)data) + sizeof(ICMP_HEADER)); + + if (size < (sizeof(ICMP_HEADER) + sizeof(ICMP_ECHO))) + { + return; + } + + payload = ((UCHAR *)data) + sizeof(ICMP_HEADER) + sizeof(ICMP_ECHO); + payload_size = size - (sizeof(ICMP_HEADER) + sizeof(ICMP_ECHO)); + + if (dest_ip == t->PublicIP) + { + // Respond as soon as the Echo Request is received at the public side interface + ICMP_HEADER *ret_icmp; + ICMP_ECHO *ret_echo; + UINT ret_size = sizeof(ICMP_HEADER) + sizeof(ICMP_ECHO) + payload_size; + + ret_icmp = ZeroMalloc(ret_size); + ret_echo = (ICMP_ECHO *)(((UCHAR *)ret_icmp) + sizeof(ICMP_HEADER)); + + ret_icmp->Type = ICMP_TYPE_ECHO_RESPONSE; + ret_icmp->Code = icmp->Code; + + ret_echo->Identifier = echo->Identifier; + ret_echo->SeqNo = echo->SeqNo; + + Copy((UCHAR *)ret_icmp + sizeof(ICMP_HEADER) + sizeof(ICMP_ECHO), + payload, payload_size); + + ret_icmp->Checksum = IpChecksum(ret_icmp, ret_size); + + NnIpSendForInternet(t, IP_PROTO_ICMPV4, 0, dest_ip, src_ip, ret_icmp, ret_size, max_l3_size); + + Free(ret_icmp); + } + } + else + { + if (icmp->Type == ICMP_TYPE_DESTINATION_UNREACHABLE || icmp->Type == ICMP_TYPE_TIME_EXCEEDED) + { + // Rewrite the Src IP of the IPv4 header of the ICMP response packet + if (size >= (sizeof(ICMP_HEADER) + sizeof(ICMP_ECHO) + sizeof(IPV4_HEADER))) + { + IPV4_HEADER *orig_ipv4 = (IPV4_HEADER *)(((UCHAR *)data) + sizeof(ICMP_HEADER) + sizeof(ICMP_ECHO)); + UINT orig_ipv4_size = size - (sizeof(ICMP_HEADER) + sizeof(ICMP_ECHO)); + + UINT orig_ipv4_header_size = GetIpHeaderSize((UCHAR *)orig_ipv4, orig_ipv4_size); + + if (orig_ipv4_header_size >= sizeof(IPV4_HEADER) && orig_ipv4_size >= orig_ipv4_header_size) + { + if (orig_ipv4->Protocol == IP_PROTO_ICMPV4) + { + // Search the inner ICMP header + UINT inner_icmp_size = orig_ipv4_size - orig_ipv4_header_size; + + if (inner_icmp_size >= (sizeof(ICMP_HEADER) + sizeof(ICMP_ECHO))) + { + ICMP_HEADER *inner_icmp = (ICMP_HEADER *)(((UCHAR *)data) + + sizeof(ICMP_HEADER) + sizeof(ICMP_ECHO) + orig_ipv4_header_size); + + if (inner_icmp->Type == ICMP_TYPE_ECHO_REQUEST) + { + ICMP_ECHO *inner_echo = (ICMP_ECHO *)(((UCHAR *)inner_icmp) + sizeof(ICMP_HEADER)); + NATIVE_NAT_ENTRY tt, *e; + + // Search for the existing NAT table entry + NnSetNat(&tt, NAT_ICMP, 0, 0, 0, 0, orig_ipv4->SrcIP, Endian16(inner_echo->Identifier)); + + e = SearchHash(t->NatTableForRecv, &tt); + + if (e != NULL) + { + e->LastCommTime = t->v->Now; + + // Rewrite the inner IP packet and the ICMP header according to the NAT table + inner_echo->Identifier = Endian16(e->SrcPort); + inner_icmp->Checksum = 0; + + orig_ipv4->SrcIP = e->SrcIp; + + orig_ipv4->Checksum = 0; + orig_ipv4->Checksum = IpChecksum(orig_ipv4, orig_ipv4_header_size); + + // Rewrite the outer ICMP header + if (true) + { + UCHAR *payload; + UINT payload_size; + ICMP_ECHO *echo; + + // Echo Response + echo = (ICMP_ECHO *)(((UCHAR *)data) + sizeof(ICMP_HEADER)); + + if (size < (sizeof(ICMP_HEADER) + sizeof(ICMP_ECHO))) + { + return; + } + + payload = ((UCHAR *)data) + sizeof(ICMP_HEADER) + sizeof(ICMP_ECHO); + payload_size = size - (sizeof(ICMP_HEADER) + sizeof(ICMP_ECHO)); + + // Rewrite the header + icmp->Checksum = 0; + echo->Identifier = Endian16(e->SrcPort); + icmp->Checksum = IpChecksum(icmp, size); + + // Transmission + SendIpEx(t->v, e->SrcIp, src_ip, IP_PROTO_ICMPV4, icmp, size, MAX(ttl - 1, 1)); + } + } + } + } + } + } + } + } + } +} + +// An UDP packet has been received +void NnUdpReceived(NATIVE_NAT *t, UINT src_ip, UINT dest_ip, void *data, UINT size, UCHAR ttl, UINT max_l3_size) +{ + UDP_HEADER *udp; + UCHAR *payload; + UINT payload_size; + // Validate arguments + if (t == NULL || data == NULL) + { + return; + } + + // UDP header + if (size <= sizeof(UDP_HEADER)) + { + return; + } + + udp = (UDP_HEADER *)data; + + // Payload + payload = ((UCHAR *)data) + sizeof(UDP_HEADER); + payload_size = size - sizeof(UDP_HEADER); + + // Inspect the payload size + if (payload_size < (Endian16(udp->PacketLength) - sizeof(UDP_HEADER))) + { + return; + } + + // Truncate the payload + payload_size = Endian16(udp->PacketLength) - sizeof(UDP_HEADER); + + // Search the port number from the NAT table + if (true) + { + NATIVE_NAT_ENTRY tt; + NATIVE_NAT_ENTRY *e; + + NnSetNat(&tt, NAT_UDP, 0, 0, 0, 0, dest_ip, Endian16(udp->DstPort)); + + e = SearchHash(t->NatTableForRecv, &tt); + + if (e != NULL) + { + // Last communication time + e->LastCommTime = t->v->Now; + e->TotalRecv += (UINT64)payload_size; + + // Deliver to the client by rewriting the port number + SendUdp(t->v, e->SrcIp, e->SrcPort, src_ip, Endian16(udp->SrcPort), + payload, payload_size); + } + } +} + +// A combined IP packet is received +void NnIpReceived(NATIVE_NAT *t, UINT src_ip, UINT dest_ip, UINT protocol, void *data, UINT size, + UCHAR ttl, UCHAR *ip_header, UINT ip_header_size, UINT max_l3_size) +{ + // Validate arguments + if (t == NULL || data == NULL) + { + return; + } + + if (dest_ip != t->PublicIP) + { + // Destination IP is not a unicast + return; + } + + switch (protocol) + { + case IP_PROTO_UDP: + // UDP + NnUdpReceived(t, src_ip, dest_ip, data, size, ttl, max_l3_size); + break; + + case IP_PROTO_TCP: + // TCP + NnTcpReceived(t, src_ip, dest_ip, data, size, ttl, max_l3_size); + break; + + case IP_PROTO_ICMPV4: + // ICMP + NnIcmpReceived(t, src_ip, dest_ip, data, size, ttl, max_l3_size); + break; + } +} + +// Received an IP packet +void NnFragmentedIpReceived(NATIVE_NAT *t, PKT *packet) +{ + IPV4_HEADER *ip; + void *data; + UINT data_size_recved; + UINT size; + UINT ipv4_header_size; + bool last_packet = false; + UINT l3_size = 0; + UCHAR *head_ip_header_data = NULL; + UINT head_ip_header_size = 0; + // Validate arguments + if (t == NULL || packet == NULL) + { + return; + } + + ip = packet->L3.IPv4Header; + + // Get the size of the IPv4 header + ipv4_header_size = IPV4_GET_HEADER_LEN(packet->L3.IPv4Header) * 4; + head_ip_header_size = ipv4_header_size; + + // Get the pointer to the data + data = ((UCHAR *)packet->L3.PointerL3) + ipv4_header_size; + + // Get the data size + size = l3_size = Endian16(ip->TotalLength); + if (size <= ipv4_header_size) + { + // There is no data + return; + } + size -= ipv4_header_size; + + // Get the size of data actually received + data_size_recved = packet->PacketSize - (ipv4_header_size + MAC_HEADER_SIZE); + if (data_size_recved < size) + { + // Data insufficient (It may be missing on the way) + return; + } + + if (IPV4_GET_OFFSET(ip) == 0 && (IPV4_GET_FLAGS(ip) & 0x01) == 0) + { + // Because this packet has not been fragmented, it can be passed to the upper layer immediately + head_ip_header_data = (UCHAR *)packet->L3.IPv4Header; + NnIpReceived(t, ip->SrcIP, ip->DstIP, ip->Protocol, data, size, ip->TimeToLive, + head_ip_header_data, head_ip_header_size, l3_size); + } + else + { + // This packet is necessary to combine because it is fragmented + UINT offset = IPV4_GET_OFFSET(ip) * 8; + IP_COMBINE *c = NnSearchIpCombine(t, ip->SrcIP, ip->DstIP, Endian16(ip->Identification), ip->Protocol); + + if (offset == 0) + { + head_ip_header_data = (UCHAR *)packet->L3.IPv4Header; + } + + last_packet = ((IPV4_GET_FLAGS(ip) & 0x01) == 0 ? true : false); + + if (c != NULL) + { + // It is the second or subsequent packet + c->MaxL3Size = MAX(c->MaxL3Size, l3_size); + NnCombineIp(t, c, offset, data, size, last_packet, head_ip_header_data, head_ip_header_size); + } + else + { + // Create a combining object because it is the first packet + c = NnInsertIpCombine( + t, ip->SrcIP, ip->DstIP, Endian16(ip->Identification), ip->Protocol, packet->BroadcastPacket, + ip->TimeToLive, false); + if (c != NULL) + { + c->MaxL3Size = MAX(c->MaxL3Size, l3_size); + NnCombineIp(t, c, offset, data, size, last_packet, head_ip_header_data, head_ip_header_size); + } + } + } +} + +// Layer 2 packet processing +void NnLayer2(NATIVE_NAT *t, PKT *packet) +{ + // Validate arguments + if (t == NULL || packet == NULL) + { + return; + } + + if (packet->TypeL3 == L3_IPV4) + { + // IPv4 + NnFragmentedIpReceived(t, packet); + } +} + +// Extract the received packets of native NAT, and deliver it to the VPN client +void NnPoll(NATIVE_NAT *t) +{ + // Validate arguments + if (t == NULL) + { + return; + } + + LockQueue(t->RecvQueue); + { + while (true) + { + PKT *pkt = GetNext(t->RecvQueue); + + if (pkt == NULL) + { + break; + } + + NnLayer2(t, pkt); + + FreePacketWithData(pkt); + } + } + UnlockQueue(t->RecvQueue); + + if (t->SendStateChanged) + { + TUBE *halt_tube = NULL; + + Lock(t->Lock); + { + if (t->HaltTube != NULL) + { + halt_tube = t->HaltTube; + + AddRef(halt_tube->Ref); + } + } + Unlock(t->Lock); + + if (halt_tube != NULL) + { + TubeFlushEx(halt_tube, true); + + t->SendStateChanged = false; + + ReleaseTube(halt_tube); + } + } + + NnPollingIpCombine(t); + + NnDeleteOldSessions(t); +} + +// Send a fragmented IP packet to the Internet +void NnIpSendFragmentedForInternet(NATIVE_NAT *t, UCHAR ip_protocol, UINT src_ip, UINT dest_ip, USHORT id, USHORT total_size, + USHORT offset, void *data, UINT size, UCHAR ttl) +{ + UCHAR *buf; + IPV4_HEADER *ip; + BLOCK *b; + // Validate arguments + if (t == NULL || data == NULL) + { + return; + } + + // Memory allocation + buf = Malloc(size + IP_HEADER_SIZE); + ip = (IPV4_HEADER *)&buf[0]; + + // IP header construction + ip->VersionAndHeaderLength = 0; + IPV4_SET_VERSION(ip, 4); + IPV4_SET_HEADER_LEN(ip, (IP_HEADER_SIZE / 4)); + ip->TypeOfService = DEFAULT_IP_TOS; + ip->TotalLength = Endian16((USHORT)(size + IP_HEADER_SIZE)); + ip->Identification = Endian16(id); + ip->FlagsAndFragmentOffset[0] = ip->FlagsAndFragmentOffset[1] = 0; + IPV4_SET_OFFSET(ip, (offset / 8)); + if ((offset + size) >= total_size) + { + IPV4_SET_FLAGS(ip, 0x00); + } + else + { + IPV4_SET_FLAGS(ip, 0x01); + } + ip->TimeToLive = (ttl == 0 ? DEFAULT_IP_TTL : ttl); + ip->Protocol = ip_protocol; + ip->Checksum = 0; + ip->SrcIP = src_ip; + ip->DstIP = dest_ip; + + // Checksum calculation + ip->Checksum = IpChecksum(ip, IP_HEADER_SIZE); + + // Data copy + Copy(buf + IP_HEADER_SIZE, data, size); + + // Transmission + b = NewBlock(buf, size + IP_HEADER_SIZE, 0); + + LockQueue(t->SendQueue); + { + if (t->SendQueue->num_item <= NN_MAX_QUEUE_LENGTH) + { + InsertQueue(t->SendQueue, b); + + t->SendStateChanged = true; + } + else + { + FreeBlock(b); + } + } + UnlockQueue(t->SendQueue); +} + +// Send an IP packet to the Internet +void NnIpSendForInternet(NATIVE_NAT *t, UCHAR ip_protocol, UCHAR ttl, UINT src_ip, UINT dest_ip, void *data, UINT size, UINT max_l3_size) +{ + UINT mss = 0; + UCHAR *buf; + USHORT offset; + USHORT id; + USHORT total_size; + UINT size_of_this_packet; + // Validate arguments + if (t == NULL || data == NULL) + { + return; + } + + // Maximum segment size + if (max_l3_size > IP_HEADER_SIZE) + { + mss = max_l3_size - IP_HEADER_SIZE; + } + + if (mss == 0) + { + mss = t->v->IpMss; + } + + mss = MAX(mss, 1000); + + // Buffer + buf = (UCHAR *)data; + + // ID + id = (t->NextId++); + + // Total size + total_size = (USHORT)size; + + // Start to fragment + offset = 0; + + while (true) + { + bool last_packet = false; + // Get the size of this packet + size_of_this_packet = MIN((USHORT)mss, (total_size - offset)); + if ((offset + (USHORT)size_of_this_packet) == total_size) + { + last_packet = true; + } + + // Transmit the fragmented packet + NnIpSendFragmentedForInternet(t, ip_protocol, src_ip, dest_ip, id, total_size, offset, + buf + offset, size_of_this_packet, ttl); + if (last_packet) + { + break; + } + + offset += (USHORT)size_of_this_packet; + } +} + +// Communication of ICMP towards the Internet +void NnIcmpEchoRecvForInternet(VH *v, UINT src_ip, UINT dest_ip, void *data, UINT size, UCHAR ttl, void *icmp_data, UINT icmp_size, UCHAR *ip_header, UINT ip_header_size, UINT max_l3_size) +{ + NATIVE_NAT_ENTRY tt; + NATIVE_NAT_ENTRY *e; + NATIVE_NAT *t; + USHORT src_port; + ICMP_HEADER *old_icmp_header; + ICMP_ECHO *old_icmp_echo; + ICMP_HEADER *icmp; + ICMP_ECHO *echo; + UCHAR *payload_data; + UINT payload_size; + // Validate arguments + if (NnIsActive(v) == false || icmp_data == NULL) + { + return; + } + + t = v->NativeNat; + + old_icmp_header = (ICMP_HEADER *)icmp_data; + old_icmp_echo = (ICMP_ECHO *)(((UCHAR *)icmp_data) + sizeof(ICMP_HEADER)); + + if (size < (sizeof(ICMP_HEADER) + sizeof(ICMP_ECHO))) + { + return; + } + + payload_data = ((UCHAR *)icmp_data) + (sizeof(ICMP_HEADER) + sizeof(ICMP_ECHO)); + payload_size = icmp_size - (sizeof(ICMP_HEADER) + sizeof(ICMP_ECHO)); + + if (dest_ip == v->HostIP) + { + // Respond because it is addressed to me + VirtualIcmpEchoSendResponse(v, dest_ip, src_ip, Endian16(old_icmp_echo->Identifier), + Endian16(old_icmp_echo->SeqNo), payload_data, payload_size); + + return; + } + + if (ttl <= 1) + { + // Reply the Time Exceeded immediately for the packet whose TTL is 1 + UINT reply_size = sizeof(ICMP_HEADER) + 4 + ip_header_size + 8; + UCHAR *reply_data = ZeroMalloc(reply_size); + ICMP_HEADER *icmp = (ICMP_HEADER *)reply_data; + icmp->Type = ICMP_TYPE_TIME_EXCEEDED; + icmp->Code = ICMP_CODE_TTL_EXCEEDED_IN_TRANSIT; + Copy(reply_data + sizeof(ICMP_HEADER) + 4, ip_header, ip_header_size); + Copy(reply_data + sizeof(ICMP_HEADER) + 4 + ip_header_size, icmp_data, MIN(icmp_size, 8)); + + icmp->Checksum = IpChecksum(icmp, reply_size); + + SendIp(v, src_ip, v->HostIP, IP_PROTO_ICMPV4, reply_data, reply_size); + + Free(reply_data); + + return; + } + + src_port = Endian16(old_icmp_echo->Identifier); + + // Search whether there is an existing session + NnSetNat(&tt, NAT_ICMP, src_ip, src_port, 0, 0, 0, 0); + + e = SearchHash(t->NatTableForSend, &tt); + + if (e == NULL) + { + // Create a new session because there is no existing one + UINT public_port; + + if (CanCreateNewNatEntry(v) == false) + { + // Can not make any more + return; + } + + NnDeleteOldestNatSessionIfNecessary(t, src_ip, NAT_ICMP); + + // Get a free port + public_port = NnMapNewPublicPort(t, NAT_ICMP, 0, 0, t->PublicIP); + if (public_port == 0) + { + // There are no free ports + return; + } + + e = ZeroMalloc(sizeof(NATIVE_NAT_ENTRY)); + + e->Status = NAT_TCP_ESTABLISHED; + + e->HashCodeForSend = INFINITE; + e->HashCodeForRecv = INFINITE; + e->Id = Inc(v->Counter); + e->Protocol = NAT_ICMP; + e->SrcIp = src_ip; + e->SrcPort = src_port; + e->DestIp = 0; + e->DestPort = 0; + e->PublicIp = t->PublicIP; + e->PublicPort = public_port; + + e->CreatedTime = v->Now; + e->LastCommTime = v->Now; + + // Add to the list + AddHash(t->NatTableForSend, e); + AddHash(t->NatTableForRecv, e); + + // Log + if (true) + { + IP ip1, ip2; + char s1[MAX_SIZE], s2[MAX_SIZE]; + UINTToIP(&ip1, src_ip); + UINTToIP(&ip2, dest_ip); + IPToStr(s1, 0, &ip1); + IPToStr(s2, 0, &ip2); + + Debug("ICMP Session %u: %s:0x%x -> %s:0x%x\n", e->Id, s1, src_port, s2, public_port); + } + } + + // Rebuild the ICMP header + icmp = ZeroMalloc(sizeof(ICMP_HEADER) + sizeof(ICMP_ECHO) + payload_size); + icmp->Code = old_icmp_header->Code; + icmp->Type = old_icmp_header->Type; + icmp->Checksum = 0; + + echo = (ICMP_ECHO *)(((UCHAR *)icmp) + sizeof(ICMP_HEADER)); + echo->SeqNo = old_icmp_echo->SeqNo; + echo->Identifier = Endian16(e->PublicPort); + + Copy(((UCHAR *)icmp) + sizeof(ICMP_HEADER) + sizeof(ICMP_ECHO), payload_data, payload_size); + + icmp->Checksum = IpChecksum(icmp, sizeof(ICMP_HEADER) + sizeof(ICMP_ECHO) + payload_size); + + e->TotalSent += (UINT64)payload_size; + e->LastCommTime = v->Now; + + // Send to the Internet + NnIpSendForInternet(t, IP_PROTO_ICMPV4, ttl - 1, e->PublicIp, dest_ip, icmp, sizeof(ICMP_HEADER) + sizeof(ICMP_ECHO) + payload_size, max_l3_size); + + Free(icmp); +} + +// Communication of UDP towards the Internet +void NnUdpRecvForInternet(VH *v, UINT src_ip, UINT src_port, UINT dest_ip, UINT dest_port, void *data, UINT size, UINT max_l3_size) +{ + NATIVE_NAT_ENTRY tt; + NATIVE_NAT_ENTRY *e; + NATIVE_NAT *t; + UDP_HEADER *udp; + // Validate arguments + if (NnIsActive(v) == false || data == NULL) + { + return; + } + + t = v->NativeNat; + + // Search whether there is an existing session + NnSetNat(&tt, NAT_UDP, src_ip, src_port, 0, 0, 0, 0); + + e = SearchHash(t->NatTableForSend, &tt); + + if (e == NULL) + { + // Create a new session because there is no existing one + UINT public_port; + + if (CanCreateNewNatEntry(v) == false) + { + // Can not make any more + return; + } + + NnDeleteOldestNatSessionIfNecessary(t, src_ip, NAT_UDP); + + // Get a free port + public_port = NnMapNewPublicPort(t, NAT_UDP, 0, 0, t->PublicIP); + if (public_port == 0) + { + // There are no free ports + return; + } + + e = ZeroMalloc(sizeof(NATIVE_NAT_ENTRY)); + + e->Status = NAT_TCP_ESTABLISHED; + + e->HashCodeForSend = INFINITE; + e->HashCodeForRecv = INFINITE; + e->Id = Inc(v->Counter); + e->Protocol = NAT_UDP; + e->SrcIp = src_ip; + e->SrcPort = src_port; + e->DestIp = 0; + e->DestPort = 0; + e->PublicIp = t->PublicIP; + e->PublicPort = public_port; + + e->CreatedTime = v->Now; + e->LastCommTime = v->Now; + + // Add to the list + AddHash(t->NatTableForSend, e); + AddHash(t->NatTableForRecv, e); + + // Log + if (true) + { + IP ip1, ip2; + char s1[MAX_SIZE], s2[MAX_SIZE]; + UINTToIP(&ip1, src_ip); + UINTToIP(&ip2, dest_ip); + IPToStr(s1, 0, &ip1); + IPToStr(s2, 0, &ip2); + + NLog(v, "LH_NAT_UDP_CREATED", e->Id, s1, src_port, s2, dest_port); + } + } + + // Rebuild the UDP header + udp = ZeroMalloc(sizeof(UDP_HEADER) + size); + + udp->SrcPort = Endian16(e->PublicPort); + udp->DstPort = Endian16(dest_port); + udp->PacketLength = Endian16((USHORT)sizeof(UDP_HEADER) + size); + + Copy(((UCHAR *)udp) + sizeof(UDP_HEADER), data, size); + + udp->Checksum = CalcChecksumForIPv4(e->PublicIp, dest_ip, IP_PROTO_UDP, udp, sizeof(UDP_HEADER) + size, 0); + + e->TotalSent += (UINT64)size; + e->LastCommTime = v->Now; + + // Send to the Internet + NnIpSendForInternet(t, IP_PROTO_UDP, 127, e->PublicIp, dest_ip, udp, sizeof(UDP_HEADER) + size, max_l3_size); + + Free(udp); +} + +// Communication of TCP towards the Internet +void NnTcpRecvForInternet(VH *v, UINT src_ip, UINT src_port, UINT dest_ip, UINT dest_port, TCP_HEADER *old_tcp, void *data, UINT size, UINT max_l3_size) +{ + NATIVE_NAT_ENTRY tt; + NATIVE_NAT_ENTRY *e; + NATIVE_NAT *t; + UINT tcp_header_size; + TCP_HEADER *tcp; + // Validate arguments + if (NnIsActive(v) == false || old_tcp == NULL || data == NULL) + { + return; + } + + t = v->NativeNat; + + // Search whether there is an existing session + NnSetNat(&tt, NAT_TCP, src_ip, src_port, dest_ip, dest_port, 0, 0); + + e = SearchHash(t->NatTableForSend, &tt); + + if (e == NULL) + { + // Create a new session because there is no existing one + UINT public_port; + + if (((old_tcp->Flag & TCP_SYN) && ((old_tcp->Flag & TCP_ACK) == 0)) == false) + { + // If there is no existing session, pass through only for SYN packet + return; + } + + if (CanCreateNewNatEntry(v) == false) + { + // Can not make any more + return; + } + + NnDeleteOldestNatSessionIfNecessary(t, src_ip, NAT_TCP); + + // Get a free port + public_port = NnMapNewPublicPort(t, NAT_TCP, dest_ip, dest_port, t->PublicIP); + if (public_port == 0) + { + // There are no free ports + return; + } + + e = ZeroMalloc(sizeof(NATIVE_NAT_ENTRY)); + + e->HashCodeForSend = INFINITE; + e->HashCodeForRecv = INFINITE; + e->Id = Inc(v->Counter); + e->Status = NAT_TCP_CONNECTING; + e->Protocol = NAT_TCP; + e->SrcIp = src_ip; + e->SrcPort = src_port; + e->DestIp = dest_ip; + e->DestPort = dest_port; + e->PublicIp = t->PublicIP; + e->PublicPort = public_port; + + e->CreatedTime = v->Now; + e->LastCommTime = v->Now; + + // Add to the list + AddHash(t->NatTableForSend, e); + AddHash(t->NatTableForRecv, e); + + // Log + if (true) + { + IP ip1, ip2; + char s1[MAX_SIZE], s2[MAX_SIZE]; + UINTToIP(&ip1, src_ip); + UINTToIP(&ip2, dest_ip); + IPToStr(s1, 0, &ip1); + IPToStr(s2, 0, &ip2); + + NLog(v, "LH_NAT_TCP_CREATED", e->Id, s1, src_port, s2, dest_port); + } + } + + // Update the last communication time + e->LastCommTime = v->Now; + + e->TotalSent += (UINT64)size; + + tcp_header_size = TCP_GET_HEADER_SIZE(old_tcp) * 4; + + // Create a new TCP packet + tcp = ZeroMalloc(tcp_header_size + size); + + // Copy the old TCP header + Copy(tcp, old_tcp, tcp_header_size); + + if (tcp->Flag & TCP_RST || tcp->Flag & TCP_FIN) + { + // Disconnect + e->Status = NAT_TCP_WAIT_DISCONNECT; + } + + // Rewrite the TCP header + tcp->Checksum = 0; + tcp->SrcPort = Endian16(e->PublicPort); + + e->LastSeq = Endian32(tcp->SeqNumber); + e->LastAck = Endian32(tcp->AckNumber); + + // Payload + Copy(((UCHAR *)tcp) + tcp_header_size, data, size); + + // Checksum calculation + tcp->Checksum = CalcChecksumForIPv4(e->PublicIp, dest_ip, IP_PROTO_TCP, tcp, tcp_header_size + size, 0); + + // Send to the Internet + NnIpSendForInternet(t, IP_PROTO_TCP, 127, e->PublicIp, dest_ip, tcp, tcp_header_size + size, max_l3_size); + + Free(tcp); +} + +// Assign a new public-side port +UINT NnMapNewPublicPort(NATIVE_NAT *t, UINT protocol, UINT dest_ip, UINT dest_port, UINT public_ip) +{ + UINT i; + UINT base_port; + UINT port_start = 1025; + UINT port_end = 65500; + // Validate arguments + if (t == NULL) + { + return 0; + } + + if (t->IsRawIpMode) + { + port_start = NN_RAW_IP_PORT_START; + port_end = NN_RAW_IP_PORT_END; + } + + base_port = Rand32() % (port_end - port_start) + port_start; + + for (i = 0; i < (port_end - port_start); i++) + { + UINT port; + NATIVE_NAT_ENTRY tt; + NATIVE_NAT *e; + + port = base_port + i; + if (port > port_end) + { + port = port - port_end + port_start; + } + + // Is this port vacant? + NnSetNat(&tt, protocol, 0, 0, dest_ip, dest_port, public_ip, port); + + e = SearchHash(t->NatTableForRecv, &tt); + + if (e == NULL) + { + // Free port is found + return port; + } + } + + return 0; +} + +// Examine whether the native NAT is available +bool NnIsActive(VH *v) +{ + return NnIsActiveEx(v, NULL); +} +bool NnIsActiveEx(VH *v, bool *is_ipraw_mode) +{ + // Validate arguments + if (v == NULL) + { + return false; + } + + if (v->NativeNat == NULL) + { + return false; + } + + if (v->NativeNat->PublicIP == 0) + { + return false; + } + + if (v->NativeNat->Active) + { + if (is_ipraw_mode != NULL) + { + *is_ipraw_mode = v->NativeNat->IsRawIpMode; + } + } + + return v->NativeNat->Active; +} + +// Native NAT main loop +void NnMainLoop(NATIVE_NAT *t, NATIVE_STACK *a) +{ + IPC *ipc; + TUBE *tubes[3]; + UINT num_tubes = 0; + UINT64 next_poll_tick = 0; + INTERRUPT_MANAGER *interrupt; + USHORT dns_src_port = 0; + USHORT dns_tran_id = 0; + USHORT tcp_src_port = 0; + UINT tcp_seq = 0; + IP yahoo_ip; + bool wait_for_dns = false; + UINT64 tcp_last_recv_tick = 0; + UINT dhcp_renew_interval; + UINT64 next_dhcp_renew_tick = 0; + // Validate arguments + if (t == NULL || a == NULL) + { + return; + } + + dhcp_renew_interval = a->CurrentDhcpOptionList.LeaseTime; + + if (dhcp_renew_interval == 0) + { + dhcp_renew_interval = IPC_DHCP_DEFAULT_LEASE; + } + + dhcp_renew_interval = MAX(dhcp_renew_interval, IPC_DHCP_MIN_LEASE) / 2; + + interrupt = NewInterruptManager(); + + ipc = a->Ipc; + + tubes[num_tubes++] = ipc->Sock->RecvTube; + //tubes[num_tubes++] = ipc->Sock->SendTube; // bug 2015.10.01 remove + tubes[num_tubes++] = t->HaltTube; + + Zero(&yahoo_ip, sizeof(yahoo_ip)); + + next_poll_tick = Tick64() + (UINT64)NN_POLL_CONNECTIVITY_INTERVAL; + AddInterrupt(interrupt, next_poll_tick); + + tcp_last_recv_tick = Tick64(); + next_dhcp_renew_tick = Tick64() + (UINT64)dhcp_renew_interval * 1000; + AddInterrupt(interrupt, next_dhcp_renew_tick); + + while (t->Halt == false && t->v->UseNat) + { + UINT64 now = Tick64(); + bool call_cancel = false; + bool state_changed = false; + UINT wait_interval; + + if (t->v->HubOption != NULL) + { + if (t->IsRawIpMode == false && t->v->HubOption->DisableKernelModeSecureNAT) + { + break; + } + if (t->IsRawIpMode && t->v->HubOption->DisableIpRawModeSecureNAT) + { + break; + } + } + + IPCFlushArpTable(ipc); + call_cancel = false; + +LABEL_RESTART: + state_changed = false; + + if (next_poll_tick == 0 || next_poll_tick <= now) + { + BUF *dns_query; + + dns_src_port = NnGenSrcPort(a->IsIpRawMode); + dns_tran_id = Rand16(); + + // Start a connectivity check periodically + dns_query = NnBuildIpPacket(NnBuildUdpPacket(NnBuildDnsQueryPacket(NN_CHECK_HOSTNAME, dns_tran_id), + IPToUINT(&ipc->ClientIPAddress), dns_src_port, IPToUINT(&a->DnsServerIP), 53), + IPToUINT(&ipc->ClientIPAddress), IPToUINT(&a->DnsServerIP), IP_PROTO_UDP, 0); + + IPCSendIPv4(ipc, dns_query->Buf, dns_query->Size); + + wait_for_dns = true; + + FreeBuf(dns_query); + + next_poll_tick = now + (UINT64)NN_POLL_CONNECTIVITY_INTERVAL; + AddInterrupt(interrupt, next_poll_tick); + } + + if (next_dhcp_renew_tick == 0 || next_dhcp_renew_tick <= now) + { + IP ip; + + UINTToIP(&ip, a->CurrentDhcpOptionList.ServerAddress); + + IPCDhcpRenewIP(ipc, &ip); + + next_dhcp_renew_tick = now + (UINT64)dhcp_renew_interval * 1000; + AddInterrupt(interrupt, next_dhcp_renew_tick); + } + + // Send an IP packet to IPC + LockQueue(t->SendQueue); + { + while (true) + { + BLOCK *b = GetNext(t->SendQueue); + + if (b == NULL) + { + break; + } + + IPCSendIPv4(ipc, b->Buf, b->Size); + + state_changed = true; + + FreeBlock(b); + } + } + UnlockQueue(t->SendQueue); + + // Happy processing + IPCProcessL3EventsIPv4Only(ipc); + + LockQueue(t->RecvQueue); + { + while (true) + { + // Receive an IP packet from IPC + BLOCK *b = IPCRecvIPv4(ipc); + PKT *pkt; + + if (b == NULL) + { + // Can not receive any more + break; + } + + // Parse the packet + pkt = ParsePacketIPv4WithDummyMacHeader(b->Buf, b->Size); + + FreeBlock(b); + + if (pkt != NULL) + { + bool no_store = false; + + // Read the contents of the packet first, to determine whether it is a response for the connectivity test packet + if (wait_for_dns) + { + if (pkt->TypeL3 == L3_IPV4 && pkt->TypeL4 == L4_UDP && + pkt->L3.IPv4Header->SrcIP == IPToUINT(&a->DnsServerIP) && + pkt->L3.IPv4Header->DstIP == IPToUINT(&ipc->ClientIPAddress) && + pkt->L4.UDPHeader->SrcPort == Endian16(53) && pkt->L4.UDPHeader->DstPort == Endian16(dns_src_port)) + { + DNSV4_HEADER *dns_header = (DNSV4_HEADER *)pkt->Payload; + if (pkt->PayloadSize >= sizeof(DNSV4_HEADER)) + { + if (dns_header->TransactionId == Endian16(dns_tran_id)) + { + IP ret_ip; + + if (NnParseDnsResponsePacket(pkt->Payload, pkt->PayloadSize, &ret_ip)) + { + BUF *tcp_query; + + Copy(&yahoo_ip, &ret_ip, sizeof(IP)); + + //SetIP(&yahoo_ip, 192, 168, 2, 32); + + // DNS response has been received + no_store = true; + + tcp_src_port = NnGenSrcPort(a->IsIpRawMode); + + // Generate a TCP connection attempt packet + tcp_seq = Rand32(); + tcp_query = NnBuildIpPacket(NnBuildTcpPacket(NewBuf(), IPToUINT(&ipc->ClientIPAddress), tcp_src_port, + IPToUINT(&yahoo_ip), 80, tcp_seq, 0, TCP_SYN, 8192, 1414), + IPToUINT(&ipc->ClientIPAddress), IPToUINT(&yahoo_ip), IP_PROTO_TCP, 0); + + IPCSendIPv4(ipc, tcp_query->Buf, tcp_query->Size); + + FreeBuf(tcp_query); + + wait_for_dns = false; + } + } + } + } + } + + if (pkt->TypeL3 == L3_IPV4 && pkt->TypeL4 == L4_TCP && + pkt->L3.IPv4Header->SrcIP == IPToUINT(&yahoo_ip) && + pkt->L3.IPv4Header->DstIP == IPToUINT(&ipc->ClientIPAddress) && + pkt->L4.TCPHeader->SrcPort == Endian16(80) && pkt->L4.TCPHeader->DstPort == Endian16(tcp_src_port)) + { + TCP_HEADER *tcp_header = (TCP_HEADER *)pkt->L4.TCPHeader; + if ((tcp_header->Flag & TCP_SYN) && (tcp_header->Flag & TCP_ACK)) + { + // There was a TCP response + BUF *tcp_query; + UINT recv_seq = Endian32(tcp_header->SeqNumber) + 1; + + no_store = true; + + // Send a RST + tcp_query = NnBuildIpPacket(NnBuildTcpPacket(NewBuf(), IPToUINT(&ipc->ClientIPAddress), tcp_src_port, + IPToUINT(&yahoo_ip), 80, tcp_seq + 1, recv_seq, TCP_RST | TCP_ACK, 8192, 0), + IPToUINT(&ipc->ClientIPAddress), IPToUINT(&yahoo_ip), IP_PROTO_TCP, 0); + + IPCSendIPv4(ipc, tcp_query->Buf, tcp_query->Size); + + FreeBuf(tcp_query); + + tcp_last_recv_tick = now; + } + } + + if (t->RecvQueue->num_item > NN_MAX_QUEUE_LENGTH) + { + no_store = true; + } + + if (no_store == false) + { + // Put in the queue + InsertQueue(t->RecvQueue, pkt); + call_cancel = true; + state_changed = true; + } + else + { + // Release the packet + FreePacketWithData(pkt); + } + } + } + } + UnlockQueue(t->RecvQueue); + + if (state_changed) + { + goto LABEL_RESTART; + } + + if (call_cancel) + { + CANCEL *c = NULL; + + Lock(t->CancelLock); + { + c = t->Cancel; + + AddRef(c->ref); + } + Unlock(t->CancelLock); + + Cancel(c); + + ReleaseCancel(c); + } + + if (IsTubeConnected(ipc->Sock->RecvTube) == false || IsTubeConnected(ipc->Sock->SendTube) == false) + { + // Disconnected + break; + } + + if ((tcp_last_recv_tick + (UINT64)NN_POLL_CONNECTIVITY_TIMEOUT) < now) + { + // Connectivity test has timed out because a certain period of time has elapsed + Debug("NN_POLL_CONNECTIVITY_TIMEOUT\n"); + break; + } + + wait_interval = GetNextIntervalForInterrupt(interrupt); + wait_interval = MIN(wait_interval, 1234); + + if (wait_interval != 0) + { + WaitForTubes(tubes, num_tubes, wait_interval); + } + } + + FreeInterruptManager(interrupt); +} + +// Build an IP packet +BUF *NnBuildIpPacket(BUF *payload, UINT src_ip, UINT dst_ip, UCHAR protocol, UCHAR ttl) +{ + BUF *ret = NewBuf(); + IPV4_HEADER h; + + if (ttl == 0) + { + ttl = 127; + } + + // IP header + Zero(&h, sizeof(h)); + IPV4_SET_VERSION(&h, 4); + IPV4_SET_HEADER_LEN(&h, sizeof(IPV4_HEADER) / 4); + h.TotalLength = Endian16((USHORT)sizeof(IPV4_HEADER) + payload->Size); + h.Identification = Rand16(); + h.TimeToLive = ttl; + h.Protocol = protocol; + h.SrcIP = src_ip; + h.DstIP = dst_ip; + + h.Checksum = IpChecksum(&h, sizeof(h)); + + WriteBuf(ret, &h, sizeof(h)); + WriteBufBuf(ret, payload); + + SeekBufToBegin(ret); + + FreeBuf(payload); + + return ret; +} + +// Build an UDP packet +BUF *NnBuildUdpPacket(BUF *payload, UINT src_ip, USHORT src_port, UINT dst_ip, USHORT dst_port) +{ + BUF *ret = NewBuf(); + BUF *phbuf = NewBuf(); + UDPV4_PSEUDO_HEADER ph; + UDP_HEADER h; + + // UDP pseudo header + Zero(&ph, sizeof(ph)); + + ph.SrcIP = src_ip; + ph.DstIP = dst_ip; + ph.SrcPort = Endian16(src_port); + ph.DstPort = Endian16(dst_port); + ph.Protocol = IP_PROTO_UDP; + ph.PacketLength1 = ph.PacketLength2 = Endian16(payload->Size + (USHORT)sizeof(UDP_HEADER)); + + WriteBuf(phbuf, &ph, sizeof(ph)); + WriteBufBuf(phbuf, payload); + + // UDP header + Zero(&h, sizeof(h)); + h.SrcPort = Endian16(src_port); + h.DstPort = Endian16(dst_port); + h.PacketLength = Endian16(payload->Size + (USHORT)sizeof(UDP_HEADER)); + h.Checksum = IpChecksum(phbuf->Buf, phbuf->Size); + + WriteBuf(ret, &h, sizeof(h)); + WriteBuf(ret, payload->Buf, payload->Size); + + SeekBufToBegin(ret); + + FreeBuf(payload); + FreeBuf(phbuf); + + return ret; +} + +// Build a TCP packet +BUF *NnBuildTcpPacket(BUF *payload, UINT src_ip, USHORT src_port, UINT dst_ip, USHORT dst_port, UINT seq, UINT ack, UINT flag, UINT window_size, UINT mss) +{ + BUF *ret; + IPV4_PSEUDO_HEADER *vh; + TCP_HEADER *tcp; + static UCHAR tcp_mss_option[] = {0x02, 0x04, 0x00, 0x00, 0x01, 0x01, 0x01, 0x00}; + UINT header_size = TCP_HEADER_SIZE; + UINT total_size; + + // Memory allocation + vh = Malloc(sizeof(IPV4_PSEUDO_HEADER) + TCP_HEADER_SIZE + payload->Size + 32); + tcp = (TCP_HEADER *)(((UCHAR *)vh) + sizeof(IPV4_PSEUDO_HEADER)); + + if (mss != 0) + { + USHORT *mss_size; + mss_size = (USHORT *)(&tcp_mss_option[2]); + *mss_size = Endian16((USHORT)mss); + header_size += sizeof(tcp_mss_option); + } + + total_size = header_size + payload->Size; + + // Pseudo header generation + vh->SrcIP = src_ip; + vh->DstIP = dst_ip; + vh->Reserved = 0; + vh->Protocol = IP_PROTO_TCP; + vh->PacketLength = Endian16((USHORT)total_size); + + // TCP header generation + tcp->SrcPort = Endian16((USHORT)src_port); + tcp->DstPort = Endian16((USHORT)dst_port); + tcp->SeqNumber = Endian32(seq); + tcp->AckNumber = Endian32(ack); + tcp->HeaderSizeAndReserved = 0; + TCP_SET_HEADER_SIZE(tcp, (UCHAR)(header_size / 4)); + tcp->Flag = (UCHAR)flag; + tcp->WindowSize = Endian16((USHORT)window_size); + tcp->Checksum = 0; + tcp->UrgentPointer = 0; + + // Copy the option values + if (mss != 0) + { + Copy(((UCHAR *)tcp) + TCP_HEADER_SIZE, tcp_mss_option, sizeof(tcp_mss_option)); + } + + // Data copy + Copy(((UCHAR *)tcp) + header_size, payload->Buf, payload->Size); + + // Checksum calculation + tcp->Checksum = IpChecksum(vh, total_size + 12); + + ret = NewBufFromMemory(tcp, total_size); + + Free(vh); + + FreeBuf(payload); + + return ret; +} + +// Build a DNS query packet +BUF *NnBuildDnsQueryPacket(char *hostname, USHORT tran_id) +{ + BUF *buf = NewBuf(); + DNSV4_HEADER header; + + Zero(&header, sizeof(header)); + + header.TransactionId = Endian16(tran_id); + header.Flag1 = 0x01; + header.Flag2 = 0x00; + header.NumQuery = Endian16(1); + + WriteBuf(buf, &header, sizeof(header)); + + BuildDnsQueryPacket(buf, hostname, false); + + SeekBufToBegin(buf); + + return buf; +} + +// Read a DNS record +BUF *NnReadDnsRecord(BUF *buf, bool answer, USHORT *ret_type, USHORT *ret_class) +{ + USHORT type; + USHORT clas; + UINT ttl; + BUF *ret = NULL; + // Validate arguments + if (buf == NULL) + { + return NULL; + } + + // Read the DNS label + if (NnReadDnsLabel(buf) == false) + { + return false; + } + + // Type and Class + if (ReadBuf(buf, &type, sizeof(USHORT)) != sizeof(USHORT)) + { + return false; + } + + if (ret_type != NULL) + { + *ret_type = Endian16(type); + } + + if (ReadBuf(buf, &clas, sizeof(USHORT)) != sizeof(USHORT)) + { + return false; + } + + if (ret_class != NULL) + { + *ret_class = Endian16(clas); + } + + if (answer) + { + USHORT data_len; + UCHAR *data; + + // TTL + if (ReadBuf(buf, &ttl, sizeof(UINT)) != sizeof(UINT)) + { + return false; + } + + // data_len + if (ReadBuf(buf, &data_len, sizeof(USHORT)) != sizeof(USHORT)) + { + return false; + } + + data_len = Endian16(data_len); + + // data + data = Malloc(data_len); + if (ReadBuf(buf, data, data_len) != data_len) + { + Free(data); + return false; + } + + ret = NewBufFromMemory(data, data_len); + + Free(data); + } + else + { + ret = NewBuf(); + } + + return ret; +} + +// Read the DNS label +bool NnReadDnsLabel(BUF *buf) +{ + UCHAR c; + UCHAR tmp[256]; + // Validate arguments + if (buf == NULL) + { + return false; + } + +LABEL_START: + + if (ReadBuf(buf, &c, 1) != 1) + { + return false; + } + + if (c == 0) + { + return true; + } + + if (c & 0xC0) + { + // Compression label + if (ReadBuf(buf, &c, 1) != 1) + { + return false; + } + else + { + return true; + } + } + else + { + // Usual label + if (ReadBuf(buf, tmp, c) != c) + { + return false; + } + else + { + goto LABEL_START; + } + } + +} + +// Parse the DNS response packet +bool NnParseDnsResponsePacket(UCHAR *data, UINT size, IP *ret_ip) +{ + BUF *buf = NewBufFromMemory(data, size); + bool ret = false; + DNSV4_HEADER h; + + if (ReadBuf(buf, &h, sizeof(h)) == sizeof(h)) + { + UINT num_questions = Endian16(h.NumQuery); + UINT num_answers = Endian16(h.AnswerRRs); + UINT i; + + for (i = 0; i < num_questions; i++) + { + BUF *r = NnReadDnsRecord(buf, false, NULL, NULL); + + if (r != NULL) + { + FreeBuf(r); + } + else + { + goto LABEL_CLEANUP; + } + } + + for (i = 0; i < num_answers; i++) + { + USHORT tp, cl; + BUF *r = NnReadDnsRecord(buf, true, &tp, &cl); + + if (r != NULL) + { + if (tp == 0x0001 && cl == 0x0001 && r->Size == 4) + { + ret = true; + + if (ret_ip != NULL) + { + Zero(ret_ip, sizeof(IP)); + + Copy(ret_ip->addr, r->Buf, 4); + } + } + + FreeBuf(r); + } + else + { + goto LABEL_CLEANUP; + } + } + } + +LABEL_CLEANUP: + FreeBuf(buf); + + return ret; +} + +// Test the connectivity of the stack to the Internet +bool NnTestConnectivity(NATIVE_STACK *a, TUBE *halt_tube) +{ + BUF *dns_query; + BUF *dns_query2; + bool ok = false; + USHORT dns_tran_id = Rand16(); + UINT64 next_send_tick = 0; + UINT64 giveup_time; + IPC *ipc; + INTERRUPT_MANAGER *interrupt; + TUBE *tubes[3]; + UINT num_tubes = 0; + IP yahoo_ip; + IP my_priv_ip; + UINT num_send_dns = 0; + IP using_dns; + UINT src_port = 0; + // Validate arguments + if (a == NULL) + { + return false; + } + + src_port = NnGenSrcPort(a->IsIpRawMode); + + Copy(&using_dns, &a->DnsServerIP, sizeof(IP)); + + // Get my physical IP + if (a->IsIpRawMode) + { + if (GetMyPrivateIP(&my_priv_ip, false) == false) + { + Debug("NnTestConnectivity: GetMyPrivateIP failed.\n"); + return false; + } + else + { + Debug("NnTestConnectivity: GetMyPrivateIP ok: %r\n", &my_priv_ip); + + if (a->Eth != NULL) + { + Copy(&a->Eth->MyPhysicalIPForce, &my_priv_ip, sizeof(IP)); + } + } + } + + ipc = a->Ipc; + interrupt = NewInterruptManager(); + + tubes[num_tubes++] = ipc->Sock->RecvTube; + tubes[num_tubes++] = ipc->Sock->SendTube; + + if (halt_tube != NULL) + { + tubes[num_tubes++] = halt_tube; + } + + Zero(&yahoo_ip, sizeof(yahoo_ip)); + + // Try to get an IP address of www.yahoo.com + dns_query = NnBuildIpPacket(NnBuildUdpPacket(NnBuildDnsQueryPacket(NN_CHECK_HOSTNAME, dns_tran_id), + IPToUINT(&ipc->ClientIPAddress), src_port, IPToUINT(&a->DnsServerIP), 53), + IPToUINT(&ipc->ClientIPAddress), IPToUINT(&a->DnsServerIP), IP_PROTO_UDP, 0); + + dns_query2 = NnBuildIpPacket(NnBuildUdpPacket(NnBuildDnsQueryPacket(NN_CHECK_HOSTNAME, dns_tran_id), + IPToUINT(&ipc->ClientIPAddress), src_port, IPToUINT(&a->DnsServerIP), 53), + IPToUINT(&ipc->ClientIPAddress), IPToUINT(&a->DnsServerIP2), IP_PROTO_UDP, 0); + + giveup_time = Tick64() + NN_CHECK_CONNECTIVITY_TIMEOUT; + AddInterrupt(interrupt, giveup_time); + while (true) + { + UINT64 now = Tick64(); + + IPCFlushArpTable(a->Ipc); + + if (now >= giveup_time) + { + break; + } + + // Send a packet periodically + if (next_send_tick == 0 || next_send_tick <= now) + { + next_send_tick = now + (UINT64)NN_CHECK_CONNECTIVITY_INTERVAL; + + AddInterrupt(interrupt, next_send_tick); + + if ((num_send_dns % 2) == 0) + { + IPCSendIPv4(ipc, dns_query->Buf, dns_query->Size); + } + else + { + IPCSendIPv4(ipc, dns_query2->Buf, dns_query2->Size); + } + + num_send_dns++; + } + + // Happy processing + IPCProcessL3EventsIPv4Only(ipc); + + while (true) + { + // Receive a packet + BLOCK *b = IPCRecvIPv4(ipc); + PKT *pkt; + + if (b == NULL) + { + break; + } + + // Parse the packet + pkt = ParsePacketIPv4WithDummyMacHeader(b->Buf, b->Size); + + if (pkt != NULL) + { + if (pkt->TypeL3 == L3_IPV4 && pkt->TypeL4 == L4_UDP && + (pkt->L3.IPv4Header->SrcIP == IPToUINT(&a->DnsServerIP) || + pkt->L3.IPv4Header->SrcIP == IPToUINT(&a->DnsServerIP2)) && + pkt->L3.IPv4Header->DstIP == IPToUINT(&ipc->ClientIPAddress) && + pkt->L4.UDPHeader->SrcPort == Endian16(53) && pkt->L4.UDPHeader->DstPort == Endian16(src_port)) + { + DNSV4_HEADER *dns_header = (DNSV4_HEADER *)pkt->Payload; + if (pkt->PayloadSize >= sizeof(DNSV4_HEADER)) + { + if (dns_header->TransactionId == Endian16(dns_tran_id)) + { + IP ret_ip; + + if (NnParseDnsResponsePacket(pkt->Payload, pkt->PayloadSize, &ret_ip)) + { + UINTToIP(&using_dns, pkt->L3.IPv4Header->SrcIP); + Debug("NativeStack: Using DNS: %r\n", &using_dns); + + Copy(&yahoo_ip, &ret_ip, sizeof(IP)); + } + } + } + } + } + + FreePacketWithData(pkt); + FreeBlock(b); + } + + if ((halt_tube != NULL && IsTubeConnected(halt_tube) == false) || + IsTubeConnected(ipc->Sock->SendTube) == false || IsTubeConnected(ipc->Sock->RecvTube) == false) + { + // Disconnected + break; + } + + if (IsZeroIP(&yahoo_ip) == false) + { + // There is a response + break; + } + + // Keep the CPU waiting + WaitForTubes(tubes, num_tubes, GetNextIntervalForInterrupt(interrupt)); + } + + FreeBuf(dns_query); + FreeBuf(dns_query2); + + if (IsZeroIP(&yahoo_ip) == false) + { + BUF *tcp_query; + UINT seq = Rand32(); + bool tcp_get_response = false; + UINT recv_seq = 0; + + // Since the IP address of www.yahoo.com has gotten, try to connect by TCP + giveup_time = Tick64() + NN_CHECK_CONNECTIVITY_TIMEOUT; + AddInterrupt(interrupt, giveup_time); + + // Generate a TCP packet + tcp_query = NnBuildIpPacket(NnBuildTcpPacket(NewBuf(), IPToUINT(&ipc->ClientIPAddress), src_port, + IPToUINT(&yahoo_ip), 80, seq, 0, TCP_SYN, 8192, 1414), + IPToUINT(&ipc->ClientIPAddress), IPToUINT(&yahoo_ip), IP_PROTO_TCP, 0); + + Debug("Test TCP to %r\n", &yahoo_ip); + + next_send_tick = 0; + + while (true) + { + UINT64 now = Tick64(); + + IPCFlushArpTable(a->Ipc); + + if (now >= giveup_time) + { + break; + } + + // Send the packet periodically + if (next_send_tick == 0 || next_send_tick <= now) + { + next_send_tick = now + (UINT64)NN_CHECK_CONNECTIVITY_INTERVAL; + + AddInterrupt(interrupt, next_send_tick); + + IPCSendIPv4(ipc, tcp_query->Buf, tcp_query->Size); + } + + // Happy procedure + IPCProcessL3EventsIPv4Only(ipc); + + while (true) + { + // Receive a packet + BLOCK *b = IPCRecvIPv4(ipc); + PKT *pkt; + + if (b == NULL) + { + break; + } + + // Parse the packet + pkt = ParsePacketIPv4WithDummyMacHeader(b->Buf, b->Size); + + if (pkt != NULL) + { + if (pkt->TypeL3 == L3_IPV4 && pkt->TypeL4 == L4_TCP && + pkt->L3.IPv4Header->SrcIP == IPToUINT(&yahoo_ip) && + pkt->L3.IPv4Header->DstIP == IPToUINT(&ipc->ClientIPAddress) && + pkt->L4.TCPHeader->SrcPort == Endian16(80) && pkt->L4.TCPHeader->DstPort == Endian16(src_port)) + { + TCP_HEADER *tcp_header = (TCP_HEADER *)pkt->L4.TCPHeader; + if ((tcp_header->Flag & TCP_SYN) && (tcp_header->Flag & TCP_ACK)) + { + // There was a TCP response + tcp_get_response = true; + recv_seq = Endian32(tcp_header->SeqNumber); + } + } + } + + FreePacketWithData(pkt); + FreeBlock(b); + } + + if ((halt_tube != NULL && IsTubeConnected(halt_tube) == false) || + IsTubeConnected(ipc->Sock->SendTube) == false || IsTubeConnected(ipc->Sock->RecvTube) == false) + { + // Disconnected + break; + } + + if (tcp_get_response) + { + WHERE; + break; + } + + // Keep the CPU waiting + WaitForTubes(tubes, num_tubes, GetNextIntervalForInterrupt(interrupt)); + } + + FreeBuf(tcp_query); + + // Send a RST + if (recv_seq != 0) + { + recv_seq++; + } + + tcp_query = NnBuildIpPacket(NnBuildTcpPacket(NewBuf(), IPToUINT(&ipc->ClientIPAddress), src_port, + IPToUINT(&yahoo_ip), 80, seq + 1, recv_seq, TCP_RST | TCP_ACK, 8192, 0), + IPToUINT(&ipc->ClientIPAddress), IPToUINT(&yahoo_ip), IP_PROTO_TCP, 0); + + IPCSendIPv4(ipc, tcp_query->Buf, tcp_query->Size); + + FreeBuf(tcp_query); + + SleepThread(100); + + if (tcp_get_response) + { + ok = true; + } + } + + FreeInterruptManager(interrupt); + + if (ok) + { + if (IsZeroIP(&using_dns) == false) + { + Copy(&a->DnsServerIP, &using_dns, sizeof(IP)); + } + + if (a->IsIpRawMode) + { + if (NsStartIpTablesTracking(a) == false) + { + Debug("NsStartIpTablesTracking failed.\n"); + ok = false; + } + } + } + + return ok; +} + +// Generate source port number by a random number +UINT NnGenSrcPort(bool raw_ip_mode) +{ + if (raw_ip_mode == false) + { + return 1025 + Rand32() % (65500 - 1025); + } + else + { + return NN_RAW_IP_PORT_START + Rand32() % (NN_RAW_IP_PORT_END - NN_RAW_IP_PORT_START); + } +} + +// Get a next good interface for the native NAT +NATIVE_STACK *NnGetNextInterface(NATIVE_NAT *t) +{ + NATIVE_STACK *ret = NULL; + UINT current_hash; + TOKEN_LIST *device_list; + UINT i; + char tmp[MAX_SIZE]; + char *dev_name; + UINT current_ip_hash; + // Validate arguments + if (t == NULL) + { + return NULL; + } + + t->NextWaitTimeForRetry = NN_NEXT_WAIT_TIME_FOR_DEVICE_ENUM * MIN((t->FailedCount + 1), NN_NEXT_WAIT_TIME_MAX_FAIL_COUNT); + + // Get the device list + device_list = GetEthListEx(NULL, + !(t->v->HubOption != NULL && t->v->HubOption->DisableKernelModeSecureNAT), + !(t->v->HubOption != NULL && t->v->HubOption->DisableIpRawModeSecureNAT)); + + if (device_list == NULL || device_list->NumTokens == 0) + { + // Device list acquisition failure (Or no device acquired as a result) + FreeToken(device_list); + t->FailedCount++; + return NULL; + } + + current_hash = GetEthDeviceHash(); + current_ip_hash = GetHostIPAddressHash32(); + + if (t->LastInterfaceDeviceHash != current_hash || t->LastHostAddressHash != current_ip_hash) + { + // Device list is altered from the previous search + t->LastInterfaceIndex = INFINITE; + t->FailedCount = 0; + } + + t->LastInterfaceDeviceHash = current_hash; + t->LastHostAddressHash = current_ip_hash; + + if (t->LastInterfaceIndex == INFINITE) + { + i = 0; + } + else + { + i = t->LastInterfaceIndex + 1; + if (i >= device_list->NumTokens) + { + i = 0; + } + } + + if ((i + 1) == device_list->NumTokens) + { + // Searched to the end + t->LastInterfaceIndex = INFINITE; + + // Increase the number of search failures by one + t->FailedCount++; + } + else + { + // It is not the end yet + t->LastInterfaceIndex = i; + t->NextWaitTimeForRetry = 0; + } + + dev_name = device_list->Token[i]; + + if (IsInLinesFile(NN_NO_NATIVE_NAT_FILENAME, dev_name, true) == false) + { + // Try to open the device + BinToStr(tmp, sizeof(tmp), t->v->MacAddress, 6); + ret = NewNativeStack(NULL, dev_name, tmp); + + if (ret != NULL) + { + // Test whether an IP address can be obtained from a DHCP server + DHCP_OPTION_LIST opt; + + Copy(t->CurrentMacAddress, ret->Ipc->MacAddress, 6); + + Zero(&opt, sizeof(opt)); + + BinToStr(tmp, sizeof(tmp), ret->MacAddress, 6); + Format(ret->Ipc->ClientHostname, sizeof(ret->Ipc->ClientHostname), NN_HOSTNAME_FORMAT, tmp); + StrLower(ret->Ipc->ClientHostname); + + Debug("IPCDhcpAllocateIP for %s\n", ret->DeviceName); + if (IPCDhcpAllocateIP(ret->Ipc, &opt, t->HaltTube2)) + { + char client_ip[64]; + char dhcp_ip[64]; + char client_mask[64]; + char gateway_ip[64]; + + IP ip; + IP subnet; + IP gw; + + IPToStr32(client_ip, sizeof(client_ip), opt.ClientAddress); + IPToStr32(client_mask, sizeof(client_mask), opt.SubnetMask); + IPToStr32(dhcp_ip, sizeof(dhcp_ip), opt.ServerAddress); + IPToStr32(gateway_ip, sizeof(gateway_ip), opt.Gateway); + + Debug("DHCP: client_ip=%s, client_mask=%s, dhcp_ip=%s, gateway_ip=%s\n", + client_ip, client_mask, dhcp_ip, gateway_ip); + + Copy(&ret->CurrentDhcpOptionList, &opt, sizeof(DHCP_OPTION_LIST)); + + // IP parameter settings + UINTToIP(&ip, opt.ClientAddress); + UINTToIP(&subnet, opt.SubnetMask); + UINTToIP(&gw, opt.Gateway); + + IPCSetIPv4Parameters(ret->Ipc, &ip, &subnet, &gw, &opt.ClasslessRoute); + + // Determine the DNS server to use + UINTToIP(&ret->DnsServerIP, opt.DnsServer); + UINTToIP(&ret->DnsServerIP2, opt.DnsServer2); + if (IsZeroIP(&ret->DnsServerIP)) + { + // Use 8.8.8.8 instead If the DNS is not assigned from the DHCP server + SetIP(&ret->DnsServerIP, 8, 8, 8, 8); + } + if (IsZeroIP(&ret->DnsServerIP2)) + { + // Use 8.8.4.4 instead If the DNS is not assigned from the DHCP server + SetIP(&ret->DnsServerIP2, 8, 8, 4, 4); + } + + // Connectivity test + // (always fail if the default gateway is not set) + if (opt.Gateway != 0 && + NnTestConnectivity(ret, t->HaltTube2)) + { + // Reset the number of search failures + t->FailedCount = 0; + Debug("Connectivity OK.\n"); + } + else + { + Debug("Connectivity Failed.\n"); + FreeNativeStack(ret); + ret = NULL; + } + } + else + { + Debug("DHCP Failed.\n"); + FreeNativeStack(ret); + ret = NULL; + + Zero(t->CurrentMacAddress, sizeof(t->CurrentMacAddress)); + } + } + } + + FreeToken(device_list); + + return ret; +} + +// Native NAT thread +void NativeNatThread(THREAD *thread, void *param) +{ + NATIVE_NAT *t = (NATIVE_NAT *)param; + void *wait_handle = InitWaitUntilHostIPAddressChanged(); + // Validate arguments + if (thread == NULL || param == NULL) + { + return; + } + + while (t->Halt == false) + { + NATIVE_STACK *a; + + while (t->v->UseNat == false || t->v->HubOption == NULL || (t->v->HubOption->DisableKernelModeSecureNAT && t->v->HubOption->DisableIpRawModeSecureNAT)) + { + if (t->Halt) + { + break; + } + + // If the NAT is disabled, wait until it becomes enabled + Wait(t->HaltEvent, 1234); + } + + if (t->Halt) + { + break; + } + + // Get a next good native NAT stack + Debug("NnGetNextInterface Start.\n"); + + NnClearQueue(t); + + a = NnGetNextInterface(t); + + if (a != NULL) + { + char macstr[64]; + // Acquisition success + Debug("NnGetNextInterface Ok: %s\n", a->DeviceName); + + t->IsRawIpMode = a->IsIpRawMode; + + Lock(t->Lock); + { + if (a->Sock1 != NULL) + { + t->HaltTube = a->Sock2->RecvTube; + + if (t->HaltTube != NULL) + { + AddRef(t->HaltTube->Ref); + } + } + } + Unlock(t->Lock); + + NnClearQueue(t); + + t->PublicIP = IPToUINT(&a->Ipc->ClientIPAddress); + t->Active = true; + + + Debug("NnMainLoop Start.\n"); + MacToStr(macstr, sizeof(macstr), a->Ipc->MacAddress); + NLog(t->v, "LH_KERNEL_MODE_START", a->DeviceName, + &a->Ipc->ClientIPAddress, &a->Ipc->SubnetMask, &a->Ipc->DefaultGateway, &a->Ipc->BroadcastAddress, + macstr, &a->CurrentDhcpOptionList.ServerAddress, &a->DnsServerIP); + NnMainLoop(t, a); + Debug("NnMainLoop End.\n"); + + t->IsRawIpMode = false; + + t->Active = false; + t->PublicIP = 0; + + + NnClearQueue(t); + + // Close the stack + Lock(t->Lock); + { + if (t->HaltTube != NULL) + { + ReleaseTube(t->HaltTube); + t->HaltTube = NULL; + } + } + Unlock(t->Lock); + FreeNativeStack(a); + + Zero(t->CurrentMacAddress, 6); + } + else + { + Debug("NnGetNextInterface Failed.\n"); + } + + // Wait for a certain period of time + if (t->NextWaitTimeForRetry != 0) + { + WaitUntilHostIPAddressChanged(wait_handle, t->HaltEvent, t->NextWaitTimeForRetry, 1000); + } + } + + FreeWaitUntilHostIPAddressChanged(wait_handle); +} + +// Erase the contents of the queue for transmission and reception +void NnClearQueue(NATIVE_NAT *t) +{ + // Validate arguments + if (t == NULL) + { + return; + } + + LockQueue(t->SendQueue); + { + while (true) + { + BLOCK *b = GetNext(t->SendQueue); + + if (b == NULL) + { + break; + } + + FreeBlock(b); + } + } + UnlockQueue(t->SendQueue); + + LockQueue(t->RecvQueue); + { + while (true) + { + PKT *p = GetNext(t->RecvQueue); + + if (p == NULL) + { + break; + } + + FreePacketWithData(p); + } + } + UnlockQueue(t->RecvQueue); +} + +// Structure setting function to search for native NAT +void NnSetNat(NATIVE_NAT_ENTRY *e, UINT protocol, UINT src_ip, UINT src_port, UINT dest_ip, UINT dest_port, UINT pub_ip, UINT pub_port) +{ + // Validate arguments + if (e == NULL) + { + return; + } + + Zero(e, sizeof(NATIVE_NAT_ENTRY)); + + e->Protocol = protocol; + e->SrcIp = src_ip; + e->SrcPort = src_port; + e->DestIp = dest_ip; + e->DestPort = dest_port; + e->PublicIp = pub_ip; + e->PublicPort = pub_port; + e->HashCodeForSend = e->HashCodeForRecv = INFINITE; +} + +// Get the hash code of the native NAT table (receiving direction) +UINT GetHashNativeNatTableForRecv(void *p) +{ + UINT r; + NATIVE_NAT_ENTRY *e = (NATIVE_NAT_ENTRY *)p; + if (e == NULL) + { + return 0; + } + + if (e->HashCodeForRecv != INFINITE) + { + return e->HashCodeForRecv; + } + + r = 0; + + r += e->Protocol; + r += e->PublicIp; + r += e->PublicPort; + + if (e->Protocol == NAT_TCP) + { + r += e->DestIp; + r += e->DestPort; + } + + e->HashCodeForRecv = r; + + return r; +} + +// Comparison function of native NAT table (receiving direction) +int CmpNativeNatTableForRecv(void *p1, void *p2) +{ + int r; + NATIVE_NAT_ENTRY *e1, *e2; + if (p1 == NULL || p2 == NULL) + { + return 0; + } + e1 = *(NATIVE_NAT_ENTRY **)p1; + e2 = *(NATIVE_NAT_ENTRY **)p2; + if (e1 == NULL || e2 == NULL) + { + return 0; + } + + r = COMPARE_RET(e1->Protocol, e2->Protocol); + if (r != 0) + { + return r; + } + + r = COMPARE_RET(e1->PublicIp, e2->PublicIp); + if (r != 0) + { + return r; + } + + r = COMPARE_RET(e1->PublicPort, e2->PublicPort); + if (r != 0) + { + return r; + } + + if (e1->Protocol == NAT_TCP) + { + r = COMPARE_RET(e1->DestIp, e2->DestIp); + if (r != 0) + { + return r; + } + + r = COMPARE_RET(e1->DestPort, e2->DestPort); + if (r != 0) + { + return r; + } + } + + return 0; +} + +// Get the hash code of the native NAT table (transmit direction) +UINT GetHashNativeNatTableForSend(void *p) +{ + UINT r; + NATIVE_NAT_ENTRY *e = (NATIVE_NAT_ENTRY *)p; + if (e == NULL) + { + return 0; + } + + if (e->HashCodeForSend != INFINITE) + { + return e->HashCodeForSend; + } + + r = 0; + + r += e->Protocol; + r += e->SrcIp; + r += e->SrcPort; + + if (e->Protocol == NAT_TCP) + { + r += e->DestIp; + r += e->DestPort; + } + + e->HashCodeForSend = r; + + return r; +} + +// Comparison function of native NAT table (transmit direction) +int CmpNativeNatTableForSend(void *p1, void *p2) +{ + int r; + NATIVE_NAT_ENTRY *e1, *e2; + if (p1 == NULL || p2 == NULL) + { + return 0; + } + e1 = *(NATIVE_NAT_ENTRY **)p1; + e2 = *(NATIVE_NAT_ENTRY **)p2; + if (e1 == NULL || e2 == NULL) + { + return 0; + } + + r = COMPARE_RET(e1->Protocol, e2->Protocol); + if (r != 0) + { + return r; + } + + r = COMPARE_RET(e1->SrcIp, e2->SrcIp); + if (r != 0) + { + return r; + } + + r = COMPARE_RET(e1->SrcPort, e2->SrcPort); + if (r != 0) + { + return r; + } + + if (e1->Protocol == NAT_TCP) + { + r = COMPARE_RET(e1->DestIp, e2->DestIp); + if (r != 0) + { + return r; + } + + r = COMPARE_RET(e1->DestPort, e2->DestPort); + if (r != 0) + { + return r; + } + } + + return 0; +} + +// Start the native NAT +NATIVE_NAT *NewNativeNat(VH *v) +{ + NATIVE_NAT *t; + // Validate arguments + if (v == NULL) + { + return NULL; + } + + t = ZeroMalloc(sizeof(NATIVE_NAT)); + + t->v = v; + + t->Cancel = v->Cancel; + AddRef(t->Cancel->ref); + + // Data structure initialization + t->LastInterfaceIndex = INFINITE; + t->SendQueue = NewQueue(); + t->RecvQueue = NewQueue(); + NnInitIpCombineList(t); + + t->Lock = NewLock(); + + t->CancelLock = NewLock(); + + t->HaltEvent = NewEvent(); + + NewTubePair(&t->HaltTube2, &t->HaltTube3, 0); + + // Create a NAT table + t->NatTableForSend = NewHashList(GetHashNativeNatTableForSend, CmpNativeNatTableForSend, 11, true); + t->NatTableForRecv = NewHashList(GetHashNativeNatTableForRecv, CmpNativeNatTableForRecv, 11, true); + + t->Thread = NewThread(NativeNatThread, t); + + return t; +} + +// Stop the native NAT +void FreeNativeNat(NATIVE_NAT *t) +{ + TUBE *tube; + UINT i; + // Validate arguments + if (t == NULL) + { + return; + } + + t->Halt = true; + + Lock(t->Lock); + { + tube = t->HaltTube; + + if (tube != NULL) + { + AddRef(tube->Ref); + } + } + Unlock(t->Lock); + + if (tube != NULL) + { + TubeFlushEx(tube, true); + + SleepThread(100); + + TubeDisconnect(tube); + + ReleaseTube(tube); + } + + TubeDisconnect(t->HaltTube2); + TubeDisconnect(t->HaltTube3); + + Set(t->HaltEvent); + + WaitThread(t->Thread, INFINITE); + + ReleaseThread(t->Thread); + + DeleteLock(t->Lock); + + DeleteLock(t->CancelLock); + + ReleaseEvent(t->HaltEvent); + + ReleaseTube(t->HaltTube2); + ReleaseTube(t->HaltTube3); + + NnClearQueue(t); + + ReleaseQueue(t->RecvQueue); + ReleaseQueue(t->SendQueue); + + ReleaseCancel(t->Cancel); + + // Release the NAT table + for (i = 0; i < LIST_NUM(t->NatTableForSend->AllList); i++) + { + NATIVE_NAT_ENTRY *e = LIST_DATA(t->NatTableForSend->AllList, i); + + Free(e); + } + + ReleaseHashList(t->NatTableForSend); + ReleaseHashList(t->NatTableForRecv); + + NnFreeIpCombineList(t); + + Free(t); +} + +// Take the log of Virtual Host +void VLog(VH *v, char *str) +{ + // Not take!! + return; +} + +// Disconnect the NAT entry immediately +void DisconnectNatEntryNow(VH *v, NAT_ENTRY *e) +{ + // Validate arguments + if (v == NULL || e == NULL) + { + return; + } + + if (e->DisconnectNow == false) + { + e->DisconnectNow = true; + + SetSockEvent(v->SockEvent); + } +} + +// Get the NAT entry with specified source IP address and the oldest last communication time +NAT_ENTRY *GetOldestNatEntryOfIp(VH *v, UINT ip, UINT protocol) +{ + UINT i; + NAT_ENTRY *oldest = NULL; + UINT64 oldest_tick = 0xFFFFFFFFFFFFFFFFULL; + // Validate arguments + if (v == NULL) + { + return NULL; + } + + for (i = 0; i < LIST_NUM(v->NatTable); i++) + { + NAT_ENTRY *e = LIST_DATA(v->NatTable, i); + + if (e->DisconnectNow == false) + { + if (e->SrcIp == ip) + { + if (e->Protocol == protocol) + { + if (protocol != NAT_TCP || e->TcpStatus != NAT_TCP_CONNECTING) + { + if (e->LastCommTime <= oldest_tick) + { + oldest_tick = e->LastCommTime; + oldest = e; + } + } + } + } + } + } + + return oldest; +} + +// Get the number of current NAT entries per IP address +UINT GetNumNatEntriesPerIp(VH *v, UINT ip, UINT protocol, bool tcp_syn_sent) +{ + UINT ret = 0; + UINT i; + // Validate arguments + if (v == NULL) + { + return 0; + } + + for (i = 0; i < LIST_NUM(v->NatTable); i++) + { + NAT_ENTRY *e = LIST_DATA(v->NatTable, i); + + if (e->DisconnectNow == false) + { + if (e->SrcIp == ip) + { + if (e->Protocol == protocol) + { + bool ok = false; + + if (protocol == NAT_TCP) + { + if (tcp_syn_sent) + { + if (e->TcpStatus == NAT_TCP_CONNECTING) + { + ok = true; + } + } + else + { + if (e->TcpStatus != NAT_TCP_CONNECTING) + { + ok = true; + } + } + } + else + { + ok = true; + } + + if (ok) + { + ret++; + } + } + } + } + } + + return ret; +} + +// Check whether the NAT is available +bool CanCreateNewNatEntry(VH *v) +{ + // Validate arguments + if (v == NULL) + { + return false; + } + + if (v->UseNat == false) + { + // NAT stopped + return false; + } + + if (NnIsActive(v) && v->NativeNat != NULL && v->NativeNat->NatTableForRecv != NULL) + { + if (v->NativeNat->NatTableForRecv->AllList->num_item > NAT_MAX_SESSIONS_KERNEL) + { + // Number of sessions exceeded (kernel mode) + return false; + } + } + else + { + if (v->NatTable->num_item > NAT_MAX_SESSIONS) + { + // Number of sessions exceeded (user mode) + return false; + } + } + + return true; +} + +// Set a pointer to the Virtual HUB options +void NatSetHubOption(VH *v, HUB_OPTION *o) +{ + // Validate arguments + if (v == NULL) + { + return; + } + + v->HubOption = o; +} + +// Get a pointer to the Virtual HUB options +HUB_OPTION *NatGetHubOption(VH *v) +{ + // Validate arguments + if (v == NULL) + { + return NULL; + } + + return v->HubOption; +} + +// The main function of NAT processing thread +void NatThreadMain(VH *v) +{ + bool halt_flag; + // Validate arguments + if (v == NULL) + { + return; + } + + v->TmpBuf = Malloc(NAT_TMPBUF_SIZE); + + while (true) + { + // Wait until the next event is set + WaitSockEvent(v->SockEvent, SELECT_TIME); + + halt_flag = false; + + LockVirtual(v); + { + // Process on all NAT sessions + UINT i, num; + + v->Now = Tick64(); + v->NatDoCancelFlag = false; + +LIST_ELEMENT_DELETED: + num = LIST_NUM(v->NatTable); + for (i = 0; i < num; i++) + { + NAT_ENTRY *n = LIST_DATA(v->NatTable, i); + + switch (n->Protocol) + { + case NAT_TCP: // TCP + if (NatTransactTcp(v, n) == false) + { + goto LIST_ELEMENT_DELETED; + } + break; + + case NAT_UDP: // UDP + if (NatTransactUdp(v, n) == false) + { + goto LIST_ELEMENT_DELETED; + } + break; + + case NAT_ICMP: // ICMP + if (NatTransactIcmp(v, n) == false) + { + goto LIST_ELEMENT_DELETED; + } + break; + + case NAT_DNS: // DNS + if (NatTransactDns(v, n) == false) + { + goto LIST_ELEMENT_DELETED; + } + break; + } + } + + if (v->NatDoCancelFlag) + { + // Hit the cancel of the parent thread + Cancel(v->Cancel); + } + + // Halting flag check + if (v->HaltNat) + { + halt_flag = true; + } + } + UnlockVirtual(v); + + if (halt_flag) + { + // Terminate the thread by disconnecting all entries forcibly + LockVirtual(v); + { + UINT num = LIST_NUM(v->NatTable); + NAT_ENTRY **nn = ToArray(v->NatTable); + UINT i; + + for (i = 0; i < num; i++) + { + NAT_ENTRY *n = nn[i]; + n->DisconnectNow = true; + + switch (n->Protocol) + { + case NAT_TCP: // TCP + NatTransactTcp(v, n); + break; + + case NAT_UDP: // UDP + NatTransactUdp(v, n); + break; + + case NAT_ICMP: // ICMP + NatTransactIcmp(v, n); + break; + + case NAT_DNS: // DNS + NatTransactDns(v, n); + break; + } + } + + Free(nn); + } + UnlockVirtual(v); + break; + } + } + + Free(v->TmpBuf); +} + +// DNS: Thread to get the IP address +void NatGetIPThread(THREAD *t, void *param) +{ + NAT_DNS_QUERY *q; + // Validate arguments + if (t == NULL || param == NULL) + { + return; + } + + q = (NAT_DNS_QUERY *)param; + AddWaitThread(t); + + q->Ok = GetIP(&q->Ip, q->Hostname); + + DelWaitThread(t); + + if (Release(q->ref) == 0) + { + Free(q); + } +} + +// DNS: Get an IP address from host name +bool NatGetIP(IP *ip, char *hostname) +{ + TOKEN_LIST *t; + bool ret = false; + // Validate arguments + if (ip == NULL || hostname == NULL) + { + return false; + } + + t = ParseToken(hostname, "."); + if (t == NULL) + { + return false; + } + if (t->NumTokens == 0) + { + FreeToken(t); + return false; + } + + if (t->NumTokens == 1) + { + ret = GetIP(ip, hostname); + } + else + { + char *hostname2 = t->Token[0]; + NAT_DNS_QUERY *q1, *q2; + THREAD *t1, *t2; + + q1 = ZeroMalloc(sizeof(NAT_DNS_QUERY)); + q2 = ZeroMalloc(sizeof(NAT_DNS_QUERY)); + q1->ref = NewRef(); + q2->ref = NewRef(); + AddRef(q1->ref); + AddRef(q2->ref); + StrCpy(q1->Hostname, sizeof(q1->Hostname), hostname); + StrCpy(q2->Hostname, sizeof(q2->Hostname), hostname2); + + t1 = NewThread(NatGetIPThread, q1); + t2 = NewThread(NatGetIPThread, q2); + + WaitThread(t1, NAT_DNS_QUERY_TIMEOUT); + + if (q1->Ok) + { + ret = true; + Copy(ip, &q1->Ip, sizeof(IP)); + } + else + { + WaitThread(t2, NAT_DNS_QUERY_TIMEOUT); + if (q1->Ok) + { + ret = true; + Copy(ip, &q1->Ip, sizeof(IP)); + } + else if (q2->Ok) + { + ret = true; + Copy(ip, &q2->Ip, sizeof(IP)); + } + } + + ReleaseThread(t1); + ReleaseThread(t2); + + if (Release(q1->ref) == 0) + { + Free(q1); + } + if (Release(q2->ref) == 0) + { + Free(q2); + } + } + + FreeToken(t); + + return ret; +} + +// DNS query function +void NatDnsThread(THREAD *t, void *param) +{ + NAT_ENTRY *n; + IP ip; + // Validate arguments + if (t == NULL || param == NULL) + { + return; + } + n = (NAT_ENTRY *)param; + + // Notify the initialization completion + NoticeThreadInit(t); + + // Run processing + if (EndWith(n->DnsTargetHostName, ".in-addr.arpa") == false) + { + // Forward resolution + if (NatGetIP(&ip, n->DnsTargetHostName)) + { + // Forward resolution success + Copy(&n->DnsResponseIp, &ip, sizeof(IP)); + n->DnsOk = true; + } + } + else + { + // Reverse resolution + IP ip; + n->DnsGetIpFromHost = true; // Set the reverse resolution flag + // Convert a *.in-addr.arpa string to an IP address + if (ArpaToIP(&ip, n->DnsTargetHostName)) + { + // Reverse resolution process + char tmp[256]; + if (GetHostName(tmp, sizeof(tmp), &ip)) + { + // Reverse resolution success + n->DnsResponseHostName = CopyStr(tmp); + n->DnsOk = true; + } + } + } + + // Notify the results + n->DnsFinished = true; + + SetSockEvent(n->v->SockEvent); +} + +// Convert a reverse resolution address to an IP address +bool ArpaToIP(IP *ip, char *str) +{ + TOKEN_LIST *token; + bool ret = false; + // Validate arguments + if (ip == NULL || str == NULL) + { + return false; + } + + // Token conversion + token = ParseToken(str, "."); + if (token->NumTokens == 6) + { + // Convert the token [0, 1, 2, 3] to IP + UINT i; + Zero(ip, sizeof(IP)); + for (i = 0; i < 4; i++) + { + ip->addr[i] = (UCHAR)ToInt(token->Token[3 - i]); + } + ret = true; + } + + FreeToken(token); + + if (IPToUINT(ip) == 0) + { + ret = false; + } + + return ret; +} + +// Handle a DNS entry +bool NatTransactDns(VH *v, NAT_ENTRY *n) +{ + // Validate arguments + if (v == NULL || n == NULL) + { + return true; + } + + if (n->DisconnectNow) + { + goto DISCONNECT; + } + + if (n->DnsThread == NULL && n->DnsFinished == false) + { + // Create a thread + THREAD *t = NewThread(NatDnsThread, (void *)n); + WaitThreadInit(t); + n->DnsThread = t; + } + else + { + // Wait for the result + if (n->DnsFinished) + { + // Results have been received + WaitThread(n->DnsThread, INFINITE); + ReleaseThread(n->DnsThread); + n->DnsThread = NULL; + // Notify to the main thread + v->NatDoCancelFlag = true; + } + } + + return true; + +DISCONNECT: + + // Releasing process + if (n->DnsThread != NULL) + { + WaitThread(n->DnsThread, INFINITE); + ReleaseThread(n->DnsThread); + n->DnsThread = NULL; + } + + if (n->DnsTargetHostName != NULL) + { + Free(n->DnsTargetHostName); + n->DnsTargetHostName = NULL; + } + + if (n->DnsResponseHostName != NULL) + { + Free(n->DnsResponseHostName); + n->DnsResponseHostName = NULL; + } + + DeleteLock(n->lock); + Delete(v->NatTable, n); + Free(n); + + return false; +} + +// ICMP thread procedure +void NatIcmpThreadProc(THREAD *thread, void *param) +{ + NAT_ENTRY *n; + ICMP_RESULT *ret = NULL; + USHORT src_id = 0, src_seqno = 0; + // Validate arguments + if (thread == NULL || param == NULL) + { + return; + } + + n = (NAT_ENTRY *)param; + + if (n->IcmpQueryBlock) + { + UCHAR *data = n->IcmpQueryBlock->Buf; + UINT size = n->IcmpQueryBlock->Size; + + if (size >= (sizeof(ICMP_HEADER) + sizeof(ICMP_ECHO))) + { + ICMP_HEADER *icmp = (ICMP_HEADER *)data; + ICMP_ECHO *echo = (ICMP_ECHO *)(data + sizeof(ICMP_HEADER)); + + if (icmp->Type == ICMP_TYPE_ECHO_REQUEST && icmp->Code == 0) + { + UCHAR *icmp_payload = data + sizeof(ICMP_HEADER) + sizeof(ICMP_ECHO); + UINT icmp_payload_size = size - sizeof(ICMP_HEADER) - sizeof(ICMP_ECHO); + IP dest_ip; + + src_id = Endian16(echo->Identifier); + src_seqno = Endian16(echo->SeqNo); + + UINTToIP(&dest_ip, n->DestIp); + + // Send a query by using the ICMP API + ret = IcmpApiEchoSend(&dest_ip, n->IcmpQueryBlock->Ttl, + icmp_payload, icmp_payload_size, NAT_ICMP_TIMEOUT_WITH_API); + } + } + } + + if (ret != NULL && ret->Timeout == false) + { + // Convert to an IPv4 + ICMP packet since the result of ICMP API was obtained + IPV4_HEADER ipv4; + ICMP_HEADER icmp; + ICMP_ECHO echo; + BUF *buf = NewBuf(); + + // IPv4 header + Zero(&ipv4, sizeof(ipv4)); + IPV4_SET_VERSION(&ipv4, 4); + IPV4_SET_HEADER_LEN(&ipv4, sizeof(IPV4_HEADER) / 4); + ipv4.TimeToLive = ret->Ttl; + ipv4.Protocol = IP_PROTO_ICMPV4; + ipv4.SrcIP = IPToUINT(&ret->IpAddress); + ipv4.DstIP = 0x01010101; + + + // ICMP header + Zero(&icmp, sizeof(icmp)); + Zero(&echo, sizeof(echo)); + + if (ret->Ok) + { + // Normal response + echo.Identifier = Endian16(src_id); + echo.SeqNo = Endian16(src_seqno); + + ipv4.TotalLength = Endian16((USHORT)(sizeof(ipv4) + sizeof(icmp) + sizeof(echo) + ret->DataSize)); + + WriteBuf(buf, &ipv4, sizeof(ipv4)); + WriteBuf(buf, &icmp, sizeof(icmp)); + WriteBuf(buf, &echo, sizeof(echo)); + WriteBuf(buf, ret->Data, ret->DataSize); + } + else + { + // Error reply + icmp.Type = ret->Type; + icmp.Code = ret->Code; + echo.Identifier = Endian16(src_id); + echo.SeqNo = Endian16(src_seqno); + + ipv4.TotalLength = Endian16((USHORT)(sizeof(ipv4) + sizeof(icmp) + sizeof(echo) + n->IcmpOriginalCopySize)); + + WriteBuf(buf, &ipv4, sizeof(ipv4)); + WriteBuf(buf, &icmp, sizeof(icmp)); + WriteBuf(buf, &echo, sizeof(echo)); + + // Copy of the original packet to be included in the response packet + WriteBuf(buf, n->IcmpOriginalCopy, n->IcmpOriginalCopySize); + } + + n->IcmpResponseBlock = NewBlock(Clone(buf->Buf, buf->Size), buf->Size, 0); + n->IcmpResponseBlock->Ttl = ret->Ttl; + + FreeBuf(buf); + } + IcmpApiFreeResult(ret); + + // Inform the completion of the processing + n->IcmpTaskFinished = true; + SetSockEvent(n->v->SockEvent); +} + +// Process ICMP entry +bool NatTransactIcmp(VH *v, NAT_ENTRY *n) +{ + void *buf; + UINT recv_size; + BLOCK *block; + IP dest_ip; + UINT num_ignore_errors = 0; + UINT dest_port = 0; + // Validate arguments + if (v == NULL || n == NULL) + { + return true; + } + + dest_port = n->DestPort; + + if (n->DisconnectNow) + { + goto DISCONNECT; + } + + if (v->IcmpRawSocketOk) + { + // Environment that the Raw sockets are available + if (n->UdpSocketCreated == false) + { + // Create a UDP socket + n->Sock = NewUDP(MAKE_SPECIAL_PORT(IP_PROTO_ICMPV4)); + if (n->Sock == NULL) + { + // Socket creation failure + goto DISCONNECT; + } + else + { + n->PublicIp = IPToUINT(&n->Sock->LocalIP); + n->PublicPort = n->Sock->LocalPort; + + JoinSockToSockEvent(n->Sock, v->SockEvent); + n->UdpSocketCreated = true; + } + } + } + else + { + // Create a thread for using ICMP API if Raw sockets are not available + if (n->IcmpThread == NULL) + { + if (n->UdpSendQueue->num_item >= 1) + { + // Since UdpSendQueue contains only 1 query, get a first query + // and create a thread and pass the query to the thread + BLOCK *block = GetNext(n->UdpSendQueue); + + n->IcmpQueryBlock = block; + + n->IcmpThread = NewThread(NatIcmpThreadProc, n); + } + } + + if (n->IcmpTaskFinished) + { + if (n->IcmpResponseBlock != NULL) + { + // Because there was a response from the thread that calls ICMP API, pass this result to the stack + block = n->IcmpResponseBlock; + n->IcmpResponseBlock = NULL; + InsertQueue(n->UdpRecvQueue, block); + v->NatDoCancelFlag = true; + n->LastCommTime = v->Now; + } + else + { + // Disconnect immediately when it fails + goto DISCONNECT; + } + } + + // Examine whether this session timed-out + if ((n->LastCommTime + (UINT64)NAT_ICMP_TIMEOUT_WITH_API) < v->Now || n->LastCommTime > v->Now) + { + // Time-out + goto DISCONNECT; + } + + return true; + } + + // Following are processed only for if the raw sockets are available + buf = v->TmpBuf; + UINTToIP(&dest_ip, n->DestIp); + + // Try to receive data from the UDP socket + while (true) + { + IP src_ip; + UINT src_port; + recv_size = RecvFrom(n->Sock, &src_ip, &src_port, buf, 65536); + + if (recv_size == SOCK_LATER) + { + // Packet has not arrived + break; + } + else if (recv_size == 0) + { + Debug("ICMP ERROR\n"); + // Error? + if (n->Sock->IgnoreRecvErr == false) + { + // A fatal error occurred + goto DISCONNECT; + } + else + { + if ((num_ignore_errors++) >= MAX_NUM_IGNORE_ERRORS) + { + goto DISCONNECT; + } + } + } + else + { + // Analyze the arriving packet + ICMP_RESULT *ret = IcmpParseResult(&dest_ip, n->SrcPort, 0, buf, recv_size); + + if (ret != NULL) + { + if ((ret->Ok && CmpIpAddr(&ret->IpAddress, &dest_ip) == 0) || + (ret->DataSize >= sizeof(IPV4_HEADER) && ((IPV4_HEADER *)ret->Data)->DstIP == n->DestIp)) + { + // Insert to the queue + void *data = Malloc(recv_size); + Copy(data, buf, recv_size); + block = NewBlock(data, recv_size, 0); + InsertQueue(n->UdpRecvQueue, block); + v->NatDoCancelFlag = true; + n->LastCommTime = v->Now; + } + + IcmpFreeResult(ret); + } + } + } + + // Try to send data to the UDP socket + while (block = GetNext(n->UdpSendQueue)) + { + // Assemble the Echo header and ICMP header + UINT send_size; + + SetTtl(n->Sock, block->Ttl); + send_size = SendTo(n->Sock, &dest_ip, dest_port, block->Buf, block->Size); + + FreeBlock(block); + if (send_size == 0) + { + Debug("ICMP ERROR\n"); + // Determine whether a fatal error + if (n->Sock->IgnoreSendErr == false) + { + // A fatal error occurred + goto DISCONNECT; + } + } + else + { + n->LastCommTime = v->Now; + } + } + + // Examine whether this session timed-out + if ((n->LastCommTime + (UINT64)NAT_ICMP_TIMEOUT) < v->Now || n->LastCommTime > v->Now) + { + // Time-out + goto DISCONNECT; + } + + return true; + +DISCONNECT: + // Disconnect this session + if (n->UdpSocketCreated) + { + // Close the socket + Disconnect(n->Sock); + ReleaseSock(n->Sock); + n->Sock = NULL; + } + + // Terminate if the thread has been created + if (n->IcmpThread != NULL) + { + WaitThread(n->IcmpThread, INFINITE); + ReleaseThread(n->IcmpThread); + n->IcmpThread = NULL; + } + + // Delete the entry + DeleteNatIcmp(v, n); + + return false; +} + +// Process the UDP entry +bool NatTransactUdp(VH *v, NAT_ENTRY *n) +{ + void *buf; + UINT recv_size; + BLOCK *block; + IP dest_ip; + UINT num_ignore_errors; + UINT dest_port = 0; + // Validate arguments + if (v == NULL || n == NULL) + { + return true; + } + + dest_port = n->DestPort; + + if (n->DisconnectNow) + { + goto DISCONNECT; + } + + if (n->UdpSocketCreated == false) + { + // Create a UDP socket + n->Sock = NewUDP(0); + if (n->Sock == NULL) + { + // Socket creation failure + goto DISCONNECT; + } + else + { + n->PublicIp = IPToUINT(&n->Sock->LocalIP); + n->PublicPort = n->Sock->LocalPort; + + JoinSockToSockEvent(n->Sock, v->SockEvent); + n->UdpSocketCreated = true; + } + } + + buf = v->TmpBuf; + if (n->ProxyDns == false) + { + UINTToIP(&dest_ip, n->DestIp); + } + else + { + UINTToIP(&dest_ip, n->DestIpProxy); + } + + num_ignore_errors = 0; + + // Try to receive data from the UDP socket + while (true) + { + IP src_ip; + UINT src_port; + recv_size = RecvFrom(n->Sock, &src_ip, &src_port, buf, 65536); + + if (recv_size == SOCK_LATER) + { + // Packet has not arrived + break; + } + else if (recv_size == 0) + { + // Error? + if (n->Sock->IgnoreRecvErr == false) + { + // A fatal error occurred + goto DISCONNECT; + } + else + { + if ((num_ignore_errors++) > MAX_NUM_IGNORE_ERRORS) + { + goto DISCONNECT; + } + } + } + else + { + // Packet arrives. Check the source IP + if (IPToUINT(&src_ip) == n->DestIp || n->DestIp == 0xFFFFFFFF || (IPToUINT(&src_ip) == n->DestIpProxy && n->ProxyDns) && src_port == n->DestPort) + { + // Insert to the queue + void *data = Malloc(recv_size); + Copy(data, buf, recv_size); + block = NewBlock(data, recv_size, 0); + + if (block != NULL) + { + if (src_port == SPECIAL_UDP_PORT_WSD || src_port == SPECIAL_UDP_PORT_SSDP) + { + // Make believe there is a response from the host really in the case of WSD packet + block->Param1 = IPToUINT(&src_ip); + } + } + + InsertQueue(n->UdpRecvQueue, block); + v->NatDoCancelFlag = true; + n->LastCommTime = v->Now; + } + } + } + + // Try to send data to the UDP socket + while (block = GetNext(n->UdpSendQueue)) + { + UINT send_size; + bool is_nbtdgm = false; + LIST *local_ip_list = NULL; + + if (dest_port == SPECIAL_UDP_PORT_NBTDGM) + { + // Determine whether NetBIOS Datagram packet + NBTDG_HEADER *nh = (NBTDG_HEADER *)block->Buf; + + if (nh != NULL && block->Size >= sizeof(NBTDG_HEADER)) + { + if (nh->SrcIP == n->SrcIp && Endian16(nh->SrcPort) == n->SrcPort) + { + local_ip_list = GetHostIPAddressList(); + + if (local_ip_list != NULL) + { + is_nbtdgm = true; + } + } + } + } + + if (is_nbtdgm == false) + { + // Normal UDP packet + send_size = SendTo(n->Sock, &dest_ip, dest_port, block->Buf, block->Size); + } + else + { + // IP address and port number is embedded in the NetBIOS Datagram Packet. + // Transfer by rewriting it properly + UINT i; + + for (i = 0; i < LIST_NUM(local_ip_list); i++) + { + IP *my_ip = LIST_DATA(local_ip_list, i); + + if (IsIP4(my_ip) && IsZeroIp(my_ip) == false && IsLocalHostIP(my_ip) == false) + { + NBTDG_HEADER *nh = (NBTDG_HEADER *)block->Buf; + + nh->SrcIP = IPToUINT(my_ip); + nh->SrcPort = Endian16(n->PublicPort); + + send_size = SendTo(n->Sock, &dest_ip, dest_port, block->Buf, block->Size); + } + } + } + + if (local_ip_list != NULL) + { + FreeHostIPAddressList(local_ip_list); + } + + FreeBlock(block); + if (send_size == 0) + { + // Determining whether a fatal error + if (n->Sock->IgnoreSendErr == false) + { + // A fatal error occurred + goto DISCONNECT; + } + } + else + { + n->LastCommTime = v->Now; + } + } + + // Examine whether this session timed-out + if ((n->LastCommTime + (UINT64)v->NatUdpTimeout) < v->Now || n->LastCommTime > v->Now) + { + // Time-out + goto DISCONNECT; + } + + return true; + +DISCONNECT: + // Disconnect this session + if (n->UdpSocketCreated) + { + // Close the socket + Disconnect(n->Sock); + ReleaseSock(n->Sock); + n->Sock = NULL; + } + + // Delete the entry + DeleteNatUdp(v, n); + + return false; +} + +// Thread to make a connection to the TCP host +void NatTcpConnectThread(THREAD *t, void *p) +{ + NAT_ENTRY *n = (NAT_ENTRY *)p; + IP ip; + char hostname[MAX_SIZE]; + UINT port_number; + SOCK *sock; + SOCK_EVENT *e; + // Validate arguments + if (n == NULL || t == NULL) + { + return; + } + + UINTToIP(&ip, n->DestIp); + IPToStr(hostname, sizeof(hostname), &ip); + port_number = n->DestPort; + e = n->v->SockEvent; + AddRef(e->ref); + + // Notify the initialization completion + NoticeThreadInit(t); + + // Attempt to connect to the TCP host + Debug("NatTcpConnect Connecting to %s:%u\n", hostname, port_number); + sock = ConnectEx3(hostname, port_number, 0, &n->NatTcpCancelFlag, NULL, NULL, false, true); + if (sock == NULL) + { + // Connection failure + n->TcpMakeConnectionFailed = true; + } + else + { + // Successful connection + n->TcpMakeConnectionSucceed = true; + } + n->Sock = sock; + JoinSockToSockEvent(sock, e); + SetSockEvent(e); + + ReleaseSockEvent(e); +} + +// Create a thread for trying to connect to the TCP host +void CreateNatTcpConnectThread(VH *v, NAT_ENTRY *n) +{ + // Validate arguments + if (v == NULL || n == NULL) + { + return; + } + + // Create a thread + n->NatTcpConnectThread = NewThread(NatTcpConnectThread, (void *)n); + + // Wait for a thread initialization completion + WaitThreadInit(n->NatTcpConnectThread); +} + +// Handle the TCP entry +bool NatTransactTcp(VH *v, NAT_ENTRY *n) +{ + char str[MAX_SIZE]; + bool timeouted = false; + // Validate arguments + if (v == NULL || n == NULL) + { + return false; + } + + if (n->DisconnectNow) + { + goto DISCONNECT; + } + + // Process by state of the TCP + switch (n->TcpStatus) + { + case NAT_TCP_CONNECTING: // Waiting for connection + if (n->NatTcpConnectThread == NULL) + { + // Start a connection by creating a connection thread + CreateNatTcpConnectThread(v, n); + } + else + { + // Wait for the result of the connection thread that has already started + if (n->TcpMakeConnectionFailed || n->TcpMakeConnectionSucceed) + { + // Use the results because operation thread has already finished + WaitThread(n->NatTcpConnectThread, INFINITE); + ReleaseThread(n->NatTcpConnectThread); + n->NatTcpConnectThread = NULL; + + if (n->TcpMakeConnectionSucceed) + { + // Connection is successful, and a Sock was created + n->TcpStatus = NAT_TCP_CONNECTED; + IPToStr32(str, sizeof(str), n->DestIp); + NLog(v, "LH_NAT_TCP_SUCCEED", n->Id, n->Sock->RemoteHostname, str, n->DestPort); + } + else + { + // Failed to connect + n->TcpStatus = NAT_TCP_SEND_RESET; + IPToStr32(str, sizeof(str), n->DestIp); + NLog(v, "LH_NAT_TCP_FAILED", n->Id, str, n->DestPort); + } + v->NatDoCancelFlag = true; + } + } + break; + + case NAT_TCP_CONNECTED: // TCP socket connection completed. Negotiating with the client host + break; + + case NAT_TCP_SEND_RESET: // TCP communication disconnection: Send a RST to the client host + break; + + case NAT_TCP_ESTABLISHED: // TCP connection established + { + UINT old_send_fifo_size = 0; + + // Transmit to the socket if there is data in the receive buffer + while (n->RecvFifo->size > 0) + { + UINT sent_size = Send(n->Sock, ((UCHAR *)n->RecvFifo->p) + n->RecvFifo->pos, + n->RecvFifo->size, false); + if (sent_size == 0) + { + // Communication has been disconnected + n->TcpFinished = true; + v->NatDoCancelFlag = true; + break; + } + else if (sent_size == SOCK_LATER) + { + // Blocking + break; + } + else + { + // Successful transmission + ReadFifo(n->RecvFifo, NULL, sent_size); + n->SendAckNext = true; + + if (false) + { + IP ip; + + n->test_TotalSent += sent_size; + + UINTToIP(&ip, n->DestIp); + Debug("TCP %u: %r:%u %u\n", n->Id, &ip, n->DestPort, (UINT)n->test_TotalSent); + } + } + } + + old_send_fifo_size = FifoSize(n->SendFifo); + + // Write to the transmission buffer by obtaining data from the socket + while (true) + { + void *buf = (void *)v->TmpBuf; + UINT want_to_recv_size = 0; + UINT recv_size; + // Calculate the size of wanting to receive + if (n->SendFifo->size < NAT_SEND_BUF_SIZE) + { + // Still can receive + want_to_recv_size = MIN(NAT_SEND_BUF_SIZE - n->SendFifo->size, NAT_TMPBUF_SIZE); + } + if (want_to_recv_size == 0) + { + SetNoNeedToRead(n->Sock); + break; + } + recv_size = Recv(n->Sock, buf, want_to_recv_size, false); + if (recv_size == 0) + { + // Communication has been disconnected + n->TcpFinished = true; + v->NatDoCancelFlag = true; + if (n->TcpDisconnected == false) + { + Disconnect(n->Sock); + n->TcpDisconnected = true; + } + break; + } + else if (recv_size == SOCK_LATER) + { + // Blocking + break; + } + else + { + // Successful reception + WriteFifo(n->SendFifo, buf, recv_size); + v->NatDoCancelFlag = true; + } + } + + if (old_send_fifo_size == 0 && FifoSize(n->SendFifo) != 0) + { + // Reset the time data for timeout when the data is newly queued + // in the empty transmission buffer in the transmission process + n->TcpLastRecvAckTime = v->Now; + } + + // Raise a transmission time-out if a certain period of time elapsed + // after receiving the last ACK, and the transmission buffer is not + // empty, and the reception window size of other party is not 0 + if ((n->TcpLastRecvAckTime + (UINT64)VIRTUAL_TCP_SEND_TIMEOUT) < v->Now) + { + if (FifoSize(n->SendFifo) != 0 && n->TcpSendWindowSize != 0) + { + timeouted = true; + } + } + } + break; + + } + + // Timeout Detection + if ((n->LastCommTime + (UINT64)v->NatTcpTimeout) < v->Now || n->LastCommTime > v->Now) + { + timeouted = true; + } + + if (timeouted) + { + // Time-out occurs, the session close + n->TcpStatus = NAT_TCP_SEND_RESET; + v->NatDoCancelFlag = true; + } + + return true; + +DISCONNECT: // Disconnect and session disposal + DeleteNatTcp(v, n); + + return false; +} + +// Delete the entry of TCP NAT +void DeleteNatTcp(VH *v, NAT_ENTRY *n) +{ + // Validate arguments + if (v == NULL || n == NULL) + { + return; + } + + NLog(v, "LH_NAT_TCP_DELETED", n->Id); + + // Shutdown of connection thread + if (n->NatTcpConnectThread != NULL) + { + n->NatTcpCancelFlag = true; + + WaitThread(n->NatTcpConnectThread, INFINITE); + ReleaseThread(n->NatTcpConnectThread); + n->NatTcpConnectThread = NULL; + } + if (n->Sock != NULL) + { + // Disconnect the socket + Disconnect(n->Sock); + ReleaseSock(n->Sock); + n->Sock = NULL; + } + + // Release the window memory + if (n->TcpRecvWindow != NULL) + { + ReleaseFifo(n->TcpRecvWindow); + n->TcpRecvWindow = NULL; + } + + // Release the window reception list + if (n->TcpRecvList != NULL) + { + UINT i; + for (i = 0; i < LIST_NUM(n->TcpRecvList); i++) + { + IP_PART *p = LIST_DATA(n->TcpRecvList, i); + Free(p); + } + ReleaseList(n->TcpRecvList); + n->TcpRecvList = NULL; + } + + // FIFO release + ReleaseFifo(n->SendFifo); + ReleaseFifo(n->RecvFifo); + + // Delete from the NAT entry + Delete(v->NatTable, n); + + DeleteLock(n->lock); + + // Release the memory + Free(n); + + Debug("NAT_ENTRY: DeleteNatTcp\n"); +} + +// NAT processing thread +void NatThread(THREAD *t, void *param) +{ + // Validate arguments + if (t == NULL || param == NULL) + { + return; + } + + // Notify the initialization completion + NoticeThreadInit(t); + + NatThreadMain((VH *)param); +} + +// Send a beacon packet +void SendBeacon(VH *v) +{ + UINT dest_ip; + ARPV4_HEADER arp; + static char beacon_str[] = + "SecureNAT Virtual TCP/IP Stack Beacon"; + // Validate arguments + if (v == NULL) + { + return; + } + + // Send an UDP + dest_ip = (v->HostIP & v->HostMask) | (~v->HostMask); + SendUdp(v, dest_ip, 7, v->HostIP, 7, beacon_str, sizeof(beacon_str)); + + // Build the ARP header + arp.HardwareType = Endian16(ARP_HARDWARE_TYPE_ETHERNET); + arp.ProtocolType = Endian16(MAC_PROTO_IPV4); + arp.HardwareSize = 6; + arp.ProtocolSize = 4; + arp.Operation = Endian16(ARP_OPERATION_RESPONSE); + Copy(arp.SrcAddress, v->MacAddress, 6); + arp.SrcIP = v->HostIP; + arp.TargetAddress[0] = + arp.TargetAddress[1] = + arp.TargetAddress[2] = + arp.TargetAddress[3] = + arp.TargetAddress[4] = + arp.TargetAddress[5] = 0xff; + arp.TargetIP = dest_ip; + + // Transmission + VirtualLayer2Send(v, broadcast, v->MacAddress, MAC_PROTO_ARPV4, &arp, sizeof(arp)); +} + +// Send a TCP packet +void SendTcp(VH *v, UINT src_ip, UINT src_port, UINT dest_ip, UINT dest_port, UINT seq, UINT ack, UINT flag, UINT window_size, UINT mss, void *data, UINT size) +{ + static UCHAR tcp_mss_option[] = {0x02, 0x04, 0x00, 0x00, 0x01, 0x01, 0x01, 0x00}; + IPV4_PSEUDO_HEADER *vh; + TCP_HEADER *tcp; + UINT header_size = TCP_HEADER_SIZE; + UINT total_size; + // Validate arguments + if (v == NULL || (size != 0 && data == NULL)) + { + return; + } + + // Memory allocation + vh = Malloc(sizeof(IPV4_PSEUDO_HEADER) + TCP_HEADER_SIZE + size + 32); + tcp = (TCP_HEADER *)(((UCHAR *)vh) + sizeof(IPV4_PSEUDO_HEADER)); + + if (mss != 0) + { + USHORT *mss_size; + mss_size = (USHORT *)(&tcp_mss_option[2]); + *mss_size = Endian16((USHORT)mss); + header_size += sizeof(tcp_mss_option); + } + + total_size = header_size + size; + if (total_size > 65536) + { + // Packet is too long + Free(vh); + return; + } + + // Pseudo header generation + vh->SrcIP = src_ip; + vh->DstIP = dest_ip; + vh->Reserved = 0; + vh->Protocol = IP_PROTO_TCP; + vh->PacketLength = Endian16((USHORT)total_size); + + // TCP header generation + tcp->SrcPort = Endian16((USHORT)src_port); + tcp->DstPort = Endian16((USHORT)dest_port); + tcp->SeqNumber = Endian32(seq); + tcp->AckNumber = Endian32(ack); + tcp->HeaderSizeAndReserved = 0; + TCP_SET_HEADER_SIZE(tcp, (UCHAR)(header_size / 4)); + tcp->Flag = (UCHAR)flag; + tcp->WindowSize = Endian16((USHORT)window_size); + tcp->Checksum = 0; + tcp->UrgentPointer = 0; + + // Copy the option values + if (mss != 0) + { + Copy(((UCHAR *)tcp) + TCP_HEADER_SIZE, tcp_mss_option, sizeof(tcp_mss_option)); + } + + // Data copy + Copy(((UCHAR *)tcp) + header_size, data, size); + + // Checksum calculation + tcp->Checksum = IpChecksum(vh, total_size + 12); + + // Submit as an IP packet + SendIp(v, dest_ip, src_ip, IP_PROTO_TCP, tcp, total_size); + + // Release the memory + Free(vh); +} + +// Polling process of TCP +void PollingNatTcp(VH *v, NAT_ENTRY *n) +{ + // Validate arguments + if (v == NULL || n == NULL) + { + return; + } + + switch (n->TcpStatus) + { + case NAT_TCP_CONNECTING: // Socket connecting: nothing to do + break; + + case NAT_TCP_CONNECTED: // The socket connected: process SYN + ACK, ACK + if ((n->LastSynAckSentTime > v->Now) || n->LastSynAckSentTime == 0 || ((n->LastSynAckSentTime + (UINT64)(NAT_TCP_SYNACK_SEND_TIMEOUT * (UINT64)(n->SynAckSentCount + 1)) <= v->Now))) + { + n->LastSynAckSentTime = v->Now; + // Send a SYN + ACK + SendTcp(v, n->DestIp, n->DestPort, n->SrcIp, n->SrcPort, + (UINT)(n->SendSeqInit + n->SendSeq), + (UINT)(n->RecvSeqInit + n->RecvSeq), + TCP_SYN | TCP_ACK, n->TcpRecvWindowSize, + v->TcpMss, NULL, 0); + n->SynAckSentCount++; + } + break; + + case NAT_TCP_SEND_RESET: // Reset the connection + // Send a RST + if (n->TcpFinished == false || n->TcpForceReset) + { + SendTcp(v, n->DestIp, n->DestPort, n->SrcIp, n->SrcPort, + (UINT)(n->SendSeq + n->SendSeqInit), + (UINT)(n->SendSeq + n->SendSeqInit), + TCP_RST, 0, + 0, NULL, 0); + // Disconnect + n->TcpStatus = NAT_TCP_WAIT_DISCONNECT; + n->DisconnectNow = true; + } + else + { + // Send FINs for NAT_FIN_SEND_MAX_COUNT times + if (n->FinSentTime == 0 || (n->FinSentTime > v->Now) || (n->FinSentTime + NAT_FIN_SEND_INTERVAL * (n->FinSentCount + 1)) < v->Now) + { + SendTcp(v, n->DestIp, n->DestPort, n->SrcIp, n->SrcPort, + (UINT)(n->SendSeq + n->SendSeqInit), + (UINT)(n->RecvSeq + n->RecvSeqInit), + TCP_ACK | TCP_FIN, 0, + 0, NULL, 0); + n->FinSentTime = v->Now; + n->FinSentSeq = (UINT)(n->SendSeq + n->SendSeqInit); + n->FinSentCount++; + if (n->FinSentCount >= NAT_FIN_SEND_MAX_COUNT) + { + n->TcpFinished = false; + } + } + } + break; + + case NAT_TCP_ESTABLISHED: // Connection established + { + UINT send_data_size; + UINT current_pointer; + UINT notice_window_size_value = 0; + UINT buf_free_bytes = 0; + // Determine the value of the window size to be notified + if (FifoSize(n->RecvFifo) < NAT_RECV_BUF_SIZE) + { + buf_free_bytes = NAT_RECV_BUF_SIZE - FifoSize(n->RecvFifo); + } + notice_window_size_value = MIN(n->TcpRecvWindowSize, buf_free_bytes); + if (n->LastSentKeepAliveTime == 0 || + (n->LastSentKeepAliveTime + (UINT64)NAT_ACK_KEEPALIVE_SPAN) < v->Now || + (n->LastSentKeepAliveTime > v->Now)) + { + if (n->LastSentKeepAliveTime != 0) + { + // Send an ACK packet for Keep-Alive + SendTcp(v, n->DestIp, n->DestPort, n->SrcIp, n->SrcPort, + (UINT)(n->SendSeqInit + n->SendSeq), + (UINT)(n->RecvSeqInit + n->RecvSeq) - 1, + TCP_ACK, + notice_window_size_value, + 0, + NULL, + 0); + } + n->LastSentKeepAliveTime = v->Now; + } + if (n->TcpLastSentTime == 0 || + (n->TcpLastSentTime > v->Now) || + ((n->TcpLastSentTime + (UINT64)n->TcpSendTimeoutSpan) < v->Now) || + n->SendAckNext) + { + // If there is data to send, send the data + // Calculate the segment size to be transmitted + send_data_size = n->TcpSendWindowSize; + if (send_data_size > (n->TcpSendCWnd * n->TcpSendMaxSegmentSize)) + { + // Apply the cwnd value + send_data_size = n->TcpSendCWnd * n->TcpSendMaxSegmentSize; + } + if (send_data_size > n->SendFifo->size) + { + // Can not be sent over the data that is currently held + send_data_size = n->SendFifo->size; + } + if (send_data_size >= 1) + { + // Transmit the fragmented segments + current_pointer = 0; + while (send_data_size > 0) + { + UINT send_segment_size = MIN(n->TcpSendMaxSegmentSize, send_data_size); + void *send_segment = (void *)(((UCHAR *)n->SendFifo->p) + n->SendFifo->pos + current_pointer); + SendTcp(v, n->DestIp, n->DestPort, n->SrcIp, n->SrcPort, + (UINT)(n->SendSeqInit + n->SendSeq + (UINT64)current_pointer), + (UINT)(n->RecvSeqInit + n->RecvSeq), + TCP_ACK | TCP_PSH, + notice_window_size_value, + 0, + send_segment, + send_segment_size); + current_pointer += send_segment_size; + send_data_size -= send_segment_size; + } + // Record the transmission time + n->TcpLastSentTime = v->Now; + // Record the stream size to be transmitted this time + n->SendMissionSize = current_pointer; + n->CurrentSendingMission = true; + // RTT measurement + if (n->CalcRTTStartTime == 0) + { + n->CalcRTTStartTime = v->Now; + n->CalcRTTStartValue = n->SendSeq + current_pointer - 1; + } + if (n->RetransmissionUsedFlag == false) + { + n->RetransmissionUsedFlag = true; + } + else + { + // Congestion is detected + if (n->TcpSendCWnd > 2) + { + n->TcpSendCWnd--; + } + } + } + else if (n->SendAckNext) + { + // Send only an ACK + SendTcp(v, n->DestIp, n->DestPort, n->SrcIp, n->SrcPort, + (UINT)(n->SendSeqInit + n->SendSeq), + (UINT)(n->RecvSeqInit + n->RecvSeq), + TCP_ACK, + notice_window_size_value, + 0, + NULL, + 0); + } + n->SendAckNext = false; + } + if (n->TcpFinished) + { + // Disconnect if all data transmission has completed + if (n->SendFifo->size == 0 && n->RecvFifo->size == 0) + { + n->TcpStatus = NAT_TCP_SEND_RESET; + } + } + } + break; + } +} + +// Reception of TCP packets addressed to the Internet +void TcpRecvForInternet(VH *v, UINT src_ip, UINT src_port, UINT dest_ip, UINT dest_port, TCP_HEADER *tcp, void *data, UINT size, UINT max_l3_size) +{ + NAT_ENTRY *n, t; + UINT seq, ack; + UINT64 seq64 = 0, ack64 = 0; + // Validate arguments + if (v == NULL || tcp == NULL || data == NULL) + { + return; + } + + if (NnIsActive(v)) + { + NnTcpRecvForInternet(v, src_ip, src_port, dest_ip, dest_port, tcp, data, size, max_l3_size); + return; + } + + seq = Endian32(tcp->SeqNumber); + ack = Endian32(tcp->AckNumber); + + if (v->HubOption != NULL && v->HubOption->DisableUserModeSecureNAT) + { + // Disable User-mode NAT + SendTcp(v, dest_ip, dest_port, src_ip, src_port, + 0, seq + 1, TCP_RST | TCP_ACK, 0, 0, NULL, 0); + return; + } + + // Search for a session for this packet from the NAT table + SetNat(&t, NAT_TCP, src_ip, src_port, dest_ip, dest_port, 0, 0); + n = SearchNat(v, &t); + + if (n == NULL) + { + // There is no existing session + // Allow through only SYN packet + if ((tcp->Flag & TCP_SYN) && ((tcp->Flag & TCP_ACK) == false)) + { + TCP_OPTION o; + // Create a new session + n = CreateNatTcp(v, src_ip, src_port, dest_ip, dest_port); + if (n == NULL) + { + // Return the RST if it was not possible to create + SendTcp(v, dest_ip, dest_port, src_ip, src_port, + 0, seq + 1, TCP_RST | TCP_ACK, 0, 0, NULL, 0); + return; + } + + // Get the options + ParseTcpOption(&o, ((UCHAR *)tcp) + TCP_HEADER_SIZE, TCP_GET_HEADER_SIZE(tcp) * 4 - TCP_HEADER_SIZE); + if (o.MaxSegmentSize == 0) + { + o.MaxSegmentSize = v->TcpMss; + } + + Debug("TCP SYN: MSS=%u, WS=%u\n", o.MaxSegmentSize, o.WindowScaling); + + // Initial sequence number + n->RecvSeqInit = (UINT64)Endian32(tcp->SeqNumber); + n->RecvSeq = 1; + + n->TcpSendMaxSegmentSize = o.MaxSegmentSize; + n->TcpRecvWindowSize = NAT_TCP_RECV_WINDOW_SIZE; + n->TcpSendWindowSize = (UINT)Endian16(tcp->WindowSize); + if (o.WindowScaling != 0) + { + if (o.WindowScaling > 14) + { + o.WindowScaling = 14; + } + n->TcpSendWindowSize = (n->TcpSendWindowSize << o.WindowScaling); + } + } + } + + if (n == NULL) + { + // Return a RST since a packet which is not registered in the NAT entry arrived + SendTcp(v, dest_ip, dest_port, src_ip, src_port, + ack, ack, TCP_RST, 0, 0, NULL, 0); + return; + } + + n->TcpLastRecvAckTime = v->Now; + + switch (n->TcpStatus) + { + case NAT_TCP_SEND_RESET: // Disconnect the connection by sending a RST + if ((tcp->Flag & TCP_ACK) && ((tcp->Flag & TCP_SYN) == false)) + { + if (n->FinSentCount >= 1) + { + if (ack == (n->FinSentSeq + 1)) + { + n->TcpForceReset = true; + } + } + } + break; + + case NAT_TCP_CONNECTED: // Socket connection completion: SYN + ACK, ACK processing + if ((tcp->Flag & TCP_ACK) && ((tcp->Flag & TCP_SYN) == false)) + { + if (seq == (UINT)(n->RecvSeqInit + n->RecvSeq) && + ack == (UINT)(n->SendSeqInit + n->SendSeq + 1)) + { + // Handshake complete since the ACK packet came back + n->SendSeq++; // SYN packet consumes the seq by 1 + Debug("TCP Connection Established.\n"); + n->TcpStatus = NAT_TCP_ESTABLISHED; + // Initialize the congestion window size + n->TcpSendCWnd = 1; + n->LastCommTime = v->Now; + } + else + { + goto TCP_RESET; + } + } + else if (tcp->Flag & TCP_RST) + { +TCP_RESET: + // Receive a RST + Debug("TCP Connection Reseted.\n"); + n->TcpStatus = NAT_TCP_SEND_RESET; + } + break; + + case NAT_TCP_ESTABLISHED: // Connection established + if (tcp->Flag & TCP_FIN) + { + // Complete the connection + n->TcpFinished = true; + } + if (tcp->Flag & TCP_RST) + { + // Receive a RST + goto TCP_RESET; + } + else if (tcp->Flag & TCP_ACK) + { + TCP_OPTION opt; + n->LastCommTime = v->Now; + // Get the options, such as window size + n->TcpSendWindowSize = Endian16(tcp->WindowSize); + ParseTcpOption(&opt, ((UCHAR *)tcp) + TCP_HEADER_SIZE, TCP_GET_HEADER_SIZE(tcp) * 4 - TCP_HEADER_SIZE); + if (opt.WindowScaling != 0) + { + if (opt.WindowScaling > 14) + { + opt.WindowScaling = 14; + } + n->TcpSendWindowSize = (n->TcpSendWindowSize << opt.WindowScaling); + } + // First, process the received ACK + // Store the end position of the stream that has received the acknowledgment to ack64 + ack64 = n->SendSeq + (UINT64)ack - (n->SendSeqInit + n->SendSeq) % X32; + if ((n->SendSeqInit + n->SendSeq) % X32 > ack) + { + if (((n->SendSeqInit + n->SendSeq) % X32 - ack) >= 0x80000000) + { + ack64 = n->SendSeq + (UINT64)ack + X32 - (n->SendSeqInit + n->SendSeq) % X32; + } + } + if (ack64 > n->SendSeq) + { + // Reception of 1 byte or more seems to have been completed by the client + UINT slide_offset = (UINT)(ack64 - n->SendSeq); // Sliding size of the window + if (slide_offset == 0 || slide_offset > n->TcpSendWindowSize || slide_offset > n->SendFifo->size) + { + // Ignore because the offset value of acknowledgment is + // larger than the size that should have been sent so far + } + else + { + // RTT measurement + if (n->CalcRTTStartTime != 0) + { + if (n->CalcRTTStartValue < ack64) + { + UINT time_span; + if (v->Now > n->CalcRTTStartTime) + { + time_span = (UINT)(v->Now - n->CalcRTTStartTime); + } + else + { + time_span = 100; + } + n->CalcRTTStartTime = 0; + + // Smoothing + n->CurrentRTT = + (UINT) + ( + ((UINT64)n->CurrentRTT * (UINT64)9 + + (UINT64)time_span * (UINT64)1) / (UINT64)10 + ); + n->TcpSendTimeoutSpan = n->CurrentRTT * 2; + } + } + // Reduce the transmission size + n->SendMissionSize -= slide_offset; + if (n->SendMissionSize == 0) + { + // Try to increase the transmission segment size because + // all segments to be sent this time have been sent + if (n->TcpSendCWnd < 65536) + { + n->TcpSendCWnd++; + } + n->CurrentSendingMission = false; + n->TcpLastSentTime = 0; + n->RetransmissionUsedFlag = false; + } + // Slide the buffer + n->SendSeq += slide_offset; + ReadFifo(n->SendFifo, NULL, slide_offset); + // Send further by the size of confirmed transmission completion by the ACK this time + if (n->SendMissionSize != 0 && false) + { + UINT notice_window_size_value = 0; + UINT send_data_size; + UINT buf_free_bytes; + UINT send_offset = n->SendMissionSize; + // Determine the value of the window size to be notified + if (FifoSize(n->RecvFifo) < NAT_RECV_BUF_SIZE) + { + buf_free_bytes = NAT_RECV_BUF_SIZE - FifoSize(n->RecvFifo); + } + notice_window_size_value = MIN(n->TcpRecvWindowSize, buf_free_bytes); + // Calculate the segment size to be transmitted + send_data_size = n->TcpSendWindowSize; + if (send_data_size > (n->TcpSendCWnd * n->TcpSendMaxSegmentSize)) + { + // Apply the cwnd value + send_data_size = n->TcpSendCWnd * n->TcpSendMaxSegmentSize; + } + if (n->SendFifo->size > send_offset) + { + send_data_size = MIN(send_data_size, n->SendFifo->size - send_offset); + send_data_size = MIN(send_data_size, slide_offset); + } + else + { + send_data_size = 0; + } + if (send_data_size >= 1) + { + // Transmit the fragmented segments + UINT current_pointer = 0; + while (send_data_size > 0) + { + UINT send_segment_size = MIN(n->TcpSendMaxSegmentSize, send_data_size); + void *send_segment = (void *)(( + (UCHAR *)n->SendFifo->p) + n->SendFifo->pos + + current_pointer + send_offset); + + SendTcp(v, n->DestIp, n->DestPort, n->SrcIp, n->SrcPort, + (UINT)(n->SendSeqInit + n->SendSeq + (UINT64)current_pointer + + (UINT)send_offset), + (UINT)(n->RecvSeqInit + n->RecvSeq), + TCP_ACK | TCP_PSH, + notice_window_size_value, + 0, + send_segment, + send_segment_size); + current_pointer += send_segment_size; + send_data_size -= send_segment_size; + } + n->SendMissionSize += current_pointer; + n->CurrentSendingMission = true; + n->TcpLastSentTime = v->Now; + // RTT measurement + if (n->CalcRTTStartTime == 0) + { + n->CalcRTTStartTime = v->Now; + n->CalcRTTStartValue = n->SendSeq + current_pointer - 1; + } + } + } + // Event occurs + SetSockEvent(v->SockEvent); + } + } + // Next, receive the data + seq64 = n->RecvSeq + (UINT64)seq - (n->RecvSeqInit + n->RecvSeq) % X32; + if ((n->RecvSeqInit + n->RecvSeq) % X32 > seq) + { + if (((n->RecvSeqInit + n->RecvSeq) % X32 - seq) >= 0x80000000) + { + seq64 = n->RecvSeq + (UINT64)seq + X32 - (n->RecvSeqInit + n->RecvSeq) % X32; + } + } + // Position of the starting point of the data from the client is in the seq64 at this time + if (seq64 >= n->RecvSeq && (seq64 + size) <= (n->RecvSeq + n->TcpRecvWindowSize)) + { + if (size >= 1) + { + // One or more bytes of data has been received within the receive window + UINT offset = (UINT)(seq64 - n->RecvSeq); + UINT i; + IP_PART *me; + if (n->TcpRecvWindow == NULL) + { + n->TcpRecvWindow = NewFifo(); + } + if (n->TcpRecvList == NULL) + { + n->TcpRecvList = NewListFast(NULL); + } + // Add to the list by overwriting arriving packets to the buffer + if (FifoSize(n->TcpRecvWindow) < (offset + size)) + { + // Buffer size expansion + WriteFifo(n->TcpRecvWindow, NULL, offset + size - FifoSize(n->TcpRecvWindow)); + } + Copy(((UCHAR *)n->TcpRecvWindow->p) + n->TcpRecvWindow->pos + + offset, data, size); + me = ZeroMalloc(sizeof(IP_PART)); + me->Offset = offset; + me->Size = size; + for (i = 0; i < LIST_NUM(n->TcpRecvList); i++) + { + IP_PART *p = LIST_DATA(n->TcpRecvList, i); + // If there are overlapped region, remove these + if (p->Size != 0) + { + if (me->Offset <= p->Offset && (me->Offset + me->Size) >= (p->Offset + p->Size)) + { + // This packet completely overwrite the existing packet + p->Size = 0; + } + else if (me->Offset >= p->Offset && (me->Offset + me->Size) <= (p->Offset + p->Size)) + { + // Existing packet completely override this packet + me->Size = 0; + } + else if (me->Offset > p->Offset && me->Offset < (p->Offset + p->Size) && + (me->Offset + me->Size) > (p->Offset + p->Size)) + { + // Partially overlapped + p->Size -= p->Offset + p->Size - me->Offset; + } + else if (me->Offset < p->Offset && (me->Offset + size) > p->Offset && (me->Offset + size) < (p->Offset + p->Size)) + { + // Partially overlapped + me->Size -= me->Offset + me->Size - p->Offset; + } + } + } + if (me->Size == 0) + { + Free(me); + } + else + { + Add(n->TcpRecvList, me); + } +KILL_NULL_FIRST: + // Remove all blank items from reception list + for (i = 0; i < LIST_NUM(n->TcpRecvList); i++) + { + IP_PART *p = LIST_DATA(n->TcpRecvList, i); + if (p->Size == 0) + { + Delete(n->TcpRecvList, p); + Free(p); + goto KILL_NULL_FIRST; + } + } +SCAN_FIRST: + // Extract if there is something starting at offset 0 in the received list + for (i = 0; i < LIST_NUM(n->TcpRecvList); i++) + { + IP_PART *p = LIST_DATA(n->TcpRecvList, i); + UINT sz; + if (p->Offset == 0) + { + // Since a data block starts with 0 is found, + // slide it left by that amount and write the buffer + // for extracting data to the FIFO + sz = p->Size; + WriteFifo(n->RecvFifo, ((UCHAR *)n->TcpRecvWindow->p) + n->TcpRecvWindow->pos, sz); + // Release from the list + Delete(n->TcpRecvList, p); + Free(p); + ReadFifo(n->TcpRecvWindow, NULL, sz); + // Slide all the items to the left + for (i = 0; i < LIST_NUM(n->TcpRecvList); i++) + { + p = LIST_DATA(n->TcpRecvList, i); + p->Offset -= sz; + } + // Update the parameters of the TCB + n->RecvSeq += (UINT64)sz; + SetSockEvent(v->SockEvent); + n->SendAckNext = true; + // Re-scan from the beginning + goto SCAN_FIRST; + } + } + } + } + } + break; + } + + SetSockEvent(v->SockEvent); +} + +// Parse the TCP options +void ParseTcpOption(TCP_OPTION *o, void *data, UINT size) +{ + UCHAR *buf = (UCHAR *)data; + UINT i = 0; + UINT value_size = 0; + UINT value_id = 0; + UCHAR value[128]; + // Validate arguments + if (o == NULL || data == NULL) + { + return; + } + + Zero(o, sizeof(TCP_OPTION)); + + while(i < size) + { + if (buf[i] == 0) + { + return; + } + else if (buf[i] == 1) + { + i++; + continue; + } + else + { + value_id = buf[i]; + i++; + if (i >= size) + { + return; + } + value_size = buf[i]; + if (value_size <= 1 || value_size > sizeof(value)) + { + return; + } + i++; + if (i >= size) + { + return; + } + value_size -= 2; + + Copy(value, &buf[i], value_size); + i += value_size; + if (i > size) + { + return; + } + + switch (value_id) + { + case 2: // MSS + if (value_size == 2) + { + USHORT *mss = (USHORT *)value; + o->MaxSegmentSize = Endian16(*mss); + } + break; + + case 3: // WSS + if (value_size == 1) + { + UCHAR *wss = (UCHAR *)value; + o->WindowScaling = *wss; + } + break; + + } + } + } +} + +// Create a new NAT TCP session +NAT_ENTRY *CreateNatTcp(VH *v, UINT src_ip, UINT src_port, UINT dest_ip, UINT dest_port) +{ + NAT_ENTRY *n; + HUB_OPTION *o; + // Validate arguments + if (v == NULL) + { + return NULL; + } + + if (CanCreateNewNatEntry(v) == false) + { + return NULL; + } + + o = NatGetHubOption(v); + + // Fail immediately if the connection with SYN_SENT are too many + if (o != NULL && o->SecureNAT_MaxTcpSynSentPerIp != 0) + { + if (GetNumNatEntriesPerIp(v, src_ip, NAT_TCP, true) >= o->SecureNAT_MaxTcpSynSentPerIp) + { + return NULL; + } + } + + // If the connections other than SYN_SENT are too many, delete old ones + if (o != NULL && o->SecureNAT_MaxTcpSessionsPerIp != 0) + { + if (GetNumNatEntriesPerIp(v, src_ip, NAT_TCP, false) >= o->SecureNAT_MaxTcpSessionsPerIp) + { + NAT_ENTRY *oldest = GetOldestNatEntryOfIp(v, src_ip, NAT_TCP); + + if (oldest != NULL) + { + DisconnectNatEntryNow(v, oldest); + } + } + } + + // Create a NAT entry + n = ZeroMalloc(sizeof(NAT_ENTRY)); + n->Id = Inc(v->Counter); + n->v = v; + n->lock = NewLock(); + n->Protocol = NAT_TCP; + n->SrcIp = src_ip; + n->SrcPort = src_port; + n->DestIp = dest_ip; + n->DestPort = dest_port; + n->CreatedTime = n->LastCommTime = v->Now; + n->TcpLastRecvAckTime = v->Now; + n->Sock = NULL; + n->DisconnectNow = false; + n->TcpSendMaxSegmentSize = n->TcpRecvMaxSegmentSize = v->TcpMss; + + n->SendFifo = NewFifo(); + n->RecvFifo = NewFifo(); + + n->TcpStatus = NAT_TCP_CONNECTING; + + n->SendSeqInit = Rand32(); + n->CurrentRTT = NAT_INITIAL_RTT_VALUE; + n->TcpSendTimeoutSpan = n->CurrentRTT * 2; + + // Add to the NAT table + Add(v->NatTable, n); + + +#if 1 + { + IP ip1, ip2; + char s1[MAX_SIZE], s2[MAX_SIZE]; + UINTToIP(&ip1, src_ip); + UINTToIP(&ip2, dest_ip); + IPToStr(s1, 0, &ip1); + IPToStr(s2, 0, &ip2); + Debug("NAT_ENTRY: CreateNatTcp %s %u -> %s %u\n", s1, src_port, s2, dest_port); + + NLog(v, "LH_NAT_TCP_CREATED", n->Id, s1, src_port, s2, dest_port); + } +#endif + + return n; +} + +// Received TCP packets from the virtual network +void VirtualTcpReceived(VH *v, UINT src_ip, UINT dest_ip, void *data, UINT size, UINT max_l3_size) +{ + TCP_HEADER *tcp; + UINT src_port, dest_port; + UINT header_size, buf_size; + void *buf; + IP ip1, ip2; + // Validate arguments + if (v == NULL || data == NULL) + { + return; + } + + // Get the header + if (size < TCP_HEADER_SIZE) + { + // Size is too small + return; + } + tcp = (TCP_HEADER *)data; + src_port = Endian16(tcp->SrcPort); + dest_port = Endian16(tcp->DstPort); + if (src_port == 0 || dest_port == 0) + { + // Port number is invalid + return; + } + if (src_ip == dest_ip || src_ip == 0 || src_ip == 0xffffffff || dest_ip == 0 || dest_ip == 0xffffffff) + { + // IP address is invalid + return; + } + UINTToIP(&ip1, src_ip); + UINTToIP(&ip2, dest_ip); + if (ip1.addr[0] == 127 || ip2.addr[0] == 127) + { + // Loopback IP address can not be specified + return; + } + if (IsInNetwork(dest_ip, v->HostIP, v->HostMask)) + { + // Ignore the packets toward the network of the virtual LAN side + return; + } + // Get the header size + header_size = TCP_GET_HEADER_SIZE(tcp) * 4; + if (size < header_size) + { + // Header size is invalid + return; + } + // Get the address and size of the buffer + buf_size = size - header_size; + buf = (void *)(((UCHAR *)data) + header_size); + + TcpRecvForInternet(v, src_ip, src_port, dest_ip, dest_port, tcp, buf, buf_size, max_l3_size); +} + +// NAT ICMP polling +void PollingNatIcmp(VH *v, NAT_ENTRY *n) +{ + // Validate arguments + if (v == NULL || n == NULL) + { + return; + } + + // Process if there are any packets in the receive queue + if (n->UdpRecvQueue->num_item != 0) + { + BLOCK *block; + + // Send all ICMP packets to the virtual network + while (block = GetNext(n->UdpRecvQueue)) + { + // Rewrite the destination IP address of the returned packet to the IP address of the client + UCHAR *data; + UINT size; + + data = (UCHAR *)block->Buf; + size = block->Size; + + if (size >= sizeof(IPV4_HEADER)) + { + IPV4_HEADER *ipv4 = (IPV4_HEADER *)data; + UINT ipv4_header_size = GetIpHeaderSize((UCHAR *)ipv4, size); + + if (ipv4_header_size >= sizeof(IPV4_HEADER) && (Endian16(ipv4->TotalLength) >= ipv4_header_size)) + { + UCHAR *ipv4_payload = data + ipv4_header_size; + UINT ipv4_payload_size = Endian16(ipv4->TotalLength) - ipv4_header_size; + + if (ipv4_payload_size >= sizeof(ICMP_HEADER) + sizeof(ICMP_ECHO)) + { + ICMP_HEADER *icmp = (ICMP_HEADER *)(data + ipv4_header_size); + UINT icmp_size = ipv4_payload_size; + + if (icmp->Type == ICMP_TYPE_DESTINATION_UNREACHABLE || icmp->Type == ICMP_TYPE_TIME_EXCEEDED) + { + // Rewrite the Src IP of the IPv4 header of the ICMP response packet + if (icmp_size >= (sizeof(ICMP_HEADER) + sizeof(ICMP_ECHO) + sizeof(IPV4_HEADER))) + { + IPV4_HEADER *orig_ipv4 = (IPV4_HEADER *)(data + ipv4_header_size + sizeof(ICMP_HEADER) + sizeof(ICMP_ECHO)); + UINT orig_ipv4_size = icmp_size - (sizeof(ICMP_HEADER) + sizeof(ICMP_ECHO)); + + UINT orig_ipv4_header_size = GetIpHeaderSize((UCHAR *)orig_ipv4, orig_ipv4_size); + + if (orig_ipv4_header_size >= sizeof(IPV4_HEADER)) + { + orig_ipv4->SrcIP = n->SrcIp; + orig_ipv4->Checksum = 0; + orig_ipv4->Checksum = IpChecksum(orig_ipv4, orig_ipv4_header_size); + } + } + } + + // Recalculate the checksum of ICMP + icmp->Checksum = IpChecksum(icmp, icmp_size); + + SendIpEx(v, n->SrcIp, ipv4->SrcIP, ipv4->Protocol, ipv4_payload, ipv4_payload_size, + MAX(ipv4->TimeToLive - 1, 1)); + } + } + } + + FreeBlock(block); + } + + if (v->IcmpRawSocketOk == false) + { + // Release the NAT entry as soon as the results is received in the case of using ICMP API + n->DisconnectNow = true; + } + } +} + +// NAT UDP polling +void PoolingNatUdp(VH *v, NAT_ENTRY *n) +{ + // Validate arguments + if (v == NULL || n == NULL) + { + return; + } + + // Process if there are any packets in the receive queue + if (n->UdpRecvQueue->num_item != 0) + { + BLOCK *block; + + // Send all UDP packets to the virtual network + while (block = GetNext(n->UdpRecvQueue)) + { + UINT src_ip = n->DestIp; + + if (src_ip == 0xFFFFFFFF) + { + src_ip = v->HostIP; + } + + if (block->Param1 != 0) + { + src_ip = block->Param1; + } + + SendUdp(v, n->SrcIp, n->SrcPort, src_ip, n->DestPort, + block->Buf, block->Size); + + FreeBlock(block); + } + } +} + +// NAT polling +void PoolingNat(VH *v) +{ + UINT i; + // Validate arguments + if (v == NULL) + { + return; + } + + if (NnIsActive(v)) + { + // Poll whether the packet comes from native NAT + NnPoll(v->NativeNat); + } + + // Process by scanning the all NAT entries + for (i = 0; i < LIST_NUM(v->NatTable); i++) + { + NAT_ENTRY *n = LIST_DATA(v->NatTable, i); + + switch (n->Protocol) + { + case NAT_TCP: + PollingNatTcp(v, n); + break; + + case NAT_UDP: + PoolingNatUdp(v, n); + break; + + case NAT_ICMP: + PollingNatIcmp(v, n); + break; + + case NAT_DNS: + PollingNatDns(v, n); + break; + } + } +} + +// Comparison function of the NAT table entry +int CompareNat(void *p1, void *p2) +{ + NAT_ENTRY *n1, *n2; + if (p1 == NULL || p2 == NULL) + { + return 0; + } + n1 = *(NAT_ENTRY **)p1; + n2 = *(NAT_ENTRY **)p2; + if (n1 == n2) + { + return 0; + } + + if (n1->SrcIp > n2->SrcIp) return 1; + else if (n1->SrcIp < n2->SrcIp) return -1; + else if (n1->DestIp > n2->DestIp) return 1; + else if (n1->DestIp < n2->DestIp) return -1; + else if (n1->SrcPort > n2->SrcPort) return 1; + else if (n1->SrcPort < n2->SrcPort) return -1; + else if (n1->DestPort > n2->DestPort) return 1; + else if (n1->DestPort < n2->DestPort) return -1; + else if (n1->Protocol > n2->Protocol) return 1; + else if (n1->Protocol < n2->Protocol) return -1; + else return 0; +} + +// Configure the NAT structure +void SetNat(NAT_ENTRY *n, UINT protocol, UINT src_ip, UINT src_port, UINT dest_ip, UINT dest_port, UINT public_ip, UINT public_port) +{ + // Validate arguments + if (n == NULL) + { + return; + } + + n->Protocol = protocol; + n->SrcIp = src_ip; + n->SrcPort = src_port; + n->DestIp = dest_ip; + n->DestPort = dest_port; + n->PublicIp = public_ip; + n->PublicPort = public_port; +} + +// Initialize the NAT +void InitNat(VH *v) +{ + // Validate arguments + if (v == NULL) + { + return; + } + + // Create a NAT table + v->NatTable = NewList(CompareNat); + + // Create a socket event + v->SockEvent = NewSockEvent(); + + // Create the NAT thread + v->HaltNat = false; + v->NatThread = NewThread(NatThread, (void *)v); + WaitThreadInit(v->NatThread); + + if (IsEthSupported()) + { + // Start a native NAT if access to the layer 2 Ethernet is supported + v->NativeNat = NewNativeNat(v); + } +} + +// Release the NAT +void FreeNat(VH *v) +{ + // Validate arguments + if (v == NULL) + { + return; + } + + // Stop the native NAT + if (v->NativeNat != NULL) + { + FreeNativeNat(v->NativeNat); + v->NativeNat = NULL; + } + + // Stop the NAT thread + v->HaltNat = true; + SetSockEvent(v->SockEvent); + WaitThread(v->NatThread, INFINITE); + ReleaseThread(v->NatThread); + v->NatThread = NULL; + ReleaseSockEvent(v->SockEvent); + v->SockEvent = NULL; + + // Release the NAT table + ReleaseList(v->NatTable); +} + +// Search the NAT table +NAT_ENTRY *SearchNat(VH *v, NAT_ENTRY *target) +{ + NAT_ENTRY *n; + // Validate arguments + if (v == NULL || target == NULL) + { + return NULL; + } + + // Binary search + n = (NAT_ENTRY *)Search(v->NatTable, target); + + return n; +} + +// Delete the UDP NAT entry +void DeleteNatUdp(VH *v, NAT_ENTRY *n) +{ + BLOCK *block; + // Validate arguments + if (v == NULL || n == NULL) + { + return; + } + + NLog(v, "LH_NAT_UDP_DELETED", n->Id); + + // Release all queues + while (block = GetNext(n->UdpRecvQueue)) + { + FreeBlock(block); + } + ReleaseQueue(n->UdpRecvQueue); + while (block = GetNext(n->UdpSendQueue)) + { + FreeBlock(block); + } + ReleaseQueue(n->UdpSendQueue); + + // Release the socket + if (n->Sock != NULL) + { + Disconnect(n->Sock); + ReleaseSock(n->Sock); + n->Sock = NULL; + } + + DeleteLock(n->lock); + + // Remove from the table + Delete(v->NatTable, n); + + // Release the memory + Free(n); + + Debug("NAT: DeleteNatUdp\n"); + +} + +// Delete the ICMP NAT entry +void DeleteNatIcmp(VH *v, NAT_ENTRY *n) +{ + BLOCK *block; + // Validate arguments + if (v == NULL || n == NULL) + { + return; + } + + //NLog(v, "LH_NAT_ICMP_DELETED", n->Id); + + // Release all queues + while (block = GetNext(n->UdpRecvQueue)) + { + FreeBlock(block); + } + ReleaseQueue(n->UdpRecvQueue); + while (block = GetNext(n->UdpSendQueue)) + { + FreeBlock(block); + } + ReleaseQueue(n->UdpSendQueue); + + if (n->IcmpQueryBlock != NULL) + { + FreeBlock(n->IcmpQueryBlock); + } + + if (n->IcmpResponseBlock != NULL) + { + FreeBlock(n->IcmpResponseBlock); + } + + if (n->IcmpOriginalCopy != NULL) + { + Free(n->IcmpOriginalCopy); + } + + // Release the socket + if (n->Sock != NULL) + { + Disconnect(n->Sock); + ReleaseSock(n->Sock); + n->Sock = NULL; + } + + DeleteLock(n->lock); + + // Remove from the table + Delete(v->NatTable, n); + + // Release the memory + Free(n); + + Debug("NAT: DeleteNatIcmp\n"); + +} + +// Create a NAT ICMP entry +NAT_ENTRY *CreateNatIcmp(VH *v, UINT src_ip, UINT src_port, UINT dest_ip, UINT dest_port, UCHAR *original_copy, UINT original_copy_size) +{ + NAT_ENTRY *n; + HUB_OPTION *o; + // Validate arguments + if (v == NULL || original_copy == NULL || original_copy_size == 0) + { + return NULL; + } + + if (CanCreateNewNatEntry(v) == false) + { + return NULL; + } + + o = NatGetHubOption(v); + if (o != NULL && o->SecureNAT_MaxIcmpSessionsPerIp != 0) + { + if (GetNumNatEntriesPerIp(v, src_ip, NAT_ICMP, false) >= o->SecureNAT_MaxIcmpSessionsPerIp) + { + NAT_ENTRY *oldest = GetOldestNatEntryOfIp(v, src_ip, NAT_ICMP); + + if (oldest != NULL) + { + DisconnectNatEntryNow(v, oldest); + } + } + } + + n = ZeroMalloc(sizeof(NAT_ENTRY)); + n->Id = Inc(v->Counter); + n->v = v; + n->lock = NewLock(); + n->Protocol = NAT_ICMP; + n->SrcIp = src_ip; + n->SrcPort = src_port; + n->DestIp = dest_ip; + n->DestPort = dest_port; + + n->CreatedTime = n->LastCommTime = v->Now; + + n->UdpSendQueue = NewQueue(); + n->UdpRecvQueue = NewQueue(); + + n->UdpSocketCreated = false; + + n->IcmpOriginalCopy = Clone(original_copy, original_copy_size); + n->IcmpOriginalCopySize = original_copy_size; + + SetSockEvent(v->SockEvent); + +#if 1 + { + IP ip1, ip2; + char s1[MAX_SIZE], s2[MAX_SIZE]; + UINTToIP(&ip1, src_ip); + UINTToIP(&ip2, dest_ip); + IPToStr(s1, 0, &ip1); + IPToStr(s2, 0, &ip2); + Debug("NAT_ENTRY: CreateNatIcmp %s %u -> %s %u\n", s1, src_port, s2, dest_port); + + //NLog(v, "LH_NAT_ICMP_CREATED", n->Id, s1, s2, src_port); + } +#endif + + Add(v->NatTable, n); + + return n; +} + +// Create a NAT UDP entry +NAT_ENTRY *CreateNatUdp(VH *v, UINT src_ip, UINT src_port, UINT dest_ip, UINT dest_port, UINT dns_proxy_ip) +{ + NAT_ENTRY *n; + HUB_OPTION *o; + // Validate arguments + if (v == NULL) + { + return NULL; + } + + if (CanCreateNewNatEntry(v) == false) + { + return NULL; + } + + o = NatGetHubOption(v); + if (o != NULL && o->SecureNAT_MaxTcpSessionsPerIp != 0) + { + if (GetNumNatEntriesPerIp(v, src_ip, NAT_UDP, false) >= o->SecureNAT_MaxUdpSessionsPerIp) + { + NAT_ENTRY *oldest = GetOldestNatEntryOfIp(v, src_ip, NAT_UDP); + + if (oldest != NULL) + { + DisconnectNatEntryNow(v, oldest); + } + } + } + + n = ZeroMalloc(sizeof(NAT_ENTRY)); + n->Id = Inc(v->Counter); + n->v = v; + n->lock = NewLock(); + n->Protocol = NAT_UDP; + n->SrcIp = src_ip; + n->SrcPort = src_port; + n->DestIp = dest_ip; + n->DestPort = dest_port; + + if (dns_proxy_ip != 0) + { + n->ProxyDns = true; + n->DestIpProxy = dns_proxy_ip; + } + + n->CreatedTime = n->LastCommTime = v->Now; + + n->UdpSendQueue = NewQueue(); + n->UdpRecvQueue = NewQueue(); + + n->UdpSocketCreated = false; + + SetSockEvent(v->SockEvent); + +#if 1 + { + IP ip1, ip2; + char s1[MAX_SIZE], s2[MAX_SIZE]; + UINTToIP(&ip1, src_ip); + UINTToIP(&ip2, dest_ip); + IPToStr(s1, 0, &ip1); + IPToStr(s2, 0, &ip2); + Debug("NAT_ENTRY: CreateNatUdp %s %u -> %s %u\n", s1, src_port, s2, dest_port); + + NLog(v, "LH_NAT_UDP_CREATED", n->Id, s1, src_port, s2, dest_port); + } +#endif + + Add(v->NatTable, n); + + return n; +} + +// Ignore for NetBIOS name registration packet +bool IsNetbiosRegistrationPacket(UCHAR *buf, UINT size) +{ + // Validate arguments + if (buf == NULL || size == 0) + { + return false; + } + + if (size >= 4) + { + USHORT us = *((USHORT *)(buf + 2)); + + us = Endian16(us); + + if (((us & 0x7800) >> 11) == 5) + { + return true; + } + } + + return false; +} + +// Generate the encoded NetBIOS name +void EncodeNetBiosName(UCHAR *dst, char *src) +{ + char tmp[17]; + UINT i; + UINT copy_len; + UINT wp; + // Validate arguments + if (dst == NULL || src == NULL) + { + return; + } + + for (i = 0; i < 16; i++) + { + tmp[i] = ' '; + } + tmp[16] = 0; + + copy_len = StrLen(src); + if (copy_len > 16) + { + copy_len = 16; + } + + Copy(tmp, src, copy_len); + + wp = 0; + + tmp[15] = 0; + + for (i = 0; i < 16; i++) + { + char c = tmp[i]; + char *s = CharToNetBiosStr(c); + + dst[wp++] = s[0]; + dst[wp++] = s[1]; + } +} + +// Convert the string to NetBIOS characters +char *CharToNetBiosStr(char c) +{ + c = ToUpper(c); + + switch (c) + { + case '\0': + return "AA"; + case 'A': + return "EB"; + case 'B': + return "EC"; + case 'C': + return "ED"; + case 'D': + return "EE"; + case 'E': + return "EF"; + case 'F': + return "EG"; + case 'G': + return "EH"; + case 'H': + return "EI"; + case 'I': + return "EJ"; + case 'J': + return "EK"; + case 'K': + return "EL"; + case 'L': + return "EM"; + case 'M': + return "EN"; + case 'N': + return "EO"; + case 'O': + return "EP"; + case 'P': + return "FA"; + case 'Q': + return "FB"; + case 'R': + return "FC"; + case 'S': + return "FD"; + case 'T': + return "FE"; + case 'U': + return "FF"; + case 'V': + return "FG"; + case 'W': + return "FH"; + case 'X': + return "FI"; + case 'Y': + return "FJ"; + case 'Z': + return "FK"; + case '0': + return "DA"; + case '1': + return "DB"; + case '2': + return "DC"; + case '3': + return "DD"; + case '4': + return "DE"; + case '5': + return "DF"; + case '6': + return "DG"; + case '7': + return "DH"; + case '8': + return "DI"; + case '9': + return "DJ"; + case ' ': + return "CA"; + case '!': + return "CB"; + case '\"': + return "CC"; + case '#': + return "CD"; + case '$': + return "CE"; + case '%': + return "CF"; + case '&': + return "CG"; + case '\'': + return "CH"; + case '(': + return "CI"; + case ')': + return "CJ"; + case '*': + return "CK"; + case '+': + return "CL"; + case ',': + return "CM"; + case '-': + return "CN"; + case '.': + return "CO"; + case '=': + return "DN"; + case ':': + return "DK"; + case ';': + return "DL"; + case '@': + return "EA"; + case '^': + return "FO"; + case '_': + return "FP"; + case '{': + return "HL"; + case '}': + return "HN"; + case '~': + return "HO"; + } + + return "CA"; +} + +// Process if a NetBIOS name resolution packet for the my host name +bool ProcessNetBiosNameQueryPacketForMyself(VH *v, UINT src_ip, UINT src_port, UINT dest_ip, UINT dest_port, void *data, UINT size) +{ + BUF *rb; + USHORT tran_id; + USHORT flags; + USHORT num_query; + USHORT zero1, zero2, zero3; + UCHAR name_size; + UCHAR encoded_name[32]; + UCHAR node_type; + USHORT type, classid; + UCHAR my_pc_encoded_name[32]; + bool ret = false; + // Validate arguments + if (v == NULL || data == NULL) + { + return false; + } + + rb = NewBufFromMemory(data, size); + + ReadBuf(rb, &tran_id, sizeof(USHORT)); + + ReadBuf(rb, &flags, sizeof(USHORT)); + flags = Endian16(flags); + + ReadBuf(rb, &num_query, sizeof(USHORT)); + num_query = Endian16(num_query); + + ReadBuf(rb, &zero1, sizeof(USHORT)); + ReadBuf(rb, &zero2, sizeof(USHORT)); + ReadBuf(rb, &zero3, sizeof(USHORT)); + + ReadBuf(rb, &name_size, 1); + + ReadBuf(rb, encoded_name, 32); + + ReadBuf(rb, &node_type, 1); + + ReadBuf(rb, &type, sizeof(USHORT)); + type = Endian16(type); + + if (ReadBuf(rb, &classid, sizeof(USHORT)) == sizeof(USHORT)) + { + classid = Endian16(classid); + + if (((flags >> 11) & 0x0F) == 0 && + num_query == 1 && name_size == 0x20 && + zero1 == 0 && zero2 == 0 && zero3 == 0 && node_type == 0 && type == 0x0020 && classid == 0x0001) + { + char my_pcname[MAX_SIZE]; + + // Get the encoded name of this PC + Zero(my_pcname, sizeof(my_pcname)); + GetMachineHostName(my_pcname, sizeof(my_pcname)); + + EncodeNetBiosName(my_pc_encoded_name, my_pcname); + + if (Cmp(my_pc_encoded_name, encoded_name, 30) == 0) + { + // Assemble the response packet since the name resolution packet which targets this PC name received + BUF *sb = NewBuf(); + USHORT us; + UINT ui; + LIST *ip_list; + BUF *ip_list_buf; + bool found = false; + + WriteBuf(sb, &tran_id, sizeof(USHORT)); + + flags = Endian16(0x8500); + WriteBuf(sb, &flags, sizeof(USHORT)); + + num_query = 0; + WriteBuf(sb, &num_query, sizeof(USHORT)); + + us = Endian16(1); + WriteBuf(sb, &us, sizeof(USHORT)); + + us = 0; + WriteBuf(sb, &us, sizeof(USHORT)); + WriteBuf(sb, &us, sizeof(USHORT)); + + name_size = 0x20; + WriteBuf(sb, &name_size, 1); + + WriteBuf(sb, encoded_name, 32); + + node_type = 0; + WriteBuf(sb, &node_type, 1); + + type = Endian16(type); + classid = Endian16(classid); + + WriteBuf(sb, &type, sizeof(USHORT)); + WriteBuf(sb, &classid, sizeof(USHORT)); + + ui = Endian32((UINT)(Tick64() / 1000ULL)); + WriteBuf(sb, &ui, sizeof(UINT)); + + ip_list_buf = NewBuf(); + + ip_list = GetHostIPAddressList(); + if (ip_list != NULL) + { + UINT i; + + // Return only private IP if there is a private IP + for (i = 0; i < LIST_NUM(ip_list); i++) + { + IP *ip = LIST_DATA(ip_list, i); + + if (IsIP4(ip) && IsLocalHostIP4(ip) == false && IsZeroIp(ip) == false) + { + if (IsIPPrivate(ip)) + { + USHORT flags = Endian16(0x4000); + UINT ip_uint = IPToUINT(ip); + + WriteBuf(ip_list_buf, &flags, sizeof(USHORT)); + WriteBuf(ip_list_buf, &ip_uint, sizeof(UINT)); + + found = true; + } + } + } + + if (found == false) + { + // Return all IP if no private IP are found + for (i = 0; i < LIST_NUM(ip_list); i++) + { + IP *ip = LIST_DATA(ip_list, i); + + if (IsIP4(ip) && IsLocalHostIP4(ip) == false && IsZeroIp(ip) == false) + { + USHORT flags = Endian16(0x4000); + UINT ip_uint = IPToUINT(ip); + + WriteBuf(ip_list_buf, &flags, sizeof(USHORT)); + WriteBuf(ip_list_buf, &ip_uint, sizeof(UINT)); + + found = true; + } + } + } + + FreeHostIPAddressList(ip_list); + } + + us = Endian16(ip_list_buf->Size); + WriteBuf(sb, &us, sizeof(USHORT)); + + WriteBufBuf(sb, ip_list_buf); + + SendUdp(v, src_ip, src_port, v->HostIP, dest_port, sb->Buf, sb->Size); + + FreeBuf(ip_list_buf); + + FreeBuf(sb); + + WHERE; + } + } + } + + FreeBuf(rb); + + return ret; +} + +// Process the NetBIOS broadcast packet +void UdpRecvForNetBiosBroadcast(VH *v, UINT src_ip, UINT src_port, UINT dest_ip, UINT dest_port, void *data, UINT size, bool dns_proxy, bool unicast) +{ + // Validate arguments + if (data == NULL || v == NULL) + { + return; + } + + // Ignore for NetBIOS name registration packet + if (IsNetbiosRegistrationPacket(data, size) == false) + { + if (unicast == false) + { + dest_ip = 0xFFFFFFFF; + } + + if (ProcessNetBiosNameQueryPacketForMyself(v, src_ip, src_port, dest_ip, dest_port, data, size) == false) + { + UdpRecvForInternet(v, src_ip, src_port, dest_ip, dest_port, data, size, false); + } + } +} + +// Process the UDP packet to the Internet +void UdpRecvForInternet(VH *v, UINT src_ip, UINT src_port, UINT dest_ip, UINT dest_port, void *data, UINT size, bool dns_proxy) +{ + NAT_ENTRY *n, t; + BLOCK *block; + void *buf; + UINT dns_ip = 0; + // Validate arguments + if (data == NULL || v == NULL) + { + return; + } + + if (dns_proxy) + { + // Get the DNS server of the proxy to connect to + IP ip; + char tmp[MAX_SIZE]; + if (GetDefaultDns(&ip) == false) + { + // Failure + Debug("Failed to GetDefaultDns()\n"); + return; + } + dns_ip = IPToUINT(&ip); + IPToStr(tmp, sizeof(tmp), &ip); + Debug("Redirect to DNS Server %s\n", tmp); + } + + // Examine whether the NAT entry for this packet has already been created + SetNat(&t, NAT_UDP, src_ip, src_port, dest_ip, dest_port, 0, 0); + n = SearchNat(v, &t); + + if (n == NULL) + { + // Create a NAT entry because it is the first packet + n = CreateNatUdp(v, src_ip, src_port, dest_ip, dest_port, dns_proxy ? dns_ip : 0); + if (n == NULL) + { + // Entry creation failed + return; + } + + if (dns_proxy) + { + n->ProxyDns = true; + n->DestIpProxy = dns_ip; + } + } + + // Set the event by inserting the packet into the queue + buf = Malloc(size); + Copy(buf, data, size); + block = NewBlock(buf, size, 0); + InsertQueue(n->UdpSendQueue, block); + + SetSockEvent(v->SockEvent); +} + +// Attempt to interpret the DNS packet +bool ParseDnsPacket(VH *v, UINT src_ip, UINT src_port, UINT dest_ip, UINT dest_port, void *data, UINT size) +{ + return ParseDnsPacketEx(v, src_ip, src_port, dest_ip, dest_port, data, size, NULL); +} +bool ParseDnsPacketEx(VH *v, UINT src_ip, UINT src_port, UINT dest_ip, UINT dest_port, void *data, UINT size, DNS_PARSED_PACKET *parsed_result) +{ + DNSV4_HEADER *dns; + NAT_ENTRY *nat; + UINT transaction_id; + void *query_data; + UINT query_data_size; + char hostname[256]; + // Validate arguments + if (v == NULL || data == NULL || size == 0) + { + return false; + } + + // Check the header size + if (size < sizeof(DNSV4_HEADER)) + { + // Undersize + return false; + } + + // DNS header acquisition + dns = (DNSV4_HEADER *)data; + transaction_id = Endian16(dns->TransactionId); + if ((dns->Flag1 & 78) != 0 || (dns->Flag1 & 0x80) != 0) + { + // Illegal opcode + return false; + } + if (Endian16(dns->NumQuery) != 1) + { + // Number of queries is invalid + return false; + } + + query_data = ((UCHAR *)dns) + sizeof(DNSV4_HEADER); + query_data_size = size - sizeof(DNSV4_HEADER); + + // Interpret the query + if (ParseDnsQuery(hostname, sizeof(hostname), query_data, query_data_size) == false) + { + // Interpretation fails + return false; + } + + if (parsed_result != NULL) + { + // Only analyse without processing + Zero(parsed_result, sizeof(DNS_PARSED_PACKET)); + StrCpy(parsed_result->Hostname, sizeof(parsed_result->Hostname), hostname); + parsed_result->TransactionId = transaction_id; + + return true; + } + + // Create a DNS entry + nat = CreateNatDns(v, src_ip, src_port, dest_ip, dest_port, transaction_id, + false, hostname); + + if (nat == false) + { + return false; + } + + return true; +} + +// Send the NAT DNS response packet +void SendNatDnsResponse(VH *v, NAT_ENTRY *n) +{ + BUF *b; + UINT dns_header_size; + DNSV4_HEADER *dns; + UINT src_ip; + // Validate arguments + if (n == NULL || v == NULL) + { + return; + } + + // Generate the data + b = NewBuf(); + + // Add a Query + if (n->DnsGetIpFromHost == false) + { + BuildDnsQueryPacket(b, n->DnsTargetHostName, false); + } + else + { + BuildDnsQueryPacket(b, n->DnsTargetHostName, true); + } + + // Add a Response + if (n->DnsOk) + { + if (n->DnsGetIpFromHost == false) + { + BuildDnsResponsePacketA(b, &n->DnsResponseIp); + } + else + { + BuildDnsResponsePacketPtr(b, n->DnsResponseHostName); + } + } + + // Generate a DNS header + dns_header_size = sizeof(DNSV4_HEADER) + b->Size; + + dns = ZeroMalloc(dns_header_size); + dns->TransactionId = Endian16((USHORT)n->DnsTransactionId); + + // Generate a response flag + if (n->DnsOk) + { + dns->Flag1 = 0x85; + dns->Flag2 = 0x80; + } + else + { + dns->Flag1 = 0x85; + dns->Flag2 = 0x83; + } + + dns->NumQuery = Endian16(1); + dns->AnswerRRs = Endian16(n->DnsOk != false ? 1 : 0); + dns->AuthorityRRs = 0; + dns->AdditionalRRs = 0; + + // Settings, such as the source IP address + src_ip = n->DestIp; + if (src_ip == Endian32(SPECIAL_IPV4_ADDR_LLMNR_DEST) && n->DestPort == SPECIAL_UDP_PORT_LLMNR) + { + // Make a unicast response in the case of LLMNR packet + src_ip = v->HostIP; + + dns->Flag1 = 0x84; + dns->Flag2 = 0x00; + } + + // Copy data + Copy(((UCHAR *)dns) + sizeof(DNSV4_HEADER), b->Buf, b->Size); + + // Send this packet + SendUdp(v, n->SrcIp, n->SrcPort, src_ip, n->DestPort, dns, dns_header_size); + + // Release the memory + Free(dns); + FreeBuf(b); +} + +// Generate a DNS response packet (host name) +void BuildDnsResponsePacketPtr(BUF *b, char *hostname) +{ + USHORT magic; + USHORT type, clas; + UINT ttl; + USHORT len; + BUF *c; + // Validate arguments + if (b == NULL || hostname == NULL) + { + return; + } + + magic = Endian16(0xc00c); + type = Endian16(0x000c); + clas = Endian16(0x0001); + ttl = Endian32(NAT_DNS_RESPONSE_TTL); + + c = BuildDnsHostName(hostname); + if (c == NULL) + { + return; + } + len = Endian16((USHORT)c->Size); + + WriteBuf(b, &magic, 2); + WriteBuf(b, &type, 2); + WriteBuf(b, &clas, 2); + WriteBuf(b, &ttl, 4); + WriteBuf(b, &len, 2); + WriteBuf(b, c->Buf, c->Size); + FreeBuf(c); +} + +// Generate a DNS response packet (host IP address) +void BuildDnsResponsePacketA(BUF *b, IP *ip) +{ + UINT ip_addr; + USHORT magic; + USHORT type, clas; + UINT ttl; + USHORT len; + // Validate arguments + if (b == NULL || ip == NULL) + { + return; + } + + ip_addr = IPToUINT(ip); + magic = Endian16(0xc00c); + type = Endian16(0x0001); + clas = Endian16(0x0001); + ttl = Endian32(NAT_DNS_RESPONSE_TTL); + len = Endian16((USHORT)sizeof(ttl)); + + WriteBuf(b, &magic, sizeof(magic)); + WriteBuf(b, &type, sizeof(type)); + WriteBuf(b, &clas, sizeof(clas)); + WriteBuf(b, &ttl, sizeof(ttl)); + WriteBuf(b, &len, sizeof(len)); + WriteBuf(b, &ip_addr, sizeof(ip_addr)); +} + +// Generate a DNS query data packet +void BuildDnsQueryPacket(BUF *b, char *hostname, bool ptr) +{ + USHORT val; + BUF *c; + // Validate arguments + if (b == NULL || hostname == NULL) + { + return; + } + + // Convert the host name to a buffer + c = BuildDnsHostName(hostname); + if (c == NULL) + { + return; + } + + WriteBuf(b, c->Buf, c->Size); + FreeBuf(c); + + // Type and class + if (ptr == false) + { + val = Endian16(0x0001); + } + else + { + val = Endian16(0x000c); + } + WriteBuf(b, &val, 2); + + val = Endian16(0x0001); + WriteBuf(b, &val, 2); +} + +// Generate a DNS host name buffer +BUF *BuildDnsHostName(char *hostname) +{ + UINT i; + UCHAR size; + TOKEN_LIST *token; + BUF *b; + // Validate arguments + if (hostname == NULL) + { + return NULL; + } + + // Split the host name into tokens + token = ParseToken(hostname, "."); + if (token == NULL) + { + return NULL; + } + + b = NewBuf(); + + // Add a host string + for (i = 0; i < token->NumTokens; i++) + { + size = (UCHAR)StrLen(token->Token[i]); + WriteBuf(b, &size, 1); + WriteBuf(b, token->Token[i], size); + } + + // NULL character + size = 0; + WriteBuf(b, &size, 1); + + SeekBuf(b, 0, 0); + + FreeToken(token); + + return b; +} + +// Process the NAT DNS entry +void PollingNatDns(VH *v, NAT_ENTRY *n) +{ + // Validate arguments + if (v == NULL || n == NULL) + { + return; + } + + if (n->DnsFinished) + { + if (n->DnsPollingFlag == false) + { + n->DnsPollingFlag = true; + // Process has been completed + SendNatDnsResponse(v, n); + + // Terminating + n->DisconnectNow = true; + } + } +} + +// Create a NAT DNS entry +NAT_ENTRY *CreateNatDns(VH *v, UINT src_ip, UINT src_port, UINT dest_ip, UINT dest_port, + UINT transaction_id, bool dns_get_ip_from_host, char *dns_target_host_name) +{ + NAT_ENTRY *n; + HUB_OPTION *o; + // Validate arguments + if (v == NULL || dns_target_host_name == NULL) + { + return NULL; + } + + if (CanCreateNewNatEntry(v) == false) + { + return NULL; + } + + o = NatGetHubOption(v); + if (o != NULL && o->SecureNAT_MaxDnsSessionsPerIp != 0) + { + if (GetNumNatEntriesPerIp(v, src_ip, NAT_DNS, false) >= o->SecureNAT_MaxDnsSessionsPerIp) + { + NAT_ENTRY *oldest = GetOldestNatEntryOfIp(v, src_ip, NAT_DNS); + + if (oldest != NULL) + { + DisconnectNatEntryNow(v, oldest); + } + } + } + + n = ZeroMalloc(sizeof(NAT_ENTRY)); + n->Id = Inc(v->Counter); + n->v = v; + n->lock = NewLock(); + n->Protocol = NAT_DNS; + n->SrcIp = src_ip; + n->SrcPort = src_port; + n->DestIp = dest_ip; + n->DestPort = dest_port; + n->DnsTransactionId = transaction_id; + n->CreatedTime = n->LastCommTime = v->Now; + n->DisconnectNow = false; + + n->DnsGetIpFromHost = false; + n->DnsTargetHostName = CopyStr(dns_target_host_name); + + Add(v->NatTable, n); + +#if 1 + { + IP ip1, ip2; + char s1[MAX_SIZE], s2[MAX_SIZE]; + UINTToIP(&ip1, src_ip); + UINTToIP(&ip2, dest_ip); + IPToStr(s1, 0, &ip1); + IPToStr(s2, 0, &ip2); + Debug("NAT_ENTRY: CreateNatDns %s %u -> %s %u\n", s1, src_port, s2, dest_port); + } +#endif + + + return n; +} + +// Set the VGS host name +void SetDnsProxyVgsHostname(char *hostname) +{ + // Validate arguments + if (hostname == NULL) + { + return; + } + + StrCpy(v_vgs_hostname, sizeof(v_vgs_hostname), hostname); +} + +// Operate as a DNS proxy +void DnsProxy(VH *v, UINT src_ip, UINT src_port, UINT dest_ip, UINT dest_port, void *data, UINT size) +{ + // Validate arguments + if (v == NULL || data == NULL || size == 0) + { + return; + } + + if (dest_port == SPECIAL_UDP_PORT_LLMNR) + { + // Process by analyzing the DNS query in the case of LLMNR + ParseDnsPacket(v, src_ip, src_port, dest_ip, dest_port, data, size); + } + else + { + // Forward the packet as it is in the case of a normal DNS packet + if (IsEmptyStr(v_vgs_hostname) == false) + { + // Response by proxy in the case of trying to get the IP of the VGS + DNS_PARSED_PACKET p; + + Zero(&p, sizeof(p)); + if (ParseDnsPacketEx(v, src_ip, src_port, dest_ip, dest_port, data, size, &p)) + { + if (StrCmpi(p.Hostname, "254.254.211.10.in-addr.arpa") == 0) + { + NAT_ENTRY n; + + Zero(&n, sizeof(n)); + n.DnsTargetHostName = p.Hostname; + n.DnsGetIpFromHost = true; + n.DnsResponseHostName = v_vgs_hostname; + n.DnsTransactionId = p.TransactionId; + n.DnsOk = true; + n.DestIp = dest_ip; + n.SrcIp = src_ip; + n.DestPort = dest_port; + n.SrcPort = src_port; + + SendNatDnsResponse(v, &n); + return; + } + } + } + + UdpRecvForInternet(v, src_ip, src_port, dest_ip, dest_port, data, size, true); + } +} + +// Process the LLMNR query +void UdpRecvLlmnr(VH *v, UINT src_ip, UINT src_port, UINT dest_ip, UINT dest_port, void *data, UINT size) +{ + // Validate arguments + if (data == NULL || v == NULL) + { + return; + } + + if (dest_port == SPECIAL_UDP_PORT_LLMNR) + { + // DNS proxy start + DnsProxy(v, src_ip, src_port, dest_ip, dest_port, data, size); + } +} + +// Process the UDP packet to the virtual host +void UdpRecvForMe(VH *v, UINT src_ip, UINT src_port, UINT dest_ip, UINT dest_port, void *data, UINT size) +{ + // Validate arguments + if (data == NULL || v == NULL) + { + return; + } + + if (dest_port == NAT_DNS_PROXY_PORT) + { + // DNS proxy start + DnsProxy(v, src_ip, src_port, dest_ip, dest_port, data, size); + } +} + +// Process the UDP broadcast packet +void UdpRecvForBroadcast(VH *v, UINT src_ip, UINT src_port, UINT dest_ip, UINT dest_port, void *data, UINT size) +{ + // Validate arguments + if (data == NULL || v == NULL) + { + return; + } +} + +// An UDP packet has been received +void VirtualUdpReceived(VH *v, UINT src_ip, UINT dest_ip, void *data, UINT size, bool mac_broadcast, bool is_localmac, UINT max_l3_size) +{ + UDP_HEADER *udp; + UINT packet_length; + void *buf; + UINT buf_size; + UINT src_port, dest_port; + // Validate arguments + if (v == NULL || data == NULL) + { + return; + } + + // Check the header + udp = (UDP_HEADER *)data; + if (size < UDP_HEADER_SIZE) + { + return; + } + packet_length = Endian16(udp->PacketLength); + if (packet_length != size) + { + return; + } + buf = ((UCHAR *)data) + UDP_HEADER_SIZE; + buf_size = size - UDP_HEADER_SIZE; + src_port = Endian16(udp->SrcPort); + dest_port = Endian16(udp->DstPort); + // Check the port number + if (dest_port == 0) + { + // Port number is invalid + return; + } + + // Determine whether it's broadcast packet or packet addressed to myself + if (dest_ip == v->HostIP) + { + // IP packet addressed to myself has arrived + UdpRecvForMe(v, src_ip, src_port, dest_ip, dest_port, buf, buf_size); + } + else if ((mac_broadcast || dest_ip == Endian32(0xE00000FC)) && dest_port == SPECIAL_UDP_PORT_LLMNR) + { + if (is_localmac == false) + { + // Packet addressed to 224.0.0.252 (LLMNR) arrives + UdpRecvLlmnr(v, src_ip, src_port, dest_ip, dest_port, buf, buf_size); + } + } + else if (mac_broadcast && (dest_port == SPECIAL_UDP_PORT_WSD || dest_port == SPECIAL_UDP_PORT_SSDP)) + { + if (is_localmac == false) + { + // WS-Discovery packet arrives + UdpRecvForInternet(v, src_ip, src_port, 0xFFFFFFFF, dest_port, buf, buf_size, false); + } + } + else if (mac_broadcast && (dest_port == SPECIAL_UDP_PORT_NBTDGM || dest_port == SPECIAL_UDP_PORT_NBTNS)) + { + if (is_localmac == false) + { + // NetBIOS Broadcast packet arrived + UdpRecvForNetBiosBroadcast(v, src_ip, src_port, dest_ip, dest_port, buf, buf_size, false, false); + } + } + else if (mac_broadcast || dest_ip == 0xffffffff || dest_ip == GetBroadcastAddress(v->HostIP, v->HostMask)) + { + if (is_localmac == false) + { + // Broadcast packet arrived + UdpRecvForBroadcast(v, src_ip, src_port, dest_ip, dest_port, buf, buf_size); + } + } + else if (IsInNetwork(dest_ip, v->HostIP, v->HostMask) == false) + { + // Packets to other than local address (that is on the Internet) has been received + if (NnIsActive(v) == false) + { + if (v->HubOption != NULL && v->HubOption->DisableUserModeSecureNAT) + { + // User-mode NAT is disabled + return; + } + + // User-mode NAT + UdpRecvForInternet(v, src_ip, src_port, dest_ip, dest_port, buf, buf_size, false); + } + else + { + // Kernel-mode NAT + NnUdpRecvForInternet(v, src_ip, src_port, dest_ip, dest_port, buf, buf_size, max_l3_size); + } + } + else + { + // Local address has arrived. Ignore it + } +} + +// Determine the network address of the subnet to which the specified IP address belongs +UINT GetNetworkAddress(UINT addr, UINT mask) +{ + return (addr & mask); +} + +// Determine the broadcast address of the subnet to which the specified IP address belongs +UINT GetBroadcastAddress(UINT addr, UINT mask) +{ + return ((addr & mask) | (~mask)); +} +void GetBroadcastAddress4(IP *dst, IP *addr, IP *mask) +{ + // Validate arguments + if (dst == NULL || IsIP4(addr) == false || IsIP4(mask) == false) + { + Zero(dst, sizeof(IP)); + return; + } + + UINTToIP(dst, GetBroadcastAddress(IPToUINT(addr), IPToUINT(mask))); +} + +// Determine whether the specified IP address belongs to the sub-network that is +// represented by a another specified network address and a subnet mask +bool IsInNetwork(UINT uni_addr, UINT network_addr, UINT mask) +{ + if (GetNetworkAddress(uni_addr, mask) == GetNetworkAddress(network_addr, mask)) + { + return true; + } + return false; +} + +// Send an UDP packet +void SendUdp(VH *v, UINT dest_ip, UINT dest_port, UINT src_ip, UINT src_port, void *data, UINT size) +{ + UDPV4_PSEUDO_HEADER *vh; + UDP_HEADER *udp; + UINT udp_packet_length = UDP_HEADER_SIZE + size; + USHORT checksum; + // Validate arguments + if (v == NULL || data == NULL) + { + return; + } + if (udp_packet_length > 65536) + { + return; + } + + // Generate a virtual header + vh = Malloc(sizeof(UDPV4_PSEUDO_HEADER) + size); + udp = (UDP_HEADER *)(((UCHAR *)vh) + 12); + + vh->SrcIP = src_ip; + vh->DstIP = dest_ip; + vh->Reserved = 0; + vh->Protocol = IP_PROTO_UDP; + vh->PacketLength1 = Endian16((USHORT)udp_packet_length); + udp->SrcPort = Endian16((USHORT)src_port); + udp->DstPort = Endian16((USHORT)dest_port); + udp->PacketLength = Endian16((USHORT)udp_packet_length); + udp->Checksum = 0; + + // Copy data + Copy(((UCHAR *)udp) + UDP_HEADER_SIZE, data, size); + + // Calculate the checksum + checksum = IpChecksum(vh, udp_packet_length + 12); + if (checksum == 0x0000) + { + checksum = 0xffff; + } + udp->Checksum = checksum; + + // Send a packet + SendIp(v, dest_ip, src_ip, IP_PROTO_UDP, udp, udp_packet_length); + + // Release the memory + Free(vh); +} + +// Poll the IP combining object +void PollingIpCombine(VH *v) +{ + LIST *o; + UINT i; + // Validate arguments + if (v == NULL) + { + return; + } + + // Discard the old combining object + o = NULL; + for (i = 0; i < LIST_NUM(v->IpCombine); i++) + { + IP_COMBINE *c = LIST_DATA(v->IpCombine, i); + + if (c->Expire < v->Now) + { + if (o == NULL) + { + o = NewListFast(NULL); + } + Add(o, c); + } + } + + if (o != NULL) + { + for (i = 0; i < LIST_NUM(o); i++) + { + IP_COMBINE *c = LIST_DATA(o, i); + + // Remove from the list + Delete(v->IpCombine, c); + + // Release the memory + FreeIpCombine(v, c); + } + ReleaseList(o); + } +} + +// Send an ICMP packet +void VirtualIcmpSend(VH *v, UINT src_ip, UINT dst_ip, void *data, UINT size) +{ + ICMP_HEADER *icmp; + void *data_buf; + // Validate arguments + if (v == NULL || data == NULL) + { + return; + } + + // Build the header + icmp = ZeroMalloc(sizeof(ICMP_HEADER) + size); + // Data copy + data_buf = ((UCHAR *)icmp) + sizeof(ICMP_HEADER); + Copy(data_buf, data, size); + // Other + icmp->Checksum = 0; + icmp->Code = 0; + icmp->Type = ICMP_TYPE_ECHO_RESPONSE; + // Checksum + icmp->Checksum = IpChecksum(icmp, sizeof(ICMP_HEADER) + size); + + // IP packet transmission + SendIp(v, dst_ip, src_ip, IP_PROTO_ICMPV4, icmp, sizeof(ICMP_HEADER) + size); + + // Release the memory + Free(icmp); +} + +// Send the ICMP Echo Response packet +void VirtualIcmpEchoSendResponse(VH *v, UINT src_ip, UINT dst_ip, USHORT id, USHORT seq_no, void *data, UINT size) +{ + ICMP_ECHO *e; + // Validate arguments + if (v == NULL || data == NULL) + { + return; + } + + // Build the header + e = ZeroMalloc(sizeof(ICMP_ECHO) + size); + e->Identifier = Endian16(id); + e->SeqNo = Endian16(seq_no); + + // Data copy + Copy(((UCHAR *)e) + sizeof(ICMP_ECHO), data, size); + + // Send an ICMP + VirtualIcmpSend(v, src_ip, dst_ip, e, sizeof(ICMP_ECHO) + size); + + // Release the memory + Free(e); +} + +// Treat the ICMP Echo Request packet with a Raw Socket +void VirtualIcmpEchoRequestReceivedRaw(VH *v, UINT src_ip, UINT dst_ip, void *data, UINT size, UCHAR ttl, void *icmp_data, UINT icmp_size, UCHAR *ip_header, UINT ip_header_size) +{ + ICMP_ECHO *echo; + UINT data_size; + void *data_buf; + USHORT id, seq_no; + void *buf; + BLOCK *block; + // Validate arguments + if (v == NULL || data == NULL || icmp_data == NULL || ip_header == NULL) + { + return; + } + if (ttl == 0) + { + ttl = 1; + } + + echo = (ICMP_ECHO *)data; + + // Echo size check + if (size < sizeof(ICMP_ECHO)) + { + // Insufficient data + return; + } + + id = Endian16(echo->Identifier); + seq_no = Endian16(echo->SeqNo); + + // Data size + data_size = size - sizeof(ICMP_ECHO); + + // Data body + data_buf = ((UCHAR *)data) + sizeof(ICMP_ECHO); + + if (dst_ip == v->HostIP) + { + // Respond because it is addressed to me + VirtualIcmpEchoSendResponse(v, v->HostIP, src_ip, id, seq_no, data_buf, data_size); + } + else if (IsInNetwork(dst_ip, v->HostIP, v->HostMask) == false) + { + NAT_ENTRY *n = NULL, t; + // Process by creating a NAT entry because it is addressed to the Internet + + if (ttl <= 1) + { + // Reply the Time Exceeded immediately for the packet whose TTL is 1 + UINT reply_size = sizeof(ICMP_HEADER) + 4 + ip_header_size + 8; + UCHAR *reply_data = ZeroMalloc(reply_size); + ICMP_HEADER *icmp = (ICMP_HEADER *)reply_data; + icmp->Type = ICMP_TYPE_TIME_EXCEEDED; + icmp->Code = ICMP_CODE_TTL_EXCEEDED_IN_TRANSIT; + Copy(reply_data + sizeof(ICMP_HEADER) + 4, ip_header, ip_header_size); + Copy(reply_data + sizeof(ICMP_HEADER) + 4 + ip_header_size, icmp_data, MIN(icmp_size, 8)); + + icmp->Checksum = IpChecksum(icmp, reply_size); + + SendIp(v, src_ip, v->HostIP, IP_PROTO_ICMPV4, reply_data, reply_size); + + Free(reply_data); + } + else + { + SetNat(&t, NAT_ICMP, src_ip, id, dst_ip, id, 0, 0); + + if (v->IcmpRawSocketOk) + { + // Examine whether a NAT entry for this packet has already been created + n = SearchNat(v, &t); + } + + if (n == NULL) + { + // Create a NAT entry because it is the first packet + n = CreateNatIcmp(v, src_ip, id, dst_ip, id, (UCHAR *)ip_header, ip_header_size + 8); + + if (n == NULL) + { + // Entry creation failed + return; + } + } + + // Set the event by inserting the packet into the queue + buf = Malloc(icmp_size); + Copy(buf, icmp_data, icmp_size); + block = NewBlock(buf, icmp_size, 0); + block->Ttl = MAKESURE(ttl - 1, 1, 255); + InsertQueue(n->UdpSendQueue, block); + + SetSockEvent(v->SockEvent); + } + } +} + +// Receive an ICMP Echo Request packet +void VirtualIcmpEchoRequestReceived(VH *v, UINT src_ip, UINT dst_ip, void *data, UINT size, UCHAR ttl, void *icmp_data, UINT icmp_size, UCHAR *ip_header, UINT ip_header_size, UINT max_l3_size) +{ + ICMP_ECHO *echo; + UINT data_size; + void *data_buf; + USHORT id, seq_no; + // Validate arguments + if (v == NULL || data == NULL || icmp_data == NULL) + { + return; + } + + //Debug("ICMP: %u\n", size); + + if (NnIsActive(v)) + { + // Process by the Native NAT + NnIcmpEchoRecvForInternet(v, src_ip, dst_ip, data, size, ttl, icmp_data, icmp_size, + ip_header, ip_header_size, max_l3_size); + return; + } + + if (v->HubOption != NULL && v->HubOption->DisableUserModeSecureNAT) + { + // User-mode NAT is disabled + return; + } + + if (v->IcmpRawSocketOk || v->IcmpApiOk) + { + // Process in the Raw Socket + VirtualIcmpEchoRequestReceivedRaw(v, src_ip, dst_ip, data, size, ttl, icmp_data, icmp_size, + ip_header, ip_header_size); + return; + } + + // Returns the fake ICMP forcibly if any of Native NAT or Raw Socket can not be used + + echo = (ICMP_ECHO *)data; + + // Echo size check + if (size < sizeof(ICMP_ECHO)) + { + // Insufficient data + return; + } + + id = Endian16(echo->Identifier); + seq_no = Endian16(echo->SeqNo); + + // Data size + data_size = size - sizeof(ICMP_ECHO); + + // Data body + data_buf = ((UCHAR *)data) + sizeof(ICMP_ECHO); + + // Return the ICMP Echo Response + VirtualIcmpEchoSendResponse(v, dst_ip, src_ip, id, seq_no, data_buf, data_size); +} + +// An ICMP packet has been received +void VirtualIcmpReceived(VH *v, UINT src_ip, UINT dst_ip, void *data, UINT size, UCHAR ttl, UCHAR *ip_header, UINT ip_header_size, UINT max_l3_size) +{ + ICMP_HEADER *icmp; + UINT msg_size; + USHORT checksum_calc, checksum_original; + // Validate arguments + if (v == NULL || data == NULL) + { + return; + } + + // Size check + if (size < sizeof(ICMP_HEADER)) + { + return; + } + + // ICMP header + icmp = (ICMP_HEADER *)data; + + // Get the ICMP message size + msg_size = size - sizeof(ICMP_HEADER); + + // Check the checksum of the ICMP header + checksum_original = icmp->Checksum; + icmp->Checksum = 0; + checksum_calc = IpChecksum(data, size); + icmp->Checksum = checksum_original; + + if (checksum_calc != checksum_original) + { + // Checksum is invalid + Debug("ICMP CheckSum Failed.\n"); + return; + } + + // Identified by the opcode + switch (icmp->Type) + { + case ICMP_TYPE_ECHO_REQUEST: // ICMP Echo request + VirtualIcmpEchoRequestReceived(v, src_ip, dst_ip, ((UCHAR *)data) + sizeof(ICMP_HEADER), msg_size, ttl, + icmp, size, ip_header, ip_header_size, max_l3_size); + break; + + case ICMP_TYPE_ECHO_RESPONSE: // ICMP Echo response + // Do Nothing + break; + } +} + +// Received an IP packet +void IpReceived(VH *v, UINT src_ip, UINT dest_ip, UINT protocol, void *data, UINT size, bool mac_broadcast, UCHAR ttl, UCHAR *ip_header, UINT ip_header_size, bool is_local_mac, UINT max_l3_size) +{ + // Validate arguments + if (v == NULL || data == NULL) + { + return; + } + + // Deliver the data to the supported high-level protocol + switch (protocol) + { + case IP_PROTO_ICMPV4: // ICMPv4 + if (mac_broadcast == false) + { + VirtualIcmpReceived(v, src_ip, dest_ip, data, size, ttl, ip_header, ip_header_size, max_l3_size); + } + break; + + case IP_PROTO_TCP: // TCP + if (mac_broadcast == false) + { + VirtualTcpReceived(v, src_ip, dest_ip, data, size, max_l3_size); + } + break; + + case IP_PROTO_UDP: // UDP + VirtualUdpReceived(v, src_ip, dest_ip, data, size, mac_broadcast, is_local_mac, max_l3_size); + break; + } +} + +// Combine the IP packet received to the IP combining object +void CombineIp(VH *v, IP_COMBINE *c, UINT offset, void *data, UINT size, bool last_packet, UCHAR *head_ip_header_data, UINT head_ip_header_size) +{ + UINT i; + IP_PART *p; + UINT need_size; + UINT data_size_delta; + // Validate arguments + if (c == NULL || data == NULL) + { + return; + } + + // Check the size and offset + if ((offset + size) > 65535) + { + // Do not process packet larger than 64Kbytes + return; + } + + if (last_packet == false && c->Size != 0) + { + if ((offset + size) > c->Size) + { + // Do not process the packet larger than the packet size + return; + } + } + + if (head_ip_header_data != NULL && head_ip_header_size >= sizeof(IPV4_HEADER)) + { + if (c->HeadIpHeaderData == NULL) + { + c->HeadIpHeaderData = Clone(head_ip_header_data, head_ip_header_size); + c->HeadIpHeaderDataSize = head_ip_header_size; + } + } + + need_size = offset + size; + data_size_delta = c->DataReserved; + // Ensure sufficient if the buffer is insufficient + while (c->DataReserved < need_size) + { + c->DataReserved = c->DataReserved * 4; + c->Data = ReAlloc(c->Data, c->DataReserved); + } + data_size_delta = c->DataReserved - data_size_delta; + v->CurrentIpQuota += data_size_delta; + + // Overwrite the data into the buffer + Copy(((UCHAR *)c->Data) + offset, data, size); + + if (last_packet) + { + // If No More Fragment packet arrives, the size of this datagram is finalized + c->Size = offset + size; + } + + // Check the overlap between the region which is represented by the offset and size of the + // existing received list and the region which is represented by the offset and size + for (i = 0; i < LIST_NUM(c->IpParts); i++) + { + UINT moving_size; + IP_PART *p = LIST_DATA(c->IpParts, i); + + // Check the overlapping between the existing area and head area + if ((p->Offset <= offset) && ((p->Offset + p->Size) > offset)) + { + // Compress behind the offset of this packet since a duplication is + // found in the first part with the existing packet and this packet + + if ((offset + size) <= (p->Offset + p->Size)) + { + // This packet is buried in the existing packet + size = 0; + } + else + { + // Retral region is not overlapped + moving_size = p->Offset + p->Size - offset; + offset += moving_size; + size -= moving_size; + } + } + if ((p->Offset < (offset + size)) && ((p->Offset + p->Size) >= (offset + size))) + { + // Compress the size of this packet forward because a duplication is + // found between the posterior portion the existing packet and this packet + + moving_size = p->Offset + p->Size - offset - size; + size -= moving_size; + } + + if ((p->Offset >= offset) && ((p->Offset + p->Size) <= (offset + size))) + { + // This packet was overwritten to completely cover an existing packet + p->Size = 0; + } + } + + if (size != 0) + { + // Register this packet + p = ZeroMalloc(sizeof(IP_PART)); + + p->Offset = offset; + p->Size = size; + + Add(c->IpParts, p); + } + + if (c->Size != 0) + { + // Get the total size of the data portion list already received + UINT total_size = 0; + UINT i; + + for (i = 0; i < LIST_NUM(c->IpParts); i++) + { + IP_PART *p = LIST_DATA(c->IpParts, i); + + total_size += p->Size; + } + + if (total_size == c->Size) + { + // Received all of the IP packet + IpReceived(v, c->SrcIP, c->DestIP, c->Protocol, c->Data, c->Size, c->MacBroadcast, c->Ttl, + c->HeadIpHeaderData, c->HeadIpHeaderDataSize, c->SrcIsLocalMacAddr, c->MaxL3Size); + + // Release the combining object + FreeIpCombine(v, c); + + // Remove from the combining object list + Delete(v->IpCombine, c); + } + } +} + +// Release the IP combining object +void FreeIpCombine(VH *v, IP_COMBINE *c) +{ + UINT i; + // Validate arguments + if (c == NULL) + { + return; + } + + // Release the data + v->CurrentIpQuota -= c->DataReserved; + Free(c->Data); + + // Release the partial list + for (i = 0; i < LIST_NUM(c->IpParts); i++) + { + IP_PART *p = LIST_DATA(c->IpParts, i); + + Free(p); + } + + Free(c->HeadIpHeaderData); + + ReleaseList(c->IpParts); + Free(c); +} + +// Search the IP combining list +IP_COMBINE *SearchIpCombine(VH *v, UINT src_ip, UINT dest_ip, USHORT id, UCHAR protocol) +{ + IP_COMBINE *c, t; + // Validate arguments + if (v == NULL) + { + return NULL; + } + + t.DestIP = dest_ip; + t.SrcIP = src_ip; + t.Id = id; + t.Protocol = protocol; + + c = Search(v->IpCombine, &t); + + return c; +} + +// Insert by creating a new object to the IP combining list +IP_COMBINE *InsertIpCombine(VH *v, UINT src_ip, UINT dest_ip, USHORT id, UCHAR protocol, bool mac_broadcast, UCHAR ttl, bool src_is_localmac) +{ + IP_COMBINE *c; + // Validate arguments + if (v == NULL) + { + return NULL; + } + + // Examine the quota + if ((v->CurrentIpQuota + IP_COMBINE_INITIAL_BUF_SIZE) > IP_COMBINE_WAIT_QUEUE_SIZE_QUOTA) + { + // IP packet can not be stored any more + return NULL; + } + + c = ZeroMalloc(sizeof(IP_COMBINE)); + c->SrcIsLocalMacAddr = src_is_localmac; + c->DestIP = dest_ip; + c->SrcIP = src_ip; + c->Id = id; + c->Expire = v->Now + (UINT64)IP_COMBINE_TIMEOUT; + c->Size = 0; + c->IpParts = NewList(NULL); + c->Protocol = protocol; + c->MacBroadcast = mac_broadcast; + c->Ttl = ttl; + + // Secure the memory + c->DataReserved = IP_COMBINE_INITIAL_BUF_SIZE; + c->Data = Malloc(c->DataReserved); + v->CurrentIpQuota += c->DataReserved; + + Insert(v->IpCombine, c); + + return c; +} + +// Initialize the IP combining list +void InitIpCombineList(VH *v) +{ + // Validate arguments + if (v == NULL) + { + return; + } + + v->IpCombine = NewList(CompareIpCombine); +} + +// Release the IP combining list +void FreeIpCombineList(VH *v) +{ + UINT i; + // Validate arguments + if (v == NULL) + { + return; + } + + for (i = 0; i < LIST_NUM(v->IpCombine); i++) + { + IP_COMBINE *c = LIST_DATA(v->IpCombine, i); + + FreeIpCombine(v, c); + } + + ReleaseList(v->IpCombine); +} + +// Comparison of IP combining list entry +int CompareIpCombine(void *p1, void *p2) +{ + IP_COMBINE *c1, *c2; + if (p1 == NULL || p2 == NULL) + { + return 0; + } + c1 = *(IP_COMBINE **)p1; + c2 = *(IP_COMBINE **)p2; + if (c1 == NULL || c2 == NULL) + { + return 0; + } + if (c1->Id > c2->Id) + { + return 1; + } + else if (c1->Id < c2->Id) + { + return -1; + } + else if (c1->DestIP > c2->DestIP) + { + return 1; + } + else if (c1->DestIP < c2->DestIP) + { + return -1; + } + else if (c1->SrcIP > c2->SrcIP) + { + return 1; + } + else if (c1->SrcIP < c2->SrcIP) + { + return -1; + } + else if (c1->Protocol > c2->Protocol) + { + return 1; + } + else if (c1->Protocol < c2->Protocol) + { + return -1; + } + return 0; +} + +// Received an IP packet +void VirtualIpReceived(VH *v, PKT *packet) +{ + IPV4_HEADER *ip; + void *data; + UINT data_size_recved; + UINT size; + UINT ipv4_header_size; + bool last_packet; + UCHAR *head_ip_header_data = NULL; + UINT head_ip_header_size = 0; + bool is_local_mac = false; + UINT ip_l3_size; + // Validate arguments + if (v == NULL || packet == NULL) + { + return; + } + + ip = packet->L3.IPv4Header; + + if (packet->BroadcastPacket) + { + is_local_mac = IsMacAddressLocalFast(packet->MacAddressSrc); + } + + // Get the size of the IPv4 header + ipv4_header_size = IPV4_GET_HEADER_LEN(packet->L3.IPv4Header) * 4; + head_ip_header_size = ipv4_header_size; + + // Calculate the checksum of the IPv4 header + if (IpCheckChecksum(ip) == false) + { + return; + } + + // Get a pointer to the data + data = ((UCHAR *)packet->L3.PointerL3) + ipv4_header_size; + + // Register to the ARP table + ArpIpWasKnown(v, packet->L3.IPv4Header->SrcIP, packet->MacAddressSrc); + + // Get the data size + size = ip_l3_size = Endian16(ip->TotalLength); + if (size <= ipv4_header_size) + { + // There is no data + return; + } + size -= ipv4_header_size; + + // Get the size of data actually received + data_size_recved = packet->PacketSize - (ipv4_header_size + MAC_HEADER_SIZE); + if (data_size_recved < size) + { + // Data insufficient (It may be missing on the way) + return; + } + + if (IPV4_GET_OFFSET(ip) == 0 && (IPV4_GET_FLAGS(ip) & 0x01) == 0) + { + // Because this packet has not been fragmented, it can be delivered to the upper layer immediately + head_ip_header_data = (UCHAR *)packet->L3.IPv4Header; + IpReceived(v, ip->SrcIP, ip->DstIP, ip->Protocol, data, size, packet->BroadcastPacket, ip->TimeToLive, + head_ip_header_data, head_ip_header_size, is_local_mac, ip_l3_size); + } + else + { + // This packet is necessary to combine because it is fragmented + UINT offset = IPV4_GET_OFFSET(ip) * 8; + IP_COMBINE *c = SearchIpCombine(v, ip->SrcIP, ip->DstIP, Endian16(ip->Identification), ip->Protocol); + + if (offset == 0) + { + head_ip_header_data = (UCHAR *)packet->L3.IPv4Header; + } + + last_packet = ((IPV4_GET_FLAGS(ip) & 0x01) == 0 ? true : false); + + if (c != NULL) + { + // It is the second or subsequent packet + c->MaxL3Size = MAX(c->MaxL3Size, ip_l3_size); + CombineIp(v, c, offset, data, size, last_packet, head_ip_header_data, head_ip_header_size); + } + else + { + // Create a combining object because it is the first packet + c = InsertIpCombine( + v, ip->SrcIP, ip->DstIP, Endian16(ip->Identification), ip->Protocol, packet->BroadcastPacket, + ip->TimeToLive, is_local_mac); + if (c != NULL) + { + c->MaxL3Size = ip_l3_size; + + CombineIp(v, c, offset, data, size, last_packet, head_ip_header_data, head_ip_header_size); + } + } + } +} + +// Send the waiting IP packets from the specified IP address +void SendWaitingIp(VH *v, UCHAR *mac, UINT dest_ip) +{ + UINT i; + LIST *o = NULL; + // Validate arguments + if (v == NULL || mac == NULL) + { + return; + } + + // Get a target list + for (i = 0; i < LIST_NUM(v->IpWaitTable); i++) + { + IP_WAIT *w = LIST_DATA(v->IpWaitTable, i); + + if (w->DestIP == dest_ip) + { + if (o == NULL) + { + o = NewListFast(NULL); + } + Add(o, w); + } + } + + // Send the target packets at once + if (o != NULL) + { + for (i = 0; i < LIST_NUM(o); i++) + { + IP_WAIT *w = LIST_DATA(o, i); + + // Transmission processing + VirtualIpSend(v, mac, w->Data, w->Size); + + // Remove from the list + Delete(v->IpWaitTable, w); + + // Release the memory + Free(w->Data); + Free(w); + } + + ReleaseList(o); + } +} + +// Remove the old IP waiting table entries +void DeleteOldIpWaitTable(VH *v) +{ + UINT i; + LIST *o = NULL; + // Validate arguments + if (v == NULL) + { + return; + } + + // Get the deleting list + for (i = 0; i < LIST_NUM(v->IpWaitTable); i++) + { + IP_WAIT *w = LIST_DATA(v->IpWaitTable, i); + + if (w->Expire < v->Now) + { + if (o == NULL) + { + o = NewListFast(NULL); + } + Add(o, w); + } + } + + // Delete all at once + if (o != NULL) + { + for (i = 0; i < LIST_NUM(o); i++) + { + IP_WAIT *w = LIST_DATA(o, i); + + // Remove from the list + Delete(v->IpWaitTable, w); + + // Release the memory + Free(w->Data); + Free(w); + } + ReleaseList(o); + } +} + +// Poll the IP waiting table +void PollingIpWaitTable(VH *v) +{ + // Delete the old table entries + DeleteOldIpWaitTable(v); +} + +// Insert the IP packet to the IP waiting table +void InsertIpWaitTable(VH *v, UINT dest_ip, UINT src_ip, void *data, UINT size) +{ + IP_WAIT *w; + // Validate arguments + if (v == NULL || data == NULL || size == 0) + { + return; + } + + w = ZeroMalloc(sizeof(IP_WAIT)); + w->Data = data; + w->Size = size; + w->SrcIP = src_ip; + w->DestIP = dest_ip; + w->Expire = v->Now + (UINT64)IP_WAIT_FOR_ARP_TIMEOUT; + + Add(v->IpWaitTable, w); +} + +// Initialize the IP waiting table +void InitIpWaitTable(VH *v) +{ + // Validate arguments + if (v == NULL) + { + return; + } + + v->IpWaitTable = NewList(NULL); +} + +// Release the IP waiting table +void FreeIpWaitTable(VH *v) +{ + UINT i; + // Validate arguments + if (v == NULL) + { + return; + } + + for (i = 0; i < LIST_NUM(v->IpWaitTable); i++) + { + IP_WAIT *w = LIST_DATA(v->IpWaitTable, i); + + Free(w->Data); + Free(w); + } + + ReleaseList(v->IpWaitTable); +} + +// MAC address for the IP address is found because something such as an ARP Response arrives +void ArpIpWasKnown(VH *v, UINT ip, UCHAR *mac) +{ + // Validate arguments + if (v == NULL || mac == NULL) + { + return; + } + + // If there is a query for this IP address in the ARP queue, delete it + DeleteArpWaitTable(v, ip); + + // Update or register in the ARP table + InsertArpTable(v, mac, ip); + + // Send the IP packets waiting in the IP waiting list + SendWaitingIp(v, mac, ip); +} + +// Re-issue ARPs by checking the ARP waiting list +void PollingArpWaitTable(VH *v) +{ + UINT i; + LIST *o; + // Validate arguments + if (v == NULL) + { + return; + } + + // Initialize the deletion list + o = NULL; + + // Scan whole ARP waiting list + for (i = 0; i < LIST_NUM(v->ArpWaitTable); i++) + { + ARP_WAIT *w = LIST_DATA(v->ArpWaitTable, i); + + if (w->GiveupTime < v->Now || (w->GiveupTime - 100 * 1000) > v->Now) + { + // Give up the sending of ARP + if (o == NULL) + { + o = NewListFast(NULL); + } + Add(o, w); + } + else + { + if (w->TimeoutTime < v->Now) + { + // Send an ARP again + VirtualArpSendRequest(v, w->IpAddress); + + // Set the next timeout time + w->TimeoutTime = v->Now + (UINT64)w->NextTimeoutTimeValue; + // Increase the ARP transmission interval of the second and subsequent + w->NextTimeoutTimeValue = w->NextTimeoutTimeValue + ARP_REQUEST_TIMEOUT; + } + } + } + + // Remove if there is a ARP waiting record to be deleted + if (o != NULL) + { + for (i = 0; i < LIST_NUM(o); i++) + { + ARP_WAIT *w = LIST_DATA(o, i); + + DeleteArpWaitTable(v, w->IpAddress); + } + ReleaseList(o); + } +} + +// Issue an ARP +void SendArp(VH *v, UINT ip) +{ + ARP_WAIT *w; + // Validate arguments + if (v == NULL) + { + return; + } + + // Examine whether the destination IP address has been registered in the ARP waiting list first + w = SearchArpWaitTable(v, ip); + if (w != NULL) + { + // Do not do anything because it is already registered + return; + } + + // Send an ARP packet first + VirtualArpSendRequest(v, ip); + + // Register in the ARP waiting list + w = ZeroMalloc(sizeof(ARP_WAIT)); + w->GiveupTime = v->Now + (UINT64)ARP_REQUEST_GIVEUP; + w->TimeoutTime = v->Now + (UINT64)ARP_REQUEST_TIMEOUT; + w->NextTimeoutTimeValue = ARP_REQUEST_TIMEOUT; + w->IpAddress = ip; + + InsertArpWaitTable(v, w); +} + +// Delete the ARP waiting table +void DeleteArpWaitTable(VH *v, UINT ip) +{ + ARP_WAIT *w; + // Validate arguments + if (v == NULL) + { + return; + } + + w = SearchArpWaitTable(v, ip); + if (w == NULL) + { + return; + } + Delete(v->ArpWaitTable, w); + + Free(w); +} + +// Search the ARP waiting table +ARP_WAIT *SearchArpWaitTable(VH *v, UINT ip) +{ + ARP_WAIT *w, t; + // Validate arguments + if (v == NULL) + { + return NULL; + } + + t.IpAddress = ip; + w = Search(v->ArpWaitTable, &t); + + return w; +} + +// Register in the ARP waiting table +void InsertArpWaitTable(VH *v, ARP_WAIT *w) +{ + // Validate arguments + if (v == NULL || w == NULL) + { + return; + } + + Add(v->ArpWaitTable, w); +} + +// Initialize the ARP waiting table +void InitArpWaitTable(VH *v) +{ + // Validate arguments + if (v == NULL) + { + return; + } + + v->ArpWaitTable = NewList(CompareArpWaitTable); +} + +// Release the ARP waiting table +void FreeArpWaitTable(VH *v) +{ + UINT i; + // Validate arguments + if (v == NULL) + { + return; + } + + for (i = 0; i < LIST_NUM(v->ArpWaitTable); i++) + { + ARP_WAIT *w = LIST_DATA(v->ArpWaitTable, i); + + Free(w); + } + + ReleaseList(v->ArpWaitTable); +} + +// Insert an entry in the ARP table +void InsertArpTable(VH *v, UCHAR *mac, UINT ip) +{ + ARP_ENTRY *e, t; + // Validate arguments + if (v == NULL || mac == NULL || ip == 0 || ip == 0xffffffff || IsMacBroadcast(mac) || IsMacInvalid(mac)) + { + return; + } + + // Check whether the same IP address is not already registered + t.IpAddress = ip; + e = Search(v->ArpTable, &t); + if (e != NULL) + { + // Override this simply because it was registered + if (Cmp(e->MacAddress, mac, 6) != 0) + { + e->Created = v->Now; + Copy(e->MacAddress, mac, 6); + } + e->Expire = v->Now + (UINT64)ARP_ENTRY_EXPIRES; + } + else + { + // Create a new entry + e = ZeroMalloc(sizeof(ARP_ENTRY)); + + e->Created = v->Now; + e->Expire = v->Now + (UINT64)ARP_ENTRY_EXPIRES; + Copy(e->MacAddress, mac, 6); + e->IpAddress = ip; + + Add(v->ArpTable, e); + } +} + +// Poll the ARP table +void PollingArpTable(VH *v) +{ + // Validate arguments + if (v == NULL) + { + return; + } + + if (v->Now > v->NextArpTablePolling) + { + v->NextArpTablePolling = v->Now + (UINT64)ARP_ENTRY_POLLING_TIME; + RefreshArpTable(v); + } +} + +// Remove the old ARP entries +void RefreshArpTable(VH *v) +{ + UINT i; + LIST *o; + // Validate arguments + if (v == NULL) + { + return; + } + + o = NewListFast(NULL); + for (i = 0; i < LIST_NUM(v->ArpTable); i++) + { + ARP_ENTRY *e = LIST_DATA(v->ArpTable, i); + + // Check for expired + if (e->Expire < v->Now) + { + // Expired + Add(o, e); + } + } + + // Remove expired entries at once + for (i = 0; i < LIST_NUM(o); i++) + { + ARP_ENTRY *e = LIST_DATA(o, i); + + Delete(v->ArpTable, e); + Free(e); + } + + ReleaseList(o); +} + +// Search the ARP table +ARP_ENTRY *SearchArpTable(VH *v, UINT ip) +{ + ARP_ENTRY *e, t; + // Validate arguments + if (v == NULL) + { + return NULL; + } + + t.IpAddress = ip; + e = Search(v->ArpTable, &t); + + return e; +} + +// Initialize the ARP table +void InitArpTable(VH *v) +{ + // Validate arguments + if (v == NULL) + { + return; + } + + v->ArpTable = NewList(CompareArpTable); +} + +// Release the ARP table +void FreeArpTable(VH *v) +{ + UINT i; + // Validate arguments + if (v == NULL) + { + return; + } + + // Delete all entries + for (i = 0; i < LIST_NUM(v->ArpTable); i++) + { + ARP_ENTRY *e = LIST_DATA(v->ArpTable, i); + Free(e); + } + ReleaseList(v->ArpTable); +} + +// Comparison of the ARP waiting table entry +int CompareArpWaitTable(void *p1, void *p2) +{ + ARP_WAIT *e1, *e2; + if (p1 == NULL || p2 == NULL) + { + return 0; + } + e1 = *(ARP_WAIT **)p1; + e2 = *(ARP_WAIT **)p2; + if (e1 == NULL || e2 == NULL) + { + return 0; + } + + if (e1->IpAddress > e2->IpAddress) + { + return 1; + } + else if (e1->IpAddress < e2->IpAddress) + { + return -1; + } + return 0; +} + +// Comparison of the ARP table entry +int CompareArpTable(void *p1, void *p2) +{ + ARP_ENTRY *e1, *e2; + if (p1 == NULL || p2 == NULL) + { + return 0; + } + e1 = *(ARP_ENTRY **)p1; + e2 = *(ARP_ENTRY **)p2; + if (e1 == NULL || e2 == NULL) + { + return 0; + } + + if (e1->IpAddress > e2->IpAddress) + { + return 1; + } + else if (e1->IpAddress < e2->IpAddress) + { + return -1; + } + return 0; +} + +// Initialize the virtual host +bool VirtualInit(VH *v) +{ + // Initialize the log + v->Logger = NULL; + + LockVirtual(v); + { + // Initialize + v->Cancel = NewCancel(); + v->SendQueue = NewQueue(); + } + UnlockVirtual(v); + + // Counter reset + v->Counter->c = 0; + v->DhcpId = 0; + + // Initialize the ARP table + InitArpTable(v); + + // Initialize the ARP waiting table + InitArpWaitTable(v); + + // Initialize the IP waiting table + InitIpWaitTable(v); + + // Initialize the IP combining list + InitIpCombineList(v); + + // Initialize the NAT + InitNat(v); + + // Initialize the DHCP server + InitDhcpServer(v); + + // Other initialization + v->flag1 = false; + v->NextArpTablePolling = Tick64() + (UINT64)ARP_ENTRY_POLLING_TIME; + v->CurrentIpQuota = 0; + v->Active = true; + + return true; +} +bool VirtualPaInit(SESSION *s) +{ + VH *v; + // Validate arguments + if (s == NULL || (v = (VH *)s->PacketAdapter->Param) == NULL) + { + return false; + } + + return VirtualInit(v); +} + +// Get the cancel object of the virtual host +CANCEL *VirtualPaGetCancel(SESSION *s) +{ + VH *v; + // Validate arguments + if (s == NULL || (v = (VH *)s->PacketAdapter->Param) == NULL) + { + return NULL; + } + + AddRef(v->Cancel->ref); + return v->Cancel; +} + +// Get the next packet from the virtual host +UINT VirtualGetNextPacket(VH *v, void **data) +{ + UINT ret = 0; + +START: + // Examine the transmission queue + LockQueue(v->SendQueue); + { + BLOCK *block = GetNext(v->SendQueue); + + if (block != NULL) + { + // There is a packet + ret = block->Size; + *data = block->Buf; + // Discard the structure + Free(block); + } + } + UnlockQueue(v->SendQueue); + + if (ret == 0) + { + LockVirtual(v); + { + v->Now = Tick64(); + // Polling process + VirtualPolling(v); + } + UnlockVirtual(v); + if (v->SendQueue->num_item != 0) + { + goto START; + } + } + + return ret; +} +UINT VirtualPaGetNextPacket(SESSION *s, void **data) +{ + VH *v; + // Validate arguments + if (s == NULL || (v = (VH *)s->PacketAdapter->Param) == NULL) + { + return INFINITE; + } + + return VirtualGetNextPacket(v, data); +} + +// Polling process (Always called once in a SessionMain loop) +void VirtualPolling(VH *v) +{ + // Validate arguments + if (v == NULL) + { + return; + } + + // DHCP polling + PollingDhcpServer(v); + + // NAT polling + PoolingNat(v); + + // Clear the old ARP table entries + PollingArpTable(v); + + // Poll the ARP waiting list + PollingArpWaitTable(v); + + // Poll the IP waiting list + PollingIpWaitTable(v); + + // Poll the IP combining list + PollingIpCombine(v); + + // Beacon transmission procedure + PollingBeacon(v); +} + +// Beacon transmission procedure +void PollingBeacon(VH *v) +{ + // Validate arguments + if (v == NULL) + { + return; + } + + if (v->LastSendBeacon == 0 || + ((v->LastSendBeacon + BEACON_SEND_INTERVAL) <= Tick64())) + { + v->LastSendBeacon = Tick64(); + + SendBeacon(v); + } +} + +// Send a Layer-2 packet +void VirtualLayer2Send(VH *v, UCHAR *dest_mac, UCHAR *src_mac, USHORT protocol, void *data, UINT size) +{ + MAC_HEADER *mac_header; + UCHAR *buf; + BLOCK *block; + // Validate arguments + if (v == NULL || dest_mac == NULL || src_mac == NULL || data == NULL || size > (MAX_PACKET_SIZE - sizeof(MAC_HEADER))) + { + return; + } + + // Create buffer + buf = Malloc(MAC_HEADER_SIZE + size); + + // MAC header + mac_header = (MAC_HEADER *)&buf[0]; + Copy(mac_header->DestAddress, dest_mac, 6); + Copy(mac_header->SrcAddress, src_mac, 6); + mac_header->Protocol = Endian16(protocol); + + // Copy data + Copy(&buf[sizeof(MAC_HEADER)], data, size); + + // Size + size += sizeof(MAC_HEADER); + + // Generate the packet + block = NewBlock(buf, size, 0); + + // Insert into the queue + LockQueue(v->SendQueue); + { + InsertQueue(v->SendQueue, block); + } + UnlockQueue(v->SendQueue); + + // Cancel + Cancel(v->Cancel); +} + +// Send an IP packet (with automatic fragmentation) +void SendIp(VH *v, UINT dest_ip, UINT src_ip, UCHAR protocol, void *data, UINT size) +{ + SendIpEx(v, dest_ip, src_ip, protocol, data, size, 0); +} +void SendIpEx(VH *v, UINT dest_ip, UINT src_ip, UCHAR protocol, void *data, UINT size, UCHAR ttl) +{ + UINT mss; + UCHAR *buf; + USHORT offset; + USHORT id; + USHORT total_size; + UINT size_of_this_packet; + // Validate arguments + if (v == NULL || data == NULL || size == 0 || size > MAX_IP_DATA_SIZE_TOTAL) + { + return; + } + + // Maximum segment size + mss = v->IpMss; + + // Buffer + buf = (UCHAR *)data; + + // ID + id = (v->NextId++); + + // Total size + total_size = (USHORT)size; + + // Start to split + offset = 0; + + while (true) + { + bool last_packet = false; + // Gets the size of this packet + size_of_this_packet = MIN((USHORT)mss, (total_size - offset)); + if ((offset + (USHORT)size_of_this_packet) == total_size) + { + last_packet = true; + } + + // Transmit the fragmented packet + SendFragmentedIp(v, dest_ip, src_ip, id, + total_size, offset, protocol, buf + offset, size_of_this_packet, NULL, ttl); + if (last_packet) + { + break; + } + + offset += (USHORT)size_of_this_packet; + } +} + +// Reserve to send the fragmented IP packet +void SendFragmentedIp(VH *v, UINT dest_ip, UINT src_ip, USHORT id, USHORT total_size, USHORT offset, UCHAR protocol, void *data, UINT size, UCHAR *dest_mac, UCHAR ttl) +{ + UCHAR *buf; + IPV4_HEADER *ip; + ARP_ENTRY *arp; + // Validate arguments + if (v == NULL || data == NULL || size == 0) + { + return; + } + + // Memory allocation + buf = Malloc(size + IP_HEADER_SIZE); + ip = (IPV4_HEADER *)&buf[0]; + + // IP header construction + ip->VersionAndHeaderLength = 0; + IPV4_SET_VERSION(ip, 4); + IPV4_SET_HEADER_LEN(ip, (IP_HEADER_SIZE / 4)); + ip->TypeOfService = DEFAULT_IP_TOS; + ip->TotalLength = Endian16((USHORT)(size + IP_HEADER_SIZE)); + ip->Identification = Endian16(id); + ip->FlagsAndFragmentOffset[0] = ip->FlagsAndFragmentOffset[1] = 0; + IPV4_SET_OFFSET(ip, (offset / 8)); + if ((offset + size) >= total_size) + { + IPV4_SET_FLAGS(ip, 0x00); + } + else + { + IPV4_SET_FLAGS(ip, 0x01); + } + ip->TimeToLive = (ttl == 0 ? DEFAULT_IP_TTL : ttl); + ip->Protocol = protocol; + ip->Checksum = 0; + ip->SrcIP = src_ip; + ip->DstIP = dest_ip; + + // Checksum calculation + ip->Checksum = IpChecksum(ip, IP_HEADER_SIZE); + + // Data copy + Copy(buf + IP_HEADER_SIZE, data, size); + + if (dest_mac == NULL) + { + if (ip->DstIP == 0xffffffff || + (IsInNetwork(ip->DstIP, v->HostIP, v->HostMask) && (ip->DstIP & (~v->HostMask)) == (~v->HostMask))) + { + // Broadcast address + dest_mac = broadcast; + } + else + { + // Send an ARP query if the destination MAC address is unknown + arp = SearchArpTable(v, dest_ip); + if (arp != NULL) + { + dest_mac = arp->MacAddress; + } + } + } + if (dest_mac != NULL) + { + // Send the packet immediately + VirtualIpSend(v, dest_mac, buf, size + IP_HEADER_SIZE); + + // Packet data may be released + Free(buf); + } + else + { + // Because this packet still can not be transferred, add it to the IP waiting table + InsertIpWaitTable(v, dest_ip, src_ip, buf, size + IP_HEADER_SIZE); + + // Issue an ARP + SendArp(v, dest_ip); + } +} + +// Send an IP packet (fragmented) +void VirtualIpSend(VH *v, UCHAR *dest_mac, void *data, UINT size) +{ + // Validate arguments + if (v == NULL || dest_mac == NULL || data == NULL || size == 0) + { + return; + } + + // Transmission + VirtualLayer2Send(v, dest_mac, v->MacAddress, MAC_PROTO_IPV4, data, size); +} + +// Send an ARP request packet +void VirtualArpSendRequest(VH *v, UINT dest_ip) +{ + ARPV4_HEADER arp; + // Validate arguments + if (v == NULL) + { + return; + } + + // Build the ARP header + arp.HardwareType = Endian16(ARP_HARDWARE_TYPE_ETHERNET); + arp.ProtocolType = Endian16(MAC_PROTO_IPV4); + arp.HardwareSize = 6; + arp.ProtocolSize = 4; + arp.Operation = Endian16(ARP_OPERATION_REQUEST); + Copy(arp.SrcAddress, v->MacAddress, 6); + arp.SrcIP = v->HostIP; + Zero(&arp.TargetAddress, 6); + arp.TargetIP = dest_ip; + + // Transmission + VirtualLayer2Send(v, broadcast, v->MacAddress, MAC_PROTO_ARPV4, &arp, sizeof(arp)); +} + +// Send an ARP response packet +void VirtualArpSendResponse(VH *v, UCHAR *dest_mac, UINT dest_ip, UINT src_ip) +{ + ARPV4_HEADER arp; + // Validate arguments + if (v == NULL || dest_mac == NULL) + { + return; + } + + // Build the ARP header + arp.HardwareType = Endian16(ARP_HARDWARE_TYPE_ETHERNET); + arp.ProtocolType = Endian16(MAC_PROTO_IPV4); + arp.HardwareSize = 6; + arp.ProtocolSize = 4; + arp.Operation = Endian16(ARP_OPERATION_RESPONSE); + Copy(arp.SrcAddress, v->MacAddress, 6); + Copy(arp.TargetAddress, dest_mac, 6); + arp.SrcIP = src_ip; + arp.TargetIP = dest_ip; + + // Transmission + VirtualLayer2Send(v, dest_mac, v->MacAddress, MAC_PROTO_ARPV4, &arp, sizeof(ARPV4_HEADER)); +} + +// An ARP request packet was received +void VirtualArpResponseRequest(VH *v, PKT *packet) +{ + ARPV4_HEADER *arp; + // Validate arguments + if (v == NULL || packet == NULL) + { + return; + } + + arp = packet->L3.ARPv4Header; + + // Memory the information of the host IP address and the MAC address of the other party + ArpIpWasKnown(v, arp->SrcIP, arp->SrcAddress); + + // Search whether it matches with the IP address of this host + if (v->HostIP == arp->TargetIP) + { + // Respond since the match + VirtualArpSendResponse(v, arp->SrcAddress, arp->SrcIP, v->HostIP); + return; + } + // Do nothing if it doesn't match +} + +// An ARP response packet is received +void VirtualArpResponseReceived(VH *v, PKT *packet) +{ + ARPV4_HEADER *arp; + // Validate arguments + if (v == NULL || packet == NULL) + { + return; + } + + arp = packet->L3.ARPv4Header; + + // Regard this information as known information + ArpIpWasKnown(v, arp->SrcIP, arp->SrcAddress); +} + +// Received an ARP packet +void VirtualArpReceived(VH *v, PKT *packet) +{ + ARPV4_HEADER *arp; + // Validate arguments + if (v == NULL || packet == NULL) + { + return; + } + + arp = packet->L3.ARPv4Header; + + if (Endian16(arp->HardwareType) != ARP_HARDWARE_TYPE_ETHERNET) + { + // Ignore if hardware type is other than Ethernet + return; + } + if (Endian16(arp->ProtocolType) != MAC_PROTO_IPV4) + { + // Ignore if the protocol type is a non-IPv4 + return; + } + if (arp->HardwareSize != 6 || arp->ProtocolSize != 4) + { + // Ignore because the size of protocol address or hardware address is invalid + return; + } + // Check the source MAC address + if (Cmp(arp->SrcAddress, packet->MacAddressSrc, 6) != 0) + { + // MAC address in the MAC header and the MAC address of the ARP packet are different + return; + } + + switch (Endian16(arp->Operation)) + { + case ARP_OPERATION_REQUEST: // ARP request + VirtualArpResponseRequest(v, packet); + break; + + case ARP_OPERATION_RESPONSE: // ARP response + VirtualArpResponseReceived(v, packet); + break; + } +} + +// Release the DHCP server +void FreeDhcpServer(VH *v) +{ + UINT i; + // Validate arguments + if (v == NULL) + { + return; + } + + // Empty the leases lists + for (i = 0; i < LIST_NUM(v->DhcpLeaseList); ++i) + { + DHCP_LEASE *d = LIST_DATA(v->DhcpLeaseList, i); + FreeDhcpLease(d); + } + + ReleaseList(v->DhcpLeaseList); + v->DhcpLeaseList = NULL; + + for (i = 0; i < LIST_NUM(v->DhcpPendingLeaseList); ++i) + { + DHCP_LEASE *d = LIST_DATA(v->DhcpPendingLeaseList, i); + FreeDhcpLease(d); + } + + ReleaseList(v->DhcpPendingLeaseList); + v->DhcpPendingLeaseList = NULL; +} + +// Initialize the DHCP server +void InitDhcpServer(VH *v) +{ + // Validate arguments + if (v == NULL) + { + return; + } + + // Create a list + v->DhcpLeaseList = NewList(CompareDhcpLeaseList); + v->DhcpPendingLeaseList = NewList(CompareDhcpLeaseList); +} + +// Search for a pending DHCP lease item by the IP address +DHCP_LEASE *SearchDhcpPendingLeaseByIp(VH *v, UINT ip) +{ + UINT i; + // Validate arguments + if (v == NULL) + { + return NULL; + } + + for (i = 0; i < LIST_NUM(v->DhcpPendingLeaseList); ++i) + { + DHCP_LEASE *d = LIST_DATA(v->DhcpPendingLeaseList, i); + if (d->IpAddress == ip) + { + return d; + } + } + + return NULL; +} + +// Search for a DHCP lease item by the IP address +DHCP_LEASE *SearchDhcpLeaseByIp(VH *v, UINT ip) +{ + UINT i; + // Validate arguments + if (v == NULL) + { + return NULL; + } + + for (i = 0; i < LIST_NUM(v->DhcpLeaseList); ++i) + { + DHCP_LEASE *d = LIST_DATA(v->DhcpLeaseList, i); + if (d->IpAddress == ip) + { + return d; + } + } + + return NULL; +} + +// Search for a pending DHCP lease item by the MAC address +DHCP_LEASE *SearchDhcpPendingLeaseByMac(VH *v, UCHAR *mac) +{ + DHCP_LEASE *d, t; + // Validate arguments + if (v == NULL || mac == NULL) + { + return NULL; + } + + Copy(&t.MacAddress, mac, 6); + d = Search(v->DhcpPendingLeaseList, &t); + + return d; +} + +// Search for a DHCP lease item by the MAC address +DHCP_LEASE *SearchDhcpLeaseByMac(VH *v, UCHAR *mac) +{ + DHCP_LEASE *d, t; + // Validate arguments + if (v == NULL || mac == NULL) + { + return NULL; + } + + Copy(&t.MacAddress, mac, 6); + d = Search(v->DhcpLeaseList, &t); + + return d; +} + +// Release the DHCP lease item +void FreeDhcpLease(DHCP_LEASE *d) +{ + // Validate arguments + if (d == NULL) + { + return; + } + + Free(d->Hostname); + Free(d); +} + +// Create a DHCP lease item +DHCP_LEASE *NewDhcpLease(UINT expire, UCHAR *mac_address, UINT ip, UINT mask, char *hostname) +{ + DHCP_LEASE *d; + // Validate arguments + if (mac_address == NULL || hostname == NULL) + { + return NULL; + } + + d = ZeroMalloc(sizeof(DHCP_LEASE)); + d->LeasedTime = (UINT64)Tick64(); + if (expire == INFINITE) + { + d->ExpireTime = INFINITE; + } + else + { + d->ExpireTime = d->LeasedTime + (UINT64)expire; + } + d->IpAddress = ip; + d->Mask = mask; + d->Hostname = CopyStr(hostname); + Copy(d->MacAddress, mac_address, 6); + + + return d; +} + +// Comparison of the items in the DHCP list +int CompareDhcpLeaseList(void *p1, void *p2) +{ + DHCP_LEASE *d1, *d2; + // Validate arguments + if (p1 == NULL || p2 == NULL) + { + return 0; + } + d1 = *(DHCP_LEASE **)p1; + d2 = *(DHCP_LEASE **)p2; + if (d1 == NULL || d2 == NULL) + { + return 0; + } + + return Cmp(d1->MacAddress, d2->MacAddress, 6); +} + +// Poll the DHCP server +void PollingDhcpServer(VH *v) +{ + UINT i; + // Validate arguments + if (v == NULL) + { + return; + } + + if (v->LastDhcpPolling != 0) + { + if ((v->LastDhcpPolling + (UINT64)DHCP_POLLING_INTERVAL) > v->Now && + v->LastDhcpPolling < v->Now) + { + return; + } + } + v->LastDhcpPolling = v->Now; + +LIST_CLEANUP: + for (i = 0; i < LIST_NUM(v->DhcpLeaseList); ++i) + { + DHCP_LEASE *d = LIST_DATA(v->DhcpLeaseList, i); + + if (d->ExpireTime < v->Now) + { + FreeDhcpLease(d); + Delete(v->DhcpLeaseList, d); + goto LIST_CLEANUP; + } + } + +PENDING_LIST_CLEANUP: + // Remove expired entries + for (i = 0; i < LIST_NUM(v->DhcpPendingLeaseList); ++i) + { + DHCP_LEASE *d = LIST_DATA(v->DhcpPendingLeaseList, i); + + if (d->ExpireTime < v->Now) + { + FreeDhcpLease(d); + Delete(v->DhcpPendingLeaseList, d); + goto PENDING_LIST_CLEANUP; + } + } +} + +// Correspond to the DHCP REQUEST +UINT ServeDhcpRequest(VH *v, UCHAR *mac, UINT request_ip) +{ + return ServeDhcpRequestEx(v, mac, request_ip, false); +} + +UINT ServeDhcpRequestEx(VH *v, UCHAR *mac, UINT request_ip, bool is_static_ip) +{ + UINT ret; + // Validate arguments + if (v == NULL || mac == NULL) + { + return 0; + } + + ret = ServeDhcpDiscoverEx(v, mac, request_ip, is_static_ip); + if (ret != request_ip) + { + if (request_ip != 0) + { + // Raise an error if the requested IP address cannot to be assigned + return 0; + } + } + + return ret; +} + +// Correspond to the DHCP DISCOVER +UINT ServeDhcpDiscover(VH *v, UCHAR *mac, UINT request_ip) +{ + UINT ret = 0; + // Validate arguments + if (v == NULL || mac == NULL) + { + return 0; + } + + if (request_ip != 0) + { + // IP address is specified + DHCP_LEASE *d = SearchDhcpLeaseByIp(v, request_ip); + if (d == NULL) + { + d = SearchDhcpPendingLeaseByIp(v, request_ip); + } + + if (d != NULL) + { + // If an entry for the same IP address already exists, + // check whether it is a request from the same MAC address + if (Cmp(mac, d->MacAddress, 6) == 0) + { + // Examine whether the specified IP address is within the range of assignment + if (Endian32(v->DhcpIpStart) <= Endian32(request_ip) && + Endian32(request_ip) <= Endian32(v->DhcpIpEnd)) + { + // Accept if within the range + ret = request_ip; + } + } + } + else + { + // Examine whether the specified IP address is within the range of assignment + if (Endian32(v->DhcpIpStart) <= Endian32(request_ip) && + Endian32(request_ip) <= Endian32(v->DhcpIpEnd)) + { + // Accept if within the range + ret = request_ip; + } + else + { + // Propose an IP in the range since it's a Discover although It is out of range + } + } + } + + if (ret == 0) + { + // If there is any entry with the same MAC address + // that are already registered, use it with priority + DHCP_LEASE *d = SearchDhcpLeaseByMac(v, mac); + if (d == NULL) + { + d = SearchDhcpPendingLeaseByMac(v, mac); + } + + if (d != NULL) + { + // Examine whether the found IP address is in the allocation region + if (Endian32(v->DhcpIpStart) <= Endian32(d->IpAddress) && + Endian32(d->IpAddress) <= Endian32(v->DhcpIpEnd)) + { + // Use the IP address if it's found within the range + ret = d->IpAddress; + } + } + } + + if (ret == 0) + { + // Take an appropriate IP addresses that can be assigned newly + HUB_OPTION *opt = NatGetHubOption(v); + + if (opt != NULL && opt->SecureNAT_RandomizeAssignIp) + { + ret = GetFreeDhcpIpAddressByRandom(v, mac); + } + else + { + ret = GetFreeDhcpIpAddress(v); + } + } + + return ret; +} + +UINT ServeDhcpDiscoverEx(VH *v, UCHAR *mac, UINT request_ip, bool is_static_ip) +{ + if (is_static_ip == false) + { + return ServeDhcpDiscover(v, mac, request_ip ); + } + + if (v == NULL || mac == NULL || request_ip == 0) + { + return 0; + } + + DHCP_LEASE *d = SearchDhcpLeaseByIp(v, request_ip); + if (d != NULL) + { + // The requested IP address is used already + return 0; + } + + // For static IP, the requested IP address must NOT be within the range of the DHCP pool + if (Endian32(request_ip) < Endian32(v->DhcpIpStart) || Endian32(request_ip) > Endian32(v->DhcpIpEnd)) + { + return request_ip; + } + + return 0; +} + +// Take an appropriate IP addresses that can be assigned newly +UINT GetFreeDhcpIpAddress(VH *v) +{ + UINT ip_start, ip_end; + UINT i; + // Validate arguments + if (v == NULL) + { + return 0; + } + + ip_start = Endian32(v->DhcpIpStart); + ip_end = Endian32(v->DhcpIpEnd); + + for (i = ip_start; i <= ip_end; i++) + { + UINT ip = Endian32(i); + if (SearchDhcpLeaseByIp(v, ip) == NULL && SearchDhcpPendingLeaseByIp(v, ip) == NULL) + { + // A free IP address is found + return ip; + } + } + + // There is no free address + return 0; +} + +// Take an appropriate IP addresses that can be assigned newly (random) +UINT GetFreeDhcpIpAddressByRandom(VH *v, UCHAR *mac) +{ + UINT ip_start, ip_end; + UINT i; + UINT num_retry; + // Validate arguments + if (v == NULL || mac == NULL) + { + return 0; + } + + ip_start = Endian32(v->DhcpIpStart); + ip_end = Endian32(v->DhcpIpEnd); + + if (ip_start > ip_end) + { + return 0; + } + + num_retry = (ip_end - ip_start + 1) * 2; + num_retry = MIN(num_retry, 65536 * 2); + + for (i = 0; i < num_retry; i++) + { + UCHAR rand_seed[sizeof(UINT) + 6]; + UCHAR hash[16]; + UINT rand_int; + UINT new_ip; + + WRITE_UINT(&rand_seed[0], i); + Copy(rand_seed + sizeof(UINT), mac, 6); + + Md5(hash, rand_seed, sizeof(rand_seed)); + + rand_int = READ_UINT(hash); + + new_ip = Endian32(ip_start + (rand_int % (ip_end - ip_start + 1))); + + if (SearchDhcpLeaseByIp(v, new_ip) == NULL && SearchDhcpPendingLeaseByIp(v, new_ip) == NULL) + { + // A free IP address is found + return new_ip; + } + } + + // There is no free address + return 0; +} + +// Virtual DHCP Server +void VirtualDhcpServer(VH *v, PKT *p) +{ + DHCPV4_HEADER *dhcp; + UCHAR *data; + UINT size; + UINT dhcp_header_size; + UINT dhcp_data_offset; + UINT tran_id; + UINT magic_cookie = Endian32(DHCP_MAGIC_COOKIE); + bool ok; + DHCP_OPTION_LIST *opt; + // Validate arguments + if (v == NULL || p == NULL) + { + return; + } + + if (v->NativeNat != NULL) + { + if (Cmp(p->MacAddressSrc, v->NativeNat->CurrentMacAddress, 6) == 0) + { + // DHCP server is kept from responding for the native NAT interface + // ** Not be needed to return yet ** + //return; + } + } + + dhcp = p->L7.DHCPv4Header; + + tran_id = Endian32(dhcp->TransactionId); + + // Get the DHCP data and size + dhcp_header_size = sizeof(DHCPV4_HEADER); + dhcp_data_offset = (UINT)(((UCHAR *)p->L7.DHCPv4Header) - ((UCHAR *)p->MacHeader) + dhcp_header_size); + data = ((UCHAR *)dhcp) + dhcp_header_size; + size = p->PacketSize - dhcp_data_offset; + if (dhcp_header_size < 5) + { + // Data size is invalid + return; + } + + // Search for Magic Cookie + ok = false; + while (size >= 5) + { + if (Cmp(data, &magic_cookie, sizeof(magic_cookie)) == 0) + { + // Found + data += 4; + size -= 4; + ok = true; + break; + } + data++; + size--; + } + + if (ok == false) + { + // The packet is invalid + return; + } + + // Parse DHCP options list + opt = ParseDhcpOptionList(data, size); + if (opt == NULL) + { + // The packet is invalid + return; + } + + if (StartWith(opt->Hostname, NN_HOSTNAME_STARTWITH) || StartWith(opt->Hostname, NN_HOSTNAME_STARTWITH2)) + { + Free(opt); + return; + } + + if (dhcp->OpCode == 1 && (opt->Opcode == DHCP_DISCOVER || opt->Opcode == DHCP_REQUEST || opt->Opcode == DHCP_INFORM)) + { + // Operate as the server + UINT ip = 0, ip_static = dhcp->ServerIP; + dhcp->ServerIP = 0; + + if (opt->RequestedIp == 0) + { + opt->RequestedIp = (ip_static ? ip_static : p->L3.IPv4Header->SrcIP); + } + if (opt->Opcode == DHCP_DISCOVER) + { + // Return an IP address that can be used + ip = ServeDhcpDiscoverEx(v, p->MacAddressSrc, opt->RequestedIp, ip_static); + } + else if (opt->Opcode == DHCP_REQUEST) + { + // Determine the IP address + if (ip_static && opt->RequestedIp != ip_static) + { + // Don't allow opt->RequestedIp other than the IP written in user's note + ip = 0; + } + else + { + ip = ServeDhcpRequestEx(v, p->MacAddressSrc, opt->RequestedIp, ip_static); + } + } + + if (ip != 0 || opt->Opcode == DHCP_INFORM) + { + // Respond if there is providable IP address + + if (opt->Opcode == DHCP_REQUEST) + { + DHCP_LEASE *d; + char client_mac[MAX_SIZE]; + char client_ip[MAX_SIZE]; + + // Remove old records with the same IP address + d = SearchDhcpLeaseByIp(v, ip); + if (d != NULL) + { + FreeDhcpLease(d); + Delete(v->DhcpLeaseList, d); + } + + d = SearchDhcpPendingLeaseByIp(v, ip); + if (d != NULL) + { + FreeDhcpLease(d); + Delete(v->DhcpPendingLeaseList, d); + } + + // Create a new entry + d = NewDhcpLease(v->DhcpExpire, p->MacAddressSrc, ip, v->DhcpMask, opt->Hostname); + d->Id = ++v->DhcpId; + Add(v->DhcpLeaseList, d); + + MacToStr(client_mac, sizeof(client_mac), d->MacAddress); + IPToStr32(client_ip, sizeof(client_ip), d->IpAddress); + + NLog(v, "LH_NAT_DHCP_CREATED", d->Id, client_mac, client_ip, d->Hostname, v->DhcpExpire / 1000); + } + + // Respond + if (true) + { + DHCP_OPTION_LIST ret; + LIST *o; + Zero(&ret, sizeof(ret)); + + ret.Opcode = (opt->Opcode == DHCP_DISCOVER ? DHCP_OFFER : DHCP_ACK); + ret.ServerAddress = v->HostIP; + if (v->DhcpExpire == INFINITE) + { + ret.LeaseTime = INFINITE; + } + else + { + ret.LeaseTime = Endian32(v->DhcpExpire / 1000); + } + + if (opt->Opcode == DHCP_INFORM) + { + ret.LeaseTime = 0; + } + + StrCpy(ret.DomainName, sizeof(ret.DomainName), v->DhcpDomain); + ret.SubnetMask = v->DhcpMask; + ret.DnsServer = v->DhcpDns; + ret.DnsServer2 = v->DhcpDns2; + ret.Gateway = v->DhcpGateway; + + if (GetGlobalServerFlag(GSF_DISABLE_PUSH_ROUTE) == 0) + { + Copy(&ret.ClasslessRoute, &v->PushRoute, sizeof(DHCP_CLASSLESS_ROUTE_TABLE)); + + if (IsIpcMacAddress(p->MacAddressSrc)) + { + if (ret.Gateway == 0) + { + // If the default gateway is not specified, add the static routing table + // entry for the local IP subnet + // (for PPP clients) + IP dhcp_ip; + IP dhcp_mask; + IP dhcp_network; + + UINTToIP(&dhcp_ip, ip); + + if (ip == 0) + { + UINTToIP(&dhcp_ip, p->L3.IPv4Header->SrcIP); + } + + UINTToIP(&dhcp_mask, v->DhcpMask); + + IPAnd4(&dhcp_network, &dhcp_ip, &dhcp_mask); + + if (GetBestClasslessRoute(&ret.ClasslessRoute, &dhcp_ip) == NULL) + { + if (ret.ClasslessRoute.NumExistingRoutes < MAX_DHCP_CLASSLESS_ROUTE_ENTRIES) + { + DHCP_CLASSLESS_ROUTE *cr = &ret.ClasslessRoute.Entries[ret.ClasslessRoute.NumExistingRoutes]; + + cr->Exists = true; + + UINTToIP(&cr->Gateway, v->HostIP); + + if (v->UseNat == false && ret.ClasslessRoute.NumExistingRoutes >= 1) + { + Copy(&cr->Gateway, &ret.ClasslessRoute.Entries[0].Gateway, sizeof(IP)); + } + + Copy(&cr->Network, &dhcp_network, sizeof(IP)); + Copy(&cr->SubnetMask, &dhcp_mask, sizeof(IP)); + cr->SubnetMaskLen = SubnetMaskToInt(&dhcp_mask); + + ret.ClasslessRoute.NumExistingRoutes++; + } + } + } + } + } + + if (opt->Opcode != DHCP_INFORM) + { + char client_mac[MAX_SIZE]; + char client_ip[64]; + IP ips; + + BinToStr(client_mac, sizeof(client_mac), p->MacAddressSrc, 6); + UINTToIP(&ips, ip); + IPToStr(client_ip, sizeof(client_ip), &ips); + + if (ret.Opcode == DHCP_OFFER) + { + // DHCP_OFFER + DHCP_LEASE *d = NewDhcpLease(5000, p->MacAddressSrc, ip, v->DhcpMask, opt->Hostname); + d->Id = LIST_NUM(v->DhcpPendingLeaseList); + Add(v->DhcpPendingLeaseList, d); + + Debug("VirtualDhcpServer(): %s has been marked as pending for %s\n", client_ip, client_mac); + } + else + { + // DHCP_ACK + Debug("VirtualDhcpServer(): %s has been assigned to %s\n", client_ip, client_mac); + } + } + + // Build a DHCP option + o = BuildDhcpOption(&ret); + if (o != NULL) + { + BUF *b = BuildDhcpOptionsBuf(o); + if (b != NULL) + { + UINT dest_ip = p->L3.IPv4Header->SrcIP; + if (dest_ip == 0) + { + dest_ip = 0xffffffff; + } + // Transmission + VirtualDhcpSend(v, tran_id, dest_ip, Endian16(p->L4.UDPHeader->SrcPort), + ip, dhcp->ClientMacAddress, b, dhcp->HardwareType, dhcp->HardwareAddressSize); + + // Release the memory + FreeBuf(b); + } + FreeDhcpOptions(o); + } + } + } + else + { + // There is no IP address that can be provided + DHCP_OPTION_LIST ret; + LIST *o; + Zero(&ret, sizeof(ret)); + + ret.Opcode = DHCP_NACK; + ret.ServerAddress = v->HostIP; + StrCpy(ret.DomainName, sizeof(ret.DomainName), v->DhcpDomain); + ret.SubnetMask = v->DhcpMask; + + // Build the DHCP option + o = BuildDhcpOption(&ret); + if (o != NULL) + { + BUF *b = BuildDhcpOptionsBuf(o); + if (b != NULL) + { + UINT dest_ip = p->L3.IPv4Header->SrcIP; + if (dest_ip == 0) + { + dest_ip = 0xffffffff; + } + // Transmission + VirtualDhcpSend(v, tran_id, dest_ip, Endian16(p->L4.UDPHeader->SrcPort), + ip, dhcp->ClientMacAddress, b, dhcp->HardwareType, dhcp->HardwareAddressSize); + + // Release the memory + FreeBuf(b); + } + FreeDhcpOptions(o); + } + } + } + + // Release the memory + Free(opt); +} + +// Submit the DHCP response packet +void VirtualDhcpSend(VH *v, UINT tran_id, UINT dest_ip, UINT dest_port, + UINT new_ip, UCHAR *client_mac, BUF *b, UINT hw_type, UINT hw_addr_size) +{ + UINT blank_size = 128 + 64; + UINT dhcp_packet_size; + UINT magic = Endian32(DHCP_MAGIC_COOKIE); + DHCPV4_HEADER *dhcp; + void *magic_cookie_addr; + void *buffer_addr; + // Validate arguments + if (v == NULL || b == NULL) + { + return; + } + + // Calculate the DHCP packet size + dhcp_packet_size = blank_size + sizeof(DHCPV4_HEADER) + sizeof(magic) + b->Size; + + if (dhcp_packet_size < DHCP_MIN_SIZE) + { + // Padding + dhcp_packet_size = DHCP_MIN_SIZE; + } + + // Create a header + dhcp = ZeroMalloc(dhcp_packet_size); + + dhcp->OpCode = 2; + dhcp->HardwareType = hw_type; + dhcp->HardwareAddressSize = hw_addr_size; + dhcp->Hops = 0; + dhcp->TransactionId = Endian32(tran_id); + dhcp->Seconds = 0; + dhcp->Flags = 0; + dhcp->YourIP = new_ip; + dhcp->ServerIP = v->HostIP; + Copy(dhcp->ClientMacAddress, client_mac, 6); + + // Calculate the address + magic_cookie_addr = (((UCHAR *)dhcp) + sizeof(DHCPV4_HEADER) + blank_size); + buffer_addr = ((UCHAR *)magic_cookie_addr) + sizeof(magic); + + // Magic Cookie + Copy(magic_cookie_addr, &magic, sizeof(magic)); + + // Buffer + Copy(buffer_addr, b->Buf, b->Size); + + // Transmission + SendUdp(v, dest_ip, dest_port, v->HostIP, NAT_DHCP_SERVER_PORT, dhcp, dhcp_packet_size); + + Free(dhcp); +} + +// Virtual host: Process the Layer2 +void VirtualLayer2(VH *v, PKT *packet) +{ + bool ok; + // Validate arguments + if (packet == NULL || v == NULL) + { + return; + } + + // Packet filter + if (VirtualLayer2Filter(v, packet) == false) + { + // Packet was ignored + return; + } + + ok = false; + if (packet->TypeL3 == L3_IPV4 && packet->TypeL4 == L4_UDP && packet->TypeL7 == L7_DHCPV4) + { + if (v->UseDhcp) + { + // A special treatment on the DHCP packet + if (packet->BroadcastPacket || Cmp(packet->MacAddressDest, v->MacAddress, 6) == 0) + { + // Virtual DHCP server processing + VirtualDhcpServer(v, packet); + ok = true; + } + } + } + + if (ok == false) + { + // The process for each supported protocol + switch (packet->TypeL3) + { + case L3_ARPV4: // ARPv4 + VirtualArpReceived(v, packet); + break; + + case L3_IPV4: // IPv4 + VirtualIpReceived(v, packet); + break; + } + } +} + +// Packet filter (Blocking packets to other than me) +bool VirtualLayer2Filter(VH *v, PKT *packet) +{ + // Validate arguments + if (v == NULL || packet == NULL) + { + return false; + } + + // Pass through if broadcast packet + if (packet->BroadcastPacket) + { + return true; + } + + // Ignore if the sender of the packet is myself + if (Cmp(packet->MacAddressSrc, v->MacAddress, 6) == 0) + { + return false; + } + // Pass through in the case of a packet addressed to me + if (Cmp(packet->MacAddressDest, v->MacAddress, 6) == 0) + { + return true; + } + + // Discard if the other packets + return false; +} + +// The virtual host is made to receive a packet +bool VirtualPutPacket(VH *v, void *data, UINT size) +{ + if (data == NULL) + { + // Flush + v->flag1 = false; + + if (v->NativeNat != NULL) + { + if (v->NativeNat->SendStateChanged) + { + TUBE *halt_tube = NULL; + + Lock(v->NativeNat->Lock); + { + if (v->NativeNat->HaltTube != NULL) + { + halt_tube = v->NativeNat->HaltTube; + + AddRef(halt_tube->Ref); + } + } + Unlock(v->NativeNat->Lock); + + if (halt_tube != NULL) + { + TubeFlushEx(halt_tube, true); + + v->NativeNat->SendStateChanged = false; + + ReleaseTube(halt_tube); + } + } + } + } + else + { + // Interpret the received packet + PKT *packet = ParsePacket(data, size); + + if (v->flag1 == false) + { + v->flag1 = true; + v->Now = Tick64(); + } + + // Lock the entire virtual machine in here + LockVirtual(v); + { + if (packet != NULL) + { + // Process the Layer-2 + VirtualLayer2(v, packet); + + // Release the packet structure + FreePacket(packet); + } + } + UnlockVirtual(v); + + Free(data); + } + + return true; +} +bool VirtualPaPutPacket(SESSION *s, void *data, UINT size) +{ + VH *v; + // Validate arguments + if (s == NULL || (v = (VH *)s->PacketAdapter->Param) == NULL) + { + return false; + } + + return VirtualPutPacket(v, data, size); +} + +// Get the options for the virtual host +void GetVirtualHostOption(VH *v, VH_OPTION *o) +{ + // Validate arguments + if (v == NULL) + { + return; + } + + LockVirtual(v); + { + Zero(o, sizeof(VH_OPTION)); + + // MAC address + Copy(o->MacAddress, v->MacAddress, 6); + + // Host information + UINTToIP(&o->Ip, v->HostIP); + UINTToIP(&o->Mask, v->HostMask); + + o->Mtu = v->Mtu; + + // NAT timeout information + o->NatTcpTimeout = v->NatTcpTimeout / 1000; + o->NatUdpTimeout = v->NatUdpTimeout / 1000; + + // NAT using flag + o->UseNat = v->UseNat; + + // DHCP using flag + o->UseDhcp = v->UseDhcp; + + // IP address range for DHCP distribution + UINTToIP(&o->DhcpLeaseIPStart, v->DhcpIpStart); + UINTToIP(&o->DhcpLeaseIPEnd, v->DhcpIpEnd); + + // Subnet mask + UINTToIP(&o->DhcpSubnetMask, v->DhcpMask); + + // Expiration date + if (v->DhcpExpire != INFINITE) + { + o->DhcpExpireTimeSpan = v->DhcpExpire / 1000; + } + else + { + o->DhcpExpireTimeSpan = INFINITE; + } + + // Gateway address + UINTToIP(&o->DhcpGatewayAddress, v->DhcpGateway); + + // DNS server address + UINTToIP(&o->DhcpDnsServerAddress, v->DhcpDns); + UINTToIP(&o->DhcpDnsServerAddress2, v->DhcpDns2); + + // Domain name + StrCpy(o->DhcpDomainName, sizeof(o->DhcpDomainName), v->DhcpDomain); + + // Save a log + o->SaveLog = v->SaveLog; + + // Pushing route option + BuildClasslessRouteTableStr(o->DhcpPushRoutes, sizeof(o->DhcpPushRoutes), &v->PushRoute); + o->ApplyDhcpPushRoutes = true; + } + UnlockVirtual(v); +} + +// Set the option to the virtual host +void SetVirtualHostOption(VH *v, VH_OPTION *vo) +{ + UINT i; + // Validate arguments + if (v == NULL || vo == NULL) + { + return; + } + + LockVirtual(v); + { + // Set the MAC address + for (i = 0; i < 6; i++) + { + if (vo->MacAddress[i] != 0) + { + Copy(v->MacAddress, vo->MacAddress, 6); + break; + } + } + + // Set the host information list + v->HostIP = IPToUINT(&vo->Ip); + v->HostMask = IPToUINT(&vo->Mask); + + // Set the MTU, MMS + v->Mtu = MIN(vo->Mtu, MAX_L3_DATA_SIZE); + if (v->Mtu == 0) + { + v->Mtu = MAX_L3_DATA_SIZE; + } + v->Mtu = MAX(v->Mtu, TCP_HEADER_SIZE + IP_HEADER_SIZE + MAC_HEADER_SIZE + 8); + v->IpMss = ((v->Mtu - IP_HEADER_SIZE) / 8) * 8; + v->TcpMss = ((v->IpMss - TCP_HEADER_SIZE) / 8) * 8; + v->UdpMss = ((v->IpMss - UDP_HEADER_SIZE) / 8) * 8; + + if (vo->NatTcpTimeout != 0) + { + v->NatTcpTimeout = MIN(vo->NatTcpTimeout, 4000000) * 1000; + } + if (vo->NatUdpTimeout != 0) + { + v->NatUdpTimeout = MIN(vo->NatUdpTimeout, 4000000) * 1000; + } + v->NatTcpTimeout = MAKESURE(v->NatTcpTimeout, NAT_TCP_MIN_TIMEOUT, NAT_TCP_MAX_TIMEOUT); + v->NatUdpTimeout = MAKESURE(v->NatUdpTimeout, NAT_UDP_MIN_TIMEOUT, NAT_UDP_MAX_TIMEOUT); + Debug("Timeout: %d , %d\n", v->NatTcpTimeout, v->NatUdpTimeout); + + // NAT using flag + v->UseNat = vo->UseNat; + + // DHCP using flag + v->UseDhcp = vo->UseDhcp; + + // Expiration date + if (vo->DhcpExpireTimeSpan == 0 || vo->DhcpExpireTimeSpan == INFINITE) + { + v->DhcpExpire = INFINITE; + } + else + { + v->DhcpExpire = MAKESURE(DHCP_MIN_EXPIRE_TIMESPAN, + MIN(vo->DhcpExpireTimeSpan * 1000, 2000000000), + INFINITE); + } + + // Address range to be distributed + v->DhcpIpStart = IPToUINT(&vo->DhcpLeaseIPStart); + v->DhcpIpEnd = IPToUINT(&vo->DhcpLeaseIPEnd); + if (Endian32(v->DhcpIpEnd) < Endian32(v->DhcpIpStart)) + { + v->DhcpIpEnd = v->DhcpIpStart; + } + + // Subnet mask + v->DhcpMask = IPToUINT(&vo->DhcpSubnetMask); + + // Gateway address + v->DhcpGateway = IPToUINT(&vo->DhcpGatewayAddress); + + // DNS server address + v->DhcpDns = IPToUINT(&vo->DhcpDnsServerAddress); + v->DhcpDns2 = IPToUINT(&vo->DhcpDnsServerAddress2); + + // Domain name + StrCpy(v->DhcpDomain, sizeof(v->DhcpDomain), vo->DhcpDomainName); + + // Save a log + v->SaveLog = vo->SaveLog; + + // DHCP routing table pushing setting + if (vo->ApplyDhcpPushRoutes) + { + DHCP_CLASSLESS_ROUTE_TABLE rt; + + Zero(&rt, sizeof(rt)); + + if (ParseClasslessRouteTableStr(&rt, vo->DhcpPushRoutes)) + { + Copy(&v->PushRoute, &rt, sizeof(DHCP_CLASSLESS_ROUTE_TABLE)); + } + } + } + UnlockVirtual(v); +} + +// Release the virtual host +void Virtual_Free(VH *v) +{ + // Release the DHCP server + FreeDhcpServer(v); + + // NAT release + FreeNat(v); + + LockVirtual(v); + { + // Release the IP combining list + FreeIpCombineList(v); + + // Release the IP waiting table + FreeIpWaitTable(v); + + // Release the ARP waiting table + FreeArpWaitTable(v); + + // Release the ARP table + FreeArpTable(v); + + // Release the transmission queue + LockQueue(v->SendQueue); + { + BLOCK *block; + + // Release all queues + while (block = GetNext(v->SendQueue)) + { + FreeBlock(block); + } + } + UnlockQueue(v->SendQueue); + ReleaseQueue(v->SendQueue); + v->SendQueue = NULL; + + // Release the cancel object + ReleaseCancel(v->Cancel); + + v->Active = false; + } + UnlockVirtual(v); + + // Release the logger + FreeLog(v->Logger); +} +void VirtualPaFree(SESSION *s) +{ + VH *v; + // Validate arguments + if (s == NULL || (v = (VH *)s->PacketAdapter->Param) == NULL) + { + return; + } + + Virtual_Free(v); +} + +// Release the virtual host +void ReleaseVirtual(VH *v) +{ + // Validate arguments + if (v == NULL) + { + return; + } + + if (Release(v->ref) == 0) + { + CleanupVirtual(v); + } +} + +// Lock the virtual host +void LockVirtual(VH *v) +{ + // Validate arguments + if (v == NULL) + { + return; + } + + Lock(v->lock); +} + +// Unlock the virtual host +void UnlockVirtual(VH *v) +{ + // Validate arguments + if (v == NULL) + { + return; + } + + Unlock(v->lock); +} + +// Cleanup the virtual host +void CleanupVirtual(VH *v) +{ + // Validate arguments + if (v == NULL) + { + return; + } + + if (v->Session != NULL) + { + ReleaseSession(v->Session); + } + + DeleteCounter(v->Counter); + DeleteLock(v->lock); + + Free(v); +} + +// Stop the virtual host +void StopVirtualHost(VH *v) +{ + SESSION *s; + // Validate arguments + if (v == NULL) + { + return; + } + + // Get the session corresponding to the virtual host + LockVirtual(v); + { + s = v->Session; + if (s != NULL) + { + AddRef(s->ref); + } + } + UnlockVirtual(v); + + if (s == NULL) + { + // This session is already stopped + return; + } + + // Stop Session + StopSession(s); + + ReleaseSession(s); +} + +// Create a new virtual host +VH *NewVirtualHost(CEDAR *cedar, CLIENT_OPTION *option, CLIENT_AUTH *auth, VH_OPTION *vh_option) +{ + return NewVirtualHostEx(cedar, option, auth, vh_option, NULL); +} +VH *NewVirtualHostEx(CEDAR *cedar, CLIENT_OPTION *option, CLIENT_AUTH *auth, VH_OPTION *vh_option, NAT *nat) +{ + VH *v; + SOCK *s; + // Validate arguments + if (vh_option == NULL) + { + return NULL; + } + + // Create a VH + v = ZeroMalloc(sizeof(VH)); + v->ref = NewRef(); + v->lock = NewLock(); + v->Counter = NewCounter(); + + v->nat = nat; + + // Examine whether ICMP Raw Socket can be created + s = NewUDP4(MAKE_SPECIAL_PORT(IP_PROTO_ICMPV4), NULL); + if (s != NULL) + { + if (s->IsTtlSupported) + { + v->IcmpRawSocketOk = true; + } + + ReleaseSock(s); + } + + if (v->IcmpRawSocketOk == false) + { + if (IsIcmpApiSupported()) + { + v->IcmpApiOk = true; + } + } + + // Set the options + SetVirtualHostOption(v, vh_option); + + return v; +} + +// Generate a random MAC address +void GenMacAddress(UCHAR *mac) +{ + UCHAR rand_data[32]; + UINT64 now; + BUF *b; + UCHAR hash[SHA1_SIZE]; + // Validate arguments + if (mac == NULL) + { + return; + } + + // Get the current time + now = SystemTime64(); + + // Generate a random number + Rand(rand_data, sizeof(rand_data)); + + // Add to the buffer + b = NewBuf(); + WriteBuf(b, &now, sizeof(now)); + WriteBuf(b, rand_data, sizeof(rand_data)); + + // Hash + Sha0(hash, b->Buf, b->Size); + + // Generate a MAC address + mac[0] = 0x5E; + mac[1] = hash[0]; + mac[2] = hash[1]; + mac[3] = hash[2]; + mac[4] = hash[3]; + mac[5] = hash[4]; + + FreeBuf(b); +} + +// Get a packet of virtual host adapter +PACKET_ADAPTER *VirtualGetPacketAdapter() +{ + return NewPacketAdapter(VirtualPaInit, VirtualPaGetCancel, + VirtualPaGetNextPacket, VirtualPaPutPacket, VirtualPaFree); +} + + diff --git a/src/Cedar/Virtual.h b/src/Cedar/Virtual.h index f4086cbe..1e15e1e8 100644 --- a/src/Cedar/Virtual.h +++ b/src/Cedar/Virtual.h @@ -1,592 +1,592 @@ -// SoftEther VPN Source Code - Developer Edition Master Branch -// Cedar Communication Module - - -// Virtual.h -// Header of Virtual.c - -#ifndef VIRTUAL_H -#define VIRTUAL_H - - -#define NN_RAW_IP_PORT_START 61001 -#define NN_RAW_IP_PORT_END 65535 - -#define VIRTUAL_TCP_SEND_TIMEOUT (21 * 1000) - -#define NN_NEXT_WAIT_TIME_FOR_DEVICE_ENUM (30 * 1000) -#define NN_NEXT_WAIT_TIME_MAX_FAIL_COUNT 30 - -#define NN_HOSTNAME_FORMAT "securenat-%s" -#define NN_HOSTNAME_STARTWITH "securenat-" -#define NN_HOSTNAME_STARTWITH2 "securenat_" -#define NN_CHECK_CONNECTIVITY_TIMEOUT (5 * 1000) -#define NN_CHECK_CONNECTIVITY_INTERVAL (1 * 1000) - -#define NN_POLL_CONNECTIVITY_TIMEOUT (4 * 60 * 1000 + 10) -#define NN_POLL_CONNECTIVITY_INTERVAL (1 * 60 * 1000) - -#define NN_MAX_QUEUE_LENGTH 10000 -#define NN_NO_NATIVE_NAT_FILENAME L"@no_native_nat_niclist.txt" - -#define NN_TIMEOUT_FOR_UNESTBALISHED_TCP (10 * 1000) // Time-out period of a TCP connection incomplete session - -// Destination host name of the connectivity test for the Internet -// (Access the www.yahoo.com. Access the www.baidu.com from China. I am sorry.) -#define NN_CHECK_HOSTNAME (IsEmptyStr(secure_nat_target_hostname) ? (IsUseAlternativeHostname() ? "www.baidu.com" : "www.yahoo.com") : secure_nat_target_hostname) - - -// Native NAT entry -struct NATIVE_NAT_ENTRY -{ - UINT Id; // ID - UINT Status; // Status - UINT Protocol; // Protocol - UINT SrcIp; // Source IP address - UINT SrcPort; // Source port number - UINT DestIp; // Destination IP address - UINT DestPort; // Destination port number - UINT PublicIp; // Public IP address - UINT PublicPort; // Public port number - UINT64 CreatedTime; // Connection time - UINT64 LastCommTime; // Last communication time - UINT64 TotalSent; // Total number of bytes sent - UINT64 TotalRecv; // Total number of bytes received - UINT LastSeq; // Last sequence number - UINT LastAck; // Last acknowledgment number - UINT HashCodeForSend; // Cached hash code (transmit direction) - UINT HashCodeForRecv; // Cached hash code (receive direction) -}; - -// Native NAT -struct NATIVE_NAT -{ - struct VH *v; // Virtual machine - bool Active; // Whether currently available - THREAD *Thread; // Main thread - bool Halt; // Halting flag - TUBE *HaltTube; // Tube to be disconnected in order to stop - TUBE *HaltTube2; // Tube 2 to be disconnected in order to stop - TUBE *HaltTube3; // Tube 3 to be disconnected in order to stop - LOCK *Lock; // Lock - EVENT *HaltEvent; // Halting event - UINT LastInterfaceIndex; // Index number of the interface that is used for attempting last - UINT LastInterfaceDeviceHash; // Hash value of the device list at the time of the last attempted - UINT NextWaitTimeForRetry; // Time for waiting next time for the device list enumeration - UINT FailedCount; // The number of failed searching for the interface - UINT LastHostAddressHash; // Hash of the last host IP address - DHCP_OPTION_LIST CurrentDhcpOptions; // Current DHCP options - QUEUE *SendQueue; // Transmission queue - QUEUE *RecvQueue; // Reception queue - CANCEL *Cancel; // Cancel object (Hit if there is a received packet) - LOCK *CancelLock; // Lock of the cancel object - HASH_LIST *NatTableForSend; // Native NAT table (for transmission) - HASH_LIST *NatTableForRecv; // Native NAT table (for reception) - UINT PublicIP; // Public IP - USHORT NextId; // Next IP packet ID - bool SendStateChanged; // Transmission state changed - LIST *IpCombine; // IP combining list - UINT CurrentIpQuota; // Current IP combining quota - UCHAR CurrentMacAddress[6]; // Current MAC address - bool IsRawIpMode; // Is RAW_IP mode -}; - -// ARP entry -struct ARP_ENTRY -{ - UINT IpAddress; // IP address - UCHAR MacAddress[6]; // MAC address - UCHAR Padding[2]; - UINT64 Created; // Creation date and time - UINT64 Expire; // Expiration date -}; - -// ARP waiting list -struct ARP_WAIT -{ - UINT IpAddress; // IP address trying to solve - UINT NextTimeoutTimeValue; // Next time before timing out - UINT64 TimeoutTime; // Current Time-out of transmission - UINT64 GiveupTime; // Time to give up the transmission -}; - -// IP waiting list -struct IP_WAIT -{ - UINT DestIP; // Destination IP address - UINT SrcIP; // Source IP address - UINT64 Expire; // Storage life - void *Data; // Data - UINT Size; // Size -}; - -// IP partial list -struct IP_PART -{ - UINT Offset; // Offset - UINT Size; // Size -}; - -// IP restore list -struct IP_COMBINE -{ - UINT DestIP; // Destination IP address - UINT SrcIP; // Source IP address - USHORT Id; // IP packet ID - UCHAR Ttl; // TTL - UINT64 Expire; // Storage life - void *Data; // Packet data - UINT DataReserved; // Area reserved for data - UINT Size; // Packet size (Total) - LIST *IpParts; // IP partial list - UCHAR Protocol; // Protocol number - bool MacBroadcast; // Broadcast packets at the MAC level - UCHAR *HeadIpHeaderData; // Data of the IP header of the top - UINT HeadIpHeaderDataSize; // Data size of the IP header of the top - bool SrcIsLocalMacAddr; // Source MAC address is on the same machine - UINT MaxL3Size; // Largest L3 size -}; - -#define IP_COMBINE_INITIAL_BUF_SIZE (MAX_IP_DATA_SIZE) // Initial buffer size - -// NAT session table -struct NAT_ENTRY -{ - // TCP | UDP common items - struct VH *v; // Virtual machine - UINT Id; // ID - LOCK *lock; // Lock - UINT Protocol; // Protocol - UINT SrcIp; // Source IP address - UINT SrcPort; // Source port number - UINT DestIp; // Destination IP address - UINT DestPort; // Destination port number - UINT PublicIp; // Public IP address - UINT PublicPort; // Public port number - UINT64 CreatedTime; // Connection time - UINT64 LastCommTime; // Last communication time - SOCK *Sock; // Socket - bool DisconnectNow; // Flag to stop immediately - UINT tag1; - bool ProxyDns; // DNS proxy - UINT DestIpProxy; // Proxy DNS address - - // ICMP NAT item (only for the calling ICMP API mode) - THREAD *IcmpThread; // ICMP query thread - BLOCK *IcmpQueryBlock; // Block that contains the ICMP query - BLOCK *IcmpResponseBlock; // Block that contains ICMP result - bool IcmpTaskFinished; // Flag indicating that the processing of ICMP has been completed - UCHAR *IcmpOriginalCopy; // Copy of the original ICMP packet - UINT IcmpOriginalCopySize; // The size of the copy of original ICMP packet - - // DNS NAT item - THREAD *DnsThread; // DNS query thread - bool DnsGetIpFromHost; // Reverse resolution flag - char *DnsTargetHostName; // Target host name - IP DnsResponseIp; // Response IP address - char *DnsResponseHostName; // Response host name - UINT DnsTransactionId; // DNS transaction ID - bool DnsFinished; // DNS query completion flag - bool DnsOk; // DNS success flag - bool DnsPollingFlag; // DNS polling completion flag - - // UDP item - QUEUE *UdpSendQueue; // UDP send queue - QUEUE *UdpRecvQueue; // UDP receive queue - bool UdpSocketCreated; // Whether an UDP socket was created - - // TCP items - FIFO *SendFifo; // Transmission FIFO - FIFO *RecvFifo; // Receive FIFO - UINT TcpStatus; // TCP state - bool NatTcpCancelFlag; // TCP connection cancel flag - THREAD *NatTcpConnectThread; // TCP socket connection thread - bool TcpMakeConnectionFailed; // Failed to connect with connection thread - bool TcpMakeConnectionSucceed; // Successfully connected by the connection thread - UINT TcpSendMaxSegmentSize; // Maximum transmission segment size - UINT TcpRecvMaxSegmentSize; // Maximum reception segment size - UINT64 LastSynAckSentTime; // Time which the SYN+ACK was sent last - UINT SynAckSentCount; // SYN + ACK transmission times - UINT TcpSendWindowSize; // Transmission window size - UINT TcpSendCWnd; // Transmission congestion window size (/mss) - UINT TcpRecvWindowSize; // Receive window size - UINT TcpSendTimeoutSpan; // Transmission time-out period - UINT64 TcpLastSentTime; // Time for the last transmitted over TCP - UINT64 LastSentKeepAliveTime; // Time which the keep-alive ACK was sent last - FIFO *TcpRecvWindow; // TCP receive window - LIST *TcpRecvList; // TCP reception list - bool SendAckNext; // Send an ACK at the time of the next transmission - UINT LastSentWindowSize; // My window size that sent the last - UINT64 TcpLastRecvAckTime; // Time that the other party has received the last data in TCP - - UINT64 SendSeqInit; // Initial send sequence number - UINT64 SendSeq; // Send sequence number - UINT64 RecvSeqInit; // Initial receive sequence number - UINT64 RecvSeq; // Receive sequence number - UINT FinSentSeq; // Sequence number with the last FIN - - bool CurrentSendingMission; // Burst transmission ongoing - UINT SendMissionSize; // Transmission size of this time - bool RetransmissionUsedFlag; // Retransmission using record flag - - UINT CurrentRTT; // Current RTT value - UINT64 CalcRTTStartTime; // RTT measurement start time - UINT64 CalcRTTStartValue; // RTT measurement start value - - bool TcpFinished; // Data communication end flag of TCP - bool TcpDisconnected; // TCP Disconnect flag - bool TcpForceReset; // TCP connection force reset flag - UINT64 FinSentTime; // Time which the FIN was sent last - UINT FinSentCount; // Number of FIN transmissions - - UINT64 test_TotalSent; -}; - - -// TCP options -struct TCP_OPTION -{ - UINT MaxSegmentSize; // Maximum segment size - UINT WindowScaling; // Window scaling -}; - -// Virtual host structure -struct VH -{ - REF *ref; // Reference counter - LOCK *lock; // Lock - SESSION *Session; // Session - CANCEL *Cancel; // Cancel object - QUEUE *SendQueue; // Transmission queue - bool Active; // Active flag - volatile bool HaltNat; // NAT halting flag - LIST *ArpTable; // ARP table - LIST *ArpWaitTable; // ARP waiting table - LIST *IpWaitTable; // IP waiting table - LIST *IpCombine; // IP combining table - UINT64 Now; // Current time - UINT64 NextArpTablePolling; // Next time to poll the ARP table - UINT Mtu; // MTU value - UINT IpMss; // Maximum IP data size - UINT TcpMss; // TCP maximum data size - UINT UdpMss; // UDP maximum data size - bool flag1; // Flag 1 - bool flag2; // Flag 2 - USHORT NextId; // ID of the IP packet - UINT CurrentIpQuota; // IP packet memory quota - LIST *NatTable; // NAT table - SOCK_EVENT *SockEvent; // Socket event - THREAD *NatThread; // NAT thread - void *TmpBuf; // Buffer that can be used temporarily - bool NatDoCancelFlag; // Flag of whether to hit the cancel - UCHAR MacAddress[6]; // MAC address - UCHAR Padding[2]; - UINT HostIP; // Host IP - UINT HostMask; // Host subnet mask - UINT NatTcpTimeout; // NAT TCP timeout in seconds - UINT NatUdpTimeout; // NAT UDP timeout in seconds - bool UseNat; // NAT use flag - bool UseDhcp; // DHCP using flag - UINT DhcpIpStart; // Distribution start address - UINT DhcpIpEnd; // Distribution end address - UINT DhcpMask; // Subnet mask - UINT DhcpExpire; // Address distribution expiration date - UINT DhcpGateway; // Gateway address - UINT DhcpDns; // DNS server address 1 - UINT DhcpDns2; // DNS server address 2 - char DhcpDomain[MAX_HOST_NAME_LEN + 1]; // Assigned domain name - LIST *DhcpLeaseList; // DHCP lease list - LIST *DhcpPendingLeaseList; // Pending DHCP lease list - UINT64 LastDhcpPolling; // Time which the DHCP list polled last - bool SaveLog; // Save a log - DHCP_CLASSLESS_ROUTE_TABLE PushRoute; // Pushing routing table - COUNTER *Counter; // Session counter - UINT DhcpId; // DHCP ID - UINT64 LastSendBeacon; // Time which the beacon has been sent last - LOG *Logger; // Logger - NAT *nat; // A reference to the NAT object - bool IcmpRawSocketOk; // ICMP RAW SOCKET is available - bool IcmpApiOk; // ICMP API is available - HUB_OPTION *HubOption; // Pointer to the Virtual HUB options - - NATIVE_NAT *NativeNat; // Native NAT -}; - -// Virtual host option -struct VH_OPTION -{ - char HubName[MAX_HUBNAME_LEN + 1]; // Target Virtual HUB name - UCHAR MacAddress[6]; // MAC address - UCHAR Padding[2]; - IP Ip; // IP address - IP Mask; // Subnet mask - bool UseNat; // Use flag of NAT function - UINT Mtu; // MTU value - UINT NatTcpTimeout; // NAT TCP timeout in seconds - UINT NatUdpTimeout; // NAT UDP timeout in seconds - bool UseDhcp; // Using flag of DHCP function - IP DhcpLeaseIPStart; // Start of IP address range for DHCP distribution - IP DhcpLeaseIPEnd; // End of IP address range for DHCP distribution - IP DhcpSubnetMask; // DHCP subnet mask - UINT DhcpExpireTimeSpan; // DHCP expiration date - IP DhcpGatewayAddress; // Assigned gateway address - IP DhcpDnsServerAddress; // Assigned DNS server address 1 - IP DhcpDnsServerAddress2; // Assigned DNS server address 2 - char DhcpDomainName[MAX_HOST_NAME_LEN + 1]; // Assigned domain name - bool SaveLog; // Save a log - bool ApplyDhcpPushRoutes; // Apply flag for DhcpPushRoutes - char DhcpPushRoutes[MAX_DHCP_CLASSLESS_ROUTE_TABLE_STR_SIZE]; // DHCP pushing routes -}; - -// DHCP lease entry -struct DHCP_LEASE -{ - UINT Id; // ID - UINT64 LeasedTime; // Leased time - UINT64 ExpireTime; // Expiration date - UCHAR MacAddress[6]; // MAC address - UCHAR Padding[2]; // Padding - UINT IpAddress; // IP address - UINT Mask; // Subnet mask - char *Hostname; // Host name -}; - -// DNS query -typedef struct NAT_DNS_QUERY -{ - REF *ref; // Reference counter - char Hostname[256]; // Host name - bool Ok; // Result success flag - IP Ip; // Result IP address -} NAT_DNS_QUERY; - -// Parsed DNS query -struct DNS_PARSED_PACKET -{ - UINT TransactionId; - char Hostname[128]; -}; - - -// Virtual LAN card of the virtual host -PACKET_ADAPTER *VirtualGetPacketAdapter(); -bool VirtualPaInit(SESSION *s); -CANCEL *VirtualPaGetCancel(SESSION *s); -UINT VirtualPaGetNextPacket(SESSION *s, void **data); -bool VirtualPaPutPacket(SESSION *s, void *data, UINT size); -void VirtualPaFree(SESSION *s); - -bool VirtualInit(VH *v); -UINT VirtualGetNextPacket(VH *v, void **data); -bool VirtualPutPacket(VH *v, void *data, UINT size); -void Virtual_Free(VH *v); - -VH *NewVirtualHost(CEDAR *cedar, CLIENT_OPTION *option, CLIENT_AUTH *auth, VH_OPTION *vh_option); -VH *NewVirtualHostEx(CEDAR *cedar, CLIENT_OPTION *option, CLIENT_AUTH *auth, VH_OPTION *vh_option, NAT *nat); -void LockVirtual(VH *v); -void UnlockVirtual(VH *v); -void ReleaseVirtual(VH *v); -void CleanupVirtual(VH *v); -void StopVirtualHost(VH *v); -void SetVirtualHostOption(VH *v, VH_OPTION *vo); -void GenMacAddress(UCHAR *mac); -void GetVirtualHostOption(VH *v, VH_OPTION *o); - -void VirtualLayer2(VH *v, PKT *packet); -bool VirtualLayer2Filter(VH *v, PKT *packet); -void VirtualArpReceived(VH *v, PKT *packet); -void VirtualArpResponseRequest(VH *v, PKT *packet); -void VirtualArpResponseReceived(VH *v, PKT *packet); -void VirtualArpSendResponse(VH *v, UCHAR *dest_mac, UINT dest_ip, UINT src_ip); -void VirtualArpSendRequest(VH *v, UINT dest_ip); -void VirtualIpSend(VH *v, UCHAR *dest_mac, void *data, UINT size); -void VirtualLayer2Send(VH *v, UCHAR *dest_mac, UCHAR *src_mac, USHORT protocol, void *data, UINT size); -void VirtualPolling(VH *v); -void InitArpTable(VH *v); -void FreeArpTable(VH *v); -int CompareArpTable(void *p1, void *p2); -ARP_ENTRY *SearchArpTable(VH *v, UINT ip); -void RefreshArpTable(VH *v); -void PollingArpTable(VH *v); -void InsertArpTable(VH *v, UCHAR *mac, UINT ip); -void InitArpWaitTable(VH *v); -void FreeArpWaitTable(VH *v); -int CompareArpWaitTable(void *p1, void *p2); -ARP_WAIT *SearchArpWaitTable(VH *v, UINT ip); -void DeleteArpWaitTable(VH *v, UINT ip); -void SendArp(VH *v, UINT ip); -void InsertArpWaitTable(VH *v, ARP_WAIT *w); -void PollingArpWaitTable(VH *v); -void ArpIpWasKnown(VH *v, UINT ip, UCHAR *mac); -void InitIpWaitTable(VH *v); -void FreeIpWaitTable(VH *v); -void InsertIpWaitTable(VH *v, UINT dest_ip, UINT src_ip, void *data, UINT size); -void SendFragmentedIp(VH *v, UINT dest_ip, UINT src_ip, USHORT id, USHORT total_size, USHORT offset, UCHAR protocol, void *data, UINT size, UCHAR *dest_mac, UCHAR ttl); -void SendIp(VH *v, UINT dest_ip, UINT src_ip, UCHAR protocol, void *data, UINT size); -void SendIpEx(VH *v, UINT dest_ip, UINT src_ip, UCHAR protocol, void *data, UINT size, UCHAR ttl); -void PollingIpWaitTable(VH *v); -void DeleteOldIpWaitTable(VH *v); -void SendWaitingIp(VH *v, UCHAR *mac, UINT dest_ip); -void VirtualIpReceived(VH *v, PKT *packet); -void InitIpCombineList(VH *v); -void FreeIpCombineList(VH *v); -int CompareIpCombine(void *p1, void *p2); -void CombineIp(VH *v, IP_COMBINE *c, UINT offset, void *data, UINT size, bool last_packet, UCHAR *head_ip_header_data, UINT head_ip_header_size); -void IpReceived(VH *v, UINT src_ip, UINT dest_ip, UINT protocol, void *data, UINT size, bool mac_broadcast, UCHAR ttl, UCHAR *ip_header, UINT ip_header_size, bool is_local_mac, UINT max_l3_size); -void FreeIpCombine(VH *v, IP_COMBINE *c); -void PollingIpCombine(VH *v); -IP_COMBINE *InsertIpCombine(VH *v, UINT src_ip, UINT dest_ip, USHORT id, UCHAR protocol, bool mac_broadcast, UCHAR ttl, bool src_is_localmac); -IP_COMBINE *SearchIpCombine(VH *v, UINT src_ip, UINT dest_ip, USHORT id, UCHAR protocol); -void VirtualIcmpReceived(VH *v, UINT src_ip, UINT dst_ip, void *data, UINT size, UCHAR ttl, UCHAR *ip_header, UINT ip_header_size, UINT max_l3_size); -void VirtualIcmpEchoRequestReceived(VH *v, UINT src_ip, UINT dst_ip, void *data, UINT size, UCHAR ttl, void *icmp_data, UINT icmp_size, UCHAR *ip_header, UINT ip_header_size, UINT max_l3_size); -void VirtualIcmpEchoRequestReceivedRaw(VH *v, UINT src_ip, UINT dst_ip, void *data, UINT size, UCHAR ttl, void *icmp_data, UINT icmp_size, UCHAR *ip_header, UINT ip_header_size); -void VirtualIcmpEchoSendResponse(VH *v, UINT src_ip, UINT dst_ip, USHORT id, USHORT seq_no, void *data, UINT size); -void VirtualIcmpSend(VH *v, UINT src_ip, UINT dst_ip, void *data, UINT size); -void VirtualUdpReceived(VH *v, UINT src_ip, UINT dest_ip, void *data, UINT size, bool mac_broadcast, bool is_localmac, UINT max_l3_size); -void SendUdp(VH *v, UINT dest_ip, UINT dest_port, UINT src_ip, UINT src_port, void *data, UINT size); -UINT GetNetworkAddress(UINT addr, UINT mask); -UINT GetBroadcastAddress(UINT addr, UINT mask); -void GetBroadcastAddress4(IP *dst, IP *addr, IP *mask); -bool IsInNetwork(UINT uni_addr, UINT network_addr, UINT mask); -void UdpRecvForMe(VH *v, UINT src_ip, UINT src_port, UINT dest_ip, UINT dest_port, void *data, UINT size); -void UdpRecvLlmnr(VH *v, UINT src_ip, UINT src_port, UINT dest_ip, UINT dest_port, void *data, UINT size); -void UdpRecvForBroadcast(VH *v, UINT src_ip, UINT src_port, UINT dest_ip, UINT dest_port, void *data, UINT size); -void UdpRecvForInternet(VH *v, UINT src_ip, UINT src_port, UINT dest_ip, UINT dest_port, void *data, UINT size, bool dns_proxy); -void UdpRecvForNetBiosBroadcast(VH *v, UINT src_ip, UINT src_port, UINT dest_ip, UINT dest_port, void *data, UINT size, bool dns_proxy, bool unicast); -bool IsNetbiosRegistrationPacket(UCHAR *buf, UINT size); -bool ProcessNetBiosNameQueryPacketForMyself(VH *v, UINT src_ip, UINT src_port, UINT dest_ip, UINT dest_port, void *data, UINT size); -void EncodeNetBiosName(UCHAR *dst, char *src); -char *CharToNetBiosStr(char c); -void InitNat(VH *v); -void FreeNat(VH *v); -int CompareNat(void *p1, void *p2); -NAT_ENTRY *SearchNat(VH *v, NAT_ENTRY *target); -void SetNat(NAT_ENTRY *n, UINT protocol, UINT src_ip, UINT src_port, UINT dest_ip, UINT dest_port, UINT public_ip, UINT public_port); -void DeleteNatTcp(VH *v, NAT_ENTRY *n); -void DeleteNatUdp(VH *v, NAT_ENTRY *n); -void DeleteNatIcmp(VH *v, NAT_ENTRY *n); -NAT_ENTRY *CreateNatUdp(VH *v, UINT src_ip, UINT src_port, UINT dest_ip, UINT dest_port, UINT dns_proxy_ip); -NAT_ENTRY *CreateNatIcmp(VH *v, UINT src_ip, UINT src_port, UINT dest_ip, UINT dest_port, UCHAR *original_copy, UINT original_copy_size); -void NatThread(THREAD *t, void *param); -void NatThreadMain(VH *v); -bool NatTransactUdp(VH *v, NAT_ENTRY *n); -bool NatTransactIcmp(VH *v, NAT_ENTRY *n); -void NatIcmpThreadProc(THREAD *thread, void *param); -void PoolingNat(VH *v); -void PoolingNatUdp(VH *v, NAT_ENTRY *n); -void PollingNatIcmp(VH *v, NAT_ENTRY *n); -void VirtualTcpReceived(VH *v, UINT src_ip, UINT dest_ip, void *data, UINT size, UINT max_l3_size); -void TcpRecvForInternet(VH *v, UINT src_ip, UINT src_port, UINT dest_ip, UINT dest_port, TCP_HEADER *tcp, void *data, UINT size, UINT max_l3_size); -NAT_ENTRY *CreateNatTcp(VH *v, UINT src_ip, UINT src_port, UINT dest_ip, UINT dest_port); -bool NatTransactTcp(VH *v, NAT_ENTRY *n); -void CreateNatTcpConnectThread(VH *v, NAT_ENTRY *n); -void NatTcpConnectThread(THREAD *t, void *p); -void PollingNatTcp(VH *v, NAT_ENTRY *n); -void ParseTcpOption(TCP_OPTION *o, void *data, UINT size); -void SendTcp(VH *v, UINT src_ip, UINT src_port, UINT dest_ip, UINT dest_port, UINT seq, UINT ack, UINT flag, UINT window_size, UINT mss, void *data, UINT size); -void DnsProxy(VH *v, UINT src_ip, UINT src_port, UINT dest_ip, UINT dest_port, void *data, UINT size); -bool ParseDnsPacket(VH *v, UINT src_ip, UINT src_port, UINT dest_ip, UINT dest_port, void *data, UINT size); -bool ParseDnsPacketEx(VH *v, UINT src_ip, UINT src_port, UINT dest_ip, UINT dest_port, void *data, UINT size, DNS_PARSED_PACKET *parsed_result); -void SetDnsProxyVgsHostname(char *hostname); -bool NatTransactDns(VH *v, NAT_ENTRY *n); -void NatDnsThread(THREAD *t, void *param); -bool NatGetIP(IP *ip, char *hostname); -void NatGetIPThread(THREAD *t, void *param); -NAT_ENTRY *CreateNatDns(VH *v, UINT src_ip, UINT src_port, UINT dest_ip, UINT dest_port, - UINT transaction_id, bool dns_get_ip_from_host, char *dns_target_host_name); -void PollingNatDns(VH *v, NAT_ENTRY *n); -void SendNatDnsResponse(VH *v, NAT_ENTRY *n); -void BuildDnsQueryPacket(BUF *b, char *hostname, bool ptr); -void BuildDnsResponsePacketA(BUF *b, IP *ip); -void BuildDnsResponsePacketPtr(BUF *b, char *hostname); -bool ArpaToIP(IP *ip, char *str); -BUF *BuildDnsHostName(char *hostname); -bool CanCreateNewNatEntry(VH *v); -void VirtualDhcpServer(VH *v, PKT *p); -void InitDhcpServer(VH *v); -void FreeDhcpServer(VH *v); -void PollingDhcpServer(VH *v); -int CompareDhcpLeaseList(void *p1, void *p2); -DHCP_LEASE *NewDhcpLease(UINT expire, UCHAR *mac_address, UINT ip, UINT mask, char *hostname); -void FreeDhcpLease(DHCP_LEASE *d); -DHCP_LEASE *SearchDhcpLeaseByMac(VH *v, UCHAR *mac); -DHCP_LEASE *SearchDhcpPendingLeaseByMac(VH *v, UCHAR *mac); -DHCP_LEASE *SearchDhcpLeaseByIp(VH *v, UINT ip); -DHCP_LEASE *SearchDhcpPendingLeaseByIp(VH *v, UINT ip); -UINT ServeDhcpDiscover(VH *v, UCHAR *mac, UINT request_ip); -UINT ServeDhcpDiscoverEx(VH *v, UCHAR *mac, UINT request_ip, bool is_static_ip); -UINT GetFreeDhcpIpAddress(VH *v); -UINT GetFreeDhcpIpAddressByRandom(VH *v, UCHAR *mac); -UINT ServeDhcpRequest(VH *v, UCHAR *mac, UINT request_ip); -UINT ServeDhcpRequestEx(VH *v, UCHAR *mac, UINT request_ip, bool is_static_ip); -void VirtualDhcpSend(VH *v, UINT tran_id, UINT dest_ip, UINT dest_port, - UINT new_ip, UCHAR *client_mac, BUF *b, UINT hw_type, UINT hw_addr_size); -void VLog(VH *v, char *str); -void SendBeacon(VH *v); -void PollingBeacon(VH *v); -HUB_OPTION *NatGetHubOption(VH *v); -UINT GetNumNatEntriesPerIp(VH *v, UINT ip, UINT protocol, bool tcp_syn_sent); -void NatSetHubOption(VH *v, HUB_OPTION *o); -NAT_ENTRY *GetOldestNatEntryOfIp(VH *v, UINT ip, UINT protocol); -void DisconnectNatEntryNow(VH *v, NAT_ENTRY *e); - -NATIVE_NAT *NewNativeNat(VH *v); -void FreeNativeNat(NATIVE_NAT *t); -void NativeNatThread(THREAD *thread, void *param); -NATIVE_STACK *NnGetNextInterface(NATIVE_NAT *t); - -bool NnTestConnectivity(NATIVE_STACK *a, TUBE *halt_tube); -void NnMainLoop(NATIVE_NAT *t, NATIVE_STACK *a); - -BUF *NnBuildDnsQueryPacket(char *hostname, USHORT tran_id); -BUF *NnBuildUdpPacket(BUF *payload, UINT src_ip, USHORT src_port, UINT dst_ip, USHORT dst_port); -BUF *NnBuildTcpPacket(BUF *payload, UINT src_ip, USHORT src_port, UINT dst_ip, USHORT dst_port, UINT seq, UINT ack, UINT flag, UINT window_size, UINT mss); -BUF *NnBuildIpPacket(BUF *payload, UINT src_ip, UINT dst_ip, UCHAR protocol, UCHAR ttl); -UINT NnGenSrcPort(bool raw_ip_mode); -bool NnParseDnsResponsePacket(UCHAR *data, UINT size, IP *ret_ip); -BUF *NnReadDnsRecord(BUF *buf, bool answer, USHORT *ret_type, USHORT *ret_class); -bool NnReadDnsLabel(BUF *buf); -void NnClearQueue(NATIVE_NAT *t); - -int CmpNativeNatTableForSend(void *p1, void *p2); -int CmpNativeNatTableForRecv(void *p1, void *p2); -UINT GetHashNativeNatTableForSend(void *p); -UINT GetHashNativeNatTableForRecv(void *p); -void NnSetNat(NATIVE_NAT_ENTRY *e, UINT protocol, UINT src_ip, UINT src_port, UINT dest_ip, UINT dest_port, UINT pub_ip, UINT pub_port); - -bool NnIsActive(VH *v); -bool NnIsActiveEx(VH *v, bool *is_ipraw_mode); -void NnUdpRecvForInternet(VH *v, UINT src_ip, UINT src_port, UINT dest_ip, UINT dest_port, void *data, UINT size, UINT max_l3_size); -void NnTcpRecvForInternet(VH *v, UINT src_ip, UINT src_port, UINT dest_ip, UINT dest_port, TCP_HEADER *old_tcp, void *data, UINT size, UINT max_l3_size); -void NnIcmpEchoRecvForInternet(VH *v, UINT src_ip, UINT dest_ip, void *data, UINT size, UCHAR ttl, void *icmp_data, UINT icmp_size, UCHAR *ip_header, UINT ip_header_size, UINT max_l3_size); -UINT NnMapNewPublicPort(NATIVE_NAT *t, UINT protocol, UINT dest_ip, UINT dest_port, UINT public_ip); -void NnIpSendForInternet(NATIVE_NAT *t, UCHAR ip_protocol, UCHAR ttl, UINT src_ip, UINT dest_ip, void *data, UINT size, UINT max_l3_size); -void NnIpSendFragmentedForInternet(NATIVE_NAT *t, UCHAR ip_protocol, UINT src_ip, UINT dest_ip, USHORT id, USHORT total_size, - USHORT offset, void *data, UINT size, UCHAR ttl); -void NnPoll(NATIVE_NAT *t); -void NnLayer2(NATIVE_NAT *t, PKT *packet); -void NnFragmentedIpReceived(NATIVE_NAT *t, PKT *packet); -void NnIpReceived(NATIVE_NAT *t, UINT src_ip, UINT dest_ip, UINT protocol, void *data, UINT size, - UCHAR ttl, UCHAR *ip_header, UINT ip_header_size, UINT max_l3_size); -void NnUdpReceived(NATIVE_NAT *t, UINT src_ip, UINT dest_ip, void *data, UINT size, UCHAR ttl, UINT max_l3_size); -void NnTcpReceived(NATIVE_NAT *t, UINT src_ip, UINT dest_ip, void *data, UINT size, UCHAR ttl, UINT max_l3_size); -void NnIcmpReceived(NATIVE_NAT *t, UINT src_ip, UINT dest_ip, void *data, UINT size, UCHAR ttl, UINT max_l3_size); - -void NnCombineIp(NATIVE_NAT *t, IP_COMBINE *c, UINT offset, void *data, UINT size, bool last_packet, UCHAR *head_ip_header_data, UINT head_ip_header_size); -void NnFreeIpCombine(NATIVE_NAT *t, IP_COMBINE *c); -IP_COMBINE *NnSearchIpCombine(NATIVE_NAT *t, UINT src_ip, UINT dest_ip, USHORT id, UCHAR protocol); -IP_COMBINE *NnInsertIpCombine(NATIVE_NAT *t, UINT src_ip, UINT dest_ip, USHORT id, UCHAR protocol, bool mac_broadcast, UCHAR ttl, bool src_is_localmac); -void NnInitIpCombineList(NATIVE_NAT *t); -void NnFreeIpCombineList(NATIVE_NAT *t); -void NnPollingIpCombine(NATIVE_NAT *t); -void NnDeleteOldSessions(NATIVE_NAT *t); -void NnDeleteSession(NATIVE_NAT *t, NATIVE_NAT_ENTRY *e); - -NATIVE_NAT_ENTRY *NnGetOldestNatEntryOfIp(NATIVE_NAT *t, UINT ip, UINT protocol); -void NnDeleteOldestNatSession(NATIVE_NAT *t, UINT ip, UINT protocol); -UINT NnGetNumNatEntriesPerIp(NATIVE_NAT *t, UINT src_ip, UINT protocol); -void NnDeleteOldestNatSessionIfNecessary(NATIVE_NAT *t, UINT ip, UINT protocol); - -void NnSetSecureNatTargetHostname(char *name); - -#endif // VIRTUAL_H +// SoftEther VPN Source Code - Developer Edition Master Branch +// Cedar Communication Module + + +// Virtual.h +// Header of Virtual.c + +#ifndef VIRTUAL_H +#define VIRTUAL_H + + +#define NN_RAW_IP_PORT_START 61001 +#define NN_RAW_IP_PORT_END 65535 + +#define VIRTUAL_TCP_SEND_TIMEOUT (21 * 1000) + +#define NN_NEXT_WAIT_TIME_FOR_DEVICE_ENUM (30 * 1000) +#define NN_NEXT_WAIT_TIME_MAX_FAIL_COUNT 30 + +#define NN_HOSTNAME_FORMAT "securenat-%s" +#define NN_HOSTNAME_STARTWITH "securenat-" +#define NN_HOSTNAME_STARTWITH2 "securenat_" +#define NN_CHECK_CONNECTIVITY_TIMEOUT (5 * 1000) +#define NN_CHECK_CONNECTIVITY_INTERVAL (1 * 1000) + +#define NN_POLL_CONNECTIVITY_TIMEOUT (4 * 60 * 1000 + 10) +#define NN_POLL_CONNECTIVITY_INTERVAL (1 * 60 * 1000) + +#define NN_MAX_QUEUE_LENGTH 10000 +#define NN_NO_NATIVE_NAT_FILENAME L"@no_native_nat_niclist.txt" + +#define NN_TIMEOUT_FOR_UNESTBALISHED_TCP (10 * 1000) // Time-out period of a TCP connection incomplete session + +// Destination host name of the connectivity test for the Internet +// (Access the www.yahoo.com. Access the www.baidu.com from China. I am sorry.) +#define NN_CHECK_HOSTNAME (IsEmptyStr(secure_nat_target_hostname) ? (IsUseAlternativeHostname() ? "www.baidu.com" : "www.yahoo.com") : secure_nat_target_hostname) + + +// Native NAT entry +struct NATIVE_NAT_ENTRY +{ + UINT Id; // ID + UINT Status; // Status + UINT Protocol; // Protocol + UINT SrcIp; // Source IP address + UINT SrcPort; // Source port number + UINT DestIp; // Destination IP address + UINT DestPort; // Destination port number + UINT PublicIp; // Public IP address + UINT PublicPort; // Public port number + UINT64 CreatedTime; // Connection time + UINT64 LastCommTime; // Last communication time + UINT64 TotalSent; // Total number of bytes sent + UINT64 TotalRecv; // Total number of bytes received + UINT LastSeq; // Last sequence number + UINT LastAck; // Last acknowledgment number + UINT HashCodeForSend; // Cached hash code (transmit direction) + UINT HashCodeForRecv; // Cached hash code (receive direction) +}; + +// Native NAT +struct NATIVE_NAT +{ + struct VH *v; // Virtual machine + bool Active; // Whether currently available + THREAD *Thread; // Main thread + bool Halt; // Halting flag + TUBE *HaltTube; // Tube to be disconnected in order to stop + TUBE *HaltTube2; // Tube 2 to be disconnected in order to stop + TUBE *HaltTube3; // Tube 3 to be disconnected in order to stop + LOCK *Lock; // Lock + EVENT *HaltEvent; // Halting event + UINT LastInterfaceIndex; // Index number of the interface that is used for attempting last + UINT LastInterfaceDeviceHash; // Hash value of the device list at the time of the last attempted + UINT NextWaitTimeForRetry; // Time for waiting next time for the device list enumeration + UINT FailedCount; // The number of failed searching for the interface + UINT LastHostAddressHash; // Hash of the last host IP address + DHCP_OPTION_LIST CurrentDhcpOptions; // Current DHCP options + QUEUE *SendQueue; // Transmission queue + QUEUE *RecvQueue; // Reception queue + CANCEL *Cancel; // Cancel object (Hit if there is a received packet) + LOCK *CancelLock; // Lock of the cancel object + HASH_LIST *NatTableForSend; // Native NAT table (for transmission) + HASH_LIST *NatTableForRecv; // Native NAT table (for reception) + UINT PublicIP; // Public IP + USHORT NextId; // Next IP packet ID + bool SendStateChanged; // Transmission state changed + LIST *IpCombine; // IP combining list + UINT CurrentIpQuota; // Current IP combining quota + UCHAR CurrentMacAddress[6]; // Current MAC address + bool IsRawIpMode; // Is RAW_IP mode +}; + +// ARP entry +struct ARP_ENTRY +{ + UINT IpAddress; // IP address + UCHAR MacAddress[6]; // MAC address + UCHAR Padding[2]; + UINT64 Created; // Creation date and time + UINT64 Expire; // Expiration date +}; + +// ARP waiting list +struct ARP_WAIT +{ + UINT IpAddress; // IP address trying to solve + UINT NextTimeoutTimeValue; // Next time before timing out + UINT64 TimeoutTime; // Current Time-out of transmission + UINT64 GiveupTime; // Time to give up the transmission +}; + +// IP waiting list +struct IP_WAIT +{ + UINT DestIP; // Destination IP address + UINT SrcIP; // Source IP address + UINT64 Expire; // Storage life + void *Data; // Data + UINT Size; // Size +}; + +// IP partial list +struct IP_PART +{ + UINT Offset; // Offset + UINT Size; // Size +}; + +// IP restore list +struct IP_COMBINE +{ + UINT DestIP; // Destination IP address + UINT SrcIP; // Source IP address + USHORT Id; // IP packet ID + UCHAR Ttl; // TTL + UINT64 Expire; // Storage life + void *Data; // Packet data + UINT DataReserved; // Area reserved for data + UINT Size; // Packet size (Total) + LIST *IpParts; // IP partial list + UCHAR Protocol; // Protocol number + bool MacBroadcast; // Broadcast packets at the MAC level + UCHAR *HeadIpHeaderData; // Data of the IP header of the top + UINT HeadIpHeaderDataSize; // Data size of the IP header of the top + bool SrcIsLocalMacAddr; // Source MAC address is on the same machine + UINT MaxL3Size; // Largest L3 size +}; + +#define IP_COMBINE_INITIAL_BUF_SIZE (MAX_IP_DATA_SIZE) // Initial buffer size + +// NAT session table +struct NAT_ENTRY +{ + // TCP | UDP common items + struct VH *v; // Virtual machine + UINT Id; // ID + LOCK *lock; // Lock + UINT Protocol; // Protocol + UINT SrcIp; // Source IP address + UINT SrcPort; // Source port number + UINT DestIp; // Destination IP address + UINT DestPort; // Destination port number + UINT PublicIp; // Public IP address + UINT PublicPort; // Public port number + UINT64 CreatedTime; // Connection time + UINT64 LastCommTime; // Last communication time + SOCK *Sock; // Socket + bool DisconnectNow; // Flag to stop immediately + UINT tag1; + bool ProxyDns; // DNS proxy + UINT DestIpProxy; // Proxy DNS address + + // ICMP NAT item (only for the calling ICMP API mode) + THREAD *IcmpThread; // ICMP query thread + BLOCK *IcmpQueryBlock; // Block that contains the ICMP query + BLOCK *IcmpResponseBlock; // Block that contains ICMP result + bool IcmpTaskFinished; // Flag indicating that the processing of ICMP has been completed + UCHAR *IcmpOriginalCopy; // Copy of the original ICMP packet + UINT IcmpOriginalCopySize; // The size of the copy of original ICMP packet + + // DNS NAT item + THREAD *DnsThread; // DNS query thread + bool DnsGetIpFromHost; // Reverse resolution flag + char *DnsTargetHostName; // Target host name + IP DnsResponseIp; // Response IP address + char *DnsResponseHostName; // Response host name + UINT DnsTransactionId; // DNS transaction ID + bool DnsFinished; // DNS query completion flag + bool DnsOk; // DNS success flag + bool DnsPollingFlag; // DNS polling completion flag + + // UDP item + QUEUE *UdpSendQueue; // UDP send queue + QUEUE *UdpRecvQueue; // UDP receive queue + bool UdpSocketCreated; // Whether an UDP socket was created + + // TCP items + FIFO *SendFifo; // Transmission FIFO + FIFO *RecvFifo; // Receive FIFO + UINT TcpStatus; // TCP state + bool NatTcpCancelFlag; // TCP connection cancel flag + THREAD *NatTcpConnectThread; // TCP socket connection thread + bool TcpMakeConnectionFailed; // Failed to connect with connection thread + bool TcpMakeConnectionSucceed; // Successfully connected by the connection thread + UINT TcpSendMaxSegmentSize; // Maximum transmission segment size + UINT TcpRecvMaxSegmentSize; // Maximum reception segment size + UINT64 LastSynAckSentTime; // Time which the SYN+ACK was sent last + UINT SynAckSentCount; // SYN + ACK transmission times + UINT TcpSendWindowSize; // Transmission window size + UINT TcpSendCWnd; // Transmission congestion window size (/mss) + UINT TcpRecvWindowSize; // Receive window size + UINT TcpSendTimeoutSpan; // Transmission time-out period + UINT64 TcpLastSentTime; // Time for the last transmitted over TCP + UINT64 LastSentKeepAliveTime; // Time which the keep-alive ACK was sent last + FIFO *TcpRecvWindow; // TCP receive window + LIST *TcpRecvList; // TCP reception list + bool SendAckNext; // Send an ACK at the time of the next transmission + UINT LastSentWindowSize; // My window size that sent the last + UINT64 TcpLastRecvAckTime; // Time that the other party has received the last data in TCP + + UINT64 SendSeqInit; // Initial send sequence number + UINT64 SendSeq; // Send sequence number + UINT64 RecvSeqInit; // Initial receive sequence number + UINT64 RecvSeq; // Receive sequence number + UINT FinSentSeq; // Sequence number with the last FIN + + bool CurrentSendingMission; // Burst transmission ongoing + UINT SendMissionSize; // Transmission size of this time + bool RetransmissionUsedFlag; // Retransmission using record flag + + UINT CurrentRTT; // Current RTT value + UINT64 CalcRTTStartTime; // RTT measurement start time + UINT64 CalcRTTStartValue; // RTT measurement start value + + bool TcpFinished; // Data communication end flag of TCP + bool TcpDisconnected; // TCP Disconnect flag + bool TcpForceReset; // TCP connection force reset flag + UINT64 FinSentTime; // Time which the FIN was sent last + UINT FinSentCount; // Number of FIN transmissions + + UINT64 test_TotalSent; +}; + + +// TCP options +struct TCP_OPTION +{ + UINT MaxSegmentSize; // Maximum segment size + UINT WindowScaling; // Window scaling +}; + +// Virtual host structure +struct VH +{ + REF *ref; // Reference counter + LOCK *lock; // Lock + SESSION *Session; // Session + CANCEL *Cancel; // Cancel object + QUEUE *SendQueue; // Transmission queue + bool Active; // Active flag + volatile bool HaltNat; // NAT halting flag + LIST *ArpTable; // ARP table + LIST *ArpWaitTable; // ARP waiting table + LIST *IpWaitTable; // IP waiting table + LIST *IpCombine; // IP combining table + UINT64 Now; // Current time + UINT64 NextArpTablePolling; // Next time to poll the ARP table + UINT Mtu; // MTU value + UINT IpMss; // Maximum IP data size + UINT TcpMss; // TCP maximum data size + UINT UdpMss; // UDP maximum data size + bool flag1; // Flag 1 + bool flag2; // Flag 2 + USHORT NextId; // ID of the IP packet + UINT CurrentIpQuota; // IP packet memory quota + LIST *NatTable; // NAT table + SOCK_EVENT *SockEvent; // Socket event + THREAD *NatThread; // NAT thread + void *TmpBuf; // Buffer that can be used temporarily + bool NatDoCancelFlag; // Flag of whether to hit the cancel + UCHAR MacAddress[6]; // MAC address + UCHAR Padding[2]; + UINT HostIP; // Host IP + UINT HostMask; // Host subnet mask + UINT NatTcpTimeout; // NAT TCP timeout in seconds + UINT NatUdpTimeout; // NAT UDP timeout in seconds + bool UseNat; // NAT use flag + bool UseDhcp; // DHCP using flag + UINT DhcpIpStart; // Distribution start address + UINT DhcpIpEnd; // Distribution end address + UINT DhcpMask; // Subnet mask + UINT DhcpExpire; // Address distribution expiration date + UINT DhcpGateway; // Gateway address + UINT DhcpDns; // DNS server address 1 + UINT DhcpDns2; // DNS server address 2 + char DhcpDomain[MAX_HOST_NAME_LEN + 1]; // Assigned domain name + LIST *DhcpLeaseList; // DHCP lease list + LIST *DhcpPendingLeaseList; // Pending DHCP lease list + UINT64 LastDhcpPolling; // Time which the DHCP list polled last + bool SaveLog; // Save a log + DHCP_CLASSLESS_ROUTE_TABLE PushRoute; // Pushing routing table + COUNTER *Counter; // Session counter + UINT DhcpId; // DHCP ID + UINT64 LastSendBeacon; // Time which the beacon has been sent last + LOG *Logger; // Logger + NAT *nat; // A reference to the NAT object + bool IcmpRawSocketOk; // ICMP RAW SOCKET is available + bool IcmpApiOk; // ICMP API is available + HUB_OPTION *HubOption; // Pointer to the Virtual HUB options + + NATIVE_NAT *NativeNat; // Native NAT +}; + +// Virtual host option +struct VH_OPTION +{ + char HubName[MAX_HUBNAME_LEN + 1]; // Target Virtual HUB name + UCHAR MacAddress[6]; // MAC address + UCHAR Padding[2]; + IP Ip; // IP address + IP Mask; // Subnet mask + bool UseNat; // Use flag of NAT function + UINT Mtu; // MTU value + UINT NatTcpTimeout; // NAT TCP timeout in seconds + UINT NatUdpTimeout; // NAT UDP timeout in seconds + bool UseDhcp; // Using flag of DHCP function + IP DhcpLeaseIPStart; // Start of IP address range for DHCP distribution + IP DhcpLeaseIPEnd; // End of IP address range for DHCP distribution + IP DhcpSubnetMask; // DHCP subnet mask + UINT DhcpExpireTimeSpan; // DHCP expiration date + IP DhcpGatewayAddress; // Assigned gateway address + IP DhcpDnsServerAddress; // Assigned DNS server address 1 + IP DhcpDnsServerAddress2; // Assigned DNS server address 2 + char DhcpDomainName[MAX_HOST_NAME_LEN + 1]; // Assigned domain name + bool SaveLog; // Save a log + bool ApplyDhcpPushRoutes; // Apply flag for DhcpPushRoutes + char DhcpPushRoutes[MAX_DHCP_CLASSLESS_ROUTE_TABLE_STR_SIZE]; // DHCP pushing routes +}; + +// DHCP lease entry +struct DHCP_LEASE +{ + UINT Id; // ID + UINT64 LeasedTime; // Leased time + UINT64 ExpireTime; // Expiration date + UCHAR MacAddress[6]; // MAC address + UCHAR Padding[2]; // Padding + UINT IpAddress; // IP address + UINT Mask; // Subnet mask + char *Hostname; // Host name +}; + +// DNS query +typedef struct NAT_DNS_QUERY +{ + REF *ref; // Reference counter + char Hostname[256]; // Host name + bool Ok; // Result success flag + IP Ip; // Result IP address +} NAT_DNS_QUERY; + +// Parsed DNS query +struct DNS_PARSED_PACKET +{ + UINT TransactionId; + char Hostname[128]; +}; + + +// Virtual LAN card of the virtual host +PACKET_ADAPTER *VirtualGetPacketAdapter(); +bool VirtualPaInit(SESSION *s); +CANCEL *VirtualPaGetCancel(SESSION *s); +UINT VirtualPaGetNextPacket(SESSION *s, void **data); +bool VirtualPaPutPacket(SESSION *s, void *data, UINT size); +void VirtualPaFree(SESSION *s); + +bool VirtualInit(VH *v); +UINT VirtualGetNextPacket(VH *v, void **data); +bool VirtualPutPacket(VH *v, void *data, UINT size); +void Virtual_Free(VH *v); + +VH *NewVirtualHost(CEDAR *cedar, CLIENT_OPTION *option, CLIENT_AUTH *auth, VH_OPTION *vh_option); +VH *NewVirtualHostEx(CEDAR *cedar, CLIENT_OPTION *option, CLIENT_AUTH *auth, VH_OPTION *vh_option, NAT *nat); +void LockVirtual(VH *v); +void UnlockVirtual(VH *v); +void ReleaseVirtual(VH *v); +void CleanupVirtual(VH *v); +void StopVirtualHost(VH *v); +void SetVirtualHostOption(VH *v, VH_OPTION *vo); +void GenMacAddress(UCHAR *mac); +void GetVirtualHostOption(VH *v, VH_OPTION *o); + +void VirtualLayer2(VH *v, PKT *packet); +bool VirtualLayer2Filter(VH *v, PKT *packet); +void VirtualArpReceived(VH *v, PKT *packet); +void VirtualArpResponseRequest(VH *v, PKT *packet); +void VirtualArpResponseReceived(VH *v, PKT *packet); +void VirtualArpSendResponse(VH *v, UCHAR *dest_mac, UINT dest_ip, UINT src_ip); +void VirtualArpSendRequest(VH *v, UINT dest_ip); +void VirtualIpSend(VH *v, UCHAR *dest_mac, void *data, UINT size); +void VirtualLayer2Send(VH *v, UCHAR *dest_mac, UCHAR *src_mac, USHORT protocol, void *data, UINT size); +void VirtualPolling(VH *v); +void InitArpTable(VH *v); +void FreeArpTable(VH *v); +int CompareArpTable(void *p1, void *p2); +ARP_ENTRY *SearchArpTable(VH *v, UINT ip); +void RefreshArpTable(VH *v); +void PollingArpTable(VH *v); +void InsertArpTable(VH *v, UCHAR *mac, UINT ip); +void InitArpWaitTable(VH *v); +void FreeArpWaitTable(VH *v); +int CompareArpWaitTable(void *p1, void *p2); +ARP_WAIT *SearchArpWaitTable(VH *v, UINT ip); +void DeleteArpWaitTable(VH *v, UINT ip); +void SendArp(VH *v, UINT ip); +void InsertArpWaitTable(VH *v, ARP_WAIT *w); +void PollingArpWaitTable(VH *v); +void ArpIpWasKnown(VH *v, UINT ip, UCHAR *mac); +void InitIpWaitTable(VH *v); +void FreeIpWaitTable(VH *v); +void InsertIpWaitTable(VH *v, UINT dest_ip, UINT src_ip, void *data, UINT size); +void SendFragmentedIp(VH *v, UINT dest_ip, UINT src_ip, USHORT id, USHORT total_size, USHORT offset, UCHAR protocol, void *data, UINT size, UCHAR *dest_mac, UCHAR ttl); +void SendIp(VH *v, UINT dest_ip, UINT src_ip, UCHAR protocol, void *data, UINT size); +void SendIpEx(VH *v, UINT dest_ip, UINT src_ip, UCHAR protocol, void *data, UINT size, UCHAR ttl); +void PollingIpWaitTable(VH *v); +void DeleteOldIpWaitTable(VH *v); +void SendWaitingIp(VH *v, UCHAR *mac, UINT dest_ip); +void VirtualIpReceived(VH *v, PKT *packet); +void InitIpCombineList(VH *v); +void FreeIpCombineList(VH *v); +int CompareIpCombine(void *p1, void *p2); +void CombineIp(VH *v, IP_COMBINE *c, UINT offset, void *data, UINT size, bool last_packet, UCHAR *head_ip_header_data, UINT head_ip_header_size); +void IpReceived(VH *v, UINT src_ip, UINT dest_ip, UINT protocol, void *data, UINT size, bool mac_broadcast, UCHAR ttl, UCHAR *ip_header, UINT ip_header_size, bool is_local_mac, UINT max_l3_size); +void FreeIpCombine(VH *v, IP_COMBINE *c); +void PollingIpCombine(VH *v); +IP_COMBINE *InsertIpCombine(VH *v, UINT src_ip, UINT dest_ip, USHORT id, UCHAR protocol, bool mac_broadcast, UCHAR ttl, bool src_is_localmac); +IP_COMBINE *SearchIpCombine(VH *v, UINT src_ip, UINT dest_ip, USHORT id, UCHAR protocol); +void VirtualIcmpReceived(VH *v, UINT src_ip, UINT dst_ip, void *data, UINT size, UCHAR ttl, UCHAR *ip_header, UINT ip_header_size, UINT max_l3_size); +void VirtualIcmpEchoRequestReceived(VH *v, UINT src_ip, UINT dst_ip, void *data, UINT size, UCHAR ttl, void *icmp_data, UINT icmp_size, UCHAR *ip_header, UINT ip_header_size, UINT max_l3_size); +void VirtualIcmpEchoRequestReceivedRaw(VH *v, UINT src_ip, UINT dst_ip, void *data, UINT size, UCHAR ttl, void *icmp_data, UINT icmp_size, UCHAR *ip_header, UINT ip_header_size); +void VirtualIcmpEchoSendResponse(VH *v, UINT src_ip, UINT dst_ip, USHORT id, USHORT seq_no, void *data, UINT size); +void VirtualIcmpSend(VH *v, UINT src_ip, UINT dst_ip, void *data, UINT size); +void VirtualUdpReceived(VH *v, UINT src_ip, UINT dest_ip, void *data, UINT size, bool mac_broadcast, bool is_localmac, UINT max_l3_size); +void SendUdp(VH *v, UINT dest_ip, UINT dest_port, UINT src_ip, UINT src_port, void *data, UINT size); +UINT GetNetworkAddress(UINT addr, UINT mask); +UINT GetBroadcastAddress(UINT addr, UINT mask); +void GetBroadcastAddress4(IP *dst, IP *addr, IP *mask); +bool IsInNetwork(UINT uni_addr, UINT network_addr, UINT mask); +void UdpRecvForMe(VH *v, UINT src_ip, UINT src_port, UINT dest_ip, UINT dest_port, void *data, UINT size); +void UdpRecvLlmnr(VH *v, UINT src_ip, UINT src_port, UINT dest_ip, UINT dest_port, void *data, UINT size); +void UdpRecvForBroadcast(VH *v, UINT src_ip, UINT src_port, UINT dest_ip, UINT dest_port, void *data, UINT size); +void UdpRecvForInternet(VH *v, UINT src_ip, UINT src_port, UINT dest_ip, UINT dest_port, void *data, UINT size, bool dns_proxy); +void UdpRecvForNetBiosBroadcast(VH *v, UINT src_ip, UINT src_port, UINT dest_ip, UINT dest_port, void *data, UINT size, bool dns_proxy, bool unicast); +bool IsNetbiosRegistrationPacket(UCHAR *buf, UINT size); +bool ProcessNetBiosNameQueryPacketForMyself(VH *v, UINT src_ip, UINT src_port, UINT dest_ip, UINT dest_port, void *data, UINT size); +void EncodeNetBiosName(UCHAR *dst, char *src); +char *CharToNetBiosStr(char c); +void InitNat(VH *v); +void FreeNat(VH *v); +int CompareNat(void *p1, void *p2); +NAT_ENTRY *SearchNat(VH *v, NAT_ENTRY *target); +void SetNat(NAT_ENTRY *n, UINT protocol, UINT src_ip, UINT src_port, UINT dest_ip, UINT dest_port, UINT public_ip, UINT public_port); +void DeleteNatTcp(VH *v, NAT_ENTRY *n); +void DeleteNatUdp(VH *v, NAT_ENTRY *n); +void DeleteNatIcmp(VH *v, NAT_ENTRY *n); +NAT_ENTRY *CreateNatUdp(VH *v, UINT src_ip, UINT src_port, UINT dest_ip, UINT dest_port, UINT dns_proxy_ip); +NAT_ENTRY *CreateNatIcmp(VH *v, UINT src_ip, UINT src_port, UINT dest_ip, UINT dest_port, UCHAR *original_copy, UINT original_copy_size); +void NatThread(THREAD *t, void *param); +void NatThreadMain(VH *v); +bool NatTransactUdp(VH *v, NAT_ENTRY *n); +bool NatTransactIcmp(VH *v, NAT_ENTRY *n); +void NatIcmpThreadProc(THREAD *thread, void *param); +void PoolingNat(VH *v); +void PoolingNatUdp(VH *v, NAT_ENTRY *n); +void PollingNatIcmp(VH *v, NAT_ENTRY *n); +void VirtualTcpReceived(VH *v, UINT src_ip, UINT dest_ip, void *data, UINT size, UINT max_l3_size); +void TcpRecvForInternet(VH *v, UINT src_ip, UINT src_port, UINT dest_ip, UINT dest_port, TCP_HEADER *tcp, void *data, UINT size, UINT max_l3_size); +NAT_ENTRY *CreateNatTcp(VH *v, UINT src_ip, UINT src_port, UINT dest_ip, UINT dest_port); +bool NatTransactTcp(VH *v, NAT_ENTRY *n); +void CreateNatTcpConnectThread(VH *v, NAT_ENTRY *n); +void NatTcpConnectThread(THREAD *t, void *p); +void PollingNatTcp(VH *v, NAT_ENTRY *n); +void ParseTcpOption(TCP_OPTION *o, void *data, UINT size); +void SendTcp(VH *v, UINT src_ip, UINT src_port, UINT dest_ip, UINT dest_port, UINT seq, UINT ack, UINT flag, UINT window_size, UINT mss, void *data, UINT size); +void DnsProxy(VH *v, UINT src_ip, UINT src_port, UINT dest_ip, UINT dest_port, void *data, UINT size); +bool ParseDnsPacket(VH *v, UINT src_ip, UINT src_port, UINT dest_ip, UINT dest_port, void *data, UINT size); +bool ParseDnsPacketEx(VH *v, UINT src_ip, UINT src_port, UINT dest_ip, UINT dest_port, void *data, UINT size, DNS_PARSED_PACKET *parsed_result); +void SetDnsProxyVgsHostname(char *hostname); +bool NatTransactDns(VH *v, NAT_ENTRY *n); +void NatDnsThread(THREAD *t, void *param); +bool NatGetIP(IP *ip, char *hostname); +void NatGetIPThread(THREAD *t, void *param); +NAT_ENTRY *CreateNatDns(VH *v, UINT src_ip, UINT src_port, UINT dest_ip, UINT dest_port, + UINT transaction_id, bool dns_get_ip_from_host, char *dns_target_host_name); +void PollingNatDns(VH *v, NAT_ENTRY *n); +void SendNatDnsResponse(VH *v, NAT_ENTRY *n); +void BuildDnsQueryPacket(BUF *b, char *hostname, bool ptr); +void BuildDnsResponsePacketA(BUF *b, IP *ip); +void BuildDnsResponsePacketPtr(BUF *b, char *hostname); +bool ArpaToIP(IP *ip, char *str); +BUF *BuildDnsHostName(char *hostname); +bool CanCreateNewNatEntry(VH *v); +void VirtualDhcpServer(VH *v, PKT *p); +void InitDhcpServer(VH *v); +void FreeDhcpServer(VH *v); +void PollingDhcpServer(VH *v); +int CompareDhcpLeaseList(void *p1, void *p2); +DHCP_LEASE *NewDhcpLease(UINT expire, UCHAR *mac_address, UINT ip, UINT mask, char *hostname); +void FreeDhcpLease(DHCP_LEASE *d); +DHCP_LEASE *SearchDhcpLeaseByMac(VH *v, UCHAR *mac); +DHCP_LEASE *SearchDhcpPendingLeaseByMac(VH *v, UCHAR *mac); +DHCP_LEASE *SearchDhcpLeaseByIp(VH *v, UINT ip); +DHCP_LEASE *SearchDhcpPendingLeaseByIp(VH *v, UINT ip); +UINT ServeDhcpDiscover(VH *v, UCHAR *mac, UINT request_ip); +UINT ServeDhcpDiscoverEx(VH *v, UCHAR *mac, UINT request_ip, bool is_static_ip); +UINT GetFreeDhcpIpAddress(VH *v); +UINT GetFreeDhcpIpAddressByRandom(VH *v, UCHAR *mac); +UINT ServeDhcpRequest(VH *v, UCHAR *mac, UINT request_ip); +UINT ServeDhcpRequestEx(VH *v, UCHAR *mac, UINT request_ip, bool is_static_ip); +void VirtualDhcpSend(VH *v, UINT tran_id, UINT dest_ip, UINT dest_port, + UINT new_ip, UCHAR *client_mac, BUF *b, UINT hw_type, UINT hw_addr_size); +void VLog(VH *v, char *str); +void SendBeacon(VH *v); +void PollingBeacon(VH *v); +HUB_OPTION *NatGetHubOption(VH *v); +UINT GetNumNatEntriesPerIp(VH *v, UINT ip, UINT protocol, bool tcp_syn_sent); +void NatSetHubOption(VH *v, HUB_OPTION *o); +NAT_ENTRY *GetOldestNatEntryOfIp(VH *v, UINT ip, UINT protocol); +void DisconnectNatEntryNow(VH *v, NAT_ENTRY *e); + +NATIVE_NAT *NewNativeNat(VH *v); +void FreeNativeNat(NATIVE_NAT *t); +void NativeNatThread(THREAD *thread, void *param); +NATIVE_STACK *NnGetNextInterface(NATIVE_NAT *t); + +bool NnTestConnectivity(NATIVE_STACK *a, TUBE *halt_tube); +void NnMainLoop(NATIVE_NAT *t, NATIVE_STACK *a); + +BUF *NnBuildDnsQueryPacket(char *hostname, USHORT tran_id); +BUF *NnBuildUdpPacket(BUF *payload, UINT src_ip, USHORT src_port, UINT dst_ip, USHORT dst_port); +BUF *NnBuildTcpPacket(BUF *payload, UINT src_ip, USHORT src_port, UINT dst_ip, USHORT dst_port, UINT seq, UINT ack, UINT flag, UINT window_size, UINT mss); +BUF *NnBuildIpPacket(BUF *payload, UINT src_ip, UINT dst_ip, UCHAR protocol, UCHAR ttl); +UINT NnGenSrcPort(bool raw_ip_mode); +bool NnParseDnsResponsePacket(UCHAR *data, UINT size, IP *ret_ip); +BUF *NnReadDnsRecord(BUF *buf, bool answer, USHORT *ret_type, USHORT *ret_class); +bool NnReadDnsLabel(BUF *buf); +void NnClearQueue(NATIVE_NAT *t); + +int CmpNativeNatTableForSend(void *p1, void *p2); +int CmpNativeNatTableForRecv(void *p1, void *p2); +UINT GetHashNativeNatTableForSend(void *p); +UINT GetHashNativeNatTableForRecv(void *p); +void NnSetNat(NATIVE_NAT_ENTRY *e, UINT protocol, UINT src_ip, UINT src_port, UINT dest_ip, UINT dest_port, UINT pub_ip, UINT pub_port); + +bool NnIsActive(VH *v); +bool NnIsActiveEx(VH *v, bool *is_ipraw_mode); +void NnUdpRecvForInternet(VH *v, UINT src_ip, UINT src_port, UINT dest_ip, UINT dest_port, void *data, UINT size, UINT max_l3_size); +void NnTcpRecvForInternet(VH *v, UINT src_ip, UINT src_port, UINT dest_ip, UINT dest_port, TCP_HEADER *old_tcp, void *data, UINT size, UINT max_l3_size); +void NnIcmpEchoRecvForInternet(VH *v, UINT src_ip, UINT dest_ip, void *data, UINT size, UCHAR ttl, void *icmp_data, UINT icmp_size, UCHAR *ip_header, UINT ip_header_size, UINT max_l3_size); +UINT NnMapNewPublicPort(NATIVE_NAT *t, UINT protocol, UINT dest_ip, UINT dest_port, UINT public_ip); +void NnIpSendForInternet(NATIVE_NAT *t, UCHAR ip_protocol, UCHAR ttl, UINT src_ip, UINT dest_ip, void *data, UINT size, UINT max_l3_size); +void NnIpSendFragmentedForInternet(NATIVE_NAT *t, UCHAR ip_protocol, UINT src_ip, UINT dest_ip, USHORT id, USHORT total_size, + USHORT offset, void *data, UINT size, UCHAR ttl); +void NnPoll(NATIVE_NAT *t); +void NnLayer2(NATIVE_NAT *t, PKT *packet); +void NnFragmentedIpReceived(NATIVE_NAT *t, PKT *packet); +void NnIpReceived(NATIVE_NAT *t, UINT src_ip, UINT dest_ip, UINT protocol, void *data, UINT size, + UCHAR ttl, UCHAR *ip_header, UINT ip_header_size, UINT max_l3_size); +void NnUdpReceived(NATIVE_NAT *t, UINT src_ip, UINT dest_ip, void *data, UINT size, UCHAR ttl, UINT max_l3_size); +void NnTcpReceived(NATIVE_NAT *t, UINT src_ip, UINT dest_ip, void *data, UINT size, UCHAR ttl, UINT max_l3_size); +void NnIcmpReceived(NATIVE_NAT *t, UINT src_ip, UINT dest_ip, void *data, UINT size, UCHAR ttl, UINT max_l3_size); + +void NnCombineIp(NATIVE_NAT *t, IP_COMBINE *c, UINT offset, void *data, UINT size, bool last_packet, UCHAR *head_ip_header_data, UINT head_ip_header_size); +void NnFreeIpCombine(NATIVE_NAT *t, IP_COMBINE *c); +IP_COMBINE *NnSearchIpCombine(NATIVE_NAT *t, UINT src_ip, UINT dest_ip, USHORT id, UCHAR protocol); +IP_COMBINE *NnInsertIpCombine(NATIVE_NAT *t, UINT src_ip, UINT dest_ip, USHORT id, UCHAR protocol, bool mac_broadcast, UCHAR ttl, bool src_is_localmac); +void NnInitIpCombineList(NATIVE_NAT *t); +void NnFreeIpCombineList(NATIVE_NAT *t); +void NnPollingIpCombine(NATIVE_NAT *t); +void NnDeleteOldSessions(NATIVE_NAT *t); +void NnDeleteSession(NATIVE_NAT *t, NATIVE_NAT_ENTRY *e); + +NATIVE_NAT_ENTRY *NnGetOldestNatEntryOfIp(NATIVE_NAT *t, UINT ip, UINT protocol); +void NnDeleteOldestNatSession(NATIVE_NAT *t, UINT ip, UINT protocol); +UINT NnGetNumNatEntriesPerIp(NATIVE_NAT *t, UINT src_ip, UINT protocol); +void NnDeleteOldestNatSessionIfNecessary(NATIVE_NAT *t, UINT ip, UINT protocol); + +void NnSetSecureNatTargetHostname(char *name); + +#endif // VIRTUAL_H diff --git a/src/Cedar/WaterMark.c b/src/Cedar/WaterMark.c index c039bb92..2cf05a8a 100644 --- a/src/Cedar/WaterMark.c +++ b/src/Cedar/WaterMark.c @@ -1,4306 +1,4306 @@ -// SoftEther VPN Source Code - Developer Edition Master Branch -// Cedar Communication Module - - -// WaterMark.c -// SoftEther protocol digital watermark data - -#include "CedarPch.h" - -// Digital watermark image data (JPEG) -BYTE WaterMark[] = -{ - 0x47, 0x49, 0x46, 0x38, 0x39, 0x61, 0xC8, 0x00, 0x33, 0x00, 0xF2, 0x00, 0x00, 0x36, 0x37, 0x34, - 0x79, 0x68, 0x54, 0x80, 0x80, 0x80, 0xAF, 0x7F, 0x5B, 0xB3, 0xA8, 0x9D, 0xD5, 0xD5, 0xD4, 0xFF, - 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x2C, 0x00, 0x00, 0x00, 0x00, 0xC8, 0x00, 0x33, 0x00, 0x00, 0x03, - 0xFE, 0x08, 0x1A, 0xDC, 0x34, 0x0A, 0x04, 0x41, 0x6B, 0x65, 0x31, 0x4F, 0x11, 0x80, 0xF9, 0x60, - 0x28, 0x8E, 0x64, 0x69, 0x9E, 0x68, 0xAA, 0xAE, 0x6C, 0xEB, 0x9A, 0x4B, 0xE3, 0x0C, 0x0C, 0x25, - 0x6F, 0x56, 0xA7, 0xE9, 0xD2, 0xEB, 0xFF, 0xC0, 0xA0, 0x70, 0xC8, 0x8A, 0xDC, 0x2C, 0x9C, 0xC6, - 0x05, 0xC7, 0x31, 0x66, 0x24, 0x04, 0xA2, 0x74, 0x4A, 0xAD, 0x4E, 0x05, 0xB1, 0x0D, 0x61, 0xCB, - 0x25, 0xD4, 0xB8, 0x49, 0x1B, 0xE6, 0x19, 0xB1, 0x9A, 0xCF, 0xE8, 0xF4, 0x07, 0x2B, 0x11, 0x74, - 0x09, 0x85, 0x78, 0xFC, 0x0D, 0x6E, 0x90, 0x9F, 0xEA, 0x02, 0x81, 0x12, 0x35, 0xEF, 0x29, 0x6A, - 0x81, 0x2C, 0x04, 0x0A, 0x6E, 0x5C, 0x72, 0x88, 0x7A, 0x7A, 0x6F, 0x4D, 0x77, 0x19, 0x25, 0x71, - 0x16, 0x71, 0x2F, 0x05, 0x92, 0x06, 0x95, 0x80, 0x22, 0x48, 0x16, 0x7D, 0x98, 0x02, 0x9A, 0x7C, - 0x82, 0x06, 0x16, 0x23, 0x7F, 0x02, 0x05, 0x6B, 0x48, 0x70, 0x23, 0x15, 0x7D, 0x1F, 0x98, 0xA8, - 0x21, 0x7F, 0x87, 0x89, 0xB5, 0x8B, 0x7C, 0x7B, 0x3C, 0x8E, 0x23, 0x9E, 0x9B, 0xAE, 0x2B, 0xAD, - 0x20, 0xA6, 0xAC, 0x9B, 0x14, 0xB1, 0xC3, 0x21, 0x15, 0xB1, 0x81, 0x9E, 0x22, 0x9E, 0xAE, 0xC5, - 0x99, 0x20, 0x96, 0xAF, 0xC6, 0xA0, 0x70, 0xB6, 0xB6, 0x5B, 0x03, 0x1C, 0x16, 0x8E, 0x65, 0x21, - 0xBD, 0x9B, 0xCB, 0x2A, 0x9E, 0xCB, 0xC1, 0xE1, 0xD1, 0xA7, 0xA9, 0x6E, 0xE9, 0xD6, 0x82, 0xCD, - 0xC9, 0xCA, 0xD5, 0xD1, 0xAE, 0xBD, 0xCB, 0x7F, 0xAC, 0xB4, 0xD9, 0x73, 0x34, 0x37, 0x76, 0xDF, - 0x3C, 0xC8, 0x9A, 0x07, 0x42, 0x4E, 0x38, 0x4C, 0xAB, 0x0A, 0xFA, 0x12, 0x17, 0xEA, 0x52, 0x05, - 0x12, 0x0C, 0xDB, 0x35, 0xD3, 0xF3, 0xCE, 0xD9, 0x2C, 0x72, 0x13, 0xB7, 0x40, 0x22, 0xE8, 0xFE, - 0xB0, 0x61, 0xC7, 0x4F, 0xEC, 0x40, 0x7E, 0x94, 0xF6, 0x50, 0x13, 0x36, 0x83, 0xA8, 0x6A, 0x79, - 0xF9, 0x77, 0xE3, 0x1B, 0x28, 0x69, 0x1B, 0x55, 0x09, 0x1B, 0x67, 0x8A, 0x1A, 0xA9, 0x52, 0xC5, - 0x50, 0x71, 0x42, 0x82, 0x31, 0xDA, 0xB4, 0x56, 0x15, 0x9D, 0x71, 0xBC, 0x19, 0xF2, 0x27, 0x49, - 0x3E, 0xEF, 0x3C, 0x4E, 0xDB, 0x92, 0xED, 0x52, 0xBF, 0x01, 0xFE, 0x02, 0x44, 0x95, 0xB1, 0x6B, - 0xA0, 0x32, 0x72, 0x0A, 0x25, 0x72, 0x1C, 0xE5, 0x11, 0x99, 0x3C, 0x5F, 0x33, 0x61, 0x72, 0x75, - 0x93, 0x92, 0x28, 0x42, 0xA3, 0x7D, 0x72, 0x9A, 0x20, 0x68, 0x8A, 0x1C, 0x3A, 0x73, 0x3F, 0xE1, - 0x84, 0x82, 0x55, 0xEA, 0xE4, 0xA5, 0xBB, 0x89, 0xDE, 0x4C, 0x60, 0x30, 0x75, 0x0C, 0x9E, 0x97, - 0xD4, 0x8C, 0xC6, 0x32, 0x3B, 0xB4, 0x64, 0xD6, 0x71, 0x46, 0x45, 0x7E, 0x3C, 0x67, 0xB8, 0x30, - 0x20, 0xB8, 0x29, 0x82, 0x3D, 0x73, 0xE7, 0x93, 0x1E, 0xAA, 0x3F, 0x91, 0xD6, 0x89, 0x60, 0x9A, - 0xC8, 0x69, 0x36, 0xA8, 0x1B, 0xA4, 0xFE, 0x23, 0x03, 0x51, 0xED, 0xC7, 0xC4, 0x87, 0x19, 0xB7, - 0xA3, 0xCC, 0x13, 0x2D, 0x65, 0xD5, 0xB1, 0x22, 0x4A, 0xDE, 0xBA, 0xF6, 0xA1, 0x57, 0x7A, 0x0B, - 0xB3, 0x96, 0x3D, 0x95, 0xAF, 0x2E, 0x4A, 0xBC, 0x2A, 0xB9, 0x25, 0x61, 0x09, 0x10, 0x1C, 0x24, - 0x53, 0x7D, 0xBC, 0xA2, 0x33, 0xE0, 0x15, 0x72, 0x58, 0xC5, 0xAF, 0xAD, 0x8A, 0x84, 0x5C, 0x13, - 0xF1, 0xED, 0x13, 0xE6, 0x68, 0x57, 0x3F, 0x85, 0xB5, 0xF7, 0x58, 0xC3, 0xB2, 0x3A, 0xA7, 0x54, - 0xB9, 0x87, 0x86, 0x98, 0xBD, 0xA3, 0x8D, 0xD7, 0xCE, 0x44, 0xD4, 0xF1, 0x74, 0xDA, 0x44, 0x85, - 0x06, 0x25, 0x7C, 0x54, 0xEC, 0x57, 0xE8, 0x26, 0x18, 0xFE, 0x2A, 0xBA, 0xFE, 0xB9, 0xFE, 0xE6, - 0xCD, 0x88, 0x00, 0x57, 0x0B, 0x54, 0xFE, 0x20, 0x31, 0x1A, 0x0F, 0x01, 0x14, 0x94, 0xD0, 0x61, - 0x69, 0x95, 0x14, 0x0F, 0x3B, 0xAE, 0x5C, 0x37, 0x16, 0x56, 0xCF, 0xBD, 0x14, 0xA1, 0x61, 0x12, - 0x0E, 0xA6, 0x14, 0x76, 0x88, 0xBD, 0x44, 0xA1, 0x3C, 0xF6, 0x04, 0x76, 0x90, 0x78, 0xE4, 0x81, - 0x26, 0x80, 0x70, 0x0F, 0x10, 0xA7, 0xC4, 0x61, 0x95, 0x2D, 0xC6, 0x5C, 0x45, 0xCE, 0x89, 0x28, - 0x1B, 0x34, 0x1C, 0xC5, 0xE8, 0xD1, 0x64, 0xAF, 0xAC, 0xE2, 0x1C, 0x0A, 0xE2, 0xEC, 0xE7, 0x62, - 0x4C, 0xE4, 0xB4, 0x05, 0x51, 0x80, 0x93, 0x04, 0xE7, 0x8F, 0x70, 0x01, 0x6C, 0xA1, 0x62, 0x0D, - 0xFE, 0x75, 0xF8, 0xC1, 0x76, 0x3D, 0x55, 0x54, 0x5D, 0x27, 0xD1, 0xE0, 0x23, 0x13, 0x64, 0x3B, - 0x6E, 0x67, 0xCD, 0x8E, 0x28, 0x20, 0x51, 0x5A, 0x50, 0xF2, 0x45, 0x89, 0xDF, 0x2B, 0xB5, 0x78, - 0x26, 0x07, 0x17, 0x04, 0x8A, 0xE6, 0x46, 0x5F, 0x2C, 0x1D, 0x84, 0xDC, 0x24, 0xBC, 0x60, 0xD6, - 0x1D, 0x78, 0x1F, 0x25, 0xA4, 0xE5, 0x7F, 0x75, 0x5E, 0x66, 0x18, 0x97, 0x73, 0xF0, 0x01, 0xA7, - 0x84, 0x27, 0x88, 0x58, 0xA1, 0x09, 0xDE, 0xC5, 0x05, 0x09, 0x3F, 0x88, 0xA0, 0x79, 0x24, 0x54, - 0x0F, 0x80, 0xC6, 0x66, 0x07, 0xA2, 0x44, 0x2A, 0xE9, 0xA4, 0x23, 0x22, 0x3A, 0xC7, 0x36, 0x0D, - 0x0C, 0xD0, 0x28, 0x81, 0xA0, 0xB5, 0x44, 0xE9, 0xA7, 0xA0, 0xA2, 0x71, 0x52, 0x36, 0x70, 0xE8, - 0x25, 0x55, 0x9A, 0x9C, 0x46, 0xE5, 0x8F, 0x40, 0xA1, 0xB6, 0xEA, 0x6A, 0x10, 0xA3, 0x9E, 0x49, - 0x9E, 0x92, 0xA7, 0xA6, 0xCA, 0xA9, 0xA7, 0xAF, 0xE6, 0xAA, 0xEB, 0x0A, 0xA5, 0x4E, 0x99, 0x57, - 0x1D, 0xB5, 0x6E, 0x8A, 0xEA, 0x18, 0xBB, 0x16, 0x6B, 0xAC, 0x3E, 0x71, 0x20, 0xFE, 0x48, 0x16, - 0x36, 0x5D, 0x24, 0xC1, 0xA9, 0xB0, 0x69, 0xEA, 0x70, 0xEC, 0xB4, 0xC6, 0x26, 0xD9, 0x45, 0x0D, - 0x1C, 0x8C, 0x0A, 0x2C, 0x81, 0xD0, 0x76, 0x2A, 0x2D, 0xB5, 0xE0, 0xBE, 0x9A, 0xA4, 0x21, 0xB9, - 0x0C, 0x47, 0x6E, 0x9F, 0xB5, 0xDA, 0xEA, 0x28, 0xB1, 0x25, 0x88, 0x54, 0xD2, 0x98, 0x8D, 0xD5, - 0xA7, 0x09, 0x31, 0xF6, 0x25, 0x33, 0x4A, 0x48, 0x9F, 0x80, 0x34, 0xA6, 0x0A, 0x74, 0x56, 0xA1, - 0xAF, 0x0F, 0x6D, 0x10, 0x27, 0x41, 0x1B, 0x4C, 0x79, 0xA1, 0x2E, 0x5F, 0x9D, 0xAA, 0x67, 0xEF, - 0x1A, 0xD3, 0x30, 0xBC, 0xF0, 0xBD, 0xEE, 0xDE, 0xEB, 0x30, 0x57, 0xF3, 0x36, 0x4C, 0xC2, 0xBF, - 0x12, 0x5B, 0xBC, 0x6F, 0x97, 0x16, 0x9B, 0xB1, 0xB1, 0x0A, 0x59, 0xC8, 0x30, 0x9C, 0xC8, 0xDB, - 0x68, 0x9A, 0xEA, 0x02, 0x09, 0x2B, 0x70, 0x71, 0xC7, 0x15, 0xB3, 0x92, 0x71, 0xBE, 0x1A, 0x67, - 0x3C, 0xF1, 0x57, 0xF8, 0xC2, 0x6C, 0x14, 0xC4, 0xEE, 0xB2, 0x27, 0x33, 0xBC, 0x3A, 0xC3, 0x2C, - 0x2F, 0xC4, 0xEC, 0x8C, 0x25, 0xF1, 0xBB, 0xFD, 0x7E, 0x10, 0xB2, 0x12, 0xC4, 0x91, 0x5B, 0x32, - 0x54, 0x46, 0x14, 0xB7, 0xF2, 0xCC, 0x0F, 0xCF, 0x1B, 0x71, 0xC4, 0x40, 0x83, 0xF2, 0x30, 0xC6, - 0xFA, 0x92, 0x92, 0x35, 0xC3, 0x53, 0x43, 0x87, 0x5F, 0xD7, 0xA9, 0x70, 0xDD, 0xB0, 0xCE, 0x62, - 0x57, 0x6D, 0xF6, 0x98, 0x4D, 0x8B, 0x3C, 0x32, 0xD2, 0xE4, 0xA6, 0x8A, 0xB0, 0x5F, 0x4F, 0xCB, - 0x1C, 0x75, 0xCC, 0x65, 0x57, 0xBD, 0x2F, 0xD9, 0x43, 0x3B, 0xEC, 0xF5, 0xC4, 0xF9, 0x6A, 0xED, - 0x72, 0xCB, 0x36, 0xBF, 0x2C, 0xB8, 0x62, 0x7E, 0x9F, 0x2D, 0xF8, 0x08, 0x69, 0x87, 0xB1, 0xF6, - 0x3F, 0x6B, 0xAA, 0x0B, 0x9A, 0xC2, 0x7C, 0xB7, 0xFB, 0xF7, 0xE0, 0x63, 0xFE, 0xC7, 0x27, 0x35, - 0xDD, 0x18, 0xD3, 0x6D, 0x36, 0xD4, 0x72, 0x53, 0x1E, 0xF9, 0xD4, 0x1D, 0xDB, 0x1C, 0xF8, 0xE8, - 0x24, 0x2C, 0xB0, 0x44, 0x0E, 0x2C, 0x99, 0xDE, 0x6D, 0x9A, 0x90, 0xEF, 0x1C, 0x7A, 0xCB, 0x9E, - 0xBB, 0x1E, 0x35, 0xE9, 0x79, 0xCB, 0x9D, 0x39, 0xE9, 0xF0, 0x8E, 0xAD, 0x7B, 0xD8, 0x86, 0x53, - 0x0D, 0xC8, 0xBF, 0xA0, 0x73, 0x6E, 0x80, 0x12, 0x39, 0x9C, 0x27, 0x72, 0x07, 0x3A, 0xB4, 0xED, - 0x76, 0xEB, 0x5E, 0xC3, 0x44, 0xF8, 0x4D, 0xF1, 0xEE, 0x0D, 0xD8, 0xCD, 0x7A, 0xF7, 0xFD, 0xD0, - 0xEF, 0x1A, 0xE3, 0xFD, 0x12, 0xF5, 0x60, 0x07, 0xBD, 0xB3, 0xCF, 0xA2, 0xE3, 0x9D, 0xB9, 0x01, - 0xA6, 0x9F, 0x6E, 0x7C, 0x0D, 0x18, 0xE8, 0x60, 0x2D, 0xB4, 0xEC, 0x4E, 0x1E, 0x77, 0xB8, 0x81, - 0x7C, 0x9C, 0x06, 0xF1, 0x17, 0xD8, 0x60, 0x6E, 0x68, 0x03, 0x2F, 0xA0, 0x68, 0x54, 0x2A, 0x4B, - 0xFE, 0x3E, 0xFC, 0x6A, 0x90, 0x1F, 0x1A, 0xCA, 0x57, 0xBF, 0xD0, 0x98, 0x2B, 0x09, 0xF9, 0x03, - 0x80, 0x21, 0x6E, 0xD5, 0x3A, 0x00, 0x3A, 0x30, 0x0D, 0x04, 0xB4, 0x1F, 0x0E, 0x8E, 0xE0, 0x17, - 0x23, 0x48, 0xF0, 0x11, 0x67, 0x20, 0xDC, 0xF7, 0xDE, 0xF5, 0x3F, 0xF9, 0x79, 0x29, 0x52, 0x02, - 0x7C, 0x60, 0x1A, 0x70, 0x37, 0xBB, 0xB5, 0xC0, 0xEE, 0x7D, 0x21, 0x94, 0x42, 0x0A, 0x45, 0xE8, - 0xB1, 0xD8, 0xB9, 0x6E, 0x6B, 0xE0, 0x13, 0x9A, 0x0C, 0x59, 0x96, 0xB5, 0x9C, 0xD9, 0x50, 0x6C, - 0xBE, 0x3B, 0x4A, 0xE7, 0x58, 0x28, 0x0A, 0x12, 0x26, 0x06, 0x78, 0x61, 0xEB, 0x59, 0xE4, 0x7E, - 0xF8, 0xB9, 0xDD, 0xE1, 0xAC, 0x88, 0x65, 0xAB, 0x17, 0x0F, 0x03, 0x18, 0x33, 0x0D, 0xC6, 0xCE, - 0x87, 0x14, 0xAB, 0x98, 0x0D, 0xD9, 0x33, 0xC5, 0xC0, 0xD9, 0xAD, 0x55, 0x70, 0x3B, 0x5C, 0xE2, - 0x08, 0xA1, 0x27, 0xBB, 0xBC, 0x05, 0x6F, 0x73, 0xB6, 0xD3, 0x9C, 0x14, 0x61, 0x27, 0x3A, 0xC0, - 0x69, 0x11, 0x84, 0x97, 0x73, 0xA2, 0x17, 0x83, 0xB8, 0x3B, 0xAA, 0x0D, 0xF1, 0x8B, 0x50, 0x1C, - 0xE2, 0x15, 0xCF, 0xD8, 0xC3, 0x34, 0x96, 0x10, 0x86, 0x83, 0xAB, 0x21, 0x19, 0xBD, 0x37, 0x43, - 0x0E, 0xCE, 0x4E, 0x87, 0xE3, 0xA3, 0x63, 0xB8, 0x56, 0x28, 0xC8, 0x42, 0x82, 0xB0, 0x68, 0x86, - 0x4C, 0xA4, 0x22, 0x17, 0xC9, 0xC8, 0x46, 0x3A, 0xF2, 0x91, 0x90, 0x8C, 0xA4, 0x24, 0x75, 0x95, - 0x00, 0x00, 0x3B, -}; - -// Bonus data -BYTE Saitama[] = -{ - 0xFF, 0xD8, 0xFF, 0xE0, 0x00, 0x10, 0x4A, 0x46, 0x49, 0x46, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, - 0x00, 0x01, 0x00, 0x00, 0xFF, 0xDB, 0x00, 0x84, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, - 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02, 0x01, - 0x01, 0x01, 0x02, 0x02, 0x02, 0x03, 0x03, 0x02, 0x02, 0x02, 0x02, 0x03, 0x03, 0x04, 0x03, 0x03, - 0x03, 0x04, 0x03, 0x02, 0x02, 0x04, 0x05, 0x04, 0x04, 0x04, 0x04, 0x05, 0x05, 0x05, 0x03, 0x03, - 0x05, 0x06, 0x05, 0x05, 0x06, 0x04, 0x05, 0x05, 0x04, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, - 0x02, 0x01, 0x01, 0x02, 0x04, 0x03, 0x02, 0x03, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, - 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, - 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, - 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0xFF, 0xC4, 0x01, 0xA2, 0x00, 0x00, - 0x01, 0x05, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0A, 0x0B, 0x01, 0x00, 0x03, 0x01, 0x01, - 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x02, 0x03, - 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0A, 0x0B, 0x10, 0x00, 0x02, 0x01, 0x03, 0x03, 0x02, 0x04, - 0x03, 0x05, 0x05, 0x04, 0x04, 0x00, 0x00, 0x01, 0x7D, 0x01, 0x02, 0x03, 0x00, 0x04, 0x11, 0x05, - 0x12, 0x21, 0x31, 0x41, 0x06, 0x13, 0x51, 0x61, 0x07, 0x22, 0x71, 0x14, 0x32, 0x81, 0x91, 0xA1, - 0x08, 0x23, 0x42, 0xB1, 0xC1, 0x15, 0x52, 0xD1, 0xF0, 0x24, 0x33, 0x62, 0x72, 0x82, 0x09, 0x0A, - 0x16, 0x17, 0x18, 0x19, 0x1A, 0x25, 0x26, 0x27, 0x28, 0x29, 0x2A, 0x34, 0x35, 0x36, 0x37, 0x38, - 0x39, 0x3A, 0x43, 0x44, 0x45, 0x46, 0x47, 0x48, 0x49, 0x4A, 0x53, 0x54, 0x55, 0x56, 0x57, 0x58, - 0x59, 0x5A, 0x63, 0x64, 0x65, 0x66, 0x67, 0x68, 0x69, 0x6A, 0x73, 0x74, 0x75, 0x76, 0x77, 0x78, - 0x79, 0x7A, 0x83, 0x84, 0x85, 0x86, 0x87, 0x88, 0x89, 0x8A, 0x92, 0x93, 0x94, 0x95, 0x96, 0x97, - 0x98, 0x99, 0x9A, 0xA2, 0xA3, 0xA4, 0xA5, 0xA6, 0xA7, 0xA8, 0xA9, 0xAA, 0xB2, 0xB3, 0xB4, 0xB5, - 0xB6, 0xB7, 0xB8, 0xB9, 0xBA, 0xC2, 0xC3, 0xC4, 0xC5, 0xC6, 0xC7, 0xC8, 0xC9, 0xCA, 0xD2, 0xD3, - 0xD4, 0xD5, 0xD6, 0xD7, 0xD8, 0xD9, 0xDA, 0xE1, 0xE2, 0xE3, 0xE4, 0xE5, 0xE6, 0xE7, 0xE8, 0xE9, - 0xEA, 0xF1, 0xF2, 0xF3, 0xF4, 0xF5, 0xF6, 0xF7, 0xF8, 0xF9, 0xFA, 0x11, 0x00, 0x02, 0x01, 0x02, - 0x04, 0x04, 0x03, 0x04, 0x07, 0x05, 0x04, 0x04, 0x00, 0x01, 0x02, 0x77, 0x00, 0x01, 0x02, 0x03, - 0x11, 0x04, 0x05, 0x21, 0x31, 0x06, 0x12, 0x41, 0x51, 0x07, 0x61, 0x71, 0x13, 0x22, 0x32, 0x81, - 0x08, 0x14, 0x42, 0x91, 0xA1, 0xB1, 0xC1, 0x09, 0x23, 0x33, 0x52, 0xF0, 0x15, 0x62, 0x72, 0xD1, - 0x0A, 0x16, 0x24, 0x34, 0xE1, 0x25, 0xF1, 0x17, 0x18, 0x19, 0x1A, 0x26, 0x27, 0x28, 0x29, 0x2A, - 0x35, 0x36, 0x37, 0x38, 0x39, 0x3A, 0x43, 0x44, 0x45, 0x46, 0x47, 0x48, 0x49, 0x4A, 0x53, 0x54, - 0x55, 0x56, 0x57, 0x58, 0x59, 0x5A, 0x63, 0x64, 0x65, 0x66, 0x67, 0x68, 0x69, 0x6A, 0x73, 0x74, - 0x75, 0x76, 0x77, 0x78, 0x79, 0x7A, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87, 0x88, 0x89, 0x8A, 0x92, - 0x93, 0x94, 0x95, 0x96, 0x97, 0x98, 0x99, 0x9A, 0xA2, 0xA3, 0xA4, 0xA5, 0xA6, 0xA7, 0xA8, 0xA9, - 0xAA, 0xB2, 0xB3, 0xB4, 0xB5, 0xB6, 0xB7, 0xB8, 0xB9, 0xBA, 0xC2, 0xC3, 0xC4, 0xC5, 0xC6, 0xC7, - 0xC8, 0xC9, 0xCA, 0xD2, 0xD3, 0xD4, 0xD5, 0xD6, 0xD7, 0xD8, 0xD9, 0xDA, 0xE2, 0xE3, 0xE4, 0xE5, - 0xE6, 0xE7, 0xE8, 0xE9, 0xEA, 0xF2, 0xF3, 0xF4, 0xF5, 0xF6, 0xF7, 0xF8, 0xF9, 0xFA, 0xFF, 0xC0, - 0x00, 0x11, 0x08, 0x01, 0x9B, 0x02, 0x1C, 0x03, 0x01, 0x11, 0x00, 0x02, 0x11, 0x01, 0x03, 0x11, - 0x01, 0xFF, 0xDA, 0x00, 0x0C, 0x03, 0x01, 0x00, 0x02, 0x11, 0x03, 0x11, 0x00, 0x3F, 0x00, 0xFA, - 0xFE, 0xBF, 0x5F, 0x3E, 0x18, 0x28, 0x00, 0xA0, 0x02, 0x80, 0x0A, 0x00, 0x28, 0x00, 0xA0, 0x02, - 0x80, 0x0A, 0x00, 0x28, 0x00, 0xA0, 0x02, 0x80, 0x0A, 0x00, 0x28, 0x00, 0xA0, 0x02, 0x80, 0x0A, - 0x00, 0x28, 0x00, 0xA0, 0x02, 0x80, 0x0A, 0x00, 0x28, 0x00, 0xA0, 0x02, 0x80, 0x0A, 0x00, 0x28, - 0x00, 0xA0, 0x02, 0x80, 0x0A, 0x00, 0x28, 0x00, 0xA0, 0x02, 0x80, 0x0A, 0x00, 0x28, 0x00, 0xA0, - 0x02, 0x80, 0x0A, 0x00, 0x28, 0x00, 0xA0, 0x02, 0x80, 0x0A, 0x00, 0x28, 0x00, 0xA0, 0x02, 0x80, - 0x0A, 0x00, 0x28, 0x00, 0xA0, 0x02, 0x80, 0x0A, 0x00, 0x28, 0x00, 0xA0, 0x02, 0x80, 0x0A, 0x00, - 0x28, 0x00, 0xA0, 0x02, 0x80, 0x0A, 0x00, 0x28, 0x00, 0xA0, 0x02, 0x80, 0x0A, 0x00, 0x28, 0x00, - 0xA0, 0x02, 0x80, 0x0A, 0x00, 0x28, 0x00, 0xA0, 0x02, 0x80, 0x0A, 0x00, 0x28, 0x03, 0xF3, 0xB3, - 0xF6, 0x8A, 0xFF, 0x00, 0x82, 0xA1, 0xFE, 0xCA, 0xFF, 0x00, 0xB2, 0xE7, 0xC5, 0x3D, 0x5F, 0xE0, - 0xEF, 0xC5, 0x3B, 0xCF, 0x1F, 0x41, 0xE3, 0x2D, 0x0F, 0x4E, 0xB0, 0xD4, 0xEF, 0xA3, 0xF0, 0xFF, - 0x00, 0x83, 0x4E, 0xB1, 0xA6, 0x2C, 0x5A, 0x85, 0xA2, 0x5C, 0x5B, 0x6C, 0x9F, 0xCE, 0x4C, 0x9F, - 0x2E, 0x64, 0xC8, 0xDA, 0x30, 0x72, 0x3B, 0x57, 0x93, 0x8A, 0xCE, 0xB0, 0x38, 0x2A, 0xCF, 0x0F, - 0x5A, 0xFC, 0xC9, 0x2D, 0x96, 0x9A, 0xAD, 0x3F, 0x03, 0xB6, 0x86, 0x5F, 0x5E, 0xBD, 0x35, 0x52, - 0x9A, 0x5C, 0xBE, 0xB6, 0xD8, 0xF1, 0xD5, 0xFF, 0x00, 0x82, 0xD9, 0xFE, 0xC4, 0xCD, 0x67, 0x0D, - 0xFA, 0xFF, 0x00, 0xC2, 0xE6, 0x36, 0x33, 0xCA, 0x6D, 0xED, 0xEE, 0xD7, 0xE1, 0x74, 0x9F, 0x66, - 0x99, 0xD4, 0x7C, 0xC9, 0x1B, 0xFD, 0xA3, 0x6B, 0x11, 0xC6, 0x40, 0xE9, 0x59, 0x47, 0x3F, 0xC0, - 0x38, 0xA9, 0x46, 0x32, 0xB3, 0xD1, 0x5A, 0x3D, 0x7B, 0x2F, 0xF2, 0x3A, 0x61, 0x92, 0xE3, 0xE7, - 0x75, 0x4E, 0x17, 0xB2, 0x4F, 0x4E, 0x89, 0xE8, 0xB6, 0x5B, 0x74, 0x42, 0x43, 0xFF, 0x00, 0x05, - 0xB6, 0xFD, 0x88, 0x67, 0x1F, 0xB9, 0xB9, 0xF8, 0xB4, 0xFB, 0x47, 0x2A, 0x3E, 0x1E, 0xA2, 0x32, - 0xE3, 0xB1, 0x53, 0x74, 0x08, 0xE9, 0xD3, 0x15, 0xF7, 0x3C, 0x39, 0xC2, 0x7C, 0x53, 0xC5, 0xD8, - 0x7F, 0xAC, 0xF0, 0xCE, 0x01, 0xE2, 0x29, 0xA4, 0xDF, 0xB9, 0x57, 0x0C, 0x9A, 0x4B, 0x47, 0x78, - 0x4A, 0xB4, 0x66, 0x9F, 0x93, 0x8A, 0x7D, 0x91, 0xC5, 0x5F, 0x0B, 0x2C, 0x24, 0x9D, 0x3C, 0x43, - 0x51, 0x6B, 0x4B, 0x35, 0x25, 0xFF, 0x00, 0xB6, 0x93, 0x47, 0xFF, 0x00, 0x05, 0xAF, 0xFD, 0x89, - 0xA4, 0x46, 0x68, 0xE7, 0xF8, 0xB2, 0xCA, 0x98, 0xDD, 0x8F, 0x00, 0x44, 0x36, 0x8C, 0x71, 0xC7, - 0xDA, 0xC7, 0xA7, 0xA5, 0x7D, 0x16, 0x5B, 0xE1, 0x3F, 0x89, 0x79, 0xB6, 0x16, 0xAE, 0x2F, 0x2D, - 0xC9, 0xA5, 0x3A, 0x74, 0xB4, 0x9B, 0x58, 0x8C, 0x1A, 0x71, 0xF5, 0x8C, 0xB1, 0x2A, 0x5F, 0x72, - 0xB7, 0x4E, 0x86, 0x12, 0xF6, 0x34, 0xDA, 0x8C, 0xAA, 0x24, 0xDE, 0xDA, 0x4B, 0xF4, 0x8D, 0x8F, - 0x54, 0xF8, 0x65, 0xFF, 0x00, 0x05, 0x40, 0xFD, 0x9E, 0x7E, 0x32, 0x4B, 0xAA, 0x5B, 0xFC, 0x32, - 0xF0, 0xDF, 0xC5, 0x8F, 0x14, 0x4F, 0xA2, 0x47, 0x0C, 0xBA, 0xA4, 0x0B, 0xA1, 0x68, 0x9A, 0x14, - 0x96, 0x51, 0xCE, 0xC5, 0x62, 0x90, 0xAD, 0xEE, 0xAD, 0x06, 0xE4, 0xCA, 0x36, 0x59, 0x72, 0xAB, - 0x8C, 0xB1, 0x51, 0x5E, 0x7E, 0x71, 0xE1, 0xDF, 0x1E, 0xF0, 0xF5, 0x18, 0x56, 0xCE, 0x72, 0x99, - 0xD2, 0x84, 0xAF, 0xCB, 0xFB, 0xDC, 0x2C, 0xAF, 0x64, 0x9B, 0xB2, 0x85, 0x79, 0x37, 0x64, 0xD6, - 0x89, 0x79, 0x2D, 0x9A, 0x5C, 0x58, 0xAC, 0xC3, 0x2D, 0xC0, 0xA4, 0xF1, 0x55, 0xD4, 0x63, 0xDF, - 0x92, 0xA3, 0x5D, 0xB7, 0x50, 0x69, 0x7A, 0x36, 0xAD, 0xA7, 0x4B, 0x09, 0x27, 0xFC, 0x15, 0x07, - 0xF6, 0x7A, 0xB6, 0xF8, 0x85, 0x0F, 0xC2, 0x8B, 0xCF, 0x0B, 0xFC, 0x5F, 0xD3, 0x7E, 0x20, 0xCF, - 0x78, 0x9A, 0x7C, 0x1E, 0x1D, 0xD5, 0xFC, 0x33, 0xA4, 0x68, 0xAB, 0x2C, 0xB2, 0x21, 0x68, 0x95, - 0x2F, 0xA7, 0xD5, 0x23, 0xB2, 0x2A, 0xCA, 0x8C, 0x55, 0xC4, 0xDB, 0x1B, 0x18, 0x56, 0x27, 0x8A, - 0xD7, 0x0B, 0xE1, 0xB7, 0x88, 0x18, 0xCC, 0xAA, 0x59, 0xD6, 0x0F, 0x29, 0x94, 0xF0, 0xB1, 0xD1, - 0xCA, 0x35, 0xB0, 0x8E, 0x4B, 0x6F, 0xF9, 0x76, 0xB1, 0x1E, 0xD3, 0x4B, 0xA5, 0xF0, 0x69, 0xB7, - 0x4D, 0x1C, 0x71, 0xF9, 0x6C, 0xA9, 0x2A, 0xB4, 0xEB, 0xA7, 0x06, 0x9B, 0x56, 0x8C, 0xDE, 0x8A, - 0xD7, 0xD1, 0x42, 0xEA, 0xD7, 0x5A, 0x5B, 0xAA, 0xD3, 0x54, 0x69, 0x7C, 0x46, 0xFF, 0x00, 0x82, - 0x94, 0xFC, 0x0F, 0xF8, 0x47, 0x67, 0xA6, 0xDF, 0xFC, 0x46, 0xF0, 0x37, 0xC6, 0xCF, 0x0B, 0xD8, - 0x6A, 0xD7, 0x52, 0x58, 0x69, 0xD7, 0x72, 0xF8, 0x4B, 0x4A, 0xD5, 0x2D, 0xAE, 0x27, 0x84, 0x02, - 0xF0, 0x96, 0xB5, 0xD4, 0xE5, 0x08, 0xE0, 0x11, 0x85, 0x7D, 0xA4, 0xFF, 0x00, 0x08, 0x38, 0xE2, - 0x32, 0x8F, 0x0E, 0xB8, 0xFB, 0x3D, 0x9B, 0xA3, 0x94, 0x65, 0x33, 0x9C, 0x97, 0x4F, 0x6D, 0x85, - 0x83, 0x56, 0xF2, 0x9E, 0x22, 0x3D, 0xB4, 0x5D, 0x74, 0xB5, 0xF4, 0x0C, 0x1E, 0x3F, 0x2D, 0xC7, - 0xCE, 0x54, 0xF0, 0x58, 0x88, 0xC9, 0xC5, 0x2B, 0xA4, 0xA6, 0xB7, 0xDA, 0xD7, 0x82, 0xBD, 0xFA, - 0x25, 0xBD, 0xAC, 0x95, 0xD5, 0x88, 0x63, 0xFF, 0x00, 0x82, 0x99, 0x7C, 0x06, 0x97, 0xC1, 0x96, - 0x7F, 0x10, 0x6D, 0xFC, 0x1F, 0xF1, 0x8A, 0xEB, 0xC1, 0x77, 0xF6, 0xF3, 0x5C, 0x58, 0xEB, 0xD6, - 0x5E, 0x1A, 0xD1, 0xEF, 0x60, 0xBA, 0x4B, 0x76, 0x2B, 0x38, 0x8E, 0x08, 0xF5, 0x56, 0x98, 0xB2, - 0x15, 0x60, 0x53, 0xCB, 0xDC, 0x30, 0x78, 0xC0, 0xE2, 0x9F, 0x86, 0xDE, 0x20, 0xC7, 0x18, 0xF2, - 0xE7, 0x94, 0x4D, 0x57, 0x5B, 0xC3, 0xDB, 0x61, 0x6E, 0xB6, 0xDF, 0xFD, 0xA2, 0xC9, 0x6D, 0xAE, - 0xCB, 0x4B, 0xB4, 0x72, 0xBC, 0xF7, 0x23, 0x85, 0x7F, 0xAA, 0xD4, 0xC5, 0x46, 0x33, 0xDA, 0xD2, - 0x8D, 0x48, 0x76, 0x5B, 0xCA, 0x09, 0x7A, 0x2B, 0xEB, 0xD3, 0x44, 0xED, 0x83, 0xE0, 0x7F, 0xF8, - 0x2A, 0xC7, 0xEC, 0xD5, 0xF1, 0x22, 0xE6, 0xF2, 0xC7, 0xC0, 0xBE, 0x1E, 0xF8, 0xC7, 0xE2, 0x3B, - 0xDD, 0x3E, 0xD1, 0x6F, 0x6E, 0xAC, 0xAD, 0x3C, 0x1B, 0xA7, 0xDA, 0xDE, 0x24, 0x24, 0x90, 0x24, - 0x48, 0x66, 0xD4, 0x63, 0x69, 0x14, 0x15, 0x20, 0xEC, 0x0D, 0x8C, 0x73, 0x8C, 0x8A, 0xD7, 0x13, - 0xE1, 0x87, 0x88, 0x98, 0x2A, 0xB1, 0xA1, 0x8A, 0xCA, 0x25, 0x19, 0x35, 0x75, 0x7A, 0xF8, 0x3B, - 0x34, 0xAC, 0xB4, 0x92, 0xC4, 0xF2, 0xE9, 0x75, 0xA5, 0xEE, 0xBB, 0x59, 0x1D, 0xD8, 0xAC, 0x4E, - 0x0F, 0x03, 0x4E, 0x15, 0x31, 0x35, 0x79, 0x63, 0x2B, 0x28, 0xBE, 0x4A, 0x8D, 0x3B, 0xE8, 0xAD, - 0xCB, 0x07, 0xDB, 0xD2, 0xC9, 0xBD, 0x93, 0xB6, 0x27, 0x8A, 0xBF, 0xE0, 0xAF, 0x7F, 0xB2, 0x87, - 0x81, 0xB5, 0xDB, 0xCF, 0x0B, 0xF8, 0xBB, 0x49, 0xF8, 0xCD, 0xA0, 0x6B, 0xFA, 0x7A, 0xA1, 0xBC, - 0xD2, 0xAF, 0x7E, 0x1F, 0xC1, 0xF6, 0x8B, 0x71, 0x22, 0x06, 0x42, 0x4A, 0x5E, 0xB2, 0x90, 0x54, - 0xA9, 0xE0, 0x9F, 0xD3, 0x8E, 0xAC, 0xBB, 0xC2, 0x3F, 0x13, 0xF3, 0x58, 0xCA, 0x59, 0x66, 0x49, - 0x3A, 0x89, 0x68, 0xF9, 0x6B, 0xE0, 0xDD, 0xAC, 0xED, 0xFF, 0x00, 0x41, 0x3D, 0x1A, 0xB6, 0x9E, - 0x5D, 0x1A, 0x2E, 0x9D, 0x6C, 0x25, 0x4A, 0x6A, 0x70, 0xAA, 0xB9, 0x76, 0xDA, 0x6B, 0xF0, 0x71, - 0x4D, 0x7D, 0xC8, 0xE6, 0xFF, 0x00, 0xE1, 0xF5, 0x7F, 0xB1, 0x48, 0x1F, 0xEB, 0x7E, 0x2C, 0x80, - 0x00, 0xFF, 0x00, 0x99, 0x02, 0x2F, 0xC0, 0x01, 0xF6, 0xBF, 0xA5, 0x74, 0x4B, 0xC1, 0x8F, 0x16, - 0x20, 0xBD, 0xEC, 0x8A, 0x76, 0xFF, 0x00, 0xAF, 0xF8, 0x2F, 0xCB, 0xEB, 0x26, 0x89, 0xD0, 0xB2, - 0xB5, 0x48, 0xDB, 0xD2, 0x5F, 0xFC, 0x88, 0x9F, 0xF0, 0xFA, 0xCF, 0xD8, 0xA0, 0x0F, 0xF5, 0xBF, - 0x16, 0x80, 0x18, 0xFF, 0x00, 0x9A, 0x7F, 0x18, 0x03, 0xD3, 0xFE, 0x5E, 0xFE, 0x95, 0x9F, 0xFC, - 0x41, 0xDF, 0x15, 0x22, 0xB5, 0xC8, 0xAA, 0x5B, 0xFE, 0xBF, 0xE0, 0xFF, 0x00, 0xF9, 0xA4, 0x2F, - 0x43, 0xFE, 0x7E, 0x2F, 0xBA, 0x5F, 0xFC, 0x88, 0x9F, 0xF0, 0xFA, 0xFF, 0x00, 0xD8, 0x98, 0x0F, - 0xF5, 0xFF, 0x00, 0x16, 0x40, 0x18, 0x18, 0xFF, 0x00, 0x84, 0x02, 0x21, 0x8E, 0x38, 0x18, 0xFB, - 0x5D, 0x63, 0x3F, 0x09, 0x7C, 0x4D, 0xA5, 0x16, 0xE7, 0x92, 0xC9, 0x25, 0xFF, 0x00, 0x51, 0x18, - 0x2F, 0x96, 0x9F, 0x59, 0xFB, 0x92, 0xDF, 0xA2, 0x1A, 0x54, 0x74, 0x4A, 0xA2, 0xFB, 0xA5, 0xFF, - 0x00, 0xC8, 0x91, 0x2F, 0xFC, 0x16, 0xD3, 0xF6, 0x22, 0x27, 0x60, 0xB8, 0xF8, 0xB6, 0x08, 0xC0, - 0xF9, 0xBE, 0x1E, 0x2C, 0x6A, 0x3D, 0x30, 0x4D, 0xD0, 0x1D, 0xAB, 0xCA, 0xA3, 0xC0, 0x3C, 0x77, - 0x5B, 0x12, 0xF0, 0x70, 0xC9, 0xEA, 0xA9, 0xAF, 0xE7, 0x95, 0x0A, 0x71, 0xFF, 0x00, 0xC0, 0xE7, - 0x56, 0x34, 0xED, 0xA7, 0x49, 0x59, 0x2B, 0x74, 0xB1, 0x7E, 0xCA, 0x0A, 0x29, 0xF3, 0xC6, 0xDE, - 0x57, 0x7F, 0x82, 0x57, 0xFC, 0x07, 0xBF, 0xFC, 0x16, 0xC7, 0xF6, 0x23, 0x8D, 0xB6, 0x1B, 0xAF, - 0x8A, 0xC4, 0x80, 0x3F, 0xD5, 0xF8, 0x0A, 0x29, 0x13, 0x18, 0xEC, 0xCB, 0x78, 0x47, 0x61, 0xDE, - 0xB4, 0x9F, 0x87, 0x9C, 0x77, 0x4E, 0xA3, 0xA2, 0xF2, 0xB9, 0x73, 0x2E, 0xD5, 0xB0, 0x92, 0x5A, - 0x79, 0xC7, 0x10, 0xE3, 0xF7, 0x3F, 0x24, 0x53, 0xA3, 0x18, 0x59, 0x39, 0xC7, 0xE5, 0x76, 0xBF, - 0x05, 0x6F, 0xF2, 0x23, 0x4F, 0xF8, 0x2D, 0xB7, 0xEC, 0x40, 0xCD, 0xE5, 0xAD, 0xD7, 0xC5, 0x90, - 0x46, 0x07, 0xCF, 0xF0, 0xF5, 0x62, 0x8C, 0x71, 0xC7, 0xCC, 0x6E, 0x82, 0xFA, 0x77, 0xAF, 0x3A, - 0x9F, 0x09, 0x71, 0x75, 0x4A, 0xB3, 0xA1, 0x1C, 0xAE, 0xAA, 0x71, 0xDD, 0xC9, 0xD2, 0x84, 0x57, - 0xFD, 0xBF, 0x3A, 0x91, 0x83, 0xF9, 0x4B, 0x6F, 0x22, 0xA3, 0x86, 0xBD, 0x94, 0x67, 0x1D, 0x76, - 0xD6, 0xDF, 0xA6, 0x9F, 0xD2, 0x10, 0xFF, 0x00, 0xC1, 0x6E, 0x3F, 0x61, 0xF4, 0xE0, 0xDE, 0x7C, - 0x57, 0x00, 0x71, 0xC7, 0xC3, 0xF4, 0x65, 0xC0, 0x1D, 0x01, 0x17, 0x78, 0xED, 0x4B, 0x11, 0xC2, - 0x7C, 0x53, 0x84, 0x6A, 0x35, 0xB0, 0x0D, 0x2E, 0xEA, 0xAE, 0x1A, 0x51, 0xF2, 0xF7, 0xA3, 0x5D, - 0xC7, 0xD1, 0x5F, 0xC9, 0x2D, 0x89, 0x8E, 0x1E, 0xFA, 0x46, 0x4B, 0xEE, 0x6B, 0xF0, 0xB2, 0x18, - 0xBF, 0xF0, 0x5B, 0xCF, 0xD8, 0x70, 0xE0, 0x0B, 0xCF, 0x8B, 0x2A, 0x31, 0xC1, 0x6F, 0x87, 0x62, - 0x34, 0xC0, 0x1D, 0x98, 0xDD, 0x01, 0xDA, 0xB8, 0xA8, 0xE4, 0x99, 0xFD, 0x59, 0xAA, 0x71, 0xC0, - 0xCE, 0x2B, 0xF9, 0xA7, 0x2A, 0x54, 0xE1, 0xFF, 0x00, 0x83, 0x2A, 0x54, 0x8D, 0x3B, 0x2F, 0xF1, - 0x59, 0x22, 0xFE, 0xAB, 0x24, 0x97, 0xBC, 0xBE, 0x57, 0x7F, 0x82, 0x57, 0xFC, 0x06, 0x7F, 0xC3, - 0xF0, 0x3F, 0x61, 0x90, 0x76, 0x0B, 0xEF, 0x8B, 0x04, 0x80, 0x38, 0x5F, 0x87, 0x81, 0x97, 0x18, - 0xE3, 0x04, 0x5D, 0x63, 0xF2, 0xAE, 0x39, 0x61, 0x73, 0x08, 0x57, 0x78, 0x55, 0x86, 0x6E, 0x6B, - 0xA4, 0x67, 0x4A, 0x6B, 0x6E, 0x92, 0x85, 0x49, 0x41, 0xAE, 0xD6, 0x93, 0x5D, 0x8A, 0x58, 0x2A, - 0x9C, 0xA9, 0xA6, 0xAD, 0xF3, 0x5F, 0x85, 0x90, 0xDF, 0xF8, 0x7E, 0x0F, 0xEC, 0x30, 0x38, 0xFB, - 0x77, 0xC5, 0x91, 0x81, 0xD3, 0xFE, 0x15, 0xD0, 0x18, 0xC7, 0x6F, 0xF8, 0xF9, 0xAC, 0x5C, 0x31, - 0x70, 0xBC, 0x65, 0x86, 0x92, 0x6B, 0x4B, 0x37, 0x4D, 0x5B, 0xC9, 0xFB, 0xEA, 0xDE, 0x80, 0xB0, - 0x35, 0x6C, 0xAC, 0xD5, 0xBE, 0x7F, 0xE4, 0x1F, 0xF0, 0xFC, 0x2F, 0xD8, 0x5C, 0x01, 0xFE, 0x9F, - 0xF1, 0x60, 0x0E, 0xDF, 0xF1, 0x6E, 0xC0, 0x1C, 0x74, 0xC7, 0xFA, 0x4D, 0x66, 0xE5, 0x5E, 0x29, - 0x5E, 0x84, 0x92, 0xE9, 0xAD, 0x35, 0xFF, 0x00, 0xB7, 0xFD, 0xDF, 0x80, 0xD6, 0x06, 0xAE, 0xC9, - 0xAF, 0xC7, 0xFC, 0x80, 0x7F, 0xC1, 0x70, 0xBF, 0x61, 0x7C, 0x71, 0x7F, 0xF1, 0x63, 0x03, 0x1C, - 0x0F, 0x87, 0x63, 0x8F, 0x4E, 0x3E, 0xD3, 0xED, 0x49, 0x4E, 0xB5, 0x9B, 0x8D, 0x09, 0x59, 0x6F, - 0x67, 0x4D, 0xDB, 0xE4, 0xA7, 0xFA, 0x7E, 0x40, 0xB0, 0x15, 0x74, 0x57, 0x56, 0xF9, 0xFF, 0x00, - 0x90, 0x9F, 0xF0, 0xFC, 0x3F, 0xD8, 0x5F, 0xA7, 0xDB, 0xFE, 0x2C, 0xFA, 0x63, 0xFE, 0x15, 0xCF, - 0xB7, 0x4C, 0x7D, 0xA6, 0x92, 0xA9, 0x5B, 0x65, 0x42, 0x7F, 0xF9, 0x2F, 0xFF, 0x00, 0x24, 0x1F, - 0x50, 0xAB, 0xDD, 0x7D, 0xFF, 0x00, 0xF0, 0x03, 0xFE, 0x1F, 0x87, 0xFB, 0x0B, 0x0E, 0x3E, 0xDF, - 0xF1, 0x64, 0x76, 0xC7, 0xFC, 0x2B, 0xAC, 0x74, 0x1D, 0x31, 0xF6, 0x9F, 0xA5, 0x27, 0x5A, 0xA4, - 0x2C, 0xA5, 0x46, 0x4B, 0xFF, 0x00, 0x00, 0x5F, 0xFB, 0x70, 0xD6, 0x5F, 0x5B, 0xA3, 0x5F, 0x7F, - 0xFC, 0x01, 0x3F, 0xE1, 0xF8, 0x9F, 0xB0, 0xB7, 0xFC, 0xFF, 0x00, 0xFC, 0x58, 0xFF, 0x00, 0xC3, - 0x75, 0xFF, 0x00, 0xDD, 0x35, 0x1F, 0x5A, 0x69, 0x7F, 0x0A, 0x56, 0xF5, 0x87, 0xFF, 0x00, 0x24, - 0x1F, 0xD9, 0xF5, 0xFB, 0xAF, 0xEB, 0xE4, 0x1F, 0xF0, 0xFC, 0x4F, 0xD8, 0x5B, 0xFE, 0x7F, 0xFE, - 0x2C, 0x7F, 0xE1, 0xBA, 0xFF, 0x00, 0xEE, 0x9A, 0x7F, 0x59, 0x6A, 0xCB, 0xD9, 0x4B, 0xEF, 0x87, - 0xFF, 0x00, 0x24, 0x1F, 0xD9, 0xF5, 0xFB, 0xAF, 0xEB, 0xE4, 0x1F, 0xF0, 0xFC, 0x4F, 0xD8, 0x58, - 0x0F, 0xF8, 0xFF, 0x00, 0xF8, 0xB3, 0x80, 0x3A, 0x0F, 0x87, 0x5D, 0x80, 0xE8, 0x07, 0xDA, 0x7D, - 0xA9, 0x3C, 0x57, 0x2C, 0x5B, 0x74, 0xA5, 0x64, 0xBA, 0x72, 0xF4, 0xF2, 0x52, 0xBF, 0xC9, 0x2F, - 0x24, 0x0B, 0x2E, 0xAF, 0xA2, 0x4D, 0x7D, 0xFF, 0x00, 0xF0, 0x06, 0x8F, 0xF8, 0x2E, 0x3F, 0xEC, - 0x27, 0xD0, 0x6A, 0x1F, 0x16, 0x78, 0xC0, 0xC0, 0xF8, 0x70, 0x70, 0x38, 0xE0, 0x0F, 0xF4, 0x9F, - 0xA5, 0x71, 0xAC, 0xEB, 0x0A, 0xDB, 0x84, 0x69, 0xCD, 0xB4, 0xED, 0x65, 0x1B, 0xEA, 0xAD, 0xA6, - 0x97, 0x57, 0x5A, 0x69, 0xD0, 0xB5, 0x96, 0x62, 0x2C, 0xBE, 0x1B, 0x7A, 0x89, 0xFF, 0x00, 0x0F, - 0xC9, 0xFD, 0x84, 0xBF, 0xE8, 0x23, 0xF1, 0x63, 0xFF, 0x00, 0x0D, 0xC9, 0xFF, 0x00, 0xE4, 0x9A, - 0xC3, 0xFD, 0x63, 0xCB, 0x56, 0x9E, 0xF7, 0xFE, 0x02, 0x35, 0x95, 0x62, 0xAC, 0xAC, 0x95, 0xBD, - 0x7F, 0xE0, 0x07, 0xFC, 0x3F, 0x27, 0xF6, 0x12, 0xFF, 0x00, 0xA0, 0x8F, 0xC5, 0x8F, 0xFC, 0x37, - 0x27, 0xFF, 0x00, 0x92, 0x69, 0x7F, 0xAC, 0x99, 0x67, 0x79, 0x7F, 0xE0, 0x3F, 0xF0, 0x43, 0xFB, - 0x27, 0x15, 0xD9, 0x7D, 0xFF, 0x00, 0xF0, 0x07, 0x37, 0xFC, 0x17, 0x17, 0xF6, 0x15, 0x40, 0xBB, - 0xAF, 0xFE, 0x2D, 0x28, 0x65, 0x05, 0x7F, 0xE2, 0xDC, 0x10, 0x08, 0x23, 0x8C, 0x7F, 0xA4, 0xFD, - 0x2B, 0x79, 0x67, 0x78, 0x3A, 0x74, 0x63, 0x88, 0x94, 0x65, 0xEC, 0xDE, 0x8A, 0x5C, 0xBE, 0xEB, - 0x6B, 0xA2, 0x69, 0xDA, 0xEB, 0xAA, 0xDD, 0x6C, 0xD2, 0xB5, 0x87, 0x2C, 0xA3, 0x17, 0x09, 0x2A, - 0x72, 0x49, 0x3B, 0x27, 0x6B, 0xDB, 0x46, 0xB4, 0x76, 0xB6, 0xD6, 0xB5, 0x84, 0x5F, 0xF8, 0x2E, - 0x37, 0xEC, 0x28, 0x47, 0xCB, 0x7F, 0xF1, 0x68, 0x85, 0xC0, 0x3B, 0x7E, 0x1C, 0x1C, 0x2E, 0x7A, - 0x0F, 0xF8, 0xF9, 0xAE, 0x7F, 0xF5, 0x97, 0x2B, 0x8D, 0x93, 0x6D, 0x7C, 0xBB, 0x7C, 0xCA, 0x86, - 0x4D, 0x8E, 0x92, 0x6E, 0x11, 0x4D, 0x2B, 0x6D, 0xD2, 0xFA, 0x2D, 0x96, 0x97, 0xD9, 0x7E, 0x01, - 0xFF, 0x00, 0x0F, 0xC7, 0xFD, 0x85, 0x02, 0x86, 0xFE, 0xD0, 0xF8, 0xB4, 0x10, 0xFC, 0xAA, 0x7F, - 0xE1, 0x5C, 0x10, 0xB9, 0x03, 0x90, 0x0F, 0xDA, 0x7E, 0x95, 0xA2, 0xE2, 0x1C, 0xBB, 0x91, 0xCE, - 0x2A, 0x5C, 0xAA, 0xDB, 0x47, 0x45, 0x7B, 0xDB, 0xAE, 0x97, 0xB3, 0xB7, 0xA1, 0x9A, 0xCB, 0x31, - 0x17, 0xE4, 0x56, 0xBF, 0x6B, 0xFF, 0x00, 0xC0, 0x24, 0x87, 0xFE, 0x0B, 0x85, 0xFB, 0x0C, 0x4D, - 0xB8, 0x45, 0x7D, 0xF1, 0x65, 0x84, 0x69, 0xBD, 0xFF, 0x00, 0xE2, 0xDD, 0x05, 0x08, 0xA3, 0xB9, - 0xCD, 0xC8, 0xF6, 0xAF, 0x63, 0x25, 0xFA, 0xCF, 0x10, 0xFB, 0x75, 0x92, 0xE1, 0xE5, 0x55, 0x51, - 0x83, 0xA9, 0x52, 0xCE, 0x11, 0x50, 0x82, 0x69, 0x39, 0x37, 0x39, 0xC5, 0x59, 0x36, 0x96, 0x8D, - 0xBF, 0x2B, 0x19, 0xD4, 0xC0, 0x55, 0xA0, 0xA3, 0xED, 0x1A, 0x57, 0xD1, 0x7F, 0x49, 0x11, 0x7F, - 0xC3, 0xF2, 0x3F, 0x61, 0x30, 0x07, 0xFC, 0x4C, 0x7E, 0x2C, 0x0E, 0x38, 0x1F, 0xF0, 0xAE, 0x4F, - 0x00, 0x74, 0x18, 0xFB, 0x4F, 0xD2, 0xBC, 0x89, 0xE7, 0xF8, 0x0A, 0x36, 0x53, 0x52, 0x4F, 0xB5, - 0x95, 0xFE, 0x69, 0x3B, 0xAF, 0x2B, 0xA5, 0x75, 0x66, 0xB4, 0xB1, 0xA4, 0x72, 0xBC, 0x4B, 0x5E, - 0xEA, 0x56, 0xF5, 0xFF, 0x00, 0x80, 0x1F, 0xF0, 0xFC, 0x9F, 0xD8, 0x4B, 0xFE, 0x82, 0x3F, 0x16, - 0x3F, 0xF0, 0xDC, 0x9F, 0xFE, 0x49, 0xAC, 0xFF, 0x00, 0xD6, 0x4C, 0xB3, 0xBC, 0xBF, 0xF0, 0x1F, - 0xF8, 0x23, 0xFE, 0xC9, 0xC5, 0x76, 0x5F, 0x7F, 0xFC, 0x00, 0xFF, 0x00, 0x87, 0xE4, 0xFE, 0xC2, - 0x5F, 0xF4, 0x11, 0xF8, 0xB1, 0xFF, 0x00, 0x86, 0xE4, 0xFF, 0x00, 0xF2, 0x4D, 0x1F, 0xEB, 0x26, - 0x59, 0xDE, 0x5F, 0xF8, 0x0F, 0xFC, 0x10, 0xFE, 0xC9, 0xC5, 0x76, 0x5F, 0x7F, 0xFC, 0x03, 0x67, - 0x44, 0xFF, 0x00, 0x82, 0xD2, 0xFE, 0xC6, 0x5E, 0x24, 0xD5, 0x2C, 0xB4, 0x3F, 0x0F, 0x5B, 0x7C, - 0x6C, 0xD6, 0xF5, 0x8D, 0x44, 0x1F, 0xEC, 0xFD, 0x2F, 0x4A, 0xF8, 0x59, 0x25, 0xED, 0xF5, 0xD8, - 0x54, 0x2C, 0xDE, 0x5C, 0x49, 0x70, 0x58, 0xE1, 0x51, 0xCF, 0x03, 0x80, 0xA4, 0xF6, 0xAD, 0xE9, - 0xE7, 0x78, 0x3A, 0xA9, 0x3A, 0x71, 0x95, 0xB6, 0xBD, 0x92, 0x5B, 0x5E, 0xD7, 0x6D, 0x24, 0xEC, - 0xB4, 0x57, 0x57, 0xB6, 0x86, 0x53, 0xC0, 0xD5, 0xA5, 0x07, 0x39, 0xB4, 0x92, 0xDF, 0x5E, 0xDD, - 0x92, 0x57, 0x7F, 0x24, 0x5F, 0xF1, 0x1F, 0xFC, 0x16, 0x4B, 0xF6, 0x40, 0xF0, 0x79, 0xB0, 0x5F, - 0x13, 0xD8, 0x7C, 0x6A, 0xD1, 0x06, 0xA5, 0xA6, 0x5B, 0xEA, 0xF6, 0x06, 0xEF, 0xE1, 0xA0, 0xF2, - 0xEE, 0x2D, 0x6E, 0xD0, 0xB5, 0xB4, 0xAA, 0xEB, 0x74, 0x54, 0x6F, 0x55, 0x62, 0x14, 0x90, 0xC3, - 0x1C, 0x81, 0x5B, 0x62, 0x33, 0x3A, 0x78, 0x48, 0x46, 0xA5, 0x7A, 0x53, 0x8C, 0x1A, 0x4D, 0x3E, - 0x5B, 0xC6, 0xCF, 0x44, 0xEE, 0x9B, 0x5A, 0xDB, 0x4D, 0x76, 0xB5, 0xB4, 0xB1, 0x34, 0xF0, 0x73, - 0xA9, 0x2F, 0x65, 0x09, 0x47, 0x9B, 0xB5, 0xEC, 0xEC, 0xAD, 0xB2, 0x69, 0x3B, 0x2D, 0x35, 0x4A, - 0xDD, 0x0E, 0x6F, 0xFE, 0x1F, 0x87, 0xFB, 0x0C, 0x02, 0x89, 0xF6, 0xCF, 0x8B, 0xA1, 0x9F, 0x02, - 0x34, 0xFF, 0x00, 0x85, 0x6C, 0xC0, 0xBF, 0xA0, 0x51, 0xF6, 0x9E, 0x7B, 0x74, 0xAC, 0x5E, 0x77, - 0x85, 0x83, 0x8C, 0x25, 0x4E, 0x69, 0xB5, 0x74, 0xB9, 0x1A, 0xBA, 0xB6, 0xE9, 0x76, 0xB7, 0x6D, - 0x2C, 0x68, 0xB2, 0xEA, 0xDC, 0xAE, 0x4A, 0x51, 0xE5, 0x5B, 0xBB, 0xAB, 0x2F, 0xF2, 0x23, 0xFF, - 0x00, 0x87, 0xE3, 0xFE, 0xC2, 0x80, 0xED, 0xFE, 0xD0, 0xF8, 0xB2, 0x08, 0xF9, 0x76, 0xFF, 0x00, - 0xC2, 0xB8, 0x20, 0x82, 0x3B, 0x63, 0xED, 0x3E, 0xD5, 0x9A, 0xE2, 0x0C, 0x03, 0x9A, 0xA5, 0x18, - 0xCB, 0x9B, 0x6B, 0x72, 0xEB, 0x7D, 0xAD, 0x6F, 0xD0, 0xA5, 0x95, 0xE2, 0x79, 0x53, 0x5C, 0xB6, - 0xF5, 0xD0, 0x07, 0xFC, 0x17, 0x23, 0xF6, 0x13, 0xC7, 0x1A, 0x8F, 0xC5, 0x9C, 0x0C, 0x0E, 0x3E, - 0x1C, 0x1C, 0x0F, 0x41, 0xFF, 0x00, 0x1F, 0x3E, 0xD4, 0x97, 0x10, 0xE5, 0xFC, 0xAE, 0x49, 0x4B, - 0x95, 0x5A, 0xFE, 0xEE, 0x8B, 0xB7, 0xA6, 0xDA, 0x0D, 0x65, 0x58, 0x9D, 0x12, 0xB7, 0xDE, 0x03, - 0xFE, 0x0B, 0x91, 0xFB, 0x09, 0xF0, 0x06, 0xA3, 0xF1, 0x67, 0xD8, 0x0F, 0x87, 0x27, 0xB0, 0xEC, - 0x3E, 0xD3, 0xED, 0x44, 0x38, 0x87, 0x2E, 0x93, 0x51, 0x82, 0x93, 0x7D, 0x94, 0x7B, 0x79, 0x2E, - 0xC8, 0x3F, 0xB2, 0xB1, 0x49, 0x6C, 0xAD, 0xEB, 0xFF, 0x00, 0x00, 0x3F, 0xE1, 0xF9, 0x3F, 0xB0, - 0x97, 0xFD, 0x04, 0x7E, 0x2C, 0x7F, 0xE1, 0xB9, 0x3F, 0xFC, 0x93, 0x53, 0xFE, 0xB2, 0x65, 0x9D, - 0xE5, 0xFF, 0x00, 0x80, 0xFF, 0x00, 0xC1, 0x0F, 0xEC, 0x9C, 0x57, 0x65, 0xF7, 0xFF, 0x00, 0xC0, - 0x0F, 0xF8, 0x7E, 0x4F, 0xEC, 0x25, 0xFF, 0x00, 0x41, 0x1F, 0x8B, 0x1F, 0xF8, 0x6E, 0x4F, 0xFF, - 0x00, 0x24, 0xD1, 0xFE, 0xB2, 0x65, 0x89, 0x2D, 0x65, 0x6F, 0xF0, 0xFF, 0x00, 0xC1, 0x0F, 0xEC, - 0x9C, 0x57, 0x65, 0xF7, 0xFF, 0x00, 0xC0, 0x0F, 0xF8, 0x7E, 0x4F, 0xEC, 0x25, 0xFF, 0x00, 0x41, - 0x1F, 0x8B, 0x1F, 0xF8, 0x6E, 0x4F, 0xFF, 0x00, 0x24, 0xD1, 0xFE, 0xB2, 0x65, 0x9D, 0xE5, 0xFF, - 0x00, 0x80, 0xFF, 0x00, 0xC1, 0x0F, 0xEC, 0x9C, 0x57, 0x65, 0xF7, 0xFF, 0x00, 0xC0, 0x03, 0xFF, - 0x00, 0x05, 0xC7, 0xFD, 0x85, 0x17, 0x00, 0xEA, 0x1F, 0x16, 0x57, 0xE5, 0x04, 0x03, 0xF0, 0xE0, - 0x8E, 0x08, 0xE0, 0x81, 0xF6, 0x9E, 0x9D, 0x29, 0x2E, 0x25, 0xCA, 0xDA, 0xF7, 0x5C, 0xAD, 0xE9, - 0xFF, 0x00, 0x04, 0xA9, 0x64, 0xF8, 0xD8, 0x59, 0x4A, 0x29, 0x68, 0x9A, 0xBE, 0x9A, 0x3D, 0xBA, - 0x6D, 0x6D, 0x83, 0xFE, 0x1F, 0x93, 0xFB, 0x09, 0x7F, 0xD0, 0x47, 0xE2, 0xC7, 0xFE, 0x1B, 0x93, - 0xFF, 0x00, 0xC9, 0x34, 0xFF, 0x00, 0xD6, 0x4C, 0xB3, 0xBC, 0xBF, 0xF0, 0x1F, 0xF8, 0x24, 0xFF, - 0x00, 0x64, 0xE2, 0xBB, 0x2F, 0xBF, 0xFE, 0x00, 0x7F, 0xC3, 0xF2, 0x7F, 0x61, 0x2F, 0xFA, 0x08, - 0xFC, 0x58, 0xFF, 0x00, 0xC3, 0x72, 0x7F, 0xF9, 0x26, 0x8F, 0xF5, 0x93, 0x2C, 0xEF, 0x2F, 0xFC, - 0x07, 0xFE, 0x08, 0x7F, 0x64, 0xE2, 0xBB, 0x2F, 0xBF, 0xFE, 0x00, 0x7F, 0xC3, 0xF2, 0x7F, 0x61, - 0x2F, 0xFA, 0x08, 0xFC, 0x58, 0xFF, 0x00, 0xC3, 0x72, 0x7F, 0xF9, 0x26, 0x8F, 0xF5, 0x93, 0x2C, - 0xEF, 0x2F, 0xFC, 0x07, 0xFE, 0x08, 0x7F, 0x64, 0xE2, 0xBB, 0x2F, 0xBF, 0xFE, 0x00, 0xE4, 0xFF, - 0x00, 0x82, 0xE2, 0xFE, 0xC2, 0xAE, 0x42, 0xA5, 0xFF, 0x00, 0xC5, 0xA3, 0xD8, 0x01, 0xF0, 0xE0, - 0x81, 0xC0, 0xE9, 0xFF, 0x00, 0x1F, 0x3F, 0x4A, 0xED, 0xC1, 0x66, 0x54, 0xF3, 0x09, 0xC6, 0x8E, - 0x06, 0x94, 0xE7, 0x27, 0xB5, 0xA3, 0x65, 0xA2, 0xEE, 0xDA, 0x4A, 0xDE, 0xAB, 0xA2, 0xEC, 0x89, - 0x96, 0x5B, 0x5E, 0x9A, 0xF7, 0x9C, 0x52, 0xF5, 0xFF, 0x00, 0x80, 0x5C, 0x4F, 0xF8, 0x2D, 0xB7, - 0xEC, 0x40, 0xEA, 0x0A, 0x5D, 0x7C, 0x59, 0x23, 0xA0, 0xC7, 0xC3, 0xD5, 0x5E, 0x83, 0xD3, 0xED, - 0x43, 0xDA, 0xBE, 0xDB, 0x07, 0xC1, 0x7C, 0x63, 0x8E, 0xA7, 0x1A, 0x98, 0x4C, 0xB2, 0x6E, 0x2F, - 0x6F, 0x7F, 0x0F, 0x1F, 0xC2, 0x55, 0x93, 0xFC, 0x0E, 0x57, 0x45, 0x43, 0x47, 0x25, 0xF8, 0xFE, - 0x88, 0x5F, 0xF8, 0x7D, 0xA7, 0xEC, 0x44, 0x38, 0xFB, 0x4F, 0xC5, 0x91, 0x81, 0xFF, 0x00, 0x44, - 0xF9, 0x30, 0x30, 0x3A, 0x7F, 0xC7, 0xDF, 0xD2, 0xBA, 0xDF, 0x87, 0xDC, 0x77, 0x15, 0xAE, 0x55, - 0x3B, 0x79, 0x55, 0xC3, 0x3F, 0xCA, 0xBB, 0xFC, 0x04, 0xA9, 0xC3, 0x44, 0xA6, 0xBF, 0x1F, 0xF2, - 0x01, 0xFF, 0x00, 0x05, 0xB4, 0xFD, 0x88, 0x71, 0xFF, 0x00, 0x1F, 0x5F, 0x16, 0x46, 0x38, 0xC7, - 0xFC, 0x2B, 0xD4, 0x1D, 0x07, 0x18, 0xFF, 0x00, 0x4A, 0xFA, 0x56, 0x1F, 0xEA, 0x37, 0x1A, 0x47, - 0x4F, 0xEC, 0xB9, 0xFF, 0x00, 0xE0, 0xCC, 0x37, 0xFF, 0x00, 0x2E, 0x1A, 0xA2, 0xAC, 0xAD, 0x25, - 0x6F, 0x9F, 0xF9, 0x07, 0xFC, 0x3E, 0xD7, 0xF6, 0x20, 0x18, 0x1F, 0x6A, 0xF8, 0xB3, 0xD0, 0x70, - 0x3E, 0x1E, 0xA6, 0x00, 0xED, 0xFF, 0x00, 0x2F, 0x55, 0x3F, 0xEA, 0x4F, 0x19, 0xAD, 0x3F, 0xB3, - 0x27, 0xD3, 0xFE, 0x5E, 0x61, 0xFF, 0x00, 0xF9, 0x77, 0xFC, 0x37, 0x5B, 0x68, 0x1E, 0xC5, 0x59, - 0x7B, 0xCA, 0xDF, 0x3F, 0xF2, 0x2A, 0xCB, 0xFF, 0x00, 0x05, 0xC1, 0xFD, 0x86, 0x2D, 0xC8, 0x49, - 0x6F, 0xBE, 0x2D, 0x46, 0x71, 0xC0, 0xFF, 0x00, 0x85, 0x75, 0x91, 0x80, 0x3B, 0x11, 0x73, 0x8F, - 0x4A, 0xF9, 0x6C, 0xEF, 0xEB, 0x5C, 0x35, 0x5E, 0x38, 0x5C, 0xF3, 0x0D, 0x3A, 0x33, 0x7B, 0x26, - 0xA3, 0x24, 0xEC, 0x96, 0xCE, 0x12, 0x94, 0x5A, 0x57, 0x5B, 0x3F, 0x2E, 0x86, 0xF4, 0xB0, 0x15, - 0x6B, 0x46, 0xF4, 0x9A, 0x6B, 0xD6, 0xDF, 0xA2, 0x22, 0xFF, 0x00, 0x87, 0xE4, 0xFE, 0xC2, 0x5F, - 0xF4, 0x11, 0xF8, 0xB1, 0xFF, 0x00, 0x86, 0xE4, 0xFF, 0x00, 0xF2, 0x4D, 0x78, 0x7F, 0xEB, 0x26, - 0x59, 0xDE, 0x5F, 0xF8, 0x0F, 0xFC, 0x13, 0x5F, 0xEC, 0x9C, 0x57, 0x65, 0xF7, 0xFF, 0x00, 0xC0, - 0x0F, 0xF8, 0x7E, 0x4F, 0xEC, 0x25, 0xFF, 0x00, 0x41, 0x1F, 0x8B, 0x1F, 0xF8, 0x6E, 0x4F, 0xFF, - 0x00, 0x24, 0xD1, 0xFE, 0xB2, 0x65, 0x9D, 0xE5, 0xFF, 0x00, 0x80, 0xFF, 0x00, 0xC1, 0x0F, 0xEC, - 0x9C, 0x57, 0x65, 0xF7, 0xFF, 0x00, 0xC0, 0x0F, 0xF8, 0x7E, 0x4F, 0xEC, 0x25, 0xFF, 0x00, 0x41, - 0x1F, 0x8B, 0x1F, 0xF8, 0x6E, 0x4F, 0xFF, 0x00, 0x24, 0xD1, 0xFE, 0xB2, 0x65, 0x9D, 0xE5, 0xFF, - 0x00, 0x80, 0xFF, 0x00, 0xC1, 0x0F, 0xEC, 0x9C, 0x57, 0x65, 0xF7, 0xFF, 0x00, 0xC0, 0x3B, 0xAF, - 0x08, 0xFF, 0x00, 0xC1, 0x5E, 0xBF, 0x65, 0x5F, 0x1D, 0xB8, 0x8F, 0xC1, 0xDE, 0x1F, 0xF8, 0xED, - 0xAF, 0x0E, 0x07, 0x9D, 0x65, 0xF0, 0xB4, 0xC7, 0x66, 0x3D, 0x01, 0xB8, 0x7B, 0xA5, 0x88, 0x74, - 0xE8, 0x58, 0x57, 0x44, 0x33, 0x9C, 0x2C, 0xE2, 0xA5, 0x08, 0x4E, 0xCF, 0x6F, 0x75, 0x2B, 0xFA, - 0x5D, 0xAB, 0xFC, 0x8C, 0x67, 0x82, 0x9D, 0x2D, 0x27, 0x28, 0xAF, 0x2B, 0xFE, 0x89, 0x1E, 0xA6, - 0x3F, 0xE0, 0xA1, 0xDF, 0x09, 0x76, 0x07, 0xFF, 0x00, 0x85, 0x71, 0xF1, 0xC4, 0x26, 0x38, 0xFF, - 0x00, 0x8A, 0x53, 0x47, 0x04, 0x01, 0xEA, 0xBF, 0xDA, 0xB9, 0x1D, 0x07, 0x6F, 0x4A, 0xDD, 0x66, - 0x11, 0xB5, 0xD5, 0x19, 0xDB, 0xBF, 0x2A, 0xB7, 0xE7, 0x63, 0x0F, 0x65, 0x04, 0xBE, 0x38, 0xFE, - 0x3F, 0xE4, 0x79, 0xA7, 0x8B, 0x3F, 0xE0, 0xAE, 0x1F, 0xB2, 0xEF, 0x80, 0xD7, 0x77, 0x8B, 0xBC, - 0x35, 0xF1, 0xDF, 0x42, 0x88, 0x0E, 0x6E, 0x2E, 0x3E, 0x17, 0x79, 0xF6, 0x49, 0x83, 0x8C, 0x19, - 0xE2, 0xBA, 0x78, 0x87, 0x4E, 0x85, 0x85, 0x63, 0x3C, 0xE3, 0x0B, 0x4A, 0x37, 0x9C, 0x24, 0x97, - 0xF8, 0x56, 0x96, 0xB7, 0x44, 0xF4, 0xDD, 0x76, 0xED, 0xD1, 0xA5, 0xB5, 0x3C, 0x1C, 0xEA, 0x59, - 0x53, 0x94, 0x7E, 0xFB, 0x7E, 0x87, 0x9E, 0xFF, 0x00, 0xC3, 0xF2, 0x7F, 0x61, 0x2F, 0xFA, 0x08, - 0xFC, 0x58, 0xFF, 0x00, 0xC3, 0x72, 0x7F, 0xF9, 0x26, 0xB9, 0xBF, 0xD6, 0x4C, 0xB3, 0xBC, 0xBF, - 0xF0, 0x1F, 0xF8, 0x26, 0xFF, 0x00, 0xD9, 0x38, 0xAE, 0xCB, 0xEF, 0xFF, 0x00, 0x80, 0x7D, 0x93, - 0xFB, 0x25, 0x7E, 0xDB, 0x5F, 0x04, 0x7F, 0x6D, 0x48, 0x3E, 0x22, 0xDC, 0x7C, 0x0F, 0x3E, 0x31, - 0xBB, 0xB7, 0xF8, 0x58, 0x74, 0x75, 0xF1, 0x64, 0xBE, 0x25, 0xF0, 0xC9, 0xD0, 0x52, 0x03, 0xAE, - 0x2D, 0xF9, 0xB1, 0xF2, 0x71, 0x23, 0xEF, 0x18, 0xD1, 0x6F, 0x4B, 0x13, 0xB4, 0x2E, 0x13, 0xAE, - 0x7E, 0x5F, 0x43, 0x01, 0x99, 0x61, 0xB3, 0x05, 0x3F, 0xAB, 0x5E, 0xD1, 0xB5, 0xEE, 0xAD, 0xBD, - 0xED, 0x6F, 0xB8, 0xE6, 0xC4, 0x61, 0x2A, 0xE1, 0x79, 0x55, 0x44, 0xB5, 0xDA, 0xDE, 0x56, 0xFF, - 0x00, 0x34, 0x7D, 0x77, 0x5D, 0xE7, 0x30, 0x50, 0x01, 0x40, 0x05, 0x00, 0x7F, 0x14, 0x5F, 0xF0, - 0x5A, 0xFF, 0x00, 0xF9, 0x48, 0x1F, 0xC4, 0x8F, 0xFB, 0x12, 0xFC, 0x27, 0xFF, 0x00, 0xA8, 0xF5, - 0xAD, 0x7E, 0x75, 0xC4, 0x1F, 0xF2, 0x34, 0x9F, 0xA4, 0x7F, 0xF4, 0x94, 0x7D, 0x46, 0x57, 0xFE, - 0xE5, 0x1F, 0x9F, 0xE6, 0x7E, 0x58, 0xE9, 0x5A, 0xBD, 0xEE, 0x91, 0x75, 0x6F, 0x75, 0x69, 0x3C, - 0x91, 0xBD, 0xB1, 0x2D, 0x00, 0x59, 0x64, 0x8D, 0x22, 0x2C, 0x30, 0xC5, 0x42, 0x32, 0x91, 0x91, - 0x91, 0xC1, 0x15, 0xE6, 0xE1, 0x2A, 0xD3, 0xC3, 0xD4, 0x75, 0x25, 0x14, 0xDD, 0xAC, 0xB4, 0x5D, - 0xD7, 0x5D, 0xD6, 0x97, 0xD6, 0x2D, 0x3E, 0x89, 0xA4, 0x7A, 0x4A, 0xA5, 0x78, 0x45, 0x42, 0x95, - 0x47, 0x18, 0xDE, 0xED, 0x68, 0xD3, 0xF5, 0x8B, 0x4E, 0x2F, 0xA6, 0x8D, 0x74, 0x47, 0xAB, 0x9F, - 0xEC, 0xFF, 0x00, 0x16, 0xAE, 0x90, 0x9E, 0x18, 0xB2, 0x98, 0xF8, 0x86, 0x35, 0xB8, 0x6D, 0x40, - 0xD9, 0xE9, 0xB7, 0xD3, 0xFF, 0x00, 0x68, 0x00, 0x01, 0x86, 0x12, 0x86, 0x69, 0xD8, 0x15, 0x55, - 0x6C, 0x6D, 0x00, 0x63, 0x76, 0x49, 0xE2, 0xBF, 0x6D, 0xF0, 0xBF, 0x31, 0xE3, 0xDC, 0xAF, 0x19, - 0x2E, 0x2A, 0xE1, 0x0C, 0x15, 0x49, 0xE0, 0x30, 0xCD, 0x46, 0xBC, 0xA1, 0x07, 0xC8, 0xAF, 0x1D, - 0x14, 0xB5, 0xBC, 0xA4, 0x93, 0xBD, 0xB5, 0xBE, 0x9A, 0xEC, 0x8E, 0x2C, 0xD3, 0xFB, 0x32, 0x58, - 0x7F, 0x69, 0x9A, 0x62, 0x52, 0xAD, 0x34, 0xB9, 0x57, 0xBA, 0x92, 0x6B, 0x74, 0xE2, 0xA3, 0x15, - 0x15, 0xA2, 0xB5, 0x9B, 0x5B, 0xBB, 0x6B, 0x65, 0x07, 0x87, 0x35, 0x26, 0xD0, 0xF5, 0xFB, 0x1B, - 0xDB, 0x9B, 0x37, 0x8E, 0x5D, 0x36, 0xF5, 0x4D, 0xEE, 0x9F, 0x73, 0x6A, 0x48, 0x2D, 0x1B, 0x7C, - 0xD1, 0xCB, 0x0B, 0x15, 0x0C, 0x38, 0xC1, 0x42, 0x57, 0x23, 0x23, 0x23, 0x39, 0x1F, 0xDC, 0xDC, - 0x07, 0xC5, 0xF4, 0x73, 0x59, 0x43, 0x36, 0xC9, 0xE8, 0xBB, 0xD4, 0x8B, 0x8D, 0x7A, 0x5C, 0xAE, - 0x0A, 0x57, 0x8D, 0x9B, 0xBB, 0x56, 0x52, 0x57, 0xE6, 0x8F, 0x33, 0xDD, 0x25, 0x6E, 0x87, 0xC2, - 0xE6, 0x18, 0x5F, 0xAC, 0x60, 0xA5, 0x46, 0x13, 0x5C, 0xB2, 0x5E, 0xEC, 0xB4, 0x69, 0x2F, 0x2D, - 0xD2, 0x7D, 0x9D, 0x9D, 0x9D, 0x9D, 0xB4, 0xB1, 0xF6, 0xA6, 0xA1, 0xE3, 0x3F, 0x03, 0xFC, 0x1C, - 0xF1, 0x17, 0x80, 0xFE, 0x3C, 0x7E, 0xCE, 0xFF, 0x00, 0x10, 0xB4, 0xA8, 0x7C, 0x4E, 0x97, 0x82, - 0xCF, 0xC5, 0x7F, 0x0C, 0xE4, 0x17, 0x29, 0x1C, 0x64, 0xC4, 0x3E, 0xD0, 0xA2, 0x31, 0x1C, 0x49, - 0x26, 0x9D, 0x32, 0x86, 0x47, 0x89, 0x98, 0x61, 0x89, 0xC0, 0x23, 0x04, 0xFA, 0x54, 0x70, 0x78, - 0xDE, 0x2E, 0xFA, 0xC7, 0x0E, 0x66, 0x94, 0x13, 0xC2, 0x35, 0x29, 0x50, 0x9D, 0x49, 0x41, 0xD4, - 0xA3, 0x27, 0x7D, 0x23, 0xCC, 0xEC, 0xAD, 0x7B, 0x59, 0x7C, 0x2A, 0xFC, 0xAE, 0xFB, 0x7C, 0x7E, - 0x45, 0x4B, 0x34, 0x96, 0x0E, 0x59, 0x6E, 0x79, 0x41, 0xB8, 0x5B, 0x49, 0x4A, 0xD2, 0xBA, 0x56, - 0xB2, 0x7B, 0xB6, 0xD3, 0xD5, 0x3D, 0x1D, 0x92, 0x4F, 0x4B, 0x1F, 0x62, 0xFE, 0xD0, 0x7E, 0x36, - 0xFD, 0x97, 0xFF, 0x00, 0x6A, 0x8F, 0x84, 0x3E, 0x1C, 0xF1, 0x86, 0x8F, 0xF1, 0x13, 0xC3, 0x3F, - 0x0C, 0x3E, 0x2F, 0x78, 0x6C, 0x47, 0x3E, 0x87, 0xA7, 0x78, 0x8E, 0xF1, 0xED, 0x75, 0x6D, 0x3D, - 0x95, 0x43, 0x4B, 0xA2, 0xDC, 0x4D, 0xE4, 0xB4, 0x92, 0x5B, 0x2B, 0xB1, 0x78, 0x66, 0x46, 0x18, - 0x63, 0x82, 0xA0, 0x27, 0x3F, 0x15, 0xC2, 0xB9, 0x67, 0x1C, 0x70, 0x67, 0x11, 0x3C, 0x16, 0x37, - 0x05, 0x3A, 0x94, 0x2A, 0x73, 0x42, 0xD0, 0xB5, 0x9B, 0xBA, 0x49, 0xBB, 0x5A, 0x31, 0x4D, 0x45, - 0x2F, 0x7B, 0x9A, 0x56, 0xBD, 0xA5, 0x75, 0x61, 0x42, 0x55, 0x72, 0x89, 0xFD, 0x4E, 0x8D, 0x19, - 0x55, 0xC3, 0xA8, 0xBD, 0x14, 0x64, 0xDA, 0x57, 0x6E, 0xC9, 0xB5, 0x18, 0xC9, 0x7E, 0x37, 0x6F, - 0xA6, 0x8A, 0x5F, 0x84, 0xBF, 0xB4, 0x6F, 0xC1, 0xFF, 0x00, 0x8E, 0x1F, 0x05, 0xEF, 0x3E, 0x0F, - 0xFE, 0xD2, 0x3E, 0x24, 0xD0, 0xF4, 0x8D, 0x6A, 0xC5, 0x63, 0xD1, 0xA4, 0xD5, 0x6E, 0xB4, 0x89, - 0x9D, 0x3C, 0x56, 0x40, 0x64, 0xD3, 0xB5, 0x1B, 0x29, 0x21, 0x8C, 0x95, 0xBC, 0x85, 0x4E, 0x0B, - 0xB2, 0x86, 0x94, 0x9C, 0x82, 0x30, 0x05, 0x7A, 0xFC, 0x61, 0xC1, 0x5C, 0x55, 0xC3, 0xD9, 0xAD, - 0x3C, 0xF7, 0x22, 0xC3, 0x54, 0xF6, 0x36, 0x53, 0x71, 0x72, 0xF7, 0xA3, 0x17, 0x6E, 0x66, 0xDD, - 0xDC, 0x5B, 0x6D, 0x26, 0xE2, 0xA7, 0xCA, 0xA2, 0x92, 0x7A, 0x5E, 0xD9, 0xD7, 0xCB, 0x6B, 0x65, - 0xD5, 0xDE, 0x3B, 0x06, 0xD2, 0xA5, 0xA4, 0x9A, 0xD5, 0x72, 0xAB, 0x5D, 0xA7, 0xEE, 0xA8, 0x27, - 0x14, 0xAD, 0x1B, 0xFB, 0xB6, 0x52, 0xD5, 0xA7, 0xAF, 0x83, 0xFC, 0x35, 0xF1, 0x31, 0xFD, 0x99, - 0xBC, 0x73, 0xE2, 0x4F, 0x00, 0xF8, 0x9B, 0x53, 0x6F, 0x15, 0xFC, 0x08, 0xF1, 0x05, 0xD4, 0xDF, - 0x63, 0xF1, 0x8D, 0xB5, 0x9D, 0xCA, 0xDB, 0x69, 0xC0, 0xA4, 0x82, 0xDE, 0xE6, 0x2B, 0x77, 0x83, - 0xCE, 0xCB, 0xAA, 0xC7, 0x1C, 0x88, 0xAA, 0x07, 0xCE, 0x59, 0x72, 0x47, 0x1F, 0x79, 0x8D, 0xC1, - 0x62, 0xB8, 0xC7, 0x25, 0xA7, 0x99, 0x50, 0xA0, 0xE9, 0xE6, 0x09, 0x46, 0x33, 0x4D, 0x2E, 0x69, - 0xBB, 0x45, 0xDE, 0xC9, 0xB4, 0xA3, 0x7F, 0x89, 0x35, 0xAB, 0xEB, 0x6D, 0x1F, 0x97, 0x98, 0x3C, - 0xAF, 0x3C, 0xC2, 0xA8, 0x61, 0xE4, 0xBE, 0xB4, 0xD4, 0x5D, 0x92, 0xB3, 0x92, 0xB5, 0xAF, 0xB2, - 0xD1, 0x2B, 0xBE, 0xAD, 0x46, 0x36, 0xB6, 0xC8, 0xF1, 0xDF, 0x89, 0xBE, 0x1C, 0x9F, 0xE1, 0x67, - 0xC4, 0x3D, 0x1F, 0xE2, 0x67, 0xC1, 0x6D, 0x42, 0xF7, 0x53, 0xD0, 0x24, 0x95, 0xB5, 0x78, 0xDF, - 0x4F, 0xD2, 0x6E, 0xAC, 0xAC, 0xF4, 0x6F, 0x9F, 0x33, 0x5A, 0x32, 0x4B, 0x04, 0x43, 0xEC, 0xF2, - 0x2B, 0x36, 0x13, 0x61, 0x18, 0xC8, 0x20, 0x64, 0x2D, 0x74, 0x64, 0xD2, 0xA5, 0x9B, 0xE5, 0x2F, - 0x87, 0xF1, 0x54, 0x17, 0xB4, 0x8D, 0x9B, 0x6D, 0xAD, 0xFE, 0x1B, 0x36, 0x9B, 0x76, 0xF7, 0x53, - 0xBA, 0x6D, 0xAB, 0xA7, 0x16, 0xD9, 0xE8, 0xE5, 0x59, 0x8D, 0x0C, 0x7E, 0x5F, 0x1C, 0xA7, 0x38, - 0xAF, 0x1A, 0x92, 0x4F, 0x92, 0x3A, 0x3B, 0x49, 0x73, 0x7B, 0xAA, 0x37, 0xD2, 0x4D, 0x3D, 0x2E, - 0xAD, 0x7D, 0xAD, 0xA5, 0xCF, 0x56, 0xFD, 0xA4, 0xFC, 0x71, 0xFB, 0x3F, 0x7C, 0x6E, 0xF8, 0x63, - 0xE1, 0x9F, 0x1A, 0xE9, 0xBE, 0x3A, 0xB1, 0xD1, 0x3E, 0x2F, 0xE9, 0x5A, 0x54, 0x24, 0xF8, 0x4A, - 0x4D, 0x1F, 0x52, 0x92, 0x79, 0xE1, 0x77, 0x02, 0xE3, 0x4D, 0xBA, 0xBB, 0x4B, 0x51, 0x6C, 0x65, - 0x8C, 0x96, 0x91, 0x66, 0xDC, 0x03, 0x0D, 0xA8, 0x00, 0x0B, 0x5F, 0x31, 0xC2, 0xD9, 0x77, 0x15, - 0xF0, 0xC7, 0x12, 0x4E, 0x8E, 0x17, 0x0B, 0x27, 0x97, 0xCD, 0xA8, 0xC9, 0xA7, 0x15, 0x17, 0x07, - 0x74, 0xE6, 0x9D, 0xF9, 0x96, 0xDE, 0xEC, 0x53, 0x6D, 0x6E, 0xD6, 0xA9, 0x1E, 0xB6, 0x1E, 0x96, - 0x23, 0x2F, 0xB5, 0x1F, 0x67, 0xCD, 0x1B, 0xEC, 0xAE, 0xDA, 0xEC, 0x93, 0x71, 0x8C, 0x7D, 0xDD, - 0x6F, 0x7B, 0x69, 0x64, 0xBA, 0x5B, 0xF3, 0xD6, 0xCB, 0x47, 0xBF, 0xD5, 0x27, 0x10, 0x69, 0x76, - 0x37, 0x57, 0x65, 0xD8, 0x08, 0xD2, 0x18, 0x8B, 0xF5, 0x20, 0x01, 0x91, 0xC7, 0x52, 0x05, 0x7E, - 0xB7, 0x8B, 0xAB, 0x80, 0xCB, 0xE0, 0xE7, 0x8A, 0xAD, 0x18, 0xC5, 0x79, 0xC5, 0xEC, 0xAE, 0xD2, - 0xB5, 0xAF, 0xB3, 0xB5, 0x92, 0x5A, 0x6B, 0x67, 0xA2, 0xFA, 0xDC, 0x16, 0x59, 0x98, 0xE6, 0x75, - 0x1C, 0x32, 0xDC, 0x3C, 0xA6, 0xBC, 0x96, 0x89, 0x79, 0xBD, 0x22, 0x92, 0x5B, 0xB6, 0xD2, 0x4B, - 0x5D, 0x11, 0xE9, 0x7A, 0x5F, 0xC1, 0x1F, 0x1A, 0x5F, 0xC6, 0xB3, 0xDD, 0xDB, 0x5B, 0x69, 0x56, - 0xBB, 0x41, 0x69, 0x6F, 0x65, 0x55, 0xD8, 0xB9, 0x00, 0x9C, 0x74, 0xEE, 0x31, 0xC8, 0xCF, 0x6A, - 0xF8, 0x5C, 0xD3, 0x8F, 0x78, 0x6B, 0x0E, 0xD5, 0x1C, 0x3C, 0x9D, 0x59, 0x5B, 0x45, 0x18, 0xBB, - 0x7C, 0xB7, 0x76, 0xB2, 0xBB, 0xD1, 0x59, 0x6B, 0xD2, 0xC7, 0xD6, 0xE0, 0x7C, 0x3F, 0xCC, 0xEA, - 0xA4, 0xF1, 0xB5, 0x61, 0x49, 0x76, 0x57, 0x9C, 0xAD, 0xE4, 0xA2, 0xB9, 0x76, 0x4E, 0xD7, 0x92, - 0xDA, 0xCE, 0xC7, 0x62, 0xFF, 0x00, 0xB3, 0xF4, 0x1A, 0x75, 0x8C, 0xD7, 0xBA, 0xCE, 0xBC, 0x7C, - 0xAB, 0x68, 0x44, 0x93, 0x47, 0xA7, 0x46, 0x19, 0x94, 0x8C, 0x64, 0x29, 0x23, 0x07, 0x86, 0x5E, - 0x33, 0xEB, 0xE9, 0x8A, 0xF8, 0x2C, 0x67, 0x88, 0x2B, 0x12, 0xFD, 0x86, 0x1F, 0x0B, 0xC9, 0x16, - 0xD6, 0xB3, 0x7A, 0x47, 0x5B, 0x6B, 0xCA, 0xEE, 0xBE, 0xEB, 0x77, 0xB5, 0xB4, 0xFA, 0xAC, 0xB3, - 0xC3, 0x7C, 0xB2, 0xB5, 0x58, 0x61, 0xEA, 0x57, 0xA9, 0x3A, 0x8E, 0xC9, 0x28, 0xA8, 0x41, 0x5F, - 0x6D, 0xDF, 0x3E, 0x9A, 0x5A, 0xD6, 0x4E, 0xF6, 0x39, 0x96, 0xF0, 0x07, 0x84, 0xE2, 0x26, 0x37, - 0x9B, 0x50, 0x65, 0x00, 0xAC, 0x2E, 0xD8, 0x51, 0x23, 0x63, 0xE5, 0x0C, 0xA1, 0x88, 0xEA, 0x07, - 0x39, 0x1F, 0x4E, 0x80, 0xFE, 0x7F, 0xC7, 0x9C, 0x6B, 0xE2, 0x1E, 0x59, 0x81, 0x82, 0xC9, 0x68, - 0x53, 0xAB, 0x18, 0xBD, 0x6D, 0x09, 0x49, 0xD9, 0x5A, 0xDE, 0xEF, 0x34, 0x5D, 0xAF, 0x78, 0xCA, - 0xD7, 0x71, 0x7C, 0xAD, 0x2B, 0x58, 0xFB, 0x9A, 0x5E, 0x14, 0xF0, 0xCD, 0x2A, 0x14, 0xEB, 0x38, - 0x4A, 0x52, 0x6D, 0x47, 0x95, 0xD4, 0x7B, 0xB5, 0xA6, 0xD0, 0x8E, 0xFD, 0x12, 0xD1, 0xE8, 0xB4, - 0x7A, 0xA8, 0xFC, 0x4B, 0xF0, 0xC7, 0x44, 0xD1, 0x26, 0x8A, 0xDC, 0x59, 0xDE, 0x79, 0x8D, 0x1C, - 0x44, 0x5B, 0xC9, 0x70, 0x62, 0x9B, 0xE7, 0x23, 0x2A, 0xA3, 0x90, 0x48, 0xC8, 0xC0, 0x03, 0xF9, - 0x54, 0xE1, 0x73, 0xBC, 0x6C, 0xF0, 0x71, 0xAB, 0x9D, 0x42, 0x38, 0x69, 0x49, 0x2D, 0x2A, 0xA8, - 0xD3, 0x4B, 0x44, 0xFD, 0xDE, 0x66, 0xD6, 0xFA, 0x25, 0x77, 0x6B, 0x6A, 0x93, 0x22, 0xB7, 0x00, - 0xF0, 0x83, 0xCA, 0x9E, 0x63, 0x4A, 0x8C, 0xAF, 0x19, 0xA8, 0xB8, 0xC2, 0xA3, 0x4B, 0x95, 0xB4, - 0xB9, 0xB5, 0xBE, 0xCB, 0xA6, 0xD6, 0x5B, 0xA3, 0xE8, 0x7F, 0x09, 0xFF, 0x00, 0xC1, 0x31, 0x7F, - 0x6C, 0x0F, 0x8A, 0xFA, 0x4D, 0xB6, 0xB5, 0xF0, 0xD7, 0xF6, 0x7E, 0xF8, 0xA6, 0xBA, 0x24, 0xAA, - 0xB7, 0x2F, 0xAF, 0xF8, 0xC3, 0x41, 0x1E, 0x02, 0xF0, 0x74, 0x36, 0xCC, 0xA0, 0x9B, 0x87, 0xD5, - 0xF5, 0x36, 0xB5, 0xB5, 0x48, 0x40, 0x39, 0x32, 0x34, 0x9B, 0x31, 0x9F, 0x9B, 0x8E, 0x7F, 0x26, - 0xE3, 0x3F, 0x12, 0xB3, 0x2C, 0x1D, 0x6C, 0x3E, 0x0F, 0x26, 0x54, 0xAA, 0x61, 0x9C, 0xAD, 0x28, - 0xC2, 0x57, 0x94, 0x9A, 0x7F, 0x0D, 0xE3, 0x78, 0x7B, 0xC9, 0x5E, 0x2A, 0x32, 0x96, 0x9A, 0x4D, - 0x45, 0xD9, 0x1F, 0x2F, 0x9D, 0xF0, 0xA7, 0x01, 0x60, 0x69, 0xCA, 0xB6, 0x13, 0x34, 0xE5, 0x97, - 0x2D, 0xF9, 0x5B, 0x55, 0x39, 0x6C, 0x96, 0x8D, 0x41, 0x5E, 0xFA, 0x5A, 0xCA, 0x4E, 0xDB, 0xBB, - 0x23, 0xA3, 0x9F, 0xFE, 0x09, 0xA3, 0x17, 0x82, 0xE0, 0x5B, 0xBF, 0x8F, 0xDF, 0xB6, 0xA7, 0xEC, - 0x51, 0xF0, 0x3E, 0xDA, 0x38, 0xE4, 0x37, 0x7A, 0x4C, 0x7F, 0x14, 0xEF, 0xBE, 0x34, 0xF8, 0xBE, - 0xD1, 0xE3, 0x6C, 0x79, 0x42, 0xC7, 0xC2, 0xDA, 0x7E, 0xA5, 0x03, 0xB1, 0x0A, 0xC4, 0x2A, 0x5C, - 0xB1, 0x38, 0xE0, 0x1E, 0x71, 0xEE, 0x57, 0xE2, 0xCF, 0xED, 0x38, 0xD1, 0xA1, 0x97, 0x64, 0xF5, - 0xAF, 0xCA, 0x9C, 0xA3, 0xEE, 0x53, 0x69, 0xD9, 0x36, 0xBD, 0xED, 0x54, 0x75, 0x5D, 0x12, 0x7B, - 0xDE, 0xCA, 0xE7, 0xE7, 0x78, 0xAC, 0xA3, 0x1D, 0x81, 0x8B, 0xAD, 0x52, 0x9C, 0xFD, 0x8D, 0xED, - 0x19, 0xB8, 0x4A, 0x31, 0x7A, 0x5D, 0x2F, 0x79, 0x2B, 0x36, 0x96, 0xDF, 0x75, 0xF4, 0x31, 0xA1, - 0xF8, 0x09, 0xFF, 0x00, 0x04, 0xD7, 0xF0, 0xF5, 0xC5, 0xB5, 0x97, 0x89, 0xBF, 0x6E, 0x6F, 0x8D, - 0xBF, 0x16, 0x64, 0x54, 0x6B, 0xDB, 0xD5, 0xFD, 0x9D, 0xFF, 0x00, 0x63, 0xDB, 0xA1, 0xA4, 0x25, - 0xBC, 0x4B, 0xBA, 0x65, 0x17, 0x7E, 0x29, 0xD6, 0x34, 0x7B, 0x84, 0x60, 0xAA, 0xFF, 0x00, 0x38, - 0xB3, 0x91, 0x47, 0x07, 0x04, 0x0C, 0x57, 0xC5, 0x66, 0xB9, 0xC7, 0x88, 0x78, 0xAB, 0x61, 0x28, - 0xE5, 0xA9, 0x61, 0x5A, 0x7C, 0xB4, 0xE5, 0x4D, 0x27, 0x1E, 0x89, 0xCA, 0x53, 0x9C, 0x62, 0xFA, - 0x6C, 0xDA, 0x6A, 0xDA, 0xAD, 0x97, 0x0C, 0x5D, 0x28, 0x2E, 0x79, 0x24, 0xAD, 0x65, 0x76, 0xFA, - 0x69, 0xAA, 0xE5, 0x4E, 0xC9, 0x75, 0xBD, 0xAD, 0x6E, 0xCA, 0xE4, 0x0D, 0x65, 0xFF, 0x00, 0x04, - 0xA4, 0x82, 0xE2, 0x2B, 0x6F, 0x0F, 0x78, 0x2F, 0xFE, 0x0A, 0x3D, 0xF1, 0x24, 0xC2, 0x49, 0xFB, - 0x4A, 0x78, 0xB3, 0xE1, 0xDF, 0x80, 0xED, 0x6E, 0xF0, 0xC3, 0xCB, 0x51, 0x69, 0x1E, 0x8F, 0xA8, - 0x4A, 0x8A, 0x40, 0x39, 0xC4, 0xD9, 0x1C, 0x00, 0x7B, 0xD7, 0x93, 0x5F, 0x0B, 0xC5, 0xB1, 0xA5, - 0x0E, 0x77, 0x4A, 0x11, 0xFE, 0x5E, 0x78, 0xC2, 0xCA, 0xDD, 0x25, 0x04, 0xD5, 0xD3, 0xEC, 0x9A, - 0x4A, 0xDB, 0xB7, 0x60, 0xFA, 0xC5, 0x3A, 0x56, 0xF6, 0xD5, 0x20, 0xB6, 0x4F, 0xA7, 0xA2, 0x57, - 0x7D, 0xB4, 0xD5, 0x7A, 0x2E, 0x87, 0x71, 0x61, 0x65, 0xFB, 0x05, 0x4D, 0x23, 0x7F, 0x60, 0x7F, - 0xC1, 0x3E, 0x3F, 0x6B, 0xDF, 0x15, 0x5B, 0x04, 0x1F, 0x67, 0x3E, 0x26, 0xFD, 0xAF, 0x74, 0xBF, - 0x0A, 0x49, 0x28, 0x55, 0xF9, 0x77, 0xBC, 0x5E, 0x14, 0x65, 0x05, 0x88, 0x39, 0x0A, 0x0E, 0x06, - 0x30, 0x0D, 0x7C, 0xED, 0x6C, 0x17, 0x10, 0x41, 0x45, 0x3C, 0x5C, 0x54, 0x76, 0x76, 0xAA, 0xA6, - 0xED, 0x7D, 0xB4, 0xA5, 0xA5, 0x92, 0xF3, 0xBD, 0x92, 0x4B, 0x42, 0x23, 0x99, 0xE0, 0x21, 0x27, - 0xFB, 0xE4, 0xEF, 0xA4, 0x52, 0x83, 0xD3, 0xD6, 0xCF, 0x5E, 0xCB, 0x64, 0xFA, 0x6E, 0x91, 0xD9, - 0xE9, 0xBE, 0x04, 0xFD, 0x91, 0xB5, 0x34, 0x1B, 0xBF, 0xE0, 0x9A, 0xBF, 0x15, 0x74, 0xC0, 0xF1, - 0x92, 0x8D, 0x7F, 0xFF, 0x00, 0x05, 0x12, 0x01, 0x93, 0x8C, 0x0F, 0x91, 0x3C, 0x14, 0xD9, 0x23, - 0x23, 0x80, 0x3B, 0x11, 0x5E, 0x6C, 0xA7, 0x9A, 0xC6, 0xA7, 0x2E, 0x33, 0x1B, 0xA2, 0xD3, 0x47, - 0xCC, 0xFA, 0x69, 0x67, 0x08, 0xDB, 0x45, 0xDF, 0x7B, 0x2D, 0xAE, 0x44, 0xB3, 0x7C, 0x3C, 0x12, - 0xE5, 0x5D, 0x6D, 0x65, 0x0B, 0x5B, 0xB3, 0xD6, 0x69, 0x5B, 0xF1, 0xE9, 0x6E, 0x87, 0xAA, 0xE8, - 0xBF, 0xB2, 0x2F, 0xEC, 0x51, 0xE2, 0xB8, 0xD6, 0x5D, 0x47, 0xF6, 0x52, 0xFD, 0xAB, 0xBC, 0x23, - 0x0D, 0xE2, 0xC6, 0xA0, 0x78, 0x17, 0xF6, 0x9B, 0xD2, 0x3C, 0x5F, 0xF6, 0x14, 0x50, 0x37, 0xC9, - 0x04, 0xD7, 0x7E, 0x10, 0x55, 0x91, 0x8E, 0x3A, 0x3A, 0x00, 0x39, 0xEA, 0x06, 0x46, 0x2A, 0xAE, - 0x61, 0xCA, 0xF9, 0x6B, 0xCA, 0x53, 0xE9, 0x65, 0x14, 0x9A, 0x5F, 0xCD, 0x68, 0xF3, 0x6D, 0x65, - 0x78, 0xDD, 0x25, 0x7D, 0x51, 0x2B, 0x36, 0x93, 0xAA, 0xBD, 0x8D, 0x2B, 0xD3, 0x49, 0x5E, 0xE9, - 0xDE, 0xF6, 0xD1, 0x24, 0x9D, 0x92, 0xED, 0x76, 0x9D, 0xBA, 0x2B, 0x23, 0x76, 0x1F, 0xF8, 0x26, - 0xAF, 0xEC, 0x3B, 0xAE, 0x59, 0xC9, 0x1D, 0xB0, 0xFF, 0x00, 0x82, 0x80, 0x78, 0x26, 0xFC, 0xC1, - 0x21, 0x82, 0xEA, 0xE3, 0x4E, 0xF0, 0x3F, 0xC4, 0xAB, 0x31, 0x27, 0x22, 0x15, 0x6B, 0x61, 0x69, - 0xA5, 0x39, 0x00, 0x85, 0x0C, 0x3C, 0xC1, 0xD0, 0xE3, 0xDB, 0x69, 0x4F, 0x39, 0x95, 0x59, 0x4A, - 0xA5, 0x59, 0xA5, 0xA3, 0x49, 0x28, 0x49, 0x25, 0xDA, 0xEE, 0x2D, 0xB5, 0x65, 0x64, 0xF4, 0x6B, - 0xB3, 0x4B, 0x5D, 0x23, 0x9A, 0x41, 0x28, 0xC5, 0xD3, 0x49, 0xA7, 0x66, 0xAC, 0xD7, 0x45, 0xA2, - 0xD6, 0xD7, 0xBB, 0x5A, 0x68, 0xAD, 0xDB, 0xA7, 0x9E, 0xCD, 0xFF, 0x00, 0x04, 0x9B, 0xFD, 0x9F, - 0x35, 0x6B, 0xC4, 0xB5, 0xD0, 0x7F, 0x6B, 0xAF, 0x89, 0x7E, 0x10, 0x6F, 0x31, 0x61, 0x16, 0xDF, - 0x19, 0x3F, 0x64, 0x5F, 0x13, 0xE8, 0x82, 0x46, 0x72, 0x42, 0x91, 0x79, 0xA1, 0x49, 0xAC, 0xDA, - 0x45, 0x18, 0x0B, 0xF7, 0xE6, 0x92, 0x30, 0x72, 0x08, 0x1C, 0x10, 0x3D, 0x0F, 0x63, 0x99, 0x4E, - 0x92, 0x9E, 0x25, 0xA9, 0xC7, 0x5B, 0x28, 0xA5, 0x15, 0x1B, 0x5A, 0xFC, 0xD7, 0x92, 0x7B, 0x74, - 0x49, 0xB5, 0xDB, 0x54, 0x63, 0x0C, 0xDA, 0xBD, 0x56, 0xA3, 0x87, 0xA3, 0xCA, 0xD7, 0xC4, 0xA4, - 0x9A, 0x6D, 0x2D, 0xF9, 0x34, 0xB3, 0xB6, 0x97, 0xE9, 0xAA, 0xD7, 0x43, 0xB1, 0xD3, 0xFF, 0x00, - 0xE0, 0x84, 0xDE, 0x30, 0xD6, 0xAD, 0xF4, 0xF9, 0x3C, 0x15, 0xF1, 0x53, 0xE1, 0xFF, 0x00, 0xC5, - 0x26, 0xBF, 0x8B, 0x30, 0x5A, 0xF8, 0x17, 0xE2, 0x96, 0x87, 0xA2, 0xEB, 0x0C, 0x09, 0xFD, 0xD6, - 0x74, 0xDD, 0x69, 0x2C, 0x6E, 0x4B, 0x38, 0x20, 0xAA, 0x45, 0x1C, 0x87, 0x04, 0x0C, 0x7A, 0xF9, - 0xF5, 0x27, 0x8B, 0x8C, 0x9D, 0x1A, 0x54, 0xEC, 0x9D, 0x95, 0xAD, 0xAE, 0x8A, 0xFA, 0x2D, 0xAC, - 0xB6, 0x6E, 0xEB, 0x6D, 0x2C, 0x82, 0x96, 0x65, 0x8A, 0x74, 0xDD, 0x69, 0x72, 0xB8, 0xA7, 0x6B, - 0xD9, 0xA4, 0x96, 0x89, 0x76, 0xD3, 0xF0, 0xED, 0xD0, 0xF3, 0x5F, 0x1E, 0x7F, 0xC1, 0x22, 0xBC, - 0x51, 0xF0, 0x87, 0xCC, 0x6F, 0x8A, 0x1F, 0x0E, 0xFF, 0x00, 0x68, 0x3F, 0x08, 0xDB, 0xC7, 0x0A, - 0x5C, 0x3D, 0xEF, 0x88, 0x3C, 0x25, 0x26, 0x9B, 0xA5, 0xC5, 0x1B, 0x01, 0xB5, 0xBE, 0xD6, 0x2C, - 0xFC, 0x9C, 0x10, 0xCA, 0x73, 0xBF, 0xB8, 0xF5, 0x15, 0xC6, 0xAA, 0xD5, 0x51, 0x57, 0x94, 0x53, - 0x57, 0xD2, 0xCF, 0xA6, 0x9D, 0x1F, 0x7D, 0x17, 0xF9, 0x6D, 0x53, 0xCC, 0x31, 0x52, 0xA6, 0x9D, - 0x35, 0x6D, 0x2F, 0xA2, 0x4F, 0x45, 0x6E, 0xF7, 0x5F, 0xD7, 0xA2, 0x3E, 0x55, 0xD4, 0x7E, 0x04, - 0x7E, 0xCC, 0x9A, 0x27, 0x88, 0xED, 0xBC, 0x2B, 0xA9, 0xEB, 0x9E, 0x31, 0x4D, 0x52, 0xED, 0xDA, - 0x38, 0x21, 0x17, 0x29, 0xF3, 0xB2, 0x1C, 0x32, 0x03, 0xE5, 0x81, 0xC6, 0x06, 0x4E, 0x3F, 0xFA, - 0xDE, 0xA5, 0x2C, 0x9F, 0x34, 0xAD, 0x43, 0xDA, 0x42, 0x70, 0xB5, 0xBE, 0x1E, 0xB6, 0xF4, 0xBE, - 0x8B, 0xA5, 0xB4, 0xBE, 0xC9, 0x6C, 0x78, 0x32, 0xE2, 0xFF, 0x00, 0x63, 0xED, 0x5B, 0xA7, 0x37, - 0x4E, 0x9B, 0x51, 0x9C, 0xD4, 0x3D, 0xC8, 0xB7, 0x6B, 0x5D, 0xE9, 0xE5, 0x6B, 0x45, 0xDA, 0xFA, - 0xF9, 0x7A, 0xEC, 0x1F, 0xB1, 0x2F, 0xC1, 0x2B, 0x88, 0x62, 0x9A, 0x19, 0x7C, 0x52, 0x63, 0x74, - 0x0C, 0x9B, 0x75, 0xA1, 0xB4, 0x02, 0xA3, 0x1F, 0xC1, 0xF4, 0xE3, 0xA5, 0x7C, 0xEB, 0xA1, 0xCB, - 0x65, 0x39, 0x6A, 0x9E, 0x8B, 0xB5, 0xB4, 0xB2, 0xB3, 0xF8, 0x55, 0xB4, 0x5B, 0x2E, 0x8A, 0xFA, - 0x9E, 0xF5, 0x3C, 0xD3, 0x13, 0x3A, 0x71, 0x9A, 0xB5, 0x9F, 0x97, 0xF9, 0x3B, 0x2E, 0xC3, 0xFF, - 0x00, 0xE1, 0x87, 0x7E, 0x0A, 0x74, 0x1F, 0xF0, 0x94, 0x93, 0x8E, 0xDA, 0xC8, 0x23, 0x8F, 0x70, - 0x9E, 0xC6, 0xB8, 0xDE, 0x53, 0x85, 0xAA, 0xDD, 0x4B, 0xEE, 0xF5, 0xDF, 0x7E, 0xBD, 0x7B, 0x9B, - 0x2C, 0xD3, 0x19, 0x18, 0xE8, 0xD5, 0x97, 0x95, 0xBB, 0x7E, 0x9F, 0xD6, 0xC3, 0x7F, 0xE1, 0x87, - 0xFE, 0x0A, 0x0F, 0x97, 0x3E, 0x28, 0x04, 0x10, 0x98, 0x1A, 0xDA, 0x83, 0xDB, 0xA1, 0x29, 0x8E, - 0xE3, 0xF2, 0xA7, 0x4F, 0x2B, 0xC1, 0xD3, 0xBA, 0x49, 0x59, 0xAB, 0x6A, 0xAF, 0x6B, 0xA5, 0xB6, - 0xBA, 0x35, 0xD2, 0xC2, 0xFE, 0xD5, 0xC5, 0xAB, 0x5D, 0xAB, 0x7A, 0x5B, 0xF2, 0x7D, 0xBA, 0x75, - 0x35, 0x2F, 0x7F, 0x63, 0x9F, 0x84, 0x5A, 0x86, 0x95, 0xA6, 0xE9, 0x21, 0xBC, 0x41, 0x69, 0x6D, - 0xA4, 0xA3, 0xA2, 0xB5, 0xBD, 0xE4, 0x30, 0xCB, 0x71, 0xB9, 0xCB, 0x16, 0x9A, 0x41, 0x10, 0x32, - 0x63, 0xA7, 0xCC, 0x4E, 0x00, 0x18, 0xC6, 0x0E, 0x3D, 0x4C, 0x64, 0xFE, 0xB9, 0x95, 0xE1, 0xF2, - 0x8A, 0xB6, 0xF6, 0x34, 0x6F, 0xCB, 0x6B, 0xDF, 0x5B, 0xDA, 0xFA, 0xA5, 0xA5, 0xED, 0xB6, 0xDA, - 0x2B, 0x58, 0xE7, 0x58, 0xFC, 0x4D, 0x3A, 0xBE, 0xD1, 0x34, 0xDB, 0xDA, 0xEA, 0xF6, 0xD9, 0x3B, - 0x75, 0x4B, 0xCA, 0x36, 0x5A, 0xBB, 0xA6, 0xD9, 0xE9, 0x7A, 0x97, 0xEC, 0xF9, 0xF0, 0x3B, 0xFE, - 0x11, 0x1F, 0x04, 0xF8, 0x6F, 0x42, 0xF0, 0x35, 0x86, 0x91, 0x37, 0x87, 0x3C, 0x29, 0x77, 0xA1, - 0xF8, 0x8F, 0x55, 0xBA, 0xD3, 0xF4, 0xFD, 0x5E, 0xEF, 0xC6, 0x17, 0x77, 0x25, 0x80, 0xD4, 0xE5, - 0x77, 0x80, 0x48, 0x93, 0xC7, 0x1B, 0xA2, 0xA1, 0x0C, 0x76, 0x95, 0xC8, 0xE7, 0x18, 0xFB, 0x5E, - 0x16, 0xE2, 0xEC, 0x93, 0x86, 0xF2, 0x89, 0xE5, 0x78, 0xAC, 0x9E, 0x86, 0x26, 0x6D, 0x59, 0x4A, - 0xA4, 0x13, 0xD1, 0xA5, 0xA3, 0x6D, 0xDD, 0x27, 0xD5, 0x47, 0x46, 0xAD, 0x64, 0x9D, 0xDC, 0xBC, - 0x2C, 0x5C, 0x71, 0x58, 0xBC, 0xC2, 0x18, 0xF8, 0xE2, 0x67, 0x4E, 0x49, 0x25, 0x68, 0xCA, 0xD1, - 0x69, 0x3B, 0xD9, 0xC6, 0xDC, 0xAF, 0xAD, 0xB4, 0xBA, 0xD3, 0x6B, 0x59, 0xF8, 0xEF, 0x8D, 0xFF, - 0x00, 0x62, 0xEF, 0x85, 0x9A, 0xF4, 0xFA, 0x4C, 0x3A, 0x2E, 0xAD, 0xA9, 0xE9, 0x16, 0x7A, 0x1E, - 0x8B, 0x0E, 0x93, 0x0C, 0xDA, 0x46, 0x9F, 0x6B, 0x65, 0x26, 0xAC, 0x50, 0xE5, 0xAE, 0x6F, 0x81, - 0x8B, 0x2F, 0x39, 0x2C, 0xC0, 0xB7, 0x19, 0xC2, 0x81, 0xC0, 0x00, 0x7C, 0x87, 0x14, 0x4B, 0x25, - 0xCD, 0xF3, 0x57, 0x8B, 0xCB, 0x70, 0xB1, 0xA3, 0x49, 0x24, 0x94, 0x63, 0xCC, 0x94, 0xB4, 0x4D, - 0xDD, 0x39, 0x49, 0xC5, 0x27, 0xEE, 0xA5, 0x16, 0x92, 0x4A, 0xF6, 0xBB, 0x6C, 0xF5, 0x30, 0xB9, - 0xB6, 0x61, 0x86, 0xA4, 0xFD, 0xAB, 0x4E, 0x4F, 0xBA, 0xBD, 0xAD, 0xD1, 0x5B, 0x97, 0x4B, 0x79, - 0x3D, 0xB4, 0xF2, 0xF3, 0xD7, 0xFD, 0x84, 0x3C, 0x39, 0x05, 0xBC, 0xE9, 0x63, 0xE3, 0xCD, 0x62, - 0x33, 0x30, 0x58, 0x4F, 0xDA, 0xB4, 0xC8, 0x25, 0x2A, 0x33, 0xDB, 0x69, 0x5E, 0x31, 0x9E, 0xC7, - 0xA0, 0xFC, 0x7D, 0x6E, 0x19, 0xC5, 0xAC, 0x83, 0x87, 0x33, 0x3A, 0x58, 0x68, 0x3B, 0xE2, 0x62, - 0xA8, 0xB9, 0x3B, 0x5D, 0x42, 0x51, 0x77, 0x49, 0x24, 0x93, 0xD6, 0xDA, 0x37, 0x65, 0xDA, 0xF6, - 0x15, 0x5C, 0xF3, 0x11, 0x3A, 0xB4, 0xFD, 0xA4, 0x15, 0xE3, 0xAE, 0x8A, 0xCB, 0xCB, 0x4B, 0xF7, - 0xB5, 0x9A, 0x69, 0x79, 0x6D, 0x6E, 0x1E, 0xFB, 0xF6, 0x0F, 0xB9, 0x4F, 0xF8, 0xF0, 0xF8, 0x85, - 0x6C, 0x40, 0x07, 0x02, 0xEB, 0x45, 0x6C, 0x11, 0xC6, 0xD0, 0x19, 0x64, 0x03, 0xA0, 0x6E, 0xDC, - 0x6D, 0xAF, 0x8A, 0x96, 0x45, 0x46, 0xA4, 0x12, 0xA5, 0x51, 0xF3, 0x2B, 0x2B, 0xBB, 0x35, 0xD9, - 0x5A, 0xC9, 0x59, 0x5A, 0xC9, 0x2B, 0xF4, 0x7D, 0x12, 0x3B, 0x69, 0x71, 0x2D, 0x48, 0xE9, 0x52, - 0x94, 0x6D, 0xD2, 0xCD, 0xAB, 0x74, 0xF3, 0xEB, 0xB6, 0xD7, 0xEC, 0xBA, 0x70, 0xFA, 0x9F, 0xEC, - 0x57, 0xE2, 0xEB, 0x16, 0x55, 0x87, 0xC6, 0x7E, 0x13, 0x62, 0xF8, 0x58, 0xE3, 0xBC, 0x79, 0x2C, - 0x64, 0x93, 0xFD, 0xD5, 0xF9, 0xB3, 0xD3, 0xB5, 0x25, 0xC3, 0x15, 0xE5, 0x04, 0xE8, 0x4F, 0x9B, - 0xD2, 0x3A, 0x25, 0xA7, 0x5B, 0xAB, 0x7E, 0x16, 0xB0, 0x2E, 0x2D, 0xC3, 0xD3, 0x51, 0x8D, 0x7A, - 0x6A, 0x32, 0x7B, 0x2E, 0x64, 0x97, 0x45, 0xD5, 0x27, 0xE5, 0xA2, 0x7D, 0x3E, 0x5C, 0x7E, 0xA1, - 0xFB, 0x21, 0xFC, 0x5D, 0xB0, 0x0C, 0x62, 0x8B, 0xC3, 0x97, 0xEA, 0x00, 0x31, 0x8B, 0x5D, 0x64, - 0x23, 0x38, 0x39, 0xC0, 0x01, 0xD1, 0x54, 0x7D, 0xD3, 0xD4, 0x8E, 0x9E, 0xDC, 0x62, 0xF8, 0x6B, - 0x1A, 0x9D, 0xA1, 0x28, 0xDB, 0xE6, 0xBA, 0x76, 0xB7, 0xDD, 0x6D, 0x7C, 0x96, 0x88, 0xE8, 0x8F, - 0x15, 0xE5, 0xE9, 0xA8, 0xCE, 0x12, 0x4A, 0xDB, 0xD9, 0x5B, 0xE5, 0xAD, 0xFF, 0x00, 0x0F, 0x43, - 0xB9, 0xF8, 0x73, 0xF0, 0x8B, 0xE2, 0xEC, 0x7E, 0x36, 0xD0, 0x2E, 0x7C, 0x6B, 0xA1, 0x6A, 0x13, - 0x5A, 0xE8, 0x3A, 0x4C, 0x3A, 0x26, 0x8D, 0x31, 0xD3, 0xAD, 0x7C, 0x53, 0x67, 0x6B, 0x02, 0x9C, - 0x0B, 0x76, 0xB2, 0x84, 0x3D, 0xC4, 0x91, 0x08, 0x4D, 0xC2, 0x9F, 0x25, 0x1A, 0x45, 0x2C, 0xA7, - 0xA6, 0x6B, 0xDF, 0xC9, 0xB2, 0x0A, 0xEA, 0x51, 0xAF, 0x39, 0x72, 0xCA, 0x36, 0x56, 0xF7, 0x67, - 0x77, 0xD6, 0xD1, 0xE5, 0x49, 0x45, 0xA4, 0xD3, 0x77, 0x93, 0x8A, 0xB3, 0x4A, 0x4B, 0x6E, 0x1C, - 0x5E, 0x7B, 0x93, 0xCB, 0x08, 0xE1, 0x4E, 0x56, 0x52, 0x7B, 0x59, 0xA7, 0x7E, 0xF7, 0xD9, 0x3B, - 0xA5, 0xAB, 0xFD, 0x34, 0xD5, 0xFD, 0xA2, 0x3C, 0x03, 0x79, 0xAF, 0xF8, 0xBF, 0x40, 0xD0, 0xFC, - 0x2F, 0x67, 0x6F, 0x3F, 0xF6, 0x9D, 0xDF, 0xF6, 0x57, 0x86, 0xED, 0xF4, 0xED, 0x2A, 0xF2, 0x18, - 0xB4, 0x8D, 0x16, 0xD4, 0xAC, 0x7A, 0x54, 0x72, 0x08, 0xA2, 0x10, 0x80, 0x11, 0xE7, 0x62, 0xAC, - 0xA6, 0x54, 0x08, 0x77, 0x00, 0x4E, 0x0F, 0xD0, 0x67, 0xB9, 0x6D, 0x7A, 0xB4, 0x70, 0x99, 0x56, - 0x0A, 0x2E, 0x31, 0xA8, 0xD4, 0x9F, 0x95, 0x38, 0x35, 0xCA, 0xDC, 0xAC, 0xF5, 0x69, 0xA6, 0x9C, - 0x74, 0x6A, 0x2D, 0x35, 0x74, 0x91, 0x39, 0x56, 0x65, 0x96, 0x51, 0xF6, 0xB8, 0xBC, 0x46, 0x22, - 0x2B, 0x95, 0x45, 0x25, 0xCB, 0x67, 0x26, 0xEC, 0xA5, 0xC8, 0xAC, 0x9B, 0x69, 0xA4, 0xA5, 0xCC, - 0xD3, 0x77, 0x49, 0xAB, 0xD8, 0xF2, 0x5B, 0x9F, 0x07, 0xEB, 0x7A, 0x8F, 0x8F, 0x3C, 0x4F, 0x73, - 0xF6, 0x18, 0x12, 0xC7, 0xE1, 0x46, 0x93, 0x1F, 0xFC, 0x24, 0xD3, 0x49, 0x25, 0xC6, 0xAB, 0xA2, - 0xDA, 0x3D, 0x90, 0x16, 0xF1, 0x4B, 0x24, 0x8E, 0x89, 0xB2, 0x39, 0xA6, 0x44, 0xC6, 0xE2, 0xBD, - 0x70, 0x0E, 0x70, 0x07, 0x9B, 0x4E, 0xA6, 0x1E, 0xB7, 0x11, 0xD4, 0xFA, 0xD5, 0x48, 0xBC, 0x35, - 0x38, 0x38, 0xB9, 0x25, 0x28, 0xA4, 0xD4, 0x1F, 0x2B, 0x4A, 0xCE, 0x57, 0xDE, 0x29, 0xD9, 0x5D, - 0xDD, 0x34, 0x95, 0xCE, 0xDC, 0x35, 0x3C, 0x1D, 0x1C, 0xB5, 0xAA, 0x11, 0x76, 0xA9, 0x2E, 0x64, - 0xED, 0xAC, 0x94, 0x9A, 0xD2, 0xC9, 0x6C, 0xAE, 0x97, 0x2C, 0xB4, 0xB7, 0xBB, 0x67, 0x14, 0x79, - 0xA0, 0xD2, 0xF5, 0xA8, 0x7C, 0x27, 0xAD, 0x78, 0xDA, 0x7D, 0x1F, 0x45, 0x1A, 0x4E, 0xBD, 0xAE, - 0x3E, 0x91, 0x65, 0x75, 0x2A, 0x45, 0x2D, 0xC5, 0xA5, 0xDA, 0x91, 0x24, 0xB1, 0xDA, 0x43, 0xB8, - 0x94, 0x01, 0x25, 0xC6, 0x4A, 0x91, 0x85, 0x00, 0x1C, 0x8E, 0x7E, 0x69, 0x50, 0xC1, 0xC3, 0x01, - 0x8D, 0x9D, 0x79, 0x4B, 0xDA, 0xD4, 0x95, 0xA1, 0x16, 0xD2, 0x6A, 0xCD, 0xB6, 0xE4, 0xF4, 0xD6, - 0xD6, 0x6A, 0xD6, 0xD6, 0x3A, 0x5F, 0x67, 0xEA, 0xC6, 0xAA, 0xA7, 0x8C, 0xC3, 0xA8, 0x5E, 0xF1, - 0x57, 0xD9, 0x72, 0xD9, 0x6D, 0xCD, 0x1D, 0x17, 0x4D, 0x17, 0x2B, 0x5D, 0x2C, 0x93, 0x4D, 0x69, - 0x45, 0xE0, 0x5F, 0x16, 0x6A, 0x97, 0x5E, 0x1A, 0xF8, 0x77, 0x61, 0xE1, 0x5B, 0x73, 0xE2, 0x4B, - 0xDB, 0xF2, 0xF6, 0xE2, 0x2F, 0x21, 0x75, 0x1D, 0x45, 0xA7, 0x8C, 0xB2, 0x42, 0xD3, 0x6E, 0xDB, - 0x85, 0x58, 0x5C, 0x85, 0x27, 0x8E, 0x78, 0x1D, 0xFE, 0x93, 0x37, 0xCA, 0x70, 0x78, 0x58, 0xE0, - 0x72, 0x2C, 0x1D, 0x39, 0x3A, 0xEB, 0x92, 0x55, 0x92, 0x70, 0x51, 0xB2, 0x4A, 0xE9, 0xDD, 0xE8, - 0xDB, 0x7E, 0xEF, 0x3A, 0x49, 0xB5, 0xB5, 0xAC, 0xDC, 0xE1, 0xB1, 0x54, 0xB1, 0x14, 0x2B, 0x63, - 0x61, 0x27, 0x68, 0x35, 0x1B, 0x3D, 0x1D, 0xE5, 0x7B, 0x5A, 0x2D, 0x45, 0xE8, 0x93, 0xBB, 0xBF, - 0x2A, 0xB6, 0x96, 0xD4, 0xA0, 0xBE, 0x10, 0xBE, 0xFE, 0xD0, 0xD7, 0x6F, 0xEE, 0x34, 0x6B, 0xD3, - 0xA3, 0x78, 0x7A, 0x46, 0xB3, 0xD4, 0x1E, 0xDE, 0xD4, 0xC0, 0xB0, 0x4A, 0x43, 0xAC, 0x68, 0xC5, - 0x54, 0x46, 0x1C, 0x98, 0xDB, 0x0A, 0xA4, 0x67, 0x1C, 0x71, 0x92, 0x3C, 0x5C, 0x77, 0xF6, 0x2E, - 0x2F, 0x34, 0xC4, 0xB7, 0x85, 0xA9, 0x4F, 0x0B, 0x08, 0xF2, 0xC1, 0x28, 0xDD, 0xF3, 0x27, 0x16, - 0x93, 0xE5, 0x93, 0x51, 0xBA, 0x76, 0x5A, 0xB5, 0x6F, 0xC1, 0xCB, 0xDB, 0x60, 0xB0, 0xD4, 0x3D, - 0x9C, 0xEC, 0xE6, 0x94, 0xEE, 0xE4, 0x9B, 0x51, 0xBB, 0x56, 0x6D, 0xCA, 0x2F, 0x75, 0x67, 0x67, - 0xA2, 0xBA, 0xDE, 0xC8, 0xC0, 0xFF, 0x00, 0x84, 0x57, 0x54, 0x4D, 0x16, 0xCB, 0x51, 0x97, 0x4E, - 0xD4, 0x52, 0xE3, 0x57, 0xBF, 0x16, 0x7A, 0x1D, 0xB4, 0x9A, 0x65, 0xC0, 0xFE, 0xD6, 0x89, 0x4F, - 0x97, 0x23, 0xDA, 0xC8, 0x17, 0x63, 0xED, 0x94, 0x47, 0x1E, 0xD0, 0x49, 0xCB, 0x01, 0x8E, 0xC5, - 0x50, 0xC2, 0xE0, 0x70, 0x39, 0x1C, 0xAA, 0x54, 0xA2, 0xBE, 0xB3, 0x56, 0xAF, 0x22, 0xD6, 0x4B, - 0x96, 0x9D, 0x93, 0x6D, 0x59, 0xFB, 0xAF, 0x99, 0x72, 0xDD, 0xB7, 0x75, 0x74, 0xD3, 0x5B, 0xF5, - 0x53, 0x94, 0x2A, 0xCB, 0x96, 0x93, 0xD5, 0x24, 0xF4, 0xE5, 0xB3, 0xBA, 0x6F, 0x6B, 0xA6, 0xDB, - 0x5A, 0xE8, 0xAD, 0x6F, 0x3D, 0xBA, 0x79, 0xBC, 0x09, 0xA9, 0xDC, 0x6B, 0x7A, 0x3F, 0x84, 0x74, - 0xEF, 0x0F, 0xEB, 0x6D, 0xA9, 0xDA, 0x59, 0xAC, 0xDE, 0x20, 0x9A, 0x0D, 0x13, 0x55, 0x7B, 0xEB, - 0x28, 0x09, 0xDF, 0x71, 0x3C, 0xF6, 0x4D, 0x08, 0x78, 0xE2, 0x8A, 0x27, 0x04, 0xB2, 0xC7, 0x8D, - 0xAB, 0xBB, 0x3C, 0xF1, 0xCB, 0x8A, 0xCB, 0x30, 0x78, 0x7C, 0x45, 0x1C, 0x0E, 0x1A, 0x9F, 0xBF, - 0x3B, 0x73, 0x4A, 0x51, 0x8B, 0xE5, 0x4D, 0x2B, 0x34, 0xE3, 0x29, 0x27, 0x65, 0x77, 0x29, 0x35, - 0x1E, 0x5B, 0x5D, 0x24, 0x91, 0x9D, 0x2A, 0xB2, 0xA4, 0xAA, 0xD4, 0x8D, 0x45, 0xCC, 0xD3, 0x76, - 0x57, 0xD2, 0xCA, 0xD6, 0xD1, 0x26, 0xD3, 0xB2, 0xBA, 0xF7, 0x9B, 0xD9, 0x59, 0x68, 0x5A, 0xD5, - 0x34, 0xAF, 0x05, 0x69, 0x36, 0x96, 0xF2, 0x5D, 0xD9, 0xEA, 0x1A, 0x77, 0xF6, 0xFE, 0xA2, 0xAF, - 0xA6, 0xDD, 0x5B, 0xC7, 0x35, 0xD4, 0xBA, 0x6E, 0x9B, 0x01, 0x0A, 0x2F, 0xAD, 0x11, 0xCC, 0x69, - 0x3F, 0x9E, 0xC9, 0x26, 0x15, 0x9C, 0x6D, 0x1B, 0x48, 0xC7, 0x7D, 0x33, 0x3C, 0xAF, 0x2F, 0xC1, - 0xE0, 0x28, 0xCE, 0x69, 0x35, 0x51, 0xAB, 0x28, 0xB8, 0xEC, 0x92, 0xBE, 0xAD, 0xB6, 0x95, 0xAD, - 0x67, 0x67, 0x1D, 0x5B, 0x4E, 0xEA, 0xC1, 0x85, 0xA9, 0x8B, 0xA5, 0x17, 0x3A, 0x32, 0x6E, 0x71, - 0xB7, 0x2B, 0x97, 0xBA, 0xEF, 0xA3, 0x57, 0x4A, 0x29, 0x2B, 0x5F, 0xA2, 0x5D, 0x13, 0x57, 0xDB, - 0xC9, 0xEE, 0x64, 0x12, 0x4F, 0x23, 0x2C, 0x92, 0x4B, 0x18, 0x62, 0xB0, 0xBC, 0xB1, 0xAC, 0x52, - 0x32, 0x29, 0xC2, 0x16, 0x40, 0x48, 0x53, 0x80, 0x38, 0x04, 0x81, 0xEB, 0x5F, 0x23, 0x1A, 0x74, - 0xE9, 0x27, 0x0A, 0x4A, 0xD1, 0xE8, 0x7A, 0x3C, 0xF5, 0x6A, 0x46, 0x2E, 0xB4, 0x9B, 0x92, 0x49, - 0x6A, 0xDB, 0xD9, 0x6D, 0x77, 0xAD, 0x97, 0x4F, 0x22, 0x0A, 0xA0, 0x0A, 0x00, 0x55, 0x52, 0x70, - 0x14, 0x7D, 0x00, 0x1D, 0x38, 0xE3, 0xF9, 0x56, 0xD8, 0x7C, 0x35, 0x6C, 0x4C, 0xD5, 0x2C, 0x3C, - 0x2E, 0xFC, 0xBA, 0x7F, 0x91, 0x2E, 0x51, 0x82, 0x57, 0xD8, 0xE8, 0x2D, 0x2C, 0xC4, 0x11, 0xA4, - 0xCF, 0x1E, 0x41, 0x03, 0x74, 0x68, 0x01, 0x74, 0x5C, 0x75, 0x3D, 0x38, 0x15, 0xFD, 0x3D, 0xC1, - 0xFC, 0x1B, 0x1C, 0x83, 0x2E, 0xA3, 0x9F, 0x62, 0x70, 0xD2, 0x94, 0x5A, 0x4A, 0x74, 0xE9, 0xC5, - 0x3A, 0x94, 0xE2, 0xD2, 0xBC, 0xE6, 0xDD, 0x97, 0x2A, 0xFB, 0x4E, 0x32, 0x7A, 0x2D, 0x22, 0xF4, - 0x3C, 0x3A, 0xF8, 0x8F, 0x69, 0x27, 0x4A, 0x2D, 0x2E, 0xCF, 0xA7, 0xA2, 0xFD, 0x34, 0x47, 0x49, - 0x1C, 0x49, 0xE5, 0xAB, 0x26, 0x19, 0x0A, 0x82, 0xA5, 0x7A, 0x11, 0x8E, 0x30, 0x3F, 0x0A, 0xFE, - 0xAB, 0xCB, 0xB2, 0xDC, 0x33, 0xCB, 0xE8, 0xE2, 0x30, 0x32, 0x52, 0xA3, 0x38, 0xA9, 0x46, 0x49, - 0xBB, 0x34, 0xD6, 0x8F, 0x64, 0xD7, 0xCD, 0x2D, 0x0F, 0x0E, 0x53, 0xB3, 0x71, 0x92, 0xB3, 0x5A, - 0x58, 0x0A, 0x00, 0x06, 0xD0, 0x06, 0x31, 0x8E, 0xC3, 0x18, 0xE3, 0x1F, 0xA5, 0x5C, 0xF0, 0xAE, - 0x2B, 0xDD, 0x56, 0xB7, 0xDC, 0xD6, 0x9B, 0x74, 0xFC, 0x81, 0x35, 0x65, 0x62, 0x2C, 0x63, 0x8E, - 0x06, 0x38, 0xC0, 0x1D, 0x87, 0x61, 0x5E, 0x25, 0x4C, 0x2C, 0xEF, 0x75, 0x6E, 0x55, 0xD3, 0xCB, - 0xB2, 0xE8, 0xBB, 0x2F, 0x97, 0xA1, 0xAC, 0x5C, 0x62, 0x92, 0x48, 0x00, 0x1C, 0x71, 0x8C, 0x0C, - 0x01, 0xC0, 0xC7, 0x1D, 0x3F, 0x41, 0x51, 0xF5, 0x78, 0x69, 0xEE, 0xB5, 0x6F, 0x2F, 0xEA, 0xDF, - 0x2F, 0x45, 0x60, 0xE6, 0x69, 0x69, 0x62, 0x8D, 0xFD, 0x92, 0x5C, 0x42, 0xA3, 0x18, 0x91, 0x40, - 0xD8, 0x7B, 0x28, 0xC7, 0x03, 0xF4, 0xAF, 0x82, 0xF1, 0x27, 0x81, 0xB0, 0x7C, 0x57, 0x93, 0xD3, - 0xA2, 0xD5, 0xB1, 0x31, 0x8D, 0xE1, 0x27, 0xB4, 0x52, 0x5D, 0x5A, 0x5F, 0x7A, 0xB6, 0xDA, 0x69, - 0xA1, 0xD5, 0x82, 0xC4, 0x4A, 0x84, 0xEE, 0xBE, 0x1E, 0xA7, 0x20, 0xF1, 0x98, 0x9C, 0xC6, 0xC0, - 0x02, 0x87, 0x1C, 0x0C, 0x0C, 0x0E, 0x98, 0x1F, 0x95, 0x7F, 0x0C, 0x66, 0xB9, 0x66, 0x23, 0x27, - 0xC7, 0xD5, 0xCB, 0xB1, 0x4B, 0xDF, 0x83, 0xB6, 0xCD, 0x27, 0x6D, 0x9A, 0xBA, 0x5A, 0x5B, 0xC8, - 0xFA, 0x7A, 0x53, 0x8D, 0x48, 0x29, 0x47, 0x61, 0x95, 0xE7, 0x9A, 0x1F, 0xA3, 0x5F, 0xB1, 0xDF, - 0xEC, 0x78, 0x7E, 0x28, 0x1B, 0x3F, 0x1C, 0xF8, 0xE6, 0xCE, 0x46, 0xF0, 0xDF, 0x9A, 0xAF, 0xA4, - 0x68, 0xE4, 0x05, 0x5D, 0x49, 0x54, 0x9F, 0xDE, 0x4C, 0xB8, 0xE5, 0x4E, 0xD1, 0xB5, 0x7A, 0x10, - 0x09, 0x39, 0x1C, 0x0F, 0xAD, 0xE1, 0xEE, 0x1D, 0xAB, 0x99, 0x54, 0x8E, 0x9A, 0x68, 0xDB, 0xE9, - 0x15, 0xBA, 0xB7, 0x46, 0xDA, 0x5B, 0x74, 0xEA, 0xBB, 0x7C, 0xDE, 0x73, 0x9B, 0xC7, 0x05, 0x0E, - 0x48, 0xBD, 0x36, 0xEC, 0xDB, 0x76, 0x56, 0x4F, 0xA2, 0x5E, 0x49, 0xDF, 0x44, 0x95, 0xF4, 0x7F, - 0xD0, 0xFF, 0x00, 0xC2, 0xFF, 0x00, 0xD9, 0xAB, 0xC3, 0xBA, 0x26, 0x8F, 0x69, 0x01, 0xD3, 0x6D, - 0xB4, 0xAB, 0x48, 0xA0, 0x45, 0x86, 0xC6, 0xC6, 0x04, 0x80, 0xA0, 0x0B, 0xB5, 0x54, 0xED, 0x5E, - 0x3B, 0x0C, 0x73, 0xD4, 0xF4, 0xC0, 0xCF, 0xE8, 0x70, 0xA5, 0x95, 0xE5, 0x91, 0x54, 0xF0, 0xB4, - 0x94, 0xA7, 0xB3, 0x94, 0xB5, 0x6E, 0xD6, 0xDB, 0x6F, 0xF2, 0x56, 0xD1, 0x58, 0xF9, 0x35, 0xF5, - 0xFC, 0xC2, 0xD2, 0x9C, 0xF9, 0x29, 0xE9, 0x64, 0xBB, 0x6B, 0x65, 0xA5, 0xBD, 0x35, 0xBD, 0xED, - 0xBD, 0x99, 0xED, 0x9F, 0xF0, 0xA9, 0xBC, 0x0C, 0x22, 0xF2, 0x1B, 0x4E, 0x80, 0xE5, 0x40, 0x04, - 0xBA, 0x86, 0x50, 0x00, 0x03, 0x00, 0x77, 0x19, 0x1C, 0x77, 0xE0, 0x77, 0xAA, 0x8E, 0x3A, 0xBA, - 0xB7, 0x2C, 0x55, 0xBD, 0x17, 0xF9, 0x6D, 0xA7, 0xF5, 0x65, 0x66, 0xB2, 0xDC, 0x3A, 0x87, 0x2B, - 0x9C, 0xAF, 0xEA, 0xBB, 0x5B, 0x55, 0xB6, 0xD6, 0xDD, 0x75, 0x5D, 0x16, 0x9E, 0x3B, 0xF1, 0x13, - 0xF6, 0x6C, 0xF0, 0xC6, 0xBF, 0xA6, 0xDD, 0x47, 0xA7, 0xDB, 0xDB, 0x4E, 0xCD, 0x13, 0x2B, 0xD8, - 0xDD, 0x46, 0x93, 0x43, 0x2A, 0x95, 0x19, 0x50, 0x08, 0x38, 0xE3, 0x23, 0x27, 0x8F, 0x63, 0x9C, - 0x07, 0x2F, 0xA8, 0x63, 0xA2, 0xA9, 0xE3, 0xA9, 0x2B, 0x59, 0x2B, 0xA5, 0xAA, 0xF9, 0xAD, 0x56, - 0xDA, 0x25, 0xE6, 0xAF, 0xA6, 0xB0, 0xE8, 0xE2, 0xF0, 0x51, 0xBE, 0x12, 0xAB, 0x71, 0x49, 0x5E, - 0x32, 0xBB, 0x56, 0xB7, 0x4D, 0xDE, 0x9D, 0x34, 0xED, 0xBA, 0x3F, 0x9F, 0xDF, 0xDB, 0x0B, 0xF6, - 0x2C, 0x6F, 0x01, 0xC1, 0xA8, 0x78, 0xEF, 0xC0, 0x7A, 0x64, 0x96, 0x96, 0x96, 0x8C, 0xD2, 0xEB, - 0xBE, 0x1E, 0x85, 0x14, 0x45, 0x02, 0x80, 0x4B, 0xCB, 0x02, 0x0C, 0x6D, 0xC0, 0x00, 0xED, 0x03, - 0x91, 0xD0, 0x0C, 0x73, 0xF0, 0x1C, 0x43, 0xC3, 0x8F, 0x01, 0x35, 0x3A, 0x29, 0x72, 0x35, 0xEE, - 0xB5, 0x6B, 0x4B, 0xAD, 0x9D, 0xB4, 0xE6, 0xED, 0x6D, 0x1E, 0xDB, 0xED, 0xF5, 0x39, 0x1E, 0x73, - 0xF5, 0xBA, 0x71, 0x85, 0x4E, 0x9A, 0x5B, 0xAA, 0x7D, 0x2D, 0x65, 0xAA, 0x7B, 0x74, 0xB5, 0xAD, - 0xA5, 0xB5, 0xF9, 0xC3, 0xF6, 0x0D, 0xBB, 0xBA, 0xB6, 0xFD, 0xB5, 0xFF, 0x00, 0x64, 0x18, 0x6D, - 0xEE, 0x6E, 0x20, 0x86, 0xE7, 0xF6, 0xA3, 0xF8, 0x7D, 0x1D, 0xCC, 0x50, 0xCC, 0xD1, 0x45, 0x70, - 0xA3, 0xC5, 0x76, 0x20, 0x2C, 0x8A, 0x08, 0x0C, 0x30, 0xCC, 0x30, 0x47, 0x73, 0xEB, 0x5F, 0x2F, - 0x96, 0x69, 0x98, 0x61, 0xD2, 0xDB, 0x9E, 0x1F, 0xFA, 0x52, 0x3E, 0x87, 0x12, 0x97, 0xD5, 0xAA, - 0x69, 0xF6, 0x5F, 0xE4, 0x7F, 0xA0, 0x6D, 0x7E, 0xA6, 0x7C, 0x70, 0x50, 0x01, 0x40, 0x05, 0x00, - 0x7F, 0x14, 0x5F, 0xF0, 0x5A, 0xFF, 0x00, 0xF9, 0x48, 0x1F, 0xC4, 0x8F, 0xFB, 0x12, 0xFC, 0x27, - 0xFF, 0x00, 0xA8, 0xF5, 0xAD, 0x7E, 0x75, 0xC4, 0x1F, 0xF2, 0x34, 0x9F, 0xA4, 0x7F, 0xF4, 0x94, - 0x7D, 0x46, 0x57, 0xFE, 0xE5, 0x1F, 0x9F, 0xE6, 0x7E, 0x78, 0x7C, 0x31, 0xF8, 0x37, 0xE3, 0x9F, - 0x8B, 0x1A, 0x9C, 0x1A, 0x7F, 0x85, 0xB4, 0xC5, 0x5B, 0x47, 0xB8, 0x5B, 0x5B, 0x8D, 0x73, 0x52, - 0x63, 0x65, 0xA2, 0x59, 0x31, 0xC6, 0x55, 0xA6, 0xC1, 0xDC, 0xC0, 0x10, 0x76, 0x46, 0xAE, 0xD8, - 0xFE, 0x1C, 0x57, 0x1E, 0x0B, 0x2E, 0xC4, 0xE3, 0x54, 0xA5, 0x46, 0x3E, 0xE4, 0x56, 0xAF, 0xA2, - 0xF2, 0xFE, 0xB4, 0xEF, 0x61, 0xE3, 0x73, 0x2C, 0x26, 0x03, 0x96, 0x15, 0xA5, 0xEF, 0xCB, 0x48, - 0xC5, 0x6E, 0xFF, 0x00, 0x44, 0x97, 0x9F, 0xCB, 0xB1, 0xF7, 0xB7, 0x89, 0xFF, 0x00, 0xE0, 0x9E, - 0xED, 0xE0, 0x2F, 0x06, 0x47, 0xAC, 0x2F, 0xC4, 0x9B, 0x8B, 0x8F, 0x13, 0xB1, 0x8F, 0x2D, 0x6B, - 0x60, 0xDA, 0x7E, 0x8D, 0x01, 0xE3, 0x7A, 0x05, 0x0D, 0xE6, 0x9F, 0xBC, 0xA0, 0x31, 0x61, 0xD3, - 0xEE, 0xF6, 0xAF, 0xAF, 0xE1, 0x7F, 0xAB, 0xD1, 0xAB, 0x2C, 0x1C, 0xE5, 0x51, 0xC1, 0xB4, 0xDA, - 0x53, 0x94, 0x22, 0xDA, 0xEF, 0x18, 0xC9, 0x27, 0xDB, 0x57, 0xB6, 0x9A, 0x2B, 0x9F, 0x3D, 0x9B, - 0xE6, 0x98, 0xCC, 0x35, 0x38, 0xE2, 0xA9, 0x53, 0x83, 0x84, 0x77, 0x4F, 0x77, 0x75, 0x64, 0x94, - 0xAC, 0xD4, 0x6D, 0xBD, 0xF9, 0x5A, 0x69, 0x5B, 0x4B, 0xDD, 0x67, 0x78, 0x53, 0xF6, 0x06, 0xF1, - 0xE6, 0xAD, 0xA4, 0x5B, 0xEB, 0x17, 0x5E, 0x26, 0xD0, 0x61, 0x96, 0xE7, 0x32, 0x1D, 0xB6, 0x93, - 0x5C, 0x45, 0x1C, 0x78, 0xE1, 0xDA, 0x52, 0xC0, 0x93, 0x81, 0xD0, 0x29, 0xEA, 0x39, 0xAF, 0xDE, - 0x78, 0x3F, 0xC5, 0xDE, 0x1C, 0xE0, 0xEC, 0x54, 0x70, 0xB4, 0xF2, 0x7A, 0x36, 0x57, 0xBB, 0x8C, - 0x64, 0x9D, 0xEC, 0xD5, 0xD2, 0x72, 0xB5, 0xDB, 0xEA, 0xF5, 0x7D, 0xAF, 0x63, 0xC8, 0x95, 0x5C, - 0xE3, 0x19, 0x42, 0x35, 0x70, 0x94, 0x23, 0x18, 0x36, 0xAD, 0x19, 0x54, 0xB3, 0xB7, 0x57, 0xEE, - 0xD3, 0x69, 0x7A, 0x5E, 0xDA, 0x59, 0xB5, 0xD3, 0xD5, 0x35, 0x3F, 0xF8, 0x27, 0xFF, 0x00, 0xC4, - 0x3D, 0x17, 0xC3, 0xB7, 0xDA, 0xDF, 0x84, 0x6D, 0xB4, 0x2F, 0x1E, 0xCB, 0xA6, 0x58, 0x1B, 0xFB, - 0xED, 0x2D, 0x74, 0x2B, 0x99, 0x2E, 0xAD, 0xE2, 0x8D, 0x5C, 0xC8, 0xC8, 0xC9, 0x2F, 0x4C, 0x02, - 0x30, 0x41, 0xF6, 0x2A, 0x42, 0xE7, 0xFA, 0x27, 0x85, 0xFC, 0x68, 0xE1, 0xFC, 0xE2, 0x93, 0xFA, - 0xEE, 0x5D, 0xEC, 0xA0, 0x9C, 0x5F, 0x3C, 0x6D, 0x64, 0xB4, 0xD1, 0xBB, 0xA7, 0x64, 0xD6, 0xC9, - 0x29, 0x37, 0x7B, 0xA6, 0xAE, 0x7C, 0xFE, 0x39, 0x66, 0x98, 0x38, 0xC2, 0x78, 0xC9, 0xBF, 0x67, - 0x75, 0x77, 0x4E, 0x49, 0x34, 0x9A, 0xD5, 0x72, 0xB8, 0xA5, 0x2B, 0x5B, 0x45, 0x78, 0xEB, 0xB5, - 0xAE, 0xD1, 0x43, 0xE0, 0xD7, 0xEC, 0xF5, 0xA8, 0xF8, 0xFF, 0x00, 0xC3, 0xB7, 0x5E, 0x21, 0xD4, - 0x74, 0x0F, 0x87, 0x3A, 0x4A, 0xDB, 0xCB, 0x25, 0xA5, 0xBD, 0x95, 0xEE, 0x87, 0x73, 0x7B, 0x34, - 0x4F, 0x0E, 0xE1, 0x22, 0xC8, 0x9F, 0x6B, 0x55, 0x5C, 0xB0, 0x38, 0x03, 0x00, 0x11, 0x81, 0xD7, - 0x8F, 0xB6, 0xCD, 0x78, 0xD3, 0x07, 0x93, 0x62, 0x21, 0x83, 0xC3, 0xD4, 0x9D, 0x45, 0x34, 0xA5, - 0xCC, 0xA4, 0xD2, 0x4A, 0x49, 0x4A, 0x29, 0x3B, 0x5D, 0xC5, 0x2B, 0x24, 0x92, 0xDA, 0xEE, 0xDA, - 0x2B, 0xFC, 0xFD, 0x3A, 0x19, 0x9E, 0x69, 0xCD, 0xFD, 0x99, 0x8E, 0xAA, 0xE8, 0x41, 0x38, 0xA9, - 0x4E, 0x69, 0x4A, 0x5B, 0x69, 0x18, 0xA8, 0x5A, 0x0A, 0x37, 0x6F, 0x99, 0xBB, 0xF5, 0x6A, 0xDA, - 0x8E, 0xF8, 0x4D, 0xE0, 0xF9, 0xE1, 0xF8, 0xD1, 0x7D, 0xE1, 0xBD, 0x57, 0xC0, 0xBF, 0x0E, 0x1A, - 0xCB, 0xC1, 0x64, 0x6A, 0x72, 0xEA, 0x3A, 0x46, 0x93, 0x75, 0x1A, 0xCE, 0x48, 0xC5, 0xB2, 0xAB, - 0x3D, 0xC3, 0x60, 0x70, 0x40, 0x53, 0x9E, 0xA0, 0x74, 0xE2, 0xBD, 0x7C, 0xEF, 0x15, 0x7E, 0x1E, - 0x86, 0x6B, 0x84, 0xC5, 0xD6, 0x75, 0x2B, 0x7B, 0xAA, 0x37, 0x94, 0xA2, 0x96, 0x8A, 0x4D, 0xA5, - 0x24, 0xBC, 0xD5, 0xBC, 0xED, 0xAA, 0x8A, 0x5C, 0x75, 0x2A, 0x62, 0x73, 0x0A, 0x14, 0xB0, 0x33, - 0xC5, 0x56, 0x72, 0x94, 0x9A, 0x9C, 0x65, 0x28, 0xDA, 0xD4, 0xD2, 0xB2, 0xF7, 0x63, 0x1B, 0xAB, - 0xB8, 0xDB, 0x45, 0xCA, 0x93, 0x49, 0x2D, 0x4F, 0x6F, 0xF8, 0xC5, 0xE2, 0x1B, 0x6F, 0x13, 0x78, - 0xCF, 0xC0, 0xBF, 0x0B, 0x6C, 0x7C, 0x27, 0xE1, 0x3B, 0xCF, 0xED, 0x82, 0xDA, 0xA6, 0xBC, 0xD7, - 0x3A, 0x5C, 0xF3, 0x25, 0x9C, 0x10, 0x38, 0x65, 0x2A, 0x04, 0xBB, 0x55, 0xF3, 0x1A, 0xE0, 0x63, - 0x83, 0x8C, 0xE4, 0x6D, 0xDB, 0xF3, 0xFC, 0x31, 0x95, 0xCB, 0x05, 0x96, 0x62, 0x78, 0x83, 0x17, - 0x5A, 0xA4, 0x63, 0x04, 0xA3, 0x0B, 0xB9, 0xC5, 0x36, 0xD3, 0x4D, 0x7C, 0x5A, 0xB7, 0x17, 0x6D, - 0x6F, 0xA6, 0xA9, 0xAB, 0xD9, 0xF2, 0xE6, 0x14, 0xAA, 0xBA, 0xAA, 0x9D, 0x1A, 0xD3, 0xE6, 0x8D, - 0xA3, 0x16, 0xB9, 0x64, 0xEF, 0x3B, 0xA7, 0x6F, 0x76, 0xF6, 0x50, 0x53, 0x72, 0x5D, 0x9C, 0x5A, - 0xB3, 0xBB, 0x3D, 0x2B, 0xC7, 0x3A, 0x74, 0x3A, 0xEE, 0x87, 0x63, 0xE0, 0x6D, 0x1E, 0xC3, 0xC3, - 0x96, 0x17, 0x1A, 0xFE, 0x34, 0xAB, 0x76, 0xB8, 0xD3, 0x9A, 0x45, 0x82, 0x05, 0x5F, 0xDE, 0x10, - 0x9E, 0x71, 0xCF, 0xC8, 0x63, 0x50, 0x32, 0x33, 0xBB, 0xD1, 0x4E, 0x3E, 0x7F, 0x2F, 0x9D, 0x3C, - 0x25, 0x6A, 0x99, 0xC6, 0x3F, 0x95, 0xC6, 0x9A, 0x6D, 0xA4, 0xE6, 0x9B, 0x7B, 0x24, 0x9F, 0x32, - 0xB2, 0x76, 0x49, 0xDD, 0x34, 0xB4, 0x5B, 0xB4, 0x8F, 0x52, 0x39, 0x2E, 0x3F, 0x16, 0xA8, 0xE0, - 0x32, 0xD7, 0x37, 0x28, 0xB8, 0xBB, 0xA7, 0xEE, 0xC1, 0x45, 0xA7, 0x77, 0x34, 0xBD, 0xDB, 0x59, - 0x38, 0xB5, 0xCA, 0xFA, 0xA7, 0x6B, 0x33, 0xCF, 0xAE, 0xFF, 0x00, 0x62, 0xBD, 0x27, 0xC3, 0x11, - 0xDB, 0x6A, 0x9A, 0x9C, 0x3E, 0x12, 0xD6, 0x6D, 0xE5, 0x22, 0x39, 0x22, 0x8F, 0xC3, 0x23, 0x4F, - 0xB7, 0x80, 0xB2, 0x80, 0xAA, 0x54, 0x48, 0xD8, 0xCE, 0x18, 0xE7, 0x9C, 0x1F, 0x4E, 0x05, 0x72, - 0xD6, 0xF1, 0x72, 0xB6, 0x61, 0x09, 0x60, 0x72, 0xEA, 0x72, 0xA5, 0x18, 0xDB, 0x4E, 0x69, 0x3D, - 0x13, 0xFB, 0x29, 0xCA, 0x2A, 0xCA, 0xC9, 0x26, 0x9A, 0xEA, 0xDE, 0x89, 0x5F, 0xF5, 0x6C, 0x83, - 0x84, 0xB0, 0x78, 0x75, 0x1A, 0xB9, 0xAD, 0x6A, 0xB5, 0x6B, 0x5D, 0x35, 0xFB, 0xD9, 0x28, 0x2B, - 0x6A, 0xEF, 0x1D, 0x5C, 0xEC, 0xF4, 0x6A, 0x4E, 0xCD, 0x36, 0xF9, 0x53, 0x49, 0x1D, 0x3E, 0xBF, - 0xF0, 0x12, 0xFB, 0xC1, 0xFE, 0x1A, 0x8B, 0x5B, 0xF0, 0xAE, 0x9D, 0xA0, 0x45, 0x6B, 0x0C, 0xAA, - 0x2F, 0x6D, 0x13, 0x41, 0x53, 0x24, 0x50, 0x1C, 0x6E, 0x11, 0x80, 0xC0, 0xE0, 0x02, 0x4F, 0xDE, - 0xFE, 0x11, 0x9E, 0xA3, 0x1F, 0x1D, 0x4B, 0x88, 0xF0, 0xB9, 0x86, 0x61, 0x2C, 0xB7, 0x18, 0xAF, - 0x56, 0xDE, 0xEB, 0x77, 0x6B, 0x4B, 0xDA, 0xEB, 0x5B, 0xC9, 0xE9, 0xE6, 0xAF, 0x64, 0xEC, 0x9D, - 0xBF, 0x47, 0x87, 0x12, 0x46, 0x86, 0x0B, 0x5A, 0x55, 0x27, 0x4E, 0x0A, 0xCA, 0x31, 0x92, 0x4D, - 0x28, 0xE8, 0xE5, 0x18, 0xF2, 0xF2, 0xB6, 0x92, 0x72, 0x51, 0x4A, 0x2A, 0x5B, 0x26, 0xB4, 0x46, - 0x7E, 0xB5, 0xF0, 0x7E, 0xD3, 0x53, 0xD1, 0xED, 0xA7, 0x17, 0x76, 0x89, 0x6F, 0x3C, 0xB1, 0x2B, - 0x34, 0xB6, 0x70, 0x3F, 0x94, 0xCC, 0x32, 0xAB, 0x08, 0x6C, 0x64, 0x70, 0x79, 0xE3, 0x95, 0x5E, - 0xFC, 0x57, 0x2E, 0x5F, 0x9E, 0x62, 0x30, 0x38, 0x99, 0xDE, 0x84, 0x65, 0x08, 0xFC, 0x56, 0x8B, - 0x4E, 0x29, 0x74, 0x6A, 0xFA, 0x59, 0xA4, 0xAE, 0xF4, 0x49, 0x3B, 0x36, 0xB5, 0x5D, 0x0B, 0x89, - 0xF1, 0x4A, 0x84, 0xE5, 0x80, 0x93, 0x55, 0x25, 0x06, 0xE1, 0x24, 0xF5, 0x57, 0x8B, 0x4A, 0x4B, - 0x44, 0x9D, 0xB4, 0x7C, 0xB6, 0x7A, 0x36, 0xB9, 0x76, 0x89, 0xED, 0xBA, 0x67, 0xFC, 0x13, 0xCF, - 0xE3, 0x2E, 0xA5, 0xE0, 0x75, 0xD7, 0xEF, 0x6E, 0x3C, 0x1F, 0xF0, 0xD7, 0xE1, 0x84, 0xD6, 0xCB, - 0x04, 0x1F, 0x13, 0xBE, 0x34, 0xDD, 0x41, 0xF0, 0xDB, 0xC0, 0x31, 0x89, 0xC6, 0xC8, 0x52, 0xCE, - 0x69, 0x10, 0xDC, 0xDF, 0x93, 0xE6, 0x9F, 0xDD, 0xD8, 0xDB, 0x5C, 0xC8, 0x48, 0xC2, 0x8E, 0x48, - 0x5F, 0x9F, 0xC4, 0xF8, 0x85, 0x80, 0xA9, 0x8A, 0xE5, 0xC2, 0xE1, 0x9D, 0x4C, 0x4A, 0x92, 0x6E, - 0x9C, 0x21, 0xCD, 0x29, 0x28, 0xDB, 0x99, 0xA4, 0xDA, 0xB2, 0x8A, 0x8D, 0xF9, 0x9F, 0x2C, 0x14, - 0x52, 0x77, 0xEF, 0xAE, 0x53, 0xC5, 0xD5, 0x28, 0x54, 0xA3, 0xFD, 0xAE, 0xA5, 0x3C, 0x44, 0x6D, - 0xCD, 0x2A, 0x4A, 0xFC, 0xF6, 0xB3, 0x72, 0xB6, 0x8A, 0x32, 0xB2, 0x6A, 0x4A, 0xE9, 0x5F, 0x5B, - 0x24, 0xD5, 0xB9, 0x8D, 0x6F, 0xE1, 0x3F, 0xEC, 0x3D, 0xFB, 0x36, 0x84, 0xD0, 0xBE, 0x21, 0xD9, - 0x7C, 0x62, 0xFD, 0xB0, 0xBC, 0x77, 0x04, 0x31, 0x6B, 0x0B, 0x07, 0x87, 0x2D, 0xCF, 0xEC, 0xD7, - 0xFB, 0x3B, 0xDC, 0x92, 0xA3, 0x36, 0xE3, 0x54, 0xB8, 0x49, 0xBC, 0x47, 0xA8, 0xDB, 0xE1, 0xD7, - 0x7B, 0xC3, 0x06, 0x9E, 0xDF, 0x22, 0xA8, 0x68, 0xB2, 0x0B, 0xED, 0xFE, 0xB8, 0x71, 0x8E, 0x6F, - 0x88, 0x8D, 0x6C, 0xBA, 0x9D, 0x0C, 0x2D, 0x1D, 0x55, 0xED, 0x1A, 0xD5, 0x15, 0xF4, 0xE6, 0x7A, - 0xBA, 0x30, 0x5A, 0x24, 0x9B, 0x8C, 0xA3, 0x6B, 0xC9, 0xF3, 0xDB, 0x91, 0x7D, 0x3E, 0x1F, 0x38, - 0xCE, 0x73, 0xFA, 0x1E, 0xD7, 0x07, 0x3A, 0x78, 0x6A, 0x32, 0x6E, 0x0E, 0xED, 0xD6, 0xA8, 0x92, - 0x69, 0xAF, 0x75, 0x38, 0xC2, 0x32, 0x4F, 0x58, 0xA6, 0xF7, 0xBB, 0x57, 0xB5, 0xD7, 0x9B, 0x4D, - 0xFF, 0x00, 0x05, 0x09, 0xF8, 0xDB, 0xE0, 0xD9, 0xE7, 0xD0, 0x7F, 0x66, 0xBF, 0x85, 0xFF, 0x00, - 0x02, 0xBF, 0x64, 0x5D, 0x33, 0xE7, 0x4D, 0x30, 0x7C, 0x28, 0xF8, 0x63, 0xA7, 0x5F, 0x7C, 0x40, - 0x8A, 0xDE, 0x58, 0xC2, 0x98, 0xBF, 0xE1, 0x34, 0xD6, 0x96, 0xFB, 0x59, 0xDC, 0x7C, 0xA6, 0x26, - 0x48, 0xAE, 0x61, 0x24, 0x92, 0x4D, 0x79, 0x3F, 0xEA, 0xAE, 0x57, 0x83, 0xA9, 0x46, 0x39, 0xFD, - 0x79, 0xE3, 0x6A, 0xD4, 0xB3, 0xB4, 0xAA, 0x4A, 0x51, 0x6F, 0x74, 0x9C, 0x14, 0x94, 0x39, 0x52, - 0x71, 0x4E, 0x3F, 0x0B, 0x8A, 0x4A, 0x31, 0x8D, 0xDA, 0x5F, 0x4B, 0x4F, 0x85, 0xB8, 0x7B, 0x13, - 0x86, 0x9D, 0x6C, 0xF7, 0x15, 0x57, 0x17, 0x38, 0xB4, 0xDD, 0xE7, 0x35, 0x06, 0x93, 0x49, 0x4F, - 0xD9, 0xC1, 0xA4, 0x9A, 0x8D, 0xD3, 0x4F, 0x99, 0xAB, 0xBB, 0x26, 0x9A, 0x3C, 0x03, 0xC4, 0xF0, - 0xFE, 0xD0, 0x9F, 0xB4, 0x2D, 0xFB, 0x78, 0xAB, 0xE2, 0xDF, 0x8D, 0x3C, 0x63, 0xE3, 0x51, 0x34, - 0xCD, 0x72, 0xDA, 0xA7, 0xC4, 0xAD, 0x7E, 0xF7, 0xC4, 0x5E, 0x4B, 0xB8, 0x0B, 0x24, 0xB6, 0xD1, - 0x5C, 0x4A, 0xE5, 0x32, 0xB1, 0xA8, 0x3B, 0x51, 0x06, 0x00, 0xC7, 0x18, 0xCE, 0xD8, 0xAC, 0xD3, - 0x2E, 0xCB, 0xE8, 0x3C, 0x16, 0x0B, 0x28, 0xC3, 0xFB, 0x34, 0xEC, 0xA3, 0xEC, 0xE0, 0xE3, 0xEE, - 0xEB, 0x76, 0x9A, 0xDD, 0x5D, 0xF5, 0x6E, 0x2E, 0xE9, 0x69, 0xAB, 0xCF, 0x35, 0xE2, 0x1E, 0x0F, - 0xE1, 0x1A, 0x12, 0x8E, 0x02, 0x09, 0xC5, 0x2B, 0x35, 0x4D, 0xA4, 0xD7, 0x44, 0xDB, 0x49, 0x26, - 0xAF, 0x65, 0x67, 0x75, 0x75, 0xAF, 0x53, 0x9B, 0xF1, 0xCF, 0xEC, 0xF9, 0xAF, 0xD9, 0x78, 0x3E, - 0xF7, 0xFB, 0x0F, 0x46, 0xD5, 0xBC, 0x67, 0xA9, 0xDC, 0xDA, 0x0B, 0x5B, 0x4D, 0x33, 0xC3, 0x7A, - 0x11, 0xD6, 0xE5, 0x9A, 0x46, 0x4C, 0xAA, 0xAD, 0x94, 0x0A, 0xF3, 0x67, 0xE5, 0x66, 0x07, 0x03, - 0x01, 0x7F, 0x0A, 0xE7, 0xC1, 0x71, 0x26, 0x6B, 0x4B, 0x13, 0x87, 0xC4, 0x56, 0xC1, 0x50, 0xA7, - 0x05, 0x35, 0x18, 0xB9, 0x42, 0x2E, 0x2B, 0x7B, 0x2B, 0x5D, 0xA4, 0xAC, 0xAD, 0xF0, 0xC6, 0x2D, - 0x3B, 0x7B, 0xAA, 0xD6, 0xF0, 0xB1, 0x1C, 0x77, 0x84, 0xE2, 0x2C, 0xA3, 0x11, 0x81, 0xC5, 0xC6, - 0x2A, 0x83, 0xA4, 0xDA, 0xE6, 0x94, 0xAE, 0xDB, 0x8D, 0xE0, 0xE2, 0xF6, 0x6D, 0x36, 0xBD, 0xD8, - 0xA6, 0xEF, 0xE6, 0x8E, 0x57, 0xE1, 0x77, 0xEC, 0xE1, 0xAE, 0xF8, 0x46, 0xE2, 0xD8, 0xFC, 0x52, - 0x97, 0xE1, 0x47, 0xC3, 0xFB, 0xF9, 0x49, 0x91, 0x6D, 0xBC, 0x4D, 0xAC, 0xC7, 0xE2, 0x8F, 0x17, - 0x40, 0xA3, 0x69, 0x08, 0x74, 0x3B, 0x05, 0xB8, 0x96, 0x39, 0x00, 0x03, 0xE4, 0x94, 0xC5, 0xD5, - 0x73, 0xB4, 0x8C, 0xD7, 0xD3, 0x66, 0xBC, 0x4B, 0x86, 0xC7, 0xE1, 0xF9, 0x30, 0xF8, 0x0A, 0x0E, - 0xCB, 0x45, 0xEC, 0xA3, 0x16, 0xE5, 0x66, 0xA2, 0xED, 0x1E, 0x69, 0x24, 0xDD, 0xB5, 0x4D, 0x34, - 0x93, 0xB2, 0x7A, 0x23, 0xF9, 0x1F, 0x8A, 0xE8, 0x56, 0xE7, 0x84, 0xE5, 0x98, 0xBA, 0x14, 0x76, - 0xE5, 0xDE, 0xF6, 0xFE, 0x54, 0xAE, 0xE7, 0x76, 0xD4, 0x52, 0xB6, 0xFA, 0x5E, 0xDB, 0x7D, 0x5F, - 0xA7, 0x78, 0x1B, 0xC2, 0x96, 0xF0, 0xA8, 0xFB, 0x7F, 0x8C, 0xFC, 0x4E, 0xF1, 0x94, 0x91, 0x7E, - 0xC7, 0x63, 0x61, 0xF0, 0xD7, 0x42, 0x65, 0xC1, 0xC4, 0x7B, 0x31, 0x73, 0x73, 0x82, 0xA4, 0x64, - 0xFC, 0x87, 0x04, 0x63, 0x19, 0xC0, 0xF8, 0xEC, 0x5F, 0x10, 0x60, 0xF2, 0xFB, 0xA7, 0x81, 0xA3, - 0x29, 0xDA, 0xD7, 0x54, 0x20, 0xA3, 0x7D, 0x2E, 0xD3, 0x7C, 0xCE, 0x51, 0xD2, 0xC9, 0xB8, 0xC5, - 0xAE, 0xAA, 0xE9, 0x27, 0xF3, 0xB4, 0xB2, 0x7A, 0x35, 0x94, 0x64, 0xA7, 0x5E, 0xAB, 0xB5, 0x94, - 0xA5, 0x25, 0x4A, 0x32, 0x4F, 0x5F, 0x86, 0x37, 0x6B, 0x4B, 0x2D, 0x6F, 0xB5, 0xB4, 0x7B, 0x69, - 0xDC, 0x41, 0xAE, 0x69, 0x2A, 0xCD, 0xE0, 0x7F, 0x06, 0x7C, 0x3C, 0xD2, 0x65, 0xE1, 0x56, 0x6F, - 0x11, 0xC1, 0xA8, 0xF8, 0xDA, 0xEF, 0x80, 0x30, 0xE1, 0xAF, 0x2E, 0x1A, 0x25, 0x62, 0x15, 0x49, - 0xDB, 0x18, 0x19, 0xCE, 0x14, 0x64, 0xD7, 0xCC, 0x57, 0xE2, 0x7A, 0x13, 0xAA, 0x9D, 0x6A, 0x54, - 0x6D, 0xCC, 0x9D, 0xA3, 0x46, 0x0F, 0x4D, 0x6E, 0xB4, 0xB5, 0xD7, 0x55, 0xB2, 0xD1, 0x34, 0xD6, - 0x89, 0x7A, 0x3F, 0xD9, 0x75, 0xB0, 0xF1, 0x7F, 0x51, 0xC1, 0xD2, 0xE5, 0xB6, 0x8A, 0x55, 0x2A, - 0x49, 0xDB, 0x4D, 0x79, 0x9D, 0xEC, 0xEC, 0x93, 0x56, 0x49, 0x2D, 0x94, 0x56, 0x87, 0x23, 0xF1, - 0x47, 0xE3, 0x2F, 0xC7, 0xDF, 0x84, 0x36, 0x7F, 0x0F, 0x75, 0xAB, 0x3F, 0x17, 0x59, 0xDC, 0xE8, - 0xFE, 0x2C, 0xB8, 0x7B, 0x7D, 0x46, 0xD7, 0x40, 0xF0, 0x76, 0x89, 0xE1, 0xBB, 0xFD, 0x05, 0xE3, - 0x74, 0x44, 0x58, 0xD2, 0xC1, 0x4D, 0xC3, 0xC5, 0xBE, 0x53, 0x8F, 0x33, 0x6B, 0xE0, 0x29, 0x00, - 0x92, 0x71, 0xF6, 0x38, 0x5C, 0x26, 0x16, 0x4F, 0x0D, 0x4E, 0xAA, 0xA5, 0xEC, 0xB1, 0x0F, 0x97, - 0x9A, 0x38, 0x78, 0x5A, 0x37, 0x77, 0x4A, 0x30, 0x94, 0xD3, 0x8D, 0xF9, 0x5E, 0xAA, 0x5C, 0x8D, - 0xC7, 0x46, 0xBA, 0x67, 0x43, 0xDB, 0x66, 0x15, 0xE1, 0x97, 0xD3, 0xC4, 0xCA, 0x86, 0x22, 0xD7, - 0x84, 0x25, 0x18, 0xB8, 0x4A, 0x51, 0xB7, 0x32, 0xE6, 0x49, 0x69, 0xAA, 0xE5, 0xB3, 0xD6, 0xCD, - 0x3B, 0x6C, 0x7A, 0x5F, 0x80, 0x7E, 0x3A, 0x78, 0xB3, 0xE2, 0x05, 0xAD, 0xDC, 0xFA, 0x9F, 0x8A, - 0x7C, 0x48, 0xD7, 0xF6, 0x37, 0x4D, 0x67, 0x72, 0x92, 0x6A, 0x17, 0x96, 0xAE, 0x4A, 0x80, 0x18, - 0x98, 0xCB, 0x02, 0x9D, 0x40, 0x2A, 0xC1, 0x4F, 0xB7, 0x35, 0xF2, 0x1C, 0x47, 0x96, 0x4B, 0x2D, - 0xC0, 0x62, 0xF3, 0x8C, 0x2E, 0x22, 0x33, 0x85, 0x3A, 0xDE, 0xCD, 0x46, 0x58, 0x78, 0x6A, 0x93, - 0x69, 0x4A, 0x52, 0xF6, 0x92, 0xE5, 0x6B, 0x64, 0xA2, 0x9C, 0x6F, 0x65, 0x7B, 0x24, 0x7A, 0x19, - 0x5E, 0x65, 0x88, 0xA9, 0x8A, 0x9E, 0x59, 0x8D, 0x49, 0x55, 0x86, 0xEE, 0x2D, 0xF2, 0xC9, 0x74, - 0x94, 0x5B, 0x4B, 0x47, 0xD2, 0xDA, 0xAD, 0x3B, 0x26, 0x65, 0xFC, 0x40, 0x93, 0xE2, 0x8E, 0xAB, - 0x11, 0x6F, 0x0F, 0x6B, 0x89, 0x80, 0x98, 0x91, 0x75, 0x29, 0x65, 0xBA, 0x32, 0xA0, 0x4E, 0x10, - 0x96, 0x63, 0xE9, 0x80, 0x71, 0x8E, 0x78, 0xC6, 0x39, 0xF8, 0xFC, 0xA3, 0x3F, 0xC0, 0x53, 0x4A, - 0x35, 0xF0, 0xD4, 0x9B, 0x4B, 0x4B, 0x52, 0x8A, 0x49, 0xF7, 0x56, 0xB6, 0xDA, 0x5A, 0xF7, 0xB7, - 0x66, 0xB6, 0xD7, 0x39, 0xC3, 0x67, 0x75, 0xA2, 0x9E, 0x5F, 0x59, 0xA8, 0xF5, 0x57, 0x49, 0xB5, - 0xD2, 0xCD, 0xA6, 0xBC, 0xAC, 0xD6, 0xDA, 0x26, 0xAC, 0xEF, 0xF9, 0x61, 0xF1, 0x71, 0x3C, 0x79, - 0x6D, 0xF1, 0x27, 0x43, 0x5D, 0x52, 0xE7, 0x4B, 0xB9, 0xD5, 0x65, 0xBC, 0xFF, 0x00, 0x40, 0x75, - 0xB3, 0xDB, 0x14, 0x52, 0x02, 0x9B, 0xD9, 0xCE, 0xE2, 0x4F, 0x51, 0xD3, 0x1C, 0x00, 0x38, 0xC5, - 0x7E, 0x89, 0x4F, 0x8A, 0x31, 0x7E, 0xC9, 0x2C, 0x36, 0x13, 0x0A, 0xE0, 0xD7, 0x5C, 0x3C, 0x1B, - 0xB2, 0xE8, 0x9F, 0x4B, 0x5A, 0xDB, 0x36, 0xDB, 0xBB, 0x67, 0x3F, 0x0D, 0x53, 0xC9, 0xD6, 0x45, - 0x98, 0xD2, 0xC5, 0x42, 0xA2, 0x94, 0x6F, 0xED, 0xAF, 0x34, 0xDC, 0xAE, 0x9D, 0xAC, 0xD2, 0x4B, - 0x6F, 0x96, 0xBB, 0x5B, 0x45, 0xFA, 0x0B, 0xF0, 0xE5, 0xBE, 0x36, 0x7D, 0x83, 0x4A, 0x6B, 0xC9, - 0x7C, 0x3E, 0x9A, 0x47, 0xD9, 0xD5, 0x0A, 0x15, 0x71, 0x72, 0x91, 0x95, 0x00, 0x2A, 0x1F, 0xBC, - 0x07, 0x04, 0xF5, 0xE9, 0xEB, 0xC5, 0x7C, 0x76, 0x67, 0xC4, 0x39, 0x6A, 0x94, 0xE9, 0xCA, 0x85, - 0x2F, 0x68, 0xF7, 0xE5, 0xA5, 0x1B, 0x37, 0xAF, 0x4D, 0xBC, 0xB4, 0x4B, 0x64, 0xD2, 0x48, 0xF3, - 0xF2, 0x6C, 0x3E, 0x7A, 0xA9, 0xD1, 0x96, 0x06, 0x52, 0x58, 0x7B, 0xAE, 0x5E, 0x77, 0x1E, 0x65, - 0x0B, 0x69, 0x65, 0x15, 0x75, 0xA5, 0x92, 0xBE, 0xAB, 0xAD, 0xAD, 0xA7, 0xD8, 0x3A, 0x17, 0xED, - 0x2B, 0xFB, 0x5D, 0x7C, 0x18, 0xB4, 0x69, 0x3E, 0x01, 0x7C, 0x5C, 0xF1, 0xA7, 0x84, 0x27, 0x96, - 0xDD, 0x2D, 0xAE, 0x74, 0xEB, 0x4F, 0x17, 0x5E, 0xC3, 0xA3, 0x5C, 0x44, 0x8F, 0xB9, 0x21, 0x96, - 0xC1, 0x9D, 0xAD, 0x64, 0x8C, 0x30, 0x07, 0xCB, 0x78, 0xD9, 0x4F, 0x39, 0x1E, 0xBF, 0x39, 0x83, - 0xCD, 0x70, 0xD5, 0xD3, 0xA3, 0x98, 0x46, 0x2A, 0x29, 0xDE, 0x36, 0xA7, 0x15, 0x67, 0x6B, 0x5F, - 0x4D, 0x16, 0x9A, 0x2D, 0xD2, 0xD2, 0xC9, 0x23, 0xE8, 0xF3, 0x05, 0x9C, 0xD2, 0xA5, 0x0F, 0xEC, - 0xD8, 0xC6, 0xFF, 0x00, 0x6B, 0x6B, 0xDB, 0x7D, 0x16, 0x8B, 0xE4, 0xDA, 0x56, 0x56, 0xF4, 0xF1, - 0xCD, 0x6F, 0xFE, 0x0A, 0xA5, 0xF1, 0xA7, 0x57, 0xF1, 0xD5, 0x8F, 0x84, 0x3F, 0x6A, 0x9F, 0xD9, - 0xB7, 0xE0, 0x07, 0xC7, 0xE9, 0xF5, 0x19, 0xCC, 0x96, 0xDE, 0x28, 0xD0, 0x74, 0x88, 0xFE, 0x0A, - 0xFC, 0x50, 0x56, 0x00, 0xF9, 0xF2, 0xC9, 0xAA, 0x69, 0x50, 0x0D, 0x3E, 0x79, 0x40, 0x65, 0x20, - 0x5D, 0x69, 0xB7, 0x28, 0x71, 0xF3, 0xAC, 0x9B, 0x88, 0xAF, 0x66, 0x86, 0x16, 0xBE, 0x1F, 0x11, - 0x4F, 0x17, 0x94, 0x4A, 0x9C, 0x57, 0x2D, 0x92, 0x94, 0x23, 0x38, 0xA5, 0xA2, 0xD3, 0x9B, 0x5E, - 0x9A, 0xEB, 0xE9, 0x64, 0x74, 0x60, 0x33, 0x8C, 0x0D, 0x4C, 0x87, 0x13, 0x3C, 0xCE, 0x73, 0xE6, - 0xA4, 0xD2, 0xAA, 0xB9, 0x62, 0xB5, 0x7F, 0x0F, 0x2C, 0x63, 0x78, 0xBD, 0xD5, 0xAD, 0xEA, 0xD6, - 0x89, 0x9F, 0x7E, 0xF8, 0x56, 0xDF, 0xF6, 0x7C, 0xF8, 0xBF, 0xA6, 0x2C, 0xDE, 0x15, 0xF1, 0x9E, - 0x85, 0xF0, 0x8B, 0xC4, 0x66, 0xD9, 0x4C, 0x5E, 0x00, 0xFD, 0xA9, 0xBC, 0x1B, 0x6F, 0xA0, 0xDB, - 0x6A, 0xD2, 0xB1, 0x3B, 0x57, 0x4F, 0xF8, 0x81, 0xE1, 0x59, 0x06, 0x9F, 0x18, 0x20, 0xC6, 0x14, - 0x5E, 0xE9, 0xF6, 0x89, 0x90, 0x0B, 0x48, 0xA3, 0x81, 0xE3, 0x63, 0x33, 0x7A, 0xB7, 0x54, 0xEA, - 0x53, 0xA0, 0xE7, 0x1D, 0x9C, 0x69, 0x41, 0x2E, 0xF6, 0x97, 0xB9, 0x1B, 0xEA, 0xB5, 0xEE, 0x9D, - 0x92, 0xB2, 0x3A, 0x30, 0x56, 0x9C, 0x17, 0xB3, 0x53, 0x54, 0xD7, 0x49, 0xAE, 0x56, 0xF6, 0x57, - 0xBC, 0x25, 0xAE, 0xDA, 0xAB, 0x2D, 0x5B, 0x69, 0x59, 0xD9, 0x7C, 0xFB, 0xFB, 0x4E, 0x68, 0x7A, - 0xA7, 0xEC, 0xBF, 0x63, 0x6D, 0xAC, 0x7C, 0x5D, 0xF8, 0x41, 0xF1, 0x37, 0xC2, 0x1E, 0x1C, 0xD4, - 0x64, 0x58, 0x74, 0xAF, 0x89, 0xBE, 0x0B, 0x9A, 0xCB, 0xE2, 0x37, 0xC1, 0xDD, 0x71, 0x5C, 0xAE, - 0xC9, 0xB4, 0xED, 0x69, 0x59, 0x2D, 0x2E, 0x21, 0x6F, 0x31, 0x36, 0x18, 0xAF, 0xA4, 0x63, 0x90, - 0x0E, 0x0F, 0x03, 0x2C, 0x16, 0x22, 0xBD, 0x7A, 0x73, 0xAB, 0xEE, 0x28, 0xA7, 0x1B, 0x25, 0x4E, - 0x9E, 0xAB, 0xFB, 0xA9, 0xC1, 0xAD, 0x3A, 0xED, 0x6D, 0xD2, 0x77, 0x3A, 0xA5, 0x26, 0xF1, 0xB4, - 0x72, 0xDA, 0x74, 0xE5, 0x17, 0x3B, 0xDA, 0x4E, 0xDC, 0x89, 0xA4, 0x9D, 0x9B, 0x7C, 0xB6, 0xD2, - 0xFA, 0x2B, 0xFE, 0x16, 0x7E, 0x11, 0xE0, 0xEF, 0x15, 0x69, 0xFF, 0x00, 0x16, 0x74, 0xC1, 0x71, - 0xF0, 0x67, 0xC5, 0x3E, 0x08, 0xF1, 0xEE, 0xA9, 0x24, 0x24, 0xC7, 0xA0, 0xEA, 0xFA, 0xC1, 0xF8, - 0x6B, 0xAC, 0xE1, 0x63, 0x2C, 0x55, 0xA2, 0xD4, 0x15, 0x2D, 0xCB, 0x02, 0xAA, 0x30, 0x97, 0x2F, - 0x93, 0xC0, 0x39, 0x27, 0x1E, 0xBD, 0x3C, 0x16, 0x63, 0x3A, 0x53, 0xC4, 0x4E, 0xAC, 0x23, 0x46, - 0x9D, 0xB5, 0xF6, 0x54, 0x93, 0xBC, 0xBA, 0x2D, 0x35, 0xDF, 0x65, 0xB2, 0xE9, 0xA1, 0xE7, 0x63, - 0x2B, 0x57, 0xC3, 0xD7, 0x78, 0x0A, 0x12, 0x84, 0xAB, 0xDD, 0x5A, 0x2E, 0x4E, 0x1A, 0x59, 0x7B, - 0xD6, 0xB4, 0xB4, 0xD5, 0x25, 0xAD, 0xAF, 0xA3, 0x6B, 0x46, 0xFC, 0xD7, 0xC5, 0x7E, 0x28, 0xFD, - 0xA0, 0xBC, 0x11, 0x24, 0x8D, 0xE2, 0x4F, 0x81, 0x1A, 0x9D, 0xA4, 0x11, 0x6E, 0x22, 0x2F, 0xB5, - 0x29, 0x79, 0x95, 0x0E, 0x09, 0x89, 0xC8, 0xF2, 0xA4, 0xED, 0x82, 0x8C, 0x41, 0x03, 0x8E, 0xBC, - 0xC5, 0x0A, 0xB8, 0x7E, 0x65, 0x4E, 0x96, 0x2D, 0x45, 0xE9, 0x6F, 0x72, 0x92, 0xFB, 0x97, 0x22, - 0x49, 0x2F, 0x5D, 0x2D, 0xDD, 0x58, 0xF2, 0xEA, 0xE3, 0x33, 0x7A, 0x3E, 0xEE, 0x2A, 0x8F, 0x2C, - 0x56, 0xEF, 0x96, 0x72, 0x8E, 0x9D, 0x9C, 0x39, 0x9D, 0xB4, 0xD1, 0xF2, 0xDB, 0xAA, 0xD0, 0xA5, - 0xE0, 0x6F, 0xDA, 0x0B, 0xC3, 0x1E, 0x31, 0xD5, 0x5B, 0xC3, 0xB7, 0x56, 0xB7, 0xDE, 0x16, 0xF1, - 0x2C, 0x20, 0xA4, 0x9A, 0x26, 0xB5, 0x0A, 0xC1, 0x37, 0xA6, 0x63, 0x70, 0x30, 0xC0, 0x90, 0x00, - 0x20, 0x9F, 0xC3, 0xB7, 0x26, 0x32, 0x96, 0x6F, 0x4E, 0x9B, 0xAB, 0x4A, 0xA4, 0x67, 0x04, 0xB6, - 0xF6, 0x74, 0xE3, 0x24, 0xAD, 0xBF, 0x2F, 0x2E, 0xD6, 0xDD, 0xAF, 0x91, 0xD5, 0x87, 0xCC, 0xE8, - 0xF2, 0x42, 0x58, 0x88, 0xA5, 0x4E, 0x4E, 0xD1, 0x9C, 0x65, 0xCD, 0x4D, 0xCB, 0xF9, 0x79, 0xAD, - 0x17, 0x19, 0x59, 0x7C, 0x32, 0x8C, 0x5F, 0x44, 0x99, 0xED, 0x57, 0xF7, 0xEF, 0x63, 0x63, 0x71, - 0x78, 0xCA, 0x64, 0x5B, 0x68, 0x5A, 0x57, 0x8E, 0x14, 0x0C, 0x5C, 0x2A, 0xE4, 0x2A, 0x8C, 0x63, - 0x3D, 0x3F, 0xFD, 0x5C, 0x1F, 0x0B, 0x0B, 0x8E, 0xCC, 0x1D, 0x48, 0xE1, 0xE1, 0x51, 0x2B, 0xE9, - 0x7E, 0x48, 0x7A, 0x6F, 0xCB, 0x7F, 0xEA, 0xFB, 0x9D, 0xD8, 0x8A, 0xB0, 0xA3, 0x46, 0x55, 0x79, - 0x6F, 0x18, 0xAB, 0xE9, 0xE5, 0xFF, 0x00, 0x0D, 0xB6, 0xDE, 0x5D, 0x0F, 0x28, 0xF0, 0x77, 0xC6, - 0x4D, 0x07, 0xC6, 0xDA, 0xA5, 0xCF, 0x87, 0x74, 0xFD, 0x33, 0x5C, 0xB2, 0xBE, 0xB1, 0x2F, 0x2D, - 0xC3, 0xEA, 0x36, 0x8B, 0x05, 0xBB, 0x81, 0xC2, 0x18, 0xDB, 0xA9, 0xC8, 0x52, 0x70, 0x3D, 0xBD, - 0x6B, 0xEC, 0xB3, 0xCC, 0xA7, 0x13, 0x82, 0xE1, 0x6C, 0x2F, 0xB4, 0xAB, 0x16, 0xE7, 0x39, 0x4A, - 0x49, 0x45, 0xAD, 0xAC, 0xA2, 0xF6, 0x49, 0x2B, 0x5E, 0xD6, 0xD1, 0xF4, 0xDB, 0x5F, 0x13, 0x0B, - 0x98, 0x2C, 0x46, 0x26, 0x8C, 0x65, 0x49, 0xC7, 0xDA, 0x43, 0x9E, 0x0E, 0xF1, 0x77, 0x8A, 0x4B, - 0xA2, 0x77, 0x5B, 0xE9, 0x75, 0x6D, 0x1A, 0x57, 0x4A, 0xC7, 0xA0, 0xDD, 0xC8, 0xAA, 0x9B, 0xCB, - 0x60, 0x2A, 0x07, 0x24, 0x01, 0xB5, 0x54, 0x73, 0xEC, 0x0A, 0x80, 0xAB, 0xEA, 0x0E, 0x3A, 0xF1, - 0x5F, 0x0F, 0x42, 0x17, 0xB2, 0xB7, 0x92, 0x4B, 0xEE, 0xFE, 0xAD, 0xB3, 0xED, 0x63, 0xD7, 0xA9, - 0xCA, 0xA2, 0x97, 0x4F, 0x2F, 0x2D, 0xFF, 0x00, 0xE0, 0x79, 0x76, 0x3E, 0x3C, 0x13, 0x49, 0xF1, - 0x4B, 0xE3, 0x54, 0x8D, 0x1B, 0x93, 0xE1, 0xBF, 0x00, 0xAB, 0x44, 0x76, 0x30, 0x68, 0x6E, 0x2E, - 0xCA, 0x8D, 0xA0, 0x91, 0xC7, 0xCA, 0x88, 0x09, 0xE7, 0xF8, 0x87, 0xA5, 0x7D, 0x8A, 0x8C, 0x72, - 0xFC, 0xBA, 0x11, 0x4B, 0xDF, 0x6B, 0xB7, 0x59, 0x7D, 0xDB, 0x45, 0xDB, 0x6D, 0x1B, 0xE9, 0xA5, - 0xFE, 0x46, 0x71, 0x78, 0xFA, 0xB1, 0x8C, 0x96, 0xB5, 0xA5, 0xA7, 0xF7, 0x68, 0x52, 0x6F, 0x55, - 0xFF, 0x00, 0x5F, 0x67, 0xA2, 0x6B, 0xEC, 0xAD, 0x36, 0x47, 0xAA, 0xFC, 0x52, 0xF1, 0x34, 0xBE, - 0x17, 0xF0, 0x7E, 0xA3, 0x7B, 0x65, 0x1B, 0x1B, 0xB9, 0xD6, 0x3D, 0x2F, 0x4D, 0x48, 0xF6, 0xA6, - 0x6E, 0x2E, 0x58, 0x45, 0x6C, 0x85, 0xF8, 0x58, 0xF2, 0x4A, 0x60, 0xB6, 0xD1, 0xCA, 0xE4, 0x90, - 0x33, 0x5E, 0x7E, 0x02, 0x8C, 0x25, 0x55, 0xD4, 0xAA, 0xBD, 0xC8, 0x6A, 0xF4, 0x6D, 0x68, 0xB4, - 0x56, 0x5B, 0xEA, 0xD2, 0xB7, 0xDC, 0xBA, 0x1E, 0xAE, 0x22, 0x9D, 0x4C, 0x44, 0xA1, 0x81, 0xC2, - 0xE9, 0x2A, 0x8D, 0x46, 0xFA, 0x7B, 0xB1, 0x4A, 0xF3, 0x97, 0x64, 0xA3, 0x04, 0xDA, 0x7A, 0x6B, - 0x6B, 0x3D, 0x8F, 0x42, 0xF8, 0x7D, 0xA7, 0xDC, 0xFC, 0x3C, 0xB6, 0xF0, 0xC6, 0x8B, 0xE2, 0x1D, - 0x63, 0xC2, 0xFF, 0x00, 0x0D, 0xFC, 0x73, 0xE1, 0xAB, 0x0B, 0x2B, 0x5B, 0xB5, 0x93, 0x5B, 0x3A, - 0x66, 0xAF, 0xE2, 0x5B, 0xCB, 0x95, 0x70, 0xB7, 0xB6, 0xEB, 0xF6, 0x97, 0x32, 0x12, 0xA6, 0x5F, - 0x32, 0x58, 0x18, 0xC4, 0xA4, 0xAA, 0x9C, 0x16, 0xAF, 0xA7, 0x84, 0xA1, 0x84, 0xA1, 0x41, 0xCE, - 0x0D, 0xB9, 0x47, 0x9E, 0x52, 0xBC, 0x9B, 0x92, 0x95, 0xD4, 0x53, 0xD5, 0x72, 0x38, 0x2B, 0xF2, - 0xE9, 0x1B, 0xAD, 0x1D, 0xD7, 0x29, 0xCE, 0xA8, 0x29, 0xD6, 0xAB, 0x52, 0x34, 0x63, 0x42, 0x95, - 0x39, 0x46, 0x2E, 0xD6, 0xE5, 0x82, 0xBD, 0xA0, 0xDC, 0x95, 0xD3, 0x73, 0x56, 0xBD, 0x9D, 0x9C, - 0x95, 0xB4, 0x6A, 0xEA, 0x9E, 0xAB, 0x7B, 0xA4, 0xE8, 0xCD, 0xE2, 0x7F, 0x11, 0xB7, 0x8E, 0xF4, - 0x7D, 0x27, 0x4A, 0xF0, 0xA5, 0xAB, 0x9B, 0x2D, 0x7B, 0xC4, 0x26, 0x3D, 0x37, 0xFB, 0x69, 0x59, - 0xC4, 0x69, 0x04, 0x11, 0x48, 0x5C, 0x09, 0x1D, 0x1D, 0x98, 0x29, 0xCE, 0x02, 0xF5, 0xCE, 0x2B, - 0xC4, 0x84, 0x63, 0x4A, 0x33, 0x9C, 0xA7, 0x15, 0x18, 0xAB, 0xAB, 0xD9, 0x2E, 0x8B, 0x77, 0x64, - 0x97, 0xE2, 0xB7, 0xB7, 0x6B, 0x85, 0x1F, 0x69, 0x7A, 0x74, 0x97, 0x32, 0xD6, 0xD1, 0x49, 0xBE, - 0x66, 0x95, 0xED, 0x14, 0xAE, 0xDB, 0x56, 0x69, 0x24, 0xAE, 0xD6, 0xB6, 0xB2, 0x39, 0x3B, 0x8F, - 0x08, 0xCB, 0x27, 0x85, 0x6D, 0x2D, 0x6C, 0xF4, 0xBD, 0x3A, 0x7D, 0x27, 0xE2, 0xF4, 0x09, 0x63, - 0x6F, 0x69, 0x67, 0x0A, 0x2B, 0xF8, 0xC2, 0xDE, 0x1B, 0xB5, 0xF2, 0xE1, 0x66, 0x42, 0x37, 0xA0, - 0xB8, 0x50, 0x54, 0x1C, 0x7C, 0xE1, 0x4F, 0xB8, 0x5F, 0x56, 0xA7, 0x37, 0x15, 0x51, 0x46, 0x49, - 0xAD, 0x53, 0x49, 0xDB, 0xA2, 0x5A, 0xA7, 0x6E, 0x96, 0x4B, 0x4B, 0x6C, 0xAC, 0xAC, 0x79, 0xB4, - 0xEB, 0x63, 0x30, 0x54, 0x14, 0x30, 0x32, 0x74, 0xE3, 0x59, 0xA5, 0x05, 0x1B, 0xC5, 0xC9, 0xA7, - 0xA5, 0xB6, 0xB5, 0x9D, 0x93, 0xBD, 0x9A, 0xD9, 0x5B, 0x44, 0x79, 0xC6, 0xBB, 0xF0, 0x8B, 0xFE, - 0x13, 0xAD, 0x63, 0x41, 0xF8, 0x74, 0xDA, 0x25, 0x96, 0xA1, 0x6F, 0xF0, 0x7B, 0x46, 0x9E, 0xEB, - 0xFE, 0x11, 0xCD, 0x2F, 0x5A, 0xB8, 0xB4, 0xD3, 0x56, 0xDA, 0xD0, 0x99, 0x6E, 0x96, 0xF4, 0xC7, - 0x28, 0xDD, 0x22, 0x15, 0x74, 0xCA, 0xEC, 0x6C, 0x29, 0x50, 0x78, 0x38, 0x2A, 0xE4, 0x39, 0x3D, - 0x7E, 0x4C, 0x4D, 0x45, 0xFB, 0xCD, 0x1C, 0x5A, 0x69, 0x5A, 0xDD, 0x95, 0xEC, 0xE3, 0x7D, 0x1D, - 0xD5, 0x9F, 0x55, 0xB1, 0x74, 0x38, 0xAB, 0x8C, 0x30, 0xD9, 0x85, 0x4C, 0x24, 0x54, 0x27, 0x4E, - 0x8C, 0x5F, 0x3B, 0x9A, 0xB5, 0xD2, 0x49, 0xD9, 0xCE, 0xCA, 0xD2, 0xB3, 0x49, 0x25, 0x6B, 0xEF, - 0xAE, 0xEF, 0xC9, 0xB5, 0x9F, 0x0A, 0xFC, 0x42, 0xB0, 0xD5, 0x7C, 0x6F, 0xF1, 0x99, 0xE0, 0xD3, - 0x3C, 0x5D, 0x75, 0xF1, 0x1F, 0x4A, 0xBD, 0xF0, 0x6E, 0x9B, 0x73, 0xAB, 0xAC, 0x76, 0x33, 0x69, - 0xB3, 0xB5, 0xBC, 0x69, 0x1B, 0xDA, 0x28, 0x8D, 0xD2, 0x57, 0x82, 0x28, 0x21, 0x50, 0x0A, 0xAE, - 0x40, 0x19, 0x6C, 0x9E, 0x79, 0x6A, 0x70, 0xF6, 0x33, 0x0B, 0x5A, 0xA6, 0x23, 0x2A, 0xAF, 0xFE, - 0xD0, 0xEE, 0xDD, 0xFD, 0xD5, 0xCA, 0x92, 0xD1, 0xA8, 0xD9, 0x28, 0xAD, 0x2F, 0xEE, 0x5D, 0xB4, - 0x93, 0x7D, 0xBD, 0xEC, 0xAB, 0x8D, 0xF0, 0x38, 0xAC, 0xA2, 0x11, 0xCD, 0xB0, 0x93, 0xA5, 0x85, - 0x94, 0x9C, 0x53, 0x8C, 0xE5, 0x3B, 0xBD, 0x53, 0x8B, 0x72, 0xF7, 0xF5, 0xBE, 0x8D, 0x4B, 0x44, - 0x9A, 0x8A, 0x4A, 0xC9, 0x78, 0x5C, 0xFE, 0x19, 0xF8, 0xA3, 0x69, 0xA7, 0x78, 0x67, 0xE0, 0x35, - 0xBF, 0x81, 0xB5, 0x81, 0xE2, 0x5F, 0x17, 0x5C, 0x2F, 0x8D, 0x35, 0x4D, 0x36, 0xC8, 0x5B, 0xBE, - 0xAB, 0xE2, 0x58, 0x62, 0x59, 0x25, 0xB6, 0x10, 0x6F, 0xB7, 0x57, 0xB6, 0x68, 0xA1, 0x8A, 0x71, - 0xF2, 0x4A, 0xCA, 0x40, 0x19, 0x5E, 0x30, 0x3F, 0x3F, 0xC5, 0x61, 0xF3, 0x08, 0xD1, 0x8E, 0x4B, - 0x2C, 0x3F, 0xBC, 0xE4, 0xE5, 0x29, 0xE9, 0x15, 0x2D, 0x79, 0x9A, 0x5A, 0x28, 0xB6, 0xB4, 0xF8, - 0xAF, 0xA5, 0x92, 0xE5, 0x56, 0x47, 0xEA, 0x58, 0x79, 0x65, 0xF5, 0xA9, 0xFD, 0x6D, 0x4E, 0xF0, - 0xE5, 0x8C, 0x63, 0x75, 0x29, 0x38, 0xA8, 0xAB, 0x45, 0x72, 0xB6, 0xAD, 0x16, 0x9E, 0xAA, 0xD7, - 0xBA, 0xBB, 0xEE, 0x5B, 0xBD, 0xF8, 0x8D, 0x1F, 0x88, 0x7C, 0x65, 0xA6, 0x78, 0xF2, 0xDB, 0xE1, - 0xE5, 0xFD, 0xAF, 0x81, 0x3E, 0x14, 0xE8, 0x16, 0xDA, 0x5D, 0x9F, 0x86, 0xEC, 0x6F, 0xE1, 0xB2, - 0xD3, 0x6C, 0x2F, 0xAD, 0xBF, 0xD4, 0xDE, 0x31, 0x8E, 0xDD, 0x60, 0x32, 0xB4, 0xCB, 0x0C, 0x92, - 0x20, 0x4C, 0xBF, 0x97, 0x96, 0x24, 0x70, 0x7A, 0x9E, 0x23, 0x1F, 0x8C, 0xAD, 0x0C, 0x74, 0x68, - 0xFE, 0xE6, 0x94, 0x22, 0xDA, 0x82, 0x49, 0x25, 0x1D, 0x39, 0xA4, 0xF5, 0x4A, 0x49, 0xD9, 0x35, - 0x25, 0xB5, 0xE2, 0x9D, 0x9A, 0x4F, 0x47, 0x46, 0x34, 0xA8, 0xAC, 0x35, 0x1A, 0xAE, 0x2A, 0x57, - 0x4D, 0xB4, 0xEE, 0xEF, 0xBA, 0x49, 0xBB, 0x2B, 0xDD, 0x59, 0x27, 0xA2, 0xB3, 0x49, 0x3B, 0x35, - 0x4B, 0xC2, 0x7E, 0x31, 0xD5, 0xE2, 0x9F, 0x5D, 0xD7, 0xBC, 0x4A, 0x35, 0x0D, 0x27, 0xC4, 0x1F, - 0x12, 0x84, 0xD7, 0xB3, 0xF8, 0xC9, 0x8C, 0x36, 0x4B, 0x63, 0xA2, 0xC7, 0x39, 0x3A, 0x9C, 0x5A, - 0x4B, 0xB3, 0xAB, 0xAC, 0x8E, 0x0C, 0xD1, 0x08, 0x49, 0xD8, 0xC3, 0xCB, 0x4C, 0x00, 0x2B, 0xD8, - 0xC9, 0xA7, 0x9D, 0x51, 0xC5, 0xBA, 0xD2, 0xC3, 0xB9, 0x2A, 0xB0, 0x9B, 0x73, 0x8C, 0x1B, 0x8A, - 0xA4, 0xE2, 0xF9, 0x9A, 0x49, 0x45, 0xF2, 0xD9, 0xE9, 0xAD, 0xDB, 0x5B, 0xE8, 0x8E, 0x2A, 0xD0, - 0xC3, 0xBA, 0x6E, 0x9D, 0x29, 0x24, 0xA3, 0x68, 0xA4, 0xEF, 0x6E, 0x77, 0xA2, 0xBB, 0xD6, 0xE9, - 0x75, 0xE5, 0x4D, 0xDD, 0x5B, 0xAB, 0x3C, 0x3F, 0xC7, 0xBE, 0x2F, 0xB8, 0xF1, 0x9F, 0x89, 0x6E, - 0xF5, 0x89, 0x12, 0xDA, 0x2B, 0x58, 0xD5, 0x2C, 0x34, 0xBB, 0x5B, 0x4B, 0x31, 0xA7, 0xD9, 0xC1, - 0x6B, 0x6E, 0xA1, 0x20, 0x09, 0x6C, 0x19, 0x92, 0x32, 0x51, 0x14, 0xB2, 0xA9, 0xC6, 0xE2, 0xD8, - 0xAF, 0x8B, 0xCE, 0xF3, 0x17, 0x99, 0xE2, 0xE5, 0x38, 0xCA, 0x5E, 0xCD, 0x7B, 0xB0, 0xBE, 0x96, - 0x8A, 0x56, 0x56, 0x4A, 0xCA, 0x37, 0x49, 0x68, 0x97, 0x45, 0x76, 0xDD, 0xDB, 0xF5, 0x70, 0xF8, - 0x68, 0x50, 0xA2, 0xA9, 0x45, 0x5B, 0xD3, 0x43, 0x8B, 0xFC, 0x00, 0xF6, 0x03, 0x00, 0x7B, 0x01, - 0x5E, 0x42, 0x56, 0x49, 0x1D, 0x29, 0x59, 0x24, 0x14, 0xC6, 0x00, 0x74, 0x00, 0x7D, 0x00, 0x1E, - 0x83, 0xB0, 0xFC, 0x29, 0xC2, 0x12, 0x93, 0x50, 0x82, 0xBB, 0xE8, 0x92, 0xFD, 0x10, 0xB4, 0x4B, - 0xC8, 0xDD, 0xD2, 0xEC, 0x0C, 0x87, 0x24, 0x7A, 0x0C, 0x0E, 0x14, 0x63, 0xA6, 0x2B, 0xFA, 0x4F, - 0xC1, 0xFF, 0x00, 0x0E, 0x6B, 0x66, 0xB5, 0xBD, 0xA5, 0x68, 0xB6, 0xDD, 0xAE, 0xAE, 0xD4, 0x55, - 0xAF, 0xA6, 0xC9, 0x6D, 0xA2, 0x6E, 0xF6, 0x77, 0xE5, 0xF2, 0xF1, 0x71, 0xF8, 0xB8, 0xC1, 0x24, - 0xAD, 0x6F, 0xF8, 0x63, 0xB0, 0x8E, 0x08, 0xD2, 0x2F, 0x2F, 0x23, 0x38, 0x00, 0x71, 0xC7, 0x03, - 0xA1, 0xF6, 0xE2, 0xBF, 0xB7, 0xF2, 0xFE, 0x1F, 0xCB, 0xB0, 0xD9, 0x5C, 0xB2, 0xF7, 0x35, 0xED, - 0x1A, 0xB2, 0x6D, 0x6F, 0x65, 0x6E, 0x56, 0xF4, 0xBC, 0x7C, 0xB5, 0x4B, 0x56, 0x7C, 0xE4, 0xAA, - 0xC9, 0xC9, 0x49, 0x2D, 0x08, 0x2C, 0xD3, 0xC9, 0x9D, 0xB4, 0xE6, 0x11, 0xA0, 0x94, 0x09, 0x6D, - 0xA7, 0x6C, 0x84, 0x8C, 0x00, 0x77, 0x20, 0x03, 0xB7, 0x03, 0x8C, 0x1E, 0xD5, 0xF1, 0xDC, 0x33, - 0x4E, 0xB7, 0x0E, 0x67, 0xF5, 0x78, 0x0B, 0x13, 0x0F, 0x72, 0xB2, 0xF6, 0xB8, 0x5A, 0x89, 0x2E, - 0x48, 0xB9, 0x5D, 0xD5, 0x82, 0x5D, 0x54, 0x2C, 0x9A, 0x8D, 0xED, 0x18, 0xB4, 0x96, 0xD6, 0x5D, - 0x52, 0x51, 0xAF, 0x49, 0x57, 0x8B, 0x49, 0xAD, 0x1D, 0xEF, 0xD1, 0x69, 0xB6, 0xD7, 0xDB, 0x6F, - 0xB8, 0x9C, 0xA0, 0x2B, 0xB9, 0x31, 0x8C, 0x80, 0x06, 0x31, 0xD0, 0x73, 0x8F, 0xCA, 0xBE, 0xD7, - 0x13, 0x83, 0xA3, 0x5A, 0x93, 0xC4, 0x61, 0xE4, 0x9D, 0x3E, 0x6E, 0x54, 0xAD, 0x6D, 0x63, 0xA3, - 0x6B, 0x6D, 0x1B, 0x5D, 0x34, 0xD3, 0xA6, 0xC7, 0x1C, 0x5F, 0x2D, 0x95, 0xB5, 0xFE, 0xBF, 0x22, - 0x3F, 0x24, 0x71, 0xC0, 0xF4, 0xF6, 0xE9, 0xC6, 0x05, 0x79, 0x7F, 0xD9, 0x70, 0xB2, 0xD3, 0xF1, - 0xFF, 0x00, 0x81, 0xF2, 0xF2, 0xB7, 0x62, 0xF9, 0xDA, 0xB2, 0x4B, 0x41, 0x86, 0x3C, 0x01, 0x80, - 0x06, 0x06, 0x00, 0xC0, 0x18, 0xC0, 0xE9, 0x8F, 0xCA, 0xB8, 0xEA, 0xE0, 0x65, 0x0B, 0x28, 0x2D, - 0x15, 0xF4, 0xF4, 0xB7, 0xA5, 0xFC, 0x8A, 0x52, 0x56, 0x5F, 0x22, 0x2C, 0x6D, 0x39, 0x18, 0xF9, - 0x70, 0x06, 0x06, 0x17, 0x18, 0xE0, 0x63, 0xF0, 0xAF, 0x3B, 0xD9, 0x2A, 0x75, 0xD5, 0x5B, 0x5A, - 0x6B, 0x4F, 0x2F, 0xBB, 0x6F, 0xC0, 0xB5, 0xF0, 0xD9, 0x6C, 0x61, 0xEA, 0xD6, 0x21, 0xE3, 0xFB, - 0x4C, 0x4A, 0x14, 0xA6, 0x44, 0x98, 0x1C, 0x1C, 0xFD, 0xD0, 0x07, 0xE0, 0x6B, 0xF9, 0xD7, 0xC6, - 0xBF, 0x0E, 0xA9, 0x63, 0x70, 0x0F, 0x8A, 0xF2, 0xC8, 0x28, 0xCE, 0x95, 0xFD, 0xAB, 0x57, 0x7C, - 0xD7, 0x4B, 0x95, 0x24, 0xB4, 0x56, 0xB3, 0xD9, 0x75, 0xDA, 0xD7, 0x67, 0xAD, 0x96, 0x62, 0xF9, - 0x24, 0xA8, 0x4D, 0xE8, 0xF6, 0x2E, 0xFC, 0x3B, 0xF0, 0xC1, 0xF1, 0x97, 0x8E, 0x7C, 0x29, 0xE1, - 0x50, 0x06, 0xDD, 0x6F, 0x5B, 0xB7, 0xB0, 0x94, 0x64, 0xA7, 0xEE, 0xD9, 0xC7, 0x98, 0x01, 0x03, - 0x23, 0xE4, 0x56, 0xE9, 0x5F, 0xC9, 0x78, 0x7A, 0x57, 0xC4, 0x42, 0x94, 0xD5, 0xAC, 0xF5, 0x56, - 0xED, 0xAD, 0xAC, 0xFD, 0x2D, 0xB7, 0xCB, 0xA1, 0xED, 0xD7, 0xA9, 0xEC, 0xE8, 0x4A, 0x71, 0xED, - 0xA7, 0xF5, 0xA7, 0xF5, 0xB7, 0x63, 0xFA, 0xEE, 0xFD, 0x99, 0x7E, 0x1E, 0x69, 0x9A, 0x4E, 0x97, - 0x60, 0xB0, 0x58, 0x43, 0x0D, 0x86, 0x89, 0x6D, 0x1D, 0xA5, 0x8C, 0x6B, 0x19, 0x48, 0xD4, 0xC6, - 0x00, 0xCA, 0x01, 0xC7, 0x00, 0x28, 0xED, 0x8E, 0x0F, 0xB8, 0xFD, 0xB3, 0x0F, 0x4E, 0x39, 0x6E, - 0x4F, 0x4E, 0x8C, 0x1D, 0xAA, 0x4D, 0x5E, 0x4D, 0x79, 0xEB, 0x67, 0xE4, 0x9D, 0xF6, 0x56, 0x76, - 0xB7, 0x4B, 0x3F, 0xCC, 0x1B, 0x58, 0xFC, 0xCE, 0x53, 0x97, 0xC3, 0x0D, 0x12, 0xFB, 0xBB, 0x3B, - 0x6B, 0x6D, 0xD2, 0x7E, 0xA9, 0x68, 0x7D, 0x11, 0xE3, 0xEF, 0x1E, 0xDB, 0xF8, 0x50, 0x58, 0x68, - 0xD6, 0x0A, 0xB7, 0x1A, 0xF6, 0xB1, 0x28, 0xB4, 0xD3, 0x6D, 0x23, 0x0A, 0xEC, 0xB9, 0x1C, 0xB1, - 0x40, 0x0F, 0xCA, 0x02, 0xFE, 0x87, 0xD3, 0x15, 0xBE, 0x55, 0x95, 0x3C, 0x72, 0x96, 0x26, 0xAB, - 0xE5, 0xA3, 0x0D, 0x64, 0xFE, 0x5B, 0x6E, 0xBF, 0x44, 0xB4, 0xEE, 0x83, 0x32, 0xCC, 0xE1, 0x81, - 0x8C, 0x68, 0x52, 0x57, 0xA8, 0xF4, 0x49, 0x5B, 0xA5, 0x93, 0xD3, 0xA2, 0xB5, 0x97, 0x96, 0xD6, - 0xD9, 0x2B, 0xD6, 0xFA, 0x04, 0xD6, 0xFA, 0x0C, 0xFA, 0x8E, 0xB1, 0x7B, 0x3C, 0xFA, 0x8F, 0xD9, - 0xCD, 0xD3, 0x48, 0x58, 0x46, 0xB0, 0xB1, 0x53, 0x80, 0x14, 0x11, 0xD3, 0x23, 0xE5, 0xCE, 0x38, - 0x1D, 0x33, 0xC6, 0x13, 0xC4, 0x53, 0x96, 0x21, 0x51, 0xC3, 0x41, 0x28, 0x6D, 0xD5, 0xE9, 0xA6, - 0x9F, 0xF0, 0x77, 0xE9, 0xB5, 0x91, 0x51, 0xC1, 0xCE, 0x9E, 0x0A, 0x55, 0xF1, 0x12, 0xF7, 0xD2, - 0xBE, 0xFB, 0x26, 0xBF, 0xE0, 0x5A, 0xEB, 0xB5, 0x9B, 0xB5, 0xAD, 0xE2, 0x1F, 0x00, 0x2E, 0xFC, - 0x47, 0xE2, 0x0D, 0x6F, 0xC6, 0x3A, 0xA6, 0xAF, 0xAA, 0xDD, 0xEA, 0x1A, 0x5D, 0xAE, 0xAC, 0xF6, - 0x1A, 0x5C, 0x52, 0xE0, 0x44, 0xB1, 0xC2, 0x4A, 0x83, 0xC0, 0xEF, 0x8C, 0x63, 0x07, 0x1C, 0x7D, - 0x0F, 0xD1, 0x71, 0x2C, 0x30, 0xB8, 0x5A, 0x34, 0x68, 0xD0, 0xA7, 0x18, 0xB6, 0xAF, 0x74, 0x92, - 0x7D, 0x34, 0x76, 0xE9, 0x7B, 0xDB, 0xD3, 0xA7, 0x4F, 0x1F, 0x20, 0xF6, 0xB5, 0xB1, 0x33, 0xAE, - 0xE5, 0x74, 0xAF, 0xA5, 0xD6, 0x8F, 0x75, 0x6D, 0x76, 0xE5, 0x76, 0xDA, 0xD7, 0xD3, 0x65, 0xA1, - 0xF1, 0x67, 0xC1, 0xBA, 0x6F, 0x89, 0xE4, 0xF1, 0x4E, 0x8F, 0x25, 0xAA, 0x4F, 0x1C, 0x9A, 0x2C, - 0x93, 0x4B, 0x16, 0xD0, 0x54, 0x1C, 0x6D, 0x6D, 0xC3, 0xD0, 0x80, 0x38, 0xE4, 0x64, 0x8C, 0x63, - 0x1C, 0xFC, 0xF6, 0x36, 0x9A, 0xC5, 0x64, 0x6A, 0x15, 0x52, 0xBA, 0x7E, 0xEF, 0x4D, 0x2C, 0x9E, - 0x9F, 0x7B, 0xE9, 0xD3, 0x67, 0xA5, 0xBD, 0x8C, 0x1C, 0xA5, 0x47, 0x36, 0x95, 0x28, 0x2D, 0x25, - 0xA3, 0xE9, 0xB2, 0x4D, 0x3B, 0x3D, 0x15, 0x9B, 0xDE, 0xCA, 0xC9, 0x5B, 0xD3, 0xF9, 0xB5, 0xF8, - 0x03, 0xE0, 0xB8, 0xFE, 0x1E, 0xFF, 0x00, 0xC1, 0x4C, 0xBF, 0x67, 0x0F, 0x08, 0xC0, 0x02, 0xDA, - 0xE9, 0x5F, 0xB5, 0xFF, 0x00, 0x80, 0x3E, 0xC6, 0xAB, 0xF7, 0x52, 0x19, 0xBC, 0x55, 0xA7, 0x4B, - 0x12, 0x8E, 0x07, 0x01, 0x65, 0x51, 0xF8, 0x57, 0xE4, 0x54, 0xE9, 0xFB, 0x3C, 0xEE, 0x92, 0xB7, - 0xFC, 0xBC, 0x83, 0xDA, 0xDB, 0xB4, 0xF6, 0xF5, 0x3F, 0x44, 0x8C, 0xDD, 0x4C, 0xB6, 0x52, 0x6B, - 0x5E, 0x59, 0x2F, 0xB9, 0x35, 0xFD, 0x6D, 0xE8, 0xB6, 0x3F, 0xBC, 0x2A, 0xFD, 0x1C, 0xF9, 0x60, - 0xA0, 0x02, 0x80, 0x0A, 0x00, 0xFE, 0x28, 0xFF, 0x00, 0xE0, 0xB5, 0xEB, 0x8F, 0xF8, 0x28, 0x17, - 0xC4, 0x83, 0x8F, 0x97, 0xFE, 0x10, 0xCF, 0x09, 0xA8, 0xC6, 0x38, 0xC7, 0x87, 0x6D, 0x78, 0xC7, - 0xE5, 0x5F, 0x03, 0xC4, 0x18, 0x6A, 0xBF, 0x5C, 0x9E, 0x29, 0x47, 0xF7, 0x77, 0x51, 0xBF, 0x9A, - 0x8C, 0x5D, 0xAD, 0xDA, 0xCD, 0x79, 0x1F, 0x4F, 0x95, 0xCA, 0x2B, 0x09, 0x18, 0x75, 0xD7, 0xF3, - 0xB1, 0x8F, 0xA5, 0x5A, 0x41, 0xAB, 0x78, 0x67, 0xF6, 0x69, 0xF1, 0x37, 0xC2, 0xF9, 0xD6, 0xD7, - 0xC1, 0xBE, 0x1B, 0x7B, 0x5D, 0x37, 0xC5, 0x96, 0xF6, 0x17, 0x82, 0xD9, 0xAD, 0x75, 0x23, 0x22, - 0x0B, 0xB8, 0xAE, 0xE0, 0x53, 0x9F, 0x31, 0xA4, 0x2C, 0xE5, 0x98, 0x7C, 0xCA, 0x54, 0x82, 0x41, - 0x15, 0xF5, 0xFC, 0x2B, 0x53, 0x0D, 0x3C, 0x9E, 0xB6, 0x1A, 0x9B, 0x4A, 0x76, 0x6E, 0xDD, 0xD2, - 0x8B, 0xBE, 0x9B, 0x3D, 0x57, 0x53, 0xF3, 0x9E, 0x2A, 0x6B, 0x0B, 0x99, 0xFB, 0x6C, 0x5D, 0x26, - 0xD4, 0x94, 0x14, 0x27, 0x6B, 0xA8, 0x49, 0x4E, 0x2D, 0xEB, 0xF6, 0x6F, 0x1D, 0x13, 0x4A, 0xCF, - 0x6E, 0x96, 0x3E, 0xE6, 0xFD, 0xAA, 0x7C, 0x33, 0xE2, 0x2F, 0x17, 0xFC, 0x1C, 0x16, 0xFE, 0x18, - 0x9E, 0xE2, 0x3B, 0x94, 0x10, 0x5C, 0xC8, 0xF6, 0x77, 0xBF, 0x63, 0x93, 0x62, 0x94, 0x2D, 0xB5, - 0xB3, 0x83, 0x80, 0xAC, 0x71, 0xFE, 0xCF, 0xD2, 0xBC, 0xFE, 0x19, 0xAD, 0x4F, 0x0D, 0x99, 0xCA, - 0x33, 0xB2, 0x93, 0x4D, 0x46, 0xEB, 0x44, 0xFE, 0x5A, 0xA5, 0x6D, 0x34, 0xB6, 0xFD, 0x11, 0xE8, - 0x71, 0x05, 0x39, 0xCF, 0x01, 0x4A, 0xA2, 0xA4, 0xAA, 0x42, 0x32, 0x8C, 0xA5, 0x16, 0x93, 0x52, - 0x8F, 0x2B, 0x56, 0xB6, 0x89, 0xEA, 0xD3, 0x4B, 0xCB, 0x45, 0x7B, 0x1E, 0x87, 0xE1, 0x25, 0xD5, - 0xEE, 0x7E, 0x07, 0x69, 0xC9, 0x6D, 0x24, 0xAB, 0xAC, 0x8F, 0x0B, 0x08, 0xF7, 0xC6, 0xE1, 0x66, - 0x49, 0x96, 0x1C, 0xE1, 0x58, 0x8C, 0x02, 0x08, 0x3F, 0x95, 0x72, 0xE3, 0x15, 0x1A, 0x79, 0xF4, - 0xB4, 0xF7, 0x14, 0xD7, 0xDD, 0x7F, 0xF2, 0xFF, 0x00, 0x80, 0x3C, 0xB9, 0x62, 0x67, 0xC3, 0x54, - 0xEC, 0xDF, 0xB4, 0xF6, 0x49, 0x2D, 0x93, 0x4F, 0x97, 0x6F, 0x5F, 0x5B, 0x6B, 0xBD, 0x8F, 0x42, - 0xFD, 0x8F, 0xBE, 0x26, 0xF8, 0xA7, 0xE1, 0xB7, 0x84, 0xEC, 0x75, 0x2F, 0x8B, 0xBF, 0xE9, 0x1F, - 0xBB, 0x9A, 0xD7, 0x5E, 0x8E, 0xF9, 0xD2, 0xF6, 0xE4, 0x5A, 0x86, 0x71, 0x15, 0xC1, 0x00, 0x95, - 0x32, 0x28, 0x00, 0x80, 0x08, 0x07, 0x00, 0x90, 0x70, 0x01, 0xFD, 0x17, 0x0B, 0x9A, 0xD2, 0x86, - 0x75, 0x4A, 0x96, 0x5D, 0x36, 0xA9, 0x54, 0x51, 0x53, 0x51, 0x8D, 0xA3, 0x7D, 0x2C, 0xF4, 0x5A, - 0x35, 0xD9, 0x25, 0x75, 0xB3, 0x4D, 0x9C, 0x38, 0x4C, 0x2D, 0x4A, 0xD9, 0x13, 0x79, 0xAC, 0x2F, - 0x28, 0x29, 0x38, 0xF3, 0xB4, 0xDD, 0xAE, 0xD2, 0xBB, 0xBB, 0x5A, 0x69, 0xAB, 0x77, 0xD3, 0x56, - 0x92, 0x3C, 0xAB, 0xE3, 0xDF, 0xEC, 0xD9, 0xF1, 0x2A, 0xF7, 0xC4, 0x9A, 0xA7, 0xC5, 0x7F, 0xD9, - 0xCF, 0xC7, 0x1A, 0x7F, 0x86, 0x3E, 0x15, 0xFC, 0x40, 0xBB, 0x6B, 0xFB, 0xFD, 0x1A, 0xD1, 0x7E, - 0xD1, 0xA5, 0xE9, 0x1A, 0x84, 0xC9, 0xF2, 0xC9, 0x65, 0x28, 0xC8, 0xF2, 0xA7, 0x0A, 0xAD, 0x90, - 0x51, 0xFC, 0xCD, 0xE3, 0x68, 0x00, 0x33, 0x7F, 0x50, 0xF0, 0x5F, 0x1D, 0x64, 0x59, 0x4D, 0x28, - 0x61, 0xF8, 0xA3, 0x07, 0xCC, 0xE3, 0x68, 0x45, 0xDA, 0x2F, 0x44, 0xD7, 0x2B, 0x69, 0x34, 0xF5, - 0x77, 0x4D, 0x5B, 0x91, 0x2D, 0x9B, 0xBB, 0x4F, 0xE3, 0xF0, 0xF8, 0x78, 0xE2, 0xE9, 0xCA, 0x78, - 0x1A, 0x4D, 0xC9, 0xAE, 0x67, 0xCB, 0x39, 0x53, 0x8E, 0xBB, 0x6B, 0x67, 0x79, 0x35, 0x66, 0xE7, - 0xA3, 0xBB, 0x77, 0xD1, 0x24, 0xBC, 0x8B, 0xE0, 0x8F, 0xC3, 0xAD, 0x4F, 0xE1, 0x9E, 0x83, 0xE2, - 0x1B, 0xCF, 0x18, 0xDE, 0xC7, 0xA8, 0x78, 0xA7, 0x52, 0xD4, 0x1F, 0x52, 0xD5, 0x75, 0x17, 0x76, - 0x91, 0x65, 0x48, 0x8B, 0x08, 0x83, 0x12, 0x07, 0xCA, 0xA3, 0x2D, 0x8E, 0xC4, 0x0C, 0x74, 0xAF, - 0xD3, 0xF8, 0x93, 0x33, 0xC3, 0x67, 0xD8, 0xDC, 0x3E, 0x13, 0x28, 0x87, 0x2E, 0x1E, 0x31, 0x5C, - 0xB1, 0x56, 0xB2, 0xE6, 0xE5, 0x76, 0x6A, 0xCA, 0xF7, 0x49, 0xEE, 0x9A, 0xD5, 0xAB, 0x3D, 0x9C, - 0xE1, 0x69, 0x2C, 0x2B, 0xAD, 0x88, 0x9D, 0x25, 0x49, 0x45, 0x28, 0x28, 0x5D, 0x3E, 0x54, 0x96, - 0xAF, 0x99, 0x5D, 0x36, 0xDB, 0x6D, 0xBE, 0xD6, 0x4D, 0xC6, 0xED, 0xAE, 0x4F, 0xE0, 0x55, 0x8C, - 0x9E, 0x3C, 0xF1, 0xA7, 0xC4, 0x2F, 0x8A, 0xF7, 0x7B, 0xA5, 0xB4, 0x97, 0x54, 0x3E, 0x18, 0xD0, - 0x24, 0x6F, 0x9B, 0xCB, 0xB3, 0xB4, 0x07, 0x70, 0x45, 0x39, 0xE4, 0x85, 0x04, 0xFD, 0x09, 0xC7, - 0x07, 0x1E, 0xCF, 0x16, 0x57, 0x86, 0x47, 0x95, 0x61, 0x32, 0x08, 0x46, 0xD6, 0xD6, 0x4D, 0x25, - 0x67, 0x51, 0xDE, 0x4A, 0x3A, 0x6B, 0x7B, 0x24, 0x93, 0x69, 0x27, 0xF0, 0xDE, 0xEE, 0xCF, 0x87, - 0x2F, 0xF6, 0x75, 0xB1, 0xAB, 0xDB, 0x24, 0xB9, 0x57, 0xB4, 0x92, 0x49, 0xB6, 0x9C, 0xED, 0xAE, - 0xDB, 0x42, 0x1C, 0xB1, 0xB3, 0x4D, 0xBB, 0xB5, 0xA6, 0xEB, 0x1F, 0xE3, 0xEF, 0x89, 0x6E, 0xA0, - 0xF1, 0x06, 0x8C, 0xDA, 0x13, 0x47, 0x15, 0xEE, 0x99, 0x71, 0x0A, 0x68, 0x46, 0x3B, 0x88, 0x82, - 0xDE, 0x48, 0x18, 0x19, 0x91, 0xD8, 0x31, 0xDA, 0x32, 0x02, 0x1F, 0x30, 0xA6, 0x03, 0x36, 0x41, - 0x07, 0x29, 0xF9, 0xC6, 0x0F, 0x8A, 0xB8, 0x67, 0x21, 0xC5, 0x51, 0xCA, 0xB8, 0xA7, 0x10, 0xA9, - 0x55, 0xC4, 0x35, 0x15, 0x07, 0x19, 0xBF, 0x7A, 0x4F, 0x96, 0x09, 0x72, 0xC5, 0xC6, 0x2E, 0x3E, - 0xEC, 0x96, 0x96, 0xD2, 0xD1, 0x49, 0xBD, 0x7F, 0xAB, 0x32, 0x1E, 0x1F, 0xCA, 0xEB, 0xF0, 0x6E, - 0x61, 0x0A, 0x1F, 0xC0, 0x95, 0x29, 0x4E, 0x53, 0x49, 0xF3, 0xA5, 0x05, 0xCC, 0xA5, 0x16, 0x95, - 0xDC, 0x95, 0xAF, 0x0E, 0x58, 0xB7, 0x74, 0x93, 0xD1, 0x28, 0x9F, 0xA1, 0xFF, 0x00, 0x0B, 0x7C, - 0x53, 0x63, 0xE3, 0x9F, 0x03, 0xDA, 0x5A, 0x6B, 0x32, 0x5B, 0x4F, 0x27, 0xD9, 0x7C, 0x99, 0x63, - 0x79, 0xE3, 0xB8, 0xF9, 0xED, 0xD5, 0x5A, 0x54, 0x0C, 0x09, 0x52, 0x63, 0xF9, 0x0E, 0x41, 0xE3, - 0x00, 0xF6, 0x15, 0xF9, 0x96, 0x7D, 0x96, 0x62, 0x32, 0xFC, 0xC2, 0x59, 0x8E, 0x59, 0x16, 0xE0, - 0xA5, 0x66, 0xE2, 0x9D, 0x97, 0x5B, 0x35, 0xBD, 0x9A, 0x6D, 0x3B, 0x2D, 0xEC, 0x9E, 0x8D, 0x23, - 0xE4, 0x63, 0x4D, 0xE5, 0xB8, 0x87, 0x96, 0x56, 0xA9, 0x79, 0x47, 0x58, 0x4A, 0xD6, 0x72, 0x8B, - 0xD2, 0x3A, 0x6E, 0x9A, 0x56, 0x4D, 0x4A, 0xCE, 0x4B, 0xDE, 0x4B, 0x57, 0x6F, 0xA4, 0xBE, 0x04, - 0xFC, 0x1C, 0xD7, 0xFE, 0x26, 0xF8, 0x7F, 0x5A, 0xD7, 0x35, 0xFB, 0x8D, 0x23, 0xC0, 0x1F, 0x07, - 0xBC, 0x31, 0xA8, 0x3E, 0x91, 0xAD, 0x7C, 0x60, 0xF1, 0xEC, 0xAD, 0xA6, 0x78, 0x3A, 0x70, 0x81, - 0x7F, 0x73, 0xA6, 0xC6, 0x37, 0x5C, 0x6A, 0x97, 0x78, 0x20, 0xFD, 0x96, 0xCA, 0x39, 0x9B, 0x81, - 0x9D, 0xBC, 0x91, 0xF2, 0xFC, 0x45, 0x5E, 0x8E, 0x07, 0x1F, 0x42, 0xB6, 0x19, 0x73, 0xE2, 0xE4, - 0x93, 0x54, 0xA1, 0x34, 0xA5, 0x19, 0x36, 0xD2, 0x52, 0x71, 0x56, 0x87, 0x92, 0x9B, 0x8B, 0xB2, - 0x5B, 0x26, 0xAF, 0x2B, 0x17, 0x46, 0x94, 0xEA, 0x52, 0xB3, 0x8C, 0xAE, 0x95, 0xAC, 0xF5, 0x72, - 0x4A, 0x5A, 0x69, 0x6B, 0x6B, 0x6B, 0xEC, 0x9A, 0x6B, 0xA5, 0x97, 0xCD, 0xBF, 0x1C, 0xFF, 0x00, - 0x69, 0xBF, 0x83, 0x3F, 0xB2, 0xD7, 0x88, 0xF4, 0xCF, 0x04, 0x7E, 0xCC, 0xFF, 0x00, 0x0D, 0xB4, - 0xEF, 0x1D, 0x78, 0x9A, 0xDE, 0x43, 0x75, 0x79, 0xFB, 0x47, 0xFC, 0x79, 0xD1, 0xF4, 0xFF, 0x00, - 0x10, 0x6A, 0x1A, 0x0C, 0xEE, 0x76, 0xDB, 0x37, 0x85, 0xBC, 0x17, 0x22, 0xC9, 0xA6, 0xE9, 0xE1, - 0x59, 0x8B, 0x2C, 0xD7, 0x6D, 0x7B, 0x71, 0x85, 0xCA, 0x98, 0x99, 0x85, 0x7D, 0x5F, 0x0D, 0x70, - 0x9E, 0x67, 0xC5, 0x14, 0xE7, 0x9A, 0xE7, 0xB8, 0x88, 0xC6, 0x94, 0x24, 0x93, 0xC3, 0x51, 0xAA, - 0xE1, 0xCD, 0x1B, 0x3B, 0xFB, 0x5A, 0xAA, 0xD2, 0x6D, 0x5D, 0x59, 0x46, 0xEB, 0x95, 0x3B, 0xE8, - 0xAE, 0x7D, 0x2F, 0x0C, 0xF0, 0xEC, 0x73, 0x15, 0x52, 0x58, 0xEA, 0xAE, 0x18, 0x77, 0xEE, 0xC2, - 0x9C, 0x13, 0x51, 0x72, 0x93, 0x52, 0x71, 0x6F, 0xA4, 0x64, 0x93, 0xE5, 0x4B, 0xDD, 0x52, 0x6A, - 0x3A, 0x2E, 0x54, 0x43, 0xA6, 0xFC, 0x65, 0xD5, 0xBF, 0x68, 0x1F, 0x09, 0xB6, 0xBF, 0xF1, 0x43, - 0xC6, 0x7A, 0xBF, 0x8C, 0x3C, 0x55, 0x10, 0x65, 0x7D, 0x5F, 0xC5, 0x37, 0xD3, 0x6A, 0x72, 0xCA, - 0x42, 0x96, 0x46, 0xB7, 0x12, 0x65, 0x52, 0x2D, 0xAC, 0xC5, 0x55, 0x42, 0x2A, 0x8D, 0xA4, 0x01, - 0x8E, 0x3E, 0x7B, 0x1F, 0x91, 0xAE, 0x16, 0xCF, 0xE5, 0x4F, 0x29, 0xA4, 0xA1, 0x4A, 0x49, 0x2B, - 0x38, 0x27, 0xEE, 0x3B, 0x59, 0x4B, 0x95, 0xA5, 0x34, 0xDA, 0x4E, 0xF7, 0xE5, 0x76, 0xBF, 0x2A, - 0xBD, 0xCE, 0x0A, 0xB8, 0x19, 0x61, 0xB9, 0x68, 0xB8, 0xD9, 0xAB, 0x3D, 0x1E, 0x89, 0xA4, 0x93, - 0x4D, 0xAD, 0x1F, 0x66, 0x92, 0xB3, 0x5A, 0x5B, 0x44, 0x8F, 0x99, 0x3E, 0x21, 0xFC, 0x41, 0xF0, - 0x56, 0xAF, 0xE1, 0x0D, 0x4B, 0xC2, 0x9A, 0x8C, 0x76, 0xBA, 0x96, 0xB3, 0xA0, 0x6B, 0xD1, 0x43, - 0xA7, 0xD8, 0x88, 0x08, 0xBC, 0x59, 0x55, 0x90, 0xCE, 0xEA, 0xDD, 0x55, 0x04, 0x4C, 0xFB, 0x9B, - 0x18, 0x39, 0x51, 0xC9, 0x38, 0x3D, 0x13, 0xE1, 0xBA, 0xF8, 0x4C, 0x7D, 0x3C, 0xCA, 0xF1, 0xF6, - 0x75, 0x62, 0xB9, 0xA2, 0xA9, 0x4B, 0x95, 0xC6, 0xCF, 0x95, 0x36, 0xBD, 0xDB, 0xDD, 0xA8, 0xC5, - 0x5D, 0x5B, 0x55, 0x64, 0x95, 0xCF, 0x6F, 0x85, 0xFE, 0xBD, 0x5F, 0x11, 0x52, 0xBD, 0x0A, 0x53, - 0xA7, 0x04, 0xE5, 0x17, 0x29, 0x68, 0x9D, 0x97, 0x4B, 0xA5, 0x75, 0xCC, 0xAC, 0xAC, 0xDA, 0xD1, - 0xB4, 0xEC, 0x7C, 0xF5, 0xE1, 0x3F, 0x82, 0x5E, 0x21, 0xF1, 0x67, 0x8A, 0x24, 0xF1, 0x0E, 0x97, - 0x61, 0x04, 0x7E, 0x1C, 0xF0, 0xDD, 0xC3, 0x4B, 0xAC, 0xF8, 0x8F, 0x5C, 0xBE, 0x83, 0x45, 0xF0, - 0x8E, 0x8D, 0x1C, 0x71, 0x16, 0x32, 0x3E, 0xA1, 0x23, 0xF9, 0x2E, 0xD1, 0x0D, 0xA1, 0xA2, 0x8D, - 0x9D, 0xDF, 0x2B, 0xB5, 0x4E, 0x78, 0xF5, 0xB0, 0xF8, 0xC9, 0x65, 0x78, 0x5A, 0xF9, 0x4D, 0x14, - 0xEB, 0xD4, 0xFB, 0x2D, 0x45, 0xA8, 0x72, 0xB6, 0xB7, 0x6A, 0x2D, 0x45, 0x59, 0xBB, 0x59, 0xDD, - 0x2B, 0x26, 0xB6, 0xBF, 0xDA, 0x67, 0x99, 0xB5, 0x3C, 0x47, 0x0F, 0xCB, 0x24, 0x75, 0x5D, 0x3A, - 0xF3, 0xB3, 0xA6, 0xE0, 0x9B, 0xAA, 0xDD, 0xD5, 0xE3, 0xCB, 0xFC, 0xB3, 0xD9, 0x39, 0x24, 0x92, - 0xBA, 0x4D, 0x3B, 0x5B, 0xED, 0xDB, 0x2B, 0xDF, 0x84, 0x5A, 0x36, 0x9D, 0x1D, 0xC5, 0x8E, 0xA9, - 0xFF, 0x00, 0x0B, 0x3A, 0x54, 0xB6, 0x74, 0x53, 0x62, 0x92, 0x68, 0x3E, 0x09, 0x8A, 0x40, 0x3E, - 0x42, 0x1C, 0xA8, 0xBC, 0xB9, 0x41, 0xB1, 0xB7, 0x02, 0xB6, 0xBD, 0x32, 0x09, 0x18, 0xAF, 0x85, - 0x95, 0x0A, 0x4E, 0x6E, 0x92, 0x4F, 0xDA, 0xD9, 0x5A, 0x2A, 0x2E, 0xC9, 0xDB, 0x58, 0xB9, 0x26, - 0x9A, 0xBA, 0x76, 0x4E, 0x2A, 0xCE, 0xD6, 0x49, 0xD9, 0x27, 0xF9, 0x7E, 0x3E, 0xAE, 0x2B, 0x0B, - 0x0A, 0x8F, 0x34, 0x4A, 0x8C, 0x23, 0xBA, 0x95, 0x9C, 0xAC, 0x96, 0xA9, 0xAB, 0x72, 0xEA, 0xAC, - 0xEC, 0xAE, 0xB6, 0x5A, 0x5B, 0x4F, 0x8D, 0xBF, 0x69, 0xAF, 0x8B, 0x9A, 0xCE, 0xAB, 0xE1, 0x6B, - 0xDF, 0x0F, 0x5A, 0x78, 0xB6, 0x5F, 0x86, 0x7A, 0x05, 0xAC, 0x9B, 0x53, 0x4B, 0xF0, 0x1F, 0x87, - 0xDF, 0x48, 0xB1, 0xBB, 0x42, 0x09, 0x41, 0x70, 0xF6, 0x8D, 0x1C, 0xD3, 0xFC, 0xFB, 0x50, 0x99, - 0xE4, 0x90, 0xFC, 0xCC, 0xC4, 0xE0, 0x36, 0xEF, 0xD2, 0x78, 0x3B, 0x87, 0xF0, 0xCE, 0x0F, 0x11, - 0x89, 0xA7, 0xED, 0x71, 0x0E, 0x36, 0xA7, 0x4E, 0x70, 0x4E, 0x94, 0x55, 0x95, 0xDA, 0xEA, 0x9B, - 0x4B, 0x4E, 0xA9, 0x2B, 0x37, 0xCD, 0xCA, 0x97, 0xE4, 0x58, 0x9E, 0x31, 0x78, 0xEE, 0x22, 0xA3, - 0x92, 0x65, 0xCB, 0x97, 0x0D, 0x1D, 0x5B, 0x76, 0xE6, 0x9F, 0xBB, 0xA6, 0x96, 0x51, 0x8C, 0x53, - 0x8F, 0xBB, 0x15, 0x67, 0xB6, 0x9A, 0x26, 0x79, 0x1F, 0xEC, 0x13, 0xA4, 0xF8, 0x27, 0x59, 0xF1, - 0xA6, 0x87, 0x07, 0xC4, 0xE8, 0xAF, 0xCF, 0x85, 0xEF, 0x6F, 0xE7, 0x8F, 0x58, 0xBE, 0xD3, 0x6F, - 0xA3, 0xD3, 0x2E, 0x61, 0x91, 0xCE, 0xDB, 0x69, 0xE4, 0xBA, 0x96, 0x29, 0x51, 0x15, 0x58, 0x29, - 0x25, 0x90, 0x8C, 0x01, 0x9C, 0x63, 0x23, 0xE7, 0x38, 0x83, 0x1F, 0x9F, 0x4E, 0xAD, 0x7C, 0xB7, - 0x30, 0x84, 0x69, 0xD3, 0xA5, 0x07, 0xA5, 0x35, 0x68, 0x25, 0xCA, 0x9C, 0x6D, 0x3D, 0x3A, 0xB5, - 0x65, 0x2B, 0x6A, 0xF5, 0x69, 0x5E, 0xFF, 0x00, 0x3B, 0x9D, 0x2A, 0x15, 0x78, 0xD2, 0x93, 0xC4, - 0x45, 0xCE, 0x94, 0x20, 0x9A, 0x5A, 0x68, 0xDA, 0x49, 0xDB, 0xB7, 0xC4, 0xED, 0xD5, 0x6E, 0xBA, - 0x23, 0xF4, 0x5B, 0xE2, 0xAF, 0x86, 0xFC, 0x1F, 0xE1, 0x8F, 0x1A, 0xEA, 0x3A, 0x6F, 0x80, 0x35, - 0xEB, 0x7F, 0x11, 0xF8, 0x40, 0x2C, 0x52, 0xE8, 0x9A, 0x94, 0x1A, 0x8C, 0x5A, 0x9C, 0xC6, 0x23, - 0x18, 0xDE, 0x93, 0x4B, 0x1A, 0xAA, 0x86, 0x0C, 0x1B, 0x80, 0x07, 0x18, 0xF5, 0xAF, 0xCF, 0xAA, - 0xD0, 0xC1, 0xD5, 0x8A, 0x9B, 0x9B, 0x6A, 0x50, 0x4D, 0x34, 0xD3, 0xE5, 0x76, 0xE5, 0x6B, 0xCA, - 0xF6, 0xD1, 0x6A, 0xAF, 0xB2, 0x49, 0x33, 0xE8, 0x29, 0xF2, 0xA7, 0x15, 0x49, 0x3E, 0x5B, 0xDB, - 0x5B, 0x74, 0xDB, 0x44, 0x96, 0x96, 0xB7, 0x45, 0xA5, 0xB4, 0x3C, 0xFC, 0x0C, 0x00, 0x30, 0x07, - 0x03, 0x80, 0x30, 0x3D, 0xB0, 0x3F, 0x2A, 0xF9, 0xEC, 0x4A, 0x8C, 0x6A, 0x4E, 0x34, 0xDF, 0xBA, - 0x9D, 0x97, 0xA2, 0xD1, 0x74, 0x5B, 0x69, 0xD1, 0x1D, 0x4A, 0xD6, 0x56, 0x5A, 0x1F, 0x26, 0xFE, - 0xD2, 0xF3, 0xCD, 0xA6, 0xE9, 0x29, 0xA9, 0xD9, 0xC9, 0xF6, 0x4B, 0xDD, 0x35, 0x5B, 0x52, 0xB3, - 0xBA, 0x50, 0x14, 0xDB, 0xCB, 0x02, 0xA3, 0xC7, 0x20, 0xFA, 0x34, 0x6A, 0x46, 0x01, 0xF4, 0xF5, - 0xC7, 0xBB, 0x90, 0x61, 0xA3, 0x57, 0x0F, 0x7A, 0xF1, 0x6E, 0x8A, 0x9C, 0x1C, 0x92, 0xB6, 0xCA, - 0x4B, 0xE1, 0xBB, 0x4A, 0xF6, 0xBA, 0x49, 0xE9, 0x6E, 0xA9, 0x1F, 0x25, 0x98, 0x5A, 0x3C, 0x53, - 0x97, 0x72, 0xAD, 0x5B, 0x6A, 0xD6, 0xDD, 0x37, 0x15, 0x67, 0xD3, 0xAA, 0xD1, 0xE9, 0x6B, 0x37, - 0xD1, 0x1B, 0x3F, 0xB3, 0xDB, 0xDB, 0xEA, 0xBA, 0x9E, 0xB9, 0x7D, 0x14, 0xBA, 0xD5, 0xCD, 0xD6, - 0xAF, 0xA6, 0x5B, 0x6A, 0x92, 0xBE, 0xA8, 0xD1, 0xB5, 0xE5, 0xC5, 0xE4, 0xAA, 0x92, 0x5D, 0xCD, - 0x28, 0x45, 0x00, 0xA9, 0xDC, 0xFB, 0x70, 0x09, 0xE8, 0x4F, 0x4E, 0x7F, 0x45, 0xE2, 0xDE, 0x19, - 0x79, 0x7E, 0x03, 0x31, 0xCA, 0x68, 0xE2, 0x29, 0x4B, 0xEB, 0x34, 0x69, 0xD4, 0xA6, 0xA9, 0xF3, - 0x3F, 0x75, 0x4E, 0x2E, 0xD3, 0x8C, 0x60, 0xDF, 0x34, 0x6C, 0xEF, 0x65, 0x24, 0x9A, 0x6F, 0x45, - 0x76, 0xB9, 0x68, 0xD6, 0xA8, 0xF8, 0xA5, 0x4D, 0xAB, 0x46, 0x11, 0xB4, 0xAF, 0xA2, 0xDD, 0xC5, - 0x72, 0x2E, 0xCD, 0xA5, 0x65, 0xA5, 0x96, 0x8B, 0xA2, 0x3E, 0xA7, 0x96, 0x33, 0x83, 0x0A, 0x14, - 0xF9, 0xD0, 0xE0, 0x07, 0xE1, 0x14, 0xFD, 0xD1, 0x9E, 0x3B, 0x1F, 0xE8, 0x3D, 0xFF, 0x00, 0x9E, - 0x6A, 0xE5, 0x35, 0xF0, 0x39, 0x8C, 0x32, 0xE9, 0x54, 0x8D, 0xDD, 0x9A, 0x69, 0x4F, 0x95, 0x5F, - 0xAB, 0xBC, 0x39, 0xAD, 0xA7, 0x48, 0xB4, 0xBD, 0x36, 0xFD, 0x0B, 0x9F, 0xF7, 0x4D, 0xF2, 0xF4, - 0xB7, 0x4E, 0x8A, 0xD6, 0xB2, 0xEB, 0xA7, 0xDD, 0xF8, 0x7E, 0x69, 0x7C, 0x67, 0xF0, 0xE5, 0xFD, - 0xFF, 0x00, 0xC5, 0x4F, 0x0F, 0x5E, 0x27, 0x93, 0x6F, 0x6F, 0x65, 0x77, 0x33, 0x99, 0x27, 0x8A, - 0x62, 0x92, 0x32, 0x22, 0x6E, 0x89, 0x1D, 0x62, 0x61, 0xBC, 0x6D, 0xC7, 0x25, 0x47, 0x23, 0xF1, - 0xFD, 0xD7, 0x26, 0xE0, 0xAC, 0xCF, 0x17, 0x80, 0x78, 0x8A, 0x1E, 0xCD, 0xD3, 0x8C, 0x5B, 0x6D, - 0xAA, 0xCB, 0x48, 0x59, 0xC9, 0xC5, 0x7B, 0x1D, 0x55, 0xA4, 0xBB, 0x68, 0xBA, 0xDF, 0x5F, 0xCF, - 0xF0, 0x58, 0xAA, 0x14, 0x30, 0x79, 0xE5, 0x3A, 0xBA, 0x39, 0xDA, 0xCB, 0xD2, 0x2B, 0x4B, 0x2E, - 0xD7, 0xE8, 0xAC, 0xAC, 0xF5, 0x4B, 0x6F, 0xD1, 0xEF, 0x01, 0x69, 0xB3, 0xDC, 0x68, 0x1A, 0x6C, - 0x31, 0xF9, 0x6B, 0x88, 0x10, 0x2E, 0xE5, 0x70, 0x84, 0x01, 0xD0, 0x00, 0xA4, 0xFA, 0x0E, 0x71, - 0xDB, 0xD2, 0xBF, 0x21, 0xC7, 0xF0, 0xF5, 0x59, 0x66, 0x95, 0x29, 0x7B, 0x68, 0x45, 0xDE, 0xD7, - 0xE5, 0xAD, 0x65, 0x64, 0xDE, 0xCA, 0x93, 0x7E, 0x9A, 0x7C, 0x92, 0x3E, 0xC7, 0x24, 0xAA, 0xA9, - 0xE5, 0x34, 0x13, 0x8E, 0xAA, 0x11, 0xBA, 0x56, 0xD2, 0xD1, 0x4A, 0xFA, 0xB4, 0x95, 0xAD, 0x7F, - 0x93, 0xD3, 0x4B, 0x1D, 0x65, 0xD5, 0xBF, 0xD9, 0xE2, 0x52, 0xF2, 0xC4, 0xFE, 0x64, 0x41, 0xC8, - 0x8D, 0x24, 0x40, 0x8B, 0x91, 0xC1, 0x0C, 0x8B, 0xD0, 0x0E, 0x80, 0x11, 0x5F, 0x2F, 0x57, 0x0F, - 0x1C, 0x2C, 0xE3, 0x1E, 0x74, 0xD5, 0xB7, 0x8A, 0x92, 0xB6, 0x96, 0xB5, 0xA5, 0x18, 0xBB, 0xDE, - 0xC9, 0xD9, 0x35, 0xD8, 0xF5, 0x22, 0xA2, 0xAF, 0x14, 0xAC, 0xD6, 0x89, 0x69, 0xDB, 0xCB, 0x4F, - 0xCA, 0xD7, 0xEF, 0xA1, 0xF9, 0x7F, 0xF1, 0x56, 0xD0, 0xC9, 0xFB, 0x41, 0xF8, 0x41, 0x51, 0xA0, - 0x0D, 0x2D, 0xF5, 0xC8, 0xDD, 0x2C, 0x82, 0xDE, 0x35, 0xDD, 0x1A, 0xE7, 0x73, 0x1C, 0x05, 0x00, - 0x9E, 0xA4, 0xF4, 0xC7, 0xA1, 0xC7, 0xEA, 0xB8, 0x2C, 0x1D, 0x2F, 0xEC, 0xAA, 0x75, 0xA8, 0x4E, - 0x2D, 0x28, 0x45, 0x59, 0xF3, 0x27, 0xBF, 0x4F, 0x75, 0x2B, 0x5F, 0x4B, 0xDD, 0x5E, 0xDA, 0x24, - 0x91, 0xF0, 0x3C, 0xEE, 0x58, 0x0C, 0xEA, 0x92, 0xDF, 0xDA, 0x51, 0x4A, 0xF6, 0x4B, 0x74, 0x96, - 0xFA, 0x25, 0x65, 0xF8, 0x75, 0xD0, 0xFD, 0x34, 0xD2, 0xAD, 0xB6, 0xE9, 0xB0, 0x85, 0x16, 0x8A, - 0x12, 0x24, 0x8C, 0x2C, 0x37, 0x02, 0x68, 0xC6, 0xD4, 0x00, 0x04, 0x7E, 0x77, 0x0F, 0xBD, 0x8F, - 0xA7, 0xD2, 0xBF, 0x32, 0xCC, 0x30, 0xB2, 0x85, 0x7A, 0x93, 0x4A, 0x11, 0x82, 0xB7, 0xBA, 0xA4, - 0x9D, 0xAF, 0xD1, 0x27, 0x66, 0xDA, 0xD2, 0xFA, 0x69, 0xF9, 0x7D, 0xEE, 0x0A, 0x50, 0x78, 0x78, - 0x4A, 0xCD, 0x2B, 0x2D, 0x2D, 0xB6, 0xD6, 0x5A, 0x68, 0xAD, 0xBF, 0x4F, 0x97, 0x4F, 0x39, 0xF8, - 0x81, 0xFB, 0x54, 0xFE, 0xD0, 0x1F, 0xB3, 0x0D, 0x97, 0xF6, 0xCF, 0xC1, 0xCF, 0x18, 0xC9, 0x69, - 0xA4, 0x5E, 0xAA, 0xDA, 0xF8, 0x9F, 0xE1, 0xEF, 0x89, 0x74, 0xDB, 0x7F, 0x1B, 0xFC, 0x27, 0xF1, - 0xA5, 0xB3, 0x4A, 0xAA, 0xF6, 0xDA, 0xDF, 0x86, 0x2F, 0x52, 0x5D, 0x3E, 0xF1, 0x30, 0xC4, 0x0D, - 0xF1, 0x6F, 0x5C, 0xE5, 0x59, 0x48, 0x06, 0xBE, 0xA3, 0x86, 0xB8, 0x5E, 0xBE, 0x7D, 0x97, 0x56, - 0xF6, 0x74, 0xD5, 0xA3, 0x67, 0xCD, 0xCC, 0xA3, 0x64, 0x93, 0xEF, 0xB2, 0x76, 0x49, 0xD9, 0x35, - 0x74, 0x95, 0xBB, 0x79, 0xD2, 0xC5, 0x62, 0x69, 0xF1, 0x36, 0x0B, 0x03, 0x46, 0xEE, 0x35, 0x54, - 0xE3, 0xC8, 0x95, 0xEE, 0xD4, 0x79, 0xA3, 0x6B, 0x2B, 0x26, 0xAC, 0xEC, 0xD6, 0xB6, 0xBE, 0x96, - 0x3E, 0xBA, 0xF8, 0x1B, 0x2F, 0xEC, 0x6F, 0xF1, 0xFB, 0xC2, 0x16, 0x17, 0xCD, 0xE0, 0xEF, 0x0B, - 0xFE, 0xC6, 0x3F, 0x17, 0xF5, 0xA5, 0x3B, 0xDB, 0xC3, 0x56, 0xB7, 0x7A, 0x9F, 0xEC, 0x97, 0xE2, - 0x3B, 0xA7, 0x1F, 0xBB, 0x56, 0xD3, 0xD1, 0x65, 0xD5, 0x3C, 0x36, 0xD2, 0x33, 0x03, 0xBD, 0x24, - 0xBC, 0xB3, 0x43, 0xD5, 0x61, 0x4E, 0x47, 0x9B, 0x98, 0xC9, 0x60, 0x25, 0x3C, 0xBB, 0x13, 0x49, - 0x54, 0x51, 0x49, 0xC1, 0xC9, 0xBB, 0xC3, 0x4D, 0x95, 0x9A, 0xBE, 0xF6, 0xD3, 0xC9, 0xD9, 0xEC, - 0x2C, 0x9A, 0xA5, 0x3C, 0xD6, 0x32, 0xCC, 0xA3, 0x1F, 0x67, 0x56, 0x4D, 0xF3, 0xB4, 0x93, 0xBB, - 0x8B, 0xE5, 0xDD, 0xAD, 0x15, 0xA2, 0x9F, 0x2E, 0x89, 0x6C, 0xB5, 0x37, 0x75, 0x6F, 0x83, 0x3F, - 0xB4, 0xBF, 0xC2, 0x6F, 0x17, 0x69, 0x7F, 0x0E, 0xEE, 0x3C, 0x35, 0xA8, 0xCD, 0x37, 0x89, 0xB4, - 0xFB, 0x8D, 0x67, 0xC2, 0xD1, 0x59, 0xDD, 0x59, 0x78, 0xBF, 0xE1, 0x9F, 0xC4, 0x3B, 0x0B, 0x68, - 0x4B, 0xCD, 0xA8, 0x68, 0xF7, 0xE5, 0x9F, 0x4D, 0xBE, 0xB5, 0x11, 0x6E, 0x62, 0xF1, 0xB9, 0x2A, - 0x32, 0x18, 0x29, 0xE0, 0x78, 0x0A, 0x55, 0x22, 0x92, 0xA2, 0xF4, 0xBE, 0x89, 0xE8, 0x96, 0x96, - 0xD1, 0x6C, 0xB4, 0xF2, 0x5D, 0x3A, 0xA5, 0x6F, 0xA2, 0x97, 0x32, 0x82, 0x8C, 0x2D, 0x6D, 0x1B, - 0x56, 0x49, 0x69, 0x6B, 0x69, 0xB6, 0x96, 0x5B, 0xAB, 0x25, 0x6B, 0xE8, 0x7E, 0x75, 0x7E, 0xD7, - 0x9E, 0x12, 0xF8, 0x5B, 0xE1, 0x4F, 0x1F, 0x68, 0x36, 0x3F, 0x15, 0x7C, 0x21, 0xE2, 0x0F, 0x82, - 0xDF, 0x13, 0xEC, 0x75, 0x0B, 0x59, 0x57, 0xC4, 0x9F, 0x0E, 0x22, 0xB7, 0xD5, 0x74, 0x88, 0xCD, - 0xDA, 0xAB, 0xC6, 0xBA, 0x86, 0x86, 0xCF, 0xB9, 0x91, 0xD5, 0xC1, 0xDD, 0x6B, 0x73, 0x1E, 0xD5, - 0x23, 0xF7, 0x67, 0x6E, 0xD3, 0xF5, 0x79, 0x44, 0xB3, 0x3F, 0xA9, 0xA7, 0x4E, 0x29, 0xC2, 0x12, - 0x49, 0xA6, 0x9B, 0xB4, 0x1E, 0x97, 0xDF, 0x64, 0xF6, 0xF4, 0xB5, 0x92, 0xBB, 0x5F, 0x37, 0x38, - 0x65, 0x72, 0xC5, 0x62, 0x72, 0xCA, 0xB4, 0xB9, 0x5D, 0x5A, 0x32, 0x9C, 0x9C, 0x5D, 0xA0, 0x9C, - 0x76, 0x9B, 0x8D, 0xB4, 0x92, 0xBA, 0xB4, 0x93, 0x4D, 0xD9, 0xAD, 0x5D, 0xAD, 0xF4, 0x1D, 0xB7, - 0x83, 0x35, 0x6B, 0x7F, 0x0A, 0xE9, 0xFA, 0xD5, 0x95, 0xD6, 0x9F, 0xE2, 0xDF, 0x0F, 0x1B, 0x58, - 0x99, 0xBC, 0x47, 0xE1, 0xB7, 0x6B, 0xAB, 0x14, 0x47, 0x5C, 0x23, 0x5D, 0xC0, 0xCA, 0x27, 0xB5, - 0x62, 0x03, 0x7C, 0x93, 0x22, 0x1E, 0xB8, 0x24, 0x00, 0x4F, 0xCC, 0xE3, 0x30, 0xED, 0x62, 0x27, - 0x0A, 0x11, 0xB2, 0x6D, 0x24, 0xBF, 0x95, 0xDE, 0xDA, 0xA5, 0x6B, 0x6E, 0xB5, 0xB5, 0xBB, 0x76, - 0x37, 0xC1, 0x42, 0x73, 0xC1, 0x53, 0x97, 0x32, 0x9C, 0x6C, 0xBD, 0xE8, 0xEA, 0x9A, 0xB6, 0x92, - 0xDB, 0x4B, 0xDA, 0xE9, 0x34, 0x9A, 0x5D, 0x17, 0x5E, 0x5E, 0x5B, 0x2B, 0x08, 0xA7, 0xDD, 0x6F, - 0x67, 0x67, 0x13, 0xA4, 0x62, 0x03, 0x24, 0x36, 0xE8, 0x0B, 0x60, 0x92, 0x72, 0xEA, 0x06, 0x7E, - 0xF0, 0x18, 0xE9, 0xD7, 0xAE, 0x33, 0x5E, 0xB7, 0x13, 0x62, 0xA5, 0x2C, 0x5D, 0x2C, 0x1A, 0x93, - 0xB5, 0x1A, 0x54, 0xE9, 0xCA, 0xCD, 0xB8, 0xB9, 0x41, 0x59, 0xB5, 0x7E, 0x8F, 0x65, 0x6B, 0x26, - 0x96, 0x89, 0x2B, 0x25, 0xCB, 0x47, 0x0D, 0x46, 0x84, 0xA4, 0xE9, 0xC2, 0x29, 0xB7, 0xD2, 0x29, - 0x3B, 0x6E, 0x96, 0x89, 0x68, 0xBB, 0x6B, 0xFE, 0x5E, 0x45, 0xF1, 0x93, 0xC6, 0x31, 0x78, 0x2F, - 0xC1, 0x5A, 0x9D, 0xFE, 0xFD, 0xD7, 0xD7, 0x10, 0xB5, 0x8D, 0x8C, 0x23, 0x22, 0x59, 0x65, 0x95, - 0x48, 0x45, 0x53, 0x8E, 0xA4, 0xB2, 0xA8, 0x00, 0xF5, 0xF4, 0xE9, 0x59, 0x64, 0xB8, 0x65, 0x5F, - 0x11, 0xCF, 0x28, 0xFB, 0x90, 0x57, 0xE8, 0x96, 0x9B, 0x2B, 0x74, 0x5B, 0x7C, 0xB5, 0xB5, 0x8E, - 0x7C, 0xDE, 0x72, 0xF6, 0x10, 0xC2, 0xD1, 0x76, 0x9D, 0x57, 0xCA, 0x9E, 0xDC, 0xB1, 0xB7, 0xBF, - 0x2D, 0xAD, 0x68, 0xC5, 0x37, 0xD2, 0xCD, 0x2E, 0x87, 0x21, 0xF0, 0x4F, 0xC1, 0xEF, 0xE1, 0x4F, - 0x05, 0xDA, 0xDD, 0x6A, 0x08, 0x3F, 0xB6, 0xB5, 0xEC, 0xEB, 0x3A, 0xA4, 0xAC, 0x06, 0x5A, 0x59, - 0x8E, 0xE6, 0x04, 0x1E, 0x70, 0x37, 0x00, 0x3B, 0xFC, 0xB8, 0xED, 0x5E, 0x86, 0x67, 0x5F, 0xDA, - 0xE2, 0x3D, 0x94, 0x7E, 0x15, 0xA7, 0x6D, 0x7A, 0xF9, 0x69, 0xA2, 0xD3, 0x4B, 0x5B, 0x43, 0x93, - 0x2B, 0xA5, 0x1A, 0x8A, 0x78, 0xE8, 0x2B, 0x53, 0x92, 0x51, 0xA6, 0xB4, 0xF7, 0x69, 0x41, 0x38, - 0xC1, 0x76, 0x57, 0x5E, 0xF3, 0xB5, 0xB5, 0x6C, 0xE6, 0xAF, 0x2E, 0x63, 0xF1, 0xE7, 0xC6, 0x9F, - 0x0D, 0x78, 0x2E, 0xEA, 0x6D, 0x56, 0x6F, 0x03, 0xF8, 0x66, 0x44, 0xD7, 0x3C, 0x6D, 0xA6, 0xE8, - 0x97, 0x2B, 0x6B, 0x36, 0xA4, 0xD1, 0x12, 0x6D, 0x61, 0x66, 0x78, 0xE4, 0x87, 0x86, 0x1B, 0x87, - 0x98, 0x8C, 0x32, 0x99, 0xC0, 0xAF, 0x4F, 0x2D, 0xC3, 0x53, 0x85, 0x3A, 0x5C, 0xE9, 0x5D, 0xB5, - 0x2D, 0x5B, 0x4B, 0xB2, 0x57, 0x49, 0xBD, 0x77, 0x56, 0x4D, 0xAD, 0xBC, 0x97, 0x32, 0xC7, 0xC2, - 0x12, 0xAD, 0xCE, 0xA5, 0xC9, 0x51, 0xFB, 0x15, 0x6B, 0x2B, 0xC5, 0x6B, 0x55, 0xEA, 0x9E, 0x8D, - 0x72, 0xD3, 0xD9, 0x5E, 0xEE, 0xDA, 0xBB, 0x2E, 0x83, 0xE3, 0xDD, 0xA7, 0x86, 0xF4, 0x7F, 0x06, - 0xBF, 0x8F, 0x34, 0xDF, 0x0D, 0x4D, 0xA9, 0x6A, 0x9E, 0x17, 0x79, 0xB6, 0x8D, 0x7A, 0x67, 0xFB, - 0x25, 0xAD, 0xB3, 0xCA, 0xBF, 0xD9, 0xD7, 0x36, 0x62, 0x01, 0x08, 0xF3, 0xA1, 0x09, 0x36, 0xE2, - 0xE4, 0xC6, 0xDC, 0x81, 0x19, 0xC8, 0x03, 0xAB, 0x1B, 0x5A, 0xAD, 0x0C, 0x33, 0xA3, 0x42, 0x0E, - 0x3A, 0xF3, 0x24, 0x95, 0xA1, 0x68, 0xE9, 0x2E, 0x56, 0xF7, 0x4D, 0x75, 0x51, 0x8B, 0x4F, 0x95, - 0xEB, 0xB1, 0xD1, 0x95, 0x51, 0xC2, 0x57, 0xC7, 0x4B, 0x0D, 0x59, 0x47, 0xD9, 0xD6, 0x84, 0xE9, - 0x6A, 0xED, 0x66, 0xD3, 0xF6, 0x7A, 0x27, 0x6B, 0xDF, 0xDD, 0x56, 0xBB, 0x4D, 0xA4, 0xAD, 0x64, - 0x9F, 0x8E, 0x7C, 0x56, 0x1E, 0x1F, 0xF8, 0x8D, 0x6F, 0xF0, 0xA7, 0xC0, 0x56, 0xA5, 0xA6, 0x7F, - 0x11, 0xC2, 0xDE, 0x32, 0xF1, 0x5D, 0xFC, 0x69, 0x24, 0x73, 0x69, 0x56, 0x91, 0xC0, 0x3E, 0xCD, - 0x0D, 0xB0, 0x2C, 0xB9, 0x0C, 0xF2, 0x80, 0xDB, 0x90, 0x8C, 0x85, 0x28, 0xF8, 0xC9, 0x1E, 0x76, - 0x33, 0x03, 0x84, 0xC4, 0x61, 0x29, 0xE1, 0xE5, 0x2E, 0x6A, 0x52, 0x7C, 0xD3, 0x4A, 0xE9, 0x38, - 0x24, 0xDC, 0x53, 0x69, 0x24, 0xB5, 0xE5, 0x6D, 0x2E, 0xCD, 0x76, 0x44, 0xE5, 0x99, 0x9B, 0xCA, - 0xB0, 0x55, 0x73, 0x47, 0x4A, 0xD8, 0x9A, 0x6A, 0x34, 0xA3, 0xCC, 0xB4, 0xF6, 0x92, 0x92, 0x73, - 0x51, 0x49, 0xA7, 0xA4, 0x21, 0x27, 0xCC, 0xD2, 0x4D, 0x34, 0x93, 0xB5, 0xAD, 0x52, 0xC3, 0x5D, - 0xD2, 0x35, 0x4F, 0x87, 0x5E, 0x38, 0x8B, 0x40, 0xB7, 0xD4, 0x74, 0x0D, 0x33, 0xE1, 0xC8, 0x5D, - 0x02, 0x2B, 0x08, 0x3C, 0x4A, 0x9A, 0x7F, 0x8A, 0x4B, 0xB4, 0x89, 0x0D, 0xA5, 0xC5, 0x94, 0x92, - 0xF9, 0x87, 0xCD, 0x69, 0x64, 0x47, 0xD8, 0x9B, 0x88, 0x03, 0x82, 0x02, 0x8A, 0xEC, 0x82, 0xCB, - 0xB0, 0x70, 0x9D, 0x1A, 0xCA, 0x72, 0x8C, 0x53, 0xA4, 0x92, 0xB5, 0xF9, 0x9A, 0x51, 0x85, 0xEF, - 0x14, 0x9C, 0x75, 0x4F, 0x58, 0xAF, 0x73, 0x56, 0xF6, 0x14, 0xB2, 0xEF, 0xAF, 0x71, 0x4D, 0x2C, - 0xC3, 0x0A, 0xA3, 0x0C, 0x2B, 0x8C, 0x31, 0x57, 0x5A, 0x2B, 0x28, 0xB9, 0x4E, 0xD1, 0x6F, 0xAC, - 0xA2, 0xDC, 0xA3, 0xCC, 0x92, 0xBE, 0x8A, 0xEE, 0xC7, 0x45, 0xE3, 0x7F, 0x03, 0xEB, 0xBF, 0x0A, - 0xFC, 0x03, 0xF0, 0x7B, 0xC6, 0x50, 0x78, 0x87, 0xC4, 0xD6, 0x7E, 0x20, 0xF1, 0xBE, 0xB1, 0x6D, - 0xA2, 0xDF, 0x68, 0xF6, 0xFA, 0x8A, 0xFD, 0x83, 0xC5, 0x5A, 0x2C, 0xA4, 0xC6, 0x6F, 0x2F, 0x4A, - 0xB8, 0x9E, 0x59, 0x0D, 0xD3, 0x4A, 0x3E, 0x7C, 0x80, 0x49, 0x39, 0x3B, 0xB8, 0xE2, 0xAD, 0x08, - 0xD1, 0x9E, 0x17, 0xD8, 0x53, 0x4E, 0x34, 0x5C, 0x60, 0xDD, 0xF6, 0x83, 0x8F, 0x2F, 0x9D, 0xDA, - 0x92, 0x4F, 0xDE, 0x4F, 0x6B, 0xAE, 0x57, 0xAA, 0xC7, 0x2D, 0xA5, 0x5B, 0x1D, 0x95, 0x66, 0x52, - 0xC4, 0xD5, 0x71, 0xAD, 0x8E, 0x84, 0xEB, 0x53, 0x57, 0xB3, 0xF7, 0x7D, 0xE5, 0xCB, 0xAD, 0xEC, - 0xE3, 0x64, 0xD2, 0x56, 0xB6, 0x97, 0xE8, 0x72, 0x97, 0xBA, 0x67, 0x89, 0x75, 0x0F, 0x1D, 0xCF, - 0xA7, 0x69, 0x1F, 0x10, 0xA7, 0xD4, 0x7C, 0x0B, 0xF0, 0xC7, 0x52, 0x97, 0x51, 0xD4, 0xEC, 0x9E, - 0x45, 0xB7, 0xD0, 0xB4, 0xE9, 0xDB, 0x4F, 0x8D, 0xAF, 0x65, 0xD2, 0xC1, 0x20, 0xCD, 0x3E, 0x64, - 0x85, 0x70, 0xEA, 0x99, 0x65, 0x70, 0x31, 0xB2, 0xB6, 0xA9, 0x4B, 0x0E, 0xF8, 0x8D, 0xE3, 0xA5, - 0x89, 0xB6, 0x1A, 0x12, 0x54, 0x5B, 0x4B, 0xDD, 0x92, 0x94, 0x3D, 0xEB, 0x45, 0xA4, 0xF9, 0x93, - 0x71, 0x5A, 0x49, 0x2B, 0x26, 0xBD, 0x7A, 0x28, 0x61, 0xAA, 0x61, 0xF8, 0x62, 0x3C, 0x2D, 0xEC, - 0x5F, 0xD6, 0x55, 0x27, 0x89, 0x4D, 0x5A, 0xF1, 0xB4, 0xD7, 0x2E, 0x8D, 0x26, 0xA3, 0x64, 0xEC, - 0x97, 0x4B, 0x3B, 0x7B, 0xC7, 0x90, 0x6B, 0xDF, 0x12, 0x7C, 0x65, 0x67, 0x2F, 0x8D, 0x3E, 0x25, - 0xE9, 0xDE, 0x29, 0xF1, 0x44, 0x1E, 0x3B, 0xF1, 0xF7, 0x8A, 0xDF, 0xC3, 0x9E, 0x1F, 0xD5, 0x46, - 0x82, 0xD7, 0xF1, 0x78, 0x8B, 0x4D, 0xB5, 0x1E, 0x4D, 0xC2, 0xDB, 0xEA, 0x12, 0x02, 0xB1, 0xB8, - 0x72, 0xB9, 0x58, 0x81, 0x24, 0x90, 0x32, 0x31, 0x5F, 0x35, 0x9D, 0x4D, 0x61, 0xE8, 0xCF, 0x19, - 0x42, 0xBD, 0xA5, 0x56, 0xB7, 0xB3, 0xA7, 0x69, 0xDA, 0x51, 0x8D, 0x3B, 0x41, 0xB7, 0x1D, 0x13, - 0x4D, 0xA6, 0xEE, 0xF6, 0xBA, 0xD8, 0xFB, 0xFC, 0x8E, 0x86, 0x61, 0x18, 0x61, 0xDE, 0x2E, 0x3F, - 0xB9, 0xF6, 0x4A, 0x53, 0x52, 0x8A, 0x8A, 0x95, 0x49, 0xFB, 0xD7, 0x69, 0x6F, 0xCA, 0xB9, 0x52, - 0x8B, 0xD1, 0x2D, 0xDB, 0xD8, 0xF3, 0xCF, 0x0C, 0x4D, 0xE3, 0xEF, 0x10, 0x69, 0xAD, 0xFB, 0x3F, - 0xFF, 0x00, 0xC2, 0x47, 0xA3, 0x68, 0x9E, 0x0E, 0xB8, 0xF1, 0x18, 0xF8, 0x85, 0xE2, 0x1B, 0x7D, - 0x4A, 0xCA, 0x3D, 0x3C, 0x58, 0xEA, 0x16, 0xD6, 0x8D, 0x1C, 0x93, 0x5C, 0xCD, 0x2C, 0x71, 0xDC, - 0x34, 0xD1, 0xC0, 0xCE, 0x8B, 0x0E, 0xF0, 0xAC, 0xC1, 0x07, 0x7D, 0xC3, 0xE6, 0x2B, 0xE5, 0xD8, - 0x88, 0x4D, 0x65, 0x14, 0xF1, 0x2A, 0x74, 0x6D, 0x19, 0xBE, 0x5E, 0x55, 0x14, 0xDF, 0xBA, 0xDC, - 0x92, 0x92, 0x5C, 0xD1, 0x82, 0x6E, 0xF6, 0xBB, 0xD3, 0x99, 0x2E, 0x9E, 0xE3, 0xC5, 0x61, 0x1C, - 0x63, 0x98, 0x4E, 0x16, 0x9F, 0xC2, 0xA5, 0x65, 0x77, 0x1D, 0x25, 0xA5, 0xAE, 0xB9, 0x7A, 0xDB, - 0xA2, 0x4E, 0xCB, 0x44, 0x64, 0x7C, 0x51, 0xF8, 0xA1, 0xE2, 0xFF, 0x00, 0x18, 0x6A, 0x57, 0xB3, - 0xEB, 0xDE, 0x2C, 0x3E, 0x26, 0x9A, 0xF3, 0x4E, 0xB5, 0xD0, 0x56, 0xFA, 0x3D, 0x1A, 0xDB, 0x45, - 0x82, 0x7D, 0x33, 0x4F, 0x8C, 0x47, 0xA7, 0xA9, 0xB5, 0x8D, 0x17, 0xC9, 0x72, 0x88, 0x8E, 0x40, - 0xE4, 0xE7, 0xE6, 0x27, 0x15, 0xEC, 0x67, 0x38, 0x99, 0x64, 0xDC, 0x3F, 0x2C, 0xB3, 0x0D, 0x56, - 0xA2, 0xAD, 0x5A, 0x56, 0xA8, 0xAC, 0xD5, 0x35, 0x4D, 0x26, 0xE3, 0x14, 0xAE, 0xA2, 0xD4, 0x9A, - 0x53, 0x8B, 0xE5, 0xBD, 0x9B, 0xBD, 0xB4, 0x3B, 0x70, 0xB3, 0xC2, 0xD7, 0x85, 0xA3, 0x09, 0x5E, - 0x32, 0x96, 0xFA, 0x45, 0xED, 0xAA, 0xB5, 0xA4, 0xEC, 0xD7, 0x5F, 0x77, 0x4D, 0xAF, 0x73, 0xC4, - 0xEB, 0xF3, 0x83, 0xB8, 0x28, 0x00, 0xA0, 0x0D, 0x2D, 0x3E, 0xCC, 0xCC, 0xEA, 0xC4, 0x61, 0x06, - 0x30, 0x00, 0xED, 0x8E, 0x98, 0xFC, 0xAB, 0xF5, 0xFF, 0x00, 0x0C, 0x38, 0x22, 0xB6, 0x77, 0x8D, - 0x86, 0x3E, 0xBC, 0x3F, 0x74, 0x9E, 0x9B, 0xDE, 0xD6, 0x69, 0xDD, 0x5A, 0xD6, 0x7A, 0x59, 0xEA, - 0x9F, 0x63, 0xCD, 0xC6, 0xE2, 0x55, 0x38, 0xF2, 0x44, 0xEF, 0x2D, 0x2D, 0x44, 0x30, 0xAF, 0x0A, - 0x00, 0x51, 0x81, 0xD3, 0x00, 0x0E, 0x9D, 0x3D, 0x85, 0x7F, 0xA3, 0x3C, 0x19, 0xC2, 0x94, 0xB2, - 0x4C, 0x96, 0x9C, 0xDA, 0x49, 0x72, 0xAD, 0x2F, 0x6D, 0x3B, 0x3D, 0x17, 0xF9, 0x5F, 0x6D, 0x34, - 0x3E, 0x4A, 0xBD, 0x67, 0x52, 0x6E, 0xDB, 0x7F, 0x5B, 0x0D, 0x5B, 0xB8, 0x1E, 0xE3, 0xEC, 0x8A, - 0x58, 0xCD, 0x8C, 0x85, 0x08, 0x42, 0xED, 0x1D, 0xC1, 0xF4, 0x18, 0x15, 0xE7, 0x61, 0x78, 0xD3, - 0x20, 0xC6, 0x71, 0x43, 0xE0, 0xEC, 0x2D, 0x49, 0xCB, 0x1E, 0x95, 0xD4, 0x55, 0x39, 0xF2, 0xB8, - 0x68, 0xB9, 0xD4, 0xAD, 0x6E, 0x58, 0xBD, 0x1B, 0x76, 0x69, 0xD9, 0x5B, 0x44, 0x5B, 0xC3, 0xD5, - 0x8D, 0x05, 0x5D, 0xC5, 0x72, 0x7A, 0xAF, 0xBA, 0xC2, 0xDD, 0x5B, 0x19, 0x51, 0x36, 0x90, 0x92, - 0xC0, 0xDB, 0xAD, 0x88, 0x05, 0x7E, 0x60, 0x39, 0x03, 0x8E, 0x84, 0x0C, 0x1A, 0xDB, 0x8C, 0xB8, - 0x67, 0x11, 0x9D, 0x60, 0x29, 0xCF, 0x05, 0x35, 0x1C, 0x7E, 0x12, 0x4E, 0x78, 0x49, 0x3B, 0xC5, - 0x7B, 0x5B, 0x5D, 0xA4, 0xF9, 0x79, 0x9C, 0x26, 0x93, 0x84, 0xDA, 0x4B, 0xDD, 0x6D, 0x59, 0xDD, - 0x35, 0x38, 0x7A, 0xCA, 0x93, 0x69, 0xAF, 0x71, 0xA4, 0xA4, 0xBC, 0xBF, 0x2D, 0x37, 0x5F, 0xF0, - 0x09, 0xED, 0xC2, 0xDC, 0x5B, 0x3D, 0xCC, 0x40, 0xF9, 0x51, 0x5C, 0x7D, 0x9D, 0xD2, 0x45, 0x54, - 0x96, 0x16, 0x2A, 0x70, 0x85, 0x41, 0x38, 0xE1, 0x73, 0xC6, 0x6B, 0x5E, 0x0C, 0xCD, 0xE8, 0xF1, - 0x4E, 0x4B, 0xF5, 0xCA, 0xA9, 0x47, 0x13, 0x4E, 0x6E, 0x15, 0xE9, 0x34, 0x93, 0xA1, 0x56, 0x3A, - 0x4E, 0x92, 0x4D, 0xBF, 0x72, 0xEF, 0x9A, 0x0D, 0xFC, 0x51, 0xE5, 0x6D, 0x2D, 0x82, 0xA6, 0x1E, - 0xB5, 0x18, 0x2A, 0x92, 0x4B, 0x97, 0x44, 0x9A, 0xD9, 0xDD, 0x5D, 0x5B, 0x44, 0xF6, 0x5D, 0x95, - 0x85, 0xDA, 0x00, 0xC7, 0x1C, 0x0E, 0x30, 0xA0, 0x0E, 0x07, 0x61, 0xF9, 0x57, 0xD2, 0x4B, 0x09, - 0x04, 0x9C, 0x16, 0xF6, 0xD3, 0xDD, 0x56, 0xEC, 0xAF, 0x65, 0x75, 0xD2, 0xDF, 0x86, 0x9A, 0x18, - 0x29, 0x2D, 0x34, 0xD0, 0x85, 0x94, 0xE0, 0x01, 0x80, 0x31, 0xC7, 0x18, 0xE9, 0xED, 0x5E, 0x16, - 0x27, 0x0D, 0x38, 0xB5, 0x1D, 0x2D, 0x6F, 0xCB, 0xCA, 0xC9, 0xA5, 0xD1, 0x5D, 0x2D, 0x8D, 0x15, - 0xAC, 0xAC, 0x57, 0x65, 0xE3, 0x6F, 0x03, 0x18, 0x03, 0x18, 0xC7, 0x03, 0x80, 0x05, 0x78, 0x38, - 0xAC, 0x3C, 0xE4, 0xDD, 0x9A, 0xD2, 0xDF, 0x87, 0xF5, 0xFE, 0x66, 0xB0, 0x69, 0x25, 0x1B, 0x11, - 0xAA, 0x80, 0x55, 0x5F, 0x21, 0x08, 0xC1, 0xDA, 0x07, 0x1C, 0x71, 0x81, 0x5E, 0x5C, 0x28, 0x51, - 0xA9, 0x5E, 0x34, 0xF1, 0xB7, 0xFA, 0xBB, 0x8B, 0x52, 0xE5, 0xB3, 0x69, 0xE9, 0x6D, 0x2E, 0xBF, - 0x35, 0xE5, 0xD8, 0xBD, 0x54, 0x7D, 0xD5, 0xAE, 0x96, 0x3B, 0x1F, 0x82, 0xB2, 0xDB, 0x78, 0x77, - 0xE3, 0x67, 0xC3, 0xAD, 0x4A, 0xE8, 0xC6, 0xB6, 0x2B, 0xE2, 0x58, 0x11, 0xDD, 0xC1, 0x2B, 0x1F, - 0x9A, 0x0C, 0x6A, 0x48, 0xED, 0xCB, 0xAE, 0x2B, 0xF8, 0xB3, 0xC5, 0x4E, 0x00, 0xAD, 0xC2, 0x3C, - 0x4F, 0x2C, 0xC3, 0x0B, 0x14, 0xF0, 0x75, 0x6E, 0xD3, 0xBB, 0xBA, 0x6E, 0xEB, 0x54, 0xD2, 0x4A, - 0xF7, 0x56, 0x49, 0xBB, 0xED, 0xA5, 0xCF, 0x6E, 0x96, 0x25, 0x62, 0x70, 0x2E, 0x9B, 0xF8, 0x95, - 0xB6, 0xF2, 0xB7, 0xF9, 0x7D, 0xC7, 0xF5, 0xEF, 0xFB, 0x3B, 0x5E, 0xDB, 0xDC, 0x78, 0x5A, 0xE1, - 0x22, 0xC1, 0x92, 0x29, 0x99, 0x99, 0x55, 0x81, 0x21, 0x5D, 0x03, 0x29, 0x1F, 0x86, 0xEF, 0xCA, - 0xAB, 0x1A, 0xD5, 0x4A, 0x14, 0x2A, 0x53, 0xB7, 0x27, 0x2C, 0x52, 0xB7, 0x6D, 0x7F, 0xCF, 0xA2, - 0xED, 0xB1, 0xF1, 0x39, 0x74, 0x3D, 0x9E, 0x26, 0xB5, 0x1B, 0x6A, 0x9E, 0xD6, 0xE9, 0xAB, 0xD5, - 0x2B, 0x77, 0xD3, 0xAF, 0x4B, 0x1C, 0x05, 0x8E, 0xA9, 0x6D, 0xAB, 0xFE, 0xD1, 0xB7, 0xF6, 0xDA, - 0xEC, 0xAB, 0x6E, 0xBA, 0x26, 0x99, 0xFF, 0x00, 0x12, 0x98, 0x6E, 0x58, 0x2C, 0x79, 0x60, 0x7C, - 0xD7, 0x4C, 0xF1, 0xC6, 0x3A, 0x8C, 0x71, 0xF8, 0xE3, 0xE9, 0xEA, 0x52, 0x95, 0x0E, 0x18, 0x82, - 0xC3, 0xC5, 0x5E, 0x56, 0x6E, 0xC9, 0x3D, 0xDB, 0x4B, 0x6D, 0x74, 0xB2, 0x5D, 0x12, 0xD2, 0xD6, - 0xE6, 0x57, 0xF0, 0x29, 0xA5, 0x57, 0x3B, 0x75, 0x6B, 0xA4, 0xA2, 0x9D, 0x97, 0x6D, 0x6D, 0x65, - 0xAE, 0x8A, 0xED, 0xDB, 0x6D, 0xD2, 0xE8, 0x8F, 0x55, 0xF8, 0xED, 0xE3, 0x99, 0xF4, 0x5F, 0x01, - 0xEB, 0x3F, 0xF0, 0x8E, 0xA7, 0xDA, 0x6E, 0xBE, 0xCA, 0xF0, 0x97, 0x83, 0x2B, 0x14, 0x4B, 0xE5, - 0x9D, 0xCF, 0xB8, 0x60, 0x00, 0x14, 0x37, 0x42, 0x0E, 0x07, 0xD3, 0x3E, 0x37, 0x0D, 0xE5, 0xF1, - 0xAB, 0x8F, 0x8C, 0xB1, 0x09, 0x5A, 0x29, 0xB4, 0x9D, 0xB5, 0x6A, 0xD6, 0x8B, 0xD1, 0xEE, 0xED, - 0x75, 0x67, 0xA2, 0x6A, 0xD6, 0xBD, 0xBD, 0x6C, 0xF7, 0x1F, 0x1F, 0xAA, 0x2A, 0x34, 0x5F, 0xBA, - 0xDA, 0x4D, 0xAD, 0x92, 0xBA, 0x4E, 0xDE, 0x89, 0xBB, 0x5F, 0x7B, 0x58, 0xCF, 0xF8, 0x09, 0x06, - 0x9F, 0xE1, 0xCF, 0x85, 0xDA, 0x4D, 0xDC, 0xD7, 0x11, 0xBC, 0xF7, 0x96, 0xBF, 0x6D, 0xB8, 0x55, - 0x3F, 0xBC, 0x92, 0x59, 0x57, 0x73, 0x80, 0x3A, 0x82, 0x49, 0x1F, 0x87, 0xD2, 0xAB, 0x88, 0x1D, - 0x7C, 0x4E, 0x69, 0x2A, 0x7C, 0xBB, 0x5A, 0x2A, 0xC9, 0x6D, 0x1B, 0x25, 0xA2, 0xD3, 0x4F, 0xF2, - 0x23, 0x24, 0x74, 0x70, 0xB8, 0x09, 0x55, 0x6D, 0x5D, 0xBB, 0x25, 0xBB, 0x69, 0x6C, 0xB4, 0xF2, - 0xB6, 0xB6, 0x49, 0x2D, 0x16, 0x8B, 0x5D, 0x0D, 0x4E, 0x64, 0xB0, 0xD0, 0x7C, 0x4F, 0xE2, 0x6D, - 0x61, 0xD2, 0xC9, 0xB5, 0x0B, 0x49, 0x2D, 0xED, 0x55, 0xBE, 0x51, 0xE5, 0x91, 0x84, 0x61, 0x81, - 0xC8, 0xEA, 0x40, 0xF4, 0x1D, 0x38, 0xC9, 0xF3, 0xF1, 0xD2, 0xA7, 0x0C, 0x2C, 0x70, 0xB4, 0xBE, - 0x18, 0xA6, 0xDB, 0x5A, 0xDB, 0x7B, 0xA5, 0xB6, 0x89, 0x25, 0xB5, 0x93, 0xB2, 0xB3, 0x6D, 0xA4, - 0xBB, 0x32, 0xE8, 0xC7, 0xEB, 0x2F, 0x17, 0x57, 0xAB, 0xD1, 0x77, 0x49, 0xDD, 0xEB, 0x64, 0xAD, - 0x7D, 0x2F, 0x6B, 0x7A, 0xD9, 0x5B, 0xF9, 0xB6, 0xF0, 0x4E, 0xB1, 0x69, 0xAE, 0x7F, 0xC1, 0x57, - 0xFF, 0x00, 0x67, 0xEB, 0xDB, 0x22, 0x8D, 0x6E, 0x9F, 0xB5, 0xAF, 0xC3, 0x6B, 0x30, 0xD1, 0x8C, - 0x29, 0x68, 0x3C, 0x41, 0xA5, 0xA4, 0x98, 0xFA, 0x32, 0xB0, 0xFA, 0x01, 0x5F, 0x93, 0xCE, 0x7C, - 0xD9, 0xDD, 0x08, 0xD9, 0x69, 0x38, 0x6C, 0xD3, 0xDE, 0x5C, 0xDD, 0x3B, 0x5E, 0xD6, 0xF2, 0x3F, - 0x40, 0xA3, 0x15, 0x1C, 0xB2, 0x7F, 0xE1, 0x97, 0x4B, 0x2D, 0xAC, 0xAD, 0xE5, 0x64, 0xAC, 0x7F, - 0x70, 0xF5, 0xFA, 0x09, 0xF3, 0x41, 0x40, 0x05, 0x00, 0x14, 0x01, 0xFC, 0x57, 0xFF, 0x00, 0xC1, - 0x6A, 0x13, 0x3F, 0xB7, 0xF7, 0xC4, 0xA3, 0x81, 0x81, 0xE0, 0xEF, 0x0A, 0x0C, 0x60, 0x60, 0x81, - 0xE1, 0xDB, 0x4E, 0x31, 0x51, 0x43, 0x06, 0xAB, 0xE1, 0xF1, 0x13, 0x49, 0x59, 0x4E, 0xD6, 0x7B, - 0x35, 0xEC, 0xE9, 0x3B, 0x5B, 0xFE, 0x07, 0x6D, 0xB4, 0x3D, 0xBC, 0x13, 0x51, 0xA1, 0x05, 0xD2, - 0xCF, 0xF3, 0x67, 0xE5, 0xA6, 0x8F, 0xE2, 0x3F, 0x11, 0xF8, 0x5C, 0xDC, 0xB6, 0x81, 0xAC, 0x5F, - 0xE9, 0x49, 0x78, 0xAA, 0xB7, 0x71, 0x59, 0xCE, 0xD1, 0x41, 0x72, 0x10, 0xE5, 0x04, 0x91, 0x7D, - 0xC6, 0xDA, 0x49, 0xC1, 0x20, 0xE3, 0x9C, 0x63, 0x35, 0xF2, 0x35, 0xF0, 0x99, 0xAE, 0x49, 0x5E, - 0x59, 0x8E, 0x5F, 0x2E, 0x58, 0x6A, 0xEC, 0x92, 0x56, 0x4F, 0xA7, 0x2B, 0x5C, 0xAD, 0x74, 0xD3, - 0xA7, 0x44, 0x8D, 0xF1, 0x78, 0x0C, 0xBB, 0x36, 0xC3, 0xAC, 0x26, 0x61, 0x49, 0x4E, 0x1A, 0x68, - 0xFC, 0xB6, 0xD5, 0x59, 0xAF, 0xC8, 0xFA, 0x7E, 0x1F, 0xDB, 0x7B, 0xE3, 0x47, 0xFC, 0x22, 0x71, - 0x78, 0x4A, 0xEE, 0xEB, 0x47, 0xB9, 0x86, 0x2B, 0x61, 0x68, 0x35, 0x56, 0xB0, 0x23, 0x50, 0xD8, - 0x17, 0x01, 0x8A, 0x86, 0x11, 0x96, 0xC7, 0x70, 0xA3, 0xA0, 0xE9, 0x8A, 0x30, 0x3C, 0x45, 0x81, - 0x85, 0x78, 0xD6, 0xC6, 0xE1, 0x17, 0x36, 0x97, 0x70, 0x6D, 0x2F, 0x5E, 0x47, 0x75, 0xF2, 0xBA, - 0x8F, 0x68, 0xA5, 0x64, 0x79, 0x15, 0xB8, 0x5A, 0x53, 0xA4, 0xF0, 0xD4, 0xB1, 0x73, 0x54, 0x76, - 0x51, 0x7C, 0xAD, 0xA5, 0xFC, 0xAA, 0x5C, 0xB7, 0x49, 0x6C, 0x9D, 0x9C, 0x92, 0xFB, 0x4C, 0xFD, - 0x1C, 0xF8, 0x45, 0xFB, 0x5E, 0x7C, 0x0F, 0x4F, 0x84, 0xFA, 0x76, 0x8B, 0x7B, 0xF1, 0x0E, 0xD7, - 0x4A, 0xF1, 0x3D, 0x9E, 0x8C, 0x2D, 0xEE, 0x6D, 0x75, 0xFB, 0x19, 0x74, 0xD7, 0x69, 0xF6, 0x00, - 0xD8, 0x91, 0x97, 0xCB, 0x60, 0x4A, 0xB1, 0xC8, 0x73, 0xD4, 0x7B, 0x01, 0x38, 0xAC, 0x5E, 0x0F, - 0x1D, 0x9A, 0xBA, 0xB4, 0x26, 0x95, 0x39, 0x49, 0x5A, 0xEF, 0x95, 0x25, 0xBF, 0x5D, 0x15, 0xBE, - 0xE5, 0xB2, 0xD8, 0xE6, 0xC1, 0x60, 0x31, 0xF9, 0x5E, 0x49, 0x1A, 0x15, 0x20, 0xDD, 0x48, 0x45, - 0xAD, 0x13, 0x9D, 0xDF, 0xD9, 0xB2, 0x5A, 0xBE, 0x9D, 0x13, 0xB2, 0xBB, 0x3F, 0x3B, 0xFE, 0x26, - 0xFE, 0xD6, 0x3F, 0x12, 0xBC, 0x44, 0xFA, 0xA7, 0x85, 0xE1, 0xD7, 0x34, 0x75, 0xD0, 0x04, 0x86, - 0xDC, 0x5C, 0x68, 0x31, 0x18, 0x86, 0xA1, 0x0F, 0x50, 0x4C, 0x9B, 0xDB, 0x83, 0x91, 0x90, 0x0E, - 0x32, 0x3D, 0x00, 0xAF, 0xD4, 0xB8, 0x7F, 0x31, 0xE1, 0xBC, 0x9F, 0x1A, 0xAA, 0x42, 0x74, 0xEA, - 0x46, 0xCF, 0x69, 0xC5, 0xC9, 0x74, 0xD1, 0xA9, 0x2B, 0x5B, 0xD3, 0xB7, 0x91, 0xE6, 0xE0, 0xF2, - 0x1A, 0xB9, 0xA6, 0x06, 0x8D, 0x6C, 0xD2, 0x55, 0x15, 0xD5, 0xDD, 0x27, 0x15, 0x08, 0xDF, 0xFB, - 0xC9, 0x25, 0x26, 0xBA, 0xA8, 0xB7, 0x6B, 0x5A, 0xEA, 0xE8, 0xFB, 0x6F, 0xFE, 0x09, 0xE5, 0xFB, - 0x71, 0x5C, 0x78, 0x1E, 0x3B, 0x9F, 0xD9, 0xF3, 0xE2, 0x96, 0xAE, 0x8F, 0xF0, 0xE7, 0xC6, 0x5B, - 0xEC, 0xFC, 0x37, 0xAC, 0x6A, 0x72, 0x41, 0x1E, 0x9F, 0xE1, 0x6B, 0xAB, 0x95, 0x0B, 0x25, 0xBD, - 0xD4, 0xAE, 0x54, 0xA5, 0xAC, 0xA1, 0x54, 0x6E, 0x42, 0x5D, 0x19, 0x50, 0x26, 0x37, 0x57, 0xEB, - 0xD9, 0xAD, 0x0A, 0x59, 0x9E, 0x1A, 0x86, 0x69, 0x93, 0x61, 0xD5, 0x47, 0xA2, 0x94, 0x14, 0xAF, - 0x4E, 0x31, 0x76, 0x76, 0x94, 0x55, 0xD4, 0x93, 0x69, 0x6A, 0xEE, 0xA3, 0x76, 0xEC, 0xEE, 0x63, - 0x98, 0x64, 0xB5, 0xE9, 0xFE, 0xF3, 0x2F, 0xAA, 0xE9, 0xB5, 0x6B, 0xA4, 0xF5, 0xD3, 0x4F, 0x71, - 0xB4, 0xF9, 0x5D, 0xB7, 0xB5, 0xAE, 0x95, 0xAF, 0xA2, 0x47, 0x29, 0xFB, 0x5C, 0x58, 0xFC, 0x70, - 0xF8, 0x2B, 0xE3, 0x2D, 0x53, 0xC3, 0x17, 0xBA, 0xC9, 0xBD, 0xF0, 0x0F, 0x8E, 0x21, 0x96, 0xF3, - 0xC1, 0xFE, 0x2B, 0x48, 0x5A, 0x18, 0x35, 0x0B, 0x47, 0x53, 0xE6, 0x59, 0xCB, 0x70, 0x42, 0xC4, - 0x97, 0x11, 0x82, 0x55, 0xA3, 0x19, 0x60, 0x3C, 0xB2, 0x79, 0x3C, 0x7F, 0x56, 0xF8, 0x39, 0x9B, - 0x70, 0x7F, 0x11, 0xE0, 0x29, 0xE1, 0xEB, 0xD0, 0x70, 0xC7, 0xD0, 0x8A, 0x4A, 0x2D, 0xA4, 0xAF, - 0x0E, 0x55, 0x75, 0x14, 0xDC, 0x9A, 0x49, 0xDA, 0xEA, 0xE9, 0x3B, 0xC6, 0xD6, 0x52, 0x3E, 0x46, - 0x9E, 0x4F, 0x85, 0xAD, 0x07, 0x5E, 0xBC, 0xEA, 0x49, 0x42, 0x49, 0x4A, 0x37, 0xBC, 0x5B, 0x4D, - 0x35, 0x65, 0x14, 0xEE, 0x96, 0x97, 0x49, 0xD9, 0xA5, 0xAA, 0x4A, 0xE9, 0x78, 0x0F, 0xC0, 0x9F, - 0x8D, 0xDA, 0x9F, 0xC3, 0x9D, 0x4A, 0x1D, 0x27, 0x54, 0x9A, 0x75, 0xF0, 0x3E, 0xAC, 0x1B, 0x4D, - 0xD6, 0x11, 0x11, 0xA4, 0xFB, 0x11, 0x96, 0x3F, 0xDD, 0x5C, 0x42, 0x72, 0x0A, 0x6C, 0x71, 0x1B, - 0xB0, 0x5C, 0x92, 0x37, 0xED, 0xC6, 0x40, 0x1F, 0xA2, 0xF1, 0xA7, 0x07, 0xAC, 0xFB, 0x29, 0xAB, - 0x89, 0xC3, 0x5D, 0x62, 0xD4, 0x95, 0xB9, 0x6D, 0x05, 0x28, 0xAB, 0x3F, 0x3B, 0x38, 0xE9, 0xEF, - 0x24, 0xBA, 0x5D, 0xDD, 0x24, 0xFE, 0x8B, 0x27, 0xCB, 0xB2, 0xAA, 0x1C, 0x43, 0x4F, 0x34, 0xC4, - 0x49, 0xA9, 0x24, 0xD5, 0x93, 0x4A, 0x2D, 0x35, 0xCA, 0xD4, 0xD2, 0xB2, 0x69, 0xC5, 0xCA, 0x0B, - 0x58, 0xA4, 0x9A, 0xE6, 0xBA, 0x4E, 0xFF, 0x00, 0x44, 0xEA, 0xFE, 0x1F, 0xD6, 0xB5, 0xAB, 0x39, - 0x3C, 0x15, 0x03, 0xCB, 0xE2, 0x45, 0xBB, 0xBD, 0x86, 0xDB, 0x48, 0x83, 0x46, 0xD3, 0xA1, 0xBA, - 0x9B, 0xC4, 0x91, 0xDE, 0xB1, 0x16, 0x33, 0xD9, 0xDB, 0xA4, 0x66, 0x49, 0xAE, 0xD8, 0x90, 0xA6, - 0x14, 0x04, 0xE3, 0x7F, 0x3C, 0x82, 0xBF, 0x81, 0x67, 0xB9, 0x27, 0x0F, 0xF1, 0x64, 0x23, 0x53, - 0x88, 0xE8, 0x5A, 0xBE, 0x19, 0x27, 0x26, 0xE5, 0x38, 0xB8, 0xC5, 0x5A, 0xD5, 0x3D, 0xD9, 0x59, - 0x28, 0x36, 0xB9, 0xE4, 0xD2, 0xE9, 0xCB, 0xA6, 0x8F, 0xF5, 0xEE, 0x17, 0xC5, 0x65, 0xDC, 0x25, - 0x98, 0xC7, 0x01, 0x86, 0x9C, 0x5E, 0x51, 0x8D, 0x8C, 0xD6, 0x12, 0x52, 0x9C, 0xA7, 0x1A, 0x35, - 0x54, 0x3F, 0x7D, 0x86, 0xAB, 0x27, 0x2B, 0x46, 0x9C, 0x93, 0xE7, 0xA0, 0xDB, 0xD5, 0xFB, 0xBB, - 0xE8, 0xBF, 0x4D, 0xF4, 0xEF, 0x02, 0x78, 0x33, 0xF6, 0x33, 0xF0, 0x96, 0x9F, 0xAD, 0xFE, 0xD2, - 0xB6, 0xB3, 0xFC, 0x41, 0xF8, 0xFD, 0xA9, 0x68, 0x16, 0x5A, 0xFF, 0x00, 0x81, 0xBF, 0x64, 0x9F, - 0x0F, 0xEB, 0xE2, 0x6F, 0x0E, 0xF8, 0x11, 0x9A, 0xD5, 0x4D, 0xBD, 0xEF, 0xC5, 0x3B, 0xFB, 0x73, - 0x14, 0xD6, 0xEC, 0x42, 0x89, 0x17, 0x4B, 0xB2, 0x91, 0xA4, 0x7C, 0x91, 0x2C, 0x91, 0xA3, 0x97, - 0x5F, 0xCE, 0xA8, 0xE3, 0x31, 0xDC, 0x53, 0x8C, 0x79, 0x3F, 0x08, 0x46, 0x54, 0xB2, 0x8E, 0x69, - 0x52, 0xA9, 0x8A, 0x9C, 0x64, 0xE5, 0x56, 0x2D, 0xD9, 0xFD, 0x56, 0x13, 0x72, 0x5C, 0x89, 0x2B, - 0x73, 0x4D, 0x5A, 0x2E, 0xDC, 0xA9, 0xC9, 0x28, 0x2D, 0x23, 0x95, 0x53, 0xE2, 0xDC, 0x16, 0x19, - 0xC2, 0x11, 0x84, 0xA1, 0x18, 0x37, 0x5D, 0xC6, 0x50, 0x92, 0x9C, 0x56, 0xAA, 0x92, 0x52, 0xBD, - 0x93, 0x76, 0x69, 0xB5, 0x78, 0x37, 0x16, 0x95, 0xD2, 0x7F, 0x0A, 0x78, 0xA7, 0xF6, 0xC4, 0xFD, - 0xA3, 0x3E, 0x3E, 0xFC, 0x4A, 0xB9, 0xF1, 0x6F, 0xC5, 0x8F, 0x15, 0x4F, 0x34, 0xBA, 0x7E, 0x94, - 0x74, 0x6D, 0x03, 0xC2, 0xF6, 0x1A, 0x6C, 0x5A, 0x17, 0xC3, 0x5F, 0x07, 0x5B, 0x43, 0x13, 0x95, - 0xB7, 0xF0, 0xF6, 0x8F, 0x1A, 0xA5, 0xB5, 0x8D, 0xB0, 0x58, 0xA3, 0x5D, 0xB1, 0x2F, 0x23, 0x2C, - 0xE5, 0xD8, 0x92, 0x7F, 0x48, 0xAB, 0xC0, 0x1C, 0x39, 0xC3, 0x39, 0x05, 0x0C, 0x26, 0x43, 0x49, - 0x4E, 0xD2, 0xE6, 0x72, 0x76, 0x9D, 0x4A, 0x8E, 0x52, 0x49, 0x3A, 0xB3, 0x51, 0x52, 0x72, 0xD7, - 0x45, 0x15, 0x14, 0x94, 0x7D, 0xD4, 0x91, 0xF5, 0xB8, 0x3E, 0x1B, 0xCA, 0xE9, 0xE1, 0xEA, 0xC2, - 0x58, 0x5F, 0x67, 0x51, 0x72, 0x27, 0x24, 0xE5, 0x79, 0x3B, 0xEA, 0xD4, 0xBA, 0xC5, 0xBB, 0x3B, - 0x74, 0xD1, 0x5D, 0x6A, 0x72, 0xFE, 0x2D, 0x5B, 0xAF, 0x18, 0xDB, 0x5C, 0x26, 0xB7, 0x70, 0x2E, - 0x65, 0x11, 0x18, 0xE2, 0x9E, 0x48, 0x55, 0x7C, 0xA2, 0xC3, 0x00, 0xAC, 0x6B, 0xD4, 0x1E, 0x0B, - 0x0C, 0xF2, 0x14, 0x7C, 0xC7, 0x68, 0x0D, 0xE6, 0xE0, 0xA1, 0x98, 0x60, 0x67, 0x2A, 0xF8, 0x48, - 0xA8, 0x41, 0x24, 0x9A, 0x4A, 0x31, 0x56, 0x4B, 0xAB, 0x49, 0xB5, 0xDD, 0x5F, 0x4B, 0x3D, 0xA2, - 0xDE, 0x9E, 0xA6, 0x03, 0x0F, 0x85, 0xC0, 0x53, 0x78, 0x6A, 0x10, 0x5E, 0xCE, 0x57, 0xE6, 0x8D, - 0xDD, 0x9D, 0xF7, 0x57, 0xD1, 0xAF, 0x2E, 0xCD, 0xDD, 0x59, 0xBD, 0x35, 0x7E, 0x1D, 0x58, 0xF8, - 0xC5, 0x2C, 0x2C, 0xB4, 0x2F, 0x0F, 0xDD, 0xDC, 0x6A, 0x9A, 0xF4, 0xF7, 0x51, 0xE9, 0x3F, 0x65, - 0xD1, 0xA3, 0x92, 0xE7, 0x53, 0xBA, 0x62, 0x42, 0xDB, 0xC8, 0xA0, 0x80, 0x3E, 0x52, 0xB1, 0xC4, - 0x4E, 0x31, 0x80, 0xBC, 0x0C, 0x1D, 0xDE, 0x4E, 0x77, 0x8A, 0xA3, 0x8D, 0x6F, 0x13, 0x8D, 0xA6, - 0x92, 0x8F, 0xBB, 0x35, 0x6B, 0x4F, 0x91, 0xB4, 0xD3, 0x5E, 0xF5, 0x92, 0xE6, 0xD1, 0x7B, 0xAE, - 0xCD, 0xBB, 0xBB, 0x34, 0x71, 0xE3, 0x30, 0x79, 0x3E, 0x0F, 0x91, 0x72, 0xB8, 0xE1, 0xE0, 0xAF, - 0x1E, 0x76, 0xAC, 0x92, 0x4D, 0xB8, 0xBB, 0x6D, 0x7D, 0x64, 0xFA, 0xDF, 0x4D, 0x9D, 0x97, 0x55, - 0xE2, 0x26, 0xF8, 0x31, 0xF0, 0x36, 0x69, 0x65, 0xF8, 0xAA, 0xFA, 0x0F, 0xC4, 0x0F, 0x8A, 0x56, - 0x11, 0x08, 0x93, 0xC0, 0x3A, 0x4E, 0xBC, 0x66, 0xF0, 0x7F, 0x86, 0x67, 0x2A, 0x59, 0x9F, 0xC4, - 0x1A, 0x84, 0x33, 0xB3, 0x5D, 0x4C, 0x0E, 0xDC, 0xDA, 0xDA, 0xB4, 0x67, 0x3B, 0x43, 0xCC, 0xA4, - 0x61, 0x70, 0xC2, 0x70, 0xFF, 0x00, 0x1A, 0x71, 0x64, 0xA9, 0x43, 0x09, 0x87, 0x73, 0xA3, 0xAF, - 0x23, 0xB3, 0x8C, 0x54, 0x5D, 0x92, 0x72, 0xE6, 0x56, 0x8C, 0x6C, 0xEF, 0xAA, 0x9A, 0x6F, 0xDE, - 0x8C, 0x1A, 0x69, 0xBE, 0x4F, 0xED, 0x3A, 0xB5, 0xB0, 0xDC, 0xF4, 0x71, 0x0B, 0x0B, 0x81, 0x6F, - 0xF8, 0x93, 0xE5, 0x8C, 0xA6, 0x96, 0x96, 0xA5, 0x16, 0x97, 0x2A, 0xDD, 0x29, 0x34, 0xF4, 0xBF, - 0x2A, 0x6F, 0x43, 0xE5, 0xFF, 0x00, 0x88, 0x7F, 0xB5, 0x27, 0x89, 0xBC, 0x7D, 0x77, 0x65, 0x34, - 0xE9, 0xA3, 0x6A, 0x5A, 0x26, 0x9D, 0x1C, 0x92, 0xE9, 0x3E, 0x15, 0x69, 0xAC, 0xFC, 0x33, 0xE0, - 0x9D, 0x0D, 0x11, 0x76, 0x91, 0xA6, 0xE9, 0x7B, 0xC4, 0x36, 0xEE, 0x16, 0x38, 0xD5, 0x58, 0x46, - 0x5D, 0xC2, 0xFC, 0xC5, 0x8B, 0x02, 0x7E, 0xBF, 0x28, 0xF0, 0xBF, 0x13, 0x87, 0xA9, 0x4F, 0x11, - 0x98, 0x42, 0x1E, 0xC6, 0x17, 0x5C, 0xAA, 0x2D, 0xB5, 0xA6, 0xB2, 0xE6, 0x4F, 0x9A, 0xFE, 0xF2, - 0xB7, 0x3B, 0x94, 0x79, 0xAE, 0xD2, 0x5B, 0x2F, 0x9A, 0xC6, 0x71, 0xBF, 0x0D, 0x64, 0xB8, 0x79, - 0xE1, 0xB2, 0x58, 0x54, 0xAB, 0x89, 0x96, 0xF5, 0x2C, 0xFC, 0x9B, 0xE6, 0x95, 0x9C, 0xE4, 0x9F, - 0x44, 0x94, 0x15, 0xEC, 0xA2, 0xED, 0x1D, 0x3E, 0x6D, 0x4F, 0x1D, 0xF8, 0xF7, 0x46, 0xDF, 0x7F, - 0xA6, 0xF9, 0xBE, 0x75, 0xF2, 0x43, 0xA9, 0xC5, 0x79, 0x65, 0x2B, 0x4C, 0x96, 0xB6, 0xC0, 0x32, - 0xAC, 0x73, 0x24, 0x0D, 0xB7, 0x71, 0xE3, 0x21, 0xC9, 0x6E, 0x14, 0x10, 0x2B, 0xDF, 0x7C, 0x17, - 0x95, 0x52, 0xCB, 0x55, 0x18, 0xE1, 0xD4, 0xF9, 0x64, 0x9B, 0xE7, 0xB4, 0xA4, 0xA3, 0xBA, 0x57, - 0x85, 0x9B, 0x4B, 0x65, 0x18, 0xEF, 0xB7, 0x45, 0x6F, 0xCC, 0xF8, 0x8F, 0x3F, 0xC7, 0xF1, 0x6D, - 0x7A, 0x5F, 0xDB, 0xB8, 0xA4, 0xA3, 0x0B, 0xA8, 0xC2, 0x16, 0x84, 0x13, 0x49, 0x5F, 0x92, 0x2D, - 0xDA, 0xCA, 0xEE, 0xF7, 0x4E, 0x49, 0xBD, 0xED, 0xA3, 0xD3, 0xB8, 0xF8, 0x9B, 0xE3, 0xAD, 0x7A, - 0x0F, 0xB4, 0x78, 0x9B, 0xC3, 0x3E, 0x18, 0xD7, 0xB4, 0xF9, 0x40, 0xBB, 0x4B, 0x7F, 0x13, 0xC1, - 0x71, 0xA6, 0x69, 0xB7, 0xB1, 0x44, 0xE0, 0x14, 0x46, 0x5B, 0x98, 0x1E, 0x40, 0x19, 0x63, 0x18, - 0x49, 0x32, 0x30, 0x07, 0x7C, 0x57, 0x87, 0x5F, 0x87, 0x30, 0x38, 0x0C, 0x3C, 0x71, 0x34, 0x63, - 0x28, 0x7B, 0xCE, 0xEA, 0x29, 0xD9, 0x37, 0x6B, 0xF3, 0x26, 0x9C, 0xA2, 0x96, 0xBB, 0xC9, 0x2E, - 0x8D, 0x59, 0x34, 0x7C, 0x55, 0x3E, 0x1E, 0xC9, 0xBF, 0xB5, 0xFE, 0xB9, 0x84, 0xC5, 0x4E, 0x35, - 0xE3, 0x74, 0xF9, 0x25, 0x07, 0xCB, 0x75, 0x64, 0x9A, 0xE4, 0x6A, 0x29, 0x26, 0xEC, 0x9A, 0x49, - 0xEE, 0xEF, 0x66, 0x7A, 0x17, 0xC1, 0xAF, 0x89, 0x76, 0xDE, 0x0E, 0xBD, 0x9D, 0xF5, 0x3F, 0x0B, - 0xEA, 0x36, 0x76, 0x77, 0x17, 0x73, 0x4E, 0x90, 0xF8, 0x4A, 0x16, 0xD5, 0xB4, 0xDB, 0x48, 0xCB, - 0x99, 0x4A, 0x45, 0x08, 0x91, 0xE5, 0xF2, 0x91, 0x49, 0xC3, 0x16, 0x7C, 0x2A, 0x8F, 0x9F, 0x38, - 0xAF, 0x92, 0xE2, 0x0C, 0xA2, 0xA6, 0x3B, 0x08, 0xA5, 0x46, 0x50, 0x4E, 0xDC, 0xBE, 0xF3, 0x51, - 0x6E, 0xE9, 0x24, 0xAE, 0xD2, 0x4D, 0x5B, 0x5B, 0x5B, 0x7D, 0x34, 0x57, 0xB7, 0x3E, 0x2F, 0x27, - 0x9C, 0xF3, 0xB8, 0xE6, 0x18, 0x4C, 0x44, 0x65, 0x15, 0x1E, 0x49, 0x46, 0x52, 0x51, 0x9F, 0x32, - 0x4A, 0xD2, 0x7B, 0x29, 0x2B, 0xC7, 0x56, 0xAD, 0x66, 0xF4, 0x5D, 0x0F, 0xAD, 0xB4, 0x6F, 0xDA, - 0x1F, 0xE0, 0xE6, 0xA6, 0xA8, 0x57, 0xC6, 0x76, 0x16, 0x24, 0xC6, 0x18, 0x47, 0xAB, 0x23, 0xE9, - 0xC5, 0x01, 0xE8, 0x18, 0xB8, 0x03, 0x23, 0x03, 0x80, 0x4F, 0x6E, 0xD5, 0xF9, 0x1E, 0x6F, 0xC3, - 0x39, 0xD6, 0x1A, 0x8C, 0xB0, 0xEB, 0x0B, 0x68, 0xED, 0xEE, 0x24, 0xDE, 0xCB, 0x66, 0xB5, 0xB6, - 0x8A, 0xCF, 0xA3, 0xED, 0x64, 0x7B, 0xD0, 0xC3, 0xE2, 0x69, 0xB5, 0x1F, 0x66, 0xFB, 0x6C, 0xDE, - 0xB6, 0xD3, 0x6E, 0x8B, 0xBE, 0x8B, 0xA7, 0x4B, 0x1E, 0x9B, 0xA6, 0x78, 0xD3, 0xC1, 0x9A, 0xB2, - 0x07, 0xD3, 0x7C, 0x55, 0xE1, 0xEB, 0xD4, 0x61, 0x94, 0xFB, 0x36, 0xB1, 0x6E, 0xFC, 0x63, 0x8E, - 0x37, 0x7A, 0x02, 0x78, 0xF4, 0x3E, 0x95, 0xF9, 0xEE, 0x27, 0x2F, 0xC4, 0x61, 0xDA, 0x85, 0x4A, - 0x32, 0x8B, 0xBB, 0x5A, 0xC5, 0xAD, 0xBA, 0x3B, 0xA5, 0x6B, 0x5E, 0xDB, 0x5B, 0xA5, 0xDB, 0x45, - 0x29, 0x34, 0xD5, 0xB6, 0xDB, 0xCA, 0xFA, 0x5D, 0x2E, 0x9A, 0x5D, 0x2B, 0x74, 0x3E, 0x74, 0xFD, - 0xA6, 0x2C, 0xA6, 0xD5, 0xFC, 0x35, 0x77, 0x0E, 0x95, 0x17, 0xDB, 0x9E, 0x4D, 0x3E, 0x6B, 0x7C, - 0x59, 0xED, 0x98, 0xEE, 0x64, 0x01, 0x50, 0x10, 0x71, 0x92, 0x09, 0xFC, 0x05, 0x7B, 0x5C, 0x39, - 0x4E, 0x95, 0x4A, 0x55, 0x28, 0x4E, 0x56, 0x8E, 0x8D, 0xDB, 0x47, 0x65, 0x34, 0xAF, 0xDB, 0x45, - 0xE4, 0xF5, 0x69, 0x5B, 0xBF, 0xC8, 0xE6, 0xB5, 0x69, 0xE1, 0x78, 0x87, 0x2E, 0xC6, 0x57, 0x6A, - 0x34, 0xA1, 0x3F, 0x7A, 0x4F, 0xE1, 0x5F, 0x0D, 0xAF, 0xFF, 0x00, 0x80, 0xB4, 0xB6, 0xD5, 0x59, - 0x1A, 0x3F, 0xB2, 0xAD, 0xAE, 0xA6, 0x90, 0x68, 0x57, 0x1A, 0x9A, 0xEA, 0x3A, 0x66, 0xA1, 0x26, - 0x8B, 0x3D, 0xB6, 0xA5, 0xF6, 0xC8, 0xD8, 0xC5, 0x10, 0x89, 0x59, 0x60, 0x48, 0x94, 0xE7, 0x1B, - 0x80, 0x07, 0x04, 0x91, 0xF3, 0x37, 0xDD, 0x00, 0x01, 0xF6, 0xBC, 0x47, 0x1A, 0x78, 0xE7, 0x96, - 0xD6, 0xAD, 0x35, 0xCD, 0x52, 0x85, 0x5A, 0x72, 0x6A, 0x2D, 0x5B, 0xD9, 0xC7, 0x96, 0x0A, 0xCA, - 0xDA, 0xDA, 0x36, 0xE6, 0x5A, 0x3B, 0x27, 0x6D, 0x8C, 0xE9, 0xD6, 0xA1, 0x89, 0xE2, 0x4C, 0x5D, - 0x7C, 0x03, 0xF6, 0x94, 0x57, 0x24, 0x53, 0x4D, 0x38, 0xB5, 0x78, 0xD9, 0x26, 0xF5, 0xF7, 0x52, - 0x69, 0xDB, 0x45, 0x65, 0x6B, 0xDF, 0x5F, 0xAB, 0xC8, 0x02, 0x37, 0xDB, 0x1A, 0xAF, 0xEE, 0xFE, - 0xE9, 0x1B, 0x70, 0xA4, 0x02, 0x54, 0xFA, 0x77, 0xFE, 0x7C, 0xF4, 0xAF, 0xE6, 0xDF, 0x66, 0xF0, - 0xEA, 0x71, 0xE5, 0x4D, 0xA4, 0xE2, 0xD3, 0x57, 0xB6, 0xEA, 0xE9, 0x74, 0x6A, 0xD6, 0x4E, 0xEB, - 0xB2, 0x56, 0x3F, 0x43, 0x71, 0xBC, 0x54, 0x62, 0xAD, 0xA6, 0xDA, 0x2B, 0xDB, 0xA7, 0xA5, 0xBB, - 0x5A, 0xD6, 0x3E, 0x48, 0xF8, 0x83, 0xE1, 0xFD, 0x66, 0xC3, 0xC4, 0x77, 0x5A, 0xE5, 0xD7, 0x86, - 0x2F, 0x35, 0x8F, 0x0F, 0xE9, 0xF6, 0xD7, 0x71, 0xDB, 0x8D, 0x32, 0x13, 0x34, 0xD6, 0xD7, 0x17, - 0xAB, 0x12, 0xC2, 0xEC, 0x41, 0x19, 0x00, 0xC0, 0xC3, 0x68, 0xC7, 0xDE, 0x18, 0xCE, 0x7E, 0x5F, - 0xE8, 0x9E, 0x1E, 0x58, 0x6C, 0x45, 0x2C, 0x3E, 0x4B, 0x83, 0xA9, 0x19, 0x37, 0x39, 0x53, 0x9F, - 0x25, 0xEC, 0x94, 0xA9, 0xAB, 0x5B, 0x54, 0x95, 0xD2, 0xB2, 0x6F, 0x9A, 0xF2, 0xBA, 0x71, 0xB6, - 0xDF, 0x9D, 0x73, 0xBC, 0xBB, 0x15, 0x8D, 0xA5, 0x98, 0x47, 0x96, 0x95, 0x5B, 0x38, 0xC9, 0xC5, - 0x38, 0xC9, 0x34, 0xA3, 0x28, 0xC9, 0x36, 0x92, 0x4E, 0xC9, 0x5E, 0x36, 0x69, 0x75, 0x5A, 0xA3, - 0xB3, 0xF8, 0x73, 0xF1, 0x76, 0xDE, 0x6B, 0x2D, 0x3B, 0x47, 0xBD, 0xF0, 0xEE, 0xB9, 0x6B, 0x7D, - 0x0C, 0x7E, 0x40, 0x7F, 0xEC, 0xD7, 0x8E, 0x30, 0x14, 0x63, 0x24, 0x63, 0x8C, 0x60, 0xF0, 0x38, - 0x03, 0x1C, 0xE0, 0xE4, 0xFE, 0x4B, 0x99, 0x70, 0xF3, 0xF6, 0xB5, 0x31, 0x74, 0x6A, 0x2B, 0x36, - 0xDB, 0x4F, 0x46, 0xAC, 0xDE, 0x8A, 0xD6, 0xD3, 0x45, 0x7B, 0x2E, 0xB6, 0xB6, 0x8A, 0xDE, 0x96, - 0x47, 0xC4, 0x94, 0xF0, 0xF4, 0xA8, 0xE5, 0x53, 0xA5, 0x76, 0x94, 0x62, 0xA5, 0x06, 0xA5, 0x16, - 0x92, 0x49, 0x3B, 0x2F, 0x79, 0x69, 0xBD, 0xD5, 0x96, 0xB7, 0x7A, 0x59, 0x7D, 0x27, 0x04, 0xBF, - 0x69, 0x84, 0xB0, 0x05, 0x15, 0xE1, 0x66, 0x11, 0x72, 0xAC, 0x00, 0x4E, 0x14, 0xE7, 0xF9, 0x74, - 0xFC, 0x2B, 0xE4, 0x28, 0x50, 0xF6, 0x78, 0xB8, 0x53, 0x8B, 0x69, 0xF4, 0x6A, 0xCB, 0x64, 0xEC, - 0xD5, 0x9E, 0x8A, 0xEB, 0x74, 0xD3, 0xB6, 0xCA, 0xFA, 0x1F, 0x6F, 0x15, 0x17, 0x18, 0xCA, 0x31, - 0xB7, 0x4F, 0xBB, 0xF2, 0xB7, 0x97, 0x96, 0x87, 0xC0, 0xBF, 0x17, 0xFC, 0x0B, 0xF1, 0x0A, 0xD3, - 0xE2, 0x9F, 0x85, 0x7C, 0x67, 0xE1, 0xAF, 0x0F, 0x6A, 0xDA, 0xE4, 0x7A, 0x6E, 0xA6, 0x5A, 0x38, - 0xF4, 0x39, 0x36, 0x6A, 0xA7, 0x78, 0x0A, 0x86, 0x06, 0xC8, 0x01, 0xF8, 0x18, 0x24, 0x8E, 0x71, - 0xD3, 0x3C, 0x7E, 0x99, 0x91, 0xE7, 0x15, 0x31, 0x58, 0x0A, 0x58, 0x5F, 0x6F, 0x2B, 0xAE, 0x58, - 0xF2, 0xA9, 0xB5, 0xAA, 0x92, 0xE5, 0x51, 0x57, 0xB5, 0xD6, 0xF1, 0xB2, 0xD3, 0x74, 0xB6, 0xBF, - 0xC4, 0xBC, 0x1C, 0xF0, 0xB5, 0xF1, 0xF8, 0x4C, 0x42, 0x95, 0x35, 0x5D, 0xC2, 0x54, 0xE7, 0x18, - 0xB7, 0x14, 0xE2, 0xD6, 0x92, 0xE5, 0x8C, 0x9C, 0x5E, 0x8B, 0x5E, 0x56, 0xAD, 0x6D, 0xED, 0x63, - 0xEA, 0x0F, 0x04, 0xFC, 0x4F, 0xD5, 0xF5, 0x99, 0x46, 0x91, 0xA9, 0x78, 0x4F, 0xC5, 0xDA, 0x45, - 0xEC, 0x44, 0x25, 0xD4, 0xBA, 0xBD, 0xBB, 0xA2, 0x17, 0x18, 0x0D, 0xE6, 0xC9, 0x9E, 0x4F, 0x4C, - 0x91, 0x9E, 0xE6, 0xBE, 0x5F, 0x3B, 0xC2, 0xE2, 0xE9, 0x7B, 0x5C, 0x55, 0x3C, 0x54, 0xB9, 0x2E, - 0xEF, 0x19, 0x4D, 0xDF, 0x4E, 0x8F, 0x65, 0xA7, 0x45, 0xDE, 0xD6, 0x47, 0xA5, 0x94, 0xE7, 0x2E, - 0x73, 0x86, 0x06, 0xA6, 0x19, 0xDD, 0x2B, 0x29, 0x47, 0xE0, 0xB2, 0xD1, 0x5A, 0xE9, 0x35, 0xB5, - 0x92, 0xB3, 0x56, 0x56, 0x5D, 0x2D, 0xF3, 0xE7, 0xED, 0x98, 0x65, 0x9B, 0xC2, 0x03, 0x60, 0x95, - 0x9C, 0xC4, 0x80, 0x2C, 0x4C, 0x01, 0x04, 0x4C, 0x80, 0x31, 0xF6, 0xE0, 0x75, 0xE9, 0x81, 0xE9, - 0xC7, 0xA5, 0xC2, 0x50, 0xC6, 0xCA, 0x85, 0x68, 0x52, 0xE7, 0x6E, 0xC9, 0xA4, 0xA6, 0xA3, 0xB2, - 0x76, 0x7D, 0x92, 0x4A, 0xFA, 0x6E, 0xD5, 0xEC, 0xD1, 0xB6, 0x2D, 0xC2, 0x97, 0x15, 0xE5, 0xB2, - 0x6D, 0x24, 0x9D, 0x4D, 0x5A, 0xD7, 0xE0, 0xBF, 0x4B, 0x59, 0xF4, 0xB7, 0xC8, 0x8B, 0xE0, 0x84, - 0xBF, 0x15, 0x3C, 0x09, 0xF0, 0xF2, 0xDA, 0xE1, 0x3C, 0x2B, 0x7D, 0xE3, 0x5D, 0x16, 0x38, 0x92, - 0x38, 0xA6, 0xD3, 0xAF, 0x62, 0x1F, 0x64, 0xC8, 0xF9, 0x36, 0xC5, 0xB7, 0x2C, 0xA0, 0x29, 0x5F, - 0xBC, 0x39, 0x15, 0xE9, 0x66, 0xB9, 0x76, 0x57, 0x8B, 0xCA, 0x69, 0xD6, 0xC7, 0x42, 0x71, 0xC6, - 0x59, 0xFE, 0xF1, 0x4E, 0x3C, 0x96, 0x56, 0xDE, 0x0E, 0x2B, 0x65, 0xE7, 0xAD, 0xD7, 0x44, 0x93, - 0xF1, 0xB0, 0xB9, 0xA4, 0xFE, 0xB9, 0x88, 0xC6, 0xE5, 0x18, 0x79, 0xAA, 0x33, 0x93, 0x76, 0x6B, - 0xDD, 0xE6, 0x4E, 0xD2, 0x6B, 0x95, 0x39, 0x45, 0x3B, 0x6A, 0xB9, 0x5A, 0xD3, 0x4B, 0x58, 0xFB, - 0xF7, 0xF6, 0x7B, 0xFF, 0x00, 0x82, 0x99, 0x7C, 0x68, 0xFD, 0x9D, 0xD0, 0xF8, 0x5B, 0x4A, 0xF8, - 0x29, 0xE2, 0x0F, 0x89, 0xDF, 0x0B, 0xB5, 0x9B, 0x81, 0x27, 0x89, 0x7E, 0x0E, 0xFC, 0x44, 0xD3, - 0x23, 0xD5, 0xFC, 0x19, 0x20, 0x72, 0x56, 0x5B, 0xCD, 0x1E, 0x47, 0x24, 0xE9, 0x1A, 0x88, 0x49, - 0x1C, 0x2D, 0xDD, 0xB0, 0x07, 0x3C, 0x48, 0xB2, 0xA1, 0x68, 0xCF, 0xCB, 0xAC, 0x8F, 0x04, 0xA8, - 0xC6, 0x70, 0xC5, 0x24, 0xD6, 0xFA, 0xAD, 0x5E, 0xEA, 0xCA, 0xFA, 0x6F, 0x67, 0x6F, 0x55, 0xAA, - 0x4C, 0xF5, 0x28, 0xF1, 0x26, 0x26, 0xA3, 0x8A, 0x8D, 0x15, 0x1D, 0x52, 0x77, 0x75, 0x1B, 0xB7, - 0x5B, 0x25, 0x4A, 0xFA, 0x2B, 0xD9, 0x3B, 0x2D, 0x76, 0xE8, 0x59, 0xFD, 0xA4, 0x7F, 0x63, 0x2B, - 0xBF, 0xDA, 0x67, 0x5C, 0x5F, 0xDB, 0x27, 0xE0, 0x97, 0x8E, 0xBC, 0x4F, 0xF1, 0x1B, 0xE0, 0x8D, - 0x94, 0x56, 0xDA, 0xA7, 0x8F, 0xFE, 0x13, 0x78, 0xCF, 0x4B, 0xB5, 0xB1, 0xF8, 0xFF, 0x00, 0xF0, - 0x02, 0xFD, 0x90, 0x2A, 0xDB, 0x78, 0x8B, 0x4C, 0xB4, 0x2F, 0x0D, 0xCE, 0x97, 0x1E, 0x76, 0x41, - 0xA8, 0xDB, 0x13, 0x09, 0x1C, 0x39, 0x56, 0x47, 0xDB, 0x78, 0x6C, 0xF6, 0x78, 0x3C, 0x35, 0x4C, - 0x3C, 0xDA, 0x73, 0xDA, 0xF1, 0x77, 0x4E, 0xC9, 0x6A, 0xF7, 0xEC, 0xAC, 0x95, 0x92, 0x4B, 0x54, - 0x74, 0x63, 0x72, 0xB7, 0x8C, 0x55, 0x6B, 0x60, 0xE4, 0xEF, 0x5F, 0xDC, 0x9C, 0xE5, 0xA4, 0xA3, - 0x49, 0x6B, 0xEC, 0xE9, 0xC1, 0x45, 0x38, 0xA7, 0xD5, 0xCD, 0x26, 0xF5, 0x5A, 0xB5, 0xAF, 0x1F, - 0xA2, 0x6A, 0xFA, 0xCF, 0x84, 0x96, 0xD6, 0xE3, 0xC2, 0x57, 0xF3, 0x69, 0xD7, 0xD6, 0xD6, 0xBE, - 0x55, 0xAB, 0xD9, 0xCF, 0xE4, 0xC7, 0x32, 0xAA, 0xFC, 0xB0, 0xC8, 0xA3, 0xE5, 0x92, 0x36, 0xF9, - 0x41, 0x56, 0x52, 0xA4, 0x71, 0x8E, 0x95, 0xE7, 0x70, 0xD5, 0x0C, 0x3E, 0x65, 0xC4, 0x38, 0x4C, - 0x36, 0x3E, 0x6D, 0x52, 0xA9, 0x34, 0xA6, 0xE2, 0xD2, 0x92, 0x56, 0x6D, 0x34, 0xDA, 0x69, 0x6A, - 0x96, 0x8D, 0x35, 0xE4, 0xFA, 0x76, 0xD7, 0xE7, 0xC2, 0x60, 0x65, 0x0C, 0x22, 0x57, 0x51, 0x69, - 0x2D, 0x52, 0xD1, 0x59, 0x27, 0x6E, 0x9D, 0xF7, 0xD3, 0x4D, 0x3A, 0xE2, 0xF8, 0x47, 0xC6, 0x1A, - 0xCF, 0xC5, 0x2D, 0x7B, 0x58, 0x8B, 0xE2, 0x6F, 0x86, 0x74, 0xBF, 0x85, 0x9E, 0x23, 0x9A, 0xE9, - 0xCE, 0x9F, 0xE2, 0xAD, 0x0E, 0x08, 0xA1, 0xF8, 0x7B, 0xE2, 0x1C, 0x63, 0x0D, 0xA8, 0xD8, 0xAB, - 0x19, 0x74, 0xF9, 0x49, 0x0A, 0x77, 0xC0, 0xAF, 0x11, 0x38, 0x26, 0x35, 0xC9, 0xC6, 0xF9, 0xDB, - 0xC1, 0x62, 0x71, 0xF8, 0x8C, 0x5A, 0xA9, 0x16, 0xE5, 0x26, 0xD5, 0xB9, 0xAF, 0xDB, 0x64, 0xAD, - 0x6B, 0x59, 0x2D, 0x13, 0xB6, 0xBA, 0xEE, 0x73, 0x65, 0xD3, 0xF6, 0x98, 0x3A, 0x14, 0xF1, 0x34, - 0xE5, 0x0A, 0xEA, 0x36, 0x9B, 0x71, 0x8A, 0xA7, 0x74, 0x92, 0x4A, 0x2D, 0xC9, 0xEE, 0xF6, 0x7A, - 0x2D, 0x36, 0x49, 0x24, 0x78, 0x47, 0xC6, 0x1F, 0x84, 0xBE, 0x3F, 0xD4, 0x3E, 0x26, 0x78, 0x6E, - 0xC3, 0xC4, 0xBA, 0x23, 0xD8, 0x78, 0x4F, 0x41, 0x74, 0xD4, 0xA2, 0xBB, 0x92, 0xE2, 0x39, 0xF4, - 0xFD, 0x68, 0xA8, 0x06, 0x19, 0x6D, 0x1D, 0x09, 0x49, 0x62, 0x3B, 0xB7, 0x6E, 0x53, 0x83, 0xC7, - 0x4E, 0x95, 0xB6, 0x0A, 0xBE, 0x1F, 0x03, 0x81, 0xF6, 0x71, 0x92, 0xE7, 0x7A, 0xF6, 0x77, 0x5A, - 0x47, 0xB2, 0xB2, 0xD5, 0xDD, 0x3B, 0x69, 0x66, 0xBB, 0x78, 0xD9, 0x8E, 0x0F, 0x19, 0x5F, 0x1F, - 0x38, 0xBA, 0x6E, 0x31, 0x92, 0x54, 0xD4, 0xB4, 0xE5, 0x50, 0x6D, 0x39, 0xB8, 0xB4, 0xEF, 0xCD, - 0x24, 0x94, 0x57, 0x96, 0xBB, 0x1D, 0xED, 0xFA, 0x4F, 0x06, 0x9F, 0x34, 0x7A, 0x75, 0xB2, 0xCD, - 0x70, 0x90, 0x18, 0x2D, 0x60, 0x52, 0x22, 0x46, 0x21, 0x02, 0xA2, 0x92, 0x70, 0x3A, 0x90, 0x39, - 0x03, 0xE8, 0x3A, 0x0E, 0x0C, 0x32, 0x84, 0xEB, 0x47, 0xDA, 0xBB, 0x46, 0xEA, 0xEE, 0xDD, 0x34, - 0xDB, 0xE5, 0xD3, 0xC9, 0x74, 0xB1, 0xE9, 0xE2, 0x63, 0x56, 0x8E, 0x0A, 0x4B, 0x09, 0x04, 0xE4, - 0xA3, 0x68, 0xC7, 0x44, 0x9B, 0x4A, 0xC9, 0x74, 0xF2, 0x5D, 0x2C, 0xBB, 0x5E, 0xC7, 0x95, 0xFC, - 0x1B, 0xF0, 0x3E, 0xAD, 0xE1, 0x79, 0xFC, 0x43, 0x7D, 0xAF, 0x08, 0x66, 0xD7, 0xFC, 0x4B, 0xA9, - 0x49, 0x7F, 0xAB, 0x5F, 0xD9, 0xDA, 0xC9, 0x74, 0xF6, 0x36, 0xAA, 0x00, 0x45, 0x52, 0xA3, 0x72, - 0x84, 0x50, 0xAA, 0xC4, 0x8C, 0x67, 0x92, 0x2B, 0xE9, 0x61, 0x8A, 0xA1, 0x5A, 0xAA, 0xA7, 0x29, - 0x28, 0xD2, 0x5A, 0xBD, 0x2E, 0xE2, 0x97, 0x58, 0xEC, 0xEC, 0x96, 0xB6, 0xD1, 0x5D, 0xB5, 0x7B, - 0x2D, 0x3C, 0x3A, 0x58, 0x79, 0xF2, 0xC7, 0x96, 0x0F, 0x96, 0x14, 0xD4, 0x20, 0x9D, 0xAF, 0xB7, - 0x34, 0xE5, 0x24, 0x97, 0xBA, 0xE5, 0x36, 0xDB, 0x49, 0xDB, 0x95, 0x45, 0x35, 0xA5, 0x9E, 0xDF, - 0x8F, 0xAF, 0x3C, 0x3B, 0xAA, 0x69, 0xFA, 0xDE, 0x99, 0x79, 0xAA, 0xDB, 0xDA, 0xE9, 0x77, 0x96, - 0xAF, 0x6F, 0x1C, 0x5A, 0xA6, 0xA9, 0x16, 0xE8, 0xD0, 0x26, 0x17, 0x71, 0x24, 0x0C, 0x02, 0xB9, - 0x00, 0x01, 0x80, 0x05, 0x72, 0xD6, 0xC7, 0xAA, 0xB8, 0xE5, 0x59, 0x37, 0xEC, 0xEF, 0xCB, 0x14, - 0xDD, 0xDA, 0x8D, 0xAD, 0x65, 0xBD, 0x9D, 0x9B, 0xD1, 0x5E, 0xD7, 0x7E, 0x64, 0xFB, 0x2A, 0xF2, - 0xA2, 0xE3, 0x06, 0xA3, 0x51, 0x59, 0xC5, 0xEA, 0x94, 0x65, 0x16, 0xA5, 0x16, 0xBA, 0xA4, 0xA4, - 0x97, 0x4D, 0xFA, 0x1F, 0x22, 0x7C, 0x37, 0xF1, 0x0D, 0xAF, 0xC3, 0x3F, 0x14, 0x6A, 0xBE, 0x28, - 0xF1, 0xEF, 0xC5, 0x6D, 0x0F, 0x5A, 0xD6, 0x2D, 0x74, 0xC5, 0xF0, 0xEF, 0x86, 0x6E, 0x57, 0x5D, - 0x3E, 0x21, 0xBE, 0xB0, 0xD3, 0xA3, 0x66, 0x0B, 0x02, 0xAB, 0x83, 0xB5, 0x02, 0xC8, 0x42, 0xA8, - 0xC8, 0x1C, 0xE0, 0x8C, 0x71, 0xE7, 0xD3, 0xC4, 0x61, 0x30, 0x94, 0x65, 0x4A, 0xAE, 0x26, 0x1C, - 0xAE, 0x5E, 0xED, 0xF9, 0x63, 0xCB, 0x0B, 0x5F, 0x95, 0xDE, 0xD7, 0x6B, 0x4D, 0x77, 0xB2, 0x8F, - 0x56, 0xAF, 0xEE, 0x66, 0x58, 0xAC, 0xD7, 0x3D, 0xC4, 0x61, 0x6A, 0xE0, 0x70, 0x95, 0x22, 0xA0, - 0xA5, 0x29, 0xB7, 0x1E, 0x64, 0xEA, 0xCA, 0x2A, 0x37, 0x8B, 0x57, 0x8D, 0x94, 0x6E, 0xB5, 0xB6, - 0xEA, 0xD1, 0xBE, 0xDE, 0x5B, 0xE2, 0x9F, 0x8A, 0x1E, 0x15, 0x1E, 0x2D, 0x49, 0xAC, 0x35, 0x6B, - 0x4D, 0x43, 0xC1, 0x51, 0xEB, 0xEB, 0xE2, 0xD7, 0xD1, 0xEC, 0xF4, 0x04, 0x8F, 0x54, 0x9B, 0x52, - 0x8E, 0xDC, 0xC7, 0x14, 0x86, 0xE9, 0xA3, 0x0C, 0x63, 0x00, 0x8F, 0x94, 0xC9, 0x81, 0xB4, 0x71, - 0x93, 0x91, 0xE7, 0x57, 0xCF, 0xB2, 0x78, 0x66, 0x10, 0xC6, 0x4B, 0x11, 0xCD, 0x05, 0x18, 0xDE, - 0x0A, 0x32, 0x77, 0x94, 0x53, 0x51, 0x6B, 0x68, 0xE9, 0xD6, 0xFA, 0xA6, 0x93, 0x8A, 0x56, 0x3A, - 0x70, 0x99, 0x27, 0x10, 0xD6, 0xE1, 0x8A, 0xD9, 0x1C, 0x30, 0xCE, 0x9D, 0x59, 0x73, 0x42, 0x33, - 0x9C, 0xA3, 0x65, 0x4A, 0x52, 0x52, 0x94, 0x74, 0x6E, 0x49, 0xEE, 0x92, 0x4A, 0xCD, 0x6E, 0xB4, - 0x45, 0xCF, 0x1B, 0xFE, 0xD4, 0xEB, 0xE2, 0xA3, 0x78, 0x8B, 0xF0, 0xF3, 0xC2, 0xD7, 0x76, 0x77, - 0x1A, 0x3A, 0xE8, 0xF0, 0x69, 0xDA, 0xAD, 0xAC, 0xB6, 0xDA, 0x3D, 0x88, 0x48, 0xD5, 0x52, 0xE6, - 0x1B, 0x4B, 0x69, 0x93, 0x6C, 0xC0, 0xA0, 0x70, 0x43, 0xED, 0xDF, 0x92, 0x54, 0xF4, 0x1C, 0x78, - 0xDE, 0x37, 0xC2, 0x3A, 0x12, 0xA1, 0x81, 0xC3, 0xB7, 0x76, 0x9B, 0xE7, 0x6A, 0xCD, 0xAE, 0xE9, - 0x5D, 0xCA, 0x3A, 0x27, 0x6B, 0xA6, 0xDF, 0x54, 0x75, 0xE4, 0xBE, 0x1F, 0x62, 0xB0, 0x99, 0x95, - 0x2C, 0xD3, 0x31, 0xC4, 0x43, 0x9A, 0x9C, 0x79, 0x63, 0x0A, 0x71, 0x6A, 0x31, 0xD2, 0xD7, 0x8D, - 0xEC, 0x93, 0xB6, 0xF7, 0x8B, 0x4D, 0x68, 0xD3, 0xDC, 0xF0, 0xA3, 0xF1, 0x13, 0x50, 0x6F, 0x04, - 0xDD, 0x78, 0x22, 0xEB, 0x45, 0xD0, 0x2E, 0xE0, 0xB9, 0xD6, 0x06, 0xB1, 0x3F, 0x88, 0x64, 0x7B, - 0xA3, 0xE2, 0x65, 0x73, 0x20, 0x66, 0x48, 0xA5, 0x17, 0x1E, 0x46, 0xD3, 0x82, 0x0E, 0x61, 0x73, - 0xCF, 0x5C, 0x81, 0x8F, 0x93, 0xC4, 0x71, 0x36, 0x61, 0x8D, 0xC2, 0x3C, 0x05, 0x4B, 0x2A, 0x53, - 0x94, 0xA6, 0xD4, 0x62, 0xE2, 0xFD, 0xE9, 0x73, 0x34, 0xDB, 0x6D, 0x59, 0x3D, 0xAE, 0xAF, 0x6B, - 0x2D, 0x52, 0x3E, 0xF6, 0x97, 0x0C, 0x65, 0xB8, 0x4C, 0xCA, 0x59, 0xBD, 0x38, 0x2F, 0x6F, 0x18, - 0x46, 0x9A, 0xB4, 0xE2, 0xE2, 0xA0, 0x95, 0x92, 0x8C, 0x56, 0x9B, 0x68, 0xDA, 0xBA, 0x5B, 0x69, - 0xD7, 0x6A, 0x5F, 0x89, 0xF6, 0x0B, 0xE2, 0x0F, 0x0F, 0x6A, 0xD6, 0x5E, 0x0A, 0xB3, 0x6D, 0x0B, - 0xC2, 0x9A, 0x6A, 0x59, 0x69, 0x3E, 0x16, 0xD6, 0x3C, 0x41, 0xAA, 0x6A, 0xFA, 0x47, 0xDA, 0x15, - 0x08, 0xFB, 0x6C, 0xAE, 0xD3, 0x89, 0x16, 0x52, 0x4A, 0x3E, 0xD8, 0x1A, 0x05, 0xDD, 0x1C, 0x78, - 0x5C, 0x29, 0x06, 0x16, 0x63, 0x4D, 0xD7, 0xA7, 0x56, 0x95, 0x38, 0x45, 0xC2, 0x36, 0xB6, 0xAA, - 0xFC, 0xAD, 0x5A, 0x57, 0x94, 0xA5, 0x79, 0xB4, 0x96, 0xB1, 0x50, 0x57, 0xD9, 0x69, 0xAE, 0x98, - 0x8C, 0x1B, 0xAB, 0xCD, 0x4E, 0x55, 0x5B, 0x72, 0x6E, 0xF7, 0xD1, 0xB8, 0xBD, 0x2D, 0xEE, 0xB8, - 0xBB, 0x25, 0x65, 0xAB, 0x93, 0xB6, 0x97, 0x30, 0x17, 0xC4, 0x3A, 0x4E, 0xA7, 0x63, 0x77, 0x79, - 0xAE, 0x68, 0x9A, 0x86, 0xA7, 0xE3, 0x1B, 0xDF, 0x12, 0xA6, 0xB9, 0x3F, 0x8B, 0x2F, 0xF5, 0xE9, - 0xAE, 0x60, 0xBB, 0xB4, 0x54, 0x22, 0x4B, 0x19, 0x6D, 0x1D, 0x0E, 0xF2, 0xD2, 0x95, 0x63, 0x31, - 0x94, 0xB6, 0x17, 0x6E, 0x39, 0xCD, 0x7D, 0x87, 0x0A, 0xE0, 0xF0, 0x79, 0xD5, 0x7C, 0x45, 0x7C, - 0x64, 0xA5, 0x49, 0x28, 0xF3, 0x54, 0x96, 0xEA, 0x51, 0x96, 0x8A, 0x31, 0xBA, 0x5C, 0xB1, 0xE6, - 0x49, 0x37, 0xAD, 0xA0, 0x9A, 0xBF, 0x6C, 0xAA, 0xC6, 0x74, 0x22, 0xA8, 0xD0, 0x71, 0xE5, 0x49, - 0x25, 0x1B, 0x7C, 0x2F, 0xBB, 0xB3, 0xED, 0xB2, 0xF4, 0x38, 0xFD, 0x56, 0xEE, 0xE3, 0x50, 0xBE, - 0xB8, 0xBC, 0xBB, 0x65, 0x33, 0xDC, 0x31, 0x96, 0x41, 0x1A, 0x04, 0x8D, 0x49, 0x3F, 0x2A, 0xAA, - 0xF6, 0x00, 0x60, 0x0E, 0xBC, 0x57, 0x8F, 0xC4, 0xB4, 0x2B, 0x51, 0xC4, 0x7D, 0x5F, 0x19, 0x52, - 0xF2, 0x84, 0x36, 0x5A, 0xD9, 0x26, 0xD4, 0x12, 0x57, 0x49, 0x45, 0x2B, 0x45, 0x36, 0xDB, 0x51, - 0xD5, 0x27, 0xD3, 0xAB, 0x0A, 0xA3, 0x1A, 0x71, 0x85, 0x3B, 0xD9, 0x24, 0x95, 0xDB, 0x7A, 0x24, - 0x95, 0xAE, 0xEE, 0xF4, 0x5A, 0x25, 0xB2, 0x49, 0x25, 0x64, 0x91, 0x99, 0x5F, 0x1E, 0x76, 0x8B, - 0xF2, 0xE0, 0x00, 0x31, 0x80, 0x07, 0x6C, 0x74, 0xEC, 0x31, 0xEC, 0x2B, 0x69, 0x3C, 0x37, 0xB2, - 0x4A, 0x9C, 0x64, 0xA7, 0xA6, 0xED, 0x34, 0xF4, 0xD6, 0xC9, 0x45, 0x35, 0xE5, 0xAB, 0xD3, 0x4E, - 0x84, 0x25, 0x24, 0xFA, 0x58, 0x9A, 0xDA, 0xDD, 0xA7, 0x75, 0x45, 0x1F, 0x2F, 0x00, 0xF4, 0x00, - 0x71, 0xC0, 0x1F, 0x95, 0x7D, 0x0F, 0x0A, 0xF0, 0xC6, 0x33, 0x89, 0x73, 0x0A, 0x78, 0x5C, 0x3C, - 0x3F, 0x77, 0x74, 0xA4, 0xF6, 0xE9, 0x7B, 0x27, 0x6B, 0x6C, 0xB5, 0xEC, 0xBE, 0x49, 0xE5, 0x5E, - 0xB4, 0x68, 0x43, 0x5D, 0xED, 0xA1, 0xE8, 0x1A, 0x6E, 0x9E, 0xB6, 0xF1, 0x20, 0x0B, 0x81, 0xB4, - 0x63, 0x20, 0x60, 0x71, 0xD7, 0x1F, 0xFD, 0x6A, 0xFF, 0x00, 0x4C, 0x3C, 0x2C, 0xF0, 0xDF, 0x0D, - 0xC3, 0xD9, 0x55, 0x0A, 0x74, 0xE1, 0x68, 0x59, 0x59, 0xCB, 0x55, 0x17, 0x64, 0xAF, 0xB2, 0x76, - 0x8F, 0x5D, 0x35, 0xEF, 0xD4, 0xF8, 0xDC, 0x66, 0x29, 0xD4, 0x93, 0xEF, 0xE4, 0x4F, 0xA9, 0xDC, - 0x9B, 0x68, 0x7C, 0xB4, 0x8B, 0x32, 0xE3, 0x0B, 0x81, 0xF2, 0x8C, 0x0E, 0x01, 0x1E, 0xF8, 0xAF, - 0x73, 0xC5, 0x5E, 0x2C, 0xAD, 0xC2, 0xF9, 0x27, 0xD4, 0x30, 0x98, 0x57, 0x2C, 0x63, 0x56, 0x8A, - 0x4B, 0xDD, 0x56, 0xDB, 0x9A, 0x37, 0x4D, 0xF3, 0xFD, 0x94, 0x9A, 0xB5, 0xD2, 0xE9, 0xA6, 0x58, - 0x1A, 0x0A, 0xBC, 0xD4, 0x9C, 0xBD, 0xDF, 0xEB, 0x6F, 0x43, 0x92, 0x39, 0x0F, 0x15, 0xC3, 0x09, - 0xD0, 0x46, 0x37, 0x4D, 0x3C, 0x41, 0x92, 0x58, 0xB9, 0xFF, 0x00, 0x55, 0xB7, 0x38, 0x07, 0xA5, - 0x7F, 0x19, 0xE2, 0x61, 0x5E, 0x8E, 0x61, 0x85, 0xE2, 0x5C, 0x62, 0xC4, 0x52, 0x8D, 0x2B, 0xCF, - 0x11, 0x88, 0xA5, 0xED, 0xA1, 0x5A, 0x8D, 0xE4, 0x9F, 0xD4, 0xF9, 0x1C, 0xDC, 0x54, 0xAC, 0xD3, - 0xBB, 0xF7, 0x5A, 0xD1, 0x45, 0x3B, 0x35, 0xF4, 0x10, 0xE5, 0xE4, 0x74, 0x69, 0xA8, 0xBB, 0xE8, - 0xA2, 0xEC, 0xD3, 0xD3, 0xE2, 0xDB, 0x6F, 0x4D, 0x8E, 0xD6, 0xDE, 0x7B, 0x7B, 0xA8, 0xE1, 0x96, - 0xD9, 0xC3, 0xC6, 0xA8, 0x15, 0x73, 0xF7, 0x94, 0xE3, 0xB8, 0xF5, 0x18, 0xAF, 0xEF, 0x2E, 0x1B, - 0xE2, 0x0E, 0x1C, 0xE2, 0xEC, 0x06, 0x0F, 0x39, 0xE1, 0x8C, 0x52, 0xAD, 0x86, 0x85, 0x3E, 0x58, - 0xF3, 0x36, 0xE7, 0x17, 0xA2, 0x7C, 0xDA, 0xB6, 0xAA, 0x45, 0xAB, 0x74, 0x51, 0xD5, 0x38, 0xB3, - 0xE6, 0x6A, 0xD1, 0xAB, 0x41, 0xCA, 0x95, 0x68, 0xDA, 0x57, 0xF9, 0x7C, 0xB6, 0xD0, 0xA8, 0xCA, - 0x2C, 0x66, 0x6B, 0xC6, 0x59, 0x1E, 0xCE, 0x62, 0x12, 0xE5, 0x21, 0xC0, 0x2A, 0xD8, 0xF9, 0x24, - 0x23, 0xA7, 0x04, 0x00, 0x7D, 0xAB, 0xE0, 0x73, 0x8C, 0x2D, 0x6E, 0x01, 0xCF, 0xA7, 0xC7, 0x74, - 0x69, 0x4A, 0xAE, 0x53, 0x89, 0x94, 0x69, 0xE2, 0xE3, 0x4D, 0x7B, 0xCA, 0x76, 0xF7, 0x71, 0x12, - 0xD9, 0x29, 0x5D, 0x46, 0x13, 0x93, 0x4D, 0x72, 0xD9, 0x5A, 0x36, 0x3B, 0x68, 0x3A, 0x78, 0x9A, - 0x4B, 0x0B, 0x51, 0xDA, 0x71, 0x4D, 0xC7, 0xB6, 0xDA, 0x2F, 0x4F, 0x24, 0x5D, 0x29, 0xF2, 0x2B, - 0x80, 0xBC, 0xE0, 0x80, 0xA0, 0x70, 0xA7, 0xA0, 0xFE, 0x55, 0xFA, 0x5D, 0x4C, 0x2C, 0xDE, 0x16, - 0x9E, 0x32, 0xE9, 0xB9, 0x59, 0xD9, 0x25, 0xA4, 0x25, 0xAC, 0x13, 0xDF, 0x5D, 0xB9, 0x9D, 0xBD, - 0x12, 0xB1, 0xC0, 0x9A, 0x5E, 0xEA, 0x5A, 0x7E, 0xAB, 0xFA, 0xD0, 0x88, 0xAF, 0x03, 0x80, 0x31, - 0x81, 0xC6, 0x71, 0xD3, 0x8E, 0x3F, 0x0A, 0xF2, 0x31, 0x18, 0x6A, 0x89, 0x45, 0x34, 0x92, 0xF2, - 0xBD, 0xBC, 0xBD, 0x3E, 0xE5, 0xDB, 0xA6, 0xBA, 0x45, 0xAD, 0x91, 0x0B, 0x46, 0x40, 0xE3, 0xF0, - 0x1C, 0x7E, 0x9F, 0x90, 0xAF, 0x0B, 0x11, 0x84, 0xA9, 0x05, 0xA2, 0xD1, 0xF4, 0xD3, 0x7D, 0x36, - 0xB7, 0x4B, 0x7E, 0x46, 0x91, 0x69, 0x59, 0x5B, 0x4F, 0xD0, 0x83, 0x68, 0xE9, 0x8E, 0x06, 0x30, - 0x00, 0x00, 0x0C, 0x76, 0xC5, 0x78, 0x9F, 0x57, 0x71, 0x4E, 0x9C, 0xF6, 0xD1, 0xAB, 0x6D, 0xA6, - 0x96, 0xB7, 0x4D, 0xD2, 0xE9, 0x7F, 0x2B, 0x58, 0xD1, 0x34, 0xED, 0xCA, 0x87, 0xB2, 0x92, 0xB1, - 0xB4, 0x6C, 0x62, 0x9E, 0x06, 0x59, 0x6D, 0xE6, 0x84, 0xEC, 0x96, 0x27, 0x46, 0x05, 0x19, 0x4F, - 0x6C, 0x10, 0x2B, 0x8B, 0x8A, 0xB8, 0x6B, 0x2F, 0xE2, 0xEC, 0x8E, 0xA6, 0x4F, 0x8D, 0x86, 0xF1, - 0x4A, 0x32, 0x86, 0x93, 0x4D, 0x34, 0xE3, 0xAE, 0xBA, 0x5D, 0x25, 0xB6, 0xDA, 0x7A, 0x3A, 0x15, - 0xA5, 0x42, 0x6A, 0x71, 0xDB, 0xB7, 0x4D, 0x8F, 0xE8, 0x0B, 0xF6, 0x16, 0xFD, 0xAB, 0x2C, 0x75, - 0xBD, 0x27, 0x4E, 0xB5, 0xD5, 0xAE, 0xE2, 0x8B, 0x57, 0xB1, 0x86, 0x3D, 0x37, 0xC4, 0x1A, 0x71, - 0x65, 0x49, 0x15, 0x90, 0xFC, 0xB3, 0xA2, 0x93, 0xF7, 0x5B, 0xEF, 0x2F, 0x6E, 0xA0, 0xF2, 0x31, - 0x5F, 0xC6, 0x38, 0xCC, 0xAB, 0x17, 0xC3, 0x78, 0xDA, 0x9C, 0x2B, 0x9E, 0x47, 0x92, 0xA4, 0x5B, - 0x74, 0xE5, 0xD2, 0x49, 0xDE, 0xCA, 0xFD, 0x1F, 0x4B, 0x24, 0xBA, 0x59, 0x6C, 0x8E, 0x3C, 0x6E, - 0x1F, 0xD9, 0x57, 0x58, 0xDC, 0x2A, 0xF7, 0x6D, 0xEF, 0x2B, 0x5F, 0x64, 0xAD, 0x6D, 0x3C, 0xAD, - 0xD7, 0x64, 0xDE, 0x88, 0xFD, 0x4F, 0xBC, 0xF0, 0x27, 0xC3, 0x5F, 0x88, 0xF7, 0x3A, 0x77, 0x89, - 0x5E, 0xDA, 0xCE, 0xF2, 0xF6, 0xD9, 0x52, 0x4B, 0x6B, 0x9B, 0x3B, 0xA3, 0x0D, 0xC4, 0x47, 0x00, - 0x85, 0x25, 0x09, 0x3C, 0x64, 0x70, 0x7A, 0x71, 0x9E, 0xBC, 0x14, 0x73, 0x1C, 0xD3, 0x2A, 0x84, - 0xB0, 0xF4, 0xDD, 0xA3, 0xE6, 0x93, 0x56, 0xEE, 0xAE, 0xB6, 0x76, 0xE9, 0x64, 0xED, 0xA2, 0xD0, - 0xE0, 0xAB, 0x96, 0xE5, 0xF9, 0x8C, 0x95, 0x48, 0xE9, 0x2F, 0x27, 0x6E, 0x9B, 0x69, 0x7D, 0x3D, - 0x34, 0x7A, 0xBB, 0x6E, 0x7A, 0x03, 0x78, 0x5F, 0x41, 0x97, 0x4B, 0x93, 0x45, 0x7D, 0x3A, 0x29, - 0x34, 0xD9, 0x62, 0x11, 0x4B, 0x6F, 0x22, 0x86, 0xF3, 0x50, 0x60, 0x01, 0x26, 0x73, 0xC0, 0x00, - 0x0E, 0x87, 0xA7, 0x3E, 0xFE, 0x6A, 0xC6, 0x62, 0x61, 0x56, 0x35, 0x94, 0xDF, 0x3A, 0xD9, 0xAE, - 0x8F, 0xCA, 0xD6, 0xDF, 0xCA, 0xDE, 0x5A, 0x6D, 0xDE, 0xB0, 0x38, 0x47, 0x45, 0xE1, 0xB9, 0x3D, - 0xC6, 0xB4, 0xEF, 0x6D, 0x16, 0xFB, 0x25, 0xDF, 0xD1, 0xF6, 0x39, 0xA8, 0xFC, 0x3D, 0xE0, 0x7F, - 0x03, 0xD8, 0x2B, 0xAC, 0x76, 0xFA, 0x75, 0x9D, 0xB0, 0x06, 0x38, 0x64, 0x94, 0x18, 0xA2, 0xE3, - 0xA4, 0x68, 0x7D, 0x48, 0x1E, 0xBF, 0x90, 0xAE, 0xB9, 0x62, 0xF3, 0x0C, 0xC6, 0x7C, 0xB2, 0x7C, - 0xCD, 0xF5, 0xB2, 0x5A, 0x2D, 0x35, 0x7A, 0x2B, 0x25, 0xA5, 0xB6, 0x56, 0xE8, 0x71, 0x47, 0x03, - 0x96, 0xE0, 0x60, 0xA2, 0x95, 0xA2, 0x96, 0x89, 0xB5, 0xFA, 0xD9, 0x5A, 0xFE, 0x8B, 0x6D, 0xF7, - 0x7F, 0x98, 0xBF, 0xB7, 0x17, 0xED, 0x59, 0xA0, 0xF8, 0x2B, 0xC2, 0xD7, 0xC2, 0xDE, 0xF2, 0x2F, - 0xB5, 0x35, 0xBB, 0x5A, 0x68, 0x9A, 0x54, 0x52, 0x01, 0x3D, 0xCC, 0xCC, 0xA4, 0x21, 0x31, 0xF6, - 0xC7, 0x3C, 0x9E, 0x80, 0x1E, 0x99, 0xE3, 0xC5, 0xCE, 0xB3, 0x2C, 0x3E, 0x07, 0x07, 0x3C, 0x1D, - 0x39, 0x5E, 0x6F, 0xE3, 0x92, 0xED, 0x67, 0xEE, 0xAD, 0xB5, 0x7F, 0xF0, 0x76, 0x8A, 0x3D, 0x1C, - 0xB7, 0x05, 0x5B, 0x1B, 0x8A, 0x8D, 0x6A, 0x8A, 0xD1, 0xD3, 0x95, 0x5A, 0xDA, 0x25, 0x6B, 0x3D, - 0x34, 0xB6, 0xB6, 0xD2, 0xDB, 0x68, 0xB6, 0x5F, 0x87, 0x7F, 0xB1, 0x36, 0xA3, 0x77, 0xAB, 0xFE, - 0xDD, 0xBF, 0xB2, 0x46, 0xAB, 0x7F, 0x29, 0x9A, 0xF7, 0x51, 0xFD, 0xAC, 0x3C, 0x05, 0x7B, 0x75, - 0x29, 0xFE, 0x39, 0x25, 0xF1, 0x75, 0x8B, 0x39, 0xC7, 0xD4, 0x9E, 0x2B, 0xF3, 0x4C, 0x15, 0x47, - 0x57, 0x35, 0xA3, 0x52, 0x5B, 0xBA, 0x91, 0x7E, 0x9E, 0xF2, 0xD1, 0x79, 0x25, 0xA2, 0xEC, 0x91, - 0xF7, 0x15, 0xA1, 0x1A, 0x78, 0x39, 0xC2, 0x2A, 0xC9, 0x45, 0xFE, 0x47, 0xFA, 0x04, 0x57, 0xE9, - 0xE7, 0xC8, 0x05, 0x00, 0x14, 0x00, 0x50, 0x07, 0xF2, 0x31, 0xFF, 0x00, 0x05, 0x5D, 0xFD, 0x9F, - 0xFE, 0x31, 0x7C, 0x5A, 0xFD, 0xB9, 0x3E, 0x2B, 0xEB, 0xDF, 0x0E, 0x7E, 0x1F, 0x6B, 0xBE, 0x2D, - 0xD1, 0x74, 0xDD, 0x17, 0xC2, 0xDA, 0x1D, 0xEE, 0xA1, 0xA5, 0xC7, 0x17, 0xD9, 0x6D, 0xEE, 0xD3, - 0xC2, 0xDA, 0x7C, 0xAF, 0x6E, 0x59, 0xDD, 0x7E, 0x71, 0x15, 0xCD, 0xB3, 0x10, 0x3A, 0x09, 0x13, - 0xD6, 0xBD, 0x3C, 0x9F, 0x34, 0xC9, 0xF0, 0x58, 0x5C, 0x4E, 0x1B, 0x31, 0xAA, 0xA3, 0x27, 0x55, - 0xB4, 0x9A, 0x6F, 0xDD, 0x74, 0xA9, 0x24, 0xD5, 0x93, 0xB6, 0xA9, 0xAE, 0x9D, 0x7D, 0x0F, 0x5F, - 0x0B, 0x09, 0xBA, 0x10, 0x70, 0x5A, 0x25, 0xFA, 0xB3, 0xF3, 0x7E, 0x4F, 0xD8, 0xB3, 0xF6, 0xA2, - 0x65, 0x0B, 0xFF, 0x00, 0x0A, 0x5B, 0xC5, 0x98, 0xDA, 0x08, 0x1E, 0x5D, 0xAE, 0x30, 0x07, 0x6F, - 0xDE, 0xFF, 0x00, 0xB2, 0x78, 0xF6, 0xAC, 0xF3, 0x4C, 0xD3, 0x87, 0x71, 0x74, 0x9D, 0x07, 0x5A, - 0x2E, 0x29, 0x24, 0x97, 0x2C, 0x9F, 0x6E, 0xF1, 0xFB, 0xD5, 0x92, 0xED, 0xAA, 0x3A, 0xA0, 0xAA, - 0x53, 0x69, 0xF2, 0xFD, 0xDF, 0xF0, 0x3F, 0xA5, 0xF2, 0x33, 0x65, 0xFD, 0x8A, 0x3F, 0x6A, 0x44, - 0x20, 0x27, 0xC1, 0x6F, 0x16, 0xE3, 0x03, 0x8D, 0xB6, 0xBD, 0xFA, 0x00, 0x3C, 0xDE, 0x9C, 0x0F, - 0xD2, 0xBF, 0x2E, 0xCD, 0x70, 0x79, 0x7C, 0x67, 0x1F, 0xEC, 0xC9, 0xA7, 0x1D, 0x5B, 0xF8, 0x96, - 0xEF, 0x44, 0x93, 0x56, 0xB2, 0x5B, 0x6B, 0xEB, 0xB1, 0xD7, 0x4B, 0x11, 0x14, 0xAD, 0x3F, 0xCB, - 0xFE, 0x07, 0xF5, 0xD0, 0x8F, 0xFE, 0x18, 0xAB, 0xF6, 0xA7, 0xFF, 0x00, 0xA2, 0x29, 0xE2, 0xEF, - 0xFB, 0xE6, 0xD7, 0xFF, 0x00, 0x8E, 0xD7, 0x8D, 0xEC, 0x2A, 0x7F, 0x29, 0xB7, 0xB7, 0xA3, 0xDF, - 0xF0, 0x7F, 0xE4, 0x1F, 0xF0, 0xC5, 0x5F, 0xB5, 0x3F, 0xFD, 0x11, 0x4F, 0x17, 0x7F, 0xDF, 0x36, - 0xBF, 0xFC, 0x76, 0x8F, 0x61, 0x53, 0xF9, 0x43, 0xDB, 0xD1, 0xEF, 0xF8, 0x3F, 0xF2, 0x35, 0x34, - 0xFF, 0x00, 0xD8, 0xF7, 0xF6, 0xAB, 0xB2, 0x60, 0x0F, 0xC1, 0x6F, 0x17, 0xF9, 0x43, 0x18, 0x2A, - 0xB6, 0xA1, 0xA3, 0xC7, 0x42, 0x08, 0x97, 0xB6, 0x2B, 0xF6, 0x2F, 0x0E, 0xBC, 0x4E, 0xCC, 0x78, - 0x4A, 0x6F, 0x01, 0x98, 0xAE, 0x6C, 0x14, 0x92, 0x8B, 0xF7, 0x53, 0x71, 0x5A, 0x2D, 0x2C, 0xB6, - 0x4B, 0xEE, 0xD3, 0x46, 0xB6, 0xF3, 0xB1, 0x54, 0x30, 0xF5, 0x92, 0x95, 0x37, 0x69, 0x2F, 0x54, - 0x7E, 0xA4, 0x7C, 0x2C, 0xF0, 0xBF, 0xC6, 0x7F, 0x8A, 0x5F, 0x07, 0xEF, 0x7E, 0x00, 0xFE, 0xD4, - 0x9F, 0x0A, 0x3C, 0x77, 0x3D, 0xB5, 0xBD, 0xAB, 0x1F, 0x86, 0x3F, 0x13, 0x64, 0xB1, 0x8F, 0x50, - 0xBE, 0xF0, 0x55, 0xD4, 0x51, 0x95, 0x83, 0xED, 0x29, 0x0C, 0x9E, 0x64, 0xC8, 0x37, 0x15, 0xCB, - 0x02, 0x00, 0x20, 0xB6, 0x71, 0x5F, 0xD3, 0x9C, 0x3D, 0xC6, 0xDC, 0x1B, 0x57, 0x1B, 0x86, 0xCC, - 0xF8, 0x67, 0x1F, 0x4E, 0x9E, 0x2A, 0x32, 0x4E, 0x51, 0x92, 0x70, 0x5A, 0x6A, 0xED, 0x2A, 0x89, - 0x45, 0x37, 0x64, 0xB9, 0x61, 0x6D, 0x13, 0x5A, 0x69, 0x6F, 0xCD, 0xF3, 0x0C, 0x87, 0x31, 0xCB, - 0x31, 0x6F, 0x31, 0xC0, 0xD1, 0x95, 0x4A, 0x5D, 0x69, 0xA9, 0x5B, 0x96, 0xFB, 0xB8, 0xAB, 0xDE, - 0xCD, 0xA5, 0xCD, 0x15, 0x17, 0xD6, 0xF6, 0x4A, 0xCB, 0xE3, 0x2B, 0x2F, 0xD8, 0xCB, 0xF6, 0x96, - 0xB7, 0xF1, 0x0B, 0xE8, 0x8F, 0xF0, 0x9F, 0xC4, 0x77, 0x90, 0x49, 0x7C, 0xBA, 0x20, 0xD5, 0x2D, - 0xAC, 0x93, 0x53, 0x82, 0x44, 0x32, 0x84, 0x8E, 0x78, 0x6D, 0x92, 0x5D, 0xD2, 0xE0, 0x88, 0xD9, - 0x50, 0x2B, 0x13, 0xF2, 0x85, 0x52, 0x48, 0x07, 0xFB, 0x2A, 0x9F, 0x8C, 0x1C, 0x13, 0x89, 0xC1, - 0xC6, 0x78, 0xAC, 0xC2, 0x95, 0x3C, 0x5D, 0x38, 0x27, 0x38, 0xDA, 0x51, 0x4D, 0xB5, 0x78, 0xA5, - 0x51, 0x45, 0xD3, 0x84, 0x93, 0xB5, 0xDB, 0x6D, 0x26, 0xED, 0xA5, 0x82, 0xAE, 0x07, 0x1D, 0x3C, - 0x1A, 0xC4, 0x61, 0xA8, 0xB5, 0x24, 0x9C, 0x94, 0x3D, 0xD4, 0xEF, 0x6D, 0x62, 0xDB, 0x4D, 0xC6, - 0xFA, 0xAB, 0xA4, 0x9A, 0x5A, 0xDD, 0x6B, 0x6F, 0xE8, 0x1F, 0xC3, 0x5F, 0xB3, 0x67, 0x8E, 0xFF, - 0x00, 0xE0, 0x96, 0xBF, 0x0E, 0x7C, 0x3B, 0xA4, 0xE8, 0xFE, 0x19, 0xB7, 0xF8, 0xC9, 0xFF, 0x00, - 0x05, 0x0E, 0xF1, 0xF6, 0x8E, 0x1B, 0xC0, 0xBE, 0x2D, 0x97, 0x48, 0x17, 0x5F, 0x0B, 0x7F, 0x63, - 0x9F, 0x0F, 0xEA, 0xD1, 0x03, 0x1B, 0xC6, 0x5C, 0xB3, 0x5C, 0xF8, 0x8A, 0xE0, 0x3A, 0x91, 0x23, - 0xA0, 0x5B, 0x34, 0x72, 0xE9, 0x24, 0x52, 0x5B, 0xED, 0x97, 0xF9, 0x53, 0x36, 0xE3, 0x0C, 0x9F, - 0xC6, 0x4C, 0xEE, 0x75, 0x73, 0x27, 0x0C, 0x27, 0x0D, 0xE1, 0xAA, 0x45, 0xCA, 0x9D, 0xA4, 0xEB, - 0xE3, 0xA5, 0x09, 0x24, 0xD3, 0x95, 0xAD, 0x1A, 0x71, 0x8D, 0xEE, 0xA2, 0xEC, 0xF4, 0xE7, 0x84, - 0xF9, 0xBD, 0xCC, 0x29, 0xBC, 0xD3, 0x26, 0xCA, 0xB1, 0x15, 0xB0, 0x94, 0xEA, 0x39, 0x54, 0x51, - 0x75, 0x29, 0xC2, 0xAA, 0x70, 0x8B, 0x8A, 0x95, 0xAA, 0x72, 0xBB, 0x41, 0xCA, 0x11, 0xD5, 0x5A, - 0x17, 0x77, 0x49, 0x5E, 0xEE, 0xFF, 0x00, 0x91, 0xBE, 0x32, 0xF8, 0x37, 0xFB, 0x59, 0xDA, 0xF8, - 0x9B, 0xC4, 0x5A, 0x9C, 0x1E, 0x0B, 0xF1, 0x6F, 0x8D, 0xAE, 0x75, 0xFD, 0x5A, 0xE3, 0x56, 0xD5, - 0xBC, 0x51, 0xE2, 0x9B, 0x53, 0xAB, 0xEA, 0x9A, 0xAE, 0xA1, 0x73, 0x2E, 0xFB, 0xA2, 0x6F, 0x0D, - 0xD1, 0x79, 0xF7, 0x4B, 0x28, 0xCC, 0xD2, 0x28, 0x2D, 0x85, 0x20, 0x1D, 0xA0, 0x57, 0xEC, 0xD9, - 0x1E, 0x75, 0xE1, 0x46, 0x26, 0x82, 0xA7, 0x5A, 0xB4, 0x70, 0x94, 0x29, 0xA5, 0x18, 0x72, 0x3B, - 0x45, 0xA5, 0x75, 0x65, 0x17, 0x07, 0x64, 0x92, 0x76, 0x51, 0x6A, 0x29, 0x3B, 0x68, 0xB6, 0xFA, - 0x2E, 0x18, 0xE3, 0xEE, 0x34, 0xA5, 0x97, 0x61, 0xF0, 0x78, 0x8C, 0x14, 0x1C, 0x29, 0x45, 0x25, - 0x15, 0x68, 0xB7, 0x1F, 0xE6, 0x96, 0xBA, 0x49, 0xDD, 0xCA, 0xD7, 0xB3, 0x6D, 0xDD, 0x2B, 0xDD, - 0xF2, 0x53, 0xFC, 0x29, 0xFD, 0xAB, 0x5C, 0xB4, 0xF0, 0x7C, 0x19, 0xD7, 0xAD, 0x6E, 0xE5, 0xB9, - 0x32, 0x4D, 0x2A, 0x69, 0xB6, 0xAD, 0x1C, 0x25, 0x93, 0x25, 0x8B, 0x09, 0x10, 0x12, 0xA4, 0x9C, - 0x15, 0x63, 0xCA, 0xE4, 0x7D, 0xE1, 0x8F, 0x57, 0xEB, 0x9E, 0x15, 0x53, 0x5F, 0x57, 0xA9, 0x9C, - 0x27, 0x18, 0xC5, 0x2B, 0x25, 0x35, 0xD5, 0x59, 0x25, 0xCA, 0xDA, 0xD2, 0xD6, 0x8B, 0x8E, 0xD6, - 0x4E, 0xC8, 0xFB, 0x08, 0x78, 0x87, 0xC5, 0x0A, 0x2E, 0x1F, 0xD9, 0x94, 0xDC, 0x54, 0x5D, 0xAF, - 0x39, 0x6E, 0xB4, 0xD2, 0x29, 0xBD, 0xD5, 0x9A, 0x4F, 0x96, 0xE9, 0xA5, 0xA3, 0x5A, 0xB3, 0xC2, - 0x9F, 0xB3, 0xCF, 0xED, 0xC3, 0xE3, 0xFF, 0x00, 0x11, 0xD8, 0xF8, 0x76, 0xDB, 0xE1, 0xFE, 0xA3, - 0xE1, 0xB8, 0x6E, 0x1C, 0xCB, 0x7B, 0xAE, 0x6A, 0x16, 0x76, 0xD6, 0xDA, 0x3E, 0x83, 0x6A, 0x8C, - 0x0C, 0x97, 0x37, 0x6C, 0x8E, 0xED, 0x1C, 0x49, 0xB4, 0x92, 0xAA, 0xA4, 0x9C, 0x6D, 0x00, 0x9C, - 0x0A, 0xE6, 0xC6, 0x66, 0xFE, 0x0B, 0xE5, 0x38, 0x6F, 0xAD, 0x51, 0xC6, 0xC6, 0xBE, 0x25, 0x5F, - 0x92, 0x9A, 0xE7, 0x6E, 0x5A, 0x5A, 0xFA, 0xF2, 0xAD, 0xEC, 0xBB, 0x5E, 0xD6, 0xB3, 0x68, 0x78, - 0x8E, 0x3E, 0xE2, 0x25, 0x49, 0xB5, 0x87, 0xA7, 0x04, 0xAC, 0x9B, 0x49, 0xBE, 0x9A, 0xA4, 0xDC, - 0x9E, 0xB6, 0x5B, 0xAD, 0x56, 0xDA, 0x68, 0x7B, 0xA7, 0x8B, 0xF4, 0x3F, 0xDA, 0x17, 0xE1, 0x46, - 0x8F, 0x37, 0x80, 0x3F, 0x67, 0x9F, 0x85, 0xBE, 0x35, 0xD4, 0xF5, 0x9B, 0xCB, 0x59, 0xF4, 0x9F, - 0x88, 0x9F, 0x1E, 0x35, 0x26, 0x4B, 0x3D, 0x47, 0xC7, 0x6B, 0x2A, 0x6C, 0x96, 0xDF, 0x46, 0xB7, - 0x2F, 0x14, 0x96, 0x3A, 0x78, 0xC1, 0x00, 0x9D, 0xAE, 0xE0, 0x65, 0x80, 0xDC, 0xDB, 0xBE, 0x43, - 0x2A, 0xAD, 0xE1, 0xD6, 0x37, 0x16, 0xF3, 0x7E, 0x26, 0xC7, 0x51, 0xA6, 0xDB, 0x4E, 0x9D, 0x08, - 0xC1, 0xC9, 0x41, 0x47, 0xA4, 0xA4, 0xA2, 0xD4, 0xE7, 0x7D, 0x74, 0xBC, 0x63, 0x2B, 0x59, 0x4B, - 0x46, 0xBE, 0x5B, 0x38, 0xC7, 0x71, 0x36, 0x79, 0x08, 0x2C, 0x65, 0x69, 0x46, 0x29, 0x27, 0x18, - 0xC7, 0x96, 0x2E, 0x2D, 0x49, 0x49, 0x34, 0x95, 0xA2, 0x9A, 0x57, 0x8E, 0xB0, 0xE6, 0x69, 0xA4, - 0xDA, 0xB2, 0x8A, 0xF8, 0x3B, 0x4E, 0xFD, 0x94, 0x3F, 0x69, 0x9D, 0x3E, 0x61, 0x70, 0x3E, 0x09, - 0x6B, 0xF7, 0xB2, 0xBC, 0x32, 0x44, 0x53, 0x53, 0xB4, 0xB3, 0xBD, 0x81, 0x0B, 0x2E, 0x15, 0xA3, - 0x47, 0x90, 0xE1, 0x97, 0x2B, 0xC9, 0xCE, 0x08, 0x1E, 0x95, 0xFA, 0x55, 0x7F, 0x11, 0x7C, 0x3F, - 0x78, 0x49, 0x60, 0x70, 0xD9, 0x9D, 0x18, 0xD1, 0x49, 0x24, 0xB9, 0x67, 0xA6, 0xDD, 0xA2, 0xF4, - 0xB2, 0x7B, 0xBB, 0xBD, 0xAE, 0xA2, 0x71, 0x62, 0x70, 0x53, 0xC6, 0xC6, 0x9B, 0xC4, 0x4E, 0xAF, - 0x3A, 0xD6, 0x4D, 0x54, 0x8E, 0xB6, 0x56, 0x8A, 0x77, 0x4E, 0xF1, 0xB5, 0x93, 0x4F, 0xA2, 0xD2, - 0xCE, 0xD6, 0x4D, 0x33, 0xF6, 0x56, 0xFD, 0xAA, 0x74, 0x91, 0x2C, 0x70, 0xFC, 0x14, 0xD6, 0x6E, - 0xA1, 0x96, 0x64, 0x9D, 0xAD, 0x75, 0x1D, 0x2E, 0xC2, 0xFE, 0x04, 0x78, 0xF3, 0xB7, 0x62, 0x33, - 0xFC, 0x9C, 0xB1, 0x24, 0x2E, 0x01, 0xDA, 0xB9, 0x18, 0x5A, 0xF2, 0x71, 0x1C, 0x7B, 0xE1, 0xEB, - 0xA6, 0xD4, 0x73, 0x3A, 0x49, 0x2B, 0x3F, 0xB4, 0xEC, 0x95, 0xAC, 0xAE, 0xE0, 0xAE, 0xBF, 0x2E, - 0x89, 0x3D, 0x5E, 0x33, 0xCA, 0x7D, 0xAC, 0xA3, 0x27, 0x4D, 0xF3, 0x25, 0x64, 0xD4, 0xAC, 0xDA, - 0x6A, 0xD6, 0x6D, 0x3D, 0x74, 0xEF, 0x7E, 0xEB, 0x5D, 0x47, 0xA7, 0xEC, 0xB9, 0xFB, 0x56, 0x41, - 0x64, 0x96, 0xB6, 0x7F, 0x05, 0xB5, 0xAD, 0x3A, 0x48, 0xE6, 0x7B, 0x85, 0xD4, 0x74, 0xDB, 0x3B, - 0x3B, 0x0D, 0x4C, 0x09, 0x24, 0x0E, 0x53, 0xCF, 0x49, 0x81, 0xD8, 0x0A, 0x28, 0x0B, 0xFC, 0x20, - 0x00, 0x31, 0x8A, 0xF2, 0x6A, 0xF1, 0xEF, 0x00, 0x43, 0x9A, 0x3F, 0xDA, 0x70, 0x57, 0x6A, 0xEB, - 0x96, 0x4E, 0xFA, 0x59, 0x25, 0xEE, 0x5B, 0x6D, 0xAD, 0xAD, 0xB6, 0xD3, 0x62, 0xA6, 0x4D, 0xED, - 0x6A, 0xB9, 0x55, 0x8C, 0x9C, 0x6D, 0x67, 0x16, 0xEF, 0x06, 0xAD, 0x6B, 0x38, 0xB6, 0xD3, 0xD1, - 0xF5, 0xEB, 0xBB, 0xD1, 0x5A, 0x9D, 0xC7, 0xEC, 0xB3, 0xFB, 0x5A, 0xCD, 0x0C, 0x91, 0x37, 0xC2, - 0x9F, 0x1C, 0x01, 0x32, 0xFF, 0x00, 0xA4, 0xC8, 0x2F, 0x15, 0xA4, 0xB9, 0x0C, 0x41, 0x60, 0xE0, - 0xDC, 0x11, 0xCB, 0x80, 0x48, 0x00, 0x7C, 0xDE, 0x9D, 0x2B, 0xC4, 0xAD, 0xE2, 0x0F, 0x87, 0xB1, - 0x5C, 0x93, 0xCC, 0xA9, 0xBA, 0x6F, 0xDD, 0xE5, 0xE5, 0x97, 0x5B, 0x6F, 0x68, 0x27, 0xA2, 0x56, - 0x4D, 0xBB, 0x28, 0xDA, 0xDA, 0x1A, 0x53, 0xC9, 0xF9, 0x5D, 0xFD, 0x9A, 0x6B, 0xA2, 0xB4, 0x6C, - 0xB5, 0xBA, 0xB2, 0x49, 0x6D, 0xA7, 0x7B, 0x5B, 0x5D, 0x51, 0x97, 0x1F, 0xEC, 0x93, 0xFB, 0x5A, - 0xC0, 0x58, 0xDB, 0x7C, 0x2E, 0xF1, 0xE5, 0xBB, 0x15, 0x68, 0x4F, 0x93, 0x7D, 0x14, 0x25, 0xD5, - 0x80, 0x46, 0x43, 0x89, 0xC6, 0x41, 0x1B, 0x57, 0x1E, 0x9E, 0xC2, 0xBE, 0x5B, 0x19, 0xC7, 0xBC, - 0x03, 0x56, 0x2A, 0x94, 0x31, 0xF0, 0xB4, 0x75, 0x8A, 0x51, 0xA9, 0xB2, 0x57, 0x57, 0x4D, 0x59, - 0xD9, 0x75, 0xB2, 0xB7, 0xA2, 0x3B, 0xA1, 0x96, 0xA8, 0xC1, 0x25, 0x45, 0x72, 0xAE, 0x96, 0x8E, - 0xEB, 0xAA, 0x49, 0x7F, 0x4B, 0x63, 0x11, 0xFF, 0x00, 0x63, 0x1F, 0xDA, 0x87, 0x00, 0x8F, 0x82, - 0xFE, 0x2C, 0xC2, 0x83, 0x92, 0x16, 0xD7, 0x00, 0x0E, 0xBF, 0xF2, 0xD7, 0xB6, 0x2B, 0xE6, 0xAB, - 0x71, 0xFF, 0x00, 0x06, 0x24, 0x93, 0xC7, 0x42, 0xC9, 0x2F, 0xB3, 0x3F, 0x92, 0xB7, 0x2F, 0x9E, - 0x96, 0x5D, 0xED, 0xB3, 0x4B, 0xB1, 0x61, 0x6B, 0xBB, 0x25, 0x0D, 0x3E, 0x5D, 0x3F, 0xAF, 0xEB, - 0x42, 0x1F, 0xF8, 0x63, 0x4F, 0xDA, 0x8D, 0x0F, 0xEE, 0xFE, 0x0D, 0x78, 0xB9, 0x4F, 0x1C, 0xC7, - 0xF6, 0x55, 0x20, 0x13, 0x80, 0x09, 0x12, 0xF1, 0xCA, 0x91, 0x8F, 0x6F, 0x6A, 0xF9, 0xCC, 0x5F, - 0x1D, 0x70, 0x73, 0x72, 0x71, 0xC6, 0x45, 0xAB, 0xE9, 0x68, 0xCF, 0x6D, 0x1D, 0xAC, 0xA1, 0xDA, - 0xDA, 0x5B, 0x63, 0x78, 0xE1, 0x6B, 0x24, 0x93, 0x8E, 0xDE, 0x9F, 0x87, 0xFC, 0x0F, 0xC8, 0xEA, - 0x3C, 0x31, 0xFB, 0x1D, 0x7E, 0xD6, 0xFA, 0xAE, 0xB1, 0xA7, 0x69, 0x1F, 0xF0, 0x84, 0x78, 0xD3, - 0xC3, 0x90, 0x5E, 0x4C, 0xB6, 0xCB, 0xA9, 0x5E, 0x5E, 0x95, 0xB1, 0xB5, 0x62, 0x40, 0x51, 0x20, - 0x8A, 0x56, 0x65, 0x1C, 0x01, 0x9C, 0x60, 0x71, 0xD2, 0xBE, 0x7F, 0xFD, 0x61, 0xE0, 0xDC, 0xC3, - 0x10, 0xB0, 0x50, 0xC4, 0xD3, 0x4A, 0x56, 0xFB, 0x2D, 0x5D, 0x29, 0x46, 0xFA, 0xB8, 0xC5, 0x25, - 0xCB, 0xCC, 0xDB, 0x72, 0x49, 0x2D, 0xBA, 0x1C, 0x58, 0xBC, 0xBE, 0x94, 0x30, 0xB2, 0x75, 0x30, - 0xAA, 0xA4, 0x56, 0xAE, 0x36, 0x8B, 0xD3, 0xBD, 0x9E, 0x9A, 0x6F, 0xF2, 0xE8, 0xB5, 0x5E, 0xD3, - 0xE1, 0xAF, 0x80, 0x1F, 0xB6, 0xAF, 0x80, 0x75, 0x4B, 0x6B, 0x0B, 0x5D, 0x0F, 0xC6, 0xBA, 0x83, - 0xF8, 0x73, 0xE2, 0x14, 0x71, 0xDC, 0xCA, 0xD7, 0xD1, 0x5D, 0x69, 0x17, 0xF6, 0x4A, 0x55, 0x5E, - 0x54, 0xCB, 0x79, 0xD2, 0x44, 0x59, 0x98, 0x00, 0xAE, 0x4E, 0x06, 0xE0, 0xA0, 0x1E, 0x79, 0x5E, - 0x6D, 0xC2, 0x71, 0xE1, 0x9C, 0x56, 0x03, 0x19, 0x89, 0xA5, 0x1A, 0xB4, 0x73, 0x17, 0x3A, 0x4E, - 0x29, 0xC9, 0xBC, 0x3B, 0xA6, 0xE0, 0x9C, 0x7D, 0xD5, 0x17, 0x28, 0xC9, 0xDE, 0x50, 0x92, 0xB2, - 0xE5, 0xF7, 0xAE, 0x95, 0xA3, 0xE6, 0x4F, 0x2D, 0x4A, 0xAC, 0x1E, 0x1F, 0x08, 0xA3, 0x09, 0x51, - 0xB7, 0xBA, 0xB4, 0x52, 0x4E, 0xF1, 0x8B, 0x49, 0x72, 0xC7, 0x4B, 0xD9, 0xF5, 0x6D, 0xA5, 0x7D, - 0x19, 0x53, 0xC4, 0x3E, 0x0D, 0xFF, 0x00, 0x82, 0x83, 0xDA, 0x78, 0x8B, 0x58, 0x6D, 0x2B, 0xC2, - 0xBE, 0x2D, 0xBB, 0xB3, 0x3A, 0x9C, 0xD3, 0x5A, 0xCF, 0x6B, 0x61, 0x63, 0x3D, 0x91, 0x8E, 0x47, - 0xDE, 0x89, 0x17, 0x9A, 0x77, 0x61, 0x41, 0x03, 0xE6, 0xC9, 0x1D, 0x33, 0xC5, 0x7E, 0x67, 0x8F, - 0xAB, 0xC1, 0x34, 0xEA, 0x4A, 0x32, 0xAF, 0x79, 0x73, 0x36, 0xDF, 0xBC, 0xEF, 0x6B, 0xE9, 0x64, - 0xAC, 0x96, 0xDC, 0xC9, 0x2E, 0x5B, 0xDD, 0x47, 0x45, 0xAF, 0xB5, 0x82, 0xCA, 0x94, 0x30, 0x90, - 0x55, 0x20, 0xD3, 0xE5, 0x57, 0x5A, 0xAB, 0x3B, 0x2B, 0xE9, 0xA5, 0xAD, 0xB2, 0x5E, 0x47, 0xA5, - 0xFC, 0x3A, 0xB3, 0xFD, 0xB9, 0xB4, 0xCD, 0x27, 0x5C, 0xD6, 0xBC, 0x57, 0xF0, 0xC7, 0x5A, 0xD5, - 0xE2, 0xD1, 0xF5, 0x7D, 0x2A, 0x54, 0xF0, 0xC3, 0x69, 0x36, 0x70, 0x5D, 0xF8, 0x82, 0x09, 0x0C, - 0x82, 0xE0, 0xC7, 0x20, 0x73, 0x1A, 0xF9, 0x60, 0x46, 0xD9, 0x6D, 0xBC, 0x1E, 0x33, 0x92, 0x06, - 0x9C, 0x3D, 0xC4, 0x5C, 0x37, 0x94, 0xE5, 0xB9, 0xA4, 0xE8, 0x54, 0xFD, 0xF2, 0xAD, 0x85, 0xA9, - 0x49, 0x72, 0xC9, 0x45, 0xD3, 0x83, 0x92, 0xAB, 0x77, 0x67, 0xB5, 0xD7, 0x2C, 0x53, 0x8B, 0x6D, - 0x75, 0xD2, 0xDE, 0x5E, 0x69, 0x91, 0x57, 0xC4, 0xD5, 0xA3, 0x4B, 0x0A, 0x9A, 0x87, 0x24, 0xD4, - 0xA4, 0xDA, 0xD1, 0xD9, 0x38, 0xF6, 0x96, 0xBB, 0x5E, 0x29, 0xD9, 0x36, 0xAC, 0x91, 0x06, 0x9D, - 0x37, 0xED, 0x85, 0x19, 0x57, 0xBC, 0xFD, 0x9F, 0x3C, 0x50, 0x64, 0x69, 0x67, 0x73, 0x1D, 0x96, - 0x9B, 0xA5, 0x2C, 0x69, 0x13, 0x37, 0xEE, 0x02, 0x31, 0x91, 0x4E, 0x54, 0x10, 0x1B, 0xA0, 0xF4, - 0xEB, 0xC7, 0xCC, 0xCF, 0x17, 0xC3, 0x70, 0x6A, 0x4B, 0x15, 0x52, 0x49, 0xAE, 0x69, 0x59, 0xD9, - 0x5D, 0xB6, 0xED, 0x14, 0xE1, 0x65, 0x6B, 0x6B, 0x76, 0xFA, 0x25, 0x75, 0x76, 0x77, 0xC7, 0x25, - 0xE5, 0x51, 0x54, 0x92, 0x4A, 0xCA, 0xEA, 0xCD, 0x59, 0xA5, 0xD2, 0xC9, 0xDD, 0x37, 0xDD, 0x26, - 0x97, 0x7D, 0x0D, 0x19, 0x75, 0x4F, 0xDB, 0x58, 0x0B, 0x58, 0xB4, 0xBF, 0xD9, 0xC3, 0x5C, 0x9A, - 0x34, 0x85, 0xBE, 0xD0, 0x75, 0x38, 0x6D, 0xA2, 0xF9, 0xC8, 0x1B, 0x44, 0x62, 0x3B, 0x8C, 0x60, - 0x0E, 0xC7, 0x9A, 0xF6, 0x72, 0xAC, 0xB7, 0x86, 0x33, 0x5A, 0xF0, 0xA3, 0x2C, 0x45, 0x58, 0xB7, - 0x16, 0xDB, 0x6A, 0x09, 0x37, 0x18, 0xB7, 0x64, 0xDA, 0x82, 0x57, 0xB3, 0xF7, 0x5B, 0xBD, 0xAC, - 0xB7, 0x57, 0x2E, 0x79, 0x5D, 0x7A, 0x71, 0x4E, 0x12, 0x4B, 0x6D, 0x2D, 0x7E, 0xDB, 0x2B, 0xA6, - 0xB4, 0xD2, 0xFA, 0xFA, 0x25, 0xA0, 0xE8, 0x35, 0xCF, 0xDB, 0x41, 0x2D, 0xEE, 0x3E, 0xD3, 0xFB, - 0x2F, 0xDF, 0x49, 0x20, 0xDA, 0xB6, 0xD1, 0xAC, 0xB1, 0x34, 0x72, 0xB3, 0x30, 0xDC, 0xAE, 0xDE, - 0x78, 0xDB, 0xF2, 0x9C, 0x83, 0x86, 0x07, 0x81, 0x81, 0x9C, 0x8F, 0x26, 0xAD, 0x0E, 0x1D, 0xA3, - 0xC9, 0x37, 0x56, 0xA4, 0xA0, 0xEC, 0xD2, 0x4A, 0x29, 0xDA, 0xF6, 0xF7, 0x6F, 0x2B, 0x5E, 0xEB, - 0x76, 0xD5, 0x92, 0xBD, 0xAC, 0x8D, 0xBF, 0xB2, 0xAA, 0x37, 0x18, 0xDF, 0x47, 0xA5, 0xF6, 0xB2, - 0x49, 0xDB, 0x44, 0xAC, 0xF6, 0x4B, 0x4B, 0x77, 0xEC, 0x89, 0xE2, 0xD7, 0xBF, 0x6C, 0xA5, 0xE1, - 0xBF, 0x65, 0x0D, 0x46, 0x28, 0xCC, 0x04, 0xC4, 0xB1, 0x6A, 0xF0, 0xE4, 0xB0, 0x18, 0x48, 0xD8, - 0x19, 0x38, 0xE7, 0xA9, 0xC7, 0x00, 0xD7, 0x1E, 0x2D, 0xE4, 0x90, 0x49, 0xE0, 0x69, 0xD7, 0xE5, - 0xB6, 0x89, 0xCA, 0x83, 0x77, 0xFF, 0x00, 0xB7, 0x65, 0xA2, 0x4A, 0xDB, 0xA5, 0x6E, 0xD6, 0xB0, - 0xD6, 0x52, 0xF6, 0xE6, 0x76, 0xDB, 0x45, 0x64, 0xBC, 0xFE, 0x1D, 0x52, 0xD3, 0x4D, 0xDE, 0xD7, - 0xDA, 0xDE, 0x37, 0xF1, 0x73, 0xC0, 0x7F, 0xB5, 0xFF, 0x00, 0xC5, 0x5D, 0x1E, 0x3B, 0x0B, 0xDF, - 0xD9, 0xCF, 0x58, 0xD2, 0x06, 0xD5, 0x42, 0x6D, 0xAE, 0x21, 0xBA, 0x95, 0x48, 0x60, 0xC5, 0x46, - 0xE9, 0x02, 0xFF, 0x00, 0x08, 0xE7, 0xA7, 0x6E, 0xBD, 0x3E, 0x97, 0x0F, 0x5F, 0x86, 0x72, 0x4C, - 0xA6, 0x95, 0x78, 0x62, 0xDD, 0x5A, 0xD5, 0x21, 0x17, 0x3A, 0x4D, 0x72, 0x3A, 0x72, 0x69, 0x2E, - 0x55, 0x26, 0x9C, 0x24, 0x96, 0xD7, 0x8B, 0xB6, 0x9A, 0x6C, 0xCF, 0x32, 0x7C, 0x35, 0xED, 0x73, - 0x5A, 0x39, 0x85, 0x49, 0xBE, 0x5A, 0x5C, 0xDC, 0xA9, 0x2D, 0x1F, 0x32, 0xE5, 0x57, 0x7B, 0xD9, - 0x2B, 0x24, 0x92, 0x5D, 0x3A, 0x1D, 0xF7, 0x82, 0x47, 0xED, 0x57, 0xE0, 0xDF, 0x03, 0xAE, 0x83, - 0x17, 0xEC, 0xBF, 0xE2, 0x9B, 0xED, 0x6E, 0xCA, 0xE2, 0x2F, 0xB3, 0x5E, 0xB6, 0xA5, 0x6D, 0x6F, - 0xA5, 0xC9, 0x6E, 0x10, 0x09, 0x51, 0xE0, 0x04, 0xB8, 0x93, 0x76, 0xD2, 0x18, 0x30, 0x5C, 0x64, - 0x11, 0xEB, 0xE0, 0xF1, 0x0E, 0x6B, 0xC2, 0xD8, 0xF9, 0xAC, 0x46, 0x57, 0x3A, 0xB1, 0x94, 0x62, - 0xF9, 0xA3, 0x34, 0xA4, 0xA5, 0x25, 0xB2, 0x87, 0x2C, 0x52, 0x4B, 0xB3, 0x95, 0xBE, 0x57, 0x49, - 0x4E, 0x57, 0xC3, 0x71, 0xCB, 0x29, 0x3C, 0x32, 0xA9, 0xCD, 0x07, 0x26, 0xD3, 0x6B, 0x54, 0x9B, - 0x6E, 0xCF, 0xA3, 0x4B, 0xC9, 0x27, 0xB6, 0x87, 0xD4, 0xFF, 0x00, 0x09, 0x3E, 0x0A, 0x7E, 0xD9, - 0xDF, 0x16, 0x3E, 0x1E, 0x78, 0xB3, 0xE2, 0x19, 0xF0, 0x27, 0x82, 0x7E, 0x1D, 0xC1, 0xE1, 0x0B, - 0x99, 0xED, 0x2E, 0xBC, 0x39, 0xE2, 0xD5, 0xD5, 0xEE, 0xB5, 0x5B, 0xF5, 0x8A, 0xCB, 0xCE, 0x8E, - 0x58, 0x66, 0xB5, 0xB6, 0x92, 0x00, 0x24, 0x60, 0x22, 0x55, 0x67, 0x04, 0x36, 0x09, 0x01, 0x4D, - 0x7C, 0xBA, 0xAE, 0xAA, 0x51, 0x95, 0x6C, 0x34, 0x63, 0xC9, 0x1D, 0xD4, 0x9A, 0x8C, 0xAD, 0xA6, - 0xAA, 0x36, 0x77, 0x8E, 0xA9, 0x2E, 0xBE, 0x5A, 0x5C, 0xF6, 0x16, 0x53, 0x47, 0x48, 0xA9, 0xBD, - 0x7E, 0x5F, 0x24, 0xBC, 0xAD, 0xD2, 0xD6, 0xFC, 0x17, 0x90, 0xFC, 0x2A, 0xF8, 0xF1, 0xFF, 0x00, - 0x05, 0x25, 0xF8, 0x1F, 0xE3, 0x7D, 0x23, 0xE2, 0x2F, 0xC3, 0x2F, 0x81, 0x17, 0xBE, 0x1C, 0xF1, - 0x0D, 0x8D, 0xBB, 0xD9, 0x5C, 0x21, 0x78, 0xEF, 0x74, 0xED, 0x7A, 0xC6, 0xE5, 0x76, 0xDE, 0x69, - 0x5A, 0x9D, 0xA9, 0x98, 0x47, 0x73, 0x65, 0x3C, 0x65, 0x92, 0x5B, 0x79, 0x55, 0x91, 0x94, 0x9C, - 0x8C, 0x1C, 0x57, 0x4C, 0xEA, 0x61, 0x29, 0xE1, 0xE9, 0xD5, 0x55, 0xE3, 0xED, 0x1A, 0x4F, 0x95, - 0x6B, 0xCA, 0xEC, 0xAD, 0x19, 0x5A, 0x3A, 0x6B, 0xBA, 0xBF, 0x46, 0xD3, 0xE8, 0x4C, 0x72, 0xB5, - 0x4A, 0x49, 0xAA, 0x9E, 0xEF, 0x9C, 0x5B, 0xBA, 0xF9, 0x49, 0x59, 0x76, 0x56, 0x5E, 0x5D, 0x2D, - 0xF7, 0x57, 0xED, 0x1B, 0xF0, 0x9F, 0xE2, 0x8F, 0xC6, 0x9F, 0x83, 0x1A, 0x8F, 0xED, 0x87, 0xFB, - 0x1D, 0x7C, 0x16, 0xBA, 0xF0, 0x3D, 0xD6, 0x9F, 0x1C, 0x36, 0x9F, 0xB4, 0x7F, 0xEC, 0x85, 0xAD, - 0xE9, 0x12, 0x6A, 0x3A, 0x97, 0xC0, 0x7D, 0x56, 0xF9, 0x0A, 0xDB, 0x6B, 0x5E, 0x17, 0xD4, 0x84, - 0x8A, 0x35, 0x1D, 0x06, 0xEE, 0x68, 0x26, 0x65, 0x5C, 0x17, 0xB5, 0x3B, 0xCC, 0xBE, 0x4C, 0x61, - 0x11, 0x7D, 0xBE, 0x1A, 0xCD, 0x72, 0x3C, 0x0F, 0xD6, 0xEB, 0x66, 0x33, 0x77, 0x95, 0x0A, 0xB0, - 0x82, 0x8A, 0x6A, 0xD5, 0x64, 0xAD, 0x4B, 0x97, 0x7B, 0xC6, 0xFA, 0x36, 0xD4, 0x52, 0x5E, 0xF5, - 0xD3, 0xF7, 0x4E, 0x2C, 0x46, 0x59, 0xED, 0x2B, 0x28, 0x4E, 0x2D, 0x46, 0x4F, 0x46, 0xB9, 0x6D, - 0x65, 0x6B, 0xA7, 0x17, 0x14, 0x96, 0x9A, 0xD9, 0x75, 0x69, 0x45, 0x1F, 0x90, 0xF7, 0x30, 0xFF, - 0x00, 0xC1, 0x44, 0x6E, 0x31, 0xE5, 0xFC, 0x21, 0xBF, 0xB5, 0x50, 0xA0, 0x6D, 0x83, 0x45, 0xB4, - 0xC1, 0xC0, 0xF7, 0xB8, 0x3D, 0x78, 0xAF, 0x83, 0x79, 0x9E, 0x35, 0xC5, 0x46, 0x34, 0xE2, 0x97, - 0xA7, 0xA5, 0xBA, 0xF4, 0x6A, 0xEB, 0xFC, 0xB4, 0x3D, 0x3A, 0x59, 0x26, 0x55, 0x4D, 0x5B, 0x99, - 0xDF, 0xA6, 0xEA, 0xDF, 0x72, 0xFF, 0x00, 0x81, 0xF7, 0x23, 0xD3, 0xBE, 0x18, 0x6B, 0xFF, 0x00, - 0xB7, 0x25, 0x9B, 0xA7, 0x83, 0xBE, 0x31, 0x7C, 0x19, 0xF1, 0x97, 0x8C, 0x3E, 0x17, 0xDF, 0x07, - 0x87, 0xC8, 0xD3, 0x6C, 0xEC, 0x6C, 0xBC, 0x49, 0xE0, 0x39, 0xA5, 0xC8, 0x3A, 0xA6, 0x89, 0x38, - 0x94, 0x1F, 0x31, 0x0B, 0x06, 0x68, 0x18, 0x98, 0xE5, 0x0A, 0x54, 0x85, 0x27, 0x70, 0xDA, 0x86, - 0x6F, 0x8D, 0x52, 0xE5, 0xC4, 0xC5, 0xBA, 0x69, 0x5A, 0xC9, 0xDB, 0xB6, 0xD7, 0x7E, 0x56, 0xD7, - 0xBB, 0xB7, 0x44, 0x6D, 0x1C, 0xA7, 0x2B, 0x85, 0x17, 0x4D, 0xB7, 0x24, 0xD6, 0xCF, 0x4B, 0x7A, - 0x59, 0x2B, 0x69, 0xDA, 0xCB, 0x6E, 0xCA, 0xDE, 0x6D, 0xF1, 0x8F, 0xF6, 0x67, 0xFD, 0xBA, 0x7C, - 0x2B, 0xAD, 0x45, 0x2F, 0x84, 0xAE, 0x7C, 0x75, 0xF1, 0x13, 0xC0, 0x9A, 0xD4, 0x6D, 0x77, 0xE1, - 0x5F, 0x15, 0xE8, 0xB6, 0xF0, 0xE8, 0x4F, 0x2C, 0x41, 0xF8, 0xB7, 0xBF, 0xB4, 0x6D, 0x8F, 0x05, - 0xD2, 0x0C, 0xAB, 0xC6, 0x72, 0x32, 0x19, 0x94, 0xB2, 0x90, 0x4A, 0xAD, 0x8E, 0xCC, 0xE8, 0xCA, - 0x2E, 0x8D, 0x44, 0xE9, 0xDE, 0xE9, 0x59, 0x6C, 0xAD, 0xA6, 0x96, 0xB2, 0x5B, 0x69, 0xD3, 0x45, - 0x6D, 0x05, 0x0C, 0x9F, 0x26, 0xF6, 0x3C, 0x95, 0xA8, 0xEB, 0x6B, 0x27, 0xCD, 0x25, 0x65, 0x65, - 0x6B, 0xDB, 0x7D, 0x2E, 0xB9, 0x6F, 0xA3, 0xD7, 0x54, 0x8F, 0x2A, 0xF0, 0xE7, 0xC2, 0x7F, 0xF8, - 0x28, 0x17, 0x85, 0x5F, 0x58, 0x9F, 0x46, 0xF0, 0x67, 0xC4, 0xA8, 0xAE, 0xF5, 0xFF, 0x00, 0x0F, - 0x5F, 0xF8, 0x57, 0x55, 0xBA, 0xB9, 0xBC, 0x82, 0xFA, 0x5B, 0x8B, 0x0D, 0x4A, 0x25, 0x4B, 0xA8, - 0x00, 0x92, 0x76, 0x55, 0xCA, 0xA7, 0x0C, 0xA0, 0x32, 0xEE, 0x6C, 0x11, 0x93, 0x99, 0xFE, 0xD6, - 0xCC, 0x7E, 0xAE, 0xA8, 0xDB, 0xDE, 0xBB, 0x69, 0xE8, 0xAC, 0xAC, 0xAC, 0x92, 0x56, 0x5A, 0x35, - 0x77, 0x7B, 0xDF, 0x4D, 0x34, 0x46, 0xD0, 0xCB, 0xF2, 0xBA, 0x72, 0x52, 0xA3, 0x05, 0x17, 0x64, - 0x9D, 0xA3, 0xAB, 0x4B, 0xA3, 0xBA, 0x77, 0x4F, 0x66, 0xB6, 0xB1, 0xE4, 0xD3, 0x7E, 0xC6, 0xBF, - 0xB5, 0x8D, 0xC1, 0xCC, 0xFF, 0x00, 0x07, 0x7C, 0x6B, 0x39, 0xC6, 0x33, 0x34, 0x96, 0xF2, 0x1C, - 0x63, 0xA6, 0x4C, 0xD5, 0xE5, 0x4B, 0xEB, 0x73, 0x4A, 0x32, 0x94, 0x9A, 0xF3, 0x7F, 0xF0, 0x4E, - 0xEA, 0x7F, 0x52, 0xA4, 0x92, 0xA7, 0x18, 0xA5, 0xE5, 0x1B, 0x7E, 0x48, 0xAF, 0xFF, 0x00, 0x0C, - 0x55, 0xFB, 0x53, 0xFF, 0x00, 0xD1, 0x14, 0xF1, 0x77, 0xFD, 0xF3, 0x6B, 0xFF, 0x00, 0xC7, 0x6B, - 0x1F, 0x61, 0x53, 0xF9, 0x4D, 0x7D, 0xBD, 0x1E, 0xFF, 0x00, 0x83, 0xFF, 0x00, 0x20, 0xFF, 0x00, - 0x86, 0x2A, 0xFD, 0xA9, 0xFF, 0x00, 0xE8, 0x8A, 0x78, 0xBB, 0xFE, 0xF9, 0xB5, 0xFF, 0x00, 0xE3, - 0xB4, 0x7B, 0x0A, 0x9F, 0xCA, 0x1E, 0xDE, 0x8F, 0x7F, 0xC1, 0xFF, 0x00, 0x90, 0x7F, 0xC3, 0x15, - 0x7E, 0xD4, 0xFF, 0x00, 0xF4, 0x45, 0x3C, 0x5D, 0xFF, 0x00, 0x7C, 0xDA, 0xFF, 0x00, 0xF1, 0xDA, - 0x3D, 0x85, 0x4F, 0xE5, 0x0F, 0x6F, 0x47, 0xBF, 0xE0, 0xFF, 0x00, 0xC8, 0x3F, 0xE1, 0x8A, 0xBF, - 0x6A, 0x7F, 0xFA, 0x22, 0x9E, 0x2E, 0xFF, 0x00, 0xBE, 0x6D, 0x7F, 0xF8, 0xED, 0x1E, 0xC2, 0xA7, - 0xF2, 0x87, 0xB7, 0xA3, 0xDF, 0xF0, 0x7F, 0xE4, 0x3E, 0x2F, 0xD8, 0xA3, 0xF6, 0xA5, 0x77, 0x44, - 0x6F, 0x83, 0x1E, 0x2A, 0x85, 0x49, 0x00, 0xC8, 0xEB, 0x6D, 0xB2, 0x30, 0x07, 0x24, 0x85, 0x94, - 0x9E, 0xDD, 0x81, 0xAD, 0x21, 0x4A, 0x5C, 0xAA, 0x9C, 0xA0, 0x92, 0x6D, 0x6A, 0xEE, 0x9A, 0x4B, - 0xA6, 0x9A, 0x24, 0xFD, 0x1E, 0xCB, 0xA6, 0x84, 0xBA, 0xF4, 0x56, 0xB7, 0xD1, 0x74, 0x49, 0xFF, - 0x00, 0x91, 0xD4, 0xEB, 0xDF, 0xB1, 0x77, 0xED, 0x1B, 0x62, 0xB6, 0x3A, 0x66, 0x81, 0xF0, 0x97, - 0xC4, 0xBA, 0xCD, 0xBD, 0xBD, 0xB8, 0x96, 0x7D, 0x5E, 0x2D, 0x31, 0x74, 0xC6, 0xB8, 0x92, 0x4E, - 0x5A, 0x26, 0x8A, 0x59, 0xB2, 0x7C, 0xB2, 0x0A, 0x86, 0x00, 0x02, 0x30, 0x47, 0xBF, 0xDB, 0x50, - 0xE2, 0x8A, 0xB9, 0x6E, 0x55, 0x1C, 0xAF, 0x2D, 0x83, 0x71, 0xBE, 0xBC, 0xD6, 0xB3, 0xB6, 0x89, - 0xAB, 0x59, 0xAB, 0x2B, 0x2B, 0x5A, 0xDB, 0x6B, 0xEE, 0xA4, 0x71, 0x42, 0x95, 0x19, 0x55, 0x95, - 0x79, 0x4D, 0xEB, 0xD1, 0xAD, 0x12, 0x5B, 0x59, 0x6B, 0x6B, 0xF5, 0xDB, 0xB5, 0xB4, 0x39, 0x33, - 0xFB, 0x15, 0xFE, 0xD4, 0xE7, 0x9F, 0xF8, 0x52, 0xBE, 0x2E, 0xFF, 0x00, 0xBE, 0x6D, 0x7D, 0x38, - 0x00, 0x79, 0xDE, 0xC2, 0xBE, 0x32, 0xBB, 0xC4, 0xE2, 0x6A, 0xCA, 0xB5, 0x54, 0xDC, 0x9F, 0xF5, - 0x65, 0xE4, 0xB6, 0x4B, 0xA2, 0xD0, 0xEE, 0x85, 0x5A, 0x10, 0x8A, 0x8A, 0x7A, 0x2F, 0x2F, 0xF8, - 0x01, 0xFF, 0x00, 0x0C, 0x55, 0xFB, 0x53, 0xFF, 0x00, 0xD1, 0x14, 0xF1, 0x77, 0xFD, 0xF3, 0x6B, - 0xFF, 0x00, 0xC7, 0x6B, 0x0F, 0x61, 0x53, 0xF9, 0x47, 0xED, 0xE8, 0xF7, 0xFC, 0x1F, 0xF9, 0x02, - 0xFE, 0xC5, 0x3F, 0xB5, 0x39, 0x2A, 0xAB, 0xF0, 0x53, 0xC5, 0xD9, 0x38, 0x0A, 0x02, 0xDA, 0xFA, - 0x70, 0x00, 0xF3, 0x7D, 0xAA, 0xA1, 0x86, 0xA9, 0x29, 0x46, 0x16, 0xB5, 0xEC, 0xB5, 0xB2, 0x4B, - 0xA7, 0xF5, 0xE4, 0x1E, 0xDE, 0x8A, 0x49, 0x27, 0xF8, 0x3F, 0xF2, 0x3B, 0x4D, 0x2B, 0xF6, 0x21, - 0xFD, 0xA7, 0x6D, 0xA1, 0x43, 0x27, 0xC1, 0x9F, 0x16, 0x23, 0x30, 0x0E, 0xE0, 0xAD, 0xA9, 0xC6, - 0x00, 0xE9, 0xFB, 0xDE, 0xD9, 0x1F, 0x4A, 0xFE, 0xDF, 0xF0, 0x73, 0x07, 0xE1, 0xDE, 0x41, 0x91, - 0xD2, 0xC4, 0xE2, 0xF3, 0x08, 0x46, 0xAC, 0x9C, 0x5D, 0x45, 0xCB, 0x26, 0xD4, 0x9A, 0xB2, 0xB7, - 0xBB, 0x76, 0xB4, 0xB7, 0xBA, 0xAD, 0xA7, 0xDF, 0xF3, 0x98, 0xF9, 0xE2, 0x6A, 0x54, 0x71, 0x8C, - 0x34, 0xD9, 0x6D, 0xF7, 0x7E, 0x1B, 0x76, 0x47, 0x48, 0xBF, 0xB1, 0xDF, 0xED, 0x2F, 0x6A, 0x9E, - 0x6B, 0xFC, 0x19, 0xF1, 0x6B, 0x2C, 0x63, 0x6E, 0xD4, 0x8E, 0xD1, 0x8A, 0x92, 0xBF, 0x29, 0xDA, - 0x64, 0x20, 0x81, 0x8C, 0x9E, 0x3A, 0x0A, 0xFE, 0x9C, 0xCD, 0x7C, 0x59, 0xF0, 0xD3, 0x87, 0x72, - 0x9F, 0x6C, 0xB3, 0x28, 0x4A, 0x6E, 0x29, 0x45, 0x28, 0xD4, 0x6D, 0x5E, 0xC9, 0x4F, 0xDD, 0x8D, - 0xFD, 0xCD, 0x65, 0xBA, 0xBF, 0x2D, 0x92, 0x68, 0xF2, 0xF0, 0xF8, 0x2C, 0x44, 0xEB, 0x24, 0xE0, - 0xED, 0xE5, 0x6E, 0xDB, 0x6A, 0x9A, 0xED, 0xA5, 0xBE, 0xE3, 0x90, 0x97, 0xF6, 0x37, 0xFD, 0xA9, - 0xE5, 0x95, 0xA4, 0x6F, 0x82, 0xFE, 0x30, 0x56, 0x97, 0xF7, 0x45, 0xB6, 0xDB, 0x61, 0x63, 0x07, - 0x02, 0x6D, 0x9E, 0x6F, 0xD0, 0x00, 0x31, 0x8A, 0xFE, 0x2D, 0xCF, 0x3C, 0x44, 0xFE, 0xDD, 0xE2, - 0x58, 0xE7, 0x0F, 0x32, 0xF6, 0x70, 0xAC, 0xEA, 0xD0, 0xAB, 0x78, 0xD5, 0x9F, 0x35, 0x08, 0xA6, - 0xE1, 0x8E, 0x51, 0x4A, 0xCB, 0x95, 0x45, 0xDA, 0x9A, 0x8F, 0x3A, 0x4D, 0xDE, 0xCA, 0x37, 0x3D, - 0xBA, 0x78, 0x5F, 0x65, 0x4E, 0x34, 0xD4, 0x55, 0x92, 0xE6, 0x4A, 0xCB, 0x7B, 0x2F, 0x76, 0xFA, - 0x5B, 0xF2, 0x7A, 0x24, 0x49, 0x6B, 0xFB, 0x1A, 0x7E, 0xD4, 0x71, 0x8B, 0x58, 0x8F, 0xC1, 0xDF, - 0x1B, 0x47, 0x1D, 0xBC, 0xE1, 0xF1, 0x11, 0xB6, 0x12, 0xC6, 0x49, 0x01, 0xA5, 0x45, 0x32, 0xE0, - 0x96, 0x05, 0x06, 0x39, 0xC0, 0xC5, 0x63, 0x82, 0xE2, 0xBE, 0x1D, 0xA1, 0x94, 0x61, 0x30, 0x78, - 0x0C, 0xC9, 0xD3, 0xAB, 0x4A, 0xAF, 0x32, 0x9B, 0xF6, 0xD3, 0x9C, 0x1C, 0x54, 0xB9, 0xF1, 0x5E, - 0xCD, 0x46, 0xD5, 0x3E, 0xB1, 0x1E, 0x58, 0xBA, 0x49, 0xB7, 0x49, 0x2B, 0xD9, 0x37, 0x63, 0x49, - 0x47, 0x18, 0xAE, 0xE8, 0xAD, 0x52, 0xF7, 0x56, 0xC9, 0x5D, 0x2D, 0x34, 0x69, 0xAB, 0x77, 0x56, - 0xBA, 0xF2, 0x1B, 0xA2, 0xFE, 0xC7, 0xFF, 0x00, 0xB5, 0x45, 0xBC, 0xE2, 0xD1, 0xFE, 0x0A, 0xF8, - 0xA4, 0xDB, 0xEE, 0x67, 0x69, 0x59, 0x2D, 0x54, 0x82, 0x4F, 0x20, 0x9F, 0x3B, 0xDE, 0xBE, 0x9B, - 0xC0, 0xCF, 0x19, 0xBF, 0xD5, 0x8C, 0xF2, 0x8F, 0x06, 0xE3, 0xE7, 0x45, 0xE5, 0xD3, 0xA9, 0x39, - 0x7B, 0x69, 0xC6, 0x51, 0x97, 0x35, 0x49, 0xCA, 0x4D, 0x49, 0xDB, 0x5D, 0x5D, 0xD3, 0xB2, 0x4B, - 0x45, 0xBA, 0x39, 0xB3, 0x0C, 0x0C, 0x2B, 0x41, 0xD5, 0xA7, 0x7E, 0x74, 0xB6, 0x5B, 0x59, 0x24, - 0xBD, 0x11, 0xD5, 0xCF, 0xFB, 0x18, 0x7E, 0xD3, 0x4E, 0xB2, 0xC2, 0xDF, 0x06, 0x7C, 0x56, 0x23, - 0x64, 0x11, 0x3F, 0xCD, 0x68, 0xD1, 0xE0, 0x9C, 0x00, 0x3F, 0x7B, 0xEC, 0x31, 0xED, 0xED, 0x5F, - 0xD6, 0x79, 0xF7, 0x1D, 0xF8, 0x61, 0x9B, 0xC3, 0x13, 0x90, 0x55, 0xCC, 0x23, 0xEC, 0xAB, 0xC5, - 0xD1, 0x9A, 0x6D, 0xCA, 0x0D, 0x3B, 0x49, 0xD9, 0x28, 0x68, 0xD5, 0x95, 0xDB, 0xDB, 0x6B, 0xDF, - 0x43, 0xC4, 0xA3, 0x87, 0xC5, 0x53, 0xE5, 0xA8, 0xA3, 0xAA, 0xDB, 0x6E, 0xDF, 0x75, 0xBF, 0x0E, - 0x85, 0x0B, 0x4F, 0xD8, 0xDF, 0xF6, 0xA2, 0x0D, 0xF6, 0x39, 0x3E, 0x0C, 0xF8, 0xB3, 0xF7, 0x20, - 0x24, 0x6E, 0x12, 0xDB, 0x12, 0xA6, 0x7E, 0x42, 0xC7, 0xCD, 0xC0, 0xF4, 0xC7, 0xB5, 0x7C, 0x07, - 0x08, 0xF8, 0xA5, 0xC3, 0x18, 0x4C, 0x45, 0x5E, 0x0E, 0xCE, 0xB3, 0x18, 0xF3, 0x61, 0x14, 0xA3, - 0x09, 0xA5, 0x36, 0xAB, 0x51, 0x8A, 0xE6, 0x84, 0xE5, 0x25, 0x0E, 0x55, 0x28, 0xC6, 0xD0, 0xE5, - 0xBB, 0x6F, 0x97, 0x6D, 0x51, 0xD5, 0x5F, 0x07, 0x55, 0xC6, 0x35, 0xE9, 0xC3, 0x47, 0x6B, 0xAD, - 0x15, 0x9D, 0xB5, 0x4B, 0xBF, 0xCB, 0x62, 0x76, 0xFD, 0x8D, 0xBF, 0x69, 0xD0, 0x31, 0xFF, 0x00, - 0x0A, 0x6B, 0xC5, 0x43, 0x68, 0x1F, 0x2E, 0x2D, 0x46, 0x30, 0x3A, 0x63, 0xCD, 0x1D, 0xB1, 0xC7, - 0xA6, 0x2B, 0xE8, 0xEB, 0x78, 0x9F, 0xC0, 0x73, 0x84, 0x79, 0x33, 0x08, 0xF4, 0x4A, 0xD1, 0xA9, - 0xE9, 0x67, 0x68, 0xAF, 0x4B, 0x37, 0xF3, 0xDC, 0xCE, 0x38, 0x2C, 0x4A, 0x4B, 0xDC, 0xD3, 0xE5, - 0xFD, 0x7C, 0xAD, 0xB7, 0x90, 0xC3, 0xFB, 0x19, 0xFE, 0xD3, 0xF9, 0x20, 0x7C, 0x19, 0xF1, 0x57, - 0xCB, 0x90, 0x57, 0xFD, 0x10, 0x30, 0x00, 0xE3, 0x21, 0x7C, 0xEE, 0x9E, 0xF8, 0xC7, 0x07, 0xD3, - 0x8F, 0x23, 0x11, 0xE2, 0x5F, 0x03, 0x2F, 0x7D, 0x66, 0x10, 0xB3, 0x5A, 0x7B, 0xB3, 0xEB, 0xE4, - 0xA1, 0xA5, 0xBB, 0x5A, 0x36, 0x56, 0xD1, 0x68, 0x5A, 0xC2, 0xD6, 0x51, 0xD2, 0x3A, 0x2F, 0x4E, - 0x8B, 0xB7, 0xF5, 0xDB, 0xC8, 0x83, 0xFE, 0x18, 0xCB, 0xF6, 0xA1, 0x24, 0x2A, 0xFC, 0x18, 0xF1, - 0x6F, 0xCA, 0x07, 0xCB, 0xB2, 0xDB, 0x80, 0x46, 0x47, 0x1E, 0x6F, 0x70, 0x2B, 0xE7, 0xAB, 0x78, - 0x8F, 0xC1, 0x13, 0x92, 0x8C, 0x71, 0xF0, 0xB6, 0xAB, 0xE1, 0x9F, 0x7E, 0x96, 0x8A, 0x5D, 0x35, - 0xED, 0xA7, 0x95, 0xF5, 0x8E, 0x13, 0x11, 0x15, 0xF0, 0x69, 0xA7, 0x6F, 0xEB, 0xFE, 0x1A, 0xC2, - 0xAF, 0xEC, 0x65, 0xFB, 0x4F, 0xE0, 0x2F, 0xFC, 0x29, 0x9F, 0x15, 0x8D, 0xA7, 0x18, 0x02, 0xD7, - 0x3C, 0x11, 0xD0, 0x79, 0xBD, 0x3E, 0x61, 0x5D, 0x31, 0xF1, 0x1B, 0x81, 0x54, 0x23, 0x2A, 0x99, - 0x8C, 0x54, 0x55, 0xAD, 0xEE, 0xCD, 0xD9, 0xAD, 0x56, 0xD1, 0x7A, 0x75, 0xE9, 0x6F, 0x42, 0x56, - 0x0F, 0x11, 0xA5, 0xA1, 0xF9, 0x7C, 0xBF, 0x2F, 0xCB, 0xBA, 0x35, 0xB4, 0x7F, 0xD9, 0x6B, 0xF6, - 0xC4, 0xF0, 0x86, 0xA7, 0x6D, 0xE2, 0x4F, 0x0A, 0xFC, 0x2E, 0xF1, 0x96, 0x93, 0xAC, 0x59, 0x9D, - 0x91, 0x49, 0x6C, 0xD6, 0xBB, 0x25, 0x03, 0x19, 0x8A, 0x54, 0xF3, 0xB0, 0xC0, 0xE0, 0x0D, 0xA4, - 0x7A, 0x63, 0x9C, 0x57, 0xE6, 0x3E, 0x34, 0xE6, 0x3C, 0x19, 0xC6, 0x59, 0x42, 0xCC, 0xE9, 0x66, - 0x10, 0x58, 0xEA, 0x49, 0x7B, 0x34, 0xA3, 0x26, 0x9A, 0xB2, 0xD1, 0xBE, 0x54, 0x92, 0x76, 0xD7, - 0x6B, 0x6F, 0x75, 0xA3, 0x3A, 0x70, 0x54, 0x2A, 0x42, 0x4A, 0x94, 0xE9, 0xDE, 0x1F, 0x2B, 0xAF, - 0x4F, 0xEB, 0x6E, 0x87, 0xE8, 0x47, 0xC2, 0x7F, 0x8C, 0x1F, 0xB5, 0xEF, 0x86, 0x6D, 0x2D, 0xED, - 0x3C, 0x65, 0xFB, 0x3B, 0xFC, 0x45, 0x8A, 0xEE, 0xDD, 0x04, 0x4F, 0xAA, 0x78, 0x5E, 0xE6, 0xCD, - 0xD2, 0x72, 0xAB, 0x82, 0x5A, 0xDA, 0x49, 0xD7, 0x6E, 0x4A, 0x8E, 0x8C, 0xDD, 0xBF, 0x0F, 0xE5, - 0x4C, 0x2F, 0x15, 0xE2, 0xF0, 0xB0, 0xF6, 0x35, 0x63, 0xCF, 0x14, 0xED, 0x66, 0x94, 0x96, 0x8E, - 0xDA, 0x3D, 0x1B, 0x56, 0xD9, 0x34, 0xAC, 0xBA, 0xBD, 0x08, 0xC4, 0xF0, 0xFE, 0x0E, 0xAC, 0xB9, - 0xE8, 0xCF, 0x92, 0x5D, 0x5A, 0xBA, 0x7A, 0x2B, 0x2B, 0xD9, 0x34, 0xFB, 0x76, 0xB6, 0xDA, 0x33, - 0xE9, 0xA5, 0xFD, 0xA6, 0xBE, 0x3A, 0x2D, 0xBA, 0xAF, 0xFC, 0x29, 0xEF, 0x8E, 0x45, 0x92, 0x35, - 0x0B, 0x11, 0xF0, 0xEE, 0x96, 0xDC, 0xAA, 0xE0, 0x0F, 0x30, 0xDD, 0xFB, 0x01, 0xC6, 0x3E, 0xBC, - 0x66, 0xBD, 0x4F, 0xF5, 0xBB, 0x02, 0xE9, 0xB6, 0xF0, 0xD1, 0xE7, 0xD7, 0x4F, 0x7B, 0x7E, 0xC9, - 0x25, 0x6B, 0x75, 0xF8, 0x92, 0xFD, 0x38, 0x7F, 0xB0, 0x2B, 0xD9, 0x47, 0xEB, 0x12, 0xB5, 0xB7, - 0xD3, 0x4F, 0x35, 0xDB, 0xC9, 0x2B, 0x5A, 0xFA, 0x2D, 0x11, 0xF3, 0xD7, 0xC5, 0x1F, 0x8D, 0x5F, - 0xB5, 0x8E, 0xB9, 0x67, 0x71, 0x6F, 0xE0, 0xCF, 0xD9, 0xDB, 0xE2, 0x5D, 0xDD, 0xF4, 0x91, 0xEC, - 0x87, 0x54, 0xF1, 0x4C, 0xF6, 0x30, 0x43, 0x01, 0x20, 0x02, 0xEB, 0x6F, 0x1C, 0xEF, 0xD0, 0x0C, - 0x60, 0x10, 0x0F, 0x1C, 0xFA, 0x79, 0x78, 0xAE, 0x2D, 0xC5, 0x56, 0xA6, 0xE9, 0x50, 0x87, 0x2C, - 0x76, 0x6A, 0x29, 0x45, 0x7A, 0x5F, 0x57, 0x6F, 0x97, 0x96, 0xCC, 0xEE, 0xC1, 0xE4, 0x18, 0x3A, - 0x13, 0xF6, 0x95, 0x67, 0xCC, 0xF4, 0xD5, 0xA6, 0xFD, 0x6C, 0xAC, 0x92, 0xED, 0xA2, 0x7A, 0x5A, - 0xDD, 0x2D, 0xF9, 0x77, 0xE3, 0xAF, 0xD9, 0xB3, 0xF6, 0xD3, 0xF8, 0x91, 0xAD, 0xCD, 0xAF, 0xF8, - 0xBB, 0xE1, 0x57, 0x8D, 0x75, 0x3B, 0xE9, 0x32, 0xB1, 0x2B, 0xFD, 0x95, 0x6D, 0xAD, 0x10, 0x9C, - 0x88, 0xE1, 0x8F, 0xCE, 0xC2, 0xA8, 0xE0, 0x7A, 0xF0, 0x32, 0x78, 0xAF, 0x8D, 0xAF, 0x3C, 0x56, - 0x26, 0x4A, 0x55, 0x16, 0x9D, 0x17, 0x45, 0xFD, 0x7F, 0x92, 0xD9, 0x24, 0xBE, 0x92, 0x82, 0xC2, - 0x61, 0xE0, 0xA1, 0x4B, 0x45, 0xB6, 0xDF, 0xF0, 0x0D, 0x1F, 0xD9, 0x5B, 0xE1, 0x77, 0xC4, 0x0F, - 0x84, 0xFF, 0x00, 0xB7, 0xA7, 0xEC, 0x63, 0xE1, 0xFF, 0x00, 0x88, 0xBE, 0x13, 0xD5, 0x7C, 0x23, - 0xAB, 0xDE, 0x7E, 0xD2, 0xDF, 0x0F, 0x35, 0x3B, 0x3B, 0x1D, 0x56, 0x15, 0x8D, 0xEE, 0x6D, 0x9F, - 0xC5, 0xF6, 0x48, 0xB2, 0xC6, 0xCA, 0x4A, 0xB2, 0xEE, 0x8A, 0x45, 0xE0, 0xF0, 0x54, 0x83, 0xD2, - 0xAB, 0x2E, 0x83, 0x86, 0x63, 0x86, 0x4D, 0x5B, 0xDF, 0x87, 0xFE, 0x94, 0x8B, 0xAF, 0x28, 0x4B, - 0x09, 0x51, 0xC1, 0xE9, 0xCA, 0xFF, 0x00, 0x23, 0xFB, 0xD8, 0xAF, 0xD4, 0x4F, 0x90, 0x0A, 0x00, - 0x28, 0x00, 0xA0, 0x0F, 0x67, 0xFD, 0x85, 0xFF, 0x00, 0x64, 0xDD, 0x37, 0xE3, 0xD8, 0xFD, 0xAE, - 0xBC, 0x5F, 0x75, 0xA5, 0xC5, 0x7D, 0x36, 0x93, 0xFB, 0x58, 0xDB, 0xF8, 0x50, 0x31, 0x85, 0x5D, - 0x91, 0x20, 0xF8, 0x31, 0xF0, 0xF2, 0xE1, 0x53, 0x3B, 0x49, 0x03, 0x3A, 0x83, 0x90, 0x3E, 0xB8, - 0xAF, 0x83, 0xCE, 0xEA, 0xAA, 0x79, 0x8D, 0x48, 0xDD, 0xAF, 0x87, 0x67, 0x65, 0xF0, 0xAE, 0xDF, - 0xD6, 0xC7, 0xD1, 0x65, 0xFF, 0x00, 0xEE, 0x90, 0x5C, 0xAB, 0xAF, 0x7E, 0xFE, 0x47, 0xDE, 0xA7, - 0xFE, 0x09, 0xAF, 0xE1, 0xE5, 0xDA, 0x06, 0x8D, 0x1F, 0x0B, 0x82, 0xEB, 0x65, 0x11, 0x19, 0x03, - 0xE5, 0x07, 0x81, 0xEC, 0x38, 0x1D, 0xBF, 0x2F, 0x29, 0x62, 0x22, 0x97, 0xC5, 0x2B, 0x5B, 0xBF, - 0xF5, 0xFD, 0x74, 0xD0, 0xEA, 0x53, 0x6E, 0xCA, 0x34, 0xD5, 0xBD, 0x5A, 0xB7, 0x6E, 0xBF, 0xF0, - 0xD6, 0x23, 0x6F, 0xF8, 0x26, 0xB7, 0x87, 0xB1, 0xB8, 0x68, 0x96, 0xED, 0x85, 0xC7, 0xCD, 0xA7, - 0xC2, 0x3A, 0x8E, 0x41, 0x3B, 0x4F, 0xBF, 0xA5, 0x4F, 0xB7, 0x85, 0xB4, 0x72, 0xD3, 0xCF, 0xF2, - 0xFF, 0x00, 0x80, 0x52, 0xA8, 0xD5, 0x97, 0xB3, 0x4B, 0xD1, 0xBB, 0x7E, 0x6B, 0xF4, 0xEC, 0x56, - 0x4F, 0xF8, 0x26, 0xBE, 0x81, 0x95, 0x5F, 0xF8, 0x47, 0x2D, 0xC0, 0xE0, 0x64, 0xD8, 0x42, 0x02, - 0x8E, 0x9D, 0x3C, 0xBF, 0x6A, 0x9F, 0xAC, 0x45, 0x2D, 0x1C, 0xBE, 0xFF, 0x00, 0xF8, 0x06, 0x8A, - 0x4D, 0x24, 0xB9, 0x57, 0xDF, 0x2F, 0xF3, 0x27, 0x1F, 0xF0, 0x4D, 0x3F, 0x0E, 0x71, 0x8D, 0x06, - 0xDB, 0x00, 0x76, 0xD3, 0xA2, 0xC7, 0x03, 0x80, 0x3F, 0x77, 0xF4, 0xFA, 0x54, 0xFD, 0x61, 0x2D, - 0x13, 0x7F, 0x7F, 0xFC, 0x02, 0x79, 0xDD, 0x92, 0x50, 0x5F, 0x7C, 0xBF, 0xCC, 0x6B, 0x7F, 0xC1, - 0x35, 0x3C, 0x3C, 0xA9, 0x95, 0xF0, 0xFD, 0xB1, 0xE8, 0x15, 0x7F, 0xB3, 0xA2, 0x53, 0x8E, 0x31, - 0xC7, 0x97, 0xC7, 0x51, 0xE9, 0x4E, 0x38, 0x85, 0xA2, 0xBB, 0xFB, 0xFF, 0x00, 0xE0, 0x02, 0xA8, - 0xF4, 0x5C, 0xAA, 0xDE, 0xB2, 0xFF, 0x00, 0x3F, 0x21, 0xD6, 0xFF, 0x00, 0xF0, 0x4D, 0xDD, 0x11, - 0x4E, 0x3F, 0xB0, 0x6D, 0xD5, 0x40, 0x0D, 0xFB, 0xCB, 0x28, 0xF0, 0x31, 0x8C, 0x00, 0x02, 0x2F, - 0xA0, 0x1C, 0xF6, 0xE3, 0xE9, 0xD1, 0x47, 0x1A, 0xE9, 0x49, 0x3A, 0x73, 0x69, 0xF7, 0xBE, 0xDE, - 0x9E, 0x7B, 0x79, 0xE8, 0xAC, 0x4B, 0x49, 0x46, 0xFC, 0x8B, 0x4E, 0xD7, 0xFF, 0x00, 0x35, 0xB1, - 0xEA, 0xDF, 0x0F, 0xBF, 0x60, 0xBF, 0x0D, 0xF8, 0x0A, 0xF0, 0xF8, 0xCA, 0xD7, 0x40, 0xB4, 0xB9, - 0xF1, 0x3E, 0x9A, 0x4C, 0x3E, 0x13, 0x8A, 0xEB, 0x4E, 0x82, 0xEE, 0xDB, 0x4C, 0x9D, 0xD7, 0x03, - 0x50, 0x96, 0x06, 0x5C, 0x33, 0x44, 0xAC, 0xDE, 0x59, 0xC8, 0x2B, 0x26, 0xC7, 0x1F, 0x74, 0x57, - 0xB9, 0x1E, 0x21, 0xAD, 0x52, 0x2A, 0x9C, 0xEB, 0x49, 0xAB, 0x25, 0x2B, 0xB6, 0xAE, 0xBA, 0xAD, - 0x1E, 0xCD, 0xF4, 0xB5, 0xAC, 0xB6, 0x38, 0xAA, 0xD2, 0xA9, 0x38, 0x25, 0xCB, 0xA3, 0xE8, 0x9B, - 0xB7, 0x4B, 0x6A, 0xDD, 0x96, 0x8A, 0xDA, 0x6A, 0xB6, 0xE8, 0x71, 0x97, 0xDF, 0xF0, 0x4F, 0x3D, - 0x3B, 0x51, 0xBF, 0xB8, 0xD5, 0x6F, 0x34, 0xEF, 0xB7, 0xEA, 0x9A, 0x85, 0xE3, 0xDE, 0xDF, 0x5E, - 0xEA, 0x10, 0x06, 0xBD, 0xBD, 0x9E, 0x57, 0x2F, 0x34, 0xF2, 0xCC, 0x41, 0x2E, 0xEC, 0xE7, 0x25, - 0x89, 0xC9, 0x27, 0x35, 0xEA, 0x47, 0x8A, 0x15, 0x2A, 0x71, 0x84, 0x26, 0xAD, 0x15, 0x64, 0xB6, - 0x49, 0x25, 0x65, 0x64, 0x93, 0x49, 0xE9, 0x65, 0x64, 0xB4, 0xEC, 0xB4, 0x08, 0xD3, 0x97, 0x2B, - 0x84, 0xE2, 0x94, 0x74, 0x56, 0x4D, 0xB5, 0x6D, 0xAD, 0x6B, 0xED, 0x6E, 0x9A, 0xEB, 0xE4, 0x32, - 0x2F, 0xF8, 0x27, 0x7E, 0x86, 0xE0, 0xC6, 0xFE, 0x1F, 0xB6, 0x48, 0xD9, 0x41, 0x78, 0xC5, 0x9A, - 0xC8, 0x91, 0xC8, 0x83, 0x0A, 0xF1, 0xA8, 0x00, 0x00, 0x40, 0x50, 0x71, 0xE8, 0xB8, 0xE8, 0x33, - 0xA5, 0x0E, 0x2E, 0x94, 0x1D, 0xE3, 0x51, 0xC6, 0x2F, 0x59, 0x2D, 0x34, 0x69, 0x68, 0xD7, 0x4D, - 0x6D, 0x67, 0xAA, 0xBE, 0xED, 0x6A, 0xCC, 0x6A, 0x61, 0x1A, 0x8A, 0x7C, 0xA9, 0xBD, 0x95, 0xDB, - 0xF8, 0x5F, 0x47, 0xBB, 0xF7, 0x7A, 0x25, 0xA6, 0xB6, 0x4A, 0xC3, 0x47, 0xFC, 0x13, 0xA3, 0xC3, - 0xFB, 0x4A, 0x0D, 0x19, 0x5B, 0x72, 0x88, 0xA2, 0x59, 0x34, 0xB8, 0x7C, 0x94, 0x19, 0xE4, 0x90, - 0x38, 0xE3, 0x91, 0xE9, 0xCF, 0xE7, 0xBA, 0xE3, 0x39, 0xA8, 0xBF, 0xDE, 0xBE, 0xE9, 0x72, 0xDB, - 0x7B, 0x74, 0xFC, 0xF4, 0x5B, 0x68, 0x9A, 0x12, 0xC2, 0xB7, 0x67, 0xEC, 0x63, 0x65, 0xFD, 0xE6, - 0xF4, 0xD3, 0x6F, 0xE9, 0x6D, 0x6D, 0x36, 0x34, 0xE6, 0xFF, 0x00, 0x82, 0x7D, 0xE8, 0xD6, 0x5A, - 0x71, 0xD2, 0x34, 0xDD, 0x0E, 0x14, 0xB7, 0xBB, 0x1B, 0xB5, 0x79, 0xC5, 0xA2, 0xA4, 0xBA, 0x87, - 0xCB, 0x8F, 0x29, 0x98, 0x03, 0x88, 0x4E, 0x4F, 0xC8, 0x00, 0x04, 0xF2, 0x41, 0x20, 0x63, 0x9A, - 0x3C, 0x59, 0x3A, 0x69, 0x35, 0x57, 0xDE, 0x7E, 0x6D, 0x25, 0xB6, 0xC9, 0xDF, 0xD2, 0xCA, 0xDA, - 0x68, 0xAC, 0x8D, 0x61, 0x42, 0x53, 0x6E, 0x55, 0x23, 0xB7, 0xC2, 0x95, 0xEC, 0xB4, 0xDD, 0x6D, - 0xAE, 0x9F, 0x2D, 0xBD, 0x31, 0x57, 0xFE, 0x09, 0xD7, 0xA2, 0x49, 0xF3, 0x49, 0xA3, 0x44, 0x8D, - 0x9E, 0x02, 0x59, 0x46, 0x5E, 0x31, 0x9C, 0xAE, 0xD3, 0x81, 0x8C, 0x64, 0x00, 0x01, 0x1D, 0x0E, - 0x08, 0xA7, 0xFE, 0xB6, 0x56, 0x92, 0x72, 0xA9, 0x57, 0xCA, 0xC9, 0xB7, 0xA2, 0x49, 0x74, 0xB7, - 0x65, 0xD1, 0xE9, 0xD9, 0x68, 0x57, 0xB0, 0x74, 0xEC, 0xA9, 0xC1, 0x25, 0xEA, 0xD7, 0xE0, 0x9D, - 0xAE, 0xDF, 0xF5, 0xA0, 0xA3, 0xFE, 0x09, 0xCD, 0xA0, 0x63, 0x3F, 0xD8, 0xC7, 0xB8, 0xC7, 0xF6, - 0x6C, 0x6B, 0x80, 0x7A, 0x0C, 0x76, 0x1F, 0x77, 0xB0, 0xEE, 0x3B, 0x52, 0x5C, 0x55, 0xAA, 0x8A, - 0xA8, 0xED, 0xE8, 0xFA, 0x25, 0x6F, 0xB5, 0x6D, 0x3D, 0x76, 0xB6, 0xDD, 0x05, 0x1A, 0xC9, 0x25, - 0xC8, 0x95, 0x97, 0xF3, 0x3B, 0x7A, 0x6C, 0x8A, 0xF2, 0x7F, 0xC1, 0x39, 0xF4, 0x54, 0x24, 0x0D, - 0x06, 0x07, 0x5D, 0xA7, 0x05, 0x6C, 0xD0, 0x6E, 0x07, 0xAE, 0x72, 0xBE, 0xC0, 0x63, 0xD8, 0x74, - 0xAE, 0x5A, 0xBC, 0x4D, 0x51, 0x7B, 0xAE, 0xA5, 0xD6, 0x8D, 0x59, 0xB5, 0x6B, 0x2B, 0x2D, 0x2F, - 0xD9, 0x25, 0xA6, 0xBF, 0x76, 0x9A, 0xC2, 0x9B, 0xB2, 0xD3, 0x5D, 0x36, 0x6D, 0xF9, 0xDB, 0x7E, - 0xFF, 0x00, 0xD2, 0xD0, 0x91, 0x7F, 0xE0, 0x9C, 0x9A, 0x17, 0x97, 0xB9, 0xB4, 0x38, 0xC3, 0x1C, - 0xE1, 0x52, 0xC1, 0x5C, 0x29, 0x00, 0x63, 0xE6, 0xE3, 0x81, 0xB7, 0x19, 0xC7, 0x7C, 0x7A, 0x54, - 0x2E, 0x21, 0x76, 0x4D, 0xD5, 0x76, 0x7B, 0xA5, 0x7F, 0xBA, 0xDC, 0xD1, 0x49, 0x6D, 0xA5, 0xB4, - 0xB6, 0x9A, 0x24, 0x94, 0xDA, 0xAC, 0x5A, 0x50, 0x8A, 0xB2, 0xB5, 0xBD, 0xE6, 0xAD, 0xA5, 0xAC, - 0x96, 0xB6, 0xD1, 0x58, 0x07, 0xFC, 0x13, 0x8B, 0xC3, 0xD8, 0x50, 0xBA, 0x2C, 0x4B, 0xC6, 0x33, - 0xF6, 0x08, 0xC2, 0x21, 0x00, 0x6D, 0x0A, 0x07, 0x61, 0x93, 0xD3, 0x18, 0xED, 0xC7, 0x35, 0x9F, - 0xF6, 0xEB, 0x6A, 0xCA, 0x6F, 0xA2, 0xEB, 0x6B, 0x5E, 0xFF, 0x00, 0xCD, 0xFA, 0x74, 0x5D, 0x6E, - 0x17, 0xAB, 0xD1, 0x2B, 0x7F, 0x89, 0xFF, 0x00, 0x4B, 0xA7, 0xCB, 0xB1, 0x55, 0xBF, 0xE0, 0x9C, - 0xBA, 0x12, 0x9C, 0x0F, 0x0E, 0xDB, 0x95, 0x52, 0x40, 0x3F, 0x66, 0x4C, 0x15, 0x1D, 0x80, 0xDB, - 0xD3, 0x1E, 0xDC, 0x7A, 0x57, 0x24, 0xF3, 0xD9, 0xB8, 0xB8, 0x39, 0x6D, 0xA2, 0xB3, 0xD3, 0x45, - 0xA7, 0x5E, 0x9D, 0xB6, 0xF2, 0xED, 0xB4, 0x61, 0x37, 0x15, 0xA3, 0xDB, 0x6B, 0xBD, 0x3F, 0x1E, - 0x9A, 0x6D, 0xE9, 0xB0, 0xF5, 0xFF, 0x00, 0x82, 0x6F, 0x78, 0x7B, 0xCB, 0x50, 0x74, 0x08, 0xB3, - 0xC0, 0x3B, 0x6C, 0x23, 0x28, 0x08, 0x1C, 0x0C, 0x9C, 0x1E, 0xCB, 0x9E, 0x0F, 0xE4, 0x6B, 0x29, - 0x66, 0x70, 0x92, 0x49, 0xCD, 0xED, 0xD3, 0xA6, 0x8B, 0xAE, 0x9F, 0x87, 0x6F, 0x24, 0x45, 0xEA, - 0x27, 0x68, 0xC3, 0x4F, 0x56, 0xBB, 0x74, 0xBF, 0x65, 0xA6, 0xDD, 0x3A, 0x00, 0xFF, 0x00, 0x82, - 0x6E, 0xF8, 0x77, 0x03, 0x67, 0x87, 0xA1, 0x52, 0x08, 0xE5, 0xF4, 0xF8, 0x99, 0x50, 0x02, 0x71, - 0x80, 0x07, 0x3D, 0x08, 0xE4, 0x7A, 0x66, 0xB9, 0x9E, 0x32, 0x12, 0x6D, 0x73, 0xBF, 0xC3, 0xFA, - 0xF3, 0x4B, 0xBF, 0x61, 0xC5, 0xCF, 0x4B, 0xD3, 0xFC, 0x5F, 0x6E, 0xC9, 0xFE, 0x5F, 0x81, 0x4C, - 0x7F, 0xC1, 0x38, 0x74, 0x5C, 0x04, 0x3E, 0x1D, 0xB4, 0xC1, 0xC2, 0x12, 0xD6, 0x80, 0xAA, 0xF2, - 0x01, 0xC6, 0x07, 0x0A, 0x39, 0xE9, 0xE9, 0xF9, 0xE0, 0xF1, 0x69, 0xDD, 0x5D, 0xDB, 0xCA, 0xDE, - 0x5F, 0xD7, 0x4E, 0xDB, 0x68, 0x6C, 0x96, 0xC9, 0x45, 0x7E, 0x3F, 0xD6, 0x9A, 0x7D, 0xDE, 0x96, - 0x97, 0xFE, 0x1D, 0xB1, 0xE1, 0xBD, 0xA8, 0xA7, 0x41, 0xB6, 0x50, 0x80, 0xFC, 0xA9, 0x60, 0x9D, - 0x08, 0xE0, 0x01, 0xC8, 0x1D, 0x00, 0x3D, 0x3F, 0x4A, 0x97, 0x88, 0xA7, 0x1D, 0x39, 0x9B, 0xB7, - 0x6D, 0xBE, 0x4D, 0xFF, 0x00, 0x49, 0x5A, 0xD7, 0x25, 0x4A, 0x56, 0xD2, 0x9A, 0x5F, 0x37, 0xF9, - 0x2F, 0xEB, 0xC9, 0x74, 0x63, 0x7F, 0xC1, 0x36, 0x7C, 0x3C, 0xAA, 0x4A, 0xE8, 0x51, 0x39, 0x03, - 0x84, 0x7B, 0x28, 0xD5, 0x70, 0x07, 0x0A, 0x40, 0x1D, 0x3A, 0x0F, 0xE5, 0xD6, 0xA7, 0xEB, 0x11, - 0x4B, 0x95, 0x49, 0xD9, 0x69, 0xAB, 0x6B, 0xA7, 0xF4, 0xBD, 0x3E, 0xE4, 0xE1, 0x37, 0xA2, 0xF6, - 0x6B, 0xE4, 0xDB, 0xFF, 0x00, 0x80, 0x97, 0xFC, 0x37, 0x6B, 0xB6, 0x1F, 0xF8, 0x26, 0xFE, 0x88, - 0x03, 0x47, 0xFD, 0x83, 0x6C, 0x11, 0xD5, 0x73, 0xE6, 0x5A, 0x28, 0x5E, 0x07, 0x00, 0x80, 0xA3, - 0xDC, 0x7F, 0xFA, 0xE8, 0x8E, 0x2F, 0x91, 0x38, 0xDD, 0xD9, 0xAB, 0x6E, 0xFF, 0x00, 0x0F, 0xD3, - 0xB7, 0x42, 0x9B, 0x8A, 0x49, 0xF2, 0x2B, 0x2F, 0x52, 0x55, 0xFF, 0x00, 0x82, 0x6D, 0xF8, 0x75, - 0x42, 0x81, 0xE1, 0xFB, 0x35, 0x03, 0x8D, 0x82, 0xC0, 0x04, 0x51, 0x9E, 0x00, 0x00, 0xE3, 0xD3, - 0xD2, 0x94, 0x71, 0x51, 0x56, 0xDE, 0xDE, 0xAF, 0xFC, 0xD7, 0xCA, 0xD6, 0xF4, 0xB2, 0x15, 0xE5, - 0xAF, 0xB8, 0xB6, 0xEF, 0xE4, 0xBC, 0x9D, 0xBF, 0x1D, 0x2D, 0xE8, 0x36, 0x4F, 0xF8, 0x26, 0xE6, - 0x80, 0xAA, 0x0C, 0x5A, 0x05, 0x91, 0x00, 0x11, 0xB3, 0xFB, 0x38, 0x8E, 0xAB, 0xC0, 0x03, 0x24, - 0x0C, 0x7C, 0xC3, 0x8C, 0x70, 0x07, 0xE1, 0xA4, 0x71, 0x6A, 0x09, 0x72, 0xB7, 0x6D, 0xAD, 0x76, - 0xBA, 0x5B, 0x6B, 0xBE, 0x9B, 0x59, 0x68, 0xBC, 0xF5, 0x14, 0x5F, 0x47, 0x04, 0xBD, 0x1B, 0xF2, - 0xED, 0x6F, 0xBB, 0xF3, 0x4A, 0xC3, 0x22, 0xFF, 0x00, 0x82, 0x6E, 0xE8, 0x4C, 0x76, 0x1F, 0x0F, - 0xDA, 0x22, 0xED, 0x18, 0x26, 0xC4, 0x12, 0x72, 0x41, 0x23, 0x18, 0x03, 0x3F, 0x40, 0x3D, 0x3B, - 0xD6, 0x71, 0xC5, 0x24, 0xB9, 0x53, 0x76, 0xF5, 0x7D, 0x2D, 0xFF, 0x00, 0x00, 0xA7, 0x64, 0x93, - 0x50, 0xD7, 0xB2, 0x6D, 0x79, 0x7C, 0xBF, 0x4D, 0x2C, 0x89, 0x87, 0xFC, 0x13, 0x67, 0xC3, 0x78, - 0x38, 0xD0, 0xAD, 0x41, 0x2A, 0x54, 0x63, 0x4E, 0x50, 0x79, 0xFC, 0x48, 0xEC, 0x07, 0x4A, 0x7F, - 0x5A, 0x8F, 0x46, 0xFF, 0x00, 0xAF, 0x9F, 0xF4, 0xBE, 0x44, 0xA9, 0x4D, 0x59, 0x7B, 0x35, 0x65, - 0xD2, 0xEE, 0xDF, 0x82, 0xF9, 0x69, 0x6E, 0x9E, 0x76, 0x85, 0xFF, 0x00, 0xE0, 0x9B, 0x7A, 0x12, - 0x84, 0xC6, 0x85, 0x6E, 0xEB, 0x8D, 0xA6, 0x35, 0xB2, 0x54, 0x18, 0x03, 0x39, 0xFB, 0xA7, 0xAE, - 0x0F, 0xF8, 0x0E, 0x00, 0x1E, 0x29, 0x59, 0x26, 0xDD, 0xBA, 0x6B, 0xFD, 0x7C, 0xBC, 0xBA, 0x58, - 0xA8, 0x35, 0xAA, 0x54, 0xD2, 0x7F, 0x3F, 0x2D, 0xBF, 0x2D, 0x3F, 0x30, 0x4F, 0xF8, 0x26, 0xCF, - 0x87, 0xE5, 0x50, 0x5B, 0xC3, 0xB6, 0x70, 0x95, 0x21, 0x1B, 0xCB, 0xD3, 0x93, 0x74, 0x80, 0xE3, - 0x25, 0xB7, 0x29, 0xCF, 0x4E, 0x9D, 0x28, 0xFA, 0xCC, 0x5C, 0x54, 0x6C, 0xD2, 0x5D, 0x9B, 0xBB, - 0xF5, 0xBB, 0xE9, 0xE4, 0x90, 0x73, 0x59, 0x24, 0xA3, 0x75, 0xD3, 0x57, 0xA7, 0xE5, 0x6E, 0xDF, - 0xA1, 0x20, 0xFF, 0x00, 0x82, 0x6C, 0xE8, 0x22, 0x36, 0x45, 0xD2, 0x63, 0x44, 0x60, 0x33, 0x0C, - 0x76, 0x51, 0xC7, 0x13, 0x60, 0x71, 0x94, 0x0B, 0x8E, 0xC3, 0xB7, 0x61, 0xE9, 0x50, 0xAB, 0xC1, - 0x25, 0x67, 0x2F, 0xBF, 0xCB, 0xFA, 0xFE, 0xB4, 0x05, 0x39, 0x68, 0x95, 0x35, 0x6F, 0x57, 0xF8, - 0x6B, 0xFD, 0x76, 0x2B, 0x4B, 0xFF, 0x00, 0x04, 0xD8, 0xD0, 0x54, 0xA2, 0xFF, 0x00, 0x60, 0x42, - 0xE0, 0x28, 0xC6, 0x2C, 0x62, 0xDA, 0xA3, 0x3C, 0x00, 0x0C, 0x67, 0x1D, 0x3F, 0x9F, 0xE0, 0x2C, - 0x44, 0x76, 0xBB, 0xB7, 0xAF, 0xA7, 0xF5, 0xFA, 0x0D, 0x4B, 0x4D, 0x20, 0x97, 0x4E, 0xBE, 0x5E, - 0x67, 0x79, 0xF0, 0xF7, 0xF6, 0x18, 0x97, 0xE1, 0xB6, 0xAE, 0x35, 0xEF, 0x0D, 0x58, 0x45, 0x6B, - 0x25, 0xD5, 0x9C, 0x9A, 0x46, 0xB1, 0xA6, 0x3D, 0x82, 0x4B, 0xA6, 0x6B, 0xFA, 0x74, 0xCB, 0xB6, - 0xEB, 0x4F, 0xBF, 0xB7, 0xDA, 0x12, 0x7B, 0x69, 0x54, 0xA8, 0x68, 0x9C, 0x6D, 0x38, 0x5C, 0x8E, - 0x29, 0xFD, 0x62, 0x2A, 0x0D, 0x6B, 0xF7, 0xEC, 0xBF, 0x4E, 0x9A, 0x75, 0x5D, 0x6C, 0x65, 0x36, - 0xA6, 0xD4, 0x1C, 0x16, 0x96, 0xB3, 0xBB, 0xDF, 0x4B, 0x35, 0xAF, 0x4E, 0x8D, 0x6D, 0xF2, 0x31, - 0xBC, 0x4B, 0xFF, 0x00, 0x04, 0xD1, 0xF0, 0x29, 0xD5, 0xA5, 0xB8, 0xD0, 0x34, 0x18, 0x53, 0x48, - 0xBF, 0x02, 0xF6, 0xD2, 0xD2, 0x5D, 0x36, 0xDC, 0x4F, 0xA5, 0x89, 0x0E, 0x5A, 0xD6, 0x40, 0x91, - 0x85, 0xF9, 0x3A, 0x02, 0xA0, 0x0C, 0x63, 0x1D, 0x2A, 0x3E, 0xB1, 0x15, 0xB3, 0x76, 0xF2, 0x7F, - 0xA7, 0x4F, 0x4F, 0xD2, 0xC5, 0xC2, 0x75, 0x14, 0x23, 0xCD, 0x15, 0x7E, 0xBA, 0xBF, 0xC3, 0x54, - 0xAC, 0x73, 0x27, 0xFE, 0x09, 0xB1, 0xA0, 0x03, 0x81, 0xE1, 0xB8, 0x08, 0x07, 0x03, 0x1A, 0x7C, - 0x40, 0x11, 0xD8, 0xE3, 0xCA, 0xFA, 0x55, 0x2A, 0xF1, 0xB5, 0xB9, 0x9F, 0xDF, 0xFF, 0x00, 0x02, - 0xC5, 0xA9, 0x3B, 0x2F, 0x75, 0x5B, 0xD6, 0x5F, 0xE6, 0x6C, 0xD8, 0x7F, 0xC1, 0x39, 0xB4, 0x1B, - 0x7B, 0x79, 0x6C, 0x2E, 0x34, 0x28, 0xA6, 0xD3, 0x6E, 0x80, 0x69, 0xAD, 0x05, 0x84, 0x72, 0x2C, - 0x0E, 0x07, 0xCB, 0x34, 0x69, 0xB0, 0x00, 0xE3, 0xA6, 0x46, 0x32, 0x38, 0xEF, 0x4A, 0x38, 0x88, - 0xA6, 0xAE, 0xDD, 0xB4, 0x57, 0xBE, 0xC9, 0x79, 0x69, 0xF7, 0x7F, 0xC3, 0x12, 0xE7, 0x24, 0xAD, - 0x18, 0xAB, 0xFA, 0xBD, 0x7C, 0xB7, 0xD3, 0xFC, 0xBC, 0xB4, 0x28, 0x49, 0xFF, 0x00, 0x04, 0xD0, - 0xF0, 0xDC, 0x72, 0x14, 0x4D, 0x0E, 0xD9, 0x93, 0xFE, 0x59, 0xB9, 0xD3, 0x22, 0x04, 0xAE, 0x46, - 0x32, 0xA2, 0x33, 0x83, 0xC8, 0xE0, 0x7F, 0x4E, 0x07, 0x5E, 0x29, 0xDA, 0x2D, 0xDB, 0xD6, 0xDF, - 0xA6, 0x82, 0x55, 0x65, 0xCA, 0x9B, 0x82, 0xDB, 0xA3, 0x93, 0xB7, 0x96, 0xE8, 0xAB, 0xFF, 0x00, - 0x0E, 0xD8, 0xF0, 0xF8, 0x6D, 0xA3, 0xC3, 0x96, 0xD8, 0x1C, 0x67, 0xEC, 0x11, 0x05, 0xC0, 0x1C, - 0x63, 0xF7, 0x7E, 0x98, 0xA1, 0x57, 0x8D, 0x97, 0xBC, 0xFE, 0xFF, 0x00, 0xF8, 0x06, 0xAA, 0x4F, - 0x44, 0xA0, 0xAD, 0xEB, 0x2F, 0xF3, 0x27, 0xFF, 0x00, 0x87, 0x69, 0xF8, 0x70, 0x00, 0x06, 0x83, - 0x6B, 0xD0, 0x63, 0x1A, 0x74, 0x40, 0x74, 0x18, 0x03, 0xF7, 0x63, 0xB1, 0x15, 0x3F, 0x58, 0xB2, - 0xDD, 0xDB, 0xD7, 0xFE, 0x01, 0x0A, 0xA3, 0xB6, 0x90, 0x56, 0xF5, 0x97, 0xE5, 0x71, 0xA7, 0xFE, - 0x09, 0xA9, 0xE1, 0xD0, 0xA7, 0x1A, 0x05, 0xB7, 0xCA, 0x38, 0x53, 0xA7, 0xC2, 0xA0, 0x91, 0xD1, - 0x41, 0xF2, 0xFE, 0x94, 0x2C, 0x46, 0x9A, 0x37, 0xF7, 0xFF, 0x00, 0xC0, 0x05, 0x51, 0xE8, 0xB9, - 0x15, 0xBC, 0x9C, 0xBF, 0xCC, 0x89, 0x3F, 0xE0, 0x9B, 0x1E, 0x1F, 0x24, 0x2F, 0xFC, 0x23, 0x96, - 0xCA, 0x38, 0x19, 0x36, 0x11, 0x60, 0x74, 0xE0, 0x01, 0x17, 0xB8, 0xE9, 0xFD, 0x2A, 0xBE, 0xB1, - 0x14, 0x95, 0xA4, 0xFE, 0xFB, 0x7E, 0x9A, 0x15, 0xCC, 0xD6, 0x9C, 0xAB, 0xE4, 0xE5, 0xFE, 0x64, - 0xE3, 0xFE, 0x09, 0xA7, 0xE1, 0xCC, 0x0C, 0x78, 0x7E, 0x0E, 0xC0, 0x01, 0xA6, 0xC4, 0x3A, 0x8E, - 0x01, 0x1E, 0x5F, 0x1D, 0xAA, 0x7E, 0xB0, 0x96, 0x97, 0x76, 0xF5, 0xFF, 0x00, 0x80, 0x4A, 0xA8, - 0xEC, 0xBD, 0xD5, 0x6F, 0x59, 0x7F, 0x9F, 0x41, 0x8D, 0xFF, 0x00, 0x04, 0xD5, 0xF0, 0xEA, 0x26, - 0x57, 0xC3, 0xF6, 0xCD, 0x8C, 0x00, 0xA3, 0x4E, 0x88, 0x1C, 0x63, 0xFE, 0xB9, 0xFB, 0x0A, 0xA5, - 0x5D, 0x75, 0x6E, 0xDE, 0xBF, 0xF0, 0x3F, 0xAF, 0xB8, 0x6A, 0x6F, 0x6E, 0x45, 0xF7, 0xCA, 0xDF, - 0x9F, 0xF5, 0xF2, 0x1B, 0x1F, 0xFC, 0x13, 0x5F, 0xC3, 0xCD, 0xC1, 0xF0, 0xED, 0xB4, 0x60, 0x28, - 0x3F, 0x35, 0x84, 0x20, 0x75, 0xC0, 0x03, 0xF7, 0x7E, 0xD4, 0x7B, 0x78, 0xE8, 0x94, 0x9F, 0xDF, - 0xFF, 0x00, 0x00, 0x39, 0xDA, 0x8D, 0xF9, 0x55, 0xBD, 0x65, 0xFE, 0x64, 0xBF, 0xF0, 0xED, 0x3F, - 0x0E, 0x05, 0xCF, 0xF6, 0x05, 0xB8, 0x00, 0x1E, 0x06, 0x99, 0x17, 0x18, 0x38, 0xC7, 0xFA, 0xBF, - 0x61, 0xFE, 0x45, 0x25, 0x88, 0x49, 0x25, 0x77, 0xF7, 0xFF, 0x00, 0xC0, 0x12, 0xA8, 0xF6, 0xE4, - 0x5F, 0x7C, 0xBF, 0xCF, 0xFA, 0xF2, 0x23, 0x7F, 0xF8, 0x26, 0xAF, 0x87, 0x90, 0x0D, 0xBE, 0x1E, - 0xB6, 0x6E, 0x71, 0xB4, 0x69, 0xD1, 0x29, 0x00, 0x0E, 0x0E, 0x3C, 0xBA, 0x6A, 0xBA, 0xB2, 0xD5, - 0xDB, 0xD7, 0xFE, 0x00, 0x2A, 0x8D, 0xE8, 0xA0, 0xAD, 0x6E, 0xF2, 0xB7, 0x6E, 0xFF, 0x00, 0xD7, - 0xE5, 0x25, 0xBF, 0xFC, 0x13, 0x5B, 0xC3, 0x83, 0x12, 0x3F, 0x87, 0xED, 0xD4, 0x47, 0x82, 0x10, - 0x69, 0xF0, 0x92, 0x71, 0xD3, 0x23, 0x60, 0xC7, 0x41, 0xDF, 0xB5, 0x6F, 0x87, 0xAB, 0x4F, 0x99, - 0x39, 0x49, 0xF2, 0xAB, 0x3D, 0xF7, 0xF2, 0x4B, 0x6B, 0x7E, 0x16, 0xD0, 0x9A, 0x93, 0x94, 0x62, - 0x94, 0x62, 0xB6, 0xEE, 0xD2, 0xB5, 0xBD, 0x7A, 0x79, 0x1A, 0xC3, 0xFE, 0x09, 0xC3, 0xE1, 0xC5, - 0x04, 0x1D, 0x05, 0x14, 0x70, 0x46, 0xDD, 0x32, 0x2D, 0x8A, 0x40, 0xEC, 0x09, 0x03, 0xBE, 0x07, - 0x1F, 0xCB, 0x8F, 0xA3, 0xC3, 0xE7, 0xD4, 0xF0, 0xF4, 0xE3, 0x4E, 0x35, 0x1F, 0x22, 0xE8, 0x93, - 0xD6, 0xCA, 0xCB, 0xED, 0x79, 0x2B, 0xE8, 0xBE, 0x6A, 0xC7, 0x27, 0xEF, 0xAE, 0x9C, 0x60, 0xBB, - 0x7C, 0x4F, 0x6F, 0xBB, 0xD2, 0xDD, 0xEC, 0x67, 0xDD, 0x7F, 0xC1, 0x38, 0x74, 0x49, 0x24, 0x5F, - 0xF8, 0xA7, 0xE0, 0x60, 0xA0, 0x61, 0xBE, 0xC6, 0xAA, 0xD9, 0x04, 0xE3, 0x23, 0x69, 0xC7, 0x45, - 0xC6, 0x00, 0xC7, 0xE3, 0xC7, 0x97, 0x99, 0x67, 0x13, 0xC6, 0xD6, 0x5C, 0xD3, 0x7C, 0x89, 0x2B, - 0x59, 0xF6, 0x4B, 0x7F, 0xBB, 0x66, 0xF7, 0xBB, 0x37, 0xA3, 0x1E, 0x4A, 0x69, 0x38, 0x6B, 0xB6, - 0xF2, 0x6A, 0xDE, 0x5E, 0x9D, 0x34, 0x5A, 0x5B, 0x4B, 0x09, 0x1F, 0xFC, 0x13, 0x6F, 0x41, 0x31, - 0xE5, 0xB4, 0x2B, 0x75, 0x7D, 0xC7, 0xE5, 0x16, 0x2A, 0xC5, 0x80, 0x1C, 0x28, 0x18, 0x5F, 0x97, - 0x83, 0xC6, 0x7B, 0x0E, 0x6B, 0xCE, 0x8E, 0x25, 0x24, 0x92, 0x93, 0xED, 0xA3, 0xFC, 0x3D, 0x2D, - 0xF2, 0xE8, 0x5B, 0x97, 0x2D, 0x92, 0x82, 0xB7, 0x6B, 0xBF, 0xEB, 0xEE, 0x5F, 0x86, 0xD2, 0x0F, - 0xF8, 0x26, 0xD7, 0x87, 0x78, 0x0B, 0xA1, 0xC0, 0xA8, 0x09, 0x21, 0x05, 0x8A, 0xE5, 0x46, 0x06, - 0x76, 0x91, 0xF4, 0x00, 0x71, 0x8E, 0x3A, 0x75, 0xC9, 0x1C, 0x5C, 0x39, 0x79, 0x5B, 0x76, 0xF5, - 0xED, 0x6D, 0x9E, 0x9D, 0x9A, 0xB6, 0xDB, 0x69, 0x72, 0x5B, 0x92, 0x8D, 0xF9, 0x15, 0xEC, 0xBA, - 0xBF, 0x4B, 0x5B, 0x65, 0x6D, 0x3E, 0xEE, 0xC4, 0x71, 0xFF, 0x00, 0xC1, 0x37, 0xF4, 0x18, 0xE6, - 0x59, 0x0E, 0x81, 0x6F, 0x22, 0xC4, 0x36, 0xC7, 0xB6, 0xD1, 0x00, 0x00, 0x0C, 0x80, 0xA7, 0x6E, - 0x47, 0x7E, 0x33, 0xFF, 0x00, 0xD6, 0xDB, 0x09, 0x8A, 0xA7, 0x4A, 0xB4, 0x6B, 0x54, 0x93, 0xB4, - 0x5A, 0x69, 0x39, 0x75, 0x5B, 0x7E, 0x2B, 0xD3, 0x42, 0x9D, 0xF9, 0x14, 0x61, 0x0B, 0x7A, 0x5F, - 0xFC, 0xD2, 0xFB, 0xBE, 0x5E, 0x57, 0x57, 0xFE, 0x09, 0xC9, 0xA1, 0x37, 0xCE, 0xDA, 0x15, 0xBA, - 0x39, 0x39, 0x0A, 0x96, 0x29, 0xB5, 0x47, 0x4C, 0x64, 0x80, 0x47, 0x40, 0x38, 0xFE, 0x95, 0xF4, - 0x12, 0xE2, 0x29, 0xA5, 0xED, 0x63, 0x51, 0xDD, 0xEA, 0x92, 0x6E, 0xD7, 0xFF, 0x00, 0xC0, 0x96, - 0xBE, 0x89, 0x5A, 0xCA, 0xD6, 0xD8, 0xE6, 0x94, 0x6A, 0x69, 0x15, 0x1B, 0xAB, 0x6B, 0x79, 0x3F, - 0xC9, 0x7F, 0x5B, 0x21, 0xC9, 0xFF, 0x00, 0x04, 0xE0, 0xF0, 0xE6, 0x49, 0xFE, 0xC3, 0x45, 0x2E, - 0x0E, 0x0B, 0x69, 0xD1, 0xB0, 0x00, 0x8E, 0x41, 0x3C, 0xF6, 0x1F, 0xC8, 0x74, 0xC5, 0x73, 0x50, - 0xCE, 0x21, 0x4A, 0xAC, 0xEB, 0xFB, 0x46, 0xA7, 0x25, 0x67, 0xA6, 0x96, 0xDB, 0x74, 0xEE, 0xAC, - 0xAD, 0x6D, 0x5E, 0xBA, 0xDA, 0xE9, 0xD8, 0x97, 0xB5, 0xB2, 0x5C, 0x8A, 0xDD, 0x7D, 0xE7, 0x7D, - 0x36, 0xF2, 0xE9, 0xE5, 0xB7, 0x62, 0xA7, 0xFC, 0x3B, 0x97, 0x45, 0x18, 0x51, 0xE1, 0xEB, 0x70, - 0xAA, 0x7E, 0x5C, 0x5B, 0x2A, 0x85, 0xF9, 0x7A, 0x8F, 0x97, 0x8E, 0x83, 0xF2, 0xFC, 0xA2, 0xA6, - 0x7B, 0x51, 0xB6, 0xA5, 0x37, 0x6D, 0xB7, 0xD1, 0xF4, 0xEF, 0x7D, 0x3A, 0x5A, 0xCD, 0x76, 0xE8, - 0x6D, 0x1A, 0x6F, 0x49, 0x24, 0xD6, 0x96, 0xDD, 0xF9, 0x79, 0xF4, 0xD8, 0x9C, 0xFF, 0x00, 0xC1, - 0x37, 0xFC, 0x38, 0x02, 0xAF, 0xF6, 0x1C, 0x38, 0x00, 0x1C, 0x2D, 0x84, 0x7C, 0x81, 0xD3, 0x1D, - 0x3A, 0xFC, 0xA3, 0xB7, 0x4A, 0xA9, 0xE7, 0x3C, 0xD1, 0xB4, 0xEA, 0xB6, 0xFB, 0xAF, 0xF3, 0x76, - 0x7D, 0x6C, 0xAC, 0x95, 0xAD, 0x7B, 0x2B, 0x69, 0x9F, 0x35, 0x4D, 0x94, 0x55, 0xBF, 0xC4, 0xD7, - 0xE1, 0x7F, 0xEB, 0x6E, 0xC3, 0x1B, 0xFE, 0x09, 0xBB, 0xE1, 0xD0, 0x98, 0x5D, 0x09, 0x37, 0x28, - 0x1B, 0x73, 0x63, 0x1A, 0x82, 0x06, 0x32, 0x06, 0x07, 0x19, 0xDA, 0x3B, 0x7A, 0xE3, 0xAD, 0x72, - 0xAC, 0xC6, 0x2B, 0x9B, 0x96, 0xA3, 0x5A, 0x6D, 0xA2, 0x5F, 0x87, 0x6E, 0xDD, 0x76, 0x7B, 0x21, - 0xC5, 0xD4, 0xD1, 0x72, 0x2B, 0x79, 0x37, 0x7F, 0x2E, 0xDA, 0x7F, 0xC3, 0x2E, 0xC4, 0x43, 0xFE, - 0x09, 0xC5, 0xA1, 0x13, 0xB7, 0xFE, 0x11, 0xEB, 0x65, 0x52, 0x73, 0xF2, 0xDB, 0x28, 0x0B, 0x81, - 0xC0, 0x03, 0x68, 0xFE, 0xF1, 0xF4, 0xC7, 0x1E, 0x94, 0xA3, 0x9B, 0x5D, 0x28, 0xA9, 0xB4, 0xBB, - 0xBB, 0x7E, 0x9F, 0x76, 0x8B, 0x5D, 0x0B, 0x71, 0x94, 0x55, 0xD2, 0xE9, 0xD1, 0xCB, 0xFC, 0xFC, - 0xAD, 0xD9, 0x7A, 0x13, 0x8F, 0xF8, 0x26, 0xFF, 0x00, 0x87, 0x70, 0x33, 0xA0, 0x46, 0x48, 0x18, - 0x03, 0xFB, 0x3E, 0x1C, 0x70, 0x06, 0x38, 0xE3, 0x00, 0x10, 0x6B, 0x65, 0x9A, 0x41, 0x5A, 0x2E, - 0x4E, 0xDF, 0x2F, 0xB9, 0x6A, 0xBE, 0xED, 0x17, 0x97, 0x6C, 0xBF, 0x7B, 0x74, 0xB9, 0x17, 0x92, - 0xE6, 0x7F, 0xD7, 0x96, 0x9F, 0x79, 0x9F, 0x27, 0xFC, 0x13, 0x57, 0xC3, 0xAA, 0x18, 0xA7, 0x87, - 0xED, 0xDB, 0x04, 0x61, 0x0D, 0x84, 0x21, 0xB9, 0xC7, 0x03, 0xE4, 0x3C, 0x0C, 0x7F, 0x9E, 0x2B, - 0xC5, 0x9D, 0x68, 0xC6, 0x76, 0x8B, 0x76, 0xF5, 0xFD, 0x2D, 0xD0, 0xEA, 0x85, 0x49, 0x72, 0xA5, - 0xC8, 0xBE, 0xF7, 0xD3, 0xD1, 0xFF, 0x00, 0x5E, 0x5D, 0x22, 0x8F, 0xFE, 0x09, 0xAF, 0xE1, 0xF6, - 0x21, 0x4F, 0x87, 0x6D, 0xA3, 0x18, 0x1C, 0xB5, 0x84, 0x40, 0x0C, 0x8E, 0x00, 0x1E, 0x57, 0xD2, - 0x97, 0xB7, 0x8A, 0x4A, 0xCE, 0x5F, 0x7F, 0xFC, 0x02, 0xF9, 0x9D, 0xB4, 0x8A, 0xFB, 0xE5, 0xFE, - 0x64, 0xBF, 0xF0, 0xED, 0x3F, 0x0E, 0xED, 0x18, 0xD0, 0x2D, 0xF3, 0xD0, 0x2F, 0xF6, 0x6C, 0x5C, - 0x0C, 0xE0, 0x67, 0xF7, 0x7C, 0x7F, 0xF5, 0xBD, 0xB8, 0x85, 0x88, 0x4A, 0xDA, 0xBB, 0x7A, 0xFF, - 0x00, 0xC0, 0x21, 0x55, 0x76, 0x56, 0x82, 0xB7, 0xAC, 0xBF, 0xCC, 0x6B, 0xFF, 0x00, 0xC1, 0x35, - 0x7C, 0x3A, 0x8A, 0x36, 0xF8, 0x7E, 0xD9, 0xF8, 0xFB, 0xAB, 0xA7, 0xC4, 0x08, 0x00, 0x75, 0xFF, - 0x00, 0x57, 0x8E, 0xC2, 0xA9, 0x57, 0x49, 0x2D, 0x5D, 0xBD, 0x7F, 0xE0, 0x15, 0x19, 0xC9, 0xE9, - 0xC8, 0xAD, 0xEB, 0x2B, 0x7E, 0x67, 0xF2, 0x2B, 0xFF, 0x00, 0x05, 0xB0, 0xF8, 0x05, 0x65, 0xFB, - 0x3F, 0x7F, 0xC1, 0x64, 0xFF, 0x00, 0xE0, 0x95, 0x5E, 0x1F, 0xB1, 0xB0, 0x8F, 0x4F, 0x8F, 0x5E, - 0xBF, 0xF8, 0x7B, 0xAE, 0x3C, 0x51, 0xC2, 0xB0, 0x6E, 0x65, 0xF8, 0xAF, 0x3C, 0x3B, 0x8A, 0x85, - 0x51, 0xD2, 0x10, 0x3A, 0x76, 0xAD, 0xB0, 0x32, 0x53, 0xCC, 0xB0, 0xF6, 0x6E, 0xDC, 0xF0, 0xDF, - 0xFC, 0x48, 0x8A, 0xDA, 0xE1, 0x6A, 0x69, 0x6F, 0x75, 0xF7, 0xEC, 0xFB, 0x9F, 0xB2, 0xF5, 0xFA, - 0x79, 0xF2, 0x21, 0x40, 0x05, 0x00, 0x14, 0x01, 0xFA, 0xF5, 0xFF, 0x00, 0x04, 0x4A, 0xB4, 0xB7, - 0xBA, 0xF0, 0x27, 0xED, 0xD0, 0x27, 0x8F, 0x78, 0x8F, 0xF6, 0xE7, 0x84, 0x20, 0x0E, 0xC9, 0xB4, - 0x1F, 0x80, 0xFF, 0x00, 0x0C, 0x72, 0x38, 0x23, 0xD0, 0x57, 0xE7, 0x5C, 0x41, 0xFF, 0x00, 0x23, - 0x49, 0xFA, 0x47, 0xFF, 0x00, 0x49, 0x47, 0xD4, 0x65, 0x7F, 0xEE, 0x51, 0xF9, 0xFE, 0x67, 0xED, - 0x6F, 0xF6, 0x4E, 0x9F, 0xFF, 0x00, 0x3C, 0x0F, 0xFD, 0xFE, 0x93, 0xFC, 0x6B, 0xC4, 0xB2, 0xD3, - 0x43, 0xD1, 0x0F, 0xEC, 0x9D, 0x3F, 0xFE, 0x78, 0x1F, 0xFB, 0xFD, 0x27, 0xF8, 0xD1, 0x65, 0x64, - 0xAD, 0xA0, 0x07, 0xF6, 0x4E, 0x9F, 0xFF, 0x00, 0x3C, 0x0F, 0xFD, 0xFE, 0x93, 0xFC, 0x69, 0x80, - 0x7F, 0x64, 0xE9, 0xFF, 0x00, 0xF3, 0xC0, 0xFF, 0x00, 0xDF, 0xE9, 0x3F, 0xC6, 0x80, 0x0F, 0xEC, - 0x9D, 0x3F, 0xFE, 0x78, 0x1F, 0xFB, 0xFD, 0x27, 0xF8, 0xD2, 0x49, 0x2D, 0x90, 0xAC, 0xBB, 0x07, - 0xF6, 0x4E, 0x9F, 0xFF, 0x00, 0x3C, 0x0F, 0xFD, 0xFE, 0x93, 0xFC, 0x69, 0x82, 0x49, 0x24, 0x92, - 0xD0, 0x3F, 0xB2, 0x74, 0xFF, 0x00, 0xF9, 0xE0, 0x7F, 0xEF, 0xF4, 0x9F, 0xE3, 0x4A, 0xCB, 0x4D, - 0x06, 0x1F, 0xD9, 0x3A, 0x7F, 0xFC, 0xF0, 0x3F, 0xF7, 0xFA, 0x4F, 0xF1, 0xA2, 0xCB, 0x4D, 0x00, - 0x3F, 0xB2, 0x74, 0xFF, 0x00, 0xF9, 0xE0, 0x7F, 0xEF, 0xF4, 0x9F, 0xE3, 0x45, 0x96, 0x9A, 0x09, - 0x24, 0xB6, 0x41, 0xFD, 0x93, 0xA7, 0xFF, 0x00, 0xCF, 0x03, 0xFF, 0x00, 0x7F, 0xA4, 0xFF, 0x00, - 0x1A, 0x12, 0x49, 0x59, 0x2D, 0x06, 0x1F, 0xD9, 0x3A, 0x7F, 0xFC, 0xF0, 0x3F, 0xF7, 0xFA, 0x4F, - 0xF1, 0xA6, 0x01, 0xFD, 0x93, 0xA7, 0xFF, 0x00, 0xCF, 0x03, 0xFF, 0x00, 0x7F, 0xA4, 0xFF, 0x00, - 0x1A, 0x49, 0x24, 0xAC, 0x96, 0x82, 0x49, 0x25, 0x64, 0xB4, 0x0F, 0xEC, 0x9D, 0x3F, 0xFE, 0x78, - 0x1F, 0xFB, 0xFD, 0x27, 0xF8, 0xD1, 0x65, 0xA6, 0x83, 0x0F, 0xEC, 0x9D, 0x3F, 0xFE, 0x78, 0x1F, - 0xFB, 0xFD, 0x27, 0xF8, 0xD3, 0x15, 0x96, 0x9A, 0x07, 0xF6, 0x4E, 0x9F, 0xFF, 0x00, 0x3C, 0x0F, - 0xFD, 0xFE, 0x93, 0xFC, 0x69, 0x24, 0x92, 0xB2, 0x5A, 0x0C, 0x3F, 0xB2, 0x74, 0xFF, 0x00, 0xF9, - 0xE0, 0x7F, 0xEF, 0xF4, 0x9F, 0xE3, 0x45, 0x95, 0xAD, 0x6D, 0x00, 0x3F, 0xB2, 0x74, 0xFF, 0x00, - 0xF9, 0xE0, 0x7F, 0xEF, 0xF4, 0x9F, 0xE3, 0x4C, 0x56, 0x5D, 0x83, 0xFB, 0x27, 0x4F, 0xFF, 0x00, - 0x9E, 0x07, 0xFE, 0xFF, 0x00, 0x49, 0xFE, 0x34, 0x0C, 0x3F, 0xB2, 0x74, 0xFF, 0x00, 0xF9, 0xE0, - 0x7F, 0xEF, 0xF4, 0x9F, 0xE3, 0x40, 0x07, 0xF6, 0x4E, 0x9F, 0xFF, 0x00, 0x3C, 0x0F, 0xFD, 0xFE, - 0x93, 0xFC, 0x68, 0x15, 0x95, 0xAD, 0x6D, 0x03, 0xFB, 0x27, 0x4F, 0xFF, 0x00, 0x9E, 0x07, 0xFE, - 0xFF, 0x00, 0x49, 0xFE, 0x34, 0x92, 0x4B, 0x64, 0x30, 0xFE, 0xC9, 0xD3, 0xFF, 0x00, 0xE7, 0x81, - 0xFF, 0x00, 0xBF, 0xD2, 0x7F, 0x8D, 0x09, 0x25, 0x6B, 0x20, 0x0F, 0xEC, 0x9D, 0x3F, 0xFE, 0x78, - 0x1F, 0xFB, 0xFD, 0x27, 0xF8, 0xD1, 0x65, 0x64, 0xAD, 0xA0, 0x92, 0x4B, 0x64, 0x1F, 0xD9, 0x3A, - 0x7F, 0xFC, 0xF0, 0x3F, 0xF7, 0xFA, 0x4F, 0xF1, 0xA6, 0x30, 0xFE, 0xC9, 0xD3, 0xFF, 0x00, 0xE7, - 0x81, 0xFF, 0x00, 0xBF, 0xD2, 0x7F, 0x8D, 0x02, 0xB2, 0xD3, 0x40, 0xFE, 0xC9, 0xD3, 0xFF, 0x00, - 0xE7, 0x81, 0xFF, 0x00, 0xBF, 0xD2, 0x7F, 0x8D, 0x00, 0x92, 0x5B, 0x20, 0xFE, 0xC9, 0xD3, 0xFF, - 0x00, 0xE7, 0x81, 0xFF, 0x00, 0xBF, 0xD2, 0x7F, 0x8D, 0x03, 0x0F, 0xEC, 0x9D, 0x3F, 0xFE, 0x78, - 0x1F, 0xFB, 0xFD, 0x27, 0xF8, 0xD0, 0x01, 0xFD, 0x93, 0xA7, 0xFF, 0x00, 0xCF, 0x03, 0xFF, 0x00, - 0x7F, 0xA4, 0xFF, 0x00, 0x1A, 0x00, 0x3F, 0xB2, 0x74, 0xFF, 0x00, 0xF9, 0xE0, 0x7F, 0xEF, 0xF4, - 0x9F, 0xE3, 0x40, 0x07, 0xF6, 0x4E, 0x9F, 0xFF, 0x00, 0x3C, 0x0F, 0xFD, 0xFE, 0x93, 0xFC, 0x69, - 0x24, 0x96, 0xC8, 0x56, 0x5D, 0x83, 0xFB, 0x27, 0x4F, 0xFF, 0x00, 0x9E, 0x07, 0xFE, 0xFF, 0x00, - 0x49, 0xFE, 0x34, 0x59, 0x76, 0x04, 0x92, 0x56, 0x4B, 0x40, 0xFE, 0xC9, 0xD3, 0xFF, 0x00, 0xE7, - 0x81, 0xFF, 0x00, 0xBF, 0xD2, 0x7F, 0x8D, 0x31, 0x87, 0xF6, 0x4E, 0x9F, 0xFF, 0x00, 0x3C, 0x0F, - 0xFD, 0xFE, 0x93, 0xFC, 0x68, 0x15, 0x95, 0x92, 0xB6, 0x81, 0xFD, 0x93, 0xA7, 0xFF, 0x00, 0xCF, - 0x03, 0xFF, 0x00, 0x7F, 0xA4, 0xFF, 0x00, 0x1A, 0x49, 0x25, 0xB2, 0x18, 0x7F, 0x64, 0xE9, 0xFF, - 0x00, 0xF3, 0xC0, 0xFF, 0x00, 0xDF, 0xE9, 0x3F, 0xC6, 0x98, 0x07, 0xF6, 0x4E, 0x9F, 0xFF, 0x00, - 0x3C, 0x0F, 0xFD, 0xFE, 0x93, 0xFC, 0x68, 0x15, 0x95, 0xAD, 0x6D, 0x03, 0xFB, 0x27, 0x4F, 0xFF, - 0x00, 0x9E, 0x07, 0xFE, 0xFF, 0x00, 0x49, 0xFE, 0x34, 0x0C, 0x3F, 0xB2, 0x74, 0xFF, 0x00, 0xF9, - 0xE0, 0x7F, 0xEF, 0xF4, 0x9F, 0xE3, 0x49, 0x24, 0xB6, 0x42, 0x49, 0x2D, 0x90, 0x7F, 0x64, 0xE9, - 0xFF, 0x00, 0xF3, 0xC0, 0xFF, 0x00, 0xDF, 0xE9, 0x3F, 0xC6, 0x8B, 0x2B, 0x5A, 0xDA, 0x05, 0x95, - 0xAD, 0x6D, 0x03, 0xFB, 0x27, 0x4F, 0xFF, 0x00, 0x9E, 0x07, 0xFE, 0xFF, 0x00, 0x49, 0xFE, 0x34, - 0xC6, 0x1F, 0xD9, 0x3A, 0x7F, 0xFC, 0xF0, 0x3F, 0xF7, 0xFA, 0x4F, 0xF1, 0xA0, 0x03, 0xFB, 0x27, - 0x4F, 0xFF, 0x00, 0x9E, 0x07, 0xFE, 0xFF, 0x00, 0x49, 0xFE, 0x34, 0xAC, 0xAD, 0x6B, 0x68, 0x24, - 0x92, 0xD9, 0x07, 0xF6, 0x4E, 0x9F, 0xFF, 0x00, 0x3C, 0x0F, 0xFD, 0xFE, 0x93, 0xFC, 0x68, 0x49, - 0x24, 0x92, 0x5A, 0x0C, 0x3F, 0xB2, 0x74, 0xFF, 0x00, 0xF9, 0xE0, 0x7F, 0xEF, 0xF4, 0x9F, 0xE3, - 0x42, 0x49, 0x6C, 0x84, 0x92, 0x5B, 0x20, 0xFE, 0xC9, 0xD3, 0xFF, 0x00, 0xE7, 0x81, 0xFF, 0x00, - 0xBF, 0xD2, 0x7F, 0x8D, 0x16, 0x5A, 0x68, 0x09, 0x25, 0xB2, 0x0F, 0xEC, 0x9D, 0x3F, 0xFE, 0x78, - 0x1F, 0xFB, 0xFD, 0x27, 0xF8, 0xD3, 0x18, 0x7F, 0x64, 0xE9, 0xFF, 0x00, 0xF3, 0xC0, 0xFF, 0x00, - 0xDF, 0xE9, 0x3F, 0xC6, 0x80, 0x0F, 0xEC, 0x9D, 0x3F, 0xFE, 0x78, 0x1F, 0xFB, 0xFD, 0x27, 0xF8, - 0xD2, 0xB2, 0xD3, 0x41, 0x24, 0x92, 0x49, 0x2D, 0x03, 0xFB, 0x27, 0x4F, 0xFF, 0x00, 0x9E, 0x07, - 0xFE, 0xFF, 0x00, 0x49, 0xFE, 0x34, 0x59, 0x5A, 0xD6, 0xD0, 0x2C, 0xAD, 0x6B, 0x68, 0x1F, 0xD9, - 0x3A, 0x7F, 0xFC, 0xF0, 0x3F, 0xF7, 0xFA, 0x4F, 0xF1, 0xA6, 0x16, 0x56, 0xB5, 0xB4, 0x0F, 0xEC, - 0x9D, 0x3F, 0xFE, 0x78, 0x1F, 0xFB, 0xFD, 0x27, 0xF8, 0xD2, 0x49, 0x2D, 0x90, 0xC3, 0xFB, 0x27, - 0x4F, 0xFF, 0x00, 0x9E, 0x07, 0xFE, 0xFF, 0x00, 0x49, 0xFE, 0x34, 0xC0, 0x3F, 0xB2, 0x74, 0xFF, - 0x00, 0xF9, 0xE0, 0x7F, 0xEF, 0xF4, 0x9F, 0xE3, 0x40, 0xAC, 0xB4, 0xD0, 0x3F, 0xB2, 0x74, 0xFF, - 0x00, 0xF9, 0xE0, 0x7F, 0xEF, 0xF4, 0x9F, 0xE3, 0x49, 0x24, 0xB6, 0x43, 0x0F, 0xEC, 0x9D, 0x3F, - 0xFE, 0x78, 0x1F, 0xFB, 0xFD, 0x27, 0xF8, 0xD0, 0x92, 0x5B, 0x20, 0x0F, 0xEC, 0x9D, 0x3F, 0xFE, - 0x78, 0x1F, 0xFB, 0xFD, 0x27, 0xF8, 0xD3, 0x00, 0xFE, 0xC9, 0xD3, 0xFF, 0x00, 0xE7, 0x81, 0xFF, - 0x00, 0xBF, 0xD2, 0x7F, 0x8D, 0x2B, 0x2D, 0x34, 0x00, 0xFE, 0xC9, 0xD3, 0xFF, 0x00, 0xE7, 0x81, - 0xFF, 0x00, 0xBF, 0xD2, 0x7F, 0x8D, 0x16, 0x5D, 0x85, 0x65, 0x64, 0xAD, 0xA0, 0x7F, 0x64, 0xE9, - 0xFF, 0x00, 0xF3, 0xC0, 0xFF, 0x00, 0xDF, 0xE9, 0x3F, 0xC6, 0x8B, 0x2B, 0x5A, 0xDA, 0x02, 0x49, - 0x24, 0x92, 0xD0, 0x3F, 0xB2, 0x74, 0xFF, 0x00, 0xF9, 0xE0, 0x7F, 0xEF, 0xF4, 0x9F, 0xE3, 0x4C, - 0x61, 0xFD, 0x93, 0xA7, 0xFF, 0x00, 0xCF, 0x03, 0xFF, 0x00, 0x7F, 0xA4, 0xFF, 0x00, 0x1A, 0x05, - 0x65, 0x6B, 0x5B, 0x43, 0xF8, 0x00, 0xFF, 0x00, 0x83, 0x9D, 0xE1, 0x8A, 0xDF, 0xFE, 0x0B, 0x97, - 0xFF, 0x00, 0x04, 0x86, 0x8A, 0x14, 0xD8, 0x89, 0xA5, 0x7C, 0x3D, 0x0A, 0xB9, 0x2D, 0x80, 0x7E, - 0x2F, 0xDD, 0x1C, 0x64, 0xFD, 0x4D, 0x76, 0x65, 0x9F, 0xF2, 0x30, 0xC3, 0xFF, 0x00, 0x8E, 0x1F, - 0xFA, 0x52, 0x30, 0xC4, 0xA4, 0xB0, 0xB5, 0x2C, 0xBE, 0xCB, 0xFC, 0x8F, 0xB6, 0x2B, 0xF5, 0x33, - 0xE3, 0x82, 0x80, 0x0A, 0x00, 0x28, 0x03, 0xF6, 0x0B, 0xFE, 0x08, 0x85, 0xFF, 0x00, 0x22, 0x27, - 0xED, 0xD7, 0xFF, 0x00, 0x67, 0xCF, 0x07, 0xFE, 0xA8, 0x6F, 0x86, 0x55, 0xF9, 0xD7, 0x10, 0x7F, - 0xC8, 0xD2, 0x7E, 0x91, 0xFF, 0x00, 0xD2, 0x51, 0xF5, 0x19, 0x5F, 0xFB, 0x94, 0x7E, 0x7F, 0x99, - 0xFB, 0x6D, 0x5E, 0x29, 0xE8, 0x85, 0x00, 0x14, 0x00, 0x50, 0x01, 0x40, 0x05, 0x00, 0x14, 0x00, - 0x50, 0x01, 0x40, 0x05, 0x00, 0x14, 0x00, 0x50, 0x01, 0x40, 0x05, 0x00, 0x14, 0x00, 0x50, 0x01, - 0x40, 0x05, 0x00, 0x14, 0x00, 0x50, 0x01, 0x40, 0x05, 0x00, 0x14, 0x00, 0x50, 0x01, 0x40, 0x05, - 0x00, 0x14, 0x00, 0x50, 0x01, 0x40, 0x05, 0x00, 0x14, 0x00, 0x50, 0x01, 0x40, 0x05, 0x00, 0x14, - 0x00, 0x50, 0x01, 0x40, 0x05, 0x00, 0x14, 0x00, 0x50, 0x01, 0x40, 0x05, 0x00, 0x14, 0x00, 0x50, - 0x01, 0x40, 0x05, 0x00, 0x14, 0x00, 0x50, 0x01, 0x40, 0x05, 0x00, 0x14, 0x00, 0x50, 0x01, 0x40, - 0x05, 0x00, 0x14, 0x00, 0x50, 0x01, 0x40, 0x05, 0x00, 0x14, 0x00, 0x50, 0x01, 0x40, 0x05, 0x00, - 0x7F, 0x9F, 0x9F, 0xFC, 0x1C, 0xFB, 0xFF, 0x00, 0x29, 0xCF, 0xFF, 0x00, 0x82, 0x43, 0xFF, 0x00, - 0xD8, 0x2B, 0xE1, 0xEF, 0xFE, 0xAD, 0xEB, 0x9A, 0xEC, 0xCB, 0x3F, 0xE4, 0x61, 0x87, 0xFF, 0x00, - 0x1C, 0x3F, 0xF4, 0xA4, 0x73, 0xE2, 0x7F, 0xDD, 0x6A, 0x7F, 0x85, 0xFE, 0x47, 0xDA, 0x95, 0xFA, - 0x99, 0xF1, 0xC1, 0x40, 0x05, 0x00, 0x14, 0x01, 0xFB, 0x05, 0xFF, 0x00, 0x04, 0x42, 0xFF, 0x00, - 0x91, 0x13, 0xF6, 0xEB, 0xFF, 0x00, 0xB3, 0xE7, 0x83, 0xFF, 0x00, 0x54, 0x37, 0xC3, 0x2A, 0xFC, - 0xEB, 0x88, 0x3F, 0xE4, 0x69, 0x3F, 0x48, 0xFF, 0x00, 0xE9, 0x28, 0xFA, 0x8C, 0xAF, 0xFD, 0xCA, - 0x3F, 0x3F, 0xCC, 0xFD, 0xB6, 0xAF, 0x14, 0xF4, 0x42, 0x80, 0x0A, 0x00, 0x28, 0x00, 0xA0, 0x02, - 0x80, 0x0A, 0x00, 0x28, 0x00, 0xA0, 0x02, 0x80, 0x0A, 0x00, 0x28, 0x00, 0xA0, 0x02, 0x80, 0x0A, - 0x00, 0x28, 0x00, 0xA0, 0x02, 0x80, 0x0A, 0x00, 0x28, 0x00, 0xA0, 0x02, 0x80, 0x0A, 0x00, 0x28, - 0x00, 0xA0, 0x02, 0x80, 0x0A, 0x00, 0x28, 0x00, 0xA0, 0x02, 0x80, 0x0A, 0x00, 0x28, 0x00, 0xA0, - 0x02, 0x80, 0x0A, 0x00, 0x28, 0x00, 0xA0, 0x02, 0x80, 0x0A, 0x00, 0x28, 0x00, 0xA0, 0x02, 0x80, - 0x0A, 0x00, 0x28, 0x00, 0xA0, 0x02, 0x80, 0x0A, 0x00, 0x28, 0x00, 0xA0, 0x02, 0x80, 0x0A, 0x00, - 0x28, 0x00, 0xA0, 0x02, 0x80, 0x0A, 0x00, 0x28, 0x00, 0xA0, 0x02, 0x80, 0x0A, 0x00, 0x28, 0x00, - 0xA0, 0x02, 0x80, 0x3F, 0xCF, 0xCF, 0xFE, 0x0E, 0x7D, 0xFF, 0x00, 0x94, 0xE7, 0xFF, 0x00, 0xC1, - 0x21, 0xFF, 0x00, 0xEC, 0x15, 0xF0, 0xF7, 0xFF, 0x00, 0x56, 0xF5, 0xCD, 0x76, 0x65, 0x9F, 0xF2, - 0x30, 0xC3, 0xFF, 0x00, 0x8E, 0x1F, 0xFA, 0x52, 0x39, 0xF1, 0x3F, 0xEE, 0xB5, 0x3F, 0xC2, 0xFF, - 0x00, 0x23, 0xED, 0x4A, 0xFD, 0x4C, 0xF8, 0xE0, 0xA0, 0x02, 0x80, 0x0A, 0x00, 0xFD, 0x82, 0xFF, - 0x00, 0x82, 0x21, 0x7F, 0xC8, 0x89, 0xFB, 0x75, 0xFF, 0x00, 0xD9, 0xF3, 0xC1, 0xFF, 0x00, 0xAA, - 0x1B, 0xE1, 0x95, 0x7E, 0x75, 0xC4, 0x1F, 0xF2, 0x34, 0x9F, 0xA4, 0x7F, 0xF4, 0x94, 0x7D, 0x46, - 0x57, 0xFE, 0xE5, 0x1F, 0x9F, 0xE6, 0x7E, 0xDB, 0x57, 0x8A, 0x7A, 0x21, 0x40, 0x05, 0x00, 0x14, - 0x00, 0x50, 0x01, 0x40, 0x05, 0x00, 0x14, 0x00, 0x50, 0x01, 0x40, 0x05, 0x00, 0x14, 0x00, 0x50, - 0x01, 0x40, 0x05, 0x00, 0x14, 0x00, 0x50, 0x01, 0x40, 0x05, 0x00, 0x14, 0x00, 0x50, 0x01, 0x40, - 0x05, 0x00, 0x14, 0x00, 0x50, 0x01, 0x40, 0x05, 0x00, 0x14, 0x00, 0x50, 0x01, 0x40, 0x05, 0x00, - 0x14, 0x00, 0x50, 0x01, 0x40, 0x05, 0x00, 0x14, 0x00, 0x50, 0x01, 0x40, 0x05, 0x00, 0x14, 0x00, - 0x50, 0x01, 0x40, 0x05, 0x00, 0x14, 0x00, 0x50, 0x01, 0x40, 0x05, 0x00, 0x14, 0x00, 0x50, 0x01, - 0x40, 0x05, 0x00, 0x14, 0x00, 0x50, 0x01, 0x40, 0x05, 0x00, 0x14, 0x00, 0x50, 0x01, 0x40, 0x05, - 0x00, 0x14, 0x00, 0x50, 0x01, 0x40, 0x1F, 0xE7, 0xE7, 0xFF, 0x00, 0x07, 0x3E, 0xFF, 0x00, 0xCA, - 0x73, 0xFF, 0x00, 0xE0, 0x90, 0xFF, 0x00, 0xF6, 0x0A, 0xF8, 0x7B, 0xFF, 0x00, 0xAB, 0x7A, 0xE6, - 0xBB, 0x32, 0xCF, 0xF9, 0x18, 0x61, 0xFF, 0x00, 0xC7, 0x0F, 0xFD, 0x29, 0x1C, 0xF8, 0x9F, 0xF7, - 0x5A, 0x9F, 0xE1, 0x7F, 0x91, 0xF6, 0xA5, 0x7E, 0xA6, 0x7C, 0x70, 0x50, 0x01, 0x40, 0x05, 0x00, - 0x7E, 0xC1, 0x7F, 0xC1, 0x10, 0xBF, 0xE4, 0x44, 0xFD, 0xBA, 0xFF, 0x00, 0xEC, 0xF9, 0xE0, 0xFF, - 0x00, 0xD5, 0x0D, 0xF0, 0xCA, 0xBF, 0x3A, 0xE2, 0x0F, 0xF9, 0x1A, 0x4F, 0xD2, 0x3F, 0xFA, 0x4A, - 0x3E, 0xA3, 0x2B, 0xFF, 0x00, 0x72, 0x8F, 0xCF, 0xF3, 0x3F, 0x6D, 0xAB, 0xC5, 0x3D, 0x10, 0xA0, - 0x02, 0x80, 0x0A, 0x00, 0x28, 0x00, 0xA0, 0x02, 0x80, 0x0A, 0x00, 0x28, 0x00, 0xA0, 0x02, 0x80, - 0x0A, 0x00, 0x28, 0x00, 0xA0, 0x02, 0x80, 0x0A, 0x00, 0x28, 0x00, 0xA0, 0x02, 0x80, 0x0A, 0x00, - 0x28, 0x00, 0xA0, 0x02, 0x80, 0x0A, 0x00, 0x28, 0x00, 0xA0, 0x02, 0x80, 0x0A, 0x00, 0x28, 0x00, - 0xA0, 0x02, 0x80, 0x0A, 0x00, 0x28, 0x00, 0xA0, 0x02, 0x80, 0x0A, 0x00, 0x28, 0x00, 0xA0, 0x02, - 0x80, 0x0A, 0x00, 0x28, 0x00, 0xA0, 0x02, 0x80, 0x0A, 0x00, 0x28, 0x00, 0xA0, 0x02, 0x80, 0x0A, - 0x00, 0x28, 0x00, 0xA0, 0x02, 0x80, 0x0A, 0x00, 0x28, 0x00, 0xA0, 0x02, 0x80, 0x0A, 0x00, 0x28, - 0x00, 0xA0, 0x02, 0x80, 0x0A, 0x00, 0x28, 0x00, 0xA0, 0x0F, 0xF3, 0xF3, 0xFF, 0x00, 0x83, 0x9F, - 0x7F, 0xE5, 0x39, 0xFF, 0x00, 0xF0, 0x48, 0x7F, 0xFB, 0x05, 0x7C, 0x3D, 0xFF, 0x00, 0xD5, 0xBD, - 0x73, 0x5D, 0x99, 0x67, 0xFC, 0x8C, 0x30, 0xFF, 0x00, 0xE3, 0x87, 0xFE, 0x94, 0x8E, 0x7C, 0x4F, - 0xFB, 0xAD, 0x4F, 0xF0, 0xBF, 0xC8, 0xFB, 0x52, 0xBF, 0x53, 0x3E, 0x38, 0x28, 0x00, 0xA0, 0x02, - 0x80, 0x3F, 0x60, 0xBF, 0xE0, 0x88, 0x5F, 0xF2, 0x22, 0x7E, 0xDD, 0x7F, 0xF6, 0x7C, 0xF0, 0x7F, - 0xEA, 0x86, 0xF8, 0x65, 0x5F, 0x9D, 0x71, 0x07, 0xFC, 0x8D, 0x27, 0xE9, 0x1F, 0xFD, 0x25, 0x1F, - 0x51, 0x95, 0xFF, 0x00, 0xB9, 0x47, 0xE7, 0xF9, 0x9F, 0xB6, 0xD5, 0xE2, 0x9E, 0x88, 0x50, 0x01, - 0x40, 0x05, 0x00, 0x14, 0x00, 0x50, 0x01, 0x40, 0x05, 0x00, 0x14, 0x00, 0x50, 0x01, 0x40, 0x05, - 0x00, 0x14, 0x00, 0x50, 0x01, 0x40, 0x05, 0x00, 0x14, 0x00, 0x50, 0x01, 0x40, 0x05, 0x00, 0x14, - 0x00, 0x50, 0x01, 0x40, 0x05, 0x00, 0x14, 0x00, 0x50, 0x01, 0x40, 0x05, 0x00, 0x14, 0x00, 0x50, - 0x01, 0x40, 0x05, 0x00, 0x14, 0x00, 0x50, 0x01, 0x40, 0x05, 0x00, 0x14, 0x00, 0x50, 0x01, 0x40, - 0x05, 0x00, 0x14, 0x00, 0x50, 0x01, 0x40, 0x05, 0x00, 0x14, 0x00, 0x50, 0x01, 0x40, 0x05, 0x00, - 0x14, 0x00, 0x50, 0x01, 0x40, 0x05, 0x00, 0x14, 0x00, 0x50, 0x01, 0x40, 0x05, 0x00, 0x14, 0x00, - 0x50, 0x01, 0x40, 0x05, 0x00, 0x14, 0x00, 0x50, 0x07, 0xF9, 0xF9, 0xFF, 0x00, 0xC1, 0xCF, 0xBF, - 0xF2, 0x9C, 0xFF, 0x00, 0xF8, 0x24, 0x3F, 0xFD, 0x82, 0xBE, 0x1E, 0xFF, 0x00, 0xEA, 0xDE, 0xB9, - 0xAE, 0xCC, 0xB3, 0xFE, 0x46, 0x18, 0x7F, 0xF1, 0xC3, 0xFF, 0x00, 0x4A, 0x47, 0x3E, 0x27, 0xFD, - 0xD6, 0xA7, 0xF8, 0x5F, 0xE4, 0x7D, 0xA9, 0x5F, 0xA9, 0x9F, 0x1C, 0x14, 0x00, 0x50, 0x01, 0x40, - 0x1F, 0xB0, 0x5F, 0xF0, 0x44, 0x2F, 0xF9, 0x11, 0x3F, 0x6E, 0xBF, 0xFB, 0x3E, 0x78, 0x3F, 0xF5, - 0x43, 0x7C, 0x32, 0xAF, 0xCE, 0xB8, 0x83, 0xFE, 0x46, 0x93, 0xF4, 0x8F, 0xFE, 0x92, 0x8F, 0xA8, - 0xCA, 0xFF, 0x00, 0xDC, 0xA3, 0xF3, 0xFC, 0xCF, 0xDB, 0x6A, 0xF1, 0x4F, 0x44, 0x28, 0x00, 0xA0, - 0x02, 0x80, 0x0A, 0x00, 0x28, 0x00, 0xA0, 0x02, 0x80, 0x0A, 0x00, 0x28, 0x00, 0xA0, 0x02, 0x80, - 0x0A, 0x00, 0x28, 0x00, 0xA0, 0x02, 0x80, 0x0A, 0x00, 0x28, 0x00, 0xA0, 0x02, 0x80, 0x0A, 0x00, - 0x28, 0x00, 0xA0, 0x02, 0x80, 0x0A, 0x00, 0x28, 0x00, 0xA0, 0x02, 0x80, 0x0A, 0x00, 0x28, 0x00, - 0xA0, 0x02, 0x80, 0x0A, 0x00, 0x28, 0x00, 0xA0, 0x02, 0x80, 0x0A, 0x00, 0x28, 0x00, 0xA0, 0x02, - 0x80, 0x0A, 0x00, 0x28, 0x00, 0xA0, 0x02, 0x80, 0x0A, 0x00, 0x28, 0x00, 0xA0, 0x02, 0x80, 0x0A, - 0x00, 0x28, 0x00, 0xA0, 0x02, 0x80, 0x0A, 0x00, 0x28, 0x00, 0xA0, 0x02, 0x80, 0x0A, 0x00, 0x28, - 0x00, 0xA0, 0x02, 0x80, 0x0A, 0x00, 0x28, 0x03, 0xFC, 0xFC, 0xFF, 0x00, 0xE0, 0xE7, 0xDF, 0xF9, - 0x4E, 0x7F, 0xFC, 0x12, 0x1F, 0xFE, 0xC1, 0x5F, 0x0F, 0x7F, 0xF5, 0x6F, 0x5C, 0xD7, 0x66, 0x59, - 0xFF, 0x00, 0x23, 0x0C, 0x3F, 0xF8, 0xE1, 0xFF, 0x00, 0xA5, 0x23, 0x9F, 0x13, 0xFE, 0xEB, 0x53, - 0xFC, 0x2F, 0xF2, 0x3E, 0xD4, 0xAF, 0xD4, 0xCF, 0x8E, 0x0A, 0x00, 0x28, 0x00, 0xA0, 0x0F, 0xD8, - 0x2F, 0xF8, 0x22, 0x17, 0xFC, 0x88, 0x9F, 0xB7, 0x5F, 0xFD, 0x9F, 0x3C, 0x1F, 0xFA, 0xA1, 0xBE, - 0x19, 0x57, 0xE7, 0x5C, 0x41, 0xFF, 0x00, 0x23, 0x49, 0xFA, 0x47, 0xFF, 0x00, 0x49, 0x47, 0xD4, - 0x65, 0x7F, 0xEE, 0x51, 0xF9, 0xFE, 0x67, 0xED, 0xB5, 0x78, 0xA7, 0xA2, 0x14, 0x00, 0x50, 0x01, - 0x40, 0x05, 0x00, 0x14, 0x00, 0x50, 0x01, 0x40, 0x05, 0x00, 0x14, 0x00, 0x50, 0x01, 0x40, 0x05, - 0x00, 0x14, 0x00, 0x50, 0x01, 0x40, 0x05, 0x00, 0x14, 0x00, 0x50, 0x01, 0x40, 0x05, 0x00, 0x14, - 0x00, 0x50, 0x01, 0x40, 0x05, 0x00, 0x14, 0x00, 0x50, 0x01, 0x40, 0x05, 0x00, 0x14, 0x00, 0x50, - 0x01, 0x40, 0x05, 0x00, 0x14, 0x00, 0x50, 0x01, 0x40, 0x05, 0x00, 0x14, 0x00, 0x50, 0x01, 0x40, - 0x05, 0x00, 0x14, 0x00, 0x50, 0x01, 0x40, 0x05, 0x00, 0x14, 0x00, 0x50, 0x01, 0x40, 0x05, 0x00, - 0x14, 0x00, 0x50, 0x01, 0x40, 0x05, 0x00, 0x14, 0x00, 0x50, 0x01, 0x40, 0x05, 0x00, 0x14, 0x00, - 0x50, 0x01, 0x40, 0x05, 0x00, 0x14, 0x01, 0xFE, 0x7E, 0x7F, 0xF0, 0x73, 0xEF, 0xFC, 0xA7, 0x3F, - 0xFE, 0x09, 0x0F, 0xFF, 0x00, 0x60, 0xAF, 0x87, 0xBF, 0xFA, 0xB7, 0xAE, 0x6B, 0xB3, 0x2C, 0xFF, - 0x00, 0x91, 0x86, 0x1F, 0xFC, 0x70, 0xFF, 0x00, 0xD2, 0x91, 0xCF, 0x89, 0xFF, 0x00, 0x75, 0xA9, - 0xFE, 0x17, 0xF9, 0x1F, 0x6A, 0x57, 0xEA, 0x67, 0xC7, 0x05, 0x00, 0x14, 0x00, 0x50, 0x07, 0xEC, - 0x17, 0xFC, 0x11, 0x0B, 0xFE, 0x44, 0x4F, 0xDB, 0xAF, 0xFE, 0xCF, 0x9E, 0x0F, 0xFD, 0x50, 0xDF, - 0x0C, 0xAB, 0xF3, 0xAE, 0x20, 0xFF, 0x00, 0x91, 0xA4, 0xFD, 0x23, 0xFF, 0x00, 0xA4, 0xA3, 0xEA, - 0x32, 0xBF, 0xF7, 0x28, 0xFC, 0xFF, 0x00, 0x33, 0xF6, 0xDA, 0xBC, 0x53, 0xD1, 0x0A, 0x00, 0x28, - 0x00, 0xA0, 0x02, 0x80, 0x0A, 0x00, 0x28, 0x00, 0xA0, 0x02, 0x80, 0x0A, 0x00, 0x28, 0x00, 0xA0, - 0x02, 0x80, 0x0A, 0x00, 0x28, 0x00, 0xA0, 0x02, 0x80, 0x0A, 0x00, 0x28, 0x00, 0xA0, 0x02, 0x80, - 0x0A, 0x00, 0x28, 0x00, 0xA0, 0x02, 0x80, 0x0A, 0x00, 0x28, 0x00, 0xA0, 0x02, 0x80, 0x0A, 0x00, - 0x28, 0x00, 0xA0, 0x02, 0x80, 0x0A, 0x00, 0x28, 0x00, 0xA0, 0x02, 0x80, 0x0A, 0x00, 0x28, 0x00, - 0xA0, 0x02, 0x80, 0x0A, 0x00, 0x28, 0x00, 0xA0, 0x02, 0x80, 0x0A, 0x00, 0x28, 0x00, 0xA0, 0x02, - 0x80, 0x0A, 0x00, 0x28, 0x00, 0xA0, 0x02, 0x80, 0x0A, 0x00, 0x28, 0x00, 0xA0, 0x02, 0x80, 0x0A, - 0x00, 0x28, 0x00, 0xA0, 0x02, 0x80, 0x0A, 0x00, 0xFF, 0x00, 0x3F, 0x3F, 0xF8, 0x39, 0xF7, 0xFE, - 0x53, 0x9F, 0xFF, 0x00, 0x04, 0x87, 0xFF, 0x00, 0xB0, 0x57, 0xC3, 0xDF, 0xFD, 0x5B, 0xD7, 0x35, - 0xD9, 0x96, 0x7F, 0xC8, 0xC3, 0x0F, 0xFE, 0x38, 0x7F, 0xE9, 0x48, 0xE7, 0xC4, 0xFF, 0x00, 0xBA, - 0xD4, 0xFF, 0x00, 0x0B, 0xFC, 0x8F, 0xB5, 0x2B, 0xF5, 0x33, 0xE3, 0x82, 0x80, 0x0A, 0x00, 0x28, - 0x03, 0xF6, 0x0B, 0xFE, 0x08, 0x85, 0xFF, 0x00, 0x22, 0x27, 0xED, 0xD7, 0xFF, 0x00, 0x67, 0xCF, - 0x07, 0xFE, 0xA8, 0x6F, 0x86, 0x55, 0xF9, 0xD7, 0x10, 0x7F, 0xC8, 0xD2, 0x7E, 0x91, 0xFF, 0x00, - 0xD2, 0x51, 0xF5, 0x19, 0x5F, 0xFB, 0x94, 0x7E, 0x7F, 0x99, 0xFB, 0x6D, 0x5E, 0x29, 0xE8, 0x85, - 0x00, 0x14, 0x00, 0x50, 0x01, 0x40, 0x05, 0x00, 0x14, 0x00, 0x50, 0x01, 0x40, 0x08, 0x7E, 0xE9, - 0xFF, 0x00, 0x77, 0xFA, 0x50, 0x04, 0x14, 0x00, 0x50, 0x01, 0x40, 0x05, 0x00, 0x14, 0x00, 0x50, - 0x01, 0x40, 0x05, 0x00, 0x14, 0x00, 0x50, 0x01, 0x40, 0x05, 0x00, 0x14, 0x00, 0x50, 0x01, 0x40, - 0x05, 0x00, 0x14, 0x00, 0x50, 0x01, 0x40, 0x05, 0x00, 0x14, 0x00, 0x50, 0x01, 0x40, 0x05, 0x00, - 0x14, 0x00, 0x50, 0x01, 0x40, 0x05, 0x00, 0x14, 0x00, 0x50, 0x01, 0x40, 0x05, 0x00, 0x14, 0x00, - 0x50, 0x01, 0x40, 0x05, 0x00, 0x14, 0x00, 0x50, 0x01, 0x40, 0x05, 0x00, 0x14, 0x00, 0x50, 0x01, - 0x40, 0x05, 0x00, 0x14, 0x00, 0x50, 0x05, 0x8A, 0x00, 0x28, 0x00, 0xA0, 0x02, 0x80, 0x0A, 0x00, - 0x28, 0x03, 0xFC, 0xFC, 0xFF, 0x00, 0xE0, 0xE7, 0xDF, 0xF9, 0x4E, 0x7F, 0xFC, 0x12, 0x1F, 0xFE, - 0xC1, 0x5F, 0x0F, 0x7F, 0xF5, 0x6F, 0x5C, 0xD7, 0x66, 0x59, 0xFF, 0x00, 0x23, 0x0C, 0x3F, 0xF8, - 0xE1, 0xFF, 0x00, 0xA5, 0x23, 0x9F, 0x13, 0xFE, 0xEB, 0x53, 0xFC, 0x2F, 0xF2, 0x3E, 0xD4, 0xAF, - 0xD4, 0xCF, 0x8E, 0x0A, 0x00, 0x28, 0x00, 0xA0, 0x0F, 0xD8, 0x2F, 0xF8, 0x22, 0x17, 0xFC, 0x88, - 0x9F, 0xB7, 0x5F, 0xFD, 0x9F, 0x3C, 0x1F, 0xFA, 0xA1, 0xBE, 0x19, 0x57, 0xE7, 0x5C, 0x41, 0xFF, - 0x00, 0x23, 0x49, 0xFA, 0x47, 0xFF, 0x00, 0x49, 0x47, 0xD4, 0x65, 0x7F, 0xEE, 0x51, 0xF9, 0xFE, - 0x67, 0xED, 0xB5, 0x78, 0xA7, 0xA2, 0x14, 0x00, 0x50, 0x01, 0x40, 0x05, 0x00, 0x14, 0x00, 0x50, - 0x01, 0x40, 0x05, 0x00, 0x21, 0xFB, 0xA7, 0xFD, 0xDF, 0xE9, 0x40, 0x10, 0x50, 0x01, 0x40, 0x05, - 0x00, 0x14, 0x00, 0x50, 0x01, 0x40, 0x05, 0x00, 0x14, 0x00, 0x50, 0x01, 0x40, 0x05, 0x00, 0x14, - 0x00, 0x50, 0x01, 0x40, 0x05, 0x00, 0x03, 0x8C, 0x70, 0x38, 0xC7, 0x18, 0xE3, 0x8E, 0xD8, 0xFC, - 0x28, 0x03, 0xE6, 0x3F, 0x87, 0xBE, 0x3E, 0xF1, 0x87, 0xC3, 0xCF, 0x17, 0xE9, 0x7F, 0x02, 0xFE, - 0x39, 0x6A, 0xAF, 0xAE, 0x6B, 0x1A, 0xC7, 0xDA, 0xBF, 0xE1, 0x4A, 0x7C, 0x6A, 0x7D, 0x3D, 0x34, - 0xFD, 0x37, 0xE3, 0x5D, 0x9D, 0xA4, 0x72, 0xDC, 0x4D, 0xA4, 0xEB, 0x31, 0xDB, 0xDB, 0xC7, 0x63, - 0xA6, 0xF8, 0xB2, 0xCA, 0xCE, 0x20, 0xD3, 0xDA, 0xA1, 0x8E, 0x1D, 0x56, 0x0B, 0x7B, 0x9D, 0x57, - 0x4E, 0x8A, 0x38, 0xE1, 0xD5, 0x34, 0xDF, 0x0E, 0x80, 0x7D, 0x39, 0x40, 0x19, 0xDA, 0xBC, 0xD2, - 0xDA, 0xE9, 0x1A, 0x9D, 0xC5, 0xBB, 0x79, 0x73, 0x5B, 0xE9, 0xB3, 0xCD, 0x0B, 0x85, 0x53, 0xE5, - 0xBA, 0x44, 0x4A, 0x90, 0x08, 0x23, 0x82, 0x07, 0x04, 0x62, 0x80, 0x3C, 0x7F, 0xF6, 0x61, 0xF1, - 0x5F, 0x88, 0x7C, 0x79, 0xFB, 0x35, 0x7E, 0xCF, 0x1E, 0x38, 0xF1, 0x76, 0xA6, 0xFA, 0xD7, 0x8B, - 0x3C, 0x67, 0xF0, 0x33, 0xC2, 0x3E, 0x2B, 0xF1, 0x3E, 0xB3, 0x25, 0xAC, 0x16, 0x52, 0x6A, 0xDA, - 0x8E, 0xA3, 0xE1, 0xFB, 0x4B, 0x8B, 0xDB, 0xA6, 0x86, 0x04, 0x8E, 0x18, 0xCC, 0x93, 0x4D, 0x2B, - 0xEC, 0x8E, 0x34, 0x45, 0xDD, 0x85, 0x55, 0x00, 0x00, 0x01, 0xEE, 0x34, 0x01, 0xF2, 0xF7, 0xC4, - 0x3F, 0x88, 0xDE, 0x2F, 0xF1, 0xF7, 0x8C, 0xF5, 0x5F, 0x80, 0x5F, 0x01, 0x75, 0x65, 0xD1, 0xFC, - 0x4F, 0xA2, 0x0B, 0x43, 0xF1, 0xB3, 0xE3, 0x4A, 0xE9, 0x96, 0xBA, 0xF6, 0x89, 0xF0, 0x06, 0xCA, - 0xF2, 0x18, 0x2E, 0x61, 0xD2, 0x2C, 0x6D, 0xA6, 0x26, 0x0B, 0xCF, 0x19, 0x6A, 0x1A, 0x7D, 0xCA, - 0xCD, 0x63, 0x6B, 0x24, 0x57, 0x16, 0xBA, 0x64, 0x13, 0x5B, 0x6B, 0x1A, 0xA4, 0x32, 0xC3, 0x2E, - 0x95, 0xA4, 0xF8, 0xA0, 0x03, 0xE9, 0xC8, 0x23, 0x30, 0xC1, 0x0C, 0x2D, 0x2C, 0x93, 0xB4, 0x51, - 0x2C, 0x46, 0x79, 0xB6, 0x79, 0xD3, 0x15, 0x50, 0x0B, 0xBE, 0xD5, 0x55, 0xC9, 0xC6, 0x4E, 0xD5, - 0x51, 0xE8, 0x00, 0xE0, 0x00, 0x4B, 0x40, 0x05, 0x00, 0x14, 0x00, 0x50, 0x01, 0x40, 0x05, 0x00, - 0x14, 0x00, 0x50, 0x01, 0x40, 0x05, 0x00, 0x14, 0x00, 0x50, 0x01, 0x40, 0x05, 0x00, 0x14, 0x00, - 0x50, 0x01, 0x40, 0x05, 0x00, 0x14, 0x00, 0x50, 0x01, 0x40, 0x05, 0x00, 0x14, 0x01, 0x62, 0x80, - 0x0A, 0x00, 0x28, 0x00, 0xA0, 0x02, 0x80, 0x0A, 0x00, 0xFF, 0x00, 0x3F, 0x3F, 0xF8, 0x39, 0xF7, - 0xFE, 0x53, 0x9F, 0xFF, 0x00, 0x04, 0x87, 0xFF, 0x00, 0xB0, 0x57, 0xC3, 0xDF, 0xFD, 0x5B, 0xD7, - 0x35, 0xD9, 0x96, 0x7F, 0xC8, 0xC3, 0x0F, 0xFE, 0x38, 0x7F, 0xE9, 0x48, 0xE7, 0xC4, 0xFF, 0x00, - 0xBA, 0xD4, 0xFF, 0x00, 0x0B, 0xFC, 0x8F, 0xB5, 0x2B, 0xF5, 0x33, 0xE3, 0x82, 0x80, 0x0A, 0x00, - 0x28, 0x03, 0xF6, 0x0B, 0xFE, 0x08, 0x85, 0xFF, 0x00, 0x22, 0x27, 0xED, 0xD7, 0xFF, 0x00, 0x67, - 0xCF, 0x07, 0xFE, 0xA8, 0x6F, 0x86, 0x55, 0xF9, 0xD7, 0x10, 0x7F, 0xC8, 0xD2, 0x7E, 0x91, 0xFF, - 0x00, 0xD2, 0x51, 0xF5, 0x19, 0x5F, 0xFB, 0x94, 0x7E, 0x7F, 0x99, 0xFB, 0x6D, 0x5E, 0x29, 0xE8, - 0x85, 0x00, 0x14, 0x00, 0x50, 0x01, 0x40, 0x05, 0x00, 0x14, 0x00, 0x50, 0x01, 0x40, 0x08, 0x7E, - 0xE9, 0xFF, 0x00, 0x77, 0xFA, 0x50, 0x04, 0x14, 0x00, 0x50, 0x01, 0x40, 0x05, 0x00, 0x14, 0x00, - 0x50, 0x01, 0x40, 0x05, 0x00, 0x14, 0x00, 0x50, 0x01, 0x40, 0x05, 0x00, 0x14, 0x00, 0x50, 0x01, - 0x40, 0x05, 0x00, 0x71, 0xDE, 0x3D, 0xF0, 0x07, 0x84, 0x3E, 0x27, 0x78, 0x53, 0x51, 0xF0, 0x4F, - 0x8E, 0x74, 0x58, 0x75, 0xDF, 0x0E, 0x6A, 0x72, 0xDA, 0x5E, 0x3D, 0xA9, 0xB8, 0x9F, 0x4E, 0xBD, - 0xD3, 0xEF, 0x34, 0xEB, 0xC8, 0xAF, 0x34, 0xAD, 0x4F, 0x4E, 0xBE, 0xB7, 0x78, 0xEE, 0xAC, 0x75, - 0x0B, 0x2B, 0xDB, 0x3B, 0x2B, 0xBB, 0x4B, 0xDB, 0x59, 0x61, 0xB8, 0xB4, 0xB9, 0xB6, 0xB6, 0xB9, - 0x82, 0x58, 0xA6, 0x82, 0x39, 0x10, 0x02, 0x8F, 0xC3, 0x1F, 0x0F, 0xF8, 0xE3, 0xC2, 0x9E, 0x11, - 0xB1, 0xF0, 0xDF, 0x8F, 0xBC, 0x71, 0x17, 0xC4, 0x9D, 0x67, 0x45, 0x96, 0x4D, 0x36, 0xC7, 0xC7, - 0x12, 0x68, 0x11, 0x78, 0x6F, 0x5E, 0xF1, 0x1E, 0x9D, 0x11, 0xDB, 0xA7, 0xDC, 0x6B, 0x76, 0xF0, - 0xB9, 0xB4, 0x7D, 0x54, 0xC2, 0x23, 0x17, 0x73, 0xDA, 0x45, 0x69, 0x6D, 0x3C, 0xE2, 0x59, 0xE0, - 0xB2, 0xB1, 0x8E, 0x54, 0xB4, 0xB7, 0x00, 0xF1, 0x1F, 0x1C, 0xFE, 0xD6, 0xDF, 0x07, 0x34, 0x48, - 0x2E, 0x34, 0x78, 0x6C, 0xFE, 0x38, 0xF8, 0xC0, 0x6A, 0x9A, 0x6E, 0xA5, 0x6F, 0x69, 0xAE, 0x7C, - 0x26, 0xFD, 0x94, 0x3E, 0x2B, 0x7C, 0x6E, 0xF0, 0x6F, 0x9B, 0x65, 0xAA, 0xDF, 0xE9, 0x37, 0x96, - 0xEF, 0xAD, 0xF8, 0x73, 0xC3, 0x7A, 0x85, 0x82, 0x4F, 0x15, 0xF6, 0x8F, 0x7E, 0x8F, 0x01, 0x9B, - 0xCD, 0x08, 0xB0, 0xCD, 0xB3, 0xCA, 0xB8, 0x82, 0x49, 0x40, 0x3C, 0x4B, 0xF6, 0x76, 0xFD, 0xA9, - 0x7E, 0x11, 0xFC, 0x2D, 0xF8, 0x15, 0xF0, 0x2F, 0xE1, 0x6F, 0x8D, 0xAC, 0x3E, 0x3F, 0xF8, 0x77, - 0x51, 0xF8, 0x6F, 0xF0, 0x8F, 0xC3, 0x1E, 0x02, 0xF1, 0x77, 0x8C, 0xBC, 0x4B, 0xFB, 0x16, 0x7C, - 0x6F, 0xF0, 0x07, 0xC2, 0x8D, 0x12, 0x7D, 0x1B, 0x45, 0xB6, 0xB4, 0xD4, 0x35, 0x2B, 0xEF, 0x13, - 0xEB, 0x5E, 0x0F, 0xB0, 0xB0, 0xD3, 0xF4, 0xA8, 0xDA, 0xDA, 0x59, 0x5E, 0xFB, 0x50, 0x92, 0xCE, - 0x18, 0x61, 0x53, 0x2C, 0xCD, 0x0A, 0xAB, 0x6C, 0x00, 0xFB, 0x83, 0xE2, 0x4E, 0x83, 0xE3, 0x4F, - 0x13, 0xF8, 0x2B, 0x59, 0xF0, 0xEF, 0xC3, 0xEF, 0x1C, 0xB7, 0xC3, 0x3F, 0x13, 0x6B, 0x4B, 0x06, - 0x9B, 0x07, 0x8F, 0xAD, 0x34, 0x0B, 0x2F, 0x12, 0xEB, 0x5E, 0x12, 0xB4, 0x96, 0xE2, 0x35, 0xD4, - 0x6F, 0x74, 0x8B, 0x3B, 0xC4, 0x92, 0xC0, 0xEA, 0x69, 0x68, 0x6E, 0x8D, 0x9B, 0xDE, 0xDB, 0xDE, - 0xDA, 0x45, 0x75, 0xF6, 0x69, 0x6E, 0x6C, 0xAF, 0x60, 0x8E, 0x4B, 0x4B, 0x80, 0x09, 0x7E, 0x1D, - 0xFC, 0x3B, 0xF0, 0x6F, 0xC2, 0x9F, 0x08, 0x69, 0x7E, 0x06, 0xF0, 0x16, 0x89, 0x1E, 0x83, 0xE1, - 0xBD, 0x2A, 0x5B, 0xBB, 0xD8, 0xED, 0xBE, 0xD7, 0x73, 0xAA, 0x5F, 0x6A, 0x17, 0xBA, 0x8D, 0xEC, - 0xB7, 0x9A, 0xAE, 0xA9, 0xA8, 0xDF, 0xDC, 0xC9, 0x2D, 0xDD, 0xF6, 0xA1, 0x7B, 0x7D, 0x79, 0x7B, - 0x79, 0x77, 0x7B, 0x75, 0x2C, 0xD7, 0x37, 0x77, 0x57, 0x37, 0x37, 0x33, 0xCB, 0x2C, 0xD3, 0x49, - 0x23, 0x80, 0x76, 0xB4, 0x00, 0x50, 0x07, 0x01, 0xF1, 0x07, 0xE2, 0x7F, 0x82, 0x3E, 0x16, 0xD8, - 0xE8, 0x37, 0xBE, 0x34, 0xD5, 0xAE, 0x2C, 0x5F, 0xC5, 0x5E, 0x24, 0x83, 0xC1, 0xDE, 0x12, 0xD1, - 0x74, 0x8D, 0x0B, 0x50, 0xF1, 0x6F, 0x8A, 0xFC, 0x5F, 0xAA, 0x4D, 0x6F, 0x35, 0xC0, 0xD3, 0xF4, - 0x7D, 0x13, 0x4F, 0x82, 0x7B, 0xFB, 0xE9, 0xA3, 0xB3, 0xB0, 0xD4, 0x6F, 0x25, 0x4B, 0x68, 0x25, - 0x30, 0x59, 0xD8, 0xDF, 0xDE, 0x4B, 0xE5, 0xDB, 0xD9, 0xCF, 0x2C, 0x40, 0x1F, 0x3E, 0x7F, 0xC3, - 0x72, 0x7C, 0x15, 0xFF, 0x00, 0xA1, 0x27, 0xF6, 0xC3, 0xFF, 0x00, 0xC5, 0x77, 0x7E, 0xD0, 0x3F, - 0xFC, 0xC5, 0xD0, 0x01, 0xFF, 0x00, 0x0D, 0xC9, 0xF0, 0x57, 0xFE, 0x84, 0x9F, 0xDB, 0x0F, 0xFF, - 0x00, 0x15, 0xDD, 0xFB, 0x40, 0xFF, 0x00, 0xF3, 0x17, 0x40, 0x07, 0xFC, 0x37, 0x27, 0xC1, 0x5F, - 0xFA, 0x12, 0x7F, 0x6C, 0x3F, 0xFC, 0x57, 0x77, 0xED, 0x03, 0xFF, 0x00, 0xCC, 0x5D, 0x00, 0x1F, - 0xF0, 0xDC, 0x9F, 0x05, 0x7F, 0xE8, 0x49, 0xFD, 0xB0, 0xFF, 0x00, 0xF1, 0x5D, 0xDF, 0xB4, 0x0F, - 0xFF, 0x00, 0x31, 0x74, 0x00, 0x7F, 0xC3, 0x72, 0x7C, 0x15, 0xFF, 0x00, 0xA1, 0x27, 0xF6, 0xC3, - 0xFF, 0x00, 0xC5, 0x77, 0x7E, 0xD0, 0x3F, 0xFC, 0xC5, 0xD0, 0x01, 0xFF, 0x00, 0x0D, 0xC9, 0xF0, - 0x57, 0xFE, 0x84, 0x9F, 0xDB, 0x0F, 0xFF, 0x00, 0x15, 0xDD, 0xFB, 0x40, 0xFF, 0x00, 0xF3, 0x17, - 0x40, 0x07, 0xFC, 0x37, 0x27, 0xC1, 0x5F, 0xFA, 0x12, 0x7F, 0x6C, 0x3F, 0xFC, 0x57, 0x77, 0xED, - 0x03, 0xFF, 0x00, 0xCC, 0x5D, 0x00, 0x1F, 0xF0, 0xDC, 0x9F, 0x05, 0x7F, 0xE8, 0x49, 0xFD, 0xB0, - 0xFF, 0x00, 0xF1, 0x5D, 0xDF, 0xB4, 0x0F, 0xFF, 0x00, 0x31, 0x74, 0x00, 0x7F, 0xC3, 0x72, 0x7C, - 0x15, 0xFF, 0x00, 0xA1, 0x27, 0xF6, 0xC3, 0xFF, 0x00, 0xC5, 0x77, 0x7E, 0xD0, 0x3F, 0xFC, 0xC5, - 0xD0, 0x01, 0xFF, 0x00, 0x0D, 0xC9, 0xF0, 0x57, 0xFE, 0x84, 0x9F, 0xDB, 0x0F, 0xFF, 0x00, 0x15, - 0xDD, 0xFB, 0x40, 0xFF, 0x00, 0xF3, 0x17, 0x40, 0x07, 0xFC, 0x37, 0x27, 0xC1, 0x5F, 0xFA, 0x12, - 0x7F, 0x6C, 0x3F, 0xFC, 0x57, 0x77, 0xED, 0x03, 0xFF, 0x00, 0xCC, 0x5D, 0x00, 0x1F, 0xF0, 0xDC, - 0x9F, 0x05, 0x7F, 0xE8, 0x49, 0xFD, 0xB0, 0xFF, 0x00, 0xF1, 0x5D, 0xDF, 0xB4, 0x0F, 0xFF, 0x00, - 0x31, 0x74, 0x01, 0xEB, 0x7F, 0x09, 0xFE, 0x3C, 0xF8, 0x1F, 0xE3, 0x34, 0xFA, 0xE5, 0xAF, 0x83, - 0xF4, 0x2F, 0x8D, 0x1A, 0x34, 0x9E, 0x1D, 0x86, 0xDA, 0x7B, 0xF6, 0xF8, 0xB1, 0xFB, 0x36, 0xFC, - 0x45, 0xF8, 0x09, 0x6F, 0x3A, 0xDD, 0x34, 0xA2, 0x21, 0x61, 0x37, 0x89, 0xB4, 0x3D, 0x36, 0x3B, - 0xD6, 0x1F, 0x66, 0x93, 0x7A, 0xDA, 0xB4, 0xCD, 0x10, 0x31, 0x19, 0x02, 0x09, 0x63, 0xDE, 0x01, - 0xEC, 0xF4, 0x00, 0x50, 0x01, 0x40, 0x05, 0x00, 0x14, 0x00, 0x50, 0x01, 0x40, 0x05, 0x00, 0x58, - 0xA0, 0x02, 0x80, 0x0A, 0x00, 0x28, 0x00, 0xA0, 0x02, 0x80, 0x3F, 0xCF, 0xCF, 0xFE, 0x0E, 0x7D, - 0xFF, 0x00, 0x94, 0xE7, 0xFF, 0x00, 0xC1, 0x21, 0xFF, 0x00, 0xEC, 0x15, 0xF0, 0xF7, 0xFF, 0x00, - 0x56, 0xF5, 0xCD, 0x76, 0x65, 0x9F, 0xF2, 0x30, 0xC3, 0xFF, 0x00, 0x8E, 0x1F, 0xFA, 0x52, 0x39, - 0xF1, 0x3F, 0xEE, 0xB5, 0x3F, 0xC2, 0xFF, 0x00, 0x23, 0xED, 0x4A, 0xFD, 0x4C, 0xF8, 0xE0, 0xA0, - 0x02, 0x80, 0x0A, 0x00, 0xFD, 0x82, 0xFF, 0x00, 0x82, 0x21, 0x7F, 0xC8, 0x89, 0xFB, 0x75, 0xFF, - 0x00, 0xD9, 0xF3, 0xC1, 0xFF, 0x00, 0xAA, 0x1B, 0xE1, 0x95, 0x7E, 0x75, 0xC4, 0x1F, 0xF2, 0x34, - 0x9F, 0xA4, 0x7F, 0xF4, 0x94, 0x7D, 0x46, 0x57, 0xFE, 0xE5, 0x1F, 0x9F, 0xE6, 0x7E, 0xDB, 0x57, - 0x8A, 0x7A, 0x21, 0x40, 0x05, 0x00, 0x14, 0x00, 0x50, 0x01, 0x40, 0x05, 0x00, 0x14, 0x00, 0x50, - 0x02, 0x1F, 0xBA, 0x7F, 0xDD, 0xFE, 0x94, 0x01, 0x05, 0x00, 0x14, 0x00, 0x50, 0x01, 0x40, 0x05, - 0x00, 0x14, 0x00, 0x50, 0x01, 0x40, 0x05, 0x00, 0x14, 0x00, 0x50, 0x01, 0x40, 0x05, 0x00, 0x14, - 0x00, 0x50, 0x01, 0x40, 0x00, 0x1D, 0x00, 0x1E, 0x80, 0x00, 0x3F, 0x20, 0x07, 0xE5, 0x40, 0x1F, - 0x24, 0x6A, 0x9A, 0xB5, 0xFF, 0x00, 0xED, 0x45, 0xA8, 0x6A, 0x3E, 0x10, 0xF0, 0x6E, 0xA7, 0x71, - 0xA6, 0xFE, 0xCE, 0x5A, 0x5D, 0xDC, 0xFA, 0x2F, 0xC4, 0x1F, 0x88, 0x9A, 0x1D, 0xEC, 0x49, 0x73, - 0xF1, 0xAE, 0x78, 0x4C, 0x4B, 0x73, 0xE1, 0x9F, 0x0C, 0x5D, 0xA0, 0x71, 0xFD, 0x8E, 0x37, 0x5E, - 0x5B, 0x6A, 0x5A, 0x8C, 0x4D, 0x1C, 0x9E, 0x64, 0x52, 0x59, 0x5A, 0x38, 0x91, 0x6E, 0x2E, 0x2D, - 0x00, 0x3E, 0xA7, 0xD2, 0x34, 0x8D, 0x27, 0x40, 0xD2, 0x74, 0xBD, 0x07, 0x41, 0xD3, 0x34, 0xED, - 0x13, 0x43, 0xD1, 0x34, 0xE8, 0x34, 0x8D, 0x1B, 0x46, 0xD2, 0x2C, 0xA2, 0xD3, 0x74, 0x9D, 0x22, - 0xD2, 0xDA, 0x25, 0x8E, 0xDA, 0xD6, 0xD6, 0xDA, 0x35, 0x58, 0xE2, 0x86, 0x38, 0xE3, 0x8D, 0x12, - 0x34, 0x55, 0x55, 0x55, 0x55, 0x00, 0x00, 0x00, 0x00, 0xB3, 0x73, 0x6B, 0x6B, 0x7B, 0x6B, 0x71, - 0x63, 0x7B, 0x6D, 0x6F, 0x77, 0x65, 0x77, 0x6E, 0xF6, 0x97, 0x76, 0x77, 0x50, 0xA5, 0xC5, 0xAD, - 0xD4, 0x52, 0x21, 0x59, 0x22, 0x92, 0x36, 0x05, 0x59, 0x19, 0x49, 0x05, 0x48, 0x20, 0x82, 0x41, - 0x18, 0xA0, 0x0F, 0x90, 0xD2, 0xE6, 0x6F, 0xD9, 0x0E, 0x61, 0x6F, 0xA8, 0xCF, 0xE6, 0xFE, 0xC9, - 0x37, 0x37, 0x01, 0x6C, 0x75, 0x5B, 0x87, 0x82, 0x0F, 0xF8, 0x65, 0x29, 0xAE, 0x6E, 0x98, 0x25, - 0xA5, 0xDC, 0x8D, 0x22, 0xE7, 0xC1, 0x4C, 0xF7, 0x36, 0xB0, 0x5B, 0x08, 0xA2, 0x3F, 0xD8, 0x01, - 0x42, 0x39, 0xFE, 0xC7, 0x0A, 0xDE, 0x1C, 0x00, 0xFB, 0x0F, 0xDB, 0xD3, 0x8C, 0x7A, 0x63, 0xB6, - 0x3F, 0x0A, 0x00, 0x28, 0x03, 0xCC, 0x3E, 0x2C, 0x7C, 0x57, 0xF0, 0xEF, 0xC2, 0x1F, 0x0C, 0xDA, - 0xEB, 0x7A, 0xC5, 0x8E, 0xB7, 0xE2, 0x2D, 0x67, 0x5D, 0xD6, 0xAD, 0xFC, 0x23, 0xE0, 0x1F, 0x87, - 0xFE, 0x10, 0xB3, 0x87, 0x52, 0xF1, 0xD7, 0xC4, 0xBD, 0x7A, 0xF1, 0x24, 0x6B, 0x1D, 0x0F, 0x44, - 0xB4, 0x96, 0x58, 0x61, 0x69, 0xDD, 0x2D, 0xAE, 0x66, 0x92, 0x7B, 0x89, 0xAD, 0xED, 0x2C, 0xED, - 0x6D, 0xAF, 0xAF, 0xEF, 0x6E, 0x6D, 0x2C, 0x6C, 0x6E, 0xAE, 0xED, 0x80, 0x38, 0x7F, 0x84, 0x9F, - 0x09, 0xFC, 0x47, 0x6B, 0xAF, 0xDD, 0xFC, 0x69, 0xF8, 0xD5, 0x75, 0xA3, 0xEB, 0xFF, 0x00, 0x1D, - 0x7C, 0x49, 0xA2, 0xB6, 0x83, 0x1D, 0xA6, 0x81, 0x73, 0x75, 0x7B, 0xF0, 0xFF, 0x00, 0xE0, 0xA6, - 0x81, 0x2D, 0xC2, 0xDC, 0x27, 0x84, 0x3C, 0x22, 0x97, 0x01, 0x4B, 0x2E, 0xF8, 0xED, 0x1B, 0x52, - 0xD6, 0x0C, 0x16, 0xD7, 0x5A, 0xE5, 0xCD, 0xA5, 0xAC, 0xF3, 0xC3, 0x6B, 0x67, 0x63, 0xA4, 0x69, - 0x1A, 0x18, 0x07, 0xD0, 0xF4, 0x00, 0x50, 0x01, 0x40, 0x05, 0x00, 0x14, 0x00, 0x50, 0x01, 0x40, - 0x05, 0x00, 0x14, 0x00, 0x50, 0x01, 0x40, 0x05, 0x00, 0x14, 0x00, 0x50, 0x01, 0x40, 0x05, 0x00, - 0x14, 0x00, 0x50, 0x01, 0x40, 0x05, 0x00, 0x14, 0x01, 0x62, 0x80, 0x0A, 0x00, 0x28, 0x00, 0xA0, - 0x02, 0x80, 0x0A, 0x00, 0xFF, 0x00, 0x3F, 0x3F, 0xF8, 0x39, 0xF7, 0xFE, 0x53, 0x9F, 0xFF, 0x00, - 0x04, 0x87, 0xFF, 0x00, 0xB0, 0x57, 0xC3, 0xDF, 0xFD, 0x5B, 0xD7, 0x35, 0xD9, 0x96, 0x7F, 0xC8, - 0xC3, 0x0F, 0xFE, 0x38, 0x7F, 0xE9, 0x48, 0xE7, 0xC4, 0xFF, 0x00, 0xBA, 0xD4, 0xFF, 0x00, 0x0B, - 0xFC, 0x8F, 0xB5, 0x2B, 0xF5, 0x33, 0xE3, 0x82, 0x80, 0x0A, 0x00, 0x28, 0x03, 0xF6, 0x0B, 0xFE, - 0x08, 0x85, 0xFF, 0x00, 0x22, 0x27, 0xED, 0xD7, 0xFF, 0x00, 0x67, 0xCF, 0x07, 0xFE, 0xA8, 0x6F, - 0x86, 0x55, 0xF9, 0xD7, 0x10, 0x7F, 0xC8, 0xD2, 0x7E, 0x91, 0xFF, 0x00, 0xD2, 0x51, 0xF5, 0x19, - 0x5F, 0xFB, 0x94, 0x7E, 0x7F, 0x99, 0xFB, 0x6D, 0x5E, 0x29, 0xE8, 0x85, 0x00, 0x14, 0x00, 0x50, - 0x01, 0x40, 0x05, 0x00, 0x14, 0x00, 0x50, 0x01, 0x40, 0x08, 0x7E, 0xE9, 0xFF, 0x00, 0x77, 0xFA, - 0x50, 0x04, 0x14, 0x00, 0x50, 0x01, 0x40, 0x05, 0x00, 0x14, 0x00, 0x50, 0x01, 0x40, 0x05, 0x00, - 0x14, 0x00, 0x50, 0x01, 0x40, 0x05, 0x00, 0x14, 0x00, 0x50, 0x01, 0xC0, 0x1D, 0x80, 0x03, 0xD8, - 0x00, 0x00, 0xA0, 0x05, 0xDA, 0x7F, 0xBA, 0x7F, 0x2A, 0x00, 0xF0, 0x9F, 0xDA, 0x17, 0xE2, 0x0E, - 0xA5, 0xE0, 0x2F, 0x03, 0xE9, 0x5A, 0x7F, 0x87, 0x3C, 0x33, 0xA4, 0x78, 0xC3, 0xC6, 0xBF, 0x13, - 0xFC, 0x6B, 0xA4, 0xFC, 0x23, 0xF0, 0x4F, 0x86, 0x7C, 0x45, 0x84, 0xF0, 0xC5, 0xDD, 0xD6, 0xB9, - 0x71, 0xB2, 0xFA, 0xF7, 0x55, 0x2C, 0x55, 0x1E, 0xC7, 0x4F, 0xD2, 0xE2, 0xD6, 0x35, 0x29, 0xED, - 0xFC, 0xC8, 0xA4, 0xBA, 0x8B, 0x4F, 0x92, 0xCE, 0x06, 0x37, 0x37, 0x50, 0x23, 0x80, 0x51, 0xF1, - 0xBC, 0xBF, 0x1C, 0x7C, 0x16, 0xFF, 0x00, 0x00, 0x3C, 0x33, 0xF0, 0x5B, 0xC0, 0x7F, 0x0D, 0x3C, - 0x41, 0xE1, 0x8F, 0xF8, 0x4B, 0xB4, 0xFF, 0x00, 0x0B, 0xFC, 0x5E, 0x7B, 0xA9, 0x5B, 0xC0, 0xBA, - 0x27, 0x83, 0x7C, 0x33, 0x6F, 0x65, 0xB6, 0xE6, 0xEB, 0x45, 0xB3, 0x49, 0x64, 0x6B, 0x34, 0x8A, - 0x38, 0x65, 0x6B, 0x68, 0xE2, 0x8F, 0x54, 0x66, 0xB9, 0x8B, 0x4B, 0xD3, 0x1E, 0xDE, 0xDE, 0xD7, - 0x52, 0xBB, 0xF1, 0x07, 0x86, 0xC0, 0x31, 0xFE, 0x39, 0x7E, 0xD1, 0xD6, 0xBF, 0xB3, 0xF7, 0x8E, - 0xBE, 0x12, 0xDB, 0x78, 0xE7, 0xC2, 0x9A, 0xFB, 0x7C, 0x1F, 0xF8, 0x91, 0x67, 0xAE, 0xF8, 0x66, - 0xFB, 0xE2, 0x47, 0x85, 0x7C, 0x2F, 0xAF, 0xFC, 0x44, 0xD6, 0x7C, 0x3D, 0xE3, 0x58, 0x64, 0xD3, - 0x25, 0xF0, 0x87, 0x86, 0x8F, 0x87, 0xB4, 0x6D, 0x3A, 0xF2, 0xF4, 0xC3, 0xAA, 0xD8, 0x7F, 0xC2, - 0x69, 0x20, 0xBF, 0x91, 0x62, 0xB7, 0x86, 0xE3, 0x48, 0xB0, 0xB2, 0x2E, 0x6E, 0x35, 0x6B, 0x38, - 0xA5, 0x00, 0x8B, 0xE0, 0x7F, 0xED, 0x27, 0x65, 0xF1, 0xEB, 0xE2, 0x77, 0xC6, 0x8F, 0x0E, 0xF8, - 0x2F, 0xC2, 0x9E, 0x22, 0xB7, 0xF8, 0x69, 0xF0, 0x8B, 0x4B, 0xF0, 0xAE, 0x85, 0x2F, 0x8E, 0x7C, - 0x5B, 0xE1, 0x4F, 0x10, 0x7C, 0x37, 0xF1, 0x1D, 0xEF, 0x8D, 0x35, 0x6B, 0x7B, 0xFD, 0x43, 0xC4, - 0x1E, 0x18, 0xB8, 0xF0, 0xD6, 0xB5, 0xA7, 0x59, 0x5F, 0x40, 0x96, 0x1A, 0x1D, 0xCF, 0xC3, 0xDD, - 0x41, 0x2E, 0xC2, 0x3C, 0x37, 0x2B, 0xE2, 0x4D, 0x88, 0xDB, 0xAC, 0xE5, 0x00, 0x03, 0xB5, 0xF8, - 0x6F, 0xAC, 0xFC, 0x74, 0xD4, 0xFE, 0x20, 0x7C, 0x6B, 0xD3, 0xBE, 0x27, 0x78, 0x33, 0xC1, 0x9E, - 0x1E, 0xF8, 0x69, 0xA2, 0xF8, 0x87, 0x4F, 0xB3, 0xF8, 0x23, 0xAF, 0xE8, 0x3A, 0xDB, 0xDD, 0xF8, - 0x8F, 0xC5, 0x96, 0x32, 0x58, 0x97, 0xD4, 0x9E, 0xFE, 0xD3, 0x74, 0x89, 0xE4, 0xC6, 0xED, 0x64, - 0x63, 0xB9, 0x73, 0x63, 0x33, 0x5C, 0x4D, 0xAA, 0xD8, 0x9D, 0x3B, 0xEC, 0xDA, 0x55, 0x9E, 0xB7, - 0xE2, 0x60, 0x0E, 0x0F, 0xF6, 0x60, 0xF8, 0x99, 0xA6, 0x6A, 0x3F, 0x0D, 0x7C, 0x5D, 0xE0, 0x4F, - 0x10, 0x68, 0xBE, 0x08, 0xF8, 0x6F, 0xE2, 0x9F, 0xD9, 0x4B, 0xC5, 0xD7, 0x3F, 0x00, 0x7E, 0x29, - 0xF8, 0x5F, 0xC1, 0xBA, 0x29, 0xF0, 0x57, 0xC3, 0x0F, 0x08, 0x1D, 0x0B, 0x46, 0xB0, 0xD4, 0xB4, - 0x1B, 0xED, 0x12, 0xD5, 0x9E, 0x4B, 0x5B, 0x1D, 0x22, 0xFF, 0x00, 0xC2, 0x7A, 0xDF, 0x84, 0x75, - 0x98, 0x2C, 0xE2, 0xBB, 0xBC, 0x5D, 0x32, 0x0D, 0x56, 0x3D, 0x36, 0x7B, 0x86, 0xBA, 0xD3, 0xAE, - 0x96, 0x30, 0x07, 0x78, 0x43, 0xF6, 0x98, 0x8F, 0xE3, 0x16, 0xBF, 0xE1, 0x08, 0x3F, 0x67, 0xAF, - 0x00, 0xEB, 0x5F, 0x13, 0x7E, 0x1A, 0xEA, 0xD1, 0xA6, 0xBF, 0xE2, 0x1F, 0x8F, 0x9A, 0xE7, 0xDB, - 0x7E, 0x1B, 0xFC, 0x13, 0x1A, 0x0C, 0x86, 0x1F, 0xB0, 0xDE, 0xF8, 0x3B, 0x56, 0xB8, 0xB1, 0x96, - 0x4F, 0x17, 0x4D, 0xA8, 0x45, 0x72, 0x6E, 0xB4, 0xF9, 0x74, 0x98, 0x25, 0xD2, 0x27, 0xB4, 0xB6, - 0xB8, 0x9E, 0x5D, 0x62, 0xD4, 0x4F, 0xA6, 0xA6, 0xA8, 0x01, 0xF4, 0x3D, 0xC7, 0x85, 0x7C, 0x2F, - 0x77, 0xE2, 0x7D, 0x1F, 0xC6, 0xD7, 0x5E, 0x1C, 0xD0, 0xAE, 0x7C, 0x67, 0xE1, 0xED, 0x03, 0x52, - 0xF0, 0xAE, 0x81, 0xE2, 0xD9, 0xF4, 0x8B, 0x79, 0xBC, 0x4D, 0xA1, 0xE9, 0x7A, 0xC5, 0xC5, 0x8C, - 0xFA, 0xBE, 0x9B, 0x67, 0x7E, 0x50, 0xCF, 0x0D, 0xAD, 0xD4, 0xFA, 0x16, 0x89, 0x2C, 0xF0, 0xA3, - 0x2A, 0x4C, 0xFA, 0x75, 0x83, 0xBA, 0xB3, 0x5B, 0x44, 0x50, 0x03, 0xF3, 0x7F, 0xE2, 0x77, 0xED, - 0xB5, 0xFB, 0x50, 0x78, 0x5B, 0xC7, 0x9F, 0x0C, 0xFC, 0x31, 0xA3, 0x7E, 0xC0, 0x5F, 0x15, 0x7E, - 0x1E, 0x78, 0x77, 0xC7, 0x9E, 0x3A, 0x9F, 0xE1, 0x6D, 0xB7, 0xC4, 0xBF, 0xDA, 0x6F, 0xE2, 0x7F, - 0xC3, 0x2F, 0x06, 0xFC, 0x0D, 0x93, 0x5D, 0xBD, 0x8C, 0xB7, 0x85, 0xE3, 0xD4, 0xBC, 0x53, 0xE0, - 0xFF, 0x00, 0x15, 0x78, 0xAF, 0x58, 0xD0, 0x6D, 0xB5, 0x19, 0x2C, 0xAE, 0xEC, 0x6C, 0xE5, 0xB9, - 0xF0, 0xCD, 0xCF, 0xDB, 0x35, 0x6D, 0x47, 0xC3, 0x5A, 0x48, 0x16, 0xD3, 0x6A, 0x89, 0x24, 0x60, - 0x1F, 0x78, 0xFC, 0x24, 0xF8, 0x97, 0x67, 0xF1, 0x5F, 0xC2, 0x17, 0xDE, 0x2E, 0xB2, 0xD2, 0xAE, - 0x74, 0x7B, 0x7B, 0x1F, 0x88, 0x5E, 0x31, 0xF8, 0x7F, 0xF6, 0x2B, 0x89, 0xD6, 0xEE, 0x69, 0x1F, - 0xC1, 0xFE, 0x2E, 0xD4, 0xF4, 0x19, 0xAE, 0x43, 0x2A, 0x80, 0x16, 0x77, 0xD0, 0xDE, 0x65, 0x4C, - 0x12, 0xAB, 0x2A, 0xA1, 0x24, 0xAE, 0x48, 0x07, 0xC8, 0xBF, 0x16, 0x3F, 0x6B, 0x9F, 0x8B, 0xB7, - 0x1E, 0x24, 0xFD, 0x92, 0xF4, 0x9F, 0xD9, 0x47, 0xE0, 0x4D, 0xAF, 0xC5, 0xDF, 0x0D, 0x7E, 0xD2, - 0xAD, 0x2F, 0x8A, 0x2D, 0x7E, 0x2B, 0x7C, 0x4E, 0xF1, 0xB6, 0x9B, 0xF0, 0x8B, 0xE0, 0xB4, 0x7A, - 0x18, 0xF0, 0x66, 0xB3, 0xAA, 0xC1, 0xA6, 0x5C, 0x5D, 0x89, 0xEE, 0xFC, 0x5F, 0xA7, 0x6A, 0xEF, - 0x2E, 0x9F, 0xA2, 0x4C, 0x8D, 0x1F, 0x84, 0x75, 0x6B, 0x63, 0x0C, 0x93, 0x5B, 0xCA, 0xD6, 0xD2, - 0x48, 0xD7, 0x16, 0x20, 0x1E, 0xAD, 0xE3, 0x0F, 0xDA, 0xAF, 0xC3, 0x36, 0x3F, 0x06, 0xFE, 0x26, - 0x7C, 0x53, 0xF0, 0x87, 0xFC, 0x23, 0x5E, 0x1F, 0x1F, 0x0B, 0x2D, 0x2C, 0x75, 0x0F, 0x12, 0xEA, - 0x5F, 0xB5, 0xAC, 0xDE, 0x2F, 0xFD, 0x8C, 0x3E, 0x0F, 0x69, 0x16, 0xB3, 0xDD, 0x2A, 0xDE, 0xDD, - 0xDF, 0x78, 0xBF, 0x5B, 0xF0, 0xBC, 0xA6, 0x28, 0x21, 0xB7, 0x8E, 0xED, 0xC4, 0xB0, 0xD8, 0xDC, - 0x21, 0x91, 0x2D, 0xA2, 0x95, 0xAD, 0xD6, 0xE0, 0x4A, 0x80, 0x1F, 0x02, 0xFE, 0xC5, 0x9F, 0xF0, - 0x55, 0x0D, 0x5F, 0xF6, 0xAA, 0xFD, 0xA1, 0xBE, 0x37, 0xFC, 0x1B, 0xB1, 0xF1, 0x6F, 0xFC, 0x13, - 0x67, 0xC7, 0x76, 0x5E, 0x02, 0xF8, 0x9C, 0xFA, 0x2F, 0x82, 0xB4, 0x5F, 0xD9, 0xBB, 0xF6, 0xFE, - 0x4F, 0x8A, 0xBF, 0x18, 0x3C, 0x57, 0xE1, 0xCB, 0x7F, 0x86, 0x3E, 0x1D, 0xD7, 0x2E, 0x35, 0x2F, - 0x0D, 0x68, 0x72, 0x78, 0x72, 0xDE, 0xDF, 0xC5, 0x10, 0x2E, 0xB9, 0xAE, 0x6A, 0xB6, 0x52, 0xEA, - 0x22, 0xE7, 0x43, 0xB6, 0xB6, 0x30, 0x5D, 0x5A, 0x3C, 0x4F, 0x2E, 0x93, 0x25, 0xCE, 0xA2, 0x01, - 0xF4, 0x25, 0xAF, 0xED, 0x8B, 0xFB, 0x4E, 0xEB, 0x7F, 0x1F, 0x7E, 0x08, 0xFC, 0x32, 0x97, 0xF6, - 0x1C, 0xF1, 0xD7, 0xC0, 0x1F, 0x06, 0xFC, 0x4B, 0xD3, 0xF5, 0xEB, 0x3B, 0xEF, 0x10, 0xFE, 0xD6, - 0x9F, 0x16, 0xBE, 0x1A, 0x78, 0x5A, 0x2F, 0x11, 0x6A, 0xFA, 0x6C, 0xBA, 0x65, 0xDC, 0x1A, 0x57, - 0x83, 0xEF, 0xBC, 0x11, 0xE2, 0x7F, 0x18, 0x35, 0xE6, 0xB1, 0x1E, 0x85, 0x17, 0x8D, 0xB5, 0x01, - 0xA4, 0x5D, 0xD8, 0x59, 0x8B, 0xB8, 0x74, 0xAB, 0x89, 0xD3, 0x50, 0xB6, 0x8B, 0x4E, 0xBA, 0xDE, - 0x01, 0xF5, 0x07, 0xC1, 0x0F, 0xDA, 0x23, 0x41, 0xF8, 0xC5, 0xFB, 0x27, 0x7C, 0x21, 0xFD, 0xAC, - 0xA4, 0xF0, 0xFE, 0xB7, 0xE1, 0x9F, 0x0C, 0x7C, 0x53, 0xFD, 0x9D, 0xBC, 0x3F, 0xFB, 0x44, 0xBF, - 0x85, 0x2D, 0x6D, 0x67, 0xF1, 0x8F, 0x88, 0xFC, 0x3F, 0x61, 0xAE, 0x78, 0x66, 0xDF, 0x59, 0x3A, - 0x74, 0x70, 0x59, 0xC2, 0x66, 0xBE, 0xB9, 0x86, 0x1B, 0xAF, 0x28, 0x25, 0xBC, 0x25, 0xE6, 0x74, - 0x01, 0x23, 0xCB, 0xAA, 0xD0, 0x07, 0x80, 0xFC, 0x49, 0xFD, 0xAF, 0x7E, 0x2A, 0x5A, 0xFE, 0xD0, - 0xFF, 0x00, 0x04, 0xBE, 0x0E, 0xFC, 0x11, 0xF8, 0x1D, 0x67, 0xE3, 0x7F, 0x05, 0xFC, 0x44, 0xF8, - 0x3F, 0xAF, 0x7E, 0xD0, 0xFA, 0xA7, 0xC6, 0x1F, 0x1D, 0x78, 0xDA, 0xCB, 0xC3, 0x5F, 0x0E, 0x3C, - 0x51, 0xE0, 0xBD, 0x01, 0xB4, 0x38, 0x35, 0x29, 0x7C, 0x1E, 0xFA, 0x33, 0xEB, 0x1E, 0x23, 0xB8, - 0xD6, 0x6D, 0xAE, 0x3C, 0x69, 0xE1, 0xA2, 0x2C, 0x6E, 0xFC, 0x39, 0x6F, 0x6F, 0x79, 0x1D, 0xE1, - 0x10, 0xEA, 0x08, 0xD0, 0xB0, 0x60, 0x0E, 0xDF, 0xE2, 0xEF, 0xED, 0x7D, 0xA0, 0x78, 0x2B, 0xE0, - 0x76, 0xA7, 0xF1, 0xD7, 0xC2, 0x97, 0x7F, 0x09, 0x7C, 0x27, 0xE0, 0xDF, 0x0A, 0xF8, 0xD6, 0xD7, - 0xC2, 0xBE, 0x37, 0xF1, 0x37, 0xED, 0xC3, 0xE3, 0xFF, 0x00, 0x13, 0xFE, 0xC0, 0xBF, 0x0F, 0xBC, - 0x37, 0x05, 0xD4, 0x28, 0xB0, 0xDC, 0xAE, 0xB1, 0xAE, 0x78, 0x4E, 0xEE, 0x69, 0x64, 0x92, 0xF2, - 0xFF, 0x00, 0x46, 0xB6, 0x85, 0x4D, 0x9C, 0x76, 0xF3, 0x3D, 0xC4, 0xE8, 0xB7, 0x5E, 0x75, 0xBF, - 0xD9, 0xE5, 0x00, 0xF9, 0x47, 0xFE, 0x09, 0xB5, 0xFF, 0x00, 0x05, 0x28, 0xD5, 0xBF, 0x6E, 0x1D, - 0x4F, 0xC5, 0x3E, 0x1F, 0xBE, 0xF1, 0x7F, 0xFC, 0x13, 0xE3, 0xC4, 0x5A, 0xBF, 0x86, 0x3C, 0x73, - 0xF1, 0x32, 0xD2, 0xFB, 0x43, 0xFD, 0x99, 0x7F, 0x6D, 0x49, 0x7E, 0x2F, 0xFC, 0x54, 0xD3, 0x7C, - 0x3B, 0xE1, 0x5F, 0x88, 0xFA, 0x9E, 0x83, 0xE1, 0x8D, 0x66, 0x5F, 0x04, 0x9F, 0x0F, 0xC4, 0xED, - 0xA5, 0x5D, 0xE9, 0xF6, 0x9A, 0x24, 0xCB, 0xAC, 0xB6, 0xA3, 0x0C, 0x37, 0xAB, 0x7B, 0x69, 0x7B, - 0x0D, 0x9D, 0xAA, 0x6A, 0x11, 0x59, 0x5A, 0x80, 0x7E, 0x91, 0x5F, 0x7C, 0x4B, 0x9E, 0xCB, 0xE3, - 0xB7, 0x85, 0x7E, 0x0E, 0x2E, 0x8D, 0x0B, 0xDA, 0x78, 0x8B, 0xE1, 0x26, 0xBF, 0xF1, 0x2D, 0xF5, - 0xFF, 0x00, 0xB6, 0xB2, 0x4F, 0x67, 0x26, 0x89, 0xAC, 0x68, 0xD6, 0x29, 0x64, 0xB6, 0xBE, 0x5E, - 0xD6, 0x59, 0x17, 0x5F, 0x77, 0x2F, 0xBC, 0x15, 0x30, 0x2A, 0x85, 0x3B, 0xF2, 0xA0, 0x1E, 0xB5, - 0x40, 0x05, 0x00, 0x14, 0x00, 0x50, 0x01, 0x40, 0x05, 0x00, 0x14, 0x00, 0x50, 0x01, 0x40, 0x05, - 0x00, 0x14, 0x01, 0x62, 0x80, 0x0A, 0x00, 0x28, 0x00, 0xA0, 0x02, 0x80, 0x0A, 0x00, 0xFF, 0x00, - 0x3F, 0x3F, 0xF8, 0x39, 0xF7, 0xFE, 0x53, 0x9F, 0xFF, 0x00, 0x04, 0x87, 0xFF, 0x00, 0xB0, 0x57, - 0xC3, 0xDF, 0xFD, 0x5B, 0xD7, 0x35, 0xD9, 0x96, 0x7F, 0xC8, 0xC3, 0x0F, 0xFE, 0x38, 0x7F, 0xE9, - 0x48, 0xE7, 0xC4, 0xFF, 0x00, 0xBA, 0xD4, 0xFF, 0x00, 0x0B, 0xFC, 0x8F, 0xB5, 0x2B, 0xF5, 0x33, - 0xE3, 0x82, 0x80, 0x0A, 0x00, 0x28, 0x03, 0xF6, 0x0B, 0xFE, 0x08, 0x85, 0xFF, 0x00, 0x22, 0x27, - 0xED, 0xD7, 0xFF, 0x00, 0x67, 0xCF, 0x07, 0xFE, 0xA8, 0x6F, 0x86, 0x55, 0xF9, 0xD7, 0x10, 0x7F, - 0xC8, 0xD2, 0x7E, 0x91, 0xFF, 0x00, 0xD2, 0x51, 0xF5, 0x19, 0x5F, 0xFB, 0x94, 0x7E, 0x7F, 0x99, - 0xFB, 0x6D, 0x5E, 0x29, 0xE8, 0x85, 0x00, 0x14, 0x00, 0x50, 0x01, 0x40, 0x05, 0x00, 0x14, 0x00, - 0x50, 0x01, 0x40, 0x08, 0x7E, 0xE9, 0xFF, 0x00, 0x77, 0xFA, 0x50, 0x04, 0x14, 0x00, 0x50, 0x01, - 0x40, 0x05, 0x00, 0x14, 0x00, 0x50, 0x01, 0x40, 0x05, 0x00, 0x14, 0x00, 0x50, 0x01, 0x40, 0x05, - 0x00, 0x14, 0x00, 0x50, 0x00, 0x38, 0x00, 0x0E, 0x30, 0x00, 0x18, 0xE3, 0x18, 0x1C, 0x63, 0xF2, - 0x14, 0x01, 0xF2, 0x3C, 0xBF, 0xB0, 0x07, 0xEC, 0x1D, 0x71, 0x2C, 0x93, 0xCF, 0xFB, 0x12, 0xFE, - 0xC8, 0xB3, 0x4F, 0x34, 0x8D, 0x2C, 0xD3, 0x4B, 0xFB, 0x36, 0x78, 0x32, 0x49, 0x65, 0x76, 0x39, - 0x66, 0x66, 0x3A, 0x76, 0x49, 0x24, 0x92, 0x49, 0xA0, 0x0C, 0x4F, 0x1F, 0x7E, 0xC9, 0x9E, 0x02, - 0xF0, 0x2F, 0xC3, 0x9B, 0x46, 0xFD, 0x93, 0x7E, 0x16, 0xFC, 0x06, 0xF8, 0x23, 0xE3, 0x3F, 0x00, - 0xFC, 0x4B, 0xD1, 0xFE, 0x37, 0xE8, 0x1A, 0x16, 0x87, 0xE0, 0x3D, 0x3F, 0xE1, 0x8F, 0xC3, 0x8F, - 0x1E, 0x6A, 0x3A, 0x1A, 0xBC, 0x57, 0x7A, 0x4F, 0x88, 0x26, 0xD2, 0x6D, 0x51, 0xED, 0x52, 0xFB, - 0x49, 0xBB, 0xD5, 0x74, 0xF4, 0xD4, 0xC4, 0x17, 0x8F, 0xA7, 0x3D, 0xD4, 0x17, 0xDF, 0x63, 0xBF, - 0x5B, 0x33, 0x61, 0x76, 0x01, 0xF6, 0x46, 0x9F, 0x74, 0x2F, 0xEC, 0x2C, 0x6F, 0x84, 0x2F, 0x6E, - 0x2F, 0x2C, 0xE2, 0xBA, 0x16, 0xF2, 0x49, 0x0C, 0xD2, 0x40, 0x24, 0x8C, 0x30, 0x46, 0x78, 0x5E, - 0x48, 0x98, 0x8C, 0xE0, 0x98, 0xDD, 0xD4, 0xE3, 0xE5, 0x66, 0x18, 0x24, 0x03, 0xCA, 0xBE, 0x3C, - 0x7C, 0x24, 0x83, 0xE3, 0x67, 0xC2, 0xCF, 0x11, 0xF8, 0x01, 0x3C, 0x43, 0xAB, 0x78, 0x2B, 0x5F, - 0x9D, 0xAC, 0xFC, 0x47, 0xE0, 0x0F, 0x88, 0x1E, 0x1F, 0xF2, 0x8E, 0xBB, 0xF0, 0xDB, 0xC5, 0x1A, - 0x1D, 0xEC, 0x3A, 0x87, 0x85, 0xFC, 0x47, 0x67, 0x0C, 0xA9, 0x25, 0xB5, 0xC3, 0xD8, 0x6A, 0x96, - 0x1A, 0x75, 0xC9, 0xB4, 0xBB, 0x86, 0xE2, 0xCE, 0xE9, 0x61, 0x7B, 0x5B, 0xBB, 0x7B, 0x8B, 0x5B, - 0x89, 0xED, 0xE5, 0x00, 0xA5, 0xFB, 0x3C, 0x7C, 0x29, 0x9F, 0xE0, 0xF7, 0xC2, 0xAF, 0x0F, 0xF8, - 0x6B, 0x5B, 0x9E, 0xD7, 0x54, 0xF8, 0x83, 0xAB, 0xBC, 0xFE, 0x39, 0xF8, 0xC3, 0xE2, 0x8B, 0x5D, - 0x46, 0xEF, 0x57, 0x8F, 0xC6, 0xBE, 0x34, 0xD7, 0x24, 0x37, 0x9E, 0x29, 0xD5, 0xE3, 0xB8, 0xB9, - 0x02, 0x61, 0x6F, 0x2D, 0xFC, 0xF7, 0x22, 0xDA, 0xDC, 0x24, 0x30, 0x5A, 0x5A, 0x25, 0x9D, 0x95, - 0xAD, 0xBD, 0xAD, 0xAD, 0xA5, 0xBD, 0xAD, 0xB8, 0x07, 0xB6, 0x8C, 0x70, 0x38, 0x03, 0x81, 0xD3, - 0xA7, 0xA0, 0x03, 0xF2, 0xA0, 0x0F, 0x8E, 0x3E, 0x09, 0xFE, 0xCF, 0xFA, 0x0F, 0x88, 0x7E, 0x1C, - 0xFC, 0x5C, 0xD6, 0xBE, 0x39, 0xF8, 0x6F, 0xE1, 0xF7, 0xC4, 0x4D, 0x43, 0xF6, 0xB8, 0xF8, 0xA3, - 0x1F, 0xED, 0x03, 0xF1, 0x3B, 0xC1, 0x33, 0xE9, 0x76, 0x5E, 0x32, 0xF8, 0x5D, 0x62, 0xD1, 0xE8, - 0xBA, 0x26, 0x95, 0xE1, 0x1D, 0x26, 0xD2, 0x29, 0x9A, 0xE6, 0xDE, 0xF0, 0xE9, 0xDA, 0x0F, 0x82, - 0xBC, 0x19, 0x1C, 0xB7, 0xCA, 0xED, 0x1D, 0xDE, 0xA3, 0x67, 0x79, 0xA9, 0x5B, 0xC7, 0x69, 0x1D, - 0xCC, 0x36, 0xB6, 0x80, 0x1D, 0x47, 0x84, 0xBE, 0x02, 0xF8, 0xE3, 0xE1, 0x57, 0x8A, 0x2D, 0xA4, - 0xF8, 0x4B, 0xF1, 0xBB, 0xC4, 0x16, 0xBF, 0x0A, 0x6F, 0xB5, 0xE3, 0xA8, 0xEB, 0xFF, 0x00, 0x06, - 0x7E, 0x2F, 0xE9, 0x57, 0x1F, 0x19, 0x34, 0x4F, 0x0E, 0x5A, 0xCB, 0x71, 0x24, 0xD7, 0x76, 0xBE, - 0x06, 0xD6, 0xE4, 0xBF, 0xB4, 0xD6, 0x34, 0x61, 0x2C, 0x97, 0x0C, 0xB1, 0xDB, 0xDE, 0xDD, 0xEB, - 0x1A, 0x6D, 0x94, 0x31, 0x5B, 0x5B, 0x58, 0x69, 0xB6, 0x50, 0x42, 0x22, 0x20, 0x1F, 0x49, 0x3E, - 0xA5, 0xA6, 0xC3, 0xA8, 0xD9, 0xE8, 0xF2, 0xDF, 0xD8, 0xC7, 0xAB, 0x5F, 0x59, 0x5C, 0x6A, 0x56, - 0x3A, 0x53, 0xDD, 0x46, 0x9A, 0x8D, 0xE5, 0xB5, 0xA4, 0x90, 0x47, 0x75, 0x71, 0x0C, 0x04, 0xEF, - 0x78, 0xA2, 0x7B, 0xDB, 0x25, 0x77, 0x50, 0x55, 0x0C, 0xF0, 0x82, 0x41, 0x91, 0x41, 0x00, 0xFC, - 0x9F, 0xF0, 0xC7, 0xFC, 0x13, 0xFD, 0x6D, 0x7C, 0x7B, 0xE1, 0xAF, 0x0A, 0xFC, 0x54, 0xFD, 0x97, - 0x3F, 0x63, 0x3F, 0x8D, 0x9E, 0x05, 0x83, 0x50, 0xB4, 0xD7, 0xFC, 0x4D, 0xFB, 0x6B, 0xDC, 0x78, - 0xB3, 0x5A, 0xF8, 0x61, 0xFB, 0x72, 0x6B, 0x5A, 0x8E, 0x8B, 0x2A, 0xEA, 0x1E, 0x1E, 0xD5, 0x35, - 0x6D, 0x36, 0xD7, 0xC3, 0x37, 0x2D, 0xAB, 0x6B, 0x71, 0xEA, 0xDA, 0x4F, 0x87, 0xE7, 0x9F, 0x56, - 0x4F, 0x17, 0xE9, 0x6A, 0xF3, 0xA3, 0x5F, 0xC1, 0xA7, 0xDA, 0x9B, 0x4B, 0x7B, 0x26, 0x00, 0xFB, - 0x3B, 0xF6, 0x7F, 0xF8, 0x6B, 0xF1, 0x77, 0xE1, 0x5E, 0xB9, 0xF1, 0x2B, 0xC2, 0x9E, 0x22, 0xBD, - 0xF8, 0x7D, 0x73, 0xF0, 0x73, 0xFE, 0x13, 0x8F, 0x12, 0xF8, 0xDF, 0xE1, 0x8D, 0xE6, 0x89, 0x75, - 0xA8, 0x5D, 0xFC, 0x41, 0xD7, 0xEE, 0x7C, 0x67, 0xE2, 0xDD, 0x4F, 0xC4, 0x5A, 0xAB, 0x6B, 0x96, - 0xB2, 0xDB, 0x45, 0x6B, 0xA6, 0xA5, 0x8C, 0xBA, 0xE3, 0x69, 0xF0, 0xC5, 0x6F, 0x71, 0xA8, 0xFD, - 0xB1, 0x2D, 0xC5, 0xEB, 0xC9, 0x64, 0xD2, 0xFD, 0x86, 0x20, 0x0F, 0x16, 0xF0, 0xBF, 0xEC, 0x4F, - 0xA9, 0xF8, 0x07, 0xE2, 0xA7, 0x8C, 0x7C, 0x61, 0xF0, 0xE3, 0xC6, 0xD6, 0xDE, 0x0B, 0xB2, 0xD2, - 0xBE, 0x10, 0xFC, 0x5A, 0xD2, 0xBE, 0x02, 0xF8, 0xB2, 0x7B, 0x08, 0xFC, 0x5F, 0xE3, 0x3F, 0x03, - 0xF8, 0xDF, 0xF6, 0x82, 0xF8, 0xA7, 0x7D, 0xE3, 0x9F, 0x8A, 0xFA, 0xC6, 0xB1, 0xA6, 0x4F, 0x0C, - 0x56, 0x17, 0xDA, 0x6D, 0xBE, 0xAB, 0xA4, 0xFC, 0x39, 0x7D, 0x22, 0xD8, 0x3A, 0x32, 0xA5, 0xB6, - 0xB7, 0x05, 0xD3, 0x4C, 0x25, 0x82, 0x55, 0x00, 0xED, 0x6C, 0xEF, 0x7F, 0x6F, 0xDF, 0x18, 0x7C, - 0x3D, 0xF8, 0xA5, 0xA0, 0x78, 0x9F, 0xE1, 0xF7, 0xEC, 0xD3, 0xF0, 0x37, 0xC7, 0x03, 0xC2, 0x69, - 0x07, 0xC2, 0x5F, 0x1B, 0x7C, 0x33, 0xFD, 0xA6, 0xB5, 0xDF, 0x8E, 0x17, 0xBA, 0xB6, 0xA5, 0xE6, - 0x62, 0xE1, 0x35, 0x18, 0xB5, 0x5F, 0x86, 0x7A, 0x4D, 0x96, 0x88, 0xEF, 0x02, 0x6D, 0x86, 0xFB, - 0xEC, 0x7E, 0x21, 0x86, 0xDA, 0x79, 0x96, 0x79, 0x74, 0x8B, 0xF8, 0xAD, 0x8D, 0x95, 0xE0, 0x07, - 0x84, 0x7E, 0xC8, 0xDF, 0xB2, 0xDF, 0xED, 0xA3, 0xF0, 0x8E, 0xDF, 0xE2, 0xFE, 0xB3, 0xF1, 0x93, - 0xE3, 0xA7, 0x83, 0x3C, 0x55, 0xAD, 0xFE, 0xD4, 0x1F, 0x15, 0x6F, 0xFE, 0x22, 0x7C, 0x64, 0xD3, - 0xE3, 0x96, 0x1F, 0x13, 0xFC, 0x42, 0xF8, 0x79, 0x2C, 0x7F, 0x0F, 0xB4, 0x3F, 0x09, 0xE8, 0x57, - 0xDE, 0x19, 0xF8, 0x83, 0xA5, 0x78, 0x77, 0xC2, 0xBA, 0x5E, 0xA3, 0x71, 0x15, 0xBF, 0x81, 0xF4, - 0x8B, 0x87, 0x8A, 0x4F, 0x05, 0x69, 0x28, 0xA2, 0xED, 0x60, 0x59, 0x1E, 0x5D, 0x36, 0x4B, 0xED, - 0x74, 0x02, 0x2F, 0x83, 0x3F, 0xB0, 0x9D, 0x9F, 0x86, 0xBE, 0x26, 0xF8, 0x6C, 0x7C, 0x50, 0xFD, - 0x92, 0xFF, 0x00, 0x62, 0x31, 0x65, 0xF0, 0xBF, 0x52, 0xB0, 0xF8, 0x87, 0xE0, 0xAF, 0xDB, 0x1B, - 0xE0, 0x76, 0xBF, 0xAE, 0x7C, 0x2C, 0xFD, 0xA7, 0x3C, 0x73, 0xE2, 0xFD, 0x36, 0x58, 0x5E, 0x0D, - 0x47, 0x5B, 0xF0, 0xAC, 0x5E, 0x1F, 0x13, 0x59, 0x9B, 0x88, 0xEE, 0xF5, 0xCB, 0x6B, 0xF9, 0xDF, - 0xC6, 0xDA, 0xBF, 0xF6, 0x8C, 0x32, 0x5E, 0x47, 0x73, 0x6C, 0xF6, 0xDA, 0xD5, 0xDD, 0x9D, 0xB8, - 0x07, 0xD3, 0x1F, 0xB1, 0xDF, 0xC1, 0xCF, 0x8A, 0x9F, 0xB3, 0xDF, 0xC3, 0x1D, 0x0F, 0xE0, 0x57, - 0x8B, 0x2F, 0xBE, 0x1F, 0xCB, 0xF0, 0x97, 0xE0, 0x57, 0x82, 0xBC, 0x3D, 0xF0, 0x37, 0xF6, 0x75, - 0x87, 0xC2, 0xF7, 0x5A, 0x8E, 0xB7, 0xE3, 0x2D, 0x63, 0xC2, 0x9E, 0x14, 0xB2, 0x7B, 0x3D, 0x33, - 0x5D, 0xF1, 0x6D, 0xF5, 0xC4, 0x16, 0xB0, 0xC3, 0xAA, 0xCF, 0x60, 0x34, 0x6B, 0x49, 0xB4, 0xFB, - 0x58, 0x27, 0x82, 0x29, 0x74, 0xAB, 0x8B, 0xD4, 0xBE, 0x90, 0x6A, 0xC2, 0xC3, 0x48, 0x00, 0xF3, - 0xEF, 0x04, 0xFE, 0xC8, 0x5E, 0x27, 0xF8, 0x39, 0x69, 0xF1, 0x9F, 0x50, 0xF8, 0x2F, 0xE2, 0xFD, - 0x3B, 0xC3, 0x1E, 0x35, 0xBB, 0xFD, 0x97, 0xFE, 0x1B, 0xFE, 0xCA, 0x3F, 0xB3, 0xEF, 0x88, 0xB5, - 0x76, 0x4D, 0x6C, 0x68, 0x1E, 0x1D, 0xF8, 0x55, 0xA5, 0x6B, 0x52, 0x78, 0x5A, 0x7F, 0x11, 0x43, - 0x2D, 0x83, 0xC2, 0xD7, 0xE7, 0x58, 0xF1, 0xCF, 0x8A, 0x8C, 0xF3, 0xC5, 0x0C, 0xF0, 0xB5, 0xA9, - 0xD3, 0xF6, 0xDA, 0x89, 0x21, 0x91, 0x67, 0x00, 0xD2, 0xF1, 0x29, 0xFF, 0x00, 0x82, 0x84, 0xFC, - 0x43, 0xF8, 0x1F, 0xF1, 0x37, 0x49, 0x8F, 0xC2, 0x9F, 0xB3, 0xBF, 0xEC, 0xE1, 0xF1, 0xBC, 0x5C, - 0x69, 0x67, 0xE1, 0x6E, 0xAB, 0xF0, 0xA7, 0xF6, 0x97, 0xD4, 0xFE, 0x32, 0x69, 0x5A, 0xBD, 0xB2, - 0x5E, 0x23, 0xEB, 0x10, 0xDE, 0xEB, 0x5A, 0xFF, 0x00, 0xC2, 0xB8, 0x2D, 0xF4, 0x3B, 0x87, 0xB7, - 0x89, 0xA1, 0x86, 0x76, 0xF0, 0xF7, 0x88, 0xE3, 0x53, 0x33, 0x48, 0xD6, 0xD9, 0x8D, 0x55, 0x80, - 0x30, 0x3F, 0x61, 0xBF, 0xD9, 0xDF, 0xF6, 0xA0, 0xFD, 0x99, 0x7E, 0x1E, 0x78, 0x6B, 0xC0, 0x9F, - 0x14, 0xFE, 0x2C, 0x7C, 0x38, 0xF8, 0xB3, 0xA5, 0xEB, 0xFE, 0x34, 0xF8, 0x81, 0xF1, 0x5B, 0xE2, - 0x3C, 0x27, 0xC3, 0xB2, 0x58, 0xF8, 0xF3, 0xC2, 0xFE, 0x23, 0xF8, 0x87, 0xE3, 0x8D, 0x6F, 0xC5, - 0xB7, 0xED, 0x65, 0xE2, 0x9B, 0x3B, 0x6D, 0x3F, 0x4C, 0xD7, 0xAD, 0xED, 0xEF, 0x3C, 0x49, 0x2D, - 0x83, 0x11, 0xE1, 0x9F, 0x0E, 0x0B, 0x81, 0xBF, 0x50, 0x8E, 0x2B, 0x15, 0x0B, 0xA4, 0x80, 0x0F, - 0xA6, 0xB5, 0x5F, 0x04, 0x78, 0xAA, 0xE3, 0xF6, 0x8B, 0xF0, 0x17, 0xC4, 0x6B, 0x2D, 0x17, 0xC0, - 0x32, 0x78, 0x23, 0x46, 0xF8, 0x2B, 0xE2, 0xDF, 0x04, 0x78, 0x8B, 0xC4, 0x17, 0xDA, 0xCE, 0xB7, - 0x17, 0xC5, 0x0B, 0x2D, 0x53, 0x52, 0xD7, 0x3C, 0x39, 0x75, 0xA3, 0x59, 0x69, 0x7A, 0x74, 0x7F, - 0xF1, 0x27, 0x93, 0x4B, 0x96, 0x0D, 0x27, 0x5C, 0x7B, 0xB9, 0xAE, 0x00, 0xBA, 0x8E, 0x68, 0x34, - 0x94, 0xB7, 0xFD, 0xD4, 0xD7, 0x58, 0x00, 0xF6, 0xBA, 0x00, 0x28, 0x00, 0xA0, 0x02, 0x80, 0x0A, - 0x00, 0x28, 0x00, 0xA0, 0x02, 0x80, 0x0A, 0x00, 0x28, 0x00, 0xA0, 0x0B, 0x14, 0x00, 0x50, 0x01, - 0x40, 0x05, 0x00, 0x14, 0x00, 0x50, 0x07, 0xF9, 0xF9, 0xFF, 0x00, 0xC1, 0xCF, 0xBF, 0xF2, 0x9C, - 0xFF, 0x00, 0xF8, 0x24, 0x3F, 0xFD, 0x82, 0xBE, 0x1E, 0xFF, 0x00, 0xEA, 0xDE, 0xB9, 0xAE, 0xCC, - 0xB3, 0xFE, 0x46, 0x18, 0x7F, 0xF1, 0xC3, 0xFF, 0x00, 0x4A, 0x47, 0x3E, 0x27, 0xFD, 0xD6, 0xA7, - 0xF8, 0x5F, 0xE4, 0x7D, 0xA9, 0x5F, 0xA9, 0x9F, 0x1C, 0x14, 0x00, 0x50, 0x01, 0x40, 0x1F, 0xB0, - 0x5F, 0xF0, 0x44, 0x2F, 0xF9, 0x11, 0x3F, 0x6E, 0xBF, 0xFB, 0x3E, 0x78, 0x3F, 0xF5, 0x43, 0x7C, - 0x32, 0xAF, 0xCE, 0xB8, 0x83, 0xFE, 0x46, 0x93, 0xF4, 0x8F, 0xFE, 0x92, 0x8F, 0xA8, 0xCA, 0xFF, - 0x00, 0xDC, 0xA3, 0xF3, 0xFC, 0xCF, 0xDB, 0x6A, 0xF1, 0x4F, 0x44, 0x28, 0x00, 0xA0, 0x02, 0x80, - 0x0A, 0x00, 0x28, 0x00, 0xA0, 0x02, 0x80, 0x0A, 0x00, 0x43, 0xF7, 0x4F, 0xFB, 0xBF, 0xD2, 0x80, - 0x20, 0xA0, 0x02, 0x80, 0x0A, 0x00, 0x28, 0x00, 0xA0, 0x02, 0x80, 0x0A, 0x00, 0x28, 0x00, 0xA0, - 0x02, 0x80, 0x0A, 0x00, 0x28, 0x00, 0xA0, 0x02, 0x80, 0x0A, 0x00, 0x28, 0x01, 0x0A, 0xAB, 0x29, - 0x42, 0xA0, 0xA9, 0x5D, 0xA5, 0x48, 0x1B, 0x48, 0x23, 0x90, 0x45, 0x00, 0x7C, 0x52, 0x73, 0xFB, - 0x14, 0xEE, 0x75, 0x56, 0x7F, 0xD8, 0xB4, 0xE3, 0x31, 0xC6, 0x92, 0x4D, 0x2F, 0xEC, 0x62, 0x71, - 0x2B, 0xCD, 0x34, 0x92, 0x34, 0xAC, 0x4F, 0xC3, 0xB3, 0x8B, 0x68, 0xE3, 0x86, 0x28, 0xC7, 0xFC, - 0x22, 0xDC, 0xF5, 0xF0, 0xE9, 0xFF, 0x00, 0x8A, 0x28, 0x03, 0xED, 0x71, 0x8C, 0x71, 0x8C, 0x0E, - 0x38, 0x18, 0xC6, 0x3B, 0x63, 0xF0, 0xA0, 0x03, 0xA0, 0xE0, 0x70, 0x07, 0x00, 0x0E, 0xC0, 0x70, - 0x00, 0xFC, 0xA8, 0x03, 0xE3, 0x02, 0xE3, 0xF6, 0xCE, 0x02, 0x3B, 0x77, 0x82, 0x4F, 0xD8, 0xC5, - 0xD0, 0xAD, 0xC5, 0xC2, 0x7D, 0x9E, 0xFE, 0xD3, 0xF6, 0xCD, 0x89, 0xE3, 0x85, 0x92, 0x38, 0x72, - 0xB2, 0x45, 0x27, 0xC3, 0xB7, 0x49, 0x6E, 0x23, 0x93, 0xEE, 0x3F, 0x88, 0x99, 0x30, 0xB8, 0xD0, - 0x79, 0xF1, 0x68, 0x07, 0xD9, 0x91, 0xC7, 0x1C, 0x31, 0xC7, 0x0C, 0x48, 0xB1, 0xC5, 0x14, 0x6B, - 0x14, 0x51, 0xA2, 0x85, 0x48, 0xD5, 0x46, 0x15, 0x54, 0x76, 0x00, 0x00, 0x31, 0x40, 0x0F, 0xA0, - 0x0F, 0x2E, 0xF8, 0xA9, 0xF0, 0xAB, 0x47, 0xF8, 0xA5, 0xA4, 0x69, 0x51, 0x4B, 0xA9, 0xEA, 0x9E, - 0x13, 0xF1, 0x77, 0x84, 0xB5, 0x43, 0xE2, 0x3F, 0x87, 0x5F, 0x11, 0x7C, 0x34, 0x96, 0xDF, 0xF0, - 0x96, 0x7C, 0x3B, 0xD5, 0xBE, 0xCD, 0x25, 0xB8, 0xBF, 0xD3, 0xCD, 0xC4, 0x52, 0xDB, 0xB8, 0x7B, - 0x7B, 0x9B, 0x98, 0x26, 0x82, 0x78, 0xA5, 0x82, 0xE2, 0x09, 0xA7, 0x82, 0x68, 0xDE, 0x39, 0x19, - 0x48, 0x07, 0x39, 0xF0, 0xAF, 0xE2, 0xA6, 0xAD, 0xAD, 0x6A, 0xD7, 0xFF, 0x00, 0x0B, 0x7E, 0x29, - 0xE9, 0xBA, 0x4F, 0x84, 0xBE, 0x36, 0xF8, 0x63, 0x4D, 0xFE, 0xD1, 0xD4, 0xB4, 0x8D, 0x22, 0x4B, - 0x83, 0xE1, 0x2F, 0x88, 0x5A, 0x64, 0x62, 0x05, 0x6F, 0x13, 0xF8, 0x4A, 0x5B, 0x85, 0x59, 0xAE, - 0x34, 0xE1, 0x25, 0xED, 0xAC, 0x37, 0x10, 0xB6, 0xE9, 0x74, 0xFB, 0x99, 0x16, 0xDA, 0x66, 0x91, - 0x24, 0xB4, 0xBA, 0xBE, 0x00, 0xF7, 0x4A, 0x00, 0x28, 0x00, 0xA0, 0x02, 0x80, 0x0A, 0x00, 0x28, - 0x00, 0xA0, 0x02, 0x80, 0x0A, 0x00, 0x28, 0x00, 0xA0, 0x02, 0x80, 0x0A, 0x00, 0x28, 0x00, 0xA0, - 0x02, 0x80, 0x0A, 0x00, 0x28, 0x00, 0xA0, 0x02, 0x80, 0x0A, 0x00, 0xB1, 0x40, 0x05, 0x00, 0x14, - 0x00, 0x50, 0x01, 0x40, 0x05, 0x00, 0x7F, 0x9F, 0x9F, 0xFC, 0x1C, 0xFB, 0xFF, 0x00, 0x29, 0xCF, - 0xFF, 0x00, 0x82, 0x43, 0xFF, 0x00, 0xD8, 0x2B, 0xE1, 0xEF, 0xFE, 0xAD, 0xEB, 0x9A, 0xEC, 0xCB, - 0x3F, 0xE4, 0x61, 0x87, 0xFF, 0x00, 0x1C, 0x3F, 0xF4, 0xA4, 0x73, 0xE2, 0x7F, 0xDD, 0x6A, 0x7F, - 0x85, 0xFE, 0x47, 0xDA, 0x95, 0xFA, 0x99, 0xF1, 0xC1, 0x40, 0x05, 0x00, 0x14, 0x01, 0xFB, 0x05, - 0xFF, 0x00, 0x04, 0x42, 0xFF, 0x00, 0x91, 0x13, 0xF6, 0xEB, 0xFF, 0x00, 0xB3, 0xE7, 0x83, 0xFF, - 0x00, 0x54, 0x37, 0xC3, 0x2A, 0xFC, 0xEB, 0x88, 0x3F, 0xE4, 0x69, 0x3F, 0x48, 0xFF, 0x00, 0xE9, - 0x28, 0xFA, 0x8C, 0xAF, 0xFD, 0xCA, 0x3F, 0x3F, 0xCC, 0xFD, 0xB6, 0xAF, 0x14, 0xF4, 0x42, 0x80, - 0x0A, 0x00, 0x28, 0x00, 0xA0, 0x02, 0x80, 0x0A, 0x00, 0x28, 0x00, 0xA0, 0x04, 0x3F, 0x74, 0xFF, - 0x00, 0xBB, 0xFD, 0x28, 0x02, 0x0A, 0x00, 0x28, 0x00, 0xA0, 0x02, 0x80, 0x0A, 0x00, 0x28, 0x00, - 0xA0, 0x02, 0x80, 0x0A, 0x00, 0x28, 0x00, 0xA0, 0x02, 0x80, 0x0A, 0x00, 0x28, 0x00, 0xA0, 0x02, - 0x80, 0x30, 0x3C, 0x55, 0xE2, 0xAF, 0x0C, 0xF8, 0x17, 0xC3, 0x1A, 0xF7, 0x8C, 0xFC, 0x65, 0xAF, - 0x69, 0x3E, 0x16, 0xF0, 0x8F, 0x85, 0x74, 0x89, 0xF5, 0xEF, 0x12, 0x78, 0x8F, 0x5D, 0xBD, 0x8F, - 0x4C, 0xD1, 0x74, 0x2B, 0x1B, 0x48, 0x8C, 0x97, 0x37, 0x57, 0x57, 0x0E, 0x42, 0x47, 0x14, 0x68, - 0x8C, 0xCC, 0xCC, 0x40, 0x00, 0x50, 0x07, 0x3B, 0xF0, 0xD3, 0xC5, 0xFA, 0xFF, 0x00, 0x8F, 0x3C, - 0x36, 0xDE, 0x28, 0xD6, 0xFC, 0x05, 0xAD, 0x7C, 0x3A, 0xB3, 0xD4, 0xB5, 0x09, 0x1F, 0xC2, 0xBA, - 0x17, 0x8A, 0xA7, 0x58, 0xBC, 0x69, 0x75, 0xA5, 0x2A, 0x20, 0xB6, 0xD4, 0x35, 0x7D, 0x35, 0x53, - 0x1A, 0x64, 0xF3, 0xB8, 0x9E, 0x44, 0xB2, 0x69, 0x65, 0x9A, 0x28, 0x0D, 0xA9, 0xB9, 0x16, 0xD7, - 0x4F, 0x3D, 0x95, 0x90, 0x07, 0xCC, 0xDE, 0x31, 0xFD, 0x92, 0xB5, 0xFD, 0x23, 0x48, 0xD1, 0x74, - 0xBF, 0x80, 0x7F, 0xB5, 0xBF, 0xED, 0x2B, 0xFB, 0x26, 0x7C, 0x31, 0xF0, 0x27, 0x84, 0x64, 0xD1, - 0xF4, 0x0F, 0x83, 0x1F, 0x02, 0xB4, 0x0F, 0x84, 0x1E, 0x20, 0xF8, 0x77, 0xA6, 0xA4, 0x77, 0xB7, - 0x77, 0x6A, 0x6C, 0x7F, 0xE1, 0x32, 0xF0, 0x2F, 0x88, 0xB5, 0x0B, 0x08, 0x23, 0x8E, 0xF2, 0x1B, - 0x3B, 0x7D, 0x3E, 0xCE, 0xEE, 0xDF, 0x4D, 0xB2, 0xB3, 0xB1, 0xB0, 0xB6, 0xB4, 0xB2, 0xB7, 0x8E, - 0x12, 0x1C, 0x03, 0xC9, 0x7E, 0x07, 0xFE, 0xCD, 0xDE, 0x36, 0xF8, 0xE3, 0xF0, 0xA7, 0xE1, 0x2F, - 0xC4, 0x4F, 0x8C, 0x5F, 0xB6, 0xCF, 0xED, 0x85, 0xF1, 0x9F, 0xE1, 0x77, 0xC5, 0x9F, 0x86, 0xBA, - 0x27, 0x8F, 0x3C, 0x5D, 0xFB, 0x3B, 0x7C, 0x4B, 0xB0, 0xF8, 0x23, 0xA2, 0x7C, 0x3D, 0xF1, 0x65, - 0xAE, 0xB9, 0xA3, 0xC5, 0x78, 0x9A, 0x1E, 0xBB, 0xA9, 0xF8, 0x4B, 0xE1, 0xBF, 0x87, 0xF5, 0xCB, - 0xAB, 0x18, 0xE4, 0xB9, 0x87, 0xCE, 0xB7, 0x86, 0xFE, 0xD6, 0xDE, 0xF9, 0x21, 0x6B, 0x5B, 0xC8, - 0x2E, 0x6C, 0xAE, 0xAE, 0xAC, 0xAE, 0x00, 0x3F, 0x40, 0x3C, 0x7F, 0xE2, 0x0F, 0x11, 0xF8, 0x53, - 0xC2, 0xB7, 0xDA, 0xFF, 0x00, 0x85, 0x3C, 0x13, 0x77, 0xF1, 0x07, 0x53, 0xD3, 0x6E, 0x6D, 0x26, - 0x9F, 0xC2, 0x7A, 0x5E, 0xAD, 0x6F, 0xA2, 0xEB, 0x17, 0xF6, 0x2D, 0x79, 0x12, 0xEA, 0x52, 0xD8, - 0x3C, 0xE0, 0x41, 0x2D, 0xD4, 0x36, 0xAF, 0x73, 0x34, 0x56, 0xF2, 0x3C, 0x2B, 0x3B, 0xC4, 0x90, - 0xF9, 0xD1, 0x79, 0x9E, 0x62, 0x80, 0x5A, 0xF0, 0x47, 0x8D, 0x7C, 0x2F, 0xF1, 0x1B, 0xC2, 0x7A, - 0x17, 0x8D, 0xFC, 0x17, 0xAA, 0xC7, 0xAD, 0x78, 0x63, 0xC4, 0x76, 0x0B, 0x7F, 0xA5, 0x5F, 0xA5, - 0xB4, 0xD6, 0x12, 0x95, 0xDC, 0x56, 0x48, 0x6E, 0x2D, 0x66, 0x44, 0x9E, 0xDA, 0xE2, 0x29, 0x23, - 0x92, 0x29, 0x6D, 0xE7, 0x8E, 0x39, 0xA1, 0x96, 0x39, 0x62, 0x91, 0x12, 0x48, 0xD9, 0x14, 0x03, - 0xAA, 0xA0, 0x02, 0x80, 0x3C, 0xE3, 0xE2, 0x3F, 0xC2, 0xEF, 0x0E, 0x7C, 0x4B, 0xB1, 0xD2, 0x57, - 0x54, 0x9F, 0x59, 0xD0, 0x7C, 0x43, 0xE1, 0x7D, 0x40, 0xEB, 0x9E, 0x07, 0xF1, 0xD7, 0x84, 0xF5, - 0x01, 0xA3, 0x78, 0xCB, 0xC0, 0xDA, 0x88, 0x89, 0xA3, 0x4B, 0xDD, 0x3E, 0xE4, 0xAB, 0xC4, 0xE3, - 0x6B, 0x95, 0x96, 0xD6, 0xE6, 0x2B, 0x8B, 0x3B, 0xA8, 0xCB, 0x5B, 0xDD, 0x5B, 0x5C, 0xC1, 0x24, - 0x90, 0xB8, 0x07, 0xCA, 0x3F, 0xF0, 0xC7, 0xDF, 0xB4, 0x27, 0xFD, 0x25, 0x57, 0xF6, 0xF6, 0xFF, - 0x00, 0xC3, 0x75, 0xFB, 0x2E, 0x7F, 0xF3, 0x9D, 0xA0, 0x03, 0xFE, 0x18, 0xFB, 0xF6, 0x84, 0xFF, - 0x00, 0xA4, 0xAA, 0xFE, 0xDE, 0xDF, 0xF8, 0x6E, 0xBF, 0x65, 0xCF, 0xFE, 0x73, 0xB4, 0x00, 0x7F, - 0xC3, 0x1F, 0x7E, 0xD0, 0x9F, 0xF4, 0x95, 0x5F, 0xDB, 0xDB, 0xFF, 0x00, 0x0D, 0xD7, 0xEC, 0xB9, - 0xFF, 0x00, 0xCE, 0x76, 0x80, 0x0F, 0xF8, 0x63, 0xEF, 0xDA, 0x13, 0xFE, 0x92, 0xAB, 0xFB, 0x7B, - 0x7F, 0xE1, 0xBA, 0xFD, 0x97, 0x3F, 0xF9, 0xCE, 0xD0, 0x01, 0xFF, 0x00, 0x0C, 0x7D, 0xFB, 0x42, - 0x7F, 0xD2, 0x55, 0x7F, 0x6F, 0x6F, 0xFC, 0x37, 0x5F, 0xB2, 0xE7, 0xFF, 0x00, 0x39, 0xDA, 0x00, - 0x3F, 0xE1, 0x8F, 0xBF, 0x68, 0x4F, 0xFA, 0x4A, 0xAF, 0xED, 0xED, 0xFF, 0x00, 0x86, 0xEB, 0xF6, - 0x5C, 0xFF, 0x00, 0xE7, 0x3B, 0x40, 0x07, 0xFC, 0x31, 0xF7, 0xED, 0x09, 0xFF, 0x00, 0x49, 0x55, - 0xFD, 0xBD, 0xBF, 0xF0, 0xDD, 0x7E, 0xCB, 0x9F, 0xFC, 0xE7, 0x68, 0x00, 0xFF, 0x00, 0x86, 0x3E, - 0xFD, 0xA1, 0x3F, 0xE9, 0x2A, 0xBF, 0xB7, 0xB7, 0xFE, 0x1B, 0xAF, 0xD9, 0x73, 0xFF, 0x00, 0x9C, - 0xED, 0x00, 0x1F, 0xF0, 0xC7, 0xDF, 0xB4, 0x27, 0xFD, 0x25, 0x57, 0xF6, 0xF6, 0xFF, 0x00, 0xC3, - 0x75, 0xFB, 0x2E, 0x7F, 0xF3, 0x9D, 0xA0, 0x03, 0xFE, 0x18, 0xFB, 0xF6, 0x84, 0xFF, 0x00, 0xA4, - 0xAA, 0xFE, 0xDE, 0xDF, 0xF8, 0x6E, 0xBF, 0x65, 0xCF, 0xFE, 0x73, 0xB4, 0x00, 0x7F, 0xC3, 0x1F, - 0x7E, 0xD0, 0x9F, 0xF4, 0x95, 0x5F, 0xDB, 0xDB, 0xFF, 0x00, 0x0D, 0xD7, 0xEC, 0xB9, 0xFF, 0x00, - 0xCE, 0x76, 0x80, 0x0F, 0xF8, 0x63, 0xEF, 0xDA, 0x13, 0xFE, 0x92, 0xAB, 0xFB, 0x7B, 0x7F, 0xE1, - 0xBA, 0xFD, 0x97, 0x3F, 0xF9, 0xCE, 0xD0, 0x07, 0xBA, 0x7C, 0x11, 0xF8, 0x33, 0xF1, 0x17, 0xE1, - 0x44, 0xFE, 0x23, 0x9B, 0xC7, 0x7F, 0xB5, 0x9F, 0xED, 0x03, 0xFB, 0x4C, 0x45, 0xAD, 0xC1, 0x69, - 0x16, 0x97, 0x67, 0xF1, 0xBB, 0xC3, 0x7F, 0x0A, 0x74, 0x0B, 0x6F, 0x06, 0xB5, 0xB3, 0x4A, 0x66, - 0x93, 0x4D, 0x3E, 0x0E, 0xF0, 0x67, 0x87, 0xA4, 0x76, 0x9C, 0x4D, 0x10, 0x90, 0x5E, 0x3D, 0xDA, - 0x81, 0x6F, 0x17, 0x94, 0xB1, 0x13, 0x21, 0x94, 0x03, 0xE8, 0x1A, 0x00, 0x28, 0x00, 0xA0, 0x02, - 0x80, 0x0A, 0x00, 0x28, 0x00, 0xA0, 0x02, 0x80, 0x2C, 0x50, 0x01, 0x40, 0x05, 0x00, 0x14, 0x00, - 0x50, 0x01, 0x40, 0x1F, 0xE7, 0xE7, 0xFF, 0x00, 0x07, 0x3E, 0xFF, 0x00, 0xCA, 0x73, 0xFF, 0x00, - 0xE0, 0x90, 0xFF, 0x00, 0xF6, 0x0A, 0xF8, 0x7B, 0xFF, 0x00, 0xAB, 0x7A, 0xE6, 0xBB, 0x32, 0xCF, - 0xF9, 0x18, 0x61, 0xFF, 0x00, 0xC7, 0x0F, 0xFD, 0x29, 0x1C, 0xF8, 0x9F, 0xF7, 0x5A, 0x9F, 0xE1, - 0x7F, 0x91, 0xF6, 0xA5, 0x7E, 0xA6, 0x7C, 0x70, 0x50, 0x01, 0x40, 0x05, 0x00, 0x7E, 0xC1, 0x7F, - 0xC1, 0x10, 0xBF, 0xE4, 0x44, 0xFD, 0xBA, 0xFF, 0x00, 0xEC, 0xF9, 0xE0, 0xFF, 0x00, 0xD5, 0x0D, - 0xF0, 0xCA, 0xBF, 0x3A, 0xE2, 0x0F, 0xF9, 0x1A, 0x4F, 0xD2, 0x3F, 0xFA, 0x4A, 0x3E, 0xA3, 0x2B, - 0xFF, 0x00, 0x72, 0x8F, 0xCF, 0xF3, 0x3F, 0x6D, 0xAB, 0xC5, 0x3D, 0x10, 0xA0, 0x02, 0x80, 0x0A, - 0x00, 0x28, 0x00, 0xA0, 0x02, 0x80, 0x0A, 0x00, 0x28, 0x01, 0x0F, 0xDD, 0x3F, 0xEE, 0xFF, 0x00, - 0x4A, 0x00, 0x82, 0x80, 0x0A, 0x00, 0x28, 0x00, 0xA0, 0x02, 0x80, 0x0A, 0x00, 0x28, 0x00, 0xA0, - 0x02, 0x80, 0x0A, 0x00, 0x28, 0x00, 0xA0, 0x02, 0x80, 0x0A, 0x00, 0x28, 0x00, 0xE0, 0x0E, 0x9C, - 0x01, 0xD3, 0x81, 0xC0, 0x1D, 0x3D, 0x3B, 0x0A, 0x00, 0xF9, 0x57, 0xC2, 0x5E, 0x1A, 0xF1, 0x17, - 0xC7, 0xAF, 0x10, 0x78, 0x77, 0xE2, 0xCF, 0xC5, 0x0D, 0x13, 0x55, 0xF0, 0xC7, 0xC3, 0x7F, 0x0D, - 0xEA, 0x36, 0xBE, 0x28, 0xF8, 0x21, 0xF0, 0x5F, 0xC4, 0x16, 0x32, 0x69, 0x9A, 0xC4, 0xB7, 0x90, - 0x2C, 0x86, 0xC7, 0xC6, 0xDE, 0x34, 0xD3, 0xE7, 0xB7, 0x86, 0xE6, 0xDB, 0x53, 0x09, 0x72, 0x0D, - 0x96, 0x89, 0x3E, 0xE5, 0xD3, 0x4C, 0x71, 0x5E, 0x5C, 0xAF, 0xF6, 0x9F, 0x93, 0x0E, 0x82, 0x01, - 0xF5, 0x50, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x80, 0x07, 0xE0, 0x28, - 0x03, 0x2F, 0x5C, 0x46, 0x7D, 0x13, 0x57, 0x8E, 0x34, 0x2C, 0xCD, 0xA5, 0x5C, 0x22, 0x22, 0x29, - 0x66, 0x62, 0x61, 0x60, 0x15, 0x40, 0xFC, 0x06, 0x05, 0x00, 0x78, 0x67, 0xEC, 0x87, 0xA7, 0xDF, - 0x69, 0x3F, 0xB2, 0x6F, 0xEC, 0xBD, 0xA5, 0x6A, 0x96, 0x37, 0x9A, 0x5E, 0xA7, 0xA6, 0x7E, 0xCE, - 0xDE, 0x08, 0xD3, 0xF5, 0x1D, 0x33, 0x51, 0xB5, 0x92, 0xC7, 0x50, 0xD3, 0xAE, 0x20, 0xF0, 0xCD, - 0x92, 0x4D, 0x6F, 0x3C, 0x0E, 0x15, 0xE3, 0x91, 0x1D, 0x19, 0x59, 0x18, 0x02, 0xA4, 0x10, 0x40, - 0x23, 0x00, 0x03, 0xE8, 0x7A, 0x00, 0xF9, 0x87, 0xC6, 0xDE, 0x09, 0xF1, 0x2F, 0xC2, 0x6F, 0x12, - 0xEB, 0x9F, 0x1A, 0x3E, 0x0B, 0xE8, 0x57, 0x1A, 0xED, 0xBE, 0xB9, 0x39, 0xD5, 0xFE, 0x35, 0x7C, - 0x14, 0xD1, 0xD6, 0xD6, 0xD0, 0x7C, 0x4B, 0x10, 0xDA, 0xB2, 0xB7, 0x88, 0x3C, 0x3C, 0x8C, 0xA8, - 0x89, 0xE2, 0xA5, 0x48, 0x6C, 0x61, 0x06, 0x59, 0xA2, 0xB7, 0xBF, 0xB7, 0x85, 0x2D, 0xA7, 0x64, - 0x92, 0x3B, 0x5B, 0xAB, 0x40, 0x0F, 0xA5, 0xED, 0x6E, 0x23, 0xBB, 0xB5, 0xB6, 0xBA, 0x85, 0x27, - 0x48, 0xAE, 0x6D, 0xD2, 0xE2, 0x24, 0xB9, 0xB4, 0x96, 0xC6, 0xE5, 0x15, 0xD4, 0x15, 0x59, 0x20, - 0x91, 0x56, 0x48, 0xD8, 0x02, 0x01, 0x47, 0x55, 0x65, 0x3C, 0x10, 0x08, 0xC0, 0x00, 0x9E, 0x80, - 0x0A, 0x00, 0x28, 0x00, 0xA0, 0x02, 0x80, 0x0A, 0x00, 0x28, 0x00, 0xA0, 0x02, 0x80, 0x0A, 0x00, - 0x28, 0x00, 0xA0, 0x02, 0x80, 0x0A, 0x00, 0x28, 0x00, 0xA0, 0x02, 0x80, 0x0A, 0x00, 0x28, 0x00, - 0xA0, 0x02, 0x80, 0x0A, 0x00, 0x28, 0x02, 0xC5, 0x00, 0x14, 0x00, 0x50, 0x01, 0x40, 0x05, 0x00, - 0x14, 0x01, 0xFE, 0x7E, 0x7F, 0xF0, 0x73, 0xEF, 0xFC, 0xA7, 0x3F, 0xFE, 0x09, 0x0F, 0xFF, 0x00, - 0x60, 0xAF, 0x87, 0xBF, 0xFA, 0xB7, 0xAE, 0x6B, 0xB3, 0x2C, 0xFF, 0x00, 0x91, 0x86, 0x1F, 0xFC, - 0x70, 0xFF, 0x00, 0xD2, 0x91, 0xCF, 0x89, 0xFF, 0x00, 0x75, 0xA9, 0xFE, 0x17, 0xF9, 0x1F, 0x6A, - 0x57, 0xEA, 0x67, 0xC7, 0x05, 0x00, 0x14, 0x00, 0x50, 0x07, 0xEC, 0x17, 0xFC, 0x11, 0x0B, 0xFE, - 0x44, 0x4F, 0xDB, 0xAF, 0xFE, 0xCF, 0x9E, 0x0F, 0xFD, 0x50, 0xDF, 0x0C, 0xAB, 0xF3, 0xAE, 0x20, - 0xFF, 0x00, 0x91, 0xA4, 0xFD, 0x23, 0xFF, 0x00, 0xA4, 0xA3, 0xEA, 0x32, 0xBF, 0xF7, 0x28, 0xFC, - 0xFF, 0x00, 0x33, 0xF6, 0xDA, 0xBC, 0x53, 0xD1, 0x0A, 0x00, 0x28, 0x00, 0xA0, 0x02, 0x80, 0x0A, - 0x00, 0x28, 0x00, 0xA0, 0x02, 0x80, 0x10, 0xFD, 0xD3, 0xFE, 0xEF, 0xF4, 0xA0, 0x08, 0x28, 0x00, - 0xA0, 0x02, 0x80, 0x0A, 0x00, 0x28, 0x00, 0xA0, 0x02, 0x80, 0x0A, 0x00, 0x28, 0x00, 0xA0, 0x02, - 0x80, 0x0A, 0x00, 0x28, 0x00, 0xA0, 0x02, 0x80, 0x0A, 0x00, 0x28, 0x00, 0xA0, 0x02, 0x80, 0x3E, - 0x5C, 0xFD, 0xA2, 0xFC, 0x4D, 0xF1, 0x38, 0xEB, 0x9F, 0x06, 0x3E, 0x0F, 0xFC, 0x2A, 0xF1, 0xB5, - 0x8F, 0xC2, 0xED, 0x5B, 0xE3, 0x57, 0x89, 0xF5, 0xAD, 0x03, 0xC4, 0x5F, 0x13, 0x7F, 0xE1, 0x12, - 0xB6, 0xF1, 0xA7, 0x8A, 0xBC, 0x15, 0xA3, 0x69, 0xBE, 0x18, 0xBE, 0xBB, 0xB9, 0xB8, 0xF0, 0xBD, - 0x9D, 0xDB, 0x9D, 0x32, 0x2D, 0x6F, 0xCF, 0x8E, 0xC0, 0xDA, 0xDC, 0xEA, 0x56, 0x9A, 0xA5, 0x8C, - 0x26, 0x37, 0x33, 0xE9, 0xB7, 0xA8, 0xDE, 0x49, 0x00, 0xA1, 0xFB, 0x29, 0xFC, 0x40, 0xF1, 0xF7, - 0x88, 0x1B, 0xF6, 0x82, 0xF8, 0x49, 0xF1, 0x2F, 0xC5, 0x29, 0xF1, 0x13, 0xC5, 0x7F, 0xB2, 0xDF, - 0xC7, 0x38, 0x7E, 0x06, 0x49, 0xF1, 0x52, 0x4F, 0x0E, 0xDA, 0x78, 0x47, 0x59, 0xF8, 0xA5, 0x63, - 0x75, 0xE0, 0x0F, 0x0B, 0xF8, 0xAF, 0x49, 0xD6, 0x35, 0x9D, 0x32, 0xCF, 0x16, 0x11, 0x6A, 0xCB, - 0x63, 0xE3, 0xBB, 0x2B, 0x4B, 0xE9, 0x2C, 0x61, 0xB2, 0xB3, 0xB9, 0xBB, 0xB2, 0xBA, 0xBB, 0xB5, - 0xB0, 0xD3, 0x6D, 0xEE, 0xA2, 0xD3, 0xAC, 0x80, 0x39, 0x1F, 0xDB, 0x2F, 0xC6, 0xDF, 0x15, 0xB1, - 0xF0, 0xD7, 0xE0, 0xAF, 0xEC, 0xF5, 0xE2, 0x38, 0xF4, 0x2F, 0x8E, 0x3E, 0x37, 0x5D, 0x7F, 0xE3, - 0x16, 0x91, 0x1C, 0x76, 0x66, 0xF2, 0xE6, 0x6D, 0x13, 0xE1, 0x9D, 0x8C, 0x3A, 0x97, 0x97, 0x71, - 0x1B, 0x4D, 0x04, 0x72, 0xE9, 0x37, 0xBE, 0x2A, 0xBF, 0xF8, 0x6D, 0xA0, 0xEA, 0x90, 0x2C, 0xD1, - 0x5C, 0x4F, 0xA6, 0x78, 0x93, 0x51, 0x86, 0xDA, 0x5B, 0x49, 0x64, 0x5D, 0x47, 0x4E, 0x00, 0xFA, - 0x97, 0xE1, 0x67, 0xC4, 0x3F, 0x0F, 0x7C, 0x5D, 0xF8, 0x61, 0xF0, 0xE3, 0xE2, 0xC7, 0x84, 0x6E, - 0x63, 0xBC, 0xF0, 0x9F, 0xC4, 0xFF, 0x00, 0x01, 0x68, 0xFF, 0x00, 0x11, 0x3C, 0x2F, 0x79, 0x16, - 0xF3, 0x15, 0xDE, 0x9D, 0xAD, 0xE9, 0xD0, 0xDE, 0x58, 0xCA, 0x85, 0xD1, 0x1F, 0x0D, 0x0D, 0xCC, - 0x44, 0x6E, 0x44, 0x3C, 0xF2, 0xAA, 0x78, 0x00, 0x0B, 0xF1, 0x43, 0xE2, 0x17, 0x86, 0xFE, 0x11, - 0x7C, 0x32, 0xF8, 0x89, 0xF1, 0x63, 0xC6, 0x17, 0x71, 0x69, 0xDE, 0x10, 0xF8, 0x5F, 0xE0, 0x4D, - 0x5F, 0xE2, 0x1F, 0x8A, 0xB5, 0x09, 0x7C, 0xC1, 0x0D, 0x86, 0x99, 0xA2, 0x69, 0xF2, 0xDE, 0x5F, - 0x4C, 0xFE, 0x5A, 0x3B, 0xED, 0x48, 0x2D, 0x65, 0x63, 0xB5, 0x1C, 0xE0, 0x70, 0xA4, 0xE0, 0x10, - 0x0F, 0x95, 0xFF, 0x00, 0x63, 0x1F, 0x1B, 0x7C, 0x59, 0xC7, 0xC4, 0x8F, 0x83, 0x1F, 0xB4, 0x27, - 0x88, 0x13, 0x59, 0xF8, 0xDD, 0xE0, 0xB8, 0xBC, 0x3F, 0xF1, 0x9F, 0x55, 0x82, 0x5B, 0x53, 0x6B, - 0x79, 0x65, 0xA2, 0xFC, 0x4D, 0xB2, 0x9F, 0x51, 0x36, 0xF0, 0xA2, 0xCD, 0x3C, 0x49, 0xA5, 0x58, - 0x78, 0xAB, 0x4E, 0xF8, 0x8F, 0xA1, 0x69, 0x70, 0x99, 0xA4, 0x9E, 0x0D, 0x33, 0xC3, 0xBA, 0x6C, - 0x17, 0x12, 0x5D, 0xCB, 0x13, 0x6A, 0x3A, 0x88, 0x07, 0xDC, 0x54, 0x00, 0x50, 0x07, 0xCB, 0xDF, - 0x11, 0x7E, 0x22, 0xF8, 0xBB, 0xC7, 0xFE, 0x2F, 0xD6, 0x3E, 0x00, 0xFC, 0x05, 0xD6, 0x1F, 0x45, - 0xF1, 0x36, 0x92, 0xB1, 0x5A, 0x7C, 0x6D, 0xF8, 0xDB, 0x65, 0x69, 0x6B, 0xA9, 0xD9, 0x7E, 0xCE, - 0x96, 0xB7, 0xB6, 0x31, 0x5C, 0xDB, 0x58, 0xE9, 0x50, 0xDD, 0x5A, 0xDC, 0xE9, 0xDA, 0x87, 0x8D, - 0x6E, 0x6D, 0x6F, 0xB4, 0xFB, 0x9B, 0x3D, 0x36, 0xEE, 0x29, 0x6D, 0xAC, 0x2D, 0x2E, 0x6D, 0xF5, - 0x7D, 0x4A, 0x29, 0x60, 0x97, 0x4B, 0xD2, 0xFC, 0x4C, 0x01, 0x36, 0xA1, 0xFB, 0x22, 0xFC, 0x1E, - 0xD5, 0x27, 0x86, 0xE6, 0xF7, 0x53, 0xF8, 0xF6, 0xD3, 0xC3, 0xA6, 0x58, 0xE9, 0x21, 0xAD, 0xBF, - 0x6B, 0x5F, 0x8B, 0x16, 0x09, 0x24, 0x5A, 0x75, 0x8C, 0x36, 0x96, 0xEF, 0x22, 0x45, 0xE2, 0x45, - 0x57, 0x98, 0xC5, 0x69, 0x11, 0x96, 0x66, 0x0D, 0x2C, 0xF2, 0x99, 0x67, 0x99, 0xE4, 0x96, 0x59, - 0x24, 0x70, 0x0A, 0x3F, 0xF0, 0xC6, 0x9F, 0x05, 0x3F, 0xE8, 0x23, 0xFB, 0x41, 0x7F, 0xE2, 0x61, - 0x7C, 0x5E, 0xFF, 0x00, 0xE6, 0x9A, 0x80, 0x0F, 0xF8, 0x63, 0x4F, 0x82, 0x9F, 0xF4, 0x11, 0xFD, - 0xA0, 0xBF, 0xF1, 0x30, 0xBE, 0x2F, 0x7F, 0xF3, 0x4D, 0x40, 0x07, 0xFC, 0x31, 0xA7, 0xC1, 0x4F, - 0xFA, 0x08, 0xFE, 0xD0, 0x5F, 0xF8, 0x98, 0x5F, 0x17, 0xBF, 0xF9, 0xA6, 0xA0, 0x03, 0xFE, 0x18, - 0xD3, 0xE0, 0xA7, 0xFD, 0x04, 0x7F, 0x68, 0x2F, 0xFC, 0x4C, 0x2F, 0x8B, 0xDF, 0xFC, 0xD3, 0x50, - 0x01, 0xFF, 0x00, 0x0C, 0x69, 0xF0, 0x53, 0xFE, 0x82, 0x3F, 0xB4, 0x17, 0xFE, 0x26, 0x17, 0xC5, - 0xEF, 0xFE, 0x69, 0xA8, 0x00, 0xFF, 0x00, 0x86, 0x34, 0xF8, 0x29, 0xFF, 0x00, 0x41, 0x1F, 0xDA, - 0x0B, 0xFF, 0x00, 0x13, 0x0B, 0xE2, 0xF7, 0xFF, 0x00, 0x34, 0xD4, 0x00, 0x7F, 0xC3, 0x1A, 0x7C, - 0x14, 0xFF, 0x00, 0xA0, 0x8F, 0xED, 0x05, 0xFF, 0x00, 0x89, 0x85, 0xF1, 0x7B, 0xFF, 0x00, 0x9A, - 0x6A, 0x00, 0x3F, 0xE1, 0x8D, 0x3E, 0x0A, 0x7F, 0xD0, 0x47, 0xF6, 0x82, 0xFF, 0x00, 0xC4, 0xC2, - 0xF8, 0xBD, 0xFF, 0x00, 0xCD, 0x35, 0x00, 0x1F, 0xF0, 0xC6, 0x9F, 0x05, 0x3F, 0xE8, 0x23, 0xFB, - 0x41, 0x7F, 0xE2, 0x61, 0x7C, 0x5E, 0xFF, 0x00, 0xE6, 0x9A, 0x80, 0x0F, 0xF8, 0x63, 0x4F, 0x82, - 0x9F, 0xF4, 0x11, 0xFD, 0xA0, 0xBF, 0xF1, 0x30, 0xBE, 0x2F, 0x7F, 0xF3, 0x4D, 0x40, 0x07, 0xFC, - 0x31, 0xA7, 0xC1, 0x4F, 0xFA, 0x08, 0xFE, 0xD0, 0x5F, 0xF8, 0x98, 0x5F, 0x17, 0xBF, 0xF9, 0xA6, - 0xA0, 0x03, 0xFE, 0x18, 0xD3, 0xE0, 0xA7, 0xFD, 0x04, 0x7F, 0x68, 0x2F, 0xFC, 0x4C, 0x2F, 0x8B, - 0xDF, 0xFC, 0xD3, 0x50, 0x01, 0xFF, 0x00, 0x0C, 0x69, 0xF0, 0x53, 0xFE, 0x82, 0x3F, 0xB4, 0x17, - 0xFE, 0x26, 0x17, 0xC5, 0xEF, 0xFE, 0x69, 0xA8, 0x03, 0xDF, 0x7C, 0x0D, 0xE0, 0x9D, 0x0B, 0xE1, - 0xD7, 0x85, 0xB4, 0xCF, 0x07, 0x78, 0x6E, 0x4F, 0x11, 0x4D, 0xA2, 0xE9, 0x0D, 0x70, 0xD6, 0x72, - 0x78, 0xB3, 0xC6, 0x7A, 0xCF, 0xC4, 0x1D, 0x7C, 0x9B, 0xAB, 0xA9, 0x2E, 0x25, 0x13, 0xEA, 0xFA, - 0xAD, 0xD5, 0xD5, 0xFC, 0xE0, 0x49, 0x71, 0x20, 0x41, 0x2C, 0xEE, 0x23, 0x40, 0x91, 0x26, 0xD8, - 0xE3, 0x44, 0x50, 0x0E, 0xB2, 0x80, 0x0A, 0x00, 0x28, 0x02, 0xC5, 0x00, 0x14, 0x00, 0x50, 0x01, - 0x40, 0x05, 0x00, 0x14, 0x01, 0xFE, 0x7E, 0x7F, 0xF0, 0x73, 0xEF, 0xFC, 0xA7, 0x3F, 0xFE, 0x09, - 0x0F, 0xFF, 0x00, 0x60, 0xAF, 0x87, 0xBF, 0xFA, 0xB7, 0xAE, 0x6B, 0xB3, 0x2C, 0xFF, 0x00, 0x91, - 0x86, 0x1F, 0xFC, 0x70, 0xFF, 0x00, 0xD2, 0x91, 0xCF, 0x89, 0xFF, 0x00, 0x75, 0xA9, 0xFE, 0x17, - 0xF9, 0x1F, 0x6A, 0x57, 0xEA, 0x67, 0xC7, 0x05, 0x00, 0x14, 0x00, 0x50, 0x07, 0xEC, 0x17, 0xFC, - 0x11, 0x0B, 0xFE, 0x44, 0x4F, 0xDB, 0xAF, 0xFE, 0xCF, 0x9E, 0x0F, 0xFD, 0x50, 0xDF, 0x0C, 0xAB, - 0xF3, 0xAE, 0x20, 0xFF, 0x00, 0x91, 0xA4, 0xFD, 0x23, 0xFF, 0x00, 0xA4, 0xA3, 0xEA, 0x32, 0xBF, - 0xF7, 0x28, 0xFC, 0xFF, 0x00, 0x33, 0xF6, 0xDA, 0xBC, 0x53, 0xD1, 0x0A, 0x00, 0x28, 0x00, 0xA0, - 0x02, 0x80, 0x0A, 0x00, 0x28, 0x00, 0xA0, 0x02, 0x80, 0x10, 0xFD, 0xD3, 0xFE, 0xEF, 0xF4, 0xA0, - 0x0F, 0x2B, 0xF8, 0xA3, 0xE3, 0xCF, 0x14, 0xFC, 0x3F, 0xD1, 0xF4, 0xDD, 0x4B, 0xC2, 0x7F, 0x04, - 0xFE, 0x26, 0xFC, 0x71, 0xBC, 0xBD, 0xD5, 0x06, 0x9D, 0x73, 0xE1, 0xDF, 0x85, 0x9A, 0xAF, 0x82, - 0xF4, 0x8D, 0x5F, 0x46, 0x84, 0xC1, 0x23, 0x9B, 0xEB, 0x97, 0xF1, 0x26, 0xBF, 0xA3, 0x5A, 0x18, - 0x03, 0x45, 0x1C, 0x5B, 0x61, 0x9E, 0x59, 0x77, 0x4B, 0x19, 0x11, 0x6C, 0x0E, 0xE8, 0x01, 0xE2, - 0x1F, 0xF0, 0xD2, 0x7F, 0x19, 0x7F, 0xE9, 0x1F, 0x1F, 0xB5, 0xEF, 0xFE, 0x16, 0x9F, 0x00, 0x7F, - 0xF9, 0xE5, 0xD0, 0x01, 0xFF, 0x00, 0x0D, 0x27, 0xF1, 0x97, 0xFE, 0x91, 0xF1, 0xFB, 0x5E, 0xFF, - 0x00, 0xE1, 0x69, 0xF0, 0x07, 0xFF, 0x00, 0x9E, 0x5D, 0x00, 0x1F, 0xF0, 0xD2, 0x7F, 0x19, 0x7F, - 0xE9, 0x1F, 0x1F, 0xB5, 0xEF, 0xFE, 0x16, 0x9F, 0x00, 0x7F, 0xF9, 0xE5, 0xD0, 0x01, 0xFF, 0x00, - 0x0D, 0x27, 0xF1, 0x97, 0xFE, 0x91, 0xF1, 0xFB, 0x5E, 0xFF, 0x00, 0xE1, 0x69, 0xF0, 0x07, 0xFF, - 0x00, 0x9E, 0x5D, 0x00, 0x1F, 0xF0, 0xD2, 0x7F, 0x19, 0x7F, 0xE9, 0x1F, 0x1F, 0xB5, 0xEF, 0xFE, - 0x16, 0x9F, 0x00, 0x7F, 0xF9, 0xE5, 0xD0, 0x01, 0xFF, 0x00, 0x0D, 0x27, 0xF1, 0x97, 0xFE, 0x91, - 0xF1, 0xFB, 0x5E, 0xFF, 0x00, 0xE1, 0x69, 0xF0, 0x07, 0xFF, 0x00, 0x9E, 0x5D, 0x00, 0x1F, 0xF0, - 0xD2, 0x7F, 0x19, 0x7F, 0xE9, 0x1F, 0x1F, 0xB5, 0xEF, 0xFE, 0x16, 0x9F, 0x00, 0x7F, 0xF9, 0xE5, - 0xD0, 0x01, 0xFF, 0x00, 0x0D, 0x27, 0xF1, 0x97, 0xFE, 0x91, 0xF1, 0xFB, 0x5E, 0xFF, 0x00, 0xE1, - 0x69, 0xF0, 0x07, 0xFF, 0x00, 0x9E, 0x5D, 0x00, 0x1F, 0xF0, 0xD2, 0x7F, 0x19, 0x7F, 0xE9, 0x1F, - 0x1F, 0xB5, 0xEF, 0xFE, 0x16, 0x9F, 0x00, 0x7F, 0xF9, 0xE5, 0xD0, 0x01, 0xFF, 0x00, 0x0D, 0x27, - 0xF1, 0x97, 0xFE, 0x91, 0xF1, 0xFB, 0x5E, 0xFF, 0x00, 0xE1, 0x69, 0xF0, 0x07, 0xFF, 0x00, 0x9E, - 0x5D, 0x00, 0x55, 0xBC, 0xFD, 0xA9, 0xFE, 0x25, 0x68, 0x96, 0x93, 0x6A, 0xFE, 0x26, 0xFD, 0x83, - 0x7F, 0x6C, 0x6D, 0x07, 0xC3, 0x5A, 0x62, 0x0B, 0xDF, 0x10, 0xEB, 0xB6, 0x72, 0xFC, 0x22, 0xF8, - 0x81, 0x73, 0xA0, 0xD8, 0x44, 0x41, 0xBC, 0xBE, 0x8F, 0x40, 0xD0, 0x3C, 0x77, 0xA8, 0xEB, 0xDA, - 0x99, 0x86, 0x11, 0x24, 0xBF, 0x62, 0xD2, 0xB4, 0xED, 0x42, 0xFE, 0xE3, 0x67, 0x93, 0x6B, 0x69, - 0x73, 0x3C, 0x91, 0x41, 0x20, 0x07, 0xD5, 0xDE, 0x1E, 0xF1, 0x06, 0x81, 0xE2, 0xDD, 0x03, 0x43, - 0xF1, 0x57, 0x85, 0x75, 0xBD, 0x1F, 0xC4, 0xBE, 0x17, 0xF1, 0x2E, 0x8F, 0x6B, 0xE2, 0x0F, 0x0E, - 0x78, 0x8B, 0xC3, 0xFA, 0x94, 0x1A, 0xCE, 0x83, 0xAF, 0xD8, 0x5E, 0xC0, 0x93, 0x59, 0x5E, 0xD8, - 0xDE, 0x42, 0xCD, 0x0C, 0xF6, 0xF2, 0xC3, 0x2C, 0x52, 0x47, 0x2C, 0x6C, 0xC8, 0xE8, 0xCA, 0xCA, - 0x48, 0x20, 0x90, 0x0E, 0x3F, 0xE2, 0x47, 0xC6, 0x2F, 0x84, 0x9F, 0x06, 0xF4, 0xFD, 0x3F, 0x55, - 0xF8, 0xB5, 0xF1, 0x3B, 0xC0, 0x1F, 0x0C, 0xB4, 0xDD, 0x56, 0xE5, 0xAC, 0xB4, 0x9B, 0xCF, 0x1E, - 0x78, 0xBB, 0x4F, 0xF0, 0x95, 0xBE, 0xA9, 0x34, 0x6A, 0x0C, 0x90, 0xDA, 0xB5, 0xCC, 0xB1, 0xF9, - 0xAE, 0xAA, 0xCA, 0x4A, 0xA6, 0xE2, 0xA0, 0x82, 0x40, 0x14, 0x01, 0xD9, 0xE8, 0x5A, 0xEE, 0x87, - 0xE2, 0x7D, 0x17, 0x4A, 0xF1, 0x1F, 0x86, 0x75, 0x8D, 0x27, 0xC4, 0x3E, 0x1D, 0xD7, 0x74, 0xF8, - 0x75, 0x5D, 0x0F, 0x5E, 0xD0, 0xB5, 0x08, 0x75, 0x6D, 0x17, 0x58, 0xB4, 0xB8, 0x8C, 0x3D, 0xBD, - 0xCD, 0xA5, 0xD4, 0x4C, 0xD1, 0x4B, 0x13, 0xA3, 0x2B, 0x2B, 0xA3, 0x15, 0x60, 0x41, 0x04, 0x83, - 0x40, 0x1C, 0x97, 0x8C, 0xFE, 0x2A, 0x78, 0x0B, 0xE1, 0xEE, 0xBF, 0xF0, 0xCB, 0xC2, 0xDE, 0x2E, - 0xD7, 0x57, 0x48, 0xD6, 0xFE, 0x30, 0x78, 0xC6, 0x5F, 0x00, 0xFC, 0x3D, 0xB3, 0xFE, 0xCE, 0xBB, - 0xBD, 0x4D, 0x63, 0x54, 0x87, 0x48, 0xBC, 0xD4, 0x9E, 0x19, 0xA6, 0x86, 0x27, 0x8A, 0xCE, 0x2F, - 0xB2, 0xE9, 0x37, 0x4A, 0xB7, 0x17, 0x4D, 0x04, 0x0D, 0x3B, 0xD9, 0xDA, 0x2C, 0x86, 0xE6, 0xF6, - 0xD6, 0x0B, 0x80, 0x0F, 0x42, 0xA0, 0x0A, 0x97, 0xD7, 0xD6, 0x3A, 0x55, 0x85, 0xE6, 0xA7, 0xA9, - 0x5D, 0xDA, 0xE9, 0xFA, 0x6E, 0x9B, 0x69, 0x25, 0xF5, 0xFD, 0xFD, 0xED, 0xC4, 0x76, 0x76, 0x56, - 0x30, 0x43, 0x19, 0x79, 0x66, 0x9A, 0x57, 0x21, 0x12, 0x34, 0x44, 0x66, 0x66, 0x62, 0x00, 0x00, - 0x92, 0x40, 0x14, 0x01, 0xC9, 0xFC, 0x33, 0xF8, 0x8D, 0xE0, 0xFF, 0x00, 0x8B, 0xFF, 0x00, 0x0F, - 0x3C, 0x11, 0xF1, 0x4F, 0xE1, 0xF6, 0xA5, 0x71, 0xAC, 0x78, 0x1F, 0xE2, 0x1F, 0x85, 0xAC, 0x7C, - 0x63, 0xE1, 0x4D, 0x4A, 0xF3, 0x45, 0xBE, 0xF0, 0xD6, 0xA1, 0x73, 0x61, 0xA8, 0x5B, 0xA4, 0xD6, - 0xC6, 0xEB, 0x4C, 0xBD, 0x86, 0x0B, 0xDB, 0x29, 0xC2, 0x48, 0xAB, 0x25, 0xAD, 0xD4, 0x10, 0xCF, - 0x03, 0x87, 0x8A, 0x58, 0xA3, 0x92, 0x36, 0x45, 0x00, 0xE6, 0x3E, 0x2D, 0xAF, 0x83, 0xBC, 0x33, - 0x63, 0xA3, 0x7C, 0x64, 0xF1, 0x37, 0x83, 0xFC, 0x49, 0xE2, 0xBB, 0xBF, 0x83, 0xB3, 0x5C, 0x6B, - 0x7A, 0x63, 0xF8, 0x45, 0x26, 0xBF, 0xD6, 0xFC, 0x37, 0x67, 0xA8, 0xC2, 0x2C, 0xB5, 0xDD, 0x52, - 0x3D, 0x31, 0x2E, 0x22, 0x17, 0xD1, 0xDB, 0x69, 0xD7, 0x17, 0x77, 0x12, 0xC0, 0x91, 0xDC, 0xDC, - 0xBC, 0x56, 0xF2, 0xAD, 0xA5, 0xB5, 0xC5, 0xD3, 0x41, 0x04, 0xC0, 0x1A, 0x1F, 0x0D, 0xBC, 0x21, - 0xF0, 0xC7, 0x4B, 0x97, 0xC7, 0x1F, 0x12, 0xFE, 0x19, 0x0D, 0x36, 0xF6, 0x1F, 0xDA, 0x1B, 0xC4, - 0xBA, 0x7F, 0xC6, 0x4F, 0x15, 0x78, 0xAB, 0x45, 0xF1, 0x14, 0xDE, 0x24, 0xD1, 0x3C, 0x7B, 0x7C, - 0x7C, 0x27, 0xA3, 0x68, 0x9A, 0x6E, 0xB1, 0x65, 0x29, 0x9E, 0x5B, 0x64, 0x81, 0xF4, 0x3F, 0x0B, - 0xF8, 0x6E, 0x24, 0x16, 0x9E, 0x5C, 0x0E, 0xB6, 0xEB, 0x38, 0x56, 0x92, 0x79, 0x65, 0x94, 0x03, - 0x8C, 0xBC, 0x97, 0xE1, 0x47, 0xC3, 0xFF, 0x00, 0xDA, 0x12, 0xC6, 0x76, 0x7B, 0xAB, 0xDF, 0x8D, - 0xDF, 0xB4, 0x87, 0x84, 0xED, 0xFC, 0x3D, 0x06, 0x95, 0x6A, 0xD0, 0x6A, 0x3A, 0xA2, 0xF8, 0x5F, - 0xE1, 0xC2, 0x5E, 0xDC, 0xC9, 0xA9, 0x3C, 0x1F, 0x2C, 0xD6, 0xFA, 0x35, 0x85, 0xE7, 0x8D, 0x96, - 0x19, 0x67, 0x25, 0xE2, 0x8E, 0xFB, 0xC4, 0x9A, 0x74, 0x58, 0x59, 0x35, 0x14, 0x12, 0x00, 0x79, - 0x67, 0x83, 0xBE, 0x2F, 0xFE, 0xCE, 0x1F, 0x02, 0xFC, 0x7F, 0xF1, 0xBB, 0xE0, 0xCE, 0x90, 0xFE, - 0x24, 0xF0, 0x9C, 0x9E, 0x1E, 0xF1, 0x5B, 0x7C, 0x63, 0xF1, 0xA4, 0x6F, 0xE1, 0x6B, 0xA9, 0x3C, - 0x1B, 0x65, 0xAD, 0x7C, 0x42, 0xD6, 0xAD, 0x6E, 0x35, 0x38, 0xF4, 0x98, 0x2D, 0x61, 0x32, 0xA7, - 0xDA, 0xF5, 0x6F, 0x14, 0xD8, 0x5E, 0xC9, 0x37, 0x90, 0xB6, 0xF7, 0x97, 0xBA, 0xCE, 0xAC, 0xD0, - 0x5C, 0xDD, 0xDD, 0x69, 0xDA, 0xE4, 0x7A, 0x50, 0x07, 0xB3, 0xFC, 0x6D, 0xD1, 0xBE, 0x14, 0xF8, - 0x8A, 0xCF, 0xE1, 0x7E, 0x8B, 0xF1, 0x66, 0x69, 0x1F, 0x4B, 0x9B, 0xE3, 0x67, 0x85, 0xF5, 0xAF, - 0x05, 0xE8, 0xED, 0x65, 0x2E, 0xA3, 0xA5, 0x6B, 0xBE, 0x2A, 0xD0, 0xEF, 0xBF, 0xB5, 0x7C, 0x2E, - 0x97, 0x90, 0xAC, 0x12, 0xC6, 0x56, 0xDF, 0x50, 0xD2, 0xAD, 0x2F, 0xA1, 0x79, 0x44, 0x6B, 0x15, - 0xD5, 0x8D, 0x94, 0xCB, 0x22, 0x49, 0x14, 0x46, 0x80, 0x3E, 0x7F, 0xF8, 0x53, 0xF1, 0xEB, 0xF6, - 0x7D, 0xFD, 0xA5, 0x3E, 0x33, 0xFC, 0x3A, 0xF1, 0xC7, 0x86, 0xF4, 0x4F, 0x88, 0x3A, 0x37, 0x8D, - 0x3C, 0x2B, 0xE0, 0xAF, 0x1A, 0x78, 0x7F, 0xE1, 0x8F, 0x8B, 0x3C, 0x49, 0xE1, 0x94, 0xF0, 0xF6, - 0x8B, 0xE2, 0xED, 0x2E, 0xEE, 0xFF, 0x00, 0x45, 0x3E, 0x2D, 0xD1, 0x63, 0x9D, 0x5A, 0x49, 0xA2, - 0x9D, 0x23, 0xB2, 0xF8, 0x7F, 0xA8, 0xCB, 0xA7, 0x5E, 0x0B, 0x39, 0xD1, 0xA6, 0x86, 0xDE, 0x58, - 0x06, 0xA3, 0xA0, 0x6B, 0x76, 0x3A, 0x00, 0x07, 0xDB, 0x5A, 0xD6, 0xB5, 0xA3, 0x78, 0x6B, 0x45, - 0xD5, 0xBC, 0x45, 0xE2, 0x2D, 0x5B, 0x4B, 0xF0, 0xFF, 0x00, 0x87, 0xBC, 0x3F, 0xA5, 0xDC, 0x6B, - 0x5A, 0xEE, 0xBB, 0xAD, 0x5F, 0xC3, 0xA4, 0xE8, 0xBA, 0x25, 0x95, 0xA4, 0x2D, 0x2D, 0xD5, 0xDD, - 0xDD, 0xD4, 0xAC, 0xB1, 0x43, 0x04, 0x51, 0x46, 0xEE, 0xF2, 0x3B, 0x2A, 0xA2, 0xAB, 0x31, 0x20, - 0x0E, 0x00, 0x38, 0xCD, 0x3B, 0xC4, 0xDE, 0x1C, 0xF8, 0xC9, 0xF0, 0xD2, 0xF7, 0x5B, 0xF8, 0x45, - 0xF1, 0x3F, 0x4C, 0xBA, 0xD1, 0x7C, 0x5D, 0xA3, 0xEA, 0x5A, 0x47, 0x85, 0x3E, 0x2A, 0xFC, 0x39, - 0xBE, 0xD2, 0x3C, 0x65, 0x69, 0xA5, 0xDD, 0x46, 0xF3, 0x59, 0xBE, 0xA1, 0xA6, 0x49, 0x2C, 0x77, - 0x5A, 0x75, 0xCC, 0xD6, 0xB7, 0x50, 0x4A, 0x02, 0x4D, 0x14, 0xF0, 0xF9, 0x90, 0x14, 0x92, 0x37, - 0x50, 0xC8, 0x40, 0x38, 0x18, 0xFC, 0x4D, 0xFB, 0x34, 0xFE, 0xC9, 0xDE, 0x15, 0xF0, 0x7F, 0xC3, - 0x9D, 0x6B, 0xE2, 0x37, 0xC3, 0x4F, 0x83, 0x9A, 0x34, 0xB6, 0xF7, 0x52, 0x78, 0x6A, 0xD3, 0xE2, - 0x77, 0xC5, 0x2B, 0x5D, 0x33, 0xC4, 0x7E, 0x30, 0x98, 0x4E, 0x25, 0xD5, 0xB5, 0x4B, 0xAD, 0x53, - 0x58, 0xBC, 0x3A, 0x86, 0xB3, 0xA8, 0x4D, 0x75, 0x7C, 0x6E, 0x2F, 0x75, 0x0B, 0x99, 0xAE, 0x6E, - 0xAE, 0x6E, 0x6E, 0xE4, 0xB8, 0xB9, 0x9A, 0x59, 0xAE, 0x1E, 0x49, 0x00, 0x33, 0xBF, 0x67, 0xDF, - 0xDA, 0xFB, 0xF6, 0x70, 0xFD, 0xA7, 0xBC, 0x2B, 0xF0, 0xDB, 0xC4, 0xFF, 0x00, 0x06, 0xBE, 0x2D, - 0x78, 0x1B, 0xC5, 0x32, 0xFC, 0x52, 0xF8, 0x70, 0xBF, 0x14, 0xFC, 0x31, 0xE1, 0x0B, 0x3F, 0x15, - 0x69, 0x97, 0x5E, 0x39, 0x8F, 0x49, 0x8E, 0xCF, 0x47, 0xB8, 0xD4, 0x5A, 0xEB, 0x4B, 0x86, 0xE2, - 0x49, 0x23, 0x92, 0xC4, 0x78, 0xC3, 0xC3, 0x11, 0xDE, 0x28, 0xDC, 0x2D, 0xA5, 0xD4, 0xEC, 0x63, - 0x90, 0x83, 0x3C, 0x7B, 0xC0, 0x3D, 0xEF, 0xC4, 0x3E, 0x24, 0xF0, 0xE7, 0x84, 0x34, 0x2D, 0x57, - 0xC4, 0xFE, 0x2C, 0xD7, 0xB4, 0x4F, 0x0B, 0xF8, 0x67, 0x40, 0xB0, 0x93, 0x53, 0xD7, 0x3C, 0x43, - 0xE2, 0x2D, 0x52, 0xDF, 0x44, 0xD0, 0xB4, 0x5B, 0x58, 0x57, 0x74, 0xB7, 0x17, 0x77, 0x73, 0x32, - 0x45, 0x0C, 0x48, 0xB8, 0x2C, 0xEE, 0xCA, 0xA0, 0x72, 0x48, 0x14, 0x01, 0xE4, 0xFF, 0x00, 0x01, - 0x7F, 0x69, 0x0F, 0x82, 0xBF, 0xB4, 0xC7, 0x86, 0x75, 0x5F, 0x15, 0xFC, 0x15, 0xF1, 0xFF, 0x00, - 0x86, 0xBC, 0x75, 0xA4, 0xE8, 0x1E, 0x24, 0xD4, 0x7C, 0x27, 0xAE, 0x8D, 0x07, 0x5B, 0xB2, 0xD5, - 0xEE, 0x34, 0x5B, 0xDD, 0x37, 0x51, 0xB9, 0xB2, 0x96, 0x3B, 0xA4, 0xB7, 0x96, 0x41, 0x18, 0x92, - 0x4D, 0x3E, 0x77, 0x88, 0xB1, 0x1B, 0xE2, 0x28, 0xE0, 0x61, 0xB8, 0x00, 0xF2, 0xEF, 0x88, 0x3F, - 0xB7, 0xE7, 0xEC, 0x75, 0xF0, 0xBF, 0xC6, 0xDE, 0x13, 0xF8, 0x77, 0xE2, 0xEF, 0xDA, 0x1B, 0xE1, - 0x26, 0x9F, 0xE2, 0xBF, 0x14, 0x7C, 0x47, 0xD4, 0x7E, 0x15, 0xDC, 0x69, 0x67, 0xE2, 0x16, 0x8B, - 0x1C, 0xBE, 0x0C, 0xD5, 0x74, 0xAD, 0x03, 0x58, 0xD5, 0x6F, 0x97, 0x5F, 0x47, 0xBA, 0x46, 0xB1, - 0x89, 0x22, 0xF0, 0xB6, 0xA1, 0x6C, 0x59, 0xD7, 0x3F, 0x6A, 0x96, 0xCE, 0xDF, 0x68, 0x69, 0x86, - 0x00, 0x24, 0xF8, 0xD5, 0xFB, 0x7A, 0xFE, 0xC8, 0x9F, 0x01, 0x3E, 0x11, 0xF8, 0xBF, 0xE3, 0x2F, - 0x8E, 0x3E, 0x3D, 0xFC, 0x2D, 0x7F, 0x0D, 0x78, 0x4B, 0xE0, 0xF6, 0xAD, 0xF1, 0xCE, 0xDB, 0x45, - 0xD0, 0xBE, 0x20, 0x68, 0x7A, 0x87, 0x8C, 0xFC, 0x6F, 0xE1, 0xED, 0x1E, 0xD2, 0xF6, 0x79, 0x67, - 0xF0, 0xDE, 0x96, 0xD7, 0x69, 0x26, 0xA2, 0xF3, 0x1D, 0x1F, 0x50, 0x82, 0xDD, 0x62, 0xCA, 0xCB, - 0x3C, 0x2F, 0x12, 0xB6, 0xE5, 0x6D, 0xA0, 0x1E, 0xE1, 0xF0, 0xFB, 0xE3, 0x67, 0xC1, 0xCF, 0x8B, - 0x17, 0xDA, 0xF6, 0x97, 0xF0, 0xB7, 0xE2, 0xAF, 0xC3, 0xAF, 0x88, 0xDA, 0x8F, 0x85, 0x6D, 0xAD, - 0x2F, 0x3C, 0x49, 0x61, 0xE0, 0x6F, 0x19, 0x69, 0xDE, 0x29, 0xBA, 0xD0, 0x60, 0xBE, 0xB9, 0xBC, - 0xB7, 0xB1, 0x9E, 0xEE, 0x3B, 0x69, 0x5C, 0xC5, 0x14, 0xD3, 0xE8, 0xBA, 0xBC, 0x51, 0x3B, 0x00, - 0xAE, 0xF6, 0x37, 0x6A, 0xA4, 0x98, 0x5C, 0x28, 0x07, 0x59, 0xE2, 0xCF, 0x18, 0xF8, 0x43, 0xC0, - 0x3A, 0x05, 0xDF, 0x8A, 0x7C, 0x73, 0xE2, 0xAF, 0x0D, 0x78, 0x2B, 0xC2, 0xFA, 0x7C, 0xD6, 0xD6, - 0xD7, 0xDE, 0x23, 0xF1, 0x6E, 0xB9, 0x6B, 0xE1, 0xBD, 0x02, 0xC6, 0x4B, 0xCB, 0xA8, 0xED, 0xAC, - 0xE3, 0x9A, 0xF2, 0xE1, 0xD2, 0x14, 0x69, 0x6E, 0x6E, 0x2D, 0xE1, 0x8C, 0x33, 0x02, 0xF2, 0x4B, - 0x1A, 0x2E, 0x59, 0x80, 0x20, 0x1E, 0x63, 0xFB, 0x38, 0x7E, 0xD1, 0x9F, 0x08, 0x3F, 0x6A, 0xFF, - 0x00, 0x83, 0x7E, 0x04, 0xF8, 0xEB, 0xF0, 0x3B, 0xC5, 0xDA, 0x5F, 0x8C, 0x7C, 0x01, 0xE3, 0xFF, - 0x00, 0x0C, 0xE9, 0x7E, 0x25, 0xD3, 0x6E, 0x74, 0xFB, 0xFB, 0x5B, 0xCB, 0xED, 0x1B, 0xFB, 0x53, - 0x4A, 0xB5, 0xD4, 0x22, 0xD3, 0x75, 0x48, 0xA0, 0x96, 0x45, 0xB5, 0xBF, 0x8A, 0xDF, 0x51, 0xB4, - 0xF3, 0xAD, 0xD9, 0xCB, 0x44, 0xCD, 0xB4, 0xFB, 0x80, 0x79, 0x26, 0xB5, 0xFF, 0x00, 0x05, 0x0C, - 0xFD, 0x89, 0xFC, 0x3F, 0xE3, 0x5F, 0x0F, 0xF8, 0x0B, 0x51, 0xFD, 0xA6, 0xBE, 0x0A, 0xC7, 0xAD, - 0x78, 0x82, 0xD3, 0x55, 0xB9, 0x8A, 0x68, 0xFE, 0x25, 0xE8, 0x6D, 0xA5, 0x69, 0x27, 0x46, 0x6B, - 0x75, 0xBA, 0x82, 0xFE, 0x7F, 0xB5, 0x0F, 0x22, 0x56, 0x37, 0xB1, 0x88, 0xD1, 0x86, 0x5B, 0xCB, - 0x98, 0x71, 0xB0, 0xD0, 0x06, 0xCF, 0xC4, 0xFF, 0x00, 0xDB, 0xA3, 0xF6, 0x46, 0xF8, 0x43, 0xA7, - 0xE8, 0xB7, 0x9E, 0x31, 0xFD, 0xA0, 0xFE, 0x10, 0x5B, 0xDC, 0x6B, 0xDE, 0x25, 0xF0, 0x57, 0x86, - 0x74, 0xDD, 0x0E, 0xD3, 0xE2, 0x5E, 0x81, 0x27, 0x88, 0xA4, 0x3E, 0x3E, 0xD6, 0x74, 0xBD, 0x3B, - 0xC3, 0x97, 0xE6, 0xC5, 0xEF, 0x12, 0x51, 0x62, 0xE7, 0xC4, 0x7A, 0x65, 0xD3, 0xCF, 0xB7, 0x6A, - 0xDA, 0x33, 0x5C, 0x0D, 0xC8, 0x06, 0xE0, 0x0F, 0x71, 0xF8, 0x73, 0xF1, 0x67, 0xE1, 0x6F, 0xC5, - 0xFD, 0x22, 0x6D, 0x7B, 0xE1, 0x4F, 0xC4, 0x4F, 0x04, 0x7C, 0x48, 0xD0, 0xED, 0xA6, 0xFB, 0x2D, - 0xC6, 0xAB, 0xE0, 0x6F, 0x13, 0xD9, 0x78, 0xA3, 0x4F, 0xB6, 0x90, 0x12, 0x04, 0x72, 0x4B, 0x6D, - 0x23, 0xAA, 0xB7, 0xEE, 0xDF, 0x82, 0x41, 0xF9, 0x4F, 0xA5, 0x00, 0x71, 0x9F, 0xB4, 0x9F, 0xED, - 0x1F, 0xF0, 0x8B, 0xF6, 0x4B, 0xF8, 0x2B, 0xF1, 0x07, 0xE3, 0xD7, 0xC6, 0xDF, 0x14, 0xE9, 0xFE, - 0x15, 0xF0, 0x1F, 0xC3, 0x9F, 0x07, 0x6B, 0x3E, 0x30, 0xBE, 0x59, 0xEF, 0xAD, 0x2D, 0xB5, 0xBF, - 0x11, 0xAE, 0x89, 0xA2, 0xDD, 0xEA, 0x97, 0x3A, 0x5E, 0x87, 0x6B, 0x3C, 0xD1, 0x0B, 0xDD, 0x4A, - 0x4B, 0x4D, 0x26, 0xF9, 0xA1, 0xB5, 0x8D, 0xB7, 0xC8, 0x62, 0x60, 0x30, 0x14, 0x95, 0x00, 0xF4, - 0x5F, 0x0B, 0x7C, 0x42, 0xF0, 0x17, 0x8D, 0xFC, 0x23, 0x17, 0x8F, 0xBC, 0x17, 0xE3, 0x4F, 0x0A, - 0x78, 0xB7, 0xC0, 0xB3, 0xA5, 0xEB, 0xDB, 0xF8, 0xCB, 0xC3, 0x3A, 0xFD, 0xA6, 0xB9, 0xE1, 0x5B, - 0x85, 0xD3, 0xAE, 0x65, 0xB7, 0xBF, 0x68, 0xB5, 0x08, 0x5D, 0xA0, 0x65, 0x86, 0x7B, 0x4B, 0xA8, - 0xDC, 0xAB, 0x10, 0xAD, 0x14, 0x8A, 0x70, 0x54, 0xE0, 0x03, 0xE5, 0x9B, 0xAF, 0xF8, 0x28, 0xC7, - 0xEC, 0x39, 0x65, 0xE3, 0x2D, 0x23, 0xC1, 0x12, 0xFE, 0xD4, 0x7F, 0x03, 0xBE, 0xDF, 0xAB, 0xF8, - 0x4B, 0x53, 0xF1, 0x8C, 0x3A, 0xAC, 0x7F, 0x14, 0x34, 0x26, 0xF0, 0xDD, 0xA5, 0xAE, 0x95, 0x77, - 0x63, 0x6F, 0x3C, 0x37, 0x17, 0x9F, 0x6A, 0xDB, 0x1D, 0xC3, 0xB6, 0xAF, 0x6E, 0xD1, 0xC6, 0x47, - 0xCE, 0x91, 0x5C, 0x30, 0x20, 0x44, 0x72, 0x01, 0xF4, 0xEF, 0xC4, 0x4F, 0x89, 0x3E, 0x0B, 0xF8, - 0x51, 0xE1, 0xFD, 0x3F, 0xC4, 0xFE, 0x3D, 0xD5, 0xCE, 0x85, 0xA1, 0xEA, 0x7E, 0x39, 0xF0, 0xBF, - 0xC3, 0x5B, 0x0B, 0xC4, 0xD3, 0x2E, 0xF5, 0x53, 0x3E, 0xB7, 0xE3, 0x3F, 0x12, 0xD8, 0x78, 0x7F, - 0xC3, 0x56, 0x5E, 0x55, 0xB4, 0x52, 0x48, 0xBF, 0x69, 0xD5, 0xF5, 0xDD, 0x2A, 0xDB, 0xCD, 0x65, - 0x11, 0x45, 0xE7, 0xF9, 0xB3, 0x3C, 0x51, 0x47, 0x24, 0x88, 0x01, 0xDC, 0xD0, 0x01, 0x40, 0x05, - 0x00, 0x58, 0xA0, 0x02, 0x80, 0x0A, 0x00, 0x28, 0x00, 0xA0, 0x02, 0x80, 0x3F, 0xCF, 0xCF, 0xFE, - 0x0E, 0x7D, 0xFF, 0x00, 0x94, 0xE7, 0xFF, 0x00, 0xC1, 0x21, 0xFF, 0x00, 0xEC, 0x15, 0xF0, 0xF7, - 0xFF, 0x00, 0x56, 0xF5, 0xCD, 0x76, 0x65, 0x9F, 0xF2, 0x30, 0xC3, 0xFF, 0x00, 0x8E, 0x1F, 0xFA, - 0x52, 0x39, 0xF1, 0x3F, 0xEE, 0xB5, 0x3F, 0xC2, 0xFF, 0x00, 0x23, 0xED, 0x4A, 0xFD, 0x4C, 0xF8, - 0xE0, 0xA0, 0x02, 0x80, 0x0A, 0x00, 0xFD, 0x82, 0xFF, 0x00, 0x82, 0x21, 0x7F, 0xC8, 0x89, 0xFB, - 0x75, 0xFF, 0x00, 0xD9, 0xF3, 0xC1, 0xFF, 0x00, 0xAA, 0x1B, 0xE1, 0x95, 0x7E, 0x75, 0xC4, 0x1F, - 0xF2, 0x34, 0x9F, 0xA4, 0x7F, 0xF4, 0x94, 0x7D, 0x46, 0x57, 0xFE, 0xE5, 0x1F, 0x9F, 0xE6, 0x7E, - 0xDB, 0x57, 0x8A, 0x7A, 0x21, 0x40, 0x05, 0x00, 0x14, 0x00, 0x50, 0x01, 0x40, 0x05, 0x00, 0x14, - 0x00, 0x50, 0x02, 0x1F, 0xBA, 0x7F, 0xDD, 0xFE, 0x94, 0x01, 0x05, 0x00, 0x14, 0x00, 0x50, 0x01, - 0x40, 0x05, 0x00, 0x14, 0x00, 0x50, 0x01, 0x40, 0x05, 0x00, 0x14, 0x00, 0x50, 0x01, 0x40, 0x1F, - 0x20, 0x6B, 0xFE, 0x13, 0xF1, 0x27, 0xEC, 0xD7, 0xE2, 0x5D, 0x67, 0xE2, 0x57, 0xC2, 0x4F, 0x0D, - 0x6A, 0xDE, 0x29, 0xF8, 0x27, 0xE2, 0xED, 0x7E, 0xEB, 0xC4, 0xFF, 0x00, 0x1B, 0x3E, 0x03, 0xF8, - 0x3B, 0x47, 0x1A, 0x8E, 0xBD, 0xE1, 0x1D, 0x57, 0x55, 0xBF, 0x6B, 0x9D, 0x67, 0xE2, 0x2F, 0x80, - 0xB4, 0xD8, 0x54, 0x49, 0x3D, 0xC4, 0xF7, 0x17, 0x77, 0xB7, 0xBA, 0xEE, 0x87, 0x08, 0x92, 0x4D, - 0x51, 0xCC, 0xFA, 0xA6, 0x99, 0x13, 0x6B, 0x4D, 0x7B, 0x63, 0xE3, 0x10, 0x0D, 0x3F, 0x0E, 0xC5, - 0x63, 0xF1, 0x13, 0xF6, 0x90, 0xF8, 0x7F, 0xF1, 0xDB, 0xC1, 0xD7, 0x1A, 0x37, 0x8E, 0xBE, 0x13, - 0xEA, 0xDF, 0xB2, 0x9D, 0xC4, 0x5F, 0x0E, 0xBE, 0x29, 0xF8, 0x6F, 0x51, 0xB4, 0xF1, 0x37, 0x83, - 0xF5, 0x18, 0x3C, 0x4B, 0xAE, 0xE9, 0xBA, 0x87, 0x99, 0xA1, 0x6A, 0x90, 0xBB, 0xC5, 0x25, 0xB6, - 0xA1, 0x67, 0xA6, 0xE8, 0xF7, 0x26, 0x5B, 0x76, 0x31, 0x5C, 0xC7, 0x69, 0x60, 0xE5, 0x9C, 0x41, - 0x09, 0x40, 0x0A, 0x7F, 0xB1, 0x17, 0x82, 0xFC, 0x67, 0xF0, 0xF3, 0xE0, 0x6E, 0xB3, 0xE1, 0x0F, - 0x1C, 0x69, 0x1A, 0xBE, 0x81, 0x75, 0xA4, 0xFE, 0xD2, 0xBF, 0x1B, 0x9B, 0xC1, 0xFA, 0x1E, 0xAF, - 0x2B, 0x38, 0xD1, 0xFC, 0x1B, 0x73, 0xF1, 0xA7, 0xC5, 0x53, 0xF8, 0x02, 0xD7, 0x4E, 0x8C, 0xB3, - 0x2C, 0x1A, 0x5C, 0x7E, 0x19, 0x9F, 0xC3, 0xA9, 0x61, 0x6D, 0x1E, 0xD8, 0xAD, 0xEC, 0x96, 0xCA, - 0x08, 0x92, 0x38, 0xE2, 0x48, 0xD0, 0x03, 0xC9, 0xFE, 0x29, 0xFC, 0x18, 0xF8, 0x83, 0xFB, 0x4E, - 0xF8, 0xF3, 0xE3, 0x86, 0xBB, 0x1C, 0x96, 0x9F, 0x0E, 0x17, 0xE1, 0x07, 0x85, 0xED, 0x7E, 0x16, - 0x7E, 0xCB, 0xBA, 0xAF, 0x8B, 0x7C, 0x1F, 0x7D, 0x7B, 0x63, 0xAC, 0x78, 0xB6, 0xDB, 0x56, 0xF0, - 0xFF, 0x00, 0x8B, 0xEF, 0xBC, 0x69, 0xAB, 0xDB, 0x9B, 0x88, 0x27, 0xBA, 0xD0, 0xA2, 0xD7, 0xFC, - 0x2B, 0xE0, 0x7B, 0x0B, 0x78, 0x2C, 0x1B, 0x4C, 0xBA, 0x3F, 0xD8, 0xBE, 0x23, 0x9D, 0x2F, 0xE4, - 0x17, 0xDA, 0x5C, 0xFA, 0x50, 0x07, 0xD9, 0xBF, 0x09, 0x7C, 0x6B, 0xAA, 0x7C, 0x46, 0xF8, 0x67, - 0xE0, 0x6F, 0x1B, 0xEB, 0xDE, 0x0A, 0xD7, 0xFE, 0x1B, 0xF8, 0x8B, 0xC4, 0x7E, 0x1B, 0xB5, 0xD4, - 0x3C, 0x4B, 0xF0, 0xF3, 0xC5, 0x11, 0x15, 0xD7, 0xBC, 0x0B, 0xAA, 0x18, 0xC2, 0xEA, 0x5A, 0x3D, - 0xCC, 0xBB, 0x12, 0x3B, 0x83, 0x6D, 0x72, 0x97, 0x10, 0x8B, 0x98, 0x41, 0x82, 0xE1, 0x63, 0x59, - 0xE0, 0x67, 0x86, 0x58, 0xDD, 0x80, 0x3C, 0x57, 0xF6, 0xB1, 0xD1, 0x3C, 0x4F, 0xF1, 0x2F, 0xC2, - 0x5E, 0x16, 0xFD, 0x9E, 0x3C, 0x35, 0xE1, 0xEB, 0x9D, 0x43, 0x4B, 0xF8, 0xFB, 0xE2, 0x41, 0xE0, - 0xEF, 0x8B, 0x1E, 0x26, 0xB8, 0xD1, 0x25, 0xD4, 0xFC, 0x2D, 0xE0, 0x5F, 0x00, 0x5A, 0xC0, 0x6E, - 0x7C, 0x61, 0x35, 0xF6, 0x5A, 0x3B, 0x69, 0x67, 0xD4, 0x2D, 0x62, 0x8F, 0x44, 0xB4, 0xB6, 0x91, - 0xE5, 0xCD, 0xC6, 0xB7, 0x15, 0xDC, 0xB6, 0x57, 0xD6, 0x3A, 0x76, 0xA1, 0x01, 0x00, 0x9F, 0xE0, - 0x46, 0x8D, 0xE2, 0xDF, 0x86, 0x3F, 0x11, 0xBE, 0x37, 0x7C, 0x1C, 0xD5, 0x74, 0xFB, 0xCD, 0x43, - 0xE1, 0xFC, 0x9E, 0x29, 0xB9, 0xF8, 0xF5, 0xF0, 0x8F, 0xC7, 0x0B, 0xA3, 0x5C, 0xC1, 0x6F, 0x25, - 0xB7, 0x8F, 0x75, 0xAD, 0x4B, 0x50, 0xF1, 0x37, 0x85, 0xF5, 0x2B, 0xDC, 0xB5, 0xAC, 0xB7, 0xFA, - 0x76, 0xBC, 0x75, 0x69, 0xE1, 0x68, 0x92, 0xD1, 0x7F, 0xB2, 0xF5, 0x7D, 0x0A, 0x03, 0x14, 0xF7, - 0x16, 0x57, 0xB7, 0xB7, 0x60, 0x1F, 0x53, 0x0E, 0x31, 0x8E, 0x31, 0x8C, 0x63, 0x8C, 0x63, 0xA6, - 0x3F, 0x21, 0x40, 0x1F, 0x28, 0x6B, 0x3A, 0x07, 0x88, 0x3F, 0x67, 0x3F, 0x10, 0x6A, 0xFE, 0x3C, - 0xF8, 0x7D, 0xA3, 0x6B, 0x3E, 0x28, 0xF8, 0x25, 0xE2, 0x9D, 0x6E, 0x7F, 0x10, 0x7C, 0x54, 0xF8, - 0x4D, 0xE1, 0xED, 0x3E, 0xEB, 0x5E, 0xF1, 0x27, 0x80, 0xB5, 0x4D, 0x4E, 0xFD, 0xE7, 0xD4, 0xBC, - 0x65, 0xE0, 0xAD, 0x2E, 0xDA, 0xDE, 0x5B, 0x9B, 0xBF, 0xB4, 0xDD, 0x5F, 0x4D, 0x71, 0xAA, 0xE9, - 0x28, 0xC3, 0xCD, 0x0B, 0x36, 0xA1, 0x63, 0x19, 0xBE, 0x37, 0x56, 0x9A, 0xE8, 0x07, 0x21, 0xA2, - 0x78, 0xA3, 0x4C, 0xD2, 0x7F, 0x6C, 0xCB, 0x2F, 0x88, 0x30, 0xDE, 0x69, 0xFE, 0x22, 0xF8, 0x59, - 0xFB, 0x5B, 0x7E, 0xCB, 0x9E, 0x0E, 0xF0, 0xB7, 0xC1, 0x9F, 0x89, 0x9E, 0x18, 0xD5, 0xAD, 0xB5, - 0xAF, 0x04, 0x5E, 0xEA, 0xFE, 0x02, 0xD5, 0xFC, 0x53, 0xAD, 0x5C, 0xE9, 0xB3, 0x5E, 0xAB, 0x88, - 0xDA, 0x5D, 0x5F, 0x46, 0xF8, 0x87, 0x69, 0x7F, 0xA5, 0x35, 0xA1, 0xBA, 0x4B, 0xAB, 0x7F, 0x0E, - 0xF8, 0x91, 0xE5, 0x6B, 0x61, 0x6B, 0x69, 0xFD, 0xA0, 0x01, 0xF5, 0x9F, 0x8E, 0x3C, 0x0D, 0xE1, - 0x2F, 0x89, 0x3E, 0x0C, 0xF1, 0x97, 0xC3, 0xDF, 0x1C, 0xE8, 0x36, 0x1E, 0x24, 0xF0, 0x67, 0xC4, - 0x1F, 0x09, 0xDF, 0xF8, 0x17, 0xC6, 0x7E, 0x1F, 0xD4, 0x23, 0x63, 0x63, 0xE2, 0x2D, 0x23, 0x53, - 0xB4, 0x96, 0xDA, 0xFF, 0x00, 0x4F, 0xB8, 0xDA, 0x55, 0x8C, 0x52, 0xC1, 0x75, 0x71, 0x19, 0x01, - 0x94, 0xE2, 0x46, 0xC1, 0x04, 0xE6, 0x80, 0x3F, 0x28, 0xFF, 0x00, 0x62, 0x8F, 0xD9, 0x33, 0xC4, - 0xBE, 0x1B, 0xF8, 0xD7, 0x63, 0xAF, 0x7C, 0x52, 0xF1, 0x0F, 0xED, 0x57, 0xE2, 0x79, 0xBF, 0x63, - 0xCF, 0x0C, 0xEA, 0x1F, 0x07, 0xBC, 0x21, 0xAC, 0x7C, 0x7D, 0xFD, 0xA2, 0x7E, 0x20, 0x7C, 0x5C, - 0xD0, 0x7E, 0x30, 0x78, 0xA7, 0x53, 0xB9, 0xBC, 0xB7, 0xFF, 0x00, 0x85, 0x91, 0x3D, 0x9E, 0xBF, - 0xAA, 0x5D, 0xE9, 0x97, 0x5A, 0xB1, 0xF0, 0x2A, 0xF8, 0x41, 0xA2, 0xD4, 0x74, 0x38, 0x2C, 0x6C, - 0xED, 0xEE, 0x3C, 0x6B, 0xE3, 0x9D, 0x36, 0x48, 0xCD, 0xCD, 0xBC, 0xB6, 0x3A, 0x10, 0x07, 0xD6, - 0x1F, 0x1C, 0xA1, 0x8F, 0xC7, 0x7F, 0xB5, 0x0F, 0xEC, 0x5B, 0xE0, 0x4F, 0x08, 0x5C, 0x58, 0xDD, - 0xEB, 0xFF, 0x00, 0x03, 0x7E, 0x2C, 0x6B, 0x3F, 0xB4, 0xF7, 0xC5, 0x7D, 0x3A, 0xDE, 0x47, 0x73, - 0xE1, 0x3F, 0x0A, 0xEA, 0x3F, 0x0B, 0xFC, 0x73, 0xE1, 0x0D, 0x1E, 0x6B, 0xE5, 0x85, 0x1F, 0xEC, - 0xF3, 0xEA, 0x5A, 0xE7, 0x8B, 0x47, 0xD8, 0x92, 0xE4, 0x40, 0x97, 0x91, 0xE8, 0x9E, 0x25, 0x78, - 0x64, 0x77, 0xD2, 0xE5, 0x88, 0x80, 0x70, 0xDF, 0x1B, 0xFE, 0x00, 0x7C, 0x60, 0x3F, 0x13, 0x6E, - 0x3E, 0x32, 0x35, 0x95, 0xB7, 0xED, 0x8D, 0xF0, 0xFB, 0xC3, 0x7A, 0xA6, 0x97, 0xE3, 0xFF, 0x00, - 0x0B, 0xFE, 0xCC, 0xBF, 0x10, 0xFC, 0x58, 0xFF, 0x00, 0x0E, 0xB5, 0x6F, 0x05, 0x6A, 0x7A, 0x25, - 0xF8, 0xBC, 0x88, 0xF8, 0x42, 0x08, 0x64, 0xB7, 0xF0, 0x56, 0xBB, 0x79, 0x6F, 0x2D, 0xA6, 0x9D, - 0x7B, 0xA2, 0xC7, 0xE2, 0x8D, 0x3E, 0x0B, 0xBB, 0x4D, 0x5E, 0xDC, 0x4D, 0x2F, 0x8A, 0xAD, 0xA0, - 0x96, 0xD2, 0x4D, 0x00, 0x03, 0xEE, 0x0F, 0x00, 0x78, 0xB6, 0x0F, 0x1D, 0x78, 0x43, 0x46, 0xF1, - 0x44, 0x1E, 0x1A, 0xF1, 0x77, 0x83, 0x86, 0xA3, 0x1C, 0xB0, 0xCD, 0xE1, 0x5F, 0x1D, 0xF8, 0x72, - 0x5F, 0x0A, 0x78, 0xAF, 0x40, 0x9E, 0xD6, 0xE1, 0xED, 0xEE, 0x2D, 0x6E, 0xEC, 0x9F, 0x2B, 0xF2, - 0x4B, 0x6F, 0x20, 0x49, 0x61, 0x79, 0x6D, 0xE7, 0x8F, 0xCB, 0x9E, 0xDE, 0x69, 0xA0, 0x96, 0x29, - 0x64, 0x00, 0xF9, 0x17, 0xF6, 0xBB, 0xD5, 0x3C, 0x76, 0x9E, 0x24, 0xF8, 0x77, 0xA1, 0xC1, 0xE3, - 0xFF, 0x00, 0x8D, 0xFF, 0x00, 0x04, 0xFE, 0x14, 0xCD, 0xA1, 0xEA, 0xDA, 0xBF, 0x88, 0xBE, 0x2D, - 0x7E, 0xCE, 0xBF, 0x02, 0xB4, 0xBF, 0x8F, 0x3F, 0x12, 0x1F, 0x5D, 0x82, 0x7B, 0x28, 0xB4, 0x7D, - 0x02, 0xE6, 0xCF, 0x50, 0xF0, 0xB7, 0x89, 0xAD, 0x6C, 0x34, 0x99, 0x6D, 0xAE, 0xB5, 0x79, 0xE5, - 0x94, 0xE9, 0x02, 0x59, 0x6E, 0x2D, 0xB4, 0xD4, 0x8E, 0xFA, 0xD9, 0x23, 0x9E, 0x0D, 0x40, 0x03, - 0xE2, 0xCF, 0x87, 0xDF, 0x0D, 0x7E, 0x30, 0x7E, 0xCB, 0x7E, 0x3D, 0xFD, 0x9D, 0x3F, 0x68, 0x2F, - 0x13, 0xDF, 0xF8, 0xC3, 0xF6, 0xA6, 0xF8, 0x4B, 0xE0, 0xBF, 0x86, 0xDF, 0x1F, 0x3E, 0x10, 0xFC, - 0x2B, 0xD2, 0xBE, 0x13, 0x7E, 0xCF, 0x3A, 0xBF, 0x81, 0x7F, 0x68, 0x0B, 0x5D, 0x3F, 0xE2, 0xE6, - 0xBB, 0xE0, 0x3F, 0x18, 0xF8, 0x2B, 0x49, 0xF1, 0x0F, 0x85, 0xAE, 0xA5, 0x8E, 0xCA, 0xDF, 0xEC, - 0xD7, 0x5F, 0x0C, 0xBC, 0x57, 0xA1, 0x9B, 0xE9, 0x0E, 0x8B, 0x6F, 0x0B, 0x6A, 0x5E, 0x10, 0x8E, - 0x6B, 0x3B, 0x68, 0xCE, 0xA1, 0x7B, 0x68, 0x01, 0xF6, 0x67, 0xED, 0x71, 0xE0, 0x5F, 0x8B, 0xDE, - 0x1B, 0xB9, 0xF1, 0xA7, 0xED, 0x09, 0xFB, 0x38, 0x5A, 0xE8, 0xF6, 0x3F, 0x17, 0x63, 0xFD, 0x96, - 0x7C, 0x63, 0xF0, 0x72, 0xCE, 0xE6, 0xD7, 0x49, 0xB9, 0xD5, 0xB5, 0x9F, 0x13, 0xF8, 0x92, 0xF6, - 0xEE, 0xC2, 0x5F, 0x85, 0x57, 0x5A, 0xB6, 0x9B, 0x05, 0x95, 0xC2, 0x6A, 0x7A, 0x66, 0x85, 0xAA, - 0xDD, 0x78, 0x96, 0xEB, 0x33, 0xA4, 0xCF, 0x63, 0x0E, 0xAF, 0xAD, 0x9B, 0x58, 0x24, 0xFE, 0xD2, - 0xBC, 0x8E, 0x50, 0x0E, 0x47, 0x53, 0xF0, 0xC7, 0xEC, 0xF1, 0xF0, 0x0F, 0xC4, 0x3F, 0x02, 0xFE, - 0x04, 0x4D, 0xE0, 0xFF, 0x00, 0xDA, 0xCB, 0xC1, 0xBF, 0x0F, 0x7F, 0x66, 0x4F, 0x83, 0x5E, 0x05, - 0xD1, 0xBE, 0x00, 0xEA, 0x5F, 0x08, 0xFC, 0x59, 0xF1, 0xC3, 0x5F, 0xF8, 0x6D, 0xAB, 0xD8, 0xE8, - 0xF7, 0x17, 0x36, 0x16, 0xBE, 0x1D, 0xD7, 0xEC, 0x7C, 0x2D, 0x34, 0xB6, 0x1A, 0xAC, 0x9A, 0x7D, - 0xBF, 0x86, 0x34, 0x33, 0x70, 0x35, 0xE5, 0xBA, 0xFB, 0x54, 0x1A, 0x9A, 0x24, 0x8B, 0x24, 0x6D, - 0x38, 0x70, 0x0F, 0x90, 0x7F, 0x6C, 0xCF, 0xF8, 0x5B, 0x7E, 0x2C, 0xFD, 0xB7, 0xBE, 0x08, 0x5A, - 0x78, 0x53, 0xE0, 0xCF, 0xED, 0x79, 0xE3, 0x1F, 0x03, 0xFC, 0x21, 0xFD, 0xA0, 0x53, 0xC5, 0xFE, - 0x33, 0xBF, 0xF8, 0x51, 0xF1, 0x2F, 0xC4, 0x9A, 0x1E, 0xA2, 0xBA, 0x75, 0xE7, 0xC0, 0xFF, 0x00, - 0x11, 0xE9, 0x73, 0x6B, 0xDE, 0x0D, 0xD3, 0x6F, 0x34, 0xDB, 0x3F, 0x08, 0x45, 0xA7, 0xDB, 0x5D, - 0x78, 0xAF, 0x4F, 0x8A, 0xE6, 0x41, 0xE2, 0x88, 0x75, 0x49, 0xA7, 0xB7, 0xD6, 0x2D, 0xED, 0xF4, - 0x9B, 0x99, 0x26, 0x81, 0x2F, 0x00, 0x3E, 0x93, 0xF8, 0xBB, 0xE2, 0xDF, 0x15, 0x6B, 0x3A, 0xFF, - 0x00, 0x82, 0x74, 0x78, 0xFE, 0x28, 0x7E, 0xD7, 0x7F, 0x00, 0xBE, 0x07, 0xE9, 0xFF, 0x00, 0x06, - 0x74, 0x0B, 0xEF, 0x02, 0x7C, 0x58, 0xF8, 0x5B, 0xFB, 0x33, 0xC5, 0xF1, 0x87, 0xE2, 0xFF, 0x00, - 0xC4, 0xEF, 0x11, 0x1D, 0x43, 0x56, 0xB4, 0xF1, 0x16, 0x87, 0xE3, 0x4B, 0x1F, 0x11, 0x78, 0x0F, - 0xC4, 0x97, 0x5A, 0x3B, 0x69, 0xD6, 0x7A, 0x67, 0x86, 0x6E, 0xA3, 0x6B, 0x8B, 0x0D, 0x3E, 0x5B, - 0xE9, 0x75, 0xAB, 0xF6, 0x59, 0x66, 0x16, 0x52, 0x24, 0x40, 0x1C, 0x17, 0xEC, 0xF5, 0xE1, 0xEF, - 0x8B, 0xDF, 0xB1, 0xDF, 0xC4, 0xBF, 0x86, 0x3A, 0x77, 0xC4, 0x6F, 0x05, 0xF8, 0x83, 0xE3, 0xD6, - 0x97, 0xF1, 0x6B, 0xF6, 0x5F, 0xF8, 0x55, 0xFB, 0x31, 0x78, 0x0F, 0xC7, 0x3F, 0xB3, 0x4F, 0xC1, - 0x7D, 0x6B, 0xC2, 0x9E, 0x13, 0xF0, 0x84, 0x7F, 0x0F, 0x7E, 0x23, 0x78, 0x9E, 0x1B, 0x19, 0x7C, - 0x5F, 0xA1, 0x6B, 0x7A, 0xBD, 0xE5, 0xD7, 0x87, 0x61, 0x8F, 0xC2, 0x9F, 0x16, 0x7C, 0x3D, 0xA8, - 0x3C, 0x93, 0xEA, 0x77, 0x9E, 0x62, 0xF8, 0x53, 0xC6, 0x9C, 0x43, 0x71, 0x1E, 0x97, 0x61, 0xAB, - 0x00, 0x7A, 0xF7, 0xED, 0x91, 0xFB, 0x3A, 0xEB, 0x7E, 0x24, 0xD3, 0xFE, 0x36, 0xAF, 0x85, 0x74, - 0x8B, 0x9D, 0x4B, 0xE1, 0xAF, 0xED, 0x77, 0xF0, 0xF3, 0xC3, 0x7F, 0xB3, 0x7F, 0xED, 0x13, 0xE0, - 0x2F, 0x0E, 0xCF, 0xAA, 0xDC, 0x5F, 0xF8, 0xB2, 0x6F, 0x11, 0xF8, 0xBF, 0x46, 0xF0, 0xCC, 0xFE, - 0x26, 0x1A, 0x6D, 0xB4, 0x4D, 0x0D, 0x9B, 0xC5, 0xE0, 0xFD, 0x7F, 0xC4, 0xD6, 0xBA, 0x9E, 0xB7, - 0x0B, 0xC5, 0x7A, 0xB6, 0x1A, 0x66, 0x85, 0xE6, 0x34, 0xB1, 0x68, 0x56, 0x7F, 0x61, 0x00, 0xEF, - 0xAF, 0x7C, 0x73, 0xF0, 0xEA, 0xF7, 0xF6, 0xAA, 0xD6, 0x87, 0xC4, 0x0F, 0x08, 0xFE, 0xD5, 0xFE, - 0x0C, 0xF1, 0xEF, 0x80, 0x3C, 0x67, 0xA3, 0xFC, 0x36, 0xF8, 0x57, 0x7F, 0xE1, 0xED, 0x67, 0xE3, - 0x1E, 0xAD, 0xFB, 0x3B, 0xFC, 0x5A, 0xD2, 0xF5, 0x6F, 0x0E, 0x58, 0x5C, 0xC5, 0xE2, 0x1B, 0x9D, - 0x13, 0x44, 0x66, 0xF0, 0x52, 0xC7, 0x16, 0xA5, 0xE2, 0x9D, 0x73, 0x4B, 0x9A, 0x5D, 0x5A, 0x16, - 0x96, 0x29, 0x74, 0x4F, 0xB4, 0xCB, 0x24, 0x71, 0x43, 0x6A, 0xF0, 0x80, 0x7E, 0x78, 0xF8, 0xE6, - 0xE7, 0xE2, 0x8F, 0x8D, 0xBF, 0x6D, 0x68, 0xF5, 0xFB, 0x8F, 0x83, 0x9F, 0xB7, 0xA5, 0x9F, 0xC2, - 0x7F, 0x87, 0x5A, 0xA7, 0xC4, 0xAF, 0x0F, 0x78, 0x83, 0x5F, 0xF0, 0x07, 0xC5, 0x2F, 0x14, 0x9F, - 0x1D, 0x78, 0x4E, 0xDE, 0xE3, 0x58, 0xD3, 0x6D, 0xD7, 0xC4, 0x90, 0x78, 0x7E, 0xEB, 0x4D, 0xB0, - 0xD1, 0xCF, 0x86, 0xEE, 0x3F, 0xB3, 0x6F, 0xAE, 0xAC, 0x2D, 0x3C, 0x2F, 0xAE, 0xF8, 0x9B, 0x59, - 0xB9, 0xB1, 0x97, 0x46, 0x3F, 0xD8, 0xB0, 0xCC, 0x6E, 0xED, 0x74, 0xC0, 0x0F, 0x6F, 0xFD, 0xA8, - 0x67, 0xF1, 0x3F, 0xC7, 0xFD, 0x43, 0xE3, 0x4F, 0xC3, 0xEF, 0x88, 0x5E, 0x35, 0xF8, 0xED, 0xF0, - 0x17, 0xE1, 0x07, 0x8A, 0xFC, 0x1D, 0x6F, 0xE0, 0xFF, 0x00, 0x85, 0x5E, 0x17, 0xF0, 0x5F, 0xEC, - 0x7F, 0x79, 0xFB, 0x40, 0x7C, 0x34, 0xFD, 0xA9, 0xFC, 0x27, 0xE2, 0x9F, 0x06, 0xD8, 0xC9, 0xAC, - 0xDF, 0xFC, 0x4E, 0x74, 0xF0, 0xA5, 0xD6, 0xB9, 0xA6, 0xD9, 0xC9, 0x7F, 0xA9, 0xEB, 0xFE, 0x1F, - 0xB8, 0xF0, 0xEE, 0x9F, 0xAC, 0xF8, 0x53, 0x5A, 0x86, 0xCF, 0x4C, 0xBB, 0xBB, 0xFB, 0x7D, 0xB3, - 0x6B, 0x1A, 0x75, 0xCE, 0x9E, 0x01, 0xEE, 0xFF, 0x00, 0x01, 0xEF, 0x3E, 0x2A, 0x7C, 0x11, 0xF8, - 0xDF, 0x75, 0xF0, 0xA3, 0xE3, 0x3F, 0x87, 0xFC, 0x7B, 0xF1, 0x5F, 0xC7, 0xBF, 0x1A, 0xBC, 0x3D, - 0xE0, 0x7D, 0x5B, 0x52, 0xFD, 0xA0, 0xFE, 0x1E, 0x7C, 0x35, 0x93, 0x4D, 0xF8, 0x23, 0xA8, 0xDF, - 0xE8, 0x3F, 0x0E, 0xE7, 0xB1, 0xF1, 0x46, 0xA5, 0xAB, 0xCE, 0xF7, 0x72, 0x1D, 0x16, 0x4F, 0xED, - 0x3F, 0x06, 0x2F, 0xFA, 0x13, 0xBD, 0xC1, 0xFF, 0x00, 0x8A, 0x9F, 0xC3, 0x6B, 0x6F, 0x2D, 0xD0, - 0x3A, 0x8B, 0x69, 0x40, 0x1C, 0xE7, 0xC6, 0xEF, 0x83, 0xBE, 0x3D, 0xD2, 0x7E, 0x2F, 0x8F, 0x0A, - 0x78, 0x7B, 0x42, 0xBD, 0xD7, 0xBE, 0x0A, 0x7E, 0xD3, 0x9F, 0xB4, 0x6F, 0xC1, 0xDF, 0x18, 0xE9, - 0x5A, 0x36, 0x95, 0x06, 0xA5, 0xE2, 0x6D, 0x2B, 0xE1, 0x47, 0x8C, 0x7C, 0x15, 0xA8, 0xEB, 0xBE, - 0x2C, 0xF8, 0x9F, 0xE2, 0x5F, 0x10, 0xEF, 0x89, 0xA0, 0xF0, 0xEE, 0x81, 0xAA, 0x68, 0x5F, 0x0E, - 0x7C, 0x0F, 0x65, 0x67, 0xF6, 0x26, 0x78, 0x6E, 0x7C, 0x49, 0x7F, 0x37, 0x9F, 0x6D, 0x6B, 0x2E, - 0xB9, 0x77, 0xA8, 0xDC, 0x80, 0x7A, 0x6F, 0xC2, 0xFF, 0x00, 0x17, 0xFC, 0x38, 0xF1, 0x07, 0xED, - 0x05, 0xE2, 0x2D, 0x67, 0xC4, 0x1E, 0x16, 0xFD, 0xAB, 0xBC, 0x01, 0xF1, 0xCA, 0xFF, 0x00, 0xC6, - 0xBE, 0x26, 0xF0, 0x27, 0xFC, 0x21, 0xFE, 0x26, 0xF1, 0x0F, 0xC6, 0x3F, 0x10, 0x7E, 0xCF, 0x97, - 0x5A, 0x6F, 0x87, 0xEE, 0xAE, 0xAC, 0x74, 0x7D, 0x7A, 0xCA, 0xCF, 0x7B, 0x7C, 0x3C, 0xB3, 0x87, - 0x54, 0xD1, 0x74, 0x3D, 0x37, 0x54, 0x85, 0xA1, 0x8E, 0x29, 0x15, 0xF5, 0x11, 0x1C, 0x8C, 0x6F, - 0xA4, 0x9B, 0xCC, 0x00, 0xFC, 0xD8, 0xF8, 0x77, 0xE2, 0x5F, 0x89, 0x5A, 0xCF, 0xED, 0x49, 0xE0, - 0x4F, 0x8D, 0x5E, 0x3F, 0xF8, 0x35, 0xFB, 0x7B, 0xF8, 0x57, 0xE1, 0x4F, 0x83, 0x7E, 0x1E, 0x78, - 0x97, 0x4A, 0xD7, 0x35, 0x4D, 0x1B, 0xC7, 0xDE, 0x39, 0xF8, 0x9D, 0xE2, 0xAF, 0x85, 0x72, 0x6A, - 0x7A, 0xFE, 0x85, 0x7D, 0xA4, 0x69, 0xBE, 0x3D, 0xF0, 0xB5, 0xCE, 0x89, 0xA7, 0x5D, 0x4C, 0xD3, - 0x9D, 0x01, 0xAC, 0xEE, 0x2C, 0xBC, 0x14, 0xDE, 0x3A, 0xB3, 0x8E, 0x73, 0x2C, 0x97, 0x17, 0xD0, - 0xE9, 0xD6, 0x89, 0xA9, 0xDC, 0x80, 0x7E, 0xAA, 0x7E, 0xDC, 0x9A, 0x4E, 0x93, 0xA8, 0x7E, 0xCF, - 0xF1, 0xEA, 0x5A, 0xED, 0xE7, 0x8B, 0xEC, 0xB4, 0x6F, 0x00, 0x7C, 0x7B, 0xF8, 0x3D, 0xF1, 0x8F, - 0x54, 0xFF, 0x00, 0x84, 0x03, 0xE1, 0x27, 0x89, 0xBE, 0x39, 0xF8, 0xC2, 0xFA, 0xDF, 0xC0, 0xBF, - 0x17, 0xBC, 0x31, 0xE2, 0x19, 0x6C, 0x2C, 0x3C, 0x2F, 0xE1, 0xEB, 0x3B, 0xBD, 0x5E, 0xE9, 0xEE, - 0x57, 0x41, 0x36, 0xFB, 0xED, 0xED, 0xA5, 0x16, 0xEB, 0x33, 0x5C, 0xCA, 0x04, 0x36, 0xF2, 0x15, - 0x00, 0xFA, 0xF3, 0x18, 0xE3, 0x8E, 0x38, 0xE3, 0xA7, 0x1E, 0x94, 0x00, 0x50, 0x01, 0x40, 0x16, - 0x28, 0x00, 0xA0, 0x02, 0x80, 0x0A, 0x00, 0x28, 0x00, 0xA0, 0x0F, 0xF3, 0xF3, 0xFF, 0x00, 0x83, - 0x9F, 0x7F, 0xE5, 0x39, 0xFF, 0x00, 0xF0, 0x48, 0x7F, 0xFB, 0x05, 0x7C, 0x3D, 0xFF, 0x00, 0xD5, - 0xBD, 0x73, 0x5D, 0x99, 0x67, 0xFC, 0x8C, 0x30, 0xFF, 0x00, 0xE3, 0x87, 0xFE, 0x94, 0x8E, 0x7C, - 0x4F, 0xFB, 0xAD, 0x4F, 0xF0, 0xBF, 0xC8, 0xFB, 0x52, 0xBF, 0x53, 0x3E, 0x38, 0x28, 0x00, 0xA0, - 0x02, 0x80, 0x3F, 0x60, 0xBF, 0xE0, 0x88, 0x5F, 0xF2, 0x22, 0x7E, 0xDD, 0x7F, 0xF6, 0x7C, 0xF0, - 0x7F, 0xEA, 0x86, 0xF8, 0x65, 0x5F, 0x9D, 0x71, 0x07, 0xFC, 0x8D, 0x27, 0xE9, 0x1F, 0xFD, 0x25, - 0x1F, 0x51, 0x95, 0xFF, 0x00, 0xB9, 0x47, 0xE7, 0xF9, 0x9F, 0xB6, 0xD5, 0xE2, 0x9E, 0x88, 0x50, - 0x01, 0x40, 0x05, 0x00, 0x14, 0x00, 0x50, 0x01, 0x40, 0x05, 0x00, 0x14, 0x00, 0x87, 0xEE, 0x9F, - 0xF7, 0x7F, 0xA5, 0x00, 0x7C, 0xBD, 0xFB, 0x56, 0x7C, 0x67, 0xF1, 0xD7, 0xC0, 0x4F, 0x86, 0xB6, - 0xFF, 0x00, 0x10, 0xBC, 0x19, 0x61, 0xFB, 0x32, 0x49, 0x65, 0x65, 0xE2, 0x0B, 0x6D, 0x3B, 0xC5, - 0x9A, 0xC7, 0xED, 0x5B, 0xFB, 0x50, 0xDE, 0x7E, 0xC9, 0x9F, 0x0D, 0x3C, 0x3D, 0x65, 0x74, 0xAD, - 0x1D, 0xBC, 0xD1, 0xF8, 0x92, 0x0F, 0x0A, 0xF8, 0x85, 0x64, 0xBA, 0x92, 0xED, 0xAC, 0xA1, 0x4B, - 0x69, 0x6D, 0xED, 0x95, 0xC4, 0xAC, 0x44, 0xFB, 0x91, 0x62, 0x94, 0x03, 0xF3, 0x9B, 0xF6, 0x54, - 0xFD, 0xBC, 0xFE, 0x37, 0xF8, 0xDF, 0xC5, 0x1F, 0x07, 0xFC, 0x35, 0xE3, 0x9F, 0x89, 0x3F, 0xB2, - 0xBF, 0xC5, 0xD7, 0xF8, 0xA9, 0xFB, 0x7D, 0x78, 0xCB, 0xF6, 0x60, 0xF1, 0x6E, 0x9B, 0xF0, 0x0B, - 0x5E, 0xB8, 0xF8, 0xA3, 0xA5, 0x7C, 0x22, 0xD3, 0xDF, 0xE1, 0x5F, 0x8E, 0xBE, 0x28, 0x78, 0x59, - 0x74, 0xDF, 0x88, 0x96, 0xE3, 0x4D, 0xD3, 0xFC, 0x47, 0x0A, 0xE8, 0x1A, 0x3F, 0x80, 0x2C, 0x22, - 0x94, 0x78, 0x7B, 0x4F, 0x75, 0x8C, 0xDF, 0x0B, 0xA9, 0x2E, 0x2F, 0x52, 0x63, 0x08, 0x07, 0xEB, - 0x17, 0x8E, 0xFE, 0x27, 0x5B, 0x78, 0x1B, 0xC4, 0xFF, 0x00, 0x0E, 0x3C, 0x23, 0x3E, 0x85, 0x7F, - 0x75, 0x7D, 0xF1, 0x5A, 0xFF, 0x00, 0x55, 0xF0, 0xC7, 0x83, 0xF5, 0xB9, 0x6E, 0x20, 0xB2, 0xF0, - 0x84, 0x1A, 0xF6, 0x9F, 0xA3, 0xCF, 0xA9, 0xD9, 0x68, 0xFA, 0xA5, 0xC2, 0x99, 0x2E, 0xED, 0x8D, - 0xE5, 0xA6, 0x9B, 0xAB, 0xBC, 0x53, 0xC7, 0x69, 0x71, 0x1A, 0x9B, 0x19, 0x11, 0xCA, 0xC9, 0x2D, - 0xB4, 0x77, 0x00, 0x1F, 0x03, 0x7E, 0xC9, 0xFF, 0x00, 0xB4, 0xA7, 0xED, 0x75, 0xF1, 0x03, 0xE1, - 0x8E, 0xB1, 0xFB, 0x44, 0x7C, 0x4F, 0xF8, 0x61, 0xA7, 0x7C, 0x47, 0xF0, 0x1F, 0xC5, 0x2F, 0x88, - 0x5E, 0x23, 0xB5, 0xF8, 0x35, 0xF0, 0x7B, 0xF6, 0x68, 0x87, 0x4A, 0xF1, 0xB5, 0xEF, 0x84, 0x3C, - 0x3D, 0xA1, 0x6A, 0x72, 0x69, 0x5A, 0x67, 0x89, 0xAC, 0xFE, 0x25, 0xEB, 0xDA, 0x97, 0x86, 0x2C, - 0xFC, 0x51, 0xE1, 0x9D, 0x7D, 0x34, 0x59, 0xB5, 0xBD, 0x1E, 0xF2, 0x1D, 0x02, 0xD5, 0xE6, 0xD3, - 0xF5, 0xCD, 0x32, 0x51, 0x3D, 0xC4, 0x2C, 0x92, 0x30, 0x07, 0x96, 0xFF, 0x00, 0xC1, 0x4A, 0xBF, - 0x6B, 0x7F, 0xDA, 0x2B, 0xF6, 0x67, 0xD5, 0x74, 0x7D, 0x3F, 0xE1, 0xDF, 0xC5, 0x7B, 0xBF, 0x0B, - 0x58, 0x78, 0x83, 0xE2, 0xBF, 0xC2, 0x08, 0x74, 0x6B, 0x2F, 0x0B, 0xFF, 0x00, 0xC1, 0x2A, 0xFE, - 0x35, 0xFE, 0xD4, 0x1F, 0x60, 0xD0, 0xBC, 0x43, 0xF1, 0x33, 0x43, 0xD1, 0x7C, 0x45, 0x61, 0xA8, - 0xFC, 0x43, 0xD0, 0xB5, 0x09, 0xFC, 0x31, 0x35, 0xDD, 0xCC, 0x0D, 0xAF, 0x2A, 0xE9, 0x51, 0xDA, - 0x59, 0xEA, 0xD2, 0xC3, 0x75, 0x65, 0x69, 0x67, 0xE5, 0x5E, 0xDD, 0xD8, 0x5F, 0x48, 0x01, 0xF6, - 0x17, 0x80, 0x7F, 0x69, 0xFD, 0x4A, 0xC3, 0xE1, 0x47, 0x80, 0x7C, 0x4F, 0xE3, 0x8B, 0x3F, 0x1F, - 0x7C, 0x5F, 0xF1, 0x97, 0xC4, 0x09, 0x35, 0xDD, 0x6B, 0x4A, 0xF0, 0xFF, 0x00, 0xC3, 0x9F, 0xD9, - 0x07, 0xC6, 0xDF, 0xB3, 0x57, 0x8F, 0x6D, 0x3C, 0x3F, 0xE1, 0xFB, 0xA4, 0xB7, 0xD5, 0xF5, 0x5B, - 0xEF, 0x86, 0x9E, 0x2F, 0xD4, 0x65, 0xF1, 0x15, 0xAC, 0x56, 0x72, 0x4D, 0x68, 0x0E, 0xF6, 0x37, - 0x17, 0x9F, 0x6D, 0xD3, 0xBE, 0xC5, 0x67, 0x39, 0xBB, 0x80, 0x4C, 0x01, 0xDC, 0x68, 0x7F, 0xB6, - 0x9F, 0xEC, 0xB3, 0xE2, 0x1B, 0x0D, 0x0A, 0xFB, 0x4A, 0xF8, 0xD1, 0xE1, 0x27, 0x5D, 0x5F, 0x4B, - 0xD6, 0xF5, 0xBD, 0x53, 0x4E, 0xBB, 0xFB, 0x56, 0x95, 0xE2, 0x0F, 0x86, 0x76, 0x5E, 0x18, 0xB1, - 0x9E, 0xE7, 0xC5, 0x37, 0x7E, 0x3D, 0xD2, 0xE7, 0x85, 0x2F, 0x3C, 0x21, 0x0E, 0x94, 0x6C, 0xE4, - 0xB4, 0xD4, 0x5F, 0x5F, 0x87, 0x4D, 0x5B, 0x0B, 0xF9, 0x2D, 0x74, 0xCB, 0xA3, 0x05, 0xF5, 0xD5, - 0xBD, 0xAC, 0xC0, 0x19, 0x9A, 0x2F, 0xED, 0xAD, 0xF0, 0x27, 0xFB, 0x46, 0x4D, 0x0F, 0xE2, 0x76, - 0xA9, 0xAD, 0x7E, 0xCD, 0xDA, 0xF4, 0xBE, 0x1E, 0x1E, 0x33, 0xF0, 0xF6, 0x8D, 0xFB, 0x4D, 0x69, - 0x2B, 0xF0, 0x42, 0x5F, 0x1B, 0x68, 0x7B, 0x4B, 0x3E, 0xAB, 0xA1, 0xDC, 0xEA, 0x32, 0x25, 0xA5, - 0xE7, 0xD9, 0xD0, 0x40, 0xD7, 0xD6, 0x71, 0xCC, 0x6F, 0xF4, 0x91, 0x75, 0xA7, 0xAE, 0xA7, 0x69, - 0x60, 0xD7, 0xD6, 0xAB, 0x38, 0x04, 0xBA, 0xDF, 0xED, 0x91, 0xF0, 0xA7, 0x43, 0x7B, 0x6B, 0xD7, - 0xF0, 0xFF, 0x00, 0xC5, 0xDB, 0xBF, 0x07, 0x69, 0xDA, 0x16, 0x85, 0xE2, 0x0F, 0x89, 0xFE, 0x3F, - 0x8F, 0xE1, 0x26, 0xB5, 0xA5, 0x78, 0x73, 0xE0, 0x1D, 0xBF, 0x89, 0xAD, 0xE2, 0x9F, 0x44, 0x8B, - 0xC7, 0x36, 0x77, 0x90, 0xDB, 0xEA, 0xBA, 0x5D, 0xCF, 0xD9, 0xEE, 0xAD, 0xAE, 0x75, 0x0B, 0x53, - 0x63, 0x24, 0xFA, 0x0D, 0x94, 0xD6, 0xFA, 0x8E, 0xBB, 0x1E, 0x91, 0x61, 0x71, 0x05, 0xDC, 0xA0, - 0x1D, 0x25, 0xD7, 0xED, 0x55, 0xF0, 0x4E, 0xE3, 0x46, 0xD5, 0x75, 0x4F, 0x00, 0xF8, 0xA1, 0x7E, - 0x33, 0x5C, 0xD8, 0xA6, 0x85, 0x6F, 0xA4, 0x68, 0xDF, 0x05, 0xE1, 0x5F, 0x88, 0x57, 0x1E, 0x30, - 0xBE, 0xF1, 0x34, 0xB7, 0x11, 0xE8, 0x5A, 0x5E, 0x93, 0x7F, 0x6E, 0xDF, 0xD9, 0xB2, 0x4F, 0x28, - 0xB0, 0xB9, 0x9E, 0x76, 0x92, 0xEE, 0x28, 0x34, 0xEB, 0x25, 0xFE, 0xD2, 0xD4, 0x26, 0xB2, 0xD3, - 0xC1, 0xBC, 0x50, 0x0C, 0xAF, 0x0D, 0xFE, 0xD8, 0xDF, 0x00, 0xB5, 0xA8, 0x6F, 0xEC, 0x35, 0x8F, - 0x16, 0xCD, 0xF0, 0xF7, 0xE2, 0x06, 0x83, 0xAD, 0x5A, 0xF8, 0x5B, 0xC4, 0xFF, 0x00, 0x05, 0xBE, - 0x21, 0xE9, 0x33, 0xF8, 0x6F, 0xE3, 0x4E, 0x81, 0xAA, 0xDE, 0x5F, 0x9B, 0x1B, 0x3B, 0x24, 0xF0, - 0xDE, 0xD7, 0xB9, 0xD4, 0x62, 0xB9, 0xBC, 0x8E, 0x58, 0xAC, 0xEF, 0xF4, 0xC1, 0x7D, 0xA7, 0xEA, - 0x4A, 0x86, 0x7D, 0x3E, 0xEE, 0xF2, 0xDD, 0x92, 0x77, 0x00, 0xEC, 0xFE, 0x36, 0xFC, 0x42, 0xD7, - 0xFE, 0x1E, 0xC7, 0xF0, 0x98, 0xF8, 0x7E, 0x3D, 0x31, 0xFF, 0x00, 0xE1, 0x35, 0xF8, 0xDD, 0xE1, - 0xDF, 0x87, 0x9A, 0xC8, 0xD4, 0x6D, 0x5E, 0xE4, 0x26, 0x9F, 0xAA, 0x49, 0x2A, 0xDC, 0xB5, 0xB8, - 0x57, 0x4D, 0x93, 0x01, 0x12, 0x6D, 0x63, 0xB8, 0x0E, 0x72, 0xA7, 0xB0, 0x07, 0xB7, 0x60, 0x63, - 0x18, 0x18, 0xC6, 0x31, 0x81, 0x8C, 0x63, 0xA6, 0x28, 0x03, 0xE3, 0xEF, 0x19, 0x7C, 0x7B, 0xF8, - 0xA7, 0xF0, 0x02, 0x4F, 0x1D, 0x6B, 0xFF, 0x00, 0x1E, 0xBE, 0x15, 0xCF, 0xE2, 0x8F, 0x82, 0xBA, - 0x2E, 0xA3, 0x79, 0xAD, 0x78, 0x7F, 0xE3, 0x27, 0xEC, 0xEB, 0xA3, 0x6A, 0x9E, 0x3E, 0xD7, 0x74, - 0x5D, 0x11, 0xEE, 0x5E, 0x48, 0x2D, 0xFC, 0x57, 0xF0, 0xE5, 0x12, 0x7D, 0x75, 0x2E, 0xED, 0xA2, - 0xB8, 0xB1, 0xB3, 0x59, 0xB4, 0x13, 0xE2, 0x11, 0xA8, 0x3D, 0xB5, 0xD5, 0xF3, 0xDA, 0xE8, 0xEB, - 0x34, 0x76, 0x11, 0x00, 0x6C, 0xFC, 0x4C, 0xF8, 0xBB, 0x2F, 0x8A, 0x74, 0xFF, 0x00, 0xD9, 0xCB, - 0x4A, 0xF8, 0x1F, 0xF1, 0x0B, 0xC3, 0xED, 0xA1, 0xFE, 0xD3, 0x3E, 0x31, 0x6D, 0x2B, 0x45, 0xF8, - 0xCD, 0xE0, 0xD9, 0xB4, 0xBF, 0x1D, 0xE9, 0xF6, 0x5E, 0x1D, 0x8B, 0xC1, 0xFA, 0xB6, 0xBC, 0xDA, - 0xC7, 0x86, 0xA7, 0x6F, 0xB4, 0x69, 0x97, 0x77, 0x17, 0x11, 0xE8, 0xD6, 0xB1, 0x5B, 0x4D, 0x2C, - 0x77, 0x56, 0xAA, 0xB7, 0x2D, 0x3B, 0x45, 0x38, 0x8D, 0x62, 0x94, 0x03, 0xD1, 0xFC, 0x57, 0xA0, - 0x7C, 0x68, 0xBE, 0xF8, 0xC1, 0xF0, 0x8B, 0x5D, 0xF0, 0x77, 0x8F, 0xBC, 0x2F, 0xE1, 0xEF, 0x83, - 0x1E, 0x1F, 0xD3, 0x3C, 0x44, 0xBF, 0x19, 0x3C, 0x09, 0xAA, 0x78, 0x4C, 0x6B, 0xBE, 0x21, 0xF8, - 0x83, 0x3D, 0xD5, 0xA4, 0x11, 0xF8, 0x72, 0x3D, 0x2A, 0xF8, 0x34, 0x4D, 0xA7, 0x3D, 0xB5, 0xC8, - 0x9E, 0xE1, 0xEE, 0x4C, 0xB2, 0x21, 0x8A, 0x29, 0xAD, 0x5A, 0xCE, 0x76, 0xBE, 0x8A, 0xF3, 0x47, - 0x00, 0xFC, 0xFB, 0xD2, 0xFF, 0x00, 0x6E, 0x0F, 0xDA, 0x0F, 0x55, 0xFD, 0x9F, 0x3C, 0x3F, 0xE1, - 0x9B, 0x5F, 0xD9, 0xFB, 0xC5, 0xEB, 0xFB, 0x5C, 0xF8, 0x8F, 0x50, 0xBE, 0xFD, 0x96, 0x74, 0xFF, - 0x00, 0x1D, 0x4B, 0xA6, 0xF8, 0x5A, 0x3F, 0xD9, 0xA2, 0x2F, 0x8D, 0x3A, 0x4A, 0x5E, 0x69, 0x7A, - 0xBE, 0xAD, 0x3D, 0x8F, 0xFC, 0x25, 0x3F, 0xF0, 0x90, 0xC5, 0xE0, 0xEB, 0x6D, 0x4F, 0x44, 0xD5, - 0xF5, 0x72, 0x5A, 0xD4, 0x5F, 0x4D, 0xA2, 0x5A, 0x89, 0x6D, 0xE0, 0x9E, 0x7B, 0x8B, 0x68, 0x6E, - 0x00, 0x3F, 0x41, 0x3C, 0x0D, 0xE1, 0xFF, 0x00, 0x8D, 0x1A, 0x77, 0xC4, 0xDF, 0x8D, 0x5A, 0xCF, - 0x8F, 0x3C, 0x7F, 0xE1, 0x7F, 0x10, 0xFC, 0x28, 0xF1, 0x0E, 0xA3, 0xA1, 0x9F, 0x81, 0xDE, 0x04, - 0xD2, 0xFC, 0x26, 0x34, 0xEF, 0x12, 0xFC, 0x3E, 0x82, 0xD7, 0x49, 0x09, 0xAF, 0xBE, 0xA7, 0xAC, - 0xAB, 0xA0, 0xBB, 0x4B, 0xBB, 0xD6, 0x46, 0x86, 0xD8, 0xC3, 0x23, 0xDB, 0xFD, 0x9E, 0x79, 0x7E, - 0xD9, 0x2A, 0x5F, 0xC5, 0x65, 0xA4, 0x80, 0x79, 0xD7, 0xEC, 0xBB, 0xF1, 0x47, 0x5E, 0xF1, 0x84, - 0x1F, 0x1C, 0xFE, 0x15, 0x78, 0xDF, 0x59, 0xD4, 0x3C, 0x55, 0xF1, 0x03, 0xF6, 0x52, 0xF8, 0xDC, - 0xFF, 0x00, 0x00, 0xBC, 0x69, 0xE3, 0xFD, 0x47, 0x4E, 0xD3, 0xB4, 0xAF, 0xF8, 0x58, 0x8B, 0x3F, - 0x84, 0x34, 0x0F, 0x15, 0xF8, 0x77, 0x5C, 0x92, 0x3B, 0x28, 0xED, 0xED, 0x7E, 0xD9, 0x2F, 0x87, - 0x3C, 0x79, 0xE1, 0x95, 0xD4, 0x0C, 0x16, 0x5A, 0x7D, 0xB0, 0xD5, 0x22, 0xD5, 0xD6, 0xD6, 0xD2, - 0x2B, 0x45, 0xB6, 0xDE, 0x01, 0xD9, 0x7E, 0xCE, 0x7F, 0x13, 0x3C, 0x51, 0xF1, 0x9F, 0xE1, 0x7E, - 0x9D, 0xF1, 0x63, 0xC4, 0x1A, 0x26, 0x8D, 0xE1, 0xBD, 0x13, 0xE2, 0x06, 0xAD, 0x7F, 0xE2, 0x2F, - 0x85, 0xBA, 0x36, 0x95, 0x71, 0x36, 0xA1, 0x79, 0xFF, 0x00, 0x08, 0x63, 0xDC, 0xB4, 0x7E, 0x15, - 0xD5, 0x35, 0x3B, 0xA7, 0xD9, 0xBA, 0xF7, 0x53, 0xD3, 0xE1, 0xB5, 0xD5, 0x64, 0xB7, 0x58, 0x20, - 0xFB, 0x0F, 0xF6, 0x9A, 0x69, 0xCD, 0xF6, 0x87, 0xB0, 0x7B, 0xDB, 0xD0, 0x0A, 0x77, 0x3E, 0x34, - 0xF1, 0x3C, 0x7F, 0xB5, 0x36, 0x89, 0xF0, 0xE9, 0x35, 0x52, 0xBE, 0x0A, 0xBB, 0xFD, 0x9F, 0xB5, - 0x4F, 0x1A, 0x5C, 0x68, 0x5F, 0x61, 0xB5, 0x29, 0x26, 0xA9, 0x6F, 0xE2, 0x2D, 0x3E, 0xD6, 0x0B, - 0xBF, 0xB4, 0xF9, 0x5F, 0x68, 0x1B, 0x60, 0xB9, 0x9D, 0x3C, 0xB1, 0x20, 0x8C, 0xEF, 0xC9, 0x42, - 0xC0, 0x10, 0x01, 0xF4, 0x00, 0xE3, 0xA7, 0x1F, 0x4E, 0x28, 0x00, 0xA0, 0x02, 0x80, 0x10, 0x28, - 0x1D, 0x00, 0x1F, 0x40, 0x07, 0x61, 0xFE, 0x03, 0xF2, 0x1E, 0x94, 0x01, 0xE1, 0x9A, 0xC7, 0xC4, - 0xAF, 0x13, 0x4B, 0xFB, 0x43, 0xF8, 0x2F, 0xE0, 0xC7, 0x86, 0x34, 0xDD, 0x0F, 0xFB, 0x0A, 0xD7, - 0xE1, 0xAE, 0xA7, 0xF1, 0x5F, 0xE2, 0xB7, 0x88, 0xF5, 0x33, 0x35, 0xD6, 0xA9, 0xA6, 0xDA, 0xB5, - 0xE4, 0x7A, 0x77, 0x85, 0xF4, 0x5D, 0x32, 0xCD, 0x1A, 0x34, 0x49, 0x6F, 0xAE, 0x9F, 0x5A, 0xBA, - 0x7B, 0xD9, 0x1E, 0x65, 0x82, 0x2F, 0x0F, 0xCB, 0x6A, 0x2D, 0x24, 0x7D, 0x4D, 0x2E, 0xB4, 0xD0, - 0x0E, 0xFF, 0x00, 0xE2, 0x1E, 0x81, 0xE2, 0xDF, 0x12, 0x78, 0x43, 0x53, 0xD2, 0x7C, 0x07, 0xE3, - 0xAB, 0x8F, 0x86, 0xDE, 0x2F, 0x32, 0x5A, 0xDF, 0xE8, 0x1E, 0x2E, 0x87, 0xC3, 0xB6, 0x5E, 0x2D, - 0xB3, 0xB3, 0x9E, 0xCA, 0xEE, 0x2B, 0x85, 0xB4, 0xD4, 0x34, 0xBB, 0x90, 0x12, 0xEB, 0x4F, 0xBA, - 0x16, 0xED, 0x6B, 0x77, 0x14, 0x32, 0xDA, 0x5C, 0xB5, 0xAD, 0xC5, 0xC8, 0xB5, 0xBD, 0xB1, 0xB9, - 0xF2, 0x2F, 0x2D, 0x80, 0x38, 0x6F, 0x83, 0xDF, 0x18, 0xBF, 0xE1, 0x61, 0xB6, 0xBD, 0xE0, 0xDF, - 0x18, 0xF8, 0x7A, 0x1F, 0x87, 0x3F, 0x1B, 0xFE, 0x1E, 0x43, 0x65, 0x17, 0xC5, 0x2F, 0x85, 0x6D, - 0xAC, 0xB6, 0xBD, 0x06, 0x8C, 0x6F, 0xA3, 0x63, 0x65, 0xAC, 0xF8, 0x7B, 0x54, 0x7B, 0x7B, 0x66, - 0xD6, 0x7C, 0x37, 0x7A, 0xD6, 0xF7, 0x82, 0xC7, 0x56, 0x5B, 0x5B, 0x61, 0x33, 0x5A, 0xDE, 0xDA, - 0xDC, 0x5B, 0xD8, 0xEA, 0x3A, 0x7E, 0xA3, 0xA6, 0xE9, 0xE0, 0x1E, 0xDD, 0x40, 0x05, 0x00, 0x14, - 0x00, 0x50, 0x01, 0x40, 0x05, 0x00, 0x14, 0x00, 0x50, 0x01, 0x40, 0x05, 0x00, 0x14, 0x00, 0x50, - 0x01, 0x40, 0x05, 0x00, 0x14, 0x00, 0x50, 0x01, 0x40, 0x05, 0x00, 0x58, 0xA0, 0x02, 0x80, 0x0A, - 0x00, 0x28, 0x00, 0xA0, 0x02, 0x80, 0x3F, 0xCF, 0xCF, 0xFE, 0x0E, 0x7D, 0xFF, 0x00, 0x94, 0xE7, - 0xFF, 0x00, 0xC1, 0x21, 0xFF, 0x00, 0xEC, 0x15, 0xF0, 0xF7, 0xFF, 0x00, 0x56, 0xF5, 0xCD, 0x76, - 0x65, 0x9F, 0xF2, 0x30, 0xC3, 0xFF, 0x00, 0x8E, 0x1F, 0xFA, 0x52, 0x39, 0xF1, 0x3F, 0xEE, 0xB5, - 0x3F, 0xC2, 0xFF, 0x00, 0x23, 0xED, 0x4A, 0xFD, 0x4C, 0xF8, 0xE0, 0xA0, 0x02, 0x80, 0x0A, 0x00, - 0xFD, 0x82, 0xFF, 0x00, 0x82, 0x21, 0x7F, 0xC8, 0x89, 0xFB, 0x75, 0xFF, 0x00, 0xD9, 0xF3, 0xC1, - 0xFF, 0x00, 0xAA, 0x1B, 0xE1, 0x95, 0x7E, 0x75, 0xC4, 0x1F, 0xF2, 0x34, 0x9F, 0xA4, 0x7F, 0xF4, - 0x94, 0x7D, 0x46, 0x57, 0xFE, 0xE5, 0x1F, 0x9F, 0xE6, 0x7E, 0xDB, 0x57, 0x8A, 0x7A, 0x21, 0x40, - 0x05, 0x00, 0x14, 0x00, 0x50, 0x01, 0x40, 0x05, 0x00, 0x14, 0x00, 0x50, 0x02, 0x1F, 0xBA, 0x7F, - 0xDD, 0xFE, 0x94, 0x01, 0xE0, 0x3F, 0x1C, 0x7E, 0x0E, 0x6B, 0x3F, 0x14, 0x20, 0xF0, 0x66, 0xBF, - 0xE0, 0x8F, 0x88, 0x57, 0x7F, 0x0B, 0xFE, 0x29, 0xFC, 0x2A, 0xD6, 0xAF, 0x3C, 0x5D, 0xF0, 0xC3, - 0xC5, 0xB2, 0x78, 0x62, 0xCB, 0xC7, 0x3E, 0x12, 0x83, 0x53, 0xB9, 0xD2, 0x2E, 0xAC, 0x0D, 0xAF, - 0x88, 0xF4, 0x19, 0xCC, 0x52, 0x5F, 0xE9, 0x33, 0x45, 0x7F, 0x22, 0x5C, 0xC1, 0x67, 0x7B, 0xA5, - 0x5E, 0xB4, 0x46, 0x44, 0xB6, 0xD4, 0xAC, 0x64, 0x7F, 0x39, 0x40, 0x3C, 0x37, 0x5E, 0xFD, 0x93, - 0xBC, 0x71, 0xE3, 0x3F, 0x0A, 0xF8, 0x6B, 0xC7, 0x9E, 0x2B, 0xF1, 0x77, 0xEC, 0xED, 0x69, 0xFB, - 0x70, 0xF8, 0x17, 0xC5, 0xB6, 0x1E, 0x37, 0xF0, 0x67, 0xED, 0x47, 0xF0, 0xFF, 0x00, 0xF6, 0x5E, - 0xD4, 0x3C, 0x25, 0xE1, 0x2B, 0x7B, 0xCD, 0x1A, 0x0D, 0x7F, 0x4F, 0xD1, 0xEC, 0xF5, 0x7F, 0x07, - 0xDC, 0x78, 0xBA, 0xF7, 0x53, 0xD4, 0xF4, 0xD5, 0xD0, 0x7E, 0x20, 0x78, 0xEF, 0x4C, 0x92, 0xD6, - 0x6F, 0x11, 0x0D, 0xAB, 0xE2, 0x2D, 0x62, 0xEA, 0xCE, 0x4D, 0x3E, 0xE6, 0x68, 0xE6, 0x80, 0x03, - 0xE8, 0x7D, 0x4B, 0xE1, 0x12, 0xEA, 0xBF, 0x0F, 0x7C, 0x0B, 0xE1, 0x8D, 0x53, 0xC6, 0x3E, 0x20, - 0xF1, 0x2F, 0x8E, 0xFE, 0x19, 0x69, 0x11, 0xCB, 0xE0, 0x9F, 0x8C, 0x5E, 0x2E, 0xB5, 0xD3, 0xEF, - 0xBC, 0x65, 0x6F, 0xE2, 0x48, 0x7C, 0x3B, 0x75, 0xA4, 0x27, 0x8B, 0x75, 0x0B, 0x3B, 0x1B, 0x7B, - 0x2D, 0x2E, 0xE6, 0xF9, 0xE2, 0xD4, 0xEF, 0xE5, 0x96, 0x18, 0xED, 0x2D, 0xED, 0x19, 0xE7, 0x90, - 0x25, 0xBC, 0x4A, 0x11, 0x63, 0x00, 0xF0, 0x7D, 0x67, 0xF6, 0x6B, 0xF8, 0xD3, 0xE0, 0x0F, 0x06, - 0x7E, 0xCE, 0xDE, 0x12, 0xFD, 0x91, 0x3E, 0x38, 0xFC, 0x3D, 0xF8, 0x2D, 0x63, 0xF0, 0x07, 0xE1, - 0x07, 0xFC, 0x28, 0xC8, 0x7C, 0x2B, 0xF1, 0x6F, 0xE0, 0xD7, 0x88, 0xFE, 0x3C, 0x7C, 0x26, 0xF1, - 0x26, 0x85, 0x15, 0xA6, 0x8F, 0x0E, 0x9D, 0x3F, 0xFC, 0x23, 0xF6, 0x1E, 0x34, 0xF0, 0xF5, 0xC4, - 0x5A, 0xA5, 0x92, 0xF8, 0x66, 0x08, 0xAD, 0xAF, 0x27, 0xBF, 0xBC, 0x31, 0xDB, 0xDF, 0x6A, 0x71, - 0x18, 0xD9, 0xAE, 0x4C, 0xAA, 0x01, 0xE4, 0xDF, 0xB4, 0x7F, 0xEC, 0x15, 0xF1, 0x47, 0xF6, 0x9C, - 0xF8, 0x93, 0xF0, 0x17, 0xC6, 0x3E, 0x34, 0xFD, 0xAA, 0xFC, 0x4D, 0xE1, 0x4F, 0x0B, 0x7C, 0x34, - 0x1E, 0x08, 0xF1, 0x17, 0xC4, 0x3F, 0x01, 0xFC, 0x31, 0xB3, 0xF1, 0xBF, 0x81, 0x74, 0x4F, 0x14, - 0xF8, 0xAB, 0xC0, 0xBE, 0x27, 0x87, 0xC4, 0x56, 0x1A, 0xF7, 0x86, 0xF4, 0xCB, 0x7F, 0x1A, 0x8F, - 0x0F, 0x59, 0xC7, 0x73, 0xAB, 0x58, 0xE9, 0x82, 0x7B, 0x7F, 0x12, 0x68, 0xDE, 0x30, 0x78, 0xED, - 0x2C, 0xAD, 0xE2, 0xB4, 0xB8, 0xB3, 0xB8, 0x0D, 0x7A, 0xE0, 0x1F, 0x79, 0xFC, 0x36, 0xF0, 0xAF, - 0x8B, 0xFC, 0x19, 0xA0, 0x5C, 0x68, 0x1E, 0x2F, 0xF8, 0x97, 0xAC, 0xFC, 0x57, 0x92, 0xDB, 0x54, - 0x92, 0x5D, 0x0B, 0xC5, 0x9E, 0x29, 0xF0, 0xFE, 0x95, 0xA1, 0x78, 0xCD, 0xAC, 0x24, 0x8A, 0x36, - 0x5B, 0x5D, 0x61, 0xF4, 0xC8, 0x2D, 0x74, 0xEB, 0xB9, 0xA2, 0xB8, 0x37, 0x8B, 0x1C, 0xF6, 0xD6, - 0x16, 0x03, 0xEC, 0xC6, 0xCE, 0x29, 0x22, 0x96, 0x78, 0x66, 0xBC, 0xBC, 0x00, 0xEB, 0xED, 0xF4, - 0x7D, 0x22, 0xD3, 0x51, 0xBE, 0xD5, 0xED, 0x74, 0xBD, 0x3A, 0xDB, 0x56, 0xD5, 0x12, 0x18, 0xF5, - 0x3D, 0x52, 0xDE, 0xC6, 0x28, 0x75, 0x1D, 0x45, 0x6D, 0xD7, 0x6D, 0xBA, 0xCF, 0x38, 0x50, 0xF2, - 0x04, 0x52, 0x42, 0x86, 0x27, 0x68, 0x38, 0x18, 0x14, 0x00, 0x6A, 0x5A, 0x3E, 0x93, 0xAC, 0xDB, - 0xC7, 0x69, 0xAB, 0xE9, 0x7A, 0x76, 0xAB, 0x6B, 0x15, 0xC4, 0x77, 0x71, 0x5B, 0x6A, 0x56, 0x31, - 0x5F, 0x5B, 0xC5, 0x2C, 0x27, 0x31, 0x4A, 0xA8, 0xEA, 0x54, 0x3A, 0x9E, 0x55, 0x80, 0xC8, 0xED, - 0x8A, 0x00, 0xD1, 0xF4, 0xF6, 0xC6, 0x3D, 0xB1, 0xD3, 0x14, 0x01, 0x9F, 0xA6, 0xE9, 0x1A, 0x4E, - 0x8D, 0x1D, 0xCC, 0x5A, 0x3E, 0x97, 0xA7, 0x69, 0x51, 0x5E, 0xDE, 0xC9, 0xA9, 0x5E, 0x47, 0xA6, - 0xD9, 0x45, 0x63, 0x1D, 0xDD, 0xCC, 0xC4, 0x79, 0xD7, 0x12, 0xAA, 0x28, 0x0D, 0x23, 0xED, 0x5D, - 0xCE, 0x72, 0x4E, 0x06, 0x4F, 0x14, 0x00, 0xDB, 0x9D, 0x1B, 0x47, 0xBD, 0xD4, 0x34, 0xBD, 0x5A, - 0xF3, 0x4A, 0xD3, 0x6E, 0xF5, 0x5D, 0x0C, 0x4E, 0x34, 0x5D, 0x4E, 0xE6, 0xC6, 0x29, 0xF5, 0x0D, - 0x1C, 0x5C, 0xC6, 0x12, 0xE4, 0x5A, 0xCC, 0xCA, 0x5E, 0x2F, 0x31, 0x15, 0x55, 0xF6, 0x15, 0xDC, - 0x00, 0x07, 0x20, 0x50, 0x07, 0x9B, 0x7C, 0x61, 0xF8, 0x7B, 0xE2, 0x5F, 0x88, 0x9A, 0x3F, 0x82, - 0xAC, 0xFC, 0x27, 0xE2, 0xBF, 0x0E, 0x78, 0x33, 0x54, 0xF0, 0xA7, 0xC5, 0xBF, 0x0A, 0x7C, 0x41, - 0xB9, 0xD5, 0x7C, 0x47, 0xF0, 0xDA, 0xC3, 0xE2, 0x6C, 0x57, 0xBA, 0x66, 0x87, 0xAE, 0x5B, 0xDC, - 0xEB, 0x5A, 0x45, 0x95, 0xB5, 0xD4, 0xB1, 0x2D, 0x85, 0xDD, 0xFE, 0x9D, 0x15, 0xFD, 0x8C, 0x5A, - 0x9C, 0x45, 0xA6, 0xB1, 0x6B, 0xBF, 0xB4, 0xC6, 0x92, 0x34, 0x41, 0x18, 0x03, 0xD3, 0x35, 0x5D, - 0x57, 0x4A, 0xD0, 0x74, 0xAD, 0x4B, 0x5B, 0xD6, 0xF5, 0x2D, 0x3F, 0x45, 0xD1, 0x34, 0x5D, 0x3E, - 0x6D, 0x57, 0x57, 0xD5, 0xF5, 0x5B, 0xC8, 0xB4, 0xED, 0x2B, 0x49, 0xB4, 0xB6, 0x88, 0xC9, 0x71, - 0x73, 0x73, 0x71, 0x21, 0x58, 0xE2, 0x8A, 0x38, 0xD1, 0xDD, 0x9D, 0xCA, 0xAA, 0xAA, 0x92, 0x48, - 0x03, 0x80, 0x0F, 0x97, 0x34, 0xBF, 0xD9, 0xA7, 0xE1, 0x2F, 0xC4, 0xEF, 0x11, 0xF8, 0x7B, 0xE3, - 0x57, 0xC4, 0x8D, 0x6B, 0xC6, 0x5F, 0xB4, 0x4E, 0x6E, 0xEE, 0x3C, 0x7B, 0xF0, 0x8B, 0x49, 0xF8, - 0xD4, 0x6D, 0x2F, 0xFE, 0x1E, 0x7C, 0x2B, 0x4D, 0x64, 0xF9, 0xD6, 0x37, 0x3E, 0x1F, 0xF0, 0x64, - 0x56, 0x16, 0x5A, 0x5D, 0xBE, 0xA1, 0x6B, 0x63, 0x70, 0x2C, 0x6D, 0x75, 0x5B, 0xDB, 0x29, 0xF5, - 0x9B, 0x7B, 0x49, 0x6F, 0xAD, 0xCD, 0xF7, 0xFC, 0x4C, 0x75, 0x0F, 0xB6, 0x80, 0x6F, 0xFC, 0x4B, - 0xD0, 0xAD, 0xBE, 0x30, 0x6B, 0x1A, 0x1E, 0xA7, 0xF0, 0x9F, 0xC7, 0x1E, 0x17, 0x5F, 0x8A, 0xFF, - 0x00, 0xB2, 0xAF, 0xC6, 0x9B, 0x6D, 0x46, 0xF7, 0x4A, 0xD5, 0x92, 0x4D, 0x57, 0xC3, 0x69, 0xA8, - 0xDE, 0xF8, 0x45, 0x7F, 0xB5, 0x7C, 0x29, 0xE2, 0x18, 0xE0, 0x65, 0xB9, 0xB4, 0x7B, 0xCF, 0x0B, - 0xF8, 0xE6, 0x29, 0xED, 0xEE, 0xA2, 0x2E, 0xD6, 0x57, 0x17, 0x7A, 0x3D, 0xFB, 0xDB, 0x6A, 0x16, - 0xF0, 0x4D, 0xA6, 0x6A, 0x00, 0x1F, 0x49, 0xE0, 0x0E, 0x07, 0x41, 0xC0, 0xE0, 0x0E, 0x07, 0x4E, - 0x28, 0x03, 0xE6, 0x1B, 0x6F, 0xD9, 0x5F, 0xC0, 0x90, 0xFE, 0xD4, 0x1A, 0x87, 0xED, 0x36, 0xF2, - 0xB9, 0xD4, 0xA6, 0xF0, 0xC4, 0x31, 0xE9, 0xDE, 0x05, 0xB5, 0xB5, 0x36, 0x3E, 0x10, 0xB7, 0xF1, - 0x74, 0x96, 0x5F, 0xD9, 0x7A, 0x9F, 0xC4, 0x5B, 0xDB, 0x44, 0x93, 0xEC, 0xD7, 0xBE, 0x26, 0x97, - 0xC3, 0x76, 0x7A, 0x1F, 0x87, 0xE0, 0xD5, 0x25, 0xB7, 0xFB, 0x6D, 0xA6, 0x95, 0x6B, 0x77, 0xA7, - 0xC7, 0x72, 0x6D, 0x6F, 0xA4, 0xB7, 0x40, 0x0F, 0xA7, 0x86, 0x38, 0xF4, 0xE3, 0xA6, 0x3A, 0x7B, - 0x50, 0x07, 0xC0, 0x9E, 0x30, 0xF8, 0x3C, 0xDF, 0x0C, 0xFF, 0x00, 0x66, 0x6F, 0xDA, 0x3B, 0xC4, - 0x7E, 0x3D, 0xF8, 0xB3, 0xA3, 0xFC, 0x18, 0xD7, 0xBE, 0x30, 0x78, 0x92, 0xFB, 0xE3, 0xEF, 0xED, - 0x7F, 0xF1, 0xDF, 0xC3, 0x7E, 0x23, 0xD4, 0xBC, 0x27, 0x1F, 0x83, 0xF4, 0x2B, 0x6D, 0x3F, 0x4F, - 0xB4, 0xF1, 0x1B, 0x68, 0x5A, 0xDD, 0xBB, 0x5A, 0xDC, 0xE9, 0xF3, 0x69, 0x9E, 0x03, 0xF0, 0xA6, - 0x99, 0xA0, 0xD9, 0x6B, 0x30, 0x2D, 0x84, 0xF0, 0x8D, 0x32, 0xD7, 0x59, 0x68, 0xD6, 0xF1, 0x65, - 0x59, 0x40, 0x3E, 0xE7, 0xD0, 0xB4, 0x2D, 0x13, 0xC2, 0xFA, 0x26, 0x8F, 0xE1, 0x9F, 0x0C, 0xE8, - 0xDA, 0x57, 0x87, 0x7C, 0x37, 0xE1, 0xDD, 0x2A, 0xDB, 0x41, 0xF0, 0xFF, 0x00, 0x87, 0xB4, 0x2D, - 0x3A, 0x1D, 0x23, 0x43, 0xD0, 0x6C, 0x6C, 0xE1, 0x58, 0xAD, 0x2C, 0xAC, 0xAD, 0x22, 0x55, 0x8A, - 0x08, 0x22, 0x8A, 0x28, 0xE3, 0x48, 0xE3, 0x55, 0x54, 0x55, 0x55, 0x50, 0x00, 0x00, 0x00, 0x7C, - 0xFB, 0xE2, 0x8B, 0x2D, 0x3F, 0xC3, 0x1F, 0xB5, 0x27, 0xC2, 0xEF, 0x1D, 0xF8, 0x8B, 0xC5, 0x1E, - 0x14, 0xD0, 0xF4, 0xFF, 0x00, 0x88, 0x1F, 0x0F, 0x35, 0x7F, 0x80, 0x5E, 0x04, 0xD1, 0x35, 0x2D, - 0x51, 0xED, 0xBC, 0x4F, 0xE3, 0x0F, 0x13, 0xB9, 0x7F, 0x12, 0xB5, 0x86, 0x9D, 0x6A, 0x62, 0xF2, - 0xE5, 0xD9, 0xA2, 0xF8, 0x47, 0xC4, 0x57, 0x4D, 0x89, 0x43, 0x84, 0xB2, 0x98, 0x84, 0x2A, 0xA5, - 0x94, 0x03, 0xE9, 0x6A, 0x00, 0x28, 0x00, 0xA0, 0x0C, 0x0F, 0x15, 0xF8, 0xA7, 0xC3, 0x7E, 0x04, - 0xF0, 0xAF, 0x89, 0x7C, 0x6F, 0xE3, 0x0D, 0x67, 0x4F, 0xF0, 0xDF, 0x84, 0x3C, 0x1B, 0xE1, 0xFB, - 0xDF, 0x15, 0x78, 0xA7, 0xC4, 0x3A, 0xB4, 0xEB, 0x69, 0xA5, 0x68, 0x1A, 0x6E, 0x9D, 0x6C, 0xF7, - 0x17, 0xD7, 0xB7, 0x32, 0x9E, 0x12, 0x28, 0xA0, 0x86, 0x59, 0x19, 0x8F, 0x01, 0x50, 0x9E, 0xD4, - 0x01, 0xE5, 0x7F, 0x08, 0xFE, 0x0E, 0x7F, 0xC2, 0x03, 0xE2, 0x8F, 0x8C, 0x5F, 0x11, 0xFC, 0x49, - 0x7F, 0x0F, 0x89, 0x3E, 0x25, 0xFC, 0x64, 0xF1, 0xCB, 0xEA, 0x7A, 0xDF, 0x89, 0x4B, 0xCD, 0x72, - 0xDA, 0x4F, 0x86, 0xF4, 0x83, 0x25, 0xAF, 0x82, 0xFC, 0x2B, 0xA7, 0xB4, 0xC4, 0xB5, 0xAE, 0x9B, - 0x61, 0x62, 0xF3, 0x5C, 0x1B, 0x38, 0x7C, 0xBB, 0x6F, 0xED, 0x3D, 0x5B, 0xC4, 0x77, 0xEB, 0x18, - 0x9F, 0x55, 0xBA, 0x96, 0x70, 0x0F, 0x73, 0xA0, 0x0F, 0x15, 0xF8, 0xC3, 0xF0, 0x81, 0xBE, 0x22, - 0x47, 0xA0, 0x78, 0xA7, 0xC2, 0x3E, 0x21, 0x4F, 0x87, 0x9F, 0x1A, 0x7E, 0x1D, 0x0B, 0xDB, 0xBF, - 0x84, 0xFF, 0x00, 0x13, 0xD3, 0x4C, 0x9B, 0x5B, 0xB5, 0xD0, 0x65, 0xBE, 0x8E, 0x35, 0xBD, 0xD2, - 0x75, 0xFD, 0x26, 0x2B, 0xAB, 0x43, 0xAD, 0x78, 0x72, 0xF8, 0xDA, 0x58, 0x8B, 0xFD, 0x22, 0x4B, - 0x9B, 0x75, 0x9C, 0xDA, 0xD8, 0xDD, 0x5B, 0xCF, 0x65, 0xA8, 0xE9, 0xDA, 0x6E, 0xA5, 0xA7, 0x00, - 0x71, 0x97, 0xFE, 0x34, 0xFD, 0xAF, 0x6D, 0xEE, 0xA4, 0x87, 0x4E, 0xFD, 0x9D, 0xFE, 0x04, 0xEA, - 0x16, 0x71, 0x84, 0x58, 0xAF, 0x26, 0xFD, 0xAA, 0x35, 0x8B, 0x07, 0x9C, 0xEC, 0x1B, 0xC8, 0x8B, - 0xFE, 0x10, 0x66, 0xC2, 0x86, 0xDC, 0x01, 0x24, 0x12, 0x00, 0x24, 0x29, 0x3B, 0x54, 0x02, 0x9F, - 0xFC, 0x27, 0x5F, 0xB6, 0x5F, 0xFD, 0x1B, 0x57, 0xC0, 0x4F, 0xFC, 0x4B, 0x4D, 0x63, 0xFF, 0x00, - 0x98, 0x3A, 0x00, 0x3F, 0xE1, 0x3A, 0xFD, 0xB2, 0xFF, 0x00, 0xE8, 0xDA, 0xBE, 0x02, 0x7F, 0xE2, - 0x5A, 0x6B, 0x1F, 0xFC, 0xC1, 0xD0, 0x01, 0xFF, 0x00, 0x09, 0xD7, 0xED, 0x97, 0xFF, 0x00, 0x46, - 0xD5, 0xF0, 0x13, 0xFF, 0x00, 0x12, 0xD3, 0x58, 0xFF, 0x00, 0xE6, 0x0E, 0x80, 0x0F, 0xF8, 0x4E, - 0xBF, 0x6C, 0xBF, 0xFA, 0x36, 0xAF, 0x80, 0x9F, 0xF8, 0x96, 0x9A, 0xC7, 0xFF, 0x00, 0x30, 0x74, - 0x00, 0x7F, 0xC2, 0x75, 0xFB, 0x65, 0xFF, 0x00, 0xD1, 0xB5, 0x7C, 0x04, 0xFF, 0x00, 0xC4, 0xB4, - 0xD6, 0x3F, 0xF9, 0x83, 0xA0, 0x03, 0xFE, 0x13, 0xAF, 0xDB, 0x2F, 0xFE, 0x8D, 0xAB, 0xE0, 0x27, - 0xFE, 0x25, 0xA6, 0xB1, 0xFF, 0x00, 0xCC, 0x1D, 0x00, 0x1F, 0xF0, 0x9D, 0x7E, 0xD9, 0x7F, 0xF4, - 0x6D, 0x5F, 0x01, 0x3F, 0xF1, 0x2D, 0x35, 0x8F, 0xFE, 0x60, 0xE8, 0x00, 0xFF, 0x00, 0x84, 0xEB, - 0xF6, 0xCB, 0xFF, 0x00, 0xA3, 0x6A, 0xF8, 0x09, 0xFF, 0x00, 0x89, 0x69, 0xAC, 0x7F, 0xF3, 0x07, - 0x40, 0x07, 0xFC, 0x27, 0x5F, 0xB6, 0x5F, 0xFD, 0x1B, 0x57, 0xC0, 0x4F, 0xFC, 0x4B, 0x4D, 0x63, - 0xFF, 0x00, 0x98, 0x3A, 0x00, 0x3F, 0xE1, 0x3A, 0xFD, 0xB2, 0xFF, 0x00, 0xE8, 0xDA, 0xBE, 0x02, - 0x7F, 0xE2, 0x5A, 0x6B, 0x1F, 0xFC, 0xC1, 0xD0, 0x01, 0xFF, 0x00, 0x09, 0xD7, 0xED, 0x97, 0xFF, - 0x00, 0x46, 0xD5, 0xF0, 0x13, 0xFF, 0x00, 0x12, 0xD3, 0x58, 0xFF, 0x00, 0xE6, 0x0E, 0x80, 0x0F, - 0xF8, 0x4E, 0xBF, 0x6C, 0xBF, 0xFA, 0x36, 0xAF, 0x80, 0x9F, 0xF8, 0x96, 0x9A, 0xC7, 0xFF, 0x00, - 0x30, 0x74, 0x00, 0x7F, 0xC2, 0x75, 0xFB, 0x65, 0xFF, 0x00, 0xD1, 0xB5, 0x7C, 0x04, 0xFF, 0x00, - 0xC4, 0xB4, 0xD6, 0x3F, 0xF9, 0x83, 0xA0, 0x0F, 0xA3, 0x3C, 0x31, 0x75, 0xE2, 0x2B, 0xDF, 0x0F, - 0x68, 0xF7, 0x7E, 0x2E, 0xD1, 0x74, 0x9F, 0x0E, 0xF8, 0x9A, 0xE2, 0xC2, 0x39, 0x75, 0xCD, 0x0B, - 0x42, 0xD7, 0xA4, 0xF1, 0x4E, 0x8F, 0xA5, 0x5C, 0x95, 0xFD, 0xE4, 0x16, 0xDA, 0x8C, 0x96, 0xB6, - 0xAF, 0x71, 0x1A, 0x9E, 0x04, 0x8D, 0x6D, 0x09, 0x3F, 0xDC, 0x5E, 0x94, 0x01, 0xBB, 0x40, 0x05, - 0x00, 0x14, 0x01, 0x62, 0x80, 0x0A, 0x00, 0x28, 0x00, 0xA0, 0x02, 0x80, 0x0A, 0x00, 0xFF, 0x00, - 0x3F, 0x3F, 0xF8, 0x39, 0xF7, 0xFE, 0x53, 0x9F, 0xFF, 0x00, 0x04, 0x87, 0xFF, 0x00, 0xB0, 0x57, - 0xC3, 0xDF, 0xFD, 0x5B, 0xD7, 0x35, 0xD9, 0x96, 0x7F, 0xC8, 0xC3, 0x0F, 0xFE, 0x38, 0x7F, 0xE9, - 0x48, 0xE7, 0xC4, 0xFF, 0x00, 0xBA, 0xD4, 0xFF, 0x00, 0x0B, 0xFC, 0x8F, 0xB5, 0x2B, 0xF5, 0x33, - 0xE3, 0x82, 0x80, 0x0A, 0x00, 0x28, 0x03, 0xF6, 0x0B, 0xFE, 0x08, 0x85, 0xFF, 0x00, 0x22, 0x27, - 0xED, 0xD7, 0xFF, 0x00, 0x67, 0xCF, 0x07, 0xFE, 0xA8, 0x6F, 0x86, 0x55, 0xF9, 0xD7, 0x10, 0x7F, - 0xC8, 0xD2, 0x7E, 0x91, 0xFF, 0x00, 0xD2, 0x51, 0xF5, 0x19, 0x5F, 0xFB, 0x94, 0x7E, 0x7F, 0x99, - 0xFB, 0x6D, 0x5E, 0x29, 0xE8, 0x85, 0x00, 0x14, 0x00, 0x50, 0x01, 0x40, 0x05, 0x00, 0x14, 0x00, - 0x50, 0x01, 0x40, 0x08, 0x7E, 0xE9, 0xFF, 0x00, 0x77, 0xFA, 0x50, 0x04, 0x14, 0x00, 0x50, 0x01, - 0x40, 0x05, 0x00, 0x14, 0x00, 0x50, 0x01, 0x40, 0x05, 0x00, 0x14, 0x00, 0x50, 0x01, 0x40, 0x15, - 0x6F, 0xAF, 0xAC, 0x74, 0xAB, 0x1B, 0xCD, 0x4F, 0x53, 0xBC, 0xB4, 0xD3, 0x74, 0xCD, 0x36, 0xD2, - 0x4B, 0xFD, 0x43, 0x50, 0xBE, 0xB8, 0x4B, 0x3B, 0x0B, 0x0B, 0x78, 0x50, 0xBC, 0xD3, 0x4D, 0x33, - 0x90, 0x91, 0xC6, 0x88, 0x8C, 0xCC, 0xCC, 0x40, 0x00, 0x12, 0x48, 0x02, 0x80, 0x3E, 0x52, 0xD2, - 0xB4, 0xEB, 0xFF, 0x00, 0xDA, 0x92, 0xF7, 0x4C, 0xF1, 0x67, 0x89, 0xAC, 0x6F, 0x74, 0xAF, 0xD9, - 0xBB, 0x4E, 0xB8, 0x83, 0x58, 0xF0, 0x17, 0x81, 0xF5, 0x3B, 0x49, 0xF4, 0xCD, 0x47, 0xE3, 0x9C, - 0x82, 0x24, 0x92, 0xD3, 0xC4, 0x3E, 0x21, 0xB6, 0x32, 0x2B, 0x26, 0x86, 0x3C, 0xD7, 0x36, 0xBA, - 0x4D, 0xD4, 0x01, 0xA7, 0x78, 0xE2, 0xBB, 0xB9, 0x50, 0xA2, 0x08, 0x10, 0x03, 0xEB, 0x7A, 0x00, - 0xF8, 0xA7, 0xF6, 0x56, 0xFF, 0x00, 0x92, 0xE7, 0xFF, 0x00, 0x05, 0x2A, 0xFF, 0x00, 0xB3, 0xD7, - 0xD0, 0x7F, 0xF5, 0x9C, 0x3E, 0x14, 0xD0, 0x07, 0xDA, 0xD4, 0x00, 0x50, 0x01, 0x40, 0x1F, 0x1E, - 0x7E, 0xD8, 0xF1, 0x5C, 0x1D, 0x23, 0xF6, 0x76, 0xB9, 0xD5, 0xE3, 0xD2, 0x24, 0xF8, 0x4D, 0xA6, - 0x7E, 0xD7, 0x3F, 0x0F, 0xB5, 0x3F, 0x8C, 0xC9, 0x7B, 0x0B, 0xCD, 0xAB, 0x47, 0x69, 0x0E, 0xA6, - 0xDF, 0xF0, 0x83, 0xCF, 0xA5, 0xAF, 0xFA, 0x91, 0x2C, 0x3F, 0x10, 0x0F, 0xC3, 0x49, 0xEE, 0x1E, - 0x70, 0x12, 0x3B, 0x08, 0x35, 0x49, 0x14, 0xAC, 0xD1, 0xC2, 0x40, 0x07, 0xD8, 0x60, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0E, 0x00, 0x1F, 0x80, 0xA0, 0x0F, 0x82, 0xBF, 0x6C, - 0x0F, 0xF9, 0x38, 0x4F, 0xF8, 0x25, 0x4F, 0xFD, 0x9F, 0xB7, 0x88, 0xBF, 0xF5, 0x97, 0x3E, 0x30, - 0xD0, 0x07, 0xDE, 0xB4, 0x00, 0x50, 0x01, 0x40, 0x1F, 0x24, 0x7E, 0xDF, 0xBF, 0xF2, 0x61, 0xDF, - 0xB6, 0xC7, 0xFD, 0x9A, 0x2F, 0xC4, 0x9F, 0xFD, 0x43, 0x35, 0x1A, 0x00, 0xFA, 0xE0, 0xF5, 0x34, - 0x00, 0x94, 0x00, 0x50, 0x01, 0x40, 0x05, 0x00, 0x14, 0x00, 0x50, 0x01, 0x40, 0x05, 0x00, 0x14, - 0x00, 0x50, 0x01, 0x40, 0x05, 0x00, 0x14, 0x00, 0x50, 0x01, 0x40, 0x05, 0x00, 0x14, 0x00, 0x50, - 0x01, 0x40, 0x05, 0x00, 0x58, 0xA0, 0x02, 0x80, 0x0A, 0x00, 0x28, 0x00, 0xA0, 0x02, 0x80, 0x3F, - 0xCF, 0xCF, 0xFE, 0x0E, 0x7D, 0xFF, 0x00, 0x94, 0xE7, 0xFF, 0x00, 0xC1, 0x21, 0xFF, 0x00, 0xEC, - 0x15, 0xF0, 0xF7, 0xFF, 0x00, 0x56, 0xF5, 0xCD, 0x76, 0x65, 0x9F, 0xF2, 0x30, 0xC3, 0xFF, 0x00, - 0x8E, 0x1F, 0xFA, 0x52, 0x39, 0xF1, 0x3F, 0xEE, 0xB5, 0x3F, 0xC2, 0xFF, 0x00, 0x23, 0xED, 0x4A, - 0xFD, 0x4C, 0xF8, 0xE0, 0xA0, 0x02, 0x80, 0x0A, 0x00, 0xFD, 0x82, 0xFF, 0x00, 0x82, 0x21, 0x7F, - 0xC8, 0x89, 0xFB, 0x75, 0xFF, 0x00, 0xD9, 0xF3, 0xC1, 0xFF, 0x00, 0xAA, 0x1B, 0xE1, 0x95, 0x7E, - 0x75, 0xC4, 0x1F, 0xF2, 0x34, 0x9F, 0xA4, 0x7F, 0xF4, 0x94, 0x7D, 0x46, 0x57, 0xFE, 0xE5, 0x1F, - 0x9F, 0xE6, 0x7E, 0xDB, 0x57, 0x8A, 0x7A, 0x21, 0x40, 0x05, 0x00, 0x14, 0x00, 0x50, 0x01, 0x40, - 0x05, 0x00, 0x14, 0x00, 0x50, 0x02, 0x1F, 0xBA, 0x7F, 0xDD, 0xFE, 0x94, 0x01, 0xE2, 0xBF, 0x1A, - 0x7E, 0x05, 0x78, 0x27, 0xE3, 0xE7, 0x87, 0xB4, 0xAF, 0x0C, 0x78, 0xE7, 0x5B, 0xF8, 0xC9, 0xA0, - 0xE9, 0xBA, 0x36, 0xB2, 0xBA, 0xED, 0x9D, 0xC7, 0xC1, 0x4F, 0xDA, 0x2F, 0xE2, 0x17, 0xEC, 0xD5, - 0xE2, 0x09, 0x67, 0x5B, 0x79, 0x21, 0x11, 0xDD, 0x6A, 0xDE, 0x10, 0xD6, 0xB4, 0xAB, 0xEB, 0xAB, - 0x6D, 0x97, 0x0E, 0x7E, 0xCD, 0x3C, 0xD2, 0x40, 0x5C, 0x47, 0x21, 0x8F, 0x7C, 0x48, 0xC8, 0x01, - 0xF3, 0x57, 0xFC, 0x3B, 0x6F, 0xF6, 0x78, 0xFF, 0x00, 0xA2, 0x89, 0xFB, 0x7C, 0xFF, 0x00, 0xE2, - 0xD6, 0xFF, 0x00, 0x6A, 0x4F, 0xFE, 0x78, 0x54, 0x00, 0x7F, 0xC3, 0xB6, 0xFF, 0x00, 0x67, 0x8F, - 0xFA, 0x28, 0x9F, 0xB7, 0xCF, 0xFE, 0x2D, 0x6F, 0xF6, 0xA4, 0xFF, 0x00, 0xE7, 0x85, 0x40, 0x07, - 0xFC, 0x3B, 0x6F, 0xF6, 0x78, 0xFF, 0x00, 0xA2, 0x89, 0xFB, 0x7C, 0xFF, 0x00, 0xE2, 0xD6, 0xFF, - 0x00, 0x6A, 0x4F, 0xFE, 0x78, 0x54, 0x00, 0x7F, 0xC3, 0xB6, 0xFF, 0x00, 0x67, 0x8F, 0xFA, 0x28, - 0x9F, 0xB7, 0xCF, 0xFE, 0x2D, 0x6F, 0xF6, 0xA4, 0xFF, 0x00, 0xE7, 0x85, 0x40, 0x07, 0xFC, 0x3B, - 0x6F, 0xF6, 0x78, 0xFF, 0x00, 0xA2, 0x89, 0xFB, 0x7C, 0xFF, 0x00, 0xE2, 0xD6, 0xFF, 0x00, 0x6A, - 0x4F, 0xFE, 0x78, 0x54, 0x00, 0x7F, 0xC3, 0xB6, 0xFF, 0x00, 0x67, 0x8F, 0xFA, 0x28, 0x9F, 0xB7, - 0xCF, 0xFE, 0x2D, 0x6F, 0xF6, 0xA4, 0xFF, 0x00, 0xE7, 0x85, 0x40, 0x07, 0xFC, 0x3B, 0x6F, 0xF6, - 0x78, 0xFF, 0x00, 0xA2, 0x89, 0xFB, 0x7C, 0xFF, 0x00, 0xE2, 0xD6, 0xFF, 0x00, 0x6A, 0x4F, 0xFE, - 0x78, 0x54, 0x00, 0x7F, 0xC3, 0xB6, 0xFF, 0x00, 0x67, 0x8F, 0xFA, 0x28, 0x9F, 0xB7, 0xCF, 0xFE, - 0x2D, 0x6F, 0xF6, 0xA4, 0xFF, 0x00, 0xE7, 0x85, 0x40, 0x07, 0xFC, 0x3B, 0x6F, 0xF6, 0x78, 0xFF, - 0x00, 0xA2, 0x89, 0xFB, 0x7C, 0xFF, 0x00, 0xE2, 0xD6, 0xFF, 0x00, 0x6A, 0x4F, 0xFE, 0x78, 0x54, - 0x00, 0x7F, 0xC3, 0xB6, 0xFF, 0x00, 0x67, 0x8F, 0xFA, 0x28, 0x9F, 0xB7, 0xCF, 0xFE, 0x2D, 0x6F, - 0xF6, 0xA4, 0xFF, 0x00, 0xE7, 0x85, 0x40, 0x1B, 0x5E, 0x1C, 0xFF, 0x00, 0x82, 0x79, 0xFE, 0xCE, - 0x3E, 0x1D, 0xD7, 0x74, 0x8D, 0x76, 0x7D, 0x57, 0xF6, 0xA8, 0xF1, 0xE2, 0x68, 0xD7, 0xB1, 0xEA, - 0x30, 0xF8, 0x53, 0xE3, 0x47, 0xED, 0xF7, 0xF1, 0xEB, 0xE3, 0xE7, 0xC3, 0x2D, 0x4A, 0x68, 0x4E, - 0xEB, 0x76, 0xD5, 0x3C, 0x21, 0xE2, 0x5F, 0x18, 0xEA, 0x1A, 0x1E, 0xA0, 0x22, 0x90, 0x47, 0x34, - 0x6B, 0x77, 0x67, 0x3A, 0xC7, 0x34, 0x50, 0x4C, 0x81, 0x64, 0x86, 0x37, 0x40, 0x0F, 0xB7, 0xA8, - 0x03, 0x9A, 0xF1, 0x9F, 0x8C, 0xBC, 0x25, 0xF0, 0xE7, 0xC1, 0xDE, 0x2B, 0xF8, 0x83, 0xE3, 0xDF, - 0x11, 0xE8, 0x9E, 0x0D, 0xF0, 0x27, 0x80, 0xFC, 0x33, 0x7F, 0xE3, 0x2F, 0x1A, 0x78, 0xBB, 0xC4, - 0x9A, 0x8C, 0x5A, 0x3F, 0x87, 0x3C, 0x29, 0xA4, 0x69, 0x56, 0x8F, 0x73, 0xA9, 0x6A, 0x57, 0xF7, - 0x72, 0x15, 0x8E, 0x0B, 0x68, 0x2D, 0xED, 0xE6, 0x96, 0x49, 0x1C, 0x85, 0x44, 0x46, 0x62, 0x40, - 0x1C, 0x00, 0x70, 0x3F, 0x05, 0x74, 0x3F, 0x0D, 0x1D, 0x03, 0x56, 0xF8, 0xAD, 0xA4, 0xFC, 0x3D, - 0xD7, 0xFE, 0x19, 0xF8, 0x9F, 0xF6, 0x89, 0xBC, 0xD2, 0x7E, 0x34, 0x7C, 0x4C, 0xF0, 0xC7, 0x8B, - 0x24, 0xB8, 0x4F, 0x16, 0x5A, 0xEB, 0x72, 0xF8, 0x4F, 0x47, 0xD2, 0x20, 0x8B, 0x55, 0xB3, 0x79, - 0x5E, 0x2B, 0x3B, 0xCB, 0x7D, 0x27, 0xC3, 0x7A, 0x0D, 0x94, 0xD6, 0xF0, 0x04, 0x8D, 0x5E, 0xC9, - 0xC9, 0x0D, 0x23, 0xC9, 0x24, 0xA0, 0x1E, 0xA1, 0xAD, 0x6B, 0x5A, 0x37, 0x86, 0xB4, 0x6D, 0x5B, - 0xC4, 0x5E, 0x22, 0xD5, 0xB4, 0xBD, 0x03, 0xC3, 0xDA, 0x06, 0x97, 0x3E, 0xB5, 0xAE, 0xEB, 0xBA, - 0xD5, 0xF4, 0x3A, 0x56, 0x8B, 0xA2, 0x59, 0x5A, 0x42, 0xD2, 0xDD, 0x5D, 0xDD, 0xDD, 0x4A, 0xCB, - 0x14, 0x30, 0x45, 0x14, 0x6E, 0xEF, 0x23, 0xB2, 0xAA, 0x2A, 0xB3, 0x12, 0x00, 0x24, 0x00, 0x7C, - 0xC1, 0x1F, 0xC5, 0x8F, 0x8E, 0xDE, 0x25, 0xD0, 0xF5, 0x0F, 0x8A, 0xDF, 0x0F, 0xFE, 0x18, 0xE9, - 0x9A, 0x9F, 0xC3, 0x0B, 0x1D, 0x52, 0xD2, 0xEB, 0xC3, 0x5F, 0x0F, 0xF5, 0x88, 0x26, 0xD2, 0x3E, - 0x36, 0xFC, 0x57, 0xF0, 0xFD, 0xBC, 0x1A, 0x8A, 0x6A, 0xBA, 0xA6, 0x92, 0x67, 0xB9, 0x83, 0x4F, - 0xD3, 0xEE, 0x2E, 0xA4, 0x93, 0xC3, 0xF7, 0x3A, 0x5D, 0xAD, 0xF0, 0x5F, 0x36, 0xDE, 0xDA, 0xE6, - 0x3B, 0xB9, 0x2C, 0x64, 0xD4, 0x91, 0xB4, 0x80, 0x0F, 0xA1, 0x7C, 0x09, 0xE3, 0xBF, 0x08, 0x7C, - 0x4C, 0xF0, 0x9E, 0x91, 0xE3, 0x7F, 0x02, 0x6B, 0xB6, 0x7E, 0x23, 0xF0, 0xBE, 0xB7, 0x1C, 0xBF, - 0x60, 0xD4, 0xEC, 0x83, 0xC5, 0xB6, 0x4B, 0x69, 0xDE, 0x0B, 0xCB, 0x4B, 0x88, 0x24, 0x54, 0x9A, - 0xDE, 0xEA, 0xDE, 0xE6, 0xDE, 0xE2, 0xDE, 0x7B, 0x69, 0x92, 0x39, 0xAD, 0xE7, 0x86, 0x68, 0x65, - 0x8E, 0x39, 0x22, 0x74, 0x50, 0x0E, 0x2B, 0xE3, 0xD7, 0x88, 0x3E, 0x19, 0xE8, 0x5F, 0x0C, 0x75, - 0x2D, 0x3F, 0xE3, 0x17, 0x85, 0x6C, 0x7C, 0x71, 0xF0, 0xDB, 0xE2, 0x47, 0x88, 0xFC, 0x39, 0xF0, - 0x1B, 0xC4, 0xDE, 0x0C, 0xD5, 0xBC, 0x39, 0x67, 0xE2, 0xDF, 0x0F, 0xF8, 0xAA, 0x3F, 0x88, 0xFE, - 0x23, 0xB0, 0xF0, 0xAD, 0xB6, 0x9D, 0xAA, 0xE9, 0x97, 0x5F, 0xE8, 0xD7, 0x3A, 0x74, 0xD7, 0x1E, - 0x25, 0xB6, 0x8E, 0xEA, 0x39, 0x55, 0xD4, 0xDB, 0x35, 0xC6, 0x63, 0x90, 0x7E, 0xED, 0xC0, 0x3D, - 0x88, 0x70, 0x00, 0xF4, 0x00, 0x7E, 0x43, 0xFF, 0x00, 0xAC, 0x28, 0x03, 0xE7, 0x3F, 0x89, 0x3F, - 0xF0, 0xAF, 0x7C, 0x53, 0xF1, 0xEB, 0xF6, 0x6F, 0xF0, 0x4E, 0xBD, 0xE0, 0xBB, 0xCF, 0x15, 0xF8, - 0xEB, 0xC0, 0x7A, 0x97, 0x89, 0x3F, 0x68, 0x9F, 0x03, 0xF8, 0x82, 0x2D, 0x5A, 0x7D, 0x2F, 0x49, - 0xF8, 0x52, 0xFA, 0x77, 0x86, 0xEE, 0xFC, 0x2B, 0x73, 0xAA, 0xDC, 0xA4, 0x52, 0x28, 0xB9, 0xB9, - 0xBB, 0xB4, 0xF8, 0x8F, 0xA8, 0x69, 0xF6, 0xF6, 0x93, 0xC6, 0xF1, 0x3C, 0x77, 0x1A, 0x9D, 0xD0, - 0xDB, 0x2E, 0x9B, 0x19, 0xA0, 0x0F, 0xA3, 0x28, 0x03, 0xC5, 0x3E, 0x30, 0xFC, 0x5E, 0x7F, 0x87, - 0x29, 0xE1, 0xBF, 0x0A, 0xF8, 0x47, 0xC3, 0x32, 0x7C, 0x45, 0xF8, 0xC9, 0xF1, 0x16, 0x6B, 0x9B, - 0x0F, 0x86, 0x1F, 0x0C, 0xAD, 0x75, 0x17, 0xD1, 0x60, 0xD5, 0x8D, 0x92, 0xC4, 0x75, 0x2D, 0x67, - 0x5D, 0xD5, 0x56, 0xDE, 0xE1, 0x74, 0x6F, 0x0F, 0xE9, 0xE9, 0x77, 0x68, 0xF7, 0xDA, 0x9C, 0xB0, - 0x4A, 0x23, 0x37, 0x16, 0x56, 0x76, 0xD0, 0x5E, 0xEA, 0x3A, 0x96, 0x9B, 0xA6, 0xEA, 0x20, 0x1C, - 0x9F, 0x80, 0xFE, 0x27, 0x7C, 0x41, 0xF0, 0x97, 0x8B, 0xB4, 0x7F, 0x83, 0xFF, 0x00, 0xB4, 0x6C, - 0x9E, 0x0C, 0x7F, 0x1A, 0x78, 0x96, 0xD5, 0xA7, 0xF8, 0x69, 0xF1, 0x63, 0xE1, 0xEF, 0x86, 0x75, - 0x3F, 0x06, 0x7C, 0x2C, 0xF8, 0xC7, 0x25, 0xBD, 0xA9, 0x9F, 0x54, 0xD2, 0xA2, 0xD2, 0xAF, 0x2F, - 0x35, 0x07, 0xD0, 0x75, 0xCB, 0x44, 0x49, 0x9D, 0x74, 0xBB, 0x8D, 0x56, 0xFD, 0xAF, 0xEC, 0xA0, - 0x93, 0x51, 0xB3, 0x9E, 0x51, 0x6B, 0xAA, 0xD9, 0xE8, 0x40, 0x1D, 0x5F, 0xED, 0x2B, 0x7F, 0xF0, - 0xD3, 0x4A, 0xFD, 0x9C, 0x7E, 0x3F, 0xEA, 0x7F, 0x19, 0xF4, 0x6D, 0x43, 0xC4, 0x3F, 0x07, 0x74, - 0xDF, 0x82, 0x5E, 0x2B, 0xBF, 0xF8, 0xB1, 0xE1, 0xED, 0x21, 0xE5, 0x8B, 0x55, 0xD7, 0x7C, 0x33, - 0x06, 0x83, 0x74, 0xFA, 0xF5, 0x95, 0xAB, 0x45, 0x34, 0x12, 0x89, 0x65, 0xB1, 0x4B, 0xA8, 0xD0, - 0xA4, 0xF0, 0xB0, 0x66, 0x5D, 0xB2, 0x21, 0xC3, 0x28, 0x07, 0xB6, 0x63, 0x1C, 0x71, 0xC7, 0x1C, - 0x63, 0x1C, 0x7A, 0x7E, 0x54, 0x00, 0x50, 0x01, 0x40, 0x05, 0x00, 0x14, 0x00, 0x50, 0x01, 0x40, - 0x05, 0x00, 0x14, 0x00, 0x50, 0x01, 0x40, 0x05, 0x00, 0x14, 0x00, 0x50, 0x01, 0x40, 0x05, 0x00, - 0x14, 0x00, 0x50, 0x01, 0x40, 0x05, 0x00, 0x14, 0x01, 0x62, 0x80, 0x0A, 0x00, 0x28, 0x00, 0xA0, - 0x02, 0x80, 0x0A, 0x00, 0xFF, 0x00, 0x3F, 0x3F, 0xF8, 0x39, 0xF7, 0xFE, 0x53, 0x9F, 0xFF, 0x00, - 0x04, 0x87, 0xFF, 0x00, 0xB0, 0x57, 0xC3, 0xDF, 0xFD, 0x5B, 0xD7, 0x35, 0xD9, 0x96, 0x7F, 0xC8, - 0xC3, 0x0F, 0xFE, 0x38, 0x7F, 0xE9, 0x48, 0xE7, 0xC4, 0xFF, 0x00, 0xBA, 0xD4, 0xFF, 0x00, 0x0B, - 0xFC, 0x8F, 0xB5, 0x2B, 0xF5, 0x33, 0xE3, 0x82, 0x80, 0x0A, 0x00, 0x28, 0x03, 0xF6, 0x0B, 0xFE, - 0x08, 0x85, 0xFF, 0x00, 0x22, 0x27, 0xED, 0xD7, 0xFF, 0x00, 0x67, 0xCF, 0x07, 0xFE, 0xA8, 0x6F, - 0x86, 0x55, 0xF9, 0xD7, 0x10, 0x7F, 0xC8, 0xD2, 0x7E, 0x91, 0xFF, 0x00, 0xD2, 0x51, 0xF5, 0x19, - 0x5F, 0xFB, 0x94, 0x7E, 0x7F, 0x99, 0xFB, 0x6D, 0x5E, 0x29, 0xE8, 0x85, 0x00, 0x14, 0x00, 0x50, - 0x01, 0x40, 0x05, 0x00, 0x14, 0x00, 0x50, 0x01, 0x40, 0x08, 0x7E, 0xE9, 0xFF, 0x00, 0x77, 0xFA, - 0x50, 0x04, 0x14, 0x00, 0x50, 0x01, 0x40, 0x05, 0x00, 0x14, 0x00, 0x50, 0x01, 0x40, 0x05, 0x00, - 0x14, 0x00, 0x50, 0x01, 0x40, 0x05, 0x00, 0x14, 0x01, 0xF3, 0x07, 0xED, 0x2F, 0xE0, 0x7F, 0x12, - 0x7C, 0x5D, 0xB3, 0xF8, 0x7B, 0xF0, 0x61, 0x7C, 0x3F, 0xA4, 0x5E, 0x7C, 0x20, 0xF1, 0xCF, 0x8B, - 0xA3, 0xD4, 0x7F, 0x68, 0xBD, 0x5F, 0xC4, 0x9A, 0xBD, 0xB5, 0xBF, 0x87, 0xEF, 0xBC, 0x1D, 0xA2, - 0xEC, 0xB9, 0xB8, 0xF0, 0x73, 0x69, 0x44, 0xBC, 0xBA, 0xB1, 0xD7, 0xAF, 0x06, 0x9B, 0xA7, 0xDD, - 0x58, 0xCD, 0x0A, 0xE9, 0xF2, 0xE8, 0xCD, 0xE2, 0x65, 0xBA, 0x9F, 0x79, 0xB4, 0xB0, 0xD5, 0x80, - 0x3E, 0x92, 0x5D, 0x43, 0x4E, 0xF9, 0x55, 0x6F, 0xAC, 0xCF, 0x45, 0x50, 0x2E, 0x90, 0x93, 0xE8, - 0x3A, 0xFD, 0x28, 0x03, 0xC0, 0xB5, 0x8F, 0x87, 0xBE, 0x2D, 0xF8, 0xB3, 0xF1, 0x06, 0x49, 0xBE, - 0x26, 0x5A, 0xC5, 0xA3, 0xFC, 0x1B, 0xF8, 0x7F, 0xAE, 0x5B, 0xDE, 0xF8, 0x1F, 0xE1, 0xED, 0xA6, - 0xAB, 0xF6, 0x99, 0xBE, 0x27, 0xEA, 0xB6, 0x6D, 0x6B, 0x73, 0x69, 0xE2, 0x6F, 0x12, 0x3C, 0x0E, - 0xAA, 0xB6, 0x96, 0x97, 0x31, 0x4E, 0x96, 0x7A, 0x4B, 0x19, 0x63, 0x77, 0x44, 0xBE, 0xB9, 0xDD, - 0x2A, 0xDA, 0xC1, 0xA7, 0x80, 0x7D, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0xE0, 0x01, 0xF8, 0x0A, 0x00, 0xF9, 0xD3, 0xC5, 0x3F, 0x0F, 0x3C, 0x5D, 0xE0, 0x9F, 0x1E, - 0xCD, 0xF1, 0x6F, 0xE0, 0xC5, 0xAC, 0x17, 0xF3, 0xF8, 0xAF, 0x51, 0xB5, 0x4F, 0x8D, 0x5F, 0x0A, - 0xAF, 0x75, 0x6F, 0xEC, 0xBD, 0x1B, 0xE2, 0x44, 0x29, 0x1D, 0xA5, 0xA4, 0x5E, 0x21, 0xD3, 0x26, - 0x94, 0x98, 0x2C, 0x7C, 0x41, 0x61, 0x63, 0x66, 0x12, 0x32, 0x04, 0x30, 0x6A, 0x50, 0xA4, 0x76, - 0x77, 0x8E, 0x86, 0x2B, 0x1B, 0xDD, 0x2C, 0x03, 0xE7, 0x1F, 0xDA, 0x0B, 0xC7, 0xFF, 0x00, 0x11, - 0xBE, 0x3D, 0x78, 0x4F, 0xE1, 0x47, 0x82, 0x7E, 0x16, 0x7E, 0xCB, 0x7F, 0xB4, 0x5E, 0xB3, 0xA7, - 0x6A, 0x1F, 0xB5, 0x07, 0xC2, 0x8F, 0x16, 0xF8, 0xB3, 0xC7, 0x5E, 0x25, 0xD2, 0x7C, 0x29, 0xF0, - 0xA3, 0xC3, 0x9F, 0x0C, 0x34, 0xCF, 0x03, 0x7C, 0x54, 0xF0, 0xA7, 0x88, 0xF5, 0x8B, 0xED, 0x5F, - 0x4D, 0xF1, 0x0E, 0xBD, 0xA7, 0x6B, 0xB7, 0x30, 0xB6, 0x9B, 0xA6, 0xDF, 0x98, 0x4E, 0x95, 0xA6, - 0xEA, 0x45, 0xE4, 0xB7, 0x92, 0x2C, 0x2B, 0x80, 0xA4, 0x03, 0xF4, 0x66, 0x80, 0x3E, 0x70, 0xF8, - 0x43, 0xF0, 0xDF, 0xC4, 0xD0, 0xFC, 0x4D, 0xF8, 0xD5, 0xF1, 0xB7, 0xE2, 0x54, 0x17, 0x49, 0xE3, - 0x0F, 0x1A, 0x78, 0x94, 0xF8, 0x07, 0xE1, 0xC6, 0x91, 0x77, 0xAA, 0xAD, 0xFD, 0xAF, 0xC3, 0xEF, - 0x87, 0xDE, 0x1C, 0x73, 0x0E, 0x91, 0x63, 0x65, 0x04, 0x13, 0x3D, 0x92, 0x3E, 0xA7, 0xA8, 0xB6, - 0xB5, 0xAE, 0xCF, 0x70, 0xB1, 0xAD, 0xEC, 0xA9, 0xAA, 0xE9, 0x96, 0x37, 0x92, 0x32, 0x68, 0x96, - 0x56, 0xF6, 0x00, 0x1E, 0xAD, 0xF1, 0x23, 0x5E, 0xF1, 0x8F, 0x86, 0xBC, 0x19, 0xAB, 0x6A, 0x7F, - 0x0F, 0x3C, 0x0E, 0x3E, 0x22, 0xF8, 0xDF, 0x36, 0xDA, 0x77, 0x86, 0x3C, 0x25, 0x2F, 0x88, 0xAD, - 0x3C, 0x21, 0xA5, 0xDD, 0xDD, 0xDE, 0x5D, 0x47, 0x6F, 0x1D, 0xD6, 0xA7, 0xA9, 0xCF, 0xBB, 0xEC, - 0xDA, 0x6D, 0xA8, 0x9D, 0xAE, 0xEF, 0x24, 0x82, 0x1B, 0xCB, 0xA5, 0xB4, 0xB6, 0xBA, 0x36, 0x96, - 0x57, 0xD7, 0x22, 0x0B, 0x2B, 0x90, 0x0E, 0x2F, 0xE0, 0xEF, 0xC1, 0xA8, 0xFE, 0x1C, 0x37, 0x88, - 0x7C, 0x61, 0xE2, 0xBD, 0x76, 0x3F, 0x88, 0x9F, 0x1B, 0xBE, 0x22, 0x45, 0x69, 0xFF, 0x00, 0x0B, - 0x4F, 0xE2, 0xCD, 0xC6, 0x89, 0x1E, 0x85, 0x73, 0xAF, 0xC5, 0x61, 0x2D, 0xD4, 0xBA, 0x47, 0x87, - 0xF4, 0x8B, 0x11, 0x24, 0xC7, 0x4C, 0xF0, 0xDE, 0x96, 0x75, 0x5D, 0x4E, 0x3D, 0x37, 0x4B, 0x13, - 0xDC, 0x18, 0x05, 0xDD, 0xED, 0xCD, 0xC5, 0xC5, 0xF6, 0xA3, 0xA8, 0xEA, 0x5A, 0x96, 0xA2, 0x01, - 0xDE, 0x78, 0xF7, 0xC0, 0x1E, 0x10, 0xF8, 0x9F, 0xE1, 0x3D, 0x4B, 0xC1, 0x3E, 0x39, 0xD1, 0x62, - 0xD7, 0x3C, 0x39, 0xAA, 0x49, 0x6B, 0x77, 0x25, 0xB7, 0xDA, 0xAE, 0x34, 0xCB, 0xED, 0x3E, 0xF3, - 0x4F, 0xBB, 0x8A, 0xEF, 0x4B, 0xD4, 0xF4, 0xEB, 0xEB, 0x77, 0x8E, 0xEA, 0xC7, 0x50, 0xB3, 0xBD, - 0xB4, 0xB2, 0xBB, 0xB4, 0xBD, 0xB5, 0x96, 0x1B, 0x9B, 0x4B, 0x9B, 0x6B, 0x6B, 0x98, 0x25, 0x8A, - 0x68, 0x23, 0x91, 0x00, 0x3F, 0x3D, 0xFF, 0x00, 0x69, 0xFB, 0x6F, 0xDA, 0xAA, 0x3F, 0xD9, 0x2B, - 0xF6, 0x91, 0xFD, 0x9C, 0x2D, 0x7E, 0x05, 0xFC, 0x4E, 0xFD, 0xAA, 0xFC, 0x61, 0xE3, 0x7F, 0x83, - 0xDA, 0xFF, 0x00, 0xC1, 0xFF, 0x00, 0x86, 0x3F, 0x15, 0xBE, 0x1B, 0xEB, 0xDF, 0x0D, 0x7C, 0x14, - 0xFE, 0x2A, 0xB2, 0xF1, 0x47, 0x85, 0xF5, 0x5B, 0x1D, 0x3B, 0x51, 0xF1, 0x8D, 0xA7, 0x88, 0x3C, - 0x4D, 0xA2, 0xC7, 0x6D, 0xAA, 0xD8, 0x4F, 0x05, 0xB4, 0x7A, 0xA4, 0x9A, 0x7C, 0x0D, 0x6B, 0x75, - 0xF6, 0xEB, 0x0B, 0xDB, 0x0B, 0x68, 0x85, 0xC5, 0xE6, 0x97, 0xA0, 0x80, 0x7E, 0x9D, 0x71, 0xDB, - 0xA7, 0x6E, 0x31, 0xC7, 0x6E, 0x3F, 0x2A, 0x00, 0x4A, 0x00, 0x28, 0x00, 0xA0, 0x02, 0x80, 0x0A, - 0x00, 0x28, 0x00, 0xA0, 0x02, 0x80, 0x0A, 0x00, 0x28, 0x00, 0xA0, 0x02, 0x80, 0x0A, 0x00, 0x28, - 0x00, 0xA0, 0x02, 0x80, 0x0A, 0x00, 0x28, 0x00, 0xA0, 0x02, 0x80, 0x2C, 0x50, 0x01, 0x40, 0x05, - 0x00, 0x14, 0x00, 0x50, 0x01, 0x40, 0x1F, 0xE7, 0xE7, 0xFF, 0x00, 0x07, 0x3E, 0xFF, 0x00, 0xCA, - 0x73, 0xFF, 0x00, 0xE0, 0x90, 0xFF, 0x00, 0xF6, 0x0A, 0xF8, 0x7B, 0xFF, 0x00, 0xAB, 0x7A, 0xE6, - 0xBB, 0x32, 0xCF, 0xF9, 0x18, 0x61, 0xFF, 0x00, 0xC7, 0x0F, 0xFD, 0x29, 0x1C, 0xF8, 0x9F, 0xF7, - 0x5A, 0x9F, 0xE1, 0x7F, 0x91, 0xF6, 0xA5, 0x7E, 0xA6, 0x7C, 0x70, 0x50, 0x01, 0x40, 0x05, 0x00, - 0x7E, 0xC1, 0x7F, 0xC1, 0x10, 0xBF, 0xE4, 0x44, 0xFD, 0xBA, 0xFF, 0x00, 0xEC, 0xF9, 0xE0, 0xFF, - 0x00, 0xD5, 0x0D, 0xF0, 0xCA, 0xBF, 0x3A, 0xE2, 0x0F, 0xF9, 0x1A, 0x4F, 0xD2, 0x3F, 0xFA, 0x4A, - 0x3E, 0xA3, 0x2B, 0xFF, 0x00, 0x72, 0x8F, 0xCF, 0xF3, 0x3F, 0x6D, 0xAB, 0xC5, 0x3D, 0x10, 0xA0, - 0x02, 0x80, 0x0A, 0x00, 0x28, 0x00, 0xA0, 0x02, 0x80, 0x0A, 0x00, 0x28, 0x01, 0x0F, 0xDD, 0x3F, - 0xEE, 0xFF, 0x00, 0x4A, 0x00, 0x82, 0x80, 0x0A, 0x00, 0x28, 0x00, 0xA0, 0x02, 0x80, 0x0A, 0x00, - 0x28, 0x00, 0xA0, 0x02, 0x80, 0x0A, 0x00, 0x28, 0x00, 0xA0, 0x02, 0x80, 0x3C, 0xDF, 0xE2, 0x2F, - 0xC1, 0xAF, 0x84, 0x1F, 0x18, 0x2D, 0xB4, 0xAB, 0x3F, 0x8B, 0x7F, 0x0A, 0x7E, 0x1A, 0xFC, 0x52, - 0xB4, 0xD0, 0xA6, 0x96, 0xE3, 0x44, 0xB5, 0xF8, 0x8D, 0xE0, 0x5D, 0x2F, 0xC6, 0xF6, 0xDA, 0x34, - 0x93, 0xAA, 0xAC, 0xD2, 0x5A, 0x47, 0x7B, 0x04, 0xAB, 0x0B, 0x3A, 0xC5, 0x18, 0x62, 0x81, 0x49, - 0x08, 0xA0, 0xF4, 0x18, 0x00, 0xF3, 0x2B, 0x4F, 0xD8, 0xBF, 0xF6, 0x3B, 0xB0, 0xBA, 0xB5, 0xBE, - 0xB0, 0xFD, 0x93, 0xBF, 0x66, 0x7B, 0x2B, 0xDB, 0x29, 0xE3, 0xBA, 0xB3, 0xBB, 0xB4, 0xF8, 0x0F, - 0xE1, 0x5B, 0x6B, 0xAB, 0x49, 0x62, 0x60, 0xD1, 0xCB, 0x14, 0x8B, 0x62, 0x19, 0x19, 0x59, 0x54, - 0x86, 0x04, 0x10, 0x40, 0x23, 0xA5, 0x00, 0x7D, 0x2B, 0x40, 0x05, 0x00, 0x14, 0x00, 0x50, 0x07, - 0xC9, 0x1F, 0x16, 0xFC, 0x47, 0x77, 0xE3, 0x8F, 0xDA, 0x1F, 0xE0, 0x5F, 0xEC, 0xFF, 0x00, 0xE1, - 0x8F, 0x15, 0xF8, 0x87, 0x4D, 0x8F, 0xC3, 0xAB, 0x2F, 0xED, 0x23, 0xF1, 0xCB, 0x4F, 0xF0, 0x46, - 0xB7, 0x2E, 0x8B, 0x7B, 0x6F, 0xE1, 0xED, 0x1E, 0x47, 0xB5, 0xF0, 0x5E, 0x93, 0xAF, 0xEA, 0x16, - 0x8C, 0x2F, 0x2C, 0x2D, 0x75, 0x6F, 0x12, 0x7F, 0xA4, 0xC1, 0x6D, 0xBE, 0xD9, 0x35, 0x9B, 0x7F, - 0x08, 0xF8, 0x96, 0xCA, 0x46, 0xBA, 0xB1, 0xB7, 0xD5, 0x6C, 0x6E, 0x80, 0x3D, 0xC7, 0xE2, 0x7F, - 0xC4, 0xFF, 0x00, 0x0D, 0xFC, 0x28, 0xF0, 0xE5, 0xBE, 0xB9, 0xAE, 0xC7, 0x7F, 0xA9, 0xEA, 0x1A, - 0xC6, 0xAF, 0x6F, 0xE1, 0x4F, 0x04, 0xF8, 0x37, 0x40, 0x5B, 0x79, 0xFC, 0x5D, 0xF1, 0x0F, 0x5D, - 0xBD, 0x0D, 0xFD, 0x9F, 0xA1, 0x68, 0xB6, 0xF3, 0x4B, 0x0C, 0x2F, 0x75, 0x37, 0x95, 0x2B, 0x6E, - 0x9A, 0x58, 0x2D, 0xE0, 0x86, 0x2B, 0x8B, 0xAB, 0x99, 0xAD, 0xED, 0xAD, 0xA7, 0x9E, 0x10, 0x0E, - 0x03, 0xE1, 0x8F, 0xC2, 0xCD, 0x7A, 0x7F, 0x11, 0xFF, 0x00, 0xC2, 0xE8, 0xF8, 0xD3, 0xFD, 0x8F, - 0xAC, 0x7C, 0x60, 0xD4, 0x34, 0xF7, 0xD3, 0xFC, 0x3D, 0xA3, 0xE9, 0xEA, 0x2F, 0xFC, 0x27, 0xF0, - 0x2F, 0x48, 0x99, 0xDD, 0x8E, 0x83, 0xE1, 0xB7, 0x90, 0x16, 0x37, 0x32, 0x24, 0x90, 0xA6, 0xA5, - 0xAA, 0x28, 0x8A, 0x4D, 0x4E, 0x5B, 0x78, 0x18, 0xC7, 0x05, 0xAD, 0xB5, 0x95, 0x8D, 0x88, 0x07, - 0xD0, 0xB4, 0x00, 0x50, 0x01, 0x40, 0x05, 0x00, 0x14, 0x00, 0x50, 0x01, 0x40, 0x05, 0x00, 0x14, - 0x00, 0x50, 0x01, 0x40, 0x05, 0x00, 0x14, 0x00, 0x50, 0x01, 0x40, 0x05, 0x00, 0x14, 0x00, 0x50, - 0x01, 0x40, 0x05, 0x00, 0x14, 0x00, 0x50, 0x01, 0x40, 0x05, 0x00, 0x58, 0xA0, 0x02, 0x80, 0x0A, - 0x00, 0x28, 0x00, 0xA0, 0x02, 0x80, 0x3F, 0xCF, 0xCF, 0xFE, 0x0E, 0x7D, 0xFF, 0x00, 0x94, 0xE7, - 0xFF, 0x00, 0xC1, 0x21, 0xFF, 0x00, 0xEC, 0x15, 0xF0, 0xF7, 0xFF, 0x00, 0x56, 0xF5, 0xCD, 0x76, - 0x65, 0x9F, 0xF2, 0x30, 0xC3, 0xFF, 0x00, 0x8E, 0x1F, 0xFA, 0x52, 0x39, 0xF1, 0x3F, 0xEE, 0xB5, - 0x3F, 0xC2, 0xFF, 0x00, 0x23, 0xED, 0x4A, 0xFD, 0x4C, 0xF8, 0xE0, 0xA0, 0x02, 0x80, 0x0A, 0x00, - 0xFD, 0x82, 0xFF, 0x00, 0x82, 0x21, 0x7F, 0xC8, 0x89, 0xFB, 0x75, 0xFF, 0x00, 0xD9, 0xF3, 0xC1, - 0xFF, 0x00, 0xAA, 0x1B, 0xE1, 0x95, 0x7E, 0x75, 0xC4, 0x1F, 0xF2, 0x34, 0x9F, 0xA4, 0x7F, 0xF4, - 0x94, 0x7D, 0x46, 0x57, 0xFE, 0xE5, 0x1F, 0x9F, 0xE6, 0x7E, 0xDB, 0x57, 0x8A, 0x7A, 0x21, 0x40, - 0x05, 0x00, 0x14, 0x00, 0x50, 0x01, 0x40, 0x05, 0x00, 0x14, 0x00, 0x50, 0x02, 0x1F, 0xBA, 0x7F, - 0xDD, 0xFE, 0x94, 0x01, 0x05, 0x00, 0x14, 0x00, 0x50, 0x01, 0x40, 0x05, 0x00, 0x14, 0x00, 0x50, - 0x01, 0x40, 0x05, 0x00, 0x14, 0x00, 0x50, 0x01, 0x40, 0x05, 0x00, 0x14, 0x00, 0x50, 0x01, 0x40, - 0x05, 0x00, 0x14, 0x01, 0x8F, 0xE2, 0x19, 0xB5, 0xFB, 0x5F, 0x0F, 0xEB, 0x97, 0x1E, 0x13, 0xD3, - 0x34, 0x6D, 0x6B, 0xC5, 0x36, 0xFA, 0x3D, 0xCC, 0xDE, 0x1A, 0xD1, 0xBC, 0x43, 0xAE, 0x4F, 0xE1, - 0x7F, 0x0F, 0xEA, 0xDA, 0x82, 0x40, 0xC6, 0xCA, 0xD6, 0xFB, 0x53, 0x86, 0xD2, 0xF2, 0x6B, 0x4B, - 0x79, 0x25, 0x11, 0x24, 0x93, 0xC7, 0x69, 0x74, 0xF1, 0x23, 0x33, 0xAC, 0x12, 0x95, 0x11, 0xB0, - 0x07, 0xC5, 0xFE, 0x1E, 0xB4, 0xFD, 0xB2, 0x7C, 0x31, 0xE2, 0x5F, 0x1E, 0xF8, 0xBF, 0x49, 0xFD, - 0x99, 0x3F, 0x64, 0xE8, 0xF5, 0xFF, 0x00, 0x89, 0x5A, 0xB5, 0x8E, 0xB1, 0xE2, 0xAB, 0xD9, 0xFF, - 0x00, 0x6E, 0x6F, 0x1B, 0xDD, 0x0B, 0x99, 0x34, 0xDD, 0x2A, 0xDF, 0x4F, 0xB3, 0x8A, 0x08, 0xDB, - 0xE1, 0x59, 0x58, 0x61, 0x48, 0x2C, 0x90, 0x88, 0xE3, 0x0A, 0xBE, 0x64, 0x93, 0xC8, 0x46, 0xE9, - 0x58, 0x90, 0x0F, 0x7E, 0xF0, 0x0F, 0x82, 0xB5, 0xBD, 0x5F, 0x5E, 0xD2, 0xBE, 0x30, 0x7C, 0x5C, - 0xF0, 0x5F, 0x84, 0xBC, 0x31, 0xF1, 0x9E, 0xD3, 0xC2, 0x37, 0x5F, 0x0F, 0xED, 0xF4, 0xCF, 0x05, - 0x7C, 0x4A, 0xD4, 0xFE, 0x2A, 0x78, 0x2B, 0xC2, 0x5A, 0x4C, 0xDA, 0xA1, 0xB9, 0x9C, 0x68, 0xF7, - 0xF7, 0xBA, 0x46, 0x92, 0xE9, 0x35, 0xFF, 0x00, 0xD9, 0xF4, 0x87, 0xBC, 0x65, 0xD3, 0xE1, 0x2E, - 0x74, 0xFD, 0x3E, 0x26, 0x79, 0x56, 0xCE, 0x27, 0x20, 0x1E, 0xD5, 0x40, 0x05, 0x00, 0x14, 0x00, - 0x50, 0x01, 0x40, 0x05, 0x00, 0x14, 0x00, 0x50, 0x01, 0x40, 0x05, 0x00, 0x14, 0x00, 0x50, 0x01, - 0x40, 0x05, 0x00, 0x14, 0x00, 0x50, 0x01, 0x40, 0x05, 0x00, 0x14, 0x00, 0x50, 0x01, 0x40, 0x05, - 0x00, 0x14, 0x00, 0x50, 0x01, 0x40, 0x16, 0x28, 0x00, 0xA0, 0x02, 0x80, 0x0A, 0x00, 0x28, 0x00, - 0xA0, 0x0F, 0xF3, 0xF3, 0xFF, 0x00, 0x83, 0x9F, 0x7F, 0xE5, 0x39, 0xFF, 0x00, 0xF0, 0x48, 0x7F, - 0xFB, 0x05, 0x7C, 0x3D, 0xFF, 0x00, 0xD5, 0xBD, 0x73, 0x5D, 0x99, 0x67, 0xFC, 0x8C, 0x30, 0xFF, - 0x00, 0xE3, 0x87, 0xFE, 0x94, 0x8E, 0x7C, 0x4F, 0xFB, 0xAD, 0x4F, 0xF0, 0xBF, 0xC8, 0xFB, 0x52, - 0xBF, 0x53, 0x3E, 0x38, 0x28, 0x00, 0xA0, 0x02, 0x80, 0x3F, 0x60, 0xBF, 0xE0, 0x88, 0x5F, 0xF2, - 0x22, 0x7E, 0xDD, 0x7F, 0xF6, 0x7C, 0xF0, 0x7F, 0xEA, 0x86, 0xF8, 0x65, 0x5F, 0x9D, 0x71, 0x07, - 0xFC, 0x8D, 0x27, 0xE9, 0x1F, 0xFD, 0x25, 0x1F, 0x51, 0x95, 0xFF, 0x00, 0xB9, 0x47, 0xE7, 0xF9, - 0x9F, 0xB6, 0xD5, 0xE2, 0x9E, 0x88, 0x50, 0x01, 0x40, 0x05, 0x00, 0x14, 0x00, 0x50, 0x01, 0x40, - 0x05, 0x00, 0x14, 0x00, 0x87, 0xEE, 0x9F, 0xF7, 0x7F, 0xA5, 0x00, 0x41, 0x40, 0x05, 0x00, 0x14, - 0x00, 0x50, 0x01, 0x40, 0x05, 0x00, 0x14, 0x00, 0x50, 0x01, 0x40, 0x05, 0x00, 0x14, 0x00, 0x50, - 0x01, 0x40, 0x05, 0x00, 0x14, 0x00, 0x50, 0x01, 0x40, 0x05, 0x00, 0x14, 0x00, 0x50, 0x01, 0x40, - 0x05, 0x00, 0x14, 0x00, 0x50, 0x01, 0x40, 0x05, 0x00, 0x14, 0x00, 0x50, 0x01, 0x40, 0x05, 0x00, - 0x14, 0x00, 0x50, 0x01, 0x40, 0x05, 0x00, 0x14, 0x00, 0x50, 0x01, 0x40, 0x05, 0x00, 0x14, 0x00, - 0x50, 0x01, 0x40, 0x05, 0x00, 0x14, 0x00, 0x50, 0x01, 0x40, 0x05, 0x00, 0x58, 0xA0, 0x02, 0x80, - 0x0A, 0x00, 0x28, 0x00, 0xA0, 0x02, 0x80, 0x3F, 0xCF, 0xCF, 0xFE, 0x0E, 0x7D, 0xFF, 0x00, 0x94, - 0xE7, 0xFF, 0x00, 0xC1, 0x21, 0xFF, 0x00, 0xEC, 0x15, 0xF0, 0xF7, 0xFF, 0x00, 0x56, 0xF5, 0xCD, - 0x76, 0x65, 0x9F, 0xF2, 0x30, 0xC3, 0xFF, 0x00, 0x8E, 0x1F, 0xFA, 0x52, 0x39, 0xF1, 0x3F, 0xEE, - 0xB5, 0x3F, 0xC2, 0xFF, 0x00, 0x23, 0xED, 0x4A, 0xFD, 0x4C, 0xF8, 0xE0, 0xA0, 0x02, 0x80, 0x0A, - 0x00, 0xFD, 0x82, 0xFF, 0x00, 0x82, 0x21, 0x7F, 0xC8, 0x89, 0xFB, 0x75, 0xFF, 0x00, 0xD9, 0xF3, - 0xC1, 0xFF, 0x00, 0xAA, 0x1B, 0xE1, 0x95, 0x7E, 0x75, 0xC4, 0x1F, 0xF2, 0x34, 0x9F, 0xA4, 0x7F, - 0xF4, 0x94, 0x7D, 0x46, 0x57, 0xFE, 0xE5, 0x1F, 0x9F, 0xE6, 0x7E, 0xDB, 0x57, 0x8A, 0x7A, 0x21, - 0x40, 0x05, 0x00, 0x14, 0x00, 0x50, 0x01, 0x40, 0x05, 0x00, 0x14, 0x00, 0x50, 0x01, 0x81, 0x8C, - 0x63, 0x8C, 0x63, 0x1D, 0x38, 0xC7, 0x4A, 0x00, 0x6E, 0xC5, 0xF4, 0xA0, 0x03, 0x62, 0xFA, 0x50, - 0x01, 0xB1, 0x7D, 0x28, 0x00, 0xD8, 0xBE, 0x94, 0x00, 0x6C, 0x5F, 0x4A, 0x00, 0x36, 0x2F, 0xA5, - 0x00, 0x1B, 0x17, 0xD2, 0x80, 0x0D, 0x8B, 0xE9, 0x40, 0x06, 0xC5, 0xF4, 0xA0, 0x03, 0x62, 0xFA, - 0x50, 0x01, 0xB1, 0x7D, 0x28, 0x00, 0xD8, 0xBE, 0x94, 0x00, 0x6C, 0x5F, 0x4A, 0x00, 0x36, 0x2F, - 0xA5, 0x00, 0x1B, 0x17, 0xD2, 0x80, 0x0D, 0x8B, 0xE9, 0x40, 0x06, 0xC5, 0xF4, 0xA0, 0x03, 0x62, - 0xFA, 0x50, 0x01, 0xB1, 0x7D, 0x28, 0x00, 0xD8, 0xBE, 0x94, 0x00, 0x6C, 0x5F, 0x4A, 0x00, 0x36, - 0x2F, 0xA5, 0x00, 0x1B, 0x17, 0xD2, 0x80, 0x0D, 0x8B, 0xE9, 0x40, 0x06, 0xC5, 0xF4, 0xA0, 0x03, - 0x62, 0xFA, 0x50, 0x01, 0xB1, 0x7D, 0x28, 0x00, 0xD8, 0xBE, 0x94, 0x00, 0x6C, 0x5F, 0x4A, 0x00, - 0x36, 0x2F, 0xA5, 0x00, 0x1B, 0x17, 0xD2, 0x80, 0x0D, 0x8B, 0xE9, 0x40, 0x06, 0xC5, 0xF4, 0xA0, - 0x03, 0x62, 0xFA, 0x50, 0x01, 0xB1, 0x7D, 0x28, 0x00, 0xD8, 0xBE, 0x94, 0x00, 0x6C, 0x5F, 0x4A, - 0x00, 0x36, 0x2F, 0xA5, 0x00, 0x1B, 0x17, 0xD2, 0x80, 0x0D, 0x8B, 0xE9, 0x40, 0x06, 0xC5, 0xF4, - 0xA0, 0x03, 0x62, 0xFA, 0x50, 0x01, 0xB1, 0x7D, 0x28, 0x00, 0xD8, 0xBE, 0x94, 0x00, 0x6C, 0x5F, - 0x4A, 0x00, 0x36, 0x2F, 0xA5, 0x00, 0x3A, 0x80, 0x0A, 0x00, 0x28, 0x00, 0xA0, 0x02, 0x80, 0x0A, - 0x00, 0xFF, 0x00, 0x3F, 0x3F, 0xF8, 0x39, 0xF7, 0xFE, 0x53, 0x9F, 0xFF, 0x00, 0x04, 0x87, 0xFF, - 0x00, 0xB0, 0x57, 0xC3, 0xDF, 0xFD, 0x5B, 0xD7, 0x35, 0xD9, 0x96, 0x7F, 0xC8, 0xC3, 0x0F, 0xFE, - 0x38, 0x7F, 0xE9, 0x48, 0xE7, 0xC4, 0xFF, 0x00, 0xBA, 0xD4, 0xFF, 0x00, 0x0B, 0xFC, 0x8F, 0xB5, - 0x2B, 0xF5, 0x33, 0xE3, 0x82, 0x80, 0x0A, 0x00, 0x28, 0x03, 0xF6, 0x0B, 0xFE, 0x08, 0x85, 0xFF, - 0x00, 0x22, 0x27, 0xED, 0xD7, 0xFF, 0x00, 0x67, 0xCF, 0x07, 0xFE, 0xA8, 0x6F, 0x86, 0x55, 0xF9, - 0xD7, 0x10, 0x7F, 0xC8, 0xD2, 0x7E, 0x91, 0xFF, 0x00, 0xD2, 0x51, 0xF5, 0x19, 0x5F, 0xFB, 0x94, - 0x7E, 0x7F, 0x99, 0xFB, 0x6D, 0x5E, 0x29, 0xE8, 0x85, 0x00, 0x14, 0x00, 0x50, 0x01, 0x40, 0x05, - 0x00, 0x14, 0x00, 0x50, 0x01, 0x40, 0x05, 0x00, 0x14, 0x00, 0x50, 0x01, 0x40, 0x05, 0x00, 0x14, - 0x00, 0x50, 0x01, 0x40, 0x05, 0x00, 0x14, 0x00, 0x50, 0x01, 0x40, 0x05, 0x00, 0x14, 0x00, 0x50, - 0x01, 0x40, 0x05, 0x00, 0x14, 0x00, 0x50, 0x01, 0x40, 0x05, 0x00, 0x14, 0x00, 0x50, 0x01, 0x40, - 0x05, 0x00, 0x14, 0x00, 0x50, 0x01, 0x40, 0x05, 0x00, 0x14, 0x00, 0x50, 0x01, 0x40, 0x05, 0x00, - 0x14, 0x00, 0x50, 0x01, 0x40, 0x05, 0x00, 0x14, 0x00, 0x50, 0x01, 0x40, 0x05, 0x00, 0x14, 0x00, - 0x50, 0x01, 0x40, 0x05, 0x00, 0x14, 0x00, 0x50, 0x01, 0x40, 0x05, 0x00, 0x14, 0x00, 0x50, 0x01, - 0x40, 0x05, 0x00, 0x7F, 0x9F, 0x9F, 0xFC, 0x1C, 0xFB, 0xFF, 0x00, 0x29, 0xCF, 0xFF, 0x00, 0x82, - 0x43, 0xFF, 0x00, 0xD8, 0x2B, 0xE1, 0xEF, 0xFE, 0xAD, 0xEB, 0x9A, 0xEC, 0xCB, 0x3F, 0xE4, 0x61, - 0x87, 0xFF, 0x00, 0x1C, 0x3F, 0xF4, 0xA4, 0x73, 0xE2, 0x7F, 0xDD, 0x6A, 0x7F, 0x85, 0xFE, 0x47, - 0xDA, 0x95, 0xFA, 0x99, 0xF1, 0xC1, 0x40, 0x05, 0x00, 0x14, 0x01, 0xFB, 0x05, 0xFF, 0x00, 0x04, - 0x42, 0xFF, 0x00, 0x91, 0x13, 0xF6, 0xEB, 0xFF, 0x00, 0xB3, 0xE7, 0x83, 0xFF, 0x00, 0x54, 0x37, - 0xC3, 0x2A, 0xFC, 0xEB, 0x88, 0x3F, 0xE4, 0x69, 0x3F, 0x48, 0xFF, 0x00, 0xE9, 0x28, 0xFA, 0x8C, - 0xAF, 0xFD, 0xCA, 0x3F, 0x3F, 0xCC, 0xFD, 0xB6, 0xAF, 0x14, 0xF4, 0x42, 0x80, 0x0A, 0x00, 0x28, - 0x00, 0xA0, 0x02, 0x80, 0x0A, 0x00, 0x28, 0x00, 0xA0, 0x02, 0x80, 0x0A, 0x00, 0x28, 0x00, 0xA0, - 0x02, 0x80, 0x0A, 0x00, 0x28, 0x00, 0xA0, 0x02, 0x80, 0x0A, 0x00, 0x28, 0x00, 0xA0, 0x02, 0x80, - 0x0A, 0x00, 0x28, 0x00, 0xA0, 0x02, 0x80, 0x0A, 0x00, 0x28, 0x00, 0xA0, 0x02, 0x80, 0x0A, 0x00, - 0x28, 0x00, 0xA0, 0x02, 0x80, 0x0A, 0x00, 0x28, 0x00, 0xA0, 0x02, 0x80, 0x0A, 0x00, 0x28, 0x00, - 0xA0, 0x02, 0x80, 0x0A, 0x00, 0x28, 0x00, 0xA0, 0x02, 0x80, 0x0A, 0x00, 0x28, 0x00, 0xA0, 0x02, - 0x80, 0x0A, 0x00, 0x28, 0x00, 0xA0, 0x02, 0x80, 0x0A, 0x00, 0x28, 0x00, 0xA0, 0x02, 0x80, 0x0A, - 0x00, 0x28, 0x00, 0xA0, 0x02, 0x80, 0x3F, 0xCF, 0xCF, 0xFE, 0x0E, 0x7D, 0xFF, 0x00, 0x94, 0xE7, - 0xFF, 0x00, 0xC1, 0x21, 0xFF, 0x00, 0xEC, 0x15, 0xF0, 0xF7, 0xFF, 0x00, 0x56, 0xF5, 0xCD, 0x76, - 0x65, 0x9F, 0xF2, 0x30, 0xC3, 0xFF, 0x00, 0x8E, 0x1F, 0xFA, 0x52, 0x39, 0xF1, 0x3F, 0xEE, 0xB5, - 0x3F, 0xC2, 0xFF, 0x00, 0x23, 0xED, 0x4A, 0xFD, 0x4C, 0xF8, 0xE0, 0xA0, 0x02, 0x80, 0x0A, 0x00, - 0xFD, 0x82, 0xFF, 0x00, 0x82, 0x21, 0x7F, 0xC8, 0x89, 0xFB, 0x75, 0xFF, 0x00, 0xD9, 0xF3, 0xC1, - 0xFF, 0x00, 0xAA, 0x1B, 0xE1, 0x95, 0x7E, 0x75, 0xC4, 0x1F, 0xF2, 0x34, 0x9F, 0xA4, 0x7F, 0xF4, - 0x94, 0x7D, 0x46, 0x57, 0xFE, 0xE5, 0x1F, 0x9F, 0xE6, 0x7E, 0xDB, 0x57, 0x8A, 0x7A, 0x21, 0x40, - 0x05, 0x00, 0x14, 0x00, 0x50, 0x01, 0x40, 0x05, 0x00, 0x14, 0x00, 0x50, 0x01, 0x40, 0x05, 0x00, - 0x14, 0x00, 0x50, 0x01, 0x40, 0x05, 0x00, 0x14, 0x00, 0x50, 0x01, 0x40, 0x05, 0x00, 0x14, 0x00, - 0x50, 0x01, 0x40, 0x05, 0x00, 0x14, 0x00, 0x50, 0x01, 0x40, 0x05, 0x00, 0x14, 0x00, 0x50, 0x01, - 0x40, 0x05, 0x00, 0x14, 0x00, 0x50, 0x01, 0x40, 0x05, 0x00, 0x14, 0x00, 0x50, 0x01, 0x40, 0x05, - 0x00, 0x14, 0x00, 0x50, 0x01, 0x40, 0x05, 0x00, 0x14, 0x00, 0x50, 0x01, 0x40, 0x05, 0x00, 0x14, - 0x00, 0x50, 0x01, 0x40, 0x05, 0x00, 0x14, 0x00, 0x50, 0x01, 0x40, 0x05, 0x00, 0x14, 0x00, 0x50, - 0x01, 0x40, 0x05, 0x00, 0x14, 0x00, 0x50, 0x01, 0x40, 0x1F, 0xE7, 0xE7, 0xFF, 0x00, 0x07, 0x3E, - 0xFF, 0x00, 0xCA, 0x73, 0xFF, 0x00, 0xE0, 0x90, 0xFF, 0x00, 0xF6, 0x0A, 0xF8, 0x7B, 0xFF, 0x00, - 0xAB, 0x7A, 0xE6, 0xBB, 0x32, 0xCF, 0xF9, 0x18, 0x61, 0xFF, 0x00, 0xC7, 0x0F, 0xFD, 0x29, 0x1C, - 0xF8, 0x9F, 0xF7, 0x5A, 0x9F, 0xE1, 0x7F, 0x91, 0xF6, 0xA5, 0x7E, 0xA6, 0x7C, 0x70, 0x50, 0x01, - 0x40, 0x05, 0x00, 0x7E, 0xC1, 0x7F, 0xC1, 0x10, 0xBF, 0xE4, 0x44, 0xFD, 0xBA, 0xFF, 0x00, 0xEC, - 0xF9, 0xE0, 0xFF, 0x00, 0xD5, 0x0D, 0xF0, 0xCA, 0xBF, 0x3A, 0xE2, 0x0F, 0xF9, 0x1A, 0x4F, 0xD2, - 0x3F, 0xFA, 0x4A, 0x3E, 0xA3, 0x2B, 0xFF, 0x00, 0x72, 0x8F, 0xCF, 0xF3, 0x3F, 0x6D, 0xAB, 0xC5, - 0x3D, 0x10, 0xA0, 0x02, 0x80, 0x0A, 0x00, 0x28, 0x00, 0xA0, 0x02, 0x80, 0x0A, 0x00, 0x28, 0x00, - 0xA0, 0x02, 0x80, 0x0A, 0x00, 0x28, 0x00, 0xA0, 0x02, 0x80, 0x0A, 0x00, 0x28, 0x00, 0xA0, 0x02, - 0x80, 0x0A, 0x00, 0x28, 0x00, 0xA0, 0x02, 0x80, 0x0A, 0x00, 0x28, 0x00, 0xA0, 0x02, 0x80, 0x0A, - 0x00, 0x28, 0x00, 0xA0, 0x02, 0x80, 0x0A, 0x00, 0x28, 0x00, 0xA0, 0x02, 0x80, 0x0A, 0x00, 0x28, - 0x00, 0xA0, 0x02, 0x80, 0x0A, 0x00, 0x28, 0x00, 0xA0, 0x02, 0x80, 0x0A, 0x00, 0x28, 0x00, 0xA0, - 0x02, 0x80, 0x0A, 0x00, 0x28, 0x00, 0xA0, 0x02, 0x80, 0x0A, 0x00, 0x28, 0x00, 0xA0, 0x02, 0x80, - 0x0A, 0x00, 0x28, 0x00, 0xA0, 0x02, 0x80, 0x0A, 0x00, 0x28, 0x00, 0xA0, 0x0F, 0xF3, 0xF3, 0xFF, - 0x00, 0x83, 0x9F, 0x7F, 0xE5, 0x39, 0xFF, 0x00, 0xF0, 0x48, 0x7F, 0xFB, 0x05, 0x7C, 0x3D, 0xFF, - 0x00, 0xD5, 0xBD, 0x73, 0x5D, 0x99, 0x67, 0xFC, 0x8C, 0x30, 0xFF, 0x00, 0xE3, 0x87, 0xFE, 0x94, - 0x8E, 0x7C, 0x4F, 0xFB, 0xAD, 0x4F, 0xF0, 0xBF, 0xC8, 0xFB, 0x52, 0xBF, 0x53, 0x3E, 0x38, 0x28, - 0x00, 0xA0, 0x02, 0x80, 0x3F, 0x60, 0xBF, 0xE0, 0x88, 0x5F, 0xF2, 0x22, 0x7E, 0xDD, 0x7F, 0xF6, - 0x7C, 0xF0, 0x7F, 0xEA, 0x86, 0xF8, 0x65, 0x5F, 0x9D, 0x71, 0x07, 0xFC, 0x8D, 0x27, 0xE9, 0x1F, - 0xFD, 0x25, 0x1F, 0x51, 0x95, 0xFF, 0x00, 0xB9, 0x47, 0xE7, 0xF9, 0x9F, 0xB6, 0xD5, 0xE2, 0x9E, - 0x88, 0x50, 0x01, 0x40, 0x05, 0x00, 0x14, 0x00, 0x50, 0x01, 0x40, 0x05, 0x00, 0x14, 0x00, 0x50, - 0x01, 0x40, 0x05, 0x00, 0x14, 0x00, 0x50, 0x01, 0x40, 0x05, 0x00, 0x14, 0x00, 0x50, 0x01, 0x40, - 0x05, 0x00, 0x14, 0x00, 0x50, 0x01, 0x40, 0x05, 0x00, 0x14, 0x00, 0x50, 0x01, 0x40, 0x05, 0x00, - 0x14, 0x00, 0x50, 0x01, 0x40, 0x05, 0x00, 0x14, 0x00, 0x50, 0x01, 0x40, 0x05, 0x00, 0x14, 0x00, - 0x50, 0x01, 0x40, 0x05, 0x00, 0x14, 0x00, 0x50, 0x01, 0x40, 0x05, 0x00, 0x14, 0x00, 0x50, 0x01, - 0x40, 0x05, 0x00, 0x14, 0x00, 0x50, 0x01, 0x40, 0x05, 0x00, 0x14, 0x00, 0x50, 0x01, 0x40, 0x05, - 0x00, 0x14, 0x00, 0x50, 0x01, 0x40, 0x05, 0x00, 0x14, 0x00, 0x50, 0x07, 0xF9, 0xF9, 0xFF, 0x00, - 0xC1, 0xCF, 0xBF, 0xF2, 0x9C, 0xFF, 0x00, 0xF8, 0x24, 0x3F, 0xFD, 0x82, 0xBE, 0x1E, 0xFF, 0x00, - 0xEA, 0xDE, 0xB9, 0xAE, 0xCC, 0xB3, 0xFE, 0x46, 0x18, 0x7F, 0xF1, 0xC3, 0xFF, 0x00, 0x4A, 0x47, - 0x3E, 0x27, 0xFD, 0xD6, 0xA7, 0xF8, 0x5F, 0xE4, 0x7D, 0xA9, 0x5F, 0xA9, 0x9F, 0x1C, 0x14, 0x00, - 0x50, 0x01, 0x40, 0x1F, 0xB0, 0x5F, 0xF0, 0x44, 0x2F, 0xF9, 0x11, 0x3F, 0x6E, 0xBF, 0xFB, 0x3E, - 0x78, 0x3F, 0xF5, 0x43, 0x7C, 0x32, 0xAF, 0xCE, 0xB8, 0x83, 0xFE, 0x46, 0x93, 0xF4, 0x8F, 0xFE, - 0x92, 0x8F, 0xA8, 0xCA, 0xFF, 0x00, 0xDC, 0xA3, 0xF3, 0xFC, 0xCF, 0xDB, 0x6A, 0xF1, 0x4F, 0x44, - 0x28, 0x00, 0xA0, 0x02, 0x80, 0x0A, 0x00, 0x28, 0x00, 0xA0, 0x02, 0x80, 0x0A, 0x00, 0x28, 0x00, - 0xA0, 0x02, 0x80, 0x0A, 0x00, 0x28, 0x00, 0xA0, 0x02, 0x80, 0x0A, 0x00, 0x28, 0x00, 0xA0, 0x02, - 0x80, 0x0A, 0x00, 0x28, 0x00, 0xA0, 0x02, 0x80, 0x0A, 0x00, 0x28, 0x00, 0xA0, 0x02, 0x80, 0x0A, - 0x00, 0x28, 0x00, 0xA0, 0x02, 0x80, 0x0A, 0x00, 0x28, 0x00, 0xA0, 0x02, 0x80, 0x0A, 0x00, 0x28, - 0x00, 0xA0, 0x02, 0x80, 0x0A, 0x00, 0x28, 0x00, 0xA0, 0x02, 0x80, 0x0A, 0x00, 0x28, 0x00, 0xA0, - 0x02, 0x80, 0x0A, 0x00, 0x28, 0x00, 0xA0, 0x02, 0x80, 0x0A, 0x00, 0x28, 0x00, 0xA0, 0x02, 0x80, - 0x0A, 0x00, 0x28, 0x00, 0xA0, 0x02, 0x80, 0x0A, 0x00, 0x28, 0x03, 0xFC, 0xFC, 0xFF, 0x00, 0xE0, - 0xE7, 0xDF, 0xF9, 0x4E, 0x7F, 0xFC, 0x12, 0x1F, 0xFE, 0xC1, 0x5F, 0x0F, 0x7F, 0xF5, 0x6F, 0x5C, - 0xD7, 0x66, 0x59, 0xFF, 0x00, 0x23, 0x0C, 0x3F, 0xF8, 0xE1, 0xFF, 0x00, 0xA5, 0x23, 0x9F, 0x13, - 0xFE, 0xEB, 0x53, 0xFC, 0x2F, 0xF2, 0x3E, 0xD4, 0xAF, 0xD4, 0xCF, 0x8E, 0x0A, 0x00, 0x28, 0x00, - 0xA0, 0x0F, 0xD8, 0x2F, 0xF8, 0x22, 0x17, 0xFC, 0x88, 0x9F, 0xB7, 0x5F, 0xFD, 0x9F, 0x3C, 0x1F, - 0xFA, 0xA1, 0xBE, 0x19, 0x57, 0xE7, 0x5C, 0x41, 0xFF, 0x00, 0x23, 0x49, 0xFA, 0x47, 0xFF, 0x00, - 0x49, 0x47, 0xD4, 0x65, 0x7F, 0xEE, 0x51, 0xF9, 0xFE, 0x67, 0xED, 0xB5, 0x78, 0xA7, 0xA2, 0x14, - 0x00, 0x50, 0x01, 0x40, 0x05, 0x00, 0x14, 0x00, 0x50, 0x01, 0x40, 0x05, 0x00, 0x14, 0x00, 0x50, - 0x01, 0x40, 0x05, 0x00, 0x14, 0x00, 0x50, 0x01, 0x40, 0x05, 0x00, 0x14, 0x00, 0x50, 0x01, 0x40, - 0x05, 0x00, 0x14, 0x00, 0x50, 0x01, 0x40, 0x05, 0x00, 0x14, 0x00, 0x50, 0x01, 0x40, 0x05, 0x00, - 0x14, 0x00, 0x50, 0x01, 0x40, 0x05, 0x00, 0x14, 0x00, 0x50, 0x01, 0x40, 0x05, 0x00, 0x14, 0x00, - 0x50, 0x01, 0x40, 0x05, 0x00, 0x14, 0x00, 0x50, 0x01, 0x40, 0x05, 0x00, 0x14, 0x00, 0x50, 0x01, - 0x40, 0x05, 0x00, 0x14, 0x00, 0x50, 0x01, 0x40, 0x05, 0x00, 0x14, 0x00, 0x50, 0x01, 0x40, 0x05, - 0x00, 0x14, 0x00, 0x50, 0x01, 0x40, 0x05, 0x00, 0x14, 0x01, 0xFE, 0x7E, 0x7F, 0xF0, 0x73, 0xEF, - 0xFC, 0xA7, 0x3F, 0xFE, 0x09, 0x0F, 0xFF, 0x00, 0x60, 0xAF, 0x87, 0xBF, 0xFA, 0xB7, 0xAE, 0x6B, - 0xB3, 0x2C, 0xFF, 0x00, 0x91, 0x86, 0x1F, 0xFC, 0x70, 0xFF, 0x00, 0xD2, 0x91, 0xCF, 0x89, 0xFF, - 0x00, 0x75, 0xA9, 0xFE, 0x17, 0xF9, 0x1F, 0x6A, 0x57, 0xEA, 0x67, 0xC7, 0x05, 0x00, 0x14, 0x00, - 0x50, 0x07, 0xEC, 0x0F, 0xFC, 0x11, 0x0F, 0x8F, 0x01, 0xFE, 0xDD, 0x98, 0x03, 0x8F, 0xDB, 0x9E, - 0x1C, 0x0C, 0x71, 0xC7, 0xC0, 0x6F, 0x86, 0x58, 0x18, 0xFC, 0x05, 0x7E, 0x75, 0xC4, 0x1F, 0xF2, - 0x34, 0x9F, 0xA4, 0x7F, 0xF4, 0x94, 0x7D, 0x46, 0x57, 0xFE, 0xE5, 0x1F, 0x9F, 0xE6, 0x7E, 0xD2, - 0xEA, 0x1A, 0xA5, 0x86, 0x91, 0x65, 0x3E, 0xA3, 0xA9, 0xDD, 0xDA, 0xE9, 0xF6, 0x16, 0x91, 0x99, - 0x6E, 0x2E, 0xEE, 0xE5, 0x58, 0x2D, 0xE1, 0x50, 0x3A, 0x96, 0x38, 0x1D, 0xBA, 0x0F, 0xC2, 0xBC, - 0x68, 0xC5, 0xC9, 0xA8, 0xC5, 0x6B, 0xD1, 0x23, 0xBD, 0xB8, 0xC2, 0x37, 0x6E, 0xC8, 0xF3, 0xBD, - 0x3F, 0xE3, 0x1F, 0x82, 0xF5, 0x52, 0x4E, 0x9B, 0x79, 0x2C, 0xD6, 0xA8, 0x8C, 0xEF, 0xA8, 0x4D, - 0x6A, 0xF6, 0x9A, 0x64, 0x4A, 0xA3, 0xAB, 0xCC, 0xD8, 0x0A, 0x0E, 0x30, 0x33, 0x8C, 0xF1, 0x5B, - 0xAC, 0x25, 0x7D, 0x23, 0x18, 0xDD, 0xBD, 0x12, 0x5A, 0xBF, 0x44, 0x96, 0xBF, 0x77, 0xF9, 0x1C, - 0xEB, 0x15, 0x41, 0x26, 0xEF, 0x68, 0xA5, 0xBB, 0xD1, 0x76, 0xFE, 0xBA, 0x1A, 0xDF, 0xF0, 0xB2, - 0x7C, 0x2E, 0x93, 0xC3, 0x6C, 0xD7, 0xF0, 0xBB, 0x39, 0x09, 0x24, 0x96, 0xA4, 0x5C, 0xDA, 0xD9, - 0x64, 0x70, 0x67, 0x90, 0x7C, 0xB1, 0x83, 0x85, 0x00, 0x1E, 0x49, 0x2A, 0x00, 0xE6, 0xB3, 0x95, - 0x1A, 0x94, 0xE0, 0xE5, 0x52, 0x2E, 0x29, 0x2E, 0xAA, 0xDF, 0x72, 0x7F, 0xA6, 0x9A, 0x1A, 0xD2, - 0xAB, 0x4E, 0xB4, 0xE3, 0x4E, 0x8B, 0xBB, 0x6D, 0x24, 0x97, 0x77, 0xA2, 0x5F, 0x96, 0x9E, 0x87, - 0x87, 0xFC, 0x10, 0xFD, 0xAD, 0x3C, 0x27, 0xF1, 0xFB, 0xE2, 0xD7, 0xC6, 0x6F, 0x86, 0xBE, 0x03, - 0xF0, 0xBF, 0x89, 0x1B, 0x44, 0xF8, 0x29, 0x06, 0x95, 0x69, 0xAD, 0xFC, 0x42, 0xD4, 0x52, 0x1B, - 0x6F, 0x0F, 0xEB, 0x5A, 0x9E, 0xA4, 0xF7, 0x3B, 0xB4, 0xEB, 0x18, 0x55, 0x9A, 0x43, 0xE5, 0x43, - 0x69, 0x1C, 0x85, 0xDF, 0x69, 0x22, 0x55, 0x1B, 0x14, 0x05, 0x2F, 0xF3, 0xF9, 0x4E, 0x77, 0x4B, - 0x37, 0xC5, 0x62, 0xA8, 0xE1, 0x69, 0xB5, 0x4A, 0x83, 0x8C, 0x1C, 0xDD, 0x92, 0x94, 0xDA, 0x72, - 0x6A, 0x29, 0x74, 0x84, 0x79, 0x5B, 0x6E, 0xD7, 0xE6, 0x49, 0x2B, 0x2B, 0x9F, 0xA0, 0x71, 0x7F, - 0x01, 0xE2, 0xF8, 0x27, 0x2A, 0xCA, 0x31, 0x39, 0xAE, 0x22, 0x0F, 0x17, 0x8E, 0xA7, 0x52, 0xB2, - 0xA1, 0x04, 0xDB, 0xA3, 0x46, 0x32, 0x8C, 0x29, 0xCE, 0xAC, 0x9D, 0x92, 0x95, 0x69, 0xAA, 0xAA, - 0x10, 0x8A, 0x92, 0x51, 0xA5, 0x26, 0xE7, 0x76, 0xA2, 0xBE, 0xAC, 0x0C, 0x78, 0x18, 0x00, 0x70, - 0x38, 0x18, 0xC0, 0xF6, 0xAF, 0x70, 0xF8, 0x42, 0x4A, 0x00, 0x28, 0x00, 0xA0, 0x02, 0x80, 0x0A, - 0x00, 0x28, 0x00, 0xA0, 0x02, 0x80, 0x0A, 0x00, 0x28, 0x00, 0xA0, 0x02, 0x80, 0x0A, 0x00, 0x28, - 0x00, 0xA0, 0x02, 0x80, 0x0A, 0x00, 0x28, 0x00, 0xA0, 0x02, 0x80, 0x0A, 0x00, 0x28, 0x00, 0xA0, - 0x02, 0x80, 0x0A, 0x00, 0x28, 0x00, 0xA0, 0x02, 0x80, 0x0A, 0x00, 0x28, 0x00, 0xA0, 0x02, 0x80, - 0x0A, 0x00, 0x28, 0x00, 0xA0, 0x02, 0x80, 0x0A, 0x00, 0x28, 0x00, 0xA0, 0x02, 0x80, 0x0A, 0x00, - 0x28, 0x00, 0xA0, 0x02, 0x80, 0x0A, 0x00, 0x28, 0x00, 0xA0, 0x02, 0x80, 0x0A, 0x00, 0x28, 0x00, - 0xA0, 0x02, 0x80, 0x0A, 0x00, 0x28, 0x00, 0xA0, 0x02, 0x80, 0x0A, 0x00, 0xFF, 0x00, 0x3F, 0x3F, - 0xF8, 0x39, 0xF7, 0xFE, 0x53, 0x9F, 0xFF, 0x00, 0x04, 0x87, 0xFF, 0x00, 0xB0, 0x57, 0xC3, 0xDF, - 0xFD, 0x5B, 0xD7, 0x35, 0xD9, 0x96, 0x7F, 0xC8, 0xC3, 0x0F, 0xFE, 0x38, 0x7F, 0xE9, 0x48, 0xE7, - 0xC4, 0xFF, 0x00, 0xBA, 0xD4, 0xFF, 0x00, 0x0B, 0xFC, 0x8F, 0xB5, 0x2B, 0xF5, 0x33, 0xE3, 0x82, - 0x80, 0x0A, 0x00, 0x28, 0x03, 0xF6, 0x07, 0xFE, 0x08, 0x88, 0x3F, 0xE2, 0x83, 0xFD, 0xBB, 0x00, - 0x1F, 0xF3, 0x7C, 0xD0, 0x80, 0x00, 0xFF, 0x00, 0xAA, 0x0D, 0xF0, 0xCB, 0x00, 0x0F, 0xCA, 0xBF, - 0x3A, 0xE2, 0x0F, 0xF9, 0x1A, 0x4F, 0xD2, 0x3F, 0xFA, 0x4A, 0x3E, 0xA3, 0x2B, 0xFF, 0x00, 0x72, - 0x8F, 0xCF, 0xF3, 0x3E, 0x97, 0xFD, 0xA5, 0x7E, 0x2D, 0x34, 0xDE, 0x21, 0xB9, 0xD1, 0x61, 0x96, - 0x39, 0x74, 0xAD, 0x06, 0xFB, 0xFB, 0x1B, 0x4A, 0xD3, 0x64, 0x6C, 0xD9, 0x6A, 0x5A, 0x8A, 0x45, - 0xBA, 0xEA, 0xE6, 0xE2, 0x3E, 0x03, 0xA4, 0x0A, 0xCA, 0x02, 0x9E, 0x09, 0x64, 0x07, 0x86, 0x61, - 0x5E, 0xE7, 0x09, 0x64, 0x51, 0xCC, 0x6B, 0x27, 0x51, 0xDA, 0x9A, 0x4A, 0x52, 0xB6, 0x8E, 0xD7, - 0xB2, 0x8A, 0x7D, 0x39, 0xAC, 0xEE, 0xD5, 0xAC, 0x93, 0xD9, 0xD9, 0x9F, 0x39, 0xC5, 0x19, 0xC5, - 0x5C, 0xBF, 0x0C, 0xFD, 0x84, 0x53, 0x9B, 0xD2, 0x2B, 0xA5, 0xEC, 0xAF, 0x26, 0xBA, 0xF2, 0xDD, - 0x24, 0xB6, 0x6D, 0xAD, 0x2D, 0x73, 0xE7, 0x18, 0xFE, 0x21, 0xF8, 0x9F, 0xC1, 0xDA, 0x2D, 0xFE, - 0xBB, 0x67, 0xE2, 0x6D, 0x59, 0xAD, 0xAC, 0xE5, 0x8E, 0xEF, 0x56, 0x94, 0xA2, 0x6A, 0x16, 0x2A, - 0xF2, 0x0D, 0x89, 0xE7, 0x40, 0x57, 0x6E, 0xCF, 0x9B, 0x6A, 0xA7, 0xCA, 0xA0, 0xE0, 0x28, 0x1C, - 0x63, 0xF4, 0x4C, 0x5E, 0x55, 0x93, 0x4E, 0x2A, 0x18, 0xBA, 0x10, 0x8C, 0x23, 0x16, 0xA3, 0xBC, - 0x5A, 0x4A, 0xCF, 0xDD, 0x6B, 0x54, 0xF4, 0x57, 0x69, 0x37, 0x6F, 0x2D, 0x0F, 0x81, 0xCA, 0xF1, - 0x79, 0xCA, 0xA9, 0x7A, 0x35, 0xE6, 0xE5, 0x27, 0x79, 0x27, 0x66, 0x9B, 0xDB, 0x54, 0xD3, 0xBD, - 0x96, 0xC9, 0xB4, 0x96, 0xCA, 0xC7, 0xCD, 0xFA, 0x67, 0xED, 0xE7, 0xF0, 0xC7, 0xE2, 0x47, 0xC5, - 0x2F, 0x89, 0x9A, 0x3E, 0x89, 0xAF, 0x6A, 0xDA, 0xEF, 0x8A, 0x7E, 0x0B, 0xFC, 0x38, 0xD7, 0xFC, - 0x49, 0xE2, 0x6F, 0x12, 0xE8, 0x36, 0x57, 0x1E, 0x13, 0xF0, 0x5E, 0x9D, 0x69, 0xA6, 0xBC, 0x56, - 0xD1, 0x59, 0xEA, 0x71, 0xDB, 0xDA, 0x8D, 0x3E, 0x49, 0x52, 0xFA, 0xEA, 0x03, 0xE4, 0xBD, 0xE4, - 0xB2, 0xAB, 0xBC, 0x8A, 0xE9, 0xFE, 0x8F, 0xB6, 0x2F, 0xC5, 0xF8, 0xBB, 0x38, 0xC3, 0x65, 0x99, - 0x06, 0x2A, 0x8E, 0x12, 0x2A, 0x34, 0xED, 0x6E, 0x4B, 0xBA, 0x8E, 0x32, 0xB3, 0x4E, 0xD3, 0x92, - 0xD1, 0xDB, 0x44, 0xA2, 0x96, 0xC9, 0xA4, 0x9B, 0x77, 0xFE, 0x82, 0xF0, 0xB7, 0x86, 0x71, 0x1C, - 0x49, 0xC6, 0xD9, 0x6E, 0x12, 0xB3, 0xE6, 0x6E, 0x71, 0x6E, 0x56, 0x50, 0x4E, 0x11, 0x69, 0xEB, - 0x05, 0xA5, 0xAF, 0x67, 0x77, 0xD3, 0x76, 0xD2, 0x56, 0xFD, 0x28, 0xFF, 0x00, 0x82, 0x64, 0xFC, - 0x31, 0x87, 0xC0, 0x5F, 0xB2, 0xE6, 0x81, 0xE3, 0x8B, 0xFB, 0xA4, 0xB9, 0xF1, 0x3F, 0xC7, 0xAB, - 0xF9, 0x7E, 0x36, 0xF8, 0xA6, 0xE4, 0x4F, 0x14, 0xF6, 0xD1, 0x2E, 0xB0, 0x8A, 0xDA, 0x54, 0x31, - 0x4A, 0xA0, 0x65, 0x23, 0xD3, 0x23, 0xD3, 0x81, 0x25, 0x98, 0x6E, 0xF3, 0x08, 0xC0, 0x38, 0x1F, - 0x27, 0xC3, 0xD9, 0x5A, 0xCA, 0x32, 0x8A, 0x38, 0x49, 0x2F, 0xDE, 0xB5, 0xCF, 0x51, 0xF7, 0x9C, - 0xFD, 0xE9, 0x7F, 0xE0, 0x37, 0x50, 0x5F, 0xDD, 0x8A, 0x3E, 0xAB, 0xC4, 0xAE, 0x2C, 0x5C, 0x67, - 0xC6, 0xB8, 0xEC, 0xDF, 0x0F, 0x2F, 0xF6, 0x48, 0x38, 0xD0, 0xC3, 0xAE, 0x91, 0xC3, 0xD0, 0x8A, - 0xA7, 0x4A, 0xCB, 0xA7, 0x3A, 0x8B, 0xAB, 0x2F, 0xEF, 0xD4, 0x91, 0xFA, 0x15, 0x14, 0xF6, 0xEE, - 0x91, 0xC9, 0x1C, 0xF6, 0xEF, 0x13, 0xAA, 0xBC, 0x6F, 0x1C, 0xC8, 0xC8, 0xCA, 0x47, 0xCA, 0x54, - 0x83, 0x82, 0x08, 0xC7, 0x4A, 0xF6, 0x8F, 0x85, 0x27, 0xF3, 0xA0, 0xFF, 0x00, 0x9E, 0xB1, 0x7F, - 0xDF, 0x6B, 0x40, 0x07, 0x9D, 0x07, 0xFC, 0xF5, 0x8B, 0xFE, 0xFB, 0x5A, 0x00, 0x3C, 0xE8, 0x3F, - 0xE7, 0xAC, 0x5F, 0xF7, 0xDA, 0xD0, 0x01, 0xE7, 0x41, 0xFF, 0x00, 0x3D, 0x62, 0xFF, 0x00, 0xBE, - 0xD6, 0x80, 0x0F, 0x3A, 0x0F, 0xF9, 0xEB, 0x17, 0xFD, 0xF6, 0xB4, 0x00, 0x79, 0xD0, 0x7F, 0xCF, - 0x58, 0xBF, 0xEF, 0xB5, 0xA0, 0x03, 0xCE, 0x83, 0xFE, 0x7A, 0xC5, 0xFF, 0x00, 0x7D, 0xAD, 0x00, - 0x1E, 0x74, 0x1F, 0xF3, 0xD6, 0x2F, 0xFB, 0xED, 0x68, 0x00, 0xF3, 0xA0, 0xFF, 0x00, 0x9E, 0xB1, - 0x7F, 0xDF, 0x6B, 0x40, 0x07, 0x9D, 0x07, 0xFC, 0xF5, 0x8B, 0xFE, 0xFB, 0x5A, 0x00, 0x3C, 0xE8, - 0x3F, 0xE7, 0xAC, 0x5F, 0xF7, 0xDA, 0xD0, 0x01, 0xE7, 0x41, 0xFF, 0x00, 0x3D, 0x62, 0xFF, 0x00, - 0xBE, 0xD6, 0x80, 0x0F, 0x3A, 0x0F, 0xF9, 0xEB, 0x17, 0xFD, 0xF6, 0xB4, 0x00, 0x79, 0xD0, 0x7F, - 0xCF, 0x58, 0xBF, 0xEF, 0xB5, 0xA0, 0x03, 0xCE, 0x83, 0xFE, 0x7A, 0xC5, 0xFF, 0x00, 0x7D, 0xAD, - 0x00, 0x1E, 0x74, 0x1F, 0xF3, 0xD6, 0x2F, 0xFB, 0xED, 0x68, 0x00, 0xF3, 0xA0, 0xFF, 0x00, 0x9E, - 0xB1, 0x7F, 0xDF, 0x6B, 0x40, 0x07, 0x9D, 0x07, 0xFC, 0xF5, 0x8B, 0xFE, 0xFB, 0x5A, 0x00, 0x3C, - 0xE8, 0x3F, 0xE7, 0xAC, 0x5F, 0xF7, 0xDA, 0xD0, 0x01, 0xE7, 0x41, 0xFF, 0x00, 0x3D, 0x62, 0xFF, - 0x00, 0xBE, 0xD6, 0x80, 0x0F, 0x3A, 0x0F, 0xF9, 0xEB, 0x17, 0xFD, 0xF6, 0xB4, 0x00, 0x79, 0xD0, - 0x7F, 0xCF, 0x58, 0xBF, 0xEF, 0xB5, 0xA0, 0x03, 0xCE, 0x83, 0xFE, 0x7A, 0xC5, 0xFF, 0x00, 0x7D, - 0xAD, 0x00, 0x1E, 0x74, 0x1F, 0xF3, 0xD6, 0x2F, 0xFB, 0xED, 0x68, 0x00, 0xF3, 0xA0, 0xFF, 0x00, - 0x9E, 0xB1, 0x7F, 0xDF, 0x6B, 0x40, 0x07, 0x9D, 0x07, 0xFC, 0xF5, 0x8B, 0xFE, 0xFB, 0x5A, 0x00, - 0x3C, 0xE8, 0x3F, 0xE7, 0xAC, 0x5F, 0xF7, 0xDA, 0xD0, 0x01, 0xE7, 0x41, 0xFF, 0x00, 0x3D, 0x62, - 0xFF, 0x00, 0xBE, 0xD6, 0x80, 0x0F, 0x3A, 0x0F, 0xF9, 0xEB, 0x17, 0xFD, 0xF6, 0xB4, 0x00, 0x79, - 0xD0, 0x7F, 0xCF, 0x58, 0xBF, 0xEF, 0xB5, 0xA0, 0x03, 0xCE, 0x83, 0xFE, 0x7A, 0xC5, 0xFF, 0x00, - 0x7D, 0xAD, 0x00, 0x1E, 0x74, 0x1F, 0xF3, 0xD6, 0x2F, 0xFB, 0xED, 0x68, 0x00, 0xF3, 0xA0, 0xFF, - 0x00, 0x9E, 0xB1, 0x7F, 0xDF, 0x6B, 0x40, 0x07, 0x9D, 0x07, 0xFC, 0xF5, 0x8B, 0xFE, 0xFB, 0x5A, - 0x00, 0x3C, 0xE8, 0x3F, 0xE7, 0xAC, 0x5F, 0xF7, 0xDA, 0xD0, 0x01, 0xE7, 0x41, 0xFF, 0x00, 0x3D, - 0x62, 0xFF, 0x00, 0xBE, 0xD6, 0x80, 0x0F, 0x3A, 0x0F, 0xF9, 0xEB, 0x17, 0xFD, 0xF6, 0xB4, 0x00, - 0x79, 0xD0, 0x7F, 0xCF, 0x58, 0xBF, 0xEF, 0xB5, 0xA0, 0x03, 0xCE, 0x83, 0xFE, 0x7A, 0xC5, 0xFF, - 0x00, 0x7D, 0xAD, 0x00, 0x1E, 0x74, 0x1F, 0xF3, 0xD6, 0x2F, 0xFB, 0xED, 0x68, 0x00, 0xF3, 0xA0, - 0xFF, 0x00, 0x9E, 0xB1, 0x7F, 0xDF, 0x6B, 0x40, 0x07, 0x9D, 0x07, 0xFC, 0xF5, 0x8B, 0xFE, 0xFB, - 0x5A, 0x00, 0x3C, 0xE8, 0x3F, 0xE7, 0xAC, 0x5F, 0xF7, 0xDA, 0xD0, 0x01, 0xE7, 0x41, 0xFF, 0x00, - 0x3D, 0x62, 0xFF, 0x00, 0xBE, 0xD6, 0x80, 0x0F, 0x3A, 0x0F, 0xF9, 0xEB, 0x17, 0xFD, 0xF6, 0xB4, - 0x00, 0x79, 0xD0, 0x7F, 0xCF, 0x58, 0xBF, 0xEF, 0xB5, 0xA0, 0x03, 0xCE, 0x83, 0xFE, 0x7A, 0xC5, - 0xFF, 0x00, 0x7D, 0xAD, 0x00, 0x1E, 0x74, 0x1F, 0xF3, 0xD6, 0x2F, 0xFB, 0xED, 0x68, 0x00, 0xF3, - 0xA0, 0xFF, 0x00, 0x9E, 0xB1, 0x7F, 0xDF, 0x6B, 0x40, 0x07, 0x9D, 0x07, 0xFC, 0xF5, 0x8B, 0xFE, - 0xFB, 0x5A, 0x00, 0x3C, 0xE8, 0x3F, 0xE7, 0xAC, 0x5F, 0xF7, 0xDA, 0xD0, 0x01, 0xE7, 0x41, 0xFF, - 0x00, 0x3D, 0x62, 0xFF, 0x00, 0xBE, 0xD6, 0x80, 0x0F, 0x3A, 0x0F, 0xF9, 0xEB, 0x17, 0xFD, 0xF6, - 0xB4, 0x00, 0x79, 0xD0, 0x7F, 0xCF, 0x58, 0xBF, 0xEF, 0xB5, 0xA0, 0x03, 0xCE, 0x83, 0xFE, 0x7A, - 0xC5, 0xFF, 0x00, 0x7D, 0xAD, 0x00, 0x3D, 0x1E, 0x37, 0xFF, 0x00, 0x56, 0xC8, 0xDB, 0x71, 0xF7, - 0x08, 0x38, 0xF4, 0xE9, 0xF4, 0xA0, 0x07, 0x0C, 0x76, 0xC7, 0x1C, 0x71, 0x8E, 0x31, 0xDB, 0xF9, - 0x50, 0x07, 0xF9, 0xF9, 0xFF, 0x00, 0xC1, 0xCF, 0xBF, 0xF2, 0x9C, 0xFF, 0x00, 0xF8, 0x24, 0x3F, - 0xFD, 0x82, 0xBE, 0x1E, 0xFF, 0x00, 0xEA, 0xDE, 0xB9, 0xAE, 0xCC, 0xB3, 0xFE, 0x46, 0x18, 0x7F, - 0xF1, 0xC3, 0xFF, 0x00, 0x4A, 0x47, 0x3E, 0x27, 0xFD, 0xD6, 0xA7, 0xF8, 0x5F, 0xE4, 0x7D, 0xA9, - 0x5F, 0xA9, 0x9F, 0x1C, 0x14, 0x00, 0x50, 0x01, 0x40, 0x1F, 0xB0, 0x5F, 0xF0, 0x44, 0x3C, 0x0F, - 0x01, 0xFE, 0xDD, 0x7C, 0x70, 0x3F, 0x6E, 0x78, 0x78, 0x00, 0x74, 0x1F, 0x01, 0xBE, 0x19, 0x70, - 0x07, 0xE1, 0x5F, 0x9D, 0x71, 0x07, 0xFC, 0x8D, 0x27, 0xE9, 0x1F, 0xFD, 0x25, 0x1F, 0x51, 0x95, - 0xFF, 0x00, 0xB9, 0x47, 0xE7, 0xF9, 0x9E, 0x5F, 0xFF, 0x00, 0x05, 0x05, 0xF8, 0x53, 0xFB, 0x61, - 0x6A, 0x7A, 0xCF, 0xC2, 0x9D, 0x67, 0xF6, 0x45, 0xF0, 0x55, 0xAF, 0x8B, 0xBC, 0x6B, 0xE0, 0x6F, - 0x8C, 0xFE, 0x36, 0x87, 0xE2, 0x5F, 0x87, 0x6F, 0xEC, 0x34, 0xF9, 0xB4, 0x6D, 0x73, 0x48, 0xD7, - 0xBC, 0x25, 0x72, 0xDE, 0x15, 0xBC, 0xBE, 0x8A, 0xEA, 0x78, 0x16, 0x68, 0x63, 0xD6, 0xA1, 0xD2, - 0xB7, 0x6D, 0x95, 0x02, 0x70, 0xD2, 0x1F, 0x25, 0x1C, 0x1D, 0xF0, 0x39, 0xC6, 0x2F, 0x2F, 0xA2, - 0xFE, 0xA7, 0x51, 0xC1, 0xB4, 0xAC, 0xD5, 0xB4, 0xB4, 0x5A, 0x6B, 0xE6, 0xDA, 0xB5, 0xBF, 0x03, - 0x8F, 0x15, 0x97, 0x61, 0xB1, 0x53, 0x51, 0xC4, 0xD3, 0x52, 0x49, 0xED, 0xF3, 0x56, 0x7F, 0x72, - 0xF4, 0xD9, 0x1E, 0x85, 0xFB, 0x2A, 0x78, 0x1B, 0xE2, 0x27, 0x84, 0xFE, 0x23, 0xF8, 0xEF, 0xE1, - 0x4F, 0xC5, 0x0F, 0x0C, 0xBF, 0x88, 0xBE, 0x0C, 0x7C, 0x40, 0xF8, 0x2F, 0xA8, 0x6B, 0x9A, 0xBF, - 0xC6, 0x4F, 0x16, 0xAD, 0xEE, 0x8D, 0xE2, 0xBF, 0x01, 0x6B, 0x3A, 0x9E, 0xA5, 0x2D, 0xD4, 0xFE, - 0x12, 0xBD, 0xB5, 0x2F, 0xFD, 0x9F, 0x25, 0xAE, 0x9D, 0x0D, 0xDD, 0x9C, 0x11, 0xDC, 0xDB, 0xB2, - 0x4B, 0x14, 0x96, 0x8A, 0x92, 0x83, 0xB5, 0x2E, 0x6E, 0x3A, 0x33, 0x6C, 0xF7, 0x33, 0xCC, 0x79, - 0x53, 0xA8, 0xB9, 0x23, 0x2E, 0x68, 0x28, 0xDA, 0xEA, 0x4E, 0xE9, 0xEC, 0x93, 0xB5, 0x9D, 0xA2, - 0x9E, 0xD1, 0x56, 0x77, 0x32, 0xCB, 0x72, 0x9C, 0x06, 0x0E, 0xEE, 0x30, 0xF7, 0x9C, 0x79, 0x64, - 0xF5, 0x4A, 0xDA, 0x59, 0x5A, 0xF6, 0xBE, 0x8A, 0xF6, 0xEB, 0xB5, 0x96, 0x87, 0xE0, 0xDF, 0xC3, - 0x2D, 0x53, 0x4B, 0xFD, 0x89, 0x7C, 0x03, 0xE2, 0xBF, 0xD9, 0xCF, 0xE2, 0xD7, 0xC0, 0xFF, 0x00, - 0x1E, 0x6A, 0x7F, 0x16, 0x9F, 0xC5, 0x7E, 0x1D, 0x87, 0xC4, 0xA9, 0xE0, 0xFF, 0x00, 0x09, 0xEB, - 0x9E, 0x35, 0xF0, 0xFF, 0x00, 0xED, 0x37, 0xA0, 0xE9, 0x12, 0xC2, 0x91, 0xE9, 0xFE, 0x18, 0xD7, - 0xEC, 0xEC, 0xA6, 0xD3, 0x17, 0x4E, 0xD4, 0xE1, 0xB6, 0x37, 0x22, 0x69, 0xE7, 0x52, 0x3E, 0xDD, - 0x2F, 0x9E, 0x91, 0xBC, 0x6C, 0xAD, 0xF1, 0x39, 0xBE, 0x0E, 0xB6, 0x61, 0x84, 0xC2, 0xE1, 0xE2, - 0xD2, 0x54, 0xAA, 0xC6, 0x72, 0x8C, 0xA2, 0xF9, 0x66, 0x94, 0x93, 0x6B, 0x99, 0x3B, 0xDD, 0x24, - 0xD2, 0x4E, 0x2E, 0x29, 0xA5, 0x7B, 0xA6, 0xED, 0xFA, 0x4F, 0x05, 0xF1, 0x0E, 0x0B, 0x86, 0xB1, - 0x39, 0x8D, 0x7A, 0xF4, 0xE6, 0xE7, 0x88, 0xC2, 0xD5, 0xA1, 0x4E, 0xA5, 0x29, 0xC5, 0x4E, 0x8C, - 0xAA, 0x53, 0x71, 0x8C, 0xB9, 0x64, 0xAC, 0xE3, 0x76, 0xB9, 0xB9, 0x65, 0x19, 0x72, 0xDD, 0xC1, - 0xA9, 0x28, 0x9F, 0xD3, 0xF7, 0xFC, 0x12, 0x93, 0xC0, 0xDF, 0x13, 0x7C, 0x09, 0xFB, 0x17, 0x7C, - 0x3F, 0xD0, 0xBE, 0x2C, 0x68, 0x51, 0x78, 0x63, 0x56, 0xB8, 0xBF, 0xD5, 0x75, 0x2D, 0x1F, 0xC1, - 0x28, 0x64, 0x96, 0xD3, 0xC1, 0x1A, 0x45, 0xEE, 0xA1, 0x34, 0xF6, 0x1A, 0x0C, 0x0B, 0x20, 0x04, - 0x5B, 0x59, 0xC5, 0x70, 0x2D, 0x22, 0x4C, 0x00, 0xB1, 0x5B, 0xC4, 0x80, 0x2A, 0xA8, 0x55, 0xEE, - 0x6F, 0x44, 0xBB, 0x1F, 0x25, 0x45, 0x24, 0x9D, 0x92, 0x4B, 0x45, 0xA6, 0xDA, 0x2B, 0x69, 0xF9, - 0x7C, 0x8F, 0x34, 0xF1, 0xF7, 0xFC, 0x10, 0x9B, 0xFE, 0x09, 0x35, 0xF1, 0x2B, 0xC5, 0xBA, 0xDF, - 0x8D, 0xBC, 0x49, 0xFB, 0x11, 0x7C, 0x0E, 0x4F, 0x10, 0x78, 0x97, 0x53, 0x9F, 0x59, 0xD6, 0xE7, - 0xD1, 0x7C, 0x13, 0x61, 0xA1, 0xDA, 0xDF, 0xDD, 0xDD, 0x4A, 0xD2, 0x5C, 0x5C, 0x35, 0xBC, 0x30, - 0xAC, 0x61, 0xDE, 0x49, 0x1D, 0x8E, 0xD5, 0x03, 0x24, 0xD2, 0x36, 0x39, 0x0F, 0xF8, 0x87, 0xA7, - 0xFE, 0x08, 0xFF, 0x00, 0xFF, 0x00, 0x46, 0x51, 0xF0, 0x97, 0xFF, 0x00, 0x09, 0xFB, 0x6F, 0xFE, - 0x37, 0x40, 0x07, 0xFC, 0x43, 0xD3, 0xFF, 0x00, 0x04, 0x7F, 0xFF, 0x00, 0xA3, 0x28, 0xF8, 0x4B, - 0xFF, 0x00, 0x84, 0xFD, 0xB7, 0xFF, 0x00, 0x1B, 0xA0, 0x03, 0xFE, 0x21, 0xE9, 0xFF, 0x00, 0x82, - 0x3F, 0xFF, 0x00, 0xD1, 0x94, 0x7C, 0x25, 0xFF, 0x00, 0xC2, 0x7E, 0xDB, 0xFF, 0x00, 0x8D, 0xD0, - 0x01, 0xFF, 0x00, 0x10, 0xF4, 0xFF, 0x00, 0xC1, 0x1F, 0xFF, 0x00, 0xE8, 0xCA, 0x3E, 0x12, 0xFF, - 0x00, 0xE1, 0x3F, 0x6D, 0xFF, 0x00, 0xC6, 0xE8, 0x00, 0xFF, 0x00, 0x88, 0x7A, 0x7F, 0xE0, 0x8F, - 0xFF, 0x00, 0xF4, 0x65, 0x1F, 0x09, 0x7F, 0xF0, 0x9F, 0xB6, 0xFF, 0x00, 0xE3, 0x74, 0x00, 0x7F, - 0xC4, 0x3D, 0x3F, 0xF0, 0x47, 0xFF, 0x00, 0xFA, 0x32, 0x8F, 0x84, 0xBF, 0xF8, 0x4F, 0xDB, 0x7F, - 0xF1, 0xBA, 0x00, 0x3F, 0xE2, 0x1E, 0x9F, 0xF8, 0x23, 0xFF, 0x00, 0xFD, 0x19, 0x47, 0xC2, 0x5F, - 0xFC, 0x27, 0xED, 0xBF, 0xF8, 0xDD, 0x00, 0x1F, 0xF1, 0x0F, 0x4F, 0xFC, 0x11, 0xFF, 0x00, 0xFE, - 0x8C, 0xA3, 0xE1, 0x2F, 0xFE, 0x13, 0xF6, 0xDF, 0xFC, 0x6E, 0x80, 0x0F, 0xF8, 0x87, 0xA7, 0xFE, - 0x08, 0xFF, 0x00, 0xFF, 0x00, 0x46, 0x51, 0xF0, 0x97, 0xFF, 0x00, 0x09, 0xFB, 0x6F, 0xFE, 0x37, - 0x40, 0x07, 0xFC, 0x43, 0xD3, 0xFF, 0x00, 0x04, 0x7F, 0xFF, 0x00, 0xA3, 0x28, 0xF8, 0x4B, 0xFF, - 0x00, 0x84, 0xFD, 0xB7, 0xFF, 0x00, 0x1B, 0xA0, 0x03, 0xFE, 0x21, 0xE9, 0xFF, 0x00, 0x82, 0x3F, - 0xFF, 0x00, 0xD1, 0x94, 0x7C, 0x25, 0xFF, 0x00, 0xC2, 0x7E, 0xDB, 0xFF, 0x00, 0x8D, 0xD0, 0x01, - 0xFF, 0x00, 0x10, 0xF4, 0xFF, 0x00, 0xC1, 0x1F, 0xFF, 0x00, 0xE8, 0xCA, 0x3E, 0x12, 0xFF, 0x00, - 0xE1, 0x3F, 0x6D, 0xFF, 0x00, 0xC6, 0xE8, 0x00, 0xFF, 0x00, 0x88, 0x7A, 0x7F, 0xE0, 0x8F, 0xFF, - 0x00, 0xF4, 0x65, 0x1F, 0x09, 0x7F, 0xF0, 0x9F, 0xB6, 0xFF, 0x00, 0xE3, 0x74, 0x00, 0x7F, 0xC4, - 0x3D, 0x3F, 0xF0, 0x47, 0xFF, 0x00, 0xFA, 0x32, 0x8F, 0x84, 0xBF, 0xF8, 0x4F, 0xDB, 0x7F, 0xF1, - 0xBA, 0x00, 0x3F, 0xE2, 0x1E, 0x9F, 0xF8, 0x23, 0xFF, 0x00, 0xFD, 0x19, 0x47, 0xC2, 0x5F, 0xFC, - 0x27, 0xED, 0xBF, 0xF8, 0xDD, 0x00, 0x1F, 0xF1, 0x0F, 0x4F, 0xFC, 0x11, 0xFF, 0x00, 0xFE, 0x8C, - 0xA3, 0xE1, 0x2F, 0xFE, 0x13, 0xF6, 0xDF, 0xFC, 0x6E, 0x80, 0x0F, 0xF8, 0x87, 0xA7, 0xFE, 0x08, - 0xFF, 0x00, 0xFF, 0x00, 0x46, 0x51, 0xF0, 0x97, 0xFF, 0x00, 0x09, 0xFB, 0x6F, 0xFE, 0x37, 0x40, - 0x07, 0xFC, 0x43, 0xD3, 0xFF, 0x00, 0x04, 0x7F, 0xFF, 0x00, 0xA3, 0x28, 0xF8, 0x4B, 0xFF, 0x00, - 0x84, 0xFD, 0xB7, 0xFF, 0x00, 0x1B, 0xA0, 0x03, 0xFE, 0x21, 0xE9, 0xFF, 0x00, 0x82, 0x3F, 0xFF, - 0x00, 0xD1, 0x94, 0x7C, 0x25, 0xFF, 0x00, 0xC2, 0x7E, 0xDB, 0xFF, 0x00, 0x8D, 0xD0, 0x01, 0xFF, - 0x00, 0x10, 0xF4, 0xFF, 0x00, 0xC1, 0x1F, 0xFF, 0x00, 0xE8, 0xCA, 0x3E, 0x12, 0xFF, 0x00, 0xE1, - 0x3F, 0x6D, 0xFF, 0x00, 0xC6, 0xE8, 0x00, 0xFF, 0x00, 0x88, 0x7A, 0x7F, 0xE0, 0x8F, 0xFF, 0x00, - 0xF4, 0x65, 0x1F, 0x09, 0x7F, 0xF0, 0x9F, 0xB6, 0xFF, 0x00, 0xE3, 0x74, 0x00, 0x7F, 0xC4, 0x3D, - 0x3F, 0xF0, 0x47, 0xFF, 0x00, 0xFA, 0x32, 0x8F, 0x84, 0xBF, 0xF8, 0x4F, 0xDB, 0x7F, 0xF1, 0xBA, - 0x00, 0x3F, 0xE2, 0x1E, 0x9F, 0xF8, 0x23, 0xFF, 0x00, 0xFD, 0x19, 0x47, 0xC2, 0x5F, 0xFC, 0x27, - 0xED, 0xBF, 0xF8, 0xDD, 0x00, 0x1F, 0xF1, 0x0F, 0x4F, 0xFC, 0x11, 0xFF, 0x00, 0xFE, 0x8C, 0xA3, - 0xE1, 0x2F, 0xFE, 0x13, 0xF6, 0xDF, 0xFC, 0x6E, 0x80, 0x0F, 0xF8, 0x87, 0xA7, 0xFE, 0x08, 0xFF, - 0x00, 0xFF, 0x00, 0x46, 0x51, 0xF0, 0x97, 0xFF, 0x00, 0x09, 0xFB, 0x6F, 0xFE, 0x37, 0x40, 0x1C, - 0x7F, 0x8F, 0xFF, 0x00, 0xE0, 0x85, 0x9F, 0xF0, 0x44, 0x0F, 0x84, 0xFE, 0x0C, 0xF1, 0x0F, 0xC4, - 0x5F, 0x8A, 0x5F, 0xB3, 0x0F, 0xEC, 0xEB, 0xF0, 0xD3, 0xE1, 0xEF, 0x84, 0x74, 0xF3, 0xAA, 0xF8, - 0xAF, 0xC7, 0x7E, 0x3F, 0x9B, 0x49, 0xF0, 0x6F, 0x83, 0x3C, 0x31, 0x68, 0xAC, 0x15, 0xAE, 0x75, - 0x1D, 0x52, 0xEC, 0xC5, 0x6D, 0x6D, 0x10, 0x67, 0x41, 0xBE, 0x47, 0x45, 0x04, 0x81, 0x9E, 0x45, - 0x00, 0x76, 0x03, 0xFE, 0x0D, 0xEA, 0xFF, 0x00, 0x82, 0x3F, 0xE0, 0x63, 0xF6, 0x28, 0xF8, 0x4A, - 0x06, 0x06, 0x07, 0xFC, 0x23, 0xD6, 0xE3, 0x03, 0x1C, 0x0C, 0x79, 0x7F, 0x4A, 0x00, 0x3F, 0xE2, - 0x1E, 0x9F, 0xF8, 0x23, 0xFF, 0x00, 0xFD, 0x19, 0x47, 0xC2, 0x5F, 0xFC, 0x27, 0xED, 0xBF, 0xF8, - 0xDD, 0x00, 0x1F, 0xF1, 0x0F, 0x4F, 0xFC, 0x11, 0xFF, 0x00, 0xFE, 0x8C, 0xA3, 0xE1, 0x2F, 0xFE, - 0x13, 0xF6, 0xDF, 0xFC, 0x6E, 0x80, 0x0F, 0xF8, 0x87, 0xA7, 0xFE, 0x08, 0xFF, 0x00, 0xFF, 0x00, - 0x46, 0x51, 0xF0, 0x97, 0xFF, 0x00, 0x09, 0xFB, 0x6F, 0xFE, 0x37, 0x40, 0x07, 0xFC, 0x43, 0xD3, - 0xFF, 0x00, 0x04, 0x7F, 0xFF, 0x00, 0xA3, 0x28, 0xF8, 0x4B, 0xFF, 0x00, 0x84, 0xFD, 0xB7, 0xFF, - 0x00, 0x1B, 0xA0, 0x03, 0xFE, 0x21, 0xE9, 0xFF, 0x00, 0x82, 0x3F, 0xFF, 0x00, 0xD1, 0x94, 0x7C, - 0x25, 0xFF, 0x00, 0xC2, 0x7E, 0xDB, 0xFF, 0x00, 0x8D, 0xD0, 0x01, 0xFF, 0x00, 0x10, 0xF4, 0xFF, - 0x00, 0xC1, 0x1F, 0xFF, 0x00, 0xE8, 0xCA, 0x3E, 0x12, 0xFF, 0x00, 0xE1, 0x3F, 0x6D, 0xFF, 0x00, - 0xC6, 0xE8, 0x00, 0xFF, 0x00, 0x88, 0x7A, 0x7F, 0xE0, 0x8F, 0xFF, 0x00, 0xF4, 0x65, 0x1F, 0x09, - 0x7F, 0xF0, 0x9F, 0xB6, 0xFF, 0x00, 0xE3, 0x74, 0x00, 0x7F, 0xC4, 0x3D, 0x3F, 0xF0, 0x47, 0xFF, - 0x00, 0xFA, 0x32, 0x8F, 0x84, 0xBF, 0xF8, 0x4F, 0xDB, 0x7F, 0xF1, 0xBA, 0x00, 0x3F, 0xE2, 0x1E, - 0x9F, 0xF8, 0x23, 0xFF, 0x00, 0xFD, 0x19, 0x47, 0xC2, 0x5F, 0xFC, 0x27, 0xED, 0xBF, 0xF8, 0xDD, - 0x00, 0x1F, 0xF1, 0x0F, 0x4F, 0xFC, 0x11, 0xFF, 0x00, 0xFE, 0x8C, 0xA3, 0xE1, 0x2F, 0xFE, 0x13, - 0xF6, 0xDF, 0xFC, 0x6E, 0x80, 0x0F, 0xF8, 0x87, 0xA7, 0xFE, 0x08, 0xFF, 0x00, 0xFF, 0x00, 0x46, - 0x51, 0xF0, 0x97, 0xFF, 0x00, 0x09, 0xFB, 0x6F, 0xFE, 0x37, 0x40, 0x07, 0xFC, 0x43, 0xD3, 0xFF, - 0x00, 0x04, 0x7F, 0xFF, 0x00, 0xA3, 0x28, 0xF8, 0x4B, 0xFF, 0x00, 0x84, 0xFD, 0xB7, 0xFF, 0x00, - 0x1B, 0xA0, 0x03, 0xFE, 0x21, 0xE9, 0xFF, 0x00, 0x82, 0x3F, 0xFF, 0x00, 0xD1, 0x94, 0x7C, 0x25, - 0xFF, 0x00, 0xC2, 0x7E, 0xDB, 0xFF, 0x00, 0x8D, 0xD0, 0x01, 0xFF, 0x00, 0x10, 0xF4, 0xFF, 0x00, - 0xC1, 0x1F, 0xFF, 0x00, 0xE8, 0xCA, 0x3E, 0x12, 0xFF, 0x00, 0xE1, 0x3F, 0x6D, 0xFF, 0x00, 0xC6, - 0xE8, 0x00, 0xFF, 0x00, 0x88, 0x7A, 0x7F, 0xE0, 0x8F, 0xFF, 0x00, 0xF4, 0x65, 0x1F, 0x09, 0x7F, - 0xF0, 0x9F, 0xB6, 0xFF, 0x00, 0xE3, 0x74, 0x00, 0x7F, 0xC4, 0x3D, 0x3F, 0xF0, 0x47, 0xFF, 0x00, - 0xFA, 0x32, 0x8F, 0x84, 0xBF, 0xF8, 0x4F, 0xDB, 0x7F, 0xF1, 0xBA, 0x00, 0x3F, 0xE2, 0x1E, 0x9F, - 0xF8, 0x23, 0xFF, 0x00, 0xFD, 0x19, 0x47, 0xC2, 0x5F, 0xFC, 0x27, 0xED, 0xBF, 0xF8, 0xDD, 0x00, - 0x1F, 0xF1, 0x0F, 0x4F, 0xFC, 0x11, 0xFF, 0x00, 0xFE, 0x8C, 0xA3, 0xE1, 0x2F, 0xFE, 0x13, 0xF6, - 0xDF, 0xFC, 0x6E, 0x80, 0x0F, 0xF8, 0x87, 0xA7, 0xFE, 0x08, 0xFF, 0x00, 0xFF, 0x00, 0x46, 0x51, - 0xF0, 0x97, 0xFF, 0x00, 0x09, 0xFB, 0x6F, 0xFE, 0x37, 0x40, 0x07, 0xFC, 0x43, 0xD3, 0xFF, 0x00, - 0x04, 0x7F, 0xFF, 0x00, 0xA3, 0x28, 0xF8, 0x4B, 0xFF, 0x00, 0x84, 0xFD, 0xB7, 0xFF, 0x00, 0x1B, - 0xA0, 0x03, 0xFE, 0x21, 0xE9, 0xFF, 0x00, 0x82, 0x3F, 0xFF, 0x00, 0xD1, 0x94, 0x7C, 0x25, 0xFF, - 0x00, 0xC2, 0x7E, 0xDB, 0xFF, 0x00, 0x8D, 0xD0, 0x01, 0xFF, 0x00, 0x10, 0xF4, 0xFF, 0x00, 0xC1, - 0x1F, 0xFF, 0x00, 0xE8, 0xCA, 0x3E, 0x12, 0xFF, 0x00, 0xE1, 0x3F, 0x6D, 0xFF, 0x00, 0xC6, 0xE8, - 0x00, 0xFF, 0x00, 0x88, 0x7A, 0x7F, 0xE0, 0x8F, 0xFF, 0x00, 0xF4, 0x65, 0x1F, 0x09, 0x7F, 0xF0, - 0x9F, 0xB6, 0xFF, 0x00, 0xE3, 0x74, 0x00, 0x7F, 0xC4, 0x3D, 0x3F, 0xF0, 0x47, 0xFF, 0x00, 0xFA, - 0x32, 0x8F, 0x84, 0xBF, 0xF8, 0x4F, 0xDB, 0x7F, 0xF1, 0xBA, 0x00, 0x3F, 0xE2, 0x1E, 0x9F, 0xF8, - 0x23, 0xFF, 0x00, 0xFD, 0x19, 0x47, 0xC2, 0x5F, 0xFC, 0x27, 0xED, 0xBF, 0xF8, 0xDD, 0x00, 0x1F, - 0xF1, 0x0F, 0x4F, 0xFC, 0x11, 0xFF, 0x00, 0xFE, 0x8C, 0xA3, 0xE1, 0x2F, 0xFE, 0x13, 0xF6, 0xDF, - 0xFC, 0x6E, 0x80, 0x0F, 0xF8, 0x87, 0xA7, 0xFE, 0x08, 0xFF, 0x00, 0xFF, 0x00, 0x46, 0x51, 0xF0, - 0x97, 0xFF, 0x00, 0x09, 0xFB, 0x6F, 0xFE, 0x37, 0x40, 0x07, 0xFC, 0x43, 0xD3, 0xFF, 0x00, 0x04, - 0x7F, 0xFF, 0x00, 0xA3, 0x28, 0xF8, 0x4B, 0xFF, 0x00, 0x84, 0xFD, 0xB7, 0xFF, 0x00, 0x1B, 0xA0, - 0x0F, 0x5A, 0xF8, 0x21, 0xFF, 0x00, 0x04, 0x5F, 0xFF, 0x00, 0x82, 0x70, 0x7E, 0xCD, 0xBF, 0x11, - 0xF4, 0x1F, 0x8B, 0xBF, 0x02, 0x3F, 0x66, 0xFF, 0x00, 0x0A, 0x7C, 0x2A, 0xF8, 0x91, 0xE1, 0xAF, - 0x35, 0x74, 0x7F, 0x17, 0x78, 0x21, 0x4F, 0x87, 0xB5, 0x9B, 0x58, 0xE7, 0x88, 0xC7, 0x3C, 0x26, - 0x58, 0x42, 0x97, 0x89, 0xD1, 0x8A, 0xB4, 0x6D, 0x95, 0x6E, 0x32, 0x38, 0x18, 0x00, 0xFD, 0x47, - 0x8A, 0x31, 0x14, 0x69, 0x18, 0x2C, 0xC1, 0x14, 0x28, 0x2C, 0x72, 0xC4, 0x00, 0x00, 0x24, 0xFA, - 0xF0, 0x28, 0x03, 0xFC, 0xFD, 0xBF, 0xE0, 0xE7, 0xDF, 0xF9, 0x4E, 0x7F, 0xFC, 0x12, 0x1F, 0xFE, - 0xC1, 0x5F, 0x0F, 0x7F, 0xF5, 0x6F, 0x5C, 0xD7, 0x66, 0x59, 0xFF, 0x00, 0x23, 0x0C, 0x3F, 0xF8, - 0xE1, 0xFF, 0x00, 0xA5, 0x23, 0x9F, 0x13, 0xFE, 0xEB, 0x53, 0xFC, 0x2F, 0xF2, 0x3E, 0xD4, 0xAF, - 0xD4, 0xCF, 0x8E, 0x0A, 0x00, 0x28, 0x00, 0xA0, 0x0F, 0xD8, 0x1F, 0xF8, 0x22, 0x1E, 0x3F, 0xE1, - 0x03, 0xFD, 0xBB, 0x00, 0xC7, 0x1F, 0xB7, 0x3C, 0x23, 0x03, 0x1C, 0x7F, 0xC5, 0x86, 0xF8, 0x63, - 0x81, 0x8F, 0xCA, 0xBF, 0x3A, 0xE2, 0x0F, 0xF9, 0x1A, 0x4F, 0xD2, 0x3F, 0xFA, 0x4A, 0x3E, 0xA3, - 0x2B, 0xFF, 0x00, 0x72, 0x8F, 0xCF, 0xF3, 0x3E, 0xAE, 0xFD, 0xBA, 0x3F, 0x62, 0x9D, 0x43, 0xF6, - 0xC5, 0xD5, 0xBF, 0x66, 0x25, 0xFF, 0x00, 0x84, 0xEB, 0x53, 0xF0, 0x67, 0x85, 0x3E, 0x0C, 0x7C, - 0x65, 0x7F, 0x88, 0x7E, 0x3C, 0xD3, 0x34, 0x0B, 0xEB, 0xDD, 0x07, 0xC4, 0x3E, 0x35, 0xD3, 0x9F, - 0x49, 0x9A, 0xDA, 0x3D, 0x3E, 0xD3, 0x54, 0xB5, 0x9E, 0x29, 0x6D, 0x0A, 0x5D, 0x49, 0x67, 0x70, - 0x59, 0x49, 0x66, 0x16, 0xE1, 0x14, 0xA1, 0x6D, 0xE9, 0xE2, 0xAF, 0x76, 0xDC, 0xA7, 0x74, 0xA3, - 0x74, 0x92, 0x5A, 0x1F, 0x8E, 0xDF, 0xB5, 0x97, 0xEC, 0x5F, 0xFF, 0x00, 0x05, 0x1E, 0xD7, 0xF4, - 0x2B, 0x5F, 0x83, 0x76, 0xBF, 0xB6, 0x07, 0xC5, 0x5F, 0x16, 0x78, 0x02, 0x4D, 0x17, 0xC3, 0x3F, - 0xF0, 0x9C, 0x8D, 0x47, 0xC0, 0x3A, 0x80, 0xD1, 0xBC, 0x51, 0xAC, 0xF8, 0x7F, 0xC5, 0x76, 0x3A, - 0xBD, 0xD6, 0xA1, 0x6D, 0x7D, 0x01, 0x90, 0xC9, 0x6F, 0x7D, 0x06, 0x9E, 0xD0, 0x35, 0x9B, 0x01, - 0x0C, 0x5E, 0x63, 0x46, 0xC9, 0x34, 0x43, 0x63, 0xFA, 0x98, 0x4A, 0x74, 0x6A, 0xC2, 0xF5, 0x5D, - 0xDE, 0x8B, 0xA3, 0x69, 0x26, 0x9E, 0xDA, 0x5B, 0x45, 0x65, 0x6E, 0xF6, 0xD8, 0xF3, 0x6B, 0x3A, - 0x94, 0x9A, 0x8C, 0x34, 0x56, 0xEB, 0x74, 0xB6, 0x6B, 0xA7, 0x9D, 0xBE, 0xEF, 0x43, 0xD5, 0xFE, - 0x01, 0xFE, 0xC5, 0xBF, 0xF0, 0x54, 0xAD, 0x73, 0xC0, 0x9F, 0x0F, 0x2C, 0xBC, 0x6B, 0xFB, 0x71, - 0x5E, 0x5D, 0xDB, 0x78, 0x25, 0xF4, 0x8B, 0x7F, 0x10, 0x68, 0x7E, 0x25, 0xF8, 0x5F, 0x2E, 0x9D, - 0x6F, 0xE2, 0xE5, 0xB3, 0xB9, 0xBC, 0x6D, 0x5D, 0x60, 0xBA, 0x9D, 0x22, 0x9C, 0xD9, 0x6A, 0x56, - 0xFA, 0x92, 0x2B, 0xA1, 0x2D, 0x24, 0x12, 0x59, 0x58, 0x6D, 0x90, 0xC5, 0x04, 0x90, 0x5E, 0xF2, - 0xE2, 0x62, 0xA1, 0x34, 0xA2, 0xD6, 0xCB, 0xAA, 0x7A, 0xAE, 0xE9, 0x6D, 0xE9, 0xF9, 0x9B, 0xE1, - 0xD3, 0x9C, 0x36, 0xD1, 0x6D, 0xA5, 0xB4, 0xB6, 0x89, 0x6D, 0x7F, 0x5B, 0x6D, 0xDB, 0x65, 0xF4, - 0x07, 0x87, 0xFF, 0x00, 0x62, 0xBF, 0xF8, 0x29, 0xEF, 0x86, 0xBC, 0x2F, 0xE1, 0x1D, 0x02, 0xC7, - 0xF6, 0xF2, 0xD3, 0x5D, 0xFC, 0x17, 0xE2, 0xD8, 0x75, 0x5D, 0x33, 0xCA, 0xF0, 0x3A, 0x69, 0x1A, - 0x4D, 0xE6, 0x93, 0x06, 0xBF, 0x0D, 0xD4, 0x1A, 0x2C, 0xF6, 0x56, 0xEE, 0x91, 0x9B, 0x64, 0xD2, - 0x20, 0xFE, 0xC8, 0xF2, 0xFE, 0xE7, 0x97, 0x1C, 0x77, 0x40, 0x0B, 0x89, 0xA7, 0x2D, 0xC9, 0x6D, - 0x2C, 0x75, 0x59, 0xE9, 0x65, 0xE8, 0x7B, 0xCF, 0xEC, 0x89, 0xFB, 0x32, 0xFE, 0xD9, 0x1F, 0x07, - 0xFE, 0x3B, 0xF8, 0xBF, 0xE2, 0xBF, 0xC7, 0xBF, 0x8D, 0xFE, 0x10, 0xF8, 0xC1, 0xA5, 0x7C, 0x40, - 0xF8, 0x5B, 0xA7, 0x7C, 0x35, 0xD7, 0xAC, 0x6D, 0xF4, 0xBB, 0xED, 0x3B, 0x5A, 0xD2, 0xE4, 0xF0, - 0xEF, 0x8B, 0x7C, 0x49, 0xA9, 0xF8, 0x7B, 0x50, 0xB5, 0x94, 0xDC, 0x1B, 0x77, 0x55, 0xD3, 0xFC, - 0x68, 0xD6, 0x13, 0x09, 0x20, 0xF3, 0x59, 0x74, 0xDB, 0x47, 0xF3, 0x4E, 0xE6, 0x54, 0x12, 0xB2, - 0x48, 0x22, 0x9A, 0xE9, 0xA7, 0xF5, 0xFD, 0x7F, 0x56, 0x3F, 0x50, 0xA9, 0x9A, 0x05, 0x00, 0x14, - 0x00, 0x50, 0x01, 0x40, 0x05, 0x00, 0x14, 0x00, 0x50, 0x01, 0x40, 0x05, 0x00, 0x14, 0x00, 0x50, - 0x01, 0x40, 0x05, 0x00, 0x14, 0x00, 0x50, 0x01, 0x40, 0x05, 0x00, 0x14, 0x00, 0x50, 0x01, 0x40, - 0x05, 0x00, 0x14, 0x00, 0x50, 0x01, 0x40, 0x1E, 0x3D, 0xF1, 0xF3, 0xE1, 0xBF, 0x88, 0x3E, 0x2D, - 0xFC, 0x22, 0xF1, 0x9F, 0xC3, 0xBF, 0x09, 0xF8, 0x9F, 0x47, 0xF0, 0x4F, 0x88, 0x7C, 0x4B, 0xA7, - 0x47, 0x65, 0xA5, 0x78, 0xB3, 0x5B, 0xD0, 0xF5, 0x8D, 0x76, 0xD3, 0xC3, 0xCE, 0xB3, 0xA3, 0x35, - 0xD4, 0x29, 0xA4, 0x6B, 0x3A, 0x2E, 0xAF, 0x6F, 0x72, 0xA8, 0x8E, 0x60, 0xBB, 0xD3, 0xB5, 0x6D, - 0x3A, 0xF2, 0xD2, 0x6F, 0x26, 0xE6, 0xDE, 0xE6, 0x29, 0x60, 0x46, 0x00, 0x1D, 0x1F, 0xC2, 0x8F, - 0x87, 0xDA, 0x6F, 0xC2, 0x5F, 0x85, 0xBF, 0x0D, 0x7E, 0x15, 0x68, 0xD3, 0xC5, 0x75, 0xA3, 0xFC, - 0x33, 0xF0, 0x06, 0x8D, 0xF0, 0xFB, 0x49, 0xB9, 0x83, 0xC3, 0x9A, 0x2F, 0x83, 0xA0, 0xB8, 0xB6, - 0xD1, 0x74, 0xE8, 0x6C, 0xED, 0xE4, 0x4D, 0x23, 0x47, 0xB2, 0xB2, 0xD2, 0x2C, 0x55, 0x92, 0xD9, - 0x08, 0xB6, 0xB0, 0xB3, 0xB4, 0xB5, 0x84, 0x11, 0x1C, 0x16, 0xF0, 0xC4, 0x89, 0x1A, 0x00, 0x77, - 0xD4, 0x00, 0x50, 0x01, 0x40, 0x05, 0x00, 0x14, 0x00, 0x50, 0x01, 0x40, 0x05, 0x00, 0x14, 0x00, - 0x50, 0x01, 0x40, 0x05, 0x00, 0x14, 0x00, 0x50, 0x01, 0x40, 0x05, 0x00, 0x14, 0x00, 0x50, 0x01, - 0x40, 0x05, 0x00, 0x14, 0x00, 0x50, 0x01, 0x40, 0x05, 0x00, 0x14, 0x00, 0x50, 0x01, 0x40, 0x05, - 0x00, 0x14, 0x00, 0x50, 0x07, 0xF9, 0xFA, 0x7F, 0xC1, 0xCF, 0xAB, 0x8F, 0xF8, 0x2E, 0x77, 0xFC, - 0x12, 0x1C, 0xE3, 0x0B, 0xFD, 0x97, 0xF0, 0xF5, 0x41, 0xC6, 0x07, 0x1F, 0x17, 0xAE, 0x72, 0x07, - 0xD3, 0x23, 0xF4, 0xAE, 0xCC, 0xB3, 0xFE, 0x46, 0x18, 0x7F, 0xF1, 0xC3, 0xFF, 0x00, 0x4A, 0x47, - 0x3E, 0x27, 0xFD, 0xD6, 0xA7, 0xF8, 0x5F, 0xE4, 0x7D, 0xA7, 0x5F, 0xA9, 0x9F, 0x1C, 0x14, 0x00, - 0x50, 0x01, 0x40, 0x1F, 0x09, 0xFE, 0xDA, 0xBF, 0xB0, 0x7F, 0x81, 0x3F, 0x6C, 0x1F, 0x05, 0xDA, - 0xE8, 0xB6, 0x3A, 0xBE, 0x83, 0xF0, 0x57, 0xE2, 0x08, 0xF1, 0xC6, 0x9D, 0xE2, 0xCD, 0x5F, 0xE3, - 0x47, 0x85, 0xFE, 0x18, 0x69, 0xDA, 0xE7, 0xC4, 0x8F, 0x10, 0xD9, 0xE9, 0xDA, 0x55, 0xDD, 0x8A, - 0xE8, 0x77, 0x9A, 0x8A, 0xCF, 0x67, 0x79, 0x25, 0xA3, 0x0B, 0xCB, 0x27, 0xDA, 0xF7, 0x4E, 0x8B, - 0xFD, 0x9F, 0x6A, 0xBE, 0x51, 0xD8, 0x86, 0x2F, 0x2B, 0x32, 0xCA, 0x68, 0x66, 0x14, 0xD4, 0x52, - 0x50, 0x9D, 0xD3, 0x72, 0x51, 0x4D, 0xB4, 0x93, 0x56, 0xBE, 0x8E, 0xDB, 0x75, 0xB6, 0x8B, 0x4E, - 0xDD, 0x98, 0x4C, 0x65, 0x4C, 0x2B, 0xD3, 0x58, 0xDA, 0xD6, 0xBD, 0x92, 0xDB, 0x5B, 0x6D, 0xD3, - 0xB1, 0xF9, 0xA1, 0xFF, 0x00, 0x0E, 0x0B, 0x3F, 0xF4, 0x7C, 0x5F, 0x11, 0x3F, 0xF0, 0xD2, 0xFF, - 0x00, 0xF8, 0x47, 0x5E, 0x2F, 0xFA, 0xA7, 0x1F, 0xF9, 0xFF, 0x00, 0xFF, 0x00, 0x92, 0x7F, 0xF6, - 0xC7, 0x77, 0xF6, 0xC4, 0xBF, 0xE7, 0xDA, 0xFB, 0xFF, 0x00, 0xE0, 0x08, 0x7F, 0xE0, 0x81, 0x20, - 0x80, 0x0F, 0xED, 0xC1, 0xF1, 0x0C, 0x81, 0x8C, 0x03, 0xF0, 0x8C, 0x10, 0x30, 0x38, 0xC0, 0xFF, - 0x00, 0x84, 0x8E, 0x8F, 0xF5, 0x4E, 0x3F, 0xF3, 0xFF, 0x00, 0xFF, 0x00, 0x24, 0xFF, 0x00, 0xED, - 0x83, 0xFB, 0x62, 0x56, 0x4B, 0xD9, 0xAB, 0x7A, 0xFF, 0x00, 0xC0, 0x14, 0x7F, 0xC1, 0x02, 0xB6, - 0x80, 0x17, 0xF6, 0xE1, 0xF8, 0x88, 0xA0, 0x74, 0x03, 0xE1, 0x26, 0x00, 0xE3, 0xB0, 0xFF, 0x00, - 0x84, 0x8F, 0xD8, 0x51, 0xFE, 0xA9, 0xC7, 0xFE, 0x7F, 0xFF, 0x00, 0xE4, 0x9F, 0xFD, 0xB0, 0x7F, - 0x6C, 0x4B, 0xFE, 0x7D, 0xAF, 0xBF, 0xFE, 0x00, 0x7F, 0xC3, 0x82, 0xCF, 0xFD, 0x1F, 0x17, 0xC4, - 0x4F, 0xFC, 0x34, 0xBF, 0xFE, 0x11, 0xD1, 0xFE, 0xA9, 0xC7, 0xFE, 0x7F, 0xFF, 0x00, 0xE4, 0x9F, - 0xFD, 0xB0, 0x7F, 0x6C, 0x4B, 0xFE, 0x7D, 0xAF, 0xBF, 0xFE, 0x00, 0x7F, 0xC3, 0x82, 0xCF, 0xFD, - 0x1F, 0x17, 0xC4, 0x4F, 0xFC, 0x34, 0xBF, 0xFE, 0x11, 0xD1, 0xFE, 0xA9, 0xC7, 0xFE, 0x7F, 0xFF, - 0x00, 0xE4, 0x9F, 0xFD, 0xB0, 0x7F, 0x6C, 0x4B, 0xFE, 0x7D, 0xAF, 0xBF, 0xFE, 0x00, 0x7F, 0xC3, - 0x82, 0xCF, 0xFD, 0x1F, 0x17, 0xC4, 0x4F, 0xFC, 0x34, 0xBF, 0xFE, 0x11, 0xD1, 0xFE, 0xA9, 0xC7, - 0xFE, 0x7F, 0xFF, 0x00, 0xE4, 0x9F, 0xFD, 0xB0, 0x7F, 0x6C, 0x4B, 0xFE, 0x7D, 0xAF, 0xBF, 0xFE, - 0x00, 0x7F, 0xC3, 0x82, 0xCF, 0xFD, 0x1F, 0x17, 0xC4, 0x4F, 0xFC, 0x34, 0xBF, 0xFE, 0x11, 0xD1, - 0xFE, 0xA9, 0xC7, 0xFE, 0x7F, 0xFF, 0x00, 0xE4, 0x9F, 0xFD, 0xB0, 0x7F, 0x6C, 0x4B, 0xFE, 0x7D, - 0xAF, 0xBF, 0xFE, 0x00, 0x7F, 0xC3, 0x82, 0xCF, 0xFD, 0x1F, 0x17, 0xC4, 0x4F, 0xFC, 0x34, 0xBF, - 0xFE, 0x11, 0xD1, 0xFE, 0xA9, 0xC7, 0xFE, 0x7F, 0xFF, 0x00, 0xE4, 0x9F, 0xFD, 0xB0, 0x7F, 0x6C, - 0x4B, 0xFE, 0x7D, 0xAF, 0xBF, 0xFE, 0x00, 0x7F, 0xC3, 0x82, 0xCF, 0xFD, 0x1F, 0x17, 0xC4, 0x4F, - 0xFC, 0x34, 0xBF, 0xFE, 0x11, 0xD1, 0xFE, 0xA9, 0xC7, 0xFE, 0x7F, 0xFF, 0x00, 0xE4, 0x9F, 0xFD, - 0xB0, 0x7F, 0x6C, 0x4B, 0xFE, 0x7D, 0xAF, 0xBF, 0xFE, 0x00, 0x7F, 0xC3, 0x82, 0xCF, 0xFD, 0x1F, - 0x17, 0xC4, 0x4F, 0xFC, 0x34, 0xBF, 0xFE, 0x11, 0xD1, 0xFE, 0xA9, 0xC7, 0xFE, 0x7F, 0xFF, 0x00, - 0xE4, 0x9F, 0xFD, 0xB0, 0x7F, 0x6C, 0x4B, 0xFE, 0x7D, 0xAF, 0xBF, 0xFE, 0x00, 0x7F, 0xC3, 0x82, - 0xCF, 0xFD, 0x1F, 0x17, 0xC4, 0x4F, 0xFC, 0x34, 0xBF, 0xFE, 0x11, 0xD1, 0xFE, 0xA9, 0xC7, 0xFE, - 0x7F, 0xFF, 0x00, 0xE4, 0x9F, 0xFD, 0xB0, 0x7F, 0x6C, 0x4B, 0xFE, 0x7D, 0xAF, 0xBF, 0xFE, 0x00, - 0x7F, 0xC3, 0x82, 0xCF, 0xFD, 0x1F, 0x17, 0xC4, 0x4F, 0xFC, 0x34, 0xBF, 0xFE, 0x11, 0xD1, 0xFE, - 0xA9, 0xC7, 0xFE, 0x7F, 0xFF, 0x00, 0xE4, 0x9F, 0xFD, 0xB0, 0x7F, 0x6C, 0x4B, 0xFE, 0x7D, 0xAF, - 0xBF, 0xFE, 0x00, 0x7F, 0xC3, 0x82, 0xCF, 0xFD, 0x1F, 0x17, 0xC4, 0x4F, 0xFC, 0x34, 0xBF, 0xFE, - 0x11, 0xD1, 0xFE, 0xA9, 0xC7, 0xFE, 0x7F, 0xFF, 0x00, 0xE4, 0x9F, 0xFD, 0xB0, 0x7F, 0x6C, 0x4B, - 0xFE, 0x7D, 0xAF, 0xBF, 0xFE, 0x00, 0x7F, 0xC3, 0x82, 0xCF, 0xFD, 0x1F, 0x17, 0xC4, 0x4F, 0xFC, - 0x34, 0xBF, 0xFE, 0x11, 0xD1, 0xFE, 0xA9, 0xC7, 0xFE, 0x7F, 0xFF, 0x00, 0xE4, 0x9F, 0xFD, 0xB0, - 0x7F, 0x6C, 0x4B, 0xFE, 0x7D, 0xAF, 0xBF, 0xFE, 0x00, 0x7F, 0xC3, 0x82, 0xCF, 0xFD, 0x1F, 0x17, - 0xC4, 0x4F, 0xFC, 0x34, 0xBF, 0xFE, 0x11, 0xD1, 0xFE, 0xA9, 0xC7, 0xFE, 0x7F, 0xFF, 0x00, 0xE4, - 0x9F, 0xFD, 0xB0, 0x7F, 0x6C, 0x4B, 0xFE, 0x7D, 0xAF, 0xBF, 0xFE, 0x00, 0x7F, 0xC3, 0x82, 0xCF, - 0xFD, 0x1F, 0x17, 0xC4, 0x4F, 0xFC, 0x34, 0xBF, 0xFE, 0x11, 0xD1, 0xFE, 0xA9, 0xC7, 0xFE, 0x7F, - 0xFF, 0x00, 0xE4, 0x9F, 0xFD, 0xB0, 0x7F, 0x6C, 0x4B, 0xFE, 0x7D, 0xAF, 0xBF, 0xFE, 0x00, 0x7F, - 0xC3, 0x82, 0xCF, 0xFD, 0x1F, 0x17, 0xC4, 0x4F, 0xFC, 0x34, 0xBF, 0xFE, 0x11, 0xD1, 0xFE, 0xA9, - 0xC7, 0xFE, 0x7F, 0xFF, 0x00, 0xE4, 0x9F, 0xFD, 0xB0, 0x7F, 0x6C, 0x4B, 0xFE, 0x7D, 0xAF, 0xBF, - 0xFE, 0x00, 0x7F, 0xC3, 0x82, 0xCF, 0xFD, 0x1F, 0x17, 0xC4, 0x4F, 0xFC, 0x34, 0xBF, 0xFE, 0x11, - 0xD1, 0xFE, 0xA9, 0xC7, 0xFE, 0x7F, 0xFF, 0x00, 0xE4, 0x9F, 0xFD, 0xB0, 0x7F, 0x6C, 0x4B, 0xFE, - 0x7D, 0xAF, 0xBF, 0xFE, 0x00, 0x7F, 0xC3, 0x82, 0xCF, 0xFD, 0x1F, 0x17, 0xC4, 0x4F, 0xFC, 0x34, - 0xBF, 0xFE, 0x11, 0xD1, 0xFE, 0xA9, 0xC7, 0xFE, 0x7F, 0xFF, 0x00, 0xE4, 0x9F, 0xFD, 0xB0, 0x7F, - 0x6C, 0x4B, 0xFE, 0x7D, 0xAF, 0xBF, 0xFE, 0x00, 0x7F, 0xC3, 0x82, 0xCF, 0xFD, 0x1F, 0x17, 0xC4, - 0x4F, 0xFC, 0x34, 0xBF, 0xFE, 0x11, 0xD1, 0xFE, 0xA9, 0xC7, 0xFE, 0x7F, 0xFF, 0x00, 0xE4, 0x9F, - 0xFD, 0xB0, 0x7F, 0x6C, 0x4B, 0xFE, 0x7D, 0xAF, 0xBF, 0xFE, 0x00, 0x7F, 0xC3, 0x82, 0xCF, 0xFD, - 0x1F, 0x17, 0xC4, 0x4F, 0xFC, 0x34, 0xBF, 0xFE, 0x11, 0xD1, 0xFE, 0xA9, 0xC7, 0xFE, 0x7F, 0xFF, - 0x00, 0xE4, 0x9F, 0xFD, 0xB0, 0x7F, 0x6C, 0x4B, 0xFE, 0x7D, 0xAF, 0xBF, 0xFE, 0x00, 0x7F, 0xC3, - 0x82, 0xCF, 0xFD, 0x1F, 0x17, 0xC4, 0x4F, 0xFC, 0x34, 0xBF, 0xFE, 0x11, 0xD1, 0xFE, 0xA9, 0xC7, - 0xFE, 0x7F, 0xFF, 0x00, 0xE4, 0x9F, 0xFD, 0xB0, 0x7F, 0x6C, 0x4B, 0xFE, 0x7D, 0xAF, 0xBF, 0xFE, - 0x00, 0x7F, 0xC3, 0x82, 0xCF, 0xFD, 0x1F, 0x17, 0xC4, 0x4F, 0xFC, 0x34, 0xBF, 0xFE, 0x11, 0xD1, - 0xFE, 0xA9, 0xC7, 0xFE, 0x7F, 0xFF, 0x00, 0xE4, 0x9F, 0xFD, 0xB0, 0x7F, 0x6C, 0x4B, 0xFE, 0x7D, - 0xAF, 0xBF, 0xFE, 0x00, 0x7F, 0xC3, 0x82, 0xCF, 0xFD, 0x1F, 0x17, 0xC4, 0x4F, 0xFC, 0x34, 0xBF, - 0xFE, 0x11, 0xD1, 0xFE, 0xA9, 0xC7, 0xFE, 0x7F, 0xFF, 0x00, 0xE4, 0x9F, 0xFD, 0xB0, 0x7F, 0x6C, - 0x4B, 0xFE, 0x7D, 0xAF, 0xBF, 0xFE, 0x00, 0x7F, 0xC3, 0x82, 0xCF, 0xFD, 0x1F, 0x17, 0xC4, 0x4F, - 0xFC, 0x34, 0xBF, 0xFE, 0x11, 0xD1, 0xFE, 0xA9, 0xC7, 0xFE, 0x7F, 0xFF, 0x00, 0xE4, 0x9F, 0xFD, - 0xB0, 0x7F, 0x6C, 0x4B, 0xFE, 0x7D, 0xAF, 0xBF, 0xFE, 0x00, 0x7F, 0xC3, 0x82, 0xCF, 0xFD, 0x1F, - 0x17, 0xC4, 0x4F, 0xFC, 0x34, 0xBF, 0xFE, 0x11, 0xD1, 0xFE, 0xA9, 0xC7, 0xFE, 0x7F, 0xFF, 0x00, - 0xE4, 0x9F, 0xFD, 0xB0, 0x7F, 0x6C, 0x4B, 0xFE, 0x7D, 0xAF, 0xBF, 0xFE, 0x00, 0x7F, 0xC3, 0x82, - 0xCF, 0xFD, 0x1F, 0x17, 0xC4, 0x4F, 0xFC, 0x34, 0xBF, 0xFE, 0x11, 0xD1, 0xFE, 0xA9, 0xC7, 0xFE, - 0x7F, 0xFF, 0x00, 0xE4, 0x9F, 0xFD, 0xB0, 0x7F, 0x6C, 0x4B, 0xFE, 0x7D, 0xAF, 0xBF, 0xFE, 0x00, - 0x7F, 0xC3, 0x82, 0xCF, 0xFD, 0x1F, 0x17, 0xC4, 0x4F, 0xFC, 0x34, 0xBF, 0xFE, 0x11, 0xD1, 0xFE, - 0xA9, 0xC7, 0xFE, 0x7F, 0xFF, 0x00, 0xE4, 0x9F, 0xFD, 0xB0, 0x7F, 0x6C, 0x4B, 0xFE, 0x7D, 0xAF, - 0xBF, 0xFE, 0x00, 0x7F, 0xC3, 0x82, 0xCF, 0xFD, 0x1F, 0x17, 0xC4, 0x4F, 0xFC, 0x34, 0xBF, 0xFE, - 0x11, 0xD1, 0xFE, 0xA9, 0xC7, 0xFE, 0x7F, 0xFF, 0x00, 0xE4, 0x9F, 0xFD, 0xB0, 0x7F, 0x6C, 0x4B, - 0xFE, 0x7D, 0xAF, 0xBF, 0xFE, 0x00, 0x7F, 0xC3, 0x82, 0xCF, 0xFD, 0x1F, 0x17, 0xC4, 0x4F, 0xFC, - 0x34, 0xBF, 0xFE, 0x11, 0xD1, 0xFE, 0xA9, 0xC7, 0xFE, 0x7F, 0xFF, 0x00, 0xE4, 0x9F, 0xFD, 0xB0, - 0x7F, 0x6C, 0x4B, 0xFE, 0x7D, 0xAF, 0xBF, 0xFE, 0x00, 0x7F, 0xC3, 0x82, 0xCF, 0xFD, 0x1F, 0x17, - 0xC4, 0x4F, 0xFC, 0x34, 0xBF, 0xFE, 0x11, 0xD1, 0xFE, 0xA9, 0xC7, 0xFE, 0x7F, 0xFF, 0x00, 0xE4, - 0x9F, 0xFD, 0xB0, 0x7F, 0x6C, 0x4B, 0xFE, 0x7D, 0xAF, 0xBF, 0xFE, 0x00, 0x7F, 0xC3, 0x82, 0xCF, - 0xFD, 0x1F, 0x17, 0xC4, 0x4F, 0xFC, 0x34, 0xBF, 0xFE, 0x11, 0xD1, 0xFE, 0xA9, 0xC7, 0xFE, 0x7F, - 0xFF, 0x00, 0xE4, 0x9F, 0xFD, 0xB0, 0x7F, 0x6C, 0x4B, 0xFE, 0x7D, 0xAF, 0xBF, 0xFE, 0x00, 0x7F, - 0xC3, 0x82, 0xCF, 0xFD, 0x1F, 0x17, 0xC4, 0x4F, 0xFC, 0x34, 0xBF, 0xFE, 0x11, 0xD1, 0xFE, 0xA9, - 0xC7, 0xFE, 0x7F, 0xFF, 0x00, 0xE4, 0x9F, 0xFD, 0xB0, 0x7F, 0x6C, 0x4B, 0xFE, 0x7D, 0xAF, 0xBF, - 0xFE, 0x00, 0x7F, 0xC3, 0x82, 0xCF, 0xFD, 0x1F, 0x17, 0xC4, 0x4F, 0xFC, 0x34, 0xBF, 0xFE, 0x11, - 0xD1, 0xFE, 0xA9, 0xC7, 0xFE, 0x7F, 0xFF, 0x00, 0xE4, 0x9F, 0xFD, 0xB0, 0x7F, 0x6C, 0x4B, 0xFE, - 0x7D, 0xAF, 0xBF, 0xFE, 0x00, 0x7F, 0xC3, 0x82, 0xCF, 0xFD, 0x1F, 0x17, 0xC4, 0x4F, 0xFC, 0x34, - 0xBF, 0xFE, 0x11, 0xD1, 0xFE, 0xA9, 0xC7, 0xFE, 0x7F, 0xFF, 0x00, 0xE4, 0x9F, 0xFD, 0xB0, 0x7F, - 0x6C, 0x4B, 0xFE, 0x7D, 0xAF, 0xBF, 0xFE, 0x00, 0x7F, 0xC3, 0x82, 0xCF, 0xFD, 0x1F, 0x17, 0xC4, - 0x4F, 0xFC, 0x34, 0xBF, 0xFE, 0x11, 0xD1, 0xFE, 0xA9, 0xC7, 0xFE, 0x7F, 0xFF, 0x00, 0xE4, 0x9F, - 0xFD, 0xB0, 0x7F, 0x6C, 0x4B, 0xFE, 0x7D, 0xAF, 0xBF, 0xFE, 0x00, 0x7F, 0xC3, 0x82, 0xCF, 0xFD, - 0x1F, 0x17, 0xC4, 0x4F, 0xFC, 0x34, 0xBF, 0xFE, 0x11, 0xD1, 0xFE, 0xA9, 0xC7, 0xFE, 0x7F, 0xFF, - 0x00, 0xE4, 0x9F, 0xFD, 0xB0, 0x7F, 0x6C, 0x4B, 0xFE, 0x7D, 0xAF, 0xBF, 0xFE, 0x00, 0x7F, 0xC3, - 0x82, 0xCF, 0xFD, 0x1F, 0x17, 0xC4, 0x4F, 0xFC, 0x34, 0xBF, 0xFE, 0x11, 0xD1, 0xFE, 0xA9, 0xC7, - 0xFE, 0x7F, 0xFF, 0x00, 0xE4, 0x9F, 0xFD, 0xB0, 0x7F, 0x6C, 0x4B, 0xFE, 0x7D, 0xAF, 0xBF, 0xFE, - 0x00, 0x7F, 0xC3, 0x82, 0xCF, 0xFD, 0x1F, 0x17, 0xC4, 0x4F, 0xFC, 0x34, 0xBF, 0xFE, 0x11, 0xD1, - 0xFE, 0xA9, 0xC7, 0xFE, 0x7F, 0xFF, 0x00, 0xE4, 0x9F, 0xFD, 0xB0, 0x7F, 0x6C, 0x4B, 0xFE, 0x7D, - 0xAF, 0xBF, 0xFE, 0x00, 0x7F, 0xC3, 0x82, 0xCF, 0xFD, 0x1F, 0x17, 0xC4, 0x4F, 0xFC, 0x34, 0xBF, - 0xFE, 0x11, 0xD1, 0xFE, 0xA9, 0xC7, 0xFE, 0x7F, 0xFF, 0x00, 0xE4, 0x9F, 0xFD, 0xB0, 0x7F, 0x6C, - 0x4B, 0xFE, 0x7D, 0xAF, 0xBF, 0xFE, 0x00, 0x7F, 0xC3, 0x82, 0xCF, 0xFD, 0x1F, 0x17, 0xC4, 0x4F, - 0xFC, 0x34, 0xBF, 0xFE, 0x11, 0xD1, 0xFE, 0xA9, 0xC7, 0xFE, 0x7F, 0xFF, 0x00, 0xE4, 0x9F, 0xFD, - 0xB0, 0x7F, 0x6C, 0x4B, 0xFE, 0x7D, 0xAF, 0xBF, 0xFE, 0x00, 0x7F, 0xC3, 0x82, 0xCF, 0xFD, 0x1F, - 0x17, 0xC4, 0x4F, 0xFC, 0x34, 0xBF, 0xFE, 0x11, 0xD1, 0xFE, 0xA9, 0xC7, 0xFE, 0x7F, 0xFF, 0x00, - 0xE4, 0x9F, 0xFD, 0xB0, 0x7F, 0x6C, 0x4B, 0xFE, 0x7D, 0xAF, 0xBF, 0xFE, 0x00, 0x7F, 0xC3, 0x82, - 0xCF, 0xFD, 0x1F, 0x17, 0xC4, 0x4F, 0xFC, 0x34, 0xBF, 0xFE, 0x11, 0xD1, 0xFE, 0xA9, 0xC7, 0xFE, - 0x7F, 0xFF, 0x00, 0xE4, 0x9F, 0xFD, 0xB0, 0x7F, 0x6C, 0x4B, 0xFE, 0x7D, 0xAF, 0xBF, 0xFE, 0x00, - 0x7F, 0xC3, 0x82, 0xCF, 0xFD, 0x1F, 0x17, 0xC4, 0x4F, 0xFC, 0x34, 0xBF, 0xFE, 0x11, 0xD1, 0xFE, - 0xA9, 0xC7, 0xFE, 0x7F, 0xFF, 0x00, 0xE4, 0x9F, 0xFD, 0xB0, 0x7F, 0x6C, 0x4B, 0xFE, 0x7D, 0xAF, - 0xBF, 0xFE, 0x00, 0x7F, 0xC3, 0x82, 0xCF, 0xFD, 0x1F, 0x17, 0xC4, 0x4F, 0xFC, 0x34, 0xBF, 0xFE, - 0x11, 0xD1, 0xFE, 0xA9, 0xC7, 0xFE, 0x7F, 0xFF, 0x00, 0xE4, 0x9F, 0xFD, 0xB0, 0x7F, 0x6C, 0x4B, - 0xFE, 0x7D, 0xAF, 0xBF, 0xFE, 0x00, 0x7F, 0xC3, 0x82, 0xCF, 0xFD, 0x1F, 0x17, 0xC4, 0x4F, 0xFC, - 0x34, 0xBF, 0xFE, 0x11, 0xD1, 0xFE, 0xA9, 0xC7, 0xFE, 0x7F, 0xFF, 0x00, 0xE4, 0x9F, 0xFD, 0xB0, - 0x7F, 0x6C, 0x4B, 0xFE, 0x7D, 0xAF, 0xBF, 0xFE, 0x00, 0x7F, 0xC3, 0x82, 0xCF, 0xFD, 0x1F, 0x17, - 0xC4, 0x4F, 0xFC, 0x34, 0xBF, 0xFE, 0x11, 0xD1, 0xFE, 0xA9, 0xC7, 0xFE, 0x7F, 0xFF, 0x00, 0xE4, - 0x9F, 0xFD, 0xB0, 0x7F, 0x6C, 0x4B, 0xFE, 0x7D, 0xAF, 0xBF, 0xFE, 0x00, 0x7F, 0xC3, 0x82, 0xCF, - 0xFD, 0x1F, 0x17, 0xC4, 0x4F, 0xFC, 0x34, 0xBF, 0xFE, 0x11, 0xD1, 0xFE, 0xA9, 0xC7, 0xFE, 0x7F, - 0xFF, 0x00, 0xE4, 0x9F, 0xFD, 0xB0, 0x7F, 0x6C, 0x4B, 0xFE, 0x7D, 0xAF, 0xBF, 0xFE, 0x00, 0x7F, - 0xC3, 0x82, 0xCF, 0xFD, 0x1F, 0x17, 0xC4, 0x4F, 0xFC, 0x34, 0xBF, 0xFE, 0x11, 0xD1, 0xFE, 0xA9, - 0xC7, 0xFE, 0x7F, 0xFF, 0x00, 0xE4, 0x9F, 0xFD, 0xB0, 0x7F, 0x6C, 0x4B, 0xFE, 0x7D, 0xAF, 0xBF, - 0xFE, 0x00, 0x7F, 0xC3, 0x82, 0xCF, 0xFD, 0x1F, 0x17, 0xC4, 0x4F, 0xFC, 0x34, 0xBF, 0xFE, 0x11, - 0xD1, 0xFE, 0xA9, 0xC7, 0xFE, 0x7F, 0xFF, 0x00, 0xE4, 0x9F, 0xFD, 0xB0, 0x7F, 0x6C, 0x4B, 0xFE, - 0x7D, 0xAF, 0xBF, 0xFE, 0x00, 0x7F, 0xC3, 0x82, 0xCF, 0xFD, 0x1F, 0x17, 0xC4, 0x4F, 0xFC, 0x34, - 0xBF, 0xFE, 0x11, 0xD1, 0xFE, 0xA9, 0xC7, 0xFE, 0x7F, 0xFF, 0x00, 0xE4, 0x9F, 0xFD, 0xB0, 0x7F, - 0x6C, 0x4B, 0xFE, 0x7D, 0xAF, 0xBF, 0xFE, 0x00, 0x7F, 0xC3, 0x82, 0xCF, 0xFD, 0x1F, 0x17, 0xC4, - 0x4F, 0xFC, 0x34, 0xBF, 0xFE, 0x11, 0xD1, 0xFE, 0xA9, 0xC7, 0xFE, 0x7F, 0xFF, 0x00, 0xE4, 0x9F, - 0xFD, 0xB0, 0x7F, 0x6C, 0x4B, 0xFE, 0x7D, 0xAF, 0xBF, 0xFE, 0x00, 0x7F, 0xC3, 0x82, 0xCF, 0xFD, - 0x1F, 0x17, 0xC4, 0x4F, 0xFC, 0x34, 0xBF, 0xFE, 0x11, 0xD1, 0xFE, 0xA9, 0xC7, 0xFE, 0x7F, 0xFF, - 0x00, 0xE4, 0x9F, 0xFD, 0xB0, 0x7F, 0x6C, 0x4B, 0xFE, 0x7D, 0xAF, 0xBF, 0xFE, 0x00, 0x7F, 0xC3, - 0x82, 0xCF, 0xFD, 0x1F, 0x17, 0xC4, 0x4F, 0xFC, 0x34, 0xBF, 0xFE, 0x11, 0xD1, 0xFE, 0xA9, 0xC7, - 0xFE, 0x7F, 0xFF, 0x00, 0xE4, 0x9F, 0xFD, 0xB0, 0x7F, 0x6C, 0x4B, 0xFE, 0x7D, 0xAF, 0xBF, 0xFE, - 0x00, 0x7F, 0xC3, 0x82, 0xCF, 0xFD, 0x1F, 0x17, 0xC4, 0x4F, 0xFC, 0x34, 0xBF, 0xFE, 0x11, 0xD1, - 0xFE, 0xA9, 0xC7, 0xFE, 0x7F, 0xFF, 0x00, 0xE4, 0x9F, 0xFD, 0xB0, 0x7F, 0x6C, 0x4B, 0xFE, 0x7D, - 0xAF, 0xBF, 0xFE, 0x00, 0x7F, 0xC3, 0x82, 0xCF, 0xFD, 0x1F, 0x17, 0xC4, 0x4F, 0xFC, 0x34, 0xBF, - 0xFE, 0x11, 0xD1, 0xFE, 0xA9, 0xC7, 0xFE, 0x7F, 0xFF, 0x00, 0xE4, 0x9F, 0xFD, 0xB0, 0x7F, 0x6C, - 0x4B, 0xFE, 0x7D, 0xAF, 0xBF, 0xFE, 0x00, 0x7F, 0xC3, 0x82, 0xCF, 0xFD, 0x1F, 0x17, 0xC4, 0x4F, - 0xFC, 0x34, 0xBF, 0xFE, 0x11, 0xD1, 0xFE, 0xA9, 0xC7, 0xFE, 0x7F, 0xFF, 0x00, 0xE4, 0x9F, 0xFD, - 0xB0, 0x7F, 0x6C, 0x4B, 0xFE, 0x7D, 0xAF, 0xBF, 0xFE, 0x00, 0x7F, 0xC3, 0x82, 0xCF, 0xFD, 0x1F, - 0x17, 0xC4, 0x4F, 0xFC, 0x34, 0xBF, 0xFE, 0x11, 0xD1, 0xFE, 0xA9, 0xC7, 0xFE, 0x7F, 0xFF, 0x00, - 0xE4, 0x9F, 0xFD, 0xB0, 0x7F, 0x6C, 0x4B, 0xFE, 0x7D, 0xAF, 0xBF, 0xFE, 0x00, 0x7F, 0xC3, 0x82, - 0xCF, 0xFD, 0x1F, 0x17, 0xC4, 0x4F, 0xFC, 0x34, 0xBF, 0xFE, 0x11, 0xD1, 0xFE, 0xA9, 0xC7, 0xFE, - 0x7F, 0xFF, 0x00, 0xE4, 0x9F, 0xFD, 0xB0, 0x7F, 0x6C, 0x4B, 0xFE, 0x7D, 0xAF, 0xBF, 0xFE, 0x00, - 0x7F, 0xC3, 0x82, 0xCF, 0xFD, 0x1F, 0x17, 0xC4, 0x4F, 0xFC, 0x34, 0xBF, 0xFE, 0x11, 0xD1, 0xFE, - 0xA9, 0xC7, 0xFE, 0x7F, 0xFF, 0x00, 0xE4, 0x9F, 0xFD, 0xB0, 0x7F, 0x6C, 0x4B, 0xFE, 0x7D, 0xAF, - 0xBF, 0xFE, 0x00, 0x7F, 0xC3, 0x82, 0xCF, 0xFD, 0x1F, 0x17, 0xC4, 0x4F, 0xFC, 0x34, 0xBF, 0xFE, - 0x11, 0xD1, 0xFE, 0xA9, 0xC7, 0xFE, 0x7F, 0xFF, 0x00, 0xE4, 0x9F, 0xFD, 0xB0, 0x7F, 0x6C, 0x4B, - 0xFE, 0x7D, 0xAF, 0xBF, 0xFE, 0x00, 0x7F, 0xC3, 0x82, 0xCF, 0xFD, 0x1F, 0x17, 0xC4, 0x4F, 0xFC, - 0x34, 0xBF, 0xFE, 0x11, 0xD1, 0xFE, 0xA9, 0xC7, 0xFE, 0x7F, 0xFF, 0x00, 0xE4, 0x9F, 0xFD, 0xB0, - 0x7F, 0x6C, 0x4B, 0xFE, 0x7D, 0xAF, 0xBF, 0xFE, 0x01, 0xDE, 0x7C, 0x1E, 0xFF, 0x00, 0x82, 0x1D, - 0xE9, 0x7F, 0x0A, 0x7E, 0x36, 0x7C, 0x1E, 0xF8, 0xD3, 0x77, 0xFB, 0x58, 0x78, 0xAF, 0xC6, 0xB7, - 0xBF, 0x08, 0x7E, 0x25, 0x68, 0x1F, 0x11, 0xAC, 0xF4, 0x2D, 0x57, 0xE1, 0x2C, 0x76, 0x6B, 0xAD, - 0x1D, 0x07, 0x56, 0x82, 0xF9, 0x2C, 0x0D, 0xE1, 0xD7, 0x66, 0x68, 0x12, 0x56, 0xB5, 0xD8, 0x5C, - 0x47, 0x26, 0xCD, 0xE5, 0x82, 0x36, 0x30, 0x77, 0xC3, 0x70, 0xCA, 0xC3, 0x62, 0x29, 0xD7, 0x55, - 0xAF, 0xCB, 0x24, 0xED, 0xCB, 0x6B, 0xD9, 0xA7, 0x6F, 0x8B, 0x4D, 0xBB, 0x11, 0x53, 0x35, 0x95, - 0x4A, 0x52, 0xA5, 0xEC, 0xD2, 0x4D, 0x35, 0xBE, 0xD7, 0x56, 0xEC, 0x7E, 0xEF, 0xD7, 0xD4, 0x1E, - 0x40, 0x50, 0x01, 0x40, 0x05, 0x00, 0x14, 0x00, 0x50, 0x01, 0x40, 0x05, 0x00, 0x14, 0x00, 0x50, - 0x01, 0x40, 0x05, 0x00, 0x14, 0x00, 0x50, 0x01, 0x40, 0x05, 0x00, 0x14, 0x00, 0x50, 0x01, 0x40, - 0x05, 0x00, 0x14, 0x00, 0x50, 0x01, 0x40, 0x05, 0x00, 0x14, 0x00, 0x50, 0x01, 0x40, 0x05, 0x00, - 0x14, 0x00, 0x50, 0x01, 0x40, 0x05, 0x00, 0x14, 0x00, 0x50, 0x01, 0x40, 0x05, 0x00, 0x14, 0x00, - 0x50, 0x01, 0x40, 0x05, 0x00, 0x14, 0x00, 0x50, 0x01, 0x40, 0x05, 0x00, 0x14, 0x00, 0x50, 0x01, - 0x40, 0x05, 0x00, 0x14, 0x00, 0x50, 0x01, 0x40, 0x05, 0x00, 0x14, 0x00, 0x50, 0x01, 0x40, 0x05, - 0x00, 0x14, 0x00, 0x50, 0x01, 0x40, 0x05, 0x00, 0x14, 0x00, 0x50, 0x01, 0x40, 0x05, 0x00, 0x14, - 0x00, 0x50, 0x01, 0x40, 0x05, 0x00, 0x14, 0x00, 0x50, 0x01, 0x40, 0x05, 0x00, 0x14, 0x00, 0x50, - 0x01, 0x40, 0x05, 0x00, 0x14, 0x00, 0x50, 0x01, 0x40, 0x05, 0x00, 0x14, 0x00, 0x50, 0x01, 0x40, - 0x05, 0x00, 0x14, 0x00, 0x50, 0x01, 0x40, 0x05, 0x00, 0x14, 0x00, 0x50, 0x01, 0x40, 0x05, 0x00, - 0x14, 0x00, 0x50, 0x01, 0x40, 0x05, 0x00, 0x14, 0x00, 0x50, 0x01, 0x40, 0x05, 0x00, 0x14, 0x00, - 0x50, 0x01, 0x40, 0x05, 0x00, 0x14, 0x00, 0x50, 0x01, 0x40, 0x05, 0x00, 0x14, 0x00, 0x50, 0x01, - 0x40, 0x05, 0x00, 0x14, 0x00, 0x50, 0x01, 0x40, 0x05, 0x00, 0x14, 0x00, 0x50, 0x01, 0x40, 0x05, - 0x00, 0x14, 0x00, 0x50, 0x01, 0x40, 0x05, 0x00, 0x14, 0x00, 0x50, 0x01, 0x40, 0x05, 0x00, 0x14, - 0x00, 0x50, 0x01, 0x40, 0x05, 0x00, 0x14, 0x00, 0x50, 0x01, 0x40, 0x05, 0x00, 0x14, 0x00, 0x50, - 0x07, 0xFF, 0xD9, -}; - -UINT SizeOfWaterMark() -{ - return sizeof(WaterMark); -} - -UINT SizeOfSaitama() -{ - return sizeof(Saitama); -} - - - +// SoftEther VPN Source Code - Developer Edition Master Branch +// Cedar Communication Module + + +// WaterMark.c +// SoftEther protocol digital watermark data + +#include "CedarPch.h" + +// Digital watermark image data (JPEG) +BYTE WaterMark[] = +{ + 0x47, 0x49, 0x46, 0x38, 0x39, 0x61, 0xC8, 0x00, 0x33, 0x00, 0xF2, 0x00, 0x00, 0x36, 0x37, 0x34, + 0x79, 0x68, 0x54, 0x80, 0x80, 0x80, 0xAF, 0x7F, 0x5B, 0xB3, 0xA8, 0x9D, 0xD5, 0xD5, 0xD4, 0xFF, + 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x2C, 0x00, 0x00, 0x00, 0x00, 0xC8, 0x00, 0x33, 0x00, 0x00, 0x03, + 0xFE, 0x08, 0x1A, 0xDC, 0x34, 0x0A, 0x04, 0x41, 0x6B, 0x65, 0x31, 0x4F, 0x11, 0x80, 0xF9, 0x60, + 0x28, 0x8E, 0x64, 0x69, 0x9E, 0x68, 0xAA, 0xAE, 0x6C, 0xEB, 0x9A, 0x4B, 0xE3, 0x0C, 0x0C, 0x25, + 0x6F, 0x56, 0xA7, 0xE9, 0xD2, 0xEB, 0xFF, 0xC0, 0xA0, 0x70, 0xC8, 0x8A, 0xDC, 0x2C, 0x9C, 0xC6, + 0x05, 0xC7, 0x31, 0x66, 0x24, 0x04, 0xA2, 0x74, 0x4A, 0xAD, 0x4E, 0x05, 0xB1, 0x0D, 0x61, 0xCB, + 0x25, 0xD4, 0xB8, 0x49, 0x1B, 0xE6, 0x19, 0xB1, 0x9A, 0xCF, 0xE8, 0xF4, 0x07, 0x2B, 0x11, 0x74, + 0x09, 0x85, 0x78, 0xFC, 0x0D, 0x6E, 0x90, 0x9F, 0xEA, 0x02, 0x81, 0x12, 0x35, 0xEF, 0x29, 0x6A, + 0x81, 0x2C, 0x04, 0x0A, 0x6E, 0x5C, 0x72, 0x88, 0x7A, 0x7A, 0x6F, 0x4D, 0x77, 0x19, 0x25, 0x71, + 0x16, 0x71, 0x2F, 0x05, 0x92, 0x06, 0x95, 0x80, 0x22, 0x48, 0x16, 0x7D, 0x98, 0x02, 0x9A, 0x7C, + 0x82, 0x06, 0x16, 0x23, 0x7F, 0x02, 0x05, 0x6B, 0x48, 0x70, 0x23, 0x15, 0x7D, 0x1F, 0x98, 0xA8, + 0x21, 0x7F, 0x87, 0x89, 0xB5, 0x8B, 0x7C, 0x7B, 0x3C, 0x8E, 0x23, 0x9E, 0x9B, 0xAE, 0x2B, 0xAD, + 0x20, 0xA6, 0xAC, 0x9B, 0x14, 0xB1, 0xC3, 0x21, 0x15, 0xB1, 0x81, 0x9E, 0x22, 0x9E, 0xAE, 0xC5, + 0x99, 0x20, 0x96, 0xAF, 0xC6, 0xA0, 0x70, 0xB6, 0xB6, 0x5B, 0x03, 0x1C, 0x16, 0x8E, 0x65, 0x21, + 0xBD, 0x9B, 0xCB, 0x2A, 0x9E, 0xCB, 0xC1, 0xE1, 0xD1, 0xA7, 0xA9, 0x6E, 0xE9, 0xD6, 0x82, 0xCD, + 0xC9, 0xCA, 0xD5, 0xD1, 0xAE, 0xBD, 0xCB, 0x7F, 0xAC, 0xB4, 0xD9, 0x73, 0x34, 0x37, 0x76, 0xDF, + 0x3C, 0xC8, 0x9A, 0x07, 0x42, 0x4E, 0x38, 0x4C, 0xAB, 0x0A, 0xFA, 0x12, 0x17, 0xEA, 0x52, 0x05, + 0x12, 0x0C, 0xDB, 0x35, 0xD3, 0xF3, 0xCE, 0xD9, 0x2C, 0x72, 0x13, 0xB7, 0x40, 0x22, 0xE8, 0xFE, + 0xB0, 0x61, 0xC7, 0x4F, 0xEC, 0x40, 0x7E, 0x94, 0xF6, 0x50, 0x13, 0x36, 0x83, 0xA8, 0x6A, 0x79, + 0xF9, 0x77, 0xE3, 0x1B, 0x28, 0x69, 0x1B, 0x55, 0x09, 0x1B, 0x67, 0x8A, 0x1A, 0xA9, 0x52, 0xC5, + 0x50, 0x71, 0x42, 0x82, 0x31, 0xDA, 0xB4, 0x56, 0x15, 0x9D, 0x71, 0xBC, 0x19, 0xF2, 0x27, 0x49, + 0x3E, 0xEF, 0x3C, 0x4E, 0xDB, 0x92, 0xED, 0x52, 0xBF, 0x01, 0xFE, 0x02, 0x44, 0x95, 0xB1, 0x6B, + 0xA0, 0x32, 0x72, 0x0A, 0x25, 0x72, 0x1C, 0xE5, 0x11, 0x99, 0x3C, 0x5F, 0x33, 0x61, 0x72, 0x75, + 0x93, 0x92, 0x28, 0x42, 0xA3, 0x7D, 0x72, 0x9A, 0x20, 0x68, 0x8A, 0x1C, 0x3A, 0x73, 0x3F, 0xE1, + 0x84, 0x82, 0x55, 0xEA, 0xE4, 0xA5, 0xBB, 0x89, 0xDE, 0x4C, 0x60, 0x30, 0x75, 0x0C, 0x9E, 0x97, + 0xD4, 0x8C, 0xC6, 0x32, 0x3B, 0xB4, 0x64, 0xD6, 0x71, 0x46, 0x45, 0x7E, 0x3C, 0x67, 0xB8, 0x30, + 0x20, 0xB8, 0x29, 0x82, 0x3D, 0x73, 0xE7, 0x93, 0x1E, 0xAA, 0x3F, 0x91, 0xD6, 0x89, 0x60, 0x9A, + 0xC8, 0x69, 0x36, 0xA8, 0x1B, 0xA4, 0xFE, 0x23, 0x03, 0x51, 0xED, 0xC7, 0xC4, 0x87, 0x19, 0xB7, + 0xA3, 0xCC, 0x13, 0x2D, 0x65, 0xD5, 0xB1, 0x22, 0x4A, 0xDE, 0xBA, 0xF6, 0xA1, 0x57, 0x7A, 0x0B, + 0xB3, 0x96, 0x3D, 0x95, 0xAF, 0x2E, 0x4A, 0xBC, 0x2A, 0xB9, 0x25, 0x61, 0x09, 0x10, 0x1C, 0x24, + 0x53, 0x7D, 0xBC, 0xA2, 0x33, 0xE0, 0x15, 0x72, 0x58, 0xC5, 0xAF, 0xAD, 0x8A, 0x84, 0x5C, 0x13, + 0xF1, 0xED, 0x13, 0xE6, 0x68, 0x57, 0x3F, 0x85, 0xB5, 0xF7, 0x58, 0xC3, 0xB2, 0x3A, 0xA7, 0x54, + 0xB9, 0x87, 0x86, 0x98, 0xBD, 0xA3, 0x8D, 0xD7, 0xCE, 0x44, 0xD4, 0xF1, 0x74, 0xDA, 0x44, 0x85, + 0x06, 0x25, 0x7C, 0x54, 0xEC, 0x57, 0xE8, 0x26, 0x18, 0xFE, 0x2A, 0xBA, 0xFE, 0xB9, 0xFE, 0xE6, + 0xCD, 0x88, 0x00, 0x57, 0x0B, 0x54, 0xFE, 0x20, 0x31, 0x1A, 0x0F, 0x01, 0x14, 0x94, 0xD0, 0x61, + 0x69, 0x95, 0x14, 0x0F, 0x3B, 0xAE, 0x5C, 0x37, 0x16, 0x56, 0xCF, 0xBD, 0x14, 0xA1, 0x61, 0x12, + 0x0E, 0xA6, 0x14, 0x76, 0x88, 0xBD, 0x44, 0xA1, 0x3C, 0xF6, 0x04, 0x76, 0x90, 0x78, 0xE4, 0x81, + 0x26, 0x80, 0x70, 0x0F, 0x10, 0xA7, 0xC4, 0x61, 0x95, 0x2D, 0xC6, 0x5C, 0x45, 0xCE, 0x89, 0x28, + 0x1B, 0x34, 0x1C, 0xC5, 0xE8, 0xD1, 0x64, 0xAF, 0xAC, 0xE2, 0x1C, 0x0A, 0xE2, 0xEC, 0xE7, 0x62, + 0x4C, 0xE4, 0xB4, 0x05, 0x51, 0x80, 0x93, 0x04, 0xE7, 0x8F, 0x70, 0x01, 0x6C, 0xA1, 0x62, 0x0D, + 0xFE, 0x75, 0xF8, 0xC1, 0x76, 0x3D, 0x55, 0x54, 0x5D, 0x27, 0xD1, 0xE0, 0x23, 0x13, 0x64, 0x3B, + 0x6E, 0x67, 0xCD, 0x8E, 0x28, 0x20, 0x51, 0x5A, 0x50, 0xF2, 0x45, 0x89, 0xDF, 0x2B, 0xB5, 0x78, + 0x26, 0x07, 0x17, 0x04, 0x8A, 0xE6, 0x46, 0x5F, 0x2C, 0x1D, 0x84, 0xDC, 0x24, 0xBC, 0x60, 0xD6, + 0x1D, 0x78, 0x1F, 0x25, 0xA4, 0xE5, 0x7F, 0x75, 0x5E, 0x66, 0x18, 0x97, 0x73, 0xF0, 0x01, 0xA7, + 0x84, 0x27, 0x88, 0x58, 0xA1, 0x09, 0xDE, 0xC5, 0x05, 0x09, 0x3F, 0x88, 0xA0, 0x79, 0x24, 0x54, + 0x0F, 0x80, 0xC6, 0x66, 0x07, 0xA2, 0x44, 0x2A, 0xE9, 0xA4, 0x23, 0x22, 0x3A, 0xC7, 0x36, 0x0D, + 0x0C, 0xD0, 0x28, 0x81, 0xA0, 0xB5, 0x44, 0xE9, 0xA7, 0xA0, 0xA2, 0x71, 0x52, 0x36, 0x70, 0xE8, + 0x25, 0x55, 0x9A, 0x9C, 0x46, 0xE5, 0x8F, 0x40, 0xA1, 0xB6, 0xEA, 0x6A, 0x10, 0xA3, 0x9E, 0x49, + 0x9E, 0x92, 0xA7, 0xA6, 0xCA, 0xA9, 0xA7, 0xAF, 0xE6, 0xAA, 0xEB, 0x0A, 0xA5, 0x4E, 0x99, 0x57, + 0x1D, 0xB5, 0x6E, 0x8A, 0xEA, 0x18, 0xBB, 0x16, 0x6B, 0xAC, 0x3E, 0x71, 0x20, 0xFE, 0x48, 0x16, + 0x36, 0x5D, 0x24, 0xC1, 0xA9, 0xB0, 0x69, 0xEA, 0x70, 0xEC, 0xB4, 0xC6, 0x26, 0xD9, 0x45, 0x0D, + 0x1C, 0x8C, 0x0A, 0x2C, 0x81, 0xD0, 0x76, 0x2A, 0x2D, 0xB5, 0xE0, 0xBE, 0x9A, 0xA4, 0x21, 0xB9, + 0x0C, 0x47, 0x6E, 0x9F, 0xB5, 0xDA, 0xEA, 0x28, 0xB1, 0x25, 0x88, 0x54, 0xD2, 0x98, 0x8D, 0xD5, + 0xA7, 0x09, 0x31, 0xF6, 0x25, 0x33, 0x4A, 0x48, 0x9F, 0x80, 0x34, 0xA6, 0x0A, 0x74, 0x56, 0xA1, + 0xAF, 0x0F, 0x6D, 0x10, 0x27, 0x41, 0x1B, 0x4C, 0x79, 0xA1, 0x2E, 0x5F, 0x9D, 0xAA, 0x67, 0xEF, + 0x1A, 0xD3, 0x30, 0xBC, 0xF0, 0xBD, 0xEE, 0xDE, 0xEB, 0x30, 0x57, 0xF3, 0x36, 0x4C, 0xC2, 0xBF, + 0x12, 0x5B, 0xBC, 0x6F, 0x97, 0x16, 0x9B, 0xB1, 0xB1, 0x0A, 0x59, 0xC8, 0x30, 0x9C, 0xC8, 0xDB, + 0x68, 0x9A, 0xEA, 0x02, 0x09, 0x2B, 0x70, 0x71, 0xC7, 0x15, 0xB3, 0x92, 0x71, 0xBE, 0x1A, 0x67, + 0x3C, 0xF1, 0x57, 0xF8, 0xC2, 0x6C, 0x14, 0xC4, 0xEE, 0xB2, 0x27, 0x33, 0xBC, 0x3A, 0xC3, 0x2C, + 0x2F, 0xC4, 0xEC, 0x8C, 0x25, 0xF1, 0xBB, 0xFD, 0x7E, 0x10, 0xB2, 0x12, 0xC4, 0x91, 0x5B, 0x32, + 0x54, 0x46, 0x14, 0xB7, 0xF2, 0xCC, 0x0F, 0xCF, 0x1B, 0x71, 0xC4, 0x40, 0x83, 0xF2, 0x30, 0xC6, + 0xFA, 0x92, 0x92, 0x35, 0xC3, 0x53, 0x43, 0x87, 0x5F, 0xD7, 0xA9, 0x70, 0xDD, 0xB0, 0xCE, 0x62, + 0x57, 0x6D, 0xF6, 0x98, 0x4D, 0x8B, 0x3C, 0x32, 0xD2, 0xE4, 0xA6, 0x8A, 0xB0, 0x5F, 0x4F, 0xCB, + 0x1C, 0x75, 0xCC, 0x65, 0x57, 0xBD, 0x2F, 0xD9, 0x43, 0x3B, 0xEC, 0xF5, 0xC4, 0xF9, 0x6A, 0xED, + 0x72, 0xCB, 0x36, 0xBF, 0x2C, 0xB8, 0x62, 0x7E, 0x9F, 0x2D, 0xF8, 0x08, 0x69, 0x87, 0xB1, 0xF6, + 0x3F, 0x6B, 0xAA, 0x0B, 0x9A, 0xC2, 0x7C, 0xB7, 0xFB, 0xF7, 0xE0, 0x63, 0xFE, 0xC7, 0x27, 0x35, + 0xDD, 0x18, 0xD3, 0x6D, 0x36, 0xD4, 0x72, 0x53, 0x1E, 0xF9, 0xD4, 0x1D, 0xDB, 0x1C, 0xF8, 0xE8, + 0x24, 0x2C, 0xB0, 0x44, 0x0E, 0x2C, 0x99, 0xDE, 0x6D, 0x9A, 0x90, 0xEF, 0x1C, 0x7A, 0xCB, 0x9E, + 0xBB, 0x1E, 0x35, 0xE9, 0x79, 0xCB, 0x9D, 0x39, 0xE9, 0xF0, 0x8E, 0xAD, 0x7B, 0xD8, 0x86, 0x53, + 0x0D, 0xC8, 0xBF, 0xA0, 0x73, 0x6E, 0x80, 0x12, 0x39, 0x9C, 0x27, 0x72, 0x07, 0x3A, 0xB4, 0xED, + 0x76, 0xEB, 0x5E, 0xC3, 0x44, 0xF8, 0x4D, 0xF1, 0xEE, 0x0D, 0xD8, 0xCD, 0x7A, 0xF7, 0xFD, 0xD0, + 0xEF, 0x1A, 0xE3, 0xFD, 0x12, 0xF5, 0x60, 0x07, 0xBD, 0xB3, 0xCF, 0xA2, 0xE3, 0x9D, 0xB9, 0x01, + 0xA6, 0x9F, 0x6E, 0x7C, 0x0D, 0x18, 0xE8, 0x60, 0x2D, 0xB4, 0xEC, 0x4E, 0x1E, 0x77, 0xB8, 0x81, + 0x7C, 0x9C, 0x06, 0xF1, 0x17, 0xD8, 0x60, 0x6E, 0x68, 0x03, 0x2F, 0xA0, 0x68, 0x54, 0x2A, 0x4B, + 0xFE, 0x3E, 0xFC, 0x6A, 0x90, 0x1F, 0x1A, 0xCA, 0x57, 0xBF, 0xD0, 0x98, 0x2B, 0x09, 0xF9, 0x03, + 0x80, 0x21, 0x6E, 0xD5, 0x3A, 0x00, 0x3A, 0x30, 0x0D, 0x04, 0xB4, 0x1F, 0x0E, 0x8E, 0xE0, 0x17, + 0x23, 0x48, 0xF0, 0x11, 0x67, 0x20, 0xDC, 0xF7, 0xDE, 0xF5, 0x3F, 0xF9, 0x79, 0x29, 0x52, 0x02, + 0x7C, 0x60, 0x1A, 0x70, 0x37, 0xBB, 0xB5, 0xC0, 0xEE, 0x7D, 0x21, 0x94, 0x42, 0x0A, 0x45, 0xE8, + 0xB1, 0xD8, 0xB9, 0x6E, 0x6B, 0xE0, 0x13, 0x9A, 0x0C, 0x59, 0x96, 0xB5, 0x9C, 0xD9, 0x50, 0x6C, + 0xBE, 0x3B, 0x4A, 0xE7, 0x58, 0x28, 0x0A, 0x12, 0x26, 0x06, 0x78, 0x61, 0xEB, 0x59, 0xE4, 0x7E, + 0xF8, 0xB9, 0xDD, 0xE1, 0xAC, 0x88, 0x65, 0xAB, 0x17, 0x0F, 0x03, 0x18, 0x33, 0x0D, 0xC6, 0xCE, + 0x87, 0x14, 0xAB, 0x98, 0x0D, 0xD9, 0x33, 0xC5, 0xC0, 0xD9, 0xAD, 0x55, 0x70, 0x3B, 0x5C, 0xE2, + 0x08, 0xA1, 0x27, 0xBB, 0xBC, 0x05, 0x6F, 0x73, 0xB6, 0xD3, 0x9C, 0x14, 0x61, 0x27, 0x3A, 0xC0, + 0x69, 0x11, 0x84, 0x97, 0x73, 0xA2, 0x17, 0x83, 0xB8, 0x3B, 0xAA, 0x0D, 0xF1, 0x8B, 0x50, 0x1C, + 0xE2, 0x15, 0xCF, 0xD8, 0xC3, 0x34, 0x96, 0x10, 0x86, 0x83, 0xAB, 0x21, 0x19, 0xBD, 0x37, 0x43, + 0x0E, 0xCE, 0x4E, 0x87, 0xE3, 0xA3, 0x63, 0xB8, 0x56, 0x28, 0xC8, 0x42, 0x82, 0xB0, 0x68, 0x86, + 0x4C, 0xA4, 0x22, 0x17, 0xC9, 0xC8, 0x46, 0x3A, 0xF2, 0x91, 0x90, 0x8C, 0xA4, 0x24, 0x75, 0x95, + 0x00, 0x00, 0x3B, +}; + +// Bonus data +BYTE Saitama[] = +{ + 0xFF, 0xD8, 0xFF, 0xE0, 0x00, 0x10, 0x4A, 0x46, 0x49, 0x46, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, + 0x00, 0x01, 0x00, 0x00, 0xFF, 0xDB, 0x00, 0x84, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, + 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02, 0x01, + 0x01, 0x01, 0x02, 0x02, 0x02, 0x03, 0x03, 0x02, 0x02, 0x02, 0x02, 0x03, 0x03, 0x04, 0x03, 0x03, + 0x03, 0x04, 0x03, 0x02, 0x02, 0x04, 0x05, 0x04, 0x04, 0x04, 0x04, 0x05, 0x05, 0x05, 0x03, 0x03, + 0x05, 0x06, 0x05, 0x05, 0x06, 0x04, 0x05, 0x05, 0x04, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, + 0x02, 0x01, 0x01, 0x02, 0x04, 0x03, 0x02, 0x03, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, + 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, + 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, + 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0xFF, 0xC4, 0x01, 0xA2, 0x00, 0x00, + 0x01, 0x05, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0A, 0x0B, 0x01, 0x00, 0x03, 0x01, 0x01, + 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x02, 0x03, + 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0A, 0x0B, 0x10, 0x00, 0x02, 0x01, 0x03, 0x03, 0x02, 0x04, + 0x03, 0x05, 0x05, 0x04, 0x04, 0x00, 0x00, 0x01, 0x7D, 0x01, 0x02, 0x03, 0x00, 0x04, 0x11, 0x05, + 0x12, 0x21, 0x31, 0x41, 0x06, 0x13, 0x51, 0x61, 0x07, 0x22, 0x71, 0x14, 0x32, 0x81, 0x91, 0xA1, + 0x08, 0x23, 0x42, 0xB1, 0xC1, 0x15, 0x52, 0xD1, 0xF0, 0x24, 0x33, 0x62, 0x72, 0x82, 0x09, 0x0A, + 0x16, 0x17, 0x18, 0x19, 0x1A, 0x25, 0x26, 0x27, 0x28, 0x29, 0x2A, 0x34, 0x35, 0x36, 0x37, 0x38, + 0x39, 0x3A, 0x43, 0x44, 0x45, 0x46, 0x47, 0x48, 0x49, 0x4A, 0x53, 0x54, 0x55, 0x56, 0x57, 0x58, + 0x59, 0x5A, 0x63, 0x64, 0x65, 0x66, 0x67, 0x68, 0x69, 0x6A, 0x73, 0x74, 0x75, 0x76, 0x77, 0x78, + 0x79, 0x7A, 0x83, 0x84, 0x85, 0x86, 0x87, 0x88, 0x89, 0x8A, 0x92, 0x93, 0x94, 0x95, 0x96, 0x97, + 0x98, 0x99, 0x9A, 0xA2, 0xA3, 0xA4, 0xA5, 0xA6, 0xA7, 0xA8, 0xA9, 0xAA, 0xB2, 0xB3, 0xB4, 0xB5, + 0xB6, 0xB7, 0xB8, 0xB9, 0xBA, 0xC2, 0xC3, 0xC4, 0xC5, 0xC6, 0xC7, 0xC8, 0xC9, 0xCA, 0xD2, 0xD3, + 0xD4, 0xD5, 0xD6, 0xD7, 0xD8, 0xD9, 0xDA, 0xE1, 0xE2, 0xE3, 0xE4, 0xE5, 0xE6, 0xE7, 0xE8, 0xE9, + 0xEA, 0xF1, 0xF2, 0xF3, 0xF4, 0xF5, 0xF6, 0xF7, 0xF8, 0xF9, 0xFA, 0x11, 0x00, 0x02, 0x01, 0x02, + 0x04, 0x04, 0x03, 0x04, 0x07, 0x05, 0x04, 0x04, 0x00, 0x01, 0x02, 0x77, 0x00, 0x01, 0x02, 0x03, + 0x11, 0x04, 0x05, 0x21, 0x31, 0x06, 0x12, 0x41, 0x51, 0x07, 0x61, 0x71, 0x13, 0x22, 0x32, 0x81, + 0x08, 0x14, 0x42, 0x91, 0xA1, 0xB1, 0xC1, 0x09, 0x23, 0x33, 0x52, 0xF0, 0x15, 0x62, 0x72, 0xD1, + 0x0A, 0x16, 0x24, 0x34, 0xE1, 0x25, 0xF1, 0x17, 0x18, 0x19, 0x1A, 0x26, 0x27, 0x28, 0x29, 0x2A, + 0x35, 0x36, 0x37, 0x38, 0x39, 0x3A, 0x43, 0x44, 0x45, 0x46, 0x47, 0x48, 0x49, 0x4A, 0x53, 0x54, + 0x55, 0x56, 0x57, 0x58, 0x59, 0x5A, 0x63, 0x64, 0x65, 0x66, 0x67, 0x68, 0x69, 0x6A, 0x73, 0x74, + 0x75, 0x76, 0x77, 0x78, 0x79, 0x7A, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87, 0x88, 0x89, 0x8A, 0x92, + 0x93, 0x94, 0x95, 0x96, 0x97, 0x98, 0x99, 0x9A, 0xA2, 0xA3, 0xA4, 0xA5, 0xA6, 0xA7, 0xA8, 0xA9, + 0xAA, 0xB2, 0xB3, 0xB4, 0xB5, 0xB6, 0xB7, 0xB8, 0xB9, 0xBA, 0xC2, 0xC3, 0xC4, 0xC5, 0xC6, 0xC7, + 0xC8, 0xC9, 0xCA, 0xD2, 0xD3, 0xD4, 0xD5, 0xD6, 0xD7, 0xD8, 0xD9, 0xDA, 0xE2, 0xE3, 0xE4, 0xE5, + 0xE6, 0xE7, 0xE8, 0xE9, 0xEA, 0xF2, 0xF3, 0xF4, 0xF5, 0xF6, 0xF7, 0xF8, 0xF9, 0xFA, 0xFF, 0xC0, + 0x00, 0x11, 0x08, 0x01, 0x9B, 0x02, 0x1C, 0x03, 0x01, 0x11, 0x00, 0x02, 0x11, 0x01, 0x03, 0x11, + 0x01, 0xFF, 0xDA, 0x00, 0x0C, 0x03, 0x01, 0x00, 0x02, 0x11, 0x03, 0x11, 0x00, 0x3F, 0x00, 0xFA, + 0xFE, 0xBF, 0x5F, 0x3E, 0x18, 0x28, 0x00, 0xA0, 0x02, 0x80, 0x0A, 0x00, 0x28, 0x00, 0xA0, 0x02, + 0x80, 0x0A, 0x00, 0x28, 0x00, 0xA0, 0x02, 0x80, 0x0A, 0x00, 0x28, 0x00, 0xA0, 0x02, 0x80, 0x0A, + 0x00, 0x28, 0x00, 0xA0, 0x02, 0x80, 0x0A, 0x00, 0x28, 0x00, 0xA0, 0x02, 0x80, 0x0A, 0x00, 0x28, + 0x00, 0xA0, 0x02, 0x80, 0x0A, 0x00, 0x28, 0x00, 0xA0, 0x02, 0x80, 0x0A, 0x00, 0x28, 0x00, 0xA0, + 0x02, 0x80, 0x0A, 0x00, 0x28, 0x00, 0xA0, 0x02, 0x80, 0x0A, 0x00, 0x28, 0x00, 0xA0, 0x02, 0x80, + 0x0A, 0x00, 0x28, 0x00, 0xA0, 0x02, 0x80, 0x0A, 0x00, 0x28, 0x00, 0xA0, 0x02, 0x80, 0x0A, 0x00, + 0x28, 0x00, 0xA0, 0x02, 0x80, 0x0A, 0x00, 0x28, 0x00, 0xA0, 0x02, 0x80, 0x0A, 0x00, 0x28, 0x00, + 0xA0, 0x02, 0x80, 0x0A, 0x00, 0x28, 0x00, 0xA0, 0x02, 0x80, 0x0A, 0x00, 0x28, 0x03, 0xF3, 0xB3, + 0xF6, 0x8A, 0xFF, 0x00, 0x82, 0xA1, 0xFE, 0xCA, 0xFF, 0x00, 0xB2, 0xE7, 0xC5, 0x3D, 0x5F, 0xE0, + 0xEF, 0xC5, 0x3B, 0xCF, 0x1F, 0x41, 0xE3, 0x2D, 0x0F, 0x4E, 0xB0, 0xD4, 0xEF, 0xA3, 0xF0, 0xFF, + 0x00, 0x83, 0x4E, 0xB1, 0xA6, 0x2C, 0x5A, 0x85, 0xA2, 0x5C, 0x5B, 0x6C, 0x9F, 0xCE, 0x4C, 0x9F, + 0x2E, 0x64, 0xC8, 0xDA, 0x30, 0x72, 0x3B, 0x57, 0x93, 0x8A, 0xCE, 0xB0, 0x38, 0x2A, 0xCF, 0x0F, + 0x5A, 0xFC, 0xC9, 0x2D, 0x96, 0x9A, 0xAD, 0x3F, 0x03, 0xB6, 0x86, 0x5F, 0x5E, 0xBD, 0x35, 0x52, + 0x9A, 0x5C, 0xBE, 0xB6, 0xD8, 0xF1, 0xD5, 0xFF, 0x00, 0x82, 0xD9, 0xFE, 0xC4, 0xCD, 0x67, 0x0D, + 0xFA, 0xFF, 0x00, 0xC2, 0xE6, 0x36, 0x33, 0xCA, 0x6D, 0xED, 0xEE, 0xD7, 0xE1, 0x74, 0x9F, 0x66, + 0x99, 0xD4, 0x7C, 0xC9, 0x1B, 0xFD, 0xA3, 0x6B, 0x11, 0xC6, 0x40, 0xE9, 0x59, 0x47, 0x3F, 0xC0, + 0x38, 0xA9, 0x46, 0x32, 0xB3, 0xD1, 0x5A, 0x3D, 0x7B, 0x2F, 0xF2, 0x3A, 0x61, 0x92, 0xE3, 0xE7, + 0x75, 0x4E, 0x17, 0xB2, 0x4F, 0x4E, 0x89, 0xE8, 0xB6, 0x5B, 0x74, 0x42, 0x43, 0xFF, 0x00, 0x05, + 0xB6, 0xFD, 0x88, 0x67, 0x1F, 0xB9, 0xB9, 0xF8, 0xB4, 0xFB, 0x47, 0x2A, 0x3E, 0x1E, 0xA2, 0x32, + 0xE3, 0xB1, 0x53, 0x74, 0x08, 0xE9, 0xD3, 0x15, 0xF7, 0x3C, 0x39, 0xC2, 0x7C, 0x53, 0xC5, 0xD8, + 0x7F, 0xAC, 0xF0, 0xCE, 0x01, 0xE2, 0x29, 0xA4, 0xDF, 0xB9, 0x57, 0x0C, 0x9A, 0x4B, 0x47, 0x78, + 0x4A, 0xB4, 0x66, 0x9F, 0x93, 0x8A, 0x7D, 0x91, 0xC5, 0x5F, 0x0B, 0x2C, 0x24, 0x9D, 0x3C, 0x43, + 0x51, 0x6B, 0x4B, 0x35, 0x25, 0xFF, 0x00, 0xB6, 0x93, 0x47, 0xFF, 0x00, 0x05, 0xAF, 0xFD, 0x89, + 0xA4, 0x46, 0x68, 0xE7, 0xF8, 0xB2, 0xCA, 0x98, 0xDD, 0x8F, 0x00, 0x44, 0x36, 0x8C, 0x71, 0xC7, + 0xDA, 0xC7, 0xA7, 0xA5, 0x7D, 0x16, 0x5B, 0xE1, 0x3F, 0x89, 0x79, 0xB6, 0x16, 0xAE, 0x2F, 0x2D, + 0xC9, 0xA5, 0x3A, 0x74, 0xB4, 0x9B, 0x58, 0x8C, 0x1A, 0x71, 0xF5, 0x8C, 0xB1, 0x2A, 0x5F, 0x72, + 0xB7, 0x4E, 0x86, 0x12, 0xF6, 0x34, 0xDA, 0x8C, 0xAA, 0x24, 0xDE, 0xDA, 0x4B, 0xF4, 0x8D, 0x8F, + 0x54, 0xF8, 0x65, 0xFF, 0x00, 0x05, 0x40, 0xFD, 0x9E, 0x7E, 0x32, 0x4B, 0xAA, 0x5B, 0xFC, 0x32, + 0xF0, 0xDF, 0xC5, 0x8F, 0x14, 0x4F, 0xA2, 0x47, 0x0C, 0xBA, 0xA4, 0x0B, 0xA1, 0x68, 0x9A, 0x14, + 0x96, 0x51, 0xCE, 0xC5, 0x62, 0x90, 0xAD, 0xEE, 0xAD, 0x06, 0xE4, 0xCA, 0x36, 0x59, 0x72, 0xAB, + 0x8C, 0xB1, 0x51, 0x5E, 0x7E, 0x71, 0xE1, 0xDF, 0x1E, 0xF0, 0xF5, 0x18, 0x56, 0xCE, 0x72, 0x99, + 0xD2, 0x84, 0xAF, 0xCB, 0xFB, 0xDC, 0x2C, 0xAF, 0x64, 0x9B, 0xB2, 0x85, 0x79, 0x37, 0x64, 0xD6, + 0x89, 0x79, 0x2D, 0x9A, 0x5C, 0x58, 0xAC, 0xC3, 0x2D, 0xC0, 0xA4, 0xF1, 0x55, 0xD4, 0x63, 0xDF, + 0x92, 0xA3, 0x5D, 0xB7, 0x50, 0x69, 0x7A, 0x36, 0xAD, 0xA7, 0x4B, 0x09, 0x27, 0xFC, 0x15, 0x07, + 0xF6, 0x7A, 0xB6, 0xF8, 0x85, 0x0F, 0xC2, 0x8B, 0xCF, 0x0B, 0xFC, 0x5F, 0xD3, 0x7E, 0x20, 0xCF, + 0x78, 0x9A, 0x7C, 0x1E, 0x1D, 0xD5, 0xFC, 0x33, 0xA4, 0x68, 0xAB, 0x2C, 0xB2, 0x21, 0x68, 0x95, + 0x2F, 0xA7, 0xD5, 0x23, 0xB2, 0x2A, 0xCA, 0x8C, 0x55, 0xC4, 0xDB, 0x1B, 0x18, 0x56, 0x27, 0x8A, + 0xD7, 0x0B, 0xE1, 0xB7, 0x88, 0x18, 0xCC, 0xAA, 0x59, 0xD6, 0x0F, 0x29, 0x94, 0xF0, 0xB1, 0xD1, + 0xCA, 0x35, 0xB0, 0x8E, 0x4B, 0x6F, 0xF9, 0x76, 0xB1, 0x1E, 0xD3, 0x4B, 0xA5, 0xF0, 0x69, 0xB7, + 0x4D, 0x1C, 0x71, 0xF9, 0x6C, 0xA9, 0x2A, 0xB4, 0xEB, 0xA7, 0x06, 0x9B, 0x56, 0x8C, 0xDE, 0x8A, + 0xD7, 0xD1, 0x42, 0xEA, 0xD7, 0x5A, 0x5B, 0xAA, 0xD3, 0x54, 0x69, 0x7C, 0x46, 0xFF, 0x00, 0x82, + 0x94, 0xFC, 0x0F, 0xF8, 0x47, 0x67, 0xA6, 0xDF, 0xFC, 0x46, 0xF0, 0x37, 0xC6, 0xCF, 0x0B, 0xD8, + 0x6A, 0xD7, 0x52, 0x58, 0x69, 0xD7, 0x72, 0xF8, 0x4B, 0x4A, 0xD5, 0x2D, 0xAE, 0x27, 0x84, 0x02, + 0xF0, 0x96, 0xB5, 0xD4, 0xE5, 0x08, 0xE0, 0x11, 0x85, 0x7D, 0xA4, 0xFF, 0x00, 0x08, 0x38, 0xE2, + 0x32, 0x8F, 0x0E, 0xB8, 0xFB, 0x3D, 0x9B, 0xA3, 0x94, 0x65, 0x33, 0x9C, 0x97, 0x4F, 0x6D, 0x85, + 0x83, 0x56, 0xF2, 0x9E, 0x22, 0x3D, 0xB4, 0x5D, 0x74, 0xB5, 0xF4, 0x0C, 0x1E, 0x3F, 0x2D, 0xC7, + 0xCE, 0x54, 0xF0, 0x58, 0x88, 0xC9, 0xC5, 0x2B, 0xA4, 0xA6, 0xB7, 0xDA, 0xD7, 0x82, 0xBD, 0xFA, + 0x25, 0xBD, 0xAC, 0x95, 0xD5, 0x88, 0x63, 0xFF, 0x00, 0x82, 0x99, 0x7C, 0x06, 0x97, 0xC1, 0x96, + 0x7F, 0x10, 0x6D, 0xFC, 0x1F, 0xF1, 0x8A, 0xEB, 0xC1, 0x77, 0xF6, 0xF3, 0x5C, 0x58, 0xEB, 0xD6, + 0x5E, 0x1A, 0xD1, 0xEF, 0x60, 0xBA, 0x4B, 0x76, 0x2B, 0x38, 0x8E, 0x08, 0xF5, 0x56, 0x98, 0xB2, + 0x15, 0x60, 0x53, 0xCB, 0xDC, 0x30, 0x78, 0xC0, 0xE2, 0x9F, 0x86, 0xDE, 0x20, 0xC7, 0x18, 0xF2, + 0xE7, 0x94, 0x4D, 0x57, 0x5B, 0xC3, 0xDB, 0x61, 0x6E, 0xB6, 0xDF, 0xFD, 0xA2, 0xC9, 0x6D, 0xAE, + 0xCB, 0x4B, 0xB4, 0x72, 0xBC, 0xF7, 0x23, 0x85, 0x7F, 0xAA, 0xD4, 0xC5, 0x46, 0x33, 0xDA, 0xD2, + 0x8D, 0x48, 0x76, 0x5B, 0xCA, 0x09, 0x7A, 0x2B, 0xEB, 0xD3, 0x44, 0xED, 0x83, 0xE0, 0x7F, 0xF8, + 0x2A, 0xC7, 0xEC, 0xD5, 0xF1, 0x22, 0xE6, 0xF2, 0xC7, 0xC0, 0xBE, 0x1E, 0xF8, 0xC7, 0xE2, 0x3B, + 0xDD, 0x3E, 0xD1, 0x6F, 0x6E, 0xAC, 0xAD, 0x3C, 0x1B, 0xA7, 0xDA, 0xDE, 0x24, 0x24, 0x90, 0x24, + 0x48, 0x66, 0xD4, 0x63, 0x69, 0x14, 0x15, 0x20, 0xEC, 0x0D, 0x8C, 0x73, 0x8C, 0x8A, 0xD7, 0x13, + 0xE1, 0x87, 0x88, 0x98, 0x2A, 0xB1, 0xA1, 0x8A, 0xCA, 0x25, 0x19, 0x35, 0x75, 0x7A, 0xF8, 0x3B, + 0x34, 0xAC, 0xB4, 0x92, 0xC4, 0xF2, 0xE9, 0x75, 0xA5, 0xEE, 0xBB, 0x59, 0x1D, 0xD8, 0xAC, 0x4E, + 0x0F, 0x03, 0x4E, 0x15, 0x31, 0x35, 0x79, 0x63, 0x2B, 0x28, 0xBE, 0x4A, 0x8D, 0x3B, 0xE8, 0xAD, + 0xCB, 0x07, 0xDB, 0xD2, 0xC9, 0xBD, 0x93, 0xB6, 0x27, 0x8A, 0xBF, 0xE0, 0xAF, 0x7F, 0xB2, 0x87, + 0x81, 0xB5, 0xDB, 0xCF, 0x0B, 0xF8, 0xBB, 0x49, 0xF8, 0xCD, 0xA0, 0x6B, 0xFA, 0x7A, 0xA1, 0xBC, + 0xD2, 0xAF, 0x7E, 0x1F, 0xC1, 0xF6, 0x8B, 0x71, 0x22, 0x06, 0x42, 0x4A, 0x5E, 0xB2, 0x90, 0x54, + 0xA9, 0xE0, 0x9F, 0xD3, 0x8E, 0xAC, 0xBB, 0xC2, 0x3F, 0x13, 0xF3, 0x58, 0xCA, 0x59, 0x66, 0x49, + 0x3A, 0x89, 0x68, 0xF9, 0x6B, 0xE0, 0xDD, 0xAC, 0xED, 0xFF, 0x00, 0x41, 0x3D, 0x1A, 0xB6, 0x9E, + 0x5D, 0x1A, 0x2E, 0x9D, 0x6C, 0x25, 0x4A, 0x6A, 0x70, 0xAA, 0xB9, 0x76, 0xDA, 0x6B, 0xF0, 0x71, + 0x4D, 0x7D, 0xC8, 0xE6, 0xFF, 0x00, 0xE1, 0xF5, 0x7F, 0xB1, 0x48, 0x1F, 0xEB, 0x7E, 0x2C, 0x80, + 0x00, 0xFF, 0x00, 0x99, 0x02, 0x2F, 0xC0, 0x01, 0xF6, 0xBF, 0xA5, 0x74, 0x4B, 0xC1, 0x8F, 0x16, + 0x20, 0xBD, 0xEC, 0x8A, 0x76, 0xFF, 0x00, 0xAF, 0xF8, 0x2F, 0xCB, 0xEB, 0x26, 0x89, 0xD0, 0xB2, + 0xB5, 0x48, 0xDB, 0xD2, 0x5F, 0xFC, 0x88, 0x9F, 0xF0, 0xFA, 0xCF, 0xD8, 0xA0, 0x0F, 0xF5, 0xBF, + 0x16, 0x80, 0x18, 0xFF, 0x00, 0x9A, 0x7F, 0x18, 0x03, 0xD3, 0xFE, 0x5E, 0xFE, 0x95, 0x9F, 0xFC, + 0x41, 0xDF, 0x15, 0x22, 0xB5, 0xC8, 0xAA, 0x5B, 0xFE, 0xBF, 0xE0, 0xFF, 0x00, 0xF9, 0xA4, 0x2F, + 0x43, 0xFE, 0x7E, 0x2F, 0xBA, 0x5F, 0xFC, 0x88, 0x9F, 0xF0, 0xFA, 0xFF, 0x00, 0xD8, 0x98, 0x0F, + 0xF5, 0xFF, 0x00, 0x16, 0x40, 0x18, 0x18, 0xFF, 0x00, 0x84, 0x02, 0x21, 0x8E, 0x38, 0x18, 0xFB, + 0x5D, 0x63, 0x3F, 0x09, 0x7C, 0x4D, 0xA5, 0x16, 0xE7, 0x92, 0xC9, 0x25, 0xFF, 0x00, 0x51, 0x18, + 0x2F, 0x96, 0x9F, 0x59, 0xFB, 0x92, 0xDF, 0xA2, 0x1A, 0x54, 0x74, 0x4A, 0xA2, 0xFB, 0xA5, 0xFF, + 0x00, 0xC8, 0x91, 0x2F, 0xFC, 0x16, 0xD3, 0xF6, 0x22, 0x27, 0x60, 0xB8, 0xF8, 0xB6, 0x08, 0xC0, + 0xF9, 0xBE, 0x1E, 0x2C, 0x6A, 0x3D, 0x30, 0x4D, 0xD0, 0x1D, 0xAB, 0xCA, 0xA3, 0xC0, 0x3C, 0x77, + 0x5B, 0x12, 0xF0, 0x70, 0xC9, 0xEA, 0xA9, 0xAF, 0xE7, 0x95, 0x0A, 0x71, 0xFF, 0x00, 0xC0, 0xE7, + 0x56, 0x34, 0xED, 0xA7, 0x49, 0x59, 0x2B, 0x74, 0xB1, 0x7E, 0xCA, 0x0A, 0x29, 0xF3, 0xC6, 0xDE, + 0x57, 0x7F, 0x82, 0x57, 0xFC, 0x07, 0xBF, 0xFC, 0x16, 0xC7, 0xF6, 0x23, 0x8D, 0xB6, 0x1B, 0xAF, + 0x8A, 0xC4, 0x80, 0x3F, 0xD5, 0xF8, 0x0A, 0x29, 0x13, 0x18, 0xEC, 0xCB, 0x78, 0x47, 0x61, 0xDE, + 0xB4, 0x9F, 0x87, 0x9C, 0x77, 0x4E, 0xA3, 0xA2, 0xF2, 0xB9, 0x73, 0x2E, 0xD5, 0xB0, 0x92, 0x5A, + 0x79, 0xC7, 0x10, 0xE3, 0xF7, 0x3F, 0x24, 0x53, 0xA3, 0x18, 0x59, 0x39, 0xC7, 0xE5, 0x76, 0xBF, + 0x05, 0x6F, 0xF2, 0x23, 0x4F, 0xF8, 0x2D, 0xB7, 0xEC, 0x40, 0xCD, 0xE5, 0xAD, 0xD7, 0xC5, 0x90, + 0x46, 0x07, 0xCF, 0xF0, 0xF5, 0x62, 0x8C, 0x71, 0xC7, 0xCC, 0x6E, 0x82, 0xFA, 0x77, 0xAF, 0x3A, + 0x9F, 0x09, 0x71, 0x75, 0x4A, 0xB3, 0xA1, 0x1C, 0xAE, 0xAA, 0x71, 0xDD, 0xC9, 0xD2, 0x84, 0x57, + 0xFD, 0xBF, 0x3A, 0x91, 0x83, 0xF9, 0x4B, 0x6F, 0x22, 0xA3, 0x86, 0xBD, 0x94, 0x67, 0x1D, 0x76, + 0xD6, 0xDF, 0xA6, 0x9F, 0xD2, 0x10, 0xFF, 0x00, 0xC1, 0x6E, 0x3F, 0x61, 0xF4, 0xE0, 0xDE, 0x7C, + 0x57, 0x00, 0x71, 0xC7, 0xC3, 0xF4, 0x65, 0xC0, 0x1D, 0x01, 0x17, 0x78, 0xED, 0x4B, 0x11, 0xC2, + 0x7C, 0x53, 0x84, 0x6A, 0x35, 0xB0, 0x0D, 0x2E, 0xEA, 0xAE, 0x1A, 0x51, 0xF2, 0xF7, 0xA3, 0x5D, + 0xC7, 0xD1, 0x5F, 0xC9, 0x2D, 0x89, 0x8E, 0x1E, 0xFA, 0x46, 0x4B, 0xEE, 0x6B, 0xF0, 0xB2, 0x18, + 0xBF, 0xF0, 0x5B, 0xCF, 0xD8, 0x70, 0xE0, 0x0B, 0xCF, 0x8B, 0x2A, 0x31, 0xC1, 0x6F, 0x87, 0x62, + 0x34, 0xC0, 0x1D, 0x98, 0xDD, 0x01, 0xDA, 0xB8, 0xA8, 0xE4, 0x99, 0xFD, 0x59, 0xAA, 0x71, 0xC0, + 0xCE, 0x2B, 0xF9, 0xA7, 0x2A, 0x54, 0xE1, 0xFF, 0x00, 0x83, 0x2A, 0x54, 0x8D, 0x3B, 0x2F, 0xF1, + 0x59, 0x22, 0xFE, 0xAB, 0x24, 0x97, 0xBC, 0xBE, 0x57, 0x7F, 0x82, 0x57, 0xFC, 0x06, 0x7F, 0xC3, + 0xF0, 0x3F, 0x61, 0x90, 0x76, 0x0B, 0xEF, 0x8B, 0x04, 0x80, 0x38, 0x5F, 0x87, 0x81, 0x97, 0x18, + 0xE3, 0x04, 0x5D, 0x63, 0xF2, 0xAE, 0x39, 0x61, 0x73, 0x08, 0x57, 0x78, 0x55, 0x86, 0x6E, 0x6B, + 0xA4, 0x67, 0x4A, 0x6B, 0x6E, 0x92, 0x85, 0x49, 0x41, 0xAE, 0xD6, 0x93, 0x5D, 0x8A, 0x58, 0x2A, + 0x9C, 0xA9, 0xA6, 0xAD, 0xF3, 0x5F, 0x85, 0x90, 0xDF, 0xF8, 0x7E, 0x0F, 0xEC, 0x30, 0x38, 0xFB, + 0x77, 0xC5, 0x91, 0x81, 0xD3, 0xFE, 0x15, 0xD0, 0x18, 0xC7, 0x6F, 0xF8, 0xF9, 0xAC, 0x5C, 0x31, + 0x70, 0xBC, 0x65, 0x86, 0x92, 0x6B, 0x4B, 0x37, 0x4D, 0x5B, 0xC9, 0xFB, 0xEA, 0xDE, 0x80, 0xB0, + 0x35, 0x6C, 0xAC, 0xD5, 0xBE, 0x7F, 0xE4, 0x1F, 0xF0, 0xFC, 0x2F, 0xD8, 0x5C, 0x01, 0xFE, 0x9F, + 0xF1, 0x60, 0x0E, 0xDF, 0xF1, 0x6E, 0xC0, 0x1C, 0x74, 0xC7, 0xFA, 0x4D, 0x66, 0xE5, 0x5E, 0x29, + 0x5E, 0x84, 0x92, 0xE9, 0xAD, 0x35, 0xFF, 0x00, 0xB7, 0xFD, 0xDF, 0x80, 0xD6, 0x06, 0xAE, 0xC9, + 0xAF, 0xC7, 0xFC, 0x80, 0x7F, 0xC1, 0x70, 0xBF, 0x61, 0x7C, 0x71, 0x7F, 0xF1, 0x63, 0x03, 0x1C, + 0x0F, 0x87, 0x63, 0x8F, 0x4E, 0x3E, 0xD3, 0xED, 0x49, 0x4E, 0xB5, 0x9B, 0x8D, 0x09, 0x59, 0x6F, + 0x67, 0x4D, 0xDB, 0xE4, 0xA7, 0xFA, 0x7E, 0x40, 0xB0, 0x15, 0x74, 0x57, 0x56, 0xF9, 0xFF, 0x00, + 0x90, 0x9F, 0xF0, 0xFC, 0x3F, 0xD8, 0x5F, 0xA7, 0xDB, 0xFE, 0x2C, 0xFA, 0x63, 0xFE, 0x15, 0xCF, + 0xB7, 0x4C, 0x7D, 0xA6, 0x92, 0xA9, 0x5B, 0x65, 0x42, 0x7F, 0xF9, 0x2F, 0xFF, 0x00, 0x24, 0x1F, + 0x50, 0xAB, 0xDD, 0x7D, 0xFF, 0x00, 0xF0, 0x03, 0xFE, 0x1F, 0x87, 0xFB, 0x0B, 0x0E, 0x3E, 0xDF, + 0xF1, 0x64, 0x76, 0xC7, 0xFC, 0x2B, 0xAC, 0x74, 0x1D, 0x31, 0xF6, 0x9F, 0xA5, 0x27, 0x5A, 0xA4, + 0x2C, 0xA5, 0x46, 0x4B, 0xFF, 0x00, 0x00, 0x5F, 0xFB, 0x70, 0xD6, 0x5F, 0x5B, 0xA3, 0x5F, 0x7F, + 0xFC, 0x01, 0x3F, 0xE1, 0xF8, 0x9F, 0xB0, 0xB7, 0xFC, 0xFF, 0x00, 0xFC, 0x58, 0xFF, 0x00, 0xC3, + 0x75, 0xFF, 0x00, 0xDD, 0x35, 0x1F, 0x5A, 0x69, 0x7F, 0x0A, 0x56, 0xF5, 0x87, 0xFF, 0x00, 0x24, + 0x1F, 0xD9, 0xF5, 0xFB, 0xAF, 0xEB, 0xE4, 0x1F, 0xF0, 0xFC, 0x4F, 0xD8, 0x5B, 0xFE, 0x7F, 0xFE, + 0x2C, 0x7F, 0xE1, 0xBA, 0xFF, 0x00, 0xEE, 0x9A, 0x7F, 0x59, 0x6A, 0xCB, 0xD9, 0x4B, 0xEF, 0x87, + 0xFF, 0x00, 0x24, 0x1F, 0xD9, 0xF5, 0xFB, 0xAF, 0xEB, 0xE4, 0x1F, 0xF0, 0xFC, 0x4F, 0xD8, 0x58, + 0x0F, 0xF8, 0xFF, 0x00, 0xF8, 0xB3, 0x80, 0x3A, 0x0F, 0x87, 0x5D, 0x80, 0xE8, 0x07, 0xDA, 0x7D, + 0xA9, 0x3C, 0x57, 0x2C, 0x5B, 0x74, 0xA5, 0x64, 0xBA, 0x72, 0xF4, 0xF2, 0x52, 0xBF, 0xC9, 0x2F, + 0x24, 0x0B, 0x2E, 0xAF, 0xA2, 0x4D, 0x7D, 0xFF, 0x00, 0xF0, 0x06, 0x8F, 0xF8, 0x2E, 0x3F, 0xEC, + 0x27, 0xD0, 0x6A, 0x1F, 0x16, 0x78, 0xC0, 0xC0, 0xF8, 0x70, 0x70, 0x38, 0xE0, 0x0F, 0xF4, 0x9F, + 0xA5, 0x71, 0xAC, 0xEB, 0x0A, 0xDB, 0x84, 0x69, 0xCD, 0xB4, 0xED, 0x65, 0x1B, 0xEA, 0xAD, 0xA6, + 0x97, 0x57, 0x5A, 0x69, 0xD0, 0xB5, 0x96, 0x62, 0x2C, 0xBE, 0x1B, 0x7A, 0x89, 0xFF, 0x00, 0x0F, + 0xC9, 0xFD, 0x84, 0xBF, 0xE8, 0x23, 0xF1, 0x63, 0xFF, 0x00, 0x0D, 0xC9, 0xFF, 0x00, 0xE4, 0x9A, + 0xC3, 0xFD, 0x63, 0xCB, 0x56, 0x9E, 0xF7, 0xFE, 0x02, 0x35, 0x95, 0x62, 0xAC, 0xAC, 0x95, 0xBD, + 0x7F, 0xE0, 0x07, 0xFC, 0x3F, 0x27, 0xF6, 0x12, 0xFF, 0x00, 0xA0, 0x8F, 0xC5, 0x8F, 0xFC, 0x37, + 0x27, 0xFF, 0x00, 0x92, 0x69, 0x7F, 0xAC, 0x99, 0x67, 0x79, 0x7F, 0xE0, 0x3F, 0xF0, 0x43, 0xFB, + 0x27, 0x15, 0xD9, 0x7D, 0xFF, 0x00, 0xF0, 0x07, 0x37, 0xFC, 0x17, 0x17, 0xF6, 0x15, 0x40, 0xBB, + 0xAF, 0xFE, 0x2D, 0x28, 0x65, 0x05, 0x7F, 0xE2, 0xDC, 0x10, 0x08, 0x23, 0x8C, 0x7F, 0xA4, 0xFD, + 0x2B, 0x79, 0x67, 0x78, 0x3A, 0x74, 0x63, 0x88, 0x94, 0x65, 0xEC, 0xDE, 0x8A, 0x5C, 0xBE, 0xEB, + 0x6B, 0xA2, 0x69, 0xDA, 0xEB, 0xAA, 0xDD, 0x6C, 0xD2, 0xB5, 0x87, 0x2C, 0xA3, 0x17, 0x09, 0x2A, + 0x72, 0x49, 0x3B, 0x27, 0x6B, 0xDB, 0x46, 0xB4, 0x76, 0xB6, 0xD6, 0xB5, 0x84, 0x5F, 0xF8, 0x2E, + 0x37, 0xEC, 0x28, 0x47, 0xCB, 0x7F, 0xF1, 0x68, 0x85, 0xC0, 0x3B, 0x7E, 0x1C, 0x1C, 0x2E, 0x7A, + 0x0F, 0xF8, 0xF9, 0xAE, 0x7F, 0xF5, 0x97, 0x2B, 0x8D, 0x93, 0x6D, 0x7C, 0xBB, 0x7C, 0xCA, 0x86, + 0x4D, 0x8E, 0x92, 0x6E, 0x11, 0x4D, 0x2B, 0x6D, 0xD2, 0xFA, 0x2D, 0x96, 0x97, 0xD9, 0x7E, 0x01, + 0xFF, 0x00, 0x0F, 0xC7, 0xFD, 0x85, 0x02, 0x86, 0xFE, 0xD0, 0xF8, 0xB4, 0x10, 0xFC, 0xAA, 0x7F, + 0xE1, 0x5C, 0x10, 0xB9, 0x03, 0x90, 0x0F, 0xDA, 0x7E, 0x95, 0xA2, 0xE2, 0x1C, 0xBB, 0x91, 0xCE, + 0x2A, 0x5C, 0xAA, 0xDB, 0x47, 0x45, 0x7B, 0xDB, 0xAE, 0x97, 0xB3, 0xB7, 0xA1, 0x9A, 0xCB, 0x31, + 0x17, 0xE4, 0x56, 0xBF, 0x6B, 0xFF, 0x00, 0xC0, 0x24, 0x87, 0xFE, 0x0B, 0x85, 0xFB, 0x0C, 0x4D, + 0xB8, 0x45, 0x7D, 0xF1, 0x65, 0x84, 0x69, 0xBD, 0xFF, 0x00, 0xE2, 0xDD, 0x05, 0x08, 0xA3, 0xB9, + 0xCD, 0xC8, 0xF6, 0xAF, 0x63, 0x25, 0xFA, 0xCF, 0x10, 0xFB, 0x75, 0x92, 0xE1, 0xE5, 0x55, 0x51, + 0x83, 0xA9, 0x52, 0xCE, 0x11, 0x50, 0x82, 0x69, 0x39, 0x37, 0x39, 0xC5, 0x59, 0x36, 0x96, 0x8D, + 0xBF, 0x2B, 0x19, 0xD4, 0xC0, 0x55, 0xA0, 0xA3, 0xED, 0x1A, 0x57, 0xD1, 0x7F, 0x49, 0x11, 0x7F, + 0xC3, 0xF2, 0x3F, 0x61, 0x30, 0x07, 0xFC, 0x4C, 0x7E, 0x2C, 0x0E, 0x38, 0x1F, 0xF0, 0xAE, 0x4F, + 0x00, 0x74, 0x18, 0xFB, 0x4F, 0xD2, 0xBC, 0x89, 0xE7, 0xF8, 0x0A, 0x36, 0x53, 0x52, 0x4F, 0xB5, + 0x95, 0xFE, 0x69, 0x3B, 0xAF, 0x2B, 0xA5, 0x75, 0x66, 0xB4, 0xB1, 0xA4, 0x72, 0xBC, 0x4B, 0x5E, + 0xEA, 0x56, 0xF5, 0xFF, 0x00, 0x80, 0x1F, 0xF0, 0xFC, 0x9F, 0xD8, 0x4B, 0xFE, 0x82, 0x3F, 0x16, + 0x3F, 0xF0, 0xDC, 0x9F, 0xFE, 0x49, 0xAC, 0xFF, 0x00, 0xD6, 0x4C, 0xB3, 0xBC, 0xBF, 0xF0, 0x1F, + 0xF8, 0x23, 0xFE, 0xC9, 0xC5, 0x76, 0x5F, 0x7F, 0xFC, 0x00, 0xFF, 0x00, 0x87, 0xE4, 0xFE, 0xC2, + 0x5F, 0xF4, 0x11, 0xF8, 0xB1, 0xFF, 0x00, 0x86, 0xE4, 0xFF, 0x00, 0xF2, 0x4D, 0x1F, 0xEB, 0x26, + 0x59, 0xDE, 0x5F, 0xF8, 0x0F, 0xFC, 0x10, 0xFE, 0xC9, 0xC5, 0x76, 0x5F, 0x7F, 0xFC, 0x03, 0x67, + 0x44, 0xFF, 0x00, 0x82, 0xD2, 0xFE, 0xC6, 0x5E, 0x24, 0xD5, 0x2C, 0xB4, 0x3F, 0x0F, 0x5B, 0x7C, + 0x6C, 0xD6, 0xF5, 0x8D, 0x44, 0x1F, 0xEC, 0xFD, 0x2F, 0x4A, 0xF8, 0x59, 0x25, 0xED, 0xF5, 0xD8, + 0x54, 0x2C, 0xDE, 0x5C, 0x49, 0x70, 0x58, 0xE1, 0x51, 0xCF, 0x03, 0x80, 0xA4, 0xF6, 0xAD, 0xE9, + 0xE7, 0x78, 0x3A, 0xA9, 0x3A, 0x71, 0x95, 0xB6, 0xBD, 0x92, 0x5B, 0x5E, 0xD7, 0x6D, 0x24, 0xEC, + 0xB4, 0x57, 0x57, 0xB6, 0x86, 0x53, 0xC0, 0xD5, 0xA5, 0x07, 0x39, 0xB4, 0x92, 0xDF, 0x5E, 0xDD, + 0x92, 0x57, 0x7F, 0x24, 0x5F, 0xF1, 0x1F, 0xFC, 0x16, 0x4B, 0xF6, 0x40, 0xF0, 0x79, 0xB0, 0x5F, + 0x13, 0xD8, 0x7C, 0x6A, 0xD1, 0x06, 0xA5, 0xA6, 0x5B, 0xEA, 0xF6, 0x06, 0xEF, 0xE1, 0xA0, 0xF2, + 0xEE, 0x2D, 0x6E, 0xD0, 0xB5, 0xB4, 0xAA, 0xEB, 0x74, 0x54, 0x6F, 0x55, 0x62, 0x14, 0x90, 0xC3, + 0x1C, 0x81, 0x5B, 0x62, 0x33, 0x3A, 0x78, 0x48, 0x46, 0xA5, 0x7A, 0x53, 0x8C, 0x1A, 0x4D, 0x3E, + 0x5B, 0xC6, 0xCF, 0x44, 0xEE, 0x9B, 0x5A, 0xDB, 0x4D, 0x76, 0xB5, 0xB4, 0xB1, 0x34, 0xF0, 0x73, + 0xA9, 0x2F, 0x65, 0x09, 0x47, 0x9B, 0xB5, 0xEC, 0xEC, 0xAD, 0xB2, 0x69, 0x3B, 0x2D, 0x35, 0x4A, + 0xDD, 0x0E, 0x6F, 0xFE, 0x1F, 0x87, 0xFB, 0x0C, 0x02, 0x89, 0xF6, 0xCF, 0x8B, 0xA1, 0x9F, 0x02, + 0x34, 0xFF, 0x00, 0x85, 0x6C, 0xC0, 0xBF, 0xA0, 0x51, 0xF6, 0x9E, 0x7B, 0x74, 0xAC, 0x5E, 0x77, + 0x85, 0x83, 0x8C, 0x25, 0x4E, 0x69, 0xB5, 0x74, 0xB9, 0x1A, 0xBA, 0xB6, 0xE9, 0x76, 0xB7, 0x6D, + 0x2C, 0x68, 0xB2, 0xEA, 0xDC, 0xAE, 0x4A, 0x51, 0xE5, 0x5B, 0xBB, 0xAB, 0x2F, 0xF2, 0x23, 0xFF, + 0x00, 0x87, 0xE3, 0xFE, 0xC2, 0x80, 0xED, 0xFE, 0xD0, 0xF8, 0xB2, 0x08, 0xF9, 0x76, 0xFF, 0x00, + 0xC2, 0xB8, 0x20, 0x82, 0x3B, 0x63, 0xED, 0x3E, 0xD5, 0x9A, 0xE2, 0x0C, 0x03, 0x9A, 0xA5, 0x18, + 0xCB, 0x9B, 0x6B, 0x72, 0xEB, 0x7D, 0xAD, 0x6F, 0xD0, 0xA5, 0x95, 0xE2, 0x79, 0x53, 0x5C, 0xB6, + 0xF5, 0xD0, 0x07, 0xFC, 0x17, 0x23, 0xF6, 0x13, 0xC7, 0x1A, 0x8F, 0xC5, 0x9C, 0x0C, 0x0E, 0x3E, + 0x1C, 0x1C, 0x0F, 0x41, 0xFF, 0x00, 0x1F, 0x3E, 0xD4, 0x97, 0x10, 0xE5, 0xFC, 0xAE, 0x49, 0x4B, + 0x95, 0x5A, 0xFE, 0xEE, 0x8B, 0xB7, 0xA6, 0xDA, 0x0D, 0x65, 0x58, 0x9D, 0x12, 0xB7, 0xDE, 0x03, + 0xFE, 0x0B, 0x91, 0xFB, 0x09, 0xF0, 0x06, 0xA3, 0xF1, 0x67, 0xD8, 0x0F, 0x87, 0x27, 0xB0, 0xEC, + 0x3E, 0xD3, 0xED, 0x44, 0x38, 0x87, 0x2E, 0x93, 0x51, 0x82, 0x93, 0x7D, 0x94, 0x7B, 0x79, 0x2E, + 0xC8, 0x3F, 0xB2, 0xB1, 0x49, 0x6C, 0xAD, 0xEB, 0xFF, 0x00, 0x00, 0x3F, 0xE1, 0xF9, 0x3F, 0xB0, + 0x97, 0xFD, 0x04, 0x7E, 0x2C, 0x7F, 0xE1, 0xB9, 0x3F, 0xFC, 0x93, 0x53, 0xFE, 0xB2, 0x65, 0x9D, + 0xE5, 0xFF, 0x00, 0x80, 0xFF, 0x00, 0xC1, 0x0F, 0xEC, 0x9C, 0x57, 0x65, 0xF7, 0xFF, 0x00, 0xC0, + 0x0F, 0xF8, 0x7E, 0x4F, 0xEC, 0x25, 0xFF, 0x00, 0x41, 0x1F, 0x8B, 0x1F, 0xF8, 0x6E, 0x4F, 0xFF, + 0x00, 0x24, 0xD1, 0xFE, 0xB2, 0x65, 0x89, 0x2D, 0x65, 0x6F, 0xF0, 0xFF, 0x00, 0xC1, 0x0F, 0xEC, + 0x9C, 0x57, 0x65, 0xF7, 0xFF, 0x00, 0xC0, 0x0F, 0xF8, 0x7E, 0x4F, 0xEC, 0x25, 0xFF, 0x00, 0x41, + 0x1F, 0x8B, 0x1F, 0xF8, 0x6E, 0x4F, 0xFF, 0x00, 0x24, 0xD1, 0xFE, 0xB2, 0x65, 0x9D, 0xE5, 0xFF, + 0x00, 0x80, 0xFF, 0x00, 0xC1, 0x0F, 0xEC, 0x9C, 0x57, 0x65, 0xF7, 0xFF, 0x00, 0xC0, 0x03, 0xFF, + 0x00, 0x05, 0xC7, 0xFD, 0x85, 0x17, 0x00, 0xEA, 0x1F, 0x16, 0x57, 0xE5, 0x04, 0x03, 0xF0, 0xE0, + 0x8E, 0x08, 0xE0, 0x81, 0xF6, 0x9E, 0x9D, 0x29, 0x2E, 0x25, 0xCA, 0xDA, 0xF7, 0x5C, 0xAD, 0xE9, + 0xFF, 0x00, 0x04, 0xA9, 0x64, 0xF8, 0xD8, 0x59, 0x4A, 0x29, 0x68, 0x9A, 0xBE, 0x9A, 0x3D, 0xBA, + 0x6D, 0x6D, 0x83, 0xFE, 0x1F, 0x93, 0xFB, 0x09, 0x7F, 0xD0, 0x47, 0xE2, 0xC7, 0xFE, 0x1B, 0x93, + 0xFF, 0x00, 0xC9, 0x34, 0xFF, 0x00, 0xD6, 0x4C, 0xB3, 0xBC, 0xBF, 0xF0, 0x1F, 0xF8, 0x24, 0xFF, + 0x00, 0x64, 0xE2, 0xBB, 0x2F, 0xBF, 0xFE, 0x00, 0x7F, 0xC3, 0xF2, 0x7F, 0x61, 0x2F, 0xFA, 0x08, + 0xFC, 0x58, 0xFF, 0x00, 0xC3, 0x72, 0x7F, 0xF9, 0x26, 0x8F, 0xF5, 0x93, 0x2C, 0xEF, 0x2F, 0xFC, + 0x07, 0xFE, 0x08, 0x7F, 0x64, 0xE2, 0xBB, 0x2F, 0xBF, 0xFE, 0x00, 0x7F, 0xC3, 0xF2, 0x7F, 0x61, + 0x2F, 0xFA, 0x08, 0xFC, 0x58, 0xFF, 0x00, 0xC3, 0x72, 0x7F, 0xF9, 0x26, 0x8F, 0xF5, 0x93, 0x2C, + 0xEF, 0x2F, 0xFC, 0x07, 0xFE, 0x08, 0x7F, 0x64, 0xE2, 0xBB, 0x2F, 0xBF, 0xFE, 0x00, 0xE4, 0xFF, + 0x00, 0x82, 0xE2, 0xFE, 0xC2, 0xAE, 0x42, 0xA5, 0xFF, 0x00, 0xC5, 0xA3, 0xD8, 0x01, 0xF0, 0xE0, + 0x81, 0xC0, 0xE9, 0xFF, 0x00, 0x1F, 0x3F, 0x4A, 0xED, 0xC1, 0x66, 0x54, 0xF3, 0x09, 0xC6, 0x8E, + 0x06, 0x94, 0xE7, 0x27, 0xB5, 0xA3, 0x65, 0xA2, 0xEE, 0xDA, 0x4A, 0xDE, 0xAB, 0xA2, 0xEC, 0x89, + 0x96, 0x5B, 0x5E, 0x9A, 0xF7, 0x9C, 0x52, 0xF5, 0xFF, 0x00, 0x80, 0x5C, 0x4F, 0xF8, 0x2D, 0xB7, + 0xEC, 0x40, 0xEA, 0x0A, 0x5D, 0x7C, 0x59, 0x23, 0xA0, 0xC7, 0xC3, 0xD5, 0x5E, 0x83, 0xD3, 0xED, + 0x43, 0xDA, 0xBE, 0xDB, 0x07, 0xC1, 0x7C, 0x63, 0x8E, 0xA7, 0x1A, 0x98, 0x4C, 0xB2, 0x6E, 0x2F, + 0x6F, 0x7F, 0x0F, 0x1F, 0xC2, 0x55, 0x93, 0xFC, 0x0E, 0x57, 0x45, 0x43, 0x47, 0x25, 0xF8, 0xFE, + 0x88, 0x5F, 0xF8, 0x7D, 0xA7, 0xEC, 0x44, 0x38, 0xFB, 0x4F, 0xC5, 0x91, 0x81, 0xFF, 0x00, 0x44, + 0xF9, 0x30, 0x30, 0x3A, 0x7F, 0xC7, 0xDF, 0xD2, 0xBA, 0xDF, 0x87, 0xDC, 0x77, 0x15, 0xAE, 0x55, + 0x3B, 0x79, 0x55, 0xC3, 0x3F, 0xCA, 0xBB, 0xFC, 0x04, 0xA9, 0xC3, 0x44, 0xA6, 0xBF, 0x1F, 0xF2, + 0x01, 0xFF, 0x00, 0x05, 0xB4, 0xFD, 0x88, 0x71, 0xFF, 0x00, 0x1F, 0x5F, 0x16, 0x46, 0x38, 0xC7, + 0xFC, 0x2B, 0xD4, 0x1D, 0x07, 0x18, 0xFF, 0x00, 0x4A, 0xFA, 0x56, 0x1F, 0xEA, 0x37, 0x1A, 0x47, + 0x4F, 0xEC, 0xB9, 0xFF, 0x00, 0xE0, 0xCC, 0x37, 0xFF, 0x00, 0x2E, 0x1A, 0xA2, 0xAC, 0xAD, 0x25, + 0x6F, 0x9F, 0xF9, 0x07, 0xFC, 0x3E, 0xD7, 0xF6, 0x20, 0x18, 0x1F, 0x6A, 0xF8, 0xB3, 0xD0, 0x70, + 0x3E, 0x1E, 0xA6, 0x00, 0xED, 0xFF, 0x00, 0x2F, 0x55, 0x3F, 0xEA, 0x4F, 0x19, 0xAD, 0x3F, 0xB3, + 0x27, 0xD3, 0xFE, 0x5E, 0x61, 0xFF, 0x00, 0xF9, 0x77, 0xFC, 0x37, 0x5B, 0x68, 0x1E, 0xC5, 0x59, + 0x7B, 0xCA, 0xDF, 0x3F, 0xF2, 0x2A, 0xCB, 0xFF, 0x00, 0x05, 0xC1, 0xFD, 0x86, 0x2D, 0xC8, 0x49, + 0x6F, 0xBE, 0x2D, 0x46, 0x71, 0xC0, 0xFF, 0x00, 0x85, 0x75, 0x91, 0x80, 0x3B, 0x11, 0x73, 0x8F, + 0x4A, 0xF9, 0x6C, 0xEF, 0xEB, 0x5C, 0x35, 0x5E, 0x38, 0x5C, 0xF3, 0x0D, 0x3A, 0x33, 0x7B, 0x26, + 0xA3, 0x24, 0xEC, 0x96, 0xCE, 0x12, 0x94, 0x5A, 0x57, 0x5B, 0x3F, 0x2E, 0x86, 0xF4, 0xB0, 0x15, + 0x6B, 0x46, 0xF4, 0x9A, 0x6B, 0xD6, 0xDF, 0xA2, 0x22, 0xFF, 0x00, 0x87, 0xE4, 0xFE, 0xC2, 0x5F, + 0xF4, 0x11, 0xF8, 0xB1, 0xFF, 0x00, 0x86, 0xE4, 0xFF, 0x00, 0xF2, 0x4D, 0x78, 0x7F, 0xEB, 0x26, + 0x59, 0xDE, 0x5F, 0xF8, 0x0F, 0xFC, 0x13, 0x5F, 0xEC, 0x9C, 0x57, 0x65, 0xF7, 0xFF, 0x00, 0xC0, + 0x0F, 0xF8, 0x7E, 0x4F, 0xEC, 0x25, 0xFF, 0x00, 0x41, 0x1F, 0x8B, 0x1F, 0xF8, 0x6E, 0x4F, 0xFF, + 0x00, 0x24, 0xD1, 0xFE, 0xB2, 0x65, 0x9D, 0xE5, 0xFF, 0x00, 0x80, 0xFF, 0x00, 0xC1, 0x0F, 0xEC, + 0x9C, 0x57, 0x65, 0xF7, 0xFF, 0x00, 0xC0, 0x0F, 0xF8, 0x7E, 0x4F, 0xEC, 0x25, 0xFF, 0x00, 0x41, + 0x1F, 0x8B, 0x1F, 0xF8, 0x6E, 0x4F, 0xFF, 0x00, 0x24, 0xD1, 0xFE, 0xB2, 0x65, 0x9D, 0xE5, 0xFF, + 0x00, 0x80, 0xFF, 0x00, 0xC1, 0x0F, 0xEC, 0x9C, 0x57, 0x65, 0xF7, 0xFF, 0x00, 0xC0, 0x3B, 0xAF, + 0x08, 0xFF, 0x00, 0xC1, 0x5E, 0xBF, 0x65, 0x5F, 0x1D, 0xB8, 0x8F, 0xC1, 0xDE, 0x1F, 0xF8, 0xED, + 0xAF, 0x0E, 0x07, 0x9D, 0x65, 0xF0, 0xB4, 0xC7, 0x66, 0x3D, 0x01, 0xB8, 0x7B, 0xA5, 0x88, 0x74, + 0xE8, 0x58, 0x57, 0x44, 0x33, 0x9C, 0x2C, 0xE2, 0xA5, 0x08, 0x4E, 0xCF, 0x6F, 0x75, 0x2B, 0xFA, + 0x5D, 0xAB, 0xFC, 0x8C, 0x67, 0x82, 0x9D, 0x2D, 0x27, 0x28, 0xAF, 0x2B, 0xFE, 0x89, 0x1E, 0xA6, + 0x3F, 0xE0, 0xA1, 0xDF, 0x09, 0x76, 0x07, 0xFF, 0x00, 0x85, 0x71, 0xF1, 0xC4, 0x26, 0x38, 0xFF, + 0x00, 0x8A, 0x53, 0x47, 0x04, 0x01, 0xEA, 0xBF, 0xDA, 0xB9, 0x1D, 0x07, 0x6F, 0x4A, 0xDD, 0x66, + 0x11, 0xB5, 0xD5, 0x19, 0xDB, 0xBF, 0x2A, 0xB7, 0xE7, 0x63, 0x0F, 0x65, 0x04, 0xBE, 0x38, 0xFE, + 0x3F, 0xE4, 0x79, 0xA7, 0x8B, 0x3F, 0xE0, 0xAE, 0x1F, 0xB2, 0xEF, 0x80, 0xD7, 0x77, 0x8B, 0xBC, + 0x35, 0xF1, 0xDF, 0x42, 0x88, 0x0E, 0x6E, 0x2E, 0x3E, 0x17, 0x79, 0xF6, 0x49, 0x83, 0x8C, 0x19, + 0xE2, 0xBA, 0x78, 0x87, 0x4E, 0x85, 0x85, 0x63, 0x3C, 0xE3, 0x0B, 0x4A, 0x37, 0x9C, 0x24, 0x97, + 0xF8, 0x56, 0x96, 0xB7, 0x44, 0xF4, 0xDD, 0x76, 0xED, 0xD1, 0xA5, 0xB5, 0x3C, 0x1C, 0xEA, 0x59, + 0x53, 0x94, 0x7E, 0xFB, 0x7E, 0x87, 0x9E, 0xFF, 0x00, 0xC3, 0xF2, 0x7F, 0x61, 0x2F, 0xFA, 0x08, + 0xFC, 0x58, 0xFF, 0x00, 0xC3, 0x72, 0x7F, 0xF9, 0x26, 0xB9, 0xBF, 0xD6, 0x4C, 0xB3, 0xBC, 0xBF, + 0xF0, 0x1F, 0xF8, 0x26, 0xFF, 0x00, 0xD9, 0x38, 0xAE, 0xCB, 0xEF, 0xFF, 0x00, 0x80, 0x7D, 0x93, + 0xFB, 0x25, 0x7E, 0xDB, 0x5F, 0x04, 0x7F, 0x6D, 0x48, 0x3E, 0x22, 0xDC, 0x7C, 0x0F, 0x3E, 0x31, + 0xBB, 0xB7, 0xF8, 0x58, 0x74, 0x75, 0xF1, 0x64, 0xBE, 0x25, 0xF0, 0xC9, 0xD0, 0x52, 0x03, 0xAE, + 0x2D, 0xF9, 0xB1, 0xF2, 0x71, 0x23, 0xEF, 0x18, 0xD1, 0x6F, 0x4B, 0x13, 0xB4, 0x2E, 0x13, 0xAE, + 0x7E, 0x5F, 0x43, 0x01, 0x99, 0x61, 0xB3, 0x05, 0x3F, 0xAB, 0x5E, 0xD1, 0xB5, 0xEE, 0xAD, 0xBD, + 0xED, 0x6F, 0xB8, 0xE6, 0xC4, 0x61, 0x2A, 0xE1, 0x79, 0x55, 0x44, 0xB5, 0xDA, 0xDE, 0x56, 0xFF, + 0x00, 0x34, 0x7D, 0x77, 0x5D, 0xE7, 0x30, 0x50, 0x01, 0x40, 0x05, 0x00, 0x7F, 0x14, 0x5F, 0xF0, + 0x5A, 0xFF, 0x00, 0xF9, 0x48, 0x1F, 0xC4, 0x8F, 0xFB, 0x12, 0xFC, 0x27, 0xFF, 0x00, 0xA8, 0xF5, + 0xAD, 0x7E, 0x75, 0xC4, 0x1F, 0xF2, 0x34, 0x9F, 0xA4, 0x7F, 0xF4, 0x94, 0x7D, 0x46, 0x57, 0xFE, + 0xE5, 0x1F, 0x9F, 0xE6, 0x7E, 0x58, 0xE9, 0x5A, 0xBD, 0xEE, 0x91, 0x75, 0x6F, 0x75, 0x69, 0x3C, + 0x91, 0xBD, 0xB1, 0x2D, 0x00, 0x59, 0x64, 0x8D, 0x22, 0x2C, 0x30, 0xC5, 0x42, 0x32, 0x91, 0x91, + 0x91, 0xC1, 0x15, 0xE6, 0xE1, 0x2A, 0xD3, 0xC3, 0xD4, 0x75, 0x25, 0x14, 0xDD, 0xAC, 0xB4, 0x5D, + 0xD7, 0x5D, 0xD6, 0x97, 0xD6, 0x2D, 0x3E, 0x89, 0xA4, 0x7A, 0x4A, 0xA5, 0x78, 0x45, 0x42, 0x95, + 0x47, 0x18, 0xDE, 0xED, 0x68, 0xD3, 0xF5, 0x8B, 0x4E, 0x2F, 0xA6, 0x8D, 0x74, 0x47, 0xAB, 0x9F, + 0xEC, 0xFF, 0x00, 0x16, 0xAE, 0x90, 0x9E, 0x18, 0xB2, 0x98, 0xF8, 0x86, 0x35, 0xB8, 0x6D, 0x40, + 0xD9, 0xE9, 0xB7, 0xD3, 0xFF, 0x00, 0x68, 0x00, 0x01, 0x86, 0x12, 0x86, 0x69, 0xD8, 0x15, 0x55, + 0x6C, 0x6D, 0x00, 0x63, 0x76, 0x49, 0xE2, 0xBF, 0x6D, 0xF0, 0xBF, 0x31, 0xE3, 0xDC, 0xAF, 0x19, + 0x2E, 0x2A, 0xE1, 0x0C, 0x15, 0x49, 0xE0, 0x30, 0xCD, 0x46, 0xBC, 0xA1, 0x07, 0xC8, 0xAF, 0x1D, + 0x14, 0xB5, 0xBC, 0xA4, 0x93, 0xBD, 0xB5, 0xBE, 0x9A, 0xEC, 0x8E, 0x2C, 0xD3, 0xFB, 0x32, 0x58, + 0x7F, 0x69, 0x9A, 0x62, 0x52, 0xAD, 0x34, 0xB9, 0x57, 0xBA, 0x92, 0x6B, 0x74, 0xE2, 0xA3, 0x15, + 0x15, 0xA2, 0xB5, 0x9B, 0x5B, 0xBB, 0x6B, 0x65, 0x07, 0x87, 0x35, 0x26, 0xD0, 0xF5, 0xFB, 0x1B, + 0xDB, 0x9B, 0x37, 0x8E, 0x5D, 0x36, 0xF5, 0x4D, 0xEE, 0x9F, 0x73, 0x6A, 0x48, 0x2D, 0x1B, 0x7C, + 0xD1, 0xCB, 0x0B, 0x15, 0x0C, 0x38, 0xC1, 0x42, 0x57, 0x23, 0x23, 0x23, 0x39, 0x1F, 0xDC, 0xDC, + 0x07, 0xC5, 0xF4, 0x73, 0x59, 0x43, 0x36, 0xC9, 0xE8, 0xBB, 0xD4, 0x8B, 0x8D, 0x7A, 0x5C, 0xAE, + 0x0A, 0x57, 0x8D, 0x9B, 0xBB, 0x56, 0x52, 0x57, 0xE6, 0x8F, 0x33, 0xDD, 0x25, 0x6E, 0x87, 0xC2, + 0xE6, 0x18, 0x5F, 0xAC, 0x60, 0xA5, 0x46, 0x13, 0x5C, 0xB2, 0x5E, 0xEC, 0xB4, 0x69, 0x2F, 0x2D, + 0xD2, 0x7D, 0x9D, 0x9D, 0x9D, 0x9D, 0xB4, 0xB1, 0xF6, 0xA6, 0xA1, 0xE3, 0x3F, 0x03, 0xFC, 0x1C, + 0xF1, 0x17, 0x80, 0xFE, 0x3C, 0x7E, 0xCE, 0xFF, 0x00, 0x10, 0xB4, 0xA8, 0x7C, 0x4E, 0x97, 0x82, + 0xCF, 0xC5, 0x7F, 0x0C, 0xE4, 0x17, 0x29, 0x1C, 0x64, 0xC4, 0x3E, 0xD0, 0xA2, 0x31, 0x1C, 0x49, + 0x26, 0x9D, 0x32, 0x86, 0x47, 0x89, 0x98, 0x61, 0x89, 0xC0, 0x23, 0x04, 0xFA, 0x54, 0x70, 0x78, + 0xDE, 0x2E, 0xFA, 0xC7, 0x0E, 0x66, 0x94, 0x13, 0xC2, 0x35, 0x29, 0x50, 0x9D, 0x49, 0x41, 0xD4, + 0xA3, 0x27, 0x7D, 0x23, 0xCC, 0xEC, 0xAD, 0x7B, 0x59, 0x7C, 0x2A, 0xFC, 0xAE, 0xFB, 0x7C, 0x7E, + 0x45, 0x4B, 0x34, 0x96, 0x0E, 0x59, 0x6E, 0x79, 0x41, 0xB8, 0x5B, 0x49, 0x4A, 0xD2, 0xBA, 0x56, + 0xB2, 0x7B, 0xB6, 0xD3, 0xD5, 0x3D, 0x1D, 0x92, 0x4F, 0x4B, 0x1F, 0x62, 0xFE, 0xD0, 0x7E, 0x36, + 0xFD, 0x97, 0xFF, 0x00, 0x6A, 0x8F, 0x84, 0x3E, 0x1C, 0xF1, 0x86, 0x8F, 0xF1, 0x13, 0xC3, 0x3F, + 0x0C, 0x3E, 0x2F, 0x78, 0x6C, 0x47, 0x3E, 0x87, 0xA7, 0x78, 0x8E, 0xF1, 0xED, 0x75, 0x6D, 0x3D, + 0x95, 0x43, 0x4B, 0xA2, 0xDC, 0x4D, 0xE4, 0xB4, 0x92, 0x5B, 0x2B, 0xB1, 0x78, 0x66, 0x46, 0x18, + 0x63, 0x82, 0xA0, 0x27, 0x3F, 0x15, 0xC2, 0xB9, 0x67, 0x1C, 0x70, 0x67, 0x11, 0x3C, 0x16, 0x37, + 0x05, 0x3A, 0x94, 0x2A, 0x73, 0x42, 0xD0, 0xB5, 0x9B, 0xBA, 0x49, 0xBB, 0x5A, 0x31, 0x4D, 0x45, + 0x2F, 0x7B, 0x9A, 0x56, 0xBD, 0xA5, 0x75, 0x61, 0x42, 0x55, 0x72, 0x89, 0xFD, 0x4E, 0x8D, 0x19, + 0x55, 0xC3, 0xA8, 0xBD, 0x14, 0x64, 0xDA, 0x57, 0x6E, 0xC9, 0xB5, 0x18, 0xC9, 0x7E, 0x37, 0x6F, + 0xA6, 0x8A, 0x5F, 0x84, 0xBF, 0xB4, 0x6F, 0xC1, 0xFF, 0x00, 0x8E, 0x1F, 0x05, 0xEF, 0x3E, 0x0F, + 0xFE, 0xD2, 0x3E, 0x24, 0xD0, 0xF4, 0x8D, 0x6A, 0xC5, 0x63, 0xD1, 0xA4, 0xD5, 0x6E, 0xB4, 0x89, + 0x9D, 0x3C, 0x56, 0x40, 0x64, 0xD3, 0xB5, 0x1B, 0x29, 0x21, 0x8C, 0x95, 0xBC, 0x85, 0x4E, 0x0B, + 0xB2, 0x86, 0x94, 0x9C, 0x82, 0x30, 0x05, 0x7A, 0xFC, 0x61, 0xC1, 0x5C, 0x55, 0xC3, 0xD9, 0xAD, + 0x3C, 0xF7, 0x22, 0xC3, 0x54, 0xF6, 0x36, 0x53, 0x71, 0x72, 0xF7, 0xA3, 0x17, 0x6E, 0x66, 0xDD, + 0xDC, 0x5B, 0x6D, 0x26, 0xE2, 0xA7, 0xCA, 0xA2, 0x92, 0x7A, 0x5E, 0xD9, 0xD7, 0xCB, 0x6B, 0x65, + 0xD5, 0xDE, 0x3B, 0x06, 0xD2, 0xA5, 0xA4, 0x9A, 0xD5, 0x72, 0xAB, 0x5D, 0xA7, 0xEE, 0xA8, 0x27, + 0x14, 0xAD, 0x1B, 0xFB, 0xB6, 0x52, 0xD5, 0xA7, 0xAF, 0x83, 0xFC, 0x35, 0xF1, 0x31, 0xFD, 0x99, + 0xBC, 0x73, 0xE2, 0x4F, 0x00, 0xF8, 0x9B, 0x53, 0x6F, 0x15, 0xFC, 0x08, 0xF1, 0x05, 0xD4, 0xDF, + 0x63, 0xF1, 0x8D, 0xB5, 0x9D, 0xCA, 0xDB, 0x69, 0xC0, 0xA4, 0x82, 0xDE, 0xE6, 0x2B, 0x77, 0x83, + 0xCE, 0xCB, 0xAA, 0xC7, 0x1C, 0x88, 0xAA, 0x07, 0xCE, 0x59, 0x72, 0x47, 0x1F, 0x79, 0x8D, 0xC1, + 0x62, 0xB8, 0xC7, 0x25, 0xA7, 0x99, 0x50, 0xA0, 0xE9, 0xE6, 0x09, 0x46, 0x33, 0x4D, 0x2E, 0x69, + 0xBB, 0x45, 0xDE, 0xC9, 0xB4, 0xA3, 0x7F, 0x89, 0x35, 0xAB, 0xEB, 0x6D, 0x1F, 0x97, 0x98, 0x3C, + 0xAF, 0x3C, 0xC2, 0xA8, 0x61, 0xE4, 0xBE, 0xB4, 0xD4, 0x5D, 0x92, 0xB3, 0x92, 0xB5, 0xAF, 0xB2, + 0xD1, 0x2B, 0xBE, 0xAD, 0x46, 0x36, 0xB6, 0xC8, 0xF1, 0xDF, 0x89, 0xBE, 0x1C, 0x9F, 0xE1, 0x67, + 0xC4, 0x3D, 0x1F, 0xE2, 0x67, 0xC1, 0x6D, 0x42, 0xF7, 0x53, 0xD0, 0x24, 0x95, 0xB5, 0x78, 0xDF, + 0x4F, 0xD2, 0x6E, 0xAC, 0xAC, 0xF4, 0x6F, 0x9F, 0x33, 0x5A, 0x32, 0x4B, 0x04, 0x43, 0xEC, 0xF2, + 0x2B, 0x36, 0x13, 0x61, 0x18, 0xC8, 0x20, 0x64, 0x2D, 0x74, 0x64, 0xD2, 0xA5, 0x9B, 0xE5, 0x2F, + 0x87, 0xF1, 0x54, 0x17, 0xB4, 0x8D, 0x9B, 0x6D, 0xAD, 0xFE, 0x1B, 0x36, 0x9B, 0x76, 0xF7, 0x53, + 0xBA, 0x6D, 0xAB, 0xA7, 0x16, 0xD9, 0xE8, 0xE5, 0x59, 0x8D, 0x0C, 0x7E, 0x5F, 0x1C, 0xA7, 0x38, + 0xAF, 0x1A, 0x92, 0x4F, 0x92, 0x3A, 0x3B, 0x49, 0x73, 0x7B, 0xAA, 0x37, 0xD2, 0x4D, 0x3D, 0x2E, + 0xAD, 0x7D, 0xAD, 0xA5, 0xCF, 0x56, 0xFD, 0xA4, 0xFC, 0x71, 0xFB, 0x3F, 0x7C, 0x6E, 0xF8, 0x63, + 0xE1, 0x9F, 0x1A, 0xE9, 0xBE, 0x3A, 0xB1, 0xD1, 0x3E, 0x2F, 0xE9, 0x5A, 0x54, 0x24, 0xF8, 0x4A, + 0x4D, 0x1F, 0x52, 0x92, 0x79, 0xE1, 0x77, 0x02, 0xE3, 0x4D, 0xBA, 0xBB, 0x4B, 0x51, 0x6C, 0x65, + 0x8C, 0x96, 0x91, 0x66, 0xDC, 0x03, 0x0D, 0xA8, 0x00, 0x0B, 0x5F, 0x31, 0xC2, 0xD9, 0x77, 0x15, + 0xF0, 0xC7, 0x12, 0x4E, 0x8E, 0x17, 0x0B, 0x27, 0x97, 0xCD, 0xA8, 0xC9, 0xA7, 0x15, 0x17, 0x07, + 0x74, 0xE6, 0x9D, 0xF9, 0x96, 0xDE, 0xEC, 0x53, 0x6D, 0x6E, 0xD6, 0xA9, 0x1E, 0xB6, 0x1E, 0x96, + 0x23, 0x2F, 0xB5, 0x1F, 0x67, 0xCD, 0x1B, 0xEC, 0xAE, 0xDA, 0xEC, 0x93, 0x71, 0x8C, 0x7D, 0xDD, + 0x6F, 0x7B, 0x69, 0x64, 0xBA, 0x5B, 0xF3, 0xD6, 0xCB, 0x47, 0xBF, 0xD5, 0x27, 0x10, 0x69, 0x76, + 0x37, 0x57, 0x65, 0xD8, 0x08, 0xD2, 0x18, 0x8B, 0xF5, 0x20, 0x01, 0x91, 0xC7, 0x52, 0x05, 0x7E, + 0xB7, 0x8B, 0xAB, 0x80, 0xCB, 0xE0, 0xE7, 0x8A, 0xAD, 0x18, 0xC5, 0x79, 0xC5, 0xEC, 0xAE, 0xD2, + 0xB5, 0xAF, 0xB3, 0xB5, 0x92, 0x5A, 0x6B, 0x67, 0xA2, 0xFA, 0xDC, 0x16, 0x59, 0x98, 0xE6, 0x75, + 0x1C, 0x32, 0xDC, 0x3C, 0xA6, 0xBC, 0x96, 0x89, 0x79, 0xBD, 0x22, 0x92, 0x5B, 0xB6, 0xD2, 0x4B, + 0x5D, 0x11, 0xE9, 0x7A, 0x5F, 0xC1, 0x1F, 0x1A, 0x5F, 0xC6, 0xB3, 0xDD, 0xDB, 0x5B, 0x69, 0x56, + 0xBB, 0x41, 0x69, 0x6F, 0x65, 0x55, 0xD8, 0xB9, 0x00, 0x9C, 0x74, 0xEE, 0x31, 0xC8, 0xCF, 0x6A, + 0xF8, 0x5C, 0xD3, 0x8F, 0x78, 0x6B, 0x0E, 0xD5, 0x1C, 0x3C, 0x9D, 0x59, 0x5B, 0x45, 0x18, 0xBB, + 0x7C, 0xB7, 0x76, 0xB2, 0xBB, 0xD1, 0x59, 0x6B, 0xD2, 0xC7, 0xD6, 0xE0, 0x7C, 0x3F, 0xCC, 0xEA, + 0xA4, 0xF1, 0xB5, 0x61, 0x49, 0x76, 0x57, 0x9C, 0xAD, 0xE4, 0xA2, 0xB9, 0x76, 0x4E, 0xD7, 0x92, + 0xDA, 0xCE, 0xC7, 0x62, 0xFF, 0x00, 0xB3, 0xF4, 0x1A, 0x75, 0x8C, 0xD7, 0xBA, 0xCE, 0xBC, 0x7C, + 0xAB, 0x68, 0x44, 0x93, 0x47, 0xA7, 0x46, 0x19, 0x94, 0x8C, 0x64, 0x29, 0x23, 0x07, 0x86, 0x5E, + 0x33, 0xEB, 0xE9, 0x8A, 0xF8, 0x2C, 0x67, 0x88, 0x2B, 0x12, 0xFD, 0x86, 0x1F, 0x0B, 0xC9, 0x16, + 0xD6, 0xB3, 0x7A, 0x47, 0x5B, 0x6B, 0xCA, 0xEE, 0xBE, 0xEB, 0x77, 0xB5, 0xB4, 0xFA, 0xAC, 0xB3, + 0xC3, 0x7C, 0xB2, 0xB5, 0x58, 0x61, 0xEA, 0x57, 0xA9, 0x3A, 0x8E, 0xC9, 0x28, 0xA8, 0x41, 0x5F, + 0x6D, 0xDF, 0x3E, 0x9A, 0x5A, 0xD6, 0x4E, 0xF6, 0x39, 0x96, 0xF0, 0x07, 0x84, 0xE2, 0x26, 0x37, + 0x9B, 0x50, 0x65, 0x00, 0xAC, 0x2E, 0xD8, 0x51, 0x23, 0x63, 0xE5, 0x0C, 0xA1, 0x88, 0xEA, 0x07, + 0x39, 0x1F, 0x4E, 0x80, 0xFE, 0x7F, 0xC7, 0x9C, 0x6B, 0xE2, 0x1E, 0x59, 0x81, 0x82, 0xC9, 0x68, + 0x53, 0xAB, 0x18, 0xBD, 0x6D, 0x09, 0x49, 0xD9, 0x5A, 0xDE, 0xEF, 0x34, 0x5D, 0xAF, 0x78, 0xCA, + 0xD7, 0x71, 0x7C, 0xAD, 0x2B, 0x58, 0xFB, 0x9A, 0x5E, 0x14, 0xF0, 0xCD, 0x2A, 0x14, 0xEB, 0x38, + 0x4A, 0x52, 0x6D, 0x47, 0x95, 0xD4, 0x7B, 0xB5, 0xA6, 0xD0, 0x8E, 0xFD, 0x12, 0xD1, 0xE8, 0xB4, + 0x7A, 0xA8, 0xFC, 0x4B, 0xF0, 0xC7, 0x44, 0xD1, 0x26, 0x8A, 0xDC, 0x59, 0xDE, 0x79, 0x8D, 0x1C, + 0x44, 0x5B, 0xC9, 0x70, 0x62, 0x9B, 0xE7, 0x23, 0x2A, 0xA3, 0x90, 0x48, 0xC8, 0xC0, 0x03, 0xF9, + 0x54, 0xE1, 0x73, 0xBC, 0x6C, 0xF0, 0x71, 0xAB, 0x9D, 0x42, 0x38, 0x69, 0x49, 0x2D, 0x2A, 0xA8, + 0xD3, 0x4B, 0x44, 0xFD, 0xDE, 0x66, 0xD6, 0xFA, 0x25, 0x77, 0x6B, 0x6A, 0x93, 0x22, 0xB7, 0x00, + 0xF0, 0x83, 0xCA, 0x9E, 0x63, 0x4A, 0x8C, 0xAF, 0x19, 0xA8, 0xB8, 0xC2, 0xA3, 0x4B, 0x95, 0xB4, + 0xB9, 0xB5, 0xBE, 0xCB, 0xA6, 0xD6, 0x5B, 0xA3, 0xE8, 0x7F, 0x09, 0xFF, 0x00, 0xC1, 0x31, 0x7F, + 0x6C, 0x0F, 0x8A, 0xFA, 0x4D, 0xB6, 0xB5, 0xF0, 0xD7, 0xF6, 0x7E, 0xF8, 0xA6, 0xBA, 0x24, 0xAA, + 0xB7, 0x2F, 0xAF, 0xF8, 0xC3, 0x41, 0x1E, 0x02, 0xF0, 0x74, 0x36, 0xCC, 0xA0, 0x9B, 0x87, 0xD5, + 0xF5, 0x36, 0xB5, 0xB5, 0x48, 0x40, 0x39, 0x32, 0x34, 0x9B, 0x31, 0x9F, 0x9B, 0x8E, 0x7F, 0x26, + 0xE3, 0x3F, 0x12, 0xB3, 0x2C, 0x1D, 0x6C, 0x3E, 0x0F, 0x26, 0x54, 0xAA, 0x61, 0x9C, 0xAD, 0x28, + 0xC2, 0x57, 0x94, 0x9A, 0x7F, 0x0D, 0xE3, 0x78, 0x7B, 0xC9, 0x5E, 0x2A, 0x32, 0x96, 0x9A, 0x4D, + 0x45, 0xD9, 0x1F, 0x2F, 0x9D, 0xF0, 0xA7, 0x01, 0x60, 0x69, 0xCA, 0xB6, 0x13, 0x34, 0xE5, 0x97, + 0x2D, 0xF9, 0x5B, 0x55, 0x39, 0x6C, 0x96, 0x8D, 0x41, 0x5E, 0xFA, 0x5A, 0xCA, 0x4E, 0xDB, 0xBB, + 0x23, 0xA3, 0x9F, 0xFE, 0x09, 0xA3, 0x17, 0x82, 0xE0, 0x5B, 0xBF, 0x8F, 0xDF, 0xB6, 0xA7, 0xEC, + 0x51, 0xF0, 0x3E, 0xDA, 0x38, 0xE4, 0x37, 0x7A, 0x4C, 0x7F, 0x14, 0xEF, 0xBE, 0x34, 0xF8, 0xBE, + 0xD1, 0xE3, 0x6C, 0x79, 0x42, 0xC7, 0xC2, 0xDA, 0x7E, 0xA5, 0x03, 0xB1, 0x0A, 0xC4, 0x2A, 0x5C, + 0xB1, 0x38, 0xE0, 0x1E, 0x71, 0xEE, 0x57, 0xE2, 0xCF, 0xED, 0x38, 0xD1, 0xA1, 0x97, 0x64, 0xF5, + 0xAF, 0xCA, 0x9C, 0xA3, 0xEE, 0x53, 0x69, 0xD9, 0x36, 0xBD, 0xED, 0x54, 0x75, 0x5D, 0x12, 0x7B, + 0xDE, 0xCA, 0xE7, 0xE7, 0x78, 0xAC, 0xA3, 0x1D, 0x81, 0x8B, 0xAD, 0x52, 0x9C, 0xFD, 0x8D, 0xED, + 0x19, 0xB8, 0x4A, 0x31, 0x7A, 0x5D, 0x2F, 0x79, 0x2B, 0x36, 0x96, 0xDF, 0x75, 0xF4, 0x31, 0xA1, + 0xF8, 0x09, 0xFF, 0x00, 0x04, 0xD7, 0xF0, 0xF5, 0xC5, 0xB5, 0x97, 0x89, 0xBF, 0x6E, 0x6F, 0x8D, + 0xBF, 0x16, 0x64, 0x54, 0x6B, 0xDB, 0xD5, 0xFD, 0x9D, 0xFF, 0x00, 0x63, 0xDB, 0xA1, 0xA4, 0x25, + 0xBC, 0x4B, 0xBA, 0x65, 0x17, 0x7E, 0x29, 0xD6, 0x34, 0x7B, 0x84, 0x60, 0xAA, 0xFF, 0x00, 0x38, + 0xB3, 0x91, 0x47, 0x07, 0x04, 0x0C, 0x57, 0xC5, 0x66, 0xB9, 0xC7, 0x88, 0x78, 0xAB, 0x61, 0x28, + 0xE5, 0xA9, 0x61, 0x5A, 0x7C, 0xB4, 0xE5, 0x4D, 0x27, 0x1E, 0x89, 0xCA, 0x53, 0x9C, 0x62, 0xFA, + 0x6C, 0xDA, 0x6A, 0xDA, 0xAD, 0x97, 0x0C, 0x5D, 0x28, 0x2E, 0x79, 0x24, 0xAD, 0x65, 0x76, 0xFA, + 0x69, 0xAA, 0xE5, 0x4E, 0xC9, 0x75, 0xBD, 0xAD, 0x6E, 0xCA, 0xE4, 0x0D, 0x65, 0xFF, 0x00, 0x04, + 0xA4, 0x82, 0xE2, 0x2B, 0x6F, 0x0F, 0x78, 0x2F, 0xFE, 0x0A, 0x3D, 0xF1, 0x24, 0xC2, 0x49, 0xFB, + 0x4A, 0x78, 0xB3, 0xE1, 0xDF, 0x80, 0xED, 0x6E, 0xF0, 0xC3, 0xCB, 0x51, 0x69, 0x1E, 0x8F, 0xA8, + 0x4A, 0x8A, 0x40, 0x39, 0xC4, 0xD9, 0x1C, 0x00, 0x7B, 0xD7, 0x93, 0x5F, 0x0B, 0xC5, 0xB1, 0xA5, + 0x0E, 0x77, 0x4A, 0x11, 0xFE, 0x5E, 0x78, 0xC2, 0xCA, 0xDD, 0x25, 0x04, 0xD5, 0xD3, 0xEC, 0x9A, + 0x4A, 0xDB, 0xB7, 0x60, 0xFA, 0xC5, 0x3A, 0x56, 0xF6, 0xD5, 0x20, 0xB6, 0x4F, 0xA7, 0xA2, 0x57, + 0x7D, 0xB4, 0xD5, 0x7A, 0x2E, 0x87, 0x71, 0x61, 0x65, 0xFB, 0x05, 0x4D, 0x23, 0x7F, 0x60, 0x7F, + 0xC1, 0x3E, 0x3F, 0x6B, 0xDF, 0x15, 0x5B, 0x04, 0x1F, 0x67, 0x3E, 0x26, 0xFD, 0xAF, 0x74, 0xBF, + 0x0A, 0x49, 0x28, 0x55, 0xF9, 0x77, 0xBC, 0x5E, 0x14, 0x65, 0x05, 0x88, 0x39, 0x0A, 0x0E, 0x06, + 0x30, 0x0D, 0x7C, 0xED, 0x6C, 0x17, 0x10, 0x41, 0x45, 0x3C, 0x5C, 0x54, 0x76, 0x76, 0xAA, 0xA6, + 0xED, 0x7D, 0xB4, 0xA5, 0xA5, 0x92, 0xF3, 0xBD, 0x92, 0x4B, 0x42, 0x23, 0x99, 0xE0, 0x21, 0x27, + 0xFB, 0xE4, 0xEF, 0xA4, 0x52, 0x83, 0xD3, 0xD6, 0xCF, 0x5E, 0xCB, 0x64, 0xFA, 0x6E, 0x91, 0xD9, + 0xE9, 0xBE, 0x04, 0xFD, 0x91, 0xB5, 0x34, 0x1B, 0xBF, 0xE0, 0x9A, 0xBF, 0x15, 0x74, 0xC0, 0xF1, + 0x92, 0x8D, 0x7F, 0xFF, 0x00, 0x05, 0x12, 0x01, 0x93, 0x8C, 0x0F, 0x91, 0x3C, 0x14, 0xD9, 0x23, + 0x23, 0x80, 0x3B, 0x11, 0x5E, 0x6C, 0xA7, 0x9A, 0xC6, 0xA7, 0x2E, 0x33, 0x1B, 0xA2, 0xD3, 0x47, + 0xCC, 0xFA, 0x69, 0x67, 0x08, 0xDB, 0x45, 0xDF, 0x7B, 0x2D, 0xAE, 0x44, 0xB3, 0x7C, 0x3C, 0x12, + 0xE5, 0x5D, 0x6D, 0x65, 0x0B, 0x5B, 0xB3, 0xD6, 0x69, 0x5B, 0xF1, 0xE9, 0x6E, 0x87, 0xAA, 0xE8, + 0xBF, 0xB2, 0x2F, 0xEC, 0x51, 0xE2, 0xB8, 0xD6, 0x5D, 0x47, 0xF6, 0x52, 0xFD, 0xAB, 0xBC, 0x23, + 0x0D, 0xE2, 0xC6, 0xA0, 0x78, 0x17, 0xF6, 0x9B, 0xD2, 0x3C, 0x5F, 0xF6, 0x14, 0x50, 0x37, 0xC9, + 0x04, 0xD7, 0x7E, 0x10, 0x55, 0x91, 0x8E, 0x3A, 0x3A, 0x00, 0x39, 0xEA, 0x06, 0x46, 0x2A, 0xAE, + 0x61, 0xCA, 0xF9, 0x6B, 0xCA, 0x53, 0xE9, 0x65, 0x14, 0x9A, 0x5F, 0xCD, 0x68, 0xF3, 0x6D, 0x65, + 0x78, 0xDD, 0x25, 0x7D, 0x51, 0x2B, 0x36, 0x93, 0xAA, 0xBD, 0x8D, 0x2B, 0xD3, 0x49, 0x5E, 0xE9, + 0xDE, 0xF6, 0xD1, 0x24, 0x9D, 0x92, 0xED, 0x76, 0x9D, 0xBA, 0x2B, 0x23, 0x76, 0x1F, 0xF8, 0x26, + 0xAF, 0xEC, 0x3B, 0xAE, 0x59, 0xC9, 0x1D, 0xB0, 0xFF, 0x00, 0x82, 0x80, 0x78, 0x26, 0xFC, 0xC1, + 0x21, 0x82, 0xEA, 0xE3, 0x4E, 0xF0, 0x3F, 0xC4, 0xAB, 0x31, 0x27, 0x22, 0x15, 0x6B, 0x61, 0x69, + 0xA5, 0x39, 0x00, 0x85, 0x0C, 0x3C, 0xC1, 0xD0, 0xE3, 0xDB, 0x69, 0x4F, 0x39, 0x95, 0x59, 0x4A, + 0xA5, 0x59, 0xA5, 0xA3, 0x49, 0x28, 0x49, 0x25, 0xDA, 0xEE, 0x2D, 0xB5, 0x65, 0x64, 0xF4, 0x6B, + 0xB3, 0x4B, 0x5D, 0x23, 0x9A, 0x41, 0x28, 0xC5, 0xD3, 0x49, 0xA7, 0x66, 0xAC, 0xD7, 0x45, 0xA2, + 0xD6, 0xD7, 0xBB, 0x5A, 0x68, 0xAD, 0xDB, 0xA7, 0x9E, 0xCD, 0xFF, 0x00, 0x04, 0x9B, 0xFD, 0x9F, + 0x35, 0x6B, 0xC4, 0xB5, 0xD0, 0x7F, 0x6B, 0xAF, 0x89, 0x7E, 0x10, 0x6F, 0x31, 0x61, 0x16, 0xDF, + 0x19, 0x3F, 0x64, 0x5F, 0x13, 0xE8, 0x82, 0x46, 0x72, 0x42, 0x91, 0x79, 0xA1, 0x49, 0xAC, 0xDA, + 0x45, 0x18, 0x0B, 0xF7, 0xE6, 0x92, 0x30, 0x72, 0x08, 0x1C, 0x10, 0x3D, 0x0F, 0x63, 0x99, 0x4E, + 0x92, 0x9E, 0x25, 0xA9, 0xC7, 0x5B, 0x28, 0xA5, 0x15, 0x1B, 0x5A, 0xFC, 0xD7, 0x92, 0x7B, 0x74, + 0x49, 0xB5, 0xDB, 0x54, 0x63, 0x0C, 0xDA, 0xBD, 0x56, 0xA3, 0x87, 0xA3, 0xCA, 0xD7, 0xC4, 0xA4, + 0x9A, 0x6D, 0x2D, 0xF9, 0x34, 0xB3, 0xB6, 0x97, 0xE9, 0xAA, 0xD7, 0x43, 0xB1, 0xD3, 0xFF, 0x00, + 0xE0, 0x84, 0xDE, 0x30, 0xD6, 0xAD, 0xF4, 0xF9, 0x3C, 0x15, 0xF1, 0x53, 0xE1, 0xFF, 0x00, 0xC5, + 0x26, 0xBF, 0x8B, 0x30, 0x5A, 0xF8, 0x17, 0xE2, 0x96, 0x87, 0xA2, 0xEB, 0x0C, 0x09, 0xFD, 0xD6, + 0x74, 0xDD, 0x69, 0x2C, 0x6E, 0x4B, 0x38, 0x20, 0xAA, 0x45, 0x1C, 0x87, 0x04, 0x0C, 0x7A, 0xF9, + 0xF5, 0x27, 0x8B, 0x8C, 0x9D, 0x1A, 0x54, 0xEC, 0x9D, 0x95, 0xAD, 0xAE, 0x8A, 0xFA, 0x2D, 0xAC, + 0xB6, 0x6E, 0xEB, 0x6D, 0x2C, 0x82, 0x96, 0x65, 0x8A, 0x74, 0xDD, 0x69, 0x72, 0xB8, 0xA7, 0x6B, + 0xD9, 0xA4, 0x96, 0x89, 0x76, 0xD3, 0xF0, 0xED, 0xD0, 0xF3, 0x5F, 0x1E, 0x7F, 0xC1, 0x22, 0xBC, + 0x51, 0xF0, 0x87, 0xCC, 0x6F, 0x8A, 0x1F, 0x0E, 0xFF, 0x00, 0x68, 0x3F, 0x08, 0xDB, 0xC7, 0x0A, + 0x5C, 0x3D, 0xEF, 0x88, 0x3C, 0x25, 0x26, 0x9B, 0xA5, 0xC5, 0x1B, 0x01, 0xB5, 0xBE, 0xD6, 0x2C, + 0xFC, 0x9C, 0x10, 0xCA, 0x73, 0xBF, 0xB8, 0xF5, 0x15, 0xC6, 0xAA, 0xD5, 0x51, 0x57, 0x94, 0x53, + 0x57, 0xD2, 0xCF, 0xA6, 0x9D, 0x1F, 0x7D, 0x17, 0xF9, 0x6D, 0x53, 0xCC, 0x31, 0x52, 0xA6, 0x9D, + 0x35, 0x6D, 0x2F, 0xA2, 0x4F, 0x45, 0x6E, 0xF7, 0x5F, 0xD7, 0xA2, 0x3E, 0x55, 0xD4, 0x7E, 0x04, + 0x7E, 0xCC, 0x9A, 0x27, 0x88, 0xED, 0xBC, 0x2B, 0xA9, 0xEB, 0x9E, 0x31, 0x4D, 0x52, 0xED, 0xDA, + 0x38, 0x21, 0x17, 0x29, 0xF3, 0xB2, 0x1C, 0x32, 0x03, 0xE5, 0x81, 0xC6, 0x06, 0x4E, 0x3F, 0xFA, + 0xDE, 0xA5, 0x2C, 0x9F, 0x34, 0xAD, 0x43, 0xDA, 0x42, 0x70, 0xB5, 0xBE, 0x1E, 0xB6, 0xF4, 0xBE, + 0x8B, 0xA5, 0xB4, 0xBE, 0xC9, 0x6C, 0x78, 0x32, 0xE2, 0xFF, 0x00, 0x63, 0xED, 0x5B, 0xA7, 0x37, + 0x4E, 0x9B, 0x51, 0x9C, 0xD4, 0x3D, 0xC8, 0xB7, 0x6B, 0x5D, 0xE9, 0xE5, 0x6B, 0x45, 0xDA, 0xFA, + 0xF9, 0x7A, 0xEC, 0x1F, 0xB1, 0x2F, 0xC1, 0x2B, 0x88, 0x62, 0x9A, 0x19, 0x7C, 0x52, 0x63, 0x74, + 0x0C, 0x9B, 0x75, 0xA1, 0xB4, 0x02, 0xA3, 0x1F, 0xC1, 0xF4, 0xE3, 0xA5, 0x7C, 0xEB, 0xA1, 0xCB, + 0x65, 0x39, 0x6A, 0x9E, 0x8B, 0xB5, 0xB4, 0xB2, 0xB3, 0xF8, 0x55, 0xB4, 0x5B, 0x2E, 0x8A, 0xFA, + 0x9E, 0xF5, 0x3C, 0xD3, 0x13, 0x3A, 0x71, 0x9A, 0xB5, 0x9F, 0x97, 0xF9, 0x3B, 0x2E, 0xC3, 0xFF, + 0x00, 0xE1, 0x87, 0x7E, 0x0A, 0x74, 0x1F, 0xF0, 0x94, 0x93, 0x8E, 0xDA, 0xC8, 0x23, 0x8F, 0x70, + 0x9E, 0xC6, 0xB8, 0xDE, 0x53, 0x85, 0xAA, 0xDD, 0x4B, 0xEE, 0xF5, 0xDF, 0x7E, 0xBD, 0x7B, 0x9B, + 0x2C, 0xD3, 0x19, 0x18, 0xE8, 0xD5, 0x97, 0x95, 0xBB, 0x7E, 0x9F, 0xD6, 0xC3, 0x7F, 0xE1, 0x87, + 0xFE, 0x0A, 0x0F, 0x97, 0x3E, 0x28, 0x04, 0x10, 0x98, 0x1A, 0xDA, 0x83, 0xDB, 0xA1, 0x29, 0x8E, + 0xE3, 0xF2, 0xA7, 0x4F, 0x2B, 0xC1, 0xD3, 0xBA, 0x49, 0x59, 0xAB, 0x6A, 0xAF, 0x6B, 0xA5, 0xB6, + 0xBA, 0x35, 0xD2, 0xC2, 0xFE, 0xD5, 0xC5, 0xAB, 0x5D, 0xAB, 0x7A, 0x5B, 0xF2, 0x7D, 0xBA, 0x75, + 0x35, 0x2F, 0x7F, 0x63, 0x9F, 0x84, 0x5A, 0x86, 0x95, 0xA6, 0xE9, 0x21, 0xBC, 0x41, 0x69, 0x6D, + 0xA4, 0xA3, 0xA2, 0xB5, 0xBD, 0xE4, 0x30, 0xCB, 0x71, 0xB9, 0xCB, 0x16, 0x9A, 0x41, 0x10, 0x32, + 0x63, 0xA7, 0xCC, 0x4E, 0x00, 0x18, 0xC6, 0x0E, 0x3D, 0x4C, 0x64, 0xFE, 0xB9, 0x95, 0xE1, 0xF2, + 0x8A, 0xB6, 0xF6, 0x34, 0x6F, 0xCB, 0x6B, 0xDF, 0x5B, 0xDA, 0xFA, 0xA5, 0xA5, 0xED, 0xB6, 0xDA, + 0x2B, 0x58, 0xE7, 0x58, 0xFC, 0x4D, 0x3A, 0xBE, 0xD1, 0x34, 0xDB, 0xDA, 0xEA, 0xF6, 0xD9, 0x3B, + 0x75, 0x4B, 0xCA, 0x36, 0x5A, 0xBB, 0xA6, 0xD9, 0xE9, 0x7A, 0x97, 0xEC, 0xF9, 0xF0, 0x3B, 0xFE, + 0x11, 0x1F, 0x04, 0xF8, 0x6F, 0x42, 0xF0, 0x35, 0x86, 0x91, 0x37, 0x87, 0x3C, 0x29, 0x77, 0xA1, + 0xF8, 0x8F, 0x55, 0xBA, 0xD3, 0xF4, 0xFD, 0x5E, 0xEF, 0xC6, 0x17, 0x77, 0x25, 0x80, 0xD4, 0xE5, + 0x77, 0x80, 0x48, 0x93, 0xC7, 0x1B, 0xA2, 0xA1, 0x0C, 0x76, 0x95, 0xC8, 0xE7, 0x18, 0xFB, 0x5E, + 0x16, 0xE2, 0xEC, 0x93, 0x86, 0xF2, 0x89, 0xE5, 0x78, 0xAC, 0x9E, 0x86, 0x26, 0x6D, 0x59, 0x4A, + 0xA4, 0x13, 0xD1, 0xA5, 0xA3, 0x6D, 0xDD, 0x27, 0xD5, 0x47, 0x46, 0xAD, 0x64, 0x9D, 0xDC, 0xBC, + 0x2C, 0x5C, 0x71, 0x58, 0xBC, 0xC2, 0x18, 0xF8, 0xE2, 0x67, 0x4E, 0x49, 0x25, 0x68, 0xCA, 0xD1, + 0x69, 0x3B, 0xD9, 0xC6, 0xDC, 0xAF, 0xAD, 0xB4, 0xBA, 0xD3, 0x6B, 0x59, 0xF8, 0xEF, 0x8D, 0xFF, + 0x00, 0x62, 0xEF, 0x85, 0x9A, 0xF4, 0xFA, 0x4C, 0x3A, 0x2E, 0xAD, 0xA9, 0xE9, 0x16, 0x7A, 0x1E, + 0x8B, 0x0E, 0x93, 0x0C, 0xDA, 0x46, 0x9F, 0x6B, 0x65, 0x26, 0xAC, 0x50, 0xE5, 0xAE, 0x6F, 0x81, + 0x8B, 0x2F, 0x39, 0x2C, 0xC0, 0xB7, 0x19, 0xC2, 0x81, 0xC0, 0x00, 0x7C, 0x87, 0x14, 0x4B, 0x25, + 0xCD, 0xF3, 0x57, 0x8B, 0xCB, 0x70, 0xB1, 0xA3, 0x49, 0x24, 0x94, 0x63, 0xCC, 0x94, 0xB4, 0x4D, + 0xDD, 0x39, 0x49, 0xC5, 0x27, 0xEE, 0xA5, 0x16, 0x92, 0x4A, 0xF6, 0xBB, 0x6C, 0xF5, 0x30, 0xB9, + 0xB6, 0x61, 0x86, 0xA4, 0xFD, 0xAB, 0x4E, 0x4F, 0xBA, 0xBD, 0xAD, 0xD1, 0x5B, 0x97, 0x4B, 0x79, + 0x3D, 0xB4, 0xF2, 0xF3, 0xD7, 0xFD, 0x84, 0x3C, 0x39, 0x05, 0xBC, 0xE9, 0x63, 0xE3, 0xCD, 0x62, + 0x33, 0x30, 0x58, 0x4F, 0xDA, 0xB4, 0xC8, 0x25, 0x2A, 0x33, 0xDB, 0x69, 0x5E, 0x31, 0x9E, 0xC7, + 0xA0, 0xFC, 0x7D, 0x6E, 0x19, 0xC5, 0xAC, 0x83, 0x87, 0x33, 0x3A, 0x58, 0x68, 0x3B, 0xE2, 0x62, + 0xA8, 0xB9, 0x3B, 0x5D, 0x42, 0x51, 0x77, 0x49, 0x24, 0x93, 0xD6, 0xDA, 0x37, 0x65, 0xDA, 0xF6, + 0x15, 0x5C, 0xF3, 0x11, 0x3A, 0xB4, 0xFD, 0xA4, 0x15, 0xE3, 0xAE, 0x8A, 0xCB, 0xCB, 0x4B, 0xF7, + 0xB5, 0x9A, 0x69, 0x79, 0x6D, 0x6E, 0x1E, 0xFB, 0xF6, 0x0F, 0xB9, 0x4F, 0xF8, 0xF0, 0xF8, 0x85, + 0x6C, 0x40, 0x07, 0x02, 0xEB, 0x45, 0x6C, 0x11, 0xC6, 0xD0, 0x19, 0x64, 0x03, 0xA0, 0x6E, 0xDC, + 0x6D, 0xAF, 0x8A, 0x96, 0x45, 0x46, 0xA4, 0x12, 0xA5, 0x51, 0xF3, 0x2B, 0x2B, 0xBB, 0x35, 0xD9, + 0x5A, 0xC9, 0x59, 0x5A, 0xC9, 0x2B, 0xF4, 0x7D, 0x12, 0x3B, 0x69, 0x71, 0x2D, 0x48, 0xE9, 0x52, + 0x94, 0x6D, 0xD2, 0xCD, 0xAB, 0x74, 0xF3, 0xEB, 0xB6, 0xD7, 0xEC, 0xBA, 0x70, 0xFA, 0x9F, 0xEC, + 0x57, 0xE2, 0xEB, 0x16, 0x55, 0x87, 0xC6, 0x7E, 0x13, 0x62, 0xF8, 0x58, 0xE3, 0xBC, 0x79, 0x2C, + 0x64, 0x93, 0xFD, 0xD5, 0xF9, 0xB3, 0xD3, 0xB5, 0x25, 0xC3, 0x15, 0xE5, 0x04, 0xE8, 0x4F, 0x9B, + 0xD2, 0x3A, 0x25, 0xA7, 0x5B, 0xAB, 0x7E, 0x16, 0xB0, 0x2E, 0x2D, 0xC3, 0xD3, 0x51, 0x8D, 0x7A, + 0x6A, 0x32, 0x7B, 0x2E, 0x64, 0x97, 0x45, 0xD5, 0x27, 0xE5, 0xA2, 0x7D, 0x3E, 0x5C, 0x7E, 0xA1, + 0xFB, 0x21, 0xFC, 0x5D, 0xB0, 0x0C, 0x62, 0x8B, 0xC3, 0x97, 0xEA, 0x00, 0x31, 0x8B, 0x5D, 0x64, + 0x23, 0x38, 0x39, 0xC0, 0x01, 0xD1, 0x54, 0x7D, 0xD3, 0xD4, 0x8E, 0x9E, 0xDC, 0x62, 0xF8, 0x6B, + 0x1A, 0x9D, 0xA1, 0x28, 0xDB, 0xE6, 0xBA, 0x76, 0xB7, 0xDD, 0x6D, 0x7C, 0x96, 0x88, 0xE8, 0x8F, + 0x15, 0xE5, 0xE9, 0xA8, 0xCE, 0x12, 0x4A, 0xDB, 0xD9, 0x5B, 0xE5, 0xAD, 0xFF, 0x00, 0x0F, 0x43, + 0xB9, 0xF8, 0x73, 0xF0, 0x8B, 0xE2, 0xEC, 0x7E, 0x36, 0xD0, 0x2E, 0x7C, 0x6B, 0xA1, 0x6A, 0x13, + 0x5A, 0xE8, 0x3A, 0x4C, 0x3A, 0x26, 0x8D, 0x31, 0xD3, 0xAD, 0x7C, 0x53, 0x67, 0x6B, 0x02, 0x9C, + 0x0B, 0x76, 0xB2, 0x84, 0x3D, 0xC4, 0x91, 0x08, 0x4D, 0xC2, 0x9F, 0x25, 0x1A, 0x45, 0x2C, 0xA7, + 0xA6, 0x6B, 0xDF, 0xC9, 0xB2, 0x0A, 0xEA, 0x51, 0xAF, 0x39, 0x72, 0xCA, 0x36, 0x56, 0xF7, 0x67, + 0x77, 0xD6, 0xD1, 0xE5, 0x49, 0x45, 0xA4, 0xD3, 0x77, 0x93, 0x8A, 0xB3, 0x4A, 0x4B, 0x6E, 0x1C, + 0x5E, 0x7B, 0x93, 0xCB, 0x08, 0xE1, 0x4E, 0x56, 0x52, 0x7B, 0x59, 0xA7, 0x7E, 0xF7, 0xD9, 0x3B, + 0xA5, 0xAB, 0xFD, 0x34, 0xD5, 0xFD, 0xA2, 0x3C, 0x03, 0x79, 0xAF, 0xF8, 0xBF, 0x40, 0xD0, 0xFC, + 0x2F, 0x67, 0x6F, 0x3F, 0xF6, 0x9D, 0xDF, 0xF6, 0x57, 0x86, 0xED, 0xF4, 0xED, 0x2A, 0xF2, 0x18, + 0xB4, 0x8D, 0x16, 0xD4, 0xAC, 0x7A, 0x54, 0x72, 0x08, 0xA2, 0x10, 0x80, 0x11, 0xE7, 0x62, 0xAC, + 0xA6, 0x54, 0x08, 0x77, 0x00, 0x4E, 0x0F, 0xD0, 0x67, 0xB9, 0x6D, 0x7A, 0xB4, 0x70, 0x99, 0x56, + 0x0A, 0x2E, 0x31, 0xA8, 0xD4, 0x9F, 0x95, 0x38, 0x35, 0xCA, 0xDC, 0xAC, 0xF5, 0x69, 0xA6, 0x9C, + 0x74, 0x6A, 0x2D, 0x35, 0x74, 0x91, 0x39, 0x56, 0x65, 0x96, 0x51, 0xF6, 0xB8, 0xBC, 0x46, 0x22, + 0x2B, 0x95, 0x45, 0x25, 0xCB, 0x67, 0x26, 0xEC, 0xA5, 0xC8, 0xAC, 0x9B, 0x69, 0xA4, 0xA5, 0xCC, + 0xD3, 0x77, 0x49, 0xAB, 0xD8, 0xF2, 0x5B, 0x9F, 0x07, 0xEB, 0x7A, 0x8F, 0x8F, 0x3C, 0x4F, 0x73, + 0xF6, 0x18, 0x12, 0xC7, 0xE1, 0x46, 0x93, 0x1F, 0xFC, 0x24, 0xD3, 0x49, 0x25, 0xC6, 0xAB, 0xA2, + 0xDA, 0x3D, 0x90, 0x16, 0xF1, 0x4B, 0x24, 0x8E, 0x89, 0xB2, 0x39, 0xA6, 0x44, 0xC6, 0xE2, 0xBD, + 0x70, 0x0E, 0x70, 0x07, 0x9B, 0x4E, 0xA6, 0x1E, 0xB7, 0x11, 0xD4, 0xFA, 0xD5, 0x48, 0xBC, 0x35, + 0x38, 0x38, 0xB9, 0x25, 0x28, 0xA4, 0xD4, 0x1F, 0x2B, 0x4A, 0xCE, 0x57, 0xDE, 0x29, 0xD9, 0x5D, + 0xDD, 0x34, 0x95, 0xCE, 0xDC, 0x35, 0x3C, 0x1D, 0x1C, 0xB5, 0xAA, 0x11, 0x76, 0xA9, 0x2E, 0x64, + 0xED, 0xAC, 0x94, 0x9A, 0xD2, 0xC9, 0x6C, 0xAE, 0x97, 0x2C, 0xB4, 0xB7, 0xBB, 0x67, 0x14, 0x79, + 0xA0, 0xD2, 0xF5, 0xA8, 0x7C, 0x27, 0xAD, 0x78, 0xDA, 0x7D, 0x1F, 0x45, 0x1A, 0x4E, 0xBD, 0xAE, + 0x3E, 0x91, 0x65, 0x75, 0x2A, 0x45, 0x2D, 0xC5, 0xA5, 0xDA, 0x91, 0x24, 0xB1, 0xDA, 0x43, 0xB8, + 0x94, 0x01, 0x25, 0xC6, 0x4A, 0x91, 0x85, 0x00, 0x1C, 0x8E, 0x7E, 0x69, 0x50, 0xC1, 0xC3, 0x01, + 0x8D, 0x9D, 0x79, 0x4B, 0xDA, 0xD4, 0x95, 0xA1, 0x16, 0xD2, 0x6A, 0xCD, 0xB6, 0xE4, 0xF4, 0xD6, + 0xD6, 0x6A, 0xD6, 0xD6, 0x3A, 0x5F, 0x67, 0xEA, 0xC6, 0xAA, 0xA7, 0x8C, 0xC3, 0xA8, 0x5E, 0xF1, + 0x57, 0xD9, 0x72, 0xD9, 0x6D, 0xCD, 0x1D, 0x17, 0x4D, 0x17, 0x2B, 0x5D, 0x2C, 0x93, 0x4D, 0x69, + 0x45, 0xE0, 0x5F, 0x16, 0x6A, 0x97, 0x5E, 0x1A, 0xF8, 0x77, 0x61, 0xE1, 0x5B, 0x73, 0xE2, 0x4B, + 0xDB, 0xF2, 0xF6, 0xE2, 0x2F, 0x21, 0x75, 0x1D, 0x45, 0xA7, 0x8C, 0xB2, 0x42, 0xD3, 0x6E, 0xDB, + 0x85, 0x58, 0x5C, 0x85, 0x27, 0x8E, 0x78, 0x1D, 0xFE, 0x93, 0x37, 0xCA, 0x70, 0x78, 0x58, 0xE0, + 0x72, 0x2C, 0x1D, 0x39, 0x3A, 0xEB, 0x92, 0x55, 0x92, 0x70, 0x51, 0xB2, 0x4A, 0xE9, 0xDD, 0xE8, + 0xDB, 0x7E, 0xEF, 0x3A, 0x49, 0xB5, 0xB5, 0xAC, 0xDC, 0xE1, 0xB1, 0x54, 0xB1, 0x14, 0x2B, 0x63, + 0x61, 0x27, 0x68, 0x35, 0x1B, 0x3D, 0x1D, 0xE5, 0x7B, 0x5A, 0x2D, 0x45, 0xE8, 0x93, 0xBB, 0xBF, + 0x2A, 0xB6, 0x96, 0xD4, 0xA0, 0xBE, 0x10, 0xBE, 0xFE, 0xD0, 0xD7, 0x6F, 0xEE, 0x34, 0x6B, 0xD3, + 0xA3, 0x78, 0x7A, 0x46, 0xB3, 0xD4, 0x1E, 0xDE, 0xD4, 0xC0, 0xB0, 0x4A, 0x43, 0xAC, 0x68, 0xC5, + 0x54, 0x46, 0x1C, 0x98, 0xDB, 0x0A, 0xA4, 0x67, 0x1C, 0x71, 0x92, 0x3C, 0x5C, 0x77, 0xF6, 0x2E, + 0x2F, 0x34, 0xC4, 0xB7, 0x85, 0xA9, 0x4F, 0x0B, 0x08, 0xF2, 0xC1, 0x28, 0xDD, 0xF3, 0x27, 0x16, + 0x93, 0xE5, 0x93, 0x51, 0xBA, 0x76, 0x5A, 0xB5, 0x6F, 0xC1, 0xCB, 0xDB, 0x60, 0xB0, 0xD4, 0x3D, + 0x9C, 0xEC, 0xE6, 0x94, 0xEE, 0xE4, 0x9B, 0x51, 0xBB, 0x56, 0x6D, 0xCA, 0x2F, 0x75, 0x67, 0x67, + 0xA2, 0xBA, 0xDE, 0xC8, 0xC0, 0xFF, 0x00, 0x84, 0x57, 0x54, 0x4D, 0x16, 0xCB, 0x51, 0x97, 0x4E, + 0xD4, 0x52, 0xE3, 0x57, 0xBF, 0x16, 0x7A, 0x1D, 0xB4, 0x9A, 0x65, 0xC0, 0xFE, 0xD6, 0x89, 0x4F, + 0x97, 0x23, 0xDA, 0xC8, 0x17, 0x63, 0xED, 0x94, 0x47, 0x1E, 0xD0, 0x49, 0xCB, 0x01, 0x8E, 0xC5, + 0x50, 0xC2, 0xE0, 0x70, 0x39, 0x1C, 0xAA, 0x54, 0xA2, 0xBE, 0xB3, 0x56, 0xAF, 0x22, 0xD6, 0x4B, + 0x96, 0x9D, 0x93, 0x6D, 0x59, 0xFB, 0xAF, 0x99, 0x72, 0xDD, 0xB7, 0x75, 0x74, 0xD3, 0x5B, 0xF5, + 0x53, 0x94, 0x2A, 0xCB, 0x96, 0x93, 0xD5, 0x24, 0xF4, 0xE5, 0xB3, 0xBA, 0x6F, 0x6B, 0xA6, 0xDB, + 0x5A, 0xE8, 0xAD, 0x6F, 0x3D, 0xBA, 0x79, 0xBC, 0x09, 0xA9, 0xDC, 0x6B, 0x7A, 0x3F, 0x84, 0x74, + 0xEF, 0x0F, 0xEB, 0x6D, 0xA9, 0xDA, 0x59, 0xAC, 0xDE, 0x20, 0x9A, 0x0D, 0x13, 0x55, 0x7B, 0xEB, + 0x28, 0x09, 0xDF, 0x71, 0x3C, 0xF6, 0x4D, 0x08, 0x78, 0xE2, 0x8A, 0x27, 0x04, 0xB2, 0xC7, 0x8D, + 0xAB, 0xBB, 0x3C, 0xF1, 0xCB, 0x8A, 0xCB, 0x30, 0x78, 0x7C, 0x45, 0x1C, 0x0E, 0x1A, 0x9F, 0xBF, + 0x3B, 0x73, 0x4A, 0x51, 0x8B, 0xE5, 0x4D, 0x2B, 0x34, 0xE3, 0x29, 0x27, 0x65, 0x77, 0x29, 0x35, + 0x1E, 0x5B, 0x5D, 0x24, 0x91, 0x9D, 0x2A, 0xB2, 0xA4, 0xAA, 0xD4, 0x8D, 0x45, 0xCC, 0xD3, 0x76, + 0x57, 0xD2, 0xCA, 0xD6, 0xD1, 0x26, 0xD3, 0xB2, 0xBA, 0xF7, 0x9B, 0xD9, 0x59, 0x68, 0x5A, 0xD5, + 0x34, 0xAF, 0x05, 0x69, 0x36, 0x96, 0xF2, 0x5D, 0xD9, 0xEA, 0x1A, 0x77, 0xF6, 0xFE, 0xA2, 0xAF, + 0xA6, 0xDD, 0x5B, 0xC7, 0x35, 0xD4, 0xBA, 0x6E, 0x9B, 0x01, 0x0A, 0x2F, 0xAD, 0x11, 0xCC, 0x69, + 0x3F, 0x9E, 0xC9, 0x26, 0x15, 0x9C, 0x6D, 0x1B, 0x48, 0xC7, 0x7D, 0x33, 0x3C, 0xAF, 0x2F, 0xC1, + 0xE0, 0x28, 0xCE, 0x69, 0x35, 0x51, 0xAB, 0x28, 0xB8, 0xEC, 0x92, 0xBE, 0xAD, 0xB6, 0x95, 0xAD, + 0x67, 0x67, 0x1D, 0x5B, 0x4E, 0xEA, 0xC1, 0x85, 0xA9, 0x8B, 0xA5, 0x17, 0x3A, 0x32, 0x6E, 0x71, + 0xB7, 0x2B, 0x97, 0xBA, 0xEF, 0xA3, 0x57, 0x4A, 0x29, 0x2B, 0x5F, 0xA2, 0x5D, 0x13, 0x57, 0xDB, + 0xC9, 0xEE, 0x64, 0x12, 0x4F, 0x23, 0x2C, 0x92, 0x4B, 0x18, 0x62, 0xB0, 0xBC, 0xB1, 0xAC, 0x52, + 0x32, 0x29, 0xC2, 0x16, 0x40, 0x48, 0x53, 0x80, 0x38, 0x04, 0x81, 0xEB, 0x5F, 0x23, 0x1A, 0x74, + 0xE9, 0x27, 0x0A, 0x4A, 0xD1, 0xE8, 0x7A, 0x3C, 0xF5, 0x6A, 0x46, 0x2E, 0xB4, 0x9B, 0x92, 0x49, + 0x6A, 0xDB, 0xD9, 0x6D, 0x77, 0xAD, 0x97, 0x4F, 0x22, 0x0A, 0xA0, 0x0A, 0x00, 0x55, 0x52, 0x70, + 0x14, 0x7D, 0x00, 0x1D, 0x38, 0xE3, 0xF9, 0x56, 0xD8, 0x7C, 0x35, 0x6C, 0x4C, 0xD5, 0x2C, 0x3C, + 0x2E, 0xFC, 0xBA, 0x7F, 0x91, 0x2E, 0x51, 0x82, 0x57, 0xD8, 0xE8, 0x2D, 0x2C, 0xC4, 0x11, 0xA4, + 0xCF, 0x1E, 0x41, 0x03, 0x74, 0x68, 0x01, 0x74, 0x5C, 0x75, 0x3D, 0x38, 0x15, 0xFD, 0x3D, 0xC1, + 0xFC, 0x1B, 0x1C, 0x83, 0x2E, 0xA3, 0x9F, 0x62, 0x70, 0xD2, 0x94, 0x5A, 0x4A, 0x74, 0xE9, 0xC5, + 0x3A, 0x94, 0xE2, 0xD2, 0xBC, 0xE6, 0xDD, 0x97, 0x2A, 0xFB, 0x4E, 0x32, 0x7A, 0x2D, 0x22, 0xF4, + 0x3C, 0x3A, 0xF8, 0x8F, 0x69, 0x27, 0x4A, 0x2D, 0x2E, 0xCF, 0xA7, 0xA2, 0xFD, 0x34, 0x47, 0x49, + 0x1C, 0x49, 0xE5, 0xAB, 0x26, 0x19, 0x0A, 0x82, 0xA5, 0x7A, 0x11, 0x8E, 0x30, 0x3F, 0x0A, 0xFE, + 0xAB, 0xCB, 0xB2, 0xDC, 0x33, 0xCB, 0xE8, 0xE2, 0x30, 0x32, 0x52, 0xA3, 0x38, 0xA9, 0x46, 0x49, + 0xBB, 0x34, 0xD6, 0x8F, 0x64, 0xD7, 0xCD, 0x2D, 0x0F, 0x0E, 0x53, 0xB3, 0x71, 0x92, 0xB3, 0x5A, + 0x58, 0x0A, 0x00, 0x06, 0xD0, 0x06, 0x31, 0x8E, 0xC3, 0x18, 0xE3, 0x1F, 0xA5, 0x5C, 0xF0, 0xAE, + 0x2B, 0xDD, 0x56, 0xB7, 0xDC, 0xD6, 0x9B, 0x74, 0xFC, 0x81, 0x35, 0x65, 0x62, 0x2C, 0x63, 0x8E, + 0x06, 0x38, 0xC0, 0x1D, 0x87, 0x61, 0x5E, 0x25, 0x4C, 0x2C, 0xEF, 0x75, 0x6E, 0x55, 0xD3, 0xCB, + 0xB2, 0xE8, 0xBB, 0x2F, 0x97, 0xA1, 0xAC, 0x5C, 0x62, 0x92, 0x48, 0x00, 0x1C, 0x71, 0x8C, 0x0C, + 0x01, 0xC0, 0xC7, 0x1D, 0x3F, 0x41, 0x51, 0xF5, 0x78, 0x69, 0xEE, 0xB5, 0x6F, 0x2F, 0xEA, 0xDF, + 0x2F, 0x45, 0x60, 0xE6, 0x69, 0x69, 0x62, 0x8D, 0xFD, 0x92, 0x5C, 0x42, 0xA3, 0x18, 0x91, 0x40, + 0xD8, 0x7B, 0x28, 0xC7, 0x03, 0xF4, 0xAF, 0x82, 0xF1, 0x27, 0x81, 0xB0, 0x7C, 0x57, 0x93, 0xD3, + 0xA2, 0xD5, 0xB1, 0x31, 0x8D, 0xE1, 0x27, 0xB4, 0x52, 0x5D, 0x5A, 0x5F, 0x7A, 0xB6, 0xDA, 0x69, + 0xA1, 0xD5, 0x82, 0xC4, 0x4A, 0x84, 0xEE, 0xBE, 0x1E, 0xA7, 0x20, 0xF1, 0x98, 0x9C, 0xC6, 0xC0, + 0x02, 0x87, 0x1C, 0x0C, 0x0C, 0x0E, 0x98, 0x1F, 0x95, 0x7F, 0x0C, 0x66, 0xB9, 0x66, 0x23, 0x27, + 0xC7, 0xD5, 0xCB, 0xB1, 0x4B, 0xDF, 0x83, 0xB6, 0xCD, 0x27, 0x6D, 0x9A, 0xBA, 0x5A, 0x5B, 0xC8, + 0xFA, 0x7A, 0x53, 0x8D, 0x48, 0x29, 0x47, 0x61, 0x95, 0xE7, 0x9A, 0x1F, 0xA3, 0x5F, 0xB1, 0xDF, + 0xEC, 0x78, 0x7E, 0x28, 0x1B, 0x3F, 0x1C, 0xF8, 0xE6, 0xCE, 0x46, 0xF0, 0xDF, 0x9A, 0xAF, 0xA4, + 0x68, 0xE4, 0x05, 0x5D, 0x49, 0x54, 0x9F, 0xDE, 0x4C, 0xB8, 0xE5, 0x4E, 0xD1, 0xB5, 0x7A, 0x10, + 0x09, 0x39, 0x1C, 0x0F, 0xAD, 0xE1, 0xEE, 0x1D, 0xAB, 0x99, 0x54, 0x8E, 0x9A, 0x68, 0xDB, 0xE9, + 0x15, 0xBA, 0xB7, 0x46, 0xDA, 0x5B, 0x74, 0xEA, 0xBB, 0x7C, 0xDE, 0x73, 0x9B, 0xC7, 0x05, 0x0E, + 0x48, 0xBD, 0x36, 0xEC, 0xDB, 0x76, 0x56, 0x4F, 0xA2, 0x5E, 0x49, 0xDF, 0x44, 0x95, 0xF4, 0x7F, + 0xD0, 0xFF, 0x00, 0xC2, 0xFF, 0x00, 0xD9, 0xAB, 0xC3, 0xBA, 0x26, 0x8F, 0x69, 0x01, 0xD3, 0x6D, + 0xB4, 0xAB, 0x48, 0xA0, 0x45, 0x86, 0xC6, 0xC6, 0x04, 0x80, 0xA0, 0x0B, 0xB5, 0x54, 0xED, 0x5E, + 0x3B, 0x0C, 0x73, 0xD4, 0xF4, 0xC0, 0xCF, 0xE8, 0x70, 0xA5, 0x95, 0xE5, 0x91, 0x54, 0xF0, 0xB4, + 0x94, 0xA7, 0xB3, 0x94, 0xB5, 0x6E, 0xD6, 0xDB, 0x6F, 0xF2, 0x56, 0xD1, 0x58, 0xF9, 0x35, 0xF5, + 0xFC, 0xC2, 0xD2, 0x9C, 0xF9, 0x29, 0xE9, 0x64, 0xBB, 0x6B, 0x65, 0xA5, 0xBD, 0x35, 0xBD, 0xED, + 0xBD, 0x99, 0xED, 0x9F, 0xF0, 0xA9, 0xBC, 0x0C, 0x22, 0xF2, 0x1B, 0x4E, 0x80, 0xE5, 0x40, 0x04, + 0xBA, 0x86, 0x50, 0x00, 0x03, 0x00, 0x77, 0x19, 0x1C, 0x77, 0xE0, 0x77, 0xAA, 0x8E, 0x3A, 0xBA, + 0xB7, 0x2C, 0x55, 0xBD, 0x17, 0xF9, 0x6D, 0xA7, 0xF5, 0x65, 0x66, 0xB2, 0xDC, 0x3A, 0x87, 0x2B, + 0x9C, 0xAF, 0xEA, 0xBB, 0x5B, 0x55, 0xB6, 0xD6, 0xDD, 0x75, 0x5D, 0x16, 0x9E, 0x3B, 0xF1, 0x13, + 0xF6, 0x6C, 0xF0, 0xC6, 0xBF, 0xA6, 0xDD, 0x47, 0xA7, 0xDB, 0xDB, 0x4E, 0xCD, 0x13, 0x2B, 0xD8, + 0xDD, 0x46, 0x93, 0x43, 0x2A, 0x95, 0x19, 0x50, 0x08, 0x38, 0xE3, 0x23, 0x27, 0x8F, 0x63, 0x9C, + 0x07, 0x2F, 0xA8, 0x63, 0xA2, 0xA9, 0xE3, 0xA9, 0x2B, 0x59, 0x2B, 0xA5, 0xAA, 0xF9, 0xAD, 0x56, + 0xDA, 0x25, 0xE6, 0xAF, 0xA6, 0xB0, 0xE8, 0xE2, 0xF0, 0x51, 0xBE, 0x12, 0xAB, 0x71, 0x49, 0x5E, + 0x32, 0xBB, 0x56, 0xB7, 0x4D, 0xDE, 0x9D, 0x34, 0xED, 0xBA, 0x3F, 0x9F, 0xDF, 0xDB, 0x0B, 0xF6, + 0x2C, 0x6F, 0x01, 0xC1, 0xA8, 0x78, 0xEF, 0xC0, 0x7A, 0x64, 0x96, 0x96, 0x96, 0x8C, 0xD2, 0xEB, + 0xBE, 0x1E, 0x85, 0x14, 0x45, 0x02, 0x80, 0x4B, 0xCB, 0x02, 0x0C, 0x6D, 0xC0, 0x00, 0xED, 0x03, + 0x91, 0xD0, 0x0C, 0x73, 0xF0, 0x1C, 0x43, 0xC3, 0x8F, 0x01, 0x35, 0x3A, 0x29, 0x72, 0x35, 0xEE, + 0xB5, 0x6B, 0x4B, 0xAD, 0x9D, 0xB4, 0xE6, 0xED, 0x6D, 0x1E, 0xDB, 0xED, 0xF5, 0x39, 0x1E, 0x73, + 0xF5, 0xBA, 0x71, 0x85, 0x4E, 0x9A, 0x5B, 0xAA, 0x7D, 0x2D, 0x65, 0xAA, 0x7B, 0x74, 0xB5, 0xAD, + 0xA5, 0xB5, 0xF9, 0xC3, 0xF6, 0x0D, 0xBB, 0xBA, 0xB6, 0xFD, 0xB5, 0xFF, 0x00, 0x64, 0x18, 0x6D, + 0xEE, 0x6E, 0x20, 0x86, 0xE7, 0xF6, 0xA3, 0xF8, 0x7D, 0x1D, 0xCC, 0x50, 0xCC, 0xD1, 0x45, 0x70, + 0xA3, 0xC5, 0x76, 0x20, 0x2C, 0x8A, 0x08, 0x0C, 0x30, 0xCC, 0x30, 0x47, 0x73, 0xEB, 0x5F, 0x2F, + 0x96, 0x69, 0x98, 0x61, 0xD2, 0xDB, 0x9E, 0x1F, 0xFA, 0x52, 0x3E, 0x87, 0x12, 0x97, 0xD5, 0xAA, + 0x69, 0xF6, 0x5F, 0xE4, 0x7F, 0xA0, 0x6D, 0x7E, 0xA6, 0x7C, 0x70, 0x50, 0x01, 0x40, 0x05, 0x00, + 0x7F, 0x14, 0x5F, 0xF0, 0x5A, 0xFF, 0x00, 0xF9, 0x48, 0x1F, 0xC4, 0x8F, 0xFB, 0x12, 0xFC, 0x27, + 0xFF, 0x00, 0xA8, 0xF5, 0xAD, 0x7E, 0x75, 0xC4, 0x1F, 0xF2, 0x34, 0x9F, 0xA4, 0x7F, 0xF4, 0x94, + 0x7D, 0x46, 0x57, 0xFE, 0xE5, 0x1F, 0x9F, 0xE6, 0x7E, 0x78, 0x7C, 0x31, 0xF8, 0x37, 0xE3, 0x9F, + 0x8B, 0x1A, 0x9C, 0x1A, 0x7F, 0x85, 0xB4, 0xC5, 0x5B, 0x47, 0xB8, 0x5B, 0x5B, 0x8D, 0x73, 0x52, + 0x63, 0x65, 0xA2, 0x59, 0x31, 0xC6, 0x55, 0xA6, 0xC1, 0xDC, 0xC0, 0x10, 0x76, 0x46, 0xAE, 0xD8, + 0xFE, 0x1C, 0x57, 0x1E, 0x0B, 0x2E, 0xC4, 0xE3, 0x54, 0xA5, 0x46, 0x3E, 0xE4, 0x56, 0xAF, 0xA2, + 0xF2, 0xFE, 0xB4, 0xEF, 0x61, 0xE3, 0x73, 0x2C, 0x26, 0x03, 0x96, 0x15, 0xA5, 0xEF, 0xCB, 0x48, + 0xC5, 0x6E, 0xFF, 0x00, 0x44, 0x97, 0x9F, 0xCB, 0xB1, 0xF7, 0xB7, 0x89, 0xFF, 0x00, 0xE0, 0x9E, + 0xED, 0xE0, 0x2F, 0x06, 0x47, 0xAC, 0x2F, 0xC4, 0x9B, 0x8B, 0x8F, 0x13, 0xB1, 0x8F, 0x2D, 0x6B, + 0x60, 0xDA, 0x7E, 0x8D, 0x01, 0xE3, 0x7A, 0x05, 0x0D, 0xE6, 0x9F, 0xBC, 0xA0, 0x31, 0x61, 0xD3, + 0xEE, 0xF6, 0xAF, 0xAF, 0xE1, 0x7F, 0xAB, 0xD1, 0xAB, 0x2C, 0x1C, 0xE5, 0x51, 0xC1, 0xB4, 0xDA, + 0x53, 0x94, 0x22, 0xDA, 0xEF, 0x18, 0xC9, 0x27, 0xDB, 0x57, 0xB6, 0x9A, 0x2B, 0x9F, 0x3D, 0x9B, + 0xE6, 0x98, 0xCC, 0x35, 0x38, 0xE2, 0xA9, 0x53, 0x83, 0x84, 0x77, 0x4F, 0x77, 0x75, 0x64, 0x94, + 0xAC, 0xD4, 0x6D, 0xBD, 0xF9, 0x5A, 0x69, 0x5B, 0x4B, 0xDD, 0x67, 0x78, 0x53, 0xF6, 0x06, 0xF1, + 0xE6, 0xAD, 0xA4, 0x5B, 0xEB, 0x17, 0x5E, 0x26, 0xD0, 0x61, 0x96, 0xE7, 0x32, 0x1D, 0xB6, 0x93, + 0x5C, 0x45, 0x1C, 0x78, 0xE1, 0xDA, 0x52, 0xC0, 0x93, 0x81, 0xD0, 0x29, 0xEA, 0x39, 0xAF, 0xDE, + 0x78, 0x3F, 0xC5, 0xDE, 0x1C, 0xE0, 0xEC, 0x54, 0x70, 0xB4, 0xF2, 0x7A, 0x36, 0x57, 0xBB, 0x8C, + 0x64, 0x9D, 0xEC, 0xD5, 0xD2, 0x72, 0xB5, 0xDB, 0xEA, 0xF5, 0x7D, 0xAF, 0x63, 0xC8, 0x95, 0x5C, + 0xE3, 0x19, 0x42, 0x35, 0x70, 0x94, 0x23, 0x18, 0x36, 0xAD, 0x19, 0x54, 0xB3, 0xB7, 0x57, 0xEE, + 0xD3, 0x69, 0x7A, 0x5E, 0xDA, 0x59, 0xB5, 0xD3, 0xD5, 0x35, 0x3F, 0xF8, 0x27, 0xFF, 0x00, 0xC4, + 0x3D, 0x17, 0xC3, 0xB7, 0xDA, 0xDF, 0x84, 0x6D, 0xB4, 0x2F, 0x1E, 0xCB, 0xA6, 0x58, 0x1B, 0xFB, + 0xED, 0x2D, 0x74, 0x2B, 0x99, 0x2E, 0xAD, 0xE2, 0x8D, 0x5C, 0xC8, 0xC8, 0xC9, 0x2F, 0x4C, 0x02, + 0x30, 0x41, 0xF6, 0x2A, 0x42, 0xE7, 0xFA, 0x27, 0x85, 0xFC, 0x68, 0xE1, 0xFC, 0xE2, 0x93, 0xFA, + 0xEE, 0x5D, 0xEC, 0xA0, 0x9C, 0x5F, 0x3C, 0x6D, 0x64, 0xB4, 0xD1, 0xBB, 0xA7, 0x64, 0xD6, 0xC9, + 0x29, 0x37, 0x7B, 0xA6, 0xAE, 0x7C, 0xFE, 0x39, 0x66, 0x98, 0x38, 0xC2, 0x78, 0xC9, 0xBF, 0x67, + 0x75, 0x77, 0x4E, 0x49, 0x34, 0x9A, 0xD5, 0x72, 0xB8, 0xA5, 0x2B, 0x5B, 0x45, 0x78, 0xEB, 0xB5, + 0xAE, 0xD1, 0x43, 0xE0, 0xD7, 0xEC, 0xF5, 0xA8, 0xF8, 0xFF, 0x00, 0xC3, 0xB7, 0x5E, 0x21, 0xD4, + 0x74, 0x0F, 0x87, 0x3A, 0x4A, 0xDB, 0xCB, 0x25, 0xA5, 0xBD, 0x95, 0xEE, 0x87, 0x73, 0x7B, 0x34, + 0x4F, 0x0E, 0xE1, 0x22, 0xC8, 0x9F, 0x6B, 0x55, 0x5C, 0xB0, 0x38, 0x03, 0x00, 0x11, 0x81, 0xD7, + 0x8F, 0xB6, 0xCD, 0x78, 0xD3, 0x07, 0x93, 0x62, 0x21, 0x83, 0xC3, 0xD4, 0x9D, 0x45, 0x34, 0xA5, + 0xCC, 0xA4, 0xD2, 0x4A, 0x49, 0x4A, 0x29, 0x3B, 0x5D, 0xC5, 0x2B, 0x24, 0x92, 0xDA, 0xEE, 0xDA, + 0x2B, 0xFC, 0xFD, 0x3A, 0x19, 0x9E, 0x69, 0xCD, 0xFD, 0x99, 0x8E, 0xAA, 0xE8, 0x41, 0x38, 0xA9, + 0x4E, 0x69, 0x4A, 0x5B, 0x69, 0x18, 0xA8, 0x5A, 0x0A, 0x37, 0x6F, 0x99, 0xBB, 0xF5, 0x6A, 0xDA, + 0x8E, 0xF8, 0x4D, 0xE0, 0xF9, 0xE1, 0xF8, 0xD1, 0x7D, 0xE1, 0xBD, 0x57, 0xC0, 0xBF, 0x0E, 0x1A, + 0xCB, 0xC1, 0x64, 0x6A, 0x72, 0xEA, 0x3A, 0x46, 0x93, 0x75, 0x1A, 0xCE, 0x48, 0xC5, 0xB2, 0xAB, + 0x3D, 0xC3, 0x60, 0x70, 0x40, 0x53, 0x9E, 0xA0, 0x74, 0xE2, 0xBD, 0x7C, 0xEF, 0x15, 0x7E, 0x1E, + 0x86, 0x6B, 0x84, 0xC5, 0xD6, 0x75, 0x2B, 0x7B, 0xAA, 0x37, 0x94, 0xA2, 0x96, 0x8A, 0x4D, 0xA5, + 0x24, 0xBC, 0xD5, 0xBC, 0xED, 0xAA, 0x8A, 0x5C, 0x75, 0x2A, 0x62, 0x73, 0x0A, 0x14, 0xB0, 0x33, + 0xC5, 0x56, 0x72, 0x94, 0x9A, 0x9C, 0x65, 0x28, 0xDA, 0xD4, 0xD2, 0xB2, 0xF7, 0x63, 0x1B, 0xAB, + 0xB8, 0xDB, 0x45, 0xCA, 0x93, 0x49, 0x2D, 0x4F, 0x6F, 0xF8, 0xC5, 0xE2, 0x1B, 0x6F, 0x13, 0x78, + 0xCF, 0xC0, 0xBF, 0x0B, 0x6C, 0x7C, 0x27, 0xE1, 0x3B, 0xCF, 0xED, 0x82, 0xDA, 0xA6, 0xBC, 0xD7, + 0x3A, 0x5C, 0xF3, 0x25, 0x9C, 0x10, 0x38, 0x65, 0x2A, 0x04, 0xBB, 0x55, 0xF3, 0x1A, 0xE0, 0x63, + 0x83, 0x8C, 0xE4, 0x6D, 0xDB, 0xF3, 0xFC, 0x31, 0x95, 0xCB, 0x05, 0x96, 0x62, 0x78, 0x83, 0x17, + 0x5A, 0xA4, 0x63, 0x04, 0xA3, 0x0B, 0xB9, 0xC5, 0x36, 0xD3, 0x4D, 0x7C, 0x5A, 0xB7, 0x17, 0x6D, + 0x6F, 0xA6, 0xA9, 0xAB, 0xD9, 0xF2, 0xE6, 0x14, 0xAA, 0xBA, 0xAA, 0x9D, 0x1A, 0xD3, 0xE6, 0x8D, + 0xA3, 0x16, 0xB9, 0x64, 0xEF, 0x3B, 0xA7, 0x6F, 0x76, 0xF6, 0x50, 0x53, 0x72, 0x5D, 0x9C, 0x5A, + 0xB3, 0xBB, 0x3D, 0x2B, 0xC7, 0x3A, 0x74, 0x3A, 0xEE, 0x87, 0x63, 0xE0, 0x6D, 0x1E, 0xC3, 0xC3, + 0x96, 0x17, 0x1A, 0xFE, 0x34, 0xAB, 0x76, 0xB8, 0xD3, 0x9A, 0x45, 0x82, 0x05, 0x5F, 0xDE, 0x10, + 0x9E, 0x71, 0xCF, 0xC8, 0x63, 0x50, 0x32, 0x33, 0xBB, 0xD1, 0x4E, 0x3E, 0x7F, 0x2F, 0x9D, 0x3C, + 0x25, 0x6A, 0x99, 0xC6, 0x3F, 0x95, 0xC6, 0x9A, 0x6D, 0xA4, 0xE6, 0x9B, 0x7B, 0x24, 0x9F, 0x32, + 0xB2, 0x76, 0x49, 0xDD, 0x34, 0xB4, 0x5B, 0xB4, 0x8F, 0x52, 0x39, 0x2E, 0x3F, 0x16, 0xA8, 0xE0, + 0x32, 0xD7, 0x37, 0x28, 0xB8, 0xBB, 0xA7, 0xEE, 0xC1, 0x45, 0xA7, 0x77, 0x34, 0xBD, 0xDB, 0x59, + 0x38, 0xB5, 0xCA, 0xFA, 0xA7, 0x6B, 0x33, 0xCF, 0xAE, 0xFF, 0x00, 0x62, 0xBD, 0x27, 0xC3, 0x11, + 0xDB, 0x6A, 0x9A, 0x9C, 0x3E, 0x12, 0xD6, 0x6D, 0xE5, 0x22, 0x39, 0x22, 0x8F, 0xC3, 0x23, 0x4F, + 0xB7, 0x80, 0xB2, 0x80, 0xAA, 0x54, 0x48, 0xD8, 0xCE, 0x18, 0xE7, 0x9C, 0x1F, 0x4E, 0x05, 0x72, + 0xD6, 0xF1, 0x72, 0xB6, 0x61, 0x09, 0x60, 0x72, 0xEA, 0x72, 0xA5, 0x18, 0xDB, 0x4E, 0x69, 0x3D, + 0x13, 0xFB, 0x29, 0xCA, 0x2A, 0xCA, 0xC9, 0x26, 0x9A, 0xEA, 0xDE, 0x89, 0x5F, 0xF5, 0x6C, 0x83, + 0x84, 0xB0, 0x78, 0x75, 0x1A, 0xB9, 0xAD, 0x6A, 0xB5, 0x6B, 0x5D, 0x35, 0xFB, 0xD9, 0x28, 0x2B, + 0x6A, 0xEF, 0x1D, 0x5C, 0xEC, 0xF4, 0x6A, 0x4E, 0xCD, 0x36, 0xF9, 0x53, 0x49, 0x1D, 0x3E, 0xBF, + 0xF0, 0x12, 0xFB, 0xC1, 0xFE, 0x1A, 0x8B, 0x5B, 0xF0, 0xAE, 0x9D, 0xA0, 0x45, 0x6B, 0x0C, 0xAA, + 0x2F, 0x6D, 0x13, 0x41, 0x53, 0x24, 0x50, 0x1C, 0x6E, 0x11, 0x80, 0xC0, 0xE0, 0x02, 0x4F, 0xDE, + 0xFE, 0x11, 0x9E, 0xA3, 0x1F, 0x1D, 0x4B, 0x88, 0xF0, 0xB9, 0x86, 0x61, 0x2C, 0xB7, 0x18, 0xAF, + 0x56, 0xDE, 0xEB, 0x77, 0x6B, 0x4B, 0xDA, 0xEB, 0x5B, 0xC9, 0xE9, 0xE6, 0xAF, 0x64, 0xEC, 0x9D, + 0xBF, 0x47, 0x87, 0x12, 0x46, 0x86, 0x0B, 0x5A, 0x55, 0x27, 0x4E, 0x0A, 0xCA, 0x31, 0x92, 0x4D, + 0x28, 0xE8, 0xE5, 0x18, 0xF2, 0xF2, 0xB6, 0x92, 0x72, 0x51, 0x4A, 0x2A, 0x5B, 0x26, 0xB4, 0x46, + 0x7E, 0xB5, 0xF0, 0x7E, 0xD3, 0x53, 0xD1, 0xED, 0xA7, 0x17, 0x76, 0x89, 0x6F, 0x3C, 0xB1, 0x2B, + 0x34, 0xB6, 0x70, 0x3F, 0x94, 0xCC, 0x32, 0xAB, 0x08, 0x6C, 0x64, 0x70, 0x79, 0xE3, 0x95, 0x5E, + 0xFC, 0x57, 0x2E, 0x5F, 0x9E, 0x62, 0x30, 0x38, 0x99, 0xDE, 0x84, 0x65, 0x08, 0xFC, 0x56, 0x8B, + 0x4E, 0x29, 0x74, 0x6A, 0xFA, 0x59, 0xA4, 0xAE, 0xF4, 0x49, 0x3B, 0x36, 0xB5, 0x5D, 0x0B, 0x89, + 0xF1, 0x4A, 0x84, 0xE5, 0x80, 0x93, 0x55, 0x25, 0x06, 0xE1, 0x24, 0xF5, 0x57, 0x8B, 0x4A, 0x4B, + 0x44, 0x9D, 0xB4, 0x7C, 0xB6, 0x7A, 0x36, 0xB9, 0x76, 0x89, 0xED, 0xBA, 0x67, 0xFC, 0x13, 0xCF, + 0xE3, 0x2E, 0xA5, 0xE0, 0x75, 0xD7, 0xEF, 0x6E, 0x3C, 0x1F, 0xF0, 0xD7, 0xE1, 0x84, 0xD6, 0xCB, + 0x04, 0x1F, 0x13, 0xBE, 0x34, 0xDD, 0x41, 0xF0, 0xDB, 0xC0, 0x31, 0x89, 0xC6, 0xC8, 0x52, 0xCE, + 0x69, 0x10, 0xDC, 0xDF, 0x93, 0xE6, 0x9F, 0xDD, 0xD8, 0xDB, 0x5C, 0xC8, 0x48, 0xC2, 0x8E, 0x48, + 0x5F, 0x9F, 0xC4, 0xF8, 0x85, 0x80, 0xA9, 0x8A, 0xE5, 0xC2, 0xE1, 0x9D, 0x4C, 0x4A, 0x92, 0x6E, + 0x9C, 0x21, 0xCD, 0x29, 0x28, 0xDB, 0x99, 0xA4, 0xDA, 0xB2, 0x8A, 0x8D, 0xF9, 0x9F, 0x2C, 0x14, + 0x52, 0x77, 0xEF, 0xAE, 0x53, 0xC5, 0xD5, 0x28, 0x54, 0xA3, 0xFD, 0xAE, 0xA5, 0x3C, 0x44, 0x6D, + 0xCD, 0x2A, 0x4A, 0xFC, 0xF6, 0xB3, 0x72, 0xB6, 0x8A, 0x32, 0xB2, 0x6A, 0x4A, 0xE9, 0x5F, 0x5B, + 0x24, 0xD5, 0xB9, 0x8D, 0x6F, 0xE1, 0x3F, 0xEC, 0x3D, 0xFB, 0x36, 0x84, 0xD0, 0xBE, 0x21, 0xD9, + 0x7C, 0x62, 0xFD, 0xB0, 0xBC, 0x77, 0x04, 0x31, 0x6B, 0x0B, 0x07, 0x87, 0x2D, 0xCF, 0xEC, 0xD7, + 0xFB, 0x3B, 0xDC, 0x92, 0xA3, 0x36, 0xE3, 0x54, 0xB8, 0x49, 0xBC, 0x47, 0xA8, 0xDB, 0xE1, 0xD7, + 0x7B, 0xC3, 0x06, 0x9E, 0xDF, 0x22, 0xA8, 0x68, 0xB2, 0x0B, 0xED, 0xFE, 0xB8, 0x71, 0x8E, 0x6F, + 0x88, 0x8D, 0x6C, 0xBA, 0x9D, 0x0C, 0x2D, 0x1D, 0x55, 0xED, 0x1A, 0xD5, 0x15, 0xF4, 0xE6, 0x7A, + 0xBA, 0x30, 0x5A, 0x24, 0x9B, 0x8C, 0xA3, 0x6B, 0xC9, 0xF3, 0xDB, 0x91, 0x7D, 0x3E, 0x1F, 0x38, + 0xCE, 0x73, 0xFA, 0x1E, 0xD7, 0x07, 0x3A, 0x78, 0x6A, 0x32, 0x6E, 0x0E, 0xED, 0xD6, 0xA8, 0x92, + 0x69, 0xAF, 0x75, 0x38, 0xC2, 0x32, 0x4F, 0x58, 0xA6, 0xF7, 0xBB, 0x57, 0xB5, 0xD7, 0x9B, 0x4D, + 0xFF, 0x00, 0x05, 0x09, 0xF8, 0xDB, 0xE0, 0xD9, 0xE7, 0xD0, 0x7F, 0x66, 0xBF, 0x85, 0xFF, 0x00, + 0x02, 0xBF, 0x64, 0x5D, 0x33, 0xE7, 0x4D, 0x30, 0x7C, 0x28, 0xF8, 0x63, 0xA7, 0x5F, 0x7C, 0x40, + 0x8A, 0xDE, 0x58, 0xC2, 0x98, 0xBF, 0xE1, 0x34, 0xD6, 0x96, 0xFB, 0x59, 0xDC, 0x7C, 0xA6, 0x26, + 0x48, 0xAE, 0x61, 0x24, 0x92, 0x4D, 0x79, 0x3F, 0xEA, 0xAE, 0x57, 0x83, 0xA9, 0x46, 0x39, 0xFD, + 0x79, 0xE3, 0x6A, 0xD4, 0xB3, 0xB4, 0xAA, 0x4A, 0x51, 0x6F, 0x74, 0x9C, 0x14, 0x94, 0x39, 0x52, + 0x71, 0x4E, 0x3F, 0x0B, 0x8A, 0x4A, 0x31, 0x8D, 0xDA, 0x5F, 0x4B, 0x4F, 0x85, 0xB8, 0x7B, 0x13, + 0x86, 0x9D, 0x6C, 0xF7, 0x15, 0x57, 0x17, 0x38, 0xB4, 0xDD, 0xE7, 0x35, 0x06, 0x93, 0x49, 0x4F, + 0xD9, 0xC1, 0xA4, 0x9A, 0x8D, 0xD3, 0x4F, 0x99, 0xAB, 0xBB, 0x26, 0x9A, 0x3C, 0x03, 0xC4, 0xF0, + 0xFE, 0xD0, 0x9F, 0xB4, 0x2D, 0xFB, 0x78, 0xAB, 0xE2, 0xDF, 0x8D, 0x3C, 0x63, 0xE3, 0x51, 0x34, + 0xCD, 0x72, 0xDA, 0xA7, 0xC4, 0xAD, 0x7E, 0xF7, 0xC4, 0x5E, 0x4B, 0xB8, 0x0B, 0x24, 0xB6, 0xD1, + 0x5C, 0x4A, 0xE5, 0x32, 0xB1, 0xA8, 0x3B, 0x51, 0x06, 0x00, 0xC7, 0x18, 0xCE, 0xD8, 0xAC, 0xD3, + 0x2E, 0xCB, 0xE8, 0x3C, 0x16, 0x0B, 0x28, 0xC3, 0xFB, 0x34, 0xEC, 0xA3, 0xEC, 0xE0, 0xE3, 0xEE, + 0xEB, 0x76, 0x9A, 0xDD, 0x5D, 0xF5, 0x6E, 0x2E, 0xE9, 0x69, 0xAB, 0xCF, 0x35, 0xE2, 0x1E, 0x0F, + 0xE1, 0x1A, 0x12, 0x8E, 0x02, 0x09, 0xC5, 0x2B, 0x35, 0x4D, 0xA4, 0xD7, 0x44, 0xDB, 0x49, 0x26, + 0xAF, 0x65, 0x67, 0x75, 0x75, 0xAF, 0x53, 0x9B, 0xF1, 0xCF, 0xEC, 0xF9, 0xAF, 0xD9, 0x78, 0x3E, + 0xF7, 0xFB, 0x0F, 0x46, 0xD5, 0xBC, 0x67, 0xA9, 0xDC, 0xDA, 0x0B, 0x5B, 0x4D, 0x33, 0xC3, 0x7A, + 0x11, 0xD6, 0xE5, 0x9A, 0x46, 0x4C, 0xAA, 0xAD, 0x94, 0x0A, 0xF3, 0x67, 0xE5, 0x66, 0x07, 0x03, + 0x01, 0x7F, 0x0A, 0xE7, 0xC1, 0x71, 0x26, 0x6B, 0x4B, 0x13, 0x87, 0xC4, 0x56, 0xC1, 0x50, 0xA7, + 0x05, 0x35, 0x18, 0xB9, 0x42, 0x2E, 0x2B, 0x7B, 0x2B, 0x5D, 0xA4, 0xAC, 0xAD, 0xF0, 0xC6, 0x2D, + 0x3B, 0x7B, 0xAA, 0xD6, 0xF0, 0xB1, 0x1C, 0x77, 0x84, 0xE2, 0x2C, 0xA3, 0x11, 0x81, 0xC5, 0xC6, + 0x2A, 0x83, 0xA4, 0xDA, 0xE6, 0x94, 0xAE, 0xDB, 0x8D, 0xE0, 0xE2, 0xF6, 0x6D, 0x36, 0xBD, 0xD8, + 0xA6, 0xEF, 0xE6, 0x8E, 0x57, 0xE1, 0x77, 0xEC, 0xE1, 0xAE, 0xF8, 0x46, 0xE2, 0xD8, 0xFC, 0x52, + 0x97, 0xE1, 0x47, 0xC3, 0xFB, 0xF9, 0x49, 0x91, 0x6D, 0xBC, 0x4D, 0xAC, 0xC7, 0xE2, 0x8F, 0x17, + 0x40, 0xA3, 0x69, 0x08, 0x74, 0x3B, 0x05, 0xB8, 0x96, 0x39, 0x00, 0x03, 0xE4, 0x94, 0xC5, 0xD5, + 0x73, 0xB4, 0x8C, 0xD7, 0xD3, 0x66, 0xBC, 0x4B, 0x86, 0xC7, 0xE1, 0xF9, 0x30, 0xF8, 0x0A, 0x0E, + 0xCB, 0x45, 0xEC, 0xA3, 0x16, 0xE5, 0x66, 0xA2, 0xED, 0x1E, 0x69, 0x24, 0xDD, 0xB5, 0x4D, 0x34, + 0x93, 0xB2, 0x7A, 0x23, 0xF9, 0x1F, 0x8A, 0xE8, 0x56, 0xE7, 0x84, 0xE5, 0x98, 0xBA, 0x14, 0x76, + 0xE5, 0xDE, 0xF6, 0xFE, 0x54, 0xAE, 0xE7, 0x76, 0xD4, 0x52, 0xB6, 0xFA, 0x5E, 0xDB, 0x7D, 0x5F, + 0xA7, 0x78, 0x1B, 0xC2, 0x96, 0xF0, 0xA8, 0xFB, 0x7F, 0x8C, 0xFC, 0x4E, 0xF1, 0x94, 0x91, 0x7E, + 0xC7, 0x63, 0x61, 0xF0, 0xD7, 0x42, 0x65, 0xC1, 0xC4, 0x7B, 0x31, 0x73, 0x73, 0x82, 0xA4, 0x64, + 0xFC, 0x87, 0x04, 0x63, 0x19, 0xC0, 0xF8, 0xEC, 0x5F, 0x10, 0x60, 0xF2, 0xFB, 0xA7, 0x81, 0xA3, + 0x29, 0xDA, 0xD7, 0x54, 0x20, 0xA3, 0x7D, 0x2E, 0xD3, 0x7C, 0xCE, 0x51, 0xD2, 0xC9, 0xB8, 0xC5, + 0xAE, 0xAA, 0xE9, 0x27, 0xF3, 0xB4, 0xB2, 0x7A, 0x35, 0x94, 0x64, 0xA7, 0x5E, 0xAB, 0xB5, 0x94, + 0xA5, 0x25, 0x4A, 0x32, 0x4F, 0x5F, 0x86, 0x37, 0x6B, 0x4B, 0x2D, 0x6F, 0xB5, 0xB4, 0x7B, 0x69, + 0xDC, 0x41, 0xAE, 0x69, 0x2A, 0xCD, 0xE0, 0x7F, 0x06, 0x7C, 0x3C, 0xD2, 0x65, 0xE1, 0x56, 0x6F, + 0x11, 0xC1, 0xA8, 0xF8, 0xDA, 0xEF, 0x80, 0x30, 0xE1, 0xAF, 0x2E, 0x1A, 0x25, 0x62, 0x15, 0x49, + 0xDB, 0x18, 0x19, 0xCE, 0x14, 0x64, 0xD7, 0xCC, 0x57, 0xE2, 0x7A, 0x13, 0xAA, 0x9D, 0x6A, 0x54, + 0x6D, 0xCC, 0x9D, 0xA3, 0x46, 0x0F, 0x4D, 0x6E, 0xB4, 0xB5, 0xD7, 0x55, 0xB2, 0xD1, 0x34, 0xD6, + 0x89, 0x7A, 0x3F, 0xD9, 0x75, 0xB0, 0xF1, 0x7F, 0x51, 0xC1, 0xD2, 0xE5, 0xB6, 0x8A, 0x55, 0x2A, + 0x49, 0xDB, 0x4D, 0x79, 0x9D, 0xEC, 0xEC, 0x93, 0x56, 0x49, 0x2D, 0x94, 0x56, 0x87, 0x23, 0xF1, + 0x47, 0xE3, 0x2F, 0xC7, 0xDF, 0x84, 0x36, 0x7F, 0x0F, 0x75, 0xAB, 0x3F, 0x17, 0x59, 0xDC, 0xE8, + 0xFE, 0x2C, 0xB8, 0x7B, 0x7D, 0x46, 0xD7, 0x40, 0xF0, 0x76, 0x89, 0xE1, 0xBB, 0xFD, 0x05, 0xE3, + 0x74, 0x44, 0x58, 0xD2, 0xC1, 0x4D, 0xC3, 0xC5, 0xBE, 0x53, 0x8F, 0x33, 0x6B, 0xE0, 0x29, 0x00, + 0x92, 0x71, 0xF6, 0x38, 0x5C, 0x26, 0x16, 0x4F, 0x0D, 0x4E, 0xAA, 0xA5, 0xEC, 0xB1, 0x0F, 0x97, + 0x9A, 0x38, 0x78, 0x5A, 0x37, 0x77, 0x4A, 0x30, 0x94, 0xD3, 0x8D, 0xF9, 0x5E, 0xAA, 0x5C, 0x8D, + 0xC7, 0x46, 0xBA, 0x67, 0x43, 0xDB, 0x66, 0x15, 0xE1, 0x97, 0xD3, 0xC4, 0xCA, 0x86, 0x22, 0xD7, + 0x84, 0x25, 0x18, 0xB8, 0x4A, 0x51, 0xB7, 0x32, 0xE6, 0x49, 0x69, 0xAA, 0xE5, 0xB3, 0xD6, 0xCD, + 0x3B, 0x6C, 0x7A, 0x5F, 0x80, 0x7E, 0x3A, 0x78, 0xB3, 0xE2, 0x05, 0xAD, 0xDC, 0xFA, 0x9F, 0x8A, + 0x7C, 0x48, 0xD7, 0xF6, 0x37, 0x4D, 0x67, 0x72, 0x92, 0x6A, 0x17, 0x96, 0xAE, 0x4A, 0x80, 0x18, + 0x98, 0xCB, 0x02, 0x9D, 0x40, 0x2A, 0xC1, 0x4F, 0xB7, 0x35, 0xF2, 0x1C, 0x47, 0x96, 0x4B, 0x2D, + 0xC0, 0x62, 0xF3, 0x8C, 0x2E, 0x22, 0x33, 0x85, 0x3A, 0xDE, 0xCD, 0x46, 0x58, 0x78, 0x6A, 0x93, + 0x69, 0x4A, 0x52, 0xF6, 0x92, 0xE5, 0x6B, 0x64, 0xA2, 0x9C, 0x6F, 0x65, 0x7B, 0x24, 0x7A, 0x19, + 0x5E, 0x65, 0x88, 0xA9, 0x8A, 0x9E, 0x59, 0x8D, 0x49, 0x55, 0x86, 0xEE, 0x2D, 0xF2, 0xC9, 0x74, + 0x94, 0x5B, 0x4B, 0x47, 0xD2, 0xDA, 0xAD, 0x3B, 0x26, 0x65, 0xFC, 0x40, 0x93, 0xE2, 0x8E, 0xAB, + 0x11, 0x6F, 0x0F, 0x6B, 0x89, 0x80, 0x98, 0x91, 0x75, 0x29, 0x65, 0xBA, 0x32, 0xA0, 0x4E, 0x10, + 0x96, 0x63, 0xE9, 0x80, 0x71, 0x8E, 0x78, 0xC6, 0x39, 0xF8, 0xFC, 0xA3, 0x3F, 0xC0, 0x53, 0x4A, + 0x35, 0xF0, 0xD4, 0x9B, 0x4B, 0x4B, 0x52, 0x8A, 0x49, 0xF7, 0x56, 0xB6, 0xDA, 0x5A, 0xF7, 0xB7, + 0x66, 0xB6, 0xD7, 0x39, 0xC3, 0x67, 0x75, 0xA2, 0x9E, 0x5F, 0x59, 0xA8, 0xF5, 0x57, 0x49, 0xB5, + 0xD2, 0xCD, 0xA6, 0xBC, 0xAC, 0xD6, 0xDA, 0x26, 0xAC, 0xEF, 0xF9, 0x61, 0xF1, 0x71, 0x3C, 0x79, + 0x6D, 0xF1, 0x27, 0x43, 0x5D, 0x52, 0xE7, 0x4B, 0xB9, 0xD5, 0x65, 0xBC, 0xFF, 0x00, 0x40, 0x75, + 0xB3, 0xDB, 0x14, 0x52, 0x02, 0x9B, 0xD9, 0xCE, 0xE2, 0x4F, 0x51, 0xD3, 0x1C, 0x00, 0x38, 0xC5, + 0x7E, 0x89, 0x4F, 0x8A, 0x31, 0x7E, 0xC9, 0x2C, 0x36, 0x13, 0x0A, 0xE0, 0xD7, 0x5C, 0x3C, 0x1B, + 0xB2, 0xE8, 0x9F, 0x4B, 0x5A, 0xDB, 0x36, 0xDB, 0xBB, 0x67, 0x3F, 0x0D, 0x53, 0xC9, 0xD6, 0x45, + 0x98, 0xD2, 0xC5, 0x42, 0xA2, 0x94, 0x6F, 0xED, 0xAF, 0x34, 0xDC, 0xAE, 0x9D, 0xAC, 0xD2, 0x4B, + 0x6F, 0x96, 0xBB, 0x5B, 0x45, 0xFA, 0x0B, 0xF0, 0xE5, 0xBE, 0x36, 0x7D, 0x83, 0x4A, 0x6B, 0xC9, + 0x7C, 0x3E, 0x9A, 0x47, 0xD9, 0xD5, 0x0A, 0x15, 0x71, 0x72, 0x91, 0x95, 0x00, 0x2A, 0x1F, 0xBC, + 0x07, 0x04, 0xF5, 0xE9, 0xEB, 0xC5, 0x7C, 0x76, 0x67, 0xC4, 0x39, 0x6A, 0x94, 0xE9, 0xCA, 0x85, + 0x2F, 0x68, 0xF7, 0xE5, 0xA5, 0x1B, 0x37, 0xAF, 0x4D, 0xBC, 0xB4, 0x4B, 0x64, 0xD2, 0x48, 0xF3, + 0xF2, 0x6C, 0x3E, 0x7A, 0xA9, 0xD1, 0x96, 0x06, 0x52, 0x58, 0x7B, 0xAE, 0x5E, 0x77, 0x1E, 0x65, + 0x0B, 0x69, 0x65, 0x15, 0x75, 0xA5, 0x92, 0xBE, 0xAB, 0xAD, 0xAD, 0xA7, 0xD8, 0x3A, 0x17, 0xED, + 0x2B, 0xFB, 0x5D, 0x7C, 0x18, 0xB4, 0x69, 0x3E, 0x01, 0x7C, 0x5C, 0xF1, 0xA7, 0x84, 0x27, 0x96, + 0xDD, 0x2D, 0xAE, 0x74, 0xEB, 0x4F, 0x17, 0x5E, 0xC3, 0xA3, 0x5C, 0x44, 0x8F, 0xB9, 0x21, 0x96, + 0xC1, 0x9D, 0xAD, 0x64, 0x8C, 0x30, 0x07, 0xCB, 0x78, 0xD9, 0x4F, 0x39, 0x1E, 0xBF, 0x39, 0x83, + 0xCD, 0x70, 0xD5, 0xD3, 0xA3, 0x98, 0x46, 0x2A, 0x29, 0xDE, 0x36, 0xA7, 0x15, 0x67, 0x6B, 0x5F, + 0x4D, 0x16, 0x9A, 0x2D, 0xD2, 0xD2, 0xC9, 0x23, 0xE8, 0xF3, 0x05, 0x9C, 0xD2, 0xA5, 0x0F, 0xEC, + 0xD8, 0xC6, 0xFF, 0x00, 0x6B, 0x6B, 0xDB, 0x7D, 0x16, 0x8B, 0xE4, 0xDA, 0x56, 0x56, 0xF4, 0xF1, + 0xCD, 0x6F, 0xFE, 0x0A, 0xA5, 0xF1, 0xA7, 0x57, 0xF1, 0xD5, 0x8F, 0x84, 0x3F, 0x6A, 0x9F, 0xD9, + 0xB7, 0xE0, 0x07, 0xC7, 0xE9, 0xF5, 0x19, 0xCC, 0x96, 0xDE, 0x28, 0xD0, 0x74, 0x88, 0xFE, 0x0A, + 0xFC, 0x50, 0x56, 0x00, 0xF9, 0xF2, 0xC9, 0xAA, 0x69, 0x50, 0x0D, 0x3E, 0x79, 0x40, 0x65, 0x20, + 0x5D, 0x69, 0xB7, 0x28, 0x71, 0xF3, 0xAC, 0x9B, 0x88, 0xAF, 0x66, 0x86, 0x16, 0xBE, 0x1F, 0x11, + 0x4F, 0x17, 0x94, 0x4A, 0x9C, 0x57, 0x2D, 0x92, 0x94, 0x23, 0x38, 0xA5, 0xA2, 0xD3, 0x9B, 0x5E, + 0x9A, 0xEB, 0xE9, 0x64, 0x74, 0x60, 0x33, 0x8C, 0x0D, 0x4C, 0x87, 0x13, 0x3C, 0xCE, 0x73, 0xE6, + 0xA4, 0xD2, 0xAA, 0xB9, 0x62, 0xB5, 0x7F, 0x0F, 0x2C, 0x63, 0x78, 0xBD, 0xD5, 0xAD, 0xEA, 0xD6, + 0x89, 0x9F, 0x7E, 0xF8, 0x56, 0xDF, 0xF6, 0x7C, 0xF8, 0xBF, 0xA6, 0x2C, 0xDE, 0x15, 0xF1, 0x9E, + 0x85, 0xF0, 0x8B, 0xC4, 0x66, 0xD9, 0x4C, 0x5E, 0x00, 0xFD, 0xA9, 0xBC, 0x1B, 0x6F, 0xA0, 0xDB, + 0x6A, 0xD2, 0xB1, 0x3B, 0x57, 0x4F, 0xF8, 0x81, 0xE1, 0x59, 0x06, 0x9F, 0x18, 0x20, 0xC6, 0x14, + 0x5E, 0xE9, 0xF6, 0x89, 0x90, 0x0B, 0x48, 0xA3, 0x81, 0xE3, 0x63, 0x33, 0x7A, 0xB7, 0x54, 0xEA, + 0x53, 0xA0, 0xE7, 0x1D, 0x9C, 0x69, 0x41, 0x2E, 0xF6, 0x97, 0xB9, 0x1B, 0xEA, 0xB5, 0xEE, 0x9D, + 0x92, 0xB2, 0x3A, 0x30, 0x56, 0x9C, 0x17, 0xB3, 0x53, 0x54, 0xD7, 0x49, 0xAE, 0x56, 0xF6, 0x57, + 0xBC, 0x25, 0xAE, 0xDA, 0xAB, 0x2D, 0x5B, 0x69, 0x59, 0xD9, 0x7C, 0xFB, 0xFB, 0x4E, 0x68, 0x7A, + 0xA7, 0xEC, 0xBF, 0x63, 0x6D, 0xAC, 0x7C, 0x5D, 0xF8, 0x41, 0xF1, 0x37, 0xC2, 0x1E, 0x1C, 0xD4, + 0x64, 0x58, 0x74, 0xAF, 0x89, 0xBE, 0x0B, 0x9A, 0xCB, 0xE2, 0x37, 0xC1, 0xDD, 0x71, 0x5C, 0xAE, + 0xC9, 0xB4, 0xED, 0x69, 0x59, 0x2D, 0x2E, 0x21, 0x6F, 0x31, 0x36, 0x18, 0xAF, 0xA4, 0x63, 0x90, + 0x0E, 0x0F, 0x03, 0x2C, 0x16, 0x22, 0xBD, 0x7A, 0x73, 0xAB, 0xEE, 0x28, 0xA7, 0x1B, 0x25, 0x4E, + 0x9E, 0xAB, 0xFB, 0xA9, 0xC1, 0xAD, 0x3A, 0xED, 0x6D, 0xD2, 0x77, 0x3A, 0xA5, 0x26, 0xF1, 0xB4, + 0x72, 0xDA, 0x74, 0xE5, 0x17, 0x3B, 0xDA, 0x4E, 0xDC, 0x89, 0xA4, 0x9D, 0x9B, 0x7C, 0xB6, 0xD2, + 0xFA, 0x2B, 0xFE, 0x16, 0x7E, 0x11, 0xE0, 0xEF, 0x15, 0x69, 0xFF, 0x00, 0x16, 0x74, 0xC1, 0x71, + 0xF0, 0x67, 0xC5, 0x3E, 0x08, 0xF1, 0xEE, 0xA9, 0x24, 0x24, 0xC7, 0xA0, 0xEA, 0xFA, 0xC1, 0xF8, + 0x6B, 0xAC, 0xE1, 0x63, 0x2C, 0x55, 0xA2, 0xD4, 0x15, 0x2D, 0xCB, 0x02, 0xAA, 0x30, 0x97, 0x2F, + 0x93, 0xC0, 0x39, 0x27, 0x1E, 0xBD, 0x3C, 0x16, 0x63, 0x3A, 0x53, 0xC4, 0x4E, 0xAC, 0x23, 0x46, + 0x9D, 0xB5, 0xF6, 0x54, 0x93, 0xBC, 0xBA, 0x2D, 0x35, 0xDF, 0x65, 0xB2, 0xE9, 0xA1, 0xE7, 0x63, + 0x2B, 0x57, 0xC3, 0xD7, 0x78, 0x0A, 0x12, 0x84, 0xAB, 0xDD, 0x5A, 0x2E, 0x4E, 0x1A, 0x59, 0x7B, + 0xD6, 0xB4, 0xB4, 0xD5, 0x25, 0xAD, 0xAF, 0xA3, 0x6B, 0x46, 0xFC, 0xD7, 0xC5, 0x7E, 0x28, 0xFD, + 0xA0, 0xBC, 0x11, 0x24, 0x8D, 0xE2, 0x4F, 0x81, 0x1A, 0x9D, 0xA4, 0x11, 0x6E, 0x22, 0x2F, 0xB5, + 0x29, 0x79, 0x95, 0x0E, 0x09, 0x89, 0xC8, 0xF2, 0xA4, 0xED, 0x82, 0x8C, 0x41, 0x03, 0x8E, 0xBC, + 0xC5, 0x0A, 0xB8, 0x7E, 0x65, 0x4E, 0x96, 0x2D, 0x45, 0xE9, 0x6F, 0x72, 0x92, 0xFB, 0x97, 0x22, + 0x49, 0x2F, 0x5D, 0x2D, 0xDD, 0x58, 0xF2, 0xEA, 0xE3, 0x33, 0x7A, 0x3E, 0xEE, 0x2A, 0x8F, 0x2C, + 0x56, 0xEF, 0x96, 0x72, 0x8E, 0x9D, 0x9C, 0x39, 0x9D, 0xB4, 0xD1, 0xF2, 0xDB, 0xAA, 0xD0, 0xA5, + 0xE0, 0x6F, 0xDA, 0x0B, 0xC3, 0x1E, 0x31, 0xD5, 0x5B, 0xC3, 0xB7, 0x56, 0xB7, 0xDE, 0x16, 0xF1, + 0x2C, 0x20, 0xA4, 0x9A, 0x26, 0xB5, 0x0A, 0xC1, 0x37, 0xA6, 0x63, 0x70, 0x30, 0xC0, 0x90, 0x00, + 0x20, 0x9F, 0xC3, 0xB7, 0x26, 0x32, 0x96, 0x6F, 0x4E, 0x9B, 0xAB, 0x4A, 0xA4, 0x67, 0x04, 0xB6, + 0xF6, 0x74, 0xE3, 0x24, 0xAD, 0xBF, 0x2F, 0x2E, 0xD6, 0xDD, 0xAF, 0x91, 0xD5, 0x87, 0xCC, 0xE8, + 0xF2, 0x42, 0x58, 0x88, 0xA5, 0x4E, 0x4E, 0xD1, 0x9C, 0x65, 0xCD, 0x4D, 0xCB, 0xF9, 0x79, 0xAD, + 0x17, 0x19, 0x59, 0x7C, 0x32, 0x8C, 0x5F, 0x44, 0x99, 0xED, 0x57, 0xF7, 0xEF, 0x63, 0x63, 0x71, + 0x78, 0xCA, 0x64, 0x5B, 0x68, 0x5A, 0x57, 0x8E, 0x14, 0x0C, 0x5C, 0x2A, 0xE4, 0x2A, 0x8C, 0x63, + 0x3D, 0x3F, 0xFD, 0x5C, 0x1F, 0x0B, 0x0B, 0x8E, 0xCC, 0x1D, 0x48, 0xE1, 0xE1, 0x51, 0x2B, 0xE9, + 0x7E, 0x48, 0x7A, 0x6F, 0xCB, 0x7F, 0xEA, 0xFB, 0x9D, 0xD8, 0x8A, 0xB0, 0xA3, 0x46, 0x55, 0x79, + 0x6F, 0x18, 0xAB, 0xE9, 0xE5, 0xFF, 0x00, 0x0D, 0xB6, 0xDE, 0x5D, 0x0F, 0x28, 0xF0, 0x77, 0xC6, + 0x4D, 0x07, 0xC6, 0xDA, 0xA5, 0xCF, 0x87, 0x74, 0xFD, 0x33, 0x5C, 0xB2, 0xBE, 0xB1, 0x2F, 0x2D, + 0xC3, 0xEA, 0x36, 0x8B, 0x05, 0xBB, 0x81, 0xC2, 0x18, 0xDB, 0xA9, 0xC8, 0x52, 0x70, 0x3D, 0xBD, + 0x6B, 0xEC, 0xB3, 0xCC, 0xA7, 0x13, 0x82, 0xE1, 0x6C, 0x2F, 0xB4, 0xAB, 0x16, 0xE7, 0x39, 0x4A, + 0x49, 0x45, 0xAD, 0xAC, 0xA2, 0xF6, 0x49, 0x2B, 0x5E, 0xD6, 0xD1, 0xF4, 0xDB, 0x5F, 0x13, 0x0B, + 0x98, 0x2C, 0x46, 0x26, 0x8C, 0x65, 0x49, 0xC7, 0xDA, 0x43, 0x9E, 0x0E, 0xF1, 0x77, 0x8A, 0x4B, + 0xA2, 0x77, 0x5B, 0xE9, 0x75, 0x6D, 0x1A, 0x57, 0x4A, 0xC7, 0xA0, 0xDD, 0xC8, 0xAA, 0x9B, 0xCB, + 0x60, 0x2A, 0x07, 0x24, 0x01, 0xB5, 0x54, 0x73, 0xEC, 0x0A, 0x80, 0xAB, 0xEA, 0x0E, 0x3A, 0xF1, + 0x5F, 0x0F, 0x42, 0x17, 0xB2, 0xB7, 0x92, 0x4B, 0xEE, 0xFE, 0xAD, 0xB3, 0xED, 0x63, 0xD7, 0xA9, + 0xCA, 0xA2, 0x97, 0x4F, 0x2F, 0x2D, 0xFF, 0x00, 0xE0, 0x79, 0x76, 0x3E, 0x3C, 0x13, 0x49, 0xF1, + 0x4B, 0xE3, 0x54, 0x8D, 0x1B, 0x93, 0xE1, 0xBF, 0x00, 0xAB, 0x44, 0x76, 0x30, 0x68, 0x6E, 0x2E, + 0xCA, 0x8D, 0xA0, 0x91, 0xC7, 0xCA, 0x88, 0x09, 0xE7, 0xF8, 0x87, 0xA5, 0x7D, 0x8A, 0x8C, 0x72, + 0xFC, 0xBA, 0x11, 0x4B, 0xDF, 0x6B, 0xB7, 0x59, 0x7D, 0xDB, 0x45, 0xDB, 0x6D, 0x1B, 0xE9, 0xA5, + 0xFE, 0x46, 0x71, 0x78, 0xFA, 0xB1, 0x8C, 0x96, 0xB5, 0xA5, 0xA7, 0xF7, 0x68, 0x52, 0x6F, 0x55, + 0xFF, 0x00, 0x5F, 0x67, 0xA2, 0x6B, 0xEC, 0xAD, 0x36, 0x47, 0xAA, 0xFC, 0x52, 0xF1, 0x34, 0xBE, + 0x17, 0xF0, 0x7E, 0xA3, 0x7B, 0x65, 0x1B, 0x1B, 0xB9, 0xD6, 0x3D, 0x2F, 0x4D, 0x48, 0xF6, 0xA6, + 0x6E, 0x2E, 0x58, 0x45, 0x6C, 0x85, 0xF8, 0x58, 0xF2, 0x4A, 0x60, 0xB6, 0xD1, 0xCA, 0xE4, 0x90, + 0x33, 0x5E, 0x7E, 0x02, 0x8C, 0x25, 0x55, 0xD4, 0xAA, 0xBD, 0xC8, 0x6A, 0xF4, 0x6D, 0x68, 0xB4, + 0x56, 0x5B, 0xEA, 0xD2, 0xB7, 0xDC, 0xBA, 0x1E, 0xAE, 0x22, 0x9D, 0x4C, 0x44, 0xA1, 0x81, 0xC2, + 0xE9, 0x2A, 0x8D, 0x46, 0xFA, 0x7B, 0xB1, 0x4A, 0xF3, 0x97, 0x64, 0xA3, 0x04, 0xDA, 0x7A, 0x6B, + 0x6B, 0x3D, 0x8F, 0x42, 0xF8, 0x7D, 0xA7, 0xDC, 0xFC, 0x3C, 0xB6, 0xF0, 0xC6, 0x8B, 0xE2, 0x1D, + 0x63, 0xC2, 0xFF, 0x00, 0x0D, 0xFC, 0x73, 0xE1, 0xAB, 0x0B, 0x2B, 0x5B, 0xB5, 0x93, 0x5B, 0x3A, + 0x66, 0xAF, 0xE2, 0x5B, 0xCB, 0x95, 0x70, 0xB7, 0xB6, 0xEB, 0xF6, 0x97, 0x32, 0x12, 0xA6, 0x5F, + 0x32, 0x58, 0x18, 0xC4, 0xA4, 0xAA, 0x9C, 0x16, 0xAF, 0xA7, 0x84, 0xA1, 0x84, 0xA1, 0x41, 0xCE, + 0x0D, 0xB9, 0x47, 0x9E, 0x52, 0xBC, 0x9B, 0x92, 0x95, 0xD4, 0x53, 0xD5, 0x72, 0x38, 0x2B, 0xF2, + 0xE9, 0x1B, 0xAD, 0x1D, 0xD7, 0x29, 0xCE, 0xA8, 0x29, 0xD6, 0xAB, 0x52, 0x34, 0x63, 0x42, 0x95, + 0x39, 0x46, 0x2E, 0xD6, 0xE5, 0x82, 0xBD, 0xA0, 0xDC, 0x95, 0xD3, 0x73, 0x56, 0xBD, 0x9D, 0x9C, + 0x95, 0xB4, 0x6A, 0xEA, 0x9E, 0xAB, 0x7B, 0xA4, 0xE8, 0xCD, 0xE2, 0x7F, 0x11, 0xB7, 0x8E, 0xF4, + 0x7D, 0x27, 0x4A, 0xF0, 0xA5, 0xAB, 0x9B, 0x2D, 0x7B, 0xC4, 0x26, 0x3D, 0x37, 0xFB, 0x69, 0x59, + 0xC4, 0x69, 0x04, 0x11, 0x48, 0x5C, 0x09, 0x1D, 0x1D, 0x98, 0x29, 0xCE, 0x02, 0xF5, 0xCE, 0x2B, + 0xC4, 0x84, 0x63, 0x4A, 0x33, 0x9C, 0xA7, 0x15, 0x18, 0xAB, 0xAB, 0xD9, 0x2E, 0x8B, 0x77, 0x64, + 0x97, 0xE2, 0xB7, 0xB7, 0x6B, 0x85, 0x1F, 0x69, 0x7A, 0x74, 0x97, 0x32, 0xD6, 0xD1, 0x49, 0xBE, + 0x66, 0x95, 0xED, 0x14, 0xAE, 0xDB, 0x56, 0x69, 0x24, 0xAE, 0xD6, 0xB6, 0xB2, 0x39, 0x3B, 0x8F, + 0x08, 0xCB, 0x27, 0x85, 0x6D, 0x2D, 0x6C, 0xF4, 0xBD, 0x3A, 0x7D, 0x27, 0xE2, 0xF4, 0x09, 0x63, + 0x6F, 0x69, 0x67, 0x0A, 0x2B, 0xF8, 0xC2, 0xDE, 0x1B, 0xB5, 0xF2, 0xE1, 0x66, 0x42, 0x37, 0xA0, + 0xB8, 0x50, 0x54, 0x1C, 0x7C, 0xE1, 0x4F, 0xB8, 0x5F, 0x56, 0xA7, 0x37, 0x15, 0x51, 0x46, 0x49, + 0xAD, 0x53, 0x49, 0xDB, 0xA2, 0x5A, 0xA7, 0x6E, 0x96, 0x4B, 0x4B, 0x6C, 0xAC, 0xAC, 0x79, 0xB4, + 0xEB, 0x63, 0x30, 0x54, 0x14, 0x30, 0x32, 0x74, 0xE3, 0x59, 0xA5, 0x05, 0x1B, 0xC5, 0xC9, 0xA7, + 0xA5, 0xB6, 0xB5, 0x9D, 0x93, 0xBD, 0x9A, 0xD9, 0x5B, 0x44, 0x79, 0xC6, 0xBB, 0xF0, 0x8B, 0xFE, + 0x13, 0xAD, 0x63, 0x41, 0xF8, 0x74, 0xDA, 0x25, 0x96, 0xA1, 0x6F, 0xF0, 0x7B, 0x46, 0x9E, 0xEB, + 0xFE, 0x11, 0xCD, 0x2F, 0x5A, 0xB8, 0xB4, 0xD3, 0x56, 0xDA, 0xD0, 0x99, 0x6E, 0x96, 0xF4, 0xC7, + 0x28, 0xDD, 0x22, 0x15, 0x74, 0xCA, 0xEC, 0x6C, 0x29, 0x50, 0x78, 0x38, 0x2A, 0xE4, 0x39, 0x3D, + 0x7E, 0x4C, 0x4D, 0x45, 0xFB, 0xCD, 0x1C, 0x5A, 0x69, 0x5A, 0xDD, 0x95, 0xEC, 0xE3, 0x7D, 0x1D, + 0xD5, 0x9F, 0x55, 0xB1, 0x74, 0x38, 0xAB, 0x8C, 0x30, 0xD9, 0x85, 0x4C, 0x24, 0x54, 0x27, 0x4E, + 0x8C, 0x5F, 0x3B, 0x9A, 0xB5, 0xD2, 0x49, 0xD9, 0xCE, 0xCA, 0xD2, 0xB3, 0x49, 0x25, 0x6B, 0xEF, + 0xAE, 0xEF, 0xC9, 0xB5, 0x9F, 0x0A, 0xFC, 0x42, 0xB0, 0xD5, 0x7C, 0x6F, 0xF1, 0x99, 0xE0, 0xD3, + 0x3C, 0x5D, 0x75, 0xF1, 0x1F, 0x4A, 0xBD, 0xF0, 0x6E, 0x9B, 0x73, 0xAB, 0xAC, 0x76, 0x33, 0x69, + 0xB3, 0xB5, 0xBC, 0x69, 0x1B, 0xDA, 0x28, 0x8D, 0xD2, 0x57, 0x82, 0x28, 0x21, 0x50, 0x0A, 0xAE, + 0x40, 0x19, 0x6C, 0x9E, 0x79, 0x6A, 0x70, 0xF6, 0x33, 0x0B, 0x5A, 0xA6, 0x23, 0x2A, 0xAF, 0xFE, + 0xD0, 0xEE, 0xDD, 0xFD, 0xD5, 0xCA, 0x92, 0xD1, 0xA8, 0xD9, 0x28, 0xAD, 0x2F, 0xEE, 0x5D, 0xB4, + 0x93, 0x7D, 0xBD, 0xEC, 0xAB, 0x8D, 0xF0, 0x38, 0xAC, 0xA2, 0x11, 0xCD, 0xB0, 0x93, 0xA5, 0x85, + 0x94, 0x9C, 0x53, 0x8C, 0xE5, 0x3B, 0xBD, 0x53, 0x8B, 0x72, 0xF7, 0xF5, 0xBE, 0x8D, 0x4B, 0x44, + 0x9A, 0x8A, 0x4A, 0xC9, 0x78, 0x5C, 0xFE, 0x19, 0xF8, 0xA3, 0x69, 0xA7, 0x78, 0x67, 0xE0, 0x35, + 0xBF, 0x81, 0xB5, 0x81, 0xE2, 0x5F, 0x17, 0x5C, 0x2F, 0x8D, 0x35, 0x4D, 0x36, 0xC8, 0x5B, 0xBE, + 0xAB, 0xE2, 0x58, 0x62, 0x59, 0x25, 0xB6, 0x10, 0x6F, 0xB7, 0x57, 0xB6, 0x68, 0xA1, 0x8A, 0x71, + 0xF2, 0x4A, 0xCA, 0x40, 0x19, 0x5E, 0x30, 0x3F, 0x3F, 0xC5, 0x61, 0xF3, 0x08, 0xD1, 0x8E, 0x4B, + 0x2C, 0x3F, 0xBC, 0xE4, 0xE5, 0x29, 0xE9, 0x15, 0x2D, 0x79, 0x9A, 0x5A, 0x28, 0xB6, 0xB4, 0xF8, + 0xAF, 0xA5, 0x92, 0xE5, 0x56, 0x47, 0xEA, 0x58, 0x79, 0x65, 0xF5, 0xA9, 0xFD, 0x6D, 0x4E, 0xF0, + 0xE5, 0x8C, 0x63, 0x75, 0x29, 0x38, 0xA8, 0xAB, 0x45, 0x72, 0xB6, 0xAD, 0x16, 0x9E, 0xAA, 0xD7, + 0xBA, 0xBB, 0xEE, 0x5B, 0xBD, 0xF8, 0x8D, 0x1F, 0x88, 0x7C, 0x65, 0xA6, 0x78, 0xF2, 0xDB, 0xE1, + 0xE5, 0xFD, 0xAF, 0x81, 0x3E, 0x14, 0xE8, 0x16, 0xDA, 0x5D, 0x9F, 0x86, 0xEC, 0x6F, 0xE1, 0xB2, + 0xD3, 0x6C, 0x2F, 0xAD, 0xBF, 0xD4, 0xDE, 0x31, 0x8E, 0xDD, 0x60, 0x32, 0xB4, 0xCB, 0x0C, 0x92, + 0x20, 0x4C, 0xBF, 0x97, 0x96, 0x24, 0x70, 0x7A, 0x9E, 0x23, 0x1F, 0x8C, 0xAD, 0x0C, 0x74, 0x68, + 0xFE, 0xE6, 0x94, 0x22, 0xDA, 0x82, 0x49, 0x25, 0x1D, 0x39, 0xA4, 0xF5, 0x4A, 0x49, 0xD9, 0x35, + 0x25, 0xB5, 0xE2, 0x9D, 0x9A, 0x4F, 0x47, 0x46, 0x34, 0xA8, 0xAC, 0x35, 0x1A, 0xAE, 0x2A, 0x57, + 0x4D, 0xB4, 0xEE, 0xEF, 0xBA, 0x49, 0xBB, 0x2B, 0xDD, 0x59, 0x27, 0xA2, 0xB3, 0x49, 0x3B, 0x35, + 0x4B, 0xC2, 0x7E, 0x31, 0xD5, 0xE2, 0x9F, 0x5D, 0xD7, 0xBC, 0x4A, 0x35, 0x0D, 0x27, 0xC4, 0x1F, + 0x12, 0x84, 0xD7, 0xB3, 0xF8, 0xC9, 0x8C, 0x36, 0x4B, 0x63, 0xA2, 0xC7, 0x39, 0x3A, 0x9C, 0x5A, + 0x4B, 0xB3, 0xAB, 0xAC, 0x8E, 0x0C, 0xD1, 0x08, 0x49, 0xD8, 0xC3, 0xCB, 0x4C, 0x00, 0x2B, 0xD8, + 0xC9, 0xA7, 0x9D, 0x51, 0xC5, 0xBA, 0xD2, 0xC3, 0xB9, 0x2A, 0xB0, 0x9B, 0x73, 0x8C, 0x1B, 0x8A, + 0xA4, 0xE2, 0xF9, 0x9A, 0x49, 0x45, 0xF2, 0xD9, 0xE9, 0xAD, 0xDB, 0x5B, 0xE8, 0x8E, 0x2A, 0xD0, + 0xC3, 0xBA, 0x6E, 0x9D, 0x29, 0x24, 0xA3, 0x68, 0xA4, 0xEF, 0x6E, 0x77, 0xA2, 0xBB, 0xD6, 0xE9, + 0x75, 0xE5, 0x4D, 0xDD, 0x5B, 0xAB, 0x3C, 0x3F, 0xC7, 0xBE, 0x2F, 0xB8, 0xF1, 0x9F, 0x89, 0x6E, + 0xF5, 0x89, 0x12, 0xDA, 0x2B, 0x58, 0xD5, 0x2C, 0x34, 0xBB, 0x5B, 0x4B, 0x31, 0xA7, 0xD9, 0xC1, + 0x6B, 0x6E, 0xA1, 0x20, 0x09, 0x6C, 0x19, 0x92, 0x32, 0x51, 0x14, 0xB2, 0xA9, 0xC6, 0xE2, 0xD8, + 0xAF, 0x8B, 0xCE, 0xF3, 0x17, 0x99, 0xE2, 0xE5, 0x38, 0xCA, 0x5E, 0xCD, 0x7B, 0xB0, 0xBE, 0x96, + 0x8A, 0x56, 0x56, 0x4A, 0xCA, 0x37, 0x49, 0x68, 0x97, 0x45, 0x76, 0xDD, 0xDB, 0xF5, 0x70, 0xF8, + 0x68, 0x50, 0xA2, 0xA9, 0x45, 0x5B, 0xD3, 0x43, 0x8B, 0xFC, 0x00, 0xF6, 0x03, 0x00, 0x7B, 0x01, + 0x5E, 0x42, 0x56, 0x49, 0x1D, 0x29, 0x59, 0x24, 0x14, 0xC6, 0x00, 0x74, 0x00, 0x7D, 0x00, 0x1E, + 0x83, 0xB0, 0xFC, 0x29, 0xC2, 0x12, 0x93, 0x50, 0x82, 0xBB, 0xE8, 0x92, 0xFD, 0x10, 0xB4, 0x4B, + 0xC8, 0xDD, 0xD2, 0xEC, 0x0C, 0x87, 0x24, 0x7A, 0x0C, 0x0E, 0x14, 0x63, 0xA6, 0x2B, 0xFA, 0x4F, + 0xC1, 0xFF, 0x00, 0x0E, 0x6B, 0x66, 0xB5, 0xBD, 0xA5, 0x68, 0xB6, 0xDD, 0xAE, 0xAE, 0xD4, 0x55, + 0xAF, 0xA6, 0xC9, 0x6D, 0xA2, 0x6E, 0xF6, 0x77, 0xE5, 0xF2, 0xF1, 0x71, 0xF8, 0xB8, 0xC1, 0x24, + 0xAD, 0x6F, 0xF8, 0x63, 0xB0, 0x8E, 0x08, 0xD2, 0x2F, 0x2F, 0x23, 0x38, 0x00, 0x71, 0xC7, 0x03, + 0xA1, 0xF6, 0xE2, 0xBF, 0xB7, 0xF2, 0xFE, 0x1F, 0xCB, 0xB0, 0xD9, 0x5C, 0xB2, 0xF7, 0x35, 0xED, + 0x1A, 0xB2, 0x6D, 0x6F, 0x65, 0x6E, 0x56, 0xF4, 0xBC, 0x7C, 0xB5, 0x4B, 0x56, 0x7C, 0xE4, 0xAA, + 0xC9, 0xC9, 0x49, 0x2D, 0x08, 0x2C, 0xD3, 0xC9, 0x9D, 0xB4, 0xE6, 0x11, 0xA0, 0x94, 0x09, 0x6D, + 0xA7, 0x6C, 0x84, 0x8C, 0x00, 0x77, 0x20, 0x03, 0xB7, 0x03, 0x8C, 0x1E, 0xD5, 0xF1, 0xDC, 0x33, + 0x4E, 0xB7, 0x0E, 0x67, 0xF5, 0x78, 0x0B, 0x13, 0x0F, 0x72, 0xB2, 0xF6, 0xB8, 0x5A, 0x89, 0x2E, + 0x48, 0xB9, 0x5D, 0xD5, 0x82, 0x5D, 0x54, 0x2C, 0x9A, 0x8D, 0xED, 0x18, 0xB4, 0x96, 0xD6, 0x5D, + 0x52, 0x51, 0xAF, 0x49, 0x57, 0x8B, 0x49, 0xAD, 0x1D, 0xEF, 0xD1, 0x69, 0xB6, 0xD7, 0xDB, 0x6F, + 0xB8, 0x9C, 0xA0, 0x2B, 0xB9, 0x31, 0x8C, 0x80, 0x06, 0x31, 0xD0, 0x73, 0x8F, 0xCA, 0xBE, 0xD7, + 0x13, 0x83, 0xA3, 0x5A, 0x93, 0xC4, 0x61, 0xE4, 0x9D, 0x3E, 0x6E, 0x54, 0xAD, 0x6D, 0x63, 0xA3, + 0x6B, 0x6D, 0x1B, 0x5D, 0x34, 0xD3, 0xA6, 0xC7, 0x1C, 0x5F, 0x2D, 0x95, 0xB5, 0xFE, 0xBF, 0x22, + 0x3F, 0x24, 0x71, 0xC0, 0xF4, 0xF6, 0xE9, 0xC6, 0x05, 0x79, 0x7F, 0xD9, 0x70, 0xB2, 0xD3, 0xF1, + 0xFF, 0x00, 0x81, 0xF2, 0xF2, 0xB7, 0x62, 0xF9, 0xDA, 0xB2, 0x4B, 0x41, 0x86, 0x3C, 0x01, 0x80, + 0x06, 0x06, 0x00, 0xC0, 0x18, 0xC0, 0xE9, 0x8F, 0xCA, 0xB8, 0xEA, 0xE0, 0x65, 0x0B, 0x28, 0x2D, + 0x15, 0xF4, 0xF4, 0xB7, 0xA5, 0xFC, 0x8A, 0x52, 0x56, 0x5F, 0x22, 0x2C, 0x6D, 0x39, 0x18, 0xF9, + 0x70, 0x06, 0x06, 0x17, 0x18, 0xE0, 0x63, 0xF0, 0xAF, 0x3B, 0xD9, 0x2A, 0x75, 0xD5, 0x5B, 0x5A, + 0x6B, 0x4F, 0x2F, 0xBB, 0x6F, 0xC0, 0xB5, 0xF0, 0xD9, 0x6C, 0x61, 0xEA, 0xD6, 0x21, 0xE3, 0xFB, + 0x4C, 0x4A, 0x14, 0xA6, 0x44, 0x98, 0x1C, 0x1C, 0xFD, 0xD0, 0x07, 0xE0, 0x6B, 0xF9, 0xD7, 0xC6, + 0xBF, 0x0E, 0xA9, 0x63, 0x70, 0x0F, 0x8A, 0xF2, 0xC8, 0x28, 0xCE, 0x95, 0xFD, 0xAB, 0x57, 0x7C, + 0xD7, 0x4B, 0x95, 0x24, 0xB4, 0x56, 0xB3, 0xD9, 0x75, 0xDA, 0xD7, 0x67, 0xAD, 0x96, 0x62, 0xF9, + 0x24, 0xA8, 0x4D, 0xE8, 0xF6, 0x2E, 0xFC, 0x3B, 0xF0, 0xC1, 0xF1, 0x97, 0x8E, 0x7C, 0x29, 0xE1, + 0x50, 0x06, 0xDD, 0x6F, 0x5B, 0xB7, 0xB0, 0x94, 0x64, 0xA7, 0xEE, 0xD9, 0xC7, 0x98, 0x01, 0x03, + 0x23, 0xE4, 0x56, 0xE9, 0x5F, 0xC9, 0x78, 0x7A, 0x57, 0xC4, 0x42, 0x94, 0xD5, 0xAC, 0xF5, 0x56, + 0xED, 0xAD, 0xAC, 0xFD, 0x2D, 0xB7, 0xCB, 0xA1, 0xED, 0xD7, 0xA9, 0xEC, 0xE8, 0x4A, 0x71, 0xED, + 0xA7, 0xF5, 0xA7, 0xF5, 0xB7, 0x63, 0xFA, 0xEE, 0xFD, 0x99, 0x7E, 0x1E, 0x69, 0x9A, 0x4E, 0x97, + 0x60, 0xB0, 0x58, 0x43, 0x0D, 0x86, 0x89, 0x6D, 0x1D, 0xA5, 0x8C, 0x6B, 0x19, 0x48, 0xD4, 0xC6, + 0x00, 0xCA, 0x01, 0xC7, 0x00, 0x28, 0xED, 0x8E, 0x0F, 0xB8, 0xFD, 0xB3, 0x0F, 0x4E, 0x39, 0x6E, + 0x4F, 0x4E, 0x8C, 0x1D, 0xAA, 0x4D, 0x5E, 0x4D, 0x79, 0xEB, 0x67, 0xE4, 0x9D, 0xF6, 0x56, 0x76, + 0xB7, 0x4B, 0x3F, 0xCC, 0x1B, 0x58, 0xFC, 0xCE, 0x53, 0x97, 0xC3, 0x0D, 0x12, 0xFB, 0xBB, 0x3B, + 0x6B, 0x6D, 0xD2, 0x7E, 0xA9, 0x68, 0x7D, 0x11, 0xE3, 0xEF, 0x1E, 0xDB, 0xF8, 0x50, 0x58, 0x68, + 0xD6, 0x0A, 0xB7, 0x1A, 0xF6, 0xB1, 0x28, 0xB4, 0xD3, 0x6D, 0x23, 0x0A, 0xEC, 0xB9, 0x1C, 0xB1, + 0x40, 0x0F, 0xCA, 0x02, 0xFE, 0x87, 0xD3, 0x15, 0xBE, 0x55, 0x95, 0x3C, 0x72, 0x96, 0x26, 0xAB, + 0xE5, 0xA3, 0x0D, 0x64, 0xFE, 0x5B, 0x6E, 0xBF, 0x44, 0xB4, 0xEE, 0x83, 0x32, 0xCC, 0xE1, 0x81, + 0x8C, 0x68, 0x52, 0x57, 0xA8, 0xF4, 0x49, 0x5B, 0xA5, 0x93, 0xD3, 0xA2, 0xB5, 0x97, 0x96, 0xD6, + 0xD9, 0x2B, 0xD6, 0xFA, 0x04, 0xD6, 0xFA, 0x0C, 0xFA, 0x8E, 0xB1, 0x7B, 0x3C, 0xFA, 0x8F, 0xD9, + 0xCD, 0xD3, 0x48, 0x58, 0x46, 0xB0, 0xB1, 0x53, 0x80, 0x14, 0x11, 0xD3, 0x23, 0xE5, 0xCE, 0x38, + 0x1D, 0x33, 0xC6, 0x13, 0xC4, 0x53, 0x96, 0x21, 0x51, 0xC3, 0x41, 0x28, 0x6D, 0xD5, 0xE9, 0xA6, + 0x9F, 0xF0, 0x77, 0xE9, 0xB5, 0x91, 0x51, 0xC1, 0xCE, 0x9E, 0x0A, 0x55, 0xF1, 0x12, 0xF7, 0xD2, + 0xBE, 0xFB, 0x26, 0xBF, 0xE0, 0x5A, 0xEB, 0xB5, 0x9B, 0xB5, 0xAD, 0xE2, 0x1F, 0x00, 0x2E, 0xFC, + 0x47, 0xE2, 0x0D, 0x6F, 0xC6, 0x3A, 0xA6, 0xAF, 0xAA, 0xDD, 0xEA, 0x1A, 0x5D, 0xAE, 0xAC, 0xF6, + 0x1A, 0x5C, 0x52, 0xE0, 0x44, 0xB1, 0xC2, 0x4A, 0x83, 0xC0, 0xEF, 0x8C, 0x63, 0x07, 0x1C, 0x7D, + 0x0F, 0xD1, 0x71, 0x2C, 0x30, 0xB8, 0x5A, 0x34, 0x68, 0xD0, 0xA7, 0x18, 0xB6, 0xAF, 0x74, 0x92, + 0x7D, 0x34, 0x76, 0xE9, 0x7B, 0xDB, 0xD3, 0xA7, 0x4F, 0x1F, 0x20, 0xF6, 0xB5, 0xB1, 0x33, 0xAE, + 0xE5, 0x74, 0xAF, 0xA5, 0xD6, 0x8F, 0x75, 0x6D, 0x76, 0xE5, 0x76, 0xDA, 0xD7, 0xD3, 0x65, 0xA1, + 0xF1, 0x67, 0xC1, 0xBA, 0x6F, 0x89, 0xE4, 0xF1, 0x4E, 0x8F, 0x25, 0xAA, 0x4F, 0x1C, 0x9A, 0x2C, + 0x93, 0x4B, 0x16, 0xD0, 0x54, 0x1C, 0x6D, 0x6D, 0xC3, 0xD0, 0x80, 0x38, 0xE4, 0x64, 0x8C, 0x63, + 0x1C, 0xFC, 0xF6, 0x36, 0x9A, 0xC5, 0x64, 0x6A, 0x15, 0x52, 0xBA, 0x7E, 0xEF, 0x4D, 0x2C, 0x9E, + 0x9F, 0x7B, 0xE9, 0xD3, 0x67, 0xA5, 0xBD, 0x8C, 0x1C, 0xA5, 0x47, 0x36, 0x95, 0x28, 0x2D, 0x25, + 0xA3, 0xE9, 0xB2, 0x4D, 0x3B, 0x3D, 0x15, 0x9B, 0xDE, 0xCA, 0xC9, 0x5B, 0xD3, 0xF9, 0xB5, 0xF8, + 0x03, 0xE0, 0xB8, 0xFE, 0x1E, 0xFF, 0x00, 0xC1, 0x4C, 0xBF, 0x67, 0x0F, 0x08, 0xC0, 0x02, 0xDA, + 0xE9, 0x5F, 0xB5, 0xFF, 0x00, 0x80, 0x3E, 0xC6, 0xAB, 0xF7, 0x52, 0x19, 0xBC, 0x55, 0xA7, 0x4B, + 0x12, 0x8E, 0x07, 0x01, 0x65, 0x51, 0xF8, 0x57, 0xE4, 0x54, 0xE9, 0xFB, 0x3C, 0xEE, 0x92, 0xB7, + 0xFC, 0xBC, 0x83, 0xDA, 0xDB, 0xB4, 0xF6, 0xF5, 0x3F, 0x44, 0x8C, 0xDD, 0x4C, 0xB6, 0x52, 0x6B, + 0x5E, 0x59, 0x2F, 0xB9, 0x35, 0xFD, 0x6D, 0xE8, 0xB6, 0x3F, 0xBC, 0x2A, 0xFD, 0x1C, 0xF9, 0x60, + 0xA0, 0x02, 0x80, 0x0A, 0x00, 0xFE, 0x28, 0xFF, 0x00, 0xE0, 0xB5, 0xEB, 0x8F, 0xF8, 0x28, 0x17, + 0xC4, 0x83, 0x8F, 0x97, 0xFE, 0x10, 0xCF, 0x09, 0xA8, 0xC6, 0x38, 0xC7, 0x87, 0x6D, 0x78, 0xC7, + 0xE5, 0x5F, 0x03, 0xC4, 0x18, 0x6A, 0xBF, 0x5C, 0x9E, 0x29, 0x47, 0xF7, 0x77, 0x51, 0xBF, 0x9A, + 0x8C, 0x5D, 0xAD, 0xDA, 0xCD, 0x79, 0x1F, 0x4F, 0x95, 0xCA, 0x2B, 0x09, 0x18, 0x75, 0xD7, 0xF3, + 0xB1, 0x8F, 0xA5, 0x5A, 0x41, 0xAB, 0x78, 0x67, 0xF6, 0x69, 0xF1, 0x37, 0xC2, 0xF9, 0xD6, 0xD7, + 0xC1, 0xBE, 0x1B, 0x7B, 0x5D, 0x37, 0xC5, 0x96, 0xF6, 0x17, 0x82, 0xD9, 0xAD, 0x75, 0x23, 0x22, + 0x0B, 0xB8, 0xAE, 0xE0, 0x53, 0x9F, 0x31, 0xA4, 0x2C, 0xE5, 0x98, 0x7C, 0xCA, 0x54, 0x82, 0x41, + 0x15, 0xF5, 0xFC, 0x2B, 0x53, 0x0D, 0x3C, 0x9E, 0xB6, 0x1A, 0x9B, 0x4A, 0x76, 0x6E, 0xDD, 0xD2, + 0x8B, 0xBE, 0x9B, 0x3D, 0x57, 0x53, 0xF3, 0x9E, 0x2A, 0x6B, 0x0B, 0x99, 0xFB, 0x6C, 0x5D, 0x26, + 0xD4, 0x94, 0x14, 0x27, 0x6B, 0xA8, 0x49, 0x4E, 0x2D, 0xEB, 0xF6, 0x6F, 0x1D, 0x13, 0x4A, 0xCF, + 0x6E, 0x96, 0x3E, 0xE6, 0xFD, 0xAA, 0x7C, 0x33, 0xE2, 0x2F, 0x17, 0xFC, 0x1C, 0x16, 0xFE, 0x18, + 0x9E, 0xE2, 0x3B, 0x94, 0x10, 0x5C, 0xC8, 0xF6, 0x77, 0xBF, 0x63, 0x93, 0x62, 0x94, 0x2D, 0xB5, + 0xB3, 0x83, 0x80, 0xAC, 0x71, 0xFE, 0xCF, 0xD2, 0xBC, 0xFE, 0x19, 0xAD, 0x4F, 0x0D, 0x99, 0xCA, + 0x33, 0xB2, 0x93, 0x4D, 0x46, 0xEB, 0x44, 0xFE, 0x5A, 0xA5, 0x6D, 0x34, 0xB6, 0xFD, 0x11, 0xE8, + 0x71, 0x05, 0x39, 0xCF, 0x01, 0x4A, 0xA2, 0xA4, 0xAA, 0x42, 0x32, 0x8C, 0xA5, 0x16, 0x93, 0x52, + 0x8F, 0x2B, 0x56, 0xB6, 0x89, 0xEA, 0xD3, 0x4B, 0xCB, 0x45, 0x7B, 0x1E, 0x87, 0xE1, 0x25, 0xD5, + 0xEE, 0x7E, 0x07, 0x69, 0xC9, 0x6D, 0x24, 0xAB, 0xAC, 0x8F, 0x0B, 0x08, 0xF7, 0xC6, 0xE1, 0x66, + 0x49, 0x96, 0x1C, 0xE1, 0x58, 0x8C, 0x02, 0x08, 0x3F, 0x95, 0x72, 0xE3, 0x15, 0x1A, 0x79, 0xF4, + 0xB4, 0xF7, 0x14, 0xD7, 0xDD, 0x7F, 0xF2, 0xFF, 0x00, 0x80, 0x3C, 0xB9, 0x62, 0x67, 0xC3, 0x54, + 0xEC, 0xDF, 0xB4, 0xF6, 0x49, 0x2D, 0x93, 0x4F, 0x97, 0x6F, 0x5F, 0x5B, 0x6B, 0xBD, 0x8F, 0x42, + 0xFD, 0x8F, 0xBE, 0x26, 0xF8, 0xA7, 0xE1, 0xB7, 0x84, 0xEC, 0x75, 0x2F, 0x8B, 0xBF, 0xE9, 0x1F, + 0xBB, 0x9A, 0xD7, 0x5E, 0x8E, 0xF9, 0xD2, 0xF6, 0xE4, 0x5A, 0x86, 0x71, 0x15, 0xC1, 0x00, 0x95, + 0x32, 0x28, 0x00, 0x80, 0x08, 0x07, 0x00, 0x90, 0x70, 0x01, 0xFD, 0x17, 0x0B, 0x9A, 0xD2, 0x86, + 0x75, 0x4A, 0x96, 0x5D, 0x36, 0xA9, 0x54, 0x51, 0x53, 0x51, 0x8D, 0xA3, 0x7D, 0x2C, 0xF4, 0x5A, + 0x35, 0xD9, 0x25, 0x75, 0xB3, 0x4D, 0x9C, 0x38, 0x4C, 0x2D, 0x4A, 0xD9, 0x13, 0x79, 0xAC, 0x2F, + 0x28, 0x29, 0x38, 0xF3, 0xB4, 0xDD, 0xAE, 0xD2, 0xBB, 0xBB, 0x5A, 0x69, 0xAB, 0x77, 0xD3, 0x56, + 0x92, 0x3C, 0xAB, 0xE3, 0xDF, 0xEC, 0xD9, 0xF1, 0x2A, 0xF7, 0xC4, 0x9A, 0xA7, 0xC5, 0x7F, 0xD9, + 0xCF, 0xC7, 0x1A, 0x7F, 0x86, 0x3E, 0x15, 0xFC, 0x40, 0xBB, 0x6B, 0xFB, 0xFD, 0x1A, 0xD1, 0x7E, + 0xD1, 0xA5, 0xE9, 0x1A, 0x84, 0xC9, 0xF2, 0xC9, 0x65, 0x28, 0xC8, 0xF2, 0xA7, 0x0A, 0xAD, 0x90, + 0x51, 0xFC, 0xCD, 0xE3, 0x68, 0x00, 0x33, 0x7F, 0x50, 0xF0, 0x5F, 0x1D, 0x64, 0x59, 0x4D, 0x28, + 0x61, 0xF8, 0xA3, 0x07, 0xCC, 0xE3, 0x68, 0x45, 0xDA, 0x2F, 0x44, 0xD7, 0x2B, 0x69, 0x34, 0xF5, + 0x77, 0x4D, 0x5B, 0x91, 0x2D, 0x9B, 0xBB, 0x4F, 0xE3, 0xF0, 0xF8, 0x78, 0xE2, 0xE9, 0xCA, 0x78, + 0x1A, 0x4D, 0xC9, 0xAE, 0x67, 0xCB, 0x39, 0x53, 0x8E, 0xBB, 0x6B, 0x67, 0x79, 0x35, 0x66, 0xE7, + 0xA3, 0xBB, 0x77, 0xD1, 0x24, 0xBC, 0x8B, 0xE0, 0x8F, 0xC3, 0xAD, 0x4F, 0xE1, 0x9E, 0x83, 0xE2, + 0x1B, 0xCF, 0x18, 0xDE, 0xC7, 0xA8, 0x78, 0xA7, 0x52, 0xD4, 0x1F, 0x52, 0xD5, 0x75, 0x17, 0x76, + 0x91, 0x65, 0x48, 0x8B, 0x08, 0x83, 0x12, 0x07, 0xCA, 0xA3, 0x2D, 0x8E, 0xC4, 0x0C, 0x74, 0xAF, + 0xD3, 0xF8, 0x93, 0x33, 0xC3, 0x67, 0xD8, 0xDC, 0x3E, 0x13, 0x28, 0x87, 0x2E, 0x1E, 0x31, 0x5C, + 0xB1, 0x56, 0xB2, 0xE6, 0xE5, 0x76, 0x6A, 0xCA, 0xF7, 0x49, 0xEE, 0x9A, 0xD5, 0xAB, 0x3D, 0x9C, + 0xE1, 0x69, 0x2C, 0x2B, 0xAD, 0x88, 0x9D, 0x25, 0x49, 0x45, 0x28, 0x28, 0x5D, 0x3E, 0x54, 0x96, + 0xAF, 0x99, 0x5D, 0x36, 0xDB, 0x6D, 0xBE, 0xD6, 0x4D, 0xC6, 0xED, 0xAE, 0x4F, 0xE0, 0x55, 0x8C, + 0x9E, 0x3C, 0xF1, 0xA7, 0xC4, 0x2F, 0x8A, 0xF7, 0x7B, 0xA5, 0xB4, 0x97, 0x54, 0x3E, 0x18, 0xD0, + 0x24, 0x6F, 0x9B, 0xCB, 0xB3, 0xB4, 0x07, 0x70, 0x45, 0x39, 0xE4, 0x85, 0x04, 0xFD, 0x09, 0xC7, + 0x07, 0x1E, 0xCF, 0x16, 0x57, 0x86, 0x47, 0x95, 0x61, 0x32, 0x08, 0x46, 0xD6, 0xD6, 0x4D, 0x25, + 0x67, 0x51, 0xDE, 0x4A, 0x3A, 0x6B, 0x7B, 0x24, 0x93, 0x69, 0x27, 0xF0, 0xDE, 0xEE, 0xCF, 0x87, + 0x2F, 0xF6, 0x75, 0xB1, 0xAB, 0xDB, 0x24, 0xB9, 0x57, 0xB4, 0x92, 0x49, 0xB6, 0x9C, 0xED, 0xAE, + 0xDB, 0x42, 0x1C, 0xB1, 0xB3, 0x4D, 0xBB, 0xB5, 0xA6, 0xEB, 0x1F, 0xE3, 0xEF, 0x89, 0x6E, 0xA0, + 0xF1, 0x06, 0x8C, 0xDA, 0x13, 0x47, 0x15, 0xEE, 0x99, 0x71, 0x0A, 0x68, 0x46, 0x3B, 0x88, 0x82, + 0xDE, 0x48, 0x18, 0x19, 0x91, 0xD8, 0x31, 0xDA, 0x32, 0x02, 0x1F, 0x30, 0xA6, 0x03, 0x36, 0x41, + 0x07, 0x29, 0xF9, 0xC6, 0x0F, 0x8A, 0xB8, 0x67, 0x21, 0xC5, 0x51, 0xCA, 0xB8, 0xA7, 0x10, 0xA9, + 0x55, 0xC4, 0x35, 0x15, 0x07, 0x19, 0xBF, 0x7A, 0x4F, 0x96, 0x09, 0x72, 0xC5, 0xC6, 0x2E, 0x3E, + 0xEC, 0x96, 0x96, 0xD2, 0xD1, 0x49, 0xBD, 0x7F, 0xAB, 0x32, 0x1E, 0x1F, 0xCA, 0xEB, 0xF0, 0x6E, + 0x61, 0x0A, 0x1F, 0xC0, 0x95, 0x29, 0x4E, 0x53, 0x49, 0xF3, 0xA5, 0x05, 0xCC, 0xA5, 0x16, 0x95, + 0xDC, 0x95, 0xAF, 0x0E, 0x58, 0xB7, 0x74, 0x93, 0xD1, 0x28, 0x9F, 0xA1, 0xFF, 0x00, 0x0B, 0x7C, + 0x53, 0x63, 0xE3, 0x9F, 0x03, 0xDA, 0x5A, 0x6B, 0x32, 0x5B, 0x4F, 0x27, 0xD9, 0x7C, 0x99, 0x63, + 0x79, 0xE3, 0xB8, 0xF9, 0xED, 0xD5, 0x5A, 0x54, 0x0C, 0x09, 0x52, 0x63, 0xF9, 0x0E, 0x41, 0xE3, + 0x00, 0xF6, 0x15, 0xF9, 0x96, 0x7D, 0x96, 0x62, 0x32, 0xFC, 0xC2, 0x59, 0x8E, 0x59, 0x16, 0xE0, + 0xA5, 0x66, 0xE2, 0x9D, 0x97, 0x5B, 0x35, 0xBD, 0x9A, 0x6D, 0x3B, 0x2D, 0xEC, 0x9E, 0x8D, 0x23, + 0xE4, 0x63, 0x4D, 0xE5, 0xB8, 0x87, 0x96, 0x56, 0xA9, 0x79, 0x47, 0x58, 0x4A, 0xD6, 0x72, 0x8B, + 0xD2, 0x3A, 0x6E, 0x9A, 0x56, 0x4D, 0x4A, 0xCE, 0x4B, 0xDE, 0x4B, 0x57, 0x6F, 0xA4, 0xBE, 0x04, + 0xFC, 0x1C, 0xD7, 0xFE, 0x26, 0xF8, 0x7F, 0x5A, 0xD7, 0x35, 0xFB, 0x8D, 0x23, 0xC0, 0x1F, 0x07, + 0xBC, 0x31, 0xA8, 0x3E, 0x91, 0xAD, 0x7C, 0x60, 0xF1, 0xEC, 0xAD, 0xA6, 0x78, 0x3A, 0x70, 0x81, + 0x7F, 0x73, 0xA6, 0xC6, 0x37, 0x5C, 0x6A, 0x97, 0x78, 0x20, 0xFD, 0x96, 0xCA, 0x39, 0x9B, 0x81, + 0x9D, 0xBC, 0x91, 0xF2, 0xFC, 0x45, 0x5E, 0x8E, 0x07, 0x1F, 0x42, 0xB6, 0x19, 0x73, 0xE2, 0xE4, + 0x93, 0x54, 0xA1, 0x34, 0xA5, 0x19, 0x36, 0xD2, 0x52, 0x71, 0x56, 0x87, 0x92, 0x9B, 0x8B, 0xB2, + 0x5B, 0x26, 0xAF, 0x2B, 0x17, 0x46, 0x94, 0xEA, 0x52, 0xB3, 0x8C, 0xAE, 0x95, 0xAC, 0xF5, 0x72, + 0x4A, 0x5A, 0x69, 0x6B, 0x6B, 0x6B, 0xEC, 0x9A, 0x6B, 0xA5, 0x97, 0xCD, 0xBF, 0x1C, 0xFF, 0x00, + 0x69, 0xBF, 0x83, 0x3F, 0xB2, 0xD7, 0x88, 0xF4, 0xCF, 0x04, 0x7E, 0xCC, 0xFF, 0x00, 0x0D, 0xB4, + 0xEF, 0x1D, 0x78, 0x9A, 0xDE, 0x43, 0x75, 0x79, 0xFB, 0x47, 0xFC, 0x79, 0xD1, 0xF4, 0xFF, 0x00, + 0x10, 0x6A, 0x1A, 0x0C, 0xEE, 0x76, 0xDB, 0x37, 0x85, 0xBC, 0x17, 0x22, 0xC9, 0xA6, 0xE9, 0xE1, + 0x59, 0x8B, 0x2C, 0xD7, 0x6D, 0x7B, 0x71, 0x85, 0xCA, 0x98, 0x99, 0x85, 0x7D, 0x5F, 0x0D, 0x70, + 0x9E, 0x67, 0xC5, 0x14, 0xE7, 0x9A, 0xE7, 0xB8, 0x88, 0xC6, 0x94, 0x24, 0x93, 0xC3, 0x51, 0xAA, + 0xE1, 0xCD, 0x1B, 0x3B, 0xFB, 0x5A, 0xAA, 0xD2, 0x6D, 0x5D, 0x59, 0x46, 0xEB, 0x95, 0x3B, 0xE8, + 0xAE, 0x7D, 0x2F, 0x0C, 0xF0, 0xEC, 0x73, 0x15, 0x52, 0x58, 0xEA, 0xAE, 0x18, 0x77, 0xEE, 0xC2, + 0x9C, 0x13, 0x51, 0x72, 0x93, 0x52, 0x71, 0x6F, 0xA4, 0x64, 0x93, 0xE5, 0x4B, 0xDD, 0x52, 0x6A, + 0x3A, 0x2E, 0x54, 0x43, 0xA6, 0xFC, 0x65, 0xD5, 0xBF, 0x68, 0x1F, 0x09, 0xB6, 0xBF, 0xF1, 0x43, + 0xC6, 0x7A, 0xBF, 0x8C, 0x3C, 0x55, 0x10, 0x65, 0x7D, 0x5F, 0xC5, 0x37, 0xD3, 0x6A, 0x72, 0xCA, + 0x42, 0x96, 0x46, 0xB7, 0x12, 0x65, 0x52, 0x2D, 0xAC, 0xC5, 0x55, 0x42, 0x2A, 0x8D, 0xA4, 0x01, + 0x8E, 0x3E, 0x7B, 0x1F, 0x91, 0xAE, 0x16, 0xCF, 0xE5, 0x4F, 0x29, 0xA4, 0xA1, 0x4A, 0x49, 0x2B, + 0x38, 0x27, 0xEE, 0x3B, 0x59, 0x4B, 0x95, 0xA5, 0x34, 0xDA, 0x4E, 0xF7, 0xE5, 0x76, 0xBF, 0x2A, + 0xBD, 0xCE, 0x0A, 0xB8, 0x19, 0x61, 0xB9, 0x68, 0xB8, 0xD9, 0xAB, 0x3D, 0x1E, 0x89, 0xA4, 0x93, + 0x4D, 0xAD, 0x1F, 0x66, 0x92, 0xB3, 0x5A, 0x5B, 0x44, 0x8F, 0x99, 0x3E, 0x21, 0xFC, 0x41, 0xF0, + 0x56, 0xAF, 0xE1, 0x0D, 0x4B, 0xC2, 0x9A, 0x8C, 0x76, 0xBA, 0x96, 0xB3, 0xA0, 0x6B, 0xD1, 0x43, + 0xA7, 0xD8, 0x88, 0x08, 0xBC, 0x59, 0x55, 0x90, 0xCE, 0xEA, 0xDD, 0x55, 0x04, 0x4C, 0xFB, 0x9B, + 0x18, 0x39, 0x51, 0xC9, 0x38, 0x3D, 0x13, 0xE1, 0xBA, 0xF8, 0x4C, 0x7D, 0x3C, 0xCA, 0xF1, 0xF6, + 0x75, 0x62, 0xB9, 0xA2, 0xA9, 0x4B, 0x95, 0xC6, 0xCF, 0x95, 0x36, 0xBD, 0xDB, 0xDD, 0xA8, 0xC5, + 0x5D, 0x5B, 0x55, 0x64, 0x95, 0xCF, 0x6F, 0x85, 0xFE, 0xBD, 0x5F, 0x11, 0x52, 0xBD, 0x0A, 0x53, + 0xA7, 0x04, 0xE5, 0x17, 0x29, 0x68, 0x9D, 0x97, 0x4B, 0xA5, 0x75, 0xCC, 0xAC, 0xAC, 0xDA, 0xD1, + 0xB4, 0xEC, 0x7C, 0xF5, 0xE1, 0x3F, 0x82, 0x5E, 0x21, 0xF1, 0x67, 0x8A, 0x24, 0xF1, 0x0E, 0x97, + 0x61, 0x04, 0x7E, 0x1C, 0xF0, 0xDD, 0xC3, 0x4B, 0xAC, 0xF8, 0x8F, 0x5C, 0xBE, 0x83, 0x45, 0xF0, + 0x8E, 0x8D, 0x1C, 0x71, 0x16, 0x32, 0x3E, 0xA1, 0x23, 0xF9, 0x2E, 0xD1, 0x0D, 0xA1, 0xA2, 0x8D, + 0x9D, 0xDF, 0x2B, 0xB5, 0x4E, 0x78, 0xF5, 0xB0, 0xF8, 0xC9, 0x65, 0x78, 0x5A, 0xF9, 0x4D, 0x14, + 0xEB, 0xD4, 0xFB, 0x2D, 0x45, 0xA8, 0x72, 0xB6, 0xB7, 0x6A, 0x2D, 0x45, 0x59, 0xBB, 0x59, 0xDD, + 0x2B, 0x26, 0xB6, 0xBF, 0xDA, 0x67, 0x99, 0xB5, 0x3C, 0x47, 0x0F, 0xCB, 0x24, 0x75, 0x5D, 0x3A, + 0xF3, 0xB3, 0xA6, 0xE0, 0x9B, 0xAA, 0xDD, 0xD5, 0xE3, 0xCB, 0xFC, 0xB3, 0xD9, 0x39, 0x24, 0x92, + 0xBA, 0x4D, 0x3B, 0x5B, 0xED, 0xDB, 0x2B, 0xDF, 0x84, 0x5A, 0x36, 0x9D, 0x1D, 0xC5, 0x8E, 0xA9, + 0xFF, 0x00, 0x0B, 0x3A, 0x54, 0xB6, 0x74, 0x53, 0x62, 0x92, 0x68, 0x3E, 0x09, 0x8A, 0x40, 0x3E, + 0x42, 0x1C, 0xA8, 0xBC, 0xB9, 0x41, 0xB1, 0xB7, 0x02, 0xB6, 0xBD, 0x32, 0x09, 0x18, 0xAF, 0x85, + 0x95, 0x0A, 0x4E, 0x6E, 0x92, 0x4F, 0xDA, 0xD9, 0x5A, 0x2A, 0x2E, 0xC9, 0xDB, 0x58, 0xB9, 0x26, + 0x9A, 0xBA, 0x76, 0x4E, 0x2A, 0xCE, 0xD6, 0x49, 0xD9, 0x27, 0xF9, 0x7E, 0x3E, 0xAE, 0x2B, 0x0B, + 0x0A, 0x8F, 0x34, 0x4A, 0x8C, 0x23, 0xBA, 0x95, 0x9C, 0xAC, 0x96, 0xA9, 0xAB, 0x72, 0xEA, 0xAC, + 0xEC, 0xAE, 0xB6, 0x5A, 0x5B, 0x4F, 0x8D, 0xBF, 0x69, 0xAF, 0x8B, 0x9A, 0xCE, 0xAB, 0xE1, 0x6B, + 0xDF, 0x0F, 0x5A, 0x78, 0xB6, 0x5F, 0x86, 0x7A, 0x05, 0xAC, 0x9B, 0x53, 0x4B, 0xF0, 0x1F, 0x87, + 0xDF, 0x48, 0xB1, 0xBB, 0x42, 0x09, 0x41, 0x70, 0xF6, 0x8D, 0x1C, 0xD3, 0xFC, 0xFB, 0x50, 0x99, + 0xE4, 0x90, 0xFC, 0xCC, 0xC4, 0xE0, 0x36, 0xEF, 0xD2, 0x78, 0x3B, 0x87, 0xF0, 0xCE, 0x0F, 0x11, + 0x89, 0xA7, 0xED, 0x71, 0x0E, 0x36, 0xA7, 0x4E, 0x70, 0x4E, 0x94, 0x55, 0x95, 0xDA, 0xEA, 0x9B, + 0x4B, 0x4E, 0xA9, 0x2B, 0x37, 0xCD, 0xCA, 0x97, 0xE4, 0x58, 0x9E, 0x31, 0x78, 0xEE, 0x22, 0xA3, + 0x92, 0x65, 0xCB, 0x97, 0x0D, 0x1D, 0x5B, 0x76, 0xE6, 0x9F, 0xBB, 0xA6, 0x96, 0x51, 0x8C, 0x53, + 0x8F, 0xBB, 0x15, 0x67, 0xB6, 0x9A, 0x26, 0x79, 0x1F, 0xEC, 0x13, 0xA4, 0xF8, 0x27, 0x59, 0xF1, + 0xA6, 0x87, 0x07, 0xC4, 0xE8, 0xAF, 0xCF, 0x85, 0xEF, 0x6F, 0xE7, 0x8F, 0x58, 0xBE, 0xD3, 0x6F, + 0xA3, 0xD3, 0x2E, 0x61, 0x91, 0xCE, 0xDB, 0x69, 0xE4, 0xBA, 0x96, 0x29, 0x51, 0x15, 0x58, 0x29, + 0x25, 0x90, 0x8C, 0x01, 0x9C, 0x63, 0x23, 0xE7, 0x38, 0x83, 0x1F, 0x9F, 0x4E, 0xAD, 0x7C, 0xB7, + 0x30, 0x84, 0x69, 0xD3, 0xA5, 0x07, 0xA5, 0x35, 0x68, 0x25, 0xCA, 0x9C, 0x6D, 0x3D, 0x3A, 0xB5, + 0x65, 0x2B, 0x6A, 0xF5, 0x69, 0x5E, 0xFF, 0x00, 0x3B, 0x9D, 0x2A, 0x15, 0x78, 0xD2, 0x93, 0xC4, + 0x45, 0xCE, 0x94, 0x20, 0x9A, 0x5A, 0x68, 0xDA, 0x49, 0xDB, 0xB7, 0xC4, 0xED, 0xD5, 0x6E, 0xBA, + 0x23, 0xF4, 0x5B, 0xE2, 0xAF, 0x86, 0xFC, 0x1F, 0xE1, 0x8F, 0x1A, 0xEA, 0x3A, 0x6F, 0x80, 0x35, + 0xEB, 0x7F, 0x11, 0xF8, 0x40, 0x2C, 0x52, 0xE8, 0x9A, 0x94, 0x1A, 0x8C, 0x5A, 0x9C, 0xC6, 0x23, + 0x18, 0xDE, 0x93, 0x4B, 0x1A, 0xAA, 0x86, 0x0C, 0x1B, 0x80, 0x07, 0x18, 0xF5, 0xAF, 0xCF, 0xAA, + 0xD0, 0xC1, 0xD5, 0x8A, 0x9B, 0x9B, 0x6A, 0x50, 0x4D, 0x34, 0xD3, 0xE5, 0x76, 0xE5, 0x6B, 0xCA, + 0xF6, 0xD1, 0x6A, 0xAF, 0xB2, 0x49, 0x33, 0xE8, 0x29, 0xF2, 0xA7, 0x15, 0x49, 0x3E, 0x5B, 0xDB, + 0x5B, 0x74, 0xDB, 0x44, 0x96, 0x96, 0xB7, 0x45, 0xA5, 0xB4, 0x3C, 0xFC, 0x0C, 0x00, 0x30, 0x07, + 0x03, 0x80, 0x30, 0x3D, 0xB0, 0x3F, 0x2A, 0xF9, 0xEC, 0x4A, 0x8C, 0x6A, 0x4E, 0x34, 0xDF, 0xBA, + 0x9D, 0x97, 0xA2, 0xD1, 0x74, 0x5B, 0x69, 0xD1, 0x1D, 0x4A, 0xD6, 0x56, 0x5A, 0x1F, 0x26, 0xFE, + 0xD2, 0xF3, 0xCD, 0xA6, 0xE9, 0x29, 0xA9, 0xD9, 0xC9, 0xF6, 0x4B, 0xDD, 0x35, 0x5B, 0x52, 0xB3, + 0xBA, 0x50, 0x14, 0xDB, 0xCB, 0x02, 0xA3, 0xC7, 0x20, 0xFA, 0x34, 0x6A, 0x46, 0x01, 0xF4, 0xF5, + 0xC7, 0xBB, 0x90, 0x61, 0xA3, 0x57, 0x0F, 0x7A, 0xF1, 0x6E, 0x8A, 0x9C, 0x1C, 0x92, 0xB6, 0xCA, + 0x4B, 0xE1, 0xBB, 0x4A, 0xF6, 0xBA, 0x49, 0xE9, 0x6E, 0xA9, 0x1F, 0x25, 0x98, 0x5A, 0x3C, 0x53, + 0x97, 0x72, 0xAD, 0x5B, 0x6A, 0xD6, 0xDD, 0x37, 0x15, 0x67, 0xD3, 0xAA, 0xD1, 0xE9, 0x6B, 0x37, + 0xD1, 0x1B, 0x3F, 0xB3, 0xDB, 0xDB, 0xEA, 0xBA, 0x9E, 0xB9, 0x7D, 0x14, 0xBA, 0xD5, 0xCD, 0xD6, + 0xAF, 0xA6, 0x5B, 0x6A, 0x92, 0xBE, 0xA8, 0xD1, 0xB5, 0xE5, 0xC5, 0xE4, 0xAA, 0x92, 0x5D, 0xCD, + 0x28, 0x45, 0x00, 0xA9, 0xDC, 0xFB, 0x70, 0x09, 0xE8, 0x4F, 0x4E, 0x7F, 0x45, 0xE2, 0xDE, 0x19, + 0x79, 0x7E, 0x03, 0x31, 0xCA, 0x68, 0xE2, 0x29, 0x4B, 0xEB, 0x34, 0x69, 0xD4, 0xA6, 0xA9, 0xF3, + 0x3F, 0x75, 0x4E, 0x2E, 0xD3, 0x8C, 0x60, 0xDF, 0x34, 0x6C, 0xEF, 0x65, 0x24, 0x9A, 0x6F, 0x45, + 0x76, 0xB9, 0x68, 0xD6, 0xA8, 0xF8, 0xA5, 0x4D, 0xAB, 0x46, 0x11, 0xB4, 0xAF, 0xA2, 0xDD, 0xC5, + 0x72, 0x2E, 0xCD, 0xA5, 0x65, 0xA5, 0x96, 0x8B, 0xA2, 0x3E, 0xA7, 0x96, 0x33, 0x83, 0x0A, 0x14, + 0xF9, 0xD0, 0xE0, 0x07, 0xE1, 0x14, 0xFD, 0xD1, 0x9E, 0x3B, 0x1F, 0xE8, 0x3D, 0xFF, 0x00, 0x9E, + 0x6A, 0xE5, 0x35, 0xF0, 0x39, 0x8C, 0x32, 0xE9, 0x54, 0x8D, 0xDD, 0x9A, 0x69, 0x4F, 0x95, 0x5F, + 0xAB, 0xBC, 0x39, 0xAD, 0xA7, 0x48, 0xB4, 0xBD, 0x36, 0xFD, 0x0B, 0x9F, 0xF7, 0x4D, 0xF2, 0xF4, + 0xB7, 0x4E, 0x8A, 0xD6, 0xB2, 0xEB, 0xA7, 0xDD, 0xF8, 0x7E, 0x69, 0x7C, 0x67, 0xF0, 0xE5, 0xFD, + 0xFF, 0x00, 0xC5, 0x4F, 0x0F, 0x5E, 0x27, 0x93, 0x6F, 0x6F, 0x65, 0x77, 0x33, 0x99, 0x27, 0x8A, + 0x62, 0x92, 0x32, 0x22, 0x6E, 0x89, 0x1D, 0x62, 0x61, 0xBC, 0x6D, 0xC7, 0x25, 0x47, 0x23, 0xF1, + 0xFD, 0xD7, 0x26, 0xE0, 0xAC, 0xCF, 0x17, 0x80, 0x78, 0x8A, 0x1E, 0xCD, 0xD3, 0x8C, 0x5B, 0x6D, + 0xAA, 0xCB, 0x48, 0x59, 0xC9, 0xC5, 0x7B, 0x1D, 0x55, 0xA4, 0xBB, 0x68, 0xBA, 0xDF, 0x5F, 0xCF, + 0xF0, 0x58, 0xAA, 0x14, 0x30, 0x79, 0xE5, 0x3A, 0xBA, 0x39, 0xDA, 0xCB, 0xD2, 0x2B, 0x4B, 0x2E, + 0xD7, 0xE8, 0xAC, 0xAC, 0xF5, 0x4B, 0x6F, 0xD1, 0xEF, 0x01, 0x69, 0xB3, 0xDC, 0x68, 0x1A, 0x6C, + 0x31, 0xF9, 0x6B, 0x88, 0x10, 0x2E, 0xE5, 0x70, 0x84, 0x01, 0xD0, 0x00, 0xA4, 0xFA, 0x0E, 0x71, + 0xDB, 0xD2, 0xBF, 0x21, 0xC7, 0xF0, 0xF5, 0x59, 0x66, 0x95, 0x29, 0x7B, 0x68, 0x45, 0xDE, 0xD7, + 0xE5, 0xAD, 0x65, 0x64, 0xDE, 0xCA, 0x93, 0x7E, 0x9A, 0x7C, 0x92, 0x3E, 0xC7, 0x24, 0xAA, 0xA9, + 0xE5, 0x34, 0x13, 0x8E, 0xAA, 0x11, 0xBA, 0x56, 0xD2, 0xD1, 0x4A, 0xFA, 0xB4, 0x95, 0xAD, 0x7F, + 0x93, 0xD3, 0x4B, 0x1D, 0x65, 0xD5, 0xBF, 0xD9, 0xE2, 0x52, 0xF2, 0xC4, 0xFE, 0x64, 0x41, 0xC8, + 0x8D, 0x24, 0x40, 0x8B, 0x91, 0xC1, 0x0C, 0x8B, 0xD0, 0x0E, 0x80, 0x11, 0x5F, 0x2F, 0x57, 0x0F, + 0x1C, 0x2C, 0xE3, 0x1E, 0x74, 0xD5, 0xB7, 0x8A, 0x92, 0xB6, 0x96, 0xB5, 0xA5, 0x18, 0xBB, 0xDE, + 0xC9, 0xD9, 0x35, 0xD8, 0xF5, 0x22, 0xA2, 0xAF, 0x14, 0xAC, 0xD6, 0x89, 0x69, 0xDB, 0xCB, 0x4F, + 0xCA, 0xD7, 0xEF, 0xA1, 0xF9, 0x7F, 0xF1, 0x56, 0xD0, 0xC9, 0xFB, 0x41, 0xF8, 0x41, 0x51, 0xA0, + 0x0D, 0x2D, 0xF5, 0xC8, 0xDD, 0x2C, 0x82, 0xDE, 0x35, 0xDD, 0x1A, 0xE7, 0x73, 0x1C, 0x05, 0x00, + 0x9E, 0xA4, 0xF4, 0xC7, 0xA1, 0xC7, 0xEA, 0xB8, 0x2C, 0x1D, 0x2F, 0xEC, 0xAA, 0x75, 0xA8, 0x4E, + 0x2D, 0x28, 0x45, 0x59, 0xF3, 0x27, 0xBF, 0x4F, 0x75, 0x2B, 0x5F, 0x4B, 0xDD, 0x5E, 0xDA, 0x24, + 0x91, 0xF0, 0x3C, 0xEE, 0x58, 0x0C, 0xEA, 0x92, 0xDF, 0xDA, 0x51, 0x4A, 0xF6, 0x4B, 0x74, 0x96, + 0xFA, 0x25, 0x65, 0xF8, 0x75, 0xD0, 0xFD, 0x34, 0xD2, 0xAD, 0xB6, 0xE9, 0xB0, 0x85, 0x16, 0x8A, + 0x12, 0x24, 0x8C, 0x2C, 0x37, 0x02, 0x68, 0xC6, 0xD4, 0x00, 0x04, 0x7E, 0x77, 0x0F, 0xBD, 0x8F, + 0xA7, 0xD2, 0xBF, 0x32, 0xCC, 0x30, 0xB2, 0x85, 0x7A, 0x93, 0x4A, 0x11, 0x82, 0xB7, 0xBA, 0xA4, + 0x9D, 0xAF, 0xD1, 0x27, 0x66, 0xDA, 0xD2, 0xFA, 0x69, 0xF9, 0x7D, 0xEE, 0x0A, 0x50, 0x78, 0x78, + 0x4A, 0xCD, 0x2B, 0x2D, 0x2D, 0xB6, 0xD6, 0x5A, 0x68, 0xAD, 0xBF, 0x4F, 0x97, 0x4F, 0x39, 0xF8, + 0x81, 0xFB, 0x54, 0xFE, 0xD0, 0x1F, 0xB3, 0x0D, 0x97, 0xF6, 0xCF, 0xC1, 0xCF, 0x18, 0xC9, 0x69, + 0xA4, 0x5E, 0xAA, 0xDA, 0xF8, 0x9F, 0xE1, 0xEF, 0x89, 0x74, 0xDB, 0x7F, 0x1B, 0xFC, 0x27, 0xF1, + 0xA5, 0xB3, 0x4A, 0xAA, 0xF6, 0xDA, 0xDF, 0x86, 0x2F, 0x52, 0x5D, 0x3E, 0xF1, 0x30, 0xC4, 0x0D, + 0xF1, 0x6F, 0x5C, 0xE5, 0x59, 0x48, 0x06, 0xBE, 0xA3, 0x86, 0xB8, 0x5E, 0xBE, 0x7D, 0x97, 0x56, + 0xF6, 0x74, 0xD5, 0xA3, 0x67, 0xCD, 0xCC, 0xA3, 0x64, 0x93, 0xEF, 0xB2, 0x76, 0x49, 0xD9, 0x35, + 0x74, 0x95, 0xBB, 0x79, 0xD2, 0xC5, 0x62, 0x69, 0xF1, 0x36, 0x0B, 0x03, 0x46, 0xEE, 0x35, 0x54, + 0xE3, 0xC8, 0x95, 0xEE, 0xD4, 0x79, 0xA3, 0x6B, 0x2B, 0x26, 0xAC, 0xEC, 0xD6, 0xB6, 0xBE, 0x96, + 0x3E, 0xBA, 0xF8, 0x1B, 0x2F, 0xEC, 0x6F, 0xF1, 0xFB, 0xC2, 0x16, 0x17, 0xCD, 0xE0, 0xEF, 0x0B, + 0xFE, 0xC6, 0x3F, 0x17, 0xF5, 0xA5, 0x3B, 0xDB, 0xC3, 0x56, 0xB7, 0x7A, 0x9F, 0xEC, 0x97, 0xE2, + 0x3B, 0xA7, 0x1F, 0xBB, 0x56, 0xD3, 0xD1, 0x65, 0xD5, 0x3C, 0x36, 0xD2, 0x33, 0x03, 0xBD, 0x24, + 0xBC, 0xB3, 0x43, 0xD5, 0x61, 0x4E, 0x47, 0x9B, 0x98, 0xC9, 0x60, 0x25, 0x3C, 0xBB, 0x13, 0x49, + 0x54, 0x51, 0x49, 0xC1, 0xC9, 0xBB, 0xC3, 0x4D, 0x95, 0x9A, 0xBE, 0xF6, 0xD3, 0xC9, 0xD9, 0xEC, + 0x2C, 0x9A, 0xA5, 0x3C, 0xD6, 0x32, 0xCC, 0xA3, 0x1F, 0x67, 0x56, 0x4D, 0xF3, 0xB4, 0x93, 0xBB, + 0x8B, 0xE5, 0xDD, 0xAD, 0x15, 0xA2, 0x9F, 0x2E, 0x89, 0x6C, 0xB5, 0x37, 0x75, 0x6F, 0x83, 0x3F, + 0xB4, 0xBF, 0xC2, 0x6F, 0x17, 0x69, 0x7F, 0x0E, 0xEE, 0x3C, 0x35, 0xA8, 0xCD, 0x37, 0x89, 0xB4, + 0xFB, 0x8D, 0x67, 0xC2, 0xD1, 0x59, 0xDD, 0x59, 0x78, 0xBF, 0xE1, 0x9F, 0xC4, 0x3B, 0x0B, 0x68, + 0x4B, 0xCD, 0xA8, 0x68, 0xF7, 0xE5, 0x9F, 0x4D, 0xBE, 0xB5, 0x11, 0x6E, 0x62, 0xF1, 0xB9, 0x2A, + 0x32, 0x18, 0x29, 0xE0, 0x78, 0x0A, 0x55, 0x22, 0x92, 0xA2, 0xF4, 0xBE, 0x89, 0xE8, 0x96, 0x96, + 0xD1, 0x6C, 0xB4, 0xF2, 0x5D, 0x3A, 0xA5, 0x6F, 0xA2, 0x97, 0x32, 0x82, 0x8C, 0x2D, 0x6D, 0x1B, + 0x56, 0x49, 0x69, 0x6B, 0x69, 0xB6, 0x96, 0x5B, 0xAB, 0x25, 0x6B, 0xE8, 0x7E, 0x75, 0x7E, 0xD7, + 0x9E, 0x12, 0xF8, 0x5B, 0xE1, 0x4F, 0x1F, 0x68, 0x36, 0x3F, 0x15, 0x7C, 0x21, 0xE2, 0x0F, 0x82, + 0xDF, 0x13, 0xEC, 0x75, 0x0B, 0x59, 0x57, 0xC4, 0x9F, 0x0E, 0x22, 0xB7, 0xD5, 0x74, 0x88, 0xCD, + 0xDA, 0xAB, 0xC6, 0xBA, 0x86, 0x86, 0xCF, 0xB9, 0x91, 0xD5, 0xC1, 0xDD, 0x6B, 0x73, 0x1E, 0xD5, + 0x23, 0xF7, 0x67, 0x6E, 0xD3, 0xF5, 0x79, 0x44, 0xB3, 0x3F, 0xA9, 0xA7, 0x4E, 0x29, 0xC2, 0x12, + 0x49, 0xA6, 0x9B, 0xB4, 0x1E, 0x97, 0xDF, 0x64, 0xF6, 0xF4, 0xB5, 0x92, 0xBB, 0x5F, 0x37, 0x38, + 0x65, 0x72, 0xC5, 0x62, 0x72, 0xCA, 0xB4, 0xB9, 0x5D, 0x5A, 0x32, 0x9C, 0x9C, 0x5D, 0xA0, 0x9C, + 0x76, 0x9B, 0x8D, 0xB4, 0x92, 0xBA, 0xB4, 0x93, 0x4D, 0xD9, 0xAD, 0x5D, 0xAD, 0xF4, 0x1D, 0xB7, + 0x83, 0x35, 0x6B, 0x7F, 0x0A, 0xE9, 0xFA, 0xD5, 0x95, 0xD6, 0x9F, 0xE2, 0xDF, 0x0F, 0x1B, 0x58, + 0x99, 0xBC, 0x47, 0xE1, 0xB7, 0x6B, 0xAB, 0x14, 0x47, 0x5C, 0x23, 0x5D, 0xC0, 0xCA, 0x27, 0xB5, + 0x62, 0x03, 0x7C, 0x93, 0x22, 0x1E, 0xB8, 0x24, 0x00, 0x4F, 0xCC, 0xE3, 0x30, 0xED, 0x62, 0x27, + 0x0A, 0x11, 0xB2, 0x6D, 0x24, 0xBF, 0x95, 0xDE, 0xDA, 0xA5, 0x6B, 0x6E, 0xB5, 0xB5, 0xBB, 0x76, + 0x37, 0xC1, 0x42, 0x73, 0xC1, 0x53, 0x97, 0x32, 0x9C, 0x6C, 0xBD, 0xE8, 0xEA, 0x9A, 0xB6, 0x92, + 0xDB, 0x4B, 0xDA, 0xE9, 0x34, 0x9A, 0x5D, 0x17, 0x5E, 0x5E, 0x5B, 0x2B, 0x08, 0xA7, 0xDD, 0x6F, + 0x67, 0x67, 0x13, 0xA4, 0x62, 0x03, 0x24, 0x36, 0xE8, 0x0B, 0x60, 0x92, 0x72, 0xEA, 0x06, 0x7E, + 0xF0, 0x18, 0xE9, 0xD7, 0xAE, 0x33, 0x5E, 0xB7, 0x13, 0x62, 0xA5, 0x2C, 0x5D, 0x2C, 0x1A, 0x93, + 0xB5, 0x1A, 0x54, 0xE9, 0xCA, 0xCD, 0xB8, 0xB9, 0x41, 0x59, 0xB5, 0x7E, 0x8F, 0x65, 0x6B, 0x26, + 0x96, 0x89, 0x2B, 0x25, 0xCB, 0x47, 0x0D, 0x46, 0x84, 0xA4, 0xE9, 0xC2, 0x29, 0xB7, 0xD2, 0x29, + 0x3B, 0x6E, 0x96, 0x89, 0x68, 0xBB, 0x6B, 0xFE, 0x5E, 0x45, 0xF1, 0x93, 0xC6, 0x31, 0x78, 0x2F, + 0xC1, 0x5A, 0x9D, 0xFE, 0xFD, 0xD7, 0xD7, 0x10, 0xB5, 0x8D, 0x8C, 0x23, 0x22, 0x59, 0x65, 0x95, + 0x48, 0x45, 0x53, 0x8E, 0xA4, 0xB2, 0xA8, 0x00, 0xF5, 0xF4, 0xE9, 0x59, 0x64, 0xB8, 0x65, 0x5F, + 0x11, 0xCF, 0x28, 0xFB, 0x90, 0x57, 0xE8, 0x96, 0x9B, 0x2B, 0x74, 0x5B, 0x7C, 0xB5, 0xB5, 0x8E, + 0x7C, 0xDE, 0x72, 0xF6, 0x10, 0xC2, 0xD1, 0x76, 0x9D, 0x57, 0xCA, 0x9E, 0xDC, 0xB1, 0xB7, 0xBF, + 0x2D, 0xAD, 0x68, 0xC5, 0x37, 0xD2, 0xCD, 0x2E, 0x87, 0x21, 0xF0, 0x4F, 0xC1, 0xEF, 0xE1, 0x4F, + 0x05, 0xDA, 0xDD, 0x6A, 0x08, 0x3F, 0xB6, 0xB5, 0xEC, 0xEB, 0x3A, 0xA4, 0xAC, 0x06, 0x5A, 0x59, + 0x8E, 0xE6, 0x04, 0x1E, 0x70, 0x37, 0x00, 0x3B, 0xFC, 0xB8, 0xED, 0x5E, 0x86, 0x67, 0x5F, 0xDA, + 0xE2, 0x3D, 0x94, 0x7E, 0x15, 0xA7, 0x6D, 0x7A, 0xF9, 0x69, 0xA2, 0xD3, 0x4B, 0x5B, 0x43, 0x93, + 0x2B, 0xA5, 0x1A, 0x8A, 0x78, 0xE8, 0x2B, 0x53, 0x92, 0x51, 0xA6, 0xB4, 0xF7, 0x69, 0x41, 0x38, + 0xC1, 0x76, 0x57, 0x5E, 0xF3, 0xB5, 0xB5, 0x6C, 0xE6, 0xAF, 0x2E, 0x63, 0xF1, 0xE7, 0xC6, 0x9F, + 0x0D, 0x78, 0x2E, 0xEA, 0x6D, 0x56, 0x6F, 0x03, 0xF8, 0x66, 0x44, 0xD7, 0x3C, 0x6D, 0xA6, 0xE8, + 0x97, 0x2B, 0x6B, 0x36, 0xA4, 0xD1, 0x12, 0x6D, 0x61, 0x66, 0x78, 0xE4, 0x87, 0x86, 0x1B, 0x87, + 0x98, 0x8C, 0x32, 0x99, 0xC0, 0xAF, 0x4F, 0x2D, 0xC3, 0x53, 0x85, 0x3A, 0x5C, 0xE9, 0x5D, 0xB5, + 0x2D, 0x5B, 0x4B, 0xB2, 0x57, 0x49, 0xBD, 0x77, 0x56, 0x4D, 0xAD, 0xBC, 0x97, 0x32, 0xC7, 0xC2, + 0x12, 0xAD, 0xCE, 0xA5, 0xC9, 0x51, 0xFB, 0x15, 0x6B, 0x2B, 0xC5, 0x6B, 0x55, 0xEA, 0x9E, 0x8D, + 0x72, 0xD3, 0xD9, 0x5E, 0xEE, 0xDA, 0xBB, 0x2E, 0x83, 0xE3, 0xDD, 0xA7, 0x86, 0xF4, 0x7F, 0x06, + 0xBF, 0x8F, 0x34, 0xDF, 0x0D, 0x4D, 0xA9, 0x6A, 0x9E, 0x17, 0x79, 0xB6, 0x8D, 0x7A, 0x67, 0xFB, + 0x25, 0xAD, 0xB3, 0xCA, 0xBF, 0xD9, 0xD7, 0x36, 0x62, 0x01, 0x08, 0xF3, 0xA1, 0x09, 0x36, 0xE2, + 0xE4, 0xC6, 0xDC, 0x81, 0x19, 0xC8, 0x03, 0xAB, 0x1B, 0x5A, 0xAD, 0x0C, 0x33, 0xA3, 0x42, 0x0E, + 0x3A, 0xF3, 0x24, 0x95, 0xA1, 0x68, 0xE9, 0x2E, 0x56, 0xF7, 0x4D, 0x75, 0x51, 0x8B, 0x4F, 0x95, + 0xEB, 0xB1, 0xD1, 0x95, 0x51, 0xC2, 0x57, 0xC7, 0x4B, 0x0D, 0x59, 0x47, 0xD9, 0xD6, 0x84, 0xE9, + 0x6A, 0xED, 0x66, 0xD3, 0xF6, 0x7A, 0x27, 0x6B, 0xDF, 0xDD, 0x56, 0xBB, 0x4D, 0xA4, 0xAD, 0x64, + 0x9F, 0x8E, 0x7C, 0x56, 0x1E, 0x1F, 0xF8, 0x8D, 0x6F, 0xF0, 0xA7, 0xC0, 0x56, 0xA5, 0xA6, 0x7F, + 0x11, 0xC2, 0xDE, 0x32, 0xF1, 0x5D, 0xFC, 0x69, 0x24, 0x73, 0x69, 0x56, 0x91, 0xC0, 0x3E, 0xCD, + 0x0D, 0xB0, 0x2C, 0xB9, 0x0C, 0xF2, 0x80, 0xDB, 0x90, 0x8C, 0x85, 0x28, 0xF8, 0xC9, 0x1E, 0x76, + 0x33, 0x03, 0x84, 0xC4, 0x61, 0x29, 0xE1, 0xE5, 0x2E, 0x6A, 0x52, 0x7C, 0xD3, 0x4A, 0xE9, 0x38, + 0x24, 0xDC, 0x53, 0x69, 0x24, 0xB5, 0xE5, 0x6D, 0x2E, 0xCD, 0x76, 0x44, 0xE5, 0x99, 0x9B, 0xCA, + 0xB0, 0x55, 0x73, 0x47, 0x4A, 0xD8, 0x9A, 0x6A, 0x34, 0xA3, 0xCC, 0xB4, 0xF6, 0x92, 0x92, 0x73, + 0x51, 0x49, 0xA7, 0xA4, 0x21, 0x27, 0xCC, 0xD2, 0x4D, 0x34, 0x93, 0xB5, 0xAD, 0x52, 0xC3, 0x5D, + 0xD2, 0x35, 0x4F, 0x87, 0x5E, 0x38, 0x8B, 0x40, 0xB7, 0xD4, 0x74, 0x0D, 0x33, 0xE1, 0xC8, 0x5D, + 0x02, 0x2B, 0x08, 0x3C, 0x4A, 0x9A, 0x7F, 0x8A, 0x4B, 0xB4, 0x89, 0x0D, 0xA5, 0xC5, 0x94, 0x92, + 0xF9, 0x87, 0xCD, 0x69, 0x64, 0x47, 0xD8, 0x9B, 0x88, 0x03, 0x82, 0x02, 0x8A, 0xEC, 0x82, 0xCB, + 0xB0, 0x70, 0x9D, 0x1A, 0xCA, 0x72, 0x8C, 0x53, 0xA4, 0x92, 0xB5, 0xF9, 0x9A, 0x51, 0x85, 0xEF, + 0x14, 0x9C, 0x75, 0x4F, 0x58, 0xAF, 0x73, 0x56, 0xF6, 0x14, 0xB2, 0xEF, 0xAF, 0x71, 0x4D, 0x2C, + 0xC3, 0x0A, 0xA3, 0x0C, 0x2B, 0x8C, 0x31, 0x57, 0x5A, 0x2B, 0x28, 0xB9, 0x4E, 0xD1, 0x6F, 0xAC, + 0xA2, 0xDC, 0xA3, 0xCC, 0x92, 0xBE, 0x8A, 0xEE, 0xC7, 0x45, 0xE3, 0x7F, 0x03, 0xEB, 0xBF, 0x0A, + 0xFC, 0x03, 0xF0, 0x7B, 0xC6, 0x50, 0x78, 0x87, 0xC4, 0xD6, 0x7E, 0x20, 0xF1, 0xBE, 0xB1, 0x6D, + 0xA2, 0xDF, 0x68, 0xF6, 0xFA, 0x8A, 0xFD, 0x83, 0xC5, 0x5A, 0x2C, 0xA4, 0xC6, 0x6F, 0x2F, 0x4A, + 0xB8, 0x9E, 0x59, 0x0D, 0xD3, 0x4A, 0x3E, 0x7C, 0x80, 0x49, 0x39, 0x3B, 0xB8, 0xE2, 0xAD, 0x08, + 0xD1, 0x9E, 0x17, 0xD8, 0x53, 0x4E, 0x34, 0x5C, 0x60, 0xDD, 0xF6, 0x83, 0x8F, 0x2F, 0x9D, 0xDA, + 0x92, 0x4F, 0xDE, 0x4F, 0x6B, 0xAE, 0x57, 0xAA, 0xC7, 0x2D, 0xA5, 0x5B, 0x1D, 0x95, 0x66, 0x52, + 0xC4, 0xD5, 0x71, 0xAD, 0x8E, 0x84, 0xEB, 0x53, 0x57, 0xB3, 0xF7, 0x7D, 0xE5, 0xCB, 0xAD, 0xEC, + 0xE3, 0x64, 0xD2, 0x56, 0xB6, 0x97, 0xE8, 0x72, 0x97, 0xBA, 0x67, 0x89, 0x75, 0x0F, 0x1D, 0xCF, + 0xA7, 0x69, 0x1F, 0x10, 0xA7, 0xD4, 0x7C, 0x0B, 0xF0, 0xC7, 0x52, 0x97, 0x51, 0xD4, 0xEC, 0x9E, + 0x45, 0xB7, 0xD0, 0xB4, 0xE9, 0xDB, 0x4F, 0x8D, 0xAF, 0x65, 0xD2, 0xC1, 0x20, 0xCD, 0x3E, 0x64, + 0x85, 0x70, 0xEA, 0x99, 0x65, 0x70, 0x31, 0xB2, 0xB6, 0xA9, 0x4B, 0x0E, 0xF8, 0x8D, 0xE3, 0xA5, + 0x89, 0xB6, 0x1A, 0x12, 0x54, 0x5B, 0x4B, 0xDD, 0x92, 0x94, 0x3D, 0xEB, 0x45, 0xA4, 0xF9, 0x93, + 0x71, 0x5A, 0x49, 0x2B, 0x26, 0xBD, 0x7A, 0x28, 0x61, 0xAA, 0x61, 0xF8, 0x62, 0x3C, 0x2D, 0xEC, + 0x5F, 0xD6, 0x55, 0x27, 0x89, 0x4D, 0x5A, 0xF1, 0xB4, 0xD7, 0x2E, 0x8D, 0x26, 0xA3, 0x64, 0xEC, + 0x97, 0x4B, 0x3B, 0x7B, 0xC7, 0x90, 0x6B, 0xDF, 0x12, 0x7C, 0x65, 0x67, 0x2F, 0x8D, 0x3E, 0x25, + 0xE9, 0xDE, 0x29, 0xF1, 0x44, 0x1E, 0x3B, 0xF1, 0xF7, 0x8A, 0xDF, 0xC3, 0x9E, 0x1F, 0xD5, 0x46, + 0x82, 0xD7, 0xF1, 0x78, 0x8B, 0x4D, 0xB5, 0x1E, 0x4D, 0xC2, 0xDB, 0xEA, 0x12, 0x02, 0xB1, 0xB8, + 0x72, 0xB9, 0x58, 0x81, 0x24, 0x90, 0x32, 0x31, 0x5F, 0x35, 0x9D, 0x4D, 0x61, 0xE8, 0xCF, 0x19, + 0x42, 0xBD, 0xA5, 0x56, 0xB7, 0xB3, 0xA7, 0x69, 0xDA, 0x51, 0x8D, 0x3B, 0x41, 0xB7, 0x1D, 0x13, + 0x4D, 0xA6, 0xEE, 0xF6, 0xBA, 0xD8, 0xFB, 0xFC, 0x8E, 0x86, 0x61, 0x18, 0x61, 0xDE, 0x2E, 0x3F, + 0xB9, 0xF6, 0x4A, 0x53, 0x52, 0x8A, 0x8A, 0x95, 0x49, 0xFB, 0xD7, 0x69, 0x6F, 0xCA, 0xB9, 0x52, + 0x8B, 0xD1, 0x2D, 0xDB, 0xD8, 0xF3, 0xCF, 0x0C, 0x4D, 0xE3, 0xEF, 0x10, 0x69, 0xAD, 0xFB, 0x3F, + 0xFF, 0x00, 0xC2, 0x47, 0xA3, 0x68, 0x9E, 0x0E, 0xB8, 0xF1, 0x18, 0xF8, 0x85, 0xE2, 0x1B, 0x7D, + 0x4A, 0xCA, 0x3D, 0x3C, 0x58, 0xEA, 0x16, 0xD6, 0x8D, 0x1C, 0x93, 0x5C, 0xCD, 0x2C, 0x71, 0xDC, + 0x34, 0xD1, 0xC0, 0xCE, 0x8B, 0x0E, 0xF0, 0xAC, 0xC1, 0x07, 0x7D, 0xC3, 0xE6, 0x2B, 0xE5, 0xD8, + 0x88, 0x4D, 0x65, 0x14, 0xF1, 0x2A, 0x74, 0x6D, 0x19, 0xBE, 0x5E, 0x55, 0x14, 0xDF, 0xBA, 0xDC, + 0x92, 0x92, 0x5C, 0xD1, 0x82, 0x6E, 0xF6, 0xBB, 0xD3, 0x99, 0x2E, 0x9E, 0xE3, 0xC5, 0x61, 0x1C, + 0x63, 0x98, 0x4E, 0x16, 0x9F, 0xC2, 0xA5, 0x65, 0x77, 0x1D, 0x25, 0xA5, 0xAE, 0xB9, 0x7A, 0xDB, + 0xA2, 0x4E, 0xCB, 0x44, 0x64, 0x7C, 0x51, 0xF8, 0xA1, 0xE2, 0xFF, 0x00, 0x18, 0x6A, 0x57, 0xB3, + 0xEB, 0xDE, 0x2C, 0x3E, 0x26, 0x9A, 0xF3, 0x4E, 0xB5, 0xD0, 0x56, 0xFA, 0x3D, 0x1A, 0xDB, 0x45, + 0x82, 0x7D, 0x33, 0x4F, 0x8C, 0x47, 0xA7, 0xA9, 0xB5, 0x8D, 0x17, 0xC9, 0x72, 0x88, 0x8E, 0x40, + 0xE4, 0xE7, 0xE6, 0x27, 0x15, 0xEC, 0x67, 0x38, 0x99, 0x64, 0xDC, 0x3F, 0x2C, 0xB3, 0x0D, 0x56, + 0xA2, 0xAD, 0x5A, 0x56, 0xA8, 0xAC, 0xD5, 0x35, 0x4D, 0x26, 0xE3, 0x14, 0xAE, 0xA2, 0xD4, 0x9A, + 0x53, 0x8B, 0xE5, 0xBD, 0x9B, 0xBD, 0xB4, 0x3B, 0x70, 0xB3, 0xC2, 0xD7, 0x85, 0xA3, 0x09, 0x5E, + 0x32, 0x96, 0xFA, 0x45, 0xED, 0xAA, 0xB5, 0xA4, 0xEC, 0xD7, 0x5F, 0x77, 0x4D, 0xAF, 0x73, 0xC4, + 0xEB, 0xF3, 0x83, 0xB8, 0x28, 0x00, 0xA0, 0x0D, 0x2D, 0x3E, 0xCC, 0xCC, 0xEA, 0xC4, 0x61, 0x06, + 0x30, 0x00, 0xED, 0x8E, 0x98, 0xFC, 0xAB, 0xF5, 0xFF, 0x00, 0x0C, 0x38, 0x22, 0xB6, 0x77, 0x8D, + 0x86, 0x3E, 0xBC, 0x3F, 0x74, 0x9E, 0x9B, 0xDE, 0xD6, 0x69, 0xDD, 0x5A, 0xD6, 0x7A, 0x59, 0xEA, + 0x9F, 0x63, 0xCD, 0xC6, 0xE2, 0x55, 0x38, 0xF2, 0x44, 0xEF, 0x2D, 0x2D, 0x44, 0x30, 0xAF, 0x0A, + 0x00, 0x51, 0x81, 0xD3, 0x00, 0x0E, 0x9D, 0x3D, 0x85, 0x7F, 0xA3, 0x3C, 0x19, 0xC2, 0x94, 0xB2, + 0x4C, 0x96, 0x9C, 0xDA, 0x49, 0x72, 0xAD, 0x2F, 0x6D, 0x3B, 0x3D, 0x17, 0xF9, 0x5F, 0x6D, 0x34, + 0x3E, 0x4A, 0xBD, 0x67, 0x52, 0x6E, 0xDB, 0x7F, 0x5B, 0x0D, 0x5B, 0xB8, 0x1E, 0xE3, 0xEC, 0x8A, + 0x58, 0xCD, 0x8C, 0x85, 0x08, 0x42, 0xED, 0x1D, 0xC1, 0xF4, 0x18, 0x15, 0xE7, 0x61, 0x78, 0xD3, + 0x20, 0xC6, 0x71, 0x43, 0xE0, 0xEC, 0x2D, 0x49, 0xCB, 0x1E, 0x95, 0xD4, 0x55, 0x39, 0xF2, 0xB8, + 0x68, 0xB9, 0xD4, 0xAD, 0x6E, 0x58, 0xBD, 0x1B, 0x76, 0x69, 0xD9, 0x5B, 0x44, 0x5B, 0xC3, 0xD5, + 0x8D, 0x05, 0x5D, 0xC5, 0x72, 0x7A, 0xAF, 0xBA, 0xC2, 0xDD, 0x5B, 0x19, 0x51, 0x36, 0x90, 0x92, + 0xC0, 0xDB, 0xAD, 0x88, 0x05, 0x7E, 0x60, 0x39, 0x03, 0x8E, 0x84, 0x0C, 0x1A, 0xDB, 0x8C, 0xB8, + 0x67, 0x11, 0x9D, 0x60, 0x29, 0xCF, 0x05, 0x35, 0x1C, 0x7E, 0x12, 0x4E, 0x78, 0x49, 0x3B, 0xC5, + 0x7B, 0x5B, 0x5D, 0xA4, 0xF9, 0x79, 0x9C, 0x26, 0x93, 0x84, 0xDA, 0x4B, 0xDD, 0x6D, 0x59, 0xDD, + 0x35, 0x38, 0x7A, 0xCA, 0x93, 0x69, 0xAF, 0x71, 0xA4, 0xA4, 0xBC, 0xBF, 0x2D, 0x37, 0x5F, 0xF0, + 0x09, 0xED, 0xC2, 0xDC, 0x5B, 0x3D, 0xCC, 0x40, 0xF9, 0x51, 0x5C, 0x7D, 0x9D, 0xD2, 0x45, 0x54, + 0x96, 0x16, 0x2A, 0x70, 0x85, 0x41, 0x38, 0xE1, 0x73, 0xC6, 0x6B, 0x5E, 0x0C, 0xCD, 0xE8, 0xF1, + 0x4E, 0x4B, 0xF5, 0xCA, 0xA9, 0x47, 0x13, 0x4E, 0x6E, 0x15, 0xE9, 0x34, 0x93, 0xA1, 0x56, 0x3A, + 0x4E, 0x92, 0x4D, 0xBF, 0x72, 0xEF, 0x9A, 0x0D, 0xFC, 0x51, 0xE5, 0x6D, 0x2D, 0x82, 0xA6, 0x1E, + 0xB5, 0x18, 0x2A, 0x92, 0x4B, 0x97, 0x44, 0x9A, 0xD9, 0xDD, 0x5D, 0x5B, 0x44, 0xF6, 0x5D, 0x95, + 0x85, 0xDA, 0x00, 0xC7, 0x1C, 0x0E, 0x30, 0xA0, 0x0E, 0x07, 0x61, 0xF9, 0x57, 0xD2, 0x4B, 0x09, + 0x04, 0x9C, 0x16, 0xF6, 0xD3, 0xDD, 0x56, 0xEC, 0xAF, 0x65, 0x75, 0xD2, 0xDF, 0x86, 0x9A, 0x18, + 0x29, 0x2D, 0x34, 0xD0, 0x85, 0x94, 0xE0, 0x01, 0x80, 0x31, 0xC7, 0x18, 0xE9, 0xED, 0x5E, 0x16, + 0x27, 0x0D, 0x38, 0xB5, 0x1D, 0x2D, 0x6F, 0xCB, 0xCA, 0xC9, 0xA5, 0xD1, 0x5D, 0x2D, 0x8D, 0x15, + 0xAC, 0xAC, 0x57, 0x65, 0xE3, 0x6F, 0x03, 0x18, 0x03, 0x18, 0xC7, 0x03, 0x80, 0x05, 0x78, 0x38, + 0xAC, 0x3C, 0xE4, 0xDD, 0x9A, 0xD2, 0xDF, 0x87, 0xF5, 0xFE, 0x66, 0xB0, 0x69, 0x25, 0x1B, 0x11, + 0xAA, 0x80, 0x55, 0x5F, 0x21, 0x08, 0xC1, 0xDA, 0x07, 0x1C, 0x71, 0x81, 0x5E, 0x5C, 0x28, 0x51, + 0xA9, 0x5E, 0x34, 0xF1, 0xB7, 0xFA, 0xBB, 0x8B, 0x52, 0xE5, 0xB3, 0x69, 0xE9, 0x6D, 0x2E, 0xBF, + 0x35, 0xE5, 0xD8, 0xBD, 0x54, 0x7D, 0xD5, 0xAE, 0x96, 0x3B, 0x1F, 0x82, 0xB2, 0xDB, 0x78, 0x77, + 0xE3, 0x67, 0xC3, 0xAD, 0x4A, 0xE8, 0xC6, 0xB6, 0x2B, 0xE2, 0x58, 0x11, 0xDD, 0xC1, 0x2B, 0x1F, + 0x9A, 0x0C, 0x6A, 0x48, 0xED, 0xCB, 0xAE, 0x2B, 0xF8, 0xB3, 0xC5, 0x4E, 0x00, 0xAD, 0xC2, 0x3C, + 0x4F, 0x2C, 0xC3, 0x0B, 0x14, 0xF0, 0x75, 0x6E, 0xD3, 0xBB, 0xBA, 0x6E, 0xEB, 0x54, 0xD2, 0x4A, + 0xF7, 0x56, 0x49, 0xBB, 0xED, 0xA5, 0xCF, 0x6E, 0x96, 0x25, 0x62, 0x70, 0x2E, 0x9B, 0xF8, 0x95, + 0xB6, 0xF2, 0xB7, 0xF9, 0x7D, 0xC7, 0xF5, 0xEF, 0xFB, 0x3B, 0x5E, 0xDB, 0xDC, 0x78, 0x5A, 0xE1, + 0x22, 0xC1, 0x92, 0x29, 0x99, 0x99, 0x55, 0x81, 0x21, 0x5D, 0x03, 0x29, 0x1F, 0x86, 0xEF, 0xCA, + 0xAB, 0x1A, 0xD5, 0x4A, 0x14, 0x2A, 0x53, 0xB7, 0x27, 0x2C, 0x52, 0xB7, 0x6D, 0x7F, 0xCF, 0xA2, + 0xED, 0xB1, 0xF1, 0x39, 0x74, 0x3D, 0x9E, 0x26, 0xB5, 0x1B, 0x6A, 0x9E, 0xD6, 0xE9, 0xAB, 0xD5, + 0x2B, 0x77, 0xD3, 0xAF, 0x4B, 0x1C, 0x05, 0x8E, 0xA9, 0x6D, 0xAB, 0xFE, 0xD1, 0xB7, 0xF6, 0xDA, + 0xEC, 0xAB, 0x6E, 0xBA, 0x26, 0x99, 0xFF, 0x00, 0x12, 0x98, 0x6E, 0x58, 0x2C, 0x79, 0x60, 0x7C, + 0xD7, 0x4C, 0xF1, 0xC6, 0x3A, 0x8C, 0x71, 0xF8, 0xE3, 0xE9, 0xEA, 0x52, 0x95, 0x0E, 0x18, 0x82, + 0xC3, 0xC5, 0x5E, 0x56, 0x6E, 0xC9, 0x3D, 0xDB, 0x4B, 0x6D, 0x74, 0xB2, 0x5D, 0x12, 0xD2, 0xD6, + 0xE6, 0x57, 0xF0, 0x29, 0xA5, 0x57, 0x3B, 0x75, 0x6B, 0xA4, 0xA2, 0x9D, 0x97, 0x6D, 0x6D, 0x65, + 0xAE, 0x8A, 0xED, 0xDB, 0x6D, 0xD2, 0xE8, 0x8F, 0x55, 0xF8, 0xED, 0xE3, 0x99, 0xF4, 0x5F, 0x01, + 0xEB, 0x3F, 0xF0, 0x8E, 0xA7, 0xDA, 0x6E, 0xBE, 0xCA, 0xF0, 0x97, 0x83, 0x2B, 0x14, 0x4B, 0xE5, + 0x9D, 0xCF, 0xB8, 0x60, 0x00, 0x14, 0x37, 0x42, 0x0E, 0x07, 0xD3, 0x3E, 0x37, 0x0D, 0xE5, 0xF1, + 0xAB, 0x8F, 0x8C, 0xB1, 0x09, 0x5A, 0x29, 0xB4, 0x9D, 0xB5, 0x6A, 0xD6, 0x8B, 0xD1, 0xEE, 0xED, + 0x75, 0x67, 0xA2, 0x6A, 0xD6, 0xBD, 0xBD, 0x6C, 0xF7, 0x1F, 0x1F, 0xAA, 0x2A, 0x34, 0x5F, 0xBA, + 0xDA, 0x4D, 0xAD, 0x92, 0xBA, 0x4E, 0xDE, 0x89, 0xBB, 0x5F, 0x7B, 0x58, 0xCF, 0xF8, 0x09, 0x06, + 0x9F, 0xE1, 0xCF, 0x85, 0xDA, 0x4D, 0xDC, 0xD7, 0x11, 0xBC, 0xF7, 0x96, 0xBF, 0x6D, 0xB8, 0x55, + 0x3F, 0xBC, 0x92, 0x59, 0x57, 0x73, 0x80, 0x3A, 0x82, 0x49, 0x1F, 0x87, 0xD2, 0xAB, 0x88, 0x1D, + 0x7C, 0x4E, 0x69, 0x2A, 0x7C, 0xBB, 0x5A, 0x2A, 0xC9, 0x6D, 0x1B, 0x25, 0xA2, 0xD3, 0x4F, 0xF2, + 0x23, 0x24, 0x74, 0x70, 0xB8, 0x09, 0x55, 0x6D, 0x5D, 0xBB, 0x25, 0xBB, 0x69, 0x6C, 0xB4, 0xF2, + 0xB6, 0xB6, 0x49, 0x2D, 0x16, 0x8B, 0x5D, 0x0D, 0x4E, 0x64, 0xB0, 0xD0, 0x7C, 0x4F, 0xE2, 0x6D, + 0x61, 0xD2, 0xC9, 0xB5, 0x0B, 0x49, 0x2D, 0xED, 0x55, 0xBE, 0x51, 0xE5, 0x91, 0x84, 0x61, 0x81, + 0xC8, 0xEA, 0x40, 0xF4, 0x1D, 0x38, 0xC9, 0xF3, 0xF1, 0xD2, 0xA7, 0x0C, 0x2C, 0x70, 0xB4, 0xBE, + 0x18, 0xA6, 0xDB, 0x5A, 0xDB, 0x7B, 0xA5, 0xB6, 0x89, 0x25, 0xB5, 0x93, 0xB2, 0xB3, 0x6D, 0xA4, + 0xBB, 0x32, 0xE8, 0xC7, 0xEB, 0x2F, 0x17, 0x57, 0xAB, 0xD1, 0x77, 0x49, 0xDD, 0xEB, 0x64, 0xAD, + 0x7D, 0x2F, 0x6B, 0x7A, 0xD9, 0x5B, 0xF9, 0xB6, 0xF0, 0x4E, 0xB1, 0x69, 0xAE, 0x7F, 0xC1, 0x57, + 0xFF, 0x00, 0x67, 0xEB, 0xDB, 0x22, 0x8D, 0x6E, 0x9F, 0xB5, 0xAF, 0xC3, 0x6B, 0x30, 0xD1, 0x8C, + 0x29, 0x68, 0x3C, 0x41, 0xA5, 0xA4, 0x98, 0xFA, 0x32, 0xB0, 0xFA, 0x01, 0x5F, 0x93, 0xCE, 0x7C, + 0xD9, 0xDD, 0x08, 0xD9, 0x69, 0x38, 0x6C, 0xD3, 0xDE, 0x5C, 0xDD, 0x3B, 0x5E, 0xD6, 0xF2, 0x3F, + 0x40, 0xA3, 0x15, 0x1C, 0xB2, 0x7F, 0xE1, 0x97, 0x4B, 0x2D, 0xAC, 0xAD, 0xE5, 0x64, 0xAC, 0x7F, + 0x70, 0xF5, 0xFA, 0x09, 0xF3, 0x41, 0x40, 0x05, 0x00, 0x14, 0x01, 0xFC, 0x57, 0xFF, 0x00, 0xC1, + 0x6A, 0x13, 0x3F, 0xB7, 0xF7, 0xC4, 0xA3, 0x81, 0x81, 0xE0, 0xEF, 0x0A, 0x0C, 0x60, 0x60, 0x81, + 0xE1, 0xDB, 0x4E, 0x31, 0x51, 0x43, 0x06, 0xAB, 0xE1, 0xF1, 0x13, 0x49, 0x59, 0x4E, 0xD6, 0x7B, + 0x35, 0xEC, 0xE9, 0x3B, 0x5B, 0xFE, 0x07, 0x6D, 0xB4, 0x3D, 0xBC, 0x13, 0x51, 0xA1, 0x05, 0xD2, + 0xCF, 0xF3, 0x67, 0xE5, 0xA6, 0x8F, 0xE2, 0x3F, 0x11, 0xF8, 0x5C, 0xDC, 0xB6, 0x81, 0xAC, 0x5F, + 0xE9, 0x49, 0x78, 0xAA, 0xB7, 0x71, 0x59, 0xCE, 0xD1, 0x41, 0x72, 0x10, 0xE5, 0x04, 0x91, 0x7D, + 0xC6, 0xDA, 0x49, 0xC1, 0x20, 0xE3, 0x9C, 0x63, 0x35, 0xF2, 0x35, 0xF0, 0x99, 0xAE, 0x49, 0x5E, + 0x59, 0x8E, 0x5F, 0x2E, 0x58, 0x6A, 0xEC, 0x92, 0x56, 0x4F, 0xA7, 0x2B, 0x5C, 0xAD, 0x74, 0xD3, + 0xA7, 0x44, 0x8D, 0xF1, 0x78, 0x0C, 0xBB, 0x36, 0xC3, 0xAC, 0x26, 0x61, 0x49, 0x4E, 0x1A, 0x68, + 0xFC, 0xB6, 0xD5, 0x59, 0xAF, 0xC8, 0xFA, 0x7E, 0x1F, 0xDB, 0x7B, 0xE3, 0x47, 0xFC, 0x22, 0x71, + 0x78, 0x4A, 0xEE, 0xEB, 0x47, 0xB9, 0x86, 0x2B, 0x61, 0x68, 0x35, 0x56, 0xB0, 0x23, 0x50, 0xD8, + 0x17, 0x01, 0x8A, 0x86, 0x11, 0x96, 0xC7, 0x70, 0xA3, 0xA0, 0xE9, 0x8A, 0x30, 0x3C, 0x45, 0x81, + 0x85, 0x78, 0xD6, 0xC6, 0xE1, 0x17, 0x36, 0x97, 0x70, 0x6D, 0x2F, 0x5E, 0x47, 0x75, 0xF2, 0xBA, + 0x8F, 0x68, 0xA5, 0x64, 0x79, 0x15, 0xB8, 0x5A, 0x53, 0xA4, 0xF0, 0xD4, 0xB1, 0x73, 0x54, 0x76, + 0x51, 0x7C, 0xAD, 0xA5, 0xFC, 0xAA, 0x5C, 0xB7, 0x49, 0x6C, 0x9D, 0x9C, 0x92, 0xFB, 0x4C, 0xFD, + 0x1C, 0xF8, 0x45, 0xFB, 0x5E, 0x7C, 0x0F, 0x4F, 0x84, 0xFA, 0x76, 0x8B, 0x7B, 0xF1, 0x0E, 0xD7, + 0x4A, 0xF1, 0x3D, 0x9E, 0x8C, 0x2D, 0xEE, 0x6D, 0x75, 0xFB, 0x19, 0x74, 0xD7, 0x69, 0xF6, 0x00, + 0xD8, 0x91, 0x97, 0xCB, 0x60, 0x4A, 0xB1, 0xC8, 0x73, 0xD4, 0x7B, 0x01, 0x38, 0xAC, 0x5E, 0x0F, + 0x1D, 0x9A, 0xBA, 0xB4, 0x26, 0x95, 0x39, 0x49, 0x5A, 0xEF, 0x95, 0x25, 0xBF, 0x5D, 0x15, 0xBE, + 0xE5, 0xB2, 0xD8, 0xE6, 0xC1, 0x60, 0x31, 0xF9, 0x5E, 0x49, 0x1A, 0x15, 0x20, 0xDD, 0x48, 0x45, + 0xAD, 0x13, 0x9D, 0xDF, 0xD9, 0xB2, 0x5A, 0xBE, 0x9D, 0x13, 0xB2, 0xBB, 0x3F, 0x3B, 0xFE, 0x26, + 0xFE, 0xD6, 0x3F, 0x12, 0xBC, 0x44, 0xFA, 0xA7, 0x85, 0xE1, 0xD7, 0x34, 0x75, 0xD0, 0x04, 0x86, + 0xDC, 0x5C, 0x68, 0x31, 0x18, 0x86, 0xA1, 0x0F, 0x50, 0x4C, 0x9B, 0xDB, 0x83, 0x91, 0x90, 0x0E, + 0x32, 0x3D, 0x00, 0xAF, 0xD4, 0xB8, 0x7F, 0x31, 0xE1, 0xBC, 0x9F, 0x1A, 0xAA, 0x42, 0x74, 0xEA, + 0x46, 0xCF, 0x69, 0xC5, 0xC9, 0x74, 0xD1, 0xA9, 0x2B, 0x5B, 0xD3, 0xB7, 0x91, 0xE6, 0xE0, 0xF2, + 0x1A, 0xB9, 0xA6, 0x06, 0x8D, 0x6C, 0xD2, 0x55, 0x15, 0xD5, 0xDD, 0x27, 0x15, 0x08, 0xDF, 0xFB, + 0xC9, 0x25, 0x26, 0xBA, 0xA8, 0xB7, 0x6B, 0x5A, 0xEA, 0xE8, 0xFB, 0x6F, 0xFE, 0x09, 0xE5, 0xFB, + 0x71, 0x5C, 0x78, 0x1E, 0x3B, 0x9F, 0xD9, 0xF3, 0xE2, 0x96, 0xAE, 0x8F, 0xF0, 0xE7, 0xC6, 0x5B, + 0xEC, 0xFC, 0x37, 0xAC, 0x6A, 0x72, 0x41, 0x1E, 0x9F, 0xE1, 0x6B, 0xAB, 0x95, 0x0B, 0x25, 0xBD, + 0xD4, 0xAE, 0x54, 0xA5, 0xAC, 0xA1, 0x54, 0x6E, 0x42, 0x5D, 0x19, 0x50, 0x26, 0x37, 0x57, 0xEB, + 0xD9, 0xAD, 0x0A, 0x59, 0x9E, 0x1A, 0x86, 0x69, 0x93, 0x61, 0xD5, 0x47, 0xA2, 0x94, 0x14, 0xAF, + 0x4E, 0x31, 0x76, 0x76, 0x94, 0x55, 0xD4, 0x93, 0x69, 0x6A, 0xEE, 0xA3, 0x76, 0xEC, 0xEE, 0x63, + 0x98, 0x64, 0xB5, 0xE9, 0xFE, 0xF3, 0x2F, 0xAA, 0xE9, 0xB5, 0x6B, 0xA4, 0xF5, 0xD3, 0x4F, 0x71, + 0xB4, 0xF9, 0x5D, 0xB7, 0xB5, 0xAE, 0x95, 0xAF, 0xA2, 0x47, 0x29, 0xFB, 0x5C, 0x58, 0xFC, 0x70, + 0xF8, 0x2B, 0xE3, 0x2D, 0x53, 0xC3, 0x17, 0xBA, 0xC9, 0xBD, 0xF0, 0x0F, 0x8E, 0x21, 0x96, 0xF3, + 0xC1, 0xFE, 0x2B, 0x48, 0x5A, 0x18, 0x35, 0x0B, 0x47, 0x53, 0xE6, 0x59, 0xCB, 0x70, 0x42, 0xC4, + 0x97, 0x11, 0x82, 0x55, 0xA3, 0x19, 0x60, 0x3C, 0xB2, 0x79, 0x3C, 0x7F, 0x56, 0xF8, 0x39, 0x9B, + 0x70, 0x7F, 0x11, 0xE0, 0x29, 0xE1, 0xEB, 0xD0, 0x70, 0xC7, 0xD0, 0x8A, 0x4A, 0x2D, 0xA4, 0xAF, + 0x0E, 0x55, 0x75, 0x14, 0xDC, 0x9A, 0x49, 0xDA, 0xEA, 0xE9, 0x3B, 0xC6, 0xD6, 0x52, 0x3E, 0x46, + 0x9E, 0x4F, 0x85, 0xAD, 0x07, 0x5E, 0xBC, 0xEA, 0x49, 0x42, 0x49, 0x4A, 0x37, 0xBC, 0x5B, 0x4D, + 0x35, 0x65, 0x14, 0xEE, 0x96, 0x97, 0x49, 0xD9, 0xA5, 0xAA, 0x4A, 0xE9, 0x78, 0x0F, 0xC0, 0x9F, + 0x8D, 0xDA, 0x9F, 0xC3, 0x9D, 0x4A, 0x1D, 0x27, 0x54, 0x9A, 0x75, 0xF0, 0x3E, 0xAC, 0x1B, 0x4D, + 0xD6, 0x11, 0x11, 0xA4, 0xFB, 0x11, 0x96, 0x3F, 0xDD, 0x5C, 0x42, 0x72, 0x0A, 0x6C, 0x71, 0x1B, + 0xB0, 0x5C, 0x92, 0x37, 0xED, 0xC6, 0x40, 0x1F, 0xA2, 0xF1, 0xA7, 0x07, 0xAC, 0xFB, 0x29, 0xAB, + 0x89, 0xC3, 0x5D, 0x62, 0xD4, 0x95, 0xB9, 0x6D, 0x05, 0x28, 0xAB, 0x3F, 0x3B, 0x38, 0xE9, 0xEF, + 0x24, 0xBA, 0x5D, 0xDD, 0x24, 0xFE, 0x8B, 0x27, 0xCB, 0xB2, 0xAA, 0x1C, 0x43, 0x4F, 0x34, 0xC4, + 0x49, 0xA9, 0x24, 0xD5, 0x93, 0x4A, 0x2D, 0x35, 0xCA, 0xD4, 0xD2, 0xB2, 0x69, 0xC5, 0xCA, 0x0B, + 0x58, 0xA4, 0x9A, 0xE6, 0xBA, 0x4E, 0xFF, 0x00, 0x44, 0xEA, 0xFE, 0x1F, 0xD6, 0xB5, 0xAB, 0x39, + 0x3C, 0x15, 0x03, 0xCB, 0xE2, 0x45, 0xBB, 0xBD, 0x86, 0xDB, 0x48, 0x83, 0x46, 0xD3, 0xA1, 0xBA, + 0x9B, 0xC4, 0x91, 0xDE, 0xB1, 0x16, 0x33, 0xD9, 0xDB, 0xA4, 0x66, 0x49, 0xAE, 0xD8, 0x90, 0xA6, + 0x14, 0x04, 0xE3, 0x7F, 0x3C, 0x82, 0xBF, 0x81, 0x67, 0xB9, 0x27, 0x0F, 0xF1, 0x64, 0x23, 0x53, + 0x88, 0xE8, 0x5A, 0xBE, 0x19, 0x27, 0x26, 0xE5, 0x38, 0xB8, 0xC5, 0x5A, 0xD5, 0x3D, 0xD9, 0x59, + 0x28, 0x36, 0xB9, 0xE4, 0xD2, 0xE9, 0xCB, 0xA6, 0x8F, 0xF5, 0xEE, 0x17, 0xC5, 0x65, 0xDC, 0x25, + 0x98, 0xC7, 0x01, 0x86, 0x9C, 0x5E, 0x51, 0x8D, 0x8C, 0xD6, 0x12, 0x52, 0x9C, 0xA7, 0x1A, 0x35, + 0x54, 0x3F, 0x7D, 0x86, 0xAB, 0x27, 0x2B, 0x46, 0x9C, 0x93, 0xE7, 0xA0, 0xDB, 0xD5, 0xFB, 0xBB, + 0xE8, 0xBF, 0x4D, 0xF4, 0xEF, 0x02, 0x78, 0x33, 0xF6, 0x33, 0xF0, 0x96, 0x9F, 0xAD, 0xFE, 0xD2, + 0xB6, 0xB3, 0xFC, 0x41, 0xF8, 0xFD, 0xA9, 0x68, 0x16, 0x5A, 0xFF, 0x00, 0x81, 0xBF, 0x64, 0x9F, + 0x0F, 0xEB, 0xE2, 0x6F, 0x0E, 0xF8, 0x11, 0x9A, 0xD5, 0x4D, 0xBD, 0xEF, 0xC5, 0x3B, 0xFB, 0x73, + 0x14, 0xD6, 0xEC, 0x42, 0x89, 0x17, 0x4B, 0xB2, 0x91, 0xA4, 0x7C, 0x91, 0x2C, 0x91, 0xA3, 0x97, + 0x5F, 0xCE, 0xA8, 0xE3, 0x31, 0xDC, 0x53, 0x8C, 0x79, 0x3F, 0x08, 0x46, 0x54, 0xB2, 0x8E, 0x69, + 0x52, 0xA9, 0x8A, 0x9C, 0x64, 0xE5, 0x56, 0x2D, 0xD9, 0xFD, 0x56, 0x13, 0x72, 0x5C, 0x89, 0x2B, + 0x73, 0x4D, 0x5A, 0x2E, 0xDC, 0xA9, 0xC9, 0x28, 0x2D, 0x23, 0x95, 0x53, 0xE2, 0xDC, 0x16, 0x19, + 0xC2, 0x11, 0x84, 0xA1, 0x18, 0x37, 0x5D, 0xC6, 0x50, 0x92, 0x9C, 0x56, 0xAA, 0x92, 0x52, 0xBD, + 0x93, 0x76, 0x69, 0xB5, 0x78, 0x37, 0x16, 0x95, 0xD2, 0x7F, 0x0A, 0x78, 0xA7, 0xF6, 0xC4, 0xFD, + 0xA3, 0x3E, 0x3E, 0xFC, 0x4A, 0xB9, 0xF1, 0x6F, 0xC5, 0x8F, 0x15, 0x4F, 0x34, 0xBA, 0x7E, 0x94, + 0x74, 0x6D, 0x03, 0xC2, 0xF6, 0x1A, 0x6C, 0x5A, 0x17, 0xC3, 0x5F, 0x07, 0x5B, 0x43, 0x13, 0x95, + 0xB7, 0xF0, 0xF6, 0x8F, 0x1A, 0xA5, 0xB5, 0x8D, 0xB0, 0x58, 0xA3, 0x5D, 0xB1, 0x2F, 0x23, 0x2C, + 0xE5, 0xD8, 0x92, 0x7F, 0x48, 0xAB, 0xC0, 0x1C, 0x39, 0xC3, 0x39, 0x05, 0x0C, 0x26, 0x43, 0x49, + 0x4E, 0xD2, 0xE6, 0x72, 0x76, 0x9D, 0x4A, 0x8E, 0x52, 0x49, 0x3A, 0xB3, 0x51, 0x52, 0x72, 0xD7, + 0x45, 0x15, 0x14, 0x94, 0x7D, 0xD4, 0x91, 0xF5, 0xB8, 0x3E, 0x1B, 0xCA, 0xE9, 0xE1, 0xEA, 0xC2, + 0x58, 0x5F, 0x67, 0x51, 0x72, 0x27, 0x24, 0xE5, 0x79, 0x3B, 0xEA, 0xD4, 0xBA, 0xC5, 0xBB, 0x3B, + 0x74, 0xD1, 0x5D, 0x6A, 0x72, 0xFE, 0x2D, 0x5B, 0xAF, 0x18, 0xDB, 0x5C, 0x26, 0xB7, 0x70, 0x2E, + 0x65, 0x11, 0x18, 0xE2, 0x9E, 0x48, 0x55, 0x7C, 0xA2, 0xC3, 0x00, 0xAC, 0x6B, 0xD4, 0x1E, 0x0B, + 0x0C, 0xF2, 0x14, 0x7C, 0xC7, 0x68, 0x0D, 0xE6, 0xE0, 0xA1, 0x98, 0x60, 0x67, 0x2A, 0xF8, 0x48, + 0xA8, 0x41, 0x24, 0x9A, 0x4A, 0x31, 0x56, 0x4B, 0xAB, 0x49, 0xB5, 0xDD, 0x5F, 0x4B, 0x3D, 0xA2, + 0xDE, 0x9E, 0xA6, 0x03, 0x0F, 0x85, 0xC0, 0x53, 0x78, 0x6A, 0x10, 0x5E, 0xCE, 0x57, 0xE6, 0x8D, + 0xDD, 0x9D, 0xF7, 0x57, 0xD1, 0xAF, 0x2E, 0xCD, 0xDD, 0x59, 0xBD, 0x35, 0x7E, 0x1D, 0x58, 0xF8, + 0xC5, 0x2C, 0x2C, 0xB4, 0x2F, 0x0F, 0xDD, 0xDC, 0x6A, 0x9A, 0xF4, 0xF7, 0x51, 0xE9, 0x3F, 0x65, + 0xD1, 0xA3, 0x92, 0xE7, 0x53, 0xBA, 0x62, 0x42, 0xDB, 0xC8, 0xA0, 0x80, 0x3E, 0x52, 0xB1, 0xC4, + 0x4E, 0x31, 0x80, 0xBC, 0x0C, 0x1D, 0xDE, 0x4E, 0x77, 0x8A, 0xA3, 0x8D, 0x6F, 0x13, 0x8D, 0xA6, + 0x92, 0x8F, 0xBB, 0x35, 0x6B, 0x4F, 0x91, 0xB4, 0xD3, 0x5E, 0xF5, 0x92, 0xE6, 0xD1, 0x7B, 0xAE, + 0xCD, 0xBB, 0xBB, 0x34, 0x71, 0xE3, 0x30, 0x79, 0x3E, 0x0F, 0x91, 0x72, 0xB8, 0xE1, 0xE0, 0xAF, + 0x1E, 0x76, 0xAC, 0x92, 0x4D, 0xB8, 0xBB, 0x6D, 0x7D, 0x64, 0xFA, 0xDF, 0x4D, 0x9D, 0x97, 0x55, + 0xE2, 0x26, 0xF8, 0x31, 0xF0, 0x36, 0x69, 0x65, 0xF8, 0xAA, 0xFA, 0x0F, 0xC4, 0x0F, 0x8A, 0x56, + 0x11, 0x08, 0x93, 0xC0, 0x3A, 0x4E, 0xBC, 0x66, 0xF0, 0x7F, 0x86, 0x67, 0x2A, 0x59, 0x9F, 0xC4, + 0x1A, 0x84, 0x33, 0xB3, 0x5D, 0x4C, 0x0E, 0xDC, 0xDA, 0xDA, 0xB4, 0x67, 0x3B, 0x43, 0xCC, 0xA4, + 0x61, 0x70, 0xC2, 0x70, 0xFF, 0x00, 0x1A, 0x71, 0x64, 0xA9, 0x43, 0x09, 0x87, 0x73, 0xA3, 0xAF, + 0x23, 0xB3, 0x8C, 0x54, 0x5D, 0x92, 0x72, 0xE6, 0x56, 0x8C, 0x6C, 0xEF, 0xAA, 0x9A, 0x6F, 0xDE, + 0x8C, 0x1A, 0x69, 0xBE, 0x4F, 0xED, 0x3A, 0xB5, 0xB0, 0xDC, 0xF4, 0x71, 0x0B, 0x0B, 0x81, 0x6F, + 0xF8, 0x93, 0xE5, 0x8C, 0xA6, 0x96, 0x96, 0xA5, 0x16, 0x97, 0x2A, 0xDD, 0x29, 0x34, 0xF4, 0xBF, + 0x2A, 0x6F, 0x43, 0xE5, 0xFF, 0x00, 0x88, 0x7F, 0xB5, 0x27, 0x89, 0xBC, 0x7D, 0x77, 0x65, 0x34, + 0xE9, 0xA3, 0x6A, 0x5A, 0x26, 0x9D, 0x1C, 0x92, 0xE9, 0x3E, 0x15, 0x69, 0xAC, 0xFC, 0x33, 0xE0, + 0x9D, 0x0D, 0x11, 0x76, 0x91, 0xA6, 0xE9, 0x7B, 0xC4, 0x36, 0xEE, 0x16, 0x38, 0xD5, 0x58, 0x46, + 0x5D, 0xC2, 0xFC, 0xC5, 0x8B, 0x02, 0x7E, 0xBF, 0x28, 0xF0, 0xBF, 0x13, 0x87, 0xA9, 0x4F, 0x11, + 0x98, 0x42, 0x1E, 0xC6, 0x17, 0x5C, 0xAA, 0x2D, 0xB5, 0xA6, 0xB2, 0xE6, 0x4F, 0x9A, 0xFE, 0xF2, + 0xB7, 0x3B, 0x94, 0x79, 0xAE, 0xD2, 0x5B, 0x2F, 0x9A, 0xC6, 0x71, 0xBF, 0x0D, 0x64, 0xB8, 0x79, + 0xE1, 0xB2, 0x58, 0x54, 0xAB, 0x89, 0x96, 0xF5, 0x2C, 0xFC, 0x9B, 0xE6, 0x95, 0x9C, 0xE4, 0x9F, + 0x44, 0x94, 0x15, 0xEC, 0xA2, 0xED, 0x1D, 0x3E, 0x6D, 0x4F, 0x1D, 0xF8, 0xF7, 0x46, 0xDF, 0x7F, + 0xA6, 0xF9, 0xBE, 0x75, 0xF2, 0x43, 0xA9, 0xC5, 0x79, 0x65, 0x2B, 0x4C, 0x96, 0xB6, 0xC0, 0x32, + 0xAC, 0x73, 0x24, 0x0D, 0xB7, 0x71, 0xE3, 0x21, 0xC9, 0x6E, 0x14, 0x10, 0x2B, 0xDF, 0x7C, 0x17, + 0x95, 0x52, 0xCB, 0x55, 0x18, 0xE1, 0xD4, 0xF9, 0x64, 0x9B, 0xE7, 0xB4, 0xA4, 0xA3, 0xBA, 0x57, + 0x85, 0x9B, 0x4B, 0x65, 0x18, 0xEF, 0xB7, 0x45, 0x6F, 0xCC, 0xF8, 0x8F, 0x3F, 0xC7, 0xF1, 0x6D, + 0x7A, 0x5F, 0xDB, 0xB8, 0xA4, 0xA3, 0x0B, 0xA8, 0xC2, 0x16, 0x84, 0x13, 0x49, 0x5F, 0x92, 0x2D, + 0xDA, 0xCA, 0xEE, 0xF7, 0x4E, 0x49, 0xBD, 0xED, 0xA3, 0xD3, 0xB8, 0xF8, 0x9B, 0xE3, 0xAD, 0x7A, + 0x0F, 0xB4, 0x78, 0x9B, 0xC3, 0x3E, 0x18, 0xD7, 0xB4, 0xF9, 0x40, 0xBB, 0x4B, 0x7F, 0x13, 0xC1, + 0x71, 0xA6, 0x69, 0xB7, 0xB1, 0x44, 0xE0, 0x14, 0x46, 0x5B, 0x98, 0x1E, 0x40, 0x19, 0x63, 0x18, + 0x49, 0x32, 0x30, 0x07, 0x7C, 0x57, 0x87, 0x5F, 0x87, 0x30, 0x38, 0x0C, 0x3C, 0x71, 0x34, 0x63, + 0x28, 0x7B, 0xCE, 0xEA, 0x29, 0xD9, 0x37, 0x6B, 0xF3, 0x26, 0x9C, 0xA2, 0x96, 0xBB, 0xC9, 0x2E, + 0x8D, 0x59, 0x34, 0x7C, 0x55, 0x3E, 0x1E, 0xC9, 0xBF, 0xB5, 0xFE, 0xB9, 0x84, 0xC5, 0x4E, 0x35, + 0xE3, 0x74, 0xF9, 0x25, 0x07, 0xCB, 0x75, 0x64, 0x9A, 0xE4, 0x6A, 0x29, 0x26, 0xEC, 0x9A, 0x49, + 0xEE, 0xEF, 0x66, 0x7A, 0x17, 0xC1, 0xAF, 0x89, 0x76, 0xDE, 0x0E, 0xBD, 0x9D, 0xF5, 0x3F, 0x0B, + 0xEA, 0x36, 0x76, 0x77, 0x17, 0x73, 0x4E, 0x90, 0xF8, 0x4A, 0x16, 0xD5, 0xB4, 0xDB, 0x48, 0xCB, + 0x99, 0x4A, 0x45, 0x08, 0x91, 0xE5, 0xF2, 0x91, 0x49, 0xC3, 0x16, 0x7C, 0x2A, 0x8F, 0x9F, 0x38, + 0xAF, 0x92, 0xE2, 0x0C, 0xA2, 0xA6, 0x3B, 0x08, 0xA5, 0x46, 0x50, 0x4E, 0xDC, 0xBE, 0xF3, 0x51, + 0x6E, 0xE9, 0x24, 0xAE, 0xD2, 0x4D, 0x5B, 0x5B, 0x5B, 0x7D, 0x34, 0x57, 0xB7, 0x3E, 0x2F, 0x27, + 0x9C, 0xF3, 0xB8, 0xE6, 0x18, 0x4C, 0x44, 0x65, 0x15, 0x1E, 0x49, 0x46, 0x52, 0x51, 0x9F, 0x32, + 0x4A, 0xD2, 0x7B, 0x29, 0x2B, 0xC7, 0x56, 0xAD, 0x66, 0xF4, 0x5D, 0x0F, 0xAD, 0xB4, 0x6F, 0xDA, + 0x1F, 0xE0, 0xE6, 0xA6, 0xA8, 0x57, 0xC6, 0x76, 0x16, 0x24, 0xC6, 0x18, 0x47, 0xAB, 0x23, 0xE9, + 0xC5, 0x01, 0xE8, 0x18, 0xB8, 0x03, 0x23, 0x03, 0x80, 0x4F, 0x6E, 0xD5, 0xF9, 0x1E, 0x6F, 0xC3, + 0x39, 0xD6, 0x1A, 0x8C, 0xB0, 0xEB, 0x0B, 0x68, 0xED, 0xEE, 0x24, 0xDE, 0xCB, 0x66, 0xB5, 0xB6, + 0x8A, 0xCF, 0xA3, 0xED, 0x64, 0x7B, 0xD0, 0xC3, 0xE2, 0x69, 0xB5, 0x1F, 0x66, 0xFB, 0x6C, 0xDE, + 0xB6, 0xD3, 0x6E, 0x8B, 0xBE, 0x8B, 0xA7, 0x4B, 0x1E, 0x9B, 0xA6, 0x78, 0xD3, 0xC1, 0x9A, 0xB2, + 0x07, 0xD3, 0x7C, 0x55, 0xE1, 0xEB, 0xD4, 0x61, 0x94, 0xFB, 0x36, 0xB1, 0x6E, 0xFC, 0x63, 0x8E, + 0x37, 0x7A, 0x02, 0x78, 0xF4, 0x3E, 0x95, 0xF9, 0xEE, 0x27, 0x2F, 0xC4, 0x61, 0xDA, 0x85, 0x4A, + 0x32, 0x8B, 0xBB, 0x5A, 0xC5, 0xAD, 0xBA, 0x3B, 0xA5, 0x6B, 0x5E, 0xDB, 0x5B, 0xA5, 0xDB, 0x45, + 0x29, 0x34, 0xD5, 0xB6, 0xDB, 0xCA, 0xFA, 0x5D, 0x2E, 0x9A, 0x5D, 0x2B, 0x74, 0x3E, 0x74, 0xFD, + 0xA6, 0x2C, 0xA6, 0xD5, 0xFC, 0x35, 0x77, 0x0E, 0x95, 0x17, 0xDB, 0x9E, 0x4D, 0x3E, 0x6B, 0x7C, + 0x59, 0xED, 0x98, 0xEE, 0x64, 0x01, 0x50, 0x10, 0x71, 0x92, 0x09, 0xFC, 0x05, 0x7B, 0x5C, 0x39, + 0x4E, 0x95, 0x4A, 0x55, 0x28, 0x4E, 0x56, 0x8E, 0x8D, 0xDB, 0x47, 0x65, 0x34, 0xAF, 0xDB, 0x45, + 0xE4, 0xF5, 0x69, 0x5B, 0xBF, 0xC8, 0xE6, 0xB5, 0x69, 0xE1, 0x78, 0x87, 0x2E, 0xC6, 0x57, 0x6A, + 0x34, 0xA1, 0x3F, 0x7A, 0x4F, 0xE1, 0x5F, 0x0D, 0xAF, 0xFF, 0x00, 0x80, 0xB4, 0xB6, 0xD5, 0x59, + 0x1A, 0x3F, 0xB2, 0xAD, 0xAE, 0xA6, 0x90, 0x68, 0x57, 0x1A, 0x9A, 0xEA, 0x3A, 0x66, 0xA1, 0x26, + 0x8B, 0x3D, 0xB6, 0xA5, 0xF6, 0xC8, 0xD8, 0xC5, 0x10, 0x89, 0x59, 0x60, 0x48, 0x94, 0xE7, 0x1B, + 0x80, 0x07, 0x04, 0x91, 0xF3, 0x37, 0xDD, 0x00, 0x01, 0xF6, 0xBC, 0x47, 0x1A, 0x78, 0xE7, 0x96, + 0xD6, 0xAD, 0x35, 0xCD, 0x52, 0x85, 0x5A, 0x72, 0x6A, 0x2D, 0x5B, 0xD9, 0xC7, 0x96, 0x0A, 0xCA, + 0xDA, 0xDA, 0x36, 0xE6, 0x5A, 0x3B, 0x27, 0x6D, 0x8C, 0xE9, 0xD6, 0xA1, 0x89, 0xE2, 0x4C, 0x5D, + 0x7C, 0x03, 0xF6, 0x94, 0x57, 0x24, 0x53, 0x4D, 0x38, 0xB5, 0x78, 0xD9, 0x26, 0xF5, 0xF7, 0x52, + 0x69, 0xDB, 0x45, 0x65, 0x6B, 0xDF, 0x5F, 0xAB, 0xC8, 0x02, 0x37, 0xDB, 0x1A, 0xAF, 0xEE, 0xFE, + 0xE9, 0x1B, 0x70, 0xA4, 0x02, 0x54, 0xFA, 0x77, 0xFE, 0x7C, 0xF4, 0xAF, 0xE6, 0xDF, 0x66, 0xF0, + 0xEA, 0x71, 0xE5, 0x4D, 0xA4, 0xE2, 0xD3, 0x57, 0xB6, 0xEA, 0xE9, 0x74, 0x6A, 0xD6, 0x4E, 0xEB, + 0xB2, 0x56, 0x3F, 0x43, 0x71, 0xBC, 0x54, 0x62, 0xAD, 0xA6, 0xDA, 0x2B, 0xDB, 0xA7, 0xA5, 0xBB, + 0x5A, 0xD6, 0x3E, 0x48, 0xF8, 0x83, 0xE1, 0xFD, 0x66, 0xC3, 0xC4, 0x77, 0x5A, 0xE5, 0xD7, 0x86, + 0x2F, 0x35, 0x8F, 0x0F, 0xE9, 0xF6, 0xD7, 0x71, 0xDB, 0x8D, 0x32, 0x13, 0x34, 0xD6, 0xD7, 0x17, + 0xAB, 0x12, 0xC2, 0xEC, 0x41, 0x19, 0x00, 0xC0, 0xC3, 0x68, 0xC7, 0xDE, 0x18, 0xCE, 0x7E, 0x5F, + 0xE8, 0x9E, 0x1E, 0x58, 0x6C, 0x45, 0x2C, 0x3E, 0x4B, 0x83, 0xA9, 0x19, 0x37, 0x39, 0x53, 0x9F, + 0x25, 0xEC, 0x94, 0xA9, 0xAB, 0x5B, 0x54, 0x95, 0xD2, 0xB2, 0x6F, 0x9A, 0xF2, 0xBA, 0x71, 0xB6, + 0xDF, 0x9D, 0x73, 0xBC, 0xBB, 0x15, 0x8D, 0xA5, 0x98, 0x47, 0x96, 0x95, 0x5B, 0x38, 0xC9, 0xC5, + 0x38, 0xC9, 0x34, 0xA3, 0x28, 0xC9, 0x36, 0x92, 0x4E, 0xC9, 0x5E, 0x36, 0x69, 0x75, 0x5A, 0xA3, + 0xB3, 0xF8, 0x73, 0xF1, 0x76, 0xDE, 0x6B, 0x2D, 0x3B, 0x47, 0xBD, 0xF0, 0xEE, 0xB9, 0x6B, 0x7D, + 0x0C, 0x7E, 0x40, 0x7F, 0xEC, 0xD7, 0x8E, 0x30, 0x14, 0x63, 0x24, 0x63, 0x8C, 0x60, 0xF0, 0x38, + 0x03, 0x1C, 0xE0, 0xE4, 0xFE, 0x4B, 0x99, 0x70, 0xF3, 0xF6, 0xB5, 0x31, 0x74, 0x6A, 0x2B, 0x36, + 0xDB, 0x4F, 0x46, 0xAC, 0xDE, 0x8A, 0xD6, 0xD3, 0x45, 0x7B, 0x2E, 0xB6, 0xB6, 0x8A, 0xDE, 0x96, + 0x47, 0xC4, 0x94, 0xF0, 0xF4, 0xA8, 0xE5, 0x53, 0xA5, 0x76, 0x94, 0x62, 0xA5, 0x06, 0xA5, 0x16, + 0x92, 0x49, 0x3B, 0x2F, 0x79, 0x69, 0xBD, 0xD5, 0x96, 0xB7, 0x7A, 0x59, 0x7D, 0x27, 0x04, 0xBF, + 0x69, 0x84, 0xB0, 0x05, 0x15, 0xE1, 0x66, 0x11, 0x72, 0xAC, 0x00, 0x4E, 0x14, 0xE7, 0xF9, 0x74, + 0xFC, 0x2B, 0xE4, 0x28, 0x50, 0xF6, 0x78, 0xB8, 0x53, 0x8B, 0x69, 0xF4, 0x6A, 0xCB, 0x64, 0xEC, + 0xD5, 0x9E, 0x8A, 0xEB, 0x74, 0xD3, 0xB6, 0xCA, 0xFA, 0x1F, 0x6F, 0x15, 0x17, 0x18, 0xCA, 0x31, + 0xB7, 0x4F, 0xBB, 0xF2, 0xB7, 0x97, 0x96, 0x87, 0xC0, 0xBF, 0x17, 0xFC, 0x0B, 0xF1, 0x0A, 0xD3, + 0xE2, 0x9F, 0x85, 0x7C, 0x67, 0xE1, 0xAF, 0x0F, 0x6A, 0xDA, 0xE4, 0x7A, 0x6E, 0xA6, 0x5A, 0x38, + 0xF4, 0x39, 0x36, 0x6A, 0xA7, 0x78, 0x0A, 0x86, 0x06, 0xC8, 0x01, 0xF8, 0x18, 0x24, 0x8E, 0x71, + 0xD3, 0x3C, 0x7E, 0x99, 0x91, 0xE7, 0x15, 0x31, 0x58, 0x0A, 0x58, 0x5F, 0x6F, 0x2B, 0xAE, 0x58, + 0xF2, 0xA9, 0xB5, 0xAA, 0x92, 0xE5, 0x51, 0x57, 0xB5, 0xD6, 0xF1, 0xB2, 0xD3, 0x74, 0xB6, 0xBF, + 0xC4, 0xBC, 0x1C, 0xF0, 0xB5, 0xF1, 0xF8, 0x4C, 0x42, 0x95, 0x35, 0x5D, 0xC2, 0x54, 0xE7, 0x18, + 0xB7, 0x14, 0xE2, 0xD6, 0x92, 0xE5, 0x8C, 0x9C, 0x5E, 0x8B, 0x5E, 0x56, 0xAD, 0x6D, 0xED, 0x63, + 0xEA, 0x0F, 0x04, 0xFC, 0x4F, 0xD5, 0xF5, 0x99, 0x46, 0x91, 0xA9, 0x78, 0x4F, 0xC5, 0xDA, 0x45, + 0xEC, 0x44, 0x25, 0xD4, 0xBA, 0xBD, 0xBB, 0xA2, 0x17, 0x18, 0x0D, 0xE6, 0xC9, 0x9E, 0x4F, 0x4C, + 0x91, 0x9E, 0xE6, 0xBE, 0x5F, 0x3B, 0xC2, 0xE2, 0xE9, 0x7B, 0x5C, 0x55, 0x3C, 0x54, 0xB9, 0x2E, + 0xEF, 0x19, 0x4D, 0xDF, 0x4E, 0x8F, 0x65, 0xA7, 0x45, 0xDE, 0xD6, 0x47, 0xA5, 0x94, 0xE7, 0x2E, + 0x73, 0x86, 0x06, 0xA6, 0x19, 0xDD, 0x2B, 0x29, 0x47, 0xE0, 0xB2, 0xD1, 0x5A, 0xE9, 0x35, 0xB5, + 0x92, 0xB3, 0x56, 0x56, 0x5D, 0x2D, 0xF3, 0xE7, 0xED, 0x98, 0x65, 0x9B, 0xC2, 0x03, 0x60, 0x95, + 0x9C, 0xC4, 0x80, 0x2C, 0x4C, 0x01, 0x04, 0x4C, 0x80, 0x31, 0xF6, 0xE0, 0x75, 0xE9, 0x81, 0xE9, + 0xC7, 0xA5, 0xC2, 0x50, 0xC6, 0xCA, 0x85, 0x68, 0x52, 0xE7, 0x6E, 0xC9, 0xA4, 0xA6, 0xA3, 0xB2, + 0x76, 0x7D, 0x92, 0x4A, 0xFA, 0x6E, 0xD5, 0xEC, 0xD1, 0xB6, 0x2D, 0xC2, 0x97, 0x15, 0xE5, 0xB2, + 0x6D, 0x24, 0x9D, 0x4D, 0x5A, 0xD7, 0xE0, 0xBF, 0x4B, 0x59, 0xF4, 0xB7, 0xC8, 0x8B, 0xE0, 0x84, + 0xBF, 0x15, 0x3C, 0x09, 0xF0, 0xF2, 0xDA, 0xE1, 0x3C, 0x2B, 0x7D, 0xE3, 0x5D, 0x16, 0x38, 0x92, + 0x38, 0xA6, 0xD3, 0xAF, 0x62, 0x1F, 0x64, 0xC8, 0xF9, 0x36, 0xC5, 0xB7, 0x2C, 0xA0, 0x29, 0x5F, + 0xBC, 0x39, 0x15, 0xE9, 0x66, 0xB9, 0x76, 0x57, 0x8B, 0xCA, 0x69, 0xD6, 0xC7, 0x42, 0x71, 0xC6, + 0x59, 0xFE, 0xF1, 0x4E, 0x3C, 0x96, 0x56, 0xDE, 0x0E, 0x2B, 0x65, 0xE7, 0xAD, 0xD7, 0x44, 0x93, + 0xF1, 0xB0, 0xB9, 0xA4, 0xFE, 0xB9, 0x88, 0xC6, 0xE5, 0x18, 0x79, 0xAA, 0x33, 0x93, 0x76, 0x6B, + 0xDD, 0xE6, 0x4E, 0xD2, 0x6B, 0x95, 0x39, 0x45, 0x3B, 0x6A, 0xB9, 0x5A, 0xD3, 0x4B, 0x58, 0xFB, + 0xF7, 0xF6, 0x7B, 0xFF, 0x00, 0x82, 0x99, 0x7C, 0x68, 0xFD, 0x9D, 0xD0, 0xF8, 0x5B, 0x4A, 0xF8, + 0x29, 0xE2, 0x0F, 0x89, 0xDF, 0x0B, 0xB5, 0x9B, 0x81, 0x27, 0x89, 0x7E, 0x0E, 0xFC, 0x44, 0xD3, + 0x23, 0xD5, 0xFC, 0x19, 0x20, 0x72, 0x56, 0x5B, 0xCD, 0x1E, 0x47, 0x24, 0xE9, 0x1A, 0x88, 0x49, + 0x1C, 0x2D, 0xDD, 0xB0, 0x07, 0x3C, 0x48, 0xB2, 0xA1, 0x68, 0xCF, 0xCB, 0xAC, 0x8F, 0x04, 0xA8, + 0xC6, 0x70, 0xC5, 0x24, 0xD6, 0xFA, 0xAD, 0x5E, 0xEA, 0xCA, 0xFA, 0x6F, 0x67, 0x6F, 0x55, 0xAA, + 0x4C, 0xF5, 0x28, 0xF1, 0x26, 0x26, 0xA3, 0x8A, 0x8D, 0x15, 0x1D, 0x52, 0x77, 0x75, 0x1B, 0xB7, + 0x5B, 0x25, 0x4A, 0xFA, 0x2B, 0xD9, 0x3B, 0x2D, 0x76, 0xE8, 0x59, 0xFD, 0xA4, 0x7F, 0x63, 0x2B, + 0xBF, 0xDA, 0x67, 0x5C, 0x5F, 0xDB, 0x27, 0xE0, 0x97, 0x8E, 0xBC, 0x4F, 0xF1, 0x1B, 0xE0, 0x8D, + 0x94, 0x56, 0xDA, 0xA7, 0x8F, 0xFE, 0x13, 0x78, 0xCF, 0x4B, 0xB5, 0xB1, 0xF8, 0xFF, 0x00, 0xF0, + 0x02, 0xFD, 0x90, 0x2A, 0xDB, 0x78, 0x8B, 0x4C, 0xB4, 0x2F, 0x0D, 0xCE, 0x97, 0x1E, 0x76, 0x41, + 0xA8, 0xDB, 0x13, 0x09, 0x1C, 0x39, 0x56, 0x47, 0xDB, 0x78, 0x6C, 0xF6, 0x78, 0x3C, 0x35, 0x4C, + 0x3C, 0xDA, 0x73, 0xDA, 0xF1, 0x77, 0x4E, 0xC9, 0x6A, 0xF7, 0xEC, 0xAC, 0x95, 0x92, 0x4B, 0x54, + 0x74, 0x63, 0x72, 0xB7, 0x8C, 0x55, 0x6B, 0x60, 0xE4, 0xEF, 0x5F, 0xDC, 0x9C, 0xE5, 0xA4, 0xA3, + 0x49, 0x6B, 0xEC, 0xE9, 0xC1, 0x45, 0x38, 0xA7, 0xD5, 0xCD, 0x26, 0xF5, 0x5A, 0xB5, 0xAF, 0x1F, + 0xA2, 0x6A, 0xFA, 0xCF, 0x84, 0x96, 0xD6, 0xE3, 0xC2, 0x57, 0xF3, 0x69, 0xD7, 0xD6, 0xD6, 0xBE, + 0x55, 0xAB, 0xD9, 0xCF, 0xE4, 0xC7, 0x32, 0xAA, 0xFC, 0xB0, 0xC8, 0xA3, 0xE5, 0x92, 0x36, 0xF9, + 0x41, 0x56, 0x52, 0xA4, 0x71, 0x8E, 0x95, 0xE7, 0x70, 0xD5, 0x0C, 0x3E, 0x65, 0xC4, 0x38, 0x4C, + 0x36, 0x3E, 0x6D, 0x52, 0xA9, 0x34, 0xA6, 0xE2, 0xD2, 0x92, 0x56, 0x6D, 0x34, 0xDA, 0x69, 0x6A, + 0x96, 0x8D, 0x35, 0xE4, 0xFA, 0x76, 0xD7, 0xE7, 0xC2, 0x60, 0x65, 0x0C, 0x22, 0x57, 0x51, 0x69, + 0x2D, 0x52, 0xD1, 0x59, 0x27, 0x6E, 0x9D, 0xF7, 0xD3, 0x4D, 0x3A, 0xE2, 0xF8, 0x47, 0xC6, 0x1A, + 0xCF, 0xC5, 0x2D, 0x7B, 0x58, 0x8B, 0xE2, 0x6F, 0x86, 0x74, 0xBF, 0x85, 0x9E, 0x23, 0x9A, 0xE9, + 0xCE, 0x9F, 0xE2, 0xAD, 0x0E, 0x08, 0xA1, 0xF8, 0x7B, 0xE2, 0x1C, 0x63, 0x0D, 0xA8, 0xD8, 0xAB, + 0x19, 0x74, 0xF9, 0x49, 0x0A, 0x77, 0xC0, 0xAF, 0x11, 0x38, 0x26, 0x35, 0xC9, 0xC6, 0xF9, 0xDB, + 0xC1, 0x62, 0x71, 0xF8, 0x8C, 0x5A, 0xA9, 0x16, 0xE5, 0x26, 0xD5, 0xB9, 0xAF, 0xDB, 0x64, 0xAD, + 0x6B, 0x59, 0x2D, 0x13, 0xB6, 0xBA, 0xEE, 0x73, 0x65, 0xD3, 0xF6, 0x98, 0x3A, 0x14, 0xF1, 0x34, + 0xE5, 0x0A, 0xEA, 0x36, 0x9B, 0x71, 0x8A, 0xA7, 0x74, 0x92, 0x4A, 0x2D, 0xC9, 0xEE, 0xF6, 0x7A, + 0x2D, 0x36, 0x49, 0x24, 0x78, 0x47, 0xC6, 0x1F, 0x84, 0xBE, 0x3F, 0xD4, 0x3E, 0x26, 0x78, 0x6E, + 0xC3, 0xC4, 0xBA, 0x23, 0xD8, 0x78, 0x4F, 0x41, 0x74, 0xD4, 0xA2, 0xBB, 0x92, 0xE2, 0x39, 0xF4, + 0xFD, 0x68, 0xA8, 0x06, 0x19, 0x6D, 0x1D, 0x09, 0x49, 0x62, 0x3B, 0xB7, 0x6E, 0x53, 0x83, 0xC7, + 0x4E, 0x95, 0xB6, 0x0A, 0xBE, 0x1F, 0x03, 0x81, 0xF6, 0x71, 0x92, 0xE7, 0x7A, 0xF6, 0x77, 0x5A, + 0x47, 0xB2, 0xB2, 0xD5, 0xDD, 0x3B, 0x69, 0x66, 0xBB, 0x78, 0xD9, 0x8E, 0x0F, 0x19, 0x5F, 0x1F, + 0x38, 0xBA, 0x6E, 0x31, 0x92, 0x54, 0xD4, 0xB4, 0xE5, 0x50, 0x6D, 0x39, 0xB8, 0xB4, 0xEF, 0xCD, + 0x24, 0x94, 0x57, 0x96, 0xBB, 0x1D, 0xED, 0xFA, 0x4F, 0x06, 0x9F, 0x34, 0x7A, 0x75, 0xB2, 0xCD, + 0x70, 0x90, 0x18, 0x2D, 0x60, 0x52, 0x22, 0x46, 0x21, 0x02, 0xA2, 0x92, 0x70, 0x3A, 0x90, 0x39, + 0x03, 0xE8, 0x3A, 0x0E, 0x0C, 0x32, 0x84, 0xEB, 0x47, 0xDA, 0xBB, 0x46, 0xEA, 0xEE, 0xDD, 0x34, + 0xDB, 0xE5, 0xD3, 0xC9, 0x74, 0xB1, 0xE9, 0xE2, 0x63, 0x56, 0x8E, 0x0A, 0x4B, 0x09, 0x04, 0xE4, + 0xA3, 0x68, 0xC7, 0x44, 0x9B, 0x4A, 0xC9, 0x74, 0xF2, 0x5D, 0x2C, 0xBB, 0x5E, 0xC7, 0x95, 0xFC, + 0x1B, 0xF0, 0x3E, 0xAD, 0xE1, 0x79, 0xFC, 0x43, 0x7D, 0xAF, 0x08, 0x66, 0xD7, 0xFC, 0x4B, 0xA9, + 0x49, 0x7F, 0xAB, 0x5F, 0xD9, 0xDA, 0xC9, 0x74, 0xF6, 0x36, 0xAA, 0x00, 0x45, 0x52, 0xA3, 0x72, + 0x84, 0x50, 0xAA, 0xC4, 0x8C, 0x67, 0x92, 0x2B, 0xE9, 0x61, 0x8A, 0xA1, 0x5A, 0xAA, 0xA7, 0x29, + 0x28, 0xD2, 0x5A, 0xBD, 0x2E, 0xE2, 0x97, 0x58, 0xEC, 0xEC, 0x96, 0xB6, 0xD1, 0x5D, 0xB5, 0x7B, + 0x2D, 0x3C, 0x3A, 0x58, 0x79, 0xF2, 0xC7, 0x96, 0x0F, 0x96, 0x14, 0xD4, 0x20, 0x9D, 0xAF, 0xB7, + 0x34, 0xE5, 0x24, 0x97, 0xBA, 0xE5, 0x36, 0xDB, 0x49, 0xDB, 0x95, 0x45, 0x35, 0xA5, 0x9E, 0xDF, + 0x8F, 0xAF, 0x3C, 0x3B, 0xAA, 0x69, 0xFA, 0xDE, 0x99, 0x79, 0xAA, 0xDB, 0xDA, 0xE9, 0x77, 0x96, + 0xAF, 0x6F, 0x1C, 0x5A, 0xA6, 0xA9, 0x16, 0xE8, 0xD0, 0x26, 0x17, 0x71, 0x24, 0x0C, 0x02, 0xB9, + 0x00, 0x01, 0x80, 0x05, 0x72, 0xD6, 0xC7, 0xAA, 0xB8, 0xE5, 0x59, 0x37, 0xEC, 0xEF, 0xCB, 0x14, + 0xDD, 0xDA, 0x8D, 0xAD, 0x65, 0xBD, 0x9D, 0x9B, 0xD1, 0x5E, 0xD7, 0x7E, 0x64, 0xFB, 0x2A, 0xF2, + 0xA2, 0xE3, 0x06, 0xA3, 0x51, 0x59, 0xC5, 0xEA, 0x94, 0x65, 0x16, 0xA5, 0x16, 0xBA, 0xA4, 0xA4, + 0x97, 0x4D, 0xFA, 0x1F, 0x22, 0x7C, 0x37, 0xF1, 0x0D, 0xAF, 0xC3, 0x3F, 0x14, 0x6A, 0xBE, 0x28, + 0xF1, 0xEF, 0xC5, 0x6D, 0x0F, 0x5A, 0xD6, 0x2D, 0x74, 0xC5, 0xF0, 0xEF, 0x86, 0x6E, 0x57, 0x5D, + 0x3E, 0x21, 0xBE, 0xB0, 0xD3, 0xA3, 0x66, 0x0B, 0x02, 0xAB, 0x83, 0xB5, 0x02, 0xC8, 0x42, 0xA8, + 0xC8, 0x1C, 0xE0, 0x8C, 0x71, 0xE7, 0xD3, 0xC4, 0x61, 0x30, 0x94, 0x65, 0x4A, 0xAE, 0x26, 0x1C, + 0xAE, 0x5E, 0xED, 0xF9, 0x63, 0xCB, 0x0B, 0x5F, 0x95, 0xDE, 0xD7, 0x6B, 0x4D, 0x77, 0xB2, 0x8F, + 0x56, 0xAF, 0xEE, 0x66, 0x58, 0xAC, 0xD7, 0x3D, 0xC4, 0x61, 0x6A, 0xE0, 0x70, 0x95, 0x22, 0xA0, + 0xA5, 0x29, 0xB7, 0x1E, 0x64, 0xEA, 0xCA, 0x2A, 0x37, 0x8B, 0x57, 0x8D, 0x94, 0x6E, 0xB5, 0xB6, + 0xEA, 0xD1, 0xBE, 0xDE, 0x5B, 0xE2, 0x9F, 0x8A, 0x1E, 0x15, 0x1E, 0x2D, 0x49, 0xAC, 0x35, 0x6B, + 0x4D, 0x43, 0xC1, 0x51, 0xEB, 0xEB, 0xE2, 0xD7, 0xD1, 0xEC, 0xF4, 0x04, 0x8F, 0x54, 0x9B, 0x52, + 0x8E, 0xDC, 0xC7, 0x14, 0x86, 0xE9, 0xA3, 0x0C, 0x63, 0x00, 0x8F, 0x94, 0xC9, 0x81, 0xB4, 0x71, + 0x93, 0x91, 0xE7, 0x57, 0xCF, 0xB2, 0x78, 0x66, 0x10, 0xC6, 0x4B, 0x11, 0xCD, 0x05, 0x18, 0xDE, + 0x0A, 0x32, 0x77, 0x94, 0x53, 0x51, 0x6B, 0x68, 0xE9, 0xD6, 0xFA, 0xA6, 0x93, 0x8A, 0x56, 0x3A, + 0x70, 0x99, 0x27, 0x10, 0xD6, 0xE1, 0x8A, 0xD9, 0x1C, 0x30, 0xCE, 0x9D, 0x59, 0x73, 0x42, 0x33, + 0x9C, 0xA3, 0x65, 0x4A, 0x52, 0x52, 0x94, 0x74, 0x6E, 0x49, 0xEE, 0x92, 0x4A, 0xCD, 0x6E, 0xB4, + 0x45, 0xCF, 0x1B, 0xFE, 0xD4, 0xEB, 0xE2, 0xA3, 0x78, 0x8B, 0xF0, 0xF3, 0xC2, 0xD7, 0x76, 0x77, + 0x1A, 0x3A, 0xE8, 0xF0, 0x69, 0xDA, 0xAD, 0xAC, 0xB6, 0xDA, 0x3D, 0x88, 0x48, 0xD5, 0x52, 0xE6, + 0x1B, 0x4B, 0x69, 0x93, 0x6C, 0xC0, 0xA0, 0x70, 0x43, 0xED, 0xDF, 0x92, 0x54, 0xF4, 0x1C, 0x78, + 0xDE, 0x37, 0xC2, 0x3A, 0x12, 0xA1, 0x81, 0xC3, 0xB7, 0x76, 0x9B, 0xE7, 0x6A, 0xCD, 0xAE, 0xE9, + 0x5D, 0xCA, 0x3A, 0x27, 0x6B, 0xA6, 0xDF, 0x54, 0x75, 0xE4, 0xBE, 0x1F, 0x62, 0xB0, 0x99, 0x95, + 0x2C, 0xD3, 0x31, 0xC4, 0x43, 0x9A, 0x9C, 0x79, 0x63, 0x0A, 0x71, 0x6A, 0x31, 0xD2, 0xD7, 0x8D, + 0xEC, 0x93, 0xB6, 0xF7, 0x8B, 0x4D, 0x68, 0xD3, 0xDC, 0xF0, 0xA3, 0xF1, 0x13, 0x50, 0x6F, 0x04, + 0xDD, 0x78, 0x22, 0xEB, 0x45, 0xD0, 0x2E, 0xE0, 0xB9, 0xD6, 0x06, 0xB1, 0x3F, 0x88, 0x64, 0x7B, + 0xA3, 0xE2, 0x65, 0x73, 0x20, 0x66, 0x48, 0xA5, 0x17, 0x1E, 0x46, 0xD3, 0x82, 0x0E, 0x61, 0x73, + 0xCF, 0x5C, 0x81, 0x8F, 0x93, 0xC4, 0x71, 0x36, 0x61, 0x8D, 0xC2, 0x3C, 0x05, 0x4B, 0x2A, 0x53, + 0x94, 0xA6, 0xD4, 0x62, 0xE2, 0xFD, 0xE9, 0x73, 0x34, 0xDB, 0x6D, 0x59, 0x3D, 0xAE, 0xAF, 0x6B, + 0x2D, 0x52, 0x3E, 0xF6, 0x97, 0x0C, 0x65, 0xB8, 0x4C, 0xCA, 0x59, 0xBD, 0x38, 0x2F, 0x6F, 0x18, + 0x46, 0x9A, 0xB4, 0xE2, 0xE2, 0xA0, 0x95, 0x92, 0x8C, 0x56, 0x9B, 0x68, 0xDA, 0xBA, 0x5B, 0x69, + 0xD7, 0x6A, 0x5F, 0x89, 0xF6, 0x0B, 0xE2, 0x0F, 0x0F, 0x6A, 0xD6, 0x5E, 0x0A, 0xB3, 0x6D, 0x0B, + 0xC2, 0x9A, 0x6A, 0x59, 0x69, 0x3E, 0x16, 0xD6, 0x3C, 0x41, 0xAA, 0x6A, 0xFA, 0x47, 0xDA, 0x15, + 0x08, 0xFB, 0x6C, 0xAE, 0xD3, 0x89, 0x16, 0x52, 0x4A, 0x3E, 0xD8, 0x1A, 0x05, 0xDD, 0x1C, 0x78, + 0x5C, 0x29, 0x06, 0x16, 0x63, 0x4D, 0xD7, 0xA7, 0x56, 0x95, 0x38, 0x45, 0xC2, 0x36, 0xB6, 0xAA, + 0xFC, 0xAD, 0x5A, 0x57, 0x94, 0xA5, 0x79, 0xB4, 0x96, 0xB1, 0x50, 0x57, 0xD9, 0x69, 0xAE, 0x98, + 0x8C, 0x1B, 0xAB, 0xCD, 0x4E, 0x55, 0x5B, 0x72, 0x6E, 0xF7, 0xD1, 0xB8, 0xBD, 0x2D, 0xEE, 0xB8, + 0xBB, 0x25, 0x65, 0xAB, 0x93, 0xB6, 0x97, 0x30, 0x17, 0xC4, 0x3A, 0x4E, 0xA7, 0x63, 0x77, 0x79, + 0xAE, 0x68, 0x9A, 0x86, 0xA7, 0xE3, 0x1B, 0xDF, 0x12, 0xA6, 0xB9, 0x3F, 0x8B, 0x2F, 0xF5, 0xE9, + 0xAE, 0x60, 0xBB, 0xB4, 0x54, 0x22, 0x4B, 0x19, 0x6D, 0x1D, 0x0E, 0xF2, 0xD2, 0x95, 0x63, 0x31, + 0x94, 0xB6, 0x17, 0x6E, 0x39, 0xCD, 0x7D, 0x87, 0x0A, 0xE0, 0xF0, 0x79, 0xD5, 0x7C, 0x45, 0x7C, + 0x64, 0xA5, 0x49, 0x28, 0xF3, 0x54, 0x96, 0xEA, 0x51, 0x96, 0x8A, 0x31, 0xBA, 0x5C, 0xB1, 0xE6, + 0x49, 0x37, 0xAD, 0xA0, 0x9A, 0xBF, 0x6C, 0xAA, 0xC6, 0x74, 0x22, 0xA8, 0xD0, 0x71, 0xE5, 0x49, + 0x25, 0x1B, 0x7C, 0x2F, 0xBB, 0xB3, 0xED, 0xB2, 0xF4, 0x38, 0xFD, 0x56, 0xEE, 0xE3, 0x50, 0xBE, + 0xB8, 0xBC, 0xBB, 0x65, 0x33, 0xDC, 0x31, 0x96, 0x41, 0x1A, 0x04, 0x8D, 0x49, 0x3F, 0x2A, 0xAA, + 0xF6, 0x00, 0x60, 0x0E, 0xBC, 0x57, 0x8F, 0xC4, 0xB4, 0x2B, 0x51, 0xC4, 0x7D, 0x5F, 0x19, 0x52, + 0xF2, 0x84, 0x36, 0x5A, 0xD9, 0x26, 0xD4, 0x12, 0x57, 0x49, 0x45, 0x2B, 0x45, 0x36, 0xDB, 0x51, + 0xD5, 0x27, 0xD3, 0xAB, 0x0A, 0xA3, 0x1A, 0x71, 0x85, 0x3B, 0xD9, 0x24, 0x95, 0xDB, 0x7A, 0x24, + 0x95, 0xAE, 0xEE, 0xF4, 0x5A, 0x25, 0xB2, 0x49, 0x25, 0x64, 0x91, 0x99, 0x5F, 0x1E, 0x76, 0x8B, + 0xF2, 0xE0, 0x00, 0x31, 0x80, 0x07, 0x6C, 0x74, 0xEC, 0x31, 0xEC, 0x2B, 0x69, 0x3C, 0x37, 0xB2, + 0x4A, 0x9C, 0x64, 0xA7, 0xA6, 0xED, 0x34, 0xF4, 0xD6, 0xC9, 0x45, 0x35, 0xE5, 0xAB, 0xD3, 0x4E, + 0x84, 0x25, 0x24, 0xFA, 0x58, 0x9A, 0xDA, 0xDD, 0xA7, 0x75, 0x45, 0x1F, 0x2F, 0x00, 0xF4, 0x00, + 0x71, 0xC0, 0x1F, 0x95, 0x7D, 0x0F, 0x0A, 0xF0, 0xC6, 0x33, 0x89, 0x73, 0x0A, 0x78, 0x5C, 0x3C, + 0x3F, 0x77, 0x74, 0xA4, 0xF6, 0xE9, 0x7B, 0x27, 0x6B, 0x6C, 0xB5, 0xEC, 0xBE, 0x49, 0xE5, 0x5E, + 0xB4, 0x68, 0x43, 0x5D, 0xED, 0xA1, 0xE8, 0x1A, 0x6E, 0x9E, 0xB6, 0xF1, 0x20, 0x0B, 0x81, 0xB4, + 0x63, 0x20, 0x60, 0x71, 0xD7, 0x1F, 0xFD, 0x6A, 0xFF, 0x00, 0x4C, 0x3C, 0x2C, 0xF0, 0xDF, 0x0D, + 0xC3, 0xD9, 0x55, 0x0A, 0x74, 0xE1, 0x68, 0x59, 0x59, 0xCB, 0x55, 0x17, 0x64, 0xAF, 0xB2, 0x76, + 0x8F, 0x5D, 0x35, 0xEF, 0xD4, 0xF8, 0xDC, 0x66, 0x29, 0xD4, 0x93, 0xEF, 0xE4, 0x4F, 0xA9, 0xDC, + 0x9B, 0x68, 0x7C, 0xB4, 0x8B, 0x32, 0xE3, 0x0B, 0x81, 0xF2, 0x8C, 0x0E, 0x01, 0x1E, 0xF8, 0xAF, + 0x73, 0xC5, 0x5E, 0x2C, 0xAD, 0xC2, 0xF9, 0x27, 0xD4, 0x30, 0x98, 0x57, 0x2C, 0x63, 0x56, 0x8A, + 0x4B, 0xDD, 0x56, 0xDB, 0x9A, 0x37, 0x4D, 0xF3, 0xFD, 0x94, 0x9A, 0xB5, 0xD2, 0xE9, 0xA6, 0x58, + 0x1A, 0x0A, 0xBC, 0xD4, 0x9C, 0xBD, 0xDF, 0xEB, 0x6F, 0x43, 0x92, 0x39, 0x0F, 0x15, 0xC3, 0x09, + 0xD0, 0x46, 0x37, 0x4D, 0x3C, 0x41, 0x92, 0x58, 0xB9, 0xFF, 0x00, 0x55, 0xB7, 0x38, 0x07, 0xA5, + 0x7F, 0x19, 0xE2, 0x61, 0x5E, 0x8E, 0x61, 0x85, 0xE2, 0x5C, 0x62, 0xC4, 0x52, 0x8D, 0x2B, 0xCF, + 0x11, 0x88, 0xA5, 0xED, 0xA1, 0x5A, 0x8D, 0xE4, 0x9F, 0xD4, 0xF9, 0x1C, 0xDC, 0x54, 0xAC, 0xD3, + 0xBB, 0xF7, 0x5A, 0xD1, 0x45, 0x3B, 0x35, 0xF4, 0x10, 0xE5, 0xE4, 0x74, 0x69, 0xA8, 0xBB, 0xE8, + 0xA2, 0xEC, 0xD3, 0xD3, 0xE2, 0xDB, 0x6F, 0x4D, 0x8E, 0xD6, 0xDE, 0x7B, 0x7B, 0xA8, 0xE1, 0x96, + 0xD9, 0xC3, 0xC6, 0xA8, 0x15, 0x73, 0xF7, 0x94, 0xE3, 0xB8, 0xF5, 0x18, 0xAF, 0xEF, 0x2E, 0x1B, + 0xE2, 0x0E, 0x1C, 0xE2, 0xEC, 0x06, 0x0F, 0x39, 0xE1, 0x8C, 0x52, 0xAD, 0x86, 0x85, 0x3E, 0x58, + 0xF3, 0x36, 0xE7, 0x17, 0xA2, 0x7C, 0xDA, 0xB6, 0xAA, 0x45, 0xAB, 0x74, 0x51, 0xD5, 0x38, 0xB3, + 0xE6, 0x6A, 0xD1, 0xAB, 0x41, 0xCA, 0x95, 0x68, 0xDA, 0x57, 0xF9, 0x7C, 0xB6, 0xD0, 0xA8, 0xCA, + 0x2C, 0x66, 0x6B, 0xC6, 0x59, 0x1E, 0xCE, 0x62, 0x12, 0xE5, 0x21, 0xC0, 0x2A, 0xD8, 0xF9, 0x24, + 0x23, 0xA7, 0x04, 0x00, 0x7D, 0xAB, 0xE0, 0x73, 0x8C, 0x2D, 0x6E, 0x01, 0xCF, 0xA7, 0xC7, 0x74, + 0x69, 0x4A, 0xAE, 0x53, 0x89, 0x94, 0x69, 0xE2, 0xE3, 0x4D, 0x7B, 0xCA, 0x76, 0xF7, 0x71, 0x12, + 0xD9, 0x29, 0x5D, 0x46, 0x13, 0x93, 0x4D, 0x72, 0xD9, 0x5A, 0x36, 0x3B, 0x68, 0x3A, 0x78, 0x9A, + 0x4B, 0x0B, 0x51, 0xDA, 0x71, 0x4D, 0xC7, 0xB6, 0xDA, 0x2F, 0x4F, 0x24, 0x5D, 0x29, 0xF2, 0x2B, + 0x80, 0xBC, 0xE0, 0x80, 0xA0, 0x70, 0xA7, 0xA0, 0xFE, 0x55, 0xFA, 0x5D, 0x4C, 0x2C, 0xDE, 0x16, + 0x9E, 0x32, 0xE9, 0xB9, 0x59, 0xD9, 0x25, 0xA4, 0x25, 0xAC, 0x13, 0xDF, 0x5D, 0xB9, 0x9D, 0xBD, + 0x12, 0xB1, 0xC0, 0x9A, 0x5E, 0xEA, 0x5A, 0x7E, 0xAB, 0xFA, 0xD0, 0x88, 0xAF, 0x03, 0x80, 0x31, + 0x81, 0xC6, 0x71, 0xD3, 0x8E, 0x3F, 0x0A, 0xF2, 0x31, 0x18, 0x6A, 0x89, 0x45, 0x34, 0x92, 0xF2, + 0xBD, 0xBC, 0xBD, 0x3E, 0xE5, 0xDB, 0xA6, 0xBA, 0x45, 0xAD, 0x91, 0x0B, 0x46, 0x40, 0xE3, 0xF0, + 0x1C, 0x7E, 0x9F, 0x90, 0xAF, 0x0B, 0x11, 0x84, 0xA9, 0x05, 0xA2, 0xD1, 0xF4, 0xD3, 0x7D, 0x36, + 0xB7, 0x4B, 0x7E, 0x46, 0x91, 0x69, 0x59, 0x5B, 0x4F, 0xD0, 0x83, 0x68, 0xE9, 0x8E, 0x06, 0x30, + 0x00, 0x00, 0x0C, 0x76, 0xC5, 0x78, 0x9F, 0x57, 0x71, 0x4E, 0x9C, 0xF6, 0xD1, 0xAB, 0x6D, 0xA6, + 0x96, 0xB7, 0x4D, 0xD2, 0xE9, 0x7F, 0x2B, 0x58, 0xD1, 0x34, 0xED, 0xCA, 0x87, 0xB2, 0x92, 0xB1, + 0xB4, 0x6C, 0x62, 0x9E, 0x06, 0x59, 0x6D, 0xE6, 0x84, 0xEC, 0x96, 0x27, 0x46, 0x05, 0x19, 0x4F, + 0x6C, 0x10, 0x2B, 0x8B, 0x8A, 0xB8, 0x6B, 0x2F, 0xE2, 0xEC, 0x8E, 0xA6, 0x4F, 0x8D, 0x86, 0xF1, + 0x4A, 0x32, 0x86, 0x93, 0x4D, 0x34, 0xE3, 0xAE, 0xBA, 0x5D, 0x25, 0xB6, 0xDA, 0x7A, 0x3A, 0x15, + 0xA5, 0x42, 0x6A, 0x71, 0xDB, 0xB7, 0x4D, 0x8F, 0xE8, 0x0B, 0xF6, 0x16, 0xFD, 0xAB, 0x2C, 0x75, + 0xBD, 0x27, 0x4E, 0xB5, 0xD5, 0xAE, 0xE2, 0x8B, 0x57, 0xB1, 0x86, 0x3D, 0x37, 0xC4, 0x1A, 0x71, + 0x65, 0x49, 0x15, 0x90, 0xFC, 0xB3, 0xA2, 0x93, 0xF7, 0x5B, 0xEF, 0x2F, 0x6E, 0xA0, 0xF2, 0x31, + 0x5F, 0xC6, 0x38, 0xCC, 0xAB, 0x17, 0xC3, 0x78, 0xDA, 0x9C, 0x2B, 0x9E, 0x47, 0x92, 0xA4, 0x5B, + 0x74, 0xE5, 0xD2, 0x49, 0xDE, 0xCA, 0xFD, 0x1F, 0x4B, 0x24, 0xBA, 0x59, 0x6C, 0x8E, 0x3C, 0x6E, + 0x1F, 0xD9, 0x57, 0x58, 0xDC, 0x2A, 0xF7, 0x6D, 0xEF, 0x2B, 0x5F, 0x64, 0xAD, 0x6D, 0x3C, 0xAD, + 0xD7, 0x64, 0xDE, 0x88, 0xFD, 0x4F, 0xBC, 0xF0, 0x27, 0xC3, 0x5F, 0x88, 0xF7, 0x3A, 0x77, 0x89, + 0x5E, 0xDA, 0xCE, 0xF2, 0xF6, 0xD9, 0x52, 0x4B, 0x6B, 0x9B, 0x3B, 0xA3, 0x0D, 0xC4, 0x47, 0x00, + 0x85, 0x25, 0x09, 0x3C, 0x64, 0x70, 0x7A, 0x71, 0x9E, 0xBC, 0x14, 0x73, 0x1C, 0xD3, 0x2A, 0x84, + 0xB0, 0xF4, 0xDD, 0xA3, 0xE6, 0x93, 0x56, 0xEE, 0xAE, 0xB6, 0x76, 0xE9, 0x64, 0xED, 0xA2, 0xD0, + 0xE0, 0xAB, 0x96, 0xE5, 0xF9, 0x8C, 0x95, 0x48, 0xE9, 0x2F, 0x27, 0x6E, 0x9B, 0x69, 0x7D, 0x3D, + 0x34, 0x7A, 0xBB, 0x6E, 0x7A, 0x03, 0x78, 0x5F, 0x41, 0x97, 0x4B, 0x93, 0x45, 0x7D, 0x3A, 0x29, + 0x34, 0xD9, 0x62, 0x11, 0x4B, 0x6F, 0x22, 0x86, 0xF3, 0x50, 0x60, 0x01, 0x26, 0x73, 0xC0, 0x00, + 0x0E, 0x87, 0xA7, 0x3E, 0xFE, 0x6A, 0xC6, 0x62, 0x61, 0x56, 0x35, 0x94, 0xDF, 0x3A, 0xD9, 0xAE, + 0x8F, 0xCA, 0xD6, 0xDF, 0xCA, 0xDE, 0x5A, 0x6D, 0xDE, 0xB0, 0x38, 0x47, 0x45, 0xE1, 0xB9, 0x3D, + 0xC6, 0xB4, 0xEF, 0x6D, 0x16, 0xFB, 0x25, 0xDF, 0xD1, 0xF6, 0x39, 0xA8, 0xFC, 0x3D, 0xE0, 0x7F, + 0x03, 0xD8, 0x2B, 0xAC, 0x76, 0xFA, 0x75, 0x9D, 0xB0, 0x06, 0x38, 0x64, 0x94, 0x18, 0xA2, 0xE3, + 0xA4, 0x68, 0x7D, 0x48, 0x1E, 0xBF, 0x90, 0xAE, 0xB9, 0x62, 0xF3, 0x0C, 0xC6, 0x7C, 0xB2, 0x7C, + 0xCD, 0xF5, 0xB2, 0x5A, 0x2D, 0x35, 0x7A, 0x2B, 0x25, 0xA5, 0xB6, 0x56, 0xE8, 0x71, 0x47, 0x03, + 0x96, 0xE0, 0x60, 0xA2, 0x95, 0xA2, 0x96, 0x89, 0xB5, 0xFA, 0xD9, 0x5A, 0xFE, 0x8B, 0x6D, 0xF7, + 0x7F, 0x98, 0xBF, 0xB7, 0x17, 0xED, 0x59, 0xA0, 0xF8, 0x2B, 0xC2, 0xD7, 0xC2, 0xDE, 0xF2, 0x2F, + 0xB5, 0x35, 0xBB, 0x5A, 0x68, 0x9A, 0x54, 0x52, 0x01, 0x3D, 0xCC, 0xCC, 0xA4, 0x21, 0x31, 0xF6, + 0xC7, 0x3C, 0x9E, 0x80, 0x1E, 0x99, 0xE3, 0xC5, 0xCE, 0xB3, 0x2C, 0x3E, 0x07, 0x07, 0x3C, 0x1D, + 0x39, 0x5E, 0x6F, 0xE3, 0x92, 0xED, 0x67, 0xEE, 0xAD, 0xB5, 0x7F, 0xF0, 0x76, 0x8A, 0x3D, 0x1C, + 0xB7, 0x05, 0x5B, 0x1B, 0x8A, 0x8D, 0x6A, 0x8A, 0xD1, 0xD3, 0x95, 0x5A, 0xDA, 0x25, 0x6B, 0x3D, + 0x34, 0xB6, 0xB6, 0xD2, 0xDB, 0x68, 0xB6, 0x5F, 0x87, 0x7F, 0xB1, 0x36, 0xA3, 0x77, 0xAB, 0xFE, + 0xDD, 0xBF, 0xB2, 0x46, 0xAB, 0x7F, 0x29, 0x9A, 0xF7, 0x51, 0xFD, 0xAC, 0x3C, 0x05, 0x7B, 0x75, + 0x29, 0xFE, 0x39, 0x25, 0xF1, 0x75, 0x8B, 0x39, 0xC7, 0xD4, 0x9E, 0x2B, 0xF3, 0x4C, 0x15, 0x47, + 0x57, 0x35, 0xA3, 0x52, 0x5B, 0xBA, 0x91, 0x7E, 0x9E, 0xF2, 0xD1, 0x79, 0x25, 0xA2, 0xEC, 0x91, + 0xF7, 0x15, 0xA1, 0x1A, 0x78, 0x39, 0xC2, 0x2A, 0xC9, 0x45, 0xFE, 0x47, 0xFA, 0x04, 0x57, 0xE9, + 0xE7, 0xC8, 0x05, 0x00, 0x14, 0x00, 0x50, 0x07, 0xF2, 0x31, 0xFF, 0x00, 0x05, 0x5D, 0xFD, 0x9F, + 0xFE, 0x31, 0x7C, 0x5A, 0xFD, 0xB9, 0x3E, 0x2B, 0xEB, 0xDF, 0x0E, 0x7E, 0x1F, 0x6B, 0xBE, 0x2D, + 0xD1, 0x74, 0xDD, 0x17, 0xC2, 0xDA, 0x1D, 0xEE, 0xA1, 0xA5, 0xC7, 0x17, 0xD9, 0x6D, 0xEE, 0xD3, + 0xC2, 0xDA, 0x7C, 0xAF, 0x6E, 0x59, 0xDD, 0x7E, 0x71, 0x15, 0xCD, 0xB3, 0x10, 0x3A, 0x09, 0x13, + 0xD6, 0xBD, 0x3C, 0x9F, 0x34, 0xC9, 0xF0, 0x58, 0x5C, 0x4E, 0x1B, 0x31, 0xAA, 0xA3, 0x27, 0x55, + 0xB4, 0x9A, 0x6F, 0xDD, 0x74, 0xA9, 0x24, 0xD5, 0x93, 0xB6, 0xA9, 0xAE, 0x9D, 0x7D, 0x0F, 0x5F, + 0x0B, 0x09, 0xBA, 0x10, 0x70, 0x5A, 0x25, 0xFA, 0xB3, 0xF3, 0x7E, 0x4F, 0xD8, 0xB3, 0xF6, 0xA2, + 0x65, 0x0B, 0xFF, 0x00, 0x0A, 0x5B, 0xC5, 0x98, 0xDA, 0x08, 0x1E, 0x5D, 0xAE, 0x30, 0x07, 0x6F, + 0xDE, 0xFF, 0x00, 0xB2, 0x78, 0xF6, 0xAC, 0xF3, 0x4C, 0xD3, 0x87, 0x71, 0x74, 0x9D, 0x07, 0x5A, + 0x2E, 0x29, 0x24, 0x97, 0x2C, 0x9F, 0x6E, 0xF1, 0xFB, 0xD5, 0x92, 0xED, 0xAA, 0x3A, 0xA0, 0xAA, + 0x53, 0x69, 0xF2, 0xFD, 0xDF, 0xF0, 0x3F, 0xA5, 0xF2, 0x33, 0x65, 0xFD, 0x8A, 0x3F, 0x6A, 0x44, + 0x20, 0x27, 0xC1, 0x6F, 0x16, 0xE3, 0x03, 0x8D, 0xB6, 0xBD, 0xFA, 0x00, 0x3C, 0xDE, 0x9C, 0x0F, + 0xD2, 0xBF, 0x2E, 0xCD, 0x70, 0x79, 0x7C, 0x67, 0x1F, 0xEC, 0xC9, 0xA7, 0x1D, 0x5B, 0xF8, 0x96, + 0xEF, 0x44, 0x93, 0x56, 0xB2, 0x5B, 0x6B, 0xEB, 0xB1, 0xD7, 0x4B, 0x11, 0x14, 0xAD, 0x3F, 0xCB, + 0xFE, 0x07, 0xF5, 0xD0, 0x8F, 0xFE, 0x18, 0xAB, 0xF6, 0xA7, 0xFF, 0x00, 0xA2, 0x29, 0xE2, 0xEF, + 0xFB, 0xE6, 0xD7, 0xFF, 0x00, 0x8E, 0xD7, 0x8D, 0xEC, 0x2A, 0x7F, 0x29, 0xB7, 0xB7, 0xA3, 0xDF, + 0xF0, 0x7F, 0xE4, 0x1F, 0xF0, 0xC5, 0x5F, 0xB5, 0x3F, 0xFD, 0x11, 0x4F, 0x17, 0x7F, 0xDF, 0x36, + 0xBF, 0xFC, 0x76, 0x8F, 0x61, 0x53, 0xF9, 0x43, 0xDB, 0xD1, 0xEF, 0xF8, 0x3F, 0xF2, 0x35, 0x34, + 0xFF, 0x00, 0xD8, 0xF7, 0xF6, 0xAB, 0xB2, 0x60, 0x0F, 0xC1, 0x6F, 0x17, 0xF9, 0x43, 0x18, 0x2A, + 0xB6, 0xA1, 0xA3, 0xC7, 0x42, 0x08, 0x97, 0xB6, 0x2B, 0xF6, 0x2F, 0x0E, 0xBC, 0x4E, 0xCC, 0x78, + 0x4A, 0x6F, 0x01, 0x98, 0xAE, 0x6C, 0x14, 0x92, 0x8B, 0xF7, 0x53, 0x71, 0x5A, 0x2D, 0x2C, 0xB6, + 0x4B, 0xEE, 0xD3, 0x46, 0xB6, 0xF3, 0xB1, 0x54, 0x30, 0xF5, 0x92, 0x95, 0x37, 0x69, 0x2F, 0x54, + 0x7E, 0xA4, 0x7C, 0x2C, 0xF0, 0xBF, 0xC6, 0x7F, 0x8A, 0x5F, 0x07, 0xEF, 0x7E, 0x00, 0xFE, 0xD4, + 0x9F, 0x0A, 0x3C, 0x77, 0x3D, 0xB5, 0xBD, 0xAB, 0x1F, 0x86, 0x3F, 0x13, 0x64, 0xB1, 0x8F, 0x50, + 0xBE, 0xF0, 0x55, 0xD4, 0x51, 0x95, 0x83, 0xED, 0x29, 0x0C, 0x9E, 0x64, 0xC8, 0x37, 0x15, 0xCB, + 0x02, 0x00, 0x20, 0xB6, 0x71, 0x5F, 0xD3, 0x9C, 0x3D, 0xC6, 0xDC, 0x1B, 0x57, 0x1B, 0x86, 0xCC, + 0xF8, 0x67, 0x1F, 0x4E, 0x9E, 0x2A, 0x32, 0x4E, 0x51, 0x92, 0x70, 0x5A, 0x6A, 0xED, 0x2A, 0x89, + 0x45, 0x37, 0x64, 0xB9, 0x61, 0x6D, 0x13, 0x5A, 0x69, 0x6F, 0xCD, 0xF3, 0x0C, 0x87, 0x31, 0xCB, + 0x31, 0x6F, 0x31, 0xC0, 0xD1, 0x95, 0x4A, 0x5D, 0x69, 0xA9, 0x5B, 0x96, 0xFB, 0xB8, 0xAB, 0xDE, + 0xCD, 0xA5, 0xCD, 0x15, 0x17, 0xD6, 0xF6, 0x4A, 0xCB, 0xE3, 0x2B, 0x2F, 0xD8, 0xCB, 0xF6, 0x96, + 0xB7, 0xF1, 0x0B, 0xE8, 0x8F, 0xF0, 0x9F, 0xC4, 0x77, 0x90, 0x49, 0x7C, 0xBA, 0x20, 0xD5, 0x2D, + 0xAC, 0x93, 0x53, 0x82, 0x44, 0x32, 0x84, 0x8E, 0x78, 0x6D, 0x92, 0x5D, 0xD2, 0xE0, 0x88, 0xD9, + 0x50, 0x2B, 0x13, 0xF2, 0x85, 0x52, 0x48, 0x07, 0xFB, 0x2A, 0x9F, 0x8C, 0x1C, 0x13, 0x89, 0xC1, + 0xC6, 0x78, 0xAC, 0xC2, 0x95, 0x3C, 0x5D, 0x38, 0x27, 0x38, 0xDA, 0x51, 0x4D, 0xB5, 0x78, 0xA5, + 0x51, 0x45, 0xD3, 0x84, 0x93, 0xB5, 0xDB, 0x6D, 0x26, 0xED, 0xA5, 0x82, 0xAE, 0x07, 0x1D, 0x3C, + 0x1A, 0xC4, 0x61, 0xA8, 0xB5, 0x24, 0x9C, 0x94, 0x3D, 0xD4, 0xEF, 0x6D, 0x62, 0xDB, 0x4D, 0xC6, + 0xFA, 0xAB, 0xA4, 0x9A, 0x5A, 0xDD, 0x6B, 0x6F, 0xE8, 0x1F, 0xC3, 0x5F, 0xB3, 0x67, 0x8E, 0xFF, + 0x00, 0xE0, 0x96, 0xBF, 0x0E, 0x7C, 0x3B, 0xA4, 0xE8, 0xFE, 0x19, 0xB7, 0xF8, 0xC9, 0xFF, 0x00, + 0x05, 0x0E, 0xF1, 0xF6, 0x8E, 0x1B, 0xC0, 0xBE, 0x2D, 0x97, 0x48, 0x17, 0x5F, 0x0B, 0x7F, 0x63, + 0x9F, 0x0F, 0xEA, 0xD1, 0x03, 0x1B, 0xC6, 0x5C, 0xB3, 0x5C, 0xF8, 0x8A, 0xE0, 0x3A, 0x91, 0x23, + 0xA0, 0x5B, 0x34, 0x72, 0xE9, 0x24, 0x52, 0x5B, 0xED, 0x97, 0xF9, 0x53, 0x36, 0xE3, 0x0C, 0x9F, + 0xC6, 0x4C, 0xEE, 0x75, 0x73, 0x27, 0x0C, 0x27, 0x0D, 0xE1, 0xAA, 0x45, 0xCA, 0x9D, 0xA4, 0xEB, + 0xE3, 0xA5, 0x09, 0x24, 0xD3, 0x95, 0xAD, 0x1A, 0x71, 0x8D, 0xEE, 0xA2, 0xEC, 0xF4, 0xE7, 0x84, + 0xF9, 0xBD, 0xCC, 0x29, 0xBC, 0xD3, 0x26, 0xCA, 0xB1, 0x15, 0xB0, 0x94, 0xEA, 0x39, 0x54, 0x51, + 0x75, 0x29, 0xC2, 0xAA, 0x70, 0x8B, 0x8A, 0x95, 0xAA, 0x72, 0xBB, 0x41, 0xCA, 0x11, 0xD5, 0x5A, + 0x17, 0x77, 0x49, 0x5E, 0xEE, 0xFF, 0x00, 0x91, 0xBE, 0x32, 0xF8, 0x37, 0xFB, 0x59, 0xDA, 0xF8, + 0x9B, 0xC4, 0x5A, 0x9C, 0x1E, 0x0B, 0xF1, 0x6F, 0x8D, 0xAE, 0x75, 0xFD, 0x5A, 0xE3, 0x56, 0xD5, + 0xBC, 0x51, 0xE2, 0x9B, 0x53, 0xAB, 0xEA, 0x9A, 0xAE, 0xA1, 0x73, 0x2E, 0xFB, 0xA2, 0x6F, 0x0D, + 0xD1, 0x79, 0xF7, 0x4B, 0x28, 0xCC, 0xD2, 0x28, 0x2D, 0x85, 0x20, 0x1D, 0xA0, 0x57, 0xEC, 0xD9, + 0x1E, 0x75, 0xE1, 0x46, 0x26, 0x82, 0xA7, 0x5A, 0xB4, 0x70, 0x94, 0x29, 0xA5, 0x18, 0x72, 0x3B, + 0x45, 0xA5, 0x75, 0x65, 0x17, 0x07, 0x64, 0x92, 0x76, 0x51, 0x6A, 0x29, 0x3B, 0x68, 0xB6, 0xFA, + 0x2E, 0x18, 0xE3, 0xEE, 0x34, 0xA5, 0x97, 0x61, 0xF0, 0x78, 0x8C, 0x14, 0x1C, 0x29, 0x45, 0x25, + 0x15, 0x68, 0xB7, 0x1F, 0xE6, 0x96, 0xBA, 0x49, 0xDD, 0xCA, 0xD7, 0xB3, 0x6D, 0xDD, 0x2B, 0xDD, + 0xF2, 0x53, 0xFC, 0x29, 0xFD, 0xAB, 0x5C, 0xB4, 0xF0, 0x7C, 0x19, 0xD7, 0xAD, 0x6E, 0xE5, 0xB9, + 0x32, 0x4D, 0x2A, 0x69, 0xB6, 0xAD, 0x1C, 0x25, 0x93, 0x25, 0x8B, 0x09, 0x10, 0x12, 0xA4, 0x9C, + 0x15, 0x63, 0xCA, 0xE4, 0x7D, 0xE1, 0x8F, 0x57, 0xEB, 0x9E, 0x15, 0x53, 0x5F, 0x57, 0xA9, 0x9C, + 0x27, 0x18, 0xC5, 0x2B, 0x25, 0x35, 0xD5, 0x59, 0x25, 0xCA, 0xDA, 0xD2, 0xD6, 0x8B, 0x8E, 0xD6, + 0x4E, 0xC8, 0xFB, 0x08, 0x78, 0x87, 0xC5, 0x0A, 0x2E, 0x1F, 0xD9, 0x94, 0xDC, 0x54, 0x5D, 0xAF, + 0x39, 0x6E, 0xB4, 0xD2, 0x29, 0xBD, 0xD5, 0x9A, 0x4F, 0x96, 0xE9, 0xA5, 0xA3, 0x5A, 0xB3, 0xC2, + 0x9F, 0xB3, 0xCF, 0xED, 0xC3, 0xE3, 0xFF, 0x00, 0x11, 0xD8, 0xF8, 0x76, 0xDB, 0xE1, 0xFE, 0xA3, + 0xE1, 0xB8, 0x6E, 0x1C, 0xCB, 0x7B, 0xAE, 0x6A, 0x16, 0x76, 0xD6, 0xDA, 0x3E, 0x83, 0x6A, 0x8C, + 0x0C, 0x97, 0x37, 0x6C, 0x8E, 0xED, 0x1C, 0x49, 0xB4, 0x92, 0xAA, 0xA4, 0x9C, 0x6D, 0x00, 0x9C, + 0x0A, 0xE6, 0xC6, 0x66, 0xFE, 0x0B, 0xE5, 0x38, 0x6F, 0xAD, 0x51, 0xC6, 0xC6, 0xBE, 0x25, 0x5F, + 0x92, 0x9A, 0xE7, 0x6E, 0x5A, 0x5A, 0xFA, 0xF2, 0xAD, 0xEC, 0xBB, 0x5E, 0xD6, 0xB3, 0x68, 0x78, + 0x8E, 0x3E, 0xE2, 0x25, 0x49, 0xB5, 0x87, 0xA7, 0x04, 0xAC, 0x9B, 0x49, 0xBE, 0x9A, 0xA4, 0xDC, + 0x9E, 0xB6, 0x5B, 0xAD, 0x56, 0xDA, 0x68, 0x7B, 0xA7, 0x8B, 0xF4, 0x3F, 0xDA, 0x17, 0xE1, 0x46, + 0x8F, 0x37, 0x80, 0x3F, 0x67, 0x9F, 0x85, 0xBE, 0x35, 0xD4, 0xF5, 0x9B, 0xCB, 0x59, 0xF4, 0x9F, + 0x88, 0x9F, 0x1E, 0x35, 0x26, 0x4B, 0x3D, 0x47, 0xC7, 0x6B, 0x2A, 0x6C, 0x96, 0xDF, 0x46, 0xB7, + 0x2F, 0x14, 0x96, 0x3A, 0x78, 0xC1, 0x00, 0x9D, 0xAE, 0xE0, 0x65, 0x80, 0xDC, 0xDB, 0xBE, 0x43, + 0x2A, 0xAD, 0xE1, 0xD6, 0x37, 0x16, 0xF3, 0x7E, 0x26, 0xC7, 0x51, 0xA6, 0xDB, 0x4E, 0x9D, 0x08, + 0xC1, 0xC9, 0x41, 0x47, 0xA4, 0xA4, 0xA2, 0xD4, 0xE7, 0x7D, 0x74, 0xBC, 0x63, 0x2B, 0x59, 0x4B, + 0x46, 0xBE, 0x5B, 0x38, 0xC7, 0x71, 0x36, 0x79, 0x08, 0x2C, 0x65, 0x69, 0x46, 0x29, 0x27, 0x18, + 0xC7, 0x96, 0x2E, 0x2D, 0x49, 0x49, 0x34, 0x95, 0xA2, 0x9A, 0x57, 0x8E, 0xB0, 0xE6, 0x69, 0xA4, + 0xDA, 0xB2, 0x8A, 0xF8, 0x3B, 0x4E, 0xFD, 0x94, 0x3F, 0x69, 0x9D, 0x3E, 0x61, 0x70, 0x3E, 0x09, + 0x6B, 0xF7, 0xB2, 0xBC, 0x32, 0x44, 0x53, 0x53, 0xB4, 0xB3, 0xBD, 0x81, 0x0B, 0x2E, 0x15, 0xA3, + 0x47, 0x90, 0xE1, 0x97, 0x2B, 0xC9, 0xCE, 0x08, 0x1E, 0x95, 0xFA, 0x55, 0x7F, 0x11, 0x7C, 0x3F, + 0x78, 0x49, 0x60, 0x70, 0xD9, 0x9D, 0x18, 0xD1, 0x49, 0x24, 0xB9, 0x67, 0xA6, 0xDD, 0xA2, 0xF4, + 0xB2, 0x7B, 0xBB, 0xBD, 0xAE, 0xA2, 0x71, 0x62, 0x70, 0x53, 0xC6, 0xC6, 0x9B, 0xC4, 0x4E, 0xAF, + 0x3A, 0xD6, 0x4D, 0x54, 0x8E, 0xB6, 0x56, 0x8A, 0x77, 0x4E, 0xF1, 0xB5, 0x93, 0x4F, 0xA2, 0xD2, + 0xCE, 0xD6, 0x4D, 0x33, 0xF6, 0x56, 0xFD, 0xAA, 0x74, 0x91, 0x2C, 0x70, 0xFC, 0x14, 0xD6, 0x6E, + 0xA1, 0x96, 0x64, 0x9D, 0xAD, 0x75, 0x1D, 0x2E, 0xC2, 0xFE, 0x04, 0x78, 0xF3, 0xB7, 0x62, 0x33, + 0xFC, 0x9C, 0xB1, 0x24, 0x2E, 0x01, 0xDA, 0xB9, 0x18, 0x5A, 0xF2, 0x71, 0x1C, 0x7B, 0xE1, 0xEB, + 0xA6, 0xD4, 0x73, 0x3A, 0x49, 0x2B, 0x3F, 0xB4, 0xEC, 0x95, 0xAC, 0xAE, 0xE0, 0xAE, 0xBF, 0x2E, + 0x89, 0x3D, 0x5E, 0x33, 0xCA, 0x7D, 0xAC, 0xA3, 0x27, 0x4D, 0xF3, 0x25, 0x64, 0xD4, 0xAC, 0xDA, + 0x6A, 0xD6, 0x6D, 0x3D, 0x74, 0xEF, 0x7E, 0xEB, 0x5D, 0x47, 0xA7, 0xEC, 0xB9, 0xFB, 0x56, 0x41, + 0x64, 0x96, 0xB6, 0x7F, 0x05, 0xB5, 0xAD, 0x3A, 0x48, 0xE6, 0x7B, 0x85, 0xD4, 0x74, 0xDB, 0x3B, + 0x3B, 0x0D, 0x4C, 0x09, 0x24, 0x0E, 0x53, 0xCF, 0x49, 0x81, 0xD8, 0x0A, 0x28, 0x0B, 0xFC, 0x20, + 0x00, 0x31, 0x8A, 0xF2, 0x6A, 0xF1, 0xEF, 0x00, 0x43, 0x9A, 0x3F, 0xDA, 0x70, 0x57, 0x6A, 0xEB, + 0x96, 0x4E, 0xFA, 0x59, 0x25, 0xEE, 0x5B, 0x6D, 0xAD, 0xAD, 0xB6, 0xD3, 0x62, 0xA6, 0x4D, 0xED, + 0x6A, 0xB9, 0x55, 0x8C, 0x9C, 0x6D, 0x67, 0x16, 0xEF, 0x06, 0xAD, 0x6B, 0x38, 0xB6, 0xD3, 0xD1, + 0xF5, 0xEB, 0xBB, 0xD1, 0x5A, 0x9D, 0xC7, 0xEC, 0xB3, 0xFB, 0x5A, 0xCD, 0x0C, 0x91, 0x37, 0xC2, + 0x9F, 0x1C, 0x01, 0x32, 0xFF, 0x00, 0xA4, 0xC8, 0x2F, 0x15, 0xA4, 0xB9, 0x0C, 0x41, 0x60, 0xE0, + 0xDC, 0x11, 0xCB, 0x80, 0x48, 0x00, 0x7C, 0xDE, 0x9D, 0x2B, 0xC4, 0xAD, 0xE2, 0x0F, 0x87, 0xB1, + 0x5C, 0x93, 0xCC, 0xA9, 0xBA, 0x6F, 0xDD, 0xE5, 0xE5, 0x97, 0x5B, 0x6F, 0x68, 0x27, 0xA2, 0x56, + 0x4D, 0xBB, 0x28, 0xDA, 0xDA, 0x1A, 0x53, 0xC9, 0xF9, 0x5D, 0xFD, 0x9A, 0x6B, 0xA2, 0xB4, 0x6C, + 0xB5, 0xBA, 0xB2, 0x49, 0x6D, 0xA7, 0x7B, 0x5B, 0x5D, 0x51, 0x97, 0x1F, 0xEC, 0x93, 0xFB, 0x5A, + 0xC0, 0x58, 0xDB, 0x7C, 0x2E, 0xF1, 0xE5, 0xBB, 0x15, 0x68, 0x4F, 0x93, 0x7D, 0x14, 0x25, 0xD5, + 0x80, 0x46, 0x43, 0x89, 0xC6, 0x41, 0x1B, 0x57, 0x1E, 0x9E, 0xC2, 0xBE, 0x5B, 0x19, 0xC7, 0xBC, + 0x03, 0x56, 0x2A, 0x94, 0x31, 0xF0, 0xB4, 0x75, 0x8A, 0x51, 0xA9, 0xB2, 0x57, 0x57, 0x4D, 0x59, + 0xD9, 0x75, 0xB2, 0xB7, 0xA2, 0x3B, 0xA1, 0x96, 0xA8, 0xC1, 0x25, 0x45, 0x72, 0xAE, 0x96, 0x8E, + 0xEB, 0xAA, 0x49, 0x7F, 0x4B, 0x63, 0x11, 0xFF, 0x00, 0x63, 0x1F, 0xDA, 0x87, 0x00, 0x8F, 0x82, + 0xFE, 0x2C, 0xC2, 0x83, 0x92, 0x16, 0xD7, 0x00, 0x0E, 0xBF, 0xF2, 0xD7, 0xB6, 0x2B, 0xE6, 0xAB, + 0x71, 0xFF, 0x00, 0x06, 0x24, 0x93, 0xC7, 0x42, 0xC9, 0x2F, 0xB3, 0x3F, 0x92, 0xB7, 0x2F, 0x9E, + 0x96, 0x5D, 0xED, 0xB3, 0x4B, 0xB1, 0x61, 0x6B, 0xBB, 0x25, 0x0D, 0x3E, 0x5D, 0x3F, 0xAF, 0xEB, + 0x42, 0x1F, 0xF8, 0x63, 0x4F, 0xDA, 0x8D, 0x0F, 0xEE, 0xFE, 0x0D, 0x78, 0xB9, 0x4F, 0x1C, 0xC7, + 0xF6, 0x55, 0x20, 0x13, 0x80, 0x09, 0x12, 0xF1, 0xCA, 0x91, 0x8F, 0x6F, 0x6A, 0xF9, 0xCC, 0x5F, + 0x1D, 0x70, 0x73, 0x72, 0x71, 0xC6, 0x45, 0xAB, 0xE9, 0x68, 0xCF, 0x6D, 0x1D, 0xAC, 0xA1, 0xDA, + 0xDA, 0x5B, 0x63, 0x78, 0xE1, 0x6B, 0x24, 0x93, 0x8E, 0xDE, 0x9F, 0x87, 0xFC, 0x0F, 0xC8, 0xEA, + 0x3C, 0x31, 0xFB, 0x1D, 0x7E, 0xD6, 0xFA, 0xAE, 0xB1, 0xA7, 0x69, 0x1F, 0xF0, 0x84, 0x78, 0xD3, + 0xC3, 0x90, 0x5E, 0x4C, 0xB6, 0xCB, 0xA9, 0x5E, 0x5E, 0x95, 0xB1, 0xB5, 0x62, 0x40, 0x51, 0x20, + 0x8A, 0x56, 0x65, 0x1C, 0x01, 0x9C, 0x60, 0x71, 0xD2, 0xBE, 0x7F, 0xFD, 0x61, 0xE0, 0xDC, 0xC3, + 0x10, 0xB0, 0x50, 0xC4, 0xD3, 0x4A, 0x56, 0xFB, 0x2D, 0x5D, 0x29, 0x46, 0xFA, 0xB8, 0xC5, 0x25, + 0xCB, 0xCC, 0xDB, 0x72, 0x49, 0x2D, 0xBA, 0x1C, 0x58, 0xBC, 0xBE, 0x94, 0x30, 0xB2, 0x75, 0x30, + 0xAA, 0xA4, 0x56, 0xAE, 0x36, 0x8B, 0xD3, 0xBD, 0x9E, 0x9A, 0x6F, 0xF2, 0xE8, 0xB5, 0x5E, 0xD3, + 0xE1, 0xAF, 0x80, 0x1F, 0xB6, 0xAF, 0x80, 0x75, 0x4B, 0x6B, 0x0B, 0x5D, 0x0F, 0xC6, 0xBA, 0x83, + 0xF8, 0x73, 0xE2, 0x14, 0x71, 0xDC, 0xCA, 0xD7, 0xD1, 0x5D, 0x69, 0x17, 0xF6, 0x4A, 0x55, 0x5E, + 0x54, 0xCB, 0x79, 0xD2, 0x44, 0x59, 0x98, 0x00, 0xAE, 0x4E, 0x06, 0xE0, 0xA0, 0x1E, 0x79, 0x5E, + 0x6D, 0xC2, 0x71, 0xE1, 0x9C, 0x56, 0x03, 0x19, 0x89, 0xA5, 0x1A, 0xB4, 0x73, 0x17, 0x3A, 0x4E, + 0x29, 0xC9, 0xBC, 0x3B, 0xA6, 0xE0, 0x9C, 0x7D, 0xD5, 0x17, 0x28, 0xC9, 0xDE, 0x50, 0x92, 0xB2, + 0xE5, 0xF7, 0xAE, 0x95, 0xA3, 0xE6, 0x4F, 0x2D, 0x4A, 0xAC, 0x1E, 0x1F, 0x08, 0xA3, 0x09, 0x51, + 0xB7, 0xBA, 0xB4, 0x52, 0x4E, 0xF1, 0x8B, 0x49, 0x72, 0xC7, 0x4B, 0xD9, 0xF5, 0x6D, 0xA5, 0x7D, + 0x19, 0x53, 0xC4, 0x3E, 0x0D, 0xFF, 0x00, 0x82, 0x83, 0xDA, 0x78, 0x8B, 0x58, 0x6D, 0x2B, 0xC2, + 0xBE, 0x2D, 0xBB, 0xB3, 0x3A, 0x9C, 0xD3, 0x5A, 0xCF, 0x6B, 0x61, 0x63, 0x3D, 0x91, 0x8E, 0x47, + 0xDE, 0x89, 0x17, 0x9A, 0x77, 0x61, 0x41, 0x03, 0xE6, 0xC9, 0x1D, 0x33, 0xC5, 0x7E, 0x67, 0x8F, + 0xAB, 0xC1, 0x34, 0xEA, 0x4A, 0x32, 0xAF, 0x79, 0x73, 0x36, 0xDF, 0xBC, 0xEF, 0x6B, 0xE9, 0x64, + 0xAC, 0x96, 0xDC, 0xC9, 0x2E, 0x5B, 0xDD, 0x47, 0x45, 0xAF, 0xB5, 0x82, 0xCA, 0x94, 0x30, 0x90, + 0x55, 0x20, 0xD3, 0xE5, 0x57, 0x5A, 0xAB, 0x3B, 0x2B, 0xE9, 0xA5, 0xAD, 0xB2, 0x5E, 0x47, 0xA5, + 0xFC, 0x3A, 0xB3, 0xFD, 0xB9, 0xB4, 0xCD, 0x27, 0x5C, 0xD6, 0xBC, 0x57, 0xF0, 0xC7, 0x5A, 0xD5, + 0xE2, 0xD1, 0xF5, 0x7D, 0x2A, 0x54, 0xF0, 0xC3, 0x69, 0x36, 0x70, 0x5D, 0xF8, 0x82, 0x09, 0x0C, + 0x82, 0xE0, 0xC7, 0x20, 0x73, 0x1A, 0xF9, 0x60, 0x46, 0xD9, 0x6D, 0xBC, 0x1E, 0x33, 0x92, 0x06, + 0x9C, 0x3D, 0xC4, 0x5C, 0x37, 0x94, 0xE5, 0xB9, 0xA4, 0xE8, 0x54, 0xFD, 0xF2, 0xAD, 0x85, 0xA9, + 0x49, 0x72, 0xC9, 0x45, 0xD3, 0x83, 0x92, 0xAB, 0x77, 0x67, 0xB5, 0xD7, 0x2C, 0x53, 0x8B, 0x6D, + 0x75, 0xD2, 0xDE, 0x5E, 0x69, 0x91, 0x57, 0xC4, 0xD5, 0xA3, 0x4B, 0x0A, 0x9A, 0x87, 0x24, 0xD4, + 0xA4, 0xDA, 0xD1, 0xD9, 0x38, 0xF6, 0x96, 0xBB, 0x5E, 0x29, 0xD9, 0x36, 0xAC, 0x91, 0x06, 0x9D, + 0x37, 0xED, 0x85, 0x19, 0x57, 0xBC, 0xFD, 0x9F, 0x3C, 0x50, 0x64, 0x69, 0x67, 0x73, 0x1D, 0x96, + 0x9B, 0xA5, 0x2C, 0x69, 0x13, 0x37, 0xEE, 0x02, 0x31, 0x91, 0x4E, 0x54, 0x10, 0x1B, 0xA0, 0xF4, + 0xEB, 0xC7, 0xCC, 0xCF, 0x17, 0xC3, 0x70, 0x6A, 0x4B, 0x15, 0x52, 0x49, 0xAE, 0x69, 0x59, 0xD9, + 0x5D, 0xB6, 0xED, 0x14, 0xE1, 0x65, 0x6B, 0x6B, 0x76, 0xFA, 0x25, 0x75, 0x76, 0x77, 0xC7, 0x25, + 0xE5, 0x51, 0x54, 0x92, 0x4A, 0xCA, 0xEA, 0xCD, 0x59, 0xA5, 0xD2, 0xC9, 0xDD, 0x37, 0xDD, 0x26, + 0x97, 0x7D, 0x0D, 0x19, 0x75, 0x4F, 0xDB, 0x58, 0x0B, 0x58, 0xB4, 0xBF, 0xD9, 0xC3, 0x5C, 0x9A, + 0x34, 0x85, 0xBE, 0xD0, 0x75, 0x38, 0x6D, 0xA2, 0xF9, 0xC8, 0x1B, 0x44, 0x62, 0x3B, 0x8C, 0x60, + 0x0E, 0xC7, 0x9A, 0xF6, 0x72, 0xAC, 0xB7, 0x86, 0x33, 0x5A, 0xF0, 0xA3, 0x2C, 0x45, 0x58, 0xB7, + 0x16, 0xDB, 0x6A, 0x09, 0x37, 0x18, 0xB7, 0x64, 0xDA, 0x82, 0x57, 0xB3, 0xF7, 0x5B, 0xBD, 0xAC, + 0xB7, 0x57, 0x2E, 0x79, 0x5D, 0x7A, 0x71, 0x4E, 0x12, 0x4B, 0x6D, 0x2D, 0x7E, 0xDB, 0x2B, 0xA6, + 0xB4, 0xD2, 0xFA, 0xFA, 0x25, 0xA0, 0xE8, 0x35, 0xCF, 0xDB, 0x41, 0x2D, 0xEE, 0x3E, 0xD3, 0xFB, + 0x2F, 0xDF, 0x49, 0x20, 0xDA, 0xB6, 0xD1, 0xAC, 0xB1, 0x34, 0x72, 0xB3, 0x30, 0xDC, 0xAE, 0xDE, + 0x78, 0xDB, 0xF2, 0x9C, 0x83, 0x86, 0x07, 0x81, 0x81, 0x9C, 0x8F, 0x26, 0xAD, 0x0E, 0x1D, 0xA3, + 0xC9, 0x37, 0x56, 0xA4, 0xA0, 0xEC, 0xD2, 0x4A, 0x29, 0xDA, 0xF6, 0xF7, 0x6F, 0x2B, 0x5E, 0xEB, + 0x76, 0xD5, 0x92, 0xBD, 0xAC, 0x8D, 0xBF, 0xB2, 0xAA, 0x37, 0x18, 0xDF, 0x47, 0xA5, 0xF6, 0xB2, + 0x49, 0xDB, 0x44, 0xAC, 0xF6, 0x4B, 0x4B, 0x77, 0xEC, 0x89, 0xE2, 0xD7, 0xBF, 0x6C, 0xA5, 0xE1, + 0xBF, 0x65, 0x0D, 0x46, 0x28, 0xCC, 0x04, 0xC4, 0xB1, 0x6A, 0xF0, 0xE4, 0xB0, 0x18, 0x48, 0xD8, + 0x19, 0x38, 0xE7, 0xA9, 0xC7, 0x00, 0xD7, 0x1E, 0x2D, 0xE4, 0x90, 0x49, 0xE0, 0x69, 0xD7, 0xE5, + 0xB6, 0x89, 0xCA, 0x83, 0x77, 0xFF, 0x00, 0xB7, 0x65, 0xA2, 0x4A, 0xDB, 0xA5, 0x6E, 0xD6, 0xB0, + 0xD6, 0x52, 0xF6, 0xE6, 0x76, 0xDB, 0x45, 0x64, 0xBC, 0xFE, 0x1D, 0x52, 0xD3, 0x4D, 0xDE, 0xD7, + 0xDA, 0xDE, 0x37, 0xF1, 0x73, 0xC0, 0x7F, 0xB5, 0xFF, 0x00, 0xC5, 0x5D, 0x1E, 0x3B, 0x0B, 0xDF, + 0xD9, 0xCF, 0x58, 0xD2, 0x06, 0xD5, 0x42, 0x6D, 0xAE, 0x21, 0xBA, 0x95, 0x48, 0x60, 0xC5, 0x46, + 0xE9, 0x02, 0xFF, 0x00, 0x08, 0xE7, 0xA7, 0x6E, 0xBD, 0x3E, 0x97, 0x0F, 0x5F, 0x86, 0x72, 0x4C, + 0xA6, 0x95, 0x78, 0x62, 0xDD, 0x5A, 0xD5, 0x21, 0x17, 0x3A, 0x4D, 0x72, 0x3A, 0x72, 0x69, 0x2E, + 0x55, 0x26, 0x9C, 0x24, 0x96, 0xD7, 0x8B, 0xB6, 0x9A, 0x6C, 0xCF, 0x32, 0x7C, 0x35, 0xED, 0x73, + 0x5A, 0x39, 0x85, 0x49, 0xBE, 0x5A, 0x5C, 0xDC, 0xA9, 0x2D, 0x1F, 0x32, 0xE5, 0x57, 0x7B, 0xD9, + 0x2B, 0x24, 0x92, 0x5D, 0x3A, 0x1D, 0xF7, 0x82, 0x47, 0xED, 0x57, 0xE0, 0xDF, 0x03, 0xAE, 0x83, + 0x17, 0xEC, 0xBF, 0xE2, 0x9B, 0xED, 0x6E, 0xCA, 0xE2, 0x2F, 0xB3, 0x5E, 0xB6, 0xA5, 0x6D, 0x6F, + 0xA5, 0xC9, 0x6E, 0x10, 0x09, 0x51, 0xE0, 0x04, 0xB8, 0x93, 0x76, 0xD2, 0x18, 0x30, 0x5C, 0x64, + 0x11, 0xEB, 0xE0, 0xF1, 0x0E, 0x6B, 0xC2, 0xD8, 0xF9, 0xAC, 0x46, 0x57, 0x3A, 0xB1, 0x94, 0x62, + 0xF9, 0xA3, 0x34, 0xA4, 0xA5, 0x25, 0xB2, 0x87, 0x2C, 0x52, 0x4B, 0xB3, 0x95, 0xBE, 0x57, 0x49, + 0x4E, 0x57, 0xC3, 0x71, 0xCB, 0x29, 0x3C, 0x32, 0xA9, 0xCD, 0x07, 0x26, 0xD3, 0x6B, 0x54, 0x9B, + 0x6E, 0xCF, 0xA3, 0x4B, 0xC9, 0x27, 0xB6, 0x87, 0xD4, 0xFF, 0x00, 0x09, 0x3E, 0x0A, 0x7E, 0xD9, + 0xDF, 0x16, 0x3E, 0x1E, 0x78, 0xB3, 0xE2, 0x19, 0xF0, 0x27, 0x82, 0x7E, 0x1D, 0xC1, 0xE1, 0x0B, + 0x99, 0xED, 0x2E, 0xBC, 0x39, 0xE2, 0xD5, 0xD5, 0xEE, 0xB5, 0x5B, 0xF5, 0x8A, 0xCB, 0xCE, 0x8E, + 0x58, 0x66, 0xB5, 0xB6, 0x92, 0x00, 0x24, 0x60, 0x22, 0x55, 0x67, 0x04, 0x36, 0x09, 0x01, 0x4D, + 0x7C, 0xBA, 0xAE, 0xAA, 0x51, 0x95, 0x6C, 0x34, 0x63, 0xC9, 0x1D, 0xD4, 0x9A, 0x8C, 0xAD, 0xA6, + 0xAA, 0x36, 0x77, 0x8E, 0xA9, 0x2E, 0xBE, 0x5A, 0x5C, 0xF6, 0x16, 0x53, 0x47, 0x48, 0xA9, 0xBD, + 0x7E, 0x5F, 0x24, 0xBC, 0xAD, 0xD2, 0xD6, 0xFC, 0x17, 0x90, 0xFC, 0x2A, 0xF8, 0xF1, 0xFF, 0x00, + 0x05, 0x25, 0xF8, 0x1F, 0xE3, 0x7D, 0x23, 0xE2, 0x2F, 0xC3, 0x2F, 0x81, 0x17, 0xBE, 0x1C, 0xF1, + 0x0D, 0x8D, 0xBB, 0xD9, 0x5C, 0x21, 0x78, 0xEF, 0x74, 0xED, 0x7A, 0xC6, 0xE5, 0x76, 0xDE, 0x69, + 0x5A, 0x9D, 0xA9, 0x98, 0x47, 0x73, 0x65, 0x3C, 0x65, 0x92, 0x5B, 0x79, 0x55, 0x91, 0x94, 0x9C, + 0x8C, 0x1C, 0x57, 0x4C, 0xEA, 0x61, 0x29, 0xE1, 0xE9, 0xD5, 0x55, 0xE3, 0xED, 0x1A, 0x4F, 0x95, + 0x6B, 0xCA, 0xEC, 0xAD, 0x19, 0x5A, 0x3A, 0x6B, 0xBA, 0xBF, 0x46, 0xD3, 0xE8, 0x4C, 0x72, 0xB5, + 0x4A, 0x49, 0xAA, 0x9E, 0xEF, 0x9C, 0x5B, 0xBA, 0xF9, 0x49, 0x59, 0x76, 0x56, 0x5E, 0x5D, 0x2D, + 0xF7, 0x57, 0xED, 0x1B, 0xF0, 0x9F, 0xE2, 0x8F, 0xC6, 0x9F, 0x83, 0x1A, 0x8F, 0xED, 0x87, 0xFB, + 0x1D, 0x7C, 0x16, 0xBA, 0xF0, 0x3D, 0xD6, 0x9F, 0x1C, 0x36, 0x9F, 0xB4, 0x7F, 0xEC, 0x85, 0xAD, + 0xE9, 0x12, 0x6A, 0x3A, 0x97, 0xC0, 0x7D, 0x56, 0xF9, 0x0A, 0xDB, 0x6B, 0x5E, 0x17, 0xD4, 0x84, + 0x8A, 0x35, 0x1D, 0x06, 0xEE, 0x68, 0x26, 0x65, 0x5C, 0x17, 0xB5, 0x3B, 0xCC, 0xBE, 0x4C, 0x61, + 0x11, 0x7D, 0xBE, 0x1A, 0xCD, 0x72, 0x3C, 0x0F, 0xD6, 0xEB, 0x66, 0x33, 0x77, 0x95, 0x0A, 0xB0, + 0x82, 0x8A, 0x6A, 0xD5, 0x64, 0xAD, 0x4B, 0x97, 0x7B, 0xC6, 0xFA, 0x36, 0xD4, 0x52, 0x5E, 0xF5, + 0xD3, 0xF7, 0x4E, 0x2C, 0x46, 0x59, 0xED, 0x2B, 0x28, 0x4E, 0x2D, 0x46, 0x4F, 0x46, 0xB9, 0x6D, + 0x65, 0x6B, 0xA7, 0x17, 0x14, 0x96, 0x9A, 0xD9, 0x75, 0x69, 0x45, 0x1F, 0x90, 0xF7, 0x30, 0xFF, + 0x00, 0xC1, 0x44, 0x6E, 0x31, 0xE5, 0xFC, 0x21, 0xBF, 0xB5, 0x50, 0xA0, 0x6D, 0x83, 0x45, 0xB4, + 0xC1, 0xC0, 0xF7, 0xB8, 0x3D, 0x78, 0xAF, 0x83, 0x79, 0x9E, 0x35, 0xC5, 0x46, 0x34, 0xE2, 0x97, + 0xA7, 0xA5, 0xBA, 0xF4, 0x6A, 0xEB, 0xFC, 0xB4, 0x3D, 0x3A, 0x59, 0x26, 0x55, 0x4D, 0x5B, 0x99, + 0xDF, 0xA6, 0xEA, 0xDF, 0x72, 0xFF, 0x00, 0x81, 0xF7, 0x23, 0xD3, 0xBE, 0x18, 0x6B, 0xFF, 0x00, + 0xB7, 0x25, 0x9B, 0xA7, 0x83, 0xBE, 0x31, 0x7C, 0x19, 0xF1, 0x97, 0x8C, 0x3E, 0x17, 0xDF, 0x07, + 0x87, 0xC8, 0xD3, 0x6C, 0xEC, 0x6C, 0xBC, 0x49, 0xE0, 0x39, 0xA5, 0xC8, 0x3A, 0xA6, 0x89, 0x38, + 0x94, 0x1F, 0x31, 0x0B, 0x06, 0x68, 0x18, 0x98, 0xE5, 0x0A, 0x54, 0x85, 0x27, 0x70, 0xDA, 0x86, + 0x6F, 0x8D, 0x52, 0xE5, 0xC4, 0xC5, 0xBA, 0x69, 0x5A, 0xC9, 0xDB, 0xB6, 0xD7, 0x7E, 0x56, 0xD7, + 0xBB, 0xB7, 0x44, 0x6D, 0x1C, 0xA7, 0x2B, 0x85, 0x17, 0x4D, 0xB7, 0x24, 0xD6, 0xCF, 0x4B, 0x7A, + 0x59, 0x2B, 0x69, 0xDA, 0xCB, 0x6E, 0xCA, 0xDE, 0x6D, 0xF1, 0x8F, 0xF6, 0x67, 0xFD, 0xBA, 0x7C, + 0x2B, 0xAD, 0x45, 0x2F, 0x84, 0xAE, 0x7C, 0x75, 0xF1, 0x13, 0xC0, 0x9A, 0xD4, 0x6D, 0x77, 0xE1, + 0x5F, 0x15, 0xE8, 0xB6, 0xF0, 0xE8, 0x4F, 0x2C, 0x41, 0xF8, 0xB7, 0xBF, 0xB4, 0x6D, 0x8F, 0x05, + 0xD2, 0x0C, 0xAB, 0xC6, 0x72, 0x32, 0x19, 0x94, 0xB2, 0x90, 0x4A, 0xAD, 0x8E, 0xCC, 0xE8, 0xCA, + 0x2E, 0x8D, 0x44, 0xE9, 0xDE, 0xE9, 0x59, 0x6C, 0xAD, 0xA6, 0x96, 0xB2, 0x5B, 0x69, 0xD3, 0x45, + 0x6D, 0x05, 0x0C, 0x9F, 0x26, 0xF6, 0x3C, 0x95, 0xA8, 0xEB, 0x6B, 0x27, 0xCD, 0x25, 0x65, 0x65, + 0x6B, 0xDB, 0x7D, 0x2E, 0xB9, 0x6F, 0xA3, 0xD7, 0x54, 0x8F, 0x2A, 0xF0, 0xE7, 0xC2, 0x7F, 0xF8, + 0x28, 0x17, 0x85, 0x5F, 0x58, 0x9F, 0x46, 0xF0, 0x67, 0xC4, 0xA8, 0xAE, 0xF5, 0xFF, 0x00, 0x0F, + 0x5F, 0xF8, 0x57, 0x55, 0xBA, 0xB9, 0xBC, 0x82, 0xFA, 0x5B, 0x8B, 0x0D, 0x4A, 0x25, 0x4B, 0xA8, + 0x00, 0x92, 0x76, 0x55, 0xCA, 0xA7, 0x0C, 0xA0, 0x32, 0xEE, 0x6C, 0x11, 0x93, 0x99, 0xFE, 0xD6, + 0xCC, 0x7E, 0xAE, 0xA8, 0xDB, 0xDE, 0xBB, 0x69, 0xE8, 0xAC, 0xAC, 0xAC, 0x92, 0x56, 0x5A, 0x35, + 0x77, 0x7B, 0xDF, 0x4D, 0x34, 0x46, 0xD0, 0xCB, 0xF2, 0xBA, 0x72, 0x52, 0xA3, 0x05, 0x17, 0x64, + 0x9D, 0xA3, 0xAB, 0x4B, 0xA3, 0xBA, 0x77, 0x4F, 0x66, 0xB6, 0xB1, 0xE4, 0xD3, 0x7E, 0xC6, 0xBF, + 0xB5, 0x8D, 0xC1, 0xCC, 0xFF, 0x00, 0x07, 0x7C, 0x6B, 0x39, 0xC6, 0x33, 0x34, 0x96, 0xF2, 0x1C, + 0x63, 0xA6, 0x4C, 0xD5, 0xE5, 0x4B, 0xEB, 0x73, 0x4A, 0x32, 0x94, 0x9A, 0xF3, 0x7F, 0xF0, 0x4E, + 0xEA, 0x7F, 0x52, 0xA4, 0x92, 0xA7, 0x18, 0xA5, 0xE5, 0x1B, 0x7E, 0x48, 0xAF, 0xFF, 0x00, 0x0C, + 0x55, 0xFB, 0x53, 0xFF, 0x00, 0xD1, 0x14, 0xF1, 0x77, 0xFD, 0xF3, 0x6B, 0xFF, 0x00, 0xC7, 0x6B, + 0x1F, 0x61, 0x53, 0xF9, 0x4D, 0x7D, 0xBD, 0x1E, 0xFF, 0x00, 0x83, 0xFF, 0x00, 0x20, 0xFF, 0x00, + 0x86, 0x2A, 0xFD, 0xA9, 0xFF, 0x00, 0xE8, 0x8A, 0x78, 0xBB, 0xFE, 0xF9, 0xB5, 0xFF, 0x00, 0xE3, + 0xB4, 0x7B, 0x0A, 0x9F, 0xCA, 0x1E, 0xDE, 0x8F, 0x7F, 0xC1, 0xFF, 0x00, 0x90, 0x7F, 0xC3, 0x15, + 0x7E, 0xD4, 0xFF, 0x00, 0xF4, 0x45, 0x3C, 0x5D, 0xFF, 0x00, 0x7C, 0xDA, 0xFF, 0x00, 0xF1, 0xDA, + 0x3D, 0x85, 0x4F, 0xE5, 0x0F, 0x6F, 0x47, 0xBF, 0xE0, 0xFF, 0x00, 0xC8, 0x3F, 0xE1, 0x8A, 0xBF, + 0x6A, 0x7F, 0xFA, 0x22, 0x9E, 0x2E, 0xFF, 0x00, 0xBE, 0x6D, 0x7F, 0xF8, 0xED, 0x1E, 0xC2, 0xA7, + 0xF2, 0x87, 0xB7, 0xA3, 0xDF, 0xF0, 0x7F, 0xE4, 0x3E, 0x2F, 0xD8, 0xA3, 0xF6, 0xA5, 0x77, 0x44, + 0x6F, 0x83, 0x1E, 0x2A, 0x85, 0x49, 0x00, 0xC8, 0xEB, 0x6D, 0xB2, 0x30, 0x07, 0x24, 0x85, 0x94, + 0x9E, 0xDD, 0x81, 0xAD, 0x21, 0x4A, 0x5C, 0xAA, 0x9C, 0xA0, 0x92, 0x6D, 0x6A, 0xEE, 0x9A, 0x4B, + 0xA6, 0x9A, 0x24, 0xFD, 0x1E, 0xCB, 0xA6, 0x84, 0xBA, 0xF4, 0x56, 0xB7, 0xD1, 0x74, 0x49, 0xFF, + 0x00, 0x91, 0xD4, 0xEB, 0xDF, 0xB1, 0x77, 0xED, 0x1B, 0x62, 0xB6, 0x3A, 0x66, 0x81, 0xF0, 0x97, + 0xC4, 0xBA, 0xCD, 0xBD, 0xBD, 0xB8, 0x96, 0x7D, 0x5E, 0x2D, 0x31, 0x74, 0xC6, 0xB8, 0x92, 0x4E, + 0x5A, 0x26, 0x8A, 0x59, 0xB2, 0x7C, 0xB2, 0x0A, 0x86, 0x00, 0x02, 0x30, 0x47, 0xBF, 0xDB, 0x50, + 0xE2, 0x8A, 0xB9, 0x6E, 0x55, 0x1C, 0xAF, 0x2D, 0x83, 0x71, 0xBE, 0xBC, 0xD6, 0xB3, 0xB6, 0x89, + 0xAB, 0x59, 0xAB, 0x2B, 0x2B, 0x5A, 0xDB, 0x6B, 0xEE, 0xA4, 0x71, 0x42, 0x95, 0x19, 0x55, 0x95, + 0x79, 0x4D, 0xEB, 0xD1, 0xAD, 0x12, 0x5B, 0x59, 0x6B, 0x6B, 0xF5, 0xDB, 0xB5, 0xB4, 0x39, 0x33, + 0xFB, 0x15, 0xFE, 0xD4, 0xE7, 0x9F, 0xF8, 0x52, 0xBE, 0x2E, 0xFF, 0x00, 0xBE, 0x6D, 0x7D, 0x38, + 0x00, 0x79, 0xDE, 0xC2, 0xBE, 0x32, 0xBB, 0xC4, 0xE2, 0x6A, 0xCA, 0xB5, 0x54, 0xDC, 0x9F, 0xF5, + 0x65, 0xE4, 0xB6, 0x4B, 0xA2, 0xD0, 0xEE, 0x85, 0x5A, 0x10, 0x8A, 0x8A, 0x7A, 0x2F, 0x2F, 0xF8, + 0x01, 0xFF, 0x00, 0x0C, 0x55, 0xFB, 0x53, 0xFF, 0x00, 0xD1, 0x14, 0xF1, 0x77, 0xFD, 0xF3, 0x6B, + 0xFF, 0x00, 0xC7, 0x6B, 0x0F, 0x61, 0x53, 0xF9, 0x47, 0xED, 0xE8, 0xF7, 0xFC, 0x1F, 0xF9, 0x02, + 0xFE, 0xC5, 0x3F, 0xB5, 0x39, 0x2A, 0xAB, 0xF0, 0x53, 0xC5, 0xD9, 0x38, 0x0A, 0x02, 0xDA, 0xFA, + 0x70, 0x00, 0xF3, 0x7D, 0xAA, 0xA1, 0x86, 0xA9, 0x29, 0x46, 0x16, 0xB5, 0xEC, 0xB5, 0xB2, 0x4B, + 0xA7, 0xF5, 0xE4, 0x1E, 0xDE, 0x8A, 0x49, 0x27, 0xF8, 0x3F, 0xF2, 0x3B, 0x4D, 0x2B, 0xF6, 0x21, + 0xFD, 0xA7, 0x6D, 0xA1, 0x43, 0x27, 0xC1, 0x9F, 0x16, 0x23, 0x30, 0x0E, 0xE0, 0xAD, 0xA9, 0xC6, + 0x00, 0xE9, 0xFB, 0xDE, 0xD9, 0x1F, 0x4A, 0xFE, 0xDF, 0xF0, 0x73, 0x07, 0xE1, 0xDE, 0x41, 0x91, + 0xD2, 0xC4, 0xE2, 0xF3, 0x08, 0x46, 0xAC, 0x9C, 0x5D, 0x45, 0xCB, 0x26, 0xD4, 0x9A, 0xB2, 0xB7, + 0xBB, 0x76, 0xB4, 0xB7, 0xBA, 0xAD, 0xA7, 0xDF, 0xF3, 0x98, 0xF9, 0xE2, 0x6A, 0x54, 0x71, 0x8C, + 0x34, 0xD9, 0x6D, 0xF7, 0x7E, 0x1B, 0x76, 0x47, 0x48, 0xBF, 0xB1, 0xDF, 0xED, 0x2F, 0x6A, 0x9E, + 0x6B, 0xFC, 0x19, 0xF1, 0x6B, 0x2C, 0x63, 0x6E, 0xD4, 0x8E, 0xD1, 0x8A, 0x92, 0xBF, 0x29, 0xDA, + 0x64, 0x20, 0x81, 0x8C, 0x9E, 0x3A, 0x0A, 0xFE, 0x9C, 0xCD, 0x7C, 0x59, 0xF0, 0xD3, 0x87, 0x72, + 0x9F, 0x6C, 0xB3, 0x28, 0x4A, 0x6E, 0x29, 0x45, 0x28, 0xD4, 0x6D, 0x5E, 0xC9, 0x4F, 0xDD, 0x8D, + 0xFD, 0xCD, 0x65, 0xBA, 0xBF, 0x2D, 0x92, 0x68, 0xF2, 0xF0, 0xF8, 0x2C, 0x44, 0xEB, 0x24, 0xE0, + 0xED, 0xE5, 0x6E, 0xDB, 0x6A, 0x9A, 0xED, 0xA5, 0xBE, 0xE3, 0x90, 0x97, 0xF6, 0x37, 0xFD, 0xA9, + 0xE5, 0x95, 0xA4, 0x6F, 0x82, 0xFE, 0x30, 0x56, 0x97, 0xF7, 0x45, 0xB6, 0xDB, 0x61, 0x63, 0x07, + 0x02, 0x6D, 0x9E, 0x6F, 0xD0, 0x00, 0x31, 0x8A, 0xFE, 0x2D, 0xCF, 0x3C, 0x44, 0xFE, 0xDD, 0xE2, + 0x58, 0xE7, 0x0F, 0x32, 0xF6, 0x70, 0xAC, 0xEA, 0xD0, 0xAB, 0x78, 0xD5, 0x9F, 0x35, 0x08, 0xA6, + 0xE1, 0x8E, 0x51, 0x4A, 0xCB, 0x95, 0x45, 0xDA, 0x9A, 0x8F, 0x3A, 0x4D, 0xDE, 0xCA, 0x37, 0x3D, + 0xBA, 0x78, 0x5F, 0x65, 0x4E, 0x34, 0xD4, 0x55, 0x92, 0xE6, 0x4A, 0xCB, 0x7B, 0x2F, 0x76, 0xFA, + 0x5B, 0xF2, 0x7A, 0x24, 0x49, 0x6B, 0xFB, 0x1A, 0x7E, 0xD4, 0x71, 0x8B, 0x58, 0x8F, 0xC1, 0xDF, + 0x1B, 0x47, 0x1D, 0xBC, 0xE1, 0xF1, 0x11, 0xB6, 0x12, 0xC6, 0x49, 0x01, 0xA5, 0x45, 0x32, 0xE0, + 0x96, 0x05, 0x06, 0x39, 0xC0, 0xC5, 0x63, 0x82, 0xE2, 0xBE, 0x1D, 0xA1, 0x94, 0x61, 0x30, 0x78, + 0x0C, 0xC9, 0xD3, 0xAB, 0x4A, 0xAF, 0x32, 0x9B, 0xF6, 0xD3, 0x9C, 0x1C, 0x54, 0xB9, 0xF1, 0x5E, + 0xCD, 0x46, 0xD5, 0x3E, 0xB1, 0x1E, 0x58, 0xBA, 0x49, 0xB7, 0x49, 0x2B, 0xD9, 0x37, 0x63, 0x49, + 0x47, 0x18, 0xAE, 0xE8, 0xAD, 0x52, 0xF7, 0x56, 0xC9, 0x5D, 0x2D, 0x34, 0x69, 0xAB, 0x77, 0x56, + 0xBA, 0xF2, 0x1B, 0xA2, 0xFE, 0xC7, 0xFF, 0x00, 0xB5, 0x45, 0xBC, 0xE2, 0xD1, 0xFE, 0x0A, 0xF8, + 0xA4, 0xDB, 0xEE, 0x67, 0x69, 0x59, 0x2D, 0x54, 0x82, 0x4F, 0x20, 0x9F, 0x3B, 0xDE, 0xBE, 0x9B, + 0xC0, 0xCF, 0x19, 0xBF, 0xD5, 0x8C, 0xF2, 0x8F, 0x06, 0xE3, 0xE7, 0x45, 0xE5, 0xD3, 0xA9, 0x39, + 0x7B, 0x69, 0xC6, 0x51, 0x97, 0x35, 0x49, 0xCA, 0x4D, 0x49, 0xDB, 0x5D, 0x5D, 0xD3, 0xB2, 0x4B, + 0x45, 0xBA, 0x39, 0xB3, 0x0C, 0x0C, 0x2B, 0x41, 0xD5, 0xA7, 0x7E, 0x74, 0xB6, 0x5B, 0x59, 0x24, + 0xBD, 0x11, 0xD5, 0xCF, 0xFB, 0x18, 0x7E, 0xD3, 0x4E, 0xB2, 0xC2, 0xDF, 0x06, 0x7C, 0x56, 0x23, + 0x64, 0x11, 0x3F, 0xCD, 0x68, 0xD1, 0xE0, 0x9C, 0x00, 0x3F, 0x7B, 0xEC, 0x31, 0xED, 0xED, 0x5F, + 0xD6, 0x79, 0xF7, 0x1D, 0xF8, 0x61, 0x9B, 0xC3, 0x13, 0x90, 0x55, 0xCC, 0x23, 0xEC, 0xAB, 0xC5, + 0xD1, 0x9A, 0x6D, 0xCA, 0x0D, 0x3B, 0x49, 0xD9, 0x28, 0x68, 0xD5, 0x95, 0xDB, 0xDB, 0x6B, 0xDF, + 0x43, 0xC4, 0xA3, 0x87, 0xC5, 0x53, 0xE5, 0xA8, 0xA3, 0xAA, 0xDB, 0x6E, 0xDF, 0x75, 0xBF, 0x0E, + 0x85, 0x0B, 0x4F, 0xD8, 0xDF, 0xF6, 0xA2, 0x0D, 0xF6, 0x39, 0x3E, 0x0C, 0xF8, 0xB3, 0xF7, 0x20, + 0x24, 0x6E, 0x12, 0xDB, 0x12, 0xA6, 0x7E, 0x42, 0xC7, 0xCD, 0xC0, 0xF4, 0xC7, 0xB5, 0x7C, 0x07, + 0x08, 0xF8, 0xA5, 0xC3, 0x18, 0x4C, 0x45, 0x5E, 0x0E, 0xCE, 0xB3, 0x18, 0xF3, 0x61, 0x14, 0xA3, + 0x09, 0xA5, 0x36, 0xAB, 0x51, 0x8A, 0xE6, 0x84, 0xE5, 0x25, 0x0E, 0x55, 0x28, 0xC6, 0xD0, 0xE5, + 0xBB, 0x6F, 0x97, 0x6D, 0x51, 0xD5, 0x5F, 0x07, 0x55, 0xC6, 0x35, 0xE9, 0xC3, 0x47, 0x6B, 0xAD, + 0x15, 0x9D, 0xB5, 0x4B, 0xBF, 0xCB, 0x62, 0x76, 0xFD, 0x8D, 0xBF, 0x69, 0xD0, 0x31, 0xFF, 0x00, + 0x0A, 0x6B, 0xC5, 0x43, 0x68, 0x1F, 0x2E, 0x2D, 0x46, 0x30, 0x3A, 0x63, 0xCD, 0x1D, 0xB1, 0xC7, + 0xA6, 0x2B, 0xE8, 0xEB, 0x78, 0x9F, 0xC0, 0x73, 0x84, 0x79, 0x33, 0x08, 0xF4, 0x4A, 0xD1, 0xA9, + 0xE9, 0x67, 0x68, 0xAF, 0x4B, 0x37, 0xF3, 0xDC, 0xCE, 0x38, 0x2C, 0x4A, 0x4B, 0xDC, 0xD3, 0xE5, + 0xFD, 0x7C, 0xAD, 0xB7, 0x90, 0xC3, 0xFB, 0x19, 0xFE, 0xD3, 0xF9, 0x20, 0x7C, 0x19, 0xF1, 0x57, + 0xCB, 0x90, 0x57, 0xFD, 0x10, 0x30, 0x00, 0xE3, 0x21, 0x7C, 0xEE, 0x9E, 0xF8, 0xC7, 0x07, 0xD3, + 0x8F, 0x23, 0x11, 0xE2, 0x5F, 0x03, 0x2F, 0x7D, 0x66, 0x10, 0xB3, 0x5A, 0x7B, 0xB3, 0xEB, 0xE4, + 0xA1, 0xA5, 0xBB, 0x5A, 0x36, 0x56, 0xD1, 0x68, 0x5A, 0xC2, 0xD6, 0x51, 0xD2, 0x3A, 0x2F, 0x4E, + 0x8B, 0xB7, 0xF5, 0xDB, 0xC8, 0x83, 0xFE, 0x18, 0xCB, 0xF6, 0xA1, 0x24, 0x2A, 0xFC, 0x18, 0xF1, + 0x6F, 0xCA, 0x07, 0xCB, 0xB2, 0xDB, 0x80, 0x46, 0x47, 0x1E, 0x6F, 0x70, 0x2B, 0xE7, 0xAB, 0x78, + 0x8F, 0xC1, 0x13, 0x92, 0x8C, 0x71, 0xF0, 0xB6, 0xAB, 0xE1, 0x9F, 0x7E, 0x96, 0x8A, 0x5D, 0x35, + 0xED, 0xA7, 0x95, 0xF5, 0x8E, 0x13, 0x11, 0x15, 0xF0, 0x69, 0xA7, 0x6F, 0xEB, 0xFE, 0x1A, 0xC2, + 0xAF, 0xEC, 0x65, 0xFB, 0x4F, 0xE0, 0x2F, 0xFC, 0x29, 0x9F, 0x15, 0x8D, 0xA7, 0x18, 0x02, 0xD7, + 0x3C, 0x11, 0xD0, 0x79, 0xBD, 0x3E, 0x61, 0x5D, 0x31, 0xF1, 0x1B, 0x81, 0x54, 0x23, 0x2A, 0x99, + 0x8C, 0x54, 0x55, 0xAD, 0xEE, 0xCD, 0xD9, 0xAD, 0x56, 0xD1, 0x7A, 0x75, 0xE9, 0x6F, 0x42, 0x56, + 0x0F, 0x11, 0xA5, 0xA1, 0xF9, 0x7C, 0xBF, 0x2F, 0xCB, 0xBA, 0x35, 0xB4, 0x7F, 0xD9, 0x6B, 0xF6, + 0xC4, 0xF0, 0x86, 0xA7, 0x6D, 0xE2, 0x4F, 0x0A, 0xFC, 0x2E, 0xF1, 0x96, 0x93, 0xAC, 0x59, 0x9D, + 0x91, 0x49, 0x6C, 0xD6, 0xBB, 0x25, 0x03, 0x19, 0x8A, 0x54, 0xF3, 0xB0, 0xC0, 0xE0, 0x0D, 0xA4, + 0x7A, 0x63, 0x9C, 0x57, 0xE6, 0x3E, 0x34, 0xE6, 0x3C, 0x19, 0xC6, 0x59, 0x42, 0xCC, 0xE9, 0x66, + 0x10, 0x58, 0xEA, 0x49, 0x7B, 0x34, 0xA3, 0x26, 0x9A, 0xB2, 0xD1, 0xBE, 0x54, 0x92, 0x76, 0xD7, + 0x6B, 0x6F, 0x75, 0xA3, 0x3A, 0x70, 0x54, 0x2A, 0x42, 0x4A, 0x94, 0xE9, 0xDE, 0x1F, 0x2B, 0xAF, + 0x4F, 0xEB, 0x6E, 0x87, 0xE8, 0x47, 0xC2, 0x7F, 0x8C, 0x1F, 0xB5, 0xEF, 0x86, 0x6D, 0x2D, 0xED, + 0x3C, 0x65, 0xFB, 0x3B, 0xFC, 0x45, 0x8A, 0xEE, 0xDD, 0x04, 0x4F, 0xAA, 0x78, 0x5E, 0xE6, 0xCD, + 0xD2, 0x72, 0xAB, 0x82, 0x5A, 0xDA, 0x49, 0xD7, 0x6E, 0x4A, 0x8E, 0x8C, 0xDD, 0xBF, 0x0F, 0xE5, + 0x4C, 0x2F, 0x15, 0xE2, 0xF0, 0xB0, 0xF6, 0x35, 0x63, 0xCF, 0x14, 0xED, 0x66, 0x94, 0x96, 0x8E, + 0xDA, 0x3D, 0x1B, 0x56, 0xD9, 0x34, 0xAC, 0xBA, 0xBD, 0x08, 0xC4, 0xF0, 0xFE, 0x0E, 0xAC, 0xB9, + 0xE8, 0xCF, 0x92, 0x5D, 0x5A, 0xBA, 0x7A, 0x2B, 0x2B, 0xD9, 0x34, 0xFB, 0x76, 0xB6, 0xDA, 0x33, + 0xE9, 0xA5, 0xFD, 0xA6, 0xBE, 0x3A, 0x2D, 0xBA, 0xAF, 0xFC, 0x29, 0xEF, 0x8E, 0x45, 0x92, 0x35, + 0x0B, 0x11, 0xF0, 0xEE, 0x96, 0xDC, 0xAA, 0xE0, 0x0F, 0x30, 0xDD, 0xFB, 0x01, 0xC6, 0x3E, 0xBC, + 0x66, 0xBD, 0x4F, 0xF5, 0xBB, 0x02, 0xE9, 0xB6, 0xF0, 0xD1, 0xE7, 0xD7, 0x4F, 0x7B, 0x7E, 0xC9, + 0x25, 0x6B, 0x75, 0xF8, 0x92, 0xFD, 0x38, 0x7F, 0xB0, 0x2B, 0xD9, 0x47, 0xEB, 0x12, 0xB5, 0xB7, + 0xD3, 0x4F, 0x35, 0xDB, 0xC9, 0x2B, 0x5A, 0xFA, 0x2D, 0x11, 0xF3, 0xD7, 0xC5, 0x1F, 0x8D, 0x5F, + 0xB5, 0x8E, 0xB9, 0x67, 0x71, 0x6F, 0xE0, 0xCF, 0xD9, 0xDB, 0xE2, 0x5D, 0xDD, 0xF4, 0x91, 0xEC, + 0x87, 0x54, 0xF1, 0x4C, 0xF6, 0x30, 0x43, 0x01, 0x20, 0x02, 0xEB, 0x6F, 0x1C, 0xEF, 0xD0, 0x0C, + 0x60, 0x10, 0x0F, 0x1C, 0xFA, 0x79, 0x78, 0xAE, 0x2D, 0xC5, 0x56, 0xA6, 0xE9, 0x50, 0x87, 0x2C, + 0x76, 0x6A, 0x29, 0x45, 0x7A, 0x5F, 0x57, 0x6F, 0x97, 0x96, 0xCC, 0xEE, 0xC1, 0xE4, 0x18, 0x3A, + 0x13, 0xF6, 0x95, 0x67, 0xCC, 0xF4, 0xD5, 0xA6, 0xFD, 0x6C, 0xAC, 0x92, 0xED, 0xA2, 0x7A, 0x5A, + 0xDD, 0x2D, 0xF9, 0x77, 0xE3, 0xAF, 0xD9, 0xB3, 0xF6, 0xD3, 0xF8, 0x91, 0xAD, 0xCD, 0xAF, 0xF8, + 0xBB, 0xE1, 0x57, 0x8D, 0x75, 0x3B, 0xE9, 0x32, 0xB1, 0x2B, 0xFD, 0x95, 0x6D, 0xAD, 0x10, 0x9C, + 0x88, 0xE1, 0x8F, 0xCE, 0xC2, 0xA8, 0xE0, 0x7A, 0xF0, 0x32, 0x78, 0xAF, 0x8D, 0xAF, 0x3C, 0x56, + 0x26, 0x4A, 0x55, 0x16, 0x9D, 0x17, 0x45, 0xFD, 0x7F, 0x92, 0xD9, 0x24, 0xBE, 0x92, 0x82, 0xC2, + 0x61, 0xE0, 0xA1, 0x4B, 0x45, 0xB6, 0xDF, 0xF0, 0x0D, 0x1F, 0xD9, 0x5B, 0xE1, 0x77, 0xC4, 0x0F, + 0x84, 0xFF, 0x00, 0xB7, 0xA7, 0xEC, 0x63, 0xE1, 0xFF, 0x00, 0x88, 0xBE, 0x13, 0xD5, 0x7C, 0x23, + 0xAB, 0xDE, 0x7E, 0xD2, 0xDF, 0x0F, 0x35, 0x3B, 0x3B, 0x1D, 0x56, 0x15, 0x8D, 0xEE, 0x6D, 0x9F, + 0xC5, 0xF6, 0x48, 0xB2, 0xC6, 0xCA, 0x4A, 0xB2, 0xEE, 0x8A, 0x45, 0xE0, 0xF0, 0x54, 0x83, 0xD2, + 0xAB, 0x2E, 0x83, 0x86, 0x63, 0x86, 0x4D, 0x5B, 0xDF, 0x87, 0xFE, 0x94, 0x8B, 0xAF, 0x28, 0x4B, + 0x09, 0x51, 0xC1, 0xE9, 0xCA, 0xFF, 0x00, 0x23, 0xFB, 0xD8, 0xAF, 0xD4, 0x4F, 0x90, 0x0A, 0x00, + 0x28, 0x00, 0xA0, 0x0F, 0x67, 0xFD, 0x85, 0xFF, 0x00, 0x64, 0xDD, 0x37, 0xE3, 0xD8, 0xFD, 0xAE, + 0xBC, 0x5F, 0x75, 0xA5, 0xC5, 0x7D, 0x36, 0x93, 0xFB, 0x58, 0xDB, 0xF8, 0x50, 0x31, 0x85, 0x5D, + 0x91, 0x20, 0xF8, 0x31, 0xF0, 0xF2, 0xE1, 0x53, 0x3B, 0x49, 0x03, 0x3A, 0x83, 0x90, 0x3E, 0xB8, + 0xAF, 0x83, 0xCE, 0xEA, 0xAA, 0x79, 0x8D, 0x48, 0xDD, 0xAF, 0x87, 0x67, 0x65, 0xF0, 0xAE, 0xDF, + 0xD6, 0xC7, 0xD1, 0x65, 0xFF, 0x00, 0xEE, 0x90, 0x5C, 0xAB, 0xAF, 0x7E, 0xFE, 0x47, 0xDE, 0xA7, + 0xFE, 0x09, 0xAF, 0xE1, 0xE5, 0xDA, 0x06, 0x8D, 0x1F, 0x0B, 0x82, 0xEB, 0x65, 0x11, 0x19, 0x03, + 0xE5, 0x07, 0x81, 0xEC, 0x38, 0x1D, 0xBF, 0x2F, 0x29, 0x62, 0x22, 0x97, 0xC5, 0x2B, 0x5B, 0xBF, + 0xF5, 0xFD, 0x74, 0xD0, 0xEA, 0x53, 0x6E, 0xCA, 0x34, 0xD5, 0xBD, 0x5A, 0xB7, 0x6E, 0xBF, 0xF0, + 0xD6, 0x23, 0x6F, 0xF8, 0x26, 0xB7, 0x87, 0xB1, 0xB8, 0x68, 0x96, 0xED, 0x85, 0xC7, 0xCD, 0xA7, + 0xC2, 0x3A, 0x8E, 0x41, 0x3B, 0x4F, 0xBF, 0xA5, 0x4F, 0xB7, 0x85, 0xB4, 0x72, 0xD3, 0xCF, 0xF2, + 0xFF, 0x00, 0x80, 0x52, 0xA8, 0xD5, 0x97, 0xB3, 0x4B, 0xD1, 0xBB, 0x7E, 0x6B, 0xF4, 0xEC, 0x56, + 0x4F, 0xF8, 0x26, 0xBE, 0x81, 0x95, 0x5F, 0xF8, 0x47, 0x2D, 0xC0, 0xE0, 0x64, 0xD8, 0x42, 0x02, + 0x8E, 0x9D, 0x3C, 0xBF, 0x6A, 0x9F, 0xAC, 0x45, 0x2D, 0x1C, 0xBE, 0xFF, 0x00, 0xF8, 0x06, 0x8A, + 0x4D, 0x24, 0xB9, 0x57, 0xDF, 0x2F, 0xF3, 0x27, 0x1F, 0xF0, 0x4D, 0x3F, 0x0E, 0x71, 0x8D, 0x06, + 0xDB, 0x00, 0x76, 0xD3, 0xA2, 0xC7, 0x03, 0x80, 0x3F, 0x77, 0xF4, 0xFA, 0x54, 0xFD, 0x61, 0x2D, + 0x13, 0x7F, 0x7F, 0xFC, 0x02, 0x79, 0xDD, 0x92, 0x50, 0x5F, 0x7C, 0xBF, 0xCC, 0x6B, 0x7F, 0xC1, + 0x35, 0x3C, 0x3C, 0xA9, 0x95, 0xF0, 0xFD, 0xB1, 0xE8, 0x15, 0x7F, 0xB3, 0xA2, 0x53, 0x8E, 0x31, + 0xC7, 0x97, 0xC7, 0x51, 0xE9, 0x4E, 0x38, 0x85, 0xA2, 0xBB, 0xFB, 0xFF, 0x00, 0xE0, 0x02, 0xA8, + 0xF4, 0x5C, 0xAA, 0xDE, 0xB2, 0xFF, 0x00, 0x3F, 0x21, 0xD6, 0xFF, 0x00, 0xF0, 0x4D, 0xDD, 0x11, + 0x4E, 0x3F, 0xB0, 0x6D, 0xD5, 0x40, 0x0D, 0xFB, 0xCB, 0x28, 0xF0, 0x31, 0x8C, 0x00, 0x02, 0x2F, + 0xA0, 0x1C, 0xF6, 0xE3, 0xE9, 0xD1, 0x47, 0x1A, 0xE9, 0x49, 0x3A, 0x73, 0x69, 0xF7, 0xBE, 0xDE, + 0x9E, 0x7B, 0x79, 0xE8, 0xAC, 0x4B, 0x49, 0x46, 0xFC, 0x8B, 0x4E, 0xD7, 0xFF, 0x00, 0x35, 0xB1, + 0xEA, 0xDF, 0x0F, 0xBF, 0x60, 0xBF, 0x0D, 0xF8, 0x0A, 0xF0, 0xF8, 0xCA, 0xD7, 0x40, 0xB4, 0xB9, + 0xF1, 0x3E, 0x9A, 0x4C, 0x3E, 0x13, 0x8A, 0xEB, 0x4E, 0x82, 0xEE, 0xDB, 0x4C, 0x9D, 0xD7, 0x03, + 0x50, 0x96, 0x06, 0x5C, 0x33, 0x44, 0xAC, 0xDE, 0x59, 0xC8, 0x2B, 0x26, 0xC7, 0x1F, 0x74, 0x57, + 0xB9, 0x1E, 0x21, 0xAD, 0x52, 0x2A, 0x9C, 0xEB, 0x49, 0xAB, 0x25, 0x2B, 0xB6, 0xAE, 0xBA, 0xAD, + 0x1E, 0xCD, 0xF4, 0xB5, 0xAC, 0xB6, 0x38, 0xAA, 0xD2, 0xA9, 0x38, 0x25, 0xCB, 0xA3, 0xE8, 0x9B, + 0xB7, 0x4B, 0x6A, 0xDD, 0x96, 0x8A, 0xDA, 0x6A, 0xB6, 0xE8, 0x71, 0x97, 0xDF, 0xF0, 0x4F, 0x3D, + 0x3B, 0x51, 0xBF, 0xB8, 0xD5, 0x6F, 0x34, 0xEF, 0xB7, 0xEA, 0x9A, 0x85, 0xE3, 0xDE, 0xDF, 0x5E, + 0xEA, 0x10, 0x06, 0xBD, 0xBD, 0x9E, 0x57, 0x2F, 0x34, 0xF2, 0xCC, 0x41, 0x2E, 0xEC, 0xE7, 0x25, + 0x89, 0xC9, 0x27, 0x35, 0xEA, 0x47, 0x8A, 0x15, 0x2A, 0x71, 0x84, 0x26, 0xAD, 0x15, 0x64, 0xB6, + 0x49, 0x25, 0x65, 0x64, 0x93, 0x49, 0xE9, 0x65, 0x64, 0xB4, 0xEC, 0xB4, 0x08, 0xD3, 0x97, 0x2B, + 0x84, 0xE2, 0x94, 0x74, 0x56, 0x4D, 0xB5, 0x6D, 0xAD, 0x6B, 0xED, 0x6E, 0x9A, 0xEB, 0xE4, 0x32, + 0x2F, 0xF8, 0x27, 0x7E, 0x86, 0xE0, 0xC6, 0xFE, 0x1F, 0xB6, 0x48, 0xD9, 0x41, 0x78, 0xC5, 0x9A, + 0xC8, 0x91, 0xC8, 0x83, 0x0A, 0xF1, 0xA8, 0x00, 0x00, 0x40, 0x50, 0x71, 0xE8, 0xB8, 0xE8, 0x33, + 0xA5, 0x0E, 0x2E, 0x94, 0x1D, 0xE3, 0x51, 0xC6, 0x2F, 0x59, 0x2D, 0x34, 0x69, 0x68, 0xD7, 0x4D, + 0x6D, 0x67, 0xAA, 0xBE, 0xED, 0x6A, 0xCC, 0x6A, 0x61, 0x1A, 0x8A, 0x7C, 0xA9, 0xBD, 0x95, 0xDB, + 0xF8, 0x5F, 0x47, 0xBB, 0xF7, 0x7A, 0x25, 0xA6, 0xB6, 0x4A, 0xC3, 0x47, 0xFC, 0x13, 0xA3, 0xC3, + 0xFB, 0x4A, 0x0D, 0x19, 0x5B, 0x72, 0x88, 0xA2, 0x59, 0x34, 0xB8, 0x7C, 0x94, 0x19, 0xE4, 0x90, + 0x38, 0xE3, 0x91, 0xE9, 0xCF, 0xE7, 0xBA, 0xE3, 0x39, 0xA8, 0xBF, 0xDE, 0xBE, 0xE9, 0x72, 0xDB, + 0x7B, 0x74, 0xFC, 0xF4, 0x5B, 0x68, 0x9A, 0x12, 0xC2, 0xB7, 0x67, 0xEC, 0x63, 0x65, 0xFD, 0xE6, + 0xF4, 0xD3, 0x6F, 0xE9, 0x6D, 0x6D, 0x36, 0x34, 0xE6, 0xFF, 0x00, 0x82, 0x7D, 0xE8, 0xD6, 0x5A, + 0x71, 0xD2, 0x34, 0xDD, 0x0E, 0x14, 0xB7, 0xBB, 0x1B, 0xB5, 0x79, 0xC5, 0xA2, 0xA4, 0xBA, 0x87, + 0xCB, 0x8F, 0x29, 0x98, 0x03, 0x88, 0x4E, 0x4F, 0xC8, 0x00, 0x04, 0xF2, 0x41, 0x20, 0x63, 0x9A, + 0x3C, 0x59, 0x3A, 0x69, 0x35, 0x57, 0xDE, 0x7E, 0x6D, 0x25, 0xB6, 0xC9, 0xDF, 0xD2, 0xCA, 0xDA, + 0x68, 0xAC, 0x8D, 0x61, 0x42, 0x53, 0x6E, 0x55, 0x23, 0xB7, 0xC2, 0x95, 0xEC, 0xB4, 0xDD, 0x6D, + 0xAE, 0x9F, 0x2D, 0xBD, 0x31, 0x57, 0xFE, 0x09, 0xD7, 0xA2, 0x49, 0xF3, 0x49, 0xA3, 0x44, 0x8D, + 0x9E, 0x02, 0x59, 0x46, 0x5E, 0x31, 0x9C, 0xAE, 0xD3, 0x81, 0x8C, 0x64, 0x00, 0x01, 0x1D, 0x0E, + 0x08, 0xA7, 0xFE, 0xB6, 0x56, 0x92, 0x72, 0xA9, 0x57, 0xCA, 0xC9, 0xB7, 0xA2, 0x49, 0x74, 0xB7, + 0x65, 0xD1, 0xE9, 0xD9, 0x68, 0x57, 0xB0, 0x74, 0xEC, 0xA9, 0xC1, 0x25, 0xEA, 0xD7, 0xE0, 0x9D, + 0xAE, 0xDF, 0xF5, 0xA0, 0xA3, 0xFE, 0x09, 0xCD, 0xA0, 0x63, 0x3F, 0xD8, 0xC7, 0xB8, 0xC7, 0xF6, + 0x6C, 0x6B, 0x80, 0x7A, 0x0C, 0x76, 0x1F, 0x77, 0xB0, 0xEE, 0x3B, 0x52, 0x5C, 0x55, 0xAA, 0x8A, + 0xA8, 0xED, 0xE8, 0xFA, 0x25, 0x6F, 0xB5, 0x6D, 0x3D, 0x76, 0xB6, 0xDD, 0x05, 0x1A, 0xC9, 0x25, + 0xC8, 0x95, 0x97, 0xF3, 0x3B, 0x7A, 0x6C, 0x8A, 0xF2, 0x7F, 0xC1, 0x39, 0xF4, 0x54, 0x24, 0x0D, + 0x06, 0x07, 0x5D, 0xA7, 0x05, 0x6C, 0xD0, 0x6E, 0x07, 0xAE, 0x72, 0xBE, 0xC0, 0x63, 0xD8, 0x74, + 0xAE, 0x5A, 0xBC, 0x4D, 0x51, 0x7B, 0xAE, 0xA5, 0xD6, 0x8D, 0x59, 0xB5, 0x6B, 0x2B, 0x2D, 0x2F, + 0xD9, 0x25, 0xA6, 0xBF, 0x76, 0x9A, 0xC2, 0x9B, 0xB2, 0xD3, 0x5D, 0x36, 0x6D, 0xF9, 0xDB, 0x7E, + 0xFF, 0x00, 0xD2, 0xD0, 0x91, 0x7F, 0xE0, 0x9C, 0x9A, 0x17, 0x97, 0xB9, 0xB4, 0x38, 0xC3, 0x1C, + 0xE1, 0x52, 0xC1, 0x5C, 0x29, 0x00, 0x63, 0xE6, 0xE3, 0x81, 0xB7, 0x19, 0xC7, 0x7C, 0x7A, 0x54, + 0x2E, 0x21, 0x76, 0x4D, 0xD5, 0x76, 0x7B, 0xA5, 0x7F, 0xBA, 0xDC, 0xD1, 0x49, 0x6D, 0xA5, 0xB4, + 0xB6, 0x9A, 0x24, 0x94, 0xDA, 0xAC, 0x5A, 0x50, 0x8A, 0xB2, 0xB5, 0xBD, 0xE6, 0xAD, 0xA5, 0xAC, + 0x96, 0xB6, 0xD1, 0x58, 0x07, 0xFC, 0x13, 0x8B, 0xC3, 0xD8, 0x50, 0xBA, 0x2C, 0x4B, 0xC6, 0x33, + 0xF6, 0x08, 0xC2, 0x21, 0x00, 0x6D, 0x0A, 0x07, 0x61, 0x93, 0xD3, 0x18, 0xED, 0xC7, 0x35, 0x9F, + 0xF6, 0xEB, 0x6A, 0xCA, 0x6F, 0xA2, 0xEB, 0x6B, 0x5E, 0xFF, 0x00, 0xCD, 0xFA, 0x74, 0x5D, 0x6E, + 0x17, 0xAB, 0xD1, 0x2B, 0x7F, 0x89, 0xFF, 0x00, 0x4B, 0xA7, 0xCB, 0xB1, 0x55, 0xBF, 0xE0, 0x9C, + 0xBA, 0x12, 0x9C, 0x0F, 0x0E, 0xDB, 0x95, 0x52, 0x40, 0x3F, 0x66, 0x4C, 0x15, 0x1D, 0x80, 0xDB, + 0xD3, 0x1E, 0xDC, 0x7A, 0x57, 0x24, 0xF3, 0xD9, 0xB8, 0xB8, 0x39, 0x6D, 0xA2, 0xB3, 0xD3, 0x45, + 0xA7, 0x5E, 0x9D, 0xB6, 0xF2, 0xED, 0xB4, 0x61, 0x37, 0x15, 0xA3, 0xDB, 0x6B, 0xBD, 0x3F, 0x1E, + 0x9A, 0x6D, 0xE9, 0xB0, 0xF5, 0xFF, 0x00, 0x82, 0x6F, 0x78, 0x7B, 0xCB, 0x50, 0x74, 0x08, 0xB3, + 0xC0, 0x3B, 0x6C, 0x23, 0x28, 0x08, 0x1C, 0x0C, 0x9C, 0x1E, 0xCB, 0x9E, 0x0F, 0xE4, 0x6B, 0x29, + 0x66, 0x70, 0x92, 0x49, 0xCD, 0xED, 0xD3, 0xA6, 0x8B, 0xAE, 0x9F, 0x87, 0x6F, 0x24, 0x45, 0xEA, + 0x27, 0x68, 0xC3, 0x4F, 0x56, 0xBB, 0x74, 0xBF, 0x65, 0xA6, 0xDD, 0x3A, 0x00, 0xFF, 0x00, 0x82, + 0x6E, 0xF8, 0x77, 0x03, 0x67, 0x87, 0xA1, 0x52, 0x08, 0xE5, 0xF4, 0xF8, 0x99, 0x50, 0x02, 0x71, + 0x80, 0x07, 0x3D, 0x08, 0xE4, 0x7A, 0x66, 0xB9, 0x9E, 0x32, 0x12, 0x6D, 0x73, 0xBF, 0xC3, 0xFA, + 0xF3, 0x4B, 0xBF, 0x61, 0xC5, 0xCF, 0x4B, 0xD3, 0xFC, 0x5F, 0x6E, 0xC9, 0xFE, 0x5F, 0x81, 0x4C, + 0x7F, 0xC1, 0x38, 0x74, 0x5C, 0x04, 0x3E, 0x1D, 0xB4, 0xC1, 0xC2, 0x12, 0xD6, 0x80, 0xAA, 0xF2, + 0x01, 0xC6, 0x07, 0x0A, 0x39, 0xE9, 0xE9, 0xF9, 0xE0, 0xF1, 0x69, 0xDD, 0x5D, 0xDB, 0xCA, 0xDE, + 0x5F, 0xD7, 0x4E, 0xDB, 0x68, 0x6C, 0x96, 0xC9, 0x45, 0x7E, 0x3F, 0xD6, 0x9A, 0x7D, 0xDE, 0x96, + 0x97, 0xFE, 0x1D, 0xB1, 0xE1, 0xBD, 0xA8, 0xA7, 0x41, 0xB6, 0x50, 0x80, 0xFC, 0xA9, 0x60, 0x9D, + 0x08, 0xE0, 0x01, 0xC8, 0x1D, 0x00, 0x3D, 0x3F, 0x4A, 0x97, 0x88, 0xA7, 0x1D, 0x39, 0x9B, 0xB7, + 0x6D, 0xBE, 0x4D, 0xFF, 0x00, 0x49, 0x5A, 0xD7, 0x25, 0x4A, 0x56, 0xD2, 0x9A, 0x5F, 0x37, 0xF9, + 0x2F, 0xEB, 0xC9, 0x74, 0x63, 0x7F, 0xC1, 0x36, 0x7C, 0x3C, 0xAA, 0x4A, 0xE8, 0x51, 0x39, 0x03, + 0x84, 0x7B, 0x28, 0xD5, 0x70, 0x07, 0x0A, 0x40, 0x1D, 0x3A, 0x0F, 0xE5, 0xD6, 0xA7, 0xEB, 0x11, + 0x4B, 0x95, 0x49, 0xD9, 0x69, 0xAB, 0x6B, 0xA7, 0xF4, 0xBD, 0x3E, 0xE4, 0xE1, 0x37, 0xA2, 0xF6, + 0x6B, 0xE4, 0xDB, 0xFF, 0x00, 0x80, 0x97, 0xFC, 0x37, 0x6B, 0xB6, 0x1F, 0xF8, 0x26, 0xFE, 0x88, + 0x03, 0x47, 0xFD, 0x83, 0x6C, 0x11, 0xD5, 0x73, 0xE6, 0x5A, 0x28, 0x5E, 0x07, 0x00, 0x80, 0xA3, + 0xDC, 0x7F, 0xFA, 0xE8, 0x8E, 0x2F, 0x91, 0x38, 0xDD, 0xD9, 0xAB, 0x6E, 0xFF, 0x00, 0x0F, 0xD3, + 0xB7, 0x42, 0x9B, 0x8A, 0x49, 0xF2, 0x2B, 0x2F, 0x52, 0x55, 0xFF, 0x00, 0x82, 0x6D, 0xF8, 0x75, + 0x42, 0x81, 0xE1, 0xFB, 0x35, 0x03, 0x8D, 0x82, 0xC0, 0x04, 0x51, 0x9E, 0x00, 0x00, 0xE3, 0xD3, + 0xD2, 0x94, 0x71, 0x51, 0x56, 0xDE, 0xDE, 0xAF, 0xFC, 0xD7, 0xCA, 0xD6, 0xF4, 0xB2, 0x15, 0xE5, + 0xAF, 0xB8, 0xB6, 0xEF, 0xE4, 0xBC, 0x9D, 0xBF, 0x1D, 0x2D, 0xE8, 0x36, 0x4F, 0xF8, 0x26, 0xE6, + 0x80, 0xAA, 0x0C, 0x5A, 0x05, 0x91, 0x00, 0x11, 0xB3, 0xFB, 0x38, 0x8E, 0xAB, 0xC0, 0x03, 0x24, + 0x0C, 0x7C, 0xC3, 0x8C, 0x70, 0x07, 0xE1, 0xA4, 0x71, 0x6A, 0x09, 0x72, 0xB7, 0x6D, 0xAD, 0x76, + 0xBA, 0x5B, 0x6B, 0xBE, 0x9B, 0x59, 0x68, 0xBC, 0xF5, 0x14, 0x5F, 0x47, 0x04, 0xBD, 0x1B, 0xF2, + 0xED, 0x6F, 0xBB, 0xF3, 0x4A, 0xC3, 0x22, 0xFF, 0x00, 0x82, 0x6E, 0xE8, 0x4C, 0x76, 0x1F, 0x0F, + 0xDA, 0x22, 0xED, 0x18, 0x26, 0xC4, 0x12, 0x72, 0x41, 0x23, 0x18, 0x03, 0x3F, 0x40, 0x3D, 0x3B, + 0xD6, 0x71, 0xC5, 0x24, 0xB9, 0x53, 0x76, 0xF5, 0x7D, 0x2D, 0xFF, 0x00, 0x00, 0xA7, 0x64, 0x93, + 0x50, 0xD7, 0xB2, 0x6D, 0x79, 0x7C, 0xBF, 0x4D, 0x2C, 0x89, 0x87, 0xFC, 0x13, 0x67, 0xC3, 0x78, + 0x38, 0xD0, 0xAD, 0x41, 0x2A, 0x54, 0x63, 0x4E, 0x50, 0x79, 0xFC, 0x48, 0xEC, 0x07, 0x4A, 0x7F, + 0x5A, 0x8F, 0x46, 0xFF, 0x00, 0xAF, 0x9F, 0xF4, 0xBE, 0x44, 0xA9, 0x4D, 0x59, 0x7B, 0x35, 0x65, + 0xD2, 0xEE, 0xDF, 0x82, 0xF9, 0x69, 0x6E, 0x9E, 0x76, 0x85, 0xFF, 0x00, 0xE0, 0x9B, 0x7A, 0x12, + 0x84, 0xC6, 0x85, 0x6E, 0xEB, 0x8D, 0xA6, 0x35, 0xB2, 0x54, 0x18, 0x03, 0x39, 0xFB, 0xA7, 0xAE, + 0x0F, 0xF8, 0x0E, 0x00, 0x1E, 0x29, 0x59, 0x26, 0xDD, 0xBA, 0x6B, 0xFD, 0x7C, 0xBC, 0xBA, 0x58, + 0xA8, 0x35, 0xAA, 0x54, 0xD2, 0x7F, 0x3F, 0x2D, 0xBF, 0x2D, 0x3F, 0x30, 0x4F, 0xF8, 0x26, 0xCF, + 0x87, 0xE5, 0x50, 0x5B, 0xC3, 0xB6, 0x70, 0x95, 0x21, 0x1B, 0xCB, 0xD3, 0x93, 0x74, 0x80, 0xE3, + 0x25, 0xB7, 0x29, 0xCF, 0x4E, 0x9D, 0x28, 0xFA, 0xCC, 0x5C, 0x54, 0x6C, 0xD2, 0x5D, 0x9B, 0xBB, + 0xF5, 0xBB, 0xE9, 0xE4, 0x90, 0x73, 0x59, 0x24, 0xA3, 0x75, 0xD3, 0x57, 0xA7, 0xE5, 0x6E, 0xDF, + 0xA1, 0x20, 0xFF, 0x00, 0x82, 0x6C, 0xE8, 0x22, 0x36, 0x45, 0xD2, 0x63, 0x44, 0x60, 0x33, 0x0C, + 0x76, 0x51, 0xC7, 0x13, 0x60, 0x71, 0x94, 0x0B, 0x8E, 0xC3, 0xB7, 0x61, 0xE9, 0x50, 0xAB, 0xC1, + 0x25, 0x67, 0x2F, 0xBF, 0xCB, 0xFA, 0xFE, 0xB4, 0x05, 0x39, 0x68, 0x95, 0x35, 0x6F, 0x57, 0xF8, + 0x6B, 0xFD, 0x76, 0x2B, 0x4B, 0xFF, 0x00, 0x04, 0xD8, 0xD0, 0x54, 0xA2, 0xFF, 0x00, 0x60, 0x42, + 0xE0, 0x28, 0xC6, 0x2C, 0x62, 0xDA, 0xA3, 0x3C, 0x00, 0x0C, 0x67, 0x1D, 0x3F, 0x9F, 0xE0, 0x2C, + 0x44, 0x76, 0xBB, 0xB7, 0xAF, 0xA7, 0xF5, 0xFA, 0x0D, 0x4B, 0x4D, 0x20, 0x97, 0x4E, 0xBE, 0x5E, + 0x67, 0x79, 0xF0, 0xF7, 0xF6, 0x18, 0x97, 0xE1, 0xB6, 0xAE, 0x35, 0xEF, 0x0D, 0x58, 0x45, 0x6B, + 0x25, 0xD5, 0x9C, 0x9A, 0x46, 0xB1, 0xA6, 0x3D, 0x82, 0x4B, 0xA6, 0x6B, 0xFA, 0x74, 0xCB, 0xB6, + 0xEB, 0x4F, 0xBF, 0xB7, 0xDA, 0x12, 0x7B, 0x69, 0x54, 0xA8, 0x68, 0x9C, 0x6D, 0x38, 0x5C, 0x8E, + 0x29, 0xFD, 0x62, 0x2A, 0x0D, 0x6B, 0xF7, 0xEC, 0xBF, 0x4E, 0x9A, 0x75, 0x5D, 0x6C, 0x65, 0x36, + 0xA6, 0xD4, 0x1C, 0x16, 0x96, 0xB3, 0xBB, 0xDF, 0x4B, 0x35, 0xAF, 0x4E, 0x8D, 0x6D, 0xF2, 0x31, + 0xBC, 0x4B, 0xFF, 0x00, 0x04, 0xD1, 0xF0, 0x29, 0xD5, 0xA5, 0xB8, 0xD0, 0x34, 0x18, 0x53, 0x48, + 0xBF, 0x02, 0xF6, 0xD2, 0xD2, 0x5D, 0x36, 0xDC, 0x4F, 0xA5, 0x89, 0x0E, 0x5A, 0xD6, 0x40, 0x91, + 0x85, 0xF9, 0x3A, 0x02, 0xA0, 0x0C, 0x63, 0x1D, 0x2A, 0x3E, 0xB1, 0x15, 0xB3, 0x76, 0xF2, 0x7F, + 0xA7, 0x4F, 0x4F, 0xD2, 0xC5, 0xC2, 0x75, 0x14, 0x23, 0xCD, 0x15, 0x7E, 0xBA, 0xBF, 0xC3, 0x54, + 0xAC, 0x73, 0x27, 0xFE, 0x09, 0xB1, 0xA0, 0x03, 0x81, 0xE1, 0xB8, 0x08, 0x07, 0x03, 0x1A, 0x7C, + 0x40, 0x11, 0xD8, 0xE3, 0xCA, 0xFA, 0x55, 0x2A, 0xF1, 0xB5, 0xB9, 0x9F, 0xDF, 0xFF, 0x00, 0x02, + 0xC5, 0xA9, 0x3B, 0x2F, 0x75, 0x5B, 0xD6, 0x5F, 0xE6, 0x6C, 0xD8, 0x7F, 0xC1, 0x39, 0xB4, 0x1B, + 0x7B, 0x79, 0x6C, 0x2E, 0x34, 0x28, 0xA6, 0xD3, 0x6E, 0x80, 0x69, 0xAD, 0x05, 0x84, 0x72, 0x2C, + 0x0E, 0x07, 0xCB, 0x34, 0x69, 0xB0, 0x00, 0xE3, 0xA6, 0x46, 0x32, 0x38, 0xEF, 0x4A, 0x38, 0x88, + 0xA6, 0xAE, 0xDD, 0xB4, 0x57, 0xBE, 0xC9, 0x79, 0x69, 0xF7, 0x7F, 0xC3, 0x12, 0xE7, 0x24, 0xAD, + 0x18, 0xAB, 0xFA, 0xBD, 0x7C, 0xB7, 0xD3, 0xFC, 0xBC, 0xB4, 0x28, 0x49, 0xFF, 0x00, 0x04, 0xD0, + 0xF0, 0xDC, 0x72, 0x14, 0x4D, 0x0E, 0xD9, 0x93, 0xFE, 0x59, 0xB9, 0xD3, 0x22, 0x04, 0xAE, 0x46, + 0x32, 0xA2, 0x33, 0x83, 0xC8, 0xE0, 0x7F, 0x4E, 0x07, 0x5E, 0x29, 0xDA, 0x2D, 0xDB, 0xD6, 0xDF, + 0xA6, 0x82, 0x55, 0x65, 0xCA, 0x9B, 0x82, 0xDB, 0xA3, 0x93, 0xB7, 0x96, 0xE8, 0xAB, 0xFF, 0x00, + 0x0E, 0xD8, 0xF0, 0xF8, 0x6D, 0xA3, 0xC3, 0x96, 0xD8, 0x1C, 0x67, 0xEC, 0x11, 0x05, 0xC0, 0x1C, + 0x63, 0xF7, 0x7E, 0x98, 0xA1, 0x57, 0x8D, 0x97, 0xBC, 0xFE, 0xFF, 0x00, 0xF8, 0x06, 0xAA, 0x4F, + 0x44, 0xA0, 0xAD, 0xEB, 0x2F, 0xF3, 0x27, 0xFF, 0x00, 0x87, 0x69, 0xF8, 0x70, 0x00, 0x06, 0x83, + 0x6B, 0xD0, 0x63, 0x1A, 0x74, 0x40, 0x74, 0x18, 0x03, 0xF7, 0x63, 0xB1, 0x15, 0x3F, 0x58, 0xB2, + 0xDD, 0xDB, 0xD7, 0xFE, 0x01, 0x0A, 0xA3, 0xB6, 0x90, 0x56, 0xF5, 0x97, 0xE5, 0x71, 0xA7, 0xFE, + 0x09, 0xA9, 0xE1, 0xD0, 0xA7, 0x1A, 0x05, 0xB7, 0xCA, 0x38, 0x53, 0xA7, 0xC2, 0xA0, 0x91, 0xD1, + 0x41, 0xF2, 0xFE, 0x94, 0x2C, 0x46, 0x9A, 0x37, 0xF7, 0xFF, 0x00, 0xC0, 0x05, 0x51, 0xE8, 0xB9, + 0x15, 0xBC, 0x9C, 0xBF, 0xCC, 0x89, 0x3F, 0xE0, 0x9B, 0x1E, 0x1F, 0x24, 0x2F, 0xFC, 0x23, 0x96, + 0xCA, 0x38, 0x19, 0x36, 0x11, 0x60, 0x74, 0xE0, 0x01, 0x17, 0xB8, 0xE9, 0xFD, 0x2A, 0xBE, 0xB1, + 0x14, 0x95, 0xA4, 0xFE, 0xFB, 0x7E, 0x9A, 0x15, 0xCC, 0xD6, 0x9C, 0xAB, 0xE4, 0xE5, 0xFE, 0x64, + 0xE3, 0xFE, 0x09, 0xA7, 0xE1, 0xCC, 0x0C, 0x78, 0x7E, 0x0E, 0xC0, 0x01, 0xA6, 0xC4, 0x3A, 0x8E, + 0x01, 0x1E, 0x5F, 0x1D, 0xAA, 0x7E, 0xB0, 0x96, 0x97, 0x76, 0xF5, 0xFF, 0x00, 0x80, 0x4A, 0xA8, + 0xEC, 0xBD, 0xD5, 0x6F, 0x59, 0x7F, 0x9F, 0x41, 0x8D, 0xFF, 0x00, 0x04, 0xD5, 0xF0, 0xEA, 0x26, + 0x57, 0xC3, 0xF6, 0xCD, 0x8C, 0x00, 0xA3, 0x4E, 0x88, 0x1C, 0x63, 0xFE, 0xB9, 0xFB, 0x0A, 0xA5, + 0x5D, 0x75, 0x6E, 0xDE, 0xBF, 0xF0, 0x3F, 0xAF, 0xB8, 0x6A, 0x6F, 0x6E, 0x45, 0xF7, 0xCA, 0xDF, + 0x9F, 0xF5, 0xF2, 0x1B, 0x1F, 0xFC, 0x13, 0x5F, 0xC3, 0xCD, 0xC1, 0xF0, 0xED, 0xB4, 0x60, 0x28, + 0x3F, 0x35, 0x84, 0x20, 0x75, 0xC0, 0x03, 0xF7, 0x7E, 0xD4, 0x7B, 0x78, 0xE8, 0x94, 0x9F, 0xDF, + 0xFF, 0x00, 0x00, 0x39, 0xDA, 0x8D, 0xF9, 0x55, 0xBD, 0x65, 0xFE, 0x64, 0xBF, 0xF0, 0xED, 0x3F, + 0x0E, 0x05, 0xCF, 0xF6, 0x05, 0xB8, 0x00, 0x1E, 0x06, 0x99, 0x17, 0x18, 0x38, 0xC7, 0xFA, 0xBF, + 0x61, 0xFE, 0x45, 0x25, 0x88, 0x49, 0x25, 0x77, 0xF7, 0xFF, 0x00, 0xC0, 0x12, 0xA8, 0xF6, 0xE4, + 0x5F, 0x7C, 0xBF, 0xCF, 0xFA, 0xF2, 0x23, 0x7F, 0xF8, 0x26, 0xAF, 0x87, 0x90, 0x0D, 0xBE, 0x1E, + 0xB6, 0x6E, 0x71, 0xB4, 0x69, 0xD1, 0x29, 0x00, 0x0E, 0x0E, 0x3C, 0xBA, 0x6A, 0xBA, 0xB2, 0xD5, + 0xDB, 0xD7, 0xFE, 0x00, 0x2A, 0x8D, 0xE8, 0xA0, 0xAD, 0x6E, 0xF2, 0xB7, 0x6E, 0xFF, 0x00, 0xD7, + 0xE5, 0x25, 0xBF, 0xFC, 0x13, 0x5B, 0xC3, 0x83, 0x12, 0x3F, 0x87, 0xED, 0xD4, 0x47, 0x82, 0x10, + 0x69, 0xF0, 0x92, 0x71, 0xD3, 0x23, 0x60, 0xC7, 0x41, 0xDF, 0xB5, 0x6F, 0x87, 0xAB, 0x4F, 0x99, + 0x39, 0x49, 0xF2, 0xAB, 0x3D, 0xF7, 0xF2, 0x4B, 0x6B, 0x7E, 0x16, 0xD0, 0x9A, 0x93, 0x94, 0x62, + 0x94, 0x62, 0xB6, 0xEE, 0xD2, 0xB5, 0xBD, 0x7A, 0x79, 0x1A, 0xC3, 0xFE, 0x09, 0xC3, 0xE1, 0xC5, + 0x04, 0x1D, 0x05, 0x14, 0x70, 0x46, 0xDD, 0x32, 0x2D, 0x8A, 0x40, 0xEC, 0x09, 0x03, 0xBE, 0x07, + 0x1F, 0xCB, 0x8F, 0xA3, 0xC3, 0xE7, 0xD4, 0xF0, 0xF4, 0xE3, 0x4E, 0x35, 0x1F, 0x22, 0xE8, 0x93, + 0xD6, 0xCA, 0xCB, 0xED, 0x79, 0x2B, 0xE8, 0xBE, 0x6A, 0xC7, 0x27, 0xEF, 0xAE, 0x9C, 0x60, 0xBB, + 0x7C, 0x4F, 0x6F, 0xBB, 0xD2, 0xDD, 0xEC, 0x67, 0xDD, 0x7F, 0xC1, 0x38, 0x74, 0x49, 0x24, 0x5F, + 0xF8, 0xA7, 0xE0, 0x60, 0xA0, 0x61, 0xBE, 0xC6, 0xAA, 0xD9, 0x04, 0xE3, 0x23, 0x69, 0xC7, 0x45, + 0xC6, 0x00, 0xC7, 0xE3, 0xC7, 0x97, 0x99, 0x67, 0x13, 0xC6, 0xD6, 0x5C, 0xD3, 0x7C, 0x89, 0x2B, + 0x59, 0xF6, 0x4B, 0x7F, 0xBB, 0x66, 0xF7, 0xBB, 0x37, 0xA3, 0x1E, 0x4A, 0x69, 0x38, 0x6B, 0xB6, + 0xF2, 0x6A, 0xDE, 0x5E, 0x9D, 0x34, 0x5A, 0x5B, 0x4B, 0x09, 0x1F, 0xFC, 0x13, 0x6F, 0x41, 0x31, + 0xE5, 0xB4, 0x2B, 0x75, 0x7D, 0xC7, 0xE5, 0x16, 0x2A, 0xC5, 0x80, 0x1C, 0x28, 0x18, 0x5F, 0x97, + 0x83, 0xC6, 0x7B, 0x0E, 0x6B, 0xCE, 0x8E, 0x25, 0x24, 0x92, 0x93, 0xED, 0xA3, 0xFC, 0x3D, 0x2D, + 0xF2, 0xE8, 0x5B, 0x97, 0x2D, 0x92, 0x82, 0xB7, 0x6B, 0xBF, 0xEB, 0xEE, 0x5F, 0x86, 0xD2, 0x0F, + 0xF8, 0x26, 0xD7, 0x87, 0x78, 0x0B, 0xA1, 0xC0, 0xA8, 0x09, 0x21, 0x05, 0x8A, 0xE5, 0x46, 0x06, + 0x76, 0x91, 0xF4, 0x00, 0x71, 0x8E, 0x3A, 0x75, 0xC9, 0x1C, 0x5C, 0x39, 0x79, 0x5B, 0x76, 0xF5, + 0xED, 0x6D, 0x9E, 0x9D, 0x9A, 0xB6, 0xDB, 0x69, 0x72, 0x5B, 0x92, 0x8D, 0xF9, 0x15, 0xEC, 0xBA, + 0xBF, 0x4B, 0x5B, 0x65, 0x6D, 0x3E, 0xEE, 0xC4, 0x71, 0xFF, 0x00, 0xC1, 0x37, 0xF4, 0x18, 0xE6, + 0x59, 0x0E, 0x81, 0x6F, 0x22, 0xC4, 0x36, 0xC7, 0xB6, 0xD1, 0x00, 0x00, 0x0C, 0x80, 0xA7, 0x6E, + 0x47, 0x7E, 0x33, 0xFF, 0x00, 0xD6, 0xDB, 0x09, 0x8A, 0xA7, 0x4A, 0xB4, 0x6B, 0x54, 0x93, 0xB4, + 0x5A, 0x69, 0x39, 0x75, 0x5B, 0x7E, 0x2B, 0xD3, 0x42, 0x9D, 0xF9, 0x14, 0x61, 0x0B, 0x7A, 0x5F, + 0xFC, 0xD2, 0xFB, 0xBE, 0x5E, 0x57, 0x57, 0xFE, 0x09, 0xC9, 0xA1, 0x37, 0xCE, 0xDA, 0x15, 0xBA, + 0x39, 0x39, 0x0A, 0x96, 0x29, 0xB5, 0x47, 0x4C, 0x64, 0x80, 0x47, 0x40, 0x38, 0xFE, 0x95, 0xF4, + 0x12, 0xE2, 0x29, 0xA5, 0xED, 0x63, 0x51, 0xDD, 0xEA, 0x92, 0x6E, 0xD7, 0xFF, 0x00, 0xC0, 0x96, + 0xBE, 0x89, 0x5A, 0xCA, 0xD6, 0xD8, 0xE6, 0x94, 0x6A, 0x69, 0x15, 0x1B, 0xAB, 0x6B, 0x79, 0x3F, + 0xC9, 0x7F, 0x5B, 0x21, 0xC9, 0xFF, 0x00, 0x04, 0xE0, 0xF0, 0xE6, 0x49, 0xFE, 0xC3, 0x45, 0x2E, + 0x0E, 0x0B, 0x69, 0xD1, 0xB0, 0x00, 0x8E, 0x41, 0x3C, 0xF6, 0x1F, 0xC8, 0x74, 0xC5, 0x73, 0x50, + 0xCE, 0x21, 0x4A, 0xAC, 0xEB, 0xFB, 0x46, 0xA7, 0x25, 0x67, 0xA6, 0x96, 0xDB, 0x74, 0xEE, 0xAC, + 0xAD, 0x6D, 0x5E, 0xBA, 0xDA, 0xE9, 0xD8, 0x97, 0xB5, 0xB2, 0x5C, 0x8A, 0xDD, 0x7D, 0xE7, 0x7D, + 0x36, 0xF2, 0xE9, 0xE5, 0xB7, 0x62, 0xA7, 0xFC, 0x3B, 0x97, 0x45, 0x18, 0x51, 0xE1, 0xEB, 0x70, + 0xAA, 0x7E, 0x5C, 0x5B, 0x2A, 0x85, 0xF9, 0x7A, 0x8F, 0x97, 0x8E, 0x83, 0xF2, 0xFC, 0xA2, 0xA6, + 0x7B, 0x51, 0xB6, 0xA5, 0x37, 0x6D, 0xB7, 0xD1, 0xF4, 0xEF, 0x7D, 0x3A, 0x5A, 0xCD, 0x76, 0xE8, + 0x6D, 0x1A, 0x6F, 0x49, 0x24, 0xD6, 0x96, 0xDD, 0xF9, 0x79, 0xF4, 0xD8, 0x9C, 0xFF, 0x00, 0xC1, + 0x37, 0xFC, 0x38, 0x02, 0xAF, 0xF6, 0x1C, 0x38, 0x00, 0x1C, 0x2D, 0x84, 0x7C, 0x81, 0xD3, 0x1D, + 0x3A, 0xFC, 0xA3, 0xB7, 0x4A, 0xA9, 0xE7, 0x3C, 0xD1, 0xB4, 0xEA, 0xB6, 0xFB, 0xAF, 0xF3, 0x76, + 0x7D, 0x6C, 0xAC, 0x95, 0xAD, 0x7B, 0x2B, 0x69, 0x9F, 0x35, 0x4D, 0x94, 0x55, 0xBF, 0xC4, 0xD7, + 0xE1, 0x7F, 0xEB, 0x6E, 0xC3, 0x1B, 0xFE, 0x09, 0xBB, 0xE1, 0xD0, 0x98, 0x5D, 0x09, 0x37, 0x28, + 0x1B, 0x73, 0x63, 0x1A, 0x82, 0x06, 0x32, 0x06, 0x07, 0x19, 0xDA, 0x3B, 0x7A, 0xE3, 0xAD, 0x72, + 0xAC, 0xC6, 0x2B, 0x9B, 0x96, 0xA3, 0x5A, 0x6D, 0xA2, 0x5F, 0x87, 0x6E, 0xDD, 0x76, 0x7B, 0x21, + 0xC5, 0xD4, 0xD1, 0x72, 0x2B, 0x79, 0x37, 0x7F, 0x2E, 0xDA, 0x7F, 0xC3, 0x2E, 0xC4, 0x43, 0xFE, + 0x09, 0xC5, 0xA1, 0x13, 0xB7, 0xFE, 0x11, 0xEB, 0x65, 0x52, 0x73, 0xF2, 0xDB, 0x28, 0x0B, 0x81, + 0xC0, 0x03, 0x68, 0xFE, 0xF1, 0xF4, 0xC7, 0x1E, 0x94, 0xA3, 0x9B, 0x5D, 0x28, 0xA9, 0xB4, 0xBB, + 0xBB, 0x7E, 0x9F, 0x76, 0x8B, 0x5D, 0x0B, 0x71, 0x94, 0x55, 0xD2, 0xE9, 0xD1, 0xCB, 0xFC, 0xFC, + 0xAD, 0xD9, 0x7A, 0x13, 0x8F, 0xF8, 0x26, 0xFF, 0x00, 0x87, 0x70, 0x33, 0xA0, 0x46, 0x48, 0x18, + 0x03, 0xFB, 0x3E, 0x1C, 0x70, 0x06, 0x38, 0xE3, 0x00, 0x10, 0x6B, 0x65, 0x9A, 0x41, 0x5A, 0x2E, + 0x4E, 0xDF, 0x2F, 0xB9, 0x6A, 0xBE, 0xED, 0x17, 0x97, 0x6C, 0xBF, 0x7B, 0x74, 0xB9, 0x17, 0x92, + 0xE6, 0x7F, 0xD7, 0x96, 0x9F, 0x79, 0x9F, 0x27, 0xFC, 0x13, 0x57, 0xC3, 0xAA, 0x18, 0xA7, 0x87, + 0xED, 0xDB, 0x04, 0x61, 0x0D, 0x84, 0x21, 0xB9, 0xC7, 0x03, 0xE4, 0x3C, 0x0C, 0x7F, 0x9E, 0x2B, + 0xC5, 0x9D, 0x68, 0xC6, 0x76, 0x8B, 0x76, 0xF5, 0xFD, 0x2D, 0xD0, 0xEA, 0x85, 0x49, 0x72, 0xA5, + 0xC8, 0xBE, 0xF7, 0xD3, 0xD1, 0xFF, 0x00, 0x5E, 0x5D, 0x22, 0x8F, 0xFE, 0x09, 0xAF, 0xE1, 0xF6, + 0x21, 0x4F, 0x87, 0x6D, 0xA3, 0x18, 0x1C, 0xB5, 0x84, 0x40, 0x0C, 0x8E, 0x00, 0x1E, 0x57, 0xD2, + 0x97, 0xB7, 0x8A, 0x4A, 0xCE, 0x5F, 0x7F, 0xFC, 0x02, 0xF9, 0x9D, 0xB4, 0x8A, 0xFB, 0xE5, 0xFE, + 0x64, 0xBF, 0xF0, 0xED, 0x3F, 0x0E, 0xED, 0x18, 0xD0, 0x2D, 0xF3, 0xD0, 0x2F, 0xF6, 0x6C, 0x5C, + 0x0C, 0xE0, 0x67, 0xF7, 0x7C, 0x7F, 0xF5, 0xBD, 0xB8, 0x85, 0x88, 0x4A, 0xDA, 0xBB, 0x7A, 0xFF, + 0x00, 0xC0, 0x21, 0x55, 0x76, 0x56, 0x82, 0xB7, 0xAC, 0xBF, 0xCC, 0x6B, 0xFF, 0x00, 0xC1, 0x35, + 0x7C, 0x3A, 0x8A, 0x36, 0xF8, 0x7E, 0xD9, 0xF8, 0xFB, 0xAB, 0xA7, 0xC4, 0x08, 0x00, 0x75, 0xFF, + 0x00, 0x57, 0x8E, 0xC2, 0xA9, 0x57, 0x49, 0x2D, 0x5D, 0xBD, 0x7F, 0xE0, 0x15, 0x19, 0xC9, 0xE9, + 0xC8, 0xAD, 0xEB, 0x2B, 0x7E, 0x67, 0xF2, 0x2B, 0xFF, 0x00, 0x05, 0xB0, 0xF8, 0x05, 0x65, 0xFB, + 0x3F, 0x7F, 0xC1, 0x64, 0xFF, 0x00, 0xE0, 0x95, 0x5E, 0x1F, 0xB1, 0xB0, 0x8F, 0x4F, 0x8F, 0x5E, + 0xBF, 0xF8, 0x7B, 0xAE, 0x3C, 0x51, 0xC2, 0xB0, 0x6E, 0x65, 0xF8, 0xAF, 0x3C, 0x3B, 0x8A, 0x85, + 0x51, 0xD2, 0x10, 0x3A, 0x76, 0xAD, 0xB0, 0x32, 0x53, 0xCC, 0xB0, 0xF6, 0x6E, 0xDC, 0xF0, 0xDF, + 0xFC, 0x48, 0x8A, 0xDA, 0xE1, 0x6A, 0x69, 0x6F, 0x75, 0xF7, 0xEC, 0xFB, 0x9F, 0xB2, 0xF5, 0xFA, + 0x79, 0xF2, 0x21, 0x40, 0x05, 0x00, 0x14, 0x01, 0xFA, 0xF5, 0xFF, 0x00, 0x04, 0x4A, 0xB4, 0xB7, + 0xBA, 0xF0, 0x27, 0xED, 0xD0, 0x27, 0x8F, 0x78, 0x8F, 0xF6, 0xE7, 0x84, 0x20, 0x0E, 0xC9, 0xB4, + 0x1F, 0x80, 0xFF, 0x00, 0x0C, 0x72, 0x38, 0x23, 0xD0, 0x57, 0xE7, 0x5C, 0x41, 0xFF, 0x00, 0x23, + 0x49, 0xFA, 0x47, 0xFF, 0x00, 0x49, 0x47, 0xD4, 0x65, 0x7F, 0xEE, 0x51, 0xF9, 0xFE, 0x67, 0xED, + 0x6F, 0xF6, 0x4E, 0x9F, 0xFF, 0x00, 0x3C, 0x0F, 0xFD, 0xFE, 0x93, 0xFC, 0x6B, 0xC4, 0xB2, 0xD3, + 0x43, 0xD1, 0x0F, 0xEC, 0x9D, 0x3F, 0xFE, 0x78, 0x1F, 0xFB, 0xFD, 0x27, 0xF8, 0xD1, 0x65, 0x64, + 0xAD, 0xA0, 0x07, 0xF6, 0x4E, 0x9F, 0xFF, 0x00, 0x3C, 0x0F, 0xFD, 0xFE, 0x93, 0xFC, 0x69, 0x80, + 0x7F, 0x64, 0xE9, 0xFF, 0x00, 0xF3, 0xC0, 0xFF, 0x00, 0xDF, 0xE9, 0x3F, 0xC6, 0x80, 0x0F, 0xEC, + 0x9D, 0x3F, 0xFE, 0x78, 0x1F, 0xFB, 0xFD, 0x27, 0xF8, 0xD2, 0x49, 0x2D, 0x90, 0xAC, 0xBB, 0x07, + 0xF6, 0x4E, 0x9F, 0xFF, 0x00, 0x3C, 0x0F, 0xFD, 0xFE, 0x93, 0xFC, 0x69, 0x82, 0x49, 0x24, 0x92, + 0xD0, 0x3F, 0xB2, 0x74, 0xFF, 0x00, 0xF9, 0xE0, 0x7F, 0xEF, 0xF4, 0x9F, 0xE3, 0x4A, 0xCB, 0x4D, + 0x06, 0x1F, 0xD9, 0x3A, 0x7F, 0xFC, 0xF0, 0x3F, 0xF7, 0xFA, 0x4F, 0xF1, 0xA2, 0xCB, 0x4D, 0x00, + 0x3F, 0xB2, 0x74, 0xFF, 0x00, 0xF9, 0xE0, 0x7F, 0xEF, 0xF4, 0x9F, 0xE3, 0x45, 0x96, 0x9A, 0x09, + 0x24, 0xB6, 0x41, 0xFD, 0x93, 0xA7, 0xFF, 0x00, 0xCF, 0x03, 0xFF, 0x00, 0x7F, 0xA4, 0xFF, 0x00, + 0x1A, 0x12, 0x49, 0x59, 0x2D, 0x06, 0x1F, 0xD9, 0x3A, 0x7F, 0xFC, 0xF0, 0x3F, 0xF7, 0xFA, 0x4F, + 0xF1, 0xA6, 0x01, 0xFD, 0x93, 0xA7, 0xFF, 0x00, 0xCF, 0x03, 0xFF, 0x00, 0x7F, 0xA4, 0xFF, 0x00, + 0x1A, 0x49, 0x24, 0xAC, 0x96, 0x82, 0x49, 0x25, 0x64, 0xB4, 0x0F, 0xEC, 0x9D, 0x3F, 0xFE, 0x78, + 0x1F, 0xFB, 0xFD, 0x27, 0xF8, 0xD1, 0x65, 0xA6, 0x83, 0x0F, 0xEC, 0x9D, 0x3F, 0xFE, 0x78, 0x1F, + 0xFB, 0xFD, 0x27, 0xF8, 0xD3, 0x15, 0x96, 0x9A, 0x07, 0xF6, 0x4E, 0x9F, 0xFF, 0x00, 0x3C, 0x0F, + 0xFD, 0xFE, 0x93, 0xFC, 0x69, 0x24, 0x92, 0xB2, 0x5A, 0x0C, 0x3F, 0xB2, 0x74, 0xFF, 0x00, 0xF9, + 0xE0, 0x7F, 0xEF, 0xF4, 0x9F, 0xE3, 0x45, 0x95, 0xAD, 0x6D, 0x00, 0x3F, 0xB2, 0x74, 0xFF, 0x00, + 0xF9, 0xE0, 0x7F, 0xEF, 0xF4, 0x9F, 0xE3, 0x4C, 0x56, 0x5D, 0x83, 0xFB, 0x27, 0x4F, 0xFF, 0x00, + 0x9E, 0x07, 0xFE, 0xFF, 0x00, 0x49, 0xFE, 0x34, 0x0C, 0x3F, 0xB2, 0x74, 0xFF, 0x00, 0xF9, 0xE0, + 0x7F, 0xEF, 0xF4, 0x9F, 0xE3, 0x40, 0x07, 0xF6, 0x4E, 0x9F, 0xFF, 0x00, 0x3C, 0x0F, 0xFD, 0xFE, + 0x93, 0xFC, 0x68, 0x15, 0x95, 0xAD, 0x6D, 0x03, 0xFB, 0x27, 0x4F, 0xFF, 0x00, 0x9E, 0x07, 0xFE, + 0xFF, 0x00, 0x49, 0xFE, 0x34, 0x92, 0x4B, 0x64, 0x30, 0xFE, 0xC9, 0xD3, 0xFF, 0x00, 0xE7, 0x81, + 0xFF, 0x00, 0xBF, 0xD2, 0x7F, 0x8D, 0x09, 0x25, 0x6B, 0x20, 0x0F, 0xEC, 0x9D, 0x3F, 0xFE, 0x78, + 0x1F, 0xFB, 0xFD, 0x27, 0xF8, 0xD1, 0x65, 0x64, 0xAD, 0xA0, 0x92, 0x4B, 0x64, 0x1F, 0xD9, 0x3A, + 0x7F, 0xFC, 0xF0, 0x3F, 0xF7, 0xFA, 0x4F, 0xF1, 0xA6, 0x30, 0xFE, 0xC9, 0xD3, 0xFF, 0x00, 0xE7, + 0x81, 0xFF, 0x00, 0xBF, 0xD2, 0x7F, 0x8D, 0x02, 0xB2, 0xD3, 0x40, 0xFE, 0xC9, 0xD3, 0xFF, 0x00, + 0xE7, 0x81, 0xFF, 0x00, 0xBF, 0xD2, 0x7F, 0x8D, 0x00, 0x92, 0x5B, 0x20, 0xFE, 0xC9, 0xD3, 0xFF, + 0x00, 0xE7, 0x81, 0xFF, 0x00, 0xBF, 0xD2, 0x7F, 0x8D, 0x03, 0x0F, 0xEC, 0x9D, 0x3F, 0xFE, 0x78, + 0x1F, 0xFB, 0xFD, 0x27, 0xF8, 0xD0, 0x01, 0xFD, 0x93, 0xA7, 0xFF, 0x00, 0xCF, 0x03, 0xFF, 0x00, + 0x7F, 0xA4, 0xFF, 0x00, 0x1A, 0x00, 0x3F, 0xB2, 0x74, 0xFF, 0x00, 0xF9, 0xE0, 0x7F, 0xEF, 0xF4, + 0x9F, 0xE3, 0x40, 0x07, 0xF6, 0x4E, 0x9F, 0xFF, 0x00, 0x3C, 0x0F, 0xFD, 0xFE, 0x93, 0xFC, 0x69, + 0x24, 0x96, 0xC8, 0x56, 0x5D, 0x83, 0xFB, 0x27, 0x4F, 0xFF, 0x00, 0x9E, 0x07, 0xFE, 0xFF, 0x00, + 0x49, 0xFE, 0x34, 0x59, 0x76, 0x04, 0x92, 0x56, 0x4B, 0x40, 0xFE, 0xC9, 0xD3, 0xFF, 0x00, 0xE7, + 0x81, 0xFF, 0x00, 0xBF, 0xD2, 0x7F, 0x8D, 0x31, 0x87, 0xF6, 0x4E, 0x9F, 0xFF, 0x00, 0x3C, 0x0F, + 0xFD, 0xFE, 0x93, 0xFC, 0x68, 0x15, 0x95, 0x92, 0xB6, 0x81, 0xFD, 0x93, 0xA7, 0xFF, 0x00, 0xCF, + 0x03, 0xFF, 0x00, 0x7F, 0xA4, 0xFF, 0x00, 0x1A, 0x49, 0x25, 0xB2, 0x18, 0x7F, 0x64, 0xE9, 0xFF, + 0x00, 0xF3, 0xC0, 0xFF, 0x00, 0xDF, 0xE9, 0x3F, 0xC6, 0x98, 0x07, 0xF6, 0x4E, 0x9F, 0xFF, 0x00, + 0x3C, 0x0F, 0xFD, 0xFE, 0x93, 0xFC, 0x68, 0x15, 0x95, 0xAD, 0x6D, 0x03, 0xFB, 0x27, 0x4F, 0xFF, + 0x00, 0x9E, 0x07, 0xFE, 0xFF, 0x00, 0x49, 0xFE, 0x34, 0x0C, 0x3F, 0xB2, 0x74, 0xFF, 0x00, 0xF9, + 0xE0, 0x7F, 0xEF, 0xF4, 0x9F, 0xE3, 0x49, 0x24, 0xB6, 0x42, 0x49, 0x2D, 0x90, 0x7F, 0x64, 0xE9, + 0xFF, 0x00, 0xF3, 0xC0, 0xFF, 0x00, 0xDF, 0xE9, 0x3F, 0xC6, 0x8B, 0x2B, 0x5A, 0xDA, 0x05, 0x95, + 0xAD, 0x6D, 0x03, 0xFB, 0x27, 0x4F, 0xFF, 0x00, 0x9E, 0x07, 0xFE, 0xFF, 0x00, 0x49, 0xFE, 0x34, + 0xC6, 0x1F, 0xD9, 0x3A, 0x7F, 0xFC, 0xF0, 0x3F, 0xF7, 0xFA, 0x4F, 0xF1, 0xA0, 0x03, 0xFB, 0x27, + 0x4F, 0xFF, 0x00, 0x9E, 0x07, 0xFE, 0xFF, 0x00, 0x49, 0xFE, 0x34, 0xAC, 0xAD, 0x6B, 0x68, 0x24, + 0x92, 0xD9, 0x07, 0xF6, 0x4E, 0x9F, 0xFF, 0x00, 0x3C, 0x0F, 0xFD, 0xFE, 0x93, 0xFC, 0x68, 0x49, + 0x24, 0x92, 0x5A, 0x0C, 0x3F, 0xB2, 0x74, 0xFF, 0x00, 0xF9, 0xE0, 0x7F, 0xEF, 0xF4, 0x9F, 0xE3, + 0x42, 0x49, 0x6C, 0x84, 0x92, 0x5B, 0x20, 0xFE, 0xC9, 0xD3, 0xFF, 0x00, 0xE7, 0x81, 0xFF, 0x00, + 0xBF, 0xD2, 0x7F, 0x8D, 0x16, 0x5A, 0x68, 0x09, 0x25, 0xB2, 0x0F, 0xEC, 0x9D, 0x3F, 0xFE, 0x78, + 0x1F, 0xFB, 0xFD, 0x27, 0xF8, 0xD3, 0x18, 0x7F, 0x64, 0xE9, 0xFF, 0x00, 0xF3, 0xC0, 0xFF, 0x00, + 0xDF, 0xE9, 0x3F, 0xC6, 0x80, 0x0F, 0xEC, 0x9D, 0x3F, 0xFE, 0x78, 0x1F, 0xFB, 0xFD, 0x27, 0xF8, + 0xD2, 0xB2, 0xD3, 0x41, 0x24, 0x92, 0x49, 0x2D, 0x03, 0xFB, 0x27, 0x4F, 0xFF, 0x00, 0x9E, 0x07, + 0xFE, 0xFF, 0x00, 0x49, 0xFE, 0x34, 0x59, 0x5A, 0xD6, 0xD0, 0x2C, 0xAD, 0x6B, 0x68, 0x1F, 0xD9, + 0x3A, 0x7F, 0xFC, 0xF0, 0x3F, 0xF7, 0xFA, 0x4F, 0xF1, 0xA6, 0x16, 0x56, 0xB5, 0xB4, 0x0F, 0xEC, + 0x9D, 0x3F, 0xFE, 0x78, 0x1F, 0xFB, 0xFD, 0x27, 0xF8, 0xD2, 0x49, 0x2D, 0x90, 0xC3, 0xFB, 0x27, + 0x4F, 0xFF, 0x00, 0x9E, 0x07, 0xFE, 0xFF, 0x00, 0x49, 0xFE, 0x34, 0xC0, 0x3F, 0xB2, 0x74, 0xFF, + 0x00, 0xF9, 0xE0, 0x7F, 0xEF, 0xF4, 0x9F, 0xE3, 0x40, 0xAC, 0xB4, 0xD0, 0x3F, 0xB2, 0x74, 0xFF, + 0x00, 0xF9, 0xE0, 0x7F, 0xEF, 0xF4, 0x9F, 0xE3, 0x49, 0x24, 0xB6, 0x43, 0x0F, 0xEC, 0x9D, 0x3F, + 0xFE, 0x78, 0x1F, 0xFB, 0xFD, 0x27, 0xF8, 0xD0, 0x92, 0x5B, 0x20, 0x0F, 0xEC, 0x9D, 0x3F, 0xFE, + 0x78, 0x1F, 0xFB, 0xFD, 0x27, 0xF8, 0xD3, 0x00, 0xFE, 0xC9, 0xD3, 0xFF, 0x00, 0xE7, 0x81, 0xFF, + 0x00, 0xBF, 0xD2, 0x7F, 0x8D, 0x2B, 0x2D, 0x34, 0x00, 0xFE, 0xC9, 0xD3, 0xFF, 0x00, 0xE7, 0x81, + 0xFF, 0x00, 0xBF, 0xD2, 0x7F, 0x8D, 0x16, 0x5D, 0x85, 0x65, 0x64, 0xAD, 0xA0, 0x7F, 0x64, 0xE9, + 0xFF, 0x00, 0xF3, 0xC0, 0xFF, 0x00, 0xDF, 0xE9, 0x3F, 0xC6, 0x8B, 0x2B, 0x5A, 0xDA, 0x02, 0x49, + 0x24, 0x92, 0xD0, 0x3F, 0xB2, 0x74, 0xFF, 0x00, 0xF9, 0xE0, 0x7F, 0xEF, 0xF4, 0x9F, 0xE3, 0x4C, + 0x61, 0xFD, 0x93, 0xA7, 0xFF, 0x00, 0xCF, 0x03, 0xFF, 0x00, 0x7F, 0xA4, 0xFF, 0x00, 0x1A, 0x05, + 0x65, 0x6B, 0x5B, 0x43, 0xF8, 0x00, 0xFF, 0x00, 0x83, 0x9D, 0xE1, 0x8A, 0xDF, 0xFE, 0x0B, 0x97, + 0xFF, 0x00, 0x04, 0x86, 0x8A, 0x14, 0xD8, 0x89, 0xA5, 0x7C, 0x3D, 0x0A, 0xB9, 0x2D, 0x80, 0x7E, + 0x2F, 0xDD, 0x1C, 0x64, 0xFD, 0x4D, 0x76, 0x65, 0x9F, 0xF2, 0x30, 0xC3, 0xFF, 0x00, 0x8E, 0x1F, + 0xFA, 0x52, 0x30, 0xC4, 0xA4, 0xB0, 0xB5, 0x2C, 0xBE, 0xCB, 0xFC, 0x8F, 0xB6, 0x2B, 0xF5, 0x33, + 0xE3, 0x82, 0x80, 0x0A, 0x00, 0x28, 0x03, 0xF6, 0x0B, 0xFE, 0x08, 0x85, 0xFF, 0x00, 0x22, 0x27, + 0xED, 0xD7, 0xFF, 0x00, 0x67, 0xCF, 0x07, 0xFE, 0xA8, 0x6F, 0x86, 0x55, 0xF9, 0xD7, 0x10, 0x7F, + 0xC8, 0xD2, 0x7E, 0x91, 0xFF, 0x00, 0xD2, 0x51, 0xF5, 0x19, 0x5F, 0xFB, 0x94, 0x7E, 0x7F, 0x99, + 0xFB, 0x6D, 0x5E, 0x29, 0xE8, 0x85, 0x00, 0x14, 0x00, 0x50, 0x01, 0x40, 0x05, 0x00, 0x14, 0x00, + 0x50, 0x01, 0x40, 0x05, 0x00, 0x14, 0x00, 0x50, 0x01, 0x40, 0x05, 0x00, 0x14, 0x00, 0x50, 0x01, + 0x40, 0x05, 0x00, 0x14, 0x00, 0x50, 0x01, 0x40, 0x05, 0x00, 0x14, 0x00, 0x50, 0x01, 0x40, 0x05, + 0x00, 0x14, 0x00, 0x50, 0x01, 0x40, 0x05, 0x00, 0x14, 0x00, 0x50, 0x01, 0x40, 0x05, 0x00, 0x14, + 0x00, 0x50, 0x01, 0x40, 0x05, 0x00, 0x14, 0x00, 0x50, 0x01, 0x40, 0x05, 0x00, 0x14, 0x00, 0x50, + 0x01, 0x40, 0x05, 0x00, 0x14, 0x00, 0x50, 0x01, 0x40, 0x05, 0x00, 0x14, 0x00, 0x50, 0x01, 0x40, + 0x05, 0x00, 0x14, 0x00, 0x50, 0x01, 0x40, 0x05, 0x00, 0x14, 0x00, 0x50, 0x01, 0x40, 0x05, 0x00, + 0x7F, 0x9F, 0x9F, 0xFC, 0x1C, 0xFB, 0xFF, 0x00, 0x29, 0xCF, 0xFF, 0x00, 0x82, 0x43, 0xFF, 0x00, + 0xD8, 0x2B, 0xE1, 0xEF, 0xFE, 0xAD, 0xEB, 0x9A, 0xEC, 0xCB, 0x3F, 0xE4, 0x61, 0x87, 0xFF, 0x00, + 0x1C, 0x3F, 0xF4, 0xA4, 0x73, 0xE2, 0x7F, 0xDD, 0x6A, 0x7F, 0x85, 0xFE, 0x47, 0xDA, 0x95, 0xFA, + 0x99, 0xF1, 0xC1, 0x40, 0x05, 0x00, 0x14, 0x01, 0xFB, 0x05, 0xFF, 0x00, 0x04, 0x42, 0xFF, 0x00, + 0x91, 0x13, 0xF6, 0xEB, 0xFF, 0x00, 0xB3, 0xE7, 0x83, 0xFF, 0x00, 0x54, 0x37, 0xC3, 0x2A, 0xFC, + 0xEB, 0x88, 0x3F, 0xE4, 0x69, 0x3F, 0x48, 0xFF, 0x00, 0xE9, 0x28, 0xFA, 0x8C, 0xAF, 0xFD, 0xCA, + 0x3F, 0x3F, 0xCC, 0xFD, 0xB6, 0xAF, 0x14, 0xF4, 0x42, 0x80, 0x0A, 0x00, 0x28, 0x00, 0xA0, 0x02, + 0x80, 0x0A, 0x00, 0x28, 0x00, 0xA0, 0x02, 0x80, 0x0A, 0x00, 0x28, 0x00, 0xA0, 0x02, 0x80, 0x0A, + 0x00, 0x28, 0x00, 0xA0, 0x02, 0x80, 0x0A, 0x00, 0x28, 0x00, 0xA0, 0x02, 0x80, 0x0A, 0x00, 0x28, + 0x00, 0xA0, 0x02, 0x80, 0x0A, 0x00, 0x28, 0x00, 0xA0, 0x02, 0x80, 0x0A, 0x00, 0x28, 0x00, 0xA0, + 0x02, 0x80, 0x0A, 0x00, 0x28, 0x00, 0xA0, 0x02, 0x80, 0x0A, 0x00, 0x28, 0x00, 0xA0, 0x02, 0x80, + 0x0A, 0x00, 0x28, 0x00, 0xA0, 0x02, 0x80, 0x0A, 0x00, 0x28, 0x00, 0xA0, 0x02, 0x80, 0x0A, 0x00, + 0x28, 0x00, 0xA0, 0x02, 0x80, 0x0A, 0x00, 0x28, 0x00, 0xA0, 0x02, 0x80, 0x0A, 0x00, 0x28, 0x00, + 0xA0, 0x02, 0x80, 0x3F, 0xCF, 0xCF, 0xFE, 0x0E, 0x7D, 0xFF, 0x00, 0x94, 0xE7, 0xFF, 0x00, 0xC1, + 0x21, 0xFF, 0x00, 0xEC, 0x15, 0xF0, 0xF7, 0xFF, 0x00, 0x56, 0xF5, 0xCD, 0x76, 0x65, 0x9F, 0xF2, + 0x30, 0xC3, 0xFF, 0x00, 0x8E, 0x1F, 0xFA, 0x52, 0x39, 0xF1, 0x3F, 0xEE, 0xB5, 0x3F, 0xC2, 0xFF, + 0x00, 0x23, 0xED, 0x4A, 0xFD, 0x4C, 0xF8, 0xE0, 0xA0, 0x02, 0x80, 0x0A, 0x00, 0xFD, 0x82, 0xFF, + 0x00, 0x82, 0x21, 0x7F, 0xC8, 0x89, 0xFB, 0x75, 0xFF, 0x00, 0xD9, 0xF3, 0xC1, 0xFF, 0x00, 0xAA, + 0x1B, 0xE1, 0x95, 0x7E, 0x75, 0xC4, 0x1F, 0xF2, 0x34, 0x9F, 0xA4, 0x7F, 0xF4, 0x94, 0x7D, 0x46, + 0x57, 0xFE, 0xE5, 0x1F, 0x9F, 0xE6, 0x7E, 0xDB, 0x57, 0x8A, 0x7A, 0x21, 0x40, 0x05, 0x00, 0x14, + 0x00, 0x50, 0x01, 0x40, 0x05, 0x00, 0x14, 0x00, 0x50, 0x01, 0x40, 0x05, 0x00, 0x14, 0x00, 0x50, + 0x01, 0x40, 0x05, 0x00, 0x14, 0x00, 0x50, 0x01, 0x40, 0x05, 0x00, 0x14, 0x00, 0x50, 0x01, 0x40, + 0x05, 0x00, 0x14, 0x00, 0x50, 0x01, 0x40, 0x05, 0x00, 0x14, 0x00, 0x50, 0x01, 0x40, 0x05, 0x00, + 0x14, 0x00, 0x50, 0x01, 0x40, 0x05, 0x00, 0x14, 0x00, 0x50, 0x01, 0x40, 0x05, 0x00, 0x14, 0x00, + 0x50, 0x01, 0x40, 0x05, 0x00, 0x14, 0x00, 0x50, 0x01, 0x40, 0x05, 0x00, 0x14, 0x00, 0x50, 0x01, + 0x40, 0x05, 0x00, 0x14, 0x00, 0x50, 0x01, 0x40, 0x05, 0x00, 0x14, 0x00, 0x50, 0x01, 0x40, 0x05, + 0x00, 0x14, 0x00, 0x50, 0x01, 0x40, 0x1F, 0xE7, 0xE7, 0xFF, 0x00, 0x07, 0x3E, 0xFF, 0x00, 0xCA, + 0x73, 0xFF, 0x00, 0xE0, 0x90, 0xFF, 0x00, 0xF6, 0x0A, 0xF8, 0x7B, 0xFF, 0x00, 0xAB, 0x7A, 0xE6, + 0xBB, 0x32, 0xCF, 0xF9, 0x18, 0x61, 0xFF, 0x00, 0xC7, 0x0F, 0xFD, 0x29, 0x1C, 0xF8, 0x9F, 0xF7, + 0x5A, 0x9F, 0xE1, 0x7F, 0x91, 0xF6, 0xA5, 0x7E, 0xA6, 0x7C, 0x70, 0x50, 0x01, 0x40, 0x05, 0x00, + 0x7E, 0xC1, 0x7F, 0xC1, 0x10, 0xBF, 0xE4, 0x44, 0xFD, 0xBA, 0xFF, 0x00, 0xEC, 0xF9, 0xE0, 0xFF, + 0x00, 0xD5, 0x0D, 0xF0, 0xCA, 0xBF, 0x3A, 0xE2, 0x0F, 0xF9, 0x1A, 0x4F, 0xD2, 0x3F, 0xFA, 0x4A, + 0x3E, 0xA3, 0x2B, 0xFF, 0x00, 0x72, 0x8F, 0xCF, 0xF3, 0x3F, 0x6D, 0xAB, 0xC5, 0x3D, 0x10, 0xA0, + 0x02, 0x80, 0x0A, 0x00, 0x28, 0x00, 0xA0, 0x02, 0x80, 0x0A, 0x00, 0x28, 0x00, 0xA0, 0x02, 0x80, + 0x0A, 0x00, 0x28, 0x00, 0xA0, 0x02, 0x80, 0x0A, 0x00, 0x28, 0x00, 0xA0, 0x02, 0x80, 0x0A, 0x00, + 0x28, 0x00, 0xA0, 0x02, 0x80, 0x0A, 0x00, 0x28, 0x00, 0xA0, 0x02, 0x80, 0x0A, 0x00, 0x28, 0x00, + 0xA0, 0x02, 0x80, 0x0A, 0x00, 0x28, 0x00, 0xA0, 0x02, 0x80, 0x0A, 0x00, 0x28, 0x00, 0xA0, 0x02, + 0x80, 0x0A, 0x00, 0x28, 0x00, 0xA0, 0x02, 0x80, 0x0A, 0x00, 0x28, 0x00, 0xA0, 0x02, 0x80, 0x0A, + 0x00, 0x28, 0x00, 0xA0, 0x02, 0x80, 0x0A, 0x00, 0x28, 0x00, 0xA0, 0x02, 0x80, 0x0A, 0x00, 0x28, + 0x00, 0xA0, 0x02, 0x80, 0x0A, 0x00, 0x28, 0x00, 0xA0, 0x0F, 0xF3, 0xF3, 0xFF, 0x00, 0x83, 0x9F, + 0x7F, 0xE5, 0x39, 0xFF, 0x00, 0xF0, 0x48, 0x7F, 0xFB, 0x05, 0x7C, 0x3D, 0xFF, 0x00, 0xD5, 0xBD, + 0x73, 0x5D, 0x99, 0x67, 0xFC, 0x8C, 0x30, 0xFF, 0x00, 0xE3, 0x87, 0xFE, 0x94, 0x8E, 0x7C, 0x4F, + 0xFB, 0xAD, 0x4F, 0xF0, 0xBF, 0xC8, 0xFB, 0x52, 0xBF, 0x53, 0x3E, 0x38, 0x28, 0x00, 0xA0, 0x02, + 0x80, 0x3F, 0x60, 0xBF, 0xE0, 0x88, 0x5F, 0xF2, 0x22, 0x7E, 0xDD, 0x7F, 0xF6, 0x7C, 0xF0, 0x7F, + 0xEA, 0x86, 0xF8, 0x65, 0x5F, 0x9D, 0x71, 0x07, 0xFC, 0x8D, 0x27, 0xE9, 0x1F, 0xFD, 0x25, 0x1F, + 0x51, 0x95, 0xFF, 0x00, 0xB9, 0x47, 0xE7, 0xF9, 0x9F, 0xB6, 0xD5, 0xE2, 0x9E, 0x88, 0x50, 0x01, + 0x40, 0x05, 0x00, 0x14, 0x00, 0x50, 0x01, 0x40, 0x05, 0x00, 0x14, 0x00, 0x50, 0x01, 0x40, 0x05, + 0x00, 0x14, 0x00, 0x50, 0x01, 0x40, 0x05, 0x00, 0x14, 0x00, 0x50, 0x01, 0x40, 0x05, 0x00, 0x14, + 0x00, 0x50, 0x01, 0x40, 0x05, 0x00, 0x14, 0x00, 0x50, 0x01, 0x40, 0x05, 0x00, 0x14, 0x00, 0x50, + 0x01, 0x40, 0x05, 0x00, 0x14, 0x00, 0x50, 0x01, 0x40, 0x05, 0x00, 0x14, 0x00, 0x50, 0x01, 0x40, + 0x05, 0x00, 0x14, 0x00, 0x50, 0x01, 0x40, 0x05, 0x00, 0x14, 0x00, 0x50, 0x01, 0x40, 0x05, 0x00, + 0x14, 0x00, 0x50, 0x01, 0x40, 0x05, 0x00, 0x14, 0x00, 0x50, 0x01, 0x40, 0x05, 0x00, 0x14, 0x00, + 0x50, 0x01, 0x40, 0x05, 0x00, 0x14, 0x00, 0x50, 0x07, 0xF9, 0xF9, 0xFF, 0x00, 0xC1, 0xCF, 0xBF, + 0xF2, 0x9C, 0xFF, 0x00, 0xF8, 0x24, 0x3F, 0xFD, 0x82, 0xBE, 0x1E, 0xFF, 0x00, 0xEA, 0xDE, 0xB9, + 0xAE, 0xCC, 0xB3, 0xFE, 0x46, 0x18, 0x7F, 0xF1, 0xC3, 0xFF, 0x00, 0x4A, 0x47, 0x3E, 0x27, 0xFD, + 0xD6, 0xA7, 0xF8, 0x5F, 0xE4, 0x7D, 0xA9, 0x5F, 0xA9, 0x9F, 0x1C, 0x14, 0x00, 0x50, 0x01, 0x40, + 0x1F, 0xB0, 0x5F, 0xF0, 0x44, 0x2F, 0xF9, 0x11, 0x3F, 0x6E, 0xBF, 0xFB, 0x3E, 0x78, 0x3F, 0xF5, + 0x43, 0x7C, 0x32, 0xAF, 0xCE, 0xB8, 0x83, 0xFE, 0x46, 0x93, 0xF4, 0x8F, 0xFE, 0x92, 0x8F, 0xA8, + 0xCA, 0xFF, 0x00, 0xDC, 0xA3, 0xF3, 0xFC, 0xCF, 0xDB, 0x6A, 0xF1, 0x4F, 0x44, 0x28, 0x00, 0xA0, + 0x02, 0x80, 0x0A, 0x00, 0x28, 0x00, 0xA0, 0x02, 0x80, 0x0A, 0x00, 0x28, 0x00, 0xA0, 0x02, 0x80, + 0x0A, 0x00, 0x28, 0x00, 0xA0, 0x02, 0x80, 0x0A, 0x00, 0x28, 0x00, 0xA0, 0x02, 0x80, 0x0A, 0x00, + 0x28, 0x00, 0xA0, 0x02, 0x80, 0x0A, 0x00, 0x28, 0x00, 0xA0, 0x02, 0x80, 0x0A, 0x00, 0x28, 0x00, + 0xA0, 0x02, 0x80, 0x0A, 0x00, 0x28, 0x00, 0xA0, 0x02, 0x80, 0x0A, 0x00, 0x28, 0x00, 0xA0, 0x02, + 0x80, 0x0A, 0x00, 0x28, 0x00, 0xA0, 0x02, 0x80, 0x0A, 0x00, 0x28, 0x00, 0xA0, 0x02, 0x80, 0x0A, + 0x00, 0x28, 0x00, 0xA0, 0x02, 0x80, 0x0A, 0x00, 0x28, 0x00, 0xA0, 0x02, 0x80, 0x0A, 0x00, 0x28, + 0x00, 0xA0, 0x02, 0x80, 0x0A, 0x00, 0x28, 0x03, 0xFC, 0xFC, 0xFF, 0x00, 0xE0, 0xE7, 0xDF, 0xF9, + 0x4E, 0x7F, 0xFC, 0x12, 0x1F, 0xFE, 0xC1, 0x5F, 0x0F, 0x7F, 0xF5, 0x6F, 0x5C, 0xD7, 0x66, 0x59, + 0xFF, 0x00, 0x23, 0x0C, 0x3F, 0xF8, 0xE1, 0xFF, 0x00, 0xA5, 0x23, 0x9F, 0x13, 0xFE, 0xEB, 0x53, + 0xFC, 0x2F, 0xF2, 0x3E, 0xD4, 0xAF, 0xD4, 0xCF, 0x8E, 0x0A, 0x00, 0x28, 0x00, 0xA0, 0x0F, 0xD8, + 0x2F, 0xF8, 0x22, 0x17, 0xFC, 0x88, 0x9F, 0xB7, 0x5F, 0xFD, 0x9F, 0x3C, 0x1F, 0xFA, 0xA1, 0xBE, + 0x19, 0x57, 0xE7, 0x5C, 0x41, 0xFF, 0x00, 0x23, 0x49, 0xFA, 0x47, 0xFF, 0x00, 0x49, 0x47, 0xD4, + 0x65, 0x7F, 0xEE, 0x51, 0xF9, 0xFE, 0x67, 0xED, 0xB5, 0x78, 0xA7, 0xA2, 0x14, 0x00, 0x50, 0x01, + 0x40, 0x05, 0x00, 0x14, 0x00, 0x50, 0x01, 0x40, 0x05, 0x00, 0x14, 0x00, 0x50, 0x01, 0x40, 0x05, + 0x00, 0x14, 0x00, 0x50, 0x01, 0x40, 0x05, 0x00, 0x14, 0x00, 0x50, 0x01, 0x40, 0x05, 0x00, 0x14, + 0x00, 0x50, 0x01, 0x40, 0x05, 0x00, 0x14, 0x00, 0x50, 0x01, 0x40, 0x05, 0x00, 0x14, 0x00, 0x50, + 0x01, 0x40, 0x05, 0x00, 0x14, 0x00, 0x50, 0x01, 0x40, 0x05, 0x00, 0x14, 0x00, 0x50, 0x01, 0x40, + 0x05, 0x00, 0x14, 0x00, 0x50, 0x01, 0x40, 0x05, 0x00, 0x14, 0x00, 0x50, 0x01, 0x40, 0x05, 0x00, + 0x14, 0x00, 0x50, 0x01, 0x40, 0x05, 0x00, 0x14, 0x00, 0x50, 0x01, 0x40, 0x05, 0x00, 0x14, 0x00, + 0x50, 0x01, 0x40, 0x05, 0x00, 0x14, 0x01, 0xFE, 0x7E, 0x7F, 0xF0, 0x73, 0xEF, 0xFC, 0xA7, 0x3F, + 0xFE, 0x09, 0x0F, 0xFF, 0x00, 0x60, 0xAF, 0x87, 0xBF, 0xFA, 0xB7, 0xAE, 0x6B, 0xB3, 0x2C, 0xFF, + 0x00, 0x91, 0x86, 0x1F, 0xFC, 0x70, 0xFF, 0x00, 0xD2, 0x91, 0xCF, 0x89, 0xFF, 0x00, 0x75, 0xA9, + 0xFE, 0x17, 0xF9, 0x1F, 0x6A, 0x57, 0xEA, 0x67, 0xC7, 0x05, 0x00, 0x14, 0x00, 0x50, 0x07, 0xEC, + 0x17, 0xFC, 0x11, 0x0B, 0xFE, 0x44, 0x4F, 0xDB, 0xAF, 0xFE, 0xCF, 0x9E, 0x0F, 0xFD, 0x50, 0xDF, + 0x0C, 0xAB, 0xF3, 0xAE, 0x20, 0xFF, 0x00, 0x91, 0xA4, 0xFD, 0x23, 0xFF, 0x00, 0xA4, 0xA3, 0xEA, + 0x32, 0xBF, 0xF7, 0x28, 0xFC, 0xFF, 0x00, 0x33, 0xF6, 0xDA, 0xBC, 0x53, 0xD1, 0x0A, 0x00, 0x28, + 0x00, 0xA0, 0x02, 0x80, 0x0A, 0x00, 0x28, 0x00, 0xA0, 0x02, 0x80, 0x0A, 0x00, 0x28, 0x00, 0xA0, + 0x02, 0x80, 0x0A, 0x00, 0x28, 0x00, 0xA0, 0x02, 0x80, 0x0A, 0x00, 0x28, 0x00, 0xA0, 0x02, 0x80, + 0x0A, 0x00, 0x28, 0x00, 0xA0, 0x02, 0x80, 0x0A, 0x00, 0x28, 0x00, 0xA0, 0x02, 0x80, 0x0A, 0x00, + 0x28, 0x00, 0xA0, 0x02, 0x80, 0x0A, 0x00, 0x28, 0x00, 0xA0, 0x02, 0x80, 0x0A, 0x00, 0x28, 0x00, + 0xA0, 0x02, 0x80, 0x0A, 0x00, 0x28, 0x00, 0xA0, 0x02, 0x80, 0x0A, 0x00, 0x28, 0x00, 0xA0, 0x02, + 0x80, 0x0A, 0x00, 0x28, 0x00, 0xA0, 0x02, 0x80, 0x0A, 0x00, 0x28, 0x00, 0xA0, 0x02, 0x80, 0x0A, + 0x00, 0x28, 0x00, 0xA0, 0x02, 0x80, 0x0A, 0x00, 0xFF, 0x00, 0x3F, 0x3F, 0xF8, 0x39, 0xF7, 0xFE, + 0x53, 0x9F, 0xFF, 0x00, 0x04, 0x87, 0xFF, 0x00, 0xB0, 0x57, 0xC3, 0xDF, 0xFD, 0x5B, 0xD7, 0x35, + 0xD9, 0x96, 0x7F, 0xC8, 0xC3, 0x0F, 0xFE, 0x38, 0x7F, 0xE9, 0x48, 0xE7, 0xC4, 0xFF, 0x00, 0xBA, + 0xD4, 0xFF, 0x00, 0x0B, 0xFC, 0x8F, 0xB5, 0x2B, 0xF5, 0x33, 0xE3, 0x82, 0x80, 0x0A, 0x00, 0x28, + 0x03, 0xF6, 0x0B, 0xFE, 0x08, 0x85, 0xFF, 0x00, 0x22, 0x27, 0xED, 0xD7, 0xFF, 0x00, 0x67, 0xCF, + 0x07, 0xFE, 0xA8, 0x6F, 0x86, 0x55, 0xF9, 0xD7, 0x10, 0x7F, 0xC8, 0xD2, 0x7E, 0x91, 0xFF, 0x00, + 0xD2, 0x51, 0xF5, 0x19, 0x5F, 0xFB, 0x94, 0x7E, 0x7F, 0x99, 0xFB, 0x6D, 0x5E, 0x29, 0xE8, 0x85, + 0x00, 0x14, 0x00, 0x50, 0x01, 0x40, 0x05, 0x00, 0x14, 0x00, 0x50, 0x01, 0x40, 0x08, 0x7E, 0xE9, + 0xFF, 0x00, 0x77, 0xFA, 0x50, 0x04, 0x14, 0x00, 0x50, 0x01, 0x40, 0x05, 0x00, 0x14, 0x00, 0x50, + 0x01, 0x40, 0x05, 0x00, 0x14, 0x00, 0x50, 0x01, 0x40, 0x05, 0x00, 0x14, 0x00, 0x50, 0x01, 0x40, + 0x05, 0x00, 0x14, 0x00, 0x50, 0x01, 0x40, 0x05, 0x00, 0x14, 0x00, 0x50, 0x01, 0x40, 0x05, 0x00, + 0x14, 0x00, 0x50, 0x01, 0x40, 0x05, 0x00, 0x14, 0x00, 0x50, 0x01, 0x40, 0x05, 0x00, 0x14, 0x00, + 0x50, 0x01, 0x40, 0x05, 0x00, 0x14, 0x00, 0x50, 0x01, 0x40, 0x05, 0x00, 0x14, 0x00, 0x50, 0x01, + 0x40, 0x05, 0x00, 0x14, 0x00, 0x50, 0x05, 0x8A, 0x00, 0x28, 0x00, 0xA0, 0x02, 0x80, 0x0A, 0x00, + 0x28, 0x03, 0xFC, 0xFC, 0xFF, 0x00, 0xE0, 0xE7, 0xDF, 0xF9, 0x4E, 0x7F, 0xFC, 0x12, 0x1F, 0xFE, + 0xC1, 0x5F, 0x0F, 0x7F, 0xF5, 0x6F, 0x5C, 0xD7, 0x66, 0x59, 0xFF, 0x00, 0x23, 0x0C, 0x3F, 0xF8, + 0xE1, 0xFF, 0x00, 0xA5, 0x23, 0x9F, 0x13, 0xFE, 0xEB, 0x53, 0xFC, 0x2F, 0xF2, 0x3E, 0xD4, 0xAF, + 0xD4, 0xCF, 0x8E, 0x0A, 0x00, 0x28, 0x00, 0xA0, 0x0F, 0xD8, 0x2F, 0xF8, 0x22, 0x17, 0xFC, 0x88, + 0x9F, 0xB7, 0x5F, 0xFD, 0x9F, 0x3C, 0x1F, 0xFA, 0xA1, 0xBE, 0x19, 0x57, 0xE7, 0x5C, 0x41, 0xFF, + 0x00, 0x23, 0x49, 0xFA, 0x47, 0xFF, 0x00, 0x49, 0x47, 0xD4, 0x65, 0x7F, 0xEE, 0x51, 0xF9, 0xFE, + 0x67, 0xED, 0xB5, 0x78, 0xA7, 0xA2, 0x14, 0x00, 0x50, 0x01, 0x40, 0x05, 0x00, 0x14, 0x00, 0x50, + 0x01, 0x40, 0x05, 0x00, 0x21, 0xFB, 0xA7, 0xFD, 0xDF, 0xE9, 0x40, 0x10, 0x50, 0x01, 0x40, 0x05, + 0x00, 0x14, 0x00, 0x50, 0x01, 0x40, 0x05, 0x00, 0x14, 0x00, 0x50, 0x01, 0x40, 0x05, 0x00, 0x14, + 0x00, 0x50, 0x01, 0x40, 0x05, 0x00, 0x03, 0x8C, 0x70, 0x38, 0xC7, 0x18, 0xE3, 0x8E, 0xD8, 0xFC, + 0x28, 0x03, 0xE6, 0x3F, 0x87, 0xBE, 0x3E, 0xF1, 0x87, 0xC3, 0xCF, 0x17, 0xE9, 0x7F, 0x02, 0xFE, + 0x39, 0x6A, 0xAF, 0xAE, 0x6B, 0x1A, 0xC7, 0xDA, 0xBF, 0xE1, 0x4A, 0x7C, 0x6A, 0x7D, 0x3D, 0x34, + 0xFD, 0x37, 0xE3, 0x5D, 0x9D, 0xA4, 0x72, 0xDC, 0x4D, 0xA4, 0xEB, 0x31, 0xDB, 0xDB, 0xC7, 0x63, + 0xA6, 0xF8, 0xB2, 0xCA, 0xCE, 0x20, 0xD3, 0xDA, 0xA1, 0x8E, 0x1D, 0x56, 0x0B, 0x7B, 0x9D, 0x57, + 0x4E, 0x8A, 0x38, 0xE1, 0xD5, 0x34, 0xDF, 0x0E, 0x80, 0x7D, 0x39, 0x40, 0x19, 0xDA, 0xBC, 0xD2, + 0xDA, 0xE9, 0x1A, 0x9D, 0xC5, 0xBB, 0x79, 0x73, 0x5B, 0xE9, 0xB3, 0xCD, 0x0B, 0x85, 0x53, 0xE5, + 0xBA, 0x44, 0x4A, 0x90, 0x08, 0x23, 0x82, 0x07, 0x04, 0x62, 0x80, 0x3C, 0x7F, 0xF6, 0x61, 0xF1, + 0x5F, 0x88, 0x7C, 0x79, 0xFB, 0x35, 0x7E, 0xCF, 0x1E, 0x38, 0xF1, 0x76, 0xA6, 0xFA, 0xD7, 0x8B, + 0x3C, 0x67, 0xF0, 0x33, 0xC2, 0x3E, 0x2B, 0xF1, 0x3E, 0xB3, 0x25, 0xAC, 0x16, 0x52, 0x6A, 0xDA, + 0x8E, 0xA3, 0xE1, 0xFB, 0x4B, 0x8B, 0xDB, 0xA6, 0x86, 0x04, 0x8E, 0x18, 0xCC, 0x93, 0x4D, 0x2B, + 0xEC, 0x8E, 0x34, 0x45, 0xDD, 0x85, 0x55, 0x00, 0x00, 0x01, 0xEE, 0x34, 0x01, 0xF2, 0xF7, 0xC4, + 0x3F, 0x88, 0xDE, 0x2F, 0xF1, 0xF7, 0x8C, 0xF5, 0x5F, 0x80, 0x5F, 0x01, 0x75, 0x65, 0xD1, 0xFC, + 0x4F, 0xA2, 0x0B, 0x43, 0xF1, 0xB3, 0xE3, 0x4A, 0xE9, 0x96, 0xBA, 0xF6, 0x89, 0xF0, 0x06, 0xCA, + 0xF2, 0x18, 0x2E, 0x61, 0xD2, 0x2C, 0x6D, 0xA6, 0x26, 0x0B, 0xCF, 0x19, 0x6A, 0x1A, 0x7D, 0xCA, + 0xCD, 0x63, 0x6B, 0x24, 0x57, 0x16, 0xBA, 0x64, 0x13, 0x5B, 0x6B, 0x1A, 0xA4, 0x32, 0xC3, 0x2E, + 0x95, 0xA4, 0xF8, 0xA0, 0x03, 0xE9, 0xC8, 0x23, 0x30, 0xC1, 0x0C, 0x2D, 0x2C, 0x93, 0xB4, 0x51, + 0x2C, 0x46, 0x79, 0xB6, 0x79, 0xD3, 0x15, 0x50, 0x0B, 0xBE, 0xD5, 0x55, 0xC9, 0xC6, 0x4E, 0xD5, + 0x51, 0xE8, 0x00, 0xE0, 0x00, 0x4B, 0x40, 0x05, 0x00, 0x14, 0x00, 0x50, 0x01, 0x40, 0x05, 0x00, + 0x14, 0x00, 0x50, 0x01, 0x40, 0x05, 0x00, 0x14, 0x00, 0x50, 0x01, 0x40, 0x05, 0x00, 0x14, 0x00, + 0x50, 0x01, 0x40, 0x05, 0x00, 0x14, 0x00, 0x50, 0x01, 0x40, 0x05, 0x00, 0x14, 0x01, 0x62, 0x80, + 0x0A, 0x00, 0x28, 0x00, 0xA0, 0x02, 0x80, 0x0A, 0x00, 0xFF, 0x00, 0x3F, 0x3F, 0xF8, 0x39, 0xF7, + 0xFE, 0x53, 0x9F, 0xFF, 0x00, 0x04, 0x87, 0xFF, 0x00, 0xB0, 0x57, 0xC3, 0xDF, 0xFD, 0x5B, 0xD7, + 0x35, 0xD9, 0x96, 0x7F, 0xC8, 0xC3, 0x0F, 0xFE, 0x38, 0x7F, 0xE9, 0x48, 0xE7, 0xC4, 0xFF, 0x00, + 0xBA, 0xD4, 0xFF, 0x00, 0x0B, 0xFC, 0x8F, 0xB5, 0x2B, 0xF5, 0x33, 0xE3, 0x82, 0x80, 0x0A, 0x00, + 0x28, 0x03, 0xF6, 0x0B, 0xFE, 0x08, 0x85, 0xFF, 0x00, 0x22, 0x27, 0xED, 0xD7, 0xFF, 0x00, 0x67, + 0xCF, 0x07, 0xFE, 0xA8, 0x6F, 0x86, 0x55, 0xF9, 0xD7, 0x10, 0x7F, 0xC8, 0xD2, 0x7E, 0x91, 0xFF, + 0x00, 0xD2, 0x51, 0xF5, 0x19, 0x5F, 0xFB, 0x94, 0x7E, 0x7F, 0x99, 0xFB, 0x6D, 0x5E, 0x29, 0xE8, + 0x85, 0x00, 0x14, 0x00, 0x50, 0x01, 0x40, 0x05, 0x00, 0x14, 0x00, 0x50, 0x01, 0x40, 0x08, 0x7E, + 0xE9, 0xFF, 0x00, 0x77, 0xFA, 0x50, 0x04, 0x14, 0x00, 0x50, 0x01, 0x40, 0x05, 0x00, 0x14, 0x00, + 0x50, 0x01, 0x40, 0x05, 0x00, 0x14, 0x00, 0x50, 0x01, 0x40, 0x05, 0x00, 0x14, 0x00, 0x50, 0x01, + 0x40, 0x05, 0x00, 0x71, 0xDE, 0x3D, 0xF0, 0x07, 0x84, 0x3E, 0x27, 0x78, 0x53, 0x51, 0xF0, 0x4F, + 0x8E, 0x74, 0x58, 0x75, 0xDF, 0x0E, 0x6A, 0x72, 0xDA, 0x5E, 0x3D, 0xA9, 0xB8, 0x9F, 0x4E, 0xBD, + 0xD3, 0xEF, 0x34, 0xEB, 0xC8, 0xAF, 0x34, 0xAD, 0x4F, 0x4E, 0xBE, 0xB7, 0x78, 0xEE, 0xAC, 0x75, + 0x0B, 0x2B, 0xDB, 0x3B, 0x2B, 0xBB, 0x4B, 0xDB, 0x59, 0x61, 0xB8, 0xB4, 0xB9, 0xB6, 0xB6, 0xB9, + 0x82, 0x58, 0xA6, 0x82, 0x39, 0x10, 0x02, 0x8F, 0xC3, 0x1F, 0x0F, 0xF8, 0xE3, 0xC2, 0x9E, 0x11, + 0xB1, 0xF0, 0xDF, 0x8F, 0xBC, 0x71, 0x17, 0xC4, 0x9D, 0x67, 0x45, 0x96, 0x4D, 0x36, 0xC7, 0xC7, + 0x12, 0x68, 0x11, 0x78, 0x6F, 0x5E, 0xF1, 0x1E, 0x9D, 0x11, 0xDB, 0xA7, 0xDC, 0x6B, 0x76, 0xF0, + 0xB9, 0xB4, 0x7D, 0x54, 0xC2, 0x23, 0x17, 0x73, 0xDA, 0x45, 0x69, 0x6D, 0x3C, 0xE2, 0x59, 0xE0, + 0xB2, 0xB1, 0x8E, 0x54, 0xB4, 0xB7, 0x00, 0xF1, 0x1F, 0x1C, 0xFE, 0xD6, 0xDF, 0x07, 0x34, 0x48, + 0x2E, 0x34, 0x78, 0x6C, 0xFE, 0x38, 0xF8, 0xC0, 0x6A, 0x9A, 0x6E, 0xA5, 0x6F, 0x69, 0xAE, 0x7C, + 0x26, 0xFD, 0x94, 0x3E, 0x2B, 0x7C, 0x6E, 0xF0, 0x6F, 0x9B, 0x65, 0xAA, 0xDF, 0xE9, 0x37, 0x96, + 0xEF, 0xAD, 0xF8, 0x73, 0xC3, 0x7A, 0x85, 0x82, 0x4F, 0x15, 0xF6, 0x8F, 0x7E, 0x8F, 0x01, 0x9B, + 0xCD, 0x08, 0xB0, 0xCD, 0xB3, 0xCA, 0xB8, 0x82, 0x49, 0x40, 0x3C, 0x4B, 0xF6, 0x76, 0xFD, 0xA9, + 0x7E, 0x11, 0xFC, 0x2D, 0xF8, 0x15, 0xF0, 0x2F, 0xE1, 0x6F, 0x8D, 0xAC, 0x3E, 0x3F, 0xF8, 0x77, + 0x51, 0xF8, 0x6F, 0xF0, 0x8F, 0xC3, 0x1E, 0x02, 0xF1, 0x77, 0x8C, 0xBC, 0x4B, 0xFB, 0x16, 0x7C, + 0x6F, 0xF0, 0x07, 0xC2, 0x8D, 0x12, 0x7D, 0x1B, 0x45, 0xB6, 0xB4, 0xD4, 0x35, 0x2B, 0xEF, 0x13, + 0xEB, 0x5E, 0x0F, 0xB0, 0xB0, 0xD3, 0xF4, 0xA8, 0xDA, 0xDA, 0x59, 0x5E, 0xFB, 0x50, 0x92, 0xCE, + 0x18, 0x61, 0x53, 0x2C, 0xCD, 0x0A, 0xAB, 0x6C, 0x00, 0xFB, 0x83, 0xE2, 0x4E, 0x83, 0xE3, 0x4F, + 0x13, 0xF8, 0x2B, 0x59, 0xF0, 0xEF, 0xC3, 0xEF, 0x1C, 0xB7, 0xC3, 0x3F, 0x13, 0x6B, 0x4B, 0x06, + 0x9B, 0x07, 0x8F, 0xAD, 0x34, 0x0B, 0x2F, 0x12, 0xEB, 0x5E, 0x12, 0xB4, 0x96, 0xE2, 0x35, 0xD4, + 0x6F, 0x74, 0x8B, 0x3B, 0xC4, 0x92, 0xC0, 0xEA, 0x69, 0x68, 0x6E, 0x8D, 0x9B, 0xDE, 0xDB, 0xDE, + 0xDA, 0x45, 0x75, 0xF6, 0x69, 0x6E, 0x6C, 0xAF, 0x60, 0x8E, 0x4B, 0x4B, 0x80, 0x09, 0x7E, 0x1D, + 0xFC, 0x3B, 0xF0, 0x6F, 0xC2, 0x9F, 0x08, 0x69, 0x7E, 0x06, 0xF0, 0x16, 0x89, 0x1E, 0x83, 0xE1, + 0xBD, 0x2A, 0x5B, 0xBB, 0xD8, 0xED, 0xBE, 0xD7, 0x73, 0xAA, 0x5F, 0x6A, 0x17, 0xBA, 0x8D, 0xEC, + 0xB7, 0x9A, 0xAE, 0xA9, 0xA8, 0xDF, 0xDC, 0xC9, 0x2D, 0xDD, 0xF6, 0xA1, 0x7B, 0x7D, 0x79, 0x7B, + 0x79, 0x77, 0x7B, 0x75, 0x2C, 0xD7, 0x37, 0x77, 0x57, 0x37, 0x37, 0x33, 0xCB, 0x2C, 0xD3, 0x49, + 0x23, 0x80, 0x76, 0xB4, 0x00, 0x50, 0x07, 0x01, 0xF1, 0x07, 0xE2, 0x7F, 0x82, 0x3E, 0x16, 0xD8, + 0xE8, 0x37, 0xBE, 0x34, 0xD5, 0xAE, 0x2C, 0x5F, 0xC5, 0x5E, 0x24, 0x83, 0xC1, 0xDE, 0x12, 0xD1, + 0x74, 0x8D, 0x0B, 0x50, 0xF1, 0x6F, 0x8A, 0xFC, 0x5F, 0xAA, 0x4D, 0x6F, 0x35, 0xC0, 0xD3, 0xF4, + 0x7D, 0x13, 0x4F, 0x82, 0x7B, 0xFB, 0xE9, 0xA3, 0xB3, 0xB0, 0xD4, 0x6F, 0x25, 0x4B, 0x68, 0x25, + 0x30, 0x59, 0xD8, 0xDF, 0xDE, 0x4B, 0xE5, 0xDB, 0xD9, 0xCF, 0x2C, 0x40, 0x1F, 0x3E, 0x7F, 0xC3, + 0x72, 0x7C, 0x15, 0xFF, 0x00, 0xA1, 0x27, 0xF6, 0xC3, 0xFF, 0x00, 0xC5, 0x77, 0x7E, 0xD0, 0x3F, + 0xFC, 0xC5, 0xD0, 0x01, 0xFF, 0x00, 0x0D, 0xC9, 0xF0, 0x57, 0xFE, 0x84, 0x9F, 0xDB, 0x0F, 0xFF, + 0x00, 0x15, 0xDD, 0xFB, 0x40, 0xFF, 0x00, 0xF3, 0x17, 0x40, 0x07, 0xFC, 0x37, 0x27, 0xC1, 0x5F, + 0xFA, 0x12, 0x7F, 0x6C, 0x3F, 0xFC, 0x57, 0x77, 0xED, 0x03, 0xFF, 0x00, 0xCC, 0x5D, 0x00, 0x1F, + 0xF0, 0xDC, 0x9F, 0x05, 0x7F, 0xE8, 0x49, 0xFD, 0xB0, 0xFF, 0x00, 0xF1, 0x5D, 0xDF, 0xB4, 0x0F, + 0xFF, 0x00, 0x31, 0x74, 0x00, 0x7F, 0xC3, 0x72, 0x7C, 0x15, 0xFF, 0x00, 0xA1, 0x27, 0xF6, 0xC3, + 0xFF, 0x00, 0xC5, 0x77, 0x7E, 0xD0, 0x3F, 0xFC, 0xC5, 0xD0, 0x01, 0xFF, 0x00, 0x0D, 0xC9, 0xF0, + 0x57, 0xFE, 0x84, 0x9F, 0xDB, 0x0F, 0xFF, 0x00, 0x15, 0xDD, 0xFB, 0x40, 0xFF, 0x00, 0xF3, 0x17, + 0x40, 0x07, 0xFC, 0x37, 0x27, 0xC1, 0x5F, 0xFA, 0x12, 0x7F, 0x6C, 0x3F, 0xFC, 0x57, 0x77, 0xED, + 0x03, 0xFF, 0x00, 0xCC, 0x5D, 0x00, 0x1F, 0xF0, 0xDC, 0x9F, 0x05, 0x7F, 0xE8, 0x49, 0xFD, 0xB0, + 0xFF, 0x00, 0xF1, 0x5D, 0xDF, 0xB4, 0x0F, 0xFF, 0x00, 0x31, 0x74, 0x00, 0x7F, 0xC3, 0x72, 0x7C, + 0x15, 0xFF, 0x00, 0xA1, 0x27, 0xF6, 0xC3, 0xFF, 0x00, 0xC5, 0x77, 0x7E, 0xD0, 0x3F, 0xFC, 0xC5, + 0xD0, 0x01, 0xFF, 0x00, 0x0D, 0xC9, 0xF0, 0x57, 0xFE, 0x84, 0x9F, 0xDB, 0x0F, 0xFF, 0x00, 0x15, + 0xDD, 0xFB, 0x40, 0xFF, 0x00, 0xF3, 0x17, 0x40, 0x07, 0xFC, 0x37, 0x27, 0xC1, 0x5F, 0xFA, 0x12, + 0x7F, 0x6C, 0x3F, 0xFC, 0x57, 0x77, 0xED, 0x03, 0xFF, 0x00, 0xCC, 0x5D, 0x00, 0x1F, 0xF0, 0xDC, + 0x9F, 0x05, 0x7F, 0xE8, 0x49, 0xFD, 0xB0, 0xFF, 0x00, 0xF1, 0x5D, 0xDF, 0xB4, 0x0F, 0xFF, 0x00, + 0x31, 0x74, 0x01, 0xEB, 0x7F, 0x09, 0xFE, 0x3C, 0xF8, 0x1F, 0xE3, 0x34, 0xFA, 0xE5, 0xAF, 0x83, + 0xF4, 0x2F, 0x8D, 0x1A, 0x34, 0x9E, 0x1D, 0x86, 0xDA, 0x7B, 0xF6, 0xF8, 0xB1, 0xFB, 0x36, 0xFC, + 0x45, 0xF8, 0x09, 0x6F, 0x3A, 0xDD, 0x34, 0xA2, 0x21, 0x61, 0x37, 0x89, 0xB4, 0x3D, 0x36, 0x3B, + 0xD6, 0x1F, 0x66, 0x93, 0x7A, 0xDA, 0xB4, 0xCD, 0x10, 0x31, 0x19, 0x02, 0x09, 0x63, 0xDE, 0x01, + 0xEC, 0xF4, 0x00, 0x50, 0x01, 0x40, 0x05, 0x00, 0x14, 0x00, 0x50, 0x01, 0x40, 0x05, 0x00, 0x58, + 0xA0, 0x02, 0x80, 0x0A, 0x00, 0x28, 0x00, 0xA0, 0x02, 0x80, 0x3F, 0xCF, 0xCF, 0xFE, 0x0E, 0x7D, + 0xFF, 0x00, 0x94, 0xE7, 0xFF, 0x00, 0xC1, 0x21, 0xFF, 0x00, 0xEC, 0x15, 0xF0, 0xF7, 0xFF, 0x00, + 0x56, 0xF5, 0xCD, 0x76, 0x65, 0x9F, 0xF2, 0x30, 0xC3, 0xFF, 0x00, 0x8E, 0x1F, 0xFA, 0x52, 0x39, + 0xF1, 0x3F, 0xEE, 0xB5, 0x3F, 0xC2, 0xFF, 0x00, 0x23, 0xED, 0x4A, 0xFD, 0x4C, 0xF8, 0xE0, 0xA0, + 0x02, 0x80, 0x0A, 0x00, 0xFD, 0x82, 0xFF, 0x00, 0x82, 0x21, 0x7F, 0xC8, 0x89, 0xFB, 0x75, 0xFF, + 0x00, 0xD9, 0xF3, 0xC1, 0xFF, 0x00, 0xAA, 0x1B, 0xE1, 0x95, 0x7E, 0x75, 0xC4, 0x1F, 0xF2, 0x34, + 0x9F, 0xA4, 0x7F, 0xF4, 0x94, 0x7D, 0x46, 0x57, 0xFE, 0xE5, 0x1F, 0x9F, 0xE6, 0x7E, 0xDB, 0x57, + 0x8A, 0x7A, 0x21, 0x40, 0x05, 0x00, 0x14, 0x00, 0x50, 0x01, 0x40, 0x05, 0x00, 0x14, 0x00, 0x50, + 0x02, 0x1F, 0xBA, 0x7F, 0xDD, 0xFE, 0x94, 0x01, 0x05, 0x00, 0x14, 0x00, 0x50, 0x01, 0x40, 0x05, + 0x00, 0x14, 0x00, 0x50, 0x01, 0x40, 0x05, 0x00, 0x14, 0x00, 0x50, 0x01, 0x40, 0x05, 0x00, 0x14, + 0x00, 0x50, 0x01, 0x40, 0x00, 0x1D, 0x00, 0x1E, 0x80, 0x00, 0x3F, 0x20, 0x07, 0xE5, 0x40, 0x1F, + 0x24, 0x6A, 0x9A, 0xB5, 0xFF, 0x00, 0xED, 0x45, 0xA8, 0x6A, 0x3E, 0x10, 0xF0, 0x6E, 0xA7, 0x71, + 0xA6, 0xFE, 0xCE, 0x5A, 0x5D, 0xDC, 0xFA, 0x2F, 0xC4, 0x1F, 0x88, 0x9A, 0x1D, 0xEC, 0x49, 0x73, + 0xF1, 0xAE, 0x78, 0x4C, 0x4B, 0x73, 0xE1, 0x9F, 0x0C, 0x5D, 0xA0, 0x71, 0xFD, 0x8E, 0x37, 0x5E, + 0x5B, 0x6A, 0x5A, 0x8C, 0x4D, 0x1C, 0x9E, 0x64, 0x52, 0x59, 0x5A, 0x38, 0x91, 0x6E, 0x2E, 0x2D, + 0x00, 0x3E, 0xA7, 0xD2, 0x34, 0x8D, 0x27, 0x40, 0xD2, 0x74, 0xBD, 0x07, 0x41, 0xD3, 0x34, 0xED, + 0x13, 0x43, 0xD1, 0x34, 0xE8, 0x34, 0x8D, 0x1B, 0x46, 0xD2, 0x2C, 0xA2, 0xD3, 0x74, 0x9D, 0x22, + 0xD2, 0xDA, 0x25, 0x8E, 0xDA, 0xD6, 0xD6, 0xDA, 0x35, 0x58, 0xE2, 0x86, 0x38, 0xE3, 0x8D, 0x12, + 0x34, 0x55, 0x55, 0x55, 0x55, 0x00, 0x00, 0x00, 0x00, 0xB3, 0x73, 0x6B, 0x6B, 0x7B, 0x6B, 0x71, + 0x63, 0x7B, 0x6D, 0x6F, 0x77, 0x65, 0x77, 0x6E, 0xF6, 0x97, 0x76, 0x77, 0x50, 0xA5, 0xC5, 0xAD, + 0xD4, 0x52, 0x21, 0x59, 0x22, 0x92, 0x36, 0x05, 0x59, 0x19, 0x49, 0x05, 0x48, 0x20, 0x82, 0x41, + 0x18, 0xA0, 0x0F, 0x90, 0xD2, 0xE6, 0x6F, 0xD9, 0x0E, 0x61, 0x6F, 0xA8, 0xCF, 0xE6, 0xFE, 0xC9, + 0x37, 0x37, 0x01, 0x6C, 0x75, 0x5B, 0x87, 0x82, 0x0F, 0xF8, 0x65, 0x29, 0xAE, 0x6E, 0x98, 0x25, + 0xA5, 0xDC, 0x8D, 0x22, 0xE7, 0xC1, 0x4C, 0xF7, 0x36, 0xB0, 0x5B, 0x08, 0xA2, 0x3F, 0xD8, 0x01, + 0x42, 0x39, 0xFE, 0xC7, 0x0A, 0xDE, 0x1C, 0x00, 0xFB, 0x0F, 0xDB, 0xD3, 0x8C, 0x7A, 0x63, 0xB6, + 0x3F, 0x0A, 0x00, 0x28, 0x03, 0xCC, 0x3E, 0x2C, 0x7C, 0x57, 0xF0, 0xEF, 0xC2, 0x1F, 0x0C, 0xDA, + 0xEB, 0x7A, 0xC5, 0x8E, 0xB7, 0xE2, 0x2D, 0x67, 0x5D, 0xD6, 0xAD, 0xFC, 0x23, 0xE0, 0x1F, 0x87, + 0xFE, 0x10, 0xB3, 0x87, 0x52, 0xF1, 0xD7, 0xC4, 0xBD, 0x7A, 0xF1, 0x24, 0x6B, 0x1D, 0x0F, 0x44, + 0xB4, 0x96, 0x58, 0x61, 0x69, 0xDD, 0x2D, 0xAE, 0x66, 0x92, 0x7B, 0x89, 0xAD, 0xED, 0x2C, 0xED, + 0x6D, 0xAF, 0xAF, 0xEF, 0x6E, 0x6D, 0x2C, 0x6C, 0x6E, 0xAE, 0xED, 0x80, 0x38, 0x7F, 0x84, 0x9F, + 0x09, 0xFC, 0x47, 0x6B, 0xAF, 0xDD, 0xFC, 0x69, 0xF8, 0xD5, 0x75, 0xA3, 0xEB, 0xFF, 0x00, 0x1D, + 0x7C, 0x49, 0xA2, 0xB6, 0x83, 0x1D, 0xA6, 0x81, 0x73, 0x75, 0x7B, 0xF0, 0xFF, 0x00, 0xE0, 0xA6, + 0x81, 0x2D, 0xC2, 0xDC, 0x27, 0x84, 0x3C, 0x22, 0x97, 0x01, 0x4B, 0x2E, 0xF8, 0xED, 0x1B, 0x52, + 0xD6, 0x0C, 0x16, 0xD7, 0x5A, 0xE5, 0xCD, 0xA5, 0xAC, 0xF3, 0xC3, 0x6B, 0x67, 0x63, 0xA4, 0x69, + 0x1A, 0x18, 0x07, 0xD0, 0xF4, 0x00, 0x50, 0x01, 0x40, 0x05, 0x00, 0x14, 0x00, 0x50, 0x01, 0x40, + 0x05, 0x00, 0x14, 0x00, 0x50, 0x01, 0x40, 0x05, 0x00, 0x14, 0x00, 0x50, 0x01, 0x40, 0x05, 0x00, + 0x14, 0x00, 0x50, 0x01, 0x40, 0x05, 0x00, 0x14, 0x01, 0x62, 0x80, 0x0A, 0x00, 0x28, 0x00, 0xA0, + 0x02, 0x80, 0x0A, 0x00, 0xFF, 0x00, 0x3F, 0x3F, 0xF8, 0x39, 0xF7, 0xFE, 0x53, 0x9F, 0xFF, 0x00, + 0x04, 0x87, 0xFF, 0x00, 0xB0, 0x57, 0xC3, 0xDF, 0xFD, 0x5B, 0xD7, 0x35, 0xD9, 0x96, 0x7F, 0xC8, + 0xC3, 0x0F, 0xFE, 0x38, 0x7F, 0xE9, 0x48, 0xE7, 0xC4, 0xFF, 0x00, 0xBA, 0xD4, 0xFF, 0x00, 0x0B, + 0xFC, 0x8F, 0xB5, 0x2B, 0xF5, 0x33, 0xE3, 0x82, 0x80, 0x0A, 0x00, 0x28, 0x03, 0xF6, 0x0B, 0xFE, + 0x08, 0x85, 0xFF, 0x00, 0x22, 0x27, 0xED, 0xD7, 0xFF, 0x00, 0x67, 0xCF, 0x07, 0xFE, 0xA8, 0x6F, + 0x86, 0x55, 0xF9, 0xD7, 0x10, 0x7F, 0xC8, 0xD2, 0x7E, 0x91, 0xFF, 0x00, 0xD2, 0x51, 0xF5, 0x19, + 0x5F, 0xFB, 0x94, 0x7E, 0x7F, 0x99, 0xFB, 0x6D, 0x5E, 0x29, 0xE8, 0x85, 0x00, 0x14, 0x00, 0x50, + 0x01, 0x40, 0x05, 0x00, 0x14, 0x00, 0x50, 0x01, 0x40, 0x08, 0x7E, 0xE9, 0xFF, 0x00, 0x77, 0xFA, + 0x50, 0x04, 0x14, 0x00, 0x50, 0x01, 0x40, 0x05, 0x00, 0x14, 0x00, 0x50, 0x01, 0x40, 0x05, 0x00, + 0x14, 0x00, 0x50, 0x01, 0x40, 0x05, 0x00, 0x14, 0x00, 0x50, 0x01, 0xC0, 0x1D, 0x80, 0x03, 0xD8, + 0x00, 0x00, 0xA0, 0x05, 0xDA, 0x7F, 0xBA, 0x7F, 0x2A, 0x00, 0xF0, 0x9F, 0xDA, 0x17, 0xE2, 0x0E, + 0xA5, 0xE0, 0x2F, 0x03, 0xE9, 0x5A, 0x7F, 0x87, 0x3C, 0x33, 0xA4, 0x78, 0xC3, 0xC6, 0xBF, 0x13, + 0xFC, 0x6B, 0xA4, 0xFC, 0x23, 0xF0, 0x4F, 0x86, 0x7C, 0x45, 0x84, 0xF0, 0xC5, 0xDD, 0xD6, 0xB9, + 0x71, 0xB2, 0xFA, 0xF7, 0x55, 0x2C, 0x55, 0x1E, 0xC7, 0x4F, 0xD2, 0xE2, 0xD6, 0x35, 0x29, 0xED, + 0xFC, 0xC8, 0xA4, 0xBA, 0x8B, 0x4F, 0x92, 0xCE, 0x06, 0x37, 0x37, 0x50, 0x23, 0x80, 0x51, 0xF1, + 0xBC, 0xBF, 0x1C, 0x7C, 0x16, 0xFF, 0x00, 0x00, 0x3C, 0x33, 0xF0, 0x5B, 0xC0, 0x7F, 0x0D, 0x3C, + 0x41, 0xE1, 0x8F, 0xF8, 0x4B, 0xB4, 0xFF, 0x00, 0x0B, 0xFC, 0x5E, 0x7B, 0xA9, 0x5B, 0xC0, 0xBA, + 0x27, 0x83, 0x7C, 0x33, 0x6F, 0x65, 0xB6, 0xE6, 0xEB, 0x45, 0xB3, 0x49, 0x64, 0x6B, 0x34, 0x8A, + 0x38, 0x65, 0x6B, 0x68, 0xE2, 0x8F, 0x54, 0x66, 0xB9, 0x8B, 0x4B, 0xD3, 0x1E, 0xDE, 0xDE, 0xD7, + 0x52, 0xBB, 0xF1, 0x07, 0x86, 0xC0, 0x31, 0xFE, 0x39, 0x7E, 0xD1, 0xD6, 0xBF, 0xB3, 0xF7, 0x8E, + 0xBE, 0x12, 0xDB, 0x78, 0xE7, 0xC2, 0x9A, 0xFB, 0x7C, 0x1F, 0xF8, 0x91, 0x67, 0xAE, 0xF8, 0x66, + 0xFB, 0xE2, 0x47, 0x85, 0x7C, 0x2F, 0xAF, 0xFC, 0x44, 0xD6, 0x7C, 0x3D, 0xE3, 0x58, 0x64, 0xD3, + 0x25, 0xF0, 0x87, 0x86, 0x8F, 0x87, 0xB4, 0x6D, 0x3A, 0xF2, 0xF4, 0xC3, 0xAA, 0xD8, 0x7F, 0xC2, + 0x69, 0x20, 0xBF, 0x91, 0x62, 0xB7, 0x86, 0xE3, 0x48, 0xB0, 0xB2, 0x2E, 0x6E, 0x35, 0x6B, 0x38, + 0xA5, 0x00, 0x8B, 0xE0, 0x7F, 0xED, 0x27, 0x65, 0xF1, 0xEB, 0xE2, 0x77, 0xC6, 0x8F, 0x0E, 0xF8, + 0x2F, 0xC2, 0x9E, 0x22, 0xB7, 0xF8, 0x69, 0xF0, 0x8B, 0x4B, 0xF0, 0xAE, 0x85, 0x2F, 0x8E, 0x7C, + 0x5B, 0xE1, 0x4F, 0x10, 0x7C, 0x37, 0xF1, 0x1D, 0xEF, 0x8D, 0x35, 0x6B, 0x7B, 0xFD, 0x43, 0xC4, + 0x1E, 0x18, 0xB8, 0xF0, 0xD6, 0xB5, 0xA7, 0x59, 0x5F, 0x40, 0x96, 0x1A, 0x1D, 0xCF, 0xC3, 0xDD, + 0x41, 0x2E, 0xC2, 0x3C, 0x37, 0x2B, 0xE2, 0x4D, 0x88, 0xDB, 0xAC, 0xE5, 0x00, 0x03, 0xB5, 0xF8, + 0x6F, 0xAC, 0xFC, 0x74, 0xD4, 0xFE, 0x20, 0x7C, 0x6B, 0xD3, 0xBE, 0x27, 0x78, 0x33, 0xC1, 0x9E, + 0x1E, 0xF8, 0x69, 0xA2, 0xF8, 0x87, 0x4F, 0xB3, 0xF8, 0x23, 0xAF, 0xE8, 0x3A, 0xDB, 0xDD, 0xF8, + 0x8F, 0xC5, 0x96, 0x32, 0x58, 0x97, 0xD4, 0x9E, 0xFE, 0xD3, 0x74, 0x89, 0xE4, 0xC6, 0xED, 0x64, + 0x63, 0xB9, 0x73, 0x63, 0x33, 0x5C, 0x4D, 0xAA, 0xD8, 0x9D, 0x3B, 0xEC, 0xDA, 0x55, 0x9E, 0xB7, + 0xE2, 0x60, 0x0E, 0x0F, 0xF6, 0x60, 0xF8, 0x99, 0xA6, 0x6A, 0x3F, 0x0D, 0x7C, 0x5D, 0xE0, 0x4F, + 0x10, 0x68, 0xBE, 0x08, 0xF8, 0x6F, 0xE2, 0x9F, 0xD9, 0x4B, 0xC5, 0xD7, 0x3F, 0x00, 0x7E, 0x29, + 0xF8, 0x5F, 0xC1, 0xBA, 0x29, 0xF0, 0x57, 0xC3, 0x0F, 0x08, 0x1D, 0x0B, 0x46, 0xB0, 0xD4, 0xB4, + 0x1B, 0xED, 0x12, 0xD5, 0x9E, 0x4B, 0x5B, 0x1D, 0x22, 0xFF, 0x00, 0xC2, 0x7A, 0xDF, 0x84, 0x75, + 0x98, 0x2C, 0xE2, 0xBB, 0xBC, 0x5D, 0x32, 0x0D, 0x56, 0x3D, 0x36, 0x7B, 0x86, 0xBA, 0xD3, 0xAE, + 0x96, 0x30, 0x07, 0x78, 0x43, 0xF6, 0x98, 0x8F, 0xE3, 0x16, 0xBF, 0xE1, 0x08, 0x3F, 0x67, 0xAF, + 0x00, 0xEB, 0x5F, 0x13, 0x7E, 0x1A, 0xEA, 0xD1, 0xA6, 0xBF, 0xE2, 0x1F, 0x8F, 0x9A, 0xE7, 0xDB, + 0x7E, 0x1B, 0xFC, 0x13, 0x1A, 0x0C, 0x86, 0x1F, 0xB0, 0xDE, 0xF8, 0x3B, 0x56, 0xB8, 0xB1, 0x96, + 0x4F, 0x17, 0x4D, 0xA8, 0x45, 0x72, 0x6E, 0xB4, 0xF9, 0x74, 0x98, 0x25, 0xD2, 0x27, 0xB4, 0xB6, + 0xB8, 0x9E, 0x5D, 0x62, 0xD4, 0x4F, 0xA6, 0xA6, 0xA8, 0x01, 0xF4, 0x3D, 0xC7, 0x85, 0x7C, 0x2F, + 0x77, 0xE2, 0x7D, 0x1F, 0xC6, 0xD7, 0x5E, 0x1C, 0xD0, 0xAE, 0x7C, 0x67, 0xE1, 0xED, 0x03, 0x52, + 0xF0, 0xAE, 0x81, 0xE2, 0xD9, 0xF4, 0x8B, 0x79, 0xBC, 0x4D, 0xA1, 0xE9, 0x7A, 0xC5, 0xC5, 0x8C, + 0xFA, 0xBE, 0x9B, 0x67, 0x7E, 0x50, 0xCF, 0x0D, 0xAD, 0xD4, 0xFA, 0x16, 0x89, 0x2C, 0xF0, 0xA3, + 0x2A, 0x4C, 0xFA, 0x75, 0x83, 0xBA, 0xB3, 0x5B, 0x44, 0x50, 0x03, 0xF3, 0x7F, 0xE2, 0x77, 0xED, + 0xB5, 0xFB, 0x50, 0x78, 0x5B, 0xC7, 0x9F, 0x0C, 0xFC, 0x31, 0xA3, 0x7E, 0xC0, 0x5F, 0x15, 0x7E, + 0x1E, 0x78, 0x77, 0xC7, 0x9E, 0x3A, 0x9F, 0xE1, 0x6D, 0xB7, 0xC4, 0xBF, 0xDA, 0x6F, 0xE2, 0x7F, + 0xC3, 0x2F, 0x06, 0xFC, 0x0D, 0x93, 0x5D, 0xBD, 0x8C, 0xB7, 0x85, 0xE3, 0xD4, 0xBC, 0x53, 0xE0, + 0xFF, 0x00, 0x15, 0x78, 0xAF, 0x58, 0xD0, 0x6D, 0xB5, 0x19, 0x2C, 0xAE, 0xEC, 0x6C, 0xE5, 0xB9, + 0xF0, 0xCD, 0xCF, 0xDB, 0x35, 0x6D, 0x47, 0xC3, 0x5A, 0x48, 0x16, 0xD3, 0x6A, 0x89, 0x24, 0x60, + 0x1F, 0x78, 0xFC, 0x24, 0xF8, 0x97, 0x67, 0xF1, 0x5F, 0xC2, 0x17, 0xDE, 0x2E, 0xB2, 0xD2, 0xAE, + 0x74, 0x7B, 0x7B, 0x1F, 0x88, 0x5E, 0x31, 0xF8, 0x7F, 0xF6, 0x2B, 0x89, 0xD6, 0xEE, 0x69, 0x1F, + 0xC1, 0xFE, 0x2E, 0xD4, 0xF4, 0x19, 0xAE, 0x43, 0x2A, 0x80, 0x16, 0x77, 0xD0, 0xDE, 0x65, 0x4C, + 0x12, 0xAB, 0x2A, 0xA1, 0x24, 0xAE, 0x48, 0x07, 0xC8, 0xBF, 0x16, 0x3F, 0x6B, 0x9F, 0x8B, 0xB7, + 0x1E, 0x24, 0xFD, 0x92, 0xF4, 0x9F, 0xD9, 0x47, 0xE0, 0x4D, 0xAF, 0xC5, 0xDF, 0x0D, 0x7E, 0xD2, + 0xAD, 0x2F, 0x8A, 0x2D, 0x7E, 0x2B, 0x7C, 0x4E, 0xF1, 0xB6, 0x9B, 0xF0, 0x8B, 0xE0, 0xB4, 0x7A, + 0x18, 0xF0, 0x66, 0xB3, 0xAA, 0xC1, 0xA6, 0x5C, 0x5D, 0x89, 0xEE, 0xFC, 0x5F, 0xA7, 0x6A, 0xEF, + 0x2E, 0x9F, 0xA2, 0x4C, 0x8D, 0x1F, 0x84, 0x75, 0x6B, 0x63, 0x0C, 0x93, 0x5B, 0xCA, 0xD6, 0xD2, + 0x48, 0xD7, 0x16, 0x20, 0x1E, 0xAD, 0xE3, 0x0F, 0xDA, 0xAF, 0xC3, 0x36, 0x3F, 0x06, 0xFE, 0x26, + 0x7C, 0x53, 0xF0, 0x87, 0xFC, 0x23, 0x5E, 0x1F, 0x1F, 0x0B, 0x2D, 0x2C, 0x75, 0x0F, 0x12, 0xEA, + 0x5F, 0xB5, 0xAC, 0xDE, 0x2F, 0xFD, 0x8C, 0x3E, 0x0F, 0x69, 0x16, 0xB3, 0xDD, 0x2A, 0xDE, 0xDD, + 0xDF, 0x78, 0xBF, 0x5B, 0xF0, 0xBC, 0xA6, 0x28, 0x21, 0xB7, 0x8E, 0xED, 0xC4, 0xB0, 0xD8, 0xDC, + 0x21, 0x91, 0x2D, 0xA2, 0x95, 0xAD, 0xD6, 0xE0, 0x4A, 0x80, 0x1F, 0x02, 0xFE, 0xC5, 0x9F, 0xF0, + 0x55, 0x0D, 0x5F, 0xF6, 0xAA, 0xFD, 0xA1, 0xBE, 0x37, 0xFC, 0x1B, 0xB1, 0xF1, 0x6F, 0xFC, 0x13, + 0x67, 0xC7, 0x76, 0x5E, 0x02, 0xF8, 0x9C, 0xFA, 0x2F, 0x82, 0xB4, 0x5F, 0xD9, 0xBB, 0xF6, 0xFE, + 0x4F, 0x8A, 0xBF, 0x18, 0x3C, 0x57, 0xE1, 0xCB, 0x7F, 0x86, 0x3E, 0x1D, 0xD7, 0x2E, 0x35, 0x2F, + 0x0D, 0x68, 0x72, 0x78, 0x72, 0xDE, 0xDF, 0xC5, 0x10, 0x2E, 0xB9, 0xAE, 0x6A, 0xB6, 0x52, 0xEA, + 0x22, 0xE7, 0x43, 0xB6, 0xB6, 0x30, 0x5D, 0x5A, 0x3C, 0x4F, 0x2E, 0x93, 0x25, 0xCE, 0xA2, 0x01, + 0xF4, 0x25, 0xAF, 0xED, 0x8B, 0xFB, 0x4E, 0xEB, 0x7F, 0x1F, 0x7E, 0x08, 0xFC, 0x32, 0x97, 0xF6, + 0x1C, 0xF1, 0xD7, 0xC0, 0x1F, 0x06, 0xFC, 0x4B, 0xD3, 0xF5, 0xEB, 0x3B, 0xEF, 0x10, 0xFE, 0xD6, + 0x9F, 0x16, 0xBE, 0x1A, 0x78, 0x5A, 0x2F, 0x11, 0x6A, 0xFA, 0x6C, 0xBA, 0x65, 0xDC, 0x1A, 0x57, + 0x83, 0xEF, 0xBC, 0x11, 0xE2, 0x7F, 0x18, 0x35, 0xE6, 0xB1, 0x1E, 0x85, 0x17, 0x8D, 0xB5, 0x01, + 0xA4, 0x5D, 0xD8, 0x59, 0x8B, 0xB8, 0x74, 0xAB, 0x89, 0xD3, 0x50, 0xB6, 0x8B, 0x4E, 0xBA, 0xDE, + 0x01, 0xF5, 0x07, 0xC1, 0x0F, 0xDA, 0x23, 0x41, 0xF8, 0xC5, 0xFB, 0x27, 0x7C, 0x21, 0xFD, 0xAC, + 0xA4, 0xF0, 0xFE, 0xB7, 0xE1, 0x9F, 0x0C, 0x7C, 0x53, 0xFD, 0x9D, 0xBC, 0x3F, 0xFB, 0x44, 0xBF, + 0x85, 0x2D, 0x6D, 0x67, 0xF1, 0x8F, 0x88, 0xFC, 0x3F, 0x61, 0xAE, 0x78, 0x66, 0xDF, 0x59, 0x3A, + 0x74, 0x70, 0x59, 0xC2, 0x66, 0xBE, 0xB9, 0x86, 0x1B, 0xAF, 0x28, 0x25, 0xBC, 0x25, 0xE6, 0x74, + 0x01, 0x23, 0xCB, 0xAA, 0xD0, 0x07, 0x80, 0xFC, 0x49, 0xFD, 0xAF, 0x7E, 0x2A, 0x5A, 0xFE, 0xD0, + 0xFF, 0x00, 0x04, 0xBE, 0x0E, 0xFC, 0x11, 0xF8, 0x1D, 0x67, 0xE3, 0x7F, 0x05, 0xFC, 0x44, 0xF8, + 0x3F, 0xAF, 0x7E, 0xD0, 0xFA, 0xA7, 0xC6, 0x1F, 0x1D, 0x78, 0xDA, 0xCB, 0xC3, 0x5F, 0x0E, 0x3C, + 0x51, 0xE0, 0xBD, 0x01, 0xB4, 0x38, 0x35, 0x29, 0x7C, 0x1E, 0xFA, 0x33, 0xEB, 0x1E, 0x23, 0xB8, + 0xD6, 0x6D, 0xAE, 0x3C, 0x69, 0xE1, 0xA2, 0x2C, 0x6E, 0xFC, 0x39, 0x6F, 0x6F, 0x79, 0x1D, 0xE1, + 0x10, 0xEA, 0x08, 0xD0, 0xB0, 0x60, 0x0E, 0xDF, 0xE2, 0xEF, 0xED, 0x7D, 0xA0, 0x78, 0x2B, 0xE0, + 0x76, 0xA7, 0xF1, 0xD7, 0xC2, 0x97, 0x7F, 0x09, 0x7C, 0x27, 0xE0, 0xDF, 0x0A, 0xF8, 0xD6, 0xD7, + 0xC2, 0xBE, 0x37, 0xF1, 0x37, 0xED, 0xC3, 0xE3, 0xFF, 0x00, 0x13, 0xFE, 0xC0, 0xBF, 0x0F, 0xBC, + 0x37, 0x05, 0xD4, 0x28, 0xB0, 0xDC, 0xAE, 0xB1, 0xAE, 0x78, 0x4E, 0xEE, 0x69, 0x64, 0x92, 0xF2, + 0xFF, 0x00, 0x46, 0xB6, 0x85, 0x4D, 0x9C, 0x76, 0xF3, 0x3D, 0xC4, 0xE8, 0xB7, 0x5E, 0x75, 0xBF, + 0xD9, 0xE5, 0x00, 0xF9, 0x47, 0xFE, 0x09, 0xB5, 0xFF, 0x00, 0x05, 0x28, 0xD5, 0xBF, 0x6E, 0x1D, + 0x4F, 0xC5, 0x3E, 0x1F, 0xBE, 0xF1, 0x7F, 0xFC, 0x13, 0xE3, 0xC4, 0x5A, 0xBF, 0x86, 0x3C, 0x73, + 0xF1, 0x32, 0xD2, 0xFB, 0x43, 0xFD, 0x99, 0x7F, 0x6D, 0x49, 0x7E, 0x2F, 0xFC, 0x54, 0xD3, 0x7C, + 0x3B, 0xE1, 0x5F, 0x88, 0xFA, 0x9E, 0x83, 0xE1, 0x8D, 0x66, 0x5F, 0x04, 0x9F, 0x0F, 0xC4, 0xED, + 0xA5, 0x5D, 0xE9, 0xF6, 0x9A, 0x24, 0xCB, 0xAC, 0xB6, 0xA3, 0x0C, 0x37, 0xAB, 0x7B, 0x69, 0x7B, + 0x0D, 0x9D, 0xAA, 0x6A, 0x11, 0x59, 0x5A, 0x80, 0x7E, 0x91, 0x5F, 0x7C, 0x4B, 0x9E, 0xCB, 0xE3, + 0xB7, 0x85, 0x7E, 0x0E, 0x2E, 0x8D, 0x0B, 0xDA, 0x78, 0x8B, 0xE1, 0x26, 0xBF, 0xF1, 0x2D, 0xF5, + 0xFF, 0x00, 0xB6, 0xB2, 0x4F, 0x67, 0x26, 0x89, 0xAC, 0x68, 0xD6, 0x29, 0x64, 0xB6, 0xBE, 0x5E, + 0xD6, 0x59, 0x17, 0x5F, 0x77, 0x2F, 0xBC, 0x15, 0x30, 0x2A, 0x85, 0x3B, 0xF2, 0xA0, 0x1E, 0xB5, + 0x40, 0x05, 0x00, 0x14, 0x00, 0x50, 0x01, 0x40, 0x05, 0x00, 0x14, 0x00, 0x50, 0x01, 0x40, 0x05, + 0x00, 0x14, 0x01, 0x62, 0x80, 0x0A, 0x00, 0x28, 0x00, 0xA0, 0x02, 0x80, 0x0A, 0x00, 0xFF, 0x00, + 0x3F, 0x3F, 0xF8, 0x39, 0xF7, 0xFE, 0x53, 0x9F, 0xFF, 0x00, 0x04, 0x87, 0xFF, 0x00, 0xB0, 0x57, + 0xC3, 0xDF, 0xFD, 0x5B, 0xD7, 0x35, 0xD9, 0x96, 0x7F, 0xC8, 0xC3, 0x0F, 0xFE, 0x38, 0x7F, 0xE9, + 0x48, 0xE7, 0xC4, 0xFF, 0x00, 0xBA, 0xD4, 0xFF, 0x00, 0x0B, 0xFC, 0x8F, 0xB5, 0x2B, 0xF5, 0x33, + 0xE3, 0x82, 0x80, 0x0A, 0x00, 0x28, 0x03, 0xF6, 0x0B, 0xFE, 0x08, 0x85, 0xFF, 0x00, 0x22, 0x27, + 0xED, 0xD7, 0xFF, 0x00, 0x67, 0xCF, 0x07, 0xFE, 0xA8, 0x6F, 0x86, 0x55, 0xF9, 0xD7, 0x10, 0x7F, + 0xC8, 0xD2, 0x7E, 0x91, 0xFF, 0x00, 0xD2, 0x51, 0xF5, 0x19, 0x5F, 0xFB, 0x94, 0x7E, 0x7F, 0x99, + 0xFB, 0x6D, 0x5E, 0x29, 0xE8, 0x85, 0x00, 0x14, 0x00, 0x50, 0x01, 0x40, 0x05, 0x00, 0x14, 0x00, + 0x50, 0x01, 0x40, 0x08, 0x7E, 0xE9, 0xFF, 0x00, 0x77, 0xFA, 0x50, 0x04, 0x14, 0x00, 0x50, 0x01, + 0x40, 0x05, 0x00, 0x14, 0x00, 0x50, 0x01, 0x40, 0x05, 0x00, 0x14, 0x00, 0x50, 0x01, 0x40, 0x05, + 0x00, 0x14, 0x00, 0x50, 0x00, 0x38, 0x00, 0x0E, 0x30, 0x00, 0x18, 0xE3, 0x18, 0x1C, 0x63, 0xF2, + 0x14, 0x01, 0xF2, 0x3C, 0xBF, 0xB0, 0x07, 0xEC, 0x1D, 0x71, 0x2C, 0x93, 0xCF, 0xFB, 0x12, 0xFE, + 0xC8, 0xB3, 0x4F, 0x34, 0x8D, 0x2C, 0xD3, 0x4B, 0xFB, 0x36, 0x78, 0x32, 0x49, 0x65, 0x76, 0x39, + 0x66, 0x66, 0x3A, 0x76, 0x49, 0x24, 0x92, 0x49, 0xA0, 0x0C, 0x4F, 0x1F, 0x7E, 0xC9, 0x9E, 0x02, + 0xF0, 0x2F, 0xC3, 0x9B, 0x46, 0xFD, 0x93, 0x7E, 0x16, 0xFC, 0x06, 0xF8, 0x23, 0xE3, 0x3F, 0x00, + 0xFC, 0x4B, 0xD1, 0xFE, 0x37, 0xE8, 0x1A, 0x16, 0x87, 0xE0, 0x3D, 0x3F, 0xE1, 0x8F, 0xC3, 0x8F, + 0x1E, 0x6A, 0x3A, 0x1A, 0xBC, 0x57, 0x7A, 0x4F, 0x88, 0x26, 0xD2, 0x6D, 0x51, 0xED, 0x52, 0xFB, + 0x49, 0xBB, 0xD5, 0x74, 0xF4, 0xD4, 0xC4, 0x17, 0x8F, 0xA7, 0x3D, 0xD4, 0x17, 0xDF, 0x63, 0xBF, + 0x5B, 0x33, 0x61, 0x76, 0x01, 0xF6, 0x46, 0x9F, 0x74, 0x2F, 0xEC, 0x2C, 0x6F, 0x84, 0x2F, 0x6E, + 0x2F, 0x2C, 0xE2, 0xBA, 0x16, 0xF2, 0x49, 0x0C, 0xD2, 0x40, 0x24, 0x8C, 0x30, 0x46, 0x78, 0x5E, + 0x48, 0x98, 0x8C, 0xE0, 0x98, 0xDD, 0xD4, 0xE3, 0xE5, 0x66, 0x18, 0x24, 0x03, 0xCA, 0xBE, 0x3C, + 0x7C, 0x24, 0x83, 0xE3, 0x67, 0xC2, 0xCF, 0x11, 0xF8, 0x01, 0x3C, 0x43, 0xAB, 0x78, 0x2B, 0x5F, + 0x9D, 0xAC, 0xFC, 0x47, 0xE0, 0x0F, 0x88, 0x1E, 0x1F, 0xF2, 0x8E, 0xBB, 0xF0, 0xDB, 0xC5, 0x1A, + 0x1D, 0xEC, 0x3A, 0x87, 0x85, 0xFC, 0x47, 0x67, 0x0C, 0xA9, 0x25, 0xB5, 0xC3, 0xD8, 0x6A, 0x96, + 0x1A, 0x75, 0xC9, 0xB4, 0xBB, 0x86, 0xE2, 0xCE, 0xE9, 0x61, 0x7B, 0x5B, 0xBB, 0x7B, 0x8B, 0x5B, + 0x89, 0xED, 0xE5, 0x00, 0xA5, 0xFB, 0x3C, 0x7C, 0x29, 0x9F, 0xE0, 0xF7, 0xC2, 0xAF, 0x0F, 0xF8, + 0x6B, 0x5B, 0x9E, 0xD7, 0x54, 0xF8, 0x83, 0xAB, 0xBC, 0xFE, 0x39, 0xF8, 0xC3, 0xE2, 0x8B, 0x5D, + 0x46, 0xEF, 0x57, 0x8F, 0xC6, 0xBE, 0x34, 0xD7, 0x24, 0x37, 0x9E, 0x29, 0xD5, 0xE3, 0xB8, 0xB9, + 0x02, 0x61, 0x6F, 0x2D, 0xFC, 0xF7, 0x22, 0xDA, 0xDC, 0x24, 0x30, 0x5A, 0x5A, 0x25, 0x9D, 0x95, + 0xAD, 0xBD, 0xAD, 0xAD, 0xA5, 0xBD, 0xAD, 0xB8, 0x07, 0xB6, 0x8C, 0x70, 0x38, 0x03, 0x81, 0xD3, + 0xA7, 0xA0, 0x03, 0xF2, 0xA0, 0x0F, 0x8E, 0x3E, 0x09, 0xFE, 0xCF, 0xFA, 0x0F, 0x88, 0x7E, 0x1C, + 0xFC, 0x5C, 0xD6, 0xBE, 0x39, 0xF8, 0x6F, 0xE1, 0xF7, 0xC4, 0x4D, 0x43, 0xF6, 0xB8, 0xF8, 0xA3, + 0x1F, 0xED, 0x03, 0xF1, 0x3B, 0xC1, 0x33, 0xE9, 0x76, 0x5E, 0x32, 0xF8, 0x5D, 0x62, 0xD1, 0xE8, + 0xBA, 0x26, 0x95, 0xE1, 0x1D, 0x26, 0xD2, 0x29, 0x9A, 0xE6, 0xDE, 0xF0, 0xE9, 0xDA, 0x0F, 0x82, + 0xBC, 0x19, 0x1C, 0xB7, 0xCA, 0xED, 0x1D, 0xDE, 0xA3, 0x67, 0x79, 0xA9, 0x5B, 0xC7, 0x69, 0x1D, + 0xCC, 0x36, 0xB6, 0x80, 0x1D, 0x47, 0x84, 0xBE, 0x02, 0xF8, 0xE3, 0xE1, 0x57, 0x8A, 0x2D, 0xA4, + 0xF8, 0x4B, 0xF1, 0xBB, 0xC4, 0x16, 0xBF, 0x0A, 0x6F, 0xB5, 0xE3, 0xA8, 0xEB, 0xFF, 0x00, 0x06, + 0x7E, 0x2F, 0xE9, 0x57, 0x1F, 0x19, 0x34, 0x4F, 0x0E, 0x5A, 0xCB, 0x71, 0x24, 0xD7, 0x76, 0xBE, + 0x06, 0xD6, 0xE4, 0xBF, 0xB4, 0xD6, 0x34, 0x61, 0x2C, 0x97, 0x0C, 0xB1, 0xDB, 0xDE, 0xDD, 0xEB, + 0x1A, 0x6D, 0x94, 0x31, 0x5B, 0x5B, 0x58, 0x69, 0xB6, 0x50, 0x42, 0x22, 0x20, 0x1F, 0x49, 0x3E, + 0xA5, 0xA6, 0xC3, 0xA8, 0xD9, 0xE8, 0xF2, 0xDF, 0xD8, 0xC7, 0xAB, 0x5F, 0x59, 0x5C, 0x6A, 0x56, + 0x3A, 0x53, 0xDD, 0x46, 0x9A, 0x8D, 0xE5, 0xB5, 0xA4, 0x90, 0x47, 0x75, 0x71, 0x0C, 0x04, 0xEF, + 0x78, 0xA2, 0x7B, 0xDB, 0x25, 0x77, 0x50, 0x55, 0x0C, 0xF0, 0x82, 0x41, 0x91, 0x41, 0x00, 0xFC, + 0x9F, 0xF0, 0xC7, 0xFC, 0x13, 0xFD, 0x6D, 0x7C, 0x7B, 0xE1, 0xAF, 0x0A, 0xFC, 0x54, 0xFD, 0x97, + 0x3F, 0x63, 0x3F, 0x8D, 0x9E, 0x05, 0x83, 0x50, 0xB4, 0xD7, 0xFC, 0x4D, 0xFB, 0x6B, 0xDC, 0x78, + 0xB3, 0x5A, 0xF8, 0x61, 0xFB, 0x72, 0x6B, 0x5A, 0x8E, 0x8B, 0x2A, 0xEA, 0x1E, 0x1E, 0xD5, 0x35, + 0x6D, 0x36, 0xD7, 0xC3, 0x37, 0x2D, 0xAB, 0x6B, 0x71, 0xEA, 0xDA, 0x4F, 0x87, 0xE7, 0x9F, 0x56, + 0x4F, 0x17, 0xE9, 0x6A, 0xF3, 0xA3, 0x5F, 0xC1, 0xA7, 0xDA, 0x9B, 0x4B, 0x7B, 0x26, 0x00, 0xFB, + 0x3B, 0xF6, 0x7F, 0xF8, 0x6B, 0xF1, 0x77, 0xE1, 0x5E, 0xB9, 0xF1, 0x2B, 0xC2, 0x9E, 0x22, 0xBD, + 0xF8, 0x7D, 0x73, 0xF0, 0x73, 0xFE, 0x13, 0x8F, 0x12, 0xF8, 0xDF, 0xE1, 0x8D, 0xE6, 0x89, 0x75, + 0xA8, 0x5D, 0xFC, 0x41, 0xD7, 0xEE, 0x7C, 0x67, 0xE2, 0xDD, 0x4F, 0xC4, 0x5A, 0xAB, 0x6B, 0x96, + 0xB2, 0xDB, 0x45, 0x6B, 0xA6, 0xA5, 0x8C, 0xBA, 0xE3, 0x69, 0xF0, 0xC5, 0x6F, 0x71, 0xA8, 0xFD, + 0xB1, 0x2D, 0xC5, 0xEB, 0xC9, 0x64, 0xD2, 0xFD, 0x86, 0x20, 0x0F, 0x16, 0xF0, 0xBF, 0xEC, 0x4F, + 0xA9, 0xF8, 0x07, 0xE2, 0xA7, 0x8C, 0x7C, 0x61, 0xF0, 0xE3, 0xC6, 0xD6, 0xDE, 0x0B, 0xB2, 0xD2, + 0xBE, 0x10, 0xFC, 0x5A, 0xD2, 0xBE, 0x02, 0xF8, 0xB2, 0x7B, 0x08, 0xFC, 0x5F, 0xE3, 0x3F, 0x03, + 0xF8, 0xDF, 0xF6, 0x82, 0xF8, 0xA7, 0x7D, 0xE3, 0x9F, 0x8A, 0xFA, 0xC6, 0xB1, 0xA6, 0x4F, 0x0C, + 0x56, 0x17, 0xDA, 0x6D, 0xBE, 0xAB, 0xA4, 0xFC, 0x39, 0x7D, 0x22, 0xD8, 0x3A, 0x32, 0xA5, 0xB6, + 0xB7, 0x05, 0xD3, 0x4C, 0x25, 0x82, 0x55, 0x00, 0xED, 0x6C, 0xEF, 0x7F, 0x6F, 0xDF, 0x18, 0x7C, + 0x3D, 0xF8, 0xA5, 0xA0, 0x78, 0x9F, 0xE1, 0xF7, 0xEC, 0xD3, 0xF0, 0x37, 0xC7, 0x03, 0xC2, 0x69, + 0x07, 0xC2, 0x5F, 0x1B, 0x7C, 0x33, 0xFD, 0xA6, 0xB5, 0xDF, 0x8E, 0x17, 0xBA, 0xB6, 0xA5, 0xE6, + 0x62, 0xE1, 0x35, 0x18, 0xB5, 0x5F, 0x86, 0x7A, 0x4D, 0x96, 0x88, 0xEF, 0x02, 0x6D, 0x86, 0xFB, + 0xEC, 0x7E, 0x21, 0x86, 0xDA, 0x79, 0x96, 0x79, 0x74, 0x8B, 0xF8, 0xAD, 0x8D, 0x95, 0xE0, 0x07, + 0x84, 0x7E, 0xC8, 0xDF, 0xB2, 0xDF, 0xED, 0xA3, 0xF0, 0x8E, 0xDF, 0xE2, 0xFE, 0xB3, 0xF1, 0x93, + 0xE3, 0xA7, 0x83, 0x3C, 0x55, 0xAD, 0xFE, 0xD4, 0x1F, 0x15, 0x6F, 0xFE, 0x22, 0x7C, 0x64, 0xD3, + 0xE3, 0x96, 0x1F, 0x13, 0xFC, 0x42, 0xF8, 0x79, 0x2C, 0x7F, 0x0F, 0xB4, 0x3F, 0x09, 0xE8, 0x57, + 0xDE, 0x19, 0xF8, 0x83, 0xA5, 0x78, 0x77, 0xC2, 0xBA, 0x5E, 0xA3, 0x71, 0x15, 0xBF, 0x81, 0xF4, + 0x8B, 0x87, 0x8A, 0x4F, 0x05, 0x69, 0x28, 0xA2, 0xED, 0x60, 0x59, 0x1E, 0x5D, 0x36, 0x4B, 0xED, + 0x74, 0x02, 0x2F, 0x83, 0x3F, 0xB0, 0x9D, 0x9F, 0x86, 0xBE, 0x26, 0xF8, 0x6C, 0x7C, 0x50, 0xFD, + 0x92, 0xFF, 0x00, 0x62, 0x31, 0x65, 0xF0, 0xBF, 0x52, 0xB0, 0xF8, 0x87, 0xE0, 0xAF, 0xDB, 0x1B, + 0xE0, 0x76, 0xBF, 0xAE, 0x7C, 0x2C, 0xFD, 0xA7, 0x3C, 0x73, 0xE2, 0xFD, 0x36, 0x58, 0x5E, 0x0D, + 0x47, 0x5B, 0xF0, 0xAC, 0x5E, 0x1F, 0x13, 0x59, 0x9B, 0x88, 0xEE, 0xF5, 0xCB, 0x6B, 0xF9, 0xDF, + 0xC6, 0xDA, 0xBF, 0xF6, 0x8C, 0x32, 0x5E, 0x47, 0x73, 0x6C, 0xF6, 0xDA, 0xD5, 0xDD, 0x9D, 0xB8, + 0x07, 0xD3, 0x1F, 0xB1, 0xDF, 0xC1, 0xCF, 0x8A, 0x9F, 0xB3, 0xDF, 0xC3, 0x1D, 0x0F, 0xE0, 0x57, + 0x8B, 0x2F, 0xBE, 0x1F, 0xCB, 0xF0, 0x97, 0xE0, 0x57, 0x82, 0xBC, 0x3D, 0xF0, 0x37, 0xF6, 0x75, + 0x87, 0xC2, 0xF7, 0x5A, 0x8E, 0xB7, 0xE3, 0x2D, 0x63, 0xC2, 0x9E, 0x14, 0xB2, 0x7B, 0x3D, 0x33, + 0x5D, 0xF1, 0x6D, 0xF5, 0xC4, 0x16, 0xB0, 0xC3, 0xAA, 0xCF, 0x60, 0x34, 0x6B, 0x49, 0xB4, 0xFB, + 0x58, 0x27, 0x82, 0x29, 0x74, 0xAB, 0x8B, 0xD4, 0xBE, 0x90, 0x6A, 0xC2, 0xC3, 0x48, 0x00, 0xF3, + 0xEF, 0x04, 0xFE, 0xC8, 0x5E, 0x27, 0xF8, 0x39, 0x69, 0xF1, 0x9F, 0x50, 0xF8, 0x2F, 0xE2, 0xFD, + 0x3B, 0xC3, 0x1E, 0x35, 0xBB, 0xFD, 0x97, 0xFE, 0x1B, 0xFE, 0xCA, 0x3F, 0xB3, 0xEF, 0x88, 0xB5, + 0x76, 0x4D, 0x6C, 0x68, 0x1E, 0x1D, 0xF8, 0x55, 0xA5, 0x6B, 0x52, 0x78, 0x5A, 0x7F, 0x11, 0x43, + 0x2D, 0x83, 0xC2, 0xD7, 0xE7, 0x58, 0xF1, 0xCF, 0x8A, 0x8C, 0xF3, 0xC5, 0x0C, 0xF0, 0xB5, 0xA9, + 0xD3, 0xF6, 0xDA, 0x89, 0x21, 0x91, 0x67, 0x00, 0xD2, 0xF1, 0x29, 0xFF, 0x00, 0x82, 0x84, 0xFC, + 0x43, 0xF8, 0x1F, 0xF1, 0x37, 0x49, 0x8F, 0xC2, 0x9F, 0xB3, 0xBF, 0xEC, 0xE1, 0xF1, 0xBC, 0x5C, + 0x69, 0x67, 0xE1, 0x6E, 0xAB, 0xF0, 0xA7, 0xF6, 0x97, 0xD4, 0xFE, 0x32, 0x69, 0x5A, 0xBD, 0xB2, + 0x5E, 0x23, 0xEB, 0x10, 0xDE, 0xEB, 0x5A, 0xFF, 0x00, 0xC2, 0xB8, 0x2D, 0xF4, 0x3B, 0x87, 0xB7, + 0x89, 0xA1, 0x86, 0x76, 0xF0, 0xF7, 0x88, 0xE3, 0x53, 0x33, 0x48, 0xD6, 0xD9, 0x8D, 0x55, 0x80, + 0x30, 0x3F, 0x61, 0xBF, 0xD9, 0xDF, 0xF6, 0xA0, 0xFD, 0x99, 0x7E, 0x1E, 0x78, 0x6B, 0xC0, 0x9F, + 0x14, 0xFE, 0x2C, 0x7C, 0x38, 0xF8, 0xB3, 0xA5, 0xEB, 0xFE, 0x34, 0xF8, 0x81, 0xF1, 0x5B, 0xE2, + 0x3C, 0x27, 0xC3, 0xB2, 0x58, 0xF8, 0xF3, 0xC2, 0xFE, 0x23, 0xF8, 0x87, 0xE3, 0x8D, 0x6F, 0xC5, + 0xB7, 0xED, 0x65, 0xE2, 0x9B, 0x3B, 0x6D, 0x3F, 0x4C, 0xD7, 0xAD, 0xED, 0xEF, 0x3C, 0x49, 0x2D, + 0x83, 0x11, 0xE1, 0x9F, 0x0E, 0x0B, 0x81, 0xBF, 0x50, 0x8E, 0x2B, 0x15, 0x0B, 0xA4, 0x80, 0x0F, + 0xA6, 0xB5, 0x5F, 0x04, 0x78, 0xAA, 0xE3, 0xF6, 0x8B, 0xF0, 0x17, 0xC4, 0x6B, 0x2D, 0x17, 0xC0, + 0x32, 0x78, 0x23, 0x46, 0xF8, 0x2B, 0xE2, 0xDF, 0x04, 0x78, 0x8B, 0xC4, 0x17, 0xDA, 0xCE, 0xB7, + 0x17, 0xC5, 0x0B, 0x2D, 0x53, 0x52, 0xD7, 0x3C, 0x39, 0x75, 0xA3, 0x59, 0x69, 0x7A, 0x74, 0x7F, + 0xF1, 0x27, 0x93, 0x4B, 0x96, 0x0D, 0x27, 0x5C, 0x7B, 0xB9, 0xAE, 0x00, 0xBA, 0x8E, 0x68, 0x34, + 0x94, 0xB7, 0xFD, 0xD4, 0xD7, 0x58, 0x00, 0xF6, 0xBA, 0x00, 0x28, 0x00, 0xA0, 0x02, 0x80, 0x0A, + 0x00, 0x28, 0x00, 0xA0, 0x02, 0x80, 0x0A, 0x00, 0x28, 0x00, 0xA0, 0x0B, 0x14, 0x00, 0x50, 0x01, + 0x40, 0x05, 0x00, 0x14, 0x00, 0x50, 0x07, 0xF9, 0xF9, 0xFF, 0x00, 0xC1, 0xCF, 0xBF, 0xF2, 0x9C, + 0xFF, 0x00, 0xF8, 0x24, 0x3F, 0xFD, 0x82, 0xBE, 0x1E, 0xFF, 0x00, 0xEA, 0xDE, 0xB9, 0xAE, 0xCC, + 0xB3, 0xFE, 0x46, 0x18, 0x7F, 0xF1, 0xC3, 0xFF, 0x00, 0x4A, 0x47, 0x3E, 0x27, 0xFD, 0xD6, 0xA7, + 0xF8, 0x5F, 0xE4, 0x7D, 0xA9, 0x5F, 0xA9, 0x9F, 0x1C, 0x14, 0x00, 0x50, 0x01, 0x40, 0x1F, 0xB0, + 0x5F, 0xF0, 0x44, 0x2F, 0xF9, 0x11, 0x3F, 0x6E, 0xBF, 0xFB, 0x3E, 0x78, 0x3F, 0xF5, 0x43, 0x7C, + 0x32, 0xAF, 0xCE, 0xB8, 0x83, 0xFE, 0x46, 0x93, 0xF4, 0x8F, 0xFE, 0x92, 0x8F, 0xA8, 0xCA, 0xFF, + 0x00, 0xDC, 0xA3, 0xF3, 0xFC, 0xCF, 0xDB, 0x6A, 0xF1, 0x4F, 0x44, 0x28, 0x00, 0xA0, 0x02, 0x80, + 0x0A, 0x00, 0x28, 0x00, 0xA0, 0x02, 0x80, 0x0A, 0x00, 0x43, 0xF7, 0x4F, 0xFB, 0xBF, 0xD2, 0x80, + 0x20, 0xA0, 0x02, 0x80, 0x0A, 0x00, 0x28, 0x00, 0xA0, 0x02, 0x80, 0x0A, 0x00, 0x28, 0x00, 0xA0, + 0x02, 0x80, 0x0A, 0x00, 0x28, 0x00, 0xA0, 0x02, 0x80, 0x0A, 0x00, 0x28, 0x01, 0x0A, 0xAB, 0x29, + 0x42, 0xA0, 0xA9, 0x5D, 0xA5, 0x48, 0x1B, 0x48, 0x23, 0x90, 0x45, 0x00, 0x7C, 0x52, 0x73, 0xFB, + 0x14, 0xEE, 0x75, 0x56, 0x7F, 0xD8, 0xB4, 0xE3, 0x31, 0xC6, 0x92, 0x4D, 0x2F, 0xEC, 0x62, 0x71, + 0x2B, 0xCD, 0x34, 0x92, 0x34, 0xAC, 0x4F, 0xC3, 0xB3, 0x8B, 0x68, 0xE3, 0x86, 0x28, 0xC7, 0xFC, + 0x22, 0xDC, 0xF5, 0xF0, 0xE9, 0xFF, 0x00, 0x8A, 0x28, 0x03, 0xED, 0x71, 0x8C, 0x71, 0x8C, 0x0E, + 0x38, 0x18, 0xC6, 0x3B, 0x63, 0xF0, 0xA0, 0x03, 0xA0, 0xE0, 0x70, 0x07, 0x00, 0x0E, 0xC0, 0x70, + 0x00, 0xFC, 0xA8, 0x03, 0xE3, 0x02, 0xE3, 0xF6, 0xCE, 0x02, 0x3B, 0x77, 0x82, 0x4F, 0xD8, 0xC5, + 0xD0, 0xAD, 0xC5, 0xC2, 0x7D, 0x9E, 0xFE, 0xD3, 0xF6, 0xCD, 0x89, 0xE3, 0x85, 0x92, 0x38, 0x72, + 0xB2, 0x45, 0x27, 0xC3, 0xB7, 0x49, 0x6E, 0x23, 0x93, 0xEE, 0x3F, 0x88, 0x99, 0x30, 0xB8, 0xD0, + 0x79, 0xF1, 0x68, 0x07, 0xD9, 0x91, 0xC7, 0x1C, 0x31, 0xC7, 0x0C, 0x48, 0xB1, 0xC5, 0x14, 0x6B, + 0x14, 0x51, 0xA2, 0x85, 0x48, 0xD5, 0x46, 0x15, 0x54, 0x76, 0x00, 0x00, 0x31, 0x40, 0x0F, 0xA0, + 0x0F, 0x2E, 0xF8, 0xA9, 0xF0, 0xAB, 0x47, 0xF8, 0xA5, 0xA4, 0x69, 0x51, 0x4B, 0xA9, 0xEA, 0x9E, + 0x13, 0xF1, 0x77, 0x84, 0xB5, 0x43, 0xE2, 0x3F, 0x87, 0x5F, 0x11, 0x7C, 0x34, 0x96, 0xDF, 0xF0, + 0x96, 0x7C, 0x3B, 0xD5, 0xBE, 0xCD, 0x25, 0xB8, 0xBF, 0xD3, 0xCD, 0xC4, 0x52, 0xDB, 0xB8, 0x7B, + 0x7B, 0x9B, 0x98, 0x26, 0x82, 0x78, 0xA5, 0x82, 0xE2, 0x09, 0xA7, 0x82, 0x68, 0xDE, 0x39, 0x19, + 0x48, 0x07, 0x39, 0xF0, 0xAF, 0xE2, 0xA6, 0xAD, 0xAD, 0x6A, 0xD7, 0xFF, 0x00, 0x0B, 0x7E, 0x29, + 0xE9, 0xBA, 0x4F, 0x84, 0xBE, 0x36, 0xF8, 0x63, 0x4D, 0xFE, 0xD1, 0xD4, 0xB4, 0x8D, 0x22, 0x4B, + 0x83, 0xE1, 0x2F, 0x88, 0x5A, 0x64, 0x62, 0x05, 0x6F, 0x13, 0xF8, 0x4A, 0x5B, 0x85, 0x59, 0xAE, + 0x34, 0xE1, 0x25, 0xED, 0xAC, 0x37, 0x10, 0xB6, 0xE9, 0x74, 0xFB, 0x99, 0x16, 0xDA, 0x66, 0x91, + 0x24, 0xB4, 0xBA, 0xBE, 0x00, 0xF7, 0x4A, 0x00, 0x28, 0x00, 0xA0, 0x02, 0x80, 0x0A, 0x00, 0x28, + 0x00, 0xA0, 0x02, 0x80, 0x0A, 0x00, 0x28, 0x00, 0xA0, 0x02, 0x80, 0x0A, 0x00, 0x28, 0x00, 0xA0, + 0x02, 0x80, 0x0A, 0x00, 0x28, 0x00, 0xA0, 0x02, 0x80, 0x0A, 0x00, 0xB1, 0x40, 0x05, 0x00, 0x14, + 0x00, 0x50, 0x01, 0x40, 0x05, 0x00, 0x7F, 0x9F, 0x9F, 0xFC, 0x1C, 0xFB, 0xFF, 0x00, 0x29, 0xCF, + 0xFF, 0x00, 0x82, 0x43, 0xFF, 0x00, 0xD8, 0x2B, 0xE1, 0xEF, 0xFE, 0xAD, 0xEB, 0x9A, 0xEC, 0xCB, + 0x3F, 0xE4, 0x61, 0x87, 0xFF, 0x00, 0x1C, 0x3F, 0xF4, 0xA4, 0x73, 0xE2, 0x7F, 0xDD, 0x6A, 0x7F, + 0x85, 0xFE, 0x47, 0xDA, 0x95, 0xFA, 0x99, 0xF1, 0xC1, 0x40, 0x05, 0x00, 0x14, 0x01, 0xFB, 0x05, + 0xFF, 0x00, 0x04, 0x42, 0xFF, 0x00, 0x91, 0x13, 0xF6, 0xEB, 0xFF, 0x00, 0xB3, 0xE7, 0x83, 0xFF, + 0x00, 0x54, 0x37, 0xC3, 0x2A, 0xFC, 0xEB, 0x88, 0x3F, 0xE4, 0x69, 0x3F, 0x48, 0xFF, 0x00, 0xE9, + 0x28, 0xFA, 0x8C, 0xAF, 0xFD, 0xCA, 0x3F, 0x3F, 0xCC, 0xFD, 0xB6, 0xAF, 0x14, 0xF4, 0x42, 0x80, + 0x0A, 0x00, 0x28, 0x00, 0xA0, 0x02, 0x80, 0x0A, 0x00, 0x28, 0x00, 0xA0, 0x04, 0x3F, 0x74, 0xFF, + 0x00, 0xBB, 0xFD, 0x28, 0x02, 0x0A, 0x00, 0x28, 0x00, 0xA0, 0x02, 0x80, 0x0A, 0x00, 0x28, 0x00, + 0xA0, 0x02, 0x80, 0x0A, 0x00, 0x28, 0x00, 0xA0, 0x02, 0x80, 0x0A, 0x00, 0x28, 0x00, 0xA0, 0x02, + 0x80, 0x30, 0x3C, 0x55, 0xE2, 0xAF, 0x0C, 0xF8, 0x17, 0xC3, 0x1A, 0xF7, 0x8C, 0xFC, 0x65, 0xAF, + 0x69, 0x3E, 0x16, 0xF0, 0x8F, 0x85, 0x74, 0x89, 0xF5, 0xEF, 0x12, 0x78, 0x8F, 0x5D, 0xBD, 0x8F, + 0x4C, 0xD1, 0x74, 0x2B, 0x1B, 0x48, 0x8C, 0x97, 0x37, 0x57, 0x57, 0x0E, 0x42, 0x47, 0x14, 0x68, + 0x8C, 0xCC, 0xCC, 0x40, 0x00, 0x50, 0x07, 0x3B, 0xF0, 0xD3, 0xC5, 0xFA, 0xFF, 0x00, 0x8F, 0x3C, + 0x36, 0xDE, 0x28, 0xD6, 0xFC, 0x05, 0xAD, 0x7C, 0x3A, 0xB3, 0xD4, 0xB5, 0x09, 0x1F, 0xC2, 0xBA, + 0x17, 0x8A, 0xA7, 0x58, 0xBC, 0x69, 0x75, 0xA5, 0x2A, 0x20, 0xB6, 0xD4, 0x35, 0x7D, 0x35, 0x53, + 0x1A, 0x64, 0xF3, 0xB8, 0x9E, 0x44, 0xB2, 0x69, 0x65, 0x9A, 0x28, 0x0D, 0xA9, 0xB9, 0x16, 0xD7, + 0x4F, 0x3D, 0x95, 0x90, 0x07, 0xCC, 0xDE, 0x31, 0xFD, 0x92, 0xB5, 0xFD, 0x23, 0x48, 0xD1, 0x74, + 0xBF, 0x80, 0x7F, 0xB5, 0xBF, 0xED, 0x2B, 0xFB, 0x26, 0x7C, 0x31, 0xF0, 0x27, 0x84, 0x64, 0xD1, + 0xF4, 0x0F, 0x83, 0x1F, 0x02, 0xB4, 0x0F, 0x84, 0x1E, 0x20, 0xF8, 0x77, 0xA6, 0xA4, 0x77, 0xB7, + 0x77, 0x6A, 0x6C, 0x7F, 0xE1, 0x32, 0xF0, 0x2F, 0x88, 0xB5, 0x0B, 0x08, 0x23, 0x8E, 0xF2, 0x1B, + 0x3B, 0x7D, 0x3E, 0xCE, 0xEE, 0xDF, 0x4D, 0xB2, 0xB3, 0xB1, 0xB0, 0xB6, 0xB4, 0xB2, 0xB7, 0x8E, + 0x12, 0x1C, 0x03, 0xC9, 0x7E, 0x07, 0xFE, 0xCD, 0xDE, 0x36, 0xF8, 0xE3, 0xF0, 0xA7, 0xE1, 0x2F, + 0xC4, 0x4F, 0x8C, 0x5F, 0xB6, 0xCF, 0xED, 0x85, 0xF1, 0x9F, 0xE1, 0x77, 0xC5, 0x9F, 0x86, 0xBA, + 0x27, 0x8F, 0x3C, 0x5D, 0xFB, 0x3B, 0x7C, 0x4B, 0xB0, 0xF8, 0x23, 0xA2, 0x7C, 0x3D, 0xF1, 0x65, + 0xAE, 0xB9, 0xA3, 0xC5, 0x78, 0x9A, 0x1E, 0xBB, 0xA9, 0xF8, 0x4B, 0xE1, 0xBF, 0x87, 0xF5, 0xCB, + 0xAB, 0x18, 0xE4, 0xB9, 0x87, 0xCE, 0xB7, 0x86, 0xFE, 0xD6, 0xDE, 0xF9, 0x21, 0x6B, 0x5B, 0xC8, + 0x2E, 0x6C, 0xAE, 0xAE, 0xAC, 0xAE, 0x00, 0x3F, 0x40, 0x3C, 0x7F, 0xE2, 0x0F, 0x11, 0xF8, 0x53, + 0xC2, 0xB7, 0xDA, 0xFF, 0x00, 0x85, 0x3C, 0x13, 0x77, 0xF1, 0x07, 0x53, 0xD3, 0x6E, 0x6D, 0x26, + 0x9F, 0xC2, 0x7A, 0x5E, 0xAD, 0x6F, 0xA2, 0xEB, 0x17, 0xF6, 0x2D, 0x79, 0x12, 0xEA, 0x52, 0xD8, + 0x3C, 0xE0, 0x41, 0x2D, 0xD4, 0x36, 0xAF, 0x73, 0x34, 0x56, 0xF2, 0x3C, 0x2B, 0x3B, 0xC4, 0x90, + 0xF9, 0xD1, 0x79, 0x9E, 0x62, 0x80, 0x5A, 0xF0, 0x47, 0x8D, 0x7C, 0x2F, 0xF1, 0x1B, 0xC2, 0x7A, + 0x17, 0x8D, 0xFC, 0x17, 0xAA, 0xC7, 0xAD, 0x78, 0x63, 0xC4, 0x76, 0x0B, 0x7F, 0xA5, 0x5F, 0xA5, + 0xB4, 0xD6, 0x12, 0x95, 0xDC, 0x56, 0x48, 0x6E, 0x2D, 0x66, 0x44, 0x9E, 0xDA, 0xE2, 0x29, 0x23, + 0x92, 0x29, 0x6D, 0xE7, 0x8E, 0x39, 0xA1, 0x96, 0x39, 0x62, 0x91, 0x12, 0x48, 0xD9, 0x14, 0x03, + 0xAA, 0xA0, 0x02, 0x80, 0x3C, 0xE3, 0xE2, 0x3F, 0xC2, 0xEF, 0x0E, 0x7C, 0x4B, 0xB1, 0xD2, 0x57, + 0x54, 0x9F, 0x59, 0xD0, 0x7C, 0x43, 0xE1, 0x7D, 0x40, 0xEB, 0x9E, 0x07, 0xF1, 0xD7, 0x84, 0xF5, + 0x01, 0xA3, 0x78, 0xCB, 0xC0, 0xDA, 0x88, 0x89, 0xA3, 0x4B, 0xDD, 0x3E, 0xE4, 0xAB, 0xC4, 0xE3, + 0x6B, 0x95, 0x96, 0xD6, 0xE6, 0x2B, 0x8B, 0x3B, 0xA8, 0xCB, 0x5B, 0xDD, 0x5B, 0x5C, 0xC1, 0x24, + 0x90, 0xB8, 0x07, 0xCA, 0x3F, 0xF0, 0xC7, 0xDF, 0xB4, 0x27, 0xFD, 0x25, 0x57, 0xF6, 0xF6, 0xFF, + 0x00, 0xC3, 0x75, 0xFB, 0x2E, 0x7F, 0xF3, 0x9D, 0xA0, 0x03, 0xFE, 0x18, 0xFB, 0xF6, 0x84, 0xFF, + 0x00, 0xA4, 0xAA, 0xFE, 0xDE, 0xDF, 0xF8, 0x6E, 0xBF, 0x65, 0xCF, 0xFE, 0x73, 0xB4, 0x00, 0x7F, + 0xC3, 0x1F, 0x7E, 0xD0, 0x9F, 0xF4, 0x95, 0x5F, 0xDB, 0xDB, 0xFF, 0x00, 0x0D, 0xD7, 0xEC, 0xB9, + 0xFF, 0x00, 0xCE, 0x76, 0x80, 0x0F, 0xF8, 0x63, 0xEF, 0xDA, 0x13, 0xFE, 0x92, 0xAB, 0xFB, 0x7B, + 0x7F, 0xE1, 0xBA, 0xFD, 0x97, 0x3F, 0xF9, 0xCE, 0xD0, 0x01, 0xFF, 0x00, 0x0C, 0x7D, 0xFB, 0x42, + 0x7F, 0xD2, 0x55, 0x7F, 0x6F, 0x6F, 0xFC, 0x37, 0x5F, 0xB2, 0xE7, 0xFF, 0x00, 0x39, 0xDA, 0x00, + 0x3F, 0xE1, 0x8F, 0xBF, 0x68, 0x4F, 0xFA, 0x4A, 0xAF, 0xED, 0xED, 0xFF, 0x00, 0x86, 0xEB, 0xF6, + 0x5C, 0xFF, 0x00, 0xE7, 0x3B, 0x40, 0x07, 0xFC, 0x31, 0xF7, 0xED, 0x09, 0xFF, 0x00, 0x49, 0x55, + 0xFD, 0xBD, 0xBF, 0xF0, 0xDD, 0x7E, 0xCB, 0x9F, 0xFC, 0xE7, 0x68, 0x00, 0xFF, 0x00, 0x86, 0x3E, + 0xFD, 0xA1, 0x3F, 0xE9, 0x2A, 0xBF, 0xB7, 0xB7, 0xFE, 0x1B, 0xAF, 0xD9, 0x73, 0xFF, 0x00, 0x9C, + 0xED, 0x00, 0x1F, 0xF0, 0xC7, 0xDF, 0xB4, 0x27, 0xFD, 0x25, 0x57, 0xF6, 0xF6, 0xFF, 0x00, 0xC3, + 0x75, 0xFB, 0x2E, 0x7F, 0xF3, 0x9D, 0xA0, 0x03, 0xFE, 0x18, 0xFB, 0xF6, 0x84, 0xFF, 0x00, 0xA4, + 0xAA, 0xFE, 0xDE, 0xDF, 0xF8, 0x6E, 0xBF, 0x65, 0xCF, 0xFE, 0x73, 0xB4, 0x00, 0x7F, 0xC3, 0x1F, + 0x7E, 0xD0, 0x9F, 0xF4, 0x95, 0x5F, 0xDB, 0xDB, 0xFF, 0x00, 0x0D, 0xD7, 0xEC, 0xB9, 0xFF, 0x00, + 0xCE, 0x76, 0x80, 0x0F, 0xF8, 0x63, 0xEF, 0xDA, 0x13, 0xFE, 0x92, 0xAB, 0xFB, 0x7B, 0x7F, 0xE1, + 0xBA, 0xFD, 0x97, 0x3F, 0xF9, 0xCE, 0xD0, 0x07, 0xBA, 0x7C, 0x11, 0xF8, 0x33, 0xF1, 0x17, 0xE1, + 0x44, 0xFE, 0x23, 0x9B, 0xC7, 0x7F, 0xB5, 0x9F, 0xED, 0x03, 0xFB, 0x4C, 0x45, 0xAD, 0xC1, 0x69, + 0x16, 0x97, 0x67, 0xF1, 0xBB, 0xC3, 0x7F, 0x0A, 0x74, 0x0B, 0x6F, 0x06, 0xB5, 0xB3, 0x4A, 0x66, + 0x93, 0x4D, 0x3E, 0x0E, 0xF0, 0x67, 0x87, 0xA4, 0x76, 0x9C, 0x4D, 0x10, 0x90, 0x5E, 0x3D, 0xDA, + 0x81, 0x6F, 0x17, 0x94, 0xB1, 0x13, 0x21, 0x94, 0x03, 0xE8, 0x1A, 0x00, 0x28, 0x00, 0xA0, 0x02, + 0x80, 0x0A, 0x00, 0x28, 0x00, 0xA0, 0x02, 0x80, 0x2C, 0x50, 0x01, 0x40, 0x05, 0x00, 0x14, 0x00, + 0x50, 0x01, 0x40, 0x1F, 0xE7, 0xE7, 0xFF, 0x00, 0x07, 0x3E, 0xFF, 0x00, 0xCA, 0x73, 0xFF, 0x00, + 0xE0, 0x90, 0xFF, 0x00, 0xF6, 0x0A, 0xF8, 0x7B, 0xFF, 0x00, 0xAB, 0x7A, 0xE6, 0xBB, 0x32, 0xCF, + 0xF9, 0x18, 0x61, 0xFF, 0x00, 0xC7, 0x0F, 0xFD, 0x29, 0x1C, 0xF8, 0x9F, 0xF7, 0x5A, 0x9F, 0xE1, + 0x7F, 0x91, 0xF6, 0xA5, 0x7E, 0xA6, 0x7C, 0x70, 0x50, 0x01, 0x40, 0x05, 0x00, 0x7E, 0xC1, 0x7F, + 0xC1, 0x10, 0xBF, 0xE4, 0x44, 0xFD, 0xBA, 0xFF, 0x00, 0xEC, 0xF9, 0xE0, 0xFF, 0x00, 0xD5, 0x0D, + 0xF0, 0xCA, 0xBF, 0x3A, 0xE2, 0x0F, 0xF9, 0x1A, 0x4F, 0xD2, 0x3F, 0xFA, 0x4A, 0x3E, 0xA3, 0x2B, + 0xFF, 0x00, 0x72, 0x8F, 0xCF, 0xF3, 0x3F, 0x6D, 0xAB, 0xC5, 0x3D, 0x10, 0xA0, 0x02, 0x80, 0x0A, + 0x00, 0x28, 0x00, 0xA0, 0x02, 0x80, 0x0A, 0x00, 0x28, 0x01, 0x0F, 0xDD, 0x3F, 0xEE, 0xFF, 0x00, + 0x4A, 0x00, 0x82, 0x80, 0x0A, 0x00, 0x28, 0x00, 0xA0, 0x02, 0x80, 0x0A, 0x00, 0x28, 0x00, 0xA0, + 0x02, 0x80, 0x0A, 0x00, 0x28, 0x00, 0xA0, 0x02, 0x80, 0x0A, 0x00, 0x28, 0x00, 0xE0, 0x0E, 0x9C, + 0x01, 0xD3, 0x81, 0xC0, 0x1D, 0x3D, 0x3B, 0x0A, 0x00, 0xF9, 0x57, 0xC2, 0x5E, 0x1A, 0xF1, 0x17, + 0xC7, 0xAF, 0x10, 0x78, 0x77, 0xE2, 0xCF, 0xC5, 0x0D, 0x13, 0x55, 0xF0, 0xC7, 0xC3, 0x7F, 0x0D, + 0xEA, 0x36, 0xBE, 0x28, 0xF8, 0x21, 0xF0, 0x5F, 0xC4, 0x16, 0x32, 0x69, 0x9A, 0xC4, 0xB7, 0x90, + 0x2C, 0x86, 0xC7, 0xC6, 0xDE, 0x34, 0xD3, 0xE7, 0xB7, 0x86, 0xE6, 0xDB, 0x53, 0x09, 0x72, 0x0D, + 0x96, 0x89, 0x3E, 0xE5, 0xD3, 0x4C, 0x71, 0x5E, 0x5C, 0xAF, 0xF6, 0x9F, 0x93, 0x0E, 0x82, 0x01, + 0xF5, 0x50, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x80, 0x07, 0xE0, 0x28, + 0x03, 0x2F, 0x5C, 0x46, 0x7D, 0x13, 0x57, 0x8E, 0x34, 0x2C, 0xCD, 0xA5, 0x5C, 0x22, 0x22, 0x29, + 0x66, 0x62, 0x61, 0x60, 0x15, 0x40, 0xFC, 0x06, 0x05, 0x00, 0x78, 0x67, 0xEC, 0x87, 0xA7, 0xDF, + 0x69, 0x3F, 0xB2, 0x6F, 0xEC, 0xBD, 0xA5, 0x6A, 0x96, 0x37, 0x9A, 0x5E, 0xA7, 0xA6, 0x7E, 0xCE, + 0xDE, 0x08, 0xD3, 0xF5, 0x1D, 0x33, 0x51, 0xB5, 0x92, 0xC7, 0x50, 0xD3, 0xAE, 0x20, 0xF0, 0xCD, + 0x92, 0x4D, 0x6F, 0x3C, 0x0E, 0x15, 0xE3, 0x91, 0x1D, 0x19, 0x59, 0x18, 0x02, 0xA4, 0x10, 0x40, + 0x23, 0x00, 0x03, 0xE8, 0x7A, 0x00, 0xF9, 0x87, 0xC6, 0xDE, 0x09, 0xF1, 0x2F, 0xC2, 0x6F, 0x12, + 0xEB, 0x9F, 0x1A, 0x3E, 0x0B, 0xE8, 0x57, 0x1A, 0xED, 0xBE, 0xB9, 0x39, 0xD5, 0xFE, 0x35, 0x7C, + 0x14, 0xD1, 0xD6, 0xD6, 0xD0, 0x7C, 0x4B, 0x10, 0xDA, 0xB2, 0xB7, 0x88, 0x3C, 0x3C, 0x8C, 0xA8, + 0x89, 0xE2, 0xA5, 0x48, 0x6C, 0x61, 0x06, 0x59, 0xA2, 0xB7, 0xBF, 0xB7, 0x85, 0x2D, 0xA7, 0x64, + 0x92, 0x3B, 0x5B, 0xAB, 0x40, 0x0F, 0xA5, 0xED, 0x6E, 0x23, 0xBB, 0xB5, 0xB6, 0xBA, 0x85, 0x27, + 0x48, 0xAE, 0x6D, 0xD2, 0xE2, 0x24, 0xB9, 0xB4, 0x96, 0xC6, 0xE5, 0x15, 0xD4, 0x15, 0x59, 0x20, + 0x91, 0x56, 0x48, 0xD8, 0x02, 0x01, 0x47, 0x55, 0x65, 0x3C, 0x10, 0x08, 0xC0, 0x00, 0x9E, 0x80, + 0x0A, 0x00, 0x28, 0x00, 0xA0, 0x02, 0x80, 0x0A, 0x00, 0x28, 0x00, 0xA0, 0x02, 0x80, 0x0A, 0x00, + 0x28, 0x00, 0xA0, 0x02, 0x80, 0x0A, 0x00, 0x28, 0x00, 0xA0, 0x02, 0x80, 0x0A, 0x00, 0x28, 0x00, + 0xA0, 0x02, 0x80, 0x0A, 0x00, 0x28, 0x02, 0xC5, 0x00, 0x14, 0x00, 0x50, 0x01, 0x40, 0x05, 0x00, + 0x14, 0x01, 0xFE, 0x7E, 0x7F, 0xF0, 0x73, 0xEF, 0xFC, 0xA7, 0x3F, 0xFE, 0x09, 0x0F, 0xFF, 0x00, + 0x60, 0xAF, 0x87, 0xBF, 0xFA, 0xB7, 0xAE, 0x6B, 0xB3, 0x2C, 0xFF, 0x00, 0x91, 0x86, 0x1F, 0xFC, + 0x70, 0xFF, 0x00, 0xD2, 0x91, 0xCF, 0x89, 0xFF, 0x00, 0x75, 0xA9, 0xFE, 0x17, 0xF9, 0x1F, 0x6A, + 0x57, 0xEA, 0x67, 0xC7, 0x05, 0x00, 0x14, 0x00, 0x50, 0x07, 0xEC, 0x17, 0xFC, 0x11, 0x0B, 0xFE, + 0x44, 0x4F, 0xDB, 0xAF, 0xFE, 0xCF, 0x9E, 0x0F, 0xFD, 0x50, 0xDF, 0x0C, 0xAB, 0xF3, 0xAE, 0x20, + 0xFF, 0x00, 0x91, 0xA4, 0xFD, 0x23, 0xFF, 0x00, 0xA4, 0xA3, 0xEA, 0x32, 0xBF, 0xF7, 0x28, 0xFC, + 0xFF, 0x00, 0x33, 0xF6, 0xDA, 0xBC, 0x53, 0xD1, 0x0A, 0x00, 0x28, 0x00, 0xA0, 0x02, 0x80, 0x0A, + 0x00, 0x28, 0x00, 0xA0, 0x02, 0x80, 0x10, 0xFD, 0xD3, 0xFE, 0xEF, 0xF4, 0xA0, 0x08, 0x28, 0x00, + 0xA0, 0x02, 0x80, 0x0A, 0x00, 0x28, 0x00, 0xA0, 0x02, 0x80, 0x0A, 0x00, 0x28, 0x00, 0xA0, 0x02, + 0x80, 0x0A, 0x00, 0x28, 0x00, 0xA0, 0x02, 0x80, 0x0A, 0x00, 0x28, 0x00, 0xA0, 0x02, 0x80, 0x3E, + 0x5C, 0xFD, 0xA2, 0xFC, 0x4D, 0xF1, 0x38, 0xEB, 0x9F, 0x06, 0x3E, 0x0F, 0xFC, 0x2A, 0xF1, 0xB5, + 0x8F, 0xC2, 0xED, 0x5B, 0xE3, 0x57, 0x89, 0xF5, 0xAD, 0x03, 0xC4, 0x5F, 0x13, 0x7F, 0xE1, 0x12, + 0xB6, 0xF1, 0xA7, 0x8A, 0xBC, 0x15, 0xA3, 0x69, 0xBE, 0x18, 0xBE, 0xBB, 0xB9, 0xB8, 0xF0, 0xBD, + 0x9D, 0xDB, 0x9D, 0x32, 0x2D, 0x6F, 0xCF, 0x8E, 0xC0, 0xDA, 0xDC, 0xEA, 0x56, 0x9A, 0xA5, 0x8C, + 0x26, 0x37, 0x33, 0xE9, 0xB7, 0xA8, 0xDE, 0x49, 0x00, 0xA1, 0xFB, 0x29, 0xFC, 0x40, 0xF1, 0xF7, + 0x88, 0x1B, 0xF6, 0x82, 0xF8, 0x49, 0xF1, 0x2F, 0xC5, 0x29, 0xF1, 0x13, 0xC5, 0x7F, 0xB2, 0xDF, + 0xC7, 0x38, 0x7E, 0x06, 0x49, 0xF1, 0x52, 0x4F, 0x0E, 0xDA, 0x78, 0x47, 0x59, 0xF8, 0xA5, 0x63, + 0x75, 0xE0, 0x0F, 0x0B, 0xF8, 0xAF, 0x49, 0xD6, 0x35, 0x9D, 0x32, 0xCF, 0x16, 0x11, 0x6A, 0xCB, + 0x63, 0xE3, 0xBB, 0x2B, 0x4B, 0xE9, 0x2C, 0x61, 0xB2, 0xB3, 0xB9, 0xBB, 0xB2, 0xBA, 0xBB, 0xB5, + 0xB0, 0xD3, 0x6D, 0xEE, 0xA2, 0xD3, 0xAC, 0x80, 0x39, 0x1F, 0xDB, 0x2F, 0xC6, 0xDF, 0x15, 0xB1, + 0xF0, 0xD7, 0xE0, 0xAF, 0xEC, 0xF5, 0xE2, 0x38, 0xF4, 0x2F, 0x8E, 0x3E, 0x37, 0x5D, 0x7F, 0xE3, + 0x16, 0x91, 0x1C, 0x76, 0x66, 0xF2, 0xE6, 0x6D, 0x13, 0xE1, 0x9D, 0x8C, 0x3A, 0x97, 0x97, 0x71, + 0x1B, 0x4D, 0x04, 0x72, 0xE9, 0x37, 0xBE, 0x2A, 0xBF, 0xF8, 0x6D, 0xA0, 0xEA, 0x90, 0x2C, 0xD1, + 0x5C, 0x4F, 0xA6, 0x78, 0x93, 0x51, 0x86, 0xDA, 0x5B, 0x49, 0x64, 0x5D, 0x47, 0x4E, 0x00, 0xFA, + 0x97, 0xE1, 0x67, 0xC4, 0x3F, 0x0F, 0x7C, 0x5D, 0xF8, 0x61, 0xF0, 0xE3, 0xE2, 0xC7, 0x84, 0x6E, + 0x63, 0xBC, 0xF0, 0x9F, 0xC4, 0xFF, 0x00, 0x01, 0x68, 0xFF, 0x00, 0x11, 0x3C, 0x2F, 0x79, 0x16, + 0xF3, 0x15, 0xDE, 0x9D, 0xAD, 0xE9, 0xD0, 0xDE, 0x58, 0xCA, 0x85, 0xD1, 0x1F, 0x0D, 0x0D, 0xCC, + 0x44, 0x6E, 0x44, 0x3C, 0xF2, 0xAA, 0x78, 0x00, 0x0B, 0xF1, 0x43, 0xE2, 0x17, 0x86, 0xFE, 0x11, + 0x7C, 0x32, 0xF8, 0x89, 0xF1, 0x63, 0xC6, 0x17, 0x71, 0x69, 0xDE, 0x10, 0xF8, 0x5F, 0xE0, 0x4D, + 0x5F, 0xE2, 0x1F, 0x8A, 0xB5, 0x09, 0x7C, 0xC1, 0x0D, 0x86, 0x99, 0xA2, 0x69, 0xF2, 0xDE, 0x5F, + 0x4C, 0xFE, 0x5A, 0x3B, 0xED, 0x48, 0x2D, 0x65, 0x63, 0xB5, 0x1C, 0xE0, 0x70, 0xA4, 0xE0, 0x10, + 0x0F, 0x95, 0xFF, 0x00, 0x63, 0x1F, 0x1B, 0x7C, 0x59, 0xC7, 0xC4, 0x8F, 0x83, 0x1F, 0xB4, 0x27, + 0x88, 0x13, 0x59, 0xF8, 0xDD, 0xE0, 0xB8, 0xBC, 0x3F, 0xF1, 0x9F, 0x55, 0x82, 0x5B, 0x53, 0x6B, + 0x79, 0x65, 0xA2, 0xFC, 0x4D, 0xB2, 0x9F, 0x51, 0x36, 0xF0, 0xA2, 0xCD, 0x3C, 0x49, 0xA5, 0x58, + 0x78, 0xAB, 0x4E, 0xF8, 0x8F, 0xA1, 0x69, 0x70, 0x99, 0xA4, 0x9E, 0x0D, 0x33, 0xC3, 0xBA, 0x6C, + 0x17, 0x12, 0x5D, 0xCB, 0x13, 0x6A, 0x3A, 0x88, 0x07, 0xDC, 0x54, 0x00, 0x50, 0x07, 0xCB, 0xDF, + 0x11, 0x7E, 0x22, 0xF8, 0xBB, 0xC7, 0xFE, 0x2F, 0xD6, 0x3E, 0x00, 0xFC, 0x05, 0xD6, 0x1F, 0x45, + 0xF1, 0x36, 0x92, 0xB1, 0x5A, 0x7C, 0x6D, 0xF8, 0xDB, 0x65, 0x69, 0x6B, 0xA9, 0xD9, 0x7E, 0xCE, + 0x96, 0xB7, 0xB6, 0x31, 0x5C, 0xDB, 0x58, 0xE9, 0x50, 0xDD, 0x5A, 0xDC, 0xE9, 0xDA, 0x87, 0x8D, + 0x6E, 0x6D, 0x6F, 0xB4, 0xFB, 0x9B, 0x3D, 0x36, 0xEE, 0x29, 0x6D, 0xAC, 0x2D, 0x2E, 0x6D, 0xF5, + 0x7D, 0x4A, 0x29, 0x60, 0x97, 0x4B, 0xD2, 0xFC, 0x4C, 0x01, 0x36, 0xA1, 0xFB, 0x22, 0xFC, 0x1E, + 0xD5, 0x27, 0x86, 0xE6, 0xF7, 0x53, 0xF8, 0xF6, 0xD3, 0xC3, 0xA6, 0x58, 0xE9, 0x21, 0xAD, 0xBF, + 0x6B, 0x5F, 0x8B, 0x16, 0x09, 0x24, 0x5A, 0x75, 0x8C, 0x36, 0x96, 0xEF, 0x22, 0x45, 0xE2, 0x45, + 0x57, 0x98, 0xC5, 0x69, 0x11, 0x96, 0x66, 0x0D, 0x2C, 0xF2, 0x99, 0x67, 0x99, 0xE4, 0x96, 0x59, + 0x24, 0x70, 0x0A, 0x3F, 0xF0, 0xC6, 0x9F, 0x05, 0x3F, 0xE8, 0x23, 0xFB, 0x41, 0x7F, 0xE2, 0x61, + 0x7C, 0x5E, 0xFF, 0x00, 0xE6, 0x9A, 0x80, 0x0F, 0xF8, 0x63, 0x4F, 0x82, 0x9F, 0xF4, 0x11, 0xFD, + 0xA0, 0xBF, 0xF1, 0x30, 0xBE, 0x2F, 0x7F, 0xF3, 0x4D, 0x40, 0x07, 0xFC, 0x31, 0xA7, 0xC1, 0x4F, + 0xFA, 0x08, 0xFE, 0xD0, 0x5F, 0xF8, 0x98, 0x5F, 0x17, 0xBF, 0xF9, 0xA6, 0xA0, 0x03, 0xFE, 0x18, + 0xD3, 0xE0, 0xA7, 0xFD, 0x04, 0x7F, 0x68, 0x2F, 0xFC, 0x4C, 0x2F, 0x8B, 0xDF, 0xFC, 0xD3, 0x50, + 0x01, 0xFF, 0x00, 0x0C, 0x69, 0xF0, 0x53, 0xFE, 0x82, 0x3F, 0xB4, 0x17, 0xFE, 0x26, 0x17, 0xC5, + 0xEF, 0xFE, 0x69, 0xA8, 0x00, 0xFF, 0x00, 0x86, 0x34, 0xF8, 0x29, 0xFF, 0x00, 0x41, 0x1F, 0xDA, + 0x0B, 0xFF, 0x00, 0x13, 0x0B, 0xE2, 0xF7, 0xFF, 0x00, 0x34, 0xD4, 0x00, 0x7F, 0xC3, 0x1A, 0x7C, + 0x14, 0xFF, 0x00, 0xA0, 0x8F, 0xED, 0x05, 0xFF, 0x00, 0x89, 0x85, 0xF1, 0x7B, 0xFF, 0x00, 0x9A, + 0x6A, 0x00, 0x3F, 0xE1, 0x8D, 0x3E, 0x0A, 0x7F, 0xD0, 0x47, 0xF6, 0x82, 0xFF, 0x00, 0xC4, 0xC2, + 0xF8, 0xBD, 0xFF, 0x00, 0xCD, 0x35, 0x00, 0x1F, 0xF0, 0xC6, 0x9F, 0x05, 0x3F, 0xE8, 0x23, 0xFB, + 0x41, 0x7F, 0xE2, 0x61, 0x7C, 0x5E, 0xFF, 0x00, 0xE6, 0x9A, 0x80, 0x0F, 0xF8, 0x63, 0x4F, 0x82, + 0x9F, 0xF4, 0x11, 0xFD, 0xA0, 0xBF, 0xF1, 0x30, 0xBE, 0x2F, 0x7F, 0xF3, 0x4D, 0x40, 0x07, 0xFC, + 0x31, 0xA7, 0xC1, 0x4F, 0xFA, 0x08, 0xFE, 0xD0, 0x5F, 0xF8, 0x98, 0x5F, 0x17, 0xBF, 0xF9, 0xA6, + 0xA0, 0x03, 0xFE, 0x18, 0xD3, 0xE0, 0xA7, 0xFD, 0x04, 0x7F, 0x68, 0x2F, 0xFC, 0x4C, 0x2F, 0x8B, + 0xDF, 0xFC, 0xD3, 0x50, 0x01, 0xFF, 0x00, 0x0C, 0x69, 0xF0, 0x53, 0xFE, 0x82, 0x3F, 0xB4, 0x17, + 0xFE, 0x26, 0x17, 0xC5, 0xEF, 0xFE, 0x69, 0xA8, 0x03, 0xDF, 0x7C, 0x0D, 0xE0, 0x9D, 0x0B, 0xE1, + 0xD7, 0x85, 0xB4, 0xCF, 0x07, 0x78, 0x6E, 0x4F, 0x11, 0x4D, 0xA2, 0xE9, 0x0D, 0x70, 0xD6, 0x72, + 0x78, 0xB3, 0xC6, 0x7A, 0xCF, 0xC4, 0x1D, 0x7C, 0x9B, 0xAB, 0xA9, 0x2E, 0x25, 0x13, 0xEA, 0xFA, + 0xAD, 0xD5, 0xD5, 0xFC, 0xE0, 0x49, 0x71, 0x20, 0x41, 0x2C, 0xEE, 0x23, 0x40, 0x91, 0x26, 0xD8, + 0xE3, 0x44, 0x50, 0x0E, 0xB2, 0x80, 0x0A, 0x00, 0x28, 0x02, 0xC5, 0x00, 0x14, 0x00, 0x50, 0x01, + 0x40, 0x05, 0x00, 0x14, 0x01, 0xFE, 0x7E, 0x7F, 0xF0, 0x73, 0xEF, 0xFC, 0xA7, 0x3F, 0xFE, 0x09, + 0x0F, 0xFF, 0x00, 0x60, 0xAF, 0x87, 0xBF, 0xFA, 0xB7, 0xAE, 0x6B, 0xB3, 0x2C, 0xFF, 0x00, 0x91, + 0x86, 0x1F, 0xFC, 0x70, 0xFF, 0x00, 0xD2, 0x91, 0xCF, 0x89, 0xFF, 0x00, 0x75, 0xA9, 0xFE, 0x17, + 0xF9, 0x1F, 0x6A, 0x57, 0xEA, 0x67, 0xC7, 0x05, 0x00, 0x14, 0x00, 0x50, 0x07, 0xEC, 0x17, 0xFC, + 0x11, 0x0B, 0xFE, 0x44, 0x4F, 0xDB, 0xAF, 0xFE, 0xCF, 0x9E, 0x0F, 0xFD, 0x50, 0xDF, 0x0C, 0xAB, + 0xF3, 0xAE, 0x20, 0xFF, 0x00, 0x91, 0xA4, 0xFD, 0x23, 0xFF, 0x00, 0xA4, 0xA3, 0xEA, 0x32, 0xBF, + 0xF7, 0x28, 0xFC, 0xFF, 0x00, 0x33, 0xF6, 0xDA, 0xBC, 0x53, 0xD1, 0x0A, 0x00, 0x28, 0x00, 0xA0, + 0x02, 0x80, 0x0A, 0x00, 0x28, 0x00, 0xA0, 0x02, 0x80, 0x10, 0xFD, 0xD3, 0xFE, 0xEF, 0xF4, 0xA0, + 0x0F, 0x2B, 0xF8, 0xA3, 0xE3, 0xCF, 0x14, 0xFC, 0x3F, 0xD1, 0xF4, 0xDD, 0x4B, 0xC2, 0x7F, 0x04, + 0xFE, 0x26, 0xFC, 0x71, 0xBC, 0xBD, 0xD5, 0x06, 0x9D, 0x73, 0xE1, 0xDF, 0x85, 0x9A, 0xAF, 0x82, + 0xF4, 0x8D, 0x5F, 0x46, 0x84, 0xC1, 0x23, 0x9B, 0xEB, 0x97, 0xF1, 0x26, 0xBF, 0xA3, 0x5A, 0x18, + 0x03, 0x45, 0x1C, 0x5B, 0x61, 0x9E, 0x59, 0x77, 0x4B, 0x19, 0x11, 0x6C, 0x0E, 0xE8, 0x01, 0xE2, + 0x1F, 0xF0, 0xD2, 0x7F, 0x19, 0x7F, 0xE9, 0x1F, 0x1F, 0xB5, 0xEF, 0xFE, 0x16, 0x9F, 0x00, 0x7F, + 0xF9, 0xE5, 0xD0, 0x01, 0xFF, 0x00, 0x0D, 0x27, 0xF1, 0x97, 0xFE, 0x91, 0xF1, 0xFB, 0x5E, 0xFF, + 0x00, 0xE1, 0x69, 0xF0, 0x07, 0xFF, 0x00, 0x9E, 0x5D, 0x00, 0x1F, 0xF0, 0xD2, 0x7F, 0x19, 0x7F, + 0xE9, 0x1F, 0x1F, 0xB5, 0xEF, 0xFE, 0x16, 0x9F, 0x00, 0x7F, 0xF9, 0xE5, 0xD0, 0x01, 0xFF, 0x00, + 0x0D, 0x27, 0xF1, 0x97, 0xFE, 0x91, 0xF1, 0xFB, 0x5E, 0xFF, 0x00, 0xE1, 0x69, 0xF0, 0x07, 0xFF, + 0x00, 0x9E, 0x5D, 0x00, 0x1F, 0xF0, 0xD2, 0x7F, 0x19, 0x7F, 0xE9, 0x1F, 0x1F, 0xB5, 0xEF, 0xFE, + 0x16, 0x9F, 0x00, 0x7F, 0xF9, 0xE5, 0xD0, 0x01, 0xFF, 0x00, 0x0D, 0x27, 0xF1, 0x97, 0xFE, 0x91, + 0xF1, 0xFB, 0x5E, 0xFF, 0x00, 0xE1, 0x69, 0xF0, 0x07, 0xFF, 0x00, 0x9E, 0x5D, 0x00, 0x1F, 0xF0, + 0xD2, 0x7F, 0x19, 0x7F, 0xE9, 0x1F, 0x1F, 0xB5, 0xEF, 0xFE, 0x16, 0x9F, 0x00, 0x7F, 0xF9, 0xE5, + 0xD0, 0x01, 0xFF, 0x00, 0x0D, 0x27, 0xF1, 0x97, 0xFE, 0x91, 0xF1, 0xFB, 0x5E, 0xFF, 0x00, 0xE1, + 0x69, 0xF0, 0x07, 0xFF, 0x00, 0x9E, 0x5D, 0x00, 0x1F, 0xF0, 0xD2, 0x7F, 0x19, 0x7F, 0xE9, 0x1F, + 0x1F, 0xB5, 0xEF, 0xFE, 0x16, 0x9F, 0x00, 0x7F, 0xF9, 0xE5, 0xD0, 0x01, 0xFF, 0x00, 0x0D, 0x27, + 0xF1, 0x97, 0xFE, 0x91, 0xF1, 0xFB, 0x5E, 0xFF, 0x00, 0xE1, 0x69, 0xF0, 0x07, 0xFF, 0x00, 0x9E, + 0x5D, 0x00, 0x55, 0xBC, 0xFD, 0xA9, 0xFE, 0x25, 0x68, 0x96, 0x93, 0x6A, 0xFE, 0x26, 0xFD, 0x83, + 0x7F, 0x6C, 0x6D, 0x07, 0xC3, 0x5A, 0x62, 0x0B, 0xDF, 0x10, 0xEB, 0xB6, 0x72, 0xFC, 0x22, 0xF8, + 0x81, 0x73, 0xA0, 0xD8, 0x44, 0x41, 0xBC, 0xBE, 0x8F, 0x40, 0xD0, 0x3C, 0x77, 0xA8, 0xEB, 0xDA, + 0x99, 0x86, 0x11, 0x24, 0xBF, 0x62, 0xD2, 0xB4, 0xED, 0x42, 0xFE, 0xE3, 0x67, 0x93, 0x6B, 0x69, + 0x73, 0x3C, 0x91, 0x41, 0x20, 0x07, 0xD5, 0xDE, 0x1E, 0xF1, 0x06, 0x81, 0xE2, 0xDD, 0x03, 0x43, + 0xF1, 0x57, 0x85, 0x75, 0xBD, 0x1F, 0xC4, 0xBE, 0x17, 0xF1, 0x2E, 0x8F, 0x6B, 0xE2, 0x0F, 0x0E, + 0x78, 0x8B, 0xC3, 0xFA, 0x94, 0x1A, 0xCE, 0x83, 0xAF, 0xD8, 0x5E, 0xC0, 0x93, 0x59, 0x5E, 0xD8, + 0xDE, 0x42, 0xCD, 0x0C, 0xF6, 0xF2, 0xC3, 0x2C, 0x52, 0x47, 0x2C, 0x6C, 0xC8, 0xE8, 0xCA, 0xCA, + 0x48, 0x20, 0x90, 0x0E, 0x3F, 0xE2, 0x47, 0xC6, 0x2F, 0x84, 0x9F, 0x06, 0xF4, 0xFD, 0x3F, 0x55, + 0xF8, 0xB5, 0xF1, 0x3B, 0xC0, 0x1F, 0x0C, 0xB4, 0xDD, 0x56, 0xE5, 0xAC, 0xB4, 0x9B, 0xCF, 0x1E, + 0x78, 0xBB, 0x4F, 0xF0, 0x95, 0xBE, 0xA9, 0x34, 0x6A, 0x0C, 0x90, 0xDA, 0xB5, 0xCC, 0xB1, 0xF9, + 0xAE, 0xAA, 0xCA, 0x4A, 0xA6, 0xE2, 0xA0, 0x82, 0x40, 0x14, 0x01, 0xD9, 0xE8, 0x5A, 0xEE, 0x87, + 0xE2, 0x7D, 0x17, 0x4A, 0xF1, 0x1F, 0x86, 0x75, 0x8D, 0x27, 0xC4, 0x3E, 0x1D, 0xD7, 0x74, 0xF8, + 0x75, 0x5D, 0x0F, 0x5E, 0xD0, 0xB5, 0x08, 0x75, 0x6D, 0x17, 0x58, 0xB4, 0xB8, 0x8C, 0x3D, 0xBD, + 0xCD, 0xA5, 0xD4, 0x4C, 0xD1, 0x4B, 0x13, 0xA3, 0x2B, 0x2B, 0xA3, 0x15, 0x60, 0x41, 0x04, 0x83, + 0x40, 0x1C, 0x97, 0x8C, 0xFE, 0x2A, 0x78, 0x0B, 0xE1, 0xEE, 0xBF, 0xF0, 0xCB, 0xC2, 0xDE, 0x2E, + 0xD7, 0x57, 0x48, 0xD6, 0xFE, 0x30, 0x78, 0xC6, 0x5F, 0x00, 0xFC, 0x3D, 0xB3, 0xFE, 0xCE, 0xBB, + 0xBD, 0x4D, 0x63, 0x54, 0x87, 0x48, 0xBC, 0xD4, 0x9E, 0x19, 0xA6, 0x86, 0x27, 0x8A, 0xCE, 0x2F, + 0xB2, 0xE9, 0x37, 0x4A, 0xB7, 0x17, 0x4D, 0x04, 0x0D, 0x3B, 0xD9, 0xDA, 0x2C, 0x86, 0xE6, 0xF6, + 0xD6, 0x0B, 0x80, 0x0F, 0x42, 0xA0, 0x0A, 0x97, 0xD7, 0xD6, 0x3A, 0x55, 0x85, 0xE6, 0xA7, 0xA9, + 0x5D, 0xDA, 0xE9, 0xFA, 0x6E, 0x9B, 0x69, 0x25, 0xF5, 0xFD, 0xFD, 0xED, 0xC4, 0x76, 0x76, 0x56, + 0x30, 0x43, 0x19, 0x79, 0x66, 0x9A, 0x57, 0x21, 0x12, 0x34, 0x44, 0x66, 0x66, 0x62, 0x00, 0x00, + 0x92, 0x40, 0x14, 0x01, 0xC9, 0xFC, 0x33, 0xF8, 0x8D, 0xE0, 0xFF, 0x00, 0x8B, 0xFF, 0x00, 0x0F, + 0x3C, 0x11, 0xF1, 0x4F, 0xE1, 0xF6, 0xA5, 0x71, 0xAC, 0x78, 0x1F, 0xE2, 0x1F, 0x85, 0xAC, 0x7C, + 0x63, 0xE1, 0x4D, 0x4A, 0xF3, 0x45, 0xBE, 0xF0, 0xD6, 0xA1, 0x73, 0x61, 0xA8, 0x5B, 0xA4, 0xD6, + 0xC6, 0xEB, 0x4C, 0xBD, 0x86, 0x0B, 0xDB, 0x29, 0xC2, 0x48, 0xAB, 0x25, 0xAD, 0xD4, 0x10, 0xCF, + 0x03, 0x87, 0x8A, 0x58, 0xA3, 0x92, 0x36, 0x45, 0x00, 0xE6, 0x3E, 0x2D, 0xAF, 0x83, 0xBC, 0x33, + 0x63, 0xA3, 0x7C, 0x64, 0xF1, 0x37, 0x83, 0xFC, 0x49, 0xE2, 0xBB, 0xBF, 0x83, 0xB3, 0x5C, 0x6B, + 0x7A, 0x63, 0xF8, 0x45, 0x26, 0xBF, 0xD6, 0xFC, 0x37, 0x67, 0xA8, 0xC2, 0x2C, 0xB5, 0xDD, 0x52, + 0x3D, 0x31, 0x2E, 0x22, 0x17, 0xD1, 0xDB, 0x69, 0xD7, 0x17, 0x77, 0x12, 0xC0, 0x91, 0xDC, 0xDC, + 0xBC, 0x56, 0xF2, 0xAD, 0xA5, 0xB5, 0xC5, 0xD3, 0x41, 0x04, 0xC0, 0x1A, 0x1F, 0x0D, 0xBC, 0x21, + 0xF0, 0xC7, 0x4B, 0x97, 0xC7, 0x1F, 0x12, 0xFE, 0x19, 0x0D, 0x36, 0xF6, 0x1F, 0xDA, 0x1B, 0xC4, + 0xBA, 0x7F, 0xC6, 0x4F, 0x15, 0x78, 0xAB, 0x45, 0xF1, 0x14, 0xDE, 0x24, 0xD1, 0x3C, 0x7B, 0x7C, + 0x7C, 0x27, 0xA3, 0x68, 0x9A, 0x6E, 0xB1, 0x65, 0x29, 0x9E, 0x5B, 0x64, 0x81, 0xF4, 0x3F, 0x0B, + 0xF8, 0x6E, 0x24, 0x16, 0x9E, 0x5C, 0x0E, 0xB6, 0xEB, 0x38, 0x56, 0x92, 0x79, 0x65, 0x94, 0x03, + 0x8C, 0xBC, 0x97, 0xE1, 0x47, 0xC3, 0xFF, 0x00, 0xDA, 0x12, 0xC6, 0x76, 0x7B, 0xAB, 0xDF, 0x8D, + 0xDF, 0xB4, 0x87, 0x84, 0xED, 0xFC, 0x3D, 0x06, 0x95, 0x6A, 0xD0, 0x6A, 0x3A, 0xA2, 0xF8, 0x5F, + 0xE1, 0xC2, 0x5E, 0xDC, 0xC9, 0xA9, 0x3C, 0x1F, 0x2C, 0xD6, 0xFA, 0x35, 0x85, 0xE7, 0x8D, 0x96, + 0x19, 0x67, 0x25, 0xE2, 0x8E, 0xFB, 0xC4, 0x9A, 0x74, 0x58, 0x59, 0x35, 0x14, 0x12, 0x00, 0x79, + 0x67, 0x83, 0xBE, 0x2F, 0xFE, 0xCE, 0x1F, 0x02, 0xFC, 0x7F, 0xF1, 0xBB, 0xE0, 0xCE, 0x90, 0xFE, + 0x24, 0xF0, 0x9C, 0x9E, 0x1E, 0xF1, 0x5B, 0x7C, 0x63, 0xF1, 0xA4, 0x6F, 0xE1, 0x6B, 0xA9, 0x3C, + 0x1B, 0x65, 0xAD, 0x7C, 0x42, 0xD6, 0xAD, 0x6E, 0x35, 0x38, 0xF4, 0x98, 0x2D, 0x61, 0x32, 0xA7, + 0xDA, 0xF5, 0x6F, 0x14, 0xD8, 0x5E, 0xC9, 0x37, 0x90, 0xB6, 0xF7, 0x97, 0xBA, 0xCE, 0xAC, 0xD0, + 0x5C, 0xDD, 0xDD, 0x69, 0xDA, 0xE4, 0x7A, 0x50, 0x07, 0xB3, 0xFC, 0x6D, 0xD1, 0xBE, 0x14, 0xF8, + 0x8A, 0xCF, 0xE1, 0x7E, 0x8B, 0xF1, 0x66, 0x69, 0x1F, 0x4B, 0x9B, 0xE3, 0x67, 0x85, 0xF5, 0xAF, + 0x05, 0xE8, 0xED, 0x65, 0x2E, 0xA3, 0xA5, 0x6B, 0xBE, 0x2A, 0xD0, 0xEF, 0xBF, 0xB5, 0x7C, 0x2E, + 0x97, 0x90, 0xAC, 0x12, 0xC6, 0x56, 0xDF, 0x50, 0xD2, 0xAD, 0x2F, 0xA1, 0x79, 0x44, 0x6B, 0x15, + 0xD5, 0x8D, 0x94, 0xCB, 0x22, 0x49, 0x14, 0x46, 0x80, 0x3E, 0x7F, 0xF8, 0x53, 0xF1, 0xEB, 0xF6, + 0x7D, 0xFD, 0xA5, 0x3E, 0x33, 0xFC, 0x3A, 0xF1, 0xC7, 0x86, 0xF4, 0x4F, 0x88, 0x3A, 0x37, 0x8D, + 0x3C, 0x2B, 0xE0, 0xAF, 0x1A, 0x78, 0x7F, 0xE1, 0x8F, 0x8B, 0x3C, 0x49, 0xE1, 0x94, 0xF0, 0xF6, + 0x8B, 0xE2, 0xED, 0x2E, 0xEE, 0xFF, 0x00, 0x45, 0x3E, 0x2D, 0xD1, 0x63, 0x9D, 0x5A, 0x49, 0xA2, + 0x9D, 0x23, 0xB2, 0xF8, 0x7F, 0xA8, 0xCB, 0xA7, 0x5E, 0x0B, 0x39, 0xD1, 0xA6, 0x86, 0xDE, 0x58, + 0x06, 0xA3, 0xA0, 0x6B, 0x76, 0x3A, 0x00, 0x07, 0xDB, 0x5A, 0xD6, 0xB5, 0xA3, 0x78, 0x6B, 0x45, + 0xD5, 0xBC, 0x45, 0xE2, 0x2D, 0x5B, 0x4B, 0xF0, 0xFF, 0x00, 0x87, 0xBC, 0x3F, 0xA5, 0xDC, 0x6B, + 0x5A, 0xEE, 0xBB, 0xAD, 0x5F, 0xC3, 0xA4, 0xE8, 0xBA, 0x25, 0x95, 0xA4, 0x2D, 0x2D, 0xD5, 0xDD, + 0xDD, 0xD4, 0xAC, 0xB1, 0x43, 0x04, 0x51, 0x46, 0xEE, 0xF2, 0x3B, 0x2A, 0xA2, 0xAB, 0x31, 0x20, + 0x0E, 0x00, 0x38, 0xCD, 0x3B, 0xC4, 0xDE, 0x1C, 0xF8, 0xC9, 0xF0, 0xD2, 0xF7, 0x5B, 0xF8, 0x45, + 0xF1, 0x3F, 0x4C, 0xBA, 0xD1, 0x7C, 0x5D, 0xA3, 0xEA, 0x5A, 0x47, 0x85, 0x3E, 0x2A, 0xFC, 0x39, + 0xBE, 0xD2, 0x3C, 0x65, 0x69, 0xA5, 0xDD, 0x46, 0xF3, 0x59, 0xBE, 0xA1, 0xA6, 0x49, 0x2C, 0x77, + 0x5A, 0x75, 0xCC, 0xD6, 0xB7, 0x50, 0x4A, 0x02, 0x4D, 0x14, 0xF0, 0xF9, 0x90, 0x14, 0x92, 0x37, + 0x50, 0xC8, 0x40, 0x38, 0x18, 0xFC, 0x4D, 0xFB, 0x34, 0xFE, 0xC9, 0xDE, 0x15, 0xF0, 0x7F, 0xC3, + 0x9D, 0x6B, 0xE2, 0x37, 0xC3, 0x4F, 0x83, 0x9A, 0x34, 0xB6, 0xF7, 0x52, 0x78, 0x6A, 0xD3, 0xE2, + 0x77, 0xC5, 0x2B, 0x5D, 0x33, 0xC4, 0x7E, 0x30, 0x98, 0x4E, 0x25, 0xD5, 0xB5, 0x4B, 0xAD, 0x53, + 0x58, 0xBC, 0x3A, 0x86, 0xB3, 0xA8, 0x4D, 0x75, 0x7C, 0x6E, 0x2F, 0x75, 0x0B, 0x99, 0xAE, 0x6E, + 0xAE, 0x6E, 0x6E, 0xE4, 0xB8, 0xB9, 0x9A, 0x59, 0xAE, 0x1E, 0x49, 0x00, 0x33, 0xBF, 0x67, 0xDF, + 0xDA, 0xFB, 0xF6, 0x70, 0xFD, 0xA7, 0xBC, 0x2B, 0xF0, 0xDB, 0xC4, 0xFF, 0x00, 0x06, 0xBE, 0x2D, + 0x78, 0x1B, 0xC5, 0x32, 0xFC, 0x52, 0xF8, 0x70, 0xBF, 0x14, 0xFC, 0x31, 0xE1, 0x0B, 0x3F, 0x15, + 0x69, 0x97, 0x5E, 0x39, 0x8F, 0x49, 0x8E, 0xCF, 0x47, 0xB8, 0xD4, 0x5A, 0xEB, 0x4B, 0x86, 0xE2, + 0x49, 0x23, 0x92, 0xC4, 0x78, 0xC3, 0xC3, 0x11, 0xDE, 0x28, 0xDC, 0x2D, 0xA5, 0xD4, 0xEC, 0x63, + 0x90, 0x83, 0x3C, 0x7B, 0xC0, 0x3D, 0xEF, 0xC4, 0x3E, 0x24, 0xF0, 0xE7, 0x84, 0x34, 0x2D, 0x57, + 0xC4, 0xFE, 0x2C, 0xD7, 0xB4, 0x4F, 0x0B, 0xF8, 0x67, 0x40, 0xB0, 0x93, 0x53, 0xD7, 0x3C, 0x43, + 0xE2, 0x2D, 0x52, 0xDF, 0x44, 0xD0, 0xB4, 0x5B, 0x58, 0x57, 0x74, 0xB7, 0x17, 0x77, 0x73, 0x32, + 0x45, 0x0C, 0x48, 0xB8, 0x2C, 0xEE, 0xCA, 0xA0, 0x72, 0x48, 0x14, 0x01, 0xE4, 0xFF, 0x00, 0x01, + 0x7F, 0x69, 0x0F, 0x82, 0xBF, 0xB4, 0xC7, 0x86, 0x75, 0x5F, 0x15, 0xFC, 0x15, 0xF1, 0xFF, 0x00, + 0x86, 0xBC, 0x75, 0xA4, 0xE8, 0x1E, 0x24, 0xD4, 0x7C, 0x27, 0xAE, 0x8D, 0x07, 0x5B, 0xB2, 0xD5, + 0xEE, 0x34, 0x5B, 0xDD, 0x37, 0x51, 0xB9, 0xB2, 0x96, 0x3B, 0xA4, 0xB7, 0x96, 0x41, 0x18, 0x92, + 0x4D, 0x3E, 0x77, 0x88, 0xB1, 0x1B, 0xE2, 0x28, 0xE0, 0x61, 0xB8, 0x00, 0xF2, 0xEF, 0x88, 0x3F, + 0xB7, 0xE7, 0xEC, 0x75, 0xF0, 0xBF, 0xC6, 0xDE, 0x13, 0xF8, 0x77, 0xE2, 0xEF, 0xDA, 0x1B, 0xE1, + 0x26, 0x9F, 0xE2, 0xBF, 0x14, 0x7C, 0x47, 0xD4, 0x7E, 0x15, 0xDC, 0x69, 0x67, 0xE2, 0x16, 0x8B, + 0x1C, 0xBE, 0x0C, 0xD5, 0x74, 0xAD, 0x03, 0x58, 0xD5, 0x6F, 0x97, 0x5F, 0x47, 0xBA, 0x46, 0xB1, + 0x89, 0x22, 0xF0, 0xB6, 0xA1, 0x6C, 0x59, 0xD7, 0x3F, 0x6A, 0x96, 0xCE, 0xDF, 0x68, 0x69, 0x86, + 0x00, 0x24, 0xF8, 0xD5, 0xFB, 0x7A, 0xFE, 0xC8, 0x9F, 0x01, 0x3E, 0x11, 0xF8, 0xBF, 0xE3, 0x2F, + 0x8E, 0x3E, 0x3D, 0xFC, 0x2D, 0x7F, 0x0D, 0x78, 0x4B, 0xE0, 0xF6, 0xAD, 0xF1, 0xCE, 0xDB, 0x45, + 0xD0, 0xBE, 0x20, 0x68, 0x7A, 0x87, 0x8C, 0xFC, 0x6F, 0xE1, 0xED, 0x1E, 0xD2, 0xF6, 0x79, 0x67, + 0xF0, 0xDE, 0x96, 0xD7, 0x69, 0x26, 0xA2, 0xF3, 0x1D, 0x1F, 0x50, 0x82, 0xDD, 0x62, 0xCA, 0xCB, + 0x3C, 0x2F, 0x12, 0xB6, 0xE5, 0x6D, 0xA0, 0x1E, 0xE1, 0xF0, 0xFB, 0xE3, 0x67, 0xC1, 0xCF, 0x8B, + 0x17, 0xDA, 0xF6, 0x97, 0xF0, 0xB7, 0xE2, 0xAF, 0xC3, 0xAF, 0x88, 0xDA, 0x8F, 0x85, 0x6D, 0xAD, + 0x2F, 0x3C, 0x49, 0x61, 0xE0, 0x6F, 0x19, 0x69, 0xDE, 0x29, 0xBA, 0xD0, 0x60, 0xBE, 0xB9, 0xBC, + 0xB7, 0xB1, 0x9E, 0xEE, 0x3B, 0x69, 0x5C, 0xC5, 0x14, 0xD3, 0xE8, 0xBA, 0xBC, 0x51, 0x3B, 0x00, + 0xAE, 0xF6, 0x37, 0x6A, 0xA4, 0x98, 0x5C, 0x28, 0x07, 0x59, 0xE2, 0xCF, 0x18, 0xF8, 0x43, 0xC0, + 0x3A, 0x05, 0xDF, 0x8A, 0x7C, 0x73, 0xE2, 0xAF, 0x0D, 0x78, 0x2B, 0xC2, 0xFA, 0x7C, 0xD6, 0xD6, + 0xD7, 0xDE, 0x23, 0xF1, 0x6E, 0xB9, 0x6B, 0xE1, 0xBD, 0x02, 0xC6, 0x4B, 0xCB, 0xA8, 0xED, 0xAC, + 0xE3, 0x9A, 0xF2, 0xE1, 0xD2, 0x14, 0x69, 0x6E, 0x6E, 0x2D, 0xE1, 0x8C, 0x33, 0x02, 0xF2, 0x4B, + 0x1A, 0x2E, 0x59, 0x80, 0x20, 0x1E, 0x63, 0xFB, 0x38, 0x7E, 0xD1, 0x9F, 0x08, 0x3F, 0x6A, 0xFF, + 0x00, 0x83, 0x7E, 0x04, 0xF8, 0xEB, 0xF0, 0x3B, 0xC5, 0xDA, 0x5F, 0x8C, 0x7C, 0x01, 0xE3, 0xFF, + 0x00, 0x0C, 0xE9, 0x7E, 0x25, 0xD3, 0x6E, 0x74, 0xFB, 0xFB, 0x5B, 0xCB, 0xED, 0x1B, 0xFB, 0x53, + 0x4A, 0xB5, 0xD4, 0x22, 0xD3, 0x75, 0x48, 0xA0, 0x96, 0x45, 0xB5, 0xBF, 0x8A, 0xDF, 0x51, 0xB4, + 0xF3, 0xAD, 0xD9, 0xCB, 0x44, 0xCD, 0xB4, 0xFB, 0x80, 0x79, 0x26, 0xB5, 0xFF, 0x00, 0x05, 0x0C, + 0xFD, 0x89, 0xFC, 0x3F, 0xE3, 0x5F, 0x0F, 0xF8, 0x0B, 0x51, 0xFD, 0xA6, 0xBE, 0x0A, 0xC7, 0xAD, + 0x78, 0x82, 0xD3, 0x55, 0xB9, 0x8A, 0x68, 0xFE, 0x25, 0xE8, 0x6D, 0xA5, 0x69, 0x27, 0x46, 0x6B, + 0x75, 0xBA, 0x82, 0xFE, 0x7F, 0xB5, 0x0F, 0x22, 0x56, 0x37, 0xB1, 0x88, 0xD1, 0x86, 0x5B, 0xCB, + 0x98, 0x71, 0xB0, 0xD0, 0x06, 0xCF, 0xC4, 0xFF, 0x00, 0xDB, 0xA3, 0xF6, 0x46, 0xF8, 0x43, 0xA7, + 0xE8, 0xB7, 0x9E, 0x31, 0xFD, 0xA0, 0xFE, 0x10, 0x5B, 0xDC, 0x6B, 0xDE, 0x25, 0xF0, 0x57, 0x86, + 0x74, 0xDD, 0x0E, 0xD3, 0xE2, 0x5E, 0x81, 0x27, 0x88, 0xA4, 0x3E, 0x3E, 0xD6, 0x74, 0xBD, 0x3B, + 0xC3, 0x97, 0xE6, 0xC5, 0xEF, 0x12, 0x51, 0x62, 0xE7, 0xC4, 0x7A, 0x65, 0xD3, 0xCF, 0xB7, 0x6A, + 0xDA, 0x33, 0x5C, 0x0D, 0xC8, 0x06, 0xE0, 0x0F, 0x71, 0xF8, 0x73, 0xF1, 0x67, 0xE1, 0x6F, 0xC5, + 0xFD, 0x22, 0x6D, 0x7B, 0xE1, 0x4F, 0xC4, 0x4F, 0x04, 0x7C, 0x48, 0xD0, 0xED, 0xA6, 0xFB, 0x2D, + 0xC6, 0xAB, 0xE0, 0x6F, 0x13, 0xD9, 0x78, 0xA3, 0x4F, 0xB6, 0x90, 0x12, 0x04, 0x72, 0x4B, 0x6D, + 0x23, 0xAA, 0xB7, 0xEE, 0xDF, 0x82, 0x41, 0xF9, 0x4F, 0xA5, 0x00, 0x71, 0x9F, 0xB4, 0x9F, 0xED, + 0x1F, 0xF0, 0x8B, 0xF6, 0x4B, 0xF8, 0x2B, 0xF1, 0x07, 0xE3, 0xD7, 0xC6, 0xDF, 0x14, 0xE9, 0xFE, + 0x15, 0xF0, 0x1F, 0xC3, 0x9F, 0x07, 0x6B, 0x3E, 0x30, 0xBE, 0x59, 0xEF, 0xAD, 0x2D, 0xB5, 0xBF, + 0x11, 0xAE, 0x89, 0xA2, 0xDD, 0xEA, 0x97, 0x3A, 0x5E, 0x87, 0x6B, 0x3C, 0xD1, 0x0B, 0xDD, 0x4A, + 0x4B, 0x4D, 0x26, 0xF9, 0xA1, 0xB5, 0x8D, 0xB7, 0xC8, 0x62, 0x60, 0x30, 0x14, 0x95, 0x00, 0xF4, + 0x5F, 0x0B, 0x7C, 0x42, 0xF0, 0x17, 0x8D, 0xFC, 0x23, 0x17, 0x8F, 0xBC, 0x17, 0xE3, 0x4F, 0x0A, + 0x78, 0xB7, 0xC0, 0xB3, 0xA5, 0xEB, 0xDB, 0xF8, 0xCB, 0xC3, 0x3A, 0xFD, 0xA6, 0xB9, 0xE1, 0x5B, + 0x85, 0xD3, 0xAE, 0x65, 0xB7, 0xBF, 0x68, 0xB5, 0x08, 0x5D, 0xA0, 0x65, 0x86, 0x7B, 0x4B, 0xA8, + 0xDC, 0xAB, 0x10, 0xAD, 0x14, 0x8A, 0x70, 0x54, 0xE0, 0x03, 0xE5, 0x9B, 0xAF, 0xF8, 0x28, 0xC7, + 0xEC, 0x39, 0x65, 0xE3, 0x2D, 0x23, 0xC1, 0x12, 0xFE, 0xD4, 0x7F, 0x03, 0xBE, 0xDF, 0xAB, 0xF8, + 0x4B, 0x53, 0xF1, 0x8C, 0x3A, 0xAC, 0x7F, 0x14, 0x34, 0x26, 0xF0, 0xDD, 0xA5, 0xAE, 0x95, 0x77, + 0x63, 0x6F, 0x3C, 0x37, 0x17, 0x9F, 0x6A, 0xDB, 0x1D, 0xC3, 0xB6, 0xAF, 0x6E, 0xD1, 0xC6, 0x47, + 0xCE, 0x91, 0x5C, 0x30, 0x20, 0x44, 0x72, 0x01, 0xF4, 0xEF, 0xC4, 0x4F, 0x89, 0x3E, 0x0B, 0xF8, + 0x51, 0xE1, 0xFD, 0x3F, 0xC4, 0xFE, 0x3D, 0xD5, 0xCE, 0x85, 0xA1, 0xEA, 0x7E, 0x39, 0xF0, 0xBF, + 0xC3, 0x5B, 0x0B, 0xC4, 0xD3, 0x2E, 0xF5, 0x53, 0x3E, 0xB7, 0xE3, 0x3F, 0x12, 0xD8, 0x78, 0x7F, + 0xC3, 0x56, 0x5E, 0x55, 0xB4, 0x52, 0x48, 0xBF, 0x69, 0xD5, 0xF5, 0xDD, 0x2A, 0xDB, 0xCD, 0x65, + 0x11, 0x45, 0xE7, 0xF9, 0xB3, 0x3C, 0x51, 0x47, 0x24, 0x88, 0x01, 0xDC, 0xD0, 0x01, 0x40, 0x05, + 0x00, 0x58, 0xA0, 0x02, 0x80, 0x0A, 0x00, 0x28, 0x00, 0xA0, 0x02, 0x80, 0x3F, 0xCF, 0xCF, 0xFE, + 0x0E, 0x7D, 0xFF, 0x00, 0x94, 0xE7, 0xFF, 0x00, 0xC1, 0x21, 0xFF, 0x00, 0xEC, 0x15, 0xF0, 0xF7, + 0xFF, 0x00, 0x56, 0xF5, 0xCD, 0x76, 0x65, 0x9F, 0xF2, 0x30, 0xC3, 0xFF, 0x00, 0x8E, 0x1F, 0xFA, + 0x52, 0x39, 0xF1, 0x3F, 0xEE, 0xB5, 0x3F, 0xC2, 0xFF, 0x00, 0x23, 0xED, 0x4A, 0xFD, 0x4C, 0xF8, + 0xE0, 0xA0, 0x02, 0x80, 0x0A, 0x00, 0xFD, 0x82, 0xFF, 0x00, 0x82, 0x21, 0x7F, 0xC8, 0x89, 0xFB, + 0x75, 0xFF, 0x00, 0xD9, 0xF3, 0xC1, 0xFF, 0x00, 0xAA, 0x1B, 0xE1, 0x95, 0x7E, 0x75, 0xC4, 0x1F, + 0xF2, 0x34, 0x9F, 0xA4, 0x7F, 0xF4, 0x94, 0x7D, 0x46, 0x57, 0xFE, 0xE5, 0x1F, 0x9F, 0xE6, 0x7E, + 0xDB, 0x57, 0x8A, 0x7A, 0x21, 0x40, 0x05, 0x00, 0x14, 0x00, 0x50, 0x01, 0x40, 0x05, 0x00, 0x14, + 0x00, 0x50, 0x02, 0x1F, 0xBA, 0x7F, 0xDD, 0xFE, 0x94, 0x01, 0x05, 0x00, 0x14, 0x00, 0x50, 0x01, + 0x40, 0x05, 0x00, 0x14, 0x00, 0x50, 0x01, 0x40, 0x05, 0x00, 0x14, 0x00, 0x50, 0x01, 0x40, 0x1F, + 0x20, 0x6B, 0xFE, 0x13, 0xF1, 0x27, 0xEC, 0xD7, 0xE2, 0x5D, 0x67, 0xE2, 0x57, 0xC2, 0x4F, 0x0D, + 0x6A, 0xDE, 0x29, 0xF8, 0x27, 0xE2, 0xED, 0x7E, 0xEB, 0xC4, 0xFF, 0x00, 0x1B, 0x3E, 0x03, 0xF8, + 0x3B, 0x47, 0x1A, 0x8E, 0xBD, 0xE1, 0x1D, 0x57, 0x55, 0xBF, 0x6B, 0x9D, 0x67, 0xE2, 0x2F, 0x80, + 0xB4, 0xD8, 0x54, 0x49, 0x3D, 0xC4, 0xF7, 0x17, 0x77, 0xB7, 0xBA, 0xEE, 0x87, 0x08, 0x92, 0x4D, + 0x51, 0xCC, 0xFA, 0xA6, 0x99, 0x13, 0x6B, 0x4D, 0x7B, 0x63, 0xE3, 0x10, 0x0D, 0x3F, 0x0E, 0xC5, + 0x63, 0xF1, 0x13, 0xF6, 0x90, 0xF8, 0x7F, 0xF1, 0xDB, 0xC1, 0xD7, 0x1A, 0x37, 0x8E, 0xBE, 0x13, + 0xEA, 0xDF, 0xB2, 0x9D, 0xC4, 0x5F, 0x0E, 0xBE, 0x29, 0xF8, 0x6F, 0x51, 0xB4, 0xF1, 0x37, 0x83, + 0xF5, 0x18, 0x3C, 0x4B, 0xAE, 0xE9, 0xBA, 0x87, 0x99, 0xA1, 0x6A, 0x90, 0xBB, 0xC5, 0x25, 0xB6, + 0xA1, 0x67, 0xA6, 0xE8, 0xF7, 0x26, 0x5B, 0x76, 0x31, 0x5C, 0xC7, 0x69, 0x60, 0xE5, 0x9C, 0x41, + 0x09, 0x40, 0x0A, 0x7F, 0xB1, 0x17, 0x82, 0xFC, 0x67, 0xF0, 0xF3, 0xE0, 0x6E, 0xB3, 0xE1, 0x0F, + 0x1C, 0x69, 0x1A, 0xBE, 0x81, 0x75, 0xA4, 0xFE, 0xD2, 0xBF, 0x1B, 0x9B, 0xC1, 0xFA, 0x1E, 0xAF, + 0x2B, 0x38, 0xD1, 0xFC, 0x1B, 0x73, 0xF1, 0xA7, 0xC5, 0x53, 0xF8, 0x02, 0xD7, 0x4E, 0x8C, 0xB3, + 0x2C, 0x1A, 0x5C, 0x7E, 0x19, 0x9F, 0xC3, 0xA9, 0x61, 0x6D, 0x1E, 0xD8, 0xAD, 0xEC, 0x96, 0xCA, + 0x08, 0x92, 0x38, 0xE2, 0x48, 0xD0, 0x03, 0xC9, 0xFE, 0x29, 0xFC, 0x18, 0xF8, 0x83, 0xFB, 0x4E, + 0xF8, 0xF3, 0xE3, 0x86, 0xBB, 0x1C, 0x96, 0x9F, 0x0E, 0x17, 0xE1, 0x07, 0x85, 0xED, 0x7E, 0x16, + 0x7E, 0xCB, 0xBA, 0xAF, 0x8B, 0x7C, 0x1F, 0x7D, 0x7B, 0x63, 0xAC, 0x78, 0xB6, 0xDB, 0x56, 0xF0, + 0xFF, 0x00, 0x8B, 0xEF, 0xBC, 0x69, 0xAB, 0xDB, 0x9B, 0x88, 0x27, 0xBA, 0xD0, 0xA2, 0xD7, 0xFC, + 0x2B, 0xE0, 0x7B, 0x0B, 0x78, 0x2C, 0x1B, 0x4C, 0xBA, 0x3F, 0xD8, 0xBE, 0x23, 0x9D, 0x2F, 0xE4, + 0x17, 0xDA, 0x5C, 0xFA, 0x50, 0x07, 0xD9, 0xBF, 0x09, 0x7C, 0x6B, 0xAA, 0x7C, 0x46, 0xF8, 0x67, + 0xE0, 0x6F, 0x1B, 0xEB, 0xDE, 0x0A, 0xD7, 0xFE, 0x1B, 0xF8, 0x8B, 0xC4, 0x7E, 0x1B, 0xB5, 0xD4, + 0x3C, 0x4B, 0xF0, 0xF3, 0xC5, 0x11, 0x15, 0xD7, 0xBC, 0x0B, 0xAA, 0x18, 0xC2, 0xEA, 0x5A, 0x3D, + 0xCC, 0xBB, 0x12, 0x3B, 0x83, 0x6D, 0x72, 0x97, 0x10, 0x8B, 0x98, 0x41, 0x82, 0xE1, 0x63, 0x59, + 0xE0, 0x67, 0x86, 0x58, 0xDD, 0x80, 0x3C, 0x57, 0xF6, 0xB1, 0xD1, 0x3C, 0x4F, 0xF1, 0x2F, 0xC2, + 0x5E, 0x16, 0xFD, 0x9E, 0x3C, 0x35, 0xE1, 0xEB, 0x9D, 0x43, 0x4B, 0xF8, 0xFB, 0xE2, 0x41, 0xE0, + 0xEF, 0x8B, 0x1E, 0x26, 0xB8, 0xD1, 0x25, 0xD4, 0xFC, 0x2D, 0xE0, 0x5F, 0x00, 0x5A, 0xC0, 0x6E, + 0x7C, 0x61, 0x35, 0xF6, 0x5A, 0x3B, 0x69, 0x67, 0xD4, 0x2D, 0x62, 0x8F, 0x44, 0xB4, 0xB6, 0x91, + 0xE5, 0xCD, 0xC6, 0xB7, 0x15, 0xDC, 0xB6, 0x57, 0xD6, 0x3A, 0x76, 0xA1, 0x01, 0x00, 0x9F, 0xE0, + 0x46, 0x8D, 0xE2, 0xDF, 0x86, 0x3F, 0x11, 0xBE, 0x37, 0x7C, 0x1C, 0xD5, 0x74, 0xFB, 0xCD, 0x43, + 0xE1, 0xFC, 0x9E, 0x29, 0xB9, 0xF8, 0xF5, 0xF0, 0x8F, 0xC7, 0x0B, 0xA3, 0x5C, 0xC1, 0x6F, 0x25, + 0xB7, 0x8F, 0x75, 0xAD, 0x4B, 0x50, 0xF1, 0x37, 0x85, 0xF5, 0x2B, 0xDC, 0xB5, 0xAC, 0xB7, 0xFA, + 0x76, 0xBC, 0x75, 0x69, 0xE1, 0x68, 0x92, 0xD1, 0x7F, 0xB2, 0xF5, 0x7D, 0x0A, 0x03, 0x14, 0xF7, + 0x16, 0x57, 0xB7, 0xB7, 0x60, 0x1F, 0x53, 0x0E, 0x31, 0x8E, 0x31, 0x8C, 0x63, 0x8C, 0x63, 0xA6, + 0x3F, 0x21, 0x40, 0x1F, 0x28, 0x6B, 0x3A, 0x07, 0x88, 0x3F, 0x67, 0x3F, 0x10, 0x6A, 0xFE, 0x3C, + 0xF8, 0x7D, 0xA3, 0x6B, 0x3E, 0x28, 0xF8, 0x25, 0xE2, 0x9D, 0x6E, 0x7F, 0x10, 0x7C, 0x54, 0xF8, + 0x4D, 0xE1, 0xED, 0x3E, 0xEB, 0x5E, 0xF1, 0x27, 0x80, 0xB5, 0x4D, 0x4E, 0xFD, 0xE7, 0xD4, 0xBC, + 0x65, 0xE0, 0xAD, 0x2E, 0xDA, 0xDE, 0x5B, 0x9B, 0xBF, 0xB4, 0xDD, 0x5F, 0x4D, 0x71, 0xAA, 0xE9, + 0x28, 0xC3, 0xCD, 0x0B, 0x36, 0xA1, 0x63, 0x19, 0xBE, 0x37, 0x56, 0x9A, 0xE8, 0x07, 0x21, 0xA2, + 0x78, 0xA3, 0x4C, 0xD2, 0x7F, 0x6C, 0xCB, 0x2F, 0x88, 0x30, 0xDE, 0x69, 0xFE, 0x22, 0xF8, 0x59, + 0xFB, 0x5B, 0x7E, 0xCB, 0x9E, 0x0E, 0xF0, 0xB7, 0xC1, 0x9F, 0x89, 0x9E, 0x18, 0xD5, 0xAD, 0xB5, + 0xAF, 0x04, 0x5E, 0xEA, 0xFE, 0x02, 0xD5, 0xFC, 0x53, 0xAD, 0x5C, 0xE9, 0xB3, 0x5E, 0xAB, 0x88, + 0xDA, 0x5D, 0x5F, 0x46, 0xF8, 0x87, 0x69, 0x7F, 0xA5, 0x35, 0xA1, 0xBA, 0x4B, 0xAB, 0x7F, 0x0E, + 0xF8, 0x91, 0xE5, 0x6B, 0x61, 0x6B, 0x69, 0xFD, 0xA0, 0x01, 0xF5, 0x9F, 0x8E, 0x3C, 0x0D, 0xE1, + 0x2F, 0x89, 0x3E, 0x0C, 0xF1, 0x97, 0xC3, 0xDF, 0x1C, 0xE8, 0x36, 0x1E, 0x24, 0xF0, 0x67, 0xC4, + 0x1F, 0x09, 0xDF, 0xF8, 0x17, 0xC6, 0x7E, 0x1F, 0xD4, 0x23, 0x63, 0x63, 0xE2, 0x2D, 0x23, 0x53, + 0xB4, 0x96, 0xDA, 0xFF, 0x00, 0x4F, 0xB8, 0xDA, 0x55, 0x8C, 0x52, 0xC1, 0x75, 0x71, 0x19, 0x01, + 0x94, 0xE2, 0x46, 0xC1, 0x04, 0xE6, 0x80, 0x3F, 0x28, 0xFF, 0x00, 0x62, 0x8F, 0xD9, 0x33, 0xC4, + 0xBE, 0x1B, 0xF8, 0xD7, 0x63, 0xAF, 0x7C, 0x52, 0xF1, 0x0F, 0xED, 0x57, 0xE2, 0x79, 0xBF, 0x63, + 0xCF, 0x0C, 0xEA, 0x1F, 0x07, 0xBC, 0x21, 0xAC, 0x7C, 0x7D, 0xFD, 0xA2, 0x7E, 0x20, 0x7C, 0x5C, + 0xD0, 0x7E, 0x30, 0x78, 0xA7, 0x53, 0xB9, 0xBC, 0xB7, 0xFF, 0x00, 0x85, 0x91, 0x3D, 0x9E, 0xBF, + 0xAA, 0x5D, 0xE9, 0x97, 0x5A, 0xB1, 0xF0, 0x2A, 0xF8, 0x41, 0xA2, 0xD4, 0x74, 0x38, 0x2C, 0x6C, + 0xED, 0xEE, 0x3C, 0x6B, 0xE3, 0x9D, 0x36, 0x48, 0xCD, 0xCD, 0xBC, 0xB6, 0x3A, 0x10, 0x07, 0xD6, + 0x1F, 0x1C, 0xA1, 0x8F, 0xC7, 0x7F, 0xB5, 0x0F, 0xEC, 0x5B, 0xE0, 0x4F, 0x08, 0x5C, 0x58, 0xDD, + 0xEB, 0xFF, 0x00, 0x03, 0x7E, 0x2C, 0x6B, 0x3F, 0xB4, 0xF7, 0xC5, 0x7D, 0x3A, 0xDE, 0x47, 0x73, + 0xE1, 0x3F, 0x0A, 0xEA, 0x3F, 0x0B, 0xFC, 0x73, 0xE1, 0x0D, 0x1E, 0x6B, 0xE5, 0x85, 0x1F, 0xEC, + 0xF3, 0xEA, 0x5A, 0xE7, 0x8B, 0x47, 0xD8, 0x92, 0xE4, 0x40, 0x97, 0x91, 0xE8, 0x9E, 0x25, 0x78, + 0x64, 0x77, 0xD2, 0xE5, 0x88, 0x80, 0x70, 0xDF, 0x1B, 0xFE, 0x00, 0x7C, 0x60, 0x3F, 0x13, 0x6E, + 0x3E, 0x32, 0x35, 0x95, 0xB7, 0xED, 0x8D, 0xF0, 0xFB, 0xC3, 0x7A, 0xA6, 0x97, 0xE3, 0xFF, 0x00, + 0x0B, 0xFE, 0xCC, 0xBF, 0x10, 0xFC, 0x58, 0xFF, 0x00, 0x0E, 0xB5, 0x6F, 0x05, 0x6A, 0x7A, 0x25, + 0xF8, 0xBC, 0x88, 0xF8, 0x42, 0x08, 0x64, 0xB7, 0xF0, 0x56, 0xBB, 0x79, 0x6F, 0x2D, 0xA6, 0x9D, + 0x7B, 0xA2, 0xC7, 0xE2, 0x8D, 0x3E, 0x0B, 0xBB, 0x4D, 0x5E, 0xDC, 0x4D, 0x2F, 0x8A, 0xAD, 0xA0, + 0x96, 0xD2, 0x4D, 0x00, 0x03, 0xEE, 0x0F, 0x00, 0x78, 0xB6, 0x0F, 0x1D, 0x78, 0x43, 0x46, 0xF1, + 0x44, 0x1E, 0x1A, 0xF1, 0x77, 0x83, 0x86, 0xA3, 0x1C, 0xB0, 0xCD, 0xE1, 0x5F, 0x1D, 0xF8, 0x72, + 0x5F, 0x0A, 0x78, 0xAF, 0x40, 0x9E, 0xD6, 0xE1, 0xED, 0xEE, 0x2D, 0x6E, 0xEC, 0x9F, 0x2B, 0xF2, + 0x4B, 0x6F, 0x20, 0x49, 0x61, 0x79, 0x6D, 0xE7, 0x8F, 0xCB, 0x9E, 0xDE, 0x69, 0xA0, 0x96, 0x29, + 0x64, 0x00, 0xF9, 0x17, 0xF6, 0xBB, 0xD5, 0x3C, 0x76, 0x9E, 0x24, 0xF8, 0x77, 0xA1, 0xC1, 0xE3, + 0xFF, 0x00, 0x8D, 0xFF, 0x00, 0x04, 0xFE, 0x14, 0xCD, 0xA1, 0xEA, 0xDA, 0xBF, 0x88, 0xBE, 0x2D, + 0x7E, 0xCE, 0xBF, 0x02, 0xB4, 0xBF, 0x8F, 0x3F, 0x12, 0x1F, 0x5D, 0x82, 0x7B, 0x28, 0xB4, 0x7D, + 0x02, 0xE6, 0xCF, 0x50, 0xF0, 0xB7, 0x89, 0xAD, 0x6C, 0x34, 0x99, 0x6D, 0xAE, 0xB5, 0x79, 0xE5, + 0x94, 0xE9, 0x02, 0x59, 0x6E, 0x2D, 0xB4, 0xD4, 0x8E, 0xFA, 0xD9, 0x23, 0x9E, 0x0D, 0x40, 0x03, + 0xE2, 0xCF, 0x87, 0xDF, 0x0D, 0x7E, 0x30, 0x7E, 0xCB, 0x7E, 0x3D, 0xFD, 0x9D, 0x3F, 0x68, 0x2F, + 0x13, 0xDF, 0xF8, 0xC3, 0xF6, 0xA6, 0xF8, 0x4B, 0xE0, 0xBF, 0x86, 0xDF, 0x1F, 0x3E, 0x10, 0xFC, + 0x2B, 0xD2, 0xBE, 0x13, 0x7E, 0xCF, 0x3A, 0xBF, 0x81, 0x7F, 0x68, 0x0B, 0x5D, 0x3F, 0xE2, 0xE6, + 0xBB, 0xE0, 0x3F, 0x18, 0xF8, 0x2B, 0x49, 0xF1, 0x0F, 0x85, 0xAE, 0xA5, 0x8E, 0xCA, 0xDF, 0xEC, + 0xD7, 0x5F, 0x0C, 0xBC, 0x57, 0xA1, 0x9B, 0xE9, 0x0E, 0x8B, 0x6F, 0x0B, 0x6A, 0x5E, 0x10, 0x8E, + 0x6B, 0x3B, 0x68, 0xCE, 0xA1, 0x7B, 0x68, 0x01, 0xF6, 0x67, 0xED, 0x71, 0xE0, 0x5F, 0x8B, 0xDE, + 0x1B, 0xB9, 0xF1, 0xA7, 0xED, 0x09, 0xFB, 0x38, 0x5A, 0xE8, 0xF6, 0x3F, 0x17, 0x63, 0xFD, 0x96, + 0x7C, 0x63, 0xF0, 0x72, 0xCE, 0xE6, 0xD7, 0x49, 0xB9, 0xD5, 0xB5, 0x9F, 0x13, 0xF8, 0x92, 0xF6, + 0xEE, 0xC2, 0x5F, 0x85, 0x57, 0x5A, 0xB6, 0x9B, 0x05, 0x95, 0xC2, 0x6A, 0x7A, 0x66, 0x85, 0xAA, + 0xDD, 0x78, 0x96, 0xEB, 0x33, 0xA4, 0xCF, 0x63, 0x0E, 0xAF, 0xAD, 0x9B, 0x58, 0x24, 0xFE, 0xD2, + 0xBC, 0x8E, 0x50, 0x0E, 0x47, 0x53, 0xF0, 0xC7, 0xEC, 0xF1, 0xF0, 0x0F, 0xC4, 0x3F, 0x02, 0xFE, + 0x04, 0x4D, 0xE0, 0xFF, 0x00, 0xDA, 0xCB, 0xC1, 0xBF, 0x0F, 0x7F, 0x66, 0x4F, 0x83, 0x5E, 0x05, + 0xD1, 0xBE, 0x00, 0xEA, 0x5F, 0x08, 0xFC, 0x59, 0xF1, 0xC3, 0x5F, 0xF8, 0x6D, 0xAB, 0xD8, 0xE8, + 0xF7, 0x17, 0x36, 0x16, 0xBE, 0x1D, 0xD7, 0xEC, 0x7C, 0x2D, 0x34, 0xB6, 0x1A, 0xAC, 0x9A, 0x7D, + 0xBF, 0x86, 0x34, 0x33, 0x70, 0x35, 0xE5, 0xBA, 0xFB, 0x54, 0x1A, 0x9A, 0x24, 0x8B, 0x24, 0x6D, + 0x38, 0x70, 0x0F, 0x90, 0x7F, 0x6C, 0xCF, 0xF8, 0x5B, 0x7E, 0x2C, 0xFD, 0xB7, 0xBE, 0x08, 0x5A, + 0x78, 0x53, 0xE0, 0xCF, 0xED, 0x79, 0xE3, 0x1F, 0x03, 0xFC, 0x21, 0xFD, 0xA0, 0x53, 0xC5, 0xFE, + 0x33, 0xBF, 0xF8, 0x51, 0xF1, 0x2F, 0xC4, 0x9A, 0x1E, 0xA2, 0xBA, 0x75, 0xE7, 0xC0, 0xFF, 0x00, + 0x11, 0xE9, 0x73, 0x6B, 0xDE, 0x0D, 0xD3, 0x6F, 0x34, 0xDB, 0x3F, 0x08, 0x45, 0xA7, 0xDB, 0x5D, + 0x78, 0xAF, 0x4F, 0x8A, 0xE6, 0x41, 0xE2, 0x88, 0x75, 0x49, 0xA7, 0xB7, 0xD6, 0x2D, 0xED, 0xF4, + 0x9B, 0x99, 0x26, 0x81, 0x2F, 0x00, 0x3E, 0x93, 0xF8, 0xBB, 0xE2, 0xDF, 0x15, 0x6B, 0x3A, 0xFF, + 0x00, 0x82, 0x74, 0x78, 0xFE, 0x28, 0x7E, 0xD7, 0x7F, 0x00, 0xBE, 0x07, 0xE9, 0xFF, 0x00, 0x06, + 0x74, 0x0B, 0xEF, 0x02, 0x7C, 0x58, 0xF8, 0x5B, 0xFB, 0x33, 0xC5, 0xF1, 0x87, 0xE2, 0xFF, 0x00, + 0xC4, 0xEF, 0x11, 0x1D, 0x43, 0x56, 0xB4, 0xF1, 0x16, 0x87, 0xE3, 0x4B, 0x1F, 0x11, 0x78, 0x0F, + 0xC4, 0x97, 0x5A, 0x3B, 0x69, 0xD6, 0x7A, 0x67, 0x86, 0x6E, 0xA3, 0x6B, 0x8B, 0x0D, 0x3E, 0x5B, + 0xE9, 0x75, 0xAB, 0xF6, 0x59, 0x66, 0x16, 0x52, 0x24, 0x40, 0x1C, 0x17, 0xEC, 0xF5, 0xE1, 0xEF, + 0x8B, 0xDF, 0xB1, 0xDF, 0xC4, 0xBF, 0x86, 0x3A, 0x77, 0xC4, 0x6F, 0x05, 0xF8, 0x83, 0xE3, 0xD6, + 0x97, 0xF1, 0x6B, 0xF6, 0x5F, 0xF8, 0x55, 0xFB, 0x31, 0x78, 0x0F, 0xC7, 0x3F, 0xB3, 0x4F, 0xC1, + 0x7D, 0x6B, 0xC2, 0x9E, 0x13, 0xF0, 0x84, 0x7F, 0x0F, 0x7E, 0x23, 0x78, 0x9E, 0x1B, 0x19, 0x7C, + 0x5F, 0xA1, 0x6B, 0x7A, 0xBD, 0xE5, 0xD7, 0x87, 0x61, 0x8F, 0xC2, 0x9F, 0x16, 0x7C, 0x3D, 0xA8, + 0x3C, 0x93, 0xEA, 0x77, 0x9E, 0x62, 0xF8, 0x53, 0xC6, 0x9C, 0x43, 0x71, 0x1E, 0x97, 0x61, 0xAB, + 0x00, 0x7A, 0xF7, 0xED, 0x91, 0xFB, 0x3A, 0xEB, 0x7E, 0x24, 0xD3, 0xFE, 0x36, 0xAF, 0x85, 0x74, + 0x8B, 0x9D, 0x4B, 0xE1, 0xAF, 0xED, 0x77, 0xF0, 0xF3, 0xC3, 0x7F, 0xB3, 0x7F, 0xED, 0x13, 0xE0, + 0x2F, 0x0E, 0xCF, 0xAA, 0xDC, 0x5F, 0xF8, 0xB2, 0x6F, 0x11, 0xF8, 0xBF, 0x46, 0xF0, 0xCC, 0xFE, + 0x26, 0x1A, 0x6D, 0xB4, 0x4D, 0x0D, 0x9B, 0xC5, 0xE0, 0xFD, 0x7F, 0xC4, 0xD6, 0xBA, 0x9E, 0xB7, + 0x0B, 0xC5, 0x7A, 0xB6, 0x1A, 0x66, 0x85, 0xE6, 0x34, 0xB1, 0x68, 0x56, 0x7F, 0x61, 0x00, 0xEF, + 0xAF, 0x7C, 0x73, 0xF0, 0xEA, 0xF7, 0xF6, 0xAA, 0xD6, 0x87, 0xC4, 0x0F, 0x08, 0xFE, 0xD5, 0xFE, + 0x0C, 0xF1, 0xEF, 0x80, 0x3C, 0x67, 0xA3, 0xFC, 0x36, 0xF8, 0x57, 0x7F, 0xE1, 0xED, 0x67, 0xE3, + 0x1E, 0xAD, 0xFB, 0x3B, 0xFC, 0x5A, 0xD2, 0xF5, 0x6F, 0x0E, 0x58, 0x5C, 0xC5, 0xE2, 0x1B, 0x9D, + 0x13, 0x44, 0x66, 0xF0, 0x52, 0xC7, 0x16, 0xA5, 0xE2, 0x9D, 0x73, 0x4B, 0x9A, 0x5D, 0x5A, 0x16, + 0x96, 0x29, 0x74, 0x4F, 0xB4, 0xCB, 0x24, 0x71, 0x43, 0x6A, 0xF0, 0x80, 0x7E, 0x78, 0xF8, 0xE6, + 0xE7, 0xE2, 0x8F, 0x8D, 0xBF, 0x6D, 0x68, 0xF5, 0xFB, 0x8F, 0x83, 0x9F, 0xB7, 0xA5, 0x9F, 0xC2, + 0x7F, 0x87, 0x5A, 0xA7, 0xC4, 0xAF, 0x0F, 0x78, 0x83, 0x5F, 0xF0, 0x07, 0xC5, 0x2F, 0x14, 0x9F, + 0x1D, 0x78, 0x4E, 0xDE, 0xE3, 0x58, 0xD3, 0x6D, 0xD7, 0xC4, 0x90, 0x78, 0x7E, 0xEB, 0x4D, 0xB0, + 0xD1, 0xCF, 0x86, 0xEE, 0x3F, 0xB3, 0x6F, 0xAE, 0xAC, 0x2D, 0x3C, 0x2F, 0xAE, 0xF8, 0x9B, 0x59, + 0xB9, 0xB1, 0x97, 0x46, 0x3F, 0xD8, 0xB0, 0xCC, 0x6E, 0xED, 0x74, 0xC0, 0x0F, 0x6F, 0xFD, 0xA8, + 0x67, 0xF1, 0x3F, 0xC7, 0xFD, 0x43, 0xE3, 0x4F, 0xC3, 0xEF, 0x88, 0x5E, 0x35, 0xF8, 0xED, 0xF0, + 0x17, 0xE1, 0x07, 0x8A, 0xFC, 0x1D, 0x6F, 0xE0, 0xFF, 0x00, 0x85, 0x5E, 0x17, 0xF0, 0x5F, 0xEC, + 0x7F, 0x79, 0xFB, 0x40, 0x7C, 0x34, 0xFD, 0xA9, 0xFC, 0x27, 0xE2, 0x9F, 0x06, 0xD8, 0xC9, 0xAC, + 0xDF, 0xFC, 0x4E, 0x74, 0xF0, 0xA5, 0xD6, 0xB9, 0xA6, 0xD9, 0xC9, 0x7F, 0xA9, 0xEB, 0xFE, 0x1F, + 0xB8, 0xF0, 0xEE, 0x9F, 0xAC, 0xF8, 0x53, 0x5A, 0x86, 0xCF, 0x4C, 0xBB, 0xBB, 0xFB, 0x7D, 0xB3, + 0x6B, 0x1A, 0x75, 0xCE, 0x9E, 0x01, 0xEE, 0xFF, 0x00, 0x01, 0xEF, 0x3E, 0x2A, 0x7C, 0x11, 0xF8, + 0xDF, 0x75, 0xF0, 0xA3, 0xE3, 0x3F, 0x87, 0xFC, 0x7B, 0xF1, 0x5F, 0xC7, 0xBF, 0x1A, 0xBC, 0x3D, + 0xE0, 0x7D, 0x5B, 0x52, 0xFD, 0xA0, 0xFE, 0x1E, 0x7C, 0x35, 0x93, 0x4D, 0xF8, 0x23, 0xA8, 0xDF, + 0xE8, 0x3F, 0x0E, 0xE7, 0xB1, 0xF1, 0x46, 0xA5, 0xAB, 0xCE, 0xF7, 0x72, 0x1D, 0x16, 0x4F, 0xED, + 0x3F, 0x06, 0x2F, 0xFA, 0x13, 0xBD, 0xC1, 0xFF, 0x00, 0x8A, 0x9F, 0xC3, 0x6B, 0x6F, 0x2D, 0xD0, + 0x3A, 0x8B, 0x69, 0x40, 0x1C, 0xE7, 0xC6, 0xEF, 0x83, 0xBE, 0x3D, 0xD2, 0x7E, 0x2F, 0x8F, 0x0A, + 0x78, 0x7B, 0x42, 0xBD, 0xD7, 0xBE, 0x0A, 0x7E, 0xD3, 0x9F, 0xB4, 0x6F, 0xC1, 0xDF, 0x18, 0xE9, + 0x5A, 0x36, 0x95, 0x06, 0xA5, 0xE2, 0x6D, 0x2B, 0xE1, 0x47, 0x8C, 0x7C, 0x15, 0xA8, 0xEB, 0xBE, + 0x2C, 0xF8, 0x9F, 0xE2, 0x5F, 0x10, 0xEF, 0x89, 0xA0, 0xF0, 0xEE, 0x81, 0xAA, 0x68, 0x5F, 0x0E, + 0x7C, 0x0F, 0x65, 0x67, 0xF6, 0x26, 0x78, 0x6E, 0x7C, 0x49, 0x7F, 0x37, 0x9F, 0x6D, 0x6B, 0x2E, + 0xB9, 0x77, 0xA8, 0xDC, 0x80, 0x7A, 0x6F, 0xC2, 0xFF, 0x00, 0x17, 0xFC, 0x38, 0xF1, 0x07, 0xED, + 0x05, 0xE2, 0x2D, 0x67, 0xC4, 0x1E, 0x16, 0xFD, 0xAB, 0xBC, 0x01, 0xF1, 0xCA, 0xFF, 0x00, 0xC6, + 0xBE, 0x26, 0xF0, 0x27, 0xFC, 0x21, 0xFE, 0x26, 0xF1, 0x0F, 0xC6, 0x3F, 0x10, 0x7E, 0xCF, 0x97, + 0x5A, 0x6F, 0x87, 0xEE, 0xAE, 0xAC, 0x74, 0x7D, 0x7A, 0xCA, 0xCF, 0x7B, 0x7C, 0x3C, 0xB3, 0x87, + 0x54, 0xD1, 0x74, 0x3D, 0x37, 0x54, 0x85, 0xA1, 0x8E, 0x29, 0x15, 0xF5, 0x11, 0x1C, 0x8C, 0x6F, + 0xA4, 0x9B, 0xCC, 0x00, 0xFC, 0xD8, 0xF8, 0x77, 0xE2, 0x5F, 0x89, 0x5A, 0xCF, 0xED, 0x49, 0xE0, + 0x4F, 0x8D, 0x5E, 0x3F, 0xF8, 0x35, 0xFB, 0x7B, 0xF8, 0x57, 0xE1, 0x4F, 0x83, 0x7E, 0x1E, 0x78, + 0x97, 0x4A, 0xD7, 0x35, 0x4D, 0x1B, 0xC7, 0xDE, 0x39, 0xF8, 0x9D, 0xE2, 0xAF, 0x85, 0x72, 0x6A, + 0x7A, 0xFE, 0x85, 0x7D, 0xA4, 0x69, 0xBE, 0x3D, 0xF0, 0xB5, 0xCE, 0x89, 0xA7, 0x5D, 0x4C, 0xD3, + 0x9D, 0x01, 0xAC, 0xEE, 0x2C, 0xBC, 0x14, 0xDE, 0x3A, 0xB3, 0x8E, 0x73, 0x2C, 0x97, 0x17, 0xD0, + 0xE9, 0xD6, 0x89, 0xA9, 0xDC, 0x80, 0x7E, 0xAA, 0x7E, 0xDC, 0x9A, 0x4E, 0x93, 0xA8, 0x7E, 0xCF, + 0xF1, 0xEA, 0x5A, 0xED, 0xE7, 0x8B, 0xEC, 0xB4, 0x6F, 0x00, 0x7C, 0x7B, 0xF8, 0x3D, 0xF1, 0x8F, + 0x54, 0xFF, 0x00, 0x84, 0x03, 0xE1, 0x27, 0x89, 0xBE, 0x39, 0xF8, 0xC2, 0xFA, 0xDF, 0xC0, 0xBF, + 0x17, 0xBC, 0x31, 0xE2, 0x19, 0x6C, 0x2C, 0x3C, 0x2F, 0xE1, 0xEB, 0x3B, 0xBD, 0x5E, 0xE9, 0xEE, + 0x57, 0x41, 0x36, 0xFB, 0xED, 0xED, 0xA5, 0x16, 0xEB, 0x33, 0x5C, 0xCA, 0x04, 0x36, 0xF2, 0x15, + 0x00, 0xFA, 0xF3, 0x18, 0xE3, 0x8E, 0x38, 0xE3, 0xA7, 0x1E, 0x94, 0x00, 0x50, 0x01, 0x40, 0x16, + 0x28, 0x00, 0xA0, 0x02, 0x80, 0x0A, 0x00, 0x28, 0x00, 0xA0, 0x0F, 0xF3, 0xF3, 0xFF, 0x00, 0x83, + 0x9F, 0x7F, 0xE5, 0x39, 0xFF, 0x00, 0xF0, 0x48, 0x7F, 0xFB, 0x05, 0x7C, 0x3D, 0xFF, 0x00, 0xD5, + 0xBD, 0x73, 0x5D, 0x99, 0x67, 0xFC, 0x8C, 0x30, 0xFF, 0x00, 0xE3, 0x87, 0xFE, 0x94, 0x8E, 0x7C, + 0x4F, 0xFB, 0xAD, 0x4F, 0xF0, 0xBF, 0xC8, 0xFB, 0x52, 0xBF, 0x53, 0x3E, 0x38, 0x28, 0x00, 0xA0, + 0x02, 0x80, 0x3F, 0x60, 0xBF, 0xE0, 0x88, 0x5F, 0xF2, 0x22, 0x7E, 0xDD, 0x7F, 0xF6, 0x7C, 0xF0, + 0x7F, 0xEA, 0x86, 0xF8, 0x65, 0x5F, 0x9D, 0x71, 0x07, 0xFC, 0x8D, 0x27, 0xE9, 0x1F, 0xFD, 0x25, + 0x1F, 0x51, 0x95, 0xFF, 0x00, 0xB9, 0x47, 0xE7, 0xF9, 0x9F, 0xB6, 0xD5, 0xE2, 0x9E, 0x88, 0x50, + 0x01, 0x40, 0x05, 0x00, 0x14, 0x00, 0x50, 0x01, 0x40, 0x05, 0x00, 0x14, 0x00, 0x87, 0xEE, 0x9F, + 0xF7, 0x7F, 0xA5, 0x00, 0x7C, 0xBD, 0xFB, 0x56, 0x7C, 0x67, 0xF1, 0xD7, 0xC0, 0x4F, 0x86, 0xB6, + 0xFF, 0x00, 0x10, 0xBC, 0x19, 0x61, 0xFB, 0x32, 0x49, 0x65, 0x65, 0xE2, 0x0B, 0x6D, 0x3B, 0xC5, + 0x9A, 0xC7, 0xED, 0x5B, 0xFB, 0x50, 0xDE, 0x7E, 0xC9, 0x9F, 0x0D, 0x3C, 0x3D, 0x65, 0x74, 0xAD, + 0x1D, 0xBC, 0xD1, 0xF8, 0x92, 0x0F, 0x0A, 0xF8, 0x85, 0x64, 0xBA, 0x92, 0xED, 0xAC, 0xA1, 0x4B, + 0x69, 0x6D, 0xED, 0x95, 0xC4, 0xAC, 0x44, 0xFB, 0x91, 0x62, 0x94, 0x03, 0xF3, 0x9B, 0xF6, 0x54, + 0xFD, 0xBC, 0xFE, 0x37, 0xF8, 0xDF, 0xC5, 0x1F, 0x07, 0xFC, 0x35, 0xE3, 0x9F, 0x89, 0x3F, 0xB2, + 0xBF, 0xC5, 0xD7, 0xF8, 0xA9, 0xFB, 0x7D, 0x78, 0xCB, 0xF6, 0x60, 0xF1, 0x6E, 0x9B, 0xF0, 0x0B, + 0x5E, 0xB8, 0xF8, 0xA3, 0xA5, 0x7C, 0x22, 0xD3, 0xDF, 0xE1, 0x5F, 0x8E, 0xBE, 0x28, 0x78, 0x59, + 0x74, 0xDF, 0x88, 0x96, 0xE3, 0x4D, 0xD3, 0xFC, 0x47, 0x0A, 0xE8, 0x1A, 0x3F, 0x80, 0x2C, 0x22, + 0x94, 0x78, 0x7B, 0x4F, 0x75, 0x8C, 0xDF, 0x0B, 0xA9, 0x2E, 0x2F, 0x52, 0x63, 0x08, 0x07, 0xEB, + 0x17, 0x8E, 0xFE, 0x27, 0x5B, 0x78, 0x1B, 0xC4, 0xFF, 0x00, 0x0E, 0x3C, 0x23, 0x3E, 0x85, 0x7F, + 0x75, 0x7D, 0xF1, 0x5A, 0xFF, 0x00, 0x55, 0xF0, 0xC7, 0x83, 0xF5, 0xB9, 0x6E, 0x20, 0xB2, 0xF0, + 0x84, 0x1A, 0xF6, 0x9F, 0xA3, 0xCF, 0xA9, 0xD9, 0x68, 0xFA, 0xA5, 0xC2, 0x99, 0x2E, 0xED, 0x8D, + 0xE5, 0xA6, 0x9B, 0xAB, 0xBC, 0x53, 0xC7, 0x69, 0x71, 0x1A, 0x9B, 0x19, 0x11, 0xCA, 0xC9, 0x2D, + 0xB4, 0x77, 0x00, 0x1F, 0x03, 0x7E, 0xC9, 0xFF, 0x00, 0xB4, 0xA7, 0xED, 0x75, 0xF1, 0x03, 0xE1, + 0x8E, 0xB1, 0xFB, 0x44, 0x7C, 0x4F, 0xF8, 0x61, 0xA7, 0x7C, 0x47, 0xF0, 0x1F, 0xC5, 0x2F, 0x88, + 0x5E, 0x23, 0xB5, 0xF8, 0x35, 0xF0, 0x7B, 0xF6, 0x68, 0x87, 0x4A, 0xF1, 0xB5, 0xEF, 0x84, 0x3C, + 0x3D, 0xA1, 0x6A, 0x72, 0x69, 0x5A, 0x67, 0x89, 0xAC, 0xFE, 0x25, 0xEB, 0xDA, 0x97, 0x86, 0x2C, + 0xFC, 0x51, 0xE1, 0x9D, 0x7D, 0x34, 0x59, 0xB5, 0xBD, 0x1E, 0xF2, 0x1D, 0x02, 0xD5, 0xE6, 0xD3, + 0xF5, 0xCD, 0x32, 0x51, 0x3D, 0xC4, 0x2C, 0x92, 0x30, 0x07, 0x96, 0xFF, 0x00, 0xC1, 0x4A, 0xBF, + 0x6B, 0x7F, 0xDA, 0x2B, 0xF6, 0x67, 0xD5, 0x74, 0x7D, 0x3F, 0xE1, 0xDF, 0xC5, 0x7B, 0xBF, 0x0B, + 0x58, 0x78, 0x83, 0xE2, 0xBF, 0xC2, 0x08, 0x74, 0x6B, 0x2F, 0x0B, 0xFF, 0x00, 0xC1, 0x2A, 0xFE, + 0x35, 0xFE, 0xD4, 0x1F, 0x60, 0xD0, 0xBC, 0x43, 0xF1, 0x33, 0x43, 0xD1, 0x7C, 0x45, 0x61, 0xA8, + 0xFC, 0x43, 0xD0, 0xB5, 0x09, 0xFC, 0x31, 0x35, 0xDD, 0xCC, 0x0D, 0xAF, 0x2A, 0xE9, 0x51, 0xDA, + 0x59, 0xEA, 0xD2, 0xC3, 0x75, 0x65, 0x69, 0x67, 0xE5, 0x5E, 0xDD, 0xD8, 0x5F, 0x48, 0x01, 0xF6, + 0x17, 0x80, 0x7F, 0x69, 0xFD, 0x4A, 0xC3, 0xE1, 0x47, 0x80, 0x7C, 0x4F, 0xE3, 0x8B, 0x3F, 0x1F, + 0x7C, 0x5F, 0xF1, 0x97, 0xC4, 0x09, 0x35, 0xDD, 0x6B, 0x4A, 0xF0, 0xFF, 0x00, 0xC3, 0x9F, 0xD9, + 0x07, 0xC6, 0xDF, 0xB3, 0x57, 0x8F, 0x6D, 0x3C, 0x3F, 0xE1, 0xFB, 0xA4, 0xB7, 0xD5, 0xF5, 0x5B, + 0xEF, 0x86, 0x9E, 0x2F, 0xD4, 0x65, 0xF1, 0x15, 0xAC, 0x56, 0x72, 0x4D, 0x68, 0x0E, 0xF6, 0x37, + 0x17, 0x9F, 0x6D, 0xD3, 0xBE, 0xC5, 0x67, 0x39, 0xBB, 0x80, 0x4C, 0x01, 0xDC, 0x68, 0x7F, 0xB6, + 0x9F, 0xEC, 0xB3, 0xE2, 0x1B, 0x0D, 0x0A, 0xFB, 0x4A, 0xF8, 0xD1, 0xE1, 0x27, 0x5D, 0x5F, 0x4B, + 0xD6, 0xF5, 0xBD, 0x53, 0x4E, 0xBB, 0xFB, 0x56, 0x95, 0xE2, 0x0F, 0x86, 0x76, 0x5E, 0x18, 0xB1, + 0x9E, 0xE7, 0xC5, 0x37, 0x7E, 0x3D, 0xD2, 0xE7, 0x85, 0x2F, 0x3C, 0x21, 0x0E, 0x94, 0x6C, 0xE4, + 0xB4, 0xD4, 0x5F, 0x5F, 0x87, 0x4D, 0x5B, 0x0B, 0xF9, 0x2D, 0x74, 0xCB, 0xA3, 0x05, 0xF5, 0xD5, + 0xBD, 0xAC, 0xC0, 0x19, 0x9A, 0x2F, 0xED, 0xAD, 0xF0, 0x27, 0xFB, 0x46, 0x4D, 0x0F, 0xE2, 0x76, + 0xA9, 0xAD, 0x7E, 0xCD, 0xDA, 0xF4, 0xBE, 0x1E, 0x1E, 0x33, 0xF0, 0xF6, 0x8D, 0xFB, 0x4D, 0x69, + 0x2B, 0xF0, 0x42, 0x5F, 0x1B, 0x68, 0x7B, 0x4B, 0x3E, 0xAB, 0xA1, 0xDC, 0xEA, 0x32, 0x25, 0xA5, + 0xE7, 0xD9, 0xD0, 0x40, 0xD7, 0xD6, 0x71, 0xCC, 0x6F, 0xF4, 0x91, 0x75, 0xA7, 0xAE, 0xA7, 0x69, + 0x60, 0xD7, 0xD6, 0xAB, 0x38, 0x04, 0xBA, 0xDF, 0xED, 0x91, 0xF0, 0xA7, 0x43, 0x7B, 0x6B, 0xD7, + 0xF0, 0xFF, 0x00, 0xC5, 0xDB, 0xBF, 0x07, 0x69, 0xDA, 0x16, 0x85, 0xE2, 0x0F, 0x89, 0xFE, 0x3F, + 0x8F, 0xE1, 0x26, 0xB5, 0xA5, 0x78, 0x73, 0xE0, 0x1D, 0xBF, 0x89, 0xAD, 0xE2, 0x9F, 0x44, 0x8B, + 0xC7, 0x36, 0x77, 0x90, 0xDB, 0xEA, 0xBA, 0x5D, 0xCF, 0xD9, 0xEE, 0xAD, 0xAE, 0x75, 0x0B, 0x53, + 0x63, 0x24, 0xFA, 0x0D, 0x94, 0xD6, 0xFA, 0x8E, 0xBB, 0x1E, 0x91, 0x61, 0x71, 0x05, 0xDC, 0xA0, + 0x1D, 0x25, 0xD7, 0xED, 0x55, 0xF0, 0x4E, 0xE3, 0x46, 0xD5, 0x75, 0x4F, 0x00, 0xF8, 0xA1, 0x7E, + 0x33, 0x5C, 0xD8, 0xA6, 0x85, 0x6F, 0xA4, 0x68, 0xDF, 0x05, 0xE1, 0x5F, 0x88, 0x57, 0x1E, 0x30, + 0xBE, 0xF1, 0x34, 0xB7, 0x11, 0xE8, 0x5A, 0x5E, 0x93, 0x7F, 0x6E, 0xDF, 0xD9, 0xB2, 0x4F, 0x28, + 0xB0, 0xB9, 0x9E, 0x76, 0x92, 0xEE, 0x28, 0x34, 0xEB, 0x25, 0xFE, 0xD2, 0xD4, 0x26, 0xB2, 0xD3, + 0xC1, 0xBC, 0x50, 0x0C, 0xAF, 0x0D, 0xFE, 0xD8, 0xDF, 0x00, 0xB5, 0xA8, 0x6F, 0xEC, 0x35, 0x8F, + 0x16, 0xCD, 0xF0, 0xF7, 0xE2, 0x06, 0x83, 0xAD, 0x5A, 0xF8, 0x5B, 0xC4, 0xFF, 0x00, 0x05, 0xBE, + 0x21, 0xE9, 0x33, 0xF8, 0x6F, 0xE3, 0x4E, 0x81, 0xAA, 0xDE, 0x5F, 0x9B, 0x1B, 0x3B, 0x24, 0xF0, + 0xDE, 0xD7, 0xB9, 0xD4, 0x62, 0xB9, 0xBC, 0x8E, 0x58, 0xAC, 0xEF, 0xF4, 0xC1, 0x7D, 0xA7, 0xEA, + 0x4A, 0x86, 0x7D, 0x3E, 0xEE, 0xF2, 0xDD, 0x92, 0x77, 0x00, 0xEC, 0xFE, 0x36, 0xFC, 0x42, 0xD7, + 0xFE, 0x1E, 0xC7, 0xF0, 0x98, 0xF8, 0x7E, 0x3D, 0x31, 0xFF, 0x00, 0xE1, 0x35, 0xF8, 0xDD, 0xE1, + 0xDF, 0x87, 0x9A, 0xC8, 0xD4, 0x6D, 0x5E, 0xE4, 0x26, 0x9F, 0xAA, 0x49, 0x2A, 0xDC, 0xB5, 0xB8, + 0x57, 0x4D, 0x93, 0x01, 0x12, 0x6D, 0x63, 0xB8, 0x0E, 0x72, 0xA7, 0xB0, 0x07, 0xB7, 0x60, 0x63, + 0x18, 0x18, 0xC6, 0x31, 0x81, 0x8C, 0x63, 0xA6, 0x28, 0x03, 0xE3, 0xEF, 0x19, 0x7C, 0x7B, 0xF8, + 0xA7, 0xF0, 0x02, 0x4F, 0x1D, 0x6B, 0xFF, 0x00, 0x1E, 0xBE, 0x15, 0xCF, 0xE2, 0x8F, 0x82, 0xBA, + 0x2E, 0xA3, 0x79, 0xAD, 0x78, 0x7F, 0xE3, 0x27, 0xEC, 0xEB, 0xA3, 0x6A, 0x9E, 0x3E, 0xD7, 0x74, + 0x5D, 0x11, 0xEE, 0x5E, 0x48, 0x2D, 0xFC, 0x57, 0xF0, 0xE5, 0x12, 0x7D, 0x75, 0x2E, 0xED, 0xA2, + 0xB8, 0xB1, 0xB3, 0x59, 0xB4, 0x13, 0xE2, 0x11, 0xA8, 0x3D, 0xB5, 0xD5, 0xF3, 0xDA, 0xE8, 0xEB, + 0x34, 0x76, 0x11, 0x00, 0x6C, 0xFC, 0x4C, 0xF8, 0xBB, 0x2F, 0x8A, 0x74, 0xFF, 0x00, 0xD9, 0xCB, + 0x4A, 0xF8, 0x1F, 0xF1, 0x0B, 0xC3, 0xED, 0xA1, 0xFE, 0xD3, 0x3E, 0x31, 0x6D, 0x2B, 0x45, 0xF8, + 0xCD, 0xE0, 0xD9, 0xB4, 0xBF, 0x1D, 0xE9, 0xF6, 0x5E, 0x1D, 0x8B, 0xC1, 0xFA, 0xB6, 0xBC, 0xDA, + 0xC7, 0x86, 0xA7, 0x6F, 0xB4, 0x69, 0x97, 0x77, 0x17, 0x11, 0xE8, 0xD6, 0xB1, 0x5B, 0x4D, 0x2C, + 0x77, 0x56, 0xAA, 0xB7, 0x2D, 0x3B, 0x45, 0x38, 0x8D, 0x62, 0x94, 0x03, 0xD1, 0xFC, 0x57, 0xA0, + 0x7C, 0x68, 0xBE, 0xF8, 0xC1, 0xF0, 0x8B, 0x5D, 0xF0, 0x77, 0x8F, 0xBC, 0x2F, 0xE1, 0xEF, 0x83, + 0x1E, 0x1F, 0xD3, 0x3C, 0x44, 0xBF, 0x19, 0x3C, 0x09, 0xAA, 0x78, 0x4C, 0x6B, 0xBE, 0x21, 0xF8, + 0x83, 0x3D, 0xD5, 0xA4, 0x11, 0xF8, 0x72, 0x3D, 0x2A, 0xF8, 0x34, 0x4D, 0xA7, 0x3D, 0xB5, 0xC8, + 0x9E, 0xE1, 0xEE, 0x4C, 0xB2, 0x21, 0x8A, 0x29, 0xAD, 0x5A, 0xCE, 0x76, 0xBE, 0x8A, 0xF3, 0x47, + 0x00, 0xFC, 0xFB, 0xD2, 0xFF, 0x00, 0x6E, 0x0F, 0xDA, 0x0F, 0x55, 0xFD, 0x9F, 0x3C, 0x3F, 0xE1, + 0x9B, 0x5F, 0xD9, 0xFB, 0xC5, 0xEB, 0xFB, 0x5C, 0xF8, 0x8F, 0x50, 0xBE, 0xFD, 0x96, 0x74, 0xFF, + 0x00, 0x1D, 0x4B, 0xA6, 0xF8, 0x5A, 0x3F, 0xD9, 0xA2, 0x2F, 0x8D, 0x3A, 0x4A, 0x5E, 0x69, 0x7A, + 0xBE, 0xAD, 0x3D, 0x8F, 0xFC, 0x25, 0x3F, 0xF0, 0x90, 0xC5, 0xE0, 0xEB, 0x6D, 0x4F, 0x44, 0xD5, + 0xF5, 0x72, 0x5A, 0xD4, 0x5F, 0x4D, 0xA2, 0x5A, 0x89, 0x6D, 0xE0, 0x9E, 0x7B, 0x8B, 0x68, 0x6E, + 0x00, 0x3F, 0x41, 0x3C, 0x0D, 0xE1, 0xFF, 0x00, 0x8D, 0x1A, 0x77, 0xC4, 0xDF, 0x8D, 0x5A, 0xCF, + 0x8F, 0x3C, 0x7F, 0xE1, 0x7F, 0x10, 0xFC, 0x28, 0xF1, 0x0E, 0xA3, 0xA1, 0x9F, 0x81, 0xDE, 0x04, + 0xD2, 0xFC, 0x26, 0x34, 0xEF, 0x12, 0xFC, 0x3E, 0x82, 0xD7, 0x49, 0x09, 0xAF, 0xBE, 0xA7, 0xAC, + 0xAB, 0xA0, 0xBB, 0x4B, 0xBB, 0xD6, 0x46, 0x86, 0xD8, 0xC3, 0x23, 0xDB, 0xFD, 0x9E, 0x79, 0x7E, + 0xD9, 0x2A, 0x5F, 0xC5, 0x65, 0xA4, 0x80, 0x79, 0xD7, 0xEC, 0xBB, 0xF1, 0x47, 0x5E, 0xF1, 0x84, + 0x1F, 0x1C, 0xFE, 0x15, 0x78, 0xDF, 0x59, 0xD4, 0x3C, 0x55, 0xF1, 0x03, 0xF6, 0x52, 0xF8, 0xDC, + 0xFF, 0x00, 0x00, 0xBC, 0x69, 0xE3, 0xFD, 0x47, 0x4E, 0xD3, 0xB4, 0xAF, 0xF8, 0x58, 0x8B, 0x3F, + 0x84, 0x34, 0x0F, 0x15, 0xF8, 0x77, 0x5C, 0x92, 0x3B, 0x28, 0xED, 0xED, 0x7E, 0xD9, 0x2F, 0x87, + 0x3C, 0x79, 0xE1, 0x95, 0xD4, 0x0C, 0x16, 0x5A, 0x7D, 0xB0, 0xD5, 0x22, 0xD5, 0xD6, 0xD6, 0xD2, + 0x2B, 0x45, 0xB6, 0xDE, 0x01, 0xD9, 0x7E, 0xCE, 0x7F, 0x13, 0x3C, 0x51, 0xF1, 0x9F, 0xE1, 0x7E, + 0x9D, 0xF1, 0x63, 0xC4, 0x1A, 0x26, 0x8D, 0xE1, 0xBD, 0x13, 0xE2, 0x06, 0xAD, 0x7F, 0xE2, 0x2F, + 0x85, 0xBA, 0x36, 0x95, 0x71, 0x36, 0xA1, 0x79, 0xFF, 0x00, 0x08, 0x63, 0xDC, 0xB4, 0x7E, 0x15, + 0xD5, 0x35, 0x3B, 0xA7, 0xD9, 0xBA, 0xF7, 0x53, 0xD3, 0xE1, 0xB5, 0xD5, 0x64, 0xB7, 0x58, 0x20, + 0xFB, 0x0F, 0xF6, 0x9A, 0x69, 0xCD, 0xF6, 0x87, 0xB0, 0x7B, 0xDB, 0xD0, 0x0A, 0x77, 0x3E, 0x34, + 0xF1, 0x3C, 0x7F, 0xB5, 0x36, 0x89, 0xF0, 0xE9, 0x35, 0x52, 0xBE, 0x0A, 0xBB, 0xFD, 0x9F, 0xB5, + 0x4F, 0x1A, 0x5C, 0x68, 0x5F, 0x61, 0xB5, 0x29, 0x26, 0xA9, 0x6F, 0xE2, 0x2D, 0x3E, 0xD6, 0x0B, + 0xBF, 0xB4, 0xF9, 0x5F, 0x68, 0x1B, 0x60, 0xB9, 0x9D, 0x3C, 0xB1, 0x20, 0x8C, 0xEF, 0xC9, 0x42, + 0xC0, 0x10, 0x01, 0xF4, 0x00, 0xE3, 0xA7, 0x1F, 0x4E, 0x28, 0x00, 0xA0, 0x02, 0x80, 0x10, 0x28, + 0x1D, 0x00, 0x1F, 0x40, 0x07, 0x61, 0xFE, 0x03, 0xF2, 0x1E, 0x94, 0x01, 0xE1, 0x9A, 0xC7, 0xC4, + 0xAF, 0x13, 0x4B, 0xFB, 0x43, 0xF8, 0x2F, 0xE0, 0xC7, 0x86, 0x34, 0xDD, 0x0F, 0xFB, 0x0A, 0xD7, + 0xE1, 0xAE, 0xA7, 0xF1, 0x5F, 0xE2, 0xB7, 0x88, 0xF5, 0x33, 0x35, 0xD6, 0xA9, 0xA6, 0xDA, 0xB5, + 0xE4, 0x7A, 0x77, 0x85, 0xF4, 0x5D, 0x32, 0xCD, 0x1A, 0x34, 0x49, 0x6F, 0xAE, 0x9F, 0x5A, 0xBA, + 0x7B, 0xD9, 0x1E, 0x65, 0x82, 0x2F, 0x0F, 0xCB, 0x6A, 0x2D, 0x24, 0x7D, 0x4D, 0x2E, 0xB4, 0xD0, + 0x0E, 0xFF, 0x00, 0xE2, 0x1E, 0x81, 0xE2, 0xDF, 0x12, 0x78, 0x43, 0x53, 0xD2, 0x7C, 0x07, 0xE3, + 0xAB, 0x8F, 0x86, 0xDE, 0x2F, 0x32, 0x5A, 0xDF, 0xE8, 0x1E, 0x2E, 0x87, 0xC3, 0xB6, 0x5E, 0x2D, + 0xB3, 0xB3, 0x9E, 0xCA, 0xEE, 0x2B, 0x85, 0xB4, 0xD4, 0x34, 0xBB, 0x90, 0x12, 0xEB, 0x4F, 0xBA, + 0x16, 0xED, 0x6B, 0x77, 0x14, 0x32, 0xDA, 0x5C, 0xB5, 0xAD, 0xC5, 0xC8, 0xB5, 0xBD, 0xB1, 0xB9, + 0xF2, 0x2F, 0x2D, 0x80, 0x38, 0x6F, 0x83, 0xDF, 0x18, 0xBF, 0xE1, 0x61, 0xB6, 0xBD, 0xE0, 0xDF, + 0x18, 0xF8, 0x7A, 0x1F, 0x87, 0x3F, 0x1B, 0xFE, 0x1E, 0x43, 0x65, 0x17, 0xC5, 0x2F, 0x85, 0x6D, + 0xAC, 0xB6, 0xBD, 0x06, 0x8C, 0x6F, 0xA3, 0x63, 0x65, 0xAC, 0xF8, 0x7B, 0x54, 0x7B, 0x7B, 0x66, + 0xD6, 0x7C, 0x37, 0x7A, 0xD6, 0xF7, 0x82, 0xC7, 0x56, 0x5B, 0x5B, 0x61, 0x33, 0x5A, 0xDE, 0xDA, + 0xDC, 0x5B, 0xD8, 0xEA, 0x3A, 0x7E, 0xA3, 0xA6, 0xE9, 0xE0, 0x1E, 0xDD, 0x40, 0x05, 0x00, 0x14, + 0x00, 0x50, 0x01, 0x40, 0x05, 0x00, 0x14, 0x00, 0x50, 0x01, 0x40, 0x05, 0x00, 0x14, 0x00, 0x50, + 0x01, 0x40, 0x05, 0x00, 0x14, 0x00, 0x50, 0x01, 0x40, 0x05, 0x00, 0x58, 0xA0, 0x02, 0x80, 0x0A, + 0x00, 0x28, 0x00, 0xA0, 0x02, 0x80, 0x3F, 0xCF, 0xCF, 0xFE, 0x0E, 0x7D, 0xFF, 0x00, 0x94, 0xE7, + 0xFF, 0x00, 0xC1, 0x21, 0xFF, 0x00, 0xEC, 0x15, 0xF0, 0xF7, 0xFF, 0x00, 0x56, 0xF5, 0xCD, 0x76, + 0x65, 0x9F, 0xF2, 0x30, 0xC3, 0xFF, 0x00, 0x8E, 0x1F, 0xFA, 0x52, 0x39, 0xF1, 0x3F, 0xEE, 0xB5, + 0x3F, 0xC2, 0xFF, 0x00, 0x23, 0xED, 0x4A, 0xFD, 0x4C, 0xF8, 0xE0, 0xA0, 0x02, 0x80, 0x0A, 0x00, + 0xFD, 0x82, 0xFF, 0x00, 0x82, 0x21, 0x7F, 0xC8, 0x89, 0xFB, 0x75, 0xFF, 0x00, 0xD9, 0xF3, 0xC1, + 0xFF, 0x00, 0xAA, 0x1B, 0xE1, 0x95, 0x7E, 0x75, 0xC4, 0x1F, 0xF2, 0x34, 0x9F, 0xA4, 0x7F, 0xF4, + 0x94, 0x7D, 0x46, 0x57, 0xFE, 0xE5, 0x1F, 0x9F, 0xE6, 0x7E, 0xDB, 0x57, 0x8A, 0x7A, 0x21, 0x40, + 0x05, 0x00, 0x14, 0x00, 0x50, 0x01, 0x40, 0x05, 0x00, 0x14, 0x00, 0x50, 0x02, 0x1F, 0xBA, 0x7F, + 0xDD, 0xFE, 0x94, 0x01, 0xE0, 0x3F, 0x1C, 0x7E, 0x0E, 0x6B, 0x3F, 0x14, 0x20, 0xF0, 0x66, 0xBF, + 0xE0, 0x8F, 0x88, 0x57, 0x7F, 0x0B, 0xFE, 0x29, 0xFC, 0x2A, 0xD6, 0xAF, 0x3C, 0x5D, 0xF0, 0xC3, + 0xC5, 0xB2, 0x78, 0x62, 0xCB, 0xC7, 0x3E, 0x12, 0x83, 0x53, 0xB9, 0xD2, 0x2E, 0xAC, 0x0D, 0xAF, + 0x88, 0xF4, 0x19, 0xCC, 0x52, 0x5F, 0xE9, 0x33, 0x45, 0x7F, 0x22, 0x5C, 0xC1, 0x67, 0x7B, 0xA5, + 0x5E, 0xB4, 0x46, 0x44, 0xB6, 0xD4, 0xAC, 0x64, 0x7F, 0x39, 0x40, 0x3C, 0x37, 0x5E, 0xFD, 0x93, + 0xBC, 0x71, 0xE3, 0x3F, 0x0A, 0xF8, 0x6B, 0xC7, 0x9E, 0x2B, 0xF1, 0x77, 0xEC, 0xED, 0x69, 0xFB, + 0x70, 0xF8, 0x17, 0xC5, 0xB6, 0x1E, 0x37, 0xF0, 0x67, 0xED, 0x47, 0xF0, 0xFF, 0x00, 0xF6, 0x5E, + 0xD4, 0x3C, 0x25, 0xE1, 0x2B, 0x7B, 0xCD, 0x1A, 0x0D, 0x7F, 0x4F, 0xD1, 0xEC, 0xF5, 0x7F, 0x07, + 0xDC, 0x78, 0xBA, 0xF7, 0x53, 0xD4, 0xF4, 0xD5, 0xD0, 0x7E, 0x20, 0x78, 0xEF, 0x4C, 0x92, 0xD6, + 0x6F, 0x11, 0x0D, 0xAB, 0xE2, 0x2D, 0x62, 0xEA, 0xCE, 0x4D, 0x3E, 0xE6, 0x68, 0xE6, 0x80, 0x03, + 0xE8, 0x7D, 0x4B, 0xE1, 0x12, 0xEA, 0xBF, 0x0F, 0x7C, 0x0B, 0xE1, 0x8D, 0x53, 0xC6, 0x3E, 0x20, + 0xF1, 0x2F, 0x8E, 0xFE, 0x19, 0x69, 0x11, 0xCB, 0xE0, 0x9F, 0x8C, 0x5E, 0x2E, 0xB5, 0xD3, 0xEF, + 0xBC, 0x65, 0x6F, 0xE2, 0x48, 0x7C, 0x3B, 0x75, 0xA4, 0x27, 0x8B, 0x75, 0x0B, 0x3B, 0x1B, 0x7B, + 0x2D, 0x2E, 0xE6, 0xF9, 0xE2, 0xD4, 0xEF, 0xE5, 0x96, 0x18, 0xED, 0x2D, 0xED, 0x19, 0xE7, 0x90, + 0x25, 0xBC, 0x4A, 0x11, 0x63, 0x00, 0xF0, 0x7D, 0x67, 0xF6, 0x6B, 0xF8, 0xD3, 0xE0, 0x0F, 0x06, + 0x7E, 0xCE, 0xDE, 0x12, 0xFD, 0x91, 0x3E, 0x38, 0xFC, 0x3D, 0xF8, 0x2D, 0x63, 0xF0, 0x07, 0xE1, + 0x07, 0xFC, 0x28, 0xC8, 0x7C, 0x2B, 0xF1, 0x6F, 0xE0, 0xD7, 0x88, 0xFE, 0x3C, 0x7C, 0x26, 0xF1, + 0x26, 0x85, 0x15, 0xA6, 0x8F, 0x0E, 0x9D, 0x3F, 0xFC, 0x23, 0xF6, 0x1E, 0x34, 0xF0, 0xF5, 0xC4, + 0x5A, 0xA5, 0x92, 0xF8, 0x66, 0x08, 0xAD, 0xAF, 0x27, 0xBF, 0xBC, 0x31, 0xDB, 0xDF, 0x6A, 0x71, + 0x18, 0xD9, 0xAE, 0x4C, 0xAA, 0x01, 0xE4, 0xDF, 0xB4, 0x7F, 0xEC, 0x15, 0xF1, 0x47, 0xF6, 0x9C, + 0xF8, 0x93, 0xF0, 0x17, 0xC6, 0x3E, 0x34, 0xFD, 0xAA, 0xFC, 0x4D, 0xE1, 0x4F, 0x0B, 0x7C, 0x34, + 0x1E, 0x08, 0xF1, 0x17, 0xC4, 0x3F, 0x01, 0xFC, 0x31, 0xB3, 0xF1, 0xBF, 0x81, 0x74, 0x4F, 0x14, + 0xF8, 0xAB, 0xC0, 0xBE, 0x27, 0x87, 0xC4, 0x56, 0x1A, 0xF7, 0x86, 0xF4, 0xCB, 0x7F, 0x1A, 0x8F, + 0x0F, 0x59, 0xC7, 0x73, 0xAB, 0x58, 0xE9, 0x82, 0x7B, 0x7F, 0x12, 0x68, 0xDE, 0x30, 0x78, 0xED, + 0x2C, 0xAD, 0xE2, 0xB4, 0xB8, 0xB3, 0xB8, 0x0D, 0x7A, 0xE0, 0x1F, 0x79, 0xFC, 0x36, 0xF0, 0xAF, + 0x8B, 0xFC, 0x19, 0xA0, 0x5C, 0x68, 0x1E, 0x2F, 0xF8, 0x97, 0xAC, 0xFC, 0x57, 0x92, 0xDB, 0x54, + 0x92, 0x5D, 0x0B, 0xC5, 0x9E, 0x29, 0xF0, 0xFE, 0x95, 0xA1, 0x78, 0xCD, 0xAC, 0x24, 0x8A, 0x36, + 0x5B, 0x5D, 0x61, 0xF4, 0xC8, 0x2D, 0x74, 0xEB, 0xB9, 0xA2, 0xB8, 0x37, 0x8B, 0x1C, 0xF6, 0xD6, + 0x16, 0x03, 0xEC, 0xC6, 0xCE, 0x29, 0x22, 0x96, 0x78, 0x66, 0xBC, 0xBC, 0x00, 0xEB, 0xED, 0xF4, + 0x7D, 0x22, 0xD3, 0x51, 0xBE, 0xD5, 0xED, 0x74, 0xBD, 0x3A, 0xDB, 0x56, 0xD5, 0x12, 0x18, 0xF5, + 0x3D, 0x52, 0xDE, 0xC6, 0x28, 0x75, 0x1D, 0x45, 0x6D, 0xD7, 0x6D, 0xBA, 0xCF, 0x38, 0x50, 0xF2, + 0x04, 0x52, 0x42, 0x86, 0x27, 0x68, 0x38, 0x18, 0x14, 0x00, 0x6A, 0x5A, 0x3E, 0x93, 0xAC, 0xDB, + 0xC7, 0x69, 0xAB, 0xE9, 0x7A, 0x76, 0xAB, 0x6B, 0x15, 0xC4, 0x77, 0x71, 0x5B, 0x6A, 0x56, 0x31, + 0x5F, 0x5B, 0xC5, 0x2C, 0x27, 0x31, 0x4A, 0xA8, 0xEA, 0x54, 0x3A, 0x9E, 0x55, 0x80, 0xC8, 0xED, + 0x8A, 0x00, 0xD1, 0xF4, 0xF6, 0xC6, 0x3D, 0xB1, 0xD3, 0x14, 0x01, 0x9F, 0xA6, 0xE9, 0x1A, 0x4E, + 0x8D, 0x1D, 0xCC, 0x5A, 0x3E, 0x97, 0xA7, 0x69, 0x51, 0x5E, 0xDE, 0xC9, 0xA9, 0x5E, 0x47, 0xA6, + 0xD9, 0x45, 0x63, 0x1D, 0xDD, 0xCC, 0xC4, 0x79, 0xD7, 0x12, 0xAA, 0x28, 0x0D, 0x23, 0xED, 0x5D, + 0xCE, 0x72, 0x4E, 0x06, 0x4F, 0x14, 0x00, 0xDB, 0x9D, 0x1B, 0x47, 0xBD, 0xD4, 0x34, 0xBD, 0x5A, + 0xF3, 0x4A, 0xD3, 0x6E, 0xF5, 0x5D, 0x0C, 0x4E, 0x34, 0x5D, 0x4E, 0xE6, 0xC6, 0x29, 0xF5, 0x0D, + 0x1C, 0x5C, 0xC6, 0x12, 0xE4, 0x5A, 0xCC, 0xCA, 0x5E, 0x2F, 0x31, 0x15, 0x55, 0xF6, 0x15, 0xDC, + 0x00, 0x07, 0x20, 0x50, 0x07, 0x9B, 0x7C, 0x61, 0xF8, 0x7B, 0xE2, 0x5F, 0x88, 0x9A, 0x3F, 0x82, + 0xAC, 0xFC, 0x27, 0xE2, 0xBF, 0x0E, 0x78, 0x33, 0x54, 0xF0, 0xA7, 0xC5, 0xBF, 0x0A, 0x7C, 0x41, + 0xB9, 0xD5, 0x7C, 0x47, 0xF0, 0xDA, 0xC3, 0xE2, 0x6C, 0x57, 0xBA, 0x66, 0x87, 0xAE, 0x5B, 0xDC, + 0xEB, 0x5A, 0x45, 0x95, 0xB5, 0xD4, 0xB1, 0x2D, 0x85, 0xDD, 0xFE, 0x9D, 0x15, 0xFD, 0x8C, 0x5A, + 0x9C, 0x45, 0xA6, 0xB1, 0x6B, 0xBF, 0xB4, 0xC6, 0x92, 0x34, 0x41, 0x18, 0x03, 0xD3, 0x35, 0x5D, + 0x57, 0x4A, 0xD0, 0x74, 0xAD, 0x4B, 0x5B, 0xD6, 0xF5, 0x2D, 0x3F, 0x45, 0xD1, 0x34, 0x5D, 0x3E, + 0x6D, 0x57, 0x57, 0xD5, 0xF5, 0x5B, 0xC8, 0xB4, 0xED, 0x2B, 0x49, 0xB4, 0xB6, 0x88, 0xC9, 0x71, + 0x73, 0x73, 0x71, 0x21, 0x58, 0xE2, 0x8A, 0x38, 0xD1, 0xDD, 0x9D, 0xCA, 0xAA, 0xAA, 0x92, 0x48, + 0x03, 0x80, 0x0F, 0x97, 0x34, 0xBF, 0xD9, 0xA7, 0xE1, 0x2F, 0xC4, 0xEF, 0x11, 0xF8, 0x7B, 0xE3, + 0x57, 0xC4, 0x8D, 0x6B, 0xC6, 0x5F, 0xB4, 0x4E, 0x6E, 0xEE, 0x3C, 0x7B, 0xF0, 0x8B, 0x49, 0xF8, + 0xD4, 0x6D, 0x2F, 0xFE, 0x1E, 0x7C, 0x2B, 0x4D, 0x64, 0xF9, 0xD6, 0x37, 0x3E, 0x1F, 0xF0, 0x64, + 0x56, 0x16, 0x5A, 0x5D, 0xBE, 0xA1, 0x6B, 0x63, 0x70, 0x2C, 0x6D, 0x75, 0x5B, 0xDB, 0x29, 0xF5, + 0x9B, 0x7B, 0x49, 0x6F, 0xAD, 0xCD, 0xF7, 0xFC, 0x4C, 0x75, 0x0F, 0xB6, 0x80, 0x6F, 0xFC, 0x4B, + 0xD0, 0xAD, 0xBE, 0x30, 0x6B, 0x1A, 0x1E, 0xA7, 0xF0, 0x9F, 0xC7, 0x1E, 0x17, 0x5F, 0x8A, 0xFF, + 0x00, 0xB2, 0xAF, 0xC6, 0x9B, 0x6D, 0x46, 0xF7, 0x4A, 0xD5, 0x92, 0x4D, 0x57, 0xC3, 0x69, 0xA8, + 0xDE, 0xF8, 0x45, 0x7F, 0xB5, 0x7C, 0x29, 0xE2, 0x18, 0xE0, 0x65, 0xB9, 0xB4, 0x7B, 0xCF, 0x0B, + 0xF8, 0xE6, 0x29, 0xED, 0xEE, 0xA2, 0x2E, 0xD6, 0x57, 0x17, 0x7A, 0x3D, 0xFB, 0xDB, 0x6A, 0x16, + 0xF0, 0x4D, 0xA6, 0x6A, 0x00, 0x1F, 0x49, 0xE0, 0x0E, 0x07, 0x41, 0xC0, 0xE0, 0x0E, 0x07, 0x4E, + 0x28, 0x03, 0xE6, 0x1B, 0x6F, 0xD9, 0x5F, 0xC0, 0x90, 0xFE, 0xD4, 0x1A, 0x87, 0xED, 0x36, 0xF2, + 0xB9, 0xD4, 0xA6, 0xF0, 0xC4, 0x31, 0xE9, 0xDE, 0x05, 0xB5, 0xB5, 0x36, 0x3E, 0x10, 0xB7, 0xF1, + 0x74, 0x96, 0x5F, 0xD9, 0x7A, 0x9F, 0xC4, 0x5B, 0xDB, 0x44, 0x93, 0xEC, 0xD7, 0xBE, 0x26, 0x97, + 0xC3, 0x76, 0x7A, 0x1F, 0x87, 0xE0, 0xD5, 0x25, 0xB7, 0xFB, 0x6D, 0xA6, 0x95, 0x6B, 0x77, 0xA7, + 0xC7, 0x72, 0x6D, 0x6F, 0xA4, 0xB7, 0x40, 0x0F, 0xA7, 0x86, 0x38, 0xF4, 0xE3, 0xA6, 0x3A, 0x7B, + 0x50, 0x07, 0xC0, 0x9E, 0x30, 0xF8, 0x3C, 0xDF, 0x0C, 0xFF, 0x00, 0x66, 0x6F, 0xDA, 0x3B, 0xC4, + 0x7E, 0x3D, 0xF8, 0xB3, 0xA3, 0xFC, 0x18, 0xD7, 0xBE, 0x30, 0x78, 0x92, 0xFB, 0xE3, 0xEF, 0xED, + 0x7F, 0xF1, 0xDF, 0xC3, 0x7E, 0x23, 0xD4, 0xBC, 0x27, 0x1F, 0x83, 0xF4, 0x2B, 0x6D, 0x3F, 0x4F, + 0xB4, 0xF1, 0x1B, 0x68, 0x5A, 0xDD, 0xBB, 0x5A, 0xDC, 0xE9, 0xF3, 0x69, 0x9E, 0x03, 0xF0, 0xA6, + 0x99, 0xA0, 0xD9, 0x6B, 0x30, 0x2D, 0x84, 0xF0, 0x8D, 0x32, 0xD7, 0x59, 0x68, 0xD6, 0xF1, 0x65, + 0x59, 0x40, 0x3E, 0xE7, 0xD0, 0xB4, 0x2D, 0x13, 0xC2, 0xFA, 0x26, 0x8F, 0xE1, 0x9F, 0x0C, 0xE8, + 0xDA, 0x57, 0x87, 0x7C, 0x37, 0xE1, 0xDD, 0x2A, 0xDB, 0x41, 0xF0, 0xFF, 0x00, 0x87, 0xB4, 0x2D, + 0x3A, 0x1D, 0x23, 0x43, 0xD0, 0x6C, 0x6C, 0xE1, 0x58, 0xAD, 0x2C, 0xAC, 0xAD, 0x22, 0x55, 0x8A, + 0x08, 0x22, 0x8A, 0x28, 0xE3, 0x48, 0xE3, 0x55, 0x54, 0x55, 0x55, 0x50, 0x00, 0x00, 0x00, 0x7C, + 0xFB, 0xE2, 0x8B, 0x2D, 0x3F, 0xC3, 0x1F, 0xB5, 0x27, 0xC2, 0xEF, 0x1D, 0xF8, 0x8B, 0xC5, 0x1E, + 0x14, 0xD0, 0xF4, 0xFF, 0x00, 0x88, 0x1F, 0x0F, 0x35, 0x7F, 0x80, 0x5E, 0x04, 0xD1, 0x35, 0x2D, + 0x51, 0xED, 0xBC, 0x4F, 0xE3, 0x0F, 0x13, 0xB9, 0x7F, 0x12, 0xB5, 0x86, 0x9D, 0x6A, 0x62, 0xF2, + 0xE5, 0xD9, 0xA2, 0xF8, 0x47, 0xC4, 0x57, 0x4D, 0x89, 0x43, 0x84, 0xB2, 0x98, 0x84, 0x2A, 0xA5, + 0x94, 0x03, 0xE9, 0x6A, 0x00, 0x28, 0x00, 0xA0, 0x0C, 0x0F, 0x15, 0xF8, 0xA7, 0xC3, 0x7E, 0x04, + 0xF0, 0xAF, 0x89, 0x7C, 0x6F, 0xE3, 0x0D, 0x67, 0x4F, 0xF0, 0xDF, 0x84, 0x3C, 0x1B, 0xE1, 0xFB, + 0xDF, 0x15, 0x78, 0xA7, 0xC4, 0x3A, 0xB4, 0xEB, 0x69, 0xA5, 0x68, 0x1A, 0x6E, 0x9D, 0x6C, 0xF7, + 0x17, 0xD7, 0xB7, 0x32, 0x9E, 0x12, 0x28, 0xA0, 0x86, 0x59, 0x19, 0x8F, 0x01, 0x50, 0x9E, 0xD4, + 0x01, 0xE5, 0x7F, 0x08, 0xFE, 0x0E, 0x7F, 0xC2, 0x03, 0xE2, 0x8F, 0x8C, 0x5F, 0x11, 0xFC, 0x49, + 0x7F, 0x0F, 0x89, 0x3E, 0x25, 0xFC, 0x64, 0xF1, 0xCB, 0xEA, 0x7A, 0xDF, 0x89, 0x4B, 0xCD, 0x72, + 0xDA, 0x4F, 0x86, 0xF4, 0x83, 0x25, 0xAF, 0x82, 0xFC, 0x2B, 0xA7, 0xB4, 0xC4, 0xB5, 0xAE, 0x9B, + 0x61, 0x62, 0xF3, 0x5C, 0x1B, 0x38, 0x7C, 0xBB, 0x6F, 0xED, 0x3D, 0x5B, 0xC4, 0x77, 0xEB, 0x18, + 0x9F, 0x55, 0xBA, 0x96, 0x70, 0x0F, 0x73, 0xA0, 0x0F, 0x15, 0xF8, 0xC3, 0xF0, 0x81, 0xBE, 0x22, + 0x47, 0xA0, 0x78, 0xA7, 0xC2, 0x3E, 0x21, 0x4F, 0x87, 0x9F, 0x1A, 0x7E, 0x1D, 0x0B, 0xDB, 0xBF, + 0x84, 0xFF, 0x00, 0x13, 0xD3, 0x4C, 0x9B, 0x5B, 0xB5, 0xD0, 0x65, 0xBE, 0x8E, 0x35, 0xBD, 0xD2, + 0x75, 0xFD, 0x26, 0x2B, 0xAB, 0x43, 0xAD, 0x78, 0x72, 0xF8, 0xDA, 0x58, 0x8B, 0xFD, 0x22, 0x4B, + 0x9B, 0x75, 0x9C, 0xDA, 0xD8, 0xDD, 0x5B, 0xCF, 0x65, 0xA8, 0xE9, 0xDA, 0x6E, 0xA5, 0xA7, 0x00, + 0x71, 0x97, 0xFE, 0x34, 0xFD, 0xAF, 0x6D, 0xEE, 0xA4, 0x87, 0x4E, 0xFD, 0x9D, 0xFE, 0x04, 0xEA, + 0x16, 0x71, 0x84, 0x58, 0xAF, 0x26, 0xFD, 0xAA, 0x35, 0x8B, 0x07, 0x9C, 0xEC, 0x1B, 0xC8, 0x8B, + 0xFE, 0x10, 0x66, 0xC2, 0x86, 0xDC, 0x01, 0x24, 0x12, 0x00, 0x24, 0x29, 0x3B, 0x54, 0x02, 0x9F, + 0xFC, 0x27, 0x5F, 0xB6, 0x5F, 0xFD, 0x1B, 0x57, 0xC0, 0x4F, 0xFC, 0x4B, 0x4D, 0x63, 0xFF, 0x00, + 0x98, 0x3A, 0x00, 0x3F, 0xE1, 0x3A, 0xFD, 0xB2, 0xFF, 0x00, 0xE8, 0xDA, 0xBE, 0x02, 0x7F, 0xE2, + 0x5A, 0x6B, 0x1F, 0xFC, 0xC1, 0xD0, 0x01, 0xFF, 0x00, 0x09, 0xD7, 0xED, 0x97, 0xFF, 0x00, 0x46, + 0xD5, 0xF0, 0x13, 0xFF, 0x00, 0x12, 0xD3, 0x58, 0xFF, 0x00, 0xE6, 0x0E, 0x80, 0x0F, 0xF8, 0x4E, + 0xBF, 0x6C, 0xBF, 0xFA, 0x36, 0xAF, 0x80, 0x9F, 0xF8, 0x96, 0x9A, 0xC7, 0xFF, 0x00, 0x30, 0x74, + 0x00, 0x7F, 0xC2, 0x75, 0xFB, 0x65, 0xFF, 0x00, 0xD1, 0xB5, 0x7C, 0x04, 0xFF, 0x00, 0xC4, 0xB4, + 0xD6, 0x3F, 0xF9, 0x83, 0xA0, 0x03, 0xFE, 0x13, 0xAF, 0xDB, 0x2F, 0xFE, 0x8D, 0xAB, 0xE0, 0x27, + 0xFE, 0x25, 0xA6, 0xB1, 0xFF, 0x00, 0xCC, 0x1D, 0x00, 0x1F, 0xF0, 0x9D, 0x7E, 0xD9, 0x7F, 0xF4, + 0x6D, 0x5F, 0x01, 0x3F, 0xF1, 0x2D, 0x35, 0x8F, 0xFE, 0x60, 0xE8, 0x00, 0xFF, 0x00, 0x84, 0xEB, + 0xF6, 0xCB, 0xFF, 0x00, 0xA3, 0x6A, 0xF8, 0x09, 0xFF, 0x00, 0x89, 0x69, 0xAC, 0x7F, 0xF3, 0x07, + 0x40, 0x07, 0xFC, 0x27, 0x5F, 0xB6, 0x5F, 0xFD, 0x1B, 0x57, 0xC0, 0x4F, 0xFC, 0x4B, 0x4D, 0x63, + 0xFF, 0x00, 0x98, 0x3A, 0x00, 0x3F, 0xE1, 0x3A, 0xFD, 0xB2, 0xFF, 0x00, 0xE8, 0xDA, 0xBE, 0x02, + 0x7F, 0xE2, 0x5A, 0x6B, 0x1F, 0xFC, 0xC1, 0xD0, 0x01, 0xFF, 0x00, 0x09, 0xD7, 0xED, 0x97, 0xFF, + 0x00, 0x46, 0xD5, 0xF0, 0x13, 0xFF, 0x00, 0x12, 0xD3, 0x58, 0xFF, 0x00, 0xE6, 0x0E, 0x80, 0x0F, + 0xF8, 0x4E, 0xBF, 0x6C, 0xBF, 0xFA, 0x36, 0xAF, 0x80, 0x9F, 0xF8, 0x96, 0x9A, 0xC7, 0xFF, 0x00, + 0x30, 0x74, 0x00, 0x7F, 0xC2, 0x75, 0xFB, 0x65, 0xFF, 0x00, 0xD1, 0xB5, 0x7C, 0x04, 0xFF, 0x00, + 0xC4, 0xB4, 0xD6, 0x3F, 0xF9, 0x83, 0xA0, 0x0F, 0xA3, 0x3C, 0x31, 0x75, 0xE2, 0x2B, 0xDF, 0x0F, + 0x68, 0xF7, 0x7E, 0x2E, 0xD1, 0x74, 0x9F, 0x0E, 0xF8, 0x9A, 0xE2, 0xC2, 0x39, 0x75, 0xCD, 0x0B, + 0x42, 0xD7, 0xA4, 0xF1, 0x4E, 0x8F, 0xA5, 0x5C, 0x95, 0xFD, 0xE4, 0x16, 0xDA, 0x8C, 0x96, 0xB6, + 0xAF, 0x71, 0x1A, 0x9E, 0x04, 0x8D, 0x6D, 0x09, 0x3F, 0xDC, 0x5E, 0x94, 0x01, 0xBB, 0x40, 0x05, + 0x00, 0x14, 0x01, 0x62, 0x80, 0x0A, 0x00, 0x28, 0x00, 0xA0, 0x02, 0x80, 0x0A, 0x00, 0xFF, 0x00, + 0x3F, 0x3F, 0xF8, 0x39, 0xF7, 0xFE, 0x53, 0x9F, 0xFF, 0x00, 0x04, 0x87, 0xFF, 0x00, 0xB0, 0x57, + 0xC3, 0xDF, 0xFD, 0x5B, 0xD7, 0x35, 0xD9, 0x96, 0x7F, 0xC8, 0xC3, 0x0F, 0xFE, 0x38, 0x7F, 0xE9, + 0x48, 0xE7, 0xC4, 0xFF, 0x00, 0xBA, 0xD4, 0xFF, 0x00, 0x0B, 0xFC, 0x8F, 0xB5, 0x2B, 0xF5, 0x33, + 0xE3, 0x82, 0x80, 0x0A, 0x00, 0x28, 0x03, 0xF6, 0x0B, 0xFE, 0x08, 0x85, 0xFF, 0x00, 0x22, 0x27, + 0xED, 0xD7, 0xFF, 0x00, 0x67, 0xCF, 0x07, 0xFE, 0xA8, 0x6F, 0x86, 0x55, 0xF9, 0xD7, 0x10, 0x7F, + 0xC8, 0xD2, 0x7E, 0x91, 0xFF, 0x00, 0xD2, 0x51, 0xF5, 0x19, 0x5F, 0xFB, 0x94, 0x7E, 0x7F, 0x99, + 0xFB, 0x6D, 0x5E, 0x29, 0xE8, 0x85, 0x00, 0x14, 0x00, 0x50, 0x01, 0x40, 0x05, 0x00, 0x14, 0x00, + 0x50, 0x01, 0x40, 0x08, 0x7E, 0xE9, 0xFF, 0x00, 0x77, 0xFA, 0x50, 0x04, 0x14, 0x00, 0x50, 0x01, + 0x40, 0x05, 0x00, 0x14, 0x00, 0x50, 0x01, 0x40, 0x05, 0x00, 0x14, 0x00, 0x50, 0x01, 0x40, 0x15, + 0x6F, 0xAF, 0xAC, 0x74, 0xAB, 0x1B, 0xCD, 0x4F, 0x53, 0xBC, 0xB4, 0xD3, 0x74, 0xCD, 0x36, 0xD2, + 0x4B, 0xFD, 0x43, 0x50, 0xBE, 0xB8, 0x4B, 0x3B, 0x0B, 0x0B, 0x78, 0x50, 0xBC, 0xD3, 0x4D, 0x33, + 0x90, 0x91, 0xC6, 0x88, 0x8C, 0xCC, 0xCC, 0x40, 0x00, 0x12, 0x48, 0x02, 0x80, 0x3E, 0x52, 0xD2, + 0xB4, 0xEB, 0xFF, 0x00, 0xDA, 0x92, 0xF7, 0x4C, 0xF1, 0x67, 0x89, 0xAC, 0x6F, 0x74, 0xAF, 0xD9, + 0xBB, 0x4E, 0xB8, 0x83, 0x58, 0xF0, 0x17, 0x81, 0xF5, 0x3B, 0x49, 0xF4, 0xCD, 0x47, 0xE3, 0x9C, + 0x82, 0x24, 0x92, 0xD3, 0xC4, 0x3E, 0x21, 0xB6, 0x32, 0x2B, 0x26, 0x86, 0x3C, 0xD7, 0x36, 0xBA, + 0x4D, 0xD4, 0x01, 0xA7, 0x78, 0xE2, 0xBB, 0xB9, 0x50, 0xA2, 0x08, 0x10, 0x03, 0xEB, 0x7A, 0x00, + 0xF8, 0xA7, 0xF6, 0x56, 0xFF, 0x00, 0x92, 0xE7, 0xFF, 0x00, 0x05, 0x2A, 0xFF, 0x00, 0xB3, 0xD7, + 0xD0, 0x7F, 0xF5, 0x9C, 0x3E, 0x14, 0xD0, 0x07, 0xDA, 0xD4, 0x00, 0x50, 0x01, 0x40, 0x1F, 0x1E, + 0x7E, 0xD8, 0xF1, 0x5C, 0x1D, 0x23, 0xF6, 0x76, 0xB9, 0xD5, 0xE3, 0xD2, 0x24, 0xF8, 0x4D, 0xA6, + 0x7E, 0xD7, 0x3F, 0x0F, 0xB5, 0x3F, 0x8C, 0xC9, 0x7B, 0x0B, 0xCD, 0xAB, 0x47, 0x69, 0x0E, 0xA6, + 0xDF, 0xF0, 0x83, 0xCF, 0xA5, 0xAF, 0xFA, 0x91, 0x2C, 0x3F, 0x10, 0x0F, 0xC3, 0x49, 0xEE, 0x1E, + 0x70, 0x12, 0x3B, 0x08, 0x35, 0x49, 0x14, 0xAC, 0xD1, 0xC2, 0x40, 0x07, 0xD8, 0x60, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0E, 0x00, 0x1F, 0x80, 0xA0, 0x0F, 0x82, 0xBF, 0x6C, + 0x0F, 0xF9, 0x38, 0x4F, 0xF8, 0x25, 0x4F, 0xFD, 0x9F, 0xB7, 0x88, 0xBF, 0xF5, 0x97, 0x3E, 0x30, + 0xD0, 0x07, 0xDE, 0xB4, 0x00, 0x50, 0x01, 0x40, 0x1F, 0x24, 0x7E, 0xDF, 0xBF, 0xF2, 0x61, 0xDF, + 0xB6, 0xC7, 0xFD, 0x9A, 0x2F, 0xC4, 0x9F, 0xFD, 0x43, 0x35, 0x1A, 0x00, 0xFA, 0xE0, 0xF5, 0x34, + 0x00, 0x94, 0x00, 0x50, 0x01, 0x40, 0x05, 0x00, 0x14, 0x00, 0x50, 0x01, 0x40, 0x05, 0x00, 0x14, + 0x00, 0x50, 0x01, 0x40, 0x05, 0x00, 0x14, 0x00, 0x50, 0x01, 0x40, 0x05, 0x00, 0x14, 0x00, 0x50, + 0x01, 0x40, 0x05, 0x00, 0x58, 0xA0, 0x02, 0x80, 0x0A, 0x00, 0x28, 0x00, 0xA0, 0x02, 0x80, 0x3F, + 0xCF, 0xCF, 0xFE, 0x0E, 0x7D, 0xFF, 0x00, 0x94, 0xE7, 0xFF, 0x00, 0xC1, 0x21, 0xFF, 0x00, 0xEC, + 0x15, 0xF0, 0xF7, 0xFF, 0x00, 0x56, 0xF5, 0xCD, 0x76, 0x65, 0x9F, 0xF2, 0x30, 0xC3, 0xFF, 0x00, + 0x8E, 0x1F, 0xFA, 0x52, 0x39, 0xF1, 0x3F, 0xEE, 0xB5, 0x3F, 0xC2, 0xFF, 0x00, 0x23, 0xED, 0x4A, + 0xFD, 0x4C, 0xF8, 0xE0, 0xA0, 0x02, 0x80, 0x0A, 0x00, 0xFD, 0x82, 0xFF, 0x00, 0x82, 0x21, 0x7F, + 0xC8, 0x89, 0xFB, 0x75, 0xFF, 0x00, 0xD9, 0xF3, 0xC1, 0xFF, 0x00, 0xAA, 0x1B, 0xE1, 0x95, 0x7E, + 0x75, 0xC4, 0x1F, 0xF2, 0x34, 0x9F, 0xA4, 0x7F, 0xF4, 0x94, 0x7D, 0x46, 0x57, 0xFE, 0xE5, 0x1F, + 0x9F, 0xE6, 0x7E, 0xDB, 0x57, 0x8A, 0x7A, 0x21, 0x40, 0x05, 0x00, 0x14, 0x00, 0x50, 0x01, 0x40, + 0x05, 0x00, 0x14, 0x00, 0x50, 0x02, 0x1F, 0xBA, 0x7F, 0xDD, 0xFE, 0x94, 0x01, 0xE2, 0xBF, 0x1A, + 0x7E, 0x05, 0x78, 0x27, 0xE3, 0xE7, 0x87, 0xB4, 0xAF, 0x0C, 0x78, 0xE7, 0x5B, 0xF8, 0xC9, 0xA0, + 0xE9, 0xBA, 0x36, 0xB2, 0xBA, 0xED, 0x9D, 0xC7, 0xC1, 0x4F, 0xDA, 0x2F, 0xE2, 0x17, 0xEC, 0xD5, + 0xE2, 0x09, 0x67, 0x5B, 0x79, 0x21, 0x11, 0xDD, 0x6A, 0xDE, 0x10, 0xD6, 0xB4, 0xAB, 0xEB, 0xAB, + 0x6D, 0x97, 0x0E, 0x7E, 0xCD, 0x3C, 0xD2, 0x40, 0x5C, 0x47, 0x21, 0x8F, 0x7C, 0x48, 0xC8, 0x01, + 0xF3, 0x57, 0xFC, 0x3B, 0x6F, 0xF6, 0x78, 0xFF, 0x00, 0xA2, 0x89, 0xFB, 0x7C, 0xFF, 0x00, 0xE2, + 0xD6, 0xFF, 0x00, 0x6A, 0x4F, 0xFE, 0x78, 0x54, 0x00, 0x7F, 0xC3, 0xB6, 0xFF, 0x00, 0x67, 0x8F, + 0xFA, 0x28, 0x9F, 0xB7, 0xCF, 0xFE, 0x2D, 0x6F, 0xF6, 0xA4, 0xFF, 0x00, 0xE7, 0x85, 0x40, 0x07, + 0xFC, 0x3B, 0x6F, 0xF6, 0x78, 0xFF, 0x00, 0xA2, 0x89, 0xFB, 0x7C, 0xFF, 0x00, 0xE2, 0xD6, 0xFF, + 0x00, 0x6A, 0x4F, 0xFE, 0x78, 0x54, 0x00, 0x7F, 0xC3, 0xB6, 0xFF, 0x00, 0x67, 0x8F, 0xFA, 0x28, + 0x9F, 0xB7, 0xCF, 0xFE, 0x2D, 0x6F, 0xF6, 0xA4, 0xFF, 0x00, 0xE7, 0x85, 0x40, 0x07, 0xFC, 0x3B, + 0x6F, 0xF6, 0x78, 0xFF, 0x00, 0xA2, 0x89, 0xFB, 0x7C, 0xFF, 0x00, 0xE2, 0xD6, 0xFF, 0x00, 0x6A, + 0x4F, 0xFE, 0x78, 0x54, 0x00, 0x7F, 0xC3, 0xB6, 0xFF, 0x00, 0x67, 0x8F, 0xFA, 0x28, 0x9F, 0xB7, + 0xCF, 0xFE, 0x2D, 0x6F, 0xF6, 0xA4, 0xFF, 0x00, 0xE7, 0x85, 0x40, 0x07, 0xFC, 0x3B, 0x6F, 0xF6, + 0x78, 0xFF, 0x00, 0xA2, 0x89, 0xFB, 0x7C, 0xFF, 0x00, 0xE2, 0xD6, 0xFF, 0x00, 0x6A, 0x4F, 0xFE, + 0x78, 0x54, 0x00, 0x7F, 0xC3, 0xB6, 0xFF, 0x00, 0x67, 0x8F, 0xFA, 0x28, 0x9F, 0xB7, 0xCF, 0xFE, + 0x2D, 0x6F, 0xF6, 0xA4, 0xFF, 0x00, 0xE7, 0x85, 0x40, 0x07, 0xFC, 0x3B, 0x6F, 0xF6, 0x78, 0xFF, + 0x00, 0xA2, 0x89, 0xFB, 0x7C, 0xFF, 0x00, 0xE2, 0xD6, 0xFF, 0x00, 0x6A, 0x4F, 0xFE, 0x78, 0x54, + 0x00, 0x7F, 0xC3, 0xB6, 0xFF, 0x00, 0x67, 0x8F, 0xFA, 0x28, 0x9F, 0xB7, 0xCF, 0xFE, 0x2D, 0x6F, + 0xF6, 0xA4, 0xFF, 0x00, 0xE7, 0x85, 0x40, 0x1B, 0x5E, 0x1C, 0xFF, 0x00, 0x82, 0x79, 0xFE, 0xCE, + 0x3E, 0x1D, 0xD7, 0x74, 0x8D, 0x76, 0x7D, 0x57, 0xF6, 0xA8, 0xF1, 0xE2, 0x68, 0xD7, 0xB1, 0xEA, + 0x30, 0xF8, 0x53, 0xE3, 0x47, 0xED, 0xF7, 0xF1, 0xEB, 0xE3, 0xE7, 0xC3, 0x2D, 0x4A, 0x68, 0x4E, + 0xEB, 0x76, 0xD5, 0x3C, 0x21, 0xE2, 0x5F, 0x18, 0xEA, 0x1A, 0x1E, 0xA0, 0x22, 0x90, 0x47, 0x34, + 0x6B, 0x77, 0x67, 0x3A, 0xC7, 0x34, 0x50, 0x4C, 0x81, 0x64, 0x86, 0x37, 0x40, 0x0F, 0xB7, 0xA8, + 0x03, 0x9A, 0xF1, 0x9F, 0x8C, 0xBC, 0x25, 0xF0, 0xE7, 0xC1, 0xDE, 0x2B, 0xF8, 0x83, 0xE3, 0xDF, + 0x11, 0xE8, 0x9E, 0x0D, 0xF0, 0x27, 0x80, 0xFC, 0x33, 0x7F, 0xE3, 0x2F, 0x1A, 0x78, 0xBB, 0xC4, + 0x9A, 0x8C, 0x5A, 0x3F, 0x87, 0x3C, 0x29, 0xA4, 0x69, 0x56, 0x8F, 0x73, 0xA9, 0x6A, 0x57, 0xF7, + 0x72, 0x15, 0x8E, 0x0B, 0x68, 0x2D, 0xED, 0xE6, 0x96, 0x49, 0x1C, 0x85, 0x44, 0x46, 0x62, 0x40, + 0x1C, 0x00, 0x70, 0x3F, 0x05, 0x74, 0x3F, 0x0D, 0x1D, 0x03, 0x56, 0xF8, 0xAD, 0xA4, 0xFC, 0x3D, + 0xD7, 0xFE, 0x19, 0xF8, 0x9F, 0xF6, 0x89, 0xBC, 0xD2, 0x7E, 0x34, 0x7C, 0x4C, 0xF0, 0xC7, 0x8B, + 0x24, 0xB8, 0x4F, 0x16, 0x5A, 0xEB, 0x72, 0xF8, 0x4F, 0x47, 0xD2, 0x20, 0x8B, 0x55, 0xB3, 0x79, + 0x5E, 0x2B, 0x3B, 0xCB, 0x7D, 0x27, 0xC3, 0x7A, 0x0D, 0x94, 0xD6, 0xF0, 0x04, 0x8D, 0x5E, 0xC9, + 0xC9, 0x0D, 0x23, 0xC9, 0x24, 0xA0, 0x1E, 0xA1, 0xAD, 0x6B, 0x5A, 0x37, 0x86, 0xB4, 0x6D, 0x5B, + 0xC4, 0x5E, 0x22, 0xD5, 0xB4, 0xBD, 0x03, 0xC3, 0xDA, 0x06, 0x97, 0x3E, 0xB5, 0xAE, 0xEB, 0xBA, + 0xD5, 0xF4, 0x3A, 0x56, 0x8B, 0xA2, 0x59, 0x5A, 0x42, 0xD2, 0xDD, 0x5D, 0xDD, 0xDD, 0x4A, 0xCB, + 0x14, 0x30, 0x45, 0x14, 0x6E, 0xEF, 0x23, 0xB2, 0xAA, 0x2A, 0xB3, 0x12, 0x00, 0x24, 0x00, 0x7C, + 0xC1, 0x1F, 0xC5, 0x8F, 0x8E, 0xDE, 0x25, 0xD0, 0xF5, 0x0F, 0x8A, 0xDF, 0x0F, 0xFE, 0x18, 0xE9, + 0x9A, 0x9F, 0xC3, 0x0B, 0x1D, 0x52, 0xD2, 0xEB, 0xC3, 0x5F, 0x0F, 0xF5, 0x88, 0x26, 0xD2, 0x3E, + 0x36, 0xFC, 0x57, 0xF0, 0xFD, 0xBC, 0x1A, 0x8A, 0x6A, 0xBA, 0xA6, 0x92, 0x67, 0xB9, 0x83, 0x4F, + 0xD3, 0xEE, 0x2E, 0xA4, 0x93, 0xC3, 0xF7, 0x3A, 0x5D, 0xAD, 0xF0, 0x5F, 0x36, 0xDE, 0xDA, 0xE6, + 0x3B, 0xB9, 0x2C, 0x64, 0xD4, 0x91, 0xB4, 0x80, 0x0F, 0xA1, 0x7C, 0x09, 0xE3, 0xBF, 0x08, 0x7C, + 0x4C, 0xF0, 0x9E, 0x91, 0xE3, 0x7F, 0x02, 0x6B, 0xB6, 0x7E, 0x23, 0xF0, 0xBE, 0xB7, 0x1C, 0xBF, + 0x60, 0xD4, 0xEC, 0x83, 0xC5, 0xB6, 0x4B, 0x69, 0xDE, 0x0B, 0xCB, 0x4B, 0x88, 0x24, 0x54, 0x9A, + 0xDE, 0xEA, 0xDE, 0xE6, 0xDE, 0xE2, 0xDE, 0x7B, 0x69, 0x92, 0x39, 0xAD, 0xE7, 0x86, 0x68, 0x65, + 0x8E, 0x39, 0x22, 0x74, 0x50, 0x0E, 0x2B, 0xE3, 0xD7, 0x88, 0x3E, 0x19, 0xE8, 0x5F, 0x0C, 0x75, + 0x2D, 0x3F, 0xE3, 0x17, 0x85, 0x6C, 0x7C, 0x71, 0xF0, 0xDB, 0xE2, 0x47, 0x88, 0xFC, 0x39, 0xF0, + 0x1B, 0xC4, 0xDE, 0x0C, 0xD5, 0xBC, 0x39, 0x67, 0xE2, 0xDF, 0x0F, 0xF8, 0xAA, 0x3F, 0x88, 0xFE, + 0x23, 0xB0, 0xF0, 0xAD, 0xB6, 0x9D, 0xAA, 0xE9, 0x97, 0x5F, 0xE8, 0xD7, 0x3A, 0x74, 0xD7, 0x1E, + 0x25, 0xB6, 0x8E, 0xEA, 0x39, 0x55, 0xD4, 0xDB, 0x35, 0xC6, 0x63, 0x90, 0x7E, 0xED, 0xC0, 0x3D, + 0x88, 0x70, 0x00, 0xF4, 0x00, 0x7E, 0x43, 0xFF, 0x00, 0xAC, 0x28, 0x03, 0xE7, 0x3F, 0x89, 0x3F, + 0xF0, 0xAF, 0x7C, 0x53, 0xF1, 0xEB, 0xF6, 0x6F, 0xF0, 0x4E, 0xBD, 0xE0, 0xBB, 0xCF, 0x15, 0xF8, + 0xEB, 0xC0, 0x7A, 0x97, 0x89, 0x3F, 0x68, 0x9F, 0x03, 0xF8, 0x82, 0x2D, 0x5A, 0x7D, 0x2F, 0x49, + 0xF8, 0x52, 0xFA, 0x77, 0x86, 0xEE, 0xFC, 0x2B, 0x73, 0xAA, 0xDC, 0xA4, 0x52, 0x28, 0xB9, 0xB9, + 0xBB, 0xB4, 0xF8, 0x8F, 0xA8, 0x69, 0xF6, 0xF6, 0x93, 0xC6, 0xF1, 0x3C, 0x77, 0x1A, 0x9D, 0xD0, + 0xDB, 0x2E, 0x9B, 0x19, 0xA0, 0x0F, 0xA3, 0x28, 0x03, 0xC5, 0x3E, 0x30, 0xFC, 0x5E, 0x7F, 0x87, + 0x29, 0xE1, 0xBF, 0x0A, 0xF8, 0x47, 0xC3, 0x32, 0x7C, 0x45, 0xF8, 0xC9, 0xF1, 0x16, 0x6B, 0x9B, + 0x0F, 0x86, 0x1F, 0x0C, 0xAD, 0x75, 0x17, 0xD1, 0x60, 0xD5, 0x8D, 0x92, 0xC4, 0x75, 0x2D, 0x67, + 0x5D, 0xD5, 0x56, 0xDE, 0xE1, 0x74, 0x6F, 0x0F, 0xE9, 0xE9, 0x77, 0x68, 0xF7, 0xDA, 0x9C, 0xB0, + 0x4A, 0x23, 0x37, 0x16, 0x56, 0x76, 0xD0, 0x5E, 0xEA, 0x3A, 0x96, 0x9B, 0xA6, 0xEA, 0x20, 0x1C, + 0x9F, 0x80, 0xFE, 0x27, 0x7C, 0x41, 0xF0, 0x97, 0x8B, 0xB4, 0x7F, 0x83, 0xFF, 0x00, 0xB4, 0x6C, + 0x9E, 0x0C, 0x7F, 0x1A, 0x78, 0x96, 0xD5, 0xA7, 0xF8, 0x69, 0xF1, 0x63, 0xE1, 0xEF, 0x86, 0x75, + 0x3F, 0x06, 0x7C, 0x2C, 0xF8, 0xC7, 0x25, 0xBD, 0xA9, 0x9F, 0x54, 0xD2, 0xA2, 0xD2, 0xAF, 0x2F, + 0x35, 0x07, 0xD0, 0x75, 0xCB, 0x44, 0x49, 0x9D, 0x74, 0xBB, 0x8D, 0x56, 0xFD, 0xAF, 0xEC, 0xA0, + 0x93, 0x51, 0xB3, 0x9E, 0x51, 0x6B, 0xAA, 0xD9, 0xE8, 0x40, 0x1D, 0x5F, 0xED, 0x2B, 0x7F, 0xF0, + 0xD3, 0x4A, 0xFD, 0x9C, 0x7E, 0x3F, 0xEA, 0x7F, 0x19, 0xF4, 0x6D, 0x43, 0xC4, 0x3F, 0x07, 0x74, + 0xDF, 0x82, 0x5E, 0x2B, 0xBF, 0xF8, 0xB1, 0xE1, 0xED, 0x21, 0xE5, 0x8B, 0x55, 0xD7, 0x7C, 0x33, + 0x06, 0x83, 0x74, 0xFA, 0xF5, 0x95, 0xAB, 0x45, 0x34, 0x12, 0x89, 0x65, 0xB1, 0x4B, 0xA8, 0xD0, + 0xA4, 0xF0, 0xB0, 0x66, 0x5D, 0xB2, 0x21, 0xC3, 0x28, 0x07, 0xB6, 0x63, 0x1C, 0x71, 0xC7, 0x1C, + 0x63, 0x1C, 0x7A, 0x7E, 0x54, 0x00, 0x50, 0x01, 0x40, 0x05, 0x00, 0x14, 0x00, 0x50, 0x01, 0x40, + 0x05, 0x00, 0x14, 0x00, 0x50, 0x01, 0x40, 0x05, 0x00, 0x14, 0x00, 0x50, 0x01, 0x40, 0x05, 0x00, + 0x14, 0x00, 0x50, 0x01, 0x40, 0x05, 0x00, 0x14, 0x01, 0x62, 0x80, 0x0A, 0x00, 0x28, 0x00, 0xA0, + 0x02, 0x80, 0x0A, 0x00, 0xFF, 0x00, 0x3F, 0x3F, 0xF8, 0x39, 0xF7, 0xFE, 0x53, 0x9F, 0xFF, 0x00, + 0x04, 0x87, 0xFF, 0x00, 0xB0, 0x57, 0xC3, 0xDF, 0xFD, 0x5B, 0xD7, 0x35, 0xD9, 0x96, 0x7F, 0xC8, + 0xC3, 0x0F, 0xFE, 0x38, 0x7F, 0xE9, 0x48, 0xE7, 0xC4, 0xFF, 0x00, 0xBA, 0xD4, 0xFF, 0x00, 0x0B, + 0xFC, 0x8F, 0xB5, 0x2B, 0xF5, 0x33, 0xE3, 0x82, 0x80, 0x0A, 0x00, 0x28, 0x03, 0xF6, 0x0B, 0xFE, + 0x08, 0x85, 0xFF, 0x00, 0x22, 0x27, 0xED, 0xD7, 0xFF, 0x00, 0x67, 0xCF, 0x07, 0xFE, 0xA8, 0x6F, + 0x86, 0x55, 0xF9, 0xD7, 0x10, 0x7F, 0xC8, 0xD2, 0x7E, 0x91, 0xFF, 0x00, 0xD2, 0x51, 0xF5, 0x19, + 0x5F, 0xFB, 0x94, 0x7E, 0x7F, 0x99, 0xFB, 0x6D, 0x5E, 0x29, 0xE8, 0x85, 0x00, 0x14, 0x00, 0x50, + 0x01, 0x40, 0x05, 0x00, 0x14, 0x00, 0x50, 0x01, 0x40, 0x08, 0x7E, 0xE9, 0xFF, 0x00, 0x77, 0xFA, + 0x50, 0x04, 0x14, 0x00, 0x50, 0x01, 0x40, 0x05, 0x00, 0x14, 0x00, 0x50, 0x01, 0x40, 0x05, 0x00, + 0x14, 0x00, 0x50, 0x01, 0x40, 0x05, 0x00, 0x14, 0x01, 0xF3, 0x07, 0xED, 0x2F, 0xE0, 0x7F, 0x12, + 0x7C, 0x5D, 0xB3, 0xF8, 0x7B, 0xF0, 0x61, 0x7C, 0x3F, 0xA4, 0x5E, 0x7C, 0x20, 0xF1, 0xCF, 0x8B, + 0xA3, 0xD4, 0x7F, 0x68, 0xBD, 0x5F, 0xC4, 0x9A, 0xBD, 0xB5, 0xBF, 0x87, 0xEF, 0xBC, 0x1D, 0xA2, + 0xEC, 0xB9, 0xB8, 0xF0, 0x73, 0x69, 0x44, 0xBC, 0xBA, 0xB1, 0xD7, 0xAF, 0x06, 0x9B, 0xA7, 0xDD, + 0x58, 0xCD, 0x0A, 0xE9, 0xF2, 0xE8, 0xCD, 0xE2, 0x65, 0xBA, 0x9F, 0x79, 0xB4, 0xB0, 0xD5, 0x80, + 0x3E, 0x92, 0x5D, 0x43, 0x4E, 0xF9, 0x55, 0x6F, 0xAC, 0xCF, 0x45, 0x50, 0x2E, 0x90, 0x93, 0xE8, + 0x3A, 0xFD, 0x28, 0x03, 0xC0, 0xB5, 0x8F, 0x87, 0xBE, 0x2D, 0xF8, 0xB3, 0xF1, 0x06, 0x49, 0xBE, + 0x26, 0x5A, 0xC5, 0xA3, 0xFC, 0x1B, 0xF8, 0x7F, 0xAE, 0x5B, 0xDE, 0xF8, 0x1F, 0xE1, 0xED, 0xA6, + 0xAB, 0xF6, 0x99, 0xBE, 0x27, 0xEA, 0xB6, 0x6D, 0x6B, 0x73, 0x69, 0xE2, 0x6F, 0x12, 0x3C, 0x0E, + 0xAA, 0xB6, 0x96, 0x97, 0x31, 0x4E, 0x96, 0x7A, 0x4B, 0x19, 0x63, 0x77, 0x44, 0xBE, 0xB9, 0xDD, + 0x2A, 0xDA, 0xC1, 0xA7, 0x80, 0x7D, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0xE0, 0x01, 0xF8, 0x0A, 0x00, 0xF9, 0xD3, 0xC5, 0x3F, 0x0F, 0x3C, 0x5D, 0xE0, 0x9F, 0x1E, + 0xCD, 0xF1, 0x6F, 0xE0, 0xC5, 0xAC, 0x17, 0xF3, 0xF8, 0xAF, 0x51, 0xB5, 0x4F, 0x8D, 0x5F, 0x0A, + 0xAF, 0x75, 0x6F, 0xEC, 0xBD, 0x1B, 0xE2, 0x44, 0x29, 0x1D, 0xA5, 0xA4, 0x5E, 0x21, 0xD3, 0x26, + 0x94, 0x98, 0x2C, 0x7C, 0x41, 0x61, 0x63, 0x66, 0x12, 0x32, 0x04, 0x30, 0x6A, 0x50, 0xA4, 0x76, + 0x77, 0x8E, 0x86, 0x2B, 0x1B, 0xDD, 0x2C, 0x03, 0xE7, 0x1F, 0xDA, 0x0B, 0xC7, 0xFF, 0x00, 0x11, + 0xBE, 0x3D, 0x78, 0x4F, 0xE1, 0x47, 0x82, 0x7E, 0x16, 0x7E, 0xCB, 0x7F, 0xB4, 0x5E, 0xB3, 0xA7, + 0x6A, 0x1F, 0xB5, 0x07, 0xC2, 0x8F, 0x16, 0xF8, 0xB3, 0xC7, 0x5E, 0x25, 0xD2, 0x7C, 0x29, 0xF0, + 0xA3, 0xC3, 0x9F, 0x0C, 0x34, 0xCF, 0x03, 0x7C, 0x54, 0xF0, 0xA7, 0x88, 0xF5, 0x8B, 0xED, 0x5F, + 0x4D, 0xF1, 0x0E, 0xBD, 0xA7, 0x6B, 0xB7, 0x30, 0xB6, 0x9B, 0xA6, 0xDF, 0x98, 0x4E, 0x95, 0xA6, + 0xEA, 0x45, 0xE4, 0xB7, 0x92, 0x2C, 0x2B, 0x80, 0xA4, 0x03, 0xF4, 0x66, 0x80, 0x3E, 0x70, 0xF8, + 0x43, 0xF0, 0xDF, 0xC4, 0xD0, 0xFC, 0x4D, 0xF8, 0xD5, 0xF1, 0xB7, 0xE2, 0x54, 0x17, 0x49, 0xE3, + 0x0F, 0x1A, 0x78, 0x94, 0xF8, 0x07, 0xE1, 0xC6, 0x91, 0x77, 0xAA, 0xAD, 0xFD, 0xAF, 0xC3, 0xEF, + 0x87, 0xDE, 0x1C, 0x73, 0x0E, 0x91, 0x63, 0x65, 0x04, 0x13, 0x3D, 0x92, 0x3E, 0xA7, 0xA8, 0xB6, + 0xB5, 0xAE, 0xCF, 0x70, 0xB1, 0xAD, 0xEC, 0xA9, 0xAA, 0xE9, 0x96, 0x37, 0x92, 0x32, 0x68, 0x96, + 0x56, 0xF6, 0x00, 0x1E, 0xAD, 0xF1, 0x23, 0x5E, 0xF1, 0x8F, 0x86, 0xBC, 0x19, 0xAB, 0x6A, 0x7F, + 0x0F, 0x3C, 0x0E, 0x3E, 0x22, 0xF8, 0xDF, 0x36, 0xDA, 0x77, 0x86, 0x3C, 0x25, 0x2F, 0x88, 0xAD, + 0x3C, 0x21, 0xA5, 0xDD, 0xDD, 0xDE, 0x5D, 0x47, 0x6F, 0x1D, 0xD6, 0xA7, 0xA9, 0xCF, 0xBB, 0xEC, + 0xDA, 0x6D, 0xA8, 0x9D, 0xAE, 0xEF, 0x24, 0x82, 0x1B, 0xCB, 0xA5, 0xB4, 0xB6, 0xBA, 0x36, 0x96, + 0x57, 0xD7, 0x22, 0x0B, 0x2B, 0x90, 0x0E, 0x2F, 0xE0, 0xEF, 0xC1, 0xA8, 0xFE, 0x1C, 0x37, 0x88, + 0x7C, 0x61, 0xE2, 0xBD, 0x76, 0x3F, 0x88, 0x9F, 0x1B, 0xBE, 0x22, 0x45, 0x69, 0xFF, 0x00, 0x0B, + 0x4F, 0xE2, 0xCD, 0xC6, 0x89, 0x1E, 0x85, 0x73, 0xAF, 0xC5, 0x61, 0x2D, 0xD4, 0xBA, 0x47, 0x87, + 0xF4, 0x8B, 0x11, 0x24, 0xC7, 0x4C, 0xF0, 0xDE, 0x96, 0x75, 0x5D, 0x4E, 0x3D, 0x37, 0x4B, 0x13, + 0xDC, 0x18, 0x05, 0xDD, 0xED, 0xCD, 0xC5, 0xC5, 0xF6, 0xA3, 0xA8, 0xEA, 0x5A, 0x96, 0xA2, 0x01, + 0xDE, 0x78, 0xF7, 0xC0, 0x1E, 0x10, 0xF8, 0x9F, 0xE1, 0x3D, 0x4B, 0xC1, 0x3E, 0x39, 0xD1, 0x62, + 0xD7, 0x3C, 0x39, 0xAA, 0x49, 0x6B, 0x77, 0x25, 0xB7, 0xDA, 0xAE, 0x34, 0xCB, 0xED, 0x3E, 0xF3, + 0x4F, 0xBB, 0x8A, 0xEF, 0x4B, 0xD4, 0xF4, 0xEB, 0xEB, 0x77, 0x8E, 0xEA, 0xC7, 0x50, 0xB3, 0xBD, + 0xB4, 0xB2, 0xBB, 0xB4, 0xBD, 0xB5, 0x96, 0x1B, 0x9B, 0x4B, 0x9B, 0x6B, 0x6B, 0x98, 0x25, 0x8A, + 0x68, 0x23, 0x91, 0x00, 0x3F, 0x3D, 0xFF, 0x00, 0x69, 0xFB, 0x6F, 0xDA, 0xAA, 0x3F, 0xD9, 0x2B, + 0xF6, 0x91, 0xFD, 0x9C, 0x2D, 0x7E, 0x05, 0xFC, 0x4E, 0xFD, 0xAA, 0xFC, 0x61, 0xE3, 0x7F, 0x83, + 0xDA, 0xFF, 0x00, 0xC1, 0xFF, 0x00, 0x86, 0x3F, 0x15, 0xBE, 0x1B, 0xEB, 0xDF, 0x0D, 0x7C, 0x14, + 0xFE, 0x2A, 0xB2, 0xF1, 0x47, 0x85, 0xF5, 0x5B, 0x1D, 0x3B, 0x51, 0xF1, 0x8D, 0xA7, 0x88, 0x3C, + 0x4D, 0xA2, 0xC7, 0x6D, 0xAA, 0xD8, 0x4F, 0x05, 0xB4, 0x7A, 0xA4, 0x9A, 0x7C, 0x0D, 0x6B, 0x75, + 0xF6, 0xEB, 0x0B, 0xDB, 0x0B, 0x68, 0x85, 0xC5, 0xE6, 0x97, 0xA0, 0x80, 0x7E, 0x9D, 0x71, 0xDB, + 0xA7, 0x6E, 0x31, 0xC7, 0x6E, 0x3F, 0x2A, 0x00, 0x4A, 0x00, 0x28, 0x00, 0xA0, 0x02, 0x80, 0x0A, + 0x00, 0x28, 0x00, 0xA0, 0x02, 0x80, 0x0A, 0x00, 0x28, 0x00, 0xA0, 0x02, 0x80, 0x0A, 0x00, 0x28, + 0x00, 0xA0, 0x02, 0x80, 0x0A, 0x00, 0x28, 0x00, 0xA0, 0x02, 0x80, 0x2C, 0x50, 0x01, 0x40, 0x05, + 0x00, 0x14, 0x00, 0x50, 0x01, 0x40, 0x1F, 0xE7, 0xE7, 0xFF, 0x00, 0x07, 0x3E, 0xFF, 0x00, 0xCA, + 0x73, 0xFF, 0x00, 0xE0, 0x90, 0xFF, 0x00, 0xF6, 0x0A, 0xF8, 0x7B, 0xFF, 0x00, 0xAB, 0x7A, 0xE6, + 0xBB, 0x32, 0xCF, 0xF9, 0x18, 0x61, 0xFF, 0x00, 0xC7, 0x0F, 0xFD, 0x29, 0x1C, 0xF8, 0x9F, 0xF7, + 0x5A, 0x9F, 0xE1, 0x7F, 0x91, 0xF6, 0xA5, 0x7E, 0xA6, 0x7C, 0x70, 0x50, 0x01, 0x40, 0x05, 0x00, + 0x7E, 0xC1, 0x7F, 0xC1, 0x10, 0xBF, 0xE4, 0x44, 0xFD, 0xBA, 0xFF, 0x00, 0xEC, 0xF9, 0xE0, 0xFF, + 0x00, 0xD5, 0x0D, 0xF0, 0xCA, 0xBF, 0x3A, 0xE2, 0x0F, 0xF9, 0x1A, 0x4F, 0xD2, 0x3F, 0xFA, 0x4A, + 0x3E, 0xA3, 0x2B, 0xFF, 0x00, 0x72, 0x8F, 0xCF, 0xF3, 0x3F, 0x6D, 0xAB, 0xC5, 0x3D, 0x10, 0xA0, + 0x02, 0x80, 0x0A, 0x00, 0x28, 0x00, 0xA0, 0x02, 0x80, 0x0A, 0x00, 0x28, 0x01, 0x0F, 0xDD, 0x3F, + 0xEE, 0xFF, 0x00, 0x4A, 0x00, 0x82, 0x80, 0x0A, 0x00, 0x28, 0x00, 0xA0, 0x02, 0x80, 0x0A, 0x00, + 0x28, 0x00, 0xA0, 0x02, 0x80, 0x0A, 0x00, 0x28, 0x00, 0xA0, 0x02, 0x80, 0x3C, 0xDF, 0xE2, 0x2F, + 0xC1, 0xAF, 0x84, 0x1F, 0x18, 0x2D, 0xB4, 0xAB, 0x3F, 0x8B, 0x7F, 0x0A, 0x7E, 0x1A, 0xFC, 0x52, + 0xB4, 0xD0, 0xA6, 0x96, 0xE3, 0x44, 0xB5, 0xF8, 0x8D, 0xE0, 0x5D, 0x2F, 0xC6, 0xF6, 0xDA, 0x34, + 0x93, 0xAA, 0xAC, 0xD2, 0x5A, 0x47, 0x7B, 0x04, 0xAB, 0x0B, 0x3A, 0xC5, 0x18, 0x62, 0x81, 0x49, + 0x08, 0xA0, 0xF4, 0x18, 0x00, 0xF3, 0x2B, 0x4F, 0xD8, 0xBF, 0xF6, 0x3B, 0xB0, 0xBA, 0xB5, 0xBE, + 0xB0, 0xFD, 0x93, 0xBF, 0x66, 0x7B, 0x2B, 0xDB, 0x29, 0xE3, 0xBA, 0xB3, 0xBB, 0xB4, 0xF8, 0x0F, + 0xE1, 0x5B, 0x6B, 0xAB, 0x49, 0x62, 0x60, 0xD1, 0xCB, 0x14, 0x8B, 0x62, 0x19, 0x19, 0x59, 0x54, + 0x86, 0x04, 0x10, 0x40, 0x23, 0xA5, 0x00, 0x7D, 0x2B, 0x40, 0x05, 0x00, 0x14, 0x00, 0x50, 0x07, + 0xC9, 0x1F, 0x16, 0xFC, 0x47, 0x77, 0xE3, 0x8F, 0xDA, 0x1F, 0xE0, 0x5F, 0xEC, 0xFF, 0x00, 0xE1, + 0x8F, 0x15, 0xF8, 0x87, 0x4D, 0x8F, 0xC3, 0xAB, 0x2F, 0xED, 0x23, 0xF1, 0xCB, 0x4F, 0xF0, 0x46, + 0xB7, 0x2E, 0x8B, 0x7B, 0x6F, 0xE1, 0xED, 0x1E, 0x47, 0xB5, 0xF0, 0x5E, 0x93, 0xAF, 0xEA, 0x16, + 0x8C, 0x2F, 0x2C, 0x2D, 0x75, 0x6F, 0x12, 0x7F, 0xA4, 0xC1, 0x6D, 0xBE, 0xD9, 0x35, 0x9B, 0x7F, + 0x08, 0xF8, 0x96, 0xCA, 0x46, 0xBA, 0xB1, 0xB7, 0xD5, 0x6C, 0x6E, 0x80, 0x3D, 0xC7, 0xE2, 0x7F, + 0xC4, 0xFF, 0x00, 0x0D, 0xFC, 0x28, 0xF0, 0xE5, 0xBE, 0xB9, 0xAE, 0xC7, 0x7F, 0xA9, 0xEA, 0x1A, + 0xC6, 0xAF, 0x6F, 0xE1, 0x4F, 0x04, 0xF8, 0x37, 0x40, 0x5B, 0x79, 0xFC, 0x5D, 0xF1, 0x0F, 0x5D, + 0xBD, 0x0D, 0xFD, 0x9F, 0xA1, 0x68, 0xB6, 0xF3, 0x4B, 0x0C, 0x2F, 0x75, 0x37, 0x95, 0x2B, 0x6E, + 0x9A, 0x58, 0x2D, 0xE0, 0x86, 0x2B, 0x8B, 0xAB, 0x99, 0xAD, 0xED, 0xAD, 0xA7, 0x9E, 0x10, 0x0E, + 0x03, 0xE1, 0x8F, 0xC2, 0xCD, 0x7A, 0x7F, 0x11, 0xFF, 0x00, 0xC2, 0xE8, 0xF8, 0xD3, 0xFD, 0x8F, + 0xAC, 0x7C, 0x60, 0xD4, 0x34, 0xF7, 0xD3, 0xFC, 0x3D, 0xA3, 0xE9, 0xEA, 0x2F, 0xFC, 0x27, 0xF0, + 0x2F, 0x48, 0x99, 0xDD, 0x8E, 0x83, 0xE1, 0xB7, 0x90, 0x16, 0x37, 0x32, 0x24, 0x90, 0xA6, 0xA5, + 0xAA, 0x28, 0x8A, 0x4D, 0x4E, 0x5B, 0x78, 0x18, 0xC7, 0x05, 0xAD, 0xB5, 0x95, 0x8D, 0x88, 0x07, + 0xD0, 0xB4, 0x00, 0x50, 0x01, 0x40, 0x05, 0x00, 0x14, 0x00, 0x50, 0x01, 0x40, 0x05, 0x00, 0x14, + 0x00, 0x50, 0x01, 0x40, 0x05, 0x00, 0x14, 0x00, 0x50, 0x01, 0x40, 0x05, 0x00, 0x14, 0x00, 0x50, + 0x01, 0x40, 0x05, 0x00, 0x14, 0x00, 0x50, 0x01, 0x40, 0x05, 0x00, 0x58, 0xA0, 0x02, 0x80, 0x0A, + 0x00, 0x28, 0x00, 0xA0, 0x02, 0x80, 0x3F, 0xCF, 0xCF, 0xFE, 0x0E, 0x7D, 0xFF, 0x00, 0x94, 0xE7, + 0xFF, 0x00, 0xC1, 0x21, 0xFF, 0x00, 0xEC, 0x15, 0xF0, 0xF7, 0xFF, 0x00, 0x56, 0xF5, 0xCD, 0x76, + 0x65, 0x9F, 0xF2, 0x30, 0xC3, 0xFF, 0x00, 0x8E, 0x1F, 0xFA, 0x52, 0x39, 0xF1, 0x3F, 0xEE, 0xB5, + 0x3F, 0xC2, 0xFF, 0x00, 0x23, 0xED, 0x4A, 0xFD, 0x4C, 0xF8, 0xE0, 0xA0, 0x02, 0x80, 0x0A, 0x00, + 0xFD, 0x82, 0xFF, 0x00, 0x82, 0x21, 0x7F, 0xC8, 0x89, 0xFB, 0x75, 0xFF, 0x00, 0xD9, 0xF3, 0xC1, + 0xFF, 0x00, 0xAA, 0x1B, 0xE1, 0x95, 0x7E, 0x75, 0xC4, 0x1F, 0xF2, 0x34, 0x9F, 0xA4, 0x7F, 0xF4, + 0x94, 0x7D, 0x46, 0x57, 0xFE, 0xE5, 0x1F, 0x9F, 0xE6, 0x7E, 0xDB, 0x57, 0x8A, 0x7A, 0x21, 0x40, + 0x05, 0x00, 0x14, 0x00, 0x50, 0x01, 0x40, 0x05, 0x00, 0x14, 0x00, 0x50, 0x02, 0x1F, 0xBA, 0x7F, + 0xDD, 0xFE, 0x94, 0x01, 0x05, 0x00, 0x14, 0x00, 0x50, 0x01, 0x40, 0x05, 0x00, 0x14, 0x00, 0x50, + 0x01, 0x40, 0x05, 0x00, 0x14, 0x00, 0x50, 0x01, 0x40, 0x05, 0x00, 0x14, 0x00, 0x50, 0x01, 0x40, + 0x05, 0x00, 0x14, 0x01, 0x8F, 0xE2, 0x19, 0xB5, 0xFB, 0x5F, 0x0F, 0xEB, 0x97, 0x1E, 0x13, 0xD3, + 0x34, 0x6D, 0x6B, 0xC5, 0x36, 0xFA, 0x3D, 0xCC, 0xDE, 0x1A, 0xD1, 0xBC, 0x43, 0xAE, 0x4F, 0xE1, + 0x7F, 0x0F, 0xEA, 0xDA, 0x82, 0x40, 0xC6, 0xCA, 0xD6, 0xFB, 0x53, 0x86, 0xD2, 0xF2, 0x6B, 0x4B, + 0x79, 0x25, 0x11, 0x24, 0x93, 0xC7, 0x69, 0x74, 0xF1, 0x23, 0x33, 0xAC, 0x12, 0x95, 0x11, 0xB0, + 0x07, 0xC5, 0xFE, 0x1E, 0xB4, 0xFD, 0xB2, 0x7C, 0x31, 0xE2, 0x5F, 0x1E, 0xF8, 0xBF, 0x49, 0xFD, + 0x99, 0x3F, 0x64, 0xE8, 0xF5, 0xFF, 0x00, 0x89, 0x5A, 0xB5, 0x8E, 0xB1, 0xE2, 0xAB, 0xD9, 0xFF, + 0x00, 0x6E, 0x6F, 0x1B, 0xDD, 0x0B, 0x99, 0x34, 0xDD, 0x2A, 0xDF, 0x4F, 0xB3, 0x8A, 0x08, 0xDB, + 0xE1, 0x59, 0x58, 0x61, 0x48, 0x2C, 0x90, 0x88, 0xE3, 0x0A, 0xBE, 0x64, 0x93, 0xC8, 0x46, 0xE9, + 0x58, 0x90, 0x0F, 0x7E, 0xF0, 0x0F, 0x82, 0xB5, 0xBD, 0x5F, 0x5E, 0xD2, 0xBE, 0x30, 0x7C, 0x5C, + 0xF0, 0x5F, 0x84, 0xBC, 0x31, 0xF1, 0x9E, 0xD3, 0xC2, 0x37, 0x5F, 0x0F, 0xED, 0xF4, 0xCF, 0x05, + 0x7C, 0x4A, 0xD4, 0xFE, 0x2A, 0x78, 0x2B, 0xC2, 0x5A, 0x4C, 0xDA, 0xA1, 0xB9, 0x9C, 0x68, 0xF7, + 0xF7, 0xBA, 0x46, 0x92, 0xE9, 0x35, 0xFF, 0x00, 0xD9, 0xF4, 0x87, 0xBC, 0x65, 0xD3, 0xE1, 0x2E, + 0x74, 0xFD, 0x3E, 0x26, 0x79, 0x56, 0xCE, 0x27, 0x20, 0x1E, 0xD5, 0x40, 0x05, 0x00, 0x14, 0x00, + 0x50, 0x01, 0x40, 0x05, 0x00, 0x14, 0x00, 0x50, 0x01, 0x40, 0x05, 0x00, 0x14, 0x00, 0x50, 0x01, + 0x40, 0x05, 0x00, 0x14, 0x00, 0x50, 0x01, 0x40, 0x05, 0x00, 0x14, 0x00, 0x50, 0x01, 0x40, 0x05, + 0x00, 0x14, 0x00, 0x50, 0x01, 0x40, 0x16, 0x28, 0x00, 0xA0, 0x02, 0x80, 0x0A, 0x00, 0x28, 0x00, + 0xA0, 0x0F, 0xF3, 0xF3, 0xFF, 0x00, 0x83, 0x9F, 0x7F, 0xE5, 0x39, 0xFF, 0x00, 0xF0, 0x48, 0x7F, + 0xFB, 0x05, 0x7C, 0x3D, 0xFF, 0x00, 0xD5, 0xBD, 0x73, 0x5D, 0x99, 0x67, 0xFC, 0x8C, 0x30, 0xFF, + 0x00, 0xE3, 0x87, 0xFE, 0x94, 0x8E, 0x7C, 0x4F, 0xFB, 0xAD, 0x4F, 0xF0, 0xBF, 0xC8, 0xFB, 0x52, + 0xBF, 0x53, 0x3E, 0x38, 0x28, 0x00, 0xA0, 0x02, 0x80, 0x3F, 0x60, 0xBF, 0xE0, 0x88, 0x5F, 0xF2, + 0x22, 0x7E, 0xDD, 0x7F, 0xF6, 0x7C, 0xF0, 0x7F, 0xEA, 0x86, 0xF8, 0x65, 0x5F, 0x9D, 0x71, 0x07, + 0xFC, 0x8D, 0x27, 0xE9, 0x1F, 0xFD, 0x25, 0x1F, 0x51, 0x95, 0xFF, 0x00, 0xB9, 0x47, 0xE7, 0xF9, + 0x9F, 0xB6, 0xD5, 0xE2, 0x9E, 0x88, 0x50, 0x01, 0x40, 0x05, 0x00, 0x14, 0x00, 0x50, 0x01, 0x40, + 0x05, 0x00, 0x14, 0x00, 0x87, 0xEE, 0x9F, 0xF7, 0x7F, 0xA5, 0x00, 0x41, 0x40, 0x05, 0x00, 0x14, + 0x00, 0x50, 0x01, 0x40, 0x05, 0x00, 0x14, 0x00, 0x50, 0x01, 0x40, 0x05, 0x00, 0x14, 0x00, 0x50, + 0x01, 0x40, 0x05, 0x00, 0x14, 0x00, 0x50, 0x01, 0x40, 0x05, 0x00, 0x14, 0x00, 0x50, 0x01, 0x40, + 0x05, 0x00, 0x14, 0x00, 0x50, 0x01, 0x40, 0x05, 0x00, 0x14, 0x00, 0x50, 0x01, 0x40, 0x05, 0x00, + 0x14, 0x00, 0x50, 0x01, 0x40, 0x05, 0x00, 0x14, 0x00, 0x50, 0x01, 0x40, 0x05, 0x00, 0x14, 0x00, + 0x50, 0x01, 0x40, 0x05, 0x00, 0x14, 0x00, 0x50, 0x01, 0x40, 0x05, 0x00, 0x58, 0xA0, 0x02, 0x80, + 0x0A, 0x00, 0x28, 0x00, 0xA0, 0x02, 0x80, 0x3F, 0xCF, 0xCF, 0xFE, 0x0E, 0x7D, 0xFF, 0x00, 0x94, + 0xE7, 0xFF, 0x00, 0xC1, 0x21, 0xFF, 0x00, 0xEC, 0x15, 0xF0, 0xF7, 0xFF, 0x00, 0x56, 0xF5, 0xCD, + 0x76, 0x65, 0x9F, 0xF2, 0x30, 0xC3, 0xFF, 0x00, 0x8E, 0x1F, 0xFA, 0x52, 0x39, 0xF1, 0x3F, 0xEE, + 0xB5, 0x3F, 0xC2, 0xFF, 0x00, 0x23, 0xED, 0x4A, 0xFD, 0x4C, 0xF8, 0xE0, 0xA0, 0x02, 0x80, 0x0A, + 0x00, 0xFD, 0x82, 0xFF, 0x00, 0x82, 0x21, 0x7F, 0xC8, 0x89, 0xFB, 0x75, 0xFF, 0x00, 0xD9, 0xF3, + 0xC1, 0xFF, 0x00, 0xAA, 0x1B, 0xE1, 0x95, 0x7E, 0x75, 0xC4, 0x1F, 0xF2, 0x34, 0x9F, 0xA4, 0x7F, + 0xF4, 0x94, 0x7D, 0x46, 0x57, 0xFE, 0xE5, 0x1F, 0x9F, 0xE6, 0x7E, 0xDB, 0x57, 0x8A, 0x7A, 0x21, + 0x40, 0x05, 0x00, 0x14, 0x00, 0x50, 0x01, 0x40, 0x05, 0x00, 0x14, 0x00, 0x50, 0x01, 0x81, 0x8C, + 0x63, 0x8C, 0x63, 0x1D, 0x38, 0xC7, 0x4A, 0x00, 0x6E, 0xC5, 0xF4, 0xA0, 0x03, 0x62, 0xFA, 0x50, + 0x01, 0xB1, 0x7D, 0x28, 0x00, 0xD8, 0xBE, 0x94, 0x00, 0x6C, 0x5F, 0x4A, 0x00, 0x36, 0x2F, 0xA5, + 0x00, 0x1B, 0x17, 0xD2, 0x80, 0x0D, 0x8B, 0xE9, 0x40, 0x06, 0xC5, 0xF4, 0xA0, 0x03, 0x62, 0xFA, + 0x50, 0x01, 0xB1, 0x7D, 0x28, 0x00, 0xD8, 0xBE, 0x94, 0x00, 0x6C, 0x5F, 0x4A, 0x00, 0x36, 0x2F, + 0xA5, 0x00, 0x1B, 0x17, 0xD2, 0x80, 0x0D, 0x8B, 0xE9, 0x40, 0x06, 0xC5, 0xF4, 0xA0, 0x03, 0x62, + 0xFA, 0x50, 0x01, 0xB1, 0x7D, 0x28, 0x00, 0xD8, 0xBE, 0x94, 0x00, 0x6C, 0x5F, 0x4A, 0x00, 0x36, + 0x2F, 0xA5, 0x00, 0x1B, 0x17, 0xD2, 0x80, 0x0D, 0x8B, 0xE9, 0x40, 0x06, 0xC5, 0xF4, 0xA0, 0x03, + 0x62, 0xFA, 0x50, 0x01, 0xB1, 0x7D, 0x28, 0x00, 0xD8, 0xBE, 0x94, 0x00, 0x6C, 0x5F, 0x4A, 0x00, + 0x36, 0x2F, 0xA5, 0x00, 0x1B, 0x17, 0xD2, 0x80, 0x0D, 0x8B, 0xE9, 0x40, 0x06, 0xC5, 0xF4, 0xA0, + 0x03, 0x62, 0xFA, 0x50, 0x01, 0xB1, 0x7D, 0x28, 0x00, 0xD8, 0xBE, 0x94, 0x00, 0x6C, 0x5F, 0x4A, + 0x00, 0x36, 0x2F, 0xA5, 0x00, 0x1B, 0x17, 0xD2, 0x80, 0x0D, 0x8B, 0xE9, 0x40, 0x06, 0xC5, 0xF4, + 0xA0, 0x03, 0x62, 0xFA, 0x50, 0x01, 0xB1, 0x7D, 0x28, 0x00, 0xD8, 0xBE, 0x94, 0x00, 0x6C, 0x5F, + 0x4A, 0x00, 0x36, 0x2F, 0xA5, 0x00, 0x3A, 0x80, 0x0A, 0x00, 0x28, 0x00, 0xA0, 0x02, 0x80, 0x0A, + 0x00, 0xFF, 0x00, 0x3F, 0x3F, 0xF8, 0x39, 0xF7, 0xFE, 0x53, 0x9F, 0xFF, 0x00, 0x04, 0x87, 0xFF, + 0x00, 0xB0, 0x57, 0xC3, 0xDF, 0xFD, 0x5B, 0xD7, 0x35, 0xD9, 0x96, 0x7F, 0xC8, 0xC3, 0x0F, 0xFE, + 0x38, 0x7F, 0xE9, 0x48, 0xE7, 0xC4, 0xFF, 0x00, 0xBA, 0xD4, 0xFF, 0x00, 0x0B, 0xFC, 0x8F, 0xB5, + 0x2B, 0xF5, 0x33, 0xE3, 0x82, 0x80, 0x0A, 0x00, 0x28, 0x03, 0xF6, 0x0B, 0xFE, 0x08, 0x85, 0xFF, + 0x00, 0x22, 0x27, 0xED, 0xD7, 0xFF, 0x00, 0x67, 0xCF, 0x07, 0xFE, 0xA8, 0x6F, 0x86, 0x55, 0xF9, + 0xD7, 0x10, 0x7F, 0xC8, 0xD2, 0x7E, 0x91, 0xFF, 0x00, 0xD2, 0x51, 0xF5, 0x19, 0x5F, 0xFB, 0x94, + 0x7E, 0x7F, 0x99, 0xFB, 0x6D, 0x5E, 0x29, 0xE8, 0x85, 0x00, 0x14, 0x00, 0x50, 0x01, 0x40, 0x05, + 0x00, 0x14, 0x00, 0x50, 0x01, 0x40, 0x05, 0x00, 0x14, 0x00, 0x50, 0x01, 0x40, 0x05, 0x00, 0x14, + 0x00, 0x50, 0x01, 0x40, 0x05, 0x00, 0x14, 0x00, 0x50, 0x01, 0x40, 0x05, 0x00, 0x14, 0x00, 0x50, + 0x01, 0x40, 0x05, 0x00, 0x14, 0x00, 0x50, 0x01, 0x40, 0x05, 0x00, 0x14, 0x00, 0x50, 0x01, 0x40, + 0x05, 0x00, 0x14, 0x00, 0x50, 0x01, 0x40, 0x05, 0x00, 0x14, 0x00, 0x50, 0x01, 0x40, 0x05, 0x00, + 0x14, 0x00, 0x50, 0x01, 0x40, 0x05, 0x00, 0x14, 0x00, 0x50, 0x01, 0x40, 0x05, 0x00, 0x14, 0x00, + 0x50, 0x01, 0x40, 0x05, 0x00, 0x14, 0x00, 0x50, 0x01, 0x40, 0x05, 0x00, 0x14, 0x00, 0x50, 0x01, + 0x40, 0x05, 0x00, 0x7F, 0x9F, 0x9F, 0xFC, 0x1C, 0xFB, 0xFF, 0x00, 0x29, 0xCF, 0xFF, 0x00, 0x82, + 0x43, 0xFF, 0x00, 0xD8, 0x2B, 0xE1, 0xEF, 0xFE, 0xAD, 0xEB, 0x9A, 0xEC, 0xCB, 0x3F, 0xE4, 0x61, + 0x87, 0xFF, 0x00, 0x1C, 0x3F, 0xF4, 0xA4, 0x73, 0xE2, 0x7F, 0xDD, 0x6A, 0x7F, 0x85, 0xFE, 0x47, + 0xDA, 0x95, 0xFA, 0x99, 0xF1, 0xC1, 0x40, 0x05, 0x00, 0x14, 0x01, 0xFB, 0x05, 0xFF, 0x00, 0x04, + 0x42, 0xFF, 0x00, 0x91, 0x13, 0xF6, 0xEB, 0xFF, 0x00, 0xB3, 0xE7, 0x83, 0xFF, 0x00, 0x54, 0x37, + 0xC3, 0x2A, 0xFC, 0xEB, 0x88, 0x3F, 0xE4, 0x69, 0x3F, 0x48, 0xFF, 0x00, 0xE9, 0x28, 0xFA, 0x8C, + 0xAF, 0xFD, 0xCA, 0x3F, 0x3F, 0xCC, 0xFD, 0xB6, 0xAF, 0x14, 0xF4, 0x42, 0x80, 0x0A, 0x00, 0x28, + 0x00, 0xA0, 0x02, 0x80, 0x0A, 0x00, 0x28, 0x00, 0xA0, 0x02, 0x80, 0x0A, 0x00, 0x28, 0x00, 0xA0, + 0x02, 0x80, 0x0A, 0x00, 0x28, 0x00, 0xA0, 0x02, 0x80, 0x0A, 0x00, 0x28, 0x00, 0xA0, 0x02, 0x80, + 0x0A, 0x00, 0x28, 0x00, 0xA0, 0x02, 0x80, 0x0A, 0x00, 0x28, 0x00, 0xA0, 0x02, 0x80, 0x0A, 0x00, + 0x28, 0x00, 0xA0, 0x02, 0x80, 0x0A, 0x00, 0x28, 0x00, 0xA0, 0x02, 0x80, 0x0A, 0x00, 0x28, 0x00, + 0xA0, 0x02, 0x80, 0x0A, 0x00, 0x28, 0x00, 0xA0, 0x02, 0x80, 0x0A, 0x00, 0x28, 0x00, 0xA0, 0x02, + 0x80, 0x0A, 0x00, 0x28, 0x00, 0xA0, 0x02, 0x80, 0x0A, 0x00, 0x28, 0x00, 0xA0, 0x02, 0x80, 0x0A, + 0x00, 0x28, 0x00, 0xA0, 0x02, 0x80, 0x3F, 0xCF, 0xCF, 0xFE, 0x0E, 0x7D, 0xFF, 0x00, 0x94, 0xE7, + 0xFF, 0x00, 0xC1, 0x21, 0xFF, 0x00, 0xEC, 0x15, 0xF0, 0xF7, 0xFF, 0x00, 0x56, 0xF5, 0xCD, 0x76, + 0x65, 0x9F, 0xF2, 0x30, 0xC3, 0xFF, 0x00, 0x8E, 0x1F, 0xFA, 0x52, 0x39, 0xF1, 0x3F, 0xEE, 0xB5, + 0x3F, 0xC2, 0xFF, 0x00, 0x23, 0xED, 0x4A, 0xFD, 0x4C, 0xF8, 0xE0, 0xA0, 0x02, 0x80, 0x0A, 0x00, + 0xFD, 0x82, 0xFF, 0x00, 0x82, 0x21, 0x7F, 0xC8, 0x89, 0xFB, 0x75, 0xFF, 0x00, 0xD9, 0xF3, 0xC1, + 0xFF, 0x00, 0xAA, 0x1B, 0xE1, 0x95, 0x7E, 0x75, 0xC4, 0x1F, 0xF2, 0x34, 0x9F, 0xA4, 0x7F, 0xF4, + 0x94, 0x7D, 0x46, 0x57, 0xFE, 0xE5, 0x1F, 0x9F, 0xE6, 0x7E, 0xDB, 0x57, 0x8A, 0x7A, 0x21, 0x40, + 0x05, 0x00, 0x14, 0x00, 0x50, 0x01, 0x40, 0x05, 0x00, 0x14, 0x00, 0x50, 0x01, 0x40, 0x05, 0x00, + 0x14, 0x00, 0x50, 0x01, 0x40, 0x05, 0x00, 0x14, 0x00, 0x50, 0x01, 0x40, 0x05, 0x00, 0x14, 0x00, + 0x50, 0x01, 0x40, 0x05, 0x00, 0x14, 0x00, 0x50, 0x01, 0x40, 0x05, 0x00, 0x14, 0x00, 0x50, 0x01, + 0x40, 0x05, 0x00, 0x14, 0x00, 0x50, 0x01, 0x40, 0x05, 0x00, 0x14, 0x00, 0x50, 0x01, 0x40, 0x05, + 0x00, 0x14, 0x00, 0x50, 0x01, 0x40, 0x05, 0x00, 0x14, 0x00, 0x50, 0x01, 0x40, 0x05, 0x00, 0x14, + 0x00, 0x50, 0x01, 0x40, 0x05, 0x00, 0x14, 0x00, 0x50, 0x01, 0x40, 0x05, 0x00, 0x14, 0x00, 0x50, + 0x01, 0x40, 0x05, 0x00, 0x14, 0x00, 0x50, 0x01, 0x40, 0x1F, 0xE7, 0xE7, 0xFF, 0x00, 0x07, 0x3E, + 0xFF, 0x00, 0xCA, 0x73, 0xFF, 0x00, 0xE0, 0x90, 0xFF, 0x00, 0xF6, 0x0A, 0xF8, 0x7B, 0xFF, 0x00, + 0xAB, 0x7A, 0xE6, 0xBB, 0x32, 0xCF, 0xF9, 0x18, 0x61, 0xFF, 0x00, 0xC7, 0x0F, 0xFD, 0x29, 0x1C, + 0xF8, 0x9F, 0xF7, 0x5A, 0x9F, 0xE1, 0x7F, 0x91, 0xF6, 0xA5, 0x7E, 0xA6, 0x7C, 0x70, 0x50, 0x01, + 0x40, 0x05, 0x00, 0x7E, 0xC1, 0x7F, 0xC1, 0x10, 0xBF, 0xE4, 0x44, 0xFD, 0xBA, 0xFF, 0x00, 0xEC, + 0xF9, 0xE0, 0xFF, 0x00, 0xD5, 0x0D, 0xF0, 0xCA, 0xBF, 0x3A, 0xE2, 0x0F, 0xF9, 0x1A, 0x4F, 0xD2, + 0x3F, 0xFA, 0x4A, 0x3E, 0xA3, 0x2B, 0xFF, 0x00, 0x72, 0x8F, 0xCF, 0xF3, 0x3F, 0x6D, 0xAB, 0xC5, + 0x3D, 0x10, 0xA0, 0x02, 0x80, 0x0A, 0x00, 0x28, 0x00, 0xA0, 0x02, 0x80, 0x0A, 0x00, 0x28, 0x00, + 0xA0, 0x02, 0x80, 0x0A, 0x00, 0x28, 0x00, 0xA0, 0x02, 0x80, 0x0A, 0x00, 0x28, 0x00, 0xA0, 0x02, + 0x80, 0x0A, 0x00, 0x28, 0x00, 0xA0, 0x02, 0x80, 0x0A, 0x00, 0x28, 0x00, 0xA0, 0x02, 0x80, 0x0A, + 0x00, 0x28, 0x00, 0xA0, 0x02, 0x80, 0x0A, 0x00, 0x28, 0x00, 0xA0, 0x02, 0x80, 0x0A, 0x00, 0x28, + 0x00, 0xA0, 0x02, 0x80, 0x0A, 0x00, 0x28, 0x00, 0xA0, 0x02, 0x80, 0x0A, 0x00, 0x28, 0x00, 0xA0, + 0x02, 0x80, 0x0A, 0x00, 0x28, 0x00, 0xA0, 0x02, 0x80, 0x0A, 0x00, 0x28, 0x00, 0xA0, 0x02, 0x80, + 0x0A, 0x00, 0x28, 0x00, 0xA0, 0x02, 0x80, 0x0A, 0x00, 0x28, 0x00, 0xA0, 0x0F, 0xF3, 0xF3, 0xFF, + 0x00, 0x83, 0x9F, 0x7F, 0xE5, 0x39, 0xFF, 0x00, 0xF0, 0x48, 0x7F, 0xFB, 0x05, 0x7C, 0x3D, 0xFF, + 0x00, 0xD5, 0xBD, 0x73, 0x5D, 0x99, 0x67, 0xFC, 0x8C, 0x30, 0xFF, 0x00, 0xE3, 0x87, 0xFE, 0x94, + 0x8E, 0x7C, 0x4F, 0xFB, 0xAD, 0x4F, 0xF0, 0xBF, 0xC8, 0xFB, 0x52, 0xBF, 0x53, 0x3E, 0x38, 0x28, + 0x00, 0xA0, 0x02, 0x80, 0x3F, 0x60, 0xBF, 0xE0, 0x88, 0x5F, 0xF2, 0x22, 0x7E, 0xDD, 0x7F, 0xF6, + 0x7C, 0xF0, 0x7F, 0xEA, 0x86, 0xF8, 0x65, 0x5F, 0x9D, 0x71, 0x07, 0xFC, 0x8D, 0x27, 0xE9, 0x1F, + 0xFD, 0x25, 0x1F, 0x51, 0x95, 0xFF, 0x00, 0xB9, 0x47, 0xE7, 0xF9, 0x9F, 0xB6, 0xD5, 0xE2, 0x9E, + 0x88, 0x50, 0x01, 0x40, 0x05, 0x00, 0x14, 0x00, 0x50, 0x01, 0x40, 0x05, 0x00, 0x14, 0x00, 0x50, + 0x01, 0x40, 0x05, 0x00, 0x14, 0x00, 0x50, 0x01, 0x40, 0x05, 0x00, 0x14, 0x00, 0x50, 0x01, 0x40, + 0x05, 0x00, 0x14, 0x00, 0x50, 0x01, 0x40, 0x05, 0x00, 0x14, 0x00, 0x50, 0x01, 0x40, 0x05, 0x00, + 0x14, 0x00, 0x50, 0x01, 0x40, 0x05, 0x00, 0x14, 0x00, 0x50, 0x01, 0x40, 0x05, 0x00, 0x14, 0x00, + 0x50, 0x01, 0x40, 0x05, 0x00, 0x14, 0x00, 0x50, 0x01, 0x40, 0x05, 0x00, 0x14, 0x00, 0x50, 0x01, + 0x40, 0x05, 0x00, 0x14, 0x00, 0x50, 0x01, 0x40, 0x05, 0x00, 0x14, 0x00, 0x50, 0x01, 0x40, 0x05, + 0x00, 0x14, 0x00, 0x50, 0x01, 0x40, 0x05, 0x00, 0x14, 0x00, 0x50, 0x07, 0xF9, 0xF9, 0xFF, 0x00, + 0xC1, 0xCF, 0xBF, 0xF2, 0x9C, 0xFF, 0x00, 0xF8, 0x24, 0x3F, 0xFD, 0x82, 0xBE, 0x1E, 0xFF, 0x00, + 0xEA, 0xDE, 0xB9, 0xAE, 0xCC, 0xB3, 0xFE, 0x46, 0x18, 0x7F, 0xF1, 0xC3, 0xFF, 0x00, 0x4A, 0x47, + 0x3E, 0x27, 0xFD, 0xD6, 0xA7, 0xF8, 0x5F, 0xE4, 0x7D, 0xA9, 0x5F, 0xA9, 0x9F, 0x1C, 0x14, 0x00, + 0x50, 0x01, 0x40, 0x1F, 0xB0, 0x5F, 0xF0, 0x44, 0x2F, 0xF9, 0x11, 0x3F, 0x6E, 0xBF, 0xFB, 0x3E, + 0x78, 0x3F, 0xF5, 0x43, 0x7C, 0x32, 0xAF, 0xCE, 0xB8, 0x83, 0xFE, 0x46, 0x93, 0xF4, 0x8F, 0xFE, + 0x92, 0x8F, 0xA8, 0xCA, 0xFF, 0x00, 0xDC, 0xA3, 0xF3, 0xFC, 0xCF, 0xDB, 0x6A, 0xF1, 0x4F, 0x44, + 0x28, 0x00, 0xA0, 0x02, 0x80, 0x0A, 0x00, 0x28, 0x00, 0xA0, 0x02, 0x80, 0x0A, 0x00, 0x28, 0x00, + 0xA0, 0x02, 0x80, 0x0A, 0x00, 0x28, 0x00, 0xA0, 0x02, 0x80, 0x0A, 0x00, 0x28, 0x00, 0xA0, 0x02, + 0x80, 0x0A, 0x00, 0x28, 0x00, 0xA0, 0x02, 0x80, 0x0A, 0x00, 0x28, 0x00, 0xA0, 0x02, 0x80, 0x0A, + 0x00, 0x28, 0x00, 0xA0, 0x02, 0x80, 0x0A, 0x00, 0x28, 0x00, 0xA0, 0x02, 0x80, 0x0A, 0x00, 0x28, + 0x00, 0xA0, 0x02, 0x80, 0x0A, 0x00, 0x28, 0x00, 0xA0, 0x02, 0x80, 0x0A, 0x00, 0x28, 0x00, 0xA0, + 0x02, 0x80, 0x0A, 0x00, 0x28, 0x00, 0xA0, 0x02, 0x80, 0x0A, 0x00, 0x28, 0x00, 0xA0, 0x02, 0x80, + 0x0A, 0x00, 0x28, 0x00, 0xA0, 0x02, 0x80, 0x0A, 0x00, 0x28, 0x03, 0xFC, 0xFC, 0xFF, 0x00, 0xE0, + 0xE7, 0xDF, 0xF9, 0x4E, 0x7F, 0xFC, 0x12, 0x1F, 0xFE, 0xC1, 0x5F, 0x0F, 0x7F, 0xF5, 0x6F, 0x5C, + 0xD7, 0x66, 0x59, 0xFF, 0x00, 0x23, 0x0C, 0x3F, 0xF8, 0xE1, 0xFF, 0x00, 0xA5, 0x23, 0x9F, 0x13, + 0xFE, 0xEB, 0x53, 0xFC, 0x2F, 0xF2, 0x3E, 0xD4, 0xAF, 0xD4, 0xCF, 0x8E, 0x0A, 0x00, 0x28, 0x00, + 0xA0, 0x0F, 0xD8, 0x2F, 0xF8, 0x22, 0x17, 0xFC, 0x88, 0x9F, 0xB7, 0x5F, 0xFD, 0x9F, 0x3C, 0x1F, + 0xFA, 0xA1, 0xBE, 0x19, 0x57, 0xE7, 0x5C, 0x41, 0xFF, 0x00, 0x23, 0x49, 0xFA, 0x47, 0xFF, 0x00, + 0x49, 0x47, 0xD4, 0x65, 0x7F, 0xEE, 0x51, 0xF9, 0xFE, 0x67, 0xED, 0xB5, 0x78, 0xA7, 0xA2, 0x14, + 0x00, 0x50, 0x01, 0x40, 0x05, 0x00, 0x14, 0x00, 0x50, 0x01, 0x40, 0x05, 0x00, 0x14, 0x00, 0x50, + 0x01, 0x40, 0x05, 0x00, 0x14, 0x00, 0x50, 0x01, 0x40, 0x05, 0x00, 0x14, 0x00, 0x50, 0x01, 0x40, + 0x05, 0x00, 0x14, 0x00, 0x50, 0x01, 0x40, 0x05, 0x00, 0x14, 0x00, 0x50, 0x01, 0x40, 0x05, 0x00, + 0x14, 0x00, 0x50, 0x01, 0x40, 0x05, 0x00, 0x14, 0x00, 0x50, 0x01, 0x40, 0x05, 0x00, 0x14, 0x00, + 0x50, 0x01, 0x40, 0x05, 0x00, 0x14, 0x00, 0x50, 0x01, 0x40, 0x05, 0x00, 0x14, 0x00, 0x50, 0x01, + 0x40, 0x05, 0x00, 0x14, 0x00, 0x50, 0x01, 0x40, 0x05, 0x00, 0x14, 0x00, 0x50, 0x01, 0x40, 0x05, + 0x00, 0x14, 0x00, 0x50, 0x01, 0x40, 0x05, 0x00, 0x14, 0x01, 0xFE, 0x7E, 0x7F, 0xF0, 0x73, 0xEF, + 0xFC, 0xA7, 0x3F, 0xFE, 0x09, 0x0F, 0xFF, 0x00, 0x60, 0xAF, 0x87, 0xBF, 0xFA, 0xB7, 0xAE, 0x6B, + 0xB3, 0x2C, 0xFF, 0x00, 0x91, 0x86, 0x1F, 0xFC, 0x70, 0xFF, 0x00, 0xD2, 0x91, 0xCF, 0x89, 0xFF, + 0x00, 0x75, 0xA9, 0xFE, 0x17, 0xF9, 0x1F, 0x6A, 0x57, 0xEA, 0x67, 0xC7, 0x05, 0x00, 0x14, 0x00, + 0x50, 0x07, 0xEC, 0x0F, 0xFC, 0x11, 0x0F, 0x8F, 0x01, 0xFE, 0xDD, 0x98, 0x03, 0x8F, 0xDB, 0x9E, + 0x1C, 0x0C, 0x71, 0xC7, 0xC0, 0x6F, 0x86, 0x58, 0x18, 0xFC, 0x05, 0x7E, 0x75, 0xC4, 0x1F, 0xF2, + 0x34, 0x9F, 0xA4, 0x7F, 0xF4, 0x94, 0x7D, 0x46, 0x57, 0xFE, 0xE5, 0x1F, 0x9F, 0xE6, 0x7E, 0xD2, + 0xEA, 0x1A, 0xA5, 0x86, 0x91, 0x65, 0x3E, 0xA3, 0xA9, 0xDD, 0xDA, 0xE9, 0xF6, 0x16, 0x91, 0x99, + 0x6E, 0x2E, 0xEE, 0xE5, 0x58, 0x2D, 0xE1, 0x50, 0x3A, 0x96, 0x38, 0x1D, 0xBA, 0x0F, 0xC2, 0xBC, + 0x68, 0xC5, 0xC9, 0xA8, 0xC5, 0x6B, 0xD1, 0x23, 0xBD, 0xB8, 0xC2, 0x37, 0x6E, 0xC8, 0xF3, 0xBD, + 0x3F, 0xE3, 0x1F, 0x82, 0xF5, 0x52, 0x4E, 0x9B, 0x79, 0x2C, 0xD6, 0xA8, 0x8C, 0xEF, 0xA8, 0x4D, + 0x6A, 0xF6, 0x9A, 0x64, 0x4A, 0xA3, 0xAB, 0xCC, 0xD8, 0x0A, 0x0E, 0x30, 0x33, 0x8C, 0xF1, 0x5B, + 0xAC, 0x25, 0x7D, 0x23, 0x18, 0xDD, 0xBD, 0x12, 0x5A, 0xBF, 0x44, 0x96, 0xBF, 0x77, 0xF9, 0x1C, + 0xEB, 0x15, 0x41, 0x26, 0xEF, 0x68, 0xA5, 0xBB, 0xD1, 0x76, 0xFE, 0xBA, 0x1A, 0xDF, 0xF0, 0xB2, + 0x7C, 0x2E, 0x93, 0xC3, 0x6C, 0xD7, 0xF0, 0xBB, 0x39, 0x09, 0x24, 0x96, 0xA4, 0x5C, 0xDA, 0xD9, + 0x64, 0x70, 0x67, 0x90, 0x7C, 0xB1, 0x83, 0x85, 0x00, 0x1E, 0x49, 0x2A, 0x00, 0xE6, 0xB3, 0x95, + 0x1A, 0x94, 0xE0, 0xE5, 0x52, 0x2E, 0x29, 0x2E, 0xAA, 0xDF, 0x72, 0x7F, 0xA6, 0x9A, 0x1A, 0xD2, + 0xAB, 0x4E, 0xB4, 0xE3, 0x4E, 0x8B, 0xBB, 0x6D, 0x24, 0x97, 0x77, 0xA2, 0x5F, 0x96, 0x9E, 0x87, + 0x87, 0xFC, 0x10, 0xFD, 0xAD, 0x3C, 0x27, 0xF1, 0xFB, 0xE2, 0xD7, 0xC6, 0x6F, 0x86, 0xBE, 0x03, + 0xF0, 0xBF, 0x89, 0x1B, 0x44, 0xF8, 0x29, 0x06, 0x95, 0x69, 0xAD, 0xFC, 0x42, 0xD4, 0x52, 0x1B, + 0x6F, 0x0F, 0xEB, 0x5A, 0x9E, 0xA4, 0xF7, 0x3B, 0xB4, 0xEB, 0x18, 0x55, 0x9A, 0x43, 0xE5, 0x43, + 0x69, 0x1C, 0x85, 0xDF, 0x69, 0x22, 0x55, 0x1B, 0x14, 0x05, 0x2F, 0xF3, 0xF9, 0x4E, 0x77, 0x4B, + 0x37, 0xC5, 0x62, 0xA8, 0xE1, 0x69, 0xB5, 0x4A, 0x83, 0x8C, 0x1C, 0xDD, 0x92, 0x94, 0xDA, 0x72, + 0x6A, 0x29, 0x74, 0x84, 0x79, 0x5B, 0x6E, 0xD7, 0xE6, 0x49, 0x2B, 0x2B, 0x9F, 0xA0, 0x71, 0x7F, + 0x01, 0xE2, 0xF8, 0x27, 0x2A, 0xCA, 0x31, 0x39, 0xAE, 0x22, 0x0F, 0x17, 0x8E, 0xA7, 0x52, 0xB2, + 0xA1, 0x04, 0xDB, 0xA3, 0x46, 0x32, 0x8C, 0x29, 0xCE, 0xAC, 0x9D, 0x92, 0x95, 0x69, 0xAA, 0xAA, + 0x10, 0x8A, 0x92, 0x51, 0xA5, 0x26, 0xE7, 0x76, 0xA2, 0xBE, 0xAC, 0x0C, 0x78, 0x18, 0x00, 0x70, + 0x38, 0x18, 0xC0, 0xF6, 0xAF, 0x70, 0xF8, 0x42, 0x4A, 0x00, 0x28, 0x00, 0xA0, 0x02, 0x80, 0x0A, + 0x00, 0x28, 0x00, 0xA0, 0x02, 0x80, 0x0A, 0x00, 0x28, 0x00, 0xA0, 0x02, 0x80, 0x0A, 0x00, 0x28, + 0x00, 0xA0, 0x02, 0x80, 0x0A, 0x00, 0x28, 0x00, 0xA0, 0x02, 0x80, 0x0A, 0x00, 0x28, 0x00, 0xA0, + 0x02, 0x80, 0x0A, 0x00, 0x28, 0x00, 0xA0, 0x02, 0x80, 0x0A, 0x00, 0x28, 0x00, 0xA0, 0x02, 0x80, + 0x0A, 0x00, 0x28, 0x00, 0xA0, 0x02, 0x80, 0x0A, 0x00, 0x28, 0x00, 0xA0, 0x02, 0x80, 0x0A, 0x00, + 0x28, 0x00, 0xA0, 0x02, 0x80, 0x0A, 0x00, 0x28, 0x00, 0xA0, 0x02, 0x80, 0x0A, 0x00, 0x28, 0x00, + 0xA0, 0x02, 0x80, 0x0A, 0x00, 0x28, 0x00, 0xA0, 0x02, 0x80, 0x0A, 0x00, 0xFF, 0x00, 0x3F, 0x3F, + 0xF8, 0x39, 0xF7, 0xFE, 0x53, 0x9F, 0xFF, 0x00, 0x04, 0x87, 0xFF, 0x00, 0xB0, 0x57, 0xC3, 0xDF, + 0xFD, 0x5B, 0xD7, 0x35, 0xD9, 0x96, 0x7F, 0xC8, 0xC3, 0x0F, 0xFE, 0x38, 0x7F, 0xE9, 0x48, 0xE7, + 0xC4, 0xFF, 0x00, 0xBA, 0xD4, 0xFF, 0x00, 0x0B, 0xFC, 0x8F, 0xB5, 0x2B, 0xF5, 0x33, 0xE3, 0x82, + 0x80, 0x0A, 0x00, 0x28, 0x03, 0xF6, 0x07, 0xFE, 0x08, 0x88, 0x3F, 0xE2, 0x83, 0xFD, 0xBB, 0x00, + 0x1F, 0xF3, 0x7C, 0xD0, 0x80, 0x00, 0xFF, 0x00, 0xAA, 0x0D, 0xF0, 0xCB, 0x00, 0x0F, 0xCA, 0xBF, + 0x3A, 0xE2, 0x0F, 0xF9, 0x1A, 0x4F, 0xD2, 0x3F, 0xFA, 0x4A, 0x3E, 0xA3, 0x2B, 0xFF, 0x00, 0x72, + 0x8F, 0xCF, 0xF3, 0x3E, 0x97, 0xFD, 0xA5, 0x7E, 0x2D, 0x34, 0xDE, 0x21, 0xB9, 0xD1, 0x61, 0x96, + 0x39, 0x74, 0xAD, 0x06, 0xFB, 0xFB, 0x1B, 0x4A, 0xD3, 0x64, 0x6C, 0xD9, 0x6A, 0x5A, 0x8A, 0x45, + 0xBA, 0xEA, 0xE6, 0xE2, 0x3E, 0x03, 0xA4, 0x0A, 0xCA, 0x02, 0x9E, 0x09, 0x64, 0x07, 0x86, 0x61, + 0x5E, 0xE7, 0x09, 0x64, 0x51, 0xCC, 0x6B, 0x27, 0x51, 0xDA, 0x9A, 0x4A, 0x52, 0xB6, 0x8E, 0xD7, + 0xB2, 0x8A, 0x7D, 0x39, 0xAC, 0xEE, 0xD5, 0xAC, 0x93, 0xD9, 0xD9, 0x9F, 0x39, 0xC5, 0x19, 0xC5, + 0x5C, 0xBF, 0x0C, 0xFD, 0x84, 0x53, 0x9B, 0xD2, 0x2B, 0xA5, 0xEC, 0xAF, 0x26, 0xBA, 0xF2, 0xDD, + 0x24, 0xB6, 0x6D, 0xAD, 0x2D, 0x73, 0xE7, 0x18, 0xFE, 0x21, 0xF8, 0x9F, 0xC1, 0xDA, 0x2D, 0xFE, + 0xBB, 0x67, 0xE2, 0x6D, 0x59, 0xAD, 0xAC, 0xE5, 0x8E, 0xEF, 0x56, 0x94, 0xA2, 0x6A, 0x16, 0x2A, + 0xF2, 0x0D, 0x89, 0xE7, 0x40, 0x57, 0x6E, 0xCF, 0x9B, 0x6A, 0xA7, 0xCA, 0xA0, 0xE0, 0x28, 0x1C, + 0x63, 0xF4, 0x4C, 0x5E, 0x55, 0x93, 0x4E, 0x2A, 0x18, 0xBA, 0x10, 0x8C, 0x23, 0x16, 0xA3, 0xBC, + 0x5A, 0x4A, 0xCF, 0xDD, 0x6B, 0x54, 0xF4, 0x57, 0x69, 0x37, 0x6F, 0x2D, 0x0F, 0x81, 0xCA, 0xF1, + 0x79, 0xCA, 0xA9, 0x7A, 0x35, 0xE6, 0xE5, 0x27, 0x79, 0x27, 0x66, 0x9B, 0xDB, 0x54, 0xD3, 0xBD, + 0x96, 0xC9, 0xB4, 0x96, 0xCA, 0xC7, 0xCD, 0xFA, 0x67, 0xED, 0xE7, 0xF0, 0xC7, 0xE2, 0x47, 0xC5, + 0x2F, 0x89, 0x9A, 0x3E, 0x89, 0xAF, 0x6A, 0xDA, 0xEF, 0x8A, 0x7E, 0x0B, 0xFC, 0x38, 0xD7, 0xFC, + 0x49, 0xE2, 0x6F, 0x12, 0xE8, 0x36, 0x57, 0x1E, 0x13, 0xF0, 0x5E, 0x9D, 0x69, 0xA6, 0xBC, 0x56, + 0xD1, 0x59, 0xEA, 0x71, 0xDB, 0xDA, 0x8D, 0x3E, 0x49, 0x52, 0xFA, 0xEA, 0x03, 0xE4, 0xBD, 0xE4, + 0xB2, 0xAB, 0xBC, 0x8A, 0xE9, 0xFE, 0x8F, 0xB6, 0x2F, 0xC5, 0xF8, 0xBB, 0x38, 0xC3, 0x65, 0x99, + 0x06, 0x2A, 0x8E, 0x12, 0x2A, 0x34, 0xED, 0x6E, 0x4B, 0xBA, 0x8E, 0x32, 0xB3, 0x4E, 0xD3, 0x92, + 0xD1, 0xDB, 0x44, 0xA2, 0x96, 0xC9, 0xA4, 0x9B, 0x77, 0xFE, 0x82, 0xF0, 0xB7, 0x86, 0x71, 0x1C, + 0x49, 0xC6, 0xD9, 0x6E, 0x12, 0xB3, 0xE6, 0x6E, 0x71, 0x6E, 0x56, 0x50, 0x4E, 0x11, 0x69, 0xEB, + 0x05, 0xA5, 0xAF, 0x67, 0x77, 0xD3, 0x76, 0xD2, 0x56, 0xFD, 0x28, 0xFF, 0x00, 0x82, 0x64, 0xFC, + 0x31, 0x87, 0xC0, 0x5F, 0xB2, 0xE6, 0x81, 0xE3, 0x8B, 0xFB, 0xA4, 0xB9, 0xF1, 0x3F, 0xC7, 0xAB, + 0xF9, 0x7E, 0x36, 0xF8, 0xA6, 0xE4, 0x4F, 0x14, 0xF6, 0xD1, 0x2E, 0xB0, 0x8A, 0xDA, 0x54, 0x31, + 0x4A, 0xA0, 0x65, 0x23, 0xD3, 0x23, 0xD3, 0x81, 0x25, 0x98, 0x6E, 0xF3, 0x08, 0xC0, 0x38, 0x1F, + 0x27, 0xC3, 0xD9, 0x5A, 0xCA, 0x32, 0x8A, 0x38, 0x49, 0x2F, 0xDE, 0xB5, 0xCF, 0x51, 0xF7, 0x9C, + 0xFD, 0xE9, 0x7F, 0xE0, 0x37, 0x50, 0x5F, 0xDD, 0x8A, 0x3E, 0xAB, 0xC4, 0xAE, 0x2C, 0x5C, 0x67, + 0xC6, 0xB8, 0xEC, 0xDF, 0x0F, 0x2F, 0xF6, 0x48, 0x38, 0xD0, 0xC3, 0xAE, 0x91, 0xC3, 0xD0, 0x8A, + 0xA7, 0x4A, 0xCB, 0xA7, 0x3A, 0x8B, 0xAB, 0x2F, 0xEF, 0xD4, 0x91, 0xFA, 0x15, 0x14, 0xF6, 0xEE, + 0x91, 0xC9, 0x1C, 0xF6, 0xEF, 0x13, 0xAA, 0xBC, 0x6F, 0x1C, 0xC8, 0xC8, 0xCA, 0x47, 0xCA, 0x54, + 0x83, 0x82, 0x08, 0xC7, 0x4A, 0xF6, 0x8F, 0x85, 0x27, 0xF3, 0xA0, 0xFF, 0x00, 0x9E, 0xB1, 0x7F, + 0xDF, 0x6B, 0x40, 0x07, 0x9D, 0x07, 0xFC, 0xF5, 0x8B, 0xFE, 0xFB, 0x5A, 0x00, 0x3C, 0xE8, 0x3F, + 0xE7, 0xAC, 0x5F, 0xF7, 0xDA, 0xD0, 0x01, 0xE7, 0x41, 0xFF, 0x00, 0x3D, 0x62, 0xFF, 0x00, 0xBE, + 0xD6, 0x80, 0x0F, 0x3A, 0x0F, 0xF9, 0xEB, 0x17, 0xFD, 0xF6, 0xB4, 0x00, 0x79, 0xD0, 0x7F, 0xCF, + 0x58, 0xBF, 0xEF, 0xB5, 0xA0, 0x03, 0xCE, 0x83, 0xFE, 0x7A, 0xC5, 0xFF, 0x00, 0x7D, 0xAD, 0x00, + 0x1E, 0x74, 0x1F, 0xF3, 0xD6, 0x2F, 0xFB, 0xED, 0x68, 0x00, 0xF3, 0xA0, 0xFF, 0x00, 0x9E, 0xB1, + 0x7F, 0xDF, 0x6B, 0x40, 0x07, 0x9D, 0x07, 0xFC, 0xF5, 0x8B, 0xFE, 0xFB, 0x5A, 0x00, 0x3C, 0xE8, + 0x3F, 0xE7, 0xAC, 0x5F, 0xF7, 0xDA, 0xD0, 0x01, 0xE7, 0x41, 0xFF, 0x00, 0x3D, 0x62, 0xFF, 0x00, + 0xBE, 0xD6, 0x80, 0x0F, 0x3A, 0x0F, 0xF9, 0xEB, 0x17, 0xFD, 0xF6, 0xB4, 0x00, 0x79, 0xD0, 0x7F, + 0xCF, 0x58, 0xBF, 0xEF, 0xB5, 0xA0, 0x03, 0xCE, 0x83, 0xFE, 0x7A, 0xC5, 0xFF, 0x00, 0x7D, 0xAD, + 0x00, 0x1E, 0x74, 0x1F, 0xF3, 0xD6, 0x2F, 0xFB, 0xED, 0x68, 0x00, 0xF3, 0xA0, 0xFF, 0x00, 0x9E, + 0xB1, 0x7F, 0xDF, 0x6B, 0x40, 0x07, 0x9D, 0x07, 0xFC, 0xF5, 0x8B, 0xFE, 0xFB, 0x5A, 0x00, 0x3C, + 0xE8, 0x3F, 0xE7, 0xAC, 0x5F, 0xF7, 0xDA, 0xD0, 0x01, 0xE7, 0x41, 0xFF, 0x00, 0x3D, 0x62, 0xFF, + 0x00, 0xBE, 0xD6, 0x80, 0x0F, 0x3A, 0x0F, 0xF9, 0xEB, 0x17, 0xFD, 0xF6, 0xB4, 0x00, 0x79, 0xD0, + 0x7F, 0xCF, 0x58, 0xBF, 0xEF, 0xB5, 0xA0, 0x03, 0xCE, 0x83, 0xFE, 0x7A, 0xC5, 0xFF, 0x00, 0x7D, + 0xAD, 0x00, 0x1E, 0x74, 0x1F, 0xF3, 0xD6, 0x2F, 0xFB, 0xED, 0x68, 0x00, 0xF3, 0xA0, 0xFF, 0x00, + 0x9E, 0xB1, 0x7F, 0xDF, 0x6B, 0x40, 0x07, 0x9D, 0x07, 0xFC, 0xF5, 0x8B, 0xFE, 0xFB, 0x5A, 0x00, + 0x3C, 0xE8, 0x3F, 0xE7, 0xAC, 0x5F, 0xF7, 0xDA, 0xD0, 0x01, 0xE7, 0x41, 0xFF, 0x00, 0x3D, 0x62, + 0xFF, 0x00, 0xBE, 0xD6, 0x80, 0x0F, 0x3A, 0x0F, 0xF9, 0xEB, 0x17, 0xFD, 0xF6, 0xB4, 0x00, 0x79, + 0xD0, 0x7F, 0xCF, 0x58, 0xBF, 0xEF, 0xB5, 0xA0, 0x03, 0xCE, 0x83, 0xFE, 0x7A, 0xC5, 0xFF, 0x00, + 0x7D, 0xAD, 0x00, 0x1E, 0x74, 0x1F, 0xF3, 0xD6, 0x2F, 0xFB, 0xED, 0x68, 0x00, 0xF3, 0xA0, 0xFF, + 0x00, 0x9E, 0xB1, 0x7F, 0xDF, 0x6B, 0x40, 0x07, 0x9D, 0x07, 0xFC, 0xF5, 0x8B, 0xFE, 0xFB, 0x5A, + 0x00, 0x3C, 0xE8, 0x3F, 0xE7, 0xAC, 0x5F, 0xF7, 0xDA, 0xD0, 0x01, 0xE7, 0x41, 0xFF, 0x00, 0x3D, + 0x62, 0xFF, 0x00, 0xBE, 0xD6, 0x80, 0x0F, 0x3A, 0x0F, 0xF9, 0xEB, 0x17, 0xFD, 0xF6, 0xB4, 0x00, + 0x79, 0xD0, 0x7F, 0xCF, 0x58, 0xBF, 0xEF, 0xB5, 0xA0, 0x03, 0xCE, 0x83, 0xFE, 0x7A, 0xC5, 0xFF, + 0x00, 0x7D, 0xAD, 0x00, 0x1E, 0x74, 0x1F, 0xF3, 0xD6, 0x2F, 0xFB, 0xED, 0x68, 0x00, 0xF3, 0xA0, + 0xFF, 0x00, 0x9E, 0xB1, 0x7F, 0xDF, 0x6B, 0x40, 0x07, 0x9D, 0x07, 0xFC, 0xF5, 0x8B, 0xFE, 0xFB, + 0x5A, 0x00, 0x3C, 0xE8, 0x3F, 0xE7, 0xAC, 0x5F, 0xF7, 0xDA, 0xD0, 0x01, 0xE7, 0x41, 0xFF, 0x00, + 0x3D, 0x62, 0xFF, 0x00, 0xBE, 0xD6, 0x80, 0x0F, 0x3A, 0x0F, 0xF9, 0xEB, 0x17, 0xFD, 0xF6, 0xB4, + 0x00, 0x79, 0xD0, 0x7F, 0xCF, 0x58, 0xBF, 0xEF, 0xB5, 0xA0, 0x03, 0xCE, 0x83, 0xFE, 0x7A, 0xC5, + 0xFF, 0x00, 0x7D, 0xAD, 0x00, 0x1E, 0x74, 0x1F, 0xF3, 0xD6, 0x2F, 0xFB, 0xED, 0x68, 0x00, 0xF3, + 0xA0, 0xFF, 0x00, 0x9E, 0xB1, 0x7F, 0xDF, 0x6B, 0x40, 0x07, 0x9D, 0x07, 0xFC, 0xF5, 0x8B, 0xFE, + 0xFB, 0x5A, 0x00, 0x3C, 0xE8, 0x3F, 0xE7, 0xAC, 0x5F, 0xF7, 0xDA, 0xD0, 0x01, 0xE7, 0x41, 0xFF, + 0x00, 0x3D, 0x62, 0xFF, 0x00, 0xBE, 0xD6, 0x80, 0x0F, 0x3A, 0x0F, 0xF9, 0xEB, 0x17, 0xFD, 0xF6, + 0xB4, 0x00, 0x79, 0xD0, 0x7F, 0xCF, 0x58, 0xBF, 0xEF, 0xB5, 0xA0, 0x03, 0xCE, 0x83, 0xFE, 0x7A, + 0xC5, 0xFF, 0x00, 0x7D, 0xAD, 0x00, 0x3D, 0x1E, 0x37, 0xFF, 0x00, 0x56, 0xC8, 0xDB, 0x71, 0xF7, + 0x08, 0x38, 0xF4, 0xE9, 0xF4, 0xA0, 0x07, 0x0C, 0x76, 0xC7, 0x1C, 0x71, 0x8E, 0x31, 0xDB, 0xF9, + 0x50, 0x07, 0xF9, 0xF9, 0xFF, 0x00, 0xC1, 0xCF, 0xBF, 0xF2, 0x9C, 0xFF, 0x00, 0xF8, 0x24, 0x3F, + 0xFD, 0x82, 0xBE, 0x1E, 0xFF, 0x00, 0xEA, 0xDE, 0xB9, 0xAE, 0xCC, 0xB3, 0xFE, 0x46, 0x18, 0x7F, + 0xF1, 0xC3, 0xFF, 0x00, 0x4A, 0x47, 0x3E, 0x27, 0xFD, 0xD6, 0xA7, 0xF8, 0x5F, 0xE4, 0x7D, 0xA9, + 0x5F, 0xA9, 0x9F, 0x1C, 0x14, 0x00, 0x50, 0x01, 0x40, 0x1F, 0xB0, 0x5F, 0xF0, 0x44, 0x3C, 0x0F, + 0x01, 0xFE, 0xDD, 0x7C, 0x70, 0x3F, 0x6E, 0x78, 0x78, 0x00, 0x74, 0x1F, 0x01, 0xBE, 0x19, 0x70, + 0x07, 0xE1, 0x5F, 0x9D, 0x71, 0x07, 0xFC, 0x8D, 0x27, 0xE9, 0x1F, 0xFD, 0x25, 0x1F, 0x51, 0x95, + 0xFF, 0x00, 0xB9, 0x47, 0xE7, 0xF9, 0x9E, 0x5F, 0xFF, 0x00, 0x05, 0x05, 0xF8, 0x53, 0xFB, 0x61, + 0x6A, 0x7A, 0xCF, 0xC2, 0x9D, 0x67, 0xF6, 0x45, 0xF0, 0x55, 0xAF, 0x8B, 0xBC, 0x6B, 0xE0, 0x6F, + 0x8C, 0xFE, 0x36, 0x87, 0xE2, 0x5F, 0x87, 0x6F, 0xEC, 0x34, 0xF9, 0xB4, 0x6D, 0x73, 0x48, 0xD7, + 0xBC, 0x25, 0x72, 0xDE, 0x15, 0xBC, 0xBE, 0x8A, 0xEA, 0x78, 0x16, 0x68, 0x63, 0xD6, 0xA1, 0xD2, + 0xB7, 0x6D, 0x95, 0x02, 0x70, 0xD2, 0x1F, 0x25, 0x1C, 0x1D, 0xF0, 0x39, 0xC6, 0x2F, 0x2F, 0xA2, + 0xFE, 0xA7, 0x51, 0xC1, 0xB4, 0xAC, 0xD5, 0xB4, 0xB4, 0x5A, 0x6B, 0xE6, 0xDA, 0xB5, 0xBF, 0x03, + 0x8F, 0x15, 0x97, 0x61, 0xB1, 0x53, 0x51, 0xC4, 0xD3, 0x52, 0x49, 0xED, 0xF3, 0x56, 0x7F, 0x72, + 0xF4, 0xD9, 0x1E, 0x85, 0xFB, 0x2A, 0x78, 0x1B, 0xE2, 0x27, 0x84, 0xFE, 0x23, 0xF8, 0xEF, 0xE1, + 0x4F, 0xC5, 0x0F, 0x0C, 0xBF, 0x88, 0xBE, 0x0C, 0x7C, 0x40, 0xF8, 0x2F, 0xA8, 0x6B, 0x9A, 0xBF, + 0xC6, 0x4F, 0x16, 0xAD, 0xEE, 0x8D, 0xE2, 0xBF, 0x01, 0x6B, 0x3A, 0x9E, 0xA5, 0x2D, 0xD4, 0xFE, + 0x12, 0xBD, 0xB5, 0x2F, 0xFD, 0x9F, 0x25, 0xAE, 0x9D, 0x0D, 0xDD, 0x9C, 0x11, 0xDC, 0xDB, 0xB2, + 0x4B, 0x14, 0x96, 0x8A, 0x92, 0x83, 0xB5, 0x2E, 0x6E, 0x3A, 0x33, 0x6C, 0xF7, 0x33, 0xCC, 0x79, + 0x53, 0xA8, 0xB9, 0x23, 0x2E, 0x68, 0x28, 0xDA, 0xEA, 0x4E, 0xE9, 0xEC, 0x93, 0xB5, 0x9D, 0xA2, + 0x9E, 0xD1, 0x56, 0x77, 0x32, 0xCB, 0x72, 0x9C, 0x06, 0x0E, 0xEE, 0x30, 0xF7, 0x9C, 0x79, 0x64, + 0xF5, 0x4A, 0xDA, 0x59, 0x5A, 0xF6, 0xBE, 0x8A, 0xF6, 0xEB, 0xB5, 0x96, 0x87, 0xE0, 0xDF, 0xC3, + 0x2D, 0x53, 0x4B, 0xFD, 0x89, 0x7C, 0x03, 0xE2, 0xBF, 0xD9, 0xCF, 0xE2, 0xD7, 0xC0, 0xFF, 0x00, + 0x1E, 0x6A, 0x7F, 0x16, 0x9F, 0xC5, 0x7E, 0x1D, 0x87, 0xC4, 0xA9, 0xE0, 0xFF, 0x00, 0x09, 0xEB, + 0x9E, 0x35, 0xF0, 0xFF, 0x00, 0xED, 0x37, 0xA0, 0xE9, 0x12, 0xC2, 0x91, 0xE9, 0xFE, 0x18, 0xD7, + 0xEC, 0xEC, 0xA6, 0xD3, 0x17, 0x4E, 0xD4, 0xE1, 0xB6, 0x37, 0x22, 0x69, 0xE7, 0x52, 0x3E, 0xDD, + 0x2F, 0x9E, 0x91, 0xBC, 0x6C, 0xAD, 0xF1, 0x39, 0xBE, 0x0E, 0xB6, 0x61, 0x84, 0xC2, 0xE1, 0xE2, + 0xD2, 0x54, 0xAA, 0xC6, 0x72, 0x8C, 0xA2, 0xF9, 0x66, 0x94, 0x93, 0x6B, 0x99, 0x3B, 0xDD, 0x24, + 0xD2, 0x4E, 0x2E, 0x29, 0xA5, 0x7B, 0xA6, 0xED, 0xFA, 0x4F, 0x05, 0xF1, 0x0E, 0x0B, 0x86, 0xB1, + 0x39, 0x8D, 0x7A, 0xF4, 0xE6, 0xE7, 0x88, 0xC2, 0xD5, 0xA1, 0x4E, 0xA5, 0x29, 0xC5, 0x4E, 0x8C, + 0xAA, 0x53, 0x71, 0x8C, 0xB9, 0x64, 0xAC, 0xE3, 0x76, 0xB9, 0xB9, 0x65, 0x19, 0x72, 0xDD, 0xC1, + 0xA9, 0x28, 0x9F, 0xD3, 0xF7, 0xFC, 0x12, 0x93, 0xC0, 0xDF, 0x13, 0x7C, 0x09, 0xFB, 0x17, 0x7C, + 0x3F, 0xD0, 0xBE, 0x2C, 0x68, 0x51, 0x78, 0x63, 0x56, 0xB8, 0xBF, 0xD5, 0x75, 0x2D, 0x1F, 0xC1, + 0x28, 0x64, 0x96, 0xD3, 0xC1, 0x1A, 0x45, 0xEE, 0xA1, 0x34, 0xF6, 0x1A, 0x0C, 0x0B, 0x20, 0x04, + 0x5B, 0x59, 0xC5, 0x70, 0x2D, 0x22, 0x4C, 0x00, 0xB1, 0x5B, 0xC4, 0x80, 0x2A, 0xA8, 0x55, 0xEE, + 0x6F, 0x44, 0xBB, 0x1F, 0x25, 0x45, 0x24, 0x9D, 0x92, 0x4B, 0x45, 0xA6, 0xDA, 0x2B, 0x69, 0xF9, + 0x7C, 0x8F, 0x34, 0xF1, 0xF7, 0xFC, 0x10, 0x9B, 0xFE, 0x09, 0x35, 0xF1, 0x2B, 0xC5, 0xBA, 0xDF, + 0x8D, 0xBC, 0x49, 0xFB, 0x11, 0x7C, 0x0E, 0x4F, 0x10, 0x78, 0x97, 0x53, 0x9F, 0x59, 0xD6, 0xE7, + 0xD1, 0x7C, 0x13, 0x61, 0xA1, 0xDA, 0xDF, 0xDD, 0xDD, 0x4A, 0xD2, 0x5C, 0x5C, 0x35, 0xBC, 0x30, + 0xAC, 0x61, 0xDE, 0x49, 0x1D, 0x8E, 0xD5, 0x03, 0x24, 0xD2, 0x36, 0x39, 0x0F, 0xF8, 0x87, 0xA7, + 0xFE, 0x08, 0xFF, 0x00, 0xFF, 0x00, 0x46, 0x51, 0xF0, 0x97, 0xFF, 0x00, 0x09, 0xFB, 0x6F, 0xFE, + 0x37, 0x40, 0x07, 0xFC, 0x43, 0xD3, 0xFF, 0x00, 0x04, 0x7F, 0xFF, 0x00, 0xA3, 0x28, 0xF8, 0x4B, + 0xFF, 0x00, 0x84, 0xFD, 0xB7, 0xFF, 0x00, 0x1B, 0xA0, 0x03, 0xFE, 0x21, 0xE9, 0xFF, 0x00, 0x82, + 0x3F, 0xFF, 0x00, 0xD1, 0x94, 0x7C, 0x25, 0xFF, 0x00, 0xC2, 0x7E, 0xDB, 0xFF, 0x00, 0x8D, 0xD0, + 0x01, 0xFF, 0x00, 0x10, 0xF4, 0xFF, 0x00, 0xC1, 0x1F, 0xFF, 0x00, 0xE8, 0xCA, 0x3E, 0x12, 0xFF, + 0x00, 0xE1, 0x3F, 0x6D, 0xFF, 0x00, 0xC6, 0xE8, 0x00, 0xFF, 0x00, 0x88, 0x7A, 0x7F, 0xE0, 0x8F, + 0xFF, 0x00, 0xF4, 0x65, 0x1F, 0x09, 0x7F, 0xF0, 0x9F, 0xB6, 0xFF, 0x00, 0xE3, 0x74, 0x00, 0x7F, + 0xC4, 0x3D, 0x3F, 0xF0, 0x47, 0xFF, 0x00, 0xFA, 0x32, 0x8F, 0x84, 0xBF, 0xF8, 0x4F, 0xDB, 0x7F, + 0xF1, 0xBA, 0x00, 0x3F, 0xE2, 0x1E, 0x9F, 0xF8, 0x23, 0xFF, 0x00, 0xFD, 0x19, 0x47, 0xC2, 0x5F, + 0xFC, 0x27, 0xED, 0xBF, 0xF8, 0xDD, 0x00, 0x1F, 0xF1, 0x0F, 0x4F, 0xFC, 0x11, 0xFF, 0x00, 0xFE, + 0x8C, 0xA3, 0xE1, 0x2F, 0xFE, 0x13, 0xF6, 0xDF, 0xFC, 0x6E, 0x80, 0x0F, 0xF8, 0x87, 0xA7, 0xFE, + 0x08, 0xFF, 0x00, 0xFF, 0x00, 0x46, 0x51, 0xF0, 0x97, 0xFF, 0x00, 0x09, 0xFB, 0x6F, 0xFE, 0x37, + 0x40, 0x07, 0xFC, 0x43, 0xD3, 0xFF, 0x00, 0x04, 0x7F, 0xFF, 0x00, 0xA3, 0x28, 0xF8, 0x4B, 0xFF, + 0x00, 0x84, 0xFD, 0xB7, 0xFF, 0x00, 0x1B, 0xA0, 0x03, 0xFE, 0x21, 0xE9, 0xFF, 0x00, 0x82, 0x3F, + 0xFF, 0x00, 0xD1, 0x94, 0x7C, 0x25, 0xFF, 0x00, 0xC2, 0x7E, 0xDB, 0xFF, 0x00, 0x8D, 0xD0, 0x01, + 0xFF, 0x00, 0x10, 0xF4, 0xFF, 0x00, 0xC1, 0x1F, 0xFF, 0x00, 0xE8, 0xCA, 0x3E, 0x12, 0xFF, 0x00, + 0xE1, 0x3F, 0x6D, 0xFF, 0x00, 0xC6, 0xE8, 0x00, 0xFF, 0x00, 0x88, 0x7A, 0x7F, 0xE0, 0x8F, 0xFF, + 0x00, 0xF4, 0x65, 0x1F, 0x09, 0x7F, 0xF0, 0x9F, 0xB6, 0xFF, 0x00, 0xE3, 0x74, 0x00, 0x7F, 0xC4, + 0x3D, 0x3F, 0xF0, 0x47, 0xFF, 0x00, 0xFA, 0x32, 0x8F, 0x84, 0xBF, 0xF8, 0x4F, 0xDB, 0x7F, 0xF1, + 0xBA, 0x00, 0x3F, 0xE2, 0x1E, 0x9F, 0xF8, 0x23, 0xFF, 0x00, 0xFD, 0x19, 0x47, 0xC2, 0x5F, 0xFC, + 0x27, 0xED, 0xBF, 0xF8, 0xDD, 0x00, 0x1F, 0xF1, 0x0F, 0x4F, 0xFC, 0x11, 0xFF, 0x00, 0xFE, 0x8C, + 0xA3, 0xE1, 0x2F, 0xFE, 0x13, 0xF6, 0xDF, 0xFC, 0x6E, 0x80, 0x0F, 0xF8, 0x87, 0xA7, 0xFE, 0x08, + 0xFF, 0x00, 0xFF, 0x00, 0x46, 0x51, 0xF0, 0x97, 0xFF, 0x00, 0x09, 0xFB, 0x6F, 0xFE, 0x37, 0x40, + 0x07, 0xFC, 0x43, 0xD3, 0xFF, 0x00, 0x04, 0x7F, 0xFF, 0x00, 0xA3, 0x28, 0xF8, 0x4B, 0xFF, 0x00, + 0x84, 0xFD, 0xB7, 0xFF, 0x00, 0x1B, 0xA0, 0x03, 0xFE, 0x21, 0xE9, 0xFF, 0x00, 0x82, 0x3F, 0xFF, + 0x00, 0xD1, 0x94, 0x7C, 0x25, 0xFF, 0x00, 0xC2, 0x7E, 0xDB, 0xFF, 0x00, 0x8D, 0xD0, 0x01, 0xFF, + 0x00, 0x10, 0xF4, 0xFF, 0x00, 0xC1, 0x1F, 0xFF, 0x00, 0xE8, 0xCA, 0x3E, 0x12, 0xFF, 0x00, 0xE1, + 0x3F, 0x6D, 0xFF, 0x00, 0xC6, 0xE8, 0x00, 0xFF, 0x00, 0x88, 0x7A, 0x7F, 0xE0, 0x8F, 0xFF, 0x00, + 0xF4, 0x65, 0x1F, 0x09, 0x7F, 0xF0, 0x9F, 0xB6, 0xFF, 0x00, 0xE3, 0x74, 0x00, 0x7F, 0xC4, 0x3D, + 0x3F, 0xF0, 0x47, 0xFF, 0x00, 0xFA, 0x32, 0x8F, 0x84, 0xBF, 0xF8, 0x4F, 0xDB, 0x7F, 0xF1, 0xBA, + 0x00, 0x3F, 0xE2, 0x1E, 0x9F, 0xF8, 0x23, 0xFF, 0x00, 0xFD, 0x19, 0x47, 0xC2, 0x5F, 0xFC, 0x27, + 0xED, 0xBF, 0xF8, 0xDD, 0x00, 0x1F, 0xF1, 0x0F, 0x4F, 0xFC, 0x11, 0xFF, 0x00, 0xFE, 0x8C, 0xA3, + 0xE1, 0x2F, 0xFE, 0x13, 0xF6, 0xDF, 0xFC, 0x6E, 0x80, 0x0F, 0xF8, 0x87, 0xA7, 0xFE, 0x08, 0xFF, + 0x00, 0xFF, 0x00, 0x46, 0x51, 0xF0, 0x97, 0xFF, 0x00, 0x09, 0xFB, 0x6F, 0xFE, 0x37, 0x40, 0x1C, + 0x7F, 0x8F, 0xFF, 0x00, 0xE0, 0x85, 0x9F, 0xF0, 0x44, 0x0F, 0x84, 0xFE, 0x0C, 0xF1, 0x0F, 0xC4, + 0x5F, 0x8A, 0x5F, 0xB3, 0x0F, 0xEC, 0xEB, 0xF0, 0xD3, 0xE1, 0xEF, 0x84, 0x74, 0xF3, 0xAA, 0xF8, + 0xAF, 0xC7, 0x7E, 0x3F, 0x9B, 0x49, 0xF0, 0x6F, 0x83, 0x3C, 0x31, 0x68, 0xAC, 0x15, 0xAE, 0x75, + 0x1D, 0x52, 0xEC, 0xC5, 0x6D, 0x6D, 0x10, 0x67, 0x41, 0xBE, 0x47, 0x45, 0x04, 0x81, 0x9E, 0x45, + 0x00, 0x76, 0x03, 0xFE, 0x0D, 0xEA, 0xFF, 0x00, 0x82, 0x3F, 0xE0, 0x63, 0xF6, 0x28, 0xF8, 0x4A, + 0x06, 0x06, 0x07, 0xFC, 0x23, 0xD6, 0xE3, 0x03, 0x1C, 0x0C, 0x79, 0x7F, 0x4A, 0x00, 0x3F, 0xE2, + 0x1E, 0x9F, 0xF8, 0x23, 0xFF, 0x00, 0xFD, 0x19, 0x47, 0xC2, 0x5F, 0xFC, 0x27, 0xED, 0xBF, 0xF8, + 0xDD, 0x00, 0x1F, 0xF1, 0x0F, 0x4F, 0xFC, 0x11, 0xFF, 0x00, 0xFE, 0x8C, 0xA3, 0xE1, 0x2F, 0xFE, + 0x13, 0xF6, 0xDF, 0xFC, 0x6E, 0x80, 0x0F, 0xF8, 0x87, 0xA7, 0xFE, 0x08, 0xFF, 0x00, 0xFF, 0x00, + 0x46, 0x51, 0xF0, 0x97, 0xFF, 0x00, 0x09, 0xFB, 0x6F, 0xFE, 0x37, 0x40, 0x07, 0xFC, 0x43, 0xD3, + 0xFF, 0x00, 0x04, 0x7F, 0xFF, 0x00, 0xA3, 0x28, 0xF8, 0x4B, 0xFF, 0x00, 0x84, 0xFD, 0xB7, 0xFF, + 0x00, 0x1B, 0xA0, 0x03, 0xFE, 0x21, 0xE9, 0xFF, 0x00, 0x82, 0x3F, 0xFF, 0x00, 0xD1, 0x94, 0x7C, + 0x25, 0xFF, 0x00, 0xC2, 0x7E, 0xDB, 0xFF, 0x00, 0x8D, 0xD0, 0x01, 0xFF, 0x00, 0x10, 0xF4, 0xFF, + 0x00, 0xC1, 0x1F, 0xFF, 0x00, 0xE8, 0xCA, 0x3E, 0x12, 0xFF, 0x00, 0xE1, 0x3F, 0x6D, 0xFF, 0x00, + 0xC6, 0xE8, 0x00, 0xFF, 0x00, 0x88, 0x7A, 0x7F, 0xE0, 0x8F, 0xFF, 0x00, 0xF4, 0x65, 0x1F, 0x09, + 0x7F, 0xF0, 0x9F, 0xB6, 0xFF, 0x00, 0xE3, 0x74, 0x00, 0x7F, 0xC4, 0x3D, 0x3F, 0xF0, 0x47, 0xFF, + 0x00, 0xFA, 0x32, 0x8F, 0x84, 0xBF, 0xF8, 0x4F, 0xDB, 0x7F, 0xF1, 0xBA, 0x00, 0x3F, 0xE2, 0x1E, + 0x9F, 0xF8, 0x23, 0xFF, 0x00, 0xFD, 0x19, 0x47, 0xC2, 0x5F, 0xFC, 0x27, 0xED, 0xBF, 0xF8, 0xDD, + 0x00, 0x1F, 0xF1, 0x0F, 0x4F, 0xFC, 0x11, 0xFF, 0x00, 0xFE, 0x8C, 0xA3, 0xE1, 0x2F, 0xFE, 0x13, + 0xF6, 0xDF, 0xFC, 0x6E, 0x80, 0x0F, 0xF8, 0x87, 0xA7, 0xFE, 0x08, 0xFF, 0x00, 0xFF, 0x00, 0x46, + 0x51, 0xF0, 0x97, 0xFF, 0x00, 0x09, 0xFB, 0x6F, 0xFE, 0x37, 0x40, 0x07, 0xFC, 0x43, 0xD3, 0xFF, + 0x00, 0x04, 0x7F, 0xFF, 0x00, 0xA3, 0x28, 0xF8, 0x4B, 0xFF, 0x00, 0x84, 0xFD, 0xB7, 0xFF, 0x00, + 0x1B, 0xA0, 0x03, 0xFE, 0x21, 0xE9, 0xFF, 0x00, 0x82, 0x3F, 0xFF, 0x00, 0xD1, 0x94, 0x7C, 0x25, + 0xFF, 0x00, 0xC2, 0x7E, 0xDB, 0xFF, 0x00, 0x8D, 0xD0, 0x01, 0xFF, 0x00, 0x10, 0xF4, 0xFF, 0x00, + 0xC1, 0x1F, 0xFF, 0x00, 0xE8, 0xCA, 0x3E, 0x12, 0xFF, 0x00, 0xE1, 0x3F, 0x6D, 0xFF, 0x00, 0xC6, + 0xE8, 0x00, 0xFF, 0x00, 0x88, 0x7A, 0x7F, 0xE0, 0x8F, 0xFF, 0x00, 0xF4, 0x65, 0x1F, 0x09, 0x7F, + 0xF0, 0x9F, 0xB6, 0xFF, 0x00, 0xE3, 0x74, 0x00, 0x7F, 0xC4, 0x3D, 0x3F, 0xF0, 0x47, 0xFF, 0x00, + 0xFA, 0x32, 0x8F, 0x84, 0xBF, 0xF8, 0x4F, 0xDB, 0x7F, 0xF1, 0xBA, 0x00, 0x3F, 0xE2, 0x1E, 0x9F, + 0xF8, 0x23, 0xFF, 0x00, 0xFD, 0x19, 0x47, 0xC2, 0x5F, 0xFC, 0x27, 0xED, 0xBF, 0xF8, 0xDD, 0x00, + 0x1F, 0xF1, 0x0F, 0x4F, 0xFC, 0x11, 0xFF, 0x00, 0xFE, 0x8C, 0xA3, 0xE1, 0x2F, 0xFE, 0x13, 0xF6, + 0xDF, 0xFC, 0x6E, 0x80, 0x0F, 0xF8, 0x87, 0xA7, 0xFE, 0x08, 0xFF, 0x00, 0xFF, 0x00, 0x46, 0x51, + 0xF0, 0x97, 0xFF, 0x00, 0x09, 0xFB, 0x6F, 0xFE, 0x37, 0x40, 0x07, 0xFC, 0x43, 0xD3, 0xFF, 0x00, + 0x04, 0x7F, 0xFF, 0x00, 0xA3, 0x28, 0xF8, 0x4B, 0xFF, 0x00, 0x84, 0xFD, 0xB7, 0xFF, 0x00, 0x1B, + 0xA0, 0x03, 0xFE, 0x21, 0xE9, 0xFF, 0x00, 0x82, 0x3F, 0xFF, 0x00, 0xD1, 0x94, 0x7C, 0x25, 0xFF, + 0x00, 0xC2, 0x7E, 0xDB, 0xFF, 0x00, 0x8D, 0xD0, 0x01, 0xFF, 0x00, 0x10, 0xF4, 0xFF, 0x00, 0xC1, + 0x1F, 0xFF, 0x00, 0xE8, 0xCA, 0x3E, 0x12, 0xFF, 0x00, 0xE1, 0x3F, 0x6D, 0xFF, 0x00, 0xC6, 0xE8, + 0x00, 0xFF, 0x00, 0x88, 0x7A, 0x7F, 0xE0, 0x8F, 0xFF, 0x00, 0xF4, 0x65, 0x1F, 0x09, 0x7F, 0xF0, + 0x9F, 0xB6, 0xFF, 0x00, 0xE3, 0x74, 0x00, 0x7F, 0xC4, 0x3D, 0x3F, 0xF0, 0x47, 0xFF, 0x00, 0xFA, + 0x32, 0x8F, 0x84, 0xBF, 0xF8, 0x4F, 0xDB, 0x7F, 0xF1, 0xBA, 0x00, 0x3F, 0xE2, 0x1E, 0x9F, 0xF8, + 0x23, 0xFF, 0x00, 0xFD, 0x19, 0x47, 0xC2, 0x5F, 0xFC, 0x27, 0xED, 0xBF, 0xF8, 0xDD, 0x00, 0x1F, + 0xF1, 0x0F, 0x4F, 0xFC, 0x11, 0xFF, 0x00, 0xFE, 0x8C, 0xA3, 0xE1, 0x2F, 0xFE, 0x13, 0xF6, 0xDF, + 0xFC, 0x6E, 0x80, 0x0F, 0xF8, 0x87, 0xA7, 0xFE, 0x08, 0xFF, 0x00, 0xFF, 0x00, 0x46, 0x51, 0xF0, + 0x97, 0xFF, 0x00, 0x09, 0xFB, 0x6F, 0xFE, 0x37, 0x40, 0x07, 0xFC, 0x43, 0xD3, 0xFF, 0x00, 0x04, + 0x7F, 0xFF, 0x00, 0xA3, 0x28, 0xF8, 0x4B, 0xFF, 0x00, 0x84, 0xFD, 0xB7, 0xFF, 0x00, 0x1B, 0xA0, + 0x0F, 0x5A, 0xF8, 0x21, 0xFF, 0x00, 0x04, 0x5F, 0xFF, 0x00, 0x82, 0x70, 0x7E, 0xCD, 0xBF, 0x11, + 0xF4, 0x1F, 0x8B, 0xBF, 0x02, 0x3F, 0x66, 0xFF, 0x00, 0x0A, 0x7C, 0x2A, 0xF8, 0x91, 0xE1, 0xAF, + 0x35, 0x74, 0x7F, 0x17, 0x78, 0x21, 0x4F, 0x87, 0xB5, 0x9B, 0x58, 0xE7, 0x88, 0xC7, 0x3C, 0x26, + 0x58, 0x42, 0x97, 0x89, 0xD1, 0x8A, 0xB4, 0x6D, 0x95, 0x6E, 0x32, 0x38, 0x18, 0x00, 0xFD, 0x47, + 0x8A, 0x31, 0x14, 0x69, 0x18, 0x2C, 0xC1, 0x14, 0x28, 0x2C, 0x72, 0xC4, 0x00, 0x00, 0x24, 0xFA, + 0xF0, 0x28, 0x03, 0xFC, 0xFD, 0xBF, 0xE0, 0xE7, 0xDF, 0xF9, 0x4E, 0x7F, 0xFC, 0x12, 0x1F, 0xFE, + 0xC1, 0x5F, 0x0F, 0x7F, 0xF5, 0x6F, 0x5C, 0xD7, 0x66, 0x59, 0xFF, 0x00, 0x23, 0x0C, 0x3F, 0xF8, + 0xE1, 0xFF, 0x00, 0xA5, 0x23, 0x9F, 0x13, 0xFE, 0xEB, 0x53, 0xFC, 0x2F, 0xF2, 0x3E, 0xD4, 0xAF, + 0xD4, 0xCF, 0x8E, 0x0A, 0x00, 0x28, 0x00, 0xA0, 0x0F, 0xD8, 0x1F, 0xF8, 0x22, 0x1E, 0x3F, 0xE1, + 0x03, 0xFD, 0xBB, 0x00, 0xC7, 0x1F, 0xB7, 0x3C, 0x23, 0x03, 0x1C, 0x7F, 0xC5, 0x86, 0xF8, 0x63, + 0x81, 0x8F, 0xCA, 0xBF, 0x3A, 0xE2, 0x0F, 0xF9, 0x1A, 0x4F, 0xD2, 0x3F, 0xFA, 0x4A, 0x3E, 0xA3, + 0x2B, 0xFF, 0x00, 0x72, 0x8F, 0xCF, 0xF3, 0x3E, 0xAE, 0xFD, 0xBA, 0x3F, 0x62, 0x9D, 0x43, 0xF6, + 0xC5, 0xD5, 0xBF, 0x66, 0x25, 0xFF, 0x00, 0x84, 0xEB, 0x53, 0xF0, 0x67, 0x85, 0x3E, 0x0C, 0x7C, + 0x65, 0x7F, 0x88, 0x7E, 0x3C, 0xD3, 0x34, 0x0B, 0xEB, 0xDD, 0x07, 0xC4, 0x3E, 0x35, 0xD3, 0x9F, + 0x49, 0x9A, 0xDA, 0x3D, 0x3E, 0xD3, 0x54, 0xB5, 0x9E, 0x29, 0x6D, 0x0A, 0x5D, 0x49, 0x67, 0x70, + 0x59, 0x49, 0x66, 0x16, 0xE1, 0x14, 0xA1, 0x6D, 0xE9, 0xE2, 0xAF, 0x76, 0xDC, 0xA7, 0x74, 0xA3, + 0x74, 0x92, 0x5A, 0x1F, 0x8E, 0xDF, 0xB5, 0x97, 0xEC, 0x5F, 0xFF, 0x00, 0x05, 0x1E, 0xD7, 0xF4, + 0x2B, 0x5F, 0x83, 0x76, 0xBF, 0xB6, 0x07, 0xC5, 0x5F, 0x16, 0x78, 0x02, 0x4D, 0x17, 0xC3, 0x3F, + 0xF0, 0x9C, 0x8D, 0x47, 0xC0, 0x3A, 0x80, 0xD1, 0xBC, 0x51, 0xAC, 0xF8, 0x7F, 0xC5, 0x76, 0x3A, + 0xBD, 0xD6, 0xA1, 0x6D, 0x7D, 0x01, 0x90, 0xC9, 0x6F, 0x7D, 0x06, 0x9E, 0xD0, 0x35, 0x9B, 0x01, + 0x0C, 0x5E, 0x63, 0x46, 0xC9, 0x34, 0x43, 0x63, 0xFA, 0x98, 0x4A, 0x74, 0x6A, 0xC2, 0xF5, 0x5D, + 0xDE, 0x8B, 0xA3, 0x69, 0x26, 0x9E, 0xDA, 0x5B, 0x45, 0x65, 0x6E, 0xF6, 0xD8, 0xF3, 0x6B, 0x3A, + 0x94, 0x9A, 0x8C, 0x34, 0x56, 0xEB, 0x74, 0xB6, 0x6B, 0xA7, 0x9D, 0xBE, 0xEF, 0x43, 0xD5, 0xFE, + 0x01, 0xFE, 0xC5, 0xBF, 0xF0, 0x54, 0xAD, 0x73, 0xC0, 0x9F, 0x0F, 0x2C, 0xBC, 0x6B, 0xFB, 0x71, + 0x5E, 0x5D, 0xDB, 0x78, 0x25, 0xF4, 0x8B, 0x7F, 0x10, 0x68, 0x7E, 0x25, 0xF8, 0x5F, 0x2E, 0x9D, + 0x6F, 0xE2, 0xE5, 0xB3, 0xB9, 0xBC, 0x6D, 0x5D, 0x60, 0xBA, 0x9D, 0x22, 0x9C, 0xD9, 0x6A, 0x56, + 0xFA, 0x92, 0x2B, 0xA1, 0x2D, 0x24, 0x12, 0x59, 0x58, 0x6D, 0x90, 0xC5, 0x04, 0x90, 0x5E, 0xF2, + 0xE2, 0x62, 0xA1, 0x34, 0xA2, 0xD6, 0xCB, 0xAA, 0x7A, 0xAE, 0xE9, 0x6D, 0xE9, 0xF9, 0x9B, 0xE1, + 0xD3, 0x9C, 0x36, 0xD1, 0x6D, 0xA5, 0xB4, 0xB6, 0x89, 0x6D, 0x7F, 0x5B, 0x6D, 0xDB, 0x65, 0xF4, + 0x07, 0x87, 0xFF, 0x00, 0x62, 0xBF, 0xF8, 0x29, 0xEF, 0x86, 0xBC, 0x2F, 0xE1, 0x1D, 0x02, 0xC7, + 0xF6, 0xF2, 0xD3, 0x5D, 0xFC, 0x17, 0xE2, 0xD8, 0x75, 0x5D, 0x33, 0xCA, 0xF0, 0x3A, 0x69, 0x1A, + 0x4D, 0xE6, 0x93, 0x06, 0xBF, 0x0D, 0xD4, 0x1A, 0x2C, 0xF6, 0x56, 0xEE, 0x91, 0x9B, 0x64, 0xD2, + 0x20, 0xFE, 0xC8, 0xF2, 0xFE, 0xE7, 0x97, 0x1C, 0x77, 0x40, 0x0B, 0x89, 0xA7, 0x2D, 0xC9, 0x6D, + 0x2C, 0x75, 0x59, 0xE9, 0x65, 0xE8, 0x7B, 0xCF, 0xEC, 0x89, 0xFB, 0x32, 0xFE, 0xD9, 0x1F, 0x07, + 0xFE, 0x3B, 0xF8, 0xBF, 0xE2, 0xBF, 0xC7, 0xBF, 0x8D, 0xFE, 0x10, 0xF8, 0xC1, 0xA5, 0x7C, 0x40, + 0xF8, 0x5B, 0xA7, 0x7C, 0x35, 0xD7, 0xAC, 0x6D, 0xF4, 0xBB, 0xED, 0x3B, 0x5A, 0xD2, 0xE4, 0xF0, + 0xEF, 0x8B, 0x7C, 0x49, 0xA9, 0xF8, 0x7B, 0x50, 0xB5, 0x94, 0xDC, 0x1B, 0x77, 0x55, 0xD3, 0xFC, + 0x68, 0xD6, 0x13, 0x09, 0x20, 0xF3, 0x59, 0x74, 0xDB, 0x47, 0xF3, 0x4E, 0xE6, 0x54, 0x12, 0xB2, + 0x48, 0x22, 0x9A, 0xE9, 0xA7, 0xF5, 0xFD, 0x7F, 0x56, 0x3F, 0x50, 0xA9, 0x9A, 0x05, 0x00, 0x14, + 0x00, 0x50, 0x01, 0x40, 0x05, 0x00, 0x14, 0x00, 0x50, 0x01, 0x40, 0x05, 0x00, 0x14, 0x00, 0x50, + 0x01, 0x40, 0x05, 0x00, 0x14, 0x00, 0x50, 0x01, 0x40, 0x05, 0x00, 0x14, 0x00, 0x50, 0x01, 0x40, + 0x05, 0x00, 0x14, 0x00, 0x50, 0x01, 0x40, 0x1E, 0x3D, 0xF1, 0xF3, 0xE1, 0xBF, 0x88, 0x3E, 0x2D, + 0xFC, 0x22, 0xF1, 0x9F, 0xC3, 0xBF, 0x09, 0xF8, 0x9F, 0x47, 0xF0, 0x4F, 0x88, 0x7C, 0x4B, 0xA7, + 0x47, 0x65, 0xA5, 0x78, 0xB3, 0x5B, 0xD0, 0xF5, 0x8D, 0x76, 0xD3, 0xC3, 0xCE, 0xB3, 0xA3, 0x35, + 0xD4, 0x29, 0xA4, 0x6B, 0x3A, 0x2E, 0xAF, 0x6F, 0x72, 0xA8, 0x8E, 0x60, 0xBB, 0xD3, 0xB5, 0x6D, + 0x3A, 0xF2, 0xD2, 0x6F, 0x26, 0xE6, 0xDE, 0xE6, 0x29, 0x60, 0x46, 0x00, 0x1D, 0x1F, 0xC2, 0x8F, + 0x87, 0xDA, 0x6F, 0xC2, 0x5F, 0x85, 0xBF, 0x0D, 0x7E, 0x15, 0x68, 0xD3, 0xC5, 0x75, 0xA3, 0xFC, + 0x33, 0xF0, 0x06, 0x8D, 0xF0, 0xFB, 0x49, 0xB9, 0x83, 0xC3, 0x9A, 0x2F, 0x83, 0xA0, 0xB8, 0xB6, + 0xD1, 0x74, 0xE8, 0x6C, 0xED, 0xE4, 0x4D, 0x23, 0x47, 0xB2, 0xB2, 0xD2, 0x2C, 0x55, 0x92, 0xD9, + 0x08, 0xB6, 0xB0, 0xB3, 0xB4, 0xB5, 0x84, 0x11, 0x1C, 0x16, 0xF0, 0xC4, 0x89, 0x1A, 0x00, 0x77, + 0xD4, 0x00, 0x50, 0x01, 0x40, 0x05, 0x00, 0x14, 0x00, 0x50, 0x01, 0x40, 0x05, 0x00, 0x14, 0x00, + 0x50, 0x01, 0x40, 0x05, 0x00, 0x14, 0x00, 0x50, 0x01, 0x40, 0x05, 0x00, 0x14, 0x00, 0x50, 0x01, + 0x40, 0x05, 0x00, 0x14, 0x00, 0x50, 0x01, 0x40, 0x05, 0x00, 0x14, 0x00, 0x50, 0x01, 0x40, 0x05, + 0x00, 0x14, 0x00, 0x50, 0x07, 0xF9, 0xFA, 0x7F, 0xC1, 0xCF, 0xAB, 0x8F, 0xF8, 0x2E, 0x77, 0xFC, + 0x12, 0x1C, 0xE3, 0x0B, 0xFD, 0x97, 0xF0, 0xF5, 0x41, 0xC6, 0x07, 0x1F, 0x17, 0xAE, 0x72, 0x07, + 0xD3, 0x23, 0xF4, 0xAE, 0xCC, 0xB3, 0xFE, 0x46, 0x18, 0x7F, 0xF1, 0xC3, 0xFF, 0x00, 0x4A, 0x47, + 0x3E, 0x27, 0xFD, 0xD6, 0xA7, 0xF8, 0x5F, 0xE4, 0x7D, 0xA7, 0x5F, 0xA9, 0x9F, 0x1C, 0x14, 0x00, + 0x50, 0x01, 0x40, 0x1F, 0x09, 0xFE, 0xDA, 0xBF, 0xB0, 0x7F, 0x81, 0x3F, 0x6C, 0x1F, 0x05, 0xDA, + 0xE8, 0xB6, 0x3A, 0xBE, 0x83, 0xF0, 0x57, 0xE2, 0x08, 0xF1, 0xC6, 0x9D, 0xE2, 0xCD, 0x5F, 0xE3, + 0x47, 0x85, 0xFE, 0x18, 0x69, 0xDA, 0xE7, 0xC4, 0x8F, 0x10, 0xD9, 0xE9, 0xDA, 0x55, 0xDD, 0x8A, + 0xE8, 0x77, 0x9A, 0x8A, 0xCF, 0x67, 0x79, 0x25, 0xA3, 0x0B, 0xCB, 0x27, 0xDA, 0xF7, 0x4E, 0x8B, + 0xFD, 0x9F, 0x6A, 0xBE, 0x51, 0xD8, 0x86, 0x2F, 0x2B, 0x32, 0xCA, 0x68, 0x66, 0x14, 0xD4, 0x52, + 0x50, 0x9D, 0xD3, 0x72, 0x51, 0x4D, 0xB4, 0x93, 0x56, 0xBE, 0x8E, 0xDB, 0x75, 0xB6, 0x8B, 0x4E, + 0xDD, 0x98, 0x4C, 0x65, 0x4C, 0x2B, 0xD3, 0x58, 0xDA, 0xD6, 0xBD, 0x92, 0xDB, 0x5B, 0x6D, 0xD3, + 0xB1, 0xF9, 0xA1, 0xFF, 0x00, 0x0E, 0x0B, 0x3F, 0xF4, 0x7C, 0x5F, 0x11, 0x3F, 0xF0, 0xD2, 0xFF, + 0x00, 0xF8, 0x47, 0x5E, 0x2F, 0xFA, 0xA7, 0x1F, 0xF9, 0xFF, 0x00, 0xFF, 0x00, 0x92, 0x7F, 0xF6, + 0xC7, 0x77, 0xF6, 0xC4, 0xBF, 0xE7, 0xDA, 0xFB, 0xFF, 0x00, 0xE0, 0x08, 0x7F, 0xE0, 0x81, 0x20, + 0x80, 0x0F, 0xED, 0xC1, 0xF1, 0x0C, 0x81, 0x8C, 0x03, 0xF0, 0x8C, 0x10, 0x30, 0x38, 0xC0, 0xFF, + 0x00, 0x84, 0x8E, 0x8F, 0xF5, 0x4E, 0x3F, 0xF3, 0xFF, 0x00, 0xFF, 0x00, 0x24, 0xFF, 0x00, 0xED, + 0x83, 0xFB, 0x62, 0x56, 0x4B, 0xD9, 0xAB, 0x7A, 0xFF, 0x00, 0xC0, 0x14, 0x7F, 0xC1, 0x02, 0xB6, + 0x80, 0x17, 0xF6, 0xE1, 0xF8, 0x88, 0xA0, 0x74, 0x03, 0xE1, 0x26, 0x00, 0xE3, 0xB0, 0xFF, 0x00, + 0x84, 0x8F, 0xD8, 0x51, 0xFE, 0xA9, 0xC7, 0xFE, 0x7F, 0xFF, 0x00, 0xE4, 0x9F, 0xFD, 0xB0, 0x7F, + 0x6C, 0x4B, 0xFE, 0x7D, 0xAF, 0xBF, 0xFE, 0x00, 0x7F, 0xC3, 0x82, 0xCF, 0xFD, 0x1F, 0x17, 0xC4, + 0x4F, 0xFC, 0x34, 0xBF, 0xFE, 0x11, 0xD1, 0xFE, 0xA9, 0xC7, 0xFE, 0x7F, 0xFF, 0x00, 0xE4, 0x9F, + 0xFD, 0xB0, 0x7F, 0x6C, 0x4B, 0xFE, 0x7D, 0xAF, 0xBF, 0xFE, 0x00, 0x7F, 0xC3, 0x82, 0xCF, 0xFD, + 0x1F, 0x17, 0xC4, 0x4F, 0xFC, 0x34, 0xBF, 0xFE, 0x11, 0xD1, 0xFE, 0xA9, 0xC7, 0xFE, 0x7F, 0xFF, + 0x00, 0xE4, 0x9F, 0xFD, 0xB0, 0x7F, 0x6C, 0x4B, 0xFE, 0x7D, 0xAF, 0xBF, 0xFE, 0x00, 0x7F, 0xC3, + 0x82, 0xCF, 0xFD, 0x1F, 0x17, 0xC4, 0x4F, 0xFC, 0x34, 0xBF, 0xFE, 0x11, 0xD1, 0xFE, 0xA9, 0xC7, + 0xFE, 0x7F, 0xFF, 0x00, 0xE4, 0x9F, 0xFD, 0xB0, 0x7F, 0x6C, 0x4B, 0xFE, 0x7D, 0xAF, 0xBF, 0xFE, + 0x00, 0x7F, 0xC3, 0x82, 0xCF, 0xFD, 0x1F, 0x17, 0xC4, 0x4F, 0xFC, 0x34, 0xBF, 0xFE, 0x11, 0xD1, + 0xFE, 0xA9, 0xC7, 0xFE, 0x7F, 0xFF, 0x00, 0xE4, 0x9F, 0xFD, 0xB0, 0x7F, 0x6C, 0x4B, 0xFE, 0x7D, + 0xAF, 0xBF, 0xFE, 0x00, 0x7F, 0xC3, 0x82, 0xCF, 0xFD, 0x1F, 0x17, 0xC4, 0x4F, 0xFC, 0x34, 0xBF, + 0xFE, 0x11, 0xD1, 0xFE, 0xA9, 0xC7, 0xFE, 0x7F, 0xFF, 0x00, 0xE4, 0x9F, 0xFD, 0xB0, 0x7F, 0x6C, + 0x4B, 0xFE, 0x7D, 0xAF, 0xBF, 0xFE, 0x00, 0x7F, 0xC3, 0x82, 0xCF, 0xFD, 0x1F, 0x17, 0xC4, 0x4F, + 0xFC, 0x34, 0xBF, 0xFE, 0x11, 0xD1, 0xFE, 0xA9, 0xC7, 0xFE, 0x7F, 0xFF, 0x00, 0xE4, 0x9F, 0xFD, + 0xB0, 0x7F, 0x6C, 0x4B, 0xFE, 0x7D, 0xAF, 0xBF, 0xFE, 0x00, 0x7F, 0xC3, 0x82, 0xCF, 0xFD, 0x1F, + 0x17, 0xC4, 0x4F, 0xFC, 0x34, 0xBF, 0xFE, 0x11, 0xD1, 0xFE, 0xA9, 0xC7, 0xFE, 0x7F, 0xFF, 0x00, + 0xE4, 0x9F, 0xFD, 0xB0, 0x7F, 0x6C, 0x4B, 0xFE, 0x7D, 0xAF, 0xBF, 0xFE, 0x00, 0x7F, 0xC3, 0x82, + 0xCF, 0xFD, 0x1F, 0x17, 0xC4, 0x4F, 0xFC, 0x34, 0xBF, 0xFE, 0x11, 0xD1, 0xFE, 0xA9, 0xC7, 0xFE, + 0x7F, 0xFF, 0x00, 0xE4, 0x9F, 0xFD, 0xB0, 0x7F, 0x6C, 0x4B, 0xFE, 0x7D, 0xAF, 0xBF, 0xFE, 0x00, + 0x7F, 0xC3, 0x82, 0xCF, 0xFD, 0x1F, 0x17, 0xC4, 0x4F, 0xFC, 0x34, 0xBF, 0xFE, 0x11, 0xD1, 0xFE, + 0xA9, 0xC7, 0xFE, 0x7F, 0xFF, 0x00, 0xE4, 0x9F, 0xFD, 0xB0, 0x7F, 0x6C, 0x4B, 0xFE, 0x7D, 0xAF, + 0xBF, 0xFE, 0x00, 0x7F, 0xC3, 0x82, 0xCF, 0xFD, 0x1F, 0x17, 0xC4, 0x4F, 0xFC, 0x34, 0xBF, 0xFE, + 0x11, 0xD1, 0xFE, 0xA9, 0xC7, 0xFE, 0x7F, 0xFF, 0x00, 0xE4, 0x9F, 0xFD, 0xB0, 0x7F, 0x6C, 0x4B, + 0xFE, 0x7D, 0xAF, 0xBF, 0xFE, 0x00, 0x7F, 0xC3, 0x82, 0xCF, 0xFD, 0x1F, 0x17, 0xC4, 0x4F, 0xFC, + 0x34, 0xBF, 0xFE, 0x11, 0xD1, 0xFE, 0xA9, 0xC7, 0xFE, 0x7F, 0xFF, 0x00, 0xE4, 0x9F, 0xFD, 0xB0, + 0x7F, 0x6C, 0x4B, 0xFE, 0x7D, 0xAF, 0xBF, 0xFE, 0x00, 0x7F, 0xC3, 0x82, 0xCF, 0xFD, 0x1F, 0x17, + 0xC4, 0x4F, 0xFC, 0x34, 0xBF, 0xFE, 0x11, 0xD1, 0xFE, 0xA9, 0xC7, 0xFE, 0x7F, 0xFF, 0x00, 0xE4, + 0x9F, 0xFD, 0xB0, 0x7F, 0x6C, 0x4B, 0xFE, 0x7D, 0xAF, 0xBF, 0xFE, 0x00, 0x7F, 0xC3, 0x82, 0xCF, + 0xFD, 0x1F, 0x17, 0xC4, 0x4F, 0xFC, 0x34, 0xBF, 0xFE, 0x11, 0xD1, 0xFE, 0xA9, 0xC7, 0xFE, 0x7F, + 0xFF, 0x00, 0xE4, 0x9F, 0xFD, 0xB0, 0x7F, 0x6C, 0x4B, 0xFE, 0x7D, 0xAF, 0xBF, 0xFE, 0x00, 0x7F, + 0xC3, 0x82, 0xCF, 0xFD, 0x1F, 0x17, 0xC4, 0x4F, 0xFC, 0x34, 0xBF, 0xFE, 0x11, 0xD1, 0xFE, 0xA9, + 0xC7, 0xFE, 0x7F, 0xFF, 0x00, 0xE4, 0x9F, 0xFD, 0xB0, 0x7F, 0x6C, 0x4B, 0xFE, 0x7D, 0xAF, 0xBF, + 0xFE, 0x00, 0x7F, 0xC3, 0x82, 0xCF, 0xFD, 0x1F, 0x17, 0xC4, 0x4F, 0xFC, 0x34, 0xBF, 0xFE, 0x11, + 0xD1, 0xFE, 0xA9, 0xC7, 0xFE, 0x7F, 0xFF, 0x00, 0xE4, 0x9F, 0xFD, 0xB0, 0x7F, 0x6C, 0x4B, 0xFE, + 0x7D, 0xAF, 0xBF, 0xFE, 0x00, 0x7F, 0xC3, 0x82, 0xCF, 0xFD, 0x1F, 0x17, 0xC4, 0x4F, 0xFC, 0x34, + 0xBF, 0xFE, 0x11, 0xD1, 0xFE, 0xA9, 0xC7, 0xFE, 0x7F, 0xFF, 0x00, 0xE4, 0x9F, 0xFD, 0xB0, 0x7F, + 0x6C, 0x4B, 0xFE, 0x7D, 0xAF, 0xBF, 0xFE, 0x00, 0x7F, 0xC3, 0x82, 0xCF, 0xFD, 0x1F, 0x17, 0xC4, + 0x4F, 0xFC, 0x34, 0xBF, 0xFE, 0x11, 0xD1, 0xFE, 0xA9, 0xC7, 0xFE, 0x7F, 0xFF, 0x00, 0xE4, 0x9F, + 0xFD, 0xB0, 0x7F, 0x6C, 0x4B, 0xFE, 0x7D, 0xAF, 0xBF, 0xFE, 0x00, 0x7F, 0xC3, 0x82, 0xCF, 0xFD, + 0x1F, 0x17, 0xC4, 0x4F, 0xFC, 0x34, 0xBF, 0xFE, 0x11, 0xD1, 0xFE, 0xA9, 0xC7, 0xFE, 0x7F, 0xFF, + 0x00, 0xE4, 0x9F, 0xFD, 0xB0, 0x7F, 0x6C, 0x4B, 0xFE, 0x7D, 0xAF, 0xBF, 0xFE, 0x00, 0x7F, 0xC3, + 0x82, 0xCF, 0xFD, 0x1F, 0x17, 0xC4, 0x4F, 0xFC, 0x34, 0xBF, 0xFE, 0x11, 0xD1, 0xFE, 0xA9, 0xC7, + 0xFE, 0x7F, 0xFF, 0x00, 0xE4, 0x9F, 0xFD, 0xB0, 0x7F, 0x6C, 0x4B, 0xFE, 0x7D, 0xAF, 0xBF, 0xFE, + 0x00, 0x7F, 0xC3, 0x82, 0xCF, 0xFD, 0x1F, 0x17, 0xC4, 0x4F, 0xFC, 0x34, 0xBF, 0xFE, 0x11, 0xD1, + 0xFE, 0xA9, 0xC7, 0xFE, 0x7F, 0xFF, 0x00, 0xE4, 0x9F, 0xFD, 0xB0, 0x7F, 0x6C, 0x4B, 0xFE, 0x7D, + 0xAF, 0xBF, 0xFE, 0x00, 0x7F, 0xC3, 0x82, 0xCF, 0xFD, 0x1F, 0x17, 0xC4, 0x4F, 0xFC, 0x34, 0xBF, + 0xFE, 0x11, 0xD1, 0xFE, 0xA9, 0xC7, 0xFE, 0x7F, 0xFF, 0x00, 0xE4, 0x9F, 0xFD, 0xB0, 0x7F, 0x6C, + 0x4B, 0xFE, 0x7D, 0xAF, 0xBF, 0xFE, 0x00, 0x7F, 0xC3, 0x82, 0xCF, 0xFD, 0x1F, 0x17, 0xC4, 0x4F, + 0xFC, 0x34, 0xBF, 0xFE, 0x11, 0xD1, 0xFE, 0xA9, 0xC7, 0xFE, 0x7F, 0xFF, 0x00, 0xE4, 0x9F, 0xFD, + 0xB0, 0x7F, 0x6C, 0x4B, 0xFE, 0x7D, 0xAF, 0xBF, 0xFE, 0x00, 0x7F, 0xC3, 0x82, 0xCF, 0xFD, 0x1F, + 0x17, 0xC4, 0x4F, 0xFC, 0x34, 0xBF, 0xFE, 0x11, 0xD1, 0xFE, 0xA9, 0xC7, 0xFE, 0x7F, 0xFF, 0x00, + 0xE4, 0x9F, 0xFD, 0xB0, 0x7F, 0x6C, 0x4B, 0xFE, 0x7D, 0xAF, 0xBF, 0xFE, 0x00, 0x7F, 0xC3, 0x82, + 0xCF, 0xFD, 0x1F, 0x17, 0xC4, 0x4F, 0xFC, 0x34, 0xBF, 0xFE, 0x11, 0xD1, 0xFE, 0xA9, 0xC7, 0xFE, + 0x7F, 0xFF, 0x00, 0xE4, 0x9F, 0xFD, 0xB0, 0x7F, 0x6C, 0x4B, 0xFE, 0x7D, 0xAF, 0xBF, 0xFE, 0x00, + 0x7F, 0xC3, 0x82, 0xCF, 0xFD, 0x1F, 0x17, 0xC4, 0x4F, 0xFC, 0x34, 0xBF, 0xFE, 0x11, 0xD1, 0xFE, + 0xA9, 0xC7, 0xFE, 0x7F, 0xFF, 0x00, 0xE4, 0x9F, 0xFD, 0xB0, 0x7F, 0x6C, 0x4B, 0xFE, 0x7D, 0xAF, + 0xBF, 0xFE, 0x00, 0x7F, 0xC3, 0x82, 0xCF, 0xFD, 0x1F, 0x17, 0xC4, 0x4F, 0xFC, 0x34, 0xBF, 0xFE, + 0x11, 0xD1, 0xFE, 0xA9, 0xC7, 0xFE, 0x7F, 0xFF, 0x00, 0xE4, 0x9F, 0xFD, 0xB0, 0x7F, 0x6C, 0x4B, + 0xFE, 0x7D, 0xAF, 0xBF, 0xFE, 0x00, 0x7F, 0xC3, 0x82, 0xCF, 0xFD, 0x1F, 0x17, 0xC4, 0x4F, 0xFC, + 0x34, 0xBF, 0xFE, 0x11, 0xD1, 0xFE, 0xA9, 0xC7, 0xFE, 0x7F, 0xFF, 0x00, 0xE4, 0x9F, 0xFD, 0xB0, + 0x7F, 0x6C, 0x4B, 0xFE, 0x7D, 0xAF, 0xBF, 0xFE, 0x00, 0x7F, 0xC3, 0x82, 0xCF, 0xFD, 0x1F, 0x17, + 0xC4, 0x4F, 0xFC, 0x34, 0xBF, 0xFE, 0x11, 0xD1, 0xFE, 0xA9, 0xC7, 0xFE, 0x7F, 0xFF, 0x00, 0xE4, + 0x9F, 0xFD, 0xB0, 0x7F, 0x6C, 0x4B, 0xFE, 0x7D, 0xAF, 0xBF, 0xFE, 0x00, 0x7F, 0xC3, 0x82, 0xCF, + 0xFD, 0x1F, 0x17, 0xC4, 0x4F, 0xFC, 0x34, 0xBF, 0xFE, 0x11, 0xD1, 0xFE, 0xA9, 0xC7, 0xFE, 0x7F, + 0xFF, 0x00, 0xE4, 0x9F, 0xFD, 0xB0, 0x7F, 0x6C, 0x4B, 0xFE, 0x7D, 0xAF, 0xBF, 0xFE, 0x00, 0x7F, + 0xC3, 0x82, 0xCF, 0xFD, 0x1F, 0x17, 0xC4, 0x4F, 0xFC, 0x34, 0xBF, 0xFE, 0x11, 0xD1, 0xFE, 0xA9, + 0xC7, 0xFE, 0x7F, 0xFF, 0x00, 0xE4, 0x9F, 0xFD, 0xB0, 0x7F, 0x6C, 0x4B, 0xFE, 0x7D, 0xAF, 0xBF, + 0xFE, 0x00, 0x7F, 0xC3, 0x82, 0xCF, 0xFD, 0x1F, 0x17, 0xC4, 0x4F, 0xFC, 0x34, 0xBF, 0xFE, 0x11, + 0xD1, 0xFE, 0xA9, 0xC7, 0xFE, 0x7F, 0xFF, 0x00, 0xE4, 0x9F, 0xFD, 0xB0, 0x7F, 0x6C, 0x4B, 0xFE, + 0x7D, 0xAF, 0xBF, 0xFE, 0x00, 0x7F, 0xC3, 0x82, 0xCF, 0xFD, 0x1F, 0x17, 0xC4, 0x4F, 0xFC, 0x34, + 0xBF, 0xFE, 0x11, 0xD1, 0xFE, 0xA9, 0xC7, 0xFE, 0x7F, 0xFF, 0x00, 0xE4, 0x9F, 0xFD, 0xB0, 0x7F, + 0x6C, 0x4B, 0xFE, 0x7D, 0xAF, 0xBF, 0xFE, 0x00, 0x7F, 0xC3, 0x82, 0xCF, 0xFD, 0x1F, 0x17, 0xC4, + 0x4F, 0xFC, 0x34, 0xBF, 0xFE, 0x11, 0xD1, 0xFE, 0xA9, 0xC7, 0xFE, 0x7F, 0xFF, 0x00, 0xE4, 0x9F, + 0xFD, 0xB0, 0x7F, 0x6C, 0x4B, 0xFE, 0x7D, 0xAF, 0xBF, 0xFE, 0x00, 0x7F, 0xC3, 0x82, 0xCF, 0xFD, + 0x1F, 0x17, 0xC4, 0x4F, 0xFC, 0x34, 0xBF, 0xFE, 0x11, 0xD1, 0xFE, 0xA9, 0xC7, 0xFE, 0x7F, 0xFF, + 0x00, 0xE4, 0x9F, 0xFD, 0xB0, 0x7F, 0x6C, 0x4B, 0xFE, 0x7D, 0xAF, 0xBF, 0xFE, 0x00, 0x7F, 0xC3, + 0x82, 0xCF, 0xFD, 0x1F, 0x17, 0xC4, 0x4F, 0xFC, 0x34, 0xBF, 0xFE, 0x11, 0xD1, 0xFE, 0xA9, 0xC7, + 0xFE, 0x7F, 0xFF, 0x00, 0xE4, 0x9F, 0xFD, 0xB0, 0x7F, 0x6C, 0x4B, 0xFE, 0x7D, 0xAF, 0xBF, 0xFE, + 0x00, 0x7F, 0xC3, 0x82, 0xCF, 0xFD, 0x1F, 0x17, 0xC4, 0x4F, 0xFC, 0x34, 0xBF, 0xFE, 0x11, 0xD1, + 0xFE, 0xA9, 0xC7, 0xFE, 0x7F, 0xFF, 0x00, 0xE4, 0x9F, 0xFD, 0xB0, 0x7F, 0x6C, 0x4B, 0xFE, 0x7D, + 0xAF, 0xBF, 0xFE, 0x00, 0x7F, 0xC3, 0x82, 0xCF, 0xFD, 0x1F, 0x17, 0xC4, 0x4F, 0xFC, 0x34, 0xBF, + 0xFE, 0x11, 0xD1, 0xFE, 0xA9, 0xC7, 0xFE, 0x7F, 0xFF, 0x00, 0xE4, 0x9F, 0xFD, 0xB0, 0x7F, 0x6C, + 0x4B, 0xFE, 0x7D, 0xAF, 0xBF, 0xFE, 0x00, 0x7F, 0xC3, 0x82, 0xCF, 0xFD, 0x1F, 0x17, 0xC4, 0x4F, + 0xFC, 0x34, 0xBF, 0xFE, 0x11, 0xD1, 0xFE, 0xA9, 0xC7, 0xFE, 0x7F, 0xFF, 0x00, 0xE4, 0x9F, 0xFD, + 0xB0, 0x7F, 0x6C, 0x4B, 0xFE, 0x7D, 0xAF, 0xBF, 0xFE, 0x00, 0x7F, 0xC3, 0x82, 0xCF, 0xFD, 0x1F, + 0x17, 0xC4, 0x4F, 0xFC, 0x34, 0xBF, 0xFE, 0x11, 0xD1, 0xFE, 0xA9, 0xC7, 0xFE, 0x7F, 0xFF, 0x00, + 0xE4, 0x9F, 0xFD, 0xB0, 0x7F, 0x6C, 0x4B, 0xFE, 0x7D, 0xAF, 0xBF, 0xFE, 0x00, 0x7F, 0xC3, 0x82, + 0xCF, 0xFD, 0x1F, 0x17, 0xC4, 0x4F, 0xFC, 0x34, 0xBF, 0xFE, 0x11, 0xD1, 0xFE, 0xA9, 0xC7, 0xFE, + 0x7F, 0xFF, 0x00, 0xE4, 0x9F, 0xFD, 0xB0, 0x7F, 0x6C, 0x4B, 0xFE, 0x7D, 0xAF, 0xBF, 0xFE, 0x00, + 0x7F, 0xC3, 0x82, 0xCF, 0xFD, 0x1F, 0x17, 0xC4, 0x4F, 0xFC, 0x34, 0xBF, 0xFE, 0x11, 0xD1, 0xFE, + 0xA9, 0xC7, 0xFE, 0x7F, 0xFF, 0x00, 0xE4, 0x9F, 0xFD, 0xB0, 0x7F, 0x6C, 0x4B, 0xFE, 0x7D, 0xAF, + 0xBF, 0xFE, 0x00, 0x7F, 0xC3, 0x82, 0xCF, 0xFD, 0x1F, 0x17, 0xC4, 0x4F, 0xFC, 0x34, 0xBF, 0xFE, + 0x11, 0xD1, 0xFE, 0xA9, 0xC7, 0xFE, 0x7F, 0xFF, 0x00, 0xE4, 0x9F, 0xFD, 0xB0, 0x7F, 0x6C, 0x4B, + 0xFE, 0x7D, 0xAF, 0xBF, 0xFE, 0x00, 0x7F, 0xC3, 0x82, 0xCF, 0xFD, 0x1F, 0x17, 0xC4, 0x4F, 0xFC, + 0x34, 0xBF, 0xFE, 0x11, 0xD1, 0xFE, 0xA9, 0xC7, 0xFE, 0x7F, 0xFF, 0x00, 0xE4, 0x9F, 0xFD, 0xB0, + 0x7F, 0x6C, 0x4B, 0xFE, 0x7D, 0xAF, 0xBF, 0xFE, 0x00, 0x7F, 0xC3, 0x82, 0xCF, 0xFD, 0x1F, 0x17, + 0xC4, 0x4F, 0xFC, 0x34, 0xBF, 0xFE, 0x11, 0xD1, 0xFE, 0xA9, 0xC7, 0xFE, 0x7F, 0xFF, 0x00, 0xE4, + 0x9F, 0xFD, 0xB0, 0x7F, 0x6C, 0x4B, 0xFE, 0x7D, 0xAF, 0xBF, 0xFE, 0x00, 0x7F, 0xC3, 0x82, 0xCF, + 0xFD, 0x1F, 0x17, 0xC4, 0x4F, 0xFC, 0x34, 0xBF, 0xFE, 0x11, 0xD1, 0xFE, 0xA9, 0xC7, 0xFE, 0x7F, + 0xFF, 0x00, 0xE4, 0x9F, 0xFD, 0xB0, 0x7F, 0x6C, 0x4B, 0xFE, 0x7D, 0xAF, 0xBF, 0xFE, 0x00, 0x7F, + 0xC3, 0x82, 0xCF, 0xFD, 0x1F, 0x17, 0xC4, 0x4F, 0xFC, 0x34, 0xBF, 0xFE, 0x11, 0xD1, 0xFE, 0xA9, + 0xC7, 0xFE, 0x7F, 0xFF, 0x00, 0xE4, 0x9F, 0xFD, 0xB0, 0x7F, 0x6C, 0x4B, 0xFE, 0x7D, 0xAF, 0xBF, + 0xFE, 0x00, 0x7F, 0xC3, 0x82, 0xCF, 0xFD, 0x1F, 0x17, 0xC4, 0x4F, 0xFC, 0x34, 0xBF, 0xFE, 0x11, + 0xD1, 0xFE, 0xA9, 0xC7, 0xFE, 0x7F, 0xFF, 0x00, 0xE4, 0x9F, 0xFD, 0xB0, 0x7F, 0x6C, 0x4B, 0xFE, + 0x7D, 0xAF, 0xBF, 0xFE, 0x00, 0x7F, 0xC3, 0x82, 0xCF, 0xFD, 0x1F, 0x17, 0xC4, 0x4F, 0xFC, 0x34, + 0xBF, 0xFE, 0x11, 0xD1, 0xFE, 0xA9, 0xC7, 0xFE, 0x7F, 0xFF, 0x00, 0xE4, 0x9F, 0xFD, 0xB0, 0x7F, + 0x6C, 0x4B, 0xFE, 0x7D, 0xAF, 0xBF, 0xFE, 0x00, 0x7F, 0xC3, 0x82, 0xCF, 0xFD, 0x1F, 0x17, 0xC4, + 0x4F, 0xFC, 0x34, 0xBF, 0xFE, 0x11, 0xD1, 0xFE, 0xA9, 0xC7, 0xFE, 0x7F, 0xFF, 0x00, 0xE4, 0x9F, + 0xFD, 0xB0, 0x7F, 0x6C, 0x4B, 0xFE, 0x7D, 0xAF, 0xBF, 0xFE, 0x00, 0x7F, 0xC3, 0x82, 0xCF, 0xFD, + 0x1F, 0x17, 0xC4, 0x4F, 0xFC, 0x34, 0xBF, 0xFE, 0x11, 0xD1, 0xFE, 0xA9, 0xC7, 0xFE, 0x7F, 0xFF, + 0x00, 0xE4, 0x9F, 0xFD, 0xB0, 0x7F, 0x6C, 0x4B, 0xFE, 0x7D, 0xAF, 0xBF, 0xFE, 0x00, 0x7F, 0xC3, + 0x82, 0xCF, 0xFD, 0x1F, 0x17, 0xC4, 0x4F, 0xFC, 0x34, 0xBF, 0xFE, 0x11, 0xD1, 0xFE, 0xA9, 0xC7, + 0xFE, 0x7F, 0xFF, 0x00, 0xE4, 0x9F, 0xFD, 0xB0, 0x7F, 0x6C, 0x4B, 0xFE, 0x7D, 0xAF, 0xBF, 0xFE, + 0x00, 0x7F, 0xC3, 0x82, 0xCF, 0xFD, 0x1F, 0x17, 0xC4, 0x4F, 0xFC, 0x34, 0xBF, 0xFE, 0x11, 0xD1, + 0xFE, 0xA9, 0xC7, 0xFE, 0x7F, 0xFF, 0x00, 0xE4, 0x9F, 0xFD, 0xB0, 0x7F, 0x6C, 0x4B, 0xFE, 0x7D, + 0xAF, 0xBF, 0xFE, 0x00, 0x7F, 0xC3, 0x82, 0xCF, 0xFD, 0x1F, 0x17, 0xC4, 0x4F, 0xFC, 0x34, 0xBF, + 0xFE, 0x11, 0xD1, 0xFE, 0xA9, 0xC7, 0xFE, 0x7F, 0xFF, 0x00, 0xE4, 0x9F, 0xFD, 0xB0, 0x7F, 0x6C, + 0x4B, 0xFE, 0x7D, 0xAF, 0xBF, 0xFE, 0x00, 0x7F, 0xC3, 0x82, 0xCF, 0xFD, 0x1F, 0x17, 0xC4, 0x4F, + 0xFC, 0x34, 0xBF, 0xFE, 0x11, 0xD1, 0xFE, 0xA9, 0xC7, 0xFE, 0x7F, 0xFF, 0x00, 0xE4, 0x9F, 0xFD, + 0xB0, 0x7F, 0x6C, 0x4B, 0xFE, 0x7D, 0xAF, 0xBF, 0xFE, 0x00, 0x7F, 0xC3, 0x82, 0xCF, 0xFD, 0x1F, + 0x17, 0xC4, 0x4F, 0xFC, 0x34, 0xBF, 0xFE, 0x11, 0xD1, 0xFE, 0xA9, 0xC7, 0xFE, 0x7F, 0xFF, 0x00, + 0xE4, 0x9F, 0xFD, 0xB0, 0x7F, 0x6C, 0x4B, 0xFE, 0x7D, 0xAF, 0xBF, 0xFE, 0x00, 0x7F, 0xC3, 0x82, + 0xCF, 0xFD, 0x1F, 0x17, 0xC4, 0x4F, 0xFC, 0x34, 0xBF, 0xFE, 0x11, 0xD1, 0xFE, 0xA9, 0xC7, 0xFE, + 0x7F, 0xFF, 0x00, 0xE4, 0x9F, 0xFD, 0xB0, 0x7F, 0x6C, 0x4B, 0xFE, 0x7D, 0xAF, 0xBF, 0xFE, 0x00, + 0x7F, 0xC3, 0x82, 0xCF, 0xFD, 0x1F, 0x17, 0xC4, 0x4F, 0xFC, 0x34, 0xBF, 0xFE, 0x11, 0xD1, 0xFE, + 0xA9, 0xC7, 0xFE, 0x7F, 0xFF, 0x00, 0xE4, 0x9F, 0xFD, 0xB0, 0x7F, 0x6C, 0x4B, 0xFE, 0x7D, 0xAF, + 0xBF, 0xFE, 0x00, 0x7F, 0xC3, 0x82, 0xCF, 0xFD, 0x1F, 0x17, 0xC4, 0x4F, 0xFC, 0x34, 0xBF, 0xFE, + 0x11, 0xD1, 0xFE, 0xA9, 0xC7, 0xFE, 0x7F, 0xFF, 0x00, 0xE4, 0x9F, 0xFD, 0xB0, 0x7F, 0x6C, 0x4B, + 0xFE, 0x7D, 0xAF, 0xBF, 0xFE, 0x00, 0x7F, 0xC3, 0x82, 0xCF, 0xFD, 0x1F, 0x17, 0xC4, 0x4F, 0xFC, + 0x34, 0xBF, 0xFE, 0x11, 0xD1, 0xFE, 0xA9, 0xC7, 0xFE, 0x7F, 0xFF, 0x00, 0xE4, 0x9F, 0xFD, 0xB0, + 0x7F, 0x6C, 0x4B, 0xFE, 0x7D, 0xAF, 0xBF, 0xFE, 0x01, 0xDE, 0x7C, 0x1E, 0xFF, 0x00, 0x82, 0x1D, + 0xE9, 0x7F, 0x0A, 0x7E, 0x36, 0x7C, 0x1E, 0xF8, 0xD3, 0x77, 0xFB, 0x58, 0x78, 0xAF, 0xC6, 0xB7, + 0xBF, 0x08, 0x7E, 0x25, 0x68, 0x1F, 0x11, 0xAC, 0xF4, 0x2D, 0x57, 0xE1, 0x2C, 0x76, 0x6B, 0xAD, + 0x1D, 0x07, 0x56, 0x82, 0xF9, 0x2C, 0x0D, 0xE1, 0xD7, 0x66, 0x68, 0x12, 0x56, 0xB5, 0xD8, 0x5C, + 0x47, 0x26, 0xCD, 0xE5, 0x82, 0x36, 0x30, 0x77, 0xC3, 0x70, 0xCA, 0xC3, 0x62, 0x29, 0xD7, 0x55, + 0xAF, 0xCB, 0x24, 0xED, 0xCB, 0x6B, 0xD9, 0xA7, 0x6F, 0x8B, 0x4D, 0xBB, 0x11, 0x53, 0x35, 0x95, + 0x4A, 0x52, 0xA5, 0xEC, 0xD2, 0x4D, 0x35, 0xBE, 0xD7, 0x56, 0xEC, 0x7E, 0xEF, 0xD7, 0xD4, 0x1E, + 0x40, 0x50, 0x01, 0x40, 0x05, 0x00, 0x14, 0x00, 0x50, 0x01, 0x40, 0x05, 0x00, 0x14, 0x00, 0x50, + 0x01, 0x40, 0x05, 0x00, 0x14, 0x00, 0x50, 0x01, 0x40, 0x05, 0x00, 0x14, 0x00, 0x50, 0x01, 0x40, + 0x05, 0x00, 0x14, 0x00, 0x50, 0x01, 0x40, 0x05, 0x00, 0x14, 0x00, 0x50, 0x01, 0x40, 0x05, 0x00, + 0x14, 0x00, 0x50, 0x01, 0x40, 0x05, 0x00, 0x14, 0x00, 0x50, 0x01, 0x40, 0x05, 0x00, 0x14, 0x00, + 0x50, 0x01, 0x40, 0x05, 0x00, 0x14, 0x00, 0x50, 0x01, 0x40, 0x05, 0x00, 0x14, 0x00, 0x50, 0x01, + 0x40, 0x05, 0x00, 0x14, 0x00, 0x50, 0x01, 0x40, 0x05, 0x00, 0x14, 0x00, 0x50, 0x01, 0x40, 0x05, + 0x00, 0x14, 0x00, 0x50, 0x01, 0x40, 0x05, 0x00, 0x14, 0x00, 0x50, 0x01, 0x40, 0x05, 0x00, 0x14, + 0x00, 0x50, 0x01, 0x40, 0x05, 0x00, 0x14, 0x00, 0x50, 0x01, 0x40, 0x05, 0x00, 0x14, 0x00, 0x50, + 0x01, 0x40, 0x05, 0x00, 0x14, 0x00, 0x50, 0x01, 0x40, 0x05, 0x00, 0x14, 0x00, 0x50, 0x01, 0x40, + 0x05, 0x00, 0x14, 0x00, 0x50, 0x01, 0x40, 0x05, 0x00, 0x14, 0x00, 0x50, 0x01, 0x40, 0x05, 0x00, + 0x14, 0x00, 0x50, 0x01, 0x40, 0x05, 0x00, 0x14, 0x00, 0x50, 0x01, 0x40, 0x05, 0x00, 0x14, 0x00, + 0x50, 0x01, 0x40, 0x05, 0x00, 0x14, 0x00, 0x50, 0x01, 0x40, 0x05, 0x00, 0x14, 0x00, 0x50, 0x01, + 0x40, 0x05, 0x00, 0x14, 0x00, 0x50, 0x01, 0x40, 0x05, 0x00, 0x14, 0x00, 0x50, 0x01, 0x40, 0x05, + 0x00, 0x14, 0x00, 0x50, 0x01, 0x40, 0x05, 0x00, 0x14, 0x00, 0x50, 0x01, 0x40, 0x05, 0x00, 0x14, + 0x00, 0x50, 0x01, 0x40, 0x05, 0x00, 0x14, 0x00, 0x50, 0x01, 0x40, 0x05, 0x00, 0x14, 0x00, 0x50, + 0x07, 0xFF, 0xD9, +}; + +UINT SizeOfWaterMark() +{ + return sizeof(WaterMark); +} + +UINT SizeOfSaitama() +{ + return sizeof(Saitama); +} + + + diff --git a/src/Cedar/WaterMark.h b/src/Cedar/WaterMark.h index 964d86d8..1ce3a0dc 100644 --- a/src/Cedar/WaterMark.h +++ b/src/Cedar/WaterMark.h @@ -1,30 +1,30 @@ -// SoftEther VPN Source Code - Developer Edition Master Branch -// Cedar Communication Module - - -// WaterMark.h -// Header of WaterMark.c - -#include -#include -#include -#include -#include -#include -#include -#include - -#ifndef WATERMARK_H -#define WATERMARK_H - -// Digital watermark -extern BYTE WaterMark[]; -extern BYTE Saitama[]; - -UINT SizeOfWaterMark(); -UINT SizeOfSaitama(); - -#define MAX_WATERMARK_SIZE (SizeOfWaterMark() + HTTP_PACK_RAND_SIZE_MAX * 2) - -#endif // WATERMARK_H - +// SoftEther VPN Source Code - Developer Edition Master Branch +// Cedar Communication Module + + +// WaterMark.h +// Header of WaterMark.c + +#include +#include +#include +#include +#include +#include +#include +#include + +#ifndef WATERMARK_H +#define WATERMARK_H + +// Digital watermark +extern BYTE WaterMark[]; +extern BYTE Saitama[]; + +UINT SizeOfWaterMark(); +UINT SizeOfSaitama(); + +#define MAX_WATERMARK_SIZE (SizeOfWaterMark() + HTTP_PACK_RAND_SIZE_MAX * 2) + +#endif // WATERMARK_H + diff --git a/src/Cedar/WebUI.c b/src/Cedar/WebUI.c index 3d94a7f1..2915746b 100644 --- a/src/Cedar/WebUI.c +++ b/src/Cedar/WebUI.c @@ -1,1883 +1,1883 @@ -// SoftEther VPN Source Code - Developer Edition Master Branch -// Cedar Communication Module - - -// WebUI.c -// Web User Interface module - -#include "CedarPch.h" - -static WU_CONTEXT *WuNewContext(WEBUI *wu, char *hubname); -static void WuFreeContext(WU_CONTEXT *context); -static WU_WEBPAGE *WuNewUniWebPage(wchar_t *content); -static WU_WEBPAGE *WuNewWebPage(char *content, UINT size, char *filename); -static wchar_t *WuErrorPage(UINT errorcode); -static wchar_t *WuRedirectPage(char *url); -static wchar_t *WuUniReadFile(char *filename); -static void WuUniReplace(wchar_t **buf, wchar_t *from, wchar_t *to); -static void WuUniInsertBefore(wchar_t **buf, wchar_t *insert, wchar_t *before); -static LIST *WuAnalyzeTarget(char *target,char *filename, UINT size); -static void WuFreeStrStrMap(LIST *params); -static void WuEnableTag(wchar_t **buf, wchar_t *keyword); -static char *WuNewSessionKey(); -static void WuUniStrReplace(wchar_t **buf, wchar_t *from, char *to); -static wchar_t *WuUniGetTemplate(wchar_t **str, wchar_t *start, wchar_t *end, bool erase); -static void WuUniUintReplace(wchar_t **buf, wchar_t *key, UINT num); -static void WuUniUint64Replace(wchar_t **buf, wchar_t *key, UINT64 num); -static wchar_t *WuUniGetTemplate(wchar_t **str, wchar_t *start, wchar_t *end, bool erase); -static LIST *WuUniMakeTable(wchar_t *def); -static LIST *WuUniMakeTableFromTemplate(wchar_t **str, wchar_t *start, wchar_t *end); -static void WuExpireSessionKey(WEBUI *wu); -static WU_CONTEXT *WuGetContext(LIST *contexts, char *sessionkey); - -#define WP_DEFAULT "/webui/" -#define WP_LOGIN "/webui/login.cgi" -#define WP_REDIRECT "/webui/redirect.cgi" -#define WP_ERROR "/webui/error.cgi" -#define WP_SERVER "/webui/server.cgi" -#define WP_LISTENER "/webui/listener.cgi" -#define WP_HUB "/webui/hub.cgi" -#define WP_USER "/webui/user.cgi" -#define WP_EDITUSER "/webui/edituser.cgi" -#define WP_NEWHUB "/webui/newhub.cgi" -#define WP_LICENSE "/webui/license.cgi" -#define WP_LOCALBRIDGE "/webui/localbridge.cgi" -#define WP_SECURENAT "/webui/securenat.cgi" -#define WP_SESSION "/webui/session.cgi" - -static wchar_t *WpDefault(WEBUI *wu, LIST *params); -static wchar_t *WpLogin(WEBUI *wu, LIST *params); -static wchar_t *WpServer(WEBUI *wu, LIST *params); -static wchar_t *WpListener(WEBUI *wu, LIST *params); -static wchar_t *WpHub(WEBUI *wu, LIST *params); -static wchar_t *WpUser(WEBUI *wu, LIST *params); -static wchar_t *WpEditUser(WEBUI *wu, LIST *params); -static wchar_t *WpNewHub(WEBUI *wu, LIST *params); -static wchar_t *WpLicense(WEBUI *wu, LIST *params); -static wchar_t *WpLocalBridge(WEBUI *wu, LIST *params); -static wchar_t *WpSecureNAT(WEBUI *wu, LIST *params); -static wchar_t *WpSession(WEBUI *wu, LIST *params); - -// WebUI page handler table -static STRMAP_ENTRY wu_pages[] = { - {WP_DEFAULT, WpDefault}, - {WP_LOGIN, WpLogin}, - {WP_SERVER, WpServer}, - {WP_LISTENER, WpListener}, - {WP_HUB, WpHub}, - {WP_USER, WpUser}, - {WP_EDITUSER, WpEditUser}, - {WP_NEWHUB, WpNewHub}, - {WP_LICENSE, WpLicense}, - {WP_LOCALBRIDGE, WpLocalBridge}, - {WP_SECURENAT, WpSecureNAT}, - {WP_SESSION, WpSession}, -}; - -// **** Page handlers - -// Redirect the directory access to the login screen -static wchar_t *WpDefault(WEBUI *wu, LIST *params) -{ - return WuRedirectPage(WP_LOGIN); -} - -// Login page -static wchar_t *WpLogin(WEBUI *wu, LIST *params) -{ - UINT result; - char random[20], securepass[SHA1_SIZE]; - char *password = (char*)StrMapSearch(params, "PASS"); - char *hubname = (char*)StrMapSearch(params, "HUB"); - - if(password == NULL) - { - wchar_t *buf = WuUniReadFile("|"WP_LOGIN); - WuUniStrReplace(&buf, L"ACTION", WP_LOGIN); - WuUniStrReplace(&buf, L"HUBNAME", hubname == NULL ? "" : hubname); - return buf; - } - - // Administrator authentication - Rand(random,sizeof(random)); - Sha0(securepass, password, StrLen(password)); - SecurePassword(securepass, securepass, random); - result = AdminCheckPassword(wu->Cedar, random, securepass, hubname, false, NULL); - - if(result == ERR_NO_ERROR) - { - // Successful login - char tmp[MAX_SIZE]; - STRMAP_ENTRY *context; - - // Create a new context - context = Malloc(sizeof(STRMAP_ENTRY)); - context->Name = WuNewSessionKey(); - context->Value = WuNewContext(wu, hubname); - Add(wu->Contexts, context); - - // Transfer to the server management screen - Format(tmp, sizeof(tmp), "%s?KEY=%s", WP_SERVER, context->Name); - return WuRedirectPage(tmp); - }else{ - // Login failure - wchar_t *buf = WuUniReadFile("|"WP_LOGIN); - WuUniStrReplace(&buf, L"ACTION", WP_LOGIN); - WuUniStrReplace(&buf, L"HUBNAME",hubname == NULL ? "" : hubname); - WuUniReplace(&buf, L"", GetUniErrorStr(result)); - return buf; - } -} - -// Server management -static wchar_t *WpServer(WEBUI *wu, LIST *params) -{ - char *sessionkey = (char*)StrMapSearch(params, "KEY"); - WU_CONTEXT *context = WuGetContext(wu->Contexts, sessionkey); - UINT i; - wchar_t *buf; - LIST *strmap; - - if(context == NULL) - { - return WuRedirectPage(WP_LOGIN); - } - - buf = WuUniReadFile("|"WP_SERVER); - strmap = WuUniMakeTableFromTemplate(&buf, L""); - - // Show the Virtual HUB list - { - wchar_t *tmpl = WuUniGetTemplate(&buf, L"", true); - RPC_ENUM_HUB t; - - t.Hubs = NULL; - StEnumHub(context->Admin, &t); - for(i=0; iLastLoginTime)); - GetDateTimeStr64Uni(lastcomm, sizeof(lastcomm), SystemToLocal64(item->LastCommTime)); - WuUniStrReplace(&tmp, L"{HUBNAME}", item->HubName); - WuUniReplace(&tmp, L"{HUBSTATE}", item->Online ? StrMapSearch(strmap, "HUB_ONLINE") : StrMapSearch(strmap, "HUB_OFFLINE")); - WuUniReplace(&tmp, L"{HUBTYPE}", item->HubType == HUB_TYPE_STANDALONE ? StrMapSearch(strmap, "HUB_STANDALONE") - : item->HubType == HUB_TYPE_FARM_DYNAMIC ? StrMapSearch(strmap,"HUB_DYNAMIC") : StrMapSearch(strmap, "HUB_STATIC")); - WuUniUintReplace(&tmp, L"{HUBUSERS}", item->NumUsers); - WuUniUintReplace(&tmp, L"{HUBGROUPS}", item->NumGroups); - WuUniUintReplace(&tmp, L"{HUBSESSIONS}", item->NumSessions); - WuUniUintReplace(&tmp, L"{HUBMACS}", item->NumMacTables); - WuUniUintReplace(&tmp, L"{HUBIPS}", item->NumIpTables); - WuUniUintReplace(&tmp, L"{HUBLOGINS}", item->NumLogin); - WuUniReplace(&tmp, L"{HUBLASTLOGINDATE}", lastlogin); - WuUniReplace(&tmp, L"{HUBLASTCOMMDATE}", lastcomm); - - WuUniInsertBefore(&buf, tmp, L""); - Free(tmp); - } - FreeRpcEnumHub(&t); - Free(tmpl); - } - - // Show the listener list - { - RPC_LISTENER_LIST t; - wchar_t *tmpl = WuUniGetTemplate(&buf, L"", true); - Zero(&t, sizeof(t)); - StEnumListener(context->Admin, &t); - for(i=0; i"); - Free(tmp); - } - FreeRpcListenerList(&t); - Free(tmpl); - } - WuUniStrReplace(&buf, L"{LINK_HUB}", WP_HUB); - WuUniStrReplace(&buf, L"{SESSIONKEY}", sessionkey); - WuUniStrReplace(&buf, L"{LISTENER_LINK}", WP_LISTENER); - WuUniStrReplace(&buf, L"{LINK_NEWHUB}", WP_NEWHUB); - WuUniStrReplace(&buf, L"{LINK_SERVER}", WP_SERVER); - WuUniStrReplace(&buf, L"{LINK_LICENSE}", WP_LICENSE); - WuUniStrReplace(&buf, L"{LINK_LOCALBRIDGE}", WP_LOCALBRIDGE); - - WuFreeStrStrMap(strmap); - - return buf; -} - -// Listener management -static wchar_t *WpListener(WEBUI *wu, LIST *params) -{ - char *sessionkey = (char*)StrMapSearch(params, "KEY"); - WU_CONTEXT *context = WuGetContext(wu->Contexts, sessionkey); - char *cmd = (char*)StrMapSearch(params, "CMD"); - RPC_LISTENER t; - UINT retcode = ERR_NO_ERROR; - - if(context == NULL) - { - return WuRedirectPage(WP_LOGIN); - } - - t.Port = ToInt((char*)StrMapSearch(params, "PORT")); - - if( StrCmp(cmd, "CREATE") == 0 ) - { - // Create a new listener - if(t.Port == 0) - { - wchar_t *buf = WuUniReadFile("|"WP_LISTENER); - WuUniStrReplace(&buf, L"ACTION", WP_LISTENER); - WuUniStrReplace(&buf, L"SESSIONKEY", sessionkey); - return buf; - } - else - { - t.Enable = true; - retcode = StCreateListener(context->Admin, &t); - } - } - else if( StrCmp(cmd, "DEL")==0 ) - { - retcode = StDeleteListener(context->Admin, &t); - } - else if(StrCmp(cmd, "START")==0 ) - { - t.Enable = true; - retcode = StEnableListener(context->Admin, &t); - } - else if(StrCmp(cmd, "STOP")==0 ) - { - t.Enable = false; - retcode = StEnableListener(context->Admin, &t); - } - - if(retcode == ERR_NO_ERROR) - { - char tmp[MAX_SIZE]; - Format(tmp, sizeof(tmp), "%s?KEY=%s", WP_SERVER, sessionkey); - return WuRedirectPage(tmp); - } - return WuErrorPage(retcode); -} - -// Virtual HUB management -static wchar_t *WpHub(WEBUI *wu, LIST *params) -{ - char *hubname = (char*)StrMapSearch(params, "HUB"); - char *sessionkey = (char*)StrMapSearch(params, "KEY"); - char *cmd = (char*)StrMapSearch(params, "CMD"); - WU_CONTEXT *context = WuGetContext(wu->Contexts, sessionkey); - - // Confirm the session - if(context == NULL) - { - return WuRedirectPage(WP_LOGIN); - } - - if(StrCmp(cmd, "ONLINE") == 0 || StrCmp(cmd, "OFFLINE") == 0) - { - // Online / offline switching - UINT retcode; - RPC_SET_HUB_ONLINE t; - StrCpy(t.HubName, sizeof(t.HubName), hubname); - t.Online = (StrCmp(cmd, "ONLINE") == 0) ? true : false; - retcode = StSetHubOnline(context->Admin, &t); - if(retcode == ERR_NO_ERROR){ - char tmp[MAX_SIZE]; - Format(tmp, sizeof(tmp), "%s?HUB=%s&KEY=%s", WP_HUB, hubname, sessionkey); - return WuRedirectPage(tmp); - }else{ - return WuErrorPage(retcode); - } - } - else if(StrCmp(cmd, "DELETE") == 0) - { - // Delete the Virtual HUB - RPC_DELETE_HUB t; - UINT retcode; - StrCpy(t.HubName, sizeof(t.HubName), hubname); - retcode = StDeleteHub(context->Admin, &t); - if(retcode == ERR_NO_ERROR) - { - char tmp[MAX_SIZE]; - Format(tmp, sizeof(tmp), "%s?KEY=%s", WP_SERVER, sessionkey); - return WuRedirectPage(tmp); - } - return WuErrorPage(retcode); - } - else - { - // Show the status and commands of the virtual HUB - RPC_HUB_STATUS t; - UINT retcode; - Zero(&t, sizeof(t)); - StrCpy(t.HubName, sizeof(t.HubName), hubname); - retcode = StGetHubStatus(context->Admin, &t); - if(retcode == ERR_NO_ERROR) - { - wchar_t tmp[MAX_SIZE]; - wchar_t *buf = WuUniReadFile("|"WP_HUB); - LIST *strmap = WuUniMakeTableFromTemplate(&buf, L""); - - WuUniStrReplace(&buf, L"{HUBNAME}", t.HubName); - WuUniReplace(&buf, L"{HUBSTATE}", StrMapSearch(strmap, t.Online == false ? "HUB_OFFLINE" : "HUB_ONLINE")); - WuUniReplace(&buf, L"{HUBTYPE}", GetHubTypeStr(t.HubType)); - WuUniReplace(&buf, L"{HUBSNAT}", StrMapSearch(strmap, t.SecureNATEnabled == false ? "SECNAT_OFF" : "SECNAT_ON")); - WuUniUintReplace(&buf, L"{HUBSESSIONS}", t.NumSessions); - WuUniUintReplace(&buf, L"{HUBACLS}", t.NumAccessLists); - WuUniUintReplace(&buf, L"{HUBUSERS}", t.NumUsers); - WuUniUintReplace(&buf, L"{HUBGROUPS}", t.NumGroups); - WuUniUintReplace(&buf, L"{HUBMACTBLS}", t.NumMacTables); - WuUniUintReplace(&buf, L"{HUBIPTBLS}", t.NumIpTables); - WuUniUintReplace(&buf, L"{HUBLOGINS}", t.NumLogin); - GetDateTimeStr64Uni(tmp, sizeof(tmp), SystemToLocal64(t.LastLoginTime)); - WuUniReplace(&buf, L"{HUBLASTLOGIN}", tmp); - GetDateTimeStr64Uni(tmp, sizeof(tmp), SystemToLocal64(t.LastCommTime)); - WuUniReplace(&buf, L"{HUBLASTCOMM}", tmp); - WuUniUint64Replace(&buf, L"{HUBTXUNIPKTS}", t.Traffic.Send.UnicastCount); - WuUniUint64Replace(&buf, L"{HUBTXUNISIZE}", t.Traffic.Send.UnicastBytes); - WuUniUint64Replace(&buf, L"{HUBTXBRPKTS}", t.Traffic.Send.BroadcastCount); - WuUniUint64Replace(&buf, L"{HUBTXBRSIZE}", t.Traffic.Send.BroadcastBytes); - WuUniUint64Replace(&buf, L"{HUBRXUNIPKTS}", t.Traffic.Recv.UnicastCount); - WuUniUint64Replace(&buf, L"{HUBRXUNISIZE}", t.Traffic.Recv.UnicastBytes); - WuUniUint64Replace(&buf, L"{HUBRXBRPKTS}", t.Traffic.Recv.BroadcastCount); - WuUniUint64Replace(&buf, L"{HUBRXBRSIZE}", t.Traffic.Recv.BroadcastBytes); - - WuEnableTag(&buf, t.Online ? L"ENABLE_OFFLINE" : L"ENABLE_ONLINE"); - - WuUniStrReplace(&buf, L"{LINK_HUB}", WP_HUB); - WuUniStrReplace(&buf, L"{LINK_USER}", WP_USER); - WuUniStrReplace(&buf, L"{LINK_SERVER}", WP_SERVER); - WuUniStrReplace(&buf, L"{LINK_SESSION}", WP_SESSION); - WuUniStrReplace(&buf, L"{HUBNAME}", hubname); - WuUniStrReplace(&buf, L"{SESSIONKEY}", sessionkey); - WuUniStrReplace(&buf, L"{LINK_SECURENAT}", WP_SECURENAT); - - WuFreeStrStrMap(strmap); - - return buf; - }else{ - return WuErrorPage(retcode); - } - } -} - -// User list -static wchar_t *WpUser(WEBUI *wu, LIST *params) -{ - char *sessionkey = (char*)StrMapSearch(params, "KEY"); - WU_CONTEXT *context = WuGetContext(wu->Contexts, sessionkey); - char *hubname = (char*)StrMapSearch(params, "HUB"); - char *cmd = (char*)StrMapSearch(params, "CMD"); - UINT retcode; - RPC_ENUM_USER t; - - // Check the context - if(context == NULL) - { - return WuRedirectPage(WP_LOGIN); - } - - if(cmd != NULL && StrCmp(cmd, "DEL") == 0) - { - char *username = (char*)StrMapSearch(params, "USER"); - RPC_DELETE_USER t; - UINT retcode; - - StrCpy(t.HubName, sizeof(t.HubName), hubname); - StrCpy(t.Name, sizeof(t.Name), username); - retcode = StDeleteUser(context->Admin, &t); - if(retcode == ERR_NO_ERROR) - { - char tmp[MAX_SIZE]; - Format(tmp, sizeof(tmp), "%s?HUB=%s&KEY=%s", WP_USER, hubname, sessionkey); - return WuRedirectPage(tmp); - }else - { - return WuErrorPage(retcode); - } - } - - Zero(&t, sizeof(t)); - StrCpy(t.HubName, sizeof(t.HubName), hubname); - retcode = StEnumUser(context->Admin, &t); - if(retcode == ERR_NO_ERROR) - { - UINT i; - wchar_t *buf = WuUniReadFile("|"WP_USER); - wchar_t *tmpl = WuUniGetTemplate(&buf, L"", true); - wchar_t tmp[MAX_SIZE]; - wchar_t datestr[MAX_SIZE]; - - for(i=0; iLastLoginTime)); - UniFormat(tmp, sizeof(tmp), tmpl, item->Name, item->Name, item->Name, item->Realname, item->GroupName, - item->Note, GetAuthTypeStr(item->AuthType), item->NumLogin, datestr); - WuUniInsertBefore(&buf, tmp, L""); - } - WuUniStrReplace(&buf, L"{SESSIONKEY}", sessionkey); - WuUniStrReplace(&buf, L"{HUBNAME}", hubname); - WuUniStrReplace(&buf, L"{LINK_USER}", WP_USER); - WuUniStrReplace(&buf, L"{LINK_EDITUSER}", WP_EDITUSER); - WuUniStrReplace(&buf, L"{LINK_HUB}", WP_HUB); - - FreeRpcEnumUser(&t); - Free(tmpl); - return buf; - }else{ - return WuErrorPage(retcode); - } -} - -// User edit page -static wchar_t *WpEditUser(WEBUI *wu, LIST *params) -{ - char *sessionkey = (char*)StrMapSearch(params, "KEY"); - WU_CONTEXT *context = WuGetContext(wu->Contexts, sessionkey); - char *hubname = (char*)StrMapSearch(params, "HUB"); - char *username = (char*)StrMapSearch(params, "USER"); - char *cmd = (char*)StrMapSearch(params, "CMD"); - char tmp[MAX_SIZE]; - wchar_t utmp[MAX_SIZE]; - UINT retcode; - RPC_SET_USER t; - wchar_t *buf; - - // Check the context - if(context == NULL) - { - return WuRedirectPage(WP_LOGIN); - } - - if(cmd != NULL && (StrCmp(cmd, "SET") == 0 || StrCmp(cmd, "CREATE") == 0)) - { - char *authtype = (char*)StrMapSearch(params, "AUTHTYPE"); - char *password = (char*)StrMapSearch(params, "PASSWORD"); - char *password2 = (char*)StrMapSearch(params, "PASSWORD2"); - bool create = (StrCmp(cmd, "CREATE") == 0); - - Zero(&t, sizeof(t)); - StrCpy(t.Name, sizeof(t.Name), username); - StrCpy(t.HubName, sizeof(t.HubName), hubname); - - // Read the original user data in the case of edit mode. - if(!create) - { - retcode = StGetUser(context->Admin, &t); - if(retcode != ERR_NO_ERROR) - { - return WuErrorPage(retcode); - } - } - - // Set the authentication method - if(StrCmp(authtype, "ANONYMOUS") == 0) - { - FreeAuthData(t.AuthType, t.AuthData); - t.AuthType = AUTHTYPE_ANONYMOUS; - t.AuthData = NULL; - } - else if(StrCmp(authtype, "PASSWORD") == 0) - { - if(StrCmp(password,password2) != 0) - { - // Password for confirmation is mismatched - return WuErrorPage(ERR_INVALID_PARAMETER); - } - - // If the password field has not changed, leave as is - if(t.AuthType != AUTHTYPE_PASSWORD || StrCmp(password, WU_PASSWORD_NOCHANGE) != 0) - { - FreeAuthData(t.AuthType, t.AuthData); - t.AuthType = AUTHTYPE_PASSWORD; - t.AuthData = NewPasswordAuthData(username, password); - } - } - else - { - // Parameters of the authentication method is invalid - return WuErrorPage(ERR_INVALID_PARAMETER); - } - - // Set the user information - if(create) - { - retcode = StCreateUser(context->Admin, &t); - } - else - { - retcode = StSetUser(context->Admin, &t); - } - if(retcode != ERR_NO_ERROR) - { - return WuErrorPage(retcode); - } - - Format(tmp, sizeof(tmp), "%s?KEY=%s&HUB=%s", WP_USER, sessionkey, hubname); - return WuRedirectPage(tmp); - } - - // Generate the user edit page - Zero(&t, sizeof(t)); - StrCpy(t.HubName, sizeof(t.HubName), hubname); - - if( username == NULL ) - { - t.AuthType = AUTHTYPE_PASSWORD; - }else{ - UINT retcode; - StrCpy(t.Name, sizeof(t.Name), username); - retcode = StGetUser(context->Admin, &t); - if(retcode != ERR_NO_ERROR) - { - return WuErrorPage(retcode); - } - } - - buf = WuUniReadFile("|"WP_EDITUSER); - - if( username == NULL) - { - WuEnableTag(&buf, L"{USERNAMEINPUT}"); - WuUniReplace(&buf, L"{USERNAME}", L""); - WuUniReplace(&buf, L"{CMDNAME}", L"CREATE"); - WuUniReplace(&buf, L"{PASSWORD}", L""); - } - else - { - WuEnableTag(&buf, L"{USERNAMEHIDDEN}"); - WuUniStrReplace(&buf, L"{USERNAME}", username); - WuUniReplace(&buf, L"{CMDNAME}", L"SET"); - WuUniStrReplace(&buf, L"{PASSWORD}", WU_PASSWORD_NOCHANGE); - } - - // Select the authentication method - if(t.AuthType == AUTHTYPE_ANONYMOUS) - { - WuUniReplace(&buf, L"{SELANONYM}", L"checked"); - } - else - { - WuUniReplace(&buf, L"{SELANONYM}", L""); - if(t.AuthType == AUTHTYPE_PASSWORD) - { - WuUniReplace(&buf, L"{SELPASSWD}", L"checked"); - } - else - { - WuUniReplace(&buf, L"{SELPASSWD}", L""); - } - } - - WuUniReplace(&buf, L"{REALNAME}", t.Realname); - WuUniReplace(&buf, L"{NOTETEXT}", t.Note); - WuUniStrReplace(&buf, L"{GROUPNAME}", t.GroupName); - GetDateTimeStr64Uni(utmp, sizeof(utmp), SystemToLocal64(t.ExpireTime)); - WuUniReplace(&buf, L"{EXPIREDATE}", utmp); - - WuUniStrReplace(&buf, L"{SESSIONKEY}", sessionkey); - WuUniStrReplace(&buf, L"{HUBNAME}", hubname); - WuUniStrReplace(&buf, L"{LINK_EDITUSER}", WP_EDITUSER); - WuUniStrReplace(&buf, L"{LINK_USER}", WP_USER); - - return buf; -} - -// Create a new Virtual HUB -static wchar_t *WpNewHub(WEBUI *wu, LIST *params) -{ - char *sessionkey = (char*)StrMapSearch(params, "KEY"); - WU_CONTEXT *context = WuGetContext(wu->Contexts, sessionkey); - char *cmd = (char*)StrMapSearch(params, "CMD"); - wchar_t *buf; - - if(context == NULL) - { - return WuRedirectPage(WP_LOGIN); - } - - if(StrCmp(cmd, "CREATE") == 0) - { - UINT retcode; - char tmp[MAX_SIZE]; - RPC_CREATE_HUB t; - RPC_SERVER_INFO t2; - char *hubname = (char*)StrMapSearch(params, "NAME"); - char *passwd = (char*)StrMapSearch(params, "PASSWD"); - char *passwd2 = (char*)StrMapSearch(params, "PASSWD2"); - - if(strcmp(passwd,passwd2) != 0) - { - return WuErrorPage(ERR_INVALID_PARAMETER); - } - - Zero(&t, sizeof(t)); - StrCpy(t.HubName, sizeof(t.HubName), hubname); - Sha0(t.HashedPassword, passwd, StrLen(passwd)); - HashPassword(t.SecurePassword, ADMINISTRATOR_USERNAME, passwd); - t.Online = true; - t.HubType = HUB_TYPE_STANDALONE; - - // Set to dynamic HUB in the case of cluster controller - Zero(&t2, sizeof(t2)); - if (StGetServerInfo(context->Admin, &t2) == ERR_NO_ERROR) - { - if (t2.ServerType == SERVER_TYPE_FARM_CONTROLLER) - { - t.HubType = HUB_TYPE_FARM_DYNAMIC; - } - FreeRpcServerInfo(&t2); - } - - retcode = StCreateHub(context->Admin, &t); - if(retcode != ERR_NO_ERROR) - { - return WuErrorPage(retcode); - } - - Format(tmp, sizeof(tmp), "%s?KEY=%s", WP_SERVER, sessionkey); - return WuRedirectPage(tmp); - } - - buf = WuUniReadFile("|"WP_NEWHUB); - WuUniStrReplace(&buf, L"{SESSIONKEY}", sessionkey); - WuUniStrReplace(&buf, L"{LINK_NEWHUB}", WP_NEWHUB); - WuUniStrReplace(&buf, L"{LINK_SERVER}", WP_SERVER); - return buf; -} - -// License management page -static wchar_t *WpLicense(WEBUI *wu, LIST *params) -{ - char *sessionkey = (char*)StrMapSearch(params, "KEY"); - WU_CONTEXT *context = WuGetContext(wu->Contexts, sessionkey); - char *cmd = (char*)StrMapSearch(params, "CMD"); - UINT retcode; - wchar_t *buf; - LIST *strmap; - - if(context == NULL) - { - return WuRedirectPage(WP_LOGIN); - } - - // Add a license - if(StrCmp(cmd, "ADD") == 0) - { - RPC_TEST t; - char tmp[MAX_SIZE]; - char *licensekey = (char*)StrMapSearch(params, "KEYSTRINGS"); - - - Zero(&t, sizeof(t)); - StrCpy(t.StrValue, sizeof(t.StrValue), licensekey); - - retcode = StAddLicenseKey(context->Admin, &t); - if(retcode != ERR_NO_ERROR) - { - return WuErrorPage(retcode); - } - - Format(tmp, sizeof(tmp), "%s?KEY=%s", WP_LICENSE, sessionkey); - return WuRedirectPage(tmp); - - } - // Remove the license - else if(StrCmp(cmd, "DEL") == 0) - { - RPC_TEST t; - char tmp[MAX_SIZE]; - char *id = (char*)StrMapSearch(params, "ID"); - - Zero(&t, sizeof(t)); - t.IntValue = ToInt(id); - - retcode = StDelLicenseKey(context->Admin, &t); - if(retcode != ERR_NO_ERROR) - { - return WuErrorPage(retcode); - } - - Format(tmp, sizeof(tmp), "%s?KEY=%s", WP_LICENSE, sessionkey); - return WuRedirectPage(tmp); - } - - buf = WuUniReadFile("|"WP_LICENSE); - strmap = WuUniMakeTableFromTemplate(&buf, L""); - - // Enumerate the license keys - { - UINT i; - RPC_ENUM_LICENSE_KEY t; - wchar_t *tmpl; - Zero(&t, sizeof(t)); - - retcode = StEnumLicenseKey(context->Admin, &t); - - if(retcode != ERR_NO_ERROR) - { - WuFreeStrStrMap(strmap); - Free(buf); - return WuErrorPage(retcode); - } - - tmpl = WuUniGetTemplate(&buf, L"", true); - - for(i = 0; i < t.NumItem; i++) - { - wchar_t *status, expires[128]; - wchar_t *tmp = UniCopyStr(tmpl); - RPC_ENUM_LICENSE_KEY_ITEM *item = &t.Items[i]; - - status = LiGetLicenseStatusStr(item->Status); - - if(item->Expires == 0) - { - UniStrCpy(expires, sizeof(expires), StrMapSearch(strmap, "EXPIRE_INFINITE")); - } - else - { - GetDateStrEx64(expires, sizeof(expires), item->Expires, NULL); - } - - WuUniUintReplace(&tmp, L"{ID}", i); - WuUniStrReplace(&tmp, L"{LICENSEKEY}", item->LicenseKey); - WuUniStrReplace(&tmp, L"{LICENSENAME}", item->LicenseName); - WuUniReplace(&tmp, L"{STATUS}", status); - WuUniReplace(&tmp, L"{EXPIRES}", expires); - WuUniStrReplace(&tmp, L"{LICENSEID}", item->LicenseId); - WuUniUintReplace(&tmp, L"{PRODUCTID}", item->ProductId); - WuUniUint64Replace(&tmp, L"{SYSTEMID}", item->SystemId); - WuUniUintReplace(&tmp, L"{SERIALID}", item->SerialId); - - WuUniInsertBefore(&buf, tmp, L""); - Free(tmp); - } - FreeRpcEnumLicenseKey(&t); - Free(tmpl); - } - - // Show the license status - { - RPC_LICENSE_STATUS t; - - Zero(&t, sizeof(t)); - - retcode = StGetLicenseStatus(context->Admin, &t); - - if(retcode != ERR_NO_ERROR) - { - WuFreeStrStrMap(strmap); - Free(buf); - return WuErrorPage(retcode); - } - - WuUniStrReplace(&buf, L"{LSEDITIONNAME}", t.EditionStr); - WuUniUint64Replace(&buf, L"{LSSERVERID}", t.SystemId); - if(t.SystemExpires == 0) - { - WuUniReplace(&buf, L"{LSEXPIRES}", StrMapSearch(strmap, "NOEXPIRE")); - } - else - { - wchar_t expires[128]; - GetDateStrEx64(expires, sizeof(expires), t.SystemExpires, NULL); - WuUniReplace(&buf, L"{LSEXPIRES}", expires); - } - - if(t.NumBridgeConnectLicense == INFINITE) - { - WuUniReplace(&buf, L"{LSNUMBRIDGES}", StrMapSearch(strmap, "LICENSE_INFINITE")); - } - else - { - WuUniUintReplace(&buf, L"{LSNUMBRIDGES}", t.NumBridgeConnectLicense); - } - - if(t.NumClientConnectLicense == INFINITE) - { - WuUniReplace(&buf, L"{LSNUMCLIENTS}", StrMapSearch(strmap, "LICENSE_INFINITE")); - } - else - { - WuUniUintReplace(&buf, L"{LSNUMCLIENTS}", t.NumClientConnectLicense); - } - - } - - WuUniStrReplace(&buf, L"{LINK_LICENSE}", WP_LICENSE); - WuUniStrReplace(&buf, L"{LINK_SERVER}", WP_SERVER); - WuUniStrReplace(&buf, L"{SESSIONKEY}", sessionkey); - WuFreeStrStrMap(strmap); - - return buf; - -} - -// Local bridge setup page -static wchar_t *WpLocalBridge(WEBUI *wu, LIST *params) -{ - char *sessionkey = (char*)StrMapSearch(params, "KEY"); - WU_CONTEXT *context = WuGetContext(wu->Contexts, sessionkey); - char *cmd = (char*)StrMapSearch(params, "CMD"); - UINT retcode; - wchar_t *buf; - LIST *strmap; - - if(context == NULL) - { - return WuRedirectPage(WP_LOGIN); - } - - // Create a local bridge - if(StrCmp(cmd, "CREATE") == 0) - { - RPC_LOCALBRIDGE t; - RPC_ENUM_ETH eth; - char tmp[MAX_SIZE]; - char *tapmode = (char*)StrMapSearch(params, "TAPMODE"); - char *tapname = (char*)StrMapSearch(params, "TAPNAME"); - char *devid = (char*)StrMapSearch(params, "DEVID"); - char *hubname = (char*)StrMapSearch(params, "LBHUBNAME"); - UINT id = ToInt(devid); - - Zero(ð, sizeof(eth)); - retcode = StEnumEthernet(context->Admin, ð); - - if(retcode != ERR_NO_ERROR) - { - FreeRpcEnumEth(ð); - return WuErrorPage(retcode); - } - - Zero(&t, sizeof(t)); - t.Active = true; - if(StrCmp(tapmode, "YES") == 0) - { - t.TapMode = true; - StrCpy(t.DeviceName, sizeof(t.DeviceName), tapname); - } - else - { - t.TapMode = false; - StrCpy(t.DeviceName, sizeof(t.DeviceName), eth.Items[id].DeviceName); - } - StrCpy(t.HubName, sizeof(t.HubName), hubname); - t.Online = true; - FreeRpcEnumEth(ð); - - retcode = StAddLocalBridge(context->Admin, &t); - - if(retcode != ERR_NO_ERROR) - { - return WuErrorPage(retcode); - } - - Format(tmp, sizeof(tmp), "%s?KEY=%s", WP_LOCALBRIDGE, sessionkey); - return WuRedirectPage(tmp); - } - - // Delete the local bridge - if(StrCmp(cmd, "DEL") == 0) - { - RPC_LOCALBRIDGE t; - RPC_ENUM_LOCALBRIDGE et; - char tmp[MAX_SIZE]; - char *listid = (char*)StrMapSearch(params, "LISTID"); - UINT id = ToInt(listid); - - Zero(&et, sizeof(et)); - retcode = StEnumLocalBridge(context->Admin, &et); - if(retcode != ERR_NO_ERROR) - { - return WuErrorPage(retcode); - } - - Zero(&t, sizeof(t)); - StrCpy(t.DeviceName, sizeof(t.DeviceName), et.Items[id].DeviceName); - StrCpy(t.HubName, sizeof(t.HubName), et.Items[id].HubName); - FreeRpcEnumLocalBridge(&et); - - retcode = StDeleteLocalBridge(context->Admin, &t); - - if(retcode != ERR_NO_ERROR) - { - return WuErrorPage(retcode); - } - - Format(tmp, sizeof(tmp), "%s?KEY=%s", WP_LOCALBRIDGE, sessionkey); - return WuRedirectPage(tmp); - } - - // Show the current local bridge list and the Virtual HUB list and the device list to be bridged - buf = WuUniReadFile("|"WP_LOCALBRIDGE); - strmap = WuUniMakeTableFromTemplate(&buf, L""); - - // Show the current local bridge list - { - UINT i; - RPC_ENUM_LOCALBRIDGE t; - wchar_t *tmpl; - - Zero(&t, sizeof(t)); - retcode = StEnumLocalBridge(context->Admin, &t); - - if(retcode != ERR_NO_ERROR) - { - FreeRpcEnumLocalBridge(&t); - Free(buf); - WuFreeStrStrMap(strmap); - return WuErrorPage(retcode); - } - - tmpl = WuUniGetTemplate(&buf, L"", true); - - for(i = 0; i < t.NumItem; i++) - { - RPC_LOCALBRIDGE *item = &t.Items[i]; - wchar_t *tmp = UniCopyStr(tmpl); - WuUniUintReplace(&tmp, L"{LISTID}", i); - WuUniStrReplace(&tmp, L"{HUBNAME}", item->HubName); - WuUniStrReplace(&tmp, L"{DEVICENAME}", item->DeviceName); - WuUniReplace(&tmp, L"{STATUS}", item->Online ? item->Active ? StrMapSearch(strmap, "BRIDGE_ONLINE") - : StrMapSearch(strmap, "BRIDGE_ERROR") : StrMapSearch(strmap, "BRIDGE_OFFLINE")); - WuUniInsertBefore(&buf, tmp, L""); - Free(tmp); - } - Free(tmpl); - FreeRpcEnumLocalBridge(&t); - } - - // Show the Virtual HUB list - { - wchar_t *tmpl; - RPC_ENUM_HUB t; - UINT i; - - Zero(&t, sizeof(t)); - retcode = StEnumHub(context->Admin, &t); - - if(retcode != ERR_NO_ERROR) - { - FreeRpcEnumHub(&t); - Free(buf); - WuFreeStrStrMap(strmap); - return WuErrorPage(retcode); - } - - tmpl = WuUniGetTemplate(&buf, L"", true); - for(i=0; i"); - Free(tmp); - } - FreeRpcEnumHub(&t); - Free(tmpl); - } - - // Get the device list to be bridge - { - UINT i; - RPC_ENUM_ETH t; - wchar_t *tmpl; - - Zero(&t, sizeof(t)); - retcode = StEnumEthernet(context->Admin, &t); - - if(retcode != ERR_NO_ERROR) - { - FreeRpcEnumEth(&t); - Free(buf); - WuFreeStrStrMap(strmap); - return WuErrorPage(retcode); - } - - tmpl = WuUniGetTemplate(&buf, L"", true); - - for(i = 0; i < t.NumItem; i++) - { - wchar_t *tmp = UniCopyStr(tmpl); - WuUniUintReplace(&tmp, L"{DEVID}", i); - WuUniStrReplace(&tmp, L"{ABLEDEVICE}", t.Items[i].DeviceName); - WuUniInsertBefore(&buf, tmp, L""); - Free(tmp); - } - FreeRpcEnumEth(&t); - Free(tmpl); - } - - WuUniStrReplace(&buf, L"{LINK_LOCALBRIDGE}", WP_LOCALBRIDGE); - WuUniStrReplace(&buf, L"{LINK_SERVER}", WP_SERVER); - WuUniStrReplace(&buf, L"{SESSIONKEY}", sessionkey); - WuFreeStrStrMap(strmap); - - return buf; - -} - -// Configure the virtual DHCP function and virtual NAT (SecureNAT) -static wchar_t *WpSecureNAT(WEBUI *wu, LIST *params) -{ - char *sessionkey = (char*)StrMapSearch(params, "KEY"); - - WU_CONTEXT *context = WuGetContext(wu->Contexts, sessionkey); - char *cmd = (char*)StrMapSearch(params, "CMD"); - char *hubname = (char*)StrMapSearch(params, "HUB"); - - UINT retcode; - wchar_t *buf; - - if(context == NULL) - { - return WuRedirectPage(WP_LOGIN); - } - - // Enable / disable the SecureNAT function - if(StrCmp(cmd, "ENABLE") == 0 || StrCmp(cmd, "DISABLE") == 0) - { - RPC_HUB t; - char tmp[MAX_SIZE]; - - Zero(&t, sizeof(t)); - StrCpy(t.HubName, sizeof(t.HubName), hubname); - - if(StrCmp(cmd, "ENABLE") == 0) - { - retcode = StEnableSecureNAT(context->Admin, &t); - } - else - { - retcode = StDisableSecureNAT(context->Admin, &t); - } - - if(retcode != ERR_NO_ERROR) - { - return WuErrorPage(retcode); - } - - Format(tmp, sizeof(tmp), "%s?HUB=%s&KEY=%s", WP_SECURENAT, hubname, sessionkey); - return WuRedirectPage(tmp); - } - // Set the SecureNAT options - else if(StrCmp(cmd, "SAVE") == 0) - { - char tmp[MAX_SIZE]; - VH_OPTION t; - - Zero(&t, sizeof(t)); - StrCpy(t.HubName, sizeof(t.HubName), hubname); - - // Configure the a virtual host - StrToMac(t.MacAddress, (char*)StrMapSearch(params, "HOSTMAC")); - StrToIP(&t.Ip, (char*)StrMapSearch(params, "HOSTIP")); - StrToIP(&t.Mask, (char*)StrMapSearch(params, "HOSTMASK")); - - // Configure the virtual NAT function - t.UseNat = (StrCmp((char*)StrMapSearch(params, "NATCHECK"), "on") == 0); - t.Mtu = ToInt((char*)StrMapSearch(params, "NATMTU")); - t.NatTcpTimeout = ToInt((char*)StrMapSearch(params, "NATTCPTIMEOUT")); - t.NatUdpTimeout = ToInt((char*)StrMapSearch(params, "NATUDPTIMEOUT")); - t.SaveLog = (StrCmp((char*)StrMapSearch(params, "NATSAVELOG"), "on") == 0); - - // Configure the virtual DHCP server function - t.UseDhcp = (StrCmp((char*)StrMapSearch(params, "DHCPCHECK"), "on") == 0); - StrToIP(&t.DhcpLeaseIPStart, (char*)StrMapSearch(params, "DHCPIPS")); - StrToIP(&t.DhcpLeaseIPEnd, (char*)StrMapSearch(params, "DHCPIPE")); - StrToIP(&t.DhcpSubnetMask, (char*)StrMapSearch(params, "DHCPMASK")); - t.DhcpExpireTimeSpan = ToInt((char*)StrMapSearch(params, "DHCPEXPIRE")); - StrToIP(&t.DhcpGatewayAddress, (char*)StrMapSearch(params, "DHCPGW")); - StrToIP(&t.DhcpDnsServerAddress, (char*)StrMapSearch(params, "DHCPDNS")); - StrCpy(t.DhcpDomainName, sizeof(t.DhcpDomainName), (char*)StrMapSearch(params, "DHCPDOMAIN")); - - retcode = StSetSecureNATOption(context->Admin, &t); - if(retcode == ERR_NO_ERROR) - { - Format(tmp, sizeof(tmp), "%s?HUB=%s&KEY=%s", WP_SECURENAT, hubname, sessionkey); - return WuRedirectPage(tmp); - } - return WuErrorPage(retcode); - } - - buf = WuUniReadFile("|"WP_SECURENAT); - - // Get the enable / disable state of the current SecureNAT - { - RPC_HUB_STATUS t; - Zero(&t, sizeof(t)); - StrCpy(t.HubName, sizeof(t.HubName), hubname); - - retcode = StGetHubStatus(context->Admin, &t); - - if(retcode != ERR_NO_ERROR) - { - Free(buf); - return WuErrorPage(retcode); - } - - WuEnableTag(&buf, t.SecureNATEnabled ? L"DISABLESNAT" : L"ENABLESNAT"); - } - - // Show the advanced settings of the current SecureNAT - { - char mac[MAX_SIZE], ip[MAX_SIZE], mask[MAX_SIZE]; - char dhcpips[MAX_SIZE], dhcpipe[MAX_SIZE], dhcpmask[MAX_SIZE]; - char optgw[MAX_SIZE], optdns[MAX_SIZE]; - VH_OPTION t; - - Zero(&t, sizeof(t)); - StrCpy(t.HubName, sizeof(t.HubName), hubname); - - retcode = StGetSecureNATOption(context->Admin, &t); - - - // Configure the virtual interfaces - MacToStr(mac, sizeof(mac), t.MacAddress); - IPToStr(ip, sizeof(ip), &t.Ip); - IPToStr(mask, sizeof(mask), &t.Mask); - WuUniStrReplace(&buf, L"{HOSTMAC}", mac); - WuUniStrReplace(&buf, L"{HOSTIP}", ip); - WuUniStrReplace(&buf, L"{HOSTMASK}", mask); - - // Configure the Virtual NAT - WuUniStrReplace(&buf, L"{NATCHECK}", t.UseNat ? "CHECKED" : ""); - WuUniUintReplace(&buf, L"{NATMTU}", t.Mtu); - WuUniUintReplace(&buf, L"{NATTCPTIMEOUT}", t.NatTcpTimeout); - WuUniUintReplace(&buf, L"{NATUDPTIMEOUT}", t.NatUdpTimeout); - - WuUniStrReplace(&buf, L"{NATSAVELOG}", t.SaveLog ? "CHECKED" : ""); - - // Configure the Virtual DHCP server - WuUniStrReplace(&buf, L"{DHCPCHECK}", t.UseDhcp ? "CHECKED" : ""); - - IPToStr(dhcpips, sizeof(dhcpips), &t.DhcpLeaseIPStart); - IPToStr(dhcpipe, sizeof(dhcpipe), &t.DhcpLeaseIPEnd); - IPToStr(dhcpmask, sizeof(dhcpmask), &t.DhcpSubnetMask); - WuUniStrReplace(&buf, L"{DHCPIPS}", dhcpips); - WuUniStrReplace(&buf, L"{DHCPIPE}", dhcpipe); - WuUniStrReplace(&buf, L"{DHCPMASK}", dhcpmask); - WuUniUintReplace(&buf, L"{DHCPEXPIRE}", t.DhcpExpireTimeSpan); - - IPToStr(optgw, sizeof(optgw), &t.DhcpGatewayAddress); - IPToStr(optdns, sizeof(optdns), &t.DhcpDnsServerAddress); - WuUniStrReplace(&buf, L"{DHCPGW}", optgw); - WuUniStrReplace(&buf, L"{DHCPDNS}", optdns); - WuUniStrReplace(&buf, L"{DHCPDOMAIN}", t.DhcpDomainName); - } - - WuUniStrReplace(&buf, L"{LINK_HUB}", WP_HUB); - WuUniStrReplace(&buf, L"{LINK_SECURENAT}", WP_SECURENAT); - WuUniStrReplace(&buf, L"{HUBNAME}", hubname); - WuUniStrReplace(&buf, L"{SESSIONKEY}", sessionkey); - - return buf; -} - -static wchar_t *WpSession(WEBUI *wu, LIST *params) -{ - char *sessionkey = (char*)StrMapSearch(params, "KEY"); - WU_CONTEXT *context = WuGetContext(wu->Contexts, sessionkey); - char *hub = (char*)StrMapSearch(params, "HUB"); - char *cmd = (char*)StrMapSearch(params, "CMD"); - - if(context == NULL) - { - return WuRedirectPage(WP_LOGIN); - } - - if(StrCmp(cmd, "DEL") == 0) - { - char *session = (char*)StrMapSearch(params, "SESSION"); - RPC_DELETE_SESSION t; - UINT retcode; - char tmp[MAX_SIZE]; - - Zero(&t, sizeof(t)); - StrCpy(t.HubName, sizeof(t.HubName), hub); - StrCpy(t.Name, sizeof(t.Name), session); - - retcode = StDeleteSession(context->Admin, &t); - if(retcode != ERR_NO_ERROR) - { - return WuErrorPage(retcode); - } - - Format(tmp, sizeof(tmp), "%s?HUB=%s&KEY=%s", WP_SESSION, hub, session); - return WuRedirectPage(tmp); - } - - // Show the session list - { - RPC_ENUM_SESSION t; - UINT retcode; - - Zero(&t, sizeof(t)); - StrCpy(t.HubName, sizeof(t.HubName), hub); - - retcode = StEnumSession(context->Admin, &t); - if(retcode != ERR_NO_ERROR) - { - return WuErrorPage(retcode); - }else{ - wchar_t *buf = WuUniReadFile("|"WP_SESSION); - wchar_t *tmpl = WuUniGetTemplate(&buf, L"", true); - UINT i; - for(i=0; iName); - WuUniStrReplace(&tmp, L"{SESSION_SERVER}", item->RemoteHostname); - WuUniStrReplace(&tmp, L"{SESSION_USER}", item->Username); - WuUniStrReplace(&tmp, L"{SESSION_HOST}", item->Hostname); - WuUniUintReplace(&tmp, L"{SESSION_TCP}", item->CurrentNumTcp); - WuUniUint64Replace(&tmp, L"{SESSION_BYTES}", item->PacketSize); - WuUniUint64Replace(&tmp, L"{SESSION_PKTS}", item->PacketNum); - WuUniStrReplace(&tmp, L"{SESSION}", item->Name); - - WuUniInsertBefore(&buf, tmp, L""); - Free(tmp); - } - - WuUniStrReplace(&buf, L"{HUBNAME}", hub); - WuUniStrReplace(&buf, L"{SESSIONKEY}", sessionkey); - WuUniStrReplace(&buf, L"{LINK_HUB}", WP_HUB); - WuUniStrReplace(&buf, L"{LINK_SESSION}", WP_SESSION); - - FreeRpcEnumSession(&t); - Free(tmpl); - return buf; - } - } -} - - -// **** Public interface of the WebUI module - -// Get the page -WU_WEBPAGE *WuGetPage(char *target, WEBUI *wu) -{ - char filename[MAX_SIZE]; - LIST *params; - wchar_t *(*handler)(WEBUI *wu, LIST *params); - - // Delete the expired session keys - WuExpireSessionKey(wu); - - params = WuAnalyzeTarget(target, filename, sizeof(filename)); - - // Search for the handler corresponding to the URL - handler = StrMapSearch(wu->PageList, filename); - - // Call the handler - if(handler != NULL) - { - wchar_t *unitmp; - WU_WEBPAGE *page; - unitmp = handler(wu, params); - WuFreeStrStrMap(params); - page = WuNewUniWebPage(unitmp); - Free(unitmp); - return page; - } - - WuFreeStrStrMap(params); - - // If it missed, try to read the file directly - if(StartWith(filename, WP_DEFAULT)) - { - char tmp[MAX_SIZE] = "|"; - BUF *buf; - WU_WEBPAGE *page; - - StrCat(tmp, sizeof(tmp), filename); - buf = ReadDump(tmp); - if(buf == NULL) - { - return NULL; - } - - page = WuNewWebPage(buf->Buf, buf->Size, filename); - FreeBuf(buf); - return page; - } - - return NULL; -} - -// Start the WebUI -WEBUI *WuNewWebUI(CEDAR *cedar) -{ - WEBUI *wu = (WEBUI*)Malloc(sizeof(WEBUI)); - int i; - - wu->Cedar = cedar; - - wu->PageList = NewStrMap(); - for(i=0;iPageList, &wu_pages[i]); - } - - wu->Contexts = NewStrMap(); - - return wu; -} - -// Release the WebUI -bool WuFreeWebUI(WEBUI *wu) -{ - UINT i; - - if(wu == NULL) - { - return false; - } - - for(i=0; iContexts); i++) - { - STRMAP_ENTRY *se = LIST_DATA(wu->Contexts, i); - Free(se->Name); - WuFreeContext((WU_CONTEXT*)se->Value); - Free(se); - } - ReleaseList(wu->Contexts); - - ReleaseList(wu->PageList); - Free(wu); - return true; -} - -void WuFreeWebPage(WU_WEBPAGE *page) -{ - if(page == NULL) - { - return; - } - - FreeHttpHeader(page->header); - Free(page->data); - Free(page); -} - -// **** Module local utility functions - -// Initialize the context -static WU_CONTEXT *WuNewContext(WEBUI *wu, char *hubname) -{ - WU_CONTEXT *context = (WU_CONTEXT*)Malloc(sizeof(WU_CONTEXT)); - - if(StrLen(hubname) == 0) - { - hubname=NULL; - } - context->Admin = (ADMIN*)ZeroMalloc(sizeof(ADMIN)); - context->Admin->HubName = hubname != NULL ? CopyStr(hubname) : NULL; - context->Admin->Server = wu->Cedar->Server; - context->Admin->ServerAdmin = hubname == NULL ? true: false; - context->Admin->Rpc = (RPC*)ZeroMalloc(sizeof(RPC)); - StrCpy(context->Admin->Rpc->Name, sizeof(context->Admin->Rpc->Name), "WEBUI"); - context->Admin->Rpc->Param = context->Admin; - context->Admin->Rpc->ServerAdminMode = context->Admin->ServerAdmin; - context->Admin->Rpc->ServerMode = true; - context->Admin->Rpc->IsVpnServer = true; - context->Admin->Rpc->Lock = NewLock(); - context->Admin->LogFileList = NULL; - - context->ExpireDate = Tick64() + WU_CONTEXT_EXPIRE; - - return context; -} - -// Release the context -static void WuFreeContext(WU_CONTEXT *context) -{ - DeleteLock(context->Admin->Rpc->Lock); - Free(context->Admin->Rpc); - Free(context->Admin->HubName); - Free(context->Admin); - Free(context); -} - -// Create a WebPage structure from the Unicode string -static WU_WEBPAGE *WuNewUniWebPage(wchar_t *content) -{ - WU_WEBPAGE *ret; - - if(content == NULL) - { - return NULL; - } - - ret = (WU_WEBPAGE*)Malloc(sizeof(WU_WEBPAGE)); - ret->size = CalcUniToUtf8(content); - ret->data = (char*)Malloc(ret->size); - UniToUtf8(ret->data, ret->size, content); - - ret->header = NewHttpHeader("HTTP/1.1", "202", "OK"); - AddHttpValue(ret->header, NewHttpValue("Content-Type", HTTP_CONTENT_TYPE4)); - AddHttpValue(ret->header, NewHttpValue("Connection", "Keep-Alive")); - AddHttpValue(ret->header, NewHttpValue("Keep-Alive", HTTP_KEEP_ALIVE)); - - return ret; -} - -// Generate the WebPage structure from the raw data -static WU_WEBPAGE *WuNewWebPage(char *content, UINT size, char *filename) -{ - WU_WEBPAGE *ret; - - if(content == NULL) - { - return NULL; - } - - ret = (WU_WEBPAGE*)Malloc(sizeof(WU_WEBPAGE)); - ret->size = size; - ret->data = (char*)Malloc(size); - Copy(ret->data, content, size); - - ret->header = NewHttpHeader("HTTP/1.1", "202", "OK"); - AddHttpValue(ret->header, NewHttpValue("Connection", "Keep-Alive")); - AddHttpValue(ret->header, NewHttpValue("Keep-Alive", HTTP_KEEP_ALIVE)); - - if(EndWith(filename, "jpg")) - { - AddHttpValue(ret->header, NewHttpValue("Content-Type", HTTP_CONTENT_TYPE3)); - } - AddHttpValue(ret->header, NewHttpValue("Content-Type", HTTP_CONTENT_TYPE4)); - - return ret; -} - -// Return an error page -static wchar_t *WuErrorPage(UINT errorcode) -{ - wchar_t *buf = WuUniReadFile("|"WP_ERROR); - wchar_t tmp[MAX_SIZE]; - UniFormat(tmp, sizeof(tmp), L"%d\n

%s

", errorcode, GetUniErrorStr(errorcode)); - WuUniReplace(&buf, L"ERRMSG", tmp); - return buf; -} - -// Redirect -static wchar_t *WuRedirectPage(char *url) -{ - wchar_t *buf = WuUniReadFile("|"WP_REDIRECT); - wchar_t tmp[MAX_SIZE]; - StrToUni(tmp, sizeof(tmp), url); - WuUniReplace(&buf, L"REDIRECT_TO", tmp); - return buf; -} - -// Analyse the URL -static LIST *WuAnalyzeTarget(char *target,char *filename, UINT size) -{ - char *start, tmp; - - if(target == NULL || filename == NULL) - { - return NULL; - } - - // Process the absolute path specification - if(StartWith(target,"http://")) - { - // Skip http:// - target += 7; - - // Skip the host name portion - while(*target != '/' && *target != '\0') - { - target ++; - } - - // Error if the "/" isn't included after "http://" - if(*target == '\0') - { - return NULL; - } - - target++; - } - - // Unescape - // (not implemented) - - // Extract the file name portion - start = target; - while(*target != '?' && *target != '\0') - { - target ++; - } - tmp = *target; - *target = '\0'; - StrCpy(filename, size, start); - *target = tmp; - - // Interpret if there are parameters - if(*target == '?') - { - LIST *params = NewStrMap(); - UINT i; - TOKEN_LIST *tl; - target++; - tl =ParseToken(target,"&"); - for(i=0;iNumTokens;i++) - { - char *token = tl->Token[i]; - char *body = token; - STRMAP_ENTRY *newentry = (STRMAP_ENTRY*)Malloc(sizeof(STRMAP_ENTRY)); - - while(*body != '=' && *body != '\0') - { - body++; - } - if(*body == '=') - { - *body = '\0'; - body++; - } - newentry->Name = CopyStr(token); - newentry->Value = CopyStr(body); - Add(params, newentry); -// Debug("PARAMS: %s : %s\n",token,body); - } - FreeToken(tl); - return params; - } - return NULL; -} - -// Release the parameter list -static void WuFreeStrStrMap(LIST *params) -{ - UINT i; - - if(params == NULL) - { - return; - } - - for(i=0; iName); - Free(e->Value); - Free(e); - } - ReleaseList(params); -} - -// Read the UTF-8 file and convert as an Unicode string -static wchar_t *WuUniReadFile(char *filename) -{ - IO *io; - UINT size, usize; - BYTE *utf8; - wchar_t *wchars; - - // Validate arguments - if (filename == NULL) - { - return NULL; - } - - io = FileOpen(filename, false); - if (io == NULL) - { - return NULL; - } - - // Load the file - size = FileSize(io); - utf8 = (BYTE*)Malloc(size); - FileRead(io, (void*)utf8, size); - FileClose(io); - - usize = CalcUtf8ToUni(utf8, size); - wchars = (wchar_t*)ZeroMalloc(usize+sizeof(wchar_t)); - Utf8ToUni(wchars, usize, utf8, size); - Free(utf8); - - return wchars; -} - -// Replace string (with memory reallocation) -static void WuUniReplace(wchar_t **buf, wchar_t *from, wchar_t *to) -{ - UINT dstsize; - wchar_t *oldbuf; - - if(buf == NULL || from == NULL || to == NULL) - { - return; - } - - oldbuf = *buf; - - dstsize = (UniCalcReplaceStrEx(*buf, from, to, true) + 1) * sizeof(wchar_t); - *buf = (wchar_t*)Malloc(dstsize); - UniReplaceStr(*buf, dstsize, oldbuf, from, to); - Free(oldbuf); -} - -// Insert the string in front of a specified pattern -static void WuUniInsertBefore(wchar_t **buf, wchar_t *insert, wchar_t *before) -{ - UINT tmpsize; - wchar_t *tmp; - - if(buf == NULL || insert == NULL || before == NULL) - { - return; - } - - tmpsize = (UniStrLen(insert)+UniStrLen(before)+1)*sizeof(wchar_t); - tmp = (wchar_t*)Malloc(tmpsize); - UniStrCpy(tmp, tmpsize, insert); - UniStrCat(tmp, tmpsize, before); - WuUniReplace(buf, before, tmp); - Free(tmp); -} - -// Uncomment the tag specified by the keyword -static void WuEnableTag(wchar_t **buf, wchar_t *keyword) -{ - wchar_t tmp[MAX_SIZE]; - if(buf == NULL || keyword == NULL) - { - return; - } - - UniFormat(tmp, sizeof(tmp), L"!--%s", keyword); - WuUniReplace(buf, tmp, L""); - - UniFormat(tmp, sizeof(tmp), L"%s--", keyword); - WuUniReplace(buf, tmp, L""); - return; -} - -// Generate a session key -static char *WuNewSessionKey() -{ - char tmp[MD5_SIZE], *ret; - UINT size; - Rand(tmp, sizeof(tmp)); - size = sizeof(tmp)*2+1; - ret = Malloc(size); - BinToStr(ret, size, tmp, sizeof(tmp)); - return ret; -} - -// Replace the Unicode pattern in Unicode string with ASCII string -static void WuUniStrReplace(wchar_t **buf, wchar_t *from, char *to) -{ - UINT unisize; - wchar_t *tmp; - - if(buf == NULL || *buf == NULL || from == NULL || to == NULL) - { - return; - } - - unisize = CalcStrToUni(to); - tmp = (wchar_t*)Malloc(unisize); - StrToUni(tmp, unisize, to); - WuUniReplace(buf, from, tmp); - Free(tmp); -} - -// Extract the template surrounded by specified Unicode string from Unicode string -static wchar_t *WuUniGetTemplate(wchar_t **str, wchar_t *start, wchar_t *end, bool erase) -{ - UINT startidx, endidx, len, size, i; - wchar_t *ret; - - if(str == NULL || *str == NULL || start == NULL || end == NULL) - { - return NULL; - } - - startidx = UniSearchStr(*str, start, 0); - if(startidx == INFINITE) - { - return NULL; - } - startidx += UniStrLen(start); - - endidx = UniSearchStr(*str, end, startidx); - if(endidx == INFINITE) - { - return NULL; - } - - len = endidx - startidx; - size = (len + 1) * sizeof(wchar_t); - ret = (wchar_t*)Malloc(size); - for(i=0; iName = (char*)Malloc(keylen); - UniToStr(entry->Name, keylen, keytmp); - def = WuUniCopyStrTill(def, L',', (wchar_t**)&(entry->Value)); - Add(table, entry); - Free(keytmp); - } - return table; -} - -// Extract the template from Unicode string, and create a string table from it -static LIST *WuUniMakeTableFromTemplate(wchar_t **str, wchar_t *start, wchar_t *end) -{ - wchar_t *tmpl = WuUniGetTemplate(str, start, end, true); - LIST *ret = WuUniMakeTable(tmpl); - Free(tmpl); - return ret; -} - -// Delete the expired session key -static void WuExpireSessionKey(WEBUI *wu) -{ - LIST *Expired = NewList(NULL); - UINT i; - - LockList(wu->Contexts); - - for(i=0; iContexts); i++) - { - STRMAP_ENTRY *entry = (STRMAP_ENTRY*)LIST_DATA(wu->Contexts, i); - WU_CONTEXT *context = (WU_CONTEXT*)entry->Value; - if(context->ExpireDate < Tick64()) - { - Add(Expired, entry); - } - } - - for(i=0; iContexts, entry); - Free(entry->Name); - WuFreeContext(entry->Value); - Free(entry); - } - ReleaseList(Expired); - - UnlockList(wu->Contexts); -} - -// Get the context, and extend its expiration date -static WU_CONTEXT *WuGetContext(LIST *contexts, char *sessionkey) -{ - WU_CONTEXT *ret = StrMapSearch(contexts, sessionkey); - if(ret != NULL) - { - ret->ExpireDate = Tick64() + WU_CONTEXT_EXPIRE; - } - return ret; -} +// SoftEther VPN Source Code - Developer Edition Master Branch +// Cedar Communication Module + + +// WebUI.c +// Web User Interface module + +#include "CedarPch.h" + +static WU_CONTEXT *WuNewContext(WEBUI *wu, char *hubname); +static void WuFreeContext(WU_CONTEXT *context); +static WU_WEBPAGE *WuNewUniWebPage(wchar_t *content); +static WU_WEBPAGE *WuNewWebPage(char *content, UINT size, char *filename); +static wchar_t *WuErrorPage(UINT errorcode); +static wchar_t *WuRedirectPage(char *url); +static wchar_t *WuUniReadFile(char *filename); +static void WuUniReplace(wchar_t **buf, wchar_t *from, wchar_t *to); +static void WuUniInsertBefore(wchar_t **buf, wchar_t *insert, wchar_t *before); +static LIST *WuAnalyzeTarget(char *target,char *filename, UINT size); +static void WuFreeStrStrMap(LIST *params); +static void WuEnableTag(wchar_t **buf, wchar_t *keyword); +static char *WuNewSessionKey(); +static void WuUniStrReplace(wchar_t **buf, wchar_t *from, char *to); +static wchar_t *WuUniGetTemplate(wchar_t **str, wchar_t *start, wchar_t *end, bool erase); +static void WuUniUintReplace(wchar_t **buf, wchar_t *key, UINT num); +static void WuUniUint64Replace(wchar_t **buf, wchar_t *key, UINT64 num); +static wchar_t *WuUniGetTemplate(wchar_t **str, wchar_t *start, wchar_t *end, bool erase); +static LIST *WuUniMakeTable(wchar_t *def); +static LIST *WuUniMakeTableFromTemplate(wchar_t **str, wchar_t *start, wchar_t *end); +static void WuExpireSessionKey(WEBUI *wu); +static WU_CONTEXT *WuGetContext(LIST *contexts, char *sessionkey); + +#define WP_DEFAULT "/webui/" +#define WP_LOGIN "/webui/login.cgi" +#define WP_REDIRECT "/webui/redirect.cgi" +#define WP_ERROR "/webui/error.cgi" +#define WP_SERVER "/webui/server.cgi" +#define WP_LISTENER "/webui/listener.cgi" +#define WP_HUB "/webui/hub.cgi" +#define WP_USER "/webui/user.cgi" +#define WP_EDITUSER "/webui/edituser.cgi" +#define WP_NEWHUB "/webui/newhub.cgi" +#define WP_LICENSE "/webui/license.cgi" +#define WP_LOCALBRIDGE "/webui/localbridge.cgi" +#define WP_SECURENAT "/webui/securenat.cgi" +#define WP_SESSION "/webui/session.cgi" + +static wchar_t *WpDefault(WEBUI *wu, LIST *params); +static wchar_t *WpLogin(WEBUI *wu, LIST *params); +static wchar_t *WpServer(WEBUI *wu, LIST *params); +static wchar_t *WpListener(WEBUI *wu, LIST *params); +static wchar_t *WpHub(WEBUI *wu, LIST *params); +static wchar_t *WpUser(WEBUI *wu, LIST *params); +static wchar_t *WpEditUser(WEBUI *wu, LIST *params); +static wchar_t *WpNewHub(WEBUI *wu, LIST *params); +static wchar_t *WpLicense(WEBUI *wu, LIST *params); +static wchar_t *WpLocalBridge(WEBUI *wu, LIST *params); +static wchar_t *WpSecureNAT(WEBUI *wu, LIST *params); +static wchar_t *WpSession(WEBUI *wu, LIST *params); + +// WebUI page handler table +static STRMAP_ENTRY wu_pages[] = { + {WP_DEFAULT, WpDefault}, + {WP_LOGIN, WpLogin}, + {WP_SERVER, WpServer}, + {WP_LISTENER, WpListener}, + {WP_HUB, WpHub}, + {WP_USER, WpUser}, + {WP_EDITUSER, WpEditUser}, + {WP_NEWHUB, WpNewHub}, + {WP_LICENSE, WpLicense}, + {WP_LOCALBRIDGE, WpLocalBridge}, + {WP_SECURENAT, WpSecureNAT}, + {WP_SESSION, WpSession}, +}; + +// **** Page handlers + +// Redirect the directory access to the login screen +static wchar_t *WpDefault(WEBUI *wu, LIST *params) +{ + return WuRedirectPage(WP_LOGIN); +} + +// Login page +static wchar_t *WpLogin(WEBUI *wu, LIST *params) +{ + UINT result; + char random[20], securepass[SHA1_SIZE]; + char *password = (char*)StrMapSearch(params, "PASS"); + char *hubname = (char*)StrMapSearch(params, "HUB"); + + if(password == NULL) + { + wchar_t *buf = WuUniReadFile("|"WP_LOGIN); + WuUniStrReplace(&buf, L"ACTION", WP_LOGIN); + WuUniStrReplace(&buf, L"HUBNAME", hubname == NULL ? "" : hubname); + return buf; + } + + // Administrator authentication + Rand(random,sizeof(random)); + Sha0(securepass, password, StrLen(password)); + SecurePassword(securepass, securepass, random); + result = AdminCheckPassword(wu->Cedar, random, securepass, hubname, false, NULL); + + if(result == ERR_NO_ERROR) + { + // Successful login + char tmp[MAX_SIZE]; + STRMAP_ENTRY *context; + + // Create a new context + context = Malloc(sizeof(STRMAP_ENTRY)); + context->Name = WuNewSessionKey(); + context->Value = WuNewContext(wu, hubname); + Add(wu->Contexts, context); + + // Transfer to the server management screen + Format(tmp, sizeof(tmp), "%s?KEY=%s", WP_SERVER, context->Name); + return WuRedirectPage(tmp); + }else{ + // Login failure + wchar_t *buf = WuUniReadFile("|"WP_LOGIN); + WuUniStrReplace(&buf, L"ACTION", WP_LOGIN); + WuUniStrReplace(&buf, L"HUBNAME",hubname == NULL ? "" : hubname); + WuUniReplace(&buf, L"", GetUniErrorStr(result)); + return buf; + } +} + +// Server management +static wchar_t *WpServer(WEBUI *wu, LIST *params) +{ + char *sessionkey = (char*)StrMapSearch(params, "KEY"); + WU_CONTEXT *context = WuGetContext(wu->Contexts, sessionkey); + UINT i; + wchar_t *buf; + LIST *strmap; + + if(context == NULL) + { + return WuRedirectPage(WP_LOGIN); + } + + buf = WuUniReadFile("|"WP_SERVER); + strmap = WuUniMakeTableFromTemplate(&buf, L""); + + // Show the Virtual HUB list + { + wchar_t *tmpl = WuUniGetTemplate(&buf, L"", true); + RPC_ENUM_HUB t; + + t.Hubs = NULL; + StEnumHub(context->Admin, &t); + for(i=0; iLastLoginTime)); + GetDateTimeStr64Uni(lastcomm, sizeof(lastcomm), SystemToLocal64(item->LastCommTime)); + WuUniStrReplace(&tmp, L"{HUBNAME}", item->HubName); + WuUniReplace(&tmp, L"{HUBSTATE}", item->Online ? StrMapSearch(strmap, "HUB_ONLINE") : StrMapSearch(strmap, "HUB_OFFLINE")); + WuUniReplace(&tmp, L"{HUBTYPE}", item->HubType == HUB_TYPE_STANDALONE ? StrMapSearch(strmap, "HUB_STANDALONE") + : item->HubType == HUB_TYPE_FARM_DYNAMIC ? StrMapSearch(strmap,"HUB_DYNAMIC") : StrMapSearch(strmap, "HUB_STATIC")); + WuUniUintReplace(&tmp, L"{HUBUSERS}", item->NumUsers); + WuUniUintReplace(&tmp, L"{HUBGROUPS}", item->NumGroups); + WuUniUintReplace(&tmp, L"{HUBSESSIONS}", item->NumSessions); + WuUniUintReplace(&tmp, L"{HUBMACS}", item->NumMacTables); + WuUniUintReplace(&tmp, L"{HUBIPS}", item->NumIpTables); + WuUniUintReplace(&tmp, L"{HUBLOGINS}", item->NumLogin); + WuUniReplace(&tmp, L"{HUBLASTLOGINDATE}", lastlogin); + WuUniReplace(&tmp, L"{HUBLASTCOMMDATE}", lastcomm); + + WuUniInsertBefore(&buf, tmp, L""); + Free(tmp); + } + FreeRpcEnumHub(&t); + Free(tmpl); + } + + // Show the listener list + { + RPC_LISTENER_LIST t; + wchar_t *tmpl = WuUniGetTemplate(&buf, L"", true); + Zero(&t, sizeof(t)); + StEnumListener(context->Admin, &t); + for(i=0; i"); + Free(tmp); + } + FreeRpcListenerList(&t); + Free(tmpl); + } + WuUniStrReplace(&buf, L"{LINK_HUB}", WP_HUB); + WuUniStrReplace(&buf, L"{SESSIONKEY}", sessionkey); + WuUniStrReplace(&buf, L"{LISTENER_LINK}", WP_LISTENER); + WuUniStrReplace(&buf, L"{LINK_NEWHUB}", WP_NEWHUB); + WuUniStrReplace(&buf, L"{LINK_SERVER}", WP_SERVER); + WuUniStrReplace(&buf, L"{LINK_LICENSE}", WP_LICENSE); + WuUniStrReplace(&buf, L"{LINK_LOCALBRIDGE}", WP_LOCALBRIDGE); + + WuFreeStrStrMap(strmap); + + return buf; +} + +// Listener management +static wchar_t *WpListener(WEBUI *wu, LIST *params) +{ + char *sessionkey = (char*)StrMapSearch(params, "KEY"); + WU_CONTEXT *context = WuGetContext(wu->Contexts, sessionkey); + char *cmd = (char*)StrMapSearch(params, "CMD"); + RPC_LISTENER t; + UINT retcode = ERR_NO_ERROR; + + if(context == NULL) + { + return WuRedirectPage(WP_LOGIN); + } + + t.Port = ToInt((char*)StrMapSearch(params, "PORT")); + + if( StrCmp(cmd, "CREATE") == 0 ) + { + // Create a new listener + if(t.Port == 0) + { + wchar_t *buf = WuUniReadFile("|"WP_LISTENER); + WuUniStrReplace(&buf, L"ACTION", WP_LISTENER); + WuUniStrReplace(&buf, L"SESSIONKEY", sessionkey); + return buf; + } + else + { + t.Enable = true; + retcode = StCreateListener(context->Admin, &t); + } + } + else if( StrCmp(cmd, "DEL")==0 ) + { + retcode = StDeleteListener(context->Admin, &t); + } + else if(StrCmp(cmd, "START")==0 ) + { + t.Enable = true; + retcode = StEnableListener(context->Admin, &t); + } + else if(StrCmp(cmd, "STOP")==0 ) + { + t.Enable = false; + retcode = StEnableListener(context->Admin, &t); + } + + if(retcode == ERR_NO_ERROR) + { + char tmp[MAX_SIZE]; + Format(tmp, sizeof(tmp), "%s?KEY=%s", WP_SERVER, sessionkey); + return WuRedirectPage(tmp); + } + return WuErrorPage(retcode); +} + +// Virtual HUB management +static wchar_t *WpHub(WEBUI *wu, LIST *params) +{ + char *hubname = (char*)StrMapSearch(params, "HUB"); + char *sessionkey = (char*)StrMapSearch(params, "KEY"); + char *cmd = (char*)StrMapSearch(params, "CMD"); + WU_CONTEXT *context = WuGetContext(wu->Contexts, sessionkey); + + // Confirm the session + if(context == NULL) + { + return WuRedirectPage(WP_LOGIN); + } + + if(StrCmp(cmd, "ONLINE") == 0 || StrCmp(cmd, "OFFLINE") == 0) + { + // Online / offline switching + UINT retcode; + RPC_SET_HUB_ONLINE t; + StrCpy(t.HubName, sizeof(t.HubName), hubname); + t.Online = (StrCmp(cmd, "ONLINE") == 0) ? true : false; + retcode = StSetHubOnline(context->Admin, &t); + if(retcode == ERR_NO_ERROR){ + char tmp[MAX_SIZE]; + Format(tmp, sizeof(tmp), "%s?HUB=%s&KEY=%s", WP_HUB, hubname, sessionkey); + return WuRedirectPage(tmp); + }else{ + return WuErrorPage(retcode); + } + } + else if(StrCmp(cmd, "DELETE") == 0) + { + // Delete the Virtual HUB + RPC_DELETE_HUB t; + UINT retcode; + StrCpy(t.HubName, sizeof(t.HubName), hubname); + retcode = StDeleteHub(context->Admin, &t); + if(retcode == ERR_NO_ERROR) + { + char tmp[MAX_SIZE]; + Format(tmp, sizeof(tmp), "%s?KEY=%s", WP_SERVER, sessionkey); + return WuRedirectPage(tmp); + } + return WuErrorPage(retcode); + } + else + { + // Show the status and commands of the virtual HUB + RPC_HUB_STATUS t; + UINT retcode; + Zero(&t, sizeof(t)); + StrCpy(t.HubName, sizeof(t.HubName), hubname); + retcode = StGetHubStatus(context->Admin, &t); + if(retcode == ERR_NO_ERROR) + { + wchar_t tmp[MAX_SIZE]; + wchar_t *buf = WuUniReadFile("|"WP_HUB); + LIST *strmap = WuUniMakeTableFromTemplate(&buf, L""); + + WuUniStrReplace(&buf, L"{HUBNAME}", t.HubName); + WuUniReplace(&buf, L"{HUBSTATE}", StrMapSearch(strmap, t.Online == false ? "HUB_OFFLINE" : "HUB_ONLINE")); + WuUniReplace(&buf, L"{HUBTYPE}", GetHubTypeStr(t.HubType)); + WuUniReplace(&buf, L"{HUBSNAT}", StrMapSearch(strmap, t.SecureNATEnabled == false ? "SECNAT_OFF" : "SECNAT_ON")); + WuUniUintReplace(&buf, L"{HUBSESSIONS}", t.NumSessions); + WuUniUintReplace(&buf, L"{HUBACLS}", t.NumAccessLists); + WuUniUintReplace(&buf, L"{HUBUSERS}", t.NumUsers); + WuUniUintReplace(&buf, L"{HUBGROUPS}", t.NumGroups); + WuUniUintReplace(&buf, L"{HUBMACTBLS}", t.NumMacTables); + WuUniUintReplace(&buf, L"{HUBIPTBLS}", t.NumIpTables); + WuUniUintReplace(&buf, L"{HUBLOGINS}", t.NumLogin); + GetDateTimeStr64Uni(tmp, sizeof(tmp), SystemToLocal64(t.LastLoginTime)); + WuUniReplace(&buf, L"{HUBLASTLOGIN}", tmp); + GetDateTimeStr64Uni(tmp, sizeof(tmp), SystemToLocal64(t.LastCommTime)); + WuUniReplace(&buf, L"{HUBLASTCOMM}", tmp); + WuUniUint64Replace(&buf, L"{HUBTXUNIPKTS}", t.Traffic.Send.UnicastCount); + WuUniUint64Replace(&buf, L"{HUBTXUNISIZE}", t.Traffic.Send.UnicastBytes); + WuUniUint64Replace(&buf, L"{HUBTXBRPKTS}", t.Traffic.Send.BroadcastCount); + WuUniUint64Replace(&buf, L"{HUBTXBRSIZE}", t.Traffic.Send.BroadcastBytes); + WuUniUint64Replace(&buf, L"{HUBRXUNIPKTS}", t.Traffic.Recv.UnicastCount); + WuUniUint64Replace(&buf, L"{HUBRXUNISIZE}", t.Traffic.Recv.UnicastBytes); + WuUniUint64Replace(&buf, L"{HUBRXBRPKTS}", t.Traffic.Recv.BroadcastCount); + WuUniUint64Replace(&buf, L"{HUBRXBRSIZE}", t.Traffic.Recv.BroadcastBytes); + + WuEnableTag(&buf, t.Online ? L"ENABLE_OFFLINE" : L"ENABLE_ONLINE"); + + WuUniStrReplace(&buf, L"{LINK_HUB}", WP_HUB); + WuUniStrReplace(&buf, L"{LINK_USER}", WP_USER); + WuUniStrReplace(&buf, L"{LINK_SERVER}", WP_SERVER); + WuUniStrReplace(&buf, L"{LINK_SESSION}", WP_SESSION); + WuUniStrReplace(&buf, L"{HUBNAME}", hubname); + WuUniStrReplace(&buf, L"{SESSIONKEY}", sessionkey); + WuUniStrReplace(&buf, L"{LINK_SECURENAT}", WP_SECURENAT); + + WuFreeStrStrMap(strmap); + + return buf; + }else{ + return WuErrorPage(retcode); + } + } +} + +// User list +static wchar_t *WpUser(WEBUI *wu, LIST *params) +{ + char *sessionkey = (char*)StrMapSearch(params, "KEY"); + WU_CONTEXT *context = WuGetContext(wu->Contexts, sessionkey); + char *hubname = (char*)StrMapSearch(params, "HUB"); + char *cmd = (char*)StrMapSearch(params, "CMD"); + UINT retcode; + RPC_ENUM_USER t; + + // Check the context + if(context == NULL) + { + return WuRedirectPage(WP_LOGIN); + } + + if(cmd != NULL && StrCmp(cmd, "DEL") == 0) + { + char *username = (char*)StrMapSearch(params, "USER"); + RPC_DELETE_USER t; + UINT retcode; + + StrCpy(t.HubName, sizeof(t.HubName), hubname); + StrCpy(t.Name, sizeof(t.Name), username); + retcode = StDeleteUser(context->Admin, &t); + if(retcode == ERR_NO_ERROR) + { + char tmp[MAX_SIZE]; + Format(tmp, sizeof(tmp), "%s?HUB=%s&KEY=%s", WP_USER, hubname, sessionkey); + return WuRedirectPage(tmp); + }else + { + return WuErrorPage(retcode); + } + } + + Zero(&t, sizeof(t)); + StrCpy(t.HubName, sizeof(t.HubName), hubname); + retcode = StEnumUser(context->Admin, &t); + if(retcode == ERR_NO_ERROR) + { + UINT i; + wchar_t *buf = WuUniReadFile("|"WP_USER); + wchar_t *tmpl = WuUniGetTemplate(&buf, L"", true); + wchar_t tmp[MAX_SIZE]; + wchar_t datestr[MAX_SIZE]; + + for(i=0; iLastLoginTime)); + UniFormat(tmp, sizeof(tmp), tmpl, item->Name, item->Name, item->Name, item->Realname, item->GroupName, + item->Note, GetAuthTypeStr(item->AuthType), item->NumLogin, datestr); + WuUniInsertBefore(&buf, tmp, L""); + } + WuUniStrReplace(&buf, L"{SESSIONKEY}", sessionkey); + WuUniStrReplace(&buf, L"{HUBNAME}", hubname); + WuUniStrReplace(&buf, L"{LINK_USER}", WP_USER); + WuUniStrReplace(&buf, L"{LINK_EDITUSER}", WP_EDITUSER); + WuUniStrReplace(&buf, L"{LINK_HUB}", WP_HUB); + + FreeRpcEnumUser(&t); + Free(tmpl); + return buf; + }else{ + return WuErrorPage(retcode); + } +} + +// User edit page +static wchar_t *WpEditUser(WEBUI *wu, LIST *params) +{ + char *sessionkey = (char*)StrMapSearch(params, "KEY"); + WU_CONTEXT *context = WuGetContext(wu->Contexts, sessionkey); + char *hubname = (char*)StrMapSearch(params, "HUB"); + char *username = (char*)StrMapSearch(params, "USER"); + char *cmd = (char*)StrMapSearch(params, "CMD"); + char tmp[MAX_SIZE]; + wchar_t utmp[MAX_SIZE]; + UINT retcode; + RPC_SET_USER t; + wchar_t *buf; + + // Check the context + if(context == NULL) + { + return WuRedirectPage(WP_LOGIN); + } + + if(cmd != NULL && (StrCmp(cmd, "SET") == 0 || StrCmp(cmd, "CREATE") == 0)) + { + char *authtype = (char*)StrMapSearch(params, "AUTHTYPE"); + char *password = (char*)StrMapSearch(params, "PASSWORD"); + char *password2 = (char*)StrMapSearch(params, "PASSWORD2"); + bool create = (StrCmp(cmd, "CREATE") == 0); + + Zero(&t, sizeof(t)); + StrCpy(t.Name, sizeof(t.Name), username); + StrCpy(t.HubName, sizeof(t.HubName), hubname); + + // Read the original user data in the case of edit mode. + if(!create) + { + retcode = StGetUser(context->Admin, &t); + if(retcode != ERR_NO_ERROR) + { + return WuErrorPage(retcode); + } + } + + // Set the authentication method + if(StrCmp(authtype, "ANONYMOUS") == 0) + { + FreeAuthData(t.AuthType, t.AuthData); + t.AuthType = AUTHTYPE_ANONYMOUS; + t.AuthData = NULL; + } + else if(StrCmp(authtype, "PASSWORD") == 0) + { + if(StrCmp(password,password2) != 0) + { + // Password for confirmation is mismatched + return WuErrorPage(ERR_INVALID_PARAMETER); + } + + // If the password field has not changed, leave as is + if(t.AuthType != AUTHTYPE_PASSWORD || StrCmp(password, WU_PASSWORD_NOCHANGE) != 0) + { + FreeAuthData(t.AuthType, t.AuthData); + t.AuthType = AUTHTYPE_PASSWORD; + t.AuthData = NewPasswordAuthData(username, password); + } + } + else + { + // Parameters of the authentication method is invalid + return WuErrorPage(ERR_INVALID_PARAMETER); + } + + // Set the user information + if(create) + { + retcode = StCreateUser(context->Admin, &t); + } + else + { + retcode = StSetUser(context->Admin, &t); + } + if(retcode != ERR_NO_ERROR) + { + return WuErrorPage(retcode); + } + + Format(tmp, sizeof(tmp), "%s?KEY=%s&HUB=%s", WP_USER, sessionkey, hubname); + return WuRedirectPage(tmp); + } + + // Generate the user edit page + Zero(&t, sizeof(t)); + StrCpy(t.HubName, sizeof(t.HubName), hubname); + + if( username == NULL ) + { + t.AuthType = AUTHTYPE_PASSWORD; + }else{ + UINT retcode; + StrCpy(t.Name, sizeof(t.Name), username); + retcode = StGetUser(context->Admin, &t); + if(retcode != ERR_NO_ERROR) + { + return WuErrorPage(retcode); + } + } + + buf = WuUniReadFile("|"WP_EDITUSER); + + if( username == NULL) + { + WuEnableTag(&buf, L"{USERNAMEINPUT}"); + WuUniReplace(&buf, L"{USERNAME}", L""); + WuUniReplace(&buf, L"{CMDNAME}", L"CREATE"); + WuUniReplace(&buf, L"{PASSWORD}", L""); + } + else + { + WuEnableTag(&buf, L"{USERNAMEHIDDEN}"); + WuUniStrReplace(&buf, L"{USERNAME}", username); + WuUniReplace(&buf, L"{CMDNAME}", L"SET"); + WuUniStrReplace(&buf, L"{PASSWORD}", WU_PASSWORD_NOCHANGE); + } + + // Select the authentication method + if(t.AuthType == AUTHTYPE_ANONYMOUS) + { + WuUniReplace(&buf, L"{SELANONYM}", L"checked"); + } + else + { + WuUniReplace(&buf, L"{SELANONYM}", L""); + if(t.AuthType == AUTHTYPE_PASSWORD) + { + WuUniReplace(&buf, L"{SELPASSWD}", L"checked"); + } + else + { + WuUniReplace(&buf, L"{SELPASSWD}", L""); + } + } + + WuUniReplace(&buf, L"{REALNAME}", t.Realname); + WuUniReplace(&buf, L"{NOTETEXT}", t.Note); + WuUniStrReplace(&buf, L"{GROUPNAME}", t.GroupName); + GetDateTimeStr64Uni(utmp, sizeof(utmp), SystemToLocal64(t.ExpireTime)); + WuUniReplace(&buf, L"{EXPIREDATE}", utmp); + + WuUniStrReplace(&buf, L"{SESSIONKEY}", sessionkey); + WuUniStrReplace(&buf, L"{HUBNAME}", hubname); + WuUniStrReplace(&buf, L"{LINK_EDITUSER}", WP_EDITUSER); + WuUniStrReplace(&buf, L"{LINK_USER}", WP_USER); + + return buf; +} + +// Create a new Virtual HUB +static wchar_t *WpNewHub(WEBUI *wu, LIST *params) +{ + char *sessionkey = (char*)StrMapSearch(params, "KEY"); + WU_CONTEXT *context = WuGetContext(wu->Contexts, sessionkey); + char *cmd = (char*)StrMapSearch(params, "CMD"); + wchar_t *buf; + + if(context == NULL) + { + return WuRedirectPage(WP_LOGIN); + } + + if(StrCmp(cmd, "CREATE") == 0) + { + UINT retcode; + char tmp[MAX_SIZE]; + RPC_CREATE_HUB t; + RPC_SERVER_INFO t2; + char *hubname = (char*)StrMapSearch(params, "NAME"); + char *passwd = (char*)StrMapSearch(params, "PASSWD"); + char *passwd2 = (char*)StrMapSearch(params, "PASSWD2"); + + if(strcmp(passwd,passwd2) != 0) + { + return WuErrorPage(ERR_INVALID_PARAMETER); + } + + Zero(&t, sizeof(t)); + StrCpy(t.HubName, sizeof(t.HubName), hubname); + Sha0(t.HashedPassword, passwd, StrLen(passwd)); + HashPassword(t.SecurePassword, ADMINISTRATOR_USERNAME, passwd); + t.Online = true; + t.HubType = HUB_TYPE_STANDALONE; + + // Set to dynamic HUB in the case of cluster controller + Zero(&t2, sizeof(t2)); + if (StGetServerInfo(context->Admin, &t2) == ERR_NO_ERROR) + { + if (t2.ServerType == SERVER_TYPE_FARM_CONTROLLER) + { + t.HubType = HUB_TYPE_FARM_DYNAMIC; + } + FreeRpcServerInfo(&t2); + } + + retcode = StCreateHub(context->Admin, &t); + if(retcode != ERR_NO_ERROR) + { + return WuErrorPage(retcode); + } + + Format(tmp, sizeof(tmp), "%s?KEY=%s", WP_SERVER, sessionkey); + return WuRedirectPage(tmp); + } + + buf = WuUniReadFile("|"WP_NEWHUB); + WuUniStrReplace(&buf, L"{SESSIONKEY}", sessionkey); + WuUniStrReplace(&buf, L"{LINK_NEWHUB}", WP_NEWHUB); + WuUniStrReplace(&buf, L"{LINK_SERVER}", WP_SERVER); + return buf; +} + +// License management page +static wchar_t *WpLicense(WEBUI *wu, LIST *params) +{ + char *sessionkey = (char*)StrMapSearch(params, "KEY"); + WU_CONTEXT *context = WuGetContext(wu->Contexts, sessionkey); + char *cmd = (char*)StrMapSearch(params, "CMD"); + UINT retcode; + wchar_t *buf; + LIST *strmap; + + if(context == NULL) + { + return WuRedirectPage(WP_LOGIN); + } + + // Add a license + if(StrCmp(cmd, "ADD") == 0) + { + RPC_TEST t; + char tmp[MAX_SIZE]; + char *licensekey = (char*)StrMapSearch(params, "KEYSTRINGS"); + + + Zero(&t, sizeof(t)); + StrCpy(t.StrValue, sizeof(t.StrValue), licensekey); + + retcode = StAddLicenseKey(context->Admin, &t); + if(retcode != ERR_NO_ERROR) + { + return WuErrorPage(retcode); + } + + Format(tmp, sizeof(tmp), "%s?KEY=%s", WP_LICENSE, sessionkey); + return WuRedirectPage(tmp); + + } + // Remove the license + else if(StrCmp(cmd, "DEL") == 0) + { + RPC_TEST t; + char tmp[MAX_SIZE]; + char *id = (char*)StrMapSearch(params, "ID"); + + Zero(&t, sizeof(t)); + t.IntValue = ToInt(id); + + retcode = StDelLicenseKey(context->Admin, &t); + if(retcode != ERR_NO_ERROR) + { + return WuErrorPage(retcode); + } + + Format(tmp, sizeof(tmp), "%s?KEY=%s", WP_LICENSE, sessionkey); + return WuRedirectPage(tmp); + } + + buf = WuUniReadFile("|"WP_LICENSE); + strmap = WuUniMakeTableFromTemplate(&buf, L""); + + // Enumerate the license keys + { + UINT i; + RPC_ENUM_LICENSE_KEY t; + wchar_t *tmpl; + Zero(&t, sizeof(t)); + + retcode = StEnumLicenseKey(context->Admin, &t); + + if(retcode != ERR_NO_ERROR) + { + WuFreeStrStrMap(strmap); + Free(buf); + return WuErrorPage(retcode); + } + + tmpl = WuUniGetTemplate(&buf, L"", true); + + for(i = 0; i < t.NumItem; i++) + { + wchar_t *status, expires[128]; + wchar_t *tmp = UniCopyStr(tmpl); + RPC_ENUM_LICENSE_KEY_ITEM *item = &t.Items[i]; + + status = LiGetLicenseStatusStr(item->Status); + + if(item->Expires == 0) + { + UniStrCpy(expires, sizeof(expires), StrMapSearch(strmap, "EXPIRE_INFINITE")); + } + else + { + GetDateStrEx64(expires, sizeof(expires), item->Expires, NULL); + } + + WuUniUintReplace(&tmp, L"{ID}", i); + WuUniStrReplace(&tmp, L"{LICENSEKEY}", item->LicenseKey); + WuUniStrReplace(&tmp, L"{LICENSENAME}", item->LicenseName); + WuUniReplace(&tmp, L"{STATUS}", status); + WuUniReplace(&tmp, L"{EXPIRES}", expires); + WuUniStrReplace(&tmp, L"{LICENSEID}", item->LicenseId); + WuUniUintReplace(&tmp, L"{PRODUCTID}", item->ProductId); + WuUniUint64Replace(&tmp, L"{SYSTEMID}", item->SystemId); + WuUniUintReplace(&tmp, L"{SERIALID}", item->SerialId); + + WuUniInsertBefore(&buf, tmp, L""); + Free(tmp); + } + FreeRpcEnumLicenseKey(&t); + Free(tmpl); + } + + // Show the license status + { + RPC_LICENSE_STATUS t; + + Zero(&t, sizeof(t)); + + retcode = StGetLicenseStatus(context->Admin, &t); + + if(retcode != ERR_NO_ERROR) + { + WuFreeStrStrMap(strmap); + Free(buf); + return WuErrorPage(retcode); + } + + WuUniStrReplace(&buf, L"{LSEDITIONNAME}", t.EditionStr); + WuUniUint64Replace(&buf, L"{LSSERVERID}", t.SystemId); + if(t.SystemExpires == 0) + { + WuUniReplace(&buf, L"{LSEXPIRES}", StrMapSearch(strmap, "NOEXPIRE")); + } + else + { + wchar_t expires[128]; + GetDateStrEx64(expires, sizeof(expires), t.SystemExpires, NULL); + WuUniReplace(&buf, L"{LSEXPIRES}", expires); + } + + if(t.NumBridgeConnectLicense == INFINITE) + { + WuUniReplace(&buf, L"{LSNUMBRIDGES}", StrMapSearch(strmap, "LICENSE_INFINITE")); + } + else + { + WuUniUintReplace(&buf, L"{LSNUMBRIDGES}", t.NumBridgeConnectLicense); + } + + if(t.NumClientConnectLicense == INFINITE) + { + WuUniReplace(&buf, L"{LSNUMCLIENTS}", StrMapSearch(strmap, "LICENSE_INFINITE")); + } + else + { + WuUniUintReplace(&buf, L"{LSNUMCLIENTS}", t.NumClientConnectLicense); + } + + } + + WuUniStrReplace(&buf, L"{LINK_LICENSE}", WP_LICENSE); + WuUniStrReplace(&buf, L"{LINK_SERVER}", WP_SERVER); + WuUniStrReplace(&buf, L"{SESSIONKEY}", sessionkey); + WuFreeStrStrMap(strmap); + + return buf; + +} + +// Local bridge setup page +static wchar_t *WpLocalBridge(WEBUI *wu, LIST *params) +{ + char *sessionkey = (char*)StrMapSearch(params, "KEY"); + WU_CONTEXT *context = WuGetContext(wu->Contexts, sessionkey); + char *cmd = (char*)StrMapSearch(params, "CMD"); + UINT retcode; + wchar_t *buf; + LIST *strmap; + + if(context == NULL) + { + return WuRedirectPage(WP_LOGIN); + } + + // Create a local bridge + if(StrCmp(cmd, "CREATE") == 0) + { + RPC_LOCALBRIDGE t; + RPC_ENUM_ETH eth; + char tmp[MAX_SIZE]; + char *tapmode = (char*)StrMapSearch(params, "TAPMODE"); + char *tapname = (char*)StrMapSearch(params, "TAPNAME"); + char *devid = (char*)StrMapSearch(params, "DEVID"); + char *hubname = (char*)StrMapSearch(params, "LBHUBNAME"); + UINT id = ToInt(devid); + + Zero(ð, sizeof(eth)); + retcode = StEnumEthernet(context->Admin, ð); + + if(retcode != ERR_NO_ERROR) + { + FreeRpcEnumEth(ð); + return WuErrorPage(retcode); + } + + Zero(&t, sizeof(t)); + t.Active = true; + if(StrCmp(tapmode, "YES") == 0) + { + t.TapMode = true; + StrCpy(t.DeviceName, sizeof(t.DeviceName), tapname); + } + else + { + t.TapMode = false; + StrCpy(t.DeviceName, sizeof(t.DeviceName), eth.Items[id].DeviceName); + } + StrCpy(t.HubName, sizeof(t.HubName), hubname); + t.Online = true; + FreeRpcEnumEth(ð); + + retcode = StAddLocalBridge(context->Admin, &t); + + if(retcode != ERR_NO_ERROR) + { + return WuErrorPage(retcode); + } + + Format(tmp, sizeof(tmp), "%s?KEY=%s", WP_LOCALBRIDGE, sessionkey); + return WuRedirectPage(tmp); + } + + // Delete the local bridge + if(StrCmp(cmd, "DEL") == 0) + { + RPC_LOCALBRIDGE t; + RPC_ENUM_LOCALBRIDGE et; + char tmp[MAX_SIZE]; + char *listid = (char*)StrMapSearch(params, "LISTID"); + UINT id = ToInt(listid); + + Zero(&et, sizeof(et)); + retcode = StEnumLocalBridge(context->Admin, &et); + if(retcode != ERR_NO_ERROR) + { + return WuErrorPage(retcode); + } + + Zero(&t, sizeof(t)); + StrCpy(t.DeviceName, sizeof(t.DeviceName), et.Items[id].DeviceName); + StrCpy(t.HubName, sizeof(t.HubName), et.Items[id].HubName); + FreeRpcEnumLocalBridge(&et); + + retcode = StDeleteLocalBridge(context->Admin, &t); + + if(retcode != ERR_NO_ERROR) + { + return WuErrorPage(retcode); + } + + Format(tmp, sizeof(tmp), "%s?KEY=%s", WP_LOCALBRIDGE, sessionkey); + return WuRedirectPage(tmp); + } + + // Show the current local bridge list and the Virtual HUB list and the device list to be bridged + buf = WuUniReadFile("|"WP_LOCALBRIDGE); + strmap = WuUniMakeTableFromTemplate(&buf, L""); + + // Show the current local bridge list + { + UINT i; + RPC_ENUM_LOCALBRIDGE t; + wchar_t *tmpl; + + Zero(&t, sizeof(t)); + retcode = StEnumLocalBridge(context->Admin, &t); + + if(retcode != ERR_NO_ERROR) + { + FreeRpcEnumLocalBridge(&t); + Free(buf); + WuFreeStrStrMap(strmap); + return WuErrorPage(retcode); + } + + tmpl = WuUniGetTemplate(&buf, L"", true); + + for(i = 0; i < t.NumItem; i++) + { + RPC_LOCALBRIDGE *item = &t.Items[i]; + wchar_t *tmp = UniCopyStr(tmpl); + WuUniUintReplace(&tmp, L"{LISTID}", i); + WuUniStrReplace(&tmp, L"{HUBNAME}", item->HubName); + WuUniStrReplace(&tmp, L"{DEVICENAME}", item->DeviceName); + WuUniReplace(&tmp, L"{STATUS}", item->Online ? item->Active ? StrMapSearch(strmap, "BRIDGE_ONLINE") + : StrMapSearch(strmap, "BRIDGE_ERROR") : StrMapSearch(strmap, "BRIDGE_OFFLINE")); + WuUniInsertBefore(&buf, tmp, L""); + Free(tmp); + } + Free(tmpl); + FreeRpcEnumLocalBridge(&t); + } + + // Show the Virtual HUB list + { + wchar_t *tmpl; + RPC_ENUM_HUB t; + UINT i; + + Zero(&t, sizeof(t)); + retcode = StEnumHub(context->Admin, &t); + + if(retcode != ERR_NO_ERROR) + { + FreeRpcEnumHub(&t); + Free(buf); + WuFreeStrStrMap(strmap); + return WuErrorPage(retcode); + } + + tmpl = WuUniGetTemplate(&buf, L"", true); + for(i=0; i"); + Free(tmp); + } + FreeRpcEnumHub(&t); + Free(tmpl); + } + + // Get the device list to be bridge + { + UINT i; + RPC_ENUM_ETH t; + wchar_t *tmpl; + + Zero(&t, sizeof(t)); + retcode = StEnumEthernet(context->Admin, &t); + + if(retcode != ERR_NO_ERROR) + { + FreeRpcEnumEth(&t); + Free(buf); + WuFreeStrStrMap(strmap); + return WuErrorPage(retcode); + } + + tmpl = WuUniGetTemplate(&buf, L"", true); + + for(i = 0; i < t.NumItem; i++) + { + wchar_t *tmp = UniCopyStr(tmpl); + WuUniUintReplace(&tmp, L"{DEVID}", i); + WuUniStrReplace(&tmp, L"{ABLEDEVICE}", t.Items[i].DeviceName); + WuUniInsertBefore(&buf, tmp, L""); + Free(tmp); + } + FreeRpcEnumEth(&t); + Free(tmpl); + } + + WuUniStrReplace(&buf, L"{LINK_LOCALBRIDGE}", WP_LOCALBRIDGE); + WuUniStrReplace(&buf, L"{LINK_SERVER}", WP_SERVER); + WuUniStrReplace(&buf, L"{SESSIONKEY}", sessionkey); + WuFreeStrStrMap(strmap); + + return buf; + +} + +// Configure the virtual DHCP function and virtual NAT (SecureNAT) +static wchar_t *WpSecureNAT(WEBUI *wu, LIST *params) +{ + char *sessionkey = (char*)StrMapSearch(params, "KEY"); + + WU_CONTEXT *context = WuGetContext(wu->Contexts, sessionkey); + char *cmd = (char*)StrMapSearch(params, "CMD"); + char *hubname = (char*)StrMapSearch(params, "HUB"); + + UINT retcode; + wchar_t *buf; + + if(context == NULL) + { + return WuRedirectPage(WP_LOGIN); + } + + // Enable / disable the SecureNAT function + if(StrCmp(cmd, "ENABLE") == 0 || StrCmp(cmd, "DISABLE") == 0) + { + RPC_HUB t; + char tmp[MAX_SIZE]; + + Zero(&t, sizeof(t)); + StrCpy(t.HubName, sizeof(t.HubName), hubname); + + if(StrCmp(cmd, "ENABLE") == 0) + { + retcode = StEnableSecureNAT(context->Admin, &t); + } + else + { + retcode = StDisableSecureNAT(context->Admin, &t); + } + + if(retcode != ERR_NO_ERROR) + { + return WuErrorPage(retcode); + } + + Format(tmp, sizeof(tmp), "%s?HUB=%s&KEY=%s", WP_SECURENAT, hubname, sessionkey); + return WuRedirectPage(tmp); + } + // Set the SecureNAT options + else if(StrCmp(cmd, "SAVE") == 0) + { + char tmp[MAX_SIZE]; + VH_OPTION t; + + Zero(&t, sizeof(t)); + StrCpy(t.HubName, sizeof(t.HubName), hubname); + + // Configure the a virtual host + StrToMac(t.MacAddress, (char*)StrMapSearch(params, "HOSTMAC")); + StrToIP(&t.Ip, (char*)StrMapSearch(params, "HOSTIP")); + StrToIP(&t.Mask, (char*)StrMapSearch(params, "HOSTMASK")); + + // Configure the virtual NAT function + t.UseNat = (StrCmp((char*)StrMapSearch(params, "NATCHECK"), "on") == 0); + t.Mtu = ToInt((char*)StrMapSearch(params, "NATMTU")); + t.NatTcpTimeout = ToInt((char*)StrMapSearch(params, "NATTCPTIMEOUT")); + t.NatUdpTimeout = ToInt((char*)StrMapSearch(params, "NATUDPTIMEOUT")); + t.SaveLog = (StrCmp((char*)StrMapSearch(params, "NATSAVELOG"), "on") == 0); + + // Configure the virtual DHCP server function + t.UseDhcp = (StrCmp((char*)StrMapSearch(params, "DHCPCHECK"), "on") == 0); + StrToIP(&t.DhcpLeaseIPStart, (char*)StrMapSearch(params, "DHCPIPS")); + StrToIP(&t.DhcpLeaseIPEnd, (char*)StrMapSearch(params, "DHCPIPE")); + StrToIP(&t.DhcpSubnetMask, (char*)StrMapSearch(params, "DHCPMASK")); + t.DhcpExpireTimeSpan = ToInt((char*)StrMapSearch(params, "DHCPEXPIRE")); + StrToIP(&t.DhcpGatewayAddress, (char*)StrMapSearch(params, "DHCPGW")); + StrToIP(&t.DhcpDnsServerAddress, (char*)StrMapSearch(params, "DHCPDNS")); + StrCpy(t.DhcpDomainName, sizeof(t.DhcpDomainName), (char*)StrMapSearch(params, "DHCPDOMAIN")); + + retcode = StSetSecureNATOption(context->Admin, &t); + if(retcode == ERR_NO_ERROR) + { + Format(tmp, sizeof(tmp), "%s?HUB=%s&KEY=%s", WP_SECURENAT, hubname, sessionkey); + return WuRedirectPage(tmp); + } + return WuErrorPage(retcode); + } + + buf = WuUniReadFile("|"WP_SECURENAT); + + // Get the enable / disable state of the current SecureNAT + { + RPC_HUB_STATUS t; + Zero(&t, sizeof(t)); + StrCpy(t.HubName, sizeof(t.HubName), hubname); + + retcode = StGetHubStatus(context->Admin, &t); + + if(retcode != ERR_NO_ERROR) + { + Free(buf); + return WuErrorPage(retcode); + } + + WuEnableTag(&buf, t.SecureNATEnabled ? L"DISABLESNAT" : L"ENABLESNAT"); + } + + // Show the advanced settings of the current SecureNAT + { + char mac[MAX_SIZE], ip[MAX_SIZE], mask[MAX_SIZE]; + char dhcpips[MAX_SIZE], dhcpipe[MAX_SIZE], dhcpmask[MAX_SIZE]; + char optgw[MAX_SIZE], optdns[MAX_SIZE]; + VH_OPTION t; + + Zero(&t, sizeof(t)); + StrCpy(t.HubName, sizeof(t.HubName), hubname); + + retcode = StGetSecureNATOption(context->Admin, &t); + + + // Configure the virtual interfaces + MacToStr(mac, sizeof(mac), t.MacAddress); + IPToStr(ip, sizeof(ip), &t.Ip); + IPToStr(mask, sizeof(mask), &t.Mask); + WuUniStrReplace(&buf, L"{HOSTMAC}", mac); + WuUniStrReplace(&buf, L"{HOSTIP}", ip); + WuUniStrReplace(&buf, L"{HOSTMASK}", mask); + + // Configure the Virtual NAT + WuUniStrReplace(&buf, L"{NATCHECK}", t.UseNat ? "CHECKED" : ""); + WuUniUintReplace(&buf, L"{NATMTU}", t.Mtu); + WuUniUintReplace(&buf, L"{NATTCPTIMEOUT}", t.NatTcpTimeout); + WuUniUintReplace(&buf, L"{NATUDPTIMEOUT}", t.NatUdpTimeout); + + WuUniStrReplace(&buf, L"{NATSAVELOG}", t.SaveLog ? "CHECKED" : ""); + + // Configure the Virtual DHCP server + WuUniStrReplace(&buf, L"{DHCPCHECK}", t.UseDhcp ? "CHECKED" : ""); + + IPToStr(dhcpips, sizeof(dhcpips), &t.DhcpLeaseIPStart); + IPToStr(dhcpipe, sizeof(dhcpipe), &t.DhcpLeaseIPEnd); + IPToStr(dhcpmask, sizeof(dhcpmask), &t.DhcpSubnetMask); + WuUniStrReplace(&buf, L"{DHCPIPS}", dhcpips); + WuUniStrReplace(&buf, L"{DHCPIPE}", dhcpipe); + WuUniStrReplace(&buf, L"{DHCPMASK}", dhcpmask); + WuUniUintReplace(&buf, L"{DHCPEXPIRE}", t.DhcpExpireTimeSpan); + + IPToStr(optgw, sizeof(optgw), &t.DhcpGatewayAddress); + IPToStr(optdns, sizeof(optdns), &t.DhcpDnsServerAddress); + WuUniStrReplace(&buf, L"{DHCPGW}", optgw); + WuUniStrReplace(&buf, L"{DHCPDNS}", optdns); + WuUniStrReplace(&buf, L"{DHCPDOMAIN}", t.DhcpDomainName); + } + + WuUniStrReplace(&buf, L"{LINK_HUB}", WP_HUB); + WuUniStrReplace(&buf, L"{LINK_SECURENAT}", WP_SECURENAT); + WuUniStrReplace(&buf, L"{HUBNAME}", hubname); + WuUniStrReplace(&buf, L"{SESSIONKEY}", sessionkey); + + return buf; +} + +static wchar_t *WpSession(WEBUI *wu, LIST *params) +{ + char *sessionkey = (char*)StrMapSearch(params, "KEY"); + WU_CONTEXT *context = WuGetContext(wu->Contexts, sessionkey); + char *hub = (char*)StrMapSearch(params, "HUB"); + char *cmd = (char*)StrMapSearch(params, "CMD"); + + if(context == NULL) + { + return WuRedirectPage(WP_LOGIN); + } + + if(StrCmp(cmd, "DEL") == 0) + { + char *session = (char*)StrMapSearch(params, "SESSION"); + RPC_DELETE_SESSION t; + UINT retcode; + char tmp[MAX_SIZE]; + + Zero(&t, sizeof(t)); + StrCpy(t.HubName, sizeof(t.HubName), hub); + StrCpy(t.Name, sizeof(t.Name), session); + + retcode = StDeleteSession(context->Admin, &t); + if(retcode != ERR_NO_ERROR) + { + return WuErrorPage(retcode); + } + + Format(tmp, sizeof(tmp), "%s?HUB=%s&KEY=%s", WP_SESSION, hub, session); + return WuRedirectPage(tmp); + } + + // Show the session list + { + RPC_ENUM_SESSION t; + UINT retcode; + + Zero(&t, sizeof(t)); + StrCpy(t.HubName, sizeof(t.HubName), hub); + + retcode = StEnumSession(context->Admin, &t); + if(retcode != ERR_NO_ERROR) + { + return WuErrorPage(retcode); + }else{ + wchar_t *buf = WuUniReadFile("|"WP_SESSION); + wchar_t *tmpl = WuUniGetTemplate(&buf, L"", true); + UINT i; + for(i=0; iName); + WuUniStrReplace(&tmp, L"{SESSION_SERVER}", item->RemoteHostname); + WuUniStrReplace(&tmp, L"{SESSION_USER}", item->Username); + WuUniStrReplace(&tmp, L"{SESSION_HOST}", item->Hostname); + WuUniUintReplace(&tmp, L"{SESSION_TCP}", item->CurrentNumTcp); + WuUniUint64Replace(&tmp, L"{SESSION_BYTES}", item->PacketSize); + WuUniUint64Replace(&tmp, L"{SESSION_PKTS}", item->PacketNum); + WuUniStrReplace(&tmp, L"{SESSION}", item->Name); + + WuUniInsertBefore(&buf, tmp, L""); + Free(tmp); + } + + WuUniStrReplace(&buf, L"{HUBNAME}", hub); + WuUniStrReplace(&buf, L"{SESSIONKEY}", sessionkey); + WuUniStrReplace(&buf, L"{LINK_HUB}", WP_HUB); + WuUniStrReplace(&buf, L"{LINK_SESSION}", WP_SESSION); + + FreeRpcEnumSession(&t); + Free(tmpl); + return buf; + } + } +} + + +// **** Public interface of the WebUI module + +// Get the page +WU_WEBPAGE *WuGetPage(char *target, WEBUI *wu) +{ + char filename[MAX_SIZE]; + LIST *params; + wchar_t *(*handler)(WEBUI *wu, LIST *params); + + // Delete the expired session keys + WuExpireSessionKey(wu); + + params = WuAnalyzeTarget(target, filename, sizeof(filename)); + + // Search for the handler corresponding to the URL + handler = StrMapSearch(wu->PageList, filename); + + // Call the handler + if(handler != NULL) + { + wchar_t *unitmp; + WU_WEBPAGE *page; + unitmp = handler(wu, params); + WuFreeStrStrMap(params); + page = WuNewUniWebPage(unitmp); + Free(unitmp); + return page; + } + + WuFreeStrStrMap(params); + + // If it missed, try to read the file directly + if(StartWith(filename, WP_DEFAULT)) + { + char tmp[MAX_SIZE] = "|"; + BUF *buf; + WU_WEBPAGE *page; + + StrCat(tmp, sizeof(tmp), filename); + buf = ReadDump(tmp); + if(buf == NULL) + { + return NULL; + } + + page = WuNewWebPage(buf->Buf, buf->Size, filename); + FreeBuf(buf); + return page; + } + + return NULL; +} + +// Start the WebUI +WEBUI *WuNewWebUI(CEDAR *cedar) +{ + WEBUI *wu = (WEBUI*)Malloc(sizeof(WEBUI)); + int i; + + wu->Cedar = cedar; + + wu->PageList = NewStrMap(); + for(i=0;iPageList, &wu_pages[i]); + } + + wu->Contexts = NewStrMap(); + + return wu; +} + +// Release the WebUI +bool WuFreeWebUI(WEBUI *wu) +{ + UINT i; + + if(wu == NULL) + { + return false; + } + + for(i=0; iContexts); i++) + { + STRMAP_ENTRY *se = LIST_DATA(wu->Contexts, i); + Free(se->Name); + WuFreeContext((WU_CONTEXT*)se->Value); + Free(se); + } + ReleaseList(wu->Contexts); + + ReleaseList(wu->PageList); + Free(wu); + return true; +} + +void WuFreeWebPage(WU_WEBPAGE *page) +{ + if(page == NULL) + { + return; + } + + FreeHttpHeader(page->header); + Free(page->data); + Free(page); +} + +// **** Module local utility functions + +// Initialize the context +static WU_CONTEXT *WuNewContext(WEBUI *wu, char *hubname) +{ + WU_CONTEXT *context = (WU_CONTEXT*)Malloc(sizeof(WU_CONTEXT)); + + if(StrLen(hubname) == 0) + { + hubname=NULL; + } + context->Admin = (ADMIN*)ZeroMalloc(sizeof(ADMIN)); + context->Admin->HubName = hubname != NULL ? CopyStr(hubname) : NULL; + context->Admin->Server = wu->Cedar->Server; + context->Admin->ServerAdmin = hubname == NULL ? true: false; + context->Admin->Rpc = (RPC*)ZeroMalloc(sizeof(RPC)); + StrCpy(context->Admin->Rpc->Name, sizeof(context->Admin->Rpc->Name), "WEBUI"); + context->Admin->Rpc->Param = context->Admin; + context->Admin->Rpc->ServerAdminMode = context->Admin->ServerAdmin; + context->Admin->Rpc->ServerMode = true; + context->Admin->Rpc->IsVpnServer = true; + context->Admin->Rpc->Lock = NewLock(); + context->Admin->LogFileList = NULL; + + context->ExpireDate = Tick64() + WU_CONTEXT_EXPIRE; + + return context; +} + +// Release the context +static void WuFreeContext(WU_CONTEXT *context) +{ + DeleteLock(context->Admin->Rpc->Lock); + Free(context->Admin->Rpc); + Free(context->Admin->HubName); + Free(context->Admin); + Free(context); +} + +// Create a WebPage structure from the Unicode string +static WU_WEBPAGE *WuNewUniWebPage(wchar_t *content) +{ + WU_WEBPAGE *ret; + + if(content == NULL) + { + return NULL; + } + + ret = (WU_WEBPAGE*)Malloc(sizeof(WU_WEBPAGE)); + ret->size = CalcUniToUtf8(content); + ret->data = (char*)Malloc(ret->size); + UniToUtf8(ret->data, ret->size, content); + + ret->header = NewHttpHeader("HTTP/1.1", "202", "OK"); + AddHttpValue(ret->header, NewHttpValue("Content-Type", HTTP_CONTENT_TYPE4)); + AddHttpValue(ret->header, NewHttpValue("Connection", "Keep-Alive")); + AddHttpValue(ret->header, NewHttpValue("Keep-Alive", HTTP_KEEP_ALIVE)); + + return ret; +} + +// Generate the WebPage structure from the raw data +static WU_WEBPAGE *WuNewWebPage(char *content, UINT size, char *filename) +{ + WU_WEBPAGE *ret; + + if(content == NULL) + { + return NULL; + } + + ret = (WU_WEBPAGE*)Malloc(sizeof(WU_WEBPAGE)); + ret->size = size; + ret->data = (char*)Malloc(size); + Copy(ret->data, content, size); + + ret->header = NewHttpHeader("HTTP/1.1", "202", "OK"); + AddHttpValue(ret->header, NewHttpValue("Connection", "Keep-Alive")); + AddHttpValue(ret->header, NewHttpValue("Keep-Alive", HTTP_KEEP_ALIVE)); + + if(EndWith(filename, "jpg")) + { + AddHttpValue(ret->header, NewHttpValue("Content-Type", HTTP_CONTENT_TYPE3)); + } + AddHttpValue(ret->header, NewHttpValue("Content-Type", HTTP_CONTENT_TYPE4)); + + return ret; +} + +// Return an error page +static wchar_t *WuErrorPage(UINT errorcode) +{ + wchar_t *buf = WuUniReadFile("|"WP_ERROR); + wchar_t tmp[MAX_SIZE]; + UniFormat(tmp, sizeof(tmp), L"%d\n

%s

", errorcode, GetUniErrorStr(errorcode)); + WuUniReplace(&buf, L"ERRMSG", tmp); + return buf; +} + +// Redirect +static wchar_t *WuRedirectPage(char *url) +{ + wchar_t *buf = WuUniReadFile("|"WP_REDIRECT); + wchar_t tmp[MAX_SIZE]; + StrToUni(tmp, sizeof(tmp), url); + WuUniReplace(&buf, L"REDIRECT_TO", tmp); + return buf; +} + +// Analyse the URL +static LIST *WuAnalyzeTarget(char *target,char *filename, UINT size) +{ + char *start, tmp; + + if(target == NULL || filename == NULL) + { + return NULL; + } + + // Process the absolute path specification + if(StartWith(target,"http://")) + { + // Skip http:// + target += 7; + + // Skip the host name portion + while(*target != '/' && *target != '\0') + { + target ++; + } + + // Error if the "/" isn't included after "http://" + if(*target == '\0') + { + return NULL; + } + + target++; + } + + // Unescape + // (not implemented) + + // Extract the file name portion + start = target; + while(*target != '?' && *target != '\0') + { + target ++; + } + tmp = *target; + *target = '\0'; + StrCpy(filename, size, start); + *target = tmp; + + // Interpret if there are parameters + if(*target == '?') + { + LIST *params = NewStrMap(); + UINT i; + TOKEN_LIST *tl; + target++; + tl =ParseToken(target,"&"); + for(i=0;iNumTokens;i++) + { + char *token = tl->Token[i]; + char *body = token; + STRMAP_ENTRY *newentry = (STRMAP_ENTRY*)Malloc(sizeof(STRMAP_ENTRY)); + + while(*body != '=' && *body != '\0') + { + body++; + } + if(*body == '=') + { + *body = '\0'; + body++; + } + newentry->Name = CopyStr(token); + newentry->Value = CopyStr(body); + Add(params, newentry); +// Debug("PARAMS: %s : %s\n",token,body); + } + FreeToken(tl); + return params; + } + return NULL; +} + +// Release the parameter list +static void WuFreeStrStrMap(LIST *params) +{ + UINT i; + + if(params == NULL) + { + return; + } + + for(i=0; iName); + Free(e->Value); + Free(e); + } + ReleaseList(params); +} + +// Read the UTF-8 file and convert as an Unicode string +static wchar_t *WuUniReadFile(char *filename) +{ + IO *io; + UINT size, usize; + BYTE *utf8; + wchar_t *wchars; + + // Validate arguments + if (filename == NULL) + { + return NULL; + } + + io = FileOpen(filename, false); + if (io == NULL) + { + return NULL; + } + + // Load the file + size = FileSize(io); + utf8 = (BYTE*)Malloc(size); + FileRead(io, (void*)utf8, size); + FileClose(io); + + usize = CalcUtf8ToUni(utf8, size); + wchars = (wchar_t*)ZeroMalloc(usize+sizeof(wchar_t)); + Utf8ToUni(wchars, usize, utf8, size); + Free(utf8); + + return wchars; +} + +// Replace string (with memory reallocation) +static void WuUniReplace(wchar_t **buf, wchar_t *from, wchar_t *to) +{ + UINT dstsize; + wchar_t *oldbuf; + + if(buf == NULL || from == NULL || to == NULL) + { + return; + } + + oldbuf = *buf; + + dstsize = (UniCalcReplaceStrEx(*buf, from, to, true) + 1) * sizeof(wchar_t); + *buf = (wchar_t*)Malloc(dstsize); + UniReplaceStr(*buf, dstsize, oldbuf, from, to); + Free(oldbuf); +} + +// Insert the string in front of a specified pattern +static void WuUniInsertBefore(wchar_t **buf, wchar_t *insert, wchar_t *before) +{ + UINT tmpsize; + wchar_t *tmp; + + if(buf == NULL || insert == NULL || before == NULL) + { + return; + } + + tmpsize = (UniStrLen(insert)+UniStrLen(before)+1)*sizeof(wchar_t); + tmp = (wchar_t*)Malloc(tmpsize); + UniStrCpy(tmp, tmpsize, insert); + UniStrCat(tmp, tmpsize, before); + WuUniReplace(buf, before, tmp); + Free(tmp); +} + +// Uncomment the tag specified by the keyword +static void WuEnableTag(wchar_t **buf, wchar_t *keyword) +{ + wchar_t tmp[MAX_SIZE]; + if(buf == NULL || keyword == NULL) + { + return; + } + + UniFormat(tmp, sizeof(tmp), L"!--%s", keyword); + WuUniReplace(buf, tmp, L""); + + UniFormat(tmp, sizeof(tmp), L"%s--", keyword); + WuUniReplace(buf, tmp, L""); + return; +} + +// Generate a session key +static char *WuNewSessionKey() +{ + char tmp[MD5_SIZE], *ret; + UINT size; + Rand(tmp, sizeof(tmp)); + size = sizeof(tmp)*2+1; + ret = Malloc(size); + BinToStr(ret, size, tmp, sizeof(tmp)); + return ret; +} + +// Replace the Unicode pattern in Unicode string with ASCII string +static void WuUniStrReplace(wchar_t **buf, wchar_t *from, char *to) +{ + UINT unisize; + wchar_t *tmp; + + if(buf == NULL || *buf == NULL || from == NULL || to == NULL) + { + return; + } + + unisize = CalcStrToUni(to); + tmp = (wchar_t*)Malloc(unisize); + StrToUni(tmp, unisize, to); + WuUniReplace(buf, from, tmp); + Free(tmp); +} + +// Extract the template surrounded by specified Unicode string from Unicode string +static wchar_t *WuUniGetTemplate(wchar_t **str, wchar_t *start, wchar_t *end, bool erase) +{ + UINT startidx, endidx, len, size, i; + wchar_t *ret; + + if(str == NULL || *str == NULL || start == NULL || end == NULL) + { + return NULL; + } + + startidx = UniSearchStr(*str, start, 0); + if(startidx == INFINITE) + { + return NULL; + } + startidx += UniStrLen(start); + + endidx = UniSearchStr(*str, end, startidx); + if(endidx == INFINITE) + { + return NULL; + } + + len = endidx - startidx; + size = (len + 1) * sizeof(wchar_t); + ret = (wchar_t*)Malloc(size); + for(i=0; iName = (char*)Malloc(keylen); + UniToStr(entry->Name, keylen, keytmp); + def = WuUniCopyStrTill(def, L',', (wchar_t**)&(entry->Value)); + Add(table, entry); + Free(keytmp); + } + return table; +} + +// Extract the template from Unicode string, and create a string table from it +static LIST *WuUniMakeTableFromTemplate(wchar_t **str, wchar_t *start, wchar_t *end) +{ + wchar_t *tmpl = WuUniGetTemplate(str, start, end, true); + LIST *ret = WuUniMakeTable(tmpl); + Free(tmpl); + return ret; +} + +// Delete the expired session key +static void WuExpireSessionKey(WEBUI *wu) +{ + LIST *Expired = NewList(NULL); + UINT i; + + LockList(wu->Contexts); + + for(i=0; iContexts); i++) + { + STRMAP_ENTRY *entry = (STRMAP_ENTRY*)LIST_DATA(wu->Contexts, i); + WU_CONTEXT *context = (WU_CONTEXT*)entry->Value; + if(context->ExpireDate < Tick64()) + { + Add(Expired, entry); + } + } + + for(i=0; iContexts, entry); + Free(entry->Name); + WuFreeContext(entry->Value); + Free(entry); + } + ReleaseList(Expired); + + UnlockList(wu->Contexts); +} + +// Get the context, and extend its expiration date +static WU_CONTEXT *WuGetContext(LIST *contexts, char *sessionkey) +{ + WU_CONTEXT *ret = StrMapSearch(contexts, sessionkey); + if(ret != NULL) + { + ret->ExpireDate = Tick64() + WU_CONTEXT_EXPIRE; + } + return ret; +} diff --git a/src/Cedar/WebUI.h b/src/Cedar/WebUI.h index 78e3afd7..645e9382 100644 --- a/src/Cedar/WebUI.h +++ b/src/Cedar/WebUI.h @@ -1,39 +1,39 @@ -// SoftEther VPN Source Code - Developer Edition Master Branch -// Cedar Communication Module - - -// WebUI.h -// Header of WebUI.c - -#define WU_PASSWORD_NOCHANGE "********" -#define WU_CONTEXT_EXPIRE 600000 - -// Prototype declaration - -typedef struct WEBUI -{ - CEDAR *Cedar; - LIST *PageList; - LIST *Contexts; -} WEBUI; - -// WebUI context -typedef struct WU_CONTEXT -{ - ADMIN *Admin; - UINT64 ExpireDate; -} WU_CONTEXT; - -typedef struct WU_WEBPAGE -{ - char *data; - UINT size; - HTTP_HEADER *header; -} WU_WEBPAGE; - -// Prototype declaration -bool WuFreeWebUI(WEBUI *wu); -WEBUI *WuNewWebUI(CEDAR *cedar); -WU_WEBPAGE *WuGetPage(char *target, WEBUI *wu); -void WuFreeWebPage(WU_WEBPAGE *page); - +// SoftEther VPN Source Code - Developer Edition Master Branch +// Cedar Communication Module + + +// WebUI.h +// Header of WebUI.c + +#define WU_PASSWORD_NOCHANGE "********" +#define WU_CONTEXT_EXPIRE 600000 + +// Prototype declaration + +typedef struct WEBUI +{ + CEDAR *Cedar; + LIST *PageList; + LIST *Contexts; +} WEBUI; + +// WebUI context +typedef struct WU_CONTEXT +{ + ADMIN *Admin; + UINT64 ExpireDate; +} WU_CONTEXT; + +typedef struct WU_WEBPAGE +{ + char *data; + UINT size; + HTTP_HEADER *header; +} WU_WEBPAGE; + +// Prototype declaration +bool WuFreeWebUI(WEBUI *wu); +WEBUI *WuNewWebUI(CEDAR *cedar); +WU_WEBPAGE *WuGetPage(char *target, WEBUI *wu); +void WuFreeWebPage(WU_WEBPAGE *page); + diff --git a/src/Cedar/Win32Com.cpp b/src/Cedar/Win32Com.cpp index 1ad44759..01b34a96 100644 --- a/src/Cedar/Win32Com.cpp +++ b/src/Cedar/Win32Com.cpp @@ -1,1027 +1,1027 @@ -// SoftEther VPN Source Code - Developer Edition Master Branch -// Cedar Communication Module - - -// Win32Com.c -// Win32 COM module call - -#include - -#ifdef WIN32 - -#define WIN32COM_CPP - -#define _WIN32_DCOM - -//#define _WIN32_WINNT 0x0502 -//#define WINVER 0x0502 -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "netcfgn.h" -#include -#include -#include -#include -#include -#include -#include -extern "C" -{ -#include -#include -} -#include "../PenCore/resource.h" - -// Add a UPnP port -bool Win32UPnPAddPort(UINT outside_port, UINT inside_port, bool udp, char *local_ip, wchar_t *description, bool remove_before_add) -{ - bool ret = false; - HRESULT hr; - IUPnPNAT *nat = NULL; - wchar_t ip_str[MAX_SIZE]; - BSTR bstr_ip, bstr_description, bstr_protocol; - const wchar_t *protocol_str = (udp ? L"UDP" : L"TCP"); - // Validate arguments - if (outside_port == 0 || outside_port >= 65536 || inside_port == 0 || inside_port >= 65536 || - IsEmptyStr(local_ip) || UniIsEmptyStr(description)) - { - return false; - } - - StrToUni(ip_str, sizeof(ip_str), local_ip); - bstr_ip = SysAllocString(ip_str); - bstr_description = SysAllocString(description); - bstr_protocol = SysAllocString(protocol_str); - - hr = CoCreateInstance(CLSID_UPnPNAT, NULL, CLSCTX_INPROC_SERVER, IID_IUPnPNAT, (void **)&nat); - - if (SUCCEEDED(hr)) - { - if (nat != NULL) - { - IStaticPortMappingCollection *collection = NULL; - hr = nat->get_StaticPortMappingCollection(&collection); - - if (SUCCEEDED(hr)) - { - if (collection != NULL) - { - IStaticPortMapping *mapping = NULL; - - if (remove_before_add) - { - hr = collection->Remove((long)outside_port, bstr_protocol); - } - - hr = collection->Add((long)outside_port, bstr_protocol, (long)inside_port, - bstr_ip, VARIANT_TRUE, bstr_description, &mapping); - - if (SUCCEEDED(hr)) - { - ret = true; - - if (mapping != NULL) - { - mapping->Release(); - } - } - - collection->Release(); - } - else - { - WHERE; - } - } - else - { - WHERE; - } - - nat->Release(); - } - else - { - WHERE; - } - } - else - { - WHERE; - } - - SysFreeString(bstr_ip); - SysFreeString(bstr_description); - SysFreeString(bstr_protocol); - - return ret; -} - -// Install the NDIS protocol driver -bool UninstallNdisProtocolDriver(wchar_t *id, UINT lock_timeout) -{ - bool ret = false; - HRESULT hr; - INetCfg *pNetCfg; - // Validate arguments - if (id == NULL) - { - return false; - } - - hr = CoCreateInstance(CLSID_CNetCfg, NULL, CLSCTX_INPROC_SERVER, IID_INetCfg, (void **)&pNetCfg); - - if (SUCCEEDED(hr)) - { - INetCfgLock *pLock; - - hr = pNetCfg->QueryInterface(IID_INetCfgLock, (PVOID*)&pLock); - - if (SUCCEEDED(hr)) - { - LPWSTR locked_by; - - hr = pLock->AcquireWriteLock(lock_timeout, L"SoftEther VPN", &locked_by); - - if (SUCCEEDED(hr)) - { - hr = pNetCfg->Initialize(NULL); - - if (SUCCEEDED(hr)) - { - INetCfgComponent *pncc = NULL; - - hr = pNetCfg->FindComponent(id, &pncc); - - if (pncc == NULL || hr == S_FALSE) - { - hr = E_FAIL; - } - - if (SUCCEEDED(hr)) - { - INetCfgClass *pncClass; - - hr = pNetCfg->QueryNetCfgClass(&GUID_DEVCLASS_NETTRANS, IID_INetCfgClass, (void **)&pncClass); - if (SUCCEEDED(hr)) - { - INetCfgClassSetup *pncClassSetup; - - hr = pncClass->QueryInterface(IID_INetCfgClassSetup, (void **)&pncClassSetup); - if (SUCCEEDED(hr)) - { - OBO_TOKEN obo; - wchar_t *c = NULL; - - Zero(&obo, sizeof(obo)); - - obo.Type = OBO_USER; - - hr = pncClassSetup->DeInstall(pncc, &obo, &c); - - if (SUCCEEDED(hr)) - { - hr = pNetCfg->Apply(); - - if (SUCCEEDED(hr)) - { - ret = true; - } - else - { - WHERE; - Debug("0x%x\n", hr); - } - } - else - { - WHERE; - Debug("0x%x\n", hr); - } - - pncClassSetup->Release(); - } - else - { - WHERE; - } - - pncClass->Release(); - } - else - { - WHERE; - } - - pncc->Release(); - } - else - { - WHERE; - } - } - else - { - WHERE; - } - - pLock->ReleaseWriteLock(); - } - else - { - WHERE; - } - - pLock->Release(); - } - - pNetCfg->Release(); - } - else - { - WHERE; - } - - return ret; -} - -// Install the NDIS protocol driver -bool InstallNdisProtocolDriver(wchar_t *inf_path, wchar_t *id, UINT lock_timeout) -{ - bool ret = false; - HRESULT hr; - INetCfg *pNetCfg; - HINSTANCE hSetupApiDll = NULL; - BOOL (WINAPI *_SetupCopyOEMInfW)(PCWSTR, PCWSTR, DWORD, DWORD, PWSTR, DWORD, PDWORD, PWSTR *) = NULL; - BOOL (WINAPI *_SetupUninstallOEMInfW)(PCWSTR, DWORD, PVOID) = NULL; - // Validate arguments - if (inf_path == NULL || id == NULL) - { - return false; - } - - hSetupApiDll = LoadLibraryA("setupapi.dll"); - if (hSetupApiDll == NULL) - { - WHERE; - goto LABEL_CLEANUP; - } - - _SetupCopyOEMInfW = - (UINT (__stdcall *)(PCWSTR,PCWSTR,DWORD,DWORD,PWSTR,DWORD,PDWORD,PWSTR *)) - GetProcAddress(hSetupApiDll, "SetupCopyOEMInfW"); - - _SetupUninstallOEMInfW = - (UINT (__stdcall *)(PCWSTR,DWORD,PVOID)) - GetProcAddress(hSetupApiDll, "SetupUninstallOEMInfW"); - - if (_SetupCopyOEMInfW == NULL || _SetupUninstallOEMInfW == NULL) - { - WHERE; - goto LABEL_CLEANUP; - } - - hr = CoCreateInstance(CLSID_CNetCfg, NULL, CLSCTX_INPROC_SERVER, IID_INetCfg, (void **)&pNetCfg); - - if (SUCCEEDED(hr)) - { - INetCfgLock *pLock; - - hr = pNetCfg->QueryInterface(IID_INetCfgLock, (PVOID*)&pLock); - - if (SUCCEEDED(hr)) - { - LPWSTR locked_by; - - hr = pLock->AcquireWriteLock(lock_timeout, L"SoftEther VPN", &locked_by); - - if (SUCCEEDED(hr)) - { - hr = pNetCfg->Initialize(NULL); - - if (SUCCEEDED(hr)) - { - wchar_t inf_dir[MAX_PATH]; - - GetDirNameFromFilePathW(inf_dir, sizeof(inf_dir), inf_path); - - if (_SetupCopyOEMInfW(inf_path, inf_dir, SPOST_PATH, 0, NULL, 0, NULL, 0)) - { - INetCfgClassSetup *pSetup; - - hr = pNetCfg->QueryNetCfgClass(&GUID_DEVCLASS_NETTRANS, IID_INetCfgClassSetup, (void **)&pSetup); - - if (SUCCEEDED(hr)) - { - OBO_TOKEN token; - INetCfgComponent *pComponent; - - Zero(&token, sizeof(token)); - - token.Type = OBO_USER; - - hr = pSetup->Install(id, &token, 0, 0, NULL, NULL, &pComponent); - - if (SUCCEEDED(hr)) - { - pNetCfg->Apply(); - - ret = true; - } - else - { - WHERE; - Debug("0x%x\n", hr); - } - - pSetup->Release(); - } - else - { - WHERE; - } - - if (ret == false) - { - wchar_t dst_inf_name[MAX_PATH]; - DWORD dst_inf_name_size = MAX_PATH; - - if (_SetupCopyOEMInfW(inf_path, inf_dir, SPOST_PATH, SP_COPY_REPLACEONLY, - dst_inf_name, dst_inf_name_size, &dst_inf_name_size, NULL) == false && - GetLastError() == ERROR_FILE_EXISTS) - { - _SetupUninstallOEMInfW(dst_inf_name, 0, NULL); - } - } - } - else - { - WHERE; - } - } - else - { - WHERE; - } - - pLock->ReleaseWriteLock(); - } - else - { - WHERE; - } - - pLock->Release(); - } - - pNetCfg->Release(); - } - else - { - WHERE; - } - -LABEL_CLEANUP: - - if (hSetupApiDll != NULL) - { - FreeLibrary(hSetupApiDll); - } - - return ret; -} - -typedef struct FOLDER_DLG_INNER_DATA -{ - wchar_t *default_dir; -} FOLDER_DLG_INNER_DATA; - -int CALLBACK FolderDlgInnerCallbackA(HWND hWnd, UINT msg, LPARAM lParam, LPARAM lData) -{ - FOLDER_DLG_INNER_DATA *data = (FOLDER_DLG_INNER_DATA *)lData; - LPITEMIDLIST pidl; - - switch (msg) - { - case BFFM_INITIALIZED: - if (data->default_dir != NULL) - { - char *default_dir_a = CopyUniToStr(data->default_dir); - - SendMessage(hWnd, BFFM_SETSELECTIONA, true, (LPARAM)default_dir_a); - - Free(default_dir_a); - } - break; - - case BFFM_SELCHANGED: - pidl = (LPITEMIDLIST)lParam; - - if (pidl) - { - char tmp[MAX_PATH]; - - Zero(tmp, sizeof(tmp)); - if (SHGetPathFromIDListA(pidl, tmp)) - { - SendMessage(hWnd, BFFM_ENABLEOK, 0, 1); - } - else - { - SendMessage(hWnd, BFFM_ENABLEOK, 0, 0); - } - } - break; - } - - return 0; -} - -char *FolderDlgInnerA(HWND hWnd, wchar_t *title, char *default_dir) -{ - BROWSEINFOA info; - char display_name[MAX_PATH]; - FOLDER_DLG_INNER_DATA data; - LPMALLOC pMalloc; - char *ret = NULL; - char *title_a; - if (UniIsEmptyStr(title)) - { - title = NULL; - } - if (IsEmptyStr(default_dir)) - { - default_dir = NULL; - } - - Zero(&data, sizeof(data)); - data.default_dir = CopyStrToUni(default_dir); - - Zero(display_name, sizeof(display_name)); - Zero(&info, sizeof(info)); - info.hwndOwner = hWnd; - info.pidlRoot = NULL; - info.pszDisplayName = display_name; - title_a = CopyUniToStr(title); - info.lpszTitle = title_a; - info.ulFlags = BIF_NEWDIALOGSTYLE | BIF_RETURNONLYFSDIRS | BIF_VALIDATE | BIF_SHAREABLE; - info.lpfn = FolderDlgInnerCallbackA; - info.lParam = (LPARAM)&data; - - if (SUCCEEDED(SHGetMalloc(&pMalloc))) - { - LPITEMIDLIST pidl; - - pidl = SHBrowseForFolderA(&info); - - if (pidl) - { - char tmp[MAX_PATH]; - - if (SHGetPathFromIDListA(pidl, tmp)) - { - ret = CopyStr(tmp); - } - - pMalloc->Free(pidl); - } - - pMalloc->Release(); - } - - Free(data.default_dir); - Free(title_a); - - return ret; -} - -int CALLBACK FolderDlgInnerCallbackW(HWND hWnd, UINT msg, LPARAM lParam, LPARAM lData) -{ - FOLDER_DLG_INNER_DATA *data = (FOLDER_DLG_INNER_DATA *)lData; - LPITEMIDLIST pidl; - - switch (msg) - { - case BFFM_INITIALIZED: - if (data->default_dir != NULL) - { - SendMessage(hWnd, BFFM_SETSELECTIONW, true, (LPARAM)data->default_dir); - } - break; - - case BFFM_SELCHANGED: - pidl = (LPITEMIDLIST)lParam; - - if (pidl) - { - wchar_t tmp[MAX_PATH]; - - Zero(tmp, sizeof(tmp)); - if (SHGetPathFromIDListW(pidl, tmp)) - { - SendMessage(hWnd, BFFM_ENABLEOK, 0, 1); - } - else - { - SendMessage(hWnd, BFFM_ENABLEOK, 0, 0); - } - } - break; - } - - return 0; -} - -wchar_t *FolderDlgInnerW(HWND hWnd, wchar_t *title, wchar_t *default_dir) -{ - BROWSEINFOW info; - wchar_t display_name[MAX_PATH]; - FOLDER_DLG_INNER_DATA data; - LPMALLOC pMalloc; - wchar_t *ret = NULL; - if (UniIsEmptyStr(title)) - { - title = NULL; - } - if (UniIsEmptyStr(default_dir)) - { - default_dir = NULL; - } - - Zero(&data, sizeof(data)); - data.default_dir = default_dir; - - Zero(display_name, sizeof(display_name)); - Zero(&info, sizeof(info)); - info.hwndOwner = hWnd; - info.pidlRoot = NULL; - info.pszDisplayName = display_name; - info.lpszTitle = title; - info.ulFlags = BIF_NEWDIALOGSTYLE | BIF_RETURNONLYFSDIRS | BIF_VALIDATE | BIF_SHAREABLE; - info.lpfn = FolderDlgInnerCallbackW; - info.lParam = (LPARAM)&data; - - if (SUCCEEDED(SHGetMalloc(&pMalloc))) - { - LPITEMIDLIST pidl; - - pidl = SHBrowseForFolderW(&info); - - if (pidl) - { - wchar_t tmp[MAX_PATH]; - - if (SHGetPathFromIDListW(pidl, tmp)) - { - ret = CopyUniStr(tmp); - } - - pMalloc->Free(pidl); - } - - pMalloc->Release(); - } - - return ret; -} - - -class CModule -{ -public: - CModule() - { - m_hInstLib = NULL; - } - CModule( HINSTANCE hInstLib ) - { - m_hInstLib = NULL; - this->Attach( hInstLib ); - } - CModule( LPCTSTR pszModuleName ) - { - m_hInstLib = NULL; - this->LoadLibrary( pszModuleName ); - } - virtual ~CModule() - { - this->FreeLibrary(); - } - -public: - BOOL Attach( HINSTANCE hInstLib ) - { - this->FreeLibrary(); - m_hInstLib = hInstLib; - - return TRUE; - } - BOOL Detach() - { - m_hInstLib = NULL; - - return TRUE; - } - -public: - HMODULE GetHandle() - { - return m_hInstLib; - } - // Load the DLL - HINSTANCE LoadLibrary( LPCTSTR pszModuleName ) - { - this->FreeLibrary(); - m_hInstLib = ::LoadLibrary( pszModuleName ); - - return m_hInstLib; - } - // Release the DLL - BOOL FreeLibrary() - { - if (m_hInstLib == NULL) - { - return FALSE; - } - - BOOL bResult = ::FreeLibrary( m_hInstLib ); - m_hInstLib = NULL; - - return bResult; - } - // Get the address of the function - FARPROC GetProcAddress( LPCTSTR pszProcName ) - { - if (m_hInstLib == NULL) - { - return NULL; - } - - return ::GetProcAddress(m_hInstLib, pszProcName); - } - // Get a handle to the information block of resource with the specified name and the type - HRSRC FindResource(LPCTSTR lpName, LPCTSTR lpType) - { - if (m_hInstLib == NULL) - { - return NULL; - } - - return ::FindResource(m_hInstLib, lpName, lpType); - } - // Load the specified resource - HGLOBAL LoadResource(HRSRC hResInfo) - { - if (m_hInstLib == NULL) - { - return NULL; - } - - return ::LoadResource(m_hInstLib, hResInfo); - } - -protected: - HINSTANCE m_hInstLib; -}; - - - -static HRESULT _ShowHTMLDialog( - HWND hwndParent, - IMoniker* pMk, - VARIANT* pvarArgIn = NULL, - WCHAR* pchOptions = NULL, - VARIANT* pvarArgOut = NULL) -{ - HRESULT hr = S_OK; - - try - { - CModule Module("MSHTML.DLL"); - if (Module.GetHandle() == NULL) - { - return E_FAIL; - } - - SHOWHTMLDIALOGFN* fnShowHTMLDialog = - (SHOWHTMLDIALOGFN*)Module.GetProcAddress("ShowHTMLDialog"); - if (fnShowHTMLDialog == NULL) - { - return E_FAIL; - } - - hr = (*fnShowHTMLDialog)(hwndParent, pMk, pvarArgIn, pchOptions, pvarArgOut); - if (FAILED(hr)) - { - return hr; - } - } - catch (...) - { - return E_FAIL; - } - - return hr; -} - -HRESULT ShowHTMLDialogFromURL(HWND hwndParent,wchar_t *szURL,VARIANT* pvarArgIn,WCHAR* pchOptions,VARIANT* pvarArgOut) -{ - HRESULT hr = S_OK; - - try - { - IMonikerPtr spMoniker; - hr = ::CreateURLMoniker(NULL, szURL, &spMoniker); - if (FAILED(hr)) - { - return hr; - } - - hr = ::_ShowHTMLDialog(hwndParent, spMoniker, pvarArgIn, pchOptions, pvarArgOut); - if (FAILED(hr)) - { - return hr; - } - } - catch (...) - { - return E_FAIL; - } - - return hr; -} - -// Create a shortcut -bool CreateLinkInnerA(char *filename, char *target, char *workdir, char *args, - char *comment, char *icon, UINT icon_index) -{ - HRESULT r; - wchar_t tmp[MAX_SIZE]; - IShellLinkA* pShellLink; - IPersistFile* pPersistFile; - - r = CoCreateInstance(CLSID_ShellLink, NULL, CLSCTX_INPROC_SERVER, IID_IShellLinkA, (void **)&pShellLink); - if (FAILED(r)) - { - return false; - } - - r = pShellLink->QueryInterface(IID_IPersistFile,(void **)&pPersistFile); - if (FAILED(r)) - { - pShellLink->Release(); - return false; - } - - r = pShellLink->SetPath(target); - if (FAILED(r)) - { - pShellLink->Release(); - pPersistFile->Release(); - return false; - } - - if (workdir != NULL) - { - r = pShellLink->SetWorkingDirectory(workdir); - if (FAILED(r)) - { - pShellLink->Release(); - pPersistFile->Release(); - return false; - } - } - - if (args != NULL) - { - r = pShellLink->SetArguments(args); - if (FAILED(r)) - { - pShellLink->Release(); - pPersistFile->Release(); - return false; - } - } - - if (comment != NULL) - { - r = pShellLink->SetDescription(comment); - if (FAILED(r)) - { - pShellLink->Release(); - pPersistFile->Release(); - return false; - } - } - - if (icon != NULL) - { - r = pShellLink->SetIconLocation(icon, icon_index); - if (FAILED(r)) - { - pShellLink->Release(); - pPersistFile->Release(); - return false; - } - } - - StrToUni(tmp, sizeof(tmp), filename); - r = pPersistFile->Save(tmp, true); - if (FAILED(r)) - { - pShellLink->Release(); - pPersistFile->Release(); - return false; - } - - pShellLink->Release(); - pPersistFile->Release(); - return true; -} -bool CreateLinkInner(wchar_t *filename, wchar_t *target, wchar_t *workdir, wchar_t *args, - wchar_t *comment, wchar_t *icon, UINT icon_index) -{ - HRESULT r; - bool ret; - IShellLinkW* pShellLink; - IPersistFile* pPersistFile; - - if (OS_IS_WINDOWS_9X(GetOsInfo()->OsType)) - { - char *a1, *a2, *a3, *a4, *a5, *a6; - a1 = CopyUniToStr(filename); - a2 = CopyUniToStr(target); - a3 = CopyUniToStr(workdir); - a4 = CopyUniToStr(args); - a5 = CopyUniToStr(icon); - a6 = CopyUniToStr(comment); - - ret = CreateLinkInnerA(a1, a2, a3, a4, a6, a5, icon_index); - - Free(a1); - Free(a2); - Free(a3); - Free(a4); - Free(a5); - Free(a6); - - return ret; - } - - r = CoCreateInstance(CLSID_ShellLink, NULL, CLSCTX_INPROC_SERVER, IID_IShellLinkW, (void **)&pShellLink); - if (FAILED(r)) - { - return false; - } - - r = pShellLink->QueryInterface(IID_IPersistFile,(void **)&pPersistFile); - if (FAILED(r)) - { - pShellLink->Release(); - return false; - } - - r = pShellLink->SetPath(target); - if (FAILED(r)) - { - pShellLink->Release(); - pPersistFile->Release(); - return false; - } - - if (workdir != NULL) - { - r = pShellLink->SetWorkingDirectory(workdir); - if (FAILED(r)) - { - pShellLink->Release(); - pPersistFile->Release(); - return false; - } - } - - if (comment != NULL) - { - r = pShellLink->SetDescription(comment); - if (FAILED(r)) - { - pShellLink->Release(); - pPersistFile->Release(); - return false; - } - } - - if (args != NULL) - { - r = pShellLink->SetArguments(args); - if (FAILED(r)) - { - pShellLink->Release(); - pPersistFile->Release(); - return false; - } - } - - if (icon != NULL) - { - r = pShellLink->SetIconLocation(icon, icon_index); - if (FAILED(r)) - { - pShellLink->Release(); - pPersistFile->Release(); - return false; - } - } - - r = pPersistFile->Save(filename, true); - if (FAILED(r)) - { - pShellLink->Release(); - pPersistFile->Release(); - return false; - } - - pShellLink->Release(); - pPersistFile->Release(); - return true; -} - -extern "C" -{ - -// Show the folder selection dialog -wchar_t *FolderDlgW(HWND hWnd, wchar_t *title, wchar_t *default_dir) -{ - wchar_t *ret; - - if (MsIsNt() == false) - { - char *default_dir_a = CopyUniToStr(default_dir); - char *ret_a = FolderDlgA(hWnd, title, default_dir_a); - - ret = CopyStrToUni(ret_a); - Free(ret_a); - Free(default_dir_a); - - return ret; - } - - ret = FolderDlgInnerW(hWnd, title, default_dir); - - return ret; -} -char *FolderDlgA(HWND hWnd, wchar_t *title, char *default_dir) -{ - char *ret; - - ret = FolderDlgInnerA(hWnd, title, default_dir); - - return ret; -} - -// Create a shortcut -bool CreateLink(wchar_t *filename, wchar_t *target, wchar_t *workdir, wchar_t *args, - wchar_t *comment, wchar_t *icon, UINT icon_index) -{ - if (filename == NULL || target == NULL) - { - return false; - } - - return CreateLinkInner(filename, target, workdir, args, comment, icon, icon_index); -} - -// Show the HTML -void ShowHtml(HWND hWnd, char *url, wchar_t *option) -{ - wchar_t tmp[MAX_SIZE]; - // Validate arguments - if (url == NULL || option == NULL) - { - return; - } - - StrToUni(tmp, sizeof(tmp), url); - - ShowHTMLDialogFromURL(hWnd, tmp, NULL, option, NULL); -} - -} - -#endif +// SoftEther VPN Source Code - Developer Edition Master Branch +// Cedar Communication Module + + +// Win32Com.c +// Win32 COM module call + +#include + +#ifdef WIN32 + +#define WIN32COM_CPP + +#define _WIN32_DCOM + +//#define _WIN32_WINNT 0x0502 +//#define WINVER 0x0502 +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "netcfgn.h" +#include +#include +#include +#include +#include +#include +#include +extern "C" +{ +#include +#include +} +#include "../PenCore/resource.h" + +// Add a UPnP port +bool Win32UPnPAddPort(UINT outside_port, UINT inside_port, bool udp, char *local_ip, wchar_t *description, bool remove_before_add) +{ + bool ret = false; + HRESULT hr; + IUPnPNAT *nat = NULL; + wchar_t ip_str[MAX_SIZE]; + BSTR bstr_ip, bstr_description, bstr_protocol; + const wchar_t *protocol_str = (udp ? L"UDP" : L"TCP"); + // Validate arguments + if (outside_port == 0 || outside_port >= 65536 || inside_port == 0 || inside_port >= 65536 || + IsEmptyStr(local_ip) || UniIsEmptyStr(description)) + { + return false; + } + + StrToUni(ip_str, sizeof(ip_str), local_ip); + bstr_ip = SysAllocString(ip_str); + bstr_description = SysAllocString(description); + bstr_protocol = SysAllocString(protocol_str); + + hr = CoCreateInstance(CLSID_UPnPNAT, NULL, CLSCTX_INPROC_SERVER, IID_IUPnPNAT, (void **)&nat); + + if (SUCCEEDED(hr)) + { + if (nat != NULL) + { + IStaticPortMappingCollection *collection = NULL; + hr = nat->get_StaticPortMappingCollection(&collection); + + if (SUCCEEDED(hr)) + { + if (collection != NULL) + { + IStaticPortMapping *mapping = NULL; + + if (remove_before_add) + { + hr = collection->Remove((long)outside_port, bstr_protocol); + } + + hr = collection->Add((long)outside_port, bstr_protocol, (long)inside_port, + bstr_ip, VARIANT_TRUE, bstr_description, &mapping); + + if (SUCCEEDED(hr)) + { + ret = true; + + if (mapping != NULL) + { + mapping->Release(); + } + } + + collection->Release(); + } + else + { + WHERE; + } + } + else + { + WHERE; + } + + nat->Release(); + } + else + { + WHERE; + } + } + else + { + WHERE; + } + + SysFreeString(bstr_ip); + SysFreeString(bstr_description); + SysFreeString(bstr_protocol); + + return ret; +} + +// Install the NDIS protocol driver +bool UninstallNdisProtocolDriver(wchar_t *id, UINT lock_timeout) +{ + bool ret = false; + HRESULT hr; + INetCfg *pNetCfg; + // Validate arguments + if (id == NULL) + { + return false; + } + + hr = CoCreateInstance(CLSID_CNetCfg, NULL, CLSCTX_INPROC_SERVER, IID_INetCfg, (void **)&pNetCfg); + + if (SUCCEEDED(hr)) + { + INetCfgLock *pLock; + + hr = pNetCfg->QueryInterface(IID_INetCfgLock, (PVOID*)&pLock); + + if (SUCCEEDED(hr)) + { + LPWSTR locked_by; + + hr = pLock->AcquireWriteLock(lock_timeout, L"SoftEther VPN", &locked_by); + + if (SUCCEEDED(hr)) + { + hr = pNetCfg->Initialize(NULL); + + if (SUCCEEDED(hr)) + { + INetCfgComponent *pncc = NULL; + + hr = pNetCfg->FindComponent(id, &pncc); + + if (pncc == NULL || hr == S_FALSE) + { + hr = E_FAIL; + } + + if (SUCCEEDED(hr)) + { + INetCfgClass *pncClass; + + hr = pNetCfg->QueryNetCfgClass(&GUID_DEVCLASS_NETTRANS, IID_INetCfgClass, (void **)&pncClass); + if (SUCCEEDED(hr)) + { + INetCfgClassSetup *pncClassSetup; + + hr = pncClass->QueryInterface(IID_INetCfgClassSetup, (void **)&pncClassSetup); + if (SUCCEEDED(hr)) + { + OBO_TOKEN obo; + wchar_t *c = NULL; + + Zero(&obo, sizeof(obo)); + + obo.Type = OBO_USER; + + hr = pncClassSetup->DeInstall(pncc, &obo, &c); + + if (SUCCEEDED(hr)) + { + hr = pNetCfg->Apply(); + + if (SUCCEEDED(hr)) + { + ret = true; + } + else + { + WHERE; + Debug("0x%x\n", hr); + } + } + else + { + WHERE; + Debug("0x%x\n", hr); + } + + pncClassSetup->Release(); + } + else + { + WHERE; + } + + pncClass->Release(); + } + else + { + WHERE; + } + + pncc->Release(); + } + else + { + WHERE; + } + } + else + { + WHERE; + } + + pLock->ReleaseWriteLock(); + } + else + { + WHERE; + } + + pLock->Release(); + } + + pNetCfg->Release(); + } + else + { + WHERE; + } + + return ret; +} + +// Install the NDIS protocol driver +bool InstallNdisProtocolDriver(wchar_t *inf_path, wchar_t *id, UINT lock_timeout) +{ + bool ret = false; + HRESULT hr; + INetCfg *pNetCfg; + HINSTANCE hSetupApiDll = NULL; + BOOL (WINAPI *_SetupCopyOEMInfW)(PCWSTR, PCWSTR, DWORD, DWORD, PWSTR, DWORD, PDWORD, PWSTR *) = NULL; + BOOL (WINAPI *_SetupUninstallOEMInfW)(PCWSTR, DWORD, PVOID) = NULL; + // Validate arguments + if (inf_path == NULL || id == NULL) + { + return false; + } + + hSetupApiDll = LoadLibraryA("setupapi.dll"); + if (hSetupApiDll == NULL) + { + WHERE; + goto LABEL_CLEANUP; + } + + _SetupCopyOEMInfW = + (UINT (__stdcall *)(PCWSTR,PCWSTR,DWORD,DWORD,PWSTR,DWORD,PDWORD,PWSTR *)) + GetProcAddress(hSetupApiDll, "SetupCopyOEMInfW"); + + _SetupUninstallOEMInfW = + (UINT (__stdcall *)(PCWSTR,DWORD,PVOID)) + GetProcAddress(hSetupApiDll, "SetupUninstallOEMInfW"); + + if (_SetupCopyOEMInfW == NULL || _SetupUninstallOEMInfW == NULL) + { + WHERE; + goto LABEL_CLEANUP; + } + + hr = CoCreateInstance(CLSID_CNetCfg, NULL, CLSCTX_INPROC_SERVER, IID_INetCfg, (void **)&pNetCfg); + + if (SUCCEEDED(hr)) + { + INetCfgLock *pLock; + + hr = pNetCfg->QueryInterface(IID_INetCfgLock, (PVOID*)&pLock); + + if (SUCCEEDED(hr)) + { + LPWSTR locked_by; + + hr = pLock->AcquireWriteLock(lock_timeout, L"SoftEther VPN", &locked_by); + + if (SUCCEEDED(hr)) + { + hr = pNetCfg->Initialize(NULL); + + if (SUCCEEDED(hr)) + { + wchar_t inf_dir[MAX_PATH]; + + GetDirNameFromFilePathW(inf_dir, sizeof(inf_dir), inf_path); + + if (_SetupCopyOEMInfW(inf_path, inf_dir, SPOST_PATH, 0, NULL, 0, NULL, 0)) + { + INetCfgClassSetup *pSetup; + + hr = pNetCfg->QueryNetCfgClass(&GUID_DEVCLASS_NETTRANS, IID_INetCfgClassSetup, (void **)&pSetup); + + if (SUCCEEDED(hr)) + { + OBO_TOKEN token; + INetCfgComponent *pComponent; + + Zero(&token, sizeof(token)); + + token.Type = OBO_USER; + + hr = pSetup->Install(id, &token, 0, 0, NULL, NULL, &pComponent); + + if (SUCCEEDED(hr)) + { + pNetCfg->Apply(); + + ret = true; + } + else + { + WHERE; + Debug("0x%x\n", hr); + } + + pSetup->Release(); + } + else + { + WHERE; + } + + if (ret == false) + { + wchar_t dst_inf_name[MAX_PATH]; + DWORD dst_inf_name_size = MAX_PATH; + + if (_SetupCopyOEMInfW(inf_path, inf_dir, SPOST_PATH, SP_COPY_REPLACEONLY, + dst_inf_name, dst_inf_name_size, &dst_inf_name_size, NULL) == false && + GetLastError() == ERROR_FILE_EXISTS) + { + _SetupUninstallOEMInfW(dst_inf_name, 0, NULL); + } + } + } + else + { + WHERE; + } + } + else + { + WHERE; + } + + pLock->ReleaseWriteLock(); + } + else + { + WHERE; + } + + pLock->Release(); + } + + pNetCfg->Release(); + } + else + { + WHERE; + } + +LABEL_CLEANUP: + + if (hSetupApiDll != NULL) + { + FreeLibrary(hSetupApiDll); + } + + return ret; +} + +typedef struct FOLDER_DLG_INNER_DATA +{ + wchar_t *default_dir; +} FOLDER_DLG_INNER_DATA; + +int CALLBACK FolderDlgInnerCallbackA(HWND hWnd, UINT msg, LPARAM lParam, LPARAM lData) +{ + FOLDER_DLG_INNER_DATA *data = (FOLDER_DLG_INNER_DATA *)lData; + LPITEMIDLIST pidl; + + switch (msg) + { + case BFFM_INITIALIZED: + if (data->default_dir != NULL) + { + char *default_dir_a = CopyUniToStr(data->default_dir); + + SendMessage(hWnd, BFFM_SETSELECTIONA, true, (LPARAM)default_dir_a); + + Free(default_dir_a); + } + break; + + case BFFM_SELCHANGED: + pidl = (LPITEMIDLIST)lParam; + + if (pidl) + { + char tmp[MAX_PATH]; + + Zero(tmp, sizeof(tmp)); + if (SHGetPathFromIDListA(pidl, tmp)) + { + SendMessage(hWnd, BFFM_ENABLEOK, 0, 1); + } + else + { + SendMessage(hWnd, BFFM_ENABLEOK, 0, 0); + } + } + break; + } + + return 0; +} + +char *FolderDlgInnerA(HWND hWnd, wchar_t *title, char *default_dir) +{ + BROWSEINFOA info; + char display_name[MAX_PATH]; + FOLDER_DLG_INNER_DATA data; + LPMALLOC pMalloc; + char *ret = NULL; + char *title_a; + if (UniIsEmptyStr(title)) + { + title = NULL; + } + if (IsEmptyStr(default_dir)) + { + default_dir = NULL; + } + + Zero(&data, sizeof(data)); + data.default_dir = CopyStrToUni(default_dir); + + Zero(display_name, sizeof(display_name)); + Zero(&info, sizeof(info)); + info.hwndOwner = hWnd; + info.pidlRoot = NULL; + info.pszDisplayName = display_name; + title_a = CopyUniToStr(title); + info.lpszTitle = title_a; + info.ulFlags = BIF_NEWDIALOGSTYLE | BIF_RETURNONLYFSDIRS | BIF_VALIDATE | BIF_SHAREABLE; + info.lpfn = FolderDlgInnerCallbackA; + info.lParam = (LPARAM)&data; + + if (SUCCEEDED(SHGetMalloc(&pMalloc))) + { + LPITEMIDLIST pidl; + + pidl = SHBrowseForFolderA(&info); + + if (pidl) + { + char tmp[MAX_PATH]; + + if (SHGetPathFromIDListA(pidl, tmp)) + { + ret = CopyStr(tmp); + } + + pMalloc->Free(pidl); + } + + pMalloc->Release(); + } + + Free(data.default_dir); + Free(title_a); + + return ret; +} + +int CALLBACK FolderDlgInnerCallbackW(HWND hWnd, UINT msg, LPARAM lParam, LPARAM lData) +{ + FOLDER_DLG_INNER_DATA *data = (FOLDER_DLG_INNER_DATA *)lData; + LPITEMIDLIST pidl; + + switch (msg) + { + case BFFM_INITIALIZED: + if (data->default_dir != NULL) + { + SendMessage(hWnd, BFFM_SETSELECTIONW, true, (LPARAM)data->default_dir); + } + break; + + case BFFM_SELCHANGED: + pidl = (LPITEMIDLIST)lParam; + + if (pidl) + { + wchar_t tmp[MAX_PATH]; + + Zero(tmp, sizeof(tmp)); + if (SHGetPathFromIDListW(pidl, tmp)) + { + SendMessage(hWnd, BFFM_ENABLEOK, 0, 1); + } + else + { + SendMessage(hWnd, BFFM_ENABLEOK, 0, 0); + } + } + break; + } + + return 0; +} + +wchar_t *FolderDlgInnerW(HWND hWnd, wchar_t *title, wchar_t *default_dir) +{ + BROWSEINFOW info; + wchar_t display_name[MAX_PATH]; + FOLDER_DLG_INNER_DATA data; + LPMALLOC pMalloc; + wchar_t *ret = NULL; + if (UniIsEmptyStr(title)) + { + title = NULL; + } + if (UniIsEmptyStr(default_dir)) + { + default_dir = NULL; + } + + Zero(&data, sizeof(data)); + data.default_dir = default_dir; + + Zero(display_name, sizeof(display_name)); + Zero(&info, sizeof(info)); + info.hwndOwner = hWnd; + info.pidlRoot = NULL; + info.pszDisplayName = display_name; + info.lpszTitle = title; + info.ulFlags = BIF_NEWDIALOGSTYLE | BIF_RETURNONLYFSDIRS | BIF_VALIDATE | BIF_SHAREABLE; + info.lpfn = FolderDlgInnerCallbackW; + info.lParam = (LPARAM)&data; + + if (SUCCEEDED(SHGetMalloc(&pMalloc))) + { + LPITEMIDLIST pidl; + + pidl = SHBrowseForFolderW(&info); + + if (pidl) + { + wchar_t tmp[MAX_PATH]; + + if (SHGetPathFromIDListW(pidl, tmp)) + { + ret = CopyUniStr(tmp); + } + + pMalloc->Free(pidl); + } + + pMalloc->Release(); + } + + return ret; +} + + +class CModule +{ +public: + CModule() + { + m_hInstLib = NULL; + } + CModule( HINSTANCE hInstLib ) + { + m_hInstLib = NULL; + this->Attach( hInstLib ); + } + CModule( LPCTSTR pszModuleName ) + { + m_hInstLib = NULL; + this->LoadLibrary( pszModuleName ); + } + virtual ~CModule() + { + this->FreeLibrary(); + } + +public: + BOOL Attach( HINSTANCE hInstLib ) + { + this->FreeLibrary(); + m_hInstLib = hInstLib; + + return TRUE; + } + BOOL Detach() + { + m_hInstLib = NULL; + + return TRUE; + } + +public: + HMODULE GetHandle() + { + return m_hInstLib; + } + // Load the DLL + HINSTANCE LoadLibrary( LPCTSTR pszModuleName ) + { + this->FreeLibrary(); + m_hInstLib = ::LoadLibrary( pszModuleName ); + + return m_hInstLib; + } + // Release the DLL + BOOL FreeLibrary() + { + if (m_hInstLib == NULL) + { + return FALSE; + } + + BOOL bResult = ::FreeLibrary( m_hInstLib ); + m_hInstLib = NULL; + + return bResult; + } + // Get the address of the function + FARPROC GetProcAddress( LPCTSTR pszProcName ) + { + if (m_hInstLib == NULL) + { + return NULL; + } + + return ::GetProcAddress(m_hInstLib, pszProcName); + } + // Get a handle to the information block of resource with the specified name and the type + HRSRC FindResource(LPCTSTR lpName, LPCTSTR lpType) + { + if (m_hInstLib == NULL) + { + return NULL; + } + + return ::FindResource(m_hInstLib, lpName, lpType); + } + // Load the specified resource + HGLOBAL LoadResource(HRSRC hResInfo) + { + if (m_hInstLib == NULL) + { + return NULL; + } + + return ::LoadResource(m_hInstLib, hResInfo); + } + +protected: + HINSTANCE m_hInstLib; +}; + + + +static HRESULT _ShowHTMLDialog( + HWND hwndParent, + IMoniker* pMk, + VARIANT* pvarArgIn = NULL, + WCHAR* pchOptions = NULL, + VARIANT* pvarArgOut = NULL) +{ + HRESULT hr = S_OK; + + try + { + CModule Module("MSHTML.DLL"); + if (Module.GetHandle() == NULL) + { + return E_FAIL; + } + + SHOWHTMLDIALOGFN* fnShowHTMLDialog = + (SHOWHTMLDIALOGFN*)Module.GetProcAddress("ShowHTMLDialog"); + if (fnShowHTMLDialog == NULL) + { + return E_FAIL; + } + + hr = (*fnShowHTMLDialog)(hwndParent, pMk, pvarArgIn, pchOptions, pvarArgOut); + if (FAILED(hr)) + { + return hr; + } + } + catch (...) + { + return E_FAIL; + } + + return hr; +} + +HRESULT ShowHTMLDialogFromURL(HWND hwndParent,wchar_t *szURL,VARIANT* pvarArgIn,WCHAR* pchOptions,VARIANT* pvarArgOut) +{ + HRESULT hr = S_OK; + + try + { + IMonikerPtr spMoniker; + hr = ::CreateURLMoniker(NULL, szURL, &spMoniker); + if (FAILED(hr)) + { + return hr; + } + + hr = ::_ShowHTMLDialog(hwndParent, spMoniker, pvarArgIn, pchOptions, pvarArgOut); + if (FAILED(hr)) + { + return hr; + } + } + catch (...) + { + return E_FAIL; + } + + return hr; +} + +// Create a shortcut +bool CreateLinkInnerA(char *filename, char *target, char *workdir, char *args, + char *comment, char *icon, UINT icon_index) +{ + HRESULT r; + wchar_t tmp[MAX_SIZE]; + IShellLinkA* pShellLink; + IPersistFile* pPersistFile; + + r = CoCreateInstance(CLSID_ShellLink, NULL, CLSCTX_INPROC_SERVER, IID_IShellLinkA, (void **)&pShellLink); + if (FAILED(r)) + { + return false; + } + + r = pShellLink->QueryInterface(IID_IPersistFile,(void **)&pPersistFile); + if (FAILED(r)) + { + pShellLink->Release(); + return false; + } + + r = pShellLink->SetPath(target); + if (FAILED(r)) + { + pShellLink->Release(); + pPersistFile->Release(); + return false; + } + + if (workdir != NULL) + { + r = pShellLink->SetWorkingDirectory(workdir); + if (FAILED(r)) + { + pShellLink->Release(); + pPersistFile->Release(); + return false; + } + } + + if (args != NULL) + { + r = pShellLink->SetArguments(args); + if (FAILED(r)) + { + pShellLink->Release(); + pPersistFile->Release(); + return false; + } + } + + if (comment != NULL) + { + r = pShellLink->SetDescription(comment); + if (FAILED(r)) + { + pShellLink->Release(); + pPersistFile->Release(); + return false; + } + } + + if (icon != NULL) + { + r = pShellLink->SetIconLocation(icon, icon_index); + if (FAILED(r)) + { + pShellLink->Release(); + pPersistFile->Release(); + return false; + } + } + + StrToUni(tmp, sizeof(tmp), filename); + r = pPersistFile->Save(tmp, true); + if (FAILED(r)) + { + pShellLink->Release(); + pPersistFile->Release(); + return false; + } + + pShellLink->Release(); + pPersistFile->Release(); + return true; +} +bool CreateLinkInner(wchar_t *filename, wchar_t *target, wchar_t *workdir, wchar_t *args, + wchar_t *comment, wchar_t *icon, UINT icon_index) +{ + HRESULT r; + bool ret; + IShellLinkW* pShellLink; + IPersistFile* pPersistFile; + + if (OS_IS_WINDOWS_9X(GetOsInfo()->OsType)) + { + char *a1, *a2, *a3, *a4, *a5, *a6; + a1 = CopyUniToStr(filename); + a2 = CopyUniToStr(target); + a3 = CopyUniToStr(workdir); + a4 = CopyUniToStr(args); + a5 = CopyUniToStr(icon); + a6 = CopyUniToStr(comment); + + ret = CreateLinkInnerA(a1, a2, a3, a4, a6, a5, icon_index); + + Free(a1); + Free(a2); + Free(a3); + Free(a4); + Free(a5); + Free(a6); + + return ret; + } + + r = CoCreateInstance(CLSID_ShellLink, NULL, CLSCTX_INPROC_SERVER, IID_IShellLinkW, (void **)&pShellLink); + if (FAILED(r)) + { + return false; + } + + r = pShellLink->QueryInterface(IID_IPersistFile,(void **)&pPersistFile); + if (FAILED(r)) + { + pShellLink->Release(); + return false; + } + + r = pShellLink->SetPath(target); + if (FAILED(r)) + { + pShellLink->Release(); + pPersistFile->Release(); + return false; + } + + if (workdir != NULL) + { + r = pShellLink->SetWorkingDirectory(workdir); + if (FAILED(r)) + { + pShellLink->Release(); + pPersistFile->Release(); + return false; + } + } + + if (comment != NULL) + { + r = pShellLink->SetDescription(comment); + if (FAILED(r)) + { + pShellLink->Release(); + pPersistFile->Release(); + return false; + } + } + + if (args != NULL) + { + r = pShellLink->SetArguments(args); + if (FAILED(r)) + { + pShellLink->Release(); + pPersistFile->Release(); + return false; + } + } + + if (icon != NULL) + { + r = pShellLink->SetIconLocation(icon, icon_index); + if (FAILED(r)) + { + pShellLink->Release(); + pPersistFile->Release(); + return false; + } + } + + r = pPersistFile->Save(filename, true); + if (FAILED(r)) + { + pShellLink->Release(); + pPersistFile->Release(); + return false; + } + + pShellLink->Release(); + pPersistFile->Release(); + return true; +} + +extern "C" +{ + +// Show the folder selection dialog +wchar_t *FolderDlgW(HWND hWnd, wchar_t *title, wchar_t *default_dir) +{ + wchar_t *ret; + + if (MsIsNt() == false) + { + char *default_dir_a = CopyUniToStr(default_dir); + char *ret_a = FolderDlgA(hWnd, title, default_dir_a); + + ret = CopyStrToUni(ret_a); + Free(ret_a); + Free(default_dir_a); + + return ret; + } + + ret = FolderDlgInnerW(hWnd, title, default_dir); + + return ret; +} +char *FolderDlgA(HWND hWnd, wchar_t *title, char *default_dir) +{ + char *ret; + + ret = FolderDlgInnerA(hWnd, title, default_dir); + + return ret; +} + +// Create a shortcut +bool CreateLink(wchar_t *filename, wchar_t *target, wchar_t *workdir, wchar_t *args, + wchar_t *comment, wchar_t *icon, UINT icon_index) +{ + if (filename == NULL || target == NULL) + { + return false; + } + + return CreateLinkInner(filename, target, workdir, args, comment, icon, icon_index); +} + +// Show the HTML +void ShowHtml(HWND hWnd, char *url, wchar_t *option) +{ + wchar_t tmp[MAX_SIZE]; + // Validate arguments + if (url == NULL || option == NULL) + { + return; + } + + StrToUni(tmp, sizeof(tmp), url); + + ShowHTMLDialogFromURL(hWnd, tmp, NULL, option, NULL); +} + +} + +#endif diff --git a/src/Cedar/Win32Com.h b/src/Cedar/Win32Com.h index 1bf12477..8c55f179 100644 --- a/src/Cedar/Win32Com.h +++ b/src/Cedar/Win32Com.h @@ -1,322 +1,322 @@ -// SoftEther VPN Source Code - Developer Edition Master Branch -// Cedar Communication Module - - -// Win32Com.h -// Header of Win32Com.c - -#ifndef WIN32COM_H -#define WIN32COM_H - -#ifdef WIN32COM_CPP - -// Internal function - -#endif // WIN32COM_CPP - -// For external function - -#pragma comment(lib,"htmlhelp.lib") -#pragma comment(lib,"Urlmon.lib") - -#if defined(__cplusplus) -extern "C" -{ -#endif - - void ShowHtml(HWND hWnd, char *url, wchar_t *option); - bool CreateLink(wchar_t *filename, wchar_t *target, wchar_t *workdir, wchar_t *args, - wchar_t *comment, wchar_t *icon, UINT icon_index); - wchar_t *FolderDlgW(HWND hWnd, wchar_t *title, wchar_t *default_dir); - char *FolderDlgA(HWND hWnd, wchar_t *title, char *default_dir); - - bool InstallNdisProtocolDriver(wchar_t *inf_path, wchar_t *id, UINT lock_timeout); - bool UninstallNdisProtocolDriver(wchar_t *id, UINT lock_timeout); - - bool Win32UPnPAddPort(UINT outside_port, UINT inside_port, bool udp, char *local_ip, wchar_t *description, bool remove_before_add); - - ////////////////////////////////////////////////////////////////////////// - //JumpList - - //Application ID for VPN Client Manager - #define APPID_CM GC_UI_APPID_CM - - typedef void* JL_PCustomDestinationList; - typedef void* JL_PObjectArray; - typedef void* JL_PShellLink; - typedef void* JL_PObjectCollection; - typedef long JL_HRESULT; - - JL_HRESULT JL_CreateCustomDestinationList(JL_PCustomDestinationList* poc, wchar_t* appID); - JL_HRESULT JL_ReleaseCustomDestinationList(JL_PCustomDestinationList poc); - - JL_HRESULT JL_BeginList(JL_PCustomDestinationList poc, JL_PObjectArray* oaRemoved); - JL_HRESULT JL_CommitList(JL_PCustomDestinationList cdl); - - - JL_HRESULT JL_CreateObjectCollection(JL_PObjectCollection* poc); - JL_HRESULT JL_ReleaseObjectCollection(JL_PObjectCollection poc); - JL_HRESULT JL_ObjectCollectionAddShellLink(JL_PObjectCollection poc, JL_PShellLink ppsl); - - JL_HRESULT JL_AddCategoryToList(JL_PCustomDestinationList pcdl, - JL_PObjectCollection poc, - wchar_t* categoryName, - JL_PObjectArray poaRemoved); - JL_HRESULT JL_DeleteJumpList(JL_PCustomDestinationList jpcdl,wchar_t* appID); - - - JL_HRESULT JL_CreateShellLink( - wchar_t* pszPath, - wchar_t* pszArguments, - wchar_t* pszTitle, - wchar_t* iconLocation, - int iconIndex, - wchar_t* description, JL_PShellLink *ppsl); - JL_HRESULT JL_ReleaseShellLink(JL_PShellLink ppsl); - - - //SetApplicationID for Windows 7 - JL_HRESULT JL_SetCurrentProcessExplicitAppUserModelID(wchar_t* appID); - - - //JL_HRESULT JL_AddTasksToList(JL_PCustomDestinationList pcdl, JL_PObjectCollection poc); - - ////////////////////////////////////////////////////////////////////////// - //DrawImage - // - - #if defined(__cplusplus) - -typedef UCHAR ct_uchar; -typedef char ct_char; - -#define ct_max(a,b) (((a) > (b)) ? (a): (b)) -#define ct_min(a,b) (((a) < (b)) ? (a): (b)) -#define ct_clamp(n,mi,ma) (ct_max(ct_min((n),(ma)),(mi))) -#define ct_clamp01(n) ct_clamp(n,0,1) - -/** -* Union representing 32-bit color with alpha channel. -* CT_Color32, CT_AHSV32, CT_AYCbCr32 are also the same. -* -*/ -typedef union CT_ARGB32 -{ -public: - - /** 32-bit integer intensity */ - UINT ARGB; - - /** RGB Color System */ - struct - { - ct_uchar B; - ct_uchar G; - ct_uchar R; - ct_uchar A; - }; - - /** HSV Color System */ - struct HSVA - { - ct_uchar V; - ct_uchar S; - ct_uchar H; - ct_uchar A; - }HSVA; - - /** YCbCr Color System */ - struct YCbCrA - { - ct_uchar Y; - ct_char Cb; - ct_char Cr; - ct_uchar A; - }YCbCrA; - - - /** Default constructor */ - CT_ARGB32(){} - - /** Constructor to initialize by specified color. - * @param a Alpha channel - * @param r Red, Hue, Cr - * @param g Green, Saturation, Cb - * @param b Blue, Value, Y - */ - CT_ARGB32(ct_uchar a,ct_uchar r,ct_uchar g,ct_uchar b) - { - A = a; - R = r; - G = g; - B = b; - } - - - -}CT_ARGB32; - - -class CT_Size -{ -public: - int Width; - int Height; - - CT_Size(int w, int h) - { - Width = w; - Height = h; - } -}; - -class CT_Rect -{ -public: - int X; - int Y; - int Width; - int Height; - - CT_Rect() - { - X = 0; - Y = 0; - Width = 0; - Height = 0; - } - - CT_Rect(int x, int y,int w, int h) - { - X = x; - Y = y; - Width = w; - Height = h; - } - - int Right(){return X + Width;} - int Bottom(){return Y + Height;} - - void Right(int r){ Width = r - X;} - void Bottom(int b){ Height = b - Y;} - -}; - - - -#endif //__cplusplus - -typedef struct CT_RectF_c -{ - float X; - float Y; - float Width; - float Height; -} CT_RectF_c; - -void CT_DrawImage(UCHAR* dest, CT_RectF_c destRect, int destWidth, int destHeight, - UCHAR* src, CT_RectF_c srcRect, int srcWidth, int srcHeight); - - - -#if defined(__cplusplus) -} -#endif - - -//EXTERN_C const IID IID_IObjectCollection; -//EXTERN_C const IID IID_ICustomDestinationList; - -#if defined(__cplusplus) - - -#ifndef __IObjectArray_INTERFACE_DEFINED__ -#define __IObjectArray_INTERFACE_DEFINED__ - -MIDL_INTERFACE("92CA9DCD-5622-4bba-A805-5E9F541BD8C9") -IObjectArray : public IUnknown -{ -public: - virtual HRESULT STDMETHODCALLTYPE GetCount( - /* [out] */ __RPC__out UINT *pcObjects) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetAt( - /* [in] */ UINT uiIndex, - /* [in] */ __RPC__in REFIID riid, - /* [iid_is][out] */ __RPC__deref_out_opt void **ppv) = 0; - -}; - -MIDL_INTERFACE("5632b1a4-e38a-400a-928a-d4cd63230295") -IObjectCollection : public IObjectArray -{ -public: - virtual HRESULT STDMETHODCALLTYPE AddObject( - /* [in] */ __RPC__in_opt IUnknown *punk) = 0; - - virtual HRESULT STDMETHODCALLTYPE AddFromArray( - /* [in] */ __RPC__in_opt IObjectArray *poaSource) = 0; - - virtual HRESULT STDMETHODCALLTYPE RemoveObjectAt( - /* [in] */ UINT uiIndex) = 0; - - virtual HRESULT STDMETHODCALLTYPE Clear( void) = 0; - -}; - -#endif // __IObjectArray_INTERFACE_DEFINED__ - -#ifndef __ICustomDestinationList_INTERFACE_DEFINED__ -#define __ICustomDestinationList_INTERFACE_DEFINED__ - -typedef /* [v1_enum] */ -enum KNOWNDESTCATEGORY -{ - KDC_FREQUENT = 1, - KDC_RECENT = ( KDC_FREQUENT + 1 ) -} KNOWNDESTCATEGORY; - -MIDL_INTERFACE("6332debf-87b5-4670-90c0-5e57b408a49e") -ICustomDestinationList : public IUnknown -{ -public: - virtual HRESULT STDMETHODCALLTYPE SetAppID( - /* [string][in] */ __RPC__in_string LPCWSTR pszAppID) = 0; - - virtual HRESULT STDMETHODCALLTYPE BeginList( - /* [out] */ __RPC__out UINT *pcMinSlots, - /* [in] */ __RPC__in REFIID riid, - /* [iid_is][out] */ __RPC__deref_out_opt void **ppv) = 0; - - virtual HRESULT STDMETHODCALLTYPE AppendCategory( - /* [string][in] */ __RPC__in_string LPCWSTR pszCategory, - /* [in] */ __RPC__in_opt IObjectArray *poa) = 0; - - virtual HRESULT STDMETHODCALLTYPE AppendKnownCategory( - /* [in] */ KNOWNDESTCATEGORY category) = 0; - - virtual HRESULT STDMETHODCALLTYPE AddUserTasks( - /* [in] */ __RPC__in_opt IObjectArray *poa) = 0; - - virtual HRESULT STDMETHODCALLTYPE CommitList( void) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetRemovedDestinations( - /* [in] */ __RPC__in REFIID riid, - /* [iid_is][out] */ __RPC__deref_out_opt void **ppv) = 0; - - virtual HRESULT STDMETHODCALLTYPE DeleteList( - /* [string][unique][in] */ __RPC__in_opt_string LPCWSTR pszAppID) = 0; - - virtual HRESULT STDMETHODCALLTYPE AbortList( void) = 0; - -}; - - -#endif // __ICustomDestinationList_INTERFACE_DEFINED__ - - -#endif //defined(__cplusplus) - - - -#endif // WIN32COM_H +// SoftEther VPN Source Code - Developer Edition Master Branch +// Cedar Communication Module + + +// Win32Com.h +// Header of Win32Com.c + +#ifndef WIN32COM_H +#define WIN32COM_H + +#ifdef WIN32COM_CPP + +// Internal function + +#endif // WIN32COM_CPP + +// For external function + +#pragma comment(lib,"htmlhelp.lib") +#pragma comment(lib,"Urlmon.lib") + +#if defined(__cplusplus) +extern "C" +{ +#endif + + void ShowHtml(HWND hWnd, char *url, wchar_t *option); + bool CreateLink(wchar_t *filename, wchar_t *target, wchar_t *workdir, wchar_t *args, + wchar_t *comment, wchar_t *icon, UINT icon_index); + wchar_t *FolderDlgW(HWND hWnd, wchar_t *title, wchar_t *default_dir); + char *FolderDlgA(HWND hWnd, wchar_t *title, char *default_dir); + + bool InstallNdisProtocolDriver(wchar_t *inf_path, wchar_t *id, UINT lock_timeout); + bool UninstallNdisProtocolDriver(wchar_t *id, UINT lock_timeout); + + bool Win32UPnPAddPort(UINT outside_port, UINT inside_port, bool udp, char *local_ip, wchar_t *description, bool remove_before_add); + + ////////////////////////////////////////////////////////////////////////// + //JumpList + + //Application ID for VPN Client Manager + #define APPID_CM GC_UI_APPID_CM + + typedef void* JL_PCustomDestinationList; + typedef void* JL_PObjectArray; + typedef void* JL_PShellLink; + typedef void* JL_PObjectCollection; + typedef long JL_HRESULT; + + JL_HRESULT JL_CreateCustomDestinationList(JL_PCustomDestinationList* poc, wchar_t* appID); + JL_HRESULT JL_ReleaseCustomDestinationList(JL_PCustomDestinationList poc); + + JL_HRESULT JL_BeginList(JL_PCustomDestinationList poc, JL_PObjectArray* oaRemoved); + JL_HRESULT JL_CommitList(JL_PCustomDestinationList cdl); + + + JL_HRESULT JL_CreateObjectCollection(JL_PObjectCollection* poc); + JL_HRESULT JL_ReleaseObjectCollection(JL_PObjectCollection poc); + JL_HRESULT JL_ObjectCollectionAddShellLink(JL_PObjectCollection poc, JL_PShellLink ppsl); + + JL_HRESULT JL_AddCategoryToList(JL_PCustomDestinationList pcdl, + JL_PObjectCollection poc, + wchar_t* categoryName, + JL_PObjectArray poaRemoved); + JL_HRESULT JL_DeleteJumpList(JL_PCustomDestinationList jpcdl,wchar_t* appID); + + + JL_HRESULT JL_CreateShellLink( + wchar_t* pszPath, + wchar_t* pszArguments, + wchar_t* pszTitle, + wchar_t* iconLocation, + int iconIndex, + wchar_t* description, JL_PShellLink *ppsl); + JL_HRESULT JL_ReleaseShellLink(JL_PShellLink ppsl); + + + //SetApplicationID for Windows 7 + JL_HRESULT JL_SetCurrentProcessExplicitAppUserModelID(wchar_t* appID); + + + //JL_HRESULT JL_AddTasksToList(JL_PCustomDestinationList pcdl, JL_PObjectCollection poc); + + ////////////////////////////////////////////////////////////////////////// + //DrawImage + // + + #if defined(__cplusplus) + +typedef UCHAR ct_uchar; +typedef char ct_char; + +#define ct_max(a,b) (((a) > (b)) ? (a): (b)) +#define ct_min(a,b) (((a) < (b)) ? (a): (b)) +#define ct_clamp(n,mi,ma) (ct_max(ct_min((n),(ma)),(mi))) +#define ct_clamp01(n) ct_clamp(n,0,1) + +/** +* Union representing 32-bit color with alpha channel. +* CT_Color32, CT_AHSV32, CT_AYCbCr32 are also the same. +* +*/ +typedef union CT_ARGB32 +{ +public: + + /** 32-bit integer intensity */ + UINT ARGB; + + /** RGB Color System */ + struct + { + ct_uchar B; + ct_uchar G; + ct_uchar R; + ct_uchar A; + }; + + /** HSV Color System */ + struct HSVA + { + ct_uchar V; + ct_uchar S; + ct_uchar H; + ct_uchar A; + }HSVA; + + /** YCbCr Color System */ + struct YCbCrA + { + ct_uchar Y; + ct_char Cb; + ct_char Cr; + ct_uchar A; + }YCbCrA; + + + /** Default constructor */ + CT_ARGB32(){} + + /** Constructor to initialize by specified color. + * @param a Alpha channel + * @param r Red, Hue, Cr + * @param g Green, Saturation, Cb + * @param b Blue, Value, Y + */ + CT_ARGB32(ct_uchar a,ct_uchar r,ct_uchar g,ct_uchar b) + { + A = a; + R = r; + G = g; + B = b; + } + + + +}CT_ARGB32; + + +class CT_Size +{ +public: + int Width; + int Height; + + CT_Size(int w, int h) + { + Width = w; + Height = h; + } +}; + +class CT_Rect +{ +public: + int X; + int Y; + int Width; + int Height; + + CT_Rect() + { + X = 0; + Y = 0; + Width = 0; + Height = 0; + } + + CT_Rect(int x, int y,int w, int h) + { + X = x; + Y = y; + Width = w; + Height = h; + } + + int Right(){return X + Width;} + int Bottom(){return Y + Height;} + + void Right(int r){ Width = r - X;} + void Bottom(int b){ Height = b - Y;} + +}; + + + +#endif //__cplusplus + +typedef struct CT_RectF_c +{ + float X; + float Y; + float Width; + float Height; +} CT_RectF_c; + +void CT_DrawImage(UCHAR* dest, CT_RectF_c destRect, int destWidth, int destHeight, + UCHAR* src, CT_RectF_c srcRect, int srcWidth, int srcHeight); + + + +#if defined(__cplusplus) +} +#endif + + +//EXTERN_C const IID IID_IObjectCollection; +//EXTERN_C const IID IID_ICustomDestinationList; + +#if defined(__cplusplus) + + +#ifndef __IObjectArray_INTERFACE_DEFINED__ +#define __IObjectArray_INTERFACE_DEFINED__ + +MIDL_INTERFACE("92CA9DCD-5622-4bba-A805-5E9F541BD8C9") +IObjectArray : public IUnknown +{ +public: + virtual HRESULT STDMETHODCALLTYPE GetCount( + /* [out] */ __RPC__out UINT *pcObjects) = 0; + + virtual HRESULT STDMETHODCALLTYPE GetAt( + /* [in] */ UINT uiIndex, + /* [in] */ __RPC__in REFIID riid, + /* [iid_is][out] */ __RPC__deref_out_opt void **ppv) = 0; + +}; + +MIDL_INTERFACE("5632b1a4-e38a-400a-928a-d4cd63230295") +IObjectCollection : public IObjectArray +{ +public: + virtual HRESULT STDMETHODCALLTYPE AddObject( + /* [in] */ __RPC__in_opt IUnknown *punk) = 0; + + virtual HRESULT STDMETHODCALLTYPE AddFromArray( + /* [in] */ __RPC__in_opt IObjectArray *poaSource) = 0; + + virtual HRESULT STDMETHODCALLTYPE RemoveObjectAt( + /* [in] */ UINT uiIndex) = 0; + + virtual HRESULT STDMETHODCALLTYPE Clear( void) = 0; + +}; + +#endif // __IObjectArray_INTERFACE_DEFINED__ + +#ifndef __ICustomDestinationList_INTERFACE_DEFINED__ +#define __ICustomDestinationList_INTERFACE_DEFINED__ + +typedef /* [v1_enum] */ +enum KNOWNDESTCATEGORY +{ + KDC_FREQUENT = 1, + KDC_RECENT = ( KDC_FREQUENT + 1 ) +} KNOWNDESTCATEGORY; + +MIDL_INTERFACE("6332debf-87b5-4670-90c0-5e57b408a49e") +ICustomDestinationList : public IUnknown +{ +public: + virtual HRESULT STDMETHODCALLTYPE SetAppID( + /* [string][in] */ __RPC__in_string LPCWSTR pszAppID) = 0; + + virtual HRESULT STDMETHODCALLTYPE BeginList( + /* [out] */ __RPC__out UINT *pcMinSlots, + /* [in] */ __RPC__in REFIID riid, + /* [iid_is][out] */ __RPC__deref_out_opt void **ppv) = 0; + + virtual HRESULT STDMETHODCALLTYPE AppendCategory( + /* [string][in] */ __RPC__in_string LPCWSTR pszCategory, + /* [in] */ __RPC__in_opt IObjectArray *poa) = 0; + + virtual HRESULT STDMETHODCALLTYPE AppendKnownCategory( + /* [in] */ KNOWNDESTCATEGORY category) = 0; + + virtual HRESULT STDMETHODCALLTYPE AddUserTasks( + /* [in] */ __RPC__in_opt IObjectArray *poa) = 0; + + virtual HRESULT STDMETHODCALLTYPE CommitList( void) = 0; + + virtual HRESULT STDMETHODCALLTYPE GetRemovedDestinations( + /* [in] */ __RPC__in REFIID riid, + /* [iid_is][out] */ __RPC__deref_out_opt void **ppv) = 0; + + virtual HRESULT STDMETHODCALLTYPE DeleteList( + /* [string][unique][in] */ __RPC__in_opt_string LPCWSTR pszAppID) = 0; + + virtual HRESULT STDMETHODCALLTYPE AbortList( void) = 0; + +}; + + +#endif // __ICustomDestinationList_INTERFACE_DEFINED__ + + +#endif //defined(__cplusplus) + + + +#endif // WIN32COM_H diff --git a/src/Cedar/WinJumpList.cpp b/src/Cedar/WinJumpList.cpp index 8ccc736d..2b4c544c 100644 --- a/src/Cedar/WinJumpList.cpp +++ b/src/Cedar/WinJumpList.cpp @@ -1,679 +1,679 @@ -// SoftEther VPN Source Code - Developer Edition Master Branch -// Cedar Communication Module - - -// WinJumpList.cpp -// HTML display module source code for Win32 - -#include - -#ifdef WIN32 - -//#define NTDDI_WIN7 0x06010000 -//#define _WIN32_WINNT _WIN32_WINNT_VISTA -//#define NTDDI_VERSION NTDDI_VISTA // Specifies that the minimum required platform is Windows 7. -#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers -#define STRICT_TYPED_ITEMIDS // Utilize strictly typed IDLists - -//#include -#include -#include -#include -//#include -//#include - - -#ifdef StrCpy -#undef StrCpy -#endif - -#ifdef StrCat -#undef StrCat -#endif - -#ifdef StrCmp -#undef StrCmp -#endif - - -#define WIN32COM_CPP - -//#define _WIN32_WINNT 0x0502 -//#define WINVER 0x0502 -#include -#include -#include -#include -#include -#include -//#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -extern "C" -{ -#include -#include -} -#include "../PenCore/resource.h" - -extern "C" -{ - - ////////////////////////////////////////////////////////////////////////// - //JumpList - //#define NTDDI_WIN7 0x06010000 - //#define NTDDI_VERSION NTDDI_WIN7 // Specifies that the minimum required platform is Windows 7. - //#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers - //#define STRICT_TYPED_ITEMIDS // Utilize strictly typed IDLists - // - // - //#include - //#include - //#include - //#include - //#include - // - //#pragma comment(lib, "propsys.lib") - //#pragma comment(lib, "shlwapi.lib") - - #define CREATE_PROPERTYKEY(l, w1, w2, b1, b2, b3, b4, b5, b6, b7, b8, pid) { { l, w1, w2, { b1, b2, b3, b4, b5, b6, b7, b8 } }, pid } - - - // Determines if the provided IShellItem is listed in the array of items that the user has removed - bool _IsItemInArray(IShellItem *psi, IObjectArray *poaRemoved) - { - bool fRet = false; - UINT cItems; - if (SUCCEEDED(poaRemoved->GetCount(&cItems))) - { - IShellItem *psiCompare; - for (UINT i = 0; !fRet && i < cItems; i++) - { - if (SUCCEEDED(poaRemoved->GetAt(i, IID_PPV_ARGS(&psiCompare)))) - { - int iOrder; - fRet = SUCCEEDED(psiCompare->Compare(psi, SICHINT_CANONICAL, &iOrder)) && (0 == iOrder); - psiCompare->Release(); - } - } - } - return fRet; - } - - - JL_HRESULT JL_CreateCustomDestinationList(JL_PCustomDestinationList* poc, wchar_t* appID) - { - ICustomDestinationList *pcdl; - - //CLSID_DestinationList = 6332DEBF-87B5-4670-90C0-5E57-B408-A49E - - GUID destList; - - destList.Data1 = 2012286192; - destList.Data2 = 15797; - destList.Data3 = 18790; - - destList.Data4[0] = 181; - destList.Data4[1] = 32; - destList.Data4[2] = 183; - destList.Data4[3] = 197; - destList.Data4[4] = 79; - destList.Data4[5] = 211; - destList.Data4[6] = 94; - destList.Data4[7] = 214; - - //destList = CLSID_DestinationList; - - //HRESULT hr = CoCreateInstance(CLSID_DestinationList, NULL, CLSCTX_INPROC_SERVER, IID_PPV_ARGS(&pcdl)); - HRESULT hr = CoCreateInstance(destList, - NULL, CLSCTX_INPROC_SERVER, IID_PPV_ARGS(&pcdl)); - - if (SUCCEEDED(hr)) - { - pcdl->SetAppID(appID); - (*poc) = (void*)pcdl; - } - else - { - (*poc) = NULL; - } - - return hr; - } - - JL_HRESULT JL_ReleaseCustomDestinationList(JL_PCustomDestinationList poc) - { - ICustomDestinationList *pcdl = (ICustomDestinationList*)poc; - if(pcdl != NULL) - { - pcdl->Release(); - } - - return 0; - } - - JL_HRESULT JL_BeginList(JL_PCustomDestinationList poc, JL_PObjectArray* oaRemoved) - { - UINT cMinSlots; - IObjectArray *poaRemoved; - - ICustomDestinationList *pcdl = (ICustomDestinationList*)poc; - - HRESULT hr = pcdl->BeginList(&cMinSlots, IID_PPV_ARGS(&poaRemoved)); - - (*oaRemoved) = poaRemoved; - - return hr; - } - - JL_HRESULT JL_CommitList(JL_PCustomDestinationList cdl) - { - ICustomDestinationList *pcdl = (ICustomDestinationList*)cdl; - - return pcdl->CommitList(); - } - - - //JL_HRESULT JL_AddTasksToList(JL_PCustomDestinationList pcdl, JL_PObjectCollection poc) - //{ - // return 0; - //} - - JL_HRESULT JL_CreateObjectCollection(JL_PObjectCollection* jpoc) - { - - //CLSID_EnumerableObjectCollection = 2D3468C1-36A7-43B6-AC24-D3F0-2FD9-607A - - - GUID enumObjCol; - - enumObjCol.Data1 = 758409409; - enumObjCol.Data2 = 13991; - enumObjCol.Data3 = 17334; - - enumObjCol.Data4[0] = 172; - enumObjCol.Data4[1] = 36; - enumObjCol.Data4[2] = 211; - enumObjCol.Data4[3] = 240; - enumObjCol.Data4[4] = 47; - enumObjCol.Data4[5] = 217; - enumObjCol.Data4[6] = 96; - enumObjCol.Data4[7] = 122; - - //enumObjCol = CLSID_EnumerableObjectCollection; - - IObjectCollection *poc; - //HRESULT hr = CoCreateInstance(CLSID_EnumerableObjectCollection, NULL, CLSCTX_INPROC, IID_PPV_ARGS(&poc)); - HRESULT hr = CoCreateInstance(enumObjCol, - NULL, CLSCTX_INPROC, IID_PPV_ARGS(&poc)); - - if (SUCCEEDED(hr)) - { - (*jpoc) = poc; - } - else{ - (*jpoc) = NULL; - } - return hr; - } - - JL_HRESULT JL_ReleaseObjectCollection(JL_PObjectCollection jpoc) - { - IObjectCollection *poc = (IObjectCollection *)jpoc; - if(poc != NULL) - { - return poc->Release(); - } - - return 0; - } - - JL_HRESULT JL_ObjectCollectionAddShellLink(JL_PObjectCollection jpoc, JL_PShellLink jpsl) - { - IObjectCollection *poc = (IObjectCollection *)jpoc; - IShellLink *psl = (IShellLink *) jpsl; - - return poc->AddObject(psl); - - } - - - JL_HRESULT JL_AddCategoryToList(JL_PCustomDestinationList jpcdl, - JL_PObjectCollection jpoc, - wchar_t* categoryName, - JL_PObjectArray jpoaRemoved) - { - ICustomDestinationList *pcdl = (ICustomDestinationList*)jpcdl; - IObjectCollection *poc = (IObjectCollection *)jpoc; - IObjectArray *poaRemoved = (IObjectArray*)jpoaRemoved; - - //for (UINT i = 0; i < ARRAYSIZE(c_rgpszFiles); i++) - //{ - // IShellItem *psi; - // if (SUCCEEDED(SHCreateItemInKnownFolder(FOLDERID_Documents, KF_FLAG_DEFAULT, c_rgpszFiles[i], IID_PPV_ARGS(&psi)))) - // { - // // Items listed in the removed list may not be re-added to the Jump List during this - // // list-building transaction. They should not be re-added to the Jump List until - // // the user has used the item again. The AppendCategory call below will fail if - // // an attempt to add an item in the removed list is made. - // if (!_IsItemInArray(psi, poaRemoved)) - // { - // poc->AddObject(psi); - // } - // psi->Release(); - // } - //} - - IObjectArray *poa; - HRESULT hr = poc->QueryInterface(IID_PPV_ARGS(&poa)); - if (SUCCEEDED(hr)) - { - - // Add the category to the Jump List. If there were more categories, they would appear - // from top to bottom in the order they were appended. - hr = pcdl->AppendCategory(categoryName, poa); - //hr = pcdl->AddUserTasks(poa); - poa->Release(); - - if (SUCCEEDED(hr)) - { - } - else - { - Print("Failed AppendCategory\n"); - } - } - else - { - Print("Failed QueryInterface\n"); - } - - - return hr; - } - - - - JL_HRESULT JL_CreateShellLink( - wchar_t* pszPath, - wchar_t* pszArguments, - wchar_t* pszTitle, - wchar_t* iconLocation, - int iconIndex, - wchar_t* description, JL_PShellLink *ppsl) - { - IShellLinkW *psl; - HRESULT hr = CoCreateInstance(CLSID_ShellLink, NULL, CLSCTX_INPROC_SERVER, IID_PPV_ARGS(&psl)); - if (SUCCEEDED(hr)) - { - // Determine our executable's file path so the task will execute this application - //WCHAR szAppPath[MAX_PATH]; - //if (GetModuleFileName(NULL, szAppPath, ARRAYSIZE(szAppPath))) - //{ - //hr = psl->SetPath(L"C:\\Program Files\\PacketiX VPN Client\\vpncmgr.exe"); - //hr = psl->SetArguments(L"50792311B00B9E01E7534AAA881087AB2BB83A1F"); - - - psl->SetPath(pszPath); - psl->SetArguments(pszArguments); - if(iconLocation != NULL) - { - psl->SetIconLocation(iconLocation,iconIndex); - } - - if(description != NULL) - { - psl->SetDescription(description); - } - if (SUCCEEDED(hr)) - { - // The title property is required on Jump List items provided as an IShellLink - // instance. This value is used as the display name in the Jump List. - IPropertyStore *pps; - hr = psl->QueryInterface(IID_PPV_ARGS(&pps)); - if (SUCCEEDED(hr)) - { - PROPVARIANT propvar; - hr = InitPropVariantFromString(pszTitle, &propvar); - if (SUCCEEDED(hr)) - { - - ////PKEY_Title - //#define DEFINE_PROPERTYKEY(name, l, w1, w2, b1, b2, b3, b4, b5, b6, b7, b8, pid) - //EXTERN_C const PROPERTYKEY DECLSPEC_SELECTANY name - // = { { l, w1, w2, { b1, b2, b3, b4, b5, b6, b7, b8 } }, pid } - //DEFINE_PROPERTYKEY(PKEY_Title, 0xF29F85E0, 0x4FF9, 0x1068, 0xAB, 0x91, 0x08, 0x00, 0x2B, 0x27, 0xB3, 0xD9, 2); - - PROPERTYKEY pkey_title = - CREATE_PROPERTYKEY(0xF29F85E0, 0x4FF9, 0x1068, 0xAB, 0x91, 0x08, 0x00, 0x2B, 0x27, 0xB3, 0xD9, 2); - - - //hr = pps->SetValue(PKEY_Title, propvar); - hr = pps->SetValue(pkey_title, propvar); - - - if (SUCCEEDED(hr)) - { - hr = pps->Commit(); - if (SUCCEEDED(hr)) - { - IShellLink *tpsl; - hr = psl->QueryInterface(IID_PPV_ARGS(&tpsl)); - (*ppsl) = tpsl; - } - } - PropVariantClear(&propvar); - } - pps->Release(); - } - } - - /* - hr = psl->SetPath(szAppPath); - if (SUCCEEDED(hr)) - { - hr = psl->SetArguments(pszArguments); - if (SUCCEEDED(hr)) - { - // The title property is required on Jump List items provided as an IShellLink - // instance. This value is used as the display name in the Jump List. - IPropertyStore *pps; - hr = psl->QueryInterface(IID_PPV_ARGS(&pps)); - if (SUCCEEDED(hr)) - { - PROPVARIANT propvar; - hr = InitPropVariantFromString(pszTitle, &propvar); - if (SUCCEEDED(hr)) - { - hr = pps->SetValue(PKEY_Title, propvar); - if (SUCCEEDED(hr)) - { - hr = pps->Commit(); - if (SUCCEEDED(hr)) - { - hr = psl->QueryInterface(IID_PPV_ARGS(ppsl)); - } - } - PropVariantClear(&propvar); - } - pps->Release(); - } - } - } - */ - //} - //else - //{ - // hr = HRESULT_FROM_WIN32(GetLastError()); - //} - psl->Release(); - } - return hr; - } - - JL_HRESULT JL_ReleaseShellLink(JL_PShellLink jpsl) - { - IShellLink *psl = (IShellLink *) jpsl; - - if(psl != NULL) - { - return psl->Release(); - } - - return 0; - } - - // Removes that existing custom Jump List for this application. - JL_HRESULT JL_DeleteJumpList(JL_PCustomDestinationList jpcdl,wchar_t* appID) - { - ICustomDestinationList *pcdl = (ICustomDestinationList *)jpcdl; - //HRESULT hr = CoCreateInstance(CLSID_DestinationList, NULL, CLSCTX_INPROC_SERVER, IID_PPV_ARGS(&pcdl)); - - HRESULT hr = pcdl->DeleteList(appID); - - - return hr; - } - - - - ////////////////////////////////////////////////////////////////////////// - //SetApplicationID for Windows 7 - JL_HRESULT JL_SetCurrentProcessExplicitAppUserModelID(wchar_t* appID) - { -#ifdef UNICODE - HMODULE hModule = LoadLibraryW( L"shell32.dll"); -#else - HMODULE hModule = LoadLibraryA( "shell32.dll"); -#endif - HRESULT (__stdcall *SetAppID) (PCWSTR); - - if( hModule == NULL ) - { - //// Load failure (there is no DLL) - // MessageBoxW( NULL, L"shell32.dll not found", L"Error", MB_OK ); - Print("Not Found shell32.dll"); - } - else - { - // Get the address of the function in the DLL - SetAppID = (HRESULT (__stdcall *)(PCWSTR)) - GetProcAddress( hModule, "SetCurrentProcessExplicitAppUserModelID" ); - if( SetAppID != NULL ) - { - FreeLibrary( hModule ); - return SetAppID(appID); - } - else - { - //MessageBoxW( NULL, L"There may not be a function", L"Error", MB_OK ); - Print("Not Found SetCurrentProcessExplicitAppUserModelID"); - - } - - // Release the loaded DLL - FreeLibrary( hModule ); - } - return 0; - - - } - - - -} - -#endif - -////////////////////////////////////////////////////////////////////////// -// Size Rect -// - -CT_Rect GetBoundingRect(CT_RectF_c* rect) -{ - CT_Rect r = CT_Rect((int)rect->X,(int)rect->Y,(int)rect->Width,(int)rect->Height); - if(r.Right() < (rect->X + rect->Width)) - r.Width+=1; - if(r.Bottom() < (rect->Y + rect->Height)) - r.Height+=1; - - return r; -} - - -CT_ARGB32 CT_GetAAPix32(UCHAR* srcPtr, int width, int height, int xFix, int yFix); - -////////////////////////////////////////////////////////////////////////// -// DrawImage method -void CT_DrawImage(UCHAR* dest, CT_RectF_c destRect, int destWidth, int destHeight, - UCHAR* src, CT_RectF_c srcRect, int srcWidth, int srcHeight) -{ - - double scaleW = destRect.Width / srcRect.Width; - double scaleH = destRect.Height / srcRect.Height; - - - CT_ARGB32* dest32 = (CT_ARGB32*)(dest); - CT_ARGB32* src32 = (CT_ARGB32*)(src); - - float dfx = (float)(1 / scaleW); - float dfy = (float)(1 / scaleH); - - float srcSX = srcRect.X; - float srcSY = srcRect.Y; - - int srcSXFix = (int)(srcSX*65536); - int srcSYFix = (int)(srcSY*65536); - int dfxFix = (int)(dfx*65536); - int dfyFix = (int)(dfy*65536); - - //CT_Rect dRect = destRect.GetBoundingRect(); - - CT_Rect dRect = GetBoundingRect(&destRect); - - // Clipping not supported: ToDo - dRect.X = ct_max(0,dRect.X); - dRect.Y = ct_max(0,dRect.Y); - dRect.Right((int)ct_min(destRect.X + destRect.Width,dRect.Right())); - dRect.Bottom((int)ct_min(destRect.Y + destRect.Height,dRect.Bottom())); - - //CT_ARGB32* dPix = dest32->GetPixelAddressNC(dRect.X, dRect.Y); - CT_ARGB32* dPix = &(dest32[destWidth*dRect.Y + dRect.X]); - - //int dpW = dest32->GetWidth() - dRect.Width; - int dpW = destWidth - dRect.Width; - for (int dy = dRect.Y; dy < dRect.Bottom(); dy++) - { - - int syFix = srcSYFix; - int sxFix = srcSXFix; - - // Anti-aliasing - for (int dx = dRect.X; dx < dRect.Right(); dx++) - { - int rPixX = ( ((sxFix >> 15) & 0x00000001) == 1) ? (sxFix >> 16)+1 : (sxFix >> 16); - int rPixY = ( ((syFix >> 15) & 0x00000001) == 1) ? (syFix >> 16)+1 : (syFix >> 16); - - //CT_ARGB32* sPix = &(src32[rPixY * srcWidth + rPixX]); - - //*dPix = *sPix; - //if(sPix != NULL) - { - //*dPix = src32->GetAAPix32(sxFix,syFix); - *dPix = CT_GetAAPix32((UCHAR*)src32, srcWidth, srcHeight,sxFix, syFix); - } - - sxFix += dfxFix; - dPix++; - } - - - srcSYFix += dfyFix; - dPix += dpW; - } - -} - -bool isWhiteColor(CT_ARGB32 col) -{ - return - (col.R == 255 && - col.G == 255 && - col.B == 255); -} - - -CT_ARGB32 CT_GetAAPix32(UCHAR* srcPtr, int width, int height, int xFix, int yFix) -{ - - //return CT_ARGB32(255,255,255,255); - - //CT_Bitmap32* src = this; - CT_ARGB32* src = (CT_ARGB32*)(srcPtr); - - int fixx = xFix; - int fixy = yFix; - - int fx = (fixx >> 8) & 0xFF; - int fy = (fixy >> 8) & 0xFF; - - int f[4]; - f[0] = ((255 - fx) * (255 - fy)) >> 8; - f[1] = (fx * (255 - fy)) >> 8; - f[2] = ((255 - fx) * fy) >> 8; - f[3] = (fx * fy) >> 8; - - int px = fixx >> 16; - int py = fixy >> 16; - - int a, r, g, b; - a = r = g = b = 0; - CT_Size size = CT_Size(width, height); - CT_ARGB32 col = CT_ARGB32(0,255,255,255); - - CT_ARGB32 pixs[4]; - for(int j = 0; j < 2; j++) - { - for (int i = 0; i < 2; i++) - { - int sx = px + i; - int sy = py + j; - - CT_ARGB32* c; - - if(sx < 0 || sx >= width || sy < 0 || sy >= height) - { - c = &col; - } - else - { - //c = src->GetPixelAddressNC(sx, sy); - c = &(src[sy * width + sx]); - } - pixs[j*2+i] = *c; - - a += c->A * f[j*2 + i]; - r += c->R * f[j*2 + i]; - g += c->G * f[j*2 + i]; - b += c->B * f[j*2 + i]; - - } - } - - bool isAllWhite = true; - for(int k = 0; k < 4; k++) - { - if(!isWhiteColor(pixs[k])) - { - isAllWhite = false; - break; - } - } - - if(isAllWhite) - { - // - return CT_ARGB32(0, 255, 255, 255); - } - else - { - a = a >> 8; - r = r >> 8; - g = g >> 8; - b = b >> 8; - - return CT_ARGB32(a, r, g, b); - } - -} - -// - +// SoftEther VPN Source Code - Developer Edition Master Branch +// Cedar Communication Module + + +// WinJumpList.cpp +// HTML display module source code for Win32 + +#include + +#ifdef WIN32 + +//#define NTDDI_WIN7 0x06010000 +//#define _WIN32_WINNT _WIN32_WINNT_VISTA +//#define NTDDI_VERSION NTDDI_VISTA // Specifies that the minimum required platform is Windows 7. +#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers +#define STRICT_TYPED_ITEMIDS // Utilize strictly typed IDLists + +//#include +#include +#include +#include +//#include +//#include + + +#ifdef StrCpy +#undef StrCpy +#endif + +#ifdef StrCat +#undef StrCat +#endif + +#ifdef StrCmp +#undef StrCmp +#endif + + +#define WIN32COM_CPP + +//#define _WIN32_WINNT 0x0502 +//#define WINVER 0x0502 +#include +#include +#include +#include +#include +#include +//#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +extern "C" +{ +#include +#include +} +#include "../PenCore/resource.h" + +extern "C" +{ + + ////////////////////////////////////////////////////////////////////////// + //JumpList + //#define NTDDI_WIN7 0x06010000 + //#define NTDDI_VERSION NTDDI_WIN7 // Specifies that the minimum required platform is Windows 7. + //#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers + //#define STRICT_TYPED_ITEMIDS // Utilize strictly typed IDLists + // + // + //#include + //#include + //#include + //#include + //#include + // + //#pragma comment(lib, "propsys.lib") + //#pragma comment(lib, "shlwapi.lib") + + #define CREATE_PROPERTYKEY(l, w1, w2, b1, b2, b3, b4, b5, b6, b7, b8, pid) { { l, w1, w2, { b1, b2, b3, b4, b5, b6, b7, b8 } }, pid } + + + // Determines if the provided IShellItem is listed in the array of items that the user has removed + bool _IsItemInArray(IShellItem *psi, IObjectArray *poaRemoved) + { + bool fRet = false; + UINT cItems; + if (SUCCEEDED(poaRemoved->GetCount(&cItems))) + { + IShellItem *psiCompare; + for (UINT i = 0; !fRet && i < cItems; i++) + { + if (SUCCEEDED(poaRemoved->GetAt(i, IID_PPV_ARGS(&psiCompare)))) + { + int iOrder; + fRet = SUCCEEDED(psiCompare->Compare(psi, SICHINT_CANONICAL, &iOrder)) && (0 == iOrder); + psiCompare->Release(); + } + } + } + return fRet; + } + + + JL_HRESULT JL_CreateCustomDestinationList(JL_PCustomDestinationList* poc, wchar_t* appID) + { + ICustomDestinationList *pcdl; + + //CLSID_DestinationList = 6332DEBF-87B5-4670-90C0-5E57-B408-A49E + + GUID destList; + + destList.Data1 = 2012286192; + destList.Data2 = 15797; + destList.Data3 = 18790; + + destList.Data4[0] = 181; + destList.Data4[1] = 32; + destList.Data4[2] = 183; + destList.Data4[3] = 197; + destList.Data4[4] = 79; + destList.Data4[5] = 211; + destList.Data4[6] = 94; + destList.Data4[7] = 214; + + //destList = CLSID_DestinationList; + + //HRESULT hr = CoCreateInstance(CLSID_DestinationList, NULL, CLSCTX_INPROC_SERVER, IID_PPV_ARGS(&pcdl)); + HRESULT hr = CoCreateInstance(destList, + NULL, CLSCTX_INPROC_SERVER, IID_PPV_ARGS(&pcdl)); + + if (SUCCEEDED(hr)) + { + pcdl->SetAppID(appID); + (*poc) = (void*)pcdl; + } + else + { + (*poc) = NULL; + } + + return hr; + } + + JL_HRESULT JL_ReleaseCustomDestinationList(JL_PCustomDestinationList poc) + { + ICustomDestinationList *pcdl = (ICustomDestinationList*)poc; + if(pcdl != NULL) + { + pcdl->Release(); + } + + return 0; + } + + JL_HRESULT JL_BeginList(JL_PCustomDestinationList poc, JL_PObjectArray* oaRemoved) + { + UINT cMinSlots; + IObjectArray *poaRemoved; + + ICustomDestinationList *pcdl = (ICustomDestinationList*)poc; + + HRESULT hr = pcdl->BeginList(&cMinSlots, IID_PPV_ARGS(&poaRemoved)); + + (*oaRemoved) = poaRemoved; + + return hr; + } + + JL_HRESULT JL_CommitList(JL_PCustomDestinationList cdl) + { + ICustomDestinationList *pcdl = (ICustomDestinationList*)cdl; + + return pcdl->CommitList(); + } + + + //JL_HRESULT JL_AddTasksToList(JL_PCustomDestinationList pcdl, JL_PObjectCollection poc) + //{ + // return 0; + //} + + JL_HRESULT JL_CreateObjectCollection(JL_PObjectCollection* jpoc) + { + + //CLSID_EnumerableObjectCollection = 2D3468C1-36A7-43B6-AC24-D3F0-2FD9-607A + + + GUID enumObjCol; + + enumObjCol.Data1 = 758409409; + enumObjCol.Data2 = 13991; + enumObjCol.Data3 = 17334; + + enumObjCol.Data4[0] = 172; + enumObjCol.Data4[1] = 36; + enumObjCol.Data4[2] = 211; + enumObjCol.Data4[3] = 240; + enumObjCol.Data4[4] = 47; + enumObjCol.Data4[5] = 217; + enumObjCol.Data4[6] = 96; + enumObjCol.Data4[7] = 122; + + //enumObjCol = CLSID_EnumerableObjectCollection; + + IObjectCollection *poc; + //HRESULT hr = CoCreateInstance(CLSID_EnumerableObjectCollection, NULL, CLSCTX_INPROC, IID_PPV_ARGS(&poc)); + HRESULT hr = CoCreateInstance(enumObjCol, + NULL, CLSCTX_INPROC, IID_PPV_ARGS(&poc)); + + if (SUCCEEDED(hr)) + { + (*jpoc) = poc; + } + else{ + (*jpoc) = NULL; + } + return hr; + } + + JL_HRESULT JL_ReleaseObjectCollection(JL_PObjectCollection jpoc) + { + IObjectCollection *poc = (IObjectCollection *)jpoc; + if(poc != NULL) + { + return poc->Release(); + } + + return 0; + } + + JL_HRESULT JL_ObjectCollectionAddShellLink(JL_PObjectCollection jpoc, JL_PShellLink jpsl) + { + IObjectCollection *poc = (IObjectCollection *)jpoc; + IShellLink *psl = (IShellLink *) jpsl; + + return poc->AddObject(psl); + + } + + + JL_HRESULT JL_AddCategoryToList(JL_PCustomDestinationList jpcdl, + JL_PObjectCollection jpoc, + wchar_t* categoryName, + JL_PObjectArray jpoaRemoved) + { + ICustomDestinationList *pcdl = (ICustomDestinationList*)jpcdl; + IObjectCollection *poc = (IObjectCollection *)jpoc; + IObjectArray *poaRemoved = (IObjectArray*)jpoaRemoved; + + //for (UINT i = 0; i < ARRAYSIZE(c_rgpszFiles); i++) + //{ + // IShellItem *psi; + // if (SUCCEEDED(SHCreateItemInKnownFolder(FOLDERID_Documents, KF_FLAG_DEFAULT, c_rgpszFiles[i], IID_PPV_ARGS(&psi)))) + // { + // // Items listed in the removed list may not be re-added to the Jump List during this + // // list-building transaction. They should not be re-added to the Jump List until + // // the user has used the item again. The AppendCategory call below will fail if + // // an attempt to add an item in the removed list is made. + // if (!_IsItemInArray(psi, poaRemoved)) + // { + // poc->AddObject(psi); + // } + // psi->Release(); + // } + //} + + IObjectArray *poa; + HRESULT hr = poc->QueryInterface(IID_PPV_ARGS(&poa)); + if (SUCCEEDED(hr)) + { + + // Add the category to the Jump List. If there were more categories, they would appear + // from top to bottom in the order they were appended. + hr = pcdl->AppendCategory(categoryName, poa); + //hr = pcdl->AddUserTasks(poa); + poa->Release(); + + if (SUCCEEDED(hr)) + { + } + else + { + Print("Failed AppendCategory\n"); + } + } + else + { + Print("Failed QueryInterface\n"); + } + + + return hr; + } + + + + JL_HRESULT JL_CreateShellLink( + wchar_t* pszPath, + wchar_t* pszArguments, + wchar_t* pszTitle, + wchar_t* iconLocation, + int iconIndex, + wchar_t* description, JL_PShellLink *ppsl) + { + IShellLinkW *psl; + HRESULT hr = CoCreateInstance(CLSID_ShellLink, NULL, CLSCTX_INPROC_SERVER, IID_PPV_ARGS(&psl)); + if (SUCCEEDED(hr)) + { + // Determine our executable's file path so the task will execute this application + //WCHAR szAppPath[MAX_PATH]; + //if (GetModuleFileName(NULL, szAppPath, ARRAYSIZE(szAppPath))) + //{ + //hr = psl->SetPath(L"C:\\Program Files\\PacketiX VPN Client\\vpncmgr.exe"); + //hr = psl->SetArguments(L"50792311B00B9E01E7534AAA881087AB2BB83A1F"); + + + psl->SetPath(pszPath); + psl->SetArguments(pszArguments); + if(iconLocation != NULL) + { + psl->SetIconLocation(iconLocation,iconIndex); + } + + if(description != NULL) + { + psl->SetDescription(description); + } + if (SUCCEEDED(hr)) + { + // The title property is required on Jump List items provided as an IShellLink + // instance. This value is used as the display name in the Jump List. + IPropertyStore *pps; + hr = psl->QueryInterface(IID_PPV_ARGS(&pps)); + if (SUCCEEDED(hr)) + { + PROPVARIANT propvar; + hr = InitPropVariantFromString(pszTitle, &propvar); + if (SUCCEEDED(hr)) + { + + ////PKEY_Title + //#define DEFINE_PROPERTYKEY(name, l, w1, w2, b1, b2, b3, b4, b5, b6, b7, b8, pid) + //EXTERN_C const PROPERTYKEY DECLSPEC_SELECTANY name + // = { { l, w1, w2, { b1, b2, b3, b4, b5, b6, b7, b8 } }, pid } + //DEFINE_PROPERTYKEY(PKEY_Title, 0xF29F85E0, 0x4FF9, 0x1068, 0xAB, 0x91, 0x08, 0x00, 0x2B, 0x27, 0xB3, 0xD9, 2); + + PROPERTYKEY pkey_title = + CREATE_PROPERTYKEY(0xF29F85E0, 0x4FF9, 0x1068, 0xAB, 0x91, 0x08, 0x00, 0x2B, 0x27, 0xB3, 0xD9, 2); + + + //hr = pps->SetValue(PKEY_Title, propvar); + hr = pps->SetValue(pkey_title, propvar); + + + if (SUCCEEDED(hr)) + { + hr = pps->Commit(); + if (SUCCEEDED(hr)) + { + IShellLink *tpsl; + hr = psl->QueryInterface(IID_PPV_ARGS(&tpsl)); + (*ppsl) = tpsl; + } + } + PropVariantClear(&propvar); + } + pps->Release(); + } + } + + /* + hr = psl->SetPath(szAppPath); + if (SUCCEEDED(hr)) + { + hr = psl->SetArguments(pszArguments); + if (SUCCEEDED(hr)) + { + // The title property is required on Jump List items provided as an IShellLink + // instance. This value is used as the display name in the Jump List. + IPropertyStore *pps; + hr = psl->QueryInterface(IID_PPV_ARGS(&pps)); + if (SUCCEEDED(hr)) + { + PROPVARIANT propvar; + hr = InitPropVariantFromString(pszTitle, &propvar); + if (SUCCEEDED(hr)) + { + hr = pps->SetValue(PKEY_Title, propvar); + if (SUCCEEDED(hr)) + { + hr = pps->Commit(); + if (SUCCEEDED(hr)) + { + hr = psl->QueryInterface(IID_PPV_ARGS(ppsl)); + } + } + PropVariantClear(&propvar); + } + pps->Release(); + } + } + } + */ + //} + //else + //{ + // hr = HRESULT_FROM_WIN32(GetLastError()); + //} + psl->Release(); + } + return hr; + } + + JL_HRESULT JL_ReleaseShellLink(JL_PShellLink jpsl) + { + IShellLink *psl = (IShellLink *) jpsl; + + if(psl != NULL) + { + return psl->Release(); + } + + return 0; + } + + // Removes that existing custom Jump List for this application. + JL_HRESULT JL_DeleteJumpList(JL_PCustomDestinationList jpcdl,wchar_t* appID) + { + ICustomDestinationList *pcdl = (ICustomDestinationList *)jpcdl; + //HRESULT hr = CoCreateInstance(CLSID_DestinationList, NULL, CLSCTX_INPROC_SERVER, IID_PPV_ARGS(&pcdl)); + + HRESULT hr = pcdl->DeleteList(appID); + + + return hr; + } + + + + ////////////////////////////////////////////////////////////////////////// + //SetApplicationID for Windows 7 + JL_HRESULT JL_SetCurrentProcessExplicitAppUserModelID(wchar_t* appID) + { +#ifdef UNICODE + HMODULE hModule = LoadLibraryW( L"shell32.dll"); +#else + HMODULE hModule = LoadLibraryA( "shell32.dll"); +#endif + HRESULT (__stdcall *SetAppID) (PCWSTR); + + if( hModule == NULL ) + { + //// Load failure (there is no DLL) + // MessageBoxW( NULL, L"shell32.dll not found", L"Error", MB_OK ); + Print("Not Found shell32.dll"); + } + else + { + // Get the address of the function in the DLL + SetAppID = (HRESULT (__stdcall *)(PCWSTR)) + GetProcAddress( hModule, "SetCurrentProcessExplicitAppUserModelID" ); + if( SetAppID != NULL ) + { + FreeLibrary( hModule ); + return SetAppID(appID); + } + else + { + //MessageBoxW( NULL, L"There may not be a function", L"Error", MB_OK ); + Print("Not Found SetCurrentProcessExplicitAppUserModelID"); + + } + + // Release the loaded DLL + FreeLibrary( hModule ); + } + return 0; + + + } + + + +} + +#endif + +////////////////////////////////////////////////////////////////////////// +// Size Rect +// + +CT_Rect GetBoundingRect(CT_RectF_c* rect) +{ + CT_Rect r = CT_Rect((int)rect->X,(int)rect->Y,(int)rect->Width,(int)rect->Height); + if(r.Right() < (rect->X + rect->Width)) + r.Width+=1; + if(r.Bottom() < (rect->Y + rect->Height)) + r.Height+=1; + + return r; +} + + +CT_ARGB32 CT_GetAAPix32(UCHAR* srcPtr, int width, int height, int xFix, int yFix); + +////////////////////////////////////////////////////////////////////////// +// DrawImage method +void CT_DrawImage(UCHAR* dest, CT_RectF_c destRect, int destWidth, int destHeight, + UCHAR* src, CT_RectF_c srcRect, int srcWidth, int srcHeight) +{ + + double scaleW = destRect.Width / srcRect.Width; + double scaleH = destRect.Height / srcRect.Height; + + + CT_ARGB32* dest32 = (CT_ARGB32*)(dest); + CT_ARGB32* src32 = (CT_ARGB32*)(src); + + float dfx = (float)(1 / scaleW); + float dfy = (float)(1 / scaleH); + + float srcSX = srcRect.X; + float srcSY = srcRect.Y; + + int srcSXFix = (int)(srcSX*65536); + int srcSYFix = (int)(srcSY*65536); + int dfxFix = (int)(dfx*65536); + int dfyFix = (int)(dfy*65536); + + //CT_Rect dRect = destRect.GetBoundingRect(); + + CT_Rect dRect = GetBoundingRect(&destRect); + + // Clipping not supported: ToDo + dRect.X = ct_max(0,dRect.X); + dRect.Y = ct_max(0,dRect.Y); + dRect.Right((int)ct_min(destRect.X + destRect.Width,dRect.Right())); + dRect.Bottom((int)ct_min(destRect.Y + destRect.Height,dRect.Bottom())); + + //CT_ARGB32* dPix = dest32->GetPixelAddressNC(dRect.X, dRect.Y); + CT_ARGB32* dPix = &(dest32[destWidth*dRect.Y + dRect.X]); + + //int dpW = dest32->GetWidth() - dRect.Width; + int dpW = destWidth - dRect.Width; + for (int dy = dRect.Y; dy < dRect.Bottom(); dy++) + { + + int syFix = srcSYFix; + int sxFix = srcSXFix; + + // Anti-aliasing + for (int dx = dRect.X; dx < dRect.Right(); dx++) + { + int rPixX = ( ((sxFix >> 15) & 0x00000001) == 1) ? (sxFix >> 16)+1 : (sxFix >> 16); + int rPixY = ( ((syFix >> 15) & 0x00000001) == 1) ? (syFix >> 16)+1 : (syFix >> 16); + + //CT_ARGB32* sPix = &(src32[rPixY * srcWidth + rPixX]); + + //*dPix = *sPix; + //if(sPix != NULL) + { + //*dPix = src32->GetAAPix32(sxFix,syFix); + *dPix = CT_GetAAPix32((UCHAR*)src32, srcWidth, srcHeight,sxFix, syFix); + } + + sxFix += dfxFix; + dPix++; + } + + + srcSYFix += dfyFix; + dPix += dpW; + } + +} + +bool isWhiteColor(CT_ARGB32 col) +{ + return + (col.R == 255 && + col.G == 255 && + col.B == 255); +} + + +CT_ARGB32 CT_GetAAPix32(UCHAR* srcPtr, int width, int height, int xFix, int yFix) +{ + + //return CT_ARGB32(255,255,255,255); + + //CT_Bitmap32* src = this; + CT_ARGB32* src = (CT_ARGB32*)(srcPtr); + + int fixx = xFix; + int fixy = yFix; + + int fx = (fixx >> 8) & 0xFF; + int fy = (fixy >> 8) & 0xFF; + + int f[4]; + f[0] = ((255 - fx) * (255 - fy)) >> 8; + f[1] = (fx * (255 - fy)) >> 8; + f[2] = ((255 - fx) * fy) >> 8; + f[3] = (fx * fy) >> 8; + + int px = fixx >> 16; + int py = fixy >> 16; + + int a, r, g, b; + a = r = g = b = 0; + CT_Size size = CT_Size(width, height); + CT_ARGB32 col = CT_ARGB32(0,255,255,255); + + CT_ARGB32 pixs[4]; + for(int j = 0; j < 2; j++) + { + for (int i = 0; i < 2; i++) + { + int sx = px + i; + int sy = py + j; + + CT_ARGB32* c; + + if(sx < 0 || sx >= width || sy < 0 || sy >= height) + { + c = &col; + } + else + { + //c = src->GetPixelAddressNC(sx, sy); + c = &(src[sy * width + sx]); + } + pixs[j*2+i] = *c; + + a += c->A * f[j*2 + i]; + r += c->R * f[j*2 + i]; + g += c->G * f[j*2 + i]; + b += c->B * f[j*2 + i]; + + } + } + + bool isAllWhite = true; + for(int k = 0; k < 4; k++) + { + if(!isWhiteColor(pixs[k])) + { + isAllWhite = false; + break; + } + } + + if(isAllWhite) + { + // + return CT_ARGB32(0, 255, 255, 255); + } + else + { + a = a >> 8; + r = r >> 8; + g = g >> 8; + b = b >> 8; + + return CT_ARGB32(a, r, g, b); + } + +} + +// + diff --git a/src/Cedar/WinUi.c b/src/Cedar/WinUi.c index a32287f7..25212c80 100644 --- a/src/Cedar/WinUi.c +++ b/src/Cedar/WinUi.c @@ -1,10245 +1,10245 @@ -// SoftEther VPN Source Code - Developer Edition Master Branch -// Cedar Communication Module - - -// WinUi.c -// User interface code for Win32 - -#include - -#ifdef WIN32 - -#define WINUI_C - -#define _WIN32_WINNT 0x0502 -#define WINVER 0x0502 -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "../PenCore/resource.h" - -char cached_pin_code[MAX_SIZE] = {0}; -UINT64 cached_pin_code_expires = 0; - -static HINSTANCE hDll = NULL; -static wchar_t *title_bar = NULL; -static char *font_name = NULL; -static UINT font_size = 9; -static HIMAGELIST large_image_list = NULL, small_image_list = NULL; -static LIST *icon_list = NULL; -static HINSTANCE hMsHtml = NULL; -static UINT init_winui_counter = 0; -static HDC hCommonDC = NULL; -static LOCK *lock_common_dc = NULL; - -bool UseAlpha = false; -UINT AlphaValue = 100; - -static THREAD *led_thread = NULL; -static bool thread_stop = false; -static bool g_led_special = false; -static bool g_tcpip_topmost = false; -static DWORD tls_current_wizard = 0xFFFFFFFF; - -#define WINUI_PSM_SHOWWIZBUTTONS (WM_USER + 138) -#define WINUI_PropSheet_ShowWizButtons(hDlg, dwFlag, dwButton) \ - PSTMSG(hDlg, WINUI_PSM_SHOWWIZBUTTONS, (WPARAM)(dwFlag), (LPARAM)(dwButton)) - -typedef struct _WINUI_SHSTOCKICONINFO -{ - DWORD cbSize; - HICON hIcon; - int iSysImageIndex; - int iIcon; - WCHAR szPath[MAX_PATH]; -} WINUI_SHSTOCKICONINFO; - -// Get whether the current process is foreground -bool IsThisProcessForeground() -{ - HWND hWnd = GetForegroundWindow(); - DWORD proc_id, thread_id; - - if (hWnd == NULL) - { - return false; - } - - proc_id = 0; - thread_id = GetWindowThreadProcessId(hWnd, &proc_id); - - if (proc_id == MsGetCurrentProcessId()) - { - return true; - } - - return false; -} -bool IsThisProcessForegroundForUpdateUi(UPDATE_CLIENT *c, void *p) -{ - return IsThisProcessForeground(); -} - -// Update notification screen dialog procedure -UINT UpdateConfigDlgProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param) -{ - WINUI_UPDATE *u = (WINUI_UPDATE *)param; - UPDATE_CLIENT_SETTING s; - - switch (msg) - { - case WM_INITDIALOG: - SetTimer(hWnd, 1, 100, NULL); - - LoadUpdateUiSetting(u, &s); - - Check(hWnd, S_ENABLE, s.DisableCheck == false); - Check(hWnd, S_DISABLE, s.DisableCheck); - - DlgFont(hWnd, S_TITLE, 10, true); - FormatText(hWnd, S_TITLE, u->SoftwareTitle); - FormatText(hWnd, S_INFO, u->SoftwareTitle); - break; - - case WM_TIMER: - switch (wParam) - { - case 1: - if (u->UpdateClient->HaltFlag) - { - goto LABEL_CLOSE; - } - break; - } - break; - - case WM_COMMAND: - switch (wParam) - { - case IDCANCEL: - Close(hWnd); - break; - } - break; - - case WM_CLOSE: -LABEL_CLOSE: - LoadUpdateUiSetting(u, &s); - - s.DisableCheck = IsChecked(hWnd, S_DISABLE); - - if (s.DisableCheck) - { - s.LatestIgnoreBuild = 0; - } - - SaveUpdateUiSetting(u, &s); - - SetUpdateClientSetting(u->UpdateClient, &s); - - EndDialog(hWnd, !s.DisableCheck); - - break; - } - - return 0; -} - -// Show the update notification setting screen -bool ConfigUpdateUi(WINUI_UPDATE *u, HWND hWnd) -{ - // Validate arguments - if (u == NULL) - { - return false; - } - - return Dialog(hWnd, D_UPDATE_CONFIG, UpdateConfigDlgProc, u); -} - -// Update notification dialog procedure -UINT UpdateNoticeDlgProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param) -{ - WINUI_UPDATE_DLG_PARAM *p = (WINUI_UPDATE_DLG_PARAM *)param; - WINUI_UPDATE *u = NULL; - UPDATE_CLIENT_SETTING s; - char date_current[64]; - char date_latest[64]; - wchar_t date_current_str[128]; - wchar_t date_latest_str[128]; - char *font_name = NULL; - - if (p != NULL) - { - u = p->Update; - } - - switch (msg) - { - case WM_INITDIALOG: - Zero(date_current_str, sizeof(date_current_str)); - Zero(date_latest_str, sizeof(date_latest_str)); - - GetDateStr64(date_current, sizeof(date_current), u->CurrentDate); - if (u->CurrentDate != 0) - { - UniFormat(date_current_str, sizeof(date_current_str), _UU("DLG_UPDATE_DATE"), date_current); - } - - GetDateStr64(date_latest, sizeof(date_latest), p->LatestDate); - if (p->LatestDate != 0) - { - UniFormat(date_latest_str, sizeof(date_latest_str), _UU("DLG_UPDATE_DATE"), date_latest); - } - - FormatText(hWnd, 0, u->UpdateClient->SoftwareTitle); - FormatText(hWnd, S_INFO, u->UpdateClient->SoftwareTitle); - SetText(hWnd, S_PRODUCT_STR, u->UpdateClient->SoftwareTitle); - - FormatText(hWnd, S_CURRENT_STR, u->CurrentVer / 100, u->CurrentVer % 100, u->CurrentBuild, date_current_str); - FormatText(hWnd, S_LATEST_STR, p->LatestVer, date_latest_str); - - if (MsIsWindows7()) - { - if (_GETLANG() == 0) - { - font_name = GetMeiryoFontName(); - } - else if (_GETLANG() == 2) - { - font_name = "Microsoft YaHei"; - } - else if (_GETLANG() == 3) - { - font_name = "Microsoft JhengHei"; - } - } - - SetFont(hWnd, S_INFO, GetFont(font_name, 11, false, false, false, false)); - SetFont(hWnd, IDOK, GetFont(font_name, 0, true, false, false, false)); - SetFont(hWnd, IDCANCEL, GetFont(font_name, 0, false, false, false, false)); - SetFont(hWnd, S_PRODUCT_STR, GetFont(font_name, 10, true, false, false, false)); - SetFont(hWnd, S_CURRENT_STR, GetFont(font_name, 10, true, false, false, false)); - SetFont(hWnd, S_LATEST_STR, GetFont(font_name, 10, true, false, false, false)); - - SetFont(hWnd, S_PRODUCT, GetFont(font_name, 0, false, false, false, false)); - SetFont(hWnd, S_CURRENT, GetFont(font_name, 0, false, false, false, false)); - SetFont(hWnd, S_LATEST, GetFont(font_name, 0, false, false, false, false)); - SetFont(hWnd, B_CONFIG, GetFont(font_name, 0, false, false, false, false)); - - SetTimer(hWnd, 1, 100, NULL); - - //MessageBeep(MB_ICONASTERISK); - break; - - case WM_COMMAND: - switch (wParam) - { - case IDOK: // Web View - OnceMsgEx(hWnd, NULL, _UU("DLG_UPDATE_HINT"), true, ICO_INTERNET, (bool *)p->halt_flag); - - ShellExecuteA(hWnd, "open", p->Url, NULL, NULL, SW_SHOWNORMAL); - SleepThread(250); - - // Ignore the update notification of this version for future - LoadUpdateUiSetting(u, &s); - s.LatestIgnoreBuild = p->LatestBuild; - SaveUpdateUiSetting(u, &s); - - EndDialog(hWnd, 1); - break; - - case IDCANCEL: // Ignore this version - LoadUpdateUiSetting(u, &s); - s.LatestIgnoreBuild = p->LatestBuild; - SaveUpdateUiSetting(u, &s); - Close(hWnd); - break; - - case B_CONFIG: // Show the notification settings screen - p->IsInConfigDialog = true; - - if (ConfigUpdateUi(u, hWnd) == false) - { - // Decided not to notify any more as a result of setting - Close(hWnd); - } - - p->IsInConfigDialog = false; - break; - } - break; - - case WM_TIMER: - switch (wParam) - { - case 1: - if (p->IsInConfigDialog == false) - { - if (*(p->halt_flag)) - { - // Close the screen forcibly - EndDialog(hWnd, 0); - } - } - break; - } - break; - - case WM_CLOSE: // Close - EndDialog(hWnd, 0); - break; - } - - return 0; -} - -// Update notification dialog -void UpdateNotifyProcUi(UPDATE_CLIENT *c, UINT latest_build, UINT64 latest_date, char *latest_ver, char *url, volatile bool *halt_flag, void *param) -{ - WINUI_UPDATE *u = (WINUI_UPDATE *)param; - WINUI_UPDATE_DLG_PARAM p; - // Validate arguments - if (c == NULL || latest_build == 0 || latest_date == 0 || latest_ver == NULL || url == NULL || halt_flag == NULL || param == NULL) - { - return; - } - - if (u->UseSuppressFlag) - { - // Check the suppress flag - if (MsRegReadIntEx2(REG_LOCAL_MACHINE, PROTO_SUPPRESS_CLIENT_UPDATE_NOTIFICATION_REGKEY, - PROTO_SUPPRESS_CLIENT_UPDATE_NOTIFICATION_REGVALUE, false, true)) - { - // Supress the dialog - return; - } - } - - if (u->CurrentlyDisabled) - { - // Hide - return; - } - - // Show the update screen - Zero(&p, sizeof(p)); - - p.Update = u; - p.LatestBuild = latest_build; - p.LatestDate = latest_date; - p.LatestVer = latest_ver; - p.Url = url; - p.halt_flag = halt_flag; - - Dialog(NULL, D_UPDATE_NOTICE, UpdateNoticeDlgProc, &p); -} - -// Initialize the update notification -WINUI_UPDATE *InitUpdateUi(wchar_t *title, char *name, char *family_name, UINT64 current_date, UINT current_build, UINT current_ver, char *client_id, bool use_suppress_flag) -{ - WINUI_UPDATE *u; - UPDATE_CLIENT_SETTING s; - LANGLIST t; - // Validate arguments - if (title == NULL || name == NULL || current_build == 0 || current_ver == 0) - { - return NULL; - } - if (MsIsWine()) - { - return false; - } - if (IsEmptyStr(family_name)) - { - family_name = UPDATE_FAMILY_NAME; - } - - u = ZeroMalloc(sizeof(WINUI_UPDATE)); - - StrCpy(u->ClientId, sizeof(u->ClientId), client_id); - UniStrCpy(u->SoftwareTitle, sizeof(u->SoftwareTitle), title); - StrCpy(u->SoftwareName, sizeof(u->SoftwareName), name); - u->CurrentDate = current_date; - u->CurrentBuild = current_build; - u->CurrentVer = current_ver; - u->UseSuppressFlag = use_suppress_flag; - - Format(u->RegKey, sizeof(u->RegKey), WINUI_UPDATE_REGKEY, u->SoftwareName); - - Zero(&s, sizeof(s)); - LoadUpdateUiSetting(u, &s); - - Zero(&t, sizeof(t)); - GetCurrentLang(&t); - - u->UpdateClient = NewUpdateClient(UpdateNotifyProcUi, IsThisProcessForegroundForUpdateUi, u, family_name, u->SoftwareName, u->SoftwareTitle, - u->CurrentBuild, u->CurrentDate, t.Name, &s, client_id); - - if (u->UpdateClient == NULL) - { - Free(u); - return NULL; - } - - return u; -} - -// Disable the update notification UI -void DisableUpdateUi(WINUI_UPDATE *u) -{ - // Validate arguments - if (u == NULL) - { - return; - } - - u->CurrentlyDisabled = true; -} - -// Release the update notification -void FreeUpdateUi(WINUI_UPDATE *u) -{ - // Validate arguments - if (u == NULL) - { - return; - } - - if (u->UpdateClient != NULL) - { - FreeUpdateClient(u->UpdateClient); - } - - Free(u); -} - -// Read the current settings from the registry -void LoadUpdateUiSetting(WINUI_UPDATE *u, UPDATE_CLIENT_SETTING *s) -{ - Zero(s, sizeof(UPDATE_CLIENT_SETTING)); - // Validate arguments - if (u == NULL || s == NULL) - { - return; - } - - s->DisableCheck = MsRegReadInt(REG_CURRENT_USER, u->RegKey, "DisableCheck"); - s->LatestIgnoreBuild = MsRegReadInt(REG_CURRENT_USER, u->RegKey, "LatestIgnoreBuild"); -} - -// Write the current settings to the registry -void SaveUpdateUiSetting(WINUI_UPDATE *u, UPDATE_CLIENT_SETTING *s) -{ - // Validate arguments - if (u == NULL || s == NULL) - { - return; - } - - MsRegWriteInt(REG_CURRENT_USER, u->RegKey, "DisableCheck", s->DisableCheck); - MsRegWriteInt(REG_CURRENT_USER, u->RegKey, "LatestIgnoreBuild", s->LatestIgnoreBuild); -} - -// Set the UAC icon to the control in the dialog -void SetUacIcon(HWND hWnd, UINT id) -{ - static HINSTANCE hShell32 = NULL; - static HRESULT (__stdcall *_SHGetStockIconInfo)(UINT siid, UINT uFlags, void *psii) = NULL; - bool ok = false; - // Validate arguments - if (hWnd == NULL) - { - return; - } - - if (MsIsVista() == false) - { - goto LABEL_FAILED; - } - - if (hShell32 == NULL) - { - hShell32 = LoadLibraryA("shell32.dll"); - } - - if (hShell32 != NULL) - { - if (_SHGetStockIconInfo == NULL) - { - _SHGetStockIconInfo = (HRESULT (__stdcall *)(UINT,UINT,void *))GetProcAddress(hShell32, "SHGetStockIconInfo"); - } - } - - if (_SHGetStockIconInfo != NULL) - { - WINUI_SHSTOCKICONINFO sii; - - Zero(&sii, sizeof(sii)); - - sii.cbSize = sizeof(sii); - if (_SHGetStockIconInfo(77, 0x000000100 | 0x000000001, &sii) == S_OK) - { - SendMessage(DlgItem(hWnd, id), STM_SETICON, (WPARAM)sii.hIcon, 0); - - ok = true; - } - } - - if (ok) - { - return; - } - -LABEL_FAILED: - - Hide(hWnd, id); -} - -// Procedure of the wizard page -UINT CALLBACK WizardPageDefDlgProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam) -{ - DIALOG_PARAM *dp = (DIALOG_PARAM *)GetParam(hWnd); - WIZARD_PAGE *wizard_page = NULL; - WIZARD *wizard = NULL; - UINT ret_value = 0; - bool do_not_send_msg = false; - - if (dp != NULL) - { - wizard_page = dp->wizard_page; - wizard = wizard_page->Wizard; - } - - switch (msg) - { - case WM_INITDIALOG: - { - PROPSHEETPAGEW_V3 *t = (PROPSHEETPAGEW_V3 *)lParam; - dp = (DIALOG_PARAM *)t->lParam; - wizard_page = dp->wizard_page; - wizard = wizard_page->Wizard; - - wizard->hWndWizard = GetParent(hWnd); - wizard_page->hWndPage = hWnd; - - SetParam(hWnd, dp); - - InitDialogInternational(hWnd, dp); - } - break; - - case WM_CTLCOLORBTN: - case WM_CTLCOLORDLG: - case WM_CTLCOLOREDIT: - case WM_CTLCOLORLISTBOX: - case WM_CTLCOLORMSGBOX: - case WM_CTLCOLORSCROLLBAR: - case WM_CTLCOLORSTATIC: - return (UINT)GetStockObject(WHITE_BRUSH); - break; - - case WM_NOTIFY: - { - NMHDR *pnmh = (NMHDR *)lParam; - UINT ret = 0; - UINT next_page = INFINITE; - - switch (pnmh->code) - { - case PSN_SETACTIVE: // Activate - SetWizardButton(wizard_page, true, true, true, false); - dp->wizard_proc(hWnd, WM_WIZ_SHOW, 0, 0, wizard, wizard_page, wizard->Param); - break; - - case PSN_KILLACTIVE: // Deactivate - dp->wizard_proc(hWnd, WM_WIZ_HIDE, 0, 0, wizard, wizard_page, wizard->Param); - break; - - case PSN_WIZNEXT: // Determine the destination of [Next] button - ret = dp->wizard_proc(hWnd, WM_WIZ_NEXT, 0, 0, wizard, wizard_page, wizard->Param); - do_not_send_msg = true; - - if (ret == 0) - { - SetWindowLong(hWnd, DWLP_MSGRESULT, -1); - } - else - { - SetWindowLong(hWnd, DWLP_MSGRESULT, ret); - } - - ret_value = 1; - break; - - case PSN_WIZBACK: // Determine the destination of [back] button - ret = dp->wizard_proc(hWnd, WM_WIZ_BACK, 0, 0, wizard, wizard_page, wizard->Param); - do_not_send_msg = true; - - if (ret == 0) - { - SetWindowLong(hWnd, DWLP_MSGRESULT, -1); - } - else - { - SetWindowLong(hWnd, DWLP_MSGRESULT, ret); - } - - ret_value = 1; - break; - - case PSN_QUERYCANCEL: // Determine the process of the [Cancel] button - if (dp->wizard_page->EnableClose == false) - { - SetWindowLong(hWnd, DWLP_MSGRESULT, 1); - } - else - { - - ret = dp->wizard_proc(hWnd, WM_WIZ_CLOSE, 0, 0, wizard, wizard_page, wizard->Param); - - if (ret == 0) - { - if (IsEmptyUniStr(wizard->CloseConfirmMsg) == false && - MsgBox(hWnd, MB_ICONQUESTION | MB_YESNO | MB_DEFBUTTON2, wizard->CloseConfirmMsg) == IDNO) - { - ret = 1; - } - } - - if (ret == 0) - { - SetWindowLong(hWnd, DWLP_MSGRESULT, 0); - } - else - { - SetWindowLong(hWnd, DWLP_MSGRESULT, 1); - } - } - ret_value = 1; - do_not_send_msg = true; - break; - } - break; - } - } - - if (do_not_send_msg == false) - { - if (dp != NULL) - { - UINT ret = dp->wizard_proc(hWnd, msg, wParam, lParam, wizard, wizard_page, wizard->Param); - - if (ret != 0) - { - ret_value = ret; - } - } - } - - if (msg == WM_INITDIALOG) - { - if (wizard->SetCenterFlag == false) - { - wizard->SetCenterFlag = true; - - Center(wizard->hWndWizard); - } - - SetForegroundWindow(wizard->hWndWizard); - SetActiveWindow(wizard->hWndWizard); - } - - return ret_value; -} - -// Button setting of the wizard -void SetWizardButton(WIZARD_PAGE *p, bool enable_next, bool enable_back, bool enable_close, bool is_finish) -{ - SetWizardButtonEx(p, enable_next, enable_back, enable_close, is_finish, false); -} -void SetWizardButtonEx(WIZARD_PAGE *p, bool enable_next, bool enable_back, bool enable_close, bool is_finish, bool shield_icon) -{ - DWORD flags = 0; - DWORD flags2 = 0; - DWORD flags3 = 0; - // Validate arguments - if (p == NULL) - { - return; - } - - p->EnableNext = enable_next; - p->EnableBack = enable_back; - p->EnableClose = enable_close; - p->IsFinish = is_finish; - - if (is_finish == false) - { - if (p->EnableNext) - { - flags |= PSWIZB_NEXT; - flags2 |= PSWIZB_NEXT; - - if (shield_icon) - { - if (p->Wizard->IsAreoStyle) - { - if (MsIsAdmin() == false) - { - flags3 |= PSWIZBF_ELEVATIONREQUIRED; - } - } - } - } - } - else - { - if (p->EnableNext) - { - flags |= PSWIZB_FINISH; - flags2 |= PSWIZB_FINISH; - } - else - { - flags |= PSWIZB_DISABLEDFINISH; - flags2 |= PSWIZB_FINISH; - } - } - - if (p->EnableBack) - { - flags |= PSWIZB_BACK; - flags2 |= PSWIZB_BACK; - } - - if (p->EnableClose) - { - flags2 |= 0x00000010; - } - - PostMessage(p->Wizard->hWndWizard, PSM_SETWIZBUTTONS, flags3, flags); - - SetEnable(p->Wizard->hWndWizard, IDCANCEL, p->EnableClose); - - WINUI_PropSheet_ShowWizButtons(p->Wizard->hWndWizard, - flags2, PSWIZB_BACK | PSWIZB_NEXT | PSWIZB_FINISH | 0x00000010); - - if (p->EnableClose) - { - EnableClose(p->Wizard->hWndWizard); - } - else - { - DisableClose(p->Wizard->hWndWizard); - } -} - -LRESULT CALLBACK WizardCustomizedWindowProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam) -{ - WIZARD *wizard = (WIZARD *)TlsGetValue(tls_current_wizard); - - if (wizard != NULL) - { - switch (msg) - { - case WM_CTLCOLORBTN: - case WM_CTLCOLORDLG: - case WM_CTLCOLOREDIT: - case WM_CTLCOLORLISTBOX: - case WM_CTLCOLORMSGBOX: - case WM_CTLCOLORSCROLLBAR: - case WM_CTLCOLORSTATIC: - return (UINT)GetStockObject(WHITE_BRUSH); - break; - } - - if (MsIsNt()) - { - return CallWindowProcW(wizard->OriginalWindowProc, hWnd, msg, wParam, lParam); - } - else - { - return CallWindowProcA(wizard->OriginalWindowProc, hWnd, msg, wParam, lParam); - } - } - else - { - return 0; - } -} - -// Procedure of the wizard -UINT CALLBACK WizardDlgProc(HWND hWnd, UINT msg, LPARAM lParam) -{ - WIZARD *wizard = (WIZARD *)TlsGetValue(tls_current_wizard); - switch (msg) - { - case PSCB_INITIALIZED: - if (wizard != NULL) - { - if (wizard->hWndWizard != NULL) - { - wizard->hWndWizard = hWnd; - } - - if (wizard->ReplaceWindowProcFlag == false) - { - wizard->ReplaceWindowProcFlag = true; - - if (MsIsNt()) - { - wizard->OriginalWindowProc = (void *)GetWindowLongPtrW(hWnd, GWLP_WNDPROC); - } - else - { - wizard->OriginalWindowProc = (void *)GetWindowLongPtrA(hWnd, GWLP_WNDPROC); - } - - if (wizard->OriginalWindowProc != NULL) - { - if (MsIsNt()) - { - SetWindowLongPtrW(hWnd, GWLP_WNDPROC, (LONG_PTR)WizardCustomizedWindowProc); - } - else - { - SetWindowLongPtrA(hWnd, GWLP_WNDPROC, (LONG_PTR)WizardCustomizedWindowProc); - } - } - } - } - break; - } - - return 0; -} - -// Jump to another wizard page -void JumpWizard(WIZARD_PAGE *p, UINT next_id) -{ - // Validate arguments - if (p == NULL || next_id == 0) - { - return; - } - - PropSheet_SetCurSelByID(p->Wizard->hWndWizard, next_id); -} - -// Close the wizard -void CloseWizard(WIZARD_PAGE *p) -{ - // Validate arguments - if (p == NULL) - { - return; - } - - p->Wizard->CloseConfirmMsg = NULL; - SetWizardButton(p, false, false, true, false); - - if (p->Wizard->IsAreoStyle) - { - PropSheet_PressButton(p->hWndPage, PSBTN_CANCEL); - } - else - { - Close(p->Wizard->hWndWizard); - } -} - -// Show the wizard -void ShowWizard(HWND hWndParent, WIZARD *w, UINT start_id) -{ - void **pages_array; - UINT num_pages; - UINT i; - PROPSHEETHEADERW_V2 h; - WIZARD_PAGE *start_page; - // Validate arguments - if (w == NULL) - { - return; - } - - num_pages = LIST_NUM(w->Pages); - pages_array = ZeroMalloc(sizeof(void *) * num_pages); - - for (i = 0;i < num_pages;i++) - { - WIZARD_PAGE *p = LIST_DATA(w->Pages, i); - - pages_array[i] = CreateWizardPageInstance(w, p); - - p->Index = i; - } - - Zero(&h, sizeof(h)); - h.dwSize = sizeof(PROPSHEETHEADERW_V2); - h.dwFlags = PSH_WIZARD97 | PSH_HEADER | PSH_USEICONID | PSH_USECALLBACK; - - if (MsIsVista() == false) - { - // Aero Wizard is unavailable in pre-Vista - w->IsAreoStyle = false; - } - - if (MsIsAeroColor() == false) - { - // Aero Wizard can not be used If the color of Aero is disabled - // even in Vista or later (if the background color is not white) - w->IsAreoStyle = false; - } - - if (MsIsWindows10()) - { - // Windows 10 Icon Bug: Disable Aero Style! - w->IsAreoStyle = false; - } - - if (w->IsAreoStyle) - { - // Aero Wizard - h.dwFlags = PSH_WIZARD | 0x00004000 | PSH_HEADER | PSH_USEICONID | PSH_USECALLBACK; - } - - h.hInstance = hDll; - h.pszIcon = MAKEINTRESOURCEW(w->Icon); - h.hwndParent = hWndParent; - h.nPages = num_pages; - h.phpage = (HPROPSHEETPAGE *)pages_array; - h.pszbmHeader = MAKEINTRESOURCEW(w->Bitmap); - h.pszCaption = w->Caption; - h.pfnCallback = WizardDlgProc; - - start_page = GetWizardPage(w, start_id); - if (start_page != NULL) - { - h.nStartPage = start_page->Index; - } - - w->hWndParent = hWndParent; - w->hWndWizard = NULL; - w->SetCenterFlag = false; - - TlsSetValue(tls_current_wizard, w); - - PropertySheetW(&h); - - TlsSetValue(tls_current_wizard, NULL); - - Free(pages_array); -} - -// Create an instance of the wizard page -void *CreateWizardPageInstance(WIZARD *w, WIZARD_PAGE *p) -{ - PROPSHEETPAGEW_V3 t; - // Validate arguments - if (w == NULL || p == NULL) - { - return NULL; - } - - Zero(&t, sizeof(t)); - t.dwSize = sizeof(PROPSHEETPAGEW_V3); - t.dwFlags = PSP_USETITLE | PSP_USEHEADERTITLE;// | PSP_USEHEADERSUBTITLE; - t.hInstance = hDll; - t.pszTemplate = MAKEINTRESOURCEW(p->Id); - t.pfnDlgProc = (DLGPROC)WizardPageDefDlgProc; - t.pszHeaderTitle = p->Title; - t.pszTitle = w->Caption; - - if (p->DialogParam != NULL) - { - FreeBitmapList(p->DialogParam->BitmapList); - Free(p->DialogParam); - } - - p->DialogParam = ZeroMalloc(sizeof(DIALOG_PARAM)); - - p->DialogParam->BitmapList = NewBitmapList(); - p->DialogParam->wizard = w; - p->DialogParam->wizard_page = p; - p->DialogParam->wizard_proc = p->Proc; - p->DialogParam->param = w->Param; - p->DialogParam->white = false; - p->DialogParam->meiryo = false; - - t.lParam = (LPARAM)p->DialogParam; - - return CreatePropertySheetPageW(&t); -} - -// Create a new wizard -WIZARD *NewWizard(UINT icon, UINT bitmap, wchar_t *caption, void *param) -{ - WIZARD *w = ZeroMalloc(sizeof(WIZARD)); - - w->Icon = icon; - w->Pages = NewList(NULL); - w->Param = param; - w->Bitmap = bitmap; - w->Caption = CopyUniStr(caption); - - return w; -} - -// Release the wizard -void FreeWizard(WIZARD *w) -{ - UINT i; - // Validate arguments - if (w == NULL) - { - return; - } - - for (i = 0;i < LIST_NUM(w->Pages);i++) - { - WIZARD_PAGE *p = LIST_DATA(w->Pages, i); - - FreeWizardPage(p); - } - - ReleaseList(w->Pages); - - Free(w->Caption); - - Free(w); -} - -// Get the wizard page -WIZARD_PAGE *GetWizardPage(WIZARD *w, UINT id) -{ - UINT i; - // Validate arguments - if (w == NULL || id == 0) - { - return NULL; - } - - for (i = 0;i < LIST_NUM(w->Pages);i++) - { - WIZARD_PAGE *p = LIST_DATA(w->Pages, i); - - if (p->Id == id) - { - return p; - } - } - - return NULL; -} - -// Add a wizard page -void AddWizardPage(WIZARD *w, WIZARD_PAGE *p) -{ - // Validate arguments - if (w == NULL || p == NULL) - { - return; - } - - Add(w->Pages, p); - - p->Wizard = w; -} - -// Create a new wizard page -WIZARD_PAGE *NewWizardPage(UINT id, WINUI_WIZARD_PROC *proc, wchar_t *title) -{ - WIZARD_PAGE *p; - // Validate arguments - if (id == 0 || proc == NULL) - { - return NULL; - } - - p = ZeroMalloc(sizeof(WIZARD_PAGE)); - p->Id = id; - p->Proc = proc; - p->Title = CopyUniStr(title); - - return p; -} - -// Release the wizard page -void FreeWizardPage(WIZARD_PAGE *p) -{ - // Validate arguments - if (p == NULL) - { - return; - } - - if (p->DialogParam != NULL) - { - FreeBitmapList(p->DialogParam->BitmapList); - Free(p->DialogParam); - } - - Free(p->Title); - - Free(p); -} - -// NIC information dialog procedure -UINT NicInfoProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param) -{ - UI_NICINFO *info = (UI_NICINFO *)param; - - switch (msg) - { - case WM_INITDIALOG: - NicInfoInit(hWnd, info); - - SetTimer(hWnd, 1, 50, NULL); - break; - - case WM_TIMER: - switch (wParam) - { - case 1: - KillTimer(hWnd, 1); - - NicInfoOnTimer(hWnd, info); - - SetTimer(hWnd, 1, 50, NULL); - break; - - case 2: - KillTimer(hWnd, 2); - Close(hWnd); - break; - } - break; - - case WM_COMMAND: - switch (wParam) - { - case IDOK: - case IDCANCEL: - Close(hWnd); - break; - } - break; - - case WM_CLOSE: - KillTimer(hWnd, 1); - KillTimer(hWnd, 2); - EndDialog(hWnd, 0); - break; - } - - return 0; -} -void NicInfoCloseAfterTime(HWND hWnd, UI_NICINFO *info, UINT tick) -{ - UINT64 now; - UINT64 closetime; - // Validate arguments - if (hWnd == NULL || info == NULL) - { - return; - } - - now = Tick64(); - closetime = now + (UINT64)tick; - - if (info->CloseAfterTime == 0 || info->CloseAfterTime >= closetime) - { - info->CloseAfterTime = closetime; - KillTimer(hWnd, 2); - SetTimer(hWnd, 2, tick, NULL); - } -} -void NicInfoShowStatus(HWND hWnd, UI_NICINFO *info, wchar_t *msg1, wchar_t *msg2, UINT icon, bool animate) -{ - // Validate arguments - if (hWnd == NULL || info == NULL) - { - return; - } - if (icon == 0) - { - icon = ICO_TEST; - } - if (msg1 == NULL) - { - msg1 = L""; - } - if (msg2 == NULL) - { - msg2 = L""; - } - - if (info->CurrentIcon != icon) - { - SetIcon(hWnd, S_ICON, icon); - info->CurrentIcon = icon; - } - - SetText(hWnd, S_STATUS1, msg1); - SetText(hWnd, S_STATUS2, msg2); - - SetShow(hWnd, P_BAR, animate && MsIsWinXPOrWinVista()); -} -void NicInfoRefresh(HWND hWnd, UI_NICINFO *info) -{ - MS_ADAPTER *a; - IP ip; - char ip_str[MAX_SIZE]; - char title[MAX_SIZE]; - UINT i; - wchar_t tmp[MAX_SIZE]; - bool has_ip = false; - // Validate arguments - if (hWnd == NULL || info == NULL) - { - return; - } - - Format(title, sizeof(title), VLAN_ADAPTER_NAME_TAG, info->NicName); - - a = MsGetAdapter(title); - if (a == NULL) - { - Close(hWnd); - return; - } - - // Check whether an IP address is assigned - Zero(&ip, sizeof(ip)); - for (i = 0;i < MAX_MS_ADAPTER_IP_ADDRESS;i++) - { - if (IsZeroIP(&a->IpAddresses[i]) == false) - { - Copy(&ip, &a->IpAddresses[i], sizeof(IP)); - - if (!(ip.addr[0] == 169 && ip.addr[1] == 254)) - { - has_ip = true; - } - } - } - IPToStr(ip_str, sizeof(ip_str), &ip); - - if (has_ip == false) - { - if (a->UseDhcp) - { - NicInfoShowStatus(hWnd, info, _UU("NICINFO_1"), _UU("NICINFO_1_1"), ICO_NIC_OFFLINE, true); - } - else - { - NicInfoShowStatus(hWnd, info, _UU("NICINFO_1"), _UU("NICINFO_1_2"), ICO_NIC_OFFLINE, true); - } - } - else - { - if (a->UseDhcp) - { - UniFormat(tmp, sizeof(tmp), _UU("NICINFO_2_1"), ip_str); - NicInfoShowStatus(hWnd, info, _UU("NICINFO_2"), tmp, ICO_NIC_ONLINE, false); - } - else - { - UniFormat(tmp, sizeof(tmp), _UU("NICINFO_3_1"), ip_str); - NicInfoShowStatus(hWnd, info, _UU("NICINFO_3"), tmp, ICO_NIC_ONLINE, false); - } - - NicInfoCloseAfterTime(hWnd, info, NICINFO_AUTOCLOSE_TIME_2); - } - - MsFreeAdapter(a); -} -void NicInfoInit(HWND hWnd, UI_NICINFO *info) -{ - // Validate arguments - if (hWnd == NULL || info == NULL) - { - return; - } - - if (MsIsWinXPOrWinVista()) - { - // Show a progress bar for Windows XP or later - SendMsg(hWnd, P_BAR, PBM_SETMARQUEE, TRUE, 150); - SetStyle(hWnd, P_BAR, PBS_MARQUEE); - } - - DlgFont(hWnd, S_STATUS1, 9, false); - DlgFont(hWnd, S_STATUS2, 11, false); - - SetIcon(hWnd, 0, ICO_NIC_ONLINE); - - FormatText(hWnd, 0, info->NicName); - - NicInfoRefresh(hWnd, info); - - NicInfoCloseAfterTime(hWnd, info, NICINFO_AUTOCLOSE_TIME_1); -} -void NicInfoOnTimer(HWND hWnd, UI_NICINFO *info) -{ - // Validate arguments - if (hWnd == NULL || info == NULL) - { - return; - } - - if (info->Halt) - { - Close(hWnd); - return; - } - - if (info->RouteChange != NULL && - IsRouteChanged(info->RouteChange) == false) - { - return; - } - - NicInfoRefresh(hWnd, info); -} - -// Show the NIC information dialog -void NicInfo(UI_NICINFO *info) -{ - // Validate arguments - if (info == NULL) - { - return; - } - - info->RouteChange = NewRouteChange(); - - DialogEx2(NULL, D_NICINFO, NicInfoProc, info, true, true); - - FreeRouteChange(info->RouteChange); - info->RouteChange = NULL; -} - -// TCP connection thread -void WinConnectDlgThread(THREAD *thread, void *param) -{ - SOCK *s; - WINCONNECT_DLG_DATA *d = (WINCONNECT_DLG_DATA *)param; - UINT nat_t_error_code; - char *nat_t_svc_name = NULL; - // Validate arguments - if (d == NULL || thread == NULL) - { - return; - } - - // Socket connection - if (IsEmptyStr(d->nat_t_svc_name) == false) - { - nat_t_svc_name = d->nat_t_svc_name; - } - - s = ConnectEx3(d->hostname, d->port, d->timeout, &d->cancel, nat_t_svc_name, &nat_t_error_code, d->try_start_ssl, false); - - d->ret_sock = s; - d->nat_t_error_code = nat_t_error_code; - - PostMessageA(d->hWnd, WM_APP + 68, 0, 0); -} - -// TCP connection dialog procedure -UINT WinConnectDlgProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param) -{ - WINCONNECT_DLG_DATA *d = (WINCONNECT_DLG_DATA *)param; - // Validate arguments - if (hWnd == NULL || d == NULL) - { - return 0; - } - - switch (msg) - { - case WM_INITDIALOG: - // UI setting - CenterParent(hWnd); - SetText(hWnd, 0, d->caption); - SetText(hWnd, S_INFO, d->info); - SetIcon(hWnd, S_ICON, d->icon_id); - d->hWnd = hWnd; - - if (MsIsWinXPOrWinVista()) - { - // Show a progress bar for Windows XP or later - SendMsg(hWnd, IDC_PROGRESS1, PBM_SETMARQUEE, TRUE, 100); - SetStyle(hWnd, IDC_PROGRESS1, PBS_MARQUEE); - } - else - { - // Hide the progress bar in the case of pre-Windows 2000 - Hide(hWnd, IDC_PROGRESS1); - } - - // Create a thread - d->thread = NewThread(WinConnectDlgThread, d); - break; - - case WM_COMMAND: - switch (wParam) - { - case IDCANCEL: - Close(hWnd); - break; - } - break; - - case WM_APP + 68: - case WM_CLOSE: - if (d->cancel == false) - { - d->cancel = true; - Disable(hWnd, IDCANCEL); - if (d->ret_sock == NULL) - { - SetText(hWnd, S_INFO, _UU("CONNECTDLG_CANCELING")); - } - DoEvents(hWnd); - Refresh(hWnd); - WaitThread(d->thread, INFINITE); - ReleaseThread(d->thread); - EndDialog(hWnd, 0); - } - break; - } - - return 0; -} - -// TCP connection with showing the UI -SOCK *WinConnectEx3(HWND hWnd, char *server, UINT port, UINT timeout, UINT icon_id, wchar_t *caption, wchar_t *info, UINT *nat_t_error_code, char *nat_t_svc_name, bool try_start_ssl) -{ - wchar_t tmp[MAX_SIZE]; - wchar_t tmp2[MAX_SIZE]; - WINCONNECT_DLG_DATA d; - // Validate arguments - if (server == NULL || port == 0) - { - return NULL; - } - if (icon_id == 0) - { - icon_id = ICO_USER_ADMIN; - } - if (caption == NULL) - { - if (hWnd == NULL) - { - caption = _UU("CONNECTDLG_CAPTION"); - } - else - { - GetTxt(hWnd, 0, tmp2, sizeof(tmp2)); - caption = tmp2; - } - } - if (info == NULL) - { - UniFormat(tmp, sizeof(tmp), _UU("CONNECTDLG_MESSAGE"), server, port); - - info = tmp; - } - - Zero(&d, sizeof(d)); - - d.try_start_ssl = try_start_ssl; - d.cancel = false; - d.caption = caption; - d.icon_id = icon_id; - d.info = info; - d.timeout = timeout; - d.hostname = server; - d.port = port; - StrCpy(d.nat_t_svc_name, sizeof(d.nat_t_svc_name), nat_t_svc_name); - - Dialog(hWnd, D_CONNECT, WinConnectDlgProc, &d); - - if (nat_t_error_code != NULL) - { - *nat_t_error_code = d.nat_t_error_code; - } - - return d.ret_sock; -} - -// Show the Windows Network Setup screen -bool ShowWindowsNetworkConnectionDialog() -{ - wchar_t exe_name[MAX_SIZE]; - void *proc; - - CombinePathW(exe_name, sizeof(exe_name), MsGetSystem32DirW(), L"control.exe"); - - proc = Win32RunEx2W(exe_name, L"netconnections", false, NULL); - - if (proc == NULL) - { - return false; - } - - Win32CloseProcess(proc); - - return true; -} - -// Get the best Meiryo font name for the current OS -char *GetMeiryoFontName() -{ - if (MsIsWindows7()) - { - return "Meiryo UI"; - } - else - { - if (MsIsVista()) - { - return "Meiryo"; - } - else - { - return "MS UI Gothic"; - } - } -} - -// Get the Meiryo font -HFONT GetMeiryoFont() -{ - return GetMeiryoFontEx(0); -} -HFONT GetMeiryoFontEx(UINT font_size) -{ - return GetMeiryoFontEx2(font_size, false); -} -HFONT GetMeiryoFontEx2(UINT font_size, bool bold) -{ - if (_GETLANG() == 0) - { - return GetFont(GetMeiryoFontName(), font_size, bold, false, false, false); - } - else if (_GETLANG() == 2) - { - return GetFont("Microsoft YaHei", font_size, bold, false, false, false); - } - else if (_GETLANG() == 3) - { - return GetFont("Microsoft JhengHei", font_size, bold, false, false, false); - } - else - { - return GetFont(NULL, font_size, bold, false, false, false); - } -} - -// Set font to Meiryo -void SetFontMeiryo(HWND hWnd, UINT id, UINT font_size) -{ - SetFont(hWnd, id, GetMeiryoFontEx(font_size)); -} - -// Set as the default font -void SetFontDefault(HWND hWnd, UINT id) -{ - SetFont(hWnd, id, GetDialogDefaultFont()); -} - -// Display the warning messages about bad process -void ShowBadProcessWarning(HWND hWnd, BAD_PROCESS *bad) -{ - wchar_t title[MAX_SIZE]; - wchar_t message[8192]; - // Validate arguments - if (bad == NULL) - { - return; - } - - UniFormat(title, sizeof(title), _UU("BAD_PROCESS_TITLE"), bad->Title); - UniFormat(message, sizeof(message), _UU("BAD_PROCESS_MESSAGE"), - bad->Title, bad->Title, bad->Title, bad->Title); - - OnceMsg(hWnd, title, message, true, ICO_WARNING); -} - -// If there is process which is included in incompatible anti-virus software list, show appropriate -bool CheckBadProcesses(HWND hWnd) -{ - bool ret = true; - UINT i; - LIST *o; - - o = MsGetProcessList(); - - for (i = 0;i < LIST_NUM(o);i++) - { - MS_PROCESS *p = LIST_DATA(o, i); - char exe[MAX_PATH]; - BAD_PROCESS *bad; - - GetFileNameFromFilePath(exe, sizeof(exe), p->ExeFilename); - - bad = IsBadProcess(exe); - - if (bad != NULL) - { - // Display the message because a bad process have been found - ret = false; - - ShowBadProcessWarning(hWnd, bad); - } - } - - MsFreeProcessList(o); - - return ret; -} - -// Search whether the specified process name is the appropriate to a bad process -BAD_PROCESS *IsBadProcess(char *exe) -{ - UINT i; - // Validate arguments - if (exe == NULL) - { - return NULL; - } - - for (i = 0;i < num_bad_processes;i++) - { - BAD_PROCESS *bad = &bad_processes[i]; - - if (StrCmpi(bad->ExeName, exe) == 0) - { - return bad; - } - } - - return NULL; -} - -// Message display procedure -UINT OnceMsgProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param) -{ - ONCEMSG_DLG *d = (ONCEMSG_DLG *)param; - // Validate arguments - if (hWnd == NULL) - { - return 0; - } - - switch (msg) - { - case WM_INITDIALOG: - SetText(hWnd, 0, d->Title); - SetText(hWnd, E_TEXT, d->Message); - SetShow(hWnd, C_DONTSHOWAGAIN, d->ShowCheckbox); - //DisableClose(hWnd); - Focus(hWnd, IDCANCEL); - if (d->Icon != 0) - { - SetIcon(hWnd, 0, d->Icon); - } - - if (MsIsVista()) - { - SetFont(hWnd, E_TEXT, GetMeiryoFont()); - } - else - { - DlgFont(hWnd, E_TEXT, 11, false); - } - - SetTimer(hWnd, 1, 50, NULL); - break; - - case WM_TIMER: - switch (wParam) - { - case 1: - if (*d->halt) - { - Close(hWnd); - } - break; - } - break; - - case WM_COMMAND: - switch (wParam) - { - case IDOK: - case IDCANCEL: - Close(hWnd); - break; - } - break; - - case WM_CLOSE: - KillTimer(hWnd, 1); - d->Checked = IsChecked(hWnd, C_DONTSHOWAGAIN); - EndDialog(hWnd, 0); - break; - } - - return 0; -} - -// Show a message -void OnceMsg(HWND hWnd, wchar_t *title, wchar_t *message, bool show_checkbox, UINT icon) -{ - OnceMsgEx(hWnd, title, message, show_checkbox, icon, NULL); -} -void OnceMsgEx(HWND hWnd, wchar_t *title, wchar_t *message, bool show_checkbox, UINT icon, bool *halt) -{ - ONCEMSG_DLG d; - UINT hash; - char valuename[MAX_PATH]; - bool b_dummy = false; - // Validate arguments - if (title == NULL) - { - title = title_bar; - } - if (message == NULL) - { - message = L"message"; - } - if (halt == NULL) - { - halt = &b_dummy; - } - - Zero(&d, sizeof(d)); - d.Message = message; - d.Title = title; - d.ShowCheckbox = show_checkbox; - d.Icon = icon; - d.halt = halt; - - hash = GetOnceMsgHash(title, message); - Format(valuename, sizeof(valuename), ONCE_MSG_REGVALUE, hash); - - if (MsRegReadInt(REG_CURRENT_USER, ONCE_MSG_REGKEY, valuename) == 0) - { - switch (icon) - { - case ICO_WARNING: - MessageBeep(MB_ICONEXCLAMATION); - break; - - case ICO_INFORMATION: - MessageBeep(MB_ICONASTERISK); - break; - } - - Dialog(hWnd, D_ONCEMSG, OnceMsgProc, &d); - - if (show_checkbox) - { - if (d.Checked) - { - MsRegWriteInt(REG_CURRENT_USER, ONCE_MSG_REGKEY, valuename, 1); - } - } - } -} - -// Get the message hash -UINT GetOnceMsgHash(wchar_t *title, wchar_t *message) -{ - BUF *b; - UCHAR hash[SHA1_SIZE]; - UINT ret; - // Validate arguments - if (title == NULL) - { - title = title_bar; - } - if (message == NULL) - { - message = L"message"; - } - - b = NewBuf(); - // 2013.5.19: Exclude the title from the hash calculation - //WriteBuf(b, title, UniStrSize(title)); - WriteBuf(b, message, UniStrSize(message)); - Sha1(hash, b->Buf, b->Size); - FreeBuf(b); - - Copy(&ret, hash, sizeof(UINT)); - - return ret; -} - -// Set a theme for Windows Vista -void InitVistaWindowTheme(HWND hWnd) -{ - static HINSTANCE hInstDll = NULL; - HRESULT (WINAPI *_SetWindowTheme)(HWND, LPCWSTR, LPCWSTR) = NULL; - - if (MsIsVista() == false) - { - return; - } - - if (hInstDll == NULL) - { - hInstDll = LoadLibraryA("uxtheme.dll"); - } - - if (hInstDll == NULL) - { - return; - } - - if (_SetWindowTheme == NULL) - { - _SetWindowTheme = (HRESULT (WINAPI *)(HWND,LPCWSTR,LPCWSTR))GetProcAddress(hInstDll, "SetWindowTheme"); - } - - if (_SetWindowTheme == NULL) - { - return; - } - - _SetWindowTheme(hWnd, L"explorer", NULL); -} - -// Register all applications to be registered in the Windows firewall -// that may be present in the current directory -void RegistWindowsFirewallAll() -{ - char exedir[MAX_SIZE]; - - GetExeDir(exedir, sizeof(exedir)); - - RegistWindowsFirewallAllEx(exedir); -} -void RegistWindowsFirewallAllEx(char *dir) -{ - MsRegistWindowsFirewallEx2(CEDAR_CLIENT_STR, "vpnclient.exe", dir); - MsRegistWindowsFirewallEx2(CEDAR_CLIENT_MANAGER_STR, "vpncmgr.exe", dir); - MsRegistWindowsFirewallEx2(CEDAR_MANAGER_STR, "vpnsmgr.exe", dir); - MsRegistWindowsFirewallEx2(CEDAR_SERVER_STR, "vpnserver.exe", dir); - MsRegistWindowsFirewallEx2(CEDAR_BRIDGE_STR, "vpnbridge.exe", dir); - MsRegistWindowsFirewallEx2(CEDAR_CUI_STR, "vpncmd.exe", dir); - MsRegistWindowsFirewallEx2(CEDAR_PRODUCT_STR, "vpntest.exe", dir); -} - -// Check whether the notification service is already running -bool Win32CnCheckAlreadyExists(bool lock) -{ - char tmp[MAX_SIZE]; - HANDLE hMutex; - - HashInstanceNameLocal(tmp, sizeof(tmp), CLIENT_NOTIFY_SERVICE_INSTANCENAME); - - hMutex = OpenMutex(MUTEX_ALL_ACCESS, FALSE, tmp); - if (hMutex != NULL) - { - CloseHandle(hMutex); - return true; - } - - if (lock == false) - { - return false; - } - - hMutex = CreateMutex(NULL, FALSE, tmp); - if (hMutex == NULL) - { - CloseHandle(hMutex); - return true; - } - - return false; -} - -// Show the Easter Egg -void ShowEasterEgg(HWND hWnd) -{ -} - -void KakushiThread(THREAD *thread, void *param) -{ - KAKUSHI *k; - // Validate arguments - if (thread == NULL || param == NULL) - { - return; - } - - k = (KAKUSHI *)param; - - k->Thread = thread; - AddRef(k->Thread->ref); - NoticeThreadInit(thread); - - Dialog(NULL, D_CM_KAKUSHI, KakushiDlgProc, k); - k->hWnd = NULL; -} - -KAKUSHI *InitKakushi() -{ - THREAD *t; - KAKUSHI *k = ZeroMalloc(sizeof(KAKUSHI)); - - t = NewThread(KakushiThread, k); - - WaitThreadInit(t); - ReleaseThread(t); - - return k; -} - -UINT KakushiDlgProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param) -{ - KAKUSHI *k = (KAKUSHI *)param; - UINT64 now; - bool b; - if (hWnd == NULL) - { - return 0; - } - - switch (msg) - { - case WM_INITDIALOG: - SetText(hWnd, S_INFO, _UU("CM_VLAN_CREATING")); - - b = false; - - if (MsIsVista()) - { - if (_GETLANG() == 0) - { - SetFont(hWnd, S_INFO, GetFont(GetMeiryoFontName(), 11, false, false, false, false)); - b = true; - } - else if (_GETLANG() == 2) - { - SetFont(hWnd, S_INFO, GetFont("Microsoft YaHei", 11, false, false, false, false)); - b = true; - } - else if (_GETLANG() == 3) - { - SetFont(hWnd, S_INFO, GetFont("Microsoft JhengHei", 11, false, false, false, false)); - b = true; - } - } - - if (b == false) - { - DlgFont(hWnd, S_INFO, 11, false); - } - - SetTimer(hWnd, 1, 50, NULL); - k->hWnd = hWnd; - - k->Span = 20 * 1000; - k->StartTick = Tick64(); - - SetRange(hWnd, P_PROGRESS, 0, (UINT)k->Span); - - case WM_APP + 9821: - now = Tick64(); - - if (((k->StartTick + k->Span) <= now) || k->Halt) - { - EndDialog(hWnd, 0); - break; - } - - SetPos(hWnd, P_PROGRESS, (UINT)(now - k->StartTick)); - break; - - case WM_TIMER: - switch (wParam) - { - case 1: - AllowSetForegroundWindow(ASFW_ANY); - SetForegroundWindow(hWnd); - SetActiveWindow(hWnd); - - now = Tick64(); - - if (((k->StartTick + k->Span) <= now) || k->Halt) - { - EndDialog(hWnd, 0); - break; - } - - SetPos(hWnd, P_PROGRESS, (UINT)(now - k->StartTick)); - break; - } - break; - - case WM_CLOSE: - return 1; - } - - return 0; -} - -// Release the Kakushi screen -void FreeKakushi(KAKUSHI *k) -{ - // Validate arguments - if (k == NULL) - { - return; - } - - k->Halt = true; - - if (k->hWnd != NULL) - { - PostMessage(k->hWnd, WM_APP + 9821, 0, 0); - } - - WaitThread(k->Thread, INFINITE); - ReleaseThread(k->Thread); - - Free(k); -} - -// TCP/IP optimization selection dialog procedure -UINT TcpMsgDlgProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param) -{ - UINT ret; - // Validate arguments - if (hWnd == NULL) - { - return 0; - } - - switch (msg) - { - case WM_INITDIALOG: - SetIcon(hWnd, 0, ICO_SETUP); - //DlgFont(hWnd, R_OPTIMIZE, 0, true); - - Check(hWnd, R_NO, true); - - if (g_tcpip_topmost) - { - Top(hWnd); - } - - break; - - case WM_COMMAND: - switch (wParam) - { - case IDOK: - ret = 1; - if (IsChecked(hWnd, R_MANUAL)) - { - ret = 2; - } - else if (IsChecked(hWnd, R_NO)) - { - ret = 0; - } - - EndDialog(hWnd, ret); - break; - } - break; - - case WM_CLOSE: - return 1; - } - - return 0; -} - -// Initialize the dialog -void TcpIpDlgInit(HWND hWnd) -{ - MS_TCP tcp; - - SetIcon(hWnd, 0, ICO_SETUP); - - MsGetTcpConfig(&tcp); - - Check(hWnd, R_RECV_DISABLE, tcp.RecvWindowSize == 0); - Check(hWnd, R_RECV_ENABLE, tcp.RecvWindowSize != 0); - SetInt(hWnd, E_RECV, tcp.RecvWindowSize != 0 ? tcp.RecvWindowSize : DEFAULT_TCP_MAX_WINDOW_SIZE_RECV); - - Check(hWnd, R_SEND_DISABLE, tcp.SendWindowSize == 0); - Check(hWnd, R_SEND_ENABLE, tcp.SendWindowSize != 0); - SetInt(hWnd, E_SEND, tcp.SendWindowSize != 0 ? tcp.SendWindowSize : DEFAULT_TCP_MAX_WINDOW_SIZE_SEND); - - TcpIpDlgUpdate(hWnd); - - Top(hWnd); -} - -// Update the dialog -void TcpIpDlgUpdate(HWND hWnd) -{ - bool ok = true; - - SetEnable(hWnd, E_RECV, IsChecked(hWnd, R_RECV_ENABLE)); - SetEnable(hWnd, S_RECV, IsChecked(hWnd, R_RECV_ENABLE)); - SetEnable(hWnd, E_SEND, IsChecked(hWnd, R_SEND_ENABLE)); - SetEnable(hWnd, S_SEND, IsChecked(hWnd, R_SEND_ENABLE)); - - if (IsChecked(hWnd, R_RECV_ENABLE) && GetInt(hWnd, E_RECV) < 1454) - { - ok = false; - } - - if (IsChecked(hWnd, R_SEND_ENABLE) && GetInt(hWnd, E_SEND) < 1454) - { - ok = false; - } - - SetEnable(hWnd, IDOK, ok); -} - -// TCP/IP dialog procedure -UINT TcpIpDlgProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param) -{ - MS_TCP tcp, old; - // Validate arguments - if (hWnd == NULL) - { - return 0; - } - - switch (msg) - { - case WM_INITDIALOG: - TcpIpDlgInit(hWnd); - - if (g_tcpip_topmost) - { - Top(hWnd); - } - - break; - - case WM_COMMAND: - switch (LOWORD(wParam)) - { - case R_RECV_DISABLE: - case R_RECV_ENABLE: - case R_SEND_DISABLE: - case R_SEND_ENABLE: - case E_RECV: - case E_SEND: - TcpIpDlgUpdate(hWnd); - break; - } - - switch (wParam) - { - case IDOK: - Zero(&tcp, sizeof(tcp)); - - if (IsChecked(hWnd, R_RECV_ENABLE)) - { - tcp.RecvWindowSize = GetInt(hWnd, E_RECV); - } - - if (IsChecked(hWnd, R_SEND_ENABLE)) - { - tcp.SendWindowSize = GetInt(hWnd, E_SEND); - } - - MsGetTcpConfig(&old); - - MsSetTcpConfig(&tcp); - MsSaveTcpConfigReg(&tcp); - - EndDialog(hWnd, true); - break; - - case IDCANCEL: - Close(hWnd); - break; - - case R_RECV_ENABLE: - FocusEx(hWnd, E_RECV); - break; - - case R_SEND_ENABLE: - FocusEx(hWnd, E_SEND); - break; - - case B_RECV: - SetInt(hWnd, E_RECV, DEFAULT_TCP_MAX_WINDOW_SIZE_RECV); - Check(hWnd, R_RECV_DISABLE, false); - Check(hWnd, R_RECV_ENABLE, true); - TcpIpDlgUpdate(hWnd); - FocusEx(hWnd, E_RECV); - break; - - case B_SEND: - SetInt(hWnd, E_SEND, DEFAULT_TCP_MAX_WINDOW_SIZE_SEND); - Check(hWnd, R_SEND_DISABLE, false); - Check(hWnd, R_SEND_ENABLE, true); - TcpIpDlgUpdate(hWnd); - FocusEx(hWnd, E_SEND); - break; - - case B_DELETE: - Zero(&tcp, sizeof(tcp)); - MsSetTcpConfig(&tcp); - MsDeleteTcpConfigReg(); - EndDialog(hWnd, 0); - break; - } - break; - - case WM_CLOSE: - EndDialog(hWnd, false); - break; - } - - return 0; -} - -// Warning dialog about 64-bit -UINT Cpu64DlgProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param) -{ - switch (msg) - { - case WM_INITDIALOG: - SetIcon(hWnd, 0, ICO_WARNING); - DlgFont(hWnd, S_BOLD, 9, true); - SetTimer(hWnd, 1, 30 * 1000, NULL); - break; - - case WM_TIMER: - switch (wParam) - { - case 1: - KillTimer(hWnd, 1); - Command(hWnd, IDOK); - break; - } - - break; - - case WM_COMMAND: - switch (wParam) - { - case IDOK: - case IDCANCEL: - Close(hWnd); - break; - } - break; - - case WM_CLOSE: - EndDialog(hWnd, 0); - break; - } - - return 0; -} - -// Display a warning dialog about 64-bit -void ShowCpu64Warning() -{ - Dialog(NULL, D_CPU64_WARNING, Cpu64DlgProc, NULL); -} - -// Show the TCP/IP configuration utility -void ShowTcpIpConfigUtil(HWND hWnd, bool util_mode) -{ - if (MsIsTcpConfigSupported() == false) - { - if (util_mode) - { - // Show a message that is not supported by the current OS - if (MsIsAdmin() == false) - { - MsgBox(hWnd, MB_ICONINFORMATION, _UU("TCPOPT_NOT_ADMIN")); - } - else - { - MsgBox(hWnd, MB_ICONINFORMATION, _UU("TCPOPT_NOT_SUPPORTED")); - } - } - return; - } - - if (util_mode == false) - { - // Exit immediately by start the vpncmd - wchar_t tmp[MAX_PATH]; - wchar_t exedir[MAX_PATH]; - HANDLE h; - - GetExeDirW(exedir, sizeof(exedir)); - - if (IsX64()) - { - UniFormat(tmp, sizeof(tmp), L"%s\\vpncmd_x64.exe", exedir); - } - else if (IsIA64()) - { - UniFormat(tmp, sizeof(tmp), L"%s\\vpncmd_ia64.exe", exedir); - } - else - { - UniFormat(tmp, sizeof(tmp), L"%s\\vpncmd.exe", exedir); - } - - if (IsFileW(tmp)) - { - RunW(tmp, L"/tool /cmd:exit", true, false); - } - - // Disable the task off-loading by netsh - if (MsIsVista()) - { - DIRLIST *dl; - UINT i; - bool b = false; - - dl = EnumDirW(exedir); - - for (i = 0;i < dl->NumFiles;i++) - { - if (UniInStr(dl->File[i]->FileNameW, L"vpnbridge") || - UniInStr(dl->File[i]->FileNameW, L"vpnserver")) - { - b = true; - } - } - - FreeDir(dl); - - if (b) - { - // Disable the off-loading - MsDisableNetworkOffloadingEtc(); - } - } - - // Windows Firewall registration - RegistWindowsFirewallAll(); - - SleepThread(1000); - - // Start vpnclient.exe /uihelp - h = CmExecUiHelperMain(); - if (h != NULL) - { - CloseHandle(h); - } - - if (Is64() == false) - { - if (MsIs64BitWindows()) - { - // Show a warning message if a 32-bit version is used in 64-bit Windows - ShowCpu64Warning(); - } - } - - if (MsIsAdmin()) - { - if (MsIsVista()) - { - // If installing on Windows Vista, - // dispel the network limitation of MMCSS - if (MsIsMMCSSNetworkThrottlingEnabled()) - { - MsSetMMCSSNetworkThrottlingEnable(false); - } - } - } - } - - if (util_mode == false && MsIsShouldShowTcpConfigApp() == false) - { - return; - } - - if (util_mode == false) - { - // 2006.07.04 nobori - // I decided not to show TCP/IP optimization utility in the installer - return; - } - - g_tcpip_topmost = util_mode ? false : true; - - if (util_mode == false) - { - UINT ret = Dialog(hWnd, D_TCP_MSG, TcpMsgDlgProc, NULL); - - if (ret == 0) - { - MS_TCP tcp; - - Zero(&tcp, sizeof(tcp)); - MsGetTcpConfig(&tcp); - MsSaveTcpConfigReg(&tcp); - return; - } - else if (ret == 1) - { - MS_TCP tcp; - - Zero(&tcp, sizeof(tcp)); - - tcp.RecvWindowSize = DEFAULT_TCP_MAX_WINDOW_SIZE_RECV; - tcp.SendWindowSize = DEFAULT_TCP_MAX_WINDOW_SIZE_SEND; - MsSetTcpConfig(&tcp); - MsSaveTcpConfigReg(&tcp); - - return; - } - } - - Dialog(hWnd, D_TCP, TcpIpDlgProc, NULL); -} - -// Internationalization of menu (Unicode) -void InitMenuInternationalUni(HMENU hMenu, char *prefix) -{ - UINT i, num; - // Validate arguments - if (hMenu == NULL || prefix == NULL) - { - return; - } - - // Get the number of items in the menu - num = GetMenuItemCount(hMenu); - - // Enumerate the menu items - for (i = 0;i < num;i++) - { - HMENU hSubMenu = GetSubMenu(hMenu, i); - MENUITEMINFOW info; - wchar_t tmp[MAX_SIZE]; - - if (hSubMenu != NULL) - { - // If there is a sub-menu, call it recursively - InitMenuInternational(hSubMenu, prefix); - } - - // Get the menu item - Zero(&info, sizeof(info)); - info.cbSize = sizeof(info); - info.cch = sizeof(tmp); - info.dwTypeData = tmp; - info.fMask = MIIM_STRING; - Zero(tmp, sizeof(tmp)); - - if (GetMenuItemInfoW(hMenu, i, true, &info)) - { - if (tmp[0] == L'@') - { - char name[256]; - wchar_t *ret; - - Format(name, sizeof(name), "%s@%S", prefix, &tmp[1]); - - ret = _UU(name); - if (UniIsEmptyStr(ret) == false) - { - UniStrCpy(tmp, sizeof(tmp), ret); - info.cch = UniStrLen(tmp); - - SetMenuItemInfoW(hMenu, i, true, &info); - } - } - } - } -} - -// Internationalization of menu -void InitMenuInternational(HMENU hMenu, char *prefix) -{ - UINT i, num; - // Validate arguments - if (hMenu == NULL || prefix == NULL) - { - return; - } - - if (MsIsNt()) - { - InitMenuInternationalUni(hMenu, prefix); - return; - } - - // Get the number of items in the menu - num = GetMenuItemCount(hMenu); - - // Enumerate the menu items - for (i = 0;i < num;i++) - { - HMENU hSubMenu = GetSubMenu(hMenu, i); - MENUITEMINFO info; - char tmp[MAX_SIZE]; - - if (hSubMenu != NULL) - { - // If there is a sub-menu, call it recursively - InitMenuInternational(hSubMenu, prefix); - } - - // Get the menu item - Zero(&info, sizeof(info)); - info.cbSize = sizeof(info); - info.cch = sizeof(tmp); - info.dwTypeData = tmp; - info.fMask = MIIM_STRING; - Zero(tmp, sizeof(tmp)); - - if (GetMenuItemInfo(hMenu, i, true, &info)) - { - if (tmp[0] == '@') - { - char name[256]; - char *ret; - - Format(name, sizeof(name), "%s@%s", prefix, &tmp[1]); - - ret = _SS(name); - if (IsEmptyStr(ret) == false) - { - StrCpy(tmp, sizeof(tmp), ret); - info.cch = StrLen(tmp); - - SetMenuItemInfo(hMenu, i, true, &info); - } - } - } - } -} - -// Get the default font for the dialog box -HFONT GetDialogDefaultFont() -{ - return GetDialogDefaultFontEx(false); -} -HFONT GetDialogDefaultFontEx(bool meiryo) -{ - char *default_font_name = _SS("DEFAULT_FONT"); - UINT default_font_size = _II("DEFAULT_FONT_SIZE"); - char *win7_font = _SS("DEFAULT_FONT_WIN7"); - - if (meiryo) - { - if (_GETLANG() == 2) - { - default_font_name = "Microsoft YaHei"; - } - if (_GETLANG() == 3) - { - default_font_name = "Microsoft JhengHei"; - } - else - { - default_font_name = GetMeiryoFontName(); - } - } - - if (MsIsWindows7()) - { - if (IsEmptyStr(win7_font) == false) - { - default_font_name = win7_font; - } - - if (GetTextScalingFactor() >= 1.44) - { - // Use a substitute font in the case of high-DPI in Windows 7 and later - char *alternative_font = _SS("DEFAULT_FONT_HIGHDPI"); - - if (IsEmptyStr(alternative_font) == false) - { - default_font_name = alternative_font; - } - } - } - - if (IsEmptyStr(default_font_name)) - { - default_font_name = font_name; - } - - if (default_font_size == 0) - { - default_font_size = 9; - } - - return GetFont(default_font_name, default_font_size, false, false, false, false); -} - -// Adjust the control size and window size -void AdjustWindowAndControlSize(HWND hWnd, bool *need_resize, double *factor_x, double *factor_y) -{ - HFONT hDlgFont; - UINT dlgfont_x, dlgfont_y; - RECT rect, rect2; - LIST *o; - UINT i; - // Validate arguments - if (hWnd == NULL || need_resize == NULL || factor_x == NULL || factor_y == NULL) - { - return; - } - - *need_resize = true; - - // Get the font of the current window - hDlgFont = (HFONT)SendMsg(hWnd, 0, WM_GETFONT, 0, 0); - - // Get the width and height of the font of the current window - CalcFontSize(hDlgFont, &dlgfont_x, &dlgfont_y); - - if ((dlgfont_x == WINUI_DEFAULT_DIALOG_UNIT_X) && - (dlgfont_y == WINUI_DEFAULT_DIALOG_UNIT_Y)) - { - // There is no need to adjust - *need_resize = false; - *factor_x = 1.0; - *factor_y = 1.0; - //Debug("// There is no need to adjust\n"); - return; - } - - // Calculate the adjustment amount - *factor_x = (double)dlgfont_x / (double)WINUI_DEFAULT_DIALOG_UNIT_X; - *factor_y = (double)dlgfont_y / (double)WINUI_DEFAULT_DIALOG_UNIT_Y; - //Debug("Factors: %f %f\n", *factor_x, *factor_y); - - if (MsIsVista()) - { - // In Windows Vista or later, trust the size expansion by the OS to follow this (not adjusted) - return; - } - - // Adjust the size of the window - if (GetWindowRect(hWnd, &rect)) - { - if (GetClientRect(hWnd, &rect2)) - { - UINT width = rect2.right - rect2.left; - UINT height = rect2.bottom - rect2.top; - - AdjustDialogXY(&width, &height, dlgfont_x, dlgfont_y); - - width += (rect.right - rect.left) - (rect2.right - rect2.left); - height += (rect.bottom - rect.top) - (rect2.bottom - rect2.top); - - if (true) - { - HWND hParent = GetParent(hWnd); - - if (hParent != NULL) - { - RECT r; - - Zero(&r, sizeof(r)); - - if (GetWindowRect(hParent, &r)) - { - RECT r2; - - rect.top = r.top + GetSystemMetrics(SM_CYCAPTION); - - Zero(&r2, sizeof(r2)); - if (SystemParametersInfo(SPI_GETWORKAREA, 0, &r2, 0)) - { - if (r2.bottom < (rect.top + (int)height)) - { - rect.top -= (rect.top + (int)height) - r2.bottom; - - if (rect.top < 0) - { - rect.top = 0; - } - } - } - } - } - } - - MoveWindow(hWnd, rect.left, rect.top, width, height, false); - } - } - - // Enumerate the child windows - o = EnumAllChildWindowEx(hWnd, false, true, true); - - for (i = 0;i < LIST_NUM(o);i++) - { - // Adjust the size of the child window - HWND h = *((HWND *)LIST_DATA(o, i)); - HWND hWndParent = GetParent(h); - RECT current_rect; - char class_name[MAX_PATH]; - bool is_image = false; - - // Get the class name - Zero(class_name, sizeof(class_name)); - GetClassNameA(h, class_name, sizeof(class_name)); - - if (StrCmpi(class_name, "static") == 0) - { - if (SendMsg(h, 0, STM_GETIMAGE, IMAGE_BITMAP, 0) != 0 || - SendMsg(h, 0, STM_GETIMAGE, IMAGE_ICON, 0) != 0 || - SendMsg(h, 0, STM_GETICON, 0, 0) != 0) - { - is_image = true; - } - } - - // Get the position - if (GetWindowRect(h, ¤t_rect)) - { - // Convert to client coordinates - POINT p1, p2; - - p1.x = current_rect.left; - p1.y = current_rect.top; - - p2.x = current_rect.right; - p2.y = current_rect.bottom; - - ScreenToClient(hWndParent, &p1); - ScreenToClient(hWndParent, &p2); - - // Adjust the position - AdjustDialogXY(&p1.x, &p1.y, dlgfont_x, dlgfont_y); - AdjustDialogXY(&p2.x, &p2.y, dlgfont_x, dlgfont_y); - - if (is_image) - { - p2.x = p1.x + (current_rect.right - current_rect.left); - p2.y = p1.y + (current_rect.bottom - current_rect.top); - } - - // Move - MoveWindow(h, p1.x, p1.y, p2.x - p1.x, p2.y - p1.y, false); - } - } - - FreeWindowList(o); -} - -// Adjust the values of x and y according to the font -void AdjustDialogXY(UINT *x, UINT *y, UINT dlgfont_x, UINT dlgfont_y) -{ - if (x != NULL) - { - *x = (UINT)(((double)*x) * (double)WINUI_DEFAULT_DIALOG_UNIT_X / (double)dlgfont_x); - } - - if (y != NULL) - { - *y = (UINT)(((double)*y) * (double)WINUI_DEFAULT_DIALOG_UNIT_Y / (double)dlgfont_y); - } -} - -// Internationalizing process for the dialog box -void InitDialogInternational(HWND hWnd, void *pparam) -{ - LIST *o; - UINT i; - bool is_managed_dialog = false; - char caption[MAX_PATH]; - char *dialog_name; - DIALOG_PARAM *param = (DIALOG_PARAM *)pparam; - HDC hDC; - bool need_resize = false; - double factor_x = 0.0, factor_y = 0.0; - // Validate arguments - if (hWnd == NULL || param == NULL) - { - return; - } - - hDC = CreateCompatibleDC(NULL); - - AdjustWindowAndControlSize(hWnd, &need_resize, &factor_x, &factor_y); - - GetTxtA(hWnd, 0, caption, sizeof(caption)); - if (caption[0] == '@') - { - dialog_name = &caption[1]; - - is_managed_dialog = true; - } - - // Enumerate all window handles - o = EnumAllChildWindow(hWnd); - - for (i = 0;i < LIST_NUM(o);i++) - { - HWND hControl = *((HWND *)LIST_DATA(o, i)); - - if (hControl != NULL) - { - bool set_font = true; - HFONT hFont = GetDialogDefaultFontEx(param && ((DIALOG_PARAM *)param)->meiryo); - - if (MsIsWine()) - { - char classname[MAX_PATH]; - char parent_classname[MAX_PATH]; - HWND hParent = GetParent(hControl); - - Zero(classname, sizeof(classname)); - Zero(parent_classname, sizeof(parent_classname)); - - GetClassNameA(hControl, classname, sizeof(classname)); - - if (hParent != NULL) - { - GetClassNameA(hParent, parent_classname, sizeof(parent_classname)); - } - - if (StrCmpi(classname, "edit") == 0) - { - set_font = false; - } - - if (StrCmpi(classname, "combobox") == 0) - { - set_font = false; - } - - if (StrCmpi(classname, "syslistview32") == 0) - { - set_font = false; - } - - if (StrCmpi(classname, "sysheader32") == 0) - { - set_font = false; - } - - if (StrCmpi(parent_classname, "SysIPAddress32") == 0 || - StrCmpi(classname, "SysIPAddress32") == 0) - { - set_font = true; - hFont = GetFont("Tahoma", 8, false, false, false, false); - } - } - - if (set_font) - { - SetFont(hControl, 0, hFont); - } - - if (MsIsVista()) - { - char classname[MAX_PATH]; - GetClassNameA(hControl, classname, sizeof(classname)); - - if (StrCmpi(classname, "syslistview32") == 0) - { - InitVistaWindowTheme(hControl); - } - } - - if (is_managed_dialog) - { - char str[MAX_PATH]; - - GetTxtA(hControl, 0, str, sizeof(str)); - if (str[0] == '@') - { - char *control_name = &str[1]; - char tmp[MAX_PATH]; - wchar_t *ret; - - StrCpy(tmp, sizeof(tmp), dialog_name); - StrCat(tmp, sizeof(tmp), "@"); - - if (hWnd == hControl) - { - StrCat(tmp, sizeof(tmp), "CAPTION"); - } - else - { - StrCat(tmp, sizeof(tmp), control_name); - } - - ret = _UU(tmp); - - if (ret != NULL && UniIsEmptyStr(ret) == false) - { - SetText(hControl, 0, ret); - } - } - } - } - } - - FreeWindowList(o); - - if (MsIsVista() && need_resize) - { - // Since the window size is changed automatically by the OS by the dpi setting - // in Windows Vista or later, a static (bitmap) control needs to be expanded - // by anticipating the size after changing - - // Enumerate all child window (not recursive) - o = EnumAllChildWindowEx(hWnd, true, false, true); - - for (i = 0;i < LIST_NUM(o);i++) - { - HWND hControl = *((HWND *)LIST_DATA(o, i)); - - if (hControl != NULL) - { - char class_name[MAX_SIZE]; - - Zero(class_name, sizeof(class_name)); - GetClassNameA(hControl, class_name, sizeof(class_name)); - - if (StrCmpi(class_name, "static") == 0) - { - UINT style = GetStyle(hControl, 0); - - if (style & SS_BITMAP) - { - // Get the Bitmap - HBITMAP hBitmap = (HBITMAP)SendMessage(hControl, STM_GETIMAGE, IMAGE_BITMAP, 0); - - if (hBitmap != NULL) - { - // Get the size of this bitmap - UINT src_x; - UINT src_y; - - if (GetBitmapSize(hBitmap, &src_x, &src_y)) - { - RECT ctl_rect; - - Zero(&ctl_rect, sizeof(ctl_rect)); - - if (GetWindowRect(hControl, &ctl_rect)) - { - // Use the smaller magnification of the height and the width - //double scale_factor = 1.5; - double scale_factor = MIN(factor_x, factor_y); - UINT dst_x = (UINT)((double)src_x * scale_factor); - UINT dst_y = (UINT)((double)src_y * scale_factor); - - HBITMAP hDst = ResizeBitmap(hBitmap, src_x, src_y, dst_x, dst_y); - - if (hDst != NULL) - { - Add(param->BitmapList, hDst); - - SendMessage(hControl, STM_SETIMAGE, IMAGE_BITMAP, (LPARAM)hDst); - } - } - } - } - } - } - } - } - - FreeWindowList(o); - } - - DeleteDC(hDC); -} - -// Get the size of the bitmap -bool GetBitmapSize(void *bmp, UINT *x, UINT *y) -{ - BITMAP info; - // Validate arguments - if (bmp == NULL || x == NULL || y == NULL) - { - return false; - } - - Zero(&info, sizeof(info)); - if (GetObject((HANDLE)bmp, sizeof(info), &info) == 0) - { - return false; - } - - *x = info.bmWidth; - *y = info.bmHeight; - - return true; -} - -// Resize the bitmap -HBITMAP ResizeBitmap(HBITMAP hSrc, UINT src_x, UINT src_y, UINT dst_x, UINT dst_y) -{ - HDC hMemDC; - HDC hSrcDC; - HBITMAP ret = NULL; - BITMAPINFOHEADER h; - BITMAPINFO bi; - UCHAR *data = NULL; - // Validate arguments - if (hSrc == NULL) - { - return NULL; - } - - hSrcDC = CreateCompatibleDC(NULL); - if (hSrcDC != NULL) - { - HBITMAP hOld = SelectObject(hSrcDC, hSrc); - - if (hOld != NULL) - { - hMemDC = CreateCompatibleDC(NULL); - - if (hMemDC != NULL) - { - HBITMAP hOld; - HBITMAP srcHbitMap; - UCHAR* srcData; - CT_RectF_c destRect; - CT_RectF_c srcRect; - - Zero(&h, sizeof(h)); - h.biSize = sizeof(h); - h.biWidth = src_x; - h.biHeight = src_y; - h.biPlanes = 1; - h.biBitCount = 32; - h.biXPelsPerMeter = 2834; - h.biYPelsPerMeter = 2834; - h.biCompression = BI_RGB; - - // Copy once the transfer source - Zero(&bi, sizeof(bi)); - Copy(&bi.bmiHeader, &h, sizeof(BITMAPINFOHEADER)); - srcHbitMap = CreateDIBSection(hMemDC, &bi, DIB_RGB_COLORS, &srcData, NULL, 0); - - hOld = SelectObject(hMemDC, srcHbitMap); - - BitBlt(hMemDC,0,0,src_x,src_y,hSrcDC,0,0, SRCCOPY); - - GdiFlush(); - - - - // Generate a resized version - if(src_x != dst_x || src_y != dst_y) - { - h.biWidth = dst_x; - h.biHeight = dst_y; - Zero(&bi, sizeof(bi)); - Copy(&bi.bmiHeader, &h, sizeof(BITMAPINFOHEADER)); - - ret = CreateDIBSection(hMemDC, &bi, DIB_RGB_COLORS, &data, NULL, 0); - - if(srcData != NULL && data != NULL) - { - destRect.X = 0; destRect.Y = 0; - destRect.Width = (float)dst_x; destRect.Height = (float)dst_y; - srcRect = destRect; - srcRect.Width = (float)src_x; srcRect.Height = (float)src_y; - - CT_DrawImage((UCHAR*)data, destRect, dst_x,dst_y, - (UCHAR*)srcData, srcRect,src_x, src_y); - } - - if(srcHbitMap != NULL) - { - DeleteObject(srcHbitMap); - } - } - else - { - ret = srcHbitMap; - } - - SelectObject(hMemDC, hOld); - - DeleteDC(hMemDC); - } - - SelectObject(hSrcDC, hOld); - } - - DeleteDC(hSrcDC); - } - - return ret; -} - -// Initialize the bitmap list -LIST *NewBitmapList() -{ - LIST *o = NewListFast(NULL); - - return o; -} - -// Release the bitmap list -void FreeBitmapList(LIST *o) -{ - UINT i; - // Validate arguments - if (o == NULL) - { - return; - } - - for (i = 0;i < LIST_NUM(o);i++) - { - HBITMAP *h = LIST_DATA(o, i); - - DeleteObject(h); - } - - ReleaseList(o); -} - -// Child window enumeration procedure -// Initialize the dialog -void StringDlgInit(HWND hWnd, STRING_DLG *s) -{ - // Validate arguments - if (hWnd == NULL || s == NULL) - { - return; - } - - SetText(hWnd, E_STRING, s->String); - - SetIcon(hWnd, S_ICON, s->Icon); - SetText(hWnd, S_INFO, s->Info); - SetText(hWnd, 0, s->Title); - - FocusEx(hWnd, E_STRING); - - StringDlgUpdate(hWnd, s); -} - -// Update the dialog control -void StringDlgUpdate(HWND hWnd, STRING_DLG *s) -{ - wchar_t *tmp; - bool b = true; - // Validate arguments - if (hWnd == NULL || s == NULL) - { - return; - } - - tmp = GetText(hWnd, E_STRING); - - if (tmp != NULL) - { - if (s->AllowEmpty == false) - { - if (UniIsEmptyStr(tmp)) - { - b = false; - } - } - - if (s->AllowUnsafe == false) - { - if (IsSafeUniStr(tmp) == false) - { - b = false; - } - } - - Free(tmp); - } - - SetEnable(hWnd, IDOK, b); -} - -// String dialog procedure -UINT StringDlgProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param) -{ - STRING_DLG *s = (STRING_DLG *)param; - // Validate arguments - if (hWnd == NULL) - { - return 0; - } - - switch (msg) - { - case WM_INITDIALOG: - StringDlgInit(hWnd, s); - break; - - case WM_COMMAND: - switch (LOWORD(wParam)) - { - case E_STRING: - StringDlgUpdate(hWnd, s); - break; - } - - switch (wParam) - { - case IDOK: - GetTxt(hWnd, E_STRING, s->String, sizeof(s->String)); - EndDialog(hWnd, true); - break; - - case IDCANCEL: - Close(hWnd); - break; - } - break; - - case WM_CLOSE: - EndDialog(hWnd, false); - break; - } - - return 0; -} - -// Show the string dialog -wchar_t *StringDlg(HWND hWnd, wchar_t *title, wchar_t *info, wchar_t *def, UINT icon, bool allow_empty, bool allow_unsafe) -{ - STRING_DLG s; - // Validate arguments - if (title == NULL) - { - title = _UU("DLG_STRING_DEFTITLE"); - } - if (info == NULL) - { - info = _UU("DLG_STRING_DEFINFO"); - } - if (def == NULL) - { - def = L""; - } - if (icon == 0) - { - icon = ICO_NULL; - } - - Zero(&s, sizeof(s)); - s.Icon = icon; - s.Info = info; - s.Title = title; - s.Icon = icon; - UniStrCpy(s.String, sizeof(s.String), def); - s.AllowEmpty = allow_empty; - s.AllowUnsafe = allow_unsafe; - - if (Dialog(hWnd, D_STRING, StringDlgProc, &s) == false) - { - return NULL; - } - else - { - return CopyUniStr(s.String); - } -} -char *StringDlgA(HWND hWnd, wchar_t *title, wchar_t *info, char *def, UINT icon, bool allow_empty, bool allow_unsafe) -{ - wchar_t unidef[MAX_SIZE]; - wchar_t *tmp; - char *ret; - if (def == NULL) - { - def = ""; - } - - StrToUni(unidef, sizeof(unidef), def); - - tmp = StringDlg(hWnd, title, info, unidef, icon, allow_empty, allow_unsafe); - if (tmp == NULL) - { - return NULL; - } - - ret = CopyUniToStr(tmp); - Free(tmp); - - return ret; -} - -// Restarting dialog -UINT Win9xRebootDlgProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param) -{ - WIN9X_REBOOT_DLG *d = (WIN9X_REBOOT_DLG *)param; - UINT64 now; - wchar_t tmp[MAX_PATH]; - // Validate arguments - if (hWnd == NULL) - { - return 0; - } - - switch (msg) - { - case WM_INITDIALOG: - d->StartTime = Tick64(); - SetRange(hWnd, P_PROGRESS, 0, d->TotalTime); - SetTimer(hWnd, 1, 100, NULL); - goto UPDATE; - - case WM_TIMER: - switch (wParam) - { - case 1: -UPDATE: - now = Tick64(); - if ((d->StartTime + (UINT64)d->TotalTime) <= now) - { - KillTimer(hWnd, 1); - UniStrCpy(tmp, sizeof(tmp), _UU("DLG_REBOOT_INFO_2")); - SetText(hWnd, S_INFO, tmp); - if (MsShutdown(true, false) == false) - { - MsgBox(hWnd, MB_ICONSTOP, _UU("DLG_REBOOT_ERROR")); - } - EndDialog(hWnd, 0); - } - else - { - SetPos(hWnd, P_PROGRESS, (UINT)(now - d->StartTime)); - UniFormat(tmp, sizeof(tmp), _UU("DLG_REBOOT_INFO"), - (UINT)((UINT64)d->TotalTime - (now - d->StartTime)) / 1000 + 1); - SetText(hWnd, S_INFO, tmp); - } - - break; - } - break; - } - return 0; -} - -// Restarting thread -void Win9xRebootThread(THREAD *t, void *p) -{ - // Validate arguments - if (t == NULL) - { - return; - } - - Win9xReboot(NULL); -} - -// Restart automatically -void Win9xReboot(HWND hWnd) -{ - WIN9X_REBOOT_DLG d; - - Zero(&d, sizeof(d)); - d.TotalTime = 10 * 1000; - - Dialog(hWnd, D_WIN9X_REBOOT, Win9xRebootDlgProc, &d); -} - -// Show a text file -void ShowTextFile(HWND hWnd, char *filename, wchar_t *caption, UINT icon) -{ - BUF *b; - wchar_t *str; - // Validate arguments - if (filename == NULL || caption == NULL) - { - return; - } - if (icon == 0) - { - icon = ICO_NULL; - } - - // Read the text file - b = ReadDump(filename); - if (b == NULL) - { - return; - } - - SeekBufToEnd(b); - WriteBufChar(b, 0); - - str = CopyUtfToUni(b->Buf); - - OnceMsg(hWnd, caption, str, false, icon); - - FreeBuf(b); - Free(str); -} - -// Initialize the version information -void AboutDlgInit(HWND hWnd, WINUI_ABOUT *a) -{ - wchar_t tmp[MAX_SIZE]; - // Validate arguments - if (hWnd == NULL || a == NULL) - { - return; - } - - SetIcon(hWnd, 0, ICO_INFORMATION); - - UniFormat(tmp, sizeof(tmp), _UU("ABOUT_CAPTION"), a->ProductName); - SetText(hWnd, 0, tmp); - - SetFont(hWnd, S_INFO1, GetFont("Arial", 12, false, false, false, false)); - FormatText(hWnd, S_INFO1, CEDAR_VERSION_MAJOR, CEDAR_VERSION_MAJOR, CEDAR_VERSION_MINOR, CEDAR_VERSION_BUILD); - - SetFont(hWnd, S_INFO2, GetFont("Arial", 8, false, false, false, false)); - FormatText(hWnd, S_INFO2, BUILD_DATE_Y, a->Cedar->BuildInfo); - - SetFont(hWnd, S_INFO3, GetFont("Arial", 7, false, false, false, false)); - - if (MsIsWine()) - { - Disable(hWnd, B_LANGUAGE); - } - - //DlgFont(hWnd, S_INFO4, 8, false); - - SetShow(hWnd, B_UPDATE_CONFIG, (a->Update != NULL)); - - Show(hWnd, B_AUTHORS); -} - -// Version information procedure -UINT AboutDlgProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param) -{ - WINUI_ABOUT *a = (WINUI_ABOUT *)param; - char tmp[MAX_PATH]; - LANGLIST t; - // Validate arguments - if (hWnd == NULL) - { - return 0; - } - - switch (msg) - { - case WM_INITDIALOG: - AboutDlgInit(hWnd, a); - break; - - case WM_COMMAND: - switch (wParam) - { - case IDOK: - case IDCANCEL: - if ((GetKeyState(VK_SHIFT) & 0x8000) && - (GetKeyState(VK_CONTROL) & 0x8000) && - (GetKeyState(VK_MENU) & 0x8000)) - { - ShowEasterEgg(hWnd); - } - EndDialog(hWnd, true); - break; - case B_WEB: - ShellExecute(hWnd, "open", _SS("SE_COMPANY_URL"), NULL, NULL, SW_SHOW); - break; - case B_EULA: - ShowTextFile(hWnd, "|eula.txt", _UU("SW_EULA_TITLE"), ICO_LOG); - break; - case B_IMPORTANT: - GetCurrentLang(&t); - Format(tmp, sizeof(tmp), "|warning_%s.txt", t.Name); - ShowTextFile(hWnd, tmp, _UU("SW_WARNING_TITLE"), ICO_LOG); - break; - case B_LEGAL: - ShowTextFile(hWnd, "|legal.txt", _UU("DLG_ABOUT_LEGAL"), ICO_LOG); - break; - case B_UPDATE_CONFIG: - ConfigUpdateUi(a->Update, hWnd); - break; - case B_AUTHORS: - ShowTextFile(hWnd, "|authors.txt", _UU("DLG_ABOUT_AUTHORS"), ICO_ZURUHAM); - break; - case B_LANGUAGE: - // Language settings - if (true) - { - wchar_t path[MAX_SIZE]; - - CombinePathW(path, sizeof(path), MsGetExeDirNameW(), L"vpnsetup.exe"); - - if (IsFileExistsW(path)) - { - // with Installer - if (MsExecuteW(path, L"/language:yes") == false) - { - MsgBox(hWnd, MB_ICONEXCLAMATION, _UU("SW_CHILD_PROCESS_ERROR")); - } - } - else - { - // without Installer - CombinePathW(path, sizeof(path), MsGetExeDirNameW(), L"lang.config"); - if (MsExecuteW(path, L"") == false) - { - MsgBox(hWnd, MB_ICONEXCLAMATION, _UU("SW_CHILD_PROCESS_ERROR")); - } - } - } - break; - } - break; - - case WM_CLOSE: - EndDialog(hWnd, false); - break; - } - - return 0; -} - -// Version information -void About(HWND hWnd, CEDAR *cedar, wchar_t *product_name) -{ - AboutEx(hWnd, cedar, product_name, NULL); -} -void AboutEx(HWND hWnd, CEDAR *cedar, wchar_t *product_name, WINUI_UPDATE *u) -{ - WINUI_ABOUT a; - // Validate arguments - if (cedar == NULL || product_name == NULL) - { - return; - } - - Zero(&a, sizeof(a)); - a.Cedar = cedar; - a.ProductName = product_name; - a.Update = u; - - Dialog(hWnd, D_ABOUT, AboutDlgProc, &a); -} - -// Examine the number of fields that an IP address is entered -UINT IpGetFilledNum(HWND hWnd, UINT id) -{ - UINT ret; - DWORD value; - // Validate arguments - if (hWnd == NULL) - { - return 0; - } - - ret = SendMsg(hWnd, id, IPM_GETADDRESS, 0, (LPARAM)&value); - - return ret; -} - -// Examine whether an IP address has been entered -bool IpIsFilled(HWND hWnd, UINT id) -{ - UINT ret; - DWORD value; - // Validate arguments - if (hWnd == NULL) - { - return 0; - } - - ret = SendMsg(hWnd, id, IPM_GETADDRESS, 0, (LPARAM)&value); - - if (ret != 4) - { - return false; - } - else - { - return true; - } -} - -// Get an IP address -UINT IpGet(HWND hWnd, UINT id) -{ - UINT ret; - DWORD value; - // Validate arguments - if (hWnd == NULL) - { - return 0; - } - - ret = SendMsg(hWnd, id, IPM_GETADDRESS, 0, (LPARAM)&value); - - if (ret != 4) - { - return 0; - } - else - { - return Endian32((UINT)value); - } -} - -// Set the IP addresses -void IpSet(HWND hWnd, UINT id, UINT ip) -{ - // Validate arguments - if (hWnd == NULL) - { - return; - } - - SendMsg(hWnd, id, IPM_SETADDRESS, 0, Endian32(ip)); -} - -// Write the candidates to the registry -void WriteCandidateToReg(UINT root, char *key, LIST *o, char *name) -{ - BUF *b; - // Validate arguments - if (key == NULL || o == NULL || name == NULL) - { - return; - } - - b = CandidateToBuf(o); - if (b == NULL) - { - return; - } - - MsRegWriteBin(root, key, name, b->Buf, b->Size); - - FreeBuf(b); -} - -// Read the candidates from the registry -LIST *ReadCandidateFromReg(UINT root, char *key, char *name) -{ - BUF *b; - // Validate arguments - if (key == NULL || name == NULL) - { - return NULL; - } - - b = MsRegReadBin(root, key, name); - if (b == NULL) - { - return NewCandidateList(); - } - else - { - LIST *o = BufToCandidate(b); - FreeBuf(b); - - return o; - } -} - -// initialize the remote connection dialog -void RemoteDlgInit(HWND hWnd, WINUI_REMOTE *r) -{ - LIST *o; - UINT i; - // Validate arguments - if (hWnd == NULL || r == NULL) - { - return; - } - - SetIcon(hWnd, 0, r->Icon); - - SetText(hWnd, 0, r->Caption); - SetText(hWnd, S_TITLE, r->Title); - SetIcon(hWnd, S_ICON, r->Icon); - - // Read candidates - o = ReadCandidateFromReg(REG_CURRENT_USER, r->RegKeyName, "RemoteHostCandidate"); - r->CandidateList = o; - - // Show the candidates - for (i = 0;i < LIST_NUM(o);i++) - { - CANDIDATE *c = LIST_DATA(o, i); - CbAddStr(hWnd, C_HOSTNAME, c->Str, 0); - } - - if (r->DefaultHostname != NULL) - { - SetTextA(hWnd, C_HOSTNAME, r->DefaultHostname); - } - - FocusEx(hWnd, C_HOSTNAME); - - RemoteDlgRefresh(hWnd, r); -} - -// Remote connection dialog update -void RemoteDlgRefresh(HWND hWnd, WINUI_REMOTE *r) -{ - char *s; - bool ok = true; - bool localhost_mode = false; - // Validate arguments - if (hWnd == NULL || r == NULL) - { - return; - } - - s = GetTextA(hWnd, C_HOSTNAME); - if (s != NULL) - { - Trim(s); - if (StrCmpi(s, "localhost") == 0 || StartWith(s, "127.")) - { - localhost_mode = true; - } - Free(s); - } - - if (localhost_mode == false) - { - Enable(hWnd, C_HOSTNAME); - Enable(hWnd, S_HOSTNAME); - Check(hWnd, R_LOCAL, false); - } - else - { - if (r->Title != _UU("NM_CONNECT_TITLE")) - { - Disable(hWnd, C_HOSTNAME); - Disable(hWnd, S_HOSTNAME); - } - Check(hWnd, R_LOCAL, true); - SetTextA(hWnd, C_HOSTNAME, "localhost"); - - if (r->flag1 == false) - { - Focus(hWnd, IDOK); - } - } - - if (IsEmpty(hWnd, C_HOSTNAME)) - { - ok = false; - } - - SetEnable(hWnd, IDOK, ok); - - r->flag1 = true; -} - -// Remote connection dialog OK button -void RemoteDlgOnOk(HWND hWnd, WINUI_REMOTE *r) -{ - char *hostname; - wchar_t *s; - LIST *o; - // Validate arguments - if (hWnd == NULL || r == NULL) - { - return; - } - - // Get the entered host name - hostname = GetTextA(hWnd, C_HOSTNAME); - if (hostname == NULL) - { - return; - } - Trim(hostname); - - // Add a candidate - o = r->CandidateList; - s = CopyStrToUni(hostname); - AddCandidate(o, s, 64); - Free(s); - - // Write the candidates - WriteCandidateToReg(REG_CURRENT_USER, r->RegKeyName, o, "RemoteHostCandidate"); - FreeCandidateList(o); - - r->Hostname = hostname; - - EndDialog(hWnd, true); -} - -// Remote connection dialog procedure -UINT RemoteDlgProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param) -{ - WINUI_REMOTE *r = (WINUI_REMOTE *)param; - // Validate arguments - if (hWnd == NULL) - { - return 0; - } - - switch (msg) - { - case WM_INITDIALOG: - RemoteDlgInit(hWnd, r); - SetTimer(hWnd, 1, 100, NULL); - break; - case WM_TIMER: - switch (wParam) - { - case 1: - KillTimer(hWnd, 1); - RemoteDlgRefresh(hWnd, r); - SetTimer(hWnd, 1, 100, NULL); - break; - } - break; - case WM_COMMAND: - switch (wParam) - { - case R_LOCAL: - if (IsChecked(hWnd, R_LOCAL) == false) - { - SetTextA(hWnd, C_HOSTNAME, ""); - RemoteDlgRefresh(hWnd, r); - FocusEx(hWnd, C_HOSTNAME); - } - else - { - SetTextA(hWnd, C_HOSTNAME, "localhost"); - RemoteDlgRefresh(hWnd, r); - Focus(hWnd, IDOK); - } - break; - case IDCANCEL: - Close(hWnd); - break; - case IDOK: - RemoteDlgOnOk(hWnd, r); - break; - } - switch (LOWORD(wParam)) - { - case R_LOCAL: - case C_HOSTNAME: - RemoteDlgRefresh(hWnd, r); - break; - } - break; - case WM_CLOSE: - FreeCandidateList(r->CandidateList); - EndDialog(hWnd, false); - break; - } - - return 0; -} - -// Remote connection dialog -char *RemoteDlg(HWND hWnd, char *regkey, UINT icon, wchar_t *caption, wchar_t *title, char *default_host) -{ - WINUI_REMOTE r; - // Validate arguments - if (regkey == NULL) - { - regkey = "Software\\" GC_REG_COMPANY_NAME "\\" CEDAR_PRODUCT_STR " VPN\\WinUI Common Module"; - } - if (caption == NULL) - { - caption = _UU("REMOTE_DEF_CAPTION"); - } - if (title == NULL) - { - title = _UU("REMOTE_DEF_TITLE"); - } - if (icon == 0) - { - icon = ICO_INTERNET; - } - - Zero(&r, sizeof(r)); - r.RegKeyName = regkey; - r.Caption = caption; - r.Title = title; - r.Icon = icon; - r.DefaultHostname = default_host; - - if (Dialog(hWnd, D_REMOTE, RemoteDlgProc, &r) == false) - { - return NULL; - } - - return r.Hostname; -} - -// Window Searching procedure -bool CALLBACK SearchWindowEnumProc(HWND hWnd, LPARAM lParam) -{ - if (hWnd != NULL && lParam != 0) - { - wchar_t *s = GetText(hWnd, 0); - SEARCH_WINDOW_PARAM *p = (SEARCH_WINDOW_PARAM *)lParam; - if (s != NULL) - { - if (UniStrCmpi(p->caption, s) == 0) - { - p->hWndFound = hWnd; - } - Free(s); - } - } - return true; -} - -// Search for the window -HWND SearchWindow(wchar_t *caption) -{ - SEARCH_WINDOW_PARAM p; - // Validate arguments - if (caption == NULL) - { - return NULL; - } - - Zero(&p, sizeof(p)); - p.caption = caption; - p.hWndFound = NULL; - - EnumWindows(SearchWindowEnumProc, (LPARAM)&p); - - return p.hWndFound; -} - -// Allow for the specified process to become the foreground window -void AllowFGWindow(UINT process_id) -{ - if (process_id == 0) - { - return; - } - - if (OS_IS_WINDOWS_NT(GetOsInfo()->OsType) && - GET_KETA(GetOsInfo()->OsType, 100) >= 2) - { - AllowSetForegroundWindow(process_id); - } -} - -// Rename the item -void LvRename(HWND hWnd, UINT id, UINT pos) -{ - // Validate arguments - if (hWnd == NULL || pos == INFINITE) - { - return; - } - - ListView_EditLabel(DlgItem(hWnd, id), pos); -} - -// Enhanced function -LRESULT CALLBACK LvEnhancedProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam) -{ - WNDPROC func = NULL; - - if (MsIsNt()) - { - func = (WNDPROC)GetPropW(hWnd, L"ORIGINAL_FUNC"); - } - else - { - func = (WNDPROC)GetPropA(hWnd, "ORIGINAL_FUNC"); - } - - if (func == NULL) - { - Debug("LvEnhancedProc(): GetProp() returned NULL!\n"); - return 1; - } - - switch (msg) - { - case WM_HSCROLL: - case WM_VSCROLL: - case WM_MOUSEWHEEL: - { - // Prevent graphical glitches with the edit box by sending the NM_RETURN signal - // to the parent dialog (the parent dialog has to delete the edit box on NM_RETURN) - NMHDR nmh; - nmh.code = NM_RETURN; - nmh.idFrom = GetDlgCtrlID(hWnd); - nmh.hwndFrom = hWnd; - SendMsg(GetParent(hWnd), 0, WM_NOTIFY, nmh.idFrom, (LPARAM)&nmh); - - break; - } - case WM_CLOSE: - // Prevent list view from disappearing after pressing ESC in an edit box - return 0; - case WM_NCDESTROY: - // Restore original function during destruction - LvSetEnhanced(hWnd, 0, false); - } - - if (MsIsNt()) - { - return CallWindowProcW(func, hWnd, msg, wParam, lParam); - } - else - { - return CallWindowProcA(func, hWnd, msg, wParam, lParam); - } -} - -// Toggle enhanced function -void LvSetEnhanced(HWND hWnd, UINT id, bool enable) -{ - // Validate arguments - if (hWnd == NULL) - { - return; - } - - if (enable) - { - if (MsIsNt()) - { - const HANDLE fn = (HANDLE)SetWindowLongPtrW(DlgItem(hWnd, id), GWLP_WNDPROC, (LONG_PTR)LvEnhancedProc); - SetPropW(DlgItem(hWnd, id), L"ORIGINAL_FUNC", fn); - } - else - { - const HANDLE fn = (HANDLE)SetWindowLongPtrA(DlgItem(hWnd, id), GWLP_WNDPROC, (LONG_PTR)LvEnhancedProc); - SetPropA(DlgItem(hWnd, id), "ORIGINAL_FUNC", fn); - } - } - else - { - if (MsIsNt()) - { - SetWindowLongPtrW(DlgItem(hWnd, id), GWLP_WNDPROC, (LONG_PTR)GetPropW(DlgItem(hWnd, id), L"ORIGINAL_FUNC")); - RemovePropW(DlgItem(hWnd, id), L"ORIGINAL_FUNC"); - } - else - { - SetWindowLongPtrA(DlgItem(hWnd, id), GWLP_WNDPROC, (LONG_PTR)GetPropA(DlgItem(hWnd, id), "ORIGINAL_FUNC")); - RemovePropA(DlgItem(hWnd, id), "ORIGINAL_FUNC"); - } - } -} - -// Enhanced function -LRESULT CALLBACK EditBoxEnhancedProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam) -{ - WNDPROC func = NULL; - - if (MsIsNt()) - { - func = (WNDPROC)GetPropW(hWnd, L"ORIGINAL_FUNC"); - } - else - { - func = (WNDPROC)GetPropA(hWnd, "ORIGINAL_FUNC"); - } - - if (func == NULL) - { - Debug("EditBoxEnhancedProc(): GetProp() returned NULL!\n"); - return 1; - } - - switch (msg) - { - case WM_CHAR: - switch (wParam) - { - // CTRL + A - case 1: - SelectEdit(hWnd, 0); - return 0; - case VK_RETURN: - SendMsg(GetParent(hWnd), 0, WM_KEYDOWN, VK_RETURN, 0); - return 0; - case VK_ESCAPE: - DestroyWindow(hWnd); - return 0; - } - break; - case WM_NCDESTROY: - // Restore original function during destruction - EditBoxSetEnhanced(hWnd, 0, false); - } - - if (MsIsNt()) - { - return CallWindowProcW(func, hWnd, msg, wParam, lParam); - } - else - { - return CallWindowProcA(func, hWnd, msg, wParam, lParam); - } -} - -// Toggle enhanced function -void EditBoxSetEnhanced(HWND hWnd, UINT id, bool enable) -{ - // Validate arguments - if (hWnd == NULL) - { - return; - } - - if (enable) - { - if (MsIsNt()) - { - const HANDLE fn = (HANDLE)SetWindowLongPtrW(DlgItem(hWnd, id), GWLP_WNDPROC, (LONG_PTR)EditBoxEnhancedProc); - SetPropW(DlgItem(hWnd, id), L"ORIGINAL_FUNC", fn); - } - else - { - const HANDLE fn = (HANDLE)SetWindowLongPtrA(DlgItem(hWnd, id), GWLP_WNDPROC, (LONG_PTR)EditBoxEnhancedProc); - SetPropA(DlgItem(hWnd, id), "ORIGINAL_FUNC", fn); - } - } - else - { - if (MsIsNt()) - { - SetWindowLongPtrW(DlgItem(hWnd, id), GWLP_WNDPROC, (LONG_PTR)GetPropW(DlgItem(hWnd, id), L"ORIGINAL_FUNC")); - RemovePropW(DlgItem(hWnd, id), L"ORIGINAL_FUNC"); - } - else - { - SetWindowLongPtrA(DlgItem(hWnd, id), GWLP_WNDPROC, (LONG_PTR)GetPropA(DlgItem(hWnd, id), "ORIGINAL_FUNC")); - RemovePropA(DlgItem(hWnd, id), "ORIGINAL_FUNC"); - } - } -} - -// Show the menu -void PrintMenu(HWND hWnd, HMENU hMenu) -{ - POINT p; - // Validate arguments - if (hMenu == NULL || hWnd == NULL) - { - return; - } - - GetCursorPos(&p); - - TrackPopupMenu(hMenu, TPM_LEFTALIGN, p.x, p.y, 0, hWnd, NULL); -} - -// Remove a shortcut string from the menu -void RemoveShortcutKeyStrFromMenu(HMENU hMenu) -{ - UINT i, num; - // Validate arguments - if (hMenu == NULL) - { - return; - } - - num = GetMenuNum(hMenu); - for (i = 0;i < num;i++) - { - wchar_t *str = GetMenuStr(hMenu, i); - if (str != NULL) - { - UINT j, len; - len = UniStrLen(str); - for (j = 0;j < len;j++) - { - if (str[j] == L'\t') - { - str[j] = 0; - } - } - SetMenuStr(hMenu, i, str); - Free(str); - } - } -} - -// Get the number of items in the menu -UINT GetMenuNum(HMENU hMenu) -{ - UINT ret; - // Validate arguments - if (hMenu == NULL) - { - return 0; - } - - ret = GetMenuItemCount(hMenu); - if (ret == INFINITE) - { - return 0; - } - else - { - return ret; - } -} - -// Set the string into the menu -void SetMenuStr(HMENU hMenu, UINT pos, wchar_t *str) -{ - MENUITEMINFOW info; - // Validate arguments - if (hMenu == NULL || pos == INFINITE || str == NULL) - { - return; - } - - if (MsIsNt() == false) - { - char *s = CopyUniToStr(str); - SetMenuStrA(hMenu, pos, s); - Free(s); - return; - } - - Zero(&info, sizeof(info)); - info.cbSize = sizeof(info); - info.fMask = MIIM_STRING; - info.dwTypeData = str; - SetMenuItemInfoW(hMenu, pos, true, &info); -} -void SetMenuStrA(HMENU hMenu, UINT pos, char *str) -{ - MENUITEMINFOA info; - // Validate arguments - if (hMenu == NULL || pos == INFINITE || str == NULL) - { - return; - } - - Zero(&info, sizeof(info)); - info.cbSize = sizeof(info); - info.fMask = MIIM_STRING; - info.dwTypeData = str; - SetMenuItemInfoA(hMenu, pos, true, &info); -} - -// Get a string in the menu -wchar_t *GetMenuStr(HMENU hMenu, UINT pos) -{ - wchar_t tmp[MAX_SIZE]; - // Validate arguments - if (hMenu == NULL || pos == INFINITE) - { - return NULL; - } - if (MsIsNt() == false) - { - char *s = GetMenuStrA(hMenu, pos); - if (s == NULL) - { - return NULL; - } - else - { - wchar_t *ret = CopyStrToUni(s); - Free(s); - return ret; - } - } - - if (GetMenuStringW(hMenu, pos, tmp, sizeof(tmp), MF_BYPOSITION) == 0) - { - return NULL; - } - - return UniCopyStr(tmp); -} -char *GetMenuStrA(HMENU hMenu, UINT pos) -{ - char tmp[MAX_SIZE]; - // Validate arguments - if (hMenu == NULL || pos == INFINITE) - { - return NULL; - } - - if (GetMenuString(hMenu, pos, tmp, sizeof(tmp), MF_BYPOSITION) == 0) - { - return NULL; - } - - return CopyStr(tmp); -} - -// Bold the menu item -void SetMenuItemBold(HMENU hMenu, UINT pos, bool bold) -{ - MENUITEMINFO info; - // Validate arguments - if (hMenu == NULL || pos == INFINITE) - { - return; - } - - Zero(&info, sizeof(info)); - info.cbSize = sizeof(info); - info.fMask = MIIM_STATE; - - if (GetMenuItemInfo(hMenu, pos, true, &info) == false) - { - return; - } - - if (bold) - { - info.fState |= MFS_DEFAULT; - } - else - { - info.fState = info.fState & ~MFS_DEFAULT; - } - - SetMenuItemInfo(hMenu, pos, true, &info); -} - -// Remove a menu item -void DeleteMenuItem(HMENU hMenu, UINT pos) -{ - // Validate arguments - if (hMenu == NULL || pos == INFINITE) - { - return; - } - - DeleteMenu(hMenu, pos, MF_BYPOSITION); -} - -// Get the position from the ID in the menu -UINT GetMenuItemPos(HMENU hMenu, UINT id) -{ - UINT num, i; - // Validate arguments - if (hMenu == NULL) - { - return INFINITE; - } - - num = GetMenuItemCount(hMenu); - if (num == INFINITE) - { - return INFINITE; - } - - for (i = 0;i < num;i++) - { - if (GetMenuItemID(hMenu, i) == id) - { - return i; - } - } - - return INFINITE; -} - -// Get a sub-menu -HMENU LoadSubMenu(UINT menu_id, UINT pos, HMENU *parent_menu) -{ - HMENU h = LoadMenu(hDll, MAKEINTRESOURCE(menu_id)); - HMENU ret; - if (h == NULL) - { - return NULL; - } - - ret = GetSubMenu(h, pos); - - if (parent_menu != NULL) - { - *parent_menu = h; - } - - return ret; -} - -// Get the DLL of the user interface -HINSTANCE GetUiDll() -{ - return hDll; -} - -// Connection Error dialog procedure -UINT ConnectErrorDlgProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param) -{ - UI_CONNECTERROR_DLG *p = (UI_CONNECTERROR_DLG *)param; - wchar_t tmp[1024]; - // Validate arguments - if (hWnd == NULL) - { - return 0; - } - - switch (msg) - { - case WM_INITDIALOG: - if (p->Err == ERR_DISCONNECTED || p->Err == ERR_SESSION_TIMEOUT) - { - // Message indicating that the connection has been disconnected - SetText(hWnd, S_TITLE, _UU("ERRDLG_DISCONNECTED_MSG")); - } - if (p->HideWindow) - { - Hide(hWnd, R_HIDE); - } - FormatText(hWnd, 0, p->AccountName); - FormatText(hWnd, S_TITLE, p->ServerName); - UniFormat(tmp, sizeof(tmp), _UU("ERRDLG_ERRMSG"), p->Err, _E(p->Err)); - SetText(hWnd, E_ERROR, tmp); - - SetIcon(hWnd, 0, ICO_SERVER_OFFLINE); - - if (p->RetryIntervalSec == 0) - { - SetText(hWnd, S_COUNTDOWN, _UU("ERRDLG_INFORMATION")); - Hide(hWnd, P_PROGRESS); - Hide(hWnd, S_RETRYINFO); - } - else - { - if (p->RetryLimit != INFINITE) - { - UniFormat(tmp, sizeof(tmp), _UU("ERRDLG_RETRY_INFO_1"), p->CurrentRetryCount, p->RetryLimit); - } - else - { - UniFormat(tmp, sizeof(tmp), _UU("ERRDLG_RETRY_INFO_2"), p->CurrentRetryCount); - } - SetText(hWnd, S_RETRYINFO, tmp); - SetRange(hWnd, P_PROGRESS, 0, p->RetryIntervalSec); - SetPos(hWnd, P_PROGRESS, 0); - SetTimer(hWnd, 1, 10, NULL); - p->StartTick = Tick64(); - } - SetTimer(hWnd, 2, 10, NULL); - Focus(hWnd, IDOK); - break; - case WM_TIMER: - switch (wParam) - { - case 1: - if (p->RetryIntervalSec != 0) - { - UINT64 start, end, now; - now = Tick64(); - start = p->StartTick; - end = start + (UINT64)p->RetryIntervalSec; - - if (end > now) - { - SetPos(hWnd, P_PROGRESS, (UINT)(now - start)); - UniFormat(tmp, sizeof(tmp), _UU("ERRDLG_RETRYCOUNT"), ((UINT)(end - now)) / 1000); - SetText(hWnd, S_COUNTDOWN, tmp); - } - else - { - Command(hWnd, IDOK); - } - } - break; - case 2: - if (p->CancelEvent != NULL) - { - if (WaitForSingleObject((HANDLE)p->CancelEvent->pData, 0) != WAIT_TIMEOUT) - { - // Forced Cancel - Close(hWnd); - } - } - break; - } - break; - case WM_COMMAND: - switch (LOWORD(wParam)) - { - case R_HIDE: - p->HideWindow = IsChecked(hWnd, R_HIDE); - break; - } - switch (wParam) - { - case IDOK: - EndDialog(hWnd, true); - break; - case IDCANCEL: - Close(hWnd); - break; - } - break; - case WM_CLOSE: - EndDialog(hWnd, false); - break; - } - - return 0; -} - -// Show the connection error dialog -bool ConnectErrorDlg(UI_CONNECTERROR_DLG *p) -{ - // Validate arguments - if (p == NULL) - { - return false; - } - - return DialogEx2(NULL, D_CONNECTERROR, ConnectErrorDlgProc, p, true, true); -} - -// Display the contents of the certificate -void PrintCheckCertInfo(HWND hWnd, UI_CHECKCERT *p) -{ - wchar_t tmp[MAX_SIZE]; - char tmp2[MAX_SIZE]; - UCHAR md5[MD5_SIZE]; - UCHAR sha1[SHA1_SIZE]; - X *x; - // Validate arguments - if (hWnd == NULL || p == NULL) - { - return; - } - - x = p->x; - - GetAllNameFromNameEx(tmp, sizeof(tmp), x->subject_name); - SetText(hWnd, E_SUBJECT, tmp); - - GetAllNameFromNameEx(tmp, sizeof(tmp), x->issuer_name); - SetText(hWnd, E_ISSUER, tmp); - - GetDateTimeStrEx64(tmp, sizeof(tmp), SystemToLocal64(x->notAfter), NULL); - SetText(hWnd, E_EXPIRES, tmp); - - GetXDigest(x, md5, false); - BinToStr(tmp2, sizeof(tmp2), md5, sizeof(md5)); - SetTextA(hWnd, E_MD5, tmp2); - - GetXDigest(x, sha1, true); - BinToStr(tmp2, sizeof(tmp2), sha1, sizeof(sha1)); - SetTextA(hWnd, E_SHA1, tmp2); - - SetFont(hWnd, E_MD5, GetFont("Arial", 8, false, false, false, false)); - SetFont(hWnd, E_SHA1, GetFont("Arial", 8, false, false, false, false)); -} - -// Warn that the certificate is different -void ShowDlgDiffWarning(HWND hWnd, UI_CHECKCERT *p) -{ - UCHAR sha1_new[SHA1_SIZE], sha1_old[SHA1_SIZE]; - UCHAR md5_new[MD5_SIZE], md5_old[MD5_SIZE]; - char sha1_new_str[MAX_SIZE], sha1_old_str[MAX_SIZE]; - char md5_new_str[MAX_SIZE], md5_old_str[MAX_SIZE]; - // Validate arguments - if (hWnd == NULL || p == NULL || p->x == NULL || p->old_x == NULL) - { - return; - } - - GetXDigest(p->x, sha1_new, true); - GetXDigest(p->x, md5_new, false); - - GetXDigest(p->old_x, sha1_old, true); - GetXDigest(p->old_x, md5_old, false); - - BinToStrEx(sha1_new_str, sizeof(sha1_new_str), sha1_new, sizeof(sha1_new)); - BinToStrEx(md5_new_str, sizeof(md5_new_str), md5_new, sizeof(md5_new)); - BinToStrEx(sha1_old_str, sizeof(sha1_old_str), sha1_old, sizeof(sha1_old)); - BinToStrEx(md5_old_str, sizeof(md5_old_str), md5_old, sizeof(md5_old)); - - MsgBoxEx(hWnd, MB_ICONEXCLAMATION, _UU("CC_DANGEROUS_MSG"), - p->ServerName, md5_old_str, sha1_old_str, md5_new_str, sha1_new_str); -} - -// [OK] button is pressed -void CheckCertDialogOnOk(HWND hWnd, UI_CHECKCERT *p) -{ - UCHAR sha1_new[SHA1_SIZE]; - UCHAR md5_new[MD5_SIZE]; - char sha1_new_str[MAX_SIZE]; - char md5_new_str[MAX_SIZE]; - UINT ret; - // Validate arguments - if (hWnd == NULL || p == NULL) - { - return; - } - - GetXDigest(p->x, sha1_new, true); - GetXDigest(p->x, md5_new, false); - BinToStrEx(sha1_new_str, sizeof(sha1_new_str), sha1_new, sizeof(sha1_new)); - BinToStrEx(md5_new_str, sizeof(md5_new_str), md5_new, sizeof(md5_new)); - - ret = MsgBoxEx(hWnd, MB_ICONQUESTION | MB_YESNOCANCEL | MB_DEFBUTTON2, - _UU("CC_WARNING_MSG"), - p->AccountName, sha1_new_str, md5_new_str); - - if (ret == IDYES) - { - p->SaveServerCert = true; - } - - if (ret == IDCANCEL) - { - return; - } - - p->Ok = true; - EndDialog(hWnd, true); -} - -// Certificate dialog procedure -UINT CheckCertDlgProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param) -{ - UI_CHECKCERT *p = (UI_CHECKCERT *)param; - // Validate arguments - if (hWnd == NULL || param == NULL) - { - return 0; - } - - switch (msg) - { - case WM_INITDIALOG: - FormatText(hWnd, 0, p->AccountName); - FormatText(hWnd, S_TITLE, p->ServerName); - FormatText(hWnd, S_MSG1, p->ServerName); - - PrintCheckCertInfo(hWnd, p); - - Focus(hWnd, IDCANCEL); - - SetIcon(hWnd, 0, ICO_WARNING); - - if (p->DiffWarning) - { - SetTimer(hWnd, 1, 1, NULL); - } - - SetTimer(hWnd, 2, 100, NULL); - - break; - case WM_TIMER: - switch (wParam) - { - case 1: - KillTimer(hWnd, 1); - ShowDlgDiffWarning(hWnd, p); - break; - case 2: - if ((p->Session != NULL && p->Session->Halt) || - (p->Halt)) - { - p->Ok = false; - EndDialog(hWnd, false); - } - break; - } - break; - case WM_COMMAND: - switch (wParam) - { - case B_SHOW: - CertDlg(hWnd, p->x, p->parent_x, false); - break; - case IDOK: - CheckCertDialogOnOk(hWnd, p); - break; - case IDCANCEL: - Close(hWnd); - break; - } - break; - case WM_CLOSE: - p->Ok = false; - EndDialog(hWnd, false); - break; - } - - return 0; -} - -// Certificate Check dialog -void CheckCertDlg(UI_CHECKCERT *p) -{ - // Validate arguments - if (p == NULL) - { - return; - } - - Dialog(NULL, D_CHECKCERT, CheckCertDlgProc, p); -} - -// Get the image list ID from the icon ID -UINT GetIcon(UINT icon_id) -{ - IMAGELIST_ICON *c, t; - t.id = icon_id; - - c = Search(icon_list, &t); - if (c == NULL) - { - if (icon_id != ICO_NULL) - { - return GetIcon(ICO_NULL); - } - else - { - return INFINITE; - } - } - else - { - return c->Index; - } -} - -// Load an icon for the image list -IMAGELIST_ICON *LoadIconForImageList(UINT id) -{ - IMAGELIST_ICON *ret = ZeroMalloc(sizeof(IMAGELIST_ICON)); - HICON small_icon, large_icon; - - ret->id = id; - - large_icon = LoadLargeIcon(id); - if (large_icon == NULL) - { - large_icon = LoadSmallIcon(id); - } - - small_icon = LoadSmallIcon(id); - if (small_icon == NULL) - { - small_icon = LoadLargeIcon(id); - } - - ret->hSmallImage = small_icon; - ret->hLargeImage = large_icon; - ret->Index = ImageList_AddIcon(large_image_list, large_icon); - ImageList_AddIcon(small_image_list, small_icon); - - return ret; -} - -// Comparison of the image list icons -int CompareImageListIcon(void *p1, void *p2) -{ - IMAGELIST_ICON *c1, *c2; - if (p1 == NULL || p2 == NULL) - { - return 0; - } - c1 = *(IMAGELIST_ICON **)p1; - c2 = *(IMAGELIST_ICON **)p2; - if (c1 == NULL || c2 == NULL) - { - return 0; - } - - if (c1->id > c2->id) - { - return 1; - } - else if (c1->id < c2->id) - { - return -1; - } - else - { - return 0; - } -} - -// Initialize thr image list -void InitImageList() -{ - large_image_list = ImageList_Create(32, 32, ILC_COLOR32 | ILC_MASK, 1, 0); - ImageList_SetBkColor(large_image_list, RGB(255, 255, 255)); - small_image_list = ImageList_Create(16, 16, ILC_COLOR32 | ILC_MASK, 1, 0); - ImageList_SetBkColor(small_image_list, RGB(255, 255, 255)); - icon_list = NewList(CompareImageListIcon); - - // Enumeration - EnumResourceNames(hDll, RT_GROUP_ICON, EnumResNameProc, 0); -} - -// Icon resource enumeration procedure -BOOL CALLBACK EnumResNameProc(HMODULE hModule, LPCTSTR lpszType, LPTSTR lpszName, LONG_PTR lParam) -{ - if (IS_INTRESOURCE(lpszName)) - { - UINT icon_id = (UINT)lpszName; - IMAGELIST_ICON *img = LoadIconForImageList(icon_id); - - Add(icon_list, img); - } - - return TRUE; -} - -// Release the image list -void FreeImageList() -{ - UINT i; - ImageList_Destroy(large_image_list); - ImageList_Destroy(small_image_list); - large_image_list = small_image_list = NULL; - - for (i = 0;i < LIST_NUM(icon_list);i++) - { - IMAGELIST_ICON *c = LIST_DATA(icon_list, i); - Free(c); - } - - ReleaseList(icon_list); - icon_list = NULL; -} - -// Get the width of the column of the list view -UINT LvGetColumnWidth(HWND hWnd, UINT id, UINT index) -{ - return (UINT)((double)ListView_GetColumnWidth(DlgItem(hWnd, id), index) / GetTextScalingFactor()); -} - -// Insert the column into the list view -void LvInsertColumn(HWND hWnd, UINT id, UINT index, wchar_t *str, UINT width) -{ - LVCOLUMNW c; - // Validate arguments - if (hWnd == NULL || str == NULL) - { - return; - } - - width = (UINT)((double)width * GetTextScalingFactor()); - - Zero(&c, sizeof(c)); - c.mask = LVCF_FMT | LVCF_SUBITEM | LVCF_TEXT | LVCF_WIDTH; - - c.pszText = str; - c.iSubItem = index; - c.cx = width; - - SendMsg(hWnd, id, LVM_INSERTCOLUMNW, index, (LPARAM)&c); -} - -// Remove all items from list view -void LvReset(HWND hWnd, UINT id) -{ - // Validate arguments - if (hWnd == NULL) - { - return; - } - - ListView_DeleteAllItems(DlgItem(hWnd, id)); -} - -// Initialize the list view -void LvInitEx(HWND hWnd, UINT id, bool no_image) -{ - LvInitEx2(hWnd, id, no_image, false); -} -void LvInitEx2(HWND hWnd, UINT id, bool no_image, bool large_icon) -{ - // Validate arguments - if (hWnd == NULL) - { - return; - } - - ListView_SetUnicodeFormat(DlgItem(hWnd, id), true); - - if (no_image == false) - { - ListView_SetImageList(DlgItem(hWnd, id), large_image_list, LVSIL_NORMAL); - ListView_SetImageList(DlgItem(hWnd, id), large_icon ? large_image_list : small_image_list, LVSIL_SMALL); - } - - ListView_SetExtendedListViewStyle(DlgItem(hWnd, id), LVS_EX_FULLROWSELECT); - - if (MsIsVista()) - { - LvSetStyle(hWnd, id, LVS_EX_DOUBLEBUFFER); - } -} -void LvInit(HWND hWnd, UINT id) -{ - LvInitEx(hWnd, id, false); -} - -// Adding batch complete (high-speed) -void LvInsertEnd(LVB *b, HWND hWnd, UINT id) -{ - LvInsertEndEx(b, hWnd, id, false); -} -void LvInsertEndEx(LVB *b, HWND hWnd, UINT id, bool force_reset) -{ - UINT i, num; - LIST *new_list, *exist_list; - wchar_t *last_selected = NULL; - // Validate arguments - if (b == NULL || hWnd == NULL) - { - return; - } - - new_list = NewListFast(CompareUniStr); - - for (i = 0;i < LIST_NUM(b->ItemList);i++) - { - LVB_ITEM *t = LIST_DATA(b->ItemList, i); - Add(new_list, t->Strings[0]); - } - - Sort(new_list); - - if ((LIST_NUM(b->ItemList) >= LV_INSERT_RESET_ALL_ITEM_MIN) || force_reset) - { - last_selected = LvGetFocusedStr(hWnd, id, 0); - LvReset(hWnd, id); - } - - exist_list = NewListFast(CompareUniStr); - - num = LvNum(hWnd, id); - - // Delete the items which isn't contained in the batch list of existing items - for (i = 0;i < num;i++) - { - bool exists = false; - wchar_t *s = LvGetStr(hWnd, id, i, 0); - if (Search(new_list, s) != NULL) - { - exists = true; - } - if (exists == false) - { - // Remove items that don't exist in the batch list of the adding plan from the list view - LvDeleteItem(hWnd, id, i); - num = LvNum(hWnd, id); - i--; - Free(s); - } - else - { - Add(exist_list, s); - } - } - - Sort(exist_list); - - // Add items in the batch one by one - for (i = 0;i < LIST_NUM(b->ItemList);i++) - { - LVB_ITEM *t = LIST_DATA(b->ItemList, i); - UINT index; - UINT j; - bool exists = false; - - if (Search(exist_list, t->Strings[0]) != NULL) - { - index = LvSearchStr(hWnd, id, 0, t->Strings[0]); - } - else - { - index = INFINITE; - } - - if (index != INFINITE) - { - UINT j; - // If an item with the string same to adding item already exists, - // update instead of adding - for (j = 0;j < t->NumStrings;j++) - { - LvSetItem(hWnd, id, index, j, t->Strings[j]); - } - LvSetItemImageByImageListId(hWnd, id, index, t->Image); - LvSetItemParam(hWnd, id, index, t->Param); - } - else - { - // Add newly - UINT index = INFINITE; - UINT j; - for (j = 0;j < t->NumStrings;j++) - { - if (j == 0) - { - index = LvInsertItemByImageListId(hWnd, id, t->Image, t->Param, t->Strings[j]); - } - else - { - LvSetItem(hWnd, id, index, j, t->Strings[j]); - } - } - } - - // Release the memory - for (j = 0;j < t->NumStrings;j++) - { - Free(t->Strings[j]); - } - Free(t->Strings); - Free(t); - } - - // Release the list - ReleaseList(b->ItemList); - - // Release the memory - Free(b); - - ReleaseList(new_list); - - for (i = 0;i < LIST_NUM(exist_list);i++) - { - Free(LIST_DATA(exist_list, i)); - } - ReleaseList(exist_list); - - if (last_selected != NULL) - { - UINT pos = LvSearchStr(hWnd, id, 0, last_selected); - - if (pos != INFINITE) - { - LvSelect(hWnd, id, pos); - } - - Free(last_selected); - } -} - -// Get the number of columns of the list view -UINT LvGetColumnNum(HWND hWnd, UINT id) -{ - UINT i; - LVCOLUMN c; - if (hWnd == NULL) - { - return 0; - } - - for (i = 0;;i++) - { - Zero(&c, sizeof(c)); - c.mask = LVCF_SUBITEM; - if (ListView_GetColumn(DlgItem(hWnd, id), i, &c) == false) - { - break; - } - } - - return i; -} - -// List-view sort function -int CALLBACK LvSortProc(LPARAM param1, LPARAM param2, LPARAM sort_param) -{ - WINUI_LV_SORT *sort = (WINUI_LV_SORT *)sort_param; - HWND hWnd; - UINT id; - UINT i1, i2; - int ret = 0; - wchar_t *s1, *s2; - if (sort == NULL) - { - return 0; - } - - hWnd = sort->hWnd; - id = sort->id; - - if (hWnd == NULL) - { - return 0; - } - - i1 = (UINT)param1; - i2 = (UINT)param2; - - s1 = LvGetStr(hWnd, id, i1, sort->subitem); - if (s1 == NULL) - { - return 0; - } - - s2 = LvGetStr(hWnd, id, i2, sort->subitem); - if (s2 == NULL) - { - Free(s1); - return 0; - } - - if (sort->numeric == false) - { - if (UniStrCmpi(s1, _UU("CM_NEW_ICON")) == 0 || UniStrCmpi(s1, _UU("CM_VGC_ICON")) == 0 || UniStrCmpi(s1, _UU("CM_VGC_LINK")) == 0) - { - ret = -1; - } - else if (UniStrCmpi(s2, _UU("CM_NEW_ICON")) == 0 || UniStrCmpi(s2, _UU("CM_VGC_ICON")) == 0 || UniStrCmpi(s1, _UU("CM_VGC_LINK")) == 0) - { - ret = 1; - } - else - { - ret = UniStrCmpi(s1, s2); - } - } - else - { - UINT64 v1, v2; - v1 = UniToInt64(s1); - v2 = UniToInt64(s2); - if (v1 > v2) - { - ret = 1; - } - else if (v1 < v2) - { - ret = -1; - } - else - { - ret = 0; - } - } - - Free(s1); - Free(s2); - - if (sort->desc) - { - ret = -ret; - } - - return ret; -} - -// Standard handler -void LvStandardHandler(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, UINT id) -{ - NMHDR *n; - NMLVKEYDOWN *key; - // Validate arguments - if (hWnd == NULL) - { - return; - } - - LvSortHander(hWnd, msg, wParam, lParam, id); - - switch (msg) - { - case WM_NOTIFY: - n = (NMHDR *)lParam; - if (n->idFrom == id) - { - switch (n->code) - { - case NM_DBLCLK: - Command(hWnd, IDOK); - break; - case LVN_KEYDOWN: - key = (NMLVKEYDOWN *)n; - if (key != NULL) - { - UINT code = key->wVKey; - switch (code) - { - case VK_DELETE: - Command(hWnd, B_DELETE); - break; - - case VK_RETURN: - Command(hWnd, IDOK); - break; - - case VK_F5: - Command(hWnd, B_REFRESH); - break; - } - } - break; - } - } - break; - } -} - -// Sort header handler -void LvSortHander(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, UINT id) -{ - NMHDR *nmhdr; - UINT subitem; - bool desc; - // Validate arguments - if (hWnd == NULL) - { - return; - } - - switch (msg) - { - case WM_NOTIFY: - nmhdr = (NMHDR *)lParam; - - if (nmhdr != NULL) - { - if (nmhdr->idFrom == id) - { - NMLISTVIEW *v; - switch (nmhdr->code) - { - case LVN_COLUMNCLICK: - desc = false; - v = (NMLISTVIEW *)lParam; - subitem = v->iSubItem; - - if ((GetStyle(hWnd, id) & LVS_SORTDESCENDING) == 0) - { - desc = true; - SetStyle(hWnd, id, LVS_SORTDESCENDING); - RemoveStyle(hWnd, id, LVS_SORTASCENDING); - } - else - { - SetStyle(hWnd, id, LVS_SORTASCENDING); - RemoveStyle(hWnd, id, LVS_SORTDESCENDING); - } - - LvSort(hWnd, id, subitem, desc); - break; - } - } - } - break; - } -} - -// Do sort -void LvSort(HWND hWnd, UINT id, UINT subitem, bool desc) -{ - UINT i, num; - bool numeric = true; - wchar_t na[2] = {0xff0d, 0x0, }; - // Validate arguments - if (hWnd == NULL) - { - return; - } - - num = LvNum(hWnd, id); - for (i = 0;i < num;i++) - { - wchar_t *s = LvGetStr(hWnd, id, i, subitem); - if (s != NULL) - { - if (UniIsNum(s) == false && UniStrCmp(s, na) != 0) - { - numeric = false; - Free(s); - break; - } - Free(s); - } - else - { - numeric = false; - break; - } - } - - LvSortEx(hWnd, id, subitem, desc, numeric); -} - -void LvSortEx(HWND hWnd, UINT id, UINT subitem, bool desc, bool numeric) -{ - WINUI_LV_SORT s; - // Validate arguments - if (hWnd == NULL) - { - return; - } - if (subitem >= LvGetColumnNum(hWnd, id)) - { - return; - } - - Zero(&s, sizeof(s)); - s.desc = desc; - s.numeric = numeric; - s.id = id; - s.hWnd = hWnd; - s.subitem = subitem; - - ListView_SortItemsEx(DlgItem(hWnd, id), LvSortProc, (LPARAM)&s); -} - -// Add an item to adding batch -void LvInsertAdd(LVB *b, UINT icon, void *param, UINT num_str, ...) -{ - UINT i; - va_list va; - UINT index = 0; - LVB_ITEM *t; - // Validate arguments - if (b == NULL || num_str == 0) - { - return; - } - - t = ZeroMalloc(sizeof(LVB_ITEM)); - - va_start(va, num_str); - - t->Strings = (wchar_t **)ZeroMalloc(sizeof(wchar_t *) * num_str); - t->NumStrings = num_str; - - for (i = 0;i < num_str;i++) - { - wchar_t *s = va_arg(va, wchar_t *); - - t->Strings[i] = UniCopyStr(s); - } - - t->Param = param; - t->Image = GetIcon(icon); - - Add(b->ItemList, t); - - va_end(va); -} - -// Start the item adding batch -LVB *LvInsertStart() -{ - LVB *b = ZeroMalloc(sizeof(LVB)); - b->ItemList = NewListFast(NULL); - - return b; -} - -// Add items to the list view -void LvInsert(HWND hWnd, UINT id, UINT icon, void *param, UINT num_str, ...) -{ - UINT i; - va_list va; - UINT index = 0; - // Validate arguments - if (hWnd == NULL) - { - return; - } - - va_start(va, num_str); - - for (i = 0;i < num_str;i++) - { - wchar_t *s = va_arg(va, wchar_t *); - if (i == 0) - { - index = LvInsertItem(hWnd, id, icon, param, s); - } - else - { - LvSetItem(hWnd, id, index, i, s); - } - } - - va_end(va); -} - -// Adjust the item size automatically -void LvAutoSize(HWND hWnd, UINT id) -{ - UINT i; - // Validate arguments - if (hWnd == NULL) - { - return; - } - - i = 0; - while (true) - { - if (ListView_SetColumnWidth(DlgItem(hWnd, id), i, LVSCW_AUTOSIZE) == false) - { - break; - } - i++; - } -} - -// Add an item -UINT LvInsertItem(HWND hWnd, UINT id, UINT icon, void *param, wchar_t *str) -{ - return LvInsertItemByImageListId(hWnd, id, GetIcon(icon), param, str); -} -UINT LvInsertItemByImageListId(HWND hWnd, UINT id, UINT image, void *param, wchar_t *str) -{ - LVITEMW t; - // Validate arguments - if (hWnd == NULL || str == NULL) - { - return INFINITE; - } - if (MsIsNt() == false) - { - char *s = CopyUniToStr(str); - UINT ret; - ret = LvInsertItemByImageListIdA(hWnd, id, image, param, s); - Free(s); - return ret; - } - - Zero(&t, sizeof(t)); - t.mask = LVIF_IMAGE | LVIF_PARAM | LVIF_TEXT; - t.pszText = str; - t.iImage = image; - t.lParam = (LPARAM)param; - t.iItem = LvNum(hWnd, id); - - return SendMsg(hWnd, id, LVM_INSERTITEMW, 0, (LPARAM)&t); -} -UINT LvInsertItemByImageListIdA(HWND hWnd, UINT id, UINT image, void *param, char *str) -{ - LVITEM t; - // Validate arguments - if (hWnd == NULL || str == NULL) - { - return INFINITE; - } - - Zero(&t, sizeof(t)); - t.mask = LVIF_IMAGE | LVIF_PARAM | LVIF_TEXT; - t.pszText = str; - t.iImage = image; - t.lParam = (LPARAM)param; - t.iItem = LvNum(hWnd, id); - - return SendMsg(hWnd, id, LVM_INSERTITEM, 0, (LPARAM)&t); -} - -// Change the image -void LvSetItemImageByImageListId(HWND hWnd, UINT id, UINT index, UINT image) -{ - LVITEM t; - // Validate arguments - if (hWnd == NULL) - { - return; - } - - Zero(&t, sizeof(t)); - t.mask = LVIF_IMAGE; - t.iImage = image; - t.iItem = index; - - SendMsg(hWnd, id, LVM_SETITEM, 0, (LPARAM)&t); -} - -// Set the parameters of the item -void LvSetItemParam(HWND hWnd, UINT id, UINT index, void *param) -{ - LvSetItemParamEx(hWnd, id, index, 0, param); -} -void LvSetItemParamEx(HWND hWnd, UINT id, UINT index, UINT subitem, void *param) -{ - LVITEM t; - // Validate arguments - if (hWnd == NULL) - { - return; - } - - Zero(&t, sizeof(t)); - t.mask = LVIF_PARAM; - t.iItem = index; - t.iSubItem = subitem; - t.lParam = (LPARAM)param; - - SendMsg(hWnd, id, LVM_SETITEM, 0, (LPARAM)&t); -} - -// Set the item -void LvSetItem(HWND hWnd, UINT id, UINT index, UINT pos, wchar_t *str) -{ - LVITEMW t; - wchar_t *old_str; - // Validate arguments - if (hWnd == NULL || str == NULL) - { - return; - } - if (MsIsNt() == false) - { - char *s = CopyUniToStr(str); - LvSetItemA(hWnd, id, index, pos, s); - Free(s); - return; - } - - Zero(&t, sizeof(t)); - t.mask = LVIF_TEXT; - t.pszText = str; - t.iItem = index; - t.iSubItem = pos; - - old_str = LvGetStr(hWnd, id, index, pos); - - if (UniStrCmp(old_str, str) != 0) - { - SendMsg(hWnd, id, LVM_SETITEMW, 0, (LPARAM)&t); - } - - Free(old_str); -} -void LvSetItemA(HWND hWnd, UINT id, UINT index, UINT pos, char *str) -{ - LVITEM t; - wchar_t *old_str; - char *old_str_2; - // Validate arguments - if (hWnd == NULL || str == NULL) - { - return; - } - - Zero(&t, sizeof(t)); - t.mask = LVIF_TEXT; - t.pszText = str; - t.iItem = index; - t.iSubItem = pos; - - old_str = LvGetStr(hWnd, id, index, pos); - old_str_2 = CopyUniToStr(old_str); - - if (StrCmp(old_str_2, str) != 0) - { - SendMsg(hWnd, id, LVM_SETITEM, 0, (LPARAM)&t); - } - - Free(old_str_2); - Free(old_str); -} - -// Set the view of the list box -void LvSetView(HWND hWnd, UINT id, bool details) -{ - // Validate arguments - if (hWnd == NULL) - { - return; - } - - if (details) - { - RemoveStyle(hWnd, id, LVS_ICON); - SetStyle(hWnd, id, LVS_REPORT); - } - else - { - RemoveStyle(hWnd, id, LVS_REPORT); - SetStyle(hWnd, id, LVS_ICON); - } -} - -// Get whether there is currently selected item -bool LvIsSelected(HWND hWnd, UINT id) -{ - // Validate arguments - if (hWnd == NULL) - { - return false; - } - - if (LvGetSelected(hWnd, id) == INFINITE) - { - return false; - } - - return true; -} - -// Get the currently selected item -UINT LvGetFocused(HWND hWnd, UINT id) -{ - // Validate arguments - if (hWnd == NULL) - { - return INFINITE; - } - - return ListView_GetNextItem(DlgItem(hWnd, id), -1, LVNI_FOCUSED); -} - -// Get the parameter of the currently selected item -void *LvGetSelectedParam(HWND hWnd, UINT id) -{ - UINT index; - // Validate arguments - if (hWnd == NULL) - { - return NULL; - } - - index = LvGetSelected(hWnd, id); - - if (index == INFINITE) - { - return NULL; - } - - return LvGetParam(hWnd, id, index); -} - -// Get a string that is currently selected -wchar_t *LvGetFocusedStr(HWND hWnd, UINT id, UINT pos) -{ - UINT i; - // Validate arguments - if (hWnd == NULL) - { - return NULL; - } - - i = LvGetFocused(hWnd, id); - if (i == INFINITE) - { - return NULL; - } - - return LvGetStr(hWnd, id, i, pos); -} - -// Get the currently selected item -UINT LvGetSelected(HWND hWnd, UINT id) -{ - // Validate arguments - if (hWnd == NULL) - { - return INFINITE; - } - - return ListView_GetNextItem(DlgItem(hWnd, id), -1, LVNI_FOCUSED | LVNI_SELECTED); -} - -// Get a string that is currently selected -wchar_t *LvGetSelectedStr(HWND hWnd, UINT id, UINT pos) -{ - UINT i; - // Validate arguments - if (hWnd == NULL) - { - return NULL; - } - - i = LvGetSelected(hWnd, id); - if (i == INFINITE) - { - return NULL; - } - - return LvGetStr(hWnd, id, i, pos); -} -char *LvGetSelectedStrA(HWND hWnd, UINT id, UINT pos) -{ - char *ret; - wchar_t *tmp = LvGetSelectedStr(hWnd, id, pos); - if (tmp == NULL) - { - return NULL; - } - ret = CopyUniToStr(tmp); - Free(tmp); - return ret; -} - -// Get whether two or more items are masked -bool LvIsMultiMasked(HWND hWnd, UINT id) -{ - UINT i; - // Validate arguments - if (hWnd == NULL) - { - return false; - } - - i = INFINITE; - i = LvGetNextMasked(hWnd, id, i); - if (i != INFINITE) - { - if (LvGetNextMasked(hWnd, id, i) != INFINITE) - { - return true; - } - } - - return false; -} - -// Examine whether just only one item is selected -bool LvIsSingleSelected(HWND hWnd, UINT id) -{ - return LvIsSelected(hWnd, id) && (LvIsMultiMasked(hWnd, id) == false); -} - -// Get whether there are items that are currently masked -bool LvIsMasked(HWND hWnd, UINT id) -{ - // Validate arguments - if (hWnd == NULL) - { - return false; - } - - if (LvGetNextMasked(hWnd, id, INFINITE) == INFINITE) - { - return false; - } - - return true; -} - -// Get the items that is currently masked -UINT LvGetNextMasked(HWND hWnd, UINT id, UINT start) -{ - // Validate arguments - if (hWnd == NULL) - { - return INFINITE; - } - - return ListView_GetNextItem(DlgItem(hWnd, id), start, LVNI_SELECTED); -} - -// Search an item with the specified string -UINT LvSearchStr(HWND hWnd, UINT id, UINT pos, wchar_t *str) -{ - UINT i, num; - // Validate arguments - if (hWnd == NULL || str == NULL) - { - return INFINITE; - } - - num = LvNum(hWnd, id); - - for (i = 0;i < num;i++) - { - wchar_t *s = LvGetStr(hWnd, id, i, pos); - if (s != NULL) - { - if (UniStrCmpi(s, str) == 0) - { - Free(s); - return i; - } - else - { - Free(s); - } - } - } - - return INFINITE; -} -UINT LvSearchStrA(HWND hWnd, UINT id, UINT pos, char *str) -{ - wchar_t *tmp = CopyStrToUni(str); - UINT ret = LvSearchStr(hWnd, id, pos, tmp); - Free(tmp); - return ret; -} - -// Search for item that have a specified param -UINT LvSearchParam(HWND hWnd, UINT id, void *param) -{ - UINT i, num; - // Validate arguments - if (hWnd == NULL) - { - return INFINITE; - } - - num = LvNum(hWnd, id); - - for (i = 0;i < num;i++) - { - if (LvGetParam(hWnd, id, i) == param) - { - return i; - } - } - - return INFINITE; -} - -// Get the number of items -UINT LvNum(HWND hWnd, UINT id) -{ - // Validate arguments - if (hWnd == NULL) - { - return 0; - } - - return ListView_GetItemCount(DlgItem(hWnd, id)); -} - -// Remove an item -void LvDeleteItem(HWND hWnd, UINT id, UINT index) -{ - UINT i; - // Validate arguments - if (hWnd == NULL) - { - return; - } - - ListView_DeleteItem(DlgItem(hWnd, id), index); - - i = LvGetSelected(hWnd, id); - if (i != INFINITE) - { - LvSelect(hWnd, id, i); - } -} - -// Get the data from the item -void *LvGetParam(HWND hWnd, UINT id, UINT index) -{ - return LvGetParamEx(hWnd, id, index, 0); -} -void *LvGetParamEx(HWND hWnd, UINT id, UINT index, UINT subitem) -{ - LVITEM t; - // Validate arguments - if (hWnd == NULL) - { - return NULL; - } - if (index == INFINITE) - { - return NULL; - } - - Zero(&t, sizeof(t)); - t.mask = LVIF_PARAM; - t.iItem = index; - t.iSubItem = subitem; - - if (ListView_GetItem(DlgItem(hWnd, id), &t) == false) - { - return NULL; - } - - return (void *)t.lParam; -} - -// Get the string of item -wchar_t *LvGetStr(HWND hWnd, UINT id, UINT index, UINT pos) -{ - wchar_t *tmp; - UINT size; - LVITEMW t; - // Validate arguments - if (hWnd == NULL) - { - return NULL; - } - if (MsIsNt() == false) - { - char *s = LvGetStrA(hWnd, id, index, pos); - if (s == NULL) - { - return NULL; - } - else - { - wchar_t *ret = CopyStrToUni(s); - Free(s); - - return ret; - } - } - - size = 65536; - tmp = Malloc(size); - - Zero(&t, sizeof(t)); - t.mask = LVIF_TEXT; - t.iItem = index; - t.iSubItem = pos; - t.pszText = tmp; - t.cchTextMax = size; - - if (SendMsg(hWnd, id, LVM_GETITEMTEXTW, index, (LPARAM)&t) <= 0) - { - Free(tmp); - return UniCopyStr(L""); - } - else - { - wchar_t *ret = UniCopyStr(tmp); - Free(tmp); - return ret; - } -} -char *LvGetStrA(HWND hWnd, UINT id, UINT index, UINT pos) -{ - char *tmp; - UINT size; - LVITEM t; - // Validate arguments - if (hWnd == NULL) - { - return NULL; - } - - size = 65536; - tmp = Malloc(size); - - Zero(&t, sizeof(t)); - t.mask = LVIF_TEXT; - t.iItem = index; - t.iSubItem = pos; - t.pszText = tmp; - t.cchTextMax = size; - - if (SendMsg(hWnd, id, LVM_GETITEMTEXT, index, (LPARAM)&t) <= 0) - { - Free(tmp); - return CopyStr(""); - } - else - { - char *ret = CopyStr(tmp); - Free(tmp); - return ret; - } -} - -// Set the style -void LvSetStyle(HWND hWnd, UINT id, UINT style) -{ - // Validate arguments - if (hWnd == NULL) - { - return; - } - - if ((ListView_GetExtendedListViewStyle(DlgItem(hWnd, id)) & style) == 0) - { - ListView_SetExtendedListViewStyleEx(DlgItem(hWnd, id), style, style); - } -} - -// Remove the style -void LvRemoveStyle(HWND hWnd, UINT id, UINT style) -{ - // Validate arguments - if (hWnd == NULL) - { - return; - } - - if ((ListView_GetExtendedListViewStyle(DlgItem(hWnd, id)) & style) != 0) - { - ListView_SetExtendedListViewStyleEx(DlgItem(hWnd, id), style, 0); - } -} - -// Invert the selection of items -void LvSwitchSelect(HWND hWnd, UINT id) -{ - UINT i, num; - bool *states; - // Validate arguments - if (hWnd == NULL) - { - return; - } - - num = LvNum(hWnd, id); - states = ZeroMalloc(sizeof(bool) * num); - - i = INFINITE; - while (true) - { - i = LvGetNextMasked(hWnd, id, i); - if (i == INFINITE) - { - break; - } - - states[i] = true; - } - - for (i = 0;i < num;i++) - { - if (states[i] == false) - { - ListView_SetItemState(DlgItem(hWnd, id), i, LVIS_SELECTED, LVIS_SELECTED); - } - else - { - ListView_SetItemState(DlgItem(hWnd, id), i, 0, LVIS_SELECTED); - } - } - - Free(states); -} - -// Select all items -void LvSelectAll(HWND hWnd, UINT id) -{ - UINT i, num; - // Validate arguments - if (hWnd == NULL) - { - return; - } - - num = LvNum(hWnd, id); - for (i = 0;i < num;i++) - { - ListView_SetItemState(DlgItem(hWnd, id), i, LVIS_SELECTED, LVIS_SELECTED); - } -} - -// Select the item by specifying the parameter -void LvSelectByParam(HWND hWnd, UINT id, void *param) -{ - UINT index; - // Validate arguments - if (hWnd == NULL || param == NULL) - { - return; - } - - index = LvSearchParam(hWnd, id, param); - if (index == INFINITE) - { - return; - } - - LvSelect(hWnd, id, index); -} - -// Select an item -void LvSelect(HWND hWnd, UINT id, UINT index) -{ - // Validate arguments - if (hWnd == NULL) - { - return; - } - - if (index == INFINITE) - { - UINT i, num; - // Deselect all - num = LvNum(hWnd, id); - for (i = 0;i < num;i++) - { - ListView_SetItemState(DlgItem(hWnd, id), i, 0, LVIS_SELECTED); - } - } - else - { - // Select - ListView_SetItemState(DlgItem(hWnd, id), index, LVIS_FOCUSED | LVIS_SELECTED, LVIS_FOCUSED | LVIS_SELECTED); - ListView_EnsureVisible(DlgItem(hWnd, id), index, true); - } -} - -// Show the certificate information -void PrintCertInfo(HWND hWnd, CERT_DLG *p) -{ - X *x; - char *serial_tmp; - UINT serial_size; - wchar_t *wchar_tmp; - wchar_t tmp[1024 * 5]; - UCHAR md5[MD5_SIZE]; - UCHAR sha1[SHA1_SIZE]; - char *s_tmp; - K *k; - // Validate arguments - if (p == NULL || hWnd == NULL) - { - return; - } - - x = p->x; - - // Serial number - if (x->serial != NULL) - { - serial_size = x->serial->size * 3 + 1; - serial_tmp = ZeroMalloc(serial_size); - BinToStrEx(serial_tmp, serial_size, x->serial->data, x->serial->size); - wchar_tmp = CopyStrToUni(serial_tmp); - Free(serial_tmp); - } - else - { - wchar_tmp = CopyUniStr(_UU("CERT_NO_SERIAL")); - } - LvInsert(hWnd, L_CERTINFO, ICO_CERT, NULL, 2, _UU("CERT_SERIAL"), wchar_tmp); - - // Issuer - GetAllNameFromName(tmp, sizeof(tmp), x->issuer_name); - LvInsert(hWnd, L_CERTINFO, ICO_CERT, NULL, 2, _UU("CERT_ISSUER"), tmp); - - // Subject - GetAllNameFromName(tmp, sizeof(tmp), x->subject_name); - LvInsert(hWnd, L_CERTINFO, ICO_CERT, NULL, 2, _UU("CERT_SUBJECT"), tmp); - - // Not available before - GetDateTimeStrEx64(tmp, sizeof(tmp), SystemToLocal64(x->notBefore), NULL); - LvInsert(hWnd, L_CERTINFO, ICO_CERT, NULL, 2, _UU("CERT_NOT_BEFORE"), tmp); - - // Not available after - GetDateTimeStrEx64(tmp, sizeof(tmp), SystemToLocal64(x->notAfter), NULL); - LvInsert(hWnd, L_CERTINFO, ICO_CERT, NULL, 2, _UU("CERT_NOT_AFTER"), tmp); - - // Number of bits - if (x->is_compatible_bit) - { - UniFormat(tmp, sizeof(tmp), _UU("CERT_BITS_FORMAT"), x->bits); - LvInsert(hWnd, L_CERTINFO, ICO_CERT, NULL, 2, _UU("CERT_BITS"), tmp); - } - - // Public key - k = GetKFromX(x); - if (k != NULL) - { - BUF *b = KToBuf(k, false, NULL); - s_tmp = CopyBinToStrEx(b->Buf, b->Size); - StrToUni(tmp, sizeof(tmp), s_tmp); - Free(s_tmp); - LvInsert(hWnd, L_CERTINFO, ICO_KEY, NULL, 2, _UU("CERT_PUBLIC_KEY"), tmp); - FreeBuf(b); - } - FreeK(k); - - GetXDigest(x, md5, false); - GetXDigest(x, sha1, true); - - // Digest (MD5) - s_tmp = CopyBinToStrEx(md5, sizeof(md5)); - StrToUni(tmp, sizeof(tmp), s_tmp); - Free(s_tmp); - LvInsert(hWnd, L_CERTINFO, ICO_KEY, NULL, 2, _UU("CERT_DIGEST_MD5"), tmp); - - // Digest (SHA-1) - s_tmp = CopyBinToStrEx(sha1, sizeof(sha1)); - StrToUni(tmp, sizeof(tmp), s_tmp); - Free(s_tmp); - LvInsert(hWnd, L_CERTINFO, ICO_KEY, NULL, 2, _UU("CERT_DIGEST_SHA1"), tmp); - - Free(wchar_tmp); - - LvSelect(hWnd, L_CERTINFO, 0); -} - -// Update the display -void CertDlgUpdate(HWND hWnd, CERT_DLG *p) -{ - // Validate arguments - if (hWnd == NULL || p == NULL) - { - return; - } - - if (LvIsSelected(hWnd, L_CERTINFO) == false) - { - SetText(hWnd, E_DETAIL, L""); - } - else - { - UINT i = LvGetSelected(hWnd, L_CERTINFO); - wchar_t *tmp = LvGetStr(hWnd, L_CERTINFO, i, 1); - SetText(hWnd, E_DETAIL, tmp); - Free(tmp); - } -} - -// Save the certificate -void CertDlgSave(HWND hWnd, CERT_DLG *p) -{ - wchar_t *name; - X *x; - // Validate arguments - if (hWnd == NULL || p == NULL) - { - return; - } - - // Save to a file - name = SaveDlg(hWnd, _UU("DLG_CERT_FILES"), _UU("DLG_SAVE_CERT"), NULL, L".cer"); - x = p->x; - if (name != NULL) - { - wchar_t str[MAX_SIZE]; - UniStrCpy(str, sizeof(str), name); - if (XToFileW(x, str, true)) - { - MsgBox(hWnd, MB_ICONINFORMATION, _UU("DLG_CERT_SAVE_OK")); - } - else - { - MsgBox(hWnd, MB_ICONSTOP, _UU("DLG_CERT_SAVE_ERROR")); - } - Free(name); - } -} - -// Certificate display dialog procedure -UINT CertDlgProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param) -{ - CERT_DLG *p = (CERT_DLG *)param; - X *x; - wchar_t tmp[MAX_SIZE]; - NMHDR *n; - // Validate arguments - if (hWnd == NULL) - { - return 0; - } - - switch (msg) - { - case WM_INITDIALOG: - SetIcon(hWnd, 0, ICO_CERT); - x = p->x; - GetAllNameFromNameEx(tmp, sizeof(tmp), x->subject_name); - SetText(hWnd, E_SUBJECT, tmp); - GetAllNameFromNameEx(tmp, sizeof(tmp), x->issuer_name); - SetText(hWnd, E_ISSUER, tmp); - GetDateStrEx64(tmp, sizeof(tmp), SystemToLocal64(x->notAfter), NULL); - SetText(hWnd, E_EXPIRES, tmp); - SetFont(hWnd, E_SUBJECT, Font(0, 1)); - SetFont(hWnd, E_ISSUER, Font(0, 1)); - SetFont(hWnd, E_EXPIRES, Font(0, 1)); - SetIcon(hWnd, B_PARENT, ICO_CERT); - if (x->root_cert) - { - // Root certificate - Hide(hWnd, S_WARNING_ICON); - SetText(hWnd, S_PARENT, _UU("CERT_ROOT")); - Hide(hWnd, B_PARENT); - Hide(hWnd, S_PARENT_BUTTON_STR); - } - else if (p->issuer_x != NULL) - { - // Parent certificate exists - Hide(hWnd, S_WARNING_ICON); - } - else - { - // There is no parent certificate - Hide(hWnd, S_CERT_ICON); - Hide(hWnd, B_PARENT); - Hide(hWnd, S_PARENT_BUTTON_STR); - SetText(hWnd, S_PARENT, _UU("CERT_NOT_FOUND")); - if (p->ManagerMode) - { - Hide(hWnd, IDC_STATIC1); - Hide(hWnd, S_PARENT); - Hide(hWnd, S_WARNING_ICON); - Hide(hWnd, S_CERT_ICON); - Hide(hWnd, B_PARENT); - Hide(hWnd, S_PARENT_BUTTON_STR); - } - } - - - LvInit(hWnd, L_CERTINFO); - LvInsertColumn(hWnd, L_CERTINFO, 0, _UU("CERT_LV_C1"), 130); - LvInsertColumn(hWnd, L_CERTINFO, 1, _UU("CERT_LV_C2"), 250); - - PrintCertInfo(hWnd, p); - Focus(hWnd, L_CERTINFO); - - CertDlgUpdate(hWnd, p); - - if (p->ManagerMode) - { - Show(hWnd, B_SAVE); - } - else - { - // Hide for security - Hide(hWnd, B_SAVE); - } - - break; - case WM_COMMAND: - switch (wParam) - { - case IDOK: - case IDCANCEL: - Close(hWnd); - break; - case B_PARENT: - CertDlg(hWnd, p->issuer_x, NULL, p->ManagerMode); - break; - case B_SAVE: - // Save to the file - CertDlgSave(hWnd, p); - break; - } - break; - case WM_CLOSE: - EndDialog(hWnd, false); - break; - case WM_NOTIFY: - n = (NMHDR *)lParam; - switch (n->idFrom) - { - case L_CERTINFO: - switch (n->code) - { - case LVN_ITEMCHANGED: - CertDlgUpdate(hWnd, p); - break; - } - break; - } - break; - } - - LvSortHander(hWnd, msg, wParam, lParam, L_CERTINFO); - - return 0; -} - -// Certificate display dialog -void CertDlg(HWND hWnd, X *x, X *issuer_x, bool manager) -{ - CERT_DLG p; - // Validate arguments - if (x == NULL) - { - return; - } - - Zero(&p, sizeof(p)); - p.x = x; - if (CompareX(x, issuer_x) == false) - { - p.issuer_x = issuer_x; - } - p.ManagerMode = manager; - Dialog(hWnd, D_CERT, CertDlgProc, &p); -} - -// Status window dialog -UINT StatusPrinterWindowDlg(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param) -{ - STATUS_WINDOW_PARAM *p = (STATUS_WINDOW_PARAM *)param; - PACK *pack; - // Validate arguments - if (hWnd == NULL) - { - return 0; - } - - switch (msg) - { - case WM_INITDIALOG: - // Initialize - SetIcon(hWnd, 0, ICO_SERVER_ONLINE); - RemoveExStyle(hWnd, 0, WS_EX_APPWINDOW); - p->hWnd = hWnd; - NoticeThreadInit(p->Thread); - FormatText(hWnd, 0, p->AccountName); - break; - - case WM_COMMAND: - switch (wParam) - { - case IDOK: - case IDCANCEL: - // Cancel button - Close(hWnd); - break; - } - - break; - - case WM_APP + 1: - // Set a string - SetText(hWnd, S_STATUS, (wchar_t *)lParam); - break; - - case WM_APP + 2: - // Close this window - EndDialog(hWnd, false); - break; - - case WM_CLOSE: - // End the session - pack = NewPack(); - SendPack(p->Sock, pack); - EndDialog(hWnd, false); - break; - } - - return 0; -} - -// Status window control thread -void StatusPrinterWindowThread(THREAD *thread, void *param) -{ - STATUS_WINDOW_PARAM *p = (STATUS_WINDOW_PARAM *)param; - // Validate arguments - if (thread == NULL || param == NULL) - { - return; - } - - p->Thread = thread; - DialogEx2(NULL, D_STATUS, StatusPrinterWindowDlg, p, true, true); - - Free(p); -} - -// Show a message in the status window -void StatusPrinterWindowPrint(STATUS_WINDOW *sw, wchar_t *str) -{ - // Validate arguments - if (sw == NULL) - { - return; - } - - SendMessage(sw->hWnd, WM_APP + 1, 0, (LPARAM)str); -} - -// End and release the status window -void StatusPrinterWindowStop(STATUS_WINDOW *sw) -{ - // Validate arguments - if (sw == NULL) - { - return; - } - - // Send stop message - SendMessage(sw->hWnd, WM_APP + 2, 0, 0); - - // Wait until the thread terminates - WaitThread(sw->Thread, INFINITE); - - // Release the memory - ReleaseThread(sw->Thread); - Free(sw); -} - -// Initialize the status window -STATUS_WINDOW *StatusPrinterWindowStart(SOCK *s, wchar_t *account_name) -{ - STATUS_WINDOW_PARAM *p; - STATUS_WINDOW *sw; - THREAD *t; - // Validate arguments - if (s == NULL || account_name == NULL) - { - return NULL; - } - - p = ZeroMalloc(sizeof(STATUS_WINDOW_PARAM)); - p->Sock = s; - UniStrCpy(p->AccountName, sizeof(p->AccountName), account_name); - - // Create a thread - t = NewThread(StatusPrinterWindowThread, p); - WaitThreadInit(t); - - sw = ZeroMalloc(sizeof(STATUS_WINDOW)); - sw->hWnd = p->hWnd; - sw->Thread = t; - - return sw; -} - -// Remove all -void LbReset(HWND hWnd, UINT id) -{ - // Validate arguments - if (hWnd == NULL) - { - return; - } - - SendMsg(hWnd, id, LB_RESETCONTENT, 0, 0); -} - -// Password input dialog state change -void PasswordDlgProcChange(HWND hWnd, UI_PASSWORD_DLG *p) -{ - bool b; - // Validate arguments - if (hWnd == NULL || p == NULL) - { - return; - } - - b = true; - if (IsEmpty(hWnd, E_USERNAME)) - { - b = false; - } - - SetEnable(hWnd, IDOK, b); - - p->StartTick = Tick64(); - if (p->RetryIntervalSec) - { - KillTimer(hWnd, 1); - Hide(hWnd, P_PROGRESS); - Hide(hWnd, S_COUNTDOWN); - } -} - -// Get the string -wchar_t *CbGetStr(HWND hWnd, UINT id) -{ - // Validate arguments - if (hWnd == NULL) - { - return NULL; - } - - return GetText(hWnd, id); -} - -// String search -UINT CbFindStr(HWND hWnd, UINT id, wchar_t *str) -{ - UINT ret; - if (MsIsNt() == false) - { - char *tmp = CopyUniToStr(str); - ret = CbFindStr9xA(hWnd, id, tmp); - Free(tmp); - return ret; - } - // Validate arguments - if (hWnd == NULL || str == NULL) - { - return INFINITE; - } - - ret = SendMsg(hWnd, id, CB_FINDSTRINGEXACT, -1, (LPARAM)str); - - return ret; -} -UINT CbFindStr9xA(HWND hWnd, UINT id, char *str) -{ - UINT ret; - // Validate arguments - if (hWnd == NULL || str == NULL) - { - return INFINITE; - } - - ret = SendMsg(hWnd, id, CB_FINDSTRINGEXACT, -1, (LPARAM)str); - - return ret; -} - -// Get the number of items -UINT CbNum(HWND hWnd, UINT id) -{ - // Validate arguments - if (hWnd == NULL) - { - return INFINITE; - } - - return SendMsg(hWnd, id, CB_GETCOUNT, 0, 0); -} - -// Add a string -UINT CbAddStrA(HWND hWnd, UINT id, char *str, UINT data) -{ - wchar_t *tmp; - UINT ret; - // Validate arguments - if (hWnd == NULL || str == NULL) - { - return INFINITE; - } - tmp = CopyStrToUni(str); - ret = CbAddStr(hWnd, id, tmp, data); - Free(tmp); - return ret; -} -UINT CbAddStr(HWND hWnd, UINT id, wchar_t *str, UINT data) -{ - UINT ret; - if (MsIsNt() == false) - { - char *s = CopyUniToStr(str); - ret = CbAddStr9xA(hWnd, id, s, data); - Free(s); - return ret; - } - // Validate arguments - if (hWnd == NULL || str == NULL) - { - return INFINITE; - } - - ret = SendMsg(hWnd, id, CB_ADDSTRING, 0, (LPARAM)str); - SendMsg(hWnd, id, CB_SETITEMDATA, ret, (LPARAM)data); - - if (CbNum(hWnd, id) == 1) - { - wchar_t tmp[MAX_SIZE]; - GetTxt(hWnd, id, tmp, sizeof(tmp)); - if (UniStrLen(tmp) == 0) - { - CbSelectIndex(hWnd, id, 0); - } - } - - return ret; -} -UINT CbAddStr9xA(HWND hWnd, UINT id, char *str, UINT data) -{ - UINT ret; - // Validate arguments - if (hWnd == NULL || str == NULL) - { - return INFINITE; - } - - ret = SendMsg(hWnd, id, CB_ADDSTRING, 0, (LPARAM)str); - SendMsg(hWnd, id, CB_SETITEMDATA, ret, (LPARAM)data); - - if (CbNum(hWnd, id) == 1) - { - wchar_t tmp[MAX_SIZE]; - GetTxt(hWnd, id, tmp, sizeof(tmp)); - if (UniStrLen(tmp) == 0) - { - CbSelectIndex(hWnd, id, 0); - } - } - - return ret; -} - -// Remove all -void CbReset(HWND hWnd, UINT id) -{ - wchar_t *s; - // Validate arguments - if (hWnd == NULL) - { - return; - } - - s = GetText(hWnd, id); - - SendMsg(hWnd, id, CB_RESETCONTENT, 0, 0); - - if (s != NULL) - { - SetText(hWnd, id, s); - Free(s); - } -} - -// Select by specifying the index -void CbSelectIndex(HWND hWnd, UINT id, UINT index) -{ - // Validate arguments - if (hWnd == NULL) - { - return; - } - - SendMsg(hWnd, id, CB_SETCURSEL, index, 0); -} - -// Get the data -UINT CbGetData(HWND hWnd, UINT id, UINT index) -{ - // Validate arguments - if (hWnd == NULL || index == INFINITE) - { - return INFINITE; - } - - return SendMsg(hWnd, id, CB_GETITEMDATA, index, 0); -} - -// Search for the data -UINT CbFindData(HWND hWnd, UINT id, UINT data) -{ - UINT i, num; - // Validate arguments - if (hWnd == NULL) - { - return INFINITE; - } - - num = CbNum(hWnd, id); - if (num == INFINITE) - { - return INFINITE; - } - - for (i = 0;i < num;i++) - { - if (CbGetData(hWnd, id, i) == data) - { - return i; - } - } - - return INFINITE; -} - -// Set the height of the item -void CbSetHeight(HWND hWnd, UINT id, UINT value) -{ - // Validate arguments - if (hWnd == NULL) - { - return; - } - - SendMsg(hWnd, id, CB_SETITEMHEIGHT, 0, (UINT)(GetTextScalingFactor() * (double)value)); -} - -// Search by specifying the data -void CbSelect(HWND hWnd, UINT id, int data) -{ - UINT index; - // Validate arguments - if (hWnd == NULL) - { - return; - } - - if (data == INFINITE) - { - // Get the first item - CbSelectIndex(hWnd, id, 0); - return; - } - - index = CbFindData(hWnd, id, data); - if (index == INFINITE) - { - // Can not be found - return; - } - - // Select - CbSelectIndex(hWnd, id, index); -} - -// Get the currently selected item -UINT CbGetSelectIndex(HWND hWnd, UINT id) -{ - // Validate arguments - if (hWnd == NULL) - { - return INFINITE; - } - - return SendMsg(hWnd, id, CB_GETCURSEL, 0, 0); -} - -// Get the value that is currently selected -UINT CbGetSelect(HWND hWnd, UINT id) -{ - UINT index; - // Validate arguments - if (hWnd == NULL) - { - return INFINITE; - } - - index = CbGetSelectIndex(hWnd, id); - if (index == INFINITE) - { - return INFINITE; - } - - return CbGetData(hWnd, id, index); -} - -// OK button is pressed -void PasswordDlgOnOk(HWND hWnd, UI_PASSWORD_DLG *p) -{ - // Validate arguments - if (hWnd == NULL || p == NULL) - { - return; - } - - GetTxtA(hWnd, E_USERNAME, p->Username, sizeof(p->Username)); - GetTxtA(hWnd, E_PASSWORD, p->Password, sizeof(p->Password)); - p->Type = CbGetSelect(hWnd, C_TYPE); - - if (p->ShowNoSavePassword) - { - p->NoSavePassword = IsChecked(hWnd, R_NO_SAVE_PASSWORD); - } - - EndDialog(hWnd, true); -} - -// Password input dialog procedure -UINT PasswordDlgProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param) -{ - UI_PASSWORD_DLG *p = (UI_PASSWORD_DLG *)param; - // Validate arguments - if (hWnd == NULL) - { - return 0; - } - - switch (msg) - { - case WM_INITDIALOG: - SetIcon(hWnd, 0, ICO_KEY); - CbSetHeight(hWnd, C_TYPE, 18); - if (p->ServerName != NULL) - { - FormatText(hWnd, 0, p->ServerName); - } - else - { - SetText(hWnd, 0, _UU("PW_LOGIN_DLG_TITLE")); - } - - if (p->ProxyServer == false) - { - FormatText(hWnd, S_TITLE, p->ServerName == NULL ? "" : p->ServerName); - } - else - { - wchar_t tmp[MAX_SIZE]; - UniFormat(tmp, sizeof(tmp), _UU("PW_MSG_PROXY"), p->ServerName == NULL ? "" : p->ServerName); - SetText(hWnd, S_TITLE, tmp); - } - - // Enumerate the connection methods - SendMsg(hWnd, C_TYPE, CBEM_SETUNICODEFORMAT, true, 0); - - if (StrCmpi(p->Username, WINUI_PASSWORD_NULL_USERNAME) != 0) - { - SetTextA(hWnd, E_USERNAME, p->Username); - SetTextA(hWnd, E_PASSWORD, p->Password); - } - else - { - p->RetryIntervalSec = 0; - SetTextA(hWnd, E_USERNAME, ""); - SetTextA(hWnd, E_PASSWORD, ""); - } - - if (p->AdminMode == false) - { - if (p->ProxyServer == false) - { - CbAddStr(hWnd, C_TYPE, _UU("PW_TYPE_1"), CLIENT_AUTHTYPE_PASSWORD); - CbAddStr(hWnd, C_TYPE, _UU("PW_TYPE_2"), CLIENT_AUTHTYPE_PLAIN_PASSWORD); - } - else - { - CbAddStr(hWnd, C_TYPE, _UU("PW_TYPE_PROXY"), 0); - Disable(hWnd, C_TYPE); - } - - CbSelect(hWnd, C_TYPE, p->Type); - } - else - { - CbAddStr(hWnd, C_TYPE, _UU("SM_PASSWORD_TYPE_STR"), 0); - Disable(hWnd, C_TYPE); - SetTextA(hWnd, E_USERNAME, "Administrator"); - Disable(hWnd, E_USERNAME); - } - - if (IsEmpty(hWnd, E_USERNAME)) - { - FocusEx(hWnd, E_USERNAME); - } - else - { - FocusEx(hWnd, E_PASSWORD); - } - LimitText(hWnd, E_USERNAME, MAX_USERNAME_LEN); - LimitText(hWnd, E_PASSWORD, MAX_PASSWORD_LEN); - - PasswordDlgProcChange(hWnd, p); - - if (p->RetryIntervalSec != 0) - { - SetTimer(hWnd, 1, 50, NULL); - FormatText(hWnd, S_COUNTDOWN, p->RetryIntervalSec); - Show(hWnd, S_COUNTDOWN); - Show(hWnd, P_PROGRESS); - SetRange(hWnd, P_PROGRESS, 0, p->RetryIntervalSec * 1000); - } - else - { - Hide(hWnd, S_COUNTDOWN); - Hide(hWnd, P_PROGRESS); - } - - if (p->ShowNoSavePassword) - { - Show(hWnd, R_NO_SAVE_PASSWORD); - Check(hWnd, R_NO_SAVE_PASSWORD, p->NoSavePassword); - } - else - { - Hide(hWnd, R_NO_SAVE_PASSWORD); - } - - p->StartTick = Tick64(); - - if (p->CancelEvent != NULL) - { - SetTimer(hWnd, 2, 50, NULL); - } - - break; - - case WM_CLOSE: - EndDialog(hWnd, false); - break; - - case WM_TIMER: - switch (wParam) - { - case 1: - if (p->RetryIntervalSec != 0) - { - wchar_t tmp[MAX_SIZE]; - UINT64 end, now, start; - start = p->StartTick; - end = p->StartTick + (UINT64)(p->RetryIntervalSec * 1000); - now = Tick64(); - - if (now <= end) - { - UniFormat(tmp, sizeof(tmp), _UU("PW_RETRYCOUNT"), (UINT)((end - now) / 1000)); - SetText(hWnd, S_COUNTDOWN, tmp); - SetPos(hWnd, P_PROGRESS, (UINT)(now - start)); - } - else - { - EndDialog(hWnd, true); - } - } - break; - - case 2: - if (p->CancelEvent != NULL) - { - // Wait for the end event - HANDLE hEvent = (HANDLE)p->CancelEvent->pData; - UINT ret = WaitForSingleObject(hEvent, 0); - if (ret != WAIT_TIMEOUT) - { - // Forced termination event is set - Close(hWnd); - } - } - break; - } - break; - - case WM_COMMAND: - switch (wParam) - { - case IDOK: - PasswordDlgOnOk(hWnd, p); - break; - case IDCANCEL: - Close(hWnd); - break; - } - switch (HIWORD(wParam)) - { - case EN_CHANGE: - switch (LOWORD(wParam)) - { - case E_USERNAME: - case E_PASSWORD: - PasswordDlgProcChange(hWnd, p); - break; - } - break; - case CBN_SELCHANGE: - switch (LOWORD(wParam)) - { - case C_TYPE: - PasswordDlgProcChange(hWnd, p); - if (IsEmpty(hWnd, E_USERNAME)) - { - FocusEx(hWnd, E_USERNAME); - } - else - { - FocusEx(hWnd, E_PASSWORD); - } - break; - } - break; - } - break; - } - - return 0; -} - -// Set the position of the progress bar -void SetPos(HWND hWnd, UINT id, UINT pos) -{ - // Validate arguments - if (hWnd == NULL) - { - return; - } - - SendMsg(hWnd, id, PBM_SETPOS, pos, 0); -} - -// Set the range of the progress bar -void SetRange(HWND hWnd, UINT id, UINT start, UINT end) -{ - // Validate arguments - if (hWnd == NULL) - { - return; - } - - SendMsg(hWnd, id, PBM_SETRANGE32, start, end); -} - -// Password input dialog -bool PasswordDlg(HWND hWnd, UI_PASSWORD_DLG *p) -{ - // Validate arguments - if (p == NULL) - { - return false; - } - - p->StartTick = Tick64(); - - return Dialog(hWnd, D_PASSWORD, PasswordDlgProc, p); -} - -// Passphrase input dialog -bool PassphraseDlg(HWND hWnd, char *pass, UINT pass_size, BUF *buf, bool p12) -{ - PASSPHRASE_DLG p; - // Validate arguments - if (pass == NULL || buf == NULL) - { - return false; - } - - Zero(&p, sizeof(PASSPHRASE_DLG)); - - p.buf = buf; - p.p12 = p12; - - // Examine whether it is encrypted first - if (p12 == false) - { - // Secret key - if (IsEncryptedK(buf, true) == false) - { - // Unencrypted - StrCpy(pass, pass_size, ""); - return true; - } - } - else - { - // PKCS#12 - P12 *p12 = BufToP12(buf); - if (p12 == NULL) - { - // It is in unknown format, but not encrypted - StrCpy(pass, pass_size, ""); - return true; - } - - if (IsEncryptedP12(p12) == false) - { - // Unencrypted - StrCpy(pass, pass_size, ""); - FreeP12(p12); - return true; - } - FreeP12(p12); - } - - // Show the dialog - if (Dialog(hWnd, D_PASSPHRASE, PassphraseDlgProc, &p) == false) - { - // Cancel - return false; - } - - StrCpy(pass, pass_size, p.pass); - - return true; -} - -// WM_COMMAND handler -void PassphraseDlgProcCommand(HWND hWnd, PASSPHRASE_DLG *p) -{ - char *pass; - bool ok; - // Validate arguments - if (hWnd == NULL || p == NULL) - { - return; - } - - pass = GetTextA(hWnd, E_PASSPHRASE); - if (pass == NULL) - { - return; - } - - ok = false; - - if (p->p12 == false) - { - K *k; - k = BufToK(p->buf, true, true, pass); - if (k != NULL) - { - ok = true; - FreeK(k); - } - } - else - { - X *x; - K *k; - P12 *p12; - p12 = BufToP12(p->buf); - if (p12 != NULL) - { - if (ParseP12(p12, &x, &k, pass)) - { - FreeX(x); - FreeK(k); - ok = true; - } - FreeP12(p12); - } - } - - Free(pass); - - SetEnable(hWnd, IDOK, ok); -} - -// Passphrase input dialog procedure -UINT PassphraseDlgProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param) -{ - PASSPHRASE_DLG *p = (PASSPHRASE_DLG *)param; - // Validate arguments - if (hWnd == NULL) - { - return 0; - } - - switch (msg) - { - case WM_INITDIALOG: - PassphraseDlgProcCommand(hWnd, p); - break; - - case WM_COMMAND: - switch (wParam) - { - case IDOK: - GetTxtA(hWnd, E_PASSPHRASE, p->pass, sizeof(p->pass)); - EndDialog(hWnd, true); - break; - - case IDCANCEL: - Close(hWnd); - break; - } - - switch (LOWORD(wParam)) - { - case E_PASSPHRASE: - PassphraseDlgProcCommand(hWnd, p); - break; - } - break; - - case WM_CLOSE: - EndDialog(hWnd, false); - break; - } - - return 0; -} - -// [Save File] dialog -wchar_t *SaveDlg(HWND hWnd, wchar_t *filter, wchar_t *title, wchar_t *default_name, wchar_t *default_ext) -{ - wchar_t *filter_str; - wchar_t tmp[MAX_SIZE]; - OPENFILENAMEW o; - - if (MsIsNt() == false) - { - char *ret, *s1, *s2, *s3, *s4; - wchar_t *wr; - s1 = CopyUniToStr(filter); - s2 = CopyUniToStr(title); - s3 = CopyUniToStr(default_name); - s4 = CopyUniToStr(default_ext); - ret = SaveDlgA(hWnd, s1, s2, s3, s4); - Free(s1); - Free(s2); - Free(s3); - Free(s4); - wr = CopyStrToUni(ret); - Free(ret); - return wr; - } - - // Validate arguments - if (filter == NULL) - { - filter = _UU("DLG_ALL_FILES"); - } - - filter_str = MakeFilter(filter); - - Zero(&o, sizeof(o)); - Zero(tmp, sizeof(tmp)); - - if (default_name != NULL) - { - UniStrCpy(tmp, sizeof(tmp), default_name); - } - - o.lStructSize = sizeof(o); - - if (OS_IS_WINDOWS_9X(GetOsInfo()->OsType) || (OS_IS_WINDOWS_NT(GetOsInfo()->OsType) && GET_KETA(GetOsInfo()->OsType, 100) <= 1)) - { - o.lStructSize = OPENFILENAME_SIZE_VERSION_400W; - } - - o.hwndOwner = hWnd; - o.hInstance = GetModuleHandle(NULL); - o.lpstrFile = tmp; - o.lpstrTitle = title; - o.lpstrFilter = filter_str; - o.nMaxFile = sizeof(tmp); - o.Flags = OFN_OVERWRITEPROMPT; - o.lpstrDefExt = default_ext; - - if (GetSaveFileNameW(&o) == false) - { - Free(filter_str); - return NULL; - } - - Free(filter_str); - - return UniCopyStr(tmp); -} -char *SaveDlgA(HWND hWnd, char *filter, char *title, char *default_name, char *default_ext) -{ - char *filter_str; - char tmp[MAX_SIZE]; - OPENFILENAME o; - // Validate arguments - if (filter == NULL) - { - filter = _SS("DLG_ALL_FILES"); - } - - filter_str = MakeFilterA(filter); - - Zero(&o, sizeof(o)); - Zero(tmp, sizeof(tmp)); - - if (default_name != NULL) - { - StrCpy(tmp, sizeof(tmp), default_name); - } - - o.lStructSize = sizeof(o); - - if (OS_IS_WINDOWS_9X(GetOsInfo()->OsType) || (OS_IS_WINDOWS_NT(GetOsInfo()->OsType) && GET_KETA(GetOsInfo()->OsType, 100) <= 1)) - { - o.lStructSize = OPENFILENAME_SIZE_VERSION_400A; - } - - o.hwndOwner = hWnd; - o.hInstance = GetModuleHandle(NULL); - o.lpstrFile = tmp; - o.lpstrTitle = title; - o.lpstrFilter = filter_str; - o.nMaxFile = sizeof(tmp); - o.Flags = OFN_OVERWRITEPROMPT; - o.lpstrDefExt = default_ext; - - if (GetSaveFileName(&o) == false) - { - Free(filter_str); - return NULL; - } - - Free(filter_str); - - return CopyStr(tmp); -} - -// [Open File] dialog -wchar_t *OpenDlg(HWND hWnd, wchar_t *filter, wchar_t *title) -{ - wchar_t *filter_str; - wchar_t tmp[MAX_SIZE]; - OPENFILENAMEW o; - - if (MsIsNt() == false) - { - char *ret; - char *filter_a; - char *title_a; - wchar_t *w; - filter_a = CopyUniToStr(filter); - title_a = CopyUniToStr(title); - ret = OpenDlgA(hWnd, filter_a, title_a); - Free(filter_a); - Free(title_a); - w = CopyStrToUni(ret); - Free(ret); - return w; - } - - // Validate arguments - if (filter == NULL) - { - filter = _UU("DLG_ALL_FILES"); - } - - filter_str = MakeFilter(filter); - - Zero(&o, sizeof(OPENFILENAMEW)); - Zero(tmp, sizeof(tmp)); - - o.lStructSize = sizeof(o); - - - if (OS_IS_WINDOWS_9X(GetOsInfo()->OsType) || (OS_IS_WINDOWS_NT(GetOsInfo()->OsType) && GET_KETA(GetOsInfo()->OsType, 100) <= 1)) - { - o.lStructSize = OPENFILENAME_SIZE_VERSION_400W; - } - - - o.hwndOwner = hWnd; - o.hInstance = GetModuleHandle(NULL); - o.lpstrFilter = filter_str; - o.lpstrFile = tmp; - o.nMaxFile = sizeof(tmp); - o.lpstrTitle = title; - o.Flags = OFN_FILEMUSTEXIST | OFN_HIDEREADONLY; - - if (GetOpenFileNameW(&o) == false) - { - Free(filter_str); - return NULL; - } - - Free(filter_str); - - return UniCopyStr(tmp); -} -char *OpenDlgA(HWND hWnd, char *filter, char *title) -{ - char *filter_str; - char tmp[MAX_SIZE]; - OPENFILENAME o; - // Validate arguments - if (filter == NULL) - { - filter = _SS("DLG_ALL_FILES"); - } - - filter_str = MakeFilterA(filter); - - Zero(&o, sizeof(OPENFILENAME)); - Zero(tmp, sizeof(tmp)); - - o.lStructSize = sizeof(o); - - if (OS_IS_WINDOWS_9X(GetOsInfo()->OsType) || (OS_IS_WINDOWS_NT(GetOsInfo()->OsType) && GET_KETA(GetOsInfo()->OsType, 100) <= 1)) - { - o.lStructSize = OPENFILENAME_SIZE_VERSION_400A; - } - - o.hwndOwner = hWnd; - o.hInstance = GetModuleHandle(NULL); - o.lpstrFilter = filter_str; - o.lpstrFile = tmp; - o.nMaxFile = sizeof(tmp); - o.lpstrTitle = title; - o.Flags = OFN_FILEMUSTEXIST | OFN_HIDEREADONLY; - - if (GetOpenFileName(&o) == false) - { - Free(filter_str); - return NULL; - } - - Free(filter_str); - - return CopyStr(tmp); -} - -// Generate the filter string -wchar_t *MakeFilter(wchar_t *str) -{ - UINT i; - wchar_t *ret; - // Validate arguments - if (str == NULL) - { - return NULL; - } - - ret = ZeroMalloc(UniStrSize(str) + 32); - - for (i = 0;i < UniStrLen(str);i++) - { - if (str[i] == L'|') - { - ret[i] = L'\0'; - } - else - { - ret[i] = str[i]; - } - } - - return ret; -} -char *MakeFilterA(char *str) -{ - UINT i; - char *ret; - // Validate arguments - if (str == NULL) - { - return NULL; - } - - ret = ZeroMalloc(StrSize(str) + 32); - - for (i = 0;i < StrLen(str);i++) - { - if (str[i] == '|') - { - ret[i] = '\0'; - } - else - { - ret[i] = str[i]; - } - } - - return ret; -} - -// Execution of batch -bool ExecuteSecureDeviceBatch(HWND hWnd, SECURE *sec, SECURE_DEVICE_THREAD *p, SECURE_DEVICE *dev, WINUI_SECURE_BATCH *batch) -{ - LIST *o; - void *buf; - UINT size = 10 * 1024; // Maximum size of the data - UINT type = INFINITE; - // Validate arguments - if (hWnd == NULL || p == NULL || dev == NULL || batch == NULL || sec == NULL) - { - return false; - } - - switch (batch->Type) - { - case WINUI_SECURE_DELETE_CERT: - type = SEC_X; - goto DELETE_OBJECT; - - case WINUI_SECURE_DELETE_KEY: - type = SEC_K; - goto DELETE_OBJECT; - - case WINUI_SECURE_DELETE_DATA: - type = SEC_DATA; - goto DELETE_OBJECT; - - case WINUI_SECURE_DELETE_OBJECT: - // Delete the object -DELETE_OBJECT: - SetText(hWnd, S_STATUS, _UU("SEC_DELETE")); - if (DeleteSecObjectByName(sec, batch->Name, type) == false) - { - p->ErrorMessage = UniCopyStr(_UU("SEC_ERROR_DELETE")); - return false; - } - break; - - case WINUI_SECURE_ENUM_OBJECTS: - // Enumerate objects - SetText(hWnd, S_STATUS, _UU("SEC_ENUM")); - o = EnumSecObject(sec); - if (o == NULL) - { - p->ErrorMessage = UniCopyStr(_UU("SEC_ERROR_ENUM")); - return false; - } - - batch->EnumList = o; - break; - - case WINUI_SECURE_WRITE_DATA: - // Write the data - SetText(hWnd, S_STATUS, _UU("SEC_WRITE_DATA")); - if (WriteSecData(sec, batch->Private, batch->Name, batch->InputData->Buf, batch->InputData->Size) == false) - { - p->ErrorMessage = UniCopyStr(dev->Type != SECURE_USB_TOKEN ? - _UU("SEC_ERROR_WRITE_1") : _UU("SEC_ERROR_WRITE_2")); - return false; - } - break; - - case WINUI_SECURE_READ_DATA: - // Read the data - SetText(hWnd, S_STATUS, _UU("SEC_READ_DATA")); - buf = MallocEx(size, true); - size = ReadSecData(sec, batch->Name, buf, size); - if (size == 0) - { - Free(buf); - p->ErrorMessage = UniCopyStr(dev->Type != SECURE_USB_TOKEN ? - _UU("SEC_ERROR_NOT_FOUND_1") : _UU("SEC_ERROR_NOT_FOUND_2")); - return false; - } - batch->OutputData = NewBuf(); - WriteBuf(batch->OutputData, buf, size); - SeekBuf(batch->OutputData, 0, 0); - Free(buf); - break; - - case WINUI_SECURE_WRITE_CERT: - // Write the certificate - SetText(hWnd, S_STATUS, _UU("SEC_WRITE_CERT")); - if (WriteSecCert(sec, batch->Private, batch->Name, batch->InputX) == false) - { - p->ErrorMessage = UniCopyStr(dev->Type != SECURE_USB_TOKEN ? - _UU("SEC_ERROR_WRITE_1") : _UU("SEC_ERROR_WRITE_2")); - return false; - } - break; - - case WINUI_SECURE_READ_CERT: - // Read the certificate - SetText(hWnd, S_STATUS, _UU("SEC_READ_CERT")); - batch->OutputX = ReadSecCert(sec, batch->Name); - if (batch->OutputX == NULL) - { - p->ErrorMessage = UniCopyStr(dev->Type != SECURE_USB_TOKEN ? - _UU("SEC_ERROR_NOT_FOUND_1") : _UU("SEC_ERROR_NOT_FOUND_2")); - return false; - } - break; - - case WINUI_SECURE_WRITE_KEY: - // Write the secret key - SetText(hWnd, S_STATUS, _UU("SEC_WRITE_KEY")); - if (WriteSecKey(sec, batch->Private, batch->Name, batch->InputK) == false) - { - p->ErrorMessage = UniCopyStr(dev->Type != SECURE_USB_TOKEN ? - _UU("SEC_ERROR_WRITE_1") : _UU("SEC_ERROR_WRITE_2")); - return false; - } - break; - - case WINUI_SECURE_SIGN_WITH_KEY: - // Signature - SetText(hWnd, S_STATUS, _UU("SEC_SIGN")); - if (SignSec(sec, batch->Name, batch->OutputSign, batch->InputData->Buf, batch->InputData->Size) == false) - { - p->ErrorMessage = UniCopyStr(dev->Type != SECURE_USB_TOKEN ? - _UU("SEC_ERROR_SIGN_1") : _UU("SEC_ERROR_SIGN_2")); - return false; - } - break; - } - - return true; -} - -// Run the secure device operations as a batch job -void SecureDeviceBatch(HWND hWnd, SECURE *sec, SECURE_DEVICE_THREAD *p, SECURE_DEVICE *dev) -{ - UINT i; - // Validate arguments - if (hWnd == NULL || p == NULL || dev == NULL || sec == NULL) - { - return; - } - - // Sequential processing - for (i = 0;i < p->w->num_batch;i++) - { - WINUI_SECURE_BATCH *batch = &p->w->batch[i]; - - if (ExecuteSecureDeviceBatch(hWnd, sec, p, dev, batch) == false) - { - // If fail even one, abort immediately - return; - } - } - - // All batch job succeeded - p->Succeed = true; -} - -// Thread to perform a secure device operation -void SecureDeviceThread(THREAD *t, void *param) -{ - SECURE *sec; - SECURE_DEVICE_THREAD *p = (SECURE_DEVICE_THREAD *)param; - SECURE_DEVICE *dev; - HWND hWnd; - // Validate arguments - if (t == NULL || param == NULL) - { - return; - } - - p->Succeed = false; - p->ErrorMessage = NULL; - - hWnd = p->hWnd; - - // Open the device - dev = GetSecureDevice(p->w->device_id); - SetText(hWnd, S_STATUS, _UU("SEC_OPENING")); - sec = OpenSec(p->w->device_id); - if (sec == NULL) - { - // Device open failure - if (p->w->device_id != 9) - { - p->ErrorMessage = CopyUniFormat(_UU("SEC_ERROR_OPEN_DEVICE"), dev->DeviceName); - } - else - { - p->ErrorMessage = CopyUniFormat(_UU("SEC_ERROR_OPEN_DEVICEEX"), dev->DeviceName); - } - } - else - { - // Open the session - SetText(hWnd, S_STATUS, _UU("SEC_OPEN_SESSION")); - if (OpenSecSession(sec, 0) == false) - { - // Session initialization failure - p->ErrorMessage = CopyUniFormat(_UU("SEC_ERROR_OPEN_SESSION"), dev->DeviceName); - } - else - { - // Login - SetText(hWnd, S_STATUS, _UU("SEC_LOGIN")); - if (LoginSec(sec, p->pin) == false) - { - // Login failure - p->ErrorMessage =UniCopyStr(_UU("SEC_ERROR_LOGIN")); - } - else - { - // Batch processing main - SetText(hWnd, S_STATUS, _UU("SEC_INIT_BATCH")); - SecureDeviceBatch(hWnd, sec, p, dev); - - // Logout - SetText(hWnd, S_STATUS, _UU("SEC_LOGOUT")); - LogoutSec(sec); - } - - // Close the session - SetText(hWnd, S_STATUS, _UU("SEC_CLOSE_SESSION")); - CloseSecSession(sec); - } - - // Close the device - SetText(hWnd, S_STATUS, _UU("SEC_CLOSING")); - CloseSec(sec); - } - - if (p->Succeed) - { - // If successful, show the message for 150ms (service) - SetText(hWnd, S_STATUS, _UU("SEC_FINISHED")); - SleepThread(150); - } - - SendMessage(p->hWnd, WM_APP + 1, 0, 0); -} - -// Start a secure device operation -void StartSecureDevice(HWND hWnd, SECURE_DEVICE_WINDOW *w) -{ - SECURE_DEVICE_THREAD *p; - // Validate arguments - if (hWnd == NULL || w == NULL) - { - return; - } - - // Disable the control - EnableSecureDeviceWindowControls(hWnd, false); - - // Start the thread - p = ZeroMalloc(sizeof(SECURE_DEVICE_THREAD)); - p->w = w; - p->hWnd = hWnd; - w->p = p; - p->pin = GetTextA(hWnd, E_PIN); - ReleaseThread(NewThread(SecureDeviceThread, p)); -} - -// Enable or disable the control of the secure device operation window -void EnableSecureDeviceWindowControls(HWND hWnd, bool enable) -{ - // Validate arguments - if (hWnd == NULL) - { - return; - } - - if (enable) - { - Show(hWnd, S_PIN_CODE); - Show(hWnd, E_PIN); - Show(hWnd, S_WARNING); - } - else - { - Hide(hWnd, S_PIN_CODE); - Hide(hWnd, E_PIN); - Hide(hWnd, S_WARNING); - } - - SetEnable(hWnd, IDOK, enable); - SetEnable(hWnd, IDCANCEL, enable); - SetEnable(hWnd, S_TITLE, enable); - SetEnable(hWnd, S_DEVICE_INFO, enable); - SetEnable(hWnd, S_INSERT_SECURE, enable); - - if (enable == false) - { - DisableClose(hWnd); - SetText(hWnd, S_STATUS, L""); - Show(hWnd, S_STATUS); - PlayAvi(hWnd, A_PROGRESS, true); - } - else - { - EnableClose(hWnd); - SetText(hWnd, S_STATUS, L""); - Hide(hWnd, S_STATUS); - StopAvi(hWnd, A_PROGRESS); - } -} - -// Secure device operation window procedure -UINT SecureDeviceWindowProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param) -{ - SECURE_DEVICE_WINDOW *w = (SECURE_DEVICE_WINDOW *)param; - SECURE_DEVICE *dev = GetSecureDevice(w->device_id); - - switch (msg) - { - case WM_INITDIALOG: - if (dev == NULL) - { - MsgBoxEx(hWnd, MB_ICONEXCLAMATION, _UU("SEC_ERROR_INVALID_ID"), w->device_id); - EndDialog(hWnd, 0); - break; - } - - if (IsJPKI(dev->Id)) - { - // Juki card - Hide(hWnd, S_IMAGE); - Show(hWnd, S_IMAGE2); - Hide(hWnd, S_IMAGE_TSUKUBA); - } - else - { - // Regular card - Hide(hWnd, S_IMAGE2); - - if (w->BitmapId != 0) - { - // For University of Tsukuba - Hide(hWnd, S_IMAGE); - Show(hWnd, S_IMAGE_TSUKUBA); - } - else - { - // For general use - Show(hWnd, S_IMAGE); - Hide(hWnd, S_IMAGE_TSUKUBA); - } - } - - FormatText(hWnd, 0, dev->Type != SECURE_USB_TOKEN ? _UU("SEC_SMART_CARD") : _UU("SEC_USB_TOKEN"), - dev->DeviceName); - FormatText(hWnd, S_TITLE, dev->DeviceName); - FormatText(hWnd, S_INSERT_SECURE, - dev->Type != SECURE_USB_TOKEN ? _UU("SEC_INIT_MSG_1") : _UU("SEC_INIT_MSG_2")); - FormatText(hWnd, S_DEVICE_INFO, - dev->DeviceName, dev->Manufacturer, dev->ModuleName); - - DlgFont(hWnd, S_SOFTWARE_TITLE, 11, 0); - SetText(hWnd, S_SOFTWARE_TITLE, title_bar); - - DlgFont(hWnd, S_TITLE, 14, true); - DlgFont(hWnd, S_DEVICE_INFO, 11, false); - DlgFont(hWnd, S_STATUS, 13, true); - EnableSecureDeviceWindowControls(hWnd, true); - OpenAvi(hWnd, A_PROGRESS, AVI_PROGRESS); - - SetIcon(hWnd, 0, ICO_KEY); - - // Initial PIN - if ((w->default_pin != NULL && StrLen(w->default_pin) != 0) || (cached_pin_code_expires >= Tick64())) - { - if (w->default_pin != NULL && StrLen(w->default_pin) != 0) - { - SetTextA(hWnd, E_PIN, w->default_pin); - } - else - { - SetTextA(hWnd, E_PIN, cached_pin_code); - } - SetTimer(hWnd, 1, 1, NULL); - } - - break; - - case WM_TIMER: - switch (wParam) - { - case 1: - KillTimer(hWnd, 1); - Command(hWnd, IDOK); - break; - } - break; - - case WM_COMMAND: - switch (wParam) - { - case IDOK: - StartSecureDevice(hWnd, w); - break; - - case IDCANCEL: - Close(hWnd); - break; - } - break; - - case WM_CLOSE: - if (IsEnable(hWnd, IDCANCEL)) - { - CloseAvi(hWnd, A_PROGRESS); - EndDialog(hWnd, false); - } - break; - - case WM_APP + 1: - // There is a response from the thread - if (w->p != NULL) - { - if (w->p->Succeed) - { - // Success - if (w->default_pin != NULL) - { - StrCpy(w->default_pin, 128, w->p->pin); - } - StrCpy(cached_pin_code, sizeof(cached_pin_code), w->p->pin); - cached_pin_code_expires = Tick64() + (UINT64)WINUI_SECUREDEVICE_PIN_CACHE_TIME; - Free(w->p->pin); - Free(w->p); - EndDialog(hWnd, true); - } - else - { - // Failure - cached_pin_code_expires = 0; - EnableSecureDeviceWindowControls(hWnd, true); - FocusEx(hWnd, E_PIN); - MsgBox(hWnd, MB_ICONEXCLAMATION, w->p->ErrorMessage); - Free(w->p->pin); - Free(w->p->ErrorMessage); - Free(w->p); - } - } - break; - } - - return 0; -} - -// Send a WM_COMMAND -void Command(HWND hWnd, UINT id) -{ - SendMessage(hWnd, WM_COMMAND, id, 0); -} - -// Show the secure device window -bool SecureDeviceWindow(HWND hWnd, WINUI_SECURE_BATCH *batch, UINT num_batch, UINT device_id, UINT bitmap_id) -{ - SECURE_DEVICE_WINDOW w; - UINT i; - // Validate arguments - if (batch == NULL || num_batch == 0 || device_id == 0) - { - return false; - } - - // Initialize the success flag - for (i = 0;i < num_batch;i++) - { - batch[i].Succeed = false; - } - - Zero(&w, sizeof(w)); - w.batch = batch; - w.device_id = device_id; - w.num_batch = num_batch; - w.BitmapId = bitmap_id; - - // Open a dialog - return (bool)Dialog(hWnd, D_SECURE, SecureDeviceWindowProc, &w); -} - -// Stop playing the AVI -void StopAvi(HWND hWnd, UINT id) -{ - // Validate arguments - if (hWnd == NULL) - { - return; - } - - Animate_Stop(DlgItem(hWnd, id)); - Hide(hWnd, id); -} - -// Play an AVI -void PlayAvi(HWND hWnd, UINT id, bool repeat) -{ - // Validate arguments - if (hWnd == NULL) - { - return; - } - - Show(hWnd, id); - Animate_Play(DlgItem(hWnd, id), 0, -1, (repeat ? -1 : 0)); -} - -// Close the AVI file -void CloseAvi(HWND hWnd, UINT id) -{ - // Validate arguments - if (hWnd == NULL) - { - return; - } - - StopAvi(hWnd, id); - Animate_Close(DlgItem(hWnd, id)); -} - -// Open an AVI file -void OpenAvi(HWND hWnd, UINT id, UINT avi_id) -{ - // Validate arguments - if (hWnd == NULL || avi_id == 0) - { - return; - } - - Hide(hWnd, id); - Animate_OpenEx(DlgItem(hWnd, id), hDll, MAKEINTRESOURCE(avi_id)); -} - -// Set the font to the control -void DlgFont(HWND hWnd, UINT id, UINT size, UINT bold) -{ - DIALOG_PARAM *param = (DIALOG_PARAM *)GetParam(hWnd); - - if (param == NULL || param->meiryo == false) - { - SetFont(hWnd, id, Font(size, bold)); - } - else - { - SetFont(hWnd, id, GetFont((_GETLANG() == 2 ? "Microsoft YaHei" : GetMeiryoFontName()), size, bold, false, false, false)); - } -} - -// Generate a standard font -HFONT Font(UINT size, UINT bold) -{ - return GetFont(NULL, size, bold, false, false, false); -} - -// Dialog procedure for internal management -UINT CALLBACK InternalDialogProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam) -{ - DIALOG_PARAM *param = (DIALOG_PARAM *)GetParam(hWnd); - void *app_param = NULL; - bool white_flag = false; - UINT ret; - // Validate arguments - if (hWnd == NULL) - { - return 0; - } - - if (msg == WM_INITDIALOG) - { - DoEvents(hWnd); - } - - if (param == NULL) - { - if (msg == WM_INITDIALOG) - { - param = (void *)lParam; - InitDialogInternational(hWnd, param); - } - } - if (param != NULL) - { - app_param = param->param; - white_flag = param->white; - } - - ret = DlgProc(hWnd, msg, wParam, lParam, white_flag); - if (ret != 0) - { - return ret; - } - - ret = 0; - - if (param != NULL) - { - if (param->proc != NULL) - { - ret = param->proc(hWnd, msg, wParam, lParam, app_param); - } - else - { - if (msg == WM_CLOSE) - { - EndDialog(hWnd, 0); - } - else if (msg == WM_COMMAND && (wParam == IDOK || wParam == IDCANCEL)) - { - Close(hWnd); - } - } - } - - if (msg == WM_INITDIALOG) - { - SetForegroundWindow(hWnd); - SetActiveWindow(hWnd); - } - - return ret; -} - -// Show a dialog box -UINT Dialog(HWND hWnd, UINT id, WINUI_DIALOG_PROC *proc, void *param) -{ - bool white = true; - - return DialogEx(hWnd, id, proc, param, white); -} -UINT DialogEx(HWND hWnd, UINT id, WINUI_DIALOG_PROC *proc, void *param, bool white) -{ - return DialogEx2(hWnd, id, proc, param, white, false); -} -UINT DialogEx2(HWND hWnd, UINT id, WINUI_DIALOG_PROC *proc, void *param, bool white, bool meiryo) -{ - UINT ret; - DIALOG_PARAM p; - // Validate arguments - if (id == 0) - { - return 0; - } - - Zero(&p, sizeof(p)); - p.param = param; - p.white = white; - p.proc = proc; - - p.BitmapList = NewBitmapList(); - - if (MsIsVista()) - { - p.meiryo = meiryo; - } - - ret = DialogInternal(hWnd, id, InternalDialogProc, &p); - - FreeBitmapList(p.BitmapList); - - return ret; -} - -// Initialize the icon cache -void InitIconCache() -{ - if (icon_cache_list != NULL) - { - return; - } - - icon_cache_list = NewList(NULL); -} - -// Release the icon cache -void FreeIconCache() -{ - UINT i; - if (icon_cache_list == NULL) - { - return; - } - - for (i = 0;i < LIST_NUM(icon_cache_list);i++) - { - ICON_CACHE *c = LIST_DATA(icon_cache_list, i); - DestroyIcon(c->hIcon); - Free(c); - } - - ReleaseList(icon_cache_list); - icon_cache_list = NULL; -} - -// Get the Icon -HICON LoadIconEx(UINT id, bool small_icon) -{ - HICON h = NULL; - UINT i; - if (icon_cache_list == NULL) - { - return small_icon == false ? LoadLargeIconInner(id) : LoadSmallIconInner(id); - } - - LockList(icon_cache_list); - { - for (i = 0;i < LIST_NUM(icon_cache_list);i++) - { - ICON_CACHE *c = LIST_DATA(icon_cache_list, i); - if (c->id == id && c->small_icon == small_icon) - { - h = c->hIcon; - break; - } - } - - if (h == NULL) - { - h = small_icon == false ? LoadLargeIconInner(id) : LoadSmallIconInner(id); - if (h != NULL) - { - ICON_CACHE *c = ZeroMalloc(sizeof(ICON_CACHE)); - c->hIcon = h; - c->id = id; - c->small_icon = small_icon; - Add(icon_cache_list, c); - } - } - } - UnlockList(icon_cache_list); - - return h; -} - -// Get a large Icon -HICON LoadLargeIcon(UINT id) -{ - return LoadIconEx(id, false); -} - -// Get a small icon -HICON LoadSmallIcon(UINT id) -{ - return LoadIconEx(id, true); -} - -// Get a large icon -HICON LoadLargeIconInner(UINT id) -{ - HICON ret; - ret = LoadImage(hDll, MAKEINTRESOURCE(id), IMAGE_ICON, 32, 32, 0); - if (ret == NULL) - { - ret = LoadImage(hDll, MAKEINTRESOURCE(id), IMAGE_ICON, 32, 32, LR_VGACOLOR); - if (ret == NULL) - { - ret = LoadImage(hDll, MAKEINTRESOURCE(id), IMAGE_ICON, 0, 0, 0); - if (ret == NULL) - { - ret = LoadImage(hDll, MAKEINTRESOURCE(id), IMAGE_ICON, 0, 0, LR_VGACOLOR); - if (ret == NULL) - { - ret = LoadIcon(hDll, MAKEINTRESOURCE(id)); - } - } - } - } - return ret; -} - -// Get a small icon -HICON LoadSmallIconInner(UINT id) -{ - HICON ret; - ret = LoadImage(hDll, MAKEINTRESOURCE(id), IMAGE_ICON, 16, 16, 0); - if (ret == NULL) - { - ret = LoadImage(hDll, MAKEINTRESOURCE(id), IMAGE_ICON, 16, 16, LR_VGACOLOR); - if (ret == NULL) - { - ret = LoadImage(hDll, MAKEINTRESOURCE(id), IMAGE_ICON, 0, 0, 0); - if (ret == NULL) - { - ret = LoadImage(hDll, MAKEINTRESOURCE(id), IMAGE_ICON, 0, 0, LR_VGACOLOR); - if (ret == NULL) - { - ret = LoadLargeIconInner(id); - } - } - } - } - return ret; -} - -// Set the icon to the button or window -void SetIcon(HWND hWnd, UINT id, UINT icon_id) -{ - HICON icon1, icon2; - // Validate arguments - if (hWnd == NULL) - { - return; - } - - icon1 = LoadLargeIcon(icon_id); - if (icon1 == NULL) - { - return; - } - - if (id == 0) - { - SendMessage(hWnd, WM_SETICON, ICON_BIG, (LPARAM)icon1); - icon2 = LoadSmallIcon(icon_id); - if (icon2 == NULL) - { - icon2 = icon1; - } - SendMessage(hWnd, WM_SETICON, ICON_SMALL, (LPARAM)icon2); - } - else - { - bool is_btn = true; - wchar_t *s = GetClass(hWnd, id); - if (s != NULL) - { - if (UniStrCmpi(s, L"Static") == 0) - { - is_btn = false; - } - Free(s); - } - - if (is_btn) - { - SendMsg(hWnd, id, BM_SETIMAGE, IMAGE_ICON, (LPARAM)icon1); - } - else - { - SendMsg(hWnd, id, STM_SETICON, (WPARAM)icon1, 0); - } - } -} - -// Check whether the radio button is checked -bool IsChecked(HWND hWnd, UINT id) -{ - // Validate arguments - if (hWnd == NULL) - { - return false; - } - - return IsDlgButtonChecked(hWnd, id) == BST_CHECKED ? true : false; -} - -// Check the radio button -void Check(HWND hWnd, UINT id, bool b) -{ - // Validate arguments - if (hWnd == NULL) - { - return; - } - - if ((!(!IsChecked(hWnd, id))) != (!(!b))) - { - CheckDlgButton(hWnd, id, b ? BST_CHECKED : BST_UNCHECKED); - } -} - -// Limit the number of characters that can be entered into the text-box -void LimitText(HWND hWnd, UINT id, UINT count) -{ - // Validate arguments - if (hWnd == NULL) - { - return; - } - - SendMsg(hWnd, id, EM_LIMITTEXT, count, 0); -} - -// Font settings -void SetFont(HWND hWnd, UINT id, HFONT hFont) -{ - SetFontEx(hWnd, id, hFont, false); -} -void SetFontEx(HWND hWnd, UINT id, HFONT hFont, bool no_adjust_font_size) -{ - // Validate arguments - if (hWnd == NULL || hFont == NULL) - { - return; - } - - SendMessage(DlgItem(hWnd, id), WM_SETFONT, (WPARAM)hFont, true); - - if (no_adjust_font_size == false) - { - AdjustFontSize(hWnd, id); - } -} - -// Calculate the font size -bool CalcFontSize(HFONT hFont, UINT *x, UINT *y) -{ - UINT xx = 0, yy = 0; - TEXTMETRIC tm; - SIZE sz; - bool ret = false; - HDC hDC; - - hDC = CreateCompatibleDC(NULL); - - SelectObject(hDC, hFont); - - Zero(&tm, sizeof(tm)); - Zero(&sz, sizeof(sz)); - - if (GetTextMetrics(hDC, &tm)) - { - xx = tm.tmAveCharWidth; - yy = tm.tmHeight; - - ret = true; - - if (GetTextExtentPoint32(hDC, - "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz", - 52, &sz)) - { - xx = (sz.cx / 26 + 1) / 2; - } - } - - if (x != NULL) - { - *x = xx; - } - - if (y != NULL) - { - *y = yy; - } - - DeleteDC(hDC); - - return ret; -} - -// Get the font magnification -double GetTextScalingFactor() -{ - static int cached_dpi = 0; - double ret = 1.0; - - if (MsIsVista() == false) - { - // It's always 1.0 in Windows XP or earlier - return 1.0; - } - - if (cached_dpi == 0) - { - HDC hDC = CreateCompatibleDC(NULL); - - if (hDC != NULL) - { - cached_dpi = GetDeviceCaps(hDC, LOGPIXELSY); - - DeleteDC(hDC); - } - } - - if (cached_dpi != 0) - { - ret = (double)cached_dpi / 96.0; - - if (ret < 0) - { - ret = -ret; - } - } - - return ret; -} - -// Get the parameters of the font that was created in the past -bool GetFontParam(HFONT hFont, struct FONT *f) -{ - bool ret = false; - // Validate arguments - if (hFont == NULL || f == NULL) - { - return false; - } - - // Search for the existing font - LockList(font_list); - { - UINT i; - - for (i = 0;i < LIST_NUM(font_list);i++) - { - FONT *n = LIST_DATA(font_list, i); - - if (n->hFont == hFont) - { - Copy(f, n, sizeof(FONT)); - - ret = true; - - break; - } - } - } - UnlockList(font_list); - - return ret; -} - -// Get the font -HFONT GetFont(char *name, UINT size, bool bold, bool italic, bool underline, bool strikeout) -{ - HFONT hFont; - HDC hDC; - // Validate arguments - if (name == NULL) - { - name = font_name; - } - if (size == 0) - { - size = font_size; - if (size == 0) - { - size = 9; - } - } - - // Search for the existing font - LockList(font_list); - { - FONT *f, t; - DWORD font_quality = ANTIALIASED_QUALITY; - OS_INFO *os = GetOsInfo(); - UINT x = 0; - UINT y = 0; - int rotate = 0; - UINT dpi; - - Zero(&t, sizeof(t)); - t.Bold = bold; - t.Italic = italic; - t.Size = size; - t.StrikeOut = strikeout; - t.UnderLine = underline; - t.Name = CopyStr(name); - f = Search(font_list, &t); - Free(t.Name); - - if (f != NULL) - { - // Font is found - UnlockList(font_list); - return f->hFont; - } - - // Create a new font - hDC = CreateCompatibleDC(NULL); - - // Specify the ClearType in Windows XP or later - if (OS_IS_WINDOWS_NT(os->OsType) && GET_KETA(os->OsType, 100) >= 3) - { - font_quality = CLEARTYPE_NATURAL_QUALITY; - rotate = 3600; - } - - if (MsIsVista()) - { - dpi = GetDeviceCaps(hDC, LOGPIXELSY); - } - else - { - dpi = 96; - } - - // Create a font - hFont = CreateFontA(-MulDiv(size, dpi, 72), - 0, rotate, rotate, (bold == false ? 500 : FW_BOLD), - italic, underline, strikeout, DEFAULT_CHARSET, OUT_DEFAULT_PRECIS, - CLIP_DEFAULT_PRECIS, font_quality, DEFAULT_PITCH, name); - - if (hFont == NULL) - { - // Failure - DeleteDC(hDC); - UnlockList(font_list); - - return NULL; - } - - CalcFontSize(hFont, &x, &y); - - // Add to the table - f = ZeroMalloc(sizeof(FONT)); - f->Bold = bold; - f->hFont = hFont; - f->Italic = italic; - f->Name = CopyStr(name); - f->Size = size; - f->StrikeOut = strikeout; - f->UnderLine = underline; - f->x = x; - f->y = y; - - Insert(font_list, f); - - DeleteDC(hDC); - } - UnlockList(font_list); - - return hFont; -} - -// Comparison of the font -int CompareFont(void *p1, void *p2) -{ - FONT *f1, *f2; - UINT r; - if (p1 == NULL || p2 == NULL) - { - return 0; - } - f1 = *(FONT **)p1; - f2 = *(FONT **)p2; - if (f1 == NULL || f2 == NULL) - { - return 0; - } - r = StrCmpi(f1->Name, f2->Name); - if (r != 0) - { - return r; - } - else - { - if (f1->Bold > f2->Bold) - { - return 1; - } - else if (f1->Bold < f2->Bold) - { - return -1; - } - else if (f1->Italic > f2->Italic) - { - return 1; - } - else if (f1->Italic < f2->Italic) - { - return -1; - } - else if (f1->Size > f2->Size) - { - return 1; - } - else if (f1->Size < f2->Size) - { - return -1; - } - else if (f1->StrikeOut > f2->StrikeOut) - { - return 1; - } - else if (f1->StrikeOut < f2->StrikeOut) - { - return -1; - } - else if (f1->UnderLine > f2->UnderLine) - { - return 1; - } - else if (f1->UnderLine < f2->UnderLine) - { - return -1; - } - else - { - return 0; - } - } -} - -// Initialize the font -void InitFont() -{ - if (font_list != NULL) - { - return; - } - font_list = NewList(CompareFont); -} - -// Release the font -void FreeFont() -{ - UINT i; - if (font_list == NULL) - { - return; - } - for (i = 0;i < LIST_NUM(font_list);i++) - { - FONT *f = LIST_DATA(font_list, i); - Free(f->Name); - DeleteObject((HGDIOBJ)f->hFont); - Free(f); - } - ReleaseList(font_list); - font_list = NULL; -} - -// Show a button to close the window -void EnableClose(HWND hWnd) -{ - HMENU h; - // Validate arguments - if (hWnd == NULL) - { - return; - } - - h = GetSystemMenu(hWnd, false); - EnableMenuItem(h, SC_CLOSE, MF_ENABLED); - DrawMenuBar(hWnd); -} - -// Hide the button to close the window -void DisableClose(HWND hWnd) -{ - HMENU h; - // Validate arguments - if (hWnd == NULL) - { - return; - } - - h = GetSystemMenu(hWnd, false); - EnableMenuItem(h, SC_CLOSE, MF_GRAYED); - DrawMenuBar(hWnd); -} - -// Move to the center of the parent window -void CenterParent(HWND hWnd) -{ - RECT rp; - RECT r; - HWND hWndParent = GetParent(hWnd); - int win_x, win_y; - int x, y; - - if (hWndParent == NULL || IsHide(hWndParent, 0) || IsIconic(hWndParent)) - { - Center(hWnd); - return; - } - - if (GetWindowRect(hWndParent, &rp) == false) - { - Center(hWnd); - return; - } - - GetWindowRect(hWnd, &r); - - win_x = r.right - r.left; - win_y = r.bottom - r.top; - - x = (rp.right - rp.left - win_x) / 2 + rp.left; - y = (rp.bottom - rp.top - win_y) / 2 + rp.top; - - x = MAX(x, 0); - y = MAX(y, 0); - - SetWindowPos(hWnd, NULL, x, y, 0, 0, SWP_NOSIZE | SWP_NOACTIVATE); -} - -// Move the window to the center -void Center(HWND hWnd) -{ - RECT screen; - RECT win; - UINT x, y; - UINT win_x, win_y; - // Validate arguments - if (hWnd == NULL) - { - return; - } - - if (SystemParametersInfo(SPI_GETWORKAREA, 0, &screen, 0) == false) - { - return; - } - - GetWindowRect(hWnd, &win); - win_x = win.right - win.left; - win_y = win.bottom - win.top; - - if (win_x < (UINT)(screen.right - screen.left)) - { - x = (screen.right - screen.left - win_x) / 2; - } - else - { - x = 0; - } - - if (win_y < (UINT)(screen.bottom - screen.top)) - { - y = (screen.bottom - screen.top - win_y) / 2; - } - else - { - y = 0; - } - - SetWindowPos(hWnd, NULL, x, y, 0, 0, SWP_NOSIZE | SWP_NOACTIVATE); -} - -// Format the string in the window -void FormatText(HWND hWnd, UINT id, ...) -{ - va_list args; - wchar_t *buf; - UINT size; - wchar_t *str; - // Validate arguments - if (hWnd == NULL) - { - return; - } - - str = GetText(hWnd, id); - if (str == NULL) - { - return; - } - - size = MAX(UniStrSize(str) * 10, MAX_SIZE * 10); - buf = MallocEx(size, true); - - va_start(args, id); - UniFormatArgs(buf, size, str, args); - - SetText(hWnd, id, buf); - - Free(buf); - - Free(str); - va_end(args); -} - -// Show the variable-length message box -UINT MsgBoxEx(HWND hWnd, UINT flag, wchar_t *msg, ...) -{ - va_list args; - wchar_t *buf; - UINT size; - UINT ret; - // Validate arguments - if (msg == NULL) - { - msg = L"MessageBox"; - } - - size = MAX(UniStrSize(msg) * 10, MAX_SIZE * 10); - buf = MallocEx(size, true); - - va_start(args, msg); - UniFormatArgs(buf, size, msg, args); - - ret = MsgBox(hWnd, flag, buf); - Free(buf); - va_end(args); - - return ret; -} - -// Show the message box -UINT MsgBox(HWND hWnd, UINT flag, wchar_t *msg) -{ - UINT ret; - wchar_t *title; - // Validate arguments - if (msg == NULL) - { - msg = L"MessageBox"; - } - - if (title_bar != NULL) - { - title = CopyUniStr(title_bar); - } - else - { - title = CopyStrToUni(CEDAR_PRODUCT_STR); - } - - if (hWnd) - { - // Raise the message box to top-level if the parent window is the top-level window - if (GetExStyle(hWnd, 0) & WS_EX_TOPMOST) - { - flag |= MB_SYSTEMMODAL; - } - } - - ret = MessageBoxW(hWnd, msg, title, flag); - - Free(title); - - return ret; -} - -// Create a dialog (internal) -UINT DialogInternal(HWND hWnd, UINT id, DIALOG_PROC *proc, void *param) -{ - // Validate arguments - if (proc == NULL) - { - return 0; - } - - if (MsIsNt() == false) - { - // Win9x - return (UINT)DialogBoxParam(hDll, MAKEINTRESOURCE(id), hWnd, (DLGPROC)proc, (LPARAM)param); - } - else - { - // WinNT - return (UINT)DialogBoxParamW(hDll, MAKEINTRESOURCEW(id), hWnd, (DLGPROC)proc, (LPARAM)param); - } -} - -// Dialog box procedure managed by WinUi -UINT DlgProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, bool white_color) -{ - void *param; - HWND hWndParent; - // Validate arguments - if (hWnd == NULL) - { - return 0; - } - - switch (msg) - { - case WM_INITDIALOG: - if (true) - { - RECT rect1; - - SetRect(&rect1, 0, 0, 100, 100); - MapDialogRect(hWnd, &rect1); - Debug("%u %u %u %u\n", rect1.left, rect1.right, rect1.top, rect1.bottom); - } - - param = (void *)lParam; - SetParam(hWnd, param); - - // Examine whether the parent window exists - hWndParent = GetParent(hWnd); - if (hWndParent == NULL || IsShow(hWndParent, 0) == false) - { - // Place in the center if parent does not exist - Center(hWnd); - } - - if (UseAlpha) - { - UINT os_type = GetOsInfo()->OsType; - if (OS_IS_WINDOWS_NT(os_type) && GET_KETA(os_type, 100) >= 2) - { - bool (WINAPI *_SetLayeredWindowAttributes)(HWND, COLORREF, BYTE, DWORD); - HINSTANCE hInst; - - hInst = LoadLibrary("user32.dll"); - _SetLayeredWindowAttributes = - (bool (__stdcall *)(HWND,COLORREF,BYTE,DWORD)) - GetProcAddress(hInst, "SetLayeredWindowAttributes"); - - if (_SetLayeredWindowAttributes != NULL) - { - // Only available on Windows 2000 or later - SetExStyle(hWnd, 0, WS_EX_LAYERED); - _SetLayeredWindowAttributes(hWnd, 0, AlphaValue * 255 / 100, LWA_ALPHA); - } - } - } - - break; - - case WM_CTLCOLORBTN: - case WM_CTLCOLORDLG: - case WM_CTLCOLOREDIT: - case WM_CTLCOLORLISTBOX: - case WM_CTLCOLORMSGBOX: - case WM_CTLCOLORSCROLLBAR: - case WM_CTLCOLORSTATIC: - if (white_color) - { - return (UINT)GetStockObject(WHITE_BRUSH); - } - break; - } - - return 0; -} - -// Set the parameters of the dialog box -void SetParam(HWND hWnd, void *param) -{ - // Validate arguments - if (hWnd == NULL) - { - return; - } - - SetWindowLongPtr(hWnd, DWLP_USER, (LONG_PTR)param); -} - -// Get the parameters of the dialog box -void *GetParam(HWND hWnd) -{ - void *ret; - // Validate arguments - if (hWnd == NULL) - { - return NULL; - } - - ret = (void *)GetWindowLongPtr(hWnd, DWLP_USER); - return ret; -} - -// Show the windows as foreground -void Top(HWND hWnd) -{ - // Validate arguments - if (hWnd == NULL) - { - return; - } - - SetWindowPos(hWnd, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE); -} - -// Hide the window -void Hide(HWND hWnd, UINT id) -{ - // Validate arguments - if (hWnd == NULL) - { - return; - } - - if (IsShow(hWnd, id)) - { - ShowWindow(DlgItem(hWnd, id), SW_HIDE); - } -} - -// Show the window -void Show(HWND hWnd, UINT id) -{ - // Validate arguments - if (hWnd == NULL) - { - return; - } - - if (IsHide(hWnd, id)) - { - ShowWindow(DlgItem(hWnd, id), SW_SHOW); - } -} - -// Change the display settings -void SetShow(HWND hWnd, UINT id, bool b) -{ - // Validate arguments - if (hWnd == NULL) - { - return; - } - - if (b) - { - Show(hWnd, id); - } - else - { - Hide(hWnd, id); - } -} - -// Get whether the window is shown -bool IsShow(HWND hWnd, UINT id) -{ - return IsHide(hWnd, id) ? false : true; -} - -// Get whether the window is hidden -bool IsHide(HWND hWnd, UINT id) -{ - // Validate arguments - if (hWnd == NULL) - { - return true; - } - - if (GetStyle(hWnd, id) & WS_VISIBLE) - { - return false; - } - else - { - return true; - } -} - -// Remove the window style -void RemoveExStyle(HWND hWnd, UINT id, UINT style) -{ - UINT old; - // Validate arguments - if (hWnd == NULL) - { - return; - } - - old = GetExStyle(hWnd, id); - if ((old & style) == 0) - { - return; - } - - SetWindowLong(DlgItem(hWnd, id), GWL_EXSTYLE, old & ~style); - Refresh(DlgItem(hWnd, id)); -} - -// Set the window style -void SetExStyle(HWND hWnd, UINT id, UINT style) -{ - UINT old; - // Validate arguments - if (hWnd == NULL) - { - return; - } - - old = GetExStyle(hWnd, id); - if (old & style) - { - return; - } - - SetWindowLong(DlgItem(hWnd, id), GWL_EXSTYLE, old | style); - Refresh(DlgItem(hWnd, id)); -} - -// Get the window style -UINT GetExStyle(HWND hWnd, UINT id) -{ - // Validate arguments - if (hWnd == NULL) - { - return 0; - } - - return GetWindowLong(DlgItem(hWnd, id), GWL_EXSTYLE); -} - -// Remove the window style -void RemoveStyle(HWND hWnd, UINT id, UINT style) -{ - UINT old; - // Validate arguments - if (hWnd == NULL) - { - return; - } - - old = GetStyle(hWnd, id); - if ((old & style) == 0) - { - return; - } - - SetWindowLong(DlgItem(hWnd, id), GWL_STYLE, old & ~style); - Refresh(DlgItem(hWnd, id)); -} - -// Set the window style -void SetStyle(HWND hWnd, UINT id, UINT style) -{ - UINT old; - // Validate arguments - if (hWnd == NULL) - { - return; - } - - old = GetStyle(hWnd, id); - if (old & style) - { - return; - } - - SetWindowLong(DlgItem(hWnd, id), GWL_STYLE, old | style); - Refresh(DlgItem(hWnd, id)); -} - -// Get the window style -UINT GetStyle(HWND hWnd, UINT id) -{ - // Validate arguments - if (hWnd == NULL) - { - return 0; - } - - return GetWindowLong(DlgItem(hWnd, id), GWL_STYLE); -} - -// Get the number of characters in the text -UINT GetTextLen(HWND hWnd, UINT id, bool unicode) -{ - wchar_t *s; - UINT ret; - // Validate arguments - if (hWnd == NULL) - { - return 0; - } - - s = GetText(hWnd, id); - if (s == NULL) - { - return 0; - } - - if (unicode) - { - ret = UniStrLen(s); - } - else - { - char *tmp = CopyUniToStr(s); - ret = StrLen(tmp); - Free(tmp); - } - - Free(s); - - return ret; -} - -// Check whether the text is blank -bool IsEmpty(HWND hWnd, UINT id) -{ - bool ret; - wchar_t *s; - // Validate arguments - if (hWnd == NULL) - { - return true; - } - - s = GetText(hWnd, id); - - UniTrim(s); - if (UniStrLen(s) == 0) - { - ret = true; - } - else - { - ret = false; - } - - Free(s); - - return ret; -} - -// Get the window class -wchar_t *GetClass(HWND hWnd, UINT id) -{ - wchar_t tmp[MAX_SIZE]; - - if (MsIsNt() == false) - { - wchar_t *ret; - char *s; - s = GetClassA(hWnd, id); - ret = CopyStrToUni(s); - Free(s); - return ret; - } - - // Validate arguments - if (hWnd == NULL) - { - return CopyUniStr(L""); - } - - GetClassNameW(DlgItem(hWnd, id), tmp, sizeof(tmp)); - - return UniCopyStr(tmp); -} -char *GetClassA(HWND hWnd, UINT id) -{ - char tmp[MAX_SIZE]; - // Validate arguments - if (hWnd == NULL) - { - return CopyStr(""); - } - - GetClassName(DlgItem(hWnd, id), tmp, sizeof(tmp)); - - return CopyStr(tmp); -} - -// Transmit a message to the control -UINT SendMsg(HWND hWnd, UINT id, UINT msg, WPARAM wParam, LPARAM lParam) -{ - // Validate arguments - if (hWnd == NULL) - { - return 0; - } - - if (MsIsNt()) - { - return (UINT)SendMessageW(DlgItem(hWnd, id), msg, wParam, lParam); - } - else - { - return (UINT)SendMessageA(DlgItem(hWnd, id), msg, wParam, lParam); - } -} - -// Move the cursor to the right edge of the text in the EDIT -void SetCursorOnRight(HWND hWnd, UINT id) -{ - wchar_t *class_name; - // Validate arguments - if (hWnd == NULL) - { - return; - } - - class_name = GetClass(hWnd, id); - - if (class_name != NULL) - { - if (UniStrCmpi(class_name, L"edit") == 0) - { - wchar_t *str = GetText(hWnd, id); - - if (str != NULL) - { - UINT len = UniStrLen(str); - - SendMsg(hWnd, id, EM_SETSEL, len, len); - - Free(str); - } - } - Free(class_name); - } -} - -// Select entire the text in the EDIT -void SelectEdit(HWND hWnd, UINT id) -{ - wchar_t *class_name; - - // Validate arguments - if (hWnd == NULL) - { - return; - } - - class_name = GetClass(hWnd, id); - - if (class_name != NULL) - { - if (UniStrCmpi(class_name, L"edit") == 0) - { - SendMsg(hWnd, id, EM_SETSEL, 0, -1); - } - Free(class_name); - } -} - -// Deselect the text of EDIT -void UnselectEdit(HWND hWnd, UINT id) -{ - wchar_t *class_name; - - // Validate arguments - if (hWnd == NULL) - { - return; - } - - class_name = GetClass(hWnd, id); - - if (class_name != NULL) - { - if (UniStrCmpi(class_name, L"edit") == 0) - { - SendMsg(hWnd, id, EM_SETSEL, -1, 0); - } - Free(class_name); - } -} - -// Select all by setting the focus to the EDIT -void FocusEx(HWND hWnd, UINT id) -{ - // Validate arguments - if (hWnd == NULL) - { - return; - } - - if (IsEnable(hWnd, id) == false || IsShow(hWnd, id) == false) - { - return; - } - - SelectEdit(hWnd, id); - - Focus(hWnd, id); -} - -// Get whether the specified window has focus -bool IsFocus(HWND hWnd, UINT id) -{ - // Validate arguments - if (hWnd == NULL) - { - return false; - } - - if (GetFocus() == DlgItem(hWnd, id)) - { - return true; - } - - return false; -} - -// Set the focus -void Focus(HWND hWnd, UINT id) -{ - // Validate arguments - if (hWnd == NULL) - { - return; - } - - if (IsEnable(hWnd, id) == false || IsShow(hWnd, id) == false) - { - return; - } - - SetFocus(DlgItem(hWnd, id)); -} - -// Set the value of the int type -void SetInt(HWND hWnd, UINT id, UINT value) -{ - wchar_t tmp[MAX_SIZE]; - // Validate arguments - if (hWnd == NULL) - { - return; - } - - UniToStru(tmp, value); - SetText(hWnd, id, tmp); -} -void SetIntEx(HWND hWnd, UINT id, UINT value) -{ - // Validate arguments - if (hWnd == NULL) - { - return; - } - - if (value == 0) - { - // Leave blank in the case of 0 - SetText(hWnd, id, L""); - } - else - { - SetInt(hWnd, id, value); - } -} - -// Get the value of the int type -UINT GetInt(HWND hWnd, UINT id) -{ - wchar_t *s; - UINT ret; - // Validate arguments - if (hWnd == NULL) - { - return 0; - } - - s = GetText(hWnd, id); - if (s == NULL) - { - return 0; - } - - ret = UniToInt(s); - Free(s); - - return ret; -} - -// Update the window appearance -void Refresh(HWND hWnd) -{ - HWND parent; - // Validate arguments - if (hWnd == NULL) - { - return; - } - - DoEvents(hWnd); - UpdateWindow(hWnd); - DoEvents(hWnd); - - parent = GetParent(hWnd); - if (parent != NULL) - { - Refresh(parent); - } -} - -// Handle the event -void DoEvents(HWND hWnd) -{ - MSG msg; - - if (PeekMessage(&msg, hWnd, 0, 0, PM_REMOVE)) - { - TranslateMessage(&msg); - DispatchMessage(&msg); - } - UpdateWindow(hWnd); - - if (hWnd) - { - DoEvents(NULL); - } -} - -// Close the window -void Close(HWND hWnd) -{ - // Validate arguments - if (hWnd == NULL) - { - return; - } - - SendMessage(hWnd, WM_CLOSE, 0, 0); -} - -// Disable the window -void Disable(HWND hWnd, UINT id) -{ - SetEnable(hWnd, id, false); -} - -// Enable the window -void Enable(HWND hWnd, UINT id) -{ - SetEnable(hWnd, id, true); -} - -// Set the enabled state of a window -void SetEnable(HWND hWnd, UINT id, bool b) -{ - // Validate arguments - if (hWnd == NULL) - { - return; - } - - if (b == false) - { - if (IsEnable(hWnd, id)) - { - if (id != 0 && IsFocus(hWnd, id)) - { - Focus(hWnd, IDCANCEL); - Focus(hWnd, IDOK); - } - EnableWindow(DlgItem(hWnd, id), false); - Refresh(DlgItem(hWnd, id)); - } - } - else - { - if (IsDisable(hWnd, id)) - { - EnableWindow(DlgItem(hWnd, id), true); - Refresh(DlgItem(hWnd, id)); - } - } -} - -// Examine whether the window is disabled -bool IsDisable(HWND hWnd, UINT id) -{ - return IsEnable(hWnd, id) ? false : true; -} - -// Examine whether the window is enabled -bool IsEnable(HWND hWnd, UINT id) -{ - // Validate arguments - if (hWnd == NULL) - { - return false; - } - - return IsWindowEnabled(DlgItem(hWnd, id)); -} - -// If the control protrude by large font size, adjust into appropriate size -void AdjustFontSize(HWND hWnd, UINT id) -{ - char class_name[MAX_PATH]; - UINT style; - UINT format = 0; - HFONT current_font; - FONT font; - wchar_t *text; - RECT rect; - UINT width, height; - HFONT new_font = NULL; - UINT old_font_size; - UINT style1; - // Validate arguments - if (hWnd == NULL) - { - return; - } - - hWnd = DlgItem(hWnd, id); - - if (GetClassNameA(hWnd, class_name, sizeof(class_name)) == 0) - { - return; - } - - if (StrCmpi(class_name, "static") != 0) - { - return; - } - - style = GetStyle(hWnd, 0); - - if ((style & SS_ENDELLIPSIS) || (style & SS_PATHELLIPSIS)) - { - return; - } - - style1 = style & 0x0F; - - // Create a format for DrawText - if (style1 == SS_RIGHT) - { - // Right justification - format |= DT_RIGHT; - } - else if (style1 == SS_CENTER) - { - // Center justification - format |= DT_CENTER; - } - else if (style1 == SS_LEFT) - { - // Left justification - format |= DT_LEFT; - } - else - { - // Others - return; - } - - if (style & DT_NOPREFIX) - { - // Without prefix - format |= DT_NOPREFIX; - } - - // Get the font parameters currently set - current_font = (HFONT)SendMessageA(hWnd, WM_GETFONT, 0, 0); - if (current_font == NULL) - { - return; - } - - Zero(&font, sizeof(font)); - if (GetFontParam(current_font, &font) == false) - { - return; - } - - // Get the size of the static area - Zero(&rect, sizeof(rect)); - if (GetWindowRect(hWnd, &rect) == false) - { - return; - } - - // Get the text that is currently set - text = GetText(hWnd, 0); - if (text == NULL) - { - return; - } - - if (IsEmptyUniStr(text)) - { - Free(text); - return; - } - - width = GET_ABS(rect.right - rect.left); - height = GET_ABS(rect.bottom - rect.top); - - new_font = NULL; - old_font_size = font.Size; - - // Try to gradually reduce the font size until drawing succeeds - while (font.Size != 0) - { - // Drawing test - bool aborted = false; - - if (IsFontFitInRect(&font, width, height, text, format, &aborted)) - { - // Drawing success - if (old_font_size != font.Size) - { - // Font size is changed - new_font = GetFont(font.Name, font.Size, font.Bold, font.Italic, font.UnderLine, font.StrikeOut); - } - break; - } - else - { - if (aborted) - { - // Fatal error - break; - } - } - - font.Size--; - - if (font.Size == 1) - { - // Not supposed to become a font size like this. Fatal error - break; - } - } - - Free(text); - - if (new_font != NULL) - { - // Change the font size - SetFontEx(hWnd, 0, new_font, true); - } -} - -// Check whether the specified string can be drawn in the specified area with the specified font -bool IsFontFitInRect(struct FONT *f, UINT width, UINT height, wchar_t *text, UINT format, bool *aborted) -{ - RECT r; - int i; - bool dummy_bool; - UINT new_height; - HFONT hCreatedFont, hOldFont; - // Validate arguments - if (f == NULL || text == NULL) - { - return false; - } - if (aborted == NULL) - { - aborted = &dummy_bool; - } - - format |= DT_CALCRECT | DT_WORDBREAK; - - *aborted = false; - - // Create a font - hCreatedFont = GetFont(f->Name, f->Size, f->Bold, f->Italic, f->UnderLine, f->StrikeOut); - if (hCreatedFont == NULL) - { - *aborted = true; - return false; - } - - Lock(lock_common_dc); - { - hOldFont = SelectObject(hCommonDC, hCreatedFont); - - Zero(&r, sizeof(r)); - r.left = r.top = 0; - r.right = width; - r.bottom = height; - - if (MsIsNt()) - { - i = DrawTextW(hCommonDC, text, -1, &r, format); - } - else - { - char *a = CopyUniToStr(text); - - i = DrawTextA(hCommonDC, a, -1, &r, format); - - Free(a); - } - - SelectObject(hCommonDC, hOldFont); - } - Unlock(lock_common_dc); - - if (i == 0) - { - *aborted = true; - return false; - } - - new_height = GET_ABS(r.bottom - r.top); - - if (new_height > height) - { - return false; - } - - return true; -} - -// Set a text string -void SetText(HWND hWnd, UINT id, wchar_t *str) -{ - // Validate arguments - if (hWnd == NULL || str == NULL) - { - return; - } - - SetTextInner(hWnd, id, str); -} -void SetTextInner(HWND hWnd, UINT id, wchar_t *str) -{ - wchar_t *old; - // Validate arguments - if (hWnd == NULL || str == NULL) - { - return; - } - - // Get the old string - old = GetText(hWnd, id); - if (UniStrCmp(str, old) == 0) - { - // Identity - Free(old); - return; - } - - Free(old); - - if (MsIsNt()) - { - SetWindowTextW(DlgItem(hWnd, id), str); - } - else - { - char *tmp = CopyUniToStr(str); - - if (MsIsNt() == false && StrLen(tmp) >= 32000) - { - // Truncate to less than 32k - tmp[32000] = 0; - } - - SetWindowTextA(DlgItem(hWnd, id), tmp); - Free(tmp); - } - - AdjustFontSize(hWnd, id); - - if (id != 0) - { - Refresh(DlgItem(hWnd, id)); - } -} -void SetTextA(HWND hWnd, UINT id, char *str) -{ - wchar_t *s; - // Validate arguments - if (hWnd == NULL || str == NULL) - { - return; - } - - s = CopyStrToUni(str); - if (s == NULL) - { - return; - } - - SetText(hWnd, id, s); - - Free(s); -} - -// Get the text string to the buffer -bool GetTxt(HWND hWnd, UINT id, wchar_t *str, UINT size) -{ - wchar_t *s; - // Validate arguments - if (hWnd == NULL || str == NULL) - { - return false; - } - - s = GetText(hWnd, id); - if (s == NULL) - { - UniStrCpy(str, size, L""); - return false; - } - - UniStrCpy(str, size, s); - Free(s); - - return true; -} -bool GetTxtA(HWND hWnd, UINT id, char *str, UINT size) -{ - char *s; - // Validate arguments - if (hWnd == NULL || str == NULL) - { - return false; - } - - s = GetTextA(hWnd, id); - if (s == NULL) - { - StrCpy(str, size, ""); - return false; - } - - StrCpy(str, size, s); - Free(s); - - return true; -} - -// Get the text string -wchar_t *GetText(HWND hWnd, UINT id) -{ - wchar_t *ret; - UINT size, len; - // Validate arguments - if (hWnd == NULL) - { - return NULL; - } - - if (MsIsNt() == false) - { - char *s = GetTextA(hWnd, id); - ret = CopyStrToUni(s); - Free(s); - - return ret; - } - - len = GetWindowTextLengthW(DlgItem(hWnd, id)); - if (len == 0) - { - return CopyUniStr(L""); - } - - size = (len + 1) * 2; - ret = ZeroMallocEx(size, true); - - GetWindowTextW(DlgItem(hWnd, id), ret, size); - - return ret; -} -char *GetTextA(HWND hWnd, UINT id) -{ - char *ret; - UINT size, len; - // Validate arguments - if (hWnd == NULL) - { - return NULL; - } - - len = GetWindowTextLengthA(DlgItem(hWnd, id)); - if (len == 0) - { - return CopyStr(""); - } - - size = len + 1; - ret = ZeroMallocEx(size, true); - - GetWindowTextA(DlgItem(hWnd, id), ret, size); - - return ret; -} - -// Get the item in the dialog -HWND DlgItem(HWND hWnd, UINT id) -{ - // Validate arguments - if (hWnd == NULL) - { - return NULL; - } - - if (id == 0) - { - return hWnd; - } - else - { - return GetDlgItem(hWnd, id); - } -} - -// Initialize the WinUi -void InitWinUi(wchar_t *software_name, char *font, UINT fontsize) -{ - if (tls_current_wizard == 0xffffffff) - { - tls_current_wizard = TlsAlloc(); - } - - if ((init_winui_counter++) != 0) - { - return; - } - - if (hDll != NULL) - { - return; - } - - if (MayaquaIsMinimalMode() == false) - { - if (Is64()) - { - hDll = MsLoadLibraryAsDataFile(PENCORE_DLL_NAME); - } - else - { - hDll = MsLoadLibrary(PENCORE_DLL_NAME); - } - - if (hDll == NULL) - { - Alert(PENCORE_DLL_NAME " not found. "CEDAR_PRODUCT_STR " VPN couldn't start.\r\n\r\n" - "Please reinstall all files with "CEDAR_PRODUCT_STR " VPN Installer.", - NULL); - exit(0); - } - } - else - { - hDll = LoadLibrary(MsGetExeFileName()); - - if (hDll == NULL) - { - Alert("MsLoadLibrary() Error.", - NULL); - exit(0); - } - } - - if (software_name != NULL) - { - title_bar = CopyUniStr(software_name); - } - else - { - title_bar = CopyUniStr(CEDAR_PRODUCT_STR_W L" VPN"); - } - - if (font != NULL) - { - font_name = CopyStr(font); - } - else - { - font_name = CopyStr(_SS("DEFAULT_FONT")); - } - - if (MsIsWindows7()) - { - char *win7_font = _SS("DEFAULT_FONT_WIN7"); - - if (IsEmptyStr(win7_font) == false) - { - Free(font_name); - font_name = CopyStr(win7_font); - } - - if (GetTextScalingFactor() >= 1.44) - { - // Use a substitute font in the case of high-DPI in Windows 7 and later - char *alternative_font = _SS("DEFAULT_FONT_HIGHDPI"); - - if (IsEmptyStr(alternative_font) == false) - { - Free(font_name); - font_name = CopyStr(alternative_font); - } - } - } - - if (fontsize != 0) - { - font_size = fontsize; - } - else - { - font_size = _II("DEFAULT_FONT_SIZE"); - if (font_size == 0) - { - font_size = 9; - } - } - - lock_common_dc = NewLock(); - - hCommonDC = CreateCompatibleDC(NULL); - - InitIconCache(); - - InitFont(); - - InitImageList(); -} - -// Release the WinUi -void FreeWinUi() -{ - if ((--init_winui_counter) != 0) - { - return; - } - - if (hDll == NULL) - { - return; - } - - FreeImageList(); - - FreeFont(); - - FreeIconCache(); - - FreeLibrary(hDll); - hDll = NULL; - - Free(title_bar); - title_bar = NULL; - - Free(font_name); - font_name = NULL; - - if (hCommonDC != NULL) - { - DeleteDC(hCommonDC); - hCommonDC = NULL; - } - - DeleteLock(lock_common_dc); - lock_common_dc = NULL; -} - -#endif // WIN32 +// SoftEther VPN Source Code - Developer Edition Master Branch +// Cedar Communication Module + + +// WinUi.c +// User interface code for Win32 + +#include + +#ifdef WIN32 + +#define WINUI_C + +#define _WIN32_WINNT 0x0502 +#define WINVER 0x0502 +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "../PenCore/resource.h" + +char cached_pin_code[MAX_SIZE] = {0}; +UINT64 cached_pin_code_expires = 0; + +static HINSTANCE hDll = NULL; +static wchar_t *title_bar = NULL; +static char *font_name = NULL; +static UINT font_size = 9; +static HIMAGELIST large_image_list = NULL, small_image_list = NULL; +static LIST *icon_list = NULL; +static HINSTANCE hMsHtml = NULL; +static UINT init_winui_counter = 0; +static HDC hCommonDC = NULL; +static LOCK *lock_common_dc = NULL; + +bool UseAlpha = false; +UINT AlphaValue = 100; + +static THREAD *led_thread = NULL; +static bool thread_stop = false; +static bool g_led_special = false; +static bool g_tcpip_topmost = false; +static DWORD tls_current_wizard = 0xFFFFFFFF; + +#define WINUI_PSM_SHOWWIZBUTTONS (WM_USER + 138) +#define WINUI_PropSheet_ShowWizButtons(hDlg, dwFlag, dwButton) \ + PSTMSG(hDlg, WINUI_PSM_SHOWWIZBUTTONS, (WPARAM)(dwFlag), (LPARAM)(dwButton)) + +typedef struct _WINUI_SHSTOCKICONINFO +{ + DWORD cbSize; + HICON hIcon; + int iSysImageIndex; + int iIcon; + WCHAR szPath[MAX_PATH]; +} WINUI_SHSTOCKICONINFO; + +// Get whether the current process is foreground +bool IsThisProcessForeground() +{ + HWND hWnd = GetForegroundWindow(); + DWORD proc_id, thread_id; + + if (hWnd == NULL) + { + return false; + } + + proc_id = 0; + thread_id = GetWindowThreadProcessId(hWnd, &proc_id); + + if (proc_id == MsGetCurrentProcessId()) + { + return true; + } + + return false; +} +bool IsThisProcessForegroundForUpdateUi(UPDATE_CLIENT *c, void *p) +{ + return IsThisProcessForeground(); +} + +// Update notification screen dialog procedure +UINT UpdateConfigDlgProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param) +{ + WINUI_UPDATE *u = (WINUI_UPDATE *)param; + UPDATE_CLIENT_SETTING s; + + switch (msg) + { + case WM_INITDIALOG: + SetTimer(hWnd, 1, 100, NULL); + + LoadUpdateUiSetting(u, &s); + + Check(hWnd, S_ENABLE, s.DisableCheck == false); + Check(hWnd, S_DISABLE, s.DisableCheck); + + DlgFont(hWnd, S_TITLE, 10, true); + FormatText(hWnd, S_TITLE, u->SoftwareTitle); + FormatText(hWnd, S_INFO, u->SoftwareTitle); + break; + + case WM_TIMER: + switch (wParam) + { + case 1: + if (u->UpdateClient->HaltFlag) + { + goto LABEL_CLOSE; + } + break; + } + break; + + case WM_COMMAND: + switch (wParam) + { + case IDCANCEL: + Close(hWnd); + break; + } + break; + + case WM_CLOSE: +LABEL_CLOSE: + LoadUpdateUiSetting(u, &s); + + s.DisableCheck = IsChecked(hWnd, S_DISABLE); + + if (s.DisableCheck) + { + s.LatestIgnoreBuild = 0; + } + + SaveUpdateUiSetting(u, &s); + + SetUpdateClientSetting(u->UpdateClient, &s); + + EndDialog(hWnd, !s.DisableCheck); + + break; + } + + return 0; +} + +// Show the update notification setting screen +bool ConfigUpdateUi(WINUI_UPDATE *u, HWND hWnd) +{ + // Validate arguments + if (u == NULL) + { + return false; + } + + return Dialog(hWnd, D_UPDATE_CONFIG, UpdateConfigDlgProc, u); +} + +// Update notification dialog procedure +UINT UpdateNoticeDlgProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param) +{ + WINUI_UPDATE_DLG_PARAM *p = (WINUI_UPDATE_DLG_PARAM *)param; + WINUI_UPDATE *u = NULL; + UPDATE_CLIENT_SETTING s; + char date_current[64]; + char date_latest[64]; + wchar_t date_current_str[128]; + wchar_t date_latest_str[128]; + char *font_name = NULL; + + if (p != NULL) + { + u = p->Update; + } + + switch (msg) + { + case WM_INITDIALOG: + Zero(date_current_str, sizeof(date_current_str)); + Zero(date_latest_str, sizeof(date_latest_str)); + + GetDateStr64(date_current, sizeof(date_current), u->CurrentDate); + if (u->CurrentDate != 0) + { + UniFormat(date_current_str, sizeof(date_current_str), _UU("DLG_UPDATE_DATE"), date_current); + } + + GetDateStr64(date_latest, sizeof(date_latest), p->LatestDate); + if (p->LatestDate != 0) + { + UniFormat(date_latest_str, sizeof(date_latest_str), _UU("DLG_UPDATE_DATE"), date_latest); + } + + FormatText(hWnd, 0, u->UpdateClient->SoftwareTitle); + FormatText(hWnd, S_INFO, u->UpdateClient->SoftwareTitle); + SetText(hWnd, S_PRODUCT_STR, u->UpdateClient->SoftwareTitle); + + FormatText(hWnd, S_CURRENT_STR, u->CurrentVer / 100, u->CurrentVer % 100, u->CurrentBuild, date_current_str); + FormatText(hWnd, S_LATEST_STR, p->LatestVer, date_latest_str); + + if (MsIsWindows7()) + { + if (_GETLANG() == 0) + { + font_name = GetMeiryoFontName(); + } + else if (_GETLANG() == 2) + { + font_name = "Microsoft YaHei"; + } + else if (_GETLANG() == 3) + { + font_name = "Microsoft JhengHei"; + } + } + + SetFont(hWnd, S_INFO, GetFont(font_name, 11, false, false, false, false)); + SetFont(hWnd, IDOK, GetFont(font_name, 0, true, false, false, false)); + SetFont(hWnd, IDCANCEL, GetFont(font_name, 0, false, false, false, false)); + SetFont(hWnd, S_PRODUCT_STR, GetFont(font_name, 10, true, false, false, false)); + SetFont(hWnd, S_CURRENT_STR, GetFont(font_name, 10, true, false, false, false)); + SetFont(hWnd, S_LATEST_STR, GetFont(font_name, 10, true, false, false, false)); + + SetFont(hWnd, S_PRODUCT, GetFont(font_name, 0, false, false, false, false)); + SetFont(hWnd, S_CURRENT, GetFont(font_name, 0, false, false, false, false)); + SetFont(hWnd, S_LATEST, GetFont(font_name, 0, false, false, false, false)); + SetFont(hWnd, B_CONFIG, GetFont(font_name, 0, false, false, false, false)); + + SetTimer(hWnd, 1, 100, NULL); + + //MessageBeep(MB_ICONASTERISK); + break; + + case WM_COMMAND: + switch (wParam) + { + case IDOK: // Web View + OnceMsgEx(hWnd, NULL, _UU("DLG_UPDATE_HINT"), true, ICO_INTERNET, (bool *)p->halt_flag); + + ShellExecuteA(hWnd, "open", p->Url, NULL, NULL, SW_SHOWNORMAL); + SleepThread(250); + + // Ignore the update notification of this version for future + LoadUpdateUiSetting(u, &s); + s.LatestIgnoreBuild = p->LatestBuild; + SaveUpdateUiSetting(u, &s); + + EndDialog(hWnd, 1); + break; + + case IDCANCEL: // Ignore this version + LoadUpdateUiSetting(u, &s); + s.LatestIgnoreBuild = p->LatestBuild; + SaveUpdateUiSetting(u, &s); + Close(hWnd); + break; + + case B_CONFIG: // Show the notification settings screen + p->IsInConfigDialog = true; + + if (ConfigUpdateUi(u, hWnd) == false) + { + // Decided not to notify any more as a result of setting + Close(hWnd); + } + + p->IsInConfigDialog = false; + break; + } + break; + + case WM_TIMER: + switch (wParam) + { + case 1: + if (p->IsInConfigDialog == false) + { + if (*(p->halt_flag)) + { + // Close the screen forcibly + EndDialog(hWnd, 0); + } + } + break; + } + break; + + case WM_CLOSE: // Close + EndDialog(hWnd, 0); + break; + } + + return 0; +} + +// Update notification dialog +void UpdateNotifyProcUi(UPDATE_CLIENT *c, UINT latest_build, UINT64 latest_date, char *latest_ver, char *url, volatile bool *halt_flag, void *param) +{ + WINUI_UPDATE *u = (WINUI_UPDATE *)param; + WINUI_UPDATE_DLG_PARAM p; + // Validate arguments + if (c == NULL || latest_build == 0 || latest_date == 0 || latest_ver == NULL || url == NULL || halt_flag == NULL || param == NULL) + { + return; + } + + if (u->UseSuppressFlag) + { + // Check the suppress flag + if (MsRegReadIntEx2(REG_LOCAL_MACHINE, PROTO_SUPPRESS_CLIENT_UPDATE_NOTIFICATION_REGKEY, + PROTO_SUPPRESS_CLIENT_UPDATE_NOTIFICATION_REGVALUE, false, true)) + { + // Supress the dialog + return; + } + } + + if (u->CurrentlyDisabled) + { + // Hide + return; + } + + // Show the update screen + Zero(&p, sizeof(p)); + + p.Update = u; + p.LatestBuild = latest_build; + p.LatestDate = latest_date; + p.LatestVer = latest_ver; + p.Url = url; + p.halt_flag = halt_flag; + + Dialog(NULL, D_UPDATE_NOTICE, UpdateNoticeDlgProc, &p); +} + +// Initialize the update notification +WINUI_UPDATE *InitUpdateUi(wchar_t *title, char *name, char *family_name, UINT64 current_date, UINT current_build, UINT current_ver, char *client_id, bool use_suppress_flag) +{ + WINUI_UPDATE *u; + UPDATE_CLIENT_SETTING s; + LANGLIST t; + // Validate arguments + if (title == NULL || name == NULL || current_build == 0 || current_ver == 0) + { + return NULL; + } + if (MsIsWine()) + { + return false; + } + if (IsEmptyStr(family_name)) + { + family_name = UPDATE_FAMILY_NAME; + } + + u = ZeroMalloc(sizeof(WINUI_UPDATE)); + + StrCpy(u->ClientId, sizeof(u->ClientId), client_id); + UniStrCpy(u->SoftwareTitle, sizeof(u->SoftwareTitle), title); + StrCpy(u->SoftwareName, sizeof(u->SoftwareName), name); + u->CurrentDate = current_date; + u->CurrentBuild = current_build; + u->CurrentVer = current_ver; + u->UseSuppressFlag = use_suppress_flag; + + Format(u->RegKey, sizeof(u->RegKey), WINUI_UPDATE_REGKEY, u->SoftwareName); + + Zero(&s, sizeof(s)); + LoadUpdateUiSetting(u, &s); + + Zero(&t, sizeof(t)); + GetCurrentLang(&t); + + u->UpdateClient = NewUpdateClient(UpdateNotifyProcUi, IsThisProcessForegroundForUpdateUi, u, family_name, u->SoftwareName, u->SoftwareTitle, + u->CurrentBuild, u->CurrentDate, t.Name, &s, client_id); + + if (u->UpdateClient == NULL) + { + Free(u); + return NULL; + } + + return u; +} + +// Disable the update notification UI +void DisableUpdateUi(WINUI_UPDATE *u) +{ + // Validate arguments + if (u == NULL) + { + return; + } + + u->CurrentlyDisabled = true; +} + +// Release the update notification +void FreeUpdateUi(WINUI_UPDATE *u) +{ + // Validate arguments + if (u == NULL) + { + return; + } + + if (u->UpdateClient != NULL) + { + FreeUpdateClient(u->UpdateClient); + } + + Free(u); +} + +// Read the current settings from the registry +void LoadUpdateUiSetting(WINUI_UPDATE *u, UPDATE_CLIENT_SETTING *s) +{ + Zero(s, sizeof(UPDATE_CLIENT_SETTING)); + // Validate arguments + if (u == NULL || s == NULL) + { + return; + } + + s->DisableCheck = MsRegReadInt(REG_CURRENT_USER, u->RegKey, "DisableCheck"); + s->LatestIgnoreBuild = MsRegReadInt(REG_CURRENT_USER, u->RegKey, "LatestIgnoreBuild"); +} + +// Write the current settings to the registry +void SaveUpdateUiSetting(WINUI_UPDATE *u, UPDATE_CLIENT_SETTING *s) +{ + // Validate arguments + if (u == NULL || s == NULL) + { + return; + } + + MsRegWriteInt(REG_CURRENT_USER, u->RegKey, "DisableCheck", s->DisableCheck); + MsRegWriteInt(REG_CURRENT_USER, u->RegKey, "LatestIgnoreBuild", s->LatestIgnoreBuild); +} + +// Set the UAC icon to the control in the dialog +void SetUacIcon(HWND hWnd, UINT id) +{ + static HINSTANCE hShell32 = NULL; + static HRESULT (__stdcall *_SHGetStockIconInfo)(UINT siid, UINT uFlags, void *psii) = NULL; + bool ok = false; + // Validate arguments + if (hWnd == NULL) + { + return; + } + + if (MsIsVista() == false) + { + goto LABEL_FAILED; + } + + if (hShell32 == NULL) + { + hShell32 = LoadLibraryA("shell32.dll"); + } + + if (hShell32 != NULL) + { + if (_SHGetStockIconInfo == NULL) + { + _SHGetStockIconInfo = (HRESULT (__stdcall *)(UINT,UINT,void *))GetProcAddress(hShell32, "SHGetStockIconInfo"); + } + } + + if (_SHGetStockIconInfo != NULL) + { + WINUI_SHSTOCKICONINFO sii; + + Zero(&sii, sizeof(sii)); + + sii.cbSize = sizeof(sii); + if (_SHGetStockIconInfo(77, 0x000000100 | 0x000000001, &sii) == S_OK) + { + SendMessage(DlgItem(hWnd, id), STM_SETICON, (WPARAM)sii.hIcon, 0); + + ok = true; + } + } + + if (ok) + { + return; + } + +LABEL_FAILED: + + Hide(hWnd, id); +} + +// Procedure of the wizard page +UINT CALLBACK WizardPageDefDlgProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam) +{ + DIALOG_PARAM *dp = (DIALOG_PARAM *)GetParam(hWnd); + WIZARD_PAGE *wizard_page = NULL; + WIZARD *wizard = NULL; + UINT ret_value = 0; + bool do_not_send_msg = false; + + if (dp != NULL) + { + wizard_page = dp->wizard_page; + wizard = wizard_page->Wizard; + } + + switch (msg) + { + case WM_INITDIALOG: + { + PROPSHEETPAGEW_V3 *t = (PROPSHEETPAGEW_V3 *)lParam; + dp = (DIALOG_PARAM *)t->lParam; + wizard_page = dp->wizard_page; + wizard = wizard_page->Wizard; + + wizard->hWndWizard = GetParent(hWnd); + wizard_page->hWndPage = hWnd; + + SetParam(hWnd, dp); + + InitDialogInternational(hWnd, dp); + } + break; + + case WM_CTLCOLORBTN: + case WM_CTLCOLORDLG: + case WM_CTLCOLOREDIT: + case WM_CTLCOLORLISTBOX: + case WM_CTLCOLORMSGBOX: + case WM_CTLCOLORSCROLLBAR: + case WM_CTLCOLORSTATIC: + return (UINT)GetStockObject(WHITE_BRUSH); + break; + + case WM_NOTIFY: + { + NMHDR *pnmh = (NMHDR *)lParam; + UINT ret = 0; + UINT next_page = INFINITE; + + switch (pnmh->code) + { + case PSN_SETACTIVE: // Activate + SetWizardButton(wizard_page, true, true, true, false); + dp->wizard_proc(hWnd, WM_WIZ_SHOW, 0, 0, wizard, wizard_page, wizard->Param); + break; + + case PSN_KILLACTIVE: // Deactivate + dp->wizard_proc(hWnd, WM_WIZ_HIDE, 0, 0, wizard, wizard_page, wizard->Param); + break; + + case PSN_WIZNEXT: // Determine the destination of [Next] button + ret = dp->wizard_proc(hWnd, WM_WIZ_NEXT, 0, 0, wizard, wizard_page, wizard->Param); + do_not_send_msg = true; + + if (ret == 0) + { + SetWindowLong(hWnd, DWLP_MSGRESULT, -1); + } + else + { + SetWindowLong(hWnd, DWLP_MSGRESULT, ret); + } + + ret_value = 1; + break; + + case PSN_WIZBACK: // Determine the destination of [back] button + ret = dp->wizard_proc(hWnd, WM_WIZ_BACK, 0, 0, wizard, wizard_page, wizard->Param); + do_not_send_msg = true; + + if (ret == 0) + { + SetWindowLong(hWnd, DWLP_MSGRESULT, -1); + } + else + { + SetWindowLong(hWnd, DWLP_MSGRESULT, ret); + } + + ret_value = 1; + break; + + case PSN_QUERYCANCEL: // Determine the process of the [Cancel] button + if (dp->wizard_page->EnableClose == false) + { + SetWindowLong(hWnd, DWLP_MSGRESULT, 1); + } + else + { + + ret = dp->wizard_proc(hWnd, WM_WIZ_CLOSE, 0, 0, wizard, wizard_page, wizard->Param); + + if (ret == 0) + { + if (IsEmptyUniStr(wizard->CloseConfirmMsg) == false && + MsgBox(hWnd, MB_ICONQUESTION | MB_YESNO | MB_DEFBUTTON2, wizard->CloseConfirmMsg) == IDNO) + { + ret = 1; + } + } + + if (ret == 0) + { + SetWindowLong(hWnd, DWLP_MSGRESULT, 0); + } + else + { + SetWindowLong(hWnd, DWLP_MSGRESULT, 1); + } + } + ret_value = 1; + do_not_send_msg = true; + break; + } + break; + } + } + + if (do_not_send_msg == false) + { + if (dp != NULL) + { + UINT ret = dp->wizard_proc(hWnd, msg, wParam, lParam, wizard, wizard_page, wizard->Param); + + if (ret != 0) + { + ret_value = ret; + } + } + } + + if (msg == WM_INITDIALOG) + { + if (wizard->SetCenterFlag == false) + { + wizard->SetCenterFlag = true; + + Center(wizard->hWndWizard); + } + + SetForegroundWindow(wizard->hWndWizard); + SetActiveWindow(wizard->hWndWizard); + } + + return ret_value; +} + +// Button setting of the wizard +void SetWizardButton(WIZARD_PAGE *p, bool enable_next, bool enable_back, bool enable_close, bool is_finish) +{ + SetWizardButtonEx(p, enable_next, enable_back, enable_close, is_finish, false); +} +void SetWizardButtonEx(WIZARD_PAGE *p, bool enable_next, bool enable_back, bool enable_close, bool is_finish, bool shield_icon) +{ + DWORD flags = 0; + DWORD flags2 = 0; + DWORD flags3 = 0; + // Validate arguments + if (p == NULL) + { + return; + } + + p->EnableNext = enable_next; + p->EnableBack = enable_back; + p->EnableClose = enable_close; + p->IsFinish = is_finish; + + if (is_finish == false) + { + if (p->EnableNext) + { + flags |= PSWIZB_NEXT; + flags2 |= PSWIZB_NEXT; + + if (shield_icon) + { + if (p->Wizard->IsAreoStyle) + { + if (MsIsAdmin() == false) + { + flags3 |= PSWIZBF_ELEVATIONREQUIRED; + } + } + } + } + } + else + { + if (p->EnableNext) + { + flags |= PSWIZB_FINISH; + flags2 |= PSWIZB_FINISH; + } + else + { + flags |= PSWIZB_DISABLEDFINISH; + flags2 |= PSWIZB_FINISH; + } + } + + if (p->EnableBack) + { + flags |= PSWIZB_BACK; + flags2 |= PSWIZB_BACK; + } + + if (p->EnableClose) + { + flags2 |= 0x00000010; + } + + PostMessage(p->Wizard->hWndWizard, PSM_SETWIZBUTTONS, flags3, flags); + + SetEnable(p->Wizard->hWndWizard, IDCANCEL, p->EnableClose); + + WINUI_PropSheet_ShowWizButtons(p->Wizard->hWndWizard, + flags2, PSWIZB_BACK | PSWIZB_NEXT | PSWIZB_FINISH | 0x00000010); + + if (p->EnableClose) + { + EnableClose(p->Wizard->hWndWizard); + } + else + { + DisableClose(p->Wizard->hWndWizard); + } +} + +LRESULT CALLBACK WizardCustomizedWindowProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam) +{ + WIZARD *wizard = (WIZARD *)TlsGetValue(tls_current_wizard); + + if (wizard != NULL) + { + switch (msg) + { + case WM_CTLCOLORBTN: + case WM_CTLCOLORDLG: + case WM_CTLCOLOREDIT: + case WM_CTLCOLORLISTBOX: + case WM_CTLCOLORMSGBOX: + case WM_CTLCOLORSCROLLBAR: + case WM_CTLCOLORSTATIC: + return (UINT)GetStockObject(WHITE_BRUSH); + break; + } + + if (MsIsNt()) + { + return CallWindowProcW(wizard->OriginalWindowProc, hWnd, msg, wParam, lParam); + } + else + { + return CallWindowProcA(wizard->OriginalWindowProc, hWnd, msg, wParam, lParam); + } + } + else + { + return 0; + } +} + +// Procedure of the wizard +UINT CALLBACK WizardDlgProc(HWND hWnd, UINT msg, LPARAM lParam) +{ + WIZARD *wizard = (WIZARD *)TlsGetValue(tls_current_wizard); + switch (msg) + { + case PSCB_INITIALIZED: + if (wizard != NULL) + { + if (wizard->hWndWizard != NULL) + { + wizard->hWndWizard = hWnd; + } + + if (wizard->ReplaceWindowProcFlag == false) + { + wizard->ReplaceWindowProcFlag = true; + + if (MsIsNt()) + { + wizard->OriginalWindowProc = (void *)GetWindowLongPtrW(hWnd, GWLP_WNDPROC); + } + else + { + wizard->OriginalWindowProc = (void *)GetWindowLongPtrA(hWnd, GWLP_WNDPROC); + } + + if (wizard->OriginalWindowProc != NULL) + { + if (MsIsNt()) + { + SetWindowLongPtrW(hWnd, GWLP_WNDPROC, (LONG_PTR)WizardCustomizedWindowProc); + } + else + { + SetWindowLongPtrA(hWnd, GWLP_WNDPROC, (LONG_PTR)WizardCustomizedWindowProc); + } + } + } + } + break; + } + + return 0; +} + +// Jump to another wizard page +void JumpWizard(WIZARD_PAGE *p, UINT next_id) +{ + // Validate arguments + if (p == NULL || next_id == 0) + { + return; + } + + PropSheet_SetCurSelByID(p->Wizard->hWndWizard, next_id); +} + +// Close the wizard +void CloseWizard(WIZARD_PAGE *p) +{ + // Validate arguments + if (p == NULL) + { + return; + } + + p->Wizard->CloseConfirmMsg = NULL; + SetWizardButton(p, false, false, true, false); + + if (p->Wizard->IsAreoStyle) + { + PropSheet_PressButton(p->hWndPage, PSBTN_CANCEL); + } + else + { + Close(p->Wizard->hWndWizard); + } +} + +// Show the wizard +void ShowWizard(HWND hWndParent, WIZARD *w, UINT start_id) +{ + void **pages_array; + UINT num_pages; + UINT i; + PROPSHEETHEADERW_V2 h; + WIZARD_PAGE *start_page; + // Validate arguments + if (w == NULL) + { + return; + } + + num_pages = LIST_NUM(w->Pages); + pages_array = ZeroMalloc(sizeof(void *) * num_pages); + + for (i = 0;i < num_pages;i++) + { + WIZARD_PAGE *p = LIST_DATA(w->Pages, i); + + pages_array[i] = CreateWizardPageInstance(w, p); + + p->Index = i; + } + + Zero(&h, sizeof(h)); + h.dwSize = sizeof(PROPSHEETHEADERW_V2); + h.dwFlags = PSH_WIZARD97 | PSH_HEADER | PSH_USEICONID | PSH_USECALLBACK; + + if (MsIsVista() == false) + { + // Aero Wizard is unavailable in pre-Vista + w->IsAreoStyle = false; + } + + if (MsIsAeroColor() == false) + { + // Aero Wizard can not be used If the color of Aero is disabled + // even in Vista or later (if the background color is not white) + w->IsAreoStyle = false; + } + + if (MsIsWindows10()) + { + // Windows 10 Icon Bug: Disable Aero Style! + w->IsAreoStyle = false; + } + + if (w->IsAreoStyle) + { + // Aero Wizard + h.dwFlags = PSH_WIZARD | 0x00004000 | PSH_HEADER | PSH_USEICONID | PSH_USECALLBACK; + } + + h.hInstance = hDll; + h.pszIcon = MAKEINTRESOURCEW(w->Icon); + h.hwndParent = hWndParent; + h.nPages = num_pages; + h.phpage = (HPROPSHEETPAGE *)pages_array; + h.pszbmHeader = MAKEINTRESOURCEW(w->Bitmap); + h.pszCaption = w->Caption; + h.pfnCallback = WizardDlgProc; + + start_page = GetWizardPage(w, start_id); + if (start_page != NULL) + { + h.nStartPage = start_page->Index; + } + + w->hWndParent = hWndParent; + w->hWndWizard = NULL; + w->SetCenterFlag = false; + + TlsSetValue(tls_current_wizard, w); + + PropertySheetW(&h); + + TlsSetValue(tls_current_wizard, NULL); + + Free(pages_array); +} + +// Create an instance of the wizard page +void *CreateWizardPageInstance(WIZARD *w, WIZARD_PAGE *p) +{ + PROPSHEETPAGEW_V3 t; + // Validate arguments + if (w == NULL || p == NULL) + { + return NULL; + } + + Zero(&t, sizeof(t)); + t.dwSize = sizeof(PROPSHEETPAGEW_V3); + t.dwFlags = PSP_USETITLE | PSP_USEHEADERTITLE;// | PSP_USEHEADERSUBTITLE; + t.hInstance = hDll; + t.pszTemplate = MAKEINTRESOURCEW(p->Id); + t.pfnDlgProc = (DLGPROC)WizardPageDefDlgProc; + t.pszHeaderTitle = p->Title; + t.pszTitle = w->Caption; + + if (p->DialogParam != NULL) + { + FreeBitmapList(p->DialogParam->BitmapList); + Free(p->DialogParam); + } + + p->DialogParam = ZeroMalloc(sizeof(DIALOG_PARAM)); + + p->DialogParam->BitmapList = NewBitmapList(); + p->DialogParam->wizard = w; + p->DialogParam->wizard_page = p; + p->DialogParam->wizard_proc = p->Proc; + p->DialogParam->param = w->Param; + p->DialogParam->white = false; + p->DialogParam->meiryo = false; + + t.lParam = (LPARAM)p->DialogParam; + + return CreatePropertySheetPageW(&t); +} + +// Create a new wizard +WIZARD *NewWizard(UINT icon, UINT bitmap, wchar_t *caption, void *param) +{ + WIZARD *w = ZeroMalloc(sizeof(WIZARD)); + + w->Icon = icon; + w->Pages = NewList(NULL); + w->Param = param; + w->Bitmap = bitmap; + w->Caption = CopyUniStr(caption); + + return w; +} + +// Release the wizard +void FreeWizard(WIZARD *w) +{ + UINT i; + // Validate arguments + if (w == NULL) + { + return; + } + + for (i = 0;i < LIST_NUM(w->Pages);i++) + { + WIZARD_PAGE *p = LIST_DATA(w->Pages, i); + + FreeWizardPage(p); + } + + ReleaseList(w->Pages); + + Free(w->Caption); + + Free(w); +} + +// Get the wizard page +WIZARD_PAGE *GetWizardPage(WIZARD *w, UINT id) +{ + UINT i; + // Validate arguments + if (w == NULL || id == 0) + { + return NULL; + } + + for (i = 0;i < LIST_NUM(w->Pages);i++) + { + WIZARD_PAGE *p = LIST_DATA(w->Pages, i); + + if (p->Id == id) + { + return p; + } + } + + return NULL; +} + +// Add a wizard page +void AddWizardPage(WIZARD *w, WIZARD_PAGE *p) +{ + // Validate arguments + if (w == NULL || p == NULL) + { + return; + } + + Add(w->Pages, p); + + p->Wizard = w; +} + +// Create a new wizard page +WIZARD_PAGE *NewWizardPage(UINT id, WINUI_WIZARD_PROC *proc, wchar_t *title) +{ + WIZARD_PAGE *p; + // Validate arguments + if (id == 0 || proc == NULL) + { + return NULL; + } + + p = ZeroMalloc(sizeof(WIZARD_PAGE)); + p->Id = id; + p->Proc = proc; + p->Title = CopyUniStr(title); + + return p; +} + +// Release the wizard page +void FreeWizardPage(WIZARD_PAGE *p) +{ + // Validate arguments + if (p == NULL) + { + return; + } + + if (p->DialogParam != NULL) + { + FreeBitmapList(p->DialogParam->BitmapList); + Free(p->DialogParam); + } + + Free(p->Title); + + Free(p); +} + +// NIC information dialog procedure +UINT NicInfoProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param) +{ + UI_NICINFO *info = (UI_NICINFO *)param; + + switch (msg) + { + case WM_INITDIALOG: + NicInfoInit(hWnd, info); + + SetTimer(hWnd, 1, 50, NULL); + break; + + case WM_TIMER: + switch (wParam) + { + case 1: + KillTimer(hWnd, 1); + + NicInfoOnTimer(hWnd, info); + + SetTimer(hWnd, 1, 50, NULL); + break; + + case 2: + KillTimer(hWnd, 2); + Close(hWnd); + break; + } + break; + + case WM_COMMAND: + switch (wParam) + { + case IDOK: + case IDCANCEL: + Close(hWnd); + break; + } + break; + + case WM_CLOSE: + KillTimer(hWnd, 1); + KillTimer(hWnd, 2); + EndDialog(hWnd, 0); + break; + } + + return 0; +} +void NicInfoCloseAfterTime(HWND hWnd, UI_NICINFO *info, UINT tick) +{ + UINT64 now; + UINT64 closetime; + // Validate arguments + if (hWnd == NULL || info == NULL) + { + return; + } + + now = Tick64(); + closetime = now + (UINT64)tick; + + if (info->CloseAfterTime == 0 || info->CloseAfterTime >= closetime) + { + info->CloseAfterTime = closetime; + KillTimer(hWnd, 2); + SetTimer(hWnd, 2, tick, NULL); + } +} +void NicInfoShowStatus(HWND hWnd, UI_NICINFO *info, wchar_t *msg1, wchar_t *msg2, UINT icon, bool animate) +{ + // Validate arguments + if (hWnd == NULL || info == NULL) + { + return; + } + if (icon == 0) + { + icon = ICO_TEST; + } + if (msg1 == NULL) + { + msg1 = L""; + } + if (msg2 == NULL) + { + msg2 = L""; + } + + if (info->CurrentIcon != icon) + { + SetIcon(hWnd, S_ICON, icon); + info->CurrentIcon = icon; + } + + SetText(hWnd, S_STATUS1, msg1); + SetText(hWnd, S_STATUS2, msg2); + + SetShow(hWnd, P_BAR, animate && MsIsWinXPOrWinVista()); +} +void NicInfoRefresh(HWND hWnd, UI_NICINFO *info) +{ + MS_ADAPTER *a; + IP ip; + char ip_str[MAX_SIZE]; + char title[MAX_SIZE]; + UINT i; + wchar_t tmp[MAX_SIZE]; + bool has_ip = false; + // Validate arguments + if (hWnd == NULL || info == NULL) + { + return; + } + + Format(title, sizeof(title), VLAN_ADAPTER_NAME_TAG, info->NicName); + + a = MsGetAdapter(title); + if (a == NULL) + { + Close(hWnd); + return; + } + + // Check whether an IP address is assigned + Zero(&ip, sizeof(ip)); + for (i = 0;i < MAX_MS_ADAPTER_IP_ADDRESS;i++) + { + if (IsZeroIP(&a->IpAddresses[i]) == false) + { + Copy(&ip, &a->IpAddresses[i], sizeof(IP)); + + if (!(ip.addr[0] == 169 && ip.addr[1] == 254)) + { + has_ip = true; + } + } + } + IPToStr(ip_str, sizeof(ip_str), &ip); + + if (has_ip == false) + { + if (a->UseDhcp) + { + NicInfoShowStatus(hWnd, info, _UU("NICINFO_1"), _UU("NICINFO_1_1"), ICO_NIC_OFFLINE, true); + } + else + { + NicInfoShowStatus(hWnd, info, _UU("NICINFO_1"), _UU("NICINFO_1_2"), ICO_NIC_OFFLINE, true); + } + } + else + { + if (a->UseDhcp) + { + UniFormat(tmp, sizeof(tmp), _UU("NICINFO_2_1"), ip_str); + NicInfoShowStatus(hWnd, info, _UU("NICINFO_2"), tmp, ICO_NIC_ONLINE, false); + } + else + { + UniFormat(tmp, sizeof(tmp), _UU("NICINFO_3_1"), ip_str); + NicInfoShowStatus(hWnd, info, _UU("NICINFO_3"), tmp, ICO_NIC_ONLINE, false); + } + + NicInfoCloseAfterTime(hWnd, info, NICINFO_AUTOCLOSE_TIME_2); + } + + MsFreeAdapter(a); +} +void NicInfoInit(HWND hWnd, UI_NICINFO *info) +{ + // Validate arguments + if (hWnd == NULL || info == NULL) + { + return; + } + + if (MsIsWinXPOrWinVista()) + { + // Show a progress bar for Windows XP or later + SendMsg(hWnd, P_BAR, PBM_SETMARQUEE, TRUE, 150); + SetStyle(hWnd, P_BAR, PBS_MARQUEE); + } + + DlgFont(hWnd, S_STATUS1, 9, false); + DlgFont(hWnd, S_STATUS2, 11, false); + + SetIcon(hWnd, 0, ICO_NIC_ONLINE); + + FormatText(hWnd, 0, info->NicName); + + NicInfoRefresh(hWnd, info); + + NicInfoCloseAfterTime(hWnd, info, NICINFO_AUTOCLOSE_TIME_1); +} +void NicInfoOnTimer(HWND hWnd, UI_NICINFO *info) +{ + // Validate arguments + if (hWnd == NULL || info == NULL) + { + return; + } + + if (info->Halt) + { + Close(hWnd); + return; + } + + if (info->RouteChange != NULL && + IsRouteChanged(info->RouteChange) == false) + { + return; + } + + NicInfoRefresh(hWnd, info); +} + +// Show the NIC information dialog +void NicInfo(UI_NICINFO *info) +{ + // Validate arguments + if (info == NULL) + { + return; + } + + info->RouteChange = NewRouteChange(); + + DialogEx2(NULL, D_NICINFO, NicInfoProc, info, true, true); + + FreeRouteChange(info->RouteChange); + info->RouteChange = NULL; +} + +// TCP connection thread +void WinConnectDlgThread(THREAD *thread, void *param) +{ + SOCK *s; + WINCONNECT_DLG_DATA *d = (WINCONNECT_DLG_DATA *)param; + UINT nat_t_error_code; + char *nat_t_svc_name = NULL; + // Validate arguments + if (d == NULL || thread == NULL) + { + return; + } + + // Socket connection + if (IsEmptyStr(d->nat_t_svc_name) == false) + { + nat_t_svc_name = d->nat_t_svc_name; + } + + s = ConnectEx3(d->hostname, d->port, d->timeout, &d->cancel, nat_t_svc_name, &nat_t_error_code, d->try_start_ssl, false); + + d->ret_sock = s; + d->nat_t_error_code = nat_t_error_code; + + PostMessageA(d->hWnd, WM_APP + 68, 0, 0); +} + +// TCP connection dialog procedure +UINT WinConnectDlgProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param) +{ + WINCONNECT_DLG_DATA *d = (WINCONNECT_DLG_DATA *)param; + // Validate arguments + if (hWnd == NULL || d == NULL) + { + return 0; + } + + switch (msg) + { + case WM_INITDIALOG: + // UI setting + CenterParent(hWnd); + SetText(hWnd, 0, d->caption); + SetText(hWnd, S_INFO, d->info); + SetIcon(hWnd, S_ICON, d->icon_id); + d->hWnd = hWnd; + + if (MsIsWinXPOrWinVista()) + { + // Show a progress bar for Windows XP or later + SendMsg(hWnd, IDC_PROGRESS1, PBM_SETMARQUEE, TRUE, 100); + SetStyle(hWnd, IDC_PROGRESS1, PBS_MARQUEE); + } + else + { + // Hide the progress bar in the case of pre-Windows 2000 + Hide(hWnd, IDC_PROGRESS1); + } + + // Create a thread + d->thread = NewThread(WinConnectDlgThread, d); + break; + + case WM_COMMAND: + switch (wParam) + { + case IDCANCEL: + Close(hWnd); + break; + } + break; + + case WM_APP + 68: + case WM_CLOSE: + if (d->cancel == false) + { + d->cancel = true; + Disable(hWnd, IDCANCEL); + if (d->ret_sock == NULL) + { + SetText(hWnd, S_INFO, _UU("CONNECTDLG_CANCELING")); + } + DoEvents(hWnd); + Refresh(hWnd); + WaitThread(d->thread, INFINITE); + ReleaseThread(d->thread); + EndDialog(hWnd, 0); + } + break; + } + + return 0; +} + +// TCP connection with showing the UI +SOCK *WinConnectEx3(HWND hWnd, char *server, UINT port, UINT timeout, UINT icon_id, wchar_t *caption, wchar_t *info, UINT *nat_t_error_code, char *nat_t_svc_name, bool try_start_ssl) +{ + wchar_t tmp[MAX_SIZE]; + wchar_t tmp2[MAX_SIZE]; + WINCONNECT_DLG_DATA d; + // Validate arguments + if (server == NULL || port == 0) + { + return NULL; + } + if (icon_id == 0) + { + icon_id = ICO_USER_ADMIN; + } + if (caption == NULL) + { + if (hWnd == NULL) + { + caption = _UU("CONNECTDLG_CAPTION"); + } + else + { + GetTxt(hWnd, 0, tmp2, sizeof(tmp2)); + caption = tmp2; + } + } + if (info == NULL) + { + UniFormat(tmp, sizeof(tmp), _UU("CONNECTDLG_MESSAGE"), server, port); + + info = tmp; + } + + Zero(&d, sizeof(d)); + + d.try_start_ssl = try_start_ssl; + d.cancel = false; + d.caption = caption; + d.icon_id = icon_id; + d.info = info; + d.timeout = timeout; + d.hostname = server; + d.port = port; + StrCpy(d.nat_t_svc_name, sizeof(d.nat_t_svc_name), nat_t_svc_name); + + Dialog(hWnd, D_CONNECT, WinConnectDlgProc, &d); + + if (nat_t_error_code != NULL) + { + *nat_t_error_code = d.nat_t_error_code; + } + + return d.ret_sock; +} + +// Show the Windows Network Setup screen +bool ShowWindowsNetworkConnectionDialog() +{ + wchar_t exe_name[MAX_SIZE]; + void *proc; + + CombinePathW(exe_name, sizeof(exe_name), MsGetSystem32DirW(), L"control.exe"); + + proc = Win32RunEx2W(exe_name, L"netconnections", false, NULL); + + if (proc == NULL) + { + return false; + } + + Win32CloseProcess(proc); + + return true; +} + +// Get the best Meiryo font name for the current OS +char *GetMeiryoFontName() +{ + if (MsIsWindows7()) + { + return "Meiryo UI"; + } + else + { + if (MsIsVista()) + { + return "Meiryo"; + } + else + { + return "MS UI Gothic"; + } + } +} + +// Get the Meiryo font +HFONT GetMeiryoFont() +{ + return GetMeiryoFontEx(0); +} +HFONT GetMeiryoFontEx(UINT font_size) +{ + return GetMeiryoFontEx2(font_size, false); +} +HFONT GetMeiryoFontEx2(UINT font_size, bool bold) +{ + if (_GETLANG() == 0) + { + return GetFont(GetMeiryoFontName(), font_size, bold, false, false, false); + } + else if (_GETLANG() == 2) + { + return GetFont("Microsoft YaHei", font_size, bold, false, false, false); + } + else if (_GETLANG() == 3) + { + return GetFont("Microsoft JhengHei", font_size, bold, false, false, false); + } + else + { + return GetFont(NULL, font_size, bold, false, false, false); + } +} + +// Set font to Meiryo +void SetFontMeiryo(HWND hWnd, UINT id, UINT font_size) +{ + SetFont(hWnd, id, GetMeiryoFontEx(font_size)); +} + +// Set as the default font +void SetFontDefault(HWND hWnd, UINT id) +{ + SetFont(hWnd, id, GetDialogDefaultFont()); +} + +// Display the warning messages about bad process +void ShowBadProcessWarning(HWND hWnd, BAD_PROCESS *bad) +{ + wchar_t title[MAX_SIZE]; + wchar_t message[8192]; + // Validate arguments + if (bad == NULL) + { + return; + } + + UniFormat(title, sizeof(title), _UU("BAD_PROCESS_TITLE"), bad->Title); + UniFormat(message, sizeof(message), _UU("BAD_PROCESS_MESSAGE"), + bad->Title, bad->Title, bad->Title, bad->Title); + + OnceMsg(hWnd, title, message, true, ICO_WARNING); +} + +// If there is process which is included in incompatible anti-virus software list, show appropriate +bool CheckBadProcesses(HWND hWnd) +{ + bool ret = true; + UINT i; + LIST *o; + + o = MsGetProcessList(); + + for (i = 0;i < LIST_NUM(o);i++) + { + MS_PROCESS *p = LIST_DATA(o, i); + char exe[MAX_PATH]; + BAD_PROCESS *bad; + + GetFileNameFromFilePath(exe, sizeof(exe), p->ExeFilename); + + bad = IsBadProcess(exe); + + if (bad != NULL) + { + // Display the message because a bad process have been found + ret = false; + + ShowBadProcessWarning(hWnd, bad); + } + } + + MsFreeProcessList(o); + + return ret; +} + +// Search whether the specified process name is the appropriate to a bad process +BAD_PROCESS *IsBadProcess(char *exe) +{ + UINT i; + // Validate arguments + if (exe == NULL) + { + return NULL; + } + + for (i = 0;i < num_bad_processes;i++) + { + BAD_PROCESS *bad = &bad_processes[i]; + + if (StrCmpi(bad->ExeName, exe) == 0) + { + return bad; + } + } + + return NULL; +} + +// Message display procedure +UINT OnceMsgProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param) +{ + ONCEMSG_DLG *d = (ONCEMSG_DLG *)param; + // Validate arguments + if (hWnd == NULL) + { + return 0; + } + + switch (msg) + { + case WM_INITDIALOG: + SetText(hWnd, 0, d->Title); + SetText(hWnd, E_TEXT, d->Message); + SetShow(hWnd, C_DONTSHOWAGAIN, d->ShowCheckbox); + //DisableClose(hWnd); + Focus(hWnd, IDCANCEL); + if (d->Icon != 0) + { + SetIcon(hWnd, 0, d->Icon); + } + + if (MsIsVista()) + { + SetFont(hWnd, E_TEXT, GetMeiryoFont()); + } + else + { + DlgFont(hWnd, E_TEXT, 11, false); + } + + SetTimer(hWnd, 1, 50, NULL); + break; + + case WM_TIMER: + switch (wParam) + { + case 1: + if (*d->halt) + { + Close(hWnd); + } + break; + } + break; + + case WM_COMMAND: + switch (wParam) + { + case IDOK: + case IDCANCEL: + Close(hWnd); + break; + } + break; + + case WM_CLOSE: + KillTimer(hWnd, 1); + d->Checked = IsChecked(hWnd, C_DONTSHOWAGAIN); + EndDialog(hWnd, 0); + break; + } + + return 0; +} + +// Show a message +void OnceMsg(HWND hWnd, wchar_t *title, wchar_t *message, bool show_checkbox, UINT icon) +{ + OnceMsgEx(hWnd, title, message, show_checkbox, icon, NULL); +} +void OnceMsgEx(HWND hWnd, wchar_t *title, wchar_t *message, bool show_checkbox, UINT icon, bool *halt) +{ + ONCEMSG_DLG d; + UINT hash; + char valuename[MAX_PATH]; + bool b_dummy = false; + // Validate arguments + if (title == NULL) + { + title = title_bar; + } + if (message == NULL) + { + message = L"message"; + } + if (halt == NULL) + { + halt = &b_dummy; + } + + Zero(&d, sizeof(d)); + d.Message = message; + d.Title = title; + d.ShowCheckbox = show_checkbox; + d.Icon = icon; + d.halt = halt; + + hash = GetOnceMsgHash(title, message); + Format(valuename, sizeof(valuename), ONCE_MSG_REGVALUE, hash); + + if (MsRegReadInt(REG_CURRENT_USER, ONCE_MSG_REGKEY, valuename) == 0) + { + switch (icon) + { + case ICO_WARNING: + MessageBeep(MB_ICONEXCLAMATION); + break; + + case ICO_INFORMATION: + MessageBeep(MB_ICONASTERISK); + break; + } + + Dialog(hWnd, D_ONCEMSG, OnceMsgProc, &d); + + if (show_checkbox) + { + if (d.Checked) + { + MsRegWriteInt(REG_CURRENT_USER, ONCE_MSG_REGKEY, valuename, 1); + } + } + } +} + +// Get the message hash +UINT GetOnceMsgHash(wchar_t *title, wchar_t *message) +{ + BUF *b; + UCHAR hash[SHA1_SIZE]; + UINT ret; + // Validate arguments + if (title == NULL) + { + title = title_bar; + } + if (message == NULL) + { + message = L"message"; + } + + b = NewBuf(); + // 2013.5.19: Exclude the title from the hash calculation + //WriteBuf(b, title, UniStrSize(title)); + WriteBuf(b, message, UniStrSize(message)); + Sha1(hash, b->Buf, b->Size); + FreeBuf(b); + + Copy(&ret, hash, sizeof(UINT)); + + return ret; +} + +// Set a theme for Windows Vista +void InitVistaWindowTheme(HWND hWnd) +{ + static HINSTANCE hInstDll = NULL; + HRESULT (WINAPI *_SetWindowTheme)(HWND, LPCWSTR, LPCWSTR) = NULL; + + if (MsIsVista() == false) + { + return; + } + + if (hInstDll == NULL) + { + hInstDll = LoadLibraryA("uxtheme.dll"); + } + + if (hInstDll == NULL) + { + return; + } + + if (_SetWindowTheme == NULL) + { + _SetWindowTheme = (HRESULT (WINAPI *)(HWND,LPCWSTR,LPCWSTR))GetProcAddress(hInstDll, "SetWindowTheme"); + } + + if (_SetWindowTheme == NULL) + { + return; + } + + _SetWindowTheme(hWnd, L"explorer", NULL); +} + +// Register all applications to be registered in the Windows firewall +// that may be present in the current directory +void RegistWindowsFirewallAll() +{ + char exedir[MAX_SIZE]; + + GetExeDir(exedir, sizeof(exedir)); + + RegistWindowsFirewallAllEx(exedir); +} +void RegistWindowsFirewallAllEx(char *dir) +{ + MsRegistWindowsFirewallEx2(CEDAR_CLIENT_STR, "vpnclient.exe", dir); + MsRegistWindowsFirewallEx2(CEDAR_CLIENT_MANAGER_STR, "vpncmgr.exe", dir); + MsRegistWindowsFirewallEx2(CEDAR_MANAGER_STR, "vpnsmgr.exe", dir); + MsRegistWindowsFirewallEx2(CEDAR_SERVER_STR, "vpnserver.exe", dir); + MsRegistWindowsFirewallEx2(CEDAR_BRIDGE_STR, "vpnbridge.exe", dir); + MsRegistWindowsFirewallEx2(CEDAR_CUI_STR, "vpncmd.exe", dir); + MsRegistWindowsFirewallEx2(CEDAR_PRODUCT_STR, "vpntest.exe", dir); +} + +// Check whether the notification service is already running +bool Win32CnCheckAlreadyExists(bool lock) +{ + char tmp[MAX_SIZE]; + HANDLE hMutex; + + HashInstanceNameLocal(tmp, sizeof(tmp), CLIENT_NOTIFY_SERVICE_INSTANCENAME); + + hMutex = OpenMutex(MUTEX_ALL_ACCESS, FALSE, tmp); + if (hMutex != NULL) + { + CloseHandle(hMutex); + return true; + } + + if (lock == false) + { + return false; + } + + hMutex = CreateMutex(NULL, FALSE, tmp); + if (hMutex == NULL) + { + CloseHandle(hMutex); + return true; + } + + return false; +} + +// Show the Easter Egg +void ShowEasterEgg(HWND hWnd) +{ +} + +void KakushiThread(THREAD *thread, void *param) +{ + KAKUSHI *k; + // Validate arguments + if (thread == NULL || param == NULL) + { + return; + } + + k = (KAKUSHI *)param; + + k->Thread = thread; + AddRef(k->Thread->ref); + NoticeThreadInit(thread); + + Dialog(NULL, D_CM_KAKUSHI, KakushiDlgProc, k); + k->hWnd = NULL; +} + +KAKUSHI *InitKakushi() +{ + THREAD *t; + KAKUSHI *k = ZeroMalloc(sizeof(KAKUSHI)); + + t = NewThread(KakushiThread, k); + + WaitThreadInit(t); + ReleaseThread(t); + + return k; +} + +UINT KakushiDlgProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param) +{ + KAKUSHI *k = (KAKUSHI *)param; + UINT64 now; + bool b; + if (hWnd == NULL) + { + return 0; + } + + switch (msg) + { + case WM_INITDIALOG: + SetText(hWnd, S_INFO, _UU("CM_VLAN_CREATING")); + + b = false; + + if (MsIsVista()) + { + if (_GETLANG() == 0) + { + SetFont(hWnd, S_INFO, GetFont(GetMeiryoFontName(), 11, false, false, false, false)); + b = true; + } + else if (_GETLANG() == 2) + { + SetFont(hWnd, S_INFO, GetFont("Microsoft YaHei", 11, false, false, false, false)); + b = true; + } + else if (_GETLANG() == 3) + { + SetFont(hWnd, S_INFO, GetFont("Microsoft JhengHei", 11, false, false, false, false)); + b = true; + } + } + + if (b == false) + { + DlgFont(hWnd, S_INFO, 11, false); + } + + SetTimer(hWnd, 1, 50, NULL); + k->hWnd = hWnd; + + k->Span = 20 * 1000; + k->StartTick = Tick64(); + + SetRange(hWnd, P_PROGRESS, 0, (UINT)k->Span); + + case WM_APP + 9821: + now = Tick64(); + + if (((k->StartTick + k->Span) <= now) || k->Halt) + { + EndDialog(hWnd, 0); + break; + } + + SetPos(hWnd, P_PROGRESS, (UINT)(now - k->StartTick)); + break; + + case WM_TIMER: + switch (wParam) + { + case 1: + AllowSetForegroundWindow(ASFW_ANY); + SetForegroundWindow(hWnd); + SetActiveWindow(hWnd); + + now = Tick64(); + + if (((k->StartTick + k->Span) <= now) || k->Halt) + { + EndDialog(hWnd, 0); + break; + } + + SetPos(hWnd, P_PROGRESS, (UINT)(now - k->StartTick)); + break; + } + break; + + case WM_CLOSE: + return 1; + } + + return 0; +} + +// Release the Kakushi screen +void FreeKakushi(KAKUSHI *k) +{ + // Validate arguments + if (k == NULL) + { + return; + } + + k->Halt = true; + + if (k->hWnd != NULL) + { + PostMessage(k->hWnd, WM_APP + 9821, 0, 0); + } + + WaitThread(k->Thread, INFINITE); + ReleaseThread(k->Thread); + + Free(k); +} + +// TCP/IP optimization selection dialog procedure +UINT TcpMsgDlgProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param) +{ + UINT ret; + // Validate arguments + if (hWnd == NULL) + { + return 0; + } + + switch (msg) + { + case WM_INITDIALOG: + SetIcon(hWnd, 0, ICO_SETUP); + //DlgFont(hWnd, R_OPTIMIZE, 0, true); + + Check(hWnd, R_NO, true); + + if (g_tcpip_topmost) + { + Top(hWnd); + } + + break; + + case WM_COMMAND: + switch (wParam) + { + case IDOK: + ret = 1; + if (IsChecked(hWnd, R_MANUAL)) + { + ret = 2; + } + else if (IsChecked(hWnd, R_NO)) + { + ret = 0; + } + + EndDialog(hWnd, ret); + break; + } + break; + + case WM_CLOSE: + return 1; + } + + return 0; +} + +// Initialize the dialog +void TcpIpDlgInit(HWND hWnd) +{ + MS_TCP tcp; + + SetIcon(hWnd, 0, ICO_SETUP); + + MsGetTcpConfig(&tcp); + + Check(hWnd, R_RECV_DISABLE, tcp.RecvWindowSize == 0); + Check(hWnd, R_RECV_ENABLE, tcp.RecvWindowSize != 0); + SetInt(hWnd, E_RECV, tcp.RecvWindowSize != 0 ? tcp.RecvWindowSize : DEFAULT_TCP_MAX_WINDOW_SIZE_RECV); + + Check(hWnd, R_SEND_DISABLE, tcp.SendWindowSize == 0); + Check(hWnd, R_SEND_ENABLE, tcp.SendWindowSize != 0); + SetInt(hWnd, E_SEND, tcp.SendWindowSize != 0 ? tcp.SendWindowSize : DEFAULT_TCP_MAX_WINDOW_SIZE_SEND); + + TcpIpDlgUpdate(hWnd); + + Top(hWnd); +} + +// Update the dialog +void TcpIpDlgUpdate(HWND hWnd) +{ + bool ok = true; + + SetEnable(hWnd, E_RECV, IsChecked(hWnd, R_RECV_ENABLE)); + SetEnable(hWnd, S_RECV, IsChecked(hWnd, R_RECV_ENABLE)); + SetEnable(hWnd, E_SEND, IsChecked(hWnd, R_SEND_ENABLE)); + SetEnable(hWnd, S_SEND, IsChecked(hWnd, R_SEND_ENABLE)); + + if (IsChecked(hWnd, R_RECV_ENABLE) && GetInt(hWnd, E_RECV) < 1454) + { + ok = false; + } + + if (IsChecked(hWnd, R_SEND_ENABLE) && GetInt(hWnd, E_SEND) < 1454) + { + ok = false; + } + + SetEnable(hWnd, IDOK, ok); +} + +// TCP/IP dialog procedure +UINT TcpIpDlgProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param) +{ + MS_TCP tcp, old; + // Validate arguments + if (hWnd == NULL) + { + return 0; + } + + switch (msg) + { + case WM_INITDIALOG: + TcpIpDlgInit(hWnd); + + if (g_tcpip_topmost) + { + Top(hWnd); + } + + break; + + case WM_COMMAND: + switch (LOWORD(wParam)) + { + case R_RECV_DISABLE: + case R_RECV_ENABLE: + case R_SEND_DISABLE: + case R_SEND_ENABLE: + case E_RECV: + case E_SEND: + TcpIpDlgUpdate(hWnd); + break; + } + + switch (wParam) + { + case IDOK: + Zero(&tcp, sizeof(tcp)); + + if (IsChecked(hWnd, R_RECV_ENABLE)) + { + tcp.RecvWindowSize = GetInt(hWnd, E_RECV); + } + + if (IsChecked(hWnd, R_SEND_ENABLE)) + { + tcp.SendWindowSize = GetInt(hWnd, E_SEND); + } + + MsGetTcpConfig(&old); + + MsSetTcpConfig(&tcp); + MsSaveTcpConfigReg(&tcp); + + EndDialog(hWnd, true); + break; + + case IDCANCEL: + Close(hWnd); + break; + + case R_RECV_ENABLE: + FocusEx(hWnd, E_RECV); + break; + + case R_SEND_ENABLE: + FocusEx(hWnd, E_SEND); + break; + + case B_RECV: + SetInt(hWnd, E_RECV, DEFAULT_TCP_MAX_WINDOW_SIZE_RECV); + Check(hWnd, R_RECV_DISABLE, false); + Check(hWnd, R_RECV_ENABLE, true); + TcpIpDlgUpdate(hWnd); + FocusEx(hWnd, E_RECV); + break; + + case B_SEND: + SetInt(hWnd, E_SEND, DEFAULT_TCP_MAX_WINDOW_SIZE_SEND); + Check(hWnd, R_SEND_DISABLE, false); + Check(hWnd, R_SEND_ENABLE, true); + TcpIpDlgUpdate(hWnd); + FocusEx(hWnd, E_SEND); + break; + + case B_DELETE: + Zero(&tcp, sizeof(tcp)); + MsSetTcpConfig(&tcp); + MsDeleteTcpConfigReg(); + EndDialog(hWnd, 0); + break; + } + break; + + case WM_CLOSE: + EndDialog(hWnd, false); + break; + } + + return 0; +} + +// Warning dialog about 64-bit +UINT Cpu64DlgProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param) +{ + switch (msg) + { + case WM_INITDIALOG: + SetIcon(hWnd, 0, ICO_WARNING); + DlgFont(hWnd, S_BOLD, 9, true); + SetTimer(hWnd, 1, 30 * 1000, NULL); + break; + + case WM_TIMER: + switch (wParam) + { + case 1: + KillTimer(hWnd, 1); + Command(hWnd, IDOK); + break; + } + + break; + + case WM_COMMAND: + switch (wParam) + { + case IDOK: + case IDCANCEL: + Close(hWnd); + break; + } + break; + + case WM_CLOSE: + EndDialog(hWnd, 0); + break; + } + + return 0; +} + +// Display a warning dialog about 64-bit +void ShowCpu64Warning() +{ + Dialog(NULL, D_CPU64_WARNING, Cpu64DlgProc, NULL); +} + +// Show the TCP/IP configuration utility +void ShowTcpIpConfigUtil(HWND hWnd, bool util_mode) +{ + if (MsIsTcpConfigSupported() == false) + { + if (util_mode) + { + // Show a message that is not supported by the current OS + if (MsIsAdmin() == false) + { + MsgBox(hWnd, MB_ICONINFORMATION, _UU("TCPOPT_NOT_ADMIN")); + } + else + { + MsgBox(hWnd, MB_ICONINFORMATION, _UU("TCPOPT_NOT_SUPPORTED")); + } + } + return; + } + + if (util_mode == false) + { + // Exit immediately by start the vpncmd + wchar_t tmp[MAX_PATH]; + wchar_t exedir[MAX_PATH]; + HANDLE h; + + GetExeDirW(exedir, sizeof(exedir)); + + if (IsX64()) + { + UniFormat(tmp, sizeof(tmp), L"%s\\vpncmd_x64.exe", exedir); + } + else if (IsIA64()) + { + UniFormat(tmp, sizeof(tmp), L"%s\\vpncmd_ia64.exe", exedir); + } + else + { + UniFormat(tmp, sizeof(tmp), L"%s\\vpncmd.exe", exedir); + } + + if (IsFileW(tmp)) + { + RunW(tmp, L"/tool /cmd:exit", true, false); + } + + // Disable the task off-loading by netsh + if (MsIsVista()) + { + DIRLIST *dl; + UINT i; + bool b = false; + + dl = EnumDirW(exedir); + + for (i = 0;i < dl->NumFiles;i++) + { + if (UniInStr(dl->File[i]->FileNameW, L"vpnbridge") || + UniInStr(dl->File[i]->FileNameW, L"vpnserver")) + { + b = true; + } + } + + FreeDir(dl); + + if (b) + { + // Disable the off-loading + MsDisableNetworkOffloadingEtc(); + } + } + + // Windows Firewall registration + RegistWindowsFirewallAll(); + + SleepThread(1000); + + // Start vpnclient.exe /uihelp + h = CmExecUiHelperMain(); + if (h != NULL) + { + CloseHandle(h); + } + + if (Is64() == false) + { + if (MsIs64BitWindows()) + { + // Show a warning message if a 32-bit version is used in 64-bit Windows + ShowCpu64Warning(); + } + } + + if (MsIsAdmin()) + { + if (MsIsVista()) + { + // If installing on Windows Vista, + // dispel the network limitation of MMCSS + if (MsIsMMCSSNetworkThrottlingEnabled()) + { + MsSetMMCSSNetworkThrottlingEnable(false); + } + } + } + } + + if (util_mode == false && MsIsShouldShowTcpConfigApp() == false) + { + return; + } + + if (util_mode == false) + { + // 2006.07.04 nobori + // I decided not to show TCP/IP optimization utility in the installer + return; + } + + g_tcpip_topmost = util_mode ? false : true; + + if (util_mode == false) + { + UINT ret = Dialog(hWnd, D_TCP_MSG, TcpMsgDlgProc, NULL); + + if (ret == 0) + { + MS_TCP tcp; + + Zero(&tcp, sizeof(tcp)); + MsGetTcpConfig(&tcp); + MsSaveTcpConfigReg(&tcp); + return; + } + else if (ret == 1) + { + MS_TCP tcp; + + Zero(&tcp, sizeof(tcp)); + + tcp.RecvWindowSize = DEFAULT_TCP_MAX_WINDOW_SIZE_RECV; + tcp.SendWindowSize = DEFAULT_TCP_MAX_WINDOW_SIZE_SEND; + MsSetTcpConfig(&tcp); + MsSaveTcpConfigReg(&tcp); + + return; + } + } + + Dialog(hWnd, D_TCP, TcpIpDlgProc, NULL); +} + +// Internationalization of menu (Unicode) +void InitMenuInternationalUni(HMENU hMenu, char *prefix) +{ + UINT i, num; + // Validate arguments + if (hMenu == NULL || prefix == NULL) + { + return; + } + + // Get the number of items in the menu + num = GetMenuItemCount(hMenu); + + // Enumerate the menu items + for (i = 0;i < num;i++) + { + HMENU hSubMenu = GetSubMenu(hMenu, i); + MENUITEMINFOW info; + wchar_t tmp[MAX_SIZE]; + + if (hSubMenu != NULL) + { + // If there is a sub-menu, call it recursively + InitMenuInternational(hSubMenu, prefix); + } + + // Get the menu item + Zero(&info, sizeof(info)); + info.cbSize = sizeof(info); + info.cch = sizeof(tmp); + info.dwTypeData = tmp; + info.fMask = MIIM_STRING; + Zero(tmp, sizeof(tmp)); + + if (GetMenuItemInfoW(hMenu, i, true, &info)) + { + if (tmp[0] == L'@') + { + char name[256]; + wchar_t *ret; + + Format(name, sizeof(name), "%s@%S", prefix, &tmp[1]); + + ret = _UU(name); + if (UniIsEmptyStr(ret) == false) + { + UniStrCpy(tmp, sizeof(tmp), ret); + info.cch = UniStrLen(tmp); + + SetMenuItemInfoW(hMenu, i, true, &info); + } + } + } + } +} + +// Internationalization of menu +void InitMenuInternational(HMENU hMenu, char *prefix) +{ + UINT i, num; + // Validate arguments + if (hMenu == NULL || prefix == NULL) + { + return; + } + + if (MsIsNt()) + { + InitMenuInternationalUni(hMenu, prefix); + return; + } + + // Get the number of items in the menu + num = GetMenuItemCount(hMenu); + + // Enumerate the menu items + for (i = 0;i < num;i++) + { + HMENU hSubMenu = GetSubMenu(hMenu, i); + MENUITEMINFO info; + char tmp[MAX_SIZE]; + + if (hSubMenu != NULL) + { + // If there is a sub-menu, call it recursively + InitMenuInternational(hSubMenu, prefix); + } + + // Get the menu item + Zero(&info, sizeof(info)); + info.cbSize = sizeof(info); + info.cch = sizeof(tmp); + info.dwTypeData = tmp; + info.fMask = MIIM_STRING; + Zero(tmp, sizeof(tmp)); + + if (GetMenuItemInfo(hMenu, i, true, &info)) + { + if (tmp[0] == '@') + { + char name[256]; + char *ret; + + Format(name, sizeof(name), "%s@%s", prefix, &tmp[1]); + + ret = _SS(name); + if (IsEmptyStr(ret) == false) + { + StrCpy(tmp, sizeof(tmp), ret); + info.cch = StrLen(tmp); + + SetMenuItemInfo(hMenu, i, true, &info); + } + } + } + } +} + +// Get the default font for the dialog box +HFONT GetDialogDefaultFont() +{ + return GetDialogDefaultFontEx(false); +} +HFONT GetDialogDefaultFontEx(bool meiryo) +{ + char *default_font_name = _SS("DEFAULT_FONT"); + UINT default_font_size = _II("DEFAULT_FONT_SIZE"); + char *win7_font = _SS("DEFAULT_FONT_WIN7"); + + if (meiryo) + { + if (_GETLANG() == 2) + { + default_font_name = "Microsoft YaHei"; + } + if (_GETLANG() == 3) + { + default_font_name = "Microsoft JhengHei"; + } + else + { + default_font_name = GetMeiryoFontName(); + } + } + + if (MsIsWindows7()) + { + if (IsEmptyStr(win7_font) == false) + { + default_font_name = win7_font; + } + + if (GetTextScalingFactor() >= 1.44) + { + // Use a substitute font in the case of high-DPI in Windows 7 and later + char *alternative_font = _SS("DEFAULT_FONT_HIGHDPI"); + + if (IsEmptyStr(alternative_font) == false) + { + default_font_name = alternative_font; + } + } + } + + if (IsEmptyStr(default_font_name)) + { + default_font_name = font_name; + } + + if (default_font_size == 0) + { + default_font_size = 9; + } + + return GetFont(default_font_name, default_font_size, false, false, false, false); +} + +// Adjust the control size and window size +void AdjustWindowAndControlSize(HWND hWnd, bool *need_resize, double *factor_x, double *factor_y) +{ + HFONT hDlgFont; + UINT dlgfont_x, dlgfont_y; + RECT rect, rect2; + LIST *o; + UINT i; + // Validate arguments + if (hWnd == NULL || need_resize == NULL || factor_x == NULL || factor_y == NULL) + { + return; + } + + *need_resize = true; + + // Get the font of the current window + hDlgFont = (HFONT)SendMsg(hWnd, 0, WM_GETFONT, 0, 0); + + // Get the width and height of the font of the current window + CalcFontSize(hDlgFont, &dlgfont_x, &dlgfont_y); + + if ((dlgfont_x == WINUI_DEFAULT_DIALOG_UNIT_X) && + (dlgfont_y == WINUI_DEFAULT_DIALOG_UNIT_Y)) + { + // There is no need to adjust + *need_resize = false; + *factor_x = 1.0; + *factor_y = 1.0; + //Debug("// There is no need to adjust\n"); + return; + } + + // Calculate the adjustment amount + *factor_x = (double)dlgfont_x / (double)WINUI_DEFAULT_DIALOG_UNIT_X; + *factor_y = (double)dlgfont_y / (double)WINUI_DEFAULT_DIALOG_UNIT_Y; + //Debug("Factors: %f %f\n", *factor_x, *factor_y); + + if (MsIsVista()) + { + // In Windows Vista or later, trust the size expansion by the OS to follow this (not adjusted) + return; + } + + // Adjust the size of the window + if (GetWindowRect(hWnd, &rect)) + { + if (GetClientRect(hWnd, &rect2)) + { + UINT width = rect2.right - rect2.left; + UINT height = rect2.bottom - rect2.top; + + AdjustDialogXY(&width, &height, dlgfont_x, dlgfont_y); + + width += (rect.right - rect.left) - (rect2.right - rect2.left); + height += (rect.bottom - rect.top) - (rect2.bottom - rect2.top); + + if (true) + { + HWND hParent = GetParent(hWnd); + + if (hParent != NULL) + { + RECT r; + + Zero(&r, sizeof(r)); + + if (GetWindowRect(hParent, &r)) + { + RECT r2; + + rect.top = r.top + GetSystemMetrics(SM_CYCAPTION); + + Zero(&r2, sizeof(r2)); + if (SystemParametersInfo(SPI_GETWORKAREA, 0, &r2, 0)) + { + if (r2.bottom < (rect.top + (int)height)) + { + rect.top -= (rect.top + (int)height) - r2.bottom; + + if (rect.top < 0) + { + rect.top = 0; + } + } + } + } + } + } + + MoveWindow(hWnd, rect.left, rect.top, width, height, false); + } + } + + // Enumerate the child windows + o = EnumAllChildWindowEx(hWnd, false, true, true); + + for (i = 0;i < LIST_NUM(o);i++) + { + // Adjust the size of the child window + HWND h = *((HWND *)LIST_DATA(o, i)); + HWND hWndParent = GetParent(h); + RECT current_rect; + char class_name[MAX_PATH]; + bool is_image = false; + + // Get the class name + Zero(class_name, sizeof(class_name)); + GetClassNameA(h, class_name, sizeof(class_name)); + + if (StrCmpi(class_name, "static") == 0) + { + if (SendMsg(h, 0, STM_GETIMAGE, IMAGE_BITMAP, 0) != 0 || + SendMsg(h, 0, STM_GETIMAGE, IMAGE_ICON, 0) != 0 || + SendMsg(h, 0, STM_GETICON, 0, 0) != 0) + { + is_image = true; + } + } + + // Get the position + if (GetWindowRect(h, ¤t_rect)) + { + // Convert to client coordinates + POINT p1, p2; + + p1.x = current_rect.left; + p1.y = current_rect.top; + + p2.x = current_rect.right; + p2.y = current_rect.bottom; + + ScreenToClient(hWndParent, &p1); + ScreenToClient(hWndParent, &p2); + + // Adjust the position + AdjustDialogXY(&p1.x, &p1.y, dlgfont_x, dlgfont_y); + AdjustDialogXY(&p2.x, &p2.y, dlgfont_x, dlgfont_y); + + if (is_image) + { + p2.x = p1.x + (current_rect.right - current_rect.left); + p2.y = p1.y + (current_rect.bottom - current_rect.top); + } + + // Move + MoveWindow(h, p1.x, p1.y, p2.x - p1.x, p2.y - p1.y, false); + } + } + + FreeWindowList(o); +} + +// Adjust the values of x and y according to the font +void AdjustDialogXY(UINT *x, UINT *y, UINT dlgfont_x, UINT dlgfont_y) +{ + if (x != NULL) + { + *x = (UINT)(((double)*x) * (double)WINUI_DEFAULT_DIALOG_UNIT_X / (double)dlgfont_x); + } + + if (y != NULL) + { + *y = (UINT)(((double)*y) * (double)WINUI_DEFAULT_DIALOG_UNIT_Y / (double)dlgfont_y); + } +} + +// Internationalizing process for the dialog box +void InitDialogInternational(HWND hWnd, void *pparam) +{ + LIST *o; + UINT i; + bool is_managed_dialog = false; + char caption[MAX_PATH]; + char *dialog_name; + DIALOG_PARAM *param = (DIALOG_PARAM *)pparam; + HDC hDC; + bool need_resize = false; + double factor_x = 0.0, factor_y = 0.0; + // Validate arguments + if (hWnd == NULL || param == NULL) + { + return; + } + + hDC = CreateCompatibleDC(NULL); + + AdjustWindowAndControlSize(hWnd, &need_resize, &factor_x, &factor_y); + + GetTxtA(hWnd, 0, caption, sizeof(caption)); + if (caption[0] == '@') + { + dialog_name = &caption[1]; + + is_managed_dialog = true; + } + + // Enumerate all window handles + o = EnumAllChildWindow(hWnd); + + for (i = 0;i < LIST_NUM(o);i++) + { + HWND hControl = *((HWND *)LIST_DATA(o, i)); + + if (hControl != NULL) + { + bool set_font = true; + HFONT hFont = GetDialogDefaultFontEx(param && ((DIALOG_PARAM *)param)->meiryo); + + if (MsIsWine()) + { + char classname[MAX_PATH]; + char parent_classname[MAX_PATH]; + HWND hParent = GetParent(hControl); + + Zero(classname, sizeof(classname)); + Zero(parent_classname, sizeof(parent_classname)); + + GetClassNameA(hControl, classname, sizeof(classname)); + + if (hParent != NULL) + { + GetClassNameA(hParent, parent_classname, sizeof(parent_classname)); + } + + if (StrCmpi(classname, "edit") == 0) + { + set_font = false; + } + + if (StrCmpi(classname, "combobox") == 0) + { + set_font = false; + } + + if (StrCmpi(classname, "syslistview32") == 0) + { + set_font = false; + } + + if (StrCmpi(classname, "sysheader32") == 0) + { + set_font = false; + } + + if (StrCmpi(parent_classname, "SysIPAddress32") == 0 || + StrCmpi(classname, "SysIPAddress32") == 0) + { + set_font = true; + hFont = GetFont("Tahoma", 8, false, false, false, false); + } + } + + if (set_font) + { + SetFont(hControl, 0, hFont); + } + + if (MsIsVista()) + { + char classname[MAX_PATH]; + GetClassNameA(hControl, classname, sizeof(classname)); + + if (StrCmpi(classname, "syslistview32") == 0) + { + InitVistaWindowTheme(hControl); + } + } + + if (is_managed_dialog) + { + char str[MAX_PATH]; + + GetTxtA(hControl, 0, str, sizeof(str)); + if (str[0] == '@') + { + char *control_name = &str[1]; + char tmp[MAX_PATH]; + wchar_t *ret; + + StrCpy(tmp, sizeof(tmp), dialog_name); + StrCat(tmp, sizeof(tmp), "@"); + + if (hWnd == hControl) + { + StrCat(tmp, sizeof(tmp), "CAPTION"); + } + else + { + StrCat(tmp, sizeof(tmp), control_name); + } + + ret = _UU(tmp); + + if (ret != NULL && UniIsEmptyStr(ret) == false) + { + SetText(hControl, 0, ret); + } + } + } + } + } + + FreeWindowList(o); + + if (MsIsVista() && need_resize) + { + // Since the window size is changed automatically by the OS by the dpi setting + // in Windows Vista or later, a static (bitmap) control needs to be expanded + // by anticipating the size after changing + + // Enumerate all child window (not recursive) + o = EnumAllChildWindowEx(hWnd, true, false, true); + + for (i = 0;i < LIST_NUM(o);i++) + { + HWND hControl = *((HWND *)LIST_DATA(o, i)); + + if (hControl != NULL) + { + char class_name[MAX_SIZE]; + + Zero(class_name, sizeof(class_name)); + GetClassNameA(hControl, class_name, sizeof(class_name)); + + if (StrCmpi(class_name, "static") == 0) + { + UINT style = GetStyle(hControl, 0); + + if (style & SS_BITMAP) + { + // Get the Bitmap + HBITMAP hBitmap = (HBITMAP)SendMessage(hControl, STM_GETIMAGE, IMAGE_BITMAP, 0); + + if (hBitmap != NULL) + { + // Get the size of this bitmap + UINT src_x; + UINT src_y; + + if (GetBitmapSize(hBitmap, &src_x, &src_y)) + { + RECT ctl_rect; + + Zero(&ctl_rect, sizeof(ctl_rect)); + + if (GetWindowRect(hControl, &ctl_rect)) + { + // Use the smaller magnification of the height and the width + //double scale_factor = 1.5; + double scale_factor = MIN(factor_x, factor_y); + UINT dst_x = (UINT)((double)src_x * scale_factor); + UINT dst_y = (UINT)((double)src_y * scale_factor); + + HBITMAP hDst = ResizeBitmap(hBitmap, src_x, src_y, dst_x, dst_y); + + if (hDst != NULL) + { + Add(param->BitmapList, hDst); + + SendMessage(hControl, STM_SETIMAGE, IMAGE_BITMAP, (LPARAM)hDst); + } + } + } + } + } + } + } + } + + FreeWindowList(o); + } + + DeleteDC(hDC); +} + +// Get the size of the bitmap +bool GetBitmapSize(void *bmp, UINT *x, UINT *y) +{ + BITMAP info; + // Validate arguments + if (bmp == NULL || x == NULL || y == NULL) + { + return false; + } + + Zero(&info, sizeof(info)); + if (GetObject((HANDLE)bmp, sizeof(info), &info) == 0) + { + return false; + } + + *x = info.bmWidth; + *y = info.bmHeight; + + return true; +} + +// Resize the bitmap +HBITMAP ResizeBitmap(HBITMAP hSrc, UINT src_x, UINT src_y, UINT dst_x, UINT dst_y) +{ + HDC hMemDC; + HDC hSrcDC; + HBITMAP ret = NULL; + BITMAPINFOHEADER h; + BITMAPINFO bi; + UCHAR *data = NULL; + // Validate arguments + if (hSrc == NULL) + { + return NULL; + } + + hSrcDC = CreateCompatibleDC(NULL); + if (hSrcDC != NULL) + { + HBITMAP hOld = SelectObject(hSrcDC, hSrc); + + if (hOld != NULL) + { + hMemDC = CreateCompatibleDC(NULL); + + if (hMemDC != NULL) + { + HBITMAP hOld; + HBITMAP srcHbitMap; + UCHAR* srcData; + CT_RectF_c destRect; + CT_RectF_c srcRect; + + Zero(&h, sizeof(h)); + h.biSize = sizeof(h); + h.biWidth = src_x; + h.biHeight = src_y; + h.biPlanes = 1; + h.biBitCount = 32; + h.biXPelsPerMeter = 2834; + h.biYPelsPerMeter = 2834; + h.biCompression = BI_RGB; + + // Copy once the transfer source + Zero(&bi, sizeof(bi)); + Copy(&bi.bmiHeader, &h, sizeof(BITMAPINFOHEADER)); + srcHbitMap = CreateDIBSection(hMemDC, &bi, DIB_RGB_COLORS, &srcData, NULL, 0); + + hOld = SelectObject(hMemDC, srcHbitMap); + + BitBlt(hMemDC,0,0,src_x,src_y,hSrcDC,0,0, SRCCOPY); + + GdiFlush(); + + + + // Generate a resized version + if(src_x != dst_x || src_y != dst_y) + { + h.biWidth = dst_x; + h.biHeight = dst_y; + Zero(&bi, sizeof(bi)); + Copy(&bi.bmiHeader, &h, sizeof(BITMAPINFOHEADER)); + + ret = CreateDIBSection(hMemDC, &bi, DIB_RGB_COLORS, &data, NULL, 0); + + if(srcData != NULL && data != NULL) + { + destRect.X = 0; destRect.Y = 0; + destRect.Width = (float)dst_x; destRect.Height = (float)dst_y; + srcRect = destRect; + srcRect.Width = (float)src_x; srcRect.Height = (float)src_y; + + CT_DrawImage((UCHAR*)data, destRect, dst_x,dst_y, + (UCHAR*)srcData, srcRect,src_x, src_y); + } + + if(srcHbitMap != NULL) + { + DeleteObject(srcHbitMap); + } + } + else + { + ret = srcHbitMap; + } + + SelectObject(hMemDC, hOld); + + DeleteDC(hMemDC); + } + + SelectObject(hSrcDC, hOld); + } + + DeleteDC(hSrcDC); + } + + return ret; +} + +// Initialize the bitmap list +LIST *NewBitmapList() +{ + LIST *o = NewListFast(NULL); + + return o; +} + +// Release the bitmap list +void FreeBitmapList(LIST *o) +{ + UINT i; + // Validate arguments + if (o == NULL) + { + return; + } + + for (i = 0;i < LIST_NUM(o);i++) + { + HBITMAP *h = LIST_DATA(o, i); + + DeleteObject(h); + } + + ReleaseList(o); +} + +// Child window enumeration procedure +// Initialize the dialog +void StringDlgInit(HWND hWnd, STRING_DLG *s) +{ + // Validate arguments + if (hWnd == NULL || s == NULL) + { + return; + } + + SetText(hWnd, E_STRING, s->String); + + SetIcon(hWnd, S_ICON, s->Icon); + SetText(hWnd, S_INFO, s->Info); + SetText(hWnd, 0, s->Title); + + FocusEx(hWnd, E_STRING); + + StringDlgUpdate(hWnd, s); +} + +// Update the dialog control +void StringDlgUpdate(HWND hWnd, STRING_DLG *s) +{ + wchar_t *tmp; + bool b = true; + // Validate arguments + if (hWnd == NULL || s == NULL) + { + return; + } + + tmp = GetText(hWnd, E_STRING); + + if (tmp != NULL) + { + if (s->AllowEmpty == false) + { + if (UniIsEmptyStr(tmp)) + { + b = false; + } + } + + if (s->AllowUnsafe == false) + { + if (IsSafeUniStr(tmp) == false) + { + b = false; + } + } + + Free(tmp); + } + + SetEnable(hWnd, IDOK, b); +} + +// String dialog procedure +UINT StringDlgProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param) +{ + STRING_DLG *s = (STRING_DLG *)param; + // Validate arguments + if (hWnd == NULL) + { + return 0; + } + + switch (msg) + { + case WM_INITDIALOG: + StringDlgInit(hWnd, s); + break; + + case WM_COMMAND: + switch (LOWORD(wParam)) + { + case E_STRING: + StringDlgUpdate(hWnd, s); + break; + } + + switch (wParam) + { + case IDOK: + GetTxt(hWnd, E_STRING, s->String, sizeof(s->String)); + EndDialog(hWnd, true); + break; + + case IDCANCEL: + Close(hWnd); + break; + } + break; + + case WM_CLOSE: + EndDialog(hWnd, false); + break; + } + + return 0; +} + +// Show the string dialog +wchar_t *StringDlg(HWND hWnd, wchar_t *title, wchar_t *info, wchar_t *def, UINT icon, bool allow_empty, bool allow_unsafe) +{ + STRING_DLG s; + // Validate arguments + if (title == NULL) + { + title = _UU("DLG_STRING_DEFTITLE"); + } + if (info == NULL) + { + info = _UU("DLG_STRING_DEFINFO"); + } + if (def == NULL) + { + def = L""; + } + if (icon == 0) + { + icon = ICO_NULL; + } + + Zero(&s, sizeof(s)); + s.Icon = icon; + s.Info = info; + s.Title = title; + s.Icon = icon; + UniStrCpy(s.String, sizeof(s.String), def); + s.AllowEmpty = allow_empty; + s.AllowUnsafe = allow_unsafe; + + if (Dialog(hWnd, D_STRING, StringDlgProc, &s) == false) + { + return NULL; + } + else + { + return CopyUniStr(s.String); + } +} +char *StringDlgA(HWND hWnd, wchar_t *title, wchar_t *info, char *def, UINT icon, bool allow_empty, bool allow_unsafe) +{ + wchar_t unidef[MAX_SIZE]; + wchar_t *tmp; + char *ret; + if (def == NULL) + { + def = ""; + } + + StrToUni(unidef, sizeof(unidef), def); + + tmp = StringDlg(hWnd, title, info, unidef, icon, allow_empty, allow_unsafe); + if (tmp == NULL) + { + return NULL; + } + + ret = CopyUniToStr(tmp); + Free(tmp); + + return ret; +} + +// Restarting dialog +UINT Win9xRebootDlgProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param) +{ + WIN9X_REBOOT_DLG *d = (WIN9X_REBOOT_DLG *)param; + UINT64 now; + wchar_t tmp[MAX_PATH]; + // Validate arguments + if (hWnd == NULL) + { + return 0; + } + + switch (msg) + { + case WM_INITDIALOG: + d->StartTime = Tick64(); + SetRange(hWnd, P_PROGRESS, 0, d->TotalTime); + SetTimer(hWnd, 1, 100, NULL); + goto UPDATE; + + case WM_TIMER: + switch (wParam) + { + case 1: +UPDATE: + now = Tick64(); + if ((d->StartTime + (UINT64)d->TotalTime) <= now) + { + KillTimer(hWnd, 1); + UniStrCpy(tmp, sizeof(tmp), _UU("DLG_REBOOT_INFO_2")); + SetText(hWnd, S_INFO, tmp); + if (MsShutdown(true, false) == false) + { + MsgBox(hWnd, MB_ICONSTOP, _UU("DLG_REBOOT_ERROR")); + } + EndDialog(hWnd, 0); + } + else + { + SetPos(hWnd, P_PROGRESS, (UINT)(now - d->StartTime)); + UniFormat(tmp, sizeof(tmp), _UU("DLG_REBOOT_INFO"), + (UINT)((UINT64)d->TotalTime - (now - d->StartTime)) / 1000 + 1); + SetText(hWnd, S_INFO, tmp); + } + + break; + } + break; + } + return 0; +} + +// Restarting thread +void Win9xRebootThread(THREAD *t, void *p) +{ + // Validate arguments + if (t == NULL) + { + return; + } + + Win9xReboot(NULL); +} + +// Restart automatically +void Win9xReboot(HWND hWnd) +{ + WIN9X_REBOOT_DLG d; + + Zero(&d, sizeof(d)); + d.TotalTime = 10 * 1000; + + Dialog(hWnd, D_WIN9X_REBOOT, Win9xRebootDlgProc, &d); +} + +// Show a text file +void ShowTextFile(HWND hWnd, char *filename, wchar_t *caption, UINT icon) +{ + BUF *b; + wchar_t *str; + // Validate arguments + if (filename == NULL || caption == NULL) + { + return; + } + if (icon == 0) + { + icon = ICO_NULL; + } + + // Read the text file + b = ReadDump(filename); + if (b == NULL) + { + return; + } + + SeekBufToEnd(b); + WriteBufChar(b, 0); + + str = CopyUtfToUni(b->Buf); + + OnceMsg(hWnd, caption, str, false, icon); + + FreeBuf(b); + Free(str); +} + +// Initialize the version information +void AboutDlgInit(HWND hWnd, WINUI_ABOUT *a) +{ + wchar_t tmp[MAX_SIZE]; + // Validate arguments + if (hWnd == NULL || a == NULL) + { + return; + } + + SetIcon(hWnd, 0, ICO_INFORMATION); + + UniFormat(tmp, sizeof(tmp), _UU("ABOUT_CAPTION"), a->ProductName); + SetText(hWnd, 0, tmp); + + SetFont(hWnd, S_INFO1, GetFont("Arial", 12, false, false, false, false)); + FormatText(hWnd, S_INFO1, CEDAR_VERSION_MAJOR, CEDAR_VERSION_MAJOR, CEDAR_VERSION_MINOR, CEDAR_VERSION_BUILD); + + SetFont(hWnd, S_INFO2, GetFont("Arial", 8, false, false, false, false)); + FormatText(hWnd, S_INFO2, BUILD_DATE_Y, a->Cedar->BuildInfo); + + SetFont(hWnd, S_INFO3, GetFont("Arial", 7, false, false, false, false)); + + if (MsIsWine()) + { + Disable(hWnd, B_LANGUAGE); + } + + //DlgFont(hWnd, S_INFO4, 8, false); + + SetShow(hWnd, B_UPDATE_CONFIG, (a->Update != NULL)); + + Show(hWnd, B_AUTHORS); +} + +// Version information procedure +UINT AboutDlgProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param) +{ + WINUI_ABOUT *a = (WINUI_ABOUT *)param; + char tmp[MAX_PATH]; + LANGLIST t; + // Validate arguments + if (hWnd == NULL) + { + return 0; + } + + switch (msg) + { + case WM_INITDIALOG: + AboutDlgInit(hWnd, a); + break; + + case WM_COMMAND: + switch (wParam) + { + case IDOK: + case IDCANCEL: + if ((GetKeyState(VK_SHIFT) & 0x8000) && + (GetKeyState(VK_CONTROL) & 0x8000) && + (GetKeyState(VK_MENU) & 0x8000)) + { + ShowEasterEgg(hWnd); + } + EndDialog(hWnd, true); + break; + case B_WEB: + ShellExecute(hWnd, "open", _SS("SE_COMPANY_URL"), NULL, NULL, SW_SHOW); + break; + case B_EULA: + ShowTextFile(hWnd, "|eula.txt", _UU("SW_EULA_TITLE"), ICO_LOG); + break; + case B_IMPORTANT: + GetCurrentLang(&t); + Format(tmp, sizeof(tmp), "|warning_%s.txt", t.Name); + ShowTextFile(hWnd, tmp, _UU("SW_WARNING_TITLE"), ICO_LOG); + break; + case B_LEGAL: + ShowTextFile(hWnd, "|legal.txt", _UU("DLG_ABOUT_LEGAL"), ICO_LOG); + break; + case B_UPDATE_CONFIG: + ConfigUpdateUi(a->Update, hWnd); + break; + case B_AUTHORS: + ShowTextFile(hWnd, "|authors.txt", _UU("DLG_ABOUT_AUTHORS"), ICO_ZURUHAM); + break; + case B_LANGUAGE: + // Language settings + if (true) + { + wchar_t path[MAX_SIZE]; + + CombinePathW(path, sizeof(path), MsGetExeDirNameW(), L"vpnsetup.exe"); + + if (IsFileExistsW(path)) + { + // with Installer + if (MsExecuteW(path, L"/language:yes") == false) + { + MsgBox(hWnd, MB_ICONEXCLAMATION, _UU("SW_CHILD_PROCESS_ERROR")); + } + } + else + { + // without Installer + CombinePathW(path, sizeof(path), MsGetExeDirNameW(), L"lang.config"); + if (MsExecuteW(path, L"") == false) + { + MsgBox(hWnd, MB_ICONEXCLAMATION, _UU("SW_CHILD_PROCESS_ERROR")); + } + } + } + break; + } + break; + + case WM_CLOSE: + EndDialog(hWnd, false); + break; + } + + return 0; +} + +// Version information +void About(HWND hWnd, CEDAR *cedar, wchar_t *product_name) +{ + AboutEx(hWnd, cedar, product_name, NULL); +} +void AboutEx(HWND hWnd, CEDAR *cedar, wchar_t *product_name, WINUI_UPDATE *u) +{ + WINUI_ABOUT a; + // Validate arguments + if (cedar == NULL || product_name == NULL) + { + return; + } + + Zero(&a, sizeof(a)); + a.Cedar = cedar; + a.ProductName = product_name; + a.Update = u; + + Dialog(hWnd, D_ABOUT, AboutDlgProc, &a); +} + +// Examine the number of fields that an IP address is entered +UINT IpGetFilledNum(HWND hWnd, UINT id) +{ + UINT ret; + DWORD value; + // Validate arguments + if (hWnd == NULL) + { + return 0; + } + + ret = SendMsg(hWnd, id, IPM_GETADDRESS, 0, (LPARAM)&value); + + return ret; +} + +// Examine whether an IP address has been entered +bool IpIsFilled(HWND hWnd, UINT id) +{ + UINT ret; + DWORD value; + // Validate arguments + if (hWnd == NULL) + { + return 0; + } + + ret = SendMsg(hWnd, id, IPM_GETADDRESS, 0, (LPARAM)&value); + + if (ret != 4) + { + return false; + } + else + { + return true; + } +} + +// Get an IP address +UINT IpGet(HWND hWnd, UINT id) +{ + UINT ret; + DWORD value; + // Validate arguments + if (hWnd == NULL) + { + return 0; + } + + ret = SendMsg(hWnd, id, IPM_GETADDRESS, 0, (LPARAM)&value); + + if (ret != 4) + { + return 0; + } + else + { + return Endian32((UINT)value); + } +} + +// Set the IP addresses +void IpSet(HWND hWnd, UINT id, UINT ip) +{ + // Validate arguments + if (hWnd == NULL) + { + return; + } + + SendMsg(hWnd, id, IPM_SETADDRESS, 0, Endian32(ip)); +} + +// Write the candidates to the registry +void WriteCandidateToReg(UINT root, char *key, LIST *o, char *name) +{ + BUF *b; + // Validate arguments + if (key == NULL || o == NULL || name == NULL) + { + return; + } + + b = CandidateToBuf(o); + if (b == NULL) + { + return; + } + + MsRegWriteBin(root, key, name, b->Buf, b->Size); + + FreeBuf(b); +} + +// Read the candidates from the registry +LIST *ReadCandidateFromReg(UINT root, char *key, char *name) +{ + BUF *b; + // Validate arguments + if (key == NULL || name == NULL) + { + return NULL; + } + + b = MsRegReadBin(root, key, name); + if (b == NULL) + { + return NewCandidateList(); + } + else + { + LIST *o = BufToCandidate(b); + FreeBuf(b); + + return o; + } +} + +// initialize the remote connection dialog +void RemoteDlgInit(HWND hWnd, WINUI_REMOTE *r) +{ + LIST *o; + UINT i; + // Validate arguments + if (hWnd == NULL || r == NULL) + { + return; + } + + SetIcon(hWnd, 0, r->Icon); + + SetText(hWnd, 0, r->Caption); + SetText(hWnd, S_TITLE, r->Title); + SetIcon(hWnd, S_ICON, r->Icon); + + // Read candidates + o = ReadCandidateFromReg(REG_CURRENT_USER, r->RegKeyName, "RemoteHostCandidate"); + r->CandidateList = o; + + // Show the candidates + for (i = 0;i < LIST_NUM(o);i++) + { + CANDIDATE *c = LIST_DATA(o, i); + CbAddStr(hWnd, C_HOSTNAME, c->Str, 0); + } + + if (r->DefaultHostname != NULL) + { + SetTextA(hWnd, C_HOSTNAME, r->DefaultHostname); + } + + FocusEx(hWnd, C_HOSTNAME); + + RemoteDlgRefresh(hWnd, r); +} + +// Remote connection dialog update +void RemoteDlgRefresh(HWND hWnd, WINUI_REMOTE *r) +{ + char *s; + bool ok = true; + bool localhost_mode = false; + // Validate arguments + if (hWnd == NULL || r == NULL) + { + return; + } + + s = GetTextA(hWnd, C_HOSTNAME); + if (s != NULL) + { + Trim(s); + if (StrCmpi(s, "localhost") == 0 || StartWith(s, "127.")) + { + localhost_mode = true; + } + Free(s); + } + + if (localhost_mode == false) + { + Enable(hWnd, C_HOSTNAME); + Enable(hWnd, S_HOSTNAME); + Check(hWnd, R_LOCAL, false); + } + else + { + if (r->Title != _UU("NM_CONNECT_TITLE")) + { + Disable(hWnd, C_HOSTNAME); + Disable(hWnd, S_HOSTNAME); + } + Check(hWnd, R_LOCAL, true); + SetTextA(hWnd, C_HOSTNAME, "localhost"); + + if (r->flag1 == false) + { + Focus(hWnd, IDOK); + } + } + + if (IsEmpty(hWnd, C_HOSTNAME)) + { + ok = false; + } + + SetEnable(hWnd, IDOK, ok); + + r->flag1 = true; +} + +// Remote connection dialog OK button +void RemoteDlgOnOk(HWND hWnd, WINUI_REMOTE *r) +{ + char *hostname; + wchar_t *s; + LIST *o; + // Validate arguments + if (hWnd == NULL || r == NULL) + { + return; + } + + // Get the entered host name + hostname = GetTextA(hWnd, C_HOSTNAME); + if (hostname == NULL) + { + return; + } + Trim(hostname); + + // Add a candidate + o = r->CandidateList; + s = CopyStrToUni(hostname); + AddCandidate(o, s, 64); + Free(s); + + // Write the candidates + WriteCandidateToReg(REG_CURRENT_USER, r->RegKeyName, o, "RemoteHostCandidate"); + FreeCandidateList(o); + + r->Hostname = hostname; + + EndDialog(hWnd, true); +} + +// Remote connection dialog procedure +UINT RemoteDlgProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param) +{ + WINUI_REMOTE *r = (WINUI_REMOTE *)param; + // Validate arguments + if (hWnd == NULL) + { + return 0; + } + + switch (msg) + { + case WM_INITDIALOG: + RemoteDlgInit(hWnd, r); + SetTimer(hWnd, 1, 100, NULL); + break; + case WM_TIMER: + switch (wParam) + { + case 1: + KillTimer(hWnd, 1); + RemoteDlgRefresh(hWnd, r); + SetTimer(hWnd, 1, 100, NULL); + break; + } + break; + case WM_COMMAND: + switch (wParam) + { + case R_LOCAL: + if (IsChecked(hWnd, R_LOCAL) == false) + { + SetTextA(hWnd, C_HOSTNAME, ""); + RemoteDlgRefresh(hWnd, r); + FocusEx(hWnd, C_HOSTNAME); + } + else + { + SetTextA(hWnd, C_HOSTNAME, "localhost"); + RemoteDlgRefresh(hWnd, r); + Focus(hWnd, IDOK); + } + break; + case IDCANCEL: + Close(hWnd); + break; + case IDOK: + RemoteDlgOnOk(hWnd, r); + break; + } + switch (LOWORD(wParam)) + { + case R_LOCAL: + case C_HOSTNAME: + RemoteDlgRefresh(hWnd, r); + break; + } + break; + case WM_CLOSE: + FreeCandidateList(r->CandidateList); + EndDialog(hWnd, false); + break; + } + + return 0; +} + +// Remote connection dialog +char *RemoteDlg(HWND hWnd, char *regkey, UINT icon, wchar_t *caption, wchar_t *title, char *default_host) +{ + WINUI_REMOTE r; + // Validate arguments + if (regkey == NULL) + { + regkey = "Software\\" GC_REG_COMPANY_NAME "\\" CEDAR_PRODUCT_STR " VPN\\WinUI Common Module"; + } + if (caption == NULL) + { + caption = _UU("REMOTE_DEF_CAPTION"); + } + if (title == NULL) + { + title = _UU("REMOTE_DEF_TITLE"); + } + if (icon == 0) + { + icon = ICO_INTERNET; + } + + Zero(&r, sizeof(r)); + r.RegKeyName = regkey; + r.Caption = caption; + r.Title = title; + r.Icon = icon; + r.DefaultHostname = default_host; + + if (Dialog(hWnd, D_REMOTE, RemoteDlgProc, &r) == false) + { + return NULL; + } + + return r.Hostname; +} + +// Window Searching procedure +bool CALLBACK SearchWindowEnumProc(HWND hWnd, LPARAM lParam) +{ + if (hWnd != NULL && lParam != 0) + { + wchar_t *s = GetText(hWnd, 0); + SEARCH_WINDOW_PARAM *p = (SEARCH_WINDOW_PARAM *)lParam; + if (s != NULL) + { + if (UniStrCmpi(p->caption, s) == 0) + { + p->hWndFound = hWnd; + } + Free(s); + } + } + return true; +} + +// Search for the window +HWND SearchWindow(wchar_t *caption) +{ + SEARCH_WINDOW_PARAM p; + // Validate arguments + if (caption == NULL) + { + return NULL; + } + + Zero(&p, sizeof(p)); + p.caption = caption; + p.hWndFound = NULL; + + EnumWindows(SearchWindowEnumProc, (LPARAM)&p); + + return p.hWndFound; +} + +// Allow for the specified process to become the foreground window +void AllowFGWindow(UINT process_id) +{ + if (process_id == 0) + { + return; + } + + if (OS_IS_WINDOWS_NT(GetOsInfo()->OsType) && + GET_KETA(GetOsInfo()->OsType, 100) >= 2) + { + AllowSetForegroundWindow(process_id); + } +} + +// Rename the item +void LvRename(HWND hWnd, UINT id, UINT pos) +{ + // Validate arguments + if (hWnd == NULL || pos == INFINITE) + { + return; + } + + ListView_EditLabel(DlgItem(hWnd, id), pos); +} + +// Enhanced function +LRESULT CALLBACK LvEnhancedProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam) +{ + WNDPROC func = NULL; + + if (MsIsNt()) + { + func = (WNDPROC)GetPropW(hWnd, L"ORIGINAL_FUNC"); + } + else + { + func = (WNDPROC)GetPropA(hWnd, "ORIGINAL_FUNC"); + } + + if (func == NULL) + { + Debug("LvEnhancedProc(): GetProp() returned NULL!\n"); + return 1; + } + + switch (msg) + { + case WM_HSCROLL: + case WM_VSCROLL: + case WM_MOUSEWHEEL: + { + // Prevent graphical glitches with the edit box by sending the NM_RETURN signal + // to the parent dialog (the parent dialog has to delete the edit box on NM_RETURN) + NMHDR nmh; + nmh.code = NM_RETURN; + nmh.idFrom = GetDlgCtrlID(hWnd); + nmh.hwndFrom = hWnd; + SendMsg(GetParent(hWnd), 0, WM_NOTIFY, nmh.idFrom, (LPARAM)&nmh); + + break; + } + case WM_CLOSE: + // Prevent list view from disappearing after pressing ESC in an edit box + return 0; + case WM_NCDESTROY: + // Restore original function during destruction + LvSetEnhanced(hWnd, 0, false); + } + + if (MsIsNt()) + { + return CallWindowProcW(func, hWnd, msg, wParam, lParam); + } + else + { + return CallWindowProcA(func, hWnd, msg, wParam, lParam); + } +} + +// Toggle enhanced function +void LvSetEnhanced(HWND hWnd, UINT id, bool enable) +{ + // Validate arguments + if (hWnd == NULL) + { + return; + } + + if (enable) + { + if (MsIsNt()) + { + const HANDLE fn = (HANDLE)SetWindowLongPtrW(DlgItem(hWnd, id), GWLP_WNDPROC, (LONG_PTR)LvEnhancedProc); + SetPropW(DlgItem(hWnd, id), L"ORIGINAL_FUNC", fn); + } + else + { + const HANDLE fn = (HANDLE)SetWindowLongPtrA(DlgItem(hWnd, id), GWLP_WNDPROC, (LONG_PTR)LvEnhancedProc); + SetPropA(DlgItem(hWnd, id), "ORIGINAL_FUNC", fn); + } + } + else + { + if (MsIsNt()) + { + SetWindowLongPtrW(DlgItem(hWnd, id), GWLP_WNDPROC, (LONG_PTR)GetPropW(DlgItem(hWnd, id), L"ORIGINAL_FUNC")); + RemovePropW(DlgItem(hWnd, id), L"ORIGINAL_FUNC"); + } + else + { + SetWindowLongPtrA(DlgItem(hWnd, id), GWLP_WNDPROC, (LONG_PTR)GetPropA(DlgItem(hWnd, id), "ORIGINAL_FUNC")); + RemovePropA(DlgItem(hWnd, id), "ORIGINAL_FUNC"); + } + } +} + +// Enhanced function +LRESULT CALLBACK EditBoxEnhancedProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam) +{ + WNDPROC func = NULL; + + if (MsIsNt()) + { + func = (WNDPROC)GetPropW(hWnd, L"ORIGINAL_FUNC"); + } + else + { + func = (WNDPROC)GetPropA(hWnd, "ORIGINAL_FUNC"); + } + + if (func == NULL) + { + Debug("EditBoxEnhancedProc(): GetProp() returned NULL!\n"); + return 1; + } + + switch (msg) + { + case WM_CHAR: + switch (wParam) + { + // CTRL + A + case 1: + SelectEdit(hWnd, 0); + return 0; + case VK_RETURN: + SendMsg(GetParent(hWnd), 0, WM_KEYDOWN, VK_RETURN, 0); + return 0; + case VK_ESCAPE: + DestroyWindow(hWnd); + return 0; + } + break; + case WM_NCDESTROY: + // Restore original function during destruction + EditBoxSetEnhanced(hWnd, 0, false); + } + + if (MsIsNt()) + { + return CallWindowProcW(func, hWnd, msg, wParam, lParam); + } + else + { + return CallWindowProcA(func, hWnd, msg, wParam, lParam); + } +} + +// Toggle enhanced function +void EditBoxSetEnhanced(HWND hWnd, UINT id, bool enable) +{ + // Validate arguments + if (hWnd == NULL) + { + return; + } + + if (enable) + { + if (MsIsNt()) + { + const HANDLE fn = (HANDLE)SetWindowLongPtrW(DlgItem(hWnd, id), GWLP_WNDPROC, (LONG_PTR)EditBoxEnhancedProc); + SetPropW(DlgItem(hWnd, id), L"ORIGINAL_FUNC", fn); + } + else + { + const HANDLE fn = (HANDLE)SetWindowLongPtrA(DlgItem(hWnd, id), GWLP_WNDPROC, (LONG_PTR)EditBoxEnhancedProc); + SetPropA(DlgItem(hWnd, id), "ORIGINAL_FUNC", fn); + } + } + else + { + if (MsIsNt()) + { + SetWindowLongPtrW(DlgItem(hWnd, id), GWLP_WNDPROC, (LONG_PTR)GetPropW(DlgItem(hWnd, id), L"ORIGINAL_FUNC")); + RemovePropW(DlgItem(hWnd, id), L"ORIGINAL_FUNC"); + } + else + { + SetWindowLongPtrA(DlgItem(hWnd, id), GWLP_WNDPROC, (LONG_PTR)GetPropA(DlgItem(hWnd, id), "ORIGINAL_FUNC")); + RemovePropA(DlgItem(hWnd, id), "ORIGINAL_FUNC"); + } + } +} + +// Show the menu +void PrintMenu(HWND hWnd, HMENU hMenu) +{ + POINT p; + // Validate arguments + if (hMenu == NULL || hWnd == NULL) + { + return; + } + + GetCursorPos(&p); + + TrackPopupMenu(hMenu, TPM_LEFTALIGN, p.x, p.y, 0, hWnd, NULL); +} + +// Remove a shortcut string from the menu +void RemoveShortcutKeyStrFromMenu(HMENU hMenu) +{ + UINT i, num; + // Validate arguments + if (hMenu == NULL) + { + return; + } + + num = GetMenuNum(hMenu); + for (i = 0;i < num;i++) + { + wchar_t *str = GetMenuStr(hMenu, i); + if (str != NULL) + { + UINT j, len; + len = UniStrLen(str); + for (j = 0;j < len;j++) + { + if (str[j] == L'\t') + { + str[j] = 0; + } + } + SetMenuStr(hMenu, i, str); + Free(str); + } + } +} + +// Get the number of items in the menu +UINT GetMenuNum(HMENU hMenu) +{ + UINT ret; + // Validate arguments + if (hMenu == NULL) + { + return 0; + } + + ret = GetMenuItemCount(hMenu); + if (ret == INFINITE) + { + return 0; + } + else + { + return ret; + } +} + +// Set the string into the menu +void SetMenuStr(HMENU hMenu, UINT pos, wchar_t *str) +{ + MENUITEMINFOW info; + // Validate arguments + if (hMenu == NULL || pos == INFINITE || str == NULL) + { + return; + } + + if (MsIsNt() == false) + { + char *s = CopyUniToStr(str); + SetMenuStrA(hMenu, pos, s); + Free(s); + return; + } + + Zero(&info, sizeof(info)); + info.cbSize = sizeof(info); + info.fMask = MIIM_STRING; + info.dwTypeData = str; + SetMenuItemInfoW(hMenu, pos, true, &info); +} +void SetMenuStrA(HMENU hMenu, UINT pos, char *str) +{ + MENUITEMINFOA info; + // Validate arguments + if (hMenu == NULL || pos == INFINITE || str == NULL) + { + return; + } + + Zero(&info, sizeof(info)); + info.cbSize = sizeof(info); + info.fMask = MIIM_STRING; + info.dwTypeData = str; + SetMenuItemInfoA(hMenu, pos, true, &info); +} + +// Get a string in the menu +wchar_t *GetMenuStr(HMENU hMenu, UINT pos) +{ + wchar_t tmp[MAX_SIZE]; + // Validate arguments + if (hMenu == NULL || pos == INFINITE) + { + return NULL; + } + if (MsIsNt() == false) + { + char *s = GetMenuStrA(hMenu, pos); + if (s == NULL) + { + return NULL; + } + else + { + wchar_t *ret = CopyStrToUni(s); + Free(s); + return ret; + } + } + + if (GetMenuStringW(hMenu, pos, tmp, sizeof(tmp), MF_BYPOSITION) == 0) + { + return NULL; + } + + return UniCopyStr(tmp); +} +char *GetMenuStrA(HMENU hMenu, UINT pos) +{ + char tmp[MAX_SIZE]; + // Validate arguments + if (hMenu == NULL || pos == INFINITE) + { + return NULL; + } + + if (GetMenuString(hMenu, pos, tmp, sizeof(tmp), MF_BYPOSITION) == 0) + { + return NULL; + } + + return CopyStr(tmp); +} + +// Bold the menu item +void SetMenuItemBold(HMENU hMenu, UINT pos, bool bold) +{ + MENUITEMINFO info; + // Validate arguments + if (hMenu == NULL || pos == INFINITE) + { + return; + } + + Zero(&info, sizeof(info)); + info.cbSize = sizeof(info); + info.fMask = MIIM_STATE; + + if (GetMenuItemInfo(hMenu, pos, true, &info) == false) + { + return; + } + + if (bold) + { + info.fState |= MFS_DEFAULT; + } + else + { + info.fState = info.fState & ~MFS_DEFAULT; + } + + SetMenuItemInfo(hMenu, pos, true, &info); +} + +// Remove a menu item +void DeleteMenuItem(HMENU hMenu, UINT pos) +{ + // Validate arguments + if (hMenu == NULL || pos == INFINITE) + { + return; + } + + DeleteMenu(hMenu, pos, MF_BYPOSITION); +} + +// Get the position from the ID in the menu +UINT GetMenuItemPos(HMENU hMenu, UINT id) +{ + UINT num, i; + // Validate arguments + if (hMenu == NULL) + { + return INFINITE; + } + + num = GetMenuItemCount(hMenu); + if (num == INFINITE) + { + return INFINITE; + } + + for (i = 0;i < num;i++) + { + if (GetMenuItemID(hMenu, i) == id) + { + return i; + } + } + + return INFINITE; +} + +// Get a sub-menu +HMENU LoadSubMenu(UINT menu_id, UINT pos, HMENU *parent_menu) +{ + HMENU h = LoadMenu(hDll, MAKEINTRESOURCE(menu_id)); + HMENU ret; + if (h == NULL) + { + return NULL; + } + + ret = GetSubMenu(h, pos); + + if (parent_menu != NULL) + { + *parent_menu = h; + } + + return ret; +} + +// Get the DLL of the user interface +HINSTANCE GetUiDll() +{ + return hDll; +} + +// Connection Error dialog procedure +UINT ConnectErrorDlgProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param) +{ + UI_CONNECTERROR_DLG *p = (UI_CONNECTERROR_DLG *)param; + wchar_t tmp[1024]; + // Validate arguments + if (hWnd == NULL) + { + return 0; + } + + switch (msg) + { + case WM_INITDIALOG: + if (p->Err == ERR_DISCONNECTED || p->Err == ERR_SESSION_TIMEOUT) + { + // Message indicating that the connection has been disconnected + SetText(hWnd, S_TITLE, _UU("ERRDLG_DISCONNECTED_MSG")); + } + if (p->HideWindow) + { + Hide(hWnd, R_HIDE); + } + FormatText(hWnd, 0, p->AccountName); + FormatText(hWnd, S_TITLE, p->ServerName); + UniFormat(tmp, sizeof(tmp), _UU("ERRDLG_ERRMSG"), p->Err, _E(p->Err)); + SetText(hWnd, E_ERROR, tmp); + + SetIcon(hWnd, 0, ICO_SERVER_OFFLINE); + + if (p->RetryIntervalSec == 0) + { + SetText(hWnd, S_COUNTDOWN, _UU("ERRDLG_INFORMATION")); + Hide(hWnd, P_PROGRESS); + Hide(hWnd, S_RETRYINFO); + } + else + { + if (p->RetryLimit != INFINITE) + { + UniFormat(tmp, sizeof(tmp), _UU("ERRDLG_RETRY_INFO_1"), p->CurrentRetryCount, p->RetryLimit); + } + else + { + UniFormat(tmp, sizeof(tmp), _UU("ERRDLG_RETRY_INFO_2"), p->CurrentRetryCount); + } + SetText(hWnd, S_RETRYINFO, tmp); + SetRange(hWnd, P_PROGRESS, 0, p->RetryIntervalSec); + SetPos(hWnd, P_PROGRESS, 0); + SetTimer(hWnd, 1, 10, NULL); + p->StartTick = Tick64(); + } + SetTimer(hWnd, 2, 10, NULL); + Focus(hWnd, IDOK); + break; + case WM_TIMER: + switch (wParam) + { + case 1: + if (p->RetryIntervalSec != 0) + { + UINT64 start, end, now; + now = Tick64(); + start = p->StartTick; + end = start + (UINT64)p->RetryIntervalSec; + + if (end > now) + { + SetPos(hWnd, P_PROGRESS, (UINT)(now - start)); + UniFormat(tmp, sizeof(tmp), _UU("ERRDLG_RETRYCOUNT"), ((UINT)(end - now)) / 1000); + SetText(hWnd, S_COUNTDOWN, tmp); + } + else + { + Command(hWnd, IDOK); + } + } + break; + case 2: + if (p->CancelEvent != NULL) + { + if (WaitForSingleObject((HANDLE)p->CancelEvent->pData, 0) != WAIT_TIMEOUT) + { + // Forced Cancel + Close(hWnd); + } + } + break; + } + break; + case WM_COMMAND: + switch (LOWORD(wParam)) + { + case R_HIDE: + p->HideWindow = IsChecked(hWnd, R_HIDE); + break; + } + switch (wParam) + { + case IDOK: + EndDialog(hWnd, true); + break; + case IDCANCEL: + Close(hWnd); + break; + } + break; + case WM_CLOSE: + EndDialog(hWnd, false); + break; + } + + return 0; +} + +// Show the connection error dialog +bool ConnectErrorDlg(UI_CONNECTERROR_DLG *p) +{ + // Validate arguments + if (p == NULL) + { + return false; + } + + return DialogEx2(NULL, D_CONNECTERROR, ConnectErrorDlgProc, p, true, true); +} + +// Display the contents of the certificate +void PrintCheckCertInfo(HWND hWnd, UI_CHECKCERT *p) +{ + wchar_t tmp[MAX_SIZE]; + char tmp2[MAX_SIZE]; + UCHAR md5[MD5_SIZE]; + UCHAR sha1[SHA1_SIZE]; + X *x; + // Validate arguments + if (hWnd == NULL || p == NULL) + { + return; + } + + x = p->x; + + GetAllNameFromNameEx(tmp, sizeof(tmp), x->subject_name); + SetText(hWnd, E_SUBJECT, tmp); + + GetAllNameFromNameEx(tmp, sizeof(tmp), x->issuer_name); + SetText(hWnd, E_ISSUER, tmp); + + GetDateTimeStrEx64(tmp, sizeof(tmp), SystemToLocal64(x->notAfter), NULL); + SetText(hWnd, E_EXPIRES, tmp); + + GetXDigest(x, md5, false); + BinToStr(tmp2, sizeof(tmp2), md5, sizeof(md5)); + SetTextA(hWnd, E_MD5, tmp2); + + GetXDigest(x, sha1, true); + BinToStr(tmp2, sizeof(tmp2), sha1, sizeof(sha1)); + SetTextA(hWnd, E_SHA1, tmp2); + + SetFont(hWnd, E_MD5, GetFont("Arial", 8, false, false, false, false)); + SetFont(hWnd, E_SHA1, GetFont("Arial", 8, false, false, false, false)); +} + +// Warn that the certificate is different +void ShowDlgDiffWarning(HWND hWnd, UI_CHECKCERT *p) +{ + UCHAR sha1_new[SHA1_SIZE], sha1_old[SHA1_SIZE]; + UCHAR md5_new[MD5_SIZE], md5_old[MD5_SIZE]; + char sha1_new_str[MAX_SIZE], sha1_old_str[MAX_SIZE]; + char md5_new_str[MAX_SIZE], md5_old_str[MAX_SIZE]; + // Validate arguments + if (hWnd == NULL || p == NULL || p->x == NULL || p->old_x == NULL) + { + return; + } + + GetXDigest(p->x, sha1_new, true); + GetXDigest(p->x, md5_new, false); + + GetXDigest(p->old_x, sha1_old, true); + GetXDigest(p->old_x, md5_old, false); + + BinToStrEx(sha1_new_str, sizeof(sha1_new_str), sha1_new, sizeof(sha1_new)); + BinToStrEx(md5_new_str, sizeof(md5_new_str), md5_new, sizeof(md5_new)); + BinToStrEx(sha1_old_str, sizeof(sha1_old_str), sha1_old, sizeof(sha1_old)); + BinToStrEx(md5_old_str, sizeof(md5_old_str), md5_old, sizeof(md5_old)); + + MsgBoxEx(hWnd, MB_ICONEXCLAMATION, _UU("CC_DANGEROUS_MSG"), + p->ServerName, md5_old_str, sha1_old_str, md5_new_str, sha1_new_str); +} + +// [OK] button is pressed +void CheckCertDialogOnOk(HWND hWnd, UI_CHECKCERT *p) +{ + UCHAR sha1_new[SHA1_SIZE]; + UCHAR md5_new[MD5_SIZE]; + char sha1_new_str[MAX_SIZE]; + char md5_new_str[MAX_SIZE]; + UINT ret; + // Validate arguments + if (hWnd == NULL || p == NULL) + { + return; + } + + GetXDigest(p->x, sha1_new, true); + GetXDigest(p->x, md5_new, false); + BinToStrEx(sha1_new_str, sizeof(sha1_new_str), sha1_new, sizeof(sha1_new)); + BinToStrEx(md5_new_str, sizeof(md5_new_str), md5_new, sizeof(md5_new)); + + ret = MsgBoxEx(hWnd, MB_ICONQUESTION | MB_YESNOCANCEL | MB_DEFBUTTON2, + _UU("CC_WARNING_MSG"), + p->AccountName, sha1_new_str, md5_new_str); + + if (ret == IDYES) + { + p->SaveServerCert = true; + } + + if (ret == IDCANCEL) + { + return; + } + + p->Ok = true; + EndDialog(hWnd, true); +} + +// Certificate dialog procedure +UINT CheckCertDlgProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param) +{ + UI_CHECKCERT *p = (UI_CHECKCERT *)param; + // Validate arguments + if (hWnd == NULL || param == NULL) + { + return 0; + } + + switch (msg) + { + case WM_INITDIALOG: + FormatText(hWnd, 0, p->AccountName); + FormatText(hWnd, S_TITLE, p->ServerName); + FormatText(hWnd, S_MSG1, p->ServerName); + + PrintCheckCertInfo(hWnd, p); + + Focus(hWnd, IDCANCEL); + + SetIcon(hWnd, 0, ICO_WARNING); + + if (p->DiffWarning) + { + SetTimer(hWnd, 1, 1, NULL); + } + + SetTimer(hWnd, 2, 100, NULL); + + break; + case WM_TIMER: + switch (wParam) + { + case 1: + KillTimer(hWnd, 1); + ShowDlgDiffWarning(hWnd, p); + break; + case 2: + if ((p->Session != NULL && p->Session->Halt) || + (p->Halt)) + { + p->Ok = false; + EndDialog(hWnd, false); + } + break; + } + break; + case WM_COMMAND: + switch (wParam) + { + case B_SHOW: + CertDlg(hWnd, p->x, p->parent_x, false); + break; + case IDOK: + CheckCertDialogOnOk(hWnd, p); + break; + case IDCANCEL: + Close(hWnd); + break; + } + break; + case WM_CLOSE: + p->Ok = false; + EndDialog(hWnd, false); + break; + } + + return 0; +} + +// Certificate Check dialog +void CheckCertDlg(UI_CHECKCERT *p) +{ + // Validate arguments + if (p == NULL) + { + return; + } + + Dialog(NULL, D_CHECKCERT, CheckCertDlgProc, p); +} + +// Get the image list ID from the icon ID +UINT GetIcon(UINT icon_id) +{ + IMAGELIST_ICON *c, t; + t.id = icon_id; + + c = Search(icon_list, &t); + if (c == NULL) + { + if (icon_id != ICO_NULL) + { + return GetIcon(ICO_NULL); + } + else + { + return INFINITE; + } + } + else + { + return c->Index; + } +} + +// Load an icon for the image list +IMAGELIST_ICON *LoadIconForImageList(UINT id) +{ + IMAGELIST_ICON *ret = ZeroMalloc(sizeof(IMAGELIST_ICON)); + HICON small_icon, large_icon; + + ret->id = id; + + large_icon = LoadLargeIcon(id); + if (large_icon == NULL) + { + large_icon = LoadSmallIcon(id); + } + + small_icon = LoadSmallIcon(id); + if (small_icon == NULL) + { + small_icon = LoadLargeIcon(id); + } + + ret->hSmallImage = small_icon; + ret->hLargeImage = large_icon; + ret->Index = ImageList_AddIcon(large_image_list, large_icon); + ImageList_AddIcon(small_image_list, small_icon); + + return ret; +} + +// Comparison of the image list icons +int CompareImageListIcon(void *p1, void *p2) +{ + IMAGELIST_ICON *c1, *c2; + if (p1 == NULL || p2 == NULL) + { + return 0; + } + c1 = *(IMAGELIST_ICON **)p1; + c2 = *(IMAGELIST_ICON **)p2; + if (c1 == NULL || c2 == NULL) + { + return 0; + } + + if (c1->id > c2->id) + { + return 1; + } + else if (c1->id < c2->id) + { + return -1; + } + else + { + return 0; + } +} + +// Initialize thr image list +void InitImageList() +{ + large_image_list = ImageList_Create(32, 32, ILC_COLOR32 | ILC_MASK, 1, 0); + ImageList_SetBkColor(large_image_list, RGB(255, 255, 255)); + small_image_list = ImageList_Create(16, 16, ILC_COLOR32 | ILC_MASK, 1, 0); + ImageList_SetBkColor(small_image_list, RGB(255, 255, 255)); + icon_list = NewList(CompareImageListIcon); + + // Enumeration + EnumResourceNames(hDll, RT_GROUP_ICON, EnumResNameProc, 0); +} + +// Icon resource enumeration procedure +BOOL CALLBACK EnumResNameProc(HMODULE hModule, LPCTSTR lpszType, LPTSTR lpszName, LONG_PTR lParam) +{ + if (IS_INTRESOURCE(lpszName)) + { + UINT icon_id = (UINT)lpszName; + IMAGELIST_ICON *img = LoadIconForImageList(icon_id); + + Add(icon_list, img); + } + + return TRUE; +} + +// Release the image list +void FreeImageList() +{ + UINT i; + ImageList_Destroy(large_image_list); + ImageList_Destroy(small_image_list); + large_image_list = small_image_list = NULL; + + for (i = 0;i < LIST_NUM(icon_list);i++) + { + IMAGELIST_ICON *c = LIST_DATA(icon_list, i); + Free(c); + } + + ReleaseList(icon_list); + icon_list = NULL; +} + +// Get the width of the column of the list view +UINT LvGetColumnWidth(HWND hWnd, UINT id, UINT index) +{ + return (UINT)((double)ListView_GetColumnWidth(DlgItem(hWnd, id), index) / GetTextScalingFactor()); +} + +// Insert the column into the list view +void LvInsertColumn(HWND hWnd, UINT id, UINT index, wchar_t *str, UINT width) +{ + LVCOLUMNW c; + // Validate arguments + if (hWnd == NULL || str == NULL) + { + return; + } + + width = (UINT)((double)width * GetTextScalingFactor()); + + Zero(&c, sizeof(c)); + c.mask = LVCF_FMT | LVCF_SUBITEM | LVCF_TEXT | LVCF_WIDTH; + + c.pszText = str; + c.iSubItem = index; + c.cx = width; + + SendMsg(hWnd, id, LVM_INSERTCOLUMNW, index, (LPARAM)&c); +} + +// Remove all items from list view +void LvReset(HWND hWnd, UINT id) +{ + // Validate arguments + if (hWnd == NULL) + { + return; + } + + ListView_DeleteAllItems(DlgItem(hWnd, id)); +} + +// Initialize the list view +void LvInitEx(HWND hWnd, UINT id, bool no_image) +{ + LvInitEx2(hWnd, id, no_image, false); +} +void LvInitEx2(HWND hWnd, UINT id, bool no_image, bool large_icon) +{ + // Validate arguments + if (hWnd == NULL) + { + return; + } + + ListView_SetUnicodeFormat(DlgItem(hWnd, id), true); + + if (no_image == false) + { + ListView_SetImageList(DlgItem(hWnd, id), large_image_list, LVSIL_NORMAL); + ListView_SetImageList(DlgItem(hWnd, id), large_icon ? large_image_list : small_image_list, LVSIL_SMALL); + } + + ListView_SetExtendedListViewStyle(DlgItem(hWnd, id), LVS_EX_FULLROWSELECT); + + if (MsIsVista()) + { + LvSetStyle(hWnd, id, LVS_EX_DOUBLEBUFFER); + } +} +void LvInit(HWND hWnd, UINT id) +{ + LvInitEx(hWnd, id, false); +} + +// Adding batch complete (high-speed) +void LvInsertEnd(LVB *b, HWND hWnd, UINT id) +{ + LvInsertEndEx(b, hWnd, id, false); +} +void LvInsertEndEx(LVB *b, HWND hWnd, UINT id, bool force_reset) +{ + UINT i, num; + LIST *new_list, *exist_list; + wchar_t *last_selected = NULL; + // Validate arguments + if (b == NULL || hWnd == NULL) + { + return; + } + + new_list = NewListFast(CompareUniStr); + + for (i = 0;i < LIST_NUM(b->ItemList);i++) + { + LVB_ITEM *t = LIST_DATA(b->ItemList, i); + Add(new_list, t->Strings[0]); + } + + Sort(new_list); + + if ((LIST_NUM(b->ItemList) >= LV_INSERT_RESET_ALL_ITEM_MIN) || force_reset) + { + last_selected = LvGetFocusedStr(hWnd, id, 0); + LvReset(hWnd, id); + } + + exist_list = NewListFast(CompareUniStr); + + num = LvNum(hWnd, id); + + // Delete the items which isn't contained in the batch list of existing items + for (i = 0;i < num;i++) + { + bool exists = false; + wchar_t *s = LvGetStr(hWnd, id, i, 0); + if (Search(new_list, s) != NULL) + { + exists = true; + } + if (exists == false) + { + // Remove items that don't exist in the batch list of the adding plan from the list view + LvDeleteItem(hWnd, id, i); + num = LvNum(hWnd, id); + i--; + Free(s); + } + else + { + Add(exist_list, s); + } + } + + Sort(exist_list); + + // Add items in the batch one by one + for (i = 0;i < LIST_NUM(b->ItemList);i++) + { + LVB_ITEM *t = LIST_DATA(b->ItemList, i); + UINT index; + UINT j; + bool exists = false; + + if (Search(exist_list, t->Strings[0]) != NULL) + { + index = LvSearchStr(hWnd, id, 0, t->Strings[0]); + } + else + { + index = INFINITE; + } + + if (index != INFINITE) + { + UINT j; + // If an item with the string same to adding item already exists, + // update instead of adding + for (j = 0;j < t->NumStrings;j++) + { + LvSetItem(hWnd, id, index, j, t->Strings[j]); + } + LvSetItemImageByImageListId(hWnd, id, index, t->Image); + LvSetItemParam(hWnd, id, index, t->Param); + } + else + { + // Add newly + UINT index = INFINITE; + UINT j; + for (j = 0;j < t->NumStrings;j++) + { + if (j == 0) + { + index = LvInsertItemByImageListId(hWnd, id, t->Image, t->Param, t->Strings[j]); + } + else + { + LvSetItem(hWnd, id, index, j, t->Strings[j]); + } + } + } + + // Release the memory + for (j = 0;j < t->NumStrings;j++) + { + Free(t->Strings[j]); + } + Free(t->Strings); + Free(t); + } + + // Release the list + ReleaseList(b->ItemList); + + // Release the memory + Free(b); + + ReleaseList(new_list); + + for (i = 0;i < LIST_NUM(exist_list);i++) + { + Free(LIST_DATA(exist_list, i)); + } + ReleaseList(exist_list); + + if (last_selected != NULL) + { + UINT pos = LvSearchStr(hWnd, id, 0, last_selected); + + if (pos != INFINITE) + { + LvSelect(hWnd, id, pos); + } + + Free(last_selected); + } +} + +// Get the number of columns of the list view +UINT LvGetColumnNum(HWND hWnd, UINT id) +{ + UINT i; + LVCOLUMN c; + if (hWnd == NULL) + { + return 0; + } + + for (i = 0;;i++) + { + Zero(&c, sizeof(c)); + c.mask = LVCF_SUBITEM; + if (ListView_GetColumn(DlgItem(hWnd, id), i, &c) == false) + { + break; + } + } + + return i; +} + +// List-view sort function +int CALLBACK LvSortProc(LPARAM param1, LPARAM param2, LPARAM sort_param) +{ + WINUI_LV_SORT *sort = (WINUI_LV_SORT *)sort_param; + HWND hWnd; + UINT id; + UINT i1, i2; + int ret = 0; + wchar_t *s1, *s2; + if (sort == NULL) + { + return 0; + } + + hWnd = sort->hWnd; + id = sort->id; + + if (hWnd == NULL) + { + return 0; + } + + i1 = (UINT)param1; + i2 = (UINT)param2; + + s1 = LvGetStr(hWnd, id, i1, sort->subitem); + if (s1 == NULL) + { + return 0; + } + + s2 = LvGetStr(hWnd, id, i2, sort->subitem); + if (s2 == NULL) + { + Free(s1); + return 0; + } + + if (sort->numeric == false) + { + if (UniStrCmpi(s1, _UU("CM_NEW_ICON")) == 0 || UniStrCmpi(s1, _UU("CM_VGC_ICON")) == 0 || UniStrCmpi(s1, _UU("CM_VGC_LINK")) == 0) + { + ret = -1; + } + else if (UniStrCmpi(s2, _UU("CM_NEW_ICON")) == 0 || UniStrCmpi(s2, _UU("CM_VGC_ICON")) == 0 || UniStrCmpi(s1, _UU("CM_VGC_LINK")) == 0) + { + ret = 1; + } + else + { + ret = UniStrCmpi(s1, s2); + } + } + else + { + UINT64 v1, v2; + v1 = UniToInt64(s1); + v2 = UniToInt64(s2); + if (v1 > v2) + { + ret = 1; + } + else if (v1 < v2) + { + ret = -1; + } + else + { + ret = 0; + } + } + + Free(s1); + Free(s2); + + if (sort->desc) + { + ret = -ret; + } + + return ret; +} + +// Standard handler +void LvStandardHandler(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, UINT id) +{ + NMHDR *n; + NMLVKEYDOWN *key; + // Validate arguments + if (hWnd == NULL) + { + return; + } + + LvSortHander(hWnd, msg, wParam, lParam, id); + + switch (msg) + { + case WM_NOTIFY: + n = (NMHDR *)lParam; + if (n->idFrom == id) + { + switch (n->code) + { + case NM_DBLCLK: + Command(hWnd, IDOK); + break; + case LVN_KEYDOWN: + key = (NMLVKEYDOWN *)n; + if (key != NULL) + { + UINT code = key->wVKey; + switch (code) + { + case VK_DELETE: + Command(hWnd, B_DELETE); + break; + + case VK_RETURN: + Command(hWnd, IDOK); + break; + + case VK_F5: + Command(hWnd, B_REFRESH); + break; + } + } + break; + } + } + break; + } +} + +// Sort header handler +void LvSortHander(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, UINT id) +{ + NMHDR *nmhdr; + UINT subitem; + bool desc; + // Validate arguments + if (hWnd == NULL) + { + return; + } + + switch (msg) + { + case WM_NOTIFY: + nmhdr = (NMHDR *)lParam; + + if (nmhdr != NULL) + { + if (nmhdr->idFrom == id) + { + NMLISTVIEW *v; + switch (nmhdr->code) + { + case LVN_COLUMNCLICK: + desc = false; + v = (NMLISTVIEW *)lParam; + subitem = v->iSubItem; + + if ((GetStyle(hWnd, id) & LVS_SORTDESCENDING) == 0) + { + desc = true; + SetStyle(hWnd, id, LVS_SORTDESCENDING); + RemoveStyle(hWnd, id, LVS_SORTASCENDING); + } + else + { + SetStyle(hWnd, id, LVS_SORTASCENDING); + RemoveStyle(hWnd, id, LVS_SORTDESCENDING); + } + + LvSort(hWnd, id, subitem, desc); + break; + } + } + } + break; + } +} + +// Do sort +void LvSort(HWND hWnd, UINT id, UINT subitem, bool desc) +{ + UINT i, num; + bool numeric = true; + wchar_t na[2] = {0xff0d, 0x0, }; + // Validate arguments + if (hWnd == NULL) + { + return; + } + + num = LvNum(hWnd, id); + for (i = 0;i < num;i++) + { + wchar_t *s = LvGetStr(hWnd, id, i, subitem); + if (s != NULL) + { + if (UniIsNum(s) == false && UniStrCmp(s, na) != 0) + { + numeric = false; + Free(s); + break; + } + Free(s); + } + else + { + numeric = false; + break; + } + } + + LvSortEx(hWnd, id, subitem, desc, numeric); +} + +void LvSortEx(HWND hWnd, UINT id, UINT subitem, bool desc, bool numeric) +{ + WINUI_LV_SORT s; + // Validate arguments + if (hWnd == NULL) + { + return; + } + if (subitem >= LvGetColumnNum(hWnd, id)) + { + return; + } + + Zero(&s, sizeof(s)); + s.desc = desc; + s.numeric = numeric; + s.id = id; + s.hWnd = hWnd; + s.subitem = subitem; + + ListView_SortItemsEx(DlgItem(hWnd, id), LvSortProc, (LPARAM)&s); +} + +// Add an item to adding batch +void LvInsertAdd(LVB *b, UINT icon, void *param, UINT num_str, ...) +{ + UINT i; + va_list va; + UINT index = 0; + LVB_ITEM *t; + // Validate arguments + if (b == NULL || num_str == 0) + { + return; + } + + t = ZeroMalloc(sizeof(LVB_ITEM)); + + va_start(va, num_str); + + t->Strings = (wchar_t **)ZeroMalloc(sizeof(wchar_t *) * num_str); + t->NumStrings = num_str; + + for (i = 0;i < num_str;i++) + { + wchar_t *s = va_arg(va, wchar_t *); + + t->Strings[i] = UniCopyStr(s); + } + + t->Param = param; + t->Image = GetIcon(icon); + + Add(b->ItemList, t); + + va_end(va); +} + +// Start the item adding batch +LVB *LvInsertStart() +{ + LVB *b = ZeroMalloc(sizeof(LVB)); + b->ItemList = NewListFast(NULL); + + return b; +} + +// Add items to the list view +void LvInsert(HWND hWnd, UINT id, UINT icon, void *param, UINT num_str, ...) +{ + UINT i; + va_list va; + UINT index = 0; + // Validate arguments + if (hWnd == NULL) + { + return; + } + + va_start(va, num_str); + + for (i = 0;i < num_str;i++) + { + wchar_t *s = va_arg(va, wchar_t *); + if (i == 0) + { + index = LvInsertItem(hWnd, id, icon, param, s); + } + else + { + LvSetItem(hWnd, id, index, i, s); + } + } + + va_end(va); +} + +// Adjust the item size automatically +void LvAutoSize(HWND hWnd, UINT id) +{ + UINT i; + // Validate arguments + if (hWnd == NULL) + { + return; + } + + i = 0; + while (true) + { + if (ListView_SetColumnWidth(DlgItem(hWnd, id), i, LVSCW_AUTOSIZE) == false) + { + break; + } + i++; + } +} + +// Add an item +UINT LvInsertItem(HWND hWnd, UINT id, UINT icon, void *param, wchar_t *str) +{ + return LvInsertItemByImageListId(hWnd, id, GetIcon(icon), param, str); +} +UINT LvInsertItemByImageListId(HWND hWnd, UINT id, UINT image, void *param, wchar_t *str) +{ + LVITEMW t; + // Validate arguments + if (hWnd == NULL || str == NULL) + { + return INFINITE; + } + if (MsIsNt() == false) + { + char *s = CopyUniToStr(str); + UINT ret; + ret = LvInsertItemByImageListIdA(hWnd, id, image, param, s); + Free(s); + return ret; + } + + Zero(&t, sizeof(t)); + t.mask = LVIF_IMAGE | LVIF_PARAM | LVIF_TEXT; + t.pszText = str; + t.iImage = image; + t.lParam = (LPARAM)param; + t.iItem = LvNum(hWnd, id); + + return SendMsg(hWnd, id, LVM_INSERTITEMW, 0, (LPARAM)&t); +} +UINT LvInsertItemByImageListIdA(HWND hWnd, UINT id, UINT image, void *param, char *str) +{ + LVITEM t; + // Validate arguments + if (hWnd == NULL || str == NULL) + { + return INFINITE; + } + + Zero(&t, sizeof(t)); + t.mask = LVIF_IMAGE | LVIF_PARAM | LVIF_TEXT; + t.pszText = str; + t.iImage = image; + t.lParam = (LPARAM)param; + t.iItem = LvNum(hWnd, id); + + return SendMsg(hWnd, id, LVM_INSERTITEM, 0, (LPARAM)&t); +} + +// Change the image +void LvSetItemImageByImageListId(HWND hWnd, UINT id, UINT index, UINT image) +{ + LVITEM t; + // Validate arguments + if (hWnd == NULL) + { + return; + } + + Zero(&t, sizeof(t)); + t.mask = LVIF_IMAGE; + t.iImage = image; + t.iItem = index; + + SendMsg(hWnd, id, LVM_SETITEM, 0, (LPARAM)&t); +} + +// Set the parameters of the item +void LvSetItemParam(HWND hWnd, UINT id, UINT index, void *param) +{ + LvSetItemParamEx(hWnd, id, index, 0, param); +} +void LvSetItemParamEx(HWND hWnd, UINT id, UINT index, UINT subitem, void *param) +{ + LVITEM t; + // Validate arguments + if (hWnd == NULL) + { + return; + } + + Zero(&t, sizeof(t)); + t.mask = LVIF_PARAM; + t.iItem = index; + t.iSubItem = subitem; + t.lParam = (LPARAM)param; + + SendMsg(hWnd, id, LVM_SETITEM, 0, (LPARAM)&t); +} + +// Set the item +void LvSetItem(HWND hWnd, UINT id, UINT index, UINT pos, wchar_t *str) +{ + LVITEMW t; + wchar_t *old_str; + // Validate arguments + if (hWnd == NULL || str == NULL) + { + return; + } + if (MsIsNt() == false) + { + char *s = CopyUniToStr(str); + LvSetItemA(hWnd, id, index, pos, s); + Free(s); + return; + } + + Zero(&t, sizeof(t)); + t.mask = LVIF_TEXT; + t.pszText = str; + t.iItem = index; + t.iSubItem = pos; + + old_str = LvGetStr(hWnd, id, index, pos); + + if (UniStrCmp(old_str, str) != 0) + { + SendMsg(hWnd, id, LVM_SETITEMW, 0, (LPARAM)&t); + } + + Free(old_str); +} +void LvSetItemA(HWND hWnd, UINT id, UINT index, UINT pos, char *str) +{ + LVITEM t; + wchar_t *old_str; + char *old_str_2; + // Validate arguments + if (hWnd == NULL || str == NULL) + { + return; + } + + Zero(&t, sizeof(t)); + t.mask = LVIF_TEXT; + t.pszText = str; + t.iItem = index; + t.iSubItem = pos; + + old_str = LvGetStr(hWnd, id, index, pos); + old_str_2 = CopyUniToStr(old_str); + + if (StrCmp(old_str_2, str) != 0) + { + SendMsg(hWnd, id, LVM_SETITEM, 0, (LPARAM)&t); + } + + Free(old_str_2); + Free(old_str); +} + +// Set the view of the list box +void LvSetView(HWND hWnd, UINT id, bool details) +{ + // Validate arguments + if (hWnd == NULL) + { + return; + } + + if (details) + { + RemoveStyle(hWnd, id, LVS_ICON); + SetStyle(hWnd, id, LVS_REPORT); + } + else + { + RemoveStyle(hWnd, id, LVS_REPORT); + SetStyle(hWnd, id, LVS_ICON); + } +} + +// Get whether there is currently selected item +bool LvIsSelected(HWND hWnd, UINT id) +{ + // Validate arguments + if (hWnd == NULL) + { + return false; + } + + if (LvGetSelected(hWnd, id) == INFINITE) + { + return false; + } + + return true; +} + +// Get the currently selected item +UINT LvGetFocused(HWND hWnd, UINT id) +{ + // Validate arguments + if (hWnd == NULL) + { + return INFINITE; + } + + return ListView_GetNextItem(DlgItem(hWnd, id), -1, LVNI_FOCUSED); +} + +// Get the parameter of the currently selected item +void *LvGetSelectedParam(HWND hWnd, UINT id) +{ + UINT index; + // Validate arguments + if (hWnd == NULL) + { + return NULL; + } + + index = LvGetSelected(hWnd, id); + + if (index == INFINITE) + { + return NULL; + } + + return LvGetParam(hWnd, id, index); +} + +// Get a string that is currently selected +wchar_t *LvGetFocusedStr(HWND hWnd, UINT id, UINT pos) +{ + UINT i; + // Validate arguments + if (hWnd == NULL) + { + return NULL; + } + + i = LvGetFocused(hWnd, id); + if (i == INFINITE) + { + return NULL; + } + + return LvGetStr(hWnd, id, i, pos); +} + +// Get the currently selected item +UINT LvGetSelected(HWND hWnd, UINT id) +{ + // Validate arguments + if (hWnd == NULL) + { + return INFINITE; + } + + return ListView_GetNextItem(DlgItem(hWnd, id), -1, LVNI_FOCUSED | LVNI_SELECTED); +} + +// Get a string that is currently selected +wchar_t *LvGetSelectedStr(HWND hWnd, UINT id, UINT pos) +{ + UINT i; + // Validate arguments + if (hWnd == NULL) + { + return NULL; + } + + i = LvGetSelected(hWnd, id); + if (i == INFINITE) + { + return NULL; + } + + return LvGetStr(hWnd, id, i, pos); +} +char *LvGetSelectedStrA(HWND hWnd, UINT id, UINT pos) +{ + char *ret; + wchar_t *tmp = LvGetSelectedStr(hWnd, id, pos); + if (tmp == NULL) + { + return NULL; + } + ret = CopyUniToStr(tmp); + Free(tmp); + return ret; +} + +// Get whether two or more items are masked +bool LvIsMultiMasked(HWND hWnd, UINT id) +{ + UINT i; + // Validate arguments + if (hWnd == NULL) + { + return false; + } + + i = INFINITE; + i = LvGetNextMasked(hWnd, id, i); + if (i != INFINITE) + { + if (LvGetNextMasked(hWnd, id, i) != INFINITE) + { + return true; + } + } + + return false; +} + +// Examine whether just only one item is selected +bool LvIsSingleSelected(HWND hWnd, UINT id) +{ + return LvIsSelected(hWnd, id) && (LvIsMultiMasked(hWnd, id) == false); +} + +// Get whether there are items that are currently masked +bool LvIsMasked(HWND hWnd, UINT id) +{ + // Validate arguments + if (hWnd == NULL) + { + return false; + } + + if (LvGetNextMasked(hWnd, id, INFINITE) == INFINITE) + { + return false; + } + + return true; +} + +// Get the items that is currently masked +UINT LvGetNextMasked(HWND hWnd, UINT id, UINT start) +{ + // Validate arguments + if (hWnd == NULL) + { + return INFINITE; + } + + return ListView_GetNextItem(DlgItem(hWnd, id), start, LVNI_SELECTED); +} + +// Search an item with the specified string +UINT LvSearchStr(HWND hWnd, UINT id, UINT pos, wchar_t *str) +{ + UINT i, num; + // Validate arguments + if (hWnd == NULL || str == NULL) + { + return INFINITE; + } + + num = LvNum(hWnd, id); + + for (i = 0;i < num;i++) + { + wchar_t *s = LvGetStr(hWnd, id, i, pos); + if (s != NULL) + { + if (UniStrCmpi(s, str) == 0) + { + Free(s); + return i; + } + else + { + Free(s); + } + } + } + + return INFINITE; +} +UINT LvSearchStrA(HWND hWnd, UINT id, UINT pos, char *str) +{ + wchar_t *tmp = CopyStrToUni(str); + UINT ret = LvSearchStr(hWnd, id, pos, tmp); + Free(tmp); + return ret; +} + +// Search for item that have a specified param +UINT LvSearchParam(HWND hWnd, UINT id, void *param) +{ + UINT i, num; + // Validate arguments + if (hWnd == NULL) + { + return INFINITE; + } + + num = LvNum(hWnd, id); + + for (i = 0;i < num;i++) + { + if (LvGetParam(hWnd, id, i) == param) + { + return i; + } + } + + return INFINITE; +} + +// Get the number of items +UINT LvNum(HWND hWnd, UINT id) +{ + // Validate arguments + if (hWnd == NULL) + { + return 0; + } + + return ListView_GetItemCount(DlgItem(hWnd, id)); +} + +// Remove an item +void LvDeleteItem(HWND hWnd, UINT id, UINT index) +{ + UINT i; + // Validate arguments + if (hWnd == NULL) + { + return; + } + + ListView_DeleteItem(DlgItem(hWnd, id), index); + + i = LvGetSelected(hWnd, id); + if (i != INFINITE) + { + LvSelect(hWnd, id, i); + } +} + +// Get the data from the item +void *LvGetParam(HWND hWnd, UINT id, UINT index) +{ + return LvGetParamEx(hWnd, id, index, 0); +} +void *LvGetParamEx(HWND hWnd, UINT id, UINT index, UINT subitem) +{ + LVITEM t; + // Validate arguments + if (hWnd == NULL) + { + return NULL; + } + if (index == INFINITE) + { + return NULL; + } + + Zero(&t, sizeof(t)); + t.mask = LVIF_PARAM; + t.iItem = index; + t.iSubItem = subitem; + + if (ListView_GetItem(DlgItem(hWnd, id), &t) == false) + { + return NULL; + } + + return (void *)t.lParam; +} + +// Get the string of item +wchar_t *LvGetStr(HWND hWnd, UINT id, UINT index, UINT pos) +{ + wchar_t *tmp; + UINT size; + LVITEMW t; + // Validate arguments + if (hWnd == NULL) + { + return NULL; + } + if (MsIsNt() == false) + { + char *s = LvGetStrA(hWnd, id, index, pos); + if (s == NULL) + { + return NULL; + } + else + { + wchar_t *ret = CopyStrToUni(s); + Free(s); + + return ret; + } + } + + size = 65536; + tmp = Malloc(size); + + Zero(&t, sizeof(t)); + t.mask = LVIF_TEXT; + t.iItem = index; + t.iSubItem = pos; + t.pszText = tmp; + t.cchTextMax = size; + + if (SendMsg(hWnd, id, LVM_GETITEMTEXTW, index, (LPARAM)&t) <= 0) + { + Free(tmp); + return UniCopyStr(L""); + } + else + { + wchar_t *ret = UniCopyStr(tmp); + Free(tmp); + return ret; + } +} +char *LvGetStrA(HWND hWnd, UINT id, UINT index, UINT pos) +{ + char *tmp; + UINT size; + LVITEM t; + // Validate arguments + if (hWnd == NULL) + { + return NULL; + } + + size = 65536; + tmp = Malloc(size); + + Zero(&t, sizeof(t)); + t.mask = LVIF_TEXT; + t.iItem = index; + t.iSubItem = pos; + t.pszText = tmp; + t.cchTextMax = size; + + if (SendMsg(hWnd, id, LVM_GETITEMTEXT, index, (LPARAM)&t) <= 0) + { + Free(tmp); + return CopyStr(""); + } + else + { + char *ret = CopyStr(tmp); + Free(tmp); + return ret; + } +} + +// Set the style +void LvSetStyle(HWND hWnd, UINT id, UINT style) +{ + // Validate arguments + if (hWnd == NULL) + { + return; + } + + if ((ListView_GetExtendedListViewStyle(DlgItem(hWnd, id)) & style) == 0) + { + ListView_SetExtendedListViewStyleEx(DlgItem(hWnd, id), style, style); + } +} + +// Remove the style +void LvRemoveStyle(HWND hWnd, UINT id, UINT style) +{ + // Validate arguments + if (hWnd == NULL) + { + return; + } + + if ((ListView_GetExtendedListViewStyle(DlgItem(hWnd, id)) & style) != 0) + { + ListView_SetExtendedListViewStyleEx(DlgItem(hWnd, id), style, 0); + } +} + +// Invert the selection of items +void LvSwitchSelect(HWND hWnd, UINT id) +{ + UINT i, num; + bool *states; + // Validate arguments + if (hWnd == NULL) + { + return; + } + + num = LvNum(hWnd, id); + states = ZeroMalloc(sizeof(bool) * num); + + i = INFINITE; + while (true) + { + i = LvGetNextMasked(hWnd, id, i); + if (i == INFINITE) + { + break; + } + + states[i] = true; + } + + for (i = 0;i < num;i++) + { + if (states[i] == false) + { + ListView_SetItemState(DlgItem(hWnd, id), i, LVIS_SELECTED, LVIS_SELECTED); + } + else + { + ListView_SetItemState(DlgItem(hWnd, id), i, 0, LVIS_SELECTED); + } + } + + Free(states); +} + +// Select all items +void LvSelectAll(HWND hWnd, UINT id) +{ + UINT i, num; + // Validate arguments + if (hWnd == NULL) + { + return; + } + + num = LvNum(hWnd, id); + for (i = 0;i < num;i++) + { + ListView_SetItemState(DlgItem(hWnd, id), i, LVIS_SELECTED, LVIS_SELECTED); + } +} + +// Select the item by specifying the parameter +void LvSelectByParam(HWND hWnd, UINT id, void *param) +{ + UINT index; + // Validate arguments + if (hWnd == NULL || param == NULL) + { + return; + } + + index = LvSearchParam(hWnd, id, param); + if (index == INFINITE) + { + return; + } + + LvSelect(hWnd, id, index); +} + +// Select an item +void LvSelect(HWND hWnd, UINT id, UINT index) +{ + // Validate arguments + if (hWnd == NULL) + { + return; + } + + if (index == INFINITE) + { + UINT i, num; + // Deselect all + num = LvNum(hWnd, id); + for (i = 0;i < num;i++) + { + ListView_SetItemState(DlgItem(hWnd, id), i, 0, LVIS_SELECTED); + } + } + else + { + // Select + ListView_SetItemState(DlgItem(hWnd, id), index, LVIS_FOCUSED | LVIS_SELECTED, LVIS_FOCUSED | LVIS_SELECTED); + ListView_EnsureVisible(DlgItem(hWnd, id), index, true); + } +} + +// Show the certificate information +void PrintCertInfo(HWND hWnd, CERT_DLG *p) +{ + X *x; + char *serial_tmp; + UINT serial_size; + wchar_t *wchar_tmp; + wchar_t tmp[1024 * 5]; + UCHAR md5[MD5_SIZE]; + UCHAR sha1[SHA1_SIZE]; + char *s_tmp; + K *k; + // Validate arguments + if (p == NULL || hWnd == NULL) + { + return; + } + + x = p->x; + + // Serial number + if (x->serial != NULL) + { + serial_size = x->serial->size * 3 + 1; + serial_tmp = ZeroMalloc(serial_size); + BinToStrEx(serial_tmp, serial_size, x->serial->data, x->serial->size); + wchar_tmp = CopyStrToUni(serial_tmp); + Free(serial_tmp); + } + else + { + wchar_tmp = CopyUniStr(_UU("CERT_NO_SERIAL")); + } + LvInsert(hWnd, L_CERTINFO, ICO_CERT, NULL, 2, _UU("CERT_SERIAL"), wchar_tmp); + + // Issuer + GetAllNameFromName(tmp, sizeof(tmp), x->issuer_name); + LvInsert(hWnd, L_CERTINFO, ICO_CERT, NULL, 2, _UU("CERT_ISSUER"), tmp); + + // Subject + GetAllNameFromName(tmp, sizeof(tmp), x->subject_name); + LvInsert(hWnd, L_CERTINFO, ICO_CERT, NULL, 2, _UU("CERT_SUBJECT"), tmp); + + // Not available before + GetDateTimeStrEx64(tmp, sizeof(tmp), SystemToLocal64(x->notBefore), NULL); + LvInsert(hWnd, L_CERTINFO, ICO_CERT, NULL, 2, _UU("CERT_NOT_BEFORE"), tmp); + + // Not available after + GetDateTimeStrEx64(tmp, sizeof(tmp), SystemToLocal64(x->notAfter), NULL); + LvInsert(hWnd, L_CERTINFO, ICO_CERT, NULL, 2, _UU("CERT_NOT_AFTER"), tmp); + + // Number of bits + if (x->is_compatible_bit) + { + UniFormat(tmp, sizeof(tmp), _UU("CERT_BITS_FORMAT"), x->bits); + LvInsert(hWnd, L_CERTINFO, ICO_CERT, NULL, 2, _UU("CERT_BITS"), tmp); + } + + // Public key + k = GetKFromX(x); + if (k != NULL) + { + BUF *b = KToBuf(k, false, NULL); + s_tmp = CopyBinToStrEx(b->Buf, b->Size); + StrToUni(tmp, sizeof(tmp), s_tmp); + Free(s_tmp); + LvInsert(hWnd, L_CERTINFO, ICO_KEY, NULL, 2, _UU("CERT_PUBLIC_KEY"), tmp); + FreeBuf(b); + } + FreeK(k); + + GetXDigest(x, md5, false); + GetXDigest(x, sha1, true); + + // Digest (MD5) + s_tmp = CopyBinToStrEx(md5, sizeof(md5)); + StrToUni(tmp, sizeof(tmp), s_tmp); + Free(s_tmp); + LvInsert(hWnd, L_CERTINFO, ICO_KEY, NULL, 2, _UU("CERT_DIGEST_MD5"), tmp); + + // Digest (SHA-1) + s_tmp = CopyBinToStrEx(sha1, sizeof(sha1)); + StrToUni(tmp, sizeof(tmp), s_tmp); + Free(s_tmp); + LvInsert(hWnd, L_CERTINFO, ICO_KEY, NULL, 2, _UU("CERT_DIGEST_SHA1"), tmp); + + Free(wchar_tmp); + + LvSelect(hWnd, L_CERTINFO, 0); +} + +// Update the display +void CertDlgUpdate(HWND hWnd, CERT_DLG *p) +{ + // Validate arguments + if (hWnd == NULL || p == NULL) + { + return; + } + + if (LvIsSelected(hWnd, L_CERTINFO) == false) + { + SetText(hWnd, E_DETAIL, L""); + } + else + { + UINT i = LvGetSelected(hWnd, L_CERTINFO); + wchar_t *tmp = LvGetStr(hWnd, L_CERTINFO, i, 1); + SetText(hWnd, E_DETAIL, tmp); + Free(tmp); + } +} + +// Save the certificate +void CertDlgSave(HWND hWnd, CERT_DLG *p) +{ + wchar_t *name; + X *x; + // Validate arguments + if (hWnd == NULL || p == NULL) + { + return; + } + + // Save to a file + name = SaveDlg(hWnd, _UU("DLG_CERT_FILES"), _UU("DLG_SAVE_CERT"), NULL, L".cer"); + x = p->x; + if (name != NULL) + { + wchar_t str[MAX_SIZE]; + UniStrCpy(str, sizeof(str), name); + if (XToFileW(x, str, true)) + { + MsgBox(hWnd, MB_ICONINFORMATION, _UU("DLG_CERT_SAVE_OK")); + } + else + { + MsgBox(hWnd, MB_ICONSTOP, _UU("DLG_CERT_SAVE_ERROR")); + } + Free(name); + } +} + +// Certificate display dialog procedure +UINT CertDlgProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param) +{ + CERT_DLG *p = (CERT_DLG *)param; + X *x; + wchar_t tmp[MAX_SIZE]; + NMHDR *n; + // Validate arguments + if (hWnd == NULL) + { + return 0; + } + + switch (msg) + { + case WM_INITDIALOG: + SetIcon(hWnd, 0, ICO_CERT); + x = p->x; + GetAllNameFromNameEx(tmp, sizeof(tmp), x->subject_name); + SetText(hWnd, E_SUBJECT, tmp); + GetAllNameFromNameEx(tmp, sizeof(tmp), x->issuer_name); + SetText(hWnd, E_ISSUER, tmp); + GetDateStrEx64(tmp, sizeof(tmp), SystemToLocal64(x->notAfter), NULL); + SetText(hWnd, E_EXPIRES, tmp); + SetFont(hWnd, E_SUBJECT, Font(0, 1)); + SetFont(hWnd, E_ISSUER, Font(0, 1)); + SetFont(hWnd, E_EXPIRES, Font(0, 1)); + SetIcon(hWnd, B_PARENT, ICO_CERT); + if (x->root_cert) + { + // Root certificate + Hide(hWnd, S_WARNING_ICON); + SetText(hWnd, S_PARENT, _UU("CERT_ROOT")); + Hide(hWnd, B_PARENT); + Hide(hWnd, S_PARENT_BUTTON_STR); + } + else if (p->issuer_x != NULL) + { + // Parent certificate exists + Hide(hWnd, S_WARNING_ICON); + } + else + { + // There is no parent certificate + Hide(hWnd, S_CERT_ICON); + Hide(hWnd, B_PARENT); + Hide(hWnd, S_PARENT_BUTTON_STR); + SetText(hWnd, S_PARENT, _UU("CERT_NOT_FOUND")); + if (p->ManagerMode) + { + Hide(hWnd, IDC_STATIC1); + Hide(hWnd, S_PARENT); + Hide(hWnd, S_WARNING_ICON); + Hide(hWnd, S_CERT_ICON); + Hide(hWnd, B_PARENT); + Hide(hWnd, S_PARENT_BUTTON_STR); + } + } + + + LvInit(hWnd, L_CERTINFO); + LvInsertColumn(hWnd, L_CERTINFO, 0, _UU("CERT_LV_C1"), 130); + LvInsertColumn(hWnd, L_CERTINFO, 1, _UU("CERT_LV_C2"), 250); + + PrintCertInfo(hWnd, p); + Focus(hWnd, L_CERTINFO); + + CertDlgUpdate(hWnd, p); + + if (p->ManagerMode) + { + Show(hWnd, B_SAVE); + } + else + { + // Hide for security + Hide(hWnd, B_SAVE); + } + + break; + case WM_COMMAND: + switch (wParam) + { + case IDOK: + case IDCANCEL: + Close(hWnd); + break; + case B_PARENT: + CertDlg(hWnd, p->issuer_x, NULL, p->ManagerMode); + break; + case B_SAVE: + // Save to the file + CertDlgSave(hWnd, p); + break; + } + break; + case WM_CLOSE: + EndDialog(hWnd, false); + break; + case WM_NOTIFY: + n = (NMHDR *)lParam; + switch (n->idFrom) + { + case L_CERTINFO: + switch (n->code) + { + case LVN_ITEMCHANGED: + CertDlgUpdate(hWnd, p); + break; + } + break; + } + break; + } + + LvSortHander(hWnd, msg, wParam, lParam, L_CERTINFO); + + return 0; +} + +// Certificate display dialog +void CertDlg(HWND hWnd, X *x, X *issuer_x, bool manager) +{ + CERT_DLG p; + // Validate arguments + if (x == NULL) + { + return; + } + + Zero(&p, sizeof(p)); + p.x = x; + if (CompareX(x, issuer_x) == false) + { + p.issuer_x = issuer_x; + } + p.ManagerMode = manager; + Dialog(hWnd, D_CERT, CertDlgProc, &p); +} + +// Status window dialog +UINT StatusPrinterWindowDlg(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param) +{ + STATUS_WINDOW_PARAM *p = (STATUS_WINDOW_PARAM *)param; + PACK *pack; + // Validate arguments + if (hWnd == NULL) + { + return 0; + } + + switch (msg) + { + case WM_INITDIALOG: + // Initialize + SetIcon(hWnd, 0, ICO_SERVER_ONLINE); + RemoveExStyle(hWnd, 0, WS_EX_APPWINDOW); + p->hWnd = hWnd; + NoticeThreadInit(p->Thread); + FormatText(hWnd, 0, p->AccountName); + break; + + case WM_COMMAND: + switch (wParam) + { + case IDOK: + case IDCANCEL: + // Cancel button + Close(hWnd); + break; + } + + break; + + case WM_APP + 1: + // Set a string + SetText(hWnd, S_STATUS, (wchar_t *)lParam); + break; + + case WM_APP + 2: + // Close this window + EndDialog(hWnd, false); + break; + + case WM_CLOSE: + // End the session + pack = NewPack(); + SendPack(p->Sock, pack); + EndDialog(hWnd, false); + break; + } + + return 0; +} + +// Status window control thread +void StatusPrinterWindowThread(THREAD *thread, void *param) +{ + STATUS_WINDOW_PARAM *p = (STATUS_WINDOW_PARAM *)param; + // Validate arguments + if (thread == NULL || param == NULL) + { + return; + } + + p->Thread = thread; + DialogEx2(NULL, D_STATUS, StatusPrinterWindowDlg, p, true, true); + + Free(p); +} + +// Show a message in the status window +void StatusPrinterWindowPrint(STATUS_WINDOW *sw, wchar_t *str) +{ + // Validate arguments + if (sw == NULL) + { + return; + } + + SendMessage(sw->hWnd, WM_APP + 1, 0, (LPARAM)str); +} + +// End and release the status window +void StatusPrinterWindowStop(STATUS_WINDOW *sw) +{ + // Validate arguments + if (sw == NULL) + { + return; + } + + // Send stop message + SendMessage(sw->hWnd, WM_APP + 2, 0, 0); + + // Wait until the thread terminates + WaitThread(sw->Thread, INFINITE); + + // Release the memory + ReleaseThread(sw->Thread); + Free(sw); +} + +// Initialize the status window +STATUS_WINDOW *StatusPrinterWindowStart(SOCK *s, wchar_t *account_name) +{ + STATUS_WINDOW_PARAM *p; + STATUS_WINDOW *sw; + THREAD *t; + // Validate arguments + if (s == NULL || account_name == NULL) + { + return NULL; + } + + p = ZeroMalloc(sizeof(STATUS_WINDOW_PARAM)); + p->Sock = s; + UniStrCpy(p->AccountName, sizeof(p->AccountName), account_name); + + // Create a thread + t = NewThread(StatusPrinterWindowThread, p); + WaitThreadInit(t); + + sw = ZeroMalloc(sizeof(STATUS_WINDOW)); + sw->hWnd = p->hWnd; + sw->Thread = t; + + return sw; +} + +// Remove all +void LbReset(HWND hWnd, UINT id) +{ + // Validate arguments + if (hWnd == NULL) + { + return; + } + + SendMsg(hWnd, id, LB_RESETCONTENT, 0, 0); +} + +// Password input dialog state change +void PasswordDlgProcChange(HWND hWnd, UI_PASSWORD_DLG *p) +{ + bool b; + // Validate arguments + if (hWnd == NULL || p == NULL) + { + return; + } + + b = true; + if (IsEmpty(hWnd, E_USERNAME)) + { + b = false; + } + + SetEnable(hWnd, IDOK, b); + + p->StartTick = Tick64(); + if (p->RetryIntervalSec) + { + KillTimer(hWnd, 1); + Hide(hWnd, P_PROGRESS); + Hide(hWnd, S_COUNTDOWN); + } +} + +// Get the string +wchar_t *CbGetStr(HWND hWnd, UINT id) +{ + // Validate arguments + if (hWnd == NULL) + { + return NULL; + } + + return GetText(hWnd, id); +} + +// String search +UINT CbFindStr(HWND hWnd, UINT id, wchar_t *str) +{ + UINT ret; + if (MsIsNt() == false) + { + char *tmp = CopyUniToStr(str); + ret = CbFindStr9xA(hWnd, id, tmp); + Free(tmp); + return ret; + } + // Validate arguments + if (hWnd == NULL || str == NULL) + { + return INFINITE; + } + + ret = SendMsg(hWnd, id, CB_FINDSTRINGEXACT, -1, (LPARAM)str); + + return ret; +} +UINT CbFindStr9xA(HWND hWnd, UINT id, char *str) +{ + UINT ret; + // Validate arguments + if (hWnd == NULL || str == NULL) + { + return INFINITE; + } + + ret = SendMsg(hWnd, id, CB_FINDSTRINGEXACT, -1, (LPARAM)str); + + return ret; +} + +// Get the number of items +UINT CbNum(HWND hWnd, UINT id) +{ + // Validate arguments + if (hWnd == NULL) + { + return INFINITE; + } + + return SendMsg(hWnd, id, CB_GETCOUNT, 0, 0); +} + +// Add a string +UINT CbAddStrA(HWND hWnd, UINT id, char *str, UINT data) +{ + wchar_t *tmp; + UINT ret; + // Validate arguments + if (hWnd == NULL || str == NULL) + { + return INFINITE; + } + tmp = CopyStrToUni(str); + ret = CbAddStr(hWnd, id, tmp, data); + Free(tmp); + return ret; +} +UINT CbAddStr(HWND hWnd, UINT id, wchar_t *str, UINT data) +{ + UINT ret; + if (MsIsNt() == false) + { + char *s = CopyUniToStr(str); + ret = CbAddStr9xA(hWnd, id, s, data); + Free(s); + return ret; + } + // Validate arguments + if (hWnd == NULL || str == NULL) + { + return INFINITE; + } + + ret = SendMsg(hWnd, id, CB_ADDSTRING, 0, (LPARAM)str); + SendMsg(hWnd, id, CB_SETITEMDATA, ret, (LPARAM)data); + + if (CbNum(hWnd, id) == 1) + { + wchar_t tmp[MAX_SIZE]; + GetTxt(hWnd, id, tmp, sizeof(tmp)); + if (UniStrLen(tmp) == 0) + { + CbSelectIndex(hWnd, id, 0); + } + } + + return ret; +} +UINT CbAddStr9xA(HWND hWnd, UINT id, char *str, UINT data) +{ + UINT ret; + // Validate arguments + if (hWnd == NULL || str == NULL) + { + return INFINITE; + } + + ret = SendMsg(hWnd, id, CB_ADDSTRING, 0, (LPARAM)str); + SendMsg(hWnd, id, CB_SETITEMDATA, ret, (LPARAM)data); + + if (CbNum(hWnd, id) == 1) + { + wchar_t tmp[MAX_SIZE]; + GetTxt(hWnd, id, tmp, sizeof(tmp)); + if (UniStrLen(tmp) == 0) + { + CbSelectIndex(hWnd, id, 0); + } + } + + return ret; +} + +// Remove all +void CbReset(HWND hWnd, UINT id) +{ + wchar_t *s; + // Validate arguments + if (hWnd == NULL) + { + return; + } + + s = GetText(hWnd, id); + + SendMsg(hWnd, id, CB_RESETCONTENT, 0, 0); + + if (s != NULL) + { + SetText(hWnd, id, s); + Free(s); + } +} + +// Select by specifying the index +void CbSelectIndex(HWND hWnd, UINT id, UINT index) +{ + // Validate arguments + if (hWnd == NULL) + { + return; + } + + SendMsg(hWnd, id, CB_SETCURSEL, index, 0); +} + +// Get the data +UINT CbGetData(HWND hWnd, UINT id, UINT index) +{ + // Validate arguments + if (hWnd == NULL || index == INFINITE) + { + return INFINITE; + } + + return SendMsg(hWnd, id, CB_GETITEMDATA, index, 0); +} + +// Search for the data +UINT CbFindData(HWND hWnd, UINT id, UINT data) +{ + UINT i, num; + // Validate arguments + if (hWnd == NULL) + { + return INFINITE; + } + + num = CbNum(hWnd, id); + if (num == INFINITE) + { + return INFINITE; + } + + for (i = 0;i < num;i++) + { + if (CbGetData(hWnd, id, i) == data) + { + return i; + } + } + + return INFINITE; +} + +// Set the height of the item +void CbSetHeight(HWND hWnd, UINT id, UINT value) +{ + // Validate arguments + if (hWnd == NULL) + { + return; + } + + SendMsg(hWnd, id, CB_SETITEMHEIGHT, 0, (UINT)(GetTextScalingFactor() * (double)value)); +} + +// Search by specifying the data +void CbSelect(HWND hWnd, UINT id, int data) +{ + UINT index; + // Validate arguments + if (hWnd == NULL) + { + return; + } + + if (data == INFINITE) + { + // Get the first item + CbSelectIndex(hWnd, id, 0); + return; + } + + index = CbFindData(hWnd, id, data); + if (index == INFINITE) + { + // Can not be found + return; + } + + // Select + CbSelectIndex(hWnd, id, index); +} + +// Get the currently selected item +UINT CbGetSelectIndex(HWND hWnd, UINT id) +{ + // Validate arguments + if (hWnd == NULL) + { + return INFINITE; + } + + return SendMsg(hWnd, id, CB_GETCURSEL, 0, 0); +} + +// Get the value that is currently selected +UINT CbGetSelect(HWND hWnd, UINT id) +{ + UINT index; + // Validate arguments + if (hWnd == NULL) + { + return INFINITE; + } + + index = CbGetSelectIndex(hWnd, id); + if (index == INFINITE) + { + return INFINITE; + } + + return CbGetData(hWnd, id, index); +} + +// OK button is pressed +void PasswordDlgOnOk(HWND hWnd, UI_PASSWORD_DLG *p) +{ + // Validate arguments + if (hWnd == NULL || p == NULL) + { + return; + } + + GetTxtA(hWnd, E_USERNAME, p->Username, sizeof(p->Username)); + GetTxtA(hWnd, E_PASSWORD, p->Password, sizeof(p->Password)); + p->Type = CbGetSelect(hWnd, C_TYPE); + + if (p->ShowNoSavePassword) + { + p->NoSavePassword = IsChecked(hWnd, R_NO_SAVE_PASSWORD); + } + + EndDialog(hWnd, true); +} + +// Password input dialog procedure +UINT PasswordDlgProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param) +{ + UI_PASSWORD_DLG *p = (UI_PASSWORD_DLG *)param; + // Validate arguments + if (hWnd == NULL) + { + return 0; + } + + switch (msg) + { + case WM_INITDIALOG: + SetIcon(hWnd, 0, ICO_KEY); + CbSetHeight(hWnd, C_TYPE, 18); + if (p->ServerName != NULL) + { + FormatText(hWnd, 0, p->ServerName); + } + else + { + SetText(hWnd, 0, _UU("PW_LOGIN_DLG_TITLE")); + } + + if (p->ProxyServer == false) + { + FormatText(hWnd, S_TITLE, p->ServerName == NULL ? "" : p->ServerName); + } + else + { + wchar_t tmp[MAX_SIZE]; + UniFormat(tmp, sizeof(tmp), _UU("PW_MSG_PROXY"), p->ServerName == NULL ? "" : p->ServerName); + SetText(hWnd, S_TITLE, tmp); + } + + // Enumerate the connection methods + SendMsg(hWnd, C_TYPE, CBEM_SETUNICODEFORMAT, true, 0); + + if (StrCmpi(p->Username, WINUI_PASSWORD_NULL_USERNAME) != 0) + { + SetTextA(hWnd, E_USERNAME, p->Username); + SetTextA(hWnd, E_PASSWORD, p->Password); + } + else + { + p->RetryIntervalSec = 0; + SetTextA(hWnd, E_USERNAME, ""); + SetTextA(hWnd, E_PASSWORD, ""); + } + + if (p->AdminMode == false) + { + if (p->ProxyServer == false) + { + CbAddStr(hWnd, C_TYPE, _UU("PW_TYPE_1"), CLIENT_AUTHTYPE_PASSWORD); + CbAddStr(hWnd, C_TYPE, _UU("PW_TYPE_2"), CLIENT_AUTHTYPE_PLAIN_PASSWORD); + } + else + { + CbAddStr(hWnd, C_TYPE, _UU("PW_TYPE_PROXY"), 0); + Disable(hWnd, C_TYPE); + } + + CbSelect(hWnd, C_TYPE, p->Type); + } + else + { + CbAddStr(hWnd, C_TYPE, _UU("SM_PASSWORD_TYPE_STR"), 0); + Disable(hWnd, C_TYPE); + SetTextA(hWnd, E_USERNAME, "Administrator"); + Disable(hWnd, E_USERNAME); + } + + if (IsEmpty(hWnd, E_USERNAME)) + { + FocusEx(hWnd, E_USERNAME); + } + else + { + FocusEx(hWnd, E_PASSWORD); + } + LimitText(hWnd, E_USERNAME, MAX_USERNAME_LEN); + LimitText(hWnd, E_PASSWORD, MAX_PASSWORD_LEN); + + PasswordDlgProcChange(hWnd, p); + + if (p->RetryIntervalSec != 0) + { + SetTimer(hWnd, 1, 50, NULL); + FormatText(hWnd, S_COUNTDOWN, p->RetryIntervalSec); + Show(hWnd, S_COUNTDOWN); + Show(hWnd, P_PROGRESS); + SetRange(hWnd, P_PROGRESS, 0, p->RetryIntervalSec * 1000); + } + else + { + Hide(hWnd, S_COUNTDOWN); + Hide(hWnd, P_PROGRESS); + } + + if (p->ShowNoSavePassword) + { + Show(hWnd, R_NO_SAVE_PASSWORD); + Check(hWnd, R_NO_SAVE_PASSWORD, p->NoSavePassword); + } + else + { + Hide(hWnd, R_NO_SAVE_PASSWORD); + } + + p->StartTick = Tick64(); + + if (p->CancelEvent != NULL) + { + SetTimer(hWnd, 2, 50, NULL); + } + + break; + + case WM_CLOSE: + EndDialog(hWnd, false); + break; + + case WM_TIMER: + switch (wParam) + { + case 1: + if (p->RetryIntervalSec != 0) + { + wchar_t tmp[MAX_SIZE]; + UINT64 end, now, start; + start = p->StartTick; + end = p->StartTick + (UINT64)(p->RetryIntervalSec * 1000); + now = Tick64(); + + if (now <= end) + { + UniFormat(tmp, sizeof(tmp), _UU("PW_RETRYCOUNT"), (UINT)((end - now) / 1000)); + SetText(hWnd, S_COUNTDOWN, tmp); + SetPos(hWnd, P_PROGRESS, (UINT)(now - start)); + } + else + { + EndDialog(hWnd, true); + } + } + break; + + case 2: + if (p->CancelEvent != NULL) + { + // Wait for the end event + HANDLE hEvent = (HANDLE)p->CancelEvent->pData; + UINT ret = WaitForSingleObject(hEvent, 0); + if (ret != WAIT_TIMEOUT) + { + // Forced termination event is set + Close(hWnd); + } + } + break; + } + break; + + case WM_COMMAND: + switch (wParam) + { + case IDOK: + PasswordDlgOnOk(hWnd, p); + break; + case IDCANCEL: + Close(hWnd); + break; + } + switch (HIWORD(wParam)) + { + case EN_CHANGE: + switch (LOWORD(wParam)) + { + case E_USERNAME: + case E_PASSWORD: + PasswordDlgProcChange(hWnd, p); + break; + } + break; + case CBN_SELCHANGE: + switch (LOWORD(wParam)) + { + case C_TYPE: + PasswordDlgProcChange(hWnd, p); + if (IsEmpty(hWnd, E_USERNAME)) + { + FocusEx(hWnd, E_USERNAME); + } + else + { + FocusEx(hWnd, E_PASSWORD); + } + break; + } + break; + } + break; + } + + return 0; +} + +// Set the position of the progress bar +void SetPos(HWND hWnd, UINT id, UINT pos) +{ + // Validate arguments + if (hWnd == NULL) + { + return; + } + + SendMsg(hWnd, id, PBM_SETPOS, pos, 0); +} + +// Set the range of the progress bar +void SetRange(HWND hWnd, UINT id, UINT start, UINT end) +{ + // Validate arguments + if (hWnd == NULL) + { + return; + } + + SendMsg(hWnd, id, PBM_SETRANGE32, start, end); +} + +// Password input dialog +bool PasswordDlg(HWND hWnd, UI_PASSWORD_DLG *p) +{ + // Validate arguments + if (p == NULL) + { + return false; + } + + p->StartTick = Tick64(); + + return Dialog(hWnd, D_PASSWORD, PasswordDlgProc, p); +} + +// Passphrase input dialog +bool PassphraseDlg(HWND hWnd, char *pass, UINT pass_size, BUF *buf, bool p12) +{ + PASSPHRASE_DLG p; + // Validate arguments + if (pass == NULL || buf == NULL) + { + return false; + } + + Zero(&p, sizeof(PASSPHRASE_DLG)); + + p.buf = buf; + p.p12 = p12; + + // Examine whether it is encrypted first + if (p12 == false) + { + // Secret key + if (IsEncryptedK(buf, true) == false) + { + // Unencrypted + StrCpy(pass, pass_size, ""); + return true; + } + } + else + { + // PKCS#12 + P12 *p12 = BufToP12(buf); + if (p12 == NULL) + { + // It is in unknown format, but not encrypted + StrCpy(pass, pass_size, ""); + return true; + } + + if (IsEncryptedP12(p12) == false) + { + // Unencrypted + StrCpy(pass, pass_size, ""); + FreeP12(p12); + return true; + } + FreeP12(p12); + } + + // Show the dialog + if (Dialog(hWnd, D_PASSPHRASE, PassphraseDlgProc, &p) == false) + { + // Cancel + return false; + } + + StrCpy(pass, pass_size, p.pass); + + return true; +} + +// WM_COMMAND handler +void PassphraseDlgProcCommand(HWND hWnd, PASSPHRASE_DLG *p) +{ + char *pass; + bool ok; + // Validate arguments + if (hWnd == NULL || p == NULL) + { + return; + } + + pass = GetTextA(hWnd, E_PASSPHRASE); + if (pass == NULL) + { + return; + } + + ok = false; + + if (p->p12 == false) + { + K *k; + k = BufToK(p->buf, true, true, pass); + if (k != NULL) + { + ok = true; + FreeK(k); + } + } + else + { + X *x; + K *k; + P12 *p12; + p12 = BufToP12(p->buf); + if (p12 != NULL) + { + if (ParseP12(p12, &x, &k, pass)) + { + FreeX(x); + FreeK(k); + ok = true; + } + FreeP12(p12); + } + } + + Free(pass); + + SetEnable(hWnd, IDOK, ok); +} + +// Passphrase input dialog procedure +UINT PassphraseDlgProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param) +{ + PASSPHRASE_DLG *p = (PASSPHRASE_DLG *)param; + // Validate arguments + if (hWnd == NULL) + { + return 0; + } + + switch (msg) + { + case WM_INITDIALOG: + PassphraseDlgProcCommand(hWnd, p); + break; + + case WM_COMMAND: + switch (wParam) + { + case IDOK: + GetTxtA(hWnd, E_PASSPHRASE, p->pass, sizeof(p->pass)); + EndDialog(hWnd, true); + break; + + case IDCANCEL: + Close(hWnd); + break; + } + + switch (LOWORD(wParam)) + { + case E_PASSPHRASE: + PassphraseDlgProcCommand(hWnd, p); + break; + } + break; + + case WM_CLOSE: + EndDialog(hWnd, false); + break; + } + + return 0; +} + +// [Save File] dialog +wchar_t *SaveDlg(HWND hWnd, wchar_t *filter, wchar_t *title, wchar_t *default_name, wchar_t *default_ext) +{ + wchar_t *filter_str; + wchar_t tmp[MAX_SIZE]; + OPENFILENAMEW o; + + if (MsIsNt() == false) + { + char *ret, *s1, *s2, *s3, *s4; + wchar_t *wr; + s1 = CopyUniToStr(filter); + s2 = CopyUniToStr(title); + s3 = CopyUniToStr(default_name); + s4 = CopyUniToStr(default_ext); + ret = SaveDlgA(hWnd, s1, s2, s3, s4); + Free(s1); + Free(s2); + Free(s3); + Free(s4); + wr = CopyStrToUni(ret); + Free(ret); + return wr; + } + + // Validate arguments + if (filter == NULL) + { + filter = _UU("DLG_ALL_FILES"); + } + + filter_str = MakeFilter(filter); + + Zero(&o, sizeof(o)); + Zero(tmp, sizeof(tmp)); + + if (default_name != NULL) + { + UniStrCpy(tmp, sizeof(tmp), default_name); + } + + o.lStructSize = sizeof(o); + + if (OS_IS_WINDOWS_9X(GetOsInfo()->OsType) || (OS_IS_WINDOWS_NT(GetOsInfo()->OsType) && GET_KETA(GetOsInfo()->OsType, 100) <= 1)) + { + o.lStructSize = OPENFILENAME_SIZE_VERSION_400W; + } + + o.hwndOwner = hWnd; + o.hInstance = GetModuleHandle(NULL); + o.lpstrFile = tmp; + o.lpstrTitle = title; + o.lpstrFilter = filter_str; + o.nMaxFile = sizeof(tmp); + o.Flags = OFN_OVERWRITEPROMPT; + o.lpstrDefExt = default_ext; + + if (GetSaveFileNameW(&o) == false) + { + Free(filter_str); + return NULL; + } + + Free(filter_str); + + return UniCopyStr(tmp); +} +char *SaveDlgA(HWND hWnd, char *filter, char *title, char *default_name, char *default_ext) +{ + char *filter_str; + char tmp[MAX_SIZE]; + OPENFILENAME o; + // Validate arguments + if (filter == NULL) + { + filter = _SS("DLG_ALL_FILES"); + } + + filter_str = MakeFilterA(filter); + + Zero(&o, sizeof(o)); + Zero(tmp, sizeof(tmp)); + + if (default_name != NULL) + { + StrCpy(tmp, sizeof(tmp), default_name); + } + + o.lStructSize = sizeof(o); + + if (OS_IS_WINDOWS_9X(GetOsInfo()->OsType) || (OS_IS_WINDOWS_NT(GetOsInfo()->OsType) && GET_KETA(GetOsInfo()->OsType, 100) <= 1)) + { + o.lStructSize = OPENFILENAME_SIZE_VERSION_400A; + } + + o.hwndOwner = hWnd; + o.hInstance = GetModuleHandle(NULL); + o.lpstrFile = tmp; + o.lpstrTitle = title; + o.lpstrFilter = filter_str; + o.nMaxFile = sizeof(tmp); + o.Flags = OFN_OVERWRITEPROMPT; + o.lpstrDefExt = default_ext; + + if (GetSaveFileName(&o) == false) + { + Free(filter_str); + return NULL; + } + + Free(filter_str); + + return CopyStr(tmp); +} + +// [Open File] dialog +wchar_t *OpenDlg(HWND hWnd, wchar_t *filter, wchar_t *title) +{ + wchar_t *filter_str; + wchar_t tmp[MAX_SIZE]; + OPENFILENAMEW o; + + if (MsIsNt() == false) + { + char *ret; + char *filter_a; + char *title_a; + wchar_t *w; + filter_a = CopyUniToStr(filter); + title_a = CopyUniToStr(title); + ret = OpenDlgA(hWnd, filter_a, title_a); + Free(filter_a); + Free(title_a); + w = CopyStrToUni(ret); + Free(ret); + return w; + } + + // Validate arguments + if (filter == NULL) + { + filter = _UU("DLG_ALL_FILES"); + } + + filter_str = MakeFilter(filter); + + Zero(&o, sizeof(OPENFILENAMEW)); + Zero(tmp, sizeof(tmp)); + + o.lStructSize = sizeof(o); + + + if (OS_IS_WINDOWS_9X(GetOsInfo()->OsType) || (OS_IS_WINDOWS_NT(GetOsInfo()->OsType) && GET_KETA(GetOsInfo()->OsType, 100) <= 1)) + { + o.lStructSize = OPENFILENAME_SIZE_VERSION_400W; + } + + + o.hwndOwner = hWnd; + o.hInstance = GetModuleHandle(NULL); + o.lpstrFilter = filter_str; + o.lpstrFile = tmp; + o.nMaxFile = sizeof(tmp); + o.lpstrTitle = title; + o.Flags = OFN_FILEMUSTEXIST | OFN_HIDEREADONLY; + + if (GetOpenFileNameW(&o) == false) + { + Free(filter_str); + return NULL; + } + + Free(filter_str); + + return UniCopyStr(tmp); +} +char *OpenDlgA(HWND hWnd, char *filter, char *title) +{ + char *filter_str; + char tmp[MAX_SIZE]; + OPENFILENAME o; + // Validate arguments + if (filter == NULL) + { + filter = _SS("DLG_ALL_FILES"); + } + + filter_str = MakeFilterA(filter); + + Zero(&o, sizeof(OPENFILENAME)); + Zero(tmp, sizeof(tmp)); + + o.lStructSize = sizeof(o); + + if (OS_IS_WINDOWS_9X(GetOsInfo()->OsType) || (OS_IS_WINDOWS_NT(GetOsInfo()->OsType) && GET_KETA(GetOsInfo()->OsType, 100) <= 1)) + { + o.lStructSize = OPENFILENAME_SIZE_VERSION_400A; + } + + o.hwndOwner = hWnd; + o.hInstance = GetModuleHandle(NULL); + o.lpstrFilter = filter_str; + o.lpstrFile = tmp; + o.nMaxFile = sizeof(tmp); + o.lpstrTitle = title; + o.Flags = OFN_FILEMUSTEXIST | OFN_HIDEREADONLY; + + if (GetOpenFileName(&o) == false) + { + Free(filter_str); + return NULL; + } + + Free(filter_str); + + return CopyStr(tmp); +} + +// Generate the filter string +wchar_t *MakeFilter(wchar_t *str) +{ + UINT i; + wchar_t *ret; + // Validate arguments + if (str == NULL) + { + return NULL; + } + + ret = ZeroMalloc(UniStrSize(str) + 32); + + for (i = 0;i < UniStrLen(str);i++) + { + if (str[i] == L'|') + { + ret[i] = L'\0'; + } + else + { + ret[i] = str[i]; + } + } + + return ret; +} +char *MakeFilterA(char *str) +{ + UINT i; + char *ret; + // Validate arguments + if (str == NULL) + { + return NULL; + } + + ret = ZeroMalloc(StrSize(str) + 32); + + for (i = 0;i < StrLen(str);i++) + { + if (str[i] == '|') + { + ret[i] = '\0'; + } + else + { + ret[i] = str[i]; + } + } + + return ret; +} + +// Execution of batch +bool ExecuteSecureDeviceBatch(HWND hWnd, SECURE *sec, SECURE_DEVICE_THREAD *p, SECURE_DEVICE *dev, WINUI_SECURE_BATCH *batch) +{ + LIST *o; + void *buf; + UINT size = 10 * 1024; // Maximum size of the data + UINT type = INFINITE; + // Validate arguments + if (hWnd == NULL || p == NULL || dev == NULL || batch == NULL || sec == NULL) + { + return false; + } + + switch (batch->Type) + { + case WINUI_SECURE_DELETE_CERT: + type = SEC_X; + goto DELETE_OBJECT; + + case WINUI_SECURE_DELETE_KEY: + type = SEC_K; + goto DELETE_OBJECT; + + case WINUI_SECURE_DELETE_DATA: + type = SEC_DATA; + goto DELETE_OBJECT; + + case WINUI_SECURE_DELETE_OBJECT: + // Delete the object +DELETE_OBJECT: + SetText(hWnd, S_STATUS, _UU("SEC_DELETE")); + if (DeleteSecObjectByName(sec, batch->Name, type) == false) + { + p->ErrorMessage = UniCopyStr(_UU("SEC_ERROR_DELETE")); + return false; + } + break; + + case WINUI_SECURE_ENUM_OBJECTS: + // Enumerate objects + SetText(hWnd, S_STATUS, _UU("SEC_ENUM")); + o = EnumSecObject(sec); + if (o == NULL) + { + p->ErrorMessage = UniCopyStr(_UU("SEC_ERROR_ENUM")); + return false; + } + + batch->EnumList = o; + break; + + case WINUI_SECURE_WRITE_DATA: + // Write the data + SetText(hWnd, S_STATUS, _UU("SEC_WRITE_DATA")); + if (WriteSecData(sec, batch->Private, batch->Name, batch->InputData->Buf, batch->InputData->Size) == false) + { + p->ErrorMessage = UniCopyStr(dev->Type != SECURE_USB_TOKEN ? + _UU("SEC_ERROR_WRITE_1") : _UU("SEC_ERROR_WRITE_2")); + return false; + } + break; + + case WINUI_SECURE_READ_DATA: + // Read the data + SetText(hWnd, S_STATUS, _UU("SEC_READ_DATA")); + buf = MallocEx(size, true); + size = ReadSecData(sec, batch->Name, buf, size); + if (size == 0) + { + Free(buf); + p->ErrorMessage = UniCopyStr(dev->Type != SECURE_USB_TOKEN ? + _UU("SEC_ERROR_NOT_FOUND_1") : _UU("SEC_ERROR_NOT_FOUND_2")); + return false; + } + batch->OutputData = NewBuf(); + WriteBuf(batch->OutputData, buf, size); + SeekBuf(batch->OutputData, 0, 0); + Free(buf); + break; + + case WINUI_SECURE_WRITE_CERT: + // Write the certificate + SetText(hWnd, S_STATUS, _UU("SEC_WRITE_CERT")); + if (WriteSecCert(sec, batch->Private, batch->Name, batch->InputX) == false) + { + p->ErrorMessage = UniCopyStr(dev->Type != SECURE_USB_TOKEN ? + _UU("SEC_ERROR_WRITE_1") : _UU("SEC_ERROR_WRITE_2")); + return false; + } + break; + + case WINUI_SECURE_READ_CERT: + // Read the certificate + SetText(hWnd, S_STATUS, _UU("SEC_READ_CERT")); + batch->OutputX = ReadSecCert(sec, batch->Name); + if (batch->OutputX == NULL) + { + p->ErrorMessage = UniCopyStr(dev->Type != SECURE_USB_TOKEN ? + _UU("SEC_ERROR_NOT_FOUND_1") : _UU("SEC_ERROR_NOT_FOUND_2")); + return false; + } + break; + + case WINUI_SECURE_WRITE_KEY: + // Write the secret key + SetText(hWnd, S_STATUS, _UU("SEC_WRITE_KEY")); + if (WriteSecKey(sec, batch->Private, batch->Name, batch->InputK) == false) + { + p->ErrorMessage = UniCopyStr(dev->Type != SECURE_USB_TOKEN ? + _UU("SEC_ERROR_WRITE_1") : _UU("SEC_ERROR_WRITE_2")); + return false; + } + break; + + case WINUI_SECURE_SIGN_WITH_KEY: + // Signature + SetText(hWnd, S_STATUS, _UU("SEC_SIGN")); + if (SignSec(sec, batch->Name, batch->OutputSign, batch->InputData->Buf, batch->InputData->Size) == false) + { + p->ErrorMessage = UniCopyStr(dev->Type != SECURE_USB_TOKEN ? + _UU("SEC_ERROR_SIGN_1") : _UU("SEC_ERROR_SIGN_2")); + return false; + } + break; + } + + return true; +} + +// Run the secure device operations as a batch job +void SecureDeviceBatch(HWND hWnd, SECURE *sec, SECURE_DEVICE_THREAD *p, SECURE_DEVICE *dev) +{ + UINT i; + // Validate arguments + if (hWnd == NULL || p == NULL || dev == NULL || sec == NULL) + { + return; + } + + // Sequential processing + for (i = 0;i < p->w->num_batch;i++) + { + WINUI_SECURE_BATCH *batch = &p->w->batch[i]; + + if (ExecuteSecureDeviceBatch(hWnd, sec, p, dev, batch) == false) + { + // If fail even one, abort immediately + return; + } + } + + // All batch job succeeded + p->Succeed = true; +} + +// Thread to perform a secure device operation +void SecureDeviceThread(THREAD *t, void *param) +{ + SECURE *sec; + SECURE_DEVICE_THREAD *p = (SECURE_DEVICE_THREAD *)param; + SECURE_DEVICE *dev; + HWND hWnd; + // Validate arguments + if (t == NULL || param == NULL) + { + return; + } + + p->Succeed = false; + p->ErrorMessage = NULL; + + hWnd = p->hWnd; + + // Open the device + dev = GetSecureDevice(p->w->device_id); + SetText(hWnd, S_STATUS, _UU("SEC_OPENING")); + sec = OpenSec(p->w->device_id); + if (sec == NULL) + { + // Device open failure + if (p->w->device_id != 9) + { + p->ErrorMessage = CopyUniFormat(_UU("SEC_ERROR_OPEN_DEVICE"), dev->DeviceName); + } + else + { + p->ErrorMessage = CopyUniFormat(_UU("SEC_ERROR_OPEN_DEVICEEX"), dev->DeviceName); + } + } + else + { + // Open the session + SetText(hWnd, S_STATUS, _UU("SEC_OPEN_SESSION")); + if (OpenSecSession(sec, 0) == false) + { + // Session initialization failure + p->ErrorMessage = CopyUniFormat(_UU("SEC_ERROR_OPEN_SESSION"), dev->DeviceName); + } + else + { + // Login + SetText(hWnd, S_STATUS, _UU("SEC_LOGIN")); + if (LoginSec(sec, p->pin) == false) + { + // Login failure + p->ErrorMessage =UniCopyStr(_UU("SEC_ERROR_LOGIN")); + } + else + { + // Batch processing main + SetText(hWnd, S_STATUS, _UU("SEC_INIT_BATCH")); + SecureDeviceBatch(hWnd, sec, p, dev); + + // Logout + SetText(hWnd, S_STATUS, _UU("SEC_LOGOUT")); + LogoutSec(sec); + } + + // Close the session + SetText(hWnd, S_STATUS, _UU("SEC_CLOSE_SESSION")); + CloseSecSession(sec); + } + + // Close the device + SetText(hWnd, S_STATUS, _UU("SEC_CLOSING")); + CloseSec(sec); + } + + if (p->Succeed) + { + // If successful, show the message for 150ms (service) + SetText(hWnd, S_STATUS, _UU("SEC_FINISHED")); + SleepThread(150); + } + + SendMessage(p->hWnd, WM_APP + 1, 0, 0); +} + +// Start a secure device operation +void StartSecureDevice(HWND hWnd, SECURE_DEVICE_WINDOW *w) +{ + SECURE_DEVICE_THREAD *p; + // Validate arguments + if (hWnd == NULL || w == NULL) + { + return; + } + + // Disable the control + EnableSecureDeviceWindowControls(hWnd, false); + + // Start the thread + p = ZeroMalloc(sizeof(SECURE_DEVICE_THREAD)); + p->w = w; + p->hWnd = hWnd; + w->p = p; + p->pin = GetTextA(hWnd, E_PIN); + ReleaseThread(NewThread(SecureDeviceThread, p)); +} + +// Enable or disable the control of the secure device operation window +void EnableSecureDeviceWindowControls(HWND hWnd, bool enable) +{ + // Validate arguments + if (hWnd == NULL) + { + return; + } + + if (enable) + { + Show(hWnd, S_PIN_CODE); + Show(hWnd, E_PIN); + Show(hWnd, S_WARNING); + } + else + { + Hide(hWnd, S_PIN_CODE); + Hide(hWnd, E_PIN); + Hide(hWnd, S_WARNING); + } + + SetEnable(hWnd, IDOK, enable); + SetEnable(hWnd, IDCANCEL, enable); + SetEnable(hWnd, S_TITLE, enable); + SetEnable(hWnd, S_DEVICE_INFO, enable); + SetEnable(hWnd, S_INSERT_SECURE, enable); + + if (enable == false) + { + DisableClose(hWnd); + SetText(hWnd, S_STATUS, L""); + Show(hWnd, S_STATUS); + PlayAvi(hWnd, A_PROGRESS, true); + } + else + { + EnableClose(hWnd); + SetText(hWnd, S_STATUS, L""); + Hide(hWnd, S_STATUS); + StopAvi(hWnd, A_PROGRESS); + } +} + +// Secure device operation window procedure +UINT SecureDeviceWindowProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param) +{ + SECURE_DEVICE_WINDOW *w = (SECURE_DEVICE_WINDOW *)param; + SECURE_DEVICE *dev = GetSecureDevice(w->device_id); + + switch (msg) + { + case WM_INITDIALOG: + if (dev == NULL) + { + MsgBoxEx(hWnd, MB_ICONEXCLAMATION, _UU("SEC_ERROR_INVALID_ID"), w->device_id); + EndDialog(hWnd, 0); + break; + } + + if (IsJPKI(dev->Id)) + { + // Juki card + Hide(hWnd, S_IMAGE); + Show(hWnd, S_IMAGE2); + Hide(hWnd, S_IMAGE_TSUKUBA); + } + else + { + // Regular card + Hide(hWnd, S_IMAGE2); + + if (w->BitmapId != 0) + { + // For University of Tsukuba + Hide(hWnd, S_IMAGE); + Show(hWnd, S_IMAGE_TSUKUBA); + } + else + { + // For general use + Show(hWnd, S_IMAGE); + Hide(hWnd, S_IMAGE_TSUKUBA); + } + } + + FormatText(hWnd, 0, dev->Type != SECURE_USB_TOKEN ? _UU("SEC_SMART_CARD") : _UU("SEC_USB_TOKEN"), + dev->DeviceName); + FormatText(hWnd, S_TITLE, dev->DeviceName); + FormatText(hWnd, S_INSERT_SECURE, + dev->Type != SECURE_USB_TOKEN ? _UU("SEC_INIT_MSG_1") : _UU("SEC_INIT_MSG_2")); + FormatText(hWnd, S_DEVICE_INFO, + dev->DeviceName, dev->Manufacturer, dev->ModuleName); + + DlgFont(hWnd, S_SOFTWARE_TITLE, 11, 0); + SetText(hWnd, S_SOFTWARE_TITLE, title_bar); + + DlgFont(hWnd, S_TITLE, 14, true); + DlgFont(hWnd, S_DEVICE_INFO, 11, false); + DlgFont(hWnd, S_STATUS, 13, true); + EnableSecureDeviceWindowControls(hWnd, true); + OpenAvi(hWnd, A_PROGRESS, AVI_PROGRESS); + + SetIcon(hWnd, 0, ICO_KEY); + + // Initial PIN + if ((w->default_pin != NULL && StrLen(w->default_pin) != 0) || (cached_pin_code_expires >= Tick64())) + { + if (w->default_pin != NULL && StrLen(w->default_pin) != 0) + { + SetTextA(hWnd, E_PIN, w->default_pin); + } + else + { + SetTextA(hWnd, E_PIN, cached_pin_code); + } + SetTimer(hWnd, 1, 1, NULL); + } + + break; + + case WM_TIMER: + switch (wParam) + { + case 1: + KillTimer(hWnd, 1); + Command(hWnd, IDOK); + break; + } + break; + + case WM_COMMAND: + switch (wParam) + { + case IDOK: + StartSecureDevice(hWnd, w); + break; + + case IDCANCEL: + Close(hWnd); + break; + } + break; + + case WM_CLOSE: + if (IsEnable(hWnd, IDCANCEL)) + { + CloseAvi(hWnd, A_PROGRESS); + EndDialog(hWnd, false); + } + break; + + case WM_APP + 1: + // There is a response from the thread + if (w->p != NULL) + { + if (w->p->Succeed) + { + // Success + if (w->default_pin != NULL) + { + StrCpy(w->default_pin, 128, w->p->pin); + } + StrCpy(cached_pin_code, sizeof(cached_pin_code), w->p->pin); + cached_pin_code_expires = Tick64() + (UINT64)WINUI_SECUREDEVICE_PIN_CACHE_TIME; + Free(w->p->pin); + Free(w->p); + EndDialog(hWnd, true); + } + else + { + // Failure + cached_pin_code_expires = 0; + EnableSecureDeviceWindowControls(hWnd, true); + FocusEx(hWnd, E_PIN); + MsgBox(hWnd, MB_ICONEXCLAMATION, w->p->ErrorMessage); + Free(w->p->pin); + Free(w->p->ErrorMessage); + Free(w->p); + } + } + break; + } + + return 0; +} + +// Send a WM_COMMAND +void Command(HWND hWnd, UINT id) +{ + SendMessage(hWnd, WM_COMMAND, id, 0); +} + +// Show the secure device window +bool SecureDeviceWindow(HWND hWnd, WINUI_SECURE_BATCH *batch, UINT num_batch, UINT device_id, UINT bitmap_id) +{ + SECURE_DEVICE_WINDOW w; + UINT i; + // Validate arguments + if (batch == NULL || num_batch == 0 || device_id == 0) + { + return false; + } + + // Initialize the success flag + for (i = 0;i < num_batch;i++) + { + batch[i].Succeed = false; + } + + Zero(&w, sizeof(w)); + w.batch = batch; + w.device_id = device_id; + w.num_batch = num_batch; + w.BitmapId = bitmap_id; + + // Open a dialog + return (bool)Dialog(hWnd, D_SECURE, SecureDeviceWindowProc, &w); +} + +// Stop playing the AVI +void StopAvi(HWND hWnd, UINT id) +{ + // Validate arguments + if (hWnd == NULL) + { + return; + } + + Animate_Stop(DlgItem(hWnd, id)); + Hide(hWnd, id); +} + +// Play an AVI +void PlayAvi(HWND hWnd, UINT id, bool repeat) +{ + // Validate arguments + if (hWnd == NULL) + { + return; + } + + Show(hWnd, id); + Animate_Play(DlgItem(hWnd, id), 0, -1, (repeat ? -1 : 0)); +} + +// Close the AVI file +void CloseAvi(HWND hWnd, UINT id) +{ + // Validate arguments + if (hWnd == NULL) + { + return; + } + + StopAvi(hWnd, id); + Animate_Close(DlgItem(hWnd, id)); +} + +// Open an AVI file +void OpenAvi(HWND hWnd, UINT id, UINT avi_id) +{ + // Validate arguments + if (hWnd == NULL || avi_id == 0) + { + return; + } + + Hide(hWnd, id); + Animate_OpenEx(DlgItem(hWnd, id), hDll, MAKEINTRESOURCE(avi_id)); +} + +// Set the font to the control +void DlgFont(HWND hWnd, UINT id, UINT size, UINT bold) +{ + DIALOG_PARAM *param = (DIALOG_PARAM *)GetParam(hWnd); + + if (param == NULL || param->meiryo == false) + { + SetFont(hWnd, id, Font(size, bold)); + } + else + { + SetFont(hWnd, id, GetFont((_GETLANG() == 2 ? "Microsoft YaHei" : GetMeiryoFontName()), size, bold, false, false, false)); + } +} + +// Generate a standard font +HFONT Font(UINT size, UINT bold) +{ + return GetFont(NULL, size, bold, false, false, false); +} + +// Dialog procedure for internal management +UINT CALLBACK InternalDialogProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam) +{ + DIALOG_PARAM *param = (DIALOG_PARAM *)GetParam(hWnd); + void *app_param = NULL; + bool white_flag = false; + UINT ret; + // Validate arguments + if (hWnd == NULL) + { + return 0; + } + + if (msg == WM_INITDIALOG) + { + DoEvents(hWnd); + } + + if (param == NULL) + { + if (msg == WM_INITDIALOG) + { + param = (void *)lParam; + InitDialogInternational(hWnd, param); + } + } + if (param != NULL) + { + app_param = param->param; + white_flag = param->white; + } + + ret = DlgProc(hWnd, msg, wParam, lParam, white_flag); + if (ret != 0) + { + return ret; + } + + ret = 0; + + if (param != NULL) + { + if (param->proc != NULL) + { + ret = param->proc(hWnd, msg, wParam, lParam, app_param); + } + else + { + if (msg == WM_CLOSE) + { + EndDialog(hWnd, 0); + } + else if (msg == WM_COMMAND && (wParam == IDOK || wParam == IDCANCEL)) + { + Close(hWnd); + } + } + } + + if (msg == WM_INITDIALOG) + { + SetForegroundWindow(hWnd); + SetActiveWindow(hWnd); + } + + return ret; +} + +// Show a dialog box +UINT Dialog(HWND hWnd, UINT id, WINUI_DIALOG_PROC *proc, void *param) +{ + bool white = true; + + return DialogEx(hWnd, id, proc, param, white); +} +UINT DialogEx(HWND hWnd, UINT id, WINUI_DIALOG_PROC *proc, void *param, bool white) +{ + return DialogEx2(hWnd, id, proc, param, white, false); +} +UINT DialogEx2(HWND hWnd, UINT id, WINUI_DIALOG_PROC *proc, void *param, bool white, bool meiryo) +{ + UINT ret; + DIALOG_PARAM p; + // Validate arguments + if (id == 0) + { + return 0; + } + + Zero(&p, sizeof(p)); + p.param = param; + p.white = white; + p.proc = proc; + + p.BitmapList = NewBitmapList(); + + if (MsIsVista()) + { + p.meiryo = meiryo; + } + + ret = DialogInternal(hWnd, id, InternalDialogProc, &p); + + FreeBitmapList(p.BitmapList); + + return ret; +} + +// Initialize the icon cache +void InitIconCache() +{ + if (icon_cache_list != NULL) + { + return; + } + + icon_cache_list = NewList(NULL); +} + +// Release the icon cache +void FreeIconCache() +{ + UINT i; + if (icon_cache_list == NULL) + { + return; + } + + for (i = 0;i < LIST_NUM(icon_cache_list);i++) + { + ICON_CACHE *c = LIST_DATA(icon_cache_list, i); + DestroyIcon(c->hIcon); + Free(c); + } + + ReleaseList(icon_cache_list); + icon_cache_list = NULL; +} + +// Get the Icon +HICON LoadIconEx(UINT id, bool small_icon) +{ + HICON h = NULL; + UINT i; + if (icon_cache_list == NULL) + { + return small_icon == false ? LoadLargeIconInner(id) : LoadSmallIconInner(id); + } + + LockList(icon_cache_list); + { + for (i = 0;i < LIST_NUM(icon_cache_list);i++) + { + ICON_CACHE *c = LIST_DATA(icon_cache_list, i); + if (c->id == id && c->small_icon == small_icon) + { + h = c->hIcon; + break; + } + } + + if (h == NULL) + { + h = small_icon == false ? LoadLargeIconInner(id) : LoadSmallIconInner(id); + if (h != NULL) + { + ICON_CACHE *c = ZeroMalloc(sizeof(ICON_CACHE)); + c->hIcon = h; + c->id = id; + c->small_icon = small_icon; + Add(icon_cache_list, c); + } + } + } + UnlockList(icon_cache_list); + + return h; +} + +// Get a large Icon +HICON LoadLargeIcon(UINT id) +{ + return LoadIconEx(id, false); +} + +// Get a small icon +HICON LoadSmallIcon(UINT id) +{ + return LoadIconEx(id, true); +} + +// Get a large icon +HICON LoadLargeIconInner(UINT id) +{ + HICON ret; + ret = LoadImage(hDll, MAKEINTRESOURCE(id), IMAGE_ICON, 32, 32, 0); + if (ret == NULL) + { + ret = LoadImage(hDll, MAKEINTRESOURCE(id), IMAGE_ICON, 32, 32, LR_VGACOLOR); + if (ret == NULL) + { + ret = LoadImage(hDll, MAKEINTRESOURCE(id), IMAGE_ICON, 0, 0, 0); + if (ret == NULL) + { + ret = LoadImage(hDll, MAKEINTRESOURCE(id), IMAGE_ICON, 0, 0, LR_VGACOLOR); + if (ret == NULL) + { + ret = LoadIcon(hDll, MAKEINTRESOURCE(id)); + } + } + } + } + return ret; +} + +// Get a small icon +HICON LoadSmallIconInner(UINT id) +{ + HICON ret; + ret = LoadImage(hDll, MAKEINTRESOURCE(id), IMAGE_ICON, 16, 16, 0); + if (ret == NULL) + { + ret = LoadImage(hDll, MAKEINTRESOURCE(id), IMAGE_ICON, 16, 16, LR_VGACOLOR); + if (ret == NULL) + { + ret = LoadImage(hDll, MAKEINTRESOURCE(id), IMAGE_ICON, 0, 0, 0); + if (ret == NULL) + { + ret = LoadImage(hDll, MAKEINTRESOURCE(id), IMAGE_ICON, 0, 0, LR_VGACOLOR); + if (ret == NULL) + { + ret = LoadLargeIconInner(id); + } + } + } + } + return ret; +} + +// Set the icon to the button or window +void SetIcon(HWND hWnd, UINT id, UINT icon_id) +{ + HICON icon1, icon2; + // Validate arguments + if (hWnd == NULL) + { + return; + } + + icon1 = LoadLargeIcon(icon_id); + if (icon1 == NULL) + { + return; + } + + if (id == 0) + { + SendMessage(hWnd, WM_SETICON, ICON_BIG, (LPARAM)icon1); + icon2 = LoadSmallIcon(icon_id); + if (icon2 == NULL) + { + icon2 = icon1; + } + SendMessage(hWnd, WM_SETICON, ICON_SMALL, (LPARAM)icon2); + } + else + { + bool is_btn = true; + wchar_t *s = GetClass(hWnd, id); + if (s != NULL) + { + if (UniStrCmpi(s, L"Static") == 0) + { + is_btn = false; + } + Free(s); + } + + if (is_btn) + { + SendMsg(hWnd, id, BM_SETIMAGE, IMAGE_ICON, (LPARAM)icon1); + } + else + { + SendMsg(hWnd, id, STM_SETICON, (WPARAM)icon1, 0); + } + } +} + +// Check whether the radio button is checked +bool IsChecked(HWND hWnd, UINT id) +{ + // Validate arguments + if (hWnd == NULL) + { + return false; + } + + return IsDlgButtonChecked(hWnd, id) == BST_CHECKED ? true : false; +} + +// Check the radio button +void Check(HWND hWnd, UINT id, bool b) +{ + // Validate arguments + if (hWnd == NULL) + { + return; + } + + if ((!(!IsChecked(hWnd, id))) != (!(!b))) + { + CheckDlgButton(hWnd, id, b ? BST_CHECKED : BST_UNCHECKED); + } +} + +// Limit the number of characters that can be entered into the text-box +void LimitText(HWND hWnd, UINT id, UINT count) +{ + // Validate arguments + if (hWnd == NULL) + { + return; + } + + SendMsg(hWnd, id, EM_LIMITTEXT, count, 0); +} + +// Font settings +void SetFont(HWND hWnd, UINT id, HFONT hFont) +{ + SetFontEx(hWnd, id, hFont, false); +} +void SetFontEx(HWND hWnd, UINT id, HFONT hFont, bool no_adjust_font_size) +{ + // Validate arguments + if (hWnd == NULL || hFont == NULL) + { + return; + } + + SendMessage(DlgItem(hWnd, id), WM_SETFONT, (WPARAM)hFont, true); + + if (no_adjust_font_size == false) + { + AdjustFontSize(hWnd, id); + } +} + +// Calculate the font size +bool CalcFontSize(HFONT hFont, UINT *x, UINT *y) +{ + UINT xx = 0, yy = 0; + TEXTMETRIC tm; + SIZE sz; + bool ret = false; + HDC hDC; + + hDC = CreateCompatibleDC(NULL); + + SelectObject(hDC, hFont); + + Zero(&tm, sizeof(tm)); + Zero(&sz, sizeof(sz)); + + if (GetTextMetrics(hDC, &tm)) + { + xx = tm.tmAveCharWidth; + yy = tm.tmHeight; + + ret = true; + + if (GetTextExtentPoint32(hDC, + "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz", + 52, &sz)) + { + xx = (sz.cx / 26 + 1) / 2; + } + } + + if (x != NULL) + { + *x = xx; + } + + if (y != NULL) + { + *y = yy; + } + + DeleteDC(hDC); + + return ret; +} + +// Get the font magnification +double GetTextScalingFactor() +{ + static int cached_dpi = 0; + double ret = 1.0; + + if (MsIsVista() == false) + { + // It's always 1.0 in Windows XP or earlier + return 1.0; + } + + if (cached_dpi == 0) + { + HDC hDC = CreateCompatibleDC(NULL); + + if (hDC != NULL) + { + cached_dpi = GetDeviceCaps(hDC, LOGPIXELSY); + + DeleteDC(hDC); + } + } + + if (cached_dpi != 0) + { + ret = (double)cached_dpi / 96.0; + + if (ret < 0) + { + ret = -ret; + } + } + + return ret; +} + +// Get the parameters of the font that was created in the past +bool GetFontParam(HFONT hFont, struct FONT *f) +{ + bool ret = false; + // Validate arguments + if (hFont == NULL || f == NULL) + { + return false; + } + + // Search for the existing font + LockList(font_list); + { + UINT i; + + for (i = 0;i < LIST_NUM(font_list);i++) + { + FONT *n = LIST_DATA(font_list, i); + + if (n->hFont == hFont) + { + Copy(f, n, sizeof(FONT)); + + ret = true; + + break; + } + } + } + UnlockList(font_list); + + return ret; +} + +// Get the font +HFONT GetFont(char *name, UINT size, bool bold, bool italic, bool underline, bool strikeout) +{ + HFONT hFont; + HDC hDC; + // Validate arguments + if (name == NULL) + { + name = font_name; + } + if (size == 0) + { + size = font_size; + if (size == 0) + { + size = 9; + } + } + + // Search for the existing font + LockList(font_list); + { + FONT *f, t; + DWORD font_quality = ANTIALIASED_QUALITY; + OS_INFO *os = GetOsInfo(); + UINT x = 0; + UINT y = 0; + int rotate = 0; + UINT dpi; + + Zero(&t, sizeof(t)); + t.Bold = bold; + t.Italic = italic; + t.Size = size; + t.StrikeOut = strikeout; + t.UnderLine = underline; + t.Name = CopyStr(name); + f = Search(font_list, &t); + Free(t.Name); + + if (f != NULL) + { + // Font is found + UnlockList(font_list); + return f->hFont; + } + + // Create a new font + hDC = CreateCompatibleDC(NULL); + + // Specify the ClearType in Windows XP or later + if (OS_IS_WINDOWS_NT(os->OsType) && GET_KETA(os->OsType, 100) >= 3) + { + font_quality = CLEARTYPE_NATURAL_QUALITY; + rotate = 3600; + } + + if (MsIsVista()) + { + dpi = GetDeviceCaps(hDC, LOGPIXELSY); + } + else + { + dpi = 96; + } + + // Create a font + hFont = CreateFontA(-MulDiv(size, dpi, 72), + 0, rotate, rotate, (bold == false ? 500 : FW_BOLD), + italic, underline, strikeout, DEFAULT_CHARSET, OUT_DEFAULT_PRECIS, + CLIP_DEFAULT_PRECIS, font_quality, DEFAULT_PITCH, name); + + if (hFont == NULL) + { + // Failure + DeleteDC(hDC); + UnlockList(font_list); + + return NULL; + } + + CalcFontSize(hFont, &x, &y); + + // Add to the table + f = ZeroMalloc(sizeof(FONT)); + f->Bold = bold; + f->hFont = hFont; + f->Italic = italic; + f->Name = CopyStr(name); + f->Size = size; + f->StrikeOut = strikeout; + f->UnderLine = underline; + f->x = x; + f->y = y; + + Insert(font_list, f); + + DeleteDC(hDC); + } + UnlockList(font_list); + + return hFont; +} + +// Comparison of the font +int CompareFont(void *p1, void *p2) +{ + FONT *f1, *f2; + UINT r; + if (p1 == NULL || p2 == NULL) + { + return 0; + } + f1 = *(FONT **)p1; + f2 = *(FONT **)p2; + if (f1 == NULL || f2 == NULL) + { + return 0; + } + r = StrCmpi(f1->Name, f2->Name); + if (r != 0) + { + return r; + } + else + { + if (f1->Bold > f2->Bold) + { + return 1; + } + else if (f1->Bold < f2->Bold) + { + return -1; + } + else if (f1->Italic > f2->Italic) + { + return 1; + } + else if (f1->Italic < f2->Italic) + { + return -1; + } + else if (f1->Size > f2->Size) + { + return 1; + } + else if (f1->Size < f2->Size) + { + return -1; + } + else if (f1->StrikeOut > f2->StrikeOut) + { + return 1; + } + else if (f1->StrikeOut < f2->StrikeOut) + { + return -1; + } + else if (f1->UnderLine > f2->UnderLine) + { + return 1; + } + else if (f1->UnderLine < f2->UnderLine) + { + return -1; + } + else + { + return 0; + } + } +} + +// Initialize the font +void InitFont() +{ + if (font_list != NULL) + { + return; + } + font_list = NewList(CompareFont); +} + +// Release the font +void FreeFont() +{ + UINT i; + if (font_list == NULL) + { + return; + } + for (i = 0;i < LIST_NUM(font_list);i++) + { + FONT *f = LIST_DATA(font_list, i); + Free(f->Name); + DeleteObject((HGDIOBJ)f->hFont); + Free(f); + } + ReleaseList(font_list); + font_list = NULL; +} + +// Show a button to close the window +void EnableClose(HWND hWnd) +{ + HMENU h; + // Validate arguments + if (hWnd == NULL) + { + return; + } + + h = GetSystemMenu(hWnd, false); + EnableMenuItem(h, SC_CLOSE, MF_ENABLED); + DrawMenuBar(hWnd); +} + +// Hide the button to close the window +void DisableClose(HWND hWnd) +{ + HMENU h; + // Validate arguments + if (hWnd == NULL) + { + return; + } + + h = GetSystemMenu(hWnd, false); + EnableMenuItem(h, SC_CLOSE, MF_GRAYED); + DrawMenuBar(hWnd); +} + +// Move to the center of the parent window +void CenterParent(HWND hWnd) +{ + RECT rp; + RECT r; + HWND hWndParent = GetParent(hWnd); + int win_x, win_y; + int x, y; + + if (hWndParent == NULL || IsHide(hWndParent, 0) || IsIconic(hWndParent)) + { + Center(hWnd); + return; + } + + if (GetWindowRect(hWndParent, &rp) == false) + { + Center(hWnd); + return; + } + + GetWindowRect(hWnd, &r); + + win_x = r.right - r.left; + win_y = r.bottom - r.top; + + x = (rp.right - rp.left - win_x) / 2 + rp.left; + y = (rp.bottom - rp.top - win_y) / 2 + rp.top; + + x = MAX(x, 0); + y = MAX(y, 0); + + SetWindowPos(hWnd, NULL, x, y, 0, 0, SWP_NOSIZE | SWP_NOACTIVATE); +} + +// Move the window to the center +void Center(HWND hWnd) +{ + RECT screen; + RECT win; + UINT x, y; + UINT win_x, win_y; + // Validate arguments + if (hWnd == NULL) + { + return; + } + + if (SystemParametersInfo(SPI_GETWORKAREA, 0, &screen, 0) == false) + { + return; + } + + GetWindowRect(hWnd, &win); + win_x = win.right - win.left; + win_y = win.bottom - win.top; + + if (win_x < (UINT)(screen.right - screen.left)) + { + x = (screen.right - screen.left - win_x) / 2; + } + else + { + x = 0; + } + + if (win_y < (UINT)(screen.bottom - screen.top)) + { + y = (screen.bottom - screen.top - win_y) / 2; + } + else + { + y = 0; + } + + SetWindowPos(hWnd, NULL, x, y, 0, 0, SWP_NOSIZE | SWP_NOACTIVATE); +} + +// Format the string in the window +void FormatText(HWND hWnd, UINT id, ...) +{ + va_list args; + wchar_t *buf; + UINT size; + wchar_t *str; + // Validate arguments + if (hWnd == NULL) + { + return; + } + + str = GetText(hWnd, id); + if (str == NULL) + { + return; + } + + size = MAX(UniStrSize(str) * 10, MAX_SIZE * 10); + buf = MallocEx(size, true); + + va_start(args, id); + UniFormatArgs(buf, size, str, args); + + SetText(hWnd, id, buf); + + Free(buf); + + Free(str); + va_end(args); +} + +// Show the variable-length message box +UINT MsgBoxEx(HWND hWnd, UINT flag, wchar_t *msg, ...) +{ + va_list args; + wchar_t *buf; + UINT size; + UINT ret; + // Validate arguments + if (msg == NULL) + { + msg = L"MessageBox"; + } + + size = MAX(UniStrSize(msg) * 10, MAX_SIZE * 10); + buf = MallocEx(size, true); + + va_start(args, msg); + UniFormatArgs(buf, size, msg, args); + + ret = MsgBox(hWnd, flag, buf); + Free(buf); + va_end(args); + + return ret; +} + +// Show the message box +UINT MsgBox(HWND hWnd, UINT flag, wchar_t *msg) +{ + UINT ret; + wchar_t *title; + // Validate arguments + if (msg == NULL) + { + msg = L"MessageBox"; + } + + if (title_bar != NULL) + { + title = CopyUniStr(title_bar); + } + else + { + title = CopyStrToUni(CEDAR_PRODUCT_STR); + } + + if (hWnd) + { + // Raise the message box to top-level if the parent window is the top-level window + if (GetExStyle(hWnd, 0) & WS_EX_TOPMOST) + { + flag |= MB_SYSTEMMODAL; + } + } + + ret = MessageBoxW(hWnd, msg, title, flag); + + Free(title); + + return ret; +} + +// Create a dialog (internal) +UINT DialogInternal(HWND hWnd, UINT id, DIALOG_PROC *proc, void *param) +{ + // Validate arguments + if (proc == NULL) + { + return 0; + } + + if (MsIsNt() == false) + { + // Win9x + return (UINT)DialogBoxParam(hDll, MAKEINTRESOURCE(id), hWnd, (DLGPROC)proc, (LPARAM)param); + } + else + { + // WinNT + return (UINT)DialogBoxParamW(hDll, MAKEINTRESOURCEW(id), hWnd, (DLGPROC)proc, (LPARAM)param); + } +} + +// Dialog box procedure managed by WinUi +UINT DlgProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, bool white_color) +{ + void *param; + HWND hWndParent; + // Validate arguments + if (hWnd == NULL) + { + return 0; + } + + switch (msg) + { + case WM_INITDIALOG: + if (true) + { + RECT rect1; + + SetRect(&rect1, 0, 0, 100, 100); + MapDialogRect(hWnd, &rect1); + Debug("%u %u %u %u\n", rect1.left, rect1.right, rect1.top, rect1.bottom); + } + + param = (void *)lParam; + SetParam(hWnd, param); + + // Examine whether the parent window exists + hWndParent = GetParent(hWnd); + if (hWndParent == NULL || IsShow(hWndParent, 0) == false) + { + // Place in the center if parent does not exist + Center(hWnd); + } + + if (UseAlpha) + { + UINT os_type = GetOsInfo()->OsType; + if (OS_IS_WINDOWS_NT(os_type) && GET_KETA(os_type, 100) >= 2) + { + bool (WINAPI *_SetLayeredWindowAttributes)(HWND, COLORREF, BYTE, DWORD); + HINSTANCE hInst; + + hInst = LoadLibrary("user32.dll"); + _SetLayeredWindowAttributes = + (bool (__stdcall *)(HWND,COLORREF,BYTE,DWORD)) + GetProcAddress(hInst, "SetLayeredWindowAttributes"); + + if (_SetLayeredWindowAttributes != NULL) + { + // Only available on Windows 2000 or later + SetExStyle(hWnd, 0, WS_EX_LAYERED); + _SetLayeredWindowAttributes(hWnd, 0, AlphaValue * 255 / 100, LWA_ALPHA); + } + } + } + + break; + + case WM_CTLCOLORBTN: + case WM_CTLCOLORDLG: + case WM_CTLCOLOREDIT: + case WM_CTLCOLORLISTBOX: + case WM_CTLCOLORMSGBOX: + case WM_CTLCOLORSCROLLBAR: + case WM_CTLCOLORSTATIC: + if (white_color) + { + return (UINT)GetStockObject(WHITE_BRUSH); + } + break; + } + + return 0; +} + +// Set the parameters of the dialog box +void SetParam(HWND hWnd, void *param) +{ + // Validate arguments + if (hWnd == NULL) + { + return; + } + + SetWindowLongPtr(hWnd, DWLP_USER, (LONG_PTR)param); +} + +// Get the parameters of the dialog box +void *GetParam(HWND hWnd) +{ + void *ret; + // Validate arguments + if (hWnd == NULL) + { + return NULL; + } + + ret = (void *)GetWindowLongPtr(hWnd, DWLP_USER); + return ret; +} + +// Show the windows as foreground +void Top(HWND hWnd) +{ + // Validate arguments + if (hWnd == NULL) + { + return; + } + + SetWindowPos(hWnd, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE); +} + +// Hide the window +void Hide(HWND hWnd, UINT id) +{ + // Validate arguments + if (hWnd == NULL) + { + return; + } + + if (IsShow(hWnd, id)) + { + ShowWindow(DlgItem(hWnd, id), SW_HIDE); + } +} + +// Show the window +void Show(HWND hWnd, UINT id) +{ + // Validate arguments + if (hWnd == NULL) + { + return; + } + + if (IsHide(hWnd, id)) + { + ShowWindow(DlgItem(hWnd, id), SW_SHOW); + } +} + +// Change the display settings +void SetShow(HWND hWnd, UINT id, bool b) +{ + // Validate arguments + if (hWnd == NULL) + { + return; + } + + if (b) + { + Show(hWnd, id); + } + else + { + Hide(hWnd, id); + } +} + +// Get whether the window is shown +bool IsShow(HWND hWnd, UINT id) +{ + return IsHide(hWnd, id) ? false : true; +} + +// Get whether the window is hidden +bool IsHide(HWND hWnd, UINT id) +{ + // Validate arguments + if (hWnd == NULL) + { + return true; + } + + if (GetStyle(hWnd, id) & WS_VISIBLE) + { + return false; + } + else + { + return true; + } +} + +// Remove the window style +void RemoveExStyle(HWND hWnd, UINT id, UINT style) +{ + UINT old; + // Validate arguments + if (hWnd == NULL) + { + return; + } + + old = GetExStyle(hWnd, id); + if ((old & style) == 0) + { + return; + } + + SetWindowLong(DlgItem(hWnd, id), GWL_EXSTYLE, old & ~style); + Refresh(DlgItem(hWnd, id)); +} + +// Set the window style +void SetExStyle(HWND hWnd, UINT id, UINT style) +{ + UINT old; + // Validate arguments + if (hWnd == NULL) + { + return; + } + + old = GetExStyle(hWnd, id); + if (old & style) + { + return; + } + + SetWindowLong(DlgItem(hWnd, id), GWL_EXSTYLE, old | style); + Refresh(DlgItem(hWnd, id)); +} + +// Get the window style +UINT GetExStyle(HWND hWnd, UINT id) +{ + // Validate arguments + if (hWnd == NULL) + { + return 0; + } + + return GetWindowLong(DlgItem(hWnd, id), GWL_EXSTYLE); +} + +// Remove the window style +void RemoveStyle(HWND hWnd, UINT id, UINT style) +{ + UINT old; + // Validate arguments + if (hWnd == NULL) + { + return; + } + + old = GetStyle(hWnd, id); + if ((old & style) == 0) + { + return; + } + + SetWindowLong(DlgItem(hWnd, id), GWL_STYLE, old & ~style); + Refresh(DlgItem(hWnd, id)); +} + +// Set the window style +void SetStyle(HWND hWnd, UINT id, UINT style) +{ + UINT old; + // Validate arguments + if (hWnd == NULL) + { + return; + } + + old = GetStyle(hWnd, id); + if (old & style) + { + return; + } + + SetWindowLong(DlgItem(hWnd, id), GWL_STYLE, old | style); + Refresh(DlgItem(hWnd, id)); +} + +// Get the window style +UINT GetStyle(HWND hWnd, UINT id) +{ + // Validate arguments + if (hWnd == NULL) + { + return 0; + } + + return GetWindowLong(DlgItem(hWnd, id), GWL_STYLE); +} + +// Get the number of characters in the text +UINT GetTextLen(HWND hWnd, UINT id, bool unicode) +{ + wchar_t *s; + UINT ret; + // Validate arguments + if (hWnd == NULL) + { + return 0; + } + + s = GetText(hWnd, id); + if (s == NULL) + { + return 0; + } + + if (unicode) + { + ret = UniStrLen(s); + } + else + { + char *tmp = CopyUniToStr(s); + ret = StrLen(tmp); + Free(tmp); + } + + Free(s); + + return ret; +} + +// Check whether the text is blank +bool IsEmpty(HWND hWnd, UINT id) +{ + bool ret; + wchar_t *s; + // Validate arguments + if (hWnd == NULL) + { + return true; + } + + s = GetText(hWnd, id); + + UniTrim(s); + if (UniStrLen(s) == 0) + { + ret = true; + } + else + { + ret = false; + } + + Free(s); + + return ret; +} + +// Get the window class +wchar_t *GetClass(HWND hWnd, UINT id) +{ + wchar_t tmp[MAX_SIZE]; + + if (MsIsNt() == false) + { + wchar_t *ret; + char *s; + s = GetClassA(hWnd, id); + ret = CopyStrToUni(s); + Free(s); + return ret; + } + + // Validate arguments + if (hWnd == NULL) + { + return CopyUniStr(L""); + } + + GetClassNameW(DlgItem(hWnd, id), tmp, sizeof(tmp)); + + return UniCopyStr(tmp); +} +char *GetClassA(HWND hWnd, UINT id) +{ + char tmp[MAX_SIZE]; + // Validate arguments + if (hWnd == NULL) + { + return CopyStr(""); + } + + GetClassName(DlgItem(hWnd, id), tmp, sizeof(tmp)); + + return CopyStr(tmp); +} + +// Transmit a message to the control +UINT SendMsg(HWND hWnd, UINT id, UINT msg, WPARAM wParam, LPARAM lParam) +{ + // Validate arguments + if (hWnd == NULL) + { + return 0; + } + + if (MsIsNt()) + { + return (UINT)SendMessageW(DlgItem(hWnd, id), msg, wParam, lParam); + } + else + { + return (UINT)SendMessageA(DlgItem(hWnd, id), msg, wParam, lParam); + } +} + +// Move the cursor to the right edge of the text in the EDIT +void SetCursorOnRight(HWND hWnd, UINT id) +{ + wchar_t *class_name; + // Validate arguments + if (hWnd == NULL) + { + return; + } + + class_name = GetClass(hWnd, id); + + if (class_name != NULL) + { + if (UniStrCmpi(class_name, L"edit") == 0) + { + wchar_t *str = GetText(hWnd, id); + + if (str != NULL) + { + UINT len = UniStrLen(str); + + SendMsg(hWnd, id, EM_SETSEL, len, len); + + Free(str); + } + } + Free(class_name); + } +} + +// Select entire the text in the EDIT +void SelectEdit(HWND hWnd, UINT id) +{ + wchar_t *class_name; + + // Validate arguments + if (hWnd == NULL) + { + return; + } + + class_name = GetClass(hWnd, id); + + if (class_name != NULL) + { + if (UniStrCmpi(class_name, L"edit") == 0) + { + SendMsg(hWnd, id, EM_SETSEL, 0, -1); + } + Free(class_name); + } +} + +// Deselect the text of EDIT +void UnselectEdit(HWND hWnd, UINT id) +{ + wchar_t *class_name; + + // Validate arguments + if (hWnd == NULL) + { + return; + } + + class_name = GetClass(hWnd, id); + + if (class_name != NULL) + { + if (UniStrCmpi(class_name, L"edit") == 0) + { + SendMsg(hWnd, id, EM_SETSEL, -1, 0); + } + Free(class_name); + } +} + +// Select all by setting the focus to the EDIT +void FocusEx(HWND hWnd, UINT id) +{ + // Validate arguments + if (hWnd == NULL) + { + return; + } + + if (IsEnable(hWnd, id) == false || IsShow(hWnd, id) == false) + { + return; + } + + SelectEdit(hWnd, id); + + Focus(hWnd, id); +} + +// Get whether the specified window has focus +bool IsFocus(HWND hWnd, UINT id) +{ + // Validate arguments + if (hWnd == NULL) + { + return false; + } + + if (GetFocus() == DlgItem(hWnd, id)) + { + return true; + } + + return false; +} + +// Set the focus +void Focus(HWND hWnd, UINT id) +{ + // Validate arguments + if (hWnd == NULL) + { + return; + } + + if (IsEnable(hWnd, id) == false || IsShow(hWnd, id) == false) + { + return; + } + + SetFocus(DlgItem(hWnd, id)); +} + +// Set the value of the int type +void SetInt(HWND hWnd, UINT id, UINT value) +{ + wchar_t tmp[MAX_SIZE]; + // Validate arguments + if (hWnd == NULL) + { + return; + } + + UniToStru(tmp, value); + SetText(hWnd, id, tmp); +} +void SetIntEx(HWND hWnd, UINT id, UINT value) +{ + // Validate arguments + if (hWnd == NULL) + { + return; + } + + if (value == 0) + { + // Leave blank in the case of 0 + SetText(hWnd, id, L""); + } + else + { + SetInt(hWnd, id, value); + } +} + +// Get the value of the int type +UINT GetInt(HWND hWnd, UINT id) +{ + wchar_t *s; + UINT ret; + // Validate arguments + if (hWnd == NULL) + { + return 0; + } + + s = GetText(hWnd, id); + if (s == NULL) + { + return 0; + } + + ret = UniToInt(s); + Free(s); + + return ret; +} + +// Update the window appearance +void Refresh(HWND hWnd) +{ + HWND parent; + // Validate arguments + if (hWnd == NULL) + { + return; + } + + DoEvents(hWnd); + UpdateWindow(hWnd); + DoEvents(hWnd); + + parent = GetParent(hWnd); + if (parent != NULL) + { + Refresh(parent); + } +} + +// Handle the event +void DoEvents(HWND hWnd) +{ + MSG msg; + + if (PeekMessage(&msg, hWnd, 0, 0, PM_REMOVE)) + { + TranslateMessage(&msg); + DispatchMessage(&msg); + } + UpdateWindow(hWnd); + + if (hWnd) + { + DoEvents(NULL); + } +} + +// Close the window +void Close(HWND hWnd) +{ + // Validate arguments + if (hWnd == NULL) + { + return; + } + + SendMessage(hWnd, WM_CLOSE, 0, 0); +} + +// Disable the window +void Disable(HWND hWnd, UINT id) +{ + SetEnable(hWnd, id, false); +} + +// Enable the window +void Enable(HWND hWnd, UINT id) +{ + SetEnable(hWnd, id, true); +} + +// Set the enabled state of a window +void SetEnable(HWND hWnd, UINT id, bool b) +{ + // Validate arguments + if (hWnd == NULL) + { + return; + } + + if (b == false) + { + if (IsEnable(hWnd, id)) + { + if (id != 0 && IsFocus(hWnd, id)) + { + Focus(hWnd, IDCANCEL); + Focus(hWnd, IDOK); + } + EnableWindow(DlgItem(hWnd, id), false); + Refresh(DlgItem(hWnd, id)); + } + } + else + { + if (IsDisable(hWnd, id)) + { + EnableWindow(DlgItem(hWnd, id), true); + Refresh(DlgItem(hWnd, id)); + } + } +} + +// Examine whether the window is disabled +bool IsDisable(HWND hWnd, UINT id) +{ + return IsEnable(hWnd, id) ? false : true; +} + +// Examine whether the window is enabled +bool IsEnable(HWND hWnd, UINT id) +{ + // Validate arguments + if (hWnd == NULL) + { + return false; + } + + return IsWindowEnabled(DlgItem(hWnd, id)); +} + +// If the control protrude by large font size, adjust into appropriate size +void AdjustFontSize(HWND hWnd, UINT id) +{ + char class_name[MAX_PATH]; + UINT style; + UINT format = 0; + HFONT current_font; + FONT font; + wchar_t *text; + RECT rect; + UINT width, height; + HFONT new_font = NULL; + UINT old_font_size; + UINT style1; + // Validate arguments + if (hWnd == NULL) + { + return; + } + + hWnd = DlgItem(hWnd, id); + + if (GetClassNameA(hWnd, class_name, sizeof(class_name)) == 0) + { + return; + } + + if (StrCmpi(class_name, "static") != 0) + { + return; + } + + style = GetStyle(hWnd, 0); + + if ((style & SS_ENDELLIPSIS) || (style & SS_PATHELLIPSIS)) + { + return; + } + + style1 = style & 0x0F; + + // Create a format for DrawText + if (style1 == SS_RIGHT) + { + // Right justification + format |= DT_RIGHT; + } + else if (style1 == SS_CENTER) + { + // Center justification + format |= DT_CENTER; + } + else if (style1 == SS_LEFT) + { + // Left justification + format |= DT_LEFT; + } + else + { + // Others + return; + } + + if (style & DT_NOPREFIX) + { + // Without prefix + format |= DT_NOPREFIX; + } + + // Get the font parameters currently set + current_font = (HFONT)SendMessageA(hWnd, WM_GETFONT, 0, 0); + if (current_font == NULL) + { + return; + } + + Zero(&font, sizeof(font)); + if (GetFontParam(current_font, &font) == false) + { + return; + } + + // Get the size of the static area + Zero(&rect, sizeof(rect)); + if (GetWindowRect(hWnd, &rect) == false) + { + return; + } + + // Get the text that is currently set + text = GetText(hWnd, 0); + if (text == NULL) + { + return; + } + + if (IsEmptyUniStr(text)) + { + Free(text); + return; + } + + width = GET_ABS(rect.right - rect.left); + height = GET_ABS(rect.bottom - rect.top); + + new_font = NULL; + old_font_size = font.Size; + + // Try to gradually reduce the font size until drawing succeeds + while (font.Size != 0) + { + // Drawing test + bool aborted = false; + + if (IsFontFitInRect(&font, width, height, text, format, &aborted)) + { + // Drawing success + if (old_font_size != font.Size) + { + // Font size is changed + new_font = GetFont(font.Name, font.Size, font.Bold, font.Italic, font.UnderLine, font.StrikeOut); + } + break; + } + else + { + if (aborted) + { + // Fatal error + break; + } + } + + font.Size--; + + if (font.Size == 1) + { + // Not supposed to become a font size like this. Fatal error + break; + } + } + + Free(text); + + if (new_font != NULL) + { + // Change the font size + SetFontEx(hWnd, 0, new_font, true); + } +} + +// Check whether the specified string can be drawn in the specified area with the specified font +bool IsFontFitInRect(struct FONT *f, UINT width, UINT height, wchar_t *text, UINT format, bool *aborted) +{ + RECT r; + int i; + bool dummy_bool; + UINT new_height; + HFONT hCreatedFont, hOldFont; + // Validate arguments + if (f == NULL || text == NULL) + { + return false; + } + if (aborted == NULL) + { + aborted = &dummy_bool; + } + + format |= DT_CALCRECT | DT_WORDBREAK; + + *aborted = false; + + // Create a font + hCreatedFont = GetFont(f->Name, f->Size, f->Bold, f->Italic, f->UnderLine, f->StrikeOut); + if (hCreatedFont == NULL) + { + *aborted = true; + return false; + } + + Lock(lock_common_dc); + { + hOldFont = SelectObject(hCommonDC, hCreatedFont); + + Zero(&r, sizeof(r)); + r.left = r.top = 0; + r.right = width; + r.bottom = height; + + if (MsIsNt()) + { + i = DrawTextW(hCommonDC, text, -1, &r, format); + } + else + { + char *a = CopyUniToStr(text); + + i = DrawTextA(hCommonDC, a, -1, &r, format); + + Free(a); + } + + SelectObject(hCommonDC, hOldFont); + } + Unlock(lock_common_dc); + + if (i == 0) + { + *aborted = true; + return false; + } + + new_height = GET_ABS(r.bottom - r.top); + + if (new_height > height) + { + return false; + } + + return true; +} + +// Set a text string +void SetText(HWND hWnd, UINT id, wchar_t *str) +{ + // Validate arguments + if (hWnd == NULL || str == NULL) + { + return; + } + + SetTextInner(hWnd, id, str); +} +void SetTextInner(HWND hWnd, UINT id, wchar_t *str) +{ + wchar_t *old; + // Validate arguments + if (hWnd == NULL || str == NULL) + { + return; + } + + // Get the old string + old = GetText(hWnd, id); + if (UniStrCmp(str, old) == 0) + { + // Identity + Free(old); + return; + } + + Free(old); + + if (MsIsNt()) + { + SetWindowTextW(DlgItem(hWnd, id), str); + } + else + { + char *tmp = CopyUniToStr(str); + + if (MsIsNt() == false && StrLen(tmp) >= 32000) + { + // Truncate to less than 32k + tmp[32000] = 0; + } + + SetWindowTextA(DlgItem(hWnd, id), tmp); + Free(tmp); + } + + AdjustFontSize(hWnd, id); + + if (id != 0) + { + Refresh(DlgItem(hWnd, id)); + } +} +void SetTextA(HWND hWnd, UINT id, char *str) +{ + wchar_t *s; + // Validate arguments + if (hWnd == NULL || str == NULL) + { + return; + } + + s = CopyStrToUni(str); + if (s == NULL) + { + return; + } + + SetText(hWnd, id, s); + + Free(s); +} + +// Get the text string to the buffer +bool GetTxt(HWND hWnd, UINT id, wchar_t *str, UINT size) +{ + wchar_t *s; + // Validate arguments + if (hWnd == NULL || str == NULL) + { + return false; + } + + s = GetText(hWnd, id); + if (s == NULL) + { + UniStrCpy(str, size, L""); + return false; + } + + UniStrCpy(str, size, s); + Free(s); + + return true; +} +bool GetTxtA(HWND hWnd, UINT id, char *str, UINT size) +{ + char *s; + // Validate arguments + if (hWnd == NULL || str == NULL) + { + return false; + } + + s = GetTextA(hWnd, id); + if (s == NULL) + { + StrCpy(str, size, ""); + return false; + } + + StrCpy(str, size, s); + Free(s); + + return true; +} + +// Get the text string +wchar_t *GetText(HWND hWnd, UINT id) +{ + wchar_t *ret; + UINT size, len; + // Validate arguments + if (hWnd == NULL) + { + return NULL; + } + + if (MsIsNt() == false) + { + char *s = GetTextA(hWnd, id); + ret = CopyStrToUni(s); + Free(s); + + return ret; + } + + len = GetWindowTextLengthW(DlgItem(hWnd, id)); + if (len == 0) + { + return CopyUniStr(L""); + } + + size = (len + 1) * 2; + ret = ZeroMallocEx(size, true); + + GetWindowTextW(DlgItem(hWnd, id), ret, size); + + return ret; +} +char *GetTextA(HWND hWnd, UINT id) +{ + char *ret; + UINT size, len; + // Validate arguments + if (hWnd == NULL) + { + return NULL; + } + + len = GetWindowTextLengthA(DlgItem(hWnd, id)); + if (len == 0) + { + return CopyStr(""); + } + + size = len + 1; + ret = ZeroMallocEx(size, true); + + GetWindowTextA(DlgItem(hWnd, id), ret, size); + + return ret; +} + +// Get the item in the dialog +HWND DlgItem(HWND hWnd, UINT id) +{ + // Validate arguments + if (hWnd == NULL) + { + return NULL; + } + + if (id == 0) + { + return hWnd; + } + else + { + return GetDlgItem(hWnd, id); + } +} + +// Initialize the WinUi +void InitWinUi(wchar_t *software_name, char *font, UINT fontsize) +{ + if (tls_current_wizard == 0xffffffff) + { + tls_current_wizard = TlsAlloc(); + } + + if ((init_winui_counter++) != 0) + { + return; + } + + if (hDll != NULL) + { + return; + } + + if (MayaquaIsMinimalMode() == false) + { + if (Is64()) + { + hDll = MsLoadLibraryAsDataFile(PENCORE_DLL_NAME); + } + else + { + hDll = MsLoadLibrary(PENCORE_DLL_NAME); + } + + if (hDll == NULL) + { + Alert(PENCORE_DLL_NAME " not found. "CEDAR_PRODUCT_STR " VPN couldn't start.\r\n\r\n" + "Please reinstall all files with "CEDAR_PRODUCT_STR " VPN Installer.", + NULL); + exit(0); + } + } + else + { + hDll = LoadLibrary(MsGetExeFileName()); + + if (hDll == NULL) + { + Alert("MsLoadLibrary() Error.", + NULL); + exit(0); + } + } + + if (software_name != NULL) + { + title_bar = CopyUniStr(software_name); + } + else + { + title_bar = CopyUniStr(CEDAR_PRODUCT_STR_W L" VPN"); + } + + if (font != NULL) + { + font_name = CopyStr(font); + } + else + { + font_name = CopyStr(_SS("DEFAULT_FONT")); + } + + if (MsIsWindows7()) + { + char *win7_font = _SS("DEFAULT_FONT_WIN7"); + + if (IsEmptyStr(win7_font) == false) + { + Free(font_name); + font_name = CopyStr(win7_font); + } + + if (GetTextScalingFactor() >= 1.44) + { + // Use a substitute font in the case of high-DPI in Windows 7 and later + char *alternative_font = _SS("DEFAULT_FONT_HIGHDPI"); + + if (IsEmptyStr(alternative_font) == false) + { + Free(font_name); + font_name = CopyStr(alternative_font); + } + } + } + + if (fontsize != 0) + { + font_size = fontsize; + } + else + { + font_size = _II("DEFAULT_FONT_SIZE"); + if (font_size == 0) + { + font_size = 9; + } + } + + lock_common_dc = NewLock(); + + hCommonDC = CreateCompatibleDC(NULL); + + InitIconCache(); + + InitFont(); + + InitImageList(); +} + +// Release the WinUi +void FreeWinUi() +{ + if ((--init_winui_counter) != 0) + { + return; + } + + if (hDll == NULL) + { + return; + } + + FreeImageList(); + + FreeFont(); + + FreeIconCache(); + + FreeLibrary(hDll); + hDll = NULL; + + Free(title_bar); + title_bar = NULL; + + Free(font_name); + font_name = NULL; + + if (hCommonDC != NULL) + { + DeleteDC(hCommonDC); + hCommonDC = NULL; + } + + DeleteLock(lock_common_dc); + lock_common_dc = NULL; +} + +#endif // WIN32 diff --git a/src/Cedar/WinUi.h b/src/Cedar/WinUi.h index 801eb6b0..6ff9d1d4 100644 --- a/src/Cedar/WinUi.h +++ b/src/Cedar/WinUi.h @@ -1,779 +1,779 @@ -// SoftEther VPN Source Code - Developer Edition Master Branch -// Cedar Communication Module - - - -// WinUi.h -// User interface code for Win32 - -#ifdef OS_WIN32 - -#define WINUI_DEBUG_TEXT "@winui_debug.txt" - -#define LV_INSERT_RESET_ALL_ITEM_MIN 500 - -#define WINUI_PASSWORD_NULL_USERNAME "NULL" - -#define WINUI_DEFAULT_DIALOG_UNIT_X 7 -#define WINUI_DEFAULT_DIALOG_UNIT_Y 14 - -// Make available the types for Windows even if windows.h is not included -#ifndef _WINDEF_ -typedef void *HWND; -typedef void *HFONT; -typedef void *HICON; -typedef void *HMENU; -typedef void *HINSTANCE; - -#ifdef CPU_64 -typedef unsigned __int64 *WPARAM; -typedef __int64 *LPARAM; -#else -typedef unsigned int *WPARAM; -typedef long *LPARAM; -#endif // CPU_64 -#endif // _WINDEF_ - - -// Constants -#define FREE_REGKEY "Software\\" GC_REG_COMPANY_NAME "\\" CEDAR_PRODUCT_STR " VPN Client\\Free Edition Info" -#define ONCE_MSG_REGKEY "Software\\" GC_REG_COMPANY_NAME "\\" CEDAR_PRODUCT_STR " VPN\\Common" -#define ONCE_MSG_REGVALUE "HideMessage_%u" - -#define NICINFO_AUTOCLOSE_TIME_1 (20 * 1000) -#define NICINFO_AUTOCLOSE_TIME_2 1800 - -extern bool UseAlpha; -extern UINT AlphaValue; - - -// Minimum font size -#define WINUI_MIN_FONTSIZE 5 - - -// Macro -#define DIALOG DIALOGEX(false) -#define DIALOG_WHITE DIALOGEX(true) -#define DIALOGEX(white) \ - void *param = GetParam(hWnd); \ - { \ - UINT ret; \ - ret = DlgProc(hWnd, msg, wParam, lParam, white); \ - if (ret != 0) return ret; \ - } - -typedef UINT (__stdcall DIALOG_PROC)(HWND, UINT, WPARAM, LPARAM); - -typedef UINT (WINUI_DIALOG_PROC)(HWND, UINT, WPARAM, LPARAM, void *); - -typedef UINT (WINUI_WIZARD_PROC)(HWND, UINT, WPARAM, LPARAM, WIZARD *, WIZARD_PAGE *, void *); - - -// Special message to be used for this wizard -#define WM_WIZ_BASE (WM_APP + 201) -#define WM_WIZ_NEXT (WM_WIZ_BASE + 0) -#define WM_WIZ_BACK (WM_WIZ_BASE + 1) -#define WM_WIZ_CLOSE (WM_WIZ_BASE + 2) -#define WM_WIZ_SHOW (WM_WIZ_BASE + 3) -#define WM_WIZ_HIDE (WM_WIZ_BASE + 4) - - -// Secure operation contents -#define WINUI_SECURE_ENUM_OBJECTS 1 // Enumerate objects -#define WINUI_SECURE_WRITE_DATA 2 // Write the data -#define WINUI_SECURE_READ_DATA 3 // Read the data -#define WINUI_SECURE_WRITE_CERT 4 // Write the certificate -#define WINUI_SECURE_READ_CERT 5 // Read the certificate -#define WINUI_SECURE_WRITE_KEY 6 // Write the secret key -#define WINUI_SECURE_SIGN_WITH_KEY 7 // Signature by the private key -#define WINUI_SECURE_DELETE_OBJECT 8 // Delete the object -#define WINUI_SECURE_DELETE_CERT 9 // Delete the certificate -#define WINUI_SECURE_DELETE_KEY 10 // Delete the private key -#define WINUI_SECURE_DELETE_DATA 11 // Delete the Data - -// Secure operation structure -typedef struct WINUI_SECURE_BATCH -{ - UINT Type; // Type of operation - char *Name; // Name - bool Private; // Private mode - BUF *InputData; // Input data - BUF *OutputData; // Output data - X *InputX; // Input certificate - X *OutputX; // Output certificate - K *InputK; // Input secret key - LIST *EnumList; // Enumerated list - UCHAR OutputSign[4096 / 8]; // Output signature - bool Succeed; // Success flag -} WINUI_SECURE_BATCH; - -// Status window -typedef struct STATUS_WINDOW -{ - HWND hWnd; - THREAD *Thread; -} STATUS_WINDOW; - -// Batch processing items -typedef struct LVB_ITEM -{ - UINT NumStrings; // The number of strings - wchar_t **Strings; // String buffer - UINT Image; // Image number - void *Param; // Parameters -} LVB_ITEM; - -// LV insertion batch process -typedef struct LVB -{ - LIST *ItemList; // Item list -} LVB; - - -#ifdef CreateWindow - -// Internal code - -// Font -typedef struct FONT -{ - UINT Size; // Size - bool Bold; // Bold type - bool Italic; // Italic type - bool UnderLine; // Underline - bool StrikeOut; // Strike through - char *Name; // Font name - HFONT hFont; // Font - UINT x, y; // Font size -} FONT; - -// Font cache list -static LIST *font_list = NULL; - -// Dialog related -typedef struct DIALOG_PARAM -{ - bool white; - void *param; - WINUI_DIALOG_PROC *proc; - bool meiryo; - LIST *BitmapList; - - WIZARD *wizard; - WIZARD_PAGE *wizard_page; - WINUI_WIZARD_PROC *wizard_proc; -} DIALOG_PARAM; - -// Secure device window related -typedef struct SECURE_DEVICE_WINDOW -{ - WINUI_SECURE_BATCH *batch; - UINT num_batch; - UINT device_id; - struct SECURE_DEVICE_THREAD *p; - char *default_pin; - UINT BitmapId; -} SECURE_DEVICE_WINDOW; - -// Thread -typedef struct SECURE_DEVICE_THREAD -{ - SECURE_DEVICE_WINDOW *w; - HWND hWnd; - bool Succeed; - wchar_t *ErrorMessage; - char *pin; -} SECURE_DEVICE_THREAD; - -void StartSecureDevice(HWND hWnd, SECURE_DEVICE_WINDOW *w); - -// Passphrase -typedef struct PASSPHRASE_DLG -{ - char pass[MAX_SIZE]; - BUF *buf; - bool p12; -} PASSPHRASE_DLG; - -void PassphraseDlgProcCommand(HWND hWnd, PASSPHRASE_DLG *p); - -// Status window -typedef struct STATUS_WINDOW_PARAM -{ - HWND hWnd; - SOCK *Sock; - THREAD *Thread; - wchar_t AccountName[MAX_ACCOUNT_NAME_LEN + 1]; -} STATUS_WINDOW_PARAM; - -// Certificate display dialog -typedef struct CERT_DLG -{ - X *x, *issuer_x; - bool ManagerMode; -} CERT_DLG; - - -typedef struct IMAGELIST_ICON -{ - UINT id; - HICON hSmallImage; - HICON hLargeImage; - UINT Index; -} IMAGELIST_ICON; - -typedef struct SEARCH_WINDOW_PARAM -{ - wchar_t *caption; - HWND hWndFound; -} SEARCH_WINDOW_PARAM; - -// Remote connection screen setting -typedef struct WINUI_REMOTE -{ - bool flag1; - char *RegKeyName; // Registry key name - UINT Icon; // Icon - wchar_t *Caption; // Caption - wchar_t *Title; // Title - char *Hostname; // Host name - char *DefaultHostname; // Default host name - LIST *CandidateList; // Candidate list -} WINUI_REMOTE; - -void InitImageList(); -void FreeImageList(); -IMAGELIST_ICON *LoadIconForImageList(UINT id); -int CompareImageListIcon(void *p1, void *p2); -BOOL CALLBACK EnumResNameProc(HMODULE hModule, LPCTSTR lpszType, LPTSTR lpszName, LONG_PTR lParam); -void PrintCertInfo(HWND hWnd, CERT_DLG *p); -void CertDlgUpdate(HWND hWnd, CERT_DLG *p); -bool CALLBACK SearchWindowEnumProc(HWND hWnd, LPARAM lParam); -UINT RemoteDlgProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param); -void RemoteDlgInit(HWND hWnd, WINUI_REMOTE *r); -void RemoteDlgRefresh(HWND hWnd, WINUI_REMOTE *r); -void RemoteDlgOnOk(HWND hWnd, WINUI_REMOTE *r); -int CALLBACK LvSortProc(LPARAM param1, LPARAM param2, LPARAM sort_param); - -// Icon cache -typedef struct ICON_CACHE -{ - UINT id; - bool small_icon; - HICON hIcon; -} ICON_CACHE; - -static LIST *icon_cache_list = NULL; - -// Sort related -typedef struct WINUI_LV_SORT -{ - HWND hWnd; - UINT id; - UINT subitem; - bool desc; - bool numeric; -} WINUI_LV_SORT; - -// Version information -typedef struct WINUI_ABOUT -{ - CEDAR *Cedar; - wchar_t *ProductName; - UINT Bitmap; - WINUI_UPDATE *Update; -} WINUI_ABOUT; - -UINT AboutDlgProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param); -void AboutDlgInit(HWND hWnd, WINUI_ABOUT *a); - -typedef struct WIN9X_REBOOT_DLG -{ - UINT64 StartTime; - UINT TotalTime; -} WIN9X_REBOOT_DLG; - -#define LED_WIDTH 96 -#define LED_HEIGHT 16 -#define LED_FORCE_UPDATE 60000 - -// LED -struct LED -{ - HDC hDC; - HBITMAP hBM; - void *Buf; - UCHAR px[LED_WIDTH][LED_HEIGHT]; - bool Updated; - UINT64 LastUpdated; -}; - -void LedDrawString(LED *d, char *str, HFONT f); -void LedMainDraw(LED *d, HANDLE h); -void LedSpecial(LED *d, HANDLE h, UINT n); - - -// STRING -typedef struct STRING_DLG -{ - wchar_t String[MAX_SIZE]; - wchar_t *Title; - wchar_t *Info; - UINT Icon; - bool AllowEmpty; - bool AllowUnsafe; -} STRING_DLG; - -void StringDlgInit(HWND hWnd, STRING_DLG *s); -void StringDlgUpdate(HWND hWnd, STRING_DLG *s); - -// PIN code is cached for five minutes -#define WINUI_SECUREDEVICE_PIN_CACHE_TIME (5 * 60 * 1000) -extern char cached_pin_code[MAX_SIZE]; -extern UINT64 cached_pin_code_expires; - -// TCP connection dialog related -typedef struct WINCONNECT_DLG_DATA -{ - wchar_t *caption; - wchar_t *info; - UINT icon_id; - UINT timeout; - char *hostname; - UINT port; - bool cancel; - SOCK *ret_sock; - THREAD *thread; - HWND hWnd; - char nat_t_svc_name[MAX_SIZE]; - UINT nat_t_error_code; - bool try_start_ssl; -} WINCONNECT_DLG_DATA; - -HBITMAP ResizeBitmap(HBITMAP hSrc, UINT src_x, UINT src_y, UINT dst_x, UINT dst_y); - -#endif // WINUI_C - -// Kakushi -typedef struct KAKUSHI -{ - HWND hWnd; - THREAD *Thread; - volatile bool Halt; - UINT64 StartTick, Span; -} KAKUSHI; - -// The information screen about the free version -typedef struct FREEINFO -{ - char ServerName[MAX_SERVER_STR_LEN + 1]; - HWND hWnd; - THREAD *Thread; - EVENT *Event; -} FREEINFO; - -// Message -typedef struct ONCEMSG_DLG -{ - UINT Icon; - wchar_t *Title; - wchar_t *Message; - bool ShowCheckbox; - bool Checked; - UINT MessageHash; - bool *halt; -} ONCEMSG_DLG; - -// Definition of bad process -typedef struct BAD_PROCESS -{ - char *ExeName; - char *Title; -} BAD_PROCESS; - -#ifdef WINUI_C - -// Process name list of incompatible anti-virus software -static BAD_PROCESS bad_processes[] = -{ - {"nod32krn.exe", "NOD32 Antivirus",}, - {"avp.exe", "Kaspersky",}, -}; - -static UINT num_bad_processes = sizeof(bad_processes) / sizeof(bad_processes[0]); - -#endif // WINUI_C - -// Page in the wizard -struct WIZARD_PAGE -{ - UINT Id; - UINT Index; - WINUI_WIZARD_PROC *Proc; - wchar_t *Title; - WIZARD *Wizard; - - struct DIALOG_PARAM *DialogParam; - HWND hWndPage; - bool EnableNext; - bool EnableBack; - bool EnableClose; - bool IsFinish; -}; - -// Wizard -struct WIZARD -{ - UINT Icon; - HWND hWndParent; - LIST *Pages; - void *Param; - UINT Bitmap; - wchar_t *Caption; - wchar_t *CloseConfirmMsg; - bool IsAreoStyle; - - HWND hWndWizard; - bool SetCenterFlag; - bool ReplaceWindowProcFlag; - void *OriginalWindowProc; -}; - -// Update notification -struct WINUI_UPDATE -{ - wchar_t SoftwareTitle[MAX_SIZE]; - char SoftwareName[MAX_SIZE]; - UINT64 CurrentDate; - UINT CurrentBuild; - UINT CurrentVer; - char ClientId[128]; - char RegKey[MAX_PATH]; - UPDATE_CLIENT *UpdateClient; - bool UseSuppressFlag; - bool CurrentlyDisabled; -}; - -// Update notification parameters -struct WINUI_UPDATE_DLG_PARAM -{ - WINUI_UPDATE *Update; - UINT LatestBuild; - UINT64 LatestDate; - char *LatestVer; - char *Url; - volatile bool *halt_flag; - bool IsInConfigDialog; -}; - -// Registry key to save the update notification settings -#define WINUI_UPDATE_REGKEY "Software\\" GC_REG_COMPANY_NAME "\\" CEDAR_PRODUCT_STR " VPN\\Check Update\\%s" - - -// Function prototype -void InitWinUi(wchar_t *software_name, char *font, UINT fontsize); -void FreeWinUi(); - -WINUI_UPDATE *InitUpdateUi(wchar_t *title, char *name, char *family_name, UINT64 current_date, UINT current_build, UINT current_ver, char *client_id, bool use_suppress_flag); -void FreeUpdateUi(WINUI_UPDATE *u); -void DisableUpdateUi(WINUI_UPDATE *u); -void LoadUpdateUiSetting(WINUI_UPDATE *u, UPDATE_CLIENT_SETTING *s); -void SaveUpdateUiSetting(WINUI_UPDATE *u, UPDATE_CLIENT_SETTING *s); -void UpdateNotifyProcUi(UPDATE_CLIENT *c, UINT latest_build, UINT64 latest_date, char *latest_ver, char *url, volatile bool *halt_flag, void *param); -UINT UpdateNoticeDlgProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param); -bool ConfigUpdateUi(WINUI_UPDATE *u, HWND hWnd); -UINT UpdateConfigDlgProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param); - -bool IsThisProcessForeground(); -HWND DlgItem(HWND hWnd, UINT id); -void SetText(HWND hWnd, UINT id, wchar_t *str); -void SetTextInner(HWND hWnd, UINT id, wchar_t *str); -void SetTextA(HWND hWnd, UINT id, char *str); -wchar_t *GetText(HWND hWnd, UINT id); -char *GetTextA(HWND hWnd, UINT id); -bool GetTxt(HWND hWnd, UINT id, wchar_t *str, UINT size); -bool GetTxtA(HWND hWnd, UINT id, char *str, UINT size); -bool IsEnable(HWND hWnd, UINT id); -bool IsDisable(HWND hWnd, UINT id); -void Enable(HWND hWnd, UINT id); -void Disable(HWND hWnd, UINT id); -void SetEnable(HWND hWnd, UINT id, bool b); -void Close(HWND hWnd); -void DoEvents(HWND hWnd); -void Refresh(HWND hWnd); -UINT GetInt(HWND hWnd, UINT id); -void SetInt(HWND hWnd, UINT id, UINT value); -void SetIntEx(HWND hWnd, UINT id, UINT value); -void Focus(HWND hWnd, UINT id); -void FocusEx(HWND hWnd, UINT id); -bool IsFocus(HWND hWnd, UINT id); -wchar_t *GetClass(HWND hWnd, UINT id); -char *GetClassA(HWND hWnd, UINT id); -void SelectEdit(HWND hWnd, UINT id); -void SetCursorOnRight(HWND hWnd, UINT id); -void UnselectEdit(HWND hWnd, UINT id); -UINT SendMsg(HWND hWnd, UINT id, UINT msg, WPARAM wParam, LPARAM lParam); -bool IsEmpty(HWND hWnd, UINT id); -UINT GetTextLen(HWND hWnd, UINT id, bool unicode); -UINT GetStyle(HWND hWnd, UINT id); -void SetStyle(HWND hWnd, UINT id, UINT style); -void RemoveStyle(HWND hWnd, UINT id, UINT style); -UINT GetExStyle(HWND hWnd, UINT id); -void SetExStyle(HWND hWnd, UINT id, UINT style); -void RemoveExStyle(HWND hWnd, UINT id, UINT style); -void Hide(HWND hWnd, UINT id); -void Show(HWND hWnd, UINT id); -void SetShow(HWND hWnd, UINT id, bool b); -bool IsHide(HWND hWnd, UINT id); -bool IsShow(HWND hWnd, UINT id); -void Top(HWND hWnd); -void *GetParam(HWND hWnd); -void SetParam(HWND hWnd, void *param); -UINT DlgProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, bool white_color); -UINT DialogInternal(HWND hWnd, UINT id, DIALOG_PROC *proc, void *param); -UINT MsgBox(HWND hWnd, UINT flag, wchar_t *msg); -UINT MsgBoxEx(HWND hWnd, UINT flag, wchar_t *msg, ...); -void FormatText(HWND hWnd, UINT id, ...); -void Center(HWND hWnd); -void CenterParent(HWND hWnd); -void DisableClose(HWND hWnd); -void EnableClose(HWND hWnd); -void InitFont(); -void FreeFont(); -int CompareFont(void *p1, void *p2); -HFONT GetFont(char *name, UINT size, bool bold, bool italic, bool underline, bool strikeout); -double GetTextScalingFactor(); -bool CalcFontSize(HFONT hFont, UINT *x, UINT *y); -void SetFont(HWND hWnd, UINT id, HFONT hFont); -void SetFontEx(HWND hWnd, UINT id, HFONT hFont, bool no_adjust_font_size); -void LimitText(HWND hWnd, UINT id, UINT count); -void Check(HWND hWnd, UINT id, bool b); -bool IsChecked(HWND hWnd, UINT id); -void SetIcon(HWND hWnd, UINT id, UINT icon_id); -bool SecureDeviceWindow(HWND hWnd, WINUI_SECURE_BATCH *batch, UINT num_batch, UINT device_id, UINT bitmap_id); -UINT Dialog(HWND hWnd, UINT id, WINUI_DIALOG_PROC *proc, void *param); -UINT DialogEx(HWND hWnd, UINT id, WINUI_DIALOG_PROC *proc, void *param, bool white); -UINT DialogEx2(HWND hWnd, UINT id, WINUI_DIALOG_PROC *proc, void *param, bool white, bool meiryo); -UINT __stdcall InternalDialogProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam); -UINT SecureDeviceWindowProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param); -HFONT Font(UINT size, UINT bold); -void DlgFont(HWND hWnd, UINT id, UINT size, UINT bold); -void OpenAvi(HWND hWnd, UINT id, UINT avi_id); -void CloseAvi(HWND hWnd, UINT id); -void PlayAvi(HWND hWnd, UINT id, bool repeat); -void StopAvi(HWND hWnd, UINT id); -void EnableSecureDeviceWindowControls(HWND hWnd, bool enable); -void SecureDeviceThread(THREAD *t, void *param); -void Command(HWND hWnd, UINT id); -wchar_t *OpenDlg(HWND hWnd, wchar_t *filter, wchar_t *title); -char *OpenDlgA(HWND hWnd, char *filter, char *title); -wchar_t *SaveDlg(HWND hWnd, wchar_t *filter, wchar_t *title, wchar_t *default_name, wchar_t *default_ext); -char *SaveDlgA(HWND hWnd, char *filter, char *title, char *default_name, char *default_ext); -wchar_t *MakeFilter(wchar_t *str); -char *MakeFilterA(char *str); -bool PassphraseDlg(HWND hWnd, char *pass, UINT pass_size, BUF *buf, bool p12); -UINT PassphraseDlgProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param); -bool PasswordDlg(HWND hWnd, UI_PASSWORD_DLG *p); -void PasswordDlgOnOk(HWND hWnd, UI_PASSWORD_DLG *p); -UINT PasswordDlgProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param); -void PasswordDlgProcChange(HWND hWnd, UI_PASSWORD_DLG *p); -UINT CbAddStr(HWND hWnd, UINT id, wchar_t *str, UINT data); -UINT CbAddStrA(HWND hWnd, UINT id, char *str, UINT data); -UINT CbAddStr9xA(HWND hWnd, UINT id, char *str, UINT data); -void CbSelectIndex(HWND hWnd, UINT id, UINT index); -UINT CbNum(HWND hWnd, UINT id); -UINT CbFindStr(HWND hWnd, UINT id, wchar_t *str); -UINT CbFindStr9xA(HWND hWnd, UINT id, char *str); -wchar_t *CbGetStr(HWND hWnd, UINT id); -UINT CbFindData(HWND hWnd, UINT id, UINT data); -UINT CbGetData(HWND hWnd, UINT id, UINT index); -void CbSelect(HWND hWnd, UINT id, int data); -void CbReset(HWND hWnd, UINT id); -void CbSetHeight(HWND hWnd, UINT id, UINT value); -UINT CbGetSelectIndex(HWND hWnd, UINT id); -UINT CbGetSelect(HWND hWnd, UINT id); -void SetRange(HWND hWnd, UINT id, UINT start, UINT end); -void SetPos(HWND hWnd, UINT id, UINT pos); -void LbReset(HWND hWnd, UINT id); -STATUS_WINDOW *StatusPrinterWindowStart(SOCK *s, wchar_t *account_name); -void StatusPrinterWindowStop(STATUS_WINDOW *sw); -void StatusPrinterWindowPrint(STATUS_WINDOW *sw, wchar_t *str); -void StatusPrinterWindowThread(THREAD *thread, void *param); -UINT StatusPrinterWindowDlg(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param); -void CertDlg(HWND hWnd, X *x, X *issuer_x, bool manager); -UINT CertDlgProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param); -void LvInit(HWND hWnd, UINT id); -void LvInitEx(HWND hWnd, UINT id, bool no_image); -void LvInitEx2(HWND hWnd, UINT id, bool no_image, bool large_icon); -void LvReset(HWND hWnd, UINT id); -void LvInsertColumn(HWND hWnd, UINT id, UINT index, wchar_t *str, UINT width); -UINT GetIcon(UINT icon_id); -void LvInsert(HWND hWnd, UINT id, UINT icon, void *param, UINT num_str, ...); -UINT LvInsertItem(HWND hWnd, UINT id, UINT icon, void *param, wchar_t *str); -UINT LvInsertItemByImageListId(HWND hWnd, UINT id, UINT image, void *param, wchar_t *str); -UINT LvInsertItemByImageListIdA(HWND hWnd, UINT id, UINT image, void *param, char *str); -void LvSetItem(HWND hWnd, UINT id, UINT index, UINT pos, wchar_t *str); -void LvSetItemA(HWND hWnd, UINT id, UINT index, UINT pos, char *str); -void LvSetItemParam(HWND hWnd, UINT id, UINT index, void *param); -void LvSetItemImageByImageListId(HWND hWnd, UINT id, UINT index, UINT image); -void LvDeleteItem(HWND hWnd, UINT id, UINT index); -UINT LvNum(HWND hWnd, UINT id); -void *LvGetParam(HWND hWnd, UINT id, UINT index); -wchar_t *LvGetStr(HWND hWnd, UINT id, UINT index, UINT pos); -char *LvGetStrA(HWND hWnd, UINT id, UINT index, UINT pos); -UINT LvSearchParam(HWND hWnd, UINT id, void *param); -UINT LvSearchStr(HWND hWnd, UINT id, UINT pos, wchar_t *str); -UINT LvSearchStrA(HWND hWnd, UINT id, UINT pos, char *str); -UINT LvGetSelected(HWND hWnd, UINT id); -void *LvGetSelectedParam(HWND hWnd, UINT id); -UINT LvGetFocused(HWND hWnd, UINT id); -wchar_t *LvGetFocusedStr(HWND hWnd, UINT id, UINT pos); -wchar_t *LvGetSelectedStr(HWND hWnd, UINT id, UINT pos); -char *LvGetSelectedStrA(HWND hWnd, UINT id, UINT pos); -bool LvIsSelected(HWND hWnd, UINT id); -UINT LvGetNextMasked(HWND hWnd, UINT id, UINT start); -bool LvIsMasked(HWND hWnd, UINT id); -bool LvIsSingleSelected(HWND hWnd, UINT id); -bool LvIsMultiMasked(HWND hWnd, UINT id); -void LvAutoSize(HWND hWnd, UINT id); -void LvSelect(HWND hWnd, UINT id, UINT index); -void LvSelectByParam(HWND hWnd, UINT id, void *param); -void LvSelectAll(HWND hWnd, UINT id); -void LvSwitchSelect(HWND hWnd, UINT id); -void LvSetView(HWND hWnd, UINT id, bool details); -UINT LvGetColumnWidth(HWND hWnd, UINT id, UINT index); -void CheckCertDlg(UI_CHECKCERT *p); -UINT CheckCertDlgProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param); -void PrintCheckCertInfo(HWND hWnd, UI_CHECKCERT *p); -void ShowDlgDiffWarning(HWND hWnd, UI_CHECKCERT *p); -void CheckCertDialogOnOk(HWND hWnd, UI_CHECKCERT *p); -bool ConnectErrorDlg(UI_CONNECTERROR_DLG *p); -UINT ConnectErrorDlgProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param); -HINSTANCE GetUiDll(); -HICON LoadLargeIconInner(UINT id); -HICON LoadSmallIconInner(UINT id); -HICON LoadLargeIcon(UINT id); -HICON LoadSmallIcon(UINT id); -HICON LoadIconEx(UINT id, bool small_icon); -void InitIconCache(); -void FreeIconCache(); -LVB *LvInsertStart(); -void LvInsertAdd(LVB *b, UINT icon, void *param, UINT num_str, ...); -void LvInsertEnd(LVB *b, HWND hWnd, UINT id); -void LvInsertEndEx(LVB *b, HWND hWnd, UINT id, bool force_reset); -void LvSetStyle(HWND hWnd, UINT id, UINT style); -void LvRemoveStyle(HWND hWnd, UINT id, UINT style); -HMENU LoadSubMenu(UINT menu_id, UINT pos, HMENU *parent_menu); -UINT GetMenuItemPos(HMENU hMenu, UINT id); -void DeleteMenuItem(HMENU hMenu, UINT pos); -void SetMenuItemBold(HMENU hMenu, UINT pos, bool bold); -wchar_t *GetMenuStr(HMENU hMenu, UINT pos); -char *GetMenuStrA(HMENU hMenu, UINT pos); -void SetMenuStr(HMENU hMenu, UINT pos, wchar_t *str); -void SetMenuStrA(HMENU hMenu, UINT pos, char *str); -void RemoveShortcutKeyStrFromMenu(HMENU hMenu); -UINT GetMenuNum(HMENU hMenu); -void PrintMenu(HWND hWnd, HMENU hMenu); -void LvRename(HWND hWnd, UINT id, UINT pos); -void LvSetEnhanced(HWND hWnd, UINT id, bool enable); -void EditBoxSetEnhanced(HWND hWnd, UINT id, bool enable); -void AllowFGWindow(UINT process_id); -HWND SearchWindow(wchar_t *caption); -char *RemoteDlg(HWND hWnd, char *regkey, UINT icon, wchar_t *caption, wchar_t *title, char *default_host); -LIST *ReadCandidateFromReg(UINT root, char *key, char *name); -void WriteCandidateToReg(UINT root, char *key, LIST *o, char *name); -UINT LvGetColumnNum(HWND hWnd, UINT id); -void LvSetItemParamEx(HWND hWnd, UINT id, UINT index, UINT subitem, void *param); -void LvSortEx(HWND hWnd, UINT id, UINT subitem, bool desc, bool numeric); -void LvSort(HWND hWnd, UINT id, UINT subitem, bool desc); -void *LvGetParamEx(HWND hWnd, UINT id, UINT index, UINT subitem); -void LvSortHander(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, UINT id); -void LvStandardHandler(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, UINT id); -void IpSet(HWND hWnd, UINT id, UINT ip); -UINT IpGet(HWND hWnd, UINT id); -bool IpIsFilled(HWND hWnd, UINT id); -UINT IpGetFilledNum(HWND hWnd, UINT id); -void About(HWND hWnd, CEDAR *cedar, wchar_t *product_name); -void AboutEx(HWND hWnd, CEDAR *cedar, wchar_t *product_name, WINUI_UPDATE *u); -void Win9xReboot(HWND hWnd); -void Win9xRebootThread(THREAD *t, void *p); -UINT Win9xRebootDlgProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param); -wchar_t *StringDlg(HWND hWnd, wchar_t *title, wchar_t *info, wchar_t *def, UINT icon, bool allow_empty, bool allow_unsafe); -char *StringDlgA(HWND hWnd, wchar_t *title, wchar_t *info, char *def, UINT icon, bool allow_empty, bool allow_unsafe); -UINT StringDlgProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param); -void InitDialogInternational(HWND hWnd, void *pparam); -void AdjustWindowAndControlSize(HWND hWnd, bool *need_resize, double *factor_x, double *factor_y); -void AdjustDialogXY(UINT *x, UINT *y, UINT dlgfont_x, UINT dlgfont_y); -HFONT GetDialogDefaultFont(); -HFONT GetDialogDefaultFontEx(bool meiryo); -void InitMenuInternational(HMENU hMenu, char *prefix); -void InitMenuInternationalUni(HMENU hMenu, char *prefix); -void ShowTcpIpConfigUtil(HWND hWnd, bool util_mode); -void ShowCpu64Warning(); -UINT Cpu64DlgProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param); -UINT TcpIpDlgProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param); -void TcpIpDlgInit(HWND hWnd); -void TcpIpDlgUpdate(HWND hWnd); -UINT TcpMsgDlgProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param); -UINT KakushiDlgProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param); -void KakushiThread(THREAD *thread, void *param); -KAKUSHI *InitKakushi(); -void FreeKakushi(KAKUSHI *k); -void ShowEasterEgg(HWND hWnd); -bool Win32CnCheckAlreadyExists(bool lock); -void RegistWindowsFirewallAll(); -void RegistWindowsFirewallAllEx(char *dir); -void InitVistaWindowTheme(HWND hWnd); -void OnceMsg(HWND hWnd, wchar_t *title, wchar_t *message, bool show_checkbox, UINT icon); -void OnceMsgEx(HWND hWnd, wchar_t *title, wchar_t *message, bool show_checkbox, UINT icon, bool *halt); -UINT GetOnceMsgHash(wchar_t *title, wchar_t *message); -UINT OnceMsgProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param); -bool CheckBadProcesses(HWND hWnd); -BAD_PROCESS *IsBadProcess(char *exe); -void ShowBadProcessWarning(HWND hWnd, BAD_PROCESS *bad); -void SetFontMeiryo(HWND hWnd, UINT id, UINT font_size); -char *GetMeiryoFontName(); -void SetFontDefault(HWND hWnd, UINT id); -HFONT GetMeiryoFont(); -HFONT GetMeiryoFontEx(UINT font_size); -HFONT GetMeiryoFontEx2(UINT font_size, bool bold); -bool ShowWindowsNetworkConnectionDialog(); -SOCK *WinConnectEx3(HWND hWnd, char *server, UINT port, UINT timeout, UINT icon_id, wchar_t *caption, wchar_t *info, UINT *nat_t_error_code, char *nat_t_svc_name, bool try_start_ssl); -UINT WinConnectDlgProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param); -void WinConnectDlgThread(THREAD *thread, void *param); -void NicInfo(UI_NICINFO *info); -UINT NicInfoProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param); -void NicInfoInit(HWND hWnd, UI_NICINFO *info); -void NicInfoOnTimer(HWND hWnd, UI_NICINFO *info); -void NicInfoRefresh(HWND hWnd, UI_NICINFO *info); -void NicInfoShowStatus(HWND hWnd, UI_NICINFO *info, wchar_t *msg1, wchar_t *msg2, UINT icon, bool animate); -void NicInfoCloseAfterTime(HWND hWnd, UI_NICINFO *info, UINT tick); - -WIZARD *NewWizard(UINT icon, UINT bitmap, wchar_t *caption, void *param); -void FreeWizard(WIZARD *w); -WIZARD_PAGE *NewWizardPage(UINT id, WINUI_WIZARD_PROC *proc, wchar_t *title); -void FreeWizardPage(WIZARD_PAGE *p); -void AddWizardPage(WIZARD *w, WIZARD_PAGE *p); -WIZARD_PAGE *GetWizardPage(WIZARD *w, UINT id); -void *CreateWizardPageInstance(WIZARD *w, WIZARD_PAGE *p); -void ShowWizard(HWND hWndParent, WIZARD *w, UINT start_id); -void SetWizardButton(WIZARD_PAGE *p, bool enable_next, bool enable_back, bool enable_close, bool is_finish); -void SetWizardButtonEx(WIZARD_PAGE *p, bool enable_next, bool enable_back, bool enable_close, bool is_finish, bool shield_icon); -void JumpWizard(WIZARD_PAGE *p, UINT next_id); -void CloseWizard(WIZARD_PAGE *p); -void SetUacIcon(HWND hWnd, UINT id); - -LIST *NewBitmapList(); -void FreeBitmapList(LIST *o); - -bool GetBitmapSize(void *bmp, UINT *x, UINT *y); - -bool GetFontParam(HFONT hFont, struct FONT *f); -void AdjustFontSize(HWND hWnd, UINT id); -bool IsFontFitInRect(struct FONT *f, UINT width, UINT height, wchar_t *text, UINT format, bool *aborted); - -void ShowTextFile(HWND hWnd, char *filename, wchar_t *caption, UINT icon); - -#endif // OS_WIN32 - - +// SoftEther VPN Source Code - Developer Edition Master Branch +// Cedar Communication Module + + + +// WinUi.h +// User interface code for Win32 + +#ifdef OS_WIN32 + +#define WINUI_DEBUG_TEXT "@winui_debug.txt" + +#define LV_INSERT_RESET_ALL_ITEM_MIN 500 + +#define WINUI_PASSWORD_NULL_USERNAME "NULL" + +#define WINUI_DEFAULT_DIALOG_UNIT_X 7 +#define WINUI_DEFAULT_DIALOG_UNIT_Y 14 + +// Make available the types for Windows even if windows.h is not included +#ifndef _WINDEF_ +typedef void *HWND; +typedef void *HFONT; +typedef void *HICON; +typedef void *HMENU; +typedef void *HINSTANCE; + +#ifdef CPU_64 +typedef unsigned __int64 *WPARAM; +typedef __int64 *LPARAM; +#else +typedef unsigned int *WPARAM; +typedef long *LPARAM; +#endif // CPU_64 +#endif // _WINDEF_ + + +// Constants +#define FREE_REGKEY "Software\\" GC_REG_COMPANY_NAME "\\" CEDAR_PRODUCT_STR " VPN Client\\Free Edition Info" +#define ONCE_MSG_REGKEY "Software\\" GC_REG_COMPANY_NAME "\\" CEDAR_PRODUCT_STR " VPN\\Common" +#define ONCE_MSG_REGVALUE "HideMessage_%u" + +#define NICINFO_AUTOCLOSE_TIME_1 (20 * 1000) +#define NICINFO_AUTOCLOSE_TIME_2 1800 + +extern bool UseAlpha; +extern UINT AlphaValue; + + +// Minimum font size +#define WINUI_MIN_FONTSIZE 5 + + +// Macro +#define DIALOG DIALOGEX(false) +#define DIALOG_WHITE DIALOGEX(true) +#define DIALOGEX(white) \ + void *param = GetParam(hWnd); \ + { \ + UINT ret; \ + ret = DlgProc(hWnd, msg, wParam, lParam, white); \ + if (ret != 0) return ret; \ + } + +typedef UINT (__stdcall DIALOG_PROC)(HWND, UINT, WPARAM, LPARAM); + +typedef UINT (WINUI_DIALOG_PROC)(HWND, UINT, WPARAM, LPARAM, void *); + +typedef UINT (WINUI_WIZARD_PROC)(HWND, UINT, WPARAM, LPARAM, WIZARD *, WIZARD_PAGE *, void *); + + +// Special message to be used for this wizard +#define WM_WIZ_BASE (WM_APP + 201) +#define WM_WIZ_NEXT (WM_WIZ_BASE + 0) +#define WM_WIZ_BACK (WM_WIZ_BASE + 1) +#define WM_WIZ_CLOSE (WM_WIZ_BASE + 2) +#define WM_WIZ_SHOW (WM_WIZ_BASE + 3) +#define WM_WIZ_HIDE (WM_WIZ_BASE + 4) + + +// Secure operation contents +#define WINUI_SECURE_ENUM_OBJECTS 1 // Enumerate objects +#define WINUI_SECURE_WRITE_DATA 2 // Write the data +#define WINUI_SECURE_READ_DATA 3 // Read the data +#define WINUI_SECURE_WRITE_CERT 4 // Write the certificate +#define WINUI_SECURE_READ_CERT 5 // Read the certificate +#define WINUI_SECURE_WRITE_KEY 6 // Write the secret key +#define WINUI_SECURE_SIGN_WITH_KEY 7 // Signature by the private key +#define WINUI_SECURE_DELETE_OBJECT 8 // Delete the object +#define WINUI_SECURE_DELETE_CERT 9 // Delete the certificate +#define WINUI_SECURE_DELETE_KEY 10 // Delete the private key +#define WINUI_SECURE_DELETE_DATA 11 // Delete the Data + +// Secure operation structure +typedef struct WINUI_SECURE_BATCH +{ + UINT Type; // Type of operation + char *Name; // Name + bool Private; // Private mode + BUF *InputData; // Input data + BUF *OutputData; // Output data + X *InputX; // Input certificate + X *OutputX; // Output certificate + K *InputK; // Input secret key + LIST *EnumList; // Enumerated list + UCHAR OutputSign[4096 / 8]; // Output signature + bool Succeed; // Success flag +} WINUI_SECURE_BATCH; + +// Status window +typedef struct STATUS_WINDOW +{ + HWND hWnd; + THREAD *Thread; +} STATUS_WINDOW; + +// Batch processing items +typedef struct LVB_ITEM +{ + UINT NumStrings; // The number of strings + wchar_t **Strings; // String buffer + UINT Image; // Image number + void *Param; // Parameters +} LVB_ITEM; + +// LV insertion batch process +typedef struct LVB +{ + LIST *ItemList; // Item list +} LVB; + + +#ifdef CreateWindow + +// Internal code + +// Font +typedef struct FONT +{ + UINT Size; // Size + bool Bold; // Bold type + bool Italic; // Italic type + bool UnderLine; // Underline + bool StrikeOut; // Strike through + char *Name; // Font name + HFONT hFont; // Font + UINT x, y; // Font size +} FONT; + +// Font cache list +static LIST *font_list = NULL; + +// Dialog related +typedef struct DIALOG_PARAM +{ + bool white; + void *param; + WINUI_DIALOG_PROC *proc; + bool meiryo; + LIST *BitmapList; + + WIZARD *wizard; + WIZARD_PAGE *wizard_page; + WINUI_WIZARD_PROC *wizard_proc; +} DIALOG_PARAM; + +// Secure device window related +typedef struct SECURE_DEVICE_WINDOW +{ + WINUI_SECURE_BATCH *batch; + UINT num_batch; + UINT device_id; + struct SECURE_DEVICE_THREAD *p; + char *default_pin; + UINT BitmapId; +} SECURE_DEVICE_WINDOW; + +// Thread +typedef struct SECURE_DEVICE_THREAD +{ + SECURE_DEVICE_WINDOW *w; + HWND hWnd; + bool Succeed; + wchar_t *ErrorMessage; + char *pin; +} SECURE_DEVICE_THREAD; + +void StartSecureDevice(HWND hWnd, SECURE_DEVICE_WINDOW *w); + +// Passphrase +typedef struct PASSPHRASE_DLG +{ + char pass[MAX_SIZE]; + BUF *buf; + bool p12; +} PASSPHRASE_DLG; + +void PassphraseDlgProcCommand(HWND hWnd, PASSPHRASE_DLG *p); + +// Status window +typedef struct STATUS_WINDOW_PARAM +{ + HWND hWnd; + SOCK *Sock; + THREAD *Thread; + wchar_t AccountName[MAX_ACCOUNT_NAME_LEN + 1]; +} STATUS_WINDOW_PARAM; + +// Certificate display dialog +typedef struct CERT_DLG +{ + X *x, *issuer_x; + bool ManagerMode; +} CERT_DLG; + + +typedef struct IMAGELIST_ICON +{ + UINT id; + HICON hSmallImage; + HICON hLargeImage; + UINT Index; +} IMAGELIST_ICON; + +typedef struct SEARCH_WINDOW_PARAM +{ + wchar_t *caption; + HWND hWndFound; +} SEARCH_WINDOW_PARAM; + +// Remote connection screen setting +typedef struct WINUI_REMOTE +{ + bool flag1; + char *RegKeyName; // Registry key name + UINT Icon; // Icon + wchar_t *Caption; // Caption + wchar_t *Title; // Title + char *Hostname; // Host name + char *DefaultHostname; // Default host name + LIST *CandidateList; // Candidate list +} WINUI_REMOTE; + +void InitImageList(); +void FreeImageList(); +IMAGELIST_ICON *LoadIconForImageList(UINT id); +int CompareImageListIcon(void *p1, void *p2); +BOOL CALLBACK EnumResNameProc(HMODULE hModule, LPCTSTR lpszType, LPTSTR lpszName, LONG_PTR lParam); +void PrintCertInfo(HWND hWnd, CERT_DLG *p); +void CertDlgUpdate(HWND hWnd, CERT_DLG *p); +bool CALLBACK SearchWindowEnumProc(HWND hWnd, LPARAM lParam); +UINT RemoteDlgProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param); +void RemoteDlgInit(HWND hWnd, WINUI_REMOTE *r); +void RemoteDlgRefresh(HWND hWnd, WINUI_REMOTE *r); +void RemoteDlgOnOk(HWND hWnd, WINUI_REMOTE *r); +int CALLBACK LvSortProc(LPARAM param1, LPARAM param2, LPARAM sort_param); + +// Icon cache +typedef struct ICON_CACHE +{ + UINT id; + bool small_icon; + HICON hIcon; +} ICON_CACHE; + +static LIST *icon_cache_list = NULL; + +// Sort related +typedef struct WINUI_LV_SORT +{ + HWND hWnd; + UINT id; + UINT subitem; + bool desc; + bool numeric; +} WINUI_LV_SORT; + +// Version information +typedef struct WINUI_ABOUT +{ + CEDAR *Cedar; + wchar_t *ProductName; + UINT Bitmap; + WINUI_UPDATE *Update; +} WINUI_ABOUT; + +UINT AboutDlgProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param); +void AboutDlgInit(HWND hWnd, WINUI_ABOUT *a); + +typedef struct WIN9X_REBOOT_DLG +{ + UINT64 StartTime; + UINT TotalTime; +} WIN9X_REBOOT_DLG; + +#define LED_WIDTH 96 +#define LED_HEIGHT 16 +#define LED_FORCE_UPDATE 60000 + +// LED +struct LED +{ + HDC hDC; + HBITMAP hBM; + void *Buf; + UCHAR px[LED_WIDTH][LED_HEIGHT]; + bool Updated; + UINT64 LastUpdated; +}; + +void LedDrawString(LED *d, char *str, HFONT f); +void LedMainDraw(LED *d, HANDLE h); +void LedSpecial(LED *d, HANDLE h, UINT n); + + +// STRING +typedef struct STRING_DLG +{ + wchar_t String[MAX_SIZE]; + wchar_t *Title; + wchar_t *Info; + UINT Icon; + bool AllowEmpty; + bool AllowUnsafe; +} STRING_DLG; + +void StringDlgInit(HWND hWnd, STRING_DLG *s); +void StringDlgUpdate(HWND hWnd, STRING_DLG *s); + +// PIN code is cached for five minutes +#define WINUI_SECUREDEVICE_PIN_CACHE_TIME (5 * 60 * 1000) +extern char cached_pin_code[MAX_SIZE]; +extern UINT64 cached_pin_code_expires; + +// TCP connection dialog related +typedef struct WINCONNECT_DLG_DATA +{ + wchar_t *caption; + wchar_t *info; + UINT icon_id; + UINT timeout; + char *hostname; + UINT port; + bool cancel; + SOCK *ret_sock; + THREAD *thread; + HWND hWnd; + char nat_t_svc_name[MAX_SIZE]; + UINT nat_t_error_code; + bool try_start_ssl; +} WINCONNECT_DLG_DATA; + +HBITMAP ResizeBitmap(HBITMAP hSrc, UINT src_x, UINT src_y, UINT dst_x, UINT dst_y); + +#endif // WINUI_C + +// Kakushi +typedef struct KAKUSHI +{ + HWND hWnd; + THREAD *Thread; + volatile bool Halt; + UINT64 StartTick, Span; +} KAKUSHI; + +// The information screen about the free version +typedef struct FREEINFO +{ + char ServerName[MAX_SERVER_STR_LEN + 1]; + HWND hWnd; + THREAD *Thread; + EVENT *Event; +} FREEINFO; + +// Message +typedef struct ONCEMSG_DLG +{ + UINT Icon; + wchar_t *Title; + wchar_t *Message; + bool ShowCheckbox; + bool Checked; + UINT MessageHash; + bool *halt; +} ONCEMSG_DLG; + +// Definition of bad process +typedef struct BAD_PROCESS +{ + char *ExeName; + char *Title; +} BAD_PROCESS; + +#ifdef WINUI_C + +// Process name list of incompatible anti-virus software +static BAD_PROCESS bad_processes[] = +{ + {"nod32krn.exe", "NOD32 Antivirus",}, + {"avp.exe", "Kaspersky",}, +}; + +static UINT num_bad_processes = sizeof(bad_processes) / sizeof(bad_processes[0]); + +#endif // WINUI_C + +// Page in the wizard +struct WIZARD_PAGE +{ + UINT Id; + UINT Index; + WINUI_WIZARD_PROC *Proc; + wchar_t *Title; + WIZARD *Wizard; + + struct DIALOG_PARAM *DialogParam; + HWND hWndPage; + bool EnableNext; + bool EnableBack; + bool EnableClose; + bool IsFinish; +}; + +// Wizard +struct WIZARD +{ + UINT Icon; + HWND hWndParent; + LIST *Pages; + void *Param; + UINT Bitmap; + wchar_t *Caption; + wchar_t *CloseConfirmMsg; + bool IsAreoStyle; + + HWND hWndWizard; + bool SetCenterFlag; + bool ReplaceWindowProcFlag; + void *OriginalWindowProc; +}; + +// Update notification +struct WINUI_UPDATE +{ + wchar_t SoftwareTitle[MAX_SIZE]; + char SoftwareName[MAX_SIZE]; + UINT64 CurrentDate; + UINT CurrentBuild; + UINT CurrentVer; + char ClientId[128]; + char RegKey[MAX_PATH]; + UPDATE_CLIENT *UpdateClient; + bool UseSuppressFlag; + bool CurrentlyDisabled; +}; + +// Update notification parameters +struct WINUI_UPDATE_DLG_PARAM +{ + WINUI_UPDATE *Update; + UINT LatestBuild; + UINT64 LatestDate; + char *LatestVer; + char *Url; + volatile bool *halt_flag; + bool IsInConfigDialog; +}; + +// Registry key to save the update notification settings +#define WINUI_UPDATE_REGKEY "Software\\" GC_REG_COMPANY_NAME "\\" CEDAR_PRODUCT_STR " VPN\\Check Update\\%s" + + +// Function prototype +void InitWinUi(wchar_t *software_name, char *font, UINT fontsize); +void FreeWinUi(); + +WINUI_UPDATE *InitUpdateUi(wchar_t *title, char *name, char *family_name, UINT64 current_date, UINT current_build, UINT current_ver, char *client_id, bool use_suppress_flag); +void FreeUpdateUi(WINUI_UPDATE *u); +void DisableUpdateUi(WINUI_UPDATE *u); +void LoadUpdateUiSetting(WINUI_UPDATE *u, UPDATE_CLIENT_SETTING *s); +void SaveUpdateUiSetting(WINUI_UPDATE *u, UPDATE_CLIENT_SETTING *s); +void UpdateNotifyProcUi(UPDATE_CLIENT *c, UINT latest_build, UINT64 latest_date, char *latest_ver, char *url, volatile bool *halt_flag, void *param); +UINT UpdateNoticeDlgProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param); +bool ConfigUpdateUi(WINUI_UPDATE *u, HWND hWnd); +UINT UpdateConfigDlgProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param); + +bool IsThisProcessForeground(); +HWND DlgItem(HWND hWnd, UINT id); +void SetText(HWND hWnd, UINT id, wchar_t *str); +void SetTextInner(HWND hWnd, UINT id, wchar_t *str); +void SetTextA(HWND hWnd, UINT id, char *str); +wchar_t *GetText(HWND hWnd, UINT id); +char *GetTextA(HWND hWnd, UINT id); +bool GetTxt(HWND hWnd, UINT id, wchar_t *str, UINT size); +bool GetTxtA(HWND hWnd, UINT id, char *str, UINT size); +bool IsEnable(HWND hWnd, UINT id); +bool IsDisable(HWND hWnd, UINT id); +void Enable(HWND hWnd, UINT id); +void Disable(HWND hWnd, UINT id); +void SetEnable(HWND hWnd, UINT id, bool b); +void Close(HWND hWnd); +void DoEvents(HWND hWnd); +void Refresh(HWND hWnd); +UINT GetInt(HWND hWnd, UINT id); +void SetInt(HWND hWnd, UINT id, UINT value); +void SetIntEx(HWND hWnd, UINT id, UINT value); +void Focus(HWND hWnd, UINT id); +void FocusEx(HWND hWnd, UINT id); +bool IsFocus(HWND hWnd, UINT id); +wchar_t *GetClass(HWND hWnd, UINT id); +char *GetClassA(HWND hWnd, UINT id); +void SelectEdit(HWND hWnd, UINT id); +void SetCursorOnRight(HWND hWnd, UINT id); +void UnselectEdit(HWND hWnd, UINT id); +UINT SendMsg(HWND hWnd, UINT id, UINT msg, WPARAM wParam, LPARAM lParam); +bool IsEmpty(HWND hWnd, UINT id); +UINT GetTextLen(HWND hWnd, UINT id, bool unicode); +UINT GetStyle(HWND hWnd, UINT id); +void SetStyle(HWND hWnd, UINT id, UINT style); +void RemoveStyle(HWND hWnd, UINT id, UINT style); +UINT GetExStyle(HWND hWnd, UINT id); +void SetExStyle(HWND hWnd, UINT id, UINT style); +void RemoveExStyle(HWND hWnd, UINT id, UINT style); +void Hide(HWND hWnd, UINT id); +void Show(HWND hWnd, UINT id); +void SetShow(HWND hWnd, UINT id, bool b); +bool IsHide(HWND hWnd, UINT id); +bool IsShow(HWND hWnd, UINT id); +void Top(HWND hWnd); +void *GetParam(HWND hWnd); +void SetParam(HWND hWnd, void *param); +UINT DlgProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, bool white_color); +UINT DialogInternal(HWND hWnd, UINT id, DIALOG_PROC *proc, void *param); +UINT MsgBox(HWND hWnd, UINT flag, wchar_t *msg); +UINT MsgBoxEx(HWND hWnd, UINT flag, wchar_t *msg, ...); +void FormatText(HWND hWnd, UINT id, ...); +void Center(HWND hWnd); +void CenterParent(HWND hWnd); +void DisableClose(HWND hWnd); +void EnableClose(HWND hWnd); +void InitFont(); +void FreeFont(); +int CompareFont(void *p1, void *p2); +HFONT GetFont(char *name, UINT size, bool bold, bool italic, bool underline, bool strikeout); +double GetTextScalingFactor(); +bool CalcFontSize(HFONT hFont, UINT *x, UINT *y); +void SetFont(HWND hWnd, UINT id, HFONT hFont); +void SetFontEx(HWND hWnd, UINT id, HFONT hFont, bool no_adjust_font_size); +void LimitText(HWND hWnd, UINT id, UINT count); +void Check(HWND hWnd, UINT id, bool b); +bool IsChecked(HWND hWnd, UINT id); +void SetIcon(HWND hWnd, UINT id, UINT icon_id); +bool SecureDeviceWindow(HWND hWnd, WINUI_SECURE_BATCH *batch, UINT num_batch, UINT device_id, UINT bitmap_id); +UINT Dialog(HWND hWnd, UINT id, WINUI_DIALOG_PROC *proc, void *param); +UINT DialogEx(HWND hWnd, UINT id, WINUI_DIALOG_PROC *proc, void *param, bool white); +UINT DialogEx2(HWND hWnd, UINT id, WINUI_DIALOG_PROC *proc, void *param, bool white, bool meiryo); +UINT __stdcall InternalDialogProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam); +UINT SecureDeviceWindowProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param); +HFONT Font(UINT size, UINT bold); +void DlgFont(HWND hWnd, UINT id, UINT size, UINT bold); +void OpenAvi(HWND hWnd, UINT id, UINT avi_id); +void CloseAvi(HWND hWnd, UINT id); +void PlayAvi(HWND hWnd, UINT id, bool repeat); +void StopAvi(HWND hWnd, UINT id); +void EnableSecureDeviceWindowControls(HWND hWnd, bool enable); +void SecureDeviceThread(THREAD *t, void *param); +void Command(HWND hWnd, UINT id); +wchar_t *OpenDlg(HWND hWnd, wchar_t *filter, wchar_t *title); +char *OpenDlgA(HWND hWnd, char *filter, char *title); +wchar_t *SaveDlg(HWND hWnd, wchar_t *filter, wchar_t *title, wchar_t *default_name, wchar_t *default_ext); +char *SaveDlgA(HWND hWnd, char *filter, char *title, char *default_name, char *default_ext); +wchar_t *MakeFilter(wchar_t *str); +char *MakeFilterA(char *str); +bool PassphraseDlg(HWND hWnd, char *pass, UINT pass_size, BUF *buf, bool p12); +UINT PassphraseDlgProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param); +bool PasswordDlg(HWND hWnd, UI_PASSWORD_DLG *p); +void PasswordDlgOnOk(HWND hWnd, UI_PASSWORD_DLG *p); +UINT PasswordDlgProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param); +void PasswordDlgProcChange(HWND hWnd, UI_PASSWORD_DLG *p); +UINT CbAddStr(HWND hWnd, UINT id, wchar_t *str, UINT data); +UINT CbAddStrA(HWND hWnd, UINT id, char *str, UINT data); +UINT CbAddStr9xA(HWND hWnd, UINT id, char *str, UINT data); +void CbSelectIndex(HWND hWnd, UINT id, UINT index); +UINT CbNum(HWND hWnd, UINT id); +UINT CbFindStr(HWND hWnd, UINT id, wchar_t *str); +UINT CbFindStr9xA(HWND hWnd, UINT id, char *str); +wchar_t *CbGetStr(HWND hWnd, UINT id); +UINT CbFindData(HWND hWnd, UINT id, UINT data); +UINT CbGetData(HWND hWnd, UINT id, UINT index); +void CbSelect(HWND hWnd, UINT id, int data); +void CbReset(HWND hWnd, UINT id); +void CbSetHeight(HWND hWnd, UINT id, UINT value); +UINT CbGetSelectIndex(HWND hWnd, UINT id); +UINT CbGetSelect(HWND hWnd, UINT id); +void SetRange(HWND hWnd, UINT id, UINT start, UINT end); +void SetPos(HWND hWnd, UINT id, UINT pos); +void LbReset(HWND hWnd, UINT id); +STATUS_WINDOW *StatusPrinterWindowStart(SOCK *s, wchar_t *account_name); +void StatusPrinterWindowStop(STATUS_WINDOW *sw); +void StatusPrinterWindowPrint(STATUS_WINDOW *sw, wchar_t *str); +void StatusPrinterWindowThread(THREAD *thread, void *param); +UINT StatusPrinterWindowDlg(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param); +void CertDlg(HWND hWnd, X *x, X *issuer_x, bool manager); +UINT CertDlgProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param); +void LvInit(HWND hWnd, UINT id); +void LvInitEx(HWND hWnd, UINT id, bool no_image); +void LvInitEx2(HWND hWnd, UINT id, bool no_image, bool large_icon); +void LvReset(HWND hWnd, UINT id); +void LvInsertColumn(HWND hWnd, UINT id, UINT index, wchar_t *str, UINT width); +UINT GetIcon(UINT icon_id); +void LvInsert(HWND hWnd, UINT id, UINT icon, void *param, UINT num_str, ...); +UINT LvInsertItem(HWND hWnd, UINT id, UINT icon, void *param, wchar_t *str); +UINT LvInsertItemByImageListId(HWND hWnd, UINT id, UINT image, void *param, wchar_t *str); +UINT LvInsertItemByImageListIdA(HWND hWnd, UINT id, UINT image, void *param, char *str); +void LvSetItem(HWND hWnd, UINT id, UINT index, UINT pos, wchar_t *str); +void LvSetItemA(HWND hWnd, UINT id, UINT index, UINT pos, char *str); +void LvSetItemParam(HWND hWnd, UINT id, UINT index, void *param); +void LvSetItemImageByImageListId(HWND hWnd, UINT id, UINT index, UINT image); +void LvDeleteItem(HWND hWnd, UINT id, UINT index); +UINT LvNum(HWND hWnd, UINT id); +void *LvGetParam(HWND hWnd, UINT id, UINT index); +wchar_t *LvGetStr(HWND hWnd, UINT id, UINT index, UINT pos); +char *LvGetStrA(HWND hWnd, UINT id, UINT index, UINT pos); +UINT LvSearchParam(HWND hWnd, UINT id, void *param); +UINT LvSearchStr(HWND hWnd, UINT id, UINT pos, wchar_t *str); +UINT LvSearchStrA(HWND hWnd, UINT id, UINT pos, char *str); +UINT LvGetSelected(HWND hWnd, UINT id); +void *LvGetSelectedParam(HWND hWnd, UINT id); +UINT LvGetFocused(HWND hWnd, UINT id); +wchar_t *LvGetFocusedStr(HWND hWnd, UINT id, UINT pos); +wchar_t *LvGetSelectedStr(HWND hWnd, UINT id, UINT pos); +char *LvGetSelectedStrA(HWND hWnd, UINT id, UINT pos); +bool LvIsSelected(HWND hWnd, UINT id); +UINT LvGetNextMasked(HWND hWnd, UINT id, UINT start); +bool LvIsMasked(HWND hWnd, UINT id); +bool LvIsSingleSelected(HWND hWnd, UINT id); +bool LvIsMultiMasked(HWND hWnd, UINT id); +void LvAutoSize(HWND hWnd, UINT id); +void LvSelect(HWND hWnd, UINT id, UINT index); +void LvSelectByParam(HWND hWnd, UINT id, void *param); +void LvSelectAll(HWND hWnd, UINT id); +void LvSwitchSelect(HWND hWnd, UINT id); +void LvSetView(HWND hWnd, UINT id, bool details); +UINT LvGetColumnWidth(HWND hWnd, UINT id, UINT index); +void CheckCertDlg(UI_CHECKCERT *p); +UINT CheckCertDlgProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param); +void PrintCheckCertInfo(HWND hWnd, UI_CHECKCERT *p); +void ShowDlgDiffWarning(HWND hWnd, UI_CHECKCERT *p); +void CheckCertDialogOnOk(HWND hWnd, UI_CHECKCERT *p); +bool ConnectErrorDlg(UI_CONNECTERROR_DLG *p); +UINT ConnectErrorDlgProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param); +HINSTANCE GetUiDll(); +HICON LoadLargeIconInner(UINT id); +HICON LoadSmallIconInner(UINT id); +HICON LoadLargeIcon(UINT id); +HICON LoadSmallIcon(UINT id); +HICON LoadIconEx(UINT id, bool small_icon); +void InitIconCache(); +void FreeIconCache(); +LVB *LvInsertStart(); +void LvInsertAdd(LVB *b, UINT icon, void *param, UINT num_str, ...); +void LvInsertEnd(LVB *b, HWND hWnd, UINT id); +void LvInsertEndEx(LVB *b, HWND hWnd, UINT id, bool force_reset); +void LvSetStyle(HWND hWnd, UINT id, UINT style); +void LvRemoveStyle(HWND hWnd, UINT id, UINT style); +HMENU LoadSubMenu(UINT menu_id, UINT pos, HMENU *parent_menu); +UINT GetMenuItemPos(HMENU hMenu, UINT id); +void DeleteMenuItem(HMENU hMenu, UINT pos); +void SetMenuItemBold(HMENU hMenu, UINT pos, bool bold); +wchar_t *GetMenuStr(HMENU hMenu, UINT pos); +char *GetMenuStrA(HMENU hMenu, UINT pos); +void SetMenuStr(HMENU hMenu, UINT pos, wchar_t *str); +void SetMenuStrA(HMENU hMenu, UINT pos, char *str); +void RemoveShortcutKeyStrFromMenu(HMENU hMenu); +UINT GetMenuNum(HMENU hMenu); +void PrintMenu(HWND hWnd, HMENU hMenu); +void LvRename(HWND hWnd, UINT id, UINT pos); +void LvSetEnhanced(HWND hWnd, UINT id, bool enable); +void EditBoxSetEnhanced(HWND hWnd, UINT id, bool enable); +void AllowFGWindow(UINT process_id); +HWND SearchWindow(wchar_t *caption); +char *RemoteDlg(HWND hWnd, char *regkey, UINT icon, wchar_t *caption, wchar_t *title, char *default_host); +LIST *ReadCandidateFromReg(UINT root, char *key, char *name); +void WriteCandidateToReg(UINT root, char *key, LIST *o, char *name); +UINT LvGetColumnNum(HWND hWnd, UINT id); +void LvSetItemParamEx(HWND hWnd, UINT id, UINT index, UINT subitem, void *param); +void LvSortEx(HWND hWnd, UINT id, UINT subitem, bool desc, bool numeric); +void LvSort(HWND hWnd, UINT id, UINT subitem, bool desc); +void *LvGetParamEx(HWND hWnd, UINT id, UINT index, UINT subitem); +void LvSortHander(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, UINT id); +void LvStandardHandler(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, UINT id); +void IpSet(HWND hWnd, UINT id, UINT ip); +UINT IpGet(HWND hWnd, UINT id); +bool IpIsFilled(HWND hWnd, UINT id); +UINT IpGetFilledNum(HWND hWnd, UINT id); +void About(HWND hWnd, CEDAR *cedar, wchar_t *product_name); +void AboutEx(HWND hWnd, CEDAR *cedar, wchar_t *product_name, WINUI_UPDATE *u); +void Win9xReboot(HWND hWnd); +void Win9xRebootThread(THREAD *t, void *p); +UINT Win9xRebootDlgProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param); +wchar_t *StringDlg(HWND hWnd, wchar_t *title, wchar_t *info, wchar_t *def, UINT icon, bool allow_empty, bool allow_unsafe); +char *StringDlgA(HWND hWnd, wchar_t *title, wchar_t *info, char *def, UINT icon, bool allow_empty, bool allow_unsafe); +UINT StringDlgProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param); +void InitDialogInternational(HWND hWnd, void *pparam); +void AdjustWindowAndControlSize(HWND hWnd, bool *need_resize, double *factor_x, double *factor_y); +void AdjustDialogXY(UINT *x, UINT *y, UINT dlgfont_x, UINT dlgfont_y); +HFONT GetDialogDefaultFont(); +HFONT GetDialogDefaultFontEx(bool meiryo); +void InitMenuInternational(HMENU hMenu, char *prefix); +void InitMenuInternationalUni(HMENU hMenu, char *prefix); +void ShowTcpIpConfigUtil(HWND hWnd, bool util_mode); +void ShowCpu64Warning(); +UINT Cpu64DlgProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param); +UINT TcpIpDlgProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param); +void TcpIpDlgInit(HWND hWnd); +void TcpIpDlgUpdate(HWND hWnd); +UINT TcpMsgDlgProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param); +UINT KakushiDlgProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param); +void KakushiThread(THREAD *thread, void *param); +KAKUSHI *InitKakushi(); +void FreeKakushi(KAKUSHI *k); +void ShowEasterEgg(HWND hWnd); +bool Win32CnCheckAlreadyExists(bool lock); +void RegistWindowsFirewallAll(); +void RegistWindowsFirewallAllEx(char *dir); +void InitVistaWindowTheme(HWND hWnd); +void OnceMsg(HWND hWnd, wchar_t *title, wchar_t *message, bool show_checkbox, UINT icon); +void OnceMsgEx(HWND hWnd, wchar_t *title, wchar_t *message, bool show_checkbox, UINT icon, bool *halt); +UINT GetOnceMsgHash(wchar_t *title, wchar_t *message); +UINT OnceMsgProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param); +bool CheckBadProcesses(HWND hWnd); +BAD_PROCESS *IsBadProcess(char *exe); +void ShowBadProcessWarning(HWND hWnd, BAD_PROCESS *bad); +void SetFontMeiryo(HWND hWnd, UINT id, UINT font_size); +char *GetMeiryoFontName(); +void SetFontDefault(HWND hWnd, UINT id); +HFONT GetMeiryoFont(); +HFONT GetMeiryoFontEx(UINT font_size); +HFONT GetMeiryoFontEx2(UINT font_size, bool bold); +bool ShowWindowsNetworkConnectionDialog(); +SOCK *WinConnectEx3(HWND hWnd, char *server, UINT port, UINT timeout, UINT icon_id, wchar_t *caption, wchar_t *info, UINT *nat_t_error_code, char *nat_t_svc_name, bool try_start_ssl); +UINT WinConnectDlgProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param); +void WinConnectDlgThread(THREAD *thread, void *param); +void NicInfo(UI_NICINFO *info); +UINT NicInfoProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param); +void NicInfoInit(HWND hWnd, UI_NICINFO *info); +void NicInfoOnTimer(HWND hWnd, UI_NICINFO *info); +void NicInfoRefresh(HWND hWnd, UI_NICINFO *info); +void NicInfoShowStatus(HWND hWnd, UI_NICINFO *info, wchar_t *msg1, wchar_t *msg2, UINT icon, bool animate); +void NicInfoCloseAfterTime(HWND hWnd, UI_NICINFO *info, UINT tick); + +WIZARD *NewWizard(UINT icon, UINT bitmap, wchar_t *caption, void *param); +void FreeWizard(WIZARD *w); +WIZARD_PAGE *NewWizardPage(UINT id, WINUI_WIZARD_PROC *proc, wchar_t *title); +void FreeWizardPage(WIZARD_PAGE *p); +void AddWizardPage(WIZARD *w, WIZARD_PAGE *p); +WIZARD_PAGE *GetWizardPage(WIZARD *w, UINT id); +void *CreateWizardPageInstance(WIZARD *w, WIZARD_PAGE *p); +void ShowWizard(HWND hWndParent, WIZARD *w, UINT start_id); +void SetWizardButton(WIZARD_PAGE *p, bool enable_next, bool enable_back, bool enable_close, bool is_finish); +void SetWizardButtonEx(WIZARD_PAGE *p, bool enable_next, bool enable_back, bool enable_close, bool is_finish, bool shield_icon); +void JumpWizard(WIZARD_PAGE *p, UINT next_id); +void CloseWizard(WIZARD_PAGE *p); +void SetUacIcon(HWND hWnd, UINT id); + +LIST *NewBitmapList(); +void FreeBitmapList(LIST *o); + +bool GetBitmapSize(void *bmp, UINT *x, UINT *y); + +bool GetFontParam(HFONT hFont, struct FONT *f); +void AdjustFontSize(HWND hWnd, UINT id); +bool IsFontFitInRect(struct FONT *f, UINT width, UINT height, wchar_t *text, UINT format, bool *aborted); + +void ShowTextFile(HWND hWnd, char *filename, wchar_t *caption, UINT icon); + +#endif // OS_WIN32 + + diff --git a/src/Cedar/Wpc.c b/src/Cedar/Wpc.c index 7b608562..b5922fcf 100644 --- a/src/Cedar/Wpc.c +++ b/src/Cedar/Wpc.c @@ -1,1323 +1,1323 @@ -// SoftEther VPN Source Code - Developer Edition Master Branch -// Cedar Communication Module - - -// Wpc.c -// RPC over HTTP - -#include - -#include "CedarPch.h" - -// Get whether the proxy server is specified by a private IP -bool IsProxyPrivateIp(INTERNET_SETTING *s) -{ - IP ip; - // Validate arguments - if (s == NULL) - { - return false; - } - - if (s->ProxyType == PROXY_DIRECT) - { - return false; - } - - if (GetIP(&ip, s->ProxyHostName) == false) - { - return false; - } - - if (IsIPPrivate(&ip)) - { - return true; - } - - if (IsIPMyHost(&ip)) - { - return true; - } - - if (IsLocalHostIP(&ip)) - { - return true; - } - - return false; -} - -// Call -PACK *WpcCall(char *url, INTERNET_SETTING *setting, UINT timeout_connect, UINT timeout_comm, - char *function_name, PACK *pack, X *cert, K *key, void *sha1_cert_hash) -{ - return WpcCallEx(url, setting, timeout_connect, timeout_comm, function_name, pack, cert, key, - sha1_cert_hash, NULL, 0, NULL, NULL); -} -PACK *WpcCallEx(char *url, INTERNET_SETTING *setting, UINT timeout_connect, UINT timeout_comm, - char *function_name, PACK *pack, X *cert, K *key, void *sha1_cert_hash, bool *cancel, UINT max_recv_size, - char *additional_header_name, char *additional_header_value) -{ - return WpcCallEx2(url, setting, timeout_connect, timeout_comm, function_name, pack, - cert, key, sha1_cert_hash, (sha1_cert_hash == NULL ? 0 : 1), - cancel, max_recv_size, additional_header_name, additional_header_value, NULL); -} -PACK *WpcCallEx2(char *url, INTERNET_SETTING *setting, UINT timeout_connect, UINT timeout_comm, - char *function_name, PACK *pack, X *cert, K *key, void *sha1_cert_hash, UINT num_hashes, bool *cancel, UINT max_recv_size, - char *additional_header_name, char *additional_header_value, char *sni_string) -{ - URL_DATA data; - BUF *b, *recv; - UINT error; - WPC_PACKET packet; - // Validate arguments - if (function_name == NULL || pack == NULL) - { - return PackError(ERR_INTERNAL_ERROR); - } - - if (ParseUrl(&data, url, true, NULL) == false) - { - return PackError(ERR_INTERNAL_ERROR); - } - - PackAddStr(pack, "function", function_name); - - b = WpcGeneratePacket(pack, cert, key); - if (b == NULL) - { - return PackError(ERR_INTERNAL_ERROR); - } - - SeekBuf(b, b->Size, 0); - WriteBufInt(b, 0); - SeekBuf(b, 0, 0); - - if (IsEmptyStr(additional_header_name) == false && IsEmptyStr(additional_header_value) == false) - { - StrCpy(data.AdditionalHeaderName, sizeof(data.AdditionalHeaderName), additional_header_name); - StrCpy(data.AdditionalHeaderValue, sizeof(data.AdditionalHeaderValue), additional_header_value); - } - - if (sni_string != NULL && IsEmptyStr(sni_string) == false) - { - StrCpy(data.SniString, sizeof(data.SniString), sni_string); - } - - recv = HttpRequestEx3(&data, setting, timeout_connect, timeout_comm, &error, - false, b->Buf, NULL, NULL, sha1_cert_hash, num_hashes, cancel, max_recv_size, - NULL, NULL); - - FreeBuf(b); - - if (recv == NULL) - { - return PackError(error); - } - - if (WpcParsePacket(&packet, recv) == false) - { - FreeBuf(recv); - return PackError(ERR_PROTOCOL_ERROR); - } - - FreeBuf(recv); - - FreeX(packet.Cert); - - return packet.Pack; -} - -// Release the packet -void WpcFreePacket(WPC_PACKET *packet) -{ - // Validate arguments - if (packet == NULL) - { - return; - } - - FreePack(packet->Pack); - FreeX(packet->Cert); -} - -// Parse the packet -bool WpcParsePacket(WPC_PACKET *packet, BUF *buf) -{ - LIST *o; - BUF *b; - bool ret = false; - UCHAR hash[SHA1_SIZE]; - // Validate arguments - if (packet == NULL || buf == NULL) - { - return false; - } - - Zero(packet, sizeof(WPC_PACKET)); - - o = WpcParseDataEntry(buf); - - b = WpcDataEntryToBuf(WpcFindDataEntry(o, "PACK")); - if (b != NULL) - { - Sha1(hash, b->Buf, b->Size); - - packet->Pack = BufToPack(b); - FreeBuf(b); - - if (packet->Pack != NULL) - { - BUF *b; - - ret = true; - - b = WpcDataEntryToBuf(WpcFindDataEntry(o, "HASH")); - - if (b != NULL) - { - if (b->Size != SHA1_SIZE || Cmp(b->Buf, hash, SHA1_SIZE) != 0) - { - ret = false; - FreePack(packet->Pack); - } - else - { - BUF *b; - - Copy(packet->Hash, hash, SHA1_SIZE); - - b = WpcDataEntryToBuf(WpcFindDataEntry(o, "CERT")); - - if (b != NULL) - { - X *cert = BufToX(b, false); - if (cert == NULL) - { - ret = false; - FreePack(packet->Pack); - } - else - { - BUF *b = WpcDataEntryToBuf(WpcFindDataEntry(o, "SIGN")); - - if (b == NULL || (b->Size != 128)) - { - ret = false; - FreeX(cert); - FreePack(packet->Pack); - } - else - { - K *k = GetKFromX(cert); - - if (RsaVerify(hash, SHA1_SIZE, b->Buf, k) == false) - { - ret = false; - FreeX(cert); - FreePack(packet->Pack); - } - else - { - packet->Cert = cert; - Copy(packet->Sign, b->Buf, 128); - } - - FreeK(k); - } - - FreeBuf(b); - } - FreeBuf(b); - } - } - FreeBuf(b); - } - } - } - - WpcFreeDataEntryList(o); - - return ret; -} - -// Generate the packet -BUF *WpcGeneratePacket(PACK *pack, X *cert, K *key) -{ - UCHAR hash[SHA1_SIZE]; - BUF *pack_data; - BUF *cert_data = NULL; - BUF *sign_data = NULL; - BUF *b; - // Validate arguments - if (pack == NULL) - { - return NULL; - } - - pack_data = PackToBuf(pack); - Sha1(hash, pack_data->Buf, pack_data->Size); - - if (cert != NULL && key != NULL) - { - UCHAR sign[128]; - cert_data = XToBuf(cert, false); - - RsaSign(sign, hash, sizeof(hash), key); - - sign_data = NewBuf(); - WriteBuf(sign_data, sign, sizeof(sign)); - SeekBuf(sign_data, 0, 0); - } - - b = NewBuf(); - - WpcAddDataEntryBin(b, "PACK", pack_data->Buf, pack_data->Size); - WpcAddDataEntryBin(b, "HASH", hash, sizeof(hash)); - - if (cert_data != NULL) - { - WpcAddDataEntryBin(b, "CERT", cert_data->Buf, cert_data->Size); - WpcAddDataEntryBin(b, "SIGN", sign_data->Buf, sign_data->Size); - } - - FreeBuf(pack_data); - FreeBuf(cert_data); - FreeBuf(sign_data); - - SeekBuf(b, 0, 0); - - return b; -} - -// Decode the buffer from WPC_ENTRY -BUF *WpcDataEntryToBuf(WPC_ENTRY *e) -{ - void *data; - UINT data_size; - UINT size; - BUF *b; - // Validate arguments - if (e == NULL) - { - return NULL; - } - - data_size = e->Size + 4096; - data = Malloc(data_size); - size = DecodeSafe64(data, e->Data, e->Size); - - b = NewBuf(); - WriteBuf(b, data, size); - SeekBuf(b, 0, 0); - - Free(data); - - return b; -} - -// Search for the data entry -WPC_ENTRY *WpcFindDataEntry(LIST *o, char *name) -{ - UINT i; - char name_str[WPC_DATA_ENTRY_SIZE]; - // Validate arguments - if (o == NULL || name == NULL) - { - return NULL; - } - - WpcFillEntryName(name_str, name); - - for (i = 0;i < LIST_NUM(o);i++) - { - WPC_ENTRY *e = LIST_DATA(o, i); - - if (Cmp(e->EntryName, name_str, WPC_DATA_ENTRY_SIZE) == 0) - { - return e; - } - } - - return NULL; -} - -// Release the data entry list -void WpcFreeDataEntryList(LIST *o) -{ - UINT i; - // Validate arguments - if (o == NULL) - { - return; - } - - for (i = 0;i < LIST_NUM(o);i++) - { - WPC_ENTRY *e = LIST_DATA(o, i); - - Free(e); - } - - ReleaseList(o); -} - -// Parse the data entry -LIST *WpcParseDataEntry(BUF *b) -{ - char entry_name[WPC_DATA_ENTRY_SIZE]; - char size_str[11]; - LIST *o; - // Validate arguments - if (b == NULL) - { - return NULL; - } - - SeekBuf(b, 0, 0); - - o = NewListFast(NULL); - - while (true) - { - UINT size; - WPC_ENTRY *e; - - if (ReadBuf(b, entry_name, WPC_DATA_ENTRY_SIZE) != WPC_DATA_ENTRY_SIZE) - { - break; - } - - Zero(size_str, sizeof(size_str)); - if (ReadBuf(b, size_str, 10) != 10) - { - break; - } - - size = ToInt(size_str); - if ((b->Size - b->Current) < size) - { - break; - } - - e = ZeroMalloc(sizeof(WPC_ENTRY)); - e->Data = (UCHAR *)b->Buf + b->Current; - Copy(e->EntryName, entry_name, WPC_DATA_ENTRY_SIZE); - e->Size = size; - - SeekBuf(b, size, 1); - - Add(o, e); - } - - return o; -} - -// Generate a entry name -void WpcFillEntryName(char *dst, char *name) -{ - UINT i, len; - char tmp[MAX_SIZE]; - // Validate arguments - if (dst == NULL || name == NULL) - { - return; - } - - StrCpy(tmp, sizeof(tmp), name); - StrUpper(tmp); - len = StrLen(tmp); - - for (i = 0;i < WPC_DATA_ENTRY_SIZE;i++) - { - dst[i] = ' '; - } - - if (len <= WPC_DATA_ENTRY_SIZE) - { - Copy(dst, tmp, len); - } - else - { - Copy(dst, tmp, WPC_DATA_ENTRY_SIZE); - } -} - -// Add the data entry (binary) -void WpcAddDataEntryBin(BUF *b, char *name, void *data, UINT size) -{ - char *str; - // Validate arguments - if (b == NULL || name == NULL || (data == NULL && size != 0)) - { - return; - } - - str = Malloc(size * 2 + 64); - - EncodeSafe64(str, data, size); - - WpcAddDataEntry(b, name, str, StrLen(str)); - - Free(str); -} - - -// Add the data entry -void WpcAddDataEntry(BUF *b, char *name, void *data, UINT size) -{ - char entry_name[WPC_DATA_ENTRY_SIZE]; - char size_str[11]; - // Validate arguments - if (b == NULL || name == NULL || (data == NULL && size != 0)) - { - return; - } - - WpcFillEntryName(entry_name, name); - WriteBuf(b, entry_name, WPC_DATA_ENTRY_SIZE); - - Format(size_str, sizeof(size_str), "%010u", size); - WriteBuf(b, size_str, 10); - - WriteBuf(b, data, size); -} - -// Get the empty INTERNET_SETTING -INTERNET_SETTING *GetNullInternetSetting() -{ - static INTERNET_SETTING ret; - - Zero(&ret, sizeof(ret)); - - return &ret; -} - -// Socket connection -SOCK *WpcSockConnect(WPC_CONNECT *param, UINT *error_code, UINT timeout) -{ - return WpcSockConnectEx(param, error_code, timeout, NULL); -} -SOCK *WpcSockConnectEx(WPC_CONNECT *param, UINT *error_code, UINT timeout, bool *cancel) -{ - SOCK *sock; - UINT ret; - // Validate arguments - if (param == NULL) - { - return NULL; - } - - if (error_code == NULL) - { - error_code = &ret; - } - - if (param->ProxyType == PROXY_DIRECT) - { - sock = TcpConnectEx3(param->HostName, param->Port, timeout, cancel, NULL, true, NULL, false, NULL); - *error_code = (sock != NULL ? ERR_NO_ERROR : ERR_CONNECT_FAILED); - return sock; - } - else - { - PROXY_PARAM_OUT out; - PROXY_PARAM_IN in; - UINT ret; - - Zero(&in, sizeof(in)); - - in.Timeout = timeout; - - StrCpy(in.TargetHostname, sizeof(in.TargetHostname), param->HostName); - in.TargetPort = param->Port; - - StrCpy(in.Hostname, sizeof(in.Hostname), param->ProxyHostName); - in.Port = param->ProxyPort; - - StrCpy(in.Username, sizeof(in.Username), param->ProxyUsername); - StrCpy(in.Password, sizeof(in.Password), param->ProxyPassword); - - StrCpy(in.HttpCustomHeader, sizeof(in.HttpCustomHeader), param->CustomHttpHeader); - - switch (param->ProxyType) - { - case PROXY_HTTP: - ret = ProxyHttpConnect(&out, &in, cancel); - break; - case PROXY_SOCKS: - ret = ProxySocks4Connect(&out, &in, cancel); - break; - case PROXY_SOCKS5: - ret = ProxySocks5Connect(&out, &in, cancel); - break; - default: - *error_code = ERR_INTERNAL_ERROR; - Debug("WpcSockConnect(): Unknown proxy type: %u!\n", param->ProxyType); - return NULL; - } - - *error_code = ProxyCodeToCedar(ret); - - if (*error_code != ERR_NO_ERROR) - { - Debug("ClientConnectGetSocket(): Connection via proxy server failed with error %u\n", ret); - return NULL; - } - - return out.Sock; - } -} -SOCK *WpcSockConnect2(char *hostname, UINT port, INTERNET_SETTING *t, UINT *error_code, UINT timeout) -{ - // Validate arguments - INTERNET_SETTING t2; - WPC_CONNECT c; - if (t == NULL) - { - Zero(&t2, sizeof(t2)); - - t = &t2; - } - - Zero(&c, sizeof(c)); - StrCpy(c.HostName, sizeof(c.HostName), hostname); - c.Port = port; - c.ProxyType = t->ProxyType; - StrCpy(c.ProxyHostName, sizeof(c.HostName), t->ProxyHostName); - c.ProxyPort = t->ProxyPort; - StrCpy(c.ProxyUsername, sizeof(c.ProxyUsername), t->ProxyUsername); - StrCpy(c.ProxyPassword, sizeof(c.ProxyPassword), t->ProxyPassword); - StrCpy(c.CustomHttpHeader, sizeof(c.CustomHttpHeader), t->CustomHttpHeader); - - return WpcSockConnect(&c, error_code, timeout); -} - -// Handle the HTTP request -BUF *HttpRequest(URL_DATA *data, INTERNET_SETTING *setting, - UINT timeout_connect, UINT timeout_comm, - UINT *error_code, bool check_ssl_trust, char *post_data, - WPC_RECV_CALLBACK *recv_callback, void *recv_callback_param, void *sha1_cert_hash) -{ - return HttpRequestEx(data, setting, timeout_connect, timeout_comm, - error_code, check_ssl_trust, post_data, - recv_callback, recv_callback_param, sha1_cert_hash, NULL, 0); -} -BUF *HttpRequestEx(URL_DATA *data, INTERNET_SETTING *setting, - UINT timeout_connect, UINT timeout_comm, - UINT *error_code, bool check_ssl_trust, char *post_data, - WPC_RECV_CALLBACK *recv_callback, void *recv_callback_param, void *sha1_cert_hash, - bool *cancel, UINT max_recv_size) -{ - return HttpRequestEx2(data, setting, timeout_connect, timeout_comm, error_code, - check_ssl_trust, post_data, recv_callback, recv_callback_param, sha1_cert_hash, - cancel, max_recv_size, NULL, NULL); -} -BUF *HttpRequestEx2(URL_DATA *data, INTERNET_SETTING *setting, - UINT timeout_connect, UINT timeout_comm, - UINT *error_code, bool check_ssl_trust, char *post_data, - WPC_RECV_CALLBACK *recv_callback, void *recv_callback_param, void *sha1_cert_hash, - bool *cancel, UINT max_recv_size, char *header_name, char *header_value) -{ - return HttpRequestEx3(data, setting, timeout_connect, timeout_comm, error_code, check_ssl_trust, - post_data, recv_callback, recv_callback_param, sha1_cert_hash, (sha1_cert_hash == NULL ? 0 : 1), - cancel, max_recv_size, header_name, header_value); -} -BUF *HttpRequestEx3(URL_DATA *data, INTERNET_SETTING *setting, - UINT timeout_connect, UINT timeout_comm, - UINT *error_code, bool check_ssl_trust, char *post_data, - WPC_RECV_CALLBACK *recv_callback, void *recv_callback_param, void *sha1_cert_hash, UINT num_hashes, - bool *cancel, UINT max_recv_size, char *header_name, char *header_value) -{ - WPC_CONNECT con; - SOCK *s; - HTTP_HEADER *h; - bool use_http_proxy = false; - char target[MAX_SIZE * 4]; - char *send_str; - BUF *send_buf; - BUF *recv_buf; - UINT http_error_code; - char len_str[100]; - UINT content_len; - void *socket_buffer; - UINT socket_buffer_size = WPC_RECV_BUF_SIZE; - UINT num_continue = 0; - INTERNET_SETTING wt_setting; - // Validate arguments - if (data == NULL) - { - return NULL; - } - if (setting == NULL) - { - Zero(&wt_setting, sizeof(wt_setting)); - setting = &wt_setting; - } - if (error_code == NULL) - { - static UINT ret = 0; - error_code = &ret; - } - if (timeout_comm == 0) - { - timeout_comm = WPC_TIMEOUT; - } - if (sha1_cert_hash == NULL) - { - num_hashes = 0; - } - if (num_hashes == 0) - { - sha1_cert_hash = NULL; - } - - // Connection - Zero(&con, sizeof(con)); - StrCpy(con.HostName, sizeof(con.HostName), data->HostName); - con.Port = data->Port; - con.ProxyType = setting->ProxyType; - StrCpy(con.ProxyHostName, sizeof(con.ProxyHostName), setting->ProxyHostName); - con.ProxyPort = setting->ProxyPort; - StrCpy(con.ProxyUsername, sizeof(con.ProxyUsername), setting->ProxyUsername); - StrCpy(con.ProxyPassword, sizeof(con.ProxyPassword), setting->ProxyPassword); - StrCpy(con.CustomHttpHeader, sizeof(con.CustomHttpHeader), setting->CustomHttpHeader); - - if (setting->ProxyType != PROXY_HTTP || data->Secure) - { - use_http_proxy = false; - StrCpy(target, sizeof(target), data->Target); - } - else - { - use_http_proxy = true; - CreateUrl(target, sizeof(target), data); - } - - if (use_http_proxy == false) - { - // If the connection is not via HTTP Proxy, or is a SSL connection even via HTTP Proxy - s = WpcSockConnectEx(&con, error_code, timeout_connect, cancel); - } - else - { - // If the connection is not SSL via HTTP Proxy - s = TcpConnectEx3(con.ProxyHostName, con.ProxyPort, timeout_connect, cancel, NULL, true, NULL, false, NULL); - if (s == NULL) - { - *error_code = ERR_PROXY_CONNECT_FAILED; - } - } - - if (s == NULL) - { - return NULL; - } - - if (data->Secure) - { - // Start the SSL communication - if (StartSSLEx(s, NULL, NULL, 0, (IsEmptyStr(data->SniString) ? NULL : data->SniString)) == false) - { - // SSL connection failed - *error_code = ERR_PROTOCOL_ERROR; - Disconnect(s); - ReleaseSock(s); - return NULL; - } - - if (sha1_cert_hash != NULL && num_hashes >= 1) - { - UCHAR hash[SHA1_SIZE]; - UINT i; - bool ok = false; - - Zero(hash, sizeof(hash)); - GetXDigest(s->RemoteX, hash, true); - - for (i = 0;i < num_hashes;i++) - { - UCHAR *a = (UCHAR *)sha1_cert_hash; - a += (SHA1_SIZE * i); - - if (Cmp(hash, a, SHA1_SIZE) == 0) - { - ok = true; - break; - } - } - - if (ok == false) - { - // Destination certificate hash mismatch - *error_code = ERR_CERT_NOT_TRUSTED; - Disconnect(s); - ReleaseSock(s); - return NULL; - } - } - } - - // Timeout setting - SetTimeout(s, timeout_comm); - - // Generate a request - h = NewHttpHeader(data->Method, target, use_http_proxy ? "HTTP/1.0" : "HTTP/1.1"); - AddHttpValue(h, NewHttpValue("Keep-Alive", HTTP_KEEP_ALIVE)); - AddHttpValue(h, NewHttpValue("Connection", "Keep-Alive")); - AddHttpValue(h, NewHttpValue("Accept-Language", "ja")); - AddHttpValue(h, NewHttpValue("User-Agent", WPC_USER_AGENT)); - AddHttpValue(h, NewHttpValue("Pragma", "no-cache")); - AddHttpValue(h, NewHttpValue("Cache-Control", "no-cache")); - AddHttpValue(h, NewHttpValue("Host", data->HeaderHostName)); - - if (IsEmptyStr(header_name) == false && IsEmptyStr(header_value) == false) - { - AddHttpValue(h, NewHttpValue(header_name, header_value)); - } - - if (IsEmptyStr(data->Referer) == false) - { - AddHttpValue(h, NewHttpValue("Referer", data->Referer)); - } - - if (StrCmpi(data->Method, WPC_HTTP_POST_NAME) == 0) - { - ToStr(len_str, StrLen(post_data)); - AddHttpValue(h, NewHttpValue("Content-Type", "application/x-www-form-urlencoded")); - AddHttpValue(h, NewHttpValue("Content-Length", len_str)); - } - - if (IsEmptyStr(data->AdditionalHeaderName) == false && IsEmptyStr(data->AdditionalHeaderValue) == false) - { - AddHttpValue(h, NewHttpValue(data->AdditionalHeaderName, data->AdditionalHeaderValue)); - } - - if (use_http_proxy) - { - AddHttpValue(h, NewHttpValue("Proxy-Connection", "Keep-Alive")); - - if (IsEmptyStr(setting->ProxyUsername) == false || IsEmptyStr(setting->ProxyPassword) == false) - { - char auth_tmp_str[MAX_SIZE], auth_b64_str[MAX_SIZE * 2]; - char basic_str[MAX_SIZE * 2]; - - // Generate the authentication string - Format(auth_tmp_str, sizeof(auth_tmp_str), "%s:%s", - setting->ProxyUsername, setting->ProxyPassword); - - // Base64 encode - Zero(auth_b64_str, sizeof(auth_b64_str)); - Encode64(auth_b64_str, auth_tmp_str); - Format(basic_str, sizeof(basic_str), "Basic %s", auth_b64_str); - - AddHttpValue(h, NewHttpValue("Proxy-Authorization", basic_str)); - } - } - - send_str = HttpHeaderToStr(h); - FreeHttpHeader(h); - - send_buf = NewBuf(); - WriteBuf(send_buf, send_str, StrLen(send_str)); - Free(send_str); - - // Append to the sending data in the case of POST - if (StrCmpi(data->Method, WPC_HTTP_POST_NAME) == 0) - { - WriteBuf(send_buf, post_data, StrLen(post_data)); - } - - // Send - if (SendAll(s, send_buf->Buf, send_buf->Size, s->SecureMode) == false) - { - Disconnect(s); - ReleaseSock(s); - FreeBuf(send_buf); - - *error_code = ERR_DISCONNECTED; - - return NULL; - } - - FreeBuf(send_buf); - -CONT: - // Receive - h = RecvHttpHeader(s); - if (h == NULL) - { - Disconnect(s); - ReleaseSock(s); - - *error_code = ERR_DISCONNECTED; - - return NULL; - } - - http_error_code = 0; - if (StrLen(h->Method) == 8) - { - if (Cmp(h->Method, "HTTP/1.", 7) == 0) - { - http_error_code = ToInt(h->Target); - } - } - - *error_code = ERR_NO_ERROR; - - switch (http_error_code) - { - case 401: - case 407: - // Proxy authentication error - *error_code = ERR_PROXY_AUTH_FAILED; - break; - - case 404: - // 404 File Not Found - *error_code = ERR_OBJECT_NOT_FOUND; - break; - - case 100: - // Continue - num_continue++; - if (num_continue >= 10) - { - goto DEF; - } - FreeHttpHeader(h); - goto CONT; - - case 200: - // Success - break; - - default: - // Protocol error -DEF: - *error_code = ERR_PROTOCOL_ERROR; - break; - } - - if (*error_code != ERR_NO_ERROR) - { - // An error has occured - Disconnect(s); - ReleaseSock(s); - FreeHttpHeader(h); - return NULL; - } - - // Get the length of the content - content_len = GetContentLength(h); - if (max_recv_size != 0) - { - content_len = MIN(content_len, max_recv_size); - } - - FreeHttpHeader(h); - - socket_buffer = Malloc(socket_buffer_size); - - // Receive the content - recv_buf = NewBuf(); - - while (true) - { - UINT recvsize = MIN(socket_buffer_size, content_len - recv_buf->Size); - UINT size; - - if (recv_callback != NULL) - { - if (recv_callback(recv_callback_param, - content_len, recv_buf->Size, recv_buf) == false) - { - // Cancel the reception - *error_code = ERR_USER_CANCEL; - goto RECV_CANCEL; - } - } - - if (recvsize == 0) - { - break; - } - - size = Recv(s, socket_buffer, recvsize, s->SecureMode); - if (size == 0) - { - // Disconnected - *error_code = ERR_DISCONNECTED; - -RECV_CANCEL: - FreeBuf(recv_buf); - Free(socket_buffer); - Disconnect(s); - ReleaseSock(s); - - return NULL; - } - - WriteBuf(recv_buf, socket_buffer, size); - } - - SeekBuf(recv_buf, 0, 0); - Free(socket_buffer); - - Disconnect(s); - ReleaseSock(s); - - // Transmission - return recv_buf; -} - -// Get the proxy server settings from the registry string of IE -bool GetProxyServerNameAndPortFromIeProxyRegStr(char *name, UINT name_size, UINT *port, char *str, char *server_type) -{ -#ifdef OS_WIN32 - TOKEN_LIST *t; - UINT i; - bool ret = false; - // Validate arguments - if (name == NULL || port == NULL || str == NULL || server_type == NULL) - { - return false; - } - - t = ParseToken(str, ";"); - - for (i = 0;i < t->NumTokens;i++) - { - char *s = t->Token[i]; - UINT i; - - Trim(s); - - i = SearchStrEx(s, "=", 0, false); - if (i != INFINITE) - { - char tmp[MAX_PATH]; - - StrCpy(name, name_size, s); - name[i] = 0; - - if (StrCmpi(name, server_type) == 0) - { - char *host; - StrCpy(tmp, sizeof(tmp), s + i + 1); - - if (ParseHostPort(tmp, &host, port, 0)) - { - StrCpy(name, name_size, host); - Free(host); - - if (*port != 0) - { - ret = true; - } - break; - } - } - } - } - - FreeToken(t); - - return ret; -#else // OS_WIN32 - return true; -#endif // OS_WIN32 -} - -// Get the internet connection settings of the system -void GetSystemInternetSetting(INTERNET_SETTING *setting) -{ -#ifdef OS_WIN32 - bool use_proxy; - // Validate arguments - if (setting == NULL) - { - return; - } - - Zero(setting, sizeof(INTERNET_SETTING)); - - use_proxy = MsRegReadInt(REG_CURRENT_USER, - "Software\\Microsoft\\Windows\\CurrentVersion\\Internet Settings", - "ProxyEnable"); - - if (use_proxy) - { - char *str = MsRegReadStr(REG_CURRENT_USER, - "Software\\Microsoft\\Windows\\CurrentVersion\\Internet Settings", - "ProxyServer"); - if (str != NULL) - { - char name[MAX_HOST_NAME_LEN + 1]; - UINT port; - - if (GetProxyServerNameAndPortFromIeProxyRegStr(name, sizeof(name), - &port, str, "https")) - { - setting->ProxyType = PROXY_HTTP; - StrCpy(setting->ProxyHostName, sizeof(setting->ProxyHostName), name); - setting->ProxyPort = port; - } - else if (GetProxyServerNameAndPortFromIeProxyRegStr(name, sizeof(name), - &port, str, "http")) - { - setting->ProxyType = PROXY_HTTP; - StrCpy(setting->ProxyHostName, sizeof(setting->ProxyHostName), name); - setting->ProxyPort = port; - } - else if (GetProxyServerNameAndPortFromIeProxyRegStr(name, sizeof(name), - &port, str, "socks")) - { - setting->ProxyType = PROXY_SOCKS; - StrCpy(setting->ProxyHostName, sizeof(setting->ProxyHostName), name); - setting->ProxyPort = port; - } - else - { - if (SearchStrEx(str, "=", 0, false) == INFINITE) - { - char *host; - UINT port; - if (ParseHostPort(str, &host, &port, 0)) - { - if (port != 0) - { - setting->ProxyType = PROXY_HTTP; - StrCpy(setting->ProxyHostName, sizeof(setting->ProxyHostName), host); - setting->ProxyPort = port; - } - Free(host); - } - } - } - - Free(str); - } - } -#else // OS_WIN32 - Zero(setting, sizeof(INTERNET_SETTING)); -#endif // OS_WIN32 -} - -// Generate the URL -void CreateUrl(char *url, UINT url_size, URL_DATA *data) -{ - char *protocol; - // Validate arguments - if (url == NULL || data == NULL) - { - return; - } - - if (data->Secure == false) - { - protocol = "http://"; - } - else - { - protocol = "https://"; - } - - Format(url, url_size, "%s%s%s", protocol, data->HeaderHostName, data->Target); -} - - -// Parse the URL -bool ParseUrl(URL_DATA *data, char *str, bool is_post, char *referrer) -{ - char tmp[MAX_SIZE * 3]; - char server_port[MAX_HOST_NAME_LEN + 16]; - char *s = NULL; - char *host; - UINT port; - UINT i; - // Validate arguments - if (data == NULL || str == NULL) - { - return false; - } - - Zero(data, sizeof(URL_DATA)); - - if (is_post) - { - StrCpy(data->Method, sizeof(data->Method), WPC_HTTP_POST_NAME); - } - else - { - StrCpy(data->Method, sizeof(data->Method), WPC_HTTP_GET_NAME); - } - - if (referrer != NULL) - { - StrCpy(data->Referer, sizeof(data->Referer), referrer); - } - - StrCpy(tmp, sizeof(tmp), str); - Trim(tmp); - - // Determine the protocol - if (StartWith(tmp, "http://")) - { - data->Secure = false; - s = &tmp[7]; - } - else if (StartWith(tmp, "https://")) - { - data->Secure = true; - s = &tmp[8]; - } - else - { - if (SearchStrEx(tmp, "://", 0, false) != INFINITE) - { - return false; - } - data->Secure = false; - s = &tmp[0]; - } - - // Get the "server name:port number" - StrCpy(server_port, sizeof(server_port), s); - i = SearchStrEx(server_port, "/", 0, false); - if (i != INFINITE) - { - server_port[i] = 0; - s += StrLen(server_port); - StrCpy(data->Target, sizeof(data->Target), s); - } - else - { - StrCpy(data->Target, sizeof(data->Target), "/"); - } - - if (ParseHostPort(server_port, &host, &port, data->Secure ? 443 : 80) == false) - { - return false; - } - - StrCpy(data->HostName, sizeof(data->HostName), host); - data->Port = port; - - Free(host); - - if ((data->Secure && data->Port == 443) || (data->Secure == false && data->Port == 80)) - { - StrCpy(data->HeaderHostName, sizeof(data->HeaderHostName), data->HostName); - } - else - { - Format(data->HeaderHostName, sizeof(data->HeaderHostName), - "%s:%u", data->HostName, data->Port); - } - - return true; -} - -// String replacement -void Base64ToSafe64(char *str) -{ - UINT i, len; - // Validate arguments - if (str == NULL) - { - return; - } - - len = StrLen(str); - - for (i = 0;i < len;i++) - { - switch (str[i]) - { - case '=': - str[i] = '('; - break; - - case '+': - str[i] = ')'; - break; - - case '/': - str[i] = '_'; - break; - } - } -} -void Safe64ToBase64(char *str) -{ - UINT i, len; - // Validate arguments - if (str == NULL) - { - return; - } - - len = StrLen(str); - - for (i = 0;i < len;i++) - { - switch (str[i]) - { - case '(': - str[i] = '='; - break; - - case ')': - str[i] = '+'; - break; - - case '_': - str[i] = '/'; - break; - } - } -} - -// Decode from Safe64 -UINT DecodeSafe64(void *dst, char *src, UINT src_strlen) -{ - char *tmp; - UINT ret; - if (dst == NULL || src == NULL) - { - return 0; - } - - if (src_strlen == 0) - { - src_strlen = StrLen(src); - } - - tmp = Malloc(src_strlen + 1); - Copy(tmp, src, src_strlen); - tmp[src_strlen] = 0; - Safe64ToBase64(tmp); - - ret = B64_Decode(dst, tmp, src_strlen); - Free(tmp); - - return ret; -} - -// Encode to Safe64 -void EncodeSafe64(char *dst, void *src, UINT src_size) -{ - UINT size; - if (dst == NULL || src == NULL) - { - return; - } - - size = B64_Encode(dst, src, src_size); - dst[size] = 0; - - Base64ToSafe64(dst); -} - +// SoftEther VPN Source Code - Developer Edition Master Branch +// Cedar Communication Module + + +// Wpc.c +// RPC over HTTP + +#include + +#include "CedarPch.h" + +// Get whether the proxy server is specified by a private IP +bool IsProxyPrivateIp(INTERNET_SETTING *s) +{ + IP ip; + // Validate arguments + if (s == NULL) + { + return false; + } + + if (s->ProxyType == PROXY_DIRECT) + { + return false; + } + + if (GetIP(&ip, s->ProxyHostName) == false) + { + return false; + } + + if (IsIPPrivate(&ip)) + { + return true; + } + + if (IsIPMyHost(&ip)) + { + return true; + } + + if (IsLocalHostIP(&ip)) + { + return true; + } + + return false; +} + +// Call +PACK *WpcCall(char *url, INTERNET_SETTING *setting, UINT timeout_connect, UINT timeout_comm, + char *function_name, PACK *pack, X *cert, K *key, void *sha1_cert_hash) +{ + return WpcCallEx(url, setting, timeout_connect, timeout_comm, function_name, pack, cert, key, + sha1_cert_hash, NULL, 0, NULL, NULL); +} +PACK *WpcCallEx(char *url, INTERNET_SETTING *setting, UINT timeout_connect, UINT timeout_comm, + char *function_name, PACK *pack, X *cert, K *key, void *sha1_cert_hash, bool *cancel, UINT max_recv_size, + char *additional_header_name, char *additional_header_value) +{ + return WpcCallEx2(url, setting, timeout_connect, timeout_comm, function_name, pack, + cert, key, sha1_cert_hash, (sha1_cert_hash == NULL ? 0 : 1), + cancel, max_recv_size, additional_header_name, additional_header_value, NULL); +} +PACK *WpcCallEx2(char *url, INTERNET_SETTING *setting, UINT timeout_connect, UINT timeout_comm, + char *function_name, PACK *pack, X *cert, K *key, void *sha1_cert_hash, UINT num_hashes, bool *cancel, UINT max_recv_size, + char *additional_header_name, char *additional_header_value, char *sni_string) +{ + URL_DATA data; + BUF *b, *recv; + UINT error; + WPC_PACKET packet; + // Validate arguments + if (function_name == NULL || pack == NULL) + { + return PackError(ERR_INTERNAL_ERROR); + } + + if (ParseUrl(&data, url, true, NULL) == false) + { + return PackError(ERR_INTERNAL_ERROR); + } + + PackAddStr(pack, "function", function_name); + + b = WpcGeneratePacket(pack, cert, key); + if (b == NULL) + { + return PackError(ERR_INTERNAL_ERROR); + } + + SeekBuf(b, b->Size, 0); + WriteBufInt(b, 0); + SeekBuf(b, 0, 0); + + if (IsEmptyStr(additional_header_name) == false && IsEmptyStr(additional_header_value) == false) + { + StrCpy(data.AdditionalHeaderName, sizeof(data.AdditionalHeaderName), additional_header_name); + StrCpy(data.AdditionalHeaderValue, sizeof(data.AdditionalHeaderValue), additional_header_value); + } + + if (sni_string != NULL && IsEmptyStr(sni_string) == false) + { + StrCpy(data.SniString, sizeof(data.SniString), sni_string); + } + + recv = HttpRequestEx3(&data, setting, timeout_connect, timeout_comm, &error, + false, b->Buf, NULL, NULL, sha1_cert_hash, num_hashes, cancel, max_recv_size, + NULL, NULL); + + FreeBuf(b); + + if (recv == NULL) + { + return PackError(error); + } + + if (WpcParsePacket(&packet, recv) == false) + { + FreeBuf(recv); + return PackError(ERR_PROTOCOL_ERROR); + } + + FreeBuf(recv); + + FreeX(packet.Cert); + + return packet.Pack; +} + +// Release the packet +void WpcFreePacket(WPC_PACKET *packet) +{ + // Validate arguments + if (packet == NULL) + { + return; + } + + FreePack(packet->Pack); + FreeX(packet->Cert); +} + +// Parse the packet +bool WpcParsePacket(WPC_PACKET *packet, BUF *buf) +{ + LIST *o; + BUF *b; + bool ret = false; + UCHAR hash[SHA1_SIZE]; + // Validate arguments + if (packet == NULL || buf == NULL) + { + return false; + } + + Zero(packet, sizeof(WPC_PACKET)); + + o = WpcParseDataEntry(buf); + + b = WpcDataEntryToBuf(WpcFindDataEntry(o, "PACK")); + if (b != NULL) + { + Sha1(hash, b->Buf, b->Size); + + packet->Pack = BufToPack(b); + FreeBuf(b); + + if (packet->Pack != NULL) + { + BUF *b; + + ret = true; + + b = WpcDataEntryToBuf(WpcFindDataEntry(o, "HASH")); + + if (b != NULL) + { + if (b->Size != SHA1_SIZE || Cmp(b->Buf, hash, SHA1_SIZE) != 0) + { + ret = false; + FreePack(packet->Pack); + } + else + { + BUF *b; + + Copy(packet->Hash, hash, SHA1_SIZE); + + b = WpcDataEntryToBuf(WpcFindDataEntry(o, "CERT")); + + if (b != NULL) + { + X *cert = BufToX(b, false); + if (cert == NULL) + { + ret = false; + FreePack(packet->Pack); + } + else + { + BUF *b = WpcDataEntryToBuf(WpcFindDataEntry(o, "SIGN")); + + if (b == NULL || (b->Size != 128)) + { + ret = false; + FreeX(cert); + FreePack(packet->Pack); + } + else + { + K *k = GetKFromX(cert); + + if (RsaVerify(hash, SHA1_SIZE, b->Buf, k) == false) + { + ret = false; + FreeX(cert); + FreePack(packet->Pack); + } + else + { + packet->Cert = cert; + Copy(packet->Sign, b->Buf, 128); + } + + FreeK(k); + } + + FreeBuf(b); + } + FreeBuf(b); + } + } + FreeBuf(b); + } + } + } + + WpcFreeDataEntryList(o); + + return ret; +} + +// Generate the packet +BUF *WpcGeneratePacket(PACK *pack, X *cert, K *key) +{ + UCHAR hash[SHA1_SIZE]; + BUF *pack_data; + BUF *cert_data = NULL; + BUF *sign_data = NULL; + BUF *b; + // Validate arguments + if (pack == NULL) + { + return NULL; + } + + pack_data = PackToBuf(pack); + Sha1(hash, pack_data->Buf, pack_data->Size); + + if (cert != NULL && key != NULL) + { + UCHAR sign[128]; + cert_data = XToBuf(cert, false); + + RsaSign(sign, hash, sizeof(hash), key); + + sign_data = NewBuf(); + WriteBuf(sign_data, sign, sizeof(sign)); + SeekBuf(sign_data, 0, 0); + } + + b = NewBuf(); + + WpcAddDataEntryBin(b, "PACK", pack_data->Buf, pack_data->Size); + WpcAddDataEntryBin(b, "HASH", hash, sizeof(hash)); + + if (cert_data != NULL) + { + WpcAddDataEntryBin(b, "CERT", cert_data->Buf, cert_data->Size); + WpcAddDataEntryBin(b, "SIGN", sign_data->Buf, sign_data->Size); + } + + FreeBuf(pack_data); + FreeBuf(cert_data); + FreeBuf(sign_data); + + SeekBuf(b, 0, 0); + + return b; +} + +// Decode the buffer from WPC_ENTRY +BUF *WpcDataEntryToBuf(WPC_ENTRY *e) +{ + void *data; + UINT data_size; + UINT size; + BUF *b; + // Validate arguments + if (e == NULL) + { + return NULL; + } + + data_size = e->Size + 4096; + data = Malloc(data_size); + size = DecodeSafe64(data, e->Data, e->Size); + + b = NewBuf(); + WriteBuf(b, data, size); + SeekBuf(b, 0, 0); + + Free(data); + + return b; +} + +// Search for the data entry +WPC_ENTRY *WpcFindDataEntry(LIST *o, char *name) +{ + UINT i; + char name_str[WPC_DATA_ENTRY_SIZE]; + // Validate arguments + if (o == NULL || name == NULL) + { + return NULL; + } + + WpcFillEntryName(name_str, name); + + for (i = 0;i < LIST_NUM(o);i++) + { + WPC_ENTRY *e = LIST_DATA(o, i); + + if (Cmp(e->EntryName, name_str, WPC_DATA_ENTRY_SIZE) == 0) + { + return e; + } + } + + return NULL; +} + +// Release the data entry list +void WpcFreeDataEntryList(LIST *o) +{ + UINT i; + // Validate arguments + if (o == NULL) + { + return; + } + + for (i = 0;i < LIST_NUM(o);i++) + { + WPC_ENTRY *e = LIST_DATA(o, i); + + Free(e); + } + + ReleaseList(o); +} + +// Parse the data entry +LIST *WpcParseDataEntry(BUF *b) +{ + char entry_name[WPC_DATA_ENTRY_SIZE]; + char size_str[11]; + LIST *o; + // Validate arguments + if (b == NULL) + { + return NULL; + } + + SeekBuf(b, 0, 0); + + o = NewListFast(NULL); + + while (true) + { + UINT size; + WPC_ENTRY *e; + + if (ReadBuf(b, entry_name, WPC_DATA_ENTRY_SIZE) != WPC_DATA_ENTRY_SIZE) + { + break; + } + + Zero(size_str, sizeof(size_str)); + if (ReadBuf(b, size_str, 10) != 10) + { + break; + } + + size = ToInt(size_str); + if ((b->Size - b->Current) < size) + { + break; + } + + e = ZeroMalloc(sizeof(WPC_ENTRY)); + e->Data = (UCHAR *)b->Buf + b->Current; + Copy(e->EntryName, entry_name, WPC_DATA_ENTRY_SIZE); + e->Size = size; + + SeekBuf(b, size, 1); + + Add(o, e); + } + + return o; +} + +// Generate a entry name +void WpcFillEntryName(char *dst, char *name) +{ + UINT i, len; + char tmp[MAX_SIZE]; + // Validate arguments + if (dst == NULL || name == NULL) + { + return; + } + + StrCpy(tmp, sizeof(tmp), name); + StrUpper(tmp); + len = StrLen(tmp); + + for (i = 0;i < WPC_DATA_ENTRY_SIZE;i++) + { + dst[i] = ' '; + } + + if (len <= WPC_DATA_ENTRY_SIZE) + { + Copy(dst, tmp, len); + } + else + { + Copy(dst, tmp, WPC_DATA_ENTRY_SIZE); + } +} + +// Add the data entry (binary) +void WpcAddDataEntryBin(BUF *b, char *name, void *data, UINT size) +{ + char *str; + // Validate arguments + if (b == NULL || name == NULL || (data == NULL && size != 0)) + { + return; + } + + str = Malloc(size * 2 + 64); + + EncodeSafe64(str, data, size); + + WpcAddDataEntry(b, name, str, StrLen(str)); + + Free(str); +} + + +// Add the data entry +void WpcAddDataEntry(BUF *b, char *name, void *data, UINT size) +{ + char entry_name[WPC_DATA_ENTRY_SIZE]; + char size_str[11]; + // Validate arguments + if (b == NULL || name == NULL || (data == NULL && size != 0)) + { + return; + } + + WpcFillEntryName(entry_name, name); + WriteBuf(b, entry_name, WPC_DATA_ENTRY_SIZE); + + Format(size_str, sizeof(size_str), "%010u", size); + WriteBuf(b, size_str, 10); + + WriteBuf(b, data, size); +} + +// Get the empty INTERNET_SETTING +INTERNET_SETTING *GetNullInternetSetting() +{ + static INTERNET_SETTING ret; + + Zero(&ret, sizeof(ret)); + + return &ret; +} + +// Socket connection +SOCK *WpcSockConnect(WPC_CONNECT *param, UINT *error_code, UINT timeout) +{ + return WpcSockConnectEx(param, error_code, timeout, NULL); +} +SOCK *WpcSockConnectEx(WPC_CONNECT *param, UINT *error_code, UINT timeout, bool *cancel) +{ + SOCK *sock; + UINT ret; + // Validate arguments + if (param == NULL) + { + return NULL; + } + + if (error_code == NULL) + { + error_code = &ret; + } + + if (param->ProxyType == PROXY_DIRECT) + { + sock = TcpConnectEx3(param->HostName, param->Port, timeout, cancel, NULL, true, NULL, false, NULL); + *error_code = (sock != NULL ? ERR_NO_ERROR : ERR_CONNECT_FAILED); + return sock; + } + else + { + PROXY_PARAM_OUT out; + PROXY_PARAM_IN in; + UINT ret; + + Zero(&in, sizeof(in)); + + in.Timeout = timeout; + + StrCpy(in.TargetHostname, sizeof(in.TargetHostname), param->HostName); + in.TargetPort = param->Port; + + StrCpy(in.Hostname, sizeof(in.Hostname), param->ProxyHostName); + in.Port = param->ProxyPort; + + StrCpy(in.Username, sizeof(in.Username), param->ProxyUsername); + StrCpy(in.Password, sizeof(in.Password), param->ProxyPassword); + + StrCpy(in.HttpCustomHeader, sizeof(in.HttpCustomHeader), param->CustomHttpHeader); + + switch (param->ProxyType) + { + case PROXY_HTTP: + ret = ProxyHttpConnect(&out, &in, cancel); + break; + case PROXY_SOCKS: + ret = ProxySocks4Connect(&out, &in, cancel); + break; + case PROXY_SOCKS5: + ret = ProxySocks5Connect(&out, &in, cancel); + break; + default: + *error_code = ERR_INTERNAL_ERROR; + Debug("WpcSockConnect(): Unknown proxy type: %u!\n", param->ProxyType); + return NULL; + } + + *error_code = ProxyCodeToCedar(ret); + + if (*error_code != ERR_NO_ERROR) + { + Debug("ClientConnectGetSocket(): Connection via proxy server failed with error %u\n", ret); + return NULL; + } + + return out.Sock; + } +} +SOCK *WpcSockConnect2(char *hostname, UINT port, INTERNET_SETTING *t, UINT *error_code, UINT timeout) +{ + // Validate arguments + INTERNET_SETTING t2; + WPC_CONNECT c; + if (t == NULL) + { + Zero(&t2, sizeof(t2)); + + t = &t2; + } + + Zero(&c, sizeof(c)); + StrCpy(c.HostName, sizeof(c.HostName), hostname); + c.Port = port; + c.ProxyType = t->ProxyType; + StrCpy(c.ProxyHostName, sizeof(c.HostName), t->ProxyHostName); + c.ProxyPort = t->ProxyPort; + StrCpy(c.ProxyUsername, sizeof(c.ProxyUsername), t->ProxyUsername); + StrCpy(c.ProxyPassword, sizeof(c.ProxyPassword), t->ProxyPassword); + StrCpy(c.CustomHttpHeader, sizeof(c.CustomHttpHeader), t->CustomHttpHeader); + + return WpcSockConnect(&c, error_code, timeout); +} + +// Handle the HTTP request +BUF *HttpRequest(URL_DATA *data, INTERNET_SETTING *setting, + UINT timeout_connect, UINT timeout_comm, + UINT *error_code, bool check_ssl_trust, char *post_data, + WPC_RECV_CALLBACK *recv_callback, void *recv_callback_param, void *sha1_cert_hash) +{ + return HttpRequestEx(data, setting, timeout_connect, timeout_comm, + error_code, check_ssl_trust, post_data, + recv_callback, recv_callback_param, sha1_cert_hash, NULL, 0); +} +BUF *HttpRequestEx(URL_DATA *data, INTERNET_SETTING *setting, + UINT timeout_connect, UINT timeout_comm, + UINT *error_code, bool check_ssl_trust, char *post_data, + WPC_RECV_CALLBACK *recv_callback, void *recv_callback_param, void *sha1_cert_hash, + bool *cancel, UINT max_recv_size) +{ + return HttpRequestEx2(data, setting, timeout_connect, timeout_comm, error_code, + check_ssl_trust, post_data, recv_callback, recv_callback_param, sha1_cert_hash, + cancel, max_recv_size, NULL, NULL); +} +BUF *HttpRequestEx2(URL_DATA *data, INTERNET_SETTING *setting, + UINT timeout_connect, UINT timeout_comm, + UINT *error_code, bool check_ssl_trust, char *post_data, + WPC_RECV_CALLBACK *recv_callback, void *recv_callback_param, void *sha1_cert_hash, + bool *cancel, UINT max_recv_size, char *header_name, char *header_value) +{ + return HttpRequestEx3(data, setting, timeout_connect, timeout_comm, error_code, check_ssl_trust, + post_data, recv_callback, recv_callback_param, sha1_cert_hash, (sha1_cert_hash == NULL ? 0 : 1), + cancel, max_recv_size, header_name, header_value); +} +BUF *HttpRequestEx3(URL_DATA *data, INTERNET_SETTING *setting, + UINT timeout_connect, UINT timeout_comm, + UINT *error_code, bool check_ssl_trust, char *post_data, + WPC_RECV_CALLBACK *recv_callback, void *recv_callback_param, void *sha1_cert_hash, UINT num_hashes, + bool *cancel, UINT max_recv_size, char *header_name, char *header_value) +{ + WPC_CONNECT con; + SOCK *s; + HTTP_HEADER *h; + bool use_http_proxy = false; + char target[MAX_SIZE * 4]; + char *send_str; + BUF *send_buf; + BUF *recv_buf; + UINT http_error_code; + char len_str[100]; + UINT content_len; + void *socket_buffer; + UINT socket_buffer_size = WPC_RECV_BUF_SIZE; + UINT num_continue = 0; + INTERNET_SETTING wt_setting; + // Validate arguments + if (data == NULL) + { + return NULL; + } + if (setting == NULL) + { + Zero(&wt_setting, sizeof(wt_setting)); + setting = &wt_setting; + } + if (error_code == NULL) + { + static UINT ret = 0; + error_code = &ret; + } + if (timeout_comm == 0) + { + timeout_comm = WPC_TIMEOUT; + } + if (sha1_cert_hash == NULL) + { + num_hashes = 0; + } + if (num_hashes == 0) + { + sha1_cert_hash = NULL; + } + + // Connection + Zero(&con, sizeof(con)); + StrCpy(con.HostName, sizeof(con.HostName), data->HostName); + con.Port = data->Port; + con.ProxyType = setting->ProxyType; + StrCpy(con.ProxyHostName, sizeof(con.ProxyHostName), setting->ProxyHostName); + con.ProxyPort = setting->ProxyPort; + StrCpy(con.ProxyUsername, sizeof(con.ProxyUsername), setting->ProxyUsername); + StrCpy(con.ProxyPassword, sizeof(con.ProxyPassword), setting->ProxyPassword); + StrCpy(con.CustomHttpHeader, sizeof(con.CustomHttpHeader), setting->CustomHttpHeader); + + if (setting->ProxyType != PROXY_HTTP || data->Secure) + { + use_http_proxy = false; + StrCpy(target, sizeof(target), data->Target); + } + else + { + use_http_proxy = true; + CreateUrl(target, sizeof(target), data); + } + + if (use_http_proxy == false) + { + // If the connection is not via HTTP Proxy, or is a SSL connection even via HTTP Proxy + s = WpcSockConnectEx(&con, error_code, timeout_connect, cancel); + } + else + { + // If the connection is not SSL via HTTP Proxy + s = TcpConnectEx3(con.ProxyHostName, con.ProxyPort, timeout_connect, cancel, NULL, true, NULL, false, NULL); + if (s == NULL) + { + *error_code = ERR_PROXY_CONNECT_FAILED; + } + } + + if (s == NULL) + { + return NULL; + } + + if (data->Secure) + { + // Start the SSL communication + if (StartSSLEx(s, NULL, NULL, 0, (IsEmptyStr(data->SniString) ? NULL : data->SniString)) == false) + { + // SSL connection failed + *error_code = ERR_PROTOCOL_ERROR; + Disconnect(s); + ReleaseSock(s); + return NULL; + } + + if (sha1_cert_hash != NULL && num_hashes >= 1) + { + UCHAR hash[SHA1_SIZE]; + UINT i; + bool ok = false; + + Zero(hash, sizeof(hash)); + GetXDigest(s->RemoteX, hash, true); + + for (i = 0;i < num_hashes;i++) + { + UCHAR *a = (UCHAR *)sha1_cert_hash; + a += (SHA1_SIZE * i); + + if (Cmp(hash, a, SHA1_SIZE) == 0) + { + ok = true; + break; + } + } + + if (ok == false) + { + // Destination certificate hash mismatch + *error_code = ERR_CERT_NOT_TRUSTED; + Disconnect(s); + ReleaseSock(s); + return NULL; + } + } + } + + // Timeout setting + SetTimeout(s, timeout_comm); + + // Generate a request + h = NewHttpHeader(data->Method, target, use_http_proxy ? "HTTP/1.0" : "HTTP/1.1"); + AddHttpValue(h, NewHttpValue("Keep-Alive", HTTP_KEEP_ALIVE)); + AddHttpValue(h, NewHttpValue("Connection", "Keep-Alive")); + AddHttpValue(h, NewHttpValue("Accept-Language", "ja")); + AddHttpValue(h, NewHttpValue("User-Agent", WPC_USER_AGENT)); + AddHttpValue(h, NewHttpValue("Pragma", "no-cache")); + AddHttpValue(h, NewHttpValue("Cache-Control", "no-cache")); + AddHttpValue(h, NewHttpValue("Host", data->HeaderHostName)); + + if (IsEmptyStr(header_name) == false && IsEmptyStr(header_value) == false) + { + AddHttpValue(h, NewHttpValue(header_name, header_value)); + } + + if (IsEmptyStr(data->Referer) == false) + { + AddHttpValue(h, NewHttpValue("Referer", data->Referer)); + } + + if (StrCmpi(data->Method, WPC_HTTP_POST_NAME) == 0) + { + ToStr(len_str, StrLen(post_data)); + AddHttpValue(h, NewHttpValue("Content-Type", "application/x-www-form-urlencoded")); + AddHttpValue(h, NewHttpValue("Content-Length", len_str)); + } + + if (IsEmptyStr(data->AdditionalHeaderName) == false && IsEmptyStr(data->AdditionalHeaderValue) == false) + { + AddHttpValue(h, NewHttpValue(data->AdditionalHeaderName, data->AdditionalHeaderValue)); + } + + if (use_http_proxy) + { + AddHttpValue(h, NewHttpValue("Proxy-Connection", "Keep-Alive")); + + if (IsEmptyStr(setting->ProxyUsername) == false || IsEmptyStr(setting->ProxyPassword) == false) + { + char auth_tmp_str[MAX_SIZE], auth_b64_str[MAX_SIZE * 2]; + char basic_str[MAX_SIZE * 2]; + + // Generate the authentication string + Format(auth_tmp_str, sizeof(auth_tmp_str), "%s:%s", + setting->ProxyUsername, setting->ProxyPassword); + + // Base64 encode + Zero(auth_b64_str, sizeof(auth_b64_str)); + Encode64(auth_b64_str, auth_tmp_str); + Format(basic_str, sizeof(basic_str), "Basic %s", auth_b64_str); + + AddHttpValue(h, NewHttpValue("Proxy-Authorization", basic_str)); + } + } + + send_str = HttpHeaderToStr(h); + FreeHttpHeader(h); + + send_buf = NewBuf(); + WriteBuf(send_buf, send_str, StrLen(send_str)); + Free(send_str); + + // Append to the sending data in the case of POST + if (StrCmpi(data->Method, WPC_HTTP_POST_NAME) == 0) + { + WriteBuf(send_buf, post_data, StrLen(post_data)); + } + + // Send + if (SendAll(s, send_buf->Buf, send_buf->Size, s->SecureMode) == false) + { + Disconnect(s); + ReleaseSock(s); + FreeBuf(send_buf); + + *error_code = ERR_DISCONNECTED; + + return NULL; + } + + FreeBuf(send_buf); + +CONT: + // Receive + h = RecvHttpHeader(s); + if (h == NULL) + { + Disconnect(s); + ReleaseSock(s); + + *error_code = ERR_DISCONNECTED; + + return NULL; + } + + http_error_code = 0; + if (StrLen(h->Method) == 8) + { + if (Cmp(h->Method, "HTTP/1.", 7) == 0) + { + http_error_code = ToInt(h->Target); + } + } + + *error_code = ERR_NO_ERROR; + + switch (http_error_code) + { + case 401: + case 407: + // Proxy authentication error + *error_code = ERR_PROXY_AUTH_FAILED; + break; + + case 404: + // 404 File Not Found + *error_code = ERR_OBJECT_NOT_FOUND; + break; + + case 100: + // Continue + num_continue++; + if (num_continue >= 10) + { + goto DEF; + } + FreeHttpHeader(h); + goto CONT; + + case 200: + // Success + break; + + default: + // Protocol error +DEF: + *error_code = ERR_PROTOCOL_ERROR; + break; + } + + if (*error_code != ERR_NO_ERROR) + { + // An error has occured + Disconnect(s); + ReleaseSock(s); + FreeHttpHeader(h); + return NULL; + } + + // Get the length of the content + content_len = GetContentLength(h); + if (max_recv_size != 0) + { + content_len = MIN(content_len, max_recv_size); + } + + FreeHttpHeader(h); + + socket_buffer = Malloc(socket_buffer_size); + + // Receive the content + recv_buf = NewBuf(); + + while (true) + { + UINT recvsize = MIN(socket_buffer_size, content_len - recv_buf->Size); + UINT size; + + if (recv_callback != NULL) + { + if (recv_callback(recv_callback_param, + content_len, recv_buf->Size, recv_buf) == false) + { + // Cancel the reception + *error_code = ERR_USER_CANCEL; + goto RECV_CANCEL; + } + } + + if (recvsize == 0) + { + break; + } + + size = Recv(s, socket_buffer, recvsize, s->SecureMode); + if (size == 0) + { + // Disconnected + *error_code = ERR_DISCONNECTED; + +RECV_CANCEL: + FreeBuf(recv_buf); + Free(socket_buffer); + Disconnect(s); + ReleaseSock(s); + + return NULL; + } + + WriteBuf(recv_buf, socket_buffer, size); + } + + SeekBuf(recv_buf, 0, 0); + Free(socket_buffer); + + Disconnect(s); + ReleaseSock(s); + + // Transmission + return recv_buf; +} + +// Get the proxy server settings from the registry string of IE +bool GetProxyServerNameAndPortFromIeProxyRegStr(char *name, UINT name_size, UINT *port, char *str, char *server_type) +{ +#ifdef OS_WIN32 + TOKEN_LIST *t; + UINT i; + bool ret = false; + // Validate arguments + if (name == NULL || port == NULL || str == NULL || server_type == NULL) + { + return false; + } + + t = ParseToken(str, ";"); + + for (i = 0;i < t->NumTokens;i++) + { + char *s = t->Token[i]; + UINT i; + + Trim(s); + + i = SearchStrEx(s, "=", 0, false); + if (i != INFINITE) + { + char tmp[MAX_PATH]; + + StrCpy(name, name_size, s); + name[i] = 0; + + if (StrCmpi(name, server_type) == 0) + { + char *host; + StrCpy(tmp, sizeof(tmp), s + i + 1); + + if (ParseHostPort(tmp, &host, port, 0)) + { + StrCpy(name, name_size, host); + Free(host); + + if (*port != 0) + { + ret = true; + } + break; + } + } + } + } + + FreeToken(t); + + return ret; +#else // OS_WIN32 + return true; +#endif // OS_WIN32 +} + +// Get the internet connection settings of the system +void GetSystemInternetSetting(INTERNET_SETTING *setting) +{ +#ifdef OS_WIN32 + bool use_proxy; + // Validate arguments + if (setting == NULL) + { + return; + } + + Zero(setting, sizeof(INTERNET_SETTING)); + + use_proxy = MsRegReadInt(REG_CURRENT_USER, + "Software\\Microsoft\\Windows\\CurrentVersion\\Internet Settings", + "ProxyEnable"); + + if (use_proxy) + { + char *str = MsRegReadStr(REG_CURRENT_USER, + "Software\\Microsoft\\Windows\\CurrentVersion\\Internet Settings", + "ProxyServer"); + if (str != NULL) + { + char name[MAX_HOST_NAME_LEN + 1]; + UINT port; + + if (GetProxyServerNameAndPortFromIeProxyRegStr(name, sizeof(name), + &port, str, "https")) + { + setting->ProxyType = PROXY_HTTP; + StrCpy(setting->ProxyHostName, sizeof(setting->ProxyHostName), name); + setting->ProxyPort = port; + } + else if (GetProxyServerNameAndPortFromIeProxyRegStr(name, sizeof(name), + &port, str, "http")) + { + setting->ProxyType = PROXY_HTTP; + StrCpy(setting->ProxyHostName, sizeof(setting->ProxyHostName), name); + setting->ProxyPort = port; + } + else if (GetProxyServerNameAndPortFromIeProxyRegStr(name, sizeof(name), + &port, str, "socks")) + { + setting->ProxyType = PROXY_SOCKS; + StrCpy(setting->ProxyHostName, sizeof(setting->ProxyHostName), name); + setting->ProxyPort = port; + } + else + { + if (SearchStrEx(str, "=", 0, false) == INFINITE) + { + char *host; + UINT port; + if (ParseHostPort(str, &host, &port, 0)) + { + if (port != 0) + { + setting->ProxyType = PROXY_HTTP; + StrCpy(setting->ProxyHostName, sizeof(setting->ProxyHostName), host); + setting->ProxyPort = port; + } + Free(host); + } + } + } + + Free(str); + } + } +#else // OS_WIN32 + Zero(setting, sizeof(INTERNET_SETTING)); +#endif // OS_WIN32 +} + +// Generate the URL +void CreateUrl(char *url, UINT url_size, URL_DATA *data) +{ + char *protocol; + // Validate arguments + if (url == NULL || data == NULL) + { + return; + } + + if (data->Secure == false) + { + protocol = "http://"; + } + else + { + protocol = "https://"; + } + + Format(url, url_size, "%s%s%s", protocol, data->HeaderHostName, data->Target); +} + + +// Parse the URL +bool ParseUrl(URL_DATA *data, char *str, bool is_post, char *referrer) +{ + char tmp[MAX_SIZE * 3]; + char server_port[MAX_HOST_NAME_LEN + 16]; + char *s = NULL; + char *host; + UINT port; + UINT i; + // Validate arguments + if (data == NULL || str == NULL) + { + return false; + } + + Zero(data, sizeof(URL_DATA)); + + if (is_post) + { + StrCpy(data->Method, sizeof(data->Method), WPC_HTTP_POST_NAME); + } + else + { + StrCpy(data->Method, sizeof(data->Method), WPC_HTTP_GET_NAME); + } + + if (referrer != NULL) + { + StrCpy(data->Referer, sizeof(data->Referer), referrer); + } + + StrCpy(tmp, sizeof(tmp), str); + Trim(tmp); + + // Determine the protocol + if (StartWith(tmp, "http://")) + { + data->Secure = false; + s = &tmp[7]; + } + else if (StartWith(tmp, "https://")) + { + data->Secure = true; + s = &tmp[8]; + } + else + { + if (SearchStrEx(tmp, "://", 0, false) != INFINITE) + { + return false; + } + data->Secure = false; + s = &tmp[0]; + } + + // Get the "server name:port number" + StrCpy(server_port, sizeof(server_port), s); + i = SearchStrEx(server_port, "/", 0, false); + if (i != INFINITE) + { + server_port[i] = 0; + s += StrLen(server_port); + StrCpy(data->Target, sizeof(data->Target), s); + } + else + { + StrCpy(data->Target, sizeof(data->Target), "/"); + } + + if (ParseHostPort(server_port, &host, &port, data->Secure ? 443 : 80) == false) + { + return false; + } + + StrCpy(data->HostName, sizeof(data->HostName), host); + data->Port = port; + + Free(host); + + if ((data->Secure && data->Port == 443) || (data->Secure == false && data->Port == 80)) + { + StrCpy(data->HeaderHostName, sizeof(data->HeaderHostName), data->HostName); + } + else + { + Format(data->HeaderHostName, sizeof(data->HeaderHostName), + "%s:%u", data->HostName, data->Port); + } + + return true; +} + +// String replacement +void Base64ToSafe64(char *str) +{ + UINT i, len; + // Validate arguments + if (str == NULL) + { + return; + } + + len = StrLen(str); + + for (i = 0;i < len;i++) + { + switch (str[i]) + { + case '=': + str[i] = '('; + break; + + case '+': + str[i] = ')'; + break; + + case '/': + str[i] = '_'; + break; + } + } +} +void Safe64ToBase64(char *str) +{ + UINT i, len; + // Validate arguments + if (str == NULL) + { + return; + } + + len = StrLen(str); + + for (i = 0;i < len;i++) + { + switch (str[i]) + { + case '(': + str[i] = '='; + break; + + case ')': + str[i] = '+'; + break; + + case '_': + str[i] = '/'; + break; + } + } +} + +// Decode from Safe64 +UINT DecodeSafe64(void *dst, char *src, UINT src_strlen) +{ + char *tmp; + UINT ret; + if (dst == NULL || src == NULL) + { + return 0; + } + + if (src_strlen == 0) + { + src_strlen = StrLen(src); + } + + tmp = Malloc(src_strlen + 1); + Copy(tmp, src, src_strlen); + tmp[src_strlen] = 0; + Safe64ToBase64(tmp); + + ret = B64_Decode(dst, tmp, src_strlen); + Free(tmp); + + return ret; +} + +// Encode to Safe64 +void EncodeSafe64(char *dst, void *src, UINT src_size) +{ + UINT size; + if (dst == NULL || src == NULL) + { + return; + } + + size = B64_Encode(dst, src, src_size); + dst[size] = 0; + + Base64ToSafe64(dst); +} + diff --git a/src/Cedar/Wpc.h b/src/Cedar/Wpc.h index 016cd72c..331dc6fa 100644 --- a/src/Cedar/Wpc.h +++ b/src/Cedar/Wpc.h @@ -1,135 +1,135 @@ -// SoftEther VPN Source Code - Developer Edition Master Branch -// Cedar Communication Module - - -// Wpc.h -// Header of Wpc.c - -#ifndef WPC_H -#define WPC_H - -// Constant -#define WPC_HTTP_POST_NAME "POST" // POST -#define WPC_HTTP_GET_NAME "GET" // GET -#define WPC_USER_AGENT DEFAULT_USER_AGENT // User Agent -#define WPC_TIMEOUT (15 * 1000) // Time-out -#define WPC_RECV_BUF_SIZE 64000 // Receive buffer size -#define WPC_DATA_ENTRY_SIZE 4 // Data entry size -#define WPC_MAX_HTTP_DATASIZE (134217728) // Maximum HTTP data size - -// Connection parameters -struct WPC_CONNECT -{ - char HostName[MAX_HOST_NAME_LEN + 1]; // Host name - UINT Port; // Port number - UINT ProxyType; // Type of proxy server - char ProxyHostName[MAX_HOST_NAME_LEN + 1]; // Proxy server host name - UINT ProxyPort; // Proxy server port number - char ProxyUsername[MAX_USERNAME_LEN + 1]; // Proxy server user name - char ProxyPassword[MAX_USERNAME_LEN + 1]; // Proxy server password - char CustomHttpHeader[HTTP_CUSTOM_HEADER_MAX_SIZE + 1]; // Custom HTTP header - bool UseCompress; // Use of compression - bool DontCheckCert; // Do not check the certificate -}; - -// Internet connection settings -struct INTERNET_SETTING -{ - UINT ProxyType; // Type of proxy server - char ProxyHostName[MAX_HOST_NAME_LEN + 1]; // Proxy server host name - UINT ProxyPort; // Proxy server port number - char ProxyUsername[MAX_USERNAME_LEN + 1]; // Proxy server user name - char ProxyPassword[MAX_USERNAME_LEN + 1]; // Proxy server password - char CustomHttpHeader[HTTP_CUSTOM_HEADER_MAX_SIZE + 1]; // Custom HTTP header -}; - -// URL -struct URL_DATA -{ - bool Secure; // Whether HTTPS - char HostName[MAX_HOST_NAME_LEN + 1]; // Host name - UINT Port; // Port number - char HeaderHostName[MAX_HOST_NAME_LEN + 16]; // Host name on the header - char Method[32]; // Method - char Target[MAX_SIZE * 3]; // Target - char Referer[MAX_SIZE * 3]; // Referer - char AdditionalHeaderName[128]; // Additional header name - char AdditionalHeaderValue[MAX_SIZE]; // Additional header value - char SniString[MAX_SIZE]; // SNI String -}; - -// WPC entry -struct WPC_ENTRY -{ - char EntryName[WPC_DATA_ENTRY_SIZE]; // Entry name - void *Data; // Data - UINT Size; // Data size -}; - -// WPC packet -struct WPC_PACKET -{ - PACK *Pack; // Pack (data body) - UCHAR Hash[SHA1_SIZE]; // Data hash - X *Cert; // Certificate - UCHAR Sign[128]; // Digital signature -}; - -// Reception callback -typedef bool (WPC_RECV_CALLBACK)(void *param, UINT total_size, UINT current_size, BUF *recv_buf); - -// Function prototype -void EncodeSafe64(char *dst, void *src, UINT src_size); -UINT DecodeSafe64(void *dst, char *src, UINT src_strlen); -void Base64ToSafe64(char *str); -void Safe64ToBase64(char *str); -bool ParseUrl(URL_DATA *data, char *str, bool is_post, char *referrer); -void CreateUrl(char *url, UINT url_size, URL_DATA *data); -void GetSystemInternetSetting(INTERNET_SETTING *setting); -bool GetProxyServerNameAndPortFromIeProxyRegStr(char *name, UINT name_size, UINT *port, char *str, char *server_type); -BUF *HttpRequest(URL_DATA *data, INTERNET_SETTING *setting, - UINT timeout_connect, UINT timeout_comm, - UINT *error_code, bool check_ssl_trust, char *post_data, - WPC_RECV_CALLBACK *recv_callback, void *recv_callback_param, void *sha1_cert_hash); -BUF *HttpRequestEx(URL_DATA *data, INTERNET_SETTING *setting, - UINT timeout_connect, UINT timeout_comm, - UINT *error_code, bool check_ssl_trust, char *post_data, - WPC_RECV_CALLBACK *recv_callback, void *recv_callback_param, void *sha1_cert_hash, - bool *cancel, UINT max_recv_size); -BUF *HttpRequestEx2(URL_DATA *data, INTERNET_SETTING *setting, - UINT timeout_connect, UINT timeout_comm, - UINT *error_code, bool check_ssl_trust, char *post_data, - WPC_RECV_CALLBACK *recv_callback, void *recv_callback_param, void *sha1_cert_hash, - bool *cancel, UINT max_recv_size, char *header_name, char *header_value); -BUF *HttpRequestEx3(URL_DATA *data, INTERNET_SETTING *setting, - UINT timeout_connect, UINT timeout_comm, - UINT *error_code, bool check_ssl_trust, char *post_data, - WPC_RECV_CALLBACK *recv_callback, void *recv_callback_param, void *sha1_cert_hash, UINT num_hashes, - bool *cancel, UINT max_recv_size, char *header_name, char *header_value); -SOCK *WpcSockConnect(WPC_CONNECT *param, UINT *error_code, UINT timeout); -SOCK *WpcSockConnectEx(WPC_CONNECT *param, UINT *error_code, UINT timeout, bool *cancel); -SOCK *WpcSockConnect2(char *hostname, UINT port, INTERNET_SETTING *t, UINT *error_code, UINT timeout); -INTERNET_SETTING *GetNullInternetSetting(); -void WpcAddDataEntry(BUF *b, char *name, void *data, UINT size); -void WpcAddDataEntryBin(BUF *b, char *name, void *data, UINT size); -void WpcFillEntryName(char *dst, char *name); -LIST *WpcParseDataEntry(BUF *b); -void WpcFreeDataEntryList(LIST *o); -WPC_ENTRY *WpcFindDataEntry(LIST *o, char *name); -BUF *WpcDataEntryToBuf(WPC_ENTRY *e); -BUF *WpcGeneratePacket(PACK *pack, X *cert, K *key); -bool WpcParsePacket(WPC_PACKET *packet, BUF *buf); -void WpcFreePacket(WPC_PACKET *packet); -PACK *WpcCall(char *url, INTERNET_SETTING *setting, UINT timeout_connect, UINT timeout_comm, - char *function_name, PACK *pack, X *cert, K *key, void *sha1_cert_hash); -PACK *WpcCallEx(char *url, INTERNET_SETTING *setting, UINT timeout_connect, UINT timeout_comm, - char *function_name, PACK *pack, X *cert, K *key, void *sha1_cert_hash, bool *cancel, UINT max_recv_size, - char *additional_header_name, char *additional_header_value); -PACK *WpcCallEx2(char *url, INTERNET_SETTING *setting, UINT timeout_connect, UINT timeout_comm, - char *function_name, PACK *pack, X *cert, K *key, void *sha1_cert_hash, UINT num_hashes, bool *cancel, UINT max_recv_size, - char *additional_header_name, char *additional_header_value, char *sni_string); -bool IsProxyPrivateIp(INTERNET_SETTING *s); - -#endif // WPC_H - - +// SoftEther VPN Source Code - Developer Edition Master Branch +// Cedar Communication Module + + +// Wpc.h +// Header of Wpc.c + +#ifndef WPC_H +#define WPC_H + +// Constant +#define WPC_HTTP_POST_NAME "POST" // POST +#define WPC_HTTP_GET_NAME "GET" // GET +#define WPC_USER_AGENT DEFAULT_USER_AGENT // User Agent +#define WPC_TIMEOUT (15 * 1000) // Time-out +#define WPC_RECV_BUF_SIZE 64000 // Receive buffer size +#define WPC_DATA_ENTRY_SIZE 4 // Data entry size +#define WPC_MAX_HTTP_DATASIZE (134217728) // Maximum HTTP data size + +// Connection parameters +struct WPC_CONNECT +{ + char HostName[MAX_HOST_NAME_LEN + 1]; // Host name + UINT Port; // Port number + UINT ProxyType; // Type of proxy server + char ProxyHostName[MAX_HOST_NAME_LEN + 1]; // Proxy server host name + UINT ProxyPort; // Proxy server port number + char ProxyUsername[MAX_USERNAME_LEN + 1]; // Proxy server user name + char ProxyPassword[MAX_USERNAME_LEN + 1]; // Proxy server password + char CustomHttpHeader[HTTP_CUSTOM_HEADER_MAX_SIZE + 1]; // Custom HTTP header + bool UseCompress; // Use of compression + bool DontCheckCert; // Do not check the certificate +}; + +// Internet connection settings +struct INTERNET_SETTING +{ + UINT ProxyType; // Type of proxy server + char ProxyHostName[MAX_HOST_NAME_LEN + 1]; // Proxy server host name + UINT ProxyPort; // Proxy server port number + char ProxyUsername[MAX_USERNAME_LEN + 1]; // Proxy server user name + char ProxyPassword[MAX_USERNAME_LEN + 1]; // Proxy server password + char CustomHttpHeader[HTTP_CUSTOM_HEADER_MAX_SIZE + 1]; // Custom HTTP header +}; + +// URL +struct URL_DATA +{ + bool Secure; // Whether HTTPS + char HostName[MAX_HOST_NAME_LEN + 1]; // Host name + UINT Port; // Port number + char HeaderHostName[MAX_HOST_NAME_LEN + 16]; // Host name on the header + char Method[32]; // Method + char Target[MAX_SIZE * 3]; // Target + char Referer[MAX_SIZE * 3]; // Referer + char AdditionalHeaderName[128]; // Additional header name + char AdditionalHeaderValue[MAX_SIZE]; // Additional header value + char SniString[MAX_SIZE]; // SNI String +}; + +// WPC entry +struct WPC_ENTRY +{ + char EntryName[WPC_DATA_ENTRY_SIZE]; // Entry name + void *Data; // Data + UINT Size; // Data size +}; + +// WPC packet +struct WPC_PACKET +{ + PACK *Pack; // Pack (data body) + UCHAR Hash[SHA1_SIZE]; // Data hash + X *Cert; // Certificate + UCHAR Sign[128]; // Digital signature +}; + +// Reception callback +typedef bool (WPC_RECV_CALLBACK)(void *param, UINT total_size, UINT current_size, BUF *recv_buf); + +// Function prototype +void EncodeSafe64(char *dst, void *src, UINT src_size); +UINT DecodeSafe64(void *dst, char *src, UINT src_strlen); +void Base64ToSafe64(char *str); +void Safe64ToBase64(char *str); +bool ParseUrl(URL_DATA *data, char *str, bool is_post, char *referrer); +void CreateUrl(char *url, UINT url_size, URL_DATA *data); +void GetSystemInternetSetting(INTERNET_SETTING *setting); +bool GetProxyServerNameAndPortFromIeProxyRegStr(char *name, UINT name_size, UINT *port, char *str, char *server_type); +BUF *HttpRequest(URL_DATA *data, INTERNET_SETTING *setting, + UINT timeout_connect, UINT timeout_comm, + UINT *error_code, bool check_ssl_trust, char *post_data, + WPC_RECV_CALLBACK *recv_callback, void *recv_callback_param, void *sha1_cert_hash); +BUF *HttpRequestEx(URL_DATA *data, INTERNET_SETTING *setting, + UINT timeout_connect, UINT timeout_comm, + UINT *error_code, bool check_ssl_trust, char *post_data, + WPC_RECV_CALLBACK *recv_callback, void *recv_callback_param, void *sha1_cert_hash, + bool *cancel, UINT max_recv_size); +BUF *HttpRequestEx2(URL_DATA *data, INTERNET_SETTING *setting, + UINT timeout_connect, UINT timeout_comm, + UINT *error_code, bool check_ssl_trust, char *post_data, + WPC_RECV_CALLBACK *recv_callback, void *recv_callback_param, void *sha1_cert_hash, + bool *cancel, UINT max_recv_size, char *header_name, char *header_value); +BUF *HttpRequestEx3(URL_DATA *data, INTERNET_SETTING *setting, + UINT timeout_connect, UINT timeout_comm, + UINT *error_code, bool check_ssl_trust, char *post_data, + WPC_RECV_CALLBACK *recv_callback, void *recv_callback_param, void *sha1_cert_hash, UINT num_hashes, + bool *cancel, UINT max_recv_size, char *header_name, char *header_value); +SOCK *WpcSockConnect(WPC_CONNECT *param, UINT *error_code, UINT timeout); +SOCK *WpcSockConnectEx(WPC_CONNECT *param, UINT *error_code, UINT timeout, bool *cancel); +SOCK *WpcSockConnect2(char *hostname, UINT port, INTERNET_SETTING *t, UINT *error_code, UINT timeout); +INTERNET_SETTING *GetNullInternetSetting(); +void WpcAddDataEntry(BUF *b, char *name, void *data, UINT size); +void WpcAddDataEntryBin(BUF *b, char *name, void *data, UINT size); +void WpcFillEntryName(char *dst, char *name); +LIST *WpcParseDataEntry(BUF *b); +void WpcFreeDataEntryList(LIST *o); +WPC_ENTRY *WpcFindDataEntry(LIST *o, char *name); +BUF *WpcDataEntryToBuf(WPC_ENTRY *e); +BUF *WpcGeneratePacket(PACK *pack, X *cert, K *key); +bool WpcParsePacket(WPC_PACKET *packet, BUF *buf); +void WpcFreePacket(WPC_PACKET *packet); +PACK *WpcCall(char *url, INTERNET_SETTING *setting, UINT timeout_connect, UINT timeout_comm, + char *function_name, PACK *pack, X *cert, K *key, void *sha1_cert_hash); +PACK *WpcCallEx(char *url, INTERNET_SETTING *setting, UINT timeout_connect, UINT timeout_comm, + char *function_name, PACK *pack, X *cert, K *key, void *sha1_cert_hash, bool *cancel, UINT max_recv_size, + char *additional_header_name, char *additional_header_value); +PACK *WpcCallEx2(char *url, INTERNET_SETTING *setting, UINT timeout_connect, UINT timeout_comm, + char *function_name, PACK *pack, X *cert, K *key, void *sha1_cert_hash, UINT num_hashes, bool *cancel, UINT max_recv_size, + char *additional_header_name, char *additional_header_value, char *sni_string); +bool IsProxyPrivateIp(INTERNET_SETTING *s); + +#endif // WPC_H + + diff --git a/src/Cedar/netcfgn.h b/src/Cedar/netcfgn.h index 796f32be..a0f0ea9e 100644 --- a/src/Cedar/netcfgn.h +++ b/src/Cedar/netcfgn.h @@ -1,1335 +1,1335 @@ - - -/* this ALWAYS GENERATED file contains the definitions for the interfaces */ - - - /* File created by MIDL compiler version 7.00.0555 */ -/* Compiler settings for netcfgn.idl: - Oicf, W1, Zp8, env=Win32 (32b run), target_arch=X86 7.00.0555 - protocol : dce , ms_ext, c_ext, robust - error checks: allocation ref bounds_check enum stub_data - VC __declspec() decoration level: - __declspec(uuid()), __declspec(selectany), __declspec(novtable) - DECLSPEC_UUID(), MIDL_INTERFACE() -*/ -/* @@MIDL_FILE_HEADING( ) */ - -#pragma warning( disable: 4049 ) /* more than 64k source lines */ - - -/* verify that the version is high enough to compile this file*/ -#ifndef __REQUIRED_RPCNDR_H_VERSION__ -#define __REQUIRED_RPCNDR_H_VERSION__ 500 -#endif - -/* verify that the version is high enough to compile this file*/ -#ifndef __REQUIRED_RPCSAL_H_VERSION__ -#define __REQUIRED_RPCSAL_H_VERSION__ 100 -#endif - -#include "rpc.h" -#include "rpcndr.h" - -#ifndef __RPCNDR_H_VERSION__ -#error this stub requires an updated version of -#endif // __RPCNDR_H_VERSION__ - -#ifndef COM_NO_WINDOWS_H -#include "windows.h" -#include "ole2.h" -#endif /*COM_NO_WINDOWS_H*/ - -#ifndef __netcfgn_h__ -#define __netcfgn_h__ - -#if defined(_MSC_VER) && (_MSC_VER >= 1020) -#pragma once -#endif - -/* Forward Declarations */ - -#ifndef __INetCfgPnpReconfigCallback_FWD_DEFINED__ -#define __INetCfgPnpReconfigCallback_FWD_DEFINED__ -typedef interface INetCfgPnpReconfigCallback INetCfgPnpReconfigCallback; -#endif /* __INetCfgPnpReconfigCallback_FWD_DEFINED__ */ - - -#ifndef __INetCfgComponentControl_FWD_DEFINED__ -#define __INetCfgComponentControl_FWD_DEFINED__ -typedef interface INetCfgComponentControl INetCfgComponentControl; -#endif /* __INetCfgComponentControl_FWD_DEFINED__ */ - - -#ifndef __INetCfgComponentSetup_FWD_DEFINED__ -#define __INetCfgComponentSetup_FWD_DEFINED__ -typedef interface INetCfgComponentSetup INetCfgComponentSetup; -#endif /* __INetCfgComponentSetup_FWD_DEFINED__ */ - - -#ifndef __INetCfgComponentPropertyUi_FWD_DEFINED__ -#define __INetCfgComponentPropertyUi_FWD_DEFINED__ -typedef interface INetCfgComponentPropertyUi INetCfgComponentPropertyUi; -#endif /* __INetCfgComponentPropertyUi_FWD_DEFINED__ */ - - -#ifndef __INetCfgComponentNotifyBinding_FWD_DEFINED__ -#define __INetCfgComponentNotifyBinding_FWD_DEFINED__ -typedef interface INetCfgComponentNotifyBinding INetCfgComponentNotifyBinding; -#endif /* __INetCfgComponentNotifyBinding_FWD_DEFINED__ */ - - -#ifndef __INetCfgComponentNotifyGlobal_FWD_DEFINED__ -#define __INetCfgComponentNotifyGlobal_FWD_DEFINED__ -typedef interface INetCfgComponentNotifyGlobal INetCfgComponentNotifyGlobal; -#endif /* __INetCfgComponentNotifyGlobal_FWD_DEFINED__ */ - - -#ifndef __INetCfgComponentUpperEdge_FWD_DEFINED__ -#define __INetCfgComponentUpperEdge_FWD_DEFINED__ -typedef interface INetCfgComponentUpperEdge INetCfgComponentUpperEdge; -#endif /* __INetCfgComponentUpperEdge_FWD_DEFINED__ */ - - -#ifndef __INetLanConnectionUiInfo_FWD_DEFINED__ -#define __INetLanConnectionUiInfo_FWD_DEFINED__ -typedef interface INetLanConnectionUiInfo INetLanConnectionUiInfo; -#endif /* __INetLanConnectionUiInfo_FWD_DEFINED__ */ - - -#ifndef __INetRasConnectionIpUiInfo_FWD_DEFINED__ -#define __INetRasConnectionIpUiInfo_FWD_DEFINED__ -typedef interface INetRasConnectionIpUiInfo INetRasConnectionIpUiInfo; -#endif /* __INetRasConnectionIpUiInfo_FWD_DEFINED__ */ - - -#ifndef __INetCfgComponentSysPrep_FWD_DEFINED__ -#define __INetCfgComponentSysPrep_FWD_DEFINED__ -typedef interface INetCfgComponentSysPrep INetCfgComponentSysPrep; -#endif /* __INetCfgComponentSysPrep_FWD_DEFINED__ */ - - -/* header files for imported files */ -#include "unknwn.h" -#include "netcfgx.h" - -#ifdef __cplusplus -extern "C"{ -#endif - - -/* interface __MIDL_itf_netcfgn_0000_0000 */ -/* [local] */ - -//+------------------------------------------------------------------------- -// -// Microsoft Windows -// Copyright (c) Microsoft Corporation. All rights reserved. -// -//-------------------------------------------------------------------------- -#if ( _MSC_VER >= 800 ) -#pragma warning(disable:4201) -#endif - - -extern RPC_IF_HANDLE __MIDL_itf_netcfgn_0000_0000_v0_0_c_ifspec; -extern RPC_IF_HANDLE __MIDL_itf_netcfgn_0000_0000_v0_0_s_ifspec; - -#ifndef __INetCfgPnpReconfigCallback_INTERFACE_DEFINED__ -#define __INetCfgPnpReconfigCallback_INTERFACE_DEFINED__ - -/* interface INetCfgPnpReconfigCallback */ -/* [unique][uuid][object][local] */ - -typedef /* [v1_enum] */ -enum tagNCPNP_RECONFIG_LAYER - { NCRL_NDIS = 1, - NCRL_TDI = 2 - } NCPNP_RECONFIG_LAYER; - - -EXTERN_C const IID IID_INetCfgPnpReconfigCallback; - -#if defined(__cplusplus) && !defined(CINTERFACE) - - MIDL_INTERFACE("8d84bd35-e227-11d2-b700-00a0c98a6a85") - INetCfgPnpReconfigCallback : public IUnknown - { - public: - virtual HRESULT STDMETHODCALLTYPE SendPnpReconfig( - /* [annotation][in] */ - __in NCPNP_RECONFIG_LAYER Layer, - /* [annotation][in] */ - __in LPCWSTR pszwUpper, - /* [annotation][in] */ - __in LPCWSTR pszwLower, - /* [annotation][in] */ - __in_bcount(dwSizeOfData) PVOID pvData, - /* [annotation][in] */ - __in DWORD dwSizeOfData) = 0; - - }; - -#else /* C style interface */ - - typedef struct INetCfgPnpReconfigCallbackVtbl - { - BEGIN_INTERFACE - - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( - INetCfgPnpReconfigCallback * This, - /* [in] */ REFIID riid, - /* [annotation][iid_is][out] */ - __RPC__deref_out void **ppvObject); - - ULONG ( STDMETHODCALLTYPE *AddRef )( - INetCfgPnpReconfigCallback * This); - - ULONG ( STDMETHODCALLTYPE *Release )( - INetCfgPnpReconfigCallback * This); - - HRESULT ( STDMETHODCALLTYPE *SendPnpReconfig )( - INetCfgPnpReconfigCallback * This, - /* [annotation][in] */ - __in NCPNP_RECONFIG_LAYER Layer, - /* [annotation][in] */ - __in LPCWSTR pszwUpper, - /* [annotation][in] */ - __in LPCWSTR pszwLower, - /* [annotation][in] */ - __in_bcount(dwSizeOfData) PVOID pvData, - /* [annotation][in] */ - __in DWORD dwSizeOfData); - - END_INTERFACE - } INetCfgPnpReconfigCallbackVtbl; - - interface INetCfgPnpReconfigCallback - { - CONST_VTBL struct INetCfgPnpReconfigCallbackVtbl *lpVtbl; - }; - - - -#ifdef COBJMACROS - - -#define INetCfgPnpReconfigCallback_QueryInterface(This,riid,ppvObject) \ - ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) - -#define INetCfgPnpReconfigCallback_AddRef(This) \ - ( (This)->lpVtbl -> AddRef(This) ) - -#define INetCfgPnpReconfigCallback_Release(This) \ - ( (This)->lpVtbl -> Release(This) ) - - -#define INetCfgPnpReconfigCallback_SendPnpReconfig(This,Layer,pszwUpper,pszwLower,pvData,dwSizeOfData) \ - ( (This)->lpVtbl -> SendPnpReconfig(This,Layer,pszwUpper,pszwLower,pvData,dwSizeOfData) ) - -#endif /* COBJMACROS */ - - -#endif /* C style interface */ - - - - -#endif /* __INetCfgPnpReconfigCallback_INTERFACE_DEFINED__ */ - - -#ifndef __INetCfgComponentControl_INTERFACE_DEFINED__ -#define __INetCfgComponentControl_INTERFACE_DEFINED__ - -/* interface INetCfgComponentControl */ -/* [unique][uuid][object][local] */ - - -EXTERN_C const IID IID_INetCfgComponentControl; - -#if defined(__cplusplus) && !defined(CINTERFACE) - - MIDL_INTERFACE("932238df-bea1-11d0-9298-00c04fc99dcf") - INetCfgComponentControl : public IUnknown - { - public: - virtual HRESULT STDMETHODCALLTYPE Initialize( - /* [annotation][in] */ - __in INetCfgComponent *pIComp, - /* [annotation][in] */ - __in INetCfg *pINetCfg, - /* [annotation][in] */ - __in BOOL fInstalling) = 0; - - virtual HRESULT STDMETHODCALLTYPE ApplyRegistryChanges( void) = 0; - - virtual HRESULT STDMETHODCALLTYPE ApplyPnpChanges( - /* [annotation][in] */ - __in INetCfgPnpReconfigCallback *pICallback) = 0; - - virtual HRESULT STDMETHODCALLTYPE CancelChanges( void) = 0; - - }; - -#else /* C style interface */ - - typedef struct INetCfgComponentControlVtbl - { - BEGIN_INTERFACE - - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( - INetCfgComponentControl * This, - /* [in] */ REFIID riid, - /* [annotation][iid_is][out] */ - __RPC__deref_out void **ppvObject); - - ULONG ( STDMETHODCALLTYPE *AddRef )( - INetCfgComponentControl * This); - - ULONG ( STDMETHODCALLTYPE *Release )( - INetCfgComponentControl * This); - - HRESULT ( STDMETHODCALLTYPE *Initialize )( - INetCfgComponentControl * This, - /* [annotation][in] */ - __in INetCfgComponent *pIComp, - /* [annotation][in] */ - __in INetCfg *pINetCfg, - /* [annotation][in] */ - __in BOOL fInstalling); - - HRESULT ( STDMETHODCALLTYPE *ApplyRegistryChanges )( - INetCfgComponentControl * This); - - HRESULT ( STDMETHODCALLTYPE *ApplyPnpChanges )( - INetCfgComponentControl * This, - /* [annotation][in] */ - __in INetCfgPnpReconfigCallback *pICallback); - - HRESULT ( STDMETHODCALLTYPE *CancelChanges )( - INetCfgComponentControl * This); - - END_INTERFACE - } INetCfgComponentControlVtbl; - - interface INetCfgComponentControl - { - CONST_VTBL struct INetCfgComponentControlVtbl *lpVtbl; - }; - - - -#ifdef COBJMACROS - - -#define INetCfgComponentControl_QueryInterface(This,riid,ppvObject) \ - ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) - -#define INetCfgComponentControl_AddRef(This) \ - ( (This)->lpVtbl -> AddRef(This) ) - -#define INetCfgComponentControl_Release(This) \ - ( (This)->lpVtbl -> Release(This) ) - - -#define INetCfgComponentControl_Initialize(This,pIComp,pINetCfg,fInstalling) \ - ( (This)->lpVtbl -> Initialize(This,pIComp,pINetCfg,fInstalling) ) - -#define INetCfgComponentControl_ApplyRegistryChanges(This) \ - ( (This)->lpVtbl -> ApplyRegistryChanges(This) ) - -#define INetCfgComponentControl_ApplyPnpChanges(This,pICallback) \ - ( (This)->lpVtbl -> ApplyPnpChanges(This,pICallback) ) - -#define INetCfgComponentControl_CancelChanges(This) \ - ( (This)->lpVtbl -> CancelChanges(This) ) - -#endif /* COBJMACROS */ - - -#endif /* C style interface */ - - - - -#endif /* __INetCfgComponentControl_INTERFACE_DEFINED__ */ - - -#ifndef __INetCfgComponentSetup_INTERFACE_DEFINED__ -#define __INetCfgComponentSetup_INTERFACE_DEFINED__ - -/* interface INetCfgComponentSetup */ -/* [unique][uuid][object][local] */ - -typedef /* [v1_enum] */ -enum tagNETWORK_INSTALL_TIME - { NSF_PRIMARYINSTALL = 0x1, - NSF_POSTSYSINSTALL = 0x2 - } NETWORK_INSTALL_TIME; - -typedef /* [v1_enum] */ -enum tagNETWORK_UPGRADE_TYPE - { NSF_WIN16_UPGRADE = 0x10, - NSF_WIN95_UPGRADE = 0x20, - NSF_WINNT_WKS_UPGRADE = 0x40, - NSF_WINNT_SVR_UPGRADE = 0x80, - NSF_WINNT_SBS_UPGRADE = 0x100, - NSF_COMPONENT_UPDATE = 0x200 - } NETWORK_UPGRADE_TYPE; - - -EXTERN_C const IID IID_INetCfgComponentSetup; - -#if defined(__cplusplus) && !defined(CINTERFACE) - - MIDL_INTERFACE("932238e3-bea1-11d0-9298-00c04fc99dcf") - INetCfgComponentSetup : public IUnknown - { - public: - virtual HRESULT STDMETHODCALLTYPE Install( - /* [annotation][in] */ - __in DWORD dwSetupFlags) = 0; - - virtual HRESULT STDMETHODCALLTYPE Upgrade( - /* [annotation][in] */ - __in DWORD dwSetupFlags, - /* [annotation][in] */ - __in DWORD dwUpgradeFomBuildNo) = 0; - - virtual HRESULT STDMETHODCALLTYPE ReadAnswerFile( - /* [annotation][in] */ - __in LPCWSTR pszwAnswerFile, - /* [annotation][in] */ - __in LPCWSTR pszwAnswerSections) = 0; - - virtual HRESULT STDMETHODCALLTYPE Removing( void) = 0; - - }; - -#else /* C style interface */ - - typedef struct INetCfgComponentSetupVtbl - { - BEGIN_INTERFACE - - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( - INetCfgComponentSetup * This, - /* [in] */ REFIID riid, - /* [annotation][iid_is][out] */ - __RPC__deref_out void **ppvObject); - - ULONG ( STDMETHODCALLTYPE *AddRef )( - INetCfgComponentSetup * This); - - ULONG ( STDMETHODCALLTYPE *Release )( - INetCfgComponentSetup * This); - - HRESULT ( STDMETHODCALLTYPE *Install )( - INetCfgComponentSetup * This, - /* [annotation][in] */ - __in DWORD dwSetupFlags); - - HRESULT ( STDMETHODCALLTYPE *Upgrade )( - INetCfgComponentSetup * This, - /* [annotation][in] */ - __in DWORD dwSetupFlags, - /* [annotation][in] */ - __in DWORD dwUpgradeFomBuildNo); - - HRESULT ( STDMETHODCALLTYPE *ReadAnswerFile )( - INetCfgComponentSetup * This, - /* [annotation][in] */ - __in LPCWSTR pszwAnswerFile, - /* [annotation][in] */ - __in LPCWSTR pszwAnswerSections); - - HRESULT ( STDMETHODCALLTYPE *Removing )( - INetCfgComponentSetup * This); - - END_INTERFACE - } INetCfgComponentSetupVtbl; - - interface INetCfgComponentSetup - { - CONST_VTBL struct INetCfgComponentSetupVtbl *lpVtbl; - }; - - - -#ifdef COBJMACROS - - -#define INetCfgComponentSetup_QueryInterface(This,riid,ppvObject) \ - ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) - -#define INetCfgComponentSetup_AddRef(This) \ - ( (This)->lpVtbl -> AddRef(This) ) - -#define INetCfgComponentSetup_Release(This) \ - ( (This)->lpVtbl -> Release(This) ) - - -#define INetCfgComponentSetup_Install(This,dwSetupFlags) \ - ( (This)->lpVtbl -> Install(This,dwSetupFlags) ) - -#define INetCfgComponentSetup_Upgrade(This,dwSetupFlags,dwUpgradeFomBuildNo) \ - ( (This)->lpVtbl -> Upgrade(This,dwSetupFlags,dwUpgradeFomBuildNo) ) - -#define INetCfgComponentSetup_ReadAnswerFile(This,pszwAnswerFile,pszwAnswerSections) \ - ( (This)->lpVtbl -> ReadAnswerFile(This,pszwAnswerFile,pszwAnswerSections) ) - -#define INetCfgComponentSetup_Removing(This) \ - ( (This)->lpVtbl -> Removing(This) ) - -#endif /* COBJMACROS */ - - -#endif /* C style interface */ - - - - -#endif /* __INetCfgComponentSetup_INTERFACE_DEFINED__ */ - - -#ifndef __INetCfgComponentPropertyUi_INTERFACE_DEFINED__ -#define __INetCfgComponentPropertyUi_INTERFACE_DEFINED__ - -/* interface INetCfgComponentPropertyUi */ -/* [unique][uuid][object][local] */ - -typedef /* [v1_enum] */ -enum tagDEFAULT_PAGES - { DPP_ADVANCED = 1 - } DEFAULT_PAGES; - - -EXTERN_C const IID IID_INetCfgComponentPropertyUi; - -#if defined(__cplusplus) && !defined(CINTERFACE) - - MIDL_INTERFACE("932238e0-bea1-11d0-9298-00c04fc99dcf") - INetCfgComponentPropertyUi : public IUnknown - { - public: - virtual HRESULT STDMETHODCALLTYPE QueryPropertyUi( - /* [annotation][in] */ - __in IUnknown *pUnkReserved) = 0; - - virtual HRESULT STDMETHODCALLTYPE SetContext( - /* [annotation][in] */ - __in IUnknown *pUnkReserved) = 0; - - virtual HRESULT STDMETHODCALLTYPE MergePropPages( - /* [annotation][out][in] */ - __inout DWORD *pdwDefPages, - /* [annotation][out] */ - __out BYTE **pahpspPrivate, - /* [annotation][out] */ - __out UINT *pcPages, - /* [annotation][in] */ - __in HWND hwndParent, - /* [annotation][in] */ - __in_opt LPCWSTR *pszStartPage) = 0; - - virtual HRESULT STDMETHODCALLTYPE ValidateProperties( - /* [annotation][in] */ - __in HWND hwndSheet) = 0; - - virtual HRESULT STDMETHODCALLTYPE ApplyProperties( void) = 0; - - virtual HRESULT STDMETHODCALLTYPE CancelProperties( void) = 0; - - }; - -#else /* C style interface */ - - typedef struct INetCfgComponentPropertyUiVtbl - { - BEGIN_INTERFACE - - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( - INetCfgComponentPropertyUi * This, - /* [in] */ REFIID riid, - /* [annotation][iid_is][out] */ - __RPC__deref_out void **ppvObject); - - ULONG ( STDMETHODCALLTYPE *AddRef )( - INetCfgComponentPropertyUi * This); - - ULONG ( STDMETHODCALLTYPE *Release )( - INetCfgComponentPropertyUi * This); - - HRESULT ( STDMETHODCALLTYPE *QueryPropertyUi )( - INetCfgComponentPropertyUi * This, - /* [annotation][in] */ - __in IUnknown *pUnkReserved); - - HRESULT ( STDMETHODCALLTYPE *SetContext )( - INetCfgComponentPropertyUi * This, - /* [annotation][in] */ - __in IUnknown *pUnkReserved); - - HRESULT ( STDMETHODCALLTYPE *MergePropPages )( - INetCfgComponentPropertyUi * This, - /* [annotation][out][in] */ - __inout DWORD *pdwDefPages, - /* [annotation][out] */ - __out BYTE **pahpspPrivate, - /* [annotation][out] */ - __out UINT *pcPages, - /* [annotation][in] */ - __in HWND hwndParent, - /* [annotation][in] */ - __in_opt LPCWSTR *pszStartPage); - - HRESULT ( STDMETHODCALLTYPE *ValidateProperties )( - INetCfgComponentPropertyUi * This, - /* [annotation][in] */ - __in HWND hwndSheet); - - HRESULT ( STDMETHODCALLTYPE *ApplyProperties )( - INetCfgComponentPropertyUi * This); - - HRESULT ( STDMETHODCALLTYPE *CancelProperties )( - INetCfgComponentPropertyUi * This); - - END_INTERFACE - } INetCfgComponentPropertyUiVtbl; - - interface INetCfgComponentPropertyUi - { - CONST_VTBL struct INetCfgComponentPropertyUiVtbl *lpVtbl; - }; - - - -#ifdef COBJMACROS - - -#define INetCfgComponentPropertyUi_QueryInterface(This,riid,ppvObject) \ - ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) - -#define INetCfgComponentPropertyUi_AddRef(This) \ - ( (This)->lpVtbl -> AddRef(This) ) - -#define INetCfgComponentPropertyUi_Release(This) \ - ( (This)->lpVtbl -> Release(This) ) - - -#define INetCfgComponentPropertyUi_QueryPropertyUi(This,pUnkReserved) \ - ( (This)->lpVtbl -> QueryPropertyUi(This,pUnkReserved) ) - -#define INetCfgComponentPropertyUi_SetContext(This,pUnkReserved) \ - ( (This)->lpVtbl -> SetContext(This,pUnkReserved) ) - -#define INetCfgComponentPropertyUi_MergePropPages(This,pdwDefPages,pahpspPrivate,pcPages,hwndParent,pszStartPage) \ - ( (This)->lpVtbl -> MergePropPages(This,pdwDefPages,pahpspPrivate,pcPages,hwndParent,pszStartPage) ) - -#define INetCfgComponentPropertyUi_ValidateProperties(This,hwndSheet) \ - ( (This)->lpVtbl -> ValidateProperties(This,hwndSheet) ) - -#define INetCfgComponentPropertyUi_ApplyProperties(This) \ - ( (This)->lpVtbl -> ApplyProperties(This) ) - -#define INetCfgComponentPropertyUi_CancelProperties(This) \ - ( (This)->lpVtbl -> CancelProperties(This) ) - -#endif /* COBJMACROS */ - - -#endif /* C style interface */ - - - - -#endif /* __INetCfgComponentPropertyUi_INTERFACE_DEFINED__ */ - - -#ifndef __INetCfgComponentNotifyBinding_INTERFACE_DEFINED__ -#define __INetCfgComponentNotifyBinding_INTERFACE_DEFINED__ - -/* interface INetCfgComponentNotifyBinding */ -/* [unique][uuid][object][local] */ - -typedef /* [v1_enum] */ -enum tagBIND_FLAGS1 - { NCN_ADD = 0x1, - NCN_REMOVE = 0x2, - NCN_UPDATE = 0x4, - NCN_ENABLE = 0x10, - NCN_DISABLE = 0x20, - NCN_BINDING_PATH = 0x100, - NCN_PROPERTYCHANGE = 0x200, - NCN_NET = 0x10000, - NCN_NETTRANS = 0x20000, - NCN_NETCLIENT = 0x40000, - NCN_NETSERVICE = 0x80000 - } BIND_FLAGS1; - - -EXTERN_C const IID IID_INetCfgComponentNotifyBinding; - -#if defined(__cplusplus) && !defined(CINTERFACE) - - MIDL_INTERFACE("932238e1-bea1-11d0-9298-00c04fc99dcf") - INetCfgComponentNotifyBinding : public IUnknown - { - public: - virtual HRESULT STDMETHODCALLTYPE QueryBindingPath( - /* [annotation][in] */ - __in DWORD dwChangeFlag, - /* [annotation][in] */ - __in INetCfgBindingPath *pIPath) = 0; - - virtual HRESULT STDMETHODCALLTYPE NotifyBindingPath( - /* [annotation][in] */ - __in DWORD dwChangeFlag, - /* [annotation][in] */ - __in INetCfgBindingPath *pIPath) = 0; - - }; - -#else /* C style interface */ - - typedef struct INetCfgComponentNotifyBindingVtbl - { - BEGIN_INTERFACE - - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( - INetCfgComponentNotifyBinding * This, - /* [in] */ REFIID riid, - /* [annotation][iid_is][out] */ - __RPC__deref_out void **ppvObject); - - ULONG ( STDMETHODCALLTYPE *AddRef )( - INetCfgComponentNotifyBinding * This); - - ULONG ( STDMETHODCALLTYPE *Release )( - INetCfgComponentNotifyBinding * This); - - HRESULT ( STDMETHODCALLTYPE *QueryBindingPath )( - INetCfgComponentNotifyBinding * This, - /* [annotation][in] */ - __in DWORD dwChangeFlag, - /* [annotation][in] */ - __in INetCfgBindingPath *pIPath); - - HRESULT ( STDMETHODCALLTYPE *NotifyBindingPath )( - INetCfgComponentNotifyBinding * This, - /* [annotation][in] */ - __in DWORD dwChangeFlag, - /* [annotation][in] */ - __in INetCfgBindingPath *pIPath); - - END_INTERFACE - } INetCfgComponentNotifyBindingVtbl; - - interface INetCfgComponentNotifyBinding - { - CONST_VTBL struct INetCfgComponentNotifyBindingVtbl *lpVtbl; - }; - - - -#ifdef COBJMACROS - - -#define INetCfgComponentNotifyBinding_QueryInterface(This,riid,ppvObject) \ - ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) - -#define INetCfgComponentNotifyBinding_AddRef(This) \ - ( (This)->lpVtbl -> AddRef(This) ) - -#define INetCfgComponentNotifyBinding_Release(This) \ - ( (This)->lpVtbl -> Release(This) ) - - -#define INetCfgComponentNotifyBinding_QueryBindingPath(This,dwChangeFlag,pIPath) \ - ( (This)->lpVtbl -> QueryBindingPath(This,dwChangeFlag,pIPath) ) - -#define INetCfgComponentNotifyBinding_NotifyBindingPath(This,dwChangeFlag,pIPath) \ - ( (This)->lpVtbl -> NotifyBindingPath(This,dwChangeFlag,pIPath) ) - -#endif /* COBJMACROS */ - - -#endif /* C style interface */ - - - - -#endif /* __INetCfgComponentNotifyBinding_INTERFACE_DEFINED__ */ - - -#ifndef __INetCfgComponentNotifyGlobal_INTERFACE_DEFINED__ -#define __INetCfgComponentNotifyGlobal_INTERFACE_DEFINED__ - -/* interface INetCfgComponentNotifyGlobal */ -/* [unique][uuid][object][local] */ - - -EXTERN_C const IID IID_INetCfgComponentNotifyGlobal; - -#if defined(__cplusplus) && !defined(CINTERFACE) - - MIDL_INTERFACE("932238e2-bea1-11d0-9298-00c04fc99dcf") - INetCfgComponentNotifyGlobal : public IUnknown - { - public: - virtual HRESULT STDMETHODCALLTYPE GetSupportedNotifications( - /* [annotation][out] */ - __out DWORD *dwNotifications) = 0; - - virtual HRESULT STDMETHODCALLTYPE SysQueryBindingPath( - /* [annotation][in] */ - __in DWORD dwChangeFlag, - /* [annotation][in] */ - __in INetCfgBindingPath *pIPath) = 0; - - virtual HRESULT STDMETHODCALLTYPE SysNotifyBindingPath( - /* [annotation][in] */ - __in DWORD dwChangeFlag, - /* [annotation][in] */ - __in INetCfgBindingPath *pIPath) = 0; - - virtual HRESULT STDMETHODCALLTYPE SysNotifyComponent( - /* [annotation][in] */ - __in DWORD dwChangeFlag, - /* [annotation][in] */ - __in INetCfgComponent *pIComp) = 0; - - }; - -#else /* C style interface */ - - typedef struct INetCfgComponentNotifyGlobalVtbl - { - BEGIN_INTERFACE - - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( - INetCfgComponentNotifyGlobal * This, - /* [in] */ REFIID riid, - /* [annotation][iid_is][out] */ - __RPC__deref_out void **ppvObject); - - ULONG ( STDMETHODCALLTYPE *AddRef )( - INetCfgComponentNotifyGlobal * This); - - ULONG ( STDMETHODCALLTYPE *Release )( - INetCfgComponentNotifyGlobal * This); - - HRESULT ( STDMETHODCALLTYPE *GetSupportedNotifications )( - INetCfgComponentNotifyGlobal * This, - /* [annotation][out] */ - __out DWORD *dwNotifications); - - HRESULT ( STDMETHODCALLTYPE *SysQueryBindingPath )( - INetCfgComponentNotifyGlobal * This, - /* [annotation][in] */ - __in DWORD dwChangeFlag, - /* [annotation][in] */ - __in INetCfgBindingPath *pIPath); - - HRESULT ( STDMETHODCALLTYPE *SysNotifyBindingPath )( - INetCfgComponentNotifyGlobal * This, - /* [annotation][in] */ - __in DWORD dwChangeFlag, - /* [annotation][in] */ - __in INetCfgBindingPath *pIPath); - - HRESULT ( STDMETHODCALLTYPE *SysNotifyComponent )( - INetCfgComponentNotifyGlobal * This, - /* [annotation][in] */ - __in DWORD dwChangeFlag, - /* [annotation][in] */ - __in INetCfgComponent *pIComp); - - END_INTERFACE - } INetCfgComponentNotifyGlobalVtbl; - - interface INetCfgComponentNotifyGlobal - { - CONST_VTBL struct INetCfgComponentNotifyGlobalVtbl *lpVtbl; - }; - - - -#ifdef COBJMACROS - - -#define INetCfgComponentNotifyGlobal_QueryInterface(This,riid,ppvObject) \ - ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) - -#define INetCfgComponentNotifyGlobal_AddRef(This) \ - ( (This)->lpVtbl -> AddRef(This) ) - -#define INetCfgComponentNotifyGlobal_Release(This) \ - ( (This)->lpVtbl -> Release(This) ) - - -#define INetCfgComponentNotifyGlobal_GetSupportedNotifications(This,dwNotifications) \ - ( (This)->lpVtbl -> GetSupportedNotifications(This,dwNotifications) ) - -#define INetCfgComponentNotifyGlobal_SysQueryBindingPath(This,dwChangeFlag,pIPath) \ - ( (This)->lpVtbl -> SysQueryBindingPath(This,dwChangeFlag,pIPath) ) - -#define INetCfgComponentNotifyGlobal_SysNotifyBindingPath(This,dwChangeFlag,pIPath) \ - ( (This)->lpVtbl -> SysNotifyBindingPath(This,dwChangeFlag,pIPath) ) - -#define INetCfgComponentNotifyGlobal_SysNotifyComponent(This,dwChangeFlag,pIComp) \ - ( (This)->lpVtbl -> SysNotifyComponent(This,dwChangeFlag,pIComp) ) - -#endif /* COBJMACROS */ - - -#endif /* C style interface */ - - - - -#endif /* __INetCfgComponentNotifyGlobal_INTERFACE_DEFINED__ */ - - -#ifndef __INetCfgComponentUpperEdge_INTERFACE_DEFINED__ -#define __INetCfgComponentUpperEdge_INTERFACE_DEFINED__ - -/* interface INetCfgComponentUpperEdge */ -/* [unique][uuid][object][local] */ - - -EXTERN_C const IID IID_INetCfgComponentUpperEdge; - -#if defined(__cplusplus) && !defined(CINTERFACE) - - MIDL_INTERFACE("932238e4-bea1-11d0-9298-00c04fc99dcf") - INetCfgComponentUpperEdge : public IUnknown - { - public: - virtual HRESULT STDMETHODCALLTYPE GetInterfaceIdsForAdapter( - /* [annotation][in] */ - __in INetCfgComponent *pAdapter, - /* [annotation][out] */ - __out DWORD *pdwNumInterfaces, - /* [annotation][out] */ - __deref_out_opt GUID **ppguidInterfaceIds) = 0; - - virtual HRESULT STDMETHODCALLTYPE AddInterfacesToAdapter( - /* [annotation][in] */ - __in INetCfgComponent *pAdapter, - /* [annotation][in] */ - __in DWORD dwNumInterfaces) = 0; - - virtual HRESULT STDMETHODCALLTYPE RemoveInterfacesFromAdapter( - /* [annotation][in] */ - __in INetCfgComponent *pAdapter, - /* [annotation][in] */ - __in DWORD dwNumInterfaces, - /* [annotation][in] */ - __in const GUID *pguidInterfaceIds) = 0; - - }; - -#else /* C style interface */ - - typedef struct INetCfgComponentUpperEdgeVtbl - { - BEGIN_INTERFACE - - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( - INetCfgComponentUpperEdge * This, - /* [in] */ REFIID riid, - /* [annotation][iid_is][out] */ - __RPC__deref_out void **ppvObject); - - ULONG ( STDMETHODCALLTYPE *AddRef )( - INetCfgComponentUpperEdge * This); - - ULONG ( STDMETHODCALLTYPE *Release )( - INetCfgComponentUpperEdge * This); - - HRESULT ( STDMETHODCALLTYPE *GetInterfaceIdsForAdapter )( - INetCfgComponentUpperEdge * This, - /* [annotation][in] */ - __in INetCfgComponent *pAdapter, - /* [annotation][out] */ - __out DWORD *pdwNumInterfaces, - /* [annotation][out] */ - __deref_out_opt GUID **ppguidInterfaceIds); - - HRESULT ( STDMETHODCALLTYPE *AddInterfacesToAdapter )( - INetCfgComponentUpperEdge * This, - /* [annotation][in] */ - __in INetCfgComponent *pAdapter, - /* [annotation][in] */ - __in DWORD dwNumInterfaces); - - HRESULT ( STDMETHODCALLTYPE *RemoveInterfacesFromAdapter )( - INetCfgComponentUpperEdge * This, - /* [annotation][in] */ - __in INetCfgComponent *pAdapter, - /* [annotation][in] */ - __in DWORD dwNumInterfaces, - /* [annotation][in] */ - __in const GUID *pguidInterfaceIds); - - END_INTERFACE - } INetCfgComponentUpperEdgeVtbl; - - interface INetCfgComponentUpperEdge - { - CONST_VTBL struct INetCfgComponentUpperEdgeVtbl *lpVtbl; - }; - - - -#ifdef COBJMACROS - - -#define INetCfgComponentUpperEdge_QueryInterface(This,riid,ppvObject) \ - ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) - -#define INetCfgComponentUpperEdge_AddRef(This) \ - ( (This)->lpVtbl -> AddRef(This) ) - -#define INetCfgComponentUpperEdge_Release(This) \ - ( (This)->lpVtbl -> Release(This) ) - - -#define INetCfgComponentUpperEdge_GetInterfaceIdsForAdapter(This,pAdapter,pdwNumInterfaces,ppguidInterfaceIds) \ - ( (This)->lpVtbl -> GetInterfaceIdsForAdapter(This,pAdapter,pdwNumInterfaces,ppguidInterfaceIds) ) - -#define INetCfgComponentUpperEdge_AddInterfacesToAdapter(This,pAdapter,dwNumInterfaces) \ - ( (This)->lpVtbl -> AddInterfacesToAdapter(This,pAdapter,dwNumInterfaces) ) - -#define INetCfgComponentUpperEdge_RemoveInterfacesFromAdapter(This,pAdapter,dwNumInterfaces,pguidInterfaceIds) \ - ( (This)->lpVtbl -> RemoveInterfacesFromAdapter(This,pAdapter,dwNumInterfaces,pguidInterfaceIds) ) - -#endif /* COBJMACROS */ - - -#endif /* C style interface */ - - - - -#endif /* __INetCfgComponentUpperEdge_INTERFACE_DEFINED__ */ - - -#ifndef __INetLanConnectionUiInfo_INTERFACE_DEFINED__ -#define __INetLanConnectionUiInfo_INTERFACE_DEFINED__ - -/* interface INetLanConnectionUiInfo */ -/* [unique][uuid][object] */ - - -EXTERN_C const IID IID_INetLanConnectionUiInfo; - -#if defined(__cplusplus) && !defined(CINTERFACE) - - MIDL_INTERFACE("C08956A6-1CD3-11D1-B1C5-00805FC1270E") - INetLanConnectionUiInfo : public IUnknown - { - public: - virtual HRESULT STDMETHODCALLTYPE GetDeviceGuid( - /* [out] */ __RPC__out GUID *pguid) = 0; - - }; - -#else /* C style interface */ - - typedef struct INetLanConnectionUiInfoVtbl - { - BEGIN_INTERFACE - - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( - __RPC__in INetLanConnectionUiInfo * This, - /* [in] */ __RPC__in REFIID riid, - /* [annotation][iid_is][out] */ - __RPC__deref_out void **ppvObject); - - ULONG ( STDMETHODCALLTYPE *AddRef )( - __RPC__in INetLanConnectionUiInfo * This); - - ULONG ( STDMETHODCALLTYPE *Release )( - __RPC__in INetLanConnectionUiInfo * This); - - HRESULT ( STDMETHODCALLTYPE *GetDeviceGuid )( - __RPC__in INetLanConnectionUiInfo * This, - /* [out] */ __RPC__out GUID *pguid); - - END_INTERFACE - } INetLanConnectionUiInfoVtbl; - - interface INetLanConnectionUiInfo - { - CONST_VTBL struct INetLanConnectionUiInfoVtbl *lpVtbl; - }; - - - -#ifdef COBJMACROS - - -#define INetLanConnectionUiInfo_QueryInterface(This,riid,ppvObject) \ - ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) - -#define INetLanConnectionUiInfo_AddRef(This) \ - ( (This)->lpVtbl -> AddRef(This) ) - -#define INetLanConnectionUiInfo_Release(This) \ - ( (This)->lpVtbl -> Release(This) ) - - -#define INetLanConnectionUiInfo_GetDeviceGuid(This,pguid) \ - ( (This)->lpVtbl -> GetDeviceGuid(This,pguid) ) - -#endif /* COBJMACROS */ - - -#endif /* C style interface */ - - - - -#endif /* __INetLanConnectionUiInfo_INTERFACE_DEFINED__ */ - - -#ifndef __INetRasConnectionIpUiInfo_INTERFACE_DEFINED__ -#define __INetRasConnectionIpUiInfo_INTERFACE_DEFINED__ - -/* interface INetRasConnectionIpUiInfo */ -/* [unique][uuid][object] */ - -typedef -enum tagRASCON_IPUI_FLAGS - { RCUIF_VPN = 0x1, - RCUIF_DEMAND_DIAL = 0x2, - RCUIF_NOT_ADMIN = 0x4, - RCUIF_USE_IPv4_STATICADDRESS = 0x8, - RCUIF_USE_IPv4_NAME_SERVERS = 0x10, - RCUIF_USE_IPv4_REMOTE_GATEWAY = 0x20, - RCUIF_USE_IPv4_EXPLICIT_METRIC = 0x40, - RCUIF_USE_HEADER_COMPRESSION = 0x80, - RCUIF_USE_DISABLE_REGISTER_DNS = 0x100, - RCUIF_USE_PRIVATE_DNS_SUFFIX = 0x200, - RCUIF_ENABLE_NBT = 0x400, - RCUIF_USE_IPv6_STATICADDRESS = 0x800, - RCUIF_USE_IPv6_NAME_SERVERS = 0x1000, - RCUIF_USE_IPv6_REMOTE_GATEWAY = 0x2000, - RCUIF_USE_IPv6_EXPLICIT_METRIC = 0x4000, - RCUIF_DISABLE_CLASS_BASED_ROUTE = 0x8000 - } RASCON_UIINFO_FLAGS; - -typedef struct tagRASCON_IPUI - { - GUID guidConnection; - BOOL fIPv6Cfg; - DWORD dwFlags; - WCHAR pszwIpAddr[ 16 ]; - WCHAR pszwDnsAddr[ 16 ]; - WCHAR pszwDns2Addr[ 16 ]; - WCHAR pszwWinsAddr[ 16 ]; - WCHAR pszwWins2Addr[ 16 ]; - WCHAR pszwDnsSuffix[ 256 ]; - WCHAR pszwIpv6Addr[ 65 ]; - DWORD dwIpv6PrefixLength; - WCHAR pszwIpv6DnsAddr[ 65 ]; - WCHAR pszwIpv6Dns2Addr[ 65 ]; - DWORD dwIPv4InfMetric; - DWORD dwIPv6InfMetric; - } RASCON_IPUI; - - -EXTERN_C const IID IID_INetRasConnectionIpUiInfo; - -#if defined(__cplusplus) && !defined(CINTERFACE) - - MIDL_INTERFACE("FAEDCF58-31FE-11D1-AAD2-00805FC1270E") - INetRasConnectionIpUiInfo : public IUnknown - { - public: - virtual HRESULT STDMETHODCALLTYPE GetUiInfo( - /* [out] */ __RPC__out RASCON_IPUI *pInfo) = 0; - - }; - -#else /* C style interface */ - - typedef struct INetRasConnectionIpUiInfoVtbl - { - BEGIN_INTERFACE - - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( - __RPC__in INetRasConnectionIpUiInfo * This, - /* [in] */ __RPC__in REFIID riid, - /* [annotation][iid_is][out] */ - __RPC__deref_out void **ppvObject); - - ULONG ( STDMETHODCALLTYPE *AddRef )( - __RPC__in INetRasConnectionIpUiInfo * This); - - ULONG ( STDMETHODCALLTYPE *Release )( - __RPC__in INetRasConnectionIpUiInfo * This); - - HRESULT ( STDMETHODCALLTYPE *GetUiInfo )( - __RPC__in INetRasConnectionIpUiInfo * This, - /* [out] */ __RPC__out RASCON_IPUI *pInfo); - - END_INTERFACE - } INetRasConnectionIpUiInfoVtbl; - - interface INetRasConnectionIpUiInfo - { - CONST_VTBL struct INetRasConnectionIpUiInfoVtbl *lpVtbl; - }; - - - -#ifdef COBJMACROS - - -#define INetRasConnectionIpUiInfo_QueryInterface(This,riid,ppvObject) \ - ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) - -#define INetRasConnectionIpUiInfo_AddRef(This) \ - ( (This)->lpVtbl -> AddRef(This) ) - -#define INetRasConnectionIpUiInfo_Release(This) \ - ( (This)->lpVtbl -> Release(This) ) - - -#define INetRasConnectionIpUiInfo_GetUiInfo(This,pInfo) \ - ( (This)->lpVtbl -> GetUiInfo(This,pInfo) ) - -#endif /* COBJMACROS */ - - -#endif /* C style interface */ - - - - -#endif /* __INetRasConnectionIpUiInfo_INTERFACE_DEFINED__ */ - - -#ifndef __INetCfgComponentSysPrep_INTERFACE_DEFINED__ -#define __INetCfgComponentSysPrep_INTERFACE_DEFINED__ - -/* interface INetCfgComponentSysPrep */ -/* [unique][uuid][object][local] */ - - -EXTERN_C const IID IID_INetCfgComponentSysPrep; - -#if defined(__cplusplus) && !defined(CINTERFACE) - - MIDL_INTERFACE("C0E8AE9A-306E-11D1-AACF-00805FC1270E") - INetCfgComponentSysPrep : public IUnknown - { - public: - virtual HRESULT STDMETHODCALLTYPE SaveAdapterParameters( - /* [annotation][in] */ - __in INetCfgSysPrep *pncsp, - /* [annotation][in] */ - __in LPCWSTR pszwAnswerSections, - /* [annotation][in] */ - __in GUID *pAdapterInstanceGuid) = 0; - - virtual HRESULT STDMETHODCALLTYPE RestoreAdapterParameters( - /* [annotation][in] */ - __in LPCWSTR pszwAnswerFile, - /* [annotation][in] */ - __in LPCWSTR pszwAnswerSection, - /* [annotation][in] */ - __in GUID *pAdapterInstanceGuid) = 0; - - }; - -#else /* C style interface */ - - typedef struct INetCfgComponentSysPrepVtbl - { - BEGIN_INTERFACE - - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( - INetCfgComponentSysPrep * This, - /* [in] */ REFIID riid, - /* [annotation][iid_is][out] */ - __RPC__deref_out void **ppvObject); - - ULONG ( STDMETHODCALLTYPE *AddRef )( - INetCfgComponentSysPrep * This); - - ULONG ( STDMETHODCALLTYPE *Release )( - INetCfgComponentSysPrep * This); - - HRESULT ( STDMETHODCALLTYPE *SaveAdapterParameters )( - INetCfgComponentSysPrep * This, - /* [annotation][in] */ - __in INetCfgSysPrep *pncsp, - /* [annotation][in] */ - __in LPCWSTR pszwAnswerSections, - /* [annotation][in] */ - __in GUID *pAdapterInstanceGuid); - - HRESULT ( STDMETHODCALLTYPE *RestoreAdapterParameters )( - INetCfgComponentSysPrep * This, - /* [annotation][in] */ - __in LPCWSTR pszwAnswerFile, - /* [annotation][in] */ - __in LPCWSTR pszwAnswerSection, - /* [annotation][in] */ - __in GUID *pAdapterInstanceGuid); - - END_INTERFACE - } INetCfgComponentSysPrepVtbl; - - interface INetCfgComponentSysPrep - { - CONST_VTBL struct INetCfgComponentSysPrepVtbl *lpVtbl; - }; - - - -#ifdef COBJMACROS - - -#define INetCfgComponentSysPrep_QueryInterface(This,riid,ppvObject) \ - ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) - -#define INetCfgComponentSysPrep_AddRef(This) \ - ( (This)->lpVtbl -> AddRef(This) ) - -#define INetCfgComponentSysPrep_Release(This) \ - ( (This)->lpVtbl -> Release(This) ) - - -#define INetCfgComponentSysPrep_SaveAdapterParameters(This,pncsp,pszwAnswerSections,pAdapterInstanceGuid) \ - ( (This)->lpVtbl -> SaveAdapterParameters(This,pncsp,pszwAnswerSections,pAdapterInstanceGuid) ) - -#define INetCfgComponentSysPrep_RestoreAdapterParameters(This,pszwAnswerFile,pszwAnswerSection,pAdapterInstanceGuid) \ - ( (This)->lpVtbl -> RestoreAdapterParameters(This,pszwAnswerFile,pszwAnswerSection,pAdapterInstanceGuid) ) - -#endif /* COBJMACROS */ - - -#endif /* C style interface */ - - - - -#endif /* __INetCfgComponentSysPrep_INTERFACE_DEFINED__ */ - - -/* Additional Prototypes for ALL interfaces */ - -/* end of Additional Prototypes */ - -#ifdef __cplusplus -} -#endif - -#endif - - - + + +/* this ALWAYS GENERATED file contains the definitions for the interfaces */ + + + /* File created by MIDL compiler version 7.00.0555 */ +/* Compiler settings for netcfgn.idl: + Oicf, W1, Zp8, env=Win32 (32b run), target_arch=X86 7.00.0555 + protocol : dce , ms_ext, c_ext, robust + error checks: allocation ref bounds_check enum stub_data + VC __declspec() decoration level: + __declspec(uuid()), __declspec(selectany), __declspec(novtable) + DECLSPEC_UUID(), MIDL_INTERFACE() +*/ +/* @@MIDL_FILE_HEADING( ) */ + +#pragma warning( disable: 4049 ) /* more than 64k source lines */ + + +/* verify that the version is high enough to compile this file*/ +#ifndef __REQUIRED_RPCNDR_H_VERSION__ +#define __REQUIRED_RPCNDR_H_VERSION__ 500 +#endif + +/* verify that the version is high enough to compile this file*/ +#ifndef __REQUIRED_RPCSAL_H_VERSION__ +#define __REQUIRED_RPCSAL_H_VERSION__ 100 +#endif + +#include "rpc.h" +#include "rpcndr.h" + +#ifndef __RPCNDR_H_VERSION__ +#error this stub requires an updated version of +#endif // __RPCNDR_H_VERSION__ + +#ifndef COM_NO_WINDOWS_H +#include "windows.h" +#include "ole2.h" +#endif /*COM_NO_WINDOWS_H*/ + +#ifndef __netcfgn_h__ +#define __netcfgn_h__ + +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +#pragma once +#endif + +/* Forward Declarations */ + +#ifndef __INetCfgPnpReconfigCallback_FWD_DEFINED__ +#define __INetCfgPnpReconfigCallback_FWD_DEFINED__ +typedef interface INetCfgPnpReconfigCallback INetCfgPnpReconfigCallback; +#endif /* __INetCfgPnpReconfigCallback_FWD_DEFINED__ */ + + +#ifndef __INetCfgComponentControl_FWD_DEFINED__ +#define __INetCfgComponentControl_FWD_DEFINED__ +typedef interface INetCfgComponentControl INetCfgComponentControl; +#endif /* __INetCfgComponentControl_FWD_DEFINED__ */ + + +#ifndef __INetCfgComponentSetup_FWD_DEFINED__ +#define __INetCfgComponentSetup_FWD_DEFINED__ +typedef interface INetCfgComponentSetup INetCfgComponentSetup; +#endif /* __INetCfgComponentSetup_FWD_DEFINED__ */ + + +#ifndef __INetCfgComponentPropertyUi_FWD_DEFINED__ +#define __INetCfgComponentPropertyUi_FWD_DEFINED__ +typedef interface INetCfgComponentPropertyUi INetCfgComponentPropertyUi; +#endif /* __INetCfgComponentPropertyUi_FWD_DEFINED__ */ + + +#ifndef __INetCfgComponentNotifyBinding_FWD_DEFINED__ +#define __INetCfgComponentNotifyBinding_FWD_DEFINED__ +typedef interface INetCfgComponentNotifyBinding INetCfgComponentNotifyBinding; +#endif /* __INetCfgComponentNotifyBinding_FWD_DEFINED__ */ + + +#ifndef __INetCfgComponentNotifyGlobal_FWD_DEFINED__ +#define __INetCfgComponentNotifyGlobal_FWD_DEFINED__ +typedef interface INetCfgComponentNotifyGlobal INetCfgComponentNotifyGlobal; +#endif /* __INetCfgComponentNotifyGlobal_FWD_DEFINED__ */ + + +#ifndef __INetCfgComponentUpperEdge_FWD_DEFINED__ +#define __INetCfgComponentUpperEdge_FWD_DEFINED__ +typedef interface INetCfgComponentUpperEdge INetCfgComponentUpperEdge; +#endif /* __INetCfgComponentUpperEdge_FWD_DEFINED__ */ + + +#ifndef __INetLanConnectionUiInfo_FWD_DEFINED__ +#define __INetLanConnectionUiInfo_FWD_DEFINED__ +typedef interface INetLanConnectionUiInfo INetLanConnectionUiInfo; +#endif /* __INetLanConnectionUiInfo_FWD_DEFINED__ */ + + +#ifndef __INetRasConnectionIpUiInfo_FWD_DEFINED__ +#define __INetRasConnectionIpUiInfo_FWD_DEFINED__ +typedef interface INetRasConnectionIpUiInfo INetRasConnectionIpUiInfo; +#endif /* __INetRasConnectionIpUiInfo_FWD_DEFINED__ */ + + +#ifndef __INetCfgComponentSysPrep_FWD_DEFINED__ +#define __INetCfgComponentSysPrep_FWD_DEFINED__ +typedef interface INetCfgComponentSysPrep INetCfgComponentSysPrep; +#endif /* __INetCfgComponentSysPrep_FWD_DEFINED__ */ + + +/* header files for imported files */ +#include "unknwn.h" +#include "netcfgx.h" + +#ifdef __cplusplus +extern "C"{ +#endif + + +/* interface __MIDL_itf_netcfgn_0000_0000 */ +/* [local] */ + +//+------------------------------------------------------------------------- +// +// Microsoft Windows +// Copyright (c) Microsoft Corporation. All rights reserved. +// +//-------------------------------------------------------------------------- +#if ( _MSC_VER >= 800 ) +#pragma warning(disable:4201) +#endif + + +extern RPC_IF_HANDLE __MIDL_itf_netcfgn_0000_0000_v0_0_c_ifspec; +extern RPC_IF_HANDLE __MIDL_itf_netcfgn_0000_0000_v0_0_s_ifspec; + +#ifndef __INetCfgPnpReconfigCallback_INTERFACE_DEFINED__ +#define __INetCfgPnpReconfigCallback_INTERFACE_DEFINED__ + +/* interface INetCfgPnpReconfigCallback */ +/* [unique][uuid][object][local] */ + +typedef /* [v1_enum] */ +enum tagNCPNP_RECONFIG_LAYER + { NCRL_NDIS = 1, + NCRL_TDI = 2 + } NCPNP_RECONFIG_LAYER; + + +EXTERN_C const IID IID_INetCfgPnpReconfigCallback; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("8d84bd35-e227-11d2-b700-00a0c98a6a85") + INetCfgPnpReconfigCallback : public IUnknown + { + public: + virtual HRESULT STDMETHODCALLTYPE SendPnpReconfig( + /* [annotation][in] */ + __in NCPNP_RECONFIG_LAYER Layer, + /* [annotation][in] */ + __in LPCWSTR pszwUpper, + /* [annotation][in] */ + __in LPCWSTR pszwLower, + /* [annotation][in] */ + __in_bcount(dwSizeOfData) PVOID pvData, + /* [annotation][in] */ + __in DWORD dwSizeOfData) = 0; + + }; + +#else /* C style interface */ + + typedef struct INetCfgPnpReconfigCallbackVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + INetCfgPnpReconfigCallback * This, + /* [in] */ REFIID riid, + /* [annotation][iid_is][out] */ + __RPC__deref_out void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + INetCfgPnpReconfigCallback * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + INetCfgPnpReconfigCallback * This); + + HRESULT ( STDMETHODCALLTYPE *SendPnpReconfig )( + INetCfgPnpReconfigCallback * This, + /* [annotation][in] */ + __in NCPNP_RECONFIG_LAYER Layer, + /* [annotation][in] */ + __in LPCWSTR pszwUpper, + /* [annotation][in] */ + __in LPCWSTR pszwLower, + /* [annotation][in] */ + __in_bcount(dwSizeOfData) PVOID pvData, + /* [annotation][in] */ + __in DWORD dwSizeOfData); + + END_INTERFACE + } INetCfgPnpReconfigCallbackVtbl; + + interface INetCfgPnpReconfigCallback + { + CONST_VTBL struct INetCfgPnpReconfigCallbackVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define INetCfgPnpReconfigCallback_QueryInterface(This,riid,ppvObject) \ + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + +#define INetCfgPnpReconfigCallback_AddRef(This) \ + ( (This)->lpVtbl -> AddRef(This) ) + +#define INetCfgPnpReconfigCallback_Release(This) \ + ( (This)->lpVtbl -> Release(This) ) + + +#define INetCfgPnpReconfigCallback_SendPnpReconfig(This,Layer,pszwUpper,pszwLower,pvData,dwSizeOfData) \ + ( (This)->lpVtbl -> SendPnpReconfig(This,Layer,pszwUpper,pszwLower,pvData,dwSizeOfData) ) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + + +#endif /* __INetCfgPnpReconfigCallback_INTERFACE_DEFINED__ */ + + +#ifndef __INetCfgComponentControl_INTERFACE_DEFINED__ +#define __INetCfgComponentControl_INTERFACE_DEFINED__ + +/* interface INetCfgComponentControl */ +/* [unique][uuid][object][local] */ + + +EXTERN_C const IID IID_INetCfgComponentControl; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("932238df-bea1-11d0-9298-00c04fc99dcf") + INetCfgComponentControl : public IUnknown + { + public: + virtual HRESULT STDMETHODCALLTYPE Initialize( + /* [annotation][in] */ + __in INetCfgComponent *pIComp, + /* [annotation][in] */ + __in INetCfg *pINetCfg, + /* [annotation][in] */ + __in BOOL fInstalling) = 0; + + virtual HRESULT STDMETHODCALLTYPE ApplyRegistryChanges( void) = 0; + + virtual HRESULT STDMETHODCALLTYPE ApplyPnpChanges( + /* [annotation][in] */ + __in INetCfgPnpReconfigCallback *pICallback) = 0; + + virtual HRESULT STDMETHODCALLTYPE CancelChanges( void) = 0; + + }; + +#else /* C style interface */ + + typedef struct INetCfgComponentControlVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + INetCfgComponentControl * This, + /* [in] */ REFIID riid, + /* [annotation][iid_is][out] */ + __RPC__deref_out void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + INetCfgComponentControl * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + INetCfgComponentControl * This); + + HRESULT ( STDMETHODCALLTYPE *Initialize )( + INetCfgComponentControl * This, + /* [annotation][in] */ + __in INetCfgComponent *pIComp, + /* [annotation][in] */ + __in INetCfg *pINetCfg, + /* [annotation][in] */ + __in BOOL fInstalling); + + HRESULT ( STDMETHODCALLTYPE *ApplyRegistryChanges )( + INetCfgComponentControl * This); + + HRESULT ( STDMETHODCALLTYPE *ApplyPnpChanges )( + INetCfgComponentControl * This, + /* [annotation][in] */ + __in INetCfgPnpReconfigCallback *pICallback); + + HRESULT ( STDMETHODCALLTYPE *CancelChanges )( + INetCfgComponentControl * This); + + END_INTERFACE + } INetCfgComponentControlVtbl; + + interface INetCfgComponentControl + { + CONST_VTBL struct INetCfgComponentControlVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define INetCfgComponentControl_QueryInterface(This,riid,ppvObject) \ + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + +#define INetCfgComponentControl_AddRef(This) \ + ( (This)->lpVtbl -> AddRef(This) ) + +#define INetCfgComponentControl_Release(This) \ + ( (This)->lpVtbl -> Release(This) ) + + +#define INetCfgComponentControl_Initialize(This,pIComp,pINetCfg,fInstalling) \ + ( (This)->lpVtbl -> Initialize(This,pIComp,pINetCfg,fInstalling) ) + +#define INetCfgComponentControl_ApplyRegistryChanges(This) \ + ( (This)->lpVtbl -> ApplyRegistryChanges(This) ) + +#define INetCfgComponentControl_ApplyPnpChanges(This,pICallback) \ + ( (This)->lpVtbl -> ApplyPnpChanges(This,pICallback) ) + +#define INetCfgComponentControl_CancelChanges(This) \ + ( (This)->lpVtbl -> CancelChanges(This) ) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + + +#endif /* __INetCfgComponentControl_INTERFACE_DEFINED__ */ + + +#ifndef __INetCfgComponentSetup_INTERFACE_DEFINED__ +#define __INetCfgComponentSetup_INTERFACE_DEFINED__ + +/* interface INetCfgComponentSetup */ +/* [unique][uuid][object][local] */ + +typedef /* [v1_enum] */ +enum tagNETWORK_INSTALL_TIME + { NSF_PRIMARYINSTALL = 0x1, + NSF_POSTSYSINSTALL = 0x2 + } NETWORK_INSTALL_TIME; + +typedef /* [v1_enum] */ +enum tagNETWORK_UPGRADE_TYPE + { NSF_WIN16_UPGRADE = 0x10, + NSF_WIN95_UPGRADE = 0x20, + NSF_WINNT_WKS_UPGRADE = 0x40, + NSF_WINNT_SVR_UPGRADE = 0x80, + NSF_WINNT_SBS_UPGRADE = 0x100, + NSF_COMPONENT_UPDATE = 0x200 + } NETWORK_UPGRADE_TYPE; + + +EXTERN_C const IID IID_INetCfgComponentSetup; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("932238e3-bea1-11d0-9298-00c04fc99dcf") + INetCfgComponentSetup : public IUnknown + { + public: + virtual HRESULT STDMETHODCALLTYPE Install( + /* [annotation][in] */ + __in DWORD dwSetupFlags) = 0; + + virtual HRESULT STDMETHODCALLTYPE Upgrade( + /* [annotation][in] */ + __in DWORD dwSetupFlags, + /* [annotation][in] */ + __in DWORD dwUpgradeFomBuildNo) = 0; + + virtual HRESULT STDMETHODCALLTYPE ReadAnswerFile( + /* [annotation][in] */ + __in LPCWSTR pszwAnswerFile, + /* [annotation][in] */ + __in LPCWSTR pszwAnswerSections) = 0; + + virtual HRESULT STDMETHODCALLTYPE Removing( void) = 0; + + }; + +#else /* C style interface */ + + typedef struct INetCfgComponentSetupVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + INetCfgComponentSetup * This, + /* [in] */ REFIID riid, + /* [annotation][iid_is][out] */ + __RPC__deref_out void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + INetCfgComponentSetup * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + INetCfgComponentSetup * This); + + HRESULT ( STDMETHODCALLTYPE *Install )( + INetCfgComponentSetup * This, + /* [annotation][in] */ + __in DWORD dwSetupFlags); + + HRESULT ( STDMETHODCALLTYPE *Upgrade )( + INetCfgComponentSetup * This, + /* [annotation][in] */ + __in DWORD dwSetupFlags, + /* [annotation][in] */ + __in DWORD dwUpgradeFomBuildNo); + + HRESULT ( STDMETHODCALLTYPE *ReadAnswerFile )( + INetCfgComponentSetup * This, + /* [annotation][in] */ + __in LPCWSTR pszwAnswerFile, + /* [annotation][in] */ + __in LPCWSTR pszwAnswerSections); + + HRESULT ( STDMETHODCALLTYPE *Removing )( + INetCfgComponentSetup * This); + + END_INTERFACE + } INetCfgComponentSetupVtbl; + + interface INetCfgComponentSetup + { + CONST_VTBL struct INetCfgComponentSetupVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define INetCfgComponentSetup_QueryInterface(This,riid,ppvObject) \ + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + +#define INetCfgComponentSetup_AddRef(This) \ + ( (This)->lpVtbl -> AddRef(This) ) + +#define INetCfgComponentSetup_Release(This) \ + ( (This)->lpVtbl -> Release(This) ) + + +#define INetCfgComponentSetup_Install(This,dwSetupFlags) \ + ( (This)->lpVtbl -> Install(This,dwSetupFlags) ) + +#define INetCfgComponentSetup_Upgrade(This,dwSetupFlags,dwUpgradeFomBuildNo) \ + ( (This)->lpVtbl -> Upgrade(This,dwSetupFlags,dwUpgradeFomBuildNo) ) + +#define INetCfgComponentSetup_ReadAnswerFile(This,pszwAnswerFile,pszwAnswerSections) \ + ( (This)->lpVtbl -> ReadAnswerFile(This,pszwAnswerFile,pszwAnswerSections) ) + +#define INetCfgComponentSetup_Removing(This) \ + ( (This)->lpVtbl -> Removing(This) ) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + + +#endif /* __INetCfgComponentSetup_INTERFACE_DEFINED__ */ + + +#ifndef __INetCfgComponentPropertyUi_INTERFACE_DEFINED__ +#define __INetCfgComponentPropertyUi_INTERFACE_DEFINED__ + +/* interface INetCfgComponentPropertyUi */ +/* [unique][uuid][object][local] */ + +typedef /* [v1_enum] */ +enum tagDEFAULT_PAGES + { DPP_ADVANCED = 1 + } DEFAULT_PAGES; + + +EXTERN_C const IID IID_INetCfgComponentPropertyUi; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("932238e0-bea1-11d0-9298-00c04fc99dcf") + INetCfgComponentPropertyUi : public IUnknown + { + public: + virtual HRESULT STDMETHODCALLTYPE QueryPropertyUi( + /* [annotation][in] */ + __in IUnknown *pUnkReserved) = 0; + + virtual HRESULT STDMETHODCALLTYPE SetContext( + /* [annotation][in] */ + __in IUnknown *pUnkReserved) = 0; + + virtual HRESULT STDMETHODCALLTYPE MergePropPages( + /* [annotation][out][in] */ + __inout DWORD *pdwDefPages, + /* [annotation][out] */ + __out BYTE **pahpspPrivate, + /* [annotation][out] */ + __out UINT *pcPages, + /* [annotation][in] */ + __in HWND hwndParent, + /* [annotation][in] */ + __in_opt LPCWSTR *pszStartPage) = 0; + + virtual HRESULT STDMETHODCALLTYPE ValidateProperties( + /* [annotation][in] */ + __in HWND hwndSheet) = 0; + + virtual HRESULT STDMETHODCALLTYPE ApplyProperties( void) = 0; + + virtual HRESULT STDMETHODCALLTYPE CancelProperties( void) = 0; + + }; + +#else /* C style interface */ + + typedef struct INetCfgComponentPropertyUiVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + INetCfgComponentPropertyUi * This, + /* [in] */ REFIID riid, + /* [annotation][iid_is][out] */ + __RPC__deref_out void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + INetCfgComponentPropertyUi * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + INetCfgComponentPropertyUi * This); + + HRESULT ( STDMETHODCALLTYPE *QueryPropertyUi )( + INetCfgComponentPropertyUi * This, + /* [annotation][in] */ + __in IUnknown *pUnkReserved); + + HRESULT ( STDMETHODCALLTYPE *SetContext )( + INetCfgComponentPropertyUi * This, + /* [annotation][in] */ + __in IUnknown *pUnkReserved); + + HRESULT ( STDMETHODCALLTYPE *MergePropPages )( + INetCfgComponentPropertyUi * This, + /* [annotation][out][in] */ + __inout DWORD *pdwDefPages, + /* [annotation][out] */ + __out BYTE **pahpspPrivate, + /* [annotation][out] */ + __out UINT *pcPages, + /* [annotation][in] */ + __in HWND hwndParent, + /* [annotation][in] */ + __in_opt LPCWSTR *pszStartPage); + + HRESULT ( STDMETHODCALLTYPE *ValidateProperties )( + INetCfgComponentPropertyUi * This, + /* [annotation][in] */ + __in HWND hwndSheet); + + HRESULT ( STDMETHODCALLTYPE *ApplyProperties )( + INetCfgComponentPropertyUi * This); + + HRESULT ( STDMETHODCALLTYPE *CancelProperties )( + INetCfgComponentPropertyUi * This); + + END_INTERFACE + } INetCfgComponentPropertyUiVtbl; + + interface INetCfgComponentPropertyUi + { + CONST_VTBL struct INetCfgComponentPropertyUiVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define INetCfgComponentPropertyUi_QueryInterface(This,riid,ppvObject) \ + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + +#define INetCfgComponentPropertyUi_AddRef(This) \ + ( (This)->lpVtbl -> AddRef(This) ) + +#define INetCfgComponentPropertyUi_Release(This) \ + ( (This)->lpVtbl -> Release(This) ) + + +#define INetCfgComponentPropertyUi_QueryPropertyUi(This,pUnkReserved) \ + ( (This)->lpVtbl -> QueryPropertyUi(This,pUnkReserved) ) + +#define INetCfgComponentPropertyUi_SetContext(This,pUnkReserved) \ + ( (This)->lpVtbl -> SetContext(This,pUnkReserved) ) + +#define INetCfgComponentPropertyUi_MergePropPages(This,pdwDefPages,pahpspPrivate,pcPages,hwndParent,pszStartPage) \ + ( (This)->lpVtbl -> MergePropPages(This,pdwDefPages,pahpspPrivate,pcPages,hwndParent,pszStartPage) ) + +#define INetCfgComponentPropertyUi_ValidateProperties(This,hwndSheet) \ + ( (This)->lpVtbl -> ValidateProperties(This,hwndSheet) ) + +#define INetCfgComponentPropertyUi_ApplyProperties(This) \ + ( (This)->lpVtbl -> ApplyProperties(This) ) + +#define INetCfgComponentPropertyUi_CancelProperties(This) \ + ( (This)->lpVtbl -> CancelProperties(This) ) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + + +#endif /* __INetCfgComponentPropertyUi_INTERFACE_DEFINED__ */ + + +#ifndef __INetCfgComponentNotifyBinding_INTERFACE_DEFINED__ +#define __INetCfgComponentNotifyBinding_INTERFACE_DEFINED__ + +/* interface INetCfgComponentNotifyBinding */ +/* [unique][uuid][object][local] */ + +typedef /* [v1_enum] */ +enum tagBIND_FLAGS1 + { NCN_ADD = 0x1, + NCN_REMOVE = 0x2, + NCN_UPDATE = 0x4, + NCN_ENABLE = 0x10, + NCN_DISABLE = 0x20, + NCN_BINDING_PATH = 0x100, + NCN_PROPERTYCHANGE = 0x200, + NCN_NET = 0x10000, + NCN_NETTRANS = 0x20000, + NCN_NETCLIENT = 0x40000, + NCN_NETSERVICE = 0x80000 + } BIND_FLAGS1; + + +EXTERN_C const IID IID_INetCfgComponentNotifyBinding; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("932238e1-bea1-11d0-9298-00c04fc99dcf") + INetCfgComponentNotifyBinding : public IUnknown + { + public: + virtual HRESULT STDMETHODCALLTYPE QueryBindingPath( + /* [annotation][in] */ + __in DWORD dwChangeFlag, + /* [annotation][in] */ + __in INetCfgBindingPath *pIPath) = 0; + + virtual HRESULT STDMETHODCALLTYPE NotifyBindingPath( + /* [annotation][in] */ + __in DWORD dwChangeFlag, + /* [annotation][in] */ + __in INetCfgBindingPath *pIPath) = 0; + + }; + +#else /* C style interface */ + + typedef struct INetCfgComponentNotifyBindingVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + INetCfgComponentNotifyBinding * This, + /* [in] */ REFIID riid, + /* [annotation][iid_is][out] */ + __RPC__deref_out void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + INetCfgComponentNotifyBinding * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + INetCfgComponentNotifyBinding * This); + + HRESULT ( STDMETHODCALLTYPE *QueryBindingPath )( + INetCfgComponentNotifyBinding * This, + /* [annotation][in] */ + __in DWORD dwChangeFlag, + /* [annotation][in] */ + __in INetCfgBindingPath *pIPath); + + HRESULT ( STDMETHODCALLTYPE *NotifyBindingPath )( + INetCfgComponentNotifyBinding * This, + /* [annotation][in] */ + __in DWORD dwChangeFlag, + /* [annotation][in] */ + __in INetCfgBindingPath *pIPath); + + END_INTERFACE + } INetCfgComponentNotifyBindingVtbl; + + interface INetCfgComponentNotifyBinding + { + CONST_VTBL struct INetCfgComponentNotifyBindingVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define INetCfgComponentNotifyBinding_QueryInterface(This,riid,ppvObject) \ + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + +#define INetCfgComponentNotifyBinding_AddRef(This) \ + ( (This)->lpVtbl -> AddRef(This) ) + +#define INetCfgComponentNotifyBinding_Release(This) \ + ( (This)->lpVtbl -> Release(This) ) + + +#define INetCfgComponentNotifyBinding_QueryBindingPath(This,dwChangeFlag,pIPath) \ + ( (This)->lpVtbl -> QueryBindingPath(This,dwChangeFlag,pIPath) ) + +#define INetCfgComponentNotifyBinding_NotifyBindingPath(This,dwChangeFlag,pIPath) \ + ( (This)->lpVtbl -> NotifyBindingPath(This,dwChangeFlag,pIPath) ) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + + +#endif /* __INetCfgComponentNotifyBinding_INTERFACE_DEFINED__ */ + + +#ifndef __INetCfgComponentNotifyGlobal_INTERFACE_DEFINED__ +#define __INetCfgComponentNotifyGlobal_INTERFACE_DEFINED__ + +/* interface INetCfgComponentNotifyGlobal */ +/* [unique][uuid][object][local] */ + + +EXTERN_C const IID IID_INetCfgComponentNotifyGlobal; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("932238e2-bea1-11d0-9298-00c04fc99dcf") + INetCfgComponentNotifyGlobal : public IUnknown + { + public: + virtual HRESULT STDMETHODCALLTYPE GetSupportedNotifications( + /* [annotation][out] */ + __out DWORD *dwNotifications) = 0; + + virtual HRESULT STDMETHODCALLTYPE SysQueryBindingPath( + /* [annotation][in] */ + __in DWORD dwChangeFlag, + /* [annotation][in] */ + __in INetCfgBindingPath *pIPath) = 0; + + virtual HRESULT STDMETHODCALLTYPE SysNotifyBindingPath( + /* [annotation][in] */ + __in DWORD dwChangeFlag, + /* [annotation][in] */ + __in INetCfgBindingPath *pIPath) = 0; + + virtual HRESULT STDMETHODCALLTYPE SysNotifyComponent( + /* [annotation][in] */ + __in DWORD dwChangeFlag, + /* [annotation][in] */ + __in INetCfgComponent *pIComp) = 0; + + }; + +#else /* C style interface */ + + typedef struct INetCfgComponentNotifyGlobalVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + INetCfgComponentNotifyGlobal * This, + /* [in] */ REFIID riid, + /* [annotation][iid_is][out] */ + __RPC__deref_out void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + INetCfgComponentNotifyGlobal * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + INetCfgComponentNotifyGlobal * This); + + HRESULT ( STDMETHODCALLTYPE *GetSupportedNotifications )( + INetCfgComponentNotifyGlobal * This, + /* [annotation][out] */ + __out DWORD *dwNotifications); + + HRESULT ( STDMETHODCALLTYPE *SysQueryBindingPath )( + INetCfgComponentNotifyGlobal * This, + /* [annotation][in] */ + __in DWORD dwChangeFlag, + /* [annotation][in] */ + __in INetCfgBindingPath *pIPath); + + HRESULT ( STDMETHODCALLTYPE *SysNotifyBindingPath )( + INetCfgComponentNotifyGlobal * This, + /* [annotation][in] */ + __in DWORD dwChangeFlag, + /* [annotation][in] */ + __in INetCfgBindingPath *pIPath); + + HRESULT ( STDMETHODCALLTYPE *SysNotifyComponent )( + INetCfgComponentNotifyGlobal * This, + /* [annotation][in] */ + __in DWORD dwChangeFlag, + /* [annotation][in] */ + __in INetCfgComponent *pIComp); + + END_INTERFACE + } INetCfgComponentNotifyGlobalVtbl; + + interface INetCfgComponentNotifyGlobal + { + CONST_VTBL struct INetCfgComponentNotifyGlobalVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define INetCfgComponentNotifyGlobal_QueryInterface(This,riid,ppvObject) \ + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + +#define INetCfgComponentNotifyGlobal_AddRef(This) \ + ( (This)->lpVtbl -> AddRef(This) ) + +#define INetCfgComponentNotifyGlobal_Release(This) \ + ( (This)->lpVtbl -> Release(This) ) + + +#define INetCfgComponentNotifyGlobal_GetSupportedNotifications(This,dwNotifications) \ + ( (This)->lpVtbl -> GetSupportedNotifications(This,dwNotifications) ) + +#define INetCfgComponentNotifyGlobal_SysQueryBindingPath(This,dwChangeFlag,pIPath) \ + ( (This)->lpVtbl -> SysQueryBindingPath(This,dwChangeFlag,pIPath) ) + +#define INetCfgComponentNotifyGlobal_SysNotifyBindingPath(This,dwChangeFlag,pIPath) \ + ( (This)->lpVtbl -> SysNotifyBindingPath(This,dwChangeFlag,pIPath) ) + +#define INetCfgComponentNotifyGlobal_SysNotifyComponent(This,dwChangeFlag,pIComp) \ + ( (This)->lpVtbl -> SysNotifyComponent(This,dwChangeFlag,pIComp) ) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + + +#endif /* __INetCfgComponentNotifyGlobal_INTERFACE_DEFINED__ */ + + +#ifndef __INetCfgComponentUpperEdge_INTERFACE_DEFINED__ +#define __INetCfgComponentUpperEdge_INTERFACE_DEFINED__ + +/* interface INetCfgComponentUpperEdge */ +/* [unique][uuid][object][local] */ + + +EXTERN_C const IID IID_INetCfgComponentUpperEdge; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("932238e4-bea1-11d0-9298-00c04fc99dcf") + INetCfgComponentUpperEdge : public IUnknown + { + public: + virtual HRESULT STDMETHODCALLTYPE GetInterfaceIdsForAdapter( + /* [annotation][in] */ + __in INetCfgComponent *pAdapter, + /* [annotation][out] */ + __out DWORD *pdwNumInterfaces, + /* [annotation][out] */ + __deref_out_opt GUID **ppguidInterfaceIds) = 0; + + virtual HRESULT STDMETHODCALLTYPE AddInterfacesToAdapter( + /* [annotation][in] */ + __in INetCfgComponent *pAdapter, + /* [annotation][in] */ + __in DWORD dwNumInterfaces) = 0; + + virtual HRESULT STDMETHODCALLTYPE RemoveInterfacesFromAdapter( + /* [annotation][in] */ + __in INetCfgComponent *pAdapter, + /* [annotation][in] */ + __in DWORD dwNumInterfaces, + /* [annotation][in] */ + __in const GUID *pguidInterfaceIds) = 0; + + }; + +#else /* C style interface */ + + typedef struct INetCfgComponentUpperEdgeVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + INetCfgComponentUpperEdge * This, + /* [in] */ REFIID riid, + /* [annotation][iid_is][out] */ + __RPC__deref_out void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + INetCfgComponentUpperEdge * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + INetCfgComponentUpperEdge * This); + + HRESULT ( STDMETHODCALLTYPE *GetInterfaceIdsForAdapter )( + INetCfgComponentUpperEdge * This, + /* [annotation][in] */ + __in INetCfgComponent *pAdapter, + /* [annotation][out] */ + __out DWORD *pdwNumInterfaces, + /* [annotation][out] */ + __deref_out_opt GUID **ppguidInterfaceIds); + + HRESULT ( STDMETHODCALLTYPE *AddInterfacesToAdapter )( + INetCfgComponentUpperEdge * This, + /* [annotation][in] */ + __in INetCfgComponent *pAdapter, + /* [annotation][in] */ + __in DWORD dwNumInterfaces); + + HRESULT ( STDMETHODCALLTYPE *RemoveInterfacesFromAdapter )( + INetCfgComponentUpperEdge * This, + /* [annotation][in] */ + __in INetCfgComponent *pAdapter, + /* [annotation][in] */ + __in DWORD dwNumInterfaces, + /* [annotation][in] */ + __in const GUID *pguidInterfaceIds); + + END_INTERFACE + } INetCfgComponentUpperEdgeVtbl; + + interface INetCfgComponentUpperEdge + { + CONST_VTBL struct INetCfgComponentUpperEdgeVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define INetCfgComponentUpperEdge_QueryInterface(This,riid,ppvObject) \ + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + +#define INetCfgComponentUpperEdge_AddRef(This) \ + ( (This)->lpVtbl -> AddRef(This) ) + +#define INetCfgComponentUpperEdge_Release(This) \ + ( (This)->lpVtbl -> Release(This) ) + + +#define INetCfgComponentUpperEdge_GetInterfaceIdsForAdapter(This,pAdapter,pdwNumInterfaces,ppguidInterfaceIds) \ + ( (This)->lpVtbl -> GetInterfaceIdsForAdapter(This,pAdapter,pdwNumInterfaces,ppguidInterfaceIds) ) + +#define INetCfgComponentUpperEdge_AddInterfacesToAdapter(This,pAdapter,dwNumInterfaces) \ + ( (This)->lpVtbl -> AddInterfacesToAdapter(This,pAdapter,dwNumInterfaces) ) + +#define INetCfgComponentUpperEdge_RemoveInterfacesFromAdapter(This,pAdapter,dwNumInterfaces,pguidInterfaceIds) \ + ( (This)->lpVtbl -> RemoveInterfacesFromAdapter(This,pAdapter,dwNumInterfaces,pguidInterfaceIds) ) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + + +#endif /* __INetCfgComponentUpperEdge_INTERFACE_DEFINED__ */ + + +#ifndef __INetLanConnectionUiInfo_INTERFACE_DEFINED__ +#define __INetLanConnectionUiInfo_INTERFACE_DEFINED__ + +/* interface INetLanConnectionUiInfo */ +/* [unique][uuid][object] */ + + +EXTERN_C const IID IID_INetLanConnectionUiInfo; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("C08956A6-1CD3-11D1-B1C5-00805FC1270E") + INetLanConnectionUiInfo : public IUnknown + { + public: + virtual HRESULT STDMETHODCALLTYPE GetDeviceGuid( + /* [out] */ __RPC__out GUID *pguid) = 0; + + }; + +#else /* C style interface */ + + typedef struct INetLanConnectionUiInfoVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + __RPC__in INetLanConnectionUiInfo * This, + /* [in] */ __RPC__in REFIID riid, + /* [annotation][iid_is][out] */ + __RPC__deref_out void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + __RPC__in INetLanConnectionUiInfo * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + __RPC__in INetLanConnectionUiInfo * This); + + HRESULT ( STDMETHODCALLTYPE *GetDeviceGuid )( + __RPC__in INetLanConnectionUiInfo * This, + /* [out] */ __RPC__out GUID *pguid); + + END_INTERFACE + } INetLanConnectionUiInfoVtbl; + + interface INetLanConnectionUiInfo + { + CONST_VTBL struct INetLanConnectionUiInfoVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define INetLanConnectionUiInfo_QueryInterface(This,riid,ppvObject) \ + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + +#define INetLanConnectionUiInfo_AddRef(This) \ + ( (This)->lpVtbl -> AddRef(This) ) + +#define INetLanConnectionUiInfo_Release(This) \ + ( (This)->lpVtbl -> Release(This) ) + + +#define INetLanConnectionUiInfo_GetDeviceGuid(This,pguid) \ + ( (This)->lpVtbl -> GetDeviceGuid(This,pguid) ) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + + +#endif /* __INetLanConnectionUiInfo_INTERFACE_DEFINED__ */ + + +#ifndef __INetRasConnectionIpUiInfo_INTERFACE_DEFINED__ +#define __INetRasConnectionIpUiInfo_INTERFACE_DEFINED__ + +/* interface INetRasConnectionIpUiInfo */ +/* [unique][uuid][object] */ + +typedef +enum tagRASCON_IPUI_FLAGS + { RCUIF_VPN = 0x1, + RCUIF_DEMAND_DIAL = 0x2, + RCUIF_NOT_ADMIN = 0x4, + RCUIF_USE_IPv4_STATICADDRESS = 0x8, + RCUIF_USE_IPv4_NAME_SERVERS = 0x10, + RCUIF_USE_IPv4_REMOTE_GATEWAY = 0x20, + RCUIF_USE_IPv4_EXPLICIT_METRIC = 0x40, + RCUIF_USE_HEADER_COMPRESSION = 0x80, + RCUIF_USE_DISABLE_REGISTER_DNS = 0x100, + RCUIF_USE_PRIVATE_DNS_SUFFIX = 0x200, + RCUIF_ENABLE_NBT = 0x400, + RCUIF_USE_IPv6_STATICADDRESS = 0x800, + RCUIF_USE_IPv6_NAME_SERVERS = 0x1000, + RCUIF_USE_IPv6_REMOTE_GATEWAY = 0x2000, + RCUIF_USE_IPv6_EXPLICIT_METRIC = 0x4000, + RCUIF_DISABLE_CLASS_BASED_ROUTE = 0x8000 + } RASCON_UIINFO_FLAGS; + +typedef struct tagRASCON_IPUI + { + GUID guidConnection; + BOOL fIPv6Cfg; + DWORD dwFlags; + WCHAR pszwIpAddr[ 16 ]; + WCHAR pszwDnsAddr[ 16 ]; + WCHAR pszwDns2Addr[ 16 ]; + WCHAR pszwWinsAddr[ 16 ]; + WCHAR pszwWins2Addr[ 16 ]; + WCHAR pszwDnsSuffix[ 256 ]; + WCHAR pszwIpv6Addr[ 65 ]; + DWORD dwIpv6PrefixLength; + WCHAR pszwIpv6DnsAddr[ 65 ]; + WCHAR pszwIpv6Dns2Addr[ 65 ]; + DWORD dwIPv4InfMetric; + DWORD dwIPv6InfMetric; + } RASCON_IPUI; + + +EXTERN_C const IID IID_INetRasConnectionIpUiInfo; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("FAEDCF58-31FE-11D1-AAD2-00805FC1270E") + INetRasConnectionIpUiInfo : public IUnknown + { + public: + virtual HRESULT STDMETHODCALLTYPE GetUiInfo( + /* [out] */ __RPC__out RASCON_IPUI *pInfo) = 0; + + }; + +#else /* C style interface */ + + typedef struct INetRasConnectionIpUiInfoVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + __RPC__in INetRasConnectionIpUiInfo * This, + /* [in] */ __RPC__in REFIID riid, + /* [annotation][iid_is][out] */ + __RPC__deref_out void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + __RPC__in INetRasConnectionIpUiInfo * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + __RPC__in INetRasConnectionIpUiInfo * This); + + HRESULT ( STDMETHODCALLTYPE *GetUiInfo )( + __RPC__in INetRasConnectionIpUiInfo * This, + /* [out] */ __RPC__out RASCON_IPUI *pInfo); + + END_INTERFACE + } INetRasConnectionIpUiInfoVtbl; + + interface INetRasConnectionIpUiInfo + { + CONST_VTBL struct INetRasConnectionIpUiInfoVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define INetRasConnectionIpUiInfo_QueryInterface(This,riid,ppvObject) \ + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + +#define INetRasConnectionIpUiInfo_AddRef(This) \ + ( (This)->lpVtbl -> AddRef(This) ) + +#define INetRasConnectionIpUiInfo_Release(This) \ + ( (This)->lpVtbl -> Release(This) ) + + +#define INetRasConnectionIpUiInfo_GetUiInfo(This,pInfo) \ + ( (This)->lpVtbl -> GetUiInfo(This,pInfo) ) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + + +#endif /* __INetRasConnectionIpUiInfo_INTERFACE_DEFINED__ */ + + +#ifndef __INetCfgComponentSysPrep_INTERFACE_DEFINED__ +#define __INetCfgComponentSysPrep_INTERFACE_DEFINED__ + +/* interface INetCfgComponentSysPrep */ +/* [unique][uuid][object][local] */ + + +EXTERN_C const IID IID_INetCfgComponentSysPrep; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("C0E8AE9A-306E-11D1-AACF-00805FC1270E") + INetCfgComponentSysPrep : public IUnknown + { + public: + virtual HRESULT STDMETHODCALLTYPE SaveAdapterParameters( + /* [annotation][in] */ + __in INetCfgSysPrep *pncsp, + /* [annotation][in] */ + __in LPCWSTR pszwAnswerSections, + /* [annotation][in] */ + __in GUID *pAdapterInstanceGuid) = 0; + + virtual HRESULT STDMETHODCALLTYPE RestoreAdapterParameters( + /* [annotation][in] */ + __in LPCWSTR pszwAnswerFile, + /* [annotation][in] */ + __in LPCWSTR pszwAnswerSection, + /* [annotation][in] */ + __in GUID *pAdapterInstanceGuid) = 0; + + }; + +#else /* C style interface */ + + typedef struct INetCfgComponentSysPrepVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + INetCfgComponentSysPrep * This, + /* [in] */ REFIID riid, + /* [annotation][iid_is][out] */ + __RPC__deref_out void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + INetCfgComponentSysPrep * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + INetCfgComponentSysPrep * This); + + HRESULT ( STDMETHODCALLTYPE *SaveAdapterParameters )( + INetCfgComponentSysPrep * This, + /* [annotation][in] */ + __in INetCfgSysPrep *pncsp, + /* [annotation][in] */ + __in LPCWSTR pszwAnswerSections, + /* [annotation][in] */ + __in GUID *pAdapterInstanceGuid); + + HRESULT ( STDMETHODCALLTYPE *RestoreAdapterParameters )( + INetCfgComponentSysPrep * This, + /* [annotation][in] */ + __in LPCWSTR pszwAnswerFile, + /* [annotation][in] */ + __in LPCWSTR pszwAnswerSection, + /* [annotation][in] */ + __in GUID *pAdapterInstanceGuid); + + END_INTERFACE + } INetCfgComponentSysPrepVtbl; + + interface INetCfgComponentSysPrep + { + CONST_VTBL struct INetCfgComponentSysPrepVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define INetCfgComponentSysPrep_QueryInterface(This,riid,ppvObject) \ + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + +#define INetCfgComponentSysPrep_AddRef(This) \ + ( (This)->lpVtbl -> AddRef(This) ) + +#define INetCfgComponentSysPrep_Release(This) \ + ( (This)->lpVtbl -> Release(This) ) + + +#define INetCfgComponentSysPrep_SaveAdapterParameters(This,pncsp,pszwAnswerSections,pAdapterInstanceGuid) \ + ( (This)->lpVtbl -> SaveAdapterParameters(This,pncsp,pszwAnswerSections,pAdapterInstanceGuid) ) + +#define INetCfgComponentSysPrep_RestoreAdapterParameters(This,pszwAnswerFile,pszwAnswerSection,pAdapterInstanceGuid) \ + ( (This)->lpVtbl -> RestoreAdapterParameters(This,pszwAnswerFile,pszwAnswerSection,pAdapterInstanceGuid) ) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + + +#endif /* __INetCfgComponentSysPrep_INTERFACE_DEFINED__ */ + + +/* Additional Prototypes for ALL interfaces */ + +/* end of Additional Prototypes */ + +#ifdef __cplusplus +} +#endif + +#endif + + + diff --git a/src/Cedar/netcfgx.h b/src/Cedar/netcfgx.h index 59c9f52c..e59bd8a3 100644 --- a/src/Cedar/netcfgx.h +++ b/src/Cedar/netcfgx.h @@ -1,1941 +1,1941 @@ - - -/* this ALWAYS GENERATED file contains the definitions for the interfaces */ - - - /* File created by MIDL compiler version 7.00.0555 */ -/* Compiler settings for netcfgx.idl: - Oicf, W1, Zp8, env=Win32 (32b run), target_arch=X86 7.00.0555 - protocol : dce , ms_ext, c_ext, robust - error checks: allocation ref bounds_check enum stub_data - VC __declspec() decoration level: - __declspec(uuid()), __declspec(selectany), __declspec(novtable) - DECLSPEC_UUID(), MIDL_INTERFACE() -*/ -/* @@MIDL_FILE_HEADING( ) */ - -#pragma warning( disable: 4049 ) /* more than 64k source lines */ - - -/* verify that the version is high enough to compile this file*/ -#ifndef __REQUIRED_RPCNDR_H_VERSION__ -#define __REQUIRED_RPCNDR_H_VERSION__ 500 -#endif - -/* verify that the version is high enough to compile this file*/ -#ifndef __REQUIRED_RPCSAL_H_VERSION__ -#define __REQUIRED_RPCSAL_H_VERSION__ 100 -#endif - -#include "rpc.h" -#include "rpcndr.h" - -#ifndef __RPCNDR_H_VERSION__ -#error this stub requires an updated version of -#endif // __RPCNDR_H_VERSION__ - -#ifndef COM_NO_WINDOWS_H -#include "windows.h" -#include "ole2.h" -#endif /*COM_NO_WINDOWS_H*/ - -#ifndef __netcfgx_h__ -#define __netcfgx_h__ - -#if defined(_MSC_VER) && (_MSC_VER >= 1020) -#pragma once -#endif - -/* Forward Declarations */ - -#ifndef __IEnumNetCfgBindingInterface_FWD_DEFINED__ -#define __IEnumNetCfgBindingInterface_FWD_DEFINED__ -typedef interface IEnumNetCfgBindingInterface IEnumNetCfgBindingInterface; -#endif /* __IEnumNetCfgBindingInterface_FWD_DEFINED__ */ - - -#ifndef __IEnumNetCfgBindingPath_FWD_DEFINED__ -#define __IEnumNetCfgBindingPath_FWD_DEFINED__ -typedef interface IEnumNetCfgBindingPath IEnumNetCfgBindingPath; -#endif /* __IEnumNetCfgBindingPath_FWD_DEFINED__ */ - - -#ifndef __IEnumNetCfgComponent_FWD_DEFINED__ -#define __IEnumNetCfgComponent_FWD_DEFINED__ -typedef interface IEnumNetCfgComponent IEnumNetCfgComponent; -#endif /* __IEnumNetCfgComponent_FWD_DEFINED__ */ - - -#ifndef __INetCfg_FWD_DEFINED__ -#define __INetCfg_FWD_DEFINED__ -typedef interface INetCfg INetCfg; -#endif /* __INetCfg_FWD_DEFINED__ */ - - -#ifndef __INetCfgLock_FWD_DEFINED__ -#define __INetCfgLock_FWD_DEFINED__ -typedef interface INetCfgLock INetCfgLock; -#endif /* __INetCfgLock_FWD_DEFINED__ */ - - -#ifndef __INetCfgBindingInterface_FWD_DEFINED__ -#define __INetCfgBindingInterface_FWD_DEFINED__ -typedef interface INetCfgBindingInterface INetCfgBindingInterface; -#endif /* __INetCfgBindingInterface_FWD_DEFINED__ */ - - -#ifndef __INetCfgBindingPath_FWD_DEFINED__ -#define __INetCfgBindingPath_FWD_DEFINED__ -typedef interface INetCfgBindingPath INetCfgBindingPath; -#endif /* __INetCfgBindingPath_FWD_DEFINED__ */ - - -#ifndef __INetCfgClass_FWD_DEFINED__ -#define __INetCfgClass_FWD_DEFINED__ -typedef interface INetCfgClass INetCfgClass; -#endif /* __INetCfgClass_FWD_DEFINED__ */ - - -#ifndef __INetCfgClassSetup_FWD_DEFINED__ -#define __INetCfgClassSetup_FWD_DEFINED__ -typedef interface INetCfgClassSetup INetCfgClassSetup; -#endif /* __INetCfgClassSetup_FWD_DEFINED__ */ - - -#ifndef __INetCfgComponent_FWD_DEFINED__ -#define __INetCfgComponent_FWD_DEFINED__ -typedef interface INetCfgComponent INetCfgComponent; -#endif /* __INetCfgComponent_FWD_DEFINED__ */ - - -#ifndef __INetCfgComponentBindings_FWD_DEFINED__ -#define __INetCfgComponentBindings_FWD_DEFINED__ -typedef interface INetCfgComponentBindings INetCfgComponentBindings; -#endif /* __INetCfgComponentBindings_FWD_DEFINED__ */ - - -#ifndef __INetCfgSysPrep_FWD_DEFINED__ -#define __INetCfgSysPrep_FWD_DEFINED__ -typedef interface INetCfgSysPrep INetCfgSysPrep; -#endif /* __INetCfgSysPrep_FWD_DEFINED__ */ - - -/* header files for imported files */ -#include "unknwn.h" -#include "prsht.h" - -#ifdef __cplusplus -extern "C"{ -#endif - - -/* interface __MIDL_itf_netcfgx_0000_0000 */ -/* [local] */ - -//+------------------------------------------------------------------------- -// -// Microsoft Windows -// Copyright (c) Microsoft Corporation. All rights reserved. -// -//-------------------------------------------------------------------------- -#if ( _MSC_VER >= 800 ) -#pragma warning(disable:4201) -#endif - -EXTERN_C const CLSID CLSID_CNetCfg; - -#define NETCFG_E_ALREADY_INITIALIZED MAKE_HRESULT(SEVERITY_ERROR, FACILITY_ITF, 0xA020) -#define NETCFG_E_NOT_INITIALIZED MAKE_HRESULT(SEVERITY_ERROR, FACILITY_ITF, 0xA021) -#define NETCFG_E_IN_USE MAKE_HRESULT(SEVERITY_ERROR, FACILITY_ITF, 0xA022) -#define NETCFG_E_NO_WRITE_LOCK MAKE_HRESULT(SEVERITY_ERROR, FACILITY_ITF, 0xA024) -#define NETCFG_E_NEED_REBOOT MAKE_HRESULT(SEVERITY_ERROR, FACILITY_ITF, 0xA025) -#define NETCFG_E_ACTIVE_RAS_CONNECTIONS MAKE_HRESULT(SEVERITY_ERROR, FACILITY_ITF, 0xA026) -#define NETCFG_E_ADAPTER_NOT_FOUND MAKE_HRESULT(SEVERITY_ERROR, FACILITY_ITF, 0xA027) -#define NETCFG_E_COMPONENT_REMOVED_PENDING_REBOOT MAKE_HRESULT(SEVERITY_ERROR, FACILITY_ITF, 0xA028) -#define NETCFG_E_MAX_FILTER_LIMIT MAKE_HRESULT(SEVERITY_ERROR, FACILITY_ITF, 0xA029) -#define NETCFG_S_REBOOT MAKE_HRESULT(SEVERITY_SUCCESS, FACILITY_ITF, 0xA020) -#define NETCFG_S_DISABLE_QUERY MAKE_HRESULT(SEVERITY_SUCCESS, FACILITY_ITF, 0xA022) -#define NETCFG_S_STILL_REFERENCED MAKE_HRESULT(SEVERITY_SUCCESS, FACILITY_ITF, 0xA023) -#define NETCFG_S_CAUSED_SETUP_CHANGE MAKE_HRESULT(SEVERITY_SUCCESS, FACILITY_ITF, 0xA024) -#define NETCFG_S_COMMIT_NOW MAKE_HRESULT(SEVERITY_SUCCESS, FACILITY_ITF, 0xA025) - -#define NETCFG_CLIENT_CID_MS_MSClient TEXT("ms_msclient") -#define NETCFG_SERVICE_CID_MS_SERVER TEXT("ms_server") -#define NETCFG_SERVICE_CID_MS_NETBIOS TEXT("ms_netbios") -#define NETCFG_SERVICE_CID_MS_PSCHED TEXT("ms_pschedpc") -#define NETCFG_SERVICE_CID_MS_WLBS TEXT("ms_wlbs") -#define NETCFG_TRANS_CID_MS_APPLETALK TEXT("ms_appletalk") -#define NETCFG_TRANS_CID_MS_NETBEUI TEXT("ms_netbeui") -#define NETCFG_TRANS_CID_MS_NETMON TEXT("ms_netmon") -#define NETCFG_TRANS_CID_MS_NWIPX TEXT("ms_nwipx") -#define NETCFG_TRANS_CID_MS_NWSPX TEXT("ms_nwspx") -#define NETCFG_TRANS_CID_MS_TCPIP TEXT("ms_tcpip") - - - - - - - - - - - - - - - - -extern RPC_IF_HANDLE __MIDL_itf_netcfgx_0000_0000_v0_0_c_ifspec; -extern RPC_IF_HANDLE __MIDL_itf_netcfgx_0000_0000_v0_0_s_ifspec; - -#ifndef __IEnumNetCfgBindingInterface_INTERFACE_DEFINED__ -#define __IEnumNetCfgBindingInterface_INTERFACE_DEFINED__ - -/* interface IEnumNetCfgBindingInterface */ -/* [unique][uuid][object][local] */ - - -EXTERN_C const IID IID_IEnumNetCfgBindingInterface; - -#if defined(__cplusplus) && !defined(CINTERFACE) - - MIDL_INTERFACE("C0E8AE90-306E-11D1-AACF-00805FC1270E") - IEnumNetCfgBindingInterface : public IUnknown - { - public: - virtual HRESULT STDMETHODCALLTYPE Next( - /* [annotation][in] */ - __in ULONG celt, - /* [annotation][length_is][size_is][out] */ - __out_ecount(celt) INetCfgBindingInterface **rgelt, - /* [annotation][out] */ - __out_opt ULONG *pceltFetched) = 0; - - virtual HRESULT STDMETHODCALLTYPE Skip( - /* [annotation][in] */ - __in ULONG celt) = 0; - - virtual HRESULT STDMETHODCALLTYPE Reset( void) = 0; - - virtual HRESULT STDMETHODCALLTYPE Clone( - /* [annotation][out] */ - __out IEnumNetCfgBindingInterface **ppenum) = 0; - - }; - -#else /* C style interface */ - - typedef struct IEnumNetCfgBindingInterfaceVtbl - { - BEGIN_INTERFACE - - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( - IEnumNetCfgBindingInterface * This, - /* [in] */ REFIID riid, - /* [annotation][iid_is][out] */ - __RPC__deref_out void **ppvObject); - - ULONG ( STDMETHODCALLTYPE *AddRef )( - IEnumNetCfgBindingInterface * This); - - ULONG ( STDMETHODCALLTYPE *Release )( - IEnumNetCfgBindingInterface * This); - - HRESULT ( STDMETHODCALLTYPE *Next )( - IEnumNetCfgBindingInterface * This, - /* [annotation][in] */ - __in ULONG celt, - /* [annotation][length_is][size_is][out] */ - __out_ecount(celt) INetCfgBindingInterface **rgelt, - /* [annotation][out] */ - __out_opt ULONG *pceltFetched); - - HRESULT ( STDMETHODCALLTYPE *Skip )( - IEnumNetCfgBindingInterface * This, - /* [annotation][in] */ - __in ULONG celt); - - HRESULT ( STDMETHODCALLTYPE *Reset )( - IEnumNetCfgBindingInterface * This); - - HRESULT ( STDMETHODCALLTYPE *Clone )( - IEnumNetCfgBindingInterface * This, - /* [annotation][out] */ - __out IEnumNetCfgBindingInterface **ppenum); - - END_INTERFACE - } IEnumNetCfgBindingInterfaceVtbl; - - interface IEnumNetCfgBindingInterface - { - CONST_VTBL struct IEnumNetCfgBindingInterfaceVtbl *lpVtbl; - }; - - - -#ifdef COBJMACROS - - -#define IEnumNetCfgBindingInterface_QueryInterface(This,riid,ppvObject) \ - ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) - -#define IEnumNetCfgBindingInterface_AddRef(This) \ - ( (This)->lpVtbl -> AddRef(This) ) - -#define IEnumNetCfgBindingInterface_Release(This) \ - ( (This)->lpVtbl -> Release(This) ) - - -#define IEnumNetCfgBindingInterface_Next(This,celt,rgelt,pceltFetched) \ - ( (This)->lpVtbl -> Next(This,celt,rgelt,pceltFetched) ) - -#define IEnumNetCfgBindingInterface_Skip(This,celt) \ - ( (This)->lpVtbl -> Skip(This,celt) ) - -#define IEnumNetCfgBindingInterface_Reset(This) \ - ( (This)->lpVtbl -> Reset(This) ) - -#define IEnumNetCfgBindingInterface_Clone(This,ppenum) \ - ( (This)->lpVtbl -> Clone(This,ppenum) ) - -#endif /* COBJMACROS */ - - -#endif /* C style interface */ - - - - -#endif /* __IEnumNetCfgBindingInterface_INTERFACE_DEFINED__ */ - - -#ifndef __IEnumNetCfgBindingPath_INTERFACE_DEFINED__ -#define __IEnumNetCfgBindingPath_INTERFACE_DEFINED__ - -/* interface IEnumNetCfgBindingPath */ -/* [unique][uuid][object][local] */ - - -EXTERN_C const IID IID_IEnumNetCfgBindingPath; - -#if defined(__cplusplus) && !defined(CINTERFACE) - - MIDL_INTERFACE("C0E8AE91-306E-11D1-AACF-00805FC1270E") - IEnumNetCfgBindingPath : public IUnknown - { - public: - virtual HRESULT STDMETHODCALLTYPE Next( - /* [annotation][in] */ - __in ULONG celt, - /* [annotation][length_is][size_is][out] */ - __out_ecount(celt) INetCfgBindingPath **rgelt, - /* [annotation][out] */ - __out ULONG *pceltFetched) = 0; - - virtual HRESULT STDMETHODCALLTYPE Skip( - /* [annotation][in] */ - __in ULONG celt) = 0; - - virtual HRESULT STDMETHODCALLTYPE Reset( void) = 0; - - virtual HRESULT STDMETHODCALLTYPE Clone( - /* [annotation][out] */ - __out IEnumNetCfgBindingPath **ppenum) = 0; - - }; - -#else /* C style interface */ - - typedef struct IEnumNetCfgBindingPathVtbl - { - BEGIN_INTERFACE - - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( - IEnumNetCfgBindingPath * This, - /* [in] */ REFIID riid, - /* [annotation][iid_is][out] */ - __RPC__deref_out void **ppvObject); - - ULONG ( STDMETHODCALLTYPE *AddRef )( - IEnumNetCfgBindingPath * This); - - ULONG ( STDMETHODCALLTYPE *Release )( - IEnumNetCfgBindingPath * This); - - HRESULT ( STDMETHODCALLTYPE *Next )( - IEnumNetCfgBindingPath * This, - /* [annotation][in] */ - __in ULONG celt, - /* [annotation][length_is][size_is][out] */ - __out_ecount(celt) INetCfgBindingPath **rgelt, - /* [annotation][out] */ - __out ULONG *pceltFetched); - - HRESULT ( STDMETHODCALLTYPE *Skip )( - IEnumNetCfgBindingPath * This, - /* [annotation][in] */ - __in ULONG celt); - - HRESULT ( STDMETHODCALLTYPE *Reset )( - IEnumNetCfgBindingPath * This); - - HRESULT ( STDMETHODCALLTYPE *Clone )( - IEnumNetCfgBindingPath * This, - /* [annotation][out] */ - __out IEnumNetCfgBindingPath **ppenum); - - END_INTERFACE - } IEnumNetCfgBindingPathVtbl; - - interface IEnumNetCfgBindingPath - { - CONST_VTBL struct IEnumNetCfgBindingPathVtbl *lpVtbl; - }; - - - -#ifdef COBJMACROS - - -#define IEnumNetCfgBindingPath_QueryInterface(This,riid,ppvObject) \ - ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) - -#define IEnumNetCfgBindingPath_AddRef(This) \ - ( (This)->lpVtbl -> AddRef(This) ) - -#define IEnumNetCfgBindingPath_Release(This) \ - ( (This)->lpVtbl -> Release(This) ) - - -#define IEnumNetCfgBindingPath_Next(This,celt,rgelt,pceltFetched) \ - ( (This)->lpVtbl -> Next(This,celt,rgelt,pceltFetched) ) - -#define IEnumNetCfgBindingPath_Skip(This,celt) \ - ( (This)->lpVtbl -> Skip(This,celt) ) - -#define IEnumNetCfgBindingPath_Reset(This) \ - ( (This)->lpVtbl -> Reset(This) ) - -#define IEnumNetCfgBindingPath_Clone(This,ppenum) \ - ( (This)->lpVtbl -> Clone(This,ppenum) ) - -#endif /* COBJMACROS */ - - -#endif /* C style interface */ - - - - -#endif /* __IEnumNetCfgBindingPath_INTERFACE_DEFINED__ */ - - -#ifndef __IEnumNetCfgComponent_INTERFACE_DEFINED__ -#define __IEnumNetCfgComponent_INTERFACE_DEFINED__ - -/* interface IEnumNetCfgComponent */ -/* [unique][uuid][object][local] */ - - -EXTERN_C const IID IID_IEnumNetCfgComponent; - -#if defined(__cplusplus) && !defined(CINTERFACE) - - MIDL_INTERFACE("C0E8AE92-306E-11D1-AACF-00805FC1270E") - IEnumNetCfgComponent : public IUnknown - { - public: - virtual HRESULT STDMETHODCALLTYPE Next( - /* [annotation][in] */ - __in ULONG celt, - /* [annotation][length_is][size_is][out] */ - __out_ecount(celt) INetCfgComponent **rgelt, - /* [annotation][out] */ - __out ULONG *pceltFetched) = 0; - - virtual HRESULT STDMETHODCALLTYPE Skip( - /* [annotation][in] */ - __in ULONG celt) = 0; - - virtual HRESULT STDMETHODCALLTYPE Reset( void) = 0; - - virtual HRESULT STDMETHODCALLTYPE Clone( - /* [annotation][out] */ - __out IEnumNetCfgComponent **ppenum) = 0; - - }; - -#else /* C style interface */ - - typedef struct IEnumNetCfgComponentVtbl - { - BEGIN_INTERFACE - - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( - IEnumNetCfgComponent * This, - /* [in] */ REFIID riid, - /* [annotation][iid_is][out] */ - __RPC__deref_out void **ppvObject); - - ULONG ( STDMETHODCALLTYPE *AddRef )( - IEnumNetCfgComponent * This); - - ULONG ( STDMETHODCALLTYPE *Release )( - IEnumNetCfgComponent * This); - - HRESULT ( STDMETHODCALLTYPE *Next )( - IEnumNetCfgComponent * This, - /* [annotation][in] */ - __in ULONG celt, - /* [annotation][length_is][size_is][out] */ - __out_ecount(celt) INetCfgComponent **rgelt, - /* [annotation][out] */ - __out ULONG *pceltFetched); - - HRESULT ( STDMETHODCALLTYPE *Skip )( - IEnumNetCfgComponent * This, - /* [annotation][in] */ - __in ULONG celt); - - HRESULT ( STDMETHODCALLTYPE *Reset )( - IEnumNetCfgComponent * This); - - HRESULT ( STDMETHODCALLTYPE *Clone )( - IEnumNetCfgComponent * This, - /* [annotation][out] */ - __out IEnumNetCfgComponent **ppenum); - - END_INTERFACE - } IEnumNetCfgComponentVtbl; - - interface IEnumNetCfgComponent - { - CONST_VTBL struct IEnumNetCfgComponentVtbl *lpVtbl; - }; - - - -#ifdef COBJMACROS - - -#define IEnumNetCfgComponent_QueryInterface(This,riid,ppvObject) \ - ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) - -#define IEnumNetCfgComponent_AddRef(This) \ - ( (This)->lpVtbl -> AddRef(This) ) - -#define IEnumNetCfgComponent_Release(This) \ - ( (This)->lpVtbl -> Release(This) ) - - -#define IEnumNetCfgComponent_Next(This,celt,rgelt,pceltFetched) \ - ( (This)->lpVtbl -> Next(This,celt,rgelt,pceltFetched) ) - -#define IEnumNetCfgComponent_Skip(This,celt) \ - ( (This)->lpVtbl -> Skip(This,celt) ) - -#define IEnumNetCfgComponent_Reset(This) \ - ( (This)->lpVtbl -> Reset(This) ) - -#define IEnumNetCfgComponent_Clone(This,ppenum) \ - ( (This)->lpVtbl -> Clone(This,ppenum) ) - -#endif /* COBJMACROS */ - - -#endif /* C style interface */ - - - - -#endif /* __IEnumNetCfgComponent_INTERFACE_DEFINED__ */ - - -#ifndef __INetCfg_INTERFACE_DEFINED__ -#define __INetCfg_INTERFACE_DEFINED__ - -/* interface INetCfg */ -/* [unique][uuid][object][local] */ - - -EXTERN_C const IID IID_INetCfg; - -#if defined(__cplusplus) && !defined(CINTERFACE) - - MIDL_INTERFACE("C0E8AE93-306E-11D1-AACF-00805FC1270E") - INetCfg : public IUnknown - { - public: - virtual HRESULT STDMETHODCALLTYPE Initialize( - /* [annotation][in] */ - __in PVOID pvReserved) = 0; - - virtual HRESULT STDMETHODCALLTYPE Uninitialize( void) = 0; - - virtual HRESULT STDMETHODCALLTYPE Apply( void) = 0; - - virtual HRESULT STDMETHODCALLTYPE Cancel( void) = 0; - - virtual HRESULT STDMETHODCALLTYPE EnumComponents( - /* [annotation][in] */ - __in const GUID *pguidClass, - /* [annotation][out] */ - __deref_out_opt IEnumNetCfgComponent **ppenumComponent) = 0; - - virtual HRESULT STDMETHODCALLTYPE FindComponent( - /* [annotation][string][in] */ - __in __nullterminated LPCWSTR pszwInfId, - /* [annotation][out] */ - __deref_out_opt INetCfgComponent **pComponent) = 0; - - virtual HRESULT STDMETHODCALLTYPE QueryNetCfgClass( - /* [annotation][in] */ - __in const GUID *pguidClass, - /* [annotation][in] */ - __in REFIID riid, - /* [annotation][iid_is][out] */ - __deref_out_opt void **ppvObject) = 0; - - }; - -#else /* C style interface */ - - typedef struct INetCfgVtbl - { - BEGIN_INTERFACE - - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( - INetCfg * This, - /* [in] */ REFIID riid, - /* [annotation][iid_is][out] */ - __RPC__deref_out void **ppvObject); - - ULONG ( STDMETHODCALLTYPE *AddRef )( - INetCfg * This); - - ULONG ( STDMETHODCALLTYPE *Release )( - INetCfg * This); - - HRESULT ( STDMETHODCALLTYPE *Initialize )( - INetCfg * This, - /* [annotation][in] */ - __in PVOID pvReserved); - - HRESULT ( STDMETHODCALLTYPE *Uninitialize )( - INetCfg * This); - - HRESULT ( STDMETHODCALLTYPE *Apply )( - INetCfg * This); - - HRESULT ( STDMETHODCALLTYPE *Cancel )( - INetCfg * This); - - HRESULT ( STDMETHODCALLTYPE *EnumComponents )( - INetCfg * This, - /* [annotation][in] */ - __in const GUID *pguidClass, - /* [annotation][out] */ - __deref_out_opt IEnumNetCfgComponent **ppenumComponent); - - HRESULT ( STDMETHODCALLTYPE *FindComponent )( - INetCfg * This, - /* [annotation][string][in] */ - __in __nullterminated LPCWSTR pszwInfId, - /* [annotation][out] */ - __deref_out_opt INetCfgComponent **pComponent); - - HRESULT ( STDMETHODCALLTYPE *QueryNetCfgClass )( - INetCfg * This, - /* [annotation][in] */ - __in const GUID *pguidClass, - /* [annotation][in] */ - __in REFIID riid, - /* [annotation][iid_is][out] */ - __deref_out_opt void **ppvObject); - - END_INTERFACE - } INetCfgVtbl; - - interface INetCfg - { - CONST_VTBL struct INetCfgVtbl *lpVtbl; - }; - - - -#ifdef COBJMACROS - - -#define INetCfg_QueryInterface(This,riid,ppvObject) \ - ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) - -#define INetCfg_AddRef(This) \ - ( (This)->lpVtbl -> AddRef(This) ) - -#define INetCfg_Release(This) \ - ( (This)->lpVtbl -> Release(This) ) - - -#define INetCfg_Initialize(This,pvReserved) \ - ( (This)->lpVtbl -> Initialize(This,pvReserved) ) - -#define INetCfg_Uninitialize(This) \ - ( (This)->lpVtbl -> Uninitialize(This) ) - -#define INetCfg_Apply(This) \ - ( (This)->lpVtbl -> Apply(This) ) - -#define INetCfg_Cancel(This) \ - ( (This)->lpVtbl -> Cancel(This) ) - -#define INetCfg_EnumComponents(This,pguidClass,ppenumComponent) \ - ( (This)->lpVtbl -> EnumComponents(This,pguidClass,ppenumComponent) ) - -#define INetCfg_FindComponent(This,pszwInfId,pComponent) \ - ( (This)->lpVtbl -> FindComponent(This,pszwInfId,pComponent) ) - -#define INetCfg_QueryNetCfgClass(This,pguidClass,riid,ppvObject) \ - ( (This)->lpVtbl -> QueryNetCfgClass(This,pguidClass,riid,ppvObject) ) - -#endif /* COBJMACROS */ - - -#endif /* C style interface */ - - - - -#endif /* __INetCfg_INTERFACE_DEFINED__ */ - - -#ifndef __INetCfgLock_INTERFACE_DEFINED__ -#define __INetCfgLock_INTERFACE_DEFINED__ - -/* interface INetCfgLock */ -/* [unique][uuid][object][local] */ - - -EXTERN_C const IID IID_INetCfgLock; - -#if defined(__cplusplus) && !defined(CINTERFACE) - - MIDL_INTERFACE("C0E8AE9F-306E-11D1-AACF-00805FC1270E") - INetCfgLock : public IUnknown - { - public: - virtual HRESULT STDMETHODCALLTYPE AcquireWriteLock( - /* [annotation][in] */ - __in DWORD cmsTimeout, - /* [annotation][string][in] */ - __in __nullterminated LPCWSTR pszwClientDescription, - /* [annotation][string][out] */ - __deref_out_opt LPWSTR *ppszwClientDescription) = 0; - - virtual HRESULT STDMETHODCALLTYPE ReleaseWriteLock( void) = 0; - - virtual HRESULT STDMETHODCALLTYPE IsWriteLocked( - /* [annotation][string][out] */ - __deref_out __nullterminated LPWSTR *ppszwClientDescription) = 0; - - }; - -#else /* C style interface */ - - typedef struct INetCfgLockVtbl - { - BEGIN_INTERFACE - - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( - INetCfgLock * This, - /* [in] */ REFIID riid, - /* [annotation][iid_is][out] */ - __RPC__deref_out void **ppvObject); - - ULONG ( STDMETHODCALLTYPE *AddRef )( - INetCfgLock * This); - - ULONG ( STDMETHODCALLTYPE *Release )( - INetCfgLock * This); - - HRESULT ( STDMETHODCALLTYPE *AcquireWriteLock )( - INetCfgLock * This, - /* [annotation][in] */ - __in DWORD cmsTimeout, - /* [annotation][string][in] */ - __in __nullterminated LPCWSTR pszwClientDescription, - /* [annotation][string][out] */ - __deref_out_opt LPWSTR *ppszwClientDescription); - - HRESULT ( STDMETHODCALLTYPE *ReleaseWriteLock )( - INetCfgLock * This); - - HRESULT ( STDMETHODCALLTYPE *IsWriteLocked )( - INetCfgLock * This, - /* [annotation][string][out] */ - __deref_out __nullterminated LPWSTR *ppszwClientDescription); - - END_INTERFACE - } INetCfgLockVtbl; - - interface INetCfgLock - { - CONST_VTBL struct INetCfgLockVtbl *lpVtbl; - }; - - - -#ifdef COBJMACROS - - -#define INetCfgLock_QueryInterface(This,riid,ppvObject) \ - ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) - -#define INetCfgLock_AddRef(This) \ - ( (This)->lpVtbl -> AddRef(This) ) - -#define INetCfgLock_Release(This) \ - ( (This)->lpVtbl -> Release(This) ) - - -#define INetCfgLock_AcquireWriteLock(This,cmsTimeout,pszwClientDescription,ppszwClientDescription) \ - ( (This)->lpVtbl -> AcquireWriteLock(This,cmsTimeout,pszwClientDescription,ppszwClientDescription) ) - -#define INetCfgLock_ReleaseWriteLock(This) \ - ( (This)->lpVtbl -> ReleaseWriteLock(This) ) - -#define INetCfgLock_IsWriteLocked(This,ppszwClientDescription) \ - ( (This)->lpVtbl -> IsWriteLocked(This,ppszwClientDescription) ) - -#endif /* COBJMACROS */ - - -#endif /* C style interface */ - - - - -#endif /* __INetCfgLock_INTERFACE_DEFINED__ */ - - -#ifndef __INetCfgBindingInterface_INTERFACE_DEFINED__ -#define __INetCfgBindingInterface_INTERFACE_DEFINED__ - -/* interface INetCfgBindingInterface */ -/* [unique][uuid][object][local] */ - - -EXTERN_C const IID IID_INetCfgBindingInterface; - -#if defined(__cplusplus) && !defined(CINTERFACE) - - MIDL_INTERFACE("C0E8AE94-306E-11D1-AACF-00805FC1270E") - INetCfgBindingInterface : public IUnknown - { - public: - virtual HRESULT STDMETHODCALLTYPE GetName( - /* [annotation][string][out] */ - __deref_out LPWSTR *ppszwInterfaceName) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetUpperComponent( - /* [annotation][out] */ - __deref_out_opt INetCfgComponent **ppnccItem) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetLowerComponent( - /* [annotation][out] */ - __deref_out_opt INetCfgComponent **ppnccItem) = 0; - - }; - -#else /* C style interface */ - - typedef struct INetCfgBindingInterfaceVtbl - { - BEGIN_INTERFACE - - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( - INetCfgBindingInterface * This, - /* [in] */ REFIID riid, - /* [annotation][iid_is][out] */ - __RPC__deref_out void **ppvObject); - - ULONG ( STDMETHODCALLTYPE *AddRef )( - INetCfgBindingInterface * This); - - ULONG ( STDMETHODCALLTYPE *Release )( - INetCfgBindingInterface * This); - - HRESULT ( STDMETHODCALLTYPE *GetName )( - INetCfgBindingInterface * This, - /* [annotation][string][out] */ - __deref_out LPWSTR *ppszwInterfaceName); - - HRESULT ( STDMETHODCALLTYPE *GetUpperComponent )( - INetCfgBindingInterface * This, - /* [annotation][out] */ - __deref_out_opt INetCfgComponent **ppnccItem); - - HRESULT ( STDMETHODCALLTYPE *GetLowerComponent )( - INetCfgBindingInterface * This, - /* [annotation][out] */ - __deref_out_opt INetCfgComponent **ppnccItem); - - END_INTERFACE - } INetCfgBindingInterfaceVtbl; - - interface INetCfgBindingInterface - { - CONST_VTBL struct INetCfgBindingInterfaceVtbl *lpVtbl; - }; - - - -#ifdef COBJMACROS - - -#define INetCfgBindingInterface_QueryInterface(This,riid,ppvObject) \ - ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) - -#define INetCfgBindingInterface_AddRef(This) \ - ( (This)->lpVtbl -> AddRef(This) ) - -#define INetCfgBindingInterface_Release(This) \ - ( (This)->lpVtbl -> Release(This) ) - - -#define INetCfgBindingInterface_GetName(This,ppszwInterfaceName) \ - ( (This)->lpVtbl -> GetName(This,ppszwInterfaceName) ) - -#define INetCfgBindingInterface_GetUpperComponent(This,ppnccItem) \ - ( (This)->lpVtbl -> GetUpperComponent(This,ppnccItem) ) - -#define INetCfgBindingInterface_GetLowerComponent(This,ppnccItem) \ - ( (This)->lpVtbl -> GetLowerComponent(This,ppnccItem) ) - -#endif /* COBJMACROS */ - - -#endif /* C style interface */ - - - - -#endif /* __INetCfgBindingInterface_INTERFACE_DEFINED__ */ - - -#ifndef __INetCfgBindingPath_INTERFACE_DEFINED__ -#define __INetCfgBindingPath_INTERFACE_DEFINED__ - -/* interface INetCfgBindingPath */ -/* [unique][uuid][object][local] */ - - -EXTERN_C const IID IID_INetCfgBindingPath; - -#if defined(__cplusplus) && !defined(CINTERFACE) - - MIDL_INTERFACE("C0E8AE96-306E-11D1-AACF-00805FC1270E") - INetCfgBindingPath : public IUnknown - { - public: - virtual HRESULT STDMETHODCALLTYPE IsSamePathAs( - /* [annotation][in] */ - __in INetCfgBindingPath *pPath) = 0; - - virtual HRESULT STDMETHODCALLTYPE IsSubPathOf( - /* [annotation][in] */ - __in INetCfgBindingPath *pPath) = 0; - - virtual HRESULT STDMETHODCALLTYPE IsEnabled( void) = 0; - - virtual HRESULT STDMETHODCALLTYPE Enable( - /* [annotation][in] */ - __in BOOL fEnable) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetPathToken( - /* [annotation][string][out] */ - __deref_out __nullterminated LPWSTR *ppszwPathToken) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetOwner( - /* [annotation][out] */ - __deref_out_opt INetCfgComponent **ppComponent) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetDepth( - /* [annotation][out] */ - __out ULONG *pcInterfaces) = 0; - - virtual HRESULT STDMETHODCALLTYPE EnumBindingInterfaces( - /* [annotation][out] */ - __deref_out_opt IEnumNetCfgBindingInterface **ppenumInterface) = 0; - - }; - -#else /* C style interface */ - - typedef struct INetCfgBindingPathVtbl - { - BEGIN_INTERFACE - - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( - INetCfgBindingPath * This, - /* [in] */ REFIID riid, - /* [annotation][iid_is][out] */ - __RPC__deref_out void **ppvObject); - - ULONG ( STDMETHODCALLTYPE *AddRef )( - INetCfgBindingPath * This); - - ULONG ( STDMETHODCALLTYPE *Release )( - INetCfgBindingPath * This); - - HRESULT ( STDMETHODCALLTYPE *IsSamePathAs )( - INetCfgBindingPath * This, - /* [annotation][in] */ - __in INetCfgBindingPath *pPath); - - HRESULT ( STDMETHODCALLTYPE *IsSubPathOf )( - INetCfgBindingPath * This, - /* [annotation][in] */ - __in INetCfgBindingPath *pPath); - - HRESULT ( STDMETHODCALLTYPE *IsEnabled )( - INetCfgBindingPath * This); - - HRESULT ( STDMETHODCALLTYPE *Enable )( - INetCfgBindingPath * This, - /* [annotation][in] */ - __in BOOL fEnable); - - HRESULT ( STDMETHODCALLTYPE *GetPathToken )( - INetCfgBindingPath * This, - /* [annotation][string][out] */ - __deref_out __nullterminated LPWSTR *ppszwPathToken); - - HRESULT ( STDMETHODCALLTYPE *GetOwner )( - INetCfgBindingPath * This, - /* [annotation][out] */ - __deref_out_opt INetCfgComponent **ppComponent); - - HRESULT ( STDMETHODCALLTYPE *GetDepth )( - INetCfgBindingPath * This, - /* [annotation][out] */ - __out ULONG *pcInterfaces); - - HRESULT ( STDMETHODCALLTYPE *EnumBindingInterfaces )( - INetCfgBindingPath * This, - /* [annotation][out] */ - __deref_out_opt IEnumNetCfgBindingInterface **ppenumInterface); - - END_INTERFACE - } INetCfgBindingPathVtbl; - - interface INetCfgBindingPath - { - CONST_VTBL struct INetCfgBindingPathVtbl *lpVtbl; - }; - - - -#ifdef COBJMACROS - - -#define INetCfgBindingPath_QueryInterface(This,riid,ppvObject) \ - ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) - -#define INetCfgBindingPath_AddRef(This) \ - ( (This)->lpVtbl -> AddRef(This) ) - -#define INetCfgBindingPath_Release(This) \ - ( (This)->lpVtbl -> Release(This) ) - - -#define INetCfgBindingPath_IsSamePathAs(This,pPath) \ - ( (This)->lpVtbl -> IsSamePathAs(This,pPath) ) - -#define INetCfgBindingPath_IsSubPathOf(This,pPath) \ - ( (This)->lpVtbl -> IsSubPathOf(This,pPath) ) - -#define INetCfgBindingPath_IsEnabled(This) \ - ( (This)->lpVtbl -> IsEnabled(This) ) - -#define INetCfgBindingPath_Enable(This,fEnable) \ - ( (This)->lpVtbl -> Enable(This,fEnable) ) - -#define INetCfgBindingPath_GetPathToken(This,ppszwPathToken) \ - ( (This)->lpVtbl -> GetPathToken(This,ppszwPathToken) ) - -#define INetCfgBindingPath_GetOwner(This,ppComponent) \ - ( (This)->lpVtbl -> GetOwner(This,ppComponent) ) - -#define INetCfgBindingPath_GetDepth(This,pcInterfaces) \ - ( (This)->lpVtbl -> GetDepth(This,pcInterfaces) ) - -#define INetCfgBindingPath_EnumBindingInterfaces(This,ppenumInterface) \ - ( (This)->lpVtbl -> EnumBindingInterfaces(This,ppenumInterface) ) - -#endif /* COBJMACROS */ - - -#endif /* C style interface */ - - - - -#endif /* __INetCfgBindingPath_INTERFACE_DEFINED__ */ - - -#ifndef __INetCfgClass_INTERFACE_DEFINED__ -#define __INetCfgClass_INTERFACE_DEFINED__ - -/* interface INetCfgClass */ -/* [unique][uuid][object][local] */ - - -EXTERN_C const IID IID_INetCfgClass; - -#if defined(__cplusplus) && !defined(CINTERFACE) - - MIDL_INTERFACE("C0E8AE97-306E-11D1-AACF-00805FC1270E") - INetCfgClass : public IUnknown - { - public: - virtual HRESULT STDMETHODCALLTYPE FindComponent( - /* [annotation][string][in] */ - __in __nullterminated LPCWSTR pszwInfId, - /* [annotation][out] */ - __deref_out_opt INetCfgComponent **ppnccItem) = 0; - - virtual HRESULT STDMETHODCALLTYPE EnumComponents( - /* [annotation][out] */ - __deref_out_opt IEnumNetCfgComponent **ppenumComponent) = 0; - - }; - -#else /* C style interface */ - - typedef struct INetCfgClassVtbl - { - BEGIN_INTERFACE - - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( - INetCfgClass * This, - /* [in] */ REFIID riid, - /* [annotation][iid_is][out] */ - __RPC__deref_out void **ppvObject); - - ULONG ( STDMETHODCALLTYPE *AddRef )( - INetCfgClass * This); - - ULONG ( STDMETHODCALLTYPE *Release )( - INetCfgClass * This); - - HRESULT ( STDMETHODCALLTYPE *FindComponent )( - INetCfgClass * This, - /* [annotation][string][in] */ - __in __nullterminated LPCWSTR pszwInfId, - /* [annotation][out] */ - __deref_out_opt INetCfgComponent **ppnccItem); - - HRESULT ( STDMETHODCALLTYPE *EnumComponents )( - INetCfgClass * This, - /* [annotation][out] */ - __deref_out_opt IEnumNetCfgComponent **ppenumComponent); - - END_INTERFACE - } INetCfgClassVtbl; - - interface INetCfgClass - { - CONST_VTBL struct INetCfgClassVtbl *lpVtbl; - }; - - - -#ifdef COBJMACROS - - -#define INetCfgClass_QueryInterface(This,riid,ppvObject) \ - ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) - -#define INetCfgClass_AddRef(This) \ - ( (This)->lpVtbl -> AddRef(This) ) - -#define INetCfgClass_Release(This) \ - ( (This)->lpVtbl -> Release(This) ) - - -#define INetCfgClass_FindComponent(This,pszwInfId,ppnccItem) \ - ( (This)->lpVtbl -> FindComponent(This,pszwInfId,ppnccItem) ) - -#define INetCfgClass_EnumComponents(This,ppenumComponent) \ - ( (This)->lpVtbl -> EnumComponents(This,ppenumComponent) ) - -#endif /* COBJMACROS */ - - -#endif /* C style interface */ - - - - -#endif /* __INetCfgClass_INTERFACE_DEFINED__ */ - - -#ifndef __INetCfgClassSetup_INTERFACE_DEFINED__ -#define __INetCfgClassSetup_INTERFACE_DEFINED__ - -/* interface INetCfgClassSetup */ -/* [unique][uuid][object][local] */ - -typedef -enum tagOBO_TOKEN_TYPE - { OBO_USER = 1, - OBO_COMPONENT = 2, - OBO_SOFTWARE = 3 - } OBO_TOKEN_TYPE; - -typedef struct tagOBO_TOKEN - { - OBO_TOKEN_TYPE Type; - INetCfgComponent *pncc; - LPCWSTR pszwManufacturer; - LPCWSTR pszwProduct; - LPCWSTR pszwDisplayName; - BOOL fRegistered; - } OBO_TOKEN; - - -EXTERN_C const IID IID_INetCfgClassSetup; - -#if defined(__cplusplus) && !defined(CINTERFACE) - - MIDL_INTERFACE("C0E8AE9D-306E-11D1-AACF-00805FC1270E") - INetCfgClassSetup : public IUnknown - { - public: - virtual HRESULT STDMETHODCALLTYPE SelectAndInstall( - /* [annotation][in] */ - __in HWND hwndParent, - /* [annotation][in] */ - __in_opt OBO_TOKEN *pOboToken, - /* [annotation][out] */ - __deref_out_opt INetCfgComponent **ppnccItem) = 0; - - virtual HRESULT STDMETHODCALLTYPE Install( - /* [annotation][string][in] */ - __in LPCWSTR pszwInfId, - /* [annotation][in] */ - __in_opt OBO_TOKEN *pOboToken, - /* [annotation][in] */ - __in_opt DWORD dwSetupFlags, - /* [annotation][in] */ - __in_opt DWORD dwUpgradeFromBuildNo, - /* [annotation][string][in] */ - __in_opt LPCWSTR pszwAnswerFile, - /* [annotation][string][in] */ - __in_opt LPCWSTR pszwAnswerSections, - /* [annotation][out] */ - __deref_out_opt INetCfgComponent **ppnccItem) = 0; - - virtual HRESULT STDMETHODCALLTYPE DeInstall( - /* [annotation][in] */ - __in INetCfgComponent *pComponent, - /* [annotation][in] */ - __in_opt OBO_TOKEN *pOboToken, - /* [annotation][out] */ - __deref_out_opt LPWSTR *pmszwRefs) = 0; - - }; - -#else /* C style interface */ - - typedef struct INetCfgClassSetupVtbl - { - BEGIN_INTERFACE - - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( - INetCfgClassSetup * This, - /* [in] */ REFIID riid, - /* [annotation][iid_is][out] */ - __RPC__deref_out void **ppvObject); - - ULONG ( STDMETHODCALLTYPE *AddRef )( - INetCfgClassSetup * This); - - ULONG ( STDMETHODCALLTYPE *Release )( - INetCfgClassSetup * This); - - HRESULT ( STDMETHODCALLTYPE *SelectAndInstall )( - INetCfgClassSetup * This, - /* [annotation][in] */ - __in HWND hwndParent, - /* [annotation][in] */ - __in_opt OBO_TOKEN *pOboToken, - /* [annotation][out] */ - __deref_out_opt INetCfgComponent **ppnccItem); - - HRESULT ( STDMETHODCALLTYPE *Install )( - INetCfgClassSetup * This, - /* [annotation][string][in] */ - __in LPCWSTR pszwInfId, - /* [annotation][in] */ - __in_opt OBO_TOKEN *pOboToken, - /* [annotation][in] */ - __in_opt DWORD dwSetupFlags, - /* [annotation][in] */ - __in_opt DWORD dwUpgradeFromBuildNo, - /* [annotation][string][in] */ - __in_opt LPCWSTR pszwAnswerFile, - /* [annotation][string][in] */ - __in_opt LPCWSTR pszwAnswerSections, - /* [annotation][out] */ - __deref_out_opt INetCfgComponent **ppnccItem); - - HRESULT ( STDMETHODCALLTYPE *DeInstall )( - INetCfgClassSetup * This, - /* [annotation][in] */ - __in INetCfgComponent *pComponent, - /* [annotation][in] */ - __in_opt OBO_TOKEN *pOboToken, - /* [annotation][out] */ - __deref_out_opt LPWSTR *pmszwRefs); - - END_INTERFACE - } INetCfgClassSetupVtbl; - - interface INetCfgClassSetup - { - CONST_VTBL struct INetCfgClassSetupVtbl *lpVtbl; - }; - - - -#ifdef COBJMACROS - - -#define INetCfgClassSetup_QueryInterface(This,riid,ppvObject) \ - ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) - -#define INetCfgClassSetup_AddRef(This) \ - ( (This)->lpVtbl -> AddRef(This) ) - -#define INetCfgClassSetup_Release(This) \ - ( (This)->lpVtbl -> Release(This) ) - - -#define INetCfgClassSetup_SelectAndInstall(This,hwndParent,pOboToken,ppnccItem) \ - ( (This)->lpVtbl -> SelectAndInstall(This,hwndParent,pOboToken,ppnccItem) ) - -#define INetCfgClassSetup_Install(This,pszwInfId,pOboToken,dwSetupFlags,dwUpgradeFromBuildNo,pszwAnswerFile,pszwAnswerSections,ppnccItem) \ - ( (This)->lpVtbl -> Install(This,pszwInfId,pOboToken,dwSetupFlags,dwUpgradeFromBuildNo,pszwAnswerFile,pszwAnswerSections,ppnccItem) ) - -#define INetCfgClassSetup_DeInstall(This,pComponent,pOboToken,pmszwRefs) \ - ( (This)->lpVtbl -> DeInstall(This,pComponent,pOboToken,pmszwRefs) ) - -#endif /* COBJMACROS */ - - -#endif /* C style interface */ - - - - -#endif /* __INetCfgClassSetup_INTERFACE_DEFINED__ */ - - -#ifndef __INetCfgComponent_INTERFACE_DEFINED__ -#define __INetCfgComponent_INTERFACE_DEFINED__ - -/* interface INetCfgComponent */ -/* [unique][uuid][object][local] */ - -typedef -enum tagCOMPONENT_CHARACTERISTICS - { NCF_VIRTUAL = 0x1, - NCF_SOFTWARE_ENUMERATED = 0x2, - NCF_PHYSICAL = 0x4, - NCF_HIDDEN = 0x8, - NCF_NO_SERVICE = 0x10, - NCF_NOT_USER_REMOVABLE = 0x20, - NCF_MULTIPORT_INSTANCED_ADAPTER = 0x40, - NCF_HAS_UI = 0x80, - NCF_SINGLE_INSTANCE = 0x100, - NCF_FILTER = 0x400, - NCF_DONTEXPOSELOWER = 0x1000, - NCF_HIDE_BINDING = 0x2000, - NCF_NDIS_PROTOCOL = 0x4000, - NCF_FIXED_BINDING = 0x20000, - NCF_LW_FILTER = 0x40000 - } COMPONENT_CHARACTERISTICS; - -typedef -enum tagNCRP_FLAGS - { NCRP_QUERY_PROPERTY_UI = 0x1, - NCRP_SHOW_PROPERTY_UI = 0x2 - } NCRP_FLAGS; - - -EXTERN_C const IID IID_INetCfgComponent; - -#if defined(__cplusplus) && !defined(CINTERFACE) - - MIDL_INTERFACE("C0E8AE99-306E-11D1-AACF-00805FC1270E") - INetCfgComponent : public IUnknown - { - public: - virtual HRESULT STDMETHODCALLTYPE GetDisplayName( - /* [annotation][string][out] */ - __deref_out_opt LPWSTR *ppszwDisplayName) = 0; - - virtual HRESULT STDMETHODCALLTYPE SetDisplayName( - /* [annotation][string][in] */ - __in LPCWSTR pszwDisplayName) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetHelpText( - /* [annotation][string][out] */ - __deref_out_opt LPWSTR *pszwHelpText) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetId( - /* [annotation][string][out] */ - __deref_out_opt LPWSTR *ppszwId) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetCharacteristics( - /* [annotation][out] */ - __out LPDWORD pdwCharacteristics) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetInstanceGuid( - /* [annotation][out] */ - __out_opt GUID *pGuid) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetPnpDevNodeId( - /* [annotation][string][out] */ - __deref_out_opt LPWSTR *ppszwDevNodeId) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetClassGuid( - /* [annotation][out] */ - __out_opt GUID *pGuid) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetBindName( - /* [annotation][string][out] */ - __deref_out_opt LPWSTR *ppszwBindName) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetDeviceStatus( - /* [annotation][out] */ - __out ULONG *pulStatus) = 0; - - virtual HRESULT STDMETHODCALLTYPE OpenParamKey( - /* [annotation][out] */ - __deref_out_opt HKEY *phkey) = 0; - - virtual HRESULT STDMETHODCALLTYPE RaisePropertyUi( - /* [annotation][in] */ - __in_opt HWND hwndParent, - /* [annotation][in] */ - __in DWORD dwFlags, - /* [annotation][in] */ - __in_opt IUnknown *punkContext) = 0; - - }; - -#else /* C style interface */ - - typedef struct INetCfgComponentVtbl - { - BEGIN_INTERFACE - - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( - INetCfgComponent * This, - /* [in] */ REFIID riid, - /* [annotation][iid_is][out] */ - __RPC__deref_out void **ppvObject); - - ULONG ( STDMETHODCALLTYPE *AddRef )( - INetCfgComponent * This); - - ULONG ( STDMETHODCALLTYPE *Release )( - INetCfgComponent * This); - - HRESULT ( STDMETHODCALLTYPE *GetDisplayName )( - INetCfgComponent * This, - /* [annotation][string][out] */ - __deref_out_opt LPWSTR *ppszwDisplayName); - - HRESULT ( STDMETHODCALLTYPE *SetDisplayName )( - INetCfgComponent * This, - /* [annotation][string][in] */ - __in LPCWSTR pszwDisplayName); - - HRESULT ( STDMETHODCALLTYPE *GetHelpText )( - INetCfgComponent * This, - /* [annotation][string][out] */ - __deref_out_opt LPWSTR *pszwHelpText); - - HRESULT ( STDMETHODCALLTYPE *GetId )( - INetCfgComponent * This, - /* [annotation][string][out] */ - __deref_out_opt LPWSTR *ppszwId); - - HRESULT ( STDMETHODCALLTYPE *GetCharacteristics )( - INetCfgComponent * This, - /* [annotation][out] */ - __out LPDWORD pdwCharacteristics); - - HRESULT ( STDMETHODCALLTYPE *GetInstanceGuid )( - INetCfgComponent * This, - /* [annotation][out] */ - __out_opt GUID *pGuid); - - HRESULT ( STDMETHODCALLTYPE *GetPnpDevNodeId )( - INetCfgComponent * This, - /* [annotation][string][out] */ - __deref_out_opt LPWSTR *ppszwDevNodeId); - - HRESULT ( STDMETHODCALLTYPE *GetClassGuid )( - INetCfgComponent * This, - /* [annotation][out] */ - __out_opt GUID *pGuid); - - HRESULT ( STDMETHODCALLTYPE *GetBindName )( - INetCfgComponent * This, - /* [annotation][string][out] */ - __deref_out_opt LPWSTR *ppszwBindName); - - HRESULT ( STDMETHODCALLTYPE *GetDeviceStatus )( - INetCfgComponent * This, - /* [annotation][out] */ - __out ULONG *pulStatus); - - HRESULT ( STDMETHODCALLTYPE *OpenParamKey )( - INetCfgComponent * This, - /* [annotation][out] */ - __deref_out_opt HKEY *phkey); - - HRESULT ( STDMETHODCALLTYPE *RaisePropertyUi )( - INetCfgComponent * This, - /* [annotation][in] */ - __in_opt HWND hwndParent, - /* [annotation][in] */ - __in DWORD dwFlags, - /* [annotation][in] */ - __in_opt IUnknown *punkContext); - - END_INTERFACE - } INetCfgComponentVtbl; - - interface INetCfgComponent - { - CONST_VTBL struct INetCfgComponentVtbl *lpVtbl; - }; - - - -#ifdef COBJMACROS - - -#define INetCfgComponent_QueryInterface(This,riid,ppvObject) \ - ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) - -#define INetCfgComponent_AddRef(This) \ - ( (This)->lpVtbl -> AddRef(This) ) - -#define INetCfgComponent_Release(This) \ - ( (This)->lpVtbl -> Release(This) ) - - -#define INetCfgComponent_GetDisplayName(This,ppszwDisplayName) \ - ( (This)->lpVtbl -> GetDisplayName(This,ppszwDisplayName) ) - -#define INetCfgComponent_SetDisplayName(This,pszwDisplayName) \ - ( (This)->lpVtbl -> SetDisplayName(This,pszwDisplayName) ) - -#define INetCfgComponent_GetHelpText(This,pszwHelpText) \ - ( (This)->lpVtbl -> GetHelpText(This,pszwHelpText) ) - -#define INetCfgComponent_GetId(This,ppszwId) \ - ( (This)->lpVtbl -> GetId(This,ppszwId) ) - -#define INetCfgComponent_GetCharacteristics(This,pdwCharacteristics) \ - ( (This)->lpVtbl -> GetCharacteristics(This,pdwCharacteristics) ) - -#define INetCfgComponent_GetInstanceGuid(This,pGuid) \ - ( (This)->lpVtbl -> GetInstanceGuid(This,pGuid) ) - -#define INetCfgComponent_GetPnpDevNodeId(This,ppszwDevNodeId) \ - ( (This)->lpVtbl -> GetPnpDevNodeId(This,ppszwDevNodeId) ) - -#define INetCfgComponent_GetClassGuid(This,pGuid) \ - ( (This)->lpVtbl -> GetClassGuid(This,pGuid) ) - -#define INetCfgComponent_GetBindName(This,ppszwBindName) \ - ( (This)->lpVtbl -> GetBindName(This,ppszwBindName) ) - -#define INetCfgComponent_GetDeviceStatus(This,pulStatus) \ - ( (This)->lpVtbl -> GetDeviceStatus(This,pulStatus) ) - -#define INetCfgComponent_OpenParamKey(This,phkey) \ - ( (This)->lpVtbl -> OpenParamKey(This,phkey) ) - -#define INetCfgComponent_RaisePropertyUi(This,hwndParent,dwFlags,punkContext) \ - ( (This)->lpVtbl -> RaisePropertyUi(This,hwndParent,dwFlags,punkContext) ) - -#endif /* COBJMACROS */ - - -#endif /* C style interface */ - - - - -#endif /* __INetCfgComponent_INTERFACE_DEFINED__ */ - - -#ifndef __INetCfgComponentBindings_INTERFACE_DEFINED__ -#define __INetCfgComponentBindings_INTERFACE_DEFINED__ - -/* interface INetCfgComponentBindings */ -/* [unique][uuid][object][local] */ - -typedef -enum tagSUPPORTS_BINDING_INTERFACE_FLAGS - { NCF_LOWER = 0x1, - NCF_UPPER = 0x2 - } SUPPORTS_BINDING_INTERFACE_FLAGS; - -typedef -enum tagENUM_BINDING_PATHS_FLAGS - { EBP_ABOVE = 0x1, - EBP_BELOW = 0x2 - } ENUM_BINDING_PATHS_FLAGS; - - -EXTERN_C const IID IID_INetCfgComponentBindings; - -#if defined(__cplusplus) && !defined(CINTERFACE) - - MIDL_INTERFACE("C0E8AE9E-306E-11D1-AACF-00805FC1270E") - INetCfgComponentBindings : public IUnknown - { - public: - virtual HRESULT STDMETHODCALLTYPE BindTo( - /* [annotation][in] */ - __in INetCfgComponent *pnccItem) = 0; - - virtual HRESULT STDMETHODCALLTYPE UnbindFrom( - /* [annotation][in] */ - __in INetCfgComponent *pnccItem) = 0; - - virtual HRESULT STDMETHODCALLTYPE SupportsBindingInterface( - /* [annotation][in] */ - __in DWORD dwFlags, - /* [annotation][in] */ - __in __nullterminated LPCWSTR pszwInterfaceName) = 0; - - virtual HRESULT STDMETHODCALLTYPE IsBoundTo( - /* [annotation][in] */ - __in INetCfgComponent *pnccItem) = 0; - - virtual HRESULT STDMETHODCALLTYPE IsBindableTo( - /* [annotation][in] */ - __in INetCfgComponent *pnccItem) = 0; - - virtual HRESULT STDMETHODCALLTYPE EnumBindingPaths( - /* [annotation][in] */ - __in DWORD dwFlags, - /* [annotation][out] */ - __deref_out_opt IEnumNetCfgBindingPath **ppIEnum) = 0; - - virtual HRESULT STDMETHODCALLTYPE MoveBefore( - /* [annotation][in] */ - __in INetCfgBindingPath *pncbItemSrc, - /* [annotation][in] */ - __in INetCfgBindingPath *pncbItemDest) = 0; - - virtual HRESULT STDMETHODCALLTYPE MoveAfter( - /* [annotation][in] */ - __in INetCfgBindingPath *pncbItemSrc, - /* [annotation][in] */ - __in INetCfgBindingPath *pncbItemDest) = 0; - - }; - -#else /* C style interface */ - - typedef struct INetCfgComponentBindingsVtbl - { - BEGIN_INTERFACE - - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( - INetCfgComponentBindings * This, - /* [in] */ REFIID riid, - /* [annotation][iid_is][out] */ - __RPC__deref_out void **ppvObject); - - ULONG ( STDMETHODCALLTYPE *AddRef )( - INetCfgComponentBindings * This); - - ULONG ( STDMETHODCALLTYPE *Release )( - INetCfgComponentBindings * This); - - HRESULT ( STDMETHODCALLTYPE *BindTo )( - INetCfgComponentBindings * This, - /* [annotation][in] */ - __in INetCfgComponent *pnccItem); - - HRESULT ( STDMETHODCALLTYPE *UnbindFrom )( - INetCfgComponentBindings * This, - /* [annotation][in] */ - __in INetCfgComponent *pnccItem); - - HRESULT ( STDMETHODCALLTYPE *SupportsBindingInterface )( - INetCfgComponentBindings * This, - /* [annotation][in] */ - __in DWORD dwFlags, - /* [annotation][in] */ - __in __nullterminated LPCWSTR pszwInterfaceName); - - HRESULT ( STDMETHODCALLTYPE *IsBoundTo )( - INetCfgComponentBindings * This, - /* [annotation][in] */ - __in INetCfgComponent *pnccItem); - - HRESULT ( STDMETHODCALLTYPE *IsBindableTo )( - INetCfgComponentBindings * This, - /* [annotation][in] */ - __in INetCfgComponent *pnccItem); - - HRESULT ( STDMETHODCALLTYPE *EnumBindingPaths )( - INetCfgComponentBindings * This, - /* [annotation][in] */ - __in DWORD dwFlags, - /* [annotation][out] */ - __deref_out_opt IEnumNetCfgBindingPath **ppIEnum); - - HRESULT ( STDMETHODCALLTYPE *MoveBefore )( - INetCfgComponentBindings * This, - /* [annotation][in] */ - __in INetCfgBindingPath *pncbItemSrc, - /* [annotation][in] */ - __in INetCfgBindingPath *pncbItemDest); - - HRESULT ( STDMETHODCALLTYPE *MoveAfter )( - INetCfgComponentBindings * This, - /* [annotation][in] */ - __in INetCfgBindingPath *pncbItemSrc, - /* [annotation][in] */ - __in INetCfgBindingPath *pncbItemDest); - - END_INTERFACE - } INetCfgComponentBindingsVtbl; - - interface INetCfgComponentBindings - { - CONST_VTBL struct INetCfgComponentBindingsVtbl *lpVtbl; - }; - - - -#ifdef COBJMACROS - - -#define INetCfgComponentBindings_QueryInterface(This,riid,ppvObject) \ - ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) - -#define INetCfgComponentBindings_AddRef(This) \ - ( (This)->lpVtbl -> AddRef(This) ) - -#define INetCfgComponentBindings_Release(This) \ - ( (This)->lpVtbl -> Release(This) ) - - -#define INetCfgComponentBindings_BindTo(This,pnccItem) \ - ( (This)->lpVtbl -> BindTo(This,pnccItem) ) - -#define INetCfgComponentBindings_UnbindFrom(This,pnccItem) \ - ( (This)->lpVtbl -> UnbindFrom(This,pnccItem) ) - -#define INetCfgComponentBindings_SupportsBindingInterface(This,dwFlags,pszwInterfaceName) \ - ( (This)->lpVtbl -> SupportsBindingInterface(This,dwFlags,pszwInterfaceName) ) - -#define INetCfgComponentBindings_IsBoundTo(This,pnccItem) \ - ( (This)->lpVtbl -> IsBoundTo(This,pnccItem) ) - -#define INetCfgComponentBindings_IsBindableTo(This,pnccItem) \ - ( (This)->lpVtbl -> IsBindableTo(This,pnccItem) ) - -#define INetCfgComponentBindings_EnumBindingPaths(This,dwFlags,ppIEnum) \ - ( (This)->lpVtbl -> EnumBindingPaths(This,dwFlags,ppIEnum) ) - -#define INetCfgComponentBindings_MoveBefore(This,pncbItemSrc,pncbItemDest) \ - ( (This)->lpVtbl -> MoveBefore(This,pncbItemSrc,pncbItemDest) ) - -#define INetCfgComponentBindings_MoveAfter(This,pncbItemSrc,pncbItemDest) \ - ( (This)->lpVtbl -> MoveAfter(This,pncbItemSrc,pncbItemDest) ) - -#endif /* COBJMACROS */ - - -#endif /* C style interface */ - - - - -#endif /* __INetCfgComponentBindings_INTERFACE_DEFINED__ */ - - -#ifndef __INetCfgSysPrep_INTERFACE_DEFINED__ -#define __INetCfgSysPrep_INTERFACE_DEFINED__ - -/* interface INetCfgSysPrep */ -/* [unique][uuid][object][local] */ - - -EXTERN_C const IID IID_INetCfgSysPrep; - -#if defined(__cplusplus) && !defined(CINTERFACE) - - MIDL_INTERFACE("C0E8AE98-306E-11D1-AACF-00805FC1270E") - INetCfgSysPrep : public IUnknown - { - public: - virtual HRESULT STDMETHODCALLTYPE HrSetupSetFirstDword( - /* [annotation][string][in] */ - __in __nullterminated LPCWSTR pwszSection, - /* [annotation][string][in] */ - __in __nullterminated LPCWSTR pwszKey, - /* [in] */ DWORD dwValue) = 0; - - virtual HRESULT STDMETHODCALLTYPE HrSetupSetFirstString( - /* [annotation][string][in] */ - __in __nullterminated LPCWSTR pwszSection, - /* [annotation][string][in] */ - __in __nullterminated LPCWSTR pwszKey, - /* [annotation][string][in] */ - __in __nullterminated LPCWSTR pwszValue) = 0; - - virtual HRESULT STDMETHODCALLTYPE HrSetupSetFirstStringAsBool( - /* [annotation][string][in] */ - __in __nullterminated LPCWSTR pwszSection, - /* [annotation][string][in] */ - __in __nullterminated LPCWSTR pwszKey, - /* [in] */ BOOL fValue) = 0; - - virtual HRESULT STDMETHODCALLTYPE HrSetupSetFirstMultiSzField( - /* [annotation][string][in] */ - __in __nullterminated LPCWSTR pwszSection, - /* [annotation][string][in] */ - __in __nullterminated LPCWSTR pwszKey, - /* [annotation][in] */ - __in __nullterminated LPCWSTR pmszValue) = 0; - - }; - -#else /* C style interface */ - - typedef struct INetCfgSysPrepVtbl - { - BEGIN_INTERFACE - - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( - INetCfgSysPrep * This, - /* [in] */ REFIID riid, - /* [annotation][iid_is][out] */ - __RPC__deref_out void **ppvObject); - - ULONG ( STDMETHODCALLTYPE *AddRef )( - INetCfgSysPrep * This); - - ULONG ( STDMETHODCALLTYPE *Release )( - INetCfgSysPrep * This); - - HRESULT ( STDMETHODCALLTYPE *HrSetupSetFirstDword )( - INetCfgSysPrep * This, - /* [annotation][string][in] */ - __in __nullterminated LPCWSTR pwszSection, - /* [annotation][string][in] */ - __in __nullterminated LPCWSTR pwszKey, - /* [in] */ DWORD dwValue); - - HRESULT ( STDMETHODCALLTYPE *HrSetupSetFirstString )( - INetCfgSysPrep * This, - /* [annotation][string][in] */ - __in __nullterminated LPCWSTR pwszSection, - /* [annotation][string][in] */ - __in __nullterminated LPCWSTR pwszKey, - /* [annotation][string][in] */ - __in __nullterminated LPCWSTR pwszValue); - - HRESULT ( STDMETHODCALLTYPE *HrSetupSetFirstStringAsBool )( - INetCfgSysPrep * This, - /* [annotation][string][in] */ - __in __nullterminated LPCWSTR pwszSection, - /* [annotation][string][in] */ - __in __nullterminated LPCWSTR pwszKey, - /* [in] */ BOOL fValue); - - HRESULT ( STDMETHODCALLTYPE *HrSetupSetFirstMultiSzField )( - INetCfgSysPrep * This, - /* [annotation][string][in] */ - __in __nullterminated LPCWSTR pwszSection, - /* [annotation][string][in] */ - __in __nullterminated LPCWSTR pwszKey, - /* [annotation][in] */ - __in __nullterminated LPCWSTR pmszValue); - - END_INTERFACE - } INetCfgSysPrepVtbl; - - interface INetCfgSysPrep - { - CONST_VTBL struct INetCfgSysPrepVtbl *lpVtbl; - }; - - - -#ifdef COBJMACROS - - -#define INetCfgSysPrep_QueryInterface(This,riid,ppvObject) \ - ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) - -#define INetCfgSysPrep_AddRef(This) \ - ( (This)->lpVtbl -> AddRef(This) ) - -#define INetCfgSysPrep_Release(This) \ - ( (This)->lpVtbl -> Release(This) ) - - -#define INetCfgSysPrep_HrSetupSetFirstDword(This,pwszSection,pwszKey,dwValue) \ - ( (This)->lpVtbl -> HrSetupSetFirstDword(This,pwszSection,pwszKey,dwValue) ) - -#define INetCfgSysPrep_HrSetupSetFirstString(This,pwszSection,pwszKey,pwszValue) \ - ( (This)->lpVtbl -> HrSetupSetFirstString(This,pwszSection,pwszKey,pwszValue) ) - -#define INetCfgSysPrep_HrSetupSetFirstStringAsBool(This,pwszSection,pwszKey,fValue) \ - ( (This)->lpVtbl -> HrSetupSetFirstStringAsBool(This,pwszSection,pwszKey,fValue) ) - -#define INetCfgSysPrep_HrSetupSetFirstMultiSzField(This,pwszSection,pwszKey,pmszValue) \ - ( (This)->lpVtbl -> HrSetupSetFirstMultiSzField(This,pwszSection,pwszKey,pmszValue) ) - -#endif /* COBJMACROS */ - - -#endif /* C style interface */ - - - - -#endif /* __INetCfgSysPrep_INTERFACE_DEFINED__ */ - - -/* Additional Prototypes for ALL interfaces */ - -/* end of Additional Prototypes */ - -#ifdef __cplusplus -} -#endif - -#endif - - - + + +/* this ALWAYS GENERATED file contains the definitions for the interfaces */ + + + /* File created by MIDL compiler version 7.00.0555 */ +/* Compiler settings for netcfgx.idl: + Oicf, W1, Zp8, env=Win32 (32b run), target_arch=X86 7.00.0555 + protocol : dce , ms_ext, c_ext, robust + error checks: allocation ref bounds_check enum stub_data + VC __declspec() decoration level: + __declspec(uuid()), __declspec(selectany), __declspec(novtable) + DECLSPEC_UUID(), MIDL_INTERFACE() +*/ +/* @@MIDL_FILE_HEADING( ) */ + +#pragma warning( disable: 4049 ) /* more than 64k source lines */ + + +/* verify that the version is high enough to compile this file*/ +#ifndef __REQUIRED_RPCNDR_H_VERSION__ +#define __REQUIRED_RPCNDR_H_VERSION__ 500 +#endif + +/* verify that the version is high enough to compile this file*/ +#ifndef __REQUIRED_RPCSAL_H_VERSION__ +#define __REQUIRED_RPCSAL_H_VERSION__ 100 +#endif + +#include "rpc.h" +#include "rpcndr.h" + +#ifndef __RPCNDR_H_VERSION__ +#error this stub requires an updated version of +#endif // __RPCNDR_H_VERSION__ + +#ifndef COM_NO_WINDOWS_H +#include "windows.h" +#include "ole2.h" +#endif /*COM_NO_WINDOWS_H*/ + +#ifndef __netcfgx_h__ +#define __netcfgx_h__ + +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +#pragma once +#endif + +/* Forward Declarations */ + +#ifndef __IEnumNetCfgBindingInterface_FWD_DEFINED__ +#define __IEnumNetCfgBindingInterface_FWD_DEFINED__ +typedef interface IEnumNetCfgBindingInterface IEnumNetCfgBindingInterface; +#endif /* __IEnumNetCfgBindingInterface_FWD_DEFINED__ */ + + +#ifndef __IEnumNetCfgBindingPath_FWD_DEFINED__ +#define __IEnumNetCfgBindingPath_FWD_DEFINED__ +typedef interface IEnumNetCfgBindingPath IEnumNetCfgBindingPath; +#endif /* __IEnumNetCfgBindingPath_FWD_DEFINED__ */ + + +#ifndef __IEnumNetCfgComponent_FWD_DEFINED__ +#define __IEnumNetCfgComponent_FWD_DEFINED__ +typedef interface IEnumNetCfgComponent IEnumNetCfgComponent; +#endif /* __IEnumNetCfgComponent_FWD_DEFINED__ */ + + +#ifndef __INetCfg_FWD_DEFINED__ +#define __INetCfg_FWD_DEFINED__ +typedef interface INetCfg INetCfg; +#endif /* __INetCfg_FWD_DEFINED__ */ + + +#ifndef __INetCfgLock_FWD_DEFINED__ +#define __INetCfgLock_FWD_DEFINED__ +typedef interface INetCfgLock INetCfgLock; +#endif /* __INetCfgLock_FWD_DEFINED__ */ + + +#ifndef __INetCfgBindingInterface_FWD_DEFINED__ +#define __INetCfgBindingInterface_FWD_DEFINED__ +typedef interface INetCfgBindingInterface INetCfgBindingInterface; +#endif /* __INetCfgBindingInterface_FWD_DEFINED__ */ + + +#ifndef __INetCfgBindingPath_FWD_DEFINED__ +#define __INetCfgBindingPath_FWD_DEFINED__ +typedef interface INetCfgBindingPath INetCfgBindingPath; +#endif /* __INetCfgBindingPath_FWD_DEFINED__ */ + + +#ifndef __INetCfgClass_FWD_DEFINED__ +#define __INetCfgClass_FWD_DEFINED__ +typedef interface INetCfgClass INetCfgClass; +#endif /* __INetCfgClass_FWD_DEFINED__ */ + + +#ifndef __INetCfgClassSetup_FWD_DEFINED__ +#define __INetCfgClassSetup_FWD_DEFINED__ +typedef interface INetCfgClassSetup INetCfgClassSetup; +#endif /* __INetCfgClassSetup_FWD_DEFINED__ */ + + +#ifndef __INetCfgComponent_FWD_DEFINED__ +#define __INetCfgComponent_FWD_DEFINED__ +typedef interface INetCfgComponent INetCfgComponent; +#endif /* __INetCfgComponent_FWD_DEFINED__ */ + + +#ifndef __INetCfgComponentBindings_FWD_DEFINED__ +#define __INetCfgComponentBindings_FWD_DEFINED__ +typedef interface INetCfgComponentBindings INetCfgComponentBindings; +#endif /* __INetCfgComponentBindings_FWD_DEFINED__ */ + + +#ifndef __INetCfgSysPrep_FWD_DEFINED__ +#define __INetCfgSysPrep_FWD_DEFINED__ +typedef interface INetCfgSysPrep INetCfgSysPrep; +#endif /* __INetCfgSysPrep_FWD_DEFINED__ */ + + +/* header files for imported files */ +#include "unknwn.h" +#include "prsht.h" + +#ifdef __cplusplus +extern "C"{ +#endif + + +/* interface __MIDL_itf_netcfgx_0000_0000 */ +/* [local] */ + +//+------------------------------------------------------------------------- +// +// Microsoft Windows +// Copyright (c) Microsoft Corporation. All rights reserved. +// +//-------------------------------------------------------------------------- +#if ( _MSC_VER >= 800 ) +#pragma warning(disable:4201) +#endif + +EXTERN_C const CLSID CLSID_CNetCfg; + +#define NETCFG_E_ALREADY_INITIALIZED MAKE_HRESULT(SEVERITY_ERROR, FACILITY_ITF, 0xA020) +#define NETCFG_E_NOT_INITIALIZED MAKE_HRESULT(SEVERITY_ERROR, FACILITY_ITF, 0xA021) +#define NETCFG_E_IN_USE MAKE_HRESULT(SEVERITY_ERROR, FACILITY_ITF, 0xA022) +#define NETCFG_E_NO_WRITE_LOCK MAKE_HRESULT(SEVERITY_ERROR, FACILITY_ITF, 0xA024) +#define NETCFG_E_NEED_REBOOT MAKE_HRESULT(SEVERITY_ERROR, FACILITY_ITF, 0xA025) +#define NETCFG_E_ACTIVE_RAS_CONNECTIONS MAKE_HRESULT(SEVERITY_ERROR, FACILITY_ITF, 0xA026) +#define NETCFG_E_ADAPTER_NOT_FOUND MAKE_HRESULT(SEVERITY_ERROR, FACILITY_ITF, 0xA027) +#define NETCFG_E_COMPONENT_REMOVED_PENDING_REBOOT MAKE_HRESULT(SEVERITY_ERROR, FACILITY_ITF, 0xA028) +#define NETCFG_E_MAX_FILTER_LIMIT MAKE_HRESULT(SEVERITY_ERROR, FACILITY_ITF, 0xA029) +#define NETCFG_S_REBOOT MAKE_HRESULT(SEVERITY_SUCCESS, FACILITY_ITF, 0xA020) +#define NETCFG_S_DISABLE_QUERY MAKE_HRESULT(SEVERITY_SUCCESS, FACILITY_ITF, 0xA022) +#define NETCFG_S_STILL_REFERENCED MAKE_HRESULT(SEVERITY_SUCCESS, FACILITY_ITF, 0xA023) +#define NETCFG_S_CAUSED_SETUP_CHANGE MAKE_HRESULT(SEVERITY_SUCCESS, FACILITY_ITF, 0xA024) +#define NETCFG_S_COMMIT_NOW MAKE_HRESULT(SEVERITY_SUCCESS, FACILITY_ITF, 0xA025) + +#define NETCFG_CLIENT_CID_MS_MSClient TEXT("ms_msclient") +#define NETCFG_SERVICE_CID_MS_SERVER TEXT("ms_server") +#define NETCFG_SERVICE_CID_MS_NETBIOS TEXT("ms_netbios") +#define NETCFG_SERVICE_CID_MS_PSCHED TEXT("ms_pschedpc") +#define NETCFG_SERVICE_CID_MS_WLBS TEXT("ms_wlbs") +#define NETCFG_TRANS_CID_MS_APPLETALK TEXT("ms_appletalk") +#define NETCFG_TRANS_CID_MS_NETBEUI TEXT("ms_netbeui") +#define NETCFG_TRANS_CID_MS_NETMON TEXT("ms_netmon") +#define NETCFG_TRANS_CID_MS_NWIPX TEXT("ms_nwipx") +#define NETCFG_TRANS_CID_MS_NWSPX TEXT("ms_nwspx") +#define NETCFG_TRANS_CID_MS_TCPIP TEXT("ms_tcpip") + + + + + + + + + + + + + + + + +extern RPC_IF_HANDLE __MIDL_itf_netcfgx_0000_0000_v0_0_c_ifspec; +extern RPC_IF_HANDLE __MIDL_itf_netcfgx_0000_0000_v0_0_s_ifspec; + +#ifndef __IEnumNetCfgBindingInterface_INTERFACE_DEFINED__ +#define __IEnumNetCfgBindingInterface_INTERFACE_DEFINED__ + +/* interface IEnumNetCfgBindingInterface */ +/* [unique][uuid][object][local] */ + + +EXTERN_C const IID IID_IEnumNetCfgBindingInterface; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("C0E8AE90-306E-11D1-AACF-00805FC1270E") + IEnumNetCfgBindingInterface : public IUnknown + { + public: + virtual HRESULT STDMETHODCALLTYPE Next( + /* [annotation][in] */ + __in ULONG celt, + /* [annotation][length_is][size_is][out] */ + __out_ecount(celt) INetCfgBindingInterface **rgelt, + /* [annotation][out] */ + __out_opt ULONG *pceltFetched) = 0; + + virtual HRESULT STDMETHODCALLTYPE Skip( + /* [annotation][in] */ + __in ULONG celt) = 0; + + virtual HRESULT STDMETHODCALLTYPE Reset( void) = 0; + + virtual HRESULT STDMETHODCALLTYPE Clone( + /* [annotation][out] */ + __out IEnumNetCfgBindingInterface **ppenum) = 0; + + }; + +#else /* C style interface */ + + typedef struct IEnumNetCfgBindingInterfaceVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + IEnumNetCfgBindingInterface * This, + /* [in] */ REFIID riid, + /* [annotation][iid_is][out] */ + __RPC__deref_out void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + IEnumNetCfgBindingInterface * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + IEnumNetCfgBindingInterface * This); + + HRESULT ( STDMETHODCALLTYPE *Next )( + IEnumNetCfgBindingInterface * This, + /* [annotation][in] */ + __in ULONG celt, + /* [annotation][length_is][size_is][out] */ + __out_ecount(celt) INetCfgBindingInterface **rgelt, + /* [annotation][out] */ + __out_opt ULONG *pceltFetched); + + HRESULT ( STDMETHODCALLTYPE *Skip )( + IEnumNetCfgBindingInterface * This, + /* [annotation][in] */ + __in ULONG celt); + + HRESULT ( STDMETHODCALLTYPE *Reset )( + IEnumNetCfgBindingInterface * This); + + HRESULT ( STDMETHODCALLTYPE *Clone )( + IEnumNetCfgBindingInterface * This, + /* [annotation][out] */ + __out IEnumNetCfgBindingInterface **ppenum); + + END_INTERFACE + } IEnumNetCfgBindingInterfaceVtbl; + + interface IEnumNetCfgBindingInterface + { + CONST_VTBL struct IEnumNetCfgBindingInterfaceVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define IEnumNetCfgBindingInterface_QueryInterface(This,riid,ppvObject) \ + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + +#define IEnumNetCfgBindingInterface_AddRef(This) \ + ( (This)->lpVtbl -> AddRef(This) ) + +#define IEnumNetCfgBindingInterface_Release(This) \ + ( (This)->lpVtbl -> Release(This) ) + + +#define IEnumNetCfgBindingInterface_Next(This,celt,rgelt,pceltFetched) \ + ( (This)->lpVtbl -> Next(This,celt,rgelt,pceltFetched) ) + +#define IEnumNetCfgBindingInterface_Skip(This,celt) \ + ( (This)->lpVtbl -> Skip(This,celt) ) + +#define IEnumNetCfgBindingInterface_Reset(This) \ + ( (This)->lpVtbl -> Reset(This) ) + +#define IEnumNetCfgBindingInterface_Clone(This,ppenum) \ + ( (This)->lpVtbl -> Clone(This,ppenum) ) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + + +#endif /* __IEnumNetCfgBindingInterface_INTERFACE_DEFINED__ */ + + +#ifndef __IEnumNetCfgBindingPath_INTERFACE_DEFINED__ +#define __IEnumNetCfgBindingPath_INTERFACE_DEFINED__ + +/* interface IEnumNetCfgBindingPath */ +/* [unique][uuid][object][local] */ + + +EXTERN_C const IID IID_IEnumNetCfgBindingPath; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("C0E8AE91-306E-11D1-AACF-00805FC1270E") + IEnumNetCfgBindingPath : public IUnknown + { + public: + virtual HRESULT STDMETHODCALLTYPE Next( + /* [annotation][in] */ + __in ULONG celt, + /* [annotation][length_is][size_is][out] */ + __out_ecount(celt) INetCfgBindingPath **rgelt, + /* [annotation][out] */ + __out ULONG *pceltFetched) = 0; + + virtual HRESULT STDMETHODCALLTYPE Skip( + /* [annotation][in] */ + __in ULONG celt) = 0; + + virtual HRESULT STDMETHODCALLTYPE Reset( void) = 0; + + virtual HRESULT STDMETHODCALLTYPE Clone( + /* [annotation][out] */ + __out IEnumNetCfgBindingPath **ppenum) = 0; + + }; + +#else /* C style interface */ + + typedef struct IEnumNetCfgBindingPathVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + IEnumNetCfgBindingPath * This, + /* [in] */ REFIID riid, + /* [annotation][iid_is][out] */ + __RPC__deref_out void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + IEnumNetCfgBindingPath * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + IEnumNetCfgBindingPath * This); + + HRESULT ( STDMETHODCALLTYPE *Next )( + IEnumNetCfgBindingPath * This, + /* [annotation][in] */ + __in ULONG celt, + /* [annotation][length_is][size_is][out] */ + __out_ecount(celt) INetCfgBindingPath **rgelt, + /* [annotation][out] */ + __out ULONG *pceltFetched); + + HRESULT ( STDMETHODCALLTYPE *Skip )( + IEnumNetCfgBindingPath * This, + /* [annotation][in] */ + __in ULONG celt); + + HRESULT ( STDMETHODCALLTYPE *Reset )( + IEnumNetCfgBindingPath * This); + + HRESULT ( STDMETHODCALLTYPE *Clone )( + IEnumNetCfgBindingPath * This, + /* [annotation][out] */ + __out IEnumNetCfgBindingPath **ppenum); + + END_INTERFACE + } IEnumNetCfgBindingPathVtbl; + + interface IEnumNetCfgBindingPath + { + CONST_VTBL struct IEnumNetCfgBindingPathVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define IEnumNetCfgBindingPath_QueryInterface(This,riid,ppvObject) \ + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + +#define IEnumNetCfgBindingPath_AddRef(This) \ + ( (This)->lpVtbl -> AddRef(This) ) + +#define IEnumNetCfgBindingPath_Release(This) \ + ( (This)->lpVtbl -> Release(This) ) + + +#define IEnumNetCfgBindingPath_Next(This,celt,rgelt,pceltFetched) \ + ( (This)->lpVtbl -> Next(This,celt,rgelt,pceltFetched) ) + +#define IEnumNetCfgBindingPath_Skip(This,celt) \ + ( (This)->lpVtbl -> Skip(This,celt) ) + +#define IEnumNetCfgBindingPath_Reset(This) \ + ( (This)->lpVtbl -> Reset(This) ) + +#define IEnumNetCfgBindingPath_Clone(This,ppenum) \ + ( (This)->lpVtbl -> Clone(This,ppenum) ) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + + +#endif /* __IEnumNetCfgBindingPath_INTERFACE_DEFINED__ */ + + +#ifndef __IEnumNetCfgComponent_INTERFACE_DEFINED__ +#define __IEnumNetCfgComponent_INTERFACE_DEFINED__ + +/* interface IEnumNetCfgComponent */ +/* [unique][uuid][object][local] */ + + +EXTERN_C const IID IID_IEnumNetCfgComponent; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("C0E8AE92-306E-11D1-AACF-00805FC1270E") + IEnumNetCfgComponent : public IUnknown + { + public: + virtual HRESULT STDMETHODCALLTYPE Next( + /* [annotation][in] */ + __in ULONG celt, + /* [annotation][length_is][size_is][out] */ + __out_ecount(celt) INetCfgComponent **rgelt, + /* [annotation][out] */ + __out ULONG *pceltFetched) = 0; + + virtual HRESULT STDMETHODCALLTYPE Skip( + /* [annotation][in] */ + __in ULONG celt) = 0; + + virtual HRESULT STDMETHODCALLTYPE Reset( void) = 0; + + virtual HRESULT STDMETHODCALLTYPE Clone( + /* [annotation][out] */ + __out IEnumNetCfgComponent **ppenum) = 0; + + }; + +#else /* C style interface */ + + typedef struct IEnumNetCfgComponentVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + IEnumNetCfgComponent * This, + /* [in] */ REFIID riid, + /* [annotation][iid_is][out] */ + __RPC__deref_out void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + IEnumNetCfgComponent * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + IEnumNetCfgComponent * This); + + HRESULT ( STDMETHODCALLTYPE *Next )( + IEnumNetCfgComponent * This, + /* [annotation][in] */ + __in ULONG celt, + /* [annotation][length_is][size_is][out] */ + __out_ecount(celt) INetCfgComponent **rgelt, + /* [annotation][out] */ + __out ULONG *pceltFetched); + + HRESULT ( STDMETHODCALLTYPE *Skip )( + IEnumNetCfgComponent * This, + /* [annotation][in] */ + __in ULONG celt); + + HRESULT ( STDMETHODCALLTYPE *Reset )( + IEnumNetCfgComponent * This); + + HRESULT ( STDMETHODCALLTYPE *Clone )( + IEnumNetCfgComponent * This, + /* [annotation][out] */ + __out IEnumNetCfgComponent **ppenum); + + END_INTERFACE + } IEnumNetCfgComponentVtbl; + + interface IEnumNetCfgComponent + { + CONST_VTBL struct IEnumNetCfgComponentVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define IEnumNetCfgComponent_QueryInterface(This,riid,ppvObject) \ + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + +#define IEnumNetCfgComponent_AddRef(This) \ + ( (This)->lpVtbl -> AddRef(This) ) + +#define IEnumNetCfgComponent_Release(This) \ + ( (This)->lpVtbl -> Release(This) ) + + +#define IEnumNetCfgComponent_Next(This,celt,rgelt,pceltFetched) \ + ( (This)->lpVtbl -> Next(This,celt,rgelt,pceltFetched) ) + +#define IEnumNetCfgComponent_Skip(This,celt) \ + ( (This)->lpVtbl -> Skip(This,celt) ) + +#define IEnumNetCfgComponent_Reset(This) \ + ( (This)->lpVtbl -> Reset(This) ) + +#define IEnumNetCfgComponent_Clone(This,ppenum) \ + ( (This)->lpVtbl -> Clone(This,ppenum) ) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + + +#endif /* __IEnumNetCfgComponent_INTERFACE_DEFINED__ */ + + +#ifndef __INetCfg_INTERFACE_DEFINED__ +#define __INetCfg_INTERFACE_DEFINED__ + +/* interface INetCfg */ +/* [unique][uuid][object][local] */ + + +EXTERN_C const IID IID_INetCfg; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("C0E8AE93-306E-11D1-AACF-00805FC1270E") + INetCfg : public IUnknown + { + public: + virtual HRESULT STDMETHODCALLTYPE Initialize( + /* [annotation][in] */ + __in PVOID pvReserved) = 0; + + virtual HRESULT STDMETHODCALLTYPE Uninitialize( void) = 0; + + virtual HRESULT STDMETHODCALLTYPE Apply( void) = 0; + + virtual HRESULT STDMETHODCALLTYPE Cancel( void) = 0; + + virtual HRESULT STDMETHODCALLTYPE EnumComponents( + /* [annotation][in] */ + __in const GUID *pguidClass, + /* [annotation][out] */ + __deref_out_opt IEnumNetCfgComponent **ppenumComponent) = 0; + + virtual HRESULT STDMETHODCALLTYPE FindComponent( + /* [annotation][string][in] */ + __in __nullterminated LPCWSTR pszwInfId, + /* [annotation][out] */ + __deref_out_opt INetCfgComponent **pComponent) = 0; + + virtual HRESULT STDMETHODCALLTYPE QueryNetCfgClass( + /* [annotation][in] */ + __in const GUID *pguidClass, + /* [annotation][in] */ + __in REFIID riid, + /* [annotation][iid_is][out] */ + __deref_out_opt void **ppvObject) = 0; + + }; + +#else /* C style interface */ + + typedef struct INetCfgVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + INetCfg * This, + /* [in] */ REFIID riid, + /* [annotation][iid_is][out] */ + __RPC__deref_out void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + INetCfg * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + INetCfg * This); + + HRESULT ( STDMETHODCALLTYPE *Initialize )( + INetCfg * This, + /* [annotation][in] */ + __in PVOID pvReserved); + + HRESULT ( STDMETHODCALLTYPE *Uninitialize )( + INetCfg * This); + + HRESULT ( STDMETHODCALLTYPE *Apply )( + INetCfg * This); + + HRESULT ( STDMETHODCALLTYPE *Cancel )( + INetCfg * This); + + HRESULT ( STDMETHODCALLTYPE *EnumComponents )( + INetCfg * This, + /* [annotation][in] */ + __in const GUID *pguidClass, + /* [annotation][out] */ + __deref_out_opt IEnumNetCfgComponent **ppenumComponent); + + HRESULT ( STDMETHODCALLTYPE *FindComponent )( + INetCfg * This, + /* [annotation][string][in] */ + __in __nullterminated LPCWSTR pszwInfId, + /* [annotation][out] */ + __deref_out_opt INetCfgComponent **pComponent); + + HRESULT ( STDMETHODCALLTYPE *QueryNetCfgClass )( + INetCfg * This, + /* [annotation][in] */ + __in const GUID *pguidClass, + /* [annotation][in] */ + __in REFIID riid, + /* [annotation][iid_is][out] */ + __deref_out_opt void **ppvObject); + + END_INTERFACE + } INetCfgVtbl; + + interface INetCfg + { + CONST_VTBL struct INetCfgVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define INetCfg_QueryInterface(This,riid,ppvObject) \ + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + +#define INetCfg_AddRef(This) \ + ( (This)->lpVtbl -> AddRef(This) ) + +#define INetCfg_Release(This) \ + ( (This)->lpVtbl -> Release(This) ) + + +#define INetCfg_Initialize(This,pvReserved) \ + ( (This)->lpVtbl -> Initialize(This,pvReserved) ) + +#define INetCfg_Uninitialize(This) \ + ( (This)->lpVtbl -> Uninitialize(This) ) + +#define INetCfg_Apply(This) \ + ( (This)->lpVtbl -> Apply(This) ) + +#define INetCfg_Cancel(This) \ + ( (This)->lpVtbl -> Cancel(This) ) + +#define INetCfg_EnumComponents(This,pguidClass,ppenumComponent) \ + ( (This)->lpVtbl -> EnumComponents(This,pguidClass,ppenumComponent) ) + +#define INetCfg_FindComponent(This,pszwInfId,pComponent) \ + ( (This)->lpVtbl -> FindComponent(This,pszwInfId,pComponent) ) + +#define INetCfg_QueryNetCfgClass(This,pguidClass,riid,ppvObject) \ + ( (This)->lpVtbl -> QueryNetCfgClass(This,pguidClass,riid,ppvObject) ) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + + +#endif /* __INetCfg_INTERFACE_DEFINED__ */ + + +#ifndef __INetCfgLock_INTERFACE_DEFINED__ +#define __INetCfgLock_INTERFACE_DEFINED__ + +/* interface INetCfgLock */ +/* [unique][uuid][object][local] */ + + +EXTERN_C const IID IID_INetCfgLock; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("C0E8AE9F-306E-11D1-AACF-00805FC1270E") + INetCfgLock : public IUnknown + { + public: + virtual HRESULT STDMETHODCALLTYPE AcquireWriteLock( + /* [annotation][in] */ + __in DWORD cmsTimeout, + /* [annotation][string][in] */ + __in __nullterminated LPCWSTR pszwClientDescription, + /* [annotation][string][out] */ + __deref_out_opt LPWSTR *ppszwClientDescription) = 0; + + virtual HRESULT STDMETHODCALLTYPE ReleaseWriteLock( void) = 0; + + virtual HRESULT STDMETHODCALLTYPE IsWriteLocked( + /* [annotation][string][out] */ + __deref_out __nullterminated LPWSTR *ppszwClientDescription) = 0; + + }; + +#else /* C style interface */ + + typedef struct INetCfgLockVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + INetCfgLock * This, + /* [in] */ REFIID riid, + /* [annotation][iid_is][out] */ + __RPC__deref_out void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + INetCfgLock * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + INetCfgLock * This); + + HRESULT ( STDMETHODCALLTYPE *AcquireWriteLock )( + INetCfgLock * This, + /* [annotation][in] */ + __in DWORD cmsTimeout, + /* [annotation][string][in] */ + __in __nullterminated LPCWSTR pszwClientDescription, + /* [annotation][string][out] */ + __deref_out_opt LPWSTR *ppszwClientDescription); + + HRESULT ( STDMETHODCALLTYPE *ReleaseWriteLock )( + INetCfgLock * This); + + HRESULT ( STDMETHODCALLTYPE *IsWriteLocked )( + INetCfgLock * This, + /* [annotation][string][out] */ + __deref_out __nullterminated LPWSTR *ppszwClientDescription); + + END_INTERFACE + } INetCfgLockVtbl; + + interface INetCfgLock + { + CONST_VTBL struct INetCfgLockVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define INetCfgLock_QueryInterface(This,riid,ppvObject) \ + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + +#define INetCfgLock_AddRef(This) \ + ( (This)->lpVtbl -> AddRef(This) ) + +#define INetCfgLock_Release(This) \ + ( (This)->lpVtbl -> Release(This) ) + + +#define INetCfgLock_AcquireWriteLock(This,cmsTimeout,pszwClientDescription,ppszwClientDescription) \ + ( (This)->lpVtbl -> AcquireWriteLock(This,cmsTimeout,pszwClientDescription,ppszwClientDescription) ) + +#define INetCfgLock_ReleaseWriteLock(This) \ + ( (This)->lpVtbl -> ReleaseWriteLock(This) ) + +#define INetCfgLock_IsWriteLocked(This,ppszwClientDescription) \ + ( (This)->lpVtbl -> IsWriteLocked(This,ppszwClientDescription) ) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + + +#endif /* __INetCfgLock_INTERFACE_DEFINED__ */ + + +#ifndef __INetCfgBindingInterface_INTERFACE_DEFINED__ +#define __INetCfgBindingInterface_INTERFACE_DEFINED__ + +/* interface INetCfgBindingInterface */ +/* [unique][uuid][object][local] */ + + +EXTERN_C const IID IID_INetCfgBindingInterface; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("C0E8AE94-306E-11D1-AACF-00805FC1270E") + INetCfgBindingInterface : public IUnknown + { + public: + virtual HRESULT STDMETHODCALLTYPE GetName( + /* [annotation][string][out] */ + __deref_out LPWSTR *ppszwInterfaceName) = 0; + + virtual HRESULT STDMETHODCALLTYPE GetUpperComponent( + /* [annotation][out] */ + __deref_out_opt INetCfgComponent **ppnccItem) = 0; + + virtual HRESULT STDMETHODCALLTYPE GetLowerComponent( + /* [annotation][out] */ + __deref_out_opt INetCfgComponent **ppnccItem) = 0; + + }; + +#else /* C style interface */ + + typedef struct INetCfgBindingInterfaceVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + INetCfgBindingInterface * This, + /* [in] */ REFIID riid, + /* [annotation][iid_is][out] */ + __RPC__deref_out void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + INetCfgBindingInterface * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + INetCfgBindingInterface * This); + + HRESULT ( STDMETHODCALLTYPE *GetName )( + INetCfgBindingInterface * This, + /* [annotation][string][out] */ + __deref_out LPWSTR *ppszwInterfaceName); + + HRESULT ( STDMETHODCALLTYPE *GetUpperComponent )( + INetCfgBindingInterface * This, + /* [annotation][out] */ + __deref_out_opt INetCfgComponent **ppnccItem); + + HRESULT ( STDMETHODCALLTYPE *GetLowerComponent )( + INetCfgBindingInterface * This, + /* [annotation][out] */ + __deref_out_opt INetCfgComponent **ppnccItem); + + END_INTERFACE + } INetCfgBindingInterfaceVtbl; + + interface INetCfgBindingInterface + { + CONST_VTBL struct INetCfgBindingInterfaceVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define INetCfgBindingInterface_QueryInterface(This,riid,ppvObject) \ + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + +#define INetCfgBindingInterface_AddRef(This) \ + ( (This)->lpVtbl -> AddRef(This) ) + +#define INetCfgBindingInterface_Release(This) \ + ( (This)->lpVtbl -> Release(This) ) + + +#define INetCfgBindingInterface_GetName(This,ppszwInterfaceName) \ + ( (This)->lpVtbl -> GetName(This,ppszwInterfaceName) ) + +#define INetCfgBindingInterface_GetUpperComponent(This,ppnccItem) \ + ( (This)->lpVtbl -> GetUpperComponent(This,ppnccItem) ) + +#define INetCfgBindingInterface_GetLowerComponent(This,ppnccItem) \ + ( (This)->lpVtbl -> GetLowerComponent(This,ppnccItem) ) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + + +#endif /* __INetCfgBindingInterface_INTERFACE_DEFINED__ */ + + +#ifndef __INetCfgBindingPath_INTERFACE_DEFINED__ +#define __INetCfgBindingPath_INTERFACE_DEFINED__ + +/* interface INetCfgBindingPath */ +/* [unique][uuid][object][local] */ + + +EXTERN_C const IID IID_INetCfgBindingPath; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("C0E8AE96-306E-11D1-AACF-00805FC1270E") + INetCfgBindingPath : public IUnknown + { + public: + virtual HRESULT STDMETHODCALLTYPE IsSamePathAs( + /* [annotation][in] */ + __in INetCfgBindingPath *pPath) = 0; + + virtual HRESULT STDMETHODCALLTYPE IsSubPathOf( + /* [annotation][in] */ + __in INetCfgBindingPath *pPath) = 0; + + virtual HRESULT STDMETHODCALLTYPE IsEnabled( void) = 0; + + virtual HRESULT STDMETHODCALLTYPE Enable( + /* [annotation][in] */ + __in BOOL fEnable) = 0; + + virtual HRESULT STDMETHODCALLTYPE GetPathToken( + /* [annotation][string][out] */ + __deref_out __nullterminated LPWSTR *ppszwPathToken) = 0; + + virtual HRESULT STDMETHODCALLTYPE GetOwner( + /* [annotation][out] */ + __deref_out_opt INetCfgComponent **ppComponent) = 0; + + virtual HRESULT STDMETHODCALLTYPE GetDepth( + /* [annotation][out] */ + __out ULONG *pcInterfaces) = 0; + + virtual HRESULT STDMETHODCALLTYPE EnumBindingInterfaces( + /* [annotation][out] */ + __deref_out_opt IEnumNetCfgBindingInterface **ppenumInterface) = 0; + + }; + +#else /* C style interface */ + + typedef struct INetCfgBindingPathVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + INetCfgBindingPath * This, + /* [in] */ REFIID riid, + /* [annotation][iid_is][out] */ + __RPC__deref_out void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + INetCfgBindingPath * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + INetCfgBindingPath * This); + + HRESULT ( STDMETHODCALLTYPE *IsSamePathAs )( + INetCfgBindingPath * This, + /* [annotation][in] */ + __in INetCfgBindingPath *pPath); + + HRESULT ( STDMETHODCALLTYPE *IsSubPathOf )( + INetCfgBindingPath * This, + /* [annotation][in] */ + __in INetCfgBindingPath *pPath); + + HRESULT ( STDMETHODCALLTYPE *IsEnabled )( + INetCfgBindingPath * This); + + HRESULT ( STDMETHODCALLTYPE *Enable )( + INetCfgBindingPath * This, + /* [annotation][in] */ + __in BOOL fEnable); + + HRESULT ( STDMETHODCALLTYPE *GetPathToken )( + INetCfgBindingPath * This, + /* [annotation][string][out] */ + __deref_out __nullterminated LPWSTR *ppszwPathToken); + + HRESULT ( STDMETHODCALLTYPE *GetOwner )( + INetCfgBindingPath * This, + /* [annotation][out] */ + __deref_out_opt INetCfgComponent **ppComponent); + + HRESULT ( STDMETHODCALLTYPE *GetDepth )( + INetCfgBindingPath * This, + /* [annotation][out] */ + __out ULONG *pcInterfaces); + + HRESULT ( STDMETHODCALLTYPE *EnumBindingInterfaces )( + INetCfgBindingPath * This, + /* [annotation][out] */ + __deref_out_opt IEnumNetCfgBindingInterface **ppenumInterface); + + END_INTERFACE + } INetCfgBindingPathVtbl; + + interface INetCfgBindingPath + { + CONST_VTBL struct INetCfgBindingPathVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define INetCfgBindingPath_QueryInterface(This,riid,ppvObject) \ + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + +#define INetCfgBindingPath_AddRef(This) \ + ( (This)->lpVtbl -> AddRef(This) ) + +#define INetCfgBindingPath_Release(This) \ + ( (This)->lpVtbl -> Release(This) ) + + +#define INetCfgBindingPath_IsSamePathAs(This,pPath) \ + ( (This)->lpVtbl -> IsSamePathAs(This,pPath) ) + +#define INetCfgBindingPath_IsSubPathOf(This,pPath) \ + ( (This)->lpVtbl -> IsSubPathOf(This,pPath) ) + +#define INetCfgBindingPath_IsEnabled(This) \ + ( (This)->lpVtbl -> IsEnabled(This) ) + +#define INetCfgBindingPath_Enable(This,fEnable) \ + ( (This)->lpVtbl -> Enable(This,fEnable) ) + +#define INetCfgBindingPath_GetPathToken(This,ppszwPathToken) \ + ( (This)->lpVtbl -> GetPathToken(This,ppszwPathToken) ) + +#define INetCfgBindingPath_GetOwner(This,ppComponent) \ + ( (This)->lpVtbl -> GetOwner(This,ppComponent) ) + +#define INetCfgBindingPath_GetDepth(This,pcInterfaces) \ + ( (This)->lpVtbl -> GetDepth(This,pcInterfaces) ) + +#define INetCfgBindingPath_EnumBindingInterfaces(This,ppenumInterface) \ + ( (This)->lpVtbl -> EnumBindingInterfaces(This,ppenumInterface) ) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + + +#endif /* __INetCfgBindingPath_INTERFACE_DEFINED__ */ + + +#ifndef __INetCfgClass_INTERFACE_DEFINED__ +#define __INetCfgClass_INTERFACE_DEFINED__ + +/* interface INetCfgClass */ +/* [unique][uuid][object][local] */ + + +EXTERN_C const IID IID_INetCfgClass; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("C0E8AE97-306E-11D1-AACF-00805FC1270E") + INetCfgClass : public IUnknown + { + public: + virtual HRESULT STDMETHODCALLTYPE FindComponent( + /* [annotation][string][in] */ + __in __nullterminated LPCWSTR pszwInfId, + /* [annotation][out] */ + __deref_out_opt INetCfgComponent **ppnccItem) = 0; + + virtual HRESULT STDMETHODCALLTYPE EnumComponents( + /* [annotation][out] */ + __deref_out_opt IEnumNetCfgComponent **ppenumComponent) = 0; + + }; + +#else /* C style interface */ + + typedef struct INetCfgClassVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + INetCfgClass * This, + /* [in] */ REFIID riid, + /* [annotation][iid_is][out] */ + __RPC__deref_out void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + INetCfgClass * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + INetCfgClass * This); + + HRESULT ( STDMETHODCALLTYPE *FindComponent )( + INetCfgClass * This, + /* [annotation][string][in] */ + __in __nullterminated LPCWSTR pszwInfId, + /* [annotation][out] */ + __deref_out_opt INetCfgComponent **ppnccItem); + + HRESULT ( STDMETHODCALLTYPE *EnumComponents )( + INetCfgClass * This, + /* [annotation][out] */ + __deref_out_opt IEnumNetCfgComponent **ppenumComponent); + + END_INTERFACE + } INetCfgClassVtbl; + + interface INetCfgClass + { + CONST_VTBL struct INetCfgClassVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define INetCfgClass_QueryInterface(This,riid,ppvObject) \ + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + +#define INetCfgClass_AddRef(This) \ + ( (This)->lpVtbl -> AddRef(This) ) + +#define INetCfgClass_Release(This) \ + ( (This)->lpVtbl -> Release(This) ) + + +#define INetCfgClass_FindComponent(This,pszwInfId,ppnccItem) \ + ( (This)->lpVtbl -> FindComponent(This,pszwInfId,ppnccItem) ) + +#define INetCfgClass_EnumComponents(This,ppenumComponent) \ + ( (This)->lpVtbl -> EnumComponents(This,ppenumComponent) ) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + + +#endif /* __INetCfgClass_INTERFACE_DEFINED__ */ + + +#ifndef __INetCfgClassSetup_INTERFACE_DEFINED__ +#define __INetCfgClassSetup_INTERFACE_DEFINED__ + +/* interface INetCfgClassSetup */ +/* [unique][uuid][object][local] */ + +typedef +enum tagOBO_TOKEN_TYPE + { OBO_USER = 1, + OBO_COMPONENT = 2, + OBO_SOFTWARE = 3 + } OBO_TOKEN_TYPE; + +typedef struct tagOBO_TOKEN + { + OBO_TOKEN_TYPE Type; + INetCfgComponent *pncc; + LPCWSTR pszwManufacturer; + LPCWSTR pszwProduct; + LPCWSTR pszwDisplayName; + BOOL fRegistered; + } OBO_TOKEN; + + +EXTERN_C const IID IID_INetCfgClassSetup; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("C0E8AE9D-306E-11D1-AACF-00805FC1270E") + INetCfgClassSetup : public IUnknown + { + public: + virtual HRESULT STDMETHODCALLTYPE SelectAndInstall( + /* [annotation][in] */ + __in HWND hwndParent, + /* [annotation][in] */ + __in_opt OBO_TOKEN *pOboToken, + /* [annotation][out] */ + __deref_out_opt INetCfgComponent **ppnccItem) = 0; + + virtual HRESULT STDMETHODCALLTYPE Install( + /* [annotation][string][in] */ + __in LPCWSTR pszwInfId, + /* [annotation][in] */ + __in_opt OBO_TOKEN *pOboToken, + /* [annotation][in] */ + __in_opt DWORD dwSetupFlags, + /* [annotation][in] */ + __in_opt DWORD dwUpgradeFromBuildNo, + /* [annotation][string][in] */ + __in_opt LPCWSTR pszwAnswerFile, + /* [annotation][string][in] */ + __in_opt LPCWSTR pszwAnswerSections, + /* [annotation][out] */ + __deref_out_opt INetCfgComponent **ppnccItem) = 0; + + virtual HRESULT STDMETHODCALLTYPE DeInstall( + /* [annotation][in] */ + __in INetCfgComponent *pComponent, + /* [annotation][in] */ + __in_opt OBO_TOKEN *pOboToken, + /* [annotation][out] */ + __deref_out_opt LPWSTR *pmszwRefs) = 0; + + }; + +#else /* C style interface */ + + typedef struct INetCfgClassSetupVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + INetCfgClassSetup * This, + /* [in] */ REFIID riid, + /* [annotation][iid_is][out] */ + __RPC__deref_out void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + INetCfgClassSetup * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + INetCfgClassSetup * This); + + HRESULT ( STDMETHODCALLTYPE *SelectAndInstall )( + INetCfgClassSetup * This, + /* [annotation][in] */ + __in HWND hwndParent, + /* [annotation][in] */ + __in_opt OBO_TOKEN *pOboToken, + /* [annotation][out] */ + __deref_out_opt INetCfgComponent **ppnccItem); + + HRESULT ( STDMETHODCALLTYPE *Install )( + INetCfgClassSetup * This, + /* [annotation][string][in] */ + __in LPCWSTR pszwInfId, + /* [annotation][in] */ + __in_opt OBO_TOKEN *pOboToken, + /* [annotation][in] */ + __in_opt DWORD dwSetupFlags, + /* [annotation][in] */ + __in_opt DWORD dwUpgradeFromBuildNo, + /* [annotation][string][in] */ + __in_opt LPCWSTR pszwAnswerFile, + /* [annotation][string][in] */ + __in_opt LPCWSTR pszwAnswerSections, + /* [annotation][out] */ + __deref_out_opt INetCfgComponent **ppnccItem); + + HRESULT ( STDMETHODCALLTYPE *DeInstall )( + INetCfgClassSetup * This, + /* [annotation][in] */ + __in INetCfgComponent *pComponent, + /* [annotation][in] */ + __in_opt OBO_TOKEN *pOboToken, + /* [annotation][out] */ + __deref_out_opt LPWSTR *pmszwRefs); + + END_INTERFACE + } INetCfgClassSetupVtbl; + + interface INetCfgClassSetup + { + CONST_VTBL struct INetCfgClassSetupVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define INetCfgClassSetup_QueryInterface(This,riid,ppvObject) \ + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + +#define INetCfgClassSetup_AddRef(This) \ + ( (This)->lpVtbl -> AddRef(This) ) + +#define INetCfgClassSetup_Release(This) \ + ( (This)->lpVtbl -> Release(This) ) + + +#define INetCfgClassSetup_SelectAndInstall(This,hwndParent,pOboToken,ppnccItem) \ + ( (This)->lpVtbl -> SelectAndInstall(This,hwndParent,pOboToken,ppnccItem) ) + +#define INetCfgClassSetup_Install(This,pszwInfId,pOboToken,dwSetupFlags,dwUpgradeFromBuildNo,pszwAnswerFile,pszwAnswerSections,ppnccItem) \ + ( (This)->lpVtbl -> Install(This,pszwInfId,pOboToken,dwSetupFlags,dwUpgradeFromBuildNo,pszwAnswerFile,pszwAnswerSections,ppnccItem) ) + +#define INetCfgClassSetup_DeInstall(This,pComponent,pOboToken,pmszwRefs) \ + ( (This)->lpVtbl -> DeInstall(This,pComponent,pOboToken,pmszwRefs) ) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + + +#endif /* __INetCfgClassSetup_INTERFACE_DEFINED__ */ + + +#ifndef __INetCfgComponent_INTERFACE_DEFINED__ +#define __INetCfgComponent_INTERFACE_DEFINED__ + +/* interface INetCfgComponent */ +/* [unique][uuid][object][local] */ + +typedef +enum tagCOMPONENT_CHARACTERISTICS + { NCF_VIRTUAL = 0x1, + NCF_SOFTWARE_ENUMERATED = 0x2, + NCF_PHYSICAL = 0x4, + NCF_HIDDEN = 0x8, + NCF_NO_SERVICE = 0x10, + NCF_NOT_USER_REMOVABLE = 0x20, + NCF_MULTIPORT_INSTANCED_ADAPTER = 0x40, + NCF_HAS_UI = 0x80, + NCF_SINGLE_INSTANCE = 0x100, + NCF_FILTER = 0x400, + NCF_DONTEXPOSELOWER = 0x1000, + NCF_HIDE_BINDING = 0x2000, + NCF_NDIS_PROTOCOL = 0x4000, + NCF_FIXED_BINDING = 0x20000, + NCF_LW_FILTER = 0x40000 + } COMPONENT_CHARACTERISTICS; + +typedef +enum tagNCRP_FLAGS + { NCRP_QUERY_PROPERTY_UI = 0x1, + NCRP_SHOW_PROPERTY_UI = 0x2 + } NCRP_FLAGS; + + +EXTERN_C const IID IID_INetCfgComponent; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("C0E8AE99-306E-11D1-AACF-00805FC1270E") + INetCfgComponent : public IUnknown + { + public: + virtual HRESULT STDMETHODCALLTYPE GetDisplayName( + /* [annotation][string][out] */ + __deref_out_opt LPWSTR *ppszwDisplayName) = 0; + + virtual HRESULT STDMETHODCALLTYPE SetDisplayName( + /* [annotation][string][in] */ + __in LPCWSTR pszwDisplayName) = 0; + + virtual HRESULT STDMETHODCALLTYPE GetHelpText( + /* [annotation][string][out] */ + __deref_out_opt LPWSTR *pszwHelpText) = 0; + + virtual HRESULT STDMETHODCALLTYPE GetId( + /* [annotation][string][out] */ + __deref_out_opt LPWSTR *ppszwId) = 0; + + virtual HRESULT STDMETHODCALLTYPE GetCharacteristics( + /* [annotation][out] */ + __out LPDWORD pdwCharacteristics) = 0; + + virtual HRESULT STDMETHODCALLTYPE GetInstanceGuid( + /* [annotation][out] */ + __out_opt GUID *pGuid) = 0; + + virtual HRESULT STDMETHODCALLTYPE GetPnpDevNodeId( + /* [annotation][string][out] */ + __deref_out_opt LPWSTR *ppszwDevNodeId) = 0; + + virtual HRESULT STDMETHODCALLTYPE GetClassGuid( + /* [annotation][out] */ + __out_opt GUID *pGuid) = 0; + + virtual HRESULT STDMETHODCALLTYPE GetBindName( + /* [annotation][string][out] */ + __deref_out_opt LPWSTR *ppszwBindName) = 0; + + virtual HRESULT STDMETHODCALLTYPE GetDeviceStatus( + /* [annotation][out] */ + __out ULONG *pulStatus) = 0; + + virtual HRESULT STDMETHODCALLTYPE OpenParamKey( + /* [annotation][out] */ + __deref_out_opt HKEY *phkey) = 0; + + virtual HRESULT STDMETHODCALLTYPE RaisePropertyUi( + /* [annotation][in] */ + __in_opt HWND hwndParent, + /* [annotation][in] */ + __in DWORD dwFlags, + /* [annotation][in] */ + __in_opt IUnknown *punkContext) = 0; + + }; + +#else /* C style interface */ + + typedef struct INetCfgComponentVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + INetCfgComponent * This, + /* [in] */ REFIID riid, + /* [annotation][iid_is][out] */ + __RPC__deref_out void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + INetCfgComponent * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + INetCfgComponent * This); + + HRESULT ( STDMETHODCALLTYPE *GetDisplayName )( + INetCfgComponent * This, + /* [annotation][string][out] */ + __deref_out_opt LPWSTR *ppszwDisplayName); + + HRESULT ( STDMETHODCALLTYPE *SetDisplayName )( + INetCfgComponent * This, + /* [annotation][string][in] */ + __in LPCWSTR pszwDisplayName); + + HRESULT ( STDMETHODCALLTYPE *GetHelpText )( + INetCfgComponent * This, + /* [annotation][string][out] */ + __deref_out_opt LPWSTR *pszwHelpText); + + HRESULT ( STDMETHODCALLTYPE *GetId )( + INetCfgComponent * This, + /* [annotation][string][out] */ + __deref_out_opt LPWSTR *ppszwId); + + HRESULT ( STDMETHODCALLTYPE *GetCharacteristics )( + INetCfgComponent * This, + /* [annotation][out] */ + __out LPDWORD pdwCharacteristics); + + HRESULT ( STDMETHODCALLTYPE *GetInstanceGuid )( + INetCfgComponent * This, + /* [annotation][out] */ + __out_opt GUID *pGuid); + + HRESULT ( STDMETHODCALLTYPE *GetPnpDevNodeId )( + INetCfgComponent * This, + /* [annotation][string][out] */ + __deref_out_opt LPWSTR *ppszwDevNodeId); + + HRESULT ( STDMETHODCALLTYPE *GetClassGuid )( + INetCfgComponent * This, + /* [annotation][out] */ + __out_opt GUID *pGuid); + + HRESULT ( STDMETHODCALLTYPE *GetBindName )( + INetCfgComponent * This, + /* [annotation][string][out] */ + __deref_out_opt LPWSTR *ppszwBindName); + + HRESULT ( STDMETHODCALLTYPE *GetDeviceStatus )( + INetCfgComponent * This, + /* [annotation][out] */ + __out ULONG *pulStatus); + + HRESULT ( STDMETHODCALLTYPE *OpenParamKey )( + INetCfgComponent * This, + /* [annotation][out] */ + __deref_out_opt HKEY *phkey); + + HRESULT ( STDMETHODCALLTYPE *RaisePropertyUi )( + INetCfgComponent * This, + /* [annotation][in] */ + __in_opt HWND hwndParent, + /* [annotation][in] */ + __in DWORD dwFlags, + /* [annotation][in] */ + __in_opt IUnknown *punkContext); + + END_INTERFACE + } INetCfgComponentVtbl; + + interface INetCfgComponent + { + CONST_VTBL struct INetCfgComponentVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define INetCfgComponent_QueryInterface(This,riid,ppvObject) \ + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + +#define INetCfgComponent_AddRef(This) \ + ( (This)->lpVtbl -> AddRef(This) ) + +#define INetCfgComponent_Release(This) \ + ( (This)->lpVtbl -> Release(This) ) + + +#define INetCfgComponent_GetDisplayName(This,ppszwDisplayName) \ + ( (This)->lpVtbl -> GetDisplayName(This,ppszwDisplayName) ) + +#define INetCfgComponent_SetDisplayName(This,pszwDisplayName) \ + ( (This)->lpVtbl -> SetDisplayName(This,pszwDisplayName) ) + +#define INetCfgComponent_GetHelpText(This,pszwHelpText) \ + ( (This)->lpVtbl -> GetHelpText(This,pszwHelpText) ) + +#define INetCfgComponent_GetId(This,ppszwId) \ + ( (This)->lpVtbl -> GetId(This,ppszwId) ) + +#define INetCfgComponent_GetCharacteristics(This,pdwCharacteristics) \ + ( (This)->lpVtbl -> GetCharacteristics(This,pdwCharacteristics) ) + +#define INetCfgComponent_GetInstanceGuid(This,pGuid) \ + ( (This)->lpVtbl -> GetInstanceGuid(This,pGuid) ) + +#define INetCfgComponent_GetPnpDevNodeId(This,ppszwDevNodeId) \ + ( (This)->lpVtbl -> GetPnpDevNodeId(This,ppszwDevNodeId) ) + +#define INetCfgComponent_GetClassGuid(This,pGuid) \ + ( (This)->lpVtbl -> GetClassGuid(This,pGuid) ) + +#define INetCfgComponent_GetBindName(This,ppszwBindName) \ + ( (This)->lpVtbl -> GetBindName(This,ppszwBindName) ) + +#define INetCfgComponent_GetDeviceStatus(This,pulStatus) \ + ( (This)->lpVtbl -> GetDeviceStatus(This,pulStatus) ) + +#define INetCfgComponent_OpenParamKey(This,phkey) \ + ( (This)->lpVtbl -> OpenParamKey(This,phkey) ) + +#define INetCfgComponent_RaisePropertyUi(This,hwndParent,dwFlags,punkContext) \ + ( (This)->lpVtbl -> RaisePropertyUi(This,hwndParent,dwFlags,punkContext) ) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + + +#endif /* __INetCfgComponent_INTERFACE_DEFINED__ */ + + +#ifndef __INetCfgComponentBindings_INTERFACE_DEFINED__ +#define __INetCfgComponentBindings_INTERFACE_DEFINED__ + +/* interface INetCfgComponentBindings */ +/* [unique][uuid][object][local] */ + +typedef +enum tagSUPPORTS_BINDING_INTERFACE_FLAGS + { NCF_LOWER = 0x1, + NCF_UPPER = 0x2 + } SUPPORTS_BINDING_INTERFACE_FLAGS; + +typedef +enum tagENUM_BINDING_PATHS_FLAGS + { EBP_ABOVE = 0x1, + EBP_BELOW = 0x2 + } ENUM_BINDING_PATHS_FLAGS; + + +EXTERN_C const IID IID_INetCfgComponentBindings; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("C0E8AE9E-306E-11D1-AACF-00805FC1270E") + INetCfgComponentBindings : public IUnknown + { + public: + virtual HRESULT STDMETHODCALLTYPE BindTo( + /* [annotation][in] */ + __in INetCfgComponent *pnccItem) = 0; + + virtual HRESULT STDMETHODCALLTYPE UnbindFrom( + /* [annotation][in] */ + __in INetCfgComponent *pnccItem) = 0; + + virtual HRESULT STDMETHODCALLTYPE SupportsBindingInterface( + /* [annotation][in] */ + __in DWORD dwFlags, + /* [annotation][in] */ + __in __nullterminated LPCWSTR pszwInterfaceName) = 0; + + virtual HRESULT STDMETHODCALLTYPE IsBoundTo( + /* [annotation][in] */ + __in INetCfgComponent *pnccItem) = 0; + + virtual HRESULT STDMETHODCALLTYPE IsBindableTo( + /* [annotation][in] */ + __in INetCfgComponent *pnccItem) = 0; + + virtual HRESULT STDMETHODCALLTYPE EnumBindingPaths( + /* [annotation][in] */ + __in DWORD dwFlags, + /* [annotation][out] */ + __deref_out_opt IEnumNetCfgBindingPath **ppIEnum) = 0; + + virtual HRESULT STDMETHODCALLTYPE MoveBefore( + /* [annotation][in] */ + __in INetCfgBindingPath *pncbItemSrc, + /* [annotation][in] */ + __in INetCfgBindingPath *pncbItemDest) = 0; + + virtual HRESULT STDMETHODCALLTYPE MoveAfter( + /* [annotation][in] */ + __in INetCfgBindingPath *pncbItemSrc, + /* [annotation][in] */ + __in INetCfgBindingPath *pncbItemDest) = 0; + + }; + +#else /* C style interface */ + + typedef struct INetCfgComponentBindingsVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + INetCfgComponentBindings * This, + /* [in] */ REFIID riid, + /* [annotation][iid_is][out] */ + __RPC__deref_out void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + INetCfgComponentBindings * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + INetCfgComponentBindings * This); + + HRESULT ( STDMETHODCALLTYPE *BindTo )( + INetCfgComponentBindings * This, + /* [annotation][in] */ + __in INetCfgComponent *pnccItem); + + HRESULT ( STDMETHODCALLTYPE *UnbindFrom )( + INetCfgComponentBindings * This, + /* [annotation][in] */ + __in INetCfgComponent *pnccItem); + + HRESULT ( STDMETHODCALLTYPE *SupportsBindingInterface )( + INetCfgComponentBindings * This, + /* [annotation][in] */ + __in DWORD dwFlags, + /* [annotation][in] */ + __in __nullterminated LPCWSTR pszwInterfaceName); + + HRESULT ( STDMETHODCALLTYPE *IsBoundTo )( + INetCfgComponentBindings * This, + /* [annotation][in] */ + __in INetCfgComponent *pnccItem); + + HRESULT ( STDMETHODCALLTYPE *IsBindableTo )( + INetCfgComponentBindings * This, + /* [annotation][in] */ + __in INetCfgComponent *pnccItem); + + HRESULT ( STDMETHODCALLTYPE *EnumBindingPaths )( + INetCfgComponentBindings * This, + /* [annotation][in] */ + __in DWORD dwFlags, + /* [annotation][out] */ + __deref_out_opt IEnumNetCfgBindingPath **ppIEnum); + + HRESULT ( STDMETHODCALLTYPE *MoveBefore )( + INetCfgComponentBindings * This, + /* [annotation][in] */ + __in INetCfgBindingPath *pncbItemSrc, + /* [annotation][in] */ + __in INetCfgBindingPath *pncbItemDest); + + HRESULT ( STDMETHODCALLTYPE *MoveAfter )( + INetCfgComponentBindings * This, + /* [annotation][in] */ + __in INetCfgBindingPath *pncbItemSrc, + /* [annotation][in] */ + __in INetCfgBindingPath *pncbItemDest); + + END_INTERFACE + } INetCfgComponentBindingsVtbl; + + interface INetCfgComponentBindings + { + CONST_VTBL struct INetCfgComponentBindingsVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define INetCfgComponentBindings_QueryInterface(This,riid,ppvObject) \ + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + +#define INetCfgComponentBindings_AddRef(This) \ + ( (This)->lpVtbl -> AddRef(This) ) + +#define INetCfgComponentBindings_Release(This) \ + ( (This)->lpVtbl -> Release(This) ) + + +#define INetCfgComponentBindings_BindTo(This,pnccItem) \ + ( (This)->lpVtbl -> BindTo(This,pnccItem) ) + +#define INetCfgComponentBindings_UnbindFrom(This,pnccItem) \ + ( (This)->lpVtbl -> UnbindFrom(This,pnccItem) ) + +#define INetCfgComponentBindings_SupportsBindingInterface(This,dwFlags,pszwInterfaceName) \ + ( (This)->lpVtbl -> SupportsBindingInterface(This,dwFlags,pszwInterfaceName) ) + +#define INetCfgComponentBindings_IsBoundTo(This,pnccItem) \ + ( (This)->lpVtbl -> IsBoundTo(This,pnccItem) ) + +#define INetCfgComponentBindings_IsBindableTo(This,pnccItem) \ + ( (This)->lpVtbl -> IsBindableTo(This,pnccItem) ) + +#define INetCfgComponentBindings_EnumBindingPaths(This,dwFlags,ppIEnum) \ + ( (This)->lpVtbl -> EnumBindingPaths(This,dwFlags,ppIEnum) ) + +#define INetCfgComponentBindings_MoveBefore(This,pncbItemSrc,pncbItemDest) \ + ( (This)->lpVtbl -> MoveBefore(This,pncbItemSrc,pncbItemDest) ) + +#define INetCfgComponentBindings_MoveAfter(This,pncbItemSrc,pncbItemDest) \ + ( (This)->lpVtbl -> MoveAfter(This,pncbItemSrc,pncbItemDest) ) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + + +#endif /* __INetCfgComponentBindings_INTERFACE_DEFINED__ */ + + +#ifndef __INetCfgSysPrep_INTERFACE_DEFINED__ +#define __INetCfgSysPrep_INTERFACE_DEFINED__ + +/* interface INetCfgSysPrep */ +/* [unique][uuid][object][local] */ + + +EXTERN_C const IID IID_INetCfgSysPrep; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("C0E8AE98-306E-11D1-AACF-00805FC1270E") + INetCfgSysPrep : public IUnknown + { + public: + virtual HRESULT STDMETHODCALLTYPE HrSetupSetFirstDword( + /* [annotation][string][in] */ + __in __nullterminated LPCWSTR pwszSection, + /* [annotation][string][in] */ + __in __nullterminated LPCWSTR pwszKey, + /* [in] */ DWORD dwValue) = 0; + + virtual HRESULT STDMETHODCALLTYPE HrSetupSetFirstString( + /* [annotation][string][in] */ + __in __nullterminated LPCWSTR pwszSection, + /* [annotation][string][in] */ + __in __nullterminated LPCWSTR pwszKey, + /* [annotation][string][in] */ + __in __nullterminated LPCWSTR pwszValue) = 0; + + virtual HRESULT STDMETHODCALLTYPE HrSetupSetFirstStringAsBool( + /* [annotation][string][in] */ + __in __nullterminated LPCWSTR pwszSection, + /* [annotation][string][in] */ + __in __nullterminated LPCWSTR pwszKey, + /* [in] */ BOOL fValue) = 0; + + virtual HRESULT STDMETHODCALLTYPE HrSetupSetFirstMultiSzField( + /* [annotation][string][in] */ + __in __nullterminated LPCWSTR pwszSection, + /* [annotation][string][in] */ + __in __nullterminated LPCWSTR pwszKey, + /* [annotation][in] */ + __in __nullterminated LPCWSTR pmszValue) = 0; + + }; + +#else /* C style interface */ + + typedef struct INetCfgSysPrepVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + INetCfgSysPrep * This, + /* [in] */ REFIID riid, + /* [annotation][iid_is][out] */ + __RPC__deref_out void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + INetCfgSysPrep * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + INetCfgSysPrep * This); + + HRESULT ( STDMETHODCALLTYPE *HrSetupSetFirstDword )( + INetCfgSysPrep * This, + /* [annotation][string][in] */ + __in __nullterminated LPCWSTR pwszSection, + /* [annotation][string][in] */ + __in __nullterminated LPCWSTR pwszKey, + /* [in] */ DWORD dwValue); + + HRESULT ( STDMETHODCALLTYPE *HrSetupSetFirstString )( + INetCfgSysPrep * This, + /* [annotation][string][in] */ + __in __nullterminated LPCWSTR pwszSection, + /* [annotation][string][in] */ + __in __nullterminated LPCWSTR pwszKey, + /* [annotation][string][in] */ + __in __nullterminated LPCWSTR pwszValue); + + HRESULT ( STDMETHODCALLTYPE *HrSetupSetFirstStringAsBool )( + INetCfgSysPrep * This, + /* [annotation][string][in] */ + __in __nullterminated LPCWSTR pwszSection, + /* [annotation][string][in] */ + __in __nullterminated LPCWSTR pwszKey, + /* [in] */ BOOL fValue); + + HRESULT ( STDMETHODCALLTYPE *HrSetupSetFirstMultiSzField )( + INetCfgSysPrep * This, + /* [annotation][string][in] */ + __in __nullterminated LPCWSTR pwszSection, + /* [annotation][string][in] */ + __in __nullterminated LPCWSTR pwszKey, + /* [annotation][in] */ + __in __nullterminated LPCWSTR pmszValue); + + END_INTERFACE + } INetCfgSysPrepVtbl; + + interface INetCfgSysPrep + { + CONST_VTBL struct INetCfgSysPrepVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define INetCfgSysPrep_QueryInterface(This,riid,ppvObject) \ + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + +#define INetCfgSysPrep_AddRef(This) \ + ( (This)->lpVtbl -> AddRef(This) ) + +#define INetCfgSysPrep_Release(This) \ + ( (This)->lpVtbl -> Release(This) ) + + +#define INetCfgSysPrep_HrSetupSetFirstDword(This,pwszSection,pwszKey,dwValue) \ + ( (This)->lpVtbl -> HrSetupSetFirstDword(This,pwszSection,pwszKey,dwValue) ) + +#define INetCfgSysPrep_HrSetupSetFirstString(This,pwszSection,pwszKey,pwszValue) \ + ( (This)->lpVtbl -> HrSetupSetFirstString(This,pwszSection,pwszKey,pwszValue) ) + +#define INetCfgSysPrep_HrSetupSetFirstStringAsBool(This,pwszSection,pwszKey,fValue) \ + ( (This)->lpVtbl -> HrSetupSetFirstStringAsBool(This,pwszSection,pwszKey,fValue) ) + +#define INetCfgSysPrep_HrSetupSetFirstMultiSzField(This,pwszSection,pwszKey,pmszValue) \ + ( (This)->lpVtbl -> HrSetupSetFirstMultiSzField(This,pwszSection,pwszKey,pmszValue) ) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + + +#endif /* __INetCfgSysPrep_INTERFACE_DEFINED__ */ + + +/* Additional Prototypes for ALL interfaces */ + +/* end of Additional Prototypes */ + +#ifdef __cplusplus +} +#endif + +#endif + + + diff --git a/src/Cedar/winpcap/Devioctl.h b/src/Cedar/winpcap/Devioctl.h index af8784bf..661fda02 100644 --- a/src/Cedar/winpcap/Devioctl.h +++ b/src/Cedar/winpcap/Devioctl.h @@ -1,90 +1,90 @@ -/*++ BUILD Version: 0004 // Increment this if a change has global effects - Copyright (c) 1992-1993 Microsoft Corporation - Module Name: - devioctl.h - Revision History: - -- */ -// begin_winioctl -#ifndef _DEVIOCTL_ -#define _DEVIOCTL_ -// begin_ntddk begin_nthal begin_ntifs -// -// Define the various device type values. Note that values used by Microsoft -// Corporation are in the range 0-32767, and 32768-65535 are reserved for use -// by customers. -// -#define DEVICE_TYPE ULONG -#define FILE_DEVICE_BEEP 0x00000001 -#define FILE_DEVICE_CD_ROM 0x00000002 -#define FILE_DEVICE_CD_ROM_FILE_SYSTEM 0x00000003 -#define FILE_DEVICE_CONTROLLER 0x00000004 -#define FILE_DEVICE_DATALINK 0x00000005 -#define FILE_DEVICE_DFS 0x00000006 -#define FILE_DEVICE_DISK 0x00000007 -#define FILE_DEVICE_DISK_FILE_SYSTEM 0x00000008 -#define FILE_DEVICE_FILE_SYSTEM 0x00000009 -#define FILE_DEVICE_INPORT_PORT 0x0000000a -#define FILE_DEVICE_KEYBOARD 0x0000000b -#define FILE_DEVICE_MAILSLOT 0x0000000c -#define FILE_DEVICE_MIDI_IN 0x0000000d -#define FILE_DEVICE_MIDI_OUT 0x0000000e -#define FILE_DEVICE_MOUSE 0x0000000f -#define FILE_DEVICE_MULTI_UNC_PROVIDER 0x00000010 -#define FILE_DEVICE_NAMED_PIPE 0x00000011 -#define FILE_DEVICE_NETWORK 0x00000012 -#define FILE_DEVICE_NETWORK_BROWSER 0x00000013 -#define FILE_DEVICE_NETWORK_FILE_SYSTEM 0x00000014 -#define FILE_DEVICE_NULL 0x00000015 -#define FILE_DEVICE_PARALLEL_PORT 0x00000016 -#define FILE_DEVICE_PHYSICAL_NETCARD 0x00000017 -#define FILE_DEVICE_PRINTER 0x00000018 -#define FILE_DEVICE_SCANNER 0x00000019 -#define FILE_DEVICE_SERIAL_MOUSE_PORT 0x0000001a -#define FILE_DEVICE_SERIAL_PORT 0x0000001b -#define FILE_DEVICE_SCREEN 0x0000001c -#define FILE_DEVICE_SOUND 0x0000001d -#define FILE_DEVICE_STREAMS 0x0000001e -#define FILE_DEVICE_TAPE 0x0000001f -#define FILE_DEVICE_TAPE_FILE_SYSTEM 0x00000020 -#define FILE_DEVICE_TRANSPORT 0x00000021 -#define FILE_DEVICE_UNKNOWN 0x00000022 -#define FILE_DEVICE_VIDEO 0x00000023 -#define FILE_DEVICE_VIRTUAL_DISK 0x00000024 -#define FILE_DEVICE_WAVE_IN 0x00000025 -#define FILE_DEVICE_WAVE_OUT 0x00000026 -#define FILE_DEVICE_8042_PORT 0x00000027 -#define FILE_DEVICE_NETWORK_REDIRECTOR 0x00000028 -#define FILE_DEVICE_BATTERY 0x00000029 -#define FILE_DEVICE_BUS_EXTENDER 0x0000002a -#define FILE_DEVICE_MODEM 0x0000002b -#define FILE_DEVICE_VDM 0x0000002c -#define FILE_DEVICE_MASS_STORAGE 0x0000002d -// -// Macro definition for defining IOCTL and FSCTL function control codes. Note -// that function codes 0-2047 are reserved for Microsoft Corporation, and -// 2048-4095 are reserved for customers. -// -#define CTL_CODE( DeviceType, Function, Method, Access ) ( \ - ((DeviceType) << 16) | ((Access) << 14) | ((Function) << 2) | (Method) \ -) -// -// Define the method codes for how buffers are passed for I/O and FS controls -// -#define METHOD_BUFFERED 0 -#define METHOD_IN_DIRECT 1 -#define METHOD_OUT_DIRECT 2 -#define METHOD_NEITHER 3 -// -// Define the access check value for any access -// -// -// The FILE_READ_ACCESS and FILE_WRITE_ACCESS constants are also defined in -// ntioapi.h as FILE_READ_DATA and FILE_WRITE_DATA. The values for these -// constants *MUST* always be in sync. -// -#define FILE_ANY_ACCESS 0 -#define FILE_READ_ACCESS ( 0x0001 ) // file & pipe -#define FILE_WRITE_ACCESS ( 0x0002 ) // file & pipe -// end_ntddk end_nthal end_ntifs -#endif // _DEVIOCTL_ -// end_winioctl +/*++ BUILD Version: 0004 // Increment this if a change has global effects + Copyright (c) 1992-1993 Microsoft Corporation + Module Name: + devioctl.h + Revision History: + -- */ +// begin_winioctl +#ifndef _DEVIOCTL_ +#define _DEVIOCTL_ +// begin_ntddk begin_nthal begin_ntifs +// +// Define the various device type values. Note that values used by Microsoft +// Corporation are in the range 0-32767, and 32768-65535 are reserved for use +// by customers. +// +#define DEVICE_TYPE ULONG +#define FILE_DEVICE_BEEP 0x00000001 +#define FILE_DEVICE_CD_ROM 0x00000002 +#define FILE_DEVICE_CD_ROM_FILE_SYSTEM 0x00000003 +#define FILE_DEVICE_CONTROLLER 0x00000004 +#define FILE_DEVICE_DATALINK 0x00000005 +#define FILE_DEVICE_DFS 0x00000006 +#define FILE_DEVICE_DISK 0x00000007 +#define FILE_DEVICE_DISK_FILE_SYSTEM 0x00000008 +#define FILE_DEVICE_FILE_SYSTEM 0x00000009 +#define FILE_DEVICE_INPORT_PORT 0x0000000a +#define FILE_DEVICE_KEYBOARD 0x0000000b +#define FILE_DEVICE_MAILSLOT 0x0000000c +#define FILE_DEVICE_MIDI_IN 0x0000000d +#define FILE_DEVICE_MIDI_OUT 0x0000000e +#define FILE_DEVICE_MOUSE 0x0000000f +#define FILE_DEVICE_MULTI_UNC_PROVIDER 0x00000010 +#define FILE_DEVICE_NAMED_PIPE 0x00000011 +#define FILE_DEVICE_NETWORK 0x00000012 +#define FILE_DEVICE_NETWORK_BROWSER 0x00000013 +#define FILE_DEVICE_NETWORK_FILE_SYSTEM 0x00000014 +#define FILE_DEVICE_NULL 0x00000015 +#define FILE_DEVICE_PARALLEL_PORT 0x00000016 +#define FILE_DEVICE_PHYSICAL_NETCARD 0x00000017 +#define FILE_DEVICE_PRINTER 0x00000018 +#define FILE_DEVICE_SCANNER 0x00000019 +#define FILE_DEVICE_SERIAL_MOUSE_PORT 0x0000001a +#define FILE_DEVICE_SERIAL_PORT 0x0000001b +#define FILE_DEVICE_SCREEN 0x0000001c +#define FILE_DEVICE_SOUND 0x0000001d +#define FILE_DEVICE_STREAMS 0x0000001e +#define FILE_DEVICE_TAPE 0x0000001f +#define FILE_DEVICE_TAPE_FILE_SYSTEM 0x00000020 +#define FILE_DEVICE_TRANSPORT 0x00000021 +#define FILE_DEVICE_UNKNOWN 0x00000022 +#define FILE_DEVICE_VIDEO 0x00000023 +#define FILE_DEVICE_VIRTUAL_DISK 0x00000024 +#define FILE_DEVICE_WAVE_IN 0x00000025 +#define FILE_DEVICE_WAVE_OUT 0x00000026 +#define FILE_DEVICE_8042_PORT 0x00000027 +#define FILE_DEVICE_NETWORK_REDIRECTOR 0x00000028 +#define FILE_DEVICE_BATTERY 0x00000029 +#define FILE_DEVICE_BUS_EXTENDER 0x0000002a +#define FILE_DEVICE_MODEM 0x0000002b +#define FILE_DEVICE_VDM 0x0000002c +#define FILE_DEVICE_MASS_STORAGE 0x0000002d +// +// Macro definition for defining IOCTL and FSCTL function control codes. Note +// that function codes 0-2047 are reserved for Microsoft Corporation, and +// 2048-4095 are reserved for customers. +// +#define CTL_CODE( DeviceType, Function, Method, Access ) ( \ + ((DeviceType) << 16) | ((Access) << 14) | ((Function) << 2) | (Method) \ +) +// +// Define the method codes for how buffers are passed for I/O and FS controls +// +#define METHOD_BUFFERED 0 +#define METHOD_IN_DIRECT 1 +#define METHOD_OUT_DIRECT 2 +#define METHOD_NEITHER 3 +// +// Define the access check value for any access +// +// +// The FILE_READ_ACCESS and FILE_WRITE_ACCESS constants are also defined in +// ntioapi.h as FILE_READ_DATA and FILE_WRITE_DATA. The values for these +// constants *MUST* always be in sync. +// +#define FILE_ANY_ACCESS 0 +#define FILE_READ_ACCESS ( 0x0001 ) // file & pipe +#define FILE_WRITE_ACCESS ( 0x0002 ) // file & pipe +// end_ntddk end_nthal end_ntifs +#endif // _DEVIOCTL_ +// end_winioctl diff --git a/src/Cedar/winpcap/Gnuc.h b/src/Cedar/winpcap/Gnuc.h index b7cfb59c..b05890f9 100644 --- a/src/Cedar/winpcap/Gnuc.h +++ b/src/Cedar/winpcap/Gnuc.h @@ -1,46 +1,46 @@ -/* @(#) $Header: /tcpdump/master/libpcap/Win32/Include/Gnuc.h,v 1.1 2002/08/01 08:33:05 risso Exp $ (LBL) */ - -/* Define __P() macro, if necessary */ - -#ifndef __P -#if __STDC__ -#define __P(protos) protos -#else -#define __P(protos) () -#endif -#endif - -/* inline foo */ -#ifndef __cplusplus -#ifdef __GNUC__ -#define inline __inline -#else -#define inline -#endif -#endif - -/* - * Handle new and old "dead" routine prototypes - * - * For example: - * - * __dead void foo(void) __attribute__((volatile)); - * - */ -#ifdef __GNUC__ -#ifndef __dead -#define __dead volatile -#endif -#if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 5) -#ifndef __attribute__ -#define __attribute__(args) -#endif -#endif -#else -#ifndef __dead -#define __dead -#endif -#ifndef __attribute__ -#define __attribute__(args) -#endif -#endif +/* @(#) $Header: /tcpdump/master/libpcap/Win32/Include/Gnuc.h,v 1.1 2002/08/01 08:33:05 risso Exp $ (LBL) */ + +/* Define __P() macro, if necessary */ + +#ifndef __P +#if __STDC__ +#define __P(protos) protos +#else +#define __P(protos) () +#endif +#endif + +/* inline foo */ +#ifndef __cplusplus +#ifdef __GNUC__ +#define inline __inline +#else +#define inline +#endif +#endif + +/* + * Handle new and old "dead" routine prototypes + * + * For example: + * + * __dead void foo(void) __attribute__((volatile)); + * + */ +#ifdef __GNUC__ +#ifndef __dead +#define __dead volatile +#endif +#if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 5) +#ifndef __attribute__ +#define __attribute__(args) +#endif +#endif +#else +#ifndef __dead +#define __dead +#endif +#ifndef __attribute__ +#define __attribute__(args) +#endif +#endif diff --git a/src/Cedar/winpcap/Ntddndis.h b/src/Cedar/winpcap/Ntddndis.h index 0b629806..77a53d7a 100644 --- a/src/Cedar/winpcap/Ntddndis.h +++ b/src/Cedar/winpcap/Ntddndis.h @@ -1,1400 +1,1400 @@ -/*++ BUILD Version: 0001 // Increment this if a change has global effects - Copyright (c) 1990-1993 Microsoft Corporation - Module Name: - ntddndis.h - Abstract: - This is the include file that defines all constants and types for - accessing the Network driver interface device. - Author: - Steve Wood (stevewo) 27-May-1990 - Revision History: - Adam Barr (adamba) 04-Nov-1992 added the correct values for NDIS 3.0. - Jameel Hyder (jameelh) 01-Aug-95 added Pnp IoCTLs and structures - Kyle Brandon (kyleb) 09/24/96 added general co ndis oids. - -- */ -#ifndef _NTDDNDIS_ -#define _NTDDNDIS_ -// -// Device Name - this string is the name of the device. It is the name -// that should be passed to NtOpenFile when accessing the device. -// -// Note: For devices that support multiple units, it should be suffixed -// with the Ascii representation of the unit number. -// -#define DD_NDIS_DEVICE_NAME "\\Device\\UNKNOWN" -// -// NtDeviceIoControlFile IoControlCode values for this device. -// -// Warning: Remember that the low two bits of the code specify how the -// buffers are passed to the driver! -// -#define _NDIS_CONTROL_CODE(request,method) \ - CTL_CODE(FILE_DEVICE_PHYSICAL_NETCARD, request, method, FILE_ANY_ACCESS) -#define IOCTL_NDIS_QUERY_GLOBAL_STATS _NDIS_CONTROL_CODE( 0, METHOD_OUT_DIRECT ) -#define IOCTL_NDIS_QUERY_ALL_STATS _NDIS_CONTROL_CODE( 1, METHOD_OUT_DIRECT ) -#define IOCTL_NDIS_ADD_DEVICE _NDIS_CONTROL_CODE( 2, METHOD_BUFFERED ) -#define IOCTL_NDIS_DELETE_DEVICE _NDIS_CONTROL_CODE( 3, METHOD_BUFFERED ) -#define IOCTL_NDIS_TRANSLATE_NAME _NDIS_CONTROL_CODE( 4, METHOD_BUFFERED ) -#define IOCTL_NDIS_ADD_TDI_DEVICE _NDIS_CONTROL_CODE( 5, METHOD_BUFFERED ) -#define IOCTL_NDIS_NOTIFY_PROTOCOL _NDIS_CONTROL_CODE( 6, METHOD_BUFFERED ) -#define IOCTL_NDIS_GET_LOG_DATA _NDIS_CONTROL_CODE( 7, METHOD_OUT_DIRECT ) -// -// NtDeviceIoControlFile InputBuffer/OutputBuffer record structures for -// this device. -// -// -// This is the type of an NDIS OID value. -// -typedef ULONG NDIS_OID, *PNDIS_OID; -// -// IOCTL_NDIS_QUERY_ALL_STATS returns a sequence of these, packed -// together (no padding is required since statistics all have -// four or eight bytes of data). -// -typedef struct _NDIS_STATISTICS_VALUE { - NDIS_OID Oid; - ULONG DataLength; - UCHAR Data[1]; // variable length - -} NDIS_STATISTICS_VALUE, *PNDIS_STATISTICS_VALUE; - -// -// Structure used by TRANSLATE_NAME IOCTL -// -typedef struct _NET_PNP_ID { - ULONG ClassId; - ULONG Token; -} NET_PNP_ID, *PNET_PNP_ID; - -typedef struct _NET_PNP_TRANSLATE_LIST { - ULONG BytesNeeded; - NET_PNP_ID IdArray[ANYSIZE_ARRAY]; -} NET_PNP_TRANSLATE_LIST, *PNET_PNP_TRANSLATE_LIST; - -// -// Structure used to define a self-contained variable data structure -// -typedef struct _NDIS_VAR_DATA_DESC { - USHORT Length; // # of octects of data - - USHORT MaximumLength; // # of octects available - - LONG Offset; // Offset of data relative to the descriptor - -} NDIS_VAR_DATA_DESC, *PNDIS_VAR_DATA_DESC; - -// -// Object Identifiers used by NdisRequest Query/Set Information -// -// -// General Objects -// -#define OID_GEN_SUPPORTED_LIST 0x00010101 -#define OID_GEN_HARDWARE_STATUS 0x00010102 -#define OID_GEN_MEDIA_SUPPORTED 0x00010103 -#define OID_GEN_MEDIA_IN_USE 0x00010104 -#define OID_GEN_MAXIMUM_LOOKAHEAD 0x00010105 -#define OID_GEN_MAXIMUM_FRAME_SIZE 0x00010106 -#define OID_GEN_LINK_SPEED 0x00010107 -#define OID_GEN_TRANSMIT_BUFFER_SPACE 0x00010108 -#define OID_GEN_RECEIVE_BUFFER_SPACE 0x00010109 -#define OID_GEN_TRANSMIT_BLOCK_SIZE 0x0001010A -#define OID_GEN_RECEIVE_BLOCK_SIZE 0x0001010B -#define OID_GEN_VENDOR_ID 0x0001010C -#define OID_GEN_VENDOR_DESCRIPTION 0x0001010D -#define OID_GEN_CURRENT_PACKET_FILTER 0x0001010E -#define OID_GEN_CURRENT_LOOKAHEAD 0x0001010F -#define OID_GEN_DRIVER_VERSION 0x00010110 -#define OID_GEN_MAXIMUM_TOTAL_SIZE 0x00010111 -#define OID_GEN_PROTOCOL_OPTIONS 0x00010112 -#define OID_GEN_MAC_OPTIONS 0x00010113 -#define OID_GEN_MEDIA_CONNECT_STATUS 0x00010114 -#define OID_GEN_MAXIMUM_SEND_PACKETS 0x00010115 -#define OID_GEN_VENDOR_DRIVER_VERSION 0x00010116 -#define OID_GEN_XMIT_OK 0x00020101 -#define OID_GEN_RCV_OK 0x00020102 -#define OID_GEN_XMIT_ERROR 0x00020103 -#define OID_GEN_RCV_ERROR 0x00020104 -#define OID_GEN_RCV_NO_BUFFER 0x00020105 -#define OID_GEN_DIRECTED_BYTES_XMIT 0x00020201 -#define OID_GEN_DIRECTED_FRAMES_XMIT 0x00020202 -#define OID_GEN_MULTICAST_BYTES_XMIT 0x00020203 -#define OID_GEN_MULTICAST_FRAMES_XMIT 0x00020204 -#define OID_GEN_BROADCAST_BYTES_XMIT 0x00020205 -#define OID_GEN_BROADCAST_FRAMES_XMIT 0x00020206 -#define OID_GEN_DIRECTED_BYTES_RCV 0x00020207 -#define OID_GEN_DIRECTED_FRAMES_RCV 0x00020208 -#define OID_GEN_MULTICAST_BYTES_RCV 0x00020209 -#define OID_GEN_MULTICAST_FRAMES_RCV 0x0002020A -#define OID_GEN_BROADCAST_BYTES_RCV 0x0002020B -#define OID_GEN_BROADCAST_FRAMES_RCV 0x0002020C -#define OID_GEN_RCV_CRC_ERROR 0x0002020D -#define OID_GEN_TRANSMIT_QUEUE_LENGTH 0x0002020E -#define OID_GEN_GET_TIME_CAPS 0x0002020F -#define OID_GEN_GET_NETCARD_TIME 0x00020210 -// -// These are connection-oriented general OIDs. -// These replace the above OIDs for connection-oriented media. -// -#define OID_GEN_CO_SUPPORTED_LIST 0x00010101 -#define OID_GEN_CO_HARDWARE_STATUS 0x00010102 -#define OID_GEN_CO_MEDIA_SUPPORTED 0x00010103 -#define OID_GEN_CO_MEDIA_IN_USE 0x00010104 -#define OID_GEN_CO_LINK_SPEED 0x00010105 -#define OID_GEN_CO_VENDOR_ID 0x00010106 -#define OID_GEN_CO_VENDOR_DESCRIPTION 0x00010107 -#define OID_GEN_CO_DRIVER_VERSION 0x00010108 -#define OID_GEN_CO_PROTOCOL_OPTIONS 0x00010109 -#define OID_GEN_CO_MAC_OPTIONS 0x0001010A -#define OID_GEN_CO_MEDIA_CONNECT_STATUS 0x0001010B -#define OID_GEN_CO_VENDOR_DRIVER_VERSION 0x0001010C -#define OID_GEN_CO_MINIMUM_LINK_SPEED 0x0001010D -#define OID_GEN_CO_GET_TIME_CAPS 0x00010201 -#define OID_GEN_CO_GET_NETCARD_TIME 0x00010202 -// -// These are connection-oriented statistics OIDs. -// -#define OID_GEN_CO_XMIT_PDUS_OK 0x00020101 -#define OID_GEN_CO_RCV_PDUS_OK 0x00020102 -#define OID_GEN_CO_XMIT_PDUS_ERROR 0x00020103 -#define OID_GEN_CO_RCV_PDUS_ERROR 0x00020104 -#define OID_GEN_CO_RCV_PDUS_NO_BUFFER 0x00020105 -#define OID_GEN_CO_RCV_CRC_ERROR 0x00020201 -#define OID_GEN_CO_TRANSMIT_QUEUE_LENGTH 0x00020202 -#define OID_GEN_CO_BYTES_XMIT 0x00020203 -#define OID_GEN_CO_BYTES_RCV 0x00020204 -#define OID_GEN_CO_BYTES_XMIT_OUTSTANDING 0x00020205 -#define OID_GEN_CO_NETCARD_LOAD 0x00020206 -// -// These are objects for Connection-oriented media call-managers and are not -// valid for ndis drivers. Under construction. -// -#define OID_CO_ADD_PVC 0xFF000001 -#define OID_CO_DELETE_PVC 0xFF000002 -#define OID_CO_GET_CALL_INFORMATION 0xFF000003 -#define OID_CO_ADD_ADDRESS 0xFF000004 -#define OID_CO_DELETE_ADDRESS 0xFF000005 -#define OID_CO_GET_ADDRESSES 0xFF000006 -#define OID_CO_ADDRESS_CHANGE 0xFF000007 -#define OID_CO_SIGNALING_ENABLED 0xFF000008 -#define OID_CO_SIGNALING_DISABLED 0xFF000009 -// -// 802.3 Objects (Ethernet) -// -#define OID_802_3_PERMANENT_ADDRESS 0x01010101 -#define OID_802_3_CURRENT_ADDRESS 0x01010102 -#define OID_802_3_MULTICAST_LIST 0x01010103 -#define OID_802_3_MAXIMUM_LIST_SIZE 0x01010104 -#define OID_802_3_MAC_OPTIONS 0x01010105 -// -// -#define NDIS_802_3_MAC_OPTION_PRIORITY 0x00000001 -#define OID_802_3_RCV_ERROR_ALIGNMENT 0x01020101 -#define OID_802_3_XMIT_ONE_COLLISION 0x01020102 -#define OID_802_3_XMIT_MORE_COLLISIONS 0x01020103 -#define OID_802_3_XMIT_DEFERRED 0x01020201 -#define OID_802_3_XMIT_MAX_COLLISIONS 0x01020202 -#define OID_802_3_RCV_OVERRUN 0x01020203 -#define OID_802_3_XMIT_UNDERRUN 0x01020204 -#define OID_802_3_XMIT_HEARTBEAT_FAILURE 0x01020205 -#define OID_802_3_XMIT_TIMES_CRS_LOST 0x01020206 -#define OID_802_3_XMIT_LATE_COLLISIONS 0x01020207 -// -// 802.5 Objects (Token-Ring) -// -#define OID_802_5_PERMANENT_ADDRESS 0x02010101 -#define OID_802_5_CURRENT_ADDRESS 0x02010102 -#define OID_802_5_CURRENT_FUNCTIONAL 0x02010103 -#define OID_802_5_CURRENT_GROUP 0x02010104 -#define OID_802_5_LAST_OPEN_STATUS 0x02010105 -#define OID_802_5_CURRENT_RING_STATUS 0x02010106 -#define OID_802_5_CURRENT_RING_STATE 0x02010107 -#define OID_802_5_LINE_ERRORS 0x02020101 -#define OID_802_5_LOST_FRAMES 0x02020102 -#define OID_802_5_BURST_ERRORS 0x02020201 -#define OID_802_5_AC_ERRORS 0x02020202 -#define OID_802_5_ABORT_DELIMETERS 0x02020203 -#define OID_802_5_FRAME_COPIED_ERRORS 0x02020204 -#define OID_802_5_FREQUENCY_ERRORS 0x02020205 -#define OID_802_5_TOKEN_ERRORS 0x02020206 -#define OID_802_5_INTERNAL_ERRORS 0x02020207 -// -// FDDI Objects -// -#define OID_FDDI_LONG_PERMANENT_ADDR 0x03010101 -#define OID_FDDI_LONG_CURRENT_ADDR 0x03010102 -#define OID_FDDI_LONG_MULTICAST_LIST 0x03010103 -#define OID_FDDI_LONG_MAX_LIST_SIZE 0x03010104 -#define OID_FDDI_SHORT_PERMANENT_ADDR 0x03010105 -#define OID_FDDI_SHORT_CURRENT_ADDR 0x03010106 -#define OID_FDDI_SHORT_MULTICAST_LIST 0x03010107 -#define OID_FDDI_SHORT_MAX_LIST_SIZE 0x03010108 -#define OID_FDDI_ATTACHMENT_TYPE 0x03020101 -#define OID_FDDI_UPSTREAM_NODE_LONG 0x03020102 -#define OID_FDDI_DOWNSTREAM_NODE_LONG 0x03020103 -#define OID_FDDI_FRAME_ERRORS 0x03020104 -#define OID_FDDI_FRAMES_LOST 0x03020105 -#define OID_FDDI_RING_MGT_STATE 0x03020106 -#define OID_FDDI_LCT_FAILURES 0x03020107 -#define OID_FDDI_LEM_REJECTS 0x03020108 -#define OID_FDDI_LCONNECTION_STATE 0x03020109 -#define OID_FDDI_SMT_STATION_ID 0x03030201 -#define OID_FDDI_SMT_OP_VERSION_ID 0x03030202 -#define OID_FDDI_SMT_HI_VERSION_ID 0x03030203 -#define OID_FDDI_SMT_LO_VERSION_ID 0x03030204 -#define OID_FDDI_SMT_MANUFACTURER_DATA 0x03030205 -#define OID_FDDI_SMT_USER_DATA 0x03030206 -#define OID_FDDI_SMT_MIB_VERSION_ID 0x03030207 -#define OID_FDDI_SMT_MAC_CT 0x03030208 -#define OID_FDDI_SMT_NON_MASTER_CT 0x03030209 -#define OID_FDDI_SMT_MASTER_CT 0x0303020A -#define OID_FDDI_SMT_AVAILABLE_PATHS 0x0303020B -#define OID_FDDI_SMT_CONFIG_CAPABILITIES 0x0303020C -#define OID_FDDI_SMT_CONFIG_POLICY 0x0303020D -#define OID_FDDI_SMT_CONNECTION_POLICY 0x0303020E -#define OID_FDDI_SMT_T_NOTIFY 0x0303020F -#define OID_FDDI_SMT_STAT_RPT_POLICY 0x03030210 -#define OID_FDDI_SMT_TRACE_MAX_EXPIRATION 0x03030211 -#define OID_FDDI_SMT_PORT_INDEXES 0x03030212 -#define OID_FDDI_SMT_MAC_INDEXES 0x03030213 -#define OID_FDDI_SMT_BYPASS_PRESENT 0x03030214 -#define OID_FDDI_SMT_ECM_STATE 0x03030215 -#define OID_FDDI_SMT_CF_STATE 0x03030216 -#define OID_FDDI_SMT_HOLD_STATE 0x03030217 -#define OID_FDDI_SMT_REMOTE_DISCONNECT_FLAG 0x03030218 -#define OID_FDDI_SMT_STATION_STATUS 0x03030219 -#define OID_FDDI_SMT_PEER_WRAP_FLAG 0x0303021A -#define OID_FDDI_SMT_MSG_TIME_STAMP 0x0303021B -#define OID_FDDI_SMT_TRANSITION_TIME_STAMP 0x0303021C -#define OID_FDDI_SMT_SET_COUNT 0x0303021D -#define OID_FDDI_SMT_LAST_SET_STATION_ID 0x0303021E -#define OID_FDDI_MAC_FRAME_STATUS_FUNCTIONS 0x0303021F -#define OID_FDDI_MAC_BRIDGE_FUNCTIONS 0x03030220 -#define OID_FDDI_MAC_T_MAX_CAPABILITY 0x03030221 -#define OID_FDDI_MAC_TVX_CAPABILITY 0x03030222 -#define OID_FDDI_MAC_AVAILABLE_PATHS 0x03030223 -#define OID_FDDI_MAC_CURRENT_PATH 0x03030224 -#define OID_FDDI_MAC_UPSTREAM_NBR 0x03030225 -#define OID_FDDI_MAC_DOWNSTREAM_NBR 0x03030226 -#define OID_FDDI_MAC_OLD_UPSTREAM_NBR 0x03030227 -#define OID_FDDI_MAC_OLD_DOWNSTREAM_NBR 0x03030228 -#define OID_FDDI_MAC_DUP_ADDRESS_TEST 0x03030229 -#define OID_FDDI_MAC_REQUESTED_PATHS 0x0303022A -#define OID_FDDI_MAC_DOWNSTREAM_PORT_TYPE 0x0303022B -#define OID_FDDI_MAC_INDEX 0x0303022C -#define OID_FDDI_MAC_SMT_ADDRESS 0x0303022D -#define OID_FDDI_MAC_LONG_GRP_ADDRESS 0x0303022E -#define OID_FDDI_MAC_SHORT_GRP_ADDRESS 0x0303022F -#define OID_FDDI_MAC_T_REQ 0x03030230 -#define OID_FDDI_MAC_T_NEG 0x03030231 -#define OID_FDDI_MAC_T_MAX 0x03030232 -#define OID_FDDI_MAC_TVX_VALUE 0x03030233 -#define OID_FDDI_MAC_T_PRI0 0x03030234 -#define OID_FDDI_MAC_T_PRI1 0x03030235 -#define OID_FDDI_MAC_T_PRI2 0x03030236 -#define OID_FDDI_MAC_T_PRI3 0x03030237 -#define OID_FDDI_MAC_T_PRI4 0x03030238 -#define OID_FDDI_MAC_T_PRI5 0x03030239 -#define OID_FDDI_MAC_T_PRI6 0x0303023A -#define OID_FDDI_MAC_FRAME_CT 0x0303023B -#define OID_FDDI_MAC_COPIED_CT 0x0303023C -#define OID_FDDI_MAC_TRANSMIT_CT 0x0303023D -#define OID_FDDI_MAC_TOKEN_CT 0x0303023E -#define OID_FDDI_MAC_ERROR_CT 0x0303023F -#define OID_FDDI_MAC_LOST_CT 0x03030240 -#define OID_FDDI_MAC_TVX_EXPIRED_CT 0x03030241 -#define OID_FDDI_MAC_NOT_COPIED_CT 0x03030242 -#define OID_FDDI_MAC_LATE_CT 0x03030243 -#define OID_FDDI_MAC_RING_OP_CT 0x03030244 -#define OID_FDDI_MAC_FRAME_ERROR_THRESHOLD 0x03030245 -#define OID_FDDI_MAC_FRAME_ERROR_RATIO 0x03030246 -#define OID_FDDI_MAC_NOT_COPIED_THRESHOLD 0x03030247 -#define OID_FDDI_MAC_NOT_COPIED_RATIO 0x03030248 -#define OID_FDDI_MAC_RMT_STATE 0x03030249 -#define OID_FDDI_MAC_DA_FLAG 0x0303024A -#define OID_FDDI_MAC_UNDA_FLAG 0x0303024B -#define OID_FDDI_MAC_FRAME_ERROR_FLAG 0x0303024C -#define OID_FDDI_MAC_NOT_COPIED_FLAG 0x0303024D -#define OID_FDDI_MAC_MA_UNITDATA_AVAILABLE 0x0303024E -#define OID_FDDI_MAC_HARDWARE_PRESENT 0x0303024F -#define OID_FDDI_MAC_MA_UNITDATA_ENABLE 0x03030250 -#define OID_FDDI_PATH_INDEX 0x03030251 -#define OID_FDDI_PATH_RING_LATENCY 0x03030252 -#define OID_FDDI_PATH_TRACE_STATUS 0x03030253 -#define OID_FDDI_PATH_SBA_PAYLOAD 0x03030254 -#define OID_FDDI_PATH_SBA_OVERHEAD 0x03030255 -#define OID_FDDI_PATH_CONFIGURATION 0x03030256 -#define OID_FDDI_PATH_T_R_MODE 0x03030257 -#define OID_FDDI_PATH_SBA_AVAILABLE 0x03030258 -#define OID_FDDI_PATH_TVX_LOWER_BOUND 0x03030259 -#define OID_FDDI_PATH_T_MAX_LOWER_BOUND 0x0303025A -#define OID_FDDI_PATH_MAX_T_REQ 0x0303025B -#define OID_FDDI_PORT_MY_TYPE 0x0303025C -#define OID_FDDI_PORT_NEIGHBOR_TYPE 0x0303025D -#define OID_FDDI_PORT_CONNECTION_POLICIES 0x0303025E -#define OID_FDDI_PORT_MAC_INDICATED 0x0303025F -#define OID_FDDI_PORT_CURRENT_PATH 0x03030260 -#define OID_FDDI_PORT_REQUESTED_PATHS 0x03030261 -#define OID_FDDI_PORT_MAC_PLACEMENT 0x03030262 -#define OID_FDDI_PORT_AVAILABLE_PATHS 0x03030263 -#define OID_FDDI_PORT_MAC_LOOP_TIME 0x03030264 -#define OID_FDDI_PORT_PMD_CLASS 0x03030265 -#define OID_FDDI_PORT_CONNECTION_CAPABILITIES 0x03030266 -#define OID_FDDI_PORT_INDEX 0x03030267 -#define OID_FDDI_PORT_MAINT_LS 0x03030268 -#define OID_FDDI_PORT_BS_FLAG 0x03030269 -#define OID_FDDI_PORT_PC_LS 0x0303026A -#define OID_FDDI_PORT_EB_ERROR_CT 0x0303026B -#define OID_FDDI_PORT_LCT_FAIL_CT 0x0303026C -#define OID_FDDI_PORT_LER_ESTIMATE 0x0303026D -#define OID_FDDI_PORT_LEM_REJECT_CT 0x0303026E -#define OID_FDDI_PORT_LEM_CT 0x0303026F -#define OID_FDDI_PORT_LER_CUTOFF 0x03030270 -#define OID_FDDI_PORT_LER_ALARM 0x03030271 -#define OID_FDDI_PORT_CONNNECT_STATE 0x03030272 -#define OID_FDDI_PORT_PCM_STATE 0x03030273 -#define OID_FDDI_PORT_PC_WITHHOLD 0x03030274 -#define OID_FDDI_PORT_LER_FLAG 0x03030275 -#define OID_FDDI_PORT_HARDWARE_PRESENT 0x03030276 -#define OID_FDDI_SMT_STATION_ACTION 0x03030277 -#define OID_FDDI_PORT_ACTION 0x03030278 -#define OID_FDDI_IF_DESCR 0x03030279 -#define OID_FDDI_IF_TYPE 0x0303027A -#define OID_FDDI_IF_MTU 0x0303027B -#define OID_FDDI_IF_SPEED 0x0303027C -#define OID_FDDI_IF_PHYS_ADDRESS 0x0303027D -#define OID_FDDI_IF_ADMIN_STATUS 0x0303027E -#define OID_FDDI_IF_OPER_STATUS 0x0303027F -#define OID_FDDI_IF_LAST_CHANGE 0x03030280 -#define OID_FDDI_IF_IN_OCTETS 0x03030281 -#define OID_FDDI_IF_IN_UCAST_PKTS 0x03030282 -#define OID_FDDI_IF_IN_NUCAST_PKTS 0x03030283 -#define OID_FDDI_IF_IN_DISCARDS 0x03030284 -#define OID_FDDI_IF_IN_ERRORS 0x03030285 -#define OID_FDDI_IF_IN_UNKNOWN_PROTOS 0x03030286 -#define OID_FDDI_IF_OUT_OCTETS 0x03030287 -#define OID_FDDI_IF_OUT_UCAST_PKTS 0x03030288 -#define OID_FDDI_IF_OUT_NUCAST_PKTS 0x03030289 -#define OID_FDDI_IF_OUT_DISCARDS 0x0303028A -#define OID_FDDI_IF_OUT_ERRORS 0x0303028B -#define OID_FDDI_IF_OUT_QLEN 0x0303028C -#define OID_FDDI_IF_SPECIFIC 0x0303028D -// -// WAN objects -// -#define OID_WAN_PERMANENT_ADDRESS 0x04010101 -#define OID_WAN_CURRENT_ADDRESS 0x04010102 -#define OID_WAN_QUALITY_OF_SERVICE 0x04010103 -#define OID_WAN_PROTOCOL_TYPE 0x04010104 -#define OID_WAN_MEDIUM_SUBTYPE 0x04010105 -#define OID_WAN_HEADER_FORMAT 0x04010106 -#define OID_WAN_GET_INFO 0x04010107 -#define OID_WAN_SET_LINK_INFO 0x04010108 -#define OID_WAN_GET_LINK_INFO 0x04010109 -#define OID_WAN_LINE_COUNT 0x0401010A -#define OID_WAN_GET_BRIDGE_INFO 0x0401020A -#define OID_WAN_SET_BRIDGE_INFO 0x0401020B -#define OID_WAN_GET_COMP_INFO 0x0401020C -#define OID_WAN_SET_COMP_INFO 0x0401020D -#define OID_WAN_GET_STATS_INFO 0x0401020E -// -// LocalTalk objects -// -#define OID_LTALK_CURRENT_NODE_ID 0x05010102 -#define OID_LTALK_IN_BROADCASTS 0x05020101 -#define OID_LTALK_IN_LENGTH_ERRORS 0x05020102 -#define OID_LTALK_OUT_NO_HANDLERS 0x05020201 -#define OID_LTALK_COLLISIONS 0x05020202 -#define OID_LTALK_DEFERS 0x05020203 -#define OID_LTALK_NO_DATA_ERRORS 0x05020204 -#define OID_LTALK_RANDOM_CTS_ERRORS 0x05020205 -#define OID_LTALK_FCS_ERRORS 0x05020206 -// -// Arcnet objects -// -#define OID_ARCNET_PERMANENT_ADDRESS 0x06010101 -#define OID_ARCNET_CURRENT_ADDRESS 0x06010102 -#define OID_ARCNET_RECONFIGURATIONS 0x06020201 -// -// TAPI objects -// -#define OID_TAPI_ACCEPT 0x07030101 -#define OID_TAPI_ANSWER 0x07030102 -#define OID_TAPI_CLOSE 0x07030103 -#define OID_TAPI_CLOSE_CALL 0x07030104 -#define OID_TAPI_CONDITIONAL_MEDIA_DETECTION 0x07030105 -#define OID_TAPI_CONFIG_DIALOG 0x07030106 -#define OID_TAPI_DEV_SPECIFIC 0x07030107 -#define OID_TAPI_DIAL 0x07030108 -#define OID_TAPI_DROP 0x07030109 -#define OID_TAPI_GET_ADDRESS_CAPS 0x0703010A -#define OID_TAPI_GET_ADDRESS_ID 0x0703010B -#define OID_TAPI_GET_ADDRESS_STATUS 0x0703010C -#define OID_TAPI_GET_CALL_ADDRESS_ID 0x0703010D -#define OID_TAPI_GET_CALL_INFO 0x0703010E -#define OID_TAPI_GET_CALL_STATUS 0x0703010F -#define OID_TAPI_GET_DEV_CAPS 0x07030110 -#define OID_TAPI_GET_DEV_CONFIG 0x07030111 -#define OID_TAPI_GET_EXTENSION_ID 0x07030112 -#define OID_TAPI_GET_ID 0x07030113 -#define OID_TAPI_GET_LINE_DEV_STATUS 0x07030114 -#define OID_TAPI_MAKE_CALL 0x07030115 -#define OID_TAPI_NEGOTIATE_EXT_VERSION 0x07030116 -#define OID_TAPI_OPEN 0x07030117 -#define OID_TAPI_PROVIDER_INITIALIZE 0x07030118 -#define OID_TAPI_PROVIDER_SHUTDOWN 0x07030119 -#define OID_TAPI_SECURE_CALL 0x0703011A -#define OID_TAPI_SELECT_EXT_VERSION 0x0703011B -#define OID_TAPI_SEND_USER_USER_INFO 0x0703011C -#define OID_TAPI_SET_APP_SPECIFIC 0x0703011D -#define OID_TAPI_SET_CALL_PARAMS 0x0703011E -#define OID_TAPI_SET_DEFAULT_MEDIA_DETECTION 0x0703011F -#define OID_TAPI_SET_DEV_CONFIG 0x07030120 -#define OID_TAPI_SET_MEDIA_MODE 0x07030121 -#define OID_TAPI_SET_STATUS_MESSAGES 0x07030122 -// -// ATM Connection Oriented Ndis -// -#define OID_ATM_SUPPORTED_VC_RATES 0x08010101 -#define OID_ATM_SUPPORTED_SERVICE_CATEGORY 0x08010102 -#define OID_ATM_SUPPORTED_AAL_TYPES 0x08010103 -#define OID_ATM_HW_CURRENT_ADDRESS 0x08010104 -#define OID_ATM_MAX_ACTIVE_VCS 0x08010105 -#define OID_ATM_MAX_ACTIVE_VCI_BITS 0x08010106 -#define OID_ATM_MAX_ACTIVE_VPI_BITS 0x08010107 -#define OID_ATM_MAX_AAL0_PACKET_SIZE 0x08010108 -#define OID_ATM_MAX_AAL1_PACKET_SIZE 0x08010109 -#define OID_ATM_MAX_AAL34_PACKET_SIZE 0x0801010A -#define OID_ATM_MAX_AAL5_PACKET_SIZE 0x0801010B -#define OID_ATM_SIGNALING_VPIVCI 0x08010201 -#define OID_ATM_ASSIGNED_VPI 0x08010202 -#define OID_ATM_ACQUIRE_ACCESS_NET_RESOURCES 0x08010203 -#define OID_ATM_RELEASE_ACCESS_NET_RESOURCES 0x08010204 -#define OID_ATM_ILMI_VPIVCI 0x08010205 -#define OID_ATM_DIGITAL_BROADCAST_VPIVCI 0x08010206 -#define OID_ATM_GET_NEAREST_FLOW 0x08010207 -#define OID_ATM_ALIGNMENT_REQUIRED 0x08010208 -// -// ATM specific statistics OIDs. -// -#define OID_ATM_RCV_CELLS_OK 0x08020101 -#define OID_ATM_XMIT_CELLS_OK 0x08020102 -#define OID_ATM_RCV_CELLS_DROPPED 0x08020103 -#define OID_ATM_RCV_INVALID_VPI_VCI 0x08020201 -#define OID_ATM_CELLS_HEC_ERROR 0x08020202 -#define OID_ATM_RCV_REASSEMBLY_ERROR 0x08020203 -// -// PCCA (Wireless) object -// -// -// All WirelessWAN devices must support the following OIDs -// -#define OID_WW_GEN_NETWORK_TYPES_SUPPORTED 0x09010101 -#define OID_WW_GEN_NETWORK_TYPE_IN_USE 0x09010102 -#define OID_WW_GEN_HEADER_FORMATS_SUPPORTED 0x09010103 -#define OID_WW_GEN_HEADER_FORMAT_IN_USE 0x09010104 -#define OID_WW_GEN_INDICATION_REQUEST 0x09010105 -#define OID_WW_GEN_DEVICE_INFO 0x09010106 -#define OID_WW_GEN_OPERATION_MODE 0x09010107 -#define OID_WW_GEN_LOCK_STATUS 0x09010108 -#define OID_WW_GEN_DISABLE_TRANSMITTER 0x09010109 -#define OID_WW_GEN_NETWORK_ID 0x0901010A -#define OID_WW_GEN_PERMANENT_ADDRESS 0x0901010B -#define OID_WW_GEN_CURRENT_ADDRESS 0x0901010C -#define OID_WW_GEN_SUSPEND_DRIVER 0x0901010D -#define OID_WW_GEN_BASESTATION_ID 0x0901010E -#define OID_WW_GEN_CHANNEL_ID 0x0901010F -#define OID_WW_GEN_ENCRYPTION_SUPPORTED 0x09010110 -#define OID_WW_GEN_ENCRYPTION_IN_USE 0x09010111 -#define OID_WW_GEN_ENCRYPTION_STATE 0x09010112 -#define OID_WW_GEN_CHANNEL_QUALITY 0x09010113 -#define OID_WW_GEN_REGISTRATION_STATUS 0x09010114 -#define OID_WW_GEN_RADIO_LINK_SPEED 0x09010115 -#define OID_WW_GEN_LATENCY 0x09010116 -#define OID_WW_GEN_BATTERY_LEVEL 0x09010117 -#define OID_WW_GEN_EXTERNAL_POWER 0x09010118 -// -// Network Dependent OIDs - Mobitex: -// -#define OID_WW_MBX_SUBADDR 0x09050101 -// OID 0x09050102 is reserved and may not be used -#define OID_WW_MBX_FLEXLIST 0x09050103 -#define OID_WW_MBX_GROUPLIST 0x09050104 -#define OID_WW_MBX_TRAFFIC_AREA 0x09050105 -#define OID_WW_MBX_LIVE_DIE 0x09050106 -#define OID_WW_MBX_TEMP_DEFAULTLIST 0x09050107 -// -// Network Dependent OIDs - Pinpoint: -// -#define OID_WW_PIN_LOC_AUTHORIZE 0x09090101 -#define OID_WW_PIN_LAST_LOCATION 0x09090102 -#define OID_WW_PIN_LOC_FIX 0x09090103 -// -// Network Dependent - CDPD: -// -#define OID_WW_CDPD_SPNI 0x090D0101 -#define OID_WW_CDPD_WASI 0x090D0102 -#define OID_WW_CDPD_AREA_COLOR 0x090D0103 -#define OID_WW_CDPD_TX_POWER_LEVEL 0x090D0104 -#define OID_WW_CDPD_EID 0x090D0105 -#define OID_WW_CDPD_HEADER_COMPRESSION 0x090D0106 -#define OID_WW_CDPD_DATA_COMPRESSION 0x090D0107 -#define OID_WW_CDPD_CHANNEL_SELECT 0x090D0108 -#define OID_WW_CDPD_CHANNEL_STATE 0x090D0109 -#define OID_WW_CDPD_NEI 0x090D010A -#define OID_WW_CDPD_NEI_STATE 0x090D010B -#define OID_WW_CDPD_SERVICE_PROVIDER_IDENTIFIER 0x090D010C -#define OID_WW_CDPD_SLEEP_MODE 0x090D010D -#define OID_WW_CDPD_CIRCUIT_SWITCHED 0x090D010E -#define OID_WW_CDPD_TEI 0x090D010F -#define OID_WW_CDPD_RSSI 0x090D0110 -// -// Network Dependent - Ardis: -// -#define OID_WW_ARD_SNDCP 0x09110101 -#define OID_WW_ARD_TMLY_MSG 0x09110102 -#define OID_WW_ARD_DATAGRAM 0x09110103 -// -// Network Dependent - DataTac: -// -#define OID_WW_TAC_COMPRESSION 0x09150101 -#define OID_WW_TAC_SET_CONFIG 0x09150102 -#define OID_WW_TAC_GET_STATUS 0x09150103 -#define OID_WW_TAC_USER_HEADER 0x09150104 -// -// Network Dependent - Metricom: -// -#define OID_WW_MET_FUNCTION 0x09190101 -// -// IRDA objects -// -#define OID_IRDA_RECEIVING 0x0A010100 -#define OID_IRDA_TURNAROUND_TIME 0x0A010101 -#define OID_IRDA_SUPPORTED_SPEEDS 0x0A010102 -#define OID_IRDA_LINK_SPEED 0x0A010103 -#define OID_IRDA_MEDIA_BUSY 0x0A010104 -#define OID_IRDA_EXTRA_RCV_BOFS 0x0A010200 -#define OID_IRDA_RATE_SNIFF 0x0A010201 -#define OID_IRDA_UNICAST_LIST 0x0A010202 -#define OID_IRDA_MAX_UNICAST_LIST_SIZE 0x0A010203 -#define OID_IRDA_MAX_RECEIVE_WINDOW_SIZE 0x0A010204 -#define OID_IRDA_MAX_SEND_WINDOW_SIZE 0x0A010205 -// -// Medium the Ndis Driver is running on (OID_GEN_MEDIA_SUPPORTED/ -// OID_GEN_MEDIA_IN_USE). -// -typedef enum _NDIS_MEDIUM { - NdisMedium802_3, - NdisMedium802_5, - NdisMediumFddi, - NdisMediumWan, - NdisMediumLocalTalk, - NdisMediumDix, // defined for convenience, not a real medium - NdisMediumArcnetRaw, - NdisMediumArcnet878_2, - NdisMediumAtm, - NdisMediumWirelessWan, - NdisMediumIrda, - NdisMediumMax // Not a real medium, defined as an upper-bound -} NDIS_MEDIUM, *PNDIS_MEDIUM; - -// -// Hardware status codes (OID_GEN_HARDWARE_STATUS). -// -typedef enum _NDIS_HARDWARE_STATUS { - NdisHardwareStatusReady, - NdisHardwareStatusInitializing, - NdisHardwareStatusReset, - NdisHardwareStatusClosing, - NdisHardwareStatusNotReady -} NDIS_HARDWARE_STATUS, *PNDIS_HARDWARE_STATUS; - -// -// this is the type passed in the OID_GEN_GET_TIME_CAPS request -// -typedef struct _GEN_GET_TIME_CAPS { - ULONG Flags; // Bits defined below - - ULONG ClockPrecision; -} GEN_GET_TIME_CAPS, *PGEN_GET_TIME_CAPS; - -#define READABLE_LOCAL_CLOCK 0x000000001 -#define CLOCK_NETWORK_DERIVED 0x000000002 -#define CLOCK_PRECISION 0x000000004 -#define RECEIVE_TIME_INDICATION_CAPABLE 0x000000008 -#define TIMED_SEND_CAPABLE 0x000000010 -#define TIME_STAMP_CAPABLE 0x000000020 -// -// -// this is the type passed in the OID_GEN_GET_NETCARD_TIME request -// -typedef struct _GEN_GET_NETCARD_TIME { - ULONG ReadTime; -} GEN_GET_NETCARD_TIME, *PGEN_GET_NETCARD_TIME; - -// -// Defines the attachment types for FDDI (OID_FDDI_ATTACHMENT_TYPE). -// -typedef enum _NDIS_FDDI_ATTACHMENT_TYPE { - NdisFddiTypeIsolated = 1, - NdisFddiTypeLocalA, - NdisFddiTypeLocalB, - NdisFddiTypeLocalAB, - NdisFddiTypeLocalS, - NdisFddiTypeWrapA, - NdisFddiTypeWrapB, - NdisFddiTypeWrapAB, - NdisFddiTypeWrapS, - NdisFddiTypeCWrapA, - NdisFddiTypeCWrapB, - NdisFddiTypeCWrapS, - NdisFddiTypeThrough -} NDIS_FDDI_ATTACHMENT_TYPE, *PNDIS_FDDI_ATTACHMENT_TYPE; - -// -// Defines the ring management states for FDDI (OID_FDDI_RING_MGT_STATE). -// -typedef enum _NDIS_FDDI_RING_MGT_STATE { - NdisFddiRingIsolated = 1, - NdisFddiRingNonOperational, - NdisFddiRingOperational, - NdisFddiRingDetect, - NdisFddiRingNonOperationalDup, - NdisFddiRingOperationalDup, - NdisFddiRingDirected, - NdisFddiRingTrace -} NDIS_FDDI_RING_MGT_STATE, *PNDIS_FDDI_RING_MGT_STATE; - -// -// Defines the Lconnection state for FDDI (OID_FDDI_LCONNECTION_STATE). -// -typedef enum _NDIS_FDDI_LCONNECTION_STATE { - NdisFddiStateOff = 1, - NdisFddiStateBreak, - NdisFddiStateTrace, - NdisFddiStateConnect, - NdisFddiStateNext, - NdisFddiStateSignal, - NdisFddiStateJoin, - NdisFddiStateVerify, - NdisFddiStateActive, - NdisFddiStateMaintenance -} NDIS_FDDI_LCONNECTION_STATE, *PNDIS_FDDI_LCONNECTION_STATE; - -// -// Defines the medium subtypes for WAN medium (OID_WAN_MEDIUM_SUBTYPE). -// -typedef enum _NDIS_WAN_MEDIUM_SUBTYPE { - NdisWanMediumHub, - NdisWanMediumX_25, - NdisWanMediumIsdn, - NdisWanMediumSerial, - NdisWanMediumFrameRelay, - NdisWanMediumAtm, - NdisWanMediumSonet, - NdisWanMediumSW56K -} NDIS_WAN_MEDIUM_SUBTYPE, *PNDIS_WAN_MEDIUM_SUBTYPE; - -// -// Defines the header format for WAN medium (OID_WAN_HEADER_FORMAT). -// -typedef enum _NDIS_WAN_HEADER_FORMAT { - NdisWanHeaderNative, // src/dest based on subtype, followed by NLPID - NdisWanHeaderEthernet // emulation of ethernet header -} NDIS_WAN_HEADER_FORMAT, *PNDIS_WAN_HEADER_FORMAT; - -// -// Defines the line quality on a WAN line (OID_WAN_QUALITY_OF_SERVICE). -// -typedef enum _NDIS_WAN_QUALITY { - NdisWanRaw, - NdisWanErrorControl, - NdisWanReliable -} NDIS_WAN_QUALITY, *PNDIS_WAN_QUALITY; - -// -// Defines the state of a token-ring adapter (OID_802_5_CURRENT_RING_STATE). -// -typedef enum _NDIS_802_5_RING_STATE { - NdisRingStateOpened = 1, - NdisRingStateClosed, - NdisRingStateOpening, - NdisRingStateClosing, - NdisRingStateOpenFailure, - NdisRingStateRingFailure -} NDIS_802_5_RING_STATE, *PNDIS_802_5_RING_STATE; - -// -// Defines the state of the LAN media -// -typedef enum _NDIS_MEDIA_STATE { - NdisMediaStateConnected, - NdisMediaStateDisconnected -} NDIS_MEDIA_STATE, *PNDIS_MEDIA_STATE; - -// -// The following is set on a per-packet basis as OOB data with NdisClass802_3Priority -// -typedef ULONG Priority_802_3; // 0-7 priority levels -// -// The following structure is used to query OID_GEN_CO_LINK_SPEED and -// OID_GEN_CO_MINIMUM_LINK_SPEED. The first OID will return the current -// link speed of the adapter. The second will return the minimum link speed -// the adapter is capable of. -// - -typedef struct _NDIS_CO_LINK_SPEED { - ULONG Outbound; - ULONG Inbound; -} NDIS_CO_LINK_SPEED, - -*PNDIS_CO_LINK_SPEED; -// -// Ndis Packet Filter Bits (OID_GEN_CURRENT_PACKET_FILTER). -// -#define NDIS_PACKET_TYPE_DIRECTED 0x0001 -#define NDIS_PACKET_TYPE_MULTICAST 0x0002 -#define NDIS_PACKET_TYPE_ALL_MULTICAST 0x0004 -#define NDIS_PACKET_TYPE_BROADCAST 0x0008 -#define NDIS_PACKET_TYPE_SOURCE_ROUTING 0x0010 -#define NDIS_PACKET_TYPE_PROMISCUOUS 0x0020 -#define NDIS_PACKET_TYPE_SMT 0x0040 -#define NDIS_PACKET_TYPE_ALL_LOCAL 0x0080 -#define NDIS_PACKET_TYPE_MAC_FRAME 0x8000 -#define NDIS_PACKET_TYPE_FUNCTIONAL 0x4000 -#define NDIS_PACKET_TYPE_ALL_FUNCTIONAL 0x2000 -#define NDIS_PACKET_TYPE_GROUP 0x1000 -// -// Ndis Token-Ring Ring Status Codes (OID_802_5_CURRENT_RING_STATUS). -// -#define NDIS_RING_SIGNAL_LOSS 0x00008000 -#define NDIS_RING_HARD_ERROR 0x00004000 -#define NDIS_RING_SOFT_ERROR 0x00002000 -#define NDIS_RING_TRANSMIT_BEACON 0x00001000 -#define NDIS_RING_LOBE_WIRE_FAULT 0x00000800 -#define NDIS_RING_AUTO_REMOVAL_ERROR 0x00000400 -#define NDIS_RING_REMOVE_RECEIVED 0x00000200 -#define NDIS_RING_COUNTER_OVERFLOW 0x00000100 -#define NDIS_RING_SINGLE_STATION 0x00000080 -#define NDIS_RING_RING_RECOVERY 0x00000040 -// -// Ndis protocol option bits (OID_GEN_PROTOCOL_OPTIONS). -// -#define NDIS_PROT_OPTION_ESTIMATED_LENGTH 0x00000001 -#define NDIS_PROT_OPTION_NO_LOOPBACK 0x00000002 -#define NDIS_PROT_OPTION_NO_RSVD_ON_RCVPKT 0x00000004 -// -// Ndis MAC option bits (OID_GEN_MAC_OPTIONS). -// -#define NDIS_MAC_OPTION_COPY_LOOKAHEAD_DATA 0x00000001 -#define NDIS_MAC_OPTION_RECEIVE_SERIALIZED 0x00000002 -#define NDIS_MAC_OPTION_TRANSFERS_NOT_PEND 0x00000004 -#define NDIS_MAC_OPTION_NO_LOOPBACK 0x00000008 -#define NDIS_MAC_OPTION_FULL_DUPLEX 0x00000010 -#define NDIS_MAC_OPTION_EOTX_INDICATION 0x00000020 -#define NDIS_MAC_OPTION_RESERVED 0x80000000 -// -// NDIS MAC option bits for OID_GEN_CO_MAC_OPTIONS. -// -#define NDIS_CO_MAC_OPTION_DYNAMIC_LINK_SPEED 0x00000001 -#ifdef IRDA -// -// The following is set on a per-packet basis as OOB data with NdisClassIrdaPacketInfo -// This is the per-packet info specified on a per-packet basis -// -typedef struct _NDIS_IRDA_PACKET_INFO { - UINT ExtraBOFs; - UINT MinTurnAroundTime; -} NDIS_IRDA_PACKET_INFO, *PNDIS_IRDA_PACKET_INFO; - -#endif -#ifdef WIRELESS_WAN -// -// Wireless WAN structure definitions -// -// -// currently defined Wireless network subtypes -// -typedef enum _NDIS_WW_NETWORK_TYPE { - NdisWWGeneric, - NdisWWMobitex, - NdisWWPinpoint, - NdisWWCDPD, - NdisWWArdis, - NdisWWDataTAC, - NdisWWMetricom, - NdisWWGSM, - NdisWWCDMA, - NdisWWTDMA, - NdisWWAMPS, - NdisWWInmarsat, - NdisWWpACT -} NDIS_WW_NETWORK_TYPE; - -// -// currently defined header formats -// -typedef enum _NDIS_WW_HEADER_FORMAT { - NdisWWDIXEthernetFrames, - NdisWWMPAKFrames, - NdisWWRDLAPFrames, - NdisWWMDC4800Frames -} NDIS_WW_HEADER_FORMAT; - -// -// currently defined encryption types -// -typedef enum _NDIS_WW_ENCRYPTION_TYPE { - NdisWWUnknownEncryption = -1, - NdisWWNoEncryption, - NdisWWDefaultEncryption -} NDIS_WW_ENCRYPTION_TYPE, *PNDIS_WW_ENCRYPTION_TYPE; - -// -// OID_WW_GEN_INDICATION_REQUEST -// -typedef struct _NDIS_WW_INDICATION_REQUEST { - NDIS_OID Oid; // IN - - UINT uIndicationFlag; // IN - - UINT uApplicationToken; // IN OUT - - HANDLE hIndicationHandle; // IN OUT - - INT iPollingInterval; // IN OUT - - NDIS_VAR_DATA_DESC InitialValue; // IN OUT - - NDIS_VAR_DATA_DESC OIDIndicationValue; // OUT - only valid after indication - - NDIS_VAR_DATA_DESC TriggerValue; // IN - -} NDIS_WW_INDICATION_REQUEST, *PNDIS_WW_INDICATION_REQUEST; - -#define OID_INDICATION_REQUEST_ENABLE 0x0000 -#define OID_INDICATION_REQUEST_CANCEL 0x0001 -// -// OID_WW_GEN_DEVICE_INFO -// -typedef struct _WW_DEVICE_INFO { - NDIS_VAR_DATA_DESC Manufacturer; - NDIS_VAR_DATA_DESC ModelNum; - NDIS_VAR_DATA_DESC SWVersionNum; - NDIS_VAR_DATA_DESC SerialNum; -} WW_DEVICE_INFO, *PWW_DEVICE_INFO; - -// -// OID_WW_GEN_OPERATION_MODE -// -typedef INT WW_OPERATION_MODE; // 0 = Normal mode - // 1 = Power saving mode - // -1 = mode unknown -// -// OID_WW_GEN_LOCK_STATUS -// - -typedef INT WW_LOCK_STATUS; // 0 = unlocked - // 1 = locked - // -1 = unknown lock status -// -// OID_WW_GEN_DISABLE_TRANSMITTER -// - -typedef INT WW_DISABLE_TRANSMITTER; // 0 = transmitter enabled - // 1 = transmitter disabled - // -1 = unknown value -// -// OID_WW_GEN_NETWORK_ID -// - -typedef NDIS_VAR_DATA_DESC WW_NETWORK_ID; -// -// OID_WW_GEN_PERMANENT_ADDRESS -// -typedef NDIS_VAR_DATA_DESC WW_PERMANENT_ADDRESS; -// -// OID_WW_GEN_CURRENT_ADDRESS -// -typedef struct _WW_CURRENT_ADDRESS { - NDIS_WW_HEADER_FORMAT Format; - NDIS_VAR_DATA_DESC Address; -} WW_CURRENT_ADDRESS, *PWW_CURRENT_ADDRESS; - -// -// OID_WW_GEN_SUSPEND_DRIVER -// -typedef BOOLEAN WW_SUSPEND_DRIVER; // 0 = driver operational - // 1 = driver suspended -// -// OID_WW_GEN_BASESTATION_ID -// - -typedef NDIS_VAR_DATA_DESC WW_BASESTATION_ID; -// -// OID_WW_GEN_CHANNEL_ID -// -typedef NDIS_VAR_DATA_DESC WW_CHANNEL_ID; -// -// OID_WW_GEN_ENCRYPTION_STATE -// -typedef BOOLEAN WW_ENCRYPTION_STATE; // 0 = if encryption is disabled - // 1 = if encryption is enabled -// -// OID_WW_GEN_CHANNEL_QUALITY -// - -typedef INT WW_CHANNEL_QUALITY; // 0 = Not in network contact, - // 1-100 = Quality of Channel (100 is highest quality). - // -1 = channel quality is unknown -// -// OID_WW_GEN_REGISTRATION_STATUS -// - -typedef INT WW_REGISTRATION_STATUS; // 0 = Registration denied - // 1 = Registration pending - // 2 = Registered - // -1 = unknown registration status -// -// OID_WW_GEN_RADIO_LINK_SPEED -// - -typedef UINT WW_RADIO_LINK_SPEED; // Bits per second. -// -// OID_WW_GEN_LATENCY -// - -typedef UINT WW_LATENCY; // milliseconds -// -// OID_WW_GEN_BATTERY_LEVEL -// - -typedef INT WW_BATTERY_LEVEL; // 0-100 = battery level in percentage - // (100=fully charged) - // -1 = unknown battery level. -// -// OID_WW_GEN_EXTERNAL_POWER -// - -typedef INT WW_EXTERNAL_POWER; // 0 = no external power connected - // 1 = external power connected - // -1 = unknown -// -// OID_WW_MET_FUNCTION -// - -typedef NDIS_VAR_DATA_DESC WW_MET_FUNCTION; -// -// OID_WW_TAC_COMPRESSION -// -typedef BOOLEAN WW_TAC_COMPRESSION; // Determines whether or not network level compression - // is being used. -// -// OID_WW_TAC_SET_CONFIG -// - -typedef struct _WW_TAC_SETCONFIG { - NDIS_VAR_DATA_DESC RCV_MODE; - NDIS_VAR_DATA_DESC TX_CONTROL; - NDIS_VAR_DATA_DESC RX_CONTROL; - NDIS_VAR_DATA_DESC FLOW_CONTROL; - NDIS_VAR_DATA_DESC RESET_CNF; - NDIS_VAR_DATA_DESC READ_CNF; -} WW_TAC_SETCONFIG, *PWW_TAC_SETCONFIG; - -// -// OID_WW_TAC_GET_STATUS -// -typedef struct _WW_TAC_GETSTATUS { - BOOLEAN Action; // Set = Execute command. - - NDIS_VAR_DATA_DESC Command; - NDIS_VAR_DATA_DESC Option; - NDIS_VAR_DATA_DESC Response; // The response to the requested command - // - max. length of string is 256 octets. - -} WW_TAC_GETSTATUS, *PWW_TAC_GETSTATUS; - -// -// OID_WW_TAC_USER_HEADER -// -typedef NDIS_VAR_DATA_DESC WW_TAC_USERHEADER; // This will hold the user header - Max. 64 octets. -// -// OID_WW_ARD_SNDCP -// - -typedef struct _WW_ARD_SNDCP { - NDIS_VAR_DATA_DESC Version; // The version of SNDCP protocol supported. - - INT BlockSize; // The block size used for SNDCP - - INT Window; // The window size used in SNDCP - -} WW_ARD_SNDCP, *PWW_ARD_SNDCP; - -// -// OID_WW_ARD_TMLY_MSG -// -typedef BOOLEAN WW_ARD_CHANNEL_STATUS; // The current status of the inbound RF Channel. -// -// OID_WW_ARD_DATAGRAM -// - -typedef struct _WW_ARD_DATAGRAM { - BOOLEAN LoadLevel; // Byte that contains the load level info. - - INT SessionTime; // Datagram session time remaining. - - NDIS_VAR_DATA_DESC HostAddr; // Host address. - - NDIS_VAR_DATA_DESC THostAddr; // Test host address. - -} WW_ARD_DATAGRAM, *PWW_ARD_DATAGRAM; - -// -// OID_WW_CDPD_SPNI -// -typedef struct _WW_CDPD_SPNI { - UINT SPNI[10]; //10 16-bit service provider network IDs - - INT OperatingMode; // 0 = ignore SPNI, - // 1 = require SPNI from list, - // 2 = prefer SPNI from list. - // 3 = exclude SPNI from list. - -} WW_CDPD_SPNI, *PWW_CDPD_SPNI; - -// -// OID_WW_CDPD_WASI -// -typedef struct _WW_CDPD_WIDE_AREA_SERVICE_ID { - UINT WASI[10]; //10 16-bit wide area service IDs - - INT OperatingMode; // 0 = ignore WASI, - // 1 = Require WASI from list, - // 2 = prefer WASI from list - // 3 = exclude WASI from list. - -} WW_CDPD_WIDE_AREA_SERVICE_ID, *PWW_CDPD_WIDE_AREA_SERVICE_ID; - -// -// OID_WW_CDPD_AREA_COLOR -// -typedef INT WW_CDPD_AREA_COLOR; -// -// OID_WW_CDPD_TX_POWER_LEVEL -// -typedef UINT WW_CDPD_TX_POWER_LEVEL; -// -// OID_WW_CDPD_EID -// -typedef NDIS_VAR_DATA_DESC WW_CDPD_EID; -// -// OID_WW_CDPD_HEADER_COMPRESSION -// -typedef INT WW_CDPD_HEADER_COMPRESSION; // 0 = no header compression, - // 1 = always compress headers, - // 2 = compress headers if MD-IS does - // -1 = unknown -// -// OID_WW_CDPD_DATA_COMPRESSION -// - -typedef INT WW_CDPD_DATA_COMPRESSION; // 0 = no data compression, - // 1 = data compression enabled - // -1 = unknown -// -// OID_WW_CDPD_CHANNEL_SELECT -// - -typedef struct _WW_CDPD_CHANNEL_SELECT { - UINT ChannelID; // channel number - - UINT fixedDuration; // duration in seconds - -} WW_CDPD_CHANNEL_SELECT, *PWW_CDPD_CHANNEL_SELECT; - -// -// OID_WW_CDPD_CHANNEL_STATE -// -typedef enum _WW_CDPD_CHANNEL_STATE { - CDPDChannelNotAvail, - CDPDChannelScanning, - CDPDChannelInitAcquired, - CDPDChannelAcquired, - CDPDChannelSleeping, - CDPDChannelWaking, - CDPDChannelCSDialing, - CDPDChannelCSRedial, - CDPDChannelCSAnswering, - CDPDChannelCSConnected, - CDPDChannelCSSuspended -} WW_CDPD_CHANNEL_STATE, *PWW_CDPD_CHANNEL_STATE; - -// -// OID_WW_CDPD_NEI -// -typedef enum _WW_CDPD_NEI_FORMAT { - CDPDNeiIPv4, - CDPDNeiCLNP, - CDPDNeiIPv6 -} WW_CDPD_NEI_FORMAT, *PWW_CDPD_NEI_FORMAT; -typedef enum _WW_CDPD_NEI_TYPE { - CDPDNeiIndividual, - CDPDNeiMulticast, - CDPDNeiBroadcast -} WW_CDPD_NEI_TYPE; -typedef struct _WW_CDPD_NEI { - UINT uNeiIndex; - WW_CDPD_NEI_FORMAT NeiFormat; - WW_CDPD_NEI_TYPE NeiType; - WORD NeiGmid; // group member identifier, only - // meaningful if NeiType == - // CDPDNeiMulticast - - NDIS_VAR_DATA_DESC NeiAddress; -} WW_CDPD_NEI; - -// -// OID_WW_CDPD_NEI_STATE -// -typedef enum _WW_CDPD_NEI_STATE { - CDPDUnknown, - CDPDRegistered, - CDPDDeregistered -} WW_CDPD_NEI_STATE, *PWW_CDPD_NEI_STATE; -typedef enum _WW_CDPD_NEI_SUB_STATE { - CDPDPending, // Registration pending - CDPDNoReason, // Registration denied - no reason given - CDPDMDISNotCapable, // Registration denied - MD-IS not capable of - // handling M-ES at this time - CDPDNEINotAuthorized, // Registration denied - NEI is not authorized to - // use this subnetwork - CDPDInsufficientAuth, // Registration denied - M-ES gave insufficient - // authentication credentials - CDPDUnsupportedAuth, // Registration denied - M-ES gave unsupported - // authentication credentials - CDPDUsageExceeded, // Registration denied - NEI has exceeded usage - // limitations - CDPDDeniedThisNetwork // Registration denied on this network, service - // may be obtained on alternate Service Provider - // network -} WW_CDPD_NEI_SUB_STATE; -typedef struct _WW_CDPD_NEI_REG_STATE { - UINT uNeiIndex; - WW_CDPD_NEI_STATE NeiState; - WW_CDPD_NEI_SUB_STATE NeiSubState; -} WW_CDPD_NEI_REG_STATE, *PWW_CDPD_NEI_REG_STATE; - -// -// OID_WW_CDPD_SERVICE_PROVIDER_IDENTIFIER -// -typedef struct _WW_CDPD_SERVICE_PROVIDER_ID { - UINT SPI[10]; //10 16-bit service provider IDs - - INT OperatingMode; // 0 = ignore SPI, - // 1 = require SPI from list, - // 2 = prefer SPI from list. - // 3 = exclude SPI from list. - -} WW_CDPD_SERVICE_PROVIDER_ID, *PWW_CDPD_SERVICE_PROVIDER_ID; - -// -// OID_WW_CDPD_SLEEP_MODE -// -typedef INT WW_CDPD_SLEEP_MODE; -// -// OID_WW_CDPD_TEI -// -typedef ULONG WW_CDPD_TEI; -// -// OID_WW_CDPD_CIRCUIT_SWITCHED -// -typedef struct _WW_CDPD_CIRCUIT_SWITCHED { - INT service_preference; // -1 = unknown, - // 0 = always use packet switched CDPD, - // 1 = always use CS CDPD via AMPS, - // 2 = always use CS CDPD via PSTN, - // 3 = use circuit switched via AMPS only - // when packet switched is not available. - // 4 = use packet switched only when circuit - // switched via AMPS is not available. - // 5 = device manuf. defined service - // preference. - // 6 = device manuf. defined service - // preference. - - INT service_status; // -1 = unknown, - // 0 = packet switched CDPD, - // 1 = circuit switched CDPD via AMPS, - // 2 = circuit switched CDPD via PSTN. - - INT connect_rate; // CS connection bit rate (bits per second). - // 0 = no active connection, - // -1 = unknown - // Dial code last used to dial. - - NDIS_VAR_DATA_DESC dial_code[20]; - - UINT sid; // Current AMPS system ID - - INT a_b_side_selection; // -1 = unknown, - // 0 = no AMPS service - // 1 = AMPS "A" side channels selected - // 2 = AMPS "B" side channels selected - - INT AMPS_channel; // -1= unknown - // 0 = no AMPS service. - // 1-1023 = AMPS channel number in use - - UINT action; // 0 = no action - // 1 = suspend (hangup) - // 2 = dial - - // Default dial code for CS CDPD service - // encoded as specified in the CS CDPD - // implementor guidelines. - NDIS_VAR_DATA_DESC default_dial[20]; - - // Number for the CS CDPD network to call - // back the mobile, encoded as specified in - // the CS CDPD implementor guidelines. - NDIS_VAR_DATA_DESC call_back[20]; - - UINT sid_list[10]; // List of 10 16-bit preferred AMPS - // system IDs for CS CDPD. - - UINT inactivity_timer; // Wait time after last data before dropping - // call. - // 0-65535 = inactivity time limit (seconds). - - UINT receive_timer; // secs. per CS-CDPD Implementor Guidelines. - - UINT conn_resp_timer; // secs. per CS-CDPD Implementor Guidelines. - - UINT reconn_resp_timer; // secs. per CS-CDPD Implementor Guidelines. - - UINT disconn_timer; // secs. per CS-CDPD Implementor Guidelines. - - UINT NEI_reg_timer; // secs. per CS-CDPD Implementor Guidelines. - - UINT reconn_retry_timer; // secs. per CS-CDPD Implementor Guidelines. - - UINT link_reset_timer; // secs. per CS-CDPD Implementor Guidelines. - - UINT link_reset_ack_timer; // secs. per CS-CDPD Implementor Guidelines. - - UINT n401_retry_limit; // per CS-CDPD Implementor Guidelines. - - UINT n402_retry_limit; // per CS-CDPD Implementor Guidelines. - - UINT n404_retry_limit; // per CS-CDPD Implementor Guidelines. - - UINT n405_retry_limit; // per CS-CDPD Implementor Guidelines. - -} WW_CDPD_CIRCUIT_SWITCHED, *WW_PCDPD_CIRCUIT_SWITCHED; -typedef UINT WW_CDPD_RSSI; -// -// OID_WW_PIN_LOC_AUTHORIZE -// -typedef INT WW_PIN_AUTHORIZED; // 0 = unauthorized - // 1 = authorized - // -1 = unknown -// -// OID_WW_PIN_LAST_LOCATION -// OID_WW_PIN_LOC_FIX -// - -typedef struct _WW_PIN_LOCATION { - INT Latitude; // Latitude in hundredths of a second - - INT Longitude; // Longitude in hundredths of a second - - INT Altitude; // Altitude in feet - - INT FixTime; // Time of the location fix, since midnight, local time (of the - // current day), in tenths of a second - - INT NetTime; // Current local network time of the current day, since midnight, - // in tenths of a second - - INT LocQuality; // 0-100 = location quality - - INT LatReg; // Latitude registration offset, in hundredths of a second - - INT LongReg; // Longitude registration offset, in hundredths of a second - - INT GMTOffset; // Offset in minutes of the local time zone from GMT - -} WW_PIN_LOCATION, *PWW_PIN_LOCATION; - -// -// The following is set on a per-packet basis as OOB data with NdisClassWirelessWanMbxMailbox -// -typedef ULONG WW_MBX_MAILBOX_FLAG; // 1 = set mailbox flag, 0 = do not set mailbox flag -// -// OID_WW_MBX_SUBADDR -// - -typedef struct _WW_MBX_PMAN { - BOOLEAN ACTION; // 0 = Login PMAN, 1 = Logout PMAN - - UINT MAN; - UCHAR PASSWORD[8]; // Password should be null for Logout and indications. - // Maximum length of password is 8 chars. - -} WW_MBX_PMAN, *PWW_MBX_PMAN; - -// -// OID_WW_MBX_FLEXLIST -// -typedef struct _WW_MBX_FLEXLIST { - INT count; // Number of MAN entries used. - // -1=unknown. - - UINT MAN[7]; // List of MANs. - -} WW_MBX_FLEXLIST; - -// -// OID_WW_MBX_GROUPLIST -// -typedef struct _WW_MBX_GROUPLIST { - INT count; // Number of MAN entries used. - // -1=unknown. - - UINT MAN[15]; // List of MANs. - -} WW_MBX_GROUPLIST; - -// -// OID_WW_MBX_TRAFFIC_AREA -// -typedef enum _WW_MBX_TRAFFIC_AREA { - unknown_traffic_area, // The driver has no information about the current traffic area. - in_traffic_area, // Mobile unit has entered a subscribed traffic area. - in_auth_traffic_area, // Mobile unit is outside traffic area but is authorized. - unauth_traffic_area // Mobile unit is outside traffic area but is un-authorized. -} WW_MBX_TRAFFIC_AREA; - -// -// OID_WW_MBX_LIVE_DIE -// -typedef INT WW_MBX_LIVE_DIE; // 0 = DIE last received - // 1 = LIVE last received - // -1 = unknown -// -// OID_WW_MBX_TEMP_DEFAULTLIST -// - -typedef struct _WW_MBX_CHANNEL_PAIR { - UINT Mobile_Tx; - UINT Mobile_Rx; -} WW_MBX_CHANNEL_PAIR, *PWW_MBX_CHANNEL_PAIR; -typedef struct _WW_MBX_TEMPDEFAULTLIST { - UINT Length; - WW_MBX_CHANNEL_PAIR ChannelPair[1]; -} WW_MBX_TEMPDEFAULTLIST, *WW_PMBX_TEMPDEFAULTLIST; - -#endif // WIRELESS_WAN -#endif // _NTDDNDIS_ +/*++ BUILD Version: 0001 // Increment this if a change has global effects + Copyright (c) 1990-1993 Microsoft Corporation + Module Name: + ntddndis.h + Abstract: + This is the include file that defines all constants and types for + accessing the Network driver interface device. + Author: + Steve Wood (stevewo) 27-May-1990 + Revision History: + Adam Barr (adamba) 04-Nov-1992 added the correct values for NDIS 3.0. + Jameel Hyder (jameelh) 01-Aug-95 added Pnp IoCTLs and structures + Kyle Brandon (kyleb) 09/24/96 added general co ndis oids. + -- */ +#ifndef _NTDDNDIS_ +#define _NTDDNDIS_ +// +// Device Name - this string is the name of the device. It is the name +// that should be passed to NtOpenFile when accessing the device. +// +// Note: For devices that support multiple units, it should be suffixed +// with the Ascii representation of the unit number. +// +#define DD_NDIS_DEVICE_NAME "\\Device\\UNKNOWN" +// +// NtDeviceIoControlFile IoControlCode values for this device. +// +// Warning: Remember that the low two bits of the code specify how the +// buffers are passed to the driver! +// +#define _NDIS_CONTROL_CODE(request,method) \ + CTL_CODE(FILE_DEVICE_PHYSICAL_NETCARD, request, method, FILE_ANY_ACCESS) +#define IOCTL_NDIS_QUERY_GLOBAL_STATS _NDIS_CONTROL_CODE( 0, METHOD_OUT_DIRECT ) +#define IOCTL_NDIS_QUERY_ALL_STATS _NDIS_CONTROL_CODE( 1, METHOD_OUT_DIRECT ) +#define IOCTL_NDIS_ADD_DEVICE _NDIS_CONTROL_CODE( 2, METHOD_BUFFERED ) +#define IOCTL_NDIS_DELETE_DEVICE _NDIS_CONTROL_CODE( 3, METHOD_BUFFERED ) +#define IOCTL_NDIS_TRANSLATE_NAME _NDIS_CONTROL_CODE( 4, METHOD_BUFFERED ) +#define IOCTL_NDIS_ADD_TDI_DEVICE _NDIS_CONTROL_CODE( 5, METHOD_BUFFERED ) +#define IOCTL_NDIS_NOTIFY_PROTOCOL _NDIS_CONTROL_CODE( 6, METHOD_BUFFERED ) +#define IOCTL_NDIS_GET_LOG_DATA _NDIS_CONTROL_CODE( 7, METHOD_OUT_DIRECT ) +// +// NtDeviceIoControlFile InputBuffer/OutputBuffer record structures for +// this device. +// +// +// This is the type of an NDIS OID value. +// +typedef ULONG NDIS_OID, *PNDIS_OID; +// +// IOCTL_NDIS_QUERY_ALL_STATS returns a sequence of these, packed +// together (no padding is required since statistics all have +// four or eight bytes of data). +// +typedef struct _NDIS_STATISTICS_VALUE { + NDIS_OID Oid; + ULONG DataLength; + UCHAR Data[1]; // variable length + +} NDIS_STATISTICS_VALUE, *PNDIS_STATISTICS_VALUE; + +// +// Structure used by TRANSLATE_NAME IOCTL +// +typedef struct _NET_PNP_ID { + ULONG ClassId; + ULONG Token; +} NET_PNP_ID, *PNET_PNP_ID; + +typedef struct _NET_PNP_TRANSLATE_LIST { + ULONG BytesNeeded; + NET_PNP_ID IdArray[ANYSIZE_ARRAY]; +} NET_PNP_TRANSLATE_LIST, *PNET_PNP_TRANSLATE_LIST; + +// +// Structure used to define a self-contained variable data structure +// +typedef struct _NDIS_VAR_DATA_DESC { + USHORT Length; // # of octects of data + + USHORT MaximumLength; // # of octects available + + LONG Offset; // Offset of data relative to the descriptor + +} NDIS_VAR_DATA_DESC, *PNDIS_VAR_DATA_DESC; + +// +// Object Identifiers used by NdisRequest Query/Set Information +// +// +// General Objects +// +#define OID_GEN_SUPPORTED_LIST 0x00010101 +#define OID_GEN_HARDWARE_STATUS 0x00010102 +#define OID_GEN_MEDIA_SUPPORTED 0x00010103 +#define OID_GEN_MEDIA_IN_USE 0x00010104 +#define OID_GEN_MAXIMUM_LOOKAHEAD 0x00010105 +#define OID_GEN_MAXIMUM_FRAME_SIZE 0x00010106 +#define OID_GEN_LINK_SPEED 0x00010107 +#define OID_GEN_TRANSMIT_BUFFER_SPACE 0x00010108 +#define OID_GEN_RECEIVE_BUFFER_SPACE 0x00010109 +#define OID_GEN_TRANSMIT_BLOCK_SIZE 0x0001010A +#define OID_GEN_RECEIVE_BLOCK_SIZE 0x0001010B +#define OID_GEN_VENDOR_ID 0x0001010C +#define OID_GEN_VENDOR_DESCRIPTION 0x0001010D +#define OID_GEN_CURRENT_PACKET_FILTER 0x0001010E +#define OID_GEN_CURRENT_LOOKAHEAD 0x0001010F +#define OID_GEN_DRIVER_VERSION 0x00010110 +#define OID_GEN_MAXIMUM_TOTAL_SIZE 0x00010111 +#define OID_GEN_PROTOCOL_OPTIONS 0x00010112 +#define OID_GEN_MAC_OPTIONS 0x00010113 +#define OID_GEN_MEDIA_CONNECT_STATUS 0x00010114 +#define OID_GEN_MAXIMUM_SEND_PACKETS 0x00010115 +#define OID_GEN_VENDOR_DRIVER_VERSION 0x00010116 +#define OID_GEN_XMIT_OK 0x00020101 +#define OID_GEN_RCV_OK 0x00020102 +#define OID_GEN_XMIT_ERROR 0x00020103 +#define OID_GEN_RCV_ERROR 0x00020104 +#define OID_GEN_RCV_NO_BUFFER 0x00020105 +#define OID_GEN_DIRECTED_BYTES_XMIT 0x00020201 +#define OID_GEN_DIRECTED_FRAMES_XMIT 0x00020202 +#define OID_GEN_MULTICAST_BYTES_XMIT 0x00020203 +#define OID_GEN_MULTICAST_FRAMES_XMIT 0x00020204 +#define OID_GEN_BROADCAST_BYTES_XMIT 0x00020205 +#define OID_GEN_BROADCAST_FRAMES_XMIT 0x00020206 +#define OID_GEN_DIRECTED_BYTES_RCV 0x00020207 +#define OID_GEN_DIRECTED_FRAMES_RCV 0x00020208 +#define OID_GEN_MULTICAST_BYTES_RCV 0x00020209 +#define OID_GEN_MULTICAST_FRAMES_RCV 0x0002020A +#define OID_GEN_BROADCAST_BYTES_RCV 0x0002020B +#define OID_GEN_BROADCAST_FRAMES_RCV 0x0002020C +#define OID_GEN_RCV_CRC_ERROR 0x0002020D +#define OID_GEN_TRANSMIT_QUEUE_LENGTH 0x0002020E +#define OID_GEN_GET_TIME_CAPS 0x0002020F +#define OID_GEN_GET_NETCARD_TIME 0x00020210 +// +// These are connection-oriented general OIDs. +// These replace the above OIDs for connection-oriented media. +// +#define OID_GEN_CO_SUPPORTED_LIST 0x00010101 +#define OID_GEN_CO_HARDWARE_STATUS 0x00010102 +#define OID_GEN_CO_MEDIA_SUPPORTED 0x00010103 +#define OID_GEN_CO_MEDIA_IN_USE 0x00010104 +#define OID_GEN_CO_LINK_SPEED 0x00010105 +#define OID_GEN_CO_VENDOR_ID 0x00010106 +#define OID_GEN_CO_VENDOR_DESCRIPTION 0x00010107 +#define OID_GEN_CO_DRIVER_VERSION 0x00010108 +#define OID_GEN_CO_PROTOCOL_OPTIONS 0x00010109 +#define OID_GEN_CO_MAC_OPTIONS 0x0001010A +#define OID_GEN_CO_MEDIA_CONNECT_STATUS 0x0001010B +#define OID_GEN_CO_VENDOR_DRIVER_VERSION 0x0001010C +#define OID_GEN_CO_MINIMUM_LINK_SPEED 0x0001010D +#define OID_GEN_CO_GET_TIME_CAPS 0x00010201 +#define OID_GEN_CO_GET_NETCARD_TIME 0x00010202 +// +// These are connection-oriented statistics OIDs. +// +#define OID_GEN_CO_XMIT_PDUS_OK 0x00020101 +#define OID_GEN_CO_RCV_PDUS_OK 0x00020102 +#define OID_GEN_CO_XMIT_PDUS_ERROR 0x00020103 +#define OID_GEN_CO_RCV_PDUS_ERROR 0x00020104 +#define OID_GEN_CO_RCV_PDUS_NO_BUFFER 0x00020105 +#define OID_GEN_CO_RCV_CRC_ERROR 0x00020201 +#define OID_GEN_CO_TRANSMIT_QUEUE_LENGTH 0x00020202 +#define OID_GEN_CO_BYTES_XMIT 0x00020203 +#define OID_GEN_CO_BYTES_RCV 0x00020204 +#define OID_GEN_CO_BYTES_XMIT_OUTSTANDING 0x00020205 +#define OID_GEN_CO_NETCARD_LOAD 0x00020206 +// +// These are objects for Connection-oriented media call-managers and are not +// valid for ndis drivers. Under construction. +// +#define OID_CO_ADD_PVC 0xFF000001 +#define OID_CO_DELETE_PVC 0xFF000002 +#define OID_CO_GET_CALL_INFORMATION 0xFF000003 +#define OID_CO_ADD_ADDRESS 0xFF000004 +#define OID_CO_DELETE_ADDRESS 0xFF000005 +#define OID_CO_GET_ADDRESSES 0xFF000006 +#define OID_CO_ADDRESS_CHANGE 0xFF000007 +#define OID_CO_SIGNALING_ENABLED 0xFF000008 +#define OID_CO_SIGNALING_DISABLED 0xFF000009 +// +// 802.3 Objects (Ethernet) +// +#define OID_802_3_PERMANENT_ADDRESS 0x01010101 +#define OID_802_3_CURRENT_ADDRESS 0x01010102 +#define OID_802_3_MULTICAST_LIST 0x01010103 +#define OID_802_3_MAXIMUM_LIST_SIZE 0x01010104 +#define OID_802_3_MAC_OPTIONS 0x01010105 +// +// +#define NDIS_802_3_MAC_OPTION_PRIORITY 0x00000001 +#define OID_802_3_RCV_ERROR_ALIGNMENT 0x01020101 +#define OID_802_3_XMIT_ONE_COLLISION 0x01020102 +#define OID_802_3_XMIT_MORE_COLLISIONS 0x01020103 +#define OID_802_3_XMIT_DEFERRED 0x01020201 +#define OID_802_3_XMIT_MAX_COLLISIONS 0x01020202 +#define OID_802_3_RCV_OVERRUN 0x01020203 +#define OID_802_3_XMIT_UNDERRUN 0x01020204 +#define OID_802_3_XMIT_HEARTBEAT_FAILURE 0x01020205 +#define OID_802_3_XMIT_TIMES_CRS_LOST 0x01020206 +#define OID_802_3_XMIT_LATE_COLLISIONS 0x01020207 +// +// 802.5 Objects (Token-Ring) +// +#define OID_802_5_PERMANENT_ADDRESS 0x02010101 +#define OID_802_5_CURRENT_ADDRESS 0x02010102 +#define OID_802_5_CURRENT_FUNCTIONAL 0x02010103 +#define OID_802_5_CURRENT_GROUP 0x02010104 +#define OID_802_5_LAST_OPEN_STATUS 0x02010105 +#define OID_802_5_CURRENT_RING_STATUS 0x02010106 +#define OID_802_5_CURRENT_RING_STATE 0x02010107 +#define OID_802_5_LINE_ERRORS 0x02020101 +#define OID_802_5_LOST_FRAMES 0x02020102 +#define OID_802_5_BURST_ERRORS 0x02020201 +#define OID_802_5_AC_ERRORS 0x02020202 +#define OID_802_5_ABORT_DELIMETERS 0x02020203 +#define OID_802_5_FRAME_COPIED_ERRORS 0x02020204 +#define OID_802_5_FREQUENCY_ERRORS 0x02020205 +#define OID_802_5_TOKEN_ERRORS 0x02020206 +#define OID_802_5_INTERNAL_ERRORS 0x02020207 +// +// FDDI Objects +// +#define OID_FDDI_LONG_PERMANENT_ADDR 0x03010101 +#define OID_FDDI_LONG_CURRENT_ADDR 0x03010102 +#define OID_FDDI_LONG_MULTICAST_LIST 0x03010103 +#define OID_FDDI_LONG_MAX_LIST_SIZE 0x03010104 +#define OID_FDDI_SHORT_PERMANENT_ADDR 0x03010105 +#define OID_FDDI_SHORT_CURRENT_ADDR 0x03010106 +#define OID_FDDI_SHORT_MULTICAST_LIST 0x03010107 +#define OID_FDDI_SHORT_MAX_LIST_SIZE 0x03010108 +#define OID_FDDI_ATTACHMENT_TYPE 0x03020101 +#define OID_FDDI_UPSTREAM_NODE_LONG 0x03020102 +#define OID_FDDI_DOWNSTREAM_NODE_LONG 0x03020103 +#define OID_FDDI_FRAME_ERRORS 0x03020104 +#define OID_FDDI_FRAMES_LOST 0x03020105 +#define OID_FDDI_RING_MGT_STATE 0x03020106 +#define OID_FDDI_LCT_FAILURES 0x03020107 +#define OID_FDDI_LEM_REJECTS 0x03020108 +#define OID_FDDI_LCONNECTION_STATE 0x03020109 +#define OID_FDDI_SMT_STATION_ID 0x03030201 +#define OID_FDDI_SMT_OP_VERSION_ID 0x03030202 +#define OID_FDDI_SMT_HI_VERSION_ID 0x03030203 +#define OID_FDDI_SMT_LO_VERSION_ID 0x03030204 +#define OID_FDDI_SMT_MANUFACTURER_DATA 0x03030205 +#define OID_FDDI_SMT_USER_DATA 0x03030206 +#define OID_FDDI_SMT_MIB_VERSION_ID 0x03030207 +#define OID_FDDI_SMT_MAC_CT 0x03030208 +#define OID_FDDI_SMT_NON_MASTER_CT 0x03030209 +#define OID_FDDI_SMT_MASTER_CT 0x0303020A +#define OID_FDDI_SMT_AVAILABLE_PATHS 0x0303020B +#define OID_FDDI_SMT_CONFIG_CAPABILITIES 0x0303020C +#define OID_FDDI_SMT_CONFIG_POLICY 0x0303020D +#define OID_FDDI_SMT_CONNECTION_POLICY 0x0303020E +#define OID_FDDI_SMT_T_NOTIFY 0x0303020F +#define OID_FDDI_SMT_STAT_RPT_POLICY 0x03030210 +#define OID_FDDI_SMT_TRACE_MAX_EXPIRATION 0x03030211 +#define OID_FDDI_SMT_PORT_INDEXES 0x03030212 +#define OID_FDDI_SMT_MAC_INDEXES 0x03030213 +#define OID_FDDI_SMT_BYPASS_PRESENT 0x03030214 +#define OID_FDDI_SMT_ECM_STATE 0x03030215 +#define OID_FDDI_SMT_CF_STATE 0x03030216 +#define OID_FDDI_SMT_HOLD_STATE 0x03030217 +#define OID_FDDI_SMT_REMOTE_DISCONNECT_FLAG 0x03030218 +#define OID_FDDI_SMT_STATION_STATUS 0x03030219 +#define OID_FDDI_SMT_PEER_WRAP_FLAG 0x0303021A +#define OID_FDDI_SMT_MSG_TIME_STAMP 0x0303021B +#define OID_FDDI_SMT_TRANSITION_TIME_STAMP 0x0303021C +#define OID_FDDI_SMT_SET_COUNT 0x0303021D +#define OID_FDDI_SMT_LAST_SET_STATION_ID 0x0303021E +#define OID_FDDI_MAC_FRAME_STATUS_FUNCTIONS 0x0303021F +#define OID_FDDI_MAC_BRIDGE_FUNCTIONS 0x03030220 +#define OID_FDDI_MAC_T_MAX_CAPABILITY 0x03030221 +#define OID_FDDI_MAC_TVX_CAPABILITY 0x03030222 +#define OID_FDDI_MAC_AVAILABLE_PATHS 0x03030223 +#define OID_FDDI_MAC_CURRENT_PATH 0x03030224 +#define OID_FDDI_MAC_UPSTREAM_NBR 0x03030225 +#define OID_FDDI_MAC_DOWNSTREAM_NBR 0x03030226 +#define OID_FDDI_MAC_OLD_UPSTREAM_NBR 0x03030227 +#define OID_FDDI_MAC_OLD_DOWNSTREAM_NBR 0x03030228 +#define OID_FDDI_MAC_DUP_ADDRESS_TEST 0x03030229 +#define OID_FDDI_MAC_REQUESTED_PATHS 0x0303022A +#define OID_FDDI_MAC_DOWNSTREAM_PORT_TYPE 0x0303022B +#define OID_FDDI_MAC_INDEX 0x0303022C +#define OID_FDDI_MAC_SMT_ADDRESS 0x0303022D +#define OID_FDDI_MAC_LONG_GRP_ADDRESS 0x0303022E +#define OID_FDDI_MAC_SHORT_GRP_ADDRESS 0x0303022F +#define OID_FDDI_MAC_T_REQ 0x03030230 +#define OID_FDDI_MAC_T_NEG 0x03030231 +#define OID_FDDI_MAC_T_MAX 0x03030232 +#define OID_FDDI_MAC_TVX_VALUE 0x03030233 +#define OID_FDDI_MAC_T_PRI0 0x03030234 +#define OID_FDDI_MAC_T_PRI1 0x03030235 +#define OID_FDDI_MAC_T_PRI2 0x03030236 +#define OID_FDDI_MAC_T_PRI3 0x03030237 +#define OID_FDDI_MAC_T_PRI4 0x03030238 +#define OID_FDDI_MAC_T_PRI5 0x03030239 +#define OID_FDDI_MAC_T_PRI6 0x0303023A +#define OID_FDDI_MAC_FRAME_CT 0x0303023B +#define OID_FDDI_MAC_COPIED_CT 0x0303023C +#define OID_FDDI_MAC_TRANSMIT_CT 0x0303023D +#define OID_FDDI_MAC_TOKEN_CT 0x0303023E +#define OID_FDDI_MAC_ERROR_CT 0x0303023F +#define OID_FDDI_MAC_LOST_CT 0x03030240 +#define OID_FDDI_MAC_TVX_EXPIRED_CT 0x03030241 +#define OID_FDDI_MAC_NOT_COPIED_CT 0x03030242 +#define OID_FDDI_MAC_LATE_CT 0x03030243 +#define OID_FDDI_MAC_RING_OP_CT 0x03030244 +#define OID_FDDI_MAC_FRAME_ERROR_THRESHOLD 0x03030245 +#define OID_FDDI_MAC_FRAME_ERROR_RATIO 0x03030246 +#define OID_FDDI_MAC_NOT_COPIED_THRESHOLD 0x03030247 +#define OID_FDDI_MAC_NOT_COPIED_RATIO 0x03030248 +#define OID_FDDI_MAC_RMT_STATE 0x03030249 +#define OID_FDDI_MAC_DA_FLAG 0x0303024A +#define OID_FDDI_MAC_UNDA_FLAG 0x0303024B +#define OID_FDDI_MAC_FRAME_ERROR_FLAG 0x0303024C +#define OID_FDDI_MAC_NOT_COPIED_FLAG 0x0303024D +#define OID_FDDI_MAC_MA_UNITDATA_AVAILABLE 0x0303024E +#define OID_FDDI_MAC_HARDWARE_PRESENT 0x0303024F +#define OID_FDDI_MAC_MA_UNITDATA_ENABLE 0x03030250 +#define OID_FDDI_PATH_INDEX 0x03030251 +#define OID_FDDI_PATH_RING_LATENCY 0x03030252 +#define OID_FDDI_PATH_TRACE_STATUS 0x03030253 +#define OID_FDDI_PATH_SBA_PAYLOAD 0x03030254 +#define OID_FDDI_PATH_SBA_OVERHEAD 0x03030255 +#define OID_FDDI_PATH_CONFIGURATION 0x03030256 +#define OID_FDDI_PATH_T_R_MODE 0x03030257 +#define OID_FDDI_PATH_SBA_AVAILABLE 0x03030258 +#define OID_FDDI_PATH_TVX_LOWER_BOUND 0x03030259 +#define OID_FDDI_PATH_T_MAX_LOWER_BOUND 0x0303025A +#define OID_FDDI_PATH_MAX_T_REQ 0x0303025B +#define OID_FDDI_PORT_MY_TYPE 0x0303025C +#define OID_FDDI_PORT_NEIGHBOR_TYPE 0x0303025D +#define OID_FDDI_PORT_CONNECTION_POLICIES 0x0303025E +#define OID_FDDI_PORT_MAC_INDICATED 0x0303025F +#define OID_FDDI_PORT_CURRENT_PATH 0x03030260 +#define OID_FDDI_PORT_REQUESTED_PATHS 0x03030261 +#define OID_FDDI_PORT_MAC_PLACEMENT 0x03030262 +#define OID_FDDI_PORT_AVAILABLE_PATHS 0x03030263 +#define OID_FDDI_PORT_MAC_LOOP_TIME 0x03030264 +#define OID_FDDI_PORT_PMD_CLASS 0x03030265 +#define OID_FDDI_PORT_CONNECTION_CAPABILITIES 0x03030266 +#define OID_FDDI_PORT_INDEX 0x03030267 +#define OID_FDDI_PORT_MAINT_LS 0x03030268 +#define OID_FDDI_PORT_BS_FLAG 0x03030269 +#define OID_FDDI_PORT_PC_LS 0x0303026A +#define OID_FDDI_PORT_EB_ERROR_CT 0x0303026B +#define OID_FDDI_PORT_LCT_FAIL_CT 0x0303026C +#define OID_FDDI_PORT_LER_ESTIMATE 0x0303026D +#define OID_FDDI_PORT_LEM_REJECT_CT 0x0303026E +#define OID_FDDI_PORT_LEM_CT 0x0303026F +#define OID_FDDI_PORT_LER_CUTOFF 0x03030270 +#define OID_FDDI_PORT_LER_ALARM 0x03030271 +#define OID_FDDI_PORT_CONNNECT_STATE 0x03030272 +#define OID_FDDI_PORT_PCM_STATE 0x03030273 +#define OID_FDDI_PORT_PC_WITHHOLD 0x03030274 +#define OID_FDDI_PORT_LER_FLAG 0x03030275 +#define OID_FDDI_PORT_HARDWARE_PRESENT 0x03030276 +#define OID_FDDI_SMT_STATION_ACTION 0x03030277 +#define OID_FDDI_PORT_ACTION 0x03030278 +#define OID_FDDI_IF_DESCR 0x03030279 +#define OID_FDDI_IF_TYPE 0x0303027A +#define OID_FDDI_IF_MTU 0x0303027B +#define OID_FDDI_IF_SPEED 0x0303027C +#define OID_FDDI_IF_PHYS_ADDRESS 0x0303027D +#define OID_FDDI_IF_ADMIN_STATUS 0x0303027E +#define OID_FDDI_IF_OPER_STATUS 0x0303027F +#define OID_FDDI_IF_LAST_CHANGE 0x03030280 +#define OID_FDDI_IF_IN_OCTETS 0x03030281 +#define OID_FDDI_IF_IN_UCAST_PKTS 0x03030282 +#define OID_FDDI_IF_IN_NUCAST_PKTS 0x03030283 +#define OID_FDDI_IF_IN_DISCARDS 0x03030284 +#define OID_FDDI_IF_IN_ERRORS 0x03030285 +#define OID_FDDI_IF_IN_UNKNOWN_PROTOS 0x03030286 +#define OID_FDDI_IF_OUT_OCTETS 0x03030287 +#define OID_FDDI_IF_OUT_UCAST_PKTS 0x03030288 +#define OID_FDDI_IF_OUT_NUCAST_PKTS 0x03030289 +#define OID_FDDI_IF_OUT_DISCARDS 0x0303028A +#define OID_FDDI_IF_OUT_ERRORS 0x0303028B +#define OID_FDDI_IF_OUT_QLEN 0x0303028C +#define OID_FDDI_IF_SPECIFIC 0x0303028D +// +// WAN objects +// +#define OID_WAN_PERMANENT_ADDRESS 0x04010101 +#define OID_WAN_CURRENT_ADDRESS 0x04010102 +#define OID_WAN_QUALITY_OF_SERVICE 0x04010103 +#define OID_WAN_PROTOCOL_TYPE 0x04010104 +#define OID_WAN_MEDIUM_SUBTYPE 0x04010105 +#define OID_WAN_HEADER_FORMAT 0x04010106 +#define OID_WAN_GET_INFO 0x04010107 +#define OID_WAN_SET_LINK_INFO 0x04010108 +#define OID_WAN_GET_LINK_INFO 0x04010109 +#define OID_WAN_LINE_COUNT 0x0401010A +#define OID_WAN_GET_BRIDGE_INFO 0x0401020A +#define OID_WAN_SET_BRIDGE_INFO 0x0401020B +#define OID_WAN_GET_COMP_INFO 0x0401020C +#define OID_WAN_SET_COMP_INFO 0x0401020D +#define OID_WAN_GET_STATS_INFO 0x0401020E +// +// LocalTalk objects +// +#define OID_LTALK_CURRENT_NODE_ID 0x05010102 +#define OID_LTALK_IN_BROADCASTS 0x05020101 +#define OID_LTALK_IN_LENGTH_ERRORS 0x05020102 +#define OID_LTALK_OUT_NO_HANDLERS 0x05020201 +#define OID_LTALK_COLLISIONS 0x05020202 +#define OID_LTALK_DEFERS 0x05020203 +#define OID_LTALK_NO_DATA_ERRORS 0x05020204 +#define OID_LTALK_RANDOM_CTS_ERRORS 0x05020205 +#define OID_LTALK_FCS_ERRORS 0x05020206 +// +// Arcnet objects +// +#define OID_ARCNET_PERMANENT_ADDRESS 0x06010101 +#define OID_ARCNET_CURRENT_ADDRESS 0x06010102 +#define OID_ARCNET_RECONFIGURATIONS 0x06020201 +// +// TAPI objects +// +#define OID_TAPI_ACCEPT 0x07030101 +#define OID_TAPI_ANSWER 0x07030102 +#define OID_TAPI_CLOSE 0x07030103 +#define OID_TAPI_CLOSE_CALL 0x07030104 +#define OID_TAPI_CONDITIONAL_MEDIA_DETECTION 0x07030105 +#define OID_TAPI_CONFIG_DIALOG 0x07030106 +#define OID_TAPI_DEV_SPECIFIC 0x07030107 +#define OID_TAPI_DIAL 0x07030108 +#define OID_TAPI_DROP 0x07030109 +#define OID_TAPI_GET_ADDRESS_CAPS 0x0703010A +#define OID_TAPI_GET_ADDRESS_ID 0x0703010B +#define OID_TAPI_GET_ADDRESS_STATUS 0x0703010C +#define OID_TAPI_GET_CALL_ADDRESS_ID 0x0703010D +#define OID_TAPI_GET_CALL_INFO 0x0703010E +#define OID_TAPI_GET_CALL_STATUS 0x0703010F +#define OID_TAPI_GET_DEV_CAPS 0x07030110 +#define OID_TAPI_GET_DEV_CONFIG 0x07030111 +#define OID_TAPI_GET_EXTENSION_ID 0x07030112 +#define OID_TAPI_GET_ID 0x07030113 +#define OID_TAPI_GET_LINE_DEV_STATUS 0x07030114 +#define OID_TAPI_MAKE_CALL 0x07030115 +#define OID_TAPI_NEGOTIATE_EXT_VERSION 0x07030116 +#define OID_TAPI_OPEN 0x07030117 +#define OID_TAPI_PROVIDER_INITIALIZE 0x07030118 +#define OID_TAPI_PROVIDER_SHUTDOWN 0x07030119 +#define OID_TAPI_SECURE_CALL 0x0703011A +#define OID_TAPI_SELECT_EXT_VERSION 0x0703011B +#define OID_TAPI_SEND_USER_USER_INFO 0x0703011C +#define OID_TAPI_SET_APP_SPECIFIC 0x0703011D +#define OID_TAPI_SET_CALL_PARAMS 0x0703011E +#define OID_TAPI_SET_DEFAULT_MEDIA_DETECTION 0x0703011F +#define OID_TAPI_SET_DEV_CONFIG 0x07030120 +#define OID_TAPI_SET_MEDIA_MODE 0x07030121 +#define OID_TAPI_SET_STATUS_MESSAGES 0x07030122 +// +// ATM Connection Oriented Ndis +// +#define OID_ATM_SUPPORTED_VC_RATES 0x08010101 +#define OID_ATM_SUPPORTED_SERVICE_CATEGORY 0x08010102 +#define OID_ATM_SUPPORTED_AAL_TYPES 0x08010103 +#define OID_ATM_HW_CURRENT_ADDRESS 0x08010104 +#define OID_ATM_MAX_ACTIVE_VCS 0x08010105 +#define OID_ATM_MAX_ACTIVE_VCI_BITS 0x08010106 +#define OID_ATM_MAX_ACTIVE_VPI_BITS 0x08010107 +#define OID_ATM_MAX_AAL0_PACKET_SIZE 0x08010108 +#define OID_ATM_MAX_AAL1_PACKET_SIZE 0x08010109 +#define OID_ATM_MAX_AAL34_PACKET_SIZE 0x0801010A +#define OID_ATM_MAX_AAL5_PACKET_SIZE 0x0801010B +#define OID_ATM_SIGNALING_VPIVCI 0x08010201 +#define OID_ATM_ASSIGNED_VPI 0x08010202 +#define OID_ATM_ACQUIRE_ACCESS_NET_RESOURCES 0x08010203 +#define OID_ATM_RELEASE_ACCESS_NET_RESOURCES 0x08010204 +#define OID_ATM_ILMI_VPIVCI 0x08010205 +#define OID_ATM_DIGITAL_BROADCAST_VPIVCI 0x08010206 +#define OID_ATM_GET_NEAREST_FLOW 0x08010207 +#define OID_ATM_ALIGNMENT_REQUIRED 0x08010208 +// +// ATM specific statistics OIDs. +// +#define OID_ATM_RCV_CELLS_OK 0x08020101 +#define OID_ATM_XMIT_CELLS_OK 0x08020102 +#define OID_ATM_RCV_CELLS_DROPPED 0x08020103 +#define OID_ATM_RCV_INVALID_VPI_VCI 0x08020201 +#define OID_ATM_CELLS_HEC_ERROR 0x08020202 +#define OID_ATM_RCV_REASSEMBLY_ERROR 0x08020203 +// +// PCCA (Wireless) object +// +// +// All WirelessWAN devices must support the following OIDs +// +#define OID_WW_GEN_NETWORK_TYPES_SUPPORTED 0x09010101 +#define OID_WW_GEN_NETWORK_TYPE_IN_USE 0x09010102 +#define OID_WW_GEN_HEADER_FORMATS_SUPPORTED 0x09010103 +#define OID_WW_GEN_HEADER_FORMAT_IN_USE 0x09010104 +#define OID_WW_GEN_INDICATION_REQUEST 0x09010105 +#define OID_WW_GEN_DEVICE_INFO 0x09010106 +#define OID_WW_GEN_OPERATION_MODE 0x09010107 +#define OID_WW_GEN_LOCK_STATUS 0x09010108 +#define OID_WW_GEN_DISABLE_TRANSMITTER 0x09010109 +#define OID_WW_GEN_NETWORK_ID 0x0901010A +#define OID_WW_GEN_PERMANENT_ADDRESS 0x0901010B +#define OID_WW_GEN_CURRENT_ADDRESS 0x0901010C +#define OID_WW_GEN_SUSPEND_DRIVER 0x0901010D +#define OID_WW_GEN_BASESTATION_ID 0x0901010E +#define OID_WW_GEN_CHANNEL_ID 0x0901010F +#define OID_WW_GEN_ENCRYPTION_SUPPORTED 0x09010110 +#define OID_WW_GEN_ENCRYPTION_IN_USE 0x09010111 +#define OID_WW_GEN_ENCRYPTION_STATE 0x09010112 +#define OID_WW_GEN_CHANNEL_QUALITY 0x09010113 +#define OID_WW_GEN_REGISTRATION_STATUS 0x09010114 +#define OID_WW_GEN_RADIO_LINK_SPEED 0x09010115 +#define OID_WW_GEN_LATENCY 0x09010116 +#define OID_WW_GEN_BATTERY_LEVEL 0x09010117 +#define OID_WW_GEN_EXTERNAL_POWER 0x09010118 +// +// Network Dependent OIDs - Mobitex: +// +#define OID_WW_MBX_SUBADDR 0x09050101 +// OID 0x09050102 is reserved and may not be used +#define OID_WW_MBX_FLEXLIST 0x09050103 +#define OID_WW_MBX_GROUPLIST 0x09050104 +#define OID_WW_MBX_TRAFFIC_AREA 0x09050105 +#define OID_WW_MBX_LIVE_DIE 0x09050106 +#define OID_WW_MBX_TEMP_DEFAULTLIST 0x09050107 +// +// Network Dependent OIDs - Pinpoint: +// +#define OID_WW_PIN_LOC_AUTHORIZE 0x09090101 +#define OID_WW_PIN_LAST_LOCATION 0x09090102 +#define OID_WW_PIN_LOC_FIX 0x09090103 +// +// Network Dependent - CDPD: +// +#define OID_WW_CDPD_SPNI 0x090D0101 +#define OID_WW_CDPD_WASI 0x090D0102 +#define OID_WW_CDPD_AREA_COLOR 0x090D0103 +#define OID_WW_CDPD_TX_POWER_LEVEL 0x090D0104 +#define OID_WW_CDPD_EID 0x090D0105 +#define OID_WW_CDPD_HEADER_COMPRESSION 0x090D0106 +#define OID_WW_CDPD_DATA_COMPRESSION 0x090D0107 +#define OID_WW_CDPD_CHANNEL_SELECT 0x090D0108 +#define OID_WW_CDPD_CHANNEL_STATE 0x090D0109 +#define OID_WW_CDPD_NEI 0x090D010A +#define OID_WW_CDPD_NEI_STATE 0x090D010B +#define OID_WW_CDPD_SERVICE_PROVIDER_IDENTIFIER 0x090D010C +#define OID_WW_CDPD_SLEEP_MODE 0x090D010D +#define OID_WW_CDPD_CIRCUIT_SWITCHED 0x090D010E +#define OID_WW_CDPD_TEI 0x090D010F +#define OID_WW_CDPD_RSSI 0x090D0110 +// +// Network Dependent - Ardis: +// +#define OID_WW_ARD_SNDCP 0x09110101 +#define OID_WW_ARD_TMLY_MSG 0x09110102 +#define OID_WW_ARD_DATAGRAM 0x09110103 +// +// Network Dependent - DataTac: +// +#define OID_WW_TAC_COMPRESSION 0x09150101 +#define OID_WW_TAC_SET_CONFIG 0x09150102 +#define OID_WW_TAC_GET_STATUS 0x09150103 +#define OID_WW_TAC_USER_HEADER 0x09150104 +// +// Network Dependent - Metricom: +// +#define OID_WW_MET_FUNCTION 0x09190101 +// +// IRDA objects +// +#define OID_IRDA_RECEIVING 0x0A010100 +#define OID_IRDA_TURNAROUND_TIME 0x0A010101 +#define OID_IRDA_SUPPORTED_SPEEDS 0x0A010102 +#define OID_IRDA_LINK_SPEED 0x0A010103 +#define OID_IRDA_MEDIA_BUSY 0x0A010104 +#define OID_IRDA_EXTRA_RCV_BOFS 0x0A010200 +#define OID_IRDA_RATE_SNIFF 0x0A010201 +#define OID_IRDA_UNICAST_LIST 0x0A010202 +#define OID_IRDA_MAX_UNICAST_LIST_SIZE 0x0A010203 +#define OID_IRDA_MAX_RECEIVE_WINDOW_SIZE 0x0A010204 +#define OID_IRDA_MAX_SEND_WINDOW_SIZE 0x0A010205 +// +// Medium the Ndis Driver is running on (OID_GEN_MEDIA_SUPPORTED/ +// OID_GEN_MEDIA_IN_USE). +// +typedef enum _NDIS_MEDIUM { + NdisMedium802_3, + NdisMedium802_5, + NdisMediumFddi, + NdisMediumWan, + NdisMediumLocalTalk, + NdisMediumDix, // defined for convenience, not a real medium + NdisMediumArcnetRaw, + NdisMediumArcnet878_2, + NdisMediumAtm, + NdisMediumWirelessWan, + NdisMediumIrda, + NdisMediumMax // Not a real medium, defined as an upper-bound +} NDIS_MEDIUM, *PNDIS_MEDIUM; + +// +// Hardware status codes (OID_GEN_HARDWARE_STATUS). +// +typedef enum _NDIS_HARDWARE_STATUS { + NdisHardwareStatusReady, + NdisHardwareStatusInitializing, + NdisHardwareStatusReset, + NdisHardwareStatusClosing, + NdisHardwareStatusNotReady +} NDIS_HARDWARE_STATUS, *PNDIS_HARDWARE_STATUS; + +// +// this is the type passed in the OID_GEN_GET_TIME_CAPS request +// +typedef struct _GEN_GET_TIME_CAPS { + ULONG Flags; // Bits defined below + + ULONG ClockPrecision; +} GEN_GET_TIME_CAPS, *PGEN_GET_TIME_CAPS; + +#define READABLE_LOCAL_CLOCK 0x000000001 +#define CLOCK_NETWORK_DERIVED 0x000000002 +#define CLOCK_PRECISION 0x000000004 +#define RECEIVE_TIME_INDICATION_CAPABLE 0x000000008 +#define TIMED_SEND_CAPABLE 0x000000010 +#define TIME_STAMP_CAPABLE 0x000000020 +// +// +// this is the type passed in the OID_GEN_GET_NETCARD_TIME request +// +typedef struct _GEN_GET_NETCARD_TIME { + ULONG ReadTime; +} GEN_GET_NETCARD_TIME, *PGEN_GET_NETCARD_TIME; + +// +// Defines the attachment types for FDDI (OID_FDDI_ATTACHMENT_TYPE). +// +typedef enum _NDIS_FDDI_ATTACHMENT_TYPE { + NdisFddiTypeIsolated = 1, + NdisFddiTypeLocalA, + NdisFddiTypeLocalB, + NdisFddiTypeLocalAB, + NdisFddiTypeLocalS, + NdisFddiTypeWrapA, + NdisFddiTypeWrapB, + NdisFddiTypeWrapAB, + NdisFddiTypeWrapS, + NdisFddiTypeCWrapA, + NdisFddiTypeCWrapB, + NdisFddiTypeCWrapS, + NdisFddiTypeThrough +} NDIS_FDDI_ATTACHMENT_TYPE, *PNDIS_FDDI_ATTACHMENT_TYPE; + +// +// Defines the ring management states for FDDI (OID_FDDI_RING_MGT_STATE). +// +typedef enum _NDIS_FDDI_RING_MGT_STATE { + NdisFddiRingIsolated = 1, + NdisFddiRingNonOperational, + NdisFddiRingOperational, + NdisFddiRingDetect, + NdisFddiRingNonOperationalDup, + NdisFddiRingOperationalDup, + NdisFddiRingDirected, + NdisFddiRingTrace +} NDIS_FDDI_RING_MGT_STATE, *PNDIS_FDDI_RING_MGT_STATE; + +// +// Defines the Lconnection state for FDDI (OID_FDDI_LCONNECTION_STATE). +// +typedef enum _NDIS_FDDI_LCONNECTION_STATE { + NdisFddiStateOff = 1, + NdisFddiStateBreak, + NdisFddiStateTrace, + NdisFddiStateConnect, + NdisFddiStateNext, + NdisFddiStateSignal, + NdisFddiStateJoin, + NdisFddiStateVerify, + NdisFddiStateActive, + NdisFddiStateMaintenance +} NDIS_FDDI_LCONNECTION_STATE, *PNDIS_FDDI_LCONNECTION_STATE; + +// +// Defines the medium subtypes for WAN medium (OID_WAN_MEDIUM_SUBTYPE). +// +typedef enum _NDIS_WAN_MEDIUM_SUBTYPE { + NdisWanMediumHub, + NdisWanMediumX_25, + NdisWanMediumIsdn, + NdisWanMediumSerial, + NdisWanMediumFrameRelay, + NdisWanMediumAtm, + NdisWanMediumSonet, + NdisWanMediumSW56K +} NDIS_WAN_MEDIUM_SUBTYPE, *PNDIS_WAN_MEDIUM_SUBTYPE; + +// +// Defines the header format for WAN medium (OID_WAN_HEADER_FORMAT). +// +typedef enum _NDIS_WAN_HEADER_FORMAT { + NdisWanHeaderNative, // src/dest based on subtype, followed by NLPID + NdisWanHeaderEthernet // emulation of ethernet header +} NDIS_WAN_HEADER_FORMAT, *PNDIS_WAN_HEADER_FORMAT; + +// +// Defines the line quality on a WAN line (OID_WAN_QUALITY_OF_SERVICE). +// +typedef enum _NDIS_WAN_QUALITY { + NdisWanRaw, + NdisWanErrorControl, + NdisWanReliable +} NDIS_WAN_QUALITY, *PNDIS_WAN_QUALITY; + +// +// Defines the state of a token-ring adapter (OID_802_5_CURRENT_RING_STATE). +// +typedef enum _NDIS_802_5_RING_STATE { + NdisRingStateOpened = 1, + NdisRingStateClosed, + NdisRingStateOpening, + NdisRingStateClosing, + NdisRingStateOpenFailure, + NdisRingStateRingFailure +} NDIS_802_5_RING_STATE, *PNDIS_802_5_RING_STATE; + +// +// Defines the state of the LAN media +// +typedef enum _NDIS_MEDIA_STATE { + NdisMediaStateConnected, + NdisMediaStateDisconnected +} NDIS_MEDIA_STATE, *PNDIS_MEDIA_STATE; + +// +// The following is set on a per-packet basis as OOB data with NdisClass802_3Priority +// +typedef ULONG Priority_802_3; // 0-7 priority levels +// +// The following structure is used to query OID_GEN_CO_LINK_SPEED and +// OID_GEN_CO_MINIMUM_LINK_SPEED. The first OID will return the current +// link speed of the adapter. The second will return the minimum link speed +// the adapter is capable of. +// + +typedef struct _NDIS_CO_LINK_SPEED { + ULONG Outbound; + ULONG Inbound; +} NDIS_CO_LINK_SPEED, + +*PNDIS_CO_LINK_SPEED; +// +// Ndis Packet Filter Bits (OID_GEN_CURRENT_PACKET_FILTER). +// +#define NDIS_PACKET_TYPE_DIRECTED 0x0001 +#define NDIS_PACKET_TYPE_MULTICAST 0x0002 +#define NDIS_PACKET_TYPE_ALL_MULTICAST 0x0004 +#define NDIS_PACKET_TYPE_BROADCAST 0x0008 +#define NDIS_PACKET_TYPE_SOURCE_ROUTING 0x0010 +#define NDIS_PACKET_TYPE_PROMISCUOUS 0x0020 +#define NDIS_PACKET_TYPE_SMT 0x0040 +#define NDIS_PACKET_TYPE_ALL_LOCAL 0x0080 +#define NDIS_PACKET_TYPE_MAC_FRAME 0x8000 +#define NDIS_PACKET_TYPE_FUNCTIONAL 0x4000 +#define NDIS_PACKET_TYPE_ALL_FUNCTIONAL 0x2000 +#define NDIS_PACKET_TYPE_GROUP 0x1000 +// +// Ndis Token-Ring Ring Status Codes (OID_802_5_CURRENT_RING_STATUS). +// +#define NDIS_RING_SIGNAL_LOSS 0x00008000 +#define NDIS_RING_HARD_ERROR 0x00004000 +#define NDIS_RING_SOFT_ERROR 0x00002000 +#define NDIS_RING_TRANSMIT_BEACON 0x00001000 +#define NDIS_RING_LOBE_WIRE_FAULT 0x00000800 +#define NDIS_RING_AUTO_REMOVAL_ERROR 0x00000400 +#define NDIS_RING_REMOVE_RECEIVED 0x00000200 +#define NDIS_RING_COUNTER_OVERFLOW 0x00000100 +#define NDIS_RING_SINGLE_STATION 0x00000080 +#define NDIS_RING_RING_RECOVERY 0x00000040 +// +// Ndis protocol option bits (OID_GEN_PROTOCOL_OPTIONS). +// +#define NDIS_PROT_OPTION_ESTIMATED_LENGTH 0x00000001 +#define NDIS_PROT_OPTION_NO_LOOPBACK 0x00000002 +#define NDIS_PROT_OPTION_NO_RSVD_ON_RCVPKT 0x00000004 +// +// Ndis MAC option bits (OID_GEN_MAC_OPTIONS). +// +#define NDIS_MAC_OPTION_COPY_LOOKAHEAD_DATA 0x00000001 +#define NDIS_MAC_OPTION_RECEIVE_SERIALIZED 0x00000002 +#define NDIS_MAC_OPTION_TRANSFERS_NOT_PEND 0x00000004 +#define NDIS_MAC_OPTION_NO_LOOPBACK 0x00000008 +#define NDIS_MAC_OPTION_FULL_DUPLEX 0x00000010 +#define NDIS_MAC_OPTION_EOTX_INDICATION 0x00000020 +#define NDIS_MAC_OPTION_RESERVED 0x80000000 +// +// NDIS MAC option bits for OID_GEN_CO_MAC_OPTIONS. +// +#define NDIS_CO_MAC_OPTION_DYNAMIC_LINK_SPEED 0x00000001 +#ifdef IRDA +// +// The following is set on a per-packet basis as OOB data with NdisClassIrdaPacketInfo +// This is the per-packet info specified on a per-packet basis +// +typedef struct _NDIS_IRDA_PACKET_INFO { + UINT ExtraBOFs; + UINT MinTurnAroundTime; +} NDIS_IRDA_PACKET_INFO, *PNDIS_IRDA_PACKET_INFO; + +#endif +#ifdef WIRELESS_WAN +// +// Wireless WAN structure definitions +// +// +// currently defined Wireless network subtypes +// +typedef enum _NDIS_WW_NETWORK_TYPE { + NdisWWGeneric, + NdisWWMobitex, + NdisWWPinpoint, + NdisWWCDPD, + NdisWWArdis, + NdisWWDataTAC, + NdisWWMetricom, + NdisWWGSM, + NdisWWCDMA, + NdisWWTDMA, + NdisWWAMPS, + NdisWWInmarsat, + NdisWWpACT +} NDIS_WW_NETWORK_TYPE; + +// +// currently defined header formats +// +typedef enum _NDIS_WW_HEADER_FORMAT { + NdisWWDIXEthernetFrames, + NdisWWMPAKFrames, + NdisWWRDLAPFrames, + NdisWWMDC4800Frames +} NDIS_WW_HEADER_FORMAT; + +// +// currently defined encryption types +// +typedef enum _NDIS_WW_ENCRYPTION_TYPE { + NdisWWUnknownEncryption = -1, + NdisWWNoEncryption, + NdisWWDefaultEncryption +} NDIS_WW_ENCRYPTION_TYPE, *PNDIS_WW_ENCRYPTION_TYPE; + +// +// OID_WW_GEN_INDICATION_REQUEST +// +typedef struct _NDIS_WW_INDICATION_REQUEST { + NDIS_OID Oid; // IN + + UINT uIndicationFlag; // IN + + UINT uApplicationToken; // IN OUT + + HANDLE hIndicationHandle; // IN OUT + + INT iPollingInterval; // IN OUT + + NDIS_VAR_DATA_DESC InitialValue; // IN OUT + + NDIS_VAR_DATA_DESC OIDIndicationValue; // OUT - only valid after indication + + NDIS_VAR_DATA_DESC TriggerValue; // IN + +} NDIS_WW_INDICATION_REQUEST, *PNDIS_WW_INDICATION_REQUEST; + +#define OID_INDICATION_REQUEST_ENABLE 0x0000 +#define OID_INDICATION_REQUEST_CANCEL 0x0001 +// +// OID_WW_GEN_DEVICE_INFO +// +typedef struct _WW_DEVICE_INFO { + NDIS_VAR_DATA_DESC Manufacturer; + NDIS_VAR_DATA_DESC ModelNum; + NDIS_VAR_DATA_DESC SWVersionNum; + NDIS_VAR_DATA_DESC SerialNum; +} WW_DEVICE_INFO, *PWW_DEVICE_INFO; + +// +// OID_WW_GEN_OPERATION_MODE +// +typedef INT WW_OPERATION_MODE; // 0 = Normal mode + // 1 = Power saving mode + // -1 = mode unknown +// +// OID_WW_GEN_LOCK_STATUS +// + +typedef INT WW_LOCK_STATUS; // 0 = unlocked + // 1 = locked + // -1 = unknown lock status +// +// OID_WW_GEN_DISABLE_TRANSMITTER +// + +typedef INT WW_DISABLE_TRANSMITTER; // 0 = transmitter enabled + // 1 = transmitter disabled + // -1 = unknown value +// +// OID_WW_GEN_NETWORK_ID +// + +typedef NDIS_VAR_DATA_DESC WW_NETWORK_ID; +// +// OID_WW_GEN_PERMANENT_ADDRESS +// +typedef NDIS_VAR_DATA_DESC WW_PERMANENT_ADDRESS; +// +// OID_WW_GEN_CURRENT_ADDRESS +// +typedef struct _WW_CURRENT_ADDRESS { + NDIS_WW_HEADER_FORMAT Format; + NDIS_VAR_DATA_DESC Address; +} WW_CURRENT_ADDRESS, *PWW_CURRENT_ADDRESS; + +// +// OID_WW_GEN_SUSPEND_DRIVER +// +typedef BOOLEAN WW_SUSPEND_DRIVER; // 0 = driver operational + // 1 = driver suspended +// +// OID_WW_GEN_BASESTATION_ID +// + +typedef NDIS_VAR_DATA_DESC WW_BASESTATION_ID; +// +// OID_WW_GEN_CHANNEL_ID +// +typedef NDIS_VAR_DATA_DESC WW_CHANNEL_ID; +// +// OID_WW_GEN_ENCRYPTION_STATE +// +typedef BOOLEAN WW_ENCRYPTION_STATE; // 0 = if encryption is disabled + // 1 = if encryption is enabled +// +// OID_WW_GEN_CHANNEL_QUALITY +// + +typedef INT WW_CHANNEL_QUALITY; // 0 = Not in network contact, + // 1-100 = Quality of Channel (100 is highest quality). + // -1 = channel quality is unknown +// +// OID_WW_GEN_REGISTRATION_STATUS +// + +typedef INT WW_REGISTRATION_STATUS; // 0 = Registration denied + // 1 = Registration pending + // 2 = Registered + // -1 = unknown registration status +// +// OID_WW_GEN_RADIO_LINK_SPEED +// + +typedef UINT WW_RADIO_LINK_SPEED; // Bits per second. +// +// OID_WW_GEN_LATENCY +// + +typedef UINT WW_LATENCY; // milliseconds +// +// OID_WW_GEN_BATTERY_LEVEL +// + +typedef INT WW_BATTERY_LEVEL; // 0-100 = battery level in percentage + // (100=fully charged) + // -1 = unknown battery level. +// +// OID_WW_GEN_EXTERNAL_POWER +// + +typedef INT WW_EXTERNAL_POWER; // 0 = no external power connected + // 1 = external power connected + // -1 = unknown +// +// OID_WW_MET_FUNCTION +// + +typedef NDIS_VAR_DATA_DESC WW_MET_FUNCTION; +// +// OID_WW_TAC_COMPRESSION +// +typedef BOOLEAN WW_TAC_COMPRESSION; // Determines whether or not network level compression + // is being used. +// +// OID_WW_TAC_SET_CONFIG +// + +typedef struct _WW_TAC_SETCONFIG { + NDIS_VAR_DATA_DESC RCV_MODE; + NDIS_VAR_DATA_DESC TX_CONTROL; + NDIS_VAR_DATA_DESC RX_CONTROL; + NDIS_VAR_DATA_DESC FLOW_CONTROL; + NDIS_VAR_DATA_DESC RESET_CNF; + NDIS_VAR_DATA_DESC READ_CNF; +} WW_TAC_SETCONFIG, *PWW_TAC_SETCONFIG; + +// +// OID_WW_TAC_GET_STATUS +// +typedef struct _WW_TAC_GETSTATUS { + BOOLEAN Action; // Set = Execute command. + + NDIS_VAR_DATA_DESC Command; + NDIS_VAR_DATA_DESC Option; + NDIS_VAR_DATA_DESC Response; // The response to the requested command + // - max. length of string is 256 octets. + +} WW_TAC_GETSTATUS, *PWW_TAC_GETSTATUS; + +// +// OID_WW_TAC_USER_HEADER +// +typedef NDIS_VAR_DATA_DESC WW_TAC_USERHEADER; // This will hold the user header - Max. 64 octets. +// +// OID_WW_ARD_SNDCP +// + +typedef struct _WW_ARD_SNDCP { + NDIS_VAR_DATA_DESC Version; // The version of SNDCP protocol supported. + + INT BlockSize; // The block size used for SNDCP + + INT Window; // The window size used in SNDCP + +} WW_ARD_SNDCP, *PWW_ARD_SNDCP; + +// +// OID_WW_ARD_TMLY_MSG +// +typedef BOOLEAN WW_ARD_CHANNEL_STATUS; // The current status of the inbound RF Channel. +// +// OID_WW_ARD_DATAGRAM +// + +typedef struct _WW_ARD_DATAGRAM { + BOOLEAN LoadLevel; // Byte that contains the load level info. + + INT SessionTime; // Datagram session time remaining. + + NDIS_VAR_DATA_DESC HostAddr; // Host address. + + NDIS_VAR_DATA_DESC THostAddr; // Test host address. + +} WW_ARD_DATAGRAM, *PWW_ARD_DATAGRAM; + +// +// OID_WW_CDPD_SPNI +// +typedef struct _WW_CDPD_SPNI { + UINT SPNI[10]; //10 16-bit service provider network IDs + + INT OperatingMode; // 0 = ignore SPNI, + // 1 = require SPNI from list, + // 2 = prefer SPNI from list. + // 3 = exclude SPNI from list. + +} WW_CDPD_SPNI, *PWW_CDPD_SPNI; + +// +// OID_WW_CDPD_WASI +// +typedef struct _WW_CDPD_WIDE_AREA_SERVICE_ID { + UINT WASI[10]; //10 16-bit wide area service IDs + + INT OperatingMode; // 0 = ignore WASI, + // 1 = Require WASI from list, + // 2 = prefer WASI from list + // 3 = exclude WASI from list. + +} WW_CDPD_WIDE_AREA_SERVICE_ID, *PWW_CDPD_WIDE_AREA_SERVICE_ID; + +// +// OID_WW_CDPD_AREA_COLOR +// +typedef INT WW_CDPD_AREA_COLOR; +// +// OID_WW_CDPD_TX_POWER_LEVEL +// +typedef UINT WW_CDPD_TX_POWER_LEVEL; +// +// OID_WW_CDPD_EID +// +typedef NDIS_VAR_DATA_DESC WW_CDPD_EID; +// +// OID_WW_CDPD_HEADER_COMPRESSION +// +typedef INT WW_CDPD_HEADER_COMPRESSION; // 0 = no header compression, + // 1 = always compress headers, + // 2 = compress headers if MD-IS does + // -1 = unknown +// +// OID_WW_CDPD_DATA_COMPRESSION +// + +typedef INT WW_CDPD_DATA_COMPRESSION; // 0 = no data compression, + // 1 = data compression enabled + // -1 = unknown +// +// OID_WW_CDPD_CHANNEL_SELECT +// + +typedef struct _WW_CDPD_CHANNEL_SELECT { + UINT ChannelID; // channel number + + UINT fixedDuration; // duration in seconds + +} WW_CDPD_CHANNEL_SELECT, *PWW_CDPD_CHANNEL_SELECT; + +// +// OID_WW_CDPD_CHANNEL_STATE +// +typedef enum _WW_CDPD_CHANNEL_STATE { + CDPDChannelNotAvail, + CDPDChannelScanning, + CDPDChannelInitAcquired, + CDPDChannelAcquired, + CDPDChannelSleeping, + CDPDChannelWaking, + CDPDChannelCSDialing, + CDPDChannelCSRedial, + CDPDChannelCSAnswering, + CDPDChannelCSConnected, + CDPDChannelCSSuspended +} WW_CDPD_CHANNEL_STATE, *PWW_CDPD_CHANNEL_STATE; + +// +// OID_WW_CDPD_NEI +// +typedef enum _WW_CDPD_NEI_FORMAT { + CDPDNeiIPv4, + CDPDNeiCLNP, + CDPDNeiIPv6 +} WW_CDPD_NEI_FORMAT, *PWW_CDPD_NEI_FORMAT; +typedef enum _WW_CDPD_NEI_TYPE { + CDPDNeiIndividual, + CDPDNeiMulticast, + CDPDNeiBroadcast +} WW_CDPD_NEI_TYPE; +typedef struct _WW_CDPD_NEI { + UINT uNeiIndex; + WW_CDPD_NEI_FORMAT NeiFormat; + WW_CDPD_NEI_TYPE NeiType; + WORD NeiGmid; // group member identifier, only + // meaningful if NeiType == + // CDPDNeiMulticast + + NDIS_VAR_DATA_DESC NeiAddress; +} WW_CDPD_NEI; + +// +// OID_WW_CDPD_NEI_STATE +// +typedef enum _WW_CDPD_NEI_STATE { + CDPDUnknown, + CDPDRegistered, + CDPDDeregistered +} WW_CDPD_NEI_STATE, *PWW_CDPD_NEI_STATE; +typedef enum _WW_CDPD_NEI_SUB_STATE { + CDPDPending, // Registration pending + CDPDNoReason, // Registration denied - no reason given + CDPDMDISNotCapable, // Registration denied - MD-IS not capable of + // handling M-ES at this time + CDPDNEINotAuthorized, // Registration denied - NEI is not authorized to + // use this subnetwork + CDPDInsufficientAuth, // Registration denied - M-ES gave insufficient + // authentication credentials + CDPDUnsupportedAuth, // Registration denied - M-ES gave unsupported + // authentication credentials + CDPDUsageExceeded, // Registration denied - NEI has exceeded usage + // limitations + CDPDDeniedThisNetwork // Registration denied on this network, service + // may be obtained on alternate Service Provider + // network +} WW_CDPD_NEI_SUB_STATE; +typedef struct _WW_CDPD_NEI_REG_STATE { + UINT uNeiIndex; + WW_CDPD_NEI_STATE NeiState; + WW_CDPD_NEI_SUB_STATE NeiSubState; +} WW_CDPD_NEI_REG_STATE, *PWW_CDPD_NEI_REG_STATE; + +// +// OID_WW_CDPD_SERVICE_PROVIDER_IDENTIFIER +// +typedef struct _WW_CDPD_SERVICE_PROVIDER_ID { + UINT SPI[10]; //10 16-bit service provider IDs + + INT OperatingMode; // 0 = ignore SPI, + // 1 = require SPI from list, + // 2 = prefer SPI from list. + // 3 = exclude SPI from list. + +} WW_CDPD_SERVICE_PROVIDER_ID, *PWW_CDPD_SERVICE_PROVIDER_ID; + +// +// OID_WW_CDPD_SLEEP_MODE +// +typedef INT WW_CDPD_SLEEP_MODE; +// +// OID_WW_CDPD_TEI +// +typedef ULONG WW_CDPD_TEI; +// +// OID_WW_CDPD_CIRCUIT_SWITCHED +// +typedef struct _WW_CDPD_CIRCUIT_SWITCHED { + INT service_preference; // -1 = unknown, + // 0 = always use packet switched CDPD, + // 1 = always use CS CDPD via AMPS, + // 2 = always use CS CDPD via PSTN, + // 3 = use circuit switched via AMPS only + // when packet switched is not available. + // 4 = use packet switched only when circuit + // switched via AMPS is not available. + // 5 = device manuf. defined service + // preference. + // 6 = device manuf. defined service + // preference. + + INT service_status; // -1 = unknown, + // 0 = packet switched CDPD, + // 1 = circuit switched CDPD via AMPS, + // 2 = circuit switched CDPD via PSTN. + + INT connect_rate; // CS connection bit rate (bits per second). + // 0 = no active connection, + // -1 = unknown + // Dial code last used to dial. + + NDIS_VAR_DATA_DESC dial_code[20]; + + UINT sid; // Current AMPS system ID + + INT a_b_side_selection; // -1 = unknown, + // 0 = no AMPS service + // 1 = AMPS "A" side channels selected + // 2 = AMPS "B" side channels selected + + INT AMPS_channel; // -1= unknown + // 0 = no AMPS service. + // 1-1023 = AMPS channel number in use + + UINT action; // 0 = no action + // 1 = suspend (hangup) + // 2 = dial + + // Default dial code for CS CDPD service + // encoded as specified in the CS CDPD + // implementor guidelines. + NDIS_VAR_DATA_DESC default_dial[20]; + + // Number for the CS CDPD network to call + // back the mobile, encoded as specified in + // the CS CDPD implementor guidelines. + NDIS_VAR_DATA_DESC call_back[20]; + + UINT sid_list[10]; // List of 10 16-bit preferred AMPS + // system IDs for CS CDPD. + + UINT inactivity_timer; // Wait time after last data before dropping + // call. + // 0-65535 = inactivity time limit (seconds). + + UINT receive_timer; // secs. per CS-CDPD Implementor Guidelines. + + UINT conn_resp_timer; // secs. per CS-CDPD Implementor Guidelines. + + UINT reconn_resp_timer; // secs. per CS-CDPD Implementor Guidelines. + + UINT disconn_timer; // secs. per CS-CDPD Implementor Guidelines. + + UINT NEI_reg_timer; // secs. per CS-CDPD Implementor Guidelines. + + UINT reconn_retry_timer; // secs. per CS-CDPD Implementor Guidelines. + + UINT link_reset_timer; // secs. per CS-CDPD Implementor Guidelines. + + UINT link_reset_ack_timer; // secs. per CS-CDPD Implementor Guidelines. + + UINT n401_retry_limit; // per CS-CDPD Implementor Guidelines. + + UINT n402_retry_limit; // per CS-CDPD Implementor Guidelines. + + UINT n404_retry_limit; // per CS-CDPD Implementor Guidelines. + + UINT n405_retry_limit; // per CS-CDPD Implementor Guidelines. + +} WW_CDPD_CIRCUIT_SWITCHED, *WW_PCDPD_CIRCUIT_SWITCHED; +typedef UINT WW_CDPD_RSSI; +// +// OID_WW_PIN_LOC_AUTHORIZE +// +typedef INT WW_PIN_AUTHORIZED; // 0 = unauthorized + // 1 = authorized + // -1 = unknown +// +// OID_WW_PIN_LAST_LOCATION +// OID_WW_PIN_LOC_FIX +// + +typedef struct _WW_PIN_LOCATION { + INT Latitude; // Latitude in hundredths of a second + + INT Longitude; // Longitude in hundredths of a second + + INT Altitude; // Altitude in feet + + INT FixTime; // Time of the location fix, since midnight, local time (of the + // current day), in tenths of a second + + INT NetTime; // Current local network time of the current day, since midnight, + // in tenths of a second + + INT LocQuality; // 0-100 = location quality + + INT LatReg; // Latitude registration offset, in hundredths of a second + + INT LongReg; // Longitude registration offset, in hundredths of a second + + INT GMTOffset; // Offset in minutes of the local time zone from GMT + +} WW_PIN_LOCATION, *PWW_PIN_LOCATION; + +// +// The following is set on a per-packet basis as OOB data with NdisClassWirelessWanMbxMailbox +// +typedef ULONG WW_MBX_MAILBOX_FLAG; // 1 = set mailbox flag, 0 = do not set mailbox flag +// +// OID_WW_MBX_SUBADDR +// + +typedef struct _WW_MBX_PMAN { + BOOLEAN ACTION; // 0 = Login PMAN, 1 = Logout PMAN + + UINT MAN; + UCHAR PASSWORD[8]; // Password should be null for Logout and indications. + // Maximum length of password is 8 chars. + +} WW_MBX_PMAN, *PWW_MBX_PMAN; + +// +// OID_WW_MBX_FLEXLIST +// +typedef struct _WW_MBX_FLEXLIST { + INT count; // Number of MAN entries used. + // -1=unknown. + + UINT MAN[7]; // List of MANs. + +} WW_MBX_FLEXLIST; + +// +// OID_WW_MBX_GROUPLIST +// +typedef struct _WW_MBX_GROUPLIST { + INT count; // Number of MAN entries used. + // -1=unknown. + + UINT MAN[15]; // List of MANs. + +} WW_MBX_GROUPLIST; + +// +// OID_WW_MBX_TRAFFIC_AREA +// +typedef enum _WW_MBX_TRAFFIC_AREA { + unknown_traffic_area, // The driver has no information about the current traffic area. + in_traffic_area, // Mobile unit has entered a subscribed traffic area. + in_auth_traffic_area, // Mobile unit is outside traffic area but is authorized. + unauth_traffic_area // Mobile unit is outside traffic area but is un-authorized. +} WW_MBX_TRAFFIC_AREA; + +// +// OID_WW_MBX_LIVE_DIE +// +typedef INT WW_MBX_LIVE_DIE; // 0 = DIE last received + // 1 = LIVE last received + // -1 = unknown +// +// OID_WW_MBX_TEMP_DEFAULTLIST +// + +typedef struct _WW_MBX_CHANNEL_PAIR { + UINT Mobile_Tx; + UINT Mobile_Rx; +} WW_MBX_CHANNEL_PAIR, *PWW_MBX_CHANNEL_PAIR; +typedef struct _WW_MBX_TEMPDEFAULTLIST { + UINT Length; + WW_MBX_CHANNEL_PAIR ChannelPair[1]; +} WW_MBX_TEMPDEFAULTLIST, *WW_PMBX_TEMPDEFAULTLIST; + +#endif // WIRELESS_WAN +#endif // _NTDDNDIS_ diff --git a/src/Cedar/winpcap/Ntddpack.h b/src/Cedar/winpcap/Ntddpack.h index 30945c1e..87eac60e 100644 --- a/src/Cedar/winpcap/Ntddpack.h +++ b/src/Cedar/winpcap/Ntddpack.h @@ -1,26 +1,26 @@ - -#ifndef __NTDDPACKET -#define __NTDDPACKET 1 -#include "devioctl.h" -/*#include */ -struct _PACKET_OID_DATA { - ULONG Oid; - ULONG Length; - UCHAR Data[1]; -}; - -typedef struct _PACKET_OID_DATA PACKET_OID_DATA, *PPACKET_OID_DATA; - -/*#include */ -#define FILE_DEVICE_PROTOCOL 0x8000 -#define IOCTL_PROTOCOL_QUERY_OID CTL_CODE(FILE_DEVICE_PROTOCOL, 0 , METHOD_BUFFERED, FILE_ANY_ACCESS) -#define IOCTL_PROTOCOL_SET_OID CTL_CODE(FILE_DEVICE_PROTOCOL, 1 , METHOD_BUFFERED, FILE_ANY_ACCESS) -#define IOCTL_PROTOCOL_STATISTICS CTL_CODE(FILE_DEVICE_PROTOCOL, 2 , METHOD_BUFFERED, FILE_ANY_ACCESS) -#define IOCTL_PROTOCOL_RESET CTL_CODE(FILE_DEVICE_PROTOCOL, 3 , METHOD_BUFFERED, FILE_ANY_ACCESS) -#define IOCTL_PROTOCOL_READ CTL_CODE(FILE_DEVICE_PROTOCOL, 4 , METHOD_BUFFERED, FILE_ANY_ACCESS) -#define IOCTL_PROTOCOL_WRITE CTL_CODE(FILE_DEVICE_PROTOCOL, 5 , METHOD_BUFFERED, FILE_ANY_ACCESS) -#define IOCTL_PROTOCOL_MACNAME CTL_CODE(FILE_DEVICE_PROTOCOL, 6 , METHOD_BUFFERED, FILE_ANY_ACCESS) -#define IOCTL_OPEN CTL_CODE(FILE_DEVICE_PROTOCOL, 7 , METHOD_BUFFERED, FILE_ANY_ACCESS) -#define IOCTL_CLOSE CTL_CODE(FILE_DEVICE_PROTOCOL, 8 , METHOD_BUFFERED, FILE_ANY_ACCESS) - -#endif + +#ifndef __NTDDPACKET +#define __NTDDPACKET 1 +#include "devioctl.h" +/*#include */ +struct _PACKET_OID_DATA { + ULONG Oid; + ULONG Length; + UCHAR Data[1]; +}; + +typedef struct _PACKET_OID_DATA PACKET_OID_DATA, *PPACKET_OID_DATA; + +/*#include */ +#define FILE_DEVICE_PROTOCOL 0x8000 +#define IOCTL_PROTOCOL_QUERY_OID CTL_CODE(FILE_DEVICE_PROTOCOL, 0 , METHOD_BUFFERED, FILE_ANY_ACCESS) +#define IOCTL_PROTOCOL_SET_OID CTL_CODE(FILE_DEVICE_PROTOCOL, 1 , METHOD_BUFFERED, FILE_ANY_ACCESS) +#define IOCTL_PROTOCOL_STATISTICS CTL_CODE(FILE_DEVICE_PROTOCOL, 2 , METHOD_BUFFERED, FILE_ANY_ACCESS) +#define IOCTL_PROTOCOL_RESET CTL_CODE(FILE_DEVICE_PROTOCOL, 3 , METHOD_BUFFERED, FILE_ANY_ACCESS) +#define IOCTL_PROTOCOL_READ CTL_CODE(FILE_DEVICE_PROTOCOL, 4 , METHOD_BUFFERED, FILE_ANY_ACCESS) +#define IOCTL_PROTOCOL_WRITE CTL_CODE(FILE_DEVICE_PROTOCOL, 5 , METHOD_BUFFERED, FILE_ANY_ACCESS) +#define IOCTL_PROTOCOL_MACNAME CTL_CODE(FILE_DEVICE_PROTOCOL, 6 , METHOD_BUFFERED, FILE_ANY_ACCESS) +#define IOCTL_OPEN CTL_CODE(FILE_DEVICE_PROTOCOL, 7 , METHOD_BUFFERED, FILE_ANY_ACCESS) +#define IOCTL_CLOSE CTL_CODE(FILE_DEVICE_PROTOCOL, 8 , METHOD_BUFFERED, FILE_ANY_ACCESS) + +#endif diff --git a/src/Cedar/winpcap/Packet32.h b/src/Cedar/winpcap/Packet32.h index 9ec26d97..f2e0ea27 100644 --- a/src/Cedar/winpcap/Packet32.h +++ b/src/Cedar/winpcap/Packet32.h @@ -1,423 +1,423 @@ -/* - * Copyright (c) 1999 - 2003 - * NetGroup, Politecnico di Torino (Italy) - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the Politecnico di Torino nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - */ - -/** @ingroup packetapi - * @{ - */ - -/** @defgroup packet32h Packet.dll definitions and data structures - * Packet32.h contains the data structures and the definitions used by packet.dll. - * The file is used both by the Win9x and the WinNTx versions of packet.dll, and can be included - * by the applications that use the functions of this library - * @{ - */ - -#ifndef __PACKET32 -#define __PACKET32 - -#include -#include "devioctl.h" -#ifdef HAVE_DAG_API -#include -#endif /* HAVE_DAG_API */ - -// Working modes -#define PACKET_MODE_CAPT 0x0 ///< Capture mode -#define PACKET_MODE_STAT 0x1 ///< Statistical mode -#define PACKET_MODE_MON 0x2 ///< Monitoring mode -#define PACKET_MODE_DUMP 0x10 ///< Dump mode -#define PACKET_MODE_STAT_DUMP MODE_DUMP | MODE_STAT ///< Statistical dump Mode - -// ioctls -#define FILE_DEVICE_PROTOCOL 0x8000 - -#define IOCTL_PROTOCOL_STATISTICS CTL_CODE(FILE_DEVICE_PROTOCOL, 2 , METHOD_BUFFERED, FILE_ANY_ACCESS) -#define IOCTL_PROTOCOL_RESET CTL_CODE(FILE_DEVICE_PROTOCOL, 3 , METHOD_BUFFERED, FILE_ANY_ACCESS) -#define IOCTL_PROTOCOL_READ CTL_CODE(FILE_DEVICE_PROTOCOL, 4 , METHOD_BUFFERED, FILE_ANY_ACCESS) -#define IOCTL_PROTOCOL_WRITE CTL_CODE(FILE_DEVICE_PROTOCOL, 5 , METHOD_BUFFERED, FILE_ANY_ACCESS) -#define IOCTL_PROTOCOL_MACNAME CTL_CODE(FILE_DEVICE_PROTOCOL, 6 , METHOD_BUFFERED, FILE_ANY_ACCESS) -#define IOCTL_OPEN CTL_CODE(FILE_DEVICE_PROTOCOL, 7 , METHOD_BUFFERED, FILE_ANY_ACCESS) -#define IOCTL_CLOSE CTL_CODE(FILE_DEVICE_PROTOCOL, 8 , METHOD_BUFFERED, FILE_ANY_ACCESS) - -#define pBIOCSETBUFFERSIZE 9592 ///< IOCTL code: set kernel buffer size. -#define pBIOCSETF 9030 ///< IOCTL code: set packet filtering program. -#define pBIOCGSTATS 9031 ///< IOCTL code: get the capture stats. -#define pBIOCSRTIMEOUT 7416 ///< IOCTL code: set the read timeout. -#define pBIOCSMODE 7412 ///< IOCTL code: set working mode. -#define pBIOCSWRITEREP 7413 ///< IOCTL code: set number of physical repetions of every packet written by the app. -#define pBIOCSMINTOCOPY 7414 ///< IOCTL code: set minimum amount of data in the kernel buffer that unlocks a read call. -#define pBIOCSETOID 2147483648 ///< IOCTL code: set an OID value. -#define pBIOCQUERYOID 2147483652 ///< IOCTL code: get an OID value. -#define pATTACHPROCESS 7117 ///< IOCTL code: attach a process to the driver. Used in Win9x only. -#define pDETACHPROCESS 7118 ///< IOCTL code: detach a process from the driver. Used in Win9x only. -#define pBIOCSETDUMPFILENAME 9029 ///< IOCTL code: set the name of a the file used by kernel dump mode. -#define pBIOCEVNAME 7415 ///< IOCTL code: get the name of the event that the driver signals when some data is present in the buffer. -#define pBIOCSENDPACKETSNOSYNC 9032 ///< IOCTL code: Send a buffer containing multiple packets to the network, ignoring the timestamps associated with the packets. -#define pBIOCSENDPACKETSSYNC 9033 ///< IOCTL code: Send a buffer containing multiple packets to the network, respecting the timestamps associated with the packets. -#define pBIOCSETDUMPLIMITS 9034 ///< IOCTL code: Set the dump file limits. See the PacketSetDumpLimits() function. -#define pBIOCISDUMPENDED 7411 ///< IOCTL code: Get the status of the kernel dump process. See the PacketIsDumpEnded() function. - -#define pBIOCSTIMEZONE 7471 ///< IOCTL code: set time zone. Used in Win9x only. - - -/// Alignment macro. Defines the alignment size. -#define Packet_ALIGNMENT sizeof(int) -/// Alignment macro. Rounds up to the next even multiple of Packet_ALIGNMENT. -#define Packet_WORDALIGN(x) (((x)+(Packet_ALIGNMENT-1))&~(Packet_ALIGNMENT-1)) - - -#define NdisMediumNull -1 // Custom linktype: NDIS doesn't provide an equivalent -#define NdisMediumCHDLC -2 // Custom linktype: NDIS doesn't provide an equivalent -#define NdisMediumPPPSerial -3 // Custom linktype: NDIS doesn't provide an equivalent - -/*! - \brief Network type structure. - - This structure is used by the PacketGetNetType() function to return information on the current adapter's type and speed. -*/ -typedef struct NetType -{ - UINT LinkType; ///< The MAC of the current network adapter (see function PacketGetNetType() for more information) - ULONGLONG LinkSpeed; ///< The speed of the network in bits per second -}NetType; - - -//some definitions stolen from libpcap - -#ifndef BPF_MAJOR_VERSION - -/*! - \brief A BPF pseudo-assembly program. - - The program will be injected in the kernel by the PacketSetBPF() function and applied to every incoming packet. -*/ -struct bpf_program -{ - UINT bf_len; ///< Indicates the number of instructions of the program, i.e. the number of struct bpf_insn that will follow. - struct bpf_insn *bf_insns; ///< A pointer to the first instruction of the program. -}; - -/*! - \brief A single BPF pseudo-instruction. - - bpf_insn contains a single instruction for the BPF register-machine. It is used to send a filter program to the driver. -*/ -struct bpf_insn -{ - USHORT code; ///< Instruction type and addressing mode. - UCHAR jt; ///< Jump if true - UCHAR jf; ///< Jump if false - int k; ///< Generic field used for various purposes. -}; - -/*! - \brief Structure that contains a couple of statistics values on the current capture. - - It is used by packet.dll to return statistics about a capture session. -*/ -struct bpf_stat -{ - UINT bs_recv; ///< Number of packets that the driver received from the network adapter - ///< from the beginning of the current capture. This value includes the packets - ///< lost by the driver. - UINT bs_drop; ///< number of packets that the driver lost from the beginning of a capture. - ///< Basically, a packet is lost when the the buffer of the driver is full. - ///< In this situation the packet cannot be stored and the driver rejects it. - UINT ps_ifdrop; ///< drops by interface. XXX not yet supported - UINT bs_capt; ///< number of packets that pass the filter, find place in the kernel buffer and - ///< thus reach the application. -}; - -/*! - \brief Packet header. - - This structure defines the header associated with every packet delivered to the application. -*/ -struct bpf_hdr -{ - struct timeval bh_tstamp; ///< The timestamp associated with the captured packet. - ///< It is stored in a TimeVal structure. - UINT bh_caplen; ///< Length of captured portion. The captured portion can be different - ///< from the original packet, because it is possible (with a proper filter) - ///< to instruct the driver to capture only a portion of the packets. - UINT bh_datalen; ///< Original length of packet - USHORT bh_hdrlen; ///< Length of bpf header (this struct plus alignment padding). In some cases, - ///< a padding could be added between the end of this structure and the packet - ///< data for performance reasons. This filed can be used to retrieve the actual data - ///< of the packet. -}; - -/*! - \brief Dump packet header. - - This structure defines the header associated with the packets in a buffer to be used with PacketSendPackets(). - It is simpler than the bpf_hdr, because it corresponds to the header associated by WinPcap and libpcap to a - packet in a dump file. This makes straightforward sending WinPcap dump files to the network. -*/ -struct dump_bpf_hdr{ - struct timeval ts; ///< Time stamp of the packet - UINT caplen; ///< Length of captured portion. The captured portion can smaller than the - ///< the original packet, because it is possible (with a proper filter) to - ///< instruct the driver to capture only a portion of the packets. - UINT len; ///< Length of the original packet (off wire). -}; - - -#endif - -#define DOSNAMEPREFIX TEXT("Packet_") ///< Prefix added to the adapters device names to create the WinPcap devices -#define MAX_LINK_NAME_LENGTH 64 //< Maximum length of the devices symbolic links -#define NMAX_PACKET 65535 - -/*! - \brief Addresses of a network adapter. - - This structure is used by the PacketGetNetInfoEx() function to return the IP addresses associated with - an adapter. -*/ -typedef struct npf_if_addr { - struct sockaddr_storage IPAddress; ///< IP address. - struct sockaddr_storage SubnetMask; ///< Netmask for that address. - struct sockaddr_storage Broadcast; ///< Broadcast address. -}npf_if_addr; - - -#define ADAPTER_NAME_LENGTH 256 + 12 ///< Maximum length for the name of an adapter. The value is the same used by the IP Helper API. -#define ADAPTER_DESC_LENGTH 128 ///< Maximum length for the description of an adapter. The value is the same used by the IP Helper API. -#define MAX_MAC_ADDR_LENGTH 8 ///< Maximum length for the link layer address of an adapter. The value is the same used by the IP Helper API. -#define MAX_NETWORK_ADDRESSES 16 ///< Maximum length for the link layer address of an adapter. The value is the same used by the IP Helper API. - - -typedef struct WAN_ADAPTER_INT WAN_ADAPTER; ///< Describes an opened wan (dialup, VPN...) network adapter using the NetMon API -typedef WAN_ADAPTER *PWAN_ADAPTER; ///< Describes an opened wan (dialup, VPN...) network adapter using the NetMon API - -#define INFO_FLAG_NDIS_ADAPTER 0 ///< Flag for ADAPTER_INFO: this is a traditional ndis adapter -#define INFO_FLAG_NDISWAN_ADAPTER 1 ///< Flag for ADAPTER_INFO: this is a NdisWan adapter -#define INFO_FLAG_DAG_CARD 2 ///< Flag for ADAPTER_INFO: this is a DAG card -#define INFO_FLAG_DAG_FILE 6 ///< Flag for ADAPTER_INFO: this is a DAG file -#define INFO_FLAG_DONT_EXPORT 8 ///< Flag for ADAPTER_INFO: when this flag is set, the adapter will not be listed or openend by winpcap. This allows to prevent exporting broken network adapters, like for example FireWire ones. - -/*! - \brief Contains comprehensive information about a network adapter. - - This structure is filled with all the accessory information that the user can need about an adapter installed - on his system. -*/ -typedef struct _ADAPTER_INFO -{ - struct _ADAPTER_INFO *Next; ///< Pointer to the next adapter in the list. - CHAR Name[ADAPTER_NAME_LENGTH + 1]; ///< Name of the device representing the adapter. - CHAR Description[ADAPTER_DESC_LENGTH + 1]; ///< Human understandable description of the adapter - UINT MacAddressLen; ///< Length of the link layer address. - UCHAR MacAddress[MAX_MAC_ADDR_LENGTH]; ///< Link layer address. - NetType LinkLayer; ///< Physical characteristics of this adapter. This NetType structure contains the link type and the speed of the adapter. - INT NNetworkAddresses; ///< Number of network layer addresses of this adapter. - npf_if_addr *NetworkAddresses; ///< Pointer to an array of npf_if_addr, each of which specifies a network address of this adapter. - UINT Flags; ///< Adapter's flags. Tell if this adapter must be treated in a different way, using the Netmon API or the dagc API. -} -ADAPTER_INFO, *PADAPTER_INFO; - -/*! - \brief Describes an opened network adapter. - - This structure is the most important for the functioning of packet.dll, but the great part of its fields - should be ignored by the user, since the library offers functions that avoid to cope with low-level parameters -*/ -typedef struct _ADAPTER { - HANDLE hFile; ///< \internal Handle to an open instance of the NPF driver. - CHAR SymbolicLink[MAX_LINK_NAME_LENGTH]; ///< \internal A string containing the name of the network adapter currently opened. - int NumWrites; ///< \internal Number of times a packets written on this adapter will be repeated - ///< on the wire. - HANDLE ReadEvent; ///< A notification event associated with the read calls on the adapter. - ///< It can be passed to standard Win32 functions (like WaitForSingleObject - ///< or WaitForMultipleObjects) to wait until the driver's buffer contains some - ///< data. It is particularly useful in GUI applications that need to wait - ///< concurrently on several events. In Windows NT/2000 the PacketSetMinToCopy() - ///< function can be used to define the minimum amount of data in the kernel buffer - ///< that will cause the event to be signalled. - - UINT ReadTimeOut; ///< \internal The amount of time after which a read on the driver will be released and - ///< ReadEvent will be signaled, also if no packets were captured - CHAR Name[ADAPTER_NAME_LENGTH]; - PWAN_ADAPTER pWanAdapter; - UINT Flags; ///< Adapter's flags. Tell if this adapter must be treated in a different way, using the Netmon API or the dagc API. -#ifdef HAVE_DAG_API - dagc_t *pDagCard; ///< Pointer to the dagc API adapter descriptor for this adapter - PCHAR DagBuffer; ///< Pointer to the buffer with the packets that is received from the DAG card - struct timeval DagReadTimeout; ///< Read timeout. The dagc API requires a timeval structure - unsigned DagFcsLen; ///< Length of the frame check sequence attached to any packet by the card. Obtained from the registry - DWORD DagFastProcess; ///< True if the user requests fast capture processing on this card. Higher level applications can use this value to provide a faster but possibly unprecise capture (for example, libpcap doesn't convert the timestamps). -#endif // HAVE_DAG_API -} ADAPTER, *LPADAPTER; - -/*! - \brief Structure that contains a group of packets coming from the driver. - - This structure defines the header associated with every packet delivered to the application. -*/ -typedef struct _PACKET { - HANDLE hEvent; ///< \deprecated Still present for compatibility with old applications. - OVERLAPPED OverLapped; ///< \deprecated Still present for compatibility with old applications. - PVOID Buffer; ///< Buffer with containing the packets. See the PacketReceivePacket() for - ///< details about the organization of the data in this buffer - UINT Length; ///< Length of the buffer - DWORD ulBytesReceived; ///< Number of valid bytes present in the buffer, i.e. amount of data - ///< received by the last call to PacketReceivePacket() - BOOLEAN bIoComplete; ///< \deprecated Still present for compatibility with old applications. -} PACKET, *LPPACKET; - -/*! - \brief Structure containing an OID request. - - It is used by the PacketRequest() function to send an OID to the interface card driver. - It can be used, for example, to retrieve the status of the error counters on the adapter, its MAC address, - the list of the multicast groups defined on it, and so on. -*/ -struct _PACKET_OID_DATA { - ULONG Oid; ///< OID code. See the Microsoft DDK documentation or the file ntddndis.h - ///< for a complete list of valid codes. - ULONG Length; ///< Length of the data field - UCHAR Data[1]; ///< variable-length field that contains the information passed to or received - ///< from the adapter. -}; -typedef struct _PACKET_OID_DATA PACKET_OID_DATA, *PPACKET_OID_DATA; - - -#if _DBG -#define ODS(_x) OutputDebugString(TEXT(_x)) -#define ODSEx(_x, _y) -#else -#ifdef _DEBUG_TO_FILE -/*! - \brief Macro to print a debug string. The behavior differs depending on the debug level -*/ -#define ODS(_x) { \ - FILE *f; \ - f = fopen("winpcap_debug.txt", "a"); \ - fprintf(f, "%s", _x); \ - fclose(f); \ -} -/*! - \brief Macro to print debug data with the printf convention. The behavior differs depending on - the debug level -*/ -#define ODSEx(_x, _y) { \ - FILE *f; \ - f = fopen("winpcap_debug.txt", "a"); \ - fprintf(f, _x, _y); \ - fclose(f); \ -} - - - -LONG PacketDumpRegistryKey(PCHAR KeyName, PCHAR FileName); -#else -#define ODS(_x) -#define ODSEx(_x, _y) -#endif -#endif - -/* We load dynamically the dag library in order link it only when it's present on the system */ -#ifdef HAVE_DAG_API -typedef dagc_t* (*dagc_open_handler)(const char *source, unsigned flags, char *ebuf); ///< prototype used to dynamically load the dag dll -typedef void (*dagc_close_handler)(dagc_t *dagcfd); ///< prototype used to dynamically load the dag dll -typedef int (*dagc_getlinktype_handler)(dagc_t *dagcfd); ///< prototype used to dynamically load the dag dll -typedef int (*dagc_getlinkspeed_handler)(dagc_t *dagcfd); ///< prototype used to dynamically load the dag dll -typedef int (*dagc_setsnaplen_handler)(dagc_t *dagcfd, unsigned snaplen); ///< prototype used to dynamically load the dag dll -typedef unsigned (*dagc_getfcslen_handler)(dagc_t *dagcfd); ///< prototype used to dynamically load the dag dll -typedef int (*dagc_receive_handler)(dagc_t *dagcfd, u_char **buffer, u_int *bufsize); ///< prototype used to dynamically load the dag dll -typedef int (*dagc_stats_handler)(dagc_t *dagcfd, dagc_stats_t *ps); ///< prototype used to dynamically load the dag dll -typedef int (*dagc_wait_handler)(dagc_t *dagcfd, struct timeval *timeout); ///< prototype used to dynamically load the dag dll -typedef int (*dagc_finddevs_handler)(dagc_if_t **alldevsp, char *ebuf); ///< prototype used to dynamically load the dag dll -typedef int (*dagc_freedevs_handler)(dagc_if_t *alldevsp); ///< prototype used to dynamically load the dag dll -#endif // HAVE_DAG_API - -#ifdef __cplusplus -extern "C" { -#endif - -/** - * @} - */ - -// The following is used to check the adapter name in PacketOpenAdapterNPF and prevent -// opening of firewire adapters -#define FIREWIRE_SUBSTR L"1394" - -void PacketPopulateAdaptersInfoList(); -PWCHAR SChar2WChar(PCHAR string); -PCHAR WChar2SChar(PWCHAR string); -BOOL PacketGetFileVersion(LPTSTR FileName, PCHAR VersionBuff, UINT VersionBuffLen); -PADAPTER_INFO PacketFindAdInfo(PCHAR AdapterName); -BOOLEAN PacketUpdateAdInfo(PCHAR AdapterName); -BOOLEAN IsFireWire(TCHAR *AdapterDesc); - - -//--------------------------------------------------------------------------- -// EXPORTED FUNCTIONS -//--------------------------------------------------------------------------- - -PCHAR PacketGetVersion(); -PCHAR PacketGetDriverVersion(); -BOOLEAN PacketSetMinToCopy(LPADAPTER AdapterObject,int nbytes); -BOOLEAN PacketSetNumWrites(LPADAPTER AdapterObject,int nwrites); -BOOLEAN PacketSetMode(LPADAPTER AdapterObject,int mode); -BOOLEAN PacketSetReadTimeout(LPADAPTER AdapterObject,int timeout); -BOOLEAN PacketSetBpf(LPADAPTER AdapterObject,struct bpf_program *fp); -INT PacketSetSnapLen(LPADAPTER AdapterObject,int snaplen); -BOOLEAN PacketGetStats(LPADAPTER AdapterObject,struct bpf_stat *s); -BOOLEAN PacketGetStatsEx(LPADAPTER AdapterObject,struct bpf_stat *s); -BOOLEAN PacketSetBuff(LPADAPTER AdapterObject,int dim); -BOOLEAN PacketGetNetType (LPADAPTER AdapterObject,NetType *type); -LPADAPTER PacketOpenAdapter(PCHAR AdapterName); -BOOLEAN PacketSendPacket(LPADAPTER AdapterObject,LPPACKET pPacket,BOOLEAN Sync); -INT PacketSendPackets(LPADAPTER AdapterObject,PVOID PacketBuff,ULONG Size, BOOLEAN Sync); -LPPACKET PacketAllocatePacket(void); -VOID PacketInitPacket(LPPACKET lpPacket,PVOID Buffer,UINT Length); -VOID PacketFreePacket(LPPACKET lpPacket); -BOOLEAN PacketReceivePacket(LPADAPTER AdapterObject,LPPACKET lpPacket,BOOLEAN Sync); -BOOLEAN PacketSetHwFilter(LPADAPTER AdapterObject,ULONG Filter); -BOOLEAN PacketGetAdapterNames(PTSTR pStr,PULONG BufferSize); -BOOLEAN PacketGetNetInfoEx(PCHAR AdapterName, npf_if_addr* buffer, PLONG NEntries); -BOOLEAN PacketRequest(LPADAPTER AdapterObject,BOOLEAN Set,PPACKET_OID_DATA OidData); -HANDLE PacketGetReadEvent(LPADAPTER AdapterObject); -BOOLEAN PacketSetDumpName(LPADAPTER AdapterObject, void *name, int len); -BOOLEAN PacketSetDumpLimits(LPADAPTER AdapterObject, UINT maxfilesize, UINT maxnpacks); -BOOLEAN PacketIsDumpEnded(LPADAPTER AdapterObject, BOOLEAN sync); -BOOL PacketStopDriver(); -VOID PacketCloseAdapter(LPADAPTER lpAdapter); - -#ifdef __cplusplus -} -#endif - -#endif //__PACKET32 +/* + * Copyright (c) 1999 - 2003 + * NetGroup, Politecnico di Torino (Italy) + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the Politecnico di Torino nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +/** @ingroup packetapi + * @{ + */ + +/** @defgroup packet32h Packet.dll definitions and data structures + * Packet32.h contains the data structures and the definitions used by packet.dll. + * The file is used both by the Win9x and the WinNTx versions of packet.dll, and can be included + * by the applications that use the functions of this library + * @{ + */ + +#ifndef __PACKET32 +#define __PACKET32 + +#include +#include "devioctl.h" +#ifdef HAVE_DAG_API +#include +#endif /* HAVE_DAG_API */ + +// Working modes +#define PACKET_MODE_CAPT 0x0 ///< Capture mode +#define PACKET_MODE_STAT 0x1 ///< Statistical mode +#define PACKET_MODE_MON 0x2 ///< Monitoring mode +#define PACKET_MODE_DUMP 0x10 ///< Dump mode +#define PACKET_MODE_STAT_DUMP MODE_DUMP | MODE_STAT ///< Statistical dump Mode + +// ioctls +#define FILE_DEVICE_PROTOCOL 0x8000 + +#define IOCTL_PROTOCOL_STATISTICS CTL_CODE(FILE_DEVICE_PROTOCOL, 2 , METHOD_BUFFERED, FILE_ANY_ACCESS) +#define IOCTL_PROTOCOL_RESET CTL_CODE(FILE_DEVICE_PROTOCOL, 3 , METHOD_BUFFERED, FILE_ANY_ACCESS) +#define IOCTL_PROTOCOL_READ CTL_CODE(FILE_DEVICE_PROTOCOL, 4 , METHOD_BUFFERED, FILE_ANY_ACCESS) +#define IOCTL_PROTOCOL_WRITE CTL_CODE(FILE_DEVICE_PROTOCOL, 5 , METHOD_BUFFERED, FILE_ANY_ACCESS) +#define IOCTL_PROTOCOL_MACNAME CTL_CODE(FILE_DEVICE_PROTOCOL, 6 , METHOD_BUFFERED, FILE_ANY_ACCESS) +#define IOCTL_OPEN CTL_CODE(FILE_DEVICE_PROTOCOL, 7 , METHOD_BUFFERED, FILE_ANY_ACCESS) +#define IOCTL_CLOSE CTL_CODE(FILE_DEVICE_PROTOCOL, 8 , METHOD_BUFFERED, FILE_ANY_ACCESS) + +#define pBIOCSETBUFFERSIZE 9592 ///< IOCTL code: set kernel buffer size. +#define pBIOCSETF 9030 ///< IOCTL code: set packet filtering program. +#define pBIOCGSTATS 9031 ///< IOCTL code: get the capture stats. +#define pBIOCSRTIMEOUT 7416 ///< IOCTL code: set the read timeout. +#define pBIOCSMODE 7412 ///< IOCTL code: set working mode. +#define pBIOCSWRITEREP 7413 ///< IOCTL code: set number of physical repetions of every packet written by the app. +#define pBIOCSMINTOCOPY 7414 ///< IOCTL code: set minimum amount of data in the kernel buffer that unlocks a read call. +#define pBIOCSETOID 2147483648 ///< IOCTL code: set an OID value. +#define pBIOCQUERYOID 2147483652 ///< IOCTL code: get an OID value. +#define pATTACHPROCESS 7117 ///< IOCTL code: attach a process to the driver. Used in Win9x only. +#define pDETACHPROCESS 7118 ///< IOCTL code: detach a process from the driver. Used in Win9x only. +#define pBIOCSETDUMPFILENAME 9029 ///< IOCTL code: set the name of a the file used by kernel dump mode. +#define pBIOCEVNAME 7415 ///< IOCTL code: get the name of the event that the driver signals when some data is present in the buffer. +#define pBIOCSENDPACKETSNOSYNC 9032 ///< IOCTL code: Send a buffer containing multiple packets to the network, ignoring the timestamps associated with the packets. +#define pBIOCSENDPACKETSSYNC 9033 ///< IOCTL code: Send a buffer containing multiple packets to the network, respecting the timestamps associated with the packets. +#define pBIOCSETDUMPLIMITS 9034 ///< IOCTL code: Set the dump file limits. See the PacketSetDumpLimits() function. +#define pBIOCISDUMPENDED 7411 ///< IOCTL code: Get the status of the kernel dump process. See the PacketIsDumpEnded() function. + +#define pBIOCSTIMEZONE 7471 ///< IOCTL code: set time zone. Used in Win9x only. + + +/// Alignment macro. Defines the alignment size. +#define Packet_ALIGNMENT sizeof(int) +/// Alignment macro. Rounds up to the next even multiple of Packet_ALIGNMENT. +#define Packet_WORDALIGN(x) (((x)+(Packet_ALIGNMENT-1))&~(Packet_ALIGNMENT-1)) + + +#define NdisMediumNull -1 // Custom linktype: NDIS doesn't provide an equivalent +#define NdisMediumCHDLC -2 // Custom linktype: NDIS doesn't provide an equivalent +#define NdisMediumPPPSerial -3 // Custom linktype: NDIS doesn't provide an equivalent + +/*! + \brief Network type structure. + + This structure is used by the PacketGetNetType() function to return information on the current adapter's type and speed. +*/ +typedef struct NetType +{ + UINT LinkType; ///< The MAC of the current network adapter (see function PacketGetNetType() for more information) + ULONGLONG LinkSpeed; ///< The speed of the network in bits per second +}NetType; + + +//some definitions stolen from libpcap + +#ifndef BPF_MAJOR_VERSION + +/*! + \brief A BPF pseudo-assembly program. + + The program will be injected in the kernel by the PacketSetBPF() function and applied to every incoming packet. +*/ +struct bpf_program +{ + UINT bf_len; ///< Indicates the number of instructions of the program, i.e. the number of struct bpf_insn that will follow. + struct bpf_insn *bf_insns; ///< A pointer to the first instruction of the program. +}; + +/*! + \brief A single BPF pseudo-instruction. + + bpf_insn contains a single instruction for the BPF register-machine. It is used to send a filter program to the driver. +*/ +struct bpf_insn +{ + USHORT code; ///< Instruction type and addressing mode. + UCHAR jt; ///< Jump if true + UCHAR jf; ///< Jump if false + int k; ///< Generic field used for various purposes. +}; + +/*! + \brief Structure that contains a couple of statistics values on the current capture. + + It is used by packet.dll to return statistics about a capture session. +*/ +struct bpf_stat +{ + UINT bs_recv; ///< Number of packets that the driver received from the network adapter + ///< from the beginning of the current capture. This value includes the packets + ///< lost by the driver. + UINT bs_drop; ///< number of packets that the driver lost from the beginning of a capture. + ///< Basically, a packet is lost when the the buffer of the driver is full. + ///< In this situation the packet cannot be stored and the driver rejects it. + UINT ps_ifdrop; ///< drops by interface. XXX not yet supported + UINT bs_capt; ///< number of packets that pass the filter, find place in the kernel buffer and + ///< thus reach the application. +}; + +/*! + \brief Packet header. + + This structure defines the header associated with every packet delivered to the application. +*/ +struct bpf_hdr +{ + struct timeval bh_tstamp; ///< The timestamp associated with the captured packet. + ///< It is stored in a TimeVal structure. + UINT bh_caplen; ///< Length of captured portion. The captured portion can be different + ///< from the original packet, because it is possible (with a proper filter) + ///< to instruct the driver to capture only a portion of the packets. + UINT bh_datalen; ///< Original length of packet + USHORT bh_hdrlen; ///< Length of bpf header (this struct plus alignment padding). In some cases, + ///< a padding could be added between the end of this structure and the packet + ///< data for performance reasons. This filed can be used to retrieve the actual data + ///< of the packet. +}; + +/*! + \brief Dump packet header. + + This structure defines the header associated with the packets in a buffer to be used with PacketSendPackets(). + It is simpler than the bpf_hdr, because it corresponds to the header associated by WinPcap and libpcap to a + packet in a dump file. This makes straightforward sending WinPcap dump files to the network. +*/ +struct dump_bpf_hdr{ + struct timeval ts; ///< Time stamp of the packet + UINT caplen; ///< Length of captured portion. The captured portion can smaller than the + ///< the original packet, because it is possible (with a proper filter) to + ///< instruct the driver to capture only a portion of the packets. + UINT len; ///< Length of the original packet (off wire). +}; + + +#endif + +#define DOSNAMEPREFIX TEXT("Packet_") ///< Prefix added to the adapters device names to create the WinPcap devices +#define MAX_LINK_NAME_LENGTH 64 //< Maximum length of the devices symbolic links +#define NMAX_PACKET 65535 + +/*! + \brief Addresses of a network adapter. + + This structure is used by the PacketGetNetInfoEx() function to return the IP addresses associated with + an adapter. +*/ +typedef struct npf_if_addr { + struct sockaddr_storage IPAddress; ///< IP address. + struct sockaddr_storage SubnetMask; ///< Netmask for that address. + struct sockaddr_storage Broadcast; ///< Broadcast address. +}npf_if_addr; + + +#define ADAPTER_NAME_LENGTH 256 + 12 ///< Maximum length for the name of an adapter. The value is the same used by the IP Helper API. +#define ADAPTER_DESC_LENGTH 128 ///< Maximum length for the description of an adapter. The value is the same used by the IP Helper API. +#define MAX_MAC_ADDR_LENGTH 8 ///< Maximum length for the link layer address of an adapter. The value is the same used by the IP Helper API. +#define MAX_NETWORK_ADDRESSES 16 ///< Maximum length for the link layer address of an adapter. The value is the same used by the IP Helper API. + + +typedef struct WAN_ADAPTER_INT WAN_ADAPTER; ///< Describes an opened wan (dialup, VPN...) network adapter using the NetMon API +typedef WAN_ADAPTER *PWAN_ADAPTER; ///< Describes an opened wan (dialup, VPN...) network adapter using the NetMon API + +#define INFO_FLAG_NDIS_ADAPTER 0 ///< Flag for ADAPTER_INFO: this is a traditional ndis adapter +#define INFO_FLAG_NDISWAN_ADAPTER 1 ///< Flag for ADAPTER_INFO: this is a NdisWan adapter +#define INFO_FLAG_DAG_CARD 2 ///< Flag for ADAPTER_INFO: this is a DAG card +#define INFO_FLAG_DAG_FILE 6 ///< Flag for ADAPTER_INFO: this is a DAG file +#define INFO_FLAG_DONT_EXPORT 8 ///< Flag for ADAPTER_INFO: when this flag is set, the adapter will not be listed or openend by winpcap. This allows to prevent exporting broken network adapters, like for example FireWire ones. + +/*! + \brief Contains comprehensive information about a network adapter. + + This structure is filled with all the accessory information that the user can need about an adapter installed + on his system. +*/ +typedef struct _ADAPTER_INFO +{ + struct _ADAPTER_INFO *Next; ///< Pointer to the next adapter in the list. + CHAR Name[ADAPTER_NAME_LENGTH + 1]; ///< Name of the device representing the adapter. + CHAR Description[ADAPTER_DESC_LENGTH + 1]; ///< Human understandable description of the adapter + UINT MacAddressLen; ///< Length of the link layer address. + UCHAR MacAddress[MAX_MAC_ADDR_LENGTH]; ///< Link layer address. + NetType LinkLayer; ///< Physical characteristics of this adapter. This NetType structure contains the link type and the speed of the adapter. + INT NNetworkAddresses; ///< Number of network layer addresses of this adapter. + npf_if_addr *NetworkAddresses; ///< Pointer to an array of npf_if_addr, each of which specifies a network address of this adapter. + UINT Flags; ///< Adapter's flags. Tell if this adapter must be treated in a different way, using the Netmon API or the dagc API. +} +ADAPTER_INFO, *PADAPTER_INFO; + +/*! + \brief Describes an opened network adapter. + + This structure is the most important for the functioning of packet.dll, but the great part of its fields + should be ignored by the user, since the library offers functions that avoid to cope with low-level parameters +*/ +typedef struct _ADAPTER { + HANDLE hFile; ///< \internal Handle to an open instance of the NPF driver. + CHAR SymbolicLink[MAX_LINK_NAME_LENGTH]; ///< \internal A string containing the name of the network adapter currently opened. + int NumWrites; ///< \internal Number of times a packets written on this adapter will be repeated + ///< on the wire. + HANDLE ReadEvent; ///< A notification event associated with the read calls on the adapter. + ///< It can be passed to standard Win32 functions (like WaitForSingleObject + ///< or WaitForMultipleObjects) to wait until the driver's buffer contains some + ///< data. It is particularly useful in GUI applications that need to wait + ///< concurrently on several events. In Windows NT/2000 the PacketSetMinToCopy() + ///< function can be used to define the minimum amount of data in the kernel buffer + ///< that will cause the event to be signalled. + + UINT ReadTimeOut; ///< \internal The amount of time after which a read on the driver will be released and + ///< ReadEvent will be signaled, also if no packets were captured + CHAR Name[ADAPTER_NAME_LENGTH]; + PWAN_ADAPTER pWanAdapter; + UINT Flags; ///< Adapter's flags. Tell if this adapter must be treated in a different way, using the Netmon API or the dagc API. +#ifdef HAVE_DAG_API + dagc_t *pDagCard; ///< Pointer to the dagc API adapter descriptor for this adapter + PCHAR DagBuffer; ///< Pointer to the buffer with the packets that is received from the DAG card + struct timeval DagReadTimeout; ///< Read timeout. The dagc API requires a timeval structure + unsigned DagFcsLen; ///< Length of the frame check sequence attached to any packet by the card. Obtained from the registry + DWORD DagFastProcess; ///< True if the user requests fast capture processing on this card. Higher level applications can use this value to provide a faster but possibly unprecise capture (for example, libpcap doesn't convert the timestamps). +#endif // HAVE_DAG_API +} ADAPTER, *LPADAPTER; + +/*! + \brief Structure that contains a group of packets coming from the driver. + + This structure defines the header associated with every packet delivered to the application. +*/ +typedef struct _PACKET { + HANDLE hEvent; ///< \deprecated Still present for compatibility with old applications. + OVERLAPPED OverLapped; ///< \deprecated Still present for compatibility with old applications. + PVOID Buffer; ///< Buffer with containing the packets. See the PacketReceivePacket() for + ///< details about the organization of the data in this buffer + UINT Length; ///< Length of the buffer + DWORD ulBytesReceived; ///< Number of valid bytes present in the buffer, i.e. amount of data + ///< received by the last call to PacketReceivePacket() + BOOLEAN bIoComplete; ///< \deprecated Still present for compatibility with old applications. +} PACKET, *LPPACKET; + +/*! + \brief Structure containing an OID request. + + It is used by the PacketRequest() function to send an OID to the interface card driver. + It can be used, for example, to retrieve the status of the error counters on the adapter, its MAC address, + the list of the multicast groups defined on it, and so on. +*/ +struct _PACKET_OID_DATA { + ULONG Oid; ///< OID code. See the Microsoft DDK documentation or the file ntddndis.h + ///< for a complete list of valid codes. + ULONG Length; ///< Length of the data field + UCHAR Data[1]; ///< variable-length field that contains the information passed to or received + ///< from the adapter. +}; +typedef struct _PACKET_OID_DATA PACKET_OID_DATA, *PPACKET_OID_DATA; + + +#if _DBG +#define ODS(_x) OutputDebugString(TEXT(_x)) +#define ODSEx(_x, _y) +#else +#ifdef _DEBUG_TO_FILE +/*! + \brief Macro to print a debug string. The behavior differs depending on the debug level +*/ +#define ODS(_x) { \ + FILE *f; \ + f = fopen("winpcap_debug.txt", "a"); \ + fprintf(f, "%s", _x); \ + fclose(f); \ +} +/*! + \brief Macro to print debug data with the printf convention. The behavior differs depending on + the debug level +*/ +#define ODSEx(_x, _y) { \ + FILE *f; \ + f = fopen("winpcap_debug.txt", "a"); \ + fprintf(f, _x, _y); \ + fclose(f); \ +} + + + +LONG PacketDumpRegistryKey(PCHAR KeyName, PCHAR FileName); +#else +#define ODS(_x) +#define ODSEx(_x, _y) +#endif +#endif + +/* We load dynamically the dag library in order link it only when it's present on the system */ +#ifdef HAVE_DAG_API +typedef dagc_t* (*dagc_open_handler)(const char *source, unsigned flags, char *ebuf); ///< prototype used to dynamically load the dag dll +typedef void (*dagc_close_handler)(dagc_t *dagcfd); ///< prototype used to dynamically load the dag dll +typedef int (*dagc_getlinktype_handler)(dagc_t *dagcfd); ///< prototype used to dynamically load the dag dll +typedef int (*dagc_getlinkspeed_handler)(dagc_t *dagcfd); ///< prototype used to dynamically load the dag dll +typedef int (*dagc_setsnaplen_handler)(dagc_t *dagcfd, unsigned snaplen); ///< prototype used to dynamically load the dag dll +typedef unsigned (*dagc_getfcslen_handler)(dagc_t *dagcfd); ///< prototype used to dynamically load the dag dll +typedef int (*dagc_receive_handler)(dagc_t *dagcfd, u_char **buffer, u_int *bufsize); ///< prototype used to dynamically load the dag dll +typedef int (*dagc_stats_handler)(dagc_t *dagcfd, dagc_stats_t *ps); ///< prototype used to dynamically load the dag dll +typedef int (*dagc_wait_handler)(dagc_t *dagcfd, struct timeval *timeout); ///< prototype used to dynamically load the dag dll +typedef int (*dagc_finddevs_handler)(dagc_if_t **alldevsp, char *ebuf); ///< prototype used to dynamically load the dag dll +typedef int (*dagc_freedevs_handler)(dagc_if_t *alldevsp); ///< prototype used to dynamically load the dag dll +#endif // HAVE_DAG_API + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * @} + */ + +// The following is used to check the adapter name in PacketOpenAdapterNPF and prevent +// opening of firewire adapters +#define FIREWIRE_SUBSTR L"1394" + +void PacketPopulateAdaptersInfoList(); +PWCHAR SChar2WChar(PCHAR string); +PCHAR WChar2SChar(PWCHAR string); +BOOL PacketGetFileVersion(LPTSTR FileName, PCHAR VersionBuff, UINT VersionBuffLen); +PADAPTER_INFO PacketFindAdInfo(PCHAR AdapterName); +BOOLEAN PacketUpdateAdInfo(PCHAR AdapterName); +BOOLEAN IsFireWire(TCHAR *AdapterDesc); + + +//--------------------------------------------------------------------------- +// EXPORTED FUNCTIONS +//--------------------------------------------------------------------------- + +PCHAR PacketGetVersion(); +PCHAR PacketGetDriverVersion(); +BOOLEAN PacketSetMinToCopy(LPADAPTER AdapterObject,int nbytes); +BOOLEAN PacketSetNumWrites(LPADAPTER AdapterObject,int nwrites); +BOOLEAN PacketSetMode(LPADAPTER AdapterObject,int mode); +BOOLEAN PacketSetReadTimeout(LPADAPTER AdapterObject,int timeout); +BOOLEAN PacketSetBpf(LPADAPTER AdapterObject,struct bpf_program *fp); +INT PacketSetSnapLen(LPADAPTER AdapterObject,int snaplen); +BOOLEAN PacketGetStats(LPADAPTER AdapterObject,struct bpf_stat *s); +BOOLEAN PacketGetStatsEx(LPADAPTER AdapterObject,struct bpf_stat *s); +BOOLEAN PacketSetBuff(LPADAPTER AdapterObject,int dim); +BOOLEAN PacketGetNetType (LPADAPTER AdapterObject,NetType *type); +LPADAPTER PacketOpenAdapter(PCHAR AdapterName); +BOOLEAN PacketSendPacket(LPADAPTER AdapterObject,LPPACKET pPacket,BOOLEAN Sync); +INT PacketSendPackets(LPADAPTER AdapterObject,PVOID PacketBuff,ULONG Size, BOOLEAN Sync); +LPPACKET PacketAllocatePacket(void); +VOID PacketInitPacket(LPPACKET lpPacket,PVOID Buffer,UINT Length); +VOID PacketFreePacket(LPPACKET lpPacket); +BOOLEAN PacketReceivePacket(LPADAPTER AdapterObject,LPPACKET lpPacket,BOOLEAN Sync); +BOOLEAN PacketSetHwFilter(LPADAPTER AdapterObject,ULONG Filter); +BOOLEAN PacketGetAdapterNames(PTSTR pStr,PULONG BufferSize); +BOOLEAN PacketGetNetInfoEx(PCHAR AdapterName, npf_if_addr* buffer, PLONG NEntries); +BOOLEAN PacketRequest(LPADAPTER AdapterObject,BOOLEAN Set,PPACKET_OID_DATA OidData); +HANDLE PacketGetReadEvent(LPADAPTER AdapterObject); +BOOLEAN PacketSetDumpName(LPADAPTER AdapterObject, void *name, int len); +BOOLEAN PacketSetDumpLimits(LPADAPTER AdapterObject, UINT maxfilesize, UINT maxnpacks); +BOOLEAN PacketIsDumpEnded(LPADAPTER AdapterObject, BOOLEAN sync); +BOOL PacketStopDriver(); +VOID PacketCloseAdapter(LPADAPTER lpAdapter); + +#ifdef __cplusplus +} +#endif + +#endif //__PACKET32 diff --git a/src/Cedar/winpcap/Win32-Extensions.h b/src/Cedar/winpcap/Win32-Extensions.h index 8466e0c2..cd6fc642 100644 --- a/src/Cedar/winpcap/Win32-Extensions.h +++ b/src/Cedar/winpcap/Win32-Extensions.h @@ -1,86 +1,86 @@ -/* - * Copyright (c) 1999 - 2003 - * NetGroup, Politecnico di Torino (Italy) - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the Politecnico di Torino nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - */ - -/* Definitions */ - -/*! - \brief A queue of raw packets that will be sent to the network with pcap_sendqueue_transmit(). -*/ -struct pcap_send_queue{ - u_int maxlen; ///< Maximum size of the the queue, in bytes. This variable contains the size of the buffer field. - u_int len; ///< Current size of the queue, in bytes. - char *buffer; ///< Buffer containing the packets to be sent. -}; - -typedef struct pcap_send_queue pcap_send_queue; - -#define BPF_MEM_EX_IMM 0xc0 -#define BPF_MEM_EX_IND 0xe0 - -/*used for ST*/ -#define BPF_MEM_EX 0xc0 -#define BPF_TME 0x08 - -#define BPF_LOOKUP 0x90 -#define BPF_EXECUTE 0xa0 -#define BPF_INIT 0xb0 -#define BPF_VALIDATE 0xc0 -#define BPF_SET_ACTIVE 0xd0 -#define BPF_RESET 0xe0 -#define BPF_SET_MEMORY 0x80 -#define BPF_GET_REGISTER_VALUE 0x70 -#define BPF_SET_REGISTER_VALUE 0x60 -#define BPF_SET_WORKING 0x50 -#define BPF_SET_ACTIVE_READ 0x40 -#define BPF_SET_AUTODELETION 0x30 -#define BPF_SEPARATION 0xff - -/* Prototypes */ -pcap_send_queue* pcap_sendqueue_alloc(u_int memsize); - -void pcap_sendqueue_destroy(pcap_send_queue* queue); - -int pcap_sendqueue_queue(pcap_send_queue* queue, const struct pcap_pkthdr *pkt_header, const u_char *pkt_data); - -u_int pcap_sendqueue_transmit(pcap_t *p, pcap_send_queue* queue, int sync); - -HANDLE pcap_getevent(pcap_t *p); - -struct pcap_stat *pcap_stats_ex(pcap_t *p, int *pcap_stat_size); - -int pcap_setuserbuffer(pcap_t *p, int size); - -int pcap_live_dump(pcap_t *p, char *filename, int maxsize, int maxpacks); - -int pcap_live_dump_ended(pcap_t *p, int sync); - -int pcap_offline_filter(struct bpf_program *prog, const struct pcap_pkthdr *header, const u_char *pkt_data); +/* + * Copyright (c) 1999 - 2003 + * NetGroup, Politecnico di Torino (Italy) + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the Politecnico di Torino nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +/* Definitions */ + +/*! + \brief A queue of raw packets that will be sent to the network with pcap_sendqueue_transmit(). +*/ +struct pcap_send_queue{ + u_int maxlen; ///< Maximum size of the the queue, in bytes. This variable contains the size of the buffer field. + u_int len; ///< Current size of the queue, in bytes. + char *buffer; ///< Buffer containing the packets to be sent. +}; + +typedef struct pcap_send_queue pcap_send_queue; + +#define BPF_MEM_EX_IMM 0xc0 +#define BPF_MEM_EX_IND 0xe0 + +/*used for ST*/ +#define BPF_MEM_EX 0xc0 +#define BPF_TME 0x08 + +#define BPF_LOOKUP 0x90 +#define BPF_EXECUTE 0xa0 +#define BPF_INIT 0xb0 +#define BPF_VALIDATE 0xc0 +#define BPF_SET_ACTIVE 0xd0 +#define BPF_RESET 0xe0 +#define BPF_SET_MEMORY 0x80 +#define BPF_GET_REGISTER_VALUE 0x70 +#define BPF_SET_REGISTER_VALUE 0x60 +#define BPF_SET_WORKING 0x50 +#define BPF_SET_ACTIVE_READ 0x40 +#define BPF_SET_AUTODELETION 0x30 +#define BPF_SEPARATION 0xff + +/* Prototypes */ +pcap_send_queue* pcap_sendqueue_alloc(u_int memsize); + +void pcap_sendqueue_destroy(pcap_send_queue* queue); + +int pcap_sendqueue_queue(pcap_send_queue* queue, const struct pcap_pkthdr *pkt_header, const u_char *pkt_data); + +u_int pcap_sendqueue_transmit(pcap_t *p, pcap_send_queue* queue, int sync); + +HANDLE pcap_getevent(pcap_t *p); + +struct pcap_stat *pcap_stats_ex(pcap_t *p, int *pcap_stat_size); + +int pcap_setuserbuffer(pcap_t *p, int size); + +int pcap_live_dump(pcap_t *p, char *filename, int maxsize, int maxpacks); + +int pcap_live_dump_ended(pcap_t *p, int sync); + +int pcap_offline_filter(struct bpf_program *prog, const struct pcap_pkthdr *header, const u_char *pkt_data); diff --git a/src/Cedar/winpcap/bittypes.h b/src/Cedar/winpcap/bittypes.h index 1a2611d8..c84077af 100644 --- a/src/Cedar/winpcap/bittypes.h +++ b/src/Cedar/winpcap/bittypes.h @@ -1,135 +1,135 @@ -/* - * Copyright (C) 1999 WIDE Project. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the project nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ -#ifndef _BITTYPES_H -#define _BITTYPES_H - -#ifndef HAVE_U_INT8_T - -#if SIZEOF_CHAR == 1 -typedef unsigned char u_int8_t; -typedef signed char int8_t; -#elif SIZEOF_INT == 1 -typedef unsigned int u_int8_t; -typedef signed int int8_t; -#else /* XXX */ -#error "there's no appropriate type for u_int8_t" -#endif -#define HAVE_U_INT8_T 1 -#define HAVE_INT8_T 1 - -#endif /* HAVE_U_INT8_T */ - -#ifndef HAVE_U_INT16_T - -#if SIZEOF_SHORT == 2 -typedef unsigned short u_int16_t; -typedef signed short int16_t; -#elif SIZEOF_INT == 2 -typedef unsigned int u_int16_t; -typedef signed int int16_t; -#elif SIZEOF_CHAR == 2 -typedef unsigned char u_int16_t; -typedef signed char int16_t; -#else /* XXX */ -#error "there's no appropriate type for u_int16_t" -#endif -#define HAVE_U_INT16_T 1 -#define HAVE_INT16_T 1 - -#endif /* HAVE_U_INT16_T */ - -#ifndef HAVE_U_INT32_T - -#if SIZEOF_INT == 4 -typedef unsigned int u_int32_t; -typedef signed int int32_t; -#elif SIZEOF_LONG == 4 -typedef unsigned long u_int32_t; -typedef signed long int32_t; -#elif SIZEOF_SHORT == 4 -typedef unsigned short u_int32_t; -typedef signed short int32_t; -#else /* XXX */ -#error "there's no appropriate type for u_int32_t" -#endif -#define HAVE_U_INT32_T 1 -#define HAVE_INT32_T 1 - -#endif /* HAVE_U_INT32_T */ - -#ifndef HAVE_U_INT64_T -#if SIZEOF_LONG_LONG == 8 -typedef unsigned long long u_int64_t; -#elif defined(_MSC_EXTENSIONS) -typedef unsigned _int64 u_int64_t; -#elif SIZEOF_INT == 8 -typedef unsigned int u_int64_t; -#elif SIZEOF_LONG == 8 -typedef unsigned long u_int64_t; -#elif SIZEOF_SHORT == 8 -typedef unsigned short u_int64_t; -#else /* XXX */ -#error "there's no appropriate type for u_int64_t" -#endif - -#endif /* HAVE_U_INT64_T */ - -#ifndef PRId64 -#ifdef _MSC_EXTENSIONS -#define PRId64 "I64d" -#else /* _MSC_EXTENSIONS */ -#define PRId64 "lld" -#endif /* _MSC_EXTENSIONS */ -#endif /* PRId64 */ - -#ifndef PRIo64 -#ifdef _MSC_EXTENSIONS -#define PRIo64 "I64o" -#else /* _MSC_EXTENSIONS */ -#define PRIo64 "llo" -#endif /* _MSC_EXTENSIONS */ -#endif /* PRIo64 */ - -#ifndef PRIx64 -#ifdef _MSC_EXTENSIONS -#define PRIx64 "I64x" -#else /* _MSC_EXTENSIONS */ -#define PRIx64 "llx" -#endif /* _MSC_EXTENSIONS */ -#endif /* PRIx64 */ - -#ifndef PRIu64 -#ifdef _MSC_EXTENSIONS -#define PRIu64 "I64u" -#else /* _MSC_EXTENSIONS */ -#define PRIu64 "llu" -#endif /* _MSC_EXTENSIONS */ -#endif /* PRIu64 */ - -#endif /* _BITTYPES_H */ +/* + * Copyright (C) 1999 WIDE Project. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the project nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ +#ifndef _BITTYPES_H +#define _BITTYPES_H + +#ifndef HAVE_U_INT8_T + +#if SIZEOF_CHAR == 1 +typedef unsigned char u_int8_t; +typedef signed char int8_t; +#elif SIZEOF_INT == 1 +typedef unsigned int u_int8_t; +typedef signed int int8_t; +#else /* XXX */ +#error "there's no appropriate type for u_int8_t" +#endif +#define HAVE_U_INT8_T 1 +#define HAVE_INT8_T 1 + +#endif /* HAVE_U_INT8_T */ + +#ifndef HAVE_U_INT16_T + +#if SIZEOF_SHORT == 2 +typedef unsigned short u_int16_t; +typedef signed short int16_t; +#elif SIZEOF_INT == 2 +typedef unsigned int u_int16_t; +typedef signed int int16_t; +#elif SIZEOF_CHAR == 2 +typedef unsigned char u_int16_t; +typedef signed char int16_t; +#else /* XXX */ +#error "there's no appropriate type for u_int16_t" +#endif +#define HAVE_U_INT16_T 1 +#define HAVE_INT16_T 1 + +#endif /* HAVE_U_INT16_T */ + +#ifndef HAVE_U_INT32_T + +#if SIZEOF_INT == 4 +typedef unsigned int u_int32_t; +typedef signed int int32_t; +#elif SIZEOF_LONG == 4 +typedef unsigned long u_int32_t; +typedef signed long int32_t; +#elif SIZEOF_SHORT == 4 +typedef unsigned short u_int32_t; +typedef signed short int32_t; +#else /* XXX */ +#error "there's no appropriate type for u_int32_t" +#endif +#define HAVE_U_INT32_T 1 +#define HAVE_INT32_T 1 + +#endif /* HAVE_U_INT32_T */ + +#ifndef HAVE_U_INT64_T +#if SIZEOF_LONG_LONG == 8 +typedef unsigned long long u_int64_t; +#elif defined(_MSC_EXTENSIONS) +typedef unsigned _int64 u_int64_t; +#elif SIZEOF_INT == 8 +typedef unsigned int u_int64_t; +#elif SIZEOF_LONG == 8 +typedef unsigned long u_int64_t; +#elif SIZEOF_SHORT == 8 +typedef unsigned short u_int64_t; +#else /* XXX */ +#error "there's no appropriate type for u_int64_t" +#endif + +#endif /* HAVE_U_INT64_T */ + +#ifndef PRId64 +#ifdef _MSC_EXTENSIONS +#define PRId64 "I64d" +#else /* _MSC_EXTENSIONS */ +#define PRId64 "lld" +#endif /* _MSC_EXTENSIONS */ +#endif /* PRId64 */ + +#ifndef PRIo64 +#ifdef _MSC_EXTENSIONS +#define PRIo64 "I64o" +#else /* _MSC_EXTENSIONS */ +#define PRIo64 "llo" +#endif /* _MSC_EXTENSIONS */ +#endif /* PRIo64 */ + +#ifndef PRIx64 +#ifdef _MSC_EXTENSIONS +#define PRIx64 "I64x" +#else /* _MSC_EXTENSIONS */ +#define PRIx64 "llx" +#endif /* _MSC_EXTENSIONS */ +#endif /* PRIx64 */ + +#ifndef PRIu64 +#ifdef _MSC_EXTENSIONS +#define PRIu64 "I64u" +#else /* _MSC_EXTENSIONS */ +#define PRIu64 "llu" +#endif /* _MSC_EXTENSIONS */ +#endif /* PRIu64 */ + +#endif /* _BITTYPES_H */ diff --git a/src/Cedar/winpcap/bucket_lookup.h b/src/Cedar/winpcap/bucket_lookup.h index d8700b54..fbd1ef0b 100644 --- a/src/Cedar/winpcap/bucket_lookup.h +++ b/src/Cedar/winpcap/bucket_lookup.h @@ -1,54 +1,54 @@ -/* - * Copyright (c) 2001 - 2003 - * NetGroup, Politecnico di Torino (Italy) - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the Politecnico di Torino nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - */ - -#ifndef __bucket_lookup -#define __bucket_lookup -#ifdef WIN32 -#include "tme.h" -#endif - -#ifdef __FreeBSD__ - -#ifdef _KERNEL -#include -#else -#include -#endif - -#endif - -#define BUCKET_LOOKUP_INSERT 0x00000011 -uint32 bucket_lookup_insert(uint8 *key, TME_DATA *data, MEM_TYPE *mem_ex, struct time_conv *time_ref); -#define BUCKET_LOOKUP 0x00000010 -uint32 bucket_lookup(uint8 *key, TME_DATA *data, MEM_TYPE *mem_ex, struct time_conv *time_ref); - -#endif +/* + * Copyright (c) 2001 - 2003 + * NetGroup, Politecnico di Torino (Italy) + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the Politecnico di Torino nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#ifndef __bucket_lookup +#define __bucket_lookup +#ifdef WIN32 +#include "tme.h" +#endif + +#ifdef __FreeBSD__ + +#ifdef _KERNEL +#include +#else +#include +#endif + +#endif + +#define BUCKET_LOOKUP_INSERT 0x00000011 +uint32 bucket_lookup_insert(uint8 *key, TME_DATA *data, MEM_TYPE *mem_ex, struct time_conv *time_ref); +#define BUCKET_LOOKUP 0x00000010 +uint32 bucket_lookup(uint8 *key, TME_DATA *data, MEM_TYPE *mem_ex, struct time_conv *time_ref); + +#endif diff --git a/src/Cedar/winpcap/count_packets.h b/src/Cedar/winpcap/count_packets.h index 9853bda3..2cd1af59 100644 --- a/src/Cedar/winpcap/count_packets.h +++ b/src/Cedar/winpcap/count_packets.h @@ -1,62 +1,62 @@ -/* - * Copyright (c) 2001 - 2003 - * NetGroup, Politecnico di Torino (Italy) - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the Politecnico di Torino nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - */ - -#ifndef __count_packets -#define __count_packets - -#ifdef WIN32 -#include "tme.h" -#endif - -#ifdef __FreeBSD__ - -#ifdef _KERNEL -#include -#else -#include -#endif - -#endif - -typedef struct __c_p_data -{ - struct timeval timestamp; - uint64 packets; - uint64 bytes; -} - c_p_data; - -#define COUNT_PACKETS 0x00000000 -uint32 count_packets(uint8 *block, uint32 pkt_size, TME_DATA *data, MEM_TYPE *mem_ex, uint8 *mem_data); - -#endif - +/* + * Copyright (c) 2001 - 2003 + * NetGroup, Politecnico di Torino (Italy) + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the Politecnico di Torino nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#ifndef __count_packets +#define __count_packets + +#ifdef WIN32 +#include "tme.h" +#endif + +#ifdef __FreeBSD__ + +#ifdef _KERNEL +#include +#else +#include +#endif + +#endif + +typedef struct __c_p_data +{ + struct timeval timestamp; + uint64 packets; + uint64 bytes; +} + c_p_data; + +#define COUNT_PACKETS 0x00000000 +uint32 count_packets(uint8 *block, uint32 pkt_size, TME_DATA *data, MEM_TYPE *mem_ex, uint8 *mem_data); + +#endif + diff --git a/src/Cedar/winpcap/ip6_misc.h b/src/Cedar/winpcap/ip6_misc.h index 1965ecab..a9c5cf3b 100644 --- a/src/Cedar/winpcap/ip6_misc.h +++ b/src/Cedar/winpcap/ip6_misc.h @@ -1,163 +1,163 @@ -/* - * Copyright (c) 1993, 1994, 1997 - * The Regents of the University of California. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that: (1) source code distributions - * retain the above copyright notice and this paragraph in its entirety, (2) - * distributions including binary code include the above copyright notice and - * this paragraph in its entirety in the documentation or other materials - * provided with the distribution, and (3) all advertising materials mentioning - * features or use of this software display the following acknowledgement: - * ``This product includes software developed by the University of California, - * Lawrence Berkeley Laboratory and its contributors.'' Neither the name of - * the University nor the names of its contributors may be used to endorse - * or promote products derived from this software without specific prior - * written permission. - * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. - * - * @(#) $Header: /tcpdump/master/libpcap/Win32/Include/ip6_misc.h,v 1.4 2004/07/06 23:45:29 risso Exp $ (LBL) - */ - -/* - * This file contains a collage of declarations for IPv6 from FreeBSD not present in Windows - */ - -#include - -#ifndef __MINGW32__ -#include -#endif /* __MINGW32__ */ - -#define IN_MULTICAST(a) IN_CLASSD(a) - -#define IN_EXPERIMENTAL(a) ((((u_int32_t) (a)) & 0xf0000000) == 0xf0000000) - -#define IN_LOOPBACKNET 127 - -#ifdef __MINGW32__ -/* IPv6 address */ -struct in6_addr - { - union - { - u_int8_t u6_addr8[16]; - u_int16_t u6_addr16[8]; - u_int32_t u6_addr32[4]; - } in6_u; -#define s6_addr in6_u.u6_addr8 -#define s6_addr16 in6_u.u6_addr16 -#define s6_addr32 in6_u.u6_addr32 -#define s6_addr64 in6_u.u6_addr64 - }; - -#define IN6ADDR_ANY_INIT { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 } -#define IN6ADDR_LOOPBACK_INIT { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1 } -#endif /* __MINGW32__ */ - - -#if (defined WIN32) || (defined __MINGW32__) -typedef unsigned short sa_family_t; -#endif - - -#ifdef __MINGW32__ - -#define __SOCKADDR_COMMON(sa_prefix) \ - sa_family_t sa_prefix##family - -/* Ditto, for IPv6. */ -struct sockaddr_in6 - { - __SOCKADDR_COMMON (sin6_); - u_int16_t sin6_port; /* Transport layer port # */ - u_int32_t sin6_flowinfo; /* IPv6 flow information */ - struct in6_addr sin6_addr; /* IPv6 address */ - }; - -#define IN6_IS_ADDR_V4MAPPED(a) \ - ((((u_int32_t *) (a))[0] == 0) && (((u_int32_t *) (a))[1] == 0) && \ - (((u_int32_t *) (a))[2] == htonl (0xffff))) - -#define IN6_IS_ADDR_MULTICAST(a) (((u_int8_t *) (a))[0] == 0xff) - -#define IN6_IS_ADDR_LINKLOCAL(a) \ - ((((u_int32_t *) (a))[0] & htonl (0xffc00000)) == htonl (0xfe800000)) - -#define IN6_IS_ADDR_LOOPBACK(a) \ - (((u_int32_t *) (a))[0] == 0 && ((u_int32_t *) (a))[1] == 0 && \ - ((u_int32_t *) (a))[2] == 0 && ((u_int32_t *) (a))[3] == htonl (1)) -#endif /* __MINGW32__ */ - -#define ip6_vfc ip6_ctlun.ip6_un2_vfc -#define ip6_flow ip6_ctlun.ip6_un1.ip6_un1_flow -#define ip6_plen ip6_ctlun.ip6_un1.ip6_un1_plen -#define ip6_nxt ip6_ctlun.ip6_un1.ip6_un1_nxt -#define ip6_hlim ip6_ctlun.ip6_un1.ip6_un1_hlim -#define ip6_hops ip6_ctlun.ip6_un1.ip6_un1_hlim - -#define nd_rd_type nd_rd_hdr.icmp6_type -#define nd_rd_code nd_rd_hdr.icmp6_code -#define nd_rd_cksum nd_rd_hdr.icmp6_cksum -#define nd_rd_reserved nd_rd_hdr.icmp6_data32[0] - -/* - * IPV6 extension headers - */ -#define IPPROTO_HOPOPTS 0 /* IPv6 hop-by-hop options */ -#define IPPROTO_IPV6 41 /* IPv6 header. */ -#define IPPROTO_ROUTING 43 /* IPv6 routing header */ -#define IPPROTO_FRAGMENT 44 /* IPv6 fragmentation header */ -#define IPPROTO_ESP 50 /* encapsulating security payload */ -#define IPPROTO_AH 51 /* authentication header */ -#define IPPROTO_ICMPV6 58 /* ICMPv6 */ -#define IPPROTO_NONE 59 /* IPv6 no next header */ -#define IPPROTO_DSTOPTS 60 /* IPv6 destination options */ -#define IPPROTO_PIM 103 /* Protocol Independent Multicast. */ - -#define IPV6_RTHDR_TYPE_0 0 - -/* Option types and related macros */ -#define IP6OPT_PAD1 0x00 /* 00 0 00000 */ -#define IP6OPT_PADN 0x01 /* 00 0 00001 */ -#define IP6OPT_JUMBO 0xC2 /* 11 0 00010 = 194 */ -#define IP6OPT_JUMBO_LEN 6 -#define IP6OPT_ROUTER_ALERT 0x05 /* 00 0 00101 */ - -#define IP6OPT_RTALERT_LEN 4 -#define IP6OPT_RTALERT_MLD 0 /* Datagram contains an MLD message */ -#define IP6OPT_RTALERT_RSVP 1 /* Datagram contains an RSVP message */ -#define IP6OPT_RTALERT_ACTNET 2 /* contains an Active Networks msg */ -#define IP6OPT_MINLEN 2 - -#define IP6OPT_BINDING_UPDATE 0xc6 /* 11 0 00110 */ -#define IP6OPT_BINDING_ACK 0x07 /* 00 0 00111 */ -#define IP6OPT_BINDING_REQ 0x08 /* 00 0 01000 */ -#define IP6OPT_HOME_ADDRESS 0xc9 /* 11 0 01001 */ -#define IP6OPT_EID 0x8a /* 10 0 01010 */ - -#define IP6OPT_TYPE(o) ((o) & 0xC0) -#define IP6OPT_TYPE_SKIP 0x00 -#define IP6OPT_TYPE_DISCARD 0x40 -#define IP6OPT_TYPE_FORCEICMP 0x80 -#define IP6OPT_TYPE_ICMP 0xC0 - -#define IP6OPT_MUTABLE 0x20 - - -#ifdef __MINGW32__ -#ifndef EAI_ADDRFAMILY -struct addrinfo { - int ai_flags; /* AI_PASSIVE, AI_CANONNAME */ - int ai_family; /* PF_xxx */ - int ai_socktype; /* SOCK_xxx */ - int ai_protocol; /* 0 or IPPROTO_xxx for IPv4 and IPv6 */ - size_t ai_addrlen; /* length of ai_addr */ - char *ai_canonname; /* canonical name for hostname */ - struct sockaddr *ai_addr; /* binary address */ - struct addrinfo *ai_next; /* next structure in linked list */ -}; -#endif -#endif /* __MINGW32__ */ +/* + * Copyright (c) 1993, 1994, 1997 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that: (1) source code distributions + * retain the above copyright notice and this paragraph in its entirety, (2) + * distributions including binary code include the above copyright notice and + * this paragraph in its entirety in the documentation or other materials + * provided with the distribution, and (3) all advertising materials mentioning + * features or use of this software display the following acknowledgement: + * ``This product includes software developed by the University of California, + * Lawrence Berkeley Laboratory and its contributors.'' Neither the name of + * the University nor the names of its contributors may be used to endorse + * or promote products derived from this software without specific prior + * written permission. + * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + * + * @(#) $Header: /tcpdump/master/libpcap/Win32/Include/ip6_misc.h,v 1.4 2004/07/06 23:45:29 risso Exp $ (LBL) + */ + +/* + * This file contains a collage of declarations for IPv6 from FreeBSD not present in Windows + */ + +#include + +#ifndef __MINGW32__ +#include +#endif /* __MINGW32__ */ + +#define IN_MULTICAST(a) IN_CLASSD(a) + +#define IN_EXPERIMENTAL(a) ((((u_int32_t) (a)) & 0xf0000000) == 0xf0000000) + +#define IN_LOOPBACKNET 127 + +#ifdef __MINGW32__ +/* IPv6 address */ +struct in6_addr + { + union + { + u_int8_t u6_addr8[16]; + u_int16_t u6_addr16[8]; + u_int32_t u6_addr32[4]; + } in6_u; +#define s6_addr in6_u.u6_addr8 +#define s6_addr16 in6_u.u6_addr16 +#define s6_addr32 in6_u.u6_addr32 +#define s6_addr64 in6_u.u6_addr64 + }; + +#define IN6ADDR_ANY_INIT { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 } +#define IN6ADDR_LOOPBACK_INIT { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1 } +#endif /* __MINGW32__ */ + + +#if (defined WIN32) || (defined __MINGW32__) +typedef unsigned short sa_family_t; +#endif + + +#ifdef __MINGW32__ + +#define __SOCKADDR_COMMON(sa_prefix) \ + sa_family_t sa_prefix##family + +/* Ditto, for IPv6. */ +struct sockaddr_in6 + { + __SOCKADDR_COMMON (sin6_); + u_int16_t sin6_port; /* Transport layer port # */ + u_int32_t sin6_flowinfo; /* IPv6 flow information */ + struct in6_addr sin6_addr; /* IPv6 address */ + }; + +#define IN6_IS_ADDR_V4MAPPED(a) \ + ((((u_int32_t *) (a))[0] == 0) && (((u_int32_t *) (a))[1] == 0) && \ + (((u_int32_t *) (a))[2] == htonl (0xffff))) + +#define IN6_IS_ADDR_MULTICAST(a) (((u_int8_t *) (a))[0] == 0xff) + +#define IN6_IS_ADDR_LINKLOCAL(a) \ + ((((u_int32_t *) (a))[0] & htonl (0xffc00000)) == htonl (0xfe800000)) + +#define IN6_IS_ADDR_LOOPBACK(a) \ + (((u_int32_t *) (a))[0] == 0 && ((u_int32_t *) (a))[1] == 0 && \ + ((u_int32_t *) (a))[2] == 0 && ((u_int32_t *) (a))[3] == htonl (1)) +#endif /* __MINGW32__ */ + +#define ip6_vfc ip6_ctlun.ip6_un2_vfc +#define ip6_flow ip6_ctlun.ip6_un1.ip6_un1_flow +#define ip6_plen ip6_ctlun.ip6_un1.ip6_un1_plen +#define ip6_nxt ip6_ctlun.ip6_un1.ip6_un1_nxt +#define ip6_hlim ip6_ctlun.ip6_un1.ip6_un1_hlim +#define ip6_hops ip6_ctlun.ip6_un1.ip6_un1_hlim + +#define nd_rd_type nd_rd_hdr.icmp6_type +#define nd_rd_code nd_rd_hdr.icmp6_code +#define nd_rd_cksum nd_rd_hdr.icmp6_cksum +#define nd_rd_reserved nd_rd_hdr.icmp6_data32[0] + +/* + * IPV6 extension headers + */ +#define IPPROTO_HOPOPTS 0 /* IPv6 hop-by-hop options */ +#define IPPROTO_IPV6 41 /* IPv6 header. */ +#define IPPROTO_ROUTING 43 /* IPv6 routing header */ +#define IPPROTO_FRAGMENT 44 /* IPv6 fragmentation header */ +#define IPPROTO_ESP 50 /* encapsulating security payload */ +#define IPPROTO_AH 51 /* authentication header */ +#define IPPROTO_ICMPV6 58 /* ICMPv6 */ +#define IPPROTO_NONE 59 /* IPv6 no next header */ +#define IPPROTO_DSTOPTS 60 /* IPv6 destination options */ +#define IPPROTO_PIM 103 /* Protocol Independent Multicast. */ + +#define IPV6_RTHDR_TYPE_0 0 + +/* Option types and related macros */ +#define IP6OPT_PAD1 0x00 /* 00 0 00000 */ +#define IP6OPT_PADN 0x01 /* 00 0 00001 */ +#define IP6OPT_JUMBO 0xC2 /* 11 0 00010 = 194 */ +#define IP6OPT_JUMBO_LEN 6 +#define IP6OPT_ROUTER_ALERT 0x05 /* 00 0 00101 */ + +#define IP6OPT_RTALERT_LEN 4 +#define IP6OPT_RTALERT_MLD 0 /* Datagram contains an MLD message */ +#define IP6OPT_RTALERT_RSVP 1 /* Datagram contains an RSVP message */ +#define IP6OPT_RTALERT_ACTNET 2 /* contains an Active Networks msg */ +#define IP6OPT_MINLEN 2 + +#define IP6OPT_BINDING_UPDATE 0xc6 /* 11 0 00110 */ +#define IP6OPT_BINDING_ACK 0x07 /* 00 0 00111 */ +#define IP6OPT_BINDING_REQ 0x08 /* 00 0 01000 */ +#define IP6OPT_HOME_ADDRESS 0xc9 /* 11 0 01001 */ +#define IP6OPT_EID 0x8a /* 10 0 01010 */ + +#define IP6OPT_TYPE(o) ((o) & 0xC0) +#define IP6OPT_TYPE_SKIP 0x00 +#define IP6OPT_TYPE_DISCARD 0x40 +#define IP6OPT_TYPE_FORCEICMP 0x80 +#define IP6OPT_TYPE_ICMP 0xC0 + +#define IP6OPT_MUTABLE 0x20 + + +#ifdef __MINGW32__ +#ifndef EAI_ADDRFAMILY +struct addrinfo { + int ai_flags; /* AI_PASSIVE, AI_CANONNAME */ + int ai_family; /* PF_xxx */ + int ai_socktype; /* SOCK_xxx */ + int ai_protocol; /* 0 or IPPROTO_xxx for IPv4 and IPv6 */ + size_t ai_addrlen; /* length of ai_addr */ + char *ai_canonname; /* canonical name for hostname */ + struct sockaddr *ai_addr; /* binary address */ + struct addrinfo *ai_next; /* next structure in linked list */ +}; +#endif +#endif /* __MINGW32__ */ diff --git a/src/Cedar/winpcap/memory_t.h b/src/Cedar/winpcap/memory_t.h index ab3c85db..8836743f 100644 --- a/src/Cedar/winpcap/memory_t.h +++ b/src/Cedar/winpcap/memory_t.h @@ -1,132 +1,132 @@ -/* - * Copyright (c) 2001 - 2003 - * NetGroup, Politecnico di Torino (Italy) - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the Politecnico di Torino nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - */ - -#ifndef __memory_t -#define __memory_t - -#define uint8 UCHAR -#define int8 CHAR -#define uint16 USHORT -#define int16 SHORT -#define uint32 ULONG -#define int32 LONG -#define uint64 ULONGLONG -#define int64 LONGLONG - -/*memory type*/ -typedef struct __MEM_TYPE -{ - uint8 *buffer; - uint32 size; -} MEM_TYPE, *PMEM_TYPE; - -#define LONG_AT(base,offset) (*(int32*)((uint8*)base+(uint32)offset)) - -#define ULONG_AT(base,offset) (*(uint32*)((uint8*)base+(uint32)offset)) - -#define SHORT_AT(base,offset) (*(int16*)((uint8*)base+(uint32)offset)) - -#define USHORT_AT(base,offset) (*(uint16*)((uint8*)base+(uint32)offset)) - -__inline int32 SW_LONG_AT(void *b, uint32 c) -{ - return ((int32)*((uint8 *)b+c)<<24| - (int32)*((uint8 *)b+c+1)<<16| - (int32)*((uint8 *)b+c+2)<<8| - (int32)*((uint8 *)b+c+3)<<0); -} - - -__inline uint32 SW_ULONG_AT(void *b, uint32 c) -{ - return ((uint32)*((uint8 *)b+c)<<24| - (uint32)*((uint8 *)b+c+1)<<16| - (uint32)*((uint8 *)b+c+2)<<8| - (uint32)*((uint8 *)b+c+3)<<0); -} - -__inline int16 SW_SHORT_AT(void *b, uint32 os) -{ - return ((int16) - ((int16)*((uint8 *)b+os+0)<<8| - (int16)*((uint8 *)b+os+1)<<0)); -} - -__inline uint16 SW_USHORT_AT(void *b, uint32 os) -{ - return ((uint16) - ((uint16)*((uint8 *)b+os+0)<<8| - (uint16)*((uint8 *)b+os+1)<<0)); -} - -__inline VOID SW_ULONG_ASSIGN(void *dst, uint32 src) -{ - *((uint8*)dst+0)=*((uint8*)&src+3); - *((uint8*)dst+1)=*((uint8*)&src+2); - *((uint8*)dst+2)=*((uint8*)&src+1); - *((uint8*)dst+3)=*((uint8*)&src+0); - -} - -#ifdef WIN_NT_DRIVER - -#define ALLOCATE_MEMORY(dest,type,amount) \ - (dest)=ExAllocatePool(NonPagedPool,sizeof(type)*(amount)); -#define ALLOCATE_ZERO_MEMORY(dest,type,amount) \ - { \ - (dest)=ExAllocatePool(NonPagedPool,sizeof(type)*(amount)); \ - if ((dest)!=NULL) \ - RtlZeroMemory((dest),sizeof(type)*(amount)); \ - } - -#define FREE_MEMORY(dest) ExFreePool(dest); -#define ZERO_MEMORY(dest,amount) RtlZeroMemory(dest,amount); -#define COPY_MEMORY(dest,src,amount) RtlCopyMemory(dest,src,amount); - -#else - -#define ALLOCATE_MEMORY(dest,type,amount) \ - (dest)=(type*)GlobalAlloc(GPTR, sizeof(type)*(amount)); -#define ALLOCATE_ZERO_MEMORY(dest,type,amount) \ - (dest)=(type*)GlobalAlloc(GPTR, sizeof(type)*(amount)); - -#define FREE_MEMORY(dest) GlobalFree(dest); -#define ZERO_MEMORY(dest,amount) RtlZeroMemory(dest,amount); -#define COPY_MEMORY(dest,src,amount) RtlCopyMemory(dest,src,amount); - - -#endif /*WIN_NT_DRIVER*/ - - - -#endif - +/* + * Copyright (c) 2001 - 2003 + * NetGroup, Politecnico di Torino (Italy) + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the Politecnico di Torino nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#ifndef __memory_t +#define __memory_t + +#define uint8 UCHAR +#define int8 CHAR +#define uint16 USHORT +#define int16 SHORT +#define uint32 ULONG +#define int32 LONG +#define uint64 ULONGLONG +#define int64 LONGLONG + +/*memory type*/ +typedef struct __MEM_TYPE +{ + uint8 *buffer; + uint32 size; +} MEM_TYPE, *PMEM_TYPE; + +#define LONG_AT(base,offset) (*(int32*)((uint8*)base+(uint32)offset)) + +#define ULONG_AT(base,offset) (*(uint32*)((uint8*)base+(uint32)offset)) + +#define SHORT_AT(base,offset) (*(int16*)((uint8*)base+(uint32)offset)) + +#define USHORT_AT(base,offset) (*(uint16*)((uint8*)base+(uint32)offset)) + +__inline int32 SW_LONG_AT(void *b, uint32 c) +{ + return ((int32)*((uint8 *)b+c)<<24| + (int32)*((uint8 *)b+c+1)<<16| + (int32)*((uint8 *)b+c+2)<<8| + (int32)*((uint8 *)b+c+3)<<0); +} + + +__inline uint32 SW_ULONG_AT(void *b, uint32 c) +{ + return ((uint32)*((uint8 *)b+c)<<24| + (uint32)*((uint8 *)b+c+1)<<16| + (uint32)*((uint8 *)b+c+2)<<8| + (uint32)*((uint8 *)b+c+3)<<0); +} + +__inline int16 SW_SHORT_AT(void *b, uint32 os) +{ + return ((int16) + ((int16)*((uint8 *)b+os+0)<<8| + (int16)*((uint8 *)b+os+1)<<0)); +} + +__inline uint16 SW_USHORT_AT(void *b, uint32 os) +{ + return ((uint16) + ((uint16)*((uint8 *)b+os+0)<<8| + (uint16)*((uint8 *)b+os+1)<<0)); +} + +__inline VOID SW_ULONG_ASSIGN(void *dst, uint32 src) +{ + *((uint8*)dst+0)=*((uint8*)&src+3); + *((uint8*)dst+1)=*((uint8*)&src+2); + *((uint8*)dst+2)=*((uint8*)&src+1); + *((uint8*)dst+3)=*((uint8*)&src+0); + +} + +#ifdef WIN_NT_DRIVER + +#define ALLOCATE_MEMORY(dest,type,amount) \ + (dest)=ExAllocatePool(NonPagedPool,sizeof(type)*(amount)); +#define ALLOCATE_ZERO_MEMORY(dest,type,amount) \ + { \ + (dest)=ExAllocatePool(NonPagedPool,sizeof(type)*(amount)); \ + if ((dest)!=NULL) \ + RtlZeroMemory((dest),sizeof(type)*(amount)); \ + } + +#define FREE_MEMORY(dest) ExFreePool(dest); +#define ZERO_MEMORY(dest,amount) RtlZeroMemory(dest,amount); +#define COPY_MEMORY(dest,src,amount) RtlCopyMemory(dest,src,amount); + +#else + +#define ALLOCATE_MEMORY(dest,type,amount) \ + (dest)=(type*)GlobalAlloc(GPTR, sizeof(type)*(amount)); +#define ALLOCATE_ZERO_MEMORY(dest,type,amount) \ + (dest)=(type*)GlobalAlloc(GPTR, sizeof(type)*(amount)); + +#define FREE_MEMORY(dest) GlobalFree(dest); +#define ZERO_MEMORY(dest,amount) RtlZeroMemory(dest,amount); +#define COPY_MEMORY(dest,src,amount) RtlCopyMemory(dest,src,amount); + + +#endif /*WIN_NT_DRIVER*/ + + + +#endif + diff --git a/src/Cedar/winpcap/normal_lookup.h b/src/Cedar/winpcap/normal_lookup.h index 45ac4fd1..987f9055 100644 --- a/src/Cedar/winpcap/normal_lookup.h +++ b/src/Cedar/winpcap/normal_lookup.h @@ -1,56 +1,56 @@ -/* - * Copyright (c) 2001 - 2003 - * NetGroup, Politecnico di Torino (Italy) - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the Politecnico di Torino nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - */ - -#ifndef __normal_lookup -#define __normal_lookup - -#ifdef WIN32 -#include "tme.h" -#endif - -#ifdef __FreeBSD__ - -#ifdef _KERNEL -#include -#else -#include -#endif - -#endif - -#define NORMAL_LUT_W_INSERT 0x00000000 -uint32 normal_lut_w_insert(uint8 *key, TME_DATA *data, MEM_TYPE *mem_ex, struct time_conv *time_ref); -#define NORMAL_LUT_WO_INSERT 0x00000001 -uint32 normal_lut_wo_insert(uint8 *key, TME_DATA *data, MEM_TYPE *mem_ex, struct time_conv *time_ref); -#define DUMMY_INSERT 1234 - -#endif +/* + * Copyright (c) 2001 - 2003 + * NetGroup, Politecnico di Torino (Italy) + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the Politecnico di Torino nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#ifndef __normal_lookup +#define __normal_lookup + +#ifdef WIN32 +#include "tme.h" +#endif + +#ifdef __FreeBSD__ + +#ifdef _KERNEL +#include +#else +#include +#endif + +#endif + +#define NORMAL_LUT_W_INSERT 0x00000000 +uint32 normal_lut_w_insert(uint8 *key, TME_DATA *data, MEM_TYPE *mem_ex, struct time_conv *time_ref); +#define NORMAL_LUT_WO_INSERT 0x00000001 +uint32 normal_lut_wo_insert(uint8 *key, TME_DATA *data, MEM_TYPE *mem_ex, struct time_conv *time_ref); +#define DUMMY_INSERT 1234 + +#endif diff --git a/src/Cedar/winpcap/pcap-bpf.h b/src/Cedar/winpcap/pcap-bpf.h index 0a32addc..7cc7cfee 100644 --- a/src/Cedar/winpcap/pcap-bpf.h +++ b/src/Cedar/winpcap/pcap-bpf.h @@ -1,685 +1,685 @@ -/*- - * Copyright (c) 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997 - * The Regents of the University of California. All rights reserved. - * - * This code is derived from the Stanford/CMU enet packet filter, - * (net/enet.c) distributed as part of 4.3BSD, and code contributed - * to Berkeley by Steven McCanne and Van Jacobson both of Lawrence - * Berkeley Laboratory. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the University of - * California, Berkeley and its contributors. - * 4. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @(#)bpf.h 7.1 (Berkeley) 5/7/91 - * - * @(#) $Header: /tcpdump/master/libpcap/pcap-bpf.h,v 1.34.2.5 2005/05/27 23:33:00 guy Exp $ (LBL) - */ - -/* - * This is libpcap's cut-down version of bpf.h; it includes only - * the stuff needed for the code generator and the userland BPF - * interpreter, and the libpcap APIs for setting filters, etc.. - * - * "pcap-bpf.c" will include the native OS version, as it deals with - * the OS's BPF implementation. - * - * XXX - should this all just be moved to "pcap.h"? - */ - -#ifndef BPF_MAJOR_VERSION - -#ifdef __cplusplus -extern "C" { -#endif - -/* BSD style release date */ -#define BPF_RELEASE 199606 - -#ifdef MSDOS /* must be 32-bit */ -typedef long bpf_int32; -typedef unsigned long bpf_u_int32; -#else -typedef int bpf_int32; -typedef u_int bpf_u_int32; -#endif - -/* - * Alignment macros. BPF_WORDALIGN rounds up to the next - * even multiple of BPF_ALIGNMENT. - */ -#ifndef __NetBSD__ -#define BPF_ALIGNMENT sizeof(bpf_int32) -#else -#define BPF_ALIGNMENT sizeof(long) -#endif -#define BPF_WORDALIGN(x) (((x)+(BPF_ALIGNMENT-1))&~(BPF_ALIGNMENT-1)) - -#define BPF_MAXINSNS 512 -#define BPF_MAXBUFSIZE 0x8000 -#define BPF_MINBUFSIZE 32 - -/* - * Structure for "pcap_compile()", "pcap_setfilter()", etc.. - */ -struct bpf_program { - u_int bf_len; - struct bpf_insn *bf_insns; -}; - -/* - * Struct return by BIOCVERSION. This represents the version number of - * the filter language described by the instruction encodings below. - * bpf understands a program iff kernel_major == filter_major && - * kernel_minor >= filter_minor, that is, if the value returned by the - * running kernel has the same major number and a minor number equal - * equal to or less than the filter being downloaded. Otherwise, the - * results are undefined, meaning an error may be returned or packets - * may be accepted haphazardly. - * It has nothing to do with the source code version. - */ -struct bpf_version { - u_short bv_major; - u_short bv_minor; -}; -/* Current version number of filter architecture. */ -#define BPF_MAJOR_VERSION 1 -#define BPF_MINOR_VERSION 1 - -/* - * Data-link level type codes. - * - * Do *NOT* add new values to this list without asking - * "tcpdump-workers@tcpdump.org" for a value. Otherwise, you run the - * risk of using a value that's already being used for some other purpose, - * and of having tools that read libpcap-format captures not being able - * to handle captures with your new DLT_ value, with no hope that they - * will ever be changed to do so (as that would destroy their ability - * to read captures using that value for that other purpose). - */ - -/* - * These are the types that are the same on all platforms, and that - * have been defined by for ages. - */ -#define DLT_NULL 0 /* BSD loopback encapsulation */ -#define DLT_EN10MB 1 /* Ethernet (10Mb) */ -#define DLT_EN3MB 2 /* Experimental Ethernet (3Mb) */ -#define DLT_AX25 3 /* Amateur Radio AX.25 */ -#define DLT_PRONET 4 /* Proteon ProNET Token Ring */ -#define DLT_CHAOS 5 /* Chaos */ -#define DLT_IEEE802 6 /* IEEE 802 Networks */ -#define DLT_ARCNET 7 /* ARCNET, with BSD-style header */ -#define DLT_SLIP 8 /* Serial Line IP */ -#define DLT_PPP 9 /* Point-to-point Protocol */ -#define DLT_FDDI 10 /* FDDI */ - -/* - * These are types that are different on some platforms, and that - * have been defined by for ages. We use #ifdefs to - * detect the BSDs that define them differently from the traditional - * libpcap - * - * XXX - DLT_ATM_RFC1483 is 13 in BSD/OS, and DLT_RAW is 14 in BSD/OS, - * but I don't know what the right #define is for BSD/OS. - */ -#define DLT_ATM_RFC1483 11 /* LLC-encapsulated ATM */ - -#ifdef __OpenBSD__ -#define DLT_RAW 14 /* raw IP */ -#else -#define DLT_RAW 12 /* raw IP */ -#endif - -/* - * Given that the only OS that currently generates BSD/OS SLIP or PPP - * is, well, BSD/OS, arguably everybody should have chosen its values - * for DLT_SLIP_BSDOS and DLT_PPP_BSDOS, which are 15 and 16, but they - * didn't. So it goes. - */ -#if defined(__NetBSD__) || defined(__FreeBSD__) -#ifndef DLT_SLIP_BSDOS -#define DLT_SLIP_BSDOS 13 /* BSD/OS Serial Line IP */ -#define DLT_PPP_BSDOS 14 /* BSD/OS Point-to-point Protocol */ -#endif -#else -#define DLT_SLIP_BSDOS 15 /* BSD/OS Serial Line IP */ -#define DLT_PPP_BSDOS 16 /* BSD/OS Point-to-point Protocol */ -#endif - -/* - * 17 is used for DLT_OLD_PFLOG in OpenBSD; - * OBSOLETE: DLT_PFLOG is 117 in OpenBSD now as well. See below. - * 18 is used for DLT_PFSYNC in OpenBSD; don't use it for anything else. - */ - -#define DLT_ATM_CLIP 19 /* Linux Classical-IP over ATM */ - -/* - * Apparently Redback uses this for its SmartEdge 400/800. I hope - * nobody else decided to use it, too. - */ -#define DLT_REDBACK_SMARTEDGE 32 - -/* - * These values are defined by NetBSD; other platforms should refrain from - * using them for other purposes, so that NetBSD savefiles with link - * types of 50 or 51 can be read as this type on all platforms. - */ -#define DLT_PPP_SERIAL 50 /* PPP over serial with HDLC encapsulation */ -#define DLT_PPP_ETHER 51 /* PPP over Ethernet */ - -/* - * The Axent Raptor firewall - now the Symantec Enterprise Firewall - uses - * a link-layer type of 99 for the tcpdump it supplies. The link-layer - * header has 6 bytes of unknown data, something that appears to be an - * Ethernet type, and 36 bytes that appear to be 0 in at least one capture - * I've seen. - */ -#define DLT_SYMANTEC_FIREWALL 99 - -/* - * Values between 100 and 103 are used in capture file headers as - * link-layer types corresponding to DLT_ types that differ - * between platforms; don't use those values for new DLT_ new types. - */ - -/* - * This value was defined by libpcap 0.5; platforms that have defined - * it with a different value should define it here with that value - - * a link type of 104 in a save file will be mapped to DLT_C_HDLC, - * whatever value that happens to be, so programs will correctly - * handle files with that link type regardless of the value of - * DLT_C_HDLC. - * - * The name DLT_C_HDLC was used by BSD/OS; we use that name for source - * compatibility with programs written for BSD/OS. - * - * libpcap 0.5 defined it as DLT_CHDLC; we define DLT_CHDLC as well, - * for source compatibility with programs written for libpcap 0.5. - */ -#define DLT_C_HDLC 104 /* Cisco HDLC */ -#define DLT_CHDLC DLT_C_HDLC - -#define DLT_IEEE802_11 105 /* IEEE 802.11 wireless */ - -/* - * 106 is reserved for Linux Classical IP over ATM; it's like DLT_RAW, - * except when it isn't. (I.e., sometimes it's just raw IP, and - * sometimes it isn't.) We currently handle it as DLT_LINUX_SLL, - * so that we don't have to worry about the link-layer header.) - */ - -/* - * Frame Relay; BSD/OS has a DLT_FR with a value of 11, but that collides - * with other values. - * DLT_FR and DLT_FRELAY packets start with the Q.922 Frame Relay header - * (DLCI, etc.). - */ -#define DLT_FRELAY 107 - -/* - * OpenBSD DLT_LOOP, for loopback devices; it's like DLT_NULL, except - * that the AF_ type in the link-layer header is in network byte order. - * - * OpenBSD defines it as 12, but that collides with DLT_RAW, so we - * define it as 108 here. If OpenBSD picks up this file, it should - * define DLT_LOOP as 12 in its version, as per the comment above - - * and should not use 108 as a DLT_ value. - */ -#define DLT_LOOP 108 - -/* - * Encapsulated packets for IPsec; DLT_ENC is 13 in OpenBSD, but that's - * DLT_SLIP_BSDOS in NetBSD, so we don't use 13 for it in OSes other - * than OpenBSD. - */ -#ifdef __OpenBSD__ -#define DLT_ENC 13 -#else -#define DLT_ENC 109 -#endif - -/* - * Values between 110 and 112 are reserved for use in capture file headers - * as link-layer types corresponding to DLT_ types that might differ - * between platforms; don't use those values for new DLT_ types - * other than the corresponding DLT_ types. - */ - -/* - * This is for Linux cooked sockets. - */ -#define DLT_LINUX_SLL 113 - -/* - * Apple LocalTalk hardware. - */ -#define DLT_LTALK 114 - -/* - * Acorn Econet. - */ -#define DLT_ECONET 115 - -/* - * Reserved for use with OpenBSD ipfilter. - */ -#define DLT_IPFILTER 116 - -/* - * OpenBSD DLT_PFLOG; DLT_PFLOG is 17 in OpenBSD, but that's DLT_LANE8023 - * in SuSE 6.3, so we can't use 17 for it in capture-file headers. - * - * XXX: is there a conflict with DLT_PFSYNC 18 as well? - */ -#ifdef __OpenBSD__ -#define DLT_OLD_PFLOG 17 -#define DLT_PFSYNC 18 -#endif -#define DLT_PFLOG 117 - -/* - * Registered for Cisco-internal use. - */ -#define DLT_CISCO_IOS 118 - -/* - * For 802.11 cards using the Prism II chips, with a link-layer - * header including Prism monitor mode information plus an 802.11 - * header. - */ -#define DLT_PRISM_HEADER 119 - -/* - * Reserved for Aironet 802.11 cards, with an Aironet link-layer header - * (see Doug Ambrisko's FreeBSD patches). - */ -#define DLT_AIRONET_HEADER 120 - -/* - * Reserved for Siemens HiPath HDLC. - */ -#define DLT_HHDLC 121 - -/* - * This is for RFC 2625 IP-over-Fibre Channel. - * - * This is not for use with raw Fibre Channel, where the link-layer - * header starts with a Fibre Channel frame header; it's for IP-over-FC, - * where the link-layer header starts with an RFC 2625 Network_Header - * field. - */ -#define DLT_IP_OVER_FC 122 - -/* - * This is for Full Frontal ATM on Solaris with SunATM, with a - * pseudo-header followed by an AALn PDU. - * - * There may be other forms of Full Frontal ATM on other OSes, - * with different pseudo-headers. - * - * If ATM software returns a pseudo-header with VPI/VCI information - * (and, ideally, packet type information, e.g. signalling, ILMI, - * LANE, LLC-multiplexed traffic, etc.), it should not use - * DLT_ATM_RFC1483, but should get a new DLT_ value, so tcpdump - * and the like don't have to infer the presence or absence of a - * pseudo-header and the form of the pseudo-header. - */ -#define DLT_SUNATM 123 /* Solaris+SunATM */ - -/* - * Reserved as per request from Kent Dahlgren - * for private use. - */ -#define DLT_RIO 124 /* RapidIO */ -#define DLT_PCI_EXP 125 /* PCI Express */ -#define DLT_AURORA 126 /* Xilinx Aurora link layer */ - -/* - * Header for 802.11 plus a number of bits of link-layer information - * including radio information, used by some recent BSD drivers as - * well as the madwifi Atheros driver for Linux. - */ -#define DLT_IEEE802_11_RADIO 127 /* 802.11 plus radiotap radio header */ - -/* - * Reserved for the TZSP encapsulation, as per request from - * Chris Waters - * TZSP is a generic encapsulation for any other link type, - * which includes a means to include meta-information - * with the packet, e.g. signal strength and channel - * for 802.11 packets. - */ -#define DLT_TZSP 128 /* Tazmen Sniffer Protocol */ - -/* - * BSD's ARCNET headers have the source host, destination host, - * and type at the beginning of the packet; that's what's handed - * up to userland via BPF. - * - * Linux's ARCNET headers, however, have a 2-byte offset field - * between the host IDs and the type; that's what's handed up - * to userland via PF_PACKET sockets. - * - * We therefore have to have separate DLT_ values for them. - */ -#define DLT_ARCNET_LINUX 129 /* ARCNET */ - -/* - * Juniper-private data link types, as per request from - * Hannes Gredler . The DLT_s are used - * for passing on chassis-internal metainformation such as - * QOS profiles, etc.. - */ -#define DLT_JUNIPER_MLPPP 130 -#define DLT_JUNIPER_MLFR 131 -#define DLT_JUNIPER_ES 132 -#define DLT_JUNIPER_GGSN 133 -#define DLT_JUNIPER_MFR 134 -#define DLT_JUNIPER_ATM2 135 -#define DLT_JUNIPER_SERVICES 136 -#define DLT_JUNIPER_ATM1 137 - -/* - * Apple IP-over-IEEE 1394, as per a request from Dieter Siegmund - * . The header that's presented is an Ethernet-like - * header: - * - * #define FIREWIRE_EUI64_LEN 8 - * struct firewire_header { - * u_char firewire_dhost[FIREWIRE_EUI64_LEN]; - * u_char firewire_shost[FIREWIRE_EUI64_LEN]; - * u_short firewire_type; - * }; - * - * with "firewire_type" being an Ethernet type value, rather than, - * for example, raw GASP frames being handed up. - */ -#define DLT_APPLE_IP_OVER_IEEE1394 138 - -/* - * Various SS7 encapsulations, as per a request from Jeff Morriss - * and subsequent discussions. - */ -#define DLT_MTP2_WITH_PHDR 139 /* pseudo-header with various info, followed by MTP2 */ -#define DLT_MTP2 140 /* MTP2, without pseudo-header */ -#define DLT_MTP3 141 /* MTP3, without pseudo-header or MTP2 */ -#define DLT_SCCP 142 /* SCCP, without pseudo-header or MTP2 or MTP3 */ - -/* - * DOCSIS MAC frames. - */ -#define DLT_DOCSIS 143 - -/* - * Linux-IrDA packets. Protocol defined at http://www.irda.org. - * Those packets include IrLAP headers and above (IrLMP...), but - * don't include Phy framing (SOF/EOF/CRC & byte stuffing), because Phy - * framing can be handled by the hardware and depend on the bitrate. - * This is exactly the format you would get capturing on a Linux-IrDA - * interface (irdaX), but not on a raw serial port. - * Note the capture is done in "Linux-cooked" mode, so each packet include - * a fake packet header (struct sll_header). This is because IrDA packet - * decoding is dependant on the direction of the packet (incoming or - * outgoing). - * When/if other platform implement IrDA capture, we may revisit the - * issue and define a real DLT_IRDA... - * Jean II - */ -#define DLT_LINUX_IRDA 144 - -/* - * Reserved for IBM SP switch and IBM Next Federation switch. - */ -#define DLT_IBM_SP 145 -#define DLT_IBM_SN 146 - -/* - * Reserved for private use. If you have some link-layer header type - * that you want to use within your organization, with the capture files - * using that link-layer header type not ever be sent outside your - * organization, you can use these values. - * - * No libpcap release will use these for any purpose, nor will any - * tcpdump release use them, either. - * - * Do *NOT* use these in capture files that you expect anybody not using - * your private versions of capture-file-reading tools to read; in - * particular, do *NOT* use them in products, otherwise you may find that - * people won't be able to use tcpdump, or snort, or Ethereal, or... to - * read capture files from your firewall/intrusion detection/traffic - * monitoring/etc. appliance, or whatever product uses that DLT_ value, - * and you may also find that the developers of those applications will - * not accept patches to let them read those files. - * - * Also, do not use them if somebody might send you a capture using them - * for *their* private type and tools using them for *your* private type - * would have to read them. - * - * Instead, ask "tcpdump-workers@tcpdump.org" for a new DLT_ value, - * as per the comment above, and use the type you're given. - */ -#define DLT_USER0 147 -#define DLT_USER1 148 -#define DLT_USER2 149 -#define DLT_USER3 150 -#define DLT_USER4 151 -#define DLT_USER5 152 -#define DLT_USER6 153 -#define DLT_USER7 154 -#define DLT_USER8 155 -#define DLT_USER9 156 -#define DLT_USER10 157 -#define DLT_USER11 158 -#define DLT_USER12 159 -#define DLT_USER13 160 -#define DLT_USER14 161 -#define DLT_USER15 162 - -/* - * For future use with 802.11 captures - defined by AbsoluteValue - * Systems to store a number of bits of link-layer information - * including radio information: - * - * http://www.shaftnet.org/~pizza/software/capturefrm.txt - * - * but it might be used by some non-AVS drivers now or in the - * future. - */ -#define DLT_IEEE802_11_RADIO_AVS 163 /* 802.11 plus AVS radio header */ - -/* - * Juniper-private data link type, as per request from - * Hannes Gredler . The DLT_s are used - * for passing on chassis-internal metainformation such as - * QOS profiles, etc.. - */ -#define DLT_JUNIPER_MONITOR 164 - -/* - * Reserved for BACnet MS/TP. - */ -#define DLT_BACNET_MS_TP 165 - -/* - * Another PPP variant as per request from Karsten Keil . - * - * This is used in some OSes to allow a kernel socket filter to distinguish - * between incoming and outgoing packets, on a socket intended to - * supply pppd with outgoing packets so it can do dial-on-demand and - * hangup-on-lack-of-demand; incoming packets are filtered out so they - * don't cause pppd to hold the connection up (you don't want random - * input packets such as port scans, packets from old lost connections, - * etc. to force the connection to stay up). - * - * The first byte of the PPP header (0xff03) is modified to accomodate - * the direction - 0x00 = IN, 0x01 = OUT. - */ -#define DLT_PPP_PPPD 166 - -/* - * Names for backwards compatibility with older versions of some PPP - * software; new software should use DLT_PPP_PPPD. - */ -#define DLT_PPP_WITH_DIRECTION DLT_PPP_PPPD -#define DLT_LINUX_PPP_WITHDIRECTION DLT_PPP_PPPD - -/* - * Juniper-private data link type, as per request from - * Hannes Gredler . The DLT_s are used - * for passing on chassis-internal metainformation such as - * QOS profiles, cookies, etc.. - */ -#define DLT_JUNIPER_PPPOE 167 -#define DLT_JUNIPER_PPPOE_ATM 168 - -#define DLT_GPRS_LLC 169 /* GPRS LLC */ -#define DLT_GPF_T 170 /* GPF-T (ITU-T G.7041/Y.1303) */ -#define DLT_GPF_F 171 /* GPF-F (ITU-T G.7041/Y.1303) */ - -/* - * Requested by Oolan Zimmer for use in Gcom's T1/E1 line - * monitoring equipment. - */ -#define DLT_GCOM_T1E1 172 -#define DLT_GCOM_SERIAL 173 - -/* - * Juniper-private data link type, as per request from - * Hannes Gredler . The DLT_ is used - * for internal communication to Physical Interface Cards (PIC) - */ -#define DLT_JUNIPER_PIC_PEER 174 - -/* - * Link types requested by Gregor Maier of Endace - * Measurement Systems. They add an ERF header (see - * http://www.endace.com/support/EndaceRecordFormat.pdf) in front of - * the link-layer header. - */ -#define DLT_ERF_ETH 175 /* Ethernet */ -#define DLT_ERF_POS 176 /* Packet-over-SONET */ - -/* - * Requested by Daniele Orlandi for raw LAPD - * for vISDN (http://www.orlandi.com/visdn/). Its link-layer header - * includes additional information before the LAPD header, so it's - * not necessarily a generic LAPD header. - */ -#define DLT_LINUX_LAPD 177 - -/* - * The instruction encodings. - */ -/* instruction classes */ -#define BPF_CLASS(code) ((code) & 0x07) -#define BPF_LD 0x00 -#define BPF_LDX 0x01 -#define BPF_ST 0x02 -#define BPF_STX 0x03 -#define BPF_ALU 0x04 -#define BPF_JMP 0x05 -#define BPF_RET 0x06 -#define BPF_MISC 0x07 - -/* ld/ldx fields */ -#define BPF_SIZE(code) ((code) & 0x18) -#define BPF_W 0x00 -#define BPF_H 0x08 -#define BPF_B 0x10 -#define BPF_MODE(code) ((code) & 0xe0) -#define BPF_IMM 0x00 -#define BPF_ABS 0x20 -#define BPF_IND 0x40 -#define BPF_MEM 0x60 -#define BPF_LEN 0x80 -#define BPF_MSH 0xa0 - -/* alu/jmp fields */ -#define BPF_OP(code) ((code) & 0xf0) -#define BPF_ADD 0x00 -#define BPF_SUB 0x10 -#define BPF_MUL 0x20 -#define BPF_DIV 0x30 -#define BPF_OR 0x40 -#define BPF_AND 0x50 -#define BPF_LSH 0x60 -#define BPF_RSH 0x70 -#define BPF_NEG 0x80 -#define BPF_JA 0x00 -#define BPF_JEQ 0x10 -#define BPF_JGT 0x20 -#define BPF_JGE 0x30 -#define BPF_JSET 0x40 -#define BPF_SRC(code) ((code) & 0x08) -#define BPF_K 0x00 -#define BPF_X 0x08 - -/* ret - BPF_K and BPF_X also apply */ -#define BPF_RVAL(code) ((code) & 0x18) -#define BPF_A 0x10 - -/* misc */ -#define BPF_MISCOP(code) ((code) & 0xf8) -#define BPF_TAX 0x00 -#define BPF_TXA 0x80 - -/* - * The instruction data structure. - */ -struct bpf_insn { - u_short code; - u_char jt; - u_char jf; - bpf_int32 k; -}; - -/* - * Macros for insn array initializers. - */ -#define BPF_STMT(code, k) { (u_short)(code), 0, 0, k } -#define BPF_JUMP(code, k, jt, jf) { (u_short)(code), jt, jf, k } - -#if __STDC__ || defined(__cplusplus) -extern int bpf_validate(struct bpf_insn *, int); -extern u_int bpf_filter(struct bpf_insn *, u_char *, u_int, u_int); -#else -extern int bpf_validate(); -extern u_int bpf_filter(); -#endif - -/* - * Number of scratch memory words (for BPF_LD|BPF_MEM and BPF_ST). - */ -#define BPF_MEMWORDS 16 - -#ifdef __cplusplus -} -#endif - -#endif +/*- + * Copyright (c) 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997 + * The Regents of the University of California. All rights reserved. + * + * This code is derived from the Stanford/CMU enet packet filter, + * (net/enet.c) distributed as part of 4.3BSD, and code contributed + * to Berkeley by Steven McCanne and Van Jacobson both of Lawrence + * Berkeley Laboratory. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)bpf.h 7.1 (Berkeley) 5/7/91 + * + * @(#) $Header: /tcpdump/master/libpcap/pcap-bpf.h,v 1.34.2.5 2005/05/27 23:33:00 guy Exp $ (LBL) + */ + +/* + * This is libpcap's cut-down version of bpf.h; it includes only + * the stuff needed for the code generator and the userland BPF + * interpreter, and the libpcap APIs for setting filters, etc.. + * + * "pcap-bpf.c" will include the native OS version, as it deals with + * the OS's BPF implementation. + * + * XXX - should this all just be moved to "pcap.h"? + */ + +#ifndef BPF_MAJOR_VERSION + +#ifdef __cplusplus +extern "C" { +#endif + +/* BSD style release date */ +#define BPF_RELEASE 199606 + +#ifdef MSDOS /* must be 32-bit */ +typedef long bpf_int32; +typedef unsigned long bpf_u_int32; +#else +typedef int bpf_int32; +typedef u_int bpf_u_int32; +#endif + +/* + * Alignment macros. BPF_WORDALIGN rounds up to the next + * even multiple of BPF_ALIGNMENT. + */ +#ifndef __NetBSD__ +#define BPF_ALIGNMENT sizeof(bpf_int32) +#else +#define BPF_ALIGNMENT sizeof(long) +#endif +#define BPF_WORDALIGN(x) (((x)+(BPF_ALIGNMENT-1))&~(BPF_ALIGNMENT-1)) + +#define BPF_MAXINSNS 512 +#define BPF_MAXBUFSIZE 0x8000 +#define BPF_MINBUFSIZE 32 + +/* + * Structure for "pcap_compile()", "pcap_setfilter()", etc.. + */ +struct bpf_program { + u_int bf_len; + struct bpf_insn *bf_insns; +}; + +/* + * Struct return by BIOCVERSION. This represents the version number of + * the filter language described by the instruction encodings below. + * bpf understands a program iff kernel_major == filter_major && + * kernel_minor >= filter_minor, that is, if the value returned by the + * running kernel has the same major number and a minor number equal + * equal to or less than the filter being downloaded. Otherwise, the + * results are undefined, meaning an error may be returned or packets + * may be accepted haphazardly. + * It has nothing to do with the source code version. + */ +struct bpf_version { + u_short bv_major; + u_short bv_minor; +}; +/* Current version number of filter architecture. */ +#define BPF_MAJOR_VERSION 1 +#define BPF_MINOR_VERSION 1 + +/* + * Data-link level type codes. + * + * Do *NOT* add new values to this list without asking + * "tcpdump-workers@tcpdump.org" for a value. Otherwise, you run the + * risk of using a value that's already being used for some other purpose, + * and of having tools that read libpcap-format captures not being able + * to handle captures with your new DLT_ value, with no hope that they + * will ever be changed to do so (as that would destroy their ability + * to read captures using that value for that other purpose). + */ + +/* + * These are the types that are the same on all platforms, and that + * have been defined by for ages. + */ +#define DLT_NULL 0 /* BSD loopback encapsulation */ +#define DLT_EN10MB 1 /* Ethernet (10Mb) */ +#define DLT_EN3MB 2 /* Experimental Ethernet (3Mb) */ +#define DLT_AX25 3 /* Amateur Radio AX.25 */ +#define DLT_PRONET 4 /* Proteon ProNET Token Ring */ +#define DLT_CHAOS 5 /* Chaos */ +#define DLT_IEEE802 6 /* IEEE 802 Networks */ +#define DLT_ARCNET 7 /* ARCNET, with BSD-style header */ +#define DLT_SLIP 8 /* Serial Line IP */ +#define DLT_PPP 9 /* Point-to-point Protocol */ +#define DLT_FDDI 10 /* FDDI */ + +/* + * These are types that are different on some platforms, and that + * have been defined by for ages. We use #ifdefs to + * detect the BSDs that define them differently from the traditional + * libpcap + * + * XXX - DLT_ATM_RFC1483 is 13 in BSD/OS, and DLT_RAW is 14 in BSD/OS, + * but I don't know what the right #define is for BSD/OS. + */ +#define DLT_ATM_RFC1483 11 /* LLC-encapsulated ATM */ + +#ifdef __OpenBSD__ +#define DLT_RAW 14 /* raw IP */ +#else +#define DLT_RAW 12 /* raw IP */ +#endif + +/* + * Given that the only OS that currently generates BSD/OS SLIP or PPP + * is, well, BSD/OS, arguably everybody should have chosen its values + * for DLT_SLIP_BSDOS and DLT_PPP_BSDOS, which are 15 and 16, but they + * didn't. So it goes. + */ +#if defined(__NetBSD__) || defined(__FreeBSD__) +#ifndef DLT_SLIP_BSDOS +#define DLT_SLIP_BSDOS 13 /* BSD/OS Serial Line IP */ +#define DLT_PPP_BSDOS 14 /* BSD/OS Point-to-point Protocol */ +#endif +#else +#define DLT_SLIP_BSDOS 15 /* BSD/OS Serial Line IP */ +#define DLT_PPP_BSDOS 16 /* BSD/OS Point-to-point Protocol */ +#endif + +/* + * 17 is used for DLT_OLD_PFLOG in OpenBSD; + * OBSOLETE: DLT_PFLOG is 117 in OpenBSD now as well. See below. + * 18 is used for DLT_PFSYNC in OpenBSD; don't use it for anything else. + */ + +#define DLT_ATM_CLIP 19 /* Linux Classical-IP over ATM */ + +/* + * Apparently Redback uses this for its SmartEdge 400/800. I hope + * nobody else decided to use it, too. + */ +#define DLT_REDBACK_SMARTEDGE 32 + +/* + * These values are defined by NetBSD; other platforms should refrain from + * using them for other purposes, so that NetBSD savefiles with link + * types of 50 or 51 can be read as this type on all platforms. + */ +#define DLT_PPP_SERIAL 50 /* PPP over serial with HDLC encapsulation */ +#define DLT_PPP_ETHER 51 /* PPP over Ethernet */ + +/* + * The Axent Raptor firewall - now the Symantec Enterprise Firewall - uses + * a link-layer type of 99 for the tcpdump it supplies. The link-layer + * header has 6 bytes of unknown data, something that appears to be an + * Ethernet type, and 36 bytes that appear to be 0 in at least one capture + * I've seen. + */ +#define DLT_SYMANTEC_FIREWALL 99 + +/* + * Values between 100 and 103 are used in capture file headers as + * link-layer types corresponding to DLT_ types that differ + * between platforms; don't use those values for new DLT_ new types. + */ + +/* + * This value was defined by libpcap 0.5; platforms that have defined + * it with a different value should define it here with that value - + * a link type of 104 in a save file will be mapped to DLT_C_HDLC, + * whatever value that happens to be, so programs will correctly + * handle files with that link type regardless of the value of + * DLT_C_HDLC. + * + * The name DLT_C_HDLC was used by BSD/OS; we use that name for source + * compatibility with programs written for BSD/OS. + * + * libpcap 0.5 defined it as DLT_CHDLC; we define DLT_CHDLC as well, + * for source compatibility with programs written for libpcap 0.5. + */ +#define DLT_C_HDLC 104 /* Cisco HDLC */ +#define DLT_CHDLC DLT_C_HDLC + +#define DLT_IEEE802_11 105 /* IEEE 802.11 wireless */ + +/* + * 106 is reserved for Linux Classical IP over ATM; it's like DLT_RAW, + * except when it isn't. (I.e., sometimes it's just raw IP, and + * sometimes it isn't.) We currently handle it as DLT_LINUX_SLL, + * so that we don't have to worry about the link-layer header.) + */ + +/* + * Frame Relay; BSD/OS has a DLT_FR with a value of 11, but that collides + * with other values. + * DLT_FR and DLT_FRELAY packets start with the Q.922 Frame Relay header + * (DLCI, etc.). + */ +#define DLT_FRELAY 107 + +/* + * OpenBSD DLT_LOOP, for loopback devices; it's like DLT_NULL, except + * that the AF_ type in the link-layer header is in network byte order. + * + * OpenBSD defines it as 12, but that collides with DLT_RAW, so we + * define it as 108 here. If OpenBSD picks up this file, it should + * define DLT_LOOP as 12 in its version, as per the comment above - + * and should not use 108 as a DLT_ value. + */ +#define DLT_LOOP 108 + +/* + * Encapsulated packets for IPsec; DLT_ENC is 13 in OpenBSD, but that's + * DLT_SLIP_BSDOS in NetBSD, so we don't use 13 for it in OSes other + * than OpenBSD. + */ +#ifdef __OpenBSD__ +#define DLT_ENC 13 +#else +#define DLT_ENC 109 +#endif + +/* + * Values between 110 and 112 are reserved for use in capture file headers + * as link-layer types corresponding to DLT_ types that might differ + * between platforms; don't use those values for new DLT_ types + * other than the corresponding DLT_ types. + */ + +/* + * This is for Linux cooked sockets. + */ +#define DLT_LINUX_SLL 113 + +/* + * Apple LocalTalk hardware. + */ +#define DLT_LTALK 114 + +/* + * Acorn Econet. + */ +#define DLT_ECONET 115 + +/* + * Reserved for use with OpenBSD ipfilter. + */ +#define DLT_IPFILTER 116 + +/* + * OpenBSD DLT_PFLOG; DLT_PFLOG is 17 in OpenBSD, but that's DLT_LANE8023 + * in SuSE 6.3, so we can't use 17 for it in capture-file headers. + * + * XXX: is there a conflict with DLT_PFSYNC 18 as well? + */ +#ifdef __OpenBSD__ +#define DLT_OLD_PFLOG 17 +#define DLT_PFSYNC 18 +#endif +#define DLT_PFLOG 117 + +/* + * Registered for Cisco-internal use. + */ +#define DLT_CISCO_IOS 118 + +/* + * For 802.11 cards using the Prism II chips, with a link-layer + * header including Prism monitor mode information plus an 802.11 + * header. + */ +#define DLT_PRISM_HEADER 119 + +/* + * Reserved for Aironet 802.11 cards, with an Aironet link-layer header + * (see Doug Ambrisko's FreeBSD patches). + */ +#define DLT_AIRONET_HEADER 120 + +/* + * Reserved for Siemens HiPath HDLC. + */ +#define DLT_HHDLC 121 + +/* + * This is for RFC 2625 IP-over-Fibre Channel. + * + * This is not for use with raw Fibre Channel, where the link-layer + * header starts with a Fibre Channel frame header; it's for IP-over-FC, + * where the link-layer header starts with an RFC 2625 Network_Header + * field. + */ +#define DLT_IP_OVER_FC 122 + +/* + * This is for Full Frontal ATM on Solaris with SunATM, with a + * pseudo-header followed by an AALn PDU. + * + * There may be other forms of Full Frontal ATM on other OSes, + * with different pseudo-headers. + * + * If ATM software returns a pseudo-header with VPI/VCI information + * (and, ideally, packet type information, e.g. signalling, ILMI, + * LANE, LLC-multiplexed traffic, etc.), it should not use + * DLT_ATM_RFC1483, but should get a new DLT_ value, so tcpdump + * and the like don't have to infer the presence or absence of a + * pseudo-header and the form of the pseudo-header. + */ +#define DLT_SUNATM 123 /* Solaris+SunATM */ + +/* + * Reserved as per request from Kent Dahlgren + * for private use. + */ +#define DLT_RIO 124 /* RapidIO */ +#define DLT_PCI_EXP 125 /* PCI Express */ +#define DLT_AURORA 126 /* Xilinx Aurora link layer */ + +/* + * Header for 802.11 plus a number of bits of link-layer information + * including radio information, used by some recent BSD drivers as + * well as the madwifi Atheros driver for Linux. + */ +#define DLT_IEEE802_11_RADIO 127 /* 802.11 plus radiotap radio header */ + +/* + * Reserved for the TZSP encapsulation, as per request from + * Chris Waters + * TZSP is a generic encapsulation for any other link type, + * which includes a means to include meta-information + * with the packet, e.g. signal strength and channel + * for 802.11 packets. + */ +#define DLT_TZSP 128 /* Tazmen Sniffer Protocol */ + +/* + * BSD's ARCNET headers have the source host, destination host, + * and type at the beginning of the packet; that's what's handed + * up to userland via BPF. + * + * Linux's ARCNET headers, however, have a 2-byte offset field + * between the host IDs and the type; that's what's handed up + * to userland via PF_PACKET sockets. + * + * We therefore have to have separate DLT_ values for them. + */ +#define DLT_ARCNET_LINUX 129 /* ARCNET */ + +/* + * Juniper-private data link types, as per request from + * Hannes Gredler . The DLT_s are used + * for passing on chassis-internal metainformation such as + * QOS profiles, etc.. + */ +#define DLT_JUNIPER_MLPPP 130 +#define DLT_JUNIPER_MLFR 131 +#define DLT_JUNIPER_ES 132 +#define DLT_JUNIPER_GGSN 133 +#define DLT_JUNIPER_MFR 134 +#define DLT_JUNIPER_ATM2 135 +#define DLT_JUNIPER_SERVICES 136 +#define DLT_JUNIPER_ATM1 137 + +/* + * Apple IP-over-IEEE 1394, as per a request from Dieter Siegmund + * . The header that's presented is an Ethernet-like + * header: + * + * #define FIREWIRE_EUI64_LEN 8 + * struct firewire_header { + * u_char firewire_dhost[FIREWIRE_EUI64_LEN]; + * u_char firewire_shost[FIREWIRE_EUI64_LEN]; + * u_short firewire_type; + * }; + * + * with "firewire_type" being an Ethernet type value, rather than, + * for example, raw GASP frames being handed up. + */ +#define DLT_APPLE_IP_OVER_IEEE1394 138 + +/* + * Various SS7 encapsulations, as per a request from Jeff Morriss + * and subsequent discussions. + */ +#define DLT_MTP2_WITH_PHDR 139 /* pseudo-header with various info, followed by MTP2 */ +#define DLT_MTP2 140 /* MTP2, without pseudo-header */ +#define DLT_MTP3 141 /* MTP3, without pseudo-header or MTP2 */ +#define DLT_SCCP 142 /* SCCP, without pseudo-header or MTP2 or MTP3 */ + +/* + * DOCSIS MAC frames. + */ +#define DLT_DOCSIS 143 + +/* + * Linux-IrDA packets. Protocol defined at http://www.irda.org. + * Those packets include IrLAP headers and above (IrLMP...), but + * don't include Phy framing (SOF/EOF/CRC & byte stuffing), because Phy + * framing can be handled by the hardware and depend on the bitrate. + * This is exactly the format you would get capturing on a Linux-IrDA + * interface (irdaX), but not on a raw serial port. + * Note the capture is done in "Linux-cooked" mode, so each packet include + * a fake packet header (struct sll_header). This is because IrDA packet + * decoding is dependant on the direction of the packet (incoming or + * outgoing). + * When/if other platform implement IrDA capture, we may revisit the + * issue and define a real DLT_IRDA... + * Jean II + */ +#define DLT_LINUX_IRDA 144 + +/* + * Reserved for IBM SP switch and IBM Next Federation switch. + */ +#define DLT_IBM_SP 145 +#define DLT_IBM_SN 146 + +/* + * Reserved for private use. If you have some link-layer header type + * that you want to use within your organization, with the capture files + * using that link-layer header type not ever be sent outside your + * organization, you can use these values. + * + * No libpcap release will use these for any purpose, nor will any + * tcpdump release use them, either. + * + * Do *NOT* use these in capture files that you expect anybody not using + * your private versions of capture-file-reading tools to read; in + * particular, do *NOT* use them in products, otherwise you may find that + * people won't be able to use tcpdump, or snort, or Ethereal, or... to + * read capture files from your firewall/intrusion detection/traffic + * monitoring/etc. appliance, or whatever product uses that DLT_ value, + * and you may also find that the developers of those applications will + * not accept patches to let them read those files. + * + * Also, do not use them if somebody might send you a capture using them + * for *their* private type and tools using them for *your* private type + * would have to read them. + * + * Instead, ask "tcpdump-workers@tcpdump.org" for a new DLT_ value, + * as per the comment above, and use the type you're given. + */ +#define DLT_USER0 147 +#define DLT_USER1 148 +#define DLT_USER2 149 +#define DLT_USER3 150 +#define DLT_USER4 151 +#define DLT_USER5 152 +#define DLT_USER6 153 +#define DLT_USER7 154 +#define DLT_USER8 155 +#define DLT_USER9 156 +#define DLT_USER10 157 +#define DLT_USER11 158 +#define DLT_USER12 159 +#define DLT_USER13 160 +#define DLT_USER14 161 +#define DLT_USER15 162 + +/* + * For future use with 802.11 captures - defined by AbsoluteValue + * Systems to store a number of bits of link-layer information + * including radio information: + * + * http://www.shaftnet.org/~pizza/software/capturefrm.txt + * + * but it might be used by some non-AVS drivers now or in the + * future. + */ +#define DLT_IEEE802_11_RADIO_AVS 163 /* 802.11 plus AVS radio header */ + +/* + * Juniper-private data link type, as per request from + * Hannes Gredler . The DLT_s are used + * for passing on chassis-internal metainformation such as + * QOS profiles, etc.. + */ +#define DLT_JUNIPER_MONITOR 164 + +/* + * Reserved for BACnet MS/TP. + */ +#define DLT_BACNET_MS_TP 165 + +/* + * Another PPP variant as per request from Karsten Keil . + * + * This is used in some OSes to allow a kernel socket filter to distinguish + * between incoming and outgoing packets, on a socket intended to + * supply pppd with outgoing packets so it can do dial-on-demand and + * hangup-on-lack-of-demand; incoming packets are filtered out so they + * don't cause pppd to hold the connection up (you don't want random + * input packets such as port scans, packets from old lost connections, + * etc. to force the connection to stay up). + * + * The first byte of the PPP header (0xff03) is modified to accomodate + * the direction - 0x00 = IN, 0x01 = OUT. + */ +#define DLT_PPP_PPPD 166 + +/* + * Names for backwards compatibility with older versions of some PPP + * software; new software should use DLT_PPP_PPPD. + */ +#define DLT_PPP_WITH_DIRECTION DLT_PPP_PPPD +#define DLT_LINUX_PPP_WITHDIRECTION DLT_PPP_PPPD + +/* + * Juniper-private data link type, as per request from + * Hannes Gredler . The DLT_s are used + * for passing on chassis-internal metainformation such as + * QOS profiles, cookies, etc.. + */ +#define DLT_JUNIPER_PPPOE 167 +#define DLT_JUNIPER_PPPOE_ATM 168 + +#define DLT_GPRS_LLC 169 /* GPRS LLC */ +#define DLT_GPF_T 170 /* GPF-T (ITU-T G.7041/Y.1303) */ +#define DLT_GPF_F 171 /* GPF-F (ITU-T G.7041/Y.1303) */ + +/* + * Requested by Oolan Zimmer for use in Gcom's T1/E1 line + * monitoring equipment. + */ +#define DLT_GCOM_T1E1 172 +#define DLT_GCOM_SERIAL 173 + +/* + * Juniper-private data link type, as per request from + * Hannes Gredler . The DLT_ is used + * for internal communication to Physical Interface Cards (PIC) + */ +#define DLT_JUNIPER_PIC_PEER 174 + +/* + * Link types requested by Gregor Maier of Endace + * Measurement Systems. They add an ERF header (see + * http://www.endace.com/support/EndaceRecordFormat.pdf) in front of + * the link-layer header. + */ +#define DLT_ERF_ETH 175 /* Ethernet */ +#define DLT_ERF_POS 176 /* Packet-over-SONET */ + +/* + * Requested by Daniele Orlandi for raw LAPD + * for vISDN (http://www.orlandi.com/visdn/). Its link-layer header + * includes additional information before the LAPD header, so it's + * not necessarily a generic LAPD header. + */ +#define DLT_LINUX_LAPD 177 + +/* + * The instruction encodings. + */ +/* instruction classes */ +#define BPF_CLASS(code) ((code) & 0x07) +#define BPF_LD 0x00 +#define BPF_LDX 0x01 +#define BPF_ST 0x02 +#define BPF_STX 0x03 +#define BPF_ALU 0x04 +#define BPF_JMP 0x05 +#define BPF_RET 0x06 +#define BPF_MISC 0x07 + +/* ld/ldx fields */ +#define BPF_SIZE(code) ((code) & 0x18) +#define BPF_W 0x00 +#define BPF_H 0x08 +#define BPF_B 0x10 +#define BPF_MODE(code) ((code) & 0xe0) +#define BPF_IMM 0x00 +#define BPF_ABS 0x20 +#define BPF_IND 0x40 +#define BPF_MEM 0x60 +#define BPF_LEN 0x80 +#define BPF_MSH 0xa0 + +/* alu/jmp fields */ +#define BPF_OP(code) ((code) & 0xf0) +#define BPF_ADD 0x00 +#define BPF_SUB 0x10 +#define BPF_MUL 0x20 +#define BPF_DIV 0x30 +#define BPF_OR 0x40 +#define BPF_AND 0x50 +#define BPF_LSH 0x60 +#define BPF_RSH 0x70 +#define BPF_NEG 0x80 +#define BPF_JA 0x00 +#define BPF_JEQ 0x10 +#define BPF_JGT 0x20 +#define BPF_JGE 0x30 +#define BPF_JSET 0x40 +#define BPF_SRC(code) ((code) & 0x08) +#define BPF_K 0x00 +#define BPF_X 0x08 + +/* ret - BPF_K and BPF_X also apply */ +#define BPF_RVAL(code) ((code) & 0x18) +#define BPF_A 0x10 + +/* misc */ +#define BPF_MISCOP(code) ((code) & 0xf8) +#define BPF_TAX 0x00 +#define BPF_TXA 0x80 + +/* + * The instruction data structure. + */ +struct bpf_insn { + u_short code; + u_char jt; + u_char jf; + bpf_int32 k; +}; + +/* + * Macros for insn array initializers. + */ +#define BPF_STMT(code, k) { (u_short)(code), 0, 0, k } +#define BPF_JUMP(code, k, jt, jf) { (u_short)(code), jt, jf, k } + +#if __STDC__ || defined(__cplusplus) +extern int bpf_validate(struct bpf_insn *, int); +extern u_int bpf_filter(struct bpf_insn *, u_char *, u_int, u_int); +#else +extern int bpf_validate(); +extern u_int bpf_filter(); +#endif + +/* + * Number of scratch memory words (for BPF_LD|BPF_MEM and BPF_ST). + */ +#define BPF_MEMWORDS 16 + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/src/Cedar/winpcap/pcap-int.h b/src/Cedar/winpcap/pcap-int.h index 901d309d..1d34ab35 100644 --- a/src/Cedar/winpcap/pcap-int.h +++ b/src/Cedar/winpcap/pcap-int.h @@ -1,368 +1,368 @@ -/* - * Copyright (c) 1994, 1995, 1996 - * The Regents of the University of California. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the Computer Systems - * Engineering Group at Lawrence Berkeley Laboratory. - * 4. Neither the name of the University nor of the Laboratory may be used - * to endorse or promote products derived from this software without - * specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @(#) $Header: /tcpdump/master/libpcap/pcap-int.h,v 1.68.2.6 2005/07/07 06:56:04 guy Exp $ (LBL) - */ - -#ifndef pcap_int_h -#define pcap_int_h - -#ifdef __cplusplus -extern "C" { -#endif - -#include - -#ifdef WIN32 -#include -#endif /* WIN32 */ - -#ifdef MSDOS -#include -#include -#endif - -/* - * Savefile - */ -typedef enum { - NOT_SWAPPED, - SWAPPED, - MAYBE_SWAPPED -} swapped_type_t; - -struct pcap_sf { - FILE *rfile; - int swapped; - int hdrsize; - swapped_type_t lengths_swapped; - int version_major; - int version_minor; - u_char *base; -}; - -struct pcap_md { - struct pcap_stat stat; - /*XXX*/ - int use_bpf; /* using kernel filter */ - u_long TotPkts; /* can't oflow for 79 hrs on ether */ - u_long TotAccepted; /* count accepted by filter */ - u_long TotDrops; /* count of dropped packets */ - long TotMissed; /* missed by i/f during this run */ - long OrigMissed; /* missed by i/f before this run */ - char *device; /* device name */ -#ifdef linux - int sock_packet; /* using Linux 2.0 compatible interface */ - int timeout; /* timeout specified to pcap_open_live */ - int clear_promisc; /* must clear promiscuous mode when we close */ - int cooked; /* using SOCK_DGRAM rather than SOCK_RAW */ - int ifindex; /* interface index of device we're bound to */ - int lo_ifindex; /* interface index of the loopback device */ - struct pcap *next; /* list of open promiscuous sock_packet pcaps */ -#endif - -#ifdef HAVE_DAG_API -#ifdef HAVE_DAG_STREAMS_API - u_char *dag_mem_bottom; /* DAG card current memory bottom pointer */ - u_char *dag_mem_top; /* DAG card current memory top pointer */ -#else - void *dag_mem_base; /* DAG card memory base address */ - u_int dag_mem_bottom; /* DAG card current memory bottom offset */ - u_int dag_mem_top; /* DAG card current memory top offset */ -#endif /* HAVE_DAG_STREAMS_API */ - int dag_fcs_bits; /* Number of checksum bits from link layer */ - int dag_offset_flags; /* Flags to pass to dag_offset(). */ - int dag_stream; /* DAG stream number */ - int dag_timeout; /* timeout specified to pcap_open_live. - * Same as in linux above, introduce - * generally? */ -#endif /* HAVE_DAG_API */ - -#ifdef HAVE_REMOTE -/*! - There is really a mess with previous variables, and it seems to me that they are not used - (they are used in pcap_pf.c only). I think we have to start using them. - The meaning is the following: - - - TotPkts: the amount of packets received by the bpf filter, *before* applying the filter - - TotAccepted: the amount of packets that satisfies the filter - - TotDrops: the amount of packet that were dropped into the kernel buffer because of lack of space - - TotMissed: the amount of packets that were dropped by the physical interface; it is basically - the value of the hardware counter into the card. This number is never put to zero, so this number - takes into account the *total* number of interface drops starting from the interface power-on. - - OrigMissed: the amount of packets that were dropped by the interface *when the capture begins*. - This value is used to detect the number of packets dropped by the interface *during the present - capture*, so that (ps_ifdrops= TotMissed - OrigMissed). -*/ - unsigned int TotNetDrops; //!< keeps the number of packets that have been dropped by the network -/*! - \brief It keeps the number of packets that have been received by the application. - - Packets dropped by the kernel buffer are not counted in this variable. The variable is always - equal to (TotAccepted - TotDrops), except for the case of remote capture, in which we have also - packets in fligh, i.e. that have been transmitted by the remote host, but that have not been - received (yet) from the client. In this case, (TotAccepted - TotDrops - TotNetDrops) gives a - wrong result, since this number does not corresponds always to the number of packet received by - the application. For this reason, in the remote capture we need another variable that takes - into account of the number of packets actually received by the application. -*/ - unsigned int TotCapt; -#endif /* HAVE_REMOTE */ -}; - -/* - * Ultrix, DEC OSF/1^H^H^H^H^H^H^H^H^HDigital UNIX^H^H^H^H^H^H^H^H^H^H^H^H - * Tru64 UNIX, and NetBSD pad to make everything line up on a nice boundary. - */ -#if defined(ultrix) || defined(__osf__) || (defined(__NetBSD__) && __NetBSD_Version__ > 106000000) -#define PCAP_FDDIPAD 3 -#endif - -struct pcap { -#ifdef WIN32 - ADAPTER *adapter; - LPPACKET Packet; - int timeout; - int nonblock; -#else - int fd; - int selectable_fd; - int send_fd; -#endif /* WIN32 */ - int snapshot; - int linktype; - int tzoff; /* timezone offset */ - int offset; /* offset for proper alignment */ - - int break_loop; /* flag set to force break from packet-reading loop */ - -#ifdef PCAP_FDDIPAD - int fddipad; -#endif - -#ifdef MSDOS - int inter_packet_wait; /* offline: wait between packets */ - void (*wait_proc)(void); /* call proc while waiting */ -#endif - - struct pcap_sf sf; - struct pcap_md md; - - /* - * Read buffer. - */ - int bufsize; - u_char *buffer; - u_char *bp; - int cc; - - /* - * Place holder for pcap_next(). - */ - u_char *pkt; - - /* We're accepting only packets in this direction/these directions. */ - pcap_direction_t direction; - - /* - * Methods. - */ - int (*read_op)(pcap_t *, int cnt, pcap_handler, u_char *); - int (*inject_op)(pcap_t *, const void *, size_t); - int (*setfilter_op)(pcap_t *, struct bpf_program *); - int (*setdirection_op)(pcap_t *, pcap_direction_t); - int (*set_datalink_op)(pcap_t *, int); - int (*getnonblock_op)(pcap_t *, char *); - int (*setnonblock_op)(pcap_t *, int, char *); - int (*stats_op)(pcap_t *, struct pcap_stat *); - void (*close_op)(pcap_t *); - - /* - * Placeholder for filter code if bpf not in kernel. - */ - struct bpf_program fcode; - - char errbuf[PCAP_ERRBUF_SIZE + 1]; - int dlt_count; - u_int *dlt_list; - - struct pcap_pkthdr pcap_header; /* This is needed for the pcap_next_ex() to work */ - -#ifdef HAVE_REMOTE -#ifndef WIN32 // Win32 already defines 'timeout' - int timeout; //!< timeout to be used in the pcap_open() -#endif - /*! \brief '1' if we're the network client; needed by several functions (like pcap_setfilter() ) to know if - they have to use the socket or they have to open the local adapter. */ - int rmt_clientside; - - SOCKET rmt_sockctrl; //!< socket ID of the socket used for the control connection - SOCKET rmt_sockdata; //!< socket ID of the socket used for the data connection - int rmt_flags; //!< we have to save flags, since they are passed by the pcap_open_live(), but they are used by the pcap_startcapture() - int rmt_capstarted; //!< 'true' if the capture is already started (needed to know if we have to call the pcap_startcapture() - struct pcap_samp rmt_samp; //!< Keeps the parameters related to the sampling process. - char *currentfilter; //!< Pointer to a buffer (allocated at run-time) that stores the current filter. Needed when flag PCAP_OPENFLAG_NOCAPTURE_RPCAP is turned on. -#endif /* HAVE_REMOTE */ -}; - -/* - * This is a timeval as stored in disk in a dumpfile. - * It has to use the same types everywhere, independent of the actual - * `struct timeval' - */ - -struct pcap_timeval { - bpf_int32 tv_sec; /* seconds */ - bpf_int32 tv_usec; /* microseconds */ -}; - -/* - * How a `pcap_pkthdr' is actually stored in the dumpfile. - * - * Do not change the format of this structure, in any way (this includes - * changes that only affect the length of fields in this structure), - * and do not make the time stamp anything other than seconds and - * microseconds (e.g., seconds and nanoseconds). Instead: - * - * introduce a new structure for the new format; - * - * send mail to "tcpdump-workers@tcpdump.org", requesting a new - * magic number for your new capture file format, and, when - * you get the new magic number, put it in "savefile.c"; - * - * use that magic number for save files with the changed record - * header; - * - * make the code in "savefile.c" capable of reading files with - * the old record header as well as files with the new record header - * (using the magic number to determine the header format). - * - * Then supply the changes to "patches@tcpdump.org", so that future - * versions of libpcap and programs that use it (such as tcpdump) will - * be able to read your new capture file format. - */ - -struct pcap_sf_pkthdr { - struct pcap_timeval ts; /* time stamp */ - bpf_u_int32 caplen; /* length of portion present */ - bpf_u_int32 len; /* length this packet (off wire) */ -}; - -/* - * How a `pcap_pkthdr' is actually stored in dumpfiles written - * by some patched versions of libpcap (e.g. the ones in Red - * Hat Linux 6.1 and 6.2). - * - * Do not change the format of this structure, in any way (this includes - * changes that only affect the length of fields in this structure). - * Instead, introduce a new structure, as per the above. - */ - -struct pcap_sf_patched_pkthdr { - struct pcap_timeval ts; /* time stamp */ - bpf_u_int32 caplen; /* length of portion present */ - bpf_u_int32 len; /* length this packet (off wire) */ - int index; - unsigned short protocol; - unsigned char pkt_type; -}; - -int yylex(void); - -#ifndef min -#define min(a, b) ((a) > (b) ? (b) : (a)) -#endif - -/* XXX should these be in pcap.h? */ -int pcap_offline_read(pcap_t *, int, pcap_handler, u_char *); -int pcap_read(pcap_t *, int cnt, pcap_handler, u_char *); - -#ifndef HAVE_STRLCPY -#define strlcpy(x, y, z) \ - (strncpy((x), (y), (z)), \ - ((z) <= 0 ? 0 : ((x)[(z) - 1] = '\0')), \ - strlen((y))) -#endif - -#include - -#if !defined(HAVE_SNPRINTF) -#define snprintf pcap_snprintf -extern int snprintf (char *, size_t, const char *, ...); -#endif - -#if !defined(HAVE_VSNPRINTF) -#define vsnprintf pcap_vsnprintf -extern int vsnprintf (char *, size_t, const char *, va_list ap); -#endif - -/* - * Routines that most pcap implementations can use for non-blocking mode. - */ -#if !defined(WIN32) && !defined(MSDOS) -int pcap_getnonblock_fd(pcap_t *, char *); -int pcap_setnonblock_fd(pcap_t *p, int, char *); -#endif - -void pcap_close_common(pcap_t *); - -/* - * Internal interfaces for "pcap_findalldevs()". - * - * "pcap_platform_finddevs()" is a platform-dependent routine to - * add devices not found by the "standard" mechanisms (SIOCGIFCONF, - * "getifaddrs()", etc.. - * - * "pcap_add_if()" adds an interface to the list of interfaces. - */ -int pcap_platform_finddevs(pcap_if_t **, char *); -int add_addr_to_iflist(pcap_if_t **, const char *, u_int, struct sockaddr *, - size_t, struct sockaddr *, size_t, struct sockaddr *, size_t, - struct sockaddr *, size_t, char *); -int pcap_add_if(pcap_if_t **, const char *, u_int, const char *, char *); -struct sockaddr *dup_sockaddr(struct sockaddr *, size_t); -int add_or_find_if(pcap_if_t **, pcap_if_t **, const char *, u_int, - const char *, char *); - -#ifdef WIN32 -char *pcap_win32strerror(void); -#endif - -int install_bpf_program(pcap_t *, struct bpf_program *); - -int pcap_strcasecmp(const char *, const char *); - -#ifdef __cplusplus -} -#endif - -#endif +/* + * Copyright (c) 1994, 1995, 1996 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the Computer Systems + * Engineering Group at Lawrence Berkeley Laboratory. + * 4. Neither the name of the University nor of the Laboratory may be used + * to endorse or promote products derived from this software without + * specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#) $Header: /tcpdump/master/libpcap/pcap-int.h,v 1.68.2.6 2005/07/07 06:56:04 guy Exp $ (LBL) + */ + +#ifndef pcap_int_h +#define pcap_int_h + +#ifdef __cplusplus +extern "C" { +#endif + +#include + +#ifdef WIN32 +#include +#endif /* WIN32 */ + +#ifdef MSDOS +#include +#include +#endif + +/* + * Savefile + */ +typedef enum { + NOT_SWAPPED, + SWAPPED, + MAYBE_SWAPPED +} swapped_type_t; + +struct pcap_sf { + FILE *rfile; + int swapped; + int hdrsize; + swapped_type_t lengths_swapped; + int version_major; + int version_minor; + u_char *base; +}; + +struct pcap_md { + struct pcap_stat stat; + /*XXX*/ + int use_bpf; /* using kernel filter */ + u_long TotPkts; /* can't oflow for 79 hrs on ether */ + u_long TotAccepted; /* count accepted by filter */ + u_long TotDrops; /* count of dropped packets */ + long TotMissed; /* missed by i/f during this run */ + long OrigMissed; /* missed by i/f before this run */ + char *device; /* device name */ +#ifdef linux + int sock_packet; /* using Linux 2.0 compatible interface */ + int timeout; /* timeout specified to pcap_open_live */ + int clear_promisc; /* must clear promiscuous mode when we close */ + int cooked; /* using SOCK_DGRAM rather than SOCK_RAW */ + int ifindex; /* interface index of device we're bound to */ + int lo_ifindex; /* interface index of the loopback device */ + struct pcap *next; /* list of open promiscuous sock_packet pcaps */ +#endif + +#ifdef HAVE_DAG_API +#ifdef HAVE_DAG_STREAMS_API + u_char *dag_mem_bottom; /* DAG card current memory bottom pointer */ + u_char *dag_mem_top; /* DAG card current memory top pointer */ +#else + void *dag_mem_base; /* DAG card memory base address */ + u_int dag_mem_bottom; /* DAG card current memory bottom offset */ + u_int dag_mem_top; /* DAG card current memory top offset */ +#endif /* HAVE_DAG_STREAMS_API */ + int dag_fcs_bits; /* Number of checksum bits from link layer */ + int dag_offset_flags; /* Flags to pass to dag_offset(). */ + int dag_stream; /* DAG stream number */ + int dag_timeout; /* timeout specified to pcap_open_live. + * Same as in linux above, introduce + * generally? */ +#endif /* HAVE_DAG_API */ + +#ifdef HAVE_REMOTE +/*! + There is really a mess with previous variables, and it seems to me that they are not used + (they are used in pcap_pf.c only). I think we have to start using them. + The meaning is the following: + + - TotPkts: the amount of packets received by the bpf filter, *before* applying the filter + - TotAccepted: the amount of packets that satisfies the filter + - TotDrops: the amount of packet that were dropped into the kernel buffer because of lack of space + - TotMissed: the amount of packets that were dropped by the physical interface; it is basically + the value of the hardware counter into the card. This number is never put to zero, so this number + takes into account the *total* number of interface drops starting from the interface power-on. + - OrigMissed: the amount of packets that were dropped by the interface *when the capture begins*. + This value is used to detect the number of packets dropped by the interface *during the present + capture*, so that (ps_ifdrops= TotMissed - OrigMissed). +*/ + unsigned int TotNetDrops; //!< keeps the number of packets that have been dropped by the network +/*! + \brief It keeps the number of packets that have been received by the application. + + Packets dropped by the kernel buffer are not counted in this variable. The variable is always + equal to (TotAccepted - TotDrops), except for the case of remote capture, in which we have also + packets in fligh, i.e. that have been transmitted by the remote host, but that have not been + received (yet) from the client. In this case, (TotAccepted - TotDrops - TotNetDrops) gives a + wrong result, since this number does not corresponds always to the number of packet received by + the application. For this reason, in the remote capture we need another variable that takes + into account of the number of packets actually received by the application. +*/ + unsigned int TotCapt; +#endif /* HAVE_REMOTE */ +}; + +/* + * Ultrix, DEC OSF/1^H^H^H^H^H^H^H^H^HDigital UNIX^H^H^H^H^H^H^H^H^H^H^H^H + * Tru64 UNIX, and NetBSD pad to make everything line up on a nice boundary. + */ +#if defined(ultrix) || defined(__osf__) || (defined(__NetBSD__) && __NetBSD_Version__ > 106000000) +#define PCAP_FDDIPAD 3 +#endif + +struct pcap { +#ifdef WIN32 + ADAPTER *adapter; + LPPACKET Packet; + int timeout; + int nonblock; +#else + int fd; + int selectable_fd; + int send_fd; +#endif /* WIN32 */ + int snapshot; + int linktype; + int tzoff; /* timezone offset */ + int offset; /* offset for proper alignment */ + + int break_loop; /* flag set to force break from packet-reading loop */ + +#ifdef PCAP_FDDIPAD + int fddipad; +#endif + +#ifdef MSDOS + int inter_packet_wait; /* offline: wait between packets */ + void (*wait_proc)(void); /* call proc while waiting */ +#endif + + struct pcap_sf sf; + struct pcap_md md; + + /* + * Read buffer. + */ + int bufsize; + u_char *buffer; + u_char *bp; + int cc; + + /* + * Place holder for pcap_next(). + */ + u_char *pkt; + + /* We're accepting only packets in this direction/these directions. */ + pcap_direction_t direction; + + /* + * Methods. + */ + int (*read_op)(pcap_t *, int cnt, pcap_handler, u_char *); + int (*inject_op)(pcap_t *, const void *, size_t); + int (*setfilter_op)(pcap_t *, struct bpf_program *); + int (*setdirection_op)(pcap_t *, pcap_direction_t); + int (*set_datalink_op)(pcap_t *, int); + int (*getnonblock_op)(pcap_t *, char *); + int (*setnonblock_op)(pcap_t *, int, char *); + int (*stats_op)(pcap_t *, struct pcap_stat *); + void (*close_op)(pcap_t *); + + /* + * Placeholder for filter code if bpf not in kernel. + */ + struct bpf_program fcode; + + char errbuf[PCAP_ERRBUF_SIZE + 1]; + int dlt_count; + u_int *dlt_list; + + struct pcap_pkthdr pcap_header; /* This is needed for the pcap_next_ex() to work */ + +#ifdef HAVE_REMOTE +#ifndef WIN32 // Win32 already defines 'timeout' + int timeout; //!< timeout to be used in the pcap_open() +#endif + /*! \brief '1' if we're the network client; needed by several functions (like pcap_setfilter() ) to know if + they have to use the socket or they have to open the local adapter. */ + int rmt_clientside; + + SOCKET rmt_sockctrl; //!< socket ID of the socket used for the control connection + SOCKET rmt_sockdata; //!< socket ID of the socket used for the data connection + int rmt_flags; //!< we have to save flags, since they are passed by the pcap_open_live(), but they are used by the pcap_startcapture() + int rmt_capstarted; //!< 'true' if the capture is already started (needed to know if we have to call the pcap_startcapture() + struct pcap_samp rmt_samp; //!< Keeps the parameters related to the sampling process. + char *currentfilter; //!< Pointer to a buffer (allocated at run-time) that stores the current filter. Needed when flag PCAP_OPENFLAG_NOCAPTURE_RPCAP is turned on. +#endif /* HAVE_REMOTE */ +}; + +/* + * This is a timeval as stored in disk in a dumpfile. + * It has to use the same types everywhere, independent of the actual + * `struct timeval' + */ + +struct pcap_timeval { + bpf_int32 tv_sec; /* seconds */ + bpf_int32 tv_usec; /* microseconds */ +}; + +/* + * How a `pcap_pkthdr' is actually stored in the dumpfile. + * + * Do not change the format of this structure, in any way (this includes + * changes that only affect the length of fields in this structure), + * and do not make the time stamp anything other than seconds and + * microseconds (e.g., seconds and nanoseconds). Instead: + * + * introduce a new structure for the new format; + * + * send mail to "tcpdump-workers@tcpdump.org", requesting a new + * magic number for your new capture file format, and, when + * you get the new magic number, put it in "savefile.c"; + * + * use that magic number for save files with the changed record + * header; + * + * make the code in "savefile.c" capable of reading files with + * the old record header as well as files with the new record header + * (using the magic number to determine the header format). + * + * Then supply the changes to "patches@tcpdump.org", so that future + * versions of libpcap and programs that use it (such as tcpdump) will + * be able to read your new capture file format. + */ + +struct pcap_sf_pkthdr { + struct pcap_timeval ts; /* time stamp */ + bpf_u_int32 caplen; /* length of portion present */ + bpf_u_int32 len; /* length this packet (off wire) */ +}; + +/* + * How a `pcap_pkthdr' is actually stored in dumpfiles written + * by some patched versions of libpcap (e.g. the ones in Red + * Hat Linux 6.1 and 6.2). + * + * Do not change the format of this structure, in any way (this includes + * changes that only affect the length of fields in this structure). + * Instead, introduce a new structure, as per the above. + */ + +struct pcap_sf_patched_pkthdr { + struct pcap_timeval ts; /* time stamp */ + bpf_u_int32 caplen; /* length of portion present */ + bpf_u_int32 len; /* length this packet (off wire) */ + int index; + unsigned short protocol; + unsigned char pkt_type; +}; + +int yylex(void); + +#ifndef min +#define min(a, b) ((a) > (b) ? (b) : (a)) +#endif + +/* XXX should these be in pcap.h? */ +int pcap_offline_read(pcap_t *, int, pcap_handler, u_char *); +int pcap_read(pcap_t *, int cnt, pcap_handler, u_char *); + +#ifndef HAVE_STRLCPY +#define strlcpy(x, y, z) \ + (strncpy((x), (y), (z)), \ + ((z) <= 0 ? 0 : ((x)[(z) - 1] = '\0')), \ + strlen((y))) +#endif + +#include + +#if !defined(HAVE_SNPRINTF) +#define snprintf pcap_snprintf +extern int snprintf (char *, size_t, const char *, ...); +#endif + +#if !defined(HAVE_VSNPRINTF) +#define vsnprintf pcap_vsnprintf +extern int vsnprintf (char *, size_t, const char *, va_list ap); +#endif + +/* + * Routines that most pcap implementations can use for non-blocking mode. + */ +#if !defined(WIN32) && !defined(MSDOS) +int pcap_getnonblock_fd(pcap_t *, char *); +int pcap_setnonblock_fd(pcap_t *p, int, char *); +#endif + +void pcap_close_common(pcap_t *); + +/* + * Internal interfaces for "pcap_findalldevs()". + * + * "pcap_platform_finddevs()" is a platform-dependent routine to + * add devices not found by the "standard" mechanisms (SIOCGIFCONF, + * "getifaddrs()", etc.. + * + * "pcap_add_if()" adds an interface to the list of interfaces. + */ +int pcap_platform_finddevs(pcap_if_t **, char *); +int add_addr_to_iflist(pcap_if_t **, const char *, u_int, struct sockaddr *, + size_t, struct sockaddr *, size_t, struct sockaddr *, size_t, + struct sockaddr *, size_t, char *); +int pcap_add_if(pcap_if_t **, const char *, u_int, const char *, char *); +struct sockaddr *dup_sockaddr(struct sockaddr *, size_t); +int add_or_find_if(pcap_if_t **, pcap_if_t **, const char *, u_int, + const char *, char *); + +#ifdef WIN32 +char *pcap_win32strerror(void); +#endif + +int install_bpf_program(pcap_t *, struct bpf_program *); + +int pcap_strcasecmp(const char *, const char *); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/src/Cedar/winpcap/pcap-stdinc.h b/src/Cedar/winpcap/pcap-stdinc.h index b04f9be7..fbf22de4 100644 --- a/src/Cedar/winpcap/pcap-stdinc.h +++ b/src/Cedar/winpcap/pcap-stdinc.h @@ -1,65 +1,65 @@ -/* - * Copyright (c) 2002 - 2003 - * NetGroup, Politecnico di Torino (Italy) - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the Politecnico di Torino nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - */ - -#define SIZEOF_CHAR 1 -#define SIZEOF_SHORT 2 -#define SIZEOF_INT 4 -#ifndef _MSC_EXTENSIONS -#define SIZEOF_LONG_LONG 8 -#endif - - -/* - * Avoids a compiler warning in case this was already defined - * (someone defined _WINSOCKAPI_ when including 'windows.h', in order - * to prevent it from including 'winsock.h') - */ -#ifdef _WINSOCKAPI_ -#undef _WINSOCKAPI_ -#endif -#include - -#include - -#include "bittypes.h" -#include -#include - -#ifndef __MINGW32__ -#include "IP6_misc.h" -#endif - -#define caddr_t char* - -#define snprintf _snprintf -#define vsnprintf _vsnprintf -#define inline __inline +/* + * Copyright (c) 2002 - 2003 + * NetGroup, Politecnico di Torino (Italy) + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the Politecnico di Torino nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#define SIZEOF_CHAR 1 +#define SIZEOF_SHORT 2 +#define SIZEOF_INT 4 +#ifndef _MSC_EXTENSIONS +#define SIZEOF_LONG_LONG 8 +#endif + + +/* + * Avoids a compiler warning in case this was already defined + * (someone defined _WINSOCKAPI_ when including 'windows.h', in order + * to prevent it from including 'winsock.h') + */ +#ifdef _WINSOCKAPI_ +#undef _WINSOCKAPI_ +#endif +#include + +#include + +#include "bittypes.h" +#include +#include + +#ifndef __MINGW32__ +#include "IP6_misc.h" +#endif + +#define caddr_t char* + +#define snprintf _snprintf +#define vsnprintf _vsnprintf +#define inline __inline diff --git a/src/Cedar/winpcap/pcap.h b/src/Cedar/winpcap/pcap.h index 7e5a773f..c1e4519a 100644 --- a/src/Cedar/winpcap/pcap.h +++ b/src/Cedar/winpcap/pcap.h @@ -1,337 +1,337 @@ -/* -*- Mode: c; tab-width: 8; indent-tabs-mode: 1; c-basic-offset: 8; -*- */ -/* - * Copyright (c) 1993, 1994, 1995, 1996, 1997 - * The Regents of the University of California. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the Computer Systems - * Engineering Group at Lawrence Berkeley Laboratory. - * 4. Neither the name of the University nor of the Laboratory may be used - * to endorse or promote products derived from this software without - * specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @(#) $Header: /tcpdump/master/libpcap/pcap.h,v 1.52.2.5 2005/07/07 02:04:36 guy Exp $ (LBL) - */ - -#ifndef lib_pcap_h -#define lib_pcap_h - -#if defined(WIN32) - #include -#elif defined(MSDOS) - #include - #include /* u_int, u_char etc. */ -#else /* UN*X */ - #include - #include -#endif /* WIN32/MSDOS/UN*X */ - -#ifndef PCAP_DONT_INCLUDE_PCAP_BPF_H -#include -#endif - -#include - -#ifdef HAVE_REMOTE - // We have to define the SOCKET here, although it has been defined in sockutils.h - // This is to avoid the distribution of the 'sockutils.h' file around - // (for example in the WinPcap developer's pack) - #ifndef SOCKET - #ifdef WIN32 - #define SOCKET unsigned int - #else - #define SOCKET int - #endif - #endif -#endif - -#ifdef __cplusplus -extern "C" { -#endif - -#define PCAP_VERSION_MAJOR 2 -#define PCAP_VERSION_MINOR 4 - -#define PCAP_ERRBUF_SIZE 256 - -/* - * Compatibility for systems that have a bpf.h that - * predates the bpf typedefs for 64-bit support. - */ -#if BPF_RELEASE - 0 < 199406 -typedef int bpf_int32; -typedef u_int bpf_u_int32; -#endif - -typedef struct pcap pcap_t; -typedef struct pcap_dumper pcap_dumper_t; -typedef struct pcap_if pcap_if_t; -typedef struct pcap_addr pcap_addr_t; - -/* - * The first record in the file contains saved values for some - * of the flags used in the printout phases of tcpdump. - * Many fields here are 32 bit ints so compilers won't insert unwanted - * padding; these files need to be interchangeable across architectures. - * - * Do not change the layout of this structure, in any way (this includes - * changes that only affect the length of fields in this structure). - * - * Also, do not change the interpretation of any of the members of this - * structure, in any way (this includes using values other than - * LINKTYPE_ values, as defined in "savefile.c", in the "linktype" - * field). - * - * Instead: - * - * introduce a new structure for the new format, if the layout - * of the structure changed; - * - * send mail to "tcpdump-workers@tcpdump.org", requesting a new - * magic number for your new capture file format, and, when - * you get the new magic number, put it in "savefile.c"; - * - * use that magic number for save files with the changed file - * header; - * - * make the code in "savefile.c" capable of reading files with - * the old file header as well as files with the new file header - * (using the magic number to determine the header format). - * - * Then supply the changes to "patches@tcpdump.org", so that future - * versions of libpcap and programs that use it (such as tcpdump) will - * be able to read your new capture file format. - */ -struct pcap_file_header { - bpf_u_int32 magic; - u_short version_major; - u_short version_minor; - bpf_int32 thiszone; /* gmt to local correction */ - bpf_u_int32 sigfigs; /* accuracy of timestamps */ - bpf_u_int32 snaplen; /* max length saved portion of each pkt */ - bpf_u_int32 linktype; /* data link type (LINKTYPE_*) */ -}; - -typedef enum { - PCAP_D_INOUT = 0, - PCAP_D_IN, - PCAP_D_OUT -} pcap_direction_t; - -/* - * Each packet in the dump file is prepended with this generic header. - * This gets around the problem of different headers for different - * packet interfaces. - */ -struct pcap_pkthdr { - struct timeval ts; /* time stamp */ - bpf_u_int32 caplen; /* length of portion present */ - bpf_u_int32 len; /* length this packet (off wire) */ -}; - -/* - * As returned by the pcap_stats() - */ -struct pcap_stat { - u_int ps_recv; /* number of packets received */ - u_int ps_drop; /* number of packets dropped */ - u_int ps_ifdrop; /* drops by interface XXX not yet supported */ -#ifdef HAVE_REMOTE - u_int ps_capt; /* number of packets that are received by the application; please get rid off the Win32 ifdef */ - u_int ps_sent; /* number of packets sent by the server on the network */ - u_int ps_netdrop; /* number of packets lost on the network */ -#endif /* HAVE_REMOTE */ -}; - -#ifdef MSDOS -/* - * As returned by the pcap_stats_ex() - */ -struct pcap_stat_ex { - u_long rx_packets; /* total packets received */ - u_long tx_packets; /* total packets transmitted */ - u_long rx_bytes; /* total bytes received */ - u_long tx_bytes; /* total bytes transmitted */ - u_long rx_errors; /* bad packets received */ - u_long tx_errors; /* packet transmit problems */ - u_long rx_dropped; /* no space in Rx buffers */ - u_long tx_dropped; /* no space available for Tx */ - u_long multicast; /* multicast packets received */ - u_long collisions; - - /* detailed rx_errors: */ - u_long rx_length_errors; - u_long rx_over_errors; /* receiver ring buff overflow */ - u_long rx_crc_errors; /* recv'd pkt with crc error */ - u_long rx_frame_errors; /* recv'd frame alignment error */ - u_long rx_fifo_errors; /* recv'r fifo overrun */ - u_long rx_missed_errors; /* recv'r missed packet */ - - /* detailed tx_errors */ - u_long tx_aborted_errors; - u_long tx_carrier_errors; - u_long tx_fifo_errors; - u_long tx_heartbeat_errors; - u_long tx_window_errors; - }; -#endif - -/* - * Item in a list of interfaces. - */ -struct pcap_if { - struct pcap_if *next; - char *name; /* name to hand to "pcap_open_live()" */ - char *description; /* textual description of interface, or NULL */ - struct pcap_addr *addresses; - bpf_u_int32 flags; /* PCAP_IF_ interface flags */ -}; - -#define PCAP_IF_LOOPBACK 0x00000001 /* interface is loopback */ - -/* - * Representation of an interface address. - */ -struct pcap_addr { - struct pcap_addr *next; - struct sockaddr *addr; /* address */ - struct sockaddr *netmask; /* netmask for that address */ - struct sockaddr *broadaddr; /* broadcast address for that address */ - struct sockaddr *dstaddr; /* P2P destination address for that address */ -}; - -typedef void (*pcap_handler)(u_char *, const struct pcap_pkthdr *, - const u_char *); - -char *pcap_lookupdev(char *); -int pcap_lookupnet(const char *, bpf_u_int32 *, bpf_u_int32 *, char *); -pcap_t *pcap_open_live(const char *, int, int, int, char *); -pcap_t *pcap_open_dead(int, int); -pcap_t *pcap_open_offline(const char *, char *); -pcap_t *pcap_fopen_offline(FILE *, char *); -void pcap_close(pcap_t *); -int pcap_loop(pcap_t *, int, pcap_handler, u_char *); -int pcap_dispatch(pcap_t *, int, pcap_handler, u_char *); -const u_char* - pcap_next(pcap_t *, struct pcap_pkthdr *); -int pcap_next_ex(pcap_t *, struct pcap_pkthdr **, const u_char **); -void pcap_breakloop(pcap_t *); -int pcap_stats(pcap_t *, struct pcap_stat *); -int pcap_setfilter(pcap_t *, struct bpf_program *); -int pcap_setdirection(pcap_t *, pcap_direction_t); -int pcap_getnonblock(pcap_t *, char *); -int pcap_setnonblock(pcap_t *, int, char *); -void pcap_perror(pcap_t *, char *); -int pcap_inject(pcap_t *, const void *, size_t); -int pcap_sendpacket(pcap_t *, const u_char *, int); -char *pcap_strerror(int); -char *pcap_geterr(pcap_t *); -int pcap_compile(pcap_t *, struct bpf_program *, char *, int, - bpf_u_int32); -int pcap_compile_nopcap(int, int, struct bpf_program *, - char *, int, bpf_u_int32); -void pcap_freecode(struct bpf_program *); -int pcap_datalink(pcap_t *); -int pcap_list_datalinks(pcap_t *, int **); -int pcap_set_datalink(pcap_t *, int); -int pcap_datalink_name_to_val(const char *); -const char *pcap_datalink_val_to_name(int); -const char *pcap_datalink_val_to_description(int); -int pcap_snapshot(pcap_t *); -int pcap_is_swapped(pcap_t *); -int pcap_major_version(pcap_t *); -int pcap_minor_version(pcap_t *); - -/* XXX */ -FILE *pcap_file(pcap_t *); -int pcap_fileno(pcap_t *); - -pcap_dumper_t *pcap_dump_open(pcap_t *, const char *); -pcap_dumper_t *pcap_dump_fopen(pcap_t *, FILE *fp); -FILE *pcap_dump_file(pcap_dumper_t *); -long pcap_dump_ftell(pcap_dumper_t *); -int pcap_dump_flush(pcap_dumper_t *); -void pcap_dump_close(pcap_dumper_t *); -void pcap_dump(u_char *, const struct pcap_pkthdr *, const u_char *); - -int pcap_findalldevs(pcap_if_t **, char *); -void pcap_freealldevs(pcap_if_t *); - -const char *pcap_lib_version(void); - -/* XXX this guy lives in the bpf tree */ -u_int bpf_filter(struct bpf_insn *, u_char *, u_int, u_int); -int bpf_validate(struct bpf_insn *f, int len); -char *bpf_image(struct bpf_insn *, int); -void bpf_dump(struct bpf_program *, int); - -#if defined(WIN32) - -/* - * Win32 definitions - */ - -int pcap_setbuff(pcap_t *p, int dim); -int pcap_setmode(pcap_t *p, int mode); -int pcap_setmintocopy(pcap_t *p, int size); - -#ifdef WPCAP -/* Include file with the wpcap-specific extensions */ -#include -#endif /* WPCAP */ - -#define MODE_CAPT 0 -#define MODE_STAT 1 -#define MODE_MON 2 - -#elif defined(MSDOS) - -/* - * MS-DOS definitions - */ - -int pcap_stats_ex (pcap_t *, struct pcap_stat_ex *); -void pcap_set_wait (pcap_t *p, void (*yield)(void), int wait); -u_long pcap_mac_packets (void); - -#else /* UN*X */ - -/* - * UN*X definitions - */ - -int pcap_get_selectable_fd(pcap_t *); - -#endif /* WIN32/MSDOS/UN*X */ - -#ifdef HAVE_REMOTE -/* Includes most of the public stuff that is needed for the remote capture */ -#include "remote-ext.h" -#endif /* HAVE_REMOTE */ - -#ifdef __cplusplus -} -#endif - -#endif +/* -*- Mode: c; tab-width: 8; indent-tabs-mode: 1; c-basic-offset: 8; -*- */ +/* + * Copyright (c) 1993, 1994, 1995, 1996, 1997 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the Computer Systems + * Engineering Group at Lawrence Berkeley Laboratory. + * 4. Neither the name of the University nor of the Laboratory may be used + * to endorse or promote products derived from this software without + * specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#) $Header: /tcpdump/master/libpcap/pcap.h,v 1.52.2.5 2005/07/07 02:04:36 guy Exp $ (LBL) + */ + +#ifndef lib_pcap_h +#define lib_pcap_h + +#if defined(WIN32) + #include +#elif defined(MSDOS) + #include + #include /* u_int, u_char etc. */ +#else /* UN*X */ + #include + #include +#endif /* WIN32/MSDOS/UN*X */ + +#ifndef PCAP_DONT_INCLUDE_PCAP_BPF_H +#include +#endif + +#include + +#ifdef HAVE_REMOTE + // We have to define the SOCKET here, although it has been defined in sockutils.h + // This is to avoid the distribution of the 'sockutils.h' file around + // (for example in the WinPcap developer's pack) + #ifndef SOCKET + #ifdef WIN32 + #define SOCKET unsigned int + #else + #define SOCKET int + #endif + #endif +#endif + +#ifdef __cplusplus +extern "C" { +#endif + +#define PCAP_VERSION_MAJOR 2 +#define PCAP_VERSION_MINOR 4 + +#define PCAP_ERRBUF_SIZE 256 + +/* + * Compatibility for systems that have a bpf.h that + * predates the bpf typedefs for 64-bit support. + */ +#if BPF_RELEASE - 0 < 199406 +typedef int bpf_int32; +typedef u_int bpf_u_int32; +#endif + +typedef struct pcap pcap_t; +typedef struct pcap_dumper pcap_dumper_t; +typedef struct pcap_if pcap_if_t; +typedef struct pcap_addr pcap_addr_t; + +/* + * The first record in the file contains saved values for some + * of the flags used in the printout phases of tcpdump. + * Many fields here are 32 bit ints so compilers won't insert unwanted + * padding; these files need to be interchangeable across architectures. + * + * Do not change the layout of this structure, in any way (this includes + * changes that only affect the length of fields in this structure). + * + * Also, do not change the interpretation of any of the members of this + * structure, in any way (this includes using values other than + * LINKTYPE_ values, as defined in "savefile.c", in the "linktype" + * field). + * + * Instead: + * + * introduce a new structure for the new format, if the layout + * of the structure changed; + * + * send mail to "tcpdump-workers@tcpdump.org", requesting a new + * magic number for your new capture file format, and, when + * you get the new magic number, put it in "savefile.c"; + * + * use that magic number for save files with the changed file + * header; + * + * make the code in "savefile.c" capable of reading files with + * the old file header as well as files with the new file header + * (using the magic number to determine the header format). + * + * Then supply the changes to "patches@tcpdump.org", so that future + * versions of libpcap and programs that use it (such as tcpdump) will + * be able to read your new capture file format. + */ +struct pcap_file_header { + bpf_u_int32 magic; + u_short version_major; + u_short version_minor; + bpf_int32 thiszone; /* gmt to local correction */ + bpf_u_int32 sigfigs; /* accuracy of timestamps */ + bpf_u_int32 snaplen; /* max length saved portion of each pkt */ + bpf_u_int32 linktype; /* data link type (LINKTYPE_*) */ +}; + +typedef enum { + PCAP_D_INOUT = 0, + PCAP_D_IN, + PCAP_D_OUT +} pcap_direction_t; + +/* + * Each packet in the dump file is prepended with this generic header. + * This gets around the problem of different headers for different + * packet interfaces. + */ +struct pcap_pkthdr { + struct timeval ts; /* time stamp */ + bpf_u_int32 caplen; /* length of portion present */ + bpf_u_int32 len; /* length this packet (off wire) */ +}; + +/* + * As returned by the pcap_stats() + */ +struct pcap_stat { + u_int ps_recv; /* number of packets received */ + u_int ps_drop; /* number of packets dropped */ + u_int ps_ifdrop; /* drops by interface XXX not yet supported */ +#ifdef HAVE_REMOTE + u_int ps_capt; /* number of packets that are received by the application; please get rid off the Win32 ifdef */ + u_int ps_sent; /* number of packets sent by the server on the network */ + u_int ps_netdrop; /* number of packets lost on the network */ +#endif /* HAVE_REMOTE */ +}; + +#ifdef MSDOS +/* + * As returned by the pcap_stats_ex() + */ +struct pcap_stat_ex { + u_long rx_packets; /* total packets received */ + u_long tx_packets; /* total packets transmitted */ + u_long rx_bytes; /* total bytes received */ + u_long tx_bytes; /* total bytes transmitted */ + u_long rx_errors; /* bad packets received */ + u_long tx_errors; /* packet transmit problems */ + u_long rx_dropped; /* no space in Rx buffers */ + u_long tx_dropped; /* no space available for Tx */ + u_long multicast; /* multicast packets received */ + u_long collisions; + + /* detailed rx_errors: */ + u_long rx_length_errors; + u_long rx_over_errors; /* receiver ring buff overflow */ + u_long rx_crc_errors; /* recv'd pkt with crc error */ + u_long rx_frame_errors; /* recv'd frame alignment error */ + u_long rx_fifo_errors; /* recv'r fifo overrun */ + u_long rx_missed_errors; /* recv'r missed packet */ + + /* detailed tx_errors */ + u_long tx_aborted_errors; + u_long tx_carrier_errors; + u_long tx_fifo_errors; + u_long tx_heartbeat_errors; + u_long tx_window_errors; + }; +#endif + +/* + * Item in a list of interfaces. + */ +struct pcap_if { + struct pcap_if *next; + char *name; /* name to hand to "pcap_open_live()" */ + char *description; /* textual description of interface, or NULL */ + struct pcap_addr *addresses; + bpf_u_int32 flags; /* PCAP_IF_ interface flags */ +}; + +#define PCAP_IF_LOOPBACK 0x00000001 /* interface is loopback */ + +/* + * Representation of an interface address. + */ +struct pcap_addr { + struct pcap_addr *next; + struct sockaddr *addr; /* address */ + struct sockaddr *netmask; /* netmask for that address */ + struct sockaddr *broadaddr; /* broadcast address for that address */ + struct sockaddr *dstaddr; /* P2P destination address for that address */ +}; + +typedef void (*pcap_handler)(u_char *, const struct pcap_pkthdr *, + const u_char *); + +char *pcap_lookupdev(char *); +int pcap_lookupnet(const char *, bpf_u_int32 *, bpf_u_int32 *, char *); +pcap_t *pcap_open_live(const char *, int, int, int, char *); +pcap_t *pcap_open_dead(int, int); +pcap_t *pcap_open_offline(const char *, char *); +pcap_t *pcap_fopen_offline(FILE *, char *); +void pcap_close(pcap_t *); +int pcap_loop(pcap_t *, int, pcap_handler, u_char *); +int pcap_dispatch(pcap_t *, int, pcap_handler, u_char *); +const u_char* + pcap_next(pcap_t *, struct pcap_pkthdr *); +int pcap_next_ex(pcap_t *, struct pcap_pkthdr **, const u_char **); +void pcap_breakloop(pcap_t *); +int pcap_stats(pcap_t *, struct pcap_stat *); +int pcap_setfilter(pcap_t *, struct bpf_program *); +int pcap_setdirection(pcap_t *, pcap_direction_t); +int pcap_getnonblock(pcap_t *, char *); +int pcap_setnonblock(pcap_t *, int, char *); +void pcap_perror(pcap_t *, char *); +int pcap_inject(pcap_t *, const void *, size_t); +int pcap_sendpacket(pcap_t *, const u_char *, int); +char *pcap_strerror(int); +char *pcap_geterr(pcap_t *); +int pcap_compile(pcap_t *, struct bpf_program *, char *, int, + bpf_u_int32); +int pcap_compile_nopcap(int, int, struct bpf_program *, + char *, int, bpf_u_int32); +void pcap_freecode(struct bpf_program *); +int pcap_datalink(pcap_t *); +int pcap_list_datalinks(pcap_t *, int **); +int pcap_set_datalink(pcap_t *, int); +int pcap_datalink_name_to_val(const char *); +const char *pcap_datalink_val_to_name(int); +const char *pcap_datalink_val_to_description(int); +int pcap_snapshot(pcap_t *); +int pcap_is_swapped(pcap_t *); +int pcap_major_version(pcap_t *); +int pcap_minor_version(pcap_t *); + +/* XXX */ +FILE *pcap_file(pcap_t *); +int pcap_fileno(pcap_t *); + +pcap_dumper_t *pcap_dump_open(pcap_t *, const char *); +pcap_dumper_t *pcap_dump_fopen(pcap_t *, FILE *fp); +FILE *pcap_dump_file(pcap_dumper_t *); +long pcap_dump_ftell(pcap_dumper_t *); +int pcap_dump_flush(pcap_dumper_t *); +void pcap_dump_close(pcap_dumper_t *); +void pcap_dump(u_char *, const struct pcap_pkthdr *, const u_char *); + +int pcap_findalldevs(pcap_if_t **, char *); +void pcap_freealldevs(pcap_if_t *); + +const char *pcap_lib_version(void); + +/* XXX this guy lives in the bpf tree */ +u_int bpf_filter(struct bpf_insn *, u_char *, u_int, u_int); +int bpf_validate(struct bpf_insn *f, int len); +char *bpf_image(struct bpf_insn *, int); +void bpf_dump(struct bpf_program *, int); + +#if defined(WIN32) + +/* + * Win32 definitions + */ + +int pcap_setbuff(pcap_t *p, int dim); +int pcap_setmode(pcap_t *p, int mode); +int pcap_setmintocopy(pcap_t *p, int size); + +#ifdef WPCAP +/* Include file with the wpcap-specific extensions */ +#include +#endif /* WPCAP */ + +#define MODE_CAPT 0 +#define MODE_STAT 1 +#define MODE_MON 2 + +#elif defined(MSDOS) + +/* + * MS-DOS definitions + */ + +int pcap_stats_ex (pcap_t *, struct pcap_stat_ex *); +void pcap_set_wait (pcap_t *p, void (*yield)(void), int wait); +u_long pcap_mac_packets (void); + +#else /* UN*X */ + +/* + * UN*X definitions + */ + +int pcap_get_selectable_fd(pcap_t *); + +#endif /* WIN32/MSDOS/UN*X */ + +#ifdef HAVE_REMOTE +/* Includes most of the public stuff that is needed for the remote capture */ +#include "remote-ext.h" +#endif /* HAVE_REMOTE */ + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/src/Cedar/winpcap/pthread.h b/src/Cedar/winpcap/pthread.h index 7d5a0cd1..0669cc95 100644 --- a/src/Cedar/winpcap/pthread.h +++ b/src/Cedar/winpcap/pthread.h @@ -1,1300 +1,1300 @@ -/* This is an implementation of the threads API of POSIX 1003.1-2001. - * - * -------------------------------------------------------------------------- - * - * Pthreads-win32 - POSIX Threads Library for Win32 - * Copyright(C) 1998 John E. Bossom - * Copyright(C) 1999,2003 Pthreads-win32 contributors - * - * Contact Email: rpj@callisto.canberra.edu.au - * - * The current list of contributors is contained - * in the file CONTRIBUTORS included with the source - * code distribution. The list can also be seen at the - * following World Wide Web location: - * http://sources.redhat.com/pthreads-win32/contributors.html - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library in the file COPYING.LIB; - * if not, write to the Free Software Foundation, Inc., - * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - */ - -#if !defined( PTHREAD_H ) -#define PTHREAD_H - -#undef PTW32_LEVEL - -#if defined(_POSIX_SOURCE) -#define PTW32_LEVEL 0 -/* Early POSIX */ -#endif - -#if defined(_POSIX_C_SOURCE) && _POSIX_C_SOURCE >= 199309 -#undef PTW32_LEVEL -#define PTW32_LEVEL 1 -/* Include 1b, 1c and 1d */ -#endif - -#if defined(INCLUDE_NP) -#undef PTW32_LEVEL -#define PTW32_LEVEL 2 -/* Include Non-Portable extensions */ -#endif - -#define PTW32_LEVEL_MAX 3 - -#if !defined(PTW32_LEVEL) -#define PTW32_LEVEL PTW32_LEVEL_MAX -/* Include everything */ -#endif - -#ifdef _UWIN -# define HAVE_STRUCT_TIMESPEC 1 -# define HAVE_SIGNAL_H 1 -# undef HAVE_CONFIG_H -# pragma comment(lib, "pthread") -#endif - -/* - * ------------------------------------------------------------- - * - * - * Module: pthread.h - * - * Purpose: - * Provides an implementation of PThreads based upon the - * standard: - * - * POSIX 1003.1-2001 - * and - * The Single Unix Specification version 3 - * - * (these two are equivalent) - * - * in order to enhance code portability between Windows, - * various commercial Unix implementations, and Linux. - * - * See the ANNOUNCE file for a full list of conforming - * routines and defined constants, and a list of missing - * routines and constants not defined in this implementation. - * - * Authors: - * There have been many contributors to this library. - * The initial implementation was contributed by - * John Bossom, and several others have provided major - * sections or revisions of parts of the implementation. - * Often significant effort has been contributed to - * find and fix important bugs and other problems to - * improve the reliability of the library, which sometimes - * is not reflected in the amount of code which changed as - * result. - * As much as possible, the contributors are acknowledged - * in the ChangeLog file in the source code distribution - * where their changes are noted in detail. - * - * Contributors are listed in the CONTRIBUTORS file. - * - * As usual, all bouquets go to the contributors, and all - * brickbats go to the project maintainer. - * - * Maintainer: - * The code base for this project is coordinated and - * eventually pre-tested, packaged, and made available by - * - * Ross Johnson - * - * QA Testers: - * Ultimately, the library is tested in the real world by - * a host of competent and demanding scientists and - * engineers who report bugs and/or provide solutions - * which are then fixed or incorporated into subsequent - * versions of the library. Each time a bug is fixed, a - * test case is written to prove the fix and ensure - * that later changes to the code don't reintroduce the - * same error. The number of test cases is slowly growing - * and therefore so is the code reliability. - * - * Compliance: - * See the file ANNOUNCE for the list of implemented - * and not-implemented routines and defined options. - * Of course, these are all defined is this file as well. - * - * Web site: - * The source code and other information about this library - * are available from - * - * http://sources.redhat.com/pthreads-win32/ - * - * ------------------------------------------------------------- - */ - -/* Try to avoid including windows.h */ -#if defined(__MINGW32__) && defined(__cplusplus) -/* - * FIXME: The pthreadGCE.dll build gets linker unresolved errors - * on pthread_key_create() unless windows.h is included here. - * It appears to have something to do with an argument type mismatch. - * Looking at tsd.o with 'nm' shows this line: - * 00000000 T _pthread_key_create__FPP14pthread_key_t_PFPv_v - * instead of - * 00000000 T _pthread_key_create - */ -#define PTW32_INCLUDE_WINDOWS_H -#endif - -#ifdef PTW32_INCLUDE_WINDOWS_H -#include -#endif - -/* - * ----------------- - * autoconf switches - * ----------------- - */ - -#if HAVE_CONFIG_H -#include "config.h" -#endif /* HAVE_CONFIG_H */ - -#if PTW32_LEVEL >= PTW32_LEVEL_MAX - -/* Try to avoid including windows.h */ -#if defined(__MINGW32__) && defined(__cplusplus) -/* - * FIXME: The pthreadGCE.dll build gets linker unresolved errors - * on pthread_key_create() unless windows.h is included here. - * It appears to have something to do with an argument type mismatch. - * Looking at tsd.o with 'nm' shows this line: - * 00000000 T _pthread_key_create__FPP14pthread_key_t_PFPv_v - * instead of - * 00000000 T _pthread_key_create - */ -#define PTW32_INCLUDE_WINDOWS_H -#endif - -#ifdef PTW32_INCLUDE_WINDOWS_H -#include -#endif - -#ifndef NEED_FTIME -#include -#else /* NEED_FTIME */ -/* use native WIN32 time API */ -#endif /* NEED_FTIME */ - -#if HAVE_SIGNAL_H -#include -#endif /* HAVE_SIGNAL_H */ - -#include -#include - -/* - * Boolean values to make us independent of system includes. - */ -enum { - PTW32_FALSE = 0, - PTW32_TRUE = (! PTW32_FALSE) -}; - -/* - * This is a duplicate of what is in the autoconf config.h, - * which is only used when building the pthread-win32 libraries. - */ - -#ifndef PTW32_CONFIG_H -# if defined(WINCE) -# define NEED_ERRNO -# define NEED_SEM -# endif -# if defined(_UWIN) || defined(__MINGW32__) -# define HAVE_MODE_T -# endif -#endif - -/* - * - */ - -#if PTW32_LEVEL >= PTW32_LEVEL_MAX -#ifdef NEED_ERRNO -#include "need_errno.h" -#else -#include -#endif -#endif /* PTW32_LEVEL >= PTW32_LEVEL_MAX */ - -/* - * Several systems don't define ENOTSUP. If not, we use - * the same value as Solaris. - */ -#ifndef ENOTSUP -# define ENOTSUP 48 -#endif - -#ifndef ETIMEDOUT -# define ETIMEDOUT 10060 /* This is the value in winsock.h. */ -#endif - -#include - -/* - * To avoid including windows.h we define only those things that we - * actually need from it. I don't like the potential incompatibility that - * this creates with future versions of windows. - */ -#ifndef PTW32_INCLUDE_WINDOWS_H -#ifndef HANDLE -# define PTW32__HANDLE_DEF -# define HANDLE void * -#endif -#ifndef DWORD -# define PTW32__DWORD_DEF -# define DWORD unsigned long -#endif -#endif - -#endif /* PTW32_LEVEL >= PTW32_LEVEL_MAX */ - -#ifndef HAVE_STRUCT_TIMESPEC -struct timespec { - long tv_sec; - long tv_nsec; -}; -#endif /* HAVE_STRUCT_TIMESPEC */ - -#ifndef SIG_BLOCK -#define SIG_BLOCK 0 -#endif /* SIG_BLOCK */ - -#ifndef SIG_UNBLOCK -#define SIG_UNBLOCK 1 -#endif /* SIG_UNBLOCK */ - -#ifndef SIG_SETMASK -#define SIG_SETMASK 2 -#endif /* SIG_SETMASK */ - -#ifdef __cplusplus -extern "C" -{ -#endif /* __cplusplus */ - -/* - * ------------------------------------------------------------- - * - * POSIX 1003.1-2001 Options - * ========================= - * - * _POSIX_THREADS (set) - * If set, you can use threads - * - * _POSIX_THREAD_ATTR_STACKSIZE (set) - * If set, you can control the size of a thread's - * stack - * pthread_attr_getstacksize - * pthread_attr_setstacksize - * - * _POSIX_THREAD_ATTR_STACKADDR (not set) - * If set, you can allocate and control a thread's - * stack. If not supported, the following functions - * will return ENOSYS, indicating they are not - * supported: - * pthread_attr_getstackaddr - * pthread_attr_setstackaddr - * - * _POSIX_THREAD_PRIORITY_SCHEDULING (set) - * If set, you can use realtime scheduling. - * Indicates the availability of: - * pthread_attr_getinheritsched - * pthread_attr_getschedparam - * pthread_attr_getschedpolicy - * pthread_attr_getscope - * pthread_attr_setinheritsched - * pthread_attr_setschedparam - * pthread_attr_setschedpolicy - * pthread_attr_setscope - * pthread_getschedparam - * pthread_setschedparam - * sched_get_priority_max - * sched_get_priority_min - * sched_rr_set_interval - * - * _POSIX_THREAD_PRIO_INHERIT (not set) - * If set, you can create priority inheritance - * mutexes. - * pthread_mutexattr_getprotocol + - * pthread_mutexattr_setprotocol + - * - * _POSIX_THREAD_PRIO_PROTECT (not set) - * If set, you can create priority ceiling mutexes - * Indicates the availability of: - * pthread_mutex_getprioceiling - * pthread_mutex_setprioceiling - * pthread_mutexattr_getprioceiling - * pthread_mutexattr_getprotocol + - * pthread_mutexattr_setprioceiling - * pthread_mutexattr_setprotocol + - * - * _POSIX_THREAD_PROCESS_SHARED (not set) - * If set, you can create mutexes and condition - * variables that can be shared with another - * process.If set, indicates the availability - * of: - * pthread_mutexattr_getpshared - * pthread_mutexattr_setpshared - * pthread_condattr_getpshared - * pthread_condattr_setpshared - * - * _POSIX_THREAD_SAFE_FUNCTIONS (set) - * If set you can use the special *_r library - * functions that provide thread-safe behaviour - * - * _POSIX_READER_WRITER_LOCKS (set) - * If set, you can use read/write locks - * - * _POSIX_SPIN_LOCKS (set) - * If set, you can use spin locks - * - * _POSIX_BARRIERS (set) - * If set, you can use barriers - * - * + These functions provide both 'inherit' and/or - * 'protect' protocol, based upon these macro - * settings. - * - * POSIX 1003.1-2001 Limits - * =========================== - * - * PTHREAD_DESTRUCTOR_ITERATIONS - * Maximum number of attempts to destroy - * a thread's thread-specific data on - * termination (must be at least 4) - * - * PTHREAD_KEYS_MAX - * Maximum number of thread-specific data keys - * available per process (must be at least 128) - * - * PTHREAD_STACK_MIN - * Minimum supported stack size for a thread - * - * PTHREAD_THREADS_MAX - * Maximum number of threads supported per - * process (must be at least 64). - * - * _POSIX_SEM_NSEMS_MAX - * The maximum number of semaphores a process can have. - * (only defined if not already defined) - * - * _POSIX_SEM_VALUE_MAX - * The maximum value a semaphore can have. - * (only defined if not already defined) - * - * ------------------------------------------------------------- - */ - -/* - * POSIX Options - */ -#ifndef _POSIX_THREADS -#define _POSIX_THREADS -#endif - -#ifndef _POSIX_READER_WRITER_LOCKS -#define _POSIX_READER_WRITER_LOCKS -#endif - -#ifndef _POSIX_SPIN_LOCKS -#define _POSIX_SPIN_LOCKS -#endif - -#ifndef _POSIX_BARRIERS -#define _POSIX_BARRIERS -#endif - -#define _POSIX_THREAD_SAFE_FUNCTIONS -#define _POSIX_THREAD_ATTR_STACKSIZE -#define _POSIX_THREAD_PRIORITY_SCHEDULING - -#if defined( KLUDGE ) -/* - * The following are not supported - */ -#define _POSIX_THREAD_ATTR_STACKADDR -#define _POSIX_THREAD_PRIO_INHERIT -#define _POSIX_THREAD_PRIO_PROTECT -#define _POSIX_THREAD_PROCESS_SHARED - -#endif /* KLUDGE */ - -/* - * POSIX Limits - * - * PTHREAD_DESTRUCTOR_ITERATIONS - * Standard states this must be at least - * 4. - * - * PTHREAD_KEYS_MAX - * WIN32 permits only 64 TLS keys per process. - * This limitation could be worked around by - * simply simulating keys. - * - * PTHREADS_STACK_MIN - * POSIX specifies 0 which is also the value WIN32 - * interprets as allowing the system to - * set the size to that of the main thread. The - * maximum stack size in Win32 is 1Meg. WIN32 - * allocates more stack as required up to the 1Meg - * limit. - * - * PTHREAD_THREADS_MAX - * Not documented by WIN32. Wrote a test program - * that kept creating threads until it failed - * revealed this approximate number (Windows NT). - * This number is somewhat less for Windows 9x - * and is effectively less than 64. Perhaps this - * constant should be set at DLL load time. - * - */ -#define PTHREAD_DESTRUCTOR_ITERATIONS 4 -#define PTHREAD_KEYS_MAX 64 -#define PTHREAD_STACK_MIN 0 -#define PTHREAD_THREADS_MAX 2019 -#ifndef _POSIX_SEM_NSEMS_MAX -/* Not used and only an arbitrary value. */ -# define _POSIX_SEM_NSEMS_MAX 1024 -#endif -#ifndef _POSIX_SEM_VALUE_MAX -# define _POSIX_SEM_VALUE_MAX (INT_MAX/2) -#endif - -#if __GNUC__ && ! defined (__declspec) -# error Please upgrade your GNU compiler to one that supports __declspec. -#endif - -/* - * When building the DLL code, you should define PTW32_BUILD so that - * the variables/functions are exported correctly. When using the DLL, - * do NOT define PTW32_BUILD, and then the variables/functions will - * be imported correctly. - */ -#ifdef _DLL -# ifdef PTW32_BUILD -# define PTW32_DLLPORT __declspec (dllexport) -# else -# define PTW32_DLLPORT __declspec (dllimport) -# endif -#endif - -#if defined(_UWIN) && PTW32_LEVEL >= PTW32_LEVEL_MAX -# include -#else -typedef struct pthread_t_ *pthread_t; -typedef struct pthread_attr_t_ *pthread_attr_t; -typedef struct pthread_once_t_ pthread_once_t; -typedef struct pthread_key_t_ *pthread_key_t; -typedef struct pthread_mutex_t_ *pthread_mutex_t; -typedef struct pthread_mutexattr_t_ *pthread_mutexattr_t; -typedef struct pthread_cond_t_ *pthread_cond_t; -typedef struct pthread_condattr_t_ *pthread_condattr_t; -#endif -typedef struct pthread_rwlock_t_ *pthread_rwlock_t; -typedef struct pthread_rwlockattr_t_ *pthread_rwlockattr_t; -typedef struct pthread_spinlock_t_ *pthread_spinlock_t; -typedef struct pthread_barrier_t_ *pthread_barrier_t; -typedef struct pthread_barrierattr_t_ *pthread_barrierattr_t; - -/* - * ==================== - * ==================== - * POSIX Threads - * ==================== - * ==================== - */ - -enum { -/* - * pthread_attr_{get,set}detachstate - */ - PTHREAD_CREATE_JOINABLE = 0, /* Default */ - PTHREAD_CREATE_DETACHED = 1, - -/* - * pthread_attr_{get,set}inheritsched - */ - PTHREAD_INHERIT_SCHED = 0, - PTHREAD_EXPLICIT_SCHED = 1, /* Default */ - -/* - * pthread_{get,set}scope - */ - PTHREAD_SCOPE_PROCESS = 0, - PTHREAD_SCOPE_SYSTEM = 1, /* Default */ - -/* - * pthread_setcancelstate parameters - */ - PTHREAD_CANCEL_ENABLE = 0, /* Default */ - PTHREAD_CANCEL_DISABLE = 1, - -/* - * pthread_setcanceltype parameters - */ - PTHREAD_CANCEL_ASYNCHRONOUS = 0, - PTHREAD_CANCEL_DEFERRED = 1, /* Default */ - -/* - * pthread_mutexattr_{get,set}pshared - * pthread_condattr_{get,set}pshared - */ - PTHREAD_PROCESS_PRIVATE = 0, - PTHREAD_PROCESS_SHARED = 1, - -/* - * pthread_barrier_wait - */ - PTHREAD_BARRIER_SERIAL_THREAD = -1 -}; - -/* - * ==================== - * ==================== - * Cancelation - * ==================== - * ==================== - */ -#define PTHREAD_CANCELED ((void *) -1) - - -/* - * ==================== - * ==================== - * Once Key - * ==================== - * ==================== - */ -#define PTHREAD_ONCE_INIT { PTW32_FALSE, -1 } - -struct pthread_once_t_ -{ - int done; /* indicates if user function executed */ - long started; /* First thread to increment this value */ - /* to zero executes the user function */ -}; - - -/* - * ==================== - * ==================== - * Object initialisers - * ==================== - * ==================== - */ -#define PTHREAD_MUTEX_INITIALIZER ((pthread_mutex_t) -1) - -#define PTHREAD_COND_INITIALIZER ((pthread_cond_t) -1) - -#define PTHREAD_RWLOCK_INITIALIZER ((pthread_rwlock_t) -1) - -#define PTHREAD_SPINLOCK_INITIALIZER ((pthread_spinlock_t) -1) - - -/* - * Mutex types. - */ -enum -{ - /* Compatibility with LinuxThreads */ - PTHREAD_MUTEX_FAST_NP, - PTHREAD_MUTEX_RECURSIVE_NP, - PTHREAD_MUTEX_ERRORCHECK_NP, - PTHREAD_MUTEX_TIMED_NP = PTHREAD_MUTEX_FAST_NP, - PTHREAD_MUTEX_ADAPTIVE_NP = PTHREAD_MUTEX_FAST_NP, - /* For compatibility with POSIX */ - PTHREAD_MUTEX_NORMAL = PTHREAD_MUTEX_FAST_NP, - PTHREAD_MUTEX_RECURSIVE = PTHREAD_MUTEX_RECURSIVE_NP, - PTHREAD_MUTEX_ERRORCHECK = PTHREAD_MUTEX_ERRORCHECK_NP, - PTHREAD_MUTEX_DEFAULT = PTHREAD_MUTEX_NORMAL -}; - - -/* There are three implementations of cancel cleanup. - * Note that pthread.h is included in both application - * compilation units and also internally for the library. - * The code here and within the library aims to work - * for all reasonable combinations of environments. - * - * The three implementations are: - * - * WIN32 SEH - * C - * C++ - * - * Please note that exiting a push/pop block via - * "return", "exit", "break", or "continue" will - * lead to different behaviour amongst applications - * depending upon whether the library was built - * using SEH, C++, or C. For example, a library built - * with SEH will call the cleanup routine, while both - * C++ and C built versions will not. - */ - -/* - * Define defaults for cleanup code. - * Note: Unless the build explicitly defines one of the following, then - * we default to standard C style cleanup. This style uses setjmp/longjmp - * in the cancelation and thread exit implementations and therefore won't - * do stack unwinding if linked to applications that have it (e.g. - * C++ apps). This is currently consistent with most/all commercial Unix - * POSIX threads implementations. - */ -#if !defined( __CLEANUP_SEH ) && !defined( __CLEANUP_CXX ) && !defined( __CLEANUP_C ) -# define __CLEANUP_C -#endif - -#if defined( __CLEANUP_SEH ) && defined(__GNUC__) -#error ERROR [__FILE__, line __LINE__]: GNUC does not support SEH. -#endif - -typedef struct ptw32_cleanup_t ptw32_cleanup_t; -typedef void (__cdecl *ptw32_cleanup_callback_t)(void *); - -struct ptw32_cleanup_t -{ - ptw32_cleanup_callback_t routine; - void *arg; - struct ptw32_cleanup_t *prev; -}; - -#ifdef __CLEANUP_SEH - /* - * WIN32 SEH version of cancel cleanup. - */ - -#define pthread_cleanup_push( _rout, _arg ) \ - { \ - ptw32_cleanup_t _cleanup; \ - \ - _cleanup.routine = (ptw32_cleanup_callback_t)(_rout); \ - _cleanup.arg = (_arg); \ - __try \ - { \ - -#define pthread_cleanup_pop( _execute ) \ - } \ - __finally \ - { \ - if( _execute || AbnormalTermination()) \ - { \ - (*(_cleanup.routine))( _cleanup.arg ); \ - } \ - } \ - } - -#else /* __CLEANUP_SEH */ - -#ifdef __CLEANUP_C - - /* - * C implementation of PThreads cancel cleanup - */ - -#define pthread_cleanup_push( _rout, _arg ) \ - { \ - ptw32_cleanup_t _cleanup; \ - \ - ptw32_push_cleanup( &_cleanup, (ptw32_cleanup_callback_t) (_rout), (_arg) ); \ - -#define pthread_cleanup_pop( _execute ) \ - (void) ptw32_pop_cleanup( _execute ); \ - } - -#else /* __CLEANUP_C */ - -#ifdef __CLEANUP_CXX - - /* - * C++ version of cancel cleanup. - * - John E. Bossom. - */ - - class PThreadCleanup { - /* - * PThreadCleanup - * - * Purpose - * This class is a C++ helper class that is - * used to implement pthread_cleanup_push/ - * pthread_cleanup_pop. - * The destructor of this class automatically - * pops the pushed cleanup routine regardless - * of how the code exits the scope - * (i.e. such as by an exception) - */ - ptw32_cleanup_callback_t cleanUpRout; - void * obj; - int executeIt; - - public: - PThreadCleanup() : - cleanUpRout( 0 ), - obj( 0 ), - executeIt( 0 ) - /* - * No cleanup performed - */ - { - } - - PThreadCleanup( - ptw32_cleanup_callback_t routine, - void * arg ) : - cleanUpRout( routine ), - obj( arg ), - executeIt( 1 ) - /* - * Registers a cleanup routine for 'arg' - */ - { - } - - ~PThreadCleanup() - { - if ( executeIt && ((void *) cleanUpRout != (void *) 0) ) - { - (void) (*cleanUpRout)( obj ); - } - } - - void execute( int exec ) - { - executeIt = exec; - } - }; - - /* - * C++ implementation of PThreads cancel cleanup; - * This implementation takes advantage of a helper - * class who's destructor automatically calls the - * cleanup routine if we exit our scope weirdly - */ -#define pthread_cleanup_push( _rout, _arg ) \ - { \ - PThreadCleanup cleanup((ptw32_cleanup_callback_t)(_rout), \ - (void *) (_arg) ); - -#define pthread_cleanup_pop( _execute ) \ - cleanup.execute( _execute ); \ - } - -#else - -#error ERROR [__FILE__, line __LINE__]: Cleanup type undefined. - -#endif /* __CLEANUP_CXX */ - -#endif /* __CLEANUP_C */ - -#endif /* __CLEANUP_SEH */ - -/* - * =============== - * =============== - * Methods - * =============== - * =============== - */ - -/* - * PThread Attribute Functions - */ -PTW32_DLLPORT int pthread_attr_init (pthread_attr_t * attr); - -PTW32_DLLPORT int pthread_attr_destroy (pthread_attr_t * attr); - -PTW32_DLLPORT int pthread_attr_getdetachstate (const pthread_attr_t * attr, - int *detachstate); - -PTW32_DLLPORT int pthread_attr_getstackaddr (const pthread_attr_t * attr, - void **stackaddr); - -PTW32_DLLPORT int pthread_attr_getstacksize (const pthread_attr_t * attr, - size_t * stacksize); - -PTW32_DLLPORT int pthread_attr_setdetachstate (pthread_attr_t * attr, - int detachstate); - -PTW32_DLLPORT int pthread_attr_setstackaddr (pthread_attr_t * attr, - void *stackaddr); - -PTW32_DLLPORT int pthread_attr_setstacksize (pthread_attr_t * attr, - size_t stacksize); - -PTW32_DLLPORT int pthread_attr_getschedparam (const pthread_attr_t *attr, - struct sched_param *param); - -PTW32_DLLPORT int pthread_attr_setschedparam (pthread_attr_t *attr, - const struct sched_param *param); - -PTW32_DLLPORT int pthread_attr_setschedpolicy (pthread_attr_t *, - int); - -PTW32_DLLPORT int pthread_attr_getschedpolicy (pthread_attr_t *, - int *); - -PTW32_DLLPORT int pthread_attr_setinheritsched(pthread_attr_t * attr, - int inheritsched); - -PTW32_DLLPORT int pthread_attr_getinheritsched(pthread_attr_t * attr, - int * inheritsched); - -PTW32_DLLPORT int pthread_attr_setscope (pthread_attr_t *, - int); - -PTW32_DLLPORT int pthread_attr_getscope (const pthread_attr_t *, - int *); - -/* - * PThread Functions - */ -PTW32_DLLPORT int pthread_create (pthread_t * tid, - const pthread_attr_t * attr, - void *(*start) (void *), - void *arg); - -PTW32_DLLPORT int pthread_detach (pthread_t tid); - -PTW32_DLLPORT int pthread_equal (pthread_t t1, - pthread_t t2); - -PTW32_DLLPORT void pthread_exit (void *value_ptr); - -PTW32_DLLPORT int pthread_join (pthread_t thread, - void **value_ptr); - -PTW32_DLLPORT pthread_t pthread_self (void); - -PTW32_DLLPORT int pthread_cancel (pthread_t thread); - -PTW32_DLLPORT int pthread_setcancelstate (int state, - int *oldstate); - -PTW32_DLLPORT int pthread_setcanceltype (int type, - int *oldtype); - -PTW32_DLLPORT void pthread_testcancel (void); - -PTW32_DLLPORT int pthread_once (pthread_once_t * once_control, - void (*init_routine) (void)); - -#if PTW32_LEVEL >= PTW32_LEVEL_MAX -PTW32_DLLPORT ptw32_cleanup_t *ptw32_pop_cleanup (int execute); - -PTW32_DLLPORT void ptw32_push_cleanup (ptw32_cleanup_t * cleanup, - void (*routine) (void *), - void *arg); -#endif /* PTW32_LEVEL >= PTW32_LEVEL_MAX */ - -/* - * Thread Specific Data Functions - */ -PTW32_DLLPORT int pthread_key_create (pthread_key_t * key, - void (*destructor) (void *)); - -PTW32_DLLPORT int pthread_key_delete (pthread_key_t key); - -PTW32_DLLPORT int pthread_setspecific (pthread_key_t key, - const void *value); - -PTW32_DLLPORT void *pthread_getspecific (pthread_key_t key); - - -/* - * Mutex Attribute Functions - */ -PTW32_DLLPORT int pthread_mutexattr_init (pthread_mutexattr_t * attr); - -PTW32_DLLPORT int pthread_mutexattr_destroy (pthread_mutexattr_t * attr); - -PTW32_DLLPORT int pthread_mutexattr_getpshared (const pthread_mutexattr_t - * attr, - int *pshared); - -PTW32_DLLPORT int pthread_mutexattr_setpshared (pthread_mutexattr_t * attr, - int pshared); - -PTW32_DLLPORT int pthread_mutexattr_settype (pthread_mutexattr_t * attr, int kind); -PTW32_DLLPORT int pthread_mutexattr_gettype (pthread_mutexattr_t * attr, int *kind); - -/* - * Barrier Attribute Functions - */ -PTW32_DLLPORT int pthread_barrierattr_init (pthread_barrierattr_t * attr); - -PTW32_DLLPORT int pthread_barrierattr_destroy (pthread_barrierattr_t * attr); - -PTW32_DLLPORT int pthread_barrierattr_getpshared (const pthread_barrierattr_t - * attr, - int *pshared); - -PTW32_DLLPORT int pthread_barrierattr_setpshared (pthread_barrierattr_t * attr, - int pshared); - -/* - * Mutex Functions - */ -PTW32_DLLPORT int pthread_mutex_init (pthread_mutex_t * mutex, - const pthread_mutexattr_t * attr); - -PTW32_DLLPORT int pthread_mutex_destroy (pthread_mutex_t * mutex); - -PTW32_DLLPORT int pthread_mutex_lock (pthread_mutex_t * mutex); - -PTW32_DLLPORT int pthread_mutex_timedlock(pthread_mutex_t *mutex, - const struct timespec *abstime); - -PTW32_DLLPORT int pthread_mutex_trylock (pthread_mutex_t * mutex); - -PTW32_DLLPORT int pthread_mutex_unlock (pthread_mutex_t * mutex); - -/* - * Spinlock Functions - */ -PTW32_DLLPORT int pthread_spin_init (pthread_spinlock_t * lock, int pshared); - -PTW32_DLLPORT int pthread_spin_destroy (pthread_spinlock_t * lock); - -PTW32_DLLPORT int pthread_spin_lock (pthread_spinlock_t * lock); - -PTW32_DLLPORT int pthread_spin_trylock (pthread_spinlock_t * lock); - -PTW32_DLLPORT int pthread_spin_unlock (pthread_spinlock_t * lock); - -/* - * Barrier Functions - */ -PTW32_DLLPORT int pthread_barrier_init (pthread_barrier_t * barrier, - const pthread_barrierattr_t * attr, - unsigned int count); - -PTW32_DLLPORT int pthread_barrier_destroy (pthread_barrier_t * barrier); - -PTW32_DLLPORT int pthread_barrier_wait (pthread_barrier_t * barrier); - -/* - * Condition Variable Attribute Functions - */ -PTW32_DLLPORT int pthread_condattr_init (pthread_condattr_t * attr); - -PTW32_DLLPORT int pthread_condattr_destroy (pthread_condattr_t * attr); - -PTW32_DLLPORT int pthread_condattr_getpshared (const pthread_condattr_t * attr, - int *pshared); - -PTW32_DLLPORT int pthread_condattr_setpshared (pthread_condattr_t * attr, - int pshared); - -/* - * Condition Variable Functions - */ -PTW32_DLLPORT int pthread_cond_init (pthread_cond_t * cond, - const pthread_condattr_t * attr); - -PTW32_DLLPORT int pthread_cond_destroy (pthread_cond_t * cond); - -PTW32_DLLPORT int pthread_cond_wait (pthread_cond_t * cond, - pthread_mutex_t * mutex); - -PTW32_DLLPORT int pthread_cond_timedwait (pthread_cond_t * cond, - pthread_mutex_t * mutex, - const struct timespec *abstime); - -PTW32_DLLPORT int pthread_cond_signal (pthread_cond_t * cond); - -PTW32_DLLPORT int pthread_cond_broadcast (pthread_cond_t * cond); - -/* - * Scheduling - */ -PTW32_DLLPORT int pthread_setschedparam (pthread_t thread, - int policy, - const struct sched_param *param); - -PTW32_DLLPORT int pthread_getschedparam (pthread_t thread, - int *policy, - struct sched_param *param); - -PTW32_DLLPORT int pthread_setconcurrency (int); - -PTW32_DLLPORT int pthread_getconcurrency (void); - -/* - * Read-Write Lock Functions - */ -PTW32_DLLPORT int pthread_rwlock_init(pthread_rwlock_t *lock, - const pthread_rwlockattr_t *attr); - -PTW32_DLLPORT int pthread_rwlock_destroy(pthread_rwlock_t *lock); - -PTW32_DLLPORT int pthread_rwlock_tryrdlock(pthread_rwlock_t *); - -PTW32_DLLPORT int pthread_rwlock_trywrlock(pthread_rwlock_t *); - -PTW32_DLLPORT int pthread_rwlock_rdlock(pthread_rwlock_t *lock); - -PTW32_DLLPORT int pthread_rwlock_timedrdlock(pthread_rwlock_t *lock, - const struct timespec *abstime); - -PTW32_DLLPORT int pthread_rwlock_wrlock(pthread_rwlock_t *lock); - -PTW32_DLLPORT int pthread_rwlock_timedwrlock(pthread_rwlock_t *lock, - const struct timespec *abstime); - -PTW32_DLLPORT int pthread_rwlock_unlock(pthread_rwlock_t *lock); - -PTW32_DLLPORT int pthread_rwlockattr_init (pthread_rwlockattr_t * attr); - -PTW32_DLLPORT int pthread_rwlockattr_destroy (pthread_rwlockattr_t * attr); - -PTW32_DLLPORT int pthread_rwlockattr_getpshared (const pthread_rwlockattr_t * attr, - int *pshared); - -PTW32_DLLPORT int pthread_rwlockattr_setpshared (pthread_rwlockattr_t * attr, - int pshared); - -#if PTW32_LEVEL >= PTW32_LEVEL_MAX - 1 - -/* - * Signal Functions. Should be defined in but MSVC and MinGW32 - * already have signal.h that don't define these. - */ -PTW32_DLLPORT int pthread_kill(pthread_t thread, int sig); - -/* - * Non-portable functions - */ - -/* - * Compatibility with Linux. - */ -PTW32_DLLPORT int pthread_mutexattr_setkind_np(pthread_mutexattr_t * attr, - int kind); -PTW32_DLLPORT int pthread_mutexattr_getkind_np(pthread_mutexattr_t * attr, - int *kind); - -/* - * Possibly supported by other POSIX threads implementations - */ -PTW32_DLLPORT int pthread_delay_np (struct timespec * interval); -PTW32_DLLPORT int pthread_num_processors_np(void); - -/* - * Useful if an application wants to statically link - * the lib rather than load the DLL at run-time. - */ -PTW32_DLLPORT int pthread_win32_process_attach_np(void); -PTW32_DLLPORT int pthread_win32_process_detach_np(void); -PTW32_DLLPORT int pthread_win32_thread_attach_np(void); -PTW32_DLLPORT int pthread_win32_thread_detach_np(void); - -/* - * Register a system time change with the library. - * Causes the library to perform various functions - * in response to the change. Should be called whenever - * the application's top level window receives a - * WM_TIMECHANGE message. It can be passed directly to - * pthread_create() as a new thread if desired. - */ -PTW32_DLLPORT void * pthread_timechange_handler_np(void *); - -#endif /*PTW32_LEVEL >= PTW32_LEVEL_MAX - 1 */ - -#if PTW32_LEVEL >= PTW32_LEVEL_MAX - -/* - * Returns the Win32 HANDLE for the POSIX thread. - */ -PTW32_DLLPORT HANDLE pthread_getw32threadhandle_np(pthread_t thread); - - -/* - * Protected Methods - * - * This function blocks until the given WIN32 handle - * is signaled or pthread_cancel had been called. - * This function allows the caller to hook into the - * PThreads cancel mechanism. It is implemented using - * - * WaitForMultipleObjects - * - * on 'waitHandle' and a manually reset WIN32 Event - * used to implement pthread_cancel. The 'timeout' - * argument to TimedWait is simply passed to - * WaitForMultipleObjects. - */ -PTW32_DLLPORT int pthreadCancelableWait (HANDLE waitHandle); -PTW32_DLLPORT int pthreadCancelableTimedWait (HANDLE waitHandle, - DWORD timeout); - -#endif /* PTW32_LEVEL >= PTW32_LEVEL_MAX */ - -/* - * Thread-Safe C Runtime Library Mappings. - */ -#ifndef _UWIN -# if defined(NEED_ERRNO) - PTW32_DLLPORT int * _errno( void ); -# else -# ifndef errno -# if (defined(_MT) || defined(_DLL)) - __declspec(dllimport) extern int * __cdecl _errno(void); -# define errno (*_errno()) -# endif -# endif -# endif -#endif - -/* - * WIN32 C runtime library had been made thread-safe - * without affecting the user interface. Provide - * mappings from the UNIX thread-safe versions to - * the standard C runtime library calls. - * Only provide function mappings for functions that - * actually exist on WIN32. - */ - -#if !defined(__MINGW32__) -#define strtok_r( _s, _sep, _lasts ) \ - ( *(_lasts) = strtok( (_s), (_sep) ) ) -#endif /* !__MINGW32__ */ - -#define asctime_r( _tm, _buf ) \ - ( strcpy( (_buf), asctime( (_tm) ) ), \ - (_buf) ) - -#define ctime_r( _clock, _buf ) \ - ( strcpy( (_buf), ctime( (_clock) ) ), \ - (_buf) ) - -#define gmtime_r( _clock, _result ) \ - ( *(_result) = *gmtime( (_clock) ), \ - (_result) ) - -#define localtime_r( _clock, _result ) \ - ( *(_result) = *localtime( (_clock) ), \ - (_result) ) - -#define rand_r( _seed ) \ - ( _seed == _seed? rand() : rand() ) - - -#ifdef __cplusplus - -/* - * Internal exceptions - */ -class ptw32_exception {}; -class ptw32_exception_cancel : public ptw32_exception {}; -class ptw32_exception_exit : public ptw32_exception {}; - -#endif - -#if PTW32_LEVEL >= PTW32_LEVEL_MAX - -/* FIXME: This is only required if the library was built using SEH */ -/* - * Get internal SEH tag - */ -PTW32_DLLPORT DWORD ptw32_get_exception_services_code(void); - -#endif /* PTW32_LEVEL >= PTW32_LEVEL_MAX */ - -#ifndef PTW32_BUILD - -#ifdef __CLEANUP_SEH - -/* - * Redefine the SEH __except keyword to ensure that applications - * propagate our internal exceptions up to the library's internal handlers. - */ -#define __except( E ) \ - __except( ( GetExceptionCode() == ptw32_get_exception_services_code() ) \ - ? EXCEPTION_CONTINUE_SEARCH : ( E ) ) - -#endif /* __CLEANUP_SEH */ - -#ifdef __CLEANUP_CXX - -/* - * Redefine the C++ catch keyword to ensure that applications - * propagate our internal exceptions up to the library's internal handlers. - */ -#ifdef _MSC_VER - /* - * WARNING: Replace any 'catch( ... )' with 'PtW32CatchAll' - * if you want Pthread-Win32 cancelation and pthread_exit to work. - */ - -#ifndef PtW32NoCatchWarn - -#pragma message("Specify \"/DPtW32NoCatchWarn\" compiler flag to skip this message.") -#pragma message("------------------------------------------------------------------") -#pragma message("When compiling applications with MSVC++ and C++ exception handling:") -#pragma message(" Replace any 'catch( ... )' in routines called from POSIX threads") -#pragma message(" with 'PtW32CatchAll' or 'CATCHALL' if you want POSIX thread") -#pragma message(" cancelation and pthread_exit to work. For example:") -#pragma message("") -#pragma message(" #ifdef PtW32CatchAll") -#pragma message(" PtW32CatchAll") -#pragma message(" #else") -#pragma message(" catch(...)") -#pragma message(" #endif") -#pragma message(" {") -#pragma message(" /* Catchall block processing */") -#pragma message(" }") -#pragma message("------------------------------------------------------------------") - -#endif - -#define PtW32CatchAll \ - catch( ptw32_exception & ) { throw; } \ - catch( ... ) - -#else /* _MSC_VER */ - -#define catch( E ) \ - catch( ptw32_exception & ) { throw; } \ - catch( E ) - -#endif /* _MSC_VER */ - -#endif /* __CLEANUP_CXX */ - -#endif /* ! PTW32_BUILD */ - -#ifdef __cplusplus -} /* End of extern "C" */ -#endif /* __cplusplus */ - -#ifdef PTW32__HANDLE_DEF -# undef HANDLE -#endif -#ifdef PTW32__DWORD_DEF -# undef DWORD -#endif - -#undef PTW32_LEVEL -#undef PTW32_LEVEL_MAX - -#endif /* PTHREAD_H */ +/* This is an implementation of the threads API of POSIX 1003.1-2001. + * + * -------------------------------------------------------------------------- + * + * Pthreads-win32 - POSIX Threads Library for Win32 + * Copyright(C) 1998 John E. Bossom + * Copyright(C) 1999,2003 Pthreads-win32 contributors + * + * Contact Email: rpj@callisto.canberra.edu.au + * + * The current list of contributors is contained + * in the file CONTRIBUTORS included with the source + * code distribution. The list can also be seen at the + * following World Wide Web location: + * http://sources.redhat.com/pthreads-win32/contributors.html + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library in the file COPYING.LIB; + * if not, write to the Free Software Foundation, Inc., + * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA + */ + +#if !defined( PTHREAD_H ) +#define PTHREAD_H + +#undef PTW32_LEVEL + +#if defined(_POSIX_SOURCE) +#define PTW32_LEVEL 0 +/* Early POSIX */ +#endif + +#if defined(_POSIX_C_SOURCE) && _POSIX_C_SOURCE >= 199309 +#undef PTW32_LEVEL +#define PTW32_LEVEL 1 +/* Include 1b, 1c and 1d */ +#endif + +#if defined(INCLUDE_NP) +#undef PTW32_LEVEL +#define PTW32_LEVEL 2 +/* Include Non-Portable extensions */ +#endif + +#define PTW32_LEVEL_MAX 3 + +#if !defined(PTW32_LEVEL) +#define PTW32_LEVEL PTW32_LEVEL_MAX +/* Include everything */ +#endif + +#ifdef _UWIN +# define HAVE_STRUCT_TIMESPEC 1 +# define HAVE_SIGNAL_H 1 +# undef HAVE_CONFIG_H +# pragma comment(lib, "pthread") +#endif + +/* + * ------------------------------------------------------------- + * + * + * Module: pthread.h + * + * Purpose: + * Provides an implementation of PThreads based upon the + * standard: + * + * POSIX 1003.1-2001 + * and + * The Single Unix Specification version 3 + * + * (these two are equivalent) + * + * in order to enhance code portability between Windows, + * various commercial Unix implementations, and Linux. + * + * See the ANNOUNCE file for a full list of conforming + * routines and defined constants, and a list of missing + * routines and constants not defined in this implementation. + * + * Authors: + * There have been many contributors to this library. + * The initial implementation was contributed by + * John Bossom, and several others have provided major + * sections or revisions of parts of the implementation. + * Often significant effort has been contributed to + * find and fix important bugs and other problems to + * improve the reliability of the library, which sometimes + * is not reflected in the amount of code which changed as + * result. + * As much as possible, the contributors are acknowledged + * in the ChangeLog file in the source code distribution + * where their changes are noted in detail. + * + * Contributors are listed in the CONTRIBUTORS file. + * + * As usual, all bouquets go to the contributors, and all + * brickbats go to the project maintainer. + * + * Maintainer: + * The code base for this project is coordinated and + * eventually pre-tested, packaged, and made available by + * + * Ross Johnson + * + * QA Testers: + * Ultimately, the library is tested in the real world by + * a host of competent and demanding scientists and + * engineers who report bugs and/or provide solutions + * which are then fixed or incorporated into subsequent + * versions of the library. Each time a bug is fixed, a + * test case is written to prove the fix and ensure + * that later changes to the code don't reintroduce the + * same error. The number of test cases is slowly growing + * and therefore so is the code reliability. + * + * Compliance: + * See the file ANNOUNCE for the list of implemented + * and not-implemented routines and defined options. + * Of course, these are all defined is this file as well. + * + * Web site: + * The source code and other information about this library + * are available from + * + * http://sources.redhat.com/pthreads-win32/ + * + * ------------------------------------------------------------- + */ + +/* Try to avoid including windows.h */ +#if defined(__MINGW32__) && defined(__cplusplus) +/* + * FIXME: The pthreadGCE.dll build gets linker unresolved errors + * on pthread_key_create() unless windows.h is included here. + * It appears to have something to do with an argument type mismatch. + * Looking at tsd.o with 'nm' shows this line: + * 00000000 T _pthread_key_create__FPP14pthread_key_t_PFPv_v + * instead of + * 00000000 T _pthread_key_create + */ +#define PTW32_INCLUDE_WINDOWS_H +#endif + +#ifdef PTW32_INCLUDE_WINDOWS_H +#include +#endif + +/* + * ----------------- + * autoconf switches + * ----------------- + */ + +#if HAVE_CONFIG_H +#include "config.h" +#endif /* HAVE_CONFIG_H */ + +#if PTW32_LEVEL >= PTW32_LEVEL_MAX + +/* Try to avoid including windows.h */ +#if defined(__MINGW32__) && defined(__cplusplus) +/* + * FIXME: The pthreadGCE.dll build gets linker unresolved errors + * on pthread_key_create() unless windows.h is included here. + * It appears to have something to do with an argument type mismatch. + * Looking at tsd.o with 'nm' shows this line: + * 00000000 T _pthread_key_create__FPP14pthread_key_t_PFPv_v + * instead of + * 00000000 T _pthread_key_create + */ +#define PTW32_INCLUDE_WINDOWS_H +#endif + +#ifdef PTW32_INCLUDE_WINDOWS_H +#include +#endif + +#ifndef NEED_FTIME +#include +#else /* NEED_FTIME */ +/* use native WIN32 time API */ +#endif /* NEED_FTIME */ + +#if HAVE_SIGNAL_H +#include +#endif /* HAVE_SIGNAL_H */ + +#include +#include + +/* + * Boolean values to make us independent of system includes. + */ +enum { + PTW32_FALSE = 0, + PTW32_TRUE = (! PTW32_FALSE) +}; + +/* + * This is a duplicate of what is in the autoconf config.h, + * which is only used when building the pthread-win32 libraries. + */ + +#ifndef PTW32_CONFIG_H +# if defined(WINCE) +# define NEED_ERRNO +# define NEED_SEM +# endif +# if defined(_UWIN) || defined(__MINGW32__) +# define HAVE_MODE_T +# endif +#endif + +/* + * + */ + +#if PTW32_LEVEL >= PTW32_LEVEL_MAX +#ifdef NEED_ERRNO +#include "need_errno.h" +#else +#include +#endif +#endif /* PTW32_LEVEL >= PTW32_LEVEL_MAX */ + +/* + * Several systems don't define ENOTSUP. If not, we use + * the same value as Solaris. + */ +#ifndef ENOTSUP +# define ENOTSUP 48 +#endif + +#ifndef ETIMEDOUT +# define ETIMEDOUT 10060 /* This is the value in winsock.h. */ +#endif + +#include + +/* + * To avoid including windows.h we define only those things that we + * actually need from it. I don't like the potential incompatibility that + * this creates with future versions of windows. + */ +#ifndef PTW32_INCLUDE_WINDOWS_H +#ifndef HANDLE +# define PTW32__HANDLE_DEF +# define HANDLE void * +#endif +#ifndef DWORD +# define PTW32__DWORD_DEF +# define DWORD unsigned long +#endif +#endif + +#endif /* PTW32_LEVEL >= PTW32_LEVEL_MAX */ + +#ifndef HAVE_STRUCT_TIMESPEC +struct timespec { + long tv_sec; + long tv_nsec; +}; +#endif /* HAVE_STRUCT_TIMESPEC */ + +#ifndef SIG_BLOCK +#define SIG_BLOCK 0 +#endif /* SIG_BLOCK */ + +#ifndef SIG_UNBLOCK +#define SIG_UNBLOCK 1 +#endif /* SIG_UNBLOCK */ + +#ifndef SIG_SETMASK +#define SIG_SETMASK 2 +#endif /* SIG_SETMASK */ + +#ifdef __cplusplus +extern "C" +{ +#endif /* __cplusplus */ + +/* + * ------------------------------------------------------------- + * + * POSIX 1003.1-2001 Options + * ========================= + * + * _POSIX_THREADS (set) + * If set, you can use threads + * + * _POSIX_THREAD_ATTR_STACKSIZE (set) + * If set, you can control the size of a thread's + * stack + * pthread_attr_getstacksize + * pthread_attr_setstacksize + * + * _POSIX_THREAD_ATTR_STACKADDR (not set) + * If set, you can allocate and control a thread's + * stack. If not supported, the following functions + * will return ENOSYS, indicating they are not + * supported: + * pthread_attr_getstackaddr + * pthread_attr_setstackaddr + * + * _POSIX_THREAD_PRIORITY_SCHEDULING (set) + * If set, you can use realtime scheduling. + * Indicates the availability of: + * pthread_attr_getinheritsched + * pthread_attr_getschedparam + * pthread_attr_getschedpolicy + * pthread_attr_getscope + * pthread_attr_setinheritsched + * pthread_attr_setschedparam + * pthread_attr_setschedpolicy + * pthread_attr_setscope + * pthread_getschedparam + * pthread_setschedparam + * sched_get_priority_max + * sched_get_priority_min + * sched_rr_set_interval + * + * _POSIX_THREAD_PRIO_INHERIT (not set) + * If set, you can create priority inheritance + * mutexes. + * pthread_mutexattr_getprotocol + + * pthread_mutexattr_setprotocol + + * + * _POSIX_THREAD_PRIO_PROTECT (not set) + * If set, you can create priority ceiling mutexes + * Indicates the availability of: + * pthread_mutex_getprioceiling + * pthread_mutex_setprioceiling + * pthread_mutexattr_getprioceiling + * pthread_mutexattr_getprotocol + + * pthread_mutexattr_setprioceiling + * pthread_mutexattr_setprotocol + + * + * _POSIX_THREAD_PROCESS_SHARED (not set) + * If set, you can create mutexes and condition + * variables that can be shared with another + * process.If set, indicates the availability + * of: + * pthread_mutexattr_getpshared + * pthread_mutexattr_setpshared + * pthread_condattr_getpshared + * pthread_condattr_setpshared + * + * _POSIX_THREAD_SAFE_FUNCTIONS (set) + * If set you can use the special *_r library + * functions that provide thread-safe behaviour + * + * _POSIX_READER_WRITER_LOCKS (set) + * If set, you can use read/write locks + * + * _POSIX_SPIN_LOCKS (set) + * If set, you can use spin locks + * + * _POSIX_BARRIERS (set) + * If set, you can use barriers + * + * + These functions provide both 'inherit' and/or + * 'protect' protocol, based upon these macro + * settings. + * + * POSIX 1003.1-2001 Limits + * =========================== + * + * PTHREAD_DESTRUCTOR_ITERATIONS + * Maximum number of attempts to destroy + * a thread's thread-specific data on + * termination (must be at least 4) + * + * PTHREAD_KEYS_MAX + * Maximum number of thread-specific data keys + * available per process (must be at least 128) + * + * PTHREAD_STACK_MIN + * Minimum supported stack size for a thread + * + * PTHREAD_THREADS_MAX + * Maximum number of threads supported per + * process (must be at least 64). + * + * _POSIX_SEM_NSEMS_MAX + * The maximum number of semaphores a process can have. + * (only defined if not already defined) + * + * _POSIX_SEM_VALUE_MAX + * The maximum value a semaphore can have. + * (only defined if not already defined) + * + * ------------------------------------------------------------- + */ + +/* + * POSIX Options + */ +#ifndef _POSIX_THREADS +#define _POSIX_THREADS +#endif + +#ifndef _POSIX_READER_WRITER_LOCKS +#define _POSIX_READER_WRITER_LOCKS +#endif + +#ifndef _POSIX_SPIN_LOCKS +#define _POSIX_SPIN_LOCKS +#endif + +#ifndef _POSIX_BARRIERS +#define _POSIX_BARRIERS +#endif + +#define _POSIX_THREAD_SAFE_FUNCTIONS +#define _POSIX_THREAD_ATTR_STACKSIZE +#define _POSIX_THREAD_PRIORITY_SCHEDULING + +#if defined( KLUDGE ) +/* + * The following are not supported + */ +#define _POSIX_THREAD_ATTR_STACKADDR +#define _POSIX_THREAD_PRIO_INHERIT +#define _POSIX_THREAD_PRIO_PROTECT +#define _POSIX_THREAD_PROCESS_SHARED + +#endif /* KLUDGE */ + +/* + * POSIX Limits + * + * PTHREAD_DESTRUCTOR_ITERATIONS + * Standard states this must be at least + * 4. + * + * PTHREAD_KEYS_MAX + * WIN32 permits only 64 TLS keys per process. + * This limitation could be worked around by + * simply simulating keys. + * + * PTHREADS_STACK_MIN + * POSIX specifies 0 which is also the value WIN32 + * interprets as allowing the system to + * set the size to that of the main thread. The + * maximum stack size in Win32 is 1Meg. WIN32 + * allocates more stack as required up to the 1Meg + * limit. + * + * PTHREAD_THREADS_MAX + * Not documented by WIN32. Wrote a test program + * that kept creating threads until it failed + * revealed this approximate number (Windows NT). + * This number is somewhat less for Windows 9x + * and is effectively less than 64. Perhaps this + * constant should be set at DLL load time. + * + */ +#define PTHREAD_DESTRUCTOR_ITERATIONS 4 +#define PTHREAD_KEYS_MAX 64 +#define PTHREAD_STACK_MIN 0 +#define PTHREAD_THREADS_MAX 2019 +#ifndef _POSIX_SEM_NSEMS_MAX +/* Not used and only an arbitrary value. */ +# define _POSIX_SEM_NSEMS_MAX 1024 +#endif +#ifndef _POSIX_SEM_VALUE_MAX +# define _POSIX_SEM_VALUE_MAX (INT_MAX/2) +#endif + +#if __GNUC__ && ! defined (__declspec) +# error Please upgrade your GNU compiler to one that supports __declspec. +#endif + +/* + * When building the DLL code, you should define PTW32_BUILD so that + * the variables/functions are exported correctly. When using the DLL, + * do NOT define PTW32_BUILD, and then the variables/functions will + * be imported correctly. + */ +#ifdef _DLL +# ifdef PTW32_BUILD +# define PTW32_DLLPORT __declspec (dllexport) +# else +# define PTW32_DLLPORT __declspec (dllimport) +# endif +#endif + +#if defined(_UWIN) && PTW32_LEVEL >= PTW32_LEVEL_MAX +# include +#else +typedef struct pthread_t_ *pthread_t; +typedef struct pthread_attr_t_ *pthread_attr_t; +typedef struct pthread_once_t_ pthread_once_t; +typedef struct pthread_key_t_ *pthread_key_t; +typedef struct pthread_mutex_t_ *pthread_mutex_t; +typedef struct pthread_mutexattr_t_ *pthread_mutexattr_t; +typedef struct pthread_cond_t_ *pthread_cond_t; +typedef struct pthread_condattr_t_ *pthread_condattr_t; +#endif +typedef struct pthread_rwlock_t_ *pthread_rwlock_t; +typedef struct pthread_rwlockattr_t_ *pthread_rwlockattr_t; +typedef struct pthread_spinlock_t_ *pthread_spinlock_t; +typedef struct pthread_barrier_t_ *pthread_barrier_t; +typedef struct pthread_barrierattr_t_ *pthread_barrierattr_t; + +/* + * ==================== + * ==================== + * POSIX Threads + * ==================== + * ==================== + */ + +enum { +/* + * pthread_attr_{get,set}detachstate + */ + PTHREAD_CREATE_JOINABLE = 0, /* Default */ + PTHREAD_CREATE_DETACHED = 1, + +/* + * pthread_attr_{get,set}inheritsched + */ + PTHREAD_INHERIT_SCHED = 0, + PTHREAD_EXPLICIT_SCHED = 1, /* Default */ + +/* + * pthread_{get,set}scope + */ + PTHREAD_SCOPE_PROCESS = 0, + PTHREAD_SCOPE_SYSTEM = 1, /* Default */ + +/* + * pthread_setcancelstate parameters + */ + PTHREAD_CANCEL_ENABLE = 0, /* Default */ + PTHREAD_CANCEL_DISABLE = 1, + +/* + * pthread_setcanceltype parameters + */ + PTHREAD_CANCEL_ASYNCHRONOUS = 0, + PTHREAD_CANCEL_DEFERRED = 1, /* Default */ + +/* + * pthread_mutexattr_{get,set}pshared + * pthread_condattr_{get,set}pshared + */ + PTHREAD_PROCESS_PRIVATE = 0, + PTHREAD_PROCESS_SHARED = 1, + +/* + * pthread_barrier_wait + */ + PTHREAD_BARRIER_SERIAL_THREAD = -1 +}; + +/* + * ==================== + * ==================== + * Cancelation + * ==================== + * ==================== + */ +#define PTHREAD_CANCELED ((void *) -1) + + +/* + * ==================== + * ==================== + * Once Key + * ==================== + * ==================== + */ +#define PTHREAD_ONCE_INIT { PTW32_FALSE, -1 } + +struct pthread_once_t_ +{ + int done; /* indicates if user function executed */ + long started; /* First thread to increment this value */ + /* to zero executes the user function */ +}; + + +/* + * ==================== + * ==================== + * Object initialisers + * ==================== + * ==================== + */ +#define PTHREAD_MUTEX_INITIALIZER ((pthread_mutex_t) -1) + +#define PTHREAD_COND_INITIALIZER ((pthread_cond_t) -1) + +#define PTHREAD_RWLOCK_INITIALIZER ((pthread_rwlock_t) -1) + +#define PTHREAD_SPINLOCK_INITIALIZER ((pthread_spinlock_t) -1) + + +/* + * Mutex types. + */ +enum +{ + /* Compatibility with LinuxThreads */ + PTHREAD_MUTEX_FAST_NP, + PTHREAD_MUTEX_RECURSIVE_NP, + PTHREAD_MUTEX_ERRORCHECK_NP, + PTHREAD_MUTEX_TIMED_NP = PTHREAD_MUTEX_FAST_NP, + PTHREAD_MUTEX_ADAPTIVE_NP = PTHREAD_MUTEX_FAST_NP, + /* For compatibility with POSIX */ + PTHREAD_MUTEX_NORMAL = PTHREAD_MUTEX_FAST_NP, + PTHREAD_MUTEX_RECURSIVE = PTHREAD_MUTEX_RECURSIVE_NP, + PTHREAD_MUTEX_ERRORCHECK = PTHREAD_MUTEX_ERRORCHECK_NP, + PTHREAD_MUTEX_DEFAULT = PTHREAD_MUTEX_NORMAL +}; + + +/* There are three implementations of cancel cleanup. + * Note that pthread.h is included in both application + * compilation units and also internally for the library. + * The code here and within the library aims to work + * for all reasonable combinations of environments. + * + * The three implementations are: + * + * WIN32 SEH + * C + * C++ + * + * Please note that exiting a push/pop block via + * "return", "exit", "break", or "continue" will + * lead to different behaviour amongst applications + * depending upon whether the library was built + * using SEH, C++, or C. For example, a library built + * with SEH will call the cleanup routine, while both + * C++ and C built versions will not. + */ + +/* + * Define defaults for cleanup code. + * Note: Unless the build explicitly defines one of the following, then + * we default to standard C style cleanup. This style uses setjmp/longjmp + * in the cancelation and thread exit implementations and therefore won't + * do stack unwinding if linked to applications that have it (e.g. + * C++ apps). This is currently consistent with most/all commercial Unix + * POSIX threads implementations. + */ +#if !defined( __CLEANUP_SEH ) && !defined( __CLEANUP_CXX ) && !defined( __CLEANUP_C ) +# define __CLEANUP_C +#endif + +#if defined( __CLEANUP_SEH ) && defined(__GNUC__) +#error ERROR [__FILE__, line __LINE__]: GNUC does not support SEH. +#endif + +typedef struct ptw32_cleanup_t ptw32_cleanup_t; +typedef void (__cdecl *ptw32_cleanup_callback_t)(void *); + +struct ptw32_cleanup_t +{ + ptw32_cleanup_callback_t routine; + void *arg; + struct ptw32_cleanup_t *prev; +}; + +#ifdef __CLEANUP_SEH + /* + * WIN32 SEH version of cancel cleanup. + */ + +#define pthread_cleanup_push( _rout, _arg ) \ + { \ + ptw32_cleanup_t _cleanup; \ + \ + _cleanup.routine = (ptw32_cleanup_callback_t)(_rout); \ + _cleanup.arg = (_arg); \ + __try \ + { \ + +#define pthread_cleanup_pop( _execute ) \ + } \ + __finally \ + { \ + if( _execute || AbnormalTermination()) \ + { \ + (*(_cleanup.routine))( _cleanup.arg ); \ + } \ + } \ + } + +#else /* __CLEANUP_SEH */ + +#ifdef __CLEANUP_C + + /* + * C implementation of PThreads cancel cleanup + */ + +#define pthread_cleanup_push( _rout, _arg ) \ + { \ + ptw32_cleanup_t _cleanup; \ + \ + ptw32_push_cleanup( &_cleanup, (ptw32_cleanup_callback_t) (_rout), (_arg) ); \ + +#define pthread_cleanup_pop( _execute ) \ + (void) ptw32_pop_cleanup( _execute ); \ + } + +#else /* __CLEANUP_C */ + +#ifdef __CLEANUP_CXX + + /* + * C++ version of cancel cleanup. + * - John E. Bossom. + */ + + class PThreadCleanup { + /* + * PThreadCleanup + * + * Purpose + * This class is a C++ helper class that is + * used to implement pthread_cleanup_push/ + * pthread_cleanup_pop. + * The destructor of this class automatically + * pops the pushed cleanup routine regardless + * of how the code exits the scope + * (i.e. such as by an exception) + */ + ptw32_cleanup_callback_t cleanUpRout; + void * obj; + int executeIt; + + public: + PThreadCleanup() : + cleanUpRout( 0 ), + obj( 0 ), + executeIt( 0 ) + /* + * No cleanup performed + */ + { + } + + PThreadCleanup( + ptw32_cleanup_callback_t routine, + void * arg ) : + cleanUpRout( routine ), + obj( arg ), + executeIt( 1 ) + /* + * Registers a cleanup routine for 'arg' + */ + { + } + + ~PThreadCleanup() + { + if ( executeIt && ((void *) cleanUpRout != (void *) 0) ) + { + (void) (*cleanUpRout)( obj ); + } + } + + void execute( int exec ) + { + executeIt = exec; + } + }; + + /* + * C++ implementation of PThreads cancel cleanup; + * This implementation takes advantage of a helper + * class who's destructor automatically calls the + * cleanup routine if we exit our scope weirdly + */ +#define pthread_cleanup_push( _rout, _arg ) \ + { \ + PThreadCleanup cleanup((ptw32_cleanup_callback_t)(_rout), \ + (void *) (_arg) ); + +#define pthread_cleanup_pop( _execute ) \ + cleanup.execute( _execute ); \ + } + +#else + +#error ERROR [__FILE__, line __LINE__]: Cleanup type undefined. + +#endif /* __CLEANUP_CXX */ + +#endif /* __CLEANUP_C */ + +#endif /* __CLEANUP_SEH */ + +/* + * =============== + * =============== + * Methods + * =============== + * =============== + */ + +/* + * PThread Attribute Functions + */ +PTW32_DLLPORT int pthread_attr_init (pthread_attr_t * attr); + +PTW32_DLLPORT int pthread_attr_destroy (pthread_attr_t * attr); + +PTW32_DLLPORT int pthread_attr_getdetachstate (const pthread_attr_t * attr, + int *detachstate); + +PTW32_DLLPORT int pthread_attr_getstackaddr (const pthread_attr_t * attr, + void **stackaddr); + +PTW32_DLLPORT int pthread_attr_getstacksize (const pthread_attr_t * attr, + size_t * stacksize); + +PTW32_DLLPORT int pthread_attr_setdetachstate (pthread_attr_t * attr, + int detachstate); + +PTW32_DLLPORT int pthread_attr_setstackaddr (pthread_attr_t * attr, + void *stackaddr); + +PTW32_DLLPORT int pthread_attr_setstacksize (pthread_attr_t * attr, + size_t stacksize); + +PTW32_DLLPORT int pthread_attr_getschedparam (const pthread_attr_t *attr, + struct sched_param *param); + +PTW32_DLLPORT int pthread_attr_setschedparam (pthread_attr_t *attr, + const struct sched_param *param); + +PTW32_DLLPORT int pthread_attr_setschedpolicy (pthread_attr_t *, + int); + +PTW32_DLLPORT int pthread_attr_getschedpolicy (pthread_attr_t *, + int *); + +PTW32_DLLPORT int pthread_attr_setinheritsched(pthread_attr_t * attr, + int inheritsched); + +PTW32_DLLPORT int pthread_attr_getinheritsched(pthread_attr_t * attr, + int * inheritsched); + +PTW32_DLLPORT int pthread_attr_setscope (pthread_attr_t *, + int); + +PTW32_DLLPORT int pthread_attr_getscope (const pthread_attr_t *, + int *); + +/* + * PThread Functions + */ +PTW32_DLLPORT int pthread_create (pthread_t * tid, + const pthread_attr_t * attr, + void *(*start) (void *), + void *arg); + +PTW32_DLLPORT int pthread_detach (pthread_t tid); + +PTW32_DLLPORT int pthread_equal (pthread_t t1, + pthread_t t2); + +PTW32_DLLPORT void pthread_exit (void *value_ptr); + +PTW32_DLLPORT int pthread_join (pthread_t thread, + void **value_ptr); + +PTW32_DLLPORT pthread_t pthread_self (void); + +PTW32_DLLPORT int pthread_cancel (pthread_t thread); + +PTW32_DLLPORT int pthread_setcancelstate (int state, + int *oldstate); + +PTW32_DLLPORT int pthread_setcanceltype (int type, + int *oldtype); + +PTW32_DLLPORT void pthread_testcancel (void); + +PTW32_DLLPORT int pthread_once (pthread_once_t * once_control, + void (*init_routine) (void)); + +#if PTW32_LEVEL >= PTW32_LEVEL_MAX +PTW32_DLLPORT ptw32_cleanup_t *ptw32_pop_cleanup (int execute); + +PTW32_DLLPORT void ptw32_push_cleanup (ptw32_cleanup_t * cleanup, + void (*routine) (void *), + void *arg); +#endif /* PTW32_LEVEL >= PTW32_LEVEL_MAX */ + +/* + * Thread Specific Data Functions + */ +PTW32_DLLPORT int pthread_key_create (pthread_key_t * key, + void (*destructor) (void *)); + +PTW32_DLLPORT int pthread_key_delete (pthread_key_t key); + +PTW32_DLLPORT int pthread_setspecific (pthread_key_t key, + const void *value); + +PTW32_DLLPORT void *pthread_getspecific (pthread_key_t key); + + +/* + * Mutex Attribute Functions + */ +PTW32_DLLPORT int pthread_mutexattr_init (pthread_mutexattr_t * attr); + +PTW32_DLLPORT int pthread_mutexattr_destroy (pthread_mutexattr_t * attr); + +PTW32_DLLPORT int pthread_mutexattr_getpshared (const pthread_mutexattr_t + * attr, + int *pshared); + +PTW32_DLLPORT int pthread_mutexattr_setpshared (pthread_mutexattr_t * attr, + int pshared); + +PTW32_DLLPORT int pthread_mutexattr_settype (pthread_mutexattr_t * attr, int kind); +PTW32_DLLPORT int pthread_mutexattr_gettype (pthread_mutexattr_t * attr, int *kind); + +/* + * Barrier Attribute Functions + */ +PTW32_DLLPORT int pthread_barrierattr_init (pthread_barrierattr_t * attr); + +PTW32_DLLPORT int pthread_barrierattr_destroy (pthread_barrierattr_t * attr); + +PTW32_DLLPORT int pthread_barrierattr_getpshared (const pthread_barrierattr_t + * attr, + int *pshared); + +PTW32_DLLPORT int pthread_barrierattr_setpshared (pthread_barrierattr_t * attr, + int pshared); + +/* + * Mutex Functions + */ +PTW32_DLLPORT int pthread_mutex_init (pthread_mutex_t * mutex, + const pthread_mutexattr_t * attr); + +PTW32_DLLPORT int pthread_mutex_destroy (pthread_mutex_t * mutex); + +PTW32_DLLPORT int pthread_mutex_lock (pthread_mutex_t * mutex); + +PTW32_DLLPORT int pthread_mutex_timedlock(pthread_mutex_t *mutex, + const struct timespec *abstime); + +PTW32_DLLPORT int pthread_mutex_trylock (pthread_mutex_t * mutex); + +PTW32_DLLPORT int pthread_mutex_unlock (pthread_mutex_t * mutex); + +/* + * Spinlock Functions + */ +PTW32_DLLPORT int pthread_spin_init (pthread_spinlock_t * lock, int pshared); + +PTW32_DLLPORT int pthread_spin_destroy (pthread_spinlock_t * lock); + +PTW32_DLLPORT int pthread_spin_lock (pthread_spinlock_t * lock); + +PTW32_DLLPORT int pthread_spin_trylock (pthread_spinlock_t * lock); + +PTW32_DLLPORT int pthread_spin_unlock (pthread_spinlock_t * lock); + +/* + * Barrier Functions + */ +PTW32_DLLPORT int pthread_barrier_init (pthread_barrier_t * barrier, + const pthread_barrierattr_t * attr, + unsigned int count); + +PTW32_DLLPORT int pthread_barrier_destroy (pthread_barrier_t * barrier); + +PTW32_DLLPORT int pthread_barrier_wait (pthread_barrier_t * barrier); + +/* + * Condition Variable Attribute Functions + */ +PTW32_DLLPORT int pthread_condattr_init (pthread_condattr_t * attr); + +PTW32_DLLPORT int pthread_condattr_destroy (pthread_condattr_t * attr); + +PTW32_DLLPORT int pthread_condattr_getpshared (const pthread_condattr_t * attr, + int *pshared); + +PTW32_DLLPORT int pthread_condattr_setpshared (pthread_condattr_t * attr, + int pshared); + +/* + * Condition Variable Functions + */ +PTW32_DLLPORT int pthread_cond_init (pthread_cond_t * cond, + const pthread_condattr_t * attr); + +PTW32_DLLPORT int pthread_cond_destroy (pthread_cond_t * cond); + +PTW32_DLLPORT int pthread_cond_wait (pthread_cond_t * cond, + pthread_mutex_t * mutex); + +PTW32_DLLPORT int pthread_cond_timedwait (pthread_cond_t * cond, + pthread_mutex_t * mutex, + const struct timespec *abstime); + +PTW32_DLLPORT int pthread_cond_signal (pthread_cond_t * cond); + +PTW32_DLLPORT int pthread_cond_broadcast (pthread_cond_t * cond); + +/* + * Scheduling + */ +PTW32_DLLPORT int pthread_setschedparam (pthread_t thread, + int policy, + const struct sched_param *param); + +PTW32_DLLPORT int pthread_getschedparam (pthread_t thread, + int *policy, + struct sched_param *param); + +PTW32_DLLPORT int pthread_setconcurrency (int); + +PTW32_DLLPORT int pthread_getconcurrency (void); + +/* + * Read-Write Lock Functions + */ +PTW32_DLLPORT int pthread_rwlock_init(pthread_rwlock_t *lock, + const pthread_rwlockattr_t *attr); + +PTW32_DLLPORT int pthread_rwlock_destroy(pthread_rwlock_t *lock); + +PTW32_DLLPORT int pthread_rwlock_tryrdlock(pthread_rwlock_t *); + +PTW32_DLLPORT int pthread_rwlock_trywrlock(pthread_rwlock_t *); + +PTW32_DLLPORT int pthread_rwlock_rdlock(pthread_rwlock_t *lock); + +PTW32_DLLPORT int pthread_rwlock_timedrdlock(pthread_rwlock_t *lock, + const struct timespec *abstime); + +PTW32_DLLPORT int pthread_rwlock_wrlock(pthread_rwlock_t *lock); + +PTW32_DLLPORT int pthread_rwlock_timedwrlock(pthread_rwlock_t *lock, + const struct timespec *abstime); + +PTW32_DLLPORT int pthread_rwlock_unlock(pthread_rwlock_t *lock); + +PTW32_DLLPORT int pthread_rwlockattr_init (pthread_rwlockattr_t * attr); + +PTW32_DLLPORT int pthread_rwlockattr_destroy (pthread_rwlockattr_t * attr); + +PTW32_DLLPORT int pthread_rwlockattr_getpshared (const pthread_rwlockattr_t * attr, + int *pshared); + +PTW32_DLLPORT int pthread_rwlockattr_setpshared (pthread_rwlockattr_t * attr, + int pshared); + +#if PTW32_LEVEL >= PTW32_LEVEL_MAX - 1 + +/* + * Signal Functions. Should be defined in but MSVC and MinGW32 + * already have signal.h that don't define these. + */ +PTW32_DLLPORT int pthread_kill(pthread_t thread, int sig); + +/* + * Non-portable functions + */ + +/* + * Compatibility with Linux. + */ +PTW32_DLLPORT int pthread_mutexattr_setkind_np(pthread_mutexattr_t * attr, + int kind); +PTW32_DLLPORT int pthread_mutexattr_getkind_np(pthread_mutexattr_t * attr, + int *kind); + +/* + * Possibly supported by other POSIX threads implementations + */ +PTW32_DLLPORT int pthread_delay_np (struct timespec * interval); +PTW32_DLLPORT int pthread_num_processors_np(void); + +/* + * Useful if an application wants to statically link + * the lib rather than load the DLL at run-time. + */ +PTW32_DLLPORT int pthread_win32_process_attach_np(void); +PTW32_DLLPORT int pthread_win32_process_detach_np(void); +PTW32_DLLPORT int pthread_win32_thread_attach_np(void); +PTW32_DLLPORT int pthread_win32_thread_detach_np(void); + +/* + * Register a system time change with the library. + * Causes the library to perform various functions + * in response to the change. Should be called whenever + * the application's top level window receives a + * WM_TIMECHANGE message. It can be passed directly to + * pthread_create() as a new thread if desired. + */ +PTW32_DLLPORT void * pthread_timechange_handler_np(void *); + +#endif /*PTW32_LEVEL >= PTW32_LEVEL_MAX - 1 */ + +#if PTW32_LEVEL >= PTW32_LEVEL_MAX + +/* + * Returns the Win32 HANDLE for the POSIX thread. + */ +PTW32_DLLPORT HANDLE pthread_getw32threadhandle_np(pthread_t thread); + + +/* + * Protected Methods + * + * This function blocks until the given WIN32 handle + * is signaled or pthread_cancel had been called. + * This function allows the caller to hook into the + * PThreads cancel mechanism. It is implemented using + * + * WaitForMultipleObjects + * + * on 'waitHandle' and a manually reset WIN32 Event + * used to implement pthread_cancel. The 'timeout' + * argument to TimedWait is simply passed to + * WaitForMultipleObjects. + */ +PTW32_DLLPORT int pthreadCancelableWait (HANDLE waitHandle); +PTW32_DLLPORT int pthreadCancelableTimedWait (HANDLE waitHandle, + DWORD timeout); + +#endif /* PTW32_LEVEL >= PTW32_LEVEL_MAX */ + +/* + * Thread-Safe C Runtime Library Mappings. + */ +#ifndef _UWIN +# if defined(NEED_ERRNO) + PTW32_DLLPORT int * _errno( void ); +# else +# ifndef errno +# if (defined(_MT) || defined(_DLL)) + __declspec(dllimport) extern int * __cdecl _errno(void); +# define errno (*_errno()) +# endif +# endif +# endif +#endif + +/* + * WIN32 C runtime library had been made thread-safe + * without affecting the user interface. Provide + * mappings from the UNIX thread-safe versions to + * the standard C runtime library calls. + * Only provide function mappings for functions that + * actually exist on WIN32. + */ + +#if !defined(__MINGW32__) +#define strtok_r( _s, _sep, _lasts ) \ + ( *(_lasts) = strtok( (_s), (_sep) ) ) +#endif /* !__MINGW32__ */ + +#define asctime_r( _tm, _buf ) \ + ( strcpy( (_buf), asctime( (_tm) ) ), \ + (_buf) ) + +#define ctime_r( _clock, _buf ) \ + ( strcpy( (_buf), ctime( (_clock) ) ), \ + (_buf) ) + +#define gmtime_r( _clock, _result ) \ + ( *(_result) = *gmtime( (_clock) ), \ + (_result) ) + +#define localtime_r( _clock, _result ) \ + ( *(_result) = *localtime( (_clock) ), \ + (_result) ) + +#define rand_r( _seed ) \ + ( _seed == _seed? rand() : rand() ) + + +#ifdef __cplusplus + +/* + * Internal exceptions + */ +class ptw32_exception {}; +class ptw32_exception_cancel : public ptw32_exception {}; +class ptw32_exception_exit : public ptw32_exception {}; + +#endif + +#if PTW32_LEVEL >= PTW32_LEVEL_MAX + +/* FIXME: This is only required if the library was built using SEH */ +/* + * Get internal SEH tag + */ +PTW32_DLLPORT DWORD ptw32_get_exception_services_code(void); + +#endif /* PTW32_LEVEL >= PTW32_LEVEL_MAX */ + +#ifndef PTW32_BUILD + +#ifdef __CLEANUP_SEH + +/* + * Redefine the SEH __except keyword to ensure that applications + * propagate our internal exceptions up to the library's internal handlers. + */ +#define __except( E ) \ + __except( ( GetExceptionCode() == ptw32_get_exception_services_code() ) \ + ? EXCEPTION_CONTINUE_SEARCH : ( E ) ) + +#endif /* __CLEANUP_SEH */ + +#ifdef __CLEANUP_CXX + +/* + * Redefine the C++ catch keyword to ensure that applications + * propagate our internal exceptions up to the library's internal handlers. + */ +#ifdef _MSC_VER + /* + * WARNING: Replace any 'catch( ... )' with 'PtW32CatchAll' + * if you want Pthread-Win32 cancelation and pthread_exit to work. + */ + +#ifndef PtW32NoCatchWarn + +#pragma message("Specify \"/DPtW32NoCatchWarn\" compiler flag to skip this message.") +#pragma message("------------------------------------------------------------------") +#pragma message("When compiling applications with MSVC++ and C++ exception handling:") +#pragma message(" Replace any 'catch( ... )' in routines called from POSIX threads") +#pragma message(" with 'PtW32CatchAll' or 'CATCHALL' if you want POSIX thread") +#pragma message(" cancelation and pthread_exit to work. For example:") +#pragma message("") +#pragma message(" #ifdef PtW32CatchAll") +#pragma message(" PtW32CatchAll") +#pragma message(" #else") +#pragma message(" catch(...)") +#pragma message(" #endif") +#pragma message(" {") +#pragma message(" /* Catchall block processing */") +#pragma message(" }") +#pragma message("------------------------------------------------------------------") + +#endif + +#define PtW32CatchAll \ + catch( ptw32_exception & ) { throw; } \ + catch( ... ) + +#else /* _MSC_VER */ + +#define catch( E ) \ + catch( ptw32_exception & ) { throw; } \ + catch( E ) + +#endif /* _MSC_VER */ + +#endif /* __CLEANUP_CXX */ + +#endif /* ! PTW32_BUILD */ + +#ifdef __cplusplus +} /* End of extern "C" */ +#endif /* __cplusplus */ + +#ifdef PTW32__HANDLE_DEF +# undef HANDLE +#endif +#ifdef PTW32__DWORD_DEF +# undef DWORD +#endif + +#undef PTW32_LEVEL +#undef PTW32_LEVEL_MAX + +#endif /* PTHREAD_H */ diff --git a/src/Cedar/winpcap/remote-ext.h b/src/Cedar/winpcap/remote-ext.h index 6693bdce..717c4a73 100644 --- a/src/Cedar/winpcap/remote-ext.h +++ b/src/Cedar/winpcap/remote-ext.h @@ -1,420 +1,420 @@ -/* - * Copyright (c) 2002 - 2003 - * NetGroup, Politecnico di Torino (Italy) - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the Politecnico di Torino nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - */ - - -#ifndef __REMOTE_EXT_H__ -#define __REMOTE_EXT_H__ - - - -// Definition for Microsoft Visual Studio -#if _MSC_VER > 1000 -#pragma once -#endif - -#ifdef __cplusplus -extern "C" { -#endif - -/*! - \file remote-ext.h - - The goal of this file it to include most of the new definitions that should be - placed into the pcap.h file. - - It includes all new definitions (structures and functions like pcap_open(). - Some of the functions are not really a remote feature, but, right now, - they are placed here. -*/ - - - -// All this stuff is public -/*! \addtogroup remote_struct - \{ -*/ - - - - -/*! - \brief Defines the maximum buffer size in which address, port, interface names are kept. - - In case the adapter name or such is larger than this value, it is truncated. - This is not used by the user; however it must be aware that an hostname / interface - name longer than this value will be truncated. -*/ -#define PCAP_BUF_SIZE 1024 - - -/*! \addtogroup remote_source_ID - \{ -*/ - - -/*! - \brief Internal representation of the type of source in use (file, - remote/local interface). - - This indicates a file, i.e. the user want to open a capture from a local file. -*/ -#define PCAP_SRC_FILE 2 -/*! - \brief Internal representation of the type of source in use (file, - remote/local interface). - - This indicates a local interface, i.e. the user want to open a capture from - a local interface. This does not involve the RPCAP protocol. -*/ -#define PCAP_SRC_IFLOCAL 3 -/*! - \brief Internal representation of the type of source in use (file, - remote/local interface). - - This indicates a remote interface, i.e. the user want to open a capture from - an interface on a remote host. This does involve the RPCAP protocol. -*/ -#define PCAP_SRC_IFREMOTE 4 - -/*! - \} -*/ - - - -/*! \addtogroup remote_source_string - - The formats allowed by the pcap_open() are the following: - - file://path_and_filename [opens a local file] - - rpcap://devicename [opens the selected device devices available on the local host, without using the RPCAP protocol] - - rpcap://host/devicename [opens the selected device available on a remote host] - - rpcap://host:port/devicename [opens the selected device available on a remote host, using a non-standard port for RPCAP] - - adaptername [to open a local adapter; kept for compatibility, but it is strongly discouraged] - - (NULL) [to open the first local adapter; kept for compatibility, but it is strongly discouraged] - - The formats allowed by the pcap_findalldevs_ex() are the following: - - file://folder/ [lists all the files in the given folder] - - rpcap:// [lists all local adapters] - - rpcap://host:port/ [lists the devices available on a remote host] - - Referring to the 'host' and 'port' parameters, they can be either numeric or literal. Since - IPv6 is fully supported, these are the allowed formats: - - - host (literal): e.g. host.foo.bar - - host (numeric IPv4): e.g. 10.11.12.13 - - host (numeric IPv4, IPv6 style): e.g. [10.11.12.13] - - host (numeric IPv6): e.g. [1:2:3::4] - - port: can be either numeric (e.g. '80') or literal (e.g. 'http') - - Here you find some allowed examples: - - rpcap://host.foo.bar/devicename [everything literal, no port number] - - rpcap://host.foo.bar:1234/devicename [everything literal, with port number] - - rpcap://10.11.12.13/devicename [IPv4 numeric, no port number] - - rpcap://10.11.12.13:1234/devicename [IPv4 numeric, with port number] - - rpcap://[10.11.12.13]:1234/devicename [IPv4 numeric with IPv6 format, with port number] - - rpcap://[1:2:3::4]/devicename [IPv6 numeric, no port number] - - rpcap://[1:2:3::4]:1234/devicename [IPv6 numeric, with port number] - - rpcap://[1:2:3::4]:http/devicename [IPv6 numeric, with literal port number] - - \{ -*/ - - -/*! - \brief String that will be used to determine the type of source in use (file, - remote/local interface). - - This string will be prepended to the interface name in order to create a string - that contains all the information required to open the source. - - This string indicates that the user wants to open a capture from a local file. -*/ -#define PCAP_SRC_FILE_STRING "file://" -/*! - \brief String that will be used to determine the type of source in use (file, - remote/local interface). - - This string will be prepended to the interface name in order to create a string - that contains all the information required to open the source. - - This string indicates that the user wants to open a capture from a network interface. - This string does not necessarily involve the use of the RPCAP protocol. If the - interface required resides on the local host, the RPCAP protocol is not involved - and the local functions are used. -*/ -#define PCAP_SRC_IF_STRING "rpcap://" - -/*! - \} -*/ - - - - - -/*! - \addtogroup remote_open_flags - \{ -*/ - -/*! - \brief It defines if the adapter has to go in promiscuous mode. - - It is '1' if you have to open the adapter in promiscuous mode, '0' otherwise. - Note that even if this parameter is false, the interface could well be in promiscuous - mode for some other reason (for example because another capture process with - promiscuous mode enabled is currently using that interface). - On on Linux systems with 2.2 or later kernels (that have the "any" device), this - flag does not work on the "any" device; if an argument of "any" is supplied, - the 'promisc' flag is ignored. -*/ -#define PCAP_OPENFLAG_PROMISCUOUS 1 - -/*! - \brief It defines if the data trasfer (in case of a remote - capture) has to be done with UDP protocol. - - If it is '1' if you want a UDP data connection, '0' if you want - a TCP data connection; control connection is always TCP-based. - A UDP connection is much lighter, but it does not guarantee that all - the captured packets arrive to the client workstation. Moreover, - it could be harmful in case of network congestion. - This flag is meaningless if the source is not a remote interface. - In that case, it is simply ignored. -*/ -#define PCAP_OPENFLAG_DATATX_UDP 2 - - -/*! - \brief It defines if the remote probe has to capture its own generated traffic. - - In case the remote probe uses the same interface to capture traffic and to send - data back to the caller, the captured traffic includes the RPCAP traffic as well. - If this flag is turned on, the RPCAP traffic is excluded from the capture, so that - the trace returned back to the collector is does not include this traffic. -*/ -#define PCAP_OPENFLAG_NOCAPTURE_RPCAP 4 -/*! - \} -*/ - - -/*! - \addtogroup remote_samp_methods - \{ -*/ - -/*! - \brief No sampling has to be done on the current capture. - - In this case, no sampling algorithms are applied to the current capture. -*/ -#define PCAP_SAMP_NOSAMP 0 - -/*! - \brief It defines that only 1 out of N packets must be returned to the user. - - In this case, the 'value' field of the 'pcap_samp' structure indicates the - number of packets (minus 1) that must be discarded before one packet got accepted. - In other words, if 'value = 10', the first packet is returned to the caller, while - the following 9 are discarded. -*/ -#define PCAP_SAMP_1_EVERY_N 1 - -/*! - \brief It defines that we have to return 1 packet every N milliseconds. - - In this case, the 'value' field of the 'pcap_samp' structure indicates the 'waiting - time' in milliseconds before one packet got accepted. - In other words, if 'value = 10', the first packet is returned to the caller; the next - returned one will be the first packet that arrives when 10ms have elapsed. -*/ -#define PCAP_SAMP_FIRST_AFTER_N_MS 2 - -/*! - \} -*/ - - -/*! - \addtogroup remote_auth_methods - \{ -*/ - -/*! - \brief It defines the NULL authentication. - - This value has to be used within the 'type' member of the pcap_rmtauth structure. - The 'NULL' authentication has to be equal to 'zero', so that old applications - can just put every field of struct pcap_rmtauth to zero, and it does work. -*/ -#define RPCAP_RMTAUTH_NULL 0 -/*! - \brief It defines the username/password authentication. - - With this type of authentication, the RPCAP protocol will use the username/ - password provided to authenticate the user on the remote machine. If the - authentication is successful (and the user has the right to open network devices) - the RPCAP connection will continue; otherwise it will be dropped. - - This value has to be used within the 'type' member of the pcap_rmtauth structure. -*/ -#define RPCAP_RMTAUTH_PWD 1 - -/*! - \} -*/ - - - - -/*! - - \brief This structure keeps the information needed to authenticate - the user on a remote machine. - - The remote machine can either grant or refuse the access according - to the information provided. - In case the NULL authentication is required, both 'username' and - 'password' can be NULL pointers. - - This structure is meaningless if the source is not a remote interface; - in that case, the functions which requires such a structure can accept - a NULL pointer as well. -*/ -struct pcap_rmtauth -{ - /*! - \brief Type of the authentication required. - - In order to provide maximum flexibility, we can support different types - of authentication based on the value of this 'type' variable. The currently - supported authentication methods are defined into the - \link remote_auth_methods Remote Authentication Methods Section\endlink. - - */ - int type; - /*! - \brief Zero-terminated string containing the username that has to be - used on the remote machine for authentication. - - This field is meaningless in case of the RPCAP_RMTAUTH_NULL authentication - and it can be NULL. - */ - char *username; - /*! - \brief Zero-terminated string containing the password that has to be - used on the remote machine for authentication. - - This field is meaningless in case of the RPCAP_RMTAUTH_NULL authentication - and it can be NULL. - */ - char *password; -}; - - -/*! - \brief This structure defines the information related to sampling. - - In case the sampling is requested, the capturing device should read - only a subset of the packets coming from the source. The returned packets depend - on the sampling parameters. - - \warning The sampling process is applied after the filtering process. - In other words, packets are filtered first, then the sampling process selects a - subset of the 'filtered' packets and it returns them to the caller. -*/ -struct pcap_samp -{ - /*! - Method used for sampling. Currently, the supported methods are listed in the - \link remote_samp_methods Sampling Methods Section\endlink. - */ - int method; - - /*! - This value depends on the sampling method defined. For its meaning, please check - at the \link remote_samp_methods Sampling Methods Section\endlink. - */ - int value; -}; - - - - -//! Maximum length of an host name (needed for the RPCAP active mode) -#define RPCAP_HOSTLIST_SIZE 1024 - - -/*! - \} -*/ // end of public documentation - - -// Exported functions - - - -/** \name New WinPcap functions - - This section lists the new functions that are able to help considerably in writing - WinPcap programs because of their easiness of use. - */ -//\{ -pcap_t *pcap_open(const char *source, int snaplen, int flags, int read_timeout, struct pcap_rmtauth *auth, char *errbuf); -int pcap_createsrcstr(char *source, int type, const char *host, const char *port, const char *name, char *errbuf); -int pcap_parsesrcstr(const char *source, int *type, char *host, char *port, char *name, char *errbuf); -int pcap_findalldevs_ex(char *source, struct pcap_rmtauth *auth, pcap_if_t **alldevs, char *errbuf); -struct pcap_samp *pcap_setsampling(pcap_t *p); - -//\} -// End of new winpcap functions - - - -/** \name Remote Capture functions - */ -//\{ -SOCKET pcap_remoteact_accept(const char *address, const char *port, const char *hostlist, char *connectinghost, struct pcap_rmtauth *auth, char *errbuf); -int pcap_remoteact_list(char *hostlist, char sep, int size, char *errbuf); -int pcap_remoteact_close(const char *host, char *errbuf); -void pcap_remoteact_cleanup(); -//\} -// End of remote capture functions - -#ifdef __cplusplus -} -#endif - - -#endif - +/* + * Copyright (c) 2002 - 2003 + * NetGroup, Politecnico di Torino (Italy) + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the Politecnico di Torino nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + + +#ifndef __REMOTE_EXT_H__ +#define __REMOTE_EXT_H__ + + + +// Definition for Microsoft Visual Studio +#if _MSC_VER > 1000 +#pragma once +#endif + +#ifdef __cplusplus +extern "C" { +#endif + +/*! + \file remote-ext.h + + The goal of this file it to include most of the new definitions that should be + placed into the pcap.h file. + + It includes all new definitions (structures and functions like pcap_open(). + Some of the functions are not really a remote feature, but, right now, + they are placed here. +*/ + + + +// All this stuff is public +/*! \addtogroup remote_struct + \{ +*/ + + + + +/*! + \brief Defines the maximum buffer size in which address, port, interface names are kept. + + In case the adapter name or such is larger than this value, it is truncated. + This is not used by the user; however it must be aware that an hostname / interface + name longer than this value will be truncated. +*/ +#define PCAP_BUF_SIZE 1024 + + +/*! \addtogroup remote_source_ID + \{ +*/ + + +/*! + \brief Internal representation of the type of source in use (file, + remote/local interface). + + This indicates a file, i.e. the user want to open a capture from a local file. +*/ +#define PCAP_SRC_FILE 2 +/*! + \brief Internal representation of the type of source in use (file, + remote/local interface). + + This indicates a local interface, i.e. the user want to open a capture from + a local interface. This does not involve the RPCAP protocol. +*/ +#define PCAP_SRC_IFLOCAL 3 +/*! + \brief Internal representation of the type of source in use (file, + remote/local interface). + + This indicates a remote interface, i.e. the user want to open a capture from + an interface on a remote host. This does involve the RPCAP protocol. +*/ +#define PCAP_SRC_IFREMOTE 4 + +/*! + \} +*/ + + + +/*! \addtogroup remote_source_string + + The formats allowed by the pcap_open() are the following: + - file://path_and_filename [opens a local file] + - rpcap://devicename [opens the selected device devices available on the local host, without using the RPCAP protocol] + - rpcap://host/devicename [opens the selected device available on a remote host] + - rpcap://host:port/devicename [opens the selected device available on a remote host, using a non-standard port for RPCAP] + - adaptername [to open a local adapter; kept for compatibility, but it is strongly discouraged] + - (NULL) [to open the first local adapter; kept for compatibility, but it is strongly discouraged] + + The formats allowed by the pcap_findalldevs_ex() are the following: + - file://folder/ [lists all the files in the given folder] + - rpcap:// [lists all local adapters] + - rpcap://host:port/ [lists the devices available on a remote host] + + Referring to the 'host' and 'port' parameters, they can be either numeric or literal. Since + IPv6 is fully supported, these are the allowed formats: + + - host (literal): e.g. host.foo.bar + - host (numeric IPv4): e.g. 10.11.12.13 + - host (numeric IPv4, IPv6 style): e.g. [10.11.12.13] + - host (numeric IPv6): e.g. [1:2:3::4] + - port: can be either numeric (e.g. '80') or literal (e.g. 'http') + + Here you find some allowed examples: + - rpcap://host.foo.bar/devicename [everything literal, no port number] + - rpcap://host.foo.bar:1234/devicename [everything literal, with port number] + - rpcap://10.11.12.13/devicename [IPv4 numeric, no port number] + - rpcap://10.11.12.13:1234/devicename [IPv4 numeric, with port number] + - rpcap://[10.11.12.13]:1234/devicename [IPv4 numeric with IPv6 format, with port number] + - rpcap://[1:2:3::4]/devicename [IPv6 numeric, no port number] + - rpcap://[1:2:3::4]:1234/devicename [IPv6 numeric, with port number] + - rpcap://[1:2:3::4]:http/devicename [IPv6 numeric, with literal port number] + + \{ +*/ + + +/*! + \brief String that will be used to determine the type of source in use (file, + remote/local interface). + + This string will be prepended to the interface name in order to create a string + that contains all the information required to open the source. + + This string indicates that the user wants to open a capture from a local file. +*/ +#define PCAP_SRC_FILE_STRING "file://" +/*! + \brief String that will be used to determine the type of source in use (file, + remote/local interface). + + This string will be prepended to the interface name in order to create a string + that contains all the information required to open the source. + + This string indicates that the user wants to open a capture from a network interface. + This string does not necessarily involve the use of the RPCAP protocol. If the + interface required resides on the local host, the RPCAP protocol is not involved + and the local functions are used. +*/ +#define PCAP_SRC_IF_STRING "rpcap://" + +/*! + \} +*/ + + + + + +/*! + \addtogroup remote_open_flags + \{ +*/ + +/*! + \brief It defines if the adapter has to go in promiscuous mode. + + It is '1' if you have to open the adapter in promiscuous mode, '0' otherwise. + Note that even if this parameter is false, the interface could well be in promiscuous + mode for some other reason (for example because another capture process with + promiscuous mode enabled is currently using that interface). + On on Linux systems with 2.2 or later kernels (that have the "any" device), this + flag does not work on the "any" device; if an argument of "any" is supplied, + the 'promisc' flag is ignored. +*/ +#define PCAP_OPENFLAG_PROMISCUOUS 1 + +/*! + \brief It defines if the data trasfer (in case of a remote + capture) has to be done with UDP protocol. + + If it is '1' if you want a UDP data connection, '0' if you want + a TCP data connection; control connection is always TCP-based. + A UDP connection is much lighter, but it does not guarantee that all + the captured packets arrive to the client workstation. Moreover, + it could be harmful in case of network congestion. + This flag is meaningless if the source is not a remote interface. + In that case, it is simply ignored. +*/ +#define PCAP_OPENFLAG_DATATX_UDP 2 + + +/*! + \brief It defines if the remote probe has to capture its own generated traffic. + + In case the remote probe uses the same interface to capture traffic and to send + data back to the caller, the captured traffic includes the RPCAP traffic as well. + If this flag is turned on, the RPCAP traffic is excluded from the capture, so that + the trace returned back to the collector is does not include this traffic. +*/ +#define PCAP_OPENFLAG_NOCAPTURE_RPCAP 4 +/*! + \} +*/ + + +/*! + \addtogroup remote_samp_methods + \{ +*/ + +/*! + \brief No sampling has to be done on the current capture. + + In this case, no sampling algorithms are applied to the current capture. +*/ +#define PCAP_SAMP_NOSAMP 0 + +/*! + \brief It defines that only 1 out of N packets must be returned to the user. + + In this case, the 'value' field of the 'pcap_samp' structure indicates the + number of packets (minus 1) that must be discarded before one packet got accepted. + In other words, if 'value = 10', the first packet is returned to the caller, while + the following 9 are discarded. +*/ +#define PCAP_SAMP_1_EVERY_N 1 + +/*! + \brief It defines that we have to return 1 packet every N milliseconds. + + In this case, the 'value' field of the 'pcap_samp' structure indicates the 'waiting + time' in milliseconds before one packet got accepted. + In other words, if 'value = 10', the first packet is returned to the caller; the next + returned one will be the first packet that arrives when 10ms have elapsed. +*/ +#define PCAP_SAMP_FIRST_AFTER_N_MS 2 + +/*! + \} +*/ + + +/*! + \addtogroup remote_auth_methods + \{ +*/ + +/*! + \brief It defines the NULL authentication. + + This value has to be used within the 'type' member of the pcap_rmtauth structure. + The 'NULL' authentication has to be equal to 'zero', so that old applications + can just put every field of struct pcap_rmtauth to zero, and it does work. +*/ +#define RPCAP_RMTAUTH_NULL 0 +/*! + \brief It defines the username/password authentication. + + With this type of authentication, the RPCAP protocol will use the username/ + password provided to authenticate the user on the remote machine. If the + authentication is successful (and the user has the right to open network devices) + the RPCAP connection will continue; otherwise it will be dropped. + + This value has to be used within the 'type' member of the pcap_rmtauth structure. +*/ +#define RPCAP_RMTAUTH_PWD 1 + +/*! + \} +*/ + + + + +/*! + + \brief This structure keeps the information needed to authenticate + the user on a remote machine. + + The remote machine can either grant or refuse the access according + to the information provided. + In case the NULL authentication is required, both 'username' and + 'password' can be NULL pointers. + + This structure is meaningless if the source is not a remote interface; + in that case, the functions which requires such a structure can accept + a NULL pointer as well. +*/ +struct pcap_rmtauth +{ + /*! + \brief Type of the authentication required. + + In order to provide maximum flexibility, we can support different types + of authentication based on the value of this 'type' variable. The currently + supported authentication methods are defined into the + \link remote_auth_methods Remote Authentication Methods Section\endlink. + + */ + int type; + /*! + \brief Zero-terminated string containing the username that has to be + used on the remote machine for authentication. + + This field is meaningless in case of the RPCAP_RMTAUTH_NULL authentication + and it can be NULL. + */ + char *username; + /*! + \brief Zero-terminated string containing the password that has to be + used on the remote machine for authentication. + + This field is meaningless in case of the RPCAP_RMTAUTH_NULL authentication + and it can be NULL. + */ + char *password; +}; + + +/*! + \brief This structure defines the information related to sampling. + + In case the sampling is requested, the capturing device should read + only a subset of the packets coming from the source. The returned packets depend + on the sampling parameters. + + \warning The sampling process is applied after the filtering process. + In other words, packets are filtered first, then the sampling process selects a + subset of the 'filtered' packets and it returns them to the caller. +*/ +struct pcap_samp +{ + /*! + Method used for sampling. Currently, the supported methods are listed in the + \link remote_samp_methods Sampling Methods Section\endlink. + */ + int method; + + /*! + This value depends on the sampling method defined. For its meaning, please check + at the \link remote_samp_methods Sampling Methods Section\endlink. + */ + int value; +}; + + + + +//! Maximum length of an host name (needed for the RPCAP active mode) +#define RPCAP_HOSTLIST_SIZE 1024 + + +/*! + \} +*/ // end of public documentation + + +// Exported functions + + + +/** \name New WinPcap functions + + This section lists the new functions that are able to help considerably in writing + WinPcap programs because of their easiness of use. + */ +//\{ +pcap_t *pcap_open(const char *source, int snaplen, int flags, int read_timeout, struct pcap_rmtauth *auth, char *errbuf); +int pcap_createsrcstr(char *source, int type, const char *host, const char *port, const char *name, char *errbuf); +int pcap_parsesrcstr(const char *source, int *type, char *host, char *port, char *name, char *errbuf); +int pcap_findalldevs_ex(char *source, struct pcap_rmtauth *auth, pcap_if_t **alldevs, char *errbuf); +struct pcap_samp *pcap_setsampling(pcap_t *p); + +//\} +// End of new winpcap functions + + + +/** \name Remote Capture functions + */ +//\{ +SOCKET pcap_remoteact_accept(const char *address, const char *port, const char *hostlist, char *connectinghost, struct pcap_rmtauth *auth, char *errbuf); +int pcap_remoteact_list(char *hostlist, char sep, int size, char *errbuf); +int pcap_remoteact_close(const char *host, char *errbuf); +void pcap_remoteact_cleanup(); +//\} +// End of remote capture functions + +#ifdef __cplusplus +} +#endif + + +#endif + diff --git a/src/Cedar/winpcap/sched.h b/src/Cedar/winpcap/sched.h index 8f4ddf4c..9208a52f 100644 --- a/src/Cedar/winpcap/sched.h +++ b/src/Cedar/winpcap/sched.h @@ -1,174 +1,174 @@ -/* - * Module: sched.h - * - * Purpose: - * Provides an implementation of POSIX realtime extensions - * as defined in - * - * POSIX 1003.1b-1993 (POSIX.1b) - * - * -------------------------------------------------------------------------- - * - * Pthreads-win32 - POSIX Threads Library for Win32 - * Copyright(C) 1998 John E. Bossom - * Copyright(C) 1999,2003 Pthreads-win32 contributors - * - * Contact Email: rpj@callisto.canberra.edu.au - * - * The current list of contributors is contained - * in the file CONTRIBUTORS included with the source - * code distribution. The list can also be seen at the - * following World Wide Web location: - * http://sources.redhat.com/pthreads-win32/contributors.html - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library in the file COPYING.LIB; - * if not, write to the Free Software Foundation, Inc., - * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - */ -#ifndef _SCHED_H -#define _SCHED_H - -#undef PTW32_LEVEL - -#if defined(_POSIX_SOURCE) -#define PTW32_LEVEL 0 -/* Early POSIX */ -#endif - -#if defined(_POSIX_C_SOURCE) && _POSIX_C_SOURCE >= 199309 -#undef PTW32_LEVEL -#define PTW32_LEVEL 1 -/* Include 1b, 1c and 1d */ -#endif - -#if defined(INCLUDE_NP) -#undef PTW32_LEVEL -#define PTW32_LEVEL 2 -/* Include Non-Portable extensions */ -#endif - -#define PTW32_LEVEL_MAX 3 - -#if !defined(PTW32_LEVEL) -#define PTW32_LEVEL PTW32_LEVEL_MAX -/* Include everything */ -#endif - - -#if __GNUC__ && ! defined (__declspec) -# error Please upgrade your GNU compiler to one that supports __declspec. -#endif - -/* - * When building the DLL code, you should define PTW32_BUILD so that - * the variables/functions are exported correctly. When using the DLL, - * do NOT define PTW32_BUILD, and then the variables/functions will - * be imported correctly. - */ -#ifdef PTW32_BUILD -# define PTW32_DLLPORT __declspec (dllexport) -#else -# define PTW32_DLLPORT __declspec (dllimport) -#endif - -/* - * This is a duplicate of what is in the autoconf config.h, - * which is only used when building the pthread-win32 libraries. - */ - -#ifndef PTW32_CONFIG_H -# if defined(WINCE) -# define NEED_ERRNO -# define NEED_SEM -# endif -# if defined(_UWIN) || defined(__MINGW32__) -# define HAVE_MODE_T -# endif -#endif - -/* - * - */ - -#if PTW32_LEVEL >= PTW32_LEVEL_MAX -#ifdef NEED_ERRNO -#include "need_errno.h" -#else -#include -#endif -#endif /* PTW32_LEVEL >= PTW32_LEVEL_MAX */ - -#if defined(__MINGW32__) || defined(_UWIN) -#if PTW32_LEVEL >= PTW32_LEVEL_MAX -/* For pid_t */ -# include -/* Required by Unix 98 */ -# include -#endif /* PTW32_LEVEL >= PTW32_LEVEL_MAX */ -#else -typedef int pid_t; -#endif - -/* Thread scheduling policies */ - -enum { - SCHED_OTHER = 0, - SCHED_FIFO, - SCHED_RR, - SCHED_MIN = SCHED_OTHER, - SCHED_MAX = SCHED_RR -}; - -struct sched_param { - int sched_priority; -}; - -#ifdef __cplusplus -extern "C" -{ -#endif /* __cplusplus */ - -PTW32_DLLPORT int sched_yield (void); - -PTW32_DLLPORT int sched_get_priority_min (int policy); - -PTW32_DLLPORT int sched_get_priority_max (int policy); - -PTW32_DLLPORT int sched_setscheduler (pid_t pid, int policy); - -PTW32_DLLPORT int sched_getscheduler (pid_t pid); - -/* - * Note that this macro returns ENOTSUP rather than - * ENOSYS as might be expected. However, returning ENOSYS - * should mean that sched_get_priority_{min,max} are - * not implemented as well as sched_rr_get_interval. - * This is not the case, since we just don't support - * round-robin scheduling. Therefore I have chosen to - * return the same value as sched_setscheduler when - * SCHED_RR is passed to it. - */ -#define sched_rr_get_interval(_pid, _interval) \ - ( errno = ENOTSUP, (int) -1 ) - - -#ifdef __cplusplus -} /* End of extern "C" */ -#endif /* __cplusplus */ - -#undef PTW32_LEVEL -#undef PTW32_LEVEL_MAX - -#endif /* !_SCHED_H */ - +/* + * Module: sched.h + * + * Purpose: + * Provides an implementation of POSIX realtime extensions + * as defined in + * + * POSIX 1003.1b-1993 (POSIX.1b) + * + * -------------------------------------------------------------------------- + * + * Pthreads-win32 - POSIX Threads Library for Win32 + * Copyright(C) 1998 John E. Bossom + * Copyright(C) 1999,2003 Pthreads-win32 contributors + * + * Contact Email: rpj@callisto.canberra.edu.au + * + * The current list of contributors is contained + * in the file CONTRIBUTORS included with the source + * code distribution. The list can also be seen at the + * following World Wide Web location: + * http://sources.redhat.com/pthreads-win32/contributors.html + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library in the file COPYING.LIB; + * if not, write to the Free Software Foundation, Inc., + * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA + */ +#ifndef _SCHED_H +#define _SCHED_H + +#undef PTW32_LEVEL + +#if defined(_POSIX_SOURCE) +#define PTW32_LEVEL 0 +/* Early POSIX */ +#endif + +#if defined(_POSIX_C_SOURCE) && _POSIX_C_SOURCE >= 199309 +#undef PTW32_LEVEL +#define PTW32_LEVEL 1 +/* Include 1b, 1c and 1d */ +#endif + +#if defined(INCLUDE_NP) +#undef PTW32_LEVEL +#define PTW32_LEVEL 2 +/* Include Non-Portable extensions */ +#endif + +#define PTW32_LEVEL_MAX 3 + +#if !defined(PTW32_LEVEL) +#define PTW32_LEVEL PTW32_LEVEL_MAX +/* Include everything */ +#endif + + +#if __GNUC__ && ! defined (__declspec) +# error Please upgrade your GNU compiler to one that supports __declspec. +#endif + +/* + * When building the DLL code, you should define PTW32_BUILD so that + * the variables/functions are exported correctly. When using the DLL, + * do NOT define PTW32_BUILD, and then the variables/functions will + * be imported correctly. + */ +#ifdef PTW32_BUILD +# define PTW32_DLLPORT __declspec (dllexport) +#else +# define PTW32_DLLPORT __declspec (dllimport) +#endif + +/* + * This is a duplicate of what is in the autoconf config.h, + * which is only used when building the pthread-win32 libraries. + */ + +#ifndef PTW32_CONFIG_H +# if defined(WINCE) +# define NEED_ERRNO +# define NEED_SEM +# endif +# if defined(_UWIN) || defined(__MINGW32__) +# define HAVE_MODE_T +# endif +#endif + +/* + * + */ + +#if PTW32_LEVEL >= PTW32_LEVEL_MAX +#ifdef NEED_ERRNO +#include "need_errno.h" +#else +#include +#endif +#endif /* PTW32_LEVEL >= PTW32_LEVEL_MAX */ + +#if defined(__MINGW32__) || defined(_UWIN) +#if PTW32_LEVEL >= PTW32_LEVEL_MAX +/* For pid_t */ +# include +/* Required by Unix 98 */ +# include +#endif /* PTW32_LEVEL >= PTW32_LEVEL_MAX */ +#else +typedef int pid_t; +#endif + +/* Thread scheduling policies */ + +enum { + SCHED_OTHER = 0, + SCHED_FIFO, + SCHED_RR, + SCHED_MIN = SCHED_OTHER, + SCHED_MAX = SCHED_RR +}; + +struct sched_param { + int sched_priority; +}; + +#ifdef __cplusplus +extern "C" +{ +#endif /* __cplusplus */ + +PTW32_DLLPORT int sched_yield (void); + +PTW32_DLLPORT int sched_get_priority_min (int policy); + +PTW32_DLLPORT int sched_get_priority_max (int policy); + +PTW32_DLLPORT int sched_setscheduler (pid_t pid, int policy); + +PTW32_DLLPORT int sched_getscheduler (pid_t pid); + +/* + * Note that this macro returns ENOTSUP rather than + * ENOSYS as might be expected. However, returning ENOSYS + * should mean that sched_get_priority_{min,max} are + * not implemented as well as sched_rr_get_interval. + * This is not the case, since we just don't support + * round-robin scheduling. Therefore I have chosen to + * return the same value as sched_setscheduler when + * SCHED_RR is passed to it. + */ +#define sched_rr_get_interval(_pid, _interval) \ + ( errno = ENOTSUP, (int) -1 ) + + +#ifdef __cplusplus +} /* End of extern "C" */ +#endif /* __cplusplus */ + +#undef PTW32_LEVEL +#undef PTW32_LEVEL_MAX + +#endif /* !_SCHED_H */ + diff --git a/src/Cedar/winpcap/semaphore.h b/src/Cedar/winpcap/semaphore.h index 733f0ae3..73bc45d1 100644 --- a/src/Cedar/winpcap/semaphore.h +++ b/src/Cedar/winpcap/semaphore.h @@ -1,163 +1,163 @@ -/* - * Module: semaphore.h - * - * Purpose: - * Semaphores aren't actually part of the PThreads standard. - * They are defined by the POSIX Standard: - * - * POSIX 1003.1b-1993 (POSIX.1b) - * - * -------------------------------------------------------------------------- - * - * Pthreads-win32 - POSIX Threads Library for Win32 - * Copyright(C) 1998 John E. Bossom - * Copyright(C) 1999,2003 Pthreads-win32 contributors - * - * Contact Email: rpj@callisto.canberra.edu.au - * - * The current list of contributors is contained - * in the file CONTRIBUTORS included with the source - * code distribution. The list can also be seen at the - * following World Wide Web location: - * http://sources.redhat.com/pthreads-win32/contributors.html - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library in the file COPYING.LIB; - * if not, write to the Free Software Foundation, Inc., - * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - */ -#if !defined( SEMAPHORE_H ) -#define SEMAPHORE_H - -#undef PTW32_LEVEL - -#if defined(_POSIX_SOURCE) -#define PTW32_LEVEL 0 -/* Early POSIX */ -#endif - -#if defined(_POSIX_C_SOURCE) && _POSIX_C_SOURCE >= 199309 -#undef PTW32_LEVEL -#define PTW32_LEVEL 1 -/* Include 1b, 1c and 1d */ -#endif - -#if defined(INCLUDE_NP) -#undef PTW32_LEVEL -#define PTW32_LEVEL 2 -/* Include Non-Portable extensions */ -#endif - -#define PTW32_LEVEL_MAX 3 - -#if !defined(PTW32_LEVEL) -#define PTW32_LEVEL PTW32_LEVEL_MAX -/* Include everything */ -#endif - -#if __GNUC__ && ! defined (__declspec) -# error Please upgrade your GNU compiler to one that supports __declspec. -#endif - -/* - * When building the DLL code, you should define PTW32_BUILD so that - * the variables/functions are exported correctly. When using the DLL, - * do NOT define PTW32_BUILD, and then the variables/functions will - * be imported correctly. - */ -#ifdef PTW32_BUILD -# define PTW32_DLLPORT __declspec (dllexport) -#else -# define PTW32_DLLPORT __declspec (dllimport) -#endif - - -/* - * This is a duplicate of what is in the autoconf config.h, - * which is only used when building the pthread-win32 libraries. - */ - -#ifndef PTW32_CONFIG_H -# if defined(WINCE) -# define NEED_ERRNO -# define NEED_SEM -# endif -# if defined(_UWIN) || defined(__MINGW32__) -# define HAVE_MODE_T -# endif -#endif - -/* - * - */ - -#if PTW32_LEVEL >= PTW32_LEVEL_MAX -#ifdef NEED_ERRNO -#include "need_errno.h" -#else -#include -#endif -#endif /* PTW32_LEVEL >= PTW32_LEVEL_MAX */ - -#define _POSIX_SEMAPHORES - -#ifdef __cplusplus -extern "C" -{ -#endif /* __cplusplus */ - -#ifndef HAVE_MODE_T -typedef unsigned int mode_t; -#endif - - -typedef struct sem_t_ * sem_t; - -PTW32_DLLPORT int sem_init (sem_t * sem, - int pshared, - unsigned int value); - -PTW32_DLLPORT int sem_destroy (sem_t * sem); - -PTW32_DLLPORT int sem_trywait (sem_t * sem); - -PTW32_DLLPORT int sem_wait (sem_t * sem); - -PTW32_DLLPORT int sem_timedwait (sem_t * sem, - const struct timespec * abstime); - -PTW32_DLLPORT int sem_post (sem_t * sem); - -PTW32_DLLPORT int sem_post_multiple (sem_t * sem, - int count); - -PTW32_DLLPORT int sem_open (const char * name, - int oflag, - mode_t mode, - unsigned int value); - -PTW32_DLLPORT int sem_close (sem_t * sem); - -PTW32_DLLPORT int sem_unlink (const char * name); - -PTW32_DLLPORT int sem_getvalue (sem_t * sem, - int * sval); - -#ifdef __cplusplus -} /* End of extern "C" */ -#endif /* __cplusplus */ - -#undef PTW32_LEVEL -#undef PTW32_LEVEL_MAX - -#endif /* !SEMAPHORE_H */ +/* + * Module: semaphore.h + * + * Purpose: + * Semaphores aren't actually part of the PThreads standard. + * They are defined by the POSIX Standard: + * + * POSIX 1003.1b-1993 (POSIX.1b) + * + * -------------------------------------------------------------------------- + * + * Pthreads-win32 - POSIX Threads Library for Win32 + * Copyright(C) 1998 John E. Bossom + * Copyright(C) 1999,2003 Pthreads-win32 contributors + * + * Contact Email: rpj@callisto.canberra.edu.au + * + * The current list of contributors is contained + * in the file CONTRIBUTORS included with the source + * code distribution. The list can also be seen at the + * following World Wide Web location: + * http://sources.redhat.com/pthreads-win32/contributors.html + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library in the file COPYING.LIB; + * if not, write to the Free Software Foundation, Inc., + * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA + */ +#if !defined( SEMAPHORE_H ) +#define SEMAPHORE_H + +#undef PTW32_LEVEL + +#if defined(_POSIX_SOURCE) +#define PTW32_LEVEL 0 +/* Early POSIX */ +#endif + +#if defined(_POSIX_C_SOURCE) && _POSIX_C_SOURCE >= 199309 +#undef PTW32_LEVEL +#define PTW32_LEVEL 1 +/* Include 1b, 1c and 1d */ +#endif + +#if defined(INCLUDE_NP) +#undef PTW32_LEVEL +#define PTW32_LEVEL 2 +/* Include Non-Portable extensions */ +#endif + +#define PTW32_LEVEL_MAX 3 + +#if !defined(PTW32_LEVEL) +#define PTW32_LEVEL PTW32_LEVEL_MAX +/* Include everything */ +#endif + +#if __GNUC__ && ! defined (__declspec) +# error Please upgrade your GNU compiler to one that supports __declspec. +#endif + +/* + * When building the DLL code, you should define PTW32_BUILD so that + * the variables/functions are exported correctly. When using the DLL, + * do NOT define PTW32_BUILD, and then the variables/functions will + * be imported correctly. + */ +#ifdef PTW32_BUILD +# define PTW32_DLLPORT __declspec (dllexport) +#else +# define PTW32_DLLPORT __declspec (dllimport) +#endif + + +/* + * This is a duplicate of what is in the autoconf config.h, + * which is only used when building the pthread-win32 libraries. + */ + +#ifndef PTW32_CONFIG_H +# if defined(WINCE) +# define NEED_ERRNO +# define NEED_SEM +# endif +# if defined(_UWIN) || defined(__MINGW32__) +# define HAVE_MODE_T +# endif +#endif + +/* + * + */ + +#if PTW32_LEVEL >= PTW32_LEVEL_MAX +#ifdef NEED_ERRNO +#include "need_errno.h" +#else +#include +#endif +#endif /* PTW32_LEVEL >= PTW32_LEVEL_MAX */ + +#define _POSIX_SEMAPHORES + +#ifdef __cplusplus +extern "C" +{ +#endif /* __cplusplus */ + +#ifndef HAVE_MODE_T +typedef unsigned int mode_t; +#endif + + +typedef struct sem_t_ * sem_t; + +PTW32_DLLPORT int sem_init (sem_t * sem, + int pshared, + unsigned int value); + +PTW32_DLLPORT int sem_destroy (sem_t * sem); + +PTW32_DLLPORT int sem_trywait (sem_t * sem); + +PTW32_DLLPORT int sem_wait (sem_t * sem); + +PTW32_DLLPORT int sem_timedwait (sem_t * sem, + const struct timespec * abstime); + +PTW32_DLLPORT int sem_post (sem_t * sem); + +PTW32_DLLPORT int sem_post_multiple (sem_t * sem, + int count); + +PTW32_DLLPORT int sem_open (const char * name, + int oflag, + mode_t mode, + unsigned int value); + +PTW32_DLLPORT int sem_close (sem_t * sem); + +PTW32_DLLPORT int sem_unlink (const char * name); + +PTW32_DLLPORT int sem_getvalue (sem_t * sem, + int * sval); + +#ifdef __cplusplus +} /* End of extern "C" */ +#endif /* __cplusplus */ + +#undef PTW32_LEVEL +#undef PTW32_LEVEL_MAX + +#endif /* !SEMAPHORE_H */ diff --git a/src/Cedar/winpcap/tcp_session.h b/src/Cedar/winpcap/tcp_session.h index 33aa99e1..ccd87eba 100644 --- a/src/Cedar/winpcap/tcp_session.h +++ b/src/Cedar/winpcap/tcp_session.h @@ -1,96 +1,96 @@ -/* - * Copyright (c) 2001 - 2003 - * NetGroup, Politecnico di Torino (Italy) - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the Politecnico di Torino nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - */ - -#ifndef __tcp_session -#define __tcp_session - -#ifdef WIN32 -#include "tme.h" -#endif - -#ifdef __FreeBSD__ - -#ifdef _KERNEL -#include -#else -#include -#endif - -#endif - -#define UNKNOWN 0 -#define SYN_RCV 1 -#define SYN_ACK_RCV 2 -#define ESTABLISHED 3 -#define CLOSED_RST 4 -#define FIN_CLN_RCV 5 -#define FIN_SRV_RCV 6 -#define CLOSED_FIN 7 -#define ERROR_TCP 8 -#define FIRST_IS_CLN 0 -#define FIRST_IS_SRV 0xffffffff -#define FIN_CLN 1 -#define FIN_SRV 2 - -#define MAX_WINDOW 65536 - -typedef struct __tcp_data -{ - struct timeval timestamp_block; /*DO NOT MOVE THIS VALUE*/ - struct timeval syn_timestamp; - struct timeval last_timestamp; - struct timeval syn_ack_timestamp; - uint32 direction; - uint32 seq_n_0_srv; - uint32 seq_n_0_cln; - uint32 ack_srv; /* acknowledge of (data sent by server) */ - uint32 ack_cln; /* acknowledge of (data sent by client) */ - uint32 status; - uint32 pkts_cln_to_srv; - uint32 pkts_srv_to_cln; - uint32 bytes_srv_to_cln; - uint32 bytes_cln_to_srv; - uint32 close_state; -} - tcp_data; - -#define FIN 1 -#define SYN 2 -#define RST 4 -#define PSH 8 -#define ACK 16 -#define URG 32 - -#define TCP_SESSION 0x00000800 -uint32 tcp_session(uint8 *block, uint32 pkt_size, TME_DATA *data, MEM_TYPE *mem_ex, uint8 *mem_data); - -#endif +/* + * Copyright (c) 2001 - 2003 + * NetGroup, Politecnico di Torino (Italy) + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the Politecnico di Torino nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#ifndef __tcp_session +#define __tcp_session + +#ifdef WIN32 +#include "tme.h" +#endif + +#ifdef __FreeBSD__ + +#ifdef _KERNEL +#include +#else +#include +#endif + +#endif + +#define UNKNOWN 0 +#define SYN_RCV 1 +#define SYN_ACK_RCV 2 +#define ESTABLISHED 3 +#define CLOSED_RST 4 +#define FIN_CLN_RCV 5 +#define FIN_SRV_RCV 6 +#define CLOSED_FIN 7 +#define ERROR_TCP 8 +#define FIRST_IS_CLN 0 +#define FIRST_IS_SRV 0xffffffff +#define FIN_CLN 1 +#define FIN_SRV 2 + +#define MAX_WINDOW 65536 + +typedef struct __tcp_data +{ + struct timeval timestamp_block; /*DO NOT MOVE THIS VALUE*/ + struct timeval syn_timestamp; + struct timeval last_timestamp; + struct timeval syn_ack_timestamp; + uint32 direction; + uint32 seq_n_0_srv; + uint32 seq_n_0_cln; + uint32 ack_srv; /* acknowledge of (data sent by server) */ + uint32 ack_cln; /* acknowledge of (data sent by client) */ + uint32 status; + uint32 pkts_cln_to_srv; + uint32 pkts_srv_to_cln; + uint32 bytes_srv_to_cln; + uint32 bytes_cln_to_srv; + uint32 close_state; +} + tcp_data; + +#define FIN 1 +#define SYN 2 +#define RST 4 +#define PSH 8 +#define ACK 16 +#define URG 32 + +#define TCP_SESSION 0x00000800 +uint32 tcp_session(uint8 *block, uint32 pkt_size, TME_DATA *data, MEM_TYPE *mem_ex, uint8 *mem_data); + +#endif diff --git a/src/Cedar/winpcap/time_calls.h b/src/Cedar/winpcap/time_calls.h index 6532162a..c96e17c6 100644 --- a/src/Cedar/winpcap/time_calls.h +++ b/src/Cedar/winpcap/time_calls.h @@ -1,438 +1,438 @@ -/* - * Copyright (c) 2001 - * Politecnico di Torino. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that: (1) source code distributions - * retain the above copyright notice and this paragraph in its entirety, (2) - * distributions including binary code include the above copyright notice and - * this paragraph in its entirety in the documentation or other materials - * provided with the distribution, and (3) all advertising materials mentioning - * features or use of this software display the following acknowledgement: - * ``This product includes software developed by the Politecnico - * di Torino, and its contributors.'' Neither the name of - * the University nor the names of its contributors may be used to endorse - * or promote products derived from this software without specific prior - * written permission. - * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. - */ - -#ifndef _time_calls -#define _time_calls - -#ifdef WIN_NT_DRIVER - -#include "debug.h" -#include "ndis.h" - -#define DEFAULT_TIMESTAMPMODE 0 - -#define TIMESTAMPMODE_SINGLE_SYNCHRONIZATION 0 -#define TIMESTAMPMODE_SYNCHRONIZATION_ON_CPU_WITH_FIXUP 1 -#define TIMESTAMPMODE_QUERYSYSTEMTIME 2 -#define TIMESTAMPMODE_RDTSC 3 - -#define TIMESTAMPMODE_SYNCHRONIZATION_ON_CPU_NO_FIXUP 99 - -#define TIMESTAMPMODE_REGKEY L"TimestampMode" - -extern ULONG TimestampMode; - -/*! - \brief A microsecond precise timestamp. - - included in the sf_pkthdr or the bpf_hdr that NPF associates with every packet. -*/ - -struct timeval { - long tv_sec; ///< seconds - long tv_usec; ///< microseconds -}; - -#endif /*WIN_NT_DRIVER*/ - -struct time_conv -{ - ULONGLONG reference; - struct timeval start[32]; -}; - -#ifdef WIN_NT_DRIVER - -__inline void TIME_DESYNCHRONIZE(struct time_conv *data) -{ - data->reference = 0; -// data->start.tv_sec = 0; -// data->start.tv_usec = 0; -} - - -__inline void ReadTimeStampModeFromRegistry(PUNICODE_STRING RegistryPath) -{ - ULONG NewLength; - PWSTR NullTerminatedString; - RTL_QUERY_REGISTRY_TABLE Queries[2]; - ULONG DefaultTimestampMode = DEFAULT_TIMESTAMPMODE; - - NewLength = RegistryPath->Length/2; - - NullTerminatedString = ExAllocatePool(PagedPool, (NewLength+1) *sizeof(WCHAR)); - - if (NullTerminatedString != NULL) - { - RtlCopyMemory(NullTerminatedString, RegistryPath->Buffer, RegistryPath->Length); - - NullTerminatedString[NewLength]=0; - - RtlZeroMemory(Queries, sizeof(Queries)); - - Queries[0].Flags = RTL_QUERY_REGISTRY_DIRECT; - Queries[0].Name = TIMESTAMPMODE_REGKEY; - Queries[0].EntryContext = &TimestampMode; - Queries[0].DefaultType = REG_DWORD; - Queries[0].DefaultData = &DefaultTimestampMode; - Queries[0].DefaultLength = sizeof(ULONG); - - if (RtlQueryRegistryValues(RTL_REGISTRY_ABSOLUTE, NullTerminatedString, Queries, NULL, NULL) != STATUS_SUCCESS) - { - TimestampMode = DEFAULT_TIMESTAMPMODE; - } - - RtlWriteRegistryValue( RTL_REGISTRY_ABSOLUTE, NullTerminatedString, TIMESTAMPMODE_REGKEY, REG_DWORD, &TimestampMode,sizeof(ULONG)); - ExFreePool(NullTerminatedString); - } - else - TimestampMode = DEFAULT_TIMESTAMPMODE; -} - -#pragma optimize ("g",off) //Due to some weird behaviour of the optimizer of DDK build 2600 - -/* KeQueryPerformanceCounter TimeStamps */ -__inline void SynchronizeOnCpu(struct timeval *start) -{ -// struct timeval *start = (struct timeval*)Data; - - struct timeval tmp; - LARGE_INTEGER SystemTime; - LARGE_INTEGER i; - ULONG tmp2; - LARGE_INTEGER TimeFreq,PTime; - - // get the absolute value of the system boot time. - - PTime = KeQueryPerformanceCounter(&TimeFreq); - KeQuerySystemTime(&SystemTime); - - start->tv_sec = (LONG)(SystemTime.QuadPart/10000000-11644473600); - - start->tv_usec = (LONG)((SystemTime.QuadPart%10000000)/10); - - start->tv_sec -= (ULONG)(PTime.QuadPart/TimeFreq.QuadPart); - - start->tv_usec -= (LONG)((PTime.QuadPart%TimeFreq.QuadPart)*1000000/TimeFreq.QuadPart); - - if (start->tv_usec < 0) - { - start->tv_sec --; - start->tv_usec += 1000000; - } -} - -/*RDTSC timestamps */ -/* callers must be at IRQL=PASSIVE_LEVEL*/ -__inline VOID TimeSynchronizeRDTSC(struct time_conv *data) -{ - struct timeval tmp; - LARGE_INTEGER system_time; - ULONGLONG curr_ticks; - KIRQL old; - LARGE_INTEGER start_kqpc,stop_kqpc,start_freq,stop_freq; - ULONGLONG start_ticks,stop_ticks; - ULONGLONG delta,delta2; - KEVENT event; - LARGE_INTEGER i; - ULONGLONG reference; - - if (data->reference!=0) - return; - - KeInitializeEvent(&event,NotificationEvent,FALSE); - - i.QuadPart=-3500000; - - KeRaiseIrql(HIGH_LEVEL,&old); - start_kqpc=KeQueryPerformanceCounter(&start_freq); - __asm - { - push eax - push edx - push ecx - rdtsc - lea ecx, start_ticks - mov [ecx+4], edx - mov [ecx], eax - pop ecx - pop edx - pop eax - } - - KeLowerIrql(old); - - KeWaitForSingleObject(&event,UserRequest,KernelMode,TRUE ,&i); - - KeRaiseIrql(HIGH_LEVEL,&old); - stop_kqpc=KeQueryPerformanceCounter(&stop_freq); - __asm - { - push eax - push edx - push ecx - rdtsc - lea ecx, stop_ticks - mov [ecx+4], edx - mov [ecx], eax - pop ecx - pop edx - pop eax - } - KeLowerIrql(old); - - delta=stop_ticks-start_ticks; - delta2=stop_kqpc.QuadPart-start_kqpc.QuadPart; - if (delta>10000000000) - { - delta/=16; - delta2/=16; - } - - reference=delta*(start_freq.QuadPart)/delta2; - - data->reference=reference/1000; - - if (reference%1000>500) - data->reference++; - - data->reference*=1000; - - reference=data->reference; - - KeQuerySystemTime(&system_time); - - __asm - { - push eax - push edx - push ecx - rdtsc - lea ecx, curr_ticks - mov [ecx+4], edx - mov [ecx], eax - pop ecx - pop edx - pop eax - } - - tmp.tv_sec=-(LONG)(curr_ticks/reference); - - tmp.tv_usec=-(LONG)((curr_ticks%reference)*1000000/reference); - - system_time.QuadPart-=116444736000000000; - - tmp.tv_sec+=(LONG)(system_time.QuadPart/10000000); - tmp.tv_usec+=(LONG)((system_time.QuadPart%10000000)/10); - - if (tmp.tv_usec<0) - { - tmp.tv_sec--; - tmp.tv_usec+=1000000; - } - - data->start[0] = tmp; - - IF_LOUD(DbgPrint("Frequency %I64u MHz\n",data->reference);) -} - -#pragma optimize ("g",on) //Due to some weird behaviour of the optimizer of DDK build 2600 - -__inline VOID TIME_SYNCHRONIZE(struct time_conv *data) -{ - ULONG NumberOfCpus, i; - KAFFINITY AffinityMask; - - if (data->reference != 0) - return; - - NumberOfCpus = NdisSystemProcessorCount(); - - if ( TimestampMode == TIMESTAMPMODE_SYNCHRONIZATION_ON_CPU_WITH_FIXUP || TimestampMode == TIMESTAMPMODE_SYNCHRONIZATION_ON_CPU_NO_FIXUP) - { - for (i = 0 ; i < NumberOfCpus ; i++ ) - { - AffinityMask = (1 << i); - ZwSetInformationThread(NtCurrentThread(), ThreadAffinityMask, &AffinityMask, sizeof(KAFFINITY)); - SynchronizeOnCpu(&(data->start[i])); - } - AffinityMask = 0xFFFFFFFF; - ZwSetInformationThread(NtCurrentThread(), ThreadAffinityMask, &AffinityMask, sizeof(KAFFINITY)); - data->reference = 1; - } - else - if ( TimestampMode == TIMESTAMPMODE_QUERYSYSTEMTIME ) - { - //do nothing - data->reference = 1; - } - else - if ( TimestampMode == TIMESTAMPMODE_RDTSC ) - { - TimeSynchronizeRDTSC(data); - } - else - { //it should be only the normal case i.e. TIMESTAMPMODE_SINGLESYNCHRONIZATION - SynchronizeOnCpu(data->start); - data->reference = 1; - } - return; -} - - -#pragma optimize ("g",off) //Due to some weird behaviour of the optimizer of DDK build 2600 - -__inline void GetTimeKQPC(struct timeval *dst, struct time_conv *data) -{ - LARGE_INTEGER PTime, TimeFreq; - LONG tmp; - ULONG CurrentCpu; - static struct timeval old_ts={0,0}; - - - PTime = KeQueryPerformanceCounter(&TimeFreq); - tmp = (LONG)(PTime.QuadPart/TimeFreq.QuadPart); - - if (TimestampMode == TIMESTAMPMODE_SYNCHRONIZATION_ON_CPU_WITH_FIXUP || TimestampMode == TIMESTAMPMODE_SYNCHRONIZATION_ON_CPU_NO_FIXUP) - { - //actually this code is ok only if we are guaranteed that no thread scheduling will take place. - CurrentCpu = KeGetCurrentProcessorNumber(); - - dst->tv_sec = data->start[CurrentCpu].tv_sec + tmp; - dst->tv_usec = data->start[CurrentCpu].tv_usec + (LONG)((PTime.QuadPart%TimeFreq.QuadPart)*1000000/TimeFreq.QuadPart); - - if (dst->tv_usec >= 1000000) - { - dst->tv_sec ++; - dst->tv_usec -= 1000000; - } - - if (TimestampMode == TIMESTAMPMODE_SYNCHRONIZATION_ON_CPU_WITH_FIXUP) - { - if (old_ts.tv_sec > dst->tv_sec || (old_ts.tv_sec == dst->tv_sec && old_ts.tv_usec > dst->tv_usec) ) - *dst = old_ts; - - else - old_ts = *dst; - } - } - else - { //it should be only the normal case i.e. TIMESTAMPMODE_SINGLESYNCHRONIZATION - dst->tv_sec = data->start[0].tv_sec + tmp; - dst->tv_usec = data->start[0].tv_usec + (LONG)((PTime.QuadPart%TimeFreq.QuadPart)*1000000/TimeFreq.QuadPart); - - if (dst->tv_usec >= 1000000) - { - dst->tv_sec ++; - dst->tv_usec -= 1000000; - } - } -} - -__inline void GetTimeRDTSC(struct timeval *dst, struct time_conv *data) -{ - - ULONGLONG tmp; - __asm - { - push eax - push edx - push ecx - rdtsc - lea ecx, tmp - mov [ecx+4], edx - mov [ecx], eax - pop ecx - pop edx - pop eax - } - - if (data->reference==0) - { - return; - } - dst->tv_sec=(LONG)(tmp/data->reference); - - dst->tv_usec=(LONG)((tmp-dst->tv_sec*data->reference)*1000000/data->reference); - - dst->tv_sec+=data->start[0].tv_sec; - - dst->tv_usec+=data->start[0].tv_usec; - - if (dst->tv_usec>=1000000) - { - dst->tv_sec++; - dst->tv_usec-=1000000; - } - - -} - -__inline void GetTimeQST(struct timeval *dst, struct time_conv *data) -{ - LARGE_INTEGER SystemTime; - - KeQuerySystemTime(&SystemTime); - - dst->tv_sec = (LONG)(SystemTime.QuadPart/10000000-11644473600); - dst->tv_usec = (LONG)((SystemTime.QuadPart%10000000)/10); - -} - -#pragma optimize ("g",on) //Due to some weird behaviour of the optimizer of DDK build 2600 - - -__inline void GET_TIME(struct timeval *dst, struct time_conv *data) -{ - return; - if ( TimestampMode == TIMESTAMPMODE_RDTSC ) - { - GetTimeRDTSC(dst,data); - } - else - if ( TimestampMode == TIMESTAMPMODE_QUERYSYSTEMTIME ) - { - GetTimeQST(dst,data); - } - else - { - GetTimeKQPC(dst,data); - } -} - - -#else /*WIN_NT_DRIVER*/ - -__inline void FORCE_TIME(struct timeval *src, struct time_conv *dest) -{ - dest->start[0]=*src; -} - -__inline void GET_TIME(struct timeval *dst, struct time_conv *data) -{ - return; - *dst=data->start[0]; -} - -#endif /*WIN_NT_DRIVER*/ - - -#endif /*_time_calls*/ +/* + * Copyright (c) 2001 + * Politecnico di Torino. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that: (1) source code distributions + * retain the above copyright notice and this paragraph in its entirety, (2) + * distributions including binary code include the above copyright notice and + * this paragraph in its entirety in the documentation or other materials + * provided with the distribution, and (3) all advertising materials mentioning + * features or use of this software display the following acknowledgement: + * ``This product includes software developed by the Politecnico + * di Torino, and its contributors.'' Neither the name of + * the University nor the names of its contributors may be used to endorse + * or promote products derived from this software without specific prior + * written permission. + * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + */ + +#ifndef _time_calls +#define _time_calls + +#ifdef WIN_NT_DRIVER + +#include "debug.h" +#include "ndis.h" + +#define DEFAULT_TIMESTAMPMODE 0 + +#define TIMESTAMPMODE_SINGLE_SYNCHRONIZATION 0 +#define TIMESTAMPMODE_SYNCHRONIZATION_ON_CPU_WITH_FIXUP 1 +#define TIMESTAMPMODE_QUERYSYSTEMTIME 2 +#define TIMESTAMPMODE_RDTSC 3 + +#define TIMESTAMPMODE_SYNCHRONIZATION_ON_CPU_NO_FIXUP 99 + +#define TIMESTAMPMODE_REGKEY L"TimestampMode" + +extern ULONG TimestampMode; + +/*! + \brief A microsecond precise timestamp. + + included in the sf_pkthdr or the bpf_hdr that NPF associates with every packet. +*/ + +struct timeval { + long tv_sec; ///< seconds + long tv_usec; ///< microseconds +}; + +#endif /*WIN_NT_DRIVER*/ + +struct time_conv +{ + ULONGLONG reference; + struct timeval start[32]; +}; + +#ifdef WIN_NT_DRIVER + +__inline void TIME_DESYNCHRONIZE(struct time_conv *data) +{ + data->reference = 0; +// data->start.tv_sec = 0; +// data->start.tv_usec = 0; +} + + +__inline void ReadTimeStampModeFromRegistry(PUNICODE_STRING RegistryPath) +{ + ULONG NewLength; + PWSTR NullTerminatedString; + RTL_QUERY_REGISTRY_TABLE Queries[2]; + ULONG DefaultTimestampMode = DEFAULT_TIMESTAMPMODE; + + NewLength = RegistryPath->Length/2; + + NullTerminatedString = ExAllocatePool(PagedPool, (NewLength+1) *sizeof(WCHAR)); + + if (NullTerminatedString != NULL) + { + RtlCopyMemory(NullTerminatedString, RegistryPath->Buffer, RegistryPath->Length); + + NullTerminatedString[NewLength]=0; + + RtlZeroMemory(Queries, sizeof(Queries)); + + Queries[0].Flags = RTL_QUERY_REGISTRY_DIRECT; + Queries[0].Name = TIMESTAMPMODE_REGKEY; + Queries[0].EntryContext = &TimestampMode; + Queries[0].DefaultType = REG_DWORD; + Queries[0].DefaultData = &DefaultTimestampMode; + Queries[0].DefaultLength = sizeof(ULONG); + + if (RtlQueryRegistryValues(RTL_REGISTRY_ABSOLUTE, NullTerminatedString, Queries, NULL, NULL) != STATUS_SUCCESS) + { + TimestampMode = DEFAULT_TIMESTAMPMODE; + } + + RtlWriteRegistryValue( RTL_REGISTRY_ABSOLUTE, NullTerminatedString, TIMESTAMPMODE_REGKEY, REG_DWORD, &TimestampMode,sizeof(ULONG)); + ExFreePool(NullTerminatedString); + } + else + TimestampMode = DEFAULT_TIMESTAMPMODE; +} + +#pragma optimize ("g",off) //Due to some weird behaviour of the optimizer of DDK build 2600 + +/* KeQueryPerformanceCounter TimeStamps */ +__inline void SynchronizeOnCpu(struct timeval *start) +{ +// struct timeval *start = (struct timeval*)Data; + + struct timeval tmp; + LARGE_INTEGER SystemTime; + LARGE_INTEGER i; + ULONG tmp2; + LARGE_INTEGER TimeFreq,PTime; + + // get the absolute value of the system boot time. + + PTime = KeQueryPerformanceCounter(&TimeFreq); + KeQuerySystemTime(&SystemTime); + + start->tv_sec = (LONG)(SystemTime.QuadPart/10000000-11644473600); + + start->tv_usec = (LONG)((SystemTime.QuadPart%10000000)/10); + + start->tv_sec -= (ULONG)(PTime.QuadPart/TimeFreq.QuadPart); + + start->tv_usec -= (LONG)((PTime.QuadPart%TimeFreq.QuadPart)*1000000/TimeFreq.QuadPart); + + if (start->tv_usec < 0) + { + start->tv_sec --; + start->tv_usec += 1000000; + } +} + +/*RDTSC timestamps */ +/* callers must be at IRQL=PASSIVE_LEVEL*/ +__inline VOID TimeSynchronizeRDTSC(struct time_conv *data) +{ + struct timeval tmp; + LARGE_INTEGER system_time; + ULONGLONG curr_ticks; + KIRQL old; + LARGE_INTEGER start_kqpc,stop_kqpc,start_freq,stop_freq; + ULONGLONG start_ticks,stop_ticks; + ULONGLONG delta,delta2; + KEVENT event; + LARGE_INTEGER i; + ULONGLONG reference; + + if (data->reference!=0) + return; + + KeInitializeEvent(&event,NotificationEvent,FALSE); + + i.QuadPart=-3500000; + + KeRaiseIrql(HIGH_LEVEL,&old); + start_kqpc=KeQueryPerformanceCounter(&start_freq); + __asm + { + push eax + push edx + push ecx + rdtsc + lea ecx, start_ticks + mov [ecx+4], edx + mov [ecx], eax + pop ecx + pop edx + pop eax + } + + KeLowerIrql(old); + + KeWaitForSingleObject(&event,UserRequest,KernelMode,TRUE ,&i); + + KeRaiseIrql(HIGH_LEVEL,&old); + stop_kqpc=KeQueryPerformanceCounter(&stop_freq); + __asm + { + push eax + push edx + push ecx + rdtsc + lea ecx, stop_ticks + mov [ecx+4], edx + mov [ecx], eax + pop ecx + pop edx + pop eax + } + KeLowerIrql(old); + + delta=stop_ticks-start_ticks; + delta2=stop_kqpc.QuadPart-start_kqpc.QuadPart; + if (delta>10000000000) + { + delta/=16; + delta2/=16; + } + + reference=delta*(start_freq.QuadPart)/delta2; + + data->reference=reference/1000; + + if (reference%1000>500) + data->reference++; + + data->reference*=1000; + + reference=data->reference; + + KeQuerySystemTime(&system_time); + + __asm + { + push eax + push edx + push ecx + rdtsc + lea ecx, curr_ticks + mov [ecx+4], edx + mov [ecx], eax + pop ecx + pop edx + pop eax + } + + tmp.tv_sec=-(LONG)(curr_ticks/reference); + + tmp.tv_usec=-(LONG)((curr_ticks%reference)*1000000/reference); + + system_time.QuadPart-=116444736000000000; + + tmp.tv_sec+=(LONG)(system_time.QuadPart/10000000); + tmp.tv_usec+=(LONG)((system_time.QuadPart%10000000)/10); + + if (tmp.tv_usec<0) + { + tmp.tv_sec--; + tmp.tv_usec+=1000000; + } + + data->start[0] = tmp; + + IF_LOUD(DbgPrint("Frequency %I64u MHz\n",data->reference);) +} + +#pragma optimize ("g",on) //Due to some weird behaviour of the optimizer of DDK build 2600 + +__inline VOID TIME_SYNCHRONIZE(struct time_conv *data) +{ + ULONG NumberOfCpus, i; + KAFFINITY AffinityMask; + + if (data->reference != 0) + return; + + NumberOfCpus = NdisSystemProcessorCount(); + + if ( TimestampMode == TIMESTAMPMODE_SYNCHRONIZATION_ON_CPU_WITH_FIXUP || TimestampMode == TIMESTAMPMODE_SYNCHRONIZATION_ON_CPU_NO_FIXUP) + { + for (i = 0 ; i < NumberOfCpus ; i++ ) + { + AffinityMask = (1 << i); + ZwSetInformationThread(NtCurrentThread(), ThreadAffinityMask, &AffinityMask, sizeof(KAFFINITY)); + SynchronizeOnCpu(&(data->start[i])); + } + AffinityMask = 0xFFFFFFFF; + ZwSetInformationThread(NtCurrentThread(), ThreadAffinityMask, &AffinityMask, sizeof(KAFFINITY)); + data->reference = 1; + } + else + if ( TimestampMode == TIMESTAMPMODE_QUERYSYSTEMTIME ) + { + //do nothing + data->reference = 1; + } + else + if ( TimestampMode == TIMESTAMPMODE_RDTSC ) + { + TimeSynchronizeRDTSC(data); + } + else + { //it should be only the normal case i.e. TIMESTAMPMODE_SINGLESYNCHRONIZATION + SynchronizeOnCpu(data->start); + data->reference = 1; + } + return; +} + + +#pragma optimize ("g",off) //Due to some weird behaviour of the optimizer of DDK build 2600 + +__inline void GetTimeKQPC(struct timeval *dst, struct time_conv *data) +{ + LARGE_INTEGER PTime, TimeFreq; + LONG tmp; + ULONG CurrentCpu; + static struct timeval old_ts={0,0}; + + + PTime = KeQueryPerformanceCounter(&TimeFreq); + tmp = (LONG)(PTime.QuadPart/TimeFreq.QuadPart); + + if (TimestampMode == TIMESTAMPMODE_SYNCHRONIZATION_ON_CPU_WITH_FIXUP || TimestampMode == TIMESTAMPMODE_SYNCHRONIZATION_ON_CPU_NO_FIXUP) + { + //actually this code is ok only if we are guaranteed that no thread scheduling will take place. + CurrentCpu = KeGetCurrentProcessorNumber(); + + dst->tv_sec = data->start[CurrentCpu].tv_sec + tmp; + dst->tv_usec = data->start[CurrentCpu].tv_usec + (LONG)((PTime.QuadPart%TimeFreq.QuadPart)*1000000/TimeFreq.QuadPart); + + if (dst->tv_usec >= 1000000) + { + dst->tv_sec ++; + dst->tv_usec -= 1000000; + } + + if (TimestampMode == TIMESTAMPMODE_SYNCHRONIZATION_ON_CPU_WITH_FIXUP) + { + if (old_ts.tv_sec > dst->tv_sec || (old_ts.tv_sec == dst->tv_sec && old_ts.tv_usec > dst->tv_usec) ) + *dst = old_ts; + + else + old_ts = *dst; + } + } + else + { //it should be only the normal case i.e. TIMESTAMPMODE_SINGLESYNCHRONIZATION + dst->tv_sec = data->start[0].tv_sec + tmp; + dst->tv_usec = data->start[0].tv_usec + (LONG)((PTime.QuadPart%TimeFreq.QuadPart)*1000000/TimeFreq.QuadPart); + + if (dst->tv_usec >= 1000000) + { + dst->tv_sec ++; + dst->tv_usec -= 1000000; + } + } +} + +__inline void GetTimeRDTSC(struct timeval *dst, struct time_conv *data) +{ + + ULONGLONG tmp; + __asm + { + push eax + push edx + push ecx + rdtsc + lea ecx, tmp + mov [ecx+4], edx + mov [ecx], eax + pop ecx + pop edx + pop eax + } + + if (data->reference==0) + { + return; + } + dst->tv_sec=(LONG)(tmp/data->reference); + + dst->tv_usec=(LONG)((tmp-dst->tv_sec*data->reference)*1000000/data->reference); + + dst->tv_sec+=data->start[0].tv_sec; + + dst->tv_usec+=data->start[0].tv_usec; + + if (dst->tv_usec>=1000000) + { + dst->tv_sec++; + dst->tv_usec-=1000000; + } + + +} + +__inline void GetTimeQST(struct timeval *dst, struct time_conv *data) +{ + LARGE_INTEGER SystemTime; + + KeQuerySystemTime(&SystemTime); + + dst->tv_sec = (LONG)(SystemTime.QuadPart/10000000-11644473600); + dst->tv_usec = (LONG)((SystemTime.QuadPart%10000000)/10); + +} + +#pragma optimize ("g",on) //Due to some weird behaviour of the optimizer of DDK build 2600 + + +__inline void GET_TIME(struct timeval *dst, struct time_conv *data) +{ + return; + if ( TimestampMode == TIMESTAMPMODE_RDTSC ) + { + GetTimeRDTSC(dst,data); + } + else + if ( TimestampMode == TIMESTAMPMODE_QUERYSYSTEMTIME ) + { + GetTimeQST(dst,data); + } + else + { + GetTimeKQPC(dst,data); + } +} + + +#else /*WIN_NT_DRIVER*/ + +__inline void FORCE_TIME(struct timeval *src, struct time_conv *dest) +{ + dest->start[0]=*src; +} + +__inline void GET_TIME(struct timeval *dst, struct time_conv *data) +{ + return; + *dst=data->start[0]; +} + +#endif /*WIN_NT_DRIVER*/ + + +#endif /*_time_calls*/ diff --git a/src/Cedar/winpcap/tme.h b/src/Cedar/winpcap/tme.h index eb8d4b12..6b3b6734 100644 --- a/src/Cedar/winpcap/tme.h +++ b/src/Cedar/winpcap/tme.h @@ -1,174 +1,174 @@ -/* - * Copyright (c) 2001 - 2003 - * NetGroup, Politecnico di Torino (Italy) - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the Politecnico di Torino nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - */ - -#ifndef __tme_include_ -#define __tme_include_ - -#ifdef WIN_NT_DRIVER -#include "ndis.h" -#else -#include -#endif /*WIN_NT_DRIVER*/ - -#include "memory_t.h" -#include "time_calls.h" - - -/* error codes */ -#define TME_ERROR 0 -#define TME_SUCCESS 1 -#define TME_TRUE 2 -#define TME_FALSE 3 - -/* some constants */ -#define DEFAULT_MEM_EX_SIZE 65536 -#define MAX_TME_DATA_BLOCKS 4 -#define TME_NONE_ACTIVE 0xffffffff -#define DELTA_READ 2 /* secs */ - -#define TME_LUT_ENTRIES 0x00000000 -#define TME_MAX_FILL_STATE 0x00000001 /*potrebbe servire per un thread a passive level!?!?! */ -#define TME_REHASHING_VALUE 0x00000002 -#define TME_KEY_LEN 0x00000003 -#define TME_SHARED_MEMORY_BLOCKS 0x00000004 -#define TME_FILLED_ENTRIES 0x00000005 -#define TME_BLOCK_SIZE 0x00000006 -#define TME_EXTRA_SEGMENT_SIZE 0x00000007 -#define TME_LOOKUP_CODE 0x00000008 -#define TME_OUT_LUT_EXEC 0x00000009 -#define TME_FILLED_BLOCKS 0x0000000a -#define TME_DEFAULT_EXEC 0x0000000b -#define TME_LUT_BASE_ADDRESS 0x0000000c -#define TME_SHARED_MEMORY_BASE_ADDRESS 0x0000000d -#define TME_EXTRA_SEGMENT_BASE_ADDRESS 0x0000000e -#define TME_LAST_FOUND 0x0000000f /* contains the offset of the last found entry */ -#define TME_LAST_FOUND_BLOCK 0x00000010 -/* TME default values */ -#define TME_LUT_ENTRIES_DEFAULT 32007 -#define TME_REHASHING_VALUE_DEFAULT 1 -#define TME_SHARED_MEMORY_BLOCKS_DEFAULT 16000 -#define TME_BLOCK_SIZE_DEFAULT 64 -#define TME_EXTRA_SEGMENT_SIZE_DEFAULT 0 -#define TME_LOOKUP_CODE_DEFAULT 0 -#define TME_OUT_LUT_EXEC_DEFAULT 0 -#define TME_DEFAULT_EXEC_DEFAULT 0 -#define TME_MAX_FILL_STATE_DEFAULT 15000 - -#define IS_VALIDATED(src,index) (src&(1<tv_sec=0x7fffffff; - -/* TME callback prototypes */ -typedef uint32 (*lut_fcn)(uint8 *key, struct __TME_DATA *data,MEM_TYPE *mem_ex, struct time_conv *time_ref ); -typedef uint32 (*exec_fcn)(uint8 *block, uint32 pkt_size, struct __TME_DATA *data, MEM_TYPE *mem_ex, uint8 *mem_data); - -/* DO NOT MODIFY THIS STRUCTURE!!!! GV */ -typedef struct __RECORD - -{ - uint32 block; - uint32 exec_fcn; -} - RECORD, *PRECORD; - -/* TME data registers */ -struct __TME_DATA -{ - uint32 lut_entries; - uint32 max_fill_state; - uint32 rehashing_value; - uint32 key_len; - uint32 shared_memory_blocks; - uint32 filled_entries; - uint32 block_size; - uint32 extra_segment_size; - uint32 filled_blocks; - lut_fcn lookup_code; - uint32 default_exec; - uint32 out_lut_exec; - uint8 *lut_base_address; - uint8 *shared_memory_base_address; - uint8 *extra_segment_base_address; - struct timeval last_read; - uint32 enable_deletion; - uint8 *last_found; -}; - -typedef struct __TME_DATA TME_DATA,*PTME_DATA; - - - -/* TME core */ -typedef struct __TME_CORE -{ - uint32 working; - uint32 active; - uint32 validated_blocks; - TME_DATA block_data[MAX_TME_DATA_BLOCKS]; - uint32 active_read; - -} TME_CORE, *PTME_CORE; - -static __inline int32 IS_DELETABLE(void *timestamp, TME_DATA *data) -{ - struct timeval *ts=(struct timeval*)timestamp; - - if (data->enable_deletion==FALSE) - return FALSE; - if (data->filled_entriesmax_fill_state) - return FALSE; - if ((ts->tv_sec+DELTA_READ)last_read.tv_sec) - return TRUE; - return FALSE; -} - -/* functions to manage TME */ -uint32 init_tme_block(TME_CORE *tme, uint32 block); -uint32 validate_tme_block(MEM_TYPE *mem_ex, TME_CORE *tme, uint32 block, uint32 mem_ex_offset); -uint32 lookup_frontend(MEM_TYPE *mem_ex, TME_CORE *tme,uint32 mem_ex_offset, struct time_conv *time_ref); -uint32 execute_frontend(MEM_TYPE *mem_ex, TME_CORE *tme, uint32 pkt_size,uint32 offset); -uint32 set_active_tme_block(TME_CORE *tme, uint32 block); -uint32 init_extended_memory(uint32 size, MEM_TYPE *mem_ex); -uint32 reset_tme(TME_CORE *tme); -uint32 get_tme_block_register(TME_DATA *data,MEM_TYPE *mem_ex,uint32 rgstr,uint32 *rval); -uint32 set_tme_block_register(TME_DATA *data,MEM_TYPE *mem_ex,uint32 rgstr,uint32 value, int32 init); -uint32 set_active_read_tme_block(TME_CORE *tme, uint32 block); -uint32 set_autodeletion(TME_DATA *data, uint32 value); - -/* function mappers */ -lut_fcn lut_fcn_mapper(uint32 index); -exec_fcn exec_fcn_mapper(uint32 index); - -#endif +/* + * Copyright (c) 2001 - 2003 + * NetGroup, Politecnico di Torino (Italy) + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the Politecnico di Torino nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#ifndef __tme_include_ +#define __tme_include_ + +#ifdef WIN_NT_DRIVER +#include "ndis.h" +#else +#include +#endif /*WIN_NT_DRIVER*/ + +#include "memory_t.h" +#include "time_calls.h" + + +/* error codes */ +#define TME_ERROR 0 +#define TME_SUCCESS 1 +#define TME_TRUE 2 +#define TME_FALSE 3 + +/* some constants */ +#define DEFAULT_MEM_EX_SIZE 65536 +#define MAX_TME_DATA_BLOCKS 4 +#define TME_NONE_ACTIVE 0xffffffff +#define DELTA_READ 2 /* secs */ + +#define TME_LUT_ENTRIES 0x00000000 +#define TME_MAX_FILL_STATE 0x00000001 /*potrebbe servire per un thread a passive level!?!?! */ +#define TME_REHASHING_VALUE 0x00000002 +#define TME_KEY_LEN 0x00000003 +#define TME_SHARED_MEMORY_BLOCKS 0x00000004 +#define TME_FILLED_ENTRIES 0x00000005 +#define TME_BLOCK_SIZE 0x00000006 +#define TME_EXTRA_SEGMENT_SIZE 0x00000007 +#define TME_LOOKUP_CODE 0x00000008 +#define TME_OUT_LUT_EXEC 0x00000009 +#define TME_FILLED_BLOCKS 0x0000000a +#define TME_DEFAULT_EXEC 0x0000000b +#define TME_LUT_BASE_ADDRESS 0x0000000c +#define TME_SHARED_MEMORY_BASE_ADDRESS 0x0000000d +#define TME_EXTRA_SEGMENT_BASE_ADDRESS 0x0000000e +#define TME_LAST_FOUND 0x0000000f /* contains the offset of the last found entry */ +#define TME_LAST_FOUND_BLOCK 0x00000010 +/* TME default values */ +#define TME_LUT_ENTRIES_DEFAULT 32007 +#define TME_REHASHING_VALUE_DEFAULT 1 +#define TME_SHARED_MEMORY_BLOCKS_DEFAULT 16000 +#define TME_BLOCK_SIZE_DEFAULT 64 +#define TME_EXTRA_SEGMENT_SIZE_DEFAULT 0 +#define TME_LOOKUP_CODE_DEFAULT 0 +#define TME_OUT_LUT_EXEC_DEFAULT 0 +#define TME_DEFAULT_EXEC_DEFAULT 0 +#define TME_MAX_FILL_STATE_DEFAULT 15000 + +#define IS_VALIDATED(src,index) (src&(1<tv_sec=0x7fffffff; + +/* TME callback prototypes */ +typedef uint32 (*lut_fcn)(uint8 *key, struct __TME_DATA *data,MEM_TYPE *mem_ex, struct time_conv *time_ref ); +typedef uint32 (*exec_fcn)(uint8 *block, uint32 pkt_size, struct __TME_DATA *data, MEM_TYPE *mem_ex, uint8 *mem_data); + +/* DO NOT MODIFY THIS STRUCTURE!!!! GV */ +typedef struct __RECORD + +{ + uint32 block; + uint32 exec_fcn; +} + RECORD, *PRECORD; + +/* TME data registers */ +struct __TME_DATA +{ + uint32 lut_entries; + uint32 max_fill_state; + uint32 rehashing_value; + uint32 key_len; + uint32 shared_memory_blocks; + uint32 filled_entries; + uint32 block_size; + uint32 extra_segment_size; + uint32 filled_blocks; + lut_fcn lookup_code; + uint32 default_exec; + uint32 out_lut_exec; + uint8 *lut_base_address; + uint8 *shared_memory_base_address; + uint8 *extra_segment_base_address; + struct timeval last_read; + uint32 enable_deletion; + uint8 *last_found; +}; + +typedef struct __TME_DATA TME_DATA,*PTME_DATA; + + + +/* TME core */ +typedef struct __TME_CORE +{ + uint32 working; + uint32 active; + uint32 validated_blocks; + TME_DATA block_data[MAX_TME_DATA_BLOCKS]; + uint32 active_read; + +} TME_CORE, *PTME_CORE; + +static __inline int32 IS_DELETABLE(void *timestamp, TME_DATA *data) +{ + struct timeval *ts=(struct timeval*)timestamp; + + if (data->enable_deletion==FALSE) + return FALSE; + if (data->filled_entriesmax_fill_state) + return FALSE; + if ((ts->tv_sec+DELTA_READ)last_read.tv_sec) + return TRUE; + return FALSE; +} + +/* functions to manage TME */ +uint32 init_tme_block(TME_CORE *tme, uint32 block); +uint32 validate_tme_block(MEM_TYPE *mem_ex, TME_CORE *tme, uint32 block, uint32 mem_ex_offset); +uint32 lookup_frontend(MEM_TYPE *mem_ex, TME_CORE *tme,uint32 mem_ex_offset, struct time_conv *time_ref); +uint32 execute_frontend(MEM_TYPE *mem_ex, TME_CORE *tme, uint32 pkt_size,uint32 offset); +uint32 set_active_tme_block(TME_CORE *tme, uint32 block); +uint32 init_extended_memory(uint32 size, MEM_TYPE *mem_ex); +uint32 reset_tme(TME_CORE *tme); +uint32 get_tme_block_register(TME_DATA *data,MEM_TYPE *mem_ex,uint32 rgstr,uint32 *rval); +uint32 set_tme_block_register(TME_DATA *data,MEM_TYPE *mem_ex,uint32 rgstr,uint32 value, int32 init); +uint32 set_active_read_tme_block(TME_CORE *tme, uint32 block); +uint32 set_autodeletion(TME_DATA *data, uint32 value); + +/* function mappers */ +lut_fcn lut_fcn_mapper(uint32 index); +exec_fcn exec_fcn_mapper(uint32 index); + +#endif diff --git a/src/GlobalConst.h b/src/GlobalConst.h index b7662d3b..41f54469 100644 --- a/src/GlobalConst.h +++ b/src/GlobalConst.h @@ -1,70 +1,70 @@ -// SoftEther VPN Source Code - Developer Edition Master Branch -// Global Constants Header - -#pragma warning(disable : 4819) - -#ifndef GLOBAL_CONST_H -#define GLOBAL_CONST_H - -//// Brand -// (Define it if building SoftEther VPN Project.) -#define GC_SOFTETHER_VPN -#define GC_SOFTETHER_OSS - -//// Basic Variables - -#define CEDAR_PRODUCT_STR "SoftEther" -#define CEDAR_PRODUCT_STR_W L"SoftEther" -#define CEDAR_SERVER_STR "SoftEther VPN Server Developer Edition" -#define CEDAR_BRIDGE_STR "SoftEther VPN Bridge Developer Edition" -#define CEDAR_BETA_SERVER "SoftEther VPN Server Pre Release Developer Edition" -#define CEDAR_MANAGER_STR "SoftEther VPN Server Manager Developer Edition" -#define CEDAR_CUI_STR "SoftEther VPN Command-Line Admin Tool" -#define CEDAR_ELOG "SoftEther EtherLogger Developer Edition" -#define CEDAR_CLIENT_STR "SoftEther VPN Client Developer Edition" -#define CEDAR_CLIENT_MANAGER_STR "SoftEther VPN Client Connection Manager Developer Edition" -#define CEDAR_ROUTER_STR "SoftEther VPN User-mode Router Developer Edition" -#define CEDAR_SERVER_LINK_STR "SoftEther VPN Server Developer Edition (Cascade Mode)" -#define CEDAR_BRIDGE_LINK_STR "SoftEther VPN Bridge Developer Edition (Cascade Mode)" -#define CEDAR_SERVER_FARM_STR "SoftEther VPN Server Developer Edition (Cluster RPC Mode)" - - - -//// Default Port Number - -#define GC_DEFAULT_PORT 5555 -#define GC_CLIENT_CONFIG_PORT 9931 -#define GC_CLIENT_NOTIFY_PORT 9984 - - -//// Software Name - -#define GC_SVC_NAME_VPNSERVER "SEVPNSERVERDEV" -#define GC_SVC_NAME_VPNCLIENT "SEVPNCLIENTDEV" -#define GC_SVC_NAME_VPNBRIDGE "SEVPNBRIDGEDEV" - - - -//// Registry - -#define GC_REG_COMPANY_NAME "SoftEther VPN Developer Edition" - - - - -//// Setup Wizard - -#define GC_SW_UIHELPER_REGVALUE "SoftEther VPN Client UI Helper Developer Edition" -#define GC_SW_SOFTETHER_PREFIX "sedev" -#define GC_SW_SOFTETHER_PREFIX_W L"sedev" - - - -//// VPN UI Components - -#define GC_UI_APPID_CM L"SoftEther.SoftEther VPN Client Developer Edition" - - - -#endif // GLOBAL_CONST_H - +// SoftEther VPN Source Code - Developer Edition Master Branch +// Global Constants Header + +#pragma warning(disable : 4819) + +#ifndef GLOBAL_CONST_H +#define GLOBAL_CONST_H + +//// Brand +// (Define it if building SoftEther VPN Project.) +#define GC_SOFTETHER_VPN +#define GC_SOFTETHER_OSS + +//// Basic Variables + +#define CEDAR_PRODUCT_STR "SoftEther" +#define CEDAR_PRODUCT_STR_W L"SoftEther" +#define CEDAR_SERVER_STR "SoftEther VPN Server Developer Edition" +#define CEDAR_BRIDGE_STR "SoftEther VPN Bridge Developer Edition" +#define CEDAR_BETA_SERVER "SoftEther VPN Server Pre Release Developer Edition" +#define CEDAR_MANAGER_STR "SoftEther VPN Server Manager Developer Edition" +#define CEDAR_CUI_STR "SoftEther VPN Command-Line Admin Tool" +#define CEDAR_ELOG "SoftEther EtherLogger Developer Edition" +#define CEDAR_CLIENT_STR "SoftEther VPN Client Developer Edition" +#define CEDAR_CLIENT_MANAGER_STR "SoftEther VPN Client Connection Manager Developer Edition" +#define CEDAR_ROUTER_STR "SoftEther VPN User-mode Router Developer Edition" +#define CEDAR_SERVER_LINK_STR "SoftEther VPN Server Developer Edition (Cascade Mode)" +#define CEDAR_BRIDGE_LINK_STR "SoftEther VPN Bridge Developer Edition (Cascade Mode)" +#define CEDAR_SERVER_FARM_STR "SoftEther VPN Server Developer Edition (Cluster RPC Mode)" + + + +//// Default Port Number + +#define GC_DEFAULT_PORT 5555 +#define GC_CLIENT_CONFIG_PORT 9931 +#define GC_CLIENT_NOTIFY_PORT 9984 + + +//// Software Name + +#define GC_SVC_NAME_VPNSERVER "SEVPNSERVERDEV" +#define GC_SVC_NAME_VPNCLIENT "SEVPNCLIENTDEV" +#define GC_SVC_NAME_VPNBRIDGE "SEVPNBRIDGEDEV" + + + +//// Registry + +#define GC_REG_COMPANY_NAME "SoftEther VPN Developer Edition" + + + + +//// Setup Wizard + +#define GC_SW_UIHELPER_REGVALUE "SoftEther VPN Client UI Helper Developer Edition" +#define GC_SW_SOFTETHER_PREFIX "sedev" +#define GC_SW_SOFTETHER_PREFIX_W L"sedev" + + + +//// VPN UI Components + +#define GC_UI_APPID_CM L"SoftEther.SoftEther VPN Client Developer Edition" + + + +#endif // GLOBAL_CONST_H + diff --git a/src/Mayaqua/Cfg.c b/src/Mayaqua/Cfg.c index daa9ba66..bf7e9cfb 100644 --- a/src/Mayaqua/Cfg.c +++ b/src/Mayaqua/Cfg.c @@ -1,2250 +1,2250 @@ -// SoftEther VPN Source Code - Developer Edition Master Branch -// Mayaqua Kernel - - -// Cfg.c -// Configuration information manipulation module - -#include - -#define CFG_C - -#include -#include -#include -#include -#include -#include -#include -#include - -// Create a backup of the configuration file -void BackupCfgWEx(CFG_RW *rw, FOLDER *f, wchar_t *original, UINT revision_number) -{ - wchar_t dirname[MAX_PATH]; - wchar_t filename[MAX_PATH]; - wchar_t fullpath[MAX_PATH]; - wchar_t datestr[MAX_PATH]; - SYSTEMTIME st; - // Validate arguments - if (f == NULL || rw == NULL) - { - return; - } - - // Determine the directory name - UniFormat(dirname, sizeof(dirname), L"$backup.%s", original[0] == L'$' ? original + 1 : original); - - // Determine the file name - LocalTime(&st); - UniFormat(datestr, sizeof(datestr), L"%04u%02u%02u%02u_%s", - st.wYear, st.wMonth, st.wDay, st.wHour, original[0] == L'$' ? original + 1 : original); - - if (revision_number == INFINITE) - { - UniStrCpy(filename, sizeof(filename), datestr); - } - else - { - UniFormat(filename, sizeof(filename), L"%08u_%s", - revision_number, original[0] == L'$' ? original + 1 : original); - } - - // Don't save if the date and time has not been changed - if (UniStrCmpi(datestr, rw->LastSavedDateStr) == 0) - { - return; - } - - UniStrCpy(rw->LastSavedDateStr, sizeof(rw->LastSavedDateStr), datestr); - - // Check the existence of file name - if (IsFileExistsW(filename)) - { - return; - } - - // Create the directory - MakeDirW(dirname); - - // Save the file - UniFormat(fullpath, sizeof(fullpath), L"%s/%s", dirname, filename); - CfgSaveW(f, fullpath); -} - -// Close the configuration file R/W -void FreeCfgRw(CFG_RW *rw) -{ - // Validate arguments - if (rw == NULL) - { - return; - } - - if (rw->Io != NULL) - { - FileClose(rw->Io); - } - - DeleteLock(rw->lock); - Free(rw->FileNameW); - Free(rw->FileName); - Free(rw); -} - -// Writing to the configuration file -UINT SaveCfgRw(CFG_RW *rw, FOLDER *f) -{ - return SaveCfgRwEx(rw, f, INFINITE); -} -UINT SaveCfgRwEx(CFG_RW *rw, FOLDER *f, UINT revision_number) -{ - UINT ret = 0; - // Validate arguments - if (rw == NULL || f == NULL) - { - return 0; - } - - Lock(rw->lock); - { - if (rw->Io != NULL) - { - FileClose(rw->Io); - rw->Io = NULL; - } - - if (CfgSaveExW2(rw, f, rw->FileNameW, &ret)) - { - if (rw->DontBackup == false) - { - BackupCfgWEx(rw, f, rw->FileNameW, revision_number); - } - } - else - { - ret = 0; - } - - rw->Io = FileOpenW(rw->FileNameW, false); - } - Unlock(rw->lock); - - return ret; -} - -// Creating a configuration file R/W -CFG_RW *NewCfgRw(FOLDER **root, char *cfg_name) -{ - return NewCfgRwEx(root, cfg_name, false); -} -CFG_RW *NewCfgRwEx(FOLDER **root, char *cfg_name, bool dont_backup) -{ - wchar_t *cfg_name_w = CopyStrToUni(cfg_name); - CFG_RW *ret = NewCfgRwExW(root, cfg_name_w, dont_backup); - - Free(cfg_name_w); - - return ret; -} -CFG_RW *NewCfgRwExW(FOLDER **root, wchar_t *cfg_name, bool dont_backup) -{ - return NewCfgRwEx2W(root, cfg_name, dont_backup, NULL); -} -CFG_RW *NewCfgRwEx2A(FOLDER **root, char *cfg_name_a, bool dont_backup, char *template_name_a) -{ - CFG_RW *ret; - wchar_t *cfg_name_w = CopyStrToUni(cfg_name_a); - wchar_t *template_name_w = CopyStrToUni(template_name_a); - - ret = NewCfgRwEx2W(root, cfg_name_w, dont_backup, template_name_w); - - Free(cfg_name_w); - Free(template_name_w); - - return ret; -} -CFG_RW *NewCfgRwEx2W(FOLDER **root, wchar_t *cfg_name, bool dont_backup, wchar_t *template_name) -{ - CFG_RW *rw; - FOLDER *f; - bool loaded_from_template = false; - // Validate arguments - if (cfg_name == NULL || root == NULL) - { - return NULL; - } - - f = CfgReadW(cfg_name); - if (f == NULL) - { - // Load from template - if (UniIsEmptyStr(template_name) == false) - { - f = CfgReadW(template_name); - if (f != NULL) - { - loaded_from_template = true; - - goto LABEL_CONTINUE; - } - } - - rw = ZeroMalloc(sizeof(CFG_RW)); - rw->lock = NewLock(); - rw->FileNameW = CopyUniStr(cfg_name); - rw->FileName = CopyUniToStr(cfg_name); - rw->Io = FileCreateW(cfg_name); - *root = NULL; - rw->DontBackup = dont_backup; - - return rw; - } - -LABEL_CONTINUE: - rw = ZeroMalloc(sizeof(CFG_RW)); - rw->FileNameW = CopyUniStr(cfg_name); - rw->FileName = CopyUniToStr(cfg_name); - if (loaded_from_template == false) - { - rw->Io = FileOpenW(cfg_name, false); - } - else - { - rw->Io = FileCreateW(cfg_name); - } - rw->lock = NewLock(); - - *root = f; - - rw->DontBackup = dont_backup; - - return rw; -} - -// Copy a file -bool FileCopy(char *src, char *dst) -{ - BUF *b; - bool ret = false; - // Validate arguments - if (src == NULL || dst == NULL) - { - return false; - } - - b = ReadDump(src); - if (b == NULL) - { - return false; - } - - SeekBuf(b, 0, 0); - - ret = DumpBuf(b, dst); - - FreeBuf(b); - - return ret; -} -bool FileCopyW(wchar_t *src, wchar_t *dst) -{ - return FileCopyExW(src, dst, true); -} -bool FileCopyExW(wchar_t *src, wchar_t *dst, bool read_lock) -{ - BUF *b; - bool ret = false; - // Validate arguments - if (src == NULL || dst == NULL) - { - return false; - } - - b = ReadDumpExW(src, false); - if (b == NULL) - { - return false; - } - - SeekBuf(b, 0, 0); - - ret = DumpBufW(b, dst); - - FreeBuf(b); - - return ret; -} -bool FileCopyExWithEofW(wchar_t *src, wchar_t *dst, bool read_lock) -{ - BUF *b; - bool ret = false; - // Validate arguments - if (src == NULL || dst == NULL) - { - return false; - } - - b = ReadDumpExW(src, false); - if (b == NULL) - { - return false; - } - - SeekBuf(b, b->Size, 0); - - WriteBufChar(b, 0x1A); - - SeekBuf(b, 0, 0); - - ret = DumpBufW(b, dst); - - FreeBuf(b); - - return ret; -} - -// Save the settings to a file -void CfgSave(FOLDER *f, char *name) -{ - CfgSaveEx(NULL, f, name); -} -void CfgSaveW(FOLDER *f, wchar_t *name) -{ - CfgSaveExW(NULL, f, name); -} -bool CfgSaveEx(CFG_RW *rw, FOLDER *f, char *name) -{ - wchar_t *name_w = CopyStrToUni(name); - bool ret = CfgSaveExW(rw, f, name_w); - - Free(name_w); - - return ret; -} -bool CfgSaveExW(CFG_RW *rw, FOLDER *f, wchar_t *name) -{ - return CfgSaveExW2(rw, f, name, NULL); -} -bool CfgSaveExW2(CFG_RW *rw, FOLDER *f, wchar_t *name, UINT *written_size) -{ - return CfgSaveExW3(rw, f, name, written_size, IsFileExistsW(SAVE_BINARY_FILE_NAME_SWITCH)); -} -bool CfgSaveExW3(CFG_RW *rw, FOLDER *f, wchar_t *name, UINT *written_size, bool write_binary) -{ - wchar_t tmp[MAX_SIZE]; - bool text = !write_binary; - UCHAR hash[SHA1_SIZE]; - BUF *b; - IO *o; - bool ret = true; - UINT dummy_int = 0; - // Validate arguments - if (name == NULL || f == NULL) - { - return false; - } - if (written_size == NULL) - { - written_size = &dummy_int; - } - - // Convert to buffer - b = CfgFolderToBuf(f, text); - if (b == NULL) - { - return false; - } - // Hash the contents - Sha0(hash, b->Buf, b->Size); - - // Compare the contents to be written with the content which was written last - if (rw != NULL) - { - if (Cmp(hash, rw->LashHash, SHA1_SIZE) == 0) - { - // Contents are not changed - ret = false; - } - else - { - Copy(rw->LashHash, hash, SHA1_SIZE); - } - } - - if (ret || OS_IS_UNIX(GetOsInfo()->OsType)) - { - // Generate a temporary file name - UniFormat(tmp, sizeof(tmp), L"%s.log", name); - // Copy the file that currently exist to a temporary file - // with appending the EOF - FileCopyExWithEofW(name, tmp, true); - - // Save the new file - o = FileCreateW(name); - if (o != NULL) - { - if (FileWrite(o, b->Buf, b->Size) == false) - { - // File saving failure - FileClose(o); - FileDeleteW(name); - FileRenameW(tmp, name); - - if (rw != NULL) - { - Zero(rw->LashHash, sizeof(rw->LashHash)); - } - } - else - { - // Successful saving file - FileClose(o); - - // Delete the temporary file - FileDeleteW(tmp); - } - } - else - { - // File saving failure - FileRenameW(tmp, name); - - if (rw != NULL) - { - Zero(rw->LashHash, sizeof(rw->LashHash)); - } - } - } - - *written_size = b->Size; - - // Release memory - FreeBuf(b); - - return ret; -} - -// Read the settings from the file -FOLDER *CfgRead(char *name) -{ - wchar_t *name_w = CopyStrToUni(name); - FOLDER *ret = CfgReadW(name_w); - - Free(name_w); - - return ret; -} -FOLDER *CfgReadW(wchar_t *name) -{ - wchar_t tmp[MAX_SIZE]; - wchar_t newfile[MAX_SIZE]; - BUF *b; - IO *o; - UINT size; - void *buf; - FOLDER *f; - bool delete_new = false; - bool binary_file = false; - UCHAR header[8]; - bool has_eof = false; - // Validate arguments - if (name == NULL) - { - return NULL; - } - - // Generate a new file name - UniFormat(newfile, sizeof(newfile), L"%s.new", name); - // Generate a temporary file name - UniFormat(tmp, sizeof(tmp), L"%s.log", name); - - // Read the new file if it exists - o = FileOpenW(newfile, false); - if (o == NULL) - { - UINT size; - // Read the temporary file - o = FileOpenW(tmp, false); - - if (o != NULL) - { - // Check the EOF - size = FileSize(o); - if (size >= 2) - { - char c; - - if (FileSeek(o, FILE_BEGIN, size - 1) && FileRead(o, &c, 1) && c == 0x1A && FileSeek(o, FILE_BEGIN, 0)) - { - // EOF ok - has_eof = true; - } - else - { - // No EOF: file is corrupted - FileClose(o); - o = NULL; - } - } - } - } - else - { - delete_new = true; - } - if (o == NULL) - { - // Read the original file if there is no temporary file - o = FileOpenW(name, false); - } - else - { - // Read the original file too if the size of temporary file is 0 - if (FileSize(o) == 0) - { - FileClose(o); - o = FileOpenW(name, false); - } - } - if (o == NULL) - { - // Failed to read - return NULL; - } - - // Read into the buffer - size = FileSize(o); - if (has_eof) - { - // Ignore EOF - size -= 1; - } - buf = Malloc(size); - FileRead(o, buf, size); - b = NewBuf(); - WriteBuf(b, buf, size); - SeekBuf(b, 0, 0); - - // Close the file - FileClose(o); - - if (delete_new) - { - // Delete the new file - FileDeleteW(newfile); - } - - // If the beginning 8 character of the buffer is "SEVPN_DB", it is binary file - ReadBuf(b, header, sizeof(header)); - if (Cmp(header, TAG_BINARY, 8) == 0) - { - UCHAR hash1[SHA1_SIZE], hash2[SHA1_SIZE]; - binary_file = true; - - // Check the hash - ReadBuf(b, hash1, sizeof(hash1)); - - Sha0(hash2, ((UCHAR *)b->Buf) + 8 + SHA1_SIZE, b->Size - 8 - SHA1_SIZE); - - if (Cmp(hash1, hash2, SHA1_SIZE) != 0) - { - // Corrupted file - FreeBuf(b); - return NULL; - } - } - - SeekBuf(b, 0, 0); - - if (binary_file) - { - SeekBuf(b, 8 + SHA1_SIZE, 0); - } - - // Convert the buffer into a folder - if (binary_file == false) - { - // Text mode - f = CfgBufTextToFolder(b); - } - else - { - // Binary mode - f = CfgBufBinToFolder(b); - } - - // Memory release - Free(buf); - FreeBuf(b); - - FileDeleteW(newfile); - - return f; -} - -// Read one line -char *CfgReadNextLine(BUF *b) -{ - char *tmp; - char *buf; - UINT len; - // Validate arguments - if (b == NULL) - { - return NULL; - } - - // Examine the number of characters up to the next newline - tmp = (char *)b->Buf + b->Current; - if ((b->Size - b->Current) == 0) - { - // Read to the end - return NULL; - } - len = 0; - while (true) - { - if (tmp[len] == 13 || tmp[len] == 10) - { - if (tmp[len] == 13) - { - if (len < (b->Size - b->Current)) - { - len++; - } - } - break; - } - len++; - if (len >= (b->Size - b->Current)) - { - break; - } - } - - // Read ahead only 'len' bytes - buf = ZeroMalloc(len + 1); - ReadBuf(b, buf, len); - SeekBuf(b, 1, 1); - - if (StrLen(buf) >= 1) - { - if (buf[StrLen(buf) - 1] == 13) - { - buf[StrLen(buf) - 1] = 0; - } - } - - return buf; -} - -// Read the text stream -bool CfgReadNextTextBUF(BUF *b, FOLDER *current) -{ - char *buf; - TOKEN_LIST *token; - char *name; - char *string; - char *data; - bool ret; - FOLDER *f; - - // Validate arguments - if (b == NULL || current == NULL) - { - return false; - } - - ret = true; - - // Read one line - buf = CfgReadNextLine(b); - if (buf == NULL) - { - return false; - } - - // Analyze this line - token = ParseToken(buf, "\t "); - if (token == NULL) - { - Free(buf); - return false; - } - - if (token->NumTokens >= 1) - { - if (!StrCmpi(token->Token[0], TAG_DECLARE)) - { - if (token->NumTokens >= 2) - { - // declare - name = CfgUnescape(token->Token[1]); - - // Create a folder - f = CfgCreateFolder(current, name); - - // Read the next folder - while (true) - { - if (CfgReadNextTextBUF(b, f) == false) - { - break; - } - } - - Free(name); - } - } - if (!StrCmpi(token->Token[0], "}")) - { - // end - ret = false; - } - if (token->NumTokens >= 3) - { - name = CfgUnescape(token->Token[1]); - data = token->Token[2]; - - if (!StrCmpi(token->Token[0], TAG_STRING)) - { - // string - wchar_t *uni; - UINT uni_size; - string = CfgUnescape(data); - uni_size = CalcUtf8ToUni(string, StrLen(string)); - if (uni_size != 0) - { - uni = Malloc(uni_size); - Utf8ToUni(uni, uni_size, string, StrLen(string)); - CfgAddUniStr(current, name, uni); - Free(uni); - } - Free(string); - } - if (!StrCmpi(token->Token[0], TAG_INT)) - { - // uint - CfgAddInt(current, name, ToInt(data)); - } - if (!StrCmpi(token->Token[0], TAG_INT64)) - { - // uint64 - CfgAddInt64(current, name, ToInt64(data)); - } - if (!StrCmpi(token->Token[0], TAG_BOOL)) - { - // bool - bool b = false; - if (!StrCmpi(data, TAG_TRUE)) - { - b = true; - } - else if (ToInt(data) != 0) - { - b = true; - } - CfgAddBool(current, name, b); - } - if (!StrCmpi(token->Token[0], TAG_BYTE)) - { - // byte - char *unescaped_b64 = CfgUnescape(data); - void *tmp = Malloc(StrLen(unescaped_b64) * 4 + 64); - int size = B64_Decode(tmp, unescaped_b64, StrLen(unescaped_b64)); - CfgAddByte(current, name, tmp, size); - Free(tmp); - Free(unescaped_b64); - } - - Free(name); - } - } - - // Release of the token - FreeToken(token); - - Free(buf); - - return ret; -} - -// Convert the stream text to a folder -FOLDER *CfgBufTextToFolder(BUF *b) -{ - FOLDER *f, *c; - // Validate arguments - if (b == NULL) - { - return NULL; - } - - // Read recursively from the root folder - c = CfgCreateFolder(NULL, "tmp"); - - while (true) - { - // Read the text stream - if (CfgReadNextTextBUF(b, c) == false) - { - break; - } - } - - // Getting root folder - f = CfgGetFolder(c, TAG_ROOT); - if (f == NULL) - { - // Root folder is not found - CfgDeleteFolder(c); - return NULL; - } - - // Remove the reference from tmp folder to the root - Delete(c->Folders, f); - f->Parent = NULL; - - // Delete the tmp folder - CfgDeleteFolder(c); - - // Return the root folder - return f; -} - -// Read the next folder -void CfgReadNextFolderBin(BUF *b, FOLDER *parent) -{ - char name[MAX_SIZE]; - FOLDER *f; - UINT n, i; - UINT size; - UCHAR *buf; - wchar_t *string; - // Validate arguments - if (b == NULL || parent == NULL) - { - return; - } - - // Folder name - ReadBufStr(b, name, sizeof(name)); - f = CfgCreateFolder(parent, name); - - // The number of the subfolder - n = ReadBufInt(b); - for (i = 0;i < n;i++) - { - // Subfolder - CfgReadNextFolderBin(b, f); - } - - // The number of items - n = ReadBufInt(b); - for (i = 0;i < n;i++) - { - UINT type; - - // Name - ReadBufStr(b, name, sizeof(name)); - // Type - type = ReadBufInt(b); - - switch (type) - { - case ITEM_TYPE_INT: - // int - CfgAddInt(f, name, ReadBufInt(b)); - break; - - case ITEM_TYPE_INT64: - // int64 - CfgAddInt64(f, name, ReadBufInt64(b)); - break; - - case ITEM_TYPE_BYTE: - // data - size = ReadBufInt(b); - buf = ZeroMalloc(size); - ReadBuf(b, buf, size); - CfgAddByte(f, name, buf, size); - Free(buf); - break; - - case ITEM_TYPE_STRING: - // string - size = ReadBufInt(b); - buf = ZeroMalloc(size + 1); - ReadBuf(b, buf, size); - string = ZeroMalloc(CalcUtf8ToUni(buf, StrLen(buf)) + 4); - Utf8ToUni(string, 0, buf, StrLen(buf)); - CfgAddUniStr(f, name, string); - Free(string); - Free(buf); - break; - - case ITEM_TYPE_BOOL: - // bool - CfgAddBool(f, name, ReadBufInt(b) == 0 ? false : true); - break; - } - } -} - -// Convert the binary to folder -FOLDER *CfgBufBinToFolder(BUF *b) -{ - FOLDER *f, *c; - // Validate arguments - if (b == NULL) - { - return NULL; - } - - // Create a temporary folder - c = CfgCreateFolder(NULL, "tmp"); - - // Read a binary - CfgReadNextFolderBin(b, c); - - // Get root folder - f = CfgGetFolder(c, TAG_ROOT); - if (f == NULL) - { - // Missing - CfgDeleteFolder(c); - return NULL; - } - - Delete(c->Folders, f); - f->Parent = NULL; - - CfgDeleteFolder(c); - - return f; -} - -// Convert the folder to binary -BUF *CfgFolderToBufBin(FOLDER *f) -{ - BUF *b; - UCHAR hash[SHA1_SIZE]; - // Validate arguments - if (f == NULL) - { - return NULL; - } - - b = NewBuf(); - - // Header - WriteBuf(b, TAG_BINARY, 8); - - // Hash area - Zero(hash, sizeof(hash)); - WriteBuf(b, hash, sizeof(hash)); - - // Output the root folder (recursive) - CfgOutputFolderBin(b, f); - - // Hash - Sha0(((UCHAR *)b->Buf) + 8, ((UCHAR *)b->Buf) + 8 + SHA1_SIZE, b->Size - 8 - SHA1_SIZE); - - return b; -} - -// Convert the folder to a stream text -BUF *CfgFolderToBufTextEx(FOLDER *f, bool no_banner) -{ - BUF *b; - // Validate arguments - if (f == NULL) - { - return NULL; - } - - // Create a stream - b = NewBuf(); - - // Copyright notice - if (no_banner == false) - { - WriteBuf(b, TAG_CPYRIGHT, StrLen(TAG_CPYRIGHT)); - } - - // Output the root folder (recursive) - CfgOutputFolderText(b, f, 0); - - return b; -} - -// Output the folder contents (Enumerate folders) -bool CfgEnumFolderProc(FOLDER *f, void *param) -{ - CFG_ENUM_PARAM *p; - // Validate arguments - if (f == NULL || param == NULL) - { - return false; - } - - p = (CFG_ENUM_PARAM *)param; - // Output the folder contents (recursive) - CfgOutputFolderText(p->b, f, p->depth); - - return true; -} - -// Output the contents of the item (enumeration) -bool CfgEnumItemProc(ITEM *t, void *param) -{ - CFG_ENUM_PARAM *p; - // Validate arguments - if (t == NULL || param == NULL) - { - return false; - } - - p = (CFG_ENUM_PARAM *)param; - CfgAddItemText(p->b, t, p->depth); - - return true; -} - -// Output the folder contents (Recursive, binary) -void CfgOutputFolderBin(BUF *b, FOLDER *f) -{ - UINT i; - // Validate arguments - if (b == NULL || f == NULL) - { - return; - } - - // Folder name - WriteBufStr(b, f->Name); - - // The number of the subfolder - WriteBufInt(b, LIST_NUM(f->Folders)); - - // Subfolder - for (i = 0;i < LIST_NUM(f->Folders);i++) - { - FOLDER *sub = LIST_DATA(f->Folders, i); - CfgOutputFolderBin(b, sub); - - if ((i % 100) == 99) - { - YieldCpu(); - } - } - - // The number of Items - WriteBufInt(b, LIST_NUM(f->Items)); - - // Item - for (i = 0;i < LIST_NUM(f->Items);i++) - { - char *utf8; - UINT utf8_size; - ITEM *t = LIST_DATA(f->Items, i); - - // Item Name - WriteBufStr(b, t->Name); - - // Type - WriteBufInt(b, t->Type); - - switch (t->Type) - { - case ITEM_TYPE_INT: - // Integer - WriteBufInt(b, *((UINT *)t->Buf)); - break; - - case ITEM_TYPE_INT64: - // 64-bit integer - WriteBufInt64(b, *((UINT64 *)t->Buf)); - break; - - case ITEM_TYPE_BYTE: - // Data size - WriteBufInt(b, t->size); - // Data - WriteBuf(b, t->Buf, t->size); - break; - - case ITEM_TYPE_STRING: - // String - utf8_size = CalcUniToUtf8((wchar_t *)t->Buf) + 1; - utf8 = ZeroMalloc(utf8_size); - UniToUtf8(utf8, utf8_size, (wchar_t *)t->Buf); - WriteBufInt(b, StrLen(utf8)); - WriteBuf(b, utf8, StrLen(utf8)); - Free(utf8); - break; - - case ITEM_TYPE_BOOL: - // Boolean type - if (*((bool *)t->Buf) == false) - { - WriteBufInt(b, 0); - } - else - { - WriteBufInt(b, 1); - } - break; - } - } -} - -// Output the contents of the folder (Recursive, text) -void CfgOutputFolderText(BUF *b, FOLDER *f, UINT depth) -{ - CFG_ENUM_PARAM p; - // Validate arguments - if (b == NULL || f == NULL) - { - return; - } - - // Output starting of the folder - CfgAddDeclare(b, f->Name, depth); - depth++; - - Zero(&p, sizeof(CFG_ENUM_PARAM)); - p.depth = depth; - p.b = b; - p.f = f; - - // Enumerate the list of items - CfgEnumItem(f, CfgEnumItemProc, &p); - - if (LIST_NUM(f->Folders) != 0 && LIST_NUM(f->Items) != 0) - { - WriteBuf(b, "\r\n", 2); - } - - // Enumerate the folder list - CfgEnumFolder(f, CfgEnumFolderProc, &p); - // Output the end of the folder - depth--; - CfgAddEnd(b, depth); - - //WriteBuf(b, "\r\n", 2); -} - -// Output contents of the item -void CfgAddItemText(BUF *b, ITEM *t, UINT depth) -{ - char *data; - char *sub = NULL; - UINT len; - UINT size; - char *utf8; - UINT utf8_size; - wchar_t *string; - // Validate arguments - if (b == NULL || t == NULL) - { - return; - } - - // Process the data by its type - data = NULL; - switch (t->Type) - { - case ITEM_TYPE_INT: - data = Malloc(32); - ToStr(data, *((UINT *)t->Buf)); - break; - - case ITEM_TYPE_INT64: - data = Malloc(64); - ToStr64(data, *((UINT64 *)t->Buf)); - break; - - case ITEM_TYPE_BYTE: - data = ZeroMalloc(t->size * 4 + 32); - len = B64_Encode(data, t->Buf, t->size); - data[len] = 0; - break; - - case ITEM_TYPE_STRING: - string = t->Buf; - utf8_size = CalcUniToUtf8(string); - utf8_size++; - utf8 = ZeroMalloc(utf8_size); - utf8[0] = 0; - UniToUtf8(utf8, utf8_size, string); - size = utf8_size; - data = utf8; - break; - - case ITEM_TYPE_BOOL: - size = 32; - data = Malloc(size); - if (*((bool *)t->Buf) == false) - { - StrCpy(data, size, TAG_FALSE); - } - else - { - StrCpy(data, size, TAG_TRUE); - } - break; - } - if (data == NULL) - { - return; - } - - // Output the data line - CfgAddData(b, t->Type, t->Name, data, sub, depth); - - // Memory release - Free(data); -} - -// Output the data line -void CfgAddData(BUF *b, UINT type, char *name, char *data, char *sub, UINT depth) -{ - char *tmp; - char *name2; - char *data2; - char *sub2 = NULL; - UINT tmp_size; - // Validate arguments - if (b == NULL || type == 0 || name == NULL || data == NULL) - { - return; - } - - name2 = CfgEscape(name); - data2 = CfgEscape(data); - if (sub != NULL) - { - sub2 = CfgEscape(sub); - } - - tmp_size = StrLen(name2) + StrLen(data2) + 2 + 64 + 1; - tmp = Malloc(tmp_size); - - if (sub2 != NULL) - { - StrCpy(tmp, tmp_size, CfgTypeToStr(type)); - StrCat(tmp, tmp_size, " "); - StrCat(tmp, tmp_size, name2); - StrCat(tmp, tmp_size, " "); - StrCat(tmp, tmp_size, data2); - StrCat(tmp, tmp_size, " "); - StrCat(tmp, tmp_size, sub2); - } - else - { - StrCpy(tmp, tmp_size, CfgTypeToStr(type)); - StrCat(tmp, tmp_size, " "); - StrCat(tmp, tmp_size, name2); - StrCat(tmp, tmp_size, " "); - StrCat(tmp, tmp_size, data2); - } - - Free(name2); - Free(data2); - if (sub2 != NULL) - { - Free(sub2); - } - CfgAddLine(b, tmp, depth); - Free(tmp); -} - -// Convert the type of data to a string -char *CfgTypeToStr(UINT type) -{ - switch (type) - { - case ITEM_TYPE_INT: - return TAG_INT; - case ITEM_TYPE_INT64: - return TAG_INT64; - case ITEM_TYPE_BYTE: - return TAG_BYTE; - case ITEM_TYPE_STRING: - return TAG_STRING; - case ITEM_TYPE_BOOL: - return TAG_BOOL; - } - return NULL; -} - -// Outputs the End line -void CfgAddEnd(BUF *b, UINT depth) -{ - // Validate arguments - if (b == NULL) - { - return; - } - - CfgAddLine(b, "}", depth); -// CfgAddLine(b, TAG_END, depth); -} - -// Outputs the Declare lines -void CfgAddDeclare(BUF *b, char *name, UINT depth) -{ - char *tmp; - char *name2; - UINT tmp_size; - // Validate arguments - if (b == NULL || name == NULL) - { - return; - } - - name2 = CfgEscape(name); - - tmp_size = StrLen(name2) + 2 + StrLen(TAG_DECLARE); - tmp = Malloc(tmp_size); - - Format(tmp, 0, "%s %s", TAG_DECLARE, name2); - CfgAddLine(b, tmp, depth); - CfgAddLine(b, "{", depth); - Free(tmp); - Free(name2); -} - -// Outputs one line -void CfgAddLine(BUF *b, char *str, UINT depth) -{ - UINT i; - // Validate arguments - if (b == NULL) - { - return; - } - - for (i = 0;i < depth;i++) - { - WriteBuf(b, "\t", 1); - } - WriteBuf(b, str, StrLen(str)); - WriteBuf(b, "\r\n", 2); -} - -// Convert the folder to a stream -BUF *CfgFolderToBuf(FOLDER *f, bool textmode) -{ - return CfgFolderToBufEx(f, textmode, false); -} -BUF *CfgFolderToBufEx(FOLDER *f, bool textmode, bool no_banner) -{ - // Validate arguments - if (f == NULL) - { - return NULL; - } - - if (textmode) - { - return CfgFolderToBufTextEx(f, no_banner); - } - else - { - return CfgFolderToBufBin(f);; - } -} - -// Escape restoration of the string -char *CfgUnescape(char *str) -{ - char *tmp; - char *ret; - char tmp2[16]; - UINT len, wp, i; - UINT code; - // Validate arguments - if (str == NULL) - { - return NULL; - } - - len = StrLen(str); - tmp = ZeroMalloc(len + 1); - wp = 0; - if (len == 1 && str[0] == '$') - { - // Empty character - tmp[0] = 0; - } - else - { - for (i = 0;i < len;i++) - { - if (str[i] != '$') - { - tmp[wp++] = str[i]; - } - else - { - tmp2[0] = '0'; - tmp2[1] = 'x'; - tmp2[2] = str[i + 1]; - tmp2[3] = str[i + 2]; - i += 2; - tmp2[4] = 0; - code = ToInt(tmp2); - tmp[wp++] = (char)code; - } - } - } - ret = Malloc(StrLen(tmp) + 1); - StrCpy(ret, StrLen(tmp) + 1, tmp); - Free(tmp); - return ret; -} - -// Escape the string -char *CfgEscape(char *str) -{ - char *tmp; - char *ret; - char tmp2[16]; - UINT len; - UINT wp, i; - // Validate arguments - if (str == NULL) - { - return NULL; - } - - len = StrLen(str); - tmp = ZeroMalloc(len * 3 + 2); - if (len == 0) - { - // Empty character - StrCpy(tmp, (len * 3 + 2), "$"); - } - else - { - // Non null character - wp = 0; - for (i = 0;i < len;i++) - { - if (CfgCheckCharForName(str[i])) - { - tmp[wp++] = str[i]; - } - else - { - tmp[wp++] = '$'; - Format(tmp2, sizeof(tmp2), "%02X", (UINT)str[i]); - tmp[wp++] = tmp2[0]; - tmp[wp++] = tmp2[1]; - } - } - } - ret = Malloc(StrLen(tmp) + 1); - StrCpy(ret, 0, tmp); - Free(tmp); - return ret; -} - -// Check if the character can be used in the name -bool CfgCheckCharForName(char c) -{ - if (c >= 0 && c <= 31) - { - return false; - } - if (c == ' ' || c == '\t') - { - return false; - } - if (c == '$') - { - return false; - } - return true; -} - -// Get the string type value -bool CfgGetStr(FOLDER *f, char *name, char *str, UINT size) -{ - wchar_t *tmp; - UINT tmp_size; - // Validate arguments - if (f == NULL || name == NULL || str == NULL) - { - return false; - } - - str[0] = 0; - - // Get unicode string temporarily - tmp_size = size * 4 + 10; // Just to make sure, a quantity of this amount is secured. - tmp = Malloc(tmp_size); - if (CfgGetUniStr(f, name, tmp, tmp_size) == false) - { - // Failure - Free(tmp); - return false; - } - - // Copy to the ANSI string - UniToStr(str, size, tmp); - Free(tmp); - - return true; -} - -// Get the value of the unicode_string type -bool CfgGetUniStr(FOLDER *f, char *name, wchar_t *str, UINT size) -{ - ITEM *t; - // Validate arguments - if (f == NULL || name == NULL || str == NULL) - { - return false; - } - - str[0] = 0; - - t = CfgFindItem(f, name); - if (t == NULL) - { - return false; - } - if (t->Type != ITEM_TYPE_STRING) - { - return false; - } - UniStrCpy(str, size, t->Buf); - return true; -} - -// Check for the existence of item -bool CfgIsItem(FOLDER *f, char *name) -{ - ITEM *t; - // Validate arguments - if (f == NULL || name == NULL) - { - return false; - } - - t = CfgFindItem(f, name); - if (t == NULL) - { - return false; - } - - return true; -} - -// Get the byte[] type as a BUF -BUF *CfgGetBuf(FOLDER *f, char *name) -{ - ITEM *t; - BUF *b; - // Validate arguments - if (f == NULL || name == NULL) - { - return NULL; - } - - t = CfgFindItem(f, name); - if (t == NULL) - { - return NULL; - } - - b = NewBuf(); - WriteBuf(b, t->Buf, t->size); - SeekBuf(b, 0, 0); - - return b; -} - -// Get the value of type byte[] -UINT CfgGetByte(FOLDER *f, char *name, void *buf, UINT size) -{ - ITEM *t; - // Validate arguments - if (f == NULL || name == NULL || buf == NULL) - { - return 0; - } - - t = CfgFindItem(f, name); - if (t == NULL) - { - return 0; - } - if (t->Type != ITEM_TYPE_BYTE) - { - return 0; - } - if (t->size <= size) - { - Copy(buf, t->Buf, t->size); - return t->size; - } - else - { - Copy(buf, t->Buf, size); - return t->size; - } -} - -// Get the value of type int64 -UINT64 CfgGetInt64(FOLDER *f, char *name) -{ - ITEM *t; - UINT64 *ret; - // Validate arguments - if (f == NULL || name == NULL) - { - return 0; - } - - t = CfgFindItem(f, name); - if (t == NULL) - { - return 0; - } - if (t->Type != ITEM_TYPE_INT64) - { - return 0; - } - if (t->size != sizeof(UINT64)) - { - return 0; - } - - ret = (UINT64 *)t->Buf; - return *ret; -} - -// Get the value of the bool type -bool CfgGetBool(FOLDER *f, char *name) -{ - ITEM *t; - bool *ret; - // Validate arguments - if (f == NULL || name == NULL) - { - return 0; - } - - t = CfgFindItem(f, name); - if (t == NULL) - { - return 0; - } - if (t->Type != ITEM_TYPE_BOOL) - { - return 0; - } - if (t->size != sizeof(bool)) - { - return 0; - } - - ret = (bool *)t->Buf; - if (*ret == false) - { - return false; - } - else - { - return true; - } -} - -// Get the value of the int type -UINT CfgGetInt(FOLDER *f, char *name) -{ - ITEM *t; - UINT *ret; - // Validate arguments - if (f == NULL || name == NULL) - { - return 0; - } - - t = CfgFindItem(f, name); - if (t == NULL) - { - return 0; - } - if (t->Type != ITEM_TYPE_INT) - { - return 0; - } - if (t->size != sizeof(UINT)) - { - return 0; - } - - ret = (UINT *)t->Buf; - return *ret; -} - -// Search for an item -ITEM *CfgFindItem(FOLDER *parent, char *name) -{ - ITEM *t, tt; - // Validate arguments - if (parent == NULL || name == NULL) - { - return NULL; - } - - tt.Name = ZeroMalloc(StrLen(name) + 1); - StrCpy(tt.Name, 0, name); - t = Search(parent->Items, &tt); - Free(tt.Name); - - return t; -} - -// Get a folder -FOLDER *CfgGetFolder(FOLDER *parent, char *name) -{ - return CfgFindFolder(parent, name); -} - -// Search a folder -FOLDER *CfgFindFolder(FOLDER *parent, char *name) -{ - FOLDER *f, ff; - // Validate arguments - if (parent == NULL || name == NULL) - { - return NULL; - } - - ff.Name = ZeroMalloc(StrLen(name) + 1); - StrCpy(ff.Name, 0, name); - f = Search(parent->Folders, &ff); - Free(ff.Name); - - return f; -} - -// Adding a string type -ITEM *CfgAddStr(FOLDER *f, char *name, char *str) -{ - wchar_t *tmp; - UINT tmp_size; - ITEM *t; - // Validate arguments - if (f == NULL || name == NULL || str == NULL) - { - return NULL; - } - - // Convert to a Unicode string - tmp_size = CalcStrToUni(str); - if (tmp_size == 0) - { - return NULL; - } - tmp = Malloc(tmp_size); - StrToUni(tmp, tmp_size, str); - t = CfgAddUniStr(f, name, tmp); - Free(tmp); - - return t; -} - -// Add unicode_string type -ITEM *CfgAddUniStr(FOLDER *f, char *name, wchar_t *str) -{ - // Validate arguments - if (f == NULL || name == NULL || str == NULL) - { - return NULL; - } - - return CfgCreateItem(f, name, ITEM_TYPE_STRING, str, UniStrSize(str)); -} - -// Add a binary -ITEM *CfgAddBuf(FOLDER *f, char *name, BUF *b) -{ - // Validate arguments - if (f == NULL || name == NULL || b == NULL) - { - return NULL; - } - return CfgAddByte(f, name, b->Buf, b->Size); -} - -// Add byte type -ITEM *CfgAddByte(FOLDER *f, char *name, void *buf, UINT size) -{ - // Validate arguments - if (f == NULL || name == NULL || buf == NULL) - { - return NULL; - } - return CfgCreateItem(f, name, ITEM_TYPE_BYTE, buf, size); -} - -// Add a 64-bit integer type -ITEM *CfgAddInt64(FOLDER *f, char *name, UINT64 i) -{ - // Validate arguments - if (f == NULL || name == NULL) - { - return NULL; - } - return CfgCreateItem(f, name, ITEM_TYPE_INT64, &i, sizeof(UINT64)); -} - -// Get an IP address type -bool CfgGetIp(FOLDER *f, char *name, struct IP *ip) -{ - char tmp[MAX_SIZE]; - // Validate arguments - if (f == NULL || name == NULL || ip == NULL) - { - return false; - } - - Zero(ip, sizeof(IP)); - - if (CfgGetStr(f, name, tmp, sizeof(tmp)) == false) - { - return false; - } - - if (StrToIP(ip, tmp) == false) - { - return false; - } - - return true; -} -UINT CfgGetIp32(FOLDER *f, char *name) -{ - IP p; - // Validate arguments - if (f == NULL || name == NULL) - { - return 0; - } - - if (CfgGetIp(f, name, &p) == false) - { - return 0; - } - - return IPToUINT(&p); -} -bool CfgGetIp6Addr(FOLDER *f, char *name, IPV6_ADDR *addr) -{ - IP ip; - // Validate arguments - Zero(addr, sizeof(IPV6_ADDR)); - if (f == NULL || name == NULL || addr == NULL) - { - return false; - } - - if (CfgGetIp(f, name, &ip) == false) - { - return false; - } - - if (IsIP6(&ip) == false) - { - return false; - } - - if (IPToIPv6Addr(addr, &ip) == false) - { - return false; - } - - return true; -} - -// Add an IP address type -ITEM *CfgAddIp(FOLDER *f, char *name, struct IP *ip) -{ - char tmp[MAX_SIZE]; - // Validate arguments - if (f == NULL || name == NULL || ip == NULL) - { - return NULL; - } - - IPToStr(tmp, sizeof(tmp), ip); - - return CfgAddStr(f, name, tmp); -} -ITEM *CfgAddIp32(FOLDER *f, char *name, UINT ip) -{ - IP p; - // Validate arguments - if (f == NULL || name == NULL) - { - return NULL; - } - - UINTToIP(&p, ip); - - return CfgAddIp(f, name, &p); -} -ITEM *CfgAddIp6Addr(FOLDER *f, char *name, IPV6_ADDR *addr) -{ - IP ip; - // Validate arguments - if (f == NULL || name == NULL || addr == NULL) - { - return NULL; - } - - IPv6AddrToIP(&ip, addr); - - return CfgAddIp(f, name, &ip); -} - -// Add an integer type -ITEM *CfgAddInt(FOLDER *f, char *name, UINT i) -{ - // Validate arguments - if (f == NULL || name == NULL) - { - return NULL; - } - return CfgCreateItem(f, name, ITEM_TYPE_INT, &i, sizeof(UINT)); -} - -// Adding a bool type -ITEM *CfgAddBool(FOLDER *f, char *name, bool b) -{ - // Validate arguments - if (f == NULL || name == NULL) - { - return NULL; - } - - return CfgCreateItem(f, name, ITEM_TYPE_BOOL, &b, sizeof(bool)); -} - -// Comparison function of the item names -int CmpItemName(void *p1, void *p2) -{ - ITEM *f1, *f2; - if (p1 == NULL || p2 == NULL) - { - return 0; - } - f1 = *(ITEM **)p1; - f2 = *(ITEM **)p2; - if (f1 == NULL || f2 == NULL) - { - return 0; - } - return StrCmpi(f1->Name, f2->Name); -} - -// Comparison function of the folder names -int CmpFolderName(void *p1, void *p2) -{ - FOLDER *f1, *f2; - if (p1 == NULL || p2 == NULL) - { - return 0; - } - f1 = *(FOLDER **)p1; - f2 = *(FOLDER **)p2; - if (f1 == NULL || f2 == NULL) - { - return 0; - } - return StrCmpi(f1->Name, f2->Name); -} - -// Enumeration of items -void CfgEnumItem(FOLDER *f, ENUM_ITEM proc, void *param) -{ - UINT i; - // Validate arguments - if (f == NULL || proc == NULL) - { - return; - } - - for (i = 0;i < LIST_NUM(f->Items);i++) - { - ITEM *tt = LIST_DATA(f->Items, i); - if (proc(tt, param) == false) - { - break; - } - } -} - -// Enumerate the folders and store it in the token list -TOKEN_LIST *CfgEnumFolderToTokenList(FOLDER *f) -{ - TOKEN_LIST *t, *ret; - UINT i; - // Validate arguments - if (f == NULL) - { - return NULL; - } - - t = ZeroMalloc(sizeof(TOKEN_LIST)); - t->NumTokens = LIST_NUM(f->Folders); - t->Token = ZeroMalloc(sizeof(char *) * t->NumTokens); - - for (i = 0;i < t->NumTokens;i++) - { - FOLDER *ff = LIST_DATA(f->Folders, i); - t->Token[i] = CopyStr(ff->Name); - } - - ret = UniqueToken(t); - FreeToken(t); - - return ret; -} - -// Enumerate items and store these to the token list -TOKEN_LIST *CfgEnumItemToTokenList(FOLDER *f) -{ - TOKEN_LIST *t, *ret; - UINT i; - // Validate arguments - if (f == NULL) - { - return NULL; - } - - t = ZeroMalloc(sizeof(TOKEN_LIST)); - t->NumTokens = LIST_NUM(f->Items); - t->Token = ZeroMalloc(sizeof(char *) * t->NumTokens); - - for (i = 0;i < t->NumTokens;i++) - { - FOLDER *ff = LIST_DATA(f->Items, i); - t->Token[i] = CopyStr(ff->Name); - } - - ret = UniqueToken(t); - FreeToken(t); - - return ret; -} - -// Folder enumeration -void CfgEnumFolder(FOLDER *f, ENUM_FOLDER proc, void *param) -{ - UINT i; - // Validate arguments - if (f == NULL || proc == NULL) - { - return; - } - - for (i = 0;i < LIST_NUM(f->Folders);i++) - { - FOLDER *ff = LIST_DATA(f->Folders, i); - if (proc(ff, param) == false) - { - break; - } - - if ((i % 100) == 99) - { - YieldCpu(); - } - } -} - -// Create an item -ITEM *CfgCreateItem(FOLDER *parent, char *name, UINT type, void *buf, UINT size) -{ - UINT name_size; - ITEM *t; -#ifdef CHECK_CFG_NAME_EXISTS - ITEM tt; -#endif // CHECK_CFG_NAME_EXISTS - // Validate arguments - if (parent == NULL || name == NULL || type == 0 || buf == NULL) - { - return NULL; - } - - name_size = StrLen(name) + 1; - -#ifdef CHECK_CFG_NAME_EXISTS - - // Check whether there are any items with the same name already - tt.Name = ZeroMalloc(name_size); - StrCpy(tt.Name, 0, name); - t = Search(parent->Items, &tt); - Free(tt.Name); - if (t != NULL) - { - // Duplicated - return NULL; - } - -#endif // CHECK_CFG_NAME_EXISTS - - t = ZeroMalloc(sizeof(ITEM)); - t->Buf = Malloc(size); - Copy(t->Buf, buf, size); - t->Name = ZeroMalloc(name_size); - StrCpy(t->Name, 0, name); - t->Type = type; - t->size = size; - t->Parent = parent; - - // Add to the parent list - Insert(parent->Items, t); - - return t; -} - -// Delete the item -void CfgDeleteItem(ITEM *t) -{ - // Validate arguments - if (t == NULL) - { - return; - } - - // Remove from the parent list - Delete(t->Parent->Items, t); - - // Memory release - Free(t->Buf); - Free(t->Name); - Free(t); -} - - -// Delete the folder -void CfgDeleteFolder(FOLDER *f) -{ - FOLDER **ff; - ITEM **tt; - UINT num, i; - // Validate arguments - if (f == NULL) - { - return; - } - - if(f->Folders == NULL) - { - return; - } - - // Remove all subfolders - num = LIST_NUM(f->Folders); - if (num != 0) - { - ff = Malloc(sizeof(FOLDER *) * num); - Copy(ff, f->Folders->p, sizeof(FOLDER *) * num); - for (i = 0;i < num;i++) - { - CfgDeleteFolder(ff[i]); - } - Free(ff); - } - - // Remove all items - num = LIST_NUM(f->Items); - if (num != 0) - { - tt = Malloc(sizeof(ITEM *) * num); - Copy(tt, f->Items->p, sizeof(ITEM *) * num); - for (i = 0;i < num;i++) - { - CfgDeleteItem(tt[i]); - } - Free(tt); - } - - // Memory release - Free(f->Name); - // Remove from the parent list - if (f->Parent != NULL) - { - Delete(f->Parent->Folders, f); - } - // Release the list - ReleaseList(f->Folders); - ReleaseList(f->Items); - - // Release of the memory of the body - Free(f); -} - -// Creating a root -FOLDER *CfgCreateRoot() -{ - return CfgCreateFolder(NULL, TAG_ROOT); -} - -// Create a folder -FOLDER *CfgCreateFolder(FOLDER *parent, char *name) -{ - UINT size; - FOLDER *f; - // Validate arguments - if (name == NULL) - { - return NULL; - } - - size = StrLen(name) + 1; - -#ifdef CHECK_CFG_NAME_EXISTS - - // Check the name in the parent list - if (parent != NULL) - { - FOLDER ff; - ff.Name = ZeroMalloc(size); - StrCpy(ff.Name, 0, name); - f = Search(parent->Folders, &ff); - Free(ff.Name); - if (f != NULL) - { - // Folder with the same name already exists - return NULL; - } - } - -#endif // CHECK_CFG_NAME_EXISTS - - f = ZeroMalloc(sizeof(FOLDER)); - f->Items = NewListFast(CmpItemName); - f->Folders = NewListFast(CmpFolderName); - f->Name = ZeroMalloc(size); - StrCpy(f->Name, 0, name); - f->Parent = parent; - - // Add to parentlist - if (f->Parent != NULL) - { - Insert(f->Parent->Folders, f); - } - return f; -} - - +// SoftEther VPN Source Code - Developer Edition Master Branch +// Mayaqua Kernel + + +// Cfg.c +// Configuration information manipulation module + +#include + +#define CFG_C + +#include +#include +#include +#include +#include +#include +#include +#include + +// Create a backup of the configuration file +void BackupCfgWEx(CFG_RW *rw, FOLDER *f, wchar_t *original, UINT revision_number) +{ + wchar_t dirname[MAX_PATH]; + wchar_t filename[MAX_PATH]; + wchar_t fullpath[MAX_PATH]; + wchar_t datestr[MAX_PATH]; + SYSTEMTIME st; + // Validate arguments + if (f == NULL || rw == NULL) + { + return; + } + + // Determine the directory name + UniFormat(dirname, sizeof(dirname), L"$backup.%s", original[0] == L'$' ? original + 1 : original); + + // Determine the file name + LocalTime(&st); + UniFormat(datestr, sizeof(datestr), L"%04u%02u%02u%02u_%s", + st.wYear, st.wMonth, st.wDay, st.wHour, original[0] == L'$' ? original + 1 : original); + + if (revision_number == INFINITE) + { + UniStrCpy(filename, sizeof(filename), datestr); + } + else + { + UniFormat(filename, sizeof(filename), L"%08u_%s", + revision_number, original[0] == L'$' ? original + 1 : original); + } + + // Don't save if the date and time has not been changed + if (UniStrCmpi(datestr, rw->LastSavedDateStr) == 0) + { + return; + } + + UniStrCpy(rw->LastSavedDateStr, sizeof(rw->LastSavedDateStr), datestr); + + // Check the existence of file name + if (IsFileExistsW(filename)) + { + return; + } + + // Create the directory + MakeDirW(dirname); + + // Save the file + UniFormat(fullpath, sizeof(fullpath), L"%s/%s", dirname, filename); + CfgSaveW(f, fullpath); +} + +// Close the configuration file R/W +void FreeCfgRw(CFG_RW *rw) +{ + // Validate arguments + if (rw == NULL) + { + return; + } + + if (rw->Io != NULL) + { + FileClose(rw->Io); + } + + DeleteLock(rw->lock); + Free(rw->FileNameW); + Free(rw->FileName); + Free(rw); +} + +// Writing to the configuration file +UINT SaveCfgRw(CFG_RW *rw, FOLDER *f) +{ + return SaveCfgRwEx(rw, f, INFINITE); +} +UINT SaveCfgRwEx(CFG_RW *rw, FOLDER *f, UINT revision_number) +{ + UINT ret = 0; + // Validate arguments + if (rw == NULL || f == NULL) + { + return 0; + } + + Lock(rw->lock); + { + if (rw->Io != NULL) + { + FileClose(rw->Io); + rw->Io = NULL; + } + + if (CfgSaveExW2(rw, f, rw->FileNameW, &ret)) + { + if (rw->DontBackup == false) + { + BackupCfgWEx(rw, f, rw->FileNameW, revision_number); + } + } + else + { + ret = 0; + } + + rw->Io = FileOpenW(rw->FileNameW, false); + } + Unlock(rw->lock); + + return ret; +} + +// Creating a configuration file R/W +CFG_RW *NewCfgRw(FOLDER **root, char *cfg_name) +{ + return NewCfgRwEx(root, cfg_name, false); +} +CFG_RW *NewCfgRwEx(FOLDER **root, char *cfg_name, bool dont_backup) +{ + wchar_t *cfg_name_w = CopyStrToUni(cfg_name); + CFG_RW *ret = NewCfgRwExW(root, cfg_name_w, dont_backup); + + Free(cfg_name_w); + + return ret; +} +CFG_RW *NewCfgRwExW(FOLDER **root, wchar_t *cfg_name, bool dont_backup) +{ + return NewCfgRwEx2W(root, cfg_name, dont_backup, NULL); +} +CFG_RW *NewCfgRwEx2A(FOLDER **root, char *cfg_name_a, bool dont_backup, char *template_name_a) +{ + CFG_RW *ret; + wchar_t *cfg_name_w = CopyStrToUni(cfg_name_a); + wchar_t *template_name_w = CopyStrToUni(template_name_a); + + ret = NewCfgRwEx2W(root, cfg_name_w, dont_backup, template_name_w); + + Free(cfg_name_w); + Free(template_name_w); + + return ret; +} +CFG_RW *NewCfgRwEx2W(FOLDER **root, wchar_t *cfg_name, bool dont_backup, wchar_t *template_name) +{ + CFG_RW *rw; + FOLDER *f; + bool loaded_from_template = false; + // Validate arguments + if (cfg_name == NULL || root == NULL) + { + return NULL; + } + + f = CfgReadW(cfg_name); + if (f == NULL) + { + // Load from template + if (UniIsEmptyStr(template_name) == false) + { + f = CfgReadW(template_name); + if (f != NULL) + { + loaded_from_template = true; + + goto LABEL_CONTINUE; + } + } + + rw = ZeroMalloc(sizeof(CFG_RW)); + rw->lock = NewLock(); + rw->FileNameW = CopyUniStr(cfg_name); + rw->FileName = CopyUniToStr(cfg_name); + rw->Io = FileCreateW(cfg_name); + *root = NULL; + rw->DontBackup = dont_backup; + + return rw; + } + +LABEL_CONTINUE: + rw = ZeroMalloc(sizeof(CFG_RW)); + rw->FileNameW = CopyUniStr(cfg_name); + rw->FileName = CopyUniToStr(cfg_name); + if (loaded_from_template == false) + { + rw->Io = FileOpenW(cfg_name, false); + } + else + { + rw->Io = FileCreateW(cfg_name); + } + rw->lock = NewLock(); + + *root = f; + + rw->DontBackup = dont_backup; + + return rw; +} + +// Copy a file +bool FileCopy(char *src, char *dst) +{ + BUF *b; + bool ret = false; + // Validate arguments + if (src == NULL || dst == NULL) + { + return false; + } + + b = ReadDump(src); + if (b == NULL) + { + return false; + } + + SeekBuf(b, 0, 0); + + ret = DumpBuf(b, dst); + + FreeBuf(b); + + return ret; +} +bool FileCopyW(wchar_t *src, wchar_t *dst) +{ + return FileCopyExW(src, dst, true); +} +bool FileCopyExW(wchar_t *src, wchar_t *dst, bool read_lock) +{ + BUF *b; + bool ret = false; + // Validate arguments + if (src == NULL || dst == NULL) + { + return false; + } + + b = ReadDumpExW(src, false); + if (b == NULL) + { + return false; + } + + SeekBuf(b, 0, 0); + + ret = DumpBufW(b, dst); + + FreeBuf(b); + + return ret; +} +bool FileCopyExWithEofW(wchar_t *src, wchar_t *dst, bool read_lock) +{ + BUF *b; + bool ret = false; + // Validate arguments + if (src == NULL || dst == NULL) + { + return false; + } + + b = ReadDumpExW(src, false); + if (b == NULL) + { + return false; + } + + SeekBuf(b, b->Size, 0); + + WriteBufChar(b, 0x1A); + + SeekBuf(b, 0, 0); + + ret = DumpBufW(b, dst); + + FreeBuf(b); + + return ret; +} + +// Save the settings to a file +void CfgSave(FOLDER *f, char *name) +{ + CfgSaveEx(NULL, f, name); +} +void CfgSaveW(FOLDER *f, wchar_t *name) +{ + CfgSaveExW(NULL, f, name); +} +bool CfgSaveEx(CFG_RW *rw, FOLDER *f, char *name) +{ + wchar_t *name_w = CopyStrToUni(name); + bool ret = CfgSaveExW(rw, f, name_w); + + Free(name_w); + + return ret; +} +bool CfgSaveExW(CFG_RW *rw, FOLDER *f, wchar_t *name) +{ + return CfgSaveExW2(rw, f, name, NULL); +} +bool CfgSaveExW2(CFG_RW *rw, FOLDER *f, wchar_t *name, UINT *written_size) +{ + return CfgSaveExW3(rw, f, name, written_size, IsFileExistsW(SAVE_BINARY_FILE_NAME_SWITCH)); +} +bool CfgSaveExW3(CFG_RW *rw, FOLDER *f, wchar_t *name, UINT *written_size, bool write_binary) +{ + wchar_t tmp[MAX_SIZE]; + bool text = !write_binary; + UCHAR hash[SHA1_SIZE]; + BUF *b; + IO *o; + bool ret = true; + UINT dummy_int = 0; + // Validate arguments + if (name == NULL || f == NULL) + { + return false; + } + if (written_size == NULL) + { + written_size = &dummy_int; + } + + // Convert to buffer + b = CfgFolderToBuf(f, text); + if (b == NULL) + { + return false; + } + // Hash the contents + Sha0(hash, b->Buf, b->Size); + + // Compare the contents to be written with the content which was written last + if (rw != NULL) + { + if (Cmp(hash, rw->LashHash, SHA1_SIZE) == 0) + { + // Contents are not changed + ret = false; + } + else + { + Copy(rw->LashHash, hash, SHA1_SIZE); + } + } + + if (ret || OS_IS_UNIX(GetOsInfo()->OsType)) + { + // Generate a temporary file name + UniFormat(tmp, sizeof(tmp), L"%s.log", name); + // Copy the file that currently exist to a temporary file + // with appending the EOF + FileCopyExWithEofW(name, tmp, true); + + // Save the new file + o = FileCreateW(name); + if (o != NULL) + { + if (FileWrite(o, b->Buf, b->Size) == false) + { + // File saving failure + FileClose(o); + FileDeleteW(name); + FileRenameW(tmp, name); + + if (rw != NULL) + { + Zero(rw->LashHash, sizeof(rw->LashHash)); + } + } + else + { + // Successful saving file + FileClose(o); + + // Delete the temporary file + FileDeleteW(tmp); + } + } + else + { + // File saving failure + FileRenameW(tmp, name); + + if (rw != NULL) + { + Zero(rw->LashHash, sizeof(rw->LashHash)); + } + } + } + + *written_size = b->Size; + + // Release memory + FreeBuf(b); + + return ret; +} + +// Read the settings from the file +FOLDER *CfgRead(char *name) +{ + wchar_t *name_w = CopyStrToUni(name); + FOLDER *ret = CfgReadW(name_w); + + Free(name_w); + + return ret; +} +FOLDER *CfgReadW(wchar_t *name) +{ + wchar_t tmp[MAX_SIZE]; + wchar_t newfile[MAX_SIZE]; + BUF *b; + IO *o; + UINT size; + void *buf; + FOLDER *f; + bool delete_new = false; + bool binary_file = false; + UCHAR header[8]; + bool has_eof = false; + // Validate arguments + if (name == NULL) + { + return NULL; + } + + // Generate a new file name + UniFormat(newfile, sizeof(newfile), L"%s.new", name); + // Generate a temporary file name + UniFormat(tmp, sizeof(tmp), L"%s.log", name); + + // Read the new file if it exists + o = FileOpenW(newfile, false); + if (o == NULL) + { + UINT size; + // Read the temporary file + o = FileOpenW(tmp, false); + + if (o != NULL) + { + // Check the EOF + size = FileSize(o); + if (size >= 2) + { + char c; + + if (FileSeek(o, FILE_BEGIN, size - 1) && FileRead(o, &c, 1) && c == 0x1A && FileSeek(o, FILE_BEGIN, 0)) + { + // EOF ok + has_eof = true; + } + else + { + // No EOF: file is corrupted + FileClose(o); + o = NULL; + } + } + } + } + else + { + delete_new = true; + } + if (o == NULL) + { + // Read the original file if there is no temporary file + o = FileOpenW(name, false); + } + else + { + // Read the original file too if the size of temporary file is 0 + if (FileSize(o) == 0) + { + FileClose(o); + o = FileOpenW(name, false); + } + } + if (o == NULL) + { + // Failed to read + return NULL; + } + + // Read into the buffer + size = FileSize(o); + if (has_eof) + { + // Ignore EOF + size -= 1; + } + buf = Malloc(size); + FileRead(o, buf, size); + b = NewBuf(); + WriteBuf(b, buf, size); + SeekBuf(b, 0, 0); + + // Close the file + FileClose(o); + + if (delete_new) + { + // Delete the new file + FileDeleteW(newfile); + } + + // If the beginning 8 character of the buffer is "SEVPN_DB", it is binary file + ReadBuf(b, header, sizeof(header)); + if (Cmp(header, TAG_BINARY, 8) == 0) + { + UCHAR hash1[SHA1_SIZE], hash2[SHA1_SIZE]; + binary_file = true; + + // Check the hash + ReadBuf(b, hash1, sizeof(hash1)); + + Sha0(hash2, ((UCHAR *)b->Buf) + 8 + SHA1_SIZE, b->Size - 8 - SHA1_SIZE); + + if (Cmp(hash1, hash2, SHA1_SIZE) != 0) + { + // Corrupted file + FreeBuf(b); + return NULL; + } + } + + SeekBuf(b, 0, 0); + + if (binary_file) + { + SeekBuf(b, 8 + SHA1_SIZE, 0); + } + + // Convert the buffer into a folder + if (binary_file == false) + { + // Text mode + f = CfgBufTextToFolder(b); + } + else + { + // Binary mode + f = CfgBufBinToFolder(b); + } + + // Memory release + Free(buf); + FreeBuf(b); + + FileDeleteW(newfile); + + return f; +} + +// Read one line +char *CfgReadNextLine(BUF *b) +{ + char *tmp; + char *buf; + UINT len; + // Validate arguments + if (b == NULL) + { + return NULL; + } + + // Examine the number of characters up to the next newline + tmp = (char *)b->Buf + b->Current; + if ((b->Size - b->Current) == 0) + { + // Read to the end + return NULL; + } + len = 0; + while (true) + { + if (tmp[len] == 13 || tmp[len] == 10) + { + if (tmp[len] == 13) + { + if (len < (b->Size - b->Current)) + { + len++; + } + } + break; + } + len++; + if (len >= (b->Size - b->Current)) + { + break; + } + } + + // Read ahead only 'len' bytes + buf = ZeroMalloc(len + 1); + ReadBuf(b, buf, len); + SeekBuf(b, 1, 1); + + if (StrLen(buf) >= 1) + { + if (buf[StrLen(buf) - 1] == 13) + { + buf[StrLen(buf) - 1] = 0; + } + } + + return buf; +} + +// Read the text stream +bool CfgReadNextTextBUF(BUF *b, FOLDER *current) +{ + char *buf; + TOKEN_LIST *token; + char *name; + char *string; + char *data; + bool ret; + FOLDER *f; + + // Validate arguments + if (b == NULL || current == NULL) + { + return false; + } + + ret = true; + + // Read one line + buf = CfgReadNextLine(b); + if (buf == NULL) + { + return false; + } + + // Analyze this line + token = ParseToken(buf, "\t "); + if (token == NULL) + { + Free(buf); + return false; + } + + if (token->NumTokens >= 1) + { + if (!StrCmpi(token->Token[0], TAG_DECLARE)) + { + if (token->NumTokens >= 2) + { + // declare + name = CfgUnescape(token->Token[1]); + + // Create a folder + f = CfgCreateFolder(current, name); + + // Read the next folder + while (true) + { + if (CfgReadNextTextBUF(b, f) == false) + { + break; + } + } + + Free(name); + } + } + if (!StrCmpi(token->Token[0], "}")) + { + // end + ret = false; + } + if (token->NumTokens >= 3) + { + name = CfgUnescape(token->Token[1]); + data = token->Token[2]; + + if (!StrCmpi(token->Token[0], TAG_STRING)) + { + // string + wchar_t *uni; + UINT uni_size; + string = CfgUnescape(data); + uni_size = CalcUtf8ToUni(string, StrLen(string)); + if (uni_size != 0) + { + uni = Malloc(uni_size); + Utf8ToUni(uni, uni_size, string, StrLen(string)); + CfgAddUniStr(current, name, uni); + Free(uni); + } + Free(string); + } + if (!StrCmpi(token->Token[0], TAG_INT)) + { + // uint + CfgAddInt(current, name, ToInt(data)); + } + if (!StrCmpi(token->Token[0], TAG_INT64)) + { + // uint64 + CfgAddInt64(current, name, ToInt64(data)); + } + if (!StrCmpi(token->Token[0], TAG_BOOL)) + { + // bool + bool b = false; + if (!StrCmpi(data, TAG_TRUE)) + { + b = true; + } + else if (ToInt(data) != 0) + { + b = true; + } + CfgAddBool(current, name, b); + } + if (!StrCmpi(token->Token[0], TAG_BYTE)) + { + // byte + char *unescaped_b64 = CfgUnescape(data); + void *tmp = Malloc(StrLen(unescaped_b64) * 4 + 64); + int size = B64_Decode(tmp, unescaped_b64, StrLen(unescaped_b64)); + CfgAddByte(current, name, tmp, size); + Free(tmp); + Free(unescaped_b64); + } + + Free(name); + } + } + + // Release of the token + FreeToken(token); + + Free(buf); + + return ret; +} + +// Convert the stream text to a folder +FOLDER *CfgBufTextToFolder(BUF *b) +{ + FOLDER *f, *c; + // Validate arguments + if (b == NULL) + { + return NULL; + } + + // Read recursively from the root folder + c = CfgCreateFolder(NULL, "tmp"); + + while (true) + { + // Read the text stream + if (CfgReadNextTextBUF(b, c) == false) + { + break; + } + } + + // Getting root folder + f = CfgGetFolder(c, TAG_ROOT); + if (f == NULL) + { + // Root folder is not found + CfgDeleteFolder(c); + return NULL; + } + + // Remove the reference from tmp folder to the root + Delete(c->Folders, f); + f->Parent = NULL; + + // Delete the tmp folder + CfgDeleteFolder(c); + + // Return the root folder + return f; +} + +// Read the next folder +void CfgReadNextFolderBin(BUF *b, FOLDER *parent) +{ + char name[MAX_SIZE]; + FOLDER *f; + UINT n, i; + UINT size; + UCHAR *buf; + wchar_t *string; + // Validate arguments + if (b == NULL || parent == NULL) + { + return; + } + + // Folder name + ReadBufStr(b, name, sizeof(name)); + f = CfgCreateFolder(parent, name); + + // The number of the subfolder + n = ReadBufInt(b); + for (i = 0;i < n;i++) + { + // Subfolder + CfgReadNextFolderBin(b, f); + } + + // The number of items + n = ReadBufInt(b); + for (i = 0;i < n;i++) + { + UINT type; + + // Name + ReadBufStr(b, name, sizeof(name)); + // Type + type = ReadBufInt(b); + + switch (type) + { + case ITEM_TYPE_INT: + // int + CfgAddInt(f, name, ReadBufInt(b)); + break; + + case ITEM_TYPE_INT64: + // int64 + CfgAddInt64(f, name, ReadBufInt64(b)); + break; + + case ITEM_TYPE_BYTE: + // data + size = ReadBufInt(b); + buf = ZeroMalloc(size); + ReadBuf(b, buf, size); + CfgAddByte(f, name, buf, size); + Free(buf); + break; + + case ITEM_TYPE_STRING: + // string + size = ReadBufInt(b); + buf = ZeroMalloc(size + 1); + ReadBuf(b, buf, size); + string = ZeroMalloc(CalcUtf8ToUni(buf, StrLen(buf)) + 4); + Utf8ToUni(string, 0, buf, StrLen(buf)); + CfgAddUniStr(f, name, string); + Free(string); + Free(buf); + break; + + case ITEM_TYPE_BOOL: + // bool + CfgAddBool(f, name, ReadBufInt(b) == 0 ? false : true); + break; + } + } +} + +// Convert the binary to folder +FOLDER *CfgBufBinToFolder(BUF *b) +{ + FOLDER *f, *c; + // Validate arguments + if (b == NULL) + { + return NULL; + } + + // Create a temporary folder + c = CfgCreateFolder(NULL, "tmp"); + + // Read a binary + CfgReadNextFolderBin(b, c); + + // Get root folder + f = CfgGetFolder(c, TAG_ROOT); + if (f == NULL) + { + // Missing + CfgDeleteFolder(c); + return NULL; + } + + Delete(c->Folders, f); + f->Parent = NULL; + + CfgDeleteFolder(c); + + return f; +} + +// Convert the folder to binary +BUF *CfgFolderToBufBin(FOLDER *f) +{ + BUF *b; + UCHAR hash[SHA1_SIZE]; + // Validate arguments + if (f == NULL) + { + return NULL; + } + + b = NewBuf(); + + // Header + WriteBuf(b, TAG_BINARY, 8); + + // Hash area + Zero(hash, sizeof(hash)); + WriteBuf(b, hash, sizeof(hash)); + + // Output the root folder (recursive) + CfgOutputFolderBin(b, f); + + // Hash + Sha0(((UCHAR *)b->Buf) + 8, ((UCHAR *)b->Buf) + 8 + SHA1_SIZE, b->Size - 8 - SHA1_SIZE); + + return b; +} + +// Convert the folder to a stream text +BUF *CfgFolderToBufTextEx(FOLDER *f, bool no_banner) +{ + BUF *b; + // Validate arguments + if (f == NULL) + { + return NULL; + } + + // Create a stream + b = NewBuf(); + + // Copyright notice + if (no_banner == false) + { + WriteBuf(b, TAG_CPYRIGHT, StrLen(TAG_CPYRIGHT)); + } + + // Output the root folder (recursive) + CfgOutputFolderText(b, f, 0); + + return b; +} + +// Output the folder contents (Enumerate folders) +bool CfgEnumFolderProc(FOLDER *f, void *param) +{ + CFG_ENUM_PARAM *p; + // Validate arguments + if (f == NULL || param == NULL) + { + return false; + } + + p = (CFG_ENUM_PARAM *)param; + // Output the folder contents (recursive) + CfgOutputFolderText(p->b, f, p->depth); + + return true; +} + +// Output the contents of the item (enumeration) +bool CfgEnumItemProc(ITEM *t, void *param) +{ + CFG_ENUM_PARAM *p; + // Validate arguments + if (t == NULL || param == NULL) + { + return false; + } + + p = (CFG_ENUM_PARAM *)param; + CfgAddItemText(p->b, t, p->depth); + + return true; +} + +// Output the folder contents (Recursive, binary) +void CfgOutputFolderBin(BUF *b, FOLDER *f) +{ + UINT i; + // Validate arguments + if (b == NULL || f == NULL) + { + return; + } + + // Folder name + WriteBufStr(b, f->Name); + + // The number of the subfolder + WriteBufInt(b, LIST_NUM(f->Folders)); + + // Subfolder + for (i = 0;i < LIST_NUM(f->Folders);i++) + { + FOLDER *sub = LIST_DATA(f->Folders, i); + CfgOutputFolderBin(b, sub); + + if ((i % 100) == 99) + { + YieldCpu(); + } + } + + // The number of Items + WriteBufInt(b, LIST_NUM(f->Items)); + + // Item + for (i = 0;i < LIST_NUM(f->Items);i++) + { + char *utf8; + UINT utf8_size; + ITEM *t = LIST_DATA(f->Items, i); + + // Item Name + WriteBufStr(b, t->Name); + + // Type + WriteBufInt(b, t->Type); + + switch (t->Type) + { + case ITEM_TYPE_INT: + // Integer + WriteBufInt(b, *((UINT *)t->Buf)); + break; + + case ITEM_TYPE_INT64: + // 64-bit integer + WriteBufInt64(b, *((UINT64 *)t->Buf)); + break; + + case ITEM_TYPE_BYTE: + // Data size + WriteBufInt(b, t->size); + // Data + WriteBuf(b, t->Buf, t->size); + break; + + case ITEM_TYPE_STRING: + // String + utf8_size = CalcUniToUtf8((wchar_t *)t->Buf) + 1; + utf8 = ZeroMalloc(utf8_size); + UniToUtf8(utf8, utf8_size, (wchar_t *)t->Buf); + WriteBufInt(b, StrLen(utf8)); + WriteBuf(b, utf8, StrLen(utf8)); + Free(utf8); + break; + + case ITEM_TYPE_BOOL: + // Boolean type + if (*((bool *)t->Buf) == false) + { + WriteBufInt(b, 0); + } + else + { + WriteBufInt(b, 1); + } + break; + } + } +} + +// Output the contents of the folder (Recursive, text) +void CfgOutputFolderText(BUF *b, FOLDER *f, UINT depth) +{ + CFG_ENUM_PARAM p; + // Validate arguments + if (b == NULL || f == NULL) + { + return; + } + + // Output starting of the folder + CfgAddDeclare(b, f->Name, depth); + depth++; + + Zero(&p, sizeof(CFG_ENUM_PARAM)); + p.depth = depth; + p.b = b; + p.f = f; + + // Enumerate the list of items + CfgEnumItem(f, CfgEnumItemProc, &p); + + if (LIST_NUM(f->Folders) != 0 && LIST_NUM(f->Items) != 0) + { + WriteBuf(b, "\r\n", 2); + } + + // Enumerate the folder list + CfgEnumFolder(f, CfgEnumFolderProc, &p); + // Output the end of the folder + depth--; + CfgAddEnd(b, depth); + + //WriteBuf(b, "\r\n", 2); +} + +// Output contents of the item +void CfgAddItemText(BUF *b, ITEM *t, UINT depth) +{ + char *data; + char *sub = NULL; + UINT len; + UINT size; + char *utf8; + UINT utf8_size; + wchar_t *string; + // Validate arguments + if (b == NULL || t == NULL) + { + return; + } + + // Process the data by its type + data = NULL; + switch (t->Type) + { + case ITEM_TYPE_INT: + data = Malloc(32); + ToStr(data, *((UINT *)t->Buf)); + break; + + case ITEM_TYPE_INT64: + data = Malloc(64); + ToStr64(data, *((UINT64 *)t->Buf)); + break; + + case ITEM_TYPE_BYTE: + data = ZeroMalloc(t->size * 4 + 32); + len = B64_Encode(data, t->Buf, t->size); + data[len] = 0; + break; + + case ITEM_TYPE_STRING: + string = t->Buf; + utf8_size = CalcUniToUtf8(string); + utf8_size++; + utf8 = ZeroMalloc(utf8_size); + utf8[0] = 0; + UniToUtf8(utf8, utf8_size, string); + size = utf8_size; + data = utf8; + break; + + case ITEM_TYPE_BOOL: + size = 32; + data = Malloc(size); + if (*((bool *)t->Buf) == false) + { + StrCpy(data, size, TAG_FALSE); + } + else + { + StrCpy(data, size, TAG_TRUE); + } + break; + } + if (data == NULL) + { + return; + } + + // Output the data line + CfgAddData(b, t->Type, t->Name, data, sub, depth); + + // Memory release + Free(data); +} + +// Output the data line +void CfgAddData(BUF *b, UINT type, char *name, char *data, char *sub, UINT depth) +{ + char *tmp; + char *name2; + char *data2; + char *sub2 = NULL; + UINT tmp_size; + // Validate arguments + if (b == NULL || type == 0 || name == NULL || data == NULL) + { + return; + } + + name2 = CfgEscape(name); + data2 = CfgEscape(data); + if (sub != NULL) + { + sub2 = CfgEscape(sub); + } + + tmp_size = StrLen(name2) + StrLen(data2) + 2 + 64 + 1; + tmp = Malloc(tmp_size); + + if (sub2 != NULL) + { + StrCpy(tmp, tmp_size, CfgTypeToStr(type)); + StrCat(tmp, tmp_size, " "); + StrCat(tmp, tmp_size, name2); + StrCat(tmp, tmp_size, " "); + StrCat(tmp, tmp_size, data2); + StrCat(tmp, tmp_size, " "); + StrCat(tmp, tmp_size, sub2); + } + else + { + StrCpy(tmp, tmp_size, CfgTypeToStr(type)); + StrCat(tmp, tmp_size, " "); + StrCat(tmp, tmp_size, name2); + StrCat(tmp, tmp_size, " "); + StrCat(tmp, tmp_size, data2); + } + + Free(name2); + Free(data2); + if (sub2 != NULL) + { + Free(sub2); + } + CfgAddLine(b, tmp, depth); + Free(tmp); +} + +// Convert the type of data to a string +char *CfgTypeToStr(UINT type) +{ + switch (type) + { + case ITEM_TYPE_INT: + return TAG_INT; + case ITEM_TYPE_INT64: + return TAG_INT64; + case ITEM_TYPE_BYTE: + return TAG_BYTE; + case ITEM_TYPE_STRING: + return TAG_STRING; + case ITEM_TYPE_BOOL: + return TAG_BOOL; + } + return NULL; +} + +// Outputs the End line +void CfgAddEnd(BUF *b, UINT depth) +{ + // Validate arguments + if (b == NULL) + { + return; + } + + CfgAddLine(b, "}", depth); +// CfgAddLine(b, TAG_END, depth); +} + +// Outputs the Declare lines +void CfgAddDeclare(BUF *b, char *name, UINT depth) +{ + char *tmp; + char *name2; + UINT tmp_size; + // Validate arguments + if (b == NULL || name == NULL) + { + return; + } + + name2 = CfgEscape(name); + + tmp_size = StrLen(name2) + 2 + StrLen(TAG_DECLARE); + tmp = Malloc(tmp_size); + + Format(tmp, 0, "%s %s", TAG_DECLARE, name2); + CfgAddLine(b, tmp, depth); + CfgAddLine(b, "{", depth); + Free(tmp); + Free(name2); +} + +// Outputs one line +void CfgAddLine(BUF *b, char *str, UINT depth) +{ + UINT i; + // Validate arguments + if (b == NULL) + { + return; + } + + for (i = 0;i < depth;i++) + { + WriteBuf(b, "\t", 1); + } + WriteBuf(b, str, StrLen(str)); + WriteBuf(b, "\r\n", 2); +} + +// Convert the folder to a stream +BUF *CfgFolderToBuf(FOLDER *f, bool textmode) +{ + return CfgFolderToBufEx(f, textmode, false); +} +BUF *CfgFolderToBufEx(FOLDER *f, bool textmode, bool no_banner) +{ + // Validate arguments + if (f == NULL) + { + return NULL; + } + + if (textmode) + { + return CfgFolderToBufTextEx(f, no_banner); + } + else + { + return CfgFolderToBufBin(f);; + } +} + +// Escape restoration of the string +char *CfgUnescape(char *str) +{ + char *tmp; + char *ret; + char tmp2[16]; + UINT len, wp, i; + UINT code; + // Validate arguments + if (str == NULL) + { + return NULL; + } + + len = StrLen(str); + tmp = ZeroMalloc(len + 1); + wp = 0; + if (len == 1 && str[0] == '$') + { + // Empty character + tmp[0] = 0; + } + else + { + for (i = 0;i < len;i++) + { + if (str[i] != '$') + { + tmp[wp++] = str[i]; + } + else + { + tmp2[0] = '0'; + tmp2[1] = 'x'; + tmp2[2] = str[i + 1]; + tmp2[3] = str[i + 2]; + i += 2; + tmp2[4] = 0; + code = ToInt(tmp2); + tmp[wp++] = (char)code; + } + } + } + ret = Malloc(StrLen(tmp) + 1); + StrCpy(ret, StrLen(tmp) + 1, tmp); + Free(tmp); + return ret; +} + +// Escape the string +char *CfgEscape(char *str) +{ + char *tmp; + char *ret; + char tmp2[16]; + UINT len; + UINT wp, i; + // Validate arguments + if (str == NULL) + { + return NULL; + } + + len = StrLen(str); + tmp = ZeroMalloc(len * 3 + 2); + if (len == 0) + { + // Empty character + StrCpy(tmp, (len * 3 + 2), "$"); + } + else + { + // Non null character + wp = 0; + for (i = 0;i < len;i++) + { + if (CfgCheckCharForName(str[i])) + { + tmp[wp++] = str[i]; + } + else + { + tmp[wp++] = '$'; + Format(tmp2, sizeof(tmp2), "%02X", (UINT)str[i]); + tmp[wp++] = tmp2[0]; + tmp[wp++] = tmp2[1]; + } + } + } + ret = Malloc(StrLen(tmp) + 1); + StrCpy(ret, 0, tmp); + Free(tmp); + return ret; +} + +// Check if the character can be used in the name +bool CfgCheckCharForName(char c) +{ + if (c >= 0 && c <= 31) + { + return false; + } + if (c == ' ' || c == '\t') + { + return false; + } + if (c == '$') + { + return false; + } + return true; +} + +// Get the string type value +bool CfgGetStr(FOLDER *f, char *name, char *str, UINT size) +{ + wchar_t *tmp; + UINT tmp_size; + // Validate arguments + if (f == NULL || name == NULL || str == NULL) + { + return false; + } + + str[0] = 0; + + // Get unicode string temporarily + tmp_size = size * 4 + 10; // Just to make sure, a quantity of this amount is secured. + tmp = Malloc(tmp_size); + if (CfgGetUniStr(f, name, tmp, tmp_size) == false) + { + // Failure + Free(tmp); + return false; + } + + // Copy to the ANSI string + UniToStr(str, size, tmp); + Free(tmp); + + return true; +} + +// Get the value of the unicode_string type +bool CfgGetUniStr(FOLDER *f, char *name, wchar_t *str, UINT size) +{ + ITEM *t; + // Validate arguments + if (f == NULL || name == NULL || str == NULL) + { + return false; + } + + str[0] = 0; + + t = CfgFindItem(f, name); + if (t == NULL) + { + return false; + } + if (t->Type != ITEM_TYPE_STRING) + { + return false; + } + UniStrCpy(str, size, t->Buf); + return true; +} + +// Check for the existence of item +bool CfgIsItem(FOLDER *f, char *name) +{ + ITEM *t; + // Validate arguments + if (f == NULL || name == NULL) + { + return false; + } + + t = CfgFindItem(f, name); + if (t == NULL) + { + return false; + } + + return true; +} + +// Get the byte[] type as a BUF +BUF *CfgGetBuf(FOLDER *f, char *name) +{ + ITEM *t; + BUF *b; + // Validate arguments + if (f == NULL || name == NULL) + { + return NULL; + } + + t = CfgFindItem(f, name); + if (t == NULL) + { + return NULL; + } + + b = NewBuf(); + WriteBuf(b, t->Buf, t->size); + SeekBuf(b, 0, 0); + + return b; +} + +// Get the value of type byte[] +UINT CfgGetByte(FOLDER *f, char *name, void *buf, UINT size) +{ + ITEM *t; + // Validate arguments + if (f == NULL || name == NULL || buf == NULL) + { + return 0; + } + + t = CfgFindItem(f, name); + if (t == NULL) + { + return 0; + } + if (t->Type != ITEM_TYPE_BYTE) + { + return 0; + } + if (t->size <= size) + { + Copy(buf, t->Buf, t->size); + return t->size; + } + else + { + Copy(buf, t->Buf, size); + return t->size; + } +} + +// Get the value of type int64 +UINT64 CfgGetInt64(FOLDER *f, char *name) +{ + ITEM *t; + UINT64 *ret; + // Validate arguments + if (f == NULL || name == NULL) + { + return 0; + } + + t = CfgFindItem(f, name); + if (t == NULL) + { + return 0; + } + if (t->Type != ITEM_TYPE_INT64) + { + return 0; + } + if (t->size != sizeof(UINT64)) + { + return 0; + } + + ret = (UINT64 *)t->Buf; + return *ret; +} + +// Get the value of the bool type +bool CfgGetBool(FOLDER *f, char *name) +{ + ITEM *t; + bool *ret; + // Validate arguments + if (f == NULL || name == NULL) + { + return 0; + } + + t = CfgFindItem(f, name); + if (t == NULL) + { + return 0; + } + if (t->Type != ITEM_TYPE_BOOL) + { + return 0; + } + if (t->size != sizeof(bool)) + { + return 0; + } + + ret = (bool *)t->Buf; + if (*ret == false) + { + return false; + } + else + { + return true; + } +} + +// Get the value of the int type +UINT CfgGetInt(FOLDER *f, char *name) +{ + ITEM *t; + UINT *ret; + // Validate arguments + if (f == NULL || name == NULL) + { + return 0; + } + + t = CfgFindItem(f, name); + if (t == NULL) + { + return 0; + } + if (t->Type != ITEM_TYPE_INT) + { + return 0; + } + if (t->size != sizeof(UINT)) + { + return 0; + } + + ret = (UINT *)t->Buf; + return *ret; +} + +// Search for an item +ITEM *CfgFindItem(FOLDER *parent, char *name) +{ + ITEM *t, tt; + // Validate arguments + if (parent == NULL || name == NULL) + { + return NULL; + } + + tt.Name = ZeroMalloc(StrLen(name) + 1); + StrCpy(tt.Name, 0, name); + t = Search(parent->Items, &tt); + Free(tt.Name); + + return t; +} + +// Get a folder +FOLDER *CfgGetFolder(FOLDER *parent, char *name) +{ + return CfgFindFolder(parent, name); +} + +// Search a folder +FOLDER *CfgFindFolder(FOLDER *parent, char *name) +{ + FOLDER *f, ff; + // Validate arguments + if (parent == NULL || name == NULL) + { + return NULL; + } + + ff.Name = ZeroMalloc(StrLen(name) + 1); + StrCpy(ff.Name, 0, name); + f = Search(parent->Folders, &ff); + Free(ff.Name); + + return f; +} + +// Adding a string type +ITEM *CfgAddStr(FOLDER *f, char *name, char *str) +{ + wchar_t *tmp; + UINT tmp_size; + ITEM *t; + // Validate arguments + if (f == NULL || name == NULL || str == NULL) + { + return NULL; + } + + // Convert to a Unicode string + tmp_size = CalcStrToUni(str); + if (tmp_size == 0) + { + return NULL; + } + tmp = Malloc(tmp_size); + StrToUni(tmp, tmp_size, str); + t = CfgAddUniStr(f, name, tmp); + Free(tmp); + + return t; +} + +// Add unicode_string type +ITEM *CfgAddUniStr(FOLDER *f, char *name, wchar_t *str) +{ + // Validate arguments + if (f == NULL || name == NULL || str == NULL) + { + return NULL; + } + + return CfgCreateItem(f, name, ITEM_TYPE_STRING, str, UniStrSize(str)); +} + +// Add a binary +ITEM *CfgAddBuf(FOLDER *f, char *name, BUF *b) +{ + // Validate arguments + if (f == NULL || name == NULL || b == NULL) + { + return NULL; + } + return CfgAddByte(f, name, b->Buf, b->Size); +} + +// Add byte type +ITEM *CfgAddByte(FOLDER *f, char *name, void *buf, UINT size) +{ + // Validate arguments + if (f == NULL || name == NULL || buf == NULL) + { + return NULL; + } + return CfgCreateItem(f, name, ITEM_TYPE_BYTE, buf, size); +} + +// Add a 64-bit integer type +ITEM *CfgAddInt64(FOLDER *f, char *name, UINT64 i) +{ + // Validate arguments + if (f == NULL || name == NULL) + { + return NULL; + } + return CfgCreateItem(f, name, ITEM_TYPE_INT64, &i, sizeof(UINT64)); +} + +// Get an IP address type +bool CfgGetIp(FOLDER *f, char *name, struct IP *ip) +{ + char tmp[MAX_SIZE]; + // Validate arguments + if (f == NULL || name == NULL || ip == NULL) + { + return false; + } + + Zero(ip, sizeof(IP)); + + if (CfgGetStr(f, name, tmp, sizeof(tmp)) == false) + { + return false; + } + + if (StrToIP(ip, tmp) == false) + { + return false; + } + + return true; +} +UINT CfgGetIp32(FOLDER *f, char *name) +{ + IP p; + // Validate arguments + if (f == NULL || name == NULL) + { + return 0; + } + + if (CfgGetIp(f, name, &p) == false) + { + return 0; + } + + return IPToUINT(&p); +} +bool CfgGetIp6Addr(FOLDER *f, char *name, IPV6_ADDR *addr) +{ + IP ip; + // Validate arguments + Zero(addr, sizeof(IPV6_ADDR)); + if (f == NULL || name == NULL || addr == NULL) + { + return false; + } + + if (CfgGetIp(f, name, &ip) == false) + { + return false; + } + + if (IsIP6(&ip) == false) + { + return false; + } + + if (IPToIPv6Addr(addr, &ip) == false) + { + return false; + } + + return true; +} + +// Add an IP address type +ITEM *CfgAddIp(FOLDER *f, char *name, struct IP *ip) +{ + char tmp[MAX_SIZE]; + // Validate arguments + if (f == NULL || name == NULL || ip == NULL) + { + return NULL; + } + + IPToStr(tmp, sizeof(tmp), ip); + + return CfgAddStr(f, name, tmp); +} +ITEM *CfgAddIp32(FOLDER *f, char *name, UINT ip) +{ + IP p; + // Validate arguments + if (f == NULL || name == NULL) + { + return NULL; + } + + UINTToIP(&p, ip); + + return CfgAddIp(f, name, &p); +} +ITEM *CfgAddIp6Addr(FOLDER *f, char *name, IPV6_ADDR *addr) +{ + IP ip; + // Validate arguments + if (f == NULL || name == NULL || addr == NULL) + { + return NULL; + } + + IPv6AddrToIP(&ip, addr); + + return CfgAddIp(f, name, &ip); +} + +// Add an integer type +ITEM *CfgAddInt(FOLDER *f, char *name, UINT i) +{ + // Validate arguments + if (f == NULL || name == NULL) + { + return NULL; + } + return CfgCreateItem(f, name, ITEM_TYPE_INT, &i, sizeof(UINT)); +} + +// Adding a bool type +ITEM *CfgAddBool(FOLDER *f, char *name, bool b) +{ + // Validate arguments + if (f == NULL || name == NULL) + { + return NULL; + } + + return CfgCreateItem(f, name, ITEM_TYPE_BOOL, &b, sizeof(bool)); +} + +// Comparison function of the item names +int CmpItemName(void *p1, void *p2) +{ + ITEM *f1, *f2; + if (p1 == NULL || p2 == NULL) + { + return 0; + } + f1 = *(ITEM **)p1; + f2 = *(ITEM **)p2; + if (f1 == NULL || f2 == NULL) + { + return 0; + } + return StrCmpi(f1->Name, f2->Name); +} + +// Comparison function of the folder names +int CmpFolderName(void *p1, void *p2) +{ + FOLDER *f1, *f2; + if (p1 == NULL || p2 == NULL) + { + return 0; + } + f1 = *(FOLDER **)p1; + f2 = *(FOLDER **)p2; + if (f1 == NULL || f2 == NULL) + { + return 0; + } + return StrCmpi(f1->Name, f2->Name); +} + +// Enumeration of items +void CfgEnumItem(FOLDER *f, ENUM_ITEM proc, void *param) +{ + UINT i; + // Validate arguments + if (f == NULL || proc == NULL) + { + return; + } + + for (i = 0;i < LIST_NUM(f->Items);i++) + { + ITEM *tt = LIST_DATA(f->Items, i); + if (proc(tt, param) == false) + { + break; + } + } +} + +// Enumerate the folders and store it in the token list +TOKEN_LIST *CfgEnumFolderToTokenList(FOLDER *f) +{ + TOKEN_LIST *t, *ret; + UINT i; + // Validate arguments + if (f == NULL) + { + return NULL; + } + + t = ZeroMalloc(sizeof(TOKEN_LIST)); + t->NumTokens = LIST_NUM(f->Folders); + t->Token = ZeroMalloc(sizeof(char *) * t->NumTokens); + + for (i = 0;i < t->NumTokens;i++) + { + FOLDER *ff = LIST_DATA(f->Folders, i); + t->Token[i] = CopyStr(ff->Name); + } + + ret = UniqueToken(t); + FreeToken(t); + + return ret; +} + +// Enumerate items and store these to the token list +TOKEN_LIST *CfgEnumItemToTokenList(FOLDER *f) +{ + TOKEN_LIST *t, *ret; + UINT i; + // Validate arguments + if (f == NULL) + { + return NULL; + } + + t = ZeroMalloc(sizeof(TOKEN_LIST)); + t->NumTokens = LIST_NUM(f->Items); + t->Token = ZeroMalloc(sizeof(char *) * t->NumTokens); + + for (i = 0;i < t->NumTokens;i++) + { + FOLDER *ff = LIST_DATA(f->Items, i); + t->Token[i] = CopyStr(ff->Name); + } + + ret = UniqueToken(t); + FreeToken(t); + + return ret; +} + +// Folder enumeration +void CfgEnumFolder(FOLDER *f, ENUM_FOLDER proc, void *param) +{ + UINT i; + // Validate arguments + if (f == NULL || proc == NULL) + { + return; + } + + for (i = 0;i < LIST_NUM(f->Folders);i++) + { + FOLDER *ff = LIST_DATA(f->Folders, i); + if (proc(ff, param) == false) + { + break; + } + + if ((i % 100) == 99) + { + YieldCpu(); + } + } +} + +// Create an item +ITEM *CfgCreateItem(FOLDER *parent, char *name, UINT type, void *buf, UINT size) +{ + UINT name_size; + ITEM *t; +#ifdef CHECK_CFG_NAME_EXISTS + ITEM tt; +#endif // CHECK_CFG_NAME_EXISTS + // Validate arguments + if (parent == NULL || name == NULL || type == 0 || buf == NULL) + { + return NULL; + } + + name_size = StrLen(name) + 1; + +#ifdef CHECK_CFG_NAME_EXISTS + + // Check whether there are any items with the same name already + tt.Name = ZeroMalloc(name_size); + StrCpy(tt.Name, 0, name); + t = Search(parent->Items, &tt); + Free(tt.Name); + if (t != NULL) + { + // Duplicated + return NULL; + } + +#endif // CHECK_CFG_NAME_EXISTS + + t = ZeroMalloc(sizeof(ITEM)); + t->Buf = Malloc(size); + Copy(t->Buf, buf, size); + t->Name = ZeroMalloc(name_size); + StrCpy(t->Name, 0, name); + t->Type = type; + t->size = size; + t->Parent = parent; + + // Add to the parent list + Insert(parent->Items, t); + + return t; +} + +// Delete the item +void CfgDeleteItem(ITEM *t) +{ + // Validate arguments + if (t == NULL) + { + return; + } + + // Remove from the parent list + Delete(t->Parent->Items, t); + + // Memory release + Free(t->Buf); + Free(t->Name); + Free(t); +} + + +// Delete the folder +void CfgDeleteFolder(FOLDER *f) +{ + FOLDER **ff; + ITEM **tt; + UINT num, i; + // Validate arguments + if (f == NULL) + { + return; + } + + if(f->Folders == NULL) + { + return; + } + + // Remove all subfolders + num = LIST_NUM(f->Folders); + if (num != 0) + { + ff = Malloc(sizeof(FOLDER *) * num); + Copy(ff, f->Folders->p, sizeof(FOLDER *) * num); + for (i = 0;i < num;i++) + { + CfgDeleteFolder(ff[i]); + } + Free(ff); + } + + // Remove all items + num = LIST_NUM(f->Items); + if (num != 0) + { + tt = Malloc(sizeof(ITEM *) * num); + Copy(tt, f->Items->p, sizeof(ITEM *) * num); + for (i = 0;i < num;i++) + { + CfgDeleteItem(tt[i]); + } + Free(tt); + } + + // Memory release + Free(f->Name); + // Remove from the parent list + if (f->Parent != NULL) + { + Delete(f->Parent->Folders, f); + } + // Release the list + ReleaseList(f->Folders); + ReleaseList(f->Items); + + // Release of the memory of the body + Free(f); +} + +// Creating a root +FOLDER *CfgCreateRoot() +{ + return CfgCreateFolder(NULL, TAG_ROOT); +} + +// Create a folder +FOLDER *CfgCreateFolder(FOLDER *parent, char *name) +{ + UINT size; + FOLDER *f; + // Validate arguments + if (name == NULL) + { + return NULL; + } + + size = StrLen(name) + 1; + +#ifdef CHECK_CFG_NAME_EXISTS + + // Check the name in the parent list + if (parent != NULL) + { + FOLDER ff; + ff.Name = ZeroMalloc(size); + StrCpy(ff.Name, 0, name); + f = Search(parent->Folders, &ff); + Free(ff.Name); + if (f != NULL) + { + // Folder with the same name already exists + return NULL; + } + } + +#endif // CHECK_CFG_NAME_EXISTS + + f = ZeroMalloc(sizeof(FOLDER)); + f->Items = NewListFast(CmpItemName); + f->Folders = NewListFast(CmpFolderName); + f->Name = ZeroMalloc(size); + StrCpy(f->Name, 0, name); + f->Parent = parent; + + // Add to parentlist + if (f->Parent != NULL) + { + Insert(f->Parent->Folders, f); + } + return f; +} + + diff --git a/src/Mayaqua/Cfg.h b/src/Mayaqua/Cfg.h index 580cadbd..e9a98541 100644 --- a/src/Mayaqua/Cfg.h +++ b/src/Mayaqua/Cfg.h @@ -1,165 +1,165 @@ -// SoftEther VPN Source Code - Developer Edition Master Branch -// Mayaqua Kernel - - -// Cfg.h -// Header of Cfg.c - -#ifndef CFG_H -#define CFG_H - -// Macro -//#define CHECK_CFG_NAME_EXISTS // Check duplication of the existing name - -#define SAVE_BINARY_FILE_NAME_SWITCH L"$save_binary" - -// Constants -#define TAG_DECLARE "declare" -#define TAG_STRING "string" -#define TAG_INT "uint" -#define TAG_INT64 "uint64" -#define TAG_BOOL "bool" -#define TAG_BYTE "byte" -#define TAG_TRUE "true" -#define TAG_FALSE "false" -#define TAG_END "end" -#define TAG_ROOT "root" - -#define TAG_CPYRIGHT "\xef\xbb\xbf# Software Configuration File\r\n# ---------------------------\r\n# \r\n# You may edit this file when the VPN Server / Client / Bridge program is not running.\r\n# \r\n# In prior to edit this file manually by your text editor,\r\n# shutdown the VPN Server / Client / Bridge background service.\r\n# Otherwise, all changes will be lost.\r\n# \r\n" -#define TAG_BINARY "SEVPN_DB" - -// Data type -#define ITEM_TYPE_INT 1 // int -#define ITEM_TYPE_INT64 2 // int64 -#define ITEM_TYPE_BYTE 3 // byte -#define ITEM_TYPE_STRING 4 // string -#define ITEM_TYPE_BOOL 5 // bool - -// Folder -struct FOLDER -{ - char *Name; // Folder name - LIST *Items; // List of items - LIST *Folders; // Subfolder - struct FOLDER *Parent; // Parent Folder -}; - -// Item -struct ITEM -{ - char *Name; // Item Name - UINT Type; // Data type - void *Buf; // Data - UINT size; // Data size - FOLDER *Parent; // Parent Folder -}; - -// Configuration file reader and writer -struct CFG_RW -{ - LOCK *lock; // Lock - char *FileName; // File name (ANSI) - wchar_t *FileNameW; // File name (Unicode) - IO *Io; // IO - UCHAR LashHash[SHA1_SIZE]; // Hash value which is written last - bool DontBackup; // Do not use the backup - wchar_t LastSavedDateStr[MAX_SIZE]; // Date and time string that last saved -}; - -typedef bool (*ENUM_FOLDER)(FOLDER *f, void *param); -typedef bool (*ENUM_ITEM)(ITEM *t, void *param); - -// Parameters for the enumeration -struct CFG_ENUM_PARAM -{ - BUF *b; - FOLDER *f; - UINT depth; -}; - -int CmpItemName(void *p1, void *p2); -int CmpFolderName(void *p1, void *p2); -ITEM *CfgCreateItem(FOLDER *parent, char *name, UINT type, void *buf, UINT size); -void CfgDeleteFolder(FOLDER *f); -FOLDER *CfgCreateFolder(FOLDER *parent, char *name); -void CfgEnumFolder(FOLDER *f, ENUM_FOLDER proc, void *param); -TOKEN_LIST *CfgEnumFolderToTokenList(FOLDER *f); -TOKEN_LIST *CfgEnumItemToTokenList(FOLDER *f); -void CfgEnumItem(FOLDER *f, ENUM_ITEM proc, void *param); -FOLDER *CfgFindFolder(FOLDER *parent, char *name); -ITEM *CfgFindItem(FOLDER *parent, char *name); -ITEM *CfgAddInt(FOLDER *f, char *name, UINT i); -ITEM *CfgAddBool(FOLDER *f, char *name, bool b); -ITEM *CfgAddInt64(FOLDER *f, char *name, UINT64 i); -ITEM *CfgAddByte(FOLDER *f, char *name, void *buf, UINT size); -ITEM *CfgAddBuf(FOLDER *f, char *name, BUF *b); -ITEM *CfgAddStr(FOLDER *f, char *name, char *str); -ITEM *CfgAddUniStr(FOLDER *f, char *name, wchar_t *str); -FOLDER *CfgGetFolder(FOLDER *parent, char *name); -UINT CfgGetInt(FOLDER *f, char *name); -bool CfgGetBool(FOLDER *f, char *name); -UINT64 CfgGetInt64(FOLDER *f, char *name); -UINT CfgGetByte(FOLDER *f, char *name, void *buf, UINT size); -BUF *CfgGetBuf(FOLDER *f, char *name); -bool CfgGetStr(FOLDER *f, char *name, char *str, UINT size); -bool CfgGetUniStr(FOLDER *f, char *name, wchar_t *str, UINT size); -bool CfgIsItem(FOLDER *f, char *name); -char *CfgEscape(char *name); -bool CfgCheckCharForName(char c); -char *CfgUnescape(char *str); -BUF *CfgFolderToBuf(FOLDER *f, bool textmode); -BUF *CfgFolderToBufEx(FOLDER *f, bool textmode, bool no_banner); -BUF *CfgFolderToBufTextEx(FOLDER *f, bool no_banner); -BUF *CfgFolderToBufBin(FOLDER *f); -void CfgOutputFolderText(BUF *b, FOLDER *f, UINT depth); -void CfgOutputFolderBin(BUF *b, FOLDER *f); -void CfgAddLine(BUF *b, char *str, UINT depth); -void CfgAddDeclare(BUF *b, char *name, UINT depth); -void CfgAddEnd(BUF *b, UINT depth); -void CfgAddData(BUF *b, UINT type, char *name, char *data, char *sub, UINT depth); -char *CfgTypeToStr(UINT type); -void CfgAddItemText(BUF *b, ITEM *t, UINT depth); -bool CfgEnumFolderProc(FOLDER *f, void *param); -bool CfgEnumItemProc(ITEM *t, void *param); -FOLDER *CfgBufTextToFolder(BUF *b); -FOLDER *CfgBufBinToFolder(BUF *b); -void CfgReadNextFolderBin(BUF *b, FOLDER *parent); -char *CfgReadNextLine(BUF *b); -bool CfgReadNextTextBUF(BUF *b, FOLDER *current); -void CfgSave(FOLDER *f, char *name); -void CfgSaveW(FOLDER *f, wchar_t *name); -bool CfgSaveEx(CFG_RW *rw, FOLDER *f, char *name); -bool CfgSaveExW(CFG_RW *rw, FOLDER *f, wchar_t *name); -bool CfgSaveExW2(CFG_RW *rw, FOLDER *f, wchar_t *name, UINT *written_size); -bool CfgSaveExW3(CFG_RW *rw, FOLDER *f, wchar_t *name, UINT *written_size, bool write_binary); -FOLDER *CfgRead(char *name); -FOLDER *CfgReadW(wchar_t *name); -FOLDER *CfgCreateRoot(); -void CfgTest(); -void CfgTest2(FOLDER *f, UINT n); -CFG_RW *NewCfgRw(FOLDER **root, char *cfg_name); -CFG_RW *NewCfgRwEx(FOLDER **root, char *cfg_name, bool dont_backup); -CFG_RW *NewCfgRwExW(FOLDER **root, wchar_t *cfg_name, bool dont_backup); -CFG_RW *NewCfgRwEx2W(FOLDER **root, wchar_t *cfg_name, bool dont_backup, wchar_t *template_name); -CFG_RW *NewCfgRwEx2A(FOLDER **root, char *cfg_name_a, bool dont_backup, char *template_name_a); -UINT SaveCfgRw(CFG_RW *rw, FOLDER *f); -UINT SaveCfgRwEx(CFG_RW *rw, FOLDER *f, UINT revision_number); -void FreeCfgRw(CFG_RW *rw); -ITEM *CfgAddIp32(FOLDER *f, char *name, UINT ip); -UINT CfgGetIp32(FOLDER *f, char *name); -bool CfgGetIp6Addr(FOLDER *f, char *name, IPV6_ADDR *addr); -ITEM *CfgAddIp6Addr(FOLDER *f, char *name, IPV6_ADDR *addr); -bool FileCopy(char *src, char *dst); -bool FileCopyW(wchar_t *src, wchar_t *dst); -bool FileCopyExW(wchar_t *src, wchar_t *dst, bool read_lock); -void BackupCfgWEx(CFG_RW *rw, FOLDER *f, wchar_t *original, UINT revision_number); - -#if (!defined(CFG_C)) || (!defined(OS_UNIX)) -bool CfgGetIp(FOLDER *f, char *name, struct IP *ip); -ITEM *CfgAddIp(FOLDER *f, char *name, struct IP *ip); -#endif - -#endif // CFG_H - - - +// SoftEther VPN Source Code - Developer Edition Master Branch +// Mayaqua Kernel + + +// Cfg.h +// Header of Cfg.c + +#ifndef CFG_H +#define CFG_H + +// Macro +//#define CHECK_CFG_NAME_EXISTS // Check duplication of the existing name + +#define SAVE_BINARY_FILE_NAME_SWITCH L"$save_binary" + +// Constants +#define TAG_DECLARE "declare" +#define TAG_STRING "string" +#define TAG_INT "uint" +#define TAG_INT64 "uint64" +#define TAG_BOOL "bool" +#define TAG_BYTE "byte" +#define TAG_TRUE "true" +#define TAG_FALSE "false" +#define TAG_END "end" +#define TAG_ROOT "root" + +#define TAG_CPYRIGHT "\xef\xbb\xbf# Software Configuration File\r\n# ---------------------------\r\n# \r\n# You may edit this file when the VPN Server / Client / Bridge program is not running.\r\n# \r\n# In prior to edit this file manually by your text editor,\r\n# shutdown the VPN Server / Client / Bridge background service.\r\n# Otherwise, all changes will be lost.\r\n# \r\n" +#define TAG_BINARY "SEVPN_DB" + +// Data type +#define ITEM_TYPE_INT 1 // int +#define ITEM_TYPE_INT64 2 // int64 +#define ITEM_TYPE_BYTE 3 // byte +#define ITEM_TYPE_STRING 4 // string +#define ITEM_TYPE_BOOL 5 // bool + +// Folder +struct FOLDER +{ + char *Name; // Folder name + LIST *Items; // List of items + LIST *Folders; // Subfolder + struct FOLDER *Parent; // Parent Folder +}; + +// Item +struct ITEM +{ + char *Name; // Item Name + UINT Type; // Data type + void *Buf; // Data + UINT size; // Data size + FOLDER *Parent; // Parent Folder +}; + +// Configuration file reader and writer +struct CFG_RW +{ + LOCK *lock; // Lock + char *FileName; // File name (ANSI) + wchar_t *FileNameW; // File name (Unicode) + IO *Io; // IO + UCHAR LashHash[SHA1_SIZE]; // Hash value which is written last + bool DontBackup; // Do not use the backup + wchar_t LastSavedDateStr[MAX_SIZE]; // Date and time string that last saved +}; + +typedef bool (*ENUM_FOLDER)(FOLDER *f, void *param); +typedef bool (*ENUM_ITEM)(ITEM *t, void *param); + +// Parameters for the enumeration +struct CFG_ENUM_PARAM +{ + BUF *b; + FOLDER *f; + UINT depth; +}; + +int CmpItemName(void *p1, void *p2); +int CmpFolderName(void *p1, void *p2); +ITEM *CfgCreateItem(FOLDER *parent, char *name, UINT type, void *buf, UINT size); +void CfgDeleteFolder(FOLDER *f); +FOLDER *CfgCreateFolder(FOLDER *parent, char *name); +void CfgEnumFolder(FOLDER *f, ENUM_FOLDER proc, void *param); +TOKEN_LIST *CfgEnumFolderToTokenList(FOLDER *f); +TOKEN_LIST *CfgEnumItemToTokenList(FOLDER *f); +void CfgEnumItem(FOLDER *f, ENUM_ITEM proc, void *param); +FOLDER *CfgFindFolder(FOLDER *parent, char *name); +ITEM *CfgFindItem(FOLDER *parent, char *name); +ITEM *CfgAddInt(FOLDER *f, char *name, UINT i); +ITEM *CfgAddBool(FOLDER *f, char *name, bool b); +ITEM *CfgAddInt64(FOLDER *f, char *name, UINT64 i); +ITEM *CfgAddByte(FOLDER *f, char *name, void *buf, UINT size); +ITEM *CfgAddBuf(FOLDER *f, char *name, BUF *b); +ITEM *CfgAddStr(FOLDER *f, char *name, char *str); +ITEM *CfgAddUniStr(FOLDER *f, char *name, wchar_t *str); +FOLDER *CfgGetFolder(FOLDER *parent, char *name); +UINT CfgGetInt(FOLDER *f, char *name); +bool CfgGetBool(FOLDER *f, char *name); +UINT64 CfgGetInt64(FOLDER *f, char *name); +UINT CfgGetByte(FOLDER *f, char *name, void *buf, UINT size); +BUF *CfgGetBuf(FOLDER *f, char *name); +bool CfgGetStr(FOLDER *f, char *name, char *str, UINT size); +bool CfgGetUniStr(FOLDER *f, char *name, wchar_t *str, UINT size); +bool CfgIsItem(FOLDER *f, char *name); +char *CfgEscape(char *name); +bool CfgCheckCharForName(char c); +char *CfgUnescape(char *str); +BUF *CfgFolderToBuf(FOLDER *f, bool textmode); +BUF *CfgFolderToBufEx(FOLDER *f, bool textmode, bool no_banner); +BUF *CfgFolderToBufTextEx(FOLDER *f, bool no_banner); +BUF *CfgFolderToBufBin(FOLDER *f); +void CfgOutputFolderText(BUF *b, FOLDER *f, UINT depth); +void CfgOutputFolderBin(BUF *b, FOLDER *f); +void CfgAddLine(BUF *b, char *str, UINT depth); +void CfgAddDeclare(BUF *b, char *name, UINT depth); +void CfgAddEnd(BUF *b, UINT depth); +void CfgAddData(BUF *b, UINT type, char *name, char *data, char *sub, UINT depth); +char *CfgTypeToStr(UINT type); +void CfgAddItemText(BUF *b, ITEM *t, UINT depth); +bool CfgEnumFolderProc(FOLDER *f, void *param); +bool CfgEnumItemProc(ITEM *t, void *param); +FOLDER *CfgBufTextToFolder(BUF *b); +FOLDER *CfgBufBinToFolder(BUF *b); +void CfgReadNextFolderBin(BUF *b, FOLDER *parent); +char *CfgReadNextLine(BUF *b); +bool CfgReadNextTextBUF(BUF *b, FOLDER *current); +void CfgSave(FOLDER *f, char *name); +void CfgSaveW(FOLDER *f, wchar_t *name); +bool CfgSaveEx(CFG_RW *rw, FOLDER *f, char *name); +bool CfgSaveExW(CFG_RW *rw, FOLDER *f, wchar_t *name); +bool CfgSaveExW2(CFG_RW *rw, FOLDER *f, wchar_t *name, UINT *written_size); +bool CfgSaveExW3(CFG_RW *rw, FOLDER *f, wchar_t *name, UINT *written_size, bool write_binary); +FOLDER *CfgRead(char *name); +FOLDER *CfgReadW(wchar_t *name); +FOLDER *CfgCreateRoot(); +void CfgTest(); +void CfgTest2(FOLDER *f, UINT n); +CFG_RW *NewCfgRw(FOLDER **root, char *cfg_name); +CFG_RW *NewCfgRwEx(FOLDER **root, char *cfg_name, bool dont_backup); +CFG_RW *NewCfgRwExW(FOLDER **root, wchar_t *cfg_name, bool dont_backup); +CFG_RW *NewCfgRwEx2W(FOLDER **root, wchar_t *cfg_name, bool dont_backup, wchar_t *template_name); +CFG_RW *NewCfgRwEx2A(FOLDER **root, char *cfg_name_a, bool dont_backup, char *template_name_a); +UINT SaveCfgRw(CFG_RW *rw, FOLDER *f); +UINT SaveCfgRwEx(CFG_RW *rw, FOLDER *f, UINT revision_number); +void FreeCfgRw(CFG_RW *rw); +ITEM *CfgAddIp32(FOLDER *f, char *name, UINT ip); +UINT CfgGetIp32(FOLDER *f, char *name); +bool CfgGetIp6Addr(FOLDER *f, char *name, IPV6_ADDR *addr); +ITEM *CfgAddIp6Addr(FOLDER *f, char *name, IPV6_ADDR *addr); +bool FileCopy(char *src, char *dst); +bool FileCopyW(wchar_t *src, wchar_t *dst); +bool FileCopyExW(wchar_t *src, wchar_t *dst, bool read_lock); +void BackupCfgWEx(CFG_RW *rw, FOLDER *f, wchar_t *original, UINT revision_number); + +#if (!defined(CFG_C)) || (!defined(OS_UNIX)) +bool CfgGetIp(FOLDER *f, char *name, struct IP *ip); +ITEM *CfgAddIp(FOLDER *f, char *name, struct IP *ip); +#endif + +#endif // CFG_H + + + diff --git a/src/Mayaqua/Encrypt.c b/src/Mayaqua/Encrypt.c index db070a55..363e538f 100644 --- a/src/Mayaqua/Encrypt.c +++ b/src/Mayaqua/Encrypt.c @@ -1,4606 +1,4606 @@ -// SoftEther VPN Source Code - Developer Edition Master Branch -// Mayaqua Kernel -// © 2020 Nokia - -// Encrypt.c -// Encryption and digital certification routine - -#include - -#define ENCRYPT_C - -#define __WINCRYPT_H__ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#ifdef _MSC_VER - #include // For __cpuid() -#else // _MSC_VER - - -#ifndef SKIP_CPU_FEATURES - #include "cpu_features_macros.h" -#endif - - #if defined(CPU_FEATURES_ARCH_X86) - #include "cpuinfo_x86.h" - #elif defined(CPU_FEATURES_ARCH_ARM) - #include "cpuinfo_arm.h" - #elif defined(CPU_FEATURES_ARCH_AARCH64) - #include "cpuinfo_aarch64.h" - #elif defined(CPU_FEATURES_ARCH_MIPS) - #include "cpuinfo_mips.h" - #elif defined(CPU_FEATURES_ARCH_PPC) - #include "cpuinfo_ppc.h" - #endif -#endif // _MSC_VER - -LOCK *openssl_lock = NULL; - -int ssl_clientcert_index = 0; - -LOCK **ssl_lock_obj = NULL; -UINT ssl_lock_num; -static bool openssl_inited = false; - -static UINT Internal_HMac(const EVP_MD *md, void *dest, void *key, UINT key_size, const void *src, const UINT src_size); -static void Internal_Sha0(unsigned char *dest, const unsigned char *src, const UINT size); - -// For the callback function -typedef struct CB_PARAM -{ - char *password; -} CB_PARAM; - -// Copied from t1_enc.c of OpenSSL -void Enc_tls1_P_hash(const EVP_MD *md, const unsigned char *sec, int sec_len, - const unsigned char *seed, int seed_len, unsigned char *out, int olen) -{ - int chunk,n; - unsigned int j; - HMAC_CTX *ctx; - HMAC_CTX *ctx_tmp; - unsigned char A1[EVP_MAX_MD_SIZE]; - unsigned int A1_len; - -#if OPENSSL_VERSION_NUMBER >= 0x10100000L - ctx = HMAC_CTX_new(); - ctx_tmp = HMAC_CTX_new(); -#else - HMAC_CTX ctx_; - HMAC_CTX ctx_tmp_; - ctx = &ctx_; - ctx_tmp = &ctx_tmp_; - Zero(ctx, sizeof(HMAC_CTX)); - Zero(ctx_tmp, sizeof(HMAC_CTX)); -#endif - chunk=EVP_MD_size(md); - - HMAC_Init_ex(ctx,sec,sec_len,md, NULL); - HMAC_Init_ex(ctx_tmp,sec,sec_len,md, NULL); - HMAC_Update(ctx,seed,seed_len); - HMAC_Final(ctx,A1,&A1_len); - - n=0; - for (;;) - { - HMAC_Init_ex(ctx,NULL,0,NULL,NULL); /* re-init */ - HMAC_Init_ex(ctx_tmp,NULL,0,NULL,NULL); /* re-init */ - HMAC_Update(ctx,A1,A1_len); - HMAC_Update(ctx_tmp,A1,A1_len); - HMAC_Update(ctx,seed,seed_len); - - if (olen > chunk) - { - HMAC_Final(ctx,out,&j); - out+=j; - olen-=j; - HMAC_Final(ctx_tmp,A1,&A1_len); /* calc the next A1 value */ - } - else /* last one */ - { - HMAC_Final(ctx,A1,&A1_len); - memcpy(out,A1,olen); - break; - } - } -#if OPENSSL_VERSION_NUMBER >= 0x10100000L - HMAC_CTX_free(ctx); - HMAC_CTX_free(ctx_tmp); -#else - HMAC_CTX_cleanup(ctx); - HMAC_CTX_cleanup(ctx_tmp); -#endif - Zero (A1, sizeof(A1)); -} - -void Enc_tls1_PRF(unsigned char *label, int label_len, const unsigned char *sec, - int slen, unsigned char *out1, int olen) -{ - const EVP_MD *md5 = EVP_md5(); - const EVP_MD *sha1 = EVP_sha1(); - int len,i; - const unsigned char *S1,*S2; - unsigned char *out2; - - out2 = (unsigned char *) Malloc (olen); - - len=slen/2; - S1=sec; - S2= &(sec[len]); - len+=(slen&1); /* add for odd, make longer */ - - - Enc_tls1_P_hash(md5 ,S1,len,label,label_len,out1,olen); - Enc_tls1_P_hash(sha1,S2,len,label,label_len,out2,olen); - - for (i=0; iName, sizeof(m->Name), name); - - if (StrCmpi(name, "[null-digest]") == 0 || - StrCmpi(name, "NULL") == 0 || - IsEmptyStr(name)) - { - m->IsNullMd = true; - return m; - } - - m->Md = (const struct evp_md_st *)EVP_get_digestbyname(name); - if (m->Md == NULL) - { - Debug("NewMdEx(): Algorithm %s not found by EVP_get_digestbyname().\n", m->Name); - FreeMd(m); - return NULL; - } - - m->Size = EVP_MD_size((const EVP_MD *)m->Md); - m->IsHMac = hmac; - - if (hmac) - { -#if OPENSSL_VERSION_NUMBER >= 0x10100000L - m->Ctx = HMAC_CTX_new(); -#else - m->Ctx = ZeroMalloc(sizeof(struct hmac_ctx_st)); - HMAC_CTX_init(m->Ctx); -#endif - } - else - { -#if OPENSSL_VERSION_NUMBER >= 0x10100000L - m->Ctx = EVP_MD_CTX_new(); -#else - m->Ctx = EVP_MD_CTX_create(); -#endif - if (EVP_DigestInit_ex(m->Ctx, m->Md, NULL) == false) - { - Debug("NewMdEx(): EVP_DigestInit_ex() failed with error: %s\n", OpenSSL_Error()); - FreeMd(m); - } - } - - return m; -} - -// Set the key to the message digest object -bool SetMdKey(MD *md, void *key, UINT key_size) -{ - // Validate arguments - if (md == NULL || md->IsHMac == false || key == NULL || key_size == 0) - { - return false; - } - - if (HMAC_Init_ex(md->Ctx, key, key_size, (const EVP_MD *)md->Md, NULL) == false) - { - Debug("SetMdKey(): HMAC_Init_ex() failed with error: %s\n", OpenSSL_Error()); - return false; - } - - return true; -} - -// Calculate the hash/HMAC -UINT MdProcess(MD *md, void *dest, void *src, UINT size) -{ - UINT len = 0; - - // Validate arguments - if (md == NULL || md->IsNullMd || dest == NULL || (src == NULL && size != 0)) - { - return 0; - } - - if (md->IsHMac) - { - // WARNING: Do not remove the call to HMAC_Init_ex(), it's required even if the context is initialized by SetMdKey()! - if (HMAC_Init_ex(md->Ctx, NULL, 0, NULL, NULL) == false) - { - Debug("MdProcess(): HMAC_Init_ex() failed with error: %s\n", OpenSSL_Error()); - return 0; - } - - if (HMAC_Update(md->Ctx, src, size) == false) - { - Debug("MdProcess(): HMAC_Update() failed with error: %s\n", OpenSSL_Error()); - return 0; - } - - if (HMAC_Final(md->Ctx, dest, &len) == false) - { - Debug("MdProcess(): HMAC_Final() failed with error: %s\n", OpenSSL_Error()); - } - } - else - { - if (EVP_DigestUpdate(md->Ctx, src, size) == false) - { - Debug("MdProcess(): EVP_DigestUpdate() failed with error: %s\n", OpenSSL_Error()); - return 0; - } - - if (EVP_DigestFinal_ex(md->Ctx, dest, &len) == false) - { - Debug("MdProcess(): EVP_DigestFinal_ex() failed with error: %s\n", OpenSSL_Error()); - } - } - - return len; -} - -// Release of the message digest object -void FreeMd(MD *md) -{ - // Validate arguments - if (md == NULL) - { - return; - } - - if (md->Ctx != NULL) - { - if (md->IsHMac) - { -#if OPENSSL_VERSION_NUMBER >= 0x10100000L - HMAC_CTX_free(md->Ctx); -#else - HMAC_CTX_cleanup(md->Ctx); - Free(md->Ctx); -#endif - } - else - { -#if OPENSSL_VERSION_NUMBER >= 0x10100000L - EVP_MD_CTX_free(md->Ctx); -#else - EVP_MD_CTX_destroy(md->Ctx); -#endif - } - } - - Free(md); -} - -// Creating a cipher object -CIPHER *NewCipher(char *name) -{ - CIPHER *c; - // Validate arguments - if (name == NULL) - { - return NULL; - } - - c = ZeroMalloc(sizeof(CIPHER)); - - StrCpy(c->Name, sizeof(c->Name), name); - - if (StrCmpi(name, "[null-cipher]") == 0 || - StrCmpi(name, "NULL") == 0 || - IsEmptyStr(name)) - { - c->IsNullCipher = true; - return c; - } - - c->Cipher = EVP_get_cipherbyname(c->Name); - if (c->Cipher == NULL) - { - Debug("NewCipher(): Cipher %s not found by EVP_get_cipherbyname().\n", c->Name); - FreeCipher(c); - return NULL; - } - -#if OPENSSL_VERSION_NUMBER >= 0x10100000L - c->Ctx = EVP_CIPHER_CTX_new(); -#else - c->Ctx = ZeroMalloc(sizeof(struct evp_cipher_ctx_st)); - EVP_CIPHER_CTX_init(c->Ctx); -#endif - - c->IsAeadCipher = EVP_CIPHER_flags(c->Cipher) & EVP_CIPH_FLAG_AEAD_CIPHER; - c->BlockSize = EVP_CIPHER_block_size(c->Cipher); - c->KeySize = EVP_CIPHER_key_length(c->Cipher); - c->IvSize = EVP_CIPHER_iv_length(c->Cipher); - - return c; -} - -// Set the key to the cipher object -void SetCipherKey(CIPHER *c, void *key, bool enc) -{ - // Validate arguments - if (c == NULL || key == NULL) - { - return; - } - - if (c->IsNullCipher == false) - { - if (c->Ctx != NULL) - { - EVP_CipherInit(c->Ctx, c->Cipher, key, NULL, enc); - } - } - - c->Encrypt = enc; -} - -// Process encryption / decryption -UINT CipherProcess(CIPHER *c, void *iv, void *dest, void *src, UINT size) -{ - int r = size; - int r2 = 0; - if (c != NULL && c->IsNullCipher) - { - if (dest != src) - { - Copy(dest, src, size); - } - return size; - } - // Validate arguments - if (c == NULL || iv == NULL || dest == NULL || src == NULL || size == 0) - { - return 0; - } - - if (EVP_CipherInit(c->Ctx, NULL, NULL, iv, c->Encrypt) == 0) - { - return 0; - } - - if (EVP_CipherUpdate(c->Ctx, dest, &r, src, size) == 0) - { - return 0; - } - - if (EVP_CipherFinal(c->Ctx, ((UCHAR *)dest) + (UINT)r, &r2) == 0) - { - return 0; - } - - return r + r2; -} - -// Process encryption / decryption (AEAD) -UINT CipherProcessAead(CIPHER *c, void *iv, void *tag, UINT tag_size, void *dest, void *src, UINT src_size, void *aad, UINT aad_size) -{ - int r = src_size; - int r2 = 0; - // Validate arguments - if (c == NULL) - { - return 0; - } - else if (c->IsNullCipher) - { - Copy(dest, src, src_size); - return src_size; - } - else if (c->IsAeadCipher == false || iv == NULL || tag == NULL || tag_size == 0 || dest == NULL || src == NULL || src_size == 0) - { - return 0; - } - - if (EVP_CipherInit_ex(c->Ctx, NULL, NULL, NULL, iv, c->Encrypt) == false) - { - Debug("CipherProcessAead(): EVP_CipherInit_ex() failed with error: %s\n", OpenSSL_Error()); - return 0; - } - - if (c->Encrypt == false) - { - if (EVP_CIPHER_CTX_ctrl(c->Ctx, EVP_CTRL_AEAD_SET_TAG, tag_size, tag) == false) - { - Debug("CipherProcessAead(): EVP_CIPHER_CTX_ctrl() failed to set the tag!\n"); - return 0; - } - } - - if (aad != NULL && aad_size != 0) - { - if (EVP_CipherUpdate(c->Ctx, NULL, &r, aad, aad_size) == false) - { - Debug("CipherProcessAead(): EVP_CipherUpdate() failed with error: %s\n", OpenSSL_Error()); - return 0; - } - } - - if (EVP_CipherUpdate(c->Ctx, dest, &r, src, src_size) == false) - { - Debug("CipherProcessAead(): EVP_CipherUpdate() failed with error: %s\n", OpenSSL_Error()); - return 0; - } - - if (EVP_CipherFinal_ex(c->Ctx, ((UCHAR *)dest) + (UINT)r, &r2) == false) - { - Debug("CipherProcessAead(): EVP_CipherFinal_ex() failed with error: %s\n", OpenSSL_Error()); - return 0; - } - - if (c->Encrypt) - { - if (EVP_CIPHER_CTX_ctrl(c->Ctx, EVP_CTRL_AEAD_GET_TAG, tag_size, tag) == false) - { - Debug("CipherProcessAead(): EVP_CIPHER_CTX_ctrl() failed to get the tag!\n"); - return 0; - } - } - - return r + r2; -} - -// Release of the cipher object -void FreeCipher(CIPHER *c) -{ - // Validate arguments - if (c == NULL) - { - return; - } - - if (c->Ctx != NULL) - { -#if OPENSSL_VERSION_NUMBER >= 0x10100000L - EVP_CIPHER_CTX_free(c->Ctx); -#else - EVP_CIPHER_CTX_cleanup(c->Ctx); - Free(c->Ctx); -#endif - } - - Free(c); -} - -// Convert the public key to a buffer -BUF *RsaPublicToBuf(K *k) -{ - BUF *b; -#if OPENSSL_VERSION_NUMBER >= 0x10100000L - RSA *rsa; - const BIGNUM *n; -#endif - // Validate arguments - if (k == NULL || k->pkey == NULL) - { - return NULL; - } - -#if OPENSSL_VERSION_NUMBER >= 0x10100000L - rsa = EVP_PKEY_get0_RSA(k->pkey); - if (rsa == NULL) - { - return NULL; - } - - RSA_get0_key(rsa, &n, NULL, NULL); - if (n == NULL) - { - return NULL; - } - - b = BigNumToBuf(n); -#else - if (k->pkey->pkey.rsa == NULL || k->pkey->pkey.rsa->n == NULL) - { - return NULL; - } - - b = BigNumToBuf(k->pkey->pkey.rsa->n); -#endif - - if (b == NULL) - { - return NULL; - } - - return b; -} - -// Get public key size -UINT RsaPublicSize(K *k) -{ - BUF *b; - UINT ret; - - b = RsaPublicToBuf(k); - if (b == NULL) - { - return 0; - } - - ret = b->Size; - - FreeBuf(b); - - return ret; -} - -// Hash a pointer to a 32-bit -UINT HashPtrToUINT(void *p) -{ - UCHAR hash_data[MD5_SIZE]; - UINT ret; - // Validate arguments - if (p == NULL) - { - return 0; - } - - Md5(hash_data, &p, sizeof(p)); - - Copy(&ret, hash_data, sizeof(ret)); - - return ret; -} - -// Copy of the NAME -NAME *CopyName(NAME *n) -{ - // Validate arguments - if (n == NULL) - { - return NULL; - } - - return NewName(n->CommonName, n->Organization, n->Unit, - n->Country, n->State, n->Local); -} - -// Convert the binary to the BIGNUM -BIGNUM *BinToBigNum(void *data, UINT size) -{ - BIGNUM *bn; - // Validate arguments - if (data == NULL) - { - return NULL; - } - - bn = BN_new(); - BN_bin2bn(data, size, bn); - - return bn; -} - -// Convert a BIGNUM to a buffer -BUF *BigNumToBuf(const BIGNUM *bn) -{ - UINT size; - UCHAR *tmp; - BUF *b; - // Validate arguments - if (bn == NULL) - { - return NULL; - } - - size = BN_num_bytes(bn); - tmp = ZeroMalloc(size); - BN_bn2bin(bn, tmp); - - b = NewBuf(); - WriteBuf(b, tmp, size); - Free(tmp); - - SeekBuf(b, 0, 0); - - return b; -} - -#if OPENSSL_VERSION_NUMBER < 0x10100000L || defined(LIBRESSL_VERSION_NUMBER) -// Return the thread ID -static void OpenSSL_Id(CRYPTO_THREADID *id) -{ - CRYPTO_THREADID_set_numeric(id, (unsigned long)ThreadId()); -} -#endif - -// Initialization of the lock of OpenSSL -void OpenSSL_InitLock() -{ -#if OPENSSL_VERSION_NUMBER < 0x10100000L || defined(LIBRESSL_VERSION_NUMBER) - UINT i; - - // Initialization of the lock object - ssl_lock_num = CRYPTO_num_locks(); - ssl_lock_obj = Malloc(sizeof(LOCK *) * ssl_lock_num); - for (i = 0;i < ssl_lock_num;i++) - { - ssl_lock_obj[i] = NewLock(); - } - - // Setting the lock function - CRYPTO_set_locking_callback(OpenSSL_Lock); - CRYPTO_THREADID_set_callback(OpenSSL_Id); -#endif -} - -// Release of the lock of OpenSSL -void OpenSSL_FreeLock() -{ -#if OPENSSL_VERSION_NUMBER < 0x10100000L || defined(LIBRESSL_VERSION_NUMBER) - UINT i; - - for (i = 0;i < ssl_lock_num;i++) - { - DeleteLock(ssl_lock_obj[i]); - } - Free(ssl_lock_obj); - ssl_lock_obj = NULL; - - CRYPTO_set_locking_callback(NULL); - CRYPTO_THREADID_set_callback(NULL); -#endif -} - -// Lock function for OpenSSL -void OpenSSL_Lock(int mode, int n, const char *file, int line) -{ -#if OPENSSL_VERSION_NUMBER < 0x10100000L || defined(LIBRESSL_VERSION_NUMBER) - LOCK *lock = ssl_lock_obj[n]; - - if (mode & CRYPTO_LOCK) - { - // Lock - Lock(lock); - } - else - { - // Unlock - Unlock(lock); - } -#endif -} - -char *OpenSSL_Error() -{ - return ERR_error_string(ERR_get_error(), NULL); -} - -// Get the display name of the certificate -void GetPrintNameFromX(wchar_t *str, UINT size, X *x) -{ - // Validate arguments - if (x == NULL || str == NULL) - { - return; - } - - GetPrintNameFromName(str, size, x->subject_name); -} -void GetPrintNameFromXA(char *str, UINT size, X *x) -{ - wchar_t tmp[MAX_SIZE]; - // Validate arguments - if (str == NULL || x == NULL) - { - return; - } - - GetPrintNameFromX(tmp, sizeof(tmp), x); - - UniToStr(str, size, tmp); -} - -// Get the display name from NAME -void GetPrintNameFromName(wchar_t *str, UINT size, NAME *name) -{ - // Validate arguments - if (str == NULL || name == NULL) - { - return; - } - - if (name->CommonName != NULL) - { - UniStrCpy(str, size, name->CommonName); - } - else if (name->Organization != NULL) - { - UniStrCpy(str, size, name->Organization); - } - else if (name->Unit != NULL) - { - UniStrCpy(str, size, name->Unit); - } - else if (name->State != NULL) - { - UniStrCpy(str, size, name->State); - } - else if (name->Local != NULL) - { - UniStrCpy(str, size, name->Local); - } - else if (name->Country != NULL) - { - UniStrCpy(str, size, name->Country); - } - else - { - UniStrCpy(str, size, L"untitled"); - } -} - -// Get all the name strings from the certificate -void GetAllNameFromX(wchar_t *str, UINT size, X *x) -{ - UCHAR md5[MD5_SIZE], sha1[SHA1_SIZE]; - char tmp1[MD5_SIZE * 3 + 8], tmp2[SHA1_SIZE * 3 + 8]; - wchar_t tmp3[sizeof(tmp1) + sizeof(tmp2) + 64]; - // Validate arguments - if (str == NULL || x == NULL) - { - return; - } - - GetAllNameFromName(str, size, x->subject_name); - - if (x->serial != NULL && x->serial->size >= 1) - { - char tmp[128]; - wchar_t tmp2[128]; - - BinToStr(tmp, sizeof(tmp), x->serial->data, x->serial->size); - UniFormat(tmp2, sizeof(tmp2), L", SERIAL=\"%S\"", tmp); - - UniStrCat(str, size, tmp2); - } - - // Digest value - GetXDigest(x, md5, false); - GetXDigest(x, sha1, true); - - BinToStr(tmp1, sizeof(tmp1), md5, MD5_SIZE); - BinToStr(tmp2, sizeof(tmp2), sha1, SHA1_SIZE); - - UniFormat(tmp3, sizeof(tmp3), L" (Digest: MD5=\"%S\", SHA1=\"%S\")", tmp1, tmp2); - UniStrCat(str, size, tmp3); -} - -// Get the all name strings from NAME -void GetAllNameFromName(wchar_t *str, UINT size, NAME *name) -{ - UniStrCpy(str, size, L""); - // Validate arguments - if (str == NULL || name == NULL) - { - return; - } - - if (name->CommonName != NULL) - { - UniFormat(str, size, L"%sCN=%s, ", str, name->CommonName); - } - if (name->Organization != NULL) - { - UniFormat(str, size, L"%sO=%s, ", str, name->Organization); - } - if (name->Unit != NULL) - { - UniFormat(str, size, L"%sOU=%s, ", str, name->Unit); - } - if (name->State != NULL) - { - UniFormat(str, size, L"%sS=%s, ", str, name->State); - } - if (name->Local != NULL) - { - UniFormat(str, size, L"%sL=%s, ", str, name->Local); - } - if (name->Country != NULL) - { - UniFormat(str, size, L"%sC=%s, ", str, name->Country); - } - - if (UniStrLen(str) >= 3) - { - UINT len = UniStrLen(str); - if (str[len - 2] == L',' && - str[len - 1] == L' ') - { - str[len - 2] = 0; - } - } -} -void GetAllNameFromNameEx(wchar_t *str, UINT size, NAME *name) -{ - // Validate arguments - if (str == NULL || name == NULL) - { - return; - } - - UniStrCpy(str, size, L""); - if (name->CommonName != NULL) - { - UniFormat(str, size, L"%s%s, ", str, name->CommonName); - } - if (name->Organization != NULL) - { - UniFormat(str, size, L"%s%s, ", str, name->Organization); - } - if (name->Unit != NULL) - { - UniFormat(str, size, L"%s%s, ", str, name->Unit); - } - if (name->State != NULL) - { - UniFormat(str, size, L"%s%s, ", str, name->State); - } - if (name->Local != NULL) - { - UniFormat(str, size, L"%s%s, ", str, name->Local); - } - if (name->Country != NULL) - { - UniFormat(str, size, L"%s%s, ", str, name->Country); - } - - if (UniStrLen(str) >= 3) - { - UINT len = UniStrLen(str); - if (str[len - 2] == L',' && - str[len - 1] == L' ') - { - str[len - 2] = 0; - } - } -} - -// Clone of the key -K *CloneK(K *k) -{ - BUF *b; - K *ret; - // Validate arguments - if (k == NULL) - { - return NULL; - } - - b = KToBuf(k, false, NULL); - if (b == NULL) - { - return NULL; - } - - ret = BufToK(b, k->private_key, false, NULL); - FreeBuf(b); - - return ret; -} - -// Clone of certificate -X *CloneX(X *x) -{ - BUF *b; - X *ret; - // Validate arguments - if (x == NULL) - { - return NULL; - } - - b = XToBuf(x, false); - if (b == NULL) - { - return NULL; - } - - ret = BufToX(b, false); - FreeBuf(b); - - return ret; -} - -// Generate a P12 -P12 *NewP12(X *x, K *k, char *password) -{ - PKCS12 *pkcs12; - P12 *p12; - // Validate arguments - if (x == NULL || k == NULL) - { - return false; - } - if (password && StrLen(password) == 0) - { - password = NULL; - } - - Lock(openssl_lock); - { - pkcs12 = PKCS12_create(password, NULL, k->pkey, x->x509, NULL, 0, 0, 0, 0, 0); - if (pkcs12 == NULL) - { - Unlock(openssl_lock); - return NULL; - } - } - Unlock(openssl_lock); - - p12 = PKCS12ToP12(pkcs12); - - return p12; -} - -// Check whether the P12 is encrypted -bool IsEncryptedP12(P12 *p12) -{ - X *x; - K *k; - // Validate arguments - if (p12 == NULL) - { - return false; - } - - if (ParseP12(p12, &x, &k, NULL) == true) - { - FreeX(x); - FreeK(k); - return false; - } - - return true; -} - -// Extract the X and the K from the P12 -bool ParseP12(P12 *p12, X **x, K **k, char *password) -{ - EVP_PKEY *pkey; - X509 *x509; - // Validate arguments - if (p12 == NULL || x == NULL || k == NULL) - { - return false; - } - if (password && StrLen(password) == 0) - { - password = NULL; - } - if (password == NULL) - { - password = ""; - } - - // Password confirmation - Lock(openssl_lock); - { - if (PKCS12_verify_mac(p12->pkcs12, password, -1) == false && - PKCS12_verify_mac(p12->pkcs12, NULL, -1) == false) - { - Unlock(openssl_lock); - return false; - } - } - Unlock(openssl_lock); - - // Extraction - Lock(openssl_lock); - { - if (PKCS12_parse(p12->pkcs12, password, &pkey, &x509, NULL) == false) - { - if (PKCS12_parse(p12->pkcs12, NULL, &pkey, &x509, NULL) == false) - { - Unlock(openssl_lock); - return false; - } - } - } - Unlock(openssl_lock); - - // Conversion - *x = X509ToX(x509); - - if (*x == NULL) - { - FreePKey(pkey); - return false; - } - - *k = ZeroMalloc(sizeof(K)); - (*k)->private_key = true; - (*k)->pkey = pkey; - - return true; -} - -// Write the P12 to a file -bool P12ToFileW(P12 *p12, wchar_t *filename) -{ - BUF *b; - // Validate arguments - if (p12 == NULL || filename == NULL) - { - return false; - } - - b = P12ToBuf(p12); - if (b == NULL) - { - return false; - } - - if (DumpBufW(b, filename) == false) - { - FreeBuf(b); - return false; - } - - FreeBuf(b); - - return true; -} - -// Release of P12 -void FreeP12(P12 *p12) -{ - // Validate arguments - if (p12 == NULL) - { - return; - } - - FreePKCS12(p12->pkcs12); - Free(p12); -} - -// Release of PKCS12 -void FreePKCS12(PKCS12 *pkcs12) -{ - // Validate arguments - if (pkcs12 == NULL) - { - return; - } - - PKCS12_free(pkcs12); -} - -// Converted the P12 to a BUF -BUF *P12ToBuf(P12 *p12) -{ - BIO *bio; - BUF *buf; - // Validate arguments - if (p12 == NULL) - { - return NULL; - } - - bio = P12ToBio(p12); - if (bio == NULL) - { - return NULL; - } - - buf = BioToBuf(bio); - FreeBio(bio); - - SeekBuf(buf, 0, 0); - - return buf; -} - -// Converted the P12 to a BIO -BIO *P12ToBio(P12 *p12) -{ - BIO *bio; - // Validate arguments - if (p12 == NULL) - { - return NULL; - } - - bio = NewBio(); - Lock(openssl_lock); - { - i2d_PKCS12_bio(bio, p12->pkcs12); - } - Unlock(openssl_lock); - - return bio; -} - -// Read the P12 from the BUF -P12 *BufToP12(BUF *b) -{ - P12 *p12; - BIO *bio; - // Validate arguments - if (b == NULL) - { - return NULL; - } - - bio = BufToBio(b); - if (bio == NULL) - { - return NULL; - } - - p12 = BioToP12(bio); - FreeBio(bio); - - return p12; -} - -// Read the P12 from the BIO -P12 *BioToP12(BIO *bio) -{ - PKCS12 *pkcs12; - // Validate arguments - if (bio == NULL) - { - return NULL; - } - - // Conversion - Lock(openssl_lock); - { - pkcs12 = d2i_PKCS12_bio(bio, NULL); - } - Unlock(openssl_lock); - if (pkcs12 == NULL) - { - // Failure - return NULL; - } - - return PKCS12ToP12(pkcs12); -} - -// Generate a P12 from a PKCS12 -P12 *PKCS12ToP12(PKCS12 *pkcs12) -{ - P12 *p12; - // Validate arguments - if (pkcs12 == NULL) - { - return NULL; - } - - p12 = ZeroMalloc(sizeof(P12)); - p12->pkcs12 = pkcs12; - - return p12; -} - -// Release of X_SERIAL -void FreeXSerial(X_SERIAL *serial) -{ - // Validate arguments - if (serial == NULL) - { - return; - } - - Free(serial->data); - Free(serial); -} - -// Comparison of X_SERIAL -bool CompareXSerial(X_SERIAL *s1, X_SERIAL *s2) -{ - // Validate arguments - if (s1 == NULL || s2 == NULL) - { - return false; - } - - if (s1->size != s2->size) - { - return false; - } - - if (Cmp(s1->data, s2->data, s1->size) != 0) - { - return false; - } - - return true; -} - -// Copy of X_SERIAL -X_SERIAL *CloneXSerial(X_SERIAL *src) -{ - X_SERIAL *s; - // Validate arguments - if (src == NULL) - { - return NULL; - } - - s = ZeroMalloc(sizeof(X_SERIAL)); - s->data = ZeroMalloc(src->size); - Copy(s->data, src->data, src->size); - s->size = src->size; - - return s; -} - -// Initialization of X_SERIAL -X_SERIAL *NewXSerial(void *data, UINT size) -{ - X_SERIAL *serial; - UCHAR *buf = (UCHAR *)data; - UINT i; - // Validate arguments - if (data == NULL || size == 0) - { - return NULL; - } - - for (i = 0;i < size;i++) - { - if (buf[i] != 0) - { - break; - } - } - if (i == size) - { - i = size - 1; - } - buf += i; - - serial = Malloc(sizeof(X_SERIAL)); - serial->size = size - i; - serial->data = ZeroMalloc(size + 16); - Copy(serial->data, buf, size - i); - - return serial; -} - -// Get the number of days till January 1, 2038 -UINT GetDaysUntil2038() -{ - UINT64 now = SystemTime64(); - UINT64 target; - SYSTEMTIME st; - - Zero(&st, sizeof(st)); - st.wYear = 2038; - st.wMonth = 1; - st.wDay = 1; - - target = SystemToUINT64(&st); - - if (now >= target) - { - return 0; - } - else - { - return (UINT)((target - now) / (UINT64)(1000 * 60 * 60 * 24)); - } -} -UINT GetDaysUntil2038Ex() -{ - SYSTEMTIME now; - - Zero(&now, sizeof(now)); - SystemTime(&now); - - if (now.wYear >= 2030) - { - UINT64 now = SystemTime64(); - UINT64 target; - SYSTEMTIME st; - - Zero(&st, sizeof(st)); - st.wYear = 2049; - st.wMonth = 12; - st.wDay = 30; - - target = SystemToUINT64(&st); - - if (now >= target) - { - return 0; - } - else - { - return (UINT)((target - now) / (UINT64)(1000 * 60 * 60 * 24)); - } - } - else - { - return GetDaysUntil2038(); - } -} - -// Issue an X509 certificate -X *NewX(K *pub, K *priv, X *ca, NAME *name, UINT days, X_SERIAL *serial) -{ - X509 *x509; - X *x; - // Validate arguments - if (pub == NULL || priv == NULL || name == NULL || ca == NULL) - { - return NULL; - } - - x509 = NewX509(pub, priv, ca, name, days, serial); - if (x509 == NULL) - { - return NULL; - } - - x = X509ToX(x509); - - if (x == NULL) - { - return NULL; - } - - return x; -} - -// Create a root certificate -X *NewRootX(K *pub, K *priv, NAME *name, UINT days, X_SERIAL *serial) -{ - X509 *x509; - X *x, *x2; - // Validate arguments - if (pub == NULL || priv == NULL || name == NULL) - { - return NULL; - } - - x509 = NewRootX509(pub, priv, name, days, serial); - if (x509 == NULL) - { - return NULL; - } - - x = X509ToX(x509); - if (x == NULL) - { - return NULL; - } - - x2 = CloneX(x); - FreeX(x); - - return x2; -} - -// Create new X509 basic & extended key usage -void AddKeyUsageX509(EXTENDED_KEY_USAGE *ex, int nid) -{ - ASN1_OBJECT *obj; - // Validate arguments - if (ex == NULL) - { - return; - } - - obj = OBJ_nid2obj(nid); - if (obj != NULL) - { - sk_ASN1_OBJECT_push(ex, obj); - } -} -X509_EXTENSION *NewExtendedKeyUsageForX509() -{ - EXTENDED_KEY_USAGE *ex = sk_ASN1_OBJECT_new_null(); - X509_EXTENSION *ret; - - AddKeyUsageX509(ex, NID_server_auth); - AddKeyUsageX509(ex, NID_client_auth); - AddKeyUsageX509(ex, NID_code_sign); - AddKeyUsageX509(ex, NID_email_protect); - AddKeyUsageX509(ex, NID_ipsecEndSystem); - AddKeyUsageX509(ex, NID_ipsecTunnel); - AddKeyUsageX509(ex, NID_ipsecUser); - AddKeyUsageX509(ex, NID_time_stamp); - AddKeyUsageX509(ex, NID_OCSP_sign); - - ret = X509V3_EXT_i2d(NID_ext_key_usage, 0, ex); - - sk_ASN1_OBJECT_pop_free(ex, ASN1_OBJECT_free); - - return ret; -} -void BitStringSetBit(ASN1_BIT_STRING *str, int bit) -{ - // Validate arguments - if (str == NULL) - { - return; - } - - ASN1_BIT_STRING_set_bit(str, bit, 1); -} -X509_EXTENSION *NewBasicKeyUsageForX509() -{ - X509_EXTENSION *ret = NULL; - ASN1_BIT_STRING *str; - - str = ASN1_BIT_STRING_new(); - if (str != NULL) - { - BitStringSetBit(str, 0); // KU_DIGITAL_SIGNATURE - BitStringSetBit(str, 1); // KU_NON_REPUDIATION - BitStringSetBit(str, 2); // KU_KEY_ENCIPHERMENT - BitStringSetBit(str, 3); // KU_DATA_ENCIPHERMENT - //BitStringSetBit(str, 4); // KU_KEY_AGREEMENT - BitStringSetBit(str, 5); // KU_KEY_CERT_SIGN - BitStringSetBit(str, 6); // KU_CRL_SIGN - - ret = X509V3_EXT_i2d(NID_key_usage, 0, str); - - ASN1_BIT_STRING_free(str); - } - - return ret; -} - -// Issue an X509 certificate -X509 *NewX509(K *pub, K *priv, X *ca, NAME *name, UINT days, X_SERIAL *serial) -{ - X509 *x509; - UINT64 notBefore, notAfter; - const ASN1_TIME *t1, *t2; - X509_NAME *subject_name, *issuer_name; - X509_EXTENSION *ex = NULL; - X509_EXTENSION *eku = NULL; - X509_EXTENSION *busage = NULL; - ASN1_INTEGER *s; - // Validate arguments - if (pub == NULL || name == NULL || ca == NULL) - { - return NULL; - } - if (pub->private_key != false) - { - return NULL; - } - if (priv->private_key == false) - { - return NULL; - } - - notBefore = SystemTime64(); - notAfter = notBefore + (UINT64)days * (UINT64)3600 * (UINT64)24 * (UINT64)1000; - - // Creating a X509 - x509 = X509_new(); - if (x509 == NULL) - { - return NULL; - } - - // Make it a v3 certificate - X509_set_version(x509, 2L); - - // Set the Expiration - t1 = X509_get0_notBefore(x509); - t2 = X509_get0_notAfter(x509); - if (!UINT64ToAsn1Time((void *)t1, notBefore)) - { - FreeX509(x509); - return NULL; - } - if (!UINT64ToAsn1Time((void *)t2, notAfter)) - { - FreeX509(x509); - return NULL; - } - - // Set the name - subject_name = NameToX509Name(name); - if (subject_name == NULL) - { - FreeX509(x509); - return NULL; - } - issuer_name = X509_get_subject_name(ca->x509); - if (issuer_name == NULL) - { - FreeX509Name(subject_name); - FreeX509(x509); - return NULL; - } - - X509_set_issuer_name(x509, issuer_name); - X509_set_subject_name(x509, subject_name); - - FreeX509Name(subject_name); - - // Set the Serial Number - s = X509_get_serialNumber(x509); - OPENSSL_free(s->data); - if (serial == NULL) - { - char zero = 0; - s->data = OPENSSL_malloc(sizeof(char)); - Copy(s->data, &zero, sizeof(char)); - s->length = sizeof(char); - } - else - { - s->data = OPENSSL_malloc(serial->size); - Copy(s->data, serial->data, serial->size); - s->length = serial->size; - } - - /* - // Extensions - ex = X509V3_EXT_conf_nid(NULL, NULL, NID_basic_constraints, "critical,CA:TRUE"); - X509_add_ext(x509, ex, -1); - X509_EXTENSION_free(ex); -*/ - - // Basic usage - busage = NewBasicKeyUsageForX509(); - if (busage != NULL) - { - X509_add_ext(x509, busage, -1); - X509_EXTENSION_free(busage); - } - - // EKU - eku = NewExtendedKeyUsageForX509(); - if (eku != NULL) - { - X509_add_ext(x509, eku, -1); - X509_EXTENSION_free(eku); - } - - // Alternative subject name - if (UniIsEmptyStr(name->CommonName) == false) - { - char alt_dns[MAX_PATH]; - - Format(alt_dns, sizeof(alt_dns), "DNS.1:%S", name->CommonName); - - ex = X509V3_EXT_conf_nid(NULL, NULL, NID_subject_alt_name, alt_dns); - X509_add_ext(x509, ex, -1); - X509_EXTENSION_free(ex); - } - - Lock(openssl_lock); - { - // Set the public key - X509_set_pubkey(x509, pub->pkey); - - // Signature - // 2014.3.19 set the initial digest algorithm to SHA-256 - X509_sign(x509, priv->pkey, EVP_sha256()); - } - Unlock(openssl_lock); - - return x509; -} - -// Create an X509 root certificate -X509 *NewRootX509(K *pub, K *priv, NAME *name, UINT days, X_SERIAL *serial) -{ - X509 *x509; - UINT64 notBefore, notAfter; - const ASN1_TIME *t1, *t2; - X509_NAME *subject_name, *issuer_name; - X509_EXTENSION *ex = NULL; - X509_EXTENSION *eku = NULL; - X509_EXTENSION *busage = NULL; - ASN1_INTEGER *s; - // Validate arguments - if (pub == NULL || name == NULL || priv == NULL) - { - return NULL; - } - if (days == 0) - { - days = 365; - } - if (priv->private_key == false) - { - return NULL; - } - if (pub->private_key != false) - { - return NULL; - } - - notBefore = SystemTime64(); - notAfter = notBefore + (UINT64)days * (UINT64)3600 * (UINT64)24 * (UINT64)1000; - - // Creating a X509 - x509 = X509_new(); - if (x509 == NULL) - { - return NULL; - } - - // Make it a v3 certificate - X509_set_version(x509, 2L); - - // Set the Expiration - t1 = X509_get0_notBefore(x509); - t2 = X509_get0_notAfter(x509); - if (!UINT64ToAsn1Time((void *)t1, notBefore)) - { - FreeX509(x509); - return NULL; - } - if (!UINT64ToAsn1Time((void *)t2, notAfter)) - { - FreeX509(x509); - return NULL; - } - - // Set the name - subject_name = NameToX509Name(name); - if (subject_name == NULL) - { - FreeX509(x509); - return NULL; - } - issuer_name = NameToX509Name(name); - if (issuer_name == NULL) - { - FreeX509Name(subject_name); - FreeX509(x509); - return NULL; - } - - X509_set_issuer_name(x509, issuer_name); - X509_set_subject_name(x509, subject_name); - - FreeX509Name(subject_name); - FreeX509Name(issuer_name); - - // Set a Serial Number - s = X509_get_serialNumber(x509); - OPENSSL_free(s->data); - if (serial == NULL) - { - char zero = 0; - s->data = OPENSSL_malloc(sizeof(char)); - Copy(s->data, &zero, sizeof(char)); - s->length = sizeof(char); - } - else - { - s->data = OPENSSL_malloc(serial->size); - Copy(s->data, serial->data, serial->size); - s->length = serial->size; - } - - // Extensions - ex = X509V3_EXT_conf_nid(NULL, NULL, NID_basic_constraints, "critical,CA:TRUE"); - X509_add_ext(x509, ex, -1); - X509_EXTENSION_free(ex); - - // Basic usage - busage = NewBasicKeyUsageForX509(); - if (busage != NULL) - { - X509_add_ext(x509, busage, -1); - X509_EXTENSION_free(busage); - } - - // EKU - eku = NewExtendedKeyUsageForX509(); - if (eku != NULL) - { - X509_add_ext(x509, eku, -1); - X509_EXTENSION_free(eku); - } - - Lock(openssl_lock); - { - // Set the public key - X509_set_pubkey(x509, pub->pkey); - - // Signature - // 2014.3.19 set the initial digest algorithm to SHA-256 - X509_sign(x509, priv->pkey, EVP_sha256()); - } - Unlock(openssl_lock); - - return x509; -} - -// Convert the NAMEto a X509_NAME -void *NameToX509Name(NAME *nm) -{ - X509_NAME *xn; - // Validate arguments - if (nm == NULL) - { - return NULL; - } - - xn = X509_NAME_new(); - if (xn == NULL) - { - return NULL; - } - - // Add the entries - AddX509Name(xn, NID_commonName, nm->CommonName); - AddX509Name(xn, NID_organizationName, nm->Organization); - AddX509Name(xn, NID_organizationalUnitName, nm->Unit); - AddX509Name(xn, NID_countryName, nm->Country); - AddX509Name(xn, NID_stateOrProvinceName, nm->State); - AddX509Name(xn, NID_localityName, nm->Local); - - return xn; -} - -// Add an entry to the X509_NAME -bool AddX509Name(void *xn, int nid, wchar_t *str) -{ - X509_NAME *x509_name; - UINT utf8_size; - BYTE *utf8; - int encoding_type = MBSTRING_ASC; - // Validate arguments - if (xn == NULL || str == NULL) - { - return false; - } - - // Convert to UTF-8 - utf8_size = CalcUniToUtf8(str); - if (utf8_size == 0) - { - return false; - } - utf8 = ZeroMalloc(utf8_size + 1); - UniToUtf8(utf8, utf8_size, str); - utf8[utf8_size] = 0; - - if (StrLen(utf8) != UniStrLen(str)) - { - encoding_type = MBSTRING_UTF8; - } - - // Adding - x509_name = (X509_NAME *)xn; - Lock(openssl_lock); - { - X509_NAME_add_entry_by_NID(x509_name, nid, encoding_type, utf8, utf8_size, -1, 0); - } - Unlock(openssl_lock); - Free(utf8); - - return true; -} - -// Release the X509_NAME -void FreeX509Name(void *xn) -{ - X509_NAME *x509_name; - // Validate arguments - if (xn == NULL) - { - return; - } - - x509_name = (X509_NAME *)xn; - X509_NAME_free(x509_name); -} - -// Creating the NAME -NAME *NewName(wchar_t *common_name, wchar_t *organization, wchar_t *unit, - wchar_t *country, wchar_t *state, wchar_t *local) -{ - NAME *nm = ZeroMalloc(sizeof(NAME)); - - if (UniIsEmptyStr(common_name) == false) - { - nm->CommonName = CopyUniStr(common_name); - } - - if (UniIsEmptyStr(organization) == false) - { - nm->Organization = CopyUniStr(organization); - } - - if (UniIsEmptyStr(unit) == false) - { - nm->Unit = CopyUniStr(unit); - } - - if (UniIsEmptyStr(country) == false) - { - nm->Country = CopyUniStr(country); - } - - if (UniIsEmptyStr(state) == false) - { - nm->State = CopyUniStr(state); - } - - if (UniIsEmptyStr(local) == false) - { - nm->Local = CopyUniStr(local); - } - - return nm; -} - -// Check the expiration date of the certificate by the current time -bool CheckXDateNow(X *x) -{ - // Validate arguments - if (x == NULL) - { - return false; - } - - return CheckXDate(x, SystemTime64()); -} - -// Check the expiration date of the certificate -bool CheckXDate(X *x, UINT64 current_system_time) -{ - // Validate arguments - if (x == NULL) - { - return false; - } - - if (x->notBefore >= current_system_time || x->notAfter <= current_system_time) - { - return false; - } - return true; -} - -// Read the expiration date of the certificate -void LoadXDates(X *x) -{ - // Validate arguments - if (x == NULL) - { - return; - } - - x->notBefore = Asn1TimeToUINT64((ASN1_TIME *)X509_get0_notBefore(x->x509)); - x->notAfter = Asn1TimeToUINT64((ASN1_TIME *)X509_get0_notAfter(x->x509)); -} - -// Convert the 64bit system time to ASN1 time -bool UINT64ToAsn1Time(void *asn1_time, UINT64 t) -{ - SYSTEMTIME st; - // Validate arguments - if (asn1_time == NULL) - { - return false; - } - - UINT64ToSystem(&st, t); - return SystemToAsn1Time(asn1_time, &st); -} - -// Convert the system time to the ASN1 time -bool SystemToAsn1Time(void *asn1_time, SYSTEMTIME *s) -{ - char tmp[20]; - ASN1_TIME *t; - // Validate arguments - if (asn1_time == NULL || s == NULL) - { - return false; - } - - if (SystemToStr(tmp, sizeof(tmp), s) == false) - { - return false; - } - t = (ASN1_TIME *)asn1_time; - if (t->data == NULL || t->length < sizeof(tmp)) - { - t->data = OPENSSL_malloc(sizeof(tmp)); - } - StrCpy((char *)t->data, t->length, tmp); - t->length = StrLen(tmp); - t->type = V_ASN1_UTCTIME; - - return true; -} - -// Convert the system time to a string -bool SystemToStr(char *str, UINT size, SYSTEMTIME *s) -{ - // Validate arguments - if (str == NULL || s == NULL) - { - return false; - } - - Format(str, size, "%02u%02u%02u%02u%02u%02uZ", - s->wYear % 100, s->wMonth, s->wDay, - s->wHour, s->wMinute, s->wSecond); - - return true; -} - -// Convert an ASN1 time to an UINT64 time -UINT64 Asn1TimeToUINT64(void *asn1_time) -{ - SYSTEMTIME st; - // Validate arguments - if (asn1_time == NULL) - { - return 0; - } - - if (Asn1TimeToSystem(&st, asn1_time) == false) - { - return 0; - } - return SystemToUINT64(&st); -} - -// Converted an ASN1 time to a system time -bool Asn1TimeToSystem(SYSTEMTIME *s, void *asn1_time) -{ - ASN1_TIME *t; - // Validate arguments - if (s == NULL || asn1_time == NULL) - { - return false; - } - - t = (ASN1_TIME *)asn1_time; - if (StrToSystem(s, (char *)t->data) == false) - { - return false; - } - - if (t->type == V_ASN1_GENERALIZEDTIME) - { - LocalToSystem(s, s); - } - - return true; -} - -// Convert the string to the system time -bool StrToSystem(SYSTEMTIME *s, char *str) -{ - char century[3] = {0, 0, 0}; - bool fourdigityear = false; - - // Validate arguments - if (s == NULL || str == NULL) - { - return false; - } - if (StrLen(str) != 13) - { - if (StrLen(str) != 15) - { - return false; - } - - // Year has 4 digits - save first two and use the rest - // as if it had two digits - fourdigityear = true; - century[0] = str[0]; - century[1] = str[1]; - str += 2; - } - if (str[12] != 'Z') - { - return false; - } - - // Conversion - { - char year[3] = {str[0], str[1], 0}, - month[3] = {str[2], str[3], 0}, - day[3] = {str[4], str[5], 0}, - hour[3] = {str[6], str[7], 0}, - minute[3] = {str[8], str[9], 0}, - second[3] = {str[10], str[11], 0}; - Zero(s, sizeof(SYSTEMTIME)); - s->wYear = ToInt(year); - if (fourdigityear) - { - s->wYear += ToInt(century) * 100; - } - else if (s->wYear >= 60) - { - s->wYear += 1900; - } - else - { - s->wYear += 2000; - } - s->wMonth = ToInt(month); - s->wDay = ToInt(day); - s->wHour = ToInt(hour); - s->wMinute = ToInt(minute); - s->wSecond = ToInt(second); - NormalizeSystem(s); - } - - return true; -} - -// Verify the RSA signature -bool RsaVerify(void *data, UINT data_size, void *sign, K *k) -{ - return RsaVerifyEx(data, data_size, sign, k, 0); -} - -bool RsaVerifyEx(void *data, UINT data_size, void *sign, K *k, UINT bits) -{ - UCHAR hash_data[SIGN_HASH_SIZE]; - UCHAR *decrypt_data; - RSA *rsa; - UINT rsa_size; - // Validate arguments - if (data == NULL || sign == NULL || k == NULL || k->private_key != false) - { - return false; - } - if (bits == 0) - { - bits = RSA_KEY_SIZE; - } - - rsa = EVP_PKEY_get0_RSA(k->pkey); - if (rsa == NULL) - { - return false; - } - - // Hash the data - if (HashForSign(hash_data, sizeof(hash_data), data, data_size) == false) - { - return false; - } - - rsa_size = RSA_size(rsa); - rsa_size = MAX(rsa_size, 1024); // For just in case - decrypt_data = ZeroMalloc(rsa_size); - - // Decode the signature - if (RSA_public_decrypt(bits / 8, sign, decrypt_data, rsa, RSA_PKCS1_PADDING) <= 0) - { - Free(decrypt_data); - return false; - } - - // Comparison - if (Cmp(decrypt_data, hash_data, SIGN_HASH_SIZE) != 0) - { - Free(decrypt_data); - return false; - } - - Free(decrypt_data); - - return true; -} - -// RSA signature -bool RsaSign(void *dst, void *src, UINT size, K *k) -{ - return RsaSignEx(dst, src, size, k, 0); -} -bool RsaSignEx(void *dst, void *src, UINT size, K *k, UINT bits) -{ - UCHAR hash[SIGN_HASH_SIZE]; - // Validate arguments - if (dst == NULL || src == NULL || k == NULL || EVP_PKEY_base_id(k->pkey) != EVP_PKEY_RSA) - { - return false; - } - if (bits == 0) - { - bits = RSA_KEY_SIZE; - } - - Zero(dst, bits / 8); - - // Hash - if (HashForSign(hash, sizeof(hash), src, size) == false) - { - return false; - } - - // Signature - if (RSA_private_encrypt(sizeof(hash), hash, dst, EVP_PKEY_get0_RSA(k->pkey), RSA_PKCS1_PADDING) <= 0) - { - return false; - } - - return true; -} - -// Generation of signature data by SHA-1 -bool HashForSign(void *dst, UINT dst_size, void *src, UINT src_size) -{ - UCHAR *buf = (UCHAR *)dst; - UCHAR sign_data[] = - { - 0x30, 0x21, 0x30, 0x09, 0x06, 0x05, 0x2B, 0x0E, - 0x03, 0x02, 0x1A, 0x05, 0x00, 0x04, 0x14, - }; - // Validate arguments - if (dst == NULL || src == NULL || src_size == 0 || MIN_SIGN_HASH_SIZE > dst_size) - { - return false; - } - - // Header part - Copy(buf, sign_data, sizeof(sign_data)); - - // Hash - Sha1(HASHED_DATA(buf), src, src_size); - - return true; -} - -// RSA operating environment check -bool RsaCheckEx() -{ - UINT num = 20; - UINT i; - - for (i = 0;i < num;i++) - { - if (RsaCheck()) - { - return true; - } - - SleepThread(100); - } - - return false; -} -bool RsaCheck() -{ - int ret = 0; - RSA *rsa = NULL; - BIGNUM *e = NULL; - K *priv_key, *pub_key; - BIO *bio; - char errbuf[MAX_SIZE]; - UINT size = 0; - UINT bit = RSA_KEY_SIZE; - - e = BN_new(); - ret = BN_set_word(e, RSA_F4); - if (ret == 0) - { - BN_free(e); - Debug("BN_set_word: err=%s\n", ERR_error_string(ERR_get_error(), errbuf)); - return false; - } - - // Key generation - Lock(openssl_lock); - { - rsa = RSA_new(); - ret = RSA_generate_key_ex(rsa, bit, e, NULL); - BN_free(e); - } - Unlock(openssl_lock); - if (ret == 0) - { - Debug("RSA_generate_key_ex: err=%s\n", ERR_error_string(ERR_get_error(), errbuf)); - return false; - } - - // Secret key - bio = NewBio(); - Lock(openssl_lock); - { - i2d_RSAPrivateKey_bio(bio, rsa); - } - Unlock(openssl_lock); - BIO_seek(bio, 0); - priv_key = BioToK(bio, true, false, NULL); - FreeBio(bio); - - // Public key - bio = NewBio(); - Lock(openssl_lock); - { - i2d_RSA_PUBKEY_bio(bio, rsa); - } - Unlock(openssl_lock); - BIO_seek(bio, 0); - pub_key = BioToK(bio, false, false, NULL); - FreeBio(bio); - - RSA_free(rsa); - - size = RsaPublicSize(pub_key); - - if (size != ((bit + 7) / 8)) - { - FreeK(priv_key); - FreeK(pub_key); - - return false; - } - - FreeK(priv_key); - FreeK(pub_key); - - return true; -} - -// Generation of RSA key -bool RsaGen(K **priv, K **pub, UINT bit) -{ - int ret = 0; - RSA *rsa = NULL; - BIGNUM *e = NULL; - K *priv_key, *pub_key; - BIO *bio; - char errbuf[MAX_SIZE]; - UINT size = 0; - // Validate arguments - if (priv == NULL || pub == NULL) - { - return false; - } - if (bit == 0) - { - bit = RSA_KEY_SIZE; - } - - e = BN_new(); - ret = BN_set_word(e, RSA_F4); - if (ret == 0) - { - BN_free(e); - Debug("BN_set_word: err=%s\n", ERR_error_string(ERR_get_error(), errbuf)); - return false; - } - - // Key generation - Lock(openssl_lock); - { - rsa = RSA_new(); - ret = RSA_generate_key_ex(rsa, bit, e, NULL); - BN_free(e); - } - Unlock(openssl_lock); - if (ret == 0) - { - Debug("RSA_generate_key_ex: err=%s\n", ERR_error_string(ERR_get_error(), errbuf)); - return false; - } - - // Secret key - bio = NewBio(); - Lock(openssl_lock); - { - i2d_RSAPrivateKey_bio(bio, rsa); - } - Unlock(openssl_lock); - BIO_seek(bio, 0); - priv_key = BioToK(bio, true, false, NULL); - FreeBio(bio); - - // Public key - bio = NewBio(); - Lock(openssl_lock); - { - i2d_RSA_PUBKEY_bio(bio, rsa); - } - Unlock(openssl_lock); - BIO_seek(bio, 0); - pub_key = BioToK(bio, false, false, NULL); - FreeBio(bio); - - *priv = priv_key; - *pub = pub_key; - - RSA_free(rsa); - - size = RsaPublicSize(*pub); - - if (size != ((bit + 7) / 8)) - { - FreeK(*priv); - FreeK(*pub); - - return RsaGen(priv, pub, bit); - } - - return true; -} - -// Confirm whether the certificate X is signed by the issuer of the certificate x_issuer -bool CheckXEx(X *x, X *x_issuer, bool check_name, bool check_date) -{ - K *k; - bool ret; - // Validate arguments - if (x == NULL || x_issuer == NULL) - { - return false; - } - - k = GetKFromX(x_issuer); - if (k == NULL) - { - return false; - } - - ret = CheckSignature(x, k); - - if (ret) - { - if (check_name) - { - if (CompareName(x->issuer_name, x_issuer->subject_name) == false) - { - ret = false; - } - } - - if (check_date) - { - if (CheckXDateNow(x_issuer) == false) - { - ret = false; - } - } - } - - FreeK(k); - - return ret; -} - -// Confirm the signature of the certificate X with the public key K -bool CheckSignature(X *x, K *k) -{ - // Validate arguments - if (x == NULL || k == NULL) - { - return false; - } - - Lock(openssl_lock); - { - if (X509_verify(x->x509, k->pkey) == 0) - { - Unlock(openssl_lock); - return false; - } - } - Unlock(openssl_lock); - return true; -} - -// Get the public key from the certificate -K *GetKFromX(X *x) -{ - EVP_PKEY *pkey; - K *k; - // Validate arguments - if (x == NULL) - { - return NULL; - } - - Lock(openssl_lock); - { - pkey = X509_get_pubkey(x->x509); - } - Unlock(openssl_lock); - if (pkey == NULL) - { - return NULL; - } - - k = ZeroMalloc(sizeof(K)); - k->pkey = pkey; - - return k; -} - -// The name comparison -bool CompareName(NAME *n1, NAME *n2) -{ - // Validate arguments - if (n1 == NULL || n2 == NULL) - { - return false; - } - - // Name comparison - if (UniStrCmpi(n1->CommonName, n2->CommonName) == 0 && - UniStrCmpi(n1->Organization, n2->Organization) == 0 && - UniStrCmpi(n1->Unit, n2->Unit) == 0 && - UniStrCmpi(n1->Country, n2->Country) == 0 && - UniStrCmpi(n1->State, n2->State) == 0 && - UniStrCmpi(n1->Local, n2->Local) == 0) - { - return true; - } - - return false; -} - -// Release the name of the X -void FreeXNames(X *x) -{ - // Validate arguments - if (x == NULL) - { - return; - } - - FreeName(x->issuer_name); - x->issuer_name = NULL; - - FreeName(x->subject_name); - x->subject_name = NULL; -} - -// Release the name -void FreeName(NAME *n) -{ - // Validate arguments - if (n == NULL) - { - return; - } - - // Release the string - Free(n->CommonName); - Free(n->Organization); - Free(n->Unit); - Free(n->Country); - Free(n->State); - Free(n->Local); - - // Release the object - Free(n); - - return; -} - -// Get the name of the certificate -void LoadXNames(X *x) -{ - X509 *x509; - // Validate arguments - if (x == NULL) - { - return; - } - - x509 = x->x509; - x->issuer_name = X509NameToName(X509_get_issuer_name(x509)); - x->subject_name = X509NameToName(X509_get_subject_name(x509)); -} - -// Convert the X509_NAME structure to the NAME structure -NAME *X509NameToName(void *xn) -{ - NAME *n; - // Validate arguments - if (xn == NULL) - { - return NULL; - } - - n = ZeroMalloc(sizeof(NAME)); - - // Get the strings one by one - n->CommonName = GetUniStrFromX509Name(xn, NID_commonName); - n->Organization = GetUniStrFromX509Name(xn, NID_organizationName); - n->Unit = GetUniStrFromX509Name(xn, NID_organizationalUnitName); - n->Country = GetUniStrFromX509Name(xn, NID_countryName); - n->State = GetUniStrFromX509Name(xn, NID_stateOrProvinceName); - n->Local = GetUniStrFromX509Name(xn, NID_localityName); - - return n; -} - -// Read a Unicode string from the X509_NAME structure -wchar_t *GetUniStrFromX509Name(void *xn, int nid) -{ - UCHAR txt[1024]; - bool b = false; - UINT i, size; - int index; - bool unicode = false; - bool is_utf_8 = false; - ASN1_OBJECT *obj; - ASN1_STRING *data; - // Validate arguments - if (xn == NULL || nid == 0) - { - return NULL; - } - - Zero(txt, sizeof(txt)); - if (X509_NAME_get_text_by_NID(xn, nid, (char *)txt, sizeof(txt) - 2) <= 0) - { - return NULL; - } - - obj = OBJ_nid2obj(nid); - if (obj == NULL) - { - return NULL; - } - index = X509_NAME_get_index_by_OBJ(xn, obj, -1); - if (index < 0) - { - return NULL; - } - data = X509_NAME_ENTRY_get_data(X509_NAME_get_entry(xn, index)); - if (data == NULL) - { - return NULL; - } - if (data->type == V_ASN1_BMPSTRING) - { - unicode = true; - } - if (data->type == V_ASN1_UTF8STRING || data->type == V_ASN1_T61STRING) - { - is_utf_8 = true; - } - - size = UniStrLen((wchar_t *)txt) * 4 + 8; - for (i = 0;i < size;i++) - { - if (txt[i] >= 0x80) - { - unicode = true; - break; - } - } - - if (is_utf_8) - { - wchar_t *ret; - UINT ret_size; - - ret_size = CalcUtf8ToUni(txt, StrLen(txt)); - ret = ZeroMalloc(ret_size + 8); - Utf8ToUni(ret, ret_size, txt, StrLen(txt)); - - return ret; - } - else if (unicode == false) - { - wchar_t tmp[1024]; - StrToUni(tmp, sizeof(tmp), (char *)txt); - return CopyUniStr(tmp); - } - else - { - EndianUnicode((wchar_t *)txt); - return CopyUniStr((wchar_t *)txt); - } -} - -// Check whether the certificate x1 equal to x2 -bool CompareX(X *x1, X *x2) -{ - // Validate arguments - if (x1 == NULL || x2 == NULL) - { - return false; - } - - Lock(openssl_lock); - if (X509_cmp(x1->x509, x2->x509) == 0) - { - Unlock(openssl_lock); - return true; - } - else - { - Unlock(openssl_lock); - return false; - } -} - -// Check whether K is private key of X -bool CheckXandK(X *x, K *k) -{ - // Validate arguments - if (x == NULL || k == NULL) - { - return false; - } - - Lock(openssl_lock); - if (X509_check_private_key(x->x509, k->pkey) != 0) - { - Unlock(openssl_lock); - return true; - } - else - { - Unlock(openssl_lock); - return false; - } -} - -// Read a X from the file -X *FileToX(char *filename) -{ - wchar_t *filename_w = CopyStrToUni(filename); - X *ret = FileToXW(filename_w); - - Free(filename_w); - - return ret; -} -X *FileToXW(wchar_t *filename) -{ - bool text; - BUF *b; - X *x; - // Validate arguments - if (filename == NULL) - { - return NULL; - } - - b = ReadDumpW(filename); - text = IsBase64(b); - - x = BufToX(b, text); - FreeBuf(b); - - return x; -} - -// Write the X to a file -bool XToFile(X *x, char *filename, bool text) -{ - wchar_t *filename_w = CopyStrToUni(filename); - bool ret = XToFileW(x, filename_w, text); - - Free(filename_w); - - return ret; -} -bool XToFileW(X *x, wchar_t *filename, bool text) -{ - BUF *b; - bool ret; - // Validate arguments - if (x == NULL || filename == NULL) - { - return false; - } - - b = XToBuf(x, text); - if (b == NULL) - { - return false; - } - - ret = DumpBufW(b, filename); - FreeBuf(b); - - return ret; -} - -// Read a K from the file -K *FileToKW(wchar_t *filename, bool private_key, char *password) -{ - bool text; - BUF *b; - K *k; - // Validate arguments - if (filename == NULL) - { - return NULL; - } - - b = ReadDumpW(filename); - if (b == NULL) - { - return NULL; - } - - text = IsBase64(b); - if (text == false) - { - k = BufToK(b, private_key, false, NULL); - } - else - { - k = BufToK(b, private_key, true, NULL); - if (k == NULL) - { - k = BufToK(b, private_key, true, password); - } - } - - FreeBuf(b); - - return k; -} - -// Save the K to a file -bool KToFileW(K *k, wchar_t *filename, bool text, char *password) -{ - BUF *b; - bool ret; - // Validate arguments - if (k == NULL || filename == NULL) - { - return false; - } - - b = KToBuf(k, text, password); - if (b == NULL) - { - return false; - } - - ret = DumpBufW(b, filename); - FreeBuf(b); - - return ret; -} - -// Convert the K to the BUF -BUF *KToBuf(K *k, bool text, char *password) -{ - BUF *buf; - BIO *bio; - // Validate arguments - if (k == NULL) - { - return NULL; - } - - bio = KToBio(k, text, password); - if (bio == NULL) - { - return NULL; - } - - buf = BioToBuf(bio); - FreeBio(bio); - - SeekBuf(buf, 0, 0); - - return buf; -} - -// Convert the K to the BIO -BIO *KToBio(K *k, bool text, char *password) -{ - BIO *bio; - // Validate arguments - if (k == NULL) - { - return NULL; - } - - bio = NewBio(); - - if (k->private_key) - { - // Secret key - if (text == false) - { - // Binary format - Lock(openssl_lock); - { - i2d_PrivateKey_bio(bio, k->pkey); - } - Unlock(openssl_lock); - } - else - { - // Text format - if (password == 0 || StrLen(password) == 0) - { - // No encryption - Lock(openssl_lock); - { - PEM_write_bio_PrivateKey(bio, k->pkey, NULL, NULL, 0, NULL, NULL); - } - Unlock(openssl_lock); - } - else - { - // Encrypt - CB_PARAM cb; - cb.password = password; - Lock(openssl_lock); - { - PEM_write_bio_PrivateKey(bio, k->pkey, EVP_des_ede3_cbc(), - NULL, 0, (pem_password_cb *)PKeyPasswordCallbackFunction, &cb); - } - Unlock(openssl_lock); - } - } - } - else - { - // Public key - if (text == false) - { - // Binary format - Lock(openssl_lock); - { - i2d_PUBKEY_bio(bio, k->pkey); - } - Unlock(openssl_lock); - } - else - { - // Text format - Lock(openssl_lock); - { - PEM_write_bio_PUBKEY(bio, k->pkey); - } - Unlock(openssl_lock); - } - } - - return bio; -} - -// Check whether the BUF is encoded as the Base64 -bool IsBase64(BUF *b) -{ - UINT i; - // Validate arguments - if (b == NULL) - { - return false; - } - - if (SearchAsciiInBinary(b->Buf, b->Size, "-----BEGIN", false) != INFINITE) - { - return true; - } - - for (i = 0;i < b->Size;i++) - { - char c = ((char *)b->Buf)[i]; - bool b = false; - if ('a' <= c && c <= 'z') - { - b = true; - } - else if ('A' <= c && c <= 'Z') - { - b = true; - } - else if ('0' <= c && c <= '9') - { - b = true; - } - else if (c == ':' || c == '.' || c == ';' || c == ',') - { - b = true; - } - else if (c == '!' || c == '&' || c == '#' || c == '(' || c == ')') - { - b = true; - } - else if (c == '-' || c == ' ') - { - b = true; - } - else if (c == 13 || c == 10 || c == EOF) - { - b = true; - } - else if (c == '\t' || c == '=' || c == '+' || c == '/') - { - b = true; - } - if (b == false) - { - return false; - } - } - return true; -} - -// Check whether the K in the BUF is encrypted -bool IsEncryptedK(BUF *b, bool private_key) -{ - K *k; - // Validate arguments - if (b == NULL) - { - return false; - } - if (IsBase64(b) == false) - { - return false; - } - - k = BufToK(b, private_key, true, NULL); - if (k != NULL) - { - FreeK(k); - return false; - } - - return true; -} - -K *OpensslEngineToK(char *key_file_name, char *engine_name) -{ - K *k; -#if OPENSSL_API_COMPAT < 0x10100000L - ENGINE_load_dynamic(); -#endif // OPENSSL_API_COMPAT < 0x10100000L - ENGINE *engine = ENGINE_by_id(engine_name); - ENGINE_init(engine); - EVP_PKEY *pkey; - pkey = ENGINE_load_private_key(engine, key_file_name, NULL, NULL); - k = ZeroMalloc(sizeof(K)); - k->pkey = pkey; - k->private_key = true; - return k; -} - -// Convert the BUF to a K -K *BufToK(BUF *b, bool private_key, bool text, char *password) -{ - BIO *bio; - K *k; - // Validate arguments - if (b == NULL) - { - return NULL; - } - - bio = BufToBio(b); - k = BioToK(bio, private_key, text, password); - FreeBio(bio); - - return k; -} - -// Release of K -void FreeK(K *k) -{ - // Validate arguments - if (k == NULL) - { - return; - } - - FreePKey(k->pkey); - Free(k); -} - -// Release the secret key -void FreePKey(EVP_PKEY *pkey) -{ - // Validate arguments - if (pkey == NULL) - { - return; - } - - EVP_PKEY_free(pkey); -} - -// Convert the BIO to the K -K *BioToK(BIO *bio, bool private_key, bool text, char *password) -{ - EVP_PKEY *pkey; - K *k; - // Validate arguments - if (bio == NULL) - { - return NULL; - } - - if (password != NULL && StrLen(password) == 0) - { - password = NULL; - } - - if (private_key == false) - { - // Public key - if (text == false) - { - // Binary format - pkey = d2i_PUBKEY_bio(bio, NULL); - if (pkey == NULL) - { - return NULL; - } - } - else - { - // Text format - CB_PARAM cb; - cb.password = password; - Lock(openssl_lock); - { - pkey = PEM_read_bio_PUBKEY(bio, NULL, (pem_password_cb *)PKeyPasswordCallbackFunction, &cb); - } - Unlock(openssl_lock); - if (pkey == NULL) - { - return NULL; - } - } - } - else - { - if (text == false) - { - // Binary format - Lock(openssl_lock); - { - pkey = d2i_PrivateKey_bio(bio, NULL); - } - Unlock(openssl_lock); - if (pkey == NULL) - { - return NULL; - } - } - else - { - // Text format - CB_PARAM cb; - cb.password = password; - Lock(openssl_lock); - { - pkey = PEM_read_bio_PrivateKey(bio, NULL, (pem_password_cb *)PKeyPasswordCallbackFunction, &cb); - } - Unlock(openssl_lock); - if (pkey == NULL) - { - return NULL; - } - } - } - - k = ZeroMalloc(sizeof(K)); - k->pkey = pkey; - k->private_key = private_key; - - return k; -} - -// Password callback function -int PKeyPasswordCallbackFunction(char *buf, int bufsize, int verify, void *param) -{ - CB_PARAM *cb; - // Validate arguments - if (buf == NULL || param == NULL || bufsize == 0) - { - return 0; - } - - cb = (CB_PARAM *)param; - if (cb->password == NULL) - { - return 0; - } - - return StrCpy(buf, bufsize, cb->password); -} - -// Convert the X to a BUF -BUF *XToBuf(X *x, bool text) -{ - BIO *bio; - BUF *b; - // Validate arguments - if (x == NULL) - { - return NULL; - } - - bio = XToBio(x, text); - if (bio == NULL) - { - return NULL; - } - - b = BioToBuf(bio); - FreeBio(bio); - - SeekBuf(b, 0, 0); - - return b; -} - -// Convert the X to a BIO -BIO *XToBio(X *x, bool text) -{ - BIO *bio; - // Validate arguments - if (x == NULL) - { - return NULL; - } - - bio = NewBio(); - - Lock(openssl_lock); - { - if (text == false) - { - // Binary format - i2d_X509_bio(bio, x->x509); - } - else - { - // Text format - PEM_write_bio_X509(bio, x->x509); - } - } - Unlock(openssl_lock); - - return bio; -} - -// Release of the X -void FreeX(X *x) -{ - // Validate arguments - if (x == NULL) - { - return; - } - - // Release the name - FreeXNames(x); - - - // Release the Serial - FreeXSerial(x->serial); - - if (x->do_not_free == false) - { - FreeX509(x->x509); - } - Free(x); -} - -// Release of the X509 -void FreeX509(X509 *x509) -{ - // Validate arguments - if (x509 == NULL) - { - return; - } - - Lock(openssl_lock); - { - X509_free(x509); - } - Unlock(openssl_lock); -} - -// Convert the BUF to a X -X *BufToX(BUF *b, bool text) -{ - X *x; - BIO *bio; - // Validate arguments - if (b == NULL) - { - return NULL; - } - - bio = BufToBio(b); - if (bio == NULL) - { - FreeBuf(b); - return NULL; - } - - x = BioToX(bio, text); - - FreeBio(bio); - - return x; -} - -// Get a digest of the X -void GetXDigest(X *x, UCHAR *buf, bool sha1) -{ - // Validate arguments - if (x == NULL) - { - return; - } - - if (sha1 == false) - { - UINT size = MD5_SIZE; - X509_digest(x->x509, EVP_md5(), buf, (unsigned int *)&size); - } - else - { - UINT size = SHA1_SIZE; - X509_digest(x->x509, EVP_sha1(), buf, (unsigned int *)&size); - } -} - -// Convert BIO to X -X *BioToX(BIO *bio, bool text) -{ - X *x; - X509 *x509; - // Validate arguments - if (bio == NULL) - { - return NULL; - } - - Lock(openssl_lock); - { - // Reading x509 - if (text == false) - { - // Binary mode - x509 = d2i_X509_bio(bio, NULL); - } - else - { - // Text mode - x509 = PEM_read_bio_X509(bio, NULL, NULL, NULL); - } - } - Unlock(openssl_lock); - - if (x509 == NULL) - { - return NULL; - } - - x = X509ToX(x509); - - if (x == NULL) - { - return NULL; - } - - return x; -} - -// Convert the X509 to X -X *X509ToX(X509 *x509) -{ - X *x; - K *k; - BUF *b; - UINT size; - UINT type; - ASN1_INTEGER *s; - // Validate arguments - if (x509 == NULL) - { - return NULL; - } - - x = ZeroMalloc(sizeof(X)); - x->x509 = x509; - - // Name - LoadXNames(x); - - // Expiration date - LoadXDates(x); - - // Check whether it is a root certificate - if (CompareName(x->issuer_name, x->subject_name)) - { - K *pubkey = GetKFromX(x); - if (pubkey != NULL) - { - if (CheckXandK(x, pubkey)) - { - x->root_cert = true; - } - FreeK(pubkey); - } - } - - // Check whether there is basic constraints - if (X509_get_ext_by_NID(x509, NID_basic_constraints, -1) != -1) - { - x->has_basic_constraints = true; - } - - // Get the "Certification Authority Issuer" (1.3.6.1.5.5.7.48.2) field value - if (x->root_cert == false) - { - AUTHORITY_INFO_ACCESS *ads = (AUTHORITY_INFO_ACCESS *)X509_get_ext_d2i(x509, NID_info_access, NULL, NULL); - - if (ads != NULL) - { - int i; - - for (i = 0; i < sk_ACCESS_DESCRIPTION_num(ads); i++) - { - ACCESS_DESCRIPTION *ad = sk_ACCESS_DESCRIPTION_value(ads, i); - if (ad != NULL) - { - if (OBJ_obj2nid(ad->method) == NID_ad_ca_issuers && ad->location->type == GEN_URI) - { -#if OPENSSL_VERSION_NUMBER >= 0x10100000L - char *uri = (char *)ASN1_STRING_get0_data(ad->location->d.uniformResourceIdentifier); -#else - char *uri = (char *)ASN1_STRING_data(ad->location->d.uniformResourceIdentifier); -#endif - if (IsEmptyStr(uri) == false) - { - StrCpy(x->issuer_url, sizeof(x->issuer_url), uri); - break; - } - } - } - } - - AUTHORITY_INFO_ACCESS_free(ads); - } - } - - // Get the Serial Number - s = X509_get_serialNumber(x509); - x->serial = NewXSerial(s->data, s->length); - if (x->serial == NULL) - { - char zero = 0; - x->serial = NewXSerial(&zero, sizeof(char)); - } - - k = GetKFromX(x); - if (k == NULL) - { - FreeX(x); - return NULL; - } - - b = KToBuf(k, false, NULL); - - size = b->Size; - type = EVP_PKEY_base_id(k->pkey); - - FreeBuf(b); - - //Fixed to get actual RSA key bits - x->bits = EVP_PKEY_bits(k->pkey); - - FreeK(k); - - if (type == EVP_PKEY_RSA) - { - x->is_compatible_bit = true; - - if(x->bits != 1024 && x->bits != 1536 && x->bits != 2048 && x->bits != 3072 && x->bits != 4096) - { - x->is_compatible_bit = false; - } - else - { - x->is_compatible_bit = true; - } - - /*switch (size) - { - case 162: - x->bits = 1024; - break; - - case 226: - x->bits = 1536; - break; - - case 294: - x->bits = 2048; - break; - - case 442: - x->bits = 3072; - break; - - case 550: - x->bits = 4096; - break; - - default: - x->is_compatible_bit = false; - break; - }*/ - } - - return x; -} - -// Create a BIO -BIO *NewBio() -{ - return BIO_new(BIO_s_mem()); -} - -// Release the BIO -void FreeBio(BIO *bio) -{ - // Validate arguments - if (bio == NULL) - { - return; - } - - BIO_free(bio); -} - -// Convert the BIO to the BUF -BUF *BioToBuf(BIO *bio) -{ - BUF *b; - UINT size; - void *tmp; - // Validate arguments - if (bio == NULL) - { - return NULL; - } - - BIO_seek(bio, 0); - size = (UINT)BIO_number_written(bio); - tmp = Malloc(size); - BIO_read(bio, tmp, size); - - b = NewBuf(); - WriteBuf(b, tmp, size); - Free(tmp); - - return b; -} - -// Convert the BUF to a BIO -BIO *BufToBio(BUF *b) -{ - BIO *bio; - // Validate arguments - if (b == NULL) - { - return NULL; - } - - Lock(openssl_lock); - { - bio = BIO_new(BIO_s_mem()); - if (bio == NULL) - { - Unlock(openssl_lock); - return NULL; - } - BIO_write(bio, b->Buf, b->Size); - BIO_seek(bio, 0); - } - Unlock(openssl_lock); - - return bio; -} - -// 64-bit random number generation -UINT64 Rand64() -{ - UINT64 i; - Rand(&i, sizeof(i)); - return i; -} - -// 32-bit random number generation -UINT Rand32() -{ - UINT i; - Rand(&i, sizeof(i)); - return i; -} - -// 16-bit random number generation -USHORT Rand16() -{ - USHORT i; - Rand(&i, sizeof(i)); - return i; -} - -// 8-bit random number generation -UCHAR Rand8() -{ - UCHAR i; - Rand(&i, sizeof(i)); - return i; -} - -// 1-bit random number generation -bool Rand1() -{ - return (Rand32() % 2) == 0 ? false : true; -} - -// Random number generation -void Rand(void *buf, UINT size) -{ - // Validate arguments - if (buf == NULL || size == 0) - { - return; - } - RAND_bytes(buf, size); -} - -// Delete a thread-specific information that OpenSSL has holded -void FreeOpenSSLThreadState() -{ -#if OPENSSL_VERSION_NUMBER < 0x10100000L - CRYPTO_cleanup_all_ex_data(); - ERR_remove_thread_state(NULL); -#else -#ifndef LIBRESSL_VERSION_NUMBER - OPENSSL_thread_stop(); -#endif -#endif -} - -#if OPENSSL_VERSION_NUMBER < 0x10100000L -#define SSL_COMP_free_compression_methods() (sk_free(SSL_COMP_get_compression_methods())) -#endif - -// Release the Crypt library -void FreeCryptLibrary() -{ - openssl_inited = false; - - DeleteLock(openssl_lock); - openssl_lock = NULL; -// RAND_Free_For_SoftEther(); - OpenSSL_FreeLock(); -#if OPENSSL_VERSION_NUMBER < 0x10100000L || defined(LIBRESSL_VERSION_NUMBER) -#ifdef OPENSSL_FIPS - FIPS_mode_set(0); -#endif -#ifndef OPENSSL_NO_ENGINE - ENGINE_cleanup(); -#endif - CONF_modules_unload(1); - EVP_cleanup(); - - FreeOpenSSLThreadState(); - - ERR_free_strings(); - -#ifndef OPENSSL_NO_COMP - SSL_COMP_free_compression_methods(); -#endif -#endif -} - -// Initialize the Crypt library -void InitCryptLibrary() -{ - char tmp[16]; - -#if OPENSSL_VERSION_NUMBER < 0x10100000L || defined(LIBRESSL_VERSION_NUMBER) -// RAND_Init_For_SoftEther() - openssl_lock = NewLock(); - SSL_library_init(); - //OpenSSL_add_all_algorithms(); - OpenSSL_add_all_ciphers(); - OpenSSL_add_all_digests(); - ERR_load_crypto_strings(); - SSL_load_error_strings(); -#endif - - ssl_clientcert_index = SSL_get_ex_new_index(0, "struct SslClientCertInfo *", NULL, NULL, NULL); - -#ifdef OS_UNIX - { - char *name1 = "/dev/random"; - char *name2 = "/dev/urandom"; - IO *o; - o = FileOpen(name1, false); - if (o == NULL) - { - o = FileOpen(name2, false); - if (o == NULL) - { - UINT64 now = SystemTime64(); - BUF *b; - UINT i; - b = NewBuf(); - for (i = 0;i < 4096;i++) - { - UCHAR c = rand() % 256; - WriteBuf(b, &c, 1); - } - WriteBuf(b, &now, sizeof(now)); - RAND_seed(b->Buf, b->Size); - FreeBuf(b); - } - else - { - FileClose(o); - } - } - else - { - FileClose(o); - } - } -#endif // OS_UNIX - - RAND_poll(); - -#ifdef OS_WIN32 -// RAND_screen(); -#endif - Rand(tmp, sizeof(tmp)); - OpenSSL_InitLock(); - - openssl_inited = true; -} - -// Hash with the SHA-1 and convert it to UINT -UINT HashToUINT(void *data, UINT size) -{ - UCHAR hash[SHA1_SIZE]; - UINT u; - // Validate arguments - if (data == NULL && size != 0) - { - return 0; - } - - Sha1(hash, data, size); - - Copy(&u, hash, sizeof(UINT)); - - u = Endian32(u); - - return u; -} - -// Creating a new CRYPT object -CRYPT *NewCrypt(void *key, UINT size) -{ - CRYPT *c = ZeroMalloc(sizeof(CRYPT)); - - c->Rc4Key = Malloc(sizeof(struct rc4_key_st)); - - RC4_set_key(c->Rc4Key, size, (UCHAR *)key); - - return c; -} - -// Release the CRYPT object -void FreeCrypt(CRYPT *c) -{ - // Validate arguments - if (c == NULL) - { - return; - } - - // Memory release - Free(c->Rc4Key); - Free(c); -} - -// Encryption and decryption -void Encrypt(CRYPT *c, void *dst, void *src, UINT size) -{ - RC4(c->Rc4Key, size, src, dst); -} - -// 3DES encryption -void Des3Encrypt2(void *dest, void *src, UINT size, DES_KEY_VALUE *k1, DES_KEY_VALUE *k2, DES_KEY_VALUE *k3, void *ivec) -{ - UCHAR ivec_copy[DES_IV_SIZE]; - // Validate arguments - if (dest == NULL || src == NULL || size == 0 || k1 == NULL || k2 == NULL || k3 == NULL || ivec == NULL) - { - return; - } - - Copy(ivec_copy, ivec, DES_IV_SIZE); - - DES_ede3_cbc_encrypt(src, dest, size, - k1->KeySchedule, - k2->KeySchedule, - k3->KeySchedule, - (DES_cblock *)ivec_copy, - 1); -} - -// DES encryption -void DesEncrypt(void *dest, void *src, UINT size, DES_KEY_VALUE *k, void *ivec) -{ - UCHAR ivec_copy[DES_IV_SIZE]; - // Validate arguments - if (dest == NULL || src == NULL || size == 0 || k == NULL || ivec == NULL) - { - return; - } - - Copy(ivec_copy, ivec, DES_IV_SIZE); - - DES_cbc_encrypt(src, dest, size, - k->KeySchedule, - (DES_cblock *)ivec_copy, - 1); -} - -// 3DES decryption -void Des3Decrypt2(void *dest, void *src, UINT size, DES_KEY_VALUE *k1, DES_KEY_VALUE *k2, DES_KEY_VALUE *k3, void *ivec) -{ - UCHAR ivec_copy[DES_IV_SIZE]; - // Validate arguments - if (dest == NULL || src == NULL || size == 0 || k1 == NULL || k2 == NULL || k3 == NULL || ivec == NULL) - { - return; - } - - Copy(ivec_copy, ivec, DES_IV_SIZE); - - DES_ede3_cbc_encrypt(src, dest, size, - k1->KeySchedule, - k2->KeySchedule, - k3->KeySchedule, - (DES_cblock *)ivec_copy, - 0); -} - -// DES-ECB encryption -void DesEcbEncrypt(void *dst, void *src, void *key_7bytes) -{ - UCHAR *key_56; - DES_cblock key; - DES_key_schedule ks; - // Validate arguments - if (dst == NULL || src == NULL || key_7bytes == NULL) - { - return; - } - - key_56 = (UCHAR *)key_7bytes; - - Zero(&key, sizeof(key)); - Zero(&ks, sizeof(ks)); - - key[0] = key_56[0]; - key[1] = (unsigned char)(((key_56[0] << 7) & 0xFF) | (key_56[1] >> 1)); - key[2] = (unsigned char)(((key_56[1] << 6) & 0xFF) | (key_56[2] >> 2)); - key[3] = (unsigned char)(((key_56[2] << 5) & 0xFF) | (key_56[3] >> 3)); - key[4] = (unsigned char)(((key_56[3] << 4) & 0xFF) | (key_56[4] >> 4)); - key[5] = (unsigned char)(((key_56[4] << 3) & 0xFF) | (key_56[5] >> 5)); - key[6] = (unsigned char)(((key_56[5] << 2) & 0xFF) | (key_56[6] >> 6)); - key[7] = (unsigned char) ((key_56[6] << 1) & 0xFF); - - DES_set_odd_parity(&key); - DES_set_key_unchecked(&key, &ks); - - DES_ecb_encrypt(src, dst, &ks, 1); -} - -// DES decryption -void DesDecrypt(void *dest, void *src, UINT size, DES_KEY_VALUE *k, void *ivec) -{ - UCHAR ivec_copy[DES_IV_SIZE]; - // Validate arguments - if (dest == NULL || src == NULL || size == 0 || k == NULL || ivec == NULL) - { - return; - } - - Copy(ivec_copy, ivec, DES_IV_SIZE); - - DES_cbc_encrypt(src, dest, size, - k->KeySchedule, - (DES_cblock *)ivec_copy, - 0); -} - -// Create a new DES key element -DES_KEY_VALUE *DesNewKeyValue(void *value) -{ - DES_KEY_VALUE *v; - // Validate arguments - if (value == NULL) - { - return NULL; - } - - v = ZeroMalloc(sizeof(DES_KEY_VALUE)); - - Copy(v->KeyValue, value, DES_KEY_SIZE); - - v->KeySchedule = ZeroMalloc(sizeof(DES_key_schedule)); - - DES_set_key_unchecked(value, v->KeySchedule); - - return v; -} - -// Release of DES key element -void DesFreeKeyValue(DES_KEY_VALUE *v) -{ - // Validate arguments - if (v == NULL) - { - return; - } - - Free(v->KeySchedule); - Free(v); -} - -// Create a new AES key -AES_KEY_VALUE *AesNewKey(void *data, UINT size) -{ - AES_KEY_VALUE *k; - // Validate arguments - if (data == NULL || (!(size == 16 || size == 24 || size == 32))) - { - return NULL; - } - - k = ZeroMalloc(sizeof(AES_KEY_VALUE)); - - k->EncryptKey = ZeroMalloc(sizeof(struct aes_key_st)); - k->DecryptKey = ZeroMalloc(sizeof(struct aes_key_st)); - - k->KeySize = size; - Copy(k->KeyValue, data, size); - - AES_set_encrypt_key(data, size * 8, k->EncryptKey); - AES_set_decrypt_key(data, size * 8, k->DecryptKey); - - return k; -} - -// Release the AES key -void AesFreeKey(AES_KEY_VALUE *k) -{ - // Validate arguments - if (k == NULL) - { - return; - } - - Free(k->EncryptKey); - Free(k->DecryptKey); - - Free(k); -} - -// AES encryption -void AesEncrypt(void *dest, void *src, UINT size, AES_KEY_VALUE *k, void *ivec) -{ - EVP_CIPHER_CTX *ctx = NULL; - int dest_len = 0; - int len = 0; - int ret = 0; - - // Validate arguments - if (dest == NULL || src == NULL || size == 0 || k == NULL || ivec == NULL) - { - return; - } - - // Create and initialize the context - ctx = EVP_CIPHER_CTX_new(); - - if (!ctx) - { - ERR_print_errors_fp(stderr); - return; - } - - // Disable padding, as it's handled by IkeEncryptWithPadding() - EVP_CIPHER_CTX_set_padding(ctx, false); - - // Initialize the encryption operation - switch (k->KeySize) - { - case 16: - ret = EVP_EncryptInit_ex(ctx, EVP_aes_128_cbc(), NULL, k->KeyValue, ivec); - break; - - case 24: - ret = EVP_EncryptInit_ex(ctx, EVP_aes_192_cbc(), NULL, k->KeyValue, ivec); - break; - - case 32: - ret = EVP_EncryptInit_ex(ctx, EVP_aes_256_cbc(), NULL, k->KeyValue, ivec); - break; - } - - if (ret != 1) - { - ERR_print_errors_fp(stderr); - EVP_CIPHER_CTX_free(ctx); - return; - } - - // Provide the message to be encrypted and obtain the cipher output - ret = EVP_EncryptUpdate(ctx, dest, &dest_len, src, size); - - if (ret != 1) - { - ERR_print_errors_fp(stderr); - EVP_CIPHER_CTX_free(ctx); - return; - } - - // Finalize the encryption - ret = EVP_EncryptFinal_ex(ctx, (unsigned char *) dest + dest_len, &len); - - if (ret != 1) - { - ERR_print_errors_fp(stderr); - EVP_CIPHER_CTX_free(ctx); - return; - } - - dest_len += len; - - // Clean up - EVP_CIPHER_CTX_free(ctx); -} - -// AES decryption -void AesDecrypt(void *dest, void *src, UINT size, AES_KEY_VALUE *k, void *ivec) -{ - EVP_CIPHER_CTX *ctx = NULL; - int dest_len = 0; - int len = 0; - int ret = 0; - - // Validate arguments - if (dest == NULL || src == NULL || size == 0 || k == NULL || ivec == NULL) - { - return; - } - - // Create and initialize the context - ctx = EVP_CIPHER_CTX_new(); - - if (!ctx) - { - ERR_print_errors_fp(stderr); - return; - } - - // Disable padding, as it's handled by IkeEncryptWithPadding() - EVP_CIPHER_CTX_set_padding(ctx, false); - - // Initialize the decryption operation - switch (k->KeySize) - { - case 16: - ret = EVP_DecryptInit_ex(ctx, EVP_aes_128_cbc(), NULL, k->KeyValue, ivec); - break; - - case 24: - ret = EVP_DecryptInit_ex(ctx, EVP_aes_192_cbc(), NULL, k->KeyValue, ivec); - break; - - case 32: - ret = EVP_DecryptInit_ex(ctx, EVP_aes_256_cbc(), NULL, k->KeyValue, ivec); - break; - } - - if (ret != 1) - { - ERR_print_errors_fp(stderr); - EVP_CIPHER_CTX_free(ctx); - return; - } - - // Provide the message to be decrypted and obtain the plaintext output - ret = EVP_DecryptUpdate(ctx, dest, &dest_len, src, size); - - if (ret != 1) - { - ERR_print_errors_fp(stderr); - EVP_CIPHER_CTX_free(ctx); - return; - } - - // Finalize the decryption - ret = EVP_DecryptFinal_ex(ctx, (unsigned char *) dest + dest_len, &len); - - if (ret != 1) - { - ERR_print_errors_fp(stderr); - EVP_CIPHER_CTX_free(ctx); - return; - } - - dest_len += len; - - // Clean up - EVP_CIPHER_CTX_free(ctx); -} - -// Determine whether the AES-NI instruction set is supported by the CPU -bool IsAesNiSupported() -{ - bool supported = false; - - // Unfortunately OpenSSL doesn't provide a function to do it -#ifdef _MSC_VER - int regs[4]; // EAX, EBX, ECX, EDX - __cpuid(regs, 1); - supported = (regs[2] >> 25) & 1; -#else // _MSC_VER - #if defined(CPU_FEATURES_ARCH_X86) - const X86Features features = GetX86Info().features; - supported = features.aes; - #elif defined(CPU_FEATURES_ARCH_ARM) - const ArmFeatures features = GetArmInfo().features; - supported = features.aes; - #elif defined(CPU_FEATURES_ARCH_AARCH64) - const Aarch64Features features = GetAarch64Info().features; - supported = features.aes; - #elif defined(CPU_FEATURES_ARCH_MIPS) - //const MipsFeatures features = GetMipsInfo().features; // no features.aes - #elif defined(CPU_FEATURES_ARCH_PPC) - //const PPCFeatures features = GetPPCInfo().features; // no features.aes - #endif -#endif // _MSC_VER - - return supported; -} - -// DH calculation -bool DhCompute(DH_CTX *dh, void *dst_priv_key, void *src_pub_key, UINT key_size) -{ - int i; - BIGNUM *bn; - bool ret = false; - // Validate arguments - if (dh == NULL || dst_priv_key == NULL || src_pub_key == NULL) - { - return false; - } - if (key_size > dh->Size) - { - return false; - } - - bn = BinToBigNum(src_pub_key, key_size); - - i = DH_compute_key(dst_priv_key, bn, dh->dh); - - if (i == dh->Size) - { - ret = true; - } - else if ((UINT)i < dh->Size) - { - UCHAR *dst2 = Clone(dst_priv_key, i); - - Zero(dst_priv_key, dh->Size); - - Copy(((UCHAR *)dst_priv_key) + (dh->Size - i), dst2, i); - - ret = true; - } - - BN_free(bn); - - return ret; -} - -// Creating a DH 2048bit -DH_CTX *DhNew2048() -{ - return DhNew(DH_SET_2048, 2); -} -// Creating a DH 3072bit -DH_CTX *DhNew3072() -{ - return DhNew(DH_SET_3072, 2); -} -// Creating a DH 4096bit -DH_CTX *DhNew4096() -{ - return DhNew(DH_SET_4096, 2); -} - -// Creating a DH GROUP1 -DH_CTX *DhNewGroup1() -{ - return DhNew(DH_GROUP1_PRIME_768, 2); -} - -// Creating a DH GROUP2 -DH_CTX *DhNewGroup2() -{ - return DhNew(DH_GROUP2_PRIME_1024, 2); -} - -// Creating a DH GROUP5 -DH_CTX *DhNewGroup5() -{ - return DhNew(DH_GROUP5_PRIME_1536, 2); -} - - -// Creating a DH SIMPLE 160bits -DH_CTX *DhNewSimple160() -{ - return DhNew(DH_SIMPLE_160, 2); -} - -DH_CTX *DhNewFromBits(UINT bits) -{ - switch (bits) - { - case 160: - return DhNewSimple160(); - case 768: - return DhNewGroup1(); - case 1024: - return DhNewGroup2(); - case 1536: - return DhNewGroup5(); - case 2048: - return DhNew2048(); - case 3072: - return DhNew3072(); - case 4096: - return DhNew4096(); - default: - return DhNew2048(); - } -} - -// Creating a new DH -DH_CTX *DhNew(char *prime, UINT g) -{ - DH_CTX *dh; - BUF *buf; -#if OPENSSL_VERSION_NUMBER >= 0x10100000L - BIGNUM *dhp, *dhg; - const BIGNUM *pub, *priv; -#endif - // Validate arguments - if (prime == NULL || g == 0) - { - return NULL; - } - - buf = StrToBin(prime); - - dh = ZeroMalloc(sizeof(DH_CTX)); - - dh->dh = DH_new(); -#if OPENSSL_VERSION_NUMBER >= 0x10100000L - dhp = BinToBigNum(buf->Buf, buf->Size); - dhg = BN_new(); - BN_set_word(dhg, g); - DH_set0_pqg(dh->dh, dhp, NULL, dhg); -#else - dh->dh->p = BinToBigNum(buf->Buf, buf->Size); - dh->dh->g = BN_new(); - BN_set_word(dh->dh->g, g); -#endif - - DH_generate_key(dh->dh); - -#if OPENSSL_VERSION_NUMBER >= 0x10100000L - DH_get0_key(dh->dh, &pub, &priv); - dh->MyPublicKey = BigNumToBuf(pub); - dh->MyPrivateKey = BigNumToBuf(priv); -#else - dh->MyPublicKey = BigNumToBuf(dh->dh->pub_key); - dh->MyPrivateKey = BigNumToBuf(dh->dh->priv_key); -#endif - - dh->Size = buf->Size; - - FreeBuf(buf); - - return dh; -} - -// Release of DH -void DhFree(DH_CTX *dh) -{ - // Validate arguments - if (dh == NULL) - { - return; - } - - DH_free(dh->dh); - - FreeBuf(dh->MyPrivateKey); - FreeBuf(dh->MyPublicKey); - - Free(dh); -} - -int GetSslClientCertIndex() -{ - return ssl_clientcert_index; -} - -// Internal functions -static UINT Internal_HMac(const EVP_MD *md, void *dest, void *key, UINT key_size, const void *src, const UINT src_size) -{ - MD *m; - UINT len = 0; - - // Validate arguments - if (md == NULL || dest == NULL || key == NULL || key_size == 0 || (src == NULL && src_size != 0)) - { - return 0; - } - - m = ZeroMalloc(sizeof(MD)); -#if OPENSSL_VERSION_NUMBER >= 0x10100000L - m->Ctx = HMAC_CTX_new(); -#else - m->Ctx = ZeroMalloc(sizeof(HMAC_CTX)); - HMAC_CTX_init(m->Ctx); -#endif - m->Md = md; - m->IsHMac = true; - - if (SetMdKey(m, key, key_size) == false) - { - Debug("Internal_HMac(): SetMdKey() failed!\n"); - goto final; - } - - len = MdProcess(m, dest, (void *)src, src_size); - if (len == 0) - { - Debug("Internal_HMac(): MdProcess() returned 0!\n"); - } - -final: - FreeMd(m); - return len; -} - -///////////////////////// -// SHA0 implementation // -///////////////////////// - -// Source codes from: -// https://android.googlesource.com/platform/system/core/+/81df1cc77722000f8d0025c1ab00ced123aa573c/libmincrypt/sha.c -// https://android.googlesource.com/platform/system/core/+/81df1cc77722000f8d0025c1ab00ced123aa573c/include/mincrypt/hash-internal.h -// https://android.googlesource.com/platform/system/core/+/81df1cc77722000f8d0025c1ab00ced123aa573c/include/mincrypt/sha.h - -/* - * Copyright 2013 The Android Open Source Project - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * * Neither the name of Google Inc. nor the names of its contributors may - * be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY Google Inc. ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO - * EVENT SHALL Google Inc. BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; - * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF - * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - - -#define rol(bits, value) (((value) << (bits)) | ((value) >> (32 - (bits)))) - -typedef struct MY_SHA0_CTX { -// const HASH_VTAB * f; - UINT64 count; - UCHAR buf[64]; - UINT state[8]; // upto SHA2 -} MY_SHA0_CTX; - -#define MY_SHA0_DIGEST_SIZE 20 - -static void MY_SHA0_Transform(MY_SHA0_CTX* ctx) { - UINT W[80]; - UINT A, B, C, D, E; - UCHAR* p = ctx->buf; - int t; - for(t = 0; t < 16; ++t) { - UINT tmp = *p++ << 24; - tmp |= *p++ << 16; - tmp |= *p++ << 8; - tmp |= *p++; - W[t] = tmp; - } - for(; t < 80; t++) { - //W[t] = rol(1,W[t-3] ^ W[t-8] ^ W[t-14] ^ W[t-16]); - W[t] = (1,W[t-3] ^ W[t-8] ^ W[t-14] ^ W[t-16]); - } - A = ctx->state[0]; - B = ctx->state[1]; - C = ctx->state[2]; - D = ctx->state[3]; - E = ctx->state[4]; - for(t = 0; t < 80; t++) { - UINT tmp = rol(5,A) + E + W[t]; - if (t < 20) - tmp += (D^(B&(C^D))) + 0x5A827999; - else if ( t < 40) - tmp += (B^C^D) + 0x6ED9EBA1; - else if ( t < 60) - tmp += ((B&C)|(D&(B|C))) + 0x8F1BBCDC; - else - tmp += (B^C^D) + 0xCA62C1D6; - E = D; - D = C; - C = rol(30,B); - B = A; - A = tmp; - } - ctx->state[0] += A; - ctx->state[1] += B; - ctx->state[2] += C; - ctx->state[3] += D; - ctx->state[4] += E; -} -void MY_SHA0_init(MY_SHA0_CTX* ctx) { - //ctx->f = &SHA_VTAB; - ctx->state[0] = 0x67452301; - ctx->state[1] = 0xEFCDAB89; - ctx->state[2] = 0x98BADCFE; - ctx->state[3] = 0x10325476; - ctx->state[4] = 0xC3D2E1F0; - ctx->count = 0; -} -void MY_SHA0_update(MY_SHA0_CTX* ctx, const void* data, int len) { - int i = (int) (ctx->count & 63); - const UCHAR* p = (const UCHAR*)data; - ctx->count += len; - while (len--) { - ctx->buf[i++] = *p++; - if (i == 64) { - MY_SHA0_Transform(ctx); - i = 0; - } - } -} -const UCHAR* MY_SHA0_final(MY_SHA0_CTX* ctx) { - UCHAR *p = ctx->buf; - UINT64 cnt = ctx->count * 8; - int i; - MY_SHA0_update(ctx, (UCHAR*)"\x80", 1); - while ((ctx->count & 63) != 56) { - MY_SHA0_update(ctx, (UCHAR*)"\0", 1); - } - for (i = 0; i < 8; ++i) { - UCHAR tmp = (UCHAR) (cnt >> ((7 - i) * 8)); - MY_SHA0_update(ctx, &tmp, 1); - } - for (i = 0; i < 5; i++) { - UINT tmp = ctx->state[i]; - *p++ = tmp >> 24; - *p++ = tmp >> 16; - *p++ = tmp >> 8; - *p++ = tmp >> 0; - } - return ctx->buf; -} -/* Convenience function */ -const UCHAR* MY_SHA0_hash(const void* data, int len, UCHAR* digest) { - MY_SHA0_CTX ctx; - MY_SHA0_init(&ctx); - MY_SHA0_update(&ctx, data, len); - memcpy(digest, MY_SHA0_final(&ctx), MY_SHA0_DIGEST_SIZE); - return digest; -} -static void Internal_Sha0(unsigned char *dest, const unsigned char *src, const UINT size) -{ - MY_SHA0_hash(src, (int)size, dest); -} +// SoftEther VPN Source Code - Developer Edition Master Branch +// Mayaqua Kernel +// © 2020 Nokia + +// Encrypt.c +// Encryption and digital certification routine + +#include + +#define ENCRYPT_C + +#define __WINCRYPT_H__ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#ifdef _MSC_VER + #include // For __cpuid() +#else // _MSC_VER + + +#ifndef SKIP_CPU_FEATURES + #include "cpu_features_macros.h" +#endif + + #if defined(CPU_FEATURES_ARCH_X86) + #include "cpuinfo_x86.h" + #elif defined(CPU_FEATURES_ARCH_ARM) + #include "cpuinfo_arm.h" + #elif defined(CPU_FEATURES_ARCH_AARCH64) + #include "cpuinfo_aarch64.h" + #elif defined(CPU_FEATURES_ARCH_MIPS) + #include "cpuinfo_mips.h" + #elif defined(CPU_FEATURES_ARCH_PPC) + #include "cpuinfo_ppc.h" + #endif +#endif // _MSC_VER + +LOCK *openssl_lock = NULL; + +int ssl_clientcert_index = 0; + +LOCK **ssl_lock_obj = NULL; +UINT ssl_lock_num; +static bool openssl_inited = false; + +static UINT Internal_HMac(const EVP_MD *md, void *dest, void *key, UINT key_size, const void *src, const UINT src_size); +static void Internal_Sha0(unsigned char *dest, const unsigned char *src, const UINT size); + +// For the callback function +typedef struct CB_PARAM +{ + char *password; +} CB_PARAM; + +// Copied from t1_enc.c of OpenSSL +void Enc_tls1_P_hash(const EVP_MD *md, const unsigned char *sec, int sec_len, + const unsigned char *seed, int seed_len, unsigned char *out, int olen) +{ + int chunk,n; + unsigned int j; + HMAC_CTX *ctx; + HMAC_CTX *ctx_tmp; + unsigned char A1[EVP_MAX_MD_SIZE]; + unsigned int A1_len; + +#if OPENSSL_VERSION_NUMBER >= 0x10100000L + ctx = HMAC_CTX_new(); + ctx_tmp = HMAC_CTX_new(); +#else + HMAC_CTX ctx_; + HMAC_CTX ctx_tmp_; + ctx = &ctx_; + ctx_tmp = &ctx_tmp_; + Zero(ctx, sizeof(HMAC_CTX)); + Zero(ctx_tmp, sizeof(HMAC_CTX)); +#endif + chunk=EVP_MD_size(md); + + HMAC_Init_ex(ctx,sec,sec_len,md, NULL); + HMAC_Init_ex(ctx_tmp,sec,sec_len,md, NULL); + HMAC_Update(ctx,seed,seed_len); + HMAC_Final(ctx,A1,&A1_len); + + n=0; + for (;;) + { + HMAC_Init_ex(ctx,NULL,0,NULL,NULL); /* re-init */ + HMAC_Init_ex(ctx_tmp,NULL,0,NULL,NULL); /* re-init */ + HMAC_Update(ctx,A1,A1_len); + HMAC_Update(ctx_tmp,A1,A1_len); + HMAC_Update(ctx,seed,seed_len); + + if (olen > chunk) + { + HMAC_Final(ctx,out,&j); + out+=j; + olen-=j; + HMAC_Final(ctx_tmp,A1,&A1_len); /* calc the next A1 value */ + } + else /* last one */ + { + HMAC_Final(ctx,A1,&A1_len); + memcpy(out,A1,olen); + break; + } + } +#if OPENSSL_VERSION_NUMBER >= 0x10100000L + HMAC_CTX_free(ctx); + HMAC_CTX_free(ctx_tmp); +#else + HMAC_CTX_cleanup(ctx); + HMAC_CTX_cleanup(ctx_tmp); +#endif + Zero (A1, sizeof(A1)); +} + +void Enc_tls1_PRF(unsigned char *label, int label_len, const unsigned char *sec, + int slen, unsigned char *out1, int olen) +{ + const EVP_MD *md5 = EVP_md5(); + const EVP_MD *sha1 = EVP_sha1(); + int len,i; + const unsigned char *S1,*S2; + unsigned char *out2; + + out2 = (unsigned char *) Malloc (olen); + + len=slen/2; + S1=sec; + S2= &(sec[len]); + len+=(slen&1); /* add for odd, make longer */ + + + Enc_tls1_P_hash(md5 ,S1,len,label,label_len,out1,olen); + Enc_tls1_P_hash(sha1,S2,len,label,label_len,out2,olen); + + for (i=0; iName, sizeof(m->Name), name); + + if (StrCmpi(name, "[null-digest]") == 0 || + StrCmpi(name, "NULL") == 0 || + IsEmptyStr(name)) + { + m->IsNullMd = true; + return m; + } + + m->Md = (const struct evp_md_st *)EVP_get_digestbyname(name); + if (m->Md == NULL) + { + Debug("NewMdEx(): Algorithm %s not found by EVP_get_digestbyname().\n", m->Name); + FreeMd(m); + return NULL; + } + + m->Size = EVP_MD_size((const EVP_MD *)m->Md); + m->IsHMac = hmac; + + if (hmac) + { +#if OPENSSL_VERSION_NUMBER >= 0x10100000L + m->Ctx = HMAC_CTX_new(); +#else + m->Ctx = ZeroMalloc(sizeof(struct hmac_ctx_st)); + HMAC_CTX_init(m->Ctx); +#endif + } + else + { +#if OPENSSL_VERSION_NUMBER >= 0x10100000L + m->Ctx = EVP_MD_CTX_new(); +#else + m->Ctx = EVP_MD_CTX_create(); +#endif + if (EVP_DigestInit_ex(m->Ctx, m->Md, NULL) == false) + { + Debug("NewMdEx(): EVP_DigestInit_ex() failed with error: %s\n", OpenSSL_Error()); + FreeMd(m); + } + } + + return m; +} + +// Set the key to the message digest object +bool SetMdKey(MD *md, void *key, UINT key_size) +{ + // Validate arguments + if (md == NULL || md->IsHMac == false || key == NULL || key_size == 0) + { + return false; + } + + if (HMAC_Init_ex(md->Ctx, key, key_size, (const EVP_MD *)md->Md, NULL) == false) + { + Debug("SetMdKey(): HMAC_Init_ex() failed with error: %s\n", OpenSSL_Error()); + return false; + } + + return true; +} + +// Calculate the hash/HMAC +UINT MdProcess(MD *md, void *dest, void *src, UINT size) +{ + UINT len = 0; + + // Validate arguments + if (md == NULL || md->IsNullMd || dest == NULL || (src == NULL && size != 0)) + { + return 0; + } + + if (md->IsHMac) + { + // WARNING: Do not remove the call to HMAC_Init_ex(), it's required even if the context is initialized by SetMdKey()! + if (HMAC_Init_ex(md->Ctx, NULL, 0, NULL, NULL) == false) + { + Debug("MdProcess(): HMAC_Init_ex() failed with error: %s\n", OpenSSL_Error()); + return 0; + } + + if (HMAC_Update(md->Ctx, src, size) == false) + { + Debug("MdProcess(): HMAC_Update() failed with error: %s\n", OpenSSL_Error()); + return 0; + } + + if (HMAC_Final(md->Ctx, dest, &len) == false) + { + Debug("MdProcess(): HMAC_Final() failed with error: %s\n", OpenSSL_Error()); + } + } + else + { + if (EVP_DigestUpdate(md->Ctx, src, size) == false) + { + Debug("MdProcess(): EVP_DigestUpdate() failed with error: %s\n", OpenSSL_Error()); + return 0; + } + + if (EVP_DigestFinal_ex(md->Ctx, dest, &len) == false) + { + Debug("MdProcess(): EVP_DigestFinal_ex() failed with error: %s\n", OpenSSL_Error()); + } + } + + return len; +} + +// Release of the message digest object +void FreeMd(MD *md) +{ + // Validate arguments + if (md == NULL) + { + return; + } + + if (md->Ctx != NULL) + { + if (md->IsHMac) + { +#if OPENSSL_VERSION_NUMBER >= 0x10100000L + HMAC_CTX_free(md->Ctx); +#else + HMAC_CTX_cleanup(md->Ctx); + Free(md->Ctx); +#endif + } + else + { +#if OPENSSL_VERSION_NUMBER >= 0x10100000L + EVP_MD_CTX_free(md->Ctx); +#else + EVP_MD_CTX_destroy(md->Ctx); +#endif + } + } + + Free(md); +} + +// Creating a cipher object +CIPHER *NewCipher(char *name) +{ + CIPHER *c; + // Validate arguments + if (name == NULL) + { + return NULL; + } + + c = ZeroMalloc(sizeof(CIPHER)); + + StrCpy(c->Name, sizeof(c->Name), name); + + if (StrCmpi(name, "[null-cipher]") == 0 || + StrCmpi(name, "NULL") == 0 || + IsEmptyStr(name)) + { + c->IsNullCipher = true; + return c; + } + + c->Cipher = EVP_get_cipherbyname(c->Name); + if (c->Cipher == NULL) + { + Debug("NewCipher(): Cipher %s not found by EVP_get_cipherbyname().\n", c->Name); + FreeCipher(c); + return NULL; + } + +#if OPENSSL_VERSION_NUMBER >= 0x10100000L + c->Ctx = EVP_CIPHER_CTX_new(); +#else + c->Ctx = ZeroMalloc(sizeof(struct evp_cipher_ctx_st)); + EVP_CIPHER_CTX_init(c->Ctx); +#endif + + c->IsAeadCipher = EVP_CIPHER_flags(c->Cipher) & EVP_CIPH_FLAG_AEAD_CIPHER; + c->BlockSize = EVP_CIPHER_block_size(c->Cipher); + c->KeySize = EVP_CIPHER_key_length(c->Cipher); + c->IvSize = EVP_CIPHER_iv_length(c->Cipher); + + return c; +} + +// Set the key to the cipher object +void SetCipherKey(CIPHER *c, void *key, bool enc) +{ + // Validate arguments + if (c == NULL || key == NULL) + { + return; + } + + if (c->IsNullCipher == false) + { + if (c->Ctx != NULL) + { + EVP_CipherInit(c->Ctx, c->Cipher, key, NULL, enc); + } + } + + c->Encrypt = enc; +} + +// Process encryption / decryption +UINT CipherProcess(CIPHER *c, void *iv, void *dest, void *src, UINT size) +{ + int r = size; + int r2 = 0; + if (c != NULL && c->IsNullCipher) + { + if (dest != src) + { + Copy(dest, src, size); + } + return size; + } + // Validate arguments + if (c == NULL || iv == NULL || dest == NULL || src == NULL || size == 0) + { + return 0; + } + + if (EVP_CipherInit(c->Ctx, NULL, NULL, iv, c->Encrypt) == 0) + { + return 0; + } + + if (EVP_CipherUpdate(c->Ctx, dest, &r, src, size) == 0) + { + return 0; + } + + if (EVP_CipherFinal(c->Ctx, ((UCHAR *)dest) + (UINT)r, &r2) == 0) + { + return 0; + } + + return r + r2; +} + +// Process encryption / decryption (AEAD) +UINT CipherProcessAead(CIPHER *c, void *iv, void *tag, UINT tag_size, void *dest, void *src, UINT src_size, void *aad, UINT aad_size) +{ + int r = src_size; + int r2 = 0; + // Validate arguments + if (c == NULL) + { + return 0; + } + else if (c->IsNullCipher) + { + Copy(dest, src, src_size); + return src_size; + } + else if (c->IsAeadCipher == false || iv == NULL || tag == NULL || tag_size == 0 || dest == NULL || src == NULL || src_size == 0) + { + return 0; + } + + if (EVP_CipherInit_ex(c->Ctx, NULL, NULL, NULL, iv, c->Encrypt) == false) + { + Debug("CipherProcessAead(): EVP_CipherInit_ex() failed with error: %s\n", OpenSSL_Error()); + return 0; + } + + if (c->Encrypt == false) + { + if (EVP_CIPHER_CTX_ctrl(c->Ctx, EVP_CTRL_AEAD_SET_TAG, tag_size, tag) == false) + { + Debug("CipherProcessAead(): EVP_CIPHER_CTX_ctrl() failed to set the tag!\n"); + return 0; + } + } + + if (aad != NULL && aad_size != 0) + { + if (EVP_CipherUpdate(c->Ctx, NULL, &r, aad, aad_size) == false) + { + Debug("CipherProcessAead(): EVP_CipherUpdate() failed with error: %s\n", OpenSSL_Error()); + return 0; + } + } + + if (EVP_CipherUpdate(c->Ctx, dest, &r, src, src_size) == false) + { + Debug("CipherProcessAead(): EVP_CipherUpdate() failed with error: %s\n", OpenSSL_Error()); + return 0; + } + + if (EVP_CipherFinal_ex(c->Ctx, ((UCHAR *)dest) + (UINT)r, &r2) == false) + { + Debug("CipherProcessAead(): EVP_CipherFinal_ex() failed with error: %s\n", OpenSSL_Error()); + return 0; + } + + if (c->Encrypt) + { + if (EVP_CIPHER_CTX_ctrl(c->Ctx, EVP_CTRL_AEAD_GET_TAG, tag_size, tag) == false) + { + Debug("CipherProcessAead(): EVP_CIPHER_CTX_ctrl() failed to get the tag!\n"); + return 0; + } + } + + return r + r2; +} + +// Release of the cipher object +void FreeCipher(CIPHER *c) +{ + // Validate arguments + if (c == NULL) + { + return; + } + + if (c->Ctx != NULL) + { +#if OPENSSL_VERSION_NUMBER >= 0x10100000L + EVP_CIPHER_CTX_free(c->Ctx); +#else + EVP_CIPHER_CTX_cleanup(c->Ctx); + Free(c->Ctx); +#endif + } + + Free(c); +} + +// Convert the public key to a buffer +BUF *RsaPublicToBuf(K *k) +{ + BUF *b; +#if OPENSSL_VERSION_NUMBER >= 0x10100000L + RSA *rsa; + const BIGNUM *n; +#endif + // Validate arguments + if (k == NULL || k->pkey == NULL) + { + return NULL; + } + +#if OPENSSL_VERSION_NUMBER >= 0x10100000L + rsa = EVP_PKEY_get0_RSA(k->pkey); + if (rsa == NULL) + { + return NULL; + } + + RSA_get0_key(rsa, &n, NULL, NULL); + if (n == NULL) + { + return NULL; + } + + b = BigNumToBuf(n); +#else + if (k->pkey->pkey.rsa == NULL || k->pkey->pkey.rsa->n == NULL) + { + return NULL; + } + + b = BigNumToBuf(k->pkey->pkey.rsa->n); +#endif + + if (b == NULL) + { + return NULL; + } + + return b; +} + +// Get public key size +UINT RsaPublicSize(K *k) +{ + BUF *b; + UINT ret; + + b = RsaPublicToBuf(k); + if (b == NULL) + { + return 0; + } + + ret = b->Size; + + FreeBuf(b); + + return ret; +} + +// Hash a pointer to a 32-bit +UINT HashPtrToUINT(void *p) +{ + UCHAR hash_data[MD5_SIZE]; + UINT ret; + // Validate arguments + if (p == NULL) + { + return 0; + } + + Md5(hash_data, &p, sizeof(p)); + + Copy(&ret, hash_data, sizeof(ret)); + + return ret; +} + +// Copy of the NAME +NAME *CopyName(NAME *n) +{ + // Validate arguments + if (n == NULL) + { + return NULL; + } + + return NewName(n->CommonName, n->Organization, n->Unit, + n->Country, n->State, n->Local); +} + +// Convert the binary to the BIGNUM +BIGNUM *BinToBigNum(void *data, UINT size) +{ + BIGNUM *bn; + // Validate arguments + if (data == NULL) + { + return NULL; + } + + bn = BN_new(); + BN_bin2bn(data, size, bn); + + return bn; +} + +// Convert a BIGNUM to a buffer +BUF *BigNumToBuf(const BIGNUM *bn) +{ + UINT size; + UCHAR *tmp; + BUF *b; + // Validate arguments + if (bn == NULL) + { + return NULL; + } + + size = BN_num_bytes(bn); + tmp = ZeroMalloc(size); + BN_bn2bin(bn, tmp); + + b = NewBuf(); + WriteBuf(b, tmp, size); + Free(tmp); + + SeekBuf(b, 0, 0); + + return b; +} + +#if OPENSSL_VERSION_NUMBER < 0x10100000L || defined(LIBRESSL_VERSION_NUMBER) +// Return the thread ID +static void OpenSSL_Id(CRYPTO_THREADID *id) +{ + CRYPTO_THREADID_set_numeric(id, (unsigned long)ThreadId()); +} +#endif + +// Initialization of the lock of OpenSSL +void OpenSSL_InitLock() +{ +#if OPENSSL_VERSION_NUMBER < 0x10100000L || defined(LIBRESSL_VERSION_NUMBER) + UINT i; + + // Initialization of the lock object + ssl_lock_num = CRYPTO_num_locks(); + ssl_lock_obj = Malloc(sizeof(LOCK *) * ssl_lock_num); + for (i = 0;i < ssl_lock_num;i++) + { + ssl_lock_obj[i] = NewLock(); + } + + // Setting the lock function + CRYPTO_set_locking_callback(OpenSSL_Lock); + CRYPTO_THREADID_set_callback(OpenSSL_Id); +#endif +} + +// Release of the lock of OpenSSL +void OpenSSL_FreeLock() +{ +#if OPENSSL_VERSION_NUMBER < 0x10100000L || defined(LIBRESSL_VERSION_NUMBER) + UINT i; + + for (i = 0;i < ssl_lock_num;i++) + { + DeleteLock(ssl_lock_obj[i]); + } + Free(ssl_lock_obj); + ssl_lock_obj = NULL; + + CRYPTO_set_locking_callback(NULL); + CRYPTO_THREADID_set_callback(NULL); +#endif +} + +// Lock function for OpenSSL +void OpenSSL_Lock(int mode, int n, const char *file, int line) +{ +#if OPENSSL_VERSION_NUMBER < 0x10100000L || defined(LIBRESSL_VERSION_NUMBER) + LOCK *lock = ssl_lock_obj[n]; + + if (mode & CRYPTO_LOCK) + { + // Lock + Lock(lock); + } + else + { + // Unlock + Unlock(lock); + } +#endif +} + +char *OpenSSL_Error() +{ + return ERR_error_string(ERR_get_error(), NULL); +} + +// Get the display name of the certificate +void GetPrintNameFromX(wchar_t *str, UINT size, X *x) +{ + // Validate arguments + if (x == NULL || str == NULL) + { + return; + } + + GetPrintNameFromName(str, size, x->subject_name); +} +void GetPrintNameFromXA(char *str, UINT size, X *x) +{ + wchar_t tmp[MAX_SIZE]; + // Validate arguments + if (str == NULL || x == NULL) + { + return; + } + + GetPrintNameFromX(tmp, sizeof(tmp), x); + + UniToStr(str, size, tmp); +} + +// Get the display name from NAME +void GetPrintNameFromName(wchar_t *str, UINT size, NAME *name) +{ + // Validate arguments + if (str == NULL || name == NULL) + { + return; + } + + if (name->CommonName != NULL) + { + UniStrCpy(str, size, name->CommonName); + } + else if (name->Organization != NULL) + { + UniStrCpy(str, size, name->Organization); + } + else if (name->Unit != NULL) + { + UniStrCpy(str, size, name->Unit); + } + else if (name->State != NULL) + { + UniStrCpy(str, size, name->State); + } + else if (name->Local != NULL) + { + UniStrCpy(str, size, name->Local); + } + else if (name->Country != NULL) + { + UniStrCpy(str, size, name->Country); + } + else + { + UniStrCpy(str, size, L"untitled"); + } +} + +// Get all the name strings from the certificate +void GetAllNameFromX(wchar_t *str, UINT size, X *x) +{ + UCHAR md5[MD5_SIZE], sha1[SHA1_SIZE]; + char tmp1[MD5_SIZE * 3 + 8], tmp2[SHA1_SIZE * 3 + 8]; + wchar_t tmp3[sizeof(tmp1) + sizeof(tmp2) + 64]; + // Validate arguments + if (str == NULL || x == NULL) + { + return; + } + + GetAllNameFromName(str, size, x->subject_name); + + if (x->serial != NULL && x->serial->size >= 1) + { + char tmp[128]; + wchar_t tmp2[128]; + + BinToStr(tmp, sizeof(tmp), x->serial->data, x->serial->size); + UniFormat(tmp2, sizeof(tmp2), L", SERIAL=\"%S\"", tmp); + + UniStrCat(str, size, tmp2); + } + + // Digest value + GetXDigest(x, md5, false); + GetXDigest(x, sha1, true); + + BinToStr(tmp1, sizeof(tmp1), md5, MD5_SIZE); + BinToStr(tmp2, sizeof(tmp2), sha1, SHA1_SIZE); + + UniFormat(tmp3, sizeof(tmp3), L" (Digest: MD5=\"%S\", SHA1=\"%S\")", tmp1, tmp2); + UniStrCat(str, size, tmp3); +} + +// Get the all name strings from NAME +void GetAllNameFromName(wchar_t *str, UINT size, NAME *name) +{ + UniStrCpy(str, size, L""); + // Validate arguments + if (str == NULL || name == NULL) + { + return; + } + + if (name->CommonName != NULL) + { + UniFormat(str, size, L"%sCN=%s, ", str, name->CommonName); + } + if (name->Organization != NULL) + { + UniFormat(str, size, L"%sO=%s, ", str, name->Organization); + } + if (name->Unit != NULL) + { + UniFormat(str, size, L"%sOU=%s, ", str, name->Unit); + } + if (name->State != NULL) + { + UniFormat(str, size, L"%sS=%s, ", str, name->State); + } + if (name->Local != NULL) + { + UniFormat(str, size, L"%sL=%s, ", str, name->Local); + } + if (name->Country != NULL) + { + UniFormat(str, size, L"%sC=%s, ", str, name->Country); + } + + if (UniStrLen(str) >= 3) + { + UINT len = UniStrLen(str); + if (str[len - 2] == L',' && + str[len - 1] == L' ') + { + str[len - 2] = 0; + } + } +} +void GetAllNameFromNameEx(wchar_t *str, UINT size, NAME *name) +{ + // Validate arguments + if (str == NULL || name == NULL) + { + return; + } + + UniStrCpy(str, size, L""); + if (name->CommonName != NULL) + { + UniFormat(str, size, L"%s%s, ", str, name->CommonName); + } + if (name->Organization != NULL) + { + UniFormat(str, size, L"%s%s, ", str, name->Organization); + } + if (name->Unit != NULL) + { + UniFormat(str, size, L"%s%s, ", str, name->Unit); + } + if (name->State != NULL) + { + UniFormat(str, size, L"%s%s, ", str, name->State); + } + if (name->Local != NULL) + { + UniFormat(str, size, L"%s%s, ", str, name->Local); + } + if (name->Country != NULL) + { + UniFormat(str, size, L"%s%s, ", str, name->Country); + } + + if (UniStrLen(str) >= 3) + { + UINT len = UniStrLen(str); + if (str[len - 2] == L',' && + str[len - 1] == L' ') + { + str[len - 2] = 0; + } + } +} + +// Clone of the key +K *CloneK(K *k) +{ + BUF *b; + K *ret; + // Validate arguments + if (k == NULL) + { + return NULL; + } + + b = KToBuf(k, false, NULL); + if (b == NULL) + { + return NULL; + } + + ret = BufToK(b, k->private_key, false, NULL); + FreeBuf(b); + + return ret; +} + +// Clone of certificate +X *CloneX(X *x) +{ + BUF *b; + X *ret; + // Validate arguments + if (x == NULL) + { + return NULL; + } + + b = XToBuf(x, false); + if (b == NULL) + { + return NULL; + } + + ret = BufToX(b, false); + FreeBuf(b); + + return ret; +} + +// Generate a P12 +P12 *NewP12(X *x, K *k, char *password) +{ + PKCS12 *pkcs12; + P12 *p12; + // Validate arguments + if (x == NULL || k == NULL) + { + return false; + } + if (password && StrLen(password) == 0) + { + password = NULL; + } + + Lock(openssl_lock); + { + pkcs12 = PKCS12_create(password, NULL, k->pkey, x->x509, NULL, 0, 0, 0, 0, 0); + if (pkcs12 == NULL) + { + Unlock(openssl_lock); + return NULL; + } + } + Unlock(openssl_lock); + + p12 = PKCS12ToP12(pkcs12); + + return p12; +} + +// Check whether the P12 is encrypted +bool IsEncryptedP12(P12 *p12) +{ + X *x; + K *k; + // Validate arguments + if (p12 == NULL) + { + return false; + } + + if (ParseP12(p12, &x, &k, NULL) == true) + { + FreeX(x); + FreeK(k); + return false; + } + + return true; +} + +// Extract the X and the K from the P12 +bool ParseP12(P12 *p12, X **x, K **k, char *password) +{ + EVP_PKEY *pkey; + X509 *x509; + // Validate arguments + if (p12 == NULL || x == NULL || k == NULL) + { + return false; + } + if (password && StrLen(password) == 0) + { + password = NULL; + } + if (password == NULL) + { + password = ""; + } + + // Password confirmation + Lock(openssl_lock); + { + if (PKCS12_verify_mac(p12->pkcs12, password, -1) == false && + PKCS12_verify_mac(p12->pkcs12, NULL, -1) == false) + { + Unlock(openssl_lock); + return false; + } + } + Unlock(openssl_lock); + + // Extraction + Lock(openssl_lock); + { + if (PKCS12_parse(p12->pkcs12, password, &pkey, &x509, NULL) == false) + { + if (PKCS12_parse(p12->pkcs12, NULL, &pkey, &x509, NULL) == false) + { + Unlock(openssl_lock); + return false; + } + } + } + Unlock(openssl_lock); + + // Conversion + *x = X509ToX(x509); + + if (*x == NULL) + { + FreePKey(pkey); + return false; + } + + *k = ZeroMalloc(sizeof(K)); + (*k)->private_key = true; + (*k)->pkey = pkey; + + return true; +} + +// Write the P12 to a file +bool P12ToFileW(P12 *p12, wchar_t *filename) +{ + BUF *b; + // Validate arguments + if (p12 == NULL || filename == NULL) + { + return false; + } + + b = P12ToBuf(p12); + if (b == NULL) + { + return false; + } + + if (DumpBufW(b, filename) == false) + { + FreeBuf(b); + return false; + } + + FreeBuf(b); + + return true; +} + +// Release of P12 +void FreeP12(P12 *p12) +{ + // Validate arguments + if (p12 == NULL) + { + return; + } + + FreePKCS12(p12->pkcs12); + Free(p12); +} + +// Release of PKCS12 +void FreePKCS12(PKCS12 *pkcs12) +{ + // Validate arguments + if (pkcs12 == NULL) + { + return; + } + + PKCS12_free(pkcs12); +} + +// Converted the P12 to a BUF +BUF *P12ToBuf(P12 *p12) +{ + BIO *bio; + BUF *buf; + // Validate arguments + if (p12 == NULL) + { + return NULL; + } + + bio = P12ToBio(p12); + if (bio == NULL) + { + return NULL; + } + + buf = BioToBuf(bio); + FreeBio(bio); + + SeekBuf(buf, 0, 0); + + return buf; +} + +// Converted the P12 to a BIO +BIO *P12ToBio(P12 *p12) +{ + BIO *bio; + // Validate arguments + if (p12 == NULL) + { + return NULL; + } + + bio = NewBio(); + Lock(openssl_lock); + { + i2d_PKCS12_bio(bio, p12->pkcs12); + } + Unlock(openssl_lock); + + return bio; +} + +// Read the P12 from the BUF +P12 *BufToP12(BUF *b) +{ + P12 *p12; + BIO *bio; + // Validate arguments + if (b == NULL) + { + return NULL; + } + + bio = BufToBio(b); + if (bio == NULL) + { + return NULL; + } + + p12 = BioToP12(bio); + FreeBio(bio); + + return p12; +} + +// Read the P12 from the BIO +P12 *BioToP12(BIO *bio) +{ + PKCS12 *pkcs12; + // Validate arguments + if (bio == NULL) + { + return NULL; + } + + // Conversion + Lock(openssl_lock); + { + pkcs12 = d2i_PKCS12_bio(bio, NULL); + } + Unlock(openssl_lock); + if (pkcs12 == NULL) + { + // Failure + return NULL; + } + + return PKCS12ToP12(pkcs12); +} + +// Generate a P12 from a PKCS12 +P12 *PKCS12ToP12(PKCS12 *pkcs12) +{ + P12 *p12; + // Validate arguments + if (pkcs12 == NULL) + { + return NULL; + } + + p12 = ZeroMalloc(sizeof(P12)); + p12->pkcs12 = pkcs12; + + return p12; +} + +// Release of X_SERIAL +void FreeXSerial(X_SERIAL *serial) +{ + // Validate arguments + if (serial == NULL) + { + return; + } + + Free(serial->data); + Free(serial); +} + +// Comparison of X_SERIAL +bool CompareXSerial(X_SERIAL *s1, X_SERIAL *s2) +{ + // Validate arguments + if (s1 == NULL || s2 == NULL) + { + return false; + } + + if (s1->size != s2->size) + { + return false; + } + + if (Cmp(s1->data, s2->data, s1->size) != 0) + { + return false; + } + + return true; +} + +// Copy of X_SERIAL +X_SERIAL *CloneXSerial(X_SERIAL *src) +{ + X_SERIAL *s; + // Validate arguments + if (src == NULL) + { + return NULL; + } + + s = ZeroMalloc(sizeof(X_SERIAL)); + s->data = ZeroMalloc(src->size); + Copy(s->data, src->data, src->size); + s->size = src->size; + + return s; +} + +// Initialization of X_SERIAL +X_SERIAL *NewXSerial(void *data, UINT size) +{ + X_SERIAL *serial; + UCHAR *buf = (UCHAR *)data; + UINT i; + // Validate arguments + if (data == NULL || size == 0) + { + return NULL; + } + + for (i = 0;i < size;i++) + { + if (buf[i] != 0) + { + break; + } + } + if (i == size) + { + i = size - 1; + } + buf += i; + + serial = Malloc(sizeof(X_SERIAL)); + serial->size = size - i; + serial->data = ZeroMalloc(size + 16); + Copy(serial->data, buf, size - i); + + return serial; +} + +// Get the number of days till January 1, 2038 +UINT GetDaysUntil2038() +{ + UINT64 now = SystemTime64(); + UINT64 target; + SYSTEMTIME st; + + Zero(&st, sizeof(st)); + st.wYear = 2038; + st.wMonth = 1; + st.wDay = 1; + + target = SystemToUINT64(&st); + + if (now >= target) + { + return 0; + } + else + { + return (UINT)((target - now) / (UINT64)(1000 * 60 * 60 * 24)); + } +} +UINT GetDaysUntil2038Ex() +{ + SYSTEMTIME now; + + Zero(&now, sizeof(now)); + SystemTime(&now); + + if (now.wYear >= 2030) + { + UINT64 now = SystemTime64(); + UINT64 target; + SYSTEMTIME st; + + Zero(&st, sizeof(st)); + st.wYear = 2049; + st.wMonth = 12; + st.wDay = 30; + + target = SystemToUINT64(&st); + + if (now >= target) + { + return 0; + } + else + { + return (UINT)((target - now) / (UINT64)(1000 * 60 * 60 * 24)); + } + } + else + { + return GetDaysUntil2038(); + } +} + +// Issue an X509 certificate +X *NewX(K *pub, K *priv, X *ca, NAME *name, UINT days, X_SERIAL *serial) +{ + X509 *x509; + X *x; + // Validate arguments + if (pub == NULL || priv == NULL || name == NULL || ca == NULL) + { + return NULL; + } + + x509 = NewX509(pub, priv, ca, name, days, serial); + if (x509 == NULL) + { + return NULL; + } + + x = X509ToX(x509); + + if (x == NULL) + { + return NULL; + } + + return x; +} + +// Create a root certificate +X *NewRootX(K *pub, K *priv, NAME *name, UINT days, X_SERIAL *serial) +{ + X509 *x509; + X *x, *x2; + // Validate arguments + if (pub == NULL || priv == NULL || name == NULL) + { + return NULL; + } + + x509 = NewRootX509(pub, priv, name, days, serial); + if (x509 == NULL) + { + return NULL; + } + + x = X509ToX(x509); + if (x == NULL) + { + return NULL; + } + + x2 = CloneX(x); + FreeX(x); + + return x2; +} + +// Create new X509 basic & extended key usage +void AddKeyUsageX509(EXTENDED_KEY_USAGE *ex, int nid) +{ + ASN1_OBJECT *obj; + // Validate arguments + if (ex == NULL) + { + return; + } + + obj = OBJ_nid2obj(nid); + if (obj != NULL) + { + sk_ASN1_OBJECT_push(ex, obj); + } +} +X509_EXTENSION *NewExtendedKeyUsageForX509() +{ + EXTENDED_KEY_USAGE *ex = sk_ASN1_OBJECT_new_null(); + X509_EXTENSION *ret; + + AddKeyUsageX509(ex, NID_server_auth); + AddKeyUsageX509(ex, NID_client_auth); + AddKeyUsageX509(ex, NID_code_sign); + AddKeyUsageX509(ex, NID_email_protect); + AddKeyUsageX509(ex, NID_ipsecEndSystem); + AddKeyUsageX509(ex, NID_ipsecTunnel); + AddKeyUsageX509(ex, NID_ipsecUser); + AddKeyUsageX509(ex, NID_time_stamp); + AddKeyUsageX509(ex, NID_OCSP_sign); + + ret = X509V3_EXT_i2d(NID_ext_key_usage, 0, ex); + + sk_ASN1_OBJECT_pop_free(ex, ASN1_OBJECT_free); + + return ret; +} +void BitStringSetBit(ASN1_BIT_STRING *str, int bit) +{ + // Validate arguments + if (str == NULL) + { + return; + } + + ASN1_BIT_STRING_set_bit(str, bit, 1); +} +X509_EXTENSION *NewBasicKeyUsageForX509() +{ + X509_EXTENSION *ret = NULL; + ASN1_BIT_STRING *str; + + str = ASN1_BIT_STRING_new(); + if (str != NULL) + { + BitStringSetBit(str, 0); // KU_DIGITAL_SIGNATURE + BitStringSetBit(str, 1); // KU_NON_REPUDIATION + BitStringSetBit(str, 2); // KU_KEY_ENCIPHERMENT + BitStringSetBit(str, 3); // KU_DATA_ENCIPHERMENT + //BitStringSetBit(str, 4); // KU_KEY_AGREEMENT + BitStringSetBit(str, 5); // KU_KEY_CERT_SIGN + BitStringSetBit(str, 6); // KU_CRL_SIGN + + ret = X509V3_EXT_i2d(NID_key_usage, 0, str); + + ASN1_BIT_STRING_free(str); + } + + return ret; +} + +// Issue an X509 certificate +X509 *NewX509(K *pub, K *priv, X *ca, NAME *name, UINT days, X_SERIAL *serial) +{ + X509 *x509; + UINT64 notBefore, notAfter; + const ASN1_TIME *t1, *t2; + X509_NAME *subject_name, *issuer_name; + X509_EXTENSION *ex = NULL; + X509_EXTENSION *eku = NULL; + X509_EXTENSION *busage = NULL; + ASN1_INTEGER *s; + // Validate arguments + if (pub == NULL || name == NULL || ca == NULL) + { + return NULL; + } + if (pub->private_key != false) + { + return NULL; + } + if (priv->private_key == false) + { + return NULL; + } + + notBefore = SystemTime64(); + notAfter = notBefore + (UINT64)days * (UINT64)3600 * (UINT64)24 * (UINT64)1000; + + // Creating a X509 + x509 = X509_new(); + if (x509 == NULL) + { + return NULL; + } + + // Make it a v3 certificate + X509_set_version(x509, 2L); + + // Set the Expiration + t1 = X509_get0_notBefore(x509); + t2 = X509_get0_notAfter(x509); + if (!UINT64ToAsn1Time((void *)t1, notBefore)) + { + FreeX509(x509); + return NULL; + } + if (!UINT64ToAsn1Time((void *)t2, notAfter)) + { + FreeX509(x509); + return NULL; + } + + // Set the name + subject_name = NameToX509Name(name); + if (subject_name == NULL) + { + FreeX509(x509); + return NULL; + } + issuer_name = X509_get_subject_name(ca->x509); + if (issuer_name == NULL) + { + FreeX509Name(subject_name); + FreeX509(x509); + return NULL; + } + + X509_set_issuer_name(x509, issuer_name); + X509_set_subject_name(x509, subject_name); + + FreeX509Name(subject_name); + + // Set the Serial Number + s = X509_get_serialNumber(x509); + OPENSSL_free(s->data); + if (serial == NULL) + { + char zero = 0; + s->data = OPENSSL_malloc(sizeof(char)); + Copy(s->data, &zero, sizeof(char)); + s->length = sizeof(char); + } + else + { + s->data = OPENSSL_malloc(serial->size); + Copy(s->data, serial->data, serial->size); + s->length = serial->size; + } + + /* + // Extensions + ex = X509V3_EXT_conf_nid(NULL, NULL, NID_basic_constraints, "critical,CA:TRUE"); + X509_add_ext(x509, ex, -1); + X509_EXTENSION_free(ex); +*/ + + // Basic usage + busage = NewBasicKeyUsageForX509(); + if (busage != NULL) + { + X509_add_ext(x509, busage, -1); + X509_EXTENSION_free(busage); + } + + // EKU + eku = NewExtendedKeyUsageForX509(); + if (eku != NULL) + { + X509_add_ext(x509, eku, -1); + X509_EXTENSION_free(eku); + } + + // Alternative subject name + if (UniIsEmptyStr(name->CommonName) == false) + { + char alt_dns[MAX_PATH]; + + Format(alt_dns, sizeof(alt_dns), "DNS.1:%S", name->CommonName); + + ex = X509V3_EXT_conf_nid(NULL, NULL, NID_subject_alt_name, alt_dns); + X509_add_ext(x509, ex, -1); + X509_EXTENSION_free(ex); + } + + Lock(openssl_lock); + { + // Set the public key + X509_set_pubkey(x509, pub->pkey); + + // Signature + // 2014.3.19 set the initial digest algorithm to SHA-256 + X509_sign(x509, priv->pkey, EVP_sha256()); + } + Unlock(openssl_lock); + + return x509; +} + +// Create an X509 root certificate +X509 *NewRootX509(K *pub, K *priv, NAME *name, UINT days, X_SERIAL *serial) +{ + X509 *x509; + UINT64 notBefore, notAfter; + const ASN1_TIME *t1, *t2; + X509_NAME *subject_name, *issuer_name; + X509_EXTENSION *ex = NULL; + X509_EXTENSION *eku = NULL; + X509_EXTENSION *busage = NULL; + ASN1_INTEGER *s; + // Validate arguments + if (pub == NULL || name == NULL || priv == NULL) + { + return NULL; + } + if (days == 0) + { + days = 365; + } + if (priv->private_key == false) + { + return NULL; + } + if (pub->private_key != false) + { + return NULL; + } + + notBefore = SystemTime64(); + notAfter = notBefore + (UINT64)days * (UINT64)3600 * (UINT64)24 * (UINT64)1000; + + // Creating a X509 + x509 = X509_new(); + if (x509 == NULL) + { + return NULL; + } + + // Make it a v3 certificate + X509_set_version(x509, 2L); + + // Set the Expiration + t1 = X509_get0_notBefore(x509); + t2 = X509_get0_notAfter(x509); + if (!UINT64ToAsn1Time((void *)t1, notBefore)) + { + FreeX509(x509); + return NULL; + } + if (!UINT64ToAsn1Time((void *)t2, notAfter)) + { + FreeX509(x509); + return NULL; + } + + // Set the name + subject_name = NameToX509Name(name); + if (subject_name == NULL) + { + FreeX509(x509); + return NULL; + } + issuer_name = NameToX509Name(name); + if (issuer_name == NULL) + { + FreeX509Name(subject_name); + FreeX509(x509); + return NULL; + } + + X509_set_issuer_name(x509, issuer_name); + X509_set_subject_name(x509, subject_name); + + FreeX509Name(subject_name); + FreeX509Name(issuer_name); + + // Set a Serial Number + s = X509_get_serialNumber(x509); + OPENSSL_free(s->data); + if (serial == NULL) + { + char zero = 0; + s->data = OPENSSL_malloc(sizeof(char)); + Copy(s->data, &zero, sizeof(char)); + s->length = sizeof(char); + } + else + { + s->data = OPENSSL_malloc(serial->size); + Copy(s->data, serial->data, serial->size); + s->length = serial->size; + } + + // Extensions + ex = X509V3_EXT_conf_nid(NULL, NULL, NID_basic_constraints, "critical,CA:TRUE"); + X509_add_ext(x509, ex, -1); + X509_EXTENSION_free(ex); + + // Basic usage + busage = NewBasicKeyUsageForX509(); + if (busage != NULL) + { + X509_add_ext(x509, busage, -1); + X509_EXTENSION_free(busage); + } + + // EKU + eku = NewExtendedKeyUsageForX509(); + if (eku != NULL) + { + X509_add_ext(x509, eku, -1); + X509_EXTENSION_free(eku); + } + + Lock(openssl_lock); + { + // Set the public key + X509_set_pubkey(x509, pub->pkey); + + // Signature + // 2014.3.19 set the initial digest algorithm to SHA-256 + X509_sign(x509, priv->pkey, EVP_sha256()); + } + Unlock(openssl_lock); + + return x509; +} + +// Convert the NAMEto a X509_NAME +void *NameToX509Name(NAME *nm) +{ + X509_NAME *xn; + // Validate arguments + if (nm == NULL) + { + return NULL; + } + + xn = X509_NAME_new(); + if (xn == NULL) + { + return NULL; + } + + // Add the entries + AddX509Name(xn, NID_commonName, nm->CommonName); + AddX509Name(xn, NID_organizationName, nm->Organization); + AddX509Name(xn, NID_organizationalUnitName, nm->Unit); + AddX509Name(xn, NID_countryName, nm->Country); + AddX509Name(xn, NID_stateOrProvinceName, nm->State); + AddX509Name(xn, NID_localityName, nm->Local); + + return xn; +} + +// Add an entry to the X509_NAME +bool AddX509Name(void *xn, int nid, wchar_t *str) +{ + X509_NAME *x509_name; + UINT utf8_size; + BYTE *utf8; + int encoding_type = MBSTRING_ASC; + // Validate arguments + if (xn == NULL || str == NULL) + { + return false; + } + + // Convert to UTF-8 + utf8_size = CalcUniToUtf8(str); + if (utf8_size == 0) + { + return false; + } + utf8 = ZeroMalloc(utf8_size + 1); + UniToUtf8(utf8, utf8_size, str); + utf8[utf8_size] = 0; + + if (StrLen(utf8) != UniStrLen(str)) + { + encoding_type = MBSTRING_UTF8; + } + + // Adding + x509_name = (X509_NAME *)xn; + Lock(openssl_lock); + { + X509_NAME_add_entry_by_NID(x509_name, nid, encoding_type, utf8, utf8_size, -1, 0); + } + Unlock(openssl_lock); + Free(utf8); + + return true; +} + +// Release the X509_NAME +void FreeX509Name(void *xn) +{ + X509_NAME *x509_name; + // Validate arguments + if (xn == NULL) + { + return; + } + + x509_name = (X509_NAME *)xn; + X509_NAME_free(x509_name); +} + +// Creating the NAME +NAME *NewName(wchar_t *common_name, wchar_t *organization, wchar_t *unit, + wchar_t *country, wchar_t *state, wchar_t *local) +{ + NAME *nm = ZeroMalloc(sizeof(NAME)); + + if (UniIsEmptyStr(common_name) == false) + { + nm->CommonName = CopyUniStr(common_name); + } + + if (UniIsEmptyStr(organization) == false) + { + nm->Organization = CopyUniStr(organization); + } + + if (UniIsEmptyStr(unit) == false) + { + nm->Unit = CopyUniStr(unit); + } + + if (UniIsEmptyStr(country) == false) + { + nm->Country = CopyUniStr(country); + } + + if (UniIsEmptyStr(state) == false) + { + nm->State = CopyUniStr(state); + } + + if (UniIsEmptyStr(local) == false) + { + nm->Local = CopyUniStr(local); + } + + return nm; +} + +// Check the expiration date of the certificate by the current time +bool CheckXDateNow(X *x) +{ + // Validate arguments + if (x == NULL) + { + return false; + } + + return CheckXDate(x, SystemTime64()); +} + +// Check the expiration date of the certificate +bool CheckXDate(X *x, UINT64 current_system_time) +{ + // Validate arguments + if (x == NULL) + { + return false; + } + + if (x->notBefore >= current_system_time || x->notAfter <= current_system_time) + { + return false; + } + return true; +} + +// Read the expiration date of the certificate +void LoadXDates(X *x) +{ + // Validate arguments + if (x == NULL) + { + return; + } + + x->notBefore = Asn1TimeToUINT64((ASN1_TIME *)X509_get0_notBefore(x->x509)); + x->notAfter = Asn1TimeToUINT64((ASN1_TIME *)X509_get0_notAfter(x->x509)); +} + +// Convert the 64bit system time to ASN1 time +bool UINT64ToAsn1Time(void *asn1_time, UINT64 t) +{ + SYSTEMTIME st; + // Validate arguments + if (asn1_time == NULL) + { + return false; + } + + UINT64ToSystem(&st, t); + return SystemToAsn1Time(asn1_time, &st); +} + +// Convert the system time to the ASN1 time +bool SystemToAsn1Time(void *asn1_time, SYSTEMTIME *s) +{ + char tmp[20]; + ASN1_TIME *t; + // Validate arguments + if (asn1_time == NULL || s == NULL) + { + return false; + } + + if (SystemToStr(tmp, sizeof(tmp), s) == false) + { + return false; + } + t = (ASN1_TIME *)asn1_time; + if (t->data == NULL || t->length < sizeof(tmp)) + { + t->data = OPENSSL_malloc(sizeof(tmp)); + } + StrCpy((char *)t->data, t->length, tmp); + t->length = StrLen(tmp); + t->type = V_ASN1_UTCTIME; + + return true; +} + +// Convert the system time to a string +bool SystemToStr(char *str, UINT size, SYSTEMTIME *s) +{ + // Validate arguments + if (str == NULL || s == NULL) + { + return false; + } + + Format(str, size, "%02u%02u%02u%02u%02u%02uZ", + s->wYear % 100, s->wMonth, s->wDay, + s->wHour, s->wMinute, s->wSecond); + + return true; +} + +// Convert an ASN1 time to an UINT64 time +UINT64 Asn1TimeToUINT64(void *asn1_time) +{ + SYSTEMTIME st; + // Validate arguments + if (asn1_time == NULL) + { + return 0; + } + + if (Asn1TimeToSystem(&st, asn1_time) == false) + { + return 0; + } + return SystemToUINT64(&st); +} + +// Converted an ASN1 time to a system time +bool Asn1TimeToSystem(SYSTEMTIME *s, void *asn1_time) +{ + ASN1_TIME *t; + // Validate arguments + if (s == NULL || asn1_time == NULL) + { + return false; + } + + t = (ASN1_TIME *)asn1_time; + if (StrToSystem(s, (char *)t->data) == false) + { + return false; + } + + if (t->type == V_ASN1_GENERALIZEDTIME) + { + LocalToSystem(s, s); + } + + return true; +} + +// Convert the string to the system time +bool StrToSystem(SYSTEMTIME *s, char *str) +{ + char century[3] = {0, 0, 0}; + bool fourdigityear = false; + + // Validate arguments + if (s == NULL || str == NULL) + { + return false; + } + if (StrLen(str) != 13) + { + if (StrLen(str) != 15) + { + return false; + } + + // Year has 4 digits - save first two and use the rest + // as if it had two digits + fourdigityear = true; + century[0] = str[0]; + century[1] = str[1]; + str += 2; + } + if (str[12] != 'Z') + { + return false; + } + + // Conversion + { + char year[3] = {str[0], str[1], 0}, + month[3] = {str[2], str[3], 0}, + day[3] = {str[4], str[5], 0}, + hour[3] = {str[6], str[7], 0}, + minute[3] = {str[8], str[9], 0}, + second[3] = {str[10], str[11], 0}; + Zero(s, sizeof(SYSTEMTIME)); + s->wYear = ToInt(year); + if (fourdigityear) + { + s->wYear += ToInt(century) * 100; + } + else if (s->wYear >= 60) + { + s->wYear += 1900; + } + else + { + s->wYear += 2000; + } + s->wMonth = ToInt(month); + s->wDay = ToInt(day); + s->wHour = ToInt(hour); + s->wMinute = ToInt(minute); + s->wSecond = ToInt(second); + NormalizeSystem(s); + } + + return true; +} + +// Verify the RSA signature +bool RsaVerify(void *data, UINT data_size, void *sign, K *k) +{ + return RsaVerifyEx(data, data_size, sign, k, 0); +} + +bool RsaVerifyEx(void *data, UINT data_size, void *sign, K *k, UINT bits) +{ + UCHAR hash_data[SIGN_HASH_SIZE]; + UCHAR *decrypt_data; + RSA *rsa; + UINT rsa_size; + // Validate arguments + if (data == NULL || sign == NULL || k == NULL || k->private_key != false) + { + return false; + } + if (bits == 0) + { + bits = RSA_KEY_SIZE; + } + + rsa = EVP_PKEY_get0_RSA(k->pkey); + if (rsa == NULL) + { + return false; + } + + // Hash the data + if (HashForSign(hash_data, sizeof(hash_data), data, data_size) == false) + { + return false; + } + + rsa_size = RSA_size(rsa); + rsa_size = MAX(rsa_size, 1024); // For just in case + decrypt_data = ZeroMalloc(rsa_size); + + // Decode the signature + if (RSA_public_decrypt(bits / 8, sign, decrypt_data, rsa, RSA_PKCS1_PADDING) <= 0) + { + Free(decrypt_data); + return false; + } + + // Comparison + if (Cmp(decrypt_data, hash_data, SIGN_HASH_SIZE) != 0) + { + Free(decrypt_data); + return false; + } + + Free(decrypt_data); + + return true; +} + +// RSA signature +bool RsaSign(void *dst, void *src, UINT size, K *k) +{ + return RsaSignEx(dst, src, size, k, 0); +} +bool RsaSignEx(void *dst, void *src, UINT size, K *k, UINT bits) +{ + UCHAR hash[SIGN_HASH_SIZE]; + // Validate arguments + if (dst == NULL || src == NULL || k == NULL || EVP_PKEY_base_id(k->pkey) != EVP_PKEY_RSA) + { + return false; + } + if (bits == 0) + { + bits = RSA_KEY_SIZE; + } + + Zero(dst, bits / 8); + + // Hash + if (HashForSign(hash, sizeof(hash), src, size) == false) + { + return false; + } + + // Signature + if (RSA_private_encrypt(sizeof(hash), hash, dst, EVP_PKEY_get0_RSA(k->pkey), RSA_PKCS1_PADDING) <= 0) + { + return false; + } + + return true; +} + +// Generation of signature data by SHA-1 +bool HashForSign(void *dst, UINT dst_size, void *src, UINT src_size) +{ + UCHAR *buf = (UCHAR *)dst; + UCHAR sign_data[] = + { + 0x30, 0x21, 0x30, 0x09, 0x06, 0x05, 0x2B, 0x0E, + 0x03, 0x02, 0x1A, 0x05, 0x00, 0x04, 0x14, + }; + // Validate arguments + if (dst == NULL || src == NULL || src_size == 0 || MIN_SIGN_HASH_SIZE > dst_size) + { + return false; + } + + // Header part + Copy(buf, sign_data, sizeof(sign_data)); + + // Hash + Sha1(HASHED_DATA(buf), src, src_size); + + return true; +} + +// RSA operating environment check +bool RsaCheckEx() +{ + UINT num = 20; + UINT i; + + for (i = 0;i < num;i++) + { + if (RsaCheck()) + { + return true; + } + + SleepThread(100); + } + + return false; +} +bool RsaCheck() +{ + int ret = 0; + RSA *rsa = NULL; + BIGNUM *e = NULL; + K *priv_key, *pub_key; + BIO *bio; + char errbuf[MAX_SIZE]; + UINT size = 0; + UINT bit = RSA_KEY_SIZE; + + e = BN_new(); + ret = BN_set_word(e, RSA_F4); + if (ret == 0) + { + BN_free(e); + Debug("BN_set_word: err=%s\n", ERR_error_string(ERR_get_error(), errbuf)); + return false; + } + + // Key generation + Lock(openssl_lock); + { + rsa = RSA_new(); + ret = RSA_generate_key_ex(rsa, bit, e, NULL); + BN_free(e); + } + Unlock(openssl_lock); + if (ret == 0) + { + Debug("RSA_generate_key_ex: err=%s\n", ERR_error_string(ERR_get_error(), errbuf)); + return false; + } + + // Secret key + bio = NewBio(); + Lock(openssl_lock); + { + i2d_RSAPrivateKey_bio(bio, rsa); + } + Unlock(openssl_lock); + BIO_seek(bio, 0); + priv_key = BioToK(bio, true, false, NULL); + FreeBio(bio); + + // Public key + bio = NewBio(); + Lock(openssl_lock); + { + i2d_RSA_PUBKEY_bio(bio, rsa); + } + Unlock(openssl_lock); + BIO_seek(bio, 0); + pub_key = BioToK(bio, false, false, NULL); + FreeBio(bio); + + RSA_free(rsa); + + size = RsaPublicSize(pub_key); + + if (size != ((bit + 7) / 8)) + { + FreeK(priv_key); + FreeK(pub_key); + + return false; + } + + FreeK(priv_key); + FreeK(pub_key); + + return true; +} + +// Generation of RSA key +bool RsaGen(K **priv, K **pub, UINT bit) +{ + int ret = 0; + RSA *rsa = NULL; + BIGNUM *e = NULL; + K *priv_key, *pub_key; + BIO *bio; + char errbuf[MAX_SIZE]; + UINT size = 0; + // Validate arguments + if (priv == NULL || pub == NULL) + { + return false; + } + if (bit == 0) + { + bit = RSA_KEY_SIZE; + } + + e = BN_new(); + ret = BN_set_word(e, RSA_F4); + if (ret == 0) + { + BN_free(e); + Debug("BN_set_word: err=%s\n", ERR_error_string(ERR_get_error(), errbuf)); + return false; + } + + // Key generation + Lock(openssl_lock); + { + rsa = RSA_new(); + ret = RSA_generate_key_ex(rsa, bit, e, NULL); + BN_free(e); + } + Unlock(openssl_lock); + if (ret == 0) + { + Debug("RSA_generate_key_ex: err=%s\n", ERR_error_string(ERR_get_error(), errbuf)); + return false; + } + + // Secret key + bio = NewBio(); + Lock(openssl_lock); + { + i2d_RSAPrivateKey_bio(bio, rsa); + } + Unlock(openssl_lock); + BIO_seek(bio, 0); + priv_key = BioToK(bio, true, false, NULL); + FreeBio(bio); + + // Public key + bio = NewBio(); + Lock(openssl_lock); + { + i2d_RSA_PUBKEY_bio(bio, rsa); + } + Unlock(openssl_lock); + BIO_seek(bio, 0); + pub_key = BioToK(bio, false, false, NULL); + FreeBio(bio); + + *priv = priv_key; + *pub = pub_key; + + RSA_free(rsa); + + size = RsaPublicSize(*pub); + + if (size != ((bit + 7) / 8)) + { + FreeK(*priv); + FreeK(*pub); + + return RsaGen(priv, pub, bit); + } + + return true; +} + +// Confirm whether the certificate X is signed by the issuer of the certificate x_issuer +bool CheckXEx(X *x, X *x_issuer, bool check_name, bool check_date) +{ + K *k; + bool ret; + // Validate arguments + if (x == NULL || x_issuer == NULL) + { + return false; + } + + k = GetKFromX(x_issuer); + if (k == NULL) + { + return false; + } + + ret = CheckSignature(x, k); + + if (ret) + { + if (check_name) + { + if (CompareName(x->issuer_name, x_issuer->subject_name) == false) + { + ret = false; + } + } + + if (check_date) + { + if (CheckXDateNow(x_issuer) == false) + { + ret = false; + } + } + } + + FreeK(k); + + return ret; +} + +// Confirm the signature of the certificate X with the public key K +bool CheckSignature(X *x, K *k) +{ + // Validate arguments + if (x == NULL || k == NULL) + { + return false; + } + + Lock(openssl_lock); + { + if (X509_verify(x->x509, k->pkey) == 0) + { + Unlock(openssl_lock); + return false; + } + } + Unlock(openssl_lock); + return true; +} + +// Get the public key from the certificate +K *GetKFromX(X *x) +{ + EVP_PKEY *pkey; + K *k; + // Validate arguments + if (x == NULL) + { + return NULL; + } + + Lock(openssl_lock); + { + pkey = X509_get_pubkey(x->x509); + } + Unlock(openssl_lock); + if (pkey == NULL) + { + return NULL; + } + + k = ZeroMalloc(sizeof(K)); + k->pkey = pkey; + + return k; +} + +// The name comparison +bool CompareName(NAME *n1, NAME *n2) +{ + // Validate arguments + if (n1 == NULL || n2 == NULL) + { + return false; + } + + // Name comparison + if (UniStrCmpi(n1->CommonName, n2->CommonName) == 0 && + UniStrCmpi(n1->Organization, n2->Organization) == 0 && + UniStrCmpi(n1->Unit, n2->Unit) == 0 && + UniStrCmpi(n1->Country, n2->Country) == 0 && + UniStrCmpi(n1->State, n2->State) == 0 && + UniStrCmpi(n1->Local, n2->Local) == 0) + { + return true; + } + + return false; +} + +// Release the name of the X +void FreeXNames(X *x) +{ + // Validate arguments + if (x == NULL) + { + return; + } + + FreeName(x->issuer_name); + x->issuer_name = NULL; + + FreeName(x->subject_name); + x->subject_name = NULL; +} + +// Release the name +void FreeName(NAME *n) +{ + // Validate arguments + if (n == NULL) + { + return; + } + + // Release the string + Free(n->CommonName); + Free(n->Organization); + Free(n->Unit); + Free(n->Country); + Free(n->State); + Free(n->Local); + + // Release the object + Free(n); + + return; +} + +// Get the name of the certificate +void LoadXNames(X *x) +{ + X509 *x509; + // Validate arguments + if (x == NULL) + { + return; + } + + x509 = x->x509; + x->issuer_name = X509NameToName(X509_get_issuer_name(x509)); + x->subject_name = X509NameToName(X509_get_subject_name(x509)); +} + +// Convert the X509_NAME structure to the NAME structure +NAME *X509NameToName(void *xn) +{ + NAME *n; + // Validate arguments + if (xn == NULL) + { + return NULL; + } + + n = ZeroMalloc(sizeof(NAME)); + + // Get the strings one by one + n->CommonName = GetUniStrFromX509Name(xn, NID_commonName); + n->Organization = GetUniStrFromX509Name(xn, NID_organizationName); + n->Unit = GetUniStrFromX509Name(xn, NID_organizationalUnitName); + n->Country = GetUniStrFromX509Name(xn, NID_countryName); + n->State = GetUniStrFromX509Name(xn, NID_stateOrProvinceName); + n->Local = GetUniStrFromX509Name(xn, NID_localityName); + + return n; +} + +// Read a Unicode string from the X509_NAME structure +wchar_t *GetUniStrFromX509Name(void *xn, int nid) +{ + UCHAR txt[1024]; + bool b = false; + UINT i, size; + int index; + bool unicode = false; + bool is_utf_8 = false; + ASN1_OBJECT *obj; + ASN1_STRING *data; + // Validate arguments + if (xn == NULL || nid == 0) + { + return NULL; + } + + Zero(txt, sizeof(txt)); + if (X509_NAME_get_text_by_NID(xn, nid, (char *)txt, sizeof(txt) - 2) <= 0) + { + return NULL; + } + + obj = OBJ_nid2obj(nid); + if (obj == NULL) + { + return NULL; + } + index = X509_NAME_get_index_by_OBJ(xn, obj, -1); + if (index < 0) + { + return NULL; + } + data = X509_NAME_ENTRY_get_data(X509_NAME_get_entry(xn, index)); + if (data == NULL) + { + return NULL; + } + if (data->type == V_ASN1_BMPSTRING) + { + unicode = true; + } + if (data->type == V_ASN1_UTF8STRING || data->type == V_ASN1_T61STRING) + { + is_utf_8 = true; + } + + size = UniStrLen((wchar_t *)txt) * 4 + 8; + for (i = 0;i < size;i++) + { + if (txt[i] >= 0x80) + { + unicode = true; + break; + } + } + + if (is_utf_8) + { + wchar_t *ret; + UINT ret_size; + + ret_size = CalcUtf8ToUni(txt, StrLen(txt)); + ret = ZeroMalloc(ret_size + 8); + Utf8ToUni(ret, ret_size, txt, StrLen(txt)); + + return ret; + } + else if (unicode == false) + { + wchar_t tmp[1024]; + StrToUni(tmp, sizeof(tmp), (char *)txt); + return CopyUniStr(tmp); + } + else + { + EndianUnicode((wchar_t *)txt); + return CopyUniStr((wchar_t *)txt); + } +} + +// Check whether the certificate x1 equal to x2 +bool CompareX(X *x1, X *x2) +{ + // Validate arguments + if (x1 == NULL || x2 == NULL) + { + return false; + } + + Lock(openssl_lock); + if (X509_cmp(x1->x509, x2->x509) == 0) + { + Unlock(openssl_lock); + return true; + } + else + { + Unlock(openssl_lock); + return false; + } +} + +// Check whether K is private key of X +bool CheckXandK(X *x, K *k) +{ + // Validate arguments + if (x == NULL || k == NULL) + { + return false; + } + + Lock(openssl_lock); + if (X509_check_private_key(x->x509, k->pkey) != 0) + { + Unlock(openssl_lock); + return true; + } + else + { + Unlock(openssl_lock); + return false; + } +} + +// Read a X from the file +X *FileToX(char *filename) +{ + wchar_t *filename_w = CopyStrToUni(filename); + X *ret = FileToXW(filename_w); + + Free(filename_w); + + return ret; +} +X *FileToXW(wchar_t *filename) +{ + bool text; + BUF *b; + X *x; + // Validate arguments + if (filename == NULL) + { + return NULL; + } + + b = ReadDumpW(filename); + text = IsBase64(b); + + x = BufToX(b, text); + FreeBuf(b); + + return x; +} + +// Write the X to a file +bool XToFile(X *x, char *filename, bool text) +{ + wchar_t *filename_w = CopyStrToUni(filename); + bool ret = XToFileW(x, filename_w, text); + + Free(filename_w); + + return ret; +} +bool XToFileW(X *x, wchar_t *filename, bool text) +{ + BUF *b; + bool ret; + // Validate arguments + if (x == NULL || filename == NULL) + { + return false; + } + + b = XToBuf(x, text); + if (b == NULL) + { + return false; + } + + ret = DumpBufW(b, filename); + FreeBuf(b); + + return ret; +} + +// Read a K from the file +K *FileToKW(wchar_t *filename, bool private_key, char *password) +{ + bool text; + BUF *b; + K *k; + // Validate arguments + if (filename == NULL) + { + return NULL; + } + + b = ReadDumpW(filename); + if (b == NULL) + { + return NULL; + } + + text = IsBase64(b); + if (text == false) + { + k = BufToK(b, private_key, false, NULL); + } + else + { + k = BufToK(b, private_key, true, NULL); + if (k == NULL) + { + k = BufToK(b, private_key, true, password); + } + } + + FreeBuf(b); + + return k; +} + +// Save the K to a file +bool KToFileW(K *k, wchar_t *filename, bool text, char *password) +{ + BUF *b; + bool ret; + // Validate arguments + if (k == NULL || filename == NULL) + { + return false; + } + + b = KToBuf(k, text, password); + if (b == NULL) + { + return false; + } + + ret = DumpBufW(b, filename); + FreeBuf(b); + + return ret; +} + +// Convert the K to the BUF +BUF *KToBuf(K *k, bool text, char *password) +{ + BUF *buf; + BIO *bio; + // Validate arguments + if (k == NULL) + { + return NULL; + } + + bio = KToBio(k, text, password); + if (bio == NULL) + { + return NULL; + } + + buf = BioToBuf(bio); + FreeBio(bio); + + SeekBuf(buf, 0, 0); + + return buf; +} + +// Convert the K to the BIO +BIO *KToBio(K *k, bool text, char *password) +{ + BIO *bio; + // Validate arguments + if (k == NULL) + { + return NULL; + } + + bio = NewBio(); + + if (k->private_key) + { + // Secret key + if (text == false) + { + // Binary format + Lock(openssl_lock); + { + i2d_PrivateKey_bio(bio, k->pkey); + } + Unlock(openssl_lock); + } + else + { + // Text format + if (password == 0 || StrLen(password) == 0) + { + // No encryption + Lock(openssl_lock); + { + PEM_write_bio_PrivateKey(bio, k->pkey, NULL, NULL, 0, NULL, NULL); + } + Unlock(openssl_lock); + } + else + { + // Encrypt + CB_PARAM cb; + cb.password = password; + Lock(openssl_lock); + { + PEM_write_bio_PrivateKey(bio, k->pkey, EVP_des_ede3_cbc(), + NULL, 0, (pem_password_cb *)PKeyPasswordCallbackFunction, &cb); + } + Unlock(openssl_lock); + } + } + } + else + { + // Public key + if (text == false) + { + // Binary format + Lock(openssl_lock); + { + i2d_PUBKEY_bio(bio, k->pkey); + } + Unlock(openssl_lock); + } + else + { + // Text format + Lock(openssl_lock); + { + PEM_write_bio_PUBKEY(bio, k->pkey); + } + Unlock(openssl_lock); + } + } + + return bio; +} + +// Check whether the BUF is encoded as the Base64 +bool IsBase64(BUF *b) +{ + UINT i; + // Validate arguments + if (b == NULL) + { + return false; + } + + if (SearchAsciiInBinary(b->Buf, b->Size, "-----BEGIN", false) != INFINITE) + { + return true; + } + + for (i = 0;i < b->Size;i++) + { + char c = ((char *)b->Buf)[i]; + bool b = false; + if ('a' <= c && c <= 'z') + { + b = true; + } + else if ('A' <= c && c <= 'Z') + { + b = true; + } + else if ('0' <= c && c <= '9') + { + b = true; + } + else if (c == ':' || c == '.' || c == ';' || c == ',') + { + b = true; + } + else if (c == '!' || c == '&' || c == '#' || c == '(' || c == ')') + { + b = true; + } + else if (c == '-' || c == ' ') + { + b = true; + } + else if (c == 13 || c == 10 || c == EOF) + { + b = true; + } + else if (c == '\t' || c == '=' || c == '+' || c == '/') + { + b = true; + } + if (b == false) + { + return false; + } + } + return true; +} + +// Check whether the K in the BUF is encrypted +bool IsEncryptedK(BUF *b, bool private_key) +{ + K *k; + // Validate arguments + if (b == NULL) + { + return false; + } + if (IsBase64(b) == false) + { + return false; + } + + k = BufToK(b, private_key, true, NULL); + if (k != NULL) + { + FreeK(k); + return false; + } + + return true; +} + +K *OpensslEngineToK(char *key_file_name, char *engine_name) +{ + K *k; +#if OPENSSL_API_COMPAT < 0x10100000L + ENGINE_load_dynamic(); +#endif // OPENSSL_API_COMPAT < 0x10100000L + ENGINE *engine = ENGINE_by_id(engine_name); + ENGINE_init(engine); + EVP_PKEY *pkey; + pkey = ENGINE_load_private_key(engine, key_file_name, NULL, NULL); + k = ZeroMalloc(sizeof(K)); + k->pkey = pkey; + k->private_key = true; + return k; +} + +// Convert the BUF to a K +K *BufToK(BUF *b, bool private_key, bool text, char *password) +{ + BIO *bio; + K *k; + // Validate arguments + if (b == NULL) + { + return NULL; + } + + bio = BufToBio(b); + k = BioToK(bio, private_key, text, password); + FreeBio(bio); + + return k; +} + +// Release of K +void FreeK(K *k) +{ + // Validate arguments + if (k == NULL) + { + return; + } + + FreePKey(k->pkey); + Free(k); +} + +// Release the secret key +void FreePKey(EVP_PKEY *pkey) +{ + // Validate arguments + if (pkey == NULL) + { + return; + } + + EVP_PKEY_free(pkey); +} + +// Convert the BIO to the K +K *BioToK(BIO *bio, bool private_key, bool text, char *password) +{ + EVP_PKEY *pkey; + K *k; + // Validate arguments + if (bio == NULL) + { + return NULL; + } + + if (password != NULL && StrLen(password) == 0) + { + password = NULL; + } + + if (private_key == false) + { + // Public key + if (text == false) + { + // Binary format + pkey = d2i_PUBKEY_bio(bio, NULL); + if (pkey == NULL) + { + return NULL; + } + } + else + { + // Text format + CB_PARAM cb; + cb.password = password; + Lock(openssl_lock); + { + pkey = PEM_read_bio_PUBKEY(bio, NULL, (pem_password_cb *)PKeyPasswordCallbackFunction, &cb); + } + Unlock(openssl_lock); + if (pkey == NULL) + { + return NULL; + } + } + } + else + { + if (text == false) + { + // Binary format + Lock(openssl_lock); + { + pkey = d2i_PrivateKey_bio(bio, NULL); + } + Unlock(openssl_lock); + if (pkey == NULL) + { + return NULL; + } + } + else + { + // Text format + CB_PARAM cb; + cb.password = password; + Lock(openssl_lock); + { + pkey = PEM_read_bio_PrivateKey(bio, NULL, (pem_password_cb *)PKeyPasswordCallbackFunction, &cb); + } + Unlock(openssl_lock); + if (pkey == NULL) + { + return NULL; + } + } + } + + k = ZeroMalloc(sizeof(K)); + k->pkey = pkey; + k->private_key = private_key; + + return k; +} + +// Password callback function +int PKeyPasswordCallbackFunction(char *buf, int bufsize, int verify, void *param) +{ + CB_PARAM *cb; + // Validate arguments + if (buf == NULL || param == NULL || bufsize == 0) + { + return 0; + } + + cb = (CB_PARAM *)param; + if (cb->password == NULL) + { + return 0; + } + + return StrCpy(buf, bufsize, cb->password); +} + +// Convert the X to a BUF +BUF *XToBuf(X *x, bool text) +{ + BIO *bio; + BUF *b; + // Validate arguments + if (x == NULL) + { + return NULL; + } + + bio = XToBio(x, text); + if (bio == NULL) + { + return NULL; + } + + b = BioToBuf(bio); + FreeBio(bio); + + SeekBuf(b, 0, 0); + + return b; +} + +// Convert the X to a BIO +BIO *XToBio(X *x, bool text) +{ + BIO *bio; + // Validate arguments + if (x == NULL) + { + return NULL; + } + + bio = NewBio(); + + Lock(openssl_lock); + { + if (text == false) + { + // Binary format + i2d_X509_bio(bio, x->x509); + } + else + { + // Text format + PEM_write_bio_X509(bio, x->x509); + } + } + Unlock(openssl_lock); + + return bio; +} + +// Release of the X +void FreeX(X *x) +{ + // Validate arguments + if (x == NULL) + { + return; + } + + // Release the name + FreeXNames(x); + + + // Release the Serial + FreeXSerial(x->serial); + + if (x->do_not_free == false) + { + FreeX509(x->x509); + } + Free(x); +} + +// Release of the X509 +void FreeX509(X509 *x509) +{ + // Validate arguments + if (x509 == NULL) + { + return; + } + + Lock(openssl_lock); + { + X509_free(x509); + } + Unlock(openssl_lock); +} + +// Convert the BUF to a X +X *BufToX(BUF *b, bool text) +{ + X *x; + BIO *bio; + // Validate arguments + if (b == NULL) + { + return NULL; + } + + bio = BufToBio(b); + if (bio == NULL) + { + FreeBuf(b); + return NULL; + } + + x = BioToX(bio, text); + + FreeBio(bio); + + return x; +} + +// Get a digest of the X +void GetXDigest(X *x, UCHAR *buf, bool sha1) +{ + // Validate arguments + if (x == NULL) + { + return; + } + + if (sha1 == false) + { + UINT size = MD5_SIZE; + X509_digest(x->x509, EVP_md5(), buf, (unsigned int *)&size); + } + else + { + UINT size = SHA1_SIZE; + X509_digest(x->x509, EVP_sha1(), buf, (unsigned int *)&size); + } +} + +// Convert BIO to X +X *BioToX(BIO *bio, bool text) +{ + X *x; + X509 *x509; + // Validate arguments + if (bio == NULL) + { + return NULL; + } + + Lock(openssl_lock); + { + // Reading x509 + if (text == false) + { + // Binary mode + x509 = d2i_X509_bio(bio, NULL); + } + else + { + // Text mode + x509 = PEM_read_bio_X509(bio, NULL, NULL, NULL); + } + } + Unlock(openssl_lock); + + if (x509 == NULL) + { + return NULL; + } + + x = X509ToX(x509); + + if (x == NULL) + { + return NULL; + } + + return x; +} + +// Convert the X509 to X +X *X509ToX(X509 *x509) +{ + X *x; + K *k; + BUF *b; + UINT size; + UINT type; + ASN1_INTEGER *s; + // Validate arguments + if (x509 == NULL) + { + return NULL; + } + + x = ZeroMalloc(sizeof(X)); + x->x509 = x509; + + // Name + LoadXNames(x); + + // Expiration date + LoadXDates(x); + + // Check whether it is a root certificate + if (CompareName(x->issuer_name, x->subject_name)) + { + K *pubkey = GetKFromX(x); + if (pubkey != NULL) + { + if (CheckXandK(x, pubkey)) + { + x->root_cert = true; + } + FreeK(pubkey); + } + } + + // Check whether there is basic constraints + if (X509_get_ext_by_NID(x509, NID_basic_constraints, -1) != -1) + { + x->has_basic_constraints = true; + } + + // Get the "Certification Authority Issuer" (1.3.6.1.5.5.7.48.2) field value + if (x->root_cert == false) + { + AUTHORITY_INFO_ACCESS *ads = (AUTHORITY_INFO_ACCESS *)X509_get_ext_d2i(x509, NID_info_access, NULL, NULL); + + if (ads != NULL) + { + int i; + + for (i = 0; i < sk_ACCESS_DESCRIPTION_num(ads); i++) + { + ACCESS_DESCRIPTION *ad = sk_ACCESS_DESCRIPTION_value(ads, i); + if (ad != NULL) + { + if (OBJ_obj2nid(ad->method) == NID_ad_ca_issuers && ad->location->type == GEN_URI) + { +#if OPENSSL_VERSION_NUMBER >= 0x10100000L + char *uri = (char *)ASN1_STRING_get0_data(ad->location->d.uniformResourceIdentifier); +#else + char *uri = (char *)ASN1_STRING_data(ad->location->d.uniformResourceIdentifier); +#endif + if (IsEmptyStr(uri) == false) + { + StrCpy(x->issuer_url, sizeof(x->issuer_url), uri); + break; + } + } + } + } + + AUTHORITY_INFO_ACCESS_free(ads); + } + } + + // Get the Serial Number + s = X509_get_serialNumber(x509); + x->serial = NewXSerial(s->data, s->length); + if (x->serial == NULL) + { + char zero = 0; + x->serial = NewXSerial(&zero, sizeof(char)); + } + + k = GetKFromX(x); + if (k == NULL) + { + FreeX(x); + return NULL; + } + + b = KToBuf(k, false, NULL); + + size = b->Size; + type = EVP_PKEY_base_id(k->pkey); + + FreeBuf(b); + + //Fixed to get actual RSA key bits + x->bits = EVP_PKEY_bits(k->pkey); + + FreeK(k); + + if (type == EVP_PKEY_RSA) + { + x->is_compatible_bit = true; + + if(x->bits != 1024 && x->bits != 1536 && x->bits != 2048 && x->bits != 3072 && x->bits != 4096) + { + x->is_compatible_bit = false; + } + else + { + x->is_compatible_bit = true; + } + + /*switch (size) + { + case 162: + x->bits = 1024; + break; + + case 226: + x->bits = 1536; + break; + + case 294: + x->bits = 2048; + break; + + case 442: + x->bits = 3072; + break; + + case 550: + x->bits = 4096; + break; + + default: + x->is_compatible_bit = false; + break; + }*/ + } + + return x; +} + +// Create a BIO +BIO *NewBio() +{ + return BIO_new(BIO_s_mem()); +} + +// Release the BIO +void FreeBio(BIO *bio) +{ + // Validate arguments + if (bio == NULL) + { + return; + } + + BIO_free(bio); +} + +// Convert the BIO to the BUF +BUF *BioToBuf(BIO *bio) +{ + BUF *b; + UINT size; + void *tmp; + // Validate arguments + if (bio == NULL) + { + return NULL; + } + + BIO_seek(bio, 0); + size = (UINT)BIO_number_written(bio); + tmp = Malloc(size); + BIO_read(bio, tmp, size); + + b = NewBuf(); + WriteBuf(b, tmp, size); + Free(tmp); + + return b; +} + +// Convert the BUF to a BIO +BIO *BufToBio(BUF *b) +{ + BIO *bio; + // Validate arguments + if (b == NULL) + { + return NULL; + } + + Lock(openssl_lock); + { + bio = BIO_new(BIO_s_mem()); + if (bio == NULL) + { + Unlock(openssl_lock); + return NULL; + } + BIO_write(bio, b->Buf, b->Size); + BIO_seek(bio, 0); + } + Unlock(openssl_lock); + + return bio; +} + +// 64-bit random number generation +UINT64 Rand64() +{ + UINT64 i; + Rand(&i, sizeof(i)); + return i; +} + +// 32-bit random number generation +UINT Rand32() +{ + UINT i; + Rand(&i, sizeof(i)); + return i; +} + +// 16-bit random number generation +USHORT Rand16() +{ + USHORT i; + Rand(&i, sizeof(i)); + return i; +} + +// 8-bit random number generation +UCHAR Rand8() +{ + UCHAR i; + Rand(&i, sizeof(i)); + return i; +} + +// 1-bit random number generation +bool Rand1() +{ + return (Rand32() % 2) == 0 ? false : true; +} + +// Random number generation +void Rand(void *buf, UINT size) +{ + // Validate arguments + if (buf == NULL || size == 0) + { + return; + } + RAND_bytes(buf, size); +} + +// Delete a thread-specific information that OpenSSL has holded +void FreeOpenSSLThreadState() +{ +#if OPENSSL_VERSION_NUMBER < 0x10100000L + CRYPTO_cleanup_all_ex_data(); + ERR_remove_thread_state(NULL); +#else +#ifndef LIBRESSL_VERSION_NUMBER + OPENSSL_thread_stop(); +#endif +#endif +} + +#if OPENSSL_VERSION_NUMBER < 0x10100000L +#define SSL_COMP_free_compression_methods() (sk_free(SSL_COMP_get_compression_methods())) +#endif + +// Release the Crypt library +void FreeCryptLibrary() +{ + openssl_inited = false; + + DeleteLock(openssl_lock); + openssl_lock = NULL; +// RAND_Free_For_SoftEther(); + OpenSSL_FreeLock(); +#if OPENSSL_VERSION_NUMBER < 0x10100000L || defined(LIBRESSL_VERSION_NUMBER) +#ifdef OPENSSL_FIPS + FIPS_mode_set(0); +#endif +#ifndef OPENSSL_NO_ENGINE + ENGINE_cleanup(); +#endif + CONF_modules_unload(1); + EVP_cleanup(); + + FreeOpenSSLThreadState(); + + ERR_free_strings(); + +#ifndef OPENSSL_NO_COMP + SSL_COMP_free_compression_methods(); +#endif +#endif +} + +// Initialize the Crypt library +void InitCryptLibrary() +{ + char tmp[16]; + +#if OPENSSL_VERSION_NUMBER < 0x10100000L || defined(LIBRESSL_VERSION_NUMBER) +// RAND_Init_For_SoftEther() + openssl_lock = NewLock(); + SSL_library_init(); + //OpenSSL_add_all_algorithms(); + OpenSSL_add_all_ciphers(); + OpenSSL_add_all_digests(); + ERR_load_crypto_strings(); + SSL_load_error_strings(); +#endif + + ssl_clientcert_index = SSL_get_ex_new_index(0, "struct SslClientCertInfo *", NULL, NULL, NULL); + +#ifdef OS_UNIX + { + char *name1 = "/dev/random"; + char *name2 = "/dev/urandom"; + IO *o; + o = FileOpen(name1, false); + if (o == NULL) + { + o = FileOpen(name2, false); + if (o == NULL) + { + UINT64 now = SystemTime64(); + BUF *b; + UINT i; + b = NewBuf(); + for (i = 0;i < 4096;i++) + { + UCHAR c = rand() % 256; + WriteBuf(b, &c, 1); + } + WriteBuf(b, &now, sizeof(now)); + RAND_seed(b->Buf, b->Size); + FreeBuf(b); + } + else + { + FileClose(o); + } + } + else + { + FileClose(o); + } + } +#endif // OS_UNIX + + RAND_poll(); + +#ifdef OS_WIN32 +// RAND_screen(); +#endif + Rand(tmp, sizeof(tmp)); + OpenSSL_InitLock(); + + openssl_inited = true; +} + +// Hash with the SHA-1 and convert it to UINT +UINT HashToUINT(void *data, UINT size) +{ + UCHAR hash[SHA1_SIZE]; + UINT u; + // Validate arguments + if (data == NULL && size != 0) + { + return 0; + } + + Sha1(hash, data, size); + + Copy(&u, hash, sizeof(UINT)); + + u = Endian32(u); + + return u; +} + +// Creating a new CRYPT object +CRYPT *NewCrypt(void *key, UINT size) +{ + CRYPT *c = ZeroMalloc(sizeof(CRYPT)); + + c->Rc4Key = Malloc(sizeof(struct rc4_key_st)); + + RC4_set_key(c->Rc4Key, size, (UCHAR *)key); + + return c; +} + +// Release the CRYPT object +void FreeCrypt(CRYPT *c) +{ + // Validate arguments + if (c == NULL) + { + return; + } + + // Memory release + Free(c->Rc4Key); + Free(c); +} + +// Encryption and decryption +void Encrypt(CRYPT *c, void *dst, void *src, UINT size) +{ + RC4(c->Rc4Key, size, src, dst); +} + +// 3DES encryption +void Des3Encrypt2(void *dest, void *src, UINT size, DES_KEY_VALUE *k1, DES_KEY_VALUE *k2, DES_KEY_VALUE *k3, void *ivec) +{ + UCHAR ivec_copy[DES_IV_SIZE]; + // Validate arguments + if (dest == NULL || src == NULL || size == 0 || k1 == NULL || k2 == NULL || k3 == NULL || ivec == NULL) + { + return; + } + + Copy(ivec_copy, ivec, DES_IV_SIZE); + + DES_ede3_cbc_encrypt(src, dest, size, + k1->KeySchedule, + k2->KeySchedule, + k3->KeySchedule, + (DES_cblock *)ivec_copy, + 1); +} + +// DES encryption +void DesEncrypt(void *dest, void *src, UINT size, DES_KEY_VALUE *k, void *ivec) +{ + UCHAR ivec_copy[DES_IV_SIZE]; + // Validate arguments + if (dest == NULL || src == NULL || size == 0 || k == NULL || ivec == NULL) + { + return; + } + + Copy(ivec_copy, ivec, DES_IV_SIZE); + + DES_cbc_encrypt(src, dest, size, + k->KeySchedule, + (DES_cblock *)ivec_copy, + 1); +} + +// 3DES decryption +void Des3Decrypt2(void *dest, void *src, UINT size, DES_KEY_VALUE *k1, DES_KEY_VALUE *k2, DES_KEY_VALUE *k3, void *ivec) +{ + UCHAR ivec_copy[DES_IV_SIZE]; + // Validate arguments + if (dest == NULL || src == NULL || size == 0 || k1 == NULL || k2 == NULL || k3 == NULL || ivec == NULL) + { + return; + } + + Copy(ivec_copy, ivec, DES_IV_SIZE); + + DES_ede3_cbc_encrypt(src, dest, size, + k1->KeySchedule, + k2->KeySchedule, + k3->KeySchedule, + (DES_cblock *)ivec_copy, + 0); +} + +// DES-ECB encryption +void DesEcbEncrypt(void *dst, void *src, void *key_7bytes) +{ + UCHAR *key_56; + DES_cblock key; + DES_key_schedule ks; + // Validate arguments + if (dst == NULL || src == NULL || key_7bytes == NULL) + { + return; + } + + key_56 = (UCHAR *)key_7bytes; + + Zero(&key, sizeof(key)); + Zero(&ks, sizeof(ks)); + + key[0] = key_56[0]; + key[1] = (unsigned char)(((key_56[0] << 7) & 0xFF) | (key_56[1] >> 1)); + key[2] = (unsigned char)(((key_56[1] << 6) & 0xFF) | (key_56[2] >> 2)); + key[3] = (unsigned char)(((key_56[2] << 5) & 0xFF) | (key_56[3] >> 3)); + key[4] = (unsigned char)(((key_56[3] << 4) & 0xFF) | (key_56[4] >> 4)); + key[5] = (unsigned char)(((key_56[4] << 3) & 0xFF) | (key_56[5] >> 5)); + key[6] = (unsigned char)(((key_56[5] << 2) & 0xFF) | (key_56[6] >> 6)); + key[7] = (unsigned char) ((key_56[6] << 1) & 0xFF); + + DES_set_odd_parity(&key); + DES_set_key_unchecked(&key, &ks); + + DES_ecb_encrypt(src, dst, &ks, 1); +} + +// DES decryption +void DesDecrypt(void *dest, void *src, UINT size, DES_KEY_VALUE *k, void *ivec) +{ + UCHAR ivec_copy[DES_IV_SIZE]; + // Validate arguments + if (dest == NULL || src == NULL || size == 0 || k == NULL || ivec == NULL) + { + return; + } + + Copy(ivec_copy, ivec, DES_IV_SIZE); + + DES_cbc_encrypt(src, dest, size, + k->KeySchedule, + (DES_cblock *)ivec_copy, + 0); +} + +// Create a new DES key element +DES_KEY_VALUE *DesNewKeyValue(void *value) +{ + DES_KEY_VALUE *v; + // Validate arguments + if (value == NULL) + { + return NULL; + } + + v = ZeroMalloc(sizeof(DES_KEY_VALUE)); + + Copy(v->KeyValue, value, DES_KEY_SIZE); + + v->KeySchedule = ZeroMalloc(sizeof(DES_key_schedule)); + + DES_set_key_unchecked(value, v->KeySchedule); + + return v; +} + +// Release of DES key element +void DesFreeKeyValue(DES_KEY_VALUE *v) +{ + // Validate arguments + if (v == NULL) + { + return; + } + + Free(v->KeySchedule); + Free(v); +} + +// Create a new AES key +AES_KEY_VALUE *AesNewKey(void *data, UINT size) +{ + AES_KEY_VALUE *k; + // Validate arguments + if (data == NULL || (!(size == 16 || size == 24 || size == 32))) + { + return NULL; + } + + k = ZeroMalloc(sizeof(AES_KEY_VALUE)); + + k->EncryptKey = ZeroMalloc(sizeof(struct aes_key_st)); + k->DecryptKey = ZeroMalloc(sizeof(struct aes_key_st)); + + k->KeySize = size; + Copy(k->KeyValue, data, size); + + AES_set_encrypt_key(data, size * 8, k->EncryptKey); + AES_set_decrypt_key(data, size * 8, k->DecryptKey); + + return k; +} + +// Release the AES key +void AesFreeKey(AES_KEY_VALUE *k) +{ + // Validate arguments + if (k == NULL) + { + return; + } + + Free(k->EncryptKey); + Free(k->DecryptKey); + + Free(k); +} + +// AES encryption +void AesEncrypt(void *dest, void *src, UINT size, AES_KEY_VALUE *k, void *ivec) +{ + EVP_CIPHER_CTX *ctx = NULL; + int dest_len = 0; + int len = 0; + int ret = 0; + + // Validate arguments + if (dest == NULL || src == NULL || size == 0 || k == NULL || ivec == NULL) + { + return; + } + + // Create and initialize the context + ctx = EVP_CIPHER_CTX_new(); + + if (!ctx) + { + ERR_print_errors_fp(stderr); + return; + } + + // Disable padding, as it's handled by IkeEncryptWithPadding() + EVP_CIPHER_CTX_set_padding(ctx, false); + + // Initialize the encryption operation + switch (k->KeySize) + { + case 16: + ret = EVP_EncryptInit_ex(ctx, EVP_aes_128_cbc(), NULL, k->KeyValue, ivec); + break; + + case 24: + ret = EVP_EncryptInit_ex(ctx, EVP_aes_192_cbc(), NULL, k->KeyValue, ivec); + break; + + case 32: + ret = EVP_EncryptInit_ex(ctx, EVP_aes_256_cbc(), NULL, k->KeyValue, ivec); + break; + } + + if (ret != 1) + { + ERR_print_errors_fp(stderr); + EVP_CIPHER_CTX_free(ctx); + return; + } + + // Provide the message to be encrypted and obtain the cipher output + ret = EVP_EncryptUpdate(ctx, dest, &dest_len, src, size); + + if (ret != 1) + { + ERR_print_errors_fp(stderr); + EVP_CIPHER_CTX_free(ctx); + return; + } + + // Finalize the encryption + ret = EVP_EncryptFinal_ex(ctx, (unsigned char *) dest + dest_len, &len); + + if (ret != 1) + { + ERR_print_errors_fp(stderr); + EVP_CIPHER_CTX_free(ctx); + return; + } + + dest_len += len; + + // Clean up + EVP_CIPHER_CTX_free(ctx); +} + +// AES decryption +void AesDecrypt(void *dest, void *src, UINT size, AES_KEY_VALUE *k, void *ivec) +{ + EVP_CIPHER_CTX *ctx = NULL; + int dest_len = 0; + int len = 0; + int ret = 0; + + // Validate arguments + if (dest == NULL || src == NULL || size == 0 || k == NULL || ivec == NULL) + { + return; + } + + // Create and initialize the context + ctx = EVP_CIPHER_CTX_new(); + + if (!ctx) + { + ERR_print_errors_fp(stderr); + return; + } + + // Disable padding, as it's handled by IkeEncryptWithPadding() + EVP_CIPHER_CTX_set_padding(ctx, false); + + // Initialize the decryption operation + switch (k->KeySize) + { + case 16: + ret = EVP_DecryptInit_ex(ctx, EVP_aes_128_cbc(), NULL, k->KeyValue, ivec); + break; + + case 24: + ret = EVP_DecryptInit_ex(ctx, EVP_aes_192_cbc(), NULL, k->KeyValue, ivec); + break; + + case 32: + ret = EVP_DecryptInit_ex(ctx, EVP_aes_256_cbc(), NULL, k->KeyValue, ivec); + break; + } + + if (ret != 1) + { + ERR_print_errors_fp(stderr); + EVP_CIPHER_CTX_free(ctx); + return; + } + + // Provide the message to be decrypted and obtain the plaintext output + ret = EVP_DecryptUpdate(ctx, dest, &dest_len, src, size); + + if (ret != 1) + { + ERR_print_errors_fp(stderr); + EVP_CIPHER_CTX_free(ctx); + return; + } + + // Finalize the decryption + ret = EVP_DecryptFinal_ex(ctx, (unsigned char *) dest + dest_len, &len); + + if (ret != 1) + { + ERR_print_errors_fp(stderr); + EVP_CIPHER_CTX_free(ctx); + return; + } + + dest_len += len; + + // Clean up + EVP_CIPHER_CTX_free(ctx); +} + +// Determine whether the AES-NI instruction set is supported by the CPU +bool IsAesNiSupported() +{ + bool supported = false; + + // Unfortunately OpenSSL doesn't provide a function to do it +#ifdef _MSC_VER + int regs[4]; // EAX, EBX, ECX, EDX + __cpuid(regs, 1); + supported = (regs[2] >> 25) & 1; +#else // _MSC_VER + #if defined(CPU_FEATURES_ARCH_X86) + const X86Features features = GetX86Info().features; + supported = features.aes; + #elif defined(CPU_FEATURES_ARCH_ARM) + const ArmFeatures features = GetArmInfo().features; + supported = features.aes; + #elif defined(CPU_FEATURES_ARCH_AARCH64) + const Aarch64Features features = GetAarch64Info().features; + supported = features.aes; + #elif defined(CPU_FEATURES_ARCH_MIPS) + //const MipsFeatures features = GetMipsInfo().features; // no features.aes + #elif defined(CPU_FEATURES_ARCH_PPC) + //const PPCFeatures features = GetPPCInfo().features; // no features.aes + #endif +#endif // _MSC_VER + + return supported; +} + +// DH calculation +bool DhCompute(DH_CTX *dh, void *dst_priv_key, void *src_pub_key, UINT key_size) +{ + int i; + BIGNUM *bn; + bool ret = false; + // Validate arguments + if (dh == NULL || dst_priv_key == NULL || src_pub_key == NULL) + { + return false; + } + if (key_size > dh->Size) + { + return false; + } + + bn = BinToBigNum(src_pub_key, key_size); + + i = DH_compute_key(dst_priv_key, bn, dh->dh); + + if (i == dh->Size) + { + ret = true; + } + else if ((UINT)i < dh->Size) + { + UCHAR *dst2 = Clone(dst_priv_key, i); + + Zero(dst_priv_key, dh->Size); + + Copy(((UCHAR *)dst_priv_key) + (dh->Size - i), dst2, i); + + ret = true; + } + + BN_free(bn); + + return ret; +} + +// Creating a DH 2048bit +DH_CTX *DhNew2048() +{ + return DhNew(DH_SET_2048, 2); +} +// Creating a DH 3072bit +DH_CTX *DhNew3072() +{ + return DhNew(DH_SET_3072, 2); +} +// Creating a DH 4096bit +DH_CTX *DhNew4096() +{ + return DhNew(DH_SET_4096, 2); +} + +// Creating a DH GROUP1 +DH_CTX *DhNewGroup1() +{ + return DhNew(DH_GROUP1_PRIME_768, 2); +} + +// Creating a DH GROUP2 +DH_CTX *DhNewGroup2() +{ + return DhNew(DH_GROUP2_PRIME_1024, 2); +} + +// Creating a DH GROUP5 +DH_CTX *DhNewGroup5() +{ + return DhNew(DH_GROUP5_PRIME_1536, 2); +} + + +// Creating a DH SIMPLE 160bits +DH_CTX *DhNewSimple160() +{ + return DhNew(DH_SIMPLE_160, 2); +} + +DH_CTX *DhNewFromBits(UINT bits) +{ + switch (bits) + { + case 160: + return DhNewSimple160(); + case 768: + return DhNewGroup1(); + case 1024: + return DhNewGroup2(); + case 1536: + return DhNewGroup5(); + case 2048: + return DhNew2048(); + case 3072: + return DhNew3072(); + case 4096: + return DhNew4096(); + default: + return DhNew2048(); + } +} + +// Creating a new DH +DH_CTX *DhNew(char *prime, UINT g) +{ + DH_CTX *dh; + BUF *buf; +#if OPENSSL_VERSION_NUMBER >= 0x10100000L + BIGNUM *dhp, *dhg; + const BIGNUM *pub, *priv; +#endif + // Validate arguments + if (prime == NULL || g == 0) + { + return NULL; + } + + buf = StrToBin(prime); + + dh = ZeroMalloc(sizeof(DH_CTX)); + + dh->dh = DH_new(); +#if OPENSSL_VERSION_NUMBER >= 0x10100000L + dhp = BinToBigNum(buf->Buf, buf->Size); + dhg = BN_new(); + BN_set_word(dhg, g); + DH_set0_pqg(dh->dh, dhp, NULL, dhg); +#else + dh->dh->p = BinToBigNum(buf->Buf, buf->Size); + dh->dh->g = BN_new(); + BN_set_word(dh->dh->g, g); +#endif + + DH_generate_key(dh->dh); + +#if OPENSSL_VERSION_NUMBER >= 0x10100000L + DH_get0_key(dh->dh, &pub, &priv); + dh->MyPublicKey = BigNumToBuf(pub); + dh->MyPrivateKey = BigNumToBuf(priv); +#else + dh->MyPublicKey = BigNumToBuf(dh->dh->pub_key); + dh->MyPrivateKey = BigNumToBuf(dh->dh->priv_key); +#endif + + dh->Size = buf->Size; + + FreeBuf(buf); + + return dh; +} + +// Release of DH +void DhFree(DH_CTX *dh) +{ + // Validate arguments + if (dh == NULL) + { + return; + } + + DH_free(dh->dh); + + FreeBuf(dh->MyPrivateKey); + FreeBuf(dh->MyPublicKey); + + Free(dh); +} + +int GetSslClientCertIndex() +{ + return ssl_clientcert_index; +} + +// Internal functions +static UINT Internal_HMac(const EVP_MD *md, void *dest, void *key, UINT key_size, const void *src, const UINT src_size) +{ + MD *m; + UINT len = 0; + + // Validate arguments + if (md == NULL || dest == NULL || key == NULL || key_size == 0 || (src == NULL && src_size != 0)) + { + return 0; + } + + m = ZeroMalloc(sizeof(MD)); +#if OPENSSL_VERSION_NUMBER >= 0x10100000L + m->Ctx = HMAC_CTX_new(); +#else + m->Ctx = ZeroMalloc(sizeof(HMAC_CTX)); + HMAC_CTX_init(m->Ctx); +#endif + m->Md = md; + m->IsHMac = true; + + if (SetMdKey(m, key, key_size) == false) + { + Debug("Internal_HMac(): SetMdKey() failed!\n"); + goto final; + } + + len = MdProcess(m, dest, (void *)src, src_size); + if (len == 0) + { + Debug("Internal_HMac(): MdProcess() returned 0!\n"); + } + +final: + FreeMd(m); + return len; +} + +///////////////////////// +// SHA0 implementation // +///////////////////////// + +// Source codes from: +// https://android.googlesource.com/platform/system/core/+/81df1cc77722000f8d0025c1ab00ced123aa573c/libmincrypt/sha.c +// https://android.googlesource.com/platform/system/core/+/81df1cc77722000f8d0025c1ab00ced123aa573c/include/mincrypt/hash-internal.h +// https://android.googlesource.com/platform/system/core/+/81df1cc77722000f8d0025c1ab00ced123aa573c/include/mincrypt/sha.h + +/* + * Copyright 2013 The Android Open Source Project + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of Google Inc. nor the names of its contributors may + * be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY Google Inc. ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO + * EVENT SHALL Google Inc. BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; + * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF + * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + + +#define rol(bits, value) (((value) << (bits)) | ((value) >> (32 - (bits)))) + +typedef struct MY_SHA0_CTX { +// const HASH_VTAB * f; + UINT64 count; + UCHAR buf[64]; + UINT state[8]; // upto SHA2 +} MY_SHA0_CTX; + +#define MY_SHA0_DIGEST_SIZE 20 + +static void MY_SHA0_Transform(MY_SHA0_CTX* ctx) { + UINT W[80]; + UINT A, B, C, D, E; + UCHAR* p = ctx->buf; + int t; + for(t = 0; t < 16; ++t) { + UINT tmp = *p++ << 24; + tmp |= *p++ << 16; + tmp |= *p++ << 8; + tmp |= *p++; + W[t] = tmp; + } + for(; t < 80; t++) { + //W[t] = rol(1,W[t-3] ^ W[t-8] ^ W[t-14] ^ W[t-16]); + W[t] = (1,W[t-3] ^ W[t-8] ^ W[t-14] ^ W[t-16]); + } + A = ctx->state[0]; + B = ctx->state[1]; + C = ctx->state[2]; + D = ctx->state[3]; + E = ctx->state[4]; + for(t = 0; t < 80; t++) { + UINT tmp = rol(5,A) + E + W[t]; + if (t < 20) + tmp += (D^(B&(C^D))) + 0x5A827999; + else if ( t < 40) + tmp += (B^C^D) + 0x6ED9EBA1; + else if ( t < 60) + tmp += ((B&C)|(D&(B|C))) + 0x8F1BBCDC; + else + tmp += (B^C^D) + 0xCA62C1D6; + E = D; + D = C; + C = rol(30,B); + B = A; + A = tmp; + } + ctx->state[0] += A; + ctx->state[1] += B; + ctx->state[2] += C; + ctx->state[3] += D; + ctx->state[4] += E; +} +void MY_SHA0_init(MY_SHA0_CTX* ctx) { + //ctx->f = &SHA_VTAB; + ctx->state[0] = 0x67452301; + ctx->state[1] = 0xEFCDAB89; + ctx->state[2] = 0x98BADCFE; + ctx->state[3] = 0x10325476; + ctx->state[4] = 0xC3D2E1F0; + ctx->count = 0; +} +void MY_SHA0_update(MY_SHA0_CTX* ctx, const void* data, int len) { + int i = (int) (ctx->count & 63); + const UCHAR* p = (const UCHAR*)data; + ctx->count += len; + while (len--) { + ctx->buf[i++] = *p++; + if (i == 64) { + MY_SHA0_Transform(ctx); + i = 0; + } + } +} +const UCHAR* MY_SHA0_final(MY_SHA0_CTX* ctx) { + UCHAR *p = ctx->buf; + UINT64 cnt = ctx->count * 8; + int i; + MY_SHA0_update(ctx, (UCHAR*)"\x80", 1); + while ((ctx->count & 63) != 56) { + MY_SHA0_update(ctx, (UCHAR*)"\0", 1); + } + for (i = 0; i < 8; ++i) { + UCHAR tmp = (UCHAR) (cnt >> ((7 - i) * 8)); + MY_SHA0_update(ctx, &tmp, 1); + } + for (i = 0; i < 5; i++) { + UINT tmp = ctx->state[i]; + *p++ = tmp >> 24; + *p++ = tmp >> 16; + *p++ = tmp >> 8; + *p++ = tmp >> 0; + } + return ctx->buf; +} +/* Convenience function */ +const UCHAR* MY_SHA0_hash(const void* data, int len, UCHAR* digest) { + MY_SHA0_CTX ctx; + MY_SHA0_init(&ctx); + MY_SHA0_update(&ctx, data, len); + memcpy(digest, MY_SHA0_final(&ctx), MY_SHA0_DIGEST_SIZE); + return digest; +} +static void Internal_Sha0(unsigned char *dest, const unsigned char *src, const UINT size) +{ + MY_SHA0_hash(src, (int)size, dest); +} diff --git a/src/Mayaqua/Encrypt.h b/src/Mayaqua/Encrypt.h index 27876e92..c3824e19 100644 --- a/src/Mayaqua/Encrypt.h +++ b/src/Mayaqua/Encrypt.h @@ -1,458 +1,458 @@ -// SoftEther VPN Source Code - Developer Edition Master Branch -// Mayaqua Kernel -// © 2020 Nokia - -// Encrypt.h -// Header of Encrypt.c - -#ifndef ENCRYPT_H -#define ENCRYPT_H - -// Function of OpenSSL -void RAND_Init_For_SoftEther(); -void RAND_Free_For_SoftEther(); - - - -// Constant -#define MIN_SIGN_HASH_SIZE (15 + SHA1_SIZE) -#define SIGN_HASH_SIZE (MIN_SIGN_HASH_SIZE) - -#define DES_KEY_SIZE 8 // DES key size -#define DES_IV_SIZE 8 // DES IV size -#define DES_BLOCK_SIZE 8 // DES block size -#define DES3_KEY_SIZE (8 * 3) // 3DES key size -#define RSA_KEY_SIZE 1024 // RSA key size -#define DH_KEY_SIZE 128 // DH key size -#define RSA_MIN_SIGN_HASH_SIZE (15 + SHA1_HASH_SIZE) // Minimum RSA hash size -#define RSA_SIGN_HASH_SIZE (RSA_MIN_SIGN_HASH_SIZE) // RSA hash size -#define MD5_HASH_SIZE 16 // MD5 hash size -#define SHA1_HASH_SIZE 20 // SHA-1 hash size -#define SHA1_BLOCK_SIZE 64 // SHA-1 block size -#define HMAC_SHA1_96_KEY_SIZE 20 // HMAC-SHA-1-96 key size -#define HMAC_SHA1_96_HASH_SIZE 12 // HMAC-SHA-1-96 hash size -#define HMAC_SHA1_SIZE (SHA1_HASH_SIZE) // HMAC-SHA-1 hash size -#define AES_IV_SIZE 16 // AES IV size -#define AES_MAX_KEY_SIZE 32 // Maximum AES key size - -// IANA definitions taken from IKEv1 Phase 1 -#define SHA1_160 2 -#define SHA2_256 4 -#define SHA2_384 5 -#define SHA2_512 6 - -// HMAC block size -#define HMAC_BLOCK_SIZE 64 -// The block size for sha-384 and sha-512 as defined by rfc4868 -#define HMAC_BLOCK_SIZE_1024 128 -#define HMAC_BLOCK_SIZE_MAX 512 - -#define DH_GROUP1_PRIME_768 \ - "FFFFFFFFFFFFFFFFC90FDAA22168C234C4C6628B80DC1CD1" \ - "29024E088A67CC74020BBEA63B139B22514A08798E3404DD" \ - "EF9519B3CD3A431B302B0A6DF25F14374FE1356D6D51C245" \ - "E485B576625E7EC6F44C42E9A63A3620FFFFFFFFFFFFFFFF" - -#define DH_GROUP2_PRIME_1024 \ - "FFFFFFFFFFFFFFFFC90FDAA22168C234C4C6628B80DC1CD1" \ - "29024E088A67CC74020BBEA63B139B22514A08798E3404DD" \ - "EF9519B3CD3A431B302B0A6DF25F14374FE1356D6D51C245" \ - "E485B576625E7EC6F44C42E9A637ED6B0BFF5CB6F406B7ED" \ - "EE386BFB5A899FA5AE9F24117C4B1FE649286651ECE65381" \ - "FFFFFFFFFFFFFFFF" - -#define DH_GROUP5_PRIME_1536 \ - "FFFFFFFFFFFFFFFFC90FDAA22168C234C4C6628B80DC1CD1" \ - "29024E088A67CC74020BBEA63B139B22514A08798E3404DD" \ - "EF9519B3CD3A431B302B0A6DF25F14374FE1356D6D51C245" \ - "E485B576625E7EC6F44C42E9A637ED6B0BFF5CB6F406B7ED" \ - "EE386BFB5A899FA5AE9F24117C4B1FE649286651ECE45B3D" \ - "C2007CB8A163BF0598DA48361C55D39A69163FA8FD24CF5F" \ - "83655D23DCA3AD961C62F356208552BB9ED529077096966D" \ - "670C354E4ABC9804F1746C08CA237327FFFFFFFFFFFFFFFF" - -#define DH_SIMPLE_160 "AEE7561459353C95DDA966AE1FD25D95CD46E935" - -#define DH_SET_2048 \ - "FFFFFFFFFFFFFFFFC90FDAA22168C234C4C6628B80DC1CD1" \ - "29024E088A67CC74020BBEA63B139B22514A08798E3404DD" \ - "EF9519B3CD3A431B302B0A6DF25F14374FE1356D6D51C245" \ - "E485B576625E7EC6F44C42E9A637ED6B0BFF5CB6F406B7ED" \ - "EE386BFB5A899FA5AE9F24117C4B1FE649286651ECE45B3D" \ - "C2007CB8A163BF0598DA48361C55D39A69163FA8FD24CF5F" \ - "83655D23DCA3AD961C62F356208552BB9ED529077096966D" \ - "670C354E4ABC9804F1746C08CA18217C32905E462E36CE3B" \ - "E39E772C180E86039B2783A2EC07A28FB5C55DF06F4C52C9" \ - "DE2BCBF6955817183995497CEA956AE515D2261898FA0510" \ - "15728E5A8AACAA68FFFFFFFFFFFFFFFF" - -#define DH_SET_3072 \ - "FFFFFFFFFFFFFFFFC90FDAA22168C234C4C6628B80DC1CD1"\ - "29024E088A67CC74020BBEA63B139B22514A08798E3404DD"\ - "EF9519B3CD3A431B302B0A6DF25F14374FE1356D6D51C245"\ - "E485B576625E7EC6F44C42E9A637ED6B0BFF5CB6F406B7ED"\ - "EE386BFB5A899FA5AE9F24117C4B1FE649286651ECE45B3D"\ - "C2007CB8A163BF0598DA48361C55D39A69163FA8FD24CF5F"\ - "83655D23DCA3AD961C62F356208552BB9ED529077096966D"\ - "670C354E4ABC9804F1746C08CA18217C32905E462E36CE3B"\ - "E39E772C180E86039B2783A2EC07A28FB5C55DF06F4C52C9"\ - "DE2BCBF6955817183995497CEA956AE515D2261898FA0510"\ - "15728E5A8AAAC42DAD33170D04507A33A85521ABDF1CBA64"\ - "ECFB850458DBEF0A8AEA71575D060C7DB3970F85A6E1E4C7"\ - "ABF5AE8CDB0933D71E8C94E04A25619DCEE3D2261AD2EE6B"\ - "F12FFA06D98A0864D87602733EC86A64521F2B18177B200C"\ - "BBE117577A615D6C770988C0BAD946E208E24FA074E5AB31"\ - "43DB5BFCE0FD108E4B82D120A93AD2CAFFFFFFFFFFFFFFFF" - -#define DH_SET_4096 \ - "FFFFFFFFFFFFFFFFC90FDAA22168C234C4C6628B80DC1CD1" \ - "29024E088A67CC74020BBEA63B139B22514A08798E3404DD" \ - "EF9519B3CD3A431B302B0A6DF25F14374FE1356D6D51C245" \ - "E485B576625E7EC6F44C42E9A637ED6B0BFF5CB6F406B7ED" \ - "EE386BFB5A899FA5AE9F24117C4B1FE649286651ECE45B3D" \ - "C2007CB8A163BF0598DA48361C55D39A69163FA8FD24CF5F" \ - "83655D23DCA3AD961C62F356208552BB9ED529077096966D" \ - "670C354E4ABC9804F1746C08CA18217C32905E462E36CE3B" \ - "E39E772C180E86039B2783A2EC07A28FB5C55DF06F4C52C9" \ - "DE2BCBF6955817183995497CEA956AE515D2261898FA0510" \ - "15728E5A8AAAC42DAD33170D04507A33A85521ABDF1CBA64" \ - "ECFB850458DBEF0A8AEA71575D060C7DB3970F85A6E1E4C7" \ - "ABF5AE8CDB0933D71E8C94E04A25619DCEE3D2261AD2EE6B" \ - "F12FFA06D98A0864D87602733EC86A64521F2B18177B200C" \ - "BBE117577A615D6C770988C0BAD946E208E24FA074E5AB31" \ - "43DB5BFCE0FD108E4B82D120A92108011A723C12A787E6D7" \ - "88719A10BDBA5B2699C327186AF4E23C1A946834B6150BDA" \ - "2583E9CA2AD44CE8DBBBC2DB04DE8EF92E8EFC141FBECAA6" \ - "287C59474E6BC05D99B2964FA090C3A2233BA186515BE7ED" \ - "1F612970CEE2D7AFB81BDD762170481CD0069127D5B05AA9" \ - "93B4EA988D8FDDC186FFB7DC90A6C08F4DF435C934063199" \ - "FFFFFFFFFFFFFFFF" - -// Macro -#define HASHED_DATA(p) (((UCHAR *)p) + 15) - -// OpenSSL <1.1 Shims -#if OPENSSL_VERSION_NUMBER < 0x10100000L -# define EVP_PKEY_get0_RSA(obj) ((obj)->pkey.rsa) -# define EVP_PKEY_base_id(pkey) ((pkey)->type) -# define X509_get0_notBefore(x509) ((x509)->cert_info->validity->notBefore) -# define X509_get0_notAfter(x509) ((x509)->cert_info->validity->notAfter) -# define X509_get_serialNumber(x509) ((x509)->cert_info->serialNumber) -#endif - -#ifndef EVP_CTRL_AEAD_GET_TAG -# define EVP_CTRL_AEAD_GET_TAG EVP_CTRL_GCM_GET_TAG -#endif - -#ifndef EVP_CTRL_AEAD_SET_TAG -# define EVP_CTRL_AEAD_SET_TAG EVP_CTRL_GCM_SET_TAG -#endif - -// Crypt context -struct CRYPT -{ - struct rc4_key_st *Rc4Key; -}; - -// Name in the certificate -struct NAME -{ - wchar_t *CommonName; // CN - wchar_t *Organization; // O - wchar_t *Unit; // OU - wchar_t *Country; // C - wchar_t *State; // ST - wchar_t *Local; // L -}; - -// Serial number -struct X_SERIAL -{ - UINT size; - UCHAR *data; -}; - -// Certificate -struct X -{ - X509 *x509; - NAME *issuer_name; - NAME *subject_name; - bool root_cert; - UINT64 notBefore; - UINT64 notAfter; - X_SERIAL *serial; - bool do_not_free; - bool is_compatible_bit; - UINT bits; - bool has_basic_constraints; - char issuer_url[256]; -}; - -// Key -struct K -{ - EVP_PKEY *pkey; - bool private_key; -}; - -// PKCS#12 -struct P12 -{ - PKCS12 *pkcs12; -}; - -// CEL -struct X_CRL -{ - X509_CRL *Crl; -}; - -// Constant -#define MD5_SIZE 16 -#define SHA1_SIZE 20 -#define SHA256_SIZE 32 -#define SHA384_SIZE 48 -#define SHA512_SIZE 64 - -// Key element of DES -struct DES_KEY_VALUE -{ - struct DES_ks *KeySchedule; - UCHAR KeyValue[DES_KEY_SIZE]; -}; - -// DES key -struct DES_KEY -{ - DES_KEY_VALUE *k1, *k2, *k3; -}; - -// AES key -struct AES_KEY_VALUE -{ - struct aes_key_st *EncryptKey; - struct aes_key_st *DecryptKey; - UCHAR KeyValue[AES_MAX_KEY_SIZE]; - UINT KeySize; -}; - -// DH -struct DH_CTX -{ - struct dh_st *dh; - BUF *MyPublicKey; - BUF *MyPrivateKey; - UINT Size; -}; - -// Cipher object -struct CIPHER -{ - char Name[MAX_PATH]; - bool IsNullCipher, IsAeadCipher; - const struct evp_cipher_st *Cipher; - struct evp_cipher_ctx_st *Ctx; - bool Encrypt; - UINT BlockSize, IvSize, KeySize; -}; - -// Message digest object -struct MD -{ - char Name[MAX_PATH]; - bool IsNullMd; - bool IsHMac; - const struct evp_md_st *Md; - void *Ctx; - UINT Size; -}; - - -// Lock of the OpenSSL -extern LOCK **ssl_lock_obj; - -// Function prototype -CRYPT *NewCrypt(void *key, UINT size); -void FreeCrypt(CRYPT *c); -void Encrypt(CRYPT *c, void *dst, void *src, UINT size); -void InitCryptLibrary(); -void Rand(void *buf, UINT size); -UINT HashToUINT(void *data, UINT size); -UINT64 Rand64(); -UINT Rand32(); -USHORT Rand16(); -UCHAR Rand8(); -bool Rand1(); -UINT HashPtrToUINT(void *p); - -BIO *BufToBio(BUF *b); -BUF *BioToBuf(BIO *bio); -BIO *NewBio(); -void FreeBio(BIO *bio); -X *BioToX(BIO *bio, bool text); -X *BufToX(BUF *b, bool text); -void FreeX509(X509 *x509); -void FreeX(X *x); -BIO *XToBio(X *x, bool text); -BUF *XToBuf(X *x, bool text); -K *BioToK(BIO *bio, bool private_key, bool text, char *password); -int PKeyPasswordCallbackFunction(char *buf, int bufsize, int verify, void *param); -void FreePKey(EVP_PKEY *pkey); -void FreeK(K *k); -K *OpensslEngineToK(char *key_file_name, char *engine_name); -K *BufToK(BUF *b, bool private_key, bool text, char *password); -bool IsEncryptedK(BUF *b, bool private_key); -bool IsBase64(BUF *b); -BIO *KToBio(K *k, bool text, char *password); -BUF *KToBuf(K *k, bool text, char *password); -X *FileToX(char *filename); -X *FileToXW(wchar_t *filename); -bool XToFile(X *x, char *filename, bool text); -bool XToFileW(X *x, wchar_t *filename, bool text); -K *FileToKW(wchar_t *filename, bool private_key, char *password); -bool KToFileW(K *k, wchar_t *filename, bool text, char *password); -bool CheckXandK(X *x, K *k); -bool CompareX(X *x1, X *x2); -NAME *X509NameToName(void *xn); -wchar_t *GetUniStrFromX509Name(void *xn, int nid); -void LoadXNames(X *x); -void FreeXNames(X *x); -void FreeName(NAME *n); -bool CompareName(NAME *n1, NAME *n2); -K *GetKFromX(X *x); -bool CheckSignature(X *x, K *k); -X *X509ToX(X509 *x509); -bool CheckXEx(X *x, X *x_issuer, bool check_name, bool check_date); -bool Asn1TimeToSystem(SYSTEMTIME *s, void *asn1_time); -bool StrToSystem(SYSTEMTIME *s, char *str); -UINT64 Asn1TimeToUINT64(void *asn1_time); -bool SystemToAsn1Time(void *asn1_time, SYSTEMTIME *s); -bool UINT64ToAsn1Time(void *asn1_time, UINT64 t); -bool SystemToStr(char *str, UINT size, SYSTEMTIME *s); -void LoadXDates(X *x); -bool CheckXDate(X *x, UINT64 current_system_time); -bool CheckXDateNow(X *x); -NAME *NewName(wchar_t *common_name, wchar_t *organization, wchar_t *unit, - wchar_t *country, wchar_t *state, wchar_t *local); -void *NameToX509Name(NAME *nm); -void FreeX509Name(void *xn); -bool AddX509Name(void *xn, int nid, wchar_t *str); -X509 *NewRootX509(K *pub, K *priv, NAME *name, UINT days, X_SERIAL *serial); -X *NewRootX(K *pub, K *priv, NAME *name, UINT days, X_SERIAL *serial); -X509 *NewX509(K *pub, K *priv, X *ca, NAME *name, UINT days, X_SERIAL *serial); -X *NewX(K *pub, K *priv, X *ca, NAME *name, UINT days, X_SERIAL *serial); -UINT GetDaysUntil2038(); -UINT GetDaysUntil2038Ex(); -X_SERIAL *NewXSerial(void *data, UINT size); -void FreeXSerial(X_SERIAL *serial); -P12 *BioToP12(BIO *bio); -P12 *PKCS12ToP12(PKCS12 *pkcs12); -P12 *BufToP12(BUF *b); -BIO *P12ToBio(P12 *p12); -BUF *P12ToBuf(P12 *p12); -void FreePKCS12(PKCS12 *pkcs12); -void FreeP12(P12 *p12); -bool P12ToFileW(P12 *p12, wchar_t *filename); -bool ParseP12(P12 *p12, X **x, K **k, char *password); -bool IsEncryptedP12(P12 *p12); -P12 *NewP12(X *x, K *k, char *password); -X *CloneX(X *x); -K *CloneK(K *k); -void FreeCryptLibrary(); -void GetPrintNameFromX(wchar_t *str, UINT size, X *x); -void GetPrintNameFromXA(char *str, UINT size, X *x); -void GetPrintNameFromName(wchar_t *str, UINT size, NAME *name); -void GetAllNameFromX(wchar_t *str, UINT size, X *x); -void GetAllNameFromName(wchar_t *str, UINT size, NAME *name); -void GetAllNameFromNameEx(wchar_t *str, UINT size, NAME *name); -BUF *BigNumToBuf(const BIGNUM *bn); -BIGNUM *BinToBigNum(void *data, UINT size); -X_SERIAL *CloneXSerial(X_SERIAL *src); -bool CompareXSerial(X_SERIAL *s1, X_SERIAL *s2); -void GetXDigest(X *x, UCHAR *buf, bool sha1); -NAME *CopyName(NAME *n); - - -bool RsaGen(K **priv, K **pub, UINT bit); -bool RsaCheck(); -bool RsaCheckEx(); -bool RsaSign(void *dst, void *src, UINT size, K *k); -bool RsaSignEx(void *dst, void *src, UINT size, K *k, UINT bits); -bool HashForSign(void *dst, UINT dst_size, void *src, UINT src_size); -bool RsaVerify(void *data, UINT data_size, void *sign, K *k); -bool RsaVerifyEx(void *data, UINT data_size, void *sign, K *k, UINT bits); -UINT RsaPublicSize(K *k); -BUF *RsaPublicToBuf(K *k); - -DES_KEY_VALUE *DesNewKeyValue(void *value); -void DesFreeKeyValue(DES_KEY_VALUE *v); -void Des3Encrypt2(void *dest, void *src, UINT size, DES_KEY_VALUE *k1, DES_KEY_VALUE *k2, DES_KEY_VALUE *k3, void *ivec); -void Des3Decrypt2(void *dest, void *src, UINT size, DES_KEY_VALUE *k1, DES_KEY_VALUE *k2, DES_KEY_VALUE *k3, void *ivec); -void Sha(UINT sha_type, void *dst, void *src, UINT size); - -void DesEncrypt(void *dest, void *src, UINT size, DES_KEY_VALUE *k, void *ivec); -void DesDecrypt(void *dest, void *src, UINT size, DES_KEY_VALUE *k, void *ivec); -void DesEcbEncrypt(void *dst, void *src, void *key_7bytes); - -bool DhCompute(DH_CTX *dh, void *dst_priv_key, void *src_pub_key, UINT key_size); -DH_CTX *DhNewGroup1(); -DH_CTX *DhNewGroup2(); -DH_CTX *DhNewGroup5(); -DH_CTX *DhNewSimple160(); -DH_CTX *DhNew2048(); -DH_CTX *DhNew3072(); -DH_CTX *DhNew4096(); -DH_CTX *DhNewFromBits(UINT bits); -DH_CTX *DhNew(char *prime, UINT g); -void DhFree(DH_CTX *dh); - -AES_KEY_VALUE *AesNewKey(void *data, UINT size); -void AesFreeKey(AES_KEY_VALUE *k); -void AesEncrypt(void *dest, void *src, UINT size, AES_KEY_VALUE *k, void *ivec); -void AesDecrypt(void *dest, void *src, UINT size, AES_KEY_VALUE *k, void *ivec); - -bool IsAesNiSupported(); - -void OpenSSL_InitLock(); -void OpenSSL_FreeLock(); -void OpenSSL_Lock(int mode, int n, const char *file, int line); -void FreeOpenSSLThreadState(); -char *OpenSSL_Error(); - -// Encryption/Decryption -CIPHER *NewCipher(char *name); -void FreeCipher(CIPHER *c); -void SetCipherKey(CIPHER *c, void *key, bool enc); -UINT CipherProcess(CIPHER *c, void *iv, void *dest, void *src, UINT size); -UINT CipherProcessAead(CIPHER *c, void *iv, void *tag, UINT tag_size, void *dest, void *src, UINT src_size, void *aad, UINT aad_size); - -// Hashing -MD *NewMd(char *name); -MD *NewMdEx(char *name, bool hmac); -bool SetMdKey(MD *md, void *key, UINT key_size); -UINT MdProcess(MD *md, void *dest, void *src, UINT size); -void FreeMd(MD *md); -void HashMd4(void *dst, void *src, UINT size); -void HashSha1(void *dst, void *src, UINT size); -void Md5(void *dst, void *src, UINT size); -void Sha(UINT sha_type, void *dst, void *src, UINT size); -void Sha0(void *dst, void *src, UINT size); -void Sha1(void *dst, void *src, UINT size); -void Sha2_256(void *dst, void *src, UINT size); -void Sha2_384(void *dst, void *src, UINT size); -void Sha2_512(void *dst, void *src, UINT size); -UINT HMacSha1(void *dst, void *key, UINT key_size, void *data, UINT data_size); -UINT HMacMd5(void *dst, void *key, UINT key_size, void *data, UINT data_size); -void Enc_tls1_PRF(unsigned char *label, int label_len, const unsigned char *sec, int slen, unsigned char *out1, int olen); - -int GetSslClientCertIndex(); - -#ifdef ENCRYPT_C -// Inner function - - -#endif // ENCRYPT_C - -#endif // ENCRYPT_H - +// SoftEther VPN Source Code - Developer Edition Master Branch +// Mayaqua Kernel +// © 2020 Nokia + +// Encrypt.h +// Header of Encrypt.c + +#ifndef ENCRYPT_H +#define ENCRYPT_H + +// Function of OpenSSL +void RAND_Init_For_SoftEther(); +void RAND_Free_For_SoftEther(); + + + +// Constant +#define MIN_SIGN_HASH_SIZE (15 + SHA1_SIZE) +#define SIGN_HASH_SIZE (MIN_SIGN_HASH_SIZE) + +#define DES_KEY_SIZE 8 // DES key size +#define DES_IV_SIZE 8 // DES IV size +#define DES_BLOCK_SIZE 8 // DES block size +#define DES3_KEY_SIZE (8 * 3) // 3DES key size +#define RSA_KEY_SIZE 1024 // RSA key size +#define DH_KEY_SIZE 128 // DH key size +#define RSA_MIN_SIGN_HASH_SIZE (15 + SHA1_HASH_SIZE) // Minimum RSA hash size +#define RSA_SIGN_HASH_SIZE (RSA_MIN_SIGN_HASH_SIZE) // RSA hash size +#define MD5_HASH_SIZE 16 // MD5 hash size +#define SHA1_HASH_SIZE 20 // SHA-1 hash size +#define SHA1_BLOCK_SIZE 64 // SHA-1 block size +#define HMAC_SHA1_96_KEY_SIZE 20 // HMAC-SHA-1-96 key size +#define HMAC_SHA1_96_HASH_SIZE 12 // HMAC-SHA-1-96 hash size +#define HMAC_SHA1_SIZE (SHA1_HASH_SIZE) // HMAC-SHA-1 hash size +#define AES_IV_SIZE 16 // AES IV size +#define AES_MAX_KEY_SIZE 32 // Maximum AES key size + +// IANA definitions taken from IKEv1 Phase 1 +#define SHA1_160 2 +#define SHA2_256 4 +#define SHA2_384 5 +#define SHA2_512 6 + +// HMAC block size +#define HMAC_BLOCK_SIZE 64 +// The block size for sha-384 and sha-512 as defined by rfc4868 +#define HMAC_BLOCK_SIZE_1024 128 +#define HMAC_BLOCK_SIZE_MAX 512 + +#define DH_GROUP1_PRIME_768 \ + "FFFFFFFFFFFFFFFFC90FDAA22168C234C4C6628B80DC1CD1" \ + "29024E088A67CC74020BBEA63B139B22514A08798E3404DD" \ + "EF9519B3CD3A431B302B0A6DF25F14374FE1356D6D51C245" \ + "E485B576625E7EC6F44C42E9A63A3620FFFFFFFFFFFFFFFF" + +#define DH_GROUP2_PRIME_1024 \ + "FFFFFFFFFFFFFFFFC90FDAA22168C234C4C6628B80DC1CD1" \ + "29024E088A67CC74020BBEA63B139B22514A08798E3404DD" \ + "EF9519B3CD3A431B302B0A6DF25F14374FE1356D6D51C245" \ + "E485B576625E7EC6F44C42E9A637ED6B0BFF5CB6F406B7ED" \ + "EE386BFB5A899FA5AE9F24117C4B1FE649286651ECE65381" \ + "FFFFFFFFFFFFFFFF" + +#define DH_GROUP5_PRIME_1536 \ + "FFFFFFFFFFFFFFFFC90FDAA22168C234C4C6628B80DC1CD1" \ + "29024E088A67CC74020BBEA63B139B22514A08798E3404DD" \ + "EF9519B3CD3A431B302B0A6DF25F14374FE1356D6D51C245" \ + "E485B576625E7EC6F44C42E9A637ED6B0BFF5CB6F406B7ED" \ + "EE386BFB5A899FA5AE9F24117C4B1FE649286651ECE45B3D" \ + "C2007CB8A163BF0598DA48361C55D39A69163FA8FD24CF5F" \ + "83655D23DCA3AD961C62F356208552BB9ED529077096966D" \ + "670C354E4ABC9804F1746C08CA237327FFFFFFFFFFFFFFFF" + +#define DH_SIMPLE_160 "AEE7561459353C95DDA966AE1FD25D95CD46E935" + +#define DH_SET_2048 \ + "FFFFFFFFFFFFFFFFC90FDAA22168C234C4C6628B80DC1CD1" \ + "29024E088A67CC74020BBEA63B139B22514A08798E3404DD" \ + "EF9519B3CD3A431B302B0A6DF25F14374FE1356D6D51C245" \ + "E485B576625E7EC6F44C42E9A637ED6B0BFF5CB6F406B7ED" \ + "EE386BFB5A899FA5AE9F24117C4B1FE649286651ECE45B3D" \ + "C2007CB8A163BF0598DA48361C55D39A69163FA8FD24CF5F" \ + "83655D23DCA3AD961C62F356208552BB9ED529077096966D" \ + "670C354E4ABC9804F1746C08CA18217C32905E462E36CE3B" \ + "E39E772C180E86039B2783A2EC07A28FB5C55DF06F4C52C9" \ + "DE2BCBF6955817183995497CEA956AE515D2261898FA0510" \ + "15728E5A8AACAA68FFFFFFFFFFFFFFFF" + +#define DH_SET_3072 \ + "FFFFFFFFFFFFFFFFC90FDAA22168C234C4C6628B80DC1CD1"\ + "29024E088A67CC74020BBEA63B139B22514A08798E3404DD"\ + "EF9519B3CD3A431B302B0A6DF25F14374FE1356D6D51C245"\ + "E485B576625E7EC6F44C42E9A637ED6B0BFF5CB6F406B7ED"\ + "EE386BFB5A899FA5AE9F24117C4B1FE649286651ECE45B3D"\ + "C2007CB8A163BF0598DA48361C55D39A69163FA8FD24CF5F"\ + "83655D23DCA3AD961C62F356208552BB9ED529077096966D"\ + "670C354E4ABC9804F1746C08CA18217C32905E462E36CE3B"\ + "E39E772C180E86039B2783A2EC07A28FB5C55DF06F4C52C9"\ + "DE2BCBF6955817183995497CEA956AE515D2261898FA0510"\ + "15728E5A8AAAC42DAD33170D04507A33A85521ABDF1CBA64"\ + "ECFB850458DBEF0A8AEA71575D060C7DB3970F85A6E1E4C7"\ + "ABF5AE8CDB0933D71E8C94E04A25619DCEE3D2261AD2EE6B"\ + "F12FFA06D98A0864D87602733EC86A64521F2B18177B200C"\ + "BBE117577A615D6C770988C0BAD946E208E24FA074E5AB31"\ + "43DB5BFCE0FD108E4B82D120A93AD2CAFFFFFFFFFFFFFFFF" + +#define DH_SET_4096 \ + "FFFFFFFFFFFFFFFFC90FDAA22168C234C4C6628B80DC1CD1" \ + "29024E088A67CC74020BBEA63B139B22514A08798E3404DD" \ + "EF9519B3CD3A431B302B0A6DF25F14374FE1356D6D51C245" \ + "E485B576625E7EC6F44C42E9A637ED6B0BFF5CB6F406B7ED" \ + "EE386BFB5A899FA5AE9F24117C4B1FE649286651ECE45B3D" \ + "C2007CB8A163BF0598DA48361C55D39A69163FA8FD24CF5F" \ + "83655D23DCA3AD961C62F356208552BB9ED529077096966D" \ + "670C354E4ABC9804F1746C08CA18217C32905E462E36CE3B" \ + "E39E772C180E86039B2783A2EC07A28FB5C55DF06F4C52C9" \ + "DE2BCBF6955817183995497CEA956AE515D2261898FA0510" \ + "15728E5A8AAAC42DAD33170D04507A33A85521ABDF1CBA64" \ + "ECFB850458DBEF0A8AEA71575D060C7DB3970F85A6E1E4C7" \ + "ABF5AE8CDB0933D71E8C94E04A25619DCEE3D2261AD2EE6B" \ + "F12FFA06D98A0864D87602733EC86A64521F2B18177B200C" \ + "BBE117577A615D6C770988C0BAD946E208E24FA074E5AB31" \ + "43DB5BFCE0FD108E4B82D120A92108011A723C12A787E6D7" \ + "88719A10BDBA5B2699C327186AF4E23C1A946834B6150BDA" \ + "2583E9CA2AD44CE8DBBBC2DB04DE8EF92E8EFC141FBECAA6" \ + "287C59474E6BC05D99B2964FA090C3A2233BA186515BE7ED" \ + "1F612970CEE2D7AFB81BDD762170481CD0069127D5B05AA9" \ + "93B4EA988D8FDDC186FFB7DC90A6C08F4DF435C934063199" \ + "FFFFFFFFFFFFFFFF" + +// Macro +#define HASHED_DATA(p) (((UCHAR *)p) + 15) + +// OpenSSL <1.1 Shims +#if OPENSSL_VERSION_NUMBER < 0x10100000L +# define EVP_PKEY_get0_RSA(obj) ((obj)->pkey.rsa) +# define EVP_PKEY_base_id(pkey) ((pkey)->type) +# define X509_get0_notBefore(x509) ((x509)->cert_info->validity->notBefore) +# define X509_get0_notAfter(x509) ((x509)->cert_info->validity->notAfter) +# define X509_get_serialNumber(x509) ((x509)->cert_info->serialNumber) +#endif + +#ifndef EVP_CTRL_AEAD_GET_TAG +# define EVP_CTRL_AEAD_GET_TAG EVP_CTRL_GCM_GET_TAG +#endif + +#ifndef EVP_CTRL_AEAD_SET_TAG +# define EVP_CTRL_AEAD_SET_TAG EVP_CTRL_GCM_SET_TAG +#endif + +// Crypt context +struct CRYPT +{ + struct rc4_key_st *Rc4Key; +}; + +// Name in the certificate +struct NAME +{ + wchar_t *CommonName; // CN + wchar_t *Organization; // O + wchar_t *Unit; // OU + wchar_t *Country; // C + wchar_t *State; // ST + wchar_t *Local; // L +}; + +// Serial number +struct X_SERIAL +{ + UINT size; + UCHAR *data; +}; + +// Certificate +struct X +{ + X509 *x509; + NAME *issuer_name; + NAME *subject_name; + bool root_cert; + UINT64 notBefore; + UINT64 notAfter; + X_SERIAL *serial; + bool do_not_free; + bool is_compatible_bit; + UINT bits; + bool has_basic_constraints; + char issuer_url[256]; +}; + +// Key +struct K +{ + EVP_PKEY *pkey; + bool private_key; +}; + +// PKCS#12 +struct P12 +{ + PKCS12 *pkcs12; +}; + +// CEL +struct X_CRL +{ + X509_CRL *Crl; +}; + +// Constant +#define MD5_SIZE 16 +#define SHA1_SIZE 20 +#define SHA256_SIZE 32 +#define SHA384_SIZE 48 +#define SHA512_SIZE 64 + +// Key element of DES +struct DES_KEY_VALUE +{ + struct DES_ks *KeySchedule; + UCHAR KeyValue[DES_KEY_SIZE]; +}; + +// DES key +struct DES_KEY +{ + DES_KEY_VALUE *k1, *k2, *k3; +}; + +// AES key +struct AES_KEY_VALUE +{ + struct aes_key_st *EncryptKey; + struct aes_key_st *DecryptKey; + UCHAR KeyValue[AES_MAX_KEY_SIZE]; + UINT KeySize; +}; + +// DH +struct DH_CTX +{ + struct dh_st *dh; + BUF *MyPublicKey; + BUF *MyPrivateKey; + UINT Size; +}; + +// Cipher object +struct CIPHER +{ + char Name[MAX_PATH]; + bool IsNullCipher, IsAeadCipher; + const struct evp_cipher_st *Cipher; + struct evp_cipher_ctx_st *Ctx; + bool Encrypt; + UINT BlockSize, IvSize, KeySize; +}; + +// Message digest object +struct MD +{ + char Name[MAX_PATH]; + bool IsNullMd; + bool IsHMac; + const struct evp_md_st *Md; + void *Ctx; + UINT Size; +}; + + +// Lock of the OpenSSL +extern LOCK **ssl_lock_obj; + +// Function prototype +CRYPT *NewCrypt(void *key, UINT size); +void FreeCrypt(CRYPT *c); +void Encrypt(CRYPT *c, void *dst, void *src, UINT size); +void InitCryptLibrary(); +void Rand(void *buf, UINT size); +UINT HashToUINT(void *data, UINT size); +UINT64 Rand64(); +UINT Rand32(); +USHORT Rand16(); +UCHAR Rand8(); +bool Rand1(); +UINT HashPtrToUINT(void *p); + +BIO *BufToBio(BUF *b); +BUF *BioToBuf(BIO *bio); +BIO *NewBio(); +void FreeBio(BIO *bio); +X *BioToX(BIO *bio, bool text); +X *BufToX(BUF *b, bool text); +void FreeX509(X509 *x509); +void FreeX(X *x); +BIO *XToBio(X *x, bool text); +BUF *XToBuf(X *x, bool text); +K *BioToK(BIO *bio, bool private_key, bool text, char *password); +int PKeyPasswordCallbackFunction(char *buf, int bufsize, int verify, void *param); +void FreePKey(EVP_PKEY *pkey); +void FreeK(K *k); +K *OpensslEngineToK(char *key_file_name, char *engine_name); +K *BufToK(BUF *b, bool private_key, bool text, char *password); +bool IsEncryptedK(BUF *b, bool private_key); +bool IsBase64(BUF *b); +BIO *KToBio(K *k, bool text, char *password); +BUF *KToBuf(K *k, bool text, char *password); +X *FileToX(char *filename); +X *FileToXW(wchar_t *filename); +bool XToFile(X *x, char *filename, bool text); +bool XToFileW(X *x, wchar_t *filename, bool text); +K *FileToKW(wchar_t *filename, bool private_key, char *password); +bool KToFileW(K *k, wchar_t *filename, bool text, char *password); +bool CheckXandK(X *x, K *k); +bool CompareX(X *x1, X *x2); +NAME *X509NameToName(void *xn); +wchar_t *GetUniStrFromX509Name(void *xn, int nid); +void LoadXNames(X *x); +void FreeXNames(X *x); +void FreeName(NAME *n); +bool CompareName(NAME *n1, NAME *n2); +K *GetKFromX(X *x); +bool CheckSignature(X *x, K *k); +X *X509ToX(X509 *x509); +bool CheckXEx(X *x, X *x_issuer, bool check_name, bool check_date); +bool Asn1TimeToSystem(SYSTEMTIME *s, void *asn1_time); +bool StrToSystem(SYSTEMTIME *s, char *str); +UINT64 Asn1TimeToUINT64(void *asn1_time); +bool SystemToAsn1Time(void *asn1_time, SYSTEMTIME *s); +bool UINT64ToAsn1Time(void *asn1_time, UINT64 t); +bool SystemToStr(char *str, UINT size, SYSTEMTIME *s); +void LoadXDates(X *x); +bool CheckXDate(X *x, UINT64 current_system_time); +bool CheckXDateNow(X *x); +NAME *NewName(wchar_t *common_name, wchar_t *organization, wchar_t *unit, + wchar_t *country, wchar_t *state, wchar_t *local); +void *NameToX509Name(NAME *nm); +void FreeX509Name(void *xn); +bool AddX509Name(void *xn, int nid, wchar_t *str); +X509 *NewRootX509(K *pub, K *priv, NAME *name, UINT days, X_SERIAL *serial); +X *NewRootX(K *pub, K *priv, NAME *name, UINT days, X_SERIAL *serial); +X509 *NewX509(K *pub, K *priv, X *ca, NAME *name, UINT days, X_SERIAL *serial); +X *NewX(K *pub, K *priv, X *ca, NAME *name, UINT days, X_SERIAL *serial); +UINT GetDaysUntil2038(); +UINT GetDaysUntil2038Ex(); +X_SERIAL *NewXSerial(void *data, UINT size); +void FreeXSerial(X_SERIAL *serial); +P12 *BioToP12(BIO *bio); +P12 *PKCS12ToP12(PKCS12 *pkcs12); +P12 *BufToP12(BUF *b); +BIO *P12ToBio(P12 *p12); +BUF *P12ToBuf(P12 *p12); +void FreePKCS12(PKCS12 *pkcs12); +void FreeP12(P12 *p12); +bool P12ToFileW(P12 *p12, wchar_t *filename); +bool ParseP12(P12 *p12, X **x, K **k, char *password); +bool IsEncryptedP12(P12 *p12); +P12 *NewP12(X *x, K *k, char *password); +X *CloneX(X *x); +K *CloneK(K *k); +void FreeCryptLibrary(); +void GetPrintNameFromX(wchar_t *str, UINT size, X *x); +void GetPrintNameFromXA(char *str, UINT size, X *x); +void GetPrintNameFromName(wchar_t *str, UINT size, NAME *name); +void GetAllNameFromX(wchar_t *str, UINT size, X *x); +void GetAllNameFromName(wchar_t *str, UINT size, NAME *name); +void GetAllNameFromNameEx(wchar_t *str, UINT size, NAME *name); +BUF *BigNumToBuf(const BIGNUM *bn); +BIGNUM *BinToBigNum(void *data, UINT size); +X_SERIAL *CloneXSerial(X_SERIAL *src); +bool CompareXSerial(X_SERIAL *s1, X_SERIAL *s2); +void GetXDigest(X *x, UCHAR *buf, bool sha1); +NAME *CopyName(NAME *n); + + +bool RsaGen(K **priv, K **pub, UINT bit); +bool RsaCheck(); +bool RsaCheckEx(); +bool RsaSign(void *dst, void *src, UINT size, K *k); +bool RsaSignEx(void *dst, void *src, UINT size, K *k, UINT bits); +bool HashForSign(void *dst, UINT dst_size, void *src, UINT src_size); +bool RsaVerify(void *data, UINT data_size, void *sign, K *k); +bool RsaVerifyEx(void *data, UINT data_size, void *sign, K *k, UINT bits); +UINT RsaPublicSize(K *k); +BUF *RsaPublicToBuf(K *k); + +DES_KEY_VALUE *DesNewKeyValue(void *value); +void DesFreeKeyValue(DES_KEY_VALUE *v); +void Des3Encrypt2(void *dest, void *src, UINT size, DES_KEY_VALUE *k1, DES_KEY_VALUE *k2, DES_KEY_VALUE *k3, void *ivec); +void Des3Decrypt2(void *dest, void *src, UINT size, DES_KEY_VALUE *k1, DES_KEY_VALUE *k2, DES_KEY_VALUE *k3, void *ivec); +void Sha(UINT sha_type, void *dst, void *src, UINT size); + +void DesEncrypt(void *dest, void *src, UINT size, DES_KEY_VALUE *k, void *ivec); +void DesDecrypt(void *dest, void *src, UINT size, DES_KEY_VALUE *k, void *ivec); +void DesEcbEncrypt(void *dst, void *src, void *key_7bytes); + +bool DhCompute(DH_CTX *dh, void *dst_priv_key, void *src_pub_key, UINT key_size); +DH_CTX *DhNewGroup1(); +DH_CTX *DhNewGroup2(); +DH_CTX *DhNewGroup5(); +DH_CTX *DhNewSimple160(); +DH_CTX *DhNew2048(); +DH_CTX *DhNew3072(); +DH_CTX *DhNew4096(); +DH_CTX *DhNewFromBits(UINT bits); +DH_CTX *DhNew(char *prime, UINT g); +void DhFree(DH_CTX *dh); + +AES_KEY_VALUE *AesNewKey(void *data, UINT size); +void AesFreeKey(AES_KEY_VALUE *k); +void AesEncrypt(void *dest, void *src, UINT size, AES_KEY_VALUE *k, void *ivec); +void AesDecrypt(void *dest, void *src, UINT size, AES_KEY_VALUE *k, void *ivec); + +bool IsAesNiSupported(); + +void OpenSSL_InitLock(); +void OpenSSL_FreeLock(); +void OpenSSL_Lock(int mode, int n, const char *file, int line); +void FreeOpenSSLThreadState(); +char *OpenSSL_Error(); + +// Encryption/Decryption +CIPHER *NewCipher(char *name); +void FreeCipher(CIPHER *c); +void SetCipherKey(CIPHER *c, void *key, bool enc); +UINT CipherProcess(CIPHER *c, void *iv, void *dest, void *src, UINT size); +UINT CipherProcessAead(CIPHER *c, void *iv, void *tag, UINT tag_size, void *dest, void *src, UINT src_size, void *aad, UINT aad_size); + +// Hashing +MD *NewMd(char *name); +MD *NewMdEx(char *name, bool hmac); +bool SetMdKey(MD *md, void *key, UINT key_size); +UINT MdProcess(MD *md, void *dest, void *src, UINT size); +void FreeMd(MD *md); +void HashMd4(void *dst, void *src, UINT size); +void HashSha1(void *dst, void *src, UINT size); +void Md5(void *dst, void *src, UINT size); +void Sha(UINT sha_type, void *dst, void *src, UINT size); +void Sha0(void *dst, void *src, UINT size); +void Sha1(void *dst, void *src, UINT size); +void Sha2_256(void *dst, void *src, UINT size); +void Sha2_384(void *dst, void *src, UINT size); +void Sha2_512(void *dst, void *src, UINT size); +UINT HMacSha1(void *dst, void *key, UINT key_size, void *data, UINT data_size); +UINT HMacMd5(void *dst, void *key, UINT key_size, void *data, UINT data_size); +void Enc_tls1_PRF(unsigned char *label, int label_len, const unsigned char *sec, int slen, unsigned char *out1, int olen); + +int GetSslClientCertIndex(); + +#ifdef ENCRYPT_C +// Inner function + + +#endif // ENCRYPT_C + +#endif // ENCRYPT_H + diff --git a/src/Mayaqua/FileIO.c b/src/Mayaqua/FileIO.c index a0449a9e..ffaa832c 100644 --- a/src/Mayaqua/FileIO.c +++ b/src/Mayaqua/FileIO.c @@ -1,2603 +1,2603 @@ -// SoftEther VPN Source Code - Developer Edition Master Branch -// Mayaqua Kernel - - -// FileIO.c -// File Input / Output code - -#include - -#include -#include -#include -#include -#include -#include -#include -#include - -static char exe_file_name[MAX_SIZE] = "/tmp/a.out"; -static wchar_t exe_file_name_w[MAX_SIZE] = L"/tmp/a.out"; -static LIST *hamcore = NULL; -static IO *hamcore_io = NULL; - -#define NUM_CRC32_TABLE 256 -static UINT crc32_table[NUM_CRC32_TABLE]; - -// Confirm that the specified string exists as a line -bool IsInLines(BUF *buf, char *str, bool instr) -{ - bool ret = false; - // Validate arguments - if (buf == NULL || str == NULL) - { - return false; - } - - if (IsEmptyStr(str)) - { - return false; - } - - SeekBufToBegin(buf); - - while (ret == false) - { - char *line = CfgReadNextLine(buf); - - if (line == NULL) - { - break; - } - - Trim(line); - - if (IsEmptyStr(line) == false) - { - if (StrCmpi(line, str) == 0) - { - ret = true; - } - - if (instr) - { - if (InStr(str, line)) - { - ret = true; - } - - if (InStr(line, str)) - { - ret = true; - } - } - } - - Free(line); - } - - return ret; -} -bool IsInLinesFile(wchar_t *filename, char *str, bool instr) -{ - bool ret = false; - BUF *b; - // Validate arguments - if (filename == NULL || str == NULL) - { - return false; - } - - b = ReadDumpW(filename); - if (b == NULL) - { - return false; - } - - ret = IsInLines(b, str, instr); - - FreeBuf(b); - - return ret; -} - -// Check whether the file is write-locked -bool IsFileWriteLockedW(wchar_t *name) -{ - IO *io; - // Validate arguments - if (name == NULL) - { - return false; - } - - if (IsFileExistsW(name) == false) - { - return false; - } - - io = FileOpenW(name, true); - if (io == NULL) - { - return true; - } - - FileClose(io); - - return false; -} - -// Creating a ZIP packer -ZIP_PACKER *NewZipPacker() -{ - ZIP_PACKER *p = ZeroMalloc(sizeof(ZIP_PACKER)); - - p->Fifo = NewFifo(); - p->FileList = NewList(NULL); - p->CurrentFile = NULL; - - return p; -} - -// Release of ZIP packer -void FreeZipPacker(ZIP_PACKER *p) -{ - UINT i; - // Validate arguments - if (p == NULL) - { - return; - } - - ReleaseFifo(p->Fifo); - - for (i = 0;i < LIST_NUM(p->FileList);i++) - { - ZIP_FILE *f = LIST_DATA(p->FileList, i); - - Free(f); - } - - ReleaseList(p->FileList); - - Free(p); -} - -// Simply add the file -void ZipAddFileSimple(ZIP_PACKER *p, char *name, UINT64 dt, UINT attribute, void *data, UINT size) -{ - // Validate arguments - if (p == NULL || IsEmptyStr(name) || (size != 0 && data == NULL)) - { - return; - } - - ZipAddFileStart(p, name, size, dt, attribute); - ZipAddFileData(p, data, 0, size); -} -bool ZipAddRealFileW(ZIP_PACKER *p, char *name, UINT64 dt, UINT attribute, wchar_t *srcname) -{ - BUF *b; - // Validate arguments - if (p == NULL || IsEmptyStr(name) || srcname == NULL) - { - return false; - } - - b = ReadDumpW(srcname); - if (b == NULL) - { - return false; - } - - ZipAddFileSimple(p, name, dt, attribute, b->Buf, b->Size); - - FreeBuf(b); - - return true; -} -bool ZipAddRealFile(ZIP_PACKER *p, char *name, UINT64 dt, UINT attribute, char *srcname) -{ - bool ret = false; - wchar_t *s; - - s = CopyStrToUni(srcname); - - ret = ZipAddRealFileW(p, name, dt, attribute, s); - - Free(s); - - return ret; -} - -// Start adding a file -void ZipAddFileStart(ZIP_PACKER *p, char *name, UINT size, UINT64 dt, UINT attribute) -{ - char tmp[MAX_PATH]; - ZIP_FILE *f; - ZIP_DATA_HEADER h; - // Validate arguments - if (p == NULL || IsEmptyStr(name)) - { - return; - } - if (dt == 0) - { - dt = LocalTime64(); - } - - if (p->CurrentFile != NULL) - { - return; - } - - StrCpy(tmp, sizeof(tmp), name); - ReplaceStrEx(tmp, sizeof(tmp), tmp, "/", "\\", true); - - f = ZeroMalloc(sizeof(ZIP_FILE)); - - StrCpy(f->Name, sizeof(f->Name), tmp); - f->Size = size; - f->DateTime = dt; - f->Attributes = attribute; - - Add(p->FileList, f); - - Zero(&h, sizeof(h)); - f->HeaderPos = (UINT)p->Fifo->total_write_size; - WriteZipDataHeader(f, &h, false); - WriteFifo(p->Fifo, &h, sizeof(h)); - WriteFifo(p->Fifo, f->Name, StrLen(f->Name)); - f->Crc32 = 0xffffffff; - - p->CurrentFile = f; -} - -// Add data to the file -UINT ZipAddFileData(ZIP_PACKER *p, void *data, UINT pos, UINT len) -{ - UINT ret; - UINT total_size; - // Validate arguments - if (p == NULL) - { - return 0; - } - - total_size = p->CurrentFile->CurrentSize + len; - - if (total_size > p->CurrentFile->Size) - { - return 0; - } - - WriteFifo(p->Fifo, ((UCHAR *)data) + pos, len); - - p->CurrentFile->CurrentSize += len; - p->CurrentFile->Crc32 = Crc32Next(data, pos, len, p->CurrentFile->Crc32); - - ret = p->CurrentFile->Size - p->CurrentFile->CurrentSize; - - if (ret == 0) - { - p->CurrentFile->Crc32 = ~p->CurrentFile->Crc32; - - ZipAddFileFooter(p); - - p->CurrentFile = NULL; - } - - return ret; -} - -// Append a file footer -void ZipAddFileFooter(ZIP_PACKER *p) -{ - ZIP_DATA_FOOTER f; - // Validate arguments - if (p == NULL) - { - return; - } - - Zero(&f, sizeof(f)); - WriteZipDataFooter(p->CurrentFile, &f); - - WriteFifo(p->Fifo, &f, sizeof(f)); -} - -// Output the ZIP data to a file -bool ZipWriteW(ZIP_PACKER *p, wchar_t *name) -{ - FIFO *f; - // Validate arguments - if (p == NULL || name == NULL) - { - return false; - } - - f = ZipFinish(p); - if (f == NULL) - { - return false; - } - - return FileWriteAllW(name, FifoPtr(f), FifoSize(f)); -} - -// Complete the creation of the ZIP data -FIFO *ZipFinish(ZIP_PACKER *p) -{ - UINT i; - UINT pos_start; - UINT pos_end; - ZIP_END_HEADER e; - // Validate arguments - if (p == NULL) - { - return NULL; - } - - pos_start = (UINT)p->Fifo->total_write_size; - - for (i = 0;i < LIST_NUM(p->FileList);i++) - { - ZIP_FILE *f = LIST_DATA(p->FileList, i); - ZIP_DIR_HEADER d; - ZIP_DATA_HEADER dh; - - Zero(&d, sizeof(d)); - Zero(&dh, sizeof(dh)); - - d.Signature = Endian32(Swap32(0x02014B50)); - d.MadeVer = Endian16(Swap16(ZIP_VERSION)); - - WriteZipDataHeader(f, &dh, true); - - d.NeedVer = dh.NeedVer; - d.Option = dh.Option; - d.CompType = dh.CompType; - d.FileTime = dh.FileTime; - d.FileDate = dh.FileDate; - d.Crc32 = dh.Crc32; - d.CompSize = dh.CompSize; - d.UncompSize = dh.UncompSize; - d.FileNameLen = dh.FileNameLen; - d.ExtraLen = dh.ExtraLen; - d.CommentLen = 0; - d.DiskNum = 0; - d.InAttr = 0; - d.OutAttr = Endian32(Swap32((USHORT)f->Attributes)); - d.HeaderPos = Endian32(Swap32(f->HeaderPos)); - - WriteFifo(p->Fifo, &d, sizeof(d)); - WriteFifo(p->Fifo, f->Name, StrLen(f->Name)); - } - - pos_end = (UINT)p->Fifo->total_write_size; - - Zero(&e, sizeof(e)); - e.Signature = Endian32(Swap32(ZIP_SIGNATURE_END)); - e.DiskNum = e.StartDiskNum = 0; - e.DiskDirEntry = e.DirEntry = Endian16(Swap16((USHORT)LIST_NUM(p->FileList))); - e.DirSize = Endian32(Swap32((UINT)(pos_end - pos_start))); - e.StartPos = Endian32(Swap32(pos_start)); - e.CommentLen = 0; - - WriteFifo(p->Fifo, &e, sizeof(e)); - - return p->Fifo; -} - -// Creating a ZIP data header -void WriteZipDataHeader(ZIP_FILE *f, ZIP_DATA_HEADER *h, bool write_sizes) -{ - // Validate arguments - if (f == NULL || h ==NULL) - { - return; - } - - h->Signature = Endian32(Swap32(ZIP_SIGNATURE)); - h->NeedVer = Endian16(Swap16(ZIP_VERSION)); - h->CompType = 0; - h->FileDate = Endian16(Swap16(System64ToDosDate(f->DateTime))); - h->FileTime = Endian16(Swap16(System64ToDosTime(f->DateTime))); - h->Option = Endian16(Swap16(8)); // bit3: Set the file-size and the CRC in local header to 0 - - if (write_sizes == false) - { - h->CompSize = h->UncompSize = 0; - h->Crc32 = 0; - } - else - { - h->CompSize = h->UncompSize = Endian32(Swap32(f->Size)); - h->Crc32 = Endian32(Swap32(f->Crc32)); - } - - h->FileNameLen = Endian16(Swap16(StrLen(f->Name))); - h->ExtraLen = 0; -} - -// Creating a ZIP data footer -void WriteZipDataFooter(ZIP_FILE *f, ZIP_DATA_FOOTER *h) -{ - // Validate arguments - if (f == NULL || h ==NULL) - { - return; - } - - h->Signature = Endian32(Swap32(0x08074B50)); - h->CompSize = h->UncompSize = Endian32(Swap32(f->Size)); - h->Crc32 = Endian32(Swap32(f->Crc32)); -} - -// Initialize the common table of CRC32 -void InitCrc32() -{ - UINT poly = 0xEDB88320; - UINT u, i, j; - - for (i = 0;i < 256;i++) - { - u = i; - - for (j = 0;j < 8;j++) - { - if ((u & 0x1) != 0) - { - u = (u >> 1) ^ poly; - } - else - { - u >>= 1; - } - } - - crc32_table[i] = u; - } -} - -// CRC32 arithmetic processing -UINT Crc32(void *buf, UINT pos, UINT len) -{ - return Crc32Finish(Crc32First(buf, pos, len)); -} -UINT Crc32First(void *buf, UINT pos, UINT len) -{ - return Crc32Next(buf, pos, len, 0xffffffff); -} -UINT Crc32Next(void *buf, UINT pos, UINT len, UINT last_crc32) -{ - UINT ret = last_crc32; - UINT i; - - for (i = 0;i < len;i++) - { - ret = (ret >> 8) ^ crc32_table[((UCHAR *)buf)[pos + i] ^ (ret & 0xff)]; - } - - return ret; -} -UINT Crc32Finish(UINT last_crc32) -{ - return ~last_crc32; -} - -// Save the file -bool SaveFileW(wchar_t *name, void *data, UINT size) -{ - IO *io; - // Validate arguments - if (name == NULL || (data == NULL && size != 0)) - { - return false; - } - - io = FileCreateW(name); - if (io == NULL) - { - return false; - } - - if (FileWrite(io, data, size) == false) - { - FileClose(io); - return false; - } - - FileClose(io); - - return true; -} -bool SaveFile(char *name, void *data, UINT size) -{ - wchar_t *name_w = CopyStrToUni(name); - bool ret = SaveFileW(name_w, data, size); - - Free(name_w); - - return ret; -} - -// Check whether the file exists -bool IsFile(char *name) -{ - wchar_t *name_w = CopyStrToUni(name); - bool ret = IsFileW(name_w); - - Free(name_w); - - return ret; -} -bool IsFileW(wchar_t *name) -{ - IO *io; - // Validate arguments - if (name == NULL) - { - return false; - } - - io = FileOpenExW(name, false, false); - if (io == NULL) - { - return false; - } - - FileClose(io); - - return true; -} - -// Rename to replace the file -bool FileReplaceRenameW(wchar_t *old_name, wchar_t *new_name) -{ - // Validate arguments - if (old_name == NULL || new_name == NULL) - { - return false; - } - - if (FileCopyW(old_name, new_name) == false) - { - return false; - } - - FileDeleteW(old_name); - - return true; -} - -// Make the file name safe -void ConvertSafeFileName(char *dst, UINT size, char *src) -{ - UINT i; - // Validate arguments - if (dst == NULL || src == NULL) - { - return; - } - - StrCpy(dst, size, src); - for (i = 0;i < StrLen(dst);i++) - { - if (IsSafeChar(dst[i]) == false) - { - dst[i] = '_'; - } - } -} - -// Get the free disk space -bool GetDiskFree(char *path, UINT64 *free_size, UINT64 *used_size, UINT64 *total_size) -{ - bool ret; - // Validate arguments - if (path == NULL) - { - path = "./"; - } - -#ifdef OS_WIN32 - ret = Win32GetDiskFree(path, free_size, used_size, total_size); -#else // OS_WIN32 - ret = UnixGetDiskFree(path, free_size, used_size, total_size); -#endif // OS_WIN32 - - return ret; -} - -// Enumeration of direction with all sub directories -TOKEN_LIST *EnumDirWithSubDirs(char *dirname) -{ - TOKEN_LIST *ret; - UNI_TOKEN_LIST *ret2; - wchar_t tmp[MAX_SIZE]; - // Validate arguments - if (dirname == NULL) - { - dirname = "./"; - } - - StrToUni(tmp, sizeof(tmp), dirname); - - ret2 = EnumDirWithSubDirsW(tmp); - - ret = UniTokenListToTokenList(ret2); - - UniFreeToken(ret2); - - return ret; -} -UNI_TOKEN_LIST *EnumDirWithSubDirsW(wchar_t *dirname) -{ - ENUM_DIR_WITH_SUB_DATA d; - UNI_TOKEN_LIST *ret; - UINT i; - // Validate arguments - if (dirname == NULL) - { - dirname = L"./"; - } - - Zero(&d, sizeof(d)); - - d.FileList = NewListFast(NULL); - - EnumDirWithSubDirsMain(&d, dirname); - - ret = ZeroMalloc(sizeof(UNI_TOKEN_LIST)); - - ret->NumTokens = LIST_NUM(d.FileList); - ret->Token = ZeroMalloc(sizeof(wchar_t *) * ret->NumTokens); - - for (i = 0;i < ret->NumTokens;i++) - { - wchar_t *s = LIST_DATA(d.FileList, i); - - ret->Token[i] = UniCopyStr(s); - } - - FreeStrList(d.FileList); - - return ret; -} -void EnumDirWithSubDirsMain(ENUM_DIR_WITH_SUB_DATA *d, wchar_t *dirname) -{ - DIRLIST *dir; - UINT i; - // Validate arguments - if (d == NULL || dirname == NULL) - { - return; - } - - dir = EnumDirExW(dirname, NULL); - if (dir == NULL) - { - return; - } - - // Files - for (i = 0;i < dir->NumFiles;i++) - { - DIRENT *e = dir->File[i]; - - if (e->Folder == false) - { - wchar_t tmp[MAX_SIZE]; - - ConbinePathW(tmp, sizeof(tmp), dirname, e->FileNameW); - - Add(d->FileList, CopyUniStr(tmp)); - } - } - - // Sub directories - for (i = 0;i < dir->NumFiles;i++) - { - DIRENT *e = dir->File[i]; - - if (e->Folder) - { - wchar_t tmp[MAX_SIZE]; - - ConbinePathW(tmp, sizeof(tmp), dirname, e->FileNameW); - - EnumDirWithSubDirsMain(d, tmp); - } - } - - FreeDir(dir); -} - -// Enumeration of directory -DIRLIST *EnumDirEx(char *dirname, COMPARE *compare) -{ - wchar_t *dirname_w = CopyStrToUni(dirname); - DIRLIST *ret = EnumDirExW(dirname_w, compare); - - Free(dirname_w); - - return ret; -} -DIRLIST *EnumDirExW(wchar_t *dirname, COMPARE *compare) -{ - DIRLIST *d = NULL; - // Validate arguments - if (dirname == NULL) - { - dirname = L"./"; - } - - if (compare == NULL) - { - compare = CompareDirListByName; - } - -#ifdef OS_WIN32 - d = Win32EnumDirExW(dirname, compare); -#else // OS_WIN32 - d = UnixEnumDirExW(dirname, compare); -#endif // OS_WIN32 - - return d; -} -DIRLIST *EnumDir(char *dirname) -{ - return EnumDirEx(dirname, NULL); -} -DIRLIST *EnumDirW(wchar_t *dirname) -{ - return EnumDirExW(dirname, NULL); -} - -// Comparison of DIRLIST list entry -int CompareDirListByName(void *p1, void *p2) -{ - DIRENT *d1, *d2; - if (p1 == NULL || p2 == NULL) - { - return 0; - } - d1 = *(DIRENT **)p1; - d2 = *(DIRENT **)p2; - if (d1 == NULL || d2 == NULL) - { - return 0; - } - return UniStrCmpi(d1->FileNameW, d2->FileNameW); -} - -// Release the enumeration of the directory -void FreeDir(DIRLIST *d) -{ - UINT i; - // Validate arguments - if (d == NULL) - { - return; - } - - for (i = 0;i < d->NumFiles;i++) - { - DIRENT *f = d->File[i]; - Free(f->FileName); - Free(f->FileNameW); - Free(f); - } - Free(d->File); - Free(d); -} - - -// Make the file name safe -void UniSafeFileName(wchar_t *name) -{ - UINT i, len, dlen; - static wchar_t *danger_str = L"\\/:*?\"<>|"; - // Validate arguments - if (name == NULL) - { - return; - } - - dlen = UniStrLen(danger_str); - len = UniStrLen(name); - - for (i = 0;i < len;i++) - { - wchar_t c = name[i]; - UINT j; - for (j = 0;j < dlen;j++) - { - if (c == danger_str[j]) - { - c = L'_'; - } - } - name[i] = c; - } -} - -// Read HamCore file -BUF *ReadHamcoreW(wchar_t *filename) -{ - char *filename_a = CopyUniToStr(filename); - BUF *ret; - - ret = ReadHamcore(filename_a); - - Free(filename_a); - - return ret; -} -BUF *ReadHamcore(char *name) -{ - wchar_t tmp[MAX_SIZE]; - wchar_t exe_dir[MAX_SIZE]; - BUF *b; - char filename[MAX_PATH]; - // Validate arguments - if (name == NULL) - { - return NULL; - } - - if (name[0] == '|') - { - name++; - } - - if (name[0] == '/' || name[0] == '\\') - { - name++; - } - - StrCpy(filename, sizeof(filename), name); - - ReplaceStrEx(filename, sizeof(filename), filename, "/", "\\", true); - - if (MayaquaIsMinimalMode()) - { - return NULL; - } - - // If the file exist in hamcore/ directory on the local disk, read it - GetExeDirW(exe_dir, sizeof(exe_dir)); - - UniFormat(tmp, sizeof(tmp), L"%s/%S/%S", exe_dir, HAMCORE_DIR_NAME, filename); - - b = ReadDumpW(tmp); - if (b != NULL) - { - return b; - } - - // Search from HamCore file system if it isn't found - LockList(hamcore); - { - HC t, *c; - UINT i; - - Zero(&t, sizeof(t)); - t.FileName = filename; - c = Search(hamcore, &t); - - if (c == NULL) - { - // File does not exist - b = NULL; - } - else - { - // File exists - if (c->Buffer != NULL) - { - // It is already loaded - b = NewBuf(); - WriteBuf(b, c->Buffer, c->Size); - SeekBuf(b, 0, 0); - c->LastAccess = Tick64(); - } - else - { - // Read from a file is if it is not read - if (FileSeek(hamcore_io, 0, c->Offset) == false) - { - // Failed to seek - b = NULL; - } - else - { - // Read the compressed data - void *data = Malloc(c->SizeCompressed); - if (FileRead(hamcore_io, data, c->SizeCompressed) == false) - { - // Failed to read - Free(data); - b = NULL; - } - else - { - // Expand - c->Buffer = ZeroMalloc(c->Size); - if (Uncompress(c->Buffer, c->Size, data, c->SizeCompressed) != c->Size) - { - // Failed to expand - Free(data); - Free(c->Buffer); - b = NULL; - } - else - { - // Successful - Free(data); - b = NewBuf(); - WriteBuf(b, c->Buffer, c->Size); - SeekBuf(b, 0, 0); - c->LastAccess = Tick64(); - } - } - } - } - } - - // Delete the expired cache - for (i = 0;i < LIST_NUM(hamcore);i++) - { - HC *c = LIST_DATA(hamcore, i); - - if (c->Buffer != NULL) - { - if (((c->LastAccess + HAMCORE_CACHE_EXPIRES) <= Tick64()) || - (StartWith(c->FileName, "Li"))) - { - Free(c->Buffer); - c->Buffer = NULL; - } - } - } - } - UnlockList(hamcore); - - return b; -} - -// Initialization of HamCore file system -void InitHamcore() -{ - wchar_t tmp[MAX_PATH]; - wchar_t tmp2[MAX_PATH]; - wchar_t exe_dir[MAX_PATH]; - UINT i, num; - char header[HAMCORE_HEADER_SIZE]; - - hamcore = NewList(CompareHamcore); - - if (MayaquaIsMinimalMode()) - { - return; - } - - GetExeDirW(exe_dir, sizeof(exe_dir)); - UniFormat(tmp, sizeof(tmp), L"%s/%S", exe_dir, HAMCORE_FILE_NAME); - - UniFormat(tmp2, sizeof(tmp2), L"%s/%S", exe_dir, HAMCORE_FILE_NAME_2); - - // If there is _hamcore.se2, overwrite it yo the hamcore.se2 - FileReplaceRenameW(tmp2, tmp); - - // Read if there is a file hamcore.se2 - hamcore_io = FileOpenW(tmp, false); - if (hamcore_io == NULL) - { - // Look in other locations if it isn't found -#ifdef OS_WIN32 - UniFormat(tmp, sizeof(tmp), L"%S/%S", MsGetSystem32Dir(), HAMCORE_FILE_NAME); -#else // OS_WIN32 - UniFormat(tmp, sizeof(tmp), L"/bin/%S", HAMCORE_FILE_NAME); -#endif // OS_WIN32 - - hamcore_io = FileOpenW(tmp, false); - if (hamcore_io == NULL) - { - return; - } - } - - // Read the file header - Zero(header, sizeof(header)); - FileRead(hamcore_io, header, HAMCORE_HEADER_SIZE); - - if (Cmp(header, HAMCORE_HEADER_DATA, HAMCORE_HEADER_SIZE) != 0) - { - // Invalid header - FileClose(hamcore_io); - hamcore_io = NULL; - return; - } - - // The number of the File - num = 0; - FileRead(hamcore_io, &num, sizeof(num)); - num = Endian32(num); - for (i = 0;i < num;i++) - { - // File name - char tmp[MAX_SIZE]; - UINT str_size = 0; - HC *c; - - FileRead(hamcore_io, &str_size, sizeof(str_size)); - str_size = Endian32(str_size); - if (str_size >= 1) - { - str_size--; - } - - Zero(tmp, sizeof(tmp)); - FileRead(hamcore_io, tmp, str_size); - - c = ZeroMalloc(sizeof(HC)); - c->FileName = CopyStr(tmp); - - FileRead(hamcore_io, &c->Size, sizeof(UINT)); - c->Size = Endian32(c->Size); - - FileRead(hamcore_io, &c->SizeCompressed, sizeof(UINT)); - c->SizeCompressed = Endian32(c->SizeCompressed); - - FileRead(hamcore_io, &c->Offset, sizeof(UINT)); - c->Offset = Endian32(c->Offset); - - Insert(hamcore, c); - } -} - -// Release of HamCore file system -void FreeHamcore() -{ - UINT i; - for (i = 0;i < LIST_NUM(hamcore);i++) - { - HC *c = LIST_DATA(hamcore, i); - Free(c->FileName); - if (c->Buffer != NULL) - { - Free(c->Buffer); - } - Free(c); - } - ReleaseList(hamcore); - - FileClose(hamcore_io); - hamcore_io = NULL; - hamcore = NULL; -} - -// Build a Hamcore file -void BuildHamcore(char *dst_filename, char *src_dir, bool unix_only) -{ - char exe_dir[MAX_SIZE]; - bool ok = true; - LIST *o; - UINT i; - TOKEN_LIST *src_file_list; - - GetExeDir(exe_dir, sizeof(exe_dir)); - - src_file_list = EnumDirWithSubDirs(src_dir); - - o = NewListFast(CompareHamcore); - - for (i = 0;i < src_file_list->NumTokens;i++) - { - char rpath[MAX_SIZE]; - BUF *b; - char s[MAX_SIZE]; - - StrCpy(s, sizeof(s), src_file_list->Token[i]); - Trim(s); - - if (GetRelativePath(rpath, sizeof(rpath), s, src_dir) == false) - { - // Unknown error ! - } - else - { - bool ok = true; - - ReplaceStr(rpath, sizeof(rpath), rpath, "/", "\\"); - - if (unix_only) - { - // Exclude non-UNIX files - if (EndWith(s, ".exe") || - EndWith(s, ".dll") || - EndWith(s, ".sys") || - EndWith(s, ".inf") || - EndWith(s, ".cat") || - EndWith(s, ".wav")) - { - ok = false; - } - } - - if (InStr(rpath, "\\node_modules\\")) - { - // Exclude node_modules in the hamcore\webroot - ok = false; - } - - if (ok) - { - b = ReadDump(s); - if (b == NULL) - { - Print("Failed to open '%s'.\n", s); - ok = false; - } - else - { - HC *c = ZeroMalloc(sizeof(HC)); - UINT tmp_size; - void *tmp; - c->FileName = CopyStr(rpath); - c->Size = b->Size; - tmp_size = CalcCompress(c->Size); - tmp = Malloc(tmp_size); - c->SizeCompressed = Compress(tmp, tmp_size, b->Buf, b->Size); - c->Buffer = tmp; - Insert(o, c); - Print("%s: %u -> %u\n", s, c->Size, c->SizeCompressed); - FreeBuf(b); - } - } - } - } - - if (ok) - { - // Calculate the offset of the buffer for each file - UINT i, z; - char tmp[MAX_SIZE]; - BUF *b; - z = 0; - z += HAMCORE_HEADER_SIZE; - // The number of files - z += sizeof(UINT); - // For file table first - for (i = 0;i < LIST_NUM(o);i++) - { - HC *c = LIST_DATA(o, i); - // File name - z += StrLen(c->FileName) + sizeof(UINT); - // File size - z += sizeof(UINT); - z += sizeof(UINT); - // Offset data - z += sizeof(UINT); - } - // File body - for (i = 0;i < LIST_NUM(o);i++) - { - HC *c = LIST_DATA(o, i); - // Buffer body - c->Offset = z; - printf("%s: offset: %u\n", c->FileName, c->Offset); - z += c->SizeCompressed; - } - // Writing - b = NewBuf(); - // Header - WriteBuf(b, HAMCORE_HEADER_DATA, HAMCORE_HEADER_SIZE); - WriteBufInt(b, LIST_NUM(o)); - for (i = 0;i < LIST_NUM(o);i++) - { - HC *c = LIST_DATA(o, i); - // File name - WriteBufStr(b, c->FileName); - // File size - WriteBufInt(b, c->Size); - WriteBufInt(b, c->SizeCompressed); - // Offset - WriteBufInt(b, c->Offset); - } - // Body - for (i = 0;i < LIST_NUM(o);i++) - { - HC *c = LIST_DATA(o, i); - WriteBuf(b, c->Buffer, c->SizeCompressed); - } - // Writing - StrCpy(tmp, sizeof(tmp), dst_filename); - Print("Writing %s...\n", tmp); - FileDelete(tmp); - DumpBuf(b, tmp); - FreeBuf(b); - } - - for (i = 0;i < LIST_NUM(o);i++) - { - HC *c = LIST_DATA(o, i); - Free(c->Buffer); - Free(c->FileName); - Free(c); - } - - ReleaseList(o); - - FreeToken(src_file_list); -} - -// Comparison of the HCs -int CompareHamcore(void *p1, void *p2) -{ - HC *c1, *c2; - if (p1 == NULL || p2 == NULL) - { - return 0; - } - c1 = *(HC **)p1; - c2 = *(HC **)p2; - if (c1 == NULL || c2 == NULL) - { - return 0; - } - return StrCmpi(c1->FileName, c2->FileName); -} - -// Getting the name of the directory where the EXE file is in -void GetExeDir(char *name, UINT size) -{ - // Validate arguments - if (name == NULL) - { - return; - } - - GetDirNameFromFilePath(name, size, exe_file_name); -} -void GetExeDirW(wchar_t *name, UINT size) -{ - // Validate arguments - if (name == NULL) - { - return; - } - - GetDirNameFromFilePathW(name, size, exe_file_name_w); -} - -// Get the EXE file name -void GetExeName(char *name, UINT size) -{ - // Validate arguments - if (name == NULL) - { - return; - } - - StrCpy(name, size, exe_file_name); -} -void GetExeNameW(wchar_t *name, UINT size) -{ - // Validate arguments - if (name == NULL) - { - return; - } - - UniStrCpy(name, size, exe_file_name_w); -} - -void GetLogDir(char *name, UINT size) -{ -#ifdef SE_LOGDIR - Format(name, size, SE_LOGDIR); -#else - GetExeDir(name, size); -#endif -} - -void GetLogDirW(wchar_t *name, UINT size) -{ -#ifdef SE_LOGDIR - UniFormat(name, size, L""SE_LOGDIR); -#else - GetExeDirW(name, size); -#endif -} - -void GetDbDir(char *name, UINT size) -{ -#ifdef SE_DBDIR - Format(name, size, SE_DBDIR); -#else - GetExeDir(name, size); -#endif -} - -void GetDbDirW(wchar_t *name, UINT size) -{ -#ifdef SE_DBDIR - UniFormat(name, size, L""SE_DBDIR); -#else - GetExeDirW(name, size); -#endif -} - -void GetPidDir(char *name, UINT size) -{ -#ifdef SE_PIDDIR - Format(name, size, SE_PIDDIR); -#else - GetExeDir(name, size); -#endif -} - -void GetPidDirW(wchar_t *name, UINT size) -{ -#ifdef SE_PIDDIR - UniFormat(name, size, L""SE_PIDDIR); -#else - GetExeDirW(name, size); -#endif -} - -// Initialization of the acquisition of the EXE file name -void InitGetExeName(char *arg) -{ - wchar_t *arg_w = NULL; - // Validate arguments - if (arg == NULL) - { - arg = "./a.out"; - } - - arg_w = CopyUtfToUni(arg); - -#ifdef OS_WIN32 - Win32GetExeNameW(exe_file_name_w, sizeof(exe_file_name_w)); -#else // OS_WIN32 - UnixGetExeNameW(exe_file_name_w, sizeof(exe_file_name_w), arg_w); -#endif // OS_WIN32 - - UniToStr(exe_file_name, sizeof(exe_file_name), exe_file_name_w); - - Free(arg_w); -} - -// Get the full path of the executable binary file in Unix -void UnixGetExeNameW(wchar_t *name, UINT size, wchar_t *arg) -{ - UNI_TOKEN_LIST *t; - char *path_str; - wchar_t *path_str_w; - bool ok = false; - // Validate arguments - if (name == NULL || arg == NULL) - { - return; - } - - path_str = GetCurrentPathEnvStr(); - path_str_w = CopyUtfToUni(path_str); - - t = ParseSplitedPathW(path_str_w); - - if (t != NULL) - { - UINT i; - for (i = 0;i < t->NumTokens;i++) - { - wchar_t *s = t->Token[i]; - wchar_t tmp[MAX_SIZE]; - - ConbinePathW(tmp, sizeof(tmp), s, arg); - - if (IsFileExistsInnerW(tmp)) - { -#ifdef OS_UNIX - if (UnixCheckExecAccessW(tmp) == false) - { - continue; - } -#endif // OS_UNIX - ok = true; - UniStrCpy(name, size, tmp); - break; - } - } - - UniFreeToken(t); - } - - Free(path_str); - Free(path_str_w); - - if (ok == false) - { - // In the case of failing to find the path -#ifdef OS_UNIX - UnixGetCurrentDirW(name, size); -#else // OS_UNIX - Win32GetCurrentDirW(name, size); -#endif // OS_UNIX - ConbinePathW(name, size, name, arg); - } -} - -// Generate a secure file name -void MakeSafeFileName(char *dst, UINT size, char *src) -{ - char tmp[MAX_PATH]; - // Validate arguments - if (dst == NULL || src == NULL) - { - return; - } - - StrCpy(tmp, sizeof(tmp), src); - ReplaceStrEx(tmp, sizeof(tmp), tmp, "..", "__", false); - ReplaceStrEx(tmp, sizeof(tmp), tmp, "/", "_", false); - ReplaceStrEx(tmp, sizeof(tmp), tmp, "\\", "_", false); - ReplaceStrEx(tmp, sizeof(tmp), tmp, "@", "_", false); - ReplaceStrEx(tmp, sizeof(tmp), tmp, "|", "_", false); - - StrCpy(dst, size, tmp); -} - -// Get the file name from the file path -void GetFileNameFromFilePathW(wchar_t *dst, UINT size, wchar_t *filepath) -{ - wchar_t tmp[MAX_SIZE]; - UINT i, len, wp; - // Validate arguments - if (dst == NULL || filepath == NULL) - { - return; - } - - len = MIN(UniStrLen(filepath), (MAX_SIZE - 2)); - wp = 0; - - for (i = 0;i < (len + 1);i++) - { - wchar_t c = filepath[i]; - - switch (c) - { - case L'\\': - case L'/': - case 0: - tmp[wp] = 0; - wp = 0; - break; - - default: - tmp[wp] = c; - wp++; - break; - } - } - - UniStrCpy(dst, size, tmp); -} -void GetFileNameFromFilePath(char *dst, UINT size, char *filepath) -{ - char tmp[MAX_SIZE]; - UINT i, len, wp; - // Validate arguments - if (dst == NULL || filepath == NULL) - { - return; - } - - len = MIN(StrLen(filepath), (MAX_SIZE - 2)); - wp = 0; - - for (i = 0;i < (len + 1);i++) - { - char c = filepath[i]; - - switch (c) - { - case '\\': - case '/': - case 0: - tmp[wp] = 0; - wp = 0; - break; - - default: - tmp[wp] = c; - wp++; - break; - } - } - - StrCpy(dst, size, tmp); -} -void GetDirNameFromFilePathW(wchar_t *dst, UINT size, wchar_t *filepath) -{ - wchar_t tmp[MAX_SIZE]; - UINT wp; - UINT i; - UINT len; - // Validate arguments - if (dst == NULL || filepath == NULL) - { - return; - } - - UniStrCpy(tmp, sizeof(tmp), filepath); - if (UniEndWith(tmp, L"\\") || UniEndWith(tmp, L"/")) - { - tmp[UniStrLen(tmp) - 1] = 0; - } - - len = UniStrLen(tmp); - - UniStrCpy(dst, size, L""); - - wp = 0; - - for (i = 0;i < len;i++) - { - wchar_t c = tmp[i]; - if (c == L'/' || c == L'\\') - { - tmp[wp++] = 0; - wp = 0; - UniStrCat(dst, size, tmp); - tmp[wp++] = c; - } - else - { - tmp[wp++] = c; - } - } - - if (UniStrLen(dst) == 0) - { - UniStrCpy(dst, size, L"/"); - } - - NormalizePathW(dst, size, dst); -} - -// Get the directory name from the file path -void GetDirNameFromFilePath(char *dst, UINT size, char *filepath) -{ - char tmp[MAX_SIZE]; - UINT wp; - UINT i; - UINT len; - // Validate arguments - if (dst == NULL || filepath == NULL) - { - return; - } - - StrCpy(tmp, sizeof(tmp), filepath); - if (EndWith(tmp, "\\") || EndWith(tmp, "/")) - { - tmp[StrLen(tmp) - 1] = 0; - } - - len = StrLen(tmp); - - StrCpy(dst, size, ""); - - wp = 0; - - for (i = 0;i < len;i++) - { - char c = tmp[i]; - if (c == '/' || c == '\\') - { - tmp[wp++] = 0; - wp = 0; - StrCat(dst, size, tmp); - tmp[wp++] = c; - } - else - { - tmp[wp++] = c; - } - } - - if (StrLen(dst) == 0) - { - StrCpy(dst, size, "/"); - } - - NormalizePath(dst, size, dst); -} - -// Combine the two paths -void ConbinePath(char *dst, UINT size, char *dirname, char *filename) -{ - wchar_t dst_w[MAX_PATH]; - wchar_t *dirname_w = CopyStrToUni(dirname); - wchar_t *filename_w = CopyStrToUni(filename); - - ConbinePathW(dst_w, sizeof(dst_w), dirname_w, filename_w); - - Free(dirname_w); - Free(filename_w); - - UniToStr(dst, size, dst_w); -} -void ConbinePathW(wchar_t *dst, UINT size, wchar_t *dirname, wchar_t *filename) -{ - bool is_full_path; - wchar_t tmp[MAX_SIZE]; - wchar_t filename_ident[MAX_SIZE]; - // Validate arguments - if (dst == NULL || dirname == NULL || filename == NULL) - { - return; - } - - NormalizePathW(filename_ident, sizeof(filename_ident), filename); - - is_full_path = false; - - if (UniStartWith(filename_ident, L"\\") || UniStartWith(filename_ident, L"/")) - { - is_full_path = true; - } - - filename = &filename_ident[0]; - -#ifdef OS_WIN32 - if (UniStrLen(filename) >= 2) - { - if ((L'a' <= filename[0] && filename[0] <= L'z') || (L'A' <= filename[0] && filename[0] <= L'Z')) - { - if (filename[1] == L':') - { - is_full_path = true; - } - } - } -#endif // OS_WIN32 - - if (is_full_path == false) - { - UniStrCpy(tmp, sizeof(tmp), dirname); - if (UniEndWith(tmp, L"/") == false && UniEndWith(tmp, L"\\") == false) - { - UniStrCat(tmp, sizeof(tmp), L"/"); - } - UniStrCat(tmp, sizeof(tmp), filename); - } - else - { - UniStrCpy(tmp, sizeof(tmp), filename); - } - - NormalizePathW(dst, size, tmp); -} -void CombinePath(char *dst, UINT size, char *dirname, char *filename) -{ - ConbinePath(dst, size, dirname, filename); -} -void CombinePathW(wchar_t *dst, UINT size, wchar_t *dirname, wchar_t *filename) -{ - ConbinePathW(dst, size, dirname, filename); -} - -// Check whether the file exists -bool IsFileExists(char *name) -{ - wchar_t *name_w = CopyStrToUni(name); - bool ret = IsFileExistsW(name_w); - - Free(name_w); - - return ret; -} -bool IsFileExistsW(wchar_t *name) -{ - wchar_t tmp[MAX_SIZE]; - // Validate arguments - if (name == NULL) - { - return false; - } - - InnerFilePathW(tmp, sizeof(tmp), name); - - return IsFileExistsInnerW(tmp); -} -bool IsFileExistsInnerW(wchar_t *name) -{ - IO *o; - // Validate arguments - if (name == NULL) - { - return false; - } - - o = FileOpenInnerW(name, false, false); - if (o == NULL) - { - return false; - } - - FileClose(o); - - return true; -} - -// Get the current contents of the PATH environment variable -char *GetCurrentPathEnvStr() -{ - char tmp[1024]; - char *tag_name; - -#ifdef OS_WIN32 - tag_name = "Path"; -#else // OS_WIN32 - tag_name = "PATH"; -#endif // OS_WIN32 - - if (GetEnv(tag_name, tmp, sizeof(tmp)) == false) - { -#ifdef OS_WIN32 - Win32GetCurrentDir(tmp, sizeof(tmp)); -#else // OS_WIN32 - UnixGetCurrentDir(tmp, sizeof(tmp)); -#endif // OS_WIN32 - } - - return CopyStr(tmp); -} - -// Get multiple paths separated by colons -UNI_TOKEN_LIST *ParseSplitedPathW(wchar_t *path) -{ - UNI_TOKEN_LIST *ret; - wchar_t *tmp = UniCopyStr(path); - wchar_t *split_str; - UINT i; - - UniTrim(tmp); - UniTrimCrlf(tmp); - UniTrim(tmp); - UniTrimCrlf(tmp); - -#ifdef OS_WIN32 - split_str = L";"; -#else // OS_WIN32 - split_str = L":"; -#endif // OS_WIN32 - - ret = UniParseToken(tmp, split_str); - - if (ret != NULL) - { - for (i = 0;i < ret->NumTokens;i++) - { - UniTrim(ret->Token[i]); - UniTrimCrlf(ret->Token[i]); - UniTrim(ret->Token[i]); - UniTrimCrlf(ret->Token[i]); - } - } - - Free(tmp); - - return ret; -} - -// Get the relative path -bool GetRelativePathW(wchar_t *dst, UINT size, wchar_t *fullpath, wchar_t *basepath) -{ - wchar_t fullpath2[MAX_SIZE]; - wchar_t basepath2[MAX_SIZE]; - // Validate arguments - if (dst == NULL || fullpath == NULL || basepath == NULL) - { - return false; - } - ClearUniStr(dst, size); - - NormalizePathW(fullpath2, sizeof(fullpath2), fullpath); - NormalizePathW(basepath2, sizeof(basepath2), basepath); - -#ifdef OS_WIN32 - UniStrCat(basepath2, sizeof(basepath2), L"\\"); -#else // OS_WIN32 - UniStrCat(basepath2, sizeof(basepath2), L"/"); -#endif // OS_WIN32 - - if (UniStrLen(fullpath2) <= UniStrLen(basepath2)) - { - return false; - } - - if (UniStartWith(fullpath2, basepath2) == false) - { - return false; - } - - UniStrCpy(dst, size, fullpath2 + UniStrLen(basepath2)); - - return true; -} -bool GetRelativePath(char *dst, UINT size, char *fullpath, char *basepath) -{ - wchar_t dst_w[MAX_SIZE]; - wchar_t fullpath_w[MAX_SIZE]; - wchar_t basepath_w[MAX_SIZE]; - bool ret; - // Validate arguments - if (dst == NULL || fullpath == NULL || basepath == NULL) - { - return false; - } - - StrToUni(fullpath_w, sizeof(fullpath_w), fullpath); - StrToUni(basepath_w, sizeof(basepath_w), basepath); - - ret = GetRelativePathW(dst_w, sizeof(dst_w), fullpath_w, basepath_w); - if (ret == false) - { - return false; - } - - UniToStr(dst, size, dst_w); - - return true; -} - -// Normalize the file path -void NormalizePathW(wchar_t *dst, UINT size, wchar_t *src) -{ - wchar_t tmp[MAX_SIZE]; - UNI_TOKEN_LIST *t; - bool first_double_slash = false; - bool first_single_slash = false; -#ifdef OS_WIN32 - wchar_t win32_drive_char = 0; -#endif // OS_WIN32 - bool is_full_path = false; - UINT i; - SK *sk; - // Validate arguments - if (dst == NULL || src == 0) - { - return; - } - - // Convert the path (Win32, UNIX conversion) - UniStrCpy(tmp, sizeof(tmp), src); - ConvertPathW(tmp); - UniTrim(tmp); - - // If the path begins with "./ " or " ../", replace it to the current directory - if (UniStartWith(tmp, L"./") || UniStartWith(tmp, L".\\") || - UniStartWith(tmp, L"../") || UniStartWith(tmp, L"..\\") || - UniStrCmpi(tmp, L".") == 0 || UniStrCmpi(tmp, L"..") == 0) - { - wchar_t cd[MAX_SIZE]; - Zero(cd, sizeof(cd)); - -#ifdef OS_WIN32 - Win32GetCurrentDirW(cd, sizeof(cd)); -#else // OS_WIN32 - UnixGetCurrentDirW(cd, sizeof(cd)); -#endif // OS_WIN32 - - if (UniStartWith(tmp, L"..")) - { - UniStrCat(cd, sizeof(cd), L"/../"); - UniStrCat(cd, sizeof(cd), tmp + 2); - } - else - { - UniStrCat(cd, sizeof(cd), L"/"); - UniStrCat(cd, sizeof(cd), tmp); - } - - UniStrCpy(tmp, sizeof(tmp), cd); - } - - // If the path starts with "~/", replace it with the home directory - if (UniStartWith(tmp, L"~/") || UniStartWith(tmp, L"~\\")) - { - wchar_t tmp2[MAX_SIZE]; - GetHomeDirW(tmp2, sizeof(tmp2)); - UniStrCat(tmp2, sizeof(tmp2), L"/"); - UniStrCat(tmp2, sizeof(tmp2), tmp + 2); - UniStrCpy(tmp, sizeof(tmp), tmp2); - } - - if (UniStartWith(tmp, L"//") || UniStartWith(tmp, L"\\\\")) - { - // Begin with "//" or "\\" - first_double_slash = true; - is_full_path = true; - } - else if (UniStartWith(tmp, L"/") || UniStartWith(tmp, L"\\")) - { - // Begin with "\" - first_single_slash = true; - is_full_path = true; - } - -#ifdef OS_WIN32 - if (UniStrLen(tmp) >= 2) - { - if (tmp[1] == L':') - { - // The drive string representation of the Win32 - wchar_t tmp2[MAX_SIZE]; - is_full_path = true; - win32_drive_char = tmp[0]; - UniStrCpy(tmp2, sizeof(tmp2), tmp + 2); - UniStrCpy(tmp, sizeof(tmp), tmp2); - } - } -#endif // OS_WIN32 - - if (UniStrLen(tmp) == 1 && (tmp[0] == L'/' || tmp[0] == L'\\')) - { - tmp[0] = 0; - } - - // Tokenize - t = UniParseToken(tmp, L"/\\"); - - sk = NewSk(); - - for (i = 0;i < t->NumTokens;i++) - { - wchar_t *s = t->Token[i]; - - if (UniStrCmpi(s, L".") == 0) - { - continue; - } - else if (UniStrCmpi(s, L"..") == 0) - { - if (sk->num_item >= 1 && (first_double_slash == false || sk->num_item >= 2)) - { - Pop(sk); - } - } - else - { - Push(sk, s); - } - } - - // Token concatenation - UniStrCpy(tmp, sizeof(tmp), L""); - - if (first_double_slash) - { - UniStrCat(tmp, sizeof(tmp), L"//"); - } - else if (first_single_slash) - { - UniStrCat(tmp, sizeof(tmp), L"/"); - } - -#ifdef OS_WIN32 - if (win32_drive_char != 0) - { - wchar_t d[2]; - d[0] = win32_drive_char; - d[1] = 0; - UniStrCat(tmp, sizeof(tmp), d); - UniStrCat(tmp, sizeof(tmp), L":/"); - } -#endif // OS_WIN32 - - for (i = 0;i < sk->num_item;i++) - { - UniStrCat(tmp, sizeof(tmp), (wchar_t *)sk->p[i]); - if (i != (sk->num_item - 1)) - { - UniStrCat(tmp, sizeof(tmp), L"/"); - } - } - - ReleaseSk(sk); - - UniFreeToken(t); - - ConvertPathW(tmp); - - UniStrCpy(dst, size, tmp); -} -void NormalizePath(char *dst, UINT size, char *src) -{ - wchar_t dst_w[MAX_SIZE]; - wchar_t *src_w = CopyStrToUni(src); - - NormalizePathW(dst_w, sizeof(dst_w), src_w); - - Free(src_w); - - UniToStr(dst, size, dst_w); -} - -// Rename the file -bool FileRenameW(wchar_t *old_name, wchar_t *new_name) -{ - wchar_t tmp1[MAX_SIZE]; - wchar_t tmp2[MAX_SIZE]; - // Validate arguments - if (old_name == NULL || new_name == NULL) - { - return false; - } - - InnerFilePathW(tmp1, sizeof(tmp1), old_name); - InnerFilePathW(tmp2, sizeof(tmp2), new_name); - - return FileRenameInnerW(tmp1, tmp2); -} -bool FileRenameInnerW(wchar_t *old_name, wchar_t *new_name) -{ - // Validate arguments - if (old_name == NULL || new_name == NULL) - { - return false; - } - - return OSFileRenameW(old_name, new_name); -} - -// Convert the path -void ConvertPathW(wchar_t *path) -{ - UINT i, len; -#ifdef PATH_BACKSLASH - wchar_t new_char = L'\\'; -#else - wchar_t new_char = L'/'; -#endif - - len = UniStrLen(path); - for (i = 0;i < len;i++) - { - if (path[i] == L'\\' || path[i] == L'/') - { - path[i] = new_char; - } - } -} - -// Delete the directory -bool DeleteDir(char *name) -{ - wchar_t *name_w = CopyStrToUni(name); - bool ret = DeleteDirW(name_w); - - Free(name_w); - - return ret; -} -bool DeleteDirW(wchar_t *name) -{ - wchar_t tmp[MAX_SIZE]; - // Validate arguments - if (name == NULL) - { - return false; - } - - InnerFilePathW(tmp, sizeof(tmp), name); - - return DeleteDirInnerW(tmp); -} -bool DeleteDirInnerW(wchar_t *name) -{ - // Validate arguments - if (name == NULL) - { - return false; - } - - return OSDeleteDirW(name); -} - -// Generation of internal file path -void InnerFilePathW(wchar_t *dst, UINT size, wchar_t *src) -{ - // Validate arguments - if (dst == NULL || src == NULL) - { - return; - } - - if (src[0] == L'@') - { - wchar_t dir[MAX_SIZE]; - GetLogDirW(dir, sizeof(dir)); - ConbinePathW(dst, size, dir, &src[1]); - } - else if (src[0] == L'$') - { - wchar_t dir[MAX_SIZE]; - GetDbDirW(dir, sizeof(dir)); - ConbinePathW(dst, size, dir, &src[1]); - } - else - { - NormalizePathW(dst, size, src); - } -} -void InnerFilePath(char *dst, UINT size, char *src) -{ - wchar_t dst_w[MAX_PATH]; - wchar_t *src_w = CopyStrToUni(src); - - InnerFilePathW(dst_w, sizeof(dst_w), src_w); - - Free(src_w); - - UniToStr(dst, size, dst_w); -} - -// Recursive directory creation -bool MakeDirEx(char *name) -{ - bool ret; - wchar_t *name_w = CopyStrToUni(name); - - ret = MakeDirExW(name_w); - - Free(name_w); - - return ret; -} -bool MakeDirExW(wchar_t *name) -{ - LIST *o; - wchar_t tmp[MAX_PATH]; - wchar_t tmp2[MAX_PATH]; - UINT i; - bool ret = false; - // Validate arguments - if (name == NULL) - { - return false; - } - - o = NewListFast(NULL); - - UniStrCpy(tmp, sizeof(tmp), name); - while (true) - { - wchar_t *s = CopyUniStr(tmp); - - Add(o, s); - - GetDirNameFromFilePathW(tmp2, sizeof(tmp2), tmp); - - if (UniStrCmpi(tmp2, tmp) == 0) - { - break; - } - - UniStrCpy(tmp, sizeof(tmp), tmp2); - } - - for (i = 0;i < LIST_NUM(o);i++) - { - UINT j = LIST_NUM(o) - i - 1; - wchar_t *s = LIST_DATA(o, j); - - if (UniStrCmpi(s, L"\\") != 0 && UniStrCmpi(s, L"/") != 0) - { - ret = MakeDirW(s); - } - } - - UniFreeStrList(o); - - return ret; -} - -// Create a directory -bool MakeDir(char *name) -{ - wchar_t *name_w = CopyStrToUni(name); - bool ret = MakeDirW(name_w); - - Free(name_w); - - return ret; -} -bool MakeDirW(wchar_t *name) -{ - wchar_t tmp[MAX_SIZE]; - // Validate arguments - if (name == NULL) - { - return false; - } - - InnerFilePathW(tmp, sizeof(tmp), name); - - return MakeDirInnerW(tmp); -} -bool MakeDirInnerW(wchar_t *name) -{ - // Validate arguments - if (name == NULL) - { - return false; - } - - return OSMakeDirW(name); -} - -// Delete the file -bool FileDelete(char *name) -{ - wchar_t *name_w = CopyStrToUni(name); - bool ret = FileDeleteW(name_w); - - Free(name_w); - - return ret; -} -bool FileDeleteW(wchar_t *name) -{ - wchar_t tmp[MAX_SIZE]; - // Validate arguments - if (name == NULL) - { - return false; - } - - InnerFilePathW(tmp, sizeof(tmp), name); - - return FileDeleteInnerW(tmp); -} -bool FileDeleteInnerW(wchar_t *name) -{ - wchar_t name2[MAX_SIZE]; - // Validate arguments - if (name == NULL) - { - return false; - } - - UniStrCpy(name2, sizeof(name2), name); - ConvertPathW(name2); - - return OSFileDeleteW(name2); -} - -// Seek the file -bool FileSeek(IO *o, UINT mode, int offset) -{ - // Validate arguments - if (o == NULL) - { - return false; - } - - if (o->HamMode == false) - { - return OSFileSeek(o->pData, mode, offset); - } - else - { - return false; - } -} - -// Get the file size -UINT64 FileSize64(IO *o) -{ - // Validate arguments - if (o == NULL) - { - return 0; - } - - if (o->HamMode == false) - { - return OSFileSize(o->pData); - } - else - { - return (UINT64)o->HamBuf->Size; - } -} -UINT FileSize(IO *o) -{ - UINT64 size = (UINT)(FileSize64(o)); - - if (size >= 4294967296ULL) - { - size = 4294967295ULL; - } - - return (UINT)size; -} - -// Read from a file -bool FileRead(IO *o, void *buf, UINT size) -{ - // Validate arguments - if (o == NULL || buf == NULL) - { - return false; - } - - // KS - KS_INC(KS_IO_READ_COUNT); - KS_ADD(KS_IO_TOTAL_READ_SIZE, size); - - if (size == 0) - { - return true; - } - - if (o->HamMode == false) - { - return OSFileRead(o->pData, buf, size); - } - else - { - return ReadBuf(o->HamBuf, buf, size) == size ? true : false; - } -} - -// Write to a file -bool FileWrite(IO *o, void *buf, UINT size) -{ - // Validate arguments - if (o == NULL || buf == NULL) - { - return false; - } - if (o->WriteMode == false) - { - return false; - } - - // KS - KS_INC(KS_IO_WRITE_COUNT); - KS_ADD(KS_IO_TOTAL_WRITE_SIZE, size); - - if (size == 0) - { - return true; - } - - return OSFileWrite(o->pData, buf, size); -} - -// Flush the file -void FileFlush(IO *o) -{ - // Validate arguments - if (o == NULL) - { - return; - } - - if (o->HamMode) - { - return; - } - - OSFileFlush(o->pData); -} - -// Close the file -void FileClose(IO *o) -{ - FileCloseEx(o, false); -} -void FileCloseEx(IO *o, bool no_flush) -{ - // Validate arguments - if (o == NULL) - { - return; - } - - if (o->HamMode == false) - { - if (o->WriteMode) - { -#ifdef OS_WIN32 - Win32FileSetDate(o->pData, o->SetCreateTime, o->SetUpdateTime); -#endif // OS_WIN32 - } - - OSFileClose(o->pData, no_flush); - } - else - { - FreeBuf(o->HamBuf); - } - Free(o); - - // KS - KS_INC(KS_IO_CLOSE_COUNT); -} - -// Create a file -IO *FileCreateInnerW(wchar_t *name) -{ - IO *o; - void *p; - wchar_t name2[MAX_SIZE]; - // Validate arguments - if (name == NULL) - { - return NULL; - } - - UniStrCpy(name2, sizeof(name2), name); - ConvertPathW(name2); - - p = OSFileCreateW(name2); - if (p == NULL) - { - return NULL; - } - - o = ZeroMalloc(sizeof(IO)); - o->pData = p; - UniStrCpy(o->NameW, sizeof(o->NameW), name2); - UniToStr(o->Name, sizeof(o->Name), o->NameW); - o->WriteMode = true; - - // KS - KS_INC(KS_IO_CREATE_COUNT); - - return o; -} -IO *FileCreate(char *name) -{ - wchar_t *name_w = CopyStrToUni(name); - IO *ret = FileCreateW(name_w); - - Free(name_w); - - return ret; -} -IO *FileCreateW(wchar_t *name) -{ - wchar_t tmp[MAX_SIZE]; - // Validate arguments - if (name == NULL) - { - return NULL; - } - - InnerFilePathW(tmp, sizeof(tmp), name); - - return FileCreateInnerW(tmp); -} - -// Write all the data to the file -bool FileWriteAllW(wchar_t *name, void *data, UINT size) -{ - IO *io; - // Validate arguments - if (name == NULL || (data == NULL && size != 0)) - { - return false; - } - - io = FileCreateW(name); - - if (io == NULL) - { - return false; - } - - FileWrite(io, data, size); - - FileClose(io); - - return true; -} - -// Open the file -IO *FileOpenInnerW(wchar_t *name, bool write_mode, bool read_lock) -{ - IO *o; - void *p; - wchar_t name2[MAX_SIZE]; - // Validate arguments - if (name == NULL) - { - return NULL; - } - - UniStrCpy(name2, sizeof(name2), name); - ConvertPathW(name2); - - p = OSFileOpenW(name2, write_mode, read_lock); - if (p == NULL) - { - return NULL; - } - - o = ZeroMalloc(sizeof(IO)); - o->pData = p; - UniStrCpy(o->NameW, sizeof(o->NameW), name2); - UniToStr(o->Name, sizeof(o->Name), o->NameW); - o->WriteMode = write_mode; - -#ifdef OS_WIN32 - Win32FileGetDate(p, &o->GetCreateTime, &o->GetUpdateTime, &o->GetAccessTime); -#endif // OS_WIN32 - - // KS - KS_INC(KS_IO_OPEN_COUNT); - - return o; -} -IO *FileOpen(char *name, bool write_mode) -{ - return FileOpenEx(name, write_mode, true); -} -IO *FileOpenW(wchar_t *name, bool write_mode) -{ - return FileOpenExW(name, write_mode, true); -} -IO *FileOpenEx(char *name, bool write_mode, bool read_lock) -{ - wchar_t *name_w = CopyStrToUni(name); - IO *ret = FileOpenExW(name_w, write_mode, read_lock); - - Free(name_w); - - return ret; -} -IO *FileOpenExW(wchar_t *name, bool write_mode, bool read_lock) -{ - wchar_t tmp[MAX_SIZE]; - // Validate arguments - if (name == NULL) - { - return NULL; - } - - InnerFilePathW(tmp, sizeof(tmp), name); - - if (name[0] == L'|') - { - IO *o = ZeroMalloc(sizeof(IO)); - name++; - UniStrCpy(o->NameW, sizeof(o->NameW), name); - UniToStr(o->Name, sizeof(o->Name), o->NameW); - o->HamMode = true; - o->HamBuf = ReadHamcoreW(name); - if (o->HamBuf == NULL) - { - Free(o); - return NULL; - } - return o; - } - else - { - return FileOpenInnerW(tmp, write_mode, read_lock); - } -} - - +// SoftEther VPN Source Code - Developer Edition Master Branch +// Mayaqua Kernel + + +// FileIO.c +// File Input / Output code + +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +static char exe_file_name[MAX_SIZE] = "/tmp/a.out"; +static wchar_t exe_file_name_w[MAX_SIZE] = L"/tmp/a.out"; +static LIST *hamcore = NULL; +static IO *hamcore_io = NULL; + +#define NUM_CRC32_TABLE 256 +static UINT crc32_table[NUM_CRC32_TABLE]; + +// Confirm that the specified string exists as a line +bool IsInLines(BUF *buf, char *str, bool instr) +{ + bool ret = false; + // Validate arguments + if (buf == NULL || str == NULL) + { + return false; + } + + if (IsEmptyStr(str)) + { + return false; + } + + SeekBufToBegin(buf); + + while (ret == false) + { + char *line = CfgReadNextLine(buf); + + if (line == NULL) + { + break; + } + + Trim(line); + + if (IsEmptyStr(line) == false) + { + if (StrCmpi(line, str) == 0) + { + ret = true; + } + + if (instr) + { + if (InStr(str, line)) + { + ret = true; + } + + if (InStr(line, str)) + { + ret = true; + } + } + } + + Free(line); + } + + return ret; +} +bool IsInLinesFile(wchar_t *filename, char *str, bool instr) +{ + bool ret = false; + BUF *b; + // Validate arguments + if (filename == NULL || str == NULL) + { + return false; + } + + b = ReadDumpW(filename); + if (b == NULL) + { + return false; + } + + ret = IsInLines(b, str, instr); + + FreeBuf(b); + + return ret; +} + +// Check whether the file is write-locked +bool IsFileWriteLockedW(wchar_t *name) +{ + IO *io; + // Validate arguments + if (name == NULL) + { + return false; + } + + if (IsFileExistsW(name) == false) + { + return false; + } + + io = FileOpenW(name, true); + if (io == NULL) + { + return true; + } + + FileClose(io); + + return false; +} + +// Creating a ZIP packer +ZIP_PACKER *NewZipPacker() +{ + ZIP_PACKER *p = ZeroMalloc(sizeof(ZIP_PACKER)); + + p->Fifo = NewFifo(); + p->FileList = NewList(NULL); + p->CurrentFile = NULL; + + return p; +} + +// Release of ZIP packer +void FreeZipPacker(ZIP_PACKER *p) +{ + UINT i; + // Validate arguments + if (p == NULL) + { + return; + } + + ReleaseFifo(p->Fifo); + + for (i = 0;i < LIST_NUM(p->FileList);i++) + { + ZIP_FILE *f = LIST_DATA(p->FileList, i); + + Free(f); + } + + ReleaseList(p->FileList); + + Free(p); +} + +// Simply add the file +void ZipAddFileSimple(ZIP_PACKER *p, char *name, UINT64 dt, UINT attribute, void *data, UINT size) +{ + // Validate arguments + if (p == NULL || IsEmptyStr(name) || (size != 0 && data == NULL)) + { + return; + } + + ZipAddFileStart(p, name, size, dt, attribute); + ZipAddFileData(p, data, 0, size); +} +bool ZipAddRealFileW(ZIP_PACKER *p, char *name, UINT64 dt, UINT attribute, wchar_t *srcname) +{ + BUF *b; + // Validate arguments + if (p == NULL || IsEmptyStr(name) || srcname == NULL) + { + return false; + } + + b = ReadDumpW(srcname); + if (b == NULL) + { + return false; + } + + ZipAddFileSimple(p, name, dt, attribute, b->Buf, b->Size); + + FreeBuf(b); + + return true; +} +bool ZipAddRealFile(ZIP_PACKER *p, char *name, UINT64 dt, UINT attribute, char *srcname) +{ + bool ret = false; + wchar_t *s; + + s = CopyStrToUni(srcname); + + ret = ZipAddRealFileW(p, name, dt, attribute, s); + + Free(s); + + return ret; +} + +// Start adding a file +void ZipAddFileStart(ZIP_PACKER *p, char *name, UINT size, UINT64 dt, UINT attribute) +{ + char tmp[MAX_PATH]; + ZIP_FILE *f; + ZIP_DATA_HEADER h; + // Validate arguments + if (p == NULL || IsEmptyStr(name)) + { + return; + } + if (dt == 0) + { + dt = LocalTime64(); + } + + if (p->CurrentFile != NULL) + { + return; + } + + StrCpy(tmp, sizeof(tmp), name); + ReplaceStrEx(tmp, sizeof(tmp), tmp, "/", "\\", true); + + f = ZeroMalloc(sizeof(ZIP_FILE)); + + StrCpy(f->Name, sizeof(f->Name), tmp); + f->Size = size; + f->DateTime = dt; + f->Attributes = attribute; + + Add(p->FileList, f); + + Zero(&h, sizeof(h)); + f->HeaderPos = (UINT)p->Fifo->total_write_size; + WriteZipDataHeader(f, &h, false); + WriteFifo(p->Fifo, &h, sizeof(h)); + WriteFifo(p->Fifo, f->Name, StrLen(f->Name)); + f->Crc32 = 0xffffffff; + + p->CurrentFile = f; +} + +// Add data to the file +UINT ZipAddFileData(ZIP_PACKER *p, void *data, UINT pos, UINT len) +{ + UINT ret; + UINT total_size; + // Validate arguments + if (p == NULL) + { + return 0; + } + + total_size = p->CurrentFile->CurrentSize + len; + + if (total_size > p->CurrentFile->Size) + { + return 0; + } + + WriteFifo(p->Fifo, ((UCHAR *)data) + pos, len); + + p->CurrentFile->CurrentSize += len; + p->CurrentFile->Crc32 = Crc32Next(data, pos, len, p->CurrentFile->Crc32); + + ret = p->CurrentFile->Size - p->CurrentFile->CurrentSize; + + if (ret == 0) + { + p->CurrentFile->Crc32 = ~p->CurrentFile->Crc32; + + ZipAddFileFooter(p); + + p->CurrentFile = NULL; + } + + return ret; +} + +// Append a file footer +void ZipAddFileFooter(ZIP_PACKER *p) +{ + ZIP_DATA_FOOTER f; + // Validate arguments + if (p == NULL) + { + return; + } + + Zero(&f, sizeof(f)); + WriteZipDataFooter(p->CurrentFile, &f); + + WriteFifo(p->Fifo, &f, sizeof(f)); +} + +// Output the ZIP data to a file +bool ZipWriteW(ZIP_PACKER *p, wchar_t *name) +{ + FIFO *f; + // Validate arguments + if (p == NULL || name == NULL) + { + return false; + } + + f = ZipFinish(p); + if (f == NULL) + { + return false; + } + + return FileWriteAllW(name, FifoPtr(f), FifoSize(f)); +} + +// Complete the creation of the ZIP data +FIFO *ZipFinish(ZIP_PACKER *p) +{ + UINT i; + UINT pos_start; + UINT pos_end; + ZIP_END_HEADER e; + // Validate arguments + if (p == NULL) + { + return NULL; + } + + pos_start = (UINT)p->Fifo->total_write_size; + + for (i = 0;i < LIST_NUM(p->FileList);i++) + { + ZIP_FILE *f = LIST_DATA(p->FileList, i); + ZIP_DIR_HEADER d; + ZIP_DATA_HEADER dh; + + Zero(&d, sizeof(d)); + Zero(&dh, sizeof(dh)); + + d.Signature = Endian32(Swap32(0x02014B50)); + d.MadeVer = Endian16(Swap16(ZIP_VERSION)); + + WriteZipDataHeader(f, &dh, true); + + d.NeedVer = dh.NeedVer; + d.Option = dh.Option; + d.CompType = dh.CompType; + d.FileTime = dh.FileTime; + d.FileDate = dh.FileDate; + d.Crc32 = dh.Crc32; + d.CompSize = dh.CompSize; + d.UncompSize = dh.UncompSize; + d.FileNameLen = dh.FileNameLen; + d.ExtraLen = dh.ExtraLen; + d.CommentLen = 0; + d.DiskNum = 0; + d.InAttr = 0; + d.OutAttr = Endian32(Swap32((USHORT)f->Attributes)); + d.HeaderPos = Endian32(Swap32(f->HeaderPos)); + + WriteFifo(p->Fifo, &d, sizeof(d)); + WriteFifo(p->Fifo, f->Name, StrLen(f->Name)); + } + + pos_end = (UINT)p->Fifo->total_write_size; + + Zero(&e, sizeof(e)); + e.Signature = Endian32(Swap32(ZIP_SIGNATURE_END)); + e.DiskNum = e.StartDiskNum = 0; + e.DiskDirEntry = e.DirEntry = Endian16(Swap16((USHORT)LIST_NUM(p->FileList))); + e.DirSize = Endian32(Swap32((UINT)(pos_end - pos_start))); + e.StartPos = Endian32(Swap32(pos_start)); + e.CommentLen = 0; + + WriteFifo(p->Fifo, &e, sizeof(e)); + + return p->Fifo; +} + +// Creating a ZIP data header +void WriteZipDataHeader(ZIP_FILE *f, ZIP_DATA_HEADER *h, bool write_sizes) +{ + // Validate arguments + if (f == NULL || h ==NULL) + { + return; + } + + h->Signature = Endian32(Swap32(ZIP_SIGNATURE)); + h->NeedVer = Endian16(Swap16(ZIP_VERSION)); + h->CompType = 0; + h->FileDate = Endian16(Swap16(System64ToDosDate(f->DateTime))); + h->FileTime = Endian16(Swap16(System64ToDosTime(f->DateTime))); + h->Option = Endian16(Swap16(8)); // bit3: Set the file-size and the CRC in local header to 0 + + if (write_sizes == false) + { + h->CompSize = h->UncompSize = 0; + h->Crc32 = 0; + } + else + { + h->CompSize = h->UncompSize = Endian32(Swap32(f->Size)); + h->Crc32 = Endian32(Swap32(f->Crc32)); + } + + h->FileNameLen = Endian16(Swap16(StrLen(f->Name))); + h->ExtraLen = 0; +} + +// Creating a ZIP data footer +void WriteZipDataFooter(ZIP_FILE *f, ZIP_DATA_FOOTER *h) +{ + // Validate arguments + if (f == NULL || h ==NULL) + { + return; + } + + h->Signature = Endian32(Swap32(0x08074B50)); + h->CompSize = h->UncompSize = Endian32(Swap32(f->Size)); + h->Crc32 = Endian32(Swap32(f->Crc32)); +} + +// Initialize the common table of CRC32 +void InitCrc32() +{ + UINT poly = 0xEDB88320; + UINT u, i, j; + + for (i = 0;i < 256;i++) + { + u = i; + + for (j = 0;j < 8;j++) + { + if ((u & 0x1) != 0) + { + u = (u >> 1) ^ poly; + } + else + { + u >>= 1; + } + } + + crc32_table[i] = u; + } +} + +// CRC32 arithmetic processing +UINT Crc32(void *buf, UINT pos, UINT len) +{ + return Crc32Finish(Crc32First(buf, pos, len)); +} +UINT Crc32First(void *buf, UINT pos, UINT len) +{ + return Crc32Next(buf, pos, len, 0xffffffff); +} +UINT Crc32Next(void *buf, UINT pos, UINT len, UINT last_crc32) +{ + UINT ret = last_crc32; + UINT i; + + for (i = 0;i < len;i++) + { + ret = (ret >> 8) ^ crc32_table[((UCHAR *)buf)[pos + i] ^ (ret & 0xff)]; + } + + return ret; +} +UINT Crc32Finish(UINT last_crc32) +{ + return ~last_crc32; +} + +// Save the file +bool SaveFileW(wchar_t *name, void *data, UINT size) +{ + IO *io; + // Validate arguments + if (name == NULL || (data == NULL && size != 0)) + { + return false; + } + + io = FileCreateW(name); + if (io == NULL) + { + return false; + } + + if (FileWrite(io, data, size) == false) + { + FileClose(io); + return false; + } + + FileClose(io); + + return true; +} +bool SaveFile(char *name, void *data, UINT size) +{ + wchar_t *name_w = CopyStrToUni(name); + bool ret = SaveFileW(name_w, data, size); + + Free(name_w); + + return ret; +} + +// Check whether the file exists +bool IsFile(char *name) +{ + wchar_t *name_w = CopyStrToUni(name); + bool ret = IsFileW(name_w); + + Free(name_w); + + return ret; +} +bool IsFileW(wchar_t *name) +{ + IO *io; + // Validate arguments + if (name == NULL) + { + return false; + } + + io = FileOpenExW(name, false, false); + if (io == NULL) + { + return false; + } + + FileClose(io); + + return true; +} + +// Rename to replace the file +bool FileReplaceRenameW(wchar_t *old_name, wchar_t *new_name) +{ + // Validate arguments + if (old_name == NULL || new_name == NULL) + { + return false; + } + + if (FileCopyW(old_name, new_name) == false) + { + return false; + } + + FileDeleteW(old_name); + + return true; +} + +// Make the file name safe +void ConvertSafeFileName(char *dst, UINT size, char *src) +{ + UINT i; + // Validate arguments + if (dst == NULL || src == NULL) + { + return; + } + + StrCpy(dst, size, src); + for (i = 0;i < StrLen(dst);i++) + { + if (IsSafeChar(dst[i]) == false) + { + dst[i] = '_'; + } + } +} + +// Get the free disk space +bool GetDiskFree(char *path, UINT64 *free_size, UINT64 *used_size, UINT64 *total_size) +{ + bool ret; + // Validate arguments + if (path == NULL) + { + path = "./"; + } + +#ifdef OS_WIN32 + ret = Win32GetDiskFree(path, free_size, used_size, total_size); +#else // OS_WIN32 + ret = UnixGetDiskFree(path, free_size, used_size, total_size); +#endif // OS_WIN32 + + return ret; +} + +// Enumeration of direction with all sub directories +TOKEN_LIST *EnumDirWithSubDirs(char *dirname) +{ + TOKEN_LIST *ret; + UNI_TOKEN_LIST *ret2; + wchar_t tmp[MAX_SIZE]; + // Validate arguments + if (dirname == NULL) + { + dirname = "./"; + } + + StrToUni(tmp, sizeof(tmp), dirname); + + ret2 = EnumDirWithSubDirsW(tmp); + + ret = UniTokenListToTokenList(ret2); + + UniFreeToken(ret2); + + return ret; +} +UNI_TOKEN_LIST *EnumDirWithSubDirsW(wchar_t *dirname) +{ + ENUM_DIR_WITH_SUB_DATA d; + UNI_TOKEN_LIST *ret; + UINT i; + // Validate arguments + if (dirname == NULL) + { + dirname = L"./"; + } + + Zero(&d, sizeof(d)); + + d.FileList = NewListFast(NULL); + + EnumDirWithSubDirsMain(&d, dirname); + + ret = ZeroMalloc(sizeof(UNI_TOKEN_LIST)); + + ret->NumTokens = LIST_NUM(d.FileList); + ret->Token = ZeroMalloc(sizeof(wchar_t *) * ret->NumTokens); + + for (i = 0;i < ret->NumTokens;i++) + { + wchar_t *s = LIST_DATA(d.FileList, i); + + ret->Token[i] = UniCopyStr(s); + } + + FreeStrList(d.FileList); + + return ret; +} +void EnumDirWithSubDirsMain(ENUM_DIR_WITH_SUB_DATA *d, wchar_t *dirname) +{ + DIRLIST *dir; + UINT i; + // Validate arguments + if (d == NULL || dirname == NULL) + { + return; + } + + dir = EnumDirExW(dirname, NULL); + if (dir == NULL) + { + return; + } + + // Files + for (i = 0;i < dir->NumFiles;i++) + { + DIRENT *e = dir->File[i]; + + if (e->Folder == false) + { + wchar_t tmp[MAX_SIZE]; + + ConbinePathW(tmp, sizeof(tmp), dirname, e->FileNameW); + + Add(d->FileList, CopyUniStr(tmp)); + } + } + + // Sub directories + for (i = 0;i < dir->NumFiles;i++) + { + DIRENT *e = dir->File[i]; + + if (e->Folder) + { + wchar_t tmp[MAX_SIZE]; + + ConbinePathW(tmp, sizeof(tmp), dirname, e->FileNameW); + + EnumDirWithSubDirsMain(d, tmp); + } + } + + FreeDir(dir); +} + +// Enumeration of directory +DIRLIST *EnumDirEx(char *dirname, COMPARE *compare) +{ + wchar_t *dirname_w = CopyStrToUni(dirname); + DIRLIST *ret = EnumDirExW(dirname_w, compare); + + Free(dirname_w); + + return ret; +} +DIRLIST *EnumDirExW(wchar_t *dirname, COMPARE *compare) +{ + DIRLIST *d = NULL; + // Validate arguments + if (dirname == NULL) + { + dirname = L"./"; + } + + if (compare == NULL) + { + compare = CompareDirListByName; + } + +#ifdef OS_WIN32 + d = Win32EnumDirExW(dirname, compare); +#else // OS_WIN32 + d = UnixEnumDirExW(dirname, compare); +#endif // OS_WIN32 + + return d; +} +DIRLIST *EnumDir(char *dirname) +{ + return EnumDirEx(dirname, NULL); +} +DIRLIST *EnumDirW(wchar_t *dirname) +{ + return EnumDirExW(dirname, NULL); +} + +// Comparison of DIRLIST list entry +int CompareDirListByName(void *p1, void *p2) +{ + DIRENT *d1, *d2; + if (p1 == NULL || p2 == NULL) + { + return 0; + } + d1 = *(DIRENT **)p1; + d2 = *(DIRENT **)p2; + if (d1 == NULL || d2 == NULL) + { + return 0; + } + return UniStrCmpi(d1->FileNameW, d2->FileNameW); +} + +// Release the enumeration of the directory +void FreeDir(DIRLIST *d) +{ + UINT i; + // Validate arguments + if (d == NULL) + { + return; + } + + for (i = 0;i < d->NumFiles;i++) + { + DIRENT *f = d->File[i]; + Free(f->FileName); + Free(f->FileNameW); + Free(f); + } + Free(d->File); + Free(d); +} + + +// Make the file name safe +void UniSafeFileName(wchar_t *name) +{ + UINT i, len, dlen; + static wchar_t *danger_str = L"\\/:*?\"<>|"; + // Validate arguments + if (name == NULL) + { + return; + } + + dlen = UniStrLen(danger_str); + len = UniStrLen(name); + + for (i = 0;i < len;i++) + { + wchar_t c = name[i]; + UINT j; + for (j = 0;j < dlen;j++) + { + if (c == danger_str[j]) + { + c = L'_'; + } + } + name[i] = c; + } +} + +// Read HamCore file +BUF *ReadHamcoreW(wchar_t *filename) +{ + char *filename_a = CopyUniToStr(filename); + BUF *ret; + + ret = ReadHamcore(filename_a); + + Free(filename_a); + + return ret; +} +BUF *ReadHamcore(char *name) +{ + wchar_t tmp[MAX_SIZE]; + wchar_t exe_dir[MAX_SIZE]; + BUF *b; + char filename[MAX_PATH]; + // Validate arguments + if (name == NULL) + { + return NULL; + } + + if (name[0] == '|') + { + name++; + } + + if (name[0] == '/' || name[0] == '\\') + { + name++; + } + + StrCpy(filename, sizeof(filename), name); + + ReplaceStrEx(filename, sizeof(filename), filename, "/", "\\", true); + + if (MayaquaIsMinimalMode()) + { + return NULL; + } + + // If the file exist in hamcore/ directory on the local disk, read it + GetExeDirW(exe_dir, sizeof(exe_dir)); + + UniFormat(tmp, sizeof(tmp), L"%s/%S/%S", exe_dir, HAMCORE_DIR_NAME, filename); + + b = ReadDumpW(tmp); + if (b != NULL) + { + return b; + } + + // Search from HamCore file system if it isn't found + LockList(hamcore); + { + HC t, *c; + UINT i; + + Zero(&t, sizeof(t)); + t.FileName = filename; + c = Search(hamcore, &t); + + if (c == NULL) + { + // File does not exist + b = NULL; + } + else + { + // File exists + if (c->Buffer != NULL) + { + // It is already loaded + b = NewBuf(); + WriteBuf(b, c->Buffer, c->Size); + SeekBuf(b, 0, 0); + c->LastAccess = Tick64(); + } + else + { + // Read from a file is if it is not read + if (FileSeek(hamcore_io, 0, c->Offset) == false) + { + // Failed to seek + b = NULL; + } + else + { + // Read the compressed data + void *data = Malloc(c->SizeCompressed); + if (FileRead(hamcore_io, data, c->SizeCompressed) == false) + { + // Failed to read + Free(data); + b = NULL; + } + else + { + // Expand + c->Buffer = ZeroMalloc(c->Size); + if (Uncompress(c->Buffer, c->Size, data, c->SizeCompressed) != c->Size) + { + // Failed to expand + Free(data); + Free(c->Buffer); + b = NULL; + } + else + { + // Successful + Free(data); + b = NewBuf(); + WriteBuf(b, c->Buffer, c->Size); + SeekBuf(b, 0, 0); + c->LastAccess = Tick64(); + } + } + } + } + } + + // Delete the expired cache + for (i = 0;i < LIST_NUM(hamcore);i++) + { + HC *c = LIST_DATA(hamcore, i); + + if (c->Buffer != NULL) + { + if (((c->LastAccess + HAMCORE_CACHE_EXPIRES) <= Tick64()) || + (StartWith(c->FileName, "Li"))) + { + Free(c->Buffer); + c->Buffer = NULL; + } + } + } + } + UnlockList(hamcore); + + return b; +} + +// Initialization of HamCore file system +void InitHamcore() +{ + wchar_t tmp[MAX_PATH]; + wchar_t tmp2[MAX_PATH]; + wchar_t exe_dir[MAX_PATH]; + UINT i, num; + char header[HAMCORE_HEADER_SIZE]; + + hamcore = NewList(CompareHamcore); + + if (MayaquaIsMinimalMode()) + { + return; + } + + GetExeDirW(exe_dir, sizeof(exe_dir)); + UniFormat(tmp, sizeof(tmp), L"%s/%S", exe_dir, HAMCORE_FILE_NAME); + + UniFormat(tmp2, sizeof(tmp2), L"%s/%S", exe_dir, HAMCORE_FILE_NAME_2); + + // If there is _hamcore.se2, overwrite it yo the hamcore.se2 + FileReplaceRenameW(tmp2, tmp); + + // Read if there is a file hamcore.se2 + hamcore_io = FileOpenW(tmp, false); + if (hamcore_io == NULL) + { + // Look in other locations if it isn't found +#ifdef OS_WIN32 + UniFormat(tmp, sizeof(tmp), L"%S/%S", MsGetSystem32Dir(), HAMCORE_FILE_NAME); +#else // OS_WIN32 + UniFormat(tmp, sizeof(tmp), L"/bin/%S", HAMCORE_FILE_NAME); +#endif // OS_WIN32 + + hamcore_io = FileOpenW(tmp, false); + if (hamcore_io == NULL) + { + return; + } + } + + // Read the file header + Zero(header, sizeof(header)); + FileRead(hamcore_io, header, HAMCORE_HEADER_SIZE); + + if (Cmp(header, HAMCORE_HEADER_DATA, HAMCORE_HEADER_SIZE) != 0) + { + // Invalid header + FileClose(hamcore_io); + hamcore_io = NULL; + return; + } + + // The number of the File + num = 0; + FileRead(hamcore_io, &num, sizeof(num)); + num = Endian32(num); + for (i = 0;i < num;i++) + { + // File name + char tmp[MAX_SIZE]; + UINT str_size = 0; + HC *c; + + FileRead(hamcore_io, &str_size, sizeof(str_size)); + str_size = Endian32(str_size); + if (str_size >= 1) + { + str_size--; + } + + Zero(tmp, sizeof(tmp)); + FileRead(hamcore_io, tmp, str_size); + + c = ZeroMalloc(sizeof(HC)); + c->FileName = CopyStr(tmp); + + FileRead(hamcore_io, &c->Size, sizeof(UINT)); + c->Size = Endian32(c->Size); + + FileRead(hamcore_io, &c->SizeCompressed, sizeof(UINT)); + c->SizeCompressed = Endian32(c->SizeCompressed); + + FileRead(hamcore_io, &c->Offset, sizeof(UINT)); + c->Offset = Endian32(c->Offset); + + Insert(hamcore, c); + } +} + +// Release of HamCore file system +void FreeHamcore() +{ + UINT i; + for (i = 0;i < LIST_NUM(hamcore);i++) + { + HC *c = LIST_DATA(hamcore, i); + Free(c->FileName); + if (c->Buffer != NULL) + { + Free(c->Buffer); + } + Free(c); + } + ReleaseList(hamcore); + + FileClose(hamcore_io); + hamcore_io = NULL; + hamcore = NULL; +} + +// Build a Hamcore file +void BuildHamcore(char *dst_filename, char *src_dir, bool unix_only) +{ + char exe_dir[MAX_SIZE]; + bool ok = true; + LIST *o; + UINT i; + TOKEN_LIST *src_file_list; + + GetExeDir(exe_dir, sizeof(exe_dir)); + + src_file_list = EnumDirWithSubDirs(src_dir); + + o = NewListFast(CompareHamcore); + + for (i = 0;i < src_file_list->NumTokens;i++) + { + char rpath[MAX_SIZE]; + BUF *b; + char s[MAX_SIZE]; + + StrCpy(s, sizeof(s), src_file_list->Token[i]); + Trim(s); + + if (GetRelativePath(rpath, sizeof(rpath), s, src_dir) == false) + { + // Unknown error ! + } + else + { + bool ok = true; + + ReplaceStr(rpath, sizeof(rpath), rpath, "/", "\\"); + + if (unix_only) + { + // Exclude non-UNIX files + if (EndWith(s, ".exe") || + EndWith(s, ".dll") || + EndWith(s, ".sys") || + EndWith(s, ".inf") || + EndWith(s, ".cat") || + EndWith(s, ".wav")) + { + ok = false; + } + } + + if (InStr(rpath, "\\node_modules\\")) + { + // Exclude node_modules in the hamcore\webroot + ok = false; + } + + if (ok) + { + b = ReadDump(s); + if (b == NULL) + { + Print("Failed to open '%s'.\n", s); + ok = false; + } + else + { + HC *c = ZeroMalloc(sizeof(HC)); + UINT tmp_size; + void *tmp; + c->FileName = CopyStr(rpath); + c->Size = b->Size; + tmp_size = CalcCompress(c->Size); + tmp = Malloc(tmp_size); + c->SizeCompressed = Compress(tmp, tmp_size, b->Buf, b->Size); + c->Buffer = tmp; + Insert(o, c); + Print("%s: %u -> %u\n", s, c->Size, c->SizeCompressed); + FreeBuf(b); + } + } + } + } + + if (ok) + { + // Calculate the offset of the buffer for each file + UINT i, z; + char tmp[MAX_SIZE]; + BUF *b; + z = 0; + z += HAMCORE_HEADER_SIZE; + // The number of files + z += sizeof(UINT); + // For file table first + for (i = 0;i < LIST_NUM(o);i++) + { + HC *c = LIST_DATA(o, i); + // File name + z += StrLen(c->FileName) + sizeof(UINT); + // File size + z += sizeof(UINT); + z += sizeof(UINT); + // Offset data + z += sizeof(UINT); + } + // File body + for (i = 0;i < LIST_NUM(o);i++) + { + HC *c = LIST_DATA(o, i); + // Buffer body + c->Offset = z; + printf("%s: offset: %u\n", c->FileName, c->Offset); + z += c->SizeCompressed; + } + // Writing + b = NewBuf(); + // Header + WriteBuf(b, HAMCORE_HEADER_DATA, HAMCORE_HEADER_SIZE); + WriteBufInt(b, LIST_NUM(o)); + for (i = 0;i < LIST_NUM(o);i++) + { + HC *c = LIST_DATA(o, i); + // File name + WriteBufStr(b, c->FileName); + // File size + WriteBufInt(b, c->Size); + WriteBufInt(b, c->SizeCompressed); + // Offset + WriteBufInt(b, c->Offset); + } + // Body + for (i = 0;i < LIST_NUM(o);i++) + { + HC *c = LIST_DATA(o, i); + WriteBuf(b, c->Buffer, c->SizeCompressed); + } + // Writing + StrCpy(tmp, sizeof(tmp), dst_filename); + Print("Writing %s...\n", tmp); + FileDelete(tmp); + DumpBuf(b, tmp); + FreeBuf(b); + } + + for (i = 0;i < LIST_NUM(o);i++) + { + HC *c = LIST_DATA(o, i); + Free(c->Buffer); + Free(c->FileName); + Free(c); + } + + ReleaseList(o); + + FreeToken(src_file_list); +} + +// Comparison of the HCs +int CompareHamcore(void *p1, void *p2) +{ + HC *c1, *c2; + if (p1 == NULL || p2 == NULL) + { + return 0; + } + c1 = *(HC **)p1; + c2 = *(HC **)p2; + if (c1 == NULL || c2 == NULL) + { + return 0; + } + return StrCmpi(c1->FileName, c2->FileName); +} + +// Getting the name of the directory where the EXE file is in +void GetExeDir(char *name, UINT size) +{ + // Validate arguments + if (name == NULL) + { + return; + } + + GetDirNameFromFilePath(name, size, exe_file_name); +} +void GetExeDirW(wchar_t *name, UINT size) +{ + // Validate arguments + if (name == NULL) + { + return; + } + + GetDirNameFromFilePathW(name, size, exe_file_name_w); +} + +// Get the EXE file name +void GetExeName(char *name, UINT size) +{ + // Validate arguments + if (name == NULL) + { + return; + } + + StrCpy(name, size, exe_file_name); +} +void GetExeNameW(wchar_t *name, UINT size) +{ + // Validate arguments + if (name == NULL) + { + return; + } + + UniStrCpy(name, size, exe_file_name_w); +} + +void GetLogDir(char *name, UINT size) +{ +#ifdef SE_LOGDIR + Format(name, size, SE_LOGDIR); +#else + GetExeDir(name, size); +#endif +} + +void GetLogDirW(wchar_t *name, UINT size) +{ +#ifdef SE_LOGDIR + UniFormat(name, size, L""SE_LOGDIR); +#else + GetExeDirW(name, size); +#endif +} + +void GetDbDir(char *name, UINT size) +{ +#ifdef SE_DBDIR + Format(name, size, SE_DBDIR); +#else + GetExeDir(name, size); +#endif +} + +void GetDbDirW(wchar_t *name, UINT size) +{ +#ifdef SE_DBDIR + UniFormat(name, size, L""SE_DBDIR); +#else + GetExeDirW(name, size); +#endif +} + +void GetPidDir(char *name, UINT size) +{ +#ifdef SE_PIDDIR + Format(name, size, SE_PIDDIR); +#else + GetExeDir(name, size); +#endif +} + +void GetPidDirW(wchar_t *name, UINT size) +{ +#ifdef SE_PIDDIR + UniFormat(name, size, L""SE_PIDDIR); +#else + GetExeDirW(name, size); +#endif +} + +// Initialization of the acquisition of the EXE file name +void InitGetExeName(char *arg) +{ + wchar_t *arg_w = NULL; + // Validate arguments + if (arg == NULL) + { + arg = "./a.out"; + } + + arg_w = CopyUtfToUni(arg); + +#ifdef OS_WIN32 + Win32GetExeNameW(exe_file_name_w, sizeof(exe_file_name_w)); +#else // OS_WIN32 + UnixGetExeNameW(exe_file_name_w, sizeof(exe_file_name_w), arg_w); +#endif // OS_WIN32 + + UniToStr(exe_file_name, sizeof(exe_file_name), exe_file_name_w); + + Free(arg_w); +} + +// Get the full path of the executable binary file in Unix +void UnixGetExeNameW(wchar_t *name, UINT size, wchar_t *arg) +{ + UNI_TOKEN_LIST *t; + char *path_str; + wchar_t *path_str_w; + bool ok = false; + // Validate arguments + if (name == NULL || arg == NULL) + { + return; + } + + path_str = GetCurrentPathEnvStr(); + path_str_w = CopyUtfToUni(path_str); + + t = ParseSplitedPathW(path_str_w); + + if (t != NULL) + { + UINT i; + for (i = 0;i < t->NumTokens;i++) + { + wchar_t *s = t->Token[i]; + wchar_t tmp[MAX_SIZE]; + + ConbinePathW(tmp, sizeof(tmp), s, arg); + + if (IsFileExistsInnerW(tmp)) + { +#ifdef OS_UNIX + if (UnixCheckExecAccessW(tmp) == false) + { + continue; + } +#endif // OS_UNIX + ok = true; + UniStrCpy(name, size, tmp); + break; + } + } + + UniFreeToken(t); + } + + Free(path_str); + Free(path_str_w); + + if (ok == false) + { + // In the case of failing to find the path +#ifdef OS_UNIX + UnixGetCurrentDirW(name, size); +#else // OS_UNIX + Win32GetCurrentDirW(name, size); +#endif // OS_UNIX + ConbinePathW(name, size, name, arg); + } +} + +// Generate a secure file name +void MakeSafeFileName(char *dst, UINT size, char *src) +{ + char tmp[MAX_PATH]; + // Validate arguments + if (dst == NULL || src == NULL) + { + return; + } + + StrCpy(tmp, sizeof(tmp), src); + ReplaceStrEx(tmp, sizeof(tmp), tmp, "..", "__", false); + ReplaceStrEx(tmp, sizeof(tmp), tmp, "/", "_", false); + ReplaceStrEx(tmp, sizeof(tmp), tmp, "\\", "_", false); + ReplaceStrEx(tmp, sizeof(tmp), tmp, "@", "_", false); + ReplaceStrEx(tmp, sizeof(tmp), tmp, "|", "_", false); + + StrCpy(dst, size, tmp); +} + +// Get the file name from the file path +void GetFileNameFromFilePathW(wchar_t *dst, UINT size, wchar_t *filepath) +{ + wchar_t tmp[MAX_SIZE]; + UINT i, len, wp; + // Validate arguments + if (dst == NULL || filepath == NULL) + { + return; + } + + len = MIN(UniStrLen(filepath), (MAX_SIZE - 2)); + wp = 0; + + for (i = 0;i < (len + 1);i++) + { + wchar_t c = filepath[i]; + + switch (c) + { + case L'\\': + case L'/': + case 0: + tmp[wp] = 0; + wp = 0; + break; + + default: + tmp[wp] = c; + wp++; + break; + } + } + + UniStrCpy(dst, size, tmp); +} +void GetFileNameFromFilePath(char *dst, UINT size, char *filepath) +{ + char tmp[MAX_SIZE]; + UINT i, len, wp; + // Validate arguments + if (dst == NULL || filepath == NULL) + { + return; + } + + len = MIN(StrLen(filepath), (MAX_SIZE - 2)); + wp = 0; + + for (i = 0;i < (len + 1);i++) + { + char c = filepath[i]; + + switch (c) + { + case '\\': + case '/': + case 0: + tmp[wp] = 0; + wp = 0; + break; + + default: + tmp[wp] = c; + wp++; + break; + } + } + + StrCpy(dst, size, tmp); +} +void GetDirNameFromFilePathW(wchar_t *dst, UINT size, wchar_t *filepath) +{ + wchar_t tmp[MAX_SIZE]; + UINT wp; + UINT i; + UINT len; + // Validate arguments + if (dst == NULL || filepath == NULL) + { + return; + } + + UniStrCpy(tmp, sizeof(tmp), filepath); + if (UniEndWith(tmp, L"\\") || UniEndWith(tmp, L"/")) + { + tmp[UniStrLen(tmp) - 1] = 0; + } + + len = UniStrLen(tmp); + + UniStrCpy(dst, size, L""); + + wp = 0; + + for (i = 0;i < len;i++) + { + wchar_t c = tmp[i]; + if (c == L'/' || c == L'\\') + { + tmp[wp++] = 0; + wp = 0; + UniStrCat(dst, size, tmp); + tmp[wp++] = c; + } + else + { + tmp[wp++] = c; + } + } + + if (UniStrLen(dst) == 0) + { + UniStrCpy(dst, size, L"/"); + } + + NormalizePathW(dst, size, dst); +} + +// Get the directory name from the file path +void GetDirNameFromFilePath(char *dst, UINT size, char *filepath) +{ + char tmp[MAX_SIZE]; + UINT wp; + UINT i; + UINT len; + // Validate arguments + if (dst == NULL || filepath == NULL) + { + return; + } + + StrCpy(tmp, sizeof(tmp), filepath); + if (EndWith(tmp, "\\") || EndWith(tmp, "/")) + { + tmp[StrLen(tmp) - 1] = 0; + } + + len = StrLen(tmp); + + StrCpy(dst, size, ""); + + wp = 0; + + for (i = 0;i < len;i++) + { + char c = tmp[i]; + if (c == '/' || c == '\\') + { + tmp[wp++] = 0; + wp = 0; + StrCat(dst, size, tmp); + tmp[wp++] = c; + } + else + { + tmp[wp++] = c; + } + } + + if (StrLen(dst) == 0) + { + StrCpy(dst, size, "/"); + } + + NormalizePath(dst, size, dst); +} + +// Combine the two paths +void ConbinePath(char *dst, UINT size, char *dirname, char *filename) +{ + wchar_t dst_w[MAX_PATH]; + wchar_t *dirname_w = CopyStrToUni(dirname); + wchar_t *filename_w = CopyStrToUni(filename); + + ConbinePathW(dst_w, sizeof(dst_w), dirname_w, filename_w); + + Free(dirname_w); + Free(filename_w); + + UniToStr(dst, size, dst_w); +} +void ConbinePathW(wchar_t *dst, UINT size, wchar_t *dirname, wchar_t *filename) +{ + bool is_full_path; + wchar_t tmp[MAX_SIZE]; + wchar_t filename_ident[MAX_SIZE]; + // Validate arguments + if (dst == NULL || dirname == NULL || filename == NULL) + { + return; + } + + NormalizePathW(filename_ident, sizeof(filename_ident), filename); + + is_full_path = false; + + if (UniStartWith(filename_ident, L"\\") || UniStartWith(filename_ident, L"/")) + { + is_full_path = true; + } + + filename = &filename_ident[0]; + +#ifdef OS_WIN32 + if (UniStrLen(filename) >= 2) + { + if ((L'a' <= filename[0] && filename[0] <= L'z') || (L'A' <= filename[0] && filename[0] <= L'Z')) + { + if (filename[1] == L':') + { + is_full_path = true; + } + } + } +#endif // OS_WIN32 + + if (is_full_path == false) + { + UniStrCpy(tmp, sizeof(tmp), dirname); + if (UniEndWith(tmp, L"/") == false && UniEndWith(tmp, L"\\") == false) + { + UniStrCat(tmp, sizeof(tmp), L"/"); + } + UniStrCat(tmp, sizeof(tmp), filename); + } + else + { + UniStrCpy(tmp, sizeof(tmp), filename); + } + + NormalizePathW(dst, size, tmp); +} +void CombinePath(char *dst, UINT size, char *dirname, char *filename) +{ + ConbinePath(dst, size, dirname, filename); +} +void CombinePathW(wchar_t *dst, UINT size, wchar_t *dirname, wchar_t *filename) +{ + ConbinePathW(dst, size, dirname, filename); +} + +// Check whether the file exists +bool IsFileExists(char *name) +{ + wchar_t *name_w = CopyStrToUni(name); + bool ret = IsFileExistsW(name_w); + + Free(name_w); + + return ret; +} +bool IsFileExistsW(wchar_t *name) +{ + wchar_t tmp[MAX_SIZE]; + // Validate arguments + if (name == NULL) + { + return false; + } + + InnerFilePathW(tmp, sizeof(tmp), name); + + return IsFileExistsInnerW(tmp); +} +bool IsFileExistsInnerW(wchar_t *name) +{ + IO *o; + // Validate arguments + if (name == NULL) + { + return false; + } + + o = FileOpenInnerW(name, false, false); + if (o == NULL) + { + return false; + } + + FileClose(o); + + return true; +} + +// Get the current contents of the PATH environment variable +char *GetCurrentPathEnvStr() +{ + char tmp[1024]; + char *tag_name; + +#ifdef OS_WIN32 + tag_name = "Path"; +#else // OS_WIN32 + tag_name = "PATH"; +#endif // OS_WIN32 + + if (GetEnv(tag_name, tmp, sizeof(tmp)) == false) + { +#ifdef OS_WIN32 + Win32GetCurrentDir(tmp, sizeof(tmp)); +#else // OS_WIN32 + UnixGetCurrentDir(tmp, sizeof(tmp)); +#endif // OS_WIN32 + } + + return CopyStr(tmp); +} + +// Get multiple paths separated by colons +UNI_TOKEN_LIST *ParseSplitedPathW(wchar_t *path) +{ + UNI_TOKEN_LIST *ret; + wchar_t *tmp = UniCopyStr(path); + wchar_t *split_str; + UINT i; + + UniTrim(tmp); + UniTrimCrlf(tmp); + UniTrim(tmp); + UniTrimCrlf(tmp); + +#ifdef OS_WIN32 + split_str = L";"; +#else // OS_WIN32 + split_str = L":"; +#endif // OS_WIN32 + + ret = UniParseToken(tmp, split_str); + + if (ret != NULL) + { + for (i = 0;i < ret->NumTokens;i++) + { + UniTrim(ret->Token[i]); + UniTrimCrlf(ret->Token[i]); + UniTrim(ret->Token[i]); + UniTrimCrlf(ret->Token[i]); + } + } + + Free(tmp); + + return ret; +} + +// Get the relative path +bool GetRelativePathW(wchar_t *dst, UINT size, wchar_t *fullpath, wchar_t *basepath) +{ + wchar_t fullpath2[MAX_SIZE]; + wchar_t basepath2[MAX_SIZE]; + // Validate arguments + if (dst == NULL || fullpath == NULL || basepath == NULL) + { + return false; + } + ClearUniStr(dst, size); + + NormalizePathW(fullpath2, sizeof(fullpath2), fullpath); + NormalizePathW(basepath2, sizeof(basepath2), basepath); + +#ifdef OS_WIN32 + UniStrCat(basepath2, sizeof(basepath2), L"\\"); +#else // OS_WIN32 + UniStrCat(basepath2, sizeof(basepath2), L"/"); +#endif // OS_WIN32 + + if (UniStrLen(fullpath2) <= UniStrLen(basepath2)) + { + return false; + } + + if (UniStartWith(fullpath2, basepath2) == false) + { + return false; + } + + UniStrCpy(dst, size, fullpath2 + UniStrLen(basepath2)); + + return true; +} +bool GetRelativePath(char *dst, UINT size, char *fullpath, char *basepath) +{ + wchar_t dst_w[MAX_SIZE]; + wchar_t fullpath_w[MAX_SIZE]; + wchar_t basepath_w[MAX_SIZE]; + bool ret; + // Validate arguments + if (dst == NULL || fullpath == NULL || basepath == NULL) + { + return false; + } + + StrToUni(fullpath_w, sizeof(fullpath_w), fullpath); + StrToUni(basepath_w, sizeof(basepath_w), basepath); + + ret = GetRelativePathW(dst_w, sizeof(dst_w), fullpath_w, basepath_w); + if (ret == false) + { + return false; + } + + UniToStr(dst, size, dst_w); + + return true; +} + +// Normalize the file path +void NormalizePathW(wchar_t *dst, UINT size, wchar_t *src) +{ + wchar_t tmp[MAX_SIZE]; + UNI_TOKEN_LIST *t; + bool first_double_slash = false; + bool first_single_slash = false; +#ifdef OS_WIN32 + wchar_t win32_drive_char = 0; +#endif // OS_WIN32 + bool is_full_path = false; + UINT i; + SK *sk; + // Validate arguments + if (dst == NULL || src == 0) + { + return; + } + + // Convert the path (Win32, UNIX conversion) + UniStrCpy(tmp, sizeof(tmp), src); + ConvertPathW(tmp); + UniTrim(tmp); + + // If the path begins with "./ " or " ../", replace it to the current directory + if (UniStartWith(tmp, L"./") || UniStartWith(tmp, L".\\") || + UniStartWith(tmp, L"../") || UniStartWith(tmp, L"..\\") || + UniStrCmpi(tmp, L".") == 0 || UniStrCmpi(tmp, L"..") == 0) + { + wchar_t cd[MAX_SIZE]; + Zero(cd, sizeof(cd)); + +#ifdef OS_WIN32 + Win32GetCurrentDirW(cd, sizeof(cd)); +#else // OS_WIN32 + UnixGetCurrentDirW(cd, sizeof(cd)); +#endif // OS_WIN32 + + if (UniStartWith(tmp, L"..")) + { + UniStrCat(cd, sizeof(cd), L"/../"); + UniStrCat(cd, sizeof(cd), tmp + 2); + } + else + { + UniStrCat(cd, sizeof(cd), L"/"); + UniStrCat(cd, sizeof(cd), tmp); + } + + UniStrCpy(tmp, sizeof(tmp), cd); + } + + // If the path starts with "~/", replace it with the home directory + if (UniStartWith(tmp, L"~/") || UniStartWith(tmp, L"~\\")) + { + wchar_t tmp2[MAX_SIZE]; + GetHomeDirW(tmp2, sizeof(tmp2)); + UniStrCat(tmp2, sizeof(tmp2), L"/"); + UniStrCat(tmp2, sizeof(tmp2), tmp + 2); + UniStrCpy(tmp, sizeof(tmp), tmp2); + } + + if (UniStartWith(tmp, L"//") || UniStartWith(tmp, L"\\\\")) + { + // Begin with "//" or "\\" + first_double_slash = true; + is_full_path = true; + } + else if (UniStartWith(tmp, L"/") || UniStartWith(tmp, L"\\")) + { + // Begin with "\" + first_single_slash = true; + is_full_path = true; + } + +#ifdef OS_WIN32 + if (UniStrLen(tmp) >= 2) + { + if (tmp[1] == L':') + { + // The drive string representation of the Win32 + wchar_t tmp2[MAX_SIZE]; + is_full_path = true; + win32_drive_char = tmp[0]; + UniStrCpy(tmp2, sizeof(tmp2), tmp + 2); + UniStrCpy(tmp, sizeof(tmp), tmp2); + } + } +#endif // OS_WIN32 + + if (UniStrLen(tmp) == 1 && (tmp[0] == L'/' || tmp[0] == L'\\')) + { + tmp[0] = 0; + } + + // Tokenize + t = UniParseToken(tmp, L"/\\"); + + sk = NewSk(); + + for (i = 0;i < t->NumTokens;i++) + { + wchar_t *s = t->Token[i]; + + if (UniStrCmpi(s, L".") == 0) + { + continue; + } + else if (UniStrCmpi(s, L"..") == 0) + { + if (sk->num_item >= 1 && (first_double_slash == false || sk->num_item >= 2)) + { + Pop(sk); + } + } + else + { + Push(sk, s); + } + } + + // Token concatenation + UniStrCpy(tmp, sizeof(tmp), L""); + + if (first_double_slash) + { + UniStrCat(tmp, sizeof(tmp), L"//"); + } + else if (first_single_slash) + { + UniStrCat(tmp, sizeof(tmp), L"/"); + } + +#ifdef OS_WIN32 + if (win32_drive_char != 0) + { + wchar_t d[2]; + d[0] = win32_drive_char; + d[1] = 0; + UniStrCat(tmp, sizeof(tmp), d); + UniStrCat(tmp, sizeof(tmp), L":/"); + } +#endif // OS_WIN32 + + for (i = 0;i < sk->num_item;i++) + { + UniStrCat(tmp, sizeof(tmp), (wchar_t *)sk->p[i]); + if (i != (sk->num_item - 1)) + { + UniStrCat(tmp, sizeof(tmp), L"/"); + } + } + + ReleaseSk(sk); + + UniFreeToken(t); + + ConvertPathW(tmp); + + UniStrCpy(dst, size, tmp); +} +void NormalizePath(char *dst, UINT size, char *src) +{ + wchar_t dst_w[MAX_SIZE]; + wchar_t *src_w = CopyStrToUni(src); + + NormalizePathW(dst_w, sizeof(dst_w), src_w); + + Free(src_w); + + UniToStr(dst, size, dst_w); +} + +// Rename the file +bool FileRenameW(wchar_t *old_name, wchar_t *new_name) +{ + wchar_t tmp1[MAX_SIZE]; + wchar_t tmp2[MAX_SIZE]; + // Validate arguments + if (old_name == NULL || new_name == NULL) + { + return false; + } + + InnerFilePathW(tmp1, sizeof(tmp1), old_name); + InnerFilePathW(tmp2, sizeof(tmp2), new_name); + + return FileRenameInnerW(tmp1, tmp2); +} +bool FileRenameInnerW(wchar_t *old_name, wchar_t *new_name) +{ + // Validate arguments + if (old_name == NULL || new_name == NULL) + { + return false; + } + + return OSFileRenameW(old_name, new_name); +} + +// Convert the path +void ConvertPathW(wchar_t *path) +{ + UINT i, len; +#ifdef PATH_BACKSLASH + wchar_t new_char = L'\\'; +#else + wchar_t new_char = L'/'; +#endif + + len = UniStrLen(path); + for (i = 0;i < len;i++) + { + if (path[i] == L'\\' || path[i] == L'/') + { + path[i] = new_char; + } + } +} + +// Delete the directory +bool DeleteDir(char *name) +{ + wchar_t *name_w = CopyStrToUni(name); + bool ret = DeleteDirW(name_w); + + Free(name_w); + + return ret; +} +bool DeleteDirW(wchar_t *name) +{ + wchar_t tmp[MAX_SIZE]; + // Validate arguments + if (name == NULL) + { + return false; + } + + InnerFilePathW(tmp, sizeof(tmp), name); + + return DeleteDirInnerW(tmp); +} +bool DeleteDirInnerW(wchar_t *name) +{ + // Validate arguments + if (name == NULL) + { + return false; + } + + return OSDeleteDirW(name); +} + +// Generation of internal file path +void InnerFilePathW(wchar_t *dst, UINT size, wchar_t *src) +{ + // Validate arguments + if (dst == NULL || src == NULL) + { + return; + } + + if (src[0] == L'@') + { + wchar_t dir[MAX_SIZE]; + GetLogDirW(dir, sizeof(dir)); + ConbinePathW(dst, size, dir, &src[1]); + } + else if (src[0] == L'$') + { + wchar_t dir[MAX_SIZE]; + GetDbDirW(dir, sizeof(dir)); + ConbinePathW(dst, size, dir, &src[1]); + } + else + { + NormalizePathW(dst, size, src); + } +} +void InnerFilePath(char *dst, UINT size, char *src) +{ + wchar_t dst_w[MAX_PATH]; + wchar_t *src_w = CopyStrToUni(src); + + InnerFilePathW(dst_w, sizeof(dst_w), src_w); + + Free(src_w); + + UniToStr(dst, size, dst_w); +} + +// Recursive directory creation +bool MakeDirEx(char *name) +{ + bool ret; + wchar_t *name_w = CopyStrToUni(name); + + ret = MakeDirExW(name_w); + + Free(name_w); + + return ret; +} +bool MakeDirExW(wchar_t *name) +{ + LIST *o; + wchar_t tmp[MAX_PATH]; + wchar_t tmp2[MAX_PATH]; + UINT i; + bool ret = false; + // Validate arguments + if (name == NULL) + { + return false; + } + + o = NewListFast(NULL); + + UniStrCpy(tmp, sizeof(tmp), name); + while (true) + { + wchar_t *s = CopyUniStr(tmp); + + Add(o, s); + + GetDirNameFromFilePathW(tmp2, sizeof(tmp2), tmp); + + if (UniStrCmpi(tmp2, tmp) == 0) + { + break; + } + + UniStrCpy(tmp, sizeof(tmp), tmp2); + } + + for (i = 0;i < LIST_NUM(o);i++) + { + UINT j = LIST_NUM(o) - i - 1; + wchar_t *s = LIST_DATA(o, j); + + if (UniStrCmpi(s, L"\\") != 0 && UniStrCmpi(s, L"/") != 0) + { + ret = MakeDirW(s); + } + } + + UniFreeStrList(o); + + return ret; +} + +// Create a directory +bool MakeDir(char *name) +{ + wchar_t *name_w = CopyStrToUni(name); + bool ret = MakeDirW(name_w); + + Free(name_w); + + return ret; +} +bool MakeDirW(wchar_t *name) +{ + wchar_t tmp[MAX_SIZE]; + // Validate arguments + if (name == NULL) + { + return false; + } + + InnerFilePathW(tmp, sizeof(tmp), name); + + return MakeDirInnerW(tmp); +} +bool MakeDirInnerW(wchar_t *name) +{ + // Validate arguments + if (name == NULL) + { + return false; + } + + return OSMakeDirW(name); +} + +// Delete the file +bool FileDelete(char *name) +{ + wchar_t *name_w = CopyStrToUni(name); + bool ret = FileDeleteW(name_w); + + Free(name_w); + + return ret; +} +bool FileDeleteW(wchar_t *name) +{ + wchar_t tmp[MAX_SIZE]; + // Validate arguments + if (name == NULL) + { + return false; + } + + InnerFilePathW(tmp, sizeof(tmp), name); + + return FileDeleteInnerW(tmp); +} +bool FileDeleteInnerW(wchar_t *name) +{ + wchar_t name2[MAX_SIZE]; + // Validate arguments + if (name == NULL) + { + return false; + } + + UniStrCpy(name2, sizeof(name2), name); + ConvertPathW(name2); + + return OSFileDeleteW(name2); +} + +// Seek the file +bool FileSeek(IO *o, UINT mode, int offset) +{ + // Validate arguments + if (o == NULL) + { + return false; + } + + if (o->HamMode == false) + { + return OSFileSeek(o->pData, mode, offset); + } + else + { + return false; + } +} + +// Get the file size +UINT64 FileSize64(IO *o) +{ + // Validate arguments + if (o == NULL) + { + return 0; + } + + if (o->HamMode == false) + { + return OSFileSize(o->pData); + } + else + { + return (UINT64)o->HamBuf->Size; + } +} +UINT FileSize(IO *o) +{ + UINT64 size = (UINT)(FileSize64(o)); + + if (size >= 4294967296ULL) + { + size = 4294967295ULL; + } + + return (UINT)size; +} + +// Read from a file +bool FileRead(IO *o, void *buf, UINT size) +{ + // Validate arguments + if (o == NULL || buf == NULL) + { + return false; + } + + // KS + KS_INC(KS_IO_READ_COUNT); + KS_ADD(KS_IO_TOTAL_READ_SIZE, size); + + if (size == 0) + { + return true; + } + + if (o->HamMode == false) + { + return OSFileRead(o->pData, buf, size); + } + else + { + return ReadBuf(o->HamBuf, buf, size) == size ? true : false; + } +} + +// Write to a file +bool FileWrite(IO *o, void *buf, UINT size) +{ + // Validate arguments + if (o == NULL || buf == NULL) + { + return false; + } + if (o->WriteMode == false) + { + return false; + } + + // KS + KS_INC(KS_IO_WRITE_COUNT); + KS_ADD(KS_IO_TOTAL_WRITE_SIZE, size); + + if (size == 0) + { + return true; + } + + return OSFileWrite(o->pData, buf, size); +} + +// Flush the file +void FileFlush(IO *o) +{ + // Validate arguments + if (o == NULL) + { + return; + } + + if (o->HamMode) + { + return; + } + + OSFileFlush(o->pData); +} + +// Close the file +void FileClose(IO *o) +{ + FileCloseEx(o, false); +} +void FileCloseEx(IO *o, bool no_flush) +{ + // Validate arguments + if (o == NULL) + { + return; + } + + if (o->HamMode == false) + { + if (o->WriteMode) + { +#ifdef OS_WIN32 + Win32FileSetDate(o->pData, o->SetCreateTime, o->SetUpdateTime); +#endif // OS_WIN32 + } + + OSFileClose(o->pData, no_flush); + } + else + { + FreeBuf(o->HamBuf); + } + Free(o); + + // KS + KS_INC(KS_IO_CLOSE_COUNT); +} + +// Create a file +IO *FileCreateInnerW(wchar_t *name) +{ + IO *o; + void *p; + wchar_t name2[MAX_SIZE]; + // Validate arguments + if (name == NULL) + { + return NULL; + } + + UniStrCpy(name2, sizeof(name2), name); + ConvertPathW(name2); + + p = OSFileCreateW(name2); + if (p == NULL) + { + return NULL; + } + + o = ZeroMalloc(sizeof(IO)); + o->pData = p; + UniStrCpy(o->NameW, sizeof(o->NameW), name2); + UniToStr(o->Name, sizeof(o->Name), o->NameW); + o->WriteMode = true; + + // KS + KS_INC(KS_IO_CREATE_COUNT); + + return o; +} +IO *FileCreate(char *name) +{ + wchar_t *name_w = CopyStrToUni(name); + IO *ret = FileCreateW(name_w); + + Free(name_w); + + return ret; +} +IO *FileCreateW(wchar_t *name) +{ + wchar_t tmp[MAX_SIZE]; + // Validate arguments + if (name == NULL) + { + return NULL; + } + + InnerFilePathW(tmp, sizeof(tmp), name); + + return FileCreateInnerW(tmp); +} + +// Write all the data to the file +bool FileWriteAllW(wchar_t *name, void *data, UINT size) +{ + IO *io; + // Validate arguments + if (name == NULL || (data == NULL && size != 0)) + { + return false; + } + + io = FileCreateW(name); + + if (io == NULL) + { + return false; + } + + FileWrite(io, data, size); + + FileClose(io); + + return true; +} + +// Open the file +IO *FileOpenInnerW(wchar_t *name, bool write_mode, bool read_lock) +{ + IO *o; + void *p; + wchar_t name2[MAX_SIZE]; + // Validate arguments + if (name == NULL) + { + return NULL; + } + + UniStrCpy(name2, sizeof(name2), name); + ConvertPathW(name2); + + p = OSFileOpenW(name2, write_mode, read_lock); + if (p == NULL) + { + return NULL; + } + + o = ZeroMalloc(sizeof(IO)); + o->pData = p; + UniStrCpy(o->NameW, sizeof(o->NameW), name2); + UniToStr(o->Name, sizeof(o->Name), o->NameW); + o->WriteMode = write_mode; + +#ifdef OS_WIN32 + Win32FileGetDate(p, &o->GetCreateTime, &o->GetUpdateTime, &o->GetAccessTime); +#endif // OS_WIN32 + + // KS + KS_INC(KS_IO_OPEN_COUNT); + + return o; +} +IO *FileOpen(char *name, bool write_mode) +{ + return FileOpenEx(name, write_mode, true); +} +IO *FileOpenW(wchar_t *name, bool write_mode) +{ + return FileOpenExW(name, write_mode, true); +} +IO *FileOpenEx(char *name, bool write_mode, bool read_lock) +{ + wchar_t *name_w = CopyStrToUni(name); + IO *ret = FileOpenExW(name_w, write_mode, read_lock); + + Free(name_w); + + return ret; +} +IO *FileOpenExW(wchar_t *name, bool write_mode, bool read_lock) +{ + wchar_t tmp[MAX_SIZE]; + // Validate arguments + if (name == NULL) + { + return NULL; + } + + InnerFilePathW(tmp, sizeof(tmp), name); + + if (name[0] == L'|') + { + IO *o = ZeroMalloc(sizeof(IO)); + name++; + UniStrCpy(o->NameW, sizeof(o->NameW), name); + UniToStr(o->Name, sizeof(o->Name), o->NameW); + o->HamMode = true; + o->HamBuf = ReadHamcoreW(name); + if (o->HamBuf == NULL) + { + Free(o); + return NULL; + } + return o; + } + else + { + return FileOpenInnerW(tmp, write_mode, read_lock); + } +} + + diff --git a/src/Mayaqua/FileIO.h b/src/Mayaqua/FileIO.h index 3233ce00..d5c4eb7b 100644 --- a/src/Mayaqua/FileIO.h +++ b/src/Mayaqua/FileIO.h @@ -1,268 +1,268 @@ -// SoftEther VPN Source Code - Developer Edition Master Branch -// Mayaqua Kernel - - -// FileIO.h -// Header of FileIO.c - -#ifndef FILEIO_H -#define FILEIO_H - -// Constant -#define HAMCORE_DIR_NAME "hamcore" -#define HAMCORE_FILE_NAME "hamcore.se2" -#define HAMCORE_FILE_NAME_2 "_hamcore.se2" -#define HAMCORE_TEXT_NAME "hamcore.txt" -#define HAMCORE_HEADER_DATA "HamCore" -#define HAMCORE_HEADER_SIZE 7 -#define HAMCORE_CACHE_EXPIRES (5 * 60 * 1000) - -// IO structure -struct IO -{ - char Name[MAX_SIZE]; - wchar_t NameW[MAX_SIZE]; - void *pData; - bool WriteMode; - bool HamMode; - BUF *HamBuf; - UINT64 SetUpdateTime, SetCreateTime; - UINT64 GetUpdateTime, GetCreateTime, GetAccessTime; -}; - -// HC structure -typedef struct HC -{ - char *FileName; // File name - UINT Size; // File size - UINT SizeCompressed; // Compressed file size - UINT Offset; // Offset - void *Buffer; // Buffer - UINT64 LastAccess; // Access Date -} HC; - -// DIRENT structure -struct DIRENT -{ - bool Folder; // Folder - char *FileName; // File name (ANSI) - wchar_t *FileNameW; // File name (Unicode) - UINT64 FileSize; // File size - UINT64 CreateDate; // Creation Date - UINT64 UpdateDate; // Updating date -}; - -// DIRLIST structure -struct DIRLIST -{ - UINT NumFiles; // Number of files - struct DIRENT **File; // File array -}; - -// ZIP related structure -#ifdef OS_WIN32 -#pragma pack(push, 1) -#endif // OS_WIN32 - -struct ZIP_DATA_HEADER -{ - UINT Signature; - USHORT NeedVer; - USHORT Option; - USHORT CompType; - USHORT FileTime; - USHORT FileDate; - UINT Crc32; - UINT CompSize; - UINT UncompSize; - USHORT FileNameLen; - USHORT ExtraLen; -} GCC_PACKED; - -struct ZIP_DATA_FOOTER -{ - UINT Signature; - UINT Crc32; - UINT CompSize; - UINT UncompSize; -} GCC_PACKED; - -struct ZIP_DIR_HEADER -{ - UINT Signature; - USHORT MadeVer; - USHORT NeedVer; - USHORT Option; - USHORT CompType; - USHORT FileTime; - USHORT FileDate; - UINT Crc32; - UINT CompSize; - UINT UncompSize; - USHORT FileNameLen; - USHORT ExtraLen; - USHORT CommentLen; - USHORT DiskNum; - USHORT InAttr; - UINT OutAttr; - UINT HeaderPos; -} GCC_PACKED; - -struct ZIP_END_HEADER -{ - UINT Signature; - USHORT DiskNum; - USHORT StartDiskNum; - USHORT DiskDirEntry; - USHORT DirEntry; - UINT DirSize; - UINT StartPos; - USHORT CommentLen; -} GCC_PACKED; - -#define ZIP_SIGNATURE 0x04034B50 -#define ZIP_SIGNATURE_END 0x06054B50 -#define ZIP_VERSION 10 -#define ZIP_VERSION_WITH_COMPRESS 20 - -#ifdef OS_WIN32 -#pragma pack(pop) -#endif // OS_WIN32 - -struct ZIP_FILE -{ - char Name[MAX_PATH]; - UINT Size; - UINT64 DateTime; - UINT Attributes; - UINT CurrentSize; - UINT CompressSize; - UINT Crc32; - UINT HeaderPos; -}; - -struct ZIP_PACKER -{ - FIFO *Fifo; - LIST *FileList; - ZIP_FILE *CurrentFile; -}; - -struct ENUM_DIR_WITH_SUB_DATA -{ - LIST *FileList; -}; - -void InitCrc32(); -UINT Crc32(void *buf, UINT pos, UINT len); -UINT Crc32First(void *buf, UINT pos, UINT len); -UINT Crc32Next(void *buf, UINT pos, UINT len, UINT last_crc32); -UINT Crc32Finish(UINT last_crc32); -void WriteZipDataHeader(ZIP_FILE *f, ZIP_DATA_HEADER *h, bool write_sizes); -void WriteZipDataFooter(ZIP_FILE *f, ZIP_DATA_FOOTER *h); -ZIP_PACKER *NewZipPacker(); -void FreeZipPacker(ZIP_PACKER *p); -void ZipAddFileSimple(ZIP_PACKER *p, char *name, UINT64 dt, UINT attribute, void *data, UINT size); -bool ZipAddRealFileW(ZIP_PACKER *p, char *name, UINT64 dt, UINT attribute, wchar_t *srcname); -bool ZipAddRealFile(ZIP_PACKER *p, char *name, UINT64 dt, UINT attribute, char *srcname); -void ZipAddFileStart(ZIP_PACKER *p, char *name, UINT size, UINT64 dt, UINT attribute); -UINT ZipAddFileData(ZIP_PACKER *p, void *data, UINT pos, UINT len); -void ZipAddFileFooter(ZIP_PACKER *p); -FIFO *ZipFinish(ZIP_PACKER *p); -bool ZipWriteW(ZIP_PACKER *p, wchar_t *name); - -bool DeleteDirInnerW(wchar_t *name); -bool DeleteDir(char *name); -bool DeleteDirW(wchar_t *name); -bool MakeDirInnerW(wchar_t *name); -bool MakeDir(char *name); -bool MakeDirW(wchar_t *name); -bool MakeDirEx(char *name); -bool MakeDirExW(wchar_t *name); -bool FileDeleteInnerW(wchar_t *name); -bool FileDelete(char *name); -bool FileDeleteW(wchar_t *name); -bool FileSeek(IO *o, UINT mode, int offset); -UINT FileSize(IO *o); -UINT64 FileSize64(IO *o); -bool FileRead(IO *o, void *buf, UINT size); -bool FileWrite(IO *o, void *buf, UINT size); -void FileFlush(IO *o); -void FileClose(IO *o); -void FileCloseEx(IO *o, bool no_flush); -IO *FileCreateInnerW(wchar_t *name); -IO *FileCreate(char *name); -IO *FileCreateW(wchar_t *name); -bool FileWriteAllW(wchar_t *name, void *data, UINT size); -IO *FileOpenInnerW(wchar_t *name, bool write_mode, bool read_lock); -IO *FileOpen(char *name, bool write_mode); -IO *FileOpenW(wchar_t *name, bool write_mode); -IO *FileOpenEx(char *name, bool write_mode, bool read_lock); -IO *FileOpenExW(wchar_t *name, bool write_mode, bool read_lock); -void ConvertPathW(wchar_t *path); -bool FileRenameInnerW(wchar_t *old_name, wchar_t *new_name); -bool FileRenameW(wchar_t *old_name, wchar_t *new_name); -void NormalizePath(char *dst, UINT size, char *src); -void NormalizePathW(wchar_t *dst, UINT size, wchar_t *src); -bool GetRelativePathW(wchar_t *dst, UINT size, wchar_t *fullpath, wchar_t *basepath); -bool GetRelativePath(char *dst, UINT size, char *fullpath, char *basepath); -UNI_TOKEN_LIST *ParseSplitedPathW(wchar_t *path); -char *GetCurrentPathEnvStr(); -bool IsFileExistsInnerW(wchar_t *name); -bool IsFileExists(char *name); -bool IsFileExistsW(wchar_t *name); -void InnerFilePath(char *dst, UINT size, char *src); -void InnerFilePathW(wchar_t *dst, UINT size, wchar_t *src); -void ConbinePath(char *dst, UINT size, char *dirname, char *filename); -void ConbinePathW(wchar_t *dst, UINT size, wchar_t *dirname, wchar_t *filename); -void CombinePath(char *dst, UINT size, char *dirname, char *filename); -void CombinePathW(wchar_t *dst, UINT size, wchar_t *dirname, wchar_t *filename); -void GetDirNameFromFilePath(char *dst, UINT size, char *filepath); -void GetDirNameFromFilePathW(wchar_t *dst, UINT size, wchar_t *filepath); -void GetFileNameFromFilePath(char *dst, UINT size, char *filepath); -void GetFileNameFromFilePathW(wchar_t *dst, UINT size, wchar_t *filepath); -void MakeSafeFileName(char *dst, UINT size, char *src); -void InitGetExeName(char *arg); -void UnixGetExeNameW(wchar_t *name, UINT size, wchar_t *arg); -void GetExeName(char *name, UINT size); -void GetExeNameW(wchar_t *name, UINT size); -void GetExeDir(char *name, UINT size); -void GetExeDirW(wchar_t *name, UINT size); -void GetLogDir(char *name, UINT size); -void GetLogDirW(wchar_t *name, UINT size); -void GetDbDir(char *name, UINT size); -void GetDbDirW(wchar_t *name, UINT size); -void GetPidDir(char *name, UINT size); -void GetPidDirW(wchar_t *name, UINT size); -void BuildHamcore(char *dst_filename, char *src_dir, bool unix_only); -int CompareHamcore(void *p1, void *p2); -void InitHamcore(); -void FreeHamcore(); -BUF *ReadHamcore(char *name); -BUF *ReadHamcoreW(wchar_t *filename); -void SafeFileName(char *name); -void UniSafeFileName(wchar_t *name); -DIRLIST *EnumDir(char *dirname); -DIRLIST *EnumDirW(wchar_t *dirname); -DIRLIST *EnumDirEx(char *dirname, COMPARE *compare); -DIRLIST *EnumDirExW(wchar_t *dirname, COMPARE *compare); -UNI_TOKEN_LIST *EnumDirWithSubDirsW(wchar_t *dirname); -TOKEN_LIST *EnumDirWithSubDirs(char *dirname); -void EnumDirWithSubDirsMain(ENUM_DIR_WITH_SUB_DATA *d, wchar_t *dirname); -void FreeDir(DIRLIST *d); -int CompareDirListByName(void *p1, void *p2); -bool GetDiskFree(char *path, UINT64 *free_size, UINT64 *used_size, UINT64 *total_size); -void ConvertSafeFileName(char *dst, UINT size, char *src); -bool FileReplaceRenameW(wchar_t *old_name, wchar_t *new_name); -bool IsFile(char *name); -bool IsFileW(wchar_t *name); -bool SaveFileW(wchar_t *name, void *data, UINT size); -bool SaveFile(char *name, void *data, UINT size); -bool IsFileWriteLockedW(wchar_t *name); -bool IsInLines(BUF *buf, char *str, bool instr); -bool IsInLinesFile(wchar_t *filename, char *str, bool instr); - -#endif // FILEIO_H - - - +// SoftEther VPN Source Code - Developer Edition Master Branch +// Mayaqua Kernel + + +// FileIO.h +// Header of FileIO.c + +#ifndef FILEIO_H +#define FILEIO_H + +// Constant +#define HAMCORE_DIR_NAME "hamcore" +#define HAMCORE_FILE_NAME "hamcore.se2" +#define HAMCORE_FILE_NAME_2 "_hamcore.se2" +#define HAMCORE_TEXT_NAME "hamcore.txt" +#define HAMCORE_HEADER_DATA "HamCore" +#define HAMCORE_HEADER_SIZE 7 +#define HAMCORE_CACHE_EXPIRES (5 * 60 * 1000) + +// IO structure +struct IO +{ + char Name[MAX_SIZE]; + wchar_t NameW[MAX_SIZE]; + void *pData; + bool WriteMode; + bool HamMode; + BUF *HamBuf; + UINT64 SetUpdateTime, SetCreateTime; + UINT64 GetUpdateTime, GetCreateTime, GetAccessTime; +}; + +// HC structure +typedef struct HC +{ + char *FileName; // File name + UINT Size; // File size + UINT SizeCompressed; // Compressed file size + UINT Offset; // Offset + void *Buffer; // Buffer + UINT64 LastAccess; // Access Date +} HC; + +// DIRENT structure +struct DIRENT +{ + bool Folder; // Folder + char *FileName; // File name (ANSI) + wchar_t *FileNameW; // File name (Unicode) + UINT64 FileSize; // File size + UINT64 CreateDate; // Creation Date + UINT64 UpdateDate; // Updating date +}; + +// DIRLIST structure +struct DIRLIST +{ + UINT NumFiles; // Number of files + struct DIRENT **File; // File array +}; + +// ZIP related structure +#ifdef OS_WIN32 +#pragma pack(push, 1) +#endif // OS_WIN32 + +struct ZIP_DATA_HEADER +{ + UINT Signature; + USHORT NeedVer; + USHORT Option; + USHORT CompType; + USHORT FileTime; + USHORT FileDate; + UINT Crc32; + UINT CompSize; + UINT UncompSize; + USHORT FileNameLen; + USHORT ExtraLen; +} GCC_PACKED; + +struct ZIP_DATA_FOOTER +{ + UINT Signature; + UINT Crc32; + UINT CompSize; + UINT UncompSize; +} GCC_PACKED; + +struct ZIP_DIR_HEADER +{ + UINT Signature; + USHORT MadeVer; + USHORT NeedVer; + USHORT Option; + USHORT CompType; + USHORT FileTime; + USHORT FileDate; + UINT Crc32; + UINT CompSize; + UINT UncompSize; + USHORT FileNameLen; + USHORT ExtraLen; + USHORT CommentLen; + USHORT DiskNum; + USHORT InAttr; + UINT OutAttr; + UINT HeaderPos; +} GCC_PACKED; + +struct ZIP_END_HEADER +{ + UINT Signature; + USHORT DiskNum; + USHORT StartDiskNum; + USHORT DiskDirEntry; + USHORT DirEntry; + UINT DirSize; + UINT StartPos; + USHORT CommentLen; +} GCC_PACKED; + +#define ZIP_SIGNATURE 0x04034B50 +#define ZIP_SIGNATURE_END 0x06054B50 +#define ZIP_VERSION 10 +#define ZIP_VERSION_WITH_COMPRESS 20 + +#ifdef OS_WIN32 +#pragma pack(pop) +#endif // OS_WIN32 + +struct ZIP_FILE +{ + char Name[MAX_PATH]; + UINT Size; + UINT64 DateTime; + UINT Attributes; + UINT CurrentSize; + UINT CompressSize; + UINT Crc32; + UINT HeaderPos; +}; + +struct ZIP_PACKER +{ + FIFO *Fifo; + LIST *FileList; + ZIP_FILE *CurrentFile; +}; + +struct ENUM_DIR_WITH_SUB_DATA +{ + LIST *FileList; +}; + +void InitCrc32(); +UINT Crc32(void *buf, UINT pos, UINT len); +UINT Crc32First(void *buf, UINT pos, UINT len); +UINT Crc32Next(void *buf, UINT pos, UINT len, UINT last_crc32); +UINT Crc32Finish(UINT last_crc32); +void WriteZipDataHeader(ZIP_FILE *f, ZIP_DATA_HEADER *h, bool write_sizes); +void WriteZipDataFooter(ZIP_FILE *f, ZIP_DATA_FOOTER *h); +ZIP_PACKER *NewZipPacker(); +void FreeZipPacker(ZIP_PACKER *p); +void ZipAddFileSimple(ZIP_PACKER *p, char *name, UINT64 dt, UINT attribute, void *data, UINT size); +bool ZipAddRealFileW(ZIP_PACKER *p, char *name, UINT64 dt, UINT attribute, wchar_t *srcname); +bool ZipAddRealFile(ZIP_PACKER *p, char *name, UINT64 dt, UINT attribute, char *srcname); +void ZipAddFileStart(ZIP_PACKER *p, char *name, UINT size, UINT64 dt, UINT attribute); +UINT ZipAddFileData(ZIP_PACKER *p, void *data, UINT pos, UINT len); +void ZipAddFileFooter(ZIP_PACKER *p); +FIFO *ZipFinish(ZIP_PACKER *p); +bool ZipWriteW(ZIP_PACKER *p, wchar_t *name); + +bool DeleteDirInnerW(wchar_t *name); +bool DeleteDir(char *name); +bool DeleteDirW(wchar_t *name); +bool MakeDirInnerW(wchar_t *name); +bool MakeDir(char *name); +bool MakeDirW(wchar_t *name); +bool MakeDirEx(char *name); +bool MakeDirExW(wchar_t *name); +bool FileDeleteInnerW(wchar_t *name); +bool FileDelete(char *name); +bool FileDeleteW(wchar_t *name); +bool FileSeek(IO *o, UINT mode, int offset); +UINT FileSize(IO *o); +UINT64 FileSize64(IO *o); +bool FileRead(IO *o, void *buf, UINT size); +bool FileWrite(IO *o, void *buf, UINT size); +void FileFlush(IO *o); +void FileClose(IO *o); +void FileCloseEx(IO *o, bool no_flush); +IO *FileCreateInnerW(wchar_t *name); +IO *FileCreate(char *name); +IO *FileCreateW(wchar_t *name); +bool FileWriteAllW(wchar_t *name, void *data, UINT size); +IO *FileOpenInnerW(wchar_t *name, bool write_mode, bool read_lock); +IO *FileOpen(char *name, bool write_mode); +IO *FileOpenW(wchar_t *name, bool write_mode); +IO *FileOpenEx(char *name, bool write_mode, bool read_lock); +IO *FileOpenExW(wchar_t *name, bool write_mode, bool read_lock); +void ConvertPathW(wchar_t *path); +bool FileRenameInnerW(wchar_t *old_name, wchar_t *new_name); +bool FileRenameW(wchar_t *old_name, wchar_t *new_name); +void NormalizePath(char *dst, UINT size, char *src); +void NormalizePathW(wchar_t *dst, UINT size, wchar_t *src); +bool GetRelativePathW(wchar_t *dst, UINT size, wchar_t *fullpath, wchar_t *basepath); +bool GetRelativePath(char *dst, UINT size, char *fullpath, char *basepath); +UNI_TOKEN_LIST *ParseSplitedPathW(wchar_t *path); +char *GetCurrentPathEnvStr(); +bool IsFileExistsInnerW(wchar_t *name); +bool IsFileExists(char *name); +bool IsFileExistsW(wchar_t *name); +void InnerFilePath(char *dst, UINT size, char *src); +void InnerFilePathW(wchar_t *dst, UINT size, wchar_t *src); +void ConbinePath(char *dst, UINT size, char *dirname, char *filename); +void ConbinePathW(wchar_t *dst, UINT size, wchar_t *dirname, wchar_t *filename); +void CombinePath(char *dst, UINT size, char *dirname, char *filename); +void CombinePathW(wchar_t *dst, UINT size, wchar_t *dirname, wchar_t *filename); +void GetDirNameFromFilePath(char *dst, UINT size, char *filepath); +void GetDirNameFromFilePathW(wchar_t *dst, UINT size, wchar_t *filepath); +void GetFileNameFromFilePath(char *dst, UINT size, char *filepath); +void GetFileNameFromFilePathW(wchar_t *dst, UINT size, wchar_t *filepath); +void MakeSafeFileName(char *dst, UINT size, char *src); +void InitGetExeName(char *arg); +void UnixGetExeNameW(wchar_t *name, UINT size, wchar_t *arg); +void GetExeName(char *name, UINT size); +void GetExeNameW(wchar_t *name, UINT size); +void GetExeDir(char *name, UINT size); +void GetExeDirW(wchar_t *name, UINT size); +void GetLogDir(char *name, UINT size); +void GetLogDirW(wchar_t *name, UINT size); +void GetDbDir(char *name, UINT size); +void GetDbDirW(wchar_t *name, UINT size); +void GetPidDir(char *name, UINT size); +void GetPidDirW(wchar_t *name, UINT size); +void BuildHamcore(char *dst_filename, char *src_dir, bool unix_only); +int CompareHamcore(void *p1, void *p2); +void InitHamcore(); +void FreeHamcore(); +BUF *ReadHamcore(char *name); +BUF *ReadHamcoreW(wchar_t *filename); +void SafeFileName(char *name); +void UniSafeFileName(wchar_t *name); +DIRLIST *EnumDir(char *dirname); +DIRLIST *EnumDirW(wchar_t *dirname); +DIRLIST *EnumDirEx(char *dirname, COMPARE *compare); +DIRLIST *EnumDirExW(wchar_t *dirname, COMPARE *compare); +UNI_TOKEN_LIST *EnumDirWithSubDirsW(wchar_t *dirname); +TOKEN_LIST *EnumDirWithSubDirs(char *dirname); +void EnumDirWithSubDirsMain(ENUM_DIR_WITH_SUB_DATA *d, wchar_t *dirname); +void FreeDir(DIRLIST *d); +int CompareDirListByName(void *p1, void *p2); +bool GetDiskFree(char *path, UINT64 *free_size, UINT64 *used_size, UINT64 *total_size); +void ConvertSafeFileName(char *dst, UINT size, char *src); +bool FileReplaceRenameW(wchar_t *old_name, wchar_t *new_name); +bool IsFile(char *name); +bool IsFileW(wchar_t *name); +bool SaveFileW(wchar_t *name, void *data, UINT size); +bool SaveFile(char *name, void *data, UINT size); +bool IsFileWriteLockedW(wchar_t *name); +bool IsInLines(BUF *buf, char *str, bool instr); +bool IsInLinesFile(wchar_t *filename, char *str, bool instr); + +#endif // FILEIO_H + + + diff --git a/src/Mayaqua/Internat.c b/src/Mayaqua/Internat.c index f7904c1e..bd5f4330 100644 --- a/src/Mayaqua/Internat.c +++ b/src/Mayaqua/Internat.c @@ -1,3010 +1,3010 @@ -// SoftEther VPN Source Code - Developer Edition Master Branch -// Mayaqua Kernel - - -// Internat.c -// String conversion library for internationalization - -#include - -#include -#include -#include -#include -#include -#include -#include -#include - -extern LOCK *token_lock; -static char charset[MAX_SIZE] = "EUCJP"; -static LOCK *iconv_lock = NULL; -void *iconv_cache_wide_to_str = 0; -void *iconv_cache_str_to_wide = 0; - -// Initialize the string -void ClearUniStr(wchar_t *str, UINT str_size) -{ - UniStrCpy(str, str_size, L""); -} - -// Examine whether the string contains the specified character -bool UniInChar(wchar_t *string, wchar_t c) -{ - UINT i, len; - // Validate arguments - if (string == NULL) - { - return false; - } - - len = UniStrLen(string); - - for (i = 0;i < len;i++) - { - if (string[i] == c) - { - return true; - } - } - - return false; -} - -// Check whether the string is included -bool UniInStr(wchar_t *str, wchar_t *keyword) -{ - return UniInStrEx(str, keyword, false); -} -bool UniInStrEx(wchar_t *str, wchar_t *keyword, bool case_sensitive) -{ - // Validate arguments - if (UniIsEmptyStr(str) || UniIsEmptyStr(keyword)) - { - return false; - } - - if (UniSearchStrEx(str, keyword, 0, case_sensitive) == INFINITE) - { - return false; - } - - return true; -} - -// Convert to binary data -BUF *UniStrToBin(wchar_t *str) -{ - char *str_a = CopyUniToStr(str); - BUF *ret; - - ret = StrToBin(str_a); - - Free(str_a); - - return ret; -} - -// Check whether the character is safe -bool UniIsSafeChar(wchar_t c) -{ - UINT i, len; - wchar_t *check_str = - L"ABCDEFGHIJKLMNOPQRSTUVWXYZ" - L"abcdefghijklmnopqrstuvwxyz" - L"0123456789" - L" ()-_#%&."; - - len = UniStrLen(check_str); - for (i = 0;i < len;i++) - { - if (c == check_str[i]) - { - return true; - } - } - return false; -} - -// Convert a string list to a token list -UNI_TOKEN_LIST *UniListToTokenList(LIST *o) -{ - UINT i; - UNI_TOKEN_LIST *t; - // Validate arguments - if (o == NULL) - { - return NULL; - } - - t = ZeroMalloc(sizeof(UNI_TOKEN_LIST)); - t->NumTokens = LIST_NUM(o); - t->Token = ZeroMalloc(sizeof(wchar_t *) * t->NumTokens); - for (i = 0;i < LIST_NUM(o);i++) - { - t->Token[i] = UniCopyStr(LIST_DATA(o, i)); - } - - return t; -} - -// Free the string list -void UniFreeStrList(LIST *o) -{ - UINT i; - // Validate arguments - if (o == NULL) - { - return; - } - - for (i = 0;i < LIST_NUM(o);i++) - { - wchar_t *s = LIST_DATA(o, i); - Free(s); - } - - ReleaseList(o); -} - -// Normalize the line breaks -wchar_t *UniNormalizeCrlf(wchar_t *str) -{ - wchar_t *ret; - UINT ret_size, i, len, wp; - // Validate arguments - if (str == NULL) - { - return NULL; - } - - len = UniStrLen(str); - ret_size = sizeof(wchar_t) * (len + 32) * 2; - ret = Malloc(ret_size); - - wp = 0; - - for (i = 0;i < len;i++) - { - wchar_t c = str[i]; - - switch (c) - { - case L'\r': - if (str[i + 1] == L'\n') - { - i++; - } - ret[wp++] = L'\r'; - ret[wp++] = L'\n'; - break; - - case L'\n': - ret[wp++] = L'\r'; - ret[wp++] = L'\n'; - break; - - default: - ret[wp++] = c; - break; - } - } - - ret[wp++] = 0; - - return ret; -} - -// Check whether str ends with the key -bool UniEndWith(wchar_t *str, wchar_t *key) -{ - UINT str_len; - UINT key_len; - // Validate arguments - if (str == NULL || key == NULL) - { - return false; - } - - // Comparison - str_len = UniStrLen(str); - key_len = UniStrLen(key); - if (str_len < key_len) - { - return false; - } - - if (UniStrCmpi(str + (str_len - key_len), key) == 0) - { - return true; - } - else - { - return false; - } -} - -// Check whether str starts with the key -bool UniStartWith(wchar_t *str, wchar_t *key) -{ - UINT str_len; - UINT key_len; - wchar_t *tmp; - bool ret; - // Validate arguments - if (str == NULL || key == NULL) - { - return false; - } - - // Comparison - str_len = UniStrLen(str); - key_len = UniStrLen(key); - if (str_len < key_len) - { - return false; - } - if (str_len == 0 || key_len == 0) - { - return false; - } - tmp = CopyUniStr(str); - tmp[key_len] = 0; - - if (UniStrCmpi(tmp, key) == 0) - { - ret = true; - } - else - { - ret = false; - } - - Free(tmp); - - return ret; -} - -// Convert the integer to a comma-separated string -void UniToStr3(wchar_t *str, UINT size, UINT64 value) -{ - char tmp[MAX_SIZE]; - // Validate arguments - if (str == NULL) - { - return; - } - - ToStr3(tmp, sizeof(tmp), value); - - StrToUni(str, size, tmp); -} - -// Format of the string (internal function) -wchar_t *InternalFormatArgs(wchar_t *fmt, va_list args, bool ansi_mode) -{ - UINT i, len; - wchar_t *tmp; - UINT tmp_size; - LIST *o; - UINT mode = 0; - UINT wp; - UINT total_size; - wchar_t *ret; - // Validate arguments - if (fmt == NULL) - { - return NULL; - } - - len = UniStrLen(fmt); - tmp_size = UniStrSize(fmt); - tmp = Malloc(tmp_size); - - o = NewListFast(NULL); - - mode = 0; - - wp = 0; - - for (i = 0;i < len;i++) - { - wchar_t c = fmt[i]; - - if (mode == 0) - { - // Normal character mode - switch (c) - { - case L'%': - // The start of the format specification - if (fmt[i + 1] == L'%') - { - // If the next character is also '%', output a '%' simply - i++; - tmp[wp++] = c; - } - else - { - // Shift the state if the next character is not a '%' - mode = 1; - tmp[wp++] = 0; - wp = 0; - Add(o, CopyUniStr(tmp)); - tmp[wp++] = c; - } - break; - default: - // Ordinary character - tmp[wp++] = c; - break; - } - } - else - { - char *tag; - char dst[MAX_SIZE]; - wchar_t *target_str; - wchar_t *padding_str; - bool left_padding; - UINT target_str_len; - UINT total_len; - wchar_t *output_str; - UINT padding; - // Formatting mode - switch (c) - { - case L'c': - case L'C': - case L'd': - case L'i': - case L'o': - case L'u': - case L'x': - case L'X': - // int type - tmp[wp++] = c; - tmp[wp++] = 0; - tag = CopyUniToStr(tmp); - - #ifdef OS_WIN32 - ReplaceStrEx(tag, 0, tag, "ll", "I64", false); - #else // OS_WIN32 - ReplaceStrEx(tag, 0, tag, "I64", "ll", false); - #endif // OS_WIN32 - - if ((UniStrLen(tmp) >= 5 && tmp[UniStrLen(tmp) - 4] == L'I' && - tmp[UniStrLen(tmp) - 3] == L'6' && - tmp[UniStrLen(tmp) - 2] == L'4') || - ( - UniStrLen(tmp) >= 4 && tmp[UniStrLen(tmp) - 3] == L'l' && - tmp[UniStrLen(tmp) - 2] == L'l')) - { - #ifdef OS_WIN32 - _snprintf(dst, sizeof(dst), tag, va_arg(args, UINT64)); - #else // OS_WIN32 - snprintf(dst, sizeof(dst), tag, va_arg(args, UINT64)); - #endif // OS_WIN32 - } - else - { - #ifdef OS_WIN32 - _snprintf(dst, sizeof(dst), tag, va_arg(args, int)); - #else // OS_WIN32 - snprintf(dst, sizeof(dst), tag, va_arg(args, int)); - #endif // OS_WIN32 - } - - Free(tag); - Add(o, CopyStrToUni(dst)); - - wp = 0; - mode = 0; - break; - case L'e': - case L'E': - case L'f': - case L'g': - case L'G': - // Double type - tmp[wp++] = c; - tmp[wp++] = 0; - tag = CopyUniToStr(tmp); - - #ifdef OS_WIN32 - _snprintf(dst, sizeof(dst), tag, va_arg(args, double)); - #else // OS_WIN32 - snprintf(dst, sizeof(dst), tag, va_arg(args, double)); - #endif // OS_WIN32 - - Free(tag); - Add(o, CopyStrToUni(dst)); - - wp = 0; - mode = 0; - break; - case L'n': - case L'p': - // Pointer type - tmp[wp++] = c; - tmp[wp++] = 0; - tag = ZeroMalloc(UniStrSize(tmp) + 32); - UniToStr(tag, 0, tmp); - - #ifdef OS_WIN32 - _snprintf(dst, sizeof(dst), tag, va_arg(args, void *)); - #else // OS_WIN32 - snprintf(dst, sizeof(dst), tag, va_arg(args, void *)); - #endif // OS_WIN32 - - Free(tag); - Add(o, CopyStrToUni(dst)); - - wp = 0; - mode = 0; - break; - case L'r': - case L'R': - // IP address type - tmp[wp++] = c; - tmp[wp++] = 0; - - Zero(dst, sizeof(dst)); - IPToStr(dst, sizeof(dst), va_arg(args, void *)); - - Add(o, CopyStrToUni(dst)); - - wp = 0; - mode = 0; - break; - - case L's': - case L'S': - // String type - tmp[wp++] = c; - tmp[wp++] = 0; - - if (ansi_mode == false) - { - if (c == L'S') - { - c = L's'; - } - else - { - c = L'S'; - } - } - - if (c == L's') - { - target_str = CopyStrToUni(va_arg(args, char *)); - } - else - { - target_str = CopyUniStr(va_arg(args, wchar_t *)); - } - - if (target_str == NULL) - { - target_str = CopyUniStr(L"(null)"); - } - - padding = 0; - left_padding = false; - if (tmp[1] == L'-') - { - // Left aligned - if (UniStrLen(tmp) >= 3) - { - padding = UniToInt(&tmp[2]); - } - left_padding = true; - } - else - { - // Right aligned - if (UniStrLen(tmp) >= 2) - { - padding = UniToInt(&tmp[1]); - } - } - - target_str_len = UniStrWidth(target_str); - - if (padding > target_str_len) - { - UINT len = padding - target_str_len; - UINT i; - padding_str = ZeroMalloc(sizeof(wchar_t) * (len + 1)); - for (i = 0;i < len;i++) - { - padding_str[i] = L' '; - } - } - else - { - padding_str = ZeroMalloc(sizeof(wchar_t)); - } - - total_len = sizeof(wchar_t) * (UniStrLen(padding_str) + UniStrLen(target_str) + 1); - output_str = ZeroMalloc(total_len); - output_str[0] = 0; - - if (left_padding == false) - { - UniStrCat(output_str, total_len, padding_str); - } - UniStrCat(output_str, total_len, target_str); - if (left_padding) - { - UniStrCat(output_str, total_len, padding_str); - } - - Add(o, output_str); - - Free(target_str); - Free(padding_str); - - wp = 0; - mode = 0; - break; - default: - // Normal string - tmp[wp++] = c; - break; - } - } - } - tmp[wp++] = 0; - wp = 0; - - if (UniStrLen(tmp) >= 1) - { - Add(o, CopyUniStr(tmp)); - } - - total_size = sizeof(wchar_t); - for (i = 0;i < LIST_NUM(o);i++) - { - wchar_t *s = LIST_DATA(o, i); - total_size += UniStrLen(s) * sizeof(wchar_t); - } - - ret = ZeroMalloc(total_size); - for (i = 0;i < LIST_NUM(o);i++) - { - wchar_t *s = LIST_DATA(o, i); - UniStrCat(ret, total_size, s); - Free(s); - } - - ReleaseList(o); - - Free(tmp); - - return ret; -} - -// Get the width of the string -UINT UniStrWidth(wchar_t *str) -{ - UINT i, len, ret; - // Validate arguments - if (str == NULL) - { - return 0; - } - - ret = 0; - len = UniStrLen(str); - for (i = 0;i < len;i++) - { - if (str[i] <= 255) - { - ret++; - } - else - { - ret += 2; - } - } - return ret; -} - -// Convert string of 2 byte/character to wchar_t of 4 byte/character -wchar_t *Utf16ToWide(USHORT *str) -{ - wchar_t *ret; - UINT len, i; - // Validate arguments - if (str == NULL) - { - return NULL; - } - - len = 0; - while (true) - { - if (str[len] == 0) - { - break; - } - len++; - } - - ret = Malloc((len + 1) * sizeof(wchar_t)); - for (i = 0;i < len + 1;i++) - { - ret[i] = (wchar_t)str[i]; - } - - return ret; -} - -// Convert wchar_t string of 4 byte/character to string of 2 byte/character -USHORT *WideToUtf16(wchar_t *str) -{ - USHORT *ret; - UINT len; - UINT ret_size; - UINT i; - // Validate arguments - if (str == NULL) - { - return NULL; - } - - len = UniStrLen(str); - - ret_size = (len + 1) * 2; - ret = Malloc(ret_size); - - for (i = 0;i < len + 1;i++) - { - ret[i] = (USHORT)str[i]; - } - - return ret; -} - -// Initialization of the International Library -void InitInternational() -{ -#ifdef OS_UNIX - void *d; - - if (iconv_lock != NULL) - { - return; - } - - GetCurrentCharSet(charset, sizeof(charset)); - d = IconvWideToStrInternal(); - if (d == (void *)-1) - { -#if defined (UNIX_MACOS) || defined (UNIX_LINUX_MUSL) - StrCpy(charset, sizeof(charset), "utf-8"); -#else // defined (UNIX_MACOS) || defined (UNIX_LINUX_MUSL) - StrCpy(charset, sizeof(charset), "EUCJP"); -#endif // defined (UNIX_MACOS) || defined (UNIX_LINUX_MUSL) - d = IconvWideToStrInternal(); - if (d == (void *)-1) - { - StrCpy(charset, sizeof(charset), "US"); - } - else - { - IconvFreeInternal(d); - } - } - else - { - IconvFreeInternal(d); - } - - iconv_lock = NewLockMain(); - - iconv_cache_wide_to_str = IconvWideToStrInternal(); - iconv_cache_str_to_wide = IconvStrToWideInternal(); -#endif // OS_UNIX -} - -// Release of the International Library -void FreeInternational() -{ -#ifdef OS_UNIX -#endif // OS_UNIX -} - -#ifdef OS_UNIX - -// Calculate the size when the string converted to Unicode -UINT UnixCalcStrToUni(char *str) -{ - wchar_t *tmp; - UINT len, tmp_size; - UINT ret; - // Validate arguments - if (str == NULL) - { - return 0; - } - - len = StrLen(str); - tmp_size = len * 5 + 10; - tmp = ZeroMalloc(tmp_size); - UnixStrToUni(tmp, tmp_size, str); - ret = UniStrLen(tmp); - Free(tmp); - - return (ret + 1) * sizeof(wchar_t); -} - -// Convert the strings to Unicode -UINT UnixStrToUni(wchar_t *s, UINT size, char *str) -{ - void *d; - char *inbuf; - size_t insize; - char *outbuf; - char *outbuf_orig; - size_t outsize; - wchar_t *tmp; - // Validate arguments - if (s == NULL || str == NULL) - { - return 0; - } - - d = IconvStrToWide(); - if (d == (void *)-1) - { - UniStrCpy(s, size, L""); - return 0; - } - - inbuf = (char *)str; - insize = StrLen(str) + 1; - outsize = insize * 5 + 10; - outbuf_orig = outbuf = ZeroMalloc(outsize); - - if (iconv((iconv_t)d, (char **)&inbuf, (size_t *)&insize, (char **)&outbuf, (size_t *)&outsize) == (size_t)(-1)) - { - Free(outbuf_orig); - UniStrCpy(s, size, L""); - IconvFree(d); - return 0; - } - - tmp = Utf16ToWide((USHORT *)outbuf_orig); - Free(outbuf_orig); - - UniStrCpy(s, size, tmp); - IconvFree(d); - - Free(tmp); - - return UniStrLen(s); -} - -// Calculate the size when the Unicode converted to string -UINT UnixCalcUniToStr(wchar_t *s) -{ - char *tmp; - UINT tmp_size; - UINT ret; - // Validate arguments - if (s == NULL) - { - return 0; - } - - tmp_size = UniStrLen(s) * 5 + 10; - tmp = ZeroMalloc(tmp_size); - UnixUniToStr(tmp, tmp_size, s); - - ret = StrSize(tmp); - Free(tmp); - - return ret; -} - -// Converted a Unicode string to a string -UINT UnixUniToStr(char *str, UINT size, wchar_t *s) -{ - USHORT *tmp; - char *inbuf; - size_t insize; - char *outbuf; - char *outbuf_orig; - size_t outsize; - void *d; - // Validate arguments - if (str == NULL || s == NULL) - { - return 0; - } - - // Convert a wchar_t string to sequence of 2-bytes first - tmp = WideToUtf16(s); - inbuf = (char *)tmp; - insize = (UniStrLen(s) + 1) * 2; - outsize = insize * 5 + 10; - outbuf_orig = outbuf = ZeroMalloc(outsize); - - d = IconvWideToStr(); - if (d == (void *)-1) - { - StrCpy(str, size, ""); - Free(outbuf); - Free(tmp); - return 0; - } - - if (iconv((iconv_t)d, (char **)&inbuf, (size_t *)&insize, (char **)&outbuf, (size_t *)&outsize) == (size_t)(-1)) - { - Free(outbuf_orig); - IconvFree(d); - StrCpy(str, size, ""); - Free(tmp); - return 0; - } - - StrCpy(str, size, outbuf_orig); - - Free(outbuf_orig); - IconvFree(d); - Free(tmp); - - return StrLen(str); -} - -// Converted the whcar_t to char -void *IconvWideToStrInternal() -{ - return (void *)iconv_open(charset, IsBigEndian() ? "UTF-16BE" : "UTF-16LE"); -} - -// Convert the char to a wchar_t -void *IconvStrToWideInternal() -{ - return (void *)iconv_open(IsBigEndian() ? "UTF-16BE" : "UTF-16LE", charset); -} - -// Close the handle -int IconvFreeInternal(void *d) -{ - iconv_close((iconv_t)d); - return 0; -} - -void *IconvWideToStr() -{ - if (iconv_cache_wide_to_str == (void *)-1) - { - return (void *)-1; - } - - Lock(iconv_lock); - - return iconv_cache_wide_to_str; -} - -void *IconvStrToWide() -{ - if (iconv_cache_str_to_wide == (void *)-1) - { - return (void *)-1; - } - - Lock(iconv_lock); - - return iconv_cache_str_to_wide; -} - -int IconvFree(void *d) -{ - Unlock(iconv_lock); - - return 0; -} - -// Get the character set that is currently used from the environment variable -void GetCurrentCharSet(char *name, UINT size) -{ - char tmp[MAX_SIZE]; - TOKEN_LIST *t; - // Validate arguments - if (name == NULL) - { - return; - } - - Zero(tmp, sizeof(tmp)); - if (GetEnv("LANG", tmp, sizeof(tmp)) == false || IsEmptyStr(tmp)) - { - Zero(tmp, sizeof(tmp)); - if (GetEnv("LOCATION", tmp, sizeof(tmp)) == false || IsEmptyStr(tmp)) - { - StrCpy(tmp, sizeof(tmp), "C"); - } - } - - Trim(tmp); - - t = ParseToken(tmp, "."); - if (t->NumTokens >= 2) - { - StrCpy(name, size, t->Token[1]); - } - else - { - if (t->NumTokens == 1) - { - StrCpy(name, size, t->Token[0]); - } - else - { - StrCpy(name, size, "eucJP"); - } - } - FreeToken(t); - - StrUpper(name); -} - -#endif // OS_UNIX - -// Check whether the specified string is a space -bool UniIsEmptyStr(wchar_t *str) -{ - return IsEmptyUniStr(str); -} -bool IsEmptyUniStr(wchar_t *str) -{ - bool ret; - wchar_t *s; - // Validate arguments - if (str == NULL) - { - return true; - } - - s = UniCopyStr(str); - - UniTrim(s); - if (UniStrLen(s) == 0) - { - ret = true; - } - else - { - ret = false; - } - - Free(s); - - return ret; -} - -// Check whether the specified string is a number -bool UniIsNum(wchar_t *str) -{ - char tmp[MAX_SIZE]; - - // Validate arguments - if (str == NULL) - { - return false; - } - - UniToStrForSingleChars(tmp, sizeof(tmp), str); - - return IsNum(tmp); -} - - -// Empty Unicode token list -UNI_TOKEN_LIST *UniNullToken() -{ - UNI_TOKEN_LIST *ret = ZeroMalloc(sizeof(UNI_TOKEN_LIST)); - ret->Token = ZeroMalloc(0); - - return ret; -} - -// Convert the token list to Unicode token list -UNI_TOKEN_LIST *TokenListToUniTokenList(TOKEN_LIST *src) -{ - UNI_TOKEN_LIST *ret; - UINT i; - // Validate arguments - if (src == NULL) - { - return NULL; - } - - ret = ZeroMalloc(sizeof(UNI_TOKEN_LIST)); - ret->NumTokens = src->NumTokens; - ret->Token = ZeroMalloc(sizeof(wchar_t *) * ret->NumTokens); - - for (i = 0;i < ret->NumTokens;i++) - { - ret->Token[i] = CopyStrToUni(src->Token[i]); - } - - return ret; -} - -// Convert a Unicode token list to a token list -TOKEN_LIST *UniTokenListToTokenList(UNI_TOKEN_LIST *src) -{ - TOKEN_LIST *ret; - UINT i; - // Validate arguments - if (src == NULL) - { - return NULL; - } - - ret = ZeroMalloc(sizeof(TOKEN_LIST)); - ret->NumTokens = src->NumTokens; - ret->Token = ZeroMalloc(sizeof(char *) * ret->NumTokens); - - for (i = 0;i < ret->NumTokens;i++) - { - ret->Token[i] = CopyUniToStr(src->Token[i]); - } - - return ret; -} - -// Unicode string copy -wchar_t *UniCopyStr(wchar_t *str) -{ - return CopyUniStr(str); -} - -// Copy the token list -UNI_TOKEN_LIST *UniCopyToken(UNI_TOKEN_LIST *src) -{ - UNI_TOKEN_LIST *ret; - UINT i; - // Validate arguments - if (src == NULL) - { - return NULL; - } - - ret = ZeroMalloc(sizeof(TOKEN_LIST)); - ret->NumTokens = src->NumTokens; - ret->Token = ZeroMalloc(sizeof(wchar_t *) * ret->NumTokens); - for (i = 0;i < ret->NumTokens;i++) - { - ret->Token[i] = CopyUniStr(src->Token[i]); - } - - return ret; -} - -// Parse the command line string -UNI_TOKEN_LIST *UniParseCmdLine(wchar_t *str) -{ - UNI_TOKEN_LIST *t; - LIST *o; - UINT i, len, wp, mode; - wchar_t c; - wchar_t *tmp; - bool ignore_space = false; - // Validate arguments - if (str == NULL) - { - // There is no token - return UniNullToken(); - } - - o = NewListFast(NULL); - tmp = Malloc(UniStrSize(str) + 32); - - wp = 0; - mode = 0; - - len = UniStrLen(str); - for (i = 0;i < len;i++) - { - c = str[i]; - - switch (mode) - { - case 0: - // Mode to discover the next token - if (c == L' ' || c == L'\t') - { - // Advance to the next character - } - else - { - // Start of the token - if (c == L'\"') - { - if (str[i + 1] == L'\"') - { - // Regarded "" as a single " character - tmp[wp++] = L'\"'; - i++; - } - else - { - // Single "(double-quote) enables the flag to ignore space - ignore_space = true; - } - } - else - { - tmp[wp++] = c; - } - - mode = 1; - } - break; - - case 1: - if (ignore_space == false && (c == L' ' || c == L'\t')) - { - // End of the token - tmp[wp++] = 0; - wp = 0; - - Insert(o, UniCopyStr(tmp)); - mode = 0; - } - else - { - if (c == L'\"') - { - if (str[i + 1] == L'\"') - { - // Regarded "" as a single " character - tmp[wp++] = L'\"'; - i++; - } - else - { - if (ignore_space == false) - { - // Single "(double-quote) enables the flag to ignore space - ignore_space = true; - } - else - { - // Disable the flag to ignore space - ignore_space = false; - } - } - } - else - { - tmp[wp++] = c; - } - } - break; - } - } - - if (wp != 0) - { - tmp[wp++] = 0; - Insert(o, UniCopyStr(tmp)); - } - - Free(tmp); - - t = ZeroMalloc(sizeof(UNI_TOKEN_LIST)); - t->NumTokens = LIST_NUM(o); - t->Token = ZeroMalloc(sizeof(wchar_t *) * t->NumTokens); - for (i = 0;i < t->NumTokens;i++) - { - t->Token[i] = LIST_DATA(o, i); - } - - ReleaseList(o); - - return t; -} - -// Convert Unicode string to 64bit integer -UINT64 UniToInt64(wchar_t *str) -{ - char tmp[MAX_SIZE]; - // Validate arguments - if (str == NULL) - { - return 0; - } - - UniToStrForSingleChars(tmp, sizeof(tmp), str); - - return ToInt64(tmp); -} - -// Convert the UTF string to a Unicode string -UINT UtfToUni(wchar_t *unistr, UINT size, char *utfstr) -{ - wchar_t *tmp; - // Validate arguments - if (unistr == NULL || utfstr == NULL) - { - UniStrCpy(unistr, size, L""); - return 0; - } - - tmp = CopyUtfToUni(utfstr); - - UniStrCpy(unistr, size, tmp); - - Free(tmp); - - return UniStrLen(unistr); -} - -// Copy the UTF-8 string to a Unicode string -wchar_t *CopyUtfToUni(char *utfstr) -{ - UINT size; - wchar_t *ret; - UINT utfstr_len; - // Validate arguments - if (utfstr == NULL) - { - return NULL; - } - - utfstr_len = StrLen(utfstr); - - size = CalcUtf8ToUni((BYTE *)utfstr, utfstr_len); - ret = ZeroMalloc(size + sizeof(wchar_t)); - Utf8ToUni(ret, size, (BYTE *)utfstr, utfstr_len); - - return ret; -} - -// Copy a Unicode string to ANSI string -char *CopyUniToStr(wchar_t *unistr) -{ - char *str; - UINT str_size; - // Validate arguments - if (unistr == NULL) - { - return NULL; - } - - str_size = CalcUniToStr(unistr); - if (str_size == 0) - { - return CopyStr(""); - } - str = Malloc(str_size); - UniToStr(str, str_size, unistr); - - return str; -} - -// Copy an ANSI string to a Unicode string -wchar_t *CopyStrToUni(char *str) -{ - wchar_t *uni; - UINT uni_size; - // Validate arguments - if (str == NULL) - { - return NULL; - } - - uni_size = CalcStrToUni(str); - if (uni_size == 0) - { - return CopyUniStr(L""); - } - uni = Malloc(uni_size); - StrToUni(uni, uni_size, str); - - return uni; -} - -// Copy a Unicode string to UTF-8 string -char *CopyUniToUtf(wchar_t *unistr) -{ - UINT size; - char *ret; - // Validate arguments - if (unistr == NULL) - { - return NULL; - } - - size = CalcUniToUtf8(unistr); - ret = ZeroMalloc(size + sizeof(char)); - - UniToUtf8((char *)ret, size, unistr); - - return ret; -} - -// Copy the Unicode string -wchar_t *CopyUniStr(wchar_t *str) -{ - UINT len; - wchar_t *dst; - // Validate arguments - if (str == NULL) - { - return NULL; - } - - len = UniStrLen(str); - dst = Malloc((len + 1) * sizeof(wchar_t)); - UniStrCpy(dst, 0, str); - - return dst; -} - -// Check whether the string is safe -bool IsSafeUniStr(wchar_t *str) -{ - UINT i, len; - // Validate arguments - if (str == NULL) - { - return false; - } - - len = UniStrLen(str); - for (i = 0;i < len;i++) - { - if (IsSafeUniChar(str[i]) == false) - { - return false; - } - } - if (str[0] == L' ') - { - return false; - } - if (len != 0) - { - if (str[len - 1] == L' ') - { - return false; - } - } - return true; -} - -// Check whether the character is safe -bool IsSafeUniChar(wchar_t c) -{ - UINT i, len; - wchar_t *check_str = - L"ABCDEFGHIJKLMNOPQRSTUVWXYZ" - L"abcdefghijklmnopqrstuvwxyz" - L"0123456789" - L" ()-_#%&."; - - len = UniStrLen(check_str); - for (i = 0;i < len;i++) - { - if (c == check_str[i]) - { - return true; - } - } - return false; -} - -// Convert Unicode string to ANSI string -UINT UniToStr(char *str, UINT size, wchar_t *s) -{ -#ifdef OS_WIN32 - UINT ret; - char *tmp; - UINT new_size; - // Validate arguments - if (s == NULL || str == NULL) - { - return 0; - } - - new_size = CalcUniToStr(s); - if (new_size == 0) - { - if (size >= 1) - { - StrCpy(str, 0, ""); - } - return 0; - } - tmp = Malloc(new_size); - tmp[0] = 0; - wcstombs(tmp, s, new_size); - tmp[new_size - 1] = 0; - ret = StrCpy(str, size, tmp); - Free(tmp); - - return ret; -#else // OS_WIN32 - return UnixUniToStr(str, size, s); -#endif // OS_WIN32 -} - -// Get the required number of bytes to convert Unicode string to the ANSI string -UINT CalcUniToStr(wchar_t *s) -{ -#ifdef OS_WIN32 - UINT ret; - // Validate arguments - if (s == NULL) - { - return 0; - } - - ret = (UINT)wcstombs(NULL, s, UniStrLen(s)); - if (ret == (UINT)-1) - { - return 0; - } - - return ret + 1; -#else // OS_WIN32 - return UnixCalcUniToStr(s); -#endif // OS_WIN32 -} - -// Converted an ANSI string to a Unicode string -UINT StrToUni(wchar_t *s, UINT size, char *str) -{ -#ifdef OS_WIN32 - UINT ret; - wchar_t *tmp; - UINT new_size; - // Validate arguments - if (s == NULL || str == NULL) - { - return 0; - } - - new_size = CalcStrToUni(str); - if (new_size == 0) - { - if (size >= 2) - { - UniStrCpy(s, 0, L""); - } - return 0; - } - tmp = Malloc(new_size); - tmp[0] = 0; - mbstowcs(tmp, str, StrLen(str)); - tmp[(new_size - 1) / sizeof(wchar_t)] = 0; - ret = UniStrCpy(s, size, tmp); - Free(tmp); - - return ret; -#else // OS_WIN32 - return UnixStrToUni(s, size, str); -#endif // OS_WIN32 -} - -// Get the required buffer size for converting an ANSI string to an Unicode string -UINT CalcStrToUni(char *str) -{ -#ifdef OS_WIN32 - UINT ret; - // Validate arguments - if (str == NULL) - { - return 0; - } - - ret = (UINT)mbstowcs(NULL, str, StrLen(str)); - if (ret == (UINT)-1) - { - return 0; - } - - return (ret + 1) * sizeof(wchar_t); -#else // OS_WIN32 - return UnixCalcStrToUni(str); -#endif // OS_WIN32 -} - -// Convert the UTF-8 strings to a Unicode string -UINT Utf8ToUni(wchar_t *s, UINT size, BYTE *u, UINT u_size) -{ - UINT i, wp, num; - // Validate arguments - if (s == NULL || u == NULL) - { - return 0; - } - if (size == 0) - { - size = 0x3fffffff; - } - if (u_size == 0) - { - u_size = StrLen((char *)u); - } - - i = 0; - wp = 0; - num = 0; - while (true) - { - UINT type; - wchar_t c = 0; - BYTE c1, c2; - - type = GetUtf8Type(u, u_size, i); - if (type == 0) - { - break; - } - switch (type) - { - case 1: - c1 = 0; - c2 = u[i]; - break; - case 2: - c1 = (((u[i] & 0x1c) >> 2) & 0x07); - c2 = (((u[i] & 0x03) << 6) & 0xc0) | (u[i + 1] & 0x3f); - break; - case 3: - c1 = ((((u[i] & 0x0f) << 4) & 0xf0)) | (((u[i + 1] & 0x3c) >> 2) & 0x0f); - c2 = (((u[i + 1] & 0x03) << 6) & 0xc0) | (u[i + 2] & 0x3f); - break; - } - i += type; - - if (IsBigEndian()) - { - if (sizeof(wchar_t) == 2) - { - ((BYTE *)&c)[0] = c1; - ((BYTE *)&c)[1] = c2; - } - else - { - ((BYTE *)&c)[2] = c1; - ((BYTE *)&c)[3] = c2; - } - } - else - { - ((BYTE *)&c)[0] = c2; - ((BYTE *)&c)[1] = c1; - } - - if (wp < ((size / sizeof(wchar_t)) - 1)) - { - s[wp++] = c; - num++; - } - else - { - break; - } - } - - if (wp < (size / sizeof(wchar_t))) - { - s[wp++] = 0; - } - - return num; -} - -// Get the buffer size when converted UTF-8 to Unicode -UINT CalcUtf8ToUni(BYTE *u, UINT u_size) -{ - // Validate arguments - if (u == NULL) - { - return 0; - } - if (u_size == 0) - { - u_size = StrLen((char *)u); - } - - return (Utf8Len(u, u_size) + 1) * sizeof(wchar_t); -} - -// Get the number of characters in UTF-8 string -UINT Utf8Len(BYTE *u, UINT size) -{ - UINT i, num; - // Validate arguments - if (u == NULL) - { - return 0; - } - if (size == 0) - { - size = StrLen((char *)u); - } - - i = num = 0; - while (true) - { - UINT type; - - type = GetUtf8Type(u, size, i); - if (type == 0) - { - break; - } - i += type; - num++; - } - - return num; -} - -// Convert an Unicode string to UTF-8 string -UINT UniToUtf8(BYTE *u, UINT size, wchar_t *s) -{ - UINT i, len, type, wp; - // Validate arguments - if (u == NULL || s == NULL) - { - return 0; - } - if (size == 0) - { - size = 0x3fffffff; - } - - len = UniStrLen(s); - wp = 0; - for (i = 0;i < len;i++) - { - BYTE c1, c2; - wchar_t c = s[i]; - - if (IsBigEndian()) - { - if (sizeof(wchar_t) == 2) - { - c1 = ((BYTE *)&c)[0]; - c2 = ((BYTE *)&c)[1]; - } - else - { - c1 = ((BYTE *)&c)[2]; - c2 = ((BYTE *)&c)[3]; - } - } - else - { - c1 = ((BYTE *)&c)[1]; - c2 = ((BYTE *)&c)[0]; - } - - type = GetUniType(s[i]); - switch (type) - { - case 1: - if (wp < size) - { - u[wp++] = c2; - } - break; - case 2: - if (wp < size) - { - u[wp++] = 0xc0 | (((((c1 & 0x07) << 2) & 0x1c)) | (((c2 & 0xc0) >> 6) & 0x03)); - } - if (wp < size) - { - u[wp++] = 0x80 | (c2 & 0x3f); - } - break; - case 3: - if (wp < size) - { - u[wp++] = 0xe0 | (((c1 & 0xf0) >> 4) & 0x0f); - } - if (wp < size) - { - u[wp++] = 0x80 | (((c1 & 0x0f) << 2) & 0x3c) | (((c2 & 0xc0) >> 6) & 0x03); - } - if (wp < size) - { - u[wp++] = 0x80 | (c2 & 0x3f); - } - break; - } - } - if (wp < size) - { - u[wp] = 0; - } - return wp; -} - -// Calculating the length of the string when converting Unicode string to UTF-8 string -UINT CalcUniToUtf8(wchar_t *s) -{ - UINT i, len, size; - // Validate arguments - if (s == NULL) - { - return 0; - } - - size = 0; - len = UniStrLen(s); - for (i = 0;i < len;i++) - { - size += GetUniType(s[i]); - } - - return size; -} - -// Get the number of bytes of a first character of the offset address of the UTF-8 string that starts with s -UINT GetUtf8Type(BYTE *s, UINT size, UINT offset) -{ - // Validate arguments - if (s == NULL) - { - return 0; - } - if ((offset + 1) > size) - { - return 0; - } - if ((s[offset] & 0x80) == 0) - { - // 1 byte - return 1; - } - if ((s[offset] & 0x20) == 0) - { - // 2 bytes - if ((offset + 2) > size) - { - return 0; - } - return 2; - } - // 3 bytes - if ((offset + 3) > size) - { - return 0; - } - return 3; -} - -// Type of the converted character 'c' to UTF-8 (in bytes) -UINT GetUniType(wchar_t c) -{ - BYTE c1, c2; - - if (IsBigEndian()) - { - if (sizeof(wchar_t) == 2) - { - c1 = ((BYTE *)&c)[0]; - c2 = ((BYTE *)&c)[1]; - } - else - { - c1 = ((BYTE *)&c)[2]; - c2 = ((BYTE *)&c)[3]; - } - } - else - { - c1 = ((BYTE *)&c)[1]; - c2 = ((BYTE *)&c)[0]; - } - - if (c1 == 0) - { - if (c2 <= 0x7f) - { - // 1 byte - return 1; - } - else - { - // 2 bytes - return 2; - } - } - if ((c1 & 0xf8) == 0) - { - // 2 bytes - return 2; - } - // 3 bytes - return 3; -} - -// String replacing (case-sensitive) -UINT UniReplaceStr(wchar_t *dst, UINT size, wchar_t *string, wchar_t *old_keyword, wchar_t *new_keyword) -{ - return UniReplaceStrEx(dst, size, string, old_keyword, new_keyword, true); -} - -// Replacement of string -UINT UniReplaceStrEx(wchar_t *dst, UINT size, wchar_t *string, wchar_t *old_keyword, wchar_t *new_keyword, bool case_sensitive) -{ - UINT i, j, num, len_string, len_old, len_new, len_ret, wp; - wchar_t *ret; - // Validate arguments - if (string == NULL || old_keyword == NULL || new_keyword == NULL) - { - return 0; - } - - // Get the length of the string - len_string = UniStrLen(string); - len_old = UniStrLen(old_keyword); - len_new = UniStrLen(new_keyword); - - // Get the final string length - len_ret = UniCalcReplaceStrEx(string, old_keyword, new_keyword, case_sensitive); - // Memory allocation - ret = Malloc((len_ret + 1) * sizeof(wchar_t)); - ret[len_ret] = 0; - - // Search and Replace - i = j = num = wp = 0; - while (true) - { - i = UniSearchStrEx(string, old_keyword, i, case_sensitive); - if (i == INFINITE) - { - Copy(&ret[wp], &string[j], (len_string - j) * sizeof(wchar_t)); - wp += len_string - j; - break; - } - num++; - Copy(&ret[wp], &string[j], (i - j) * sizeof(wchar_t)); - wp += i - j; - Copy(&ret[wp], new_keyword, len_new * sizeof(wchar_t)); - wp += len_new; - i += len_old; - j = i; - } - - // Copy of the search results - UniStrCpy(dst, size, ret); - - // Memory release - Free(ret); - - return num; -} - -// Calculate the length of the result of string replacement -UINT UniCalcReplaceStrEx(wchar_t *string, wchar_t *old_keyword, wchar_t *new_keyword, bool case_sensitive) -{ - UINT i, num; - UINT len_string, len_old, len_new; - // Validate arguments - if (string == NULL || old_keyword == NULL || new_keyword == NULL) - { - return 0; - } - - // Get the length of the string - len_string = UniStrLen(string); - len_old = UniStrLen(old_keyword); - len_new = UniStrLen(new_keyword); - - if (len_old == len_new) - { - return len_string; - } - - // Search process - num = 0; - i = 0; - while (true) - { - i = UniSearchStrEx(string, old_keyword, i, case_sensitive); - if (i == INFINITE) - { - break; - } - i += len_old; - num++; - } - - // Calculation - return len_string + len_new * num - len_old * num; -} - -// Search for a string (distinguish between upper / lower case) -UINT UniSearchStr(wchar_t *string, wchar_t *keyword, UINT start) -{ - return UniSearchStrEx(string, keyword, start, true); -} - -// Return the position of the first found of the keyword in the string -// (Found in first character: returns 0, Not found: returns INFINITE) -UINT UniSearchStrEx(wchar_t *string, wchar_t *keyword, UINT start, bool case_sensitive) -{ - UINT len_string, len_keyword; - UINT i; - wchar_t *cmp_string, *cmp_keyword; - bool found; - // Validate arguments - if (string == NULL || keyword == NULL) - { - return INFINITE; - } - - // Get the length of string - len_string = UniStrLen(string); - if (len_string <= start) - { - // Value of start is invalid - return INFINITE; - } - - // Get the length of the keyword - len_keyword = UniStrLen(keyword); - if (len_keyword == 0) - { - // There is no keyword - return INFINITE; - } - - if (len_string < len_keyword) - { - return INFINITE; - } - - if (len_string == len_keyword) - { - if (case_sensitive) - { - if (UniStrCmp(string, keyword) == 0) - { - return 0; - } - else - { - return INFINITE; - } - } - else - { - if (UniStrCmpi(string, keyword) == 0) - { - return 0; - } - else - { - return INFINITE; - } - } - } - - if (case_sensitive) - { - cmp_string = string; - cmp_keyword = keyword; - } - else - { - cmp_string = Malloc((len_string + 1) * sizeof(wchar_t)); - UniStrCpy(cmp_string, (len_string + 1) * sizeof(wchar_t), string); - cmp_keyword = Malloc((len_keyword + 1) * sizeof(wchar_t)); - UniStrCpy(cmp_keyword, (len_keyword + 1) * sizeof(wchar_t), keyword); - UniStrUpper(cmp_string); - UniStrUpper(cmp_keyword); - } - - // Search - found = false; - for (i = start;i < (len_string - len_keyword + 1);i++) - { - // Compare - if (!wcsncmp(&cmp_string[i], cmp_keyword, len_keyword)) - { - // Found - found = true; - break; - } - } - - if (case_sensitive == false) - { - // Memory release - Free(cmp_keyword); - Free(cmp_string); - } - - if (found == false) - { - return INFINITE; - } - return i; -} - -// Release of the token list -void UniFreeToken(UNI_TOKEN_LIST *tokens) -{ - UINT i; - if (tokens == NULL) - { - return; - } - for (i = 0;i < tokens->NumTokens;i++) - { - Free(tokens->Token[i]); - } - Free(tokens->Token); - Free(tokens); -} - -// Parse token for UNIX -UNI_TOKEN_LIST *UnixUniParseToken(wchar_t *src, wchar_t *separator) -{ - UNI_TOKEN_LIST *ret; - TOKEN_LIST *t; - char *src_s; - char *sep_s; - - // Validate arguments - if (src == NULL || separator == NULL) - { - ret = ZeroMalloc(sizeof(UNI_TOKEN_LIST)); - ret->Token = ZeroMalloc(0); - return ret; - } - - src_s = CopyUniToStr(src); - sep_s = CopyUniToStr(separator); - - t = ParseToken(src_s, sep_s); - - ret = TokenListToUniTokenList(t); - FreeToken(t); - - Free(src_s); - Free(sep_s); - - return ret; -} - -// Get a standard token delimiter -wchar_t *UniDefaultTokenSplitChars() -{ - return L" ,\t\r\n"; -} - -// Check whether the specified character is in the string -bool UniIsCharInStr(wchar_t *str, wchar_t c) -{ - UINT i, len; - // Validate arguments - if (str == NULL) - { - return false; - } - - len = UniStrLen(str); - for (i = 0;i < len;i++) - { - if (str[i] == c) - { - return true; - } - } - - return false; -} - -// Cut out the token from the string (not ignore the blanks between delimiters) -UNI_TOKEN_LIST *UniParseTokenWithNullStr(wchar_t *str, wchar_t *split_chars) -{ - LIST *o; - UINT i, len; - BUF *b; - wchar_t zero = 0; - UNI_TOKEN_LIST *t; - // Validate arguments - if (str == NULL) - { - return UniNullToken(); - } - if (split_chars == NULL) - { - split_chars = UniDefaultTokenSplitChars(); - } - - b = NewBuf(); - o = NewListFast(NULL); - - len = UniStrLen(str); - - for (i = 0;i < (len + 1);i++) - { - wchar_t c = str[i]; - bool flag = UniIsCharInStr(split_chars, c); - - if (c == L'\0') - { - flag = true; - } - - if (flag == false) - { - WriteBuf(b, &c, sizeof(wchar_t)); - } - else - { - WriteBuf(b, &zero, sizeof(wchar_t)); - - Insert(o, UniCopyStr((wchar_t *)b->Buf)); - ClearBuf(b); - } - } - - t = ZeroMalloc(sizeof(UNI_TOKEN_LIST)); - t->NumTokens = LIST_NUM(o); - t->Token = ZeroMalloc(sizeof(wchar_t *) * t->NumTokens); - - for (i = 0;i < t->NumTokens;i++) - { - t->Token[i] = LIST_DATA(o, i); - } - - ReleaseList(o); - FreeBuf(b); - - return t; -} - -// Cut out the token from string (Ignore blanks between delimiters) -UNI_TOKEN_LIST *UniParseTokenWithoutNullStr(wchar_t *str, wchar_t *split_chars) -{ - LIST *o; - UINT i, len; - bool last_flag; - BUF *b; - wchar_t zero = 0; - UNI_TOKEN_LIST *t; - // Validate arguments - if (str == NULL) - { - return UniNullToken(); - } - if (split_chars == NULL) - { - split_chars = UniDefaultTokenSplitChars(); - } - - b = NewBuf(); - o = NewListFast(NULL); - - len = UniStrLen(str); - last_flag = false; - - for (i = 0;i < (len + 1);i++) - { - wchar_t c = str[i]; - bool flag = UniIsCharInStr(split_chars, c); - - if (c == L'\0') - { - flag = true; - } - - if (flag == false) - { - WriteBuf(b, &c, sizeof(wchar_t)); - } - else - { - if (last_flag == false) - { - WriteBuf(b, &zero, sizeof(wchar_t)); - - if ((UniStrLen((wchar_t *)b->Buf)) != 0) - { - Insert(o, UniCopyStr((wchar_t *)b->Buf)); - } - ClearBuf(b); - } - } - - last_flag = flag; - } - - t = ZeroMalloc(sizeof(UNI_TOKEN_LIST)); - t->NumTokens = LIST_NUM(o); - t->Token = ZeroMalloc(sizeof(wchar_t *) * t->NumTokens); - - for (i = 0;i < t->NumTokens;i++) - { - t->Token[i] = LIST_DATA(o, i); - } - - ReleaseList(o); - FreeBuf(b); - - return t; -} - -// Parse the token -UNI_TOKEN_LIST *UniParseToken(wchar_t *src, wchar_t *separator) -{ - // 2020/7/20 remove strtok by dnobori - return UniParseTokenWithoutNullStr(src, separator); -} - -// Get a line from standard input -bool UniGetLine(wchar_t *str, UINT size) -{ -#ifdef OS_WIN32 - return UniGetLineWin32(str, size); -#else // OS_WIN32 - return UniGetLineUnix(str, size); -#endif // OS_WIN32 -} -void AnsiGetLineUnix(char *str, UINT size) -{ - // Validate arguments - if (str == NULL) - { - char tmp[MAX_SIZE]; - fgets(tmp, sizeof(tmp) - 1, stdin); - return; - } - if (size <= 1) - { - return; - } - - // Read data from standard input - fgets(str, (int)(size - 1), stdin); - - TrimCrlf(str); -} -bool UniGetLineUnix(wchar_t *str, UINT size) -{ - char *str_a; - UINT str_a_size = size; - if (str == NULL || size < sizeof(wchar_t)) - { - return false; - } - if (str_a_size >= 0x7fffffff) - { - str_a_size = MAX_SIZE; - } - str_a_size *= 2; - - str_a = ZeroMalloc(str_a_size); - - AnsiGetLineUnix(str_a, str_a_size); - - StrToUni(str, size, str_a); - - Free(str_a); - - return true; -} -bool UniGetLineWin32(wchar_t *str, UINT size) -{ - bool ret = false; - -#ifdef OS_WIN32 - ret = Win32InputW(str, size); -#endif // OS_WIN32 - - return ret; -} - -// Remove '\r\n' at the end -void UniTrimCrlf(wchar_t *str) -{ - UINT len; - // Validate arguments - if (str == NULL) - { - return; - } - len = UniStrLen(str); - if (len == 0) - { - return; - } - - if (str[len - 1] == L'\n') - { - if (len >= 2 && str[len - 2] == L'\r') - { - str[len - 2] = 0; - } - str[len - 1] = 0; - } - else if(str[len - 1] == L'\r') - { - str[len - 1] = 0; - } -} - -// Remove white space of the both side of the string -void UniTrim(wchar_t *str) -{ - // Validate arguments - if (str == NULL) - { - return; - } - - UniTrimLeft(str); - UniTrimRight(str); -} - -// Remove white space on the right side of the string -void UniTrimRight(wchar_t *str) -{ - wchar_t *buf, *tmp; - UINT len, i, wp, wp2; - bool flag; - // Validate arguments - if (str == NULL) - { - return; - } - len = UniStrLen(str); - if (len == 0) - { - return; - } - if (str[len - 1] != L' ' && str[len - 1] != L'\t') - { - return; - } - - buf = Malloc((len + 1) * sizeof(wchar_t)); - tmp = Malloc((len + 1) * sizeof(wchar_t)); - flag = false; - wp = wp2 = 0; - for (i = 0;i < len;i++) - { - if (str[i] != L' ' && str[i] != L'\t') - { - Copy(&buf[wp], tmp, wp2 * sizeof(wchar_t)); - wp += wp2; - wp2 = 0; - buf[wp++] = str[i]; - } - else - { - tmp[wp2++] = str[i]; - } - } - buf[wp] = 0; - UniStrCpy(str, 0, buf); - Free(buf); - Free(tmp); -} - -// Remove white space from the left side of the string -void UniTrimLeft(wchar_t *str) -{ - wchar_t *buf; - UINT len, i, wp; - bool flag; - // Validate arguments - if (str == NULL) - { - return; - } - len = UniStrLen(str); - if (len == 0) - { - return; - } - if (str[0] != L' ' && str[0] != L'\t') - { - return; - } - - buf = Malloc((len + 1) * sizeof(wchar_t)); - flag = false; - wp = 0; - for (i = 0;i < len;i++) - { - if (str[i] != L' ' && str[i] != L'\t') - { - flag = true; - } - if (flag) - { - buf[wp++] = str[i]; - } - } - buf[wp] = 0; - UniStrCpy(str, 0, buf); - Free(buf); -} - -// Convert a signed integer to a string -void UniToStri(wchar_t *str, int i) -{ - UniFormat(str, 0, L"%i", i); -} - -// Convert an integer to a string -void UniToStru(wchar_t *str, UINT i) -{ - UniFormat(str, 0, L"%u", i); -} - -// Convert a string to an integer -UINT UniToInt(wchar_t *str) -{ - char tmp[128]; - // Validate arguments - if (str == NULL) - { - return 0; - } - - UniToStrForSingleChars(tmp, sizeof(tmp), str); - - return ToInti(tmp); -} - -// Convert only single-byte characters in the Unicode string to a char string -void UniToStrForSingleChars(char *dst, UINT dst_size, wchar_t *src) -{ - UINT i; - // Validate arguments - if (dst == NULL || src == NULL) - { - return; - } - - for (i = 0;i < UniStrLen(src) + 1;i++) - { - wchar_t s = src[i]; - char d; - - if (s == 0) - { - d = 0; - } - else if (s <= 0xff) - { - d = (char)s; - } - else - { - d = ' '; - } - - dst[i] = d; - } -} - -// Get lines from a string -UNI_TOKEN_LIST *UniGetLines(wchar_t *str) -{ - UINT i, len; - BUF *b = NULL; - LIST *o; - UNI_TOKEN_LIST *ret; - // Validate arguments - if (str == NULL) - { - return UniNullToken(); - } - - o = NewListFast(NULL); - - len = UniStrLen(str); - - b = NewBuf(); - - for (i = 0;i < len;i++) - { - wchar_t c = str[i]; - bool f = false; - - if (c == L'\r') - { - if (str[i + 1] == L'\n') - { - i++; - } - f = true; - } - else if (c == L'\n') - { - f = true; - } - - if (f) - { - wchar_t zero = 0; - wchar_t *s; - WriteBuf(b, &zero, sizeof(wchar_t)); - - s = (wchar_t *)b->Buf; - - Add(o, UniCopyStr(s)); - - ClearBuf(b); - } - else - { - WriteBuf(b, &c, sizeof(wchar_t)); - } - } - - if (true) - { - wchar_t zero = 0; - wchar_t *s; - WriteBuf(b, &zero, sizeof(wchar_t)); - - s = (wchar_t *)b->Buf; - - Add(o, UniCopyStr(s)); - - ClearBuf(b); - } - - FreeBuf(b); - - ret = UniListToTokenList(o); - - UniFreeStrList(o); - - return ret; -} - -// Display the string on the screen -void UniPrintStr(wchar_t *string) -{ - // Validate arguments - if (string == NULL) - { - return; - } - -#ifdef OS_UNIX - if (true) - { - char *str = CopyUniToStr(string); - - if (str != NULL) - { - fputs(str, stdout); - } - else - { - fputs("", stdout); - } - - Free(str); - } -#else // OS_UNIX - Win32PrintW(string); -#endif // OS_UNIX -} - -// Display a string with arguments -void UniPrintArgs(wchar_t *fmt, va_list args) -{ - wchar_t *str; - // Validate arguments - if (fmt == NULL) - { - return; - } - - str = InternalFormatArgs(fmt, args, false); - - UniPrintStr(str); - - Free(str); -} - -// Display the string -void UniPrint(wchar_t *fmt, ...) -{ - va_list args; - // Validate arguments - if (fmt == NULL) - { - return; - } - - va_start(args, fmt); - UniPrintArgs(fmt, args); - va_end(args); -} - -// Display debug string with arguments -void UniDebugArgs(wchar_t *fmt, va_list args) -{ - if (g_debug == false) - { - return; - } - - UniPrintArgs(fmt, args); -} - -// Display a debug string -void UniDebug(wchar_t *fmt, ...) -{ - va_list args; - // Validate arguments - if (fmt == NULL) - { - return; - } - - va_start(args, fmt); - UniDebugArgs(fmt, args); - va_end(args); -} - -// Format a string (argument list) -void UniFormatArgs(wchar_t *buf, UINT size, wchar_t *fmt, va_list args) -{ - wchar_t *ret; - // Validate arguments - if (buf == NULL || fmt == NULL) - { - return; - } - if (size == 1) - { - return; - } - - // KS - KS_INC(KS_FORMAT_COUNT); - - ret = InternalFormatArgs(fmt, args, false); - - UniStrCpy(buf, size, ret); - - Free(ret); -} - -// Format the string, and copy it -wchar_t *CopyUniFormat(wchar_t *fmt, ...) -{ - wchar_t *ret, *str; - UINT size; - va_list args; - // Validate arguments - if (fmt == NULL) - { - return NULL; - } - - size = MAX(UniStrSize(fmt) * 10, MAX_SIZE * 10); - str = Malloc(size); - - va_start(args, fmt); - UniFormatArgs(str, size, fmt, args); - - ret = UniCopyStr(str); - Free(str); - va_end(args); - - return ret; -} - -// Format the string -void UniFormat(wchar_t *buf, UINT size, wchar_t *fmt, ...) -{ - va_list args; - // Validate arguments - if (buf == NULL || fmt == NULL) - { - return; - } - - va_start(args, fmt); - UniFormatArgs(buf, size, fmt, args); - va_end(args); -} - -// Flexible string comparison -int UniSoftStrCmp(wchar_t *str1, wchar_t *str2) -{ - UINT ret; - wchar_t *tmp1, *tmp2; - // Validate arguments - if (str1 == NULL && str2 == NULL) - { - return 0; - } - if (str1 == NULL) - { - return 1; - } - if (str2 == NULL) - { - return -1; - } - - tmp1 = CopyUniStr(str1); - tmp2 = CopyUniStr(str2); - - UniTrim(tmp1); - UniTrim(tmp2); - - ret = UniStrCmpi(tmp1, tmp2); - - Free(tmp1); - Free(tmp2); - - return ret; -} - -// Compare the strings in case-insensitive mode -int UniStrCmpi(wchar_t *str1, wchar_t *str2) -{ - UINT i; - // Validate arguments - if (str1 == NULL && str2 == NULL) - { - return 0; - } - if (str1 == NULL) - { - return 1; - } - if (str2 == NULL) - { - return -1; - } - - // String comparison - i = 0; - while (true) - { - wchar_t c1, c2; - c1 = UniToUpper(str1[i]); - c2 = UniToUpper(str2[i]); - if (c1 > c2) - { - return 1; - } - else if (c1 < c2) - { - return -1; - } - if (str1[i] == 0 || str2[i] == 0) - { - return 0; - } - i++; - } -} - -// Compare the string -int UniStrCmp(wchar_t *str1, wchar_t *str2) -{ - // Validate arguments - if (str1 == NULL && str2 == NULL) - { - return 0; - } - if (str1 == NULL) - { - return 1; - } - if (str2 == NULL) - { - return -1; - } - - return wcscmp(str1, str2); -} - -// Uncapitalize the string -void UniStrLower(wchar_t *str) -{ - UINT i, len; - // Validate arguments - if (str == NULL) - { - return; - } - - len = UniStrLen(str); - for (i = 0;i < len;i++) - { - str[i] = UniToLower(str[i]); - } -} - -// Capitalize the string -void UniStrUpper(wchar_t *str) -{ - UINT i, len; - // Validate arguments - if (str == NULL) - { - return; - } - - len = UniStrLen(str); - for (i = 0;i < len;i++) - { - str[i] = UniToUpper(str[i]); - } -} - -// Uncapitalize a character -wchar_t UniToLower(wchar_t c) -{ - if (c >= L'A' && c <= L'Z') - { - c += L'a' - L'A'; - } - - return c; -} - -// Capitalize a character -wchar_t UniToUpper(wchar_t c) -{ - if (c >= L'a' && c <= L'z') - { - c -= L'a' - L'A'; - } - - return c; -} - -// String concatenation -UINT UniStrCat(wchar_t *dst, UINT size, wchar_t *src) -{ - UINT len1, len2, len_test; - // Validate arguments - if (dst == NULL || src == NULL) - { - return 0; - } - if (size != 0 && size < sizeof(wchar_t)) - { - return 0; - } - if (size == sizeof(wchar_t)) - { - wcscpy(dst, L""); - return 0; - } - if (size == 0) - { - // Ignore the length - size = 0x3fffffff; - } - - len1 = UniStrLen(dst); - len2 = UniStrLen(src); - len_test = len1 + len2 + 1; - if (len_test > (size / sizeof(wchar_t))) - { - if (len2 <= (len_test - (size / sizeof(wchar_t)))) - { - return 0; - } - len2 -= len_test - (size / sizeof(wchar_t)); - } - Copy(&dst[len1], src, len2 * sizeof(wchar_t)); - dst[len1 + len2] = 0; - - return len1 + len2; -} - -// String copy -UINT UniStrCpy(wchar_t *dst, UINT size, wchar_t *src) -{ - UINT len; - // Validate arguments - if (dst == NULL || src == NULL) - { - if (src == NULL && dst != NULL) - { - if (size >= sizeof(wchar_t)) - { - dst[0] = L'\0'; - } - } - return 0; - } - if (dst == src) - { - return UniStrLen(src); - } - if (size != 0 && size < sizeof(wchar_t)) - { - return 0; - } - if (size == sizeof(wchar_t)) - { - wcscpy(dst, L""); - return 0; - } - if (size == 0) - { - // Ignore the length - size = 0x3fffffff; - } - - // Check the length - len = UniStrLen(src); - if (len <= (size / sizeof(wchar_t) - 1)) - { - Copy(dst, src, (len + 1) * sizeof(wchar_t)); - } - else - { - len = size / sizeof(wchar_t) - 1; - Copy(dst, src, len * sizeof(wchar_t)); - dst[len] = 0; - } - - return len; -} - -// Get the buffer size needed to store the string -UINT UniStrSize(wchar_t *str) -{ - // Validate arguments - if (str == NULL) - { - return 0; - } - - return (UniStrLen(str) + 1) * sizeof(wchar_t); -} - -// Get the length of the string -UINT UniStrLen(wchar_t *str) -{ - UINT i; - // Validate arguments - if (str == NULL) - { - return 0; - } - - i = 0; - while (true) - { - if (str[i] == 0) - { - break; - } - i++; - } - - return i; -} - +// SoftEther VPN Source Code - Developer Edition Master Branch +// Mayaqua Kernel + + +// Internat.c +// String conversion library for internationalization + +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +extern LOCK *token_lock; +static char charset[MAX_SIZE] = "EUCJP"; +static LOCK *iconv_lock = NULL; +void *iconv_cache_wide_to_str = 0; +void *iconv_cache_str_to_wide = 0; + +// Initialize the string +void ClearUniStr(wchar_t *str, UINT str_size) +{ + UniStrCpy(str, str_size, L""); +} + +// Examine whether the string contains the specified character +bool UniInChar(wchar_t *string, wchar_t c) +{ + UINT i, len; + // Validate arguments + if (string == NULL) + { + return false; + } + + len = UniStrLen(string); + + for (i = 0;i < len;i++) + { + if (string[i] == c) + { + return true; + } + } + + return false; +} + +// Check whether the string is included +bool UniInStr(wchar_t *str, wchar_t *keyword) +{ + return UniInStrEx(str, keyword, false); +} +bool UniInStrEx(wchar_t *str, wchar_t *keyword, bool case_sensitive) +{ + // Validate arguments + if (UniIsEmptyStr(str) || UniIsEmptyStr(keyword)) + { + return false; + } + + if (UniSearchStrEx(str, keyword, 0, case_sensitive) == INFINITE) + { + return false; + } + + return true; +} + +// Convert to binary data +BUF *UniStrToBin(wchar_t *str) +{ + char *str_a = CopyUniToStr(str); + BUF *ret; + + ret = StrToBin(str_a); + + Free(str_a); + + return ret; +} + +// Check whether the character is safe +bool UniIsSafeChar(wchar_t c) +{ + UINT i, len; + wchar_t *check_str = + L"ABCDEFGHIJKLMNOPQRSTUVWXYZ" + L"abcdefghijklmnopqrstuvwxyz" + L"0123456789" + L" ()-_#%&."; + + len = UniStrLen(check_str); + for (i = 0;i < len;i++) + { + if (c == check_str[i]) + { + return true; + } + } + return false; +} + +// Convert a string list to a token list +UNI_TOKEN_LIST *UniListToTokenList(LIST *o) +{ + UINT i; + UNI_TOKEN_LIST *t; + // Validate arguments + if (o == NULL) + { + return NULL; + } + + t = ZeroMalloc(sizeof(UNI_TOKEN_LIST)); + t->NumTokens = LIST_NUM(o); + t->Token = ZeroMalloc(sizeof(wchar_t *) * t->NumTokens); + for (i = 0;i < LIST_NUM(o);i++) + { + t->Token[i] = UniCopyStr(LIST_DATA(o, i)); + } + + return t; +} + +// Free the string list +void UniFreeStrList(LIST *o) +{ + UINT i; + // Validate arguments + if (o == NULL) + { + return; + } + + for (i = 0;i < LIST_NUM(o);i++) + { + wchar_t *s = LIST_DATA(o, i); + Free(s); + } + + ReleaseList(o); +} + +// Normalize the line breaks +wchar_t *UniNormalizeCrlf(wchar_t *str) +{ + wchar_t *ret; + UINT ret_size, i, len, wp; + // Validate arguments + if (str == NULL) + { + return NULL; + } + + len = UniStrLen(str); + ret_size = sizeof(wchar_t) * (len + 32) * 2; + ret = Malloc(ret_size); + + wp = 0; + + for (i = 0;i < len;i++) + { + wchar_t c = str[i]; + + switch (c) + { + case L'\r': + if (str[i + 1] == L'\n') + { + i++; + } + ret[wp++] = L'\r'; + ret[wp++] = L'\n'; + break; + + case L'\n': + ret[wp++] = L'\r'; + ret[wp++] = L'\n'; + break; + + default: + ret[wp++] = c; + break; + } + } + + ret[wp++] = 0; + + return ret; +} + +// Check whether str ends with the key +bool UniEndWith(wchar_t *str, wchar_t *key) +{ + UINT str_len; + UINT key_len; + // Validate arguments + if (str == NULL || key == NULL) + { + return false; + } + + // Comparison + str_len = UniStrLen(str); + key_len = UniStrLen(key); + if (str_len < key_len) + { + return false; + } + + if (UniStrCmpi(str + (str_len - key_len), key) == 0) + { + return true; + } + else + { + return false; + } +} + +// Check whether str starts with the key +bool UniStartWith(wchar_t *str, wchar_t *key) +{ + UINT str_len; + UINT key_len; + wchar_t *tmp; + bool ret; + // Validate arguments + if (str == NULL || key == NULL) + { + return false; + } + + // Comparison + str_len = UniStrLen(str); + key_len = UniStrLen(key); + if (str_len < key_len) + { + return false; + } + if (str_len == 0 || key_len == 0) + { + return false; + } + tmp = CopyUniStr(str); + tmp[key_len] = 0; + + if (UniStrCmpi(tmp, key) == 0) + { + ret = true; + } + else + { + ret = false; + } + + Free(tmp); + + return ret; +} + +// Convert the integer to a comma-separated string +void UniToStr3(wchar_t *str, UINT size, UINT64 value) +{ + char tmp[MAX_SIZE]; + // Validate arguments + if (str == NULL) + { + return; + } + + ToStr3(tmp, sizeof(tmp), value); + + StrToUni(str, size, tmp); +} + +// Format of the string (internal function) +wchar_t *InternalFormatArgs(wchar_t *fmt, va_list args, bool ansi_mode) +{ + UINT i, len; + wchar_t *tmp; + UINT tmp_size; + LIST *o; + UINT mode = 0; + UINT wp; + UINT total_size; + wchar_t *ret; + // Validate arguments + if (fmt == NULL) + { + return NULL; + } + + len = UniStrLen(fmt); + tmp_size = UniStrSize(fmt); + tmp = Malloc(tmp_size); + + o = NewListFast(NULL); + + mode = 0; + + wp = 0; + + for (i = 0;i < len;i++) + { + wchar_t c = fmt[i]; + + if (mode == 0) + { + // Normal character mode + switch (c) + { + case L'%': + // The start of the format specification + if (fmt[i + 1] == L'%') + { + // If the next character is also '%', output a '%' simply + i++; + tmp[wp++] = c; + } + else + { + // Shift the state if the next character is not a '%' + mode = 1; + tmp[wp++] = 0; + wp = 0; + Add(o, CopyUniStr(tmp)); + tmp[wp++] = c; + } + break; + default: + // Ordinary character + tmp[wp++] = c; + break; + } + } + else + { + char *tag; + char dst[MAX_SIZE]; + wchar_t *target_str; + wchar_t *padding_str; + bool left_padding; + UINT target_str_len; + UINT total_len; + wchar_t *output_str; + UINT padding; + // Formatting mode + switch (c) + { + case L'c': + case L'C': + case L'd': + case L'i': + case L'o': + case L'u': + case L'x': + case L'X': + // int type + tmp[wp++] = c; + tmp[wp++] = 0; + tag = CopyUniToStr(tmp); + + #ifdef OS_WIN32 + ReplaceStrEx(tag, 0, tag, "ll", "I64", false); + #else // OS_WIN32 + ReplaceStrEx(tag, 0, tag, "I64", "ll", false); + #endif // OS_WIN32 + + if ((UniStrLen(tmp) >= 5 && tmp[UniStrLen(tmp) - 4] == L'I' && + tmp[UniStrLen(tmp) - 3] == L'6' && + tmp[UniStrLen(tmp) - 2] == L'4') || + ( + UniStrLen(tmp) >= 4 && tmp[UniStrLen(tmp) - 3] == L'l' && + tmp[UniStrLen(tmp) - 2] == L'l')) + { + #ifdef OS_WIN32 + _snprintf(dst, sizeof(dst), tag, va_arg(args, UINT64)); + #else // OS_WIN32 + snprintf(dst, sizeof(dst), tag, va_arg(args, UINT64)); + #endif // OS_WIN32 + } + else + { + #ifdef OS_WIN32 + _snprintf(dst, sizeof(dst), tag, va_arg(args, int)); + #else // OS_WIN32 + snprintf(dst, sizeof(dst), tag, va_arg(args, int)); + #endif // OS_WIN32 + } + + Free(tag); + Add(o, CopyStrToUni(dst)); + + wp = 0; + mode = 0; + break; + case L'e': + case L'E': + case L'f': + case L'g': + case L'G': + // Double type + tmp[wp++] = c; + tmp[wp++] = 0; + tag = CopyUniToStr(tmp); + + #ifdef OS_WIN32 + _snprintf(dst, sizeof(dst), tag, va_arg(args, double)); + #else // OS_WIN32 + snprintf(dst, sizeof(dst), tag, va_arg(args, double)); + #endif // OS_WIN32 + + Free(tag); + Add(o, CopyStrToUni(dst)); + + wp = 0; + mode = 0; + break; + case L'n': + case L'p': + // Pointer type + tmp[wp++] = c; + tmp[wp++] = 0; + tag = ZeroMalloc(UniStrSize(tmp) + 32); + UniToStr(tag, 0, tmp); + + #ifdef OS_WIN32 + _snprintf(dst, sizeof(dst), tag, va_arg(args, void *)); + #else // OS_WIN32 + snprintf(dst, sizeof(dst), tag, va_arg(args, void *)); + #endif // OS_WIN32 + + Free(tag); + Add(o, CopyStrToUni(dst)); + + wp = 0; + mode = 0; + break; + case L'r': + case L'R': + // IP address type + tmp[wp++] = c; + tmp[wp++] = 0; + + Zero(dst, sizeof(dst)); + IPToStr(dst, sizeof(dst), va_arg(args, void *)); + + Add(o, CopyStrToUni(dst)); + + wp = 0; + mode = 0; + break; + + case L's': + case L'S': + // String type + tmp[wp++] = c; + tmp[wp++] = 0; + + if (ansi_mode == false) + { + if (c == L'S') + { + c = L's'; + } + else + { + c = L'S'; + } + } + + if (c == L's') + { + target_str = CopyStrToUni(va_arg(args, char *)); + } + else + { + target_str = CopyUniStr(va_arg(args, wchar_t *)); + } + + if (target_str == NULL) + { + target_str = CopyUniStr(L"(null)"); + } + + padding = 0; + left_padding = false; + if (tmp[1] == L'-') + { + // Left aligned + if (UniStrLen(tmp) >= 3) + { + padding = UniToInt(&tmp[2]); + } + left_padding = true; + } + else + { + // Right aligned + if (UniStrLen(tmp) >= 2) + { + padding = UniToInt(&tmp[1]); + } + } + + target_str_len = UniStrWidth(target_str); + + if (padding > target_str_len) + { + UINT len = padding - target_str_len; + UINT i; + padding_str = ZeroMalloc(sizeof(wchar_t) * (len + 1)); + for (i = 0;i < len;i++) + { + padding_str[i] = L' '; + } + } + else + { + padding_str = ZeroMalloc(sizeof(wchar_t)); + } + + total_len = sizeof(wchar_t) * (UniStrLen(padding_str) + UniStrLen(target_str) + 1); + output_str = ZeroMalloc(total_len); + output_str[0] = 0; + + if (left_padding == false) + { + UniStrCat(output_str, total_len, padding_str); + } + UniStrCat(output_str, total_len, target_str); + if (left_padding) + { + UniStrCat(output_str, total_len, padding_str); + } + + Add(o, output_str); + + Free(target_str); + Free(padding_str); + + wp = 0; + mode = 0; + break; + default: + // Normal string + tmp[wp++] = c; + break; + } + } + } + tmp[wp++] = 0; + wp = 0; + + if (UniStrLen(tmp) >= 1) + { + Add(o, CopyUniStr(tmp)); + } + + total_size = sizeof(wchar_t); + for (i = 0;i < LIST_NUM(o);i++) + { + wchar_t *s = LIST_DATA(o, i); + total_size += UniStrLen(s) * sizeof(wchar_t); + } + + ret = ZeroMalloc(total_size); + for (i = 0;i < LIST_NUM(o);i++) + { + wchar_t *s = LIST_DATA(o, i); + UniStrCat(ret, total_size, s); + Free(s); + } + + ReleaseList(o); + + Free(tmp); + + return ret; +} + +// Get the width of the string +UINT UniStrWidth(wchar_t *str) +{ + UINT i, len, ret; + // Validate arguments + if (str == NULL) + { + return 0; + } + + ret = 0; + len = UniStrLen(str); + for (i = 0;i < len;i++) + { + if (str[i] <= 255) + { + ret++; + } + else + { + ret += 2; + } + } + return ret; +} + +// Convert string of 2 byte/character to wchar_t of 4 byte/character +wchar_t *Utf16ToWide(USHORT *str) +{ + wchar_t *ret; + UINT len, i; + // Validate arguments + if (str == NULL) + { + return NULL; + } + + len = 0; + while (true) + { + if (str[len] == 0) + { + break; + } + len++; + } + + ret = Malloc((len + 1) * sizeof(wchar_t)); + for (i = 0;i < len + 1;i++) + { + ret[i] = (wchar_t)str[i]; + } + + return ret; +} + +// Convert wchar_t string of 4 byte/character to string of 2 byte/character +USHORT *WideToUtf16(wchar_t *str) +{ + USHORT *ret; + UINT len; + UINT ret_size; + UINT i; + // Validate arguments + if (str == NULL) + { + return NULL; + } + + len = UniStrLen(str); + + ret_size = (len + 1) * 2; + ret = Malloc(ret_size); + + for (i = 0;i < len + 1;i++) + { + ret[i] = (USHORT)str[i]; + } + + return ret; +} + +// Initialization of the International Library +void InitInternational() +{ +#ifdef OS_UNIX + void *d; + + if (iconv_lock != NULL) + { + return; + } + + GetCurrentCharSet(charset, sizeof(charset)); + d = IconvWideToStrInternal(); + if (d == (void *)-1) + { +#if defined (UNIX_MACOS) || defined (UNIX_LINUX_MUSL) + StrCpy(charset, sizeof(charset), "utf-8"); +#else // defined (UNIX_MACOS) || defined (UNIX_LINUX_MUSL) + StrCpy(charset, sizeof(charset), "EUCJP"); +#endif // defined (UNIX_MACOS) || defined (UNIX_LINUX_MUSL) + d = IconvWideToStrInternal(); + if (d == (void *)-1) + { + StrCpy(charset, sizeof(charset), "US"); + } + else + { + IconvFreeInternal(d); + } + } + else + { + IconvFreeInternal(d); + } + + iconv_lock = NewLockMain(); + + iconv_cache_wide_to_str = IconvWideToStrInternal(); + iconv_cache_str_to_wide = IconvStrToWideInternal(); +#endif // OS_UNIX +} + +// Release of the International Library +void FreeInternational() +{ +#ifdef OS_UNIX +#endif // OS_UNIX +} + +#ifdef OS_UNIX + +// Calculate the size when the string converted to Unicode +UINT UnixCalcStrToUni(char *str) +{ + wchar_t *tmp; + UINT len, tmp_size; + UINT ret; + // Validate arguments + if (str == NULL) + { + return 0; + } + + len = StrLen(str); + tmp_size = len * 5 + 10; + tmp = ZeroMalloc(tmp_size); + UnixStrToUni(tmp, tmp_size, str); + ret = UniStrLen(tmp); + Free(tmp); + + return (ret + 1) * sizeof(wchar_t); +} + +// Convert the strings to Unicode +UINT UnixStrToUni(wchar_t *s, UINT size, char *str) +{ + void *d; + char *inbuf; + size_t insize; + char *outbuf; + char *outbuf_orig; + size_t outsize; + wchar_t *tmp; + // Validate arguments + if (s == NULL || str == NULL) + { + return 0; + } + + d = IconvStrToWide(); + if (d == (void *)-1) + { + UniStrCpy(s, size, L""); + return 0; + } + + inbuf = (char *)str; + insize = StrLen(str) + 1; + outsize = insize * 5 + 10; + outbuf_orig = outbuf = ZeroMalloc(outsize); + + if (iconv((iconv_t)d, (char **)&inbuf, (size_t *)&insize, (char **)&outbuf, (size_t *)&outsize) == (size_t)(-1)) + { + Free(outbuf_orig); + UniStrCpy(s, size, L""); + IconvFree(d); + return 0; + } + + tmp = Utf16ToWide((USHORT *)outbuf_orig); + Free(outbuf_orig); + + UniStrCpy(s, size, tmp); + IconvFree(d); + + Free(tmp); + + return UniStrLen(s); +} + +// Calculate the size when the Unicode converted to string +UINT UnixCalcUniToStr(wchar_t *s) +{ + char *tmp; + UINT tmp_size; + UINT ret; + // Validate arguments + if (s == NULL) + { + return 0; + } + + tmp_size = UniStrLen(s) * 5 + 10; + tmp = ZeroMalloc(tmp_size); + UnixUniToStr(tmp, tmp_size, s); + + ret = StrSize(tmp); + Free(tmp); + + return ret; +} + +// Converted a Unicode string to a string +UINT UnixUniToStr(char *str, UINT size, wchar_t *s) +{ + USHORT *tmp; + char *inbuf; + size_t insize; + char *outbuf; + char *outbuf_orig; + size_t outsize; + void *d; + // Validate arguments + if (str == NULL || s == NULL) + { + return 0; + } + + // Convert a wchar_t string to sequence of 2-bytes first + tmp = WideToUtf16(s); + inbuf = (char *)tmp; + insize = (UniStrLen(s) + 1) * 2; + outsize = insize * 5 + 10; + outbuf_orig = outbuf = ZeroMalloc(outsize); + + d = IconvWideToStr(); + if (d == (void *)-1) + { + StrCpy(str, size, ""); + Free(outbuf); + Free(tmp); + return 0; + } + + if (iconv((iconv_t)d, (char **)&inbuf, (size_t *)&insize, (char **)&outbuf, (size_t *)&outsize) == (size_t)(-1)) + { + Free(outbuf_orig); + IconvFree(d); + StrCpy(str, size, ""); + Free(tmp); + return 0; + } + + StrCpy(str, size, outbuf_orig); + + Free(outbuf_orig); + IconvFree(d); + Free(tmp); + + return StrLen(str); +} + +// Converted the whcar_t to char +void *IconvWideToStrInternal() +{ + return (void *)iconv_open(charset, IsBigEndian() ? "UTF-16BE" : "UTF-16LE"); +} + +// Convert the char to a wchar_t +void *IconvStrToWideInternal() +{ + return (void *)iconv_open(IsBigEndian() ? "UTF-16BE" : "UTF-16LE", charset); +} + +// Close the handle +int IconvFreeInternal(void *d) +{ + iconv_close((iconv_t)d); + return 0; +} + +void *IconvWideToStr() +{ + if (iconv_cache_wide_to_str == (void *)-1) + { + return (void *)-1; + } + + Lock(iconv_lock); + + return iconv_cache_wide_to_str; +} + +void *IconvStrToWide() +{ + if (iconv_cache_str_to_wide == (void *)-1) + { + return (void *)-1; + } + + Lock(iconv_lock); + + return iconv_cache_str_to_wide; +} + +int IconvFree(void *d) +{ + Unlock(iconv_lock); + + return 0; +} + +// Get the character set that is currently used from the environment variable +void GetCurrentCharSet(char *name, UINT size) +{ + char tmp[MAX_SIZE]; + TOKEN_LIST *t; + // Validate arguments + if (name == NULL) + { + return; + } + + Zero(tmp, sizeof(tmp)); + if (GetEnv("LANG", tmp, sizeof(tmp)) == false || IsEmptyStr(tmp)) + { + Zero(tmp, sizeof(tmp)); + if (GetEnv("LOCATION", tmp, sizeof(tmp)) == false || IsEmptyStr(tmp)) + { + StrCpy(tmp, sizeof(tmp), "C"); + } + } + + Trim(tmp); + + t = ParseToken(tmp, "."); + if (t->NumTokens >= 2) + { + StrCpy(name, size, t->Token[1]); + } + else + { + if (t->NumTokens == 1) + { + StrCpy(name, size, t->Token[0]); + } + else + { + StrCpy(name, size, "eucJP"); + } + } + FreeToken(t); + + StrUpper(name); +} + +#endif // OS_UNIX + +// Check whether the specified string is a space +bool UniIsEmptyStr(wchar_t *str) +{ + return IsEmptyUniStr(str); +} +bool IsEmptyUniStr(wchar_t *str) +{ + bool ret; + wchar_t *s; + // Validate arguments + if (str == NULL) + { + return true; + } + + s = UniCopyStr(str); + + UniTrim(s); + if (UniStrLen(s) == 0) + { + ret = true; + } + else + { + ret = false; + } + + Free(s); + + return ret; +} + +// Check whether the specified string is a number +bool UniIsNum(wchar_t *str) +{ + char tmp[MAX_SIZE]; + + // Validate arguments + if (str == NULL) + { + return false; + } + + UniToStrForSingleChars(tmp, sizeof(tmp), str); + + return IsNum(tmp); +} + + +// Empty Unicode token list +UNI_TOKEN_LIST *UniNullToken() +{ + UNI_TOKEN_LIST *ret = ZeroMalloc(sizeof(UNI_TOKEN_LIST)); + ret->Token = ZeroMalloc(0); + + return ret; +} + +// Convert the token list to Unicode token list +UNI_TOKEN_LIST *TokenListToUniTokenList(TOKEN_LIST *src) +{ + UNI_TOKEN_LIST *ret; + UINT i; + // Validate arguments + if (src == NULL) + { + return NULL; + } + + ret = ZeroMalloc(sizeof(UNI_TOKEN_LIST)); + ret->NumTokens = src->NumTokens; + ret->Token = ZeroMalloc(sizeof(wchar_t *) * ret->NumTokens); + + for (i = 0;i < ret->NumTokens;i++) + { + ret->Token[i] = CopyStrToUni(src->Token[i]); + } + + return ret; +} + +// Convert a Unicode token list to a token list +TOKEN_LIST *UniTokenListToTokenList(UNI_TOKEN_LIST *src) +{ + TOKEN_LIST *ret; + UINT i; + // Validate arguments + if (src == NULL) + { + return NULL; + } + + ret = ZeroMalloc(sizeof(TOKEN_LIST)); + ret->NumTokens = src->NumTokens; + ret->Token = ZeroMalloc(sizeof(char *) * ret->NumTokens); + + for (i = 0;i < ret->NumTokens;i++) + { + ret->Token[i] = CopyUniToStr(src->Token[i]); + } + + return ret; +} + +// Unicode string copy +wchar_t *UniCopyStr(wchar_t *str) +{ + return CopyUniStr(str); +} + +// Copy the token list +UNI_TOKEN_LIST *UniCopyToken(UNI_TOKEN_LIST *src) +{ + UNI_TOKEN_LIST *ret; + UINT i; + // Validate arguments + if (src == NULL) + { + return NULL; + } + + ret = ZeroMalloc(sizeof(TOKEN_LIST)); + ret->NumTokens = src->NumTokens; + ret->Token = ZeroMalloc(sizeof(wchar_t *) * ret->NumTokens); + for (i = 0;i < ret->NumTokens;i++) + { + ret->Token[i] = CopyUniStr(src->Token[i]); + } + + return ret; +} + +// Parse the command line string +UNI_TOKEN_LIST *UniParseCmdLine(wchar_t *str) +{ + UNI_TOKEN_LIST *t; + LIST *o; + UINT i, len, wp, mode; + wchar_t c; + wchar_t *tmp; + bool ignore_space = false; + // Validate arguments + if (str == NULL) + { + // There is no token + return UniNullToken(); + } + + o = NewListFast(NULL); + tmp = Malloc(UniStrSize(str) + 32); + + wp = 0; + mode = 0; + + len = UniStrLen(str); + for (i = 0;i < len;i++) + { + c = str[i]; + + switch (mode) + { + case 0: + // Mode to discover the next token + if (c == L' ' || c == L'\t') + { + // Advance to the next character + } + else + { + // Start of the token + if (c == L'\"') + { + if (str[i + 1] == L'\"') + { + // Regarded "" as a single " character + tmp[wp++] = L'\"'; + i++; + } + else + { + // Single "(double-quote) enables the flag to ignore space + ignore_space = true; + } + } + else + { + tmp[wp++] = c; + } + + mode = 1; + } + break; + + case 1: + if (ignore_space == false && (c == L' ' || c == L'\t')) + { + // End of the token + tmp[wp++] = 0; + wp = 0; + + Insert(o, UniCopyStr(tmp)); + mode = 0; + } + else + { + if (c == L'\"') + { + if (str[i + 1] == L'\"') + { + // Regarded "" as a single " character + tmp[wp++] = L'\"'; + i++; + } + else + { + if (ignore_space == false) + { + // Single "(double-quote) enables the flag to ignore space + ignore_space = true; + } + else + { + // Disable the flag to ignore space + ignore_space = false; + } + } + } + else + { + tmp[wp++] = c; + } + } + break; + } + } + + if (wp != 0) + { + tmp[wp++] = 0; + Insert(o, UniCopyStr(tmp)); + } + + Free(tmp); + + t = ZeroMalloc(sizeof(UNI_TOKEN_LIST)); + t->NumTokens = LIST_NUM(o); + t->Token = ZeroMalloc(sizeof(wchar_t *) * t->NumTokens); + for (i = 0;i < t->NumTokens;i++) + { + t->Token[i] = LIST_DATA(o, i); + } + + ReleaseList(o); + + return t; +} + +// Convert Unicode string to 64bit integer +UINT64 UniToInt64(wchar_t *str) +{ + char tmp[MAX_SIZE]; + // Validate arguments + if (str == NULL) + { + return 0; + } + + UniToStrForSingleChars(tmp, sizeof(tmp), str); + + return ToInt64(tmp); +} + +// Convert the UTF string to a Unicode string +UINT UtfToUni(wchar_t *unistr, UINT size, char *utfstr) +{ + wchar_t *tmp; + // Validate arguments + if (unistr == NULL || utfstr == NULL) + { + UniStrCpy(unistr, size, L""); + return 0; + } + + tmp = CopyUtfToUni(utfstr); + + UniStrCpy(unistr, size, tmp); + + Free(tmp); + + return UniStrLen(unistr); +} + +// Copy the UTF-8 string to a Unicode string +wchar_t *CopyUtfToUni(char *utfstr) +{ + UINT size; + wchar_t *ret; + UINT utfstr_len; + // Validate arguments + if (utfstr == NULL) + { + return NULL; + } + + utfstr_len = StrLen(utfstr); + + size = CalcUtf8ToUni((BYTE *)utfstr, utfstr_len); + ret = ZeroMalloc(size + sizeof(wchar_t)); + Utf8ToUni(ret, size, (BYTE *)utfstr, utfstr_len); + + return ret; +} + +// Copy a Unicode string to ANSI string +char *CopyUniToStr(wchar_t *unistr) +{ + char *str; + UINT str_size; + // Validate arguments + if (unistr == NULL) + { + return NULL; + } + + str_size = CalcUniToStr(unistr); + if (str_size == 0) + { + return CopyStr(""); + } + str = Malloc(str_size); + UniToStr(str, str_size, unistr); + + return str; +} + +// Copy an ANSI string to a Unicode string +wchar_t *CopyStrToUni(char *str) +{ + wchar_t *uni; + UINT uni_size; + // Validate arguments + if (str == NULL) + { + return NULL; + } + + uni_size = CalcStrToUni(str); + if (uni_size == 0) + { + return CopyUniStr(L""); + } + uni = Malloc(uni_size); + StrToUni(uni, uni_size, str); + + return uni; +} + +// Copy a Unicode string to UTF-8 string +char *CopyUniToUtf(wchar_t *unistr) +{ + UINT size; + char *ret; + // Validate arguments + if (unistr == NULL) + { + return NULL; + } + + size = CalcUniToUtf8(unistr); + ret = ZeroMalloc(size + sizeof(char)); + + UniToUtf8((char *)ret, size, unistr); + + return ret; +} + +// Copy the Unicode string +wchar_t *CopyUniStr(wchar_t *str) +{ + UINT len; + wchar_t *dst; + // Validate arguments + if (str == NULL) + { + return NULL; + } + + len = UniStrLen(str); + dst = Malloc((len + 1) * sizeof(wchar_t)); + UniStrCpy(dst, 0, str); + + return dst; +} + +// Check whether the string is safe +bool IsSafeUniStr(wchar_t *str) +{ + UINT i, len; + // Validate arguments + if (str == NULL) + { + return false; + } + + len = UniStrLen(str); + for (i = 0;i < len;i++) + { + if (IsSafeUniChar(str[i]) == false) + { + return false; + } + } + if (str[0] == L' ') + { + return false; + } + if (len != 0) + { + if (str[len - 1] == L' ') + { + return false; + } + } + return true; +} + +// Check whether the character is safe +bool IsSafeUniChar(wchar_t c) +{ + UINT i, len; + wchar_t *check_str = + L"ABCDEFGHIJKLMNOPQRSTUVWXYZ" + L"abcdefghijklmnopqrstuvwxyz" + L"0123456789" + L" ()-_#%&."; + + len = UniStrLen(check_str); + for (i = 0;i < len;i++) + { + if (c == check_str[i]) + { + return true; + } + } + return false; +} + +// Convert Unicode string to ANSI string +UINT UniToStr(char *str, UINT size, wchar_t *s) +{ +#ifdef OS_WIN32 + UINT ret; + char *tmp; + UINT new_size; + // Validate arguments + if (s == NULL || str == NULL) + { + return 0; + } + + new_size = CalcUniToStr(s); + if (new_size == 0) + { + if (size >= 1) + { + StrCpy(str, 0, ""); + } + return 0; + } + tmp = Malloc(new_size); + tmp[0] = 0; + wcstombs(tmp, s, new_size); + tmp[new_size - 1] = 0; + ret = StrCpy(str, size, tmp); + Free(tmp); + + return ret; +#else // OS_WIN32 + return UnixUniToStr(str, size, s); +#endif // OS_WIN32 +} + +// Get the required number of bytes to convert Unicode string to the ANSI string +UINT CalcUniToStr(wchar_t *s) +{ +#ifdef OS_WIN32 + UINT ret; + // Validate arguments + if (s == NULL) + { + return 0; + } + + ret = (UINT)wcstombs(NULL, s, UniStrLen(s)); + if (ret == (UINT)-1) + { + return 0; + } + + return ret + 1; +#else // OS_WIN32 + return UnixCalcUniToStr(s); +#endif // OS_WIN32 +} + +// Converted an ANSI string to a Unicode string +UINT StrToUni(wchar_t *s, UINT size, char *str) +{ +#ifdef OS_WIN32 + UINT ret; + wchar_t *tmp; + UINT new_size; + // Validate arguments + if (s == NULL || str == NULL) + { + return 0; + } + + new_size = CalcStrToUni(str); + if (new_size == 0) + { + if (size >= 2) + { + UniStrCpy(s, 0, L""); + } + return 0; + } + tmp = Malloc(new_size); + tmp[0] = 0; + mbstowcs(tmp, str, StrLen(str)); + tmp[(new_size - 1) / sizeof(wchar_t)] = 0; + ret = UniStrCpy(s, size, tmp); + Free(tmp); + + return ret; +#else // OS_WIN32 + return UnixStrToUni(s, size, str); +#endif // OS_WIN32 +} + +// Get the required buffer size for converting an ANSI string to an Unicode string +UINT CalcStrToUni(char *str) +{ +#ifdef OS_WIN32 + UINT ret; + // Validate arguments + if (str == NULL) + { + return 0; + } + + ret = (UINT)mbstowcs(NULL, str, StrLen(str)); + if (ret == (UINT)-1) + { + return 0; + } + + return (ret + 1) * sizeof(wchar_t); +#else // OS_WIN32 + return UnixCalcStrToUni(str); +#endif // OS_WIN32 +} + +// Convert the UTF-8 strings to a Unicode string +UINT Utf8ToUni(wchar_t *s, UINT size, BYTE *u, UINT u_size) +{ + UINT i, wp, num; + // Validate arguments + if (s == NULL || u == NULL) + { + return 0; + } + if (size == 0) + { + size = 0x3fffffff; + } + if (u_size == 0) + { + u_size = StrLen((char *)u); + } + + i = 0; + wp = 0; + num = 0; + while (true) + { + UINT type; + wchar_t c = 0; + BYTE c1, c2; + + type = GetUtf8Type(u, u_size, i); + if (type == 0) + { + break; + } + switch (type) + { + case 1: + c1 = 0; + c2 = u[i]; + break; + case 2: + c1 = (((u[i] & 0x1c) >> 2) & 0x07); + c2 = (((u[i] & 0x03) << 6) & 0xc0) | (u[i + 1] & 0x3f); + break; + case 3: + c1 = ((((u[i] & 0x0f) << 4) & 0xf0)) | (((u[i + 1] & 0x3c) >> 2) & 0x0f); + c2 = (((u[i + 1] & 0x03) << 6) & 0xc0) | (u[i + 2] & 0x3f); + break; + } + i += type; + + if (IsBigEndian()) + { + if (sizeof(wchar_t) == 2) + { + ((BYTE *)&c)[0] = c1; + ((BYTE *)&c)[1] = c2; + } + else + { + ((BYTE *)&c)[2] = c1; + ((BYTE *)&c)[3] = c2; + } + } + else + { + ((BYTE *)&c)[0] = c2; + ((BYTE *)&c)[1] = c1; + } + + if (wp < ((size / sizeof(wchar_t)) - 1)) + { + s[wp++] = c; + num++; + } + else + { + break; + } + } + + if (wp < (size / sizeof(wchar_t))) + { + s[wp++] = 0; + } + + return num; +} + +// Get the buffer size when converted UTF-8 to Unicode +UINT CalcUtf8ToUni(BYTE *u, UINT u_size) +{ + // Validate arguments + if (u == NULL) + { + return 0; + } + if (u_size == 0) + { + u_size = StrLen((char *)u); + } + + return (Utf8Len(u, u_size) + 1) * sizeof(wchar_t); +} + +// Get the number of characters in UTF-8 string +UINT Utf8Len(BYTE *u, UINT size) +{ + UINT i, num; + // Validate arguments + if (u == NULL) + { + return 0; + } + if (size == 0) + { + size = StrLen((char *)u); + } + + i = num = 0; + while (true) + { + UINT type; + + type = GetUtf8Type(u, size, i); + if (type == 0) + { + break; + } + i += type; + num++; + } + + return num; +} + +// Convert an Unicode string to UTF-8 string +UINT UniToUtf8(BYTE *u, UINT size, wchar_t *s) +{ + UINT i, len, type, wp; + // Validate arguments + if (u == NULL || s == NULL) + { + return 0; + } + if (size == 0) + { + size = 0x3fffffff; + } + + len = UniStrLen(s); + wp = 0; + for (i = 0;i < len;i++) + { + BYTE c1, c2; + wchar_t c = s[i]; + + if (IsBigEndian()) + { + if (sizeof(wchar_t) == 2) + { + c1 = ((BYTE *)&c)[0]; + c2 = ((BYTE *)&c)[1]; + } + else + { + c1 = ((BYTE *)&c)[2]; + c2 = ((BYTE *)&c)[3]; + } + } + else + { + c1 = ((BYTE *)&c)[1]; + c2 = ((BYTE *)&c)[0]; + } + + type = GetUniType(s[i]); + switch (type) + { + case 1: + if (wp < size) + { + u[wp++] = c2; + } + break; + case 2: + if (wp < size) + { + u[wp++] = 0xc0 | (((((c1 & 0x07) << 2) & 0x1c)) | (((c2 & 0xc0) >> 6) & 0x03)); + } + if (wp < size) + { + u[wp++] = 0x80 | (c2 & 0x3f); + } + break; + case 3: + if (wp < size) + { + u[wp++] = 0xe0 | (((c1 & 0xf0) >> 4) & 0x0f); + } + if (wp < size) + { + u[wp++] = 0x80 | (((c1 & 0x0f) << 2) & 0x3c) | (((c2 & 0xc0) >> 6) & 0x03); + } + if (wp < size) + { + u[wp++] = 0x80 | (c2 & 0x3f); + } + break; + } + } + if (wp < size) + { + u[wp] = 0; + } + return wp; +} + +// Calculating the length of the string when converting Unicode string to UTF-8 string +UINT CalcUniToUtf8(wchar_t *s) +{ + UINT i, len, size; + // Validate arguments + if (s == NULL) + { + return 0; + } + + size = 0; + len = UniStrLen(s); + for (i = 0;i < len;i++) + { + size += GetUniType(s[i]); + } + + return size; +} + +// Get the number of bytes of a first character of the offset address of the UTF-8 string that starts with s +UINT GetUtf8Type(BYTE *s, UINT size, UINT offset) +{ + // Validate arguments + if (s == NULL) + { + return 0; + } + if ((offset + 1) > size) + { + return 0; + } + if ((s[offset] & 0x80) == 0) + { + // 1 byte + return 1; + } + if ((s[offset] & 0x20) == 0) + { + // 2 bytes + if ((offset + 2) > size) + { + return 0; + } + return 2; + } + // 3 bytes + if ((offset + 3) > size) + { + return 0; + } + return 3; +} + +// Type of the converted character 'c' to UTF-8 (in bytes) +UINT GetUniType(wchar_t c) +{ + BYTE c1, c2; + + if (IsBigEndian()) + { + if (sizeof(wchar_t) == 2) + { + c1 = ((BYTE *)&c)[0]; + c2 = ((BYTE *)&c)[1]; + } + else + { + c1 = ((BYTE *)&c)[2]; + c2 = ((BYTE *)&c)[3]; + } + } + else + { + c1 = ((BYTE *)&c)[1]; + c2 = ((BYTE *)&c)[0]; + } + + if (c1 == 0) + { + if (c2 <= 0x7f) + { + // 1 byte + return 1; + } + else + { + // 2 bytes + return 2; + } + } + if ((c1 & 0xf8) == 0) + { + // 2 bytes + return 2; + } + // 3 bytes + return 3; +} + +// String replacing (case-sensitive) +UINT UniReplaceStr(wchar_t *dst, UINT size, wchar_t *string, wchar_t *old_keyword, wchar_t *new_keyword) +{ + return UniReplaceStrEx(dst, size, string, old_keyword, new_keyword, true); +} + +// Replacement of string +UINT UniReplaceStrEx(wchar_t *dst, UINT size, wchar_t *string, wchar_t *old_keyword, wchar_t *new_keyword, bool case_sensitive) +{ + UINT i, j, num, len_string, len_old, len_new, len_ret, wp; + wchar_t *ret; + // Validate arguments + if (string == NULL || old_keyword == NULL || new_keyword == NULL) + { + return 0; + } + + // Get the length of the string + len_string = UniStrLen(string); + len_old = UniStrLen(old_keyword); + len_new = UniStrLen(new_keyword); + + // Get the final string length + len_ret = UniCalcReplaceStrEx(string, old_keyword, new_keyword, case_sensitive); + // Memory allocation + ret = Malloc((len_ret + 1) * sizeof(wchar_t)); + ret[len_ret] = 0; + + // Search and Replace + i = j = num = wp = 0; + while (true) + { + i = UniSearchStrEx(string, old_keyword, i, case_sensitive); + if (i == INFINITE) + { + Copy(&ret[wp], &string[j], (len_string - j) * sizeof(wchar_t)); + wp += len_string - j; + break; + } + num++; + Copy(&ret[wp], &string[j], (i - j) * sizeof(wchar_t)); + wp += i - j; + Copy(&ret[wp], new_keyword, len_new * sizeof(wchar_t)); + wp += len_new; + i += len_old; + j = i; + } + + // Copy of the search results + UniStrCpy(dst, size, ret); + + // Memory release + Free(ret); + + return num; +} + +// Calculate the length of the result of string replacement +UINT UniCalcReplaceStrEx(wchar_t *string, wchar_t *old_keyword, wchar_t *new_keyword, bool case_sensitive) +{ + UINT i, num; + UINT len_string, len_old, len_new; + // Validate arguments + if (string == NULL || old_keyword == NULL || new_keyword == NULL) + { + return 0; + } + + // Get the length of the string + len_string = UniStrLen(string); + len_old = UniStrLen(old_keyword); + len_new = UniStrLen(new_keyword); + + if (len_old == len_new) + { + return len_string; + } + + // Search process + num = 0; + i = 0; + while (true) + { + i = UniSearchStrEx(string, old_keyword, i, case_sensitive); + if (i == INFINITE) + { + break; + } + i += len_old; + num++; + } + + // Calculation + return len_string + len_new * num - len_old * num; +} + +// Search for a string (distinguish between upper / lower case) +UINT UniSearchStr(wchar_t *string, wchar_t *keyword, UINT start) +{ + return UniSearchStrEx(string, keyword, start, true); +} + +// Return the position of the first found of the keyword in the string +// (Found in first character: returns 0, Not found: returns INFINITE) +UINT UniSearchStrEx(wchar_t *string, wchar_t *keyword, UINT start, bool case_sensitive) +{ + UINT len_string, len_keyword; + UINT i; + wchar_t *cmp_string, *cmp_keyword; + bool found; + // Validate arguments + if (string == NULL || keyword == NULL) + { + return INFINITE; + } + + // Get the length of string + len_string = UniStrLen(string); + if (len_string <= start) + { + // Value of start is invalid + return INFINITE; + } + + // Get the length of the keyword + len_keyword = UniStrLen(keyword); + if (len_keyword == 0) + { + // There is no keyword + return INFINITE; + } + + if (len_string < len_keyword) + { + return INFINITE; + } + + if (len_string == len_keyword) + { + if (case_sensitive) + { + if (UniStrCmp(string, keyword) == 0) + { + return 0; + } + else + { + return INFINITE; + } + } + else + { + if (UniStrCmpi(string, keyword) == 0) + { + return 0; + } + else + { + return INFINITE; + } + } + } + + if (case_sensitive) + { + cmp_string = string; + cmp_keyword = keyword; + } + else + { + cmp_string = Malloc((len_string + 1) * sizeof(wchar_t)); + UniStrCpy(cmp_string, (len_string + 1) * sizeof(wchar_t), string); + cmp_keyword = Malloc((len_keyword + 1) * sizeof(wchar_t)); + UniStrCpy(cmp_keyword, (len_keyword + 1) * sizeof(wchar_t), keyword); + UniStrUpper(cmp_string); + UniStrUpper(cmp_keyword); + } + + // Search + found = false; + for (i = start;i < (len_string - len_keyword + 1);i++) + { + // Compare + if (!wcsncmp(&cmp_string[i], cmp_keyword, len_keyword)) + { + // Found + found = true; + break; + } + } + + if (case_sensitive == false) + { + // Memory release + Free(cmp_keyword); + Free(cmp_string); + } + + if (found == false) + { + return INFINITE; + } + return i; +} + +// Release of the token list +void UniFreeToken(UNI_TOKEN_LIST *tokens) +{ + UINT i; + if (tokens == NULL) + { + return; + } + for (i = 0;i < tokens->NumTokens;i++) + { + Free(tokens->Token[i]); + } + Free(tokens->Token); + Free(tokens); +} + +// Parse token for UNIX +UNI_TOKEN_LIST *UnixUniParseToken(wchar_t *src, wchar_t *separator) +{ + UNI_TOKEN_LIST *ret; + TOKEN_LIST *t; + char *src_s; + char *sep_s; + + // Validate arguments + if (src == NULL || separator == NULL) + { + ret = ZeroMalloc(sizeof(UNI_TOKEN_LIST)); + ret->Token = ZeroMalloc(0); + return ret; + } + + src_s = CopyUniToStr(src); + sep_s = CopyUniToStr(separator); + + t = ParseToken(src_s, sep_s); + + ret = TokenListToUniTokenList(t); + FreeToken(t); + + Free(src_s); + Free(sep_s); + + return ret; +} + +// Get a standard token delimiter +wchar_t *UniDefaultTokenSplitChars() +{ + return L" ,\t\r\n"; +} + +// Check whether the specified character is in the string +bool UniIsCharInStr(wchar_t *str, wchar_t c) +{ + UINT i, len; + // Validate arguments + if (str == NULL) + { + return false; + } + + len = UniStrLen(str); + for (i = 0;i < len;i++) + { + if (str[i] == c) + { + return true; + } + } + + return false; +} + +// Cut out the token from the string (not ignore the blanks between delimiters) +UNI_TOKEN_LIST *UniParseTokenWithNullStr(wchar_t *str, wchar_t *split_chars) +{ + LIST *o; + UINT i, len; + BUF *b; + wchar_t zero = 0; + UNI_TOKEN_LIST *t; + // Validate arguments + if (str == NULL) + { + return UniNullToken(); + } + if (split_chars == NULL) + { + split_chars = UniDefaultTokenSplitChars(); + } + + b = NewBuf(); + o = NewListFast(NULL); + + len = UniStrLen(str); + + for (i = 0;i < (len + 1);i++) + { + wchar_t c = str[i]; + bool flag = UniIsCharInStr(split_chars, c); + + if (c == L'\0') + { + flag = true; + } + + if (flag == false) + { + WriteBuf(b, &c, sizeof(wchar_t)); + } + else + { + WriteBuf(b, &zero, sizeof(wchar_t)); + + Insert(o, UniCopyStr((wchar_t *)b->Buf)); + ClearBuf(b); + } + } + + t = ZeroMalloc(sizeof(UNI_TOKEN_LIST)); + t->NumTokens = LIST_NUM(o); + t->Token = ZeroMalloc(sizeof(wchar_t *) * t->NumTokens); + + for (i = 0;i < t->NumTokens;i++) + { + t->Token[i] = LIST_DATA(o, i); + } + + ReleaseList(o); + FreeBuf(b); + + return t; +} + +// Cut out the token from string (Ignore blanks between delimiters) +UNI_TOKEN_LIST *UniParseTokenWithoutNullStr(wchar_t *str, wchar_t *split_chars) +{ + LIST *o; + UINT i, len; + bool last_flag; + BUF *b; + wchar_t zero = 0; + UNI_TOKEN_LIST *t; + // Validate arguments + if (str == NULL) + { + return UniNullToken(); + } + if (split_chars == NULL) + { + split_chars = UniDefaultTokenSplitChars(); + } + + b = NewBuf(); + o = NewListFast(NULL); + + len = UniStrLen(str); + last_flag = false; + + for (i = 0;i < (len + 1);i++) + { + wchar_t c = str[i]; + bool flag = UniIsCharInStr(split_chars, c); + + if (c == L'\0') + { + flag = true; + } + + if (flag == false) + { + WriteBuf(b, &c, sizeof(wchar_t)); + } + else + { + if (last_flag == false) + { + WriteBuf(b, &zero, sizeof(wchar_t)); + + if ((UniStrLen((wchar_t *)b->Buf)) != 0) + { + Insert(o, UniCopyStr((wchar_t *)b->Buf)); + } + ClearBuf(b); + } + } + + last_flag = flag; + } + + t = ZeroMalloc(sizeof(UNI_TOKEN_LIST)); + t->NumTokens = LIST_NUM(o); + t->Token = ZeroMalloc(sizeof(wchar_t *) * t->NumTokens); + + for (i = 0;i < t->NumTokens;i++) + { + t->Token[i] = LIST_DATA(o, i); + } + + ReleaseList(o); + FreeBuf(b); + + return t; +} + +// Parse the token +UNI_TOKEN_LIST *UniParseToken(wchar_t *src, wchar_t *separator) +{ + // 2020/7/20 remove strtok by dnobori + return UniParseTokenWithoutNullStr(src, separator); +} + +// Get a line from standard input +bool UniGetLine(wchar_t *str, UINT size) +{ +#ifdef OS_WIN32 + return UniGetLineWin32(str, size); +#else // OS_WIN32 + return UniGetLineUnix(str, size); +#endif // OS_WIN32 +} +void AnsiGetLineUnix(char *str, UINT size) +{ + // Validate arguments + if (str == NULL) + { + char tmp[MAX_SIZE]; + fgets(tmp, sizeof(tmp) - 1, stdin); + return; + } + if (size <= 1) + { + return; + } + + // Read data from standard input + fgets(str, (int)(size - 1), stdin); + + TrimCrlf(str); +} +bool UniGetLineUnix(wchar_t *str, UINT size) +{ + char *str_a; + UINT str_a_size = size; + if (str == NULL || size < sizeof(wchar_t)) + { + return false; + } + if (str_a_size >= 0x7fffffff) + { + str_a_size = MAX_SIZE; + } + str_a_size *= 2; + + str_a = ZeroMalloc(str_a_size); + + AnsiGetLineUnix(str_a, str_a_size); + + StrToUni(str, size, str_a); + + Free(str_a); + + return true; +} +bool UniGetLineWin32(wchar_t *str, UINT size) +{ + bool ret = false; + +#ifdef OS_WIN32 + ret = Win32InputW(str, size); +#endif // OS_WIN32 + + return ret; +} + +// Remove '\r\n' at the end +void UniTrimCrlf(wchar_t *str) +{ + UINT len; + // Validate arguments + if (str == NULL) + { + return; + } + len = UniStrLen(str); + if (len == 0) + { + return; + } + + if (str[len - 1] == L'\n') + { + if (len >= 2 && str[len - 2] == L'\r') + { + str[len - 2] = 0; + } + str[len - 1] = 0; + } + else if(str[len - 1] == L'\r') + { + str[len - 1] = 0; + } +} + +// Remove white space of the both side of the string +void UniTrim(wchar_t *str) +{ + // Validate arguments + if (str == NULL) + { + return; + } + + UniTrimLeft(str); + UniTrimRight(str); +} + +// Remove white space on the right side of the string +void UniTrimRight(wchar_t *str) +{ + wchar_t *buf, *tmp; + UINT len, i, wp, wp2; + bool flag; + // Validate arguments + if (str == NULL) + { + return; + } + len = UniStrLen(str); + if (len == 0) + { + return; + } + if (str[len - 1] != L' ' && str[len - 1] != L'\t') + { + return; + } + + buf = Malloc((len + 1) * sizeof(wchar_t)); + tmp = Malloc((len + 1) * sizeof(wchar_t)); + flag = false; + wp = wp2 = 0; + for (i = 0;i < len;i++) + { + if (str[i] != L' ' && str[i] != L'\t') + { + Copy(&buf[wp], tmp, wp2 * sizeof(wchar_t)); + wp += wp2; + wp2 = 0; + buf[wp++] = str[i]; + } + else + { + tmp[wp2++] = str[i]; + } + } + buf[wp] = 0; + UniStrCpy(str, 0, buf); + Free(buf); + Free(tmp); +} + +// Remove white space from the left side of the string +void UniTrimLeft(wchar_t *str) +{ + wchar_t *buf; + UINT len, i, wp; + bool flag; + // Validate arguments + if (str == NULL) + { + return; + } + len = UniStrLen(str); + if (len == 0) + { + return; + } + if (str[0] != L' ' && str[0] != L'\t') + { + return; + } + + buf = Malloc((len + 1) * sizeof(wchar_t)); + flag = false; + wp = 0; + for (i = 0;i < len;i++) + { + if (str[i] != L' ' && str[i] != L'\t') + { + flag = true; + } + if (flag) + { + buf[wp++] = str[i]; + } + } + buf[wp] = 0; + UniStrCpy(str, 0, buf); + Free(buf); +} + +// Convert a signed integer to a string +void UniToStri(wchar_t *str, int i) +{ + UniFormat(str, 0, L"%i", i); +} + +// Convert an integer to a string +void UniToStru(wchar_t *str, UINT i) +{ + UniFormat(str, 0, L"%u", i); +} + +// Convert a string to an integer +UINT UniToInt(wchar_t *str) +{ + char tmp[128]; + // Validate arguments + if (str == NULL) + { + return 0; + } + + UniToStrForSingleChars(tmp, sizeof(tmp), str); + + return ToInti(tmp); +} + +// Convert only single-byte characters in the Unicode string to a char string +void UniToStrForSingleChars(char *dst, UINT dst_size, wchar_t *src) +{ + UINT i; + // Validate arguments + if (dst == NULL || src == NULL) + { + return; + } + + for (i = 0;i < UniStrLen(src) + 1;i++) + { + wchar_t s = src[i]; + char d; + + if (s == 0) + { + d = 0; + } + else if (s <= 0xff) + { + d = (char)s; + } + else + { + d = ' '; + } + + dst[i] = d; + } +} + +// Get lines from a string +UNI_TOKEN_LIST *UniGetLines(wchar_t *str) +{ + UINT i, len; + BUF *b = NULL; + LIST *o; + UNI_TOKEN_LIST *ret; + // Validate arguments + if (str == NULL) + { + return UniNullToken(); + } + + o = NewListFast(NULL); + + len = UniStrLen(str); + + b = NewBuf(); + + for (i = 0;i < len;i++) + { + wchar_t c = str[i]; + bool f = false; + + if (c == L'\r') + { + if (str[i + 1] == L'\n') + { + i++; + } + f = true; + } + else if (c == L'\n') + { + f = true; + } + + if (f) + { + wchar_t zero = 0; + wchar_t *s; + WriteBuf(b, &zero, sizeof(wchar_t)); + + s = (wchar_t *)b->Buf; + + Add(o, UniCopyStr(s)); + + ClearBuf(b); + } + else + { + WriteBuf(b, &c, sizeof(wchar_t)); + } + } + + if (true) + { + wchar_t zero = 0; + wchar_t *s; + WriteBuf(b, &zero, sizeof(wchar_t)); + + s = (wchar_t *)b->Buf; + + Add(o, UniCopyStr(s)); + + ClearBuf(b); + } + + FreeBuf(b); + + ret = UniListToTokenList(o); + + UniFreeStrList(o); + + return ret; +} + +// Display the string on the screen +void UniPrintStr(wchar_t *string) +{ + // Validate arguments + if (string == NULL) + { + return; + } + +#ifdef OS_UNIX + if (true) + { + char *str = CopyUniToStr(string); + + if (str != NULL) + { + fputs(str, stdout); + } + else + { + fputs("", stdout); + } + + Free(str); + } +#else // OS_UNIX + Win32PrintW(string); +#endif // OS_UNIX +} + +// Display a string with arguments +void UniPrintArgs(wchar_t *fmt, va_list args) +{ + wchar_t *str; + // Validate arguments + if (fmt == NULL) + { + return; + } + + str = InternalFormatArgs(fmt, args, false); + + UniPrintStr(str); + + Free(str); +} + +// Display the string +void UniPrint(wchar_t *fmt, ...) +{ + va_list args; + // Validate arguments + if (fmt == NULL) + { + return; + } + + va_start(args, fmt); + UniPrintArgs(fmt, args); + va_end(args); +} + +// Display debug string with arguments +void UniDebugArgs(wchar_t *fmt, va_list args) +{ + if (g_debug == false) + { + return; + } + + UniPrintArgs(fmt, args); +} + +// Display a debug string +void UniDebug(wchar_t *fmt, ...) +{ + va_list args; + // Validate arguments + if (fmt == NULL) + { + return; + } + + va_start(args, fmt); + UniDebugArgs(fmt, args); + va_end(args); +} + +// Format a string (argument list) +void UniFormatArgs(wchar_t *buf, UINT size, wchar_t *fmt, va_list args) +{ + wchar_t *ret; + // Validate arguments + if (buf == NULL || fmt == NULL) + { + return; + } + if (size == 1) + { + return; + } + + // KS + KS_INC(KS_FORMAT_COUNT); + + ret = InternalFormatArgs(fmt, args, false); + + UniStrCpy(buf, size, ret); + + Free(ret); +} + +// Format the string, and copy it +wchar_t *CopyUniFormat(wchar_t *fmt, ...) +{ + wchar_t *ret, *str; + UINT size; + va_list args; + // Validate arguments + if (fmt == NULL) + { + return NULL; + } + + size = MAX(UniStrSize(fmt) * 10, MAX_SIZE * 10); + str = Malloc(size); + + va_start(args, fmt); + UniFormatArgs(str, size, fmt, args); + + ret = UniCopyStr(str); + Free(str); + va_end(args); + + return ret; +} + +// Format the string +void UniFormat(wchar_t *buf, UINT size, wchar_t *fmt, ...) +{ + va_list args; + // Validate arguments + if (buf == NULL || fmt == NULL) + { + return; + } + + va_start(args, fmt); + UniFormatArgs(buf, size, fmt, args); + va_end(args); +} + +// Flexible string comparison +int UniSoftStrCmp(wchar_t *str1, wchar_t *str2) +{ + UINT ret; + wchar_t *tmp1, *tmp2; + // Validate arguments + if (str1 == NULL && str2 == NULL) + { + return 0; + } + if (str1 == NULL) + { + return 1; + } + if (str2 == NULL) + { + return -1; + } + + tmp1 = CopyUniStr(str1); + tmp2 = CopyUniStr(str2); + + UniTrim(tmp1); + UniTrim(tmp2); + + ret = UniStrCmpi(tmp1, tmp2); + + Free(tmp1); + Free(tmp2); + + return ret; +} + +// Compare the strings in case-insensitive mode +int UniStrCmpi(wchar_t *str1, wchar_t *str2) +{ + UINT i; + // Validate arguments + if (str1 == NULL && str2 == NULL) + { + return 0; + } + if (str1 == NULL) + { + return 1; + } + if (str2 == NULL) + { + return -1; + } + + // String comparison + i = 0; + while (true) + { + wchar_t c1, c2; + c1 = UniToUpper(str1[i]); + c2 = UniToUpper(str2[i]); + if (c1 > c2) + { + return 1; + } + else if (c1 < c2) + { + return -1; + } + if (str1[i] == 0 || str2[i] == 0) + { + return 0; + } + i++; + } +} + +// Compare the string +int UniStrCmp(wchar_t *str1, wchar_t *str2) +{ + // Validate arguments + if (str1 == NULL && str2 == NULL) + { + return 0; + } + if (str1 == NULL) + { + return 1; + } + if (str2 == NULL) + { + return -1; + } + + return wcscmp(str1, str2); +} + +// Uncapitalize the string +void UniStrLower(wchar_t *str) +{ + UINT i, len; + // Validate arguments + if (str == NULL) + { + return; + } + + len = UniStrLen(str); + for (i = 0;i < len;i++) + { + str[i] = UniToLower(str[i]); + } +} + +// Capitalize the string +void UniStrUpper(wchar_t *str) +{ + UINT i, len; + // Validate arguments + if (str == NULL) + { + return; + } + + len = UniStrLen(str); + for (i = 0;i < len;i++) + { + str[i] = UniToUpper(str[i]); + } +} + +// Uncapitalize a character +wchar_t UniToLower(wchar_t c) +{ + if (c >= L'A' && c <= L'Z') + { + c += L'a' - L'A'; + } + + return c; +} + +// Capitalize a character +wchar_t UniToUpper(wchar_t c) +{ + if (c >= L'a' && c <= L'z') + { + c -= L'a' - L'A'; + } + + return c; +} + +// String concatenation +UINT UniStrCat(wchar_t *dst, UINT size, wchar_t *src) +{ + UINT len1, len2, len_test; + // Validate arguments + if (dst == NULL || src == NULL) + { + return 0; + } + if (size != 0 && size < sizeof(wchar_t)) + { + return 0; + } + if (size == sizeof(wchar_t)) + { + wcscpy(dst, L""); + return 0; + } + if (size == 0) + { + // Ignore the length + size = 0x3fffffff; + } + + len1 = UniStrLen(dst); + len2 = UniStrLen(src); + len_test = len1 + len2 + 1; + if (len_test > (size / sizeof(wchar_t))) + { + if (len2 <= (len_test - (size / sizeof(wchar_t)))) + { + return 0; + } + len2 -= len_test - (size / sizeof(wchar_t)); + } + Copy(&dst[len1], src, len2 * sizeof(wchar_t)); + dst[len1 + len2] = 0; + + return len1 + len2; +} + +// String copy +UINT UniStrCpy(wchar_t *dst, UINT size, wchar_t *src) +{ + UINT len; + // Validate arguments + if (dst == NULL || src == NULL) + { + if (src == NULL && dst != NULL) + { + if (size >= sizeof(wchar_t)) + { + dst[0] = L'\0'; + } + } + return 0; + } + if (dst == src) + { + return UniStrLen(src); + } + if (size != 0 && size < sizeof(wchar_t)) + { + return 0; + } + if (size == sizeof(wchar_t)) + { + wcscpy(dst, L""); + return 0; + } + if (size == 0) + { + // Ignore the length + size = 0x3fffffff; + } + + // Check the length + len = UniStrLen(src); + if (len <= (size / sizeof(wchar_t) - 1)) + { + Copy(dst, src, (len + 1) * sizeof(wchar_t)); + } + else + { + len = size / sizeof(wchar_t) - 1; + Copy(dst, src, len * sizeof(wchar_t)); + dst[len] = 0; + } + + return len; +} + +// Get the buffer size needed to store the string +UINT UniStrSize(wchar_t *str) +{ + // Validate arguments + if (str == NULL) + { + return 0; + } + + return (UniStrLen(str) + 1) * sizeof(wchar_t); +} + +// Get the length of the string +UINT UniStrLen(wchar_t *str) +{ + UINT i; + // Validate arguments + if (str == NULL) + { + return 0; + } + + i = 0; + while (true) + { + if (str[i] == 0) + { + break; + } + i++; + } + + return i; +} + diff --git a/src/Mayaqua/Internat.h b/src/Mayaqua/Internat.h index cd5c0411..b19b7d1e 100644 --- a/src/Mayaqua/Internat.h +++ b/src/Mayaqua/Internat.h @@ -1,127 +1,127 @@ -// SoftEther VPN Source Code - Developer Edition Master Branch -// Mayaqua Kernel - - -// Internat.h -// Header of Internat.c - -#ifndef INTERNAT_H -#define INTERNAT_H - -// String token -struct UNI_TOKEN_LIST -{ - UINT NumTokens; - wchar_t **Token; -}; - -UINT UniStrLen(wchar_t *str); -UINT UniStrSize(wchar_t *str); -UINT UniStrCpy(wchar_t *dst, UINT size, wchar_t *src); -UINT UniStrCat(wchar_t *dst, UINT size, wchar_t *src); -wchar_t UniToLower(wchar_t c); -wchar_t UniToUpper(wchar_t c); -void UniStrLower(wchar_t *str); -void UniStrUpper(wchar_t *str); -int UniStrCmp(wchar_t *str1, wchar_t *str2); -int UniStrCmpi(wchar_t *str1, wchar_t *str2); -int UniSoftStrCmp(wchar_t *str1, wchar_t *str2); -void UniFormat(wchar_t *buf, UINT size, wchar_t *fmt, ...); -wchar_t *CopyUniFormat(wchar_t *fmt, ...); -void UniFormatArgs(wchar_t *buf, UINT size, wchar_t *fmt, va_list args); -void UniDebugArgs(wchar_t *fmt, va_list args); -void UniDebug(wchar_t *fmt, ...); -void UniPrint(wchar_t *fmt, ...); -void UniPrintArgs(wchar_t *fmt, va_list args); -void UniPrintStr(wchar_t *string); -void UniToStri(wchar_t *str, int i); -void UniToStru(wchar_t *str, UINT i); -UINT UniToInt(wchar_t *str); -void UniToStrForSingleChars(char *dst, UINT dst_size, wchar_t *src); -void UniTrim(wchar_t *str); -void UniTrimLeft(wchar_t *str); -void UniTrimRight(wchar_t *str); -void UniTrimCrlf(wchar_t *str); -bool UniGetLine(wchar_t *str, UINT size); -bool UniGetLineWin32(wchar_t *str, UINT size); -bool UniGetLineUnix(wchar_t *str, UINT size); -void UniFreeToken(UNI_TOKEN_LIST *tokens); -UNI_TOKEN_LIST *UniParseToken(wchar_t *src, wchar_t *separator); -UINT UniSearchStrEx(wchar_t *string, wchar_t *keyword, UINT start, bool case_sensitive); -UINT UniSearchStr(wchar_t *string, wchar_t *keyword, UINT start); -UINT UniCalcReplaceStrEx(wchar_t *string, wchar_t *old_keyword, wchar_t *new_keyword, bool case_sensitive); -UINT UniReplaceStrEx(wchar_t *dst, UINT size, wchar_t *string, wchar_t *old_keyword, wchar_t *new_keyword, bool case_sensitive); -UINT UniReplaceStr(wchar_t *dst, UINT size, wchar_t *string, wchar_t *old_keyword, wchar_t *new_keyword); -UINT GetUniType(wchar_t c); -UINT GetUtf8Type(BYTE *s, UINT size, UINT offset); -UINT CalcUniToUtf8(wchar_t *s); -UINT UniToUtf8(BYTE *u, UINT size, wchar_t *s); -UINT Utf8Len(BYTE *u, UINT size); -UINT CalcUtf8ToUni(BYTE *u, UINT u_size); -UINT Utf8ToUni(wchar_t *s, UINT size, BYTE *u, UINT u_size); -UINT CalcStrToUni(char *str); -UINT StrToUni(wchar_t *s, UINT size, char *str); -UINT CalcUniToStr(wchar_t *s); -UINT UniToStr(char *str, UINT size, wchar_t *s); -bool IsSafeUniStr(wchar_t *str); -bool IsSafeUniChar(wchar_t c); -wchar_t *CopyUniStr(wchar_t *str); -wchar_t *CopyStrToUni(char *str); -UINT UtfToUni(wchar_t *unistr, UINT size, char *utfstr); -char *CopyUniToUtf(wchar_t *unistr); -char *CopyUniToStr(wchar_t *unistr); -wchar_t *CopyUtfToUni(char *utfstr); -UINT64 UniToInt64(wchar_t *str); -UNI_TOKEN_LIST *UniParseCmdLine(wchar_t *str); -UNI_TOKEN_LIST *UniCopyToken(UNI_TOKEN_LIST *src); -wchar_t *UniCopyStr(wchar_t *str); -TOKEN_LIST *UniTokenListToTokenList(UNI_TOKEN_LIST *src); -UNI_TOKEN_LIST *TokenListToUniTokenList(TOKEN_LIST *src); -UNI_TOKEN_LIST *UniNullToken(); -bool UniIsNum(wchar_t *str); -bool IsEmptyUniStr(wchar_t *str); -bool UniIsEmptyStr(wchar_t *str); -void InitInternational(); -void FreeInternational(); -USHORT *WideToUtf16(wchar_t *str); -wchar_t *Utf16ToWide(USHORT *str); -wchar_t *InternalFormatArgs(wchar_t *fmt, va_list args, bool ansi_mode); -UINT UniStrWidth(wchar_t *str); -UNI_TOKEN_LIST *UnixUniParseToken(wchar_t *src, wchar_t *separator); -void UniToStr3(wchar_t *str, UINT size, UINT64 value); -bool UniEndWith(wchar_t *str, wchar_t *key); -bool UniStartWith(wchar_t *str, wchar_t *key); -wchar_t *UniNormalizeCrlf(wchar_t *str); -void UniFreeStrList(LIST *o); -UNI_TOKEN_LIST *UniListToTokenList(LIST *o); -bool UniIsSafeChar(wchar_t c); -BUF *UniStrToBin(wchar_t *str); -bool UniInStr(wchar_t *str, wchar_t *keyword); -bool UniInStrEx(wchar_t *str, wchar_t *keyword, bool case_sensitive); -void ClearUniStr(wchar_t *str, UINT str_size); -bool UniInChar(wchar_t *string, wchar_t c); -UNI_TOKEN_LIST *UniGetLines(wchar_t *str); -wchar_t *UniDefaultTokenSplitChars(); -bool UniIsCharInStr(wchar_t *str, wchar_t c); -UNI_TOKEN_LIST *UniParseTokenWithNullStr(wchar_t *str, wchar_t *split_chars); -UNI_TOKEN_LIST *UniParseTokenWithoutNullStr(wchar_t *str, wchar_t *split_chars); - - -#ifdef OS_UNIX -void GetCurrentCharSet(char *name, UINT size); -UINT UnixCalcStrToUni(char *str); -UINT UnixStrToUni(wchar_t *s, UINT size, char *str); -UINT UnixCalcUniToStr(wchar_t *s); -UINT UnixUniToStr(char *str, UINT size, wchar_t *s); -void *IconvWideToStr(); -void *IconvStrToWide(); -int IconvFree(void *d); -void *IconvWideToStrInternal(); -void *IconvStrToWideInternal(); -int IconvFreeInternal(void *d); -#endif // OS_UNIX - -#endif // INTERNAT_H - - - +// SoftEther VPN Source Code - Developer Edition Master Branch +// Mayaqua Kernel + + +// Internat.h +// Header of Internat.c + +#ifndef INTERNAT_H +#define INTERNAT_H + +// String token +struct UNI_TOKEN_LIST +{ + UINT NumTokens; + wchar_t **Token; +}; + +UINT UniStrLen(wchar_t *str); +UINT UniStrSize(wchar_t *str); +UINT UniStrCpy(wchar_t *dst, UINT size, wchar_t *src); +UINT UniStrCat(wchar_t *dst, UINT size, wchar_t *src); +wchar_t UniToLower(wchar_t c); +wchar_t UniToUpper(wchar_t c); +void UniStrLower(wchar_t *str); +void UniStrUpper(wchar_t *str); +int UniStrCmp(wchar_t *str1, wchar_t *str2); +int UniStrCmpi(wchar_t *str1, wchar_t *str2); +int UniSoftStrCmp(wchar_t *str1, wchar_t *str2); +void UniFormat(wchar_t *buf, UINT size, wchar_t *fmt, ...); +wchar_t *CopyUniFormat(wchar_t *fmt, ...); +void UniFormatArgs(wchar_t *buf, UINT size, wchar_t *fmt, va_list args); +void UniDebugArgs(wchar_t *fmt, va_list args); +void UniDebug(wchar_t *fmt, ...); +void UniPrint(wchar_t *fmt, ...); +void UniPrintArgs(wchar_t *fmt, va_list args); +void UniPrintStr(wchar_t *string); +void UniToStri(wchar_t *str, int i); +void UniToStru(wchar_t *str, UINT i); +UINT UniToInt(wchar_t *str); +void UniToStrForSingleChars(char *dst, UINT dst_size, wchar_t *src); +void UniTrim(wchar_t *str); +void UniTrimLeft(wchar_t *str); +void UniTrimRight(wchar_t *str); +void UniTrimCrlf(wchar_t *str); +bool UniGetLine(wchar_t *str, UINT size); +bool UniGetLineWin32(wchar_t *str, UINT size); +bool UniGetLineUnix(wchar_t *str, UINT size); +void UniFreeToken(UNI_TOKEN_LIST *tokens); +UNI_TOKEN_LIST *UniParseToken(wchar_t *src, wchar_t *separator); +UINT UniSearchStrEx(wchar_t *string, wchar_t *keyword, UINT start, bool case_sensitive); +UINT UniSearchStr(wchar_t *string, wchar_t *keyword, UINT start); +UINT UniCalcReplaceStrEx(wchar_t *string, wchar_t *old_keyword, wchar_t *new_keyword, bool case_sensitive); +UINT UniReplaceStrEx(wchar_t *dst, UINT size, wchar_t *string, wchar_t *old_keyword, wchar_t *new_keyword, bool case_sensitive); +UINT UniReplaceStr(wchar_t *dst, UINT size, wchar_t *string, wchar_t *old_keyword, wchar_t *new_keyword); +UINT GetUniType(wchar_t c); +UINT GetUtf8Type(BYTE *s, UINT size, UINT offset); +UINT CalcUniToUtf8(wchar_t *s); +UINT UniToUtf8(BYTE *u, UINT size, wchar_t *s); +UINT Utf8Len(BYTE *u, UINT size); +UINT CalcUtf8ToUni(BYTE *u, UINT u_size); +UINT Utf8ToUni(wchar_t *s, UINT size, BYTE *u, UINT u_size); +UINT CalcStrToUni(char *str); +UINT StrToUni(wchar_t *s, UINT size, char *str); +UINT CalcUniToStr(wchar_t *s); +UINT UniToStr(char *str, UINT size, wchar_t *s); +bool IsSafeUniStr(wchar_t *str); +bool IsSafeUniChar(wchar_t c); +wchar_t *CopyUniStr(wchar_t *str); +wchar_t *CopyStrToUni(char *str); +UINT UtfToUni(wchar_t *unistr, UINT size, char *utfstr); +char *CopyUniToUtf(wchar_t *unistr); +char *CopyUniToStr(wchar_t *unistr); +wchar_t *CopyUtfToUni(char *utfstr); +UINT64 UniToInt64(wchar_t *str); +UNI_TOKEN_LIST *UniParseCmdLine(wchar_t *str); +UNI_TOKEN_LIST *UniCopyToken(UNI_TOKEN_LIST *src); +wchar_t *UniCopyStr(wchar_t *str); +TOKEN_LIST *UniTokenListToTokenList(UNI_TOKEN_LIST *src); +UNI_TOKEN_LIST *TokenListToUniTokenList(TOKEN_LIST *src); +UNI_TOKEN_LIST *UniNullToken(); +bool UniIsNum(wchar_t *str); +bool IsEmptyUniStr(wchar_t *str); +bool UniIsEmptyStr(wchar_t *str); +void InitInternational(); +void FreeInternational(); +USHORT *WideToUtf16(wchar_t *str); +wchar_t *Utf16ToWide(USHORT *str); +wchar_t *InternalFormatArgs(wchar_t *fmt, va_list args, bool ansi_mode); +UINT UniStrWidth(wchar_t *str); +UNI_TOKEN_LIST *UnixUniParseToken(wchar_t *src, wchar_t *separator); +void UniToStr3(wchar_t *str, UINT size, UINT64 value); +bool UniEndWith(wchar_t *str, wchar_t *key); +bool UniStartWith(wchar_t *str, wchar_t *key); +wchar_t *UniNormalizeCrlf(wchar_t *str); +void UniFreeStrList(LIST *o); +UNI_TOKEN_LIST *UniListToTokenList(LIST *o); +bool UniIsSafeChar(wchar_t c); +BUF *UniStrToBin(wchar_t *str); +bool UniInStr(wchar_t *str, wchar_t *keyword); +bool UniInStrEx(wchar_t *str, wchar_t *keyword, bool case_sensitive); +void ClearUniStr(wchar_t *str, UINT str_size); +bool UniInChar(wchar_t *string, wchar_t c); +UNI_TOKEN_LIST *UniGetLines(wchar_t *str); +wchar_t *UniDefaultTokenSplitChars(); +bool UniIsCharInStr(wchar_t *str, wchar_t c); +UNI_TOKEN_LIST *UniParseTokenWithNullStr(wchar_t *str, wchar_t *split_chars); +UNI_TOKEN_LIST *UniParseTokenWithoutNullStr(wchar_t *str, wchar_t *split_chars); + + +#ifdef OS_UNIX +void GetCurrentCharSet(char *name, UINT size); +UINT UnixCalcStrToUni(char *str); +UINT UnixStrToUni(wchar_t *s, UINT size, char *str); +UINT UnixCalcUniToStr(wchar_t *s); +UINT UnixUniToStr(char *str, UINT size, wchar_t *s); +void *IconvWideToStr(); +void *IconvStrToWide(); +int IconvFree(void *d); +void *IconvWideToStrInternal(); +void *IconvStrToWideInternal(); +int IconvFreeInternal(void *d); +#endif // OS_UNIX + +#endif // INTERNAT_H + + + diff --git a/src/Mayaqua/Kernel.c b/src/Mayaqua/Kernel.c index 78d69a49..11ef7392 100644 --- a/src/Mayaqua/Kernel.c +++ b/src/Mayaqua/Kernel.c @@ -1,2125 +1,2125 @@ -// SoftEther VPN Source Code - Developer Edition Master Branch -// Mayaqua Kernel - - -// Kernel.c -// System service processing routine - -#include - -#include -#include -#include -#include -#include -#include -#include -#include - -#ifndef TM_YEAR_MAX -#define TM_YEAR_MAX 2106 -#endif -#ifndef TM_MON_MAX -#define TM_MON_MAX 1 -#endif -#ifndef TM_MDAY_MAX -#define TM_MDAY_MAX 7 -#endif -#ifndef TM_HOUR_MAX -#define TM_HOUR_MAX 6 -#endif -#ifndef TM_MIN_MAX -#define TM_MIN_MAX 28 -#endif -#ifndef TM_SEC_MAX -#define TM_SEC_MAX 14 -#endif - -#define ADJUST_TM(tm_member, tm_carry, modulus) \ - if ((tm_member) < 0){ \ - tm_carry -= (1 - ((tm_member)+1) / (modulus)); \ - tm_member = (modulus-1) + (((tm_member)+1) % (modulus)); \ - } else if ((tm_member) >= (modulus)) { \ - tm_carry += (tm_member) / (modulus); \ - tm_member = (tm_member) % (modulus); \ - } -#define leap(y) (((y) % 4 == 0 && (y) % 100 != 0) || (y) % 400 == 0) -#define nleap(y) (((y) - 1969) / 4 - ((y) - 1901) / 100 + ((y) - 1601) / 400) -#define leapday(m, y) ((m) == 1 && leap (y)) -#define monthlen(m, y) (ydays[(m)+1] - ydays[m] + leapday (m, y)) -static int ydays[] = -{ - 0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334, 365 -}; - -static UINT current_num_thread = 0; -static UINT cached_number_of_cpus = 0; - - - -static wchar_t *default_locale_str = -L"- - $ : : $ Sun Mon Tue Wed Thu Fri Sat : : : $ (None)"; - - -static LOCALE current_locale; -LOCK *tick_manual_lock = NULL; - -#define MONSPERYEAR 12 -#define DAYSPERNYEAR 365 -#define DAYSPERLYEAR 366 -#define SECSPERMIN 60 -#define SECSPERHOUR (60*60) -#define SECSPERDAY (24*60*60) -#define DAYSPERWEEK 7 -#define TM_SUNDAY 0 -#define TM_MONDAY 1 -#define TM_TUESDAY 2 -#define TM_WEDNESDAY 3 -#define TM_THURSDAY 4 -#define TM_FRIDAY 5 -#define TM_SATURDAY 6 - -#define TM_YEAR_BASE 1900 - -#define EPOCH_YEAR 1970 -#define EPOCH_WDAY TM_THURSDAY - -#define isleap(y) (((y) % 4) == 0 && (((y) % 100) != 0 || ((y) % 400) == 0)) - -static const int mon_lengths[2][MONSPERYEAR] = { - { 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 }, - { 31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 } -}; - -static const int year_lengths[2] = { - DAYSPERNYEAR, DAYSPERLYEAR -}; - - -/* - * Taken from FreeBSD src / lib / libc / stdtime / localtime.c 1.43 revision. - * localtime.c 7.78. - * tzfile.h 1.8 - * adapted to be replacement gmtime_r. - */ -static void -c_timesub(timep, offset, tmp) -const time_64t * const timep; -const long offset; -struct tm * const tmp; -{ - INT64 days; - INT64 rem; - INT64 y; - int yleap; - const int * ip; - - days = *timep / SECSPERDAY; - rem = *timep % SECSPERDAY; - rem += (offset); - while (rem < 0) { - rem += SECSPERDAY; - --days; - } - while (rem >= SECSPERDAY) { - rem -= SECSPERDAY; - ++days; - } - tmp->tm_hour = (int) (rem / SECSPERHOUR); - rem = rem % SECSPERHOUR; - tmp->tm_min = (int) (rem / SECSPERMIN); - /* - ** A positive leap second requires a special - ** representation. This uses "... ??:59:60" et seq. - */ - tmp->tm_sec = (int) (rem % SECSPERMIN) ; - tmp->tm_wday = (int) ((EPOCH_WDAY + days) % DAYSPERWEEK); - if (tmp->tm_wday < 0) - tmp->tm_wday += DAYSPERWEEK; - y = EPOCH_YEAR; -#define LEAPS_THRU_END_OF(y) ((y) / 4 - (y) / 100 + (y) / 400) - while (days < 0 || days >= (long) year_lengths[yleap = isleap(y)]) { - INT64 newy; - - newy = y + days / DAYSPERNYEAR; - if (days < 0) - --newy; - days -= (newy - y) * DAYSPERNYEAR + - LEAPS_THRU_END_OF(newy - 1) - - LEAPS_THRU_END_OF(y - 1); - y = newy; - } - tmp->tm_year = (int)(y - TM_YEAR_BASE); - tmp->tm_yday = (int) days; - ip = mon_lengths[yleap]; - for (tmp->tm_mon = 0; days >= (INT64) ip[tmp->tm_mon]; ++(tmp->tm_mon)) - days = days - (INT64) ip[tmp->tm_mon]; - tmp->tm_mday = (int) (days + 1); - tmp->tm_isdst = 0; -} - -/* -* Re-entrant version of gmtime. -*/ -struct tm * c_gmtime_r(const time_64t* timep, struct tm *tm) -{ - c_timesub(timep, 0L, tm); - return tm; -} - -// Get the real-time system timer -UINT TickRealtime() -{ -#if defined(OS_WIN32) || defined(CLOCK_REALTIME) || defined(CLOCK_MONOTONIC) || defined(CLOCK_HIGHRES) || defined(UNIX_MACOS) - return Tick() + 1; -#else - return TickRealtimeManual() + 1; -#endif -} - -#ifndef OS_WIN32 - -static UINT64 last_manual_tick = 0; -static UINT64 manual_tick_add_value = 0; - -// For systems which not have clock_gettime (such as MacOS X) -UINT TickRealtimeManual() -{ - UINT64 ret; - Lock(tick_manual_lock); - { - ret = TickGetRealtimeTickValue64(); - - if (last_manual_tick != 0 && (last_manual_tick > ret)) - { - manual_tick_add_value += (last_manual_tick - ret); - } - - last_manual_tick = ret; - } - Unlock(tick_manual_lock); - - return (UINT)(ret + manual_tick_add_value); -} - -// Returns a appropriate value from the current time -UINT64 TickGetRealtimeTickValue64() -{ - struct timeval tv; - struct timezone tz; - UINT64 ret; - - memset(&tv, 0, sizeof(tv)); - memset(&tz, 0, sizeof(tz)); - - gettimeofday(&tv, &tz); - - if (sizeof(tv.tv_sec) != 4) - { - ret = (UINT64)tv.tv_sec * 1000ULL + (UINT64)tv.tv_usec / 1000ULL; - } - else - { - ret = (UINT64)((UINT64)((UINT)tv.tv_sec)) * 1000ULL + (UINT64)tv.tv_usec / 1000ULL; - } - - return ret; -} - -#endif // OS_WIN32 - -// Get the number of CPUs -UINT GetNumberOfCpu() -{ - UINT ret = 0; - - if (cached_number_of_cpus == 0) - { - UINT i = 0; - -#ifdef OS_WIN32 - i = Win32GetNumberOfCpuInner(); -#else // OS_WIN32 - i = UnixGetNumberOfCpuInner(); -#endif // OS_WIN32 - - if (i == 0) - { - i = 8; - } - - cached_number_of_cpus = i; - } - - ret = cached_number_of_cpus; - - if (ret == 0) - { - ret = 1; - } - if (ret > 128) - { - ret = 128; - } - - return ret; -} - -// Creating a thread list -LIST *NewThreadList() -{ - LIST *o = NewList(NULL); - - return o; -} - -// Add the thread to the thread list -void AddThreadToThreadList(LIST *o, THREAD *t) -{ - // Validate arguments - if (o == NULL || t == NULL) - { - return; - } - - LockList(o); - { - if (IsInList(o, t) == false) - { - AddRef(t->ref); - - Add(o, t); - } - } - UnlockList(o); -} - -// Maintain thread list -void MaintainThreadList(LIST *o) -{ - UINT i; - LIST *delete_list = NULL; - // Validate arguments - if (o == NULL) - { - return; - } - - LockList(o); - { - for (i = 0;i < LIST_NUM(o);i++) - { - THREAD *t = LIST_DATA(o, i); - - if (t->Stopped) - { - if (delete_list == NULL) - { - delete_list = NewListFast(NULL); - } - - Add(delete_list, t); - } - } - - if (delete_list != NULL) - { - for (i = 0;i < LIST_NUM(delete_list);i++) - { - THREAD *t = LIST_DATA(delete_list, i); - - ReleaseThread(t); - - Delete(o, t); - } - - ReleaseList(delete_list); - } - } - UnlockList(o); -} - -// Stop all the threads in the thread list -void StopThreadList(LIST *o) -{ - UINT i; - // Validate arguments - if (o == NULL) - { - return; - } - - LockList(o); - { - for (i = 0;i < LIST_NUM(o);i++) - { - THREAD *t = LIST_DATA(o, i); - - WaitThread(t, INFINITE); - } - } - UnlockList(o); -} - -// Release the thread list -void FreeThreadList(LIST *o) -{ - UINT i; - // Validate arguments - if (o == NULL) - { - return; - } - - LockList(o); - { - for (i = 0;i < LIST_NUM(o);i++) - { - THREAD *t = LIST_DATA(o, i); - - WaitThread(t, INFINITE); - - ReleaseThread(t); - } - - DeleteAll(o); - } - UnlockList(o); - - ReleaseList(o); -} - -// Get the home directory -void GetHomeDirW(wchar_t *path, UINT size) -{ - // Validate arguments - if (path == NULL) - { - return; - } - - if (GetEnvW(L"HOME", path, size) == false) - { - wchar_t drive[MAX_SIZE]; - wchar_t hpath[MAX_SIZE]; - if (GetEnvW(L"HOMEDRIVE", drive, sizeof(drive)) && - GetEnvW(L"HOMEPATH", hpath, sizeof(hpath))) - { - UniFormat(path, size, L"%s%s", drive, hpath); - } - else - { -#ifdef OS_WIN32 - Win32GetCurrentDirW(path, size); -#else // OS_WIN32 - UnixGetCurrentDirW(path, size); -#endif // OS_WIN32 - } - } -} - -// Get the environment variable string -bool GetEnv(char *name, char *data, UINT size) -{ - char *ret; - // Validate arguments - if (name == NULL || data == NULL) - { - return false; - } - - StrCpy(data, size, ""); - - ret = getenv(name); - if (ret == NULL) - { - return false; - } - - StrCpy(data, size, ret); - - return true; -} -bool GetEnvW(wchar_t *name, wchar_t *data, UINT size) -{ -#ifdef OS_WIN32 - return GetEnvW_ForWin32(name, data, size); -#else // OS_WIN32 - return GetEnvW_ForUnix(name, data, size); -#endif // OS_WIN32 -} - -#ifdef OS_WIN32 -bool GetEnvW_ForWin32(wchar_t *name, wchar_t *data, UINT size) -{ - wchar_t *ret; - // Validate arguments - if (name == NULL || data == NULL) - { - return false; - } - - if (IsNt() == false) - { - bool ret; - char *name_a = CopyUniToStr(name); - char data_a[MAX_SIZE]; - - ret = GetEnv(name_a, data_a, sizeof(data_a)); - - if (ret) - { - StrToUni(data, size, data_a); - } - - Free(name_a); - - return ret; - } - - UniStrCpy(data, size, L""); - - ret = _wgetenv(name); - if (ret == NULL) - { - return false; - } - - UniStrCpy(data, size, ret); - - return true; -} - -#endif // OS_WIN32 - -#ifdef OS_UNIX - -bool GetEnvW_ForUnix(wchar_t *name, wchar_t *data, UINT size) -{ - char *name_a; - bool ret; - char data_a[MAX_SIZE]; - // Validate arguments - if (name == NULL || data == NULL) - { - return false; - } - - name_a = CopyUniToUtf(name); - - ret = GetEnv(name_a, data_a, sizeof(data_a)); - - if (ret) - { - UtfToUni(data, size, data_a); - } - - Free(name_a); - - return ret; -} - -#endif // OS_UNIX - -// Get the memory information -void GetMemInfo(MEMINFO *info) -{ - OSGetMemInfo(info); -} - -// Start the single-instance -INSTANCE *NewSingleInstance(char *instance_name) -{ - return NewSingleInstanceEx(instance_name, false); -} -INSTANCE *NewSingleInstanceEx(char *instance_name, bool user_local) -{ - char name[MAX_SIZE]; - INSTANCE *ret; - void *data; - - if (instance_name != NULL) - { - if (user_local == false) - { - HashInstanceName(name, sizeof(name), instance_name); - } - else - { - HashInstanceNameLocal(name, sizeof(name), instance_name); - } - - data = OSNewSingleInstance(name); - } - else - { - data = OSNewSingleInstance(NULL); - } - - if (data == NULL) - { - return NULL; - } - - ret = ZeroMalloc(sizeof(INSTANCE)); - if (instance_name != NULL) - { - ret->Name = CopyStr(instance_name); - } - - ret->pData = data; - - return ret; -} - -// Release of single instance -void FreeSingleInstance(INSTANCE *inst) -{ - // Validate arguments - if (inst == NULL) - { - return; - } - - OSFreeSingleInstance(inst->pData); - - if (inst->Name != NULL) - { - Free(inst->Name); - } - Free(inst); -} - -// Hashing the instance name -void HashInstanceName(char *name, UINT size, char *instance_name) -{ - char tmp[MAX_SIZE]; - UCHAR hash[SHA1_SIZE]; - char key[11]; - // Validate arguments - if (name == NULL || instance_name == NULL) - { - return; - } - - StrCpy(tmp, sizeof(tmp), instance_name); - Trim(tmp); - StrUpper(tmp); - - Sha0(hash, tmp, StrLen(tmp)); - BinToStr(key, sizeof(key), hash, 5); - key[10] = 0; - - Format(name, size, "VPN-%s", key); - - if (OS_IS_WINDOWS_NT(GetOsInfo()->OsType)) - { - if (GET_KETA(GetOsInfo()->OsType, 100) >= 2 || - GetOsInfo()->OsType == OSTYPE_WINDOWS_NT_4_TERMINAL_SERVER) - { - StrCpy(tmp, sizeof(tmp), name); - Format(name, size, "Global\\%s", tmp); - } - } -} -void HashInstanceNameLocal(char *name, UINT size, char *instance_name) -{ - char tmp[MAX_SIZE]; - UCHAR hash[SHA1_SIZE]; - char key[11]; - // Validate arguments - if (name == NULL || instance_name == NULL) - { - return; - } - - StrCpy(tmp, sizeof(tmp), instance_name); - Trim(tmp); - StrUpper(tmp); - - Sha0(hash, tmp, StrLen(tmp)); - BinToStr(key, sizeof(key), hash, 5); - key[10] = 0; - - Format(name, size, "VPN-%s", key); - - if (OS_IS_WINDOWS_NT(GetOsInfo()->OsType)) - { - if (GET_KETA(GetOsInfo()->OsType, 100) >= 2 || - GetOsInfo()->OsType == OSTYPE_WINDOWS_NT_4_TERMINAL_SERVER) - { - StrCpy(tmp, sizeof(tmp), name); - Format(name, size, "Local\\%s", tmp); - } - } -} - -// Run the process -bool Run(char *filename, char *arg, bool hide, bool wait) -{ - // Validate arguments - if (filename == NULL) - { - return false; - } - - return OSRun(filename, arg, hide, wait); -} -bool RunW(wchar_t *filename, wchar_t *arg, bool hide, bool wait) -{ - // Validate arguments - if (filename == NULL) - { - return false; - } - - return OSRunW(filename, arg, hide, wait); -} - -// Date and time related functions -void GetDateTimeStr64Uni(wchar_t *str, UINT size, UINT64 sec64) -{ - char tmp[MAX_SIZE]; - if (str == NULL) - { - return; - } - - GetDateTimeStr64(tmp, sizeof(tmp), sec64); - StrToUni(str, size, tmp); -} -void GetDateTimeStr64(char *str, UINT size, UINT64 sec64) -{ - SYSTEMTIME st; - UINT64ToSystem(&st, sec64); - GetDateTimeStr(str, size, &st); -} -void GetDateTimeStrMilli64(char *str, UINT size, UINT64 sec64) -{ - SYSTEMTIME st; - UINT64ToSystem(&st, sec64); - GetDateTimeStrMilli(str, size, &st); -} -void GetDateTimeStrMilli64ForFileName(char *str, UINT size, UINT64 sec64) -{ - SYSTEMTIME st; - UINT64ToSystem(&st, sec64); - GetDateTimeStrMilliForFileName(str, size, &st); -} -void GetDateTimeStrMilliForFileName(char *str, UINT size, SYSTEMTIME *tm) -{ - Format(str, size, "%04u%02u%02u_%02u%02u%02u", - tm->wYear, tm->wMonth, tm->wDay, tm->wHour, tm->wMinute, tm->wSecond); -} -void GetDateStr64(char *str, UINT size, UINT64 sec64) -{ - SYSTEMTIME st; - if (sec64 == 0) - { - StrCpy(str, size, "(Unknown)"); - return; - } - UINT64ToSystem(&st, sec64); - GetDateStr(str, size, &st); -} -void GetDateTimeStrEx64(wchar_t *str, UINT size, UINT64 sec64, LOCALE *locale) -{ - SYSTEMTIME st; - if (locale == NULL) - { - locale = ¤t_locale; - } - if (sec64 == 0 || SystemToLocal64(sec64) == 0 || LocalToSystem64(sec64) == 0) - { - UniStrCpy(str, size, locale->Unknown); - return; - } - UINT64ToSystem(&st, sec64); - GetDateTimeStrEx(str, size, &st, locale); -} -void GetDateStrEx64(wchar_t *str, UINT size, UINT64 sec64, LOCALE *locale) -{ - SYSTEMTIME st; - if (locale == NULL) - { - locale = ¤t_locale; - } - if (sec64 == 0 || SystemToLocal64(sec64) == 0 || LocalToSystem64(sec64) == 0) - { - UniStrCpy(str, size, locale->Unknown); - return; - } - UINT64ToSystem(&st, sec64); - GetDateStrEx(str, size, &st, locale); -} -void GetTimeStrMilli64(char *str, UINT size, UINT64 sec64) -{ - SYSTEMTIME st; - if (sec64 == 0 || SystemToLocal64(sec64) == 0 || LocalToSystem64(sec64) == 0) - { - StrCpy(str, size, "(Unknown)"); - return; - } - UINT64ToSystem(&st, sec64); - GetTimeStrMilli(str, size, &st); -} - -// Convert to a time to be used safely in the current POSIX implementation -UINT64 SafeTime64(UINT64 sec64) -{ - return MAKESURE(sec64, 0, 4102243323123ULL); -} - -// Thread pool -static SK *thread_pool = NULL; -static COUNTER *thread_count = NULL; - -// Initialization of thread pool -void InitThreading() -{ - thread_pool = NewSk(); - thread_count = NewCounter(); -} - -// Release of thread pool -void FreeThreading() -{ - while (true) - { - if (Count(thread_count) == 0) - { - break; - } - - SleepThread(25); - } - - while (true) - { - THREAD_POOL_DATA *pd; - THREAD *t = Pop(thread_pool); - - if (t == NULL) - { - break; - } - - pd = (THREAD_POOL_DATA *)t->param; - - pd->ThreadProc = NULL; - Set(pd->Event); - - WaitThreadInternal(t); - - pd = (THREAD_POOL_DATA *)t->param; - ReleaseEvent(pd->Event); - ReleaseEvent(pd->InitFinishEvent); - - ReleaseThreadInternal(t); - - Free(pd); - } - - ReleaseSk(thread_pool); - - DeleteCounter(thread_count); - thread_count = NULL; -} - -// Thread pool procedure -void ThreadPoolProc(THREAD *t, void *param) -{ - THREAD_POOL_DATA *pd; - // Validate arguments - if (t == NULL) - { - return; - } - - pd = (THREAD_POOL_DATA *)param; - - NoticeThreadInitInternal(t); - - while (true) - { - THREAD *thread; - UINT i, num; - EVENT **ee; - - // Wait for the next job - Wait(pd->Event, INFINITE); - - if (pd->ThreadProc == NULL) - { - // Stop the pool thread - break; - } - - thread = pd->Thread; - thread->ThreadId = ThreadId(); - - // Initialization is completed - Set(pd->InitFinishEvent); - - // Set the thread name - if (thread->Name != NULL) - { - SetThreadName(thread->ThreadId, thread->Name, thread->param); - } - else - { - SetThreadName(thread->ThreadId, "Unknown", 0); - } - - // Run the thread procedure - pd->ThreadProc(pd->Thread, thread->param); - - // Set the thread name - SetThreadName(thread->ThreadId, NULL, 0); - - pd->Thread->Stopped = true; - - thread->PoolHalting = true; - - // Set the waiting event list - LockList(thread->PoolWaitList); - { - num = LIST_NUM(thread->PoolWaitList); - ee = ToArray(thread->PoolWaitList); - - DeleteAll(thread->PoolWaitList); - } - UnlockList(thread->PoolWaitList); - - for (i = 0;i < num;i++) - { - EVENT *e = ee[i]; - - Set(e); - ReleaseEvent(e); - } - - Free(ee); - - while (true) - { - if (Count(thread->ref->c) <= 1) - { - break; - } - - Wait(thread->release_event, 256); - } - - ReleaseThread(thread); - -#ifdef OS_WIN32 - // For Win32: Recover the priority of the thread - MsRestoreThreadPriority(); -#endif // OS_WIN32 - - // Register the thread itself to the thread pool - LockSk(thread_pool); - { - Push(thread_pool, t); - } - UnlockSk(thread_pool); - - Dec(thread_count); - } -} - -// Set the thread name -void SetThreadName(UINT thread_id, char *name, void *param) -{ -#ifdef OS_WIN32 - if (IsDebug()) - { - char tmp[MAX_SIZE]; - - if (name == NULL) - { - strcpy(tmp, "idle"); - } - else - { - sprintf(tmp, "%s (0x%x)", name, (UINT)param); - } - - Win32SetThreadName(thread_id, tmp); - } -#else // OS_WIN32 -#ifdef _DEBUG -#ifdef PR_SET_NAME - char tmp[MAX_SIZE]; - - if (name == NULL) - { - strcpy(tmp, "idle"); - } - else - { - sprintf(tmp, "%s (%p)", name, param); - } - - tmp[15] = 0; - - prctl(PR_SET_NAME, (unsigned long)tmp, 0, 0, 0); -#endif // PR_SET_NAME -#endif // _DEBUG -#endif // OS_WIN32 -} - -// Thread creation (pool) -THREAD *NewThreadNamed(THREAD_PROC *thread_proc, void *param, char *name) -{ - THREAD *host = NULL; - THREAD_POOL_DATA *pd = NULL; - THREAD *ret; - // Validate arguments - if (thread_proc == NULL) - { - return NULL; - } - - Inc(thread_count); - - LockSk(thread_pool); - { - // Examine whether there is a thread that is currently vacant in the pool - host = Pop(thread_pool); - } - UnlockSk(thread_pool); - - if (host == NULL) - { - // Create a new thread because a vacant thread is not found - pd = ZeroMalloc(sizeof(THREAD_POOL_DATA)); - pd->Event = NewEvent(); - pd->InitFinishEvent = NewEvent(); - host = NewThreadInternal(ThreadPoolProc, pd); - WaitThreadInitInternal(host); - } - else - { - pd = (THREAD_POOL_DATA *)host->param; - } - - // Creating a thread pool - ret = ZeroMalloc(sizeof(THREAD)); - ret->ref = NewRef(); - ret->thread_proc = thread_proc; - ret->param = param; - ret->pData = NULL; - ret->init_finished_event = NewEvent(); - ret->PoolThread = true; - ret->PoolWaitList = NewList(NULL); - ret->PoolHostThread = host; - ret->release_event = NewEvent(); - - if (IsEmptyStr(name) == false) - { - ret->Name = CopyStr(name); - } - - // Run - pd->ThreadProc = thread_proc; - pd->Thread = ret; - AddRef(ret->ref); - - Set(pd->Event); - - Wait(pd->InitFinishEvent, INFINITE); - - current_num_thread++; - -// Debug("current_num_thread = %u\n", current_num_thread); - - return ret; -} - -// Clean up of thread (pool) -void CleanupThread(THREAD *t) -{ - // Validate arguments - if (t == NULL) - { - return; - } - - ReleaseEvent(t->init_finished_event); - ReleaseEvent(t->release_event); - ReleaseList(t->PoolWaitList); - - if (t->Name != NULL) - { - Free(t->Name); - } - - Free(t); - - current_num_thread--; - //Debug("current_num_thread = %u\n", current_num_thread); -} - -// Release thread (pool) -void ReleaseThread(THREAD *t) -{ - UINT ret; - EVENT *e; - // Validate arguments - if (t == NULL) - { - return; - } - - e = t->release_event; - if (e != NULL) - { - AddRef(e->ref); - } - - ret = Release(t->ref); - Set(e); - - ReleaseEvent(e); - - if (ret == 0) - { - CleanupThread(t); - } -} - -// Notify the completion of the thread initialization (pool) -void NoticeThreadInit(THREAD *t) -{ - // Validate arguments - if (t == NULL) - { - return; - } - - // Notification - Set(t->init_finished_event); -} - -// Wait the completion of the thread initialization (pool) -void WaitThreadInit(THREAD *t) -{ - // Validate arguments - if (t == NULL) - { - return; - } - - // KS - KS_INC(KS_WAITFORTHREAD_COUNT); - - // Wait - Wait(t->init_finished_event, INFINITE); -} - -// Wait for the termination of the thread (pool) -bool WaitThread(THREAD *t, UINT timeout) -{ - bool ret = false; - EVENT *e = NULL; - // Validate arguments - if (t == NULL) - { - return false; - } - - LockList(t->PoolWaitList); - { - if (t->PoolHalting) - { - // Has already been stopped - ret = true; - } - else - { - // Register the completion notifying event to the list - e = NewEvent(); - AddRef(e->ref); - Insert(t->PoolWaitList, e); - } - } - UnlockList(t->PoolWaitList); - - if (e != NULL) - { - // Wait Event - ret = Wait(e, timeout); - - LockList(t->PoolWaitList); - { - if (Delete(t->PoolWaitList, e)) - { - ReleaseEvent(e); - } - } - UnlockList(t->PoolWaitList); - - ReleaseEvent(e); - } - - return ret; -} - -// Get Thread ID -UINT ThreadId() -{ - return OSThreadId(); -} - -// Creating a thread -THREAD *NewThreadInternal(THREAD_PROC *thread_proc, void *param) -{ - THREAD *t; - UINT retry = 0; - // Validate arguments - if (thread_proc == NULL) - { - return NULL; - } - - // Initialize Thread object - t = ZeroMalloc(sizeof(THREAD)); - t->init_finished_event = NewEvent(); - - t->param = param; - t->ref = NewRef(); - t->thread_proc = thread_proc; - - // Wait until the OS to initialize the thread - while (true) - { - if ((retry++) > 60) - { - printf("\n\n*** error: new thread create failed.\n\n"); - AbortExit(); - } - if (OSInitThread(t)) - { - break; - } - SleepThread(500); - } - - // KS - KS_INC(KS_NEWTHREAD_COUNT); - - return t; -} - -// Release of thread -void ReleaseThreadInternal(THREAD *t) -{ - // Validate arguments - if (t == NULL) - { - return; - } - - if (Release(t->ref) == 0) - { - CleanupThreadInternal(t); - } -} - -// Clean up of the thread -void CleanupThreadInternal(THREAD *t) -{ - // Validate arguments - if (t == NULL) - { - return; - } - - // Release of the thread - OSFreeThread(t); - - // Release the event - ReleaseEvent(t->init_finished_event); - // Memory release - Free(t); - - // KS - KS_INC(KS_FREETHREAD_COUNT); -} - -// Wait for the termination of the thread -bool WaitThreadInternal(THREAD *t) -{ - // Validate arguments - if (t == NULL) - { - return false; - } - - return OSWaitThread(t); -} - -// Notify that the thread initialization is complete -void NoticeThreadInitInternal(THREAD *t) -{ - // Validate arguments - if (t == NULL) - { - return; - } - - // Notify - Set(t->init_finished_event); -} - -// Wait for completion of thread initialization -void WaitThreadInitInternal(THREAD *t) -{ - // Validate arguments - if (t == NULL) - { - return; - } - - // KS - KS_INC(KS_WAITFORTHREAD_COUNT); - - // Wait - Wait(t->init_finished_event, INFINITE); -} - -// Get the date and time string by using the locale information -void GetDateTimeStrEx(wchar_t *str, UINT size, SYSTEMTIME *st, LOCALE *locale) -{ - wchar_t tmp1[MAX_SIZE]; - wchar_t tmp2[MAX_SIZE]; - // Validate arguments - if (str == NULL || st == NULL) - { - return; - } - - GetDateStrEx(tmp1, sizeof(tmp1), st, locale); - GetTimeStrEx(tmp2, sizeof(tmp2), st, locale); - UniFormat(str, size, L"%s %s", tmp1, tmp2); -} - -// Get the time string by using the locale information -void GetTimeStrEx(wchar_t *str, UINT size, SYSTEMTIME *st, LOCALE *locale) -{ - wchar_t *tag = L"%02u%s%02u%s%02u%s"; - // Validate arguments - if (str == NULL || st == NULL) - { - return; - } - - if (_GETLANG() == SE_LANG_JAPANESE || _GETLANG() == SE_LANG_CHINESE_ZH) - { - tag = L"%2u%s%2u%s%2u%s"; - } - - locale = (locale != NULL ? locale : ¤t_locale); - UniFormat(str, size, - tag, - st->wHour, locale->HourStr, - st->wMinute, locale->MinuteStr, - st->wSecond, locale->SecondStr); -} - -// Get a date string by using the locale information -void GetDateStrEx(wchar_t *str, UINT size, SYSTEMTIME *st, LOCALE *locale) -{ - wchar_t *tag = L"%04u%s%02u%s%02u%s (%s)"; - // Validate arguments - if (str == NULL || st == NULL) - { - return; - } - - if (_GETLANG() == SE_LANG_JAPANESE || _GETLANG() == SE_LANG_CHINESE_ZH) - { - tag = L"%4u%s%2u%s%2u%s(%s)"; - } - - locale = (locale != NULL ? locale : ¤t_locale); - UniFormat(str, size, - tag, - st->wYear, locale->YearStr, - st->wMonth, locale->MonthStr, - st->wDay, locale->DayStr, - locale->DayOfWeek[st->wDayOfWeek]); -} - -// Get the time string to milliseconds (for example, 12:34:56.789) -void GetTimeStrMilli(char *str, UINT size, SYSTEMTIME *st) -{ - // Validate arguments - if (st == NULL || str == NULL) - { - return; - } - - Format(str, size, "%02u:%02u:%02u.%03u", - st->wHour, st->wMinute, st->wSecond, st->wMilliseconds); -} - -// Get the date string (example: 2004/07/23) -void GetDateStr(char *str, UINT size, SYSTEMTIME *st) -{ - // Validate arguments - if (str == NULL || st == NULL) - { - return; - } - - Format(str, size, "%04u-%02u-%02u", - st->wYear, st->wMonth, st->wDay); -} - -// Get the date and time string (example: 2004/07/23 12:34:56) -void GetDateTimeStr(char *str, UINT size, SYSTEMTIME *st) -{ - // Validate arguments - if (str == NULL || st == NULL) - { - return; - } - - Format(str, size, "%04u-%02u-%02u %02u:%02u:%02u", - st->wYear, st->wMonth, st->wDay, - st->wHour, st->wMinute, st->wSecond); -} - -// Get the date and time string in milliseconds (example: 2004/07/23 12:34:56.789) -void GetDateTimeStrMilli(char *str, UINT size, SYSTEMTIME *st) -{ - // Validate arguments - if (str == NULL || st == NULL) - { - return; - } - - Format(str, size, "%04u-%02u-%02u %02u:%02u:%02u.%03u", - st->wYear, st->wMonth, st->wDay, - st->wHour, st->wMinute, st->wSecond, - st->wMilliseconds); -} - - -// Convert string RFC3339 format (example: 2017-09-27T18:25:55.434-9:00) to UINT64 -UINT64 DateTimeStrRFC3339ToSystemTime64(char *str) -{ - SYSTEMTIME st; - if (DateTimeStrRFC3339ToSystemTime(&st, str)) - { - return SystemToUINT64(&st); - } - else - { - return 0; - } -} - -// Convert string RFC3339 format (example: 2017-09-27T18:25:55.434-9:00) to SYSTEMTIME -bool DateTimeStrRFC3339ToSystemTime(SYSTEMTIME *st, char *str) -{ - bool ok = false; - UINT index_plus; - char tmp[MAX_PATH]; - Zero(st, sizeof(SYSTEMTIME)); - if (st == NULL || str == NULL) - { - return false; - } - - StrCpy(tmp, sizeof(tmp), str); - - index_plus = SearchStrEx(tmp, "+", 0, false); - if (index_plus != INFINITE) - { - tmp[index_plus] = 0; - } - - if (StrLen(tmp) >= 19) - { - if (tmp[4] == '-' && tmp[7] == '-' && tmp[10] == 'T' && tmp[13] == ':' && - tmp[16] == ':') - { - char str_year[16], str_month[16], str_day[16], str_hour[16], str_minute[16], - str_second[16], str_msec[16]; - - StrCpy(str_year, sizeof(str_year), tmp + 0); - str_year[4] = 0; - - StrCpy(str_month, sizeof(str_month), tmp + 5); - str_month[2] = 0; - - StrCpy(str_day, sizeof(str_day), tmp + 8); - str_day[2] = 0; - - StrCpy(str_hour, sizeof(str_hour), tmp + 11); - str_hour[2] = 0; - - StrCpy(str_minute, sizeof(str_minute), tmp + 14); - str_minute[2] = 0; - - StrCpy(str_second, sizeof(str_second), tmp + 17); - str_second[2] = 0; - - str_msec[0] = 0; - - if (StrLen(tmp) >= 21 && tmp[19] == '.') - { - StrCpy(str_msec, sizeof(str_msec), tmp + 20); - str_msec[StrLen(tmp) - 21] = 0; - while (StrLen(str_msec) < 3) - { - StrCat(str_msec, sizeof(str_msec), "0"); - } - str_msec[3] = 0; - } - - st->wYear = ToInt(str_year); - st->wMonth = ToInt(str_month); - st->wDay = ToInt(str_day); - st->wHour = ToInt(str_hour); - st->wMinute = ToInt(str_minute); - st->wSecond = ToInt(str_second); - st->wMilliseconds = ToInt(str_msec); - - NormalizeSystem(st); - - ok = true; - } - } - - return ok; -} - -// Get the date and time string in RFC3339 format (example: 2017-09-27T18:25:55.434-9:00) -void GetDateTimeStrRFC3339(char *str, UINT size, SYSTEMTIME *st, int timezone_min){ - // Validate arguments - if (str == NULL || st == NULL) - { - ClearStr(str, size); - return; - } - - if(timezone_min == 0){ - Format(str, size, "%04u-%02u-%02uT%02u:%02u:%02u.%03uZ", - st->wYear, st->wMonth, st->wDay, - st->wHour, st->wMinute, st->wSecond, - st->wMilliseconds); - }else{ - Format(str, size, "%04u-%02u-%02uT%02u:%02u:%02u.%03u%+02d:%02d", - st->wYear, st->wMonth, st->wDay, - st->wHour, st->wMinute, st->wSecond, - st->wMilliseconds, timezone_min/60, timezone_min%60); - } -} - -// Get the time string (in milliseconds) -void GetSpanStrMilli(char *str, UINT size, UINT64 sec64) -{ - char tmp[MAX_SIZE]; - // Validate arguments - if (str == NULL) - { - return; - } - - StrCpy(tmp, sizeof(tmp), ""); - if (sec64 >= (UINT64)(1000 * 3600 * 24)) - { - Format(tmp, sizeof(tmp), "%u:", (UINT)(sec64 / (UINT64)(1000 * 3600 * 24))); - } - - Format(tmp, sizeof(tmp), "%s%02u:%02u:%02u.%03u", tmp, - (UINT)(sec64 % (UINT64)(1000 * 60 * 60 * 24)) / (1000 * 60 * 60), - (UINT)(sec64 % (UINT64)(1000 * 60 * 60)) / (1000 * 60), - (UINT)(sec64 % (UINT64)(1000 * 60)) / 1000, - (UINT)(sec64 % (UINT64)(1000))); - - Trim(tmp); - StrCpy(str, size, tmp); -} - -// Set the locale information -void SetLocale(wchar_t *str) -{ - wchar_t *set_locale_str; - LOCALE tmp; - - if (str != NULL) - { - set_locale_str = str; - } - else - { - set_locale_str = default_locale_str; - } - - if (LoadLocale(&tmp, set_locale_str) == false) - { - if (LoadLocale(&tmp, default_locale_str) == false) - { - return; - } - } - - Copy(¤t_locale, &tmp, sizeof(LOCALE)); -} - -#define COPY_LOCALE_STR(dest, size, src) UniStrCpy(dest, size, UniStrCmp(src, L"$") == 0 ? L"" : src) - -// Read the locale information -bool LoadLocale(LOCALE *locale, wchar_t *str) -{ - UNI_TOKEN_LIST *tokens; - UINT i; - // Validate arguments - if (locale == NULL || str == NULL) - { - return false; - } - - // Analysis of the token - tokens = UniParseToken(str, L" "); - if (tokens->NumTokens != 18) - { - UniFreeToken(tokens); - return false; - } - - // Set to the structure - Zero(locale, sizeof(LOCALE)); - COPY_LOCALE_STR(locale->YearStr, sizeof(locale->YearStr), tokens->Token[0]); - COPY_LOCALE_STR(locale->MonthStr, sizeof(locale->MonthStr), tokens->Token[1]); - COPY_LOCALE_STR(locale->DayStr, sizeof(locale->DayStr), tokens->Token[2]); - COPY_LOCALE_STR(locale->HourStr, sizeof(locale->HourStr), tokens->Token[3]); - COPY_LOCALE_STR(locale->MinuteStr, sizeof(locale->MinuteStr), tokens->Token[4]); - COPY_LOCALE_STR(locale->SecondStr, sizeof(locale->SecondStr), tokens->Token[5]); - - for (i = 0;i < 7;i++) - { - COPY_LOCALE_STR(locale->DayOfWeek[i], sizeof(locale->DayOfWeek[i]), - tokens->Token[6 + i]); - } - - COPY_LOCALE_STR(locale->SpanDay, sizeof(locale->SpanDay), tokens->Token[13]); - COPY_LOCALE_STR(locale->SpanHour, sizeof(locale->SpanHour), tokens->Token[14]); - COPY_LOCALE_STR(locale->SpanMinute, sizeof(locale->SpanMinute), tokens->Token[15]); - COPY_LOCALE_STR(locale->SpanSecond, sizeof(locale->SpanSecond), tokens->Token[16]); - - COPY_LOCALE_STR(locale->Unknown, sizeof(locale->Unknown), tokens->Token[17]); - - UniFreeToken(tokens); - return true; -} - -// Convert SYSTEMTIME into DOS date -USHORT SystemToDosDate(SYSTEMTIME *st) -{ - return (USHORT)( - ((UINT)(st->wYear - 1980) << 9) | - ((UINT)st->wMonth<< 5) | - (UINT)st->wDay); -} -USHORT System64ToDosDate(UINT64 i) -{ - SYSTEMTIME st; - UINT64ToSystem(&st, i); - return SystemToDosDate(&st); -} - -// Convert SYSTEMTIME into DOS time -USHORT SystemToDosTime(SYSTEMTIME *st) -{ - return (USHORT)( - ((UINT)st->wHour << 11) | - ((UINT)st->wMinute << 5) | - ((UINT)st->wSecond >> 1)); -} -USHORT System64ToDosTime(UINT64 i) -{ - SYSTEMTIME st; - UINT64ToSystem(&st, i); - return SystemToDosTime(&st); -} - -// Convert the tm to the SYSTEMTIME -void TmToSystem(SYSTEMTIME *st, struct tm *t) -{ - struct tm tmp; - // Validate arguments - if (st == NULL || t == NULL) - { - return; - } - - Copy(&tmp, t, sizeof(struct tm)); - NormalizeTm(&tmp); - - Zero(st, sizeof(SYSTEMTIME)); - st->wYear = MAKESURE(tmp.tm_year + 1900, 1970, 2099); - st->wMonth = MAKESURE(tmp.tm_mon + 1, 1, 12); - st->wDay = MAKESURE(tmp.tm_mday, 1, 31); - st->wDayOfWeek = MAKESURE(tmp.tm_wday, 0, 6); - st->wHour = MAKESURE(tmp.tm_hour, 0, 23); - st->wMinute = MAKESURE(tmp.tm_min, 0, 59); - st->wSecond = MAKESURE(tmp.tm_sec, 0, 59); - st->wMilliseconds = 0; -} - -// Convert the SYSTEMTIME to tm -void SystemToTm(struct tm *t, SYSTEMTIME *st) -{ - // Validate arguments - if (t == NULL || st == NULL) - { - return; - } - - Zero(t, sizeof(struct tm)); - t->tm_year = MAKESURE(st->wYear, 1970, 2099) - 1900; - t->tm_mon = MAKESURE(st->wMonth, 1, 12) - 1; - t->tm_mday = MAKESURE(st->wDay, 1, 31); - t->tm_hour = MAKESURE(st->wHour, 0, 23); - t->tm_min = MAKESURE(st->wMinute, 0, 59); - t->tm_sec = MAKESURE(st->wSecond, 0, 59); - - t->tm_isdst = -1; - NormalizeTm(t); -} - -// Convert the time_t to SYSTEMTIME -void TimeToSystem(SYSTEMTIME *st, time_64t t) -{ - struct tm tmp; - // Validate arguments - if (st == NULL) - { - return; - } - - TimeToTm(&tmp, t); - TmToSystem(st, &tmp); -} - -// Convert the SYSTEMTIME to time_t -time_64t SystemToTime(SYSTEMTIME *st) -{ - struct tm t; - // Validate arguments - if (st == NULL) - { - return 0; - } - - SystemToTm(&t, st); - return TmToTime(&t); -} - -// Convert the tm to time_t -time_64t TmToTime(struct tm *t) -{ - time_64t tmp; - // Validate arguments - if (t == NULL) - { - return 0; - } - - tmp = c_mkgmtime(t); - if (tmp == (time_64t)-1) - { - return 0; - } - return tmp; -} - -// Convert time_t to tm -void TimeToTm(struct tm *t, time_64t time) -{ - // Validate arguments - if (t == NULL) - { - return; - } - - Zero(t, sizeof(struct tm)); - c_gmtime_r(&time, t); -} - -// Normalize the tm -void NormalizeTm(struct tm *t) -{ - time_64t tmp; - // Validate arguments - if (t == NULL) - { - return; - } - - tmp = c_mkgmtime(t); - if (tmp == (time_64t)-1) - { - return; - } - - c_gmtime_r(&tmp, t); -} - -// Normalize the SYSTEMTIME -void NormalizeSystem(SYSTEMTIME *st) -{ - UINT64 sec64; - // Validate arguments - if (st == NULL) - { - return; - } - - sec64 = SystemToUINT64(st); - UINT64ToSystem(st, sec64); -} - -// Convert a 64-bit local time to a system time -UINT64 LocalToSystem64(UINT64 t) -{ - SYSTEMTIME st; - UINT64ToSystem(&st, t); - LocalToSystem(&st, &st); - return SystemToUINT64(&st); -} - -// Convert the 64bit system time to local time -UINT64 SystemToLocal64(UINT64 t) -{ - SYSTEMTIME st; - UINT64ToSystem(&st, t); - SystemToLocal(&st, &st); - return SystemToUINT64(&st); -} - -// Convert local time to system time -void LocalToSystem(SYSTEMTIME *system, SYSTEMTIME *local) -{ - UINT64 sec64; - // Validate arguments - if (local == NULL || system == NULL) - { - return; - } - - sec64 = (UINT64)((INT64)SystemToUINT64(local) - GetTimeDiffEx(local, true)); - UINT64ToSystem(system, sec64); -} - -// Convert the system time to local time -void SystemToLocal(SYSTEMTIME *local, SYSTEMTIME *system) -{ - UINT64 sec64; - // Validate arguments - if (local == NULL || system == NULL) - { - return; - } - - sec64 = (UINT64)((INT64)SystemToUINT64(system) + GetTimeDiffEx(system, false)); - UINT64ToSystem(local, sec64); -} - -// Get the time difference between the local time and the system time based on the specified time -INT64 GetTimeDiffEx(SYSTEMTIME *basetime, bool local_time) -{ - time_t tmp; - struct tm t1, t2; - SYSTEMTIME snow; - struct tm now; - SYSTEMTIME s1, s2; - INT64 ret; - - Copy(&snow, basetime, sizeof(SYSTEMTIME)); - - if (sizeof(time_t) == 4) - { - if (snow.wYear >= 2038) - { - // For old systems: avoid the 2038-year problem - snow.wYear = 2037; - } - } - - SystemToTm(&now, &snow); - if (local_time == false) - { - tmp = (time_t)c_mkgmtime(&now); - } - else - { - tmp = mktime(&now); - } - - if (tmp == (time_t)-1) - { - return 0; - } - -#ifndef OS_UNIX - Copy(&t1, localtime(&tmp), sizeof(struct tm)); - Copy(&t2, gmtime(&tmp), sizeof(struct tm)); -#else // OS_UNIX - localtime_r(&tmp, &t1); - gmtime_r(&tmp, &t2); -#endif // OS_UNIX - - TmToSystem(&s1, &t1); - TmToSystem(&s2, &t2); - - ret = (INT)SystemToUINT64(&s1) - (INT)SystemToUINT64(&s2); - - return ret; -} - -// Convert UINT64 to the SYSTEMTIME -void UINT64ToSystem(SYSTEMTIME *st, UINT64 sec64) -{ - UINT64 tmp64; - UINT sec, millisec; - time_64t time; - // Validate arguments - if (st == NULL) - { - return; - } - - sec64 = SafeTime64(sec64 + 32400000ULL); - tmp64 = sec64 / (UINT64)1000; - millisec = (UINT)(sec64 - tmp64 * (UINT64)1000); - sec = (UINT)tmp64; - time = (time_64t)sec; - TimeToSystem(st, time); - st->wMilliseconds = (USHORT)millisec; -} - -// Convert the SYSTEMTIME to UINT64 -UINT64 SystemToUINT64(SYSTEMTIME *st) -{ - UINT64 sec64; - time_64t time; - // Validate arguments - if (st == NULL) - { - return 0; - } - - time = SystemToTime(st); - - //For times before 1970-01-01, clamp to the minimum - //because we have to return an unsigned integer. - //This is less wrong than casting it to UINT64 - //and returning a time far in the future. - //For some reason we subtract 9 hours below, so - //account for that here. - if( time < 32400000LL ) return 0; - - sec64 = (UINT64)time * (UINT64)1000; - sec64 += st->wMilliseconds; - - return sec64 - 32400000ULL; -} - -// Get local time in UINT64 -UINT64 LocalTime64() -{ - SYSTEMTIME s; - LocalTime(&s); - return SystemToUINT64(&s); -} - -// Get the system time in UINT64 -UINT64 SystemTime64() -{ - SYSTEMTIME s; - SystemTime(&s); - return SystemToUINT64(&s); -} - -// Get local time -void LocalTime(SYSTEMTIME *st) -{ - SYSTEMTIME tmp; - // Validate arguments - if (st == NULL) - { - return; - } - - SystemTime(&tmp); - SystemToLocal(st, &tmp); -} - -// Get the System Time -void SystemTime(SYSTEMTIME *st) -{ - // Validate arguments - if (st == NULL) - { - return; - } - - OSGetSystemTime(st); - - // KS - KS_INC(KS_GETTIME_COUNT); -} - -time_64t c_mkgmtime(struct tm *tm) -{ - int years, months, days, hours, minutes, seconds; - - years = tm->tm_year + 1900; /* year - 1900 -> year */ - months = tm->tm_mon; /* 0..11 */ - days = tm->tm_mday - 1; /* 1..31 -> 0..30 */ - hours = tm->tm_hour; /* 0..23 */ - minutes = tm->tm_min; /* 0..59 */ - seconds = tm->tm_sec; /* 0..61 in ANSI C. */ - - ADJUST_TM(seconds, minutes, 60); - ADJUST_TM(minutes, hours, 60); - ADJUST_TM(hours, days, 24); - ADJUST_TM(months, years, 12); - if (days < 0) - do { - if (--months < 0) { - --years; - months = 11; - } - days += monthlen(months, years); - } while (days < 0); - else - while (days >= monthlen(months, years)) { - days -= monthlen(months, years); - if (++months >= 12) { - ++years; - months = 0; - } - } - - /* Restore adjusted values in tm structure */ - tm->tm_year = years - 1900; - tm->tm_mon = months; - tm->tm_mday = days + 1; - tm->tm_hour = hours; - tm->tm_min = minutes; - tm->tm_sec = seconds; - - /* Set `days' to the number of days into the year. */ - days += ydays[months] + (months > 1 && leap (years)); - tm->tm_yday = days; - - /* Now calculate `days' to the number of days since Jan 1, 1970. */ - days = (unsigned)days + 365 * (unsigned)(years - 1970) + - (unsigned)(nleap (years)); - tm->tm_wday = ((unsigned)days + 4) % 7; /* Jan 1, 1970 was Thursday. */ - tm->tm_isdst = 0; - - if (years < 1970) - return (time_64t)-1; - -#if (defined(TM_YEAR_MAX) && defined(TM_MON_MAX) && defined(TM_MDAY_MAX)) -#if (defined(TM_HOUR_MAX) && defined(TM_MIN_MAX) && defined(TM_SEC_MAX)) - if (years > TM_YEAR_MAX || - (years == TM_YEAR_MAX && - (tm->tm_yday > ydays[TM_MON_MAX] + (TM_MDAY_MAX - 1) + - (TM_MON_MAX > 1 && leap (TM_YEAR_MAX)) || - (tm->tm_yday == ydays[TM_MON_MAX] + (TM_MDAY_MAX - 1) + - (TM_MON_MAX > 1 && leap (TM_YEAR_MAX)) && - (hours > TM_HOUR_MAX || - (hours == TM_HOUR_MAX && - (minutes > TM_MIN_MAX || - (minutes == TM_MIN_MAX && seconds > TM_SEC_MAX) ))))))) - return (time_64t)-1; -#endif -#endif - - return (time_64t)(86400L * (unsigned long)(unsigned)days + - 3600L * (unsigned long)hours + - (unsigned long)(60 * minutes + seconds)); -} - -// Get the system timer -UINT Tick() -{ - // KS - KS_INC(KS_GETTICK_COUNT); - return OSGetTick(); -} - -// Sleep thread -void SleepThread(UINT time) -{ - // KS - KS_INC(KS_SLEEPTHREAD_COUNT); - - OSSleep(time); -} - -// Yield -void YieldCpu() -{ - OSYield(); -} - -// Stop system (abnormal termination) -void AbortExit() -{ -#ifdef OS_WIN32 - _exit(1); -#else // OS_WIN32 - -#ifdef RLIMIT_CORE - UnixSetResourceLimit(RLIMIT_CORE, 0); -#endif // RLIMIT_CORE - - abort(); -#endif // OS_WIN32 -} - - -void AbortExitEx(char *msg) -{ - FILE *f; - // Validate arguments - if (msg == NULL) - { - msg = "Unknown Error"; - } - - f = fopen("abort_error_log.txt", "w"); - if (f != NULL) - { - fwrite(msg, 1, strlen(msg), f); - fclose(f); - } - - fputs("Fatal Error: ", stdout); - fputs(msg, stdout); - fputs("\r\n", stdout); - -#ifdef OS_WIN32 - _exit(1); -#else // OS_WIN32 - -#ifdef RLIMIT_CORE - UnixSetResourceLimit(RLIMIT_CORE, 0); -#endif // RLIMIT_CORE - - abort(); -#endif // OS_WIN32 -} - +// SoftEther VPN Source Code - Developer Edition Master Branch +// Mayaqua Kernel + + +// Kernel.c +// System service processing routine + +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +#ifndef TM_YEAR_MAX +#define TM_YEAR_MAX 2106 +#endif +#ifndef TM_MON_MAX +#define TM_MON_MAX 1 +#endif +#ifndef TM_MDAY_MAX +#define TM_MDAY_MAX 7 +#endif +#ifndef TM_HOUR_MAX +#define TM_HOUR_MAX 6 +#endif +#ifndef TM_MIN_MAX +#define TM_MIN_MAX 28 +#endif +#ifndef TM_SEC_MAX +#define TM_SEC_MAX 14 +#endif + +#define ADJUST_TM(tm_member, tm_carry, modulus) \ + if ((tm_member) < 0){ \ + tm_carry -= (1 - ((tm_member)+1) / (modulus)); \ + tm_member = (modulus-1) + (((tm_member)+1) % (modulus)); \ + } else if ((tm_member) >= (modulus)) { \ + tm_carry += (tm_member) / (modulus); \ + tm_member = (tm_member) % (modulus); \ + } +#define leap(y) (((y) % 4 == 0 && (y) % 100 != 0) || (y) % 400 == 0) +#define nleap(y) (((y) - 1969) / 4 - ((y) - 1901) / 100 + ((y) - 1601) / 400) +#define leapday(m, y) ((m) == 1 && leap (y)) +#define monthlen(m, y) (ydays[(m)+1] - ydays[m] + leapday (m, y)) +static int ydays[] = +{ + 0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334, 365 +}; + +static UINT current_num_thread = 0; +static UINT cached_number_of_cpus = 0; + + + +static wchar_t *default_locale_str = +L"- - $ : : $ Sun Mon Tue Wed Thu Fri Sat : : : $ (None)"; + + +static LOCALE current_locale; +LOCK *tick_manual_lock = NULL; + +#define MONSPERYEAR 12 +#define DAYSPERNYEAR 365 +#define DAYSPERLYEAR 366 +#define SECSPERMIN 60 +#define SECSPERHOUR (60*60) +#define SECSPERDAY (24*60*60) +#define DAYSPERWEEK 7 +#define TM_SUNDAY 0 +#define TM_MONDAY 1 +#define TM_TUESDAY 2 +#define TM_WEDNESDAY 3 +#define TM_THURSDAY 4 +#define TM_FRIDAY 5 +#define TM_SATURDAY 6 + +#define TM_YEAR_BASE 1900 + +#define EPOCH_YEAR 1970 +#define EPOCH_WDAY TM_THURSDAY + +#define isleap(y) (((y) % 4) == 0 && (((y) % 100) != 0 || ((y) % 400) == 0)) + +static const int mon_lengths[2][MONSPERYEAR] = { + { 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 }, + { 31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 } +}; + +static const int year_lengths[2] = { + DAYSPERNYEAR, DAYSPERLYEAR +}; + + +/* + * Taken from FreeBSD src / lib / libc / stdtime / localtime.c 1.43 revision. + * localtime.c 7.78. + * tzfile.h 1.8 + * adapted to be replacement gmtime_r. + */ +static void +c_timesub(timep, offset, tmp) +const time_64t * const timep; +const long offset; +struct tm * const tmp; +{ + INT64 days; + INT64 rem; + INT64 y; + int yleap; + const int * ip; + + days = *timep / SECSPERDAY; + rem = *timep % SECSPERDAY; + rem += (offset); + while (rem < 0) { + rem += SECSPERDAY; + --days; + } + while (rem >= SECSPERDAY) { + rem -= SECSPERDAY; + ++days; + } + tmp->tm_hour = (int) (rem / SECSPERHOUR); + rem = rem % SECSPERHOUR; + tmp->tm_min = (int) (rem / SECSPERMIN); + /* + ** A positive leap second requires a special + ** representation. This uses "... ??:59:60" et seq. + */ + tmp->tm_sec = (int) (rem % SECSPERMIN) ; + tmp->tm_wday = (int) ((EPOCH_WDAY + days) % DAYSPERWEEK); + if (tmp->tm_wday < 0) + tmp->tm_wday += DAYSPERWEEK; + y = EPOCH_YEAR; +#define LEAPS_THRU_END_OF(y) ((y) / 4 - (y) / 100 + (y) / 400) + while (days < 0 || days >= (long) year_lengths[yleap = isleap(y)]) { + INT64 newy; + + newy = y + days / DAYSPERNYEAR; + if (days < 0) + --newy; + days -= (newy - y) * DAYSPERNYEAR + + LEAPS_THRU_END_OF(newy - 1) - + LEAPS_THRU_END_OF(y - 1); + y = newy; + } + tmp->tm_year = (int)(y - TM_YEAR_BASE); + tmp->tm_yday = (int) days; + ip = mon_lengths[yleap]; + for (tmp->tm_mon = 0; days >= (INT64) ip[tmp->tm_mon]; ++(tmp->tm_mon)) + days = days - (INT64) ip[tmp->tm_mon]; + tmp->tm_mday = (int) (days + 1); + tmp->tm_isdst = 0; +} + +/* +* Re-entrant version of gmtime. +*/ +struct tm * c_gmtime_r(const time_64t* timep, struct tm *tm) +{ + c_timesub(timep, 0L, tm); + return tm; +} + +// Get the real-time system timer +UINT TickRealtime() +{ +#if defined(OS_WIN32) || defined(CLOCK_REALTIME) || defined(CLOCK_MONOTONIC) || defined(CLOCK_HIGHRES) || defined(UNIX_MACOS) + return Tick() + 1; +#else + return TickRealtimeManual() + 1; +#endif +} + +#ifndef OS_WIN32 + +static UINT64 last_manual_tick = 0; +static UINT64 manual_tick_add_value = 0; + +// For systems which not have clock_gettime (such as MacOS X) +UINT TickRealtimeManual() +{ + UINT64 ret; + Lock(tick_manual_lock); + { + ret = TickGetRealtimeTickValue64(); + + if (last_manual_tick != 0 && (last_manual_tick > ret)) + { + manual_tick_add_value += (last_manual_tick - ret); + } + + last_manual_tick = ret; + } + Unlock(tick_manual_lock); + + return (UINT)(ret + manual_tick_add_value); +} + +// Returns a appropriate value from the current time +UINT64 TickGetRealtimeTickValue64() +{ + struct timeval tv; + struct timezone tz; + UINT64 ret; + + memset(&tv, 0, sizeof(tv)); + memset(&tz, 0, sizeof(tz)); + + gettimeofday(&tv, &tz); + + if (sizeof(tv.tv_sec) != 4) + { + ret = (UINT64)tv.tv_sec * 1000ULL + (UINT64)tv.tv_usec / 1000ULL; + } + else + { + ret = (UINT64)((UINT64)((UINT)tv.tv_sec)) * 1000ULL + (UINT64)tv.tv_usec / 1000ULL; + } + + return ret; +} + +#endif // OS_WIN32 + +// Get the number of CPUs +UINT GetNumberOfCpu() +{ + UINT ret = 0; + + if (cached_number_of_cpus == 0) + { + UINT i = 0; + +#ifdef OS_WIN32 + i = Win32GetNumberOfCpuInner(); +#else // OS_WIN32 + i = UnixGetNumberOfCpuInner(); +#endif // OS_WIN32 + + if (i == 0) + { + i = 8; + } + + cached_number_of_cpus = i; + } + + ret = cached_number_of_cpus; + + if (ret == 0) + { + ret = 1; + } + if (ret > 128) + { + ret = 128; + } + + return ret; +} + +// Creating a thread list +LIST *NewThreadList() +{ + LIST *o = NewList(NULL); + + return o; +} + +// Add the thread to the thread list +void AddThreadToThreadList(LIST *o, THREAD *t) +{ + // Validate arguments + if (o == NULL || t == NULL) + { + return; + } + + LockList(o); + { + if (IsInList(o, t) == false) + { + AddRef(t->ref); + + Add(o, t); + } + } + UnlockList(o); +} + +// Maintain thread list +void MaintainThreadList(LIST *o) +{ + UINT i; + LIST *delete_list = NULL; + // Validate arguments + if (o == NULL) + { + return; + } + + LockList(o); + { + for (i = 0;i < LIST_NUM(o);i++) + { + THREAD *t = LIST_DATA(o, i); + + if (t->Stopped) + { + if (delete_list == NULL) + { + delete_list = NewListFast(NULL); + } + + Add(delete_list, t); + } + } + + if (delete_list != NULL) + { + for (i = 0;i < LIST_NUM(delete_list);i++) + { + THREAD *t = LIST_DATA(delete_list, i); + + ReleaseThread(t); + + Delete(o, t); + } + + ReleaseList(delete_list); + } + } + UnlockList(o); +} + +// Stop all the threads in the thread list +void StopThreadList(LIST *o) +{ + UINT i; + // Validate arguments + if (o == NULL) + { + return; + } + + LockList(o); + { + for (i = 0;i < LIST_NUM(o);i++) + { + THREAD *t = LIST_DATA(o, i); + + WaitThread(t, INFINITE); + } + } + UnlockList(o); +} + +// Release the thread list +void FreeThreadList(LIST *o) +{ + UINT i; + // Validate arguments + if (o == NULL) + { + return; + } + + LockList(o); + { + for (i = 0;i < LIST_NUM(o);i++) + { + THREAD *t = LIST_DATA(o, i); + + WaitThread(t, INFINITE); + + ReleaseThread(t); + } + + DeleteAll(o); + } + UnlockList(o); + + ReleaseList(o); +} + +// Get the home directory +void GetHomeDirW(wchar_t *path, UINT size) +{ + // Validate arguments + if (path == NULL) + { + return; + } + + if (GetEnvW(L"HOME", path, size) == false) + { + wchar_t drive[MAX_SIZE]; + wchar_t hpath[MAX_SIZE]; + if (GetEnvW(L"HOMEDRIVE", drive, sizeof(drive)) && + GetEnvW(L"HOMEPATH", hpath, sizeof(hpath))) + { + UniFormat(path, size, L"%s%s", drive, hpath); + } + else + { +#ifdef OS_WIN32 + Win32GetCurrentDirW(path, size); +#else // OS_WIN32 + UnixGetCurrentDirW(path, size); +#endif // OS_WIN32 + } + } +} + +// Get the environment variable string +bool GetEnv(char *name, char *data, UINT size) +{ + char *ret; + // Validate arguments + if (name == NULL || data == NULL) + { + return false; + } + + StrCpy(data, size, ""); + + ret = getenv(name); + if (ret == NULL) + { + return false; + } + + StrCpy(data, size, ret); + + return true; +} +bool GetEnvW(wchar_t *name, wchar_t *data, UINT size) +{ +#ifdef OS_WIN32 + return GetEnvW_ForWin32(name, data, size); +#else // OS_WIN32 + return GetEnvW_ForUnix(name, data, size); +#endif // OS_WIN32 +} + +#ifdef OS_WIN32 +bool GetEnvW_ForWin32(wchar_t *name, wchar_t *data, UINT size) +{ + wchar_t *ret; + // Validate arguments + if (name == NULL || data == NULL) + { + return false; + } + + if (IsNt() == false) + { + bool ret; + char *name_a = CopyUniToStr(name); + char data_a[MAX_SIZE]; + + ret = GetEnv(name_a, data_a, sizeof(data_a)); + + if (ret) + { + StrToUni(data, size, data_a); + } + + Free(name_a); + + return ret; + } + + UniStrCpy(data, size, L""); + + ret = _wgetenv(name); + if (ret == NULL) + { + return false; + } + + UniStrCpy(data, size, ret); + + return true; +} + +#endif // OS_WIN32 + +#ifdef OS_UNIX + +bool GetEnvW_ForUnix(wchar_t *name, wchar_t *data, UINT size) +{ + char *name_a; + bool ret; + char data_a[MAX_SIZE]; + // Validate arguments + if (name == NULL || data == NULL) + { + return false; + } + + name_a = CopyUniToUtf(name); + + ret = GetEnv(name_a, data_a, sizeof(data_a)); + + if (ret) + { + UtfToUni(data, size, data_a); + } + + Free(name_a); + + return ret; +} + +#endif // OS_UNIX + +// Get the memory information +void GetMemInfo(MEMINFO *info) +{ + OSGetMemInfo(info); +} + +// Start the single-instance +INSTANCE *NewSingleInstance(char *instance_name) +{ + return NewSingleInstanceEx(instance_name, false); +} +INSTANCE *NewSingleInstanceEx(char *instance_name, bool user_local) +{ + char name[MAX_SIZE]; + INSTANCE *ret; + void *data; + + if (instance_name != NULL) + { + if (user_local == false) + { + HashInstanceName(name, sizeof(name), instance_name); + } + else + { + HashInstanceNameLocal(name, sizeof(name), instance_name); + } + + data = OSNewSingleInstance(name); + } + else + { + data = OSNewSingleInstance(NULL); + } + + if (data == NULL) + { + return NULL; + } + + ret = ZeroMalloc(sizeof(INSTANCE)); + if (instance_name != NULL) + { + ret->Name = CopyStr(instance_name); + } + + ret->pData = data; + + return ret; +} + +// Release of single instance +void FreeSingleInstance(INSTANCE *inst) +{ + // Validate arguments + if (inst == NULL) + { + return; + } + + OSFreeSingleInstance(inst->pData); + + if (inst->Name != NULL) + { + Free(inst->Name); + } + Free(inst); +} + +// Hashing the instance name +void HashInstanceName(char *name, UINT size, char *instance_name) +{ + char tmp[MAX_SIZE]; + UCHAR hash[SHA1_SIZE]; + char key[11]; + // Validate arguments + if (name == NULL || instance_name == NULL) + { + return; + } + + StrCpy(tmp, sizeof(tmp), instance_name); + Trim(tmp); + StrUpper(tmp); + + Sha0(hash, tmp, StrLen(tmp)); + BinToStr(key, sizeof(key), hash, 5); + key[10] = 0; + + Format(name, size, "VPN-%s", key); + + if (OS_IS_WINDOWS_NT(GetOsInfo()->OsType)) + { + if (GET_KETA(GetOsInfo()->OsType, 100) >= 2 || + GetOsInfo()->OsType == OSTYPE_WINDOWS_NT_4_TERMINAL_SERVER) + { + StrCpy(tmp, sizeof(tmp), name); + Format(name, size, "Global\\%s", tmp); + } + } +} +void HashInstanceNameLocal(char *name, UINT size, char *instance_name) +{ + char tmp[MAX_SIZE]; + UCHAR hash[SHA1_SIZE]; + char key[11]; + // Validate arguments + if (name == NULL || instance_name == NULL) + { + return; + } + + StrCpy(tmp, sizeof(tmp), instance_name); + Trim(tmp); + StrUpper(tmp); + + Sha0(hash, tmp, StrLen(tmp)); + BinToStr(key, sizeof(key), hash, 5); + key[10] = 0; + + Format(name, size, "VPN-%s", key); + + if (OS_IS_WINDOWS_NT(GetOsInfo()->OsType)) + { + if (GET_KETA(GetOsInfo()->OsType, 100) >= 2 || + GetOsInfo()->OsType == OSTYPE_WINDOWS_NT_4_TERMINAL_SERVER) + { + StrCpy(tmp, sizeof(tmp), name); + Format(name, size, "Local\\%s", tmp); + } + } +} + +// Run the process +bool Run(char *filename, char *arg, bool hide, bool wait) +{ + // Validate arguments + if (filename == NULL) + { + return false; + } + + return OSRun(filename, arg, hide, wait); +} +bool RunW(wchar_t *filename, wchar_t *arg, bool hide, bool wait) +{ + // Validate arguments + if (filename == NULL) + { + return false; + } + + return OSRunW(filename, arg, hide, wait); +} + +// Date and time related functions +void GetDateTimeStr64Uni(wchar_t *str, UINT size, UINT64 sec64) +{ + char tmp[MAX_SIZE]; + if (str == NULL) + { + return; + } + + GetDateTimeStr64(tmp, sizeof(tmp), sec64); + StrToUni(str, size, tmp); +} +void GetDateTimeStr64(char *str, UINT size, UINT64 sec64) +{ + SYSTEMTIME st; + UINT64ToSystem(&st, sec64); + GetDateTimeStr(str, size, &st); +} +void GetDateTimeStrMilli64(char *str, UINT size, UINT64 sec64) +{ + SYSTEMTIME st; + UINT64ToSystem(&st, sec64); + GetDateTimeStrMilli(str, size, &st); +} +void GetDateTimeStrMilli64ForFileName(char *str, UINT size, UINT64 sec64) +{ + SYSTEMTIME st; + UINT64ToSystem(&st, sec64); + GetDateTimeStrMilliForFileName(str, size, &st); +} +void GetDateTimeStrMilliForFileName(char *str, UINT size, SYSTEMTIME *tm) +{ + Format(str, size, "%04u%02u%02u_%02u%02u%02u", + tm->wYear, tm->wMonth, tm->wDay, tm->wHour, tm->wMinute, tm->wSecond); +} +void GetDateStr64(char *str, UINT size, UINT64 sec64) +{ + SYSTEMTIME st; + if (sec64 == 0) + { + StrCpy(str, size, "(Unknown)"); + return; + } + UINT64ToSystem(&st, sec64); + GetDateStr(str, size, &st); +} +void GetDateTimeStrEx64(wchar_t *str, UINT size, UINT64 sec64, LOCALE *locale) +{ + SYSTEMTIME st; + if (locale == NULL) + { + locale = ¤t_locale; + } + if (sec64 == 0 || SystemToLocal64(sec64) == 0 || LocalToSystem64(sec64) == 0) + { + UniStrCpy(str, size, locale->Unknown); + return; + } + UINT64ToSystem(&st, sec64); + GetDateTimeStrEx(str, size, &st, locale); +} +void GetDateStrEx64(wchar_t *str, UINT size, UINT64 sec64, LOCALE *locale) +{ + SYSTEMTIME st; + if (locale == NULL) + { + locale = ¤t_locale; + } + if (sec64 == 0 || SystemToLocal64(sec64) == 0 || LocalToSystem64(sec64) == 0) + { + UniStrCpy(str, size, locale->Unknown); + return; + } + UINT64ToSystem(&st, sec64); + GetDateStrEx(str, size, &st, locale); +} +void GetTimeStrMilli64(char *str, UINT size, UINT64 sec64) +{ + SYSTEMTIME st; + if (sec64 == 0 || SystemToLocal64(sec64) == 0 || LocalToSystem64(sec64) == 0) + { + StrCpy(str, size, "(Unknown)"); + return; + } + UINT64ToSystem(&st, sec64); + GetTimeStrMilli(str, size, &st); +} + +// Convert to a time to be used safely in the current POSIX implementation +UINT64 SafeTime64(UINT64 sec64) +{ + return MAKESURE(sec64, 0, 4102243323123ULL); +} + +// Thread pool +static SK *thread_pool = NULL; +static COUNTER *thread_count = NULL; + +// Initialization of thread pool +void InitThreading() +{ + thread_pool = NewSk(); + thread_count = NewCounter(); +} + +// Release of thread pool +void FreeThreading() +{ + while (true) + { + if (Count(thread_count) == 0) + { + break; + } + + SleepThread(25); + } + + while (true) + { + THREAD_POOL_DATA *pd; + THREAD *t = Pop(thread_pool); + + if (t == NULL) + { + break; + } + + pd = (THREAD_POOL_DATA *)t->param; + + pd->ThreadProc = NULL; + Set(pd->Event); + + WaitThreadInternal(t); + + pd = (THREAD_POOL_DATA *)t->param; + ReleaseEvent(pd->Event); + ReleaseEvent(pd->InitFinishEvent); + + ReleaseThreadInternal(t); + + Free(pd); + } + + ReleaseSk(thread_pool); + + DeleteCounter(thread_count); + thread_count = NULL; +} + +// Thread pool procedure +void ThreadPoolProc(THREAD *t, void *param) +{ + THREAD_POOL_DATA *pd; + // Validate arguments + if (t == NULL) + { + return; + } + + pd = (THREAD_POOL_DATA *)param; + + NoticeThreadInitInternal(t); + + while (true) + { + THREAD *thread; + UINT i, num; + EVENT **ee; + + // Wait for the next job + Wait(pd->Event, INFINITE); + + if (pd->ThreadProc == NULL) + { + // Stop the pool thread + break; + } + + thread = pd->Thread; + thread->ThreadId = ThreadId(); + + // Initialization is completed + Set(pd->InitFinishEvent); + + // Set the thread name + if (thread->Name != NULL) + { + SetThreadName(thread->ThreadId, thread->Name, thread->param); + } + else + { + SetThreadName(thread->ThreadId, "Unknown", 0); + } + + // Run the thread procedure + pd->ThreadProc(pd->Thread, thread->param); + + // Set the thread name + SetThreadName(thread->ThreadId, NULL, 0); + + pd->Thread->Stopped = true; + + thread->PoolHalting = true; + + // Set the waiting event list + LockList(thread->PoolWaitList); + { + num = LIST_NUM(thread->PoolWaitList); + ee = ToArray(thread->PoolWaitList); + + DeleteAll(thread->PoolWaitList); + } + UnlockList(thread->PoolWaitList); + + for (i = 0;i < num;i++) + { + EVENT *e = ee[i]; + + Set(e); + ReleaseEvent(e); + } + + Free(ee); + + while (true) + { + if (Count(thread->ref->c) <= 1) + { + break; + } + + Wait(thread->release_event, 256); + } + + ReleaseThread(thread); + +#ifdef OS_WIN32 + // For Win32: Recover the priority of the thread + MsRestoreThreadPriority(); +#endif // OS_WIN32 + + // Register the thread itself to the thread pool + LockSk(thread_pool); + { + Push(thread_pool, t); + } + UnlockSk(thread_pool); + + Dec(thread_count); + } +} + +// Set the thread name +void SetThreadName(UINT thread_id, char *name, void *param) +{ +#ifdef OS_WIN32 + if (IsDebug()) + { + char tmp[MAX_SIZE]; + + if (name == NULL) + { + strcpy(tmp, "idle"); + } + else + { + sprintf(tmp, "%s (0x%x)", name, (UINT)param); + } + + Win32SetThreadName(thread_id, tmp); + } +#else // OS_WIN32 +#ifdef _DEBUG +#ifdef PR_SET_NAME + char tmp[MAX_SIZE]; + + if (name == NULL) + { + strcpy(tmp, "idle"); + } + else + { + sprintf(tmp, "%s (%p)", name, param); + } + + tmp[15] = 0; + + prctl(PR_SET_NAME, (unsigned long)tmp, 0, 0, 0); +#endif // PR_SET_NAME +#endif // _DEBUG +#endif // OS_WIN32 +} + +// Thread creation (pool) +THREAD *NewThreadNamed(THREAD_PROC *thread_proc, void *param, char *name) +{ + THREAD *host = NULL; + THREAD_POOL_DATA *pd = NULL; + THREAD *ret; + // Validate arguments + if (thread_proc == NULL) + { + return NULL; + } + + Inc(thread_count); + + LockSk(thread_pool); + { + // Examine whether there is a thread that is currently vacant in the pool + host = Pop(thread_pool); + } + UnlockSk(thread_pool); + + if (host == NULL) + { + // Create a new thread because a vacant thread is not found + pd = ZeroMalloc(sizeof(THREAD_POOL_DATA)); + pd->Event = NewEvent(); + pd->InitFinishEvent = NewEvent(); + host = NewThreadInternal(ThreadPoolProc, pd); + WaitThreadInitInternal(host); + } + else + { + pd = (THREAD_POOL_DATA *)host->param; + } + + // Creating a thread pool + ret = ZeroMalloc(sizeof(THREAD)); + ret->ref = NewRef(); + ret->thread_proc = thread_proc; + ret->param = param; + ret->pData = NULL; + ret->init_finished_event = NewEvent(); + ret->PoolThread = true; + ret->PoolWaitList = NewList(NULL); + ret->PoolHostThread = host; + ret->release_event = NewEvent(); + + if (IsEmptyStr(name) == false) + { + ret->Name = CopyStr(name); + } + + // Run + pd->ThreadProc = thread_proc; + pd->Thread = ret; + AddRef(ret->ref); + + Set(pd->Event); + + Wait(pd->InitFinishEvent, INFINITE); + + current_num_thread++; + +// Debug("current_num_thread = %u\n", current_num_thread); + + return ret; +} + +// Clean up of thread (pool) +void CleanupThread(THREAD *t) +{ + // Validate arguments + if (t == NULL) + { + return; + } + + ReleaseEvent(t->init_finished_event); + ReleaseEvent(t->release_event); + ReleaseList(t->PoolWaitList); + + if (t->Name != NULL) + { + Free(t->Name); + } + + Free(t); + + current_num_thread--; + //Debug("current_num_thread = %u\n", current_num_thread); +} + +// Release thread (pool) +void ReleaseThread(THREAD *t) +{ + UINT ret; + EVENT *e; + // Validate arguments + if (t == NULL) + { + return; + } + + e = t->release_event; + if (e != NULL) + { + AddRef(e->ref); + } + + ret = Release(t->ref); + Set(e); + + ReleaseEvent(e); + + if (ret == 0) + { + CleanupThread(t); + } +} + +// Notify the completion of the thread initialization (pool) +void NoticeThreadInit(THREAD *t) +{ + // Validate arguments + if (t == NULL) + { + return; + } + + // Notification + Set(t->init_finished_event); +} + +// Wait the completion of the thread initialization (pool) +void WaitThreadInit(THREAD *t) +{ + // Validate arguments + if (t == NULL) + { + return; + } + + // KS + KS_INC(KS_WAITFORTHREAD_COUNT); + + // Wait + Wait(t->init_finished_event, INFINITE); +} + +// Wait for the termination of the thread (pool) +bool WaitThread(THREAD *t, UINT timeout) +{ + bool ret = false; + EVENT *e = NULL; + // Validate arguments + if (t == NULL) + { + return false; + } + + LockList(t->PoolWaitList); + { + if (t->PoolHalting) + { + // Has already been stopped + ret = true; + } + else + { + // Register the completion notifying event to the list + e = NewEvent(); + AddRef(e->ref); + Insert(t->PoolWaitList, e); + } + } + UnlockList(t->PoolWaitList); + + if (e != NULL) + { + // Wait Event + ret = Wait(e, timeout); + + LockList(t->PoolWaitList); + { + if (Delete(t->PoolWaitList, e)) + { + ReleaseEvent(e); + } + } + UnlockList(t->PoolWaitList); + + ReleaseEvent(e); + } + + return ret; +} + +// Get Thread ID +UINT ThreadId() +{ + return OSThreadId(); +} + +// Creating a thread +THREAD *NewThreadInternal(THREAD_PROC *thread_proc, void *param) +{ + THREAD *t; + UINT retry = 0; + // Validate arguments + if (thread_proc == NULL) + { + return NULL; + } + + // Initialize Thread object + t = ZeroMalloc(sizeof(THREAD)); + t->init_finished_event = NewEvent(); + + t->param = param; + t->ref = NewRef(); + t->thread_proc = thread_proc; + + // Wait until the OS to initialize the thread + while (true) + { + if ((retry++) > 60) + { + printf("\n\n*** error: new thread create failed.\n\n"); + AbortExit(); + } + if (OSInitThread(t)) + { + break; + } + SleepThread(500); + } + + // KS + KS_INC(KS_NEWTHREAD_COUNT); + + return t; +} + +// Release of thread +void ReleaseThreadInternal(THREAD *t) +{ + // Validate arguments + if (t == NULL) + { + return; + } + + if (Release(t->ref) == 0) + { + CleanupThreadInternal(t); + } +} + +// Clean up of the thread +void CleanupThreadInternal(THREAD *t) +{ + // Validate arguments + if (t == NULL) + { + return; + } + + // Release of the thread + OSFreeThread(t); + + // Release the event + ReleaseEvent(t->init_finished_event); + // Memory release + Free(t); + + // KS + KS_INC(KS_FREETHREAD_COUNT); +} + +// Wait for the termination of the thread +bool WaitThreadInternal(THREAD *t) +{ + // Validate arguments + if (t == NULL) + { + return false; + } + + return OSWaitThread(t); +} + +// Notify that the thread initialization is complete +void NoticeThreadInitInternal(THREAD *t) +{ + // Validate arguments + if (t == NULL) + { + return; + } + + // Notify + Set(t->init_finished_event); +} + +// Wait for completion of thread initialization +void WaitThreadInitInternal(THREAD *t) +{ + // Validate arguments + if (t == NULL) + { + return; + } + + // KS + KS_INC(KS_WAITFORTHREAD_COUNT); + + // Wait + Wait(t->init_finished_event, INFINITE); +} + +// Get the date and time string by using the locale information +void GetDateTimeStrEx(wchar_t *str, UINT size, SYSTEMTIME *st, LOCALE *locale) +{ + wchar_t tmp1[MAX_SIZE]; + wchar_t tmp2[MAX_SIZE]; + // Validate arguments + if (str == NULL || st == NULL) + { + return; + } + + GetDateStrEx(tmp1, sizeof(tmp1), st, locale); + GetTimeStrEx(tmp2, sizeof(tmp2), st, locale); + UniFormat(str, size, L"%s %s", tmp1, tmp2); +} + +// Get the time string by using the locale information +void GetTimeStrEx(wchar_t *str, UINT size, SYSTEMTIME *st, LOCALE *locale) +{ + wchar_t *tag = L"%02u%s%02u%s%02u%s"; + // Validate arguments + if (str == NULL || st == NULL) + { + return; + } + + if (_GETLANG() == SE_LANG_JAPANESE || _GETLANG() == SE_LANG_CHINESE_ZH) + { + tag = L"%2u%s%2u%s%2u%s"; + } + + locale = (locale != NULL ? locale : ¤t_locale); + UniFormat(str, size, + tag, + st->wHour, locale->HourStr, + st->wMinute, locale->MinuteStr, + st->wSecond, locale->SecondStr); +} + +// Get a date string by using the locale information +void GetDateStrEx(wchar_t *str, UINT size, SYSTEMTIME *st, LOCALE *locale) +{ + wchar_t *tag = L"%04u%s%02u%s%02u%s (%s)"; + // Validate arguments + if (str == NULL || st == NULL) + { + return; + } + + if (_GETLANG() == SE_LANG_JAPANESE || _GETLANG() == SE_LANG_CHINESE_ZH) + { + tag = L"%4u%s%2u%s%2u%s(%s)"; + } + + locale = (locale != NULL ? locale : ¤t_locale); + UniFormat(str, size, + tag, + st->wYear, locale->YearStr, + st->wMonth, locale->MonthStr, + st->wDay, locale->DayStr, + locale->DayOfWeek[st->wDayOfWeek]); +} + +// Get the time string to milliseconds (for example, 12:34:56.789) +void GetTimeStrMilli(char *str, UINT size, SYSTEMTIME *st) +{ + // Validate arguments + if (st == NULL || str == NULL) + { + return; + } + + Format(str, size, "%02u:%02u:%02u.%03u", + st->wHour, st->wMinute, st->wSecond, st->wMilliseconds); +} + +// Get the date string (example: 2004/07/23) +void GetDateStr(char *str, UINT size, SYSTEMTIME *st) +{ + // Validate arguments + if (str == NULL || st == NULL) + { + return; + } + + Format(str, size, "%04u-%02u-%02u", + st->wYear, st->wMonth, st->wDay); +} + +// Get the date and time string (example: 2004/07/23 12:34:56) +void GetDateTimeStr(char *str, UINT size, SYSTEMTIME *st) +{ + // Validate arguments + if (str == NULL || st == NULL) + { + return; + } + + Format(str, size, "%04u-%02u-%02u %02u:%02u:%02u", + st->wYear, st->wMonth, st->wDay, + st->wHour, st->wMinute, st->wSecond); +} + +// Get the date and time string in milliseconds (example: 2004/07/23 12:34:56.789) +void GetDateTimeStrMilli(char *str, UINT size, SYSTEMTIME *st) +{ + // Validate arguments + if (str == NULL || st == NULL) + { + return; + } + + Format(str, size, "%04u-%02u-%02u %02u:%02u:%02u.%03u", + st->wYear, st->wMonth, st->wDay, + st->wHour, st->wMinute, st->wSecond, + st->wMilliseconds); +} + + +// Convert string RFC3339 format (example: 2017-09-27T18:25:55.434-9:00) to UINT64 +UINT64 DateTimeStrRFC3339ToSystemTime64(char *str) +{ + SYSTEMTIME st; + if (DateTimeStrRFC3339ToSystemTime(&st, str)) + { + return SystemToUINT64(&st); + } + else + { + return 0; + } +} + +// Convert string RFC3339 format (example: 2017-09-27T18:25:55.434-9:00) to SYSTEMTIME +bool DateTimeStrRFC3339ToSystemTime(SYSTEMTIME *st, char *str) +{ + bool ok = false; + UINT index_plus; + char tmp[MAX_PATH]; + Zero(st, sizeof(SYSTEMTIME)); + if (st == NULL || str == NULL) + { + return false; + } + + StrCpy(tmp, sizeof(tmp), str); + + index_plus = SearchStrEx(tmp, "+", 0, false); + if (index_plus != INFINITE) + { + tmp[index_plus] = 0; + } + + if (StrLen(tmp) >= 19) + { + if (tmp[4] == '-' && tmp[7] == '-' && tmp[10] == 'T' && tmp[13] == ':' && + tmp[16] == ':') + { + char str_year[16], str_month[16], str_day[16], str_hour[16], str_minute[16], + str_second[16], str_msec[16]; + + StrCpy(str_year, sizeof(str_year), tmp + 0); + str_year[4] = 0; + + StrCpy(str_month, sizeof(str_month), tmp + 5); + str_month[2] = 0; + + StrCpy(str_day, sizeof(str_day), tmp + 8); + str_day[2] = 0; + + StrCpy(str_hour, sizeof(str_hour), tmp + 11); + str_hour[2] = 0; + + StrCpy(str_minute, sizeof(str_minute), tmp + 14); + str_minute[2] = 0; + + StrCpy(str_second, sizeof(str_second), tmp + 17); + str_second[2] = 0; + + str_msec[0] = 0; + + if (StrLen(tmp) >= 21 && tmp[19] == '.') + { + StrCpy(str_msec, sizeof(str_msec), tmp + 20); + str_msec[StrLen(tmp) - 21] = 0; + while (StrLen(str_msec) < 3) + { + StrCat(str_msec, sizeof(str_msec), "0"); + } + str_msec[3] = 0; + } + + st->wYear = ToInt(str_year); + st->wMonth = ToInt(str_month); + st->wDay = ToInt(str_day); + st->wHour = ToInt(str_hour); + st->wMinute = ToInt(str_minute); + st->wSecond = ToInt(str_second); + st->wMilliseconds = ToInt(str_msec); + + NormalizeSystem(st); + + ok = true; + } + } + + return ok; +} + +// Get the date and time string in RFC3339 format (example: 2017-09-27T18:25:55.434-9:00) +void GetDateTimeStrRFC3339(char *str, UINT size, SYSTEMTIME *st, int timezone_min){ + // Validate arguments + if (str == NULL || st == NULL) + { + ClearStr(str, size); + return; + } + + if(timezone_min == 0){ + Format(str, size, "%04u-%02u-%02uT%02u:%02u:%02u.%03uZ", + st->wYear, st->wMonth, st->wDay, + st->wHour, st->wMinute, st->wSecond, + st->wMilliseconds); + }else{ + Format(str, size, "%04u-%02u-%02uT%02u:%02u:%02u.%03u%+02d:%02d", + st->wYear, st->wMonth, st->wDay, + st->wHour, st->wMinute, st->wSecond, + st->wMilliseconds, timezone_min/60, timezone_min%60); + } +} + +// Get the time string (in milliseconds) +void GetSpanStrMilli(char *str, UINT size, UINT64 sec64) +{ + char tmp[MAX_SIZE]; + // Validate arguments + if (str == NULL) + { + return; + } + + StrCpy(tmp, sizeof(tmp), ""); + if (sec64 >= (UINT64)(1000 * 3600 * 24)) + { + Format(tmp, sizeof(tmp), "%u:", (UINT)(sec64 / (UINT64)(1000 * 3600 * 24))); + } + + Format(tmp, sizeof(tmp), "%s%02u:%02u:%02u.%03u", tmp, + (UINT)(sec64 % (UINT64)(1000 * 60 * 60 * 24)) / (1000 * 60 * 60), + (UINT)(sec64 % (UINT64)(1000 * 60 * 60)) / (1000 * 60), + (UINT)(sec64 % (UINT64)(1000 * 60)) / 1000, + (UINT)(sec64 % (UINT64)(1000))); + + Trim(tmp); + StrCpy(str, size, tmp); +} + +// Set the locale information +void SetLocale(wchar_t *str) +{ + wchar_t *set_locale_str; + LOCALE tmp; + + if (str != NULL) + { + set_locale_str = str; + } + else + { + set_locale_str = default_locale_str; + } + + if (LoadLocale(&tmp, set_locale_str) == false) + { + if (LoadLocale(&tmp, default_locale_str) == false) + { + return; + } + } + + Copy(¤t_locale, &tmp, sizeof(LOCALE)); +} + +#define COPY_LOCALE_STR(dest, size, src) UniStrCpy(dest, size, UniStrCmp(src, L"$") == 0 ? L"" : src) + +// Read the locale information +bool LoadLocale(LOCALE *locale, wchar_t *str) +{ + UNI_TOKEN_LIST *tokens; + UINT i; + // Validate arguments + if (locale == NULL || str == NULL) + { + return false; + } + + // Analysis of the token + tokens = UniParseToken(str, L" "); + if (tokens->NumTokens != 18) + { + UniFreeToken(tokens); + return false; + } + + // Set to the structure + Zero(locale, sizeof(LOCALE)); + COPY_LOCALE_STR(locale->YearStr, sizeof(locale->YearStr), tokens->Token[0]); + COPY_LOCALE_STR(locale->MonthStr, sizeof(locale->MonthStr), tokens->Token[1]); + COPY_LOCALE_STR(locale->DayStr, sizeof(locale->DayStr), tokens->Token[2]); + COPY_LOCALE_STR(locale->HourStr, sizeof(locale->HourStr), tokens->Token[3]); + COPY_LOCALE_STR(locale->MinuteStr, sizeof(locale->MinuteStr), tokens->Token[4]); + COPY_LOCALE_STR(locale->SecondStr, sizeof(locale->SecondStr), tokens->Token[5]); + + for (i = 0;i < 7;i++) + { + COPY_LOCALE_STR(locale->DayOfWeek[i], sizeof(locale->DayOfWeek[i]), + tokens->Token[6 + i]); + } + + COPY_LOCALE_STR(locale->SpanDay, sizeof(locale->SpanDay), tokens->Token[13]); + COPY_LOCALE_STR(locale->SpanHour, sizeof(locale->SpanHour), tokens->Token[14]); + COPY_LOCALE_STR(locale->SpanMinute, sizeof(locale->SpanMinute), tokens->Token[15]); + COPY_LOCALE_STR(locale->SpanSecond, sizeof(locale->SpanSecond), tokens->Token[16]); + + COPY_LOCALE_STR(locale->Unknown, sizeof(locale->Unknown), tokens->Token[17]); + + UniFreeToken(tokens); + return true; +} + +// Convert SYSTEMTIME into DOS date +USHORT SystemToDosDate(SYSTEMTIME *st) +{ + return (USHORT)( + ((UINT)(st->wYear - 1980) << 9) | + ((UINT)st->wMonth<< 5) | + (UINT)st->wDay); +} +USHORT System64ToDosDate(UINT64 i) +{ + SYSTEMTIME st; + UINT64ToSystem(&st, i); + return SystemToDosDate(&st); +} + +// Convert SYSTEMTIME into DOS time +USHORT SystemToDosTime(SYSTEMTIME *st) +{ + return (USHORT)( + ((UINT)st->wHour << 11) | + ((UINT)st->wMinute << 5) | + ((UINT)st->wSecond >> 1)); +} +USHORT System64ToDosTime(UINT64 i) +{ + SYSTEMTIME st; + UINT64ToSystem(&st, i); + return SystemToDosTime(&st); +} + +// Convert the tm to the SYSTEMTIME +void TmToSystem(SYSTEMTIME *st, struct tm *t) +{ + struct tm tmp; + // Validate arguments + if (st == NULL || t == NULL) + { + return; + } + + Copy(&tmp, t, sizeof(struct tm)); + NormalizeTm(&tmp); + + Zero(st, sizeof(SYSTEMTIME)); + st->wYear = MAKESURE(tmp.tm_year + 1900, 1970, 2099); + st->wMonth = MAKESURE(tmp.tm_mon + 1, 1, 12); + st->wDay = MAKESURE(tmp.tm_mday, 1, 31); + st->wDayOfWeek = MAKESURE(tmp.tm_wday, 0, 6); + st->wHour = MAKESURE(tmp.tm_hour, 0, 23); + st->wMinute = MAKESURE(tmp.tm_min, 0, 59); + st->wSecond = MAKESURE(tmp.tm_sec, 0, 59); + st->wMilliseconds = 0; +} + +// Convert the SYSTEMTIME to tm +void SystemToTm(struct tm *t, SYSTEMTIME *st) +{ + // Validate arguments + if (t == NULL || st == NULL) + { + return; + } + + Zero(t, sizeof(struct tm)); + t->tm_year = MAKESURE(st->wYear, 1970, 2099) - 1900; + t->tm_mon = MAKESURE(st->wMonth, 1, 12) - 1; + t->tm_mday = MAKESURE(st->wDay, 1, 31); + t->tm_hour = MAKESURE(st->wHour, 0, 23); + t->tm_min = MAKESURE(st->wMinute, 0, 59); + t->tm_sec = MAKESURE(st->wSecond, 0, 59); + + t->tm_isdst = -1; + NormalizeTm(t); +} + +// Convert the time_t to SYSTEMTIME +void TimeToSystem(SYSTEMTIME *st, time_64t t) +{ + struct tm tmp; + // Validate arguments + if (st == NULL) + { + return; + } + + TimeToTm(&tmp, t); + TmToSystem(st, &tmp); +} + +// Convert the SYSTEMTIME to time_t +time_64t SystemToTime(SYSTEMTIME *st) +{ + struct tm t; + // Validate arguments + if (st == NULL) + { + return 0; + } + + SystemToTm(&t, st); + return TmToTime(&t); +} + +// Convert the tm to time_t +time_64t TmToTime(struct tm *t) +{ + time_64t tmp; + // Validate arguments + if (t == NULL) + { + return 0; + } + + tmp = c_mkgmtime(t); + if (tmp == (time_64t)-1) + { + return 0; + } + return tmp; +} + +// Convert time_t to tm +void TimeToTm(struct tm *t, time_64t time) +{ + // Validate arguments + if (t == NULL) + { + return; + } + + Zero(t, sizeof(struct tm)); + c_gmtime_r(&time, t); +} + +// Normalize the tm +void NormalizeTm(struct tm *t) +{ + time_64t tmp; + // Validate arguments + if (t == NULL) + { + return; + } + + tmp = c_mkgmtime(t); + if (tmp == (time_64t)-1) + { + return; + } + + c_gmtime_r(&tmp, t); +} + +// Normalize the SYSTEMTIME +void NormalizeSystem(SYSTEMTIME *st) +{ + UINT64 sec64; + // Validate arguments + if (st == NULL) + { + return; + } + + sec64 = SystemToUINT64(st); + UINT64ToSystem(st, sec64); +} + +// Convert a 64-bit local time to a system time +UINT64 LocalToSystem64(UINT64 t) +{ + SYSTEMTIME st; + UINT64ToSystem(&st, t); + LocalToSystem(&st, &st); + return SystemToUINT64(&st); +} + +// Convert the 64bit system time to local time +UINT64 SystemToLocal64(UINT64 t) +{ + SYSTEMTIME st; + UINT64ToSystem(&st, t); + SystemToLocal(&st, &st); + return SystemToUINT64(&st); +} + +// Convert local time to system time +void LocalToSystem(SYSTEMTIME *system, SYSTEMTIME *local) +{ + UINT64 sec64; + // Validate arguments + if (local == NULL || system == NULL) + { + return; + } + + sec64 = (UINT64)((INT64)SystemToUINT64(local) - GetTimeDiffEx(local, true)); + UINT64ToSystem(system, sec64); +} + +// Convert the system time to local time +void SystemToLocal(SYSTEMTIME *local, SYSTEMTIME *system) +{ + UINT64 sec64; + // Validate arguments + if (local == NULL || system == NULL) + { + return; + } + + sec64 = (UINT64)((INT64)SystemToUINT64(system) + GetTimeDiffEx(system, false)); + UINT64ToSystem(local, sec64); +} + +// Get the time difference between the local time and the system time based on the specified time +INT64 GetTimeDiffEx(SYSTEMTIME *basetime, bool local_time) +{ + time_t tmp; + struct tm t1, t2; + SYSTEMTIME snow; + struct tm now; + SYSTEMTIME s1, s2; + INT64 ret; + + Copy(&snow, basetime, sizeof(SYSTEMTIME)); + + if (sizeof(time_t) == 4) + { + if (snow.wYear >= 2038) + { + // For old systems: avoid the 2038-year problem + snow.wYear = 2037; + } + } + + SystemToTm(&now, &snow); + if (local_time == false) + { + tmp = (time_t)c_mkgmtime(&now); + } + else + { + tmp = mktime(&now); + } + + if (tmp == (time_t)-1) + { + return 0; + } + +#ifndef OS_UNIX + Copy(&t1, localtime(&tmp), sizeof(struct tm)); + Copy(&t2, gmtime(&tmp), sizeof(struct tm)); +#else // OS_UNIX + localtime_r(&tmp, &t1); + gmtime_r(&tmp, &t2); +#endif // OS_UNIX + + TmToSystem(&s1, &t1); + TmToSystem(&s2, &t2); + + ret = (INT)SystemToUINT64(&s1) - (INT)SystemToUINT64(&s2); + + return ret; +} + +// Convert UINT64 to the SYSTEMTIME +void UINT64ToSystem(SYSTEMTIME *st, UINT64 sec64) +{ + UINT64 tmp64; + UINT sec, millisec; + time_64t time; + // Validate arguments + if (st == NULL) + { + return; + } + + sec64 = SafeTime64(sec64 + 32400000ULL); + tmp64 = sec64 / (UINT64)1000; + millisec = (UINT)(sec64 - tmp64 * (UINT64)1000); + sec = (UINT)tmp64; + time = (time_64t)sec; + TimeToSystem(st, time); + st->wMilliseconds = (USHORT)millisec; +} + +// Convert the SYSTEMTIME to UINT64 +UINT64 SystemToUINT64(SYSTEMTIME *st) +{ + UINT64 sec64; + time_64t time; + // Validate arguments + if (st == NULL) + { + return 0; + } + + time = SystemToTime(st); + + //For times before 1970-01-01, clamp to the minimum + //because we have to return an unsigned integer. + //This is less wrong than casting it to UINT64 + //and returning a time far in the future. + //For some reason we subtract 9 hours below, so + //account for that here. + if( time < 32400000LL ) return 0; + + sec64 = (UINT64)time * (UINT64)1000; + sec64 += st->wMilliseconds; + + return sec64 - 32400000ULL; +} + +// Get local time in UINT64 +UINT64 LocalTime64() +{ + SYSTEMTIME s; + LocalTime(&s); + return SystemToUINT64(&s); +} + +// Get the system time in UINT64 +UINT64 SystemTime64() +{ + SYSTEMTIME s; + SystemTime(&s); + return SystemToUINT64(&s); +} + +// Get local time +void LocalTime(SYSTEMTIME *st) +{ + SYSTEMTIME tmp; + // Validate arguments + if (st == NULL) + { + return; + } + + SystemTime(&tmp); + SystemToLocal(st, &tmp); +} + +// Get the System Time +void SystemTime(SYSTEMTIME *st) +{ + // Validate arguments + if (st == NULL) + { + return; + } + + OSGetSystemTime(st); + + // KS + KS_INC(KS_GETTIME_COUNT); +} + +time_64t c_mkgmtime(struct tm *tm) +{ + int years, months, days, hours, minutes, seconds; + + years = tm->tm_year + 1900; /* year - 1900 -> year */ + months = tm->tm_mon; /* 0..11 */ + days = tm->tm_mday - 1; /* 1..31 -> 0..30 */ + hours = tm->tm_hour; /* 0..23 */ + minutes = tm->tm_min; /* 0..59 */ + seconds = tm->tm_sec; /* 0..61 in ANSI C. */ + + ADJUST_TM(seconds, minutes, 60); + ADJUST_TM(minutes, hours, 60); + ADJUST_TM(hours, days, 24); + ADJUST_TM(months, years, 12); + if (days < 0) + do { + if (--months < 0) { + --years; + months = 11; + } + days += monthlen(months, years); + } while (days < 0); + else + while (days >= monthlen(months, years)) { + days -= monthlen(months, years); + if (++months >= 12) { + ++years; + months = 0; + } + } + + /* Restore adjusted values in tm structure */ + tm->tm_year = years - 1900; + tm->tm_mon = months; + tm->tm_mday = days + 1; + tm->tm_hour = hours; + tm->tm_min = minutes; + tm->tm_sec = seconds; + + /* Set `days' to the number of days into the year. */ + days += ydays[months] + (months > 1 && leap (years)); + tm->tm_yday = days; + + /* Now calculate `days' to the number of days since Jan 1, 1970. */ + days = (unsigned)days + 365 * (unsigned)(years - 1970) + + (unsigned)(nleap (years)); + tm->tm_wday = ((unsigned)days + 4) % 7; /* Jan 1, 1970 was Thursday. */ + tm->tm_isdst = 0; + + if (years < 1970) + return (time_64t)-1; + +#if (defined(TM_YEAR_MAX) && defined(TM_MON_MAX) && defined(TM_MDAY_MAX)) +#if (defined(TM_HOUR_MAX) && defined(TM_MIN_MAX) && defined(TM_SEC_MAX)) + if (years > TM_YEAR_MAX || + (years == TM_YEAR_MAX && + (tm->tm_yday > ydays[TM_MON_MAX] + (TM_MDAY_MAX - 1) + + (TM_MON_MAX > 1 && leap (TM_YEAR_MAX)) || + (tm->tm_yday == ydays[TM_MON_MAX] + (TM_MDAY_MAX - 1) + + (TM_MON_MAX > 1 && leap (TM_YEAR_MAX)) && + (hours > TM_HOUR_MAX || + (hours == TM_HOUR_MAX && + (minutes > TM_MIN_MAX || + (minutes == TM_MIN_MAX && seconds > TM_SEC_MAX) ))))))) + return (time_64t)-1; +#endif +#endif + + return (time_64t)(86400L * (unsigned long)(unsigned)days + + 3600L * (unsigned long)hours + + (unsigned long)(60 * minutes + seconds)); +} + +// Get the system timer +UINT Tick() +{ + // KS + KS_INC(KS_GETTICK_COUNT); + return OSGetTick(); +} + +// Sleep thread +void SleepThread(UINT time) +{ + // KS + KS_INC(KS_SLEEPTHREAD_COUNT); + + OSSleep(time); +} + +// Yield +void YieldCpu() +{ + OSYield(); +} + +// Stop system (abnormal termination) +void AbortExit() +{ +#ifdef OS_WIN32 + _exit(1); +#else // OS_WIN32 + +#ifdef RLIMIT_CORE + UnixSetResourceLimit(RLIMIT_CORE, 0); +#endif // RLIMIT_CORE + + abort(); +#endif // OS_WIN32 +} + + +void AbortExitEx(char *msg) +{ + FILE *f; + // Validate arguments + if (msg == NULL) + { + msg = "Unknown Error"; + } + + f = fopen("abort_error_log.txt", "w"); + if (f != NULL) + { + fwrite(msg, 1, strlen(msg), f); + fclose(f); + } + + fputs("Fatal Error: ", stdout); + fputs(msg, stdout); + fputs("\r\n", stdout); + +#ifdef OS_WIN32 + _exit(1); +#else // OS_WIN32 + +#ifdef RLIMIT_CORE + UnixSetResourceLimit(RLIMIT_CORE, 0); +#endif // RLIMIT_CORE + + abort(); +#endif // OS_WIN32 +} + diff --git a/src/Mayaqua/Kernel.h b/src/Mayaqua/Kernel.h index f2db8e22..563a8832 100644 --- a/src/Mayaqua/Kernel.h +++ b/src/Mayaqua/Kernel.h @@ -1,168 +1,168 @@ -// SoftEther VPN Source Code - Developer Edition Master Branch -// Mayaqua Kernel - - -#ifndef KERNEL_H -#define KERNEL_H - -// Memory usage information -struct MEMINFO -{ - UINT64 TotalMemory; - UINT64 UsedMemory; - UINT64 FreeMemory; - UINT64 TotalPhys; - UINT64 UsedPhys; - UINT64 FreePhys; -}; - -// Locale information -struct LOCALE -{ - wchar_t YearStr[16], MonthStr[16], DayStr[16]; - wchar_t HourStr[16], MinuteStr[16], SecondStr[16]; - wchar_t DayOfWeek[7][16]; - wchar_t SpanDay[16], SpanHour[16], SpanMinute[16], SpanSecond[16]; - wchar_t Unknown[32]; -}; - - -// Thread procedure -typedef void (THREAD_PROC)(THREAD *thread, void *param); - -// Thread -struct THREAD -{ - REF *ref; - THREAD_PROC *thread_proc; - void *param; - void *pData; - EVENT *init_finished_event; - void *AppData1, *AppData2, *AppData3; - UINT AppInt1, AppInt2, AppInt3; - UINT ThreadId; - bool PoolThread; - THREAD *PoolHostThread; - LIST *PoolWaitList; // Thread termination waiting list - volatile bool PoolHalting; // Thread stopped - EVENT *release_event; - bool Stopped; // Indicates that the operation is Stopped - char *Name; // Thread name -}; - -// Thread pool data -struct THREAD_POOL_DATA -{ - EVENT *Event; // Waiting Event - EVENT *InitFinishEvent; // Initialization is completed event - THREAD *Thread; // Threads that are currently assigned - THREAD_PROC *ThreadProc; // Thread procedure that is currently assigned -}; - -// Instance -struct INSTANCE -{ - char *Name; // Name - void *pData; // Data -}; - -// Create a new thread -#define NewThread(thread_proc, param) NewThreadNamed((thread_proc), (param), (#thread_proc)) - -// Function prototype -void SleepThread(UINT time); -THREAD *NewThreadInternal(THREAD_PROC *thread_proc, void *param); -void ReleaseThreadInternal(THREAD *t); -void CleanupThreadInternal(THREAD *t); -void NoticeThreadInitInternal(THREAD *t); -void WaitThreadInitInternal(THREAD *t); -bool WaitThreadInternal(THREAD *t); -THREAD *NewThreadNamed(THREAD_PROC *thread_proc, void *param, char *name); -void ReleaseThread(THREAD *t); -void CleanupThread(THREAD *t); -void NoticeThreadInit(THREAD *t); -void WaitThreadInit(THREAD *t); -bool WaitThread(THREAD *t, UINT timeout); -void InitThreading(); -void FreeThreading(); -void ThreadPoolProc(THREAD *t, void *param); -void SetThreadName(UINT thread_id, char *name, void *param); - -struct tm * c_gmtime_r(const time_64t* timep, struct tm *tm); -time_64t c_mkgmtime(struct tm *tm); -void TmToSystem(SYSTEMTIME *st, struct tm *t); -void SystemToTm(struct tm *t, SYSTEMTIME *st); -void TimeToSystem(SYSTEMTIME *st, time_64t t); -time_64t SystemToTime(SYSTEMTIME *st); -time_64t TmToTime(struct tm *t); -void TimeToTm(struct tm *t, time_64t time); -void NormalizeTm(struct tm *t); -void NormalizeSystem(SYSTEMTIME *st); -void LocalToSystem(SYSTEMTIME *system, SYSTEMTIME *local); -void SystemToLocal(SYSTEMTIME *local, SYSTEMTIME *system); -INT64 GetTimeDiffEx(SYSTEMTIME *basetime, bool local_time); -void UINT64ToSystem(SYSTEMTIME *st, UINT64 sec64); -UINT64 SystemToUINT64(SYSTEMTIME *st); -UINT64 LocalTime64(); -UINT64 SystemTime64(); -USHORT SystemToDosDate(SYSTEMTIME *st); -USHORT System64ToDosDate(UINT64 i); -USHORT SystemToDosTime(SYSTEMTIME *st); -USHORT System64ToDosTime(UINT64 i); -void LocalTime(SYSTEMTIME *st); -void SystemTime(SYSTEMTIME *st); -void SetLocale(wchar_t *str); -bool LoadLocale(LOCALE *locale, wchar_t *str); -void GetDateTimeStr(char *str, UINT size, SYSTEMTIME *st); -void GetDateTimeStrMilli(char *str, UINT size, SYSTEMTIME *st); -void GetDateStr(char *str, UINT size, SYSTEMTIME *st); -void GetDateTimeStrEx(wchar_t *str, UINT size, SYSTEMTIME *st, LOCALE *locale); -void GetTimeStrEx(wchar_t *str, UINT size, SYSTEMTIME *st, LOCALE *locale); -void GetDateStrEx(wchar_t *str, UINT size, SYSTEMTIME *st, LOCALE *locale); -void GetTimeStrMilli(char *str, UINT size, SYSTEMTIME *st); -UINT Tick(); -UINT TickRealtime(); -UINT TickRealtimeManual(); -UINT64 TickGetRealtimeTickValue64(); -UINT64 SystemToLocal64(UINT64 t); -UINT64 LocalToSystem64(UINT64 t); -UINT ThreadId(); -void GetDateTimeStr64(char *str, UINT size, UINT64 sec64); -void GetDateTimeStr64Uni(wchar_t *str, UINT size, UINT64 sec64); -void GetDateTimeStrMilli64(char *str, UINT size, UINT64 sec64); -void GetDateTimeStrMilli64ForFileName(char *str, UINT size, UINT64 sec64); -void GetDateTimeStrMilliForFileName(char *str, UINT size, SYSTEMTIME *tm); -void GetDateStr64(char *str, UINT size, UINT64 sec64); -void GetDateTimeStrEx64(wchar_t *str, UINT size, UINT64 sec64, LOCALE *locale); -void GetDateStrEx64(wchar_t *str, UINT size, UINT64 sec64, LOCALE *locale); -void GetTimeStrMilli64(char *str, UINT size, UINT64 sec64); -void GetDateTimeStrRFC3339(char *str, UINT size, SYSTEMTIME *st, int timezone_min); -bool DateTimeStrRFC3339ToSystemTime(SYSTEMTIME *st, char *str); -UINT64 DateTimeStrRFC3339ToSystemTime64(char *str); -UINT64 SafeTime64(UINT64 sec64); -bool Run(char *filename, char *arg, bool hide, bool wait); -bool RunW(wchar_t *filename, wchar_t *arg, bool hide, bool wait); -void HashInstanceName(char *name, UINT size, char *instance_name); -void HashInstanceNameLocal(char *name, UINT size, char *instance_name); -INSTANCE *NewSingleInstance(char *instance_name); -INSTANCE *NewSingleInstanceEx(char *instance_name, bool user_local); -void FreeSingleInstance(INSTANCE *inst); -void GetSpanStrMilli(char *str, UINT size, UINT64 sec64); -void GetMemInfo(MEMINFO *info); -bool GetEnv(char *name, char *data, UINT size); -bool GetEnvW(wchar_t *name, wchar_t *data, UINT size); -bool GetEnvW_ForWin32(wchar_t *name, wchar_t *data, UINT size); -bool GetEnvW_ForUnix(wchar_t *name, wchar_t *data, UINT size); -void GetHomeDirW(wchar_t *path, UINT size); -void AbortExit(); -void AbortExitEx(char *msg); -void YieldCpu(); -LIST *NewThreadList(); -void AddThreadToThreadList(LIST *o, THREAD *t); -void MaintainThreadList(LIST *o); -void FreeThreadList(LIST *o); -void StopThreadList(LIST *o); -UINT GetNumberOfCpu(); - -#endif // KERNEL_H - +// SoftEther VPN Source Code - Developer Edition Master Branch +// Mayaqua Kernel + + +#ifndef KERNEL_H +#define KERNEL_H + +// Memory usage information +struct MEMINFO +{ + UINT64 TotalMemory; + UINT64 UsedMemory; + UINT64 FreeMemory; + UINT64 TotalPhys; + UINT64 UsedPhys; + UINT64 FreePhys; +}; + +// Locale information +struct LOCALE +{ + wchar_t YearStr[16], MonthStr[16], DayStr[16]; + wchar_t HourStr[16], MinuteStr[16], SecondStr[16]; + wchar_t DayOfWeek[7][16]; + wchar_t SpanDay[16], SpanHour[16], SpanMinute[16], SpanSecond[16]; + wchar_t Unknown[32]; +}; + + +// Thread procedure +typedef void (THREAD_PROC)(THREAD *thread, void *param); + +// Thread +struct THREAD +{ + REF *ref; + THREAD_PROC *thread_proc; + void *param; + void *pData; + EVENT *init_finished_event; + void *AppData1, *AppData2, *AppData3; + UINT AppInt1, AppInt2, AppInt3; + UINT ThreadId; + bool PoolThread; + THREAD *PoolHostThread; + LIST *PoolWaitList; // Thread termination waiting list + volatile bool PoolHalting; // Thread stopped + EVENT *release_event; + bool Stopped; // Indicates that the operation is Stopped + char *Name; // Thread name +}; + +// Thread pool data +struct THREAD_POOL_DATA +{ + EVENT *Event; // Waiting Event + EVENT *InitFinishEvent; // Initialization is completed event + THREAD *Thread; // Threads that are currently assigned + THREAD_PROC *ThreadProc; // Thread procedure that is currently assigned +}; + +// Instance +struct INSTANCE +{ + char *Name; // Name + void *pData; // Data +}; + +// Create a new thread +#define NewThread(thread_proc, param) NewThreadNamed((thread_proc), (param), (#thread_proc)) + +// Function prototype +void SleepThread(UINT time); +THREAD *NewThreadInternal(THREAD_PROC *thread_proc, void *param); +void ReleaseThreadInternal(THREAD *t); +void CleanupThreadInternal(THREAD *t); +void NoticeThreadInitInternal(THREAD *t); +void WaitThreadInitInternal(THREAD *t); +bool WaitThreadInternal(THREAD *t); +THREAD *NewThreadNamed(THREAD_PROC *thread_proc, void *param, char *name); +void ReleaseThread(THREAD *t); +void CleanupThread(THREAD *t); +void NoticeThreadInit(THREAD *t); +void WaitThreadInit(THREAD *t); +bool WaitThread(THREAD *t, UINT timeout); +void InitThreading(); +void FreeThreading(); +void ThreadPoolProc(THREAD *t, void *param); +void SetThreadName(UINT thread_id, char *name, void *param); + +struct tm * c_gmtime_r(const time_64t* timep, struct tm *tm); +time_64t c_mkgmtime(struct tm *tm); +void TmToSystem(SYSTEMTIME *st, struct tm *t); +void SystemToTm(struct tm *t, SYSTEMTIME *st); +void TimeToSystem(SYSTEMTIME *st, time_64t t); +time_64t SystemToTime(SYSTEMTIME *st); +time_64t TmToTime(struct tm *t); +void TimeToTm(struct tm *t, time_64t time); +void NormalizeTm(struct tm *t); +void NormalizeSystem(SYSTEMTIME *st); +void LocalToSystem(SYSTEMTIME *system, SYSTEMTIME *local); +void SystemToLocal(SYSTEMTIME *local, SYSTEMTIME *system); +INT64 GetTimeDiffEx(SYSTEMTIME *basetime, bool local_time); +void UINT64ToSystem(SYSTEMTIME *st, UINT64 sec64); +UINT64 SystemToUINT64(SYSTEMTIME *st); +UINT64 LocalTime64(); +UINT64 SystemTime64(); +USHORT SystemToDosDate(SYSTEMTIME *st); +USHORT System64ToDosDate(UINT64 i); +USHORT SystemToDosTime(SYSTEMTIME *st); +USHORT System64ToDosTime(UINT64 i); +void LocalTime(SYSTEMTIME *st); +void SystemTime(SYSTEMTIME *st); +void SetLocale(wchar_t *str); +bool LoadLocale(LOCALE *locale, wchar_t *str); +void GetDateTimeStr(char *str, UINT size, SYSTEMTIME *st); +void GetDateTimeStrMilli(char *str, UINT size, SYSTEMTIME *st); +void GetDateStr(char *str, UINT size, SYSTEMTIME *st); +void GetDateTimeStrEx(wchar_t *str, UINT size, SYSTEMTIME *st, LOCALE *locale); +void GetTimeStrEx(wchar_t *str, UINT size, SYSTEMTIME *st, LOCALE *locale); +void GetDateStrEx(wchar_t *str, UINT size, SYSTEMTIME *st, LOCALE *locale); +void GetTimeStrMilli(char *str, UINT size, SYSTEMTIME *st); +UINT Tick(); +UINT TickRealtime(); +UINT TickRealtimeManual(); +UINT64 TickGetRealtimeTickValue64(); +UINT64 SystemToLocal64(UINT64 t); +UINT64 LocalToSystem64(UINT64 t); +UINT ThreadId(); +void GetDateTimeStr64(char *str, UINT size, UINT64 sec64); +void GetDateTimeStr64Uni(wchar_t *str, UINT size, UINT64 sec64); +void GetDateTimeStrMilli64(char *str, UINT size, UINT64 sec64); +void GetDateTimeStrMilli64ForFileName(char *str, UINT size, UINT64 sec64); +void GetDateTimeStrMilliForFileName(char *str, UINT size, SYSTEMTIME *tm); +void GetDateStr64(char *str, UINT size, UINT64 sec64); +void GetDateTimeStrEx64(wchar_t *str, UINT size, UINT64 sec64, LOCALE *locale); +void GetDateStrEx64(wchar_t *str, UINT size, UINT64 sec64, LOCALE *locale); +void GetTimeStrMilli64(char *str, UINT size, UINT64 sec64); +void GetDateTimeStrRFC3339(char *str, UINT size, SYSTEMTIME *st, int timezone_min); +bool DateTimeStrRFC3339ToSystemTime(SYSTEMTIME *st, char *str); +UINT64 DateTimeStrRFC3339ToSystemTime64(char *str); +UINT64 SafeTime64(UINT64 sec64); +bool Run(char *filename, char *arg, bool hide, bool wait); +bool RunW(wchar_t *filename, wchar_t *arg, bool hide, bool wait); +void HashInstanceName(char *name, UINT size, char *instance_name); +void HashInstanceNameLocal(char *name, UINT size, char *instance_name); +INSTANCE *NewSingleInstance(char *instance_name); +INSTANCE *NewSingleInstanceEx(char *instance_name, bool user_local); +void FreeSingleInstance(INSTANCE *inst); +void GetSpanStrMilli(char *str, UINT size, UINT64 sec64); +void GetMemInfo(MEMINFO *info); +bool GetEnv(char *name, char *data, UINT size); +bool GetEnvW(wchar_t *name, wchar_t *data, UINT size); +bool GetEnvW_ForWin32(wchar_t *name, wchar_t *data, UINT size); +bool GetEnvW_ForUnix(wchar_t *name, wchar_t *data, UINT size); +void GetHomeDirW(wchar_t *path, UINT size); +void AbortExit(); +void AbortExitEx(char *msg); +void YieldCpu(); +LIST *NewThreadList(); +void AddThreadToThreadList(LIST *o, THREAD *t); +void MaintainThreadList(LIST *o); +void FreeThreadList(LIST *o); +void StopThreadList(LIST *o); +UINT GetNumberOfCpu(); + +#endif // KERNEL_H + diff --git a/src/Mayaqua/MayaType.h b/src/Mayaqua/MayaType.h index 32548c6c..1f09f831 100644 --- a/src/Mayaqua/MayaType.h +++ b/src/Mayaqua/MayaType.h @@ -1,498 +1,498 @@ -// SoftEther VPN Source Code - Developer Edition Master Branch -// Mayaqua Kernel - - -// MayaType.h -// Mayaqua Kernel type declaration header file - -#ifndef MAYATYPE_H -#define MAYATYPE_H - -#include - -// Check whether the windows.h header is included -#ifndef WINDOWS_H -#ifdef _WINDOWS_ -#define WINDOWS_H -#endif // _WINDOWS_ -#endif // WINDOWS_H - -#if !defined(ENCRYPT_C) -// Structure which is used by OpenSSL -typedef struct x509_st X509; -typedef struct evp_pkey_st EVP_PKEY; -typedef struct bio_st BIO; -typedef struct ssl_st SSL; -typedef struct ssl_ctx_st SSL_CTX; -typedef struct X509_req_st X509_REQ; -typedef struct PKCS12 PKCS12; -typedef struct bignum_st BIGNUM; -typedef struct x509_crl_st X509_CRL; -#endif // ENCRYPT_C - -// -// Constant -// - -// Standard buffer size -#define STD_SIZE 512 -#define MAX_SIZE 512 -#define BUF_SIZE 512 - -// Support Windows OS list -#define SUPPORTED_WINDOWS_LIST "Windows 98 / 98 SE / ME / NT 4.0 SP6a / 2000 SP4 / XP SP2, SP3 / Vista SP1, SP2 / 7 SP1 / 8 / 8.1 / 10 / Server 2003 SP2 / Server 2008 SP1, SP2 / Hyper-V Server 2008 / Server 2008 R2 SP1 / Hyper-V Server 2008 R2 / Server 2012 / Hyper-V Server 2012 / Server 2012 R2 / Hyper-V Server 2012 R2 / Server 2016 / Server 2019" - -// Infinite -#ifndef WINDOWS_H -#define INFINITE (0xFFFFFFFF) -#endif - - -#define SRC_NAME __FILE__ // File name of the source code -#define SRC_LINE __LINE__ // Line number in the source code - -// Maximum path size -#ifndef WINDOWS_H -#define MAX_PATH 260 -#endif // WINDOWS_H - -// Types of seek -#ifndef FILE_BEGIN -#define FILE_BEGIN SEEK_SET -#endif // FILE_BEGIN -#ifndef FILE_END -#define FILE_END SEEK_END -#endif // FILE_END -#ifndef FILE_CURRENT -#define FILE_CURRENT SEEK_CUR -#endif // FILE_CURRENT - -#ifndef INVALID_SOCKET -#define INVALID_SOCKET (-1) -#endif // INVALID_SOCKET - -#ifndef SOCKET_ERROR -#define SOCKET_ERROR (-1) -#endif //SOCKET_ERROR - -// Comparison function -typedef int (COMPARE)(void *p1, void *p2); - - -// -// Macro - - -#ifdef MAX -#undef MAX -#endif // MAX - -#ifdef MIN -#undef MIN -#endif // MIN - -// Minimum value of a and b -#define MIN(a, b) ((a) >= (b) ? (b) : (a)) -// Maximum value of a and b -#define MAX(a, b) ((a) >= (b) ? (a) : (b)) - -// Convert an int value to bool -#define INT_TO_BOOL(i) (((i) == 0) ? false : true) -#define MAKEBOOL(i) INT_TO_BOOL(i) -#define BOOL_TO_INT(i) (((i) == false) ? 0 : 1) - -// Invert the bool type value -#define NEGATIVE_BOOL(i) (((i) == false) ? true : false) - -// Return 'a' less than max_value -#define LESS(a, max_value) ((a) <= (max_value) ? (a) : (max_value)) -// Return 'a' greater than min_value -#define MORE(a, min_value) ((a) >= (min_value) ? (a) : (min_value)) -// Examine whether the value a is between the b and c -#define INNER(a, b, c) (((b) <= (c) && (a) >= (b) && (a) <= (c)) || ((b) >= (c) && (a) >= (c) && (a) <= (b))) -// Examine whether the value a is outbound of b and c -#define OUTER(a, b, c) (!INNER((a), (b), (c))) -// Adjust value 'a' to be between b and c -#define MAKESURE(a, b, c) (((b) <= (c)) ? (MORE(LESS((a), (c)), (b))) : (MORE(LESS((a), (b)), (c)))) -// Compare a and b -#define COMPARE_RET(a, b) (((a) == (b)) ? 0 : (((a) > (b)) ? 1 : -1)) -// Compare bool type values -#define EQUAL_BOOL(a, b) (((a) && (b)) || ((!(a)) && (!(b)))) -// Get the absolute value -#define GET_ABS(a) ((a) >= 0 ? (a) : -(a)) - -// Convert the pointer to UINT -#ifdef CPU_64 -#define POINTER_TO_KEY(p) HashPtrToUINT(p) -#else -#define POINTER_TO_KEY(p) (UINT)(p) -#endif - -// Compare the pointer and UINT -#define COMPARE_POINTER_AND_KEY(p, i) (POINTER_TO_KEY(p) == (i)) - -// Convert the pointer to UINT64 -#ifdef CPU_64 -#define POINTER_TO_UINT64(p) (UINT64)(p) -#else -#define POINTER_TO_UINT64(p) (UINT64)((UINT)(p)) -#endif - -// Convert a UINT64 to pointer -#ifdef CPU_64 -#define UINT64_TO_POINTER(i) (void *)(i) -#else -#define UINT64_TO_POINTER(i) (void *)((UINT)(i)) -#endif - -// Add the value -#define UINT_ADD(i, j) ((i == INFINITE || i == 0x7fffffff) ? (i) : (i += j)) - -// Reading data that is not dependent on the boundary or the endian -#define READ_USHORT(buf) (USHORT)((((USHORT)((UCHAR *)(buf))[0]) << 8) | (((USHORT)((UCHAR *)(buf))[1]))) -#define READ_UINT(buf) (UINT)((((UINT)((UCHAR *)(buf))[0]) << 24) | (((UINT)((UCHAR *)(buf))[1]) << 16) | (((UINT)((UCHAR *)(buf))[2]) << 8) | (((UINT)((UCHAR *)(buf))[3]))) -#define READ_UINT64(buf) (UINT64)((((UINT64)((UCHAR *)(buf))[0]) << 56) | (((UINT64)((UCHAR *)(buf))[1]) << 48) | (((UINT64)((UCHAR *)(buf))[2]) << 40) | (((UINT64)((UCHAR *)(buf))[3]) << 32) | (((UINT64)((UCHAR *)(buf))[4]) << 24) | (((UINT64)((UCHAR *)(buf))[5]) << 16) | (((UINT64)((UCHAR *)(buf))[6]) << 8) | (((UINT64)((UCHAR *)(buf))[7]))) - -// Writing data that is not dependent on the boundary or endian -#define WRITE_USHORT(buf, i) (((UCHAR *)(buf))[0]) = ((((USHORT)(i)) >> 8) & 0xFF); (((UCHAR *)(buf))[1]) = ((((USHORT)(i))) & 0xFF) -#define WRITE_UINT(buf, i) (((UCHAR *)(buf))[0]) = ((((UINT)(i)) >> 24) & 0xFF); (((UCHAR *)(buf))[1]) = ((((UINT)(i)) >> 16) & 0xFF); (((UCHAR *)(buf))[2]) = ((((UINT)(i)) >> 8) & 0xFF); (((UCHAR *)(buf))[3]) = ((((UINT)(i))) & 0xFF) -#define WRITE_UINT64(buf, i) (((UCHAR *)(buf))[0]) = ((((UINT64)(i)) >> 56) & 0xFF); (((UCHAR *)(buf))[1]) = ((((UINT64)(i)) >> 48) & 0xFF); (((UCHAR *)(buf))[2]) = ((((UINT64)(i)) >> 40) & 0xFF); (((UCHAR *)(buf))[3]) = ((((UINT64)(i)) >> 32) & 0xFF); (((UCHAR *)(buf))[4]) = ((((UINT64)(i)) >> 24) & 0xFF); (((UCHAR *)(buf))[5]) = ((((UINT64)(i)) >> 16) & 0xFF); (((UCHAR *)(buf))[6]) = ((((UINT64)(i)) >> 8) & 0xFF); (((UCHAR *)(buf))[7]) = ((((UINT64)(i))) & 0xFF) - - - -// -// Type declaration -// - -// PID type -#ifdef OS_UNIX -typedef int PID; -#endif // OS_UNIX -#ifdef OS_WIN32 -typedef unsigned long PID; -#endif // WINDOWS_H - -// TODO: include instead of manually defining type -#ifndef WIN32COM_CPP -typedef unsigned int bool; -#define true 1 -#define false 0 -#endif // WIN32COM_CPP - -typedef int64_t time_64t; - -#ifndef _BASETSD_H_ -typedef int32_t INT; -typedef int64_t INT64; - -typedef uint32_t UINT; -typedef uint64_t UINT64; -#endif - -#ifndef BASETYPES -typedef uint8_t BYTE; -typedef uint8_t UCHAR; -typedef uint16_t USHORT; -#endif - -#ifdef OS_UNIX -// Avoiding compile error -#define __cdecl -#define __declspec(x) -// socket type -typedef int SOCKET; -#else // OS_UNIX -#ifndef _WINSOCK2API_ -#ifdef CPU_64 -typedef unsigned __int64 SOCKET; -#else -typedef unsigned int SOCKET; -#endif // CPU_64 -#endif // _WINSOCK2API_ -#endif // OS_UNIX - -// OS type -#define OSTYPE_WINDOWS_95 1100 // Windows 95 -#define OSTYPE_WINDOWS_98 1200 // Windows 98 -#define OSTYPE_WINDOWS_ME 1300 // Windows Me -#define OSTYPE_WINDOWS_UNKNOWN 1400 // Windows (unknown) -#define OSTYPE_WINDOWS_NT_4_WORKSTATION 2100 // Windows NT 4.0 Workstation -#define OSTYPE_WINDOWS_NT_4_SERVER 2110 // Windows NT 4.0 Server -#define OSTYPE_WINDOWS_NT_4_SERVER_ENTERPRISE 2111 // Windows NT 4.0 Server, Enterprise Edition -#define OSTYPE_WINDOWS_NT_4_TERMINAL_SERVER 2112 // Windows NT 4.0 Terminal Server -#define OSTYPE_WINDOWS_NT_4_BACKOFFICE 2113 // BackOffice Server 4.5 -#define OSTYPE_WINDOWS_NT_4_SMS 2114 // Small Business Server 4.5 -#define OSTYPE_WINDOWS_2000_PROFESSIONAL 2200 // Windows 2000 Professional -#define OSTYPE_WINDOWS_2000_SERVER 2211 // Windows 2000 Server -#define OSTYPE_WINDOWS_2000_ADVANCED_SERVER 2212 // Windows 2000 Advanced Server -#define OSTYPE_WINDOWS_2000_DATACENTER_SERVER 2213 // Windows 2000 Datacenter Server -#define OSTYPE_WINDOWS_2000_BACKOFFICE 2214 // BackOffice Server 2000 -#define OSTYPE_WINDOWS_2000_SBS 2215 // Small Business Server 2000 -#define OSTYPE_WINDOWS_XP_HOME 2300 // Windows XP Home Edition -#define OSTYPE_WINDOWS_XP_PROFESSIONAL 2301 // Windows XP Professional -#define OSTYPE_WINDOWS_2003_WEB 2410 // Windows Server 2003 Web Edition -#define OSTYPE_WINDOWS_2003_STANDARD 2411 // Windows Server 2003 Standard Edition -#define OSTYPE_WINDOWS_2003_ENTERPRISE 2412 // Windows Server 2003 Enterprise Edition -#define OSTYPE_WINDOWS_2003_DATACENTER 2413 // Windows Server 2003 DataCenter Edition -#define OSTYPE_WINDOWS_2003_BACKOFFICE 2414 // BackOffice Server 2003 -#define OSTYPE_WINDOWS_2003_SBS 2415 // Small Business Server 2003 -#define OSTYPE_WINDOWS_LONGHORN_PROFESSIONAL 2500 // Windows Vista -#define OSTYPE_WINDOWS_LONGHORN_SERVER 2510 // Windows Server 2008 -#define OSTYPE_WINDOWS_7 2600 // Windows 7 -#define OSTYPE_WINDOWS_SERVER_2008_R2 2610 // Windows Server 2008 R2 -#define OSTYPE_WINDOWS_8 2700 // Windows 8 -#define OSTYPE_WINDOWS_SERVER_8 2710 // Windows Server 2012 -#define OSTYPE_WINDOWS_81 2701 // Windows 8.1 -#define OSTYPE_WINDOWS_SERVER_81 2711 // Windows Server 2012 R2 -#define OSTYPE_WINDOWS_10 2702 // Windows 10 -#define OSTYPE_WINDOWS_SERVER_10 2712 // Windows Server 10 -#define OSTYPE_WINDOWS_11 2800 // Windows 11 or later -#define OSTYPE_WINDOWS_SERVER_11 2810 // Windows Server 11 or later -#define OSTYPE_UNIX_UNKNOWN 3000 // Unknown UNIX -#define OSTYPE_LINUX 3100 // Linux -#define OSTYPE_SOLARIS 3200 // Solaris -#define OSTYPE_CYGWIN 3300 // Cygwin -#define OSTYPE_BSD 3400 // BSD -#define OSTYPE_MACOS_X 3500 // MacOS X - - -// OS discrimination macro -#define GET_KETA(t, i) (((t) % (i * 10)) / i) -#define OS_IS_WINDOWS_9X(t) (GET_KETA(t, 1000) == 1) -#define OS_IS_WINDOWS_NT(t) (GET_KETA(t, 1000) == 2) -#define OS_IS_WINDOWS(t) (OS_IS_WINDOWS_9X(t) || OS_IS_WINDOWS_NT(t)) -#define OS_IS_SERVER(t) (OS_IS_WINDOWS_NT(t) && GET_KETA(t, 10)) -#define OS_IS_WORKSTATION(t) ((OS_IS_WINDOWS_NT(t) && (!(GET_KETA(t, 10)))) || OS_IS_WINDOWS_9X(t)) -#define OS_IS_UNIX(t) (GET_KETA(t, 1000) == 3) - - -// OS information -typedef struct OS_INFO -{ - UINT OsType; // OS type - UINT OsServicePack; // Service pack number - char *OsSystemName; // OS system name - char *OsProductName; // OS product name - char *OsVendorName; // OS vendor name - char *OsVersion; // OS version - char *KernelName; // Kernel name - char *KernelVersion; // Kernel version -} OS_INFO; - -// Time type -#ifndef WINDOWS_H -typedef struct SYSTEMTIME -{ - USHORT wYear; - USHORT wMonth; - USHORT wDayOfWeek; - USHORT wDay; - USHORT wHour; - USHORT wMinute; - USHORT wSecond; - USHORT wMilliseconds; -} SYSTEMTIME; -#endif // WINDOWS_H - - -// Object.h -typedef struct LOCK LOCK; -typedef struct COUNTER COUNTER; -typedef struct REF REF; -typedef struct EVENT EVENT; -typedef struct DEADCHECK DEADCHECK; - -// Tracking.h -typedef struct CALLSTACK_DATA CALLSTACK_DATA; -typedef struct TRACKING_OBJECT TRACKING_OBJECT; -typedef struct MEMORY_STATUS MEMORY_STATUS; -typedef struct TRACKING_LIST TRACKING_LIST; - -// FileIO.h -typedef struct IO IO; - -// Memory.h -typedef struct MEMTAG MEMTAG; -typedef struct BUF BUF; -typedef struct FIFO FIFO; -typedef struct LIST LIST; -typedef struct QUEUE QUEUE; -typedef struct SK SK; -typedef struct CANDIDATE CANDIDATE; -typedef struct STRMAP_ENTRY STRMAP_ENTRY; -typedef struct SHARED_BUFFER SHARED_BUFFER; -typedef struct HASH_LIST HASH_LIST; -typedef struct HASH_ENTRY HASH_ENTRY; -typedef struct PRAND PRAND; - -// Str.h -typedef struct TOKEN_LIST TOKEN_LIST; -typedef struct INI_ENTRY INI_ENTRY; -typedef struct JSON_OBJECT JSON_OBJECT; -typedef struct JSON_ARRAY JSON_ARRAY; -typedef struct JSON_VALUE JSON_VALUE; - -// Internat.h -typedef struct UNI_TOKEN_LIST UNI_TOKEN_LIST; - -// Encrypt.h -typedef struct CRYPT CRYPT; -typedef struct NAME NAME; -typedef struct X_SERIAL X_SERIAL; -typedef struct X X; -typedef struct K K; -typedef struct P12 P12; -typedef struct X_CRL X_CRL; -typedef struct DES_KEY_VALUE DES_KEY_VALUE; -typedef struct DES_KEY DES_KEY; -typedef struct DH_CTX DH_CTX; -typedef struct AES_KEY_VALUE AES_KEY_VALUE; -typedef struct CIPHER CIPHER; -typedef struct MD MD; - -// Secure.h -typedef struct SECURE_DEVICE SECURE_DEVICE; -typedef struct SEC_INFO SEC_INFO; -typedef struct SECURE SECURE; -typedef struct SEC_OBJ SEC_OBJ; - -// Kernel.h -typedef struct MEMINFO MEMINFO; -typedef struct LOCALE LOCALE; -typedef struct THREAD THREAD; -typedef struct THREAD_POOL_DATA THREAD_POOL_DATA; -typedef struct INSTANCE INSTANCE; - -// Pack.h -typedef struct VALUE VALUE; -typedef struct ELEMENT ELEMENT; -typedef struct PACK PACK; -typedef struct JSONPACKHINT JSONPACKHINT; -typedef struct JSONPACKHINT_ITEM JSONPACKHINT_ITEM; - -// Cfg.h -typedef struct FOLDER FOLDER; -typedef struct ITEM ITEM; -typedef struct CFG_RW CFG_RW; -typedef struct CFG_ENUM_PARAM CFG_ENUM_PARAM; - -// Table.h -typedef struct TABLE TABLE; -typedef struct LANGLIST LANGLIST; - -// Network.h -typedef struct IP IP; -typedef struct DNSCACHE DNSCACHE; -typedef struct SOCK_EVENT SOCK_EVENT; -typedef struct SOCK SOCK; -typedef struct SOCKSET SOCKSET; -typedef struct CANCEL CANCEL; -typedef struct ROUTE_ENTRY ROUTE_ENTRY; -typedef struct ROUTE_TABLE ROUTE_TABLE; -typedef struct IP_CLIENT IP_CLIENT; -typedef struct ROUTE_CHANGE ROUTE_CHANGE; -typedef struct ROUTE_CHANGE_DATA ROUTE_CHANGE_DATA; -typedef struct GETIP_THREAD_PARAM GETIP_THREAD_PARAM; -typedef struct WIN32_RELEASEADDRESS_THREAD_PARAM WIN32_RELEASEADDRESS_THREAD_PARAM; -typedef struct IPV6_ADDR IPV6_ADDR; -typedef struct TUBE TUBE; -typedef struct TUBEDATA TUBEDATA; -typedef struct PSEUDO PSEUDO; -typedef struct TUBEPAIR_DATA TUBEPAIR_DATA; -typedef struct UDPLISTENER UDPLISTENER; -typedef struct UDPLISTENER_SOCK UDPLISTENER_SOCK; -typedef struct UDPPACKET UDPPACKET; -typedef struct TCP_RAW_DATA TCP_RAW_DATA; -typedef struct INTERRUPT_MANAGER INTERRUPT_MANAGER; -typedef struct TUBE_FLUSH_LIST TUBE_FLUSH_LIST; -typedef struct ICMP_RESULT ICMP_RESULT; -typedef struct SSL_PIPE SSL_PIPE; -typedef struct SSL_BIO SSL_BIO; -typedef struct RUDP_STACK RUDP_STACK; -typedef struct RUDP_SOURCE_IP RUDP_SOURCE_IP; -typedef struct RUDP_SESSION RUDP_SESSION; -typedef struct RUDP_SEGMENT RUDP_SEGMENT; -typedef struct CONNECT_TCP_RUDP_PARAM CONNECT_TCP_RUDP_PARAM; -typedef struct TCP_PAIR_HEADER TCP_PAIR_HEADER; -typedef struct NIC_ENTRY NIC_ENTRY; -typedef struct HTTP_VALUE HTTP_VALUE; -typedef struct HTTP_HEADER HTTP_HEADER; -typedef struct DNSPROXY_CLIENT DNSPROXY_CLIENT; -typedef struct DNSPROXY_CACHE DNSPROXY_CACHE; -typedef struct QUERYIPTHREAD QUERYIPTHREAD; -typedef struct IPBLOCK IPBLOCK; -typedef struct SAFE_REQUEST SAFE_REQUEST; -typedef struct SAFE_LIST SAFE_LIST; -typedef struct SAFE_QUOTA SAFE_QUOTA; -typedef struct SAFE_QUOTA2 SAFE_QUOTA2; -typedef struct SAFE_BLOCK SAFE_BLOCK; -typedef struct SAFE_REQUEST_LOG SAFE_REQUEST_LOG; -typedef struct DYN_VALUE DYN_VALUE; -typedef struct RELAY_PARAMETER RELAY_PARAMETER; -typedef struct SSL_ACCEPT_SETTINGS SSL_ACCEPT_SETTINGS; - -// Tick64.h -typedef struct ADJUST_TIME ADJUST_TIME; -typedef struct TICK64 TICK64; - -// FileIO.h -typedef struct DIRENT DIRENT; -typedef struct DIRLIST DIRLIST; -typedef struct ZIP_DATA_HEADER ZIP_DATA_HEADER; -typedef struct ZIP_DATA_FOOTER ZIP_DATA_FOOTER; -typedef struct ZIP_DIR_HEADER ZIP_DIR_HEADER; -typedef struct ZIP_END_HEADER ZIP_END_HEADER; -typedef struct ZIP_FILE ZIP_FILE; -typedef struct ZIP_PACKER ZIP_PACKER; -typedef struct ENUM_DIR_WITH_SUB_DATA ENUM_DIR_WITH_SUB_DATA; - -// TcpIp.h -typedef struct MAC_HEADER MAC_HEADER; -typedef struct ARPV4_HEADER ARPV4_HEADER; -typedef struct IPV4_HEADER IPV4_HEADER; -typedef struct TAGVLAN_HEADER TAGVLAN_HEADER; -typedef struct UDP_HEADER UDP_HEADER; -typedef struct UDPV4_PSEUDO_HEADER UDPV4_PSEUDO_HEADER; -typedef struct IPV4_PSEUDO_HEADER IPV4_PSEUDO_HEADER; -typedef struct TCP_HEADER TCP_HEADER; -typedef struct ICMP_HEADER ICMP_HEADER; -typedef struct ICMP_ECHO ICMP_ECHO; -typedef struct DHCPV4_HEADER DHCPV4_HEADER; -typedef struct DNSV4_HEADER DNSV4_HEADER; -typedef struct BPDU_HEADER BPDU_HEADER; -typedef struct LLC_HEADER LLC_HEADER; -typedef struct PKT PKT; -typedef struct IPV6_HEADER_PACKET_INFO IPV6_HEADER_PACKET_INFO; -typedef struct IPV6_HEADER IPV6_HEADER; -typedef struct IPV6_OPTION_HEADER IPV6_OPTION_HEADER; -typedef struct IPV6_FRAGMENT_HEADER IPV6_FRAGMENT_HEADER; -typedef struct IPV6_PSEUDO_HEADER IPV6_PSEUDO_HEADER; -typedef struct ICMPV6_ROUTER_SOLICIATION_HEADER ICMPV6_ROUTER_SOLICIATION_HEADER; -typedef struct ICMPV6_ROUTER_ADVERTISEMENT_HEADER ICMPV6_ROUTER_ADVERTISEMENT_HEADER; -typedef struct ICMPV6_NEIGHBOR_SOLICIATION_HEADER ICMPV6_NEIGHBOR_SOLICIATION_HEADER; -typedef struct ICMPV6_NEIGHBOR_ADVERTISEMENT_HEADER ICMPV6_NEIGHBOR_ADVERTISEMENT_HEADER; -typedef struct ICMPV6_OPTION_LIST ICMPV6_OPTION_LIST; -typedef struct ICMPV6_OPTION ICMPV6_OPTION; -typedef struct ICMPV6_OPTION_LINK_LAYER ICMPV6_OPTION_LINK_LAYER; -typedef struct ICMPV6_OPTION_PREFIX ICMPV6_OPTION_PREFIX; -typedef struct ICMPV6_OPTION_MTU ICMPV6_OPTION_MTU; -typedef struct IPV6_HEADER_INFO IPV6_HEADER_INFO; -typedef struct ICMPV6_HEADER_INFO ICMPV6_HEADER_INFO; -typedef struct DHCPV4_DATA DHCPV4_DATA; -typedef struct DHCP_OPTION DHCP_OPTION; -typedef struct DHCP_OPTION_LIST DHCP_OPTION_LIST; -typedef struct DHCP_CLASSLESS_ROUTE DHCP_CLASSLESS_ROUTE; -typedef struct DHCP_CLASSLESS_ROUTE_TABLE DHCP_CLASSLESS_ROUTE_TABLE; -typedef struct HTTPLOG HTTPLOG; -typedef struct DHCP_MODIFY_OPTION DHCP_MODIFY_OPTION; -typedef struct NBTDG_HEADER NBTDG_HEADER; -typedef struct IKE_HEADER IKE_HEADER; - -// HTTP.h -typedef struct HTTP_MIME_TYPE HTTP_MIME_TYPE; - -// Proxy.h -typedef struct PROXY_PARAM_IN PROXY_PARAM_IN; -typedef struct PROXY_PARAM_OUT PROXY_PARAM_OUT; - -#endif // MAYATYPE_H +// SoftEther VPN Source Code - Developer Edition Master Branch +// Mayaqua Kernel + + +// MayaType.h +// Mayaqua Kernel type declaration header file + +#ifndef MAYATYPE_H +#define MAYATYPE_H + +#include + +// Check whether the windows.h header is included +#ifndef WINDOWS_H +#ifdef _WINDOWS_ +#define WINDOWS_H +#endif // _WINDOWS_ +#endif // WINDOWS_H + +#if !defined(ENCRYPT_C) +// Structure which is used by OpenSSL +typedef struct x509_st X509; +typedef struct evp_pkey_st EVP_PKEY; +typedef struct bio_st BIO; +typedef struct ssl_st SSL; +typedef struct ssl_ctx_st SSL_CTX; +typedef struct X509_req_st X509_REQ; +typedef struct PKCS12 PKCS12; +typedef struct bignum_st BIGNUM; +typedef struct x509_crl_st X509_CRL; +#endif // ENCRYPT_C + +// +// Constant +// + +// Standard buffer size +#define STD_SIZE 512 +#define MAX_SIZE 512 +#define BUF_SIZE 512 + +// Support Windows OS list +#define SUPPORTED_WINDOWS_LIST "Windows 98 / 98 SE / ME / NT 4.0 SP6a / 2000 SP4 / XP SP2, SP3 / Vista SP1, SP2 / 7 SP1 / 8 / 8.1 / 10 / Server 2003 SP2 / Server 2008 SP1, SP2 / Hyper-V Server 2008 / Server 2008 R2 SP1 / Hyper-V Server 2008 R2 / Server 2012 / Hyper-V Server 2012 / Server 2012 R2 / Hyper-V Server 2012 R2 / Server 2016 / Server 2019" + +// Infinite +#ifndef WINDOWS_H +#define INFINITE (0xFFFFFFFF) +#endif + + +#define SRC_NAME __FILE__ // File name of the source code +#define SRC_LINE __LINE__ // Line number in the source code + +// Maximum path size +#ifndef WINDOWS_H +#define MAX_PATH 260 +#endif // WINDOWS_H + +// Types of seek +#ifndef FILE_BEGIN +#define FILE_BEGIN SEEK_SET +#endif // FILE_BEGIN +#ifndef FILE_END +#define FILE_END SEEK_END +#endif // FILE_END +#ifndef FILE_CURRENT +#define FILE_CURRENT SEEK_CUR +#endif // FILE_CURRENT + +#ifndef INVALID_SOCKET +#define INVALID_SOCKET (-1) +#endif // INVALID_SOCKET + +#ifndef SOCKET_ERROR +#define SOCKET_ERROR (-1) +#endif //SOCKET_ERROR + +// Comparison function +typedef int (COMPARE)(void *p1, void *p2); + + +// +// Macro + + +#ifdef MAX +#undef MAX +#endif // MAX + +#ifdef MIN +#undef MIN +#endif // MIN + +// Minimum value of a and b +#define MIN(a, b) ((a) >= (b) ? (b) : (a)) +// Maximum value of a and b +#define MAX(a, b) ((a) >= (b) ? (a) : (b)) + +// Convert an int value to bool +#define INT_TO_BOOL(i) (((i) == 0) ? false : true) +#define MAKEBOOL(i) INT_TO_BOOL(i) +#define BOOL_TO_INT(i) (((i) == false) ? 0 : 1) + +// Invert the bool type value +#define NEGATIVE_BOOL(i) (((i) == false) ? true : false) + +// Return 'a' less than max_value +#define LESS(a, max_value) ((a) <= (max_value) ? (a) : (max_value)) +// Return 'a' greater than min_value +#define MORE(a, min_value) ((a) >= (min_value) ? (a) : (min_value)) +// Examine whether the value a is between the b and c +#define INNER(a, b, c) (((b) <= (c) && (a) >= (b) && (a) <= (c)) || ((b) >= (c) && (a) >= (c) && (a) <= (b))) +// Examine whether the value a is outbound of b and c +#define OUTER(a, b, c) (!INNER((a), (b), (c))) +// Adjust value 'a' to be between b and c +#define MAKESURE(a, b, c) (((b) <= (c)) ? (MORE(LESS((a), (c)), (b))) : (MORE(LESS((a), (b)), (c)))) +// Compare a and b +#define COMPARE_RET(a, b) (((a) == (b)) ? 0 : (((a) > (b)) ? 1 : -1)) +// Compare bool type values +#define EQUAL_BOOL(a, b) (((a) && (b)) || ((!(a)) && (!(b)))) +// Get the absolute value +#define GET_ABS(a) ((a) >= 0 ? (a) : -(a)) + +// Convert the pointer to UINT +#ifdef CPU_64 +#define POINTER_TO_KEY(p) HashPtrToUINT(p) +#else +#define POINTER_TO_KEY(p) (UINT)(p) +#endif + +// Compare the pointer and UINT +#define COMPARE_POINTER_AND_KEY(p, i) (POINTER_TO_KEY(p) == (i)) + +// Convert the pointer to UINT64 +#ifdef CPU_64 +#define POINTER_TO_UINT64(p) (UINT64)(p) +#else +#define POINTER_TO_UINT64(p) (UINT64)((UINT)(p)) +#endif + +// Convert a UINT64 to pointer +#ifdef CPU_64 +#define UINT64_TO_POINTER(i) (void *)(i) +#else +#define UINT64_TO_POINTER(i) (void *)((UINT)(i)) +#endif + +// Add the value +#define UINT_ADD(i, j) ((i == INFINITE || i == 0x7fffffff) ? (i) : (i += j)) + +// Reading data that is not dependent on the boundary or the endian +#define READ_USHORT(buf) (USHORT)((((USHORT)((UCHAR *)(buf))[0]) << 8) | (((USHORT)((UCHAR *)(buf))[1]))) +#define READ_UINT(buf) (UINT)((((UINT)((UCHAR *)(buf))[0]) << 24) | (((UINT)((UCHAR *)(buf))[1]) << 16) | (((UINT)((UCHAR *)(buf))[2]) << 8) | (((UINT)((UCHAR *)(buf))[3]))) +#define READ_UINT64(buf) (UINT64)((((UINT64)((UCHAR *)(buf))[0]) << 56) | (((UINT64)((UCHAR *)(buf))[1]) << 48) | (((UINT64)((UCHAR *)(buf))[2]) << 40) | (((UINT64)((UCHAR *)(buf))[3]) << 32) | (((UINT64)((UCHAR *)(buf))[4]) << 24) | (((UINT64)((UCHAR *)(buf))[5]) << 16) | (((UINT64)((UCHAR *)(buf))[6]) << 8) | (((UINT64)((UCHAR *)(buf))[7]))) + +// Writing data that is not dependent on the boundary or endian +#define WRITE_USHORT(buf, i) (((UCHAR *)(buf))[0]) = ((((USHORT)(i)) >> 8) & 0xFF); (((UCHAR *)(buf))[1]) = ((((USHORT)(i))) & 0xFF) +#define WRITE_UINT(buf, i) (((UCHAR *)(buf))[0]) = ((((UINT)(i)) >> 24) & 0xFF); (((UCHAR *)(buf))[1]) = ((((UINT)(i)) >> 16) & 0xFF); (((UCHAR *)(buf))[2]) = ((((UINT)(i)) >> 8) & 0xFF); (((UCHAR *)(buf))[3]) = ((((UINT)(i))) & 0xFF) +#define WRITE_UINT64(buf, i) (((UCHAR *)(buf))[0]) = ((((UINT64)(i)) >> 56) & 0xFF); (((UCHAR *)(buf))[1]) = ((((UINT64)(i)) >> 48) & 0xFF); (((UCHAR *)(buf))[2]) = ((((UINT64)(i)) >> 40) & 0xFF); (((UCHAR *)(buf))[3]) = ((((UINT64)(i)) >> 32) & 0xFF); (((UCHAR *)(buf))[4]) = ((((UINT64)(i)) >> 24) & 0xFF); (((UCHAR *)(buf))[5]) = ((((UINT64)(i)) >> 16) & 0xFF); (((UCHAR *)(buf))[6]) = ((((UINT64)(i)) >> 8) & 0xFF); (((UCHAR *)(buf))[7]) = ((((UINT64)(i))) & 0xFF) + + + +// +// Type declaration +// + +// PID type +#ifdef OS_UNIX +typedef int PID; +#endif // OS_UNIX +#ifdef OS_WIN32 +typedef unsigned long PID; +#endif // WINDOWS_H + +// TODO: include instead of manually defining type +#ifndef WIN32COM_CPP +typedef unsigned int bool; +#define true 1 +#define false 0 +#endif // WIN32COM_CPP + +typedef int64_t time_64t; + +#ifndef _BASETSD_H_ +typedef int32_t INT; +typedef int64_t INT64; + +typedef uint32_t UINT; +typedef uint64_t UINT64; +#endif + +#ifndef BASETYPES +typedef uint8_t BYTE; +typedef uint8_t UCHAR; +typedef uint16_t USHORT; +#endif + +#ifdef OS_UNIX +// Avoiding compile error +#define __cdecl +#define __declspec(x) +// socket type +typedef int SOCKET; +#else // OS_UNIX +#ifndef _WINSOCK2API_ +#ifdef CPU_64 +typedef unsigned __int64 SOCKET; +#else +typedef unsigned int SOCKET; +#endif // CPU_64 +#endif // _WINSOCK2API_ +#endif // OS_UNIX + +// OS type +#define OSTYPE_WINDOWS_95 1100 // Windows 95 +#define OSTYPE_WINDOWS_98 1200 // Windows 98 +#define OSTYPE_WINDOWS_ME 1300 // Windows Me +#define OSTYPE_WINDOWS_UNKNOWN 1400 // Windows (unknown) +#define OSTYPE_WINDOWS_NT_4_WORKSTATION 2100 // Windows NT 4.0 Workstation +#define OSTYPE_WINDOWS_NT_4_SERVER 2110 // Windows NT 4.0 Server +#define OSTYPE_WINDOWS_NT_4_SERVER_ENTERPRISE 2111 // Windows NT 4.0 Server, Enterprise Edition +#define OSTYPE_WINDOWS_NT_4_TERMINAL_SERVER 2112 // Windows NT 4.0 Terminal Server +#define OSTYPE_WINDOWS_NT_4_BACKOFFICE 2113 // BackOffice Server 4.5 +#define OSTYPE_WINDOWS_NT_4_SMS 2114 // Small Business Server 4.5 +#define OSTYPE_WINDOWS_2000_PROFESSIONAL 2200 // Windows 2000 Professional +#define OSTYPE_WINDOWS_2000_SERVER 2211 // Windows 2000 Server +#define OSTYPE_WINDOWS_2000_ADVANCED_SERVER 2212 // Windows 2000 Advanced Server +#define OSTYPE_WINDOWS_2000_DATACENTER_SERVER 2213 // Windows 2000 Datacenter Server +#define OSTYPE_WINDOWS_2000_BACKOFFICE 2214 // BackOffice Server 2000 +#define OSTYPE_WINDOWS_2000_SBS 2215 // Small Business Server 2000 +#define OSTYPE_WINDOWS_XP_HOME 2300 // Windows XP Home Edition +#define OSTYPE_WINDOWS_XP_PROFESSIONAL 2301 // Windows XP Professional +#define OSTYPE_WINDOWS_2003_WEB 2410 // Windows Server 2003 Web Edition +#define OSTYPE_WINDOWS_2003_STANDARD 2411 // Windows Server 2003 Standard Edition +#define OSTYPE_WINDOWS_2003_ENTERPRISE 2412 // Windows Server 2003 Enterprise Edition +#define OSTYPE_WINDOWS_2003_DATACENTER 2413 // Windows Server 2003 DataCenter Edition +#define OSTYPE_WINDOWS_2003_BACKOFFICE 2414 // BackOffice Server 2003 +#define OSTYPE_WINDOWS_2003_SBS 2415 // Small Business Server 2003 +#define OSTYPE_WINDOWS_LONGHORN_PROFESSIONAL 2500 // Windows Vista +#define OSTYPE_WINDOWS_LONGHORN_SERVER 2510 // Windows Server 2008 +#define OSTYPE_WINDOWS_7 2600 // Windows 7 +#define OSTYPE_WINDOWS_SERVER_2008_R2 2610 // Windows Server 2008 R2 +#define OSTYPE_WINDOWS_8 2700 // Windows 8 +#define OSTYPE_WINDOWS_SERVER_8 2710 // Windows Server 2012 +#define OSTYPE_WINDOWS_81 2701 // Windows 8.1 +#define OSTYPE_WINDOWS_SERVER_81 2711 // Windows Server 2012 R2 +#define OSTYPE_WINDOWS_10 2702 // Windows 10 +#define OSTYPE_WINDOWS_SERVER_10 2712 // Windows Server 10 +#define OSTYPE_WINDOWS_11 2800 // Windows 11 or later +#define OSTYPE_WINDOWS_SERVER_11 2810 // Windows Server 11 or later +#define OSTYPE_UNIX_UNKNOWN 3000 // Unknown UNIX +#define OSTYPE_LINUX 3100 // Linux +#define OSTYPE_SOLARIS 3200 // Solaris +#define OSTYPE_CYGWIN 3300 // Cygwin +#define OSTYPE_BSD 3400 // BSD +#define OSTYPE_MACOS_X 3500 // MacOS X + + +// OS discrimination macro +#define GET_KETA(t, i) (((t) % (i * 10)) / i) +#define OS_IS_WINDOWS_9X(t) (GET_KETA(t, 1000) == 1) +#define OS_IS_WINDOWS_NT(t) (GET_KETA(t, 1000) == 2) +#define OS_IS_WINDOWS(t) (OS_IS_WINDOWS_9X(t) || OS_IS_WINDOWS_NT(t)) +#define OS_IS_SERVER(t) (OS_IS_WINDOWS_NT(t) && GET_KETA(t, 10)) +#define OS_IS_WORKSTATION(t) ((OS_IS_WINDOWS_NT(t) && (!(GET_KETA(t, 10)))) || OS_IS_WINDOWS_9X(t)) +#define OS_IS_UNIX(t) (GET_KETA(t, 1000) == 3) + + +// OS information +typedef struct OS_INFO +{ + UINT OsType; // OS type + UINT OsServicePack; // Service pack number + char *OsSystemName; // OS system name + char *OsProductName; // OS product name + char *OsVendorName; // OS vendor name + char *OsVersion; // OS version + char *KernelName; // Kernel name + char *KernelVersion; // Kernel version +} OS_INFO; + +// Time type +#ifndef WINDOWS_H +typedef struct SYSTEMTIME +{ + USHORT wYear; + USHORT wMonth; + USHORT wDayOfWeek; + USHORT wDay; + USHORT wHour; + USHORT wMinute; + USHORT wSecond; + USHORT wMilliseconds; +} SYSTEMTIME; +#endif // WINDOWS_H + + +// Object.h +typedef struct LOCK LOCK; +typedef struct COUNTER COUNTER; +typedef struct REF REF; +typedef struct EVENT EVENT; +typedef struct DEADCHECK DEADCHECK; + +// Tracking.h +typedef struct CALLSTACK_DATA CALLSTACK_DATA; +typedef struct TRACKING_OBJECT TRACKING_OBJECT; +typedef struct MEMORY_STATUS MEMORY_STATUS; +typedef struct TRACKING_LIST TRACKING_LIST; + +// FileIO.h +typedef struct IO IO; + +// Memory.h +typedef struct MEMTAG MEMTAG; +typedef struct BUF BUF; +typedef struct FIFO FIFO; +typedef struct LIST LIST; +typedef struct QUEUE QUEUE; +typedef struct SK SK; +typedef struct CANDIDATE CANDIDATE; +typedef struct STRMAP_ENTRY STRMAP_ENTRY; +typedef struct SHARED_BUFFER SHARED_BUFFER; +typedef struct HASH_LIST HASH_LIST; +typedef struct HASH_ENTRY HASH_ENTRY; +typedef struct PRAND PRAND; + +// Str.h +typedef struct TOKEN_LIST TOKEN_LIST; +typedef struct INI_ENTRY INI_ENTRY; +typedef struct JSON_OBJECT JSON_OBJECT; +typedef struct JSON_ARRAY JSON_ARRAY; +typedef struct JSON_VALUE JSON_VALUE; + +// Internat.h +typedef struct UNI_TOKEN_LIST UNI_TOKEN_LIST; + +// Encrypt.h +typedef struct CRYPT CRYPT; +typedef struct NAME NAME; +typedef struct X_SERIAL X_SERIAL; +typedef struct X X; +typedef struct K K; +typedef struct P12 P12; +typedef struct X_CRL X_CRL; +typedef struct DES_KEY_VALUE DES_KEY_VALUE; +typedef struct DES_KEY DES_KEY; +typedef struct DH_CTX DH_CTX; +typedef struct AES_KEY_VALUE AES_KEY_VALUE; +typedef struct CIPHER CIPHER; +typedef struct MD MD; + +// Secure.h +typedef struct SECURE_DEVICE SECURE_DEVICE; +typedef struct SEC_INFO SEC_INFO; +typedef struct SECURE SECURE; +typedef struct SEC_OBJ SEC_OBJ; + +// Kernel.h +typedef struct MEMINFO MEMINFO; +typedef struct LOCALE LOCALE; +typedef struct THREAD THREAD; +typedef struct THREAD_POOL_DATA THREAD_POOL_DATA; +typedef struct INSTANCE INSTANCE; + +// Pack.h +typedef struct VALUE VALUE; +typedef struct ELEMENT ELEMENT; +typedef struct PACK PACK; +typedef struct JSONPACKHINT JSONPACKHINT; +typedef struct JSONPACKHINT_ITEM JSONPACKHINT_ITEM; + +// Cfg.h +typedef struct FOLDER FOLDER; +typedef struct ITEM ITEM; +typedef struct CFG_RW CFG_RW; +typedef struct CFG_ENUM_PARAM CFG_ENUM_PARAM; + +// Table.h +typedef struct TABLE TABLE; +typedef struct LANGLIST LANGLIST; + +// Network.h +typedef struct IP IP; +typedef struct DNSCACHE DNSCACHE; +typedef struct SOCK_EVENT SOCK_EVENT; +typedef struct SOCK SOCK; +typedef struct SOCKSET SOCKSET; +typedef struct CANCEL CANCEL; +typedef struct ROUTE_ENTRY ROUTE_ENTRY; +typedef struct ROUTE_TABLE ROUTE_TABLE; +typedef struct IP_CLIENT IP_CLIENT; +typedef struct ROUTE_CHANGE ROUTE_CHANGE; +typedef struct ROUTE_CHANGE_DATA ROUTE_CHANGE_DATA; +typedef struct GETIP_THREAD_PARAM GETIP_THREAD_PARAM; +typedef struct WIN32_RELEASEADDRESS_THREAD_PARAM WIN32_RELEASEADDRESS_THREAD_PARAM; +typedef struct IPV6_ADDR IPV6_ADDR; +typedef struct TUBE TUBE; +typedef struct TUBEDATA TUBEDATA; +typedef struct PSEUDO PSEUDO; +typedef struct TUBEPAIR_DATA TUBEPAIR_DATA; +typedef struct UDPLISTENER UDPLISTENER; +typedef struct UDPLISTENER_SOCK UDPLISTENER_SOCK; +typedef struct UDPPACKET UDPPACKET; +typedef struct TCP_RAW_DATA TCP_RAW_DATA; +typedef struct INTERRUPT_MANAGER INTERRUPT_MANAGER; +typedef struct TUBE_FLUSH_LIST TUBE_FLUSH_LIST; +typedef struct ICMP_RESULT ICMP_RESULT; +typedef struct SSL_PIPE SSL_PIPE; +typedef struct SSL_BIO SSL_BIO; +typedef struct RUDP_STACK RUDP_STACK; +typedef struct RUDP_SOURCE_IP RUDP_SOURCE_IP; +typedef struct RUDP_SESSION RUDP_SESSION; +typedef struct RUDP_SEGMENT RUDP_SEGMENT; +typedef struct CONNECT_TCP_RUDP_PARAM CONNECT_TCP_RUDP_PARAM; +typedef struct TCP_PAIR_HEADER TCP_PAIR_HEADER; +typedef struct NIC_ENTRY NIC_ENTRY; +typedef struct HTTP_VALUE HTTP_VALUE; +typedef struct HTTP_HEADER HTTP_HEADER; +typedef struct DNSPROXY_CLIENT DNSPROXY_CLIENT; +typedef struct DNSPROXY_CACHE DNSPROXY_CACHE; +typedef struct QUERYIPTHREAD QUERYIPTHREAD; +typedef struct IPBLOCK IPBLOCK; +typedef struct SAFE_REQUEST SAFE_REQUEST; +typedef struct SAFE_LIST SAFE_LIST; +typedef struct SAFE_QUOTA SAFE_QUOTA; +typedef struct SAFE_QUOTA2 SAFE_QUOTA2; +typedef struct SAFE_BLOCK SAFE_BLOCK; +typedef struct SAFE_REQUEST_LOG SAFE_REQUEST_LOG; +typedef struct DYN_VALUE DYN_VALUE; +typedef struct RELAY_PARAMETER RELAY_PARAMETER; +typedef struct SSL_ACCEPT_SETTINGS SSL_ACCEPT_SETTINGS; + +// Tick64.h +typedef struct ADJUST_TIME ADJUST_TIME; +typedef struct TICK64 TICK64; + +// FileIO.h +typedef struct DIRENT DIRENT; +typedef struct DIRLIST DIRLIST; +typedef struct ZIP_DATA_HEADER ZIP_DATA_HEADER; +typedef struct ZIP_DATA_FOOTER ZIP_DATA_FOOTER; +typedef struct ZIP_DIR_HEADER ZIP_DIR_HEADER; +typedef struct ZIP_END_HEADER ZIP_END_HEADER; +typedef struct ZIP_FILE ZIP_FILE; +typedef struct ZIP_PACKER ZIP_PACKER; +typedef struct ENUM_DIR_WITH_SUB_DATA ENUM_DIR_WITH_SUB_DATA; + +// TcpIp.h +typedef struct MAC_HEADER MAC_HEADER; +typedef struct ARPV4_HEADER ARPV4_HEADER; +typedef struct IPV4_HEADER IPV4_HEADER; +typedef struct TAGVLAN_HEADER TAGVLAN_HEADER; +typedef struct UDP_HEADER UDP_HEADER; +typedef struct UDPV4_PSEUDO_HEADER UDPV4_PSEUDO_HEADER; +typedef struct IPV4_PSEUDO_HEADER IPV4_PSEUDO_HEADER; +typedef struct TCP_HEADER TCP_HEADER; +typedef struct ICMP_HEADER ICMP_HEADER; +typedef struct ICMP_ECHO ICMP_ECHO; +typedef struct DHCPV4_HEADER DHCPV4_HEADER; +typedef struct DNSV4_HEADER DNSV4_HEADER; +typedef struct BPDU_HEADER BPDU_HEADER; +typedef struct LLC_HEADER LLC_HEADER; +typedef struct PKT PKT; +typedef struct IPV6_HEADER_PACKET_INFO IPV6_HEADER_PACKET_INFO; +typedef struct IPV6_HEADER IPV6_HEADER; +typedef struct IPV6_OPTION_HEADER IPV6_OPTION_HEADER; +typedef struct IPV6_FRAGMENT_HEADER IPV6_FRAGMENT_HEADER; +typedef struct IPV6_PSEUDO_HEADER IPV6_PSEUDO_HEADER; +typedef struct ICMPV6_ROUTER_SOLICIATION_HEADER ICMPV6_ROUTER_SOLICIATION_HEADER; +typedef struct ICMPV6_ROUTER_ADVERTISEMENT_HEADER ICMPV6_ROUTER_ADVERTISEMENT_HEADER; +typedef struct ICMPV6_NEIGHBOR_SOLICIATION_HEADER ICMPV6_NEIGHBOR_SOLICIATION_HEADER; +typedef struct ICMPV6_NEIGHBOR_ADVERTISEMENT_HEADER ICMPV6_NEIGHBOR_ADVERTISEMENT_HEADER; +typedef struct ICMPV6_OPTION_LIST ICMPV6_OPTION_LIST; +typedef struct ICMPV6_OPTION ICMPV6_OPTION; +typedef struct ICMPV6_OPTION_LINK_LAYER ICMPV6_OPTION_LINK_LAYER; +typedef struct ICMPV6_OPTION_PREFIX ICMPV6_OPTION_PREFIX; +typedef struct ICMPV6_OPTION_MTU ICMPV6_OPTION_MTU; +typedef struct IPV6_HEADER_INFO IPV6_HEADER_INFO; +typedef struct ICMPV6_HEADER_INFO ICMPV6_HEADER_INFO; +typedef struct DHCPV4_DATA DHCPV4_DATA; +typedef struct DHCP_OPTION DHCP_OPTION; +typedef struct DHCP_OPTION_LIST DHCP_OPTION_LIST; +typedef struct DHCP_CLASSLESS_ROUTE DHCP_CLASSLESS_ROUTE; +typedef struct DHCP_CLASSLESS_ROUTE_TABLE DHCP_CLASSLESS_ROUTE_TABLE; +typedef struct HTTPLOG HTTPLOG; +typedef struct DHCP_MODIFY_OPTION DHCP_MODIFY_OPTION; +typedef struct NBTDG_HEADER NBTDG_HEADER; +typedef struct IKE_HEADER IKE_HEADER; + +// HTTP.h +typedef struct HTTP_MIME_TYPE HTTP_MIME_TYPE; + +// Proxy.h +typedef struct PROXY_PARAM_IN PROXY_PARAM_IN; +typedef struct PROXY_PARAM_OUT PROXY_PARAM_OUT; + +#endif // MAYATYPE_H diff --git a/src/Mayaqua/Mayaqua.c b/src/Mayaqua/Mayaqua.c index 9814f40d..6c87d797 100644 --- a/src/Mayaqua/Mayaqua.c +++ b/src/Mayaqua/Mayaqua.c @@ -1,1084 +1,1084 @@ -// SoftEther VPN Source Code - Developer Edition Master Branch -// Mayaqua Kernel - - -// Mayaqua.c -// Mayaqua Kernel program - -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include - -// Global variable -bool g_memcheck; // Enable memory check -bool g_debug; // Debug mode -UINT64 kernel_status[NUM_KERNEL_STATUS]; // Kernel state -UINT64 kernel_status_max[NUM_KERNEL_STATUS]; // Kernel state (maximum value) -LOCK *kernel_status_lock[NUM_KERNEL_STATUS]; // Kernel state lock -bool kernel_status_inited = false; // Kernel state initialization flag -bool g_little_endian = true; -char *cmdline = NULL; // Command line -wchar_t *uni_cmdline = NULL; // Unicode command line -bool g_foreground = false; // Execute service in foreground mode - -// Static variable -static char *exename = NULL; // EXE file name (ANSI) -static wchar_t *exename_w = NULL; // EXE file name (Unicode) -static TOKEN_LIST *cmdline_token = NULL; // Command line token -static UNI_TOKEN_LIST *cmdline_uni_token = NULL; // Command line token (Unicode) -static OS_INFO *os_info = NULL; // OS information -static bool dot_net_mode = false; -static bool minimal_mode = false; -static UINT last_time_check = 0; -static UINT first_time_check = 0; -static bool is_nt = false; -static bool is_ham_mode = false; -static UINT init_mayaqua_counter = 0; -static bool use_probe = false; -static BUF *probe_buf = NULL; -static LOCK *probe_lock = NULL; -static UINT64 probe_start = 0; -static UINT64 probe_last = 0; -static bool probe_enabled = false; - -// The function which should be called once as soon as possible after the process is started -static bool init_proc_once_flag = false; -void InitProcessCallOnce() -{ - if (init_proc_once_flag == false) - { - init_proc_once_flag = true; - -#ifdef OS_WIN32 - MsInitProcessCallOnce(); -#endif // OS_WIN32 - } -} - -// Calculate the checksum -USHORT CalcChecksum16(void *buf, UINT size) -{ - int sum = 0; - USHORT *addr = (USHORT *)buf; - int len = (int)size; - USHORT *w = addr; - int nleft = len; - USHORT answer = 0; - - while (nleft > 1) - { - USHORT ww = 0; - Copy(&ww, w++, sizeof(USHORT)); - sum += ww; - nleft -= 2; - } - - if (nleft == 1) - { - *(UCHAR *)(&answer) = *(UCHAR *)w; - sum += answer; - } - - sum = (sum >> 16) + (sum & 0xffff); - sum += (sum >> 16); - - answer = ~sum; - - return answer; -} - -// Writing a probe with the data -void WriteProbeData(char *filename, UINT line, char *str, void *data, UINT size) -{ - char tmp[MAX_SIZE]; - USHORT cs; - - if (IsProbeEnabled() == false) - { - return; - } - - // Take a checksum of the data - if (size != 0) - { - cs = CalcChecksum16(data, size); - } - else - { - cs = 0; - } - - // Generating a String - snprintf(tmp, sizeof(tmp), "\"%s\" (Size=%5u, Crc=0x%04X)", str, size, cs); - - WriteProbe(filename, line, tmp); -} - -// Writing Probe -void WriteProbe(char *filename, UINT line, char *str) -{ -#ifdef OS_WIN32 - char *s; - char tmp[MAX_SIZE]; - char tmp2[MAX_SIZE]; - UINT64 now = 0; - UINT64 time; - - if (IsProbeEnabled() == false) - { - return; - } - - now = MsGetHiResCounter(); - - Lock(probe_lock); - { - UINT64 diff; - - time = MsGetHiResTimeSpanUSec(now - probe_start); - - diff = time - probe_last; - - if (time < probe_last) - { - diff = 0; - } - - probe_last = time; - - ToStr64(tmp, time); - MakeCharArray2(tmp2, ' ', (UINT)(MIN(12, (int)12 - (int)StrLen(tmp)))); - WriteBuf(probe_buf, tmp2, StrLen(tmp2)); - WriteBuf(probe_buf, tmp, StrLen(tmp)); - - s = " [+"; - WriteBuf(probe_buf, s, StrLen(s)); - - ToStr64(tmp, diff); - MakeCharArray2(tmp2, ' ', (UINT)(MIN(12, (int)12 - (int)StrLen(tmp)))); - WriteBuf(probe_buf, tmp2, StrLen(tmp2)); - WriteBuf(probe_buf, tmp, StrLen(tmp)); - - s = "] - "; - WriteBuf(probe_buf, s, StrLen(s)); - - WriteBuf(probe_buf, filename, StrLen(filename)); - - s = "("; - WriteBuf(probe_buf, s, StrLen(s)); - - ToStr64(tmp, (UINT64)line); - WriteBuf(probe_buf, tmp, StrLen(tmp)); - - s = "): "; - WriteBuf(probe_buf, s, StrLen(s)); - - WriteBuf(probe_buf, str, StrLen(str)); - - s = "\r\n"; - WriteBuf(probe_buf, s, StrLen(s)); - } - Unlock(probe_lock); -#endif // OS_WIN32 -} - -// Initialization of Probe -void InitProbe() -{ - probe_buf = NewBuf(); - probe_lock = NewLock(); - probe_enabled = false; - - probe_start = 0; - -#ifdef OS_WIN32 - probe_start = MsGetHiResCounter(); -#endif // OS_WIN32 -} - -// Release of Probe -void FreeProbe() -{ - if (probe_buf->Size >= 1) - { - SYSTEMTIME st; - char filename[MAX_SIZE]; - - // Write all to the file - MakeDirEx("@probe_log"); - - LocalTime(&st); - - snprintf(filename, sizeof(filename), "@probe_log/%04u%02u%02u_%02u%02u%02u.log", - st.wYear, st.wMonth, st.wDay, st.wHour, st.wMinute, st.wSecond); - - DumpBuf(probe_buf, filename); - } - - FreeBuf(probe_buf); - DeleteLock(probe_lock); -} - -// Set enable / disable the Probe -void EnableProbe(bool enable) -{ - probe_enabled = enable; -} - -// Get whether the Probe is enabled? -bool IsProbeEnabled() -{ -#ifndef USE_PROBE - return false; -#else // USE_PROBE - return probe_enabled; -#endif // USE_PROBE -} - -// Set the Ham mode -void SetHamMode() -{ - is_ham_mode = true; -} - -// Get whether in Ham mode -bool IsHamMode() -{ - return is_ham_mode; -} - -// Display the time from the previous call to now -void TimeCheck() -{ -#ifdef OS_WIN32 - UINT now, ret, total; - now = Win32GetTick(); - if (last_time_check == 0) - { - ret = 0; - } - else - { - ret = now - last_time_check; - } - last_time_check = now; - - if (first_time_check == 0) - { - first_time_check = now; - } - - total = now - first_time_check; - - printf(" -- %3.3f / %3.3f\n", (double)ret / 1000.0f, (double)total / 1000.0f); -#endif // OS_WIN32 -} - -// Whether this system is IA64 -bool IsIA64() -{ - if (Is64() == false) - { - return false; - } - -#ifndef MAYAQUA_IA_64 - return false; -#else // MAYAQUA_IA_64 - return true; -#endif // MAYAQUA_IA_64 -} - -// Whether in x64 -bool IsX64() -{ - if (Is64() == false) - { - return false; - } - -#ifndef MAYAQUA_IA_64 - return true; -#else // MAYAQUA_IA_64 - return false; -#endif // MAYAQUA_IA_64 -} - -// Whether 64bit -bool Is64() -{ -#ifdef CPU_64 - return true; -#else // CPU_64 - return false; -#endif // CPU_64 -} - -// Whether 32bit -bool Is32() -{ - return Is64() ? false : true; -} - -// Acquisition whether in .NET mode -bool MayaquaIsDotNetMode() -{ - return dot_net_mode; -} - -// Check the endian -void CheckEndian() -{ - unsigned short test; - UCHAR *buf; - - test = 0x1234; - buf = (UCHAR *)&test; - if (buf[0] == 0x12) - { - g_little_endian = false; - } - else - { - g_little_endian = true; - } -} - -// Minimize mode -void MayaquaMinimalMode() -{ - minimal_mode = true; -} -bool MayaquaIsMinimalMode() -{ - return minimal_mode; -} - -// Whether in NT -bool IsNt() -{ - return is_nt; -} - -// Initialization of Mayaqua library -void InitMayaqua(bool memcheck, bool debug, int argc, char **argv) -{ - wchar_t tmp[MAX_PATH]; - UCHAR hash[SHA1_SIZE]; - - if ((init_mayaqua_counter++) > 0) - { - return; - } - - InitProcessCallOnce(); - - g_memcheck = memcheck; - g_debug = debug; - cmdline = NULL; - if (dot_net_mode == false) - { - // Fail this for some reason when this is called this in .NET mode - setbuf(stdout, NULL); - } - -#ifdef OS_UNIX - g_foreground = (argc >= 3 && StrCmpi(argv[2], UNIX_SVC_ARG_FOREGROUND) == 0); -#else - g_foreground = false; -#endif // OS_UNIX - - // Acquisition whether NT -#ifdef OS_WIN32 - is_nt = Win32IsNt(); -#endif // OS_WIN32 - - // Check endian - CheckEndian(); - -#ifdef OS_WIN32 - _configthreadlocale(_DISABLE_PER_THREAD_LOCALE); -#endif // OS_WIN32 - - // Set the locale information of the CRT to the Japanese - setlocale(LC_ALL, ""); - - // Initialization of OS - OSInit(); - - // Initialize the random number - srand((UINT)SystemTime64()); - - tick_manual_lock = NewLock(); - - // Initialization of CRC32 - InitCrc32(); - - // Initialization of the FIFO system - InitFifo(); - - // Initialize the Kernel status - InitKernelStatus(); - - if (IsTrackingEnabled()) - { - // Initialize the tracking - InitTracking(); - } - - // Initialization of thread pool - InitThreading(); - - // Initialize the string library - InitStringLibrary(); - - // Initialization of the locale information - SetLocale(NULL); - - // Initialization of the crypt library - InitCryptLibrary(); - - // Initialization of the real-time clock - InitTick64(); - - // Initialize the network communication module - InitNetwork(); - - // Initialization of the acquisition of the EXE file name - InitGetExeName(argc >= 1 ? argv[0] : NULL); - - // Initialization of the command line string - InitCommandLineStr(argc, argv); - - // Initialization of OS information - InitOsInfo(); - - // Initialization of the operating system-specific module -#ifdef OS_WIN32 - MsInit(); // Microsoft Win32 -#endif // OS_WIN32 - - // Initialization of the security token module - InitSecure(); - - if (OSIsSupportedOs() == false) - { - // Abort - exit(0); - } - - // RSA Check - if (RsaCheckEx() == false) - { - // Abort - Alert("OpenSSL Library Init Failed. (too old?)\nPlease install the latest version of OpenSSL.\n\n", "RsaCheck()"); - exit(0); - } - - // Initialization of HamCore file system - InitHamcore(); - - // Initialization of string table routine - InitTable(); - - if (exename == NULL) - { - // Executable file name - exename = CopyStr("unknown"); - } - - // Check whether the executable file name of themselves is found - // (If not found, quit because this is started in strange path) - GetExeNameW(tmp, sizeof(tmp)); - if (IsFileExistsW(tmp) == false) - { - wchar_t tmp2[MAX_SIZE]; - - UniFormat(tmp2, sizeof(tmp2), - L"Error: Executable binary file \"%s\" not found.\r\n\r\n" - L"Please execute program with full path.\r\n", - tmp); - - AlertW(tmp2, NULL); - _exit(0); - } - - CheckUnixTempDir(); - - // Initialization of Probe - InitProbe(); - - // Initialization of Machine Hash - GetCurrentMachineIpProcessHash(hash); - - // Reading Private IP file - LoadPrivateIPFile(); -} - -// Release of Mayaqua library -void FreeMayaqua() -{ - if ((--init_mayaqua_counter) > 0) - { - return; - } - - // Release of Private IP File - FreePrivateIPFile(); - - // Release of Probe - FreeProbe(); - - // Delete the table - FreeTable(); - - // Release of security token module - FreeSecure(); - - // Release of the operating system specific module -#ifdef OS_WIN32 - MsFree(); -#endif // OS_WIN32 - - // Release of OS information - FreeOsInfo(); - - // Release of HamCore file system - FreeHamcore(); - - // Release of the command line string - FreeCommandLineStr(); - - // Release of the command line token - FreeCommandLineTokens(); - - // Release of network communication module - FreeNetwork(); - - // Release of real-time clock - FreeTick64(); - - // Release of the string library - FreeStringLibrary(); - - // Release of thread pool - FreeThreading(); - - // Release of crypt library - FreeCryptLibrary(); - - if (IsTrackingEnabled()) - { - // Show the kernel status - if (g_debug) - { - PrintKernelStatus(); - } - - // Display the debug information - if (g_memcheck) - { - PrintDebugInformation(); - } - - // Release the tracking - FreeTracking(); - } - - // Release of the kernel status - FreeKernelStatus(); - - DeleteLock(tick_manual_lock); - tick_manual_lock = NULL; - - // Release of OS - OSFree(); -} - -// Check whether /tmp is available in the UNIX -void CheckUnixTempDir() -{ - if (OS_IS_UNIX(GetOsInfo()->OsType)) - { - char tmp[128], tmp2[64]; - UINT64 now = SystemTime64(); - IO *o; - - MakeDir("/tmp"); - - Format(tmp2, sizeof(tmp2), "%I64u", now); - - Format(tmp, sizeof(tmp), "/tmp/.%s", tmp2); - - o = FileCreate(tmp); - if (o == NULL) - { - o = FileOpen(tmp, false); - if (o == NULL) - { - Print("Unable to use /tmp.\n\n"); - exit(0); - } - } - - FileClose(o); - - FileDelete(tmp); - } -} - -// Show an alert -void Alert(char *msg, char *caption) -{ - OSAlert(msg, caption); -} -void AlertW(wchar_t *msg, wchar_t *caption) -{ - OSAlertW(msg, caption); -} - -// Get the OS type -UINT GetOsType() -{ - OS_INFO *i = GetOsInfo(); - - if (i == NULL) - { - return 0; - } - - return i->OsType; -} - -// Getting OS information -OS_INFO *GetOsInfo() -{ - return os_info; -} - -// Initialization of OS information -void InitOsInfo() -{ - if (os_info != NULL) - { - return; - } - - os_info = ZeroMalloc(sizeof(OS_INFO)); - - OSGetOsInfo(os_info); -} - -// Release of OS information -void FreeOsInfo() -{ - if (os_info == NULL) - { - return; - } - - Free(os_info->OsSystemName); - Free(os_info->OsProductName); - Free(os_info->OsVendorName); - Free(os_info->OsVersion); - Free(os_info->KernelName); - Free(os_info->KernelVersion); - Free(os_info); - - os_info = NULL; -} - -// Get the Unicode command line tokens -UNI_TOKEN_LIST *GetCommandLineUniToken() -{ - if (cmdline_uni_token == NULL) - { - return UniNullToken(); - } - else - { - return UniCopyToken(cmdline_uni_token); - } -} - -// Getting the command line tokens -TOKEN_LIST *GetCommandLineToken() -{ - if (cmdline_token == NULL) - { - return NullToken(); - } - else - { - return CopyToken(cmdline_token); - } -} - -// Convert the command line string into tokens -void ParseCommandLineTokens() -{ - if (cmdline_token != NULL) - { - FreeToken(cmdline_token); - } - cmdline_token = ParseCmdLine(cmdline); - - if (cmdline_uni_token != NULL) - { - UniFreeToken(cmdline_uni_token); - } - cmdline_uni_token = UniParseCmdLine(uni_cmdline); -} - -// Release command line tokens -void FreeCommandLineTokens() -{ - if (cmdline_token != NULL) - { - FreeToken(cmdline_token); - } - cmdline_token = NULL; - - if (cmdline_uni_token != NULL) - { - UniFreeToken(cmdline_uni_token); - } - cmdline_uni_token = NULL; -} - -// Initialization of the command line string -void InitCommandLineStr(int argc, char **argv) -{ - if (argc >= 1) - { -#ifdef OS_UNIX - exename_w = CopyUtfToUni(argv[0]); - exename = CopyUniToStr(exename_w); -#else // OS_UNIX - exename = CopyStr(argv[0]); - exename_w = CopyStrToUni(exename); -#endif // OS_UNIX - } - if (argc < 2 || argv == NULL) - { - // No command-line string - SetCommandLineStr(NULL); - } - else - { - // There are command-line string - int i, total_len = 1; - char *tmp; - - for (i = 1;i < argc;i++) - { - total_len += StrLen(argv[i]) * 2 + 32; - } - tmp = ZeroMalloc(total_len); - - for (i = 1;i < argc;i++) - { - UINT s_size = StrLen(argv[i]) * 2; - char *s = ZeroMalloc(s_size); - bool dq = (SearchStrEx(argv[i], " ", 0, true) != INFINITE); - ReplaceStrEx(s, s_size, argv[i], "\"", "\"\"", true); - if (dq) - { - StrCat(tmp, total_len, "\""); - } - StrCat(tmp, total_len, s); - if (dq) - { - StrCat(tmp, total_len, "\""); - } - StrCat(tmp, total_len, " "); - Free(s); - } - - Trim(tmp); - SetCommandLineStr(tmp); - Free(tmp); - } -} - -// Release of the command line string -void FreeCommandLineStr() -{ - SetCommandLineStr(NULL); - - if (exename != NULL) - { - Free(exename); - exename = NULL; - } - - if (exename_w != NULL) - { - Free(exename_w); - exename_w = NULL; - } -} - -// Get the Unicode command line string -wchar_t *GetCommandLineUniStr() -{ - if (uni_cmdline == NULL) - { - return UniCopyStr(L""); - } - else - { - return UniCopyStr(uni_cmdline); - } -} - -// Get the command line string -char *GetCommandLineStr() -{ - if (cmdline == NULL) - { - return CopyStr(""); - } - else - { - return CopyStr(cmdline); - } -} - -// Set the Unicode command line string -void SetCommandLineUniStr(wchar_t *str) -{ - if (uni_cmdline != NULL) - { - Free(uni_cmdline); - } - if (str == NULL) - { - uni_cmdline = NULL; - } - else - { - uni_cmdline = CopyUniStr(str); - } - - ParseCommandLineTokens(); -} - -// Set the command-line string -void SetCommandLineStr(char *str) -{ - // Validate arguments - if (str == NULL) - { - if (cmdline != NULL) - { - Free(cmdline); - } - cmdline = NULL; - } - else - { - if (cmdline != NULL) - { - Free(cmdline); - } - cmdline = CopyStr(str); - } - - if (cmdline == NULL) - { - if (uni_cmdline != NULL) - { - Free(uni_cmdline); - uni_cmdline = NULL; - } - } - else - { - if (uni_cmdline != NULL) - { - Free(uni_cmdline); - } - uni_cmdline = CopyStrToUni(cmdline); - } - - ParseCommandLineTokens(); -} - -// Display the kernel status -void PrintKernelStatus() -{ - bool leaked = false; - - Print("\n"); - Print( - " --------- Mayaqua Kernel Status ---------\n" - " Malloc Count ............... %u\n" - " ReAlloc Count .............. %u\n" - " Free Count ................. %u\n" - " Total Memory Size .......... %I64u bytes\n" - " * Current Memory Blocks ...... %u Blocks (Peek: %u)\n" - " Total Memory Blocks ........ %u Blocks\n" - " * Current MemPool Blocks ..... %u Blocks (Peek: %u)\n" - " Total MemPool Mallocs ...... %u Mallocs\n" - " Total MemPool ReAllocs ..... %u ReAllocs\n" - " NewLock Count .............. %u\n" - " DeleteLock Count ........... %u\n" - " * Current Lock Objects ....... %u Objects\n" - " * Current Locked Objects ..... %u Objects\n" - " NewRef Count ............... %u\n" - " FreeRef Count .............. %u\n" - " * Current Ref Objects ........ %u Objects\n" - " * Current Ref Count .......... %u Refs\n" - " GetTime Count .............. %u\n" - " GetTick Count .............. %u\n" - " NewThread Count ............ %u\n" - " FreeThread Count ........... %u\n" - " * Current Threads ............ %u Threads\n" - " Wait For Event Count ....... %u\n\n", - KS_GET(KS_MALLOC_COUNT), - KS_GET(KS_REALLOC_COUNT), - KS_GET(KS_FREE_COUNT), - KS_GET64(KS_TOTAL_MEM_SIZE), - KS_GET(KS_CURRENT_MEM_COUNT), - KS_GETMAX(KS_CURRENT_MEM_COUNT), - KS_GET(KS_TOTAL_MEM_COUNT), - KS_GET(KS_MEMPOOL_CURRENT_NUM), - KS_GETMAX(KS_MEMPOOL_CURRENT_NUM), - KS_GET(KS_MEMPOOL_MALLOC_COUNT), - KS_GET(KS_MEMPOOL_REALLOC_COUNT), - KS_GET(KS_NEWLOCK_COUNT), - KS_GET(KS_DELETELOCK_COUNT), - KS_GET(KS_CURRENT_LOCK_COUNT), - KS_GET(KS_CURRENT_LOCKED_COUNT), - KS_GET(KS_NEWREF_COUNT), - KS_GET(KS_FREEREF_COUNT), - KS_GET(KS_CURRENT_REF_COUNT), - KS_GET(KS_CURRENT_REFED_COUNT), - KS_GET(KS_GETTIME_COUNT), - KS_GET(KS_GETTICK_COUNT), - KS_GET(KS_NEWTHREAD_COUNT), - KS_GET(KS_FREETHREAD_COUNT), - KS_GET(KS_NEWTHREAD_COUNT) - KS_GET(KS_FREETHREAD_COUNT), - KS_GET(KS_WAIT_COUNT) - ); - - if (KS_GET(KS_CURRENT_MEM_COUNT) != 0 || KS_GET(KS_CURRENT_LOCK_COUNT) != 0 || - KS_GET(KS_MEMPOOL_CURRENT_NUM) != 0 || - KS_GET(KS_CURRENT_LOCKED_COUNT) != 0 || KS_GET(KS_CURRENT_REF_COUNT) != 0) - { - leaked = true; - } - - if (leaked) - { - Print(" !!! MEMORY LEAKS DETECTED !!!\n\n"); - if (g_memcheck == false) - { - if (IsHamMode()) - { - Print(" Enable /memcheck startup option to see the leaking memory heap.\n"); - Print(" Press Enter key to exit the process.\n"); - } - GetLine(NULL, 0); - } - } - else - { - Print(" @@@ NO MEMORY LEAKS @@@\n\n"); - } -} - -// Initialize Kernel status -void InitKernelStatus() -{ - UINT i; - - // Memory initialization - Zero(kernel_status, sizeof(kernel_status)); - Zero(kernel_status_max, sizeof(kernel_status_max)); - - // Lock initialization - for (i = 0;i < NUM_KERNEL_STATUS;i++) - { - kernel_status_lock[i] = OSNewLock(); - } - - kernel_status_inited = true; -} - -// Release of the kernel status -void FreeKernelStatus() -{ - UINT i; - - kernel_status_inited = false; - - // Lock release - for (i = 0;i < NUM_KERNEL_STATUS;i++) - { - OSDeleteLock(kernel_status_lock[i]); - } -} - -// Lock the kernel status -void LockKernelStatus(UINT id) -{ - // Validate arguments - if (id >= NUM_KERNEL_STATUS) - { - return; - } - - OSLock(kernel_status_lock[id]); -} - -// Unlock the kernel status -void UnlockKernelStatus(UINT id) -{ - // Validate arguments - if (id >= NUM_KERNEL_STATUS) - { - return; - } - - OSUnlock(kernel_status_lock[id]); -} - -// Display the debug information -void PrintDebugInformation() -{ - MEMORY_STATUS memory_status; - GetMemoryStatus(&memory_status); - - // Header - Print("====== " CEDAR_PRODUCT_STR " VPN System Debug Information ======\n"); - - // Memory information - Print(" \n" - " Number of Allocated Memory Blocks: %u\n" - " Total Size of Allocated Memory Blocks: %u bytes\n", - memory_status.MemoryBlocksNum, memory_status.MemorySize); - - // Footer - Print("====================================================\n"); - - if (KS_GET(KS_CURRENT_MEM_COUNT) != 0 || KS_GET(KS_CURRENT_LOCK_COUNT) != 0 || - KS_GET(KS_CURRENT_LOCKED_COUNT) != 0 || KS_GET(KS_CURRENT_REF_COUNT) != 0) - { - // Show a debug menu because memory leaks suspected - MemoryDebugMenu(); - } -} - - - - +// SoftEther VPN Source Code - Developer Edition Master Branch +// Mayaqua Kernel + + +// Mayaqua.c +// Mayaqua Kernel program + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +// Global variable +bool g_memcheck; // Enable memory check +bool g_debug; // Debug mode +UINT64 kernel_status[NUM_KERNEL_STATUS]; // Kernel state +UINT64 kernel_status_max[NUM_KERNEL_STATUS]; // Kernel state (maximum value) +LOCK *kernel_status_lock[NUM_KERNEL_STATUS]; // Kernel state lock +bool kernel_status_inited = false; // Kernel state initialization flag +bool g_little_endian = true; +char *cmdline = NULL; // Command line +wchar_t *uni_cmdline = NULL; // Unicode command line +bool g_foreground = false; // Execute service in foreground mode + +// Static variable +static char *exename = NULL; // EXE file name (ANSI) +static wchar_t *exename_w = NULL; // EXE file name (Unicode) +static TOKEN_LIST *cmdline_token = NULL; // Command line token +static UNI_TOKEN_LIST *cmdline_uni_token = NULL; // Command line token (Unicode) +static OS_INFO *os_info = NULL; // OS information +static bool dot_net_mode = false; +static bool minimal_mode = false; +static UINT last_time_check = 0; +static UINT first_time_check = 0; +static bool is_nt = false; +static bool is_ham_mode = false; +static UINT init_mayaqua_counter = 0; +static bool use_probe = false; +static BUF *probe_buf = NULL; +static LOCK *probe_lock = NULL; +static UINT64 probe_start = 0; +static UINT64 probe_last = 0; +static bool probe_enabled = false; + +// The function which should be called once as soon as possible after the process is started +static bool init_proc_once_flag = false; +void InitProcessCallOnce() +{ + if (init_proc_once_flag == false) + { + init_proc_once_flag = true; + +#ifdef OS_WIN32 + MsInitProcessCallOnce(); +#endif // OS_WIN32 + } +} + +// Calculate the checksum +USHORT CalcChecksum16(void *buf, UINT size) +{ + int sum = 0; + USHORT *addr = (USHORT *)buf; + int len = (int)size; + USHORT *w = addr; + int nleft = len; + USHORT answer = 0; + + while (nleft > 1) + { + USHORT ww = 0; + Copy(&ww, w++, sizeof(USHORT)); + sum += ww; + nleft -= 2; + } + + if (nleft == 1) + { + *(UCHAR *)(&answer) = *(UCHAR *)w; + sum += answer; + } + + sum = (sum >> 16) + (sum & 0xffff); + sum += (sum >> 16); + + answer = ~sum; + + return answer; +} + +// Writing a probe with the data +void WriteProbeData(char *filename, UINT line, char *str, void *data, UINT size) +{ + char tmp[MAX_SIZE]; + USHORT cs; + + if (IsProbeEnabled() == false) + { + return; + } + + // Take a checksum of the data + if (size != 0) + { + cs = CalcChecksum16(data, size); + } + else + { + cs = 0; + } + + // Generating a String + snprintf(tmp, sizeof(tmp), "\"%s\" (Size=%5u, Crc=0x%04X)", str, size, cs); + + WriteProbe(filename, line, tmp); +} + +// Writing Probe +void WriteProbe(char *filename, UINT line, char *str) +{ +#ifdef OS_WIN32 + char *s; + char tmp[MAX_SIZE]; + char tmp2[MAX_SIZE]; + UINT64 now = 0; + UINT64 time; + + if (IsProbeEnabled() == false) + { + return; + } + + now = MsGetHiResCounter(); + + Lock(probe_lock); + { + UINT64 diff; + + time = MsGetHiResTimeSpanUSec(now - probe_start); + + diff = time - probe_last; + + if (time < probe_last) + { + diff = 0; + } + + probe_last = time; + + ToStr64(tmp, time); + MakeCharArray2(tmp2, ' ', (UINT)(MIN(12, (int)12 - (int)StrLen(tmp)))); + WriteBuf(probe_buf, tmp2, StrLen(tmp2)); + WriteBuf(probe_buf, tmp, StrLen(tmp)); + + s = " [+"; + WriteBuf(probe_buf, s, StrLen(s)); + + ToStr64(tmp, diff); + MakeCharArray2(tmp2, ' ', (UINT)(MIN(12, (int)12 - (int)StrLen(tmp)))); + WriteBuf(probe_buf, tmp2, StrLen(tmp2)); + WriteBuf(probe_buf, tmp, StrLen(tmp)); + + s = "] - "; + WriteBuf(probe_buf, s, StrLen(s)); + + WriteBuf(probe_buf, filename, StrLen(filename)); + + s = "("; + WriteBuf(probe_buf, s, StrLen(s)); + + ToStr64(tmp, (UINT64)line); + WriteBuf(probe_buf, tmp, StrLen(tmp)); + + s = "): "; + WriteBuf(probe_buf, s, StrLen(s)); + + WriteBuf(probe_buf, str, StrLen(str)); + + s = "\r\n"; + WriteBuf(probe_buf, s, StrLen(s)); + } + Unlock(probe_lock); +#endif // OS_WIN32 +} + +// Initialization of Probe +void InitProbe() +{ + probe_buf = NewBuf(); + probe_lock = NewLock(); + probe_enabled = false; + + probe_start = 0; + +#ifdef OS_WIN32 + probe_start = MsGetHiResCounter(); +#endif // OS_WIN32 +} + +// Release of Probe +void FreeProbe() +{ + if (probe_buf->Size >= 1) + { + SYSTEMTIME st; + char filename[MAX_SIZE]; + + // Write all to the file + MakeDirEx("@probe_log"); + + LocalTime(&st); + + snprintf(filename, sizeof(filename), "@probe_log/%04u%02u%02u_%02u%02u%02u.log", + st.wYear, st.wMonth, st.wDay, st.wHour, st.wMinute, st.wSecond); + + DumpBuf(probe_buf, filename); + } + + FreeBuf(probe_buf); + DeleteLock(probe_lock); +} + +// Set enable / disable the Probe +void EnableProbe(bool enable) +{ + probe_enabled = enable; +} + +// Get whether the Probe is enabled? +bool IsProbeEnabled() +{ +#ifndef USE_PROBE + return false; +#else // USE_PROBE + return probe_enabled; +#endif // USE_PROBE +} + +// Set the Ham mode +void SetHamMode() +{ + is_ham_mode = true; +} + +// Get whether in Ham mode +bool IsHamMode() +{ + return is_ham_mode; +} + +// Display the time from the previous call to now +void TimeCheck() +{ +#ifdef OS_WIN32 + UINT now, ret, total; + now = Win32GetTick(); + if (last_time_check == 0) + { + ret = 0; + } + else + { + ret = now - last_time_check; + } + last_time_check = now; + + if (first_time_check == 0) + { + first_time_check = now; + } + + total = now - first_time_check; + + printf(" -- %3.3f / %3.3f\n", (double)ret / 1000.0f, (double)total / 1000.0f); +#endif // OS_WIN32 +} + +// Whether this system is IA64 +bool IsIA64() +{ + if (Is64() == false) + { + return false; + } + +#ifndef MAYAQUA_IA_64 + return false; +#else // MAYAQUA_IA_64 + return true; +#endif // MAYAQUA_IA_64 +} + +// Whether in x64 +bool IsX64() +{ + if (Is64() == false) + { + return false; + } + +#ifndef MAYAQUA_IA_64 + return true; +#else // MAYAQUA_IA_64 + return false; +#endif // MAYAQUA_IA_64 +} + +// Whether 64bit +bool Is64() +{ +#ifdef CPU_64 + return true; +#else // CPU_64 + return false; +#endif // CPU_64 +} + +// Whether 32bit +bool Is32() +{ + return Is64() ? false : true; +} + +// Acquisition whether in .NET mode +bool MayaquaIsDotNetMode() +{ + return dot_net_mode; +} + +// Check the endian +void CheckEndian() +{ + unsigned short test; + UCHAR *buf; + + test = 0x1234; + buf = (UCHAR *)&test; + if (buf[0] == 0x12) + { + g_little_endian = false; + } + else + { + g_little_endian = true; + } +} + +// Minimize mode +void MayaquaMinimalMode() +{ + minimal_mode = true; +} +bool MayaquaIsMinimalMode() +{ + return minimal_mode; +} + +// Whether in NT +bool IsNt() +{ + return is_nt; +} + +// Initialization of Mayaqua library +void InitMayaqua(bool memcheck, bool debug, int argc, char **argv) +{ + wchar_t tmp[MAX_PATH]; + UCHAR hash[SHA1_SIZE]; + + if ((init_mayaqua_counter++) > 0) + { + return; + } + + InitProcessCallOnce(); + + g_memcheck = memcheck; + g_debug = debug; + cmdline = NULL; + if (dot_net_mode == false) + { + // Fail this for some reason when this is called this in .NET mode + setbuf(stdout, NULL); + } + +#ifdef OS_UNIX + g_foreground = (argc >= 3 && StrCmpi(argv[2], UNIX_SVC_ARG_FOREGROUND) == 0); +#else + g_foreground = false; +#endif // OS_UNIX + + // Acquisition whether NT +#ifdef OS_WIN32 + is_nt = Win32IsNt(); +#endif // OS_WIN32 + + // Check endian + CheckEndian(); + +#ifdef OS_WIN32 + _configthreadlocale(_DISABLE_PER_THREAD_LOCALE); +#endif // OS_WIN32 + + // Set the locale information of the CRT to the Japanese + setlocale(LC_ALL, ""); + + // Initialization of OS + OSInit(); + + // Initialize the random number + srand((UINT)SystemTime64()); + + tick_manual_lock = NewLock(); + + // Initialization of CRC32 + InitCrc32(); + + // Initialization of the FIFO system + InitFifo(); + + // Initialize the Kernel status + InitKernelStatus(); + + if (IsTrackingEnabled()) + { + // Initialize the tracking + InitTracking(); + } + + // Initialization of thread pool + InitThreading(); + + // Initialize the string library + InitStringLibrary(); + + // Initialization of the locale information + SetLocale(NULL); + + // Initialization of the crypt library + InitCryptLibrary(); + + // Initialization of the real-time clock + InitTick64(); + + // Initialize the network communication module + InitNetwork(); + + // Initialization of the acquisition of the EXE file name + InitGetExeName(argc >= 1 ? argv[0] : NULL); + + // Initialization of the command line string + InitCommandLineStr(argc, argv); + + // Initialization of OS information + InitOsInfo(); + + // Initialization of the operating system-specific module +#ifdef OS_WIN32 + MsInit(); // Microsoft Win32 +#endif // OS_WIN32 + + // Initialization of the security token module + InitSecure(); + + if (OSIsSupportedOs() == false) + { + // Abort + exit(0); + } + + // RSA Check + if (RsaCheckEx() == false) + { + // Abort + Alert("OpenSSL Library Init Failed. (too old?)\nPlease install the latest version of OpenSSL.\n\n", "RsaCheck()"); + exit(0); + } + + // Initialization of HamCore file system + InitHamcore(); + + // Initialization of string table routine + InitTable(); + + if (exename == NULL) + { + // Executable file name + exename = CopyStr("unknown"); + } + + // Check whether the executable file name of themselves is found + // (If not found, quit because this is started in strange path) + GetExeNameW(tmp, sizeof(tmp)); + if (IsFileExistsW(tmp) == false) + { + wchar_t tmp2[MAX_SIZE]; + + UniFormat(tmp2, sizeof(tmp2), + L"Error: Executable binary file \"%s\" not found.\r\n\r\n" + L"Please execute program with full path.\r\n", + tmp); + + AlertW(tmp2, NULL); + _exit(0); + } + + CheckUnixTempDir(); + + // Initialization of Probe + InitProbe(); + + // Initialization of Machine Hash + GetCurrentMachineIpProcessHash(hash); + + // Reading Private IP file + LoadPrivateIPFile(); +} + +// Release of Mayaqua library +void FreeMayaqua() +{ + if ((--init_mayaqua_counter) > 0) + { + return; + } + + // Release of Private IP File + FreePrivateIPFile(); + + // Release of Probe + FreeProbe(); + + // Delete the table + FreeTable(); + + // Release of security token module + FreeSecure(); + + // Release of the operating system specific module +#ifdef OS_WIN32 + MsFree(); +#endif // OS_WIN32 + + // Release of OS information + FreeOsInfo(); + + // Release of HamCore file system + FreeHamcore(); + + // Release of the command line string + FreeCommandLineStr(); + + // Release of the command line token + FreeCommandLineTokens(); + + // Release of network communication module + FreeNetwork(); + + // Release of real-time clock + FreeTick64(); + + // Release of the string library + FreeStringLibrary(); + + // Release of thread pool + FreeThreading(); + + // Release of crypt library + FreeCryptLibrary(); + + if (IsTrackingEnabled()) + { + // Show the kernel status + if (g_debug) + { + PrintKernelStatus(); + } + + // Display the debug information + if (g_memcheck) + { + PrintDebugInformation(); + } + + // Release the tracking + FreeTracking(); + } + + // Release of the kernel status + FreeKernelStatus(); + + DeleteLock(tick_manual_lock); + tick_manual_lock = NULL; + + // Release of OS + OSFree(); +} + +// Check whether /tmp is available in the UNIX +void CheckUnixTempDir() +{ + if (OS_IS_UNIX(GetOsInfo()->OsType)) + { + char tmp[128], tmp2[64]; + UINT64 now = SystemTime64(); + IO *o; + + MakeDir("/tmp"); + + Format(tmp2, sizeof(tmp2), "%I64u", now); + + Format(tmp, sizeof(tmp), "/tmp/.%s", tmp2); + + o = FileCreate(tmp); + if (o == NULL) + { + o = FileOpen(tmp, false); + if (o == NULL) + { + Print("Unable to use /tmp.\n\n"); + exit(0); + } + } + + FileClose(o); + + FileDelete(tmp); + } +} + +// Show an alert +void Alert(char *msg, char *caption) +{ + OSAlert(msg, caption); +} +void AlertW(wchar_t *msg, wchar_t *caption) +{ + OSAlertW(msg, caption); +} + +// Get the OS type +UINT GetOsType() +{ + OS_INFO *i = GetOsInfo(); + + if (i == NULL) + { + return 0; + } + + return i->OsType; +} + +// Getting OS information +OS_INFO *GetOsInfo() +{ + return os_info; +} + +// Initialization of OS information +void InitOsInfo() +{ + if (os_info != NULL) + { + return; + } + + os_info = ZeroMalloc(sizeof(OS_INFO)); + + OSGetOsInfo(os_info); +} + +// Release of OS information +void FreeOsInfo() +{ + if (os_info == NULL) + { + return; + } + + Free(os_info->OsSystemName); + Free(os_info->OsProductName); + Free(os_info->OsVendorName); + Free(os_info->OsVersion); + Free(os_info->KernelName); + Free(os_info->KernelVersion); + Free(os_info); + + os_info = NULL; +} + +// Get the Unicode command line tokens +UNI_TOKEN_LIST *GetCommandLineUniToken() +{ + if (cmdline_uni_token == NULL) + { + return UniNullToken(); + } + else + { + return UniCopyToken(cmdline_uni_token); + } +} + +// Getting the command line tokens +TOKEN_LIST *GetCommandLineToken() +{ + if (cmdline_token == NULL) + { + return NullToken(); + } + else + { + return CopyToken(cmdline_token); + } +} + +// Convert the command line string into tokens +void ParseCommandLineTokens() +{ + if (cmdline_token != NULL) + { + FreeToken(cmdline_token); + } + cmdline_token = ParseCmdLine(cmdline); + + if (cmdline_uni_token != NULL) + { + UniFreeToken(cmdline_uni_token); + } + cmdline_uni_token = UniParseCmdLine(uni_cmdline); +} + +// Release command line tokens +void FreeCommandLineTokens() +{ + if (cmdline_token != NULL) + { + FreeToken(cmdline_token); + } + cmdline_token = NULL; + + if (cmdline_uni_token != NULL) + { + UniFreeToken(cmdline_uni_token); + } + cmdline_uni_token = NULL; +} + +// Initialization of the command line string +void InitCommandLineStr(int argc, char **argv) +{ + if (argc >= 1) + { +#ifdef OS_UNIX + exename_w = CopyUtfToUni(argv[0]); + exename = CopyUniToStr(exename_w); +#else // OS_UNIX + exename = CopyStr(argv[0]); + exename_w = CopyStrToUni(exename); +#endif // OS_UNIX + } + if (argc < 2 || argv == NULL) + { + // No command-line string + SetCommandLineStr(NULL); + } + else + { + // There are command-line string + int i, total_len = 1; + char *tmp; + + for (i = 1;i < argc;i++) + { + total_len += StrLen(argv[i]) * 2 + 32; + } + tmp = ZeroMalloc(total_len); + + for (i = 1;i < argc;i++) + { + UINT s_size = StrLen(argv[i]) * 2; + char *s = ZeroMalloc(s_size); + bool dq = (SearchStrEx(argv[i], " ", 0, true) != INFINITE); + ReplaceStrEx(s, s_size, argv[i], "\"", "\"\"", true); + if (dq) + { + StrCat(tmp, total_len, "\""); + } + StrCat(tmp, total_len, s); + if (dq) + { + StrCat(tmp, total_len, "\""); + } + StrCat(tmp, total_len, " "); + Free(s); + } + + Trim(tmp); + SetCommandLineStr(tmp); + Free(tmp); + } +} + +// Release of the command line string +void FreeCommandLineStr() +{ + SetCommandLineStr(NULL); + + if (exename != NULL) + { + Free(exename); + exename = NULL; + } + + if (exename_w != NULL) + { + Free(exename_w); + exename_w = NULL; + } +} + +// Get the Unicode command line string +wchar_t *GetCommandLineUniStr() +{ + if (uni_cmdline == NULL) + { + return UniCopyStr(L""); + } + else + { + return UniCopyStr(uni_cmdline); + } +} + +// Get the command line string +char *GetCommandLineStr() +{ + if (cmdline == NULL) + { + return CopyStr(""); + } + else + { + return CopyStr(cmdline); + } +} + +// Set the Unicode command line string +void SetCommandLineUniStr(wchar_t *str) +{ + if (uni_cmdline != NULL) + { + Free(uni_cmdline); + } + if (str == NULL) + { + uni_cmdline = NULL; + } + else + { + uni_cmdline = CopyUniStr(str); + } + + ParseCommandLineTokens(); +} + +// Set the command-line string +void SetCommandLineStr(char *str) +{ + // Validate arguments + if (str == NULL) + { + if (cmdline != NULL) + { + Free(cmdline); + } + cmdline = NULL; + } + else + { + if (cmdline != NULL) + { + Free(cmdline); + } + cmdline = CopyStr(str); + } + + if (cmdline == NULL) + { + if (uni_cmdline != NULL) + { + Free(uni_cmdline); + uni_cmdline = NULL; + } + } + else + { + if (uni_cmdline != NULL) + { + Free(uni_cmdline); + } + uni_cmdline = CopyStrToUni(cmdline); + } + + ParseCommandLineTokens(); +} + +// Display the kernel status +void PrintKernelStatus() +{ + bool leaked = false; + + Print("\n"); + Print( + " --------- Mayaqua Kernel Status ---------\n" + " Malloc Count ............... %u\n" + " ReAlloc Count .............. %u\n" + " Free Count ................. %u\n" + " Total Memory Size .......... %I64u bytes\n" + " * Current Memory Blocks ...... %u Blocks (Peek: %u)\n" + " Total Memory Blocks ........ %u Blocks\n" + " * Current MemPool Blocks ..... %u Blocks (Peek: %u)\n" + " Total MemPool Mallocs ...... %u Mallocs\n" + " Total MemPool ReAllocs ..... %u ReAllocs\n" + " NewLock Count .............. %u\n" + " DeleteLock Count ........... %u\n" + " * Current Lock Objects ....... %u Objects\n" + " * Current Locked Objects ..... %u Objects\n" + " NewRef Count ............... %u\n" + " FreeRef Count .............. %u\n" + " * Current Ref Objects ........ %u Objects\n" + " * Current Ref Count .......... %u Refs\n" + " GetTime Count .............. %u\n" + " GetTick Count .............. %u\n" + " NewThread Count ............ %u\n" + " FreeThread Count ........... %u\n" + " * Current Threads ............ %u Threads\n" + " Wait For Event Count ....... %u\n\n", + KS_GET(KS_MALLOC_COUNT), + KS_GET(KS_REALLOC_COUNT), + KS_GET(KS_FREE_COUNT), + KS_GET64(KS_TOTAL_MEM_SIZE), + KS_GET(KS_CURRENT_MEM_COUNT), + KS_GETMAX(KS_CURRENT_MEM_COUNT), + KS_GET(KS_TOTAL_MEM_COUNT), + KS_GET(KS_MEMPOOL_CURRENT_NUM), + KS_GETMAX(KS_MEMPOOL_CURRENT_NUM), + KS_GET(KS_MEMPOOL_MALLOC_COUNT), + KS_GET(KS_MEMPOOL_REALLOC_COUNT), + KS_GET(KS_NEWLOCK_COUNT), + KS_GET(KS_DELETELOCK_COUNT), + KS_GET(KS_CURRENT_LOCK_COUNT), + KS_GET(KS_CURRENT_LOCKED_COUNT), + KS_GET(KS_NEWREF_COUNT), + KS_GET(KS_FREEREF_COUNT), + KS_GET(KS_CURRENT_REF_COUNT), + KS_GET(KS_CURRENT_REFED_COUNT), + KS_GET(KS_GETTIME_COUNT), + KS_GET(KS_GETTICK_COUNT), + KS_GET(KS_NEWTHREAD_COUNT), + KS_GET(KS_FREETHREAD_COUNT), + KS_GET(KS_NEWTHREAD_COUNT) - KS_GET(KS_FREETHREAD_COUNT), + KS_GET(KS_WAIT_COUNT) + ); + + if (KS_GET(KS_CURRENT_MEM_COUNT) != 0 || KS_GET(KS_CURRENT_LOCK_COUNT) != 0 || + KS_GET(KS_MEMPOOL_CURRENT_NUM) != 0 || + KS_GET(KS_CURRENT_LOCKED_COUNT) != 0 || KS_GET(KS_CURRENT_REF_COUNT) != 0) + { + leaked = true; + } + + if (leaked) + { + Print(" !!! MEMORY LEAKS DETECTED !!!\n\n"); + if (g_memcheck == false) + { + if (IsHamMode()) + { + Print(" Enable /memcheck startup option to see the leaking memory heap.\n"); + Print(" Press Enter key to exit the process.\n"); + } + GetLine(NULL, 0); + } + } + else + { + Print(" @@@ NO MEMORY LEAKS @@@\n\n"); + } +} + +// Initialize Kernel status +void InitKernelStatus() +{ + UINT i; + + // Memory initialization + Zero(kernel_status, sizeof(kernel_status)); + Zero(kernel_status_max, sizeof(kernel_status_max)); + + // Lock initialization + for (i = 0;i < NUM_KERNEL_STATUS;i++) + { + kernel_status_lock[i] = OSNewLock(); + } + + kernel_status_inited = true; +} + +// Release of the kernel status +void FreeKernelStatus() +{ + UINT i; + + kernel_status_inited = false; + + // Lock release + for (i = 0;i < NUM_KERNEL_STATUS;i++) + { + OSDeleteLock(kernel_status_lock[i]); + } +} + +// Lock the kernel status +void LockKernelStatus(UINT id) +{ + // Validate arguments + if (id >= NUM_KERNEL_STATUS) + { + return; + } + + OSLock(kernel_status_lock[id]); +} + +// Unlock the kernel status +void UnlockKernelStatus(UINT id) +{ + // Validate arguments + if (id >= NUM_KERNEL_STATUS) + { + return; + } + + OSUnlock(kernel_status_lock[id]); +} + +// Display the debug information +void PrintDebugInformation() +{ + MEMORY_STATUS memory_status; + GetMemoryStatus(&memory_status); + + // Header + Print("====== " CEDAR_PRODUCT_STR " VPN System Debug Information ======\n"); + + // Memory information + Print(" \n" + " Number of Allocated Memory Blocks: %u\n" + " Total Size of Allocated Memory Blocks: %u bytes\n", + memory_status.MemoryBlocksNum, memory_status.MemorySize); + + // Footer + Print("====================================================\n"); + + if (KS_GET(KS_CURRENT_MEM_COUNT) != 0 || KS_GET(KS_CURRENT_LOCK_COUNT) != 0 || + KS_GET(KS_CURRENT_LOCKED_COUNT) != 0 || KS_GET(KS_CURRENT_REF_COUNT) != 0) + { + // Show a debug menu because memory leaks suspected + MemoryDebugMenu(); + } +} + + + + diff --git a/src/Mayaqua/Mayaqua.h b/src/Mayaqua/Mayaqua.h index ad5ac514..e057dc65 100644 --- a/src/Mayaqua/Mayaqua.h +++ b/src/Mayaqua/Mayaqua.h @@ -1,515 +1,515 @@ -// SoftEther VPN Source Code - Developer Edition Master Branch -// Mayaqua Kernel - - -// Mayaqua.h -// Mayaqua Kernel header file - -#ifndef MAYAQUA_H -#define MAYAQUA_H - -#include -#include -#include - -#define PENCORE_DLL_NAME "|PenCore.dll" - -//#define USE_PROBE // Use Probe - -// Macro for the release flag -#ifdef VPN_SPEED - -#define WIN32_USE_HEAP_API_FOR_MEMORY // Use the heap API to allocate memory -#define WIN32_NO_DEBUG_HELP_DLL // Do not call the DLL for debugging -#define DONT_ALLOW_RUN_ON_DEBUGGER // Do not allow running on the debugger - -#endif // VPN_SPEED - -void InitProcessCallOnce(); - -#ifdef VPN_EXE -// To build the executable file -#ifdef WIN32 -#include -#include "../PenCore/resource.h" -int main(int argc, char *argv[]); -int PASCAL WinMain(HINSTANCE hInst, HINSTANCE hPrev, char *CmdLine, int CmdShow) -{ - char *argv[] = { CmdLine, }; - InitProcessCallOnce(); - return main(1, argv); -} -#endif // WIN32 -#endif // VPN_EXE - -// Constant -#define DEFAULT_TABLE_FILE_NAME "|strtable.stb" // Default string table -//#define DEFAULT_TABLE_FILE_NAME "@hamcore_zh/strtable.stb" // Test for Chinese - -#define STRTABLE_ID "SE_VPN_20121007" // String table identifier - -// Determining the OS -#ifdef WIN32 -#define OS_WIN32 // Microsoft Windows -#else -#define OS_UNIX // UNIX -#endif // WIN32 - -// Directory separator -#ifdef OS_WIN32 -#define PATH_BACKSLASH // Backslash (\) -#else // WIN32 -#define PATH_SLASH // Slash (/) -#endif // WIN32 - -// Character code -#ifdef OS_WIN32 -#define CODE_SHIFTJIS // Shift_JIS code -#else // WIN32 -#define CODE_EUC // euc-jp code -#endif // WIN32 - -// Endian -#define IsBigEndian() (g_little_endian ? false : true) -#define IsLittleEndian() (g_little_endian) - -#ifdef OS_WIN32 -// Replace the snprintf function -#define snprintf _snprintf -#endif // OS_WIN32 - -// Compiler dependent -#ifndef OS_WIN32 -// Gcc compiler -#define GCC_PACKED __attribute__ ((__packed__)) -#else // OS_WIN32 -// VC++ compiler -#define GCC_PACKED -#endif // OS_WIN32 - -// Macro that displays the current file name and line number -#define WHERE if (IsDebug()){printf("%s: %u\n", __FILE__, __LINE__); SleepThread(10);} -#define WHERE32 if (IsDebug()){ \ - char tmp[128]; sprintf(tmp, "%s: %u", __FILE__, __LINE__); Win32DebugAlert(tmp); \ - } -#define TIMECHECK if (IsDebug()){printf("%-12s:%5u", __FILE__, __LINE__);TimeCheck();} - -// Probe related -#ifdef USE_PROBE -#define PROBE_WHERE WriteProbe(__FILE__, __LINE__, ""); -#define PROBE_STR(str) WriteProbe(__FILE__, __LINE__, (str)); -#define PROBE_DATA2(str, data, size) WriteProbeData(__FILE__, __LINE__, (str), (data), (size)); -#define PROBE_DATA(data, size) WriteProbeData(__FILE__, __LINE__, "", (data), (size)); -#else // USE_PROBE -#define PROBE_WHERE -#define PROBE_STR(str) -#define PROBE_DATA2(str, data, size) -#define PROBE_DATA(data, size) -#endif // USE_PROBE - -// Determine the performance / memory strategy -#if (defined(CPU_X86) || defined(CPU_X64) || defined(CPU_X86_X64) || defined(CPU_SPARC) || defined(CPU_SPARC64) || defined(OS_WIN32) || defined(__amd64__) || defined(__amd64) || defined(__x86_64__) || defined(__x86_64) || defined(i386) || defined(__i386) || defined(__i386__) || defined(__ia64__) || defined(__IA64__) || defined(_IA64)) -#define USE_STRATEGY_PERFORMACE -#else -#define USE_STRATEGY_LOW_MEMORY -#endif - -// Macro that displays the current time -#ifdef WIN32 -#define WHEN if (IsDebug()){WHERE; MsPrintTick();} -#else // WIN32 -#define WHEN -#endif // WIN32 - -#ifdef OS_UNIX -#ifndef UNIX_SOLARIS -#ifndef CPU_SH4 -#if !defined(__UCLIBC__) || defined(__UCLIBC_SUPPORT_AI_ADDRCONFIG__) -// Getifaddrs system call is supported on UNIX other than Solaris. -// However, it is not supported also by the Linux on SH4 CPU -#define MAYAQUA_SUPPORTS_GETIFADDRS -#endif // !UCLIBC || UCLIBC_SUPPORT_AI_ADDRCONFIG -#endif // CPU_SH4 -#endif // UNIX_SOLARIS -#endif // OS_UNIX - -#ifdef OS_UNIX -// Header only needed in UNIX OS -#include -#include -#include -#include -#ifdef UNIX_LINUX -#include -#elif UNIX_BSD -#include -#include -#endif -#ifdef UNIX_SOLARIS -#include -#define USE_STATVFS -#endif // UNIX_SOLARIS -#include -#include -#include -#include -#include -#include -#include -#ifdef UNIX_SOLARIS -#include -#endif // UNIX_SOLARIS -#include -#include -#include -#ifdef UNIX_LINUX -#include -#endif // UNIX_LINUX -#include -#include -#include -#include -//#include -#include -#include -#include -#include -#include -//#include -#ifdef MAYAQUA_SUPPORTS_GETIFADDRS -#include -#endif // MAYAQUA_SUPPORTS_GETIFADDRS - -#ifdef UNIX_LINUX -typedef void *iconv_t; -iconv_t iconv_open (__const char *__tocode, __const char *__fromcode); -size_t iconv (iconv_t __cd, char **__restrict __inbuf, - size_t *__restrict __inbytesleft, - char **__restrict __outbuf, - size_t *__restrict __outbytesleft); -int iconv_close (iconv_t __cd); -#else // UNIX_LINUX -#include -#endif // UNIX_LINUX - - - -#ifdef UNIX_LINUX -#include -#include -#include -#endif // UNIX_LINUX - -#ifdef UNIX_SOLARIS -#include -#include -#include -#endif // UNIX_SOLARIS - -#ifndef NO_VLAN - -#include - -#endif // NO_VLAN - -#define closesocket(s) close(s) - -#else // Win32 only - -#include - -#endif // OS_UNIX - -// IPv6 support flag -#ifndef WIN32 -#ifndef AF_INET6 -#define NO_IPV6 -#endif // AF_INET6 -#endif // WIN32 - -// Basic type declaration -#include - -// Object management -#include - -// Object tracking -#include - -// File I/O -#include - -// Memory management -#include - -// String processing -#include - -// Internationalized string processing -#include - -// Encryption processing -#include - -// Secure token -#include - -// Kernel -#include - -// Package -#include - -// Configuration file -#include - -// String table -#include - -// Network communication -#include - -// TCP/IP -#include - -// HTTP -#include - -// Proxy -#include - -// 64 bit real-time clock -#include - -// OS-dependent code -#include - -// Code for Microsoft Windows -#include - - -// Global variables -extern bool g_memcheck; -extern bool g_debug; -extern char *cmdline; -extern wchar_t *uni_cmdline; -extern bool g_little_endian; -extern LOCK *tick_manual_lock; -extern bool g_foreground; - -// Kernel state -#define NUM_KERNEL_STATUS 128 -extern UINT64 kernel_status[NUM_KERNEL_STATUS]; -extern UINT64 kernel_status_max[NUM_KERNEL_STATUS]; -extern LOCK *kernel_status_lock[NUM_KERNEL_STATUS]; -extern bool kernel_status_inited; - -// Kernel state operation macro -#define KS_LOCK(id) LockKernelStatus(id) -#define KS_UNLOCK(id) UnlockKernelStatus(id) -#define KS_GET64(id) (kernel_status[id]) -#define KS_GET(id) ((UINT)KS_GET64(id)) -#define KS_GETMAX64(id) (kernel_status_max[id]) -#define KS_GETMAX(id) ((UINT)KS_GETMAX64(id)) - -// Operations of the kernel status -#define KS_INC(id) \ -if (IsTrackingEnabled()) { \ - KS_LOCK(id); \ - kernel_status[id]++; \ - kernel_status_max[id] = MAX(kernel_status_max[id], kernel_status[id]); \ - KS_UNLOCK(id); \ -} -#define KS_DEC(id) \ -if (IsTrackingEnabled()) { \ - KS_LOCK(id); \ - kernel_status[id]--; \ - kernel_status_max[id] = MAX(kernel_status_max[id], kernel_status[id]); \ - KS_UNLOCK(id); \ -} -#define KS_ADD(id, n) \ -if (IsTrackingEnabled()) { \ - KS_LOCK(id); \ - kernel_status[id] += n; \ - kernel_status_max[id] = MAX(kernel_status_max[id], kernel_status[id]); \ - KS_UNLOCK(id); \ -} -#define KS_SUB(id, n) \ -if (IsTrackingEnabled()) { \ - KS_LOCK(id); \ - kernel_status[id] -= n; \ - kernel_status_max[id] = MAX(kernel_status_max[id], kernel_status[id]); \ - KS_UNLOCK(id); \ -} - -// Kernel status -// String related -#define KS_STRCPY_COUNT 0 // number of calls StrCpy -#define KS_STRLEN_COUNT 1 // number of calls StrLen -#define KS_STRCHECK_COUNT 2 // number of calls StrCheck -#define KS_STRCAT_COUNT 3 // number of calls StrCat -#define KS_FORMAT_COUNT 4 // number of calls Format -// Memory related -#define KS_MALLOC_COUNT 5 // Number of calls Malloc -#define KS_REALLOC_COUNT 6 // Number of calls ReAlloc -#define KS_FREE_COUNT 7 // number of calls Free -#define KS_TOTAL_MEM_SIZE 8 // The total size of the memory that was allocated so far -#define KS_CURRENT_MEM_COUNT 9 // Number of memory blocks that are currently reserved -#define KS_TOTAL_MEM_COUNT 10 // The total number of memory blocks that ware allocated so far -#define KS_ZERO_COUNT 11 // Number of calls Zero -#define KS_COPY_COUNT 12 // Number of calls Copy -// Lock related -#define KS_NEWLOCK_COUNT 13 // Number of calls NewLock -#define KS_DELETELOCK_COUNT 14 // Number of calls DeleteLock -#define KS_LOCK_COUNT 15 // Number of calls Lock -#define KS_UNLOCK_COUNT 16 // Number of calls Unlock -#define KS_CURRENT_LOCK_COUNT 17 // Current number of LOCK objects -#define KS_CURRENT_LOCKED_COUNT 18 // Current number of locked LOCK objects -// Counter information -#define KS_NEW_COUNTER_COUNT 19 // Number of calls NewCounter -#define KS_DELETE_COUNTER_COUNT 20 // Number of calls DeleteCounter -#define KS_INC_COUNT 21 // Number of calls Inc -#define KS_DEC_COUNT 22 // Number of calls Dec -#define KS_CURRENT_COUNT 23 // Current total number of counts -// Reference counter information -#define KS_NEWREF_COUNT 24 // Number of calls NewRef -#define KS_FREEREF_COUNT 72 // Number of times REF objects are deleted -#define KS_ADDREF_COUNT 25 // Number of calls AddRef -#define KS_RELEASE_COUNT 26 // Number of calls Release -#define KS_CURRENT_REF_COUNT 27 // Current number of REF objects -#define KS_CURRENT_REFED_COUNT 28 // The sum of the current number of references -// Buffer information -#define KS_NEWBUF_COUNT 29 // Number of calls NewBuf -#define KS_FREEBUF_COUNT 30 // NNumber of calls FreeBuf -#define KS_CURRENT_BUF_COUNT 31 // Current number of objects in the BUF -#define KS_READ_BUF_COUNT 32 // Number of calls ReadBuf -#define KS_WRITE_BUF_COUNT 33 // Number of calls WriteBuf -#define KS_ADJUST_BUFSIZE_COUNT 34 // Number of times to adjust the buffer size -#define KS_SEEK_BUF_COUNT 35 // Number of calls SeekBuf -// FIFO information -#define KS_NEWFIFO_COUNT 36 // Number of calls NewFifo -#define KS_FREEFIFO_COUNT 37 // Number of times the FIFO object is deleted -#define KS_READ_FIFO_COUNT 38 // Number of calls ReadFifo -#define KS_WRITE_FIFO_COUNT 39 // Number of calls WriteFifo -// List related -#define KS_NEWLIST_COUNT 41 // Number of calls NewList -#define KS_FREELIST_COUNT 42 // Number of times the object LIST was deleted -#define KS_INSERT_COUNT 43 // Number of calls Add -#define KS_DELETE_COUNT 44 // Number of calls Delete -#define KS_SORT_COUNT 45 // Number of calls Sort -#define KS_SEARCH_COUNT 46 // Number of calls Search -#define KS_TOARRAY_COUNT 47 // Number of calls ToArray -// Queue related -#define KS_NEWQUEUE_COUNT 48 // Number of calls NewQueue -#define KS_FREEQUEUE_COUNT 49 // Number of times you delete the object QUEUE -#define KS_PUSH_COUNT 50 // Number of calls Push -#define KS_POP_COUNT 51 // Number of calls POP -// Stack related -#define KS_NEWSK_COUNT 52 // Number of calls NewSk -#define KS_FREESK_COUNT 53 // Number of times you delete the object SK -#define KS_INSERT_QUEUE_COUNT 54 // Number of calls InsertQueue -#define KS_GETNEXT_COUNT 55 // Number of calls GetNext -// Kernel related -#define KS_GETTIME_COUNT 56 // Number of times to get the time -#define KS_GETTICK_COUNT 57 // Number of times to get the system timer -#define KS_NEWTHREAD_COUNT 58 // Number of calls NewThread -#define KS_FREETHREAD_COUNT 59 // Number of times you delete the object THREAD -#define KS_WAITFORTHREAD_COUNT 60 // Number of calls WaitForThread -#define KS_NEWEVENT_COUNT 61 // Number of calls NewEvent -#define KS_FREEEVENT_COUNT 62 // Number of times which EVENT object is deleted -#define KS_WAIT_COUNT 63 // Number of calls Wait -#define KS_SLEEPTHREAD_COUNT 64 // Number of calls SleepThread -// About IO -#define KS_IO_OPEN_COUNT 65 // Number of times to open the file -#define KS_IO_CREATE_COUNT 66 // Number of times that the file was created -#define KS_IO_CLOSE_COUNT 67 // Number of times to close the file -#define KS_IO_READ_COUNT 68 // Number of times to read from the file -#define KS_IO_WRITE_COUNT 69 // Number of times to write to a file -#define KS_IO_TOTAL_READ_SIZE 70 // Total number of bytes read from the file -#define KS_IO_TOTAL_WRITE_SIZE 71 // The total number of bytes written to the file -// Memory pool related -#define KS_MEMPOOL_MALLOC_COUNT 75 // Number of times to allocate the memory pool -#define KS_MEMPOOL_FREE_COUNT 73 // Number of times you release the memory pool -#define KS_MEMPOOL_CURRENT_NUM 74 // Current number of the memory pool -#define KS_MEMPOOL_REALLOC_COUNT 76 // Number of times you have realloc the memory pool - - -// Macro -#define IsDebug() (g_debug) // A debug mode -#define IsMemCheck() (g_memcheck) // Memory check mode - -// Function prototype -void InitMayaqua(bool memcheck, bool debug, int argc, char **argv); -void FreeMayaqua(); -bool IsNt(); -bool MayaquaIsDotNetMode(); -void MayaquaMinimalMode(); -bool MayaquaIsMinimalMode(); -bool Is64(); -bool Is32(); -bool IsIA64(); -bool IsX64(); -void InitKernelStatus(); -void FreeKernelStatus(); -void PrintDebugInformation(); -void LockKernelStatus(UINT id); -void UnlockKernelStatus(UINT id); -void PrintKernelStatus(); -void InitCommandLineStr(int argc, char **argv); -void FreeCommandLineStr(); -void SetCommandLineStr(char *str); -void SetCommandLineUniStr(wchar_t *str); -char *GetCommandLineStr(); -wchar_t *GetCommandLineUniStr(); -void ParseCommandLineTokens(); -void FreeCommandLineTokens(); -TOKEN_LIST *GetCommandLineToken(); -UNI_TOKEN_LIST *GetCommandLineUniToken(); -void InitOsInfo(); -void FreeOsInfo(); -void Alert(char *msg, char *caption); -void AlertW(wchar_t *msg, wchar_t *caption); -OS_INFO *GetOsInfo(); -UINT GetOsType(); -void CheckEndian(); -void CheckUnixTempDir(); -void TimeCheck(); -void SetHamMode(); -bool IsHamMode(); -void InitProbe(); -void FreeProbe(); -void EnableProbe(bool enable); -bool IsProbeEnabled(); -void WriteProbe(char *filename, UINT line, char *str); -void WriteProbeData(char *filename, UINT line, char *str, void *data, UINT size); -USHORT CalcChecksum16(void *buf, UINT size); - - -#ifdef OS_WIN32 -// Import library (for Win32) -#pragma comment(lib, "Ws2_32.lib") -#pragma comment(lib, "winmm.lib") -#pragma comment(lib, "kernel32.lib") -#pragma comment(lib, "user32.lib") -#pragma comment(lib, "gdi32.lib") -#pragma comment(lib, "shell32.lib") -#pragma comment(lib, "comctl32.lib") -#pragma comment(lib, "dbghelp.lib") -#pragma comment(lib, "Iphlpapi.lib") -#pragma comment(lib, "setupapi.lib") -#pragma comment(lib, "version.lib") -#pragma comment(lib, "Netapi32.lib") -#pragma comment(lib, "shlwapi.lib") -#pragma comment(lib, "crypt32.lib") -#pragma warning( disable : 4099 ) -#endif // OS_WIN32 - -// For Debugging -#ifndef ENCRYPT_C -//#define Disconnect(s) {Debug("Disconnect() Called: %s %u\n", __FILE__, __LINE__);Disconnect(s);} -#endif - - -#endif // MAYAQUA_H - - +// SoftEther VPN Source Code - Developer Edition Master Branch +// Mayaqua Kernel + + +// Mayaqua.h +// Mayaqua Kernel header file + +#ifndef MAYAQUA_H +#define MAYAQUA_H + +#include +#include +#include + +#define PENCORE_DLL_NAME "|PenCore.dll" + +//#define USE_PROBE // Use Probe + +// Macro for the release flag +#ifdef VPN_SPEED + +#define WIN32_USE_HEAP_API_FOR_MEMORY // Use the heap API to allocate memory +#define WIN32_NO_DEBUG_HELP_DLL // Do not call the DLL for debugging +#define DONT_ALLOW_RUN_ON_DEBUGGER // Do not allow running on the debugger + +#endif // VPN_SPEED + +void InitProcessCallOnce(); + +#ifdef VPN_EXE +// To build the executable file +#ifdef WIN32 +#include +#include "../PenCore/resource.h" +int main(int argc, char *argv[]); +int PASCAL WinMain(HINSTANCE hInst, HINSTANCE hPrev, char *CmdLine, int CmdShow) +{ + char *argv[] = { CmdLine, }; + InitProcessCallOnce(); + return main(1, argv); +} +#endif // WIN32 +#endif // VPN_EXE + +// Constant +#define DEFAULT_TABLE_FILE_NAME "|strtable.stb" // Default string table +//#define DEFAULT_TABLE_FILE_NAME "@hamcore_zh/strtable.stb" // Test for Chinese + +#define STRTABLE_ID "SE_VPN_20121007" // String table identifier + +// Determining the OS +#ifdef WIN32 +#define OS_WIN32 // Microsoft Windows +#else +#define OS_UNIX // UNIX +#endif // WIN32 + +// Directory separator +#ifdef OS_WIN32 +#define PATH_BACKSLASH // Backslash (\) +#else // WIN32 +#define PATH_SLASH // Slash (/) +#endif // WIN32 + +// Character code +#ifdef OS_WIN32 +#define CODE_SHIFTJIS // Shift_JIS code +#else // WIN32 +#define CODE_EUC // euc-jp code +#endif // WIN32 + +// Endian +#define IsBigEndian() (g_little_endian ? false : true) +#define IsLittleEndian() (g_little_endian) + +#ifdef OS_WIN32 +// Replace the snprintf function +#define snprintf _snprintf +#endif // OS_WIN32 + +// Compiler dependent +#ifndef OS_WIN32 +// Gcc compiler +#define GCC_PACKED __attribute__ ((__packed__)) +#else // OS_WIN32 +// VC++ compiler +#define GCC_PACKED +#endif // OS_WIN32 + +// Macro that displays the current file name and line number +#define WHERE if (IsDebug()){printf("%s: %u\n", __FILE__, __LINE__); SleepThread(10);} +#define WHERE32 if (IsDebug()){ \ + char tmp[128]; sprintf(tmp, "%s: %u", __FILE__, __LINE__); Win32DebugAlert(tmp); \ + } +#define TIMECHECK if (IsDebug()){printf("%-12s:%5u", __FILE__, __LINE__);TimeCheck();} + +// Probe related +#ifdef USE_PROBE +#define PROBE_WHERE WriteProbe(__FILE__, __LINE__, ""); +#define PROBE_STR(str) WriteProbe(__FILE__, __LINE__, (str)); +#define PROBE_DATA2(str, data, size) WriteProbeData(__FILE__, __LINE__, (str), (data), (size)); +#define PROBE_DATA(data, size) WriteProbeData(__FILE__, __LINE__, "", (data), (size)); +#else // USE_PROBE +#define PROBE_WHERE +#define PROBE_STR(str) +#define PROBE_DATA2(str, data, size) +#define PROBE_DATA(data, size) +#endif // USE_PROBE + +// Determine the performance / memory strategy +#if (defined(CPU_X86) || defined(CPU_X64) || defined(CPU_X86_X64) || defined(CPU_SPARC) || defined(CPU_SPARC64) || defined(OS_WIN32) || defined(__amd64__) || defined(__amd64) || defined(__x86_64__) || defined(__x86_64) || defined(i386) || defined(__i386) || defined(__i386__) || defined(__ia64__) || defined(__IA64__) || defined(_IA64)) +#define USE_STRATEGY_PERFORMACE +#else +#define USE_STRATEGY_LOW_MEMORY +#endif + +// Macro that displays the current time +#ifdef WIN32 +#define WHEN if (IsDebug()){WHERE; MsPrintTick();} +#else // WIN32 +#define WHEN +#endif // WIN32 + +#ifdef OS_UNIX +#ifndef UNIX_SOLARIS +#ifndef CPU_SH4 +#if !defined(__UCLIBC__) || defined(__UCLIBC_SUPPORT_AI_ADDRCONFIG__) +// Getifaddrs system call is supported on UNIX other than Solaris. +// However, it is not supported also by the Linux on SH4 CPU +#define MAYAQUA_SUPPORTS_GETIFADDRS +#endif // !UCLIBC || UCLIBC_SUPPORT_AI_ADDRCONFIG +#endif // CPU_SH4 +#endif // UNIX_SOLARIS +#endif // OS_UNIX + +#ifdef OS_UNIX +// Header only needed in UNIX OS +#include +#include +#include +#include +#ifdef UNIX_LINUX +#include +#elif UNIX_BSD +#include +#include +#endif +#ifdef UNIX_SOLARIS +#include +#define USE_STATVFS +#endif // UNIX_SOLARIS +#include +#include +#include +#include +#include +#include +#include +#ifdef UNIX_SOLARIS +#include +#endif // UNIX_SOLARIS +#include +#include +#include +#ifdef UNIX_LINUX +#include +#endif // UNIX_LINUX +#include +#include +#include +#include +//#include +#include +#include +#include +#include +#include +//#include +#ifdef MAYAQUA_SUPPORTS_GETIFADDRS +#include +#endif // MAYAQUA_SUPPORTS_GETIFADDRS + +#ifdef UNIX_LINUX +typedef void *iconv_t; +iconv_t iconv_open (__const char *__tocode, __const char *__fromcode); +size_t iconv (iconv_t __cd, char **__restrict __inbuf, + size_t *__restrict __inbytesleft, + char **__restrict __outbuf, + size_t *__restrict __outbytesleft); +int iconv_close (iconv_t __cd); +#else // UNIX_LINUX +#include +#endif // UNIX_LINUX + + + +#ifdef UNIX_LINUX +#include +#include +#include +#endif // UNIX_LINUX + +#ifdef UNIX_SOLARIS +#include +#include +#include +#endif // UNIX_SOLARIS + +#ifndef NO_VLAN + +#include + +#endif // NO_VLAN + +#define closesocket(s) close(s) + +#else // Win32 only + +#include + +#endif // OS_UNIX + +// IPv6 support flag +#ifndef WIN32 +#ifndef AF_INET6 +#define NO_IPV6 +#endif // AF_INET6 +#endif // WIN32 + +// Basic type declaration +#include + +// Object management +#include + +// Object tracking +#include + +// File I/O +#include + +// Memory management +#include + +// String processing +#include + +// Internationalized string processing +#include + +// Encryption processing +#include + +// Secure token +#include + +// Kernel +#include + +// Package +#include + +// Configuration file +#include + +// String table +#include + +// Network communication +#include + +// TCP/IP +#include + +// HTTP +#include + +// Proxy +#include + +// 64 bit real-time clock +#include + +// OS-dependent code +#include + +// Code for Microsoft Windows +#include + + +// Global variables +extern bool g_memcheck; +extern bool g_debug; +extern char *cmdline; +extern wchar_t *uni_cmdline; +extern bool g_little_endian; +extern LOCK *tick_manual_lock; +extern bool g_foreground; + +// Kernel state +#define NUM_KERNEL_STATUS 128 +extern UINT64 kernel_status[NUM_KERNEL_STATUS]; +extern UINT64 kernel_status_max[NUM_KERNEL_STATUS]; +extern LOCK *kernel_status_lock[NUM_KERNEL_STATUS]; +extern bool kernel_status_inited; + +// Kernel state operation macro +#define KS_LOCK(id) LockKernelStatus(id) +#define KS_UNLOCK(id) UnlockKernelStatus(id) +#define KS_GET64(id) (kernel_status[id]) +#define KS_GET(id) ((UINT)KS_GET64(id)) +#define KS_GETMAX64(id) (kernel_status_max[id]) +#define KS_GETMAX(id) ((UINT)KS_GETMAX64(id)) + +// Operations of the kernel status +#define KS_INC(id) \ +if (IsTrackingEnabled()) { \ + KS_LOCK(id); \ + kernel_status[id]++; \ + kernel_status_max[id] = MAX(kernel_status_max[id], kernel_status[id]); \ + KS_UNLOCK(id); \ +} +#define KS_DEC(id) \ +if (IsTrackingEnabled()) { \ + KS_LOCK(id); \ + kernel_status[id]--; \ + kernel_status_max[id] = MAX(kernel_status_max[id], kernel_status[id]); \ + KS_UNLOCK(id); \ +} +#define KS_ADD(id, n) \ +if (IsTrackingEnabled()) { \ + KS_LOCK(id); \ + kernel_status[id] += n; \ + kernel_status_max[id] = MAX(kernel_status_max[id], kernel_status[id]); \ + KS_UNLOCK(id); \ +} +#define KS_SUB(id, n) \ +if (IsTrackingEnabled()) { \ + KS_LOCK(id); \ + kernel_status[id] -= n; \ + kernel_status_max[id] = MAX(kernel_status_max[id], kernel_status[id]); \ + KS_UNLOCK(id); \ +} + +// Kernel status +// String related +#define KS_STRCPY_COUNT 0 // number of calls StrCpy +#define KS_STRLEN_COUNT 1 // number of calls StrLen +#define KS_STRCHECK_COUNT 2 // number of calls StrCheck +#define KS_STRCAT_COUNT 3 // number of calls StrCat +#define KS_FORMAT_COUNT 4 // number of calls Format +// Memory related +#define KS_MALLOC_COUNT 5 // Number of calls Malloc +#define KS_REALLOC_COUNT 6 // Number of calls ReAlloc +#define KS_FREE_COUNT 7 // number of calls Free +#define KS_TOTAL_MEM_SIZE 8 // The total size of the memory that was allocated so far +#define KS_CURRENT_MEM_COUNT 9 // Number of memory blocks that are currently reserved +#define KS_TOTAL_MEM_COUNT 10 // The total number of memory blocks that ware allocated so far +#define KS_ZERO_COUNT 11 // Number of calls Zero +#define KS_COPY_COUNT 12 // Number of calls Copy +// Lock related +#define KS_NEWLOCK_COUNT 13 // Number of calls NewLock +#define KS_DELETELOCK_COUNT 14 // Number of calls DeleteLock +#define KS_LOCK_COUNT 15 // Number of calls Lock +#define KS_UNLOCK_COUNT 16 // Number of calls Unlock +#define KS_CURRENT_LOCK_COUNT 17 // Current number of LOCK objects +#define KS_CURRENT_LOCKED_COUNT 18 // Current number of locked LOCK objects +// Counter information +#define KS_NEW_COUNTER_COUNT 19 // Number of calls NewCounter +#define KS_DELETE_COUNTER_COUNT 20 // Number of calls DeleteCounter +#define KS_INC_COUNT 21 // Number of calls Inc +#define KS_DEC_COUNT 22 // Number of calls Dec +#define KS_CURRENT_COUNT 23 // Current total number of counts +// Reference counter information +#define KS_NEWREF_COUNT 24 // Number of calls NewRef +#define KS_FREEREF_COUNT 72 // Number of times REF objects are deleted +#define KS_ADDREF_COUNT 25 // Number of calls AddRef +#define KS_RELEASE_COUNT 26 // Number of calls Release +#define KS_CURRENT_REF_COUNT 27 // Current number of REF objects +#define KS_CURRENT_REFED_COUNT 28 // The sum of the current number of references +// Buffer information +#define KS_NEWBUF_COUNT 29 // Number of calls NewBuf +#define KS_FREEBUF_COUNT 30 // NNumber of calls FreeBuf +#define KS_CURRENT_BUF_COUNT 31 // Current number of objects in the BUF +#define KS_READ_BUF_COUNT 32 // Number of calls ReadBuf +#define KS_WRITE_BUF_COUNT 33 // Number of calls WriteBuf +#define KS_ADJUST_BUFSIZE_COUNT 34 // Number of times to adjust the buffer size +#define KS_SEEK_BUF_COUNT 35 // Number of calls SeekBuf +// FIFO information +#define KS_NEWFIFO_COUNT 36 // Number of calls NewFifo +#define KS_FREEFIFO_COUNT 37 // Number of times the FIFO object is deleted +#define KS_READ_FIFO_COUNT 38 // Number of calls ReadFifo +#define KS_WRITE_FIFO_COUNT 39 // Number of calls WriteFifo +// List related +#define KS_NEWLIST_COUNT 41 // Number of calls NewList +#define KS_FREELIST_COUNT 42 // Number of times the object LIST was deleted +#define KS_INSERT_COUNT 43 // Number of calls Add +#define KS_DELETE_COUNT 44 // Number of calls Delete +#define KS_SORT_COUNT 45 // Number of calls Sort +#define KS_SEARCH_COUNT 46 // Number of calls Search +#define KS_TOARRAY_COUNT 47 // Number of calls ToArray +// Queue related +#define KS_NEWQUEUE_COUNT 48 // Number of calls NewQueue +#define KS_FREEQUEUE_COUNT 49 // Number of times you delete the object QUEUE +#define KS_PUSH_COUNT 50 // Number of calls Push +#define KS_POP_COUNT 51 // Number of calls POP +// Stack related +#define KS_NEWSK_COUNT 52 // Number of calls NewSk +#define KS_FREESK_COUNT 53 // Number of times you delete the object SK +#define KS_INSERT_QUEUE_COUNT 54 // Number of calls InsertQueue +#define KS_GETNEXT_COUNT 55 // Number of calls GetNext +// Kernel related +#define KS_GETTIME_COUNT 56 // Number of times to get the time +#define KS_GETTICK_COUNT 57 // Number of times to get the system timer +#define KS_NEWTHREAD_COUNT 58 // Number of calls NewThread +#define KS_FREETHREAD_COUNT 59 // Number of times you delete the object THREAD +#define KS_WAITFORTHREAD_COUNT 60 // Number of calls WaitForThread +#define KS_NEWEVENT_COUNT 61 // Number of calls NewEvent +#define KS_FREEEVENT_COUNT 62 // Number of times which EVENT object is deleted +#define KS_WAIT_COUNT 63 // Number of calls Wait +#define KS_SLEEPTHREAD_COUNT 64 // Number of calls SleepThread +// About IO +#define KS_IO_OPEN_COUNT 65 // Number of times to open the file +#define KS_IO_CREATE_COUNT 66 // Number of times that the file was created +#define KS_IO_CLOSE_COUNT 67 // Number of times to close the file +#define KS_IO_READ_COUNT 68 // Number of times to read from the file +#define KS_IO_WRITE_COUNT 69 // Number of times to write to a file +#define KS_IO_TOTAL_READ_SIZE 70 // Total number of bytes read from the file +#define KS_IO_TOTAL_WRITE_SIZE 71 // The total number of bytes written to the file +// Memory pool related +#define KS_MEMPOOL_MALLOC_COUNT 75 // Number of times to allocate the memory pool +#define KS_MEMPOOL_FREE_COUNT 73 // Number of times you release the memory pool +#define KS_MEMPOOL_CURRENT_NUM 74 // Current number of the memory pool +#define KS_MEMPOOL_REALLOC_COUNT 76 // Number of times you have realloc the memory pool + + +// Macro +#define IsDebug() (g_debug) // A debug mode +#define IsMemCheck() (g_memcheck) // Memory check mode + +// Function prototype +void InitMayaqua(bool memcheck, bool debug, int argc, char **argv); +void FreeMayaqua(); +bool IsNt(); +bool MayaquaIsDotNetMode(); +void MayaquaMinimalMode(); +bool MayaquaIsMinimalMode(); +bool Is64(); +bool Is32(); +bool IsIA64(); +bool IsX64(); +void InitKernelStatus(); +void FreeKernelStatus(); +void PrintDebugInformation(); +void LockKernelStatus(UINT id); +void UnlockKernelStatus(UINT id); +void PrintKernelStatus(); +void InitCommandLineStr(int argc, char **argv); +void FreeCommandLineStr(); +void SetCommandLineStr(char *str); +void SetCommandLineUniStr(wchar_t *str); +char *GetCommandLineStr(); +wchar_t *GetCommandLineUniStr(); +void ParseCommandLineTokens(); +void FreeCommandLineTokens(); +TOKEN_LIST *GetCommandLineToken(); +UNI_TOKEN_LIST *GetCommandLineUniToken(); +void InitOsInfo(); +void FreeOsInfo(); +void Alert(char *msg, char *caption); +void AlertW(wchar_t *msg, wchar_t *caption); +OS_INFO *GetOsInfo(); +UINT GetOsType(); +void CheckEndian(); +void CheckUnixTempDir(); +void TimeCheck(); +void SetHamMode(); +bool IsHamMode(); +void InitProbe(); +void FreeProbe(); +void EnableProbe(bool enable); +bool IsProbeEnabled(); +void WriteProbe(char *filename, UINT line, char *str); +void WriteProbeData(char *filename, UINT line, char *str, void *data, UINT size); +USHORT CalcChecksum16(void *buf, UINT size); + + +#ifdef OS_WIN32 +// Import library (for Win32) +#pragma comment(lib, "Ws2_32.lib") +#pragma comment(lib, "winmm.lib") +#pragma comment(lib, "kernel32.lib") +#pragma comment(lib, "user32.lib") +#pragma comment(lib, "gdi32.lib") +#pragma comment(lib, "shell32.lib") +#pragma comment(lib, "comctl32.lib") +#pragma comment(lib, "dbghelp.lib") +#pragma comment(lib, "Iphlpapi.lib") +#pragma comment(lib, "setupapi.lib") +#pragma comment(lib, "version.lib") +#pragma comment(lib, "Netapi32.lib") +#pragma comment(lib, "shlwapi.lib") +#pragma comment(lib, "crypt32.lib") +#pragma warning( disable : 4099 ) +#endif // OS_WIN32 + +// For Debugging +#ifndef ENCRYPT_C +//#define Disconnect(s) {Debug("Disconnect() Called: %s %u\n", __FILE__, __LINE__);Disconnect(s);} +#endif + + +#endif // MAYAQUA_H + + diff --git a/src/Mayaqua/Memory.c b/src/Mayaqua/Memory.c index b19e3722..c629286a 100644 --- a/src/Mayaqua/Memory.c +++ b/src/Mayaqua/Memory.c @@ -1,4060 +1,4060 @@ -// SoftEther VPN Source Code - Developer Edition Master Branch -// Mayaqua Kernel - - -// Memory.c -// Memory management program - -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#define MEMORY_SLEEP_TIME 150 -#define MEMORY_MAX_RETRY 30 -#define INIT_BUF_SIZE 10240 - -#define FIFO_INIT_MEM_SIZE 4096 -#define FIFO_REALLOC_MEM_SIZE (65536 * 10) // Exquisite value - -#define INIT_NUM_RESERVED 32 - -static UINT fifo_current_realloc_mem_size = FIFO_REALLOC_MEM_SIZE; - -// New PRand -PRAND *NewPRand(void *key, UINT key_size) -{ - PRAND *r; - UCHAR dummy[256]; - if (key == NULL || key_size == 0) - { - key = "DUMMY"; - key_size = 5; - } - - r = ZeroMalloc(sizeof(PRAND)); - - Sha1(r->Key, key, key_size); - - r->Rc4 = NewCrypt(key, key_size); - - Zero(dummy, sizeof(dummy)); - - Encrypt(r->Rc4, dummy, dummy, 256); - - return r; -} - -// Free PRand -void FreePRand(PRAND *r) -{ - if (r == NULL) - { - return; - } - - FreeCrypt(r->Rc4); - - Free(r); -} - -// Generate PRand -void PRand(PRAND *p, void *data, UINT size) -{ - if (p == NULL) - { - return; - } - - Zero(data, size); - - Encrypt(p->Rc4, data, data, size); -} - -// Generate UINT PRand -UINT PRandInt(PRAND *p) -{ - UINT r; - if (p == NULL) - { - return 0; - } - - PRand(p, &r, sizeof(UINT)); - - return r; -} - -// Check whether the specified key item is in the hash list -bool IsInHashListKey(HASH_LIST *h, UINT key) -{ - // Validate arguments - if (h == NULL || key == 0) - { - return false; - } - - if (HashListKeyToPointer(h, key) == NULL) - { - return false; - } - - return true; -} - -// Search the item in the hash list with the key -void *HashListKeyToPointer(HASH_LIST *h, UINT key) -{ - UINT num, i; - void **pp; - void *ret = NULL; - // Validate arguments - if (h == NULL || key == 0) - { - return NULL; - } - - pp = HashListToArray(h, &num); - if (pp == NULL) - { - return NULL; - } - - for (i = 0;i < num;i++) - { - void *p = pp[i]; - - if (POINTER_TO_KEY(p) == key) - { - ret = p; - } - } - - Free(pp); - - return ret; -} - -// Lock the hash list -void LockHashList(HASH_LIST *h) -{ - // Validate arguments - if (h == NULL) - { - return; - } - - Lock(h->Lock); -} - -// Unlock the hash list -void UnlockHashList(HASH_LIST *h) -{ - // Validate arguments - if (h == NULL) - { - return; - } - - Unlock(h->Lock); -} - -// Write the contents of the hash list to array -void **HashListToArray(HASH_LIST *h, UINT *num) -{ - void **ret = NULL; - UINT i; - UINT n = 0; - // Validate arguments - if (h == NULL || num == NULL) - { - if (num != NULL) - { - *num = 0; - } - return NULL; - } - - if (h->AllList != NULL) - { - *num = LIST_NUM(h->AllList); - - return ToArray(h->AllList); - } - - ret = ZeroMalloc(sizeof(void *) * h->NumItems); - - for (i = 0;i < h->Size;i++) - { - LIST *o = h->Entries[i]; - - if (o != NULL) - { - UINT j; - - for (j = 0;j < LIST_NUM(o);j++) - { - void *p = LIST_DATA(o, j); - - ret[n] = p; - n++; - } - } - } - - *num = n; - - return ret; -} - -// Search an item in the hash list -void *SearchHash(HASH_LIST *h, void *t) -{ - UINT r; - void *ret = NULL; - // Validate arguments - if (h == NULL || t == NULL) - { - return NULL; - } - - r = CalcHashForHashList(h, t); - - if (h->Entries[r] != NULL) - { - LIST *o = h->Entries[r]; - void *r = Search(o, t); - - if (r != NULL) - { - ret = r; - } - } - - return ret; -} - -// Remove an item from the hash list -bool DeleteHash(HASH_LIST *h, void *p) -{ - UINT r; - bool ret = false; - // Validate arguments - if (h == NULL || p == NULL) - { - return false; - } - - r = CalcHashForHashList(h, p); - - if (h->Entries[r] != NULL) - { - if (Delete(h->Entries[r], p)) - { - ret = true; - h->NumItems--; - } - - if (LIST_NUM(h->Entries[r]) == 0) - { - ReleaseList(h->Entries[r]); - h->Entries[r] = NULL; - } - } - - if (ret) - { - if (h->AllList != NULL) - { - Delete(h->AllList, p); - } - } - - return ret; -} - -// Add an item to the hash list -void AddHash(HASH_LIST *h, void *p) -{ - UINT r; - // Validate arguments - if (h == NULL || p == NULL) - { - return; - } - - r = CalcHashForHashList(h, p); - - if (h->Entries[r] == NULL) - { - h->Entries[r] = NewListFast(h->CompareProc); - } - - Insert(h->Entries[r], p); - - if (h->AllList != NULL) - { - Add(h->AllList, p); - } - - h->NumItems++; -} - -// Calculation of the hash value of the object -UINT CalcHashForHashList(HASH_LIST *h, void *p) -{ - UINT r; - // Validate arguments - if (h == NULL || p == NULL) - { - return 0; - } - - r = h->GetHashProc(p); - - return (r % h->Size); -} - -// Creating a hash list -HASH_LIST *NewHashList(GET_HASH *get_hash_proc, COMPARE *compare_proc, UINT bits, bool make_list) -{ - HASH_LIST *h; - // Validate arguments - if (get_hash_proc == NULL || compare_proc == NULL) - { - return NULL; - } - if (bits == 0) - { - bits = 16; - } - - bits = MIN(bits, 31); - - h = ZeroMalloc(sizeof(HASH_LIST)); - - h->Bits = bits; - h->Size = Power(2, bits); - - h->Lock = NewLock(); - h->Ref = NewRef(); - - h->Entries = ZeroMalloc(sizeof(LIST *) * h->Size); - - h->GetHashProc = get_hash_proc; - h->CompareProc = compare_proc; - - if (make_list) - { - h->AllList = NewListFast(NULL); - } - - return h; -} - -// Release the hash list -void ReleaseHashList(HASH_LIST *h) -{ - // Validate arguments - if (h == NULL) - { - return; - } - - if (Release(h->Ref) == 0) - { - CleanupHashList(h); - } -} -void CleanupHashList(HASH_LIST *h) -{ - UINT i; - // Validate arguments - if (h == NULL) - { - return; - } - - for (i = 0;i < h->Size;i++) - { - LIST *o = h->Entries[i]; - - if (o != NULL) - { - ReleaseList(o); - } - } - - Free(h->Entries); - - DeleteLock(h->Lock); - - if (h->AllList != NULL) - { - ReleaseList(h->AllList); - } - - Free(h); -} - -// Append a string to the buffer -void AppendBufStr(BUF *b, char *str) -{ - // Validate arguments - if (b == NULL || str == NULL) - { - return; - } - - WriteBuf(b, str, StrLen(str)); -} - -// Add a UTF-8 string to the buffer -void AppendBufUtf8(BUF *b, wchar_t *str) -{ - UINT size; - UCHAR *data; - // Validate arguments - if (b == NULL || str == NULL) - { - return; - } - - size = CalcUniToUtf8(str) + 1; - data = ZeroMalloc(size); - - UniToUtf8(data, size, str); - - WriteBuf(b, data, size - 1); - - Free(data); -} - -// Creating a shared buffer -SHARED_BUFFER *NewSharedBuffer(void *data, UINT size) -{ - SHARED_BUFFER *b = ZeroMalloc(sizeof(SHARED_BUFFER)); - - b->Ref = NewRef(); - b->Data = ZeroMalloc(size); - b->Size = size; - - if (data != NULL) - { - Copy(b->Data, data, size); - } - - return b; -} - -// Release of the shared buffer -void ReleaseSharedBuffer(SHARED_BUFFER *b) -{ - // Validate arguments - if (b == NULL) - { - return; - } - - if (Release(b->Ref) == 0) - { - CleanupSharedBuffer(b); - } -} -void CleanupSharedBuffer(SHARED_BUFFER *b) -{ - // Validate arguments - if (b == NULL) - { - return; - } - - Free(b->Data); - - Free(b); -} - -// Calculation of a ^ b (a to the b-th power) -UINT Power(UINT a, UINT b) -{ - UINT ret, i; - if (a == 0) - { - return 0; - } - if (b == 0) - { - return 1; - } - - ret = 1; - for (i = 0;i < b;i++) - { - ret *= a; - } - - return ret; -} - -// Search in the binary -UINT SearchBin(void *data, UINT data_start, UINT data_size, void *key, UINT key_size) -{ - UINT i; - // Validate arguments - if (data == NULL || key == NULL || key_size == 0 || data_size == 0 || - (data_start >= data_size) || (data_start + key_size > data_size)) - { - return INFINITE; - } - - for (i = data_start;i < (data_size - key_size + 1);i++) - { - UCHAR *p = ((UCHAR *)data) + i; - - if (Cmp(p, key, key_size) == 0) - { - return i; - } - } - - return INFINITE; -} - -// Crash immediately -void CrashNow() -{ - while (true) - { - UINT r = Rand32(); - UCHAR *c = (UCHAR *)r; - - *c = Rand8(); - } -} - -// Convert the buffer to candidate -LIST *BufToCandidate(BUF *b) -{ - LIST *o; - UINT i; - UINT num; - // Validate arguments - if (b == NULL) - { - return NULL; - } - - num = ReadBufInt(b); - o = NewCandidateList(); - - for (i = 0;i < num;i++) - { - CANDIDATE *c; - wchar_t *s; - UINT64 sec64; - UINT len, size; - sec64 = ReadBufInt64(b); - len = ReadBufInt(b); - if (len >= 65536) - { - break; - } - size = (len + 1) * 2; - s = ZeroMalloc(size); - if (ReadBuf(b, s, size) != size) - { - Free(s); - break; - } - else - { - c = ZeroMalloc(sizeof(CANDIDATE)); - c->LastSelectedTime = sec64; - c->Str = s; - Add(o, c); - } - } - - Sort(o); - return o; -} - -// Convert the candidate to buffer -BUF *CandidateToBuf(LIST *o) -{ - BUF *b; - UINT i; - // Validate arguments - if (o == NULL) - { - return NULL; - } - - b = NewBuf(); - WriteBufInt(b, LIST_NUM(o)); - for (i = 0;i < LIST_NUM(o);i++) - { - CANDIDATE *c = LIST_DATA(o, i); - WriteBufInt64(b, c->LastSelectedTime); - WriteBufInt(b, UniStrLen(c->Str)); - WriteBuf(b, c->Str, UniStrSize(c->Str)); - } - - SeekBuf(b, 0, 0); - - return b; -} - -// Adding a candidate -void AddCandidate(LIST *o, wchar_t *str, UINT num_max) -{ - UINT i; - bool exists; - // Validate arguments - if (o == NULL || str == NULL) - { - return; - } - if (num_max == 0) - { - num_max = 0x7fffffff; - } - - // String copy - str = UniCopyStr(str); - UniTrim(str); - - exists = false; - for (i = 0;i < LIST_NUM(o);i++) - { - CANDIDATE *c = LIST_DATA(o, i); - if (UniStrCmpi(c->Str, str) == 0) - { - // Update the time that an existing entry have been found - c->LastSelectedTime = SystemTime64(); - exists = true; - break; - } - } - - if (exists == false) - { - // Insert new - CANDIDATE *c = ZeroMalloc(sizeof(CANDIDATE)); - c->LastSelectedTime = SystemTime64(); - c->Str = UniCopyStr(str); - Insert(o, c); - } - - // Release the string - Free(str); - - // Check the current number of candidates. - // If it is more than num_max, remove from an oldest candidate sequentially. - if (LIST_NUM(o) > num_max) - { - while (LIST_NUM(o) > num_max) - { - UINT index = LIST_NUM(o) - 1; - CANDIDATE *c = LIST_DATA(o, index); - Delete(o, c); - Free(c->Str); - Free(c); - } - } -} - -// Comparison of candidates -int CompareCandidate(void *p1, void *p2) -{ - CANDIDATE *c1, *c2; - if (p1 == NULL || p2 == NULL) - { - return 0; - } - c1 = *(CANDIDATE **)p1; - c2 = *(CANDIDATE **)p2; - if (c1 == NULL || c2 == NULL) - { - return 0; - } - if (c1->LastSelectedTime > c2->LastSelectedTime) - { - return -1; - } - else if (c1->LastSelectedTime < c2->LastSelectedTime) - { - return 1; - } - else - { - return UniStrCmpi(c1->Str, c2->Str); - } -} - -// Release of the candidate list -void FreeCandidateList(LIST *o) -{ - UINT i; - // Validate arguments - if (o == NULL) - { - return; - } - - for (i = 0;i < LIST_NUM(o);i++) - { - CANDIDATE *c = LIST_DATA(o, i); - Free(c->Str); - Free(c); - } - - ReleaseList(o); -} - -// Creating a new candidate list -LIST *NewCandidateList() -{ - return NewList(CompareCandidate); -} - -// Examine whether the specified address points all-zero area -bool IsZero(void *data, UINT size) -{ - UINT i; - UCHAR *c = (UCHAR *)data; - // Validate arguments - if (data == NULL || size == 0) - { - return true; - } - - for (i = 0;i < size;i++) - { - if (c[i] != 0) - { - return false; - } - } - - return true; -} - -// Expand the data -UINT Uncompress(void *dst, UINT dst_size, void *src, UINT src_size) -{ - unsigned long dst_size_long = dst_size; - // Validate arguments - if (dst == NULL || dst_size_long == 0 || src == NULL) - { - return 0; - } - - if (uncompress(dst, &dst_size_long, src, src_size) != Z_OK) - { - return 0; - } - - return (UINT)dst_size_long; -} -BUF *UncompressBuf(BUF *src_buf) -{ - UINT dst_size, dst_size2; - UCHAR *dst; - BUF *b; - // Validate arguments - if (src_buf == NULL) - { - return NULL; - } - - SeekBuf(src_buf, 0, 0); - dst_size = ReadBufInt(src_buf); - - dst = Malloc(dst_size); - - dst_size2 = Uncompress(dst, dst_size, ((UCHAR *)src_buf->Buf) + sizeof(UINT), src_buf->Size - sizeof(UINT)); - - b = NewBuf(); - WriteBuf(b, dst, dst_size2); - Free(dst); - - return b; -} - -// Compress the data -UINT Compress(void *dst, UINT dst_size, void *src, UINT src_size) -{ - return CompressEx(dst, dst_size, src, src_size, Z_DEFAULT_COMPRESSION); -} -BUF *CompressBuf(BUF *src_buf) -{ - UINT dst_size; - UCHAR *dst_buf; - BUF *b; - // Validate arguments - if (src_buf == NULL) - { - return NULL; - } - - dst_size = CalcCompress(src_buf->Size); - dst_buf = Malloc(dst_size); - - dst_size = Compress(dst_buf, dst_size, src_buf->Buf, src_buf->Size); - - if (dst_size == 0) - { - Free(dst_buf); - return NULL; - } - - b = NewBuf(); - WriteBufInt(b, src_buf->Size); - WriteBuf(b, dst_buf, dst_size); - - Free(dst_buf); - - return b; -} - -// Compress the data with options -UINT CompressEx(void *dst, UINT dst_size, void *src, UINT src_size, UINT level) -{ - unsigned long dst_size_long = dst_size; - // Validate arguments - if (dst == NULL || dst_size_long == 0 || src == NULL) - { - return 0; - } - - if (compress2(dst, &dst_size_long, src, src_size, (int)level) != Z_OK) - { - return 0; - } - - return dst_size_long; -} - -// Get the maximum size of compressed data from data of src_size -UINT CalcCompress(UINT src_size) -{ - return src_size * 2 + 256; -} - -// Creating a Stack -SK *NewSk() -{ - return NewSkEx(false); -} -SK *NewSkEx(bool no_compact) -{ - SK *s; - - s = Malloc(sizeof(SK)); - s->lock = NewLock(); - s->ref = NewRef(); - s->num_item = 0; - s->num_reserved = INIT_NUM_RESERVED; - s->p = Malloc(sizeof(void *) * s->num_reserved); - s->no_compact = no_compact; - - // KS - KS_INC(KS_NEWSK_COUNT); - - return s; -} - -// Release of the stack -void ReleaseSk(SK *s) -{ - // Validate arguments - if (s == NULL) - { - return; - } - - if (Release(s->ref) == 0) - { - CleanupSk(s); - } -} - -// Clean up the stack -void CleanupSk(SK *s) -{ - // Validate arguments - if (s == NULL) - { - return; - } - - // Memory release - Free(s->p); - DeleteLock(s->lock); - Free(s); - - // KS - KS_INC(KS_FREESK_COUNT); -} - -// Lock of the stack -void LockSk(SK *s) -{ - // Validate arguments - if (s == NULL) - { - return; - } - - Lock(s->lock); -} - -// Unlock the stack -void UnlockSk(SK *s) -{ - // Validate arguments - if (s == NULL) - { - return; - } - - Unlock(s->lock); -} - -// Push to the stack -void Push(SK *s, void *p) -{ - UINT i; - // Validate arguments - if (s == NULL || p == NULL) - { - return; - } - - i = s->num_item; - s->num_item++; - - // Size expansion - if (s->num_item > s->num_reserved) - { - s->num_reserved = s->num_reserved * 2; - s->p = ReAlloc(s->p, sizeof(void *) * s->num_reserved); - } - s->p[i] = p; - - // KS - KS_INC(KS_PUSH_COUNT); -} - -// Pop from the stack -void *Pop(SK *s) -{ - void *ret; - // Validate arguments - if (s == NULL) - { - return NULL; - } - if (s->num_item == 0) - { - return NULL; - } - ret = s->p[s->num_item - 1]; - s->num_item--; - - // Size reduction - if (s->no_compact == false) - { - // Not to shrink when no_compact is true - if ((s->num_item * 2) <= s->num_reserved) - { - if (s->num_reserved >= (INIT_NUM_RESERVED * 2)) - { - s->num_reserved = s->num_reserved / 2; - s->p = ReAlloc(s->p, sizeof(void *) * s->num_reserved); - } - } - } - - // KS - KS_INC(KS_POP_COUNT); - - return ret; -} - -// Get the number of queued items -UINT GetQueueNum(QUEUE *q) -{ - // Validate arguments - if (q == NULL) - { - return 0; - } - - return q->num_item; -} - -// Get one -void *GetNext(QUEUE *q) -{ - void *p = NULL; - // Validate arguments - if (q == NULL) - { - return NULL; - } - - if (q->num_item == 0) - { - // No items - return NULL; - } - - // Read from the FIFO - ReadFifo(q->fifo, &p, sizeof(void *)); - q->num_item--; - - // KS - KS_INC(KS_GETNEXT_COUNT); - - return p; -} - -// Get one item from the queue (locking) -void *GetNextWithLock(QUEUE *q) -{ - void *p; - // Validate arguments - if (q == NULL) - { - return NULL; - } - - LockQueue(q); - { - p = GetNext(q); - } - UnlockQueue(q); - - return p; -} - -// Insert the int type in the queue -void InsertQueueInt(QUEUE *q, UINT value) -{ - UINT *p; - // Validate arguments - if (q == NULL) - { - return; - } - - p = Clone(&value, sizeof(UINT)); - - InsertQueue(q, p); -} - -// Insert to the queue -void InsertQueue(QUEUE *q, void *p) -{ - // Validate arguments - if (q == NULL || p == NULL) - { - return; - } - - // Write to the FIFO - WriteFifo(q->fifo, &p, sizeof(void *)); - - q->num_item++; - - /*{ - static UINT max_num_item; - static UINT64 next_tick = 0; - UINT64 now = Tick64(); - - max_num_item = MAX(q->num_item, max_num_item); - - if (next_tick == 0 || next_tick <= now) - { - next_tick = now + (UINT64)1000; - - printf("max_queue = %u\n", max_num_item); - } - }*/ - - // KS - KS_INC(KS_INSERT_QUEUE_COUNT); -} - -// Insert to the queue (locking) -void InsertQueueWithLock(QUEUE *q, void *p) -{ - // Validate arguments - if (q == NULL || p == NULL) - { - return; - } - - LockQueue(q); - { - InsertQueue(q, p); - } - UnlockQueue(q); -} - -// Lock the queue -void LockQueue(QUEUE *q) -{ - // Validate arguments - if (q == NULL) - { - return; - } - - Lock(q->lock); -} - -// Unlock the queue -void UnlockQueue(QUEUE *q) -{ - // Validate arguments - if (q == NULL) - { - return; - } - - Unlock(q->lock); -} - -// Release of the queue -void ReleaseQueue(QUEUE *q) -{ - // Validate arguments - if (q == NULL) - { - return; - } - - if (q->ref == NULL || Release(q->ref) == 0) - { - CleanupQueue(q); - } -} - -// Clean-up the queue -void CleanupQueue(QUEUE *q) -{ - // Validate arguments - if (q == NULL) - { - return; - } - - // Memory release - ReleaseFifo(q->fifo); - DeleteLock(q->lock); - Free(q); - - // KS - KS_INC(KS_FREEQUEUE_COUNT); -} - -// Creating a Queue -QUEUE *NewQueue() -{ - QUEUE *q; - - q = ZeroMalloc(sizeof(QUEUE)); - q->lock = NewLock(); - q->ref = NewRef(); - q->num_item = 0; - q->fifo = NewFifo(); - - // KS - KS_INC(KS_NEWQUEUE_COUNT); - - return q; -} -QUEUE *NewQueueFast() -{ - QUEUE *q; - - q = ZeroMalloc(sizeof(QUEUE)); - q->lock = NULL; - q->ref = NULL; - q->num_item = 0; - q->fifo = NewFifoFast(); - - // KS - KS_INC(KS_NEWQUEUE_COUNT); - - return q; -} - -// Clone the list -LIST *CloneList(LIST *o) -{ - LIST *n = NewList(o->cmp); - - // Memory reallocation - Free(n->p); - n->p = ToArray(o); - n->num_item = n->num_reserved = LIST_NUM(o); - n->sorted = o->sorted; - - return n; -} - -// Copy the list to an array -void CopyToArray(LIST *o, void *p) -{ - // Validate arguments - if (o == NULL || p == NULL) - { - return; - } - - // KS - KS_INC(KS_TOARRAY_COUNT); - - Copy(p, o->p, sizeof(void *) * o->num_item); -} - -// Arrange the list to an array -void *ToArray(LIST *o) -{ - return ToArrayEx(o, false); -} -void *ToArrayEx(LIST *o, bool fast) -{ - void *p; - // Validate arguments - if (o == NULL) - { - return NULL; - } - - // Memory allocation - if (fast == false) - { - p = Malloc(sizeof(void *) * LIST_NUM(o)); - } - else - { - p = MallocFast(sizeof(void *) * LIST_NUM(o)); - } - // Copy - CopyToArray(o, p); - - return p; -} - -// Search in the list -void *Search(LIST *o, void *target) -{ - void **ret; - // Validate arguments - if (o == NULL || target == NULL) - { - return NULL; - } - if (o->cmp == NULL) - { - return NULL; - } - - // Check the sort - if (o->sorted == false) - { - // Sort because it is not sorted - Sort(o); - } - - ret = (void **)bsearch(&target, o->p, o->num_item, sizeof(void *), - (int(*)(const void *, const void *))o->cmp); - - // KS - KS_INC(KS_SEARCH_COUNT); - - if (ret != NULL) - { - return *ret; - } - else - { - return NULL; - } -} - -// Insert an item to the list -void Insert(LIST *o, void *p) -{ - int low, high, middle; - UINT pos; - int i; - // Validate arguments - if (o == NULL || p == NULL) - { - return; - } - - if (o->cmp == NULL) - { - // adding simply if there is no sort function - Add(o, p); - return; - } - - // Sort immediately if it is not sorted - if (o->sorted == false) - { - Sort(o); - } - - low = 0; - high = LIST_NUM(o) - 1; - - pos = INFINITE; - - while (low <= high) - { - int ret; - - middle = (low + high) / 2; - ret = o->cmp(&(o->p[middle]), &p); - - if (ret == 0) - { - pos = middle; - break; - } - else if (ret > 0) - { - high = middle - 1; - } - else - { - low = middle + 1; - } - } - - if (pos == INFINITE) - { - pos = low; - } - - o->num_item++; - if (o->num_item > o->num_reserved) - { - o->num_reserved *= 2; - o->p = ReAlloc(o->p, sizeof(void *) * o->num_reserved); - } - - if (LIST_NUM(o) >= 2) - { - for (i = (LIST_NUM(o) - 2);i >= (int)pos;i--) - { - o->p[i + 1] = o->p[i]; - } - } - - o->p[pos] = p; - - // KS - KS_INC(KS_INSERT_COUNT); -} - -// Sort the list -void Sort(LIST *o) -{ - // Validate arguments - if (o == NULL || o->cmp == NULL) - { - return; - } - - qsort(o->p, o->num_item, sizeof(void *), (int(*)(const void *, const void *))o->cmp); - o->sorted = true; - - // KS - KS_INC(KS_SORT_COUNT); -} - -// Replace the pointer in the list -bool ReplaceListPointer(LIST *o, void *oldptr, void *newptr) -{ - UINT i; - // Validate arguments - if (o == NULL || oldptr == NULL || newptr == NULL) - { - return false; - } - - for (i = 0;i < LIST_NUM(o);i++) - { - void *p = LIST_DATA(o, i); - - if (p == oldptr) - { - o->p[i] = newptr; - return true; - } - } - - return false; -} - -// New string list -LIST *NewStrList() -{ - return NewListFast(CompareStr); -} - -// Release string list -void ReleaseStrList(LIST *o) -{ - UINT i; - if (o == NULL) - { - return; - } - - for (i = 0;i < LIST_NUM(o);i++) - { - char *s = LIST_DATA(o, i); - Free(s); - } - - ReleaseList(o); -} - -// Add a string distinct to the string list -bool AddStrToStrListDistinct(LIST *o, char *str) -{ - if (o == NULL || str == NULL) - { - return false; - } - - if (IsInListStr(o, str) == false) - { - Add(o, CopyStr(str)); - - return true; - } - - return false; -} - -// Examine whether a string items are present in the list -bool IsInListStr(LIST *o, char *str) -{ - UINT i; - // Validate arguments - if (o == NULL || str == NULL) - { - return false; - } - - for (i = 0;i < LIST_NUM(o);i++) - { - char *s = LIST_DATA(o, i); - - if (StrCmpi(s, str) == 0) - { - return true; - } - } - - return false; -} - -bool IsInListUniStr(LIST *o, wchar_t *str) -{ - UINT i; - // Validate arguments - if (o == NULL || str == NULL) - { - return false; - } - - for (i = 0; i < LIST_NUM(o); i++) - { - wchar_t *s = LIST_DATA(o, i); - - if (UniStrCmpi(s, str) == 0) - { - return true; - } - } - - return false; -} - -// Get the pointer by scanning by UINT pointer in the list -void *ListKeyToPointer(LIST *o, UINT key) -{ - UINT i; - // Validate arguments - if (o == NULL || key == 0) - { - return NULL; - } - - for (i = 0;i < LIST_NUM(o);i++) - { - void *p = LIST_DATA(o, i); - - if (POINTER_TO_KEY(p) == key) - { - return p; - } - } - - return NULL; -} - -// Examine whether the key is present in the list -bool IsInListKey(LIST *o, UINT key) -{ - void *p; - // Validate arguments - if (o == NULL || key == 0) - { - return false; - } - - p = ListKeyToPointer(o, key); - if (p == NULL) - { - return false; - } - - return true; -} - -// Examine whether the item exists in the list -bool IsInList(LIST *o, void *p) -{ - UINT i; - // Validate arguments - if (o == NULL || p == NULL) - { - return false; - } - - for (i = 0;i < LIST_NUM(o);i++) - { - void *q = LIST_DATA(o, i); - if (p == q) - { - return true; - } - } - - return false; -} - -// Add an element to the list (Don't add if it already exists) -void AddDistinct(LIST *o, void *p) -{ - // Validate arguments - if (o == NULL || p == NULL) - { - return; - } - - if (IsInList(o, p)) - { - return; - } - - Add(o, p); -} - -// Add an element to the list -void Add(LIST *o, void *p) -{ - UINT i; - // Validate arguments - if (o == NULL || p == NULL) - { - return; - } - - i = o->num_item; - o->num_item++; - - if (o->num_item > o->num_reserved) - { - o->num_reserved = o->num_reserved * 2; - o->p = ReAlloc(o->p, sizeof(void *) * o->num_reserved); - } - - o->p[i] = p; - o->sorted = false; - - // KS - KS_INC(KS_INSERT_COUNT); -} - -// Delete the element from the list -bool Delete(LIST *o, void *p) -{ - UINT i, n; - // Validate arguments - if (o == NULL || p == NULL) - { - return false; - } - - for (i = 0;i < o->num_item;i++) - { - if (o->p[i] == p) - { - break; - } - } - if (i == o->num_item) - { - return false; - } - - n = i; - for (i = n;i < (o->num_item - 1);i++) - { - o->p[i] = o->p[i + 1]; - } - o->num_item--; - if ((o->num_item * 2) <= o->num_reserved) - { - if (o->num_reserved > (INIT_NUM_RESERVED * 2)) - { - o->num_reserved = o->num_reserved / 2; - o->p = ReAlloc(o->p, sizeof(void *) * o->num_reserved); - } - } - - // KS - KS_INC(KS_DELETE_COUNT); - - return true; -} - -// Delete all elements from the list -void DeleteAll(LIST *o) -{ - // Validate arguments - if (o == NULL) - { - return; - } - - o->num_item = 0; - o->num_reserved = INIT_NUM_RESERVED; - o->p = ReAlloc(o->p, sizeof(void *) * INIT_NUM_RESERVED); -} - -// Lock the list -void LockList(LIST *o) -{ - // Validate arguments - if (o == NULL) - { - return; - } - - Lock(o->lock); -} - -// Unlock the list -void UnlockList(LIST *o) -{ - // Validate arguments - if (o == NULL) - { - return; - } - - Unlock(o->lock); -} - -// Release the list -void ReleaseList(LIST *o) -{ - // Validate arguments - if (o == NULL) - { - return; - } - - if (o->ref == NULL || Release(o->ref) == 0) - { - CleanupList(o); - } -} - -// Clean up the list -void CleanupList(LIST *o) -{ - // Validate arguments - if (o == NULL) - { - return; - } - - Free(o->p); - if (o->lock != NULL) - { - DeleteLock(o->lock); - } - Free(o); - - // KS - KS_INC(KS_FREELIST_COUNT); -} - -// Check whether the specified number is already in the list -bool IsIntInList(LIST *o, UINT i) -{ - UINT j; - // Validate arguments - if (o == NULL) - { - return false; - } - - for (j = 0;j < LIST_NUM(o);j++) - { - UINT *p = LIST_DATA(o, j); - - if (*p == i) - { - return true; - } - } - - return false; -} -bool IsInt64InList(LIST *o, UINT64 i) -{ - UINT j; - // Validate arguments - if (o == NULL) - { - return false; - } - - for (j = 0;j < LIST_NUM(o);j++) - { - UINT64 *p = LIST_DATA(o, j); - - if (*p == i) - { - return true; - } - } - - return false; -} - -// Release the integer list -void ReleaseIntList(LIST *o) -{ - UINT i; - // Validate arguments - if (o == NULL) - { - return; - } - - for (i = 0;i < LIST_NUM(o);i++) - { - UINT *p = LIST_DATA(o, i); - - Free(p); - } - - ReleaseList(o); -} -void ReleaseInt64List(LIST *o) -{ - UINT i; - // Validate arguments - if (o == NULL) - { - return; - } - - for (i = 0;i < LIST_NUM(o);i++) - { - UINT64 *p = LIST_DATA(o, i); - - Free(p); - } - - ReleaseList(o); -} - -// Delete an integer from list -void DelInt(LIST *o, UINT i) -{ - LIST *o2 = NULL; - UINT j; - // Validate arguments - if (o == NULL) - { - return; - } - - for (j = 0;j < LIST_NUM(o);j++) - { - UINT *p = LIST_DATA(o, j); - - if (*p == i) - { - if (o2 == NULL) - { - o2 = NewListFast(NULL); - } - Add(o2, p); - } - } - - for (j = 0;j < LIST_NUM(o2);j++) - { - UINT *p = LIST_DATA(o2, j); - - Delete(o, p); - - Free(p); - } - - if (o2 != NULL) - { - ReleaseList(o2); - } -} - -// Create a new list of integers -LIST *NewIntList(bool sorted) -{ - LIST *o = NewList(sorted ? CompareInt : NULL); - - return o; -} -LIST *NewInt64List(bool sorted) -{ - LIST *o = NewList(sorted ? CompareInt64 : NULL); - - return o; -} - -// Comparison of items in the list of integers -int CompareInt(void *p1, void *p2) -{ - UINT *v1, *v2; - if (p1 == NULL || p2 == NULL) - { - return 0; - } - - v1 = *((UINT **)p1); - v2 = *((UINT **)p2); - if (v1 == NULL || v2 == NULL) - { - return 0; - } - - return COMPARE_RET(*v1, *v2); -} -int CompareInt64(void *p1, void *p2) -{ - UINT64 *v1, *v2; - if (p1 == NULL || p2 == NULL) - { - return 0; - } - - v1 = *((UINT64 **)p1); - v2 = *((UINT64 **)p2); - if (v1 == NULL || v2 == NULL) - { - return 0; - } - - return COMPARE_RET(*v1, *v2); -} - -// Add an integer to the list -void AddInt(LIST *o, UINT i) -{ - // Validate arguments - if (o == NULL) - { - return; - } - - Add(o, Clone(&i, sizeof(UINT))); -} -void AddInt64(LIST *o, UINT64 i) -{ - // Validate arguments - if (o == NULL) - { - return; - } - - Add(o, Clone(&i, sizeof(UINT64))); -} -void InsertInt(LIST *o, UINT i) -{ - // Validate arguments - if (o == NULL) - { - return; - } - - Insert(o, Clone(&i, sizeof(UINT))); -} - -// Add an integer to the list (no duplicates) -void AddIntDistinct(LIST *o, UINT i) -{ - // Validate arguments - if (o == NULL) - { - return; - } - - if (IsIntInList(o, i) == false) - { - AddInt(o, i); - } -} -void AddInt64Distinct(LIST *o, UINT64 i) -{ - // Validate arguments - if (o == NULL) - { - return; - } - - if (IsInt64InList(o, i) == false) - { - AddInt64(o, i); - } -} -void InsertIntDistinct(LIST *o, UINT i) -{ - // Validate arguments - if (o == NULL) - { - return; - } - - if (IsIntInList(o, i) == false) - { - InsertInt(o, i); - } -} - -// String comparison function (Unicode) -int CompareUniStr(void *p1, void *p2) -{ - wchar_t *s1, *s2; - if (p1 == NULL || p2 == NULL) - { - return 0; - } - s1 = *(wchar_t **)p1; - s2 = *(wchar_t **)p2; - - return UniStrCmp(s1, s2); -} - -// Insert the string to the list -bool InsertStr(LIST *o, char *str) -{ - // Validate arguments - if (o == NULL || str == NULL) - { - return false; - } - - if (Search(o, str) == NULL) - { - Insert(o, str); - - return true; - } - - return false; -} - -// String comparison function -int CompareStr(void *p1, void *p2) -{ - char *s1, *s2; - if (p1 == NULL || p2 == NULL) - { - return 0; - } - s1 = *(char **)p1; - s2 = *(char **)p2; - - return StrCmpi(s1, s2); -} - -// Create a list with an item -LIST *NewListSingle(void *p) -{ - LIST *o = NewListFast(NULL); - - Add(o, p); - - return o; -} - -// Creating a high-speed list (without lock) -LIST *NewListFast(COMPARE *cmp) -{ - return NewListEx(cmp, true); -} - -// Creating a list -LIST *NewList(COMPARE *cmp) -{ - return NewListEx(cmp, false); -} -LIST *NewListEx(COMPARE *cmp, bool fast) -{ - return NewListEx2(cmp, fast, false); -} -LIST *NewListEx2(COMPARE *cmp, bool fast, bool fast_malloc) -{ - LIST *o; - - if (fast_malloc == false) - { - o = Malloc(sizeof(LIST)); - } - else - { - o = MallocFast(sizeof(LIST)); - } - - if (fast == false) - { - o->lock = NewLock(); - o->ref = NewRef(); - } - else - { - o->lock = NULL; - o->ref = NULL; - } - o->num_item = 0; - o->num_reserved = INIT_NUM_RESERVED; - o->Param1 = 0; - - if (fast_malloc == false) - { - o->p = Malloc(sizeof(void *) * o->num_reserved); - } - else - { - o->p = MallocFast(sizeof(void *) * o->num_reserved); - } - - o->cmp = cmp; - o->sorted = true; - - // KS - KS_INC(KS_NEWLIST_COUNT); - - return o; -} - -// Parses a string by identifying its parts using the specified separators -LIST *NewEntryList(char *src, char *key_separator, char *value_separator) -{ - LIST *o = NewListFast(NULL); - TOKEN_LIST *t; - - t = ParseTokenWithoutNullStr(src, key_separator); - if (t != NULL) - { - UINT i; - - for (i = 0; i < t->NumTokens; i++) - { - char key[MAX_SIZE]; - char value[MAX_SIZE]; - char *line = t->Token[i]; - Trim(line); - - if (GetKeyAndValue(line, key, sizeof(key), value, sizeof(value), value_separator)) - { - INI_ENTRY *e = ZeroMalloc(sizeof(INI_ENTRY)); - - e->Key = CopyStr(key); - e->Value = CopyStr(value); - - Add(o, e); - } - } - - FreeToken(t); - } - - return o; -} - -// Checks whether the list contains the specified entry -bool EntryListHasKey(LIST *o, char *key) -{ - // Validate arguments - if (o == NULL || key == NULL) - { - return false; - } - - if (GetIniEntry(o, key) != NULL) - { - return true; - } - - return false; -} - -// Gets the value of the specified key from the entry list -char *EntryListStrValue(LIST *o, char *key) -{ - return IniStrValue(o, key); -} - -UINT EntryListIntValue(LIST *o, char *key) -{ - return IniIntValue(o, key); -} - -// Release the entry list -void FreeEntryList(LIST *o) -{ - // Validate arguments - if (o == NULL) - { - return; - } - - FreeIni(o); -} - -// Read all data from FIFO -BUF *ReadFifoAll(FIFO *f) -{ - BUF *buf; - UCHAR *tmp; - UINT size; - if (f == NULL) - { - return NewBuf(); - } - - size = FifoSize(f); - tmp = Malloc(size); - ReadFifo(f, tmp, size); - - buf = MemToBuf(tmp, size); - - Free(tmp); - - return buf; -} - -// Read from the FIFO -UINT ReadFifo(FIFO *f, void *p, UINT size) -{ - UINT read_size; - // Validate arguments - if (f == NULL || size == 0) - { - return 0; - } - - read_size = MIN(size, f->size); - if (read_size == 0) - { - return 0; - } - if (p != NULL) - { - Copy(p, (UCHAR *)f->p + f->pos, read_size); - } - f->pos += read_size; - f->size -= read_size; - - f->total_read_size += (UINT64)read_size; - - if (f->fixed == false) - { - if (f->size == 0) - { - f->pos = 0; - } - } - - ShrinkFifoMemory(f); - - // KS - KS_INC(KS_READ_FIFO_COUNT); - - return read_size; -} - -// Rearrange the memory -void ShrinkFifoMemory(FIFO *f) -{ - // Validate arguments - if (f == NULL) - { - return; - } - - if (f->fixed) - { - return; - } - - // Rearrange the memory - if (f->pos >= FIFO_INIT_MEM_SIZE && - f->memsize >= fifo_current_realloc_mem_size && - (f->memsize / 2) > f->size) - { - void *new_p; - UINT new_size; - - new_size = MAX(f->memsize / 2, FIFO_INIT_MEM_SIZE); - new_p = Malloc(new_size); - Copy(new_p, (UCHAR *)f->p + f->pos, f->size); - - Free(f->p); - - f->memsize = new_size; - f->p = new_p; - f->pos = 0; - } -} - -// Write to the FIFO -void WriteFifo(FIFO *f, void *p, UINT size) -{ - UINT i, need_size; - bool realloc_flag; - // Validate arguments - if (f == NULL || size == 0) - { - return; - } - - i = f->size; - f->size += size; - need_size = f->pos + f->size; - realloc_flag = false; - - // Memory expansion - while (need_size > f->memsize) - { - f->memsize = MAX(f->memsize, FIFO_INIT_MEM_SIZE) * 3; - realloc_flag = true; - } - - if (realloc_flag) - { - f->p = ReAlloc(f->p, f->memsize); - } - - // Write the data - if (p != NULL) - { - Copy((UCHAR *)f->p + f->pos + i, p, size); - } - - f->total_write_size += (UINT64)size; - - // KS - KS_INC(KS_WRITE_FIFO_COUNT); -} - -// Get the current pointer of the FIFO -UCHAR *GetFifoPointer(FIFO *f) -{ - // Validate arguments - if (f == NULL) - { - return NULL; - } - - return ((UCHAR *)f->p) + f->pos; -} -UCHAR *FifoPtr(FIFO *f) -{ - return GetFifoPointer(f); -} - -// Get the size of the FIFO -UINT FifoSize(FIFO *f) -{ - // Validate arguments - if (f == NULL) - { - return 0; - } - - return f->size; -} - -// Release the FIFO -void ReleaseFifo(FIFO *f) -{ - // Validate arguments - if (f == NULL) - { - return; - } - - if (f->ref == NULL || Release(f->ref) == 0) - { - CleanupFifo(f); - } -} - -// Clean-up the FIFO -void CleanupFifo(FIFO *f) -{ - // Validate arguments - if (f == NULL) - { - return; - } - - DeleteLock(f->lock); - Free(f->p); - Free(f); - - // KS - KS_INC(KS_FREEFIFO_COUNT); -} - -// Initialize the FIFO system -void InitFifo() -{ - fifo_current_realloc_mem_size = FIFO_REALLOC_MEM_SIZE; -} - -// Create a FIFO -FIFO *NewFifo() -{ - return NewFifoEx(false); -} -FIFO *NewFifoFast() -{ - return NewFifoEx(true); -} -FIFO *NewFifoEx(bool fast) -{ - return NewFifoEx2(fast, false); -} -FIFO *NewFifoEx2(bool fast, bool fixed) -{ - FIFO *f; - - // Memory allocation - f = ZeroMalloc(sizeof(FIFO)); - - if (fast == false) - { - f->lock = NewLock(); - f->ref = NewRef(); - } - else - { - f->lock = NULL; - f->ref = NULL; - } - - f->size = f->pos = 0; - f->memsize = FIFO_INIT_MEM_SIZE; - f->p = Malloc(FIFO_INIT_MEM_SIZE); - f->fixed = false; - - // KS - KS_INC(KS_NEWFIFO_COUNT); - - return f; -} - -// Set the default memory reclaiming size of the FIFO -void SetFifoCurrentReallocMemSize(UINT size) -{ - if (size == 0) - { - size = FIFO_REALLOC_MEM_SIZE; - } - - fifo_current_realloc_mem_size = size; -} - -// Read a buffer from a file -BUF *FileToBuf(IO *o) -{ - UCHAR hash1[MD5_SIZE], hash2[MD5_SIZE]; - UINT size; - void *buf; - BUF *b; - - // Validate arguments - if (o == NULL) - { - return NULL; - } - - // Read the size - if (FileRead(o, &size, sizeof(size)) == false) - { - return NULL; - } - size = Endian32(size); - - if (size > FileSize(o)) - { - return NULL; - } - - // Read a hash - if (FileRead(o, hash1, sizeof(hash1)) == false) - { - return NULL; - } - - // Read from the buffer - buf = Malloc(size); - if (FileRead(o, buf, size) == false) - { - Free(buf); - return NULL; - } - - // Take a hash - Md5(hash2, buf, size); - - // Compare the hashes - if (Cmp(hash1, hash2, sizeof(hash1)) != 0) - { - // Hashes are different - Free(buf); - return NULL; - } - - // Create a buffer - b = NewBuf(); - WriteBuf(b, buf, size); - Free(buf); - b->Current = 0; - - return b; -} - -// Read a dump file into a buffer -BUF *ReadDump(char *filename) -{ - return ReadDumpWithMaxSize(filename, 0); -} -BUF *ReadDumpWithMaxSize(char *filename, UINT max_size) -{ - IO *o; - BUF *b; - UINT size; - void *data; - // Validate arguments - if (filename == NULL) - { - return NULL; - } - - o = FileOpen(filename, false); - if (o == NULL) - { - return NULL; - } - - size = FileSize(o); - - if (max_size != 0) - { - if (size > max_size) - { - size = max_size; - } - } - - data = Malloc(size); - FileRead(o, data, size); - FileClose(o); - - b = NewBuf(); - WriteBuf(b, data, size); - b->Current = 0; - Free(data); - - return b; -} -BUF *ReadDumpW(wchar_t *filename) -{ - return ReadDumpExW(filename, true); -} -BUF *ReadDumpExW(wchar_t *filename, bool read_lock) -{ - IO *o; - BUF *b; - UINT size; - void *data; - // Validate arguments - if (filename == NULL) - { - return NULL; - } - - o = FileOpenExW(filename, false, read_lock); - if (o == NULL) - { - return NULL; - } - - size = FileSize(o); - data = Malloc(size); - FileRead(o, data, size); - FileClose(o); - - b = NewBuf(); - WriteBuf(b, data, size); - b->Current = 0; - Free(data); - - return b; -} - -// Write down the data -bool DumpDataW(void *data, UINT size, wchar_t *filename) -{ - IO *o; - // Validate arguments - if (filename == NULL || (size != 0 && data == NULL)) - { - return false; - } - - o = FileCreateW(filename); - if (o == NULL) - { - return false; - } - FileWrite(o, data, size); - FileClose(o); - - return true; -} - -// Dump the contents of the buffer to the file -bool DumpBuf(BUF *b, char *filename) -{ - IO *o; - // Validate arguments - if (b == NULL || filename == NULL) - { - return false; - } - - o = FileCreate(filename); - if (o == NULL) - { - return false; - } - FileWrite(o, b->Buf, b->Size); - FileClose(o); - - return true; -} -bool DumpBufW(BUF *b, wchar_t *filename) -{ - IO *o; - // Validate arguments - if (b == NULL || filename == NULL) - { - return false; - } - - o = FileCreateW(filename); - if (o == NULL) - { - return false; - } - FileWrite(o, b->Buf, b->Size); - FileClose(o); - - return true; -} - -// Write to the file only if the contents of the file is different -bool DumpBufWIfNecessary(BUF *b, wchar_t *filename) -{ - BUF *now; - bool need = true; - // Validate arguments - if (b == NULL || filename == NULL) - { - return false; - } - - now = ReadDumpW(filename); - - if (now != NULL) - { - if (CompareBuf(now, b)) - { - need = false; - } - - FreeBuf(now); - } - - if (need == false) - { - return true; - } - else - { - return DumpBufW(b, filename); - } -} - -// Write the buffer to a file -bool BufToFile(IO *o, BUF *b) -{ - UCHAR hash[MD5_SIZE]; - UINT size; - - // Validate arguments - if (o == NULL || b == NULL) - { - return false; - } - - // Hash the data - Md5(hash, b->Buf, b->Size); - - size = Endian32(b->Size); - - // Write the size - if (FileWrite(o, &size, sizeof(size)) == false) - { - return false; - } - - // Write a hash - if (FileWrite(o, hash, sizeof(hash)) == false) - { - return false; - } - - // Write the data - if (FileWrite(o, b->Buf, b->Size) == false) - { - return false; - } - - return true; -} - -// Create a buffer from memory -BUF *NewBufFromMemory(void *buf, UINT size) -{ - BUF *b; - // Validate arguments - if (buf == NULL && size != 0) - { - return NULL; - } - - b = NewBuf(); - WriteBuf(b, buf, size); - SeekBufToBegin(b); - - return b; -} - -// Creating a buffer -BUF *NewBuf() -{ - BUF *b; - - // Memory allocation - b = Malloc(sizeof(BUF)); - b->Buf = Malloc(INIT_BUF_SIZE); - b->Size = 0; - b->Current = 0; - b->SizeReserved = INIT_BUF_SIZE; - - // KS - KS_INC(KS_NEWBUF_COUNT); - KS_INC(KS_CURRENT_BUF_COUNT); - - return b; -} - -// Clearing the buffer -void ClearBuf(BUF *b) -{ - // Validate arguments - if (b == NULL) - { - return; - } - - b->Size = 0; - b->Current = 0; -} - -// Write to the buffer -void WriteBuf(BUF *b, void *buf, UINT size) -{ - UINT new_size; - // Validate arguments - if (b == NULL || buf == NULL || size == 0) - { - return; - } - - new_size = b->Current + size; - if (new_size > b->Size) - { - // Adjust the size - AdjustBufSize(b, new_size); - } - if (b->Buf != NULL) - { - Copy((UCHAR *)b->Buf + b->Current, buf, size); - } - b->Current += size; - b->Size = new_size; - - // KS - KS_INC(KS_WRITE_BUF_COUNT); -} - -// Append a string to the buffer -void AddBufStr(BUF *b, char *str) -{ - // Validate arguments - if (b == NULL || str == NULL) - { - return; - } - - WriteBuf(b, str, StrLen(str)); -} - -// Write a line to the buffer -void WriteBufLine(BUF *b, char *str) -{ - char *crlf = "\r\n"; - // Validate arguments - if (b == NULL || str == NULL) - { - return; - } - - WriteBuf(b, str, StrLen(str)); - WriteBuf(b, crlf, StrLen(crlf)); -} - -// Write a string to a buffer -bool WriteBufStr(BUF *b, char *str) -{ - UINT len; - // Validate arguments - if (b == NULL || str == NULL) - { - return false; - } - - // String length - len = StrLen(str); - if (WriteBufInt(b, len + 1) == false) - { - return false; - } - - // String body - WriteBuf(b, str, len); - - return true; -} - -// Read a string from the buffer -bool ReadBufStr(BUF *b, char *str, UINT size) -{ - UINT len; - UINT read_size; - // Validate arguments - if (b == NULL || str == NULL || size == 0) - { - return false; - } - - // Read the length of the string - len = ReadBufInt(b); - if (len == 0) - { - return false; - } - len--; - if (len <= (size - 1)) - { - size = len + 1; - } - - read_size = MIN(len, (size - 1)); - - // Read the string body - if (ReadBuf(b, str, read_size) != read_size) - { - return false; - } - if (read_size < len) - { - ReadBuf(b, NULL, len - read_size); - } - str[read_size] = 0; - - return true; -} - -// Write a 64 bit integer to the buffer -bool WriteBufInt64(BUF *b, UINT64 value) -{ - // Validate arguments - if (b == NULL) - { - return false; - } - - value = Endian64(value); - - WriteBuf(b, &value, sizeof(UINT64)); - return true; -} - -// Write an integer in the the buffer -bool WriteBufInt(BUF *b, UINT value) -{ - // Validate arguments - if (b == NULL) - { - return false; - } - - value = Endian32(value); - - WriteBuf(b, &value, sizeof(UINT)); - return true; -} - -// Write a short integer in the the buffer -bool WriteBufShort(BUF *b, USHORT value) -{ - // Validate arguments - if (b == NULL) - { - return false; - } - - value = Endian16(value); - - WriteBuf(b, &value, sizeof(USHORT)); - return true; -} - -// Write a UCHAR to the buffer -bool WriteBufChar(BUF *b, UCHAR uc) -{ - // Validate arguments - if (b == NULL) - { - return false; - } - - WriteBuf(b, &uc, 1); - - return true; -} - -// Read a UCHAR from the buffer -UCHAR ReadBufChar(BUF *b) -{ - UCHAR uc; - // Validate arguments - if (b == NULL) - { - return 0; - } - - if (ReadBuf(b, &uc, 1) != 1) - { - return 0; - } - - return uc; -} - -// Read a 64bit integer from the buffer -UINT64 ReadBufInt64(BUF *b) -{ - UINT64 value; - // Validate arguments - if (b == NULL) - { - return 0; - } - - if (ReadBuf(b, &value, sizeof(UINT64)) != sizeof(UINT64)) - { - return 0; - } - return Endian64(value); -} - -// Read an integer from the buffer -UINT ReadBufInt(BUF *b) -{ - UINT value; - // Validate arguments - if (b == NULL) - { - return 0; - } - - if (ReadBuf(b, &value, sizeof(UINT)) != sizeof(UINT)) - { - return 0; - } - return Endian32(value); -} - -// Read a short integer from the buffer -USHORT ReadBufShort(BUF *b) -{ - USHORT value; - // Validate arguments - if (b == NULL) - { - return 0; - } - - if (ReadBuf(b, &value, sizeof(USHORT)) != sizeof(USHORT)) - { - return 0; - } - return Endian16(value); -} - -// Write the buffer to a buffer -void WriteBufBuf(BUF *b, BUF *bb) -{ - // Validate arguments - if (b == NULL || bb == NULL) - { - return; - } - - WriteBuf(b, bb->Buf, bb->Size); -} - -// Write the buffer (from the offset) to a buffer -void WriteBufBufWithOffset(BUF *b, BUF *bb) -{ - // Validate arguments - if (b == NULL || bb == NULL) - { - return; - } - - WriteBuf(b, ((UCHAR *)bb->Buf) + bb->Current, bb->Size - bb->Current); -} - -// Skip UTF-8 BOM -bool BufSkipUtf8Bom(BUF *b) -{ - if (b == NULL) - { - return false; - } - - SeekBufToBegin(b); - - if (b->Size >= 3) - { - UCHAR *data = b->Buf; - - if (data[0] == 0xEF && data[1] == 0xBB && data[2] == 0xBF) - { - SeekBuf(b, 3, 1); - - return true; - } - } - - return false; -} - -// Read into a buffer from the buffer -BUF *ReadBufFromBuf(BUF *b, UINT size) -{ - BUF *ret; - UCHAR *data; - // Validate arguments - if (b == NULL) - { - return NULL; - } - - data = Malloc(size); - if (ReadBuf(b, data, size) != size) - { - Free(data); - return NULL; - } - - ret = NewBuf(); - WriteBuf(ret, data, size); - SeekBuf(ret, 0, 0); - - Free(data); - - return ret; -} - -// Read from the buffer -UINT ReadBuf(BUF *b, void *buf, UINT size) -{ - UINT size_read; - // Validate arguments - if (b == NULL || size == 0) - { - return 0; - } - - if (b->Buf == NULL) - { - Zero(buf, size); - return 0; - } - size_read = size; - if ((b->Current + size) >= b->Size) - { - size_read = b->Size - b->Current; - if (buf != NULL) - { - Zero((UCHAR *)buf + size_read, size - size_read); - } - } - - if (buf != NULL) - { - Copy(buf, (UCHAR *)b->Buf + b->Current, size_read); - } - - b->Current += size_read; - - // KS - KS_INC(KS_READ_BUF_COUNT); - - return size_read; -} - -// Adjusting the buffer size -void AdjustBufSize(BUF *b, UINT new_size) -{ - // Validate arguments - if (b == NULL) - { - return; - } - - if (b->SizeReserved >= new_size) - { - return; - } - - while (b->SizeReserved < new_size) - { - b->SizeReserved = b->SizeReserved * 2; - } - b->Buf = ReAlloc(b->Buf, b->SizeReserved); - - // KS - KS_INC(KS_ADJUST_BUFSIZE_COUNT); -} - -// Seek to the beginning of the buffer -void SeekBufToBegin(BUF *b) -{ - // Validate arguments - if (b == NULL) - { - return; - } - - SeekBuf(b, 0, 0); -} - -// Seek to end of the buffer -void SeekBufToEnd(BUF *b) -{ - // Validate arguments - if (b == NULL) - { - return; - } - - SeekBuf(b, b->Size, 0); -} - -// Seek of the buffer -void SeekBuf(BUF *b, UINT offset, int mode) -{ - UINT new_pos; - // Validate arguments - if (b == NULL) - { - return; - } - - if (mode == 0) - { - // Absolute position - new_pos = offset; - } - else - { - if (mode > 0) - { - // Move Right - new_pos = b->Current + offset; - } - else - { - // Move Left - if (b->Current >= offset) - { - new_pos = b->Current - offset; - } - else - { - new_pos = 0; - } - } - } - b->Current = MAKESURE(new_pos, 0, b->Size); - - KS_INC(KS_SEEK_BUF_COUNT); -} - -// Free the buffer -void FreeBuf(BUF *b) -{ - // Validate arguments - if (b == NULL) - { - return; - } - - // Memory release - Free(b->Buf); - Free(b); - - // KS - KS_INC(KS_FREEBUF_COUNT); - KS_DEC(KS_CURRENT_BUF_COUNT); -} - -// Compare BUFs whether two are identical -bool CompareBuf(BUF *b1, BUF *b2) -{ - // Validate arguments - if (b1 == NULL && b2 == NULL) - { - return true; - } - if (b1 == NULL || b2 == NULL) - { - return false; - } - - if (b1->Size != b2->Size) - { - return false; - } - - if (Cmp(b1->Buf, b2->Buf, b1->Size) != 0) - { - return false; - } - - return true; -} - -// Create a buffer from the memory area -BUF *MemToBuf(void *data, UINT size) -{ - BUF *b; - // Validate arguments - if (data == NULL && size != 0) - { - return NULL; - } - - b = NewBuf(); - WriteBuf(b, data, size); - SeekBuf(b, 0, 0); - - return b; -} - -// Creating a random number buffer -BUF *RandBuf(UINT size) -{ - void *data = Malloc(size); - BUF *ret; - - Rand(data, size); - - ret = MemToBuf(data, size); - - Free(data); - - return ret; -} - -// Read the rest part of the buffer -BUF *ReadRemainBuf(BUF *b) -{ - UINT size; - // Validate arguments - if (b == NULL) - { - return NULL; - } - - if (b->Size < b->Current) - { - return NULL; - } - - size = b->Size - b->Current; - - return ReadBufFromBuf(b, size); -} - -// Get the length of the rest -UINT ReadBufRemainSize(BUF *b) -{ - // Validate arguments - if (b == NULL) - { - return 0; - } - - if (b->Size < b->Current) - { - return 0; - } - - return b->Size - b->Current; -} - -// Clone the buffer -BUF *CloneBuf(BUF *b) -{ - BUF *bb; - // Validate arguments - if (b == NULL) - { - return NULL; - } - - bb = MemToBuf(b->Buf, b->Size); - - return bb; -} - -// Endian conversion of Unicode string -void EndianUnicode(wchar_t *str) -{ - UINT i, len; - // Validate arguments - if (str == NULL) - { - return; - } - len = UniStrLen(str); - - for (i = 0;i < len;i++) - { - str[i] = Endian16(str[i]); - } -} - -// Endian conversion 16bit -USHORT Endian16(USHORT src) -{ - int x = 1; - if (*((char *)&x)) - { - return Swap16(src); - } - else - { - return src; - } -} - -// Endian conversion 32bit -UINT Endian32(UINT src) -{ - int x = 1; - if (*((char *)&x)) - { - return Swap32(src); - } - else - { - return src; - } -} - -// Endian conversion 64bit -UINT64 Endian64(UINT64 src) -{ - int x = 1; - if (*((char *)&x)) - { - return Swap64(src); - } - else - { - return src; - } -} - -// 16bit swap -USHORT Swap16(USHORT value) -{ - USHORT r; - ((BYTE *)&r)[0] = ((BYTE *)&value)[1]; - ((BYTE *)&r)[1] = ((BYTE *)&value)[0]; - return r; -} - -// 32bit swap -UINT Swap32(UINT value) -{ - UINT r; - ((BYTE *)&r)[0] = ((BYTE *)&value)[3]; - ((BYTE *)&r)[1] = ((BYTE *)&value)[2]; - ((BYTE *)&r)[2] = ((BYTE *)&value)[1]; - ((BYTE *)&r)[3] = ((BYTE *)&value)[0]; - return r; -} - -// 64-bit swap -UINT64 Swap64(UINT64 value) -{ - UINT64 r; - ((BYTE *)&r)[0] = ((BYTE *)&value)[7]; - ((BYTE *)&r)[1] = ((BYTE *)&value)[6]; - ((BYTE *)&r)[2] = ((BYTE *)&value)[5]; - ((BYTE *)&r)[3] = ((BYTE *)&value)[4]; - ((BYTE *)&r)[4] = ((BYTE *)&value)[3]; - ((BYTE *)&r)[5] = ((BYTE *)&value)[2]; - ((BYTE *)&r)[6] = ((BYTE *)&value)[1]; - ((BYTE *)&r)[7] = ((BYTE *)&value)[0]; - return r; -} - -// Base64 encode -UINT Encode64(char *dst, char *src) -{ - // Validate arguments - if (dst == NULL || src == NULL) - { - return 0; - } - - return B64_Encode(dst, src, StrLen(src)); -} - -// Base64 decoding -UINT Decode64(char *dst, char *src) -{ - // Validate arguments - if (dst == NULL || src == NULL) - { - return 0; - } - - return B64_Decode(dst, src, StrLen(src)); -} - -// Base64 encode -int B64_Encode(char *set, char *source, int len) -{ - BYTE *src; - int i,j; - src = (BYTE *)source; - j = 0; - i = 0; - if (!len) - { - return 0; - } - while (true) - { - if (i >= len) - { - return j; - } - if (set) - { - set[j] = B64_CodeToChar((src[i]) >> 2); - } - if (i + 1 >= len) - { - if (set) - { - set[j + 1] = B64_CodeToChar((src[i] & 0x03) << 4); - set[j + 2] = '='; - set[j + 3] = '='; - } - return j + 4; - } - if (set) - { - set[j + 1] = B64_CodeToChar(((src[i] & 0x03) << 4) + ((src[i + 1] >> 4))); - } - if (i + 2 >= len) - { - if (set) - { - set[j + 2] = B64_CodeToChar((src[i + 1] & 0x0f) << 2); - set[j + 3] = '='; - } - return j + 4; - } - if (set) - { - set[j + 2] = B64_CodeToChar(((src[i + 1] & 0x0f) << 2) + ((src[i + 2] >> 6))); - set[j + 3] = B64_CodeToChar(src[i + 2] & 0x3f); - } - i += 3; - j += 4; - } -} - -// Base64 decode -int B64_Decode(char *set, char *source, int len) -{ - int i,j; - char a1,a2,a3,a4; - char *src; - int f1,f2,f3,f4; - src = source; - i = 0; - j = 0; - while (true) - { - f1 = f2 = f3 = f4 = 0; - if (i >= len) - { - break; - } - f1 = 1; - a1 = B64_CharToCode(src[i]); - if (a1 == -1) - { - f1 = 0; - } - if (i >= len + 1) - { - a2 = 0; - } - else - { - a2 = B64_CharToCode(src[i + 1]); - f2 = 1; - if (a2 == -1) - { - f2 = 0; - } - } - if (i >= len + 2) - { - a3 = 0; - } - else - { - a3 = B64_CharToCode(src[i + 2]); - f3 = 1; - if (a3 == -1) - { - f3 = 0; - } - } - if (i >= len + 3) - { - a4 = 0; - } - else - { - a4 = B64_CharToCode(src[i + 3]); - f4 = 1; - if (a4 == -1) - { - f4 = 0; - } - } - if (f1 && f2) - { - if (set) - { - set[j] = (a1 << 2) + (a2 >> 4); - } - j++; - } - if (f2 && f3) - { - if (set) - { - set[j] = (a2 << 4) + (a3 >> 2); - } - j++; - } - if (f3 && f4) - { - if (set) - { - set[j] = (a3 << 6) + a4; - } - j++; - } - i += 4; - } - return j; -} - -// Base64 : Convert a code to a character -char B64_CodeToChar(BYTE c) -{ - BYTE r; - r = '='; - if (c <= 0x19) - { - r = c + 'A'; - } - if (c >= 0x1a && c <= 0x33) - { - r = c - 0x1a + 'a'; - } - if (c >= 0x34 && c <= 0x3d) - { - r = c - 0x34 + '0'; - } - if (c == 0x3e) - { - r = '+'; - } - if (c == 0x3f) - { - r = '/'; - } - return r; -} - -// Base64 : Convert a character to a code -char B64_CharToCode(char c) -{ - if (c >= 'A' && c <= 'Z') - { - return c - 'A'; - } - if (c >= 'a' && c <= 'z') - { - return c - 'a' + 0x1a; - } - if (c >= '0' && c <= '9') - { - return c - '0' + 0x34; - } - if (c == '+') - { - return 0x3e; - } - if (c == '/') - { - return 0x3f; - } - if (c == '=') - { - return -1; - } - return 0; -} - -// Malloc -void *Malloc(UINT size) -{ - return MallocEx(size, false); -} -void *MallocEx(UINT size, bool zero_clear_when_free) -{ - MEMTAG *tag; - UINT real_size; - - real_size = CALC_MALLOCSIZE(size); - - tag = InternalMalloc(real_size); - - Zero(tag, sizeof(MEMTAG)); - tag->Magic = MEMTAG_MAGIC; - tag->Size = size; - tag->ZeroFree = zero_clear_when_free; - - return MEMTAG_TO_POINTER(tag); -} - -// Get memory size -UINT GetMemSize(void *addr) -{ - MEMTAG *tag; - // Validate arguments - if (IS_NULL_POINTER(addr)) - { - return 0; - } - - tag = POINTER_TO_MEMTAG(addr); - CheckMemTag(tag); - - return tag->Size; -} - -// ReAlloc -void *ReAlloc(void *addr, UINT size) -{ - MEMTAG *tag; - bool zerofree; - // Validate arguments - if (IS_NULL_POINTER(addr)) - { - return NULL; - } - - tag = POINTER_TO_MEMTAG(addr); - CheckMemTag(tag); - - zerofree = tag->ZeroFree; - - if (tag->Size == size) - { - // No size change - return addr; - } - else - { - if (zerofree) - { - // Size changed (zero clearing required) - void *new_p = MallocEx(size, true); - - if (tag->Size <= size) - { - // Size expansion - Copy(new_p, addr, tag->Size); - } - else - { - // Size reduction - Copy(new_p, addr, size); - } - - // Release the old block - Free(addr); - - return new_p; - } - else - { - // Size changed - MEMTAG *tag2 = InternalReAlloc(tag, CALC_MALLOCSIZE(size)); - - Zero(tag2, sizeof(MEMTAG)); - tag2->Magic = MEMTAG_MAGIC; - tag2->Size = size; - - return MEMTAG_TO_POINTER(tag2); - } - } -} - -// Free -void Free(void *addr) -{ - MEMTAG *tag; - // Validate arguments - if (IS_NULL_POINTER(addr)) - { - return; - } - - tag = POINTER_TO_MEMTAG(addr); - CheckMemTag(tag); - - if (tag->ZeroFree) - { - // Zero clear - Zero(addr, tag->Size); - } - - // Memory release - tag->Magic = 0; - InternalFree(tag); -} - -// Free and set pointer's value to NULL -void FreeSafe(void **addr) -{ - Free(*addr); - *addr = NULL; -} - -// Check the memtag -void CheckMemTag(MEMTAG *tag) -{ - if (IsTrackingEnabled() == false) - { - return; - } - - // Validate arguments - if (tag == NULL) - { - AbortExitEx("CheckMemTag: tag == NULL"); - return; - } - - if (tag->Magic != MEMTAG_MAGIC) - { - AbortExitEx("CheckMemTag: tag->Magic != MEMTAG_MAGIC"); - return; - } -} - -// ZeroMalloc -void *ZeroMalloc(UINT size) -{ - return ZeroMallocEx(size, false); -} -void *ZeroMallocEx(UINT size, bool zero_clear_when_free) -{ - void *p = MallocEx(size, zero_clear_when_free); - Zero(p, size); - return p; -} - -// Memory allocation -void *InternalMalloc(UINT size) -{ - void *addr; - UINT retry = 0; - size = MORE(size, 1); - - // KS - KS_INC(KS_MALLOC_COUNT); - KS_INC(KS_TOTAL_MEM_COUNT); - KS_ADD(KS_TOTAL_MEM_SIZE, size); - KS_INC(KS_CURRENT_MEM_COUNT); - - // Attempt to allocate memory until success - while (true) - { - if ((retry++) > MEMORY_MAX_RETRY) - { - AbortExitEx("InternalMalloc: error: malloc() failed.\n\n"); - } - addr = OSMemoryAlloc(size); - if (addr != NULL) - { - break; - } - - OSSleep(MEMORY_SLEEP_TIME); - } - - TrackNewObj(POINTER_TO_UINT64(addr), "MEM", size); - - return addr; -} - -// Memory release -void InternalFree(void *addr) -{ - // Validate arguments - if (addr == NULL) - { - return; - } - - // KS - KS_DEC(KS_CURRENT_MEM_COUNT); - KS_INC(KS_FREE_COUNT); - - TrackDeleteObj(POINTER_TO_UINT64(addr)); - - // Memory release - OSMemoryFree(addr); -} - -// Memory reallocation -void *InternalReAlloc(void *addr, UINT size) -{ - void *new_addr; - UINT retry = 0; - size = MORE(size, 1); - - // KS - KS_INC(KS_REALLOC_COUNT); - KS_ADD(KS_TOTAL_MEM_SIZE, size); - - // Attempt to allocate memory until success - while (true) - { - if ((retry++) > MEMORY_MAX_RETRY) - { - AbortExitEx("InternalReAlloc: error: realloc() failed.\n\n"); - } - new_addr = OSMemoryReAlloc(addr, size); - if (new_addr != NULL) - { - break; - } - - OSSleep(MEMORY_SLEEP_TIME); - } - - TrackChangeObjSize(POINTER_TO_UINT64(addr), size, POINTER_TO_UINT64(new_addr)); - - return new_addr; -} - -// Add the heading space to the memory area -void *AddHead(void *src, UINT src_size, void *head, UINT head_size) -{ - void *ret; - UINT ret_size; - // Validate arguments - if ((src == NULL && src_size != 0) || (head == NULL && head_size != 0)) - { - return NULL; - } - - ret_size = src_size + head_size; - - ret = Malloc(ret_size); - - Copy(ret, head, head_size); - - Copy(((UCHAR *)ret) + head_size, src, src_size); - - return ret; -} - -// Clone the memory area -void *Clone(void *addr, UINT size) -{ - void *ret; - // Validate arguments - if (addr == NULL) - { - return NULL; - } - - ret = Malloc(size); - Copy(ret, addr, size); - - return ret; -} - -// Memory copy -void Copy(void *dst, void *src, UINT size) -{ - // Validate arguments - if (dst == NULL || src == NULL || size == 0 || dst == src) - { - return; - } - - // KS - KS_INC(KS_COPY_COUNT); - - memcpy(dst, src, size); -} - -// Memory move -void Move(void *dst, void *src, UINT size) -{ - // Validate arguments - if (dst == NULL || src == NULL || size == 0 || dst == src) - { - return; - } - - // KS - KS_INC(KS_COPY_COUNT); - - memmove(dst, src, size); -} - -// Memory comparison -int Cmp(void *p1, void *p2, UINT size) -{ - // Validate arguments - if (p1 == NULL || p2 == NULL || size == 0) - { - return 0; - } - - return memcmp(p1, p2, (size_t)size); -} - -// Memory comparison (case-insensitive) -int CmpCaseIgnore(void *p1, void *p2, UINT size) -{ - UINT i; - // Validate arguments - if (p1 == NULL || p2 == NULL || size == 0) - { - return 0; - } - - for (i = 0;i < size;i++) - { - char c1 = (char)(*(((UCHAR *)p1) + i)); - char c2 = (char)(*(((UCHAR *)p2) + i)); - - c1 = ToUpper(c1); - c2 = ToUpper(c2); - - if (c1 != c2) - { - return COMPARE_RET(c1, c2); - } - } - - return 0; -} - -// Zero-clear of memory -void Zero(void *addr, UINT size) -{ - // Validate arguments - if (addr == NULL || size == 0) - { - return; - } - - // KS - KS_INC(KS_ZERO_COUNT); - - memset(addr, 0, size); -} - -// Compare the string map entries -int StrMapCmp(void *p1, void *p2) -{ - STRMAP_ENTRY *s1, *s2; - if (p1 == NULL || p2 == NULL) - { - return 0; - } - s1 = *(STRMAP_ENTRY **)p1; - s2 = *(STRMAP_ENTRY **)p2; - if (s1 == NULL || s2 == NULL) - { - return 0; - } - return StrCmpi(s1->Name, s2->Name); -} - -// Create a string map (the data that can be searched by the string) -LIST *NewStrMap() -{ - return NewList(StrMapCmp); -} - -// Search in string map -void *StrMapSearch(LIST *map, char *key) -{ - STRMAP_ENTRY tmp, *result; - tmp.Name = key; - result = (STRMAP_ENTRY*)Search(map, &tmp); - if(result != NULL) - { - return result->Value; - } - return NULL; -} - -// XOR the data -void XorData(void *dst, void *src1, void *src2, UINT size) -{ - UINT i; - UCHAR *d, *c1, *c2; - // Validate arguments - if (dst == NULL || src1 == NULL || src2 == NULL || size == 0) - { - return; - } - - d = (UCHAR *)dst; - c1 = (UCHAR *)src1; - c2 = (UCHAR *)src2; - - for (i = 0;i < size;i++) - { - *d = (*c1) ^ (*c2); - - d++; - c1++; - c2++; - } -} +// SoftEther VPN Source Code - Developer Edition Master Branch +// Mayaqua Kernel + + +// Memory.c +// Memory management program + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#define MEMORY_SLEEP_TIME 150 +#define MEMORY_MAX_RETRY 30 +#define INIT_BUF_SIZE 10240 + +#define FIFO_INIT_MEM_SIZE 4096 +#define FIFO_REALLOC_MEM_SIZE (65536 * 10) // Exquisite value + +#define INIT_NUM_RESERVED 32 + +static UINT fifo_current_realloc_mem_size = FIFO_REALLOC_MEM_SIZE; + +// New PRand +PRAND *NewPRand(void *key, UINT key_size) +{ + PRAND *r; + UCHAR dummy[256]; + if (key == NULL || key_size == 0) + { + key = "DUMMY"; + key_size = 5; + } + + r = ZeroMalloc(sizeof(PRAND)); + + Sha1(r->Key, key, key_size); + + r->Rc4 = NewCrypt(key, key_size); + + Zero(dummy, sizeof(dummy)); + + Encrypt(r->Rc4, dummy, dummy, 256); + + return r; +} + +// Free PRand +void FreePRand(PRAND *r) +{ + if (r == NULL) + { + return; + } + + FreeCrypt(r->Rc4); + + Free(r); +} + +// Generate PRand +void PRand(PRAND *p, void *data, UINT size) +{ + if (p == NULL) + { + return; + } + + Zero(data, size); + + Encrypt(p->Rc4, data, data, size); +} + +// Generate UINT PRand +UINT PRandInt(PRAND *p) +{ + UINT r; + if (p == NULL) + { + return 0; + } + + PRand(p, &r, sizeof(UINT)); + + return r; +} + +// Check whether the specified key item is in the hash list +bool IsInHashListKey(HASH_LIST *h, UINT key) +{ + // Validate arguments + if (h == NULL || key == 0) + { + return false; + } + + if (HashListKeyToPointer(h, key) == NULL) + { + return false; + } + + return true; +} + +// Search the item in the hash list with the key +void *HashListKeyToPointer(HASH_LIST *h, UINT key) +{ + UINT num, i; + void **pp; + void *ret = NULL; + // Validate arguments + if (h == NULL || key == 0) + { + return NULL; + } + + pp = HashListToArray(h, &num); + if (pp == NULL) + { + return NULL; + } + + for (i = 0;i < num;i++) + { + void *p = pp[i]; + + if (POINTER_TO_KEY(p) == key) + { + ret = p; + } + } + + Free(pp); + + return ret; +} + +// Lock the hash list +void LockHashList(HASH_LIST *h) +{ + // Validate arguments + if (h == NULL) + { + return; + } + + Lock(h->Lock); +} + +// Unlock the hash list +void UnlockHashList(HASH_LIST *h) +{ + // Validate arguments + if (h == NULL) + { + return; + } + + Unlock(h->Lock); +} + +// Write the contents of the hash list to array +void **HashListToArray(HASH_LIST *h, UINT *num) +{ + void **ret = NULL; + UINT i; + UINT n = 0; + // Validate arguments + if (h == NULL || num == NULL) + { + if (num != NULL) + { + *num = 0; + } + return NULL; + } + + if (h->AllList != NULL) + { + *num = LIST_NUM(h->AllList); + + return ToArray(h->AllList); + } + + ret = ZeroMalloc(sizeof(void *) * h->NumItems); + + for (i = 0;i < h->Size;i++) + { + LIST *o = h->Entries[i]; + + if (o != NULL) + { + UINT j; + + for (j = 0;j < LIST_NUM(o);j++) + { + void *p = LIST_DATA(o, j); + + ret[n] = p; + n++; + } + } + } + + *num = n; + + return ret; +} + +// Search an item in the hash list +void *SearchHash(HASH_LIST *h, void *t) +{ + UINT r; + void *ret = NULL; + // Validate arguments + if (h == NULL || t == NULL) + { + return NULL; + } + + r = CalcHashForHashList(h, t); + + if (h->Entries[r] != NULL) + { + LIST *o = h->Entries[r]; + void *r = Search(o, t); + + if (r != NULL) + { + ret = r; + } + } + + return ret; +} + +// Remove an item from the hash list +bool DeleteHash(HASH_LIST *h, void *p) +{ + UINT r; + bool ret = false; + // Validate arguments + if (h == NULL || p == NULL) + { + return false; + } + + r = CalcHashForHashList(h, p); + + if (h->Entries[r] != NULL) + { + if (Delete(h->Entries[r], p)) + { + ret = true; + h->NumItems--; + } + + if (LIST_NUM(h->Entries[r]) == 0) + { + ReleaseList(h->Entries[r]); + h->Entries[r] = NULL; + } + } + + if (ret) + { + if (h->AllList != NULL) + { + Delete(h->AllList, p); + } + } + + return ret; +} + +// Add an item to the hash list +void AddHash(HASH_LIST *h, void *p) +{ + UINT r; + // Validate arguments + if (h == NULL || p == NULL) + { + return; + } + + r = CalcHashForHashList(h, p); + + if (h->Entries[r] == NULL) + { + h->Entries[r] = NewListFast(h->CompareProc); + } + + Insert(h->Entries[r], p); + + if (h->AllList != NULL) + { + Add(h->AllList, p); + } + + h->NumItems++; +} + +// Calculation of the hash value of the object +UINT CalcHashForHashList(HASH_LIST *h, void *p) +{ + UINT r; + // Validate arguments + if (h == NULL || p == NULL) + { + return 0; + } + + r = h->GetHashProc(p); + + return (r % h->Size); +} + +// Creating a hash list +HASH_LIST *NewHashList(GET_HASH *get_hash_proc, COMPARE *compare_proc, UINT bits, bool make_list) +{ + HASH_LIST *h; + // Validate arguments + if (get_hash_proc == NULL || compare_proc == NULL) + { + return NULL; + } + if (bits == 0) + { + bits = 16; + } + + bits = MIN(bits, 31); + + h = ZeroMalloc(sizeof(HASH_LIST)); + + h->Bits = bits; + h->Size = Power(2, bits); + + h->Lock = NewLock(); + h->Ref = NewRef(); + + h->Entries = ZeroMalloc(sizeof(LIST *) * h->Size); + + h->GetHashProc = get_hash_proc; + h->CompareProc = compare_proc; + + if (make_list) + { + h->AllList = NewListFast(NULL); + } + + return h; +} + +// Release the hash list +void ReleaseHashList(HASH_LIST *h) +{ + // Validate arguments + if (h == NULL) + { + return; + } + + if (Release(h->Ref) == 0) + { + CleanupHashList(h); + } +} +void CleanupHashList(HASH_LIST *h) +{ + UINT i; + // Validate arguments + if (h == NULL) + { + return; + } + + for (i = 0;i < h->Size;i++) + { + LIST *o = h->Entries[i]; + + if (o != NULL) + { + ReleaseList(o); + } + } + + Free(h->Entries); + + DeleteLock(h->Lock); + + if (h->AllList != NULL) + { + ReleaseList(h->AllList); + } + + Free(h); +} + +// Append a string to the buffer +void AppendBufStr(BUF *b, char *str) +{ + // Validate arguments + if (b == NULL || str == NULL) + { + return; + } + + WriteBuf(b, str, StrLen(str)); +} + +// Add a UTF-8 string to the buffer +void AppendBufUtf8(BUF *b, wchar_t *str) +{ + UINT size; + UCHAR *data; + // Validate arguments + if (b == NULL || str == NULL) + { + return; + } + + size = CalcUniToUtf8(str) + 1; + data = ZeroMalloc(size); + + UniToUtf8(data, size, str); + + WriteBuf(b, data, size - 1); + + Free(data); +} + +// Creating a shared buffer +SHARED_BUFFER *NewSharedBuffer(void *data, UINT size) +{ + SHARED_BUFFER *b = ZeroMalloc(sizeof(SHARED_BUFFER)); + + b->Ref = NewRef(); + b->Data = ZeroMalloc(size); + b->Size = size; + + if (data != NULL) + { + Copy(b->Data, data, size); + } + + return b; +} + +// Release of the shared buffer +void ReleaseSharedBuffer(SHARED_BUFFER *b) +{ + // Validate arguments + if (b == NULL) + { + return; + } + + if (Release(b->Ref) == 0) + { + CleanupSharedBuffer(b); + } +} +void CleanupSharedBuffer(SHARED_BUFFER *b) +{ + // Validate arguments + if (b == NULL) + { + return; + } + + Free(b->Data); + + Free(b); +} + +// Calculation of a ^ b (a to the b-th power) +UINT Power(UINT a, UINT b) +{ + UINT ret, i; + if (a == 0) + { + return 0; + } + if (b == 0) + { + return 1; + } + + ret = 1; + for (i = 0;i < b;i++) + { + ret *= a; + } + + return ret; +} + +// Search in the binary +UINT SearchBin(void *data, UINT data_start, UINT data_size, void *key, UINT key_size) +{ + UINT i; + // Validate arguments + if (data == NULL || key == NULL || key_size == 0 || data_size == 0 || + (data_start >= data_size) || (data_start + key_size > data_size)) + { + return INFINITE; + } + + for (i = data_start;i < (data_size - key_size + 1);i++) + { + UCHAR *p = ((UCHAR *)data) + i; + + if (Cmp(p, key, key_size) == 0) + { + return i; + } + } + + return INFINITE; +} + +// Crash immediately +void CrashNow() +{ + while (true) + { + UINT r = Rand32(); + UCHAR *c = (UCHAR *)r; + + *c = Rand8(); + } +} + +// Convert the buffer to candidate +LIST *BufToCandidate(BUF *b) +{ + LIST *o; + UINT i; + UINT num; + // Validate arguments + if (b == NULL) + { + return NULL; + } + + num = ReadBufInt(b); + o = NewCandidateList(); + + for (i = 0;i < num;i++) + { + CANDIDATE *c; + wchar_t *s; + UINT64 sec64; + UINT len, size; + sec64 = ReadBufInt64(b); + len = ReadBufInt(b); + if (len >= 65536) + { + break; + } + size = (len + 1) * 2; + s = ZeroMalloc(size); + if (ReadBuf(b, s, size) != size) + { + Free(s); + break; + } + else + { + c = ZeroMalloc(sizeof(CANDIDATE)); + c->LastSelectedTime = sec64; + c->Str = s; + Add(o, c); + } + } + + Sort(o); + return o; +} + +// Convert the candidate to buffer +BUF *CandidateToBuf(LIST *o) +{ + BUF *b; + UINT i; + // Validate arguments + if (o == NULL) + { + return NULL; + } + + b = NewBuf(); + WriteBufInt(b, LIST_NUM(o)); + for (i = 0;i < LIST_NUM(o);i++) + { + CANDIDATE *c = LIST_DATA(o, i); + WriteBufInt64(b, c->LastSelectedTime); + WriteBufInt(b, UniStrLen(c->Str)); + WriteBuf(b, c->Str, UniStrSize(c->Str)); + } + + SeekBuf(b, 0, 0); + + return b; +} + +// Adding a candidate +void AddCandidate(LIST *o, wchar_t *str, UINT num_max) +{ + UINT i; + bool exists; + // Validate arguments + if (o == NULL || str == NULL) + { + return; + } + if (num_max == 0) + { + num_max = 0x7fffffff; + } + + // String copy + str = UniCopyStr(str); + UniTrim(str); + + exists = false; + for (i = 0;i < LIST_NUM(o);i++) + { + CANDIDATE *c = LIST_DATA(o, i); + if (UniStrCmpi(c->Str, str) == 0) + { + // Update the time that an existing entry have been found + c->LastSelectedTime = SystemTime64(); + exists = true; + break; + } + } + + if (exists == false) + { + // Insert new + CANDIDATE *c = ZeroMalloc(sizeof(CANDIDATE)); + c->LastSelectedTime = SystemTime64(); + c->Str = UniCopyStr(str); + Insert(o, c); + } + + // Release the string + Free(str); + + // Check the current number of candidates. + // If it is more than num_max, remove from an oldest candidate sequentially. + if (LIST_NUM(o) > num_max) + { + while (LIST_NUM(o) > num_max) + { + UINT index = LIST_NUM(o) - 1; + CANDIDATE *c = LIST_DATA(o, index); + Delete(o, c); + Free(c->Str); + Free(c); + } + } +} + +// Comparison of candidates +int CompareCandidate(void *p1, void *p2) +{ + CANDIDATE *c1, *c2; + if (p1 == NULL || p2 == NULL) + { + return 0; + } + c1 = *(CANDIDATE **)p1; + c2 = *(CANDIDATE **)p2; + if (c1 == NULL || c2 == NULL) + { + return 0; + } + if (c1->LastSelectedTime > c2->LastSelectedTime) + { + return -1; + } + else if (c1->LastSelectedTime < c2->LastSelectedTime) + { + return 1; + } + else + { + return UniStrCmpi(c1->Str, c2->Str); + } +} + +// Release of the candidate list +void FreeCandidateList(LIST *o) +{ + UINT i; + // Validate arguments + if (o == NULL) + { + return; + } + + for (i = 0;i < LIST_NUM(o);i++) + { + CANDIDATE *c = LIST_DATA(o, i); + Free(c->Str); + Free(c); + } + + ReleaseList(o); +} + +// Creating a new candidate list +LIST *NewCandidateList() +{ + return NewList(CompareCandidate); +} + +// Examine whether the specified address points all-zero area +bool IsZero(void *data, UINT size) +{ + UINT i; + UCHAR *c = (UCHAR *)data; + // Validate arguments + if (data == NULL || size == 0) + { + return true; + } + + for (i = 0;i < size;i++) + { + if (c[i] != 0) + { + return false; + } + } + + return true; +} + +// Expand the data +UINT Uncompress(void *dst, UINT dst_size, void *src, UINT src_size) +{ + unsigned long dst_size_long = dst_size; + // Validate arguments + if (dst == NULL || dst_size_long == 0 || src == NULL) + { + return 0; + } + + if (uncompress(dst, &dst_size_long, src, src_size) != Z_OK) + { + return 0; + } + + return (UINT)dst_size_long; +} +BUF *UncompressBuf(BUF *src_buf) +{ + UINT dst_size, dst_size2; + UCHAR *dst; + BUF *b; + // Validate arguments + if (src_buf == NULL) + { + return NULL; + } + + SeekBuf(src_buf, 0, 0); + dst_size = ReadBufInt(src_buf); + + dst = Malloc(dst_size); + + dst_size2 = Uncompress(dst, dst_size, ((UCHAR *)src_buf->Buf) + sizeof(UINT), src_buf->Size - sizeof(UINT)); + + b = NewBuf(); + WriteBuf(b, dst, dst_size2); + Free(dst); + + return b; +} + +// Compress the data +UINT Compress(void *dst, UINT dst_size, void *src, UINT src_size) +{ + return CompressEx(dst, dst_size, src, src_size, Z_DEFAULT_COMPRESSION); +} +BUF *CompressBuf(BUF *src_buf) +{ + UINT dst_size; + UCHAR *dst_buf; + BUF *b; + // Validate arguments + if (src_buf == NULL) + { + return NULL; + } + + dst_size = CalcCompress(src_buf->Size); + dst_buf = Malloc(dst_size); + + dst_size = Compress(dst_buf, dst_size, src_buf->Buf, src_buf->Size); + + if (dst_size == 0) + { + Free(dst_buf); + return NULL; + } + + b = NewBuf(); + WriteBufInt(b, src_buf->Size); + WriteBuf(b, dst_buf, dst_size); + + Free(dst_buf); + + return b; +} + +// Compress the data with options +UINT CompressEx(void *dst, UINT dst_size, void *src, UINT src_size, UINT level) +{ + unsigned long dst_size_long = dst_size; + // Validate arguments + if (dst == NULL || dst_size_long == 0 || src == NULL) + { + return 0; + } + + if (compress2(dst, &dst_size_long, src, src_size, (int)level) != Z_OK) + { + return 0; + } + + return dst_size_long; +} + +// Get the maximum size of compressed data from data of src_size +UINT CalcCompress(UINT src_size) +{ + return src_size * 2 + 256; +} + +// Creating a Stack +SK *NewSk() +{ + return NewSkEx(false); +} +SK *NewSkEx(bool no_compact) +{ + SK *s; + + s = Malloc(sizeof(SK)); + s->lock = NewLock(); + s->ref = NewRef(); + s->num_item = 0; + s->num_reserved = INIT_NUM_RESERVED; + s->p = Malloc(sizeof(void *) * s->num_reserved); + s->no_compact = no_compact; + + // KS + KS_INC(KS_NEWSK_COUNT); + + return s; +} + +// Release of the stack +void ReleaseSk(SK *s) +{ + // Validate arguments + if (s == NULL) + { + return; + } + + if (Release(s->ref) == 0) + { + CleanupSk(s); + } +} + +// Clean up the stack +void CleanupSk(SK *s) +{ + // Validate arguments + if (s == NULL) + { + return; + } + + // Memory release + Free(s->p); + DeleteLock(s->lock); + Free(s); + + // KS + KS_INC(KS_FREESK_COUNT); +} + +// Lock of the stack +void LockSk(SK *s) +{ + // Validate arguments + if (s == NULL) + { + return; + } + + Lock(s->lock); +} + +// Unlock the stack +void UnlockSk(SK *s) +{ + // Validate arguments + if (s == NULL) + { + return; + } + + Unlock(s->lock); +} + +// Push to the stack +void Push(SK *s, void *p) +{ + UINT i; + // Validate arguments + if (s == NULL || p == NULL) + { + return; + } + + i = s->num_item; + s->num_item++; + + // Size expansion + if (s->num_item > s->num_reserved) + { + s->num_reserved = s->num_reserved * 2; + s->p = ReAlloc(s->p, sizeof(void *) * s->num_reserved); + } + s->p[i] = p; + + // KS + KS_INC(KS_PUSH_COUNT); +} + +// Pop from the stack +void *Pop(SK *s) +{ + void *ret; + // Validate arguments + if (s == NULL) + { + return NULL; + } + if (s->num_item == 0) + { + return NULL; + } + ret = s->p[s->num_item - 1]; + s->num_item--; + + // Size reduction + if (s->no_compact == false) + { + // Not to shrink when no_compact is true + if ((s->num_item * 2) <= s->num_reserved) + { + if (s->num_reserved >= (INIT_NUM_RESERVED * 2)) + { + s->num_reserved = s->num_reserved / 2; + s->p = ReAlloc(s->p, sizeof(void *) * s->num_reserved); + } + } + } + + // KS + KS_INC(KS_POP_COUNT); + + return ret; +} + +// Get the number of queued items +UINT GetQueueNum(QUEUE *q) +{ + // Validate arguments + if (q == NULL) + { + return 0; + } + + return q->num_item; +} + +// Get one +void *GetNext(QUEUE *q) +{ + void *p = NULL; + // Validate arguments + if (q == NULL) + { + return NULL; + } + + if (q->num_item == 0) + { + // No items + return NULL; + } + + // Read from the FIFO + ReadFifo(q->fifo, &p, sizeof(void *)); + q->num_item--; + + // KS + KS_INC(KS_GETNEXT_COUNT); + + return p; +} + +// Get one item from the queue (locking) +void *GetNextWithLock(QUEUE *q) +{ + void *p; + // Validate arguments + if (q == NULL) + { + return NULL; + } + + LockQueue(q); + { + p = GetNext(q); + } + UnlockQueue(q); + + return p; +} + +// Insert the int type in the queue +void InsertQueueInt(QUEUE *q, UINT value) +{ + UINT *p; + // Validate arguments + if (q == NULL) + { + return; + } + + p = Clone(&value, sizeof(UINT)); + + InsertQueue(q, p); +} + +// Insert to the queue +void InsertQueue(QUEUE *q, void *p) +{ + // Validate arguments + if (q == NULL || p == NULL) + { + return; + } + + // Write to the FIFO + WriteFifo(q->fifo, &p, sizeof(void *)); + + q->num_item++; + + /*{ + static UINT max_num_item; + static UINT64 next_tick = 0; + UINT64 now = Tick64(); + + max_num_item = MAX(q->num_item, max_num_item); + + if (next_tick == 0 || next_tick <= now) + { + next_tick = now + (UINT64)1000; + + printf("max_queue = %u\n", max_num_item); + } + }*/ + + // KS + KS_INC(KS_INSERT_QUEUE_COUNT); +} + +// Insert to the queue (locking) +void InsertQueueWithLock(QUEUE *q, void *p) +{ + // Validate arguments + if (q == NULL || p == NULL) + { + return; + } + + LockQueue(q); + { + InsertQueue(q, p); + } + UnlockQueue(q); +} + +// Lock the queue +void LockQueue(QUEUE *q) +{ + // Validate arguments + if (q == NULL) + { + return; + } + + Lock(q->lock); +} + +// Unlock the queue +void UnlockQueue(QUEUE *q) +{ + // Validate arguments + if (q == NULL) + { + return; + } + + Unlock(q->lock); +} + +// Release of the queue +void ReleaseQueue(QUEUE *q) +{ + // Validate arguments + if (q == NULL) + { + return; + } + + if (q->ref == NULL || Release(q->ref) == 0) + { + CleanupQueue(q); + } +} + +// Clean-up the queue +void CleanupQueue(QUEUE *q) +{ + // Validate arguments + if (q == NULL) + { + return; + } + + // Memory release + ReleaseFifo(q->fifo); + DeleteLock(q->lock); + Free(q); + + // KS + KS_INC(KS_FREEQUEUE_COUNT); +} + +// Creating a Queue +QUEUE *NewQueue() +{ + QUEUE *q; + + q = ZeroMalloc(sizeof(QUEUE)); + q->lock = NewLock(); + q->ref = NewRef(); + q->num_item = 0; + q->fifo = NewFifo(); + + // KS + KS_INC(KS_NEWQUEUE_COUNT); + + return q; +} +QUEUE *NewQueueFast() +{ + QUEUE *q; + + q = ZeroMalloc(sizeof(QUEUE)); + q->lock = NULL; + q->ref = NULL; + q->num_item = 0; + q->fifo = NewFifoFast(); + + // KS + KS_INC(KS_NEWQUEUE_COUNT); + + return q; +} + +// Clone the list +LIST *CloneList(LIST *o) +{ + LIST *n = NewList(o->cmp); + + // Memory reallocation + Free(n->p); + n->p = ToArray(o); + n->num_item = n->num_reserved = LIST_NUM(o); + n->sorted = o->sorted; + + return n; +} + +// Copy the list to an array +void CopyToArray(LIST *o, void *p) +{ + // Validate arguments + if (o == NULL || p == NULL) + { + return; + } + + // KS + KS_INC(KS_TOARRAY_COUNT); + + Copy(p, o->p, sizeof(void *) * o->num_item); +} + +// Arrange the list to an array +void *ToArray(LIST *o) +{ + return ToArrayEx(o, false); +} +void *ToArrayEx(LIST *o, bool fast) +{ + void *p; + // Validate arguments + if (o == NULL) + { + return NULL; + } + + // Memory allocation + if (fast == false) + { + p = Malloc(sizeof(void *) * LIST_NUM(o)); + } + else + { + p = MallocFast(sizeof(void *) * LIST_NUM(o)); + } + // Copy + CopyToArray(o, p); + + return p; +} + +// Search in the list +void *Search(LIST *o, void *target) +{ + void **ret; + // Validate arguments + if (o == NULL || target == NULL) + { + return NULL; + } + if (o->cmp == NULL) + { + return NULL; + } + + // Check the sort + if (o->sorted == false) + { + // Sort because it is not sorted + Sort(o); + } + + ret = (void **)bsearch(&target, o->p, o->num_item, sizeof(void *), + (int(*)(const void *, const void *))o->cmp); + + // KS + KS_INC(KS_SEARCH_COUNT); + + if (ret != NULL) + { + return *ret; + } + else + { + return NULL; + } +} + +// Insert an item to the list +void Insert(LIST *o, void *p) +{ + int low, high, middle; + UINT pos; + int i; + // Validate arguments + if (o == NULL || p == NULL) + { + return; + } + + if (o->cmp == NULL) + { + // adding simply if there is no sort function + Add(o, p); + return; + } + + // Sort immediately if it is not sorted + if (o->sorted == false) + { + Sort(o); + } + + low = 0; + high = LIST_NUM(o) - 1; + + pos = INFINITE; + + while (low <= high) + { + int ret; + + middle = (low + high) / 2; + ret = o->cmp(&(o->p[middle]), &p); + + if (ret == 0) + { + pos = middle; + break; + } + else if (ret > 0) + { + high = middle - 1; + } + else + { + low = middle + 1; + } + } + + if (pos == INFINITE) + { + pos = low; + } + + o->num_item++; + if (o->num_item > o->num_reserved) + { + o->num_reserved *= 2; + o->p = ReAlloc(o->p, sizeof(void *) * o->num_reserved); + } + + if (LIST_NUM(o) >= 2) + { + for (i = (LIST_NUM(o) - 2);i >= (int)pos;i--) + { + o->p[i + 1] = o->p[i]; + } + } + + o->p[pos] = p; + + // KS + KS_INC(KS_INSERT_COUNT); +} + +// Sort the list +void Sort(LIST *o) +{ + // Validate arguments + if (o == NULL || o->cmp == NULL) + { + return; + } + + qsort(o->p, o->num_item, sizeof(void *), (int(*)(const void *, const void *))o->cmp); + o->sorted = true; + + // KS + KS_INC(KS_SORT_COUNT); +} + +// Replace the pointer in the list +bool ReplaceListPointer(LIST *o, void *oldptr, void *newptr) +{ + UINT i; + // Validate arguments + if (o == NULL || oldptr == NULL || newptr == NULL) + { + return false; + } + + for (i = 0;i < LIST_NUM(o);i++) + { + void *p = LIST_DATA(o, i); + + if (p == oldptr) + { + o->p[i] = newptr; + return true; + } + } + + return false; +} + +// New string list +LIST *NewStrList() +{ + return NewListFast(CompareStr); +} + +// Release string list +void ReleaseStrList(LIST *o) +{ + UINT i; + if (o == NULL) + { + return; + } + + for (i = 0;i < LIST_NUM(o);i++) + { + char *s = LIST_DATA(o, i); + Free(s); + } + + ReleaseList(o); +} + +// Add a string distinct to the string list +bool AddStrToStrListDistinct(LIST *o, char *str) +{ + if (o == NULL || str == NULL) + { + return false; + } + + if (IsInListStr(o, str) == false) + { + Add(o, CopyStr(str)); + + return true; + } + + return false; +} + +// Examine whether a string items are present in the list +bool IsInListStr(LIST *o, char *str) +{ + UINT i; + // Validate arguments + if (o == NULL || str == NULL) + { + return false; + } + + for (i = 0;i < LIST_NUM(o);i++) + { + char *s = LIST_DATA(o, i); + + if (StrCmpi(s, str) == 0) + { + return true; + } + } + + return false; +} + +bool IsInListUniStr(LIST *o, wchar_t *str) +{ + UINT i; + // Validate arguments + if (o == NULL || str == NULL) + { + return false; + } + + for (i = 0; i < LIST_NUM(o); i++) + { + wchar_t *s = LIST_DATA(o, i); + + if (UniStrCmpi(s, str) == 0) + { + return true; + } + } + + return false; +} + +// Get the pointer by scanning by UINT pointer in the list +void *ListKeyToPointer(LIST *o, UINT key) +{ + UINT i; + // Validate arguments + if (o == NULL || key == 0) + { + return NULL; + } + + for (i = 0;i < LIST_NUM(o);i++) + { + void *p = LIST_DATA(o, i); + + if (POINTER_TO_KEY(p) == key) + { + return p; + } + } + + return NULL; +} + +// Examine whether the key is present in the list +bool IsInListKey(LIST *o, UINT key) +{ + void *p; + // Validate arguments + if (o == NULL || key == 0) + { + return false; + } + + p = ListKeyToPointer(o, key); + if (p == NULL) + { + return false; + } + + return true; +} + +// Examine whether the item exists in the list +bool IsInList(LIST *o, void *p) +{ + UINT i; + // Validate arguments + if (o == NULL || p == NULL) + { + return false; + } + + for (i = 0;i < LIST_NUM(o);i++) + { + void *q = LIST_DATA(o, i); + if (p == q) + { + return true; + } + } + + return false; +} + +// Add an element to the list (Don't add if it already exists) +void AddDistinct(LIST *o, void *p) +{ + // Validate arguments + if (o == NULL || p == NULL) + { + return; + } + + if (IsInList(o, p)) + { + return; + } + + Add(o, p); +} + +// Add an element to the list +void Add(LIST *o, void *p) +{ + UINT i; + // Validate arguments + if (o == NULL || p == NULL) + { + return; + } + + i = o->num_item; + o->num_item++; + + if (o->num_item > o->num_reserved) + { + o->num_reserved = o->num_reserved * 2; + o->p = ReAlloc(o->p, sizeof(void *) * o->num_reserved); + } + + o->p[i] = p; + o->sorted = false; + + // KS + KS_INC(KS_INSERT_COUNT); +} + +// Delete the element from the list +bool Delete(LIST *o, void *p) +{ + UINT i, n; + // Validate arguments + if (o == NULL || p == NULL) + { + return false; + } + + for (i = 0;i < o->num_item;i++) + { + if (o->p[i] == p) + { + break; + } + } + if (i == o->num_item) + { + return false; + } + + n = i; + for (i = n;i < (o->num_item - 1);i++) + { + o->p[i] = o->p[i + 1]; + } + o->num_item--; + if ((o->num_item * 2) <= o->num_reserved) + { + if (o->num_reserved > (INIT_NUM_RESERVED * 2)) + { + o->num_reserved = o->num_reserved / 2; + o->p = ReAlloc(o->p, sizeof(void *) * o->num_reserved); + } + } + + // KS + KS_INC(KS_DELETE_COUNT); + + return true; +} + +// Delete all elements from the list +void DeleteAll(LIST *o) +{ + // Validate arguments + if (o == NULL) + { + return; + } + + o->num_item = 0; + o->num_reserved = INIT_NUM_RESERVED; + o->p = ReAlloc(o->p, sizeof(void *) * INIT_NUM_RESERVED); +} + +// Lock the list +void LockList(LIST *o) +{ + // Validate arguments + if (o == NULL) + { + return; + } + + Lock(o->lock); +} + +// Unlock the list +void UnlockList(LIST *o) +{ + // Validate arguments + if (o == NULL) + { + return; + } + + Unlock(o->lock); +} + +// Release the list +void ReleaseList(LIST *o) +{ + // Validate arguments + if (o == NULL) + { + return; + } + + if (o->ref == NULL || Release(o->ref) == 0) + { + CleanupList(o); + } +} + +// Clean up the list +void CleanupList(LIST *o) +{ + // Validate arguments + if (o == NULL) + { + return; + } + + Free(o->p); + if (o->lock != NULL) + { + DeleteLock(o->lock); + } + Free(o); + + // KS + KS_INC(KS_FREELIST_COUNT); +} + +// Check whether the specified number is already in the list +bool IsIntInList(LIST *o, UINT i) +{ + UINT j; + // Validate arguments + if (o == NULL) + { + return false; + } + + for (j = 0;j < LIST_NUM(o);j++) + { + UINT *p = LIST_DATA(o, j); + + if (*p == i) + { + return true; + } + } + + return false; +} +bool IsInt64InList(LIST *o, UINT64 i) +{ + UINT j; + // Validate arguments + if (o == NULL) + { + return false; + } + + for (j = 0;j < LIST_NUM(o);j++) + { + UINT64 *p = LIST_DATA(o, j); + + if (*p == i) + { + return true; + } + } + + return false; +} + +// Release the integer list +void ReleaseIntList(LIST *o) +{ + UINT i; + // Validate arguments + if (o == NULL) + { + return; + } + + for (i = 0;i < LIST_NUM(o);i++) + { + UINT *p = LIST_DATA(o, i); + + Free(p); + } + + ReleaseList(o); +} +void ReleaseInt64List(LIST *o) +{ + UINT i; + // Validate arguments + if (o == NULL) + { + return; + } + + for (i = 0;i < LIST_NUM(o);i++) + { + UINT64 *p = LIST_DATA(o, i); + + Free(p); + } + + ReleaseList(o); +} + +// Delete an integer from list +void DelInt(LIST *o, UINT i) +{ + LIST *o2 = NULL; + UINT j; + // Validate arguments + if (o == NULL) + { + return; + } + + for (j = 0;j < LIST_NUM(o);j++) + { + UINT *p = LIST_DATA(o, j); + + if (*p == i) + { + if (o2 == NULL) + { + o2 = NewListFast(NULL); + } + Add(o2, p); + } + } + + for (j = 0;j < LIST_NUM(o2);j++) + { + UINT *p = LIST_DATA(o2, j); + + Delete(o, p); + + Free(p); + } + + if (o2 != NULL) + { + ReleaseList(o2); + } +} + +// Create a new list of integers +LIST *NewIntList(bool sorted) +{ + LIST *o = NewList(sorted ? CompareInt : NULL); + + return o; +} +LIST *NewInt64List(bool sorted) +{ + LIST *o = NewList(sorted ? CompareInt64 : NULL); + + return o; +} + +// Comparison of items in the list of integers +int CompareInt(void *p1, void *p2) +{ + UINT *v1, *v2; + if (p1 == NULL || p2 == NULL) + { + return 0; + } + + v1 = *((UINT **)p1); + v2 = *((UINT **)p2); + if (v1 == NULL || v2 == NULL) + { + return 0; + } + + return COMPARE_RET(*v1, *v2); +} +int CompareInt64(void *p1, void *p2) +{ + UINT64 *v1, *v2; + if (p1 == NULL || p2 == NULL) + { + return 0; + } + + v1 = *((UINT64 **)p1); + v2 = *((UINT64 **)p2); + if (v1 == NULL || v2 == NULL) + { + return 0; + } + + return COMPARE_RET(*v1, *v2); +} + +// Add an integer to the list +void AddInt(LIST *o, UINT i) +{ + // Validate arguments + if (o == NULL) + { + return; + } + + Add(o, Clone(&i, sizeof(UINT))); +} +void AddInt64(LIST *o, UINT64 i) +{ + // Validate arguments + if (o == NULL) + { + return; + } + + Add(o, Clone(&i, sizeof(UINT64))); +} +void InsertInt(LIST *o, UINT i) +{ + // Validate arguments + if (o == NULL) + { + return; + } + + Insert(o, Clone(&i, sizeof(UINT))); +} + +// Add an integer to the list (no duplicates) +void AddIntDistinct(LIST *o, UINT i) +{ + // Validate arguments + if (o == NULL) + { + return; + } + + if (IsIntInList(o, i) == false) + { + AddInt(o, i); + } +} +void AddInt64Distinct(LIST *o, UINT64 i) +{ + // Validate arguments + if (o == NULL) + { + return; + } + + if (IsInt64InList(o, i) == false) + { + AddInt64(o, i); + } +} +void InsertIntDistinct(LIST *o, UINT i) +{ + // Validate arguments + if (o == NULL) + { + return; + } + + if (IsIntInList(o, i) == false) + { + InsertInt(o, i); + } +} + +// String comparison function (Unicode) +int CompareUniStr(void *p1, void *p2) +{ + wchar_t *s1, *s2; + if (p1 == NULL || p2 == NULL) + { + return 0; + } + s1 = *(wchar_t **)p1; + s2 = *(wchar_t **)p2; + + return UniStrCmp(s1, s2); +} + +// Insert the string to the list +bool InsertStr(LIST *o, char *str) +{ + // Validate arguments + if (o == NULL || str == NULL) + { + return false; + } + + if (Search(o, str) == NULL) + { + Insert(o, str); + + return true; + } + + return false; +} + +// String comparison function +int CompareStr(void *p1, void *p2) +{ + char *s1, *s2; + if (p1 == NULL || p2 == NULL) + { + return 0; + } + s1 = *(char **)p1; + s2 = *(char **)p2; + + return StrCmpi(s1, s2); +} + +// Create a list with an item +LIST *NewListSingle(void *p) +{ + LIST *o = NewListFast(NULL); + + Add(o, p); + + return o; +} + +// Creating a high-speed list (without lock) +LIST *NewListFast(COMPARE *cmp) +{ + return NewListEx(cmp, true); +} + +// Creating a list +LIST *NewList(COMPARE *cmp) +{ + return NewListEx(cmp, false); +} +LIST *NewListEx(COMPARE *cmp, bool fast) +{ + return NewListEx2(cmp, fast, false); +} +LIST *NewListEx2(COMPARE *cmp, bool fast, bool fast_malloc) +{ + LIST *o; + + if (fast_malloc == false) + { + o = Malloc(sizeof(LIST)); + } + else + { + o = MallocFast(sizeof(LIST)); + } + + if (fast == false) + { + o->lock = NewLock(); + o->ref = NewRef(); + } + else + { + o->lock = NULL; + o->ref = NULL; + } + o->num_item = 0; + o->num_reserved = INIT_NUM_RESERVED; + o->Param1 = 0; + + if (fast_malloc == false) + { + o->p = Malloc(sizeof(void *) * o->num_reserved); + } + else + { + o->p = MallocFast(sizeof(void *) * o->num_reserved); + } + + o->cmp = cmp; + o->sorted = true; + + // KS + KS_INC(KS_NEWLIST_COUNT); + + return o; +} + +// Parses a string by identifying its parts using the specified separators +LIST *NewEntryList(char *src, char *key_separator, char *value_separator) +{ + LIST *o = NewListFast(NULL); + TOKEN_LIST *t; + + t = ParseTokenWithoutNullStr(src, key_separator); + if (t != NULL) + { + UINT i; + + for (i = 0; i < t->NumTokens; i++) + { + char key[MAX_SIZE]; + char value[MAX_SIZE]; + char *line = t->Token[i]; + Trim(line); + + if (GetKeyAndValue(line, key, sizeof(key), value, sizeof(value), value_separator)) + { + INI_ENTRY *e = ZeroMalloc(sizeof(INI_ENTRY)); + + e->Key = CopyStr(key); + e->Value = CopyStr(value); + + Add(o, e); + } + } + + FreeToken(t); + } + + return o; +} + +// Checks whether the list contains the specified entry +bool EntryListHasKey(LIST *o, char *key) +{ + // Validate arguments + if (o == NULL || key == NULL) + { + return false; + } + + if (GetIniEntry(o, key) != NULL) + { + return true; + } + + return false; +} + +// Gets the value of the specified key from the entry list +char *EntryListStrValue(LIST *o, char *key) +{ + return IniStrValue(o, key); +} + +UINT EntryListIntValue(LIST *o, char *key) +{ + return IniIntValue(o, key); +} + +// Release the entry list +void FreeEntryList(LIST *o) +{ + // Validate arguments + if (o == NULL) + { + return; + } + + FreeIni(o); +} + +// Read all data from FIFO +BUF *ReadFifoAll(FIFO *f) +{ + BUF *buf; + UCHAR *tmp; + UINT size; + if (f == NULL) + { + return NewBuf(); + } + + size = FifoSize(f); + tmp = Malloc(size); + ReadFifo(f, tmp, size); + + buf = MemToBuf(tmp, size); + + Free(tmp); + + return buf; +} + +// Read from the FIFO +UINT ReadFifo(FIFO *f, void *p, UINT size) +{ + UINT read_size; + // Validate arguments + if (f == NULL || size == 0) + { + return 0; + } + + read_size = MIN(size, f->size); + if (read_size == 0) + { + return 0; + } + if (p != NULL) + { + Copy(p, (UCHAR *)f->p + f->pos, read_size); + } + f->pos += read_size; + f->size -= read_size; + + f->total_read_size += (UINT64)read_size; + + if (f->fixed == false) + { + if (f->size == 0) + { + f->pos = 0; + } + } + + ShrinkFifoMemory(f); + + // KS + KS_INC(KS_READ_FIFO_COUNT); + + return read_size; +} + +// Rearrange the memory +void ShrinkFifoMemory(FIFO *f) +{ + // Validate arguments + if (f == NULL) + { + return; + } + + if (f->fixed) + { + return; + } + + // Rearrange the memory + if (f->pos >= FIFO_INIT_MEM_SIZE && + f->memsize >= fifo_current_realloc_mem_size && + (f->memsize / 2) > f->size) + { + void *new_p; + UINT new_size; + + new_size = MAX(f->memsize / 2, FIFO_INIT_MEM_SIZE); + new_p = Malloc(new_size); + Copy(new_p, (UCHAR *)f->p + f->pos, f->size); + + Free(f->p); + + f->memsize = new_size; + f->p = new_p; + f->pos = 0; + } +} + +// Write to the FIFO +void WriteFifo(FIFO *f, void *p, UINT size) +{ + UINT i, need_size; + bool realloc_flag; + // Validate arguments + if (f == NULL || size == 0) + { + return; + } + + i = f->size; + f->size += size; + need_size = f->pos + f->size; + realloc_flag = false; + + // Memory expansion + while (need_size > f->memsize) + { + f->memsize = MAX(f->memsize, FIFO_INIT_MEM_SIZE) * 3; + realloc_flag = true; + } + + if (realloc_flag) + { + f->p = ReAlloc(f->p, f->memsize); + } + + // Write the data + if (p != NULL) + { + Copy((UCHAR *)f->p + f->pos + i, p, size); + } + + f->total_write_size += (UINT64)size; + + // KS + KS_INC(KS_WRITE_FIFO_COUNT); +} + +// Get the current pointer of the FIFO +UCHAR *GetFifoPointer(FIFO *f) +{ + // Validate arguments + if (f == NULL) + { + return NULL; + } + + return ((UCHAR *)f->p) + f->pos; +} +UCHAR *FifoPtr(FIFO *f) +{ + return GetFifoPointer(f); +} + +// Get the size of the FIFO +UINT FifoSize(FIFO *f) +{ + // Validate arguments + if (f == NULL) + { + return 0; + } + + return f->size; +} + +// Release the FIFO +void ReleaseFifo(FIFO *f) +{ + // Validate arguments + if (f == NULL) + { + return; + } + + if (f->ref == NULL || Release(f->ref) == 0) + { + CleanupFifo(f); + } +} + +// Clean-up the FIFO +void CleanupFifo(FIFO *f) +{ + // Validate arguments + if (f == NULL) + { + return; + } + + DeleteLock(f->lock); + Free(f->p); + Free(f); + + // KS + KS_INC(KS_FREEFIFO_COUNT); +} + +// Initialize the FIFO system +void InitFifo() +{ + fifo_current_realloc_mem_size = FIFO_REALLOC_MEM_SIZE; +} + +// Create a FIFO +FIFO *NewFifo() +{ + return NewFifoEx(false); +} +FIFO *NewFifoFast() +{ + return NewFifoEx(true); +} +FIFO *NewFifoEx(bool fast) +{ + return NewFifoEx2(fast, false); +} +FIFO *NewFifoEx2(bool fast, bool fixed) +{ + FIFO *f; + + // Memory allocation + f = ZeroMalloc(sizeof(FIFO)); + + if (fast == false) + { + f->lock = NewLock(); + f->ref = NewRef(); + } + else + { + f->lock = NULL; + f->ref = NULL; + } + + f->size = f->pos = 0; + f->memsize = FIFO_INIT_MEM_SIZE; + f->p = Malloc(FIFO_INIT_MEM_SIZE); + f->fixed = false; + + // KS + KS_INC(KS_NEWFIFO_COUNT); + + return f; +} + +// Set the default memory reclaiming size of the FIFO +void SetFifoCurrentReallocMemSize(UINT size) +{ + if (size == 0) + { + size = FIFO_REALLOC_MEM_SIZE; + } + + fifo_current_realloc_mem_size = size; +} + +// Read a buffer from a file +BUF *FileToBuf(IO *o) +{ + UCHAR hash1[MD5_SIZE], hash2[MD5_SIZE]; + UINT size; + void *buf; + BUF *b; + + // Validate arguments + if (o == NULL) + { + return NULL; + } + + // Read the size + if (FileRead(o, &size, sizeof(size)) == false) + { + return NULL; + } + size = Endian32(size); + + if (size > FileSize(o)) + { + return NULL; + } + + // Read a hash + if (FileRead(o, hash1, sizeof(hash1)) == false) + { + return NULL; + } + + // Read from the buffer + buf = Malloc(size); + if (FileRead(o, buf, size) == false) + { + Free(buf); + return NULL; + } + + // Take a hash + Md5(hash2, buf, size); + + // Compare the hashes + if (Cmp(hash1, hash2, sizeof(hash1)) != 0) + { + // Hashes are different + Free(buf); + return NULL; + } + + // Create a buffer + b = NewBuf(); + WriteBuf(b, buf, size); + Free(buf); + b->Current = 0; + + return b; +} + +// Read a dump file into a buffer +BUF *ReadDump(char *filename) +{ + return ReadDumpWithMaxSize(filename, 0); +} +BUF *ReadDumpWithMaxSize(char *filename, UINT max_size) +{ + IO *o; + BUF *b; + UINT size; + void *data; + // Validate arguments + if (filename == NULL) + { + return NULL; + } + + o = FileOpen(filename, false); + if (o == NULL) + { + return NULL; + } + + size = FileSize(o); + + if (max_size != 0) + { + if (size > max_size) + { + size = max_size; + } + } + + data = Malloc(size); + FileRead(o, data, size); + FileClose(o); + + b = NewBuf(); + WriteBuf(b, data, size); + b->Current = 0; + Free(data); + + return b; +} +BUF *ReadDumpW(wchar_t *filename) +{ + return ReadDumpExW(filename, true); +} +BUF *ReadDumpExW(wchar_t *filename, bool read_lock) +{ + IO *o; + BUF *b; + UINT size; + void *data; + // Validate arguments + if (filename == NULL) + { + return NULL; + } + + o = FileOpenExW(filename, false, read_lock); + if (o == NULL) + { + return NULL; + } + + size = FileSize(o); + data = Malloc(size); + FileRead(o, data, size); + FileClose(o); + + b = NewBuf(); + WriteBuf(b, data, size); + b->Current = 0; + Free(data); + + return b; +} + +// Write down the data +bool DumpDataW(void *data, UINT size, wchar_t *filename) +{ + IO *o; + // Validate arguments + if (filename == NULL || (size != 0 && data == NULL)) + { + return false; + } + + o = FileCreateW(filename); + if (o == NULL) + { + return false; + } + FileWrite(o, data, size); + FileClose(o); + + return true; +} + +// Dump the contents of the buffer to the file +bool DumpBuf(BUF *b, char *filename) +{ + IO *o; + // Validate arguments + if (b == NULL || filename == NULL) + { + return false; + } + + o = FileCreate(filename); + if (o == NULL) + { + return false; + } + FileWrite(o, b->Buf, b->Size); + FileClose(o); + + return true; +} +bool DumpBufW(BUF *b, wchar_t *filename) +{ + IO *o; + // Validate arguments + if (b == NULL || filename == NULL) + { + return false; + } + + o = FileCreateW(filename); + if (o == NULL) + { + return false; + } + FileWrite(o, b->Buf, b->Size); + FileClose(o); + + return true; +} + +// Write to the file only if the contents of the file is different +bool DumpBufWIfNecessary(BUF *b, wchar_t *filename) +{ + BUF *now; + bool need = true; + // Validate arguments + if (b == NULL || filename == NULL) + { + return false; + } + + now = ReadDumpW(filename); + + if (now != NULL) + { + if (CompareBuf(now, b)) + { + need = false; + } + + FreeBuf(now); + } + + if (need == false) + { + return true; + } + else + { + return DumpBufW(b, filename); + } +} + +// Write the buffer to a file +bool BufToFile(IO *o, BUF *b) +{ + UCHAR hash[MD5_SIZE]; + UINT size; + + // Validate arguments + if (o == NULL || b == NULL) + { + return false; + } + + // Hash the data + Md5(hash, b->Buf, b->Size); + + size = Endian32(b->Size); + + // Write the size + if (FileWrite(o, &size, sizeof(size)) == false) + { + return false; + } + + // Write a hash + if (FileWrite(o, hash, sizeof(hash)) == false) + { + return false; + } + + // Write the data + if (FileWrite(o, b->Buf, b->Size) == false) + { + return false; + } + + return true; +} + +// Create a buffer from memory +BUF *NewBufFromMemory(void *buf, UINT size) +{ + BUF *b; + // Validate arguments + if (buf == NULL && size != 0) + { + return NULL; + } + + b = NewBuf(); + WriteBuf(b, buf, size); + SeekBufToBegin(b); + + return b; +} + +// Creating a buffer +BUF *NewBuf() +{ + BUF *b; + + // Memory allocation + b = Malloc(sizeof(BUF)); + b->Buf = Malloc(INIT_BUF_SIZE); + b->Size = 0; + b->Current = 0; + b->SizeReserved = INIT_BUF_SIZE; + + // KS + KS_INC(KS_NEWBUF_COUNT); + KS_INC(KS_CURRENT_BUF_COUNT); + + return b; +} + +// Clearing the buffer +void ClearBuf(BUF *b) +{ + // Validate arguments + if (b == NULL) + { + return; + } + + b->Size = 0; + b->Current = 0; +} + +// Write to the buffer +void WriteBuf(BUF *b, void *buf, UINT size) +{ + UINT new_size; + // Validate arguments + if (b == NULL || buf == NULL || size == 0) + { + return; + } + + new_size = b->Current + size; + if (new_size > b->Size) + { + // Adjust the size + AdjustBufSize(b, new_size); + } + if (b->Buf != NULL) + { + Copy((UCHAR *)b->Buf + b->Current, buf, size); + } + b->Current += size; + b->Size = new_size; + + // KS + KS_INC(KS_WRITE_BUF_COUNT); +} + +// Append a string to the buffer +void AddBufStr(BUF *b, char *str) +{ + // Validate arguments + if (b == NULL || str == NULL) + { + return; + } + + WriteBuf(b, str, StrLen(str)); +} + +// Write a line to the buffer +void WriteBufLine(BUF *b, char *str) +{ + char *crlf = "\r\n"; + // Validate arguments + if (b == NULL || str == NULL) + { + return; + } + + WriteBuf(b, str, StrLen(str)); + WriteBuf(b, crlf, StrLen(crlf)); +} + +// Write a string to a buffer +bool WriteBufStr(BUF *b, char *str) +{ + UINT len; + // Validate arguments + if (b == NULL || str == NULL) + { + return false; + } + + // String length + len = StrLen(str); + if (WriteBufInt(b, len + 1) == false) + { + return false; + } + + // String body + WriteBuf(b, str, len); + + return true; +} + +// Read a string from the buffer +bool ReadBufStr(BUF *b, char *str, UINT size) +{ + UINT len; + UINT read_size; + // Validate arguments + if (b == NULL || str == NULL || size == 0) + { + return false; + } + + // Read the length of the string + len = ReadBufInt(b); + if (len == 0) + { + return false; + } + len--; + if (len <= (size - 1)) + { + size = len + 1; + } + + read_size = MIN(len, (size - 1)); + + // Read the string body + if (ReadBuf(b, str, read_size) != read_size) + { + return false; + } + if (read_size < len) + { + ReadBuf(b, NULL, len - read_size); + } + str[read_size] = 0; + + return true; +} + +// Write a 64 bit integer to the buffer +bool WriteBufInt64(BUF *b, UINT64 value) +{ + // Validate arguments + if (b == NULL) + { + return false; + } + + value = Endian64(value); + + WriteBuf(b, &value, sizeof(UINT64)); + return true; +} + +// Write an integer in the the buffer +bool WriteBufInt(BUF *b, UINT value) +{ + // Validate arguments + if (b == NULL) + { + return false; + } + + value = Endian32(value); + + WriteBuf(b, &value, sizeof(UINT)); + return true; +} + +// Write a short integer in the the buffer +bool WriteBufShort(BUF *b, USHORT value) +{ + // Validate arguments + if (b == NULL) + { + return false; + } + + value = Endian16(value); + + WriteBuf(b, &value, sizeof(USHORT)); + return true; +} + +// Write a UCHAR to the buffer +bool WriteBufChar(BUF *b, UCHAR uc) +{ + // Validate arguments + if (b == NULL) + { + return false; + } + + WriteBuf(b, &uc, 1); + + return true; +} + +// Read a UCHAR from the buffer +UCHAR ReadBufChar(BUF *b) +{ + UCHAR uc; + // Validate arguments + if (b == NULL) + { + return 0; + } + + if (ReadBuf(b, &uc, 1) != 1) + { + return 0; + } + + return uc; +} + +// Read a 64bit integer from the buffer +UINT64 ReadBufInt64(BUF *b) +{ + UINT64 value; + // Validate arguments + if (b == NULL) + { + return 0; + } + + if (ReadBuf(b, &value, sizeof(UINT64)) != sizeof(UINT64)) + { + return 0; + } + return Endian64(value); +} + +// Read an integer from the buffer +UINT ReadBufInt(BUF *b) +{ + UINT value; + // Validate arguments + if (b == NULL) + { + return 0; + } + + if (ReadBuf(b, &value, sizeof(UINT)) != sizeof(UINT)) + { + return 0; + } + return Endian32(value); +} + +// Read a short integer from the buffer +USHORT ReadBufShort(BUF *b) +{ + USHORT value; + // Validate arguments + if (b == NULL) + { + return 0; + } + + if (ReadBuf(b, &value, sizeof(USHORT)) != sizeof(USHORT)) + { + return 0; + } + return Endian16(value); +} + +// Write the buffer to a buffer +void WriteBufBuf(BUF *b, BUF *bb) +{ + // Validate arguments + if (b == NULL || bb == NULL) + { + return; + } + + WriteBuf(b, bb->Buf, bb->Size); +} + +// Write the buffer (from the offset) to a buffer +void WriteBufBufWithOffset(BUF *b, BUF *bb) +{ + // Validate arguments + if (b == NULL || bb == NULL) + { + return; + } + + WriteBuf(b, ((UCHAR *)bb->Buf) + bb->Current, bb->Size - bb->Current); +} + +// Skip UTF-8 BOM +bool BufSkipUtf8Bom(BUF *b) +{ + if (b == NULL) + { + return false; + } + + SeekBufToBegin(b); + + if (b->Size >= 3) + { + UCHAR *data = b->Buf; + + if (data[0] == 0xEF && data[1] == 0xBB && data[2] == 0xBF) + { + SeekBuf(b, 3, 1); + + return true; + } + } + + return false; +} + +// Read into a buffer from the buffer +BUF *ReadBufFromBuf(BUF *b, UINT size) +{ + BUF *ret; + UCHAR *data; + // Validate arguments + if (b == NULL) + { + return NULL; + } + + data = Malloc(size); + if (ReadBuf(b, data, size) != size) + { + Free(data); + return NULL; + } + + ret = NewBuf(); + WriteBuf(ret, data, size); + SeekBuf(ret, 0, 0); + + Free(data); + + return ret; +} + +// Read from the buffer +UINT ReadBuf(BUF *b, void *buf, UINT size) +{ + UINT size_read; + // Validate arguments + if (b == NULL || size == 0) + { + return 0; + } + + if (b->Buf == NULL) + { + Zero(buf, size); + return 0; + } + size_read = size; + if ((b->Current + size) >= b->Size) + { + size_read = b->Size - b->Current; + if (buf != NULL) + { + Zero((UCHAR *)buf + size_read, size - size_read); + } + } + + if (buf != NULL) + { + Copy(buf, (UCHAR *)b->Buf + b->Current, size_read); + } + + b->Current += size_read; + + // KS + KS_INC(KS_READ_BUF_COUNT); + + return size_read; +} + +// Adjusting the buffer size +void AdjustBufSize(BUF *b, UINT new_size) +{ + // Validate arguments + if (b == NULL) + { + return; + } + + if (b->SizeReserved >= new_size) + { + return; + } + + while (b->SizeReserved < new_size) + { + b->SizeReserved = b->SizeReserved * 2; + } + b->Buf = ReAlloc(b->Buf, b->SizeReserved); + + // KS + KS_INC(KS_ADJUST_BUFSIZE_COUNT); +} + +// Seek to the beginning of the buffer +void SeekBufToBegin(BUF *b) +{ + // Validate arguments + if (b == NULL) + { + return; + } + + SeekBuf(b, 0, 0); +} + +// Seek to end of the buffer +void SeekBufToEnd(BUF *b) +{ + // Validate arguments + if (b == NULL) + { + return; + } + + SeekBuf(b, b->Size, 0); +} + +// Seek of the buffer +void SeekBuf(BUF *b, UINT offset, int mode) +{ + UINT new_pos; + // Validate arguments + if (b == NULL) + { + return; + } + + if (mode == 0) + { + // Absolute position + new_pos = offset; + } + else + { + if (mode > 0) + { + // Move Right + new_pos = b->Current + offset; + } + else + { + // Move Left + if (b->Current >= offset) + { + new_pos = b->Current - offset; + } + else + { + new_pos = 0; + } + } + } + b->Current = MAKESURE(new_pos, 0, b->Size); + + KS_INC(KS_SEEK_BUF_COUNT); +} + +// Free the buffer +void FreeBuf(BUF *b) +{ + // Validate arguments + if (b == NULL) + { + return; + } + + // Memory release + Free(b->Buf); + Free(b); + + // KS + KS_INC(KS_FREEBUF_COUNT); + KS_DEC(KS_CURRENT_BUF_COUNT); +} + +// Compare BUFs whether two are identical +bool CompareBuf(BUF *b1, BUF *b2) +{ + // Validate arguments + if (b1 == NULL && b2 == NULL) + { + return true; + } + if (b1 == NULL || b2 == NULL) + { + return false; + } + + if (b1->Size != b2->Size) + { + return false; + } + + if (Cmp(b1->Buf, b2->Buf, b1->Size) != 0) + { + return false; + } + + return true; +} + +// Create a buffer from the memory area +BUF *MemToBuf(void *data, UINT size) +{ + BUF *b; + // Validate arguments + if (data == NULL && size != 0) + { + return NULL; + } + + b = NewBuf(); + WriteBuf(b, data, size); + SeekBuf(b, 0, 0); + + return b; +} + +// Creating a random number buffer +BUF *RandBuf(UINT size) +{ + void *data = Malloc(size); + BUF *ret; + + Rand(data, size); + + ret = MemToBuf(data, size); + + Free(data); + + return ret; +} + +// Read the rest part of the buffer +BUF *ReadRemainBuf(BUF *b) +{ + UINT size; + // Validate arguments + if (b == NULL) + { + return NULL; + } + + if (b->Size < b->Current) + { + return NULL; + } + + size = b->Size - b->Current; + + return ReadBufFromBuf(b, size); +} + +// Get the length of the rest +UINT ReadBufRemainSize(BUF *b) +{ + // Validate arguments + if (b == NULL) + { + return 0; + } + + if (b->Size < b->Current) + { + return 0; + } + + return b->Size - b->Current; +} + +// Clone the buffer +BUF *CloneBuf(BUF *b) +{ + BUF *bb; + // Validate arguments + if (b == NULL) + { + return NULL; + } + + bb = MemToBuf(b->Buf, b->Size); + + return bb; +} + +// Endian conversion of Unicode string +void EndianUnicode(wchar_t *str) +{ + UINT i, len; + // Validate arguments + if (str == NULL) + { + return; + } + len = UniStrLen(str); + + for (i = 0;i < len;i++) + { + str[i] = Endian16(str[i]); + } +} + +// Endian conversion 16bit +USHORT Endian16(USHORT src) +{ + int x = 1; + if (*((char *)&x)) + { + return Swap16(src); + } + else + { + return src; + } +} + +// Endian conversion 32bit +UINT Endian32(UINT src) +{ + int x = 1; + if (*((char *)&x)) + { + return Swap32(src); + } + else + { + return src; + } +} + +// Endian conversion 64bit +UINT64 Endian64(UINT64 src) +{ + int x = 1; + if (*((char *)&x)) + { + return Swap64(src); + } + else + { + return src; + } +} + +// 16bit swap +USHORT Swap16(USHORT value) +{ + USHORT r; + ((BYTE *)&r)[0] = ((BYTE *)&value)[1]; + ((BYTE *)&r)[1] = ((BYTE *)&value)[0]; + return r; +} + +// 32bit swap +UINT Swap32(UINT value) +{ + UINT r; + ((BYTE *)&r)[0] = ((BYTE *)&value)[3]; + ((BYTE *)&r)[1] = ((BYTE *)&value)[2]; + ((BYTE *)&r)[2] = ((BYTE *)&value)[1]; + ((BYTE *)&r)[3] = ((BYTE *)&value)[0]; + return r; +} + +// 64-bit swap +UINT64 Swap64(UINT64 value) +{ + UINT64 r; + ((BYTE *)&r)[0] = ((BYTE *)&value)[7]; + ((BYTE *)&r)[1] = ((BYTE *)&value)[6]; + ((BYTE *)&r)[2] = ((BYTE *)&value)[5]; + ((BYTE *)&r)[3] = ((BYTE *)&value)[4]; + ((BYTE *)&r)[4] = ((BYTE *)&value)[3]; + ((BYTE *)&r)[5] = ((BYTE *)&value)[2]; + ((BYTE *)&r)[6] = ((BYTE *)&value)[1]; + ((BYTE *)&r)[7] = ((BYTE *)&value)[0]; + return r; +} + +// Base64 encode +UINT Encode64(char *dst, char *src) +{ + // Validate arguments + if (dst == NULL || src == NULL) + { + return 0; + } + + return B64_Encode(dst, src, StrLen(src)); +} + +// Base64 decoding +UINT Decode64(char *dst, char *src) +{ + // Validate arguments + if (dst == NULL || src == NULL) + { + return 0; + } + + return B64_Decode(dst, src, StrLen(src)); +} + +// Base64 encode +int B64_Encode(char *set, char *source, int len) +{ + BYTE *src; + int i,j; + src = (BYTE *)source; + j = 0; + i = 0; + if (!len) + { + return 0; + } + while (true) + { + if (i >= len) + { + return j; + } + if (set) + { + set[j] = B64_CodeToChar((src[i]) >> 2); + } + if (i + 1 >= len) + { + if (set) + { + set[j + 1] = B64_CodeToChar((src[i] & 0x03) << 4); + set[j + 2] = '='; + set[j + 3] = '='; + } + return j + 4; + } + if (set) + { + set[j + 1] = B64_CodeToChar(((src[i] & 0x03) << 4) + ((src[i + 1] >> 4))); + } + if (i + 2 >= len) + { + if (set) + { + set[j + 2] = B64_CodeToChar((src[i + 1] & 0x0f) << 2); + set[j + 3] = '='; + } + return j + 4; + } + if (set) + { + set[j + 2] = B64_CodeToChar(((src[i + 1] & 0x0f) << 2) + ((src[i + 2] >> 6))); + set[j + 3] = B64_CodeToChar(src[i + 2] & 0x3f); + } + i += 3; + j += 4; + } +} + +// Base64 decode +int B64_Decode(char *set, char *source, int len) +{ + int i,j; + char a1,a2,a3,a4; + char *src; + int f1,f2,f3,f4; + src = source; + i = 0; + j = 0; + while (true) + { + f1 = f2 = f3 = f4 = 0; + if (i >= len) + { + break; + } + f1 = 1; + a1 = B64_CharToCode(src[i]); + if (a1 == -1) + { + f1 = 0; + } + if (i >= len + 1) + { + a2 = 0; + } + else + { + a2 = B64_CharToCode(src[i + 1]); + f2 = 1; + if (a2 == -1) + { + f2 = 0; + } + } + if (i >= len + 2) + { + a3 = 0; + } + else + { + a3 = B64_CharToCode(src[i + 2]); + f3 = 1; + if (a3 == -1) + { + f3 = 0; + } + } + if (i >= len + 3) + { + a4 = 0; + } + else + { + a4 = B64_CharToCode(src[i + 3]); + f4 = 1; + if (a4 == -1) + { + f4 = 0; + } + } + if (f1 && f2) + { + if (set) + { + set[j] = (a1 << 2) + (a2 >> 4); + } + j++; + } + if (f2 && f3) + { + if (set) + { + set[j] = (a2 << 4) + (a3 >> 2); + } + j++; + } + if (f3 && f4) + { + if (set) + { + set[j] = (a3 << 6) + a4; + } + j++; + } + i += 4; + } + return j; +} + +// Base64 : Convert a code to a character +char B64_CodeToChar(BYTE c) +{ + BYTE r; + r = '='; + if (c <= 0x19) + { + r = c + 'A'; + } + if (c >= 0x1a && c <= 0x33) + { + r = c - 0x1a + 'a'; + } + if (c >= 0x34 && c <= 0x3d) + { + r = c - 0x34 + '0'; + } + if (c == 0x3e) + { + r = '+'; + } + if (c == 0x3f) + { + r = '/'; + } + return r; +} + +// Base64 : Convert a character to a code +char B64_CharToCode(char c) +{ + if (c >= 'A' && c <= 'Z') + { + return c - 'A'; + } + if (c >= 'a' && c <= 'z') + { + return c - 'a' + 0x1a; + } + if (c >= '0' && c <= '9') + { + return c - '0' + 0x34; + } + if (c == '+') + { + return 0x3e; + } + if (c == '/') + { + return 0x3f; + } + if (c == '=') + { + return -1; + } + return 0; +} + +// Malloc +void *Malloc(UINT size) +{ + return MallocEx(size, false); +} +void *MallocEx(UINT size, bool zero_clear_when_free) +{ + MEMTAG *tag; + UINT real_size; + + real_size = CALC_MALLOCSIZE(size); + + tag = InternalMalloc(real_size); + + Zero(tag, sizeof(MEMTAG)); + tag->Magic = MEMTAG_MAGIC; + tag->Size = size; + tag->ZeroFree = zero_clear_when_free; + + return MEMTAG_TO_POINTER(tag); +} + +// Get memory size +UINT GetMemSize(void *addr) +{ + MEMTAG *tag; + // Validate arguments + if (IS_NULL_POINTER(addr)) + { + return 0; + } + + tag = POINTER_TO_MEMTAG(addr); + CheckMemTag(tag); + + return tag->Size; +} + +// ReAlloc +void *ReAlloc(void *addr, UINT size) +{ + MEMTAG *tag; + bool zerofree; + // Validate arguments + if (IS_NULL_POINTER(addr)) + { + return NULL; + } + + tag = POINTER_TO_MEMTAG(addr); + CheckMemTag(tag); + + zerofree = tag->ZeroFree; + + if (tag->Size == size) + { + // No size change + return addr; + } + else + { + if (zerofree) + { + // Size changed (zero clearing required) + void *new_p = MallocEx(size, true); + + if (tag->Size <= size) + { + // Size expansion + Copy(new_p, addr, tag->Size); + } + else + { + // Size reduction + Copy(new_p, addr, size); + } + + // Release the old block + Free(addr); + + return new_p; + } + else + { + // Size changed + MEMTAG *tag2 = InternalReAlloc(tag, CALC_MALLOCSIZE(size)); + + Zero(tag2, sizeof(MEMTAG)); + tag2->Magic = MEMTAG_MAGIC; + tag2->Size = size; + + return MEMTAG_TO_POINTER(tag2); + } + } +} + +// Free +void Free(void *addr) +{ + MEMTAG *tag; + // Validate arguments + if (IS_NULL_POINTER(addr)) + { + return; + } + + tag = POINTER_TO_MEMTAG(addr); + CheckMemTag(tag); + + if (tag->ZeroFree) + { + // Zero clear + Zero(addr, tag->Size); + } + + // Memory release + tag->Magic = 0; + InternalFree(tag); +} + +// Free and set pointer's value to NULL +void FreeSafe(void **addr) +{ + Free(*addr); + *addr = NULL; +} + +// Check the memtag +void CheckMemTag(MEMTAG *tag) +{ + if (IsTrackingEnabled() == false) + { + return; + } + + // Validate arguments + if (tag == NULL) + { + AbortExitEx("CheckMemTag: tag == NULL"); + return; + } + + if (tag->Magic != MEMTAG_MAGIC) + { + AbortExitEx("CheckMemTag: tag->Magic != MEMTAG_MAGIC"); + return; + } +} + +// ZeroMalloc +void *ZeroMalloc(UINT size) +{ + return ZeroMallocEx(size, false); +} +void *ZeroMallocEx(UINT size, bool zero_clear_when_free) +{ + void *p = MallocEx(size, zero_clear_when_free); + Zero(p, size); + return p; +} + +// Memory allocation +void *InternalMalloc(UINT size) +{ + void *addr; + UINT retry = 0; + size = MORE(size, 1); + + // KS + KS_INC(KS_MALLOC_COUNT); + KS_INC(KS_TOTAL_MEM_COUNT); + KS_ADD(KS_TOTAL_MEM_SIZE, size); + KS_INC(KS_CURRENT_MEM_COUNT); + + // Attempt to allocate memory until success + while (true) + { + if ((retry++) > MEMORY_MAX_RETRY) + { + AbortExitEx("InternalMalloc: error: malloc() failed.\n\n"); + } + addr = OSMemoryAlloc(size); + if (addr != NULL) + { + break; + } + + OSSleep(MEMORY_SLEEP_TIME); + } + + TrackNewObj(POINTER_TO_UINT64(addr), "MEM", size); + + return addr; +} + +// Memory release +void InternalFree(void *addr) +{ + // Validate arguments + if (addr == NULL) + { + return; + } + + // KS + KS_DEC(KS_CURRENT_MEM_COUNT); + KS_INC(KS_FREE_COUNT); + + TrackDeleteObj(POINTER_TO_UINT64(addr)); + + // Memory release + OSMemoryFree(addr); +} + +// Memory reallocation +void *InternalReAlloc(void *addr, UINT size) +{ + void *new_addr; + UINT retry = 0; + size = MORE(size, 1); + + // KS + KS_INC(KS_REALLOC_COUNT); + KS_ADD(KS_TOTAL_MEM_SIZE, size); + + // Attempt to allocate memory until success + while (true) + { + if ((retry++) > MEMORY_MAX_RETRY) + { + AbortExitEx("InternalReAlloc: error: realloc() failed.\n\n"); + } + new_addr = OSMemoryReAlloc(addr, size); + if (new_addr != NULL) + { + break; + } + + OSSleep(MEMORY_SLEEP_TIME); + } + + TrackChangeObjSize(POINTER_TO_UINT64(addr), size, POINTER_TO_UINT64(new_addr)); + + return new_addr; +} + +// Add the heading space to the memory area +void *AddHead(void *src, UINT src_size, void *head, UINT head_size) +{ + void *ret; + UINT ret_size; + // Validate arguments + if ((src == NULL && src_size != 0) || (head == NULL && head_size != 0)) + { + return NULL; + } + + ret_size = src_size + head_size; + + ret = Malloc(ret_size); + + Copy(ret, head, head_size); + + Copy(((UCHAR *)ret) + head_size, src, src_size); + + return ret; +} + +// Clone the memory area +void *Clone(void *addr, UINT size) +{ + void *ret; + // Validate arguments + if (addr == NULL) + { + return NULL; + } + + ret = Malloc(size); + Copy(ret, addr, size); + + return ret; +} + +// Memory copy +void Copy(void *dst, void *src, UINT size) +{ + // Validate arguments + if (dst == NULL || src == NULL || size == 0 || dst == src) + { + return; + } + + // KS + KS_INC(KS_COPY_COUNT); + + memcpy(dst, src, size); +} + +// Memory move +void Move(void *dst, void *src, UINT size) +{ + // Validate arguments + if (dst == NULL || src == NULL || size == 0 || dst == src) + { + return; + } + + // KS + KS_INC(KS_COPY_COUNT); + + memmove(dst, src, size); +} + +// Memory comparison +int Cmp(void *p1, void *p2, UINT size) +{ + // Validate arguments + if (p1 == NULL || p2 == NULL || size == 0) + { + return 0; + } + + return memcmp(p1, p2, (size_t)size); +} + +// Memory comparison (case-insensitive) +int CmpCaseIgnore(void *p1, void *p2, UINT size) +{ + UINT i; + // Validate arguments + if (p1 == NULL || p2 == NULL || size == 0) + { + return 0; + } + + for (i = 0;i < size;i++) + { + char c1 = (char)(*(((UCHAR *)p1) + i)); + char c2 = (char)(*(((UCHAR *)p2) + i)); + + c1 = ToUpper(c1); + c2 = ToUpper(c2); + + if (c1 != c2) + { + return COMPARE_RET(c1, c2); + } + } + + return 0; +} + +// Zero-clear of memory +void Zero(void *addr, UINT size) +{ + // Validate arguments + if (addr == NULL || size == 0) + { + return; + } + + // KS + KS_INC(KS_ZERO_COUNT); + + memset(addr, 0, size); +} + +// Compare the string map entries +int StrMapCmp(void *p1, void *p2) +{ + STRMAP_ENTRY *s1, *s2; + if (p1 == NULL || p2 == NULL) + { + return 0; + } + s1 = *(STRMAP_ENTRY **)p1; + s2 = *(STRMAP_ENTRY **)p2; + if (s1 == NULL || s2 == NULL) + { + return 0; + } + return StrCmpi(s1->Name, s2->Name); +} + +// Create a string map (the data that can be searched by the string) +LIST *NewStrMap() +{ + return NewList(StrMapCmp); +} + +// Search in string map +void *StrMapSearch(LIST *map, char *key) +{ + STRMAP_ENTRY tmp, *result; + tmp.Name = key; + result = (STRMAP_ENTRY*)Search(map, &tmp); + if(result != NULL) + { + return result->Value; + } + return NULL; +} + +// XOR the data +void XorData(void *dst, void *src1, void *src2, UINT size) +{ + UINT i; + UCHAR *d, *c1, *c2; + // Validate arguments + if (dst == NULL || src1 == NULL || src2 == NULL || size == 0) + { + return; + } + + d = (UCHAR *)dst; + c1 = (UCHAR *)src1; + c2 = (UCHAR *)src2; + + for (i = 0;i < size;i++) + { + *d = (*c1) ^ (*c2); + + d++; + c1++; + c2++; + } +} diff --git a/src/Mayaqua/Memory.h b/src/Mayaqua/Memory.h index acf32089..2ba267e3 100644 --- a/src/Mayaqua/Memory.h +++ b/src/Mayaqua/Memory.h @@ -1,367 +1,367 @@ -// SoftEther VPN Source Code - Developer Edition Master Branch -// Mayaqua Kernel - - -// Memory.h -// Header of Memory.c - -#ifndef MEMORY_H -#define MEMORY_H - -// MallocFast (not implemented) -#define MallocFast Malloc -#define ZeroMallocFast ZeroMalloc - -// Memory size that can be passed to the kernel at a time -#define MAX_SEND_BUF_MEM_SIZE (10 * 1024 * 1024) - -// The magic number for memory tag -#define MEMTAG_MAGIC 0x49414449 - -#define CALC_MALLOCSIZE(size) ((MAX(size, 1)) + sizeof(MEMTAG)) -#define MEMTAG_TO_POINTER(p) ((void *)(((UCHAR *)(p)) + sizeof(MEMTAG))) -#define POINTER_TO_MEMTAG(p) ((MEMTAG *)(((UCHAR *)(p)) - sizeof(MEMTAG))) -#define IS_NULL_POINTER(p) (((p) == NULL) || ((POINTER_TO_UINT64(p) == (UINT64)sizeof(MEMTAG)))) -#define PTR_TO_PTR(p) ((void **)(&p)) - -// Fixed size of a block of memory pool -#define MEMPOOL_MAX_SIZE 3000 - - -// Memory tag -struct MEMTAG -{ - UINT Magic; - UINT Size; - bool ZeroFree; - UINT Padding; -}; - -// Buffer -struct BUF -{ - void *Buf; - UINT Size; - UINT SizeReserved; - UINT Current; -}; - -// FIFO -struct FIFO -{ - REF *ref; - LOCK *lock; - void *p; - UINT pos, size, memsize; - UINT64 total_read_size; - UINT64 total_write_size; - bool fixed; -}; - -// List -struct LIST -{ - REF *ref; - UINT num_item, num_reserved; - void **p; - LOCK *lock; - COMPARE *cmp; - bool sorted; - UINT64 Param1; -}; - -// Queue -struct QUEUE -{ - REF *ref; - UINT num_item; - FIFO *fifo; - LOCK *lock; -}; - -// Stack -struct SK -{ - REF *ref; - UINT num_item, num_reserved; - void **p; - LOCK *lock; - bool no_compact; -}; - -// Candidate list -struct CANDIDATE -{ - wchar_t *Str; // String - UINT64 LastSelectedTime; // Date and time last selected -}; - -struct STRMAP_ENTRY -{ - char *Name; - void *Value; -}; - -// Shared buffer -struct SHARED_BUFFER -{ - REF *Ref; - void *Data; - UINT Size; -}; - -// Macro -#define LIST_DATA(o, i) (((o) != NULL) ? ((o)->p[(i)]) : NULL) -#define LIST_NUM(o) (((o) != NULL) ? (o)->num_item : 0) -#define HASH_LIST_NUM(o) (((o) != NULL) ? (o)->NumItems : 0) - -// Function pointer type to get a hash function -typedef UINT (GET_HASH)(void *p); - -// Hash list -struct HASH_LIST -{ - UINT Bits; - UINT Size; - GET_HASH *GetHashProc; - COMPARE *CompareProc; - LOCK *Lock; - REF *Ref; - LIST **Entries; - UINT NumItems; - LIST *AllList; -}; - -// PRAND -struct PRAND -{ - UCHAR Key[20]; - CRYPT *Rc4; -}; - -// Function prototype -HASH_LIST *NewHashList(GET_HASH *get_hash_proc, COMPARE *compare_proc, UINT bits, bool make_list); -void ReleaseHashList(HASH_LIST *h); -void CleanupHashList(HASH_LIST *h); -void AddHash(HASH_LIST *h, void *p); -bool DeleteHash(HASH_LIST *h, void *p); -void *SearchHash(HASH_LIST *h, void *t); -UINT CalcHashForHashList(HASH_LIST *h, void *p); -void **HashListToArray(HASH_LIST *h, UINT *num); -void LockHashList(HASH_LIST *h); -void UnlockHashList(HASH_LIST *h); -bool IsInHashListKey(HASH_LIST *h, UINT key); -void *HashListKeyToPointer(HASH_LIST *h, UINT key); - -PRAND *NewPRand(void *key, UINT key_size); -void FreePRand(PRAND *r); -void PRand(PRAND *p, void *data, UINT size); -UINT PRandInt(PRAND *p); - -LIST *NewCandidateList(); -void FreeCandidateList(LIST *o); -int CompareCandidate(void *p1, void *p2); -void AddCandidate(LIST *o, wchar_t *str, UINT num_max); -BUF *CandidateToBuf(LIST *o); -LIST *BufToCandidate(BUF *b); - -void *Malloc(UINT size); -void *MallocEx(UINT size, bool zero_clear_when_free); -void *ZeroMalloc(UINT size); -void *ZeroMallocEx(UINT size, bool zero_clear_when_free); -void *ReAlloc(void *addr, UINT size); -void Free(void *addr); -void FreeSafe(void **addr); -void CheckMemTag(MEMTAG *tag); -UINT GetMemSize(void *addr); - -void *InternalMalloc(UINT size); -void *InternalReAlloc(void *addr, UINT size); -void InternalFree(void *addr); - -void Copy(void *dst, void *src, UINT size); -void Move(void *dst, void *src, UINT size); -int Cmp(void *p1, void *p2, UINT size); -int CmpCaseIgnore(void *p1, void *p2, UINT size); -void ZeroMem(void *addr, UINT size); -void Zero(void *addr, UINT size); -void *Clone(void *addr, UINT size); -void *AddHead(void *src, UINT src_size, void *head, UINT head_size); - -char B64_CodeToChar(BYTE c); -char B64_CharToCode(char c); -int B64_Encode(char *set, char *source, int len); -int B64_Decode(char *set, char *source, int len); -UINT Encode64(char *dst, char *src); -UINT Decode64(char *dst, char *src); - -USHORT Swap16(USHORT value); -UINT Swap32(UINT value); -UINT64 Swap64(UINT64 value); -USHORT Endian16(USHORT src); -UINT Endian32(UINT src); -UINT64 Endian64(UINT64 src); -void EndianUnicode(wchar_t *str); - -BUF *NewBuf(); -BUF *NewBufFromMemory(void *buf, UINT size); -void ClearBuf(BUF *b); -void WriteBuf(BUF *b, void *buf, UINT size); -void WriteBufBuf(BUF *b, BUF *bb); -void WriteBufBufWithOffset(BUF *b, BUF *bb); -UINT ReadBuf(BUF *b, void *buf, UINT size); -bool BufSkipUtf8Bom(BUF *b); -BUF *ReadBufFromBuf(BUF *b, UINT size); -void AdjustBufSize(BUF *b, UINT new_size); -void SeekBuf(BUF *b, UINT offset, int mode); -void SeekBufToEnd(BUF *b); -void SeekBufToBegin(BUF *b); -void FreeBuf(BUF *b); -bool BufToFile(IO *o, BUF *b); -BUF *FileToBuf(IO *o); -UINT ReadBufInt(BUF *b); -USHORT ReadBufShort(BUF *b); -UINT64 ReadBufInt64(BUF *b); -UCHAR ReadBufChar(BUF *b); -bool WriteBufInt(BUF *b, UINT value); -bool WriteBufInt64(BUF *b, UINT64 value); -bool WriteBufChar(BUF *b, UCHAR uc); -bool WriteBufShort(BUF *b, USHORT value); -bool ReadBufStr(BUF *b, char *str, UINT size); -bool WriteBufStr(BUF *b, char *str); -void WriteBufLine(BUF *b, char *str); -void AddBufStr(BUF *b, char *str); -bool DumpBuf(BUF *b, char *filename); -bool DumpBufW(BUF *b, wchar_t *filename); -bool DumpBufWIfNecessary(BUF *b, wchar_t *filename); -bool DumpDataW(void *data, UINT size, wchar_t *filename); -BUF *ReadDump(char *filename); -BUF *ReadDumpWithMaxSize(char *filename, UINT max_size); -BUF *ReadDumpW(wchar_t *filename); -BUF *ReadDumpExW(wchar_t *filename, bool read_lock); -BUF *CloneBuf(BUF *b); -BUF *MemToBuf(void *data, UINT size); -BUF *RandBuf(UINT size); -BUF *ReadRemainBuf(BUF *b); -UINT ReadBufRemainSize(BUF *b); -bool CompareBuf(BUF *b1, BUF *b2); - -UINT ReadFifo(FIFO *f, void *p, UINT size); -BUF *ReadFifoAll(FIFO *f); -void ShrinkFifoMemory(FIFO *f); -UCHAR *GetFifoPointer(FIFO *f); -UCHAR *FifoPtr(FIFO *f); -void WriteFifo(FIFO *f, void *p, UINT size); -UINT FifoSize(FIFO *f); -void ReleaseFifo(FIFO *f); -void CleanupFifo(FIFO *f); -FIFO *NewFifo(); -FIFO *NewFifoFast(); -FIFO *NewFifoEx(bool fast); -FIFO *NewFifoEx2(bool fast, bool fixed); -void InitFifo(); -void SetFifoCurrentReallocMemSize(UINT size); - -void *Search(LIST *o, void *target); -void Sort(LIST *o); -void Add(LIST *o, void *p); -void AddDistinct(LIST *o, void *p); -void Insert(LIST *o, void *p); -bool Delete(LIST *o, void *p); -void DeleteAll(LIST *o); -void LockList(LIST *o); -void UnlockList(LIST *o); -void ReleaseList(LIST *o); -void CleanupList(LIST *o); -LIST *NewList(COMPARE *cmp); -LIST *NewListFast(COMPARE *cmp); -LIST *NewListEx(COMPARE *cmp, bool fast); -LIST *NewListEx2(COMPARE *cmp, bool fast, bool fast_malloc); -LIST *NewListSingle(void *p); -LIST *NewEntryList(char *src, char *key_separator, char *value_separator); -bool EntryListHasKey(LIST *o, char *key); -char *EntryListStrValue(LIST *o, char *key); -UINT EntryListIntValue(LIST *o, char *key); -void FreeEntryList(LIST *o); -LIST *CloneList(LIST *o); -void CopyToArray(LIST *o, void *p); -void *ToArray(LIST *o); -void *ToArrayEx(LIST *o, bool fast); -int CompareStr(void *p1, void *p2); -bool InsertStr(LIST *o, char *str); -int CompareUniStr(void *p1, void *p2); -bool IsInList(LIST *o, void *p); -bool IsInListKey(LIST *o, UINT key); -void *ListKeyToPointer(LIST *o, UINT key); -bool IsInListStr(LIST *o, char *str); -bool IsInListUniStr(LIST *o, wchar_t *str); -bool ReplaceListPointer(LIST *o, void *oldptr, void *newptr); -void AddInt(LIST *o, UINT i); -void AddInt64(LIST *o, UINT64 i); -void AddIntDistinct(LIST *o, UINT i); -void AddInt64Distinct(LIST *o, UINT64 i); -void DelInt(LIST *o, UINT i); -void ReleaseIntList(LIST *o); -void ReleaseInt64List(LIST *o); -bool IsIntInList(LIST *o, UINT i); -bool IsInt64InList(LIST *o, UINT64 i); -LIST *NewIntList(bool sorted); -LIST *NewInt64List(bool sorted); -int CompareInt(void *p1, void *p2); -int CompareInt64(void *p1, void *p2); -void InsertInt(LIST *o, UINT i); -void InsertIntDistinct(LIST *o, UINT i); - -void *GetNext(QUEUE *q); -void *GetNextWithLock(QUEUE *q); -void InsertQueue(QUEUE *q, void *p); -void InsertQueueWithLock(QUEUE *q, void *p); -void InsertQueueInt(QUEUE *q, UINT value); -void LockQueue(QUEUE *q); -void UnlockQueue(QUEUE *q); -void ReleaseQueue(QUEUE *q); -void CleanupQueue(QUEUE *q); -QUEUE *NewQueue(); -QUEUE *NewQueueFast(); -UINT GetQueueNum(QUEUE *q); - -SK *NewSk(); -SK *NewSkEx(bool no_compact); -void ReleaseSk(SK *s); -void CleanupSk(SK *s); -void LockSk(SK *s); -void UnlockSk(SK *s); -void Push(SK *s, void *p); -void *Pop(SK *s); - -UINT Uncompress(void *dst, UINT dst_size, void *src, UINT src_size); -UINT Compress(void *dst, UINT dst_size, void *src, UINT src_size); -UINT CompressEx(void *dst, UINT dst_size, void *src, UINT src_size, UINT level); -UINT CalcCompress(UINT src_size); -BUF *CompressBuf(BUF *src_buf); -BUF *UncompressBuf(BUF *src_buf); - -bool IsZero(void *data, UINT size); - -LIST *NewStrMap(); -void *StrMapSearch(LIST *map, char *key); - -UINT SearchBin(void *data, UINT data_start, UINT data_size, void *key, UINT key_size); -void CrashNow(); -UINT Power(UINT a, UINT b); - -void XorData(void *dst, void *src1, void *src2, UINT size); - -SHARED_BUFFER *NewSharedBuffer(void *data, UINT size); -void ReleaseSharedBuffer(SHARED_BUFFER *b); -void CleanupSharedBuffer(SHARED_BUFFER *b); - -void AppendBufUtf8(BUF *b, wchar_t *str); -void AppendBufStr(BUF *b, char *str); - -LIST *NewStrList(); -void ReleaseStrList(LIST *o); -bool AddStrToStrListDistinct(LIST *o, char *str); - -#endif // MEMORY_H - +// SoftEther VPN Source Code - Developer Edition Master Branch +// Mayaqua Kernel + + +// Memory.h +// Header of Memory.c + +#ifndef MEMORY_H +#define MEMORY_H + +// MallocFast (not implemented) +#define MallocFast Malloc +#define ZeroMallocFast ZeroMalloc + +// Memory size that can be passed to the kernel at a time +#define MAX_SEND_BUF_MEM_SIZE (10 * 1024 * 1024) + +// The magic number for memory tag +#define MEMTAG_MAGIC 0x49414449 + +#define CALC_MALLOCSIZE(size) ((MAX(size, 1)) + sizeof(MEMTAG)) +#define MEMTAG_TO_POINTER(p) ((void *)(((UCHAR *)(p)) + sizeof(MEMTAG))) +#define POINTER_TO_MEMTAG(p) ((MEMTAG *)(((UCHAR *)(p)) - sizeof(MEMTAG))) +#define IS_NULL_POINTER(p) (((p) == NULL) || ((POINTER_TO_UINT64(p) == (UINT64)sizeof(MEMTAG)))) +#define PTR_TO_PTR(p) ((void **)(&p)) + +// Fixed size of a block of memory pool +#define MEMPOOL_MAX_SIZE 3000 + + +// Memory tag +struct MEMTAG +{ + UINT Magic; + UINT Size; + bool ZeroFree; + UINT Padding; +}; + +// Buffer +struct BUF +{ + void *Buf; + UINT Size; + UINT SizeReserved; + UINT Current; +}; + +// FIFO +struct FIFO +{ + REF *ref; + LOCK *lock; + void *p; + UINT pos, size, memsize; + UINT64 total_read_size; + UINT64 total_write_size; + bool fixed; +}; + +// List +struct LIST +{ + REF *ref; + UINT num_item, num_reserved; + void **p; + LOCK *lock; + COMPARE *cmp; + bool sorted; + UINT64 Param1; +}; + +// Queue +struct QUEUE +{ + REF *ref; + UINT num_item; + FIFO *fifo; + LOCK *lock; +}; + +// Stack +struct SK +{ + REF *ref; + UINT num_item, num_reserved; + void **p; + LOCK *lock; + bool no_compact; +}; + +// Candidate list +struct CANDIDATE +{ + wchar_t *Str; // String + UINT64 LastSelectedTime; // Date and time last selected +}; + +struct STRMAP_ENTRY +{ + char *Name; + void *Value; +}; + +// Shared buffer +struct SHARED_BUFFER +{ + REF *Ref; + void *Data; + UINT Size; +}; + +// Macro +#define LIST_DATA(o, i) (((o) != NULL) ? ((o)->p[(i)]) : NULL) +#define LIST_NUM(o) (((o) != NULL) ? (o)->num_item : 0) +#define HASH_LIST_NUM(o) (((o) != NULL) ? (o)->NumItems : 0) + +// Function pointer type to get a hash function +typedef UINT (GET_HASH)(void *p); + +// Hash list +struct HASH_LIST +{ + UINT Bits; + UINT Size; + GET_HASH *GetHashProc; + COMPARE *CompareProc; + LOCK *Lock; + REF *Ref; + LIST **Entries; + UINT NumItems; + LIST *AllList; +}; + +// PRAND +struct PRAND +{ + UCHAR Key[20]; + CRYPT *Rc4; +}; + +// Function prototype +HASH_LIST *NewHashList(GET_HASH *get_hash_proc, COMPARE *compare_proc, UINT bits, bool make_list); +void ReleaseHashList(HASH_LIST *h); +void CleanupHashList(HASH_LIST *h); +void AddHash(HASH_LIST *h, void *p); +bool DeleteHash(HASH_LIST *h, void *p); +void *SearchHash(HASH_LIST *h, void *t); +UINT CalcHashForHashList(HASH_LIST *h, void *p); +void **HashListToArray(HASH_LIST *h, UINT *num); +void LockHashList(HASH_LIST *h); +void UnlockHashList(HASH_LIST *h); +bool IsInHashListKey(HASH_LIST *h, UINT key); +void *HashListKeyToPointer(HASH_LIST *h, UINT key); + +PRAND *NewPRand(void *key, UINT key_size); +void FreePRand(PRAND *r); +void PRand(PRAND *p, void *data, UINT size); +UINT PRandInt(PRAND *p); + +LIST *NewCandidateList(); +void FreeCandidateList(LIST *o); +int CompareCandidate(void *p1, void *p2); +void AddCandidate(LIST *o, wchar_t *str, UINT num_max); +BUF *CandidateToBuf(LIST *o); +LIST *BufToCandidate(BUF *b); + +void *Malloc(UINT size); +void *MallocEx(UINT size, bool zero_clear_when_free); +void *ZeroMalloc(UINT size); +void *ZeroMallocEx(UINT size, bool zero_clear_when_free); +void *ReAlloc(void *addr, UINT size); +void Free(void *addr); +void FreeSafe(void **addr); +void CheckMemTag(MEMTAG *tag); +UINT GetMemSize(void *addr); + +void *InternalMalloc(UINT size); +void *InternalReAlloc(void *addr, UINT size); +void InternalFree(void *addr); + +void Copy(void *dst, void *src, UINT size); +void Move(void *dst, void *src, UINT size); +int Cmp(void *p1, void *p2, UINT size); +int CmpCaseIgnore(void *p1, void *p2, UINT size); +void ZeroMem(void *addr, UINT size); +void Zero(void *addr, UINT size); +void *Clone(void *addr, UINT size); +void *AddHead(void *src, UINT src_size, void *head, UINT head_size); + +char B64_CodeToChar(BYTE c); +char B64_CharToCode(char c); +int B64_Encode(char *set, char *source, int len); +int B64_Decode(char *set, char *source, int len); +UINT Encode64(char *dst, char *src); +UINT Decode64(char *dst, char *src); + +USHORT Swap16(USHORT value); +UINT Swap32(UINT value); +UINT64 Swap64(UINT64 value); +USHORT Endian16(USHORT src); +UINT Endian32(UINT src); +UINT64 Endian64(UINT64 src); +void EndianUnicode(wchar_t *str); + +BUF *NewBuf(); +BUF *NewBufFromMemory(void *buf, UINT size); +void ClearBuf(BUF *b); +void WriteBuf(BUF *b, void *buf, UINT size); +void WriteBufBuf(BUF *b, BUF *bb); +void WriteBufBufWithOffset(BUF *b, BUF *bb); +UINT ReadBuf(BUF *b, void *buf, UINT size); +bool BufSkipUtf8Bom(BUF *b); +BUF *ReadBufFromBuf(BUF *b, UINT size); +void AdjustBufSize(BUF *b, UINT new_size); +void SeekBuf(BUF *b, UINT offset, int mode); +void SeekBufToEnd(BUF *b); +void SeekBufToBegin(BUF *b); +void FreeBuf(BUF *b); +bool BufToFile(IO *o, BUF *b); +BUF *FileToBuf(IO *o); +UINT ReadBufInt(BUF *b); +USHORT ReadBufShort(BUF *b); +UINT64 ReadBufInt64(BUF *b); +UCHAR ReadBufChar(BUF *b); +bool WriteBufInt(BUF *b, UINT value); +bool WriteBufInt64(BUF *b, UINT64 value); +bool WriteBufChar(BUF *b, UCHAR uc); +bool WriteBufShort(BUF *b, USHORT value); +bool ReadBufStr(BUF *b, char *str, UINT size); +bool WriteBufStr(BUF *b, char *str); +void WriteBufLine(BUF *b, char *str); +void AddBufStr(BUF *b, char *str); +bool DumpBuf(BUF *b, char *filename); +bool DumpBufW(BUF *b, wchar_t *filename); +bool DumpBufWIfNecessary(BUF *b, wchar_t *filename); +bool DumpDataW(void *data, UINT size, wchar_t *filename); +BUF *ReadDump(char *filename); +BUF *ReadDumpWithMaxSize(char *filename, UINT max_size); +BUF *ReadDumpW(wchar_t *filename); +BUF *ReadDumpExW(wchar_t *filename, bool read_lock); +BUF *CloneBuf(BUF *b); +BUF *MemToBuf(void *data, UINT size); +BUF *RandBuf(UINT size); +BUF *ReadRemainBuf(BUF *b); +UINT ReadBufRemainSize(BUF *b); +bool CompareBuf(BUF *b1, BUF *b2); + +UINT ReadFifo(FIFO *f, void *p, UINT size); +BUF *ReadFifoAll(FIFO *f); +void ShrinkFifoMemory(FIFO *f); +UCHAR *GetFifoPointer(FIFO *f); +UCHAR *FifoPtr(FIFO *f); +void WriteFifo(FIFO *f, void *p, UINT size); +UINT FifoSize(FIFO *f); +void ReleaseFifo(FIFO *f); +void CleanupFifo(FIFO *f); +FIFO *NewFifo(); +FIFO *NewFifoFast(); +FIFO *NewFifoEx(bool fast); +FIFO *NewFifoEx2(bool fast, bool fixed); +void InitFifo(); +void SetFifoCurrentReallocMemSize(UINT size); + +void *Search(LIST *o, void *target); +void Sort(LIST *o); +void Add(LIST *o, void *p); +void AddDistinct(LIST *o, void *p); +void Insert(LIST *o, void *p); +bool Delete(LIST *o, void *p); +void DeleteAll(LIST *o); +void LockList(LIST *o); +void UnlockList(LIST *o); +void ReleaseList(LIST *o); +void CleanupList(LIST *o); +LIST *NewList(COMPARE *cmp); +LIST *NewListFast(COMPARE *cmp); +LIST *NewListEx(COMPARE *cmp, bool fast); +LIST *NewListEx2(COMPARE *cmp, bool fast, bool fast_malloc); +LIST *NewListSingle(void *p); +LIST *NewEntryList(char *src, char *key_separator, char *value_separator); +bool EntryListHasKey(LIST *o, char *key); +char *EntryListStrValue(LIST *o, char *key); +UINT EntryListIntValue(LIST *o, char *key); +void FreeEntryList(LIST *o); +LIST *CloneList(LIST *o); +void CopyToArray(LIST *o, void *p); +void *ToArray(LIST *o); +void *ToArrayEx(LIST *o, bool fast); +int CompareStr(void *p1, void *p2); +bool InsertStr(LIST *o, char *str); +int CompareUniStr(void *p1, void *p2); +bool IsInList(LIST *o, void *p); +bool IsInListKey(LIST *o, UINT key); +void *ListKeyToPointer(LIST *o, UINT key); +bool IsInListStr(LIST *o, char *str); +bool IsInListUniStr(LIST *o, wchar_t *str); +bool ReplaceListPointer(LIST *o, void *oldptr, void *newptr); +void AddInt(LIST *o, UINT i); +void AddInt64(LIST *o, UINT64 i); +void AddIntDistinct(LIST *o, UINT i); +void AddInt64Distinct(LIST *o, UINT64 i); +void DelInt(LIST *o, UINT i); +void ReleaseIntList(LIST *o); +void ReleaseInt64List(LIST *o); +bool IsIntInList(LIST *o, UINT i); +bool IsInt64InList(LIST *o, UINT64 i); +LIST *NewIntList(bool sorted); +LIST *NewInt64List(bool sorted); +int CompareInt(void *p1, void *p2); +int CompareInt64(void *p1, void *p2); +void InsertInt(LIST *o, UINT i); +void InsertIntDistinct(LIST *o, UINT i); + +void *GetNext(QUEUE *q); +void *GetNextWithLock(QUEUE *q); +void InsertQueue(QUEUE *q, void *p); +void InsertQueueWithLock(QUEUE *q, void *p); +void InsertQueueInt(QUEUE *q, UINT value); +void LockQueue(QUEUE *q); +void UnlockQueue(QUEUE *q); +void ReleaseQueue(QUEUE *q); +void CleanupQueue(QUEUE *q); +QUEUE *NewQueue(); +QUEUE *NewQueueFast(); +UINT GetQueueNum(QUEUE *q); + +SK *NewSk(); +SK *NewSkEx(bool no_compact); +void ReleaseSk(SK *s); +void CleanupSk(SK *s); +void LockSk(SK *s); +void UnlockSk(SK *s); +void Push(SK *s, void *p); +void *Pop(SK *s); + +UINT Uncompress(void *dst, UINT dst_size, void *src, UINT src_size); +UINT Compress(void *dst, UINT dst_size, void *src, UINT src_size); +UINT CompressEx(void *dst, UINT dst_size, void *src, UINT src_size, UINT level); +UINT CalcCompress(UINT src_size); +BUF *CompressBuf(BUF *src_buf); +BUF *UncompressBuf(BUF *src_buf); + +bool IsZero(void *data, UINT size); + +LIST *NewStrMap(); +void *StrMapSearch(LIST *map, char *key); + +UINT SearchBin(void *data, UINT data_start, UINT data_size, void *key, UINT key_size); +void CrashNow(); +UINT Power(UINT a, UINT b); + +void XorData(void *dst, void *src1, void *src2, UINT size); + +SHARED_BUFFER *NewSharedBuffer(void *data, UINT size); +void ReleaseSharedBuffer(SHARED_BUFFER *b); +void CleanupSharedBuffer(SHARED_BUFFER *b); + +void AppendBufUtf8(BUF *b, wchar_t *str); +void AppendBufStr(BUF *b, char *str); + +LIST *NewStrList(); +void ReleaseStrList(LIST *o); +bool AddStrToStrListDistinct(LIST *o, char *str); + +#endif // MEMORY_H + diff --git a/src/Mayaqua/Microsoft.c b/src/Mayaqua/Microsoft.c index b4ad140a..954c1770 100644 --- a/src/Mayaqua/Microsoft.c +++ b/src/Mayaqua/Microsoft.c @@ -1,12597 +1,12597 @@ -// SoftEther VPN Source Code - Developer Edition Master Branch -// Mayaqua Kernel - - -// Microsoft.c -// For Microsoft Windows code -// (not compiled on non-Windows environments) - -#include - -#ifdef WIN32 - -#define MICROSOFT_C - -typedef enum _PNP_VETO_TYPE { - PNP_VetoTypeUnknown, // Name is unspecified - PNP_VetoLegacyDevice, // Name is an Instance Path - PNP_VetoPendingClose, // Name is an Instance Path - PNP_VetoWindowsApp, // Name is a Module - PNP_VetoWindowsService, // Name is a Service - PNP_VetoOutstandingOpen, // Name is an Instance Path - PNP_VetoDevice, // Name is an Instance Path - PNP_VetoDriver, // Name is a Driver Service Name - PNP_VetoIllegalDeviceRequest, // Name is an Instance Path - PNP_VetoInsufficientPower, // Name is unspecified - PNP_VetoNonDisableable, // Name is an Instance Path - PNP_VetoLegacyDriver, // Name is a Service - PNP_VetoInsufficientRights // Name is unspecified -} PNP_VETO_TYPE, *PPNP_VETO_TYPE; - -#define _WIN32_IE 0x0600 -#define _WIN32_WINNT 0x0502 -#define WINVER 0x0502 -#define SECURITY_WIN32 -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -static MS *ms = NULL; - -// Function prototype -UINT MsgBox(HWND hWnd, UINT flag, wchar_t *msg); -UINT MsgBoxEx(HWND hWnd, UINT flag, wchar_t *msg, ...); -void ShowTcpIpConfigUtil(HWND hWnd, bool util_mode); -void CmTraffic(HWND hWnd); -void CnStart(); -void InitCedar(); -void FreeCedar(); -void InitWinUi(wchar_t *software_name, char *font, UINT fontsize); -void FreeWinUi(); - -// Global variable -UINT64 ms_uint64_1 = 0; - -// Adapter list related -static LOCK *lock_adapter_list = NULL; -static MS_ADAPTER_LIST *last_adapter_list = NULL; - -// Service related -static SERVICE_STATUS_HANDLE ssh = NULL; -static SERVICE_STATUS status = { 0 }; -static HANDLE service_stop_event = NULL; -static BOOL (WINAPI *_StartServiceCtrlDispatcher)(CONST LPSERVICE_TABLE_ENTRY) = NULL; -static SERVICE_STATUS_HANDLE (WINAPI *_RegisterServiceCtrlHandler)(LPCTSTR, LPHANDLER_FUNCTION) = NULL; -static BOOL (WINAPI *_SetServiceStatus)(SERVICE_STATUS_HANDLE, LPSERVICE_STATUS) = NULL; -static char g_service_name[MAX_SIZE]; -static SERVICE_FUNCTION *g_start, *g_stop; -static bool exiting = false; -static bool wnd_end; -static bool is_usermode = false; -static bool wts_is_locked_flag = false; -static HICON tray_icon; -static NOTIFYICONDATA nid; -static NOTIFYICONDATAW nid_nt; -static bool service_for_9x_mode = false; -static THREAD *service_stopper_thread = NULL; -static bool tray_inited = false; -static HWND hWndUsermode = NULL; -static HANDLE hLsa = NULL; -static ULONG lsa_package_id = 0; -static TOKEN_SOURCE lsa_token_source; -static LOCK *vlan_lock = NULL; -static COUNTER *suspend_handler_singleton = NULL; -static COUNTER *vlan_card_counter = NULL; -static volatile BOOL vlan_card_should_stop_flag = false; -static volatile BOOL vlan_is_in_suspend_mode = false; -static volatile UINT64 vlan_suspend_mode_begin_tick = 0; - -// msi.dll -static HINSTANCE hMsi = NULL; -static UINT (WINAPI *_MsiGetProductInfoW)(LPCWSTR, LPCWSTR, LPWSTR, LPDWORD) = NULL; -static UINT (WINAPI *_MsiConfigureProductW)(LPCWSTR, int, INSTALLSTATE) = NULL; -static INSTALLUILEVEL (WINAPI *_MsiSetInternalUI)(INSTALLUILEVEL, HWND *) = NULL; -static INSTALLSTATE (WINAPI *_MsiLocateComponentW)(LPCWSTR, LPWSTR, LPDWORD) = NULL; - -#define SE_GROUP_INTEGRITY (0x00000020L) - -typedef enum _TOKEN_INFORMATION_CLASS_VISTA -{ - VistaTokenUser = 1, - VistaTokenGroups, - VistaTokenPrivileges, - VistaTokenOwner, - VistaTokenPrimaryGroup, - VistaTokenDefaultDacl, - VistaTokenSource, - VistaTokenType, - VistaTokenImpersonationLevel, - VistaTokenStatistics, - VistaTokenRestrictedSids, - VistaTokenSessionId, - VistaTokenGroupsAndPrivileges, - VistaTokenSessionReference, - VistaTokenSandBoxInert, - VistaTokenAuditPolicy, - VistaTokenOrigin, - VistaTokenElevationType, - VistaTokenLinkedToken, - VistaTokenElevation, - VistaTokenHasRestrictions, - VistaTokenAccessInformation, - VistaTokenVirtualizationAllowed, - VistaTokenVirtualizationEnabled, - VistaTokenIntegrityLevel, - VistaTokenUIAccess, - VistaTokenMandatoryPolicy, - VistaTokenLogonSid, - VistaMaxTokenInfoClass -} TOKEN_INFORMATION_CLASS_VISTA, *PTOKEN_INFORMATION_CLASS_VISTA; - -typedef struct MS_MSCHAPV2_PARAMS -{ - wchar_t Username[MAX_SIZE]; - wchar_t Workstation[MAX_SIZE]; - wchar_t Domain[MAX_SIZE]; - UCHAR ClientResponse24[24]; - UCHAR ResponseBuffer[MAX_SIZE]; -} MS_MSCHAPV2_PARAMS; - -// The function which should be called once as soon as possible after the process is started -void MsInitProcessCallOnce() -{ - // Mitigate the DLL injection attack - char system_dir[MAX_PATH]; - char kernel32_path[MAX_PATH]; - UINT len; - HINSTANCE hKernel32; - - // Get the full path of kernel32.dll - memset(system_dir, 0, sizeof(system_dir)); - GetSystemDirectory(system_dir, sizeof(system_dir)); - len = lstrlenA(system_dir); - if (system_dir[len] == '\\') - { - system_dir[len] = 0; - } - wsprintfA(kernel32_path, "%s\\kernel32.dll", system_dir); - - // Load kernel32.dll - hKernel32 = LoadLibraryA(kernel32_path); - if (hKernel32 != NULL) - { - BOOL (WINAPI *_SetDllDirectoryA)(LPCTSTR); - - _SetDllDirectoryA = (BOOL (WINAPI *)(LPCTSTR)) - GetProcAddress(hKernel32, "SetDllDirectoryA"); - - if (_SetDllDirectoryA != NULL) - { - _SetDllDirectoryA(""); - } - - FreeLibrary(hKernel32); - } -} - -// Collect the information of the VPN software -bool MsCollectVpnInfo(BUF *bat, char *tmpdir, char *svc_name, wchar_t *config_name, wchar_t *logdir_name) -{ - wchar_t *inst_dir; - char subkey[MAX_PATH]; - bool ret = false; - wchar_t tmpdir_w[MAX_PATH]; - // Validate arguments - if (bat == NULL || tmpdir == NULL || svc_name == NULL || config_name == NULL || logdir_name == NULL) - { - return false; - } - - StrToUni(tmpdir_w, sizeof(tmpdir_w), tmpdir); - - Format(subkey, sizeof(subkey), "SOFTWARE\\" GC_REG_COMPANY_NAME "\\Setup Wizard Settings\\%s", svc_name); - inst_dir = MsRegReadStrEx2W(REG_LOCAL_MACHINE, subkey, "InstalledDir", false, true); - if (UniIsEmptyStr(inst_dir) == false) - { - wchar_t config_src[MAX_PATH]; - wchar_t config_dst[MAX_PATH]; - wchar_t log_dir[MAX_PATH]; - DIRLIST *dir; - UINT64 max_dt_file = 0; - - // config file - CombinePathW(config_src, sizeof(config_src), inst_dir, config_name); - UniFormat(config_dst, sizeof(config_dst), L"%s\\%S_%s", tmpdir_w, svc_name, config_name); - ret = FileCopyExW(config_src, config_dst, false); - - // Log file - CombinePathW(log_dir, sizeof(log_dir), inst_dir, logdir_name); - - dir = EnumDirW(log_dir); - - if (dir != NULL) - { - UINT i; - DIRENT *latest_log = NULL; - - for (i = 0;i < dir->NumFiles;i++) - { - DIRENT *e = dir->File[i]; - - // Get the most recent file - if (max_dt_file <= e->UpdateDate) - { - max_dt_file = e->UpdateDate; - - latest_log = e; - } - } - - if (latest_log != NULL) - { - wchar_t fullpath[MAX_SIZE]; - IO *f; - - // Open the log file - CombinePathW(fullpath, sizeof(fullpath), log_dir, latest_log->FileNameW); - f = FileOpenExW(fullpath, false, false); - - if (f != NULL) - { - UINT size = FileSize(f); - - if (size >= 1) - { - UINT copy_size = 1024 * 1024; - UINT seek_size = 0; - UCHAR *buf; - - if (copy_size < size) - { - seek_size = size - copy_size; - } - else - { - copy_size = size; - } - - FileSeek(f, 0, seek_size); - - buf = Malloc(copy_size + 3); - buf[0] = 0xEF; - buf[1] = 0xBB; - buf[2] = 0xBF; - if (FileRead(f, buf + 3, copy_size)) - { - char log_dst_filename[MAX_PATH]; - - Format(log_dst_filename, sizeof(log_dst_filename), "%s\\lastlog_%s_%s", - tmpdir, svc_name, latest_log->FileName); - - SaveFile(log_dst_filename, buf, copy_size + 3); - } - - Free(buf); - } - - FileClose(f); - } - } - - FreeDir(dir); - } - } - Free(inst_dir); - - return ret; -} - -// Save the system information -bool MsSaveSystemInfo(wchar_t *dst_filename) -{ - char tmpdir[MAX_PATH]; - UCHAR rand_data[SHA1_SIZE]; - char rand_str[MAX_SIZE]; - char filename_bat[MAX_PATH]; - BUF *bat; - char tmp[MAX_PATH]; - char cmd[MAX_PATH]; - char cmd_arg[MAX_PATH]; - bool ret = false; - DIRLIST *dir; - UINT i; - // Validate arguments - if (dst_filename == NULL) - { - return false; - } - if (MsIsAdmin() == false || MsIsWin2000OrGreater() == false) - { - return false; - } - - Rand(rand_data, sizeof(rand_data)); - BinToStr(rand_str, sizeof(rand_str), rand_data, 4); - - // Create a temporary directory - Format(tmpdir, sizeof(tmpdir), "%s\\Temp\\se_support_%s", MsGetWindowsDir(), rand_str); - MakeDirEx(tmpdir); - - // Create a batch file - CombinePath(filename_bat, sizeof(filename_bat), tmpdir, "make_system_info.cmd"); - bat = NewBuf(); - - Format(tmp, sizeof(tmp), "systeminfo > %s\\SystemInfo.txt", tmpdir); - WriteBufLine(bat, tmp); - - Format(tmp, sizeof(tmp), "ipconfig > %s\\ipconfig.txt", tmpdir); - WriteBufLine(bat, tmp); - - Format(tmp, sizeof(tmp), "netsh dump > %s\\netsh.txt", tmpdir); - WriteBufLine(bat, tmp); - - Format(tmp, sizeof(tmp), "route print > %s\\route.txt", tmpdir); - WriteBufLine(bat, tmp); - - Format(tmp, sizeof(tmp), "netstat -nab > %s\\netstat_nab.txt", tmpdir); - WriteBufLine(bat, tmp); - - Format(tmp, sizeof(tmp), "netstat -nao > %s\\netstat_nao.txt", tmpdir); - WriteBufLine(bat, tmp); - - Format(tmp, sizeof(tmp), "netstat -na > %s\\netstat_na.txt", tmpdir); - WriteBufLine(bat, tmp); - - Format(tmp, sizeof(tmp), "netstat -fab > %s\\netstat_fab.txt", tmpdir); - WriteBufLine(bat, tmp); - - Format(tmp, sizeof(tmp), "netstat -fao > %s\\netstat_fao.txt", tmpdir); - WriteBufLine(bat, tmp); - - Format(tmp, sizeof(tmp), "netstat -fa > %s\\netstat_fa.txt", tmpdir); - WriteBufLine(bat, tmp); - - Format(tmp, sizeof(tmp), "netstat -ab > %s\\netstat_ab.txt", tmpdir); - WriteBufLine(bat, tmp); - - Format(tmp, sizeof(tmp), "netstat -ao > %s\\netstat_ao.txt", tmpdir); - WriteBufLine(bat, tmp); - - Format(tmp, sizeof(tmp), "netstat -a > %s\\netstat_a.txt", tmpdir); - WriteBufLine(bat, tmp); - - Format(tmp, sizeof(tmp), "\"%s\\Common Files\\Microsoft Shared\\MSInfo\\msinfo32.exe\" /report %s\\SystemInfo.txt", MsGetProgramFilesDir(), tmpdir); - WriteBufLine(bat, tmp); - - // Collect the information of the VPN software - MsCollectVpnInfo(bat, tmpdir, "vpnclient", L"vpn_client.config", L"client_log"); - MsCollectVpnInfo(bat, tmpdir, "vpnserver", L"vpn_server.config", L"server_log"); - MsCollectVpnInfo(bat, tmpdir, "vpnbridge", L"vpn_bridge.config", L"server_log"); - - MsCollectVpnInfo(bat, tmpdir, "sevpnclient", L"vpn_client.config", L"client_log"); - MsCollectVpnInfo(bat, tmpdir, "sevpnserver", L"vpn_server.config", L"server_log"); - MsCollectVpnInfo(bat, tmpdir, "sevpnbridge", L"vpn_bridge.config", L"server_log"); - - WriteBufLine(bat, ""); - - DumpBuf(bat, filename_bat); - - FreeBuf(bat); - - // Run the batch file - CombinePath(cmd, sizeof(cmd), MsGetSystem32Dir(), "cmd.exe"); - Format(cmd_arg, sizeof(cmd_arg), "/C %s", filename_bat); - if (Win32Run(cmd, cmd_arg, false, true)) - { - dir = EnumDir(tmpdir); - if (dir != NULL) - { - ZIP_PACKER *zip; - zip = NewZipPacker(); - - for (i = 0;i < dir->NumFiles;i++) - { - char *name = dir->File[i]->FileName; - char full[MAX_PATH]; - - CombinePath(full, sizeof(full), tmpdir, name); - - ZipAddRealFile(zip, name, SystemTime64(), 0, full); - } - FreeDir(dir); - - ret = ZipWriteW(zip, dst_filename); - FreeZipPacker(zip); - } - } - - // Delete the temporary directory - dir = EnumDir(tmpdir); - if (dir != NULL) - { - for (i = 0;i < dir->NumFiles;i++) - { - char *name = dir->File[i]->FileName; - char full[MAX_PATH]; - - CombinePath(full, sizeof(full), tmpdir, name); - - if (EndWith(full, ".txt") || EndWith(full, ".cmd") || EndWith(full, ".config") || EndWith(full, ".log")) - { - FileDelete(full); - } - } - FreeDir(dir); - } - DeleteDir(tmpdir); - - return ret; -} - -// Determine whether this is running in a VM -bool MsIsInVmMain() -{ - char *bat_data = "On Error Resume Next\r\n\r\nDim str\r\n\r\nSet wmi_svc = GetObject(\"winmgmts:{impersonationLevel=impersonate}!\\\\.\\root\\cimv2\")\r\n\r\nSet items = wmi_svc.ExecQuery(\"Select * from Win32_BaseBoard\")\r\n\r\nFor Each item in items\r\n str = str & item.Manufacturer\r\nNext\r\n\r\nSet items = Nothing\r\n\r\nSet items = wmi_svc.ExecQuery(\"Select * from Win32_ComputerSystem\")\r\n\r\nFor Each item in items\r\n str = str & item.Manufacturer\r\nNext\r\n\r\nSet items = Nothing\r\n\r\nSet wmi_svc = Nothing\r\n\r\nstr = LCase(str)\r\n\r\nDim ret\r\n\r\nret = 0\r\n\r\nif InStr(str, \"microsoft corporation\") > 0 then\r\n ret = 1\r\nend if\r\n\r\nif InStr(str, \"vmware\") > 0 then\r\n ret = 1\r\nend if\r\n\r\nif InStr(str, \"virtualbox\") > 0 then\r\n ret = 1\r\nend if\r\n\r\nif InStr(str, \"virtualpc\") > 0 then\r\n ret = 1\r\nend if\r\n\r\nif InStr(str, \"xen\") > 0 then\r\n ret = 1\r\nend if\r\n\r\nif InStr(str, \"hvm\") > 0 then\r\n ret = 1\r\nend if\r\n\r\nif InStr(str, \"domu\") > 0 then\r\n ret = 1\r\nend if\r\n\r\nif InStr(str, \"kvm\") > 0 then\r\n ret = 1\r\nend if\r\n\r\nif InStr(str, \"oracle vm\") > 0 then\r\n ret = 1\r\nend if\r\n\r\nif InStr(str, \"qemu\") > 0 then\r\n ret = 1\r\nend if\r\n\r\nif InStr(str, \"parallels\") > 0 then\r\n ret = 1\r\nend if\r\n\r\nif InStr(str, \"xvm\") > 0 then\r\n ret = 1\r\nend if\r\n\r\nif InStr(str, \"virtual\") > 0 then\r\n ret = 1\r\nend if\r\n\r\nif InStr(str, \"bochs\") > 0 then\r\n ret = 1\r\nend if\r\n\r\nwscript.quit ret\r\n\r\n"; - wchar_t bat_filename[MAX_SIZE]; - wchar_t cscript_exe[MAX_SIZE]; - wchar_t tmp[MAX_SIZE]; - void *process; - bool ret = false; - - if (MsIsNt() == false) - { - return false; - } - - if (MsIsWin2000OrGreater() == false) - { - return false; - } - - CombinePathW(bat_filename, sizeof(bat_filename), MsGetMyTempDirW(), L"detectvm.vbs"); - - if (DumpDataW(bat_data, StrLen(bat_data), bat_filename) == false) - { - return false; - } - - CombinePathW(cscript_exe, sizeof(cscript_exe), MsGetSystem32DirW(), L"cscript.exe"); - - UniFormat(tmp, sizeof(tmp), L"\"%s\"", bat_filename); - - process = Win32RunEx3W(cscript_exe, tmp, true, NULL, true); - - if (process == NULL) - { - return false; - } - - if (Win32WaitProcess(process, 30000)) - { - DWORD exit_code = 0; - - if (GetExitCodeProcess(process, &exit_code)) - { - if (exit_code == 1) - { - ret = true; - } - } - } - - Win32CloseProcess(process); - - return ret; -} -bool MsIsInVm() -{ - static bool flag_detected = false; - static bool flag_is_vm = false; - - if (flag_detected == false) - { - flag_is_vm = MsIsInVmMain(); - - flag_detected = true; - } - - return flag_is_vm; -} - -// Get the current module handle -void *MsGetCurrentModuleHandle() -{ - return ms->hInst; -} - -// Resource enumeration procedure -bool CALLBACK MsEnumResourcesInternalProc(HMODULE hModule, const char *type, char *name, LONG_PTR lParam) -{ - LIST *o = (LIST *)lParam; - // Validate arguments - if (type == NULL || name == NULL || o == NULL) - { - return true; - } - - Add(o, CopyStr(name)); - - return true; -} - -// Enumeration of resources -TOKEN_LIST *MsEnumResources(void *hModule, char *type) -{ - LIST *o; - TOKEN_LIST *ret; - // Validate arguments - if (hModule == NULL) - { - hModule = MsGetCurrentModuleHandle(); - } - if (type == NULL) - { - return NullToken(); - } - - o = NewListFast(NULL); - - if (EnumResourceNamesA(hModule, type, MsEnumResourcesInternalProc, (LONG_PTR)o) == false) - { - ReleaseList(o); - return NullToken(); - } - - ret = ListToTokenList(o); - - FreeStrList(o); - - return ret; -} - -// Get whether the locale ID of the current user is Japanese -bool MsIsCurrentUserLocaleIdJapanese() -{ - UINT lcid = MsGetUserLocaleId(); - - if (lcid == 1041) - { - return true; - } - - return false; -} - -// Get the locale ID of the user -UINT MsGetUserLocaleId() -{ - static UINT lcid_cache = 0; - - if (lcid_cache == 0) - { - lcid_cache = (UINT)GetUserDefaultLCID(); - } - - return lcid_cache; -} - -// Set a secure ACL to the specified file or directory -bool MsSetFileSecureAcl(wchar_t *path) -{ - SID *sid_system; - SID *sid_admin; - bool ret = false; - // Validate arguments - if (path == NULL) - { - return false; - } - if (ms->nt == NULL) - { - return false; - } - if (ms->nt->SetNamedSecurityInfoW == NULL || ms->nt->AddAccessAllowedAceEx == NULL) - { - return false; - } - - sid_system = MsGetSidFromAccountName("SYSTEM"); - sid_admin = MsGetSidFromAccountName("Administrators"); - - if (sid_system != NULL && sid_admin != NULL) - { - UINT acl_size = 4096; - ACL *acl; - - acl = ZeroMalloc(acl_size); - - if (InitializeAcl(acl, acl_size, 2)) - { - if (ms->nt->AddAccessAllowedAceEx(acl, 2, CONTAINER_INHERIT_ACE | OBJECT_INHERIT_ACE, GENERIC_ALL, sid_system) && - ms->nt->AddAccessAllowedAceEx(acl, 2, CONTAINER_INHERIT_ACE | OBJECT_INHERIT_ACE, GENERIC_ALL, sid_admin)) - { - if (ms->nt->SetNamedSecurityInfoW(path, SE_FILE_OBJECT, DACL_SECURITY_INFORMATION | PROTECTED_DACL_SECURITY_INFORMATION, NULL, NULL, acl, NULL) == ERROR_SUCCESS) - { - ret = true; - } - } - } - - Free(acl); - } - - MsFreeSid(sid_system); - MsFreeSid(sid_admin); - - return ret; -} - -// Disable the minimization function of the number of network connections by WCM -void MsDisableWcmNetworkMinimize() -{ - MS_WCM_POLICY_VALUE v; - bool b; - if (ms->nt == NULL) - { - return; - } - if (ms->nt->WcmQueryProperty == NULL || ms->nt->WcmSetProperty == NULL || ms->nt->WcmFreeMemory == NULL || ms->nt->WcmGetProfileList == NULL) - { - return; - } - - if (MsIsWindows8() == false) - { - return; - } - - Zero(&v, sizeof(v)); - v.fIsGroupPolicy = true; - v.fValue = false; - b = false; - ms->nt->WcmSetProperty(NULL, NULL, ms_wcm_global_property_minimize_policy, NULL, sizeof(v), (const BYTE *)&v); - ms->nt->WcmSetProperty(NULL, NULL, ms_wcm_global_property_minimize_policy, NULL, sizeof(b), (const BYTE *)&b); - - Zero(&v, sizeof(v)); - v.fIsGroupPolicy = true; - v.fValue = false; - b = false; - ms->nt->WcmSetProperty(NULL, NULL, ms_wcm_global_property_domain_policy, NULL, sizeof(v), (const BYTE *)&v); - ms->nt->WcmSetProperty(NULL, NULL, ms_wcm_global_property_domain_policy, NULL, sizeof(b), (const BYTE *)&b); - - Zero(&v, sizeof(v)); - v.fIsGroupPolicy = false; - v.fValue = false; - ms->nt->WcmSetProperty(NULL, NULL, ms_wcm_global_property_minimize_policy, NULL, sizeof(v), (const BYTE *)&v); - ms->nt->WcmSetProperty(NULL, NULL, ms_wcm_global_property_minimize_policy, NULL, sizeof(b), (const BYTE *)&b); - - Zero(&v, sizeof(v)); - v.fIsGroupPolicy = false; - v.fValue = false; - ms->nt->WcmSetProperty(NULL, NULL, ms_wcm_global_property_domain_policy, NULL, sizeof(v), (const BYTE *)&v); - ms->nt->WcmSetProperty(NULL, NULL, ms_wcm_global_property_domain_policy, NULL, sizeof(b), (const BYTE *)&b); -} - -// Request the MS-CHAPv2 authentication to the LSA -bool MsPerformMsChapV2AuthByLsa(char *username, UCHAR *challenge8, UCHAR *client_response_24, UCHAR *ret_pw_hash_hash) -{ - bool ret = false; - char user[MAX_SIZE]; - char domain[MAX_SIZE]; - wchar_t workstation[MAX_SIZE + 1]; - LSA_STRING origin; - MSV1_0_LM20_LOGON *m; - MS_MSCHAPV2_PARAMS *p; - UINT m_size; - DWORD sz; - void *profile_buffer = NULL; - LUID logon_id; - UINT profile_buffer_size = 0; - UINT i; - HANDLE hLogon = NULL; - QUOTA_LIMITS q; - char *origin_str = "SE-VPN"; - NTSTATUS sub_status = 0; - // Validate arguments - if (username == NULL || challenge8 == NULL || client_response_24 == NULL || ret_pw_hash_hash == NULL) - { - return false; - } - if (hLsa == NULL) - { - return false; - } - - ParseNtUsername(username, user, sizeof(user), domain, sizeof(domain), false); - - // Get the machine name - Zero(workstation, sizeof(workstation)); - sz = MAX_SIZE; - GetComputerNameW(workstation, &sz); - - // Build a MSV1_0_INTERACTIVE_LOGON - m_size = sizeof(MSV1_0_LM20_LOGON) + sizeof(MS_MSCHAPV2_PARAMS); - m = ZeroMalloc(m_size); - p = (MS_MSCHAPV2_PARAMS *)(((UCHAR *)m) + sizeof(MSV1_0_LM20_LOGON)); - - StrToUni(p->Username, sizeof(p->Username), user); - StrToUni(p->Domain, sizeof(p->Domain), domain); - UniStrCpy(p->Workstation, sizeof(p->Workstation), workstation); - Copy(p->ClientResponse24, client_response_24, 24); - - m->MessageType = MsV1_0Lm20Logon; - - // User name - m->UserName.Length = m->UserName.MaximumLength = (USHORT)(UniStrLen(p->Username) * sizeof(wchar_t)); - m->UserName.Buffer = p->Username; - - // Workstation name - m->Workstation.Length = m->Workstation.MaximumLength = (USHORT)(UniStrLen(p->Workstation) * sizeof(wchar_t)); - m->Workstation.Buffer = p->Workstation; - - // Domain name - if (IsEmptyUniStr(p->Domain) == false) - { - m->LogonDomainName.Length = m->LogonDomainName.MaximumLength = (USHORT)(UniStrLen(p->Domain) * sizeof(wchar_t)); - m->LogonDomainName.Buffer = p->Domain; - } - - // Challenge - Copy(m->ChallengeToClient, challenge8, 8); - - // Response - m->CaseInsensitiveChallengeResponse.Length = m->CaseInsensitiveChallengeResponse.MaximumLength = 24; - m->CaseInsensitiveChallengeResponse.Buffer = p->ClientResponse24; - - m->CaseSensitiveChallengeResponse.Length = m->CaseSensitiveChallengeResponse.MaximumLength = sizeof(p->ResponseBuffer); - m->CaseSensitiveChallengeResponse.Buffer = p->ResponseBuffer; - - m->ParameterControl = MSV1_0_ALLOW_MSVCHAPV2; - - Zero(&origin, sizeof(origin)); - origin.Length = origin.MaximumLength = StrLen(origin_str); - origin.Buffer = origin_str; - - Zero(&logon_id, sizeof(logon_id)); - Zero(&q, sizeof(q)); - - i = ms->nt->LsaLogonUser(hLsa, &origin, Network, lsa_package_id, m, m_size, NULL, &lsa_token_source, - &profile_buffer, &profile_buffer_size, &logon_id, &hLogon, &q, &sub_status); - - if (i == 0) - { - if (profile_buffer != NULL) - { - MSV1_0_LM20_LOGON_PROFILE *response = (MSV1_0_LM20_LOGON_PROFILE *)profile_buffer; - - Copy(ret_pw_hash_hash, response->UserSessionKey, 16); - - ret = true; - - ms->nt->LsaFreeReturnBuffer(profile_buffer); - } - CloseHandle(hLogon); - } - - Free(m); - - return ret; -} - -// Send a pulse -void MsSendGlobalPulse(void *p) -{ - HANDLE h; - // Validate arguments - if (p == NULL) - { - return; - } - - h = (HANDLE)p; - - PulseEvent(h); -} - -// Release a pulse -void MsCloseGlobalPulse(void *p) -{ - HANDLE h; - // Validate arguments - if (p == NULL) - { - return; - } - - h = (HANDLE)p; - - CloseHandle(h); -} - -// Wait for arriving the pulse -bool MsWaitForGlobalPulse(void *p, UINT timeout) -{ - HANDLE h; - UINT ret; - // Validate arguments - if (p == NULL) - { - return false; - } - if (timeout == TIMEOUT_INFINITE) - { - timeout = INFINITE; - } - - h = (HANDLE)p; - - ret = WaitForSingleObject(h, timeout); - - if (ret == WAIT_OBJECT_0) - { - return true; - } - - return false; -} - -// Open or create a pulse -void *MsOpenOrCreateGlobalPulse(char *name) -{ - UCHAR hash[20]; - char tmp[MAX_SIZE]; - char tmp2[MAX_SIZE]; - HANDLE h; - // Validate arguments - if (name == NULL) - { - return NULL; - } - - StrCpy(tmp, sizeof(tmp), name); - Trim(tmp); - StrUpper(tmp); - - Sha1(hash, name, StrLen(name)); - - BinToStr(tmp, sizeof(tmp), hash, sizeof(hash)); - - Format(tmp2, sizeof(tmp2), "GlobalPulse_%s", tmp); - - if (OS_IS_WINDOWS_NT(GetOsInfo()->OsType)) - { - if (GET_KETA(GetOsInfo()->OsType, 100) >= 2 || - GetOsInfo()->OsType == OSTYPE_WINDOWS_NT_4_TERMINAL_SERVER) - { - Format(tmp2, sizeof(tmp2), "Global\\GlobalPulse_%s", tmp); - } - } - - h = CreateEvent(NULL, true, false, tmp2); - - return (void *)h; -} - -// Stop the IPsec service -bool MsStopIPsecService() -{ - if (MsIsServiceRunning(MsGetIPsecServiceName())) - { - Debug("Stopping Windows Service: %s\n", MsGetIPsecServiceName()); - if (MsStopService(MsGetIPsecServiceName())) - { - return true; - } - } - - return false; -} - -// Start the IPsec service -bool MsStartIPsecService() -{ - if (MsIsServiceRunning(MsGetIPsecServiceName()) == false) - { - Debug("Starting Windows Service: %s\n", MsGetIPsecServiceName()); - return MsStartService(MsGetIPsecServiceName()); - } - - return false; -} - -// Get the IPsec service name -char *MsGetIPsecServiceName() -{ - char *svc_name = "PolicyAgent"; - - if (MsIsVista()) - { - svc_name = "ikeext"; - } - - return svc_name; -} - -// Initialize the global lock -void *MsInitGlobalLock(char *name, bool ts_local) -{ - char tmp[MAX_SIZE]; - HANDLE h; - // Validate arguments - if (name == NULL) - { - name = "default_global_lock"; - } - - if (ts_local) - { - HashInstanceNameLocal(tmp, sizeof(tmp), name); - } - else - { - HashInstanceName(tmp, sizeof(tmp), name); - } - - h = CreateMutexA(NULL, false, tmp); - if (h == NULL || h == INVALID_HANDLE_VALUE) - { - return NULL; - } - - return (void *)h; -} - -// Get a global lock -void MsGlobalLock(void *p) -{ - HANDLE h = (HANDLE)p; - // Validate arguments - if (h == NULL) - { - return; - } - - WaitForSingleObject(p, INFINITE); -} - -// Unlock the global lock -void MsGlobalUnlock(void *p) -{ - HANDLE h = (HANDLE)p; - // Validate arguments - if (h == NULL) - { - return; - } - - ReleaseMutex(h); -} - -// Release the global lock -void MsFreeGlobalLock(void *p) -{ - HANDLE h = (HANDLE)p; - // Validate arguments - if (h == NULL) - { - return; - } - - CloseHandle(h); -} - - -// Set the mode not to show the errors -void MsSetErrorModeToSilent() -{ - SetErrorMode(SEM_FAILCRITICALERRORS | SEM_NOGPFAULTERRORBOX | SEM_NOOPENFILEERRORBOX); -} - -// Get the file information -bool MsGetFileInformation(void *h, void *info) -{ - // Validate arguments - if (h == INVALID_HANDLE_VALUE || info == NULL) - { - return false; - } - - if (MsIsNt() == false) - { - return false; - } - - if (ms->nt->GetFileInformationByHandle == NULL) - { - return false; - } - - return ms->nt->GetFileInformationByHandle(h, info); -} - -// Set the shutdown parameters of the process -void MsSetShutdownParameters(UINT level, UINT flag) -{ - if (MsIsNt() == false) - { - return; - } - - if (ms->nt == false || ms->nt->SetProcessShutdownParameters == NULL) - { - return; - } - - ms->nt->SetProcessShutdownParameters(level, flag); -} - -// Get whether the version of the OS is Windows XP or Windows Vista or later -bool MsIsWinXPOrWinVista() -{ - OS_INFO *info = GetOsInfo(); - if (info == NULL) - { - return false; - } - - if (OS_IS_WINDOWS_NT(info->OsType) == false) - { - return false; - } - - if (GET_KETA(info->OsType, 100) >= 3) - { - return true; - } - - return false; -} - -// Restart of MMCSS -void MsRestartMMCSS() -{ - MsStopService("CTAudSvcService"); - MsStopService("audiosrv"); - MsStopService("MMCSS"); - MsStartService("MMCSS"); - MsStartService("audiosrv"); - MsStartService("CTAudSvcService"); -} - -// Enable / disable network throttling by MMCSS -void MsSetMMCSSNetworkThrottlingEnable(bool enable) -{ - UINT value; - if (MsIsVista() == false) - { - return; - } - - if (enable) - { - value = 0x0000000a; - } - else - { - value = 0xffffffff; - } - - MsRegWriteIntEx2(REG_LOCAL_MACHINE, MMCSS_PROFILE_KEYNAME, "NetworkThrottlingIndex", - value, - false, true); - - MsRestartMMCSS(); -} - -// Examine whether the Network throttling by MMCSS is enabled -bool MsIsMMCSSNetworkThrottlingEnabled() -{ - UINT value; - if (MsIsVista() == false) - { - return false; - } - - if (MsRegIsKeyEx2(REG_LOCAL_MACHINE, MMCSS_PROFILE_KEYNAME, false, true) == false) - { - return false; - } - - value = MsRegReadIntEx2(REG_LOCAL_MACHINE, MMCSS_PROFILE_KEYNAME, - "NetworkThrottlingIndex", false, true); - - if (value == 0) - { - return false; - } - - if (value == 0x0000000a) - { - return true; - } - - return false; -} - -typedef struct _ASTAT_ -{ - ADAPTER_STATUS adapt; - NAME_BUFFER NameBuff[30]; -} ASTAT, *PASTAT; - -// Get the precise time from the value of the high-resolution counter -double MsGetHiResTimeSpan(UINT64 diff) -{ - LARGE_INTEGER t; - UINT64 freq; - - if (QueryPerformanceFrequency(&t) == false) - { - freq = 1000ULL; - } - else - { - Copy(&freq, &t, sizeof(UINT64)); - } - - return (double)diff / (double)freq; -} -UINT64 MsGetHiResTimeSpanUSec(UINT64 diff) -{ - LARGE_INTEGER t; - UINT64 freq; - - if (QueryPerformanceFrequency(&t) == false) - { - freq = 1000ULL; - } - else - { - Copy(&freq, &t, sizeof(UINT64)); - } - - return (UINT64)(diff) * 1000ULL * 1000ULL / (UINT64)freq; -} - -// Get a high-resolution counter -UINT64 MsGetHiResCounter() -{ - LARGE_INTEGER t; - UINT64 ret; - - if (QueryPerformanceCounter(&t) == false) - { - return Tick64(); - } - - Copy(&ret, &t, sizeof(UINT64)); - - return ret; -} - -// System-wide updating notification -void MsUpdateSystem() -{ - static DWORD dw = 0; - - SendMessageTimeoutA(HWND_BROADCAST, WM_WININICHANGE, 0, 0, SMTO_NORMAL, 1, (PDWORD_PTR)&dw); - SleepThread(25); - SendMessageTimeoutA(HWND_BROADCAST, WM_SETTINGCHANGE, 0, (LPARAM)"Environment", SMTO_NORMAL, 1, (PDWORD_PTR)&dw); - SleepThread(25); - SHChangeNotify(SHCNE_GLOBALEVENTS, SHCNF_IDLIST | SHCNF_FLUSHNOWAIT | SHCNF_NOTIFYRECURSIVE, NULL, NULL); - SleepThread(25); - SHChangeNotify(SHCNE_GLOBALEVENTS, SHCNF_IDLIST, NULL, NULL); - SleepThread(25); - SHChangeNotify(SHCNE_ASSOCCHANGED, SHCNF_IDLIST | SHCNF_FLUSHNOWAIT | SHCNF_NOTIFYRECURSIVE, NULL, NULL); - SleepThread(25); - SHChangeNotify(SHCNE_ASSOCCHANGED, SHCNF_IDLIST, NULL, NULL); - SleepThread(25); - SHChangeNotify(SHCNE_ALLEVENTS, SHCNF_IDLIST | SHCNF_FLUSHNOWAIT | SHCNF_NOTIFYRECURSIVE, NULL, NULL); - SleepThread(25); - SHChangeNotify(SHCNE_ALLEVENTS, SHCNF_IDLIST, NULL, NULL); - SleepThread(25); -} - -// Wait for the process termination -UINT MsWaitProcessExit(void *process_handle) -{ - HANDLE h = (HANDLE)process_handle; - UINT ret = 1; - - if (h == NULL) - { - return 1; - } - - while (true) - { - WaitForSingleObject(h, INFINITE); - - ret = 1; - if (GetExitCodeProcess(h, &ret) == false) - { - break; - } - - if (ret != STILL_ACTIVE) - { - break; - } - } - - CloseHandle(h); - - return ret; -} - -// Execution of the file (to get process handle) -bool MsExecuteEx(char *exe, char *arg, void **process_handle) -{ - return MsExecuteEx2(exe, arg, process_handle, false); -} -bool MsExecuteEx2(char *exe, char *arg, void **process_handle, bool runas) -{ - SHELLEXECUTEINFO info; - HANDLE h; - // Validate arguments - if (exe == NULL || process_handle == NULL) - { - return false; - } - - Zero(&info, sizeof(info)); - info.cbSize = sizeof(info); - info.lpVerb = (runas ? "runas" : "open"); - info.lpFile = exe; - info.fMask = SEE_MASK_NOCLOSEPROCESS; - info.lpParameters = arg; - info.nShow = SW_SHOWNORMAL; - if (ShellExecuteEx(&info) == false) - { - return false; - } - - h = info.hProcess; - - *process_handle = (void *)h; - - return true; -} -bool MsExecuteEx2W(wchar_t *exe, wchar_t *arg, void **process_handle, bool runas) -{ - SHELLEXECUTEINFOW info; - HANDLE h; - // Validate arguments - if (exe == NULL || process_handle == NULL) - { - return false; - } - - if (IsNt() == false) - { - char exe_a[MAX_SIZE]; - char arg_a[MAX_SIZE]; - - UniToStr(exe_a, sizeof(exe_a), exe); - UniToStr(arg_a, sizeof(arg_a), arg); - - return MsExecuteEx(exe_a, arg_a, process_handle); - } - - Zero(&info, sizeof(info)); - info.cbSize = sizeof(info); - info.lpVerb = (runas ? L"runas" : L"open"); - info.lpFile = exe; - info.fMask = SEE_MASK_NOCLOSEPROCESS; - info.lpParameters = arg; - info.nShow = SW_SHOWNORMAL; - if (ShellExecuteExW(&info) == false) - { - return false; - } - - h = info.hProcess; - - *process_handle = (void *)h; - - return true; -} - -// Close the handle -void MsCloseHandle(void *handle) -{ - if (handle != NULL) - { - CloseHandle(handle); - } -} - -// Execution of the file -bool MsExecute(char *exe, char *arg) -{ - return MsExecute2(exe, arg, false); -} -bool MsExecute2(char *exe, char *arg, bool runas) -{ - DWORD d; - // Validate arguments - if (exe == NULL) - { - return false; - } - - d = (DWORD)ShellExecuteA(NULL, (runas ? "runas" : "open"), exe, arg, MsGetExeDirName(), SW_SHOWNORMAL); - - if (d > 32) - { - return true; - } - - return false; -} -bool MsExecuteW(wchar_t *exe, wchar_t *arg) -{ - return MsExecute2W(exe, arg, false); -} -bool MsExecute2W(wchar_t *exe, wchar_t *arg, bool runas) -{ - DWORD d; - // Validate arguments - if (exe == NULL) - { - return false; - } - - if (IsNt() == false) - { - char exe_a[MAX_SIZE]; - char arg_a[MAX_SIZE]; - - UniToStr(exe_a, sizeof(exe_a), exe); - UniToStr(arg_a, sizeof(arg_a), arg); - - return MsExecute(exe_a, arg_a); - } - - d = (DWORD)ShellExecuteW(NULL, (runas ? L"runas" : L"open"), exe, arg, MsGetExeDirNameW(), SW_SHOWNORMAL); - - if (d > 32) - { - return true; - } - - return false; -} - -// Recursive directory creation -void MsUniMakeDirEx(wchar_t *name) -{ - UINT wp; - wchar_t *tmp; - UINT i, len; - // Validate arguments - if (name == NULL) - { - return; - } - - tmp = ZeroMalloc(UniStrSize(name) * 2); - wp = 0; - len = UniStrLen(name); - for (i = 0;i < len;i++) - { - wchar_t c = name[i]; - - if (c == '\\') - { - if (UniStrCmpi(tmp, L"\\\\") != 0 && UniStrCmpi(tmp, L"\\") != 0) - { - MsUniMakeDir(tmp); - } - } - - tmp[wp++] = c; - } - - Free(tmp); - - MsUniMakeDir(name); -} - -// Create a directory -bool MsUniMakeDir(wchar_t *name) -{ - // Validate arguments - if (name == NULL) - { - return false; - } - - if (MsIsNt() == false) - { - char *s = CopyUniToStr(name); - bool ret = MsMakeDir(s); - Free(s); - return ret; - } - - return CreateDirectoryW(name, NULL); -} -bool MsMakeDir(char *name) -{ - // Validate arguments - if (name == NULL) - { - return false; - } - - return CreateDirectoryA(name, NULL); -} - -static wchar_t ms_computer_name_full_cache[MAX_SIZE] = {0}; - -// Get the full name of the computer -void MsGetComputerNameFullEx(wchar_t *name, UINT size, bool with_cache) -{ - UINT size2 = size; - // Validate arguments - UniStrCpy(name, size, L""); - if (name == NULL || size == 0) - { - return; - } - - if (with_cache) - { - if (UniIsEmptyStr(ms_computer_name_full_cache) == false) - { - UniStrCpy(name, size, ms_computer_name_full_cache); - return; - } - } - - if (MsIsNt() == false || ms->nt->GetComputerNameExW == NULL || - ms->nt->GetComputerNameExW(ComputerNameDnsFullyQualified, name, &size2) == false) - { - char tmp[MAX_SIZE]; - - MsGetComputerName(tmp, sizeof(tmp)); - - StrToUni(name, size, tmp); - } - - if (with_cache) - { - UniStrCpy(ms_computer_name_full_cache, sizeof(ms_computer_name_full_cache), name); - } -} - -// Get the computer name -void MsGetComputerName(char *name, UINT size) -{ - DWORD sz; - // Validate arguments - if (name == NULL) - { - return; - } - - sz = size; - GetComputerName(name, &sz); -} - -// Get the hash value of the position of the mouse cursor -UINT MsGetCursorPosHash() -{ - POINT p; - - Zero(&p, sizeof(p)); - - if (GetCursorPos(&p) == false) - { - return 0; - } - - return MAKELONG((USHORT)p.x, (USHORT)p.y); -} - -// Start the process as a standard user privileges -void *MsRunAsUserExW(wchar_t *filename, wchar_t *arg, bool hide) -{ - void *ret = MsRunAsUserExInnerW(filename, arg, hide); - - if (ret == NULL) - { - Debug("MsRunAsUserExInner Failed.\n"); - ret = Win32RunExW(filename, arg, hide); - } - - return ret; -} -void *MsRunAsUserExInnerW(wchar_t *filename, wchar_t *arg, bool hide) -{ - STARTUPINFOW info; - PROCESS_INFORMATION ret; - wchar_t cmdline[MAX_SIZE]; - wchar_t name[MAX_PATH]; - HANDLE hToken; - // Validate arguments - if (filename == NULL) - { - return NULL; - } - - if (MsIsVista() == false) - { - // Can not be used in non-Windows Vista - return NULL; - } - - UniStrCpy(name, sizeof(name), filename); - UniTrim(name); - - if (UniSearchStr(name, L"\"", 0) == INFINITE) - { - if (arg == NULL) - { - UniFormat(cmdline, sizeof(cmdline), L"%s", name); - } - else - { - UniFormat(cmdline, sizeof(cmdline), L"%s %s", name, arg); - } - } - else - { - if (arg == NULL) - { - UniFormat(cmdline, sizeof(cmdline), L"\"%s\"", name); - } - else - { - UniFormat(cmdline, sizeof(cmdline), L"\"%s\" %s", name, arg); - } - } - - Zero(&info, sizeof(info)); - Zero(&ret, sizeof(ret)); - info.cb = sizeof(info); - info.dwFlags = STARTF_USESHOWWINDOW; - info.wShowWindow = (hide == false ? SW_SHOWDEFAULT : SW_HIDE); - - UniTrim(cmdline); - - hToken = MsCreateUserToken(); - - if (hToken == NULL) - { - return NULL; - } - - if (ms->nt->CreateProcessAsUserW(hToken, NULL, cmdline, NULL, NULL, FALSE, - (hide == false ? CREATE_NEW_CONSOLE : CREATE_NO_WINDOW | CREATE_NEW_CONSOLE) | NORMAL_PRIORITY_CLASS, - NULL, NULL, &info, &ret) == FALSE) - { - return NULL; - } - - CloseHandle(hToken); - - CloseHandle(ret.hThread); - return ret.hProcess; -} - -// Get the SID from the account name -SID *MsGetSidFromAccountName(char *name) -{ - SID *sid; - UINT sid_size = 4096; - char *domain_name; - UINT domain_name_size = 4096; - SID_NAME_USE use = SidTypeUser; - // Validate arguments - if (name == NULL) - { - return NULL; - } - - if (MsIsNt() == false) - { - return NULL; - } - - sid = ZeroMalloc(sid_size); - domain_name = ZeroMalloc(domain_name_size); - - if (ms->nt->LookupAccountNameA(NULL, name, sid, &sid_size, domain_name, &domain_name_size, &use) == false) - { - Free(sid); - Free(domain_name); - return NULL; - } - - Free(domain_name); - - return sid; -} - -// Release the SID -void MsFreeSid(SID *sid) -{ - // Validate arguments - if (sid == NULL) - { - return; - } - - Free(sid); -} - -// Create a token of standard user -HANDLE MsCreateUserToken() -{ - char *medium_sid = "S-1-16-8192"; - char *administrators_sid = "S-1-5-32-544"; - SID *sid = NULL; - TOKEN_MANDATORY_LABEL til; - HANDLE hCurrentToken, hNewToken; - if (MsIsNt() == false) - { - return NULL; - } - if (ms->nt->ConvertStringSidToSidA == NULL || - ms->nt->OpenProcessToken == NULL || - ms->nt->DuplicateTokenEx == NULL || - ms->nt->GetTokenInformation == NULL || - ms->nt->SetTokenInformation == NULL) - { - return NULL; - } - - Zero(&til, sizeof(til)); - - if (ms->nt->ConvertStringSidToSidA(medium_sid, &sid) == false) - { - return NULL; - } - - til.Label.Attributes = SE_GROUP_INTEGRITY; - til.Label.Sid = sid; - - if (ms->nt->OpenProcessToken(GetCurrentProcess(), MAXIMUM_ALLOWED, &hCurrentToken) == false) - { - LocalFree(sid); - return NULL; - } - - if (ms->nt->DuplicateTokenEx(hCurrentToken, MAXIMUM_ALLOWED, NULL, - SecurityImpersonation, TokenPrimary, &hNewToken) == false) - { - CloseHandle(hCurrentToken); - LocalFree(sid); - return NULL; - } - - if (ms->nt->SetTokenInformation(hNewToken, VistaTokenIntegrityLevel, &til, - sizeof(TOKEN_MANDATORY_LABEL) + GetLengthSid(sid)) == false) - { - CloseHandle(hNewToken); - CloseHandle(hCurrentToken); - LocalFree(sid); - return NULL; - } - - CloseHandle(hCurrentToken); - LocalFree(sid); - - return hNewToken; -} - -// Check whether SHA-2 kernel mode signature is supported -bool MsIsSha2KernelModeSignatureSupported() -{ - HINSTANCE hDll; - bool ret = false; - - if (MsIsWindows8()) - { - return true; - } - - hDll = LoadLibrary("Wintrust.dll"); - if (hDll == NULL) - { - return false; - } - - if (GetProcAddress(hDll, "CryptCATAdminAcquireContext2") != NULL) - { - ret = true; - } - - FreeLibrary(hDll); - - return ret; -} - -// Check whether KB3033929 is required -bool MsIsKB3033929RequiredAndMissing() -{ - OS_INFO *info = GetOsInfo(); - - if (info == NULL) - { - return false; - } - - if (OS_IS_WINDOWS_NT(info->OsType)) - { - if (GET_KETA(info->OsType, 100) == 6) - { - if (MsIsX64()) - { - if (MsIsSha2KernelModeSignatureSupported() == false) - { - return true; - } - } - } - } - - return false; -} - -// Check the digital signature of the file -bool MsCheckFileDigitalSignatureW(HWND hWnd, wchar_t *name, bool *danger) -{ - HRESULT ret = S_OK; - wchar_t *tmp; - LONG (WINAPI *_WinVerifyTrust)(HWND, GUID *, LPVOID) = NULL; - HINSTANCE hDll; - // Validate arguments - if (name == NULL) - { - return false; - } - - if (danger != NULL) - { - *danger = false; - } - - tmp = name; - - hDll = LoadLibrary("Wintrust.dll"); - if (hDll == NULL) - { - return false; - } - - _WinVerifyTrust = - (LONG (__stdcall *)(HWND,GUID *,LPVOID)) - GetProcAddress(hDll, "WinVerifyTrust"); - if (_WinVerifyTrust == NULL) - { - FreeLibrary(hDll); - return false; - } - else - { - GUID action_id = WINTRUST_ACTION_GENERIC_VERIFY_V2; - WINTRUST_FILE_INFO file; - WINTRUST_DATA data; - - Zero(&file, sizeof(file)); - file.cbStruct = sizeof(file); - file.pcwszFilePath = tmp; - - Zero(&data, sizeof(data)); - data.cbStruct = sizeof(data); - data.fdwRevocationChecks = WTD_REVOKE_WHOLECHAIN; - data.dwUIChoice = (hWnd != NULL ? WTD_UI_NOGOOD : WTD_UI_NONE); - data.dwProvFlags = WTD_REVOCATION_CHECK_CHAIN; - data.dwUnionChoice = WTD_CHOICE_FILE; - data.pFile = &file; - - ret = _WinVerifyTrust(hWnd, &action_id, &data); - - if (ret == ERROR_SUCCESS && danger != NULL) - { - if (hWnd != NULL) - { - if (MsCheckFileDigitalSignatureW(NULL, name, NULL) == false) - { - // It's a dangerous file, but the user had to select the [OK] - *danger = true; - } - } - } - } - - FreeLibrary(hDll); - - if (ret != ERROR_SUCCESS) - { - return false; - } - - return true; -} - -// Disable the WoW64 redirection -void *MsDisableWow64FileSystemRedirection() -{ - void *p = NULL; - if (MsIs64BitWindows() == false) - { - return NULL; - } - - if (ms->nt->Wow64DisableWow64FsRedirection == NULL || - ms->nt->Wow64RevertWow64FsRedirection == NULL) - { - return NULL; - } - - if (ms->nt->Wow64DisableWow64FsRedirection(&p) == false) - { - return NULL; - } - - if (p == NULL) - { - p = (void *)0x12345678; - } - - return p; -} - -// Restore the WoW64 redirection -void MsRestoreWow64FileSystemRedirection(void *p) -{ - // Validate arguments - if (p == NULL) - { - return; - } - if (p == (void *)0x12345678) - { - p = NULL; - } - if (MsIs64BitWindows() == false) - { - return; - } - - if (ms->nt->Wow64DisableWow64FsRedirection == NULL || - ms->nt->Wow64RevertWow64FsRedirection == NULL) - { - return; - } - - ms->nt->Wow64RevertWow64FsRedirection(p); -} - -// Get whether the x64 version of Windows is currently running -bool MsIsX64() -{ - SYSTEM_INFO info; - - if (MsIs64BitWindows() == false) - { - return false; - } - if (ms->nt->GetNativeSystemInfo == NULL) - { - return false; - } - - Zero(&info, sizeof(info)); - ms->nt->GetNativeSystemInfo(&info); - - if (info.wProcessorArchitecture == PROCESSOR_ARCHITECTURE_AMD64) - { - return true; - } - - return false; -} - -// Get whether the IA64 version of Windows is currently running -bool MsIsIA64() -{ - if (MsIs64BitWindows() == false) - { - return false; - } - - if (MsIsX64()) - { - return false; - } - - return true; -} - -// Acquisition whether it's a 64bit Windows -bool MsIs64BitWindows() -{ - if (Is64()) - { - return true; - } - else - { - if (MsIsNt() == false) - { - return false; - } - else - { - if (ms == NULL || ms->nt == NULL) - { - return false; - } - - if (ms->nt->IsWow64Process == NULL) - { - return false; - } - else - { - bool b = false; - if (ms->nt->IsWow64Process(GetCurrentProcess(), &b) == false) - { - return false; - } - return b; - } - } - } -} - -// Windows Firewall registration -void MsRegistWindowsFirewallEx2(char *title, char *exe, char *dir) -{ - char tmp[MAX_PATH]; - // Validate arguments - if (title == NULL || exe == NULL) - { - return; - } - if (dir == NULL || IsEmptyStr(dir)) - { - dir = MsGetExeDirName(); - } - - ConbinePath(tmp, sizeof(tmp), dir, exe); - - if (IsFileExists(tmp) == false) - { - return; - } - - MsRegistWindowsFirewallEx(title, tmp); -} -void MsRegistWindowsFirewallEx(char *title, char *exe) -{ - char *data = - "Option Explicit\r\nConst NET_FW_PROFILE_DOMAIN = 0\r\nConst NET_FW_PROFILE_STANDARD = 1\r\n" - "Const NET_FW_SCOPE_ALL = 0\r\nConst NET_FW_IP_VERSION_ANY = 2\r\nDim fwMgr\r\n" - "Set fwMgr = CreateObject(\"HNetCfg.FwMgr\")\r\nDim profile\r\n" - "Set profile = fwMgr.LocalPolicy.CurrentProfile\r\nDim app\r\n" - "Set app = CreateObject(\"HNetCfg.FwAuthorizedApplication\")\r\n" - "app.ProcessImageFileName = \"$PATH$\"\r\napp.Name = \"$TITLE$\"\r\n" - "app.Scope = NET_FW_SCOPE_ALL\r\napp.IpVersion = NET_FW_IP_VERSION_ANY\r\n" - "app.Enabled = TRUE\r\nOn Error Resume Next\r\nprofile.AuthorizedApplications." - "Add app\r\n"; - char *tmp; - UINT tmp_size; - char filename[MAX_PATH]; - char cscript[MAX_PATH]; - char arg[MAX_PATH]; - UINT ostype; - IO *o; - char hash[MAX_PATH]; - UCHAR hashbin[SHA1_SIZE]; - UCHAR file_hash_bin[SHA1_SIZE]; - char file_hash_str[MAX_SIZE]; - // Validate arguments - if (title == NULL || exe == NULL) - { - return; - } - - // OS check (This Is not performed except Windows XP, Windows Server 2003, Windows Vista or later) - ostype = GetOsInfo()->OsType; - if (OS_IS_WINDOWS_NT(ostype) == false) - { - return; - } - if (MsIsAdmin() == false) - { - return; - } - - if (MsIsVista()) - { - data = "Option Explicit\r\n\r\nConst PROFILES_ALL = 7\r\nConst NET_FW_ACTION_ALLOWNET_FW_ACTION_ALLOW = 1\r\n" - "\r\nDim policy2\r\nDim rules\r\nDim new_rule\r\n\r\nOn Error Resume Next\r\n\r\n" - "Set policy2 = CreateObject(\"HNetCfg.FwPolicy2\")\r\nSet rules = policy2.Rules\r\n" - "Set new_rule = CreateObject(\"HNetCfg.FWRule\")\r\nnew_rule.Name = \"$TITLE$\"\r\n" - "new_rule.Description = \"$TITLE$\"\r\nnew_rule.ApplicationName = \"$PATH$\"\r\n" - "new_rule.Enabled = TRUE\r\nnew_rule.Profiles = PROFILES_ALL\r\nnew_rule.Action = " - "NET_FW_ACTION_ALLOWNET_FW_ACTION_ALLOW\r\nrules.Add new_rule\r\n\r\n"; - } - - tmp_size = StrLen(data) * 4; - tmp = ZeroMalloc(tmp_size); - - Sha1(hashbin, exe, StrLen(exe)); - BinToStr(hash, sizeof(hash), hashbin, 6); - - ReplaceStrEx(tmp, tmp_size, data, "$TITLE$", title, false); - ReplaceStrEx(tmp, tmp_size, tmp, "$PATH$", exe, false); - - Sha1(file_hash_bin, tmp, StrLen(tmp)); - BinToStr(file_hash_str, sizeof(file_hash_str), file_hash_bin, sizeof(file_hash_bin)); - - if (MsIsVista() == false || MsRegReadIntEx2(REG_LOCAL_MACHINE, SOFTETHER_FW_SCRIPT_HASH, file_hash_str, false, true) == 0) - { - Format(filename, sizeof(filename), "%s\\winfire_%s.vbs", MsGetMyTempDir(), hash); - o = FileCreate(filename); - FileWrite(o, tmp, StrLen(tmp)); - FileClose(o); - - Format(cscript, sizeof(cscript), "%s\\cscript.exe", MsGetSystem32Dir()); - Format(arg, sizeof(arg), "\"%s\"", filename); - - if (Run(cscript, arg, true, false)) - { - MsRegWriteIntEx2(REG_LOCAL_MACHINE, SOFTETHER_FW_SCRIPT_HASH, file_hash_str, 1, false, true); - } - - Debug("cscript %s\n", arg); - } - - Free(tmp); -} - -// Run driver installer for Vista -bool MsExecDriverInstaller(char *arg) -{ - wchar_t tmp[MAX_PATH]; - wchar_t hamcore_dst[MAX_PATH]; - wchar_t hamcore_src[MAX_PATH]; - wchar_t lang_config_src[MAX_PATH]; - wchar_t lang_config_dst[MAX_PATH]; - HANDLE h; - UINT retcode; - SHELLEXECUTEINFOW info; - wchar_t *arg_w; - // Validate arguments - if (arg == NULL) - { - return false; - } - - UniFormat(hamcore_dst, sizeof(hamcore_dst), L"%s\\hamcore.se2", MsGetMyTempDirW()); - UniFormat(hamcore_src, sizeof(hamcore_src), L"%s\\hamcore.se2", MsGetExeDirNameW()); - - // Extract the File - UniFormat(tmp, sizeof(tmp), VISTA_DRIVER_INSTALLER_DST, MsGetMyTempDirW()); - - if (FileCopyW(VISTA_DRIVER_INSTALLER_SRC, tmp) == false) - { - return false; - } - - if (FileCopyW(hamcore_src, hamcore_dst) == false) - { - return false; - } - - ConbinePathW(lang_config_src, sizeof(lang_config_src), MsGetExeDirNameW(), L"lang.config"); - ConbinePathW(lang_config_dst, sizeof(lang_config_dst), MsGetMyTempDirW(), L"lang.config"); - FileCopyW(lang_config_src, lang_config_dst); - - arg_w = CopyStrToUni(arg); - - // Run - Zero(&info, sizeof(info)); - info.cbSize = sizeof(info); - info.lpVerb = L"open"; - info.lpFile = tmp; - info.fMask = SEE_MASK_NOCLOSEPROCESS; - info.lpParameters = arg_w; - info.nShow = SW_SHOWNORMAL; - if (ShellExecuteExW(&info) == false) - { - Free(arg_w); - return false; - } - - Free(arg_w); - - h = info.hProcess; - retcode = 1; - - while (true) - { - // Wait for completion - WaitForSingleObject(h, INFINITE); - - // Get the exit code - retcode = 1; - if (GetExitCodeProcess(h, &retcode) == false) - { - break; - } - - if (retcode != STILL_ACTIVE) - { - break; - } - } - - CloseHandle(h); - - if (retcode & 1) - { - return false; - } - - return true; -} - -// Get the locale of the current thread -UINT MsGetThreadLocale() -{ - return (UINT)GetThreadLocale(); -} - -// Set the width of the current console -UINT MsSetConsoleWidth(UINT size) -{ - HANDLE h = GetStdHandle(STD_OUTPUT_HANDLE); - CONSOLE_SCREEN_BUFFER_INFO info; - COORD c; - UINT old_x, old_y; - // Validate arguments - if (size == 0) - { - return 0; - } - if (h == INVALID_HANDLE_VALUE) - { - return 0; - } - - Zero(&info, sizeof(info)); - if (GetConsoleScreenBufferInfo(h, &info) == false) - { - return 0; - } - - old_x = info.dwSize.X; - old_y = info.dwSize.Y; - - c.X = size; - c.Y = old_y; - - SetConsoleScreenBufferSize(h, c); - - return old_x; -} - -// Get the width of the current console -UINT MsGetConsoleWidth() -{ - HANDLE h = GetStdHandle(STD_OUTPUT_HANDLE); - CONSOLE_SCREEN_BUFFER_INFO info; - - if (h == INVALID_HANDLE_VALUE) - { - return 80; - } - - Zero(&info, sizeof(info)); - if (GetConsoleScreenBufferInfo(h, &info) == false) - { - return 80; - } - - return info.dwSize.X; -} - -// Disable the MS-IME -bool MsDisableIme() -{ - HINSTANCE h; - bool ret = false; - char dll_name[MAX_PATH]; - BOOL (WINAPI *_ImmDisableIME)(DWORD); - - Format(dll_name, sizeof(dll_name), "%s\\imm32.dll", MsGetSystem32Dir()); - h = MsLoadLibrary(dll_name); - if (h == NULL) - { - return false; - } - - _ImmDisableIME = (BOOL (__stdcall *)(DWORD))GetProcAddress(h, "ImmDisableIME"); - - if (_ImmDisableIME != NULL) - { - ret = _ImmDisableIME(-1); - } - - FreeLibrary(h); - - return ret; -} - -// Display the current time -void MsPrintTick() -{ - UINT tick = timeGetTime(); - static UINT tick_init = 0; - if (tick_init == 0) - { - tick_init = tick; - tick = 0; - } - else - { - tick -= tick_init; - } - - printf("[%u]\n", tick); -} - -// LoadLibrary compatible for hamcore (Read as a data file) -void *MsLoadLibraryAsDataFileW(wchar_t *name) -{ - BUF *b; - wchar_t tmp_dll_name[MAX_SIZE]; - char hash_str[MAX_SIZE]; - UCHAR hash[SHA1_SIZE]; - // Validate arguments - if (name == NULL) - { - return NULL; - } - - Sha0(hash, name, UniStrLen(name)); - - BinToStr(hash_str, sizeof(hash_str), hash, 4); - - UniFormat(tmp_dll_name, sizeof(tmp_dll_name), L"%s\\%S.dll", MsGetMyTempDirW(), hash_str); - - if (IsFileExistsW(tmp_dll_name) == false) - { - b = ReadDumpW(name); - if (b == NULL) - { - return NULL; - } - - DumpBufW(b, tmp_dll_name); - FreeBuf(b); - } - - return LoadLibraryExW(tmp_dll_name, NULL, LOAD_LIBRARY_AS_DATAFILE); -} -void *MsLoadLibraryAsDataFile(char *name) -{ - wchar_t name_w[MAX_SIZE]; - // Validate arguments - if (name == NULL) - { - return NULL; - } - - StrToUni(name_w, sizeof(name_w), name); - - return MsLoadLibraryAsDataFileW(name_w); -} - -// LoadLibrary (compatible for Hamcore) -void *MsLoadLibraryW(wchar_t *name) -{ - BUF *b; - wchar_t tmp_dll_name[MAX_SIZE]; - char hash_str[MAX_SIZE]; - UCHAR hash[SHA1_SIZE]; - // Validate arguments - if (name == NULL) - { - return NULL; - } - - Sha0(hash, name, UniStrSize(name)); - - BinToStr(hash_str, sizeof(hash_str), hash, 4); - - UniFormat(tmp_dll_name, sizeof(tmp_dll_name), L"%s\\%S.dll", MsGetMyTempDirW(), hash_str); - - if (IsFileExistsW(tmp_dll_name) == false) - { - b = ReadDumpW(name); - if (b == NULL) - { - return NULL; - } - - DumpBufW(b, tmp_dll_name); - FreeBuf(b); - } - - if (IsNt()) - { - return LoadLibraryW(tmp_dll_name); - } - else - { - char tmp_dll_name_a[MAX_SIZE]; - HINSTANCE ret; - - UniToStr(tmp_dll_name_a, sizeof(tmp_dll_name_a), tmp_dll_name); - - ret = LoadLibraryA(tmp_dll_name_a); - - return ret; - } -} -void *MsLoadLibrary(char *name) -{ - wchar_t name_w[MAX_SIZE]; - // Validate arguments - if (name == NULL) - { - return NULL; - } - - StrToUni(name_w, sizeof(name_w), name); - - return MsLoadLibraryW(name_w); -} - -// Search for the adapter by GUID -MS_ADAPTER *MsGetAdapterByGuid(char *guid) -{ - MS_ADAPTER_LIST *o; - MS_ADAPTER *ret = NULL; - // Validate arguments - if (guid == NULL) - { - return NULL; - } - - o = MsCreateAdapterList(); - if (o == NULL) - { - return NULL; - } - - ret = MsGetAdapterByGuidFromList(o, guid); - - MsFreeAdapterList(o); - - return ret; -} -MS_ADAPTER *MsGetAdapterByGuidFromList(MS_ADAPTER_LIST *o, char *guid) -{ - MS_ADAPTER *ret = NULL; - UINT i; - // Validate arguments - if (o == NULL || guid == NULL) - { - return NULL; - } - - for (i = 0;i < o->Num;i++) - { - if (StrCmpi(o->Adapters[i]->Guid, guid) == 0) - { - ret = MsCloneAdapter(o->Adapters[i]); - break; - } - } - - return ret; -} - -// Get a single adapter -MS_ADAPTER *MsGetAdapter(char *title) -{ - MS_ADAPTER_LIST *o; - MS_ADAPTER *ret = NULL; - UINT i; - // Validate arguments - if (title == NULL) - { - return NULL; - } - - o = MsCreateAdapterList(); - if (o == NULL) - { - return NULL; - } - - for (i = 0;i < o->Num;i++) - { - if (StrCmpi(o->Adapters[i]->Title, title) == 0) - { - ret = MsCloneAdapter(o->Adapters[i]); - break; - } - } - - MsFreeAdapterList(o); - - return ret; -} - -// 32-bit overflow checking -#define CHECK_32BIT_OVERFLOW(old_value, new_value) \ -{ \ - if ((old_value) > (new_value)) \ - { \ - (new_value) += ((UINT64)4294967296ULL); \ - } \ -} - -// Get the TCP/IP information of the specified adapter -void MsGetAdapterTcpIpInformation(MS_ADAPTER *a) -{ - IP_ADAPTER_INFO *info, *info_top; - UINT info_size; - UINT ret; - // Validate arguments - if (a == NULL) - { - return; - } - - if (w32net->GetAdaptersInfo == NULL) - { - return; - } - - info_top = ZeroMalloc(sizeof(IP_ADAPTER_INFO)); - info_size = sizeof(IP_ADAPTER_INFO); - - ret = w32net->GetAdaptersInfo(info_top, &info_size); - if (ret == ERROR_INSUFFICIENT_BUFFER || ret == ERROR_BUFFER_OVERFLOW) - { - Free(info_top); - info_size *= 2; - info_top = ZeroMalloc(info_size); - - if (w32net->GetAdaptersInfo(info_top, &info_size) != NO_ERROR) - { - Free(info_top); - return; - } - } - else if (ret != NO_ERROR) - { - Free(info_top); - return; - } - - // Search for their own entry - info = info_top; - - while (info != NULL) - { - if (info->Index == a->Index) - { - IP_ADDR_STRING *s; - - // IP address - a->NumIpAddress = 0; - s = &info->IpAddressList; - while (s != NULL) - { - if (a->NumIpAddress < MAX_MS_ADAPTER_IP_ADDRESS) - { - StrToIP(&a->IpAddresses[a->NumIpAddress], s->IpAddress.String); - StrToIP(&a->SubnetMasks[a->NumIpAddress], s->IpMask.String); - a->NumIpAddress++; - } - s = s->Next; - } - - // Gateway - a->NumGateway = 0; - s = &info->GatewayList; - while (s != NULL) - { - if (a->NumGateway < MAX_MS_ADAPTER_IP_ADDRESS) - { - StrToIP(&a->Gateways[a->NumGateway], s->IpAddress.String); - a->NumGateway++; - } - s = s->Next; - } - - // DHCP Server - a->UseDhcp = (info->DhcpEnabled == 0 ? false : true); - if (a->UseDhcp) - { - SYSTEMTIME st; - - StrToIP(&a->DhcpServer, info->DhcpServer.IpAddress.String); - TimeToSystem(&st, info->LeaseObtained); - a->DhcpLeaseStart = SystemToUINT64(&st); - - TimeToSystem(&st, info->LeaseExpires); - a->DhcpLeaseExpires = SystemToUINT64(&st); - } - - // WINS server - a->UseWins = info->HaveWins; - if (a->UseWins) - { - StrToIP(&a->PrimaryWinsServer, info->PrimaryWinsServer.IpAddress.String); - StrToIP(&a->SecondaryWinsServer, info->SecondaryWinsServer.IpAddress.String); - } - - StrCpy(a->Guid, sizeof(a->Guid), info->AdapterName); - - a->Info = true; - - break; - } - - info = info->Next; - } - - Free(info_top); -} - -// Generation of adapter list -MS_ADAPTER_LIST *MsCreateAdapterList() -{ - return MsCreateAdapterListEx(false); -} -MS_ADAPTER_LIST *MsCreateAdapterListEx(bool no_info) -{ - MS_ADAPTER_LIST *ret; - - if (no_info) - { - ret = MsCreateAdapterListInnerEx(true); - - return ret; - } - - Lock(lock_adapter_list); - { - MS_ADAPTER_LIST *old = last_adapter_list; - UINT i; - - // Fetch a new adapter list - ret = MsCreateAdapterListInner(); - - if (ret == NULL) - { - Unlock(lock_adapter_list); - return NULL; - } - - // Check whether the previously acquired item exists for each entry - // in the list of adapters have been taken - for (i = 0;i < ret->Num;i++) - { - UINT j; - for (j = 0;j < old->Num;j++) - { - MS_ADAPTER *o = old->Adapters[j]; - MS_ADAPTER *n = ret->Adapters[i]; - - if (StrCmpi(o->Title, n->Title) == 0) - { - // If the value of older item is small, increment it - CHECK_32BIT_OVERFLOW(o->RecvBytes, n->RecvBytes); - CHECK_32BIT_OVERFLOW(o->RecvPacketsBroadcast, n->RecvPacketsBroadcast); - CHECK_32BIT_OVERFLOW(o->RecvPacketsUnicast, n->RecvPacketsUnicast); - CHECK_32BIT_OVERFLOW(o->SendBytes, n->SendBytes); - CHECK_32BIT_OVERFLOW(o->SendPacketsBroadcast, n->SendPacketsBroadcast); - CHECK_32BIT_OVERFLOW(o->SendPacketsUnicast, n->SendPacketsUnicast); - break; - } - } - } - - // Release the old adapter list - MsFreeAdapterList(old); - - // Save a clone of the adapter list that newly acquired - last_adapter_list = MsCloneAdapterList(ret); - } - Unlock(lock_adapter_list); - - return ret; -} - -// Initialization of the adapter module list -void MsInitAdapterListModule() -{ - lock_adapter_list = NewLock(NULL); - - last_adapter_list = MsCreateAdapterListInner(); -} - -// Release of the adapter module list -void MsFreeAdapterListModule() -{ - if (last_adapter_list != NULL) - { - MsFreeAdapterList(last_adapter_list); - last_adapter_list = NULL; - } - - DeleteLock(lock_adapter_list); - lock_adapter_list = NULL; -} - -// Clone the adapter list -MS_ADAPTER_LIST *MsCloneAdapterList(MS_ADAPTER_LIST *o) -{ - MS_ADAPTER_LIST *ret; - UINT i; - // Validate arguments - if (o == NULL) - { - return NULL; - } - - ret = ZeroMalloc(sizeof(MS_ADAPTER_LIST)); - ret->Num = o->Num; - ret->Adapters = ZeroMalloc(sizeof(MS_ADAPTER *) * ret->Num); - - for (i = 0;i < ret->Num;i++) - { - ret->Adapters[i] = ZeroMalloc(sizeof(MS_ADAPTER)); - Copy(ret->Adapters[i], o->Adapters[i], sizeof(MS_ADAPTER)); - } - - return ret; -} - -// Clone the adapter -MS_ADAPTER *MsCloneAdapter(MS_ADAPTER *a) -{ - MS_ADAPTER *ret; - // Validate arguments - if (a == NULL) - { - return NULL; - } - - ret = ZeroMalloc(sizeof(MS_ADAPTER)); - Copy(ret, a, sizeof(MS_ADAPTER)); - - return ret; -} - -// Creating an adapters list -MS_ADAPTER_LIST *MsCreateAdapterListInner() -{ - return MsCreateAdapterListInnerEx(false); -} -MS_ADAPTER_LIST *MsCreateAdapterListInnerEx(bool no_info) -{ - LIST *o; - UINT i; - UINT retcode; - MIB_IFTABLE *table; - UINT table_size = sizeof(MIB_IFTABLE); - MS_ADAPTER_LIST *ret; - - if (w32net->GetIfTable2 != NULL && w32net->FreeMibTable != NULL) - { - return MsCreateAdapterListInnerExVista(no_info); - } - - if (w32net->GetIfTable == NULL) - { - return ZeroMalloc(sizeof(MS_ADAPTER_LIST)); - } - - table = ZeroMalloc(table_size); - - retcode = w32net->GetIfTable(table, &table_size, TRUE); - if (retcode == ERROR_INSUFFICIENT_BUFFER || retcode == ERROR_BUFFER_OVERFLOW) - { - Free(table); - table_size *= 2; - table = ZeroMalloc(table_size); - if (w32net->GetIfTable(table, &table_size, TRUE) != NO_ERROR) - { - Free(table); - return ZeroMalloc(sizeof(MS_ADAPTER_LIST)); - } - } - else if (retcode != NO_ERROR) - { - Free(table); - return ZeroMalloc(sizeof(MS_ADAPTER_LIST)); - } - - o = NewListFast(NULL); - - for (i = 0;i < table->dwNumEntries;i++) - { - MIB_IFROW *r = &table->table[i]; - char title[MAX_PATH]; - UINT num = 0; - MS_ADAPTER *a; - UINT j; - - //if (r->dwOperStatus == MIB_IF_OPER_STATUS_CONNECTED || r->dwOperStatus == MIB_IF_OPER_STATUS_OPERATIONAL) - { - //if (r->dwType & IF_TYPE_ETHERNET_CSMACD) - { - for (j = 1;;j++) - { - UINT k; - bool exists; - if (j == 1) - { - StrCpy(title, sizeof(title), (char *)r->bDescr); - } - else - { - Format(title, sizeof(title), "%s (%u)", (char *)r->bDescr, j); - } - - exists = false; - - for (k = 0;k < LIST_NUM(o);k++) - { - MS_ADAPTER *a = LIST_DATA(o, k); - - if (StrCmpi(a->Title, title) == 0) - { - exists = true; - break; - } - } - - if (exists == false) - { - break; - } - } - - a = ZeroMalloc(sizeof(MS_ADAPTER)); - - // Create an adapter information - StrCpy(a->Title, sizeof(a->Title), title); - StrToUni(a->TitleW, sizeof(a->TitleW), title); - a->Index = r->dwIndex; - a->Type = r->dwType; - a->Status = r->dwOperStatus; - a->Mtu = r->dwMtu; - a->Speed = r->dwSpeed; - a->AddressSize = MIN(sizeof(a->Address), r->dwPhysAddrLen); - Copy(a->Address, r->bPhysAddr, a->AddressSize); - a->RecvBytes = r->dwInOctets; - a->RecvPacketsBroadcast = r->dwInNUcastPkts; - a->RecvPacketsUnicast = r->dwInUcastPkts; - a->SendBytes = r->dwOutOctets; - a->SendPacketsBroadcast = r->dwOutNUcastPkts; - a->SendPacketsUnicast = r->dwOutUcastPkts; - - if (a->Type != IF_TYPE_ETHERNET_CSMACD) - { - a->IsNotEthernetLan = true; - } - - // TCP/IP information acquisition - if (no_info == false) - { - MsGetAdapterTcpIpInformation(a); - } - - Add(o, a); - } - } - } - - ret = ZeroMalloc(sizeof(MS_ADAPTER_LIST)); - ret->Num = LIST_NUM(o); - ret->Adapters = ToArray(o); - - ReleaseList(o); - Free(table); - - return ret; -} - -// Creating an adapters list (Windows Vista version) -MS_ADAPTER_LIST *MsCreateAdapterListInnerExVista(bool no_info) -{ - LIST *o; - UINT i; - UINT retcode; - MIB_IF_TABLE2 *table; - UINT table_size = sizeof(MIB_IFTABLE); - MS_ADAPTER_LIST *ret; - - if (w32net->GetIfTable2 == NULL || w32net->FreeMibTable == NULL) - { - return ZeroMalloc(sizeof(MS_ADAPTER_LIST)); - } - - retcode = w32net->GetIfTable2(&table); - if (retcode != NO_ERROR || table == NULL) - { - return ZeroMalloc(sizeof(MS_ADAPTER_LIST)); - } - - o = NewListFast(NULL); - - for (i = 0;i < table->NumEntries;i++) - { - MIB_IF_ROW2 *r = &table->Table[i]; - wchar_t title[MAX_PATH]; - UINT num = 0; - MS_ADAPTER *a; - UINT j; - - //if (r->dwOperStatus == MIB_IF_OPER_STATUS_CONNECTED || r->dwOperStatus == MIB_IF_OPER_STATUS_OPERATIONAL) - { - //if (r->dwType & IF_TYPE_ETHERNET_CSMACD) - { - for (j = 1;;j++) - { - UINT k; - bool exists; - if (j == 1) - { - UniStrCpy(title, sizeof(title), r->Description); - } - else - { - UniFormat(title, sizeof(title), L"%s (%u)", r->Description, j); - } - - exists = false; - - for (k = 0;k < LIST_NUM(o);k++) - { - MS_ADAPTER *a = LIST_DATA(o, k); - - if (UniStrCmpi(a->TitleW, title) == 0) - { - exists = true; - break; - } - } - - if (exists == false) - { - break; - } - } - - a = ZeroMalloc(sizeof(MS_ADAPTER)); - - // Create an adapter information - UniStrCpy(a->TitleW, sizeof(a->TitleW), title); - UniToStr(a->Title, sizeof(a->Title), title); - a->Index = r->InterfaceIndex; - a->Type = r->Type; - a->Status = ConvertMidStatusVistaToXp(r->OperStatus); - a->Mtu = r->Mtu; - a->Speed = MAX((UINT)r->TransmitLinkSpeed, (UINT)r->ReceiveLinkSpeed); - a->AddressSize = MIN(sizeof(a->Address), r->PhysicalAddressLength); - Copy(a->Address, r->PhysicalAddress, a->AddressSize); - a->RecvBytes = r->InOctets; - a->RecvPacketsBroadcast = r->InNUcastPkts; - a->RecvPacketsUnicast = r->InUcastPkts; - a->SendBytes = r->OutOctets; - a->SendPacketsBroadcast = r->OutNUcastPkts; - a->SendPacketsUnicast = r->OutUcastPkts; - - if (r->MediaType == NdisMediumWirelessWan || r->PhysicalMediumType == NdisPhysicalMediumWirelessLan || - r->PhysicalMediumType == NdisPhysicalMediumWirelessWan || r->PhysicalMediumType == NdisPhysicalMediumWiMax || - r->Type == IF_TYPE_IEEE80211) - { - a->IsWireless = true; - } - - if (a->IsWireless || - r->Type != IF_TYPE_ETHERNET_CSMACD || - r->MediaType != NdisMedium802_3 || - (r->PhysicalMediumType != 0 && r->PhysicalMediumType != NdisPhysicalMedium802_3)) - { - a->IsNotEthernetLan = true; - } - - // TCP/IP information acquisition - if (no_info == false) - { - MsGetAdapterTcpIpInformation(a); - } - - Add(o, a); - } - } - } - - ret = ZeroMalloc(sizeof(MS_ADAPTER_LIST)); - ret->Num = LIST_NUM(o); - ret->Adapters = ToArray(o); - - ReleaseList(o); - w32net->FreeMibTable(table); - - return ret; -} - -// Convert the MIB Operational Status from Vista format to XP format -UINT ConvertMidStatusVistaToXp(UINT st) -{ - switch (st) - { - case IfOperStatusUp: - return MIB_IF_OPER_STATUS_CONNECTED; - - case IfOperStatusDown: - return MIB_IF_OPER_STATUS_DISCONNECTED; - } - - return MIB_IF_OPER_STATUS_NON_OPERATIONAL; -} - -// Release the adapter list -void MsFreeAdapterList(MS_ADAPTER_LIST *o) -{ - UINT i; - // Validate arguments - if (o == NULL) - { - return; - } - - for (i = 0;i < o->Num;i++) - { - MsFreeAdapter(o->Adapters[i]); - } - Free(o->Adapters); - - Free(o); -} - -// Release the adapter information -void MsFreeAdapter(MS_ADAPTER *a) -{ - // Validate arguments - if (a == NULL) - { - return; - } - - Free(a); -} - -// Get the status string of the adapter -wchar_t *MsGetAdapterStatusStr(UINT status) -{ - wchar_t *ret; - - switch (status) - { - case MIB_IF_OPER_STATUS_NON_OPERATIONAL: - ret = _UU("MS_NON_OPERATIONAL"); - break; - - case MIB_IF_OPER_STATUS_UNREACHABLE: - ret = _UU("MS_UNREACHABLE"); - break; - - case MIB_IF_OPER_STATUS_DISCONNECTED: - ret = _UU("MS_DISCONNECTED"); - break; - - case MIB_IF_OPER_STATUS_CONNECTING: - ret = _UU("MS_CONNECTING"); - break; - - case MIB_IF_OPER_STATUS_CONNECTED: - ret = _UU("MS_CONNECTED"); - break; - - default: - ret = _UU("MS_OPERATIONAL"); - break; - } - - return ret; -} - -// Get the type string of the adapter -wchar_t *MsGetAdapterTypeStr(UINT type) -{ - wchar_t *ret; - - switch (type) - { - case IF_TYPE_PROP_VIRTUAL: - ret = _UU("MS_VIRTUAL"); - break; - - case MIB_IF_TYPE_ETHERNET: - ret = _UU("MS_ETHERNET"); - break; - - case IF_TYPE_IEEE80211: - ret = _UU("MS_WLAN"); - break; - - case MIB_IF_TYPE_TOKENRING: - ret = _UU("MS_TOKENRING"); - break; - - case MIB_IF_TYPE_FDDI: - ret = _UU("MS_FDDI"); - break; - - case MIB_IF_TYPE_PPP: - ret = _UU("MS_PPP"); - break; - - case MIB_IF_TYPE_LOOPBACK: - ret = _UU("MS_LOOPBACK"); - break; - - case MIB_IF_TYPE_SLIP: - ret = _UU("MS_SLIP"); - break; - - default: - ret = _UU("MS_OTHER"); - break; - } - - return ret; -} - -// Kill the process of specified EXE file name -UINT MsKillProcessByExeName(wchar_t *name) -{ - LIST *o; - UINT me, i; - UINT num = 0; - // Validate arguments - if (name == NULL) - { - return 0; - } - - o = MsGetProcessList(); - me = MsGetProcessId(); - - for (i = 0;i < LIST_NUM(o);i++) - { - MS_PROCESS *p = LIST_DATA(o, i); - if (p->ProcessId != me) - { - if (UniStrCmpi(p->ExeFilenameW, name) == 0) - { - if (MsKillProcess(p->ProcessId)) - { - num++; - } - } - } - } - - MsFreeProcessList(o); - - return num; -} - -// Terminate all instances except the EXE itself -void MsKillOtherInstance() -{ - MsKillOtherInstanceEx(NULL); -} -void MsKillOtherInstanceEx(char *exclude_svcname) -{ - UINT me, i; - wchar_t me_path[MAX_PATH]; - wchar_t me_path_short[MAX_PATH]; - LIST *o = MsGetProcessList(); - UINT e_procid = 0; - UINT e_procid2 = 0; - - if (exclude_svcname != NULL) - { - e_procid = MsReadCallingServiceManagerProcessId(exclude_svcname, false); - e_procid2 = MsReadCallingServiceManagerProcessId(exclude_svcname, true); - } - - me = MsGetProcessId(); - - MsGetCurrentProcessExeNameW(me_path, sizeof(me_path)); - MsGetShortPathNameW(me_path, me_path_short, sizeof(me_path_short)); - - for (i = 0;i < LIST_NUM(o);i++) - { - MS_PROCESS *p = LIST_DATA(o, i); - if (p->ProcessId != me) - { - if ((e_procid == 0 || (e_procid != p->ProcessId)) && (e_procid2 == 0 || (e_procid2 != p->ProcessId))) - { - wchar_t tmp[MAX_PATH]; - MsGetShortPathNameW(p->ExeFilenameW, tmp, sizeof(tmp)); - if (UniStrCmpi(me_path_short, tmp) == 0) - { - MsKillProcess(p->ProcessId); - } - } - } - } - - MsFreeProcessList(o); -} - -// Get the short file name -bool MsGetShortPathNameA(char *long_path, char *short_path, UINT short_path_size) -{ - // Validate arguments - if (long_path == NULL || short_path == NULL) - { - return false; - } - - if (GetShortPathNameA(long_path, short_path, short_path_size) == 0) - { - StrCpy(short_path, short_path_size, long_path); - return false; - } - - return true; -} -bool MsGetShortPathNameW(wchar_t *long_path, wchar_t *short_path, UINT short_path_size) -{ - // Validate arguments - if (long_path == NULL || short_path == NULL) - { - return false; - } - - if (IsNt() == false) - { - char short_path_a[MAX_SIZE]; - char long_path_a[MAX_SIZE]; - bool ret; - - UniToStr(long_path_a, sizeof(long_path_a), long_path); - - ret = MsGetShortPathNameA(long_path_a, short_path_a, sizeof(short_path_a)); - - StrToUni(short_path, short_path_size, short_path_a); - - return ret; - } - - if (GetShortPathNameW(long_path, short_path, short_path_size) == 0) - { - UniStrCpy(short_path, short_path_size, long_path); - return false; - } - - return true; -} - -// Kill the specified process -bool MsKillProcess(UINT id) -{ - HANDLE h; - // Validate arguments - if (id == 0) - { - return false; - } - - h = OpenProcess(PROCESS_TERMINATE, FALSE, id); - if (h == NULL) - { - return false; - } - - if (TerminateProcess(h, 0) == FALSE) - { - CloseHandle(h); - return false; - } - - CloseHandle(h); - - return true; -} - -// Get the current EXE file name -void MsGetCurrentProcessExeNameW(wchar_t *name, UINT size) -{ - UINT id; - LIST *o; - MS_PROCESS *p; - // Validate arguments - if (name == NULL) - { - return; - } - - id = MsGetCurrentProcessId(); - o = MsGetProcessList(); - p = MsSearchProcessById(o, id); - if (p != NULL) - { - p = MsSearchProcessById(o, id); - UniStrCpy(name, size, p->ExeFilenameW); - } - else - { - UniStrCpy(name, size, MsGetExeFileNameW()); - } - MsFreeProcessList(o); -} - -// Search the process by the process ID -MS_PROCESS *MsSearchProcessById(LIST *o, UINT id) -{ - MS_PROCESS *p, t; - // Validate arguments - if (o == NULL) - { - return NULL; - } - - Zero(&t, sizeof(t)); - t.ProcessId = id; - - p = Search(o, &t); - - return p; -} - -// Compare the Process List items -int MsCompareProcessList(void *p1, void *p2) -{ - MS_PROCESS *e1, *e2; - if (p1 == NULL || p2 == NULL) - { - return 0; - } - e1 = *(MS_PROCESS **)p1; - e2 = *(MS_PROCESS **)p2; - if (e1 == NULL || e2 == NULL) - { - return 0; - } - - if (e1->ProcessId > e2->ProcessId) - { - return 1; - } - else if (e1->ProcessId < e2->ProcessId) - { - return -1; - } - else - { - return 0; - } -} - -// Release of the process list -void MsFreeProcessList(LIST *o) -{ - UINT i; - // Validate arguments - if (o == NULL) - { - return; - } - - for (i = 0;i < LIST_NUM(o);i++) - { - MS_PROCESS *p = LIST_DATA(o, i); - Free(p); - } - - ReleaseList(o); -} - -// Get the Process List (for WinNT) -LIST *MsGetProcessListNt() -{ - LIST *o; - UINT max = 16384; - DWORD *processes; - UINT needed, num; - UINT i; - - o = NewListFast(MsCompareProcessList); - - if (ms->nt->EnumProcesses == NULL) - { - return o; - } - - processes = ZeroMalloc(sizeof(DWORD) * max); - - if (ms->nt->EnumProcesses(processes, sizeof(DWORD) * max, &needed) == FALSE) - { - Free(processes); - return NULL; - } - - num = needed / sizeof(DWORD); - - for (i = 0;i < num;i++) - { - UINT id = processes[i]; - HANDLE h = OpenProcess(PROCESS_QUERY_INFORMATION | PROCESS_VM_READ, - false, id); - - if (h != NULL) - { - HINSTANCE hInst = NULL; - DWORD needed; - char exe[MAX_SIZE]; - wchar_t exe_w[MAX_SIZE]; - bool ok = false; - DWORD sz1, sz2; - - sz1 = sizeof(exe) - 1; - sz2 = sizeof(exe_w) / sizeof(wchar_t) - 1; - - if (ms->nt->EnumProcessModules(h, &hInst, sizeof(hInst), &needed) == false) - { - hInst = NULL; - } - - if (ms->nt->GetModuleFileNameExA(h, hInst, exe, sizeof(exe) - 1) && - ms->nt->GetModuleFileNameExW(h, hInst, exe_w, sizeof(exe_w) / sizeof(wchar_t) - 1)) - { - ok = true; - } - else if (ms->nt->QueryFullProcessImageNameA != NULL && - ms->nt->QueryFullProcessImageNameW != NULL && - ms->nt->QueryFullProcessImageNameA(h, 0, exe, &sz1) && - ms->nt->QueryFullProcessImageNameW(h, 0, exe_w, &sz2)) - { - ok = true; - } - - if (ok) - { - MS_PROCESS *p = ZeroMalloc(sizeof(MS_PROCESS)); - - StrCpy(p->ExeFilename, sizeof(p->ExeFilename), exe); - UniStrCpy(p->ExeFilenameW, sizeof(p->ExeFilenameW), exe_w); - p->ProcessId = id; - - Add(o, p); - } - - CloseHandle(h); - } - } - - Sort(o); - - Free(processes); - - return o; -} - -// Get the Process List (for Win9x) -LIST *MsGetProcessList9x() -{ - HANDLE h; - LIST *o; - HANDLE (WINAPI *CreateToolhelp32Snapshot)(DWORD, DWORD); - BOOL (WINAPI *Process32First)(HANDLE, LPPROCESSENTRY32); - BOOL (WINAPI *Process32Next)(HANDLE, LPPROCESSENTRY32); - - CreateToolhelp32Snapshot = - (HANDLE (__stdcall *)(DWORD,DWORD)) - GetProcAddress(ms->hKernel32, "CreateToolhelp32Snapshot"); - Process32First = - (BOOL (__stdcall *)(HANDLE,LPPROCESSENTRY32)) - GetProcAddress(ms->hKernel32, "Process32First"); - Process32Next = - (BOOL (__stdcall *)(HANDLE,LPPROCESSENTRY32)) - GetProcAddress(ms->hKernel32, "Process32Next"); - - o = NewListFast(MsCompareProcessList); - - if (CreateToolhelp32Snapshot != NULL && Process32First != NULL && Process32Next != NULL) - { - h = CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0); - if (h != INVALID_HANDLE_VALUE) - { - PROCESSENTRY32 e; - Zero(&e, sizeof(e)); - e.dwSize = sizeof(e); - - if (Process32First(h, &e)) - { - while (true) - { - MS_PROCESS *p = ZeroMalloc(sizeof(MS_PROCESS)); - StrCpy(p->ExeFilename, sizeof(p->ExeFilename), e.szExeFile); - StrToUni(p->ExeFilenameW, sizeof(p->ExeFilenameW), p->ExeFilename); - p->ProcessId = e.th32ProcessID; - Add(o, p); - if (Process32Next(h, &e) == false) - { - break; - } - } - } - CloseHandle(h); - } - } - - Sort(o); - - return o; -} - -// Get the Process List -LIST *MsGetProcessList() -{ - if (MsIsNt() == false) - { - // Windows 9x - return MsGetProcessList9x(); - } - else - { - // Windows NT, 2000, XP - return MsGetProcessListNt(); - } -} - -// Force to run the current thread on a single CPU -void MsSetThreadSingleCpu() -{ - SetThreadAffinityMask(GetCurrentThread(), 1); -} - -// Playback of sound -void MsPlaySound(char *name) -{ - char tmp[MAX_SIZE]; - char wav[MAX_SIZE]; - char *temp; - BUF *b; - // Validate arguments - if (name == NULL) - { - return; - } - - Format(tmp, sizeof(tmp), "|%s", name); - - b = ReadDump(tmp); - if (b == NULL) - { - return; - } - - temp = MsGetMyTempDir(); - Format(wav, sizeof(tmp), "%s\\%s", temp, name); - DumpBuf(b, wav); - - PlaySound(wav, NULL, SND_ASYNC | SND_FILENAME | SND_NODEFAULT); - - FreeBuf(b); -} - -// Show an icon in the task tray -bool MsShowIconOnTray(HWND hWnd, HICON icon, wchar_t *tooltip, UINT msg) -{ - bool ret = true; - // Validate arguments - if (hWnd == NULL || icon == NULL) - { - return true; - } - - if (MsIsNt() == false) - { - Zero(&nid, sizeof(nid)); - nid.cbSize = sizeof(nid); - nid.hWnd = hWnd; - nid.uID = 1; - nid.uFlags = NIF_ICON | NIF_MESSAGE | NIF_TIP | NIF_INFO; - nid.uCallbackMessage = msg; - nid.hIcon = icon; - UniToStr(nid.szTip, sizeof(nid.szTip), tooltip); - ret = Shell_NotifyIcon(NIM_ADD, &nid); - } - else - { - Zero(&nid_nt, sizeof(nid_nt)); - nid_nt.cbSize = sizeof(nid_nt); - nid_nt.hWnd = hWnd; - nid_nt.uID = 1; - nid_nt.uFlags = NIF_ICON | NIF_MESSAGE | NIF_TIP | NIF_INFO; - nid_nt.uCallbackMessage = msg; - nid_nt.hIcon = icon; - UniStrCpy(nid_nt.szTip, sizeof(nid_nt.szTip), tooltip); - - ret = Shell_NotifyIconW(NIM_ADD, &nid_nt); - } - - tray_inited = true; - - return ret; -} - -// Restore the icon in the task tray -void MsRestoreIconOnTray() -{ - if (tray_inited == false) - { - return; - } - - if (MsIsNt() == false) - { - Shell_NotifyIcon(NIM_ADD, &nid); - } - else - { - Shell_NotifyIconW(NIM_ADD, &nid_nt); - } -} - -// Change the icon in the task tray -void MsChangeIconOnTray(HICON icon, wchar_t *tooltip) -{ - MsChangeIconOnTrayEx(icon, tooltip, NULL, NULL, NIIF_NONE, false); -} -bool MsChangeIconOnTrayEx(HICON icon, wchar_t *tooltip, wchar_t *info_title, wchar_t *info, UINT info_flags, bool add) -{ - bool changed = false; - bool ret = true; - - if (tray_inited == false) - { - return ret; - } - - if (icon != NULL) - { - if (MsIsNt() == false) - { - if (nid.hIcon != icon) - { - changed = true; - nid.hIcon = icon; - } - } - else - { - if (nid_nt.hIcon != icon) - { - changed = true; - nid_nt.hIcon = icon; - } - } - } - - if (tooltip != NULL) - { - if (MsIsNt() == false) - { - char tmp[MAX_SIZE]; - - UniToStr(tmp, sizeof(tmp), tooltip); - - if (StrCmp(nid.szTip, tmp) != 0) - { - StrCpy(nid.szTip, sizeof(nid.szTip), tmp); - changed = true; - } - } - else - { - wchar_t tmp[MAX_SIZE]; - - UniStrCpy(tmp, sizeof(tmp), tooltip); - - if (UniStrCmp(nid_nt.szTip, tmp) != 0) - { - UniStrCpy(nid_nt.szTip, sizeof(nid_nt.szTip), tmp); - changed = true; - } - } - } - - if (info_title != NULL && info != NULL) - { - if (MsIsNt() == false) - { - char tmp1[MAX_SIZE]; - char tmp2[MAX_PATH]; - - UniToStr(tmp1, sizeof(tmp1), info_title); - UniToStr(tmp2, sizeof(tmp2), info); - - if (StrCmp(nid.szInfo, tmp1) != 0 || - StrCmp(nid.szInfoTitle, tmp2) != 0) - { - StrCpy(nid.szInfo, sizeof(nid.szInfo), tmp1); - StrCpy(nid.szInfoTitle, sizeof(nid.szInfoTitle), tmp2); - nid.dwInfoFlags = info_flags; - - changed = true; - } - } - else - { - wchar_t tmp1[MAX_SIZE]; - wchar_t tmp2[MAX_PATH]; - - UniStrCpy(tmp1, sizeof(tmp1), info_title); - UniStrCpy(tmp2, sizeof(tmp2), info); - - if (UniStrCmp(nid_nt.szInfo, tmp1) != 0 || - UniStrCmp(nid_nt.szInfoTitle, tmp2) != 0) - { - UniStrCpy(nid_nt.szInfo, sizeof(nid_nt.szInfo), tmp1); - UniStrCpy(nid_nt.szInfoTitle, sizeof(nid_nt.szInfoTitle), tmp2); - nid_nt.dwInfoFlags = info_flags; - - changed = true; - } - } - } - - if (changed || add) - { - UINT op = (add ? NIM_ADD : NIM_MODIFY); - if (MsIsNt() == false) - { - ret = Shell_NotifyIcon(op, &nid); - } - else - { - ret = Shell_NotifyIconW(op, &nid_nt); - } - } - - return ret; -} - -// Remove the icon in the task tray -void MsHideIconOnTray() -{ - if (MsIsNt() == false) - { - Shell_NotifyIcon(NIM_DELETE, &nid); - } - else - { - Shell_NotifyIconW(NIM_DELETE, &nid_nt); - } - - tray_inited = false; -} - -// Insert a menu item -bool MsInsertMenu(HMENU hMenu, UINT pos, UINT flags, UINT_PTR id_new_item, wchar_t *lp_new_item) -{ - bool ret; - - if (MsIsNt()) - { - ret = InsertMenuW(hMenu, pos, flags, id_new_item, lp_new_item); - } - else - { - char *s = CopyUniToStr(lp_new_item); - ret = InsertMenuA(hMenu, pos, flags, id_new_item, s); - Free(s); - } - - return ret; -} - -// Adding a menu item -bool MsAppendMenu(HMENU hMenu, UINT flags, UINT_PTR id, wchar_t *str) -{ - bool ret; - - if (MsIsNt()) - { - ret = AppendMenuW(hMenu, flags, id, str); - } - else - { - char *s = CopyUniToStr(str); - ret = AppendMenuA(hMenu, flags, id, s); - Free(s); - } - - return ret; -} - -// Display the menu -void MsUserModeTrayMenu(HWND hWnd) -{ - HMENU h; - POINT p; - wchar_t tmp[MAX_SIZE]; - wchar_t caption[MAX_SIZE]; - // Validate arguments - if (hWnd == NULL) - { - return; - } - - // Create a menu - h = CreatePopupMenu(); - MsAppendMenu(h, MF_ENABLED | MF_STRING, 10001, _UU("SVC_USERMODE_MENU_1")); - MsAppendMenu(h, MF_SEPARATOR, 10002, NULL); - - if (MsIsNt()) - { - GetWindowTextW(hWnd, caption, sizeof(caption)); - } - else - { - char tmp[MAX_SIZE]; - GetWindowTextA(hWnd, tmp, sizeof(tmp)); - StrToUni(caption, sizeof(caption), tmp); - } - - UniFormat(tmp, sizeof(tmp), _UU("SVC_USERMODE_MENU_2"), caption); - MsAppendMenu(h, MF_ENABLED | MF_STRING, 10003, tmp); - - // Display the menu - GetCursorPos(&p); - - SetForegroundWindow(hWnd); - TrackPopupMenu(h, TPM_LEFTALIGN, p.x, p.y, 0, hWnd, NULL); - PostMessage(hWnd, WM_NULL, 0, 0); - - DestroyMenu(h); -} - -// Window procedure for the user mode -LRESULT CALLBACK MsUserModeWindowProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam) -{ - wchar_t tmp[MAX_SIZE]; - char title[MAX_SIZE]; - wchar_t title_w[MAX_SIZE]; - char value_name[MAX_SIZE]; - static UINT taskbar_msg = 0; - // Validate arguments - if (hWnd == NULL) - { - return 0; - } - - if (msg == taskbar_msg && taskbar_msg != 0) - { - // The taskbar was regenerated - if (MsRegReadInt(REG_CURRENT_USER, SVC_USERMODE_SETTING_KEY, value_name) == 0 && - service_for_9x_mode == false) - { - MsRestoreIconOnTray(); - } - } - - switch (msg) - { - case WM_ENDSESSION: - // Resume - if (wParam == false) - { - break; - } - case WM_CREATE: - // Start - exiting = false; - g_start(); - GetWindowText(hWnd, title, sizeof(title)); - StrToUni(title_w, sizeof(title_w), title); - UniFormat(tmp, sizeof(tmp), _UU("SVC_TRAY_TOOLTIP"), title); - - if (taskbar_msg == 0) - { - taskbar_msg = RegisterWindowMessage("TaskbarCreated"); - } - - Format(value_name, sizeof(value_name), SVC_HIDETRAY_REG_VALUE, title_w); - if (MsRegReadInt(REG_CURRENT_USER, SVC_USERMODE_SETTING_KEY, value_name) == 0 && - service_for_9x_mode == false) - { - MsShowIconOnTray(hWnd, tray_icon, tmp, WM_APP + 33); - } - - break; - case WM_APP + 33: - if (wParam == 1) - { - // The operation to the icon in the task tray - switch (lParam) - { - case WM_RBUTTONDOWN: - // Right click - MsUserModeTrayMenu(hWnd); - break; - case WM_LBUTTONDBLCLK: - // Left double-click - break; - } - } - break; - case WM_LBUTTONDOWN: - MsUserModeTrayMenu(hWnd); - break; - case WM_QUERYENDSESSION: - if (exiting == false) - { - exiting = true; - MsHideIconOnTray(); - g_stop(); - DestroyWindow(hWnd); - } - return TRUE; - case WM_CLOSE: - // Stop - if (exiting == false) - { - exiting = true; - g_stop(); - MsHideIconOnTray(); - DestroyWindow(hWnd); - } - break; - case WM_DESTROY: - wnd_end = true; - break; - case WM_COMMAND: - switch (wParam) - { - case 10001: - GetWindowText(hWnd, title, sizeof(title)); - StrToUni(title_w, sizeof(title_w), title); - // Display a confirmation message - if (MsgBoxEx(hWnd, MB_ICONINFORMATION | MB_OKCANCEL | MB_DEFBUTTON2 | - MB_SYSTEMMODAL, _UU("SVC_HIDE_TRAY_MSG"), title, title) == IDOK) - { - char tmp[MAX_SIZE]; - Format(tmp, sizeof(tmp), SVC_HIDETRAY_REG_VALUE, title_w); - // Write to the registry - MsRegWriteInt(REG_CURRENT_USER, SVC_USERMODE_SETTING_KEY, tmp, 1); - // Hide the icon - MsHideIconOnTray(); - } - break; - case 10003: - SendMessage(hWnd, WM_CLOSE, 0, 0); - break; - } - break; - } - return DefWindowProc(hWnd, msg, wParam, lParam); -} - -// Get whether this instance is in user mode -bool MsIsUserMode() -{ - return is_usermode; -} - -// Only run the test (for debugging) -void MsTestOnly() -{ - g_start(); - GetLine(NULL, 0); - g_stop(); - - _exit(0); -} - -// Stop the user-mode service -void MsStopUserModeSvc(char *svc_name) -{ - void *p; - // Validate arguments - if (svc_name == NULL) - { - return; - } - - p = MsCreateUserModeSvcGlocalPulse(svc_name); - if (p == NULL) - { - return; - } - - MsSendGlobalPulse(p); - - MsCloseGlobalPulse(p); -} - -// Creating a global pulse for user-mode service -void *MsCreateUserModeSvcGlocalPulse(char *svc_name) -{ - char name[MAX_SIZE]; - // Validate arguments - if (svc_name == NULL) - { - return NULL; - } - - MsGenerateUserModeSvcGlobalPulseName(name, sizeof(name), svc_name); - - return MsOpenOrCreateGlobalPulse(name); -} - -// Get the global pulse name for the user-mode service -void MsGenerateUserModeSvcGlobalPulseName(char *name, UINT size, char *svc_name) -{ - wchar_t tmp[MAX_SIZE]; - UCHAR hash[SHA1_SIZE]; - // Validate arguments - if (name == NULL || svc_name == NULL) - { - return; - } - - UniFormat(tmp, sizeof(tmp), L"usersvc_%S_@_%s", svc_name, MsGetUserNameW()); - - UniTrim(tmp); - UniStrUpper(tmp); - - Sha1(hash, tmp, UniStrLen(tmp) * sizeof(wchar_t)); - - BinToStr(name, size, hash, sizeof(hash)); -} - -// Declare the beginning of use of a VLAN card -void MsBeginVLanCard() -{ - Inc(vlan_card_counter); -} - -// Declare the ending of use of a VLAN card -void MsEndVLanCard() -{ - Dec(vlan_card_counter); -} - -// Return the flag whether the VLAN cards must be stopped -bool MsIsVLanCardShouldStop() -{ - return vlan_card_should_stop_flag; -} - -// Suspend procs -void MsProcEnterSuspend() -{ - UINT64 giveup_tick = Tick64() + 2000; - UINT num = Count(vlan_card_counter); - - vlan_is_in_suspend_mode = true; - - vlan_card_should_stop_flag = true; - - vlan_suspend_mode_begin_tick = Tick64(); - - while (true) - { - UINT64 now = Tick64(); - - if (now >= giveup_tick) - { - break; - } - - if (Count(vlan_card_counter) == 0) - { - break; - } - - SleepThread(100); - } - - if (num >= 1) - { - SleepThread(3000); - } -} -void MsProcLeaveSuspend() -{ - vlan_card_should_stop_flag = false; - vlan_is_in_suspend_mode = false; - vlan_suspend_mode_begin_tick = Tick64(); -} -UINT64 MsGetSuspendModeBeginTick() -{ - if (vlan_is_in_suspend_mode) - { - return Tick64(); - } - - return vlan_suspend_mode_begin_tick; -} - -// Suspend handler window proc -LRESULT CALLBACK MsSuspendHandlerWindowProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam) -{ - MS_SUSPEND_HANDLER *h; - CREATESTRUCT *cs; - // Validate arguments - if (hWnd == NULL) - { - return 0; - } - - h = (MS_SUSPEND_HANDLER *)GetWindowLongPtrA(hWnd, GWLP_USERDATA); - if (h == NULL && msg != WM_CREATE) - { - goto LABEL_END; - } - - switch (msg) - { - case WM_CREATE: - cs = (CREATESTRUCT *)lParam; - h = (MS_SUSPEND_HANDLER *)cs->lpCreateParams; - SetWindowLongPtrA(hWnd, GWLP_USERDATA, (LONG_PTR)h); - break; - - case WM_POWERBROADCAST: - if (MsIsVista()) - { - switch (wParam) - { - case PBT_APMSUSPEND: - MsProcEnterSuspend(); - return 1; - - case PBT_APMRESUMEAUTOMATIC: - case PBT_APMRESUMESUSPEND: - MsProcLeaveSuspend(); - return 1; - } - } - break; - - case WM_CLOSE: - /*if (h->AboutToClose == false) - { - return 0; - }*/ - break; - - case WM_DESTROY: - PostQuitMessage(0); - break; - } - -LABEL_END: - return DefWindowProc(hWnd, msg, wParam, lParam); -} - -// Suspend handler thread -void MsSuspendHandlerThreadProc(THREAD *thread, void *param) -{ - char wndclass_name[MAX_PATH]; - WNDCLASS wc; - HWND hWnd; - MSG msg; - MS_SUSPEND_HANDLER *h = (MS_SUSPEND_HANDLER *)param; - // Validate arguments - if (h == NULL || thread == NULL) - { - return; - } - - Format(wndclass_name, sizeof(wndclass_name), "WNDCLASS_%X", Rand32()); - - Zero(&wc, sizeof(wc)); - wc.hbrBackground = (HBRUSH)GetStockObject(WHITE_BRUSH); - wc.hCursor = LoadCursor(NULL, IDC_ARROW); - wc.hIcon = NULL; - wc.hInstance = ms->hInst; - wc.lpfnWndProc = MsSuspendHandlerWindowProc; - wc.lpszClassName = wndclass_name; - if (RegisterClassA(&wc) == 0) - { - NoticeThreadInit(thread); - return; - } - - hWnd = CreateWindowA(wndclass_name, wndclass_name, WS_OVERLAPPEDWINDOW, - CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, - NULL, NULL, ms->hInst, h); - - h->hWnd = hWnd; - - NoticeThreadInit(thread); - - if (hWnd == NULL) - { - UnregisterClassA(wndclass_name, ms->hInst); - return; - } - - //ShowWindow(hWnd, SW_SHOWNORMAL); - - while (GetMessage(&msg, NULL, 0, 0)) - { - TranslateMessage(&msg); - DispatchMessage(&msg); - } - - vlan_card_should_stop_flag = false; - vlan_is_in_suspend_mode = false; - vlan_suspend_mode_begin_tick = 0; - - DestroyWindow(hWnd); - - UnregisterClassA(wndclass_name, ms->hInst); -} - -// New suspend handler -MS_SUSPEND_HANDLER *MsNewSuspendHandler() -{ - THREAD *t; - MS_SUSPEND_HANDLER *h; - - if (Inc(suspend_handler_singleton) >= 2) - { - Dec(suspend_handler_singleton); - return NULL; - } - - vlan_card_should_stop_flag = false; - vlan_is_in_suspend_mode = false; - vlan_suspend_mode_begin_tick = 0; - - h = ZeroMalloc(sizeof(MS_SUSPEND_HANDLER)); - - t = NewThread(MsSuspendHandlerThreadProc, h); - - WaitThreadInit(t); - - h->Thread = t; - - return h; -} - -void MsFreeSuspendHandler(MS_SUSPEND_HANDLER *h) -{ - // Validate arguments - if (h == NULL) - { - return; - } - - if (h->hWnd != NULL) - { - h->AboutToClose = true; - PostMessageA(h->hWnd, WM_CLOSE, 0, 0); - } - - WaitThread(h->Thread, INFINITE); - ReleaseThread(h->Thread); - - Free(h); - - Dec(suspend_handler_singleton); - - vlan_card_should_stop_flag = false; -} - -// Start in user mode -void MsUserModeW(wchar_t *title, SERVICE_FUNCTION *start, SERVICE_FUNCTION *stop, UINT icon) -{ - WNDCLASS wc; - HINSTANCE hDll; - HWND hWnd; - MSG msg; - INSTANCE *inst; - char title_a[MAX_PATH]; - MS_USERMODE_SVC_PULSE_THREAD_PARAM p; - THREAD *recv_thread = NULL; - // Validate arguments - if (title == NULL || start == NULL || stop == NULL) - { - return; - } - - UniToStr(title_a, sizeof(title_a), title); - - is_usermode = true; - g_start = start; - g_stop = stop; - - inst = NewSingleInstance(NULL); - if (inst == NULL) - { - if (service_for_9x_mode == false) - { - // Do not display an error if Win9x service mode - MsgBoxEx(NULL, MB_ICONINFORMATION, _UU("SVC_USERMODE_MUTEX"), ms->ExeFileNameW); - } - return; - } - - if (Is64()) - { - hDll = MsLoadLibraryAsDataFile(PENCORE_DLL_NAME); - } - else - { - hDll = MsLoadLibrary(PENCORE_DLL_NAME); - } - - // Read icon - tray_icon = LoadImage(hDll, MAKEINTRESOURCE(icon), IMAGE_ICON, 16, 16, - (MsIsNt() ? LR_SHARED : 0) | LR_VGACOLOR); - - // Creating the main window - Zero(&wc, sizeof(wc)); - wc.hbrBackground = (HBRUSH)GetStockObject(WHITE_BRUSH); - wc.hCursor = LoadCursor(NULL,IDC_ARROW); - wc.hIcon = LoadIcon(hDll, MAKEINTRESOURCE(icon)); - wc.hInstance = ms->hInst; - wc.lpfnWndProc = MsUserModeWindowProc; - wc.lpszClassName = title_a; - if (RegisterClass(&wc) == 0) - { - return; - } - - hWnd = CreateWindow(title_a, title_a, WS_OVERLAPPEDWINDOW, - CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, - NULL, NULL, ms->hInst, NULL); - - if (hWnd == NULL) - { - return; - } - - Zero(&p, sizeof(p)); - p.hWnd = hWnd; - p.GlobalPulse = MsCreateUserModeSvcGlocalPulse(g_service_name); - - if (p.GlobalPulse != NULL) - { - // Start the global pulse monitoring thread for termination - p.Halt = false; - - recv_thread = NewThread(MsUserModeGlobalPulseRecvThread, &p); - } - - hWndUsermode = hWnd; - - wnd_end = false; - // Window loop - while (wnd_end == false) - { - GetMessage(&msg, NULL, 0, 0); - TranslateMessage(&msg); - DispatchMessage(&msg); - } - - FreeSingleInstance(inst); - - p.hWnd = NULL; - - hWndUsermode = NULL; - - if (p.GlobalPulse != NULL) - { - // Terminate the monitoring thread of termination global pulse - p.Halt = true; - MsSendGlobalPulse(p.GlobalPulse); - - WaitThread(recv_thread, INFINITE); - ReleaseThread(recv_thread); - - MsCloseGlobalPulse(p.GlobalPulse); - } - - // Might abort - _exit(0); -} - -// The thread that wait for global pulse to stop the user mode service -void MsUserModeGlobalPulseRecvThread(THREAD *thread, void *param) -{ - MS_USERMODE_SVC_PULSE_THREAD_PARAM *p = (MS_USERMODE_SVC_PULSE_THREAD_PARAM *)param; - // Validate arguments - if (thread == NULL || p == NULL) - { - return; - } - - while (p->Halt == false) - { - if (MsWaitForGlobalPulse(p->GlobalPulse, INFINITE)) - { - break; - } - } - - if (p->hWnd != NULL) - { - PostMessageA(p->hWnd, WM_CLOSE, 0, 0); - } -} - -// Service stopping procedure main thread -void MsServiceStoperMainThread(THREAD *t, void *p) -{ - // Stopping procedure - g_stop(); -} - -// Service stop procedure -bool MsServiceStopProc() -{ - THREAD *thread; - bool ret = true; - UINT64 selfkill_timeout = Tick64() + SVC_SELFKILL_TIMEOUT; - - thread = NewThread(MsServiceStoperMainThread, NULL); - - while (WaitThread(thread, 250) == false) - { - if (Tick64() >= selfkill_timeout) - { - // Suicide when it freezes - ret = false; - break; - } - // During stopping procedure to complete, call the SetServiceStatus periodically - status.dwWin32ExitCode = 0; - status.dwWaitHint = 100000; - status.dwCheckPoint++; - status.dwCurrentState = SERVICE_STOP_PENDING; - _SetServiceStatus(ssh, &status); - } - - // Report that the stopping is complete - status.dwWin32ExitCode = 0; - status.dwWaitHint = 0; - status.dwCheckPoint = 0; - status.dwCurrentState = SERVICE_STOPPED; - _SetServiceStatus(ssh, &status); - - if (ret == false) - { - // Force termination here if this has committed suicide - _exit(-1); - } - else - { - ReleaseThread(thread); - } - - return ret; -} - -// Service handler -void CALLBACK MsServiceHandler(UINT opcode) -{ - switch (opcode) - { - case SERVICE_CONTROL_SHUTDOWN: - case SERVICE_CONTROL_STOP: - // Stopping request - status.dwWin32ExitCode = 0; - status.dwWaitHint = 100000; - status.dwCheckPoint = 0; - status.dwCurrentState = SERVICE_STOP_PENDING; - - // Set the stopping event - if (service_stop_event != NULL) - { - SetEvent(service_stop_event); - } - break; - } - - _SetServiceStatus(ssh, &status); -} - -// Dispatch function of the service -void CALLBACK MsServiceDispatcher(UINT argc, LPTSTR *argv) -{ - // Creating a stopping event - service_stop_event = CreateEventA(NULL, true, false, NULL); - - // Preparing for the service - Zero(&status, sizeof(status)); - status.dwServiceType = SERVICE_WIN32; - status.dwCurrentState = SERVICE_START_PENDING; - status.dwControlsAccepted = SERVICE_ACCEPT_STOP | SERVICE_ACCEPT_SHUTDOWN; - - ssh = _RegisterServiceCtrlHandler(g_service_name, MsServiceHandler); - - if (ssh == NULL) - { - MessageBox(NULL, "RegisterServiceCtrlHandler() Failed.", "MsServiceDispatcher()", MB_SETFOREGROUND | MB_TOPMOST | MB_SERVICE_NOTIFICATION | MB_OK | MB_ICONEXCLAMATION); - return; - } - - status.dwWaitHint = 300000; - status.dwCheckPoint = 0; - status.dwCheckPoint++; - status.dwCurrentState = SERVICE_START_PENDING; - _SetServiceStatus(ssh, &status); - - // Report the start completion - status.dwWaitHint = 0; - status.dwCheckPoint = 0; - status.dwCurrentState = SERVICE_RUNNING; - _SetServiceStatus(ssh, &status); - - //// Initialization - // Start of the Mayaqua -#if defined(_DEBUG) || defined(DEBUG) // In VC++ compilers, the macro is "_DEBUG", not "DEBUG". - // If set memcheck = true, the program will be vitally slow since it will log all malloc() / realloc() / free() calls to find the cause of memory leak. - // For normal debug we set memcheck = false. - // Please set memcheck = true if you want to test the cause of memory leaks. - InitMayaqua(false, true, 0, NULL); -#else - InitMayaqua(false, false, 0, NULL); -#endif - - // Stop the MS-IME - MsDisableIme(); - - // Service operation start - g_start(); - MsUpdateServiceConfig(g_service_name); - - // Wait for the stopping event to be signaled state - WaitForSingleObject(service_stop_event, INFINITE); - - // Service operation stop - MsServiceStopProc(); -} - -// Start as a test mode -void MsTestMode(char *title, SERVICE_FUNCTION *start, SERVICE_FUNCTION *stop) -{ - wchar_t *title_w = CopyStrToUni(title); - - MsTestModeW(title_w, start, stop); - Free(title_w); -} -void MsTestModeW(wchar_t *title, SERVICE_FUNCTION *start, SERVICE_FUNCTION *stop) -{ - INSTANCE *inst; - // Validate arguments - if (title == NULL || start == NULL || stop == NULL) - { - return; - } - - is_usermode = true; - - inst = NewSingleInstance(NULL); - if (inst == NULL) - { - // Already started - MsgBoxEx(NULL, MB_ICONINFORMATION, _UU("SVC_TEST_MUTEX"), ms->ExeFileNameW); - return; - } - - // Start - start(); - - // Display the message - MsgBoxEx(NULL, MB_ICONINFORMATION | MB_SYSTEMMODAL, _UU("SVC_TEST_MSG"), title); - - // Stop - stop(); - - FreeSingleInstance(inst); -} - -// Write the process ID of the process which is calling the service manager -void MsWriteCallingServiceManagerProcessId(char *svcname, UINT pid) -{ - char tmp[MAX_PATH]; - - Format(tmp, sizeof(tmp), SVC_CALLING_SM_PROCESS_ID_KEY, svcname); - - if (pid != 0) - { - MsRegWriteInt(REG_LOCAL_MACHINE, tmp, SVC_CALLING_SM_PROCESS_ID_VALUE, pid); - MsRegWriteInt(REG_CURRENT_USER, tmp, SVC_CALLING_SM_PROCESS_ID_VALUE, pid); - } - else - { - MsRegDeleteValue(REG_LOCAL_MACHINE, tmp, SVC_CALLING_SM_PROCESS_ID_VALUE); - MsRegDeleteKey(REG_LOCAL_MACHINE, tmp); - - MsRegDeleteValue(REG_CURRENT_USER, tmp, SVC_CALLING_SM_PROCESS_ID_VALUE); - MsRegDeleteKey(REG_CURRENT_USER, tmp); - } -} - -// Get the process ID of the process which is calling the service manager -UINT MsReadCallingServiceManagerProcessId(char *svcname, bool current_user) -{ - char tmp[MAX_PATH]; - // Validate arguments - if (svcname == NULL) - { - return 0; - } - - Format(tmp, sizeof(tmp), SVC_CALLING_SM_PROCESS_ID_KEY, svcname); - - return MsRegReadInt(current_user ? REG_CURRENT_USER : REG_LOCAL_MACHINE, tmp, SVC_CALLING_SM_PROCESS_ID_VALUE); -} - -// Service main function -UINT MsService(char *name, SERVICE_FUNCTION *start, SERVICE_FUNCTION *stop, UINT icon, char *cmd_line) -{ - UINT mode; - UINT ret = 0; - char *arg; - wchar_t *arg_w; - TOKEN_LIST *t = NULL; - UNI_TOKEN_LIST *ut = NULL; - char *service_name; - wchar_t *service_title; - wchar_t *service_description; - wchar_t *service_title_uni; - char tmp[MAX_SIZE]; - bool restoreReg = false; - bool silent = false; - bool is_win32_service_mode = false; - // Validate arguments - if (name == NULL || start == NULL || stop == NULL) - { - return ret; - } - - g_start = start; - g_stop = stop; - StrCpy(g_service_name, sizeof(g_service_name), name); - StrLower(g_service_name); - - // Determine whether it's in Win32 service mode - if (cmd_line != NULL && lstrcmpiA(cmd_line, SVC_ARG_SERVICE) == 0) - { - HINSTANCE h_advapi32 = LoadLibraryA("advapi32.dll"); - - if (h_advapi32 != NULL) - { - // Check whether there is the SCM in the service mode - _StartServiceCtrlDispatcher = - (BOOL (__stdcall *)(const LPSERVICE_TABLE_ENTRY)) - GetProcAddress(h_advapi32, "StartServiceCtrlDispatcherW"); - - _RegisterServiceCtrlHandler = - (SERVICE_STATUS_HANDLE (__stdcall *)(LPCTSTR,LPHANDLER_FUNCTION)) - GetProcAddress(h_advapi32, "RegisterServiceCtrlHandlerW"); - - _SetServiceStatus = - (BOOL (__stdcall *)(SERVICE_STATUS_HANDLE,LPSERVICE_STATUS)) - GetProcAddress(h_advapi32, "SetServiceStatus"); - - if (_StartServiceCtrlDispatcher != NULL && - _RegisterServiceCtrlHandler != NULL && - _SetServiceStatus != NULL) - { - is_win32_service_mode = true; - } - } - } - - // Run the service using the SCM in the case of Win32 service mode - if (is_win32_service_mode) - { - SERVICE_TABLE_ENTRY dispatch_table[] = - { - {"", MsServiceDispatcher}, - {NULL, NULL}, - }; - - MsSetErrorModeToSilent(); - - if (_StartServiceCtrlDispatcher(dispatch_table) == false) - { - MessageBox(NULL, "StartServiceCtrlDispatcher() Failed.", "MsServiceMode()", MB_SETFOREGROUND | MB_TOPMOST | MB_SERVICE_NOTIFICATION | MB_OK | MB_ICONEXCLAMATION); - } - else - { - MsUpdateServiceConfig(g_service_name); - } - - // Abort here in the case of using the SCM - _exit(0); - return 0; - } - - // Start of the Mayaqua -#if defined(_DEBUG) || defined(DEBUG) // In VC++ compilers, the macro is "_DEBUG", not "DEBUG". - // If set memcheck = true, the program will be vitally slow since it will log all malloc() / realloc() / free() calls to find the cause of memory leak. - // For normal debug we set memcheck = false. - // Please set memcheck = true if you want to test the cause of memory leaks. - InitMayaqua(false, true, 0, NULL); -#else - InitMayaqua(false, false, 0, NULL); -#endif - - // Stop the MS-IME - MsDisableIme(); - - // Get the information about the service from the string table - Format(tmp, sizeof(tmp), SVC_NAME, name); - service_name = _SS(tmp); - Format(tmp, sizeof(tmp), SVC_TITLE, name); - service_title = _UU(tmp); - service_title_uni = _UU(tmp); - Format(tmp, sizeof(tmp), SVC_DESCRIPT, name); - service_description = _UU(tmp); - - if (StrLen(service_name) == 0 || UniStrLen(service_title) == 0) - { - // The service information isn't found - MsgBoxEx(NULL, MB_ICONSTOP, _UU("SVC_NOT_FOUND"), name); - } - else - { - wchar_t path[MAX_SIZE]; - // Check the argument - mode = SVC_MODE_NONE; - - t = GetCommandLineToken(); - arg = NULL; - - ut = GetCommandLineUniToken(); - arg_w = NULL; - - if (t->NumTokens >= 1) - { - arg = t->Token[0]; - } - if(t->NumTokens >= 2) - { - if(StrCmpi(t->Token[1], SVC_ARG_SILENT) == 0) - { - silent = true; - } - } - - if (ut->NumTokens >= 1) - { - arg_w = ut->Token[0]; - } - - if (arg != NULL) - { - if (StrCmpi(arg, SVC_ARG_INSTALL) == 0) - { - mode = SVC_MODE_INSTALL; - } - if (StrCmpi(arg, SVC_ARG_UNINSTALL) == 0) - { - mode = SVC_MODE_UNINSTALL; - } - if (StrCmpi(arg, SVC_ARG_START) == 0) - { - mode = SVC_MODE_START; - } - if (StrCmpi(arg, SVC_ARG_STOP) == 0) - { - mode = SVC_MODE_STOP; - } - if (StrCmpi(arg, SVC_ARG_TEST) == 0) - { - mode = SVC_MODE_TEST; - } - if (StrCmpi(arg, SVC_ARG_USERMODE) == 0) - { - mode = SVC_MODE_USERMODE; - } - if (StrCmpi(arg, SVC_ARG_SETUP_INSTALL) == 0) - { - mode = SVC_MODE_SETUP_INSTALL; - } - if (StrCmpi(arg, SVC_ARG_SETUP_UNINSTALL) == 0) - { - mode = SVC_MODE_SETUP_UNINSTALL; - } - if (StrCmpi(arg, SVC_ARG_WIN9X_SERVICE) == 0) - { - mode = SVC_MODE_WIN9X_SERVICE; - } - if (StrCmpi(arg, SVC_ARG_WIN9X_INSTALL) == 0) - { - mode = SVC_MODE_WIN9X_INSTALL; - } - if (StrCmpi(arg, SVC_ARG_WIN9X_UNINSTALL) == 0) - { - mode = SVC_MODE_WIN9X_UNINSTALL; - } - if (StrCmpi(arg, SVC_ARG_TCP) == 0) - { - mode = SVC_MODE_TCP; - } - if (StrCmpi(arg, SVC_ARG_TCP_UAC) == 0) - { - mode = SVC_MODE_TCP_UAC; - } - if (StrCmpi(arg, SVC_ARG_TCP_SETUP) == 0) - { - mode = SVC_MODE_TCPSETUP; - } - if (StrCmpi(arg, SVC_ARG_TRAFFIC) == 0) - { - mode = SVC_MODE_TRAFFIC; - } - if (StrCmpi(arg, SVC_ARG_UIHELP) == 0) - { - mode = SVC_MODE_UIHELP; - } - if (StrCmpi(arg, SVC_ARG_USERMODE_SHOWTRAY) == 0) - { - char tmp[MAX_SIZE]; - mode = SVC_MODE_USERMODE; - Format(tmp, sizeof(tmp), SVC_HIDETRAY_REG_VALUE, service_title); - MsRegDeleteValue(REG_CURRENT_USER, SVC_USERMODE_SETTING_KEY, tmp); - } - if (StrCmpi(arg, SVC_ARG_USERMODE_HIDETRAY) == 0) - { - char tmp[MAX_SIZE]; - mode = SVC_MODE_USERMODE; - Format(tmp, sizeof(tmp), SVC_HIDETRAY_REG_VALUE, service_title); - MsRegWriteInt(REG_CURRENT_USER, SVC_USERMODE_SETTING_KEY, tmp, 1); - } - if (StrCmpi(arg, SVC_ARG_SERVICE) == 0) - { - mode = SVC_MODE_SERVICE; - } - - if (mode != SVC_MODE_NONE) - { - // Network Config - MsInitGlobalNetworkConfig(); - } - } - - // Get the command-line name when running as a service - UniFormat(path, sizeof(path), SVC_RUN_COMMANDLINE, ms->ExeFileNameW); - - if ((mode == SVC_MODE_INSTALL || mode == SVC_MODE_UNINSTALL || mode == SVC_MODE_START || - mode == SVC_MODE_STOP || mode == SVC_MODE_SERVICE) && - (ms->IsNt == false)) - { - // Tried to use the command for the NT in non-WindowsNT system - MsgBox(NULL, MB_ICONSTOP, _UU("SVC_NT_ONLY")); - } - else if ((mode == SVC_MODE_INSTALL || mode == SVC_MODE_UNINSTALL || mode == SVC_MODE_START || - mode == SVC_MODE_STOP || mode == SVC_MODE_SERVICE) && - (ms->IsAdmin == false)) - { - // Do not have Administrators privilege - MsgBox(NULL, MB_ICONEXCLAMATION, _UU("SVC_NOT_ADMIN")); - } - else - { - // Performs processing depend on mode - switch (mode) - { - case SVC_MODE_NONE: - // Exit by showing a guidance message - if (arg_w != NULL && UniEndWith(arg_w, L".vpn")) - { - if (MsgBox(NULL, MB_ICONQUESTION | MB_YESNO, _UU("CM_VPN_FILE_CLICKED")) == IDYES) - { - wchar_t vpncmgr[MAX_PATH]; - wchar_t filename[MAX_PATH]; - - UniFormat(filename, sizeof(filename), L"\"%s\"", arg_w); - UniFormat(vpncmgr, sizeof(vpncmgr), L"%s\\vpncmgr.exe", MsGetExeDirNameW()); - - RunW(vpncmgr, filename, false, false); - } - } - else - { - MsgBoxEx(NULL, MB_ICONINFORMATION, _UU("SVC_HELP"), - service_title, service_name, service_title, service_title, service_name, service_title, service_name, service_title, service_name, service_title, service_name, service_title, service_title); - } - break; - - case SVC_MODE_SETUP_INSTALL: - // Setup.exe installation mode - // Uninstall the old version - MsWriteCallingServiceManagerProcessId(service_name, MsGetCurrentProcessId()); - restoreReg = true; - - if (MsIsServiceInstalled(service_name)) - { - if (MsIsServiceRunning(service_name)) - { - MsStopService(service_name); - } - MsUninstallService(service_name); - } - if (MsInstallServiceW(service_name, service_title, service_description, path) == false) - { - ret = 1; - } - MsStartService(service_name); - MsWriteCallingServiceManagerProcessId(service_name, 0); - break; - - case SVC_MODE_SETUP_UNINSTALL: - // Setup.exe uninstall mode - MsWriteCallingServiceManagerProcessId(service_name, MsGetCurrentProcessId()); - restoreReg = true; - - if (MsIsServiceInstalled(service_name)) - { - if (MsIsServiceRunning(service_name)) - { - MsStopService(service_name); - } - if (MsUninstallService(service_name) == false) - { - ret = 1; - } - } - break; - - case SVC_MODE_INSTALL: - // Install the service - // Check whether it is already installed - MsWriteCallingServiceManagerProcessId(service_name, MsGetCurrentProcessId()); - restoreReg = true; - - if (MsIsServiceInstalled(service_name)) - { - // Already installed - // Show a message asking if you want to uninstall - if(silent == true) - { - // Always cancel the operation - break; - } - if (MsgBoxEx(NULL, MB_ICONQUESTION | MB_YESNO | MB_DEFBUTTON2, _UU("SVC_ALREADY_INSTALLED"), - service_title, service_name) == IDNO) - { - // Cancel the operation - break; - } - else - { - // Whether the existing service is working? - if (MsIsServiceRunning(service_name)) - { - // Try to stop - if (MsStopService(service_name) == false) - { - // Failed to stop - if(silent == false) - { - MsgBoxEx(NULL, MB_ICONSTOP, _UU("SVC_STOP_FAILED"), - service_title, service_name); - } - break; - } - } - // Uninstall - if (MsUninstallService(service_name) == false) - { - // Failed to uninstall - if(silent == false) - { - MsgBoxEx(NULL, MB_ICONSTOP, _UU("SVC_UNINSTALL_FAILED"), - service_title, service_name); - } - break; - } - } - } - - // Do the installation - if (MsInstallServiceW(service_name, service_title, service_description, path) == false) - { - // Failed to install - if(silent == false) - { - MsgBoxEx(NULL, MB_ICONSTOP, _UU("SVC_INSTALL_FAILED"), - service_title, service_name); - } - break; - } - - // Start the service - if (MsStartService(service_name) == false) - { - // Failed to start - if(silent == false) - { - MsgBoxEx(NULL, MB_ICONEXCLAMATION, _UU("SVC_INSTALL_FAILED_2"), - service_title, service_name, path); - } - break; - } - - // All successful - if(silent == false) - { - MsgBoxEx(NULL, MB_ICONINFORMATION, _UU("SVC_INSTALL_OK"), - service_title, service_name, path); - } - break; - - case SVC_MODE_UNINSTALL: - // Uninstall the service - // Check whether it is already installed - MsWriteCallingServiceManagerProcessId(service_name, MsGetCurrentProcessId()); - restoreReg = true; - - if (MsIsServiceInstalled(service_name) == false) - { - if(silent == false) - { - MsgBoxEx(NULL, MB_ICONEXCLAMATION, _UU("SVC_NOT_INSTALLED"), - service_title, service_name, path); - } - break; - } - - // If the service is currently running, stop it - if (MsIsServiceRunning(service_name)) - { - // Stop the service - if (MsStopService(service_name) == false) - { - // Failed to stop - if(silent == false) - { - MsgBoxEx(NULL, MB_ICONSTOP, _UU("SVC_STOP_FAILED"), - service_title, service_name); - } - break; - } - } - - // Uninstall the service - if (MsUninstallService(service_name) == false) - { - if(silent == false) - { - MsgBoxEx(NULL, MB_ICONSTOP, _UU("SVC_UNINSTALL_FAILED"), - service_title, service_name); - } - break; - } - - // All successful - if(silent == false) - { - MsgBoxEx(NULL, MB_ICONINFORMATION, _UU("SVC_UNINSTALL_OK"), - service_title, service_name); - } - break; - - case SVC_MODE_START: - // Start the service - MsWriteCallingServiceManagerProcessId(service_name, MsGetCurrentProcessId()); - restoreReg = true; - - if (MsIsServiceInstalled(service_name) == false) - { - // Service is not installed - if(silent == false) - { - MsgBoxEx(NULL, MB_ICONEXCLAMATION, _UU("SVC_NOT_INSTALLED"), - service_title, service_name); - } - break; - } - - // Confirm whether the service is running - if (MsIsServiceRunning(service_name)) - { - // Service is running - if(silent == false) - { - MsgBoxEx(NULL, MB_ICONINFORMATION, _UU("SVR_ALREADY_START"), - service_title, service_name); - } - break; - } - - // Start the service - if (MsStartService(service_name) == false) - { - // Failed to start - if(silent == false) - { - MsgBoxEx(NULL, MB_ICONEXCLAMATION, _UU("SVC_START_FAILED"), - service_title, service_name); - } - break; - } - - // All successful - if(silent == false) - { - MsgBoxEx(NULL, MB_ICONINFORMATION, _UU("SVC_START_OK"), - service_title, service_name); - } - break; - - case SVC_MODE_STOP: - // Stop the service - MsWriteCallingServiceManagerProcessId(service_name, MsGetCurrentProcessId()); - restoreReg = true; - - if (MsIsServiceInstalled(service_name) == false) - { - // Service is not installed - if(silent == false) - { - MsgBoxEx(NULL, MB_ICONEXCLAMATION, _UU("SVC_NOT_INSTALLED"), - service_title, service_name); - } - break; - } - - // Confirm whether the service is running - if (MsIsServiceRunning(service_name) == false) - { - // The service is stopped - if(silent == false) - { - MsgBoxEx(NULL, MB_ICONINFORMATION, _UU("SVC_ALREADY_STOP"), - service_title, service_name); - } - break; - } - // Stop the service - if (MsStopService(service_name) == false) - { - // Failed to stop - if(silent == false) - { - MsgBoxEx(NULL, MB_ICONEXCLAMATION, _UU("SVC_STOP_FAILED"), - service_title, service_name); - } - break; - } - - // All successful - if(silent == false) - { - MsgBoxEx(NULL, MB_ICONINFORMATION, _UU("SVC_STOP_OK"), - service_title, service_name); - } - break; - - case SVC_MODE_TEST: - // Test mode - MsTestModeW(service_title, start, stop); - break; - - case SVC_MODE_WIN9X_SERVICE: - // Win9x service mode (hide icon in the task tray unconditionally) - if (MsIsNt()) - { - // Don't do this on Windows 2000 or later - break; - } - service_for_9x_mode = true; - // Not a oblivion to break - case SVC_MODE_USERMODE: - // User mode - MsUserModeW(service_title, start, stop, icon); - break; - - case SVC_MODE_WIN9X_INSTALL: - // Win9x installation mode - MsWriteCallingServiceManagerProcessId(service_name, MsGetCurrentProcessId()); - restoreReg = true; - - if (MsIsNt() == false) - { - // Adding a registry key - char cmdline[MAX_PATH]; - Format(cmdline, sizeof(cmdline), "\"%s\" %s", - MsGetExeFileName(), SVC_ARG_WIN9X_SERVICE); - MsRegWriteStr(REG_LOCAL_MACHINE, WIN9X_SVC_REGKEY_1, - name, cmdline); - MsRegWriteStr(REG_LOCAL_MACHINE, WIN9X_SVC_REGKEY_2, - name, cmdline); - - // Start - //Run(MsGetExeFileName(), SVC_ARG_WIN9X_SERVICE, false, false); - } - break; - - case SVC_MODE_WIN9X_UNINSTALL: - // Win9x uninstall mode - MsWriteCallingServiceManagerProcessId(service_name, MsGetCurrentProcessId()); - restoreReg = true; - - if (MsIsNt() == false) - { - // Delete the registry key - MsRegDeleteValue(REG_LOCAL_MACHINE, WIN9X_SVC_REGKEY_1, - name); - MsRegDeleteValue(REG_LOCAL_MACHINE, WIN9X_SVC_REGKEY_2, - name); - - // Terminate all the processes of PacketiX VPN Client other than itself - MsKillOtherInstance(); - } - break; - - case SVC_MODE_SERVICE: - // Run as a service - // Obsoleted (2012.12.31) (Do this in the above code) - //MsServiceMode(start, stop); - break; - - case SVC_MODE_TCP: - case SVC_MODE_TCP_UAC: - // TCP Utility - InitCedar(); - InitWinUi(service_title_uni, NULL, 0); - - if (MsIsVista() && MsIsAdmin() == false && mode != SVC_MODE_TCP_UAC) - { - void *handle = NULL; - if (MsExecuteEx2W(ms->ExeFileNameW, SVC_ARG_TCP_UAC_W, &handle, true) == false) - { - ShowTcpIpConfigUtil(NULL, true); - } - else - { - MsWaitProcessExit(handle); - } - } - else - { - ShowTcpIpConfigUtil(NULL, true); - } - - FreeWinUi(); - FreeCedar(); - break; - - case SVC_MODE_TCPSETUP: - // TCP optimization mode (This is called by the installer) - InitCedar(); - InitWinUi(service_title_uni, NULL, 0); - - if (MsIsVista() && MsIsAdmin() == false) - { - void *handle = NULL; - if (MsExecuteEx2W(ms->ExeFileNameW, arg_w, &handle, true) == false) - { - ShowTcpIpConfigUtil(NULL, false); - } - else - { - MsWaitProcessExit(handle); - } - } - else - { - ShowTcpIpConfigUtil(NULL, false); - } - - FreeWinUi(); - FreeCedar(); - break; - - case SVC_MODE_TRAFFIC: - // Communication throughput measurement tool - InitCedar(); - InitWinUi(service_title_uni, NULL, 0); - CmTraffic(NULL); - FreeWinUi(); - FreeCedar(); - break; - - case SVC_MODE_UIHELP: - // Starting the UI Helper - CnStart(); - break; - } - - } - FreeToken(t); - UniFreeToken(ut); - - if (restoreReg) - { - MsWriteCallingServiceManagerProcessId(service_name, 0); - } - } - - FreeMayaqua(); - - return 0; -} - -// Get the user name of the specified session -wchar_t *MsGetSessionUserName(UINT session_id) -{ - if (MsIsTerminalServiceInstalled() || MsIsUserSwitchingInstalled()) - { - wchar_t *ret; - wchar_t *name; - UINT size = 0; - if (ms->nt->WTSQuerySessionInformation(WTS_CURRENT_SERVER_HANDLE, session_id, - WTSUserName, (wchar_t *)&name, &size) == false) - { - return NULL; - } - - if (name == NULL || UniStrLen(name) == 0) - { - ret = NULL; - } - else - { - ret = UniCopyStr(name); - } - - ms->nt->WTSFreeMemory(name); - - return ret; - } - return NULL; -} - -// Get whether the current terminal session is active -bool MsIsCurrentTerminalSessionActive() -{ - return MsIsTerminalSessionActive(MsGetCurrentTerminalSessionId()); -} - -// Get whether the specified terminal session is active -bool MsIsTerminalSessionActive(UINT session_id) -{ - if (MsIsTerminalServiceInstalled() || MsIsUserSwitchingInstalled()) - { - UINT *status = NULL; - UINT size = sizeof(status); - bool active = true; - - if (ms->nt->WTSQuerySessionInformation(WTS_CURRENT_SERVER_HANDLE, session_id, - WTSConnectState, (wchar_t *)&status, &size) == false) - { - return true; - } - - switch (*status) - { - case WTSDisconnected: - case WTSShadow: - case WTSIdle: - case WTSDown: - case WTSReset: - active = false; - break; - } - - ms->nt->WTSFreeMemory(status); - - return active; - } - - return true; -} - -// Get the current terminal session ID -UINT MsGetCurrentTerminalSessionId() -{ - if (MsIsTerminalServiceInstalled() || MsIsUserSwitchingInstalled()) - { - UINT ret; - UINT *session_id = NULL; - UINT size = sizeof(session_id); - if (ms->nt->WTSQuerySessionInformation(WTS_CURRENT_SERVER_HANDLE, WTS_CURRENT_SESSION, - WTSSessionId, (wchar_t *)&session_id, &size) == false) - { - return 0; - } - - ret = *session_id; - - ms->nt->WTSFreeMemory(session_id); - - return ret; - } - - return 0; -} - -// Examine whether the user switching is installed -bool MsIsUserSwitchingInstalled() -{ - OS_INFO *info = GetOsInfo(); - OSVERSIONINFOEX i; - - if (OS_IS_WINDOWS_NT(info->OsType) == false) - { - return false; - } - - if (ms->nt->WTSDisconnectSession == NULL || - ms->nt->WTSFreeMemory == NULL || - ms->nt->WTSQuerySessionInformation == NULL) - { - return false; - } - - if (GET_KETA(info->OsType, 100) < 2) - { - return false; - } - - Zero(&i, sizeof(i)); - i.dwOSVersionInfoSize = sizeof(i); - if (GetVersionEx((OSVERSIONINFO *)&i) == false) - { - return false; - } - - if (i.wSuiteMask & VER_SUITE_SINGLEUSERTS) - { - return true; - } - - return false; -} - -// Examine whether Windows 2000 or later -bool MsIsWin2000OrGreater() -{ - OS_INFO *info = GetOsInfo(); - - if (OS_IS_WINDOWS_NT(info->OsType) == false) - { - return false; - } - - if (GET_KETA(info->OsType, 100) >= 2) - { - return true; - } - - return false; -} - -// Examine whether Windows XP or later -bool MsIsWinXPOrGreater() -{ - OS_INFO *info = GetOsInfo(); - - if (OS_IS_WINDOWS_NT(info->OsType) == false) - { - return false; - } - - if (GET_KETA(info->OsType, 100) >= 3) - { - return true; - } - - return false; -} - -// Examine whether the Terminal Services is installed -bool MsIsTerminalServiceInstalled() -{ - OS_INFO *info = GetOsInfo(); - OSVERSIONINFOEX i; - - if (OS_IS_WINDOWS_NT(info->OsType) == false) - { - return false; - } - - if (ms->nt->WTSDisconnectSession == NULL || - ms->nt->WTSFreeMemory == NULL || - ms->nt->WTSQuerySessionInformation == NULL) - { - return false; - } - - if (GET_KETA(info->OsType, 100) < 2) - { - return false; - } - - Zero(&i, sizeof(i)); - i.dwOSVersionInfoSize = sizeof(i); - if (GetVersionEx((OSVERSIONINFO *)&i) == false) - { - return false; - } - - if (i.wSuiteMask & VER_SUITE_TERMINAL || i.wSuiteMask & VER_SUITE_SINGLEUSERTS) - { - return true; - } - - return false; -} - -// Stop the service -bool MsStopService(char *name) -{ - SC_HANDLE sc, service; - bool ret = false; - // Validate arguments - if (name == NULL) - { - return false; - } - if (ms->IsNt == false) - { - return false; - } - - sc = ms->nt->OpenSCManager(NULL, NULL, SC_MANAGER_ALL_ACCESS); - if (sc == NULL) - { - return false; - } - - service = ms->nt->OpenService(sc, name, SERVICE_ALL_ACCESS); - if (service != NULL) - { - SERVICE_STATUS st; - ret = ms->nt->ControlService(service, SERVICE_CONTROL_STOP, &st); - - ms->nt->CloseServiceHandle(service); - } - - if (ret) - { - UINT64 end = Tick64() + 10000ULL; - while (Tick64() < end) - { - if (MsIsServiceRunning(name) == false) - { - break; - } - - SleepThread(250); - } - } - - ms->nt->CloseServiceHandle(sc); - return ret; -} - -// Start the service -bool MsStartService(char *name) -{ - return MsStartServiceEx(name, NULL); -} -bool MsStartServiceEx(char *name, UINT *error_code) -{ - SC_HANDLE sc, service; - bool ret = false; - static UINT dummy = 0; - // Validate arguments - if (name == NULL) - { - return false; - } - if (ms->IsNt == false) - { - return false; - } - if (error_code == NULL) - { - error_code = &dummy; - } - - *error_code = 0; - - sc = ms->nt->OpenSCManager(NULL, NULL, SC_MANAGER_ALL_ACCESS); - if (sc == NULL) - { - *error_code = GetLastError(); - return false; - } - - service = ms->nt->OpenService(sc, name, SERVICE_ALL_ACCESS); - if (service != NULL) - { - ret = ms->nt->StartService(service, 0, NULL); - - ms->nt->CloseServiceHandle(service); - } - else - { - *error_code = GetLastError(); - } - - if (ret) - { - UINT64 end = Tick64() + 10000ULL; - while (Tick64() < end) - { - if (MsIsServiceRunning(name)) - { - break; - } - - SleepThread(250); - } - } - - ms->nt->CloseServiceHandle(sc); - return ret; -} - -// Get whether the service is running -bool MsIsServiceRunning(char *name) -{ - SC_HANDLE sc, service; - bool ret = false; - // Validate arguments - if (name == NULL || IsEmptyStr(name)) - { - return false; - } - if (ms->IsNt == false) - { - return false; - } - - sc = ms->nt->OpenSCManager(NULL, NULL, GENERIC_READ); - if (sc == NULL) - { - return false; - } - - service = ms->nt->OpenService(sc, name, GENERIC_READ); - if (service != NULL) - { - SERVICE_STATUS st; - Zero(&st, sizeof(st)); - if (ms->nt->QueryServiceStatus(service, &st)) - { - switch (st.dwCurrentState) - { - case SERVICE_CONTINUE_PENDING: - case SERVICE_PAUSE_PENDING: - case SERVICE_PAUSED: - case SERVICE_RUNNING: - case SERVICE_START_PENDING: - case SERVICE_STOP_PENDING: - ret = true; - break; - } - } - - ms->nt->CloseServiceHandle(service); - } - - ms->nt->CloseServiceHandle(sc); - return ret; -} - -// Uninstall the service -bool MsUninstallService(char *name) -{ - SC_HANDLE sc, service; - bool ret = false; - // Validate arguments - if (name == NULL) - { - return false; - } - if (ms->IsNt == false) - { - return false; - } - - MsStopService(name); - - sc = ms->nt->OpenSCManager(NULL, NULL, SC_MANAGER_ALL_ACCESS); - if (sc == NULL) - { - return false; - } - - service = ms->nt->OpenService(sc, name, SERVICE_ALL_ACCESS); - if (service != NULL) - { - if (ms->nt->DeleteService(service)) - { - ret = true; - } - ms->nt->CloseServiceHandle(service); - } - - ms->nt->CloseServiceHandle(sc); - - if (ret) - { - SleepThread(2000); - } - - return ret; -} - -// Update the title and description of the service -bool MsSetServiceDescription(char *name, wchar_t *description) -{ - SC_HANDLE sc, service; - // Validate arguments - if (name == NULL || description == NULL) - { - return false; - } - - sc = ms->nt->OpenSCManager(NULL, NULL, SC_MANAGER_ALL_ACCESS); - if (sc == NULL) - { - return false; - } - - service = ms->nt->OpenService(sc, name, SERVICE_ALL_ACCESS); - if (service != NULL) - { - if (GET_KETA(GetOsInfo()->OsType, 100) >= 2) - { - SERVICE_DESCRIPTIONW d; - - if (UniIsEmptyStr(description) == false) - { - Zero(&d, sizeof(d)); - d.lpDescription = description; - ms->nt->ChangeServiceConfig2(service, SERVICE_CONFIG_DESCRIPTION, &d); - } - } - - ms->nt->CloseServiceHandle(service); - } - - ms->nt->CloseServiceHandle(sc); - - return true; -} - -// Update the service setting -bool MsUpdateServiceConfig(char *name) -{ - SC_HANDLE sc, service; - // Validate arguments - if (name == NULL) - { - return false; - } - - // Whether just after Windows startup (deadlock prevention) - if (timeGetTime() <= (60 * 30 * 1000)) - { - if (MsRegReadInt(REG_LOCAL_MACHINE, "Software\\" GC_REG_COMPANY_NAME "\\Update Service Config", name) != 0) - { - return false; - } - } - - sc = ms->nt->OpenSCManager(NULL, NULL, SC_MANAGER_ALL_ACCESS); - if (sc == NULL) - { - return false; - } - - service = ms->nt->OpenService(sc, name, SERVICE_ALL_ACCESS); - if (service != NULL) - { - if (GET_KETA(GetOsInfo()->OsType, 100) >= 2) - { - SERVICE_FAILURE_ACTIONS action; - SC_ACTION *e; - Zero(&action, sizeof(action)); - e = ZeroMalloc(sizeof(SC_ACTION) * 3); - e[0].Delay = 10000; e[0].Type = SC_ACTION_RESTART; - e[1].Delay = 10000; e[1].Type = SC_ACTION_RESTART; - e[2].Delay = 10000; e[2].Type = SC_ACTION_RESTART; - action.cActions = 3; - action.lpsaActions = e; - action.dwResetPeriod = 1 * 60 * 60 * 24; - ms->nt->ChangeServiceConfig2(service, SERVICE_CONFIG_FAILURE_ACTIONS, &action); - - MsRegWriteInt(REG_LOCAL_MACHINE, "Software\\" GC_REG_COMPANY_NAME "\\Update Service Config", name, 1); - } - - - if (GET_KETA(GetOsInfo()->OsType, 100) >= 2) - { - SERVICE_DESCRIPTIONW d; - wchar_t *description; - char dname[MAX_SIZE]; - - Format(dname, sizeof(dname), "SVC_%s_DESCRIPT", name); - - description = _UU(dname); - - if (UniIsEmptyStr(description) == false) - { - Zero(&d, sizeof(d)); - d.lpDescription = description; - ms->nt->ChangeServiceConfig2(service, SERVICE_CONFIG_DESCRIPTION, &d); - } - } - - ms->nt->CloseServiceHandle(service); - } - - ms->nt->CloseServiceHandle(sc); - - return true; -} - -// Install the device driver -bool MsInstallDeviceDriverW(char *name, wchar_t *title, wchar_t *path, UINT *error_code) -{ - SC_HANDLE sc, service; - bool ret = false; - wchar_t name_w[MAX_SIZE]; - static UINT temp_int = 0; - // Validate arguments - if (name == NULL || title == NULL || path == NULL) - { - return false; - } - if (ms->IsNt == false) - { - return false; - } - if (error_code == NULL) - { - error_code = &temp_int; - } - - *error_code = 0; - - StrToUni(name_w, sizeof(name_w), name); - - sc = ms->nt->OpenSCManager(NULL, NULL, SC_MANAGER_ALL_ACCESS); - if (sc == NULL) - { - *error_code = GetLastError(); - return false; - } - - service = ms->nt->CreateServiceW(sc, name_w, title, SERVICE_ALL_ACCESS, - SERVICE_KERNEL_DRIVER, SERVICE_DEMAND_START, - SERVICE_ERROR_NORMAL, path, NULL, NULL, NULL, NULL, NULL); - - if (service != NULL) - { - ret = true; - - ms->nt->CloseServiceHandle(service); - } - else - { - *error_code = GetLastError(); - } - - ms->nt->CloseServiceHandle(sc); - - if (ret) - { - SleepThread(2000); - } - - return ret; -} - -// Install the service -bool MsInstallServiceW(char *name, wchar_t *title, wchar_t *description, wchar_t *path) -{ - return MsInstallServiceExW(name, title, description, path, NULL); -} -bool MsInstallServiceExW(char *name, wchar_t *title, wchar_t *description, wchar_t *path, UINT *error_code) -{ - SC_HANDLE sc, service; - bool ret = false; - wchar_t name_w[MAX_SIZE]; - static UINT temp_int = 0; - // Validate arguments - if (name == NULL || title == NULL || path == NULL) - { - return false; - } - if (ms->IsNt == false) - { - return false; - } - if (error_code == NULL) - { - error_code = &temp_int; - } - - *error_code = 0; - - StrToUni(name_w, sizeof(name_w), name); - - sc = ms->nt->OpenSCManager(NULL, NULL, SC_MANAGER_ALL_ACCESS); - if (sc == NULL) - { - *error_code = GetLastError(); - return false; - } - - service = ms->nt->CreateServiceW(sc, name_w, title, SERVICE_ALL_ACCESS, - SERVICE_WIN32_OWN_PROCESS | (MsIsVista() ? 0 : SERVICE_INTERACTIVE_PROCESS), SERVICE_AUTO_START, - SERVICE_ERROR_NORMAL, path, NULL, NULL, NULL, NULL, NULL); - - if (service != NULL) - { - ret = true; - - if (GET_KETA(GetOsInfo()->OsType, 100) >= 2) - { - SERVICE_DESCRIPTIONW d; - SERVICE_FAILURE_ACTIONS action; - SC_ACTION *e; - Zero(&d, sizeof(d)); - d.lpDescription = description; - ms->nt->ChangeServiceConfig2(service, SERVICE_CONFIG_DESCRIPTION, &d); - Zero(&action, sizeof(action)); - e = ZeroMalloc(sizeof(SC_ACTION) * 3); - e[0].Delay = 10000; e[0].Type = SC_ACTION_RESTART; - e[1].Delay = 10000; e[1].Type = SC_ACTION_RESTART; - e[2].Delay = 10000; e[2].Type = SC_ACTION_RESTART; - action.cActions = 3; - action.lpsaActions = e; - action.dwResetPeriod = 1 * 60 * 60 * 24; - ms->nt->ChangeServiceConfig2(service, SERVICE_CONFIG_FAILURE_ACTIONS, &action); - - Free(e); - } - - ms->nt->CloseServiceHandle(service); - } - else - { - *error_code = GetLastError(); - } - - ms->nt->CloseServiceHandle(sc); - - if (ret) - { - SleepThread(2000); - } - - return ret; -} - -// Check whether the specified service is installed -bool MsIsServiceInstalled(char *name) -{ - SC_HANDLE sc; - SC_HANDLE service; - bool ret = false; - // Validate arguments - if (name == NULL) - { - return false; - } - if (ms->IsNt == false) - { - return false; - } - - sc = ms->nt->OpenSCManager(NULL, NULL, GENERIC_READ); - if (sc == NULL) - { - return false; - } - - service = ms->nt->OpenService(sc, name, GENERIC_READ); - if (service != NULL) - { - ret = true; - } - - ms->nt->CloseServiceHandle(service); - ms->nt->CloseServiceHandle(sc); - - return ret; -} - -// Kill the process -void MsTerminateProcess() -{ - TerminateProcess(GetCurrentProcess(), 0); - _exit(0); -} - -// Get the Process ID -UINT MsGetProcessId() -{ - return GetCurrentProcessId(); -} - -// Lower the priority of the thread to lowest -void MsSetThreadPriorityIdle() -{ - SetThreadPriority(GetCurrentThread(), THREAD_PRIORITY_IDLE); -} - -// Raise the priority of a thread -void MsSetThreadPriorityHigh() -{ - SetThreadPriority(GetCurrentThread(), THREAD_PRIORITY_ABOVE_NORMAL); -} - -// Raise the priority of the thread to highest -void MsSetThreadPriorityRealtime() -{ - SetThreadPriority(GetCurrentThread(), THREAD_PRIORITY_ABOVE_NORMAL); - SetThreadPriority(GetCurrentThread(), THREAD_PRIORITY_HIGHEST); - SetThreadPriority(GetCurrentThread(), THREAD_PRIORITY_TIME_CRITICAL); -} - -// Restore the priority of the thread -void MsRestoreThreadPriority() -{ - SetThreadPriority(GetCurrentThread(), THREAD_PRIORITY_NORMAL); -} - -// Check whether should show the TCP setting application -bool MsIsShouldShowTcpConfigApp() -{ - MS_TCP tcp1, tcp2; - if (MsIsTcpConfigSupported() == false) - { - return false; - } - - MsGetTcpConfig(&tcp1); - if (MsLoadTcpConfigReg(&tcp2) == false) - { - return true; - } - - if (Cmp(&tcp1, &tcp2, sizeof(MS_TCP) != 0)) - { - return true; - } - - return false; -} - -// Apply the temporary settings data of registry to the TCP parameter of the Windows -void MsApplyTcpConfig() -{ - if (MsIsTcpConfigSupported()) - { - MS_TCP tcp; - - if (MsLoadTcpConfigReg(&tcp)) - { - MsSetTcpConfig(&tcp); - } - } -} - -// Check whether the dynamic configuration of TCP is supported in current state -bool MsIsTcpConfigSupported() -{ - if (MsIsNt() && MsIsAdmin()) - { - UINT type = GetOsInfo()->OsType; - - if (GET_KETA(type, 100) >= 2) - { - return true; - } - } - - return false; -} - -// Read the TCP settings from the registry setting -bool MsLoadTcpConfigReg(MS_TCP *tcp) -{ - // Validate arguments - if (tcp == NULL) - { - return false; - } - - if (MsIsNt()) - { - Zero(tcp, sizeof(MS_TCP)); - - if (MsRegIsValueEx(REG_LOCAL_MACHINE, MS_REG_TCP_SETTING_KEY, "RecvWindowSize", true) == false || - MsRegIsValueEx(REG_LOCAL_MACHINE, MS_REG_TCP_SETTING_KEY, "SendWindowSize", true) == false) - { - return false; - } - - tcp->RecvWindowSize = MsRegReadIntEx(REG_LOCAL_MACHINE, MS_REG_TCP_SETTING_KEY, "RecvWindowSize", true); - tcp->SendWindowSize = MsRegReadIntEx(REG_LOCAL_MACHINE, MS_REG_TCP_SETTING_KEY, "SendWindowSize", true); - - return true; - } - else - { - return false; - } -} - -// Remove the TCP settings from the registry -void MsDeleteTcpConfigReg() -{ - if (MsIsNt() && MsIsAdmin()) - { - MsRegDeleteKeyEx(REG_LOCAL_MACHINE, MS_REG_TCP_SETTING_KEY, true); - } -} - -// Write the TCP settings to the registry setting -void MsSaveTcpConfigReg(MS_TCP *tcp) -{ - // Validate arguments - if (tcp == NULL) - { - return; - } - - if (MsIsNt() && MsIsAdmin()) - { - MsRegWriteIntEx(REG_LOCAL_MACHINE, MS_REG_TCP_SETTING_KEY, "RecvWindowSize", tcp->RecvWindowSize, true); - MsRegWriteIntEx(REG_LOCAL_MACHINE, MS_REG_TCP_SETTING_KEY, "SendWindowSize", tcp->SendWindowSize, true); - } -} - -// Get the current TCP settings -void MsGetTcpConfig(MS_TCP *tcp) -{ - // Validate arguments - if (tcp == NULL) - { - return; - } - - Zero(tcp, sizeof(MS_TCP)); - - if (MsIsNt()) - { - UINT v; - // Initialize the network setting - MsInitGlobalNetworkConfig(); - - // Read the value of TcpWindowSize or GlobalMaxTcpWindowSize if there is - v = MsRegReadInt(REG_LOCAL_MACHINE, "SYSTEM\\CurrentControlSet\\Services\\Tcpip\\Parameters", "TcpWindowSize"); - tcp->RecvWindowSize = MAX(tcp->RecvWindowSize, v); - - v = MsRegReadInt(REG_LOCAL_MACHINE, "SYSTEM\\CurrentControlSet\\Services\\Tcpip\\Parameters", "GlobalMaxTcpWindowSize"); - tcp->RecvWindowSize = MAX(tcp->RecvWindowSize, v); - - v = MsRegReadInt(REG_LOCAL_MACHINE, "SYSTEM\\CurrentControlSet\\Services\\AFD\\Parameters", "DefaultReceiveWindow"); - tcp->RecvWindowSize = MAX(tcp->RecvWindowSize, v); - - // Read the value of DefaultSendWindow if there is - tcp->SendWindowSize = MsRegReadInt(REG_LOCAL_MACHINE, "SYSTEM\\CurrentControlSet\\Services\\AFD\\Parameters", "DefaultSendWindow"); - } -} - -// Write the TCP settings -void MsSetTcpConfig(MS_TCP *tcp) -{ - // Validate arguments - if (tcp == NULL) - { - return; - } - - if (MsIsNt() && MsIsAdmin()) - { - bool window_scaling = false; - UINT tcp1323opts; - - if (tcp->RecvWindowSize >= 65536 || tcp->SendWindowSize >= 65536) - { - window_scaling = true; - } - - // Set the Tcp1323Opts - tcp1323opts = MsRegReadInt(REG_LOCAL_MACHINE, "SYSTEM\\CurrentControlSet\\Services\\Tcpip\\Parameters", "Tcp1323Opts"); - if (window_scaling) - { - if (tcp1323opts == 0) - { - tcp1323opts = 1; - } - if (tcp1323opts == 2) - { - tcp1323opts = 3; - } - } - else - { - if (tcp1323opts == 1) - { - tcp1323opts = 0; - } - if (tcp1323opts == 3) - { - tcp1323opts = 2; - } - } - MsRegWriteInt(REG_LOCAL_MACHINE, "SYSTEM\\CurrentControlSet\\Services\\Tcpip\\Parameters", "Tcp1323Opts", tcp1323opts); - - // Set the Receive Window - if (tcp->RecvWindowSize == 0) - { - MsRegDeleteValue(REG_LOCAL_MACHINE, "SYSTEM\\CurrentControlSet\\Services\\AFD\\Parameters", - "DefaultReceiveWindow"); - MsRegDeleteValue(REG_LOCAL_MACHINE, "SYSTEM\\CurrentControlSet\\Services\\Tcpip\\Parameters", - "TcpWindowSize"); - MsRegDeleteValue(REG_LOCAL_MACHINE, "SYSTEM\\CurrentControlSet\\Services\\Tcpip\\Parameters", - "GlobalMaxTcpWindowSize"); - } - else - { - MsRegWriteInt(REG_LOCAL_MACHINE, "SYSTEM\\CurrentControlSet\\Services\\AFD\\Parameters", - "DefaultReceiveWindow", tcp->RecvWindowSize); - MsRegWriteInt(REG_LOCAL_MACHINE, "SYSTEM\\CurrentControlSet\\Services\\Tcpip\\Parameters", - "TcpWindowSize", tcp->RecvWindowSize); - MsRegWriteInt(REG_LOCAL_MACHINE, "SYSTEM\\CurrentControlSet\\Services\\Tcpip\\Parameters", - "GlobalMaxTcpWindowSize", tcp->RecvWindowSize); - } - - // Setting the Send Window - if (tcp->SendWindowSize == 0) - { - MsRegDeleteValue(REG_LOCAL_MACHINE, "SYSTEM\\CurrentControlSet\\Services\\AFD\\Parameters", - "DefaultSendWindow"); - } - else - { - MsRegWriteInt(REG_LOCAL_MACHINE, "SYSTEM\\CurrentControlSet\\Services\\AFD\\Parameters", - "DefaultSendWindow", tcp->SendWindowSize); - } - } -} - -// Initialize the global network settings -void MsInitGlobalNetworkConfig() -{ - if (MsIsNt()) - { - UINT current_window_size; - current_window_size = MsRegReadInt(REG_LOCAL_MACHINE, "SYSTEM\\CurrentControlSet\\Services\\Tcpip\\Parameters", "TcpWindowSize"); - - if (current_window_size == 65535 || current_window_size == 5980160 || - current_window_size == 16777216 || current_window_size == 16777214) - { - // Remove the strange value which is written by older version of PacketiX VPN - MsRegDeleteValue(REG_LOCAL_MACHINE, "SYSTEM\\CurrentControlSet\\Services\\AFD\\Parameters", - "DefaultReceiveWindow"); - MsRegDeleteValue(REG_LOCAL_MACHINE, "SYSTEM\\CurrentControlSet\\Services\\AFD\\Parameters", - "DefaultSendWindow"); - MsRegDeleteValue(REG_LOCAL_MACHINE, "SYSTEM\\CurrentControlSet\\Services\\Tcpip\\Parameters", - "Tcp1323Opts"); - MsRegDeleteValue(REG_LOCAL_MACHINE, "SYSTEM\\CurrentControlSet\\Services\\Tcpip\\Parameters", - "TcpWindowSize"); - MsRegDeleteValue(REG_LOCAL_MACHINE, "SYSTEM\\CurrentControlSet\\Services\\Tcpip\\Parameters", - "GlobalMaxTcpWindowSize"); - - // Set vpn_no_change = true - MsRegWriteInt(REG_LOCAL_MACHINE, "SYSTEM\\CurrentControlSet\\Services\\Tcpip\\Parameters", "vpn_no_change", 1); - MsRegWriteInt(REG_LOCAL_MACHINE, "SYSTEM\\CurrentControlSet\\Services\\AFD\\Parameters", "vpn_no_change", 1); - } - } - else - { - if (MsRegReadInt(REG_LOCAL_MACHINE, - "System\\CurrentControlSet\\Services\\VxD\\MSTCP", - "packetix_no_optimize") == 0) - { - // Disable the DeadGWDetect - MsRegWriteStr(REG_LOCAL_MACHINE, "System\\CurrentControlSet\\Services\\VxD\\MSTCP", - "DeadGWDetect", "0"); - } - } - - MsApplyTcpConfig(); -} - -// Process disabling other off-loading of network and others -void MsDisableNetworkOffloadingEtc() -{ - wchar_t netsh[MAX_SIZE]; - UINT exec_timeout = 10000; - if (MsIsNt() == false) - { - return; - } - - // Get the path of netsh.exe - CombinePathW(netsh, sizeof(netsh), MsGetSystem32DirW(), L"netsh.exe"); - - // Registry settings - MsRegWriteIntEx2(REG_LOCAL_MACHINE, "SYSTEM\\CurrentControlSet\\Services\\Tcpip\\Parameters", "DisableTaskOffload", 1, false, true); - MsRegWriteIntEx2(REG_LOCAL_MACHINE, "SYSTEM\\CurrentControlSet\\Services\\Tcpip\\Parameters", "TcpNumConnections", TCP_MAX_NUM_CONNECTIONS, false, true); - - if (MsIsVista() == false) - { - // Windows Server 2003 or earlier - MsRegWriteIntEx2(REG_LOCAL_MACHINE, "SYSTEM\\CurrentControlSet\\Services\\Tcpip\\Parameters", "EnableRSS", 1, false, true); - MsRegWriteIntEx2(REG_LOCAL_MACHINE, "SYSTEM\\CurrentControlSet\\Services\\Tcpip\\Parameters", "EnableTCPChimney", 1, false, true); - MsRegWriteIntEx2(REG_LOCAL_MACHINE, "SYSTEM\\CurrentControlSet\\Services\\Tcpip\\Parameters", "EnableTCPA", 1, false, true); - - Win32RunAndWaitProcess(netsh, L"netsh int ip set chimney disabled", true, true, exec_timeout); - SleepThread(250); - } - else - { - // Windows Vista or later - Win32RunAndWaitProcess(netsh, L"int ipv4 set global taskoffload=disabled", true, true, exec_timeout); - SleepThread(250); - Win32RunAndWaitProcess(netsh, L"int ipv6 set global taskoffload=disabled", true, true, exec_timeout); - SleepThread(250); - Win32RunAndWaitProcess(netsh, L"int tcp set global chimney=disabled", true, true, exec_timeout); - SleepThread(250); - } -} - -// Upgrade the virtual LAN card -bool MsUpgradeVLan(char *tag_name, char *connection_tag_name, char *instance_name, MS_DRIVER_VER *ver) -{ - bool ret; - - Lock(vlan_lock); - { - ret = MsUpgradeVLanWithoutLock(tag_name, connection_tag_name, instance_name, ver); - } - Unlock(vlan_lock); - - return ret; -} -bool MsUpgradeVLanWithoutLock(char *tag_name, char *connection_tag_name, char *instance_name, MS_DRIVER_VER *ver) -{ - char hwid[MAX_PATH]; - wchar_t hwid_w[MAX_PATH]; - bool ret = false; - UCHAR old_mac_address[6]; - char *s; - // Validate arguments - if (instance_name == NULL || tag_name == NULL || connection_tag_name == NULL || ver == NULL) - { - return false; - } - - if (MsIsNt() == false) - { - // Can not be upgraded in Windows 9x - return false; - } - - if (MsIsInfCatalogRequired()) - { - if (MsIsValidVLanInstanceNameForInfCatalog(instance_name) == false) - { - return false; - } - - StrUpper(instance_name); - } - - Zero(hwid, sizeof(hwid)); - Format(hwid, sizeof(hwid), DRIVER_DEVICE_ID_TAG, instance_name); - StrToUni(hwid_w, sizeof(hwid_w), hwid); - - // Examine whether the virtual LAN card with the specified name has already registered - if (MsIsVLanExists(tag_name, instance_name) == false) - { - // Not registered - return false; - } - - // Get the previous MAC address - s = MsGetMacAddress(tag_name, instance_name); - if (s == NULL) - { - Zero(old_mac_address, 6); - } - else - { - BUF *b; - b = StrToBin(s); - Free(s); - - if (b->Size == 6) - { - Copy(old_mac_address, b->Buf, b->Size); - } - else - { - Zero(old_mac_address, 6); - } - - FreeBuf(b); - } - - ret = MsUninstallVLanWithoutLock(instance_name); - - ret = MsInstallVLanWithoutLock(tag_name, connection_tag_name, instance_name, ver); - - return ret; -} - -// Test for Windows 9x -void MsWin9xTest() -{ -} - -// Update the CompatibleIDs of virtual LAN card -void MsUpdateCompatibleIDs(char *instance_name) -{ - TOKEN_LIST *t; - char id[MAX_SIZE]; - char device_title[MAX_SIZE]; - char device_title_old[MAX_SIZE]; - // Validate arguments - if (instance_name == NULL) - { - return; - } - - Format(id, sizeof(id), DRIVER_DEVICE_ID_TAG, instance_name); - Format(device_title, sizeof(device_title), VLAN_ADAPTER_NAME_TAG, instance_name); - Format(device_title_old, sizeof(device_title_old), VLAN_ADAPTER_NAME_TAG_OLD, instance_name); - - t = MsRegEnumKey(REG_LOCAL_MACHINE, "Enum\\Root\\Net"); - if (t != NULL) - { - UINT i; - for (i = 0;i < t->NumTokens;i++) - { - char keyname[MAX_PATH]; - char *str; - char *title; - - Format(keyname, sizeof(keyname), "Enum\\Root\\Net\\%s", t->Token[i]); - - title = MsRegReadStr(REG_LOCAL_MACHINE, keyname, "DeviceDesc"); - - if (title != NULL) - { - if (StrCmpi(title, device_title) == 0 || StrCmpi(title, device_title_old) == 0) - { - Format(keyname, sizeof(keyname), "Enum\\Root\\Net\\%s",t->Token[i]); - str = MsRegReadStr(REG_LOCAL_MACHINE, keyname, "CompatibleIDs"); - if (str != NULL) - { - Free(str); - } - else - { - MsRegWriteStr(REG_LOCAL_MACHINE, keyname, "CompatibleIDs", id); - } - } - Free(title); - } - } - - FreeToken(t); - } - - MsRegWriteStr(REG_LOCAL_MACHINE, "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Setup", "SourcePath", - ms->System32Dir); -} - -// Installing the virtual LAN card (for Win9x) -bool MsInstallVLan9x(char *instance_name, MS_DRIVER_VER *ver) -{ - char sysdir[MAX_PATH]; - char infdir[MAX_PATH]; - char otherdir[MAX_PATH]; - char syspath[MAX_PATH]; - char syspath2[MAX_PATH]; - char infpath[MAX_PATH]; - char vpn16[MAX_PATH]; - char infpath_src[MAX_PATH]; - char syspath_src[MAX_PATH]; - char neo_sys[MAX_PATH]; - // Validate arguments - if (instance_name == NULL || ver == NULL) - { - return false; - } - - StrCpy(sysdir, sizeof(sysdir), MsGetSystem32Dir()); - Format(infdir, sizeof(infdir), "%s\\inf", MsGetWindowsDir()); - Format(otherdir, sizeof(otherdir), "%s\\other", infdir); - Format(syspath, sizeof(syspath), "%s\\Neo_%s.sys", sysdir, instance_name); - Format(syspath2, sizeof(syspath2), "%s\\Neo_%s.sys", infdir, instance_name); - Format(infpath, sizeof(infpath), "%s\\Neo_%s.inf", infdir, instance_name); - Format(vpn16, sizeof(vpn16), "%s\\vpn16.exe", MsGetMyTempDir()); - - MakeDir(otherdir); - - Format(neo_sys, sizeof(neo_sys), "Neo_%s.sys", instance_name); - - // Copy of vpn16.exe - FileCopy("|vpn16.exe", vpn16); - - // Starting the installation - if (MsStartDriverInstall(instance_name, NULL, neo_sys, NULL, ver) == false) - { - return false; - } - MsGetDriverPathA(instance_name, NULL, NULL, infpath_src, syspath_src, NULL, NULL, neo_sys); - - // Copy of the inf file - FileCopy(infpath_src, infpath); - - // Copy of the sys file - FileCopy(syspath_src, syspath); - - // Install the device driver - if (Run(vpn16, instance_name, false, true) == false) - { - return false; - } - - // Update the CompatibleIDs - MsUpdateCompatibleIDs(instance_name); - - return true; -} - -// Child window enumeration procedure -bool CALLBACK MsEnumChildWindowProc(HWND hWnd, LPARAM lParam) -{ - LIST *o = (LIST *)lParam; - - if (o != NULL) - { - MsEnumChildWindows(o, hWnd); - } - - return true; -} - -// Enumerate specified window and all the its child windows -LIST *MsEnumChildWindows(LIST *o, HWND hWnd) -{ - // Validate arguments - if (hWnd == NULL) - { - return NULL; - } - - if (o == NULL) - { - o = NewListFast(NULL); - } - - MsAddWindowToList(o, hWnd); - - EnumChildWindows(hWnd, MsEnumChildWindowProc, (LPARAM)o); - - return o; -} - -// Add a window to the list -void MsAddWindowToList(LIST *o, HWND hWnd) -{ - // Validate arguments - if (o == NULL || hWnd == NULL) - { - return; - } - - if (IsInList(o, hWnd) == false) - { - Add(o, hWnd); - } -} - -// Enumeration of the window that the thread owns -bool CALLBACK MsEnumThreadWindowProc(HWND hWnd, LPARAM lParam) -{ - LIST *o = (LIST *)lParam; - - if (o == NULL) - { - return false; - } - - MsEnumChildWindows(o, hWnd); - - return true; -} - -// Window enumeration procedure -BOOL CALLBACK EnumTopWindowProc(HWND hWnd, LPARAM lParam) -{ - LIST *o = (LIST *)lParam; - HWND hParent; - char c1[MAX_SIZE], c2[MAX_SIZE]; - // Validate arguments - if (hWnd == NULL || o == NULL) - { - return TRUE; - } - - Zero(c1, sizeof(c1)); - Zero(c2, sizeof(c2)); - - hParent = GetParent(hWnd); - - GetClassName(hWnd, c1, sizeof(c1)); - - if (hParent != NULL) - { - GetClassName(hParent, c2, sizeof(c2)); - } - - if (StrCmpi(c1, "SysIPAddress32") != 0 && (IsEmptyStr(c2) || StrCmpi(c2, "SysIPAddress32") != 0)) - { - AddWindow(o, hWnd); - } - - return TRUE; -} - -// Child window enumeration procedure -BOOL CALLBACK EnumChildWindowProc(HWND hWnd, LPARAM lParam) -{ - ENUM_CHILD_WINDOW_PARAM *p = (ENUM_CHILD_WINDOW_PARAM *)lParam; - LIST *o; - HWND hParent; - char c1[MAX_SIZE], c2[MAX_SIZE]; - bool ok = false; - // Validate arguments - if (hWnd == NULL || p == NULL) - { - return TRUE; - } - - o = p->o; - - Zero(c1, sizeof(c1)); - Zero(c2, sizeof(c2)); - - hParent = GetParent(hWnd); - - GetClassName(hWnd, c1, sizeof(c1)); - - if (hParent != NULL) - { - GetClassName(hParent, c2, sizeof(c2)); - } - - if (p->include_ipcontrol || (StrCmpi(c1, "SysIPAddress32") != 0 && (IsEmptyStr(c2) || StrCmpi(c2, "SysIPAddress32") != 0))) - { - ok = true; - } - - if (MsIsWine()) - { - if (StrCmpi(c1, "SysIPAddress32") == 0 || StrCmpi(c2, "SysIPAddress32") == 0) - { - ok = true; - } - } - - if (ok) - { - AddWindow(o, hWnd); - - if (p->no_recursion == false) - { - EnumChildWindows(hWnd, EnumChildWindowProc, (LPARAM)p); - } - } - - return TRUE; -} -LIST *EnumAllTopWindow() -{ - LIST *o = NewWindowList(); - - EnumWindows(EnumTopWindowProc, (LPARAM)o); - - return o; -} - -// Enumerate the child windows of all that is in the specified window -LIST *EnumAllChildWindow(HWND hWnd) -{ - return EnumAllChildWindowEx(hWnd, false, false, false); -} -LIST *EnumAllChildWindowEx(HWND hWnd, bool no_recursion, bool include_ipcontrol, bool no_self) -{ - ENUM_CHILD_WINDOW_PARAM p; - LIST *o = NewWindowList(); - - Zero(&p, sizeof(p)); - p.include_ipcontrol = include_ipcontrol; - p.no_recursion = no_recursion; - p.o = o; - - if (no_self == false) - { - AddWindow(o, hWnd); - } - - EnumChildWindows(hWnd, EnumChildWindowProc, (LPARAM)&p); - - return o; -} - -// Release of the window list -void FreeWindowList(LIST *o) -{ - UINT i; - // Validate arguments - if (o == NULL) - { - return; - } - - for (i = 0;i < LIST_NUM(o);i++) - { - HWND *e = LIST_DATA(o, i); - - Free(e); - } - - ReleaseList(o); -} - -// Add a window to the window list -void AddWindow(LIST *o, HWND hWnd) -{ - HWND t, *e; - // Validate arguments - if (o == NULL || hWnd == NULL) - { - return; - } - - t = hWnd; - - if (Search(o, &t) != NULL) - { - return; - } - - e = ZeroMalloc(sizeof(HWND)); - *e = hWnd; - - Insert(o, e); -} - -// Comparison of the window list items -int CmpWindowList(void *p1, void *p2) -{ - HWND *h1, *h2; - if (p1 == NULL || p2 == NULL) - { - return 0; - } - h1 = *(HWND **)p1; - h2 = *(HWND **)p2; - if (h1 == NULL || h2 == NULL) - { - return 0; - } - - return Cmp(h1, h2, sizeof(HWND)); -} - -// Creating a new window list -LIST *NewWindowList() -{ - return NewListFast(CmpWindowList); -} - -// Determine whether it's Windows Vista or later -bool MsIsVista() -{ - OS_INFO *info = GetOsInfo(); - - if (info == NULL) - { - return false; - } - - if (OS_IS_WINDOWS_NT(info->OsType)) - { - if (GET_KETA(info->OsType, 100) >= 5) - { - return true; - } - } - - return false; -} - -// Determine whether it's Windows 7 or later -bool MsIsWindows7() -{ - OS_INFO *info = GetOsInfo(); - - if (info == NULL) - { - return false; - } - - if (OS_IS_WINDOWS_NT(info->OsType)) - { - if (GET_KETA(info->OsType, 100) >= 6) - { - return true; - } - } - - return false; -} - -// Determine whether it's Windows 10 or later -bool MsIsWindows10() -{ - OS_INFO *info = GetOsInfo(); - - if (info == NULL) - { - return false; - } - - if (OS_IS_WINDOWS_NT(info->OsType)) - { - if (GET_KETA(info->OsType, 100) == 7) - { - if (GET_KETA(info->OsType, 1) >= 2) - { - return true; - } - } - - if (GET_KETA(info->OsType, 100) >= 8) - { - return true; - } - } - - return false; -} - -// Determine whether it's Windows 8.1 or later -bool MsIsWindows81() -{ - OS_INFO *info = GetOsInfo(); - - if (info == NULL) - { - return false; - } - - if (OS_IS_WINDOWS_NT(info->OsType)) - { - if (GET_KETA(info->OsType, 100) == 7) - { - if (GET_KETA(info->OsType, 1) >= 1) - { - return true; - } - } - - if (GET_KETA(info->OsType, 100) >= 8) - { - return true; - } - } - - return false; -} - -// Determine whether it's Windows 8 or later -bool MsIsWindows8() -{ - OS_INFO *info = GetOsInfo(); - - if (info == NULL) - { - return false; - } - - if (OS_IS_WINDOWS_NT(info->OsType)) - { - if (GET_KETA(info->OsType, 100) >= 7) - { - return true; - } - } - - return false; -} - -// Whether INF catalog signature is required -bool MsIsInfCatalogRequired() -{ - return MsIsWindows8(); -} - -// Get the process path of the owner of the window -bool MsGetWindowOwnerProcessExeName(char *path, UINT size, HWND hWnd) -{ - DWORD procId = 0; - // Validate arguments - if (path == NULL || hWnd == NULL) - { - return false; - } - - GetWindowThreadProcessId(hWnd, &procId); - if (procId == 0) - { - return false; - } - - if (MsGetProcessExeName(path, size, procId) == false) - { - return false; - } - - return true; -} - -// Get the process path from process ID -bool MsGetProcessExeName(char *path, UINT size, UINT id) -{ - LIST *o; - MS_PROCESS *proc; - bool ret = false; - // Validate arguments - if (path == NULL) - { - return false; - } - - o = MsGetProcessList(); - proc = MsSearchProcessById(o, id); - - if (proc != NULL) - { - ret = true; - StrCpy(path, size, proc->ExeFilename); - } - - MsFreeProcessList(o); - - return ret; -} - -// Close the alert dialog -bool MsCloseWarningWindow(NO_WARNING *nw, UINT thread_id) -{ - UINT i; - LIST *o; - bool ret = false; - bool press = false; - - if (MsIsVista() == false || nw->StartTimer == 0) - { - press = true; - } - - if (nw->StartTick != 0 && nw->StartTick <= Tick64()) - { - press = true; - } - - if (MsIsVista() == false) - { - o = NewListFast(NULL); - EnumThreadWindows(thread_id, MsEnumThreadWindowProc, (LPARAM)o); - } - else - { - o = EnumAllTopWindow(); - } - - for (i = 0;i < LIST_NUM(o);i++) - { - HWND hWnd; - - if (nw->Halt) - { - break; - } - - if (MsIsVista() == false) - { - hWnd = LIST_DATA(o, i); - } - else - { - hWnd = *((HWND *)LIST_DATA(o, i)); - } - - if (hWnd != NULL) - { - OS_INFO *info = GetOsInfo(); - - if (MsIsNt()) - { - // Get whether this window is a warning screen of driver - if (MsIsVista() == false) - { - // Other than Windows Vista - HWND hStatic, hOk, hCancel, hDetail; - - hStatic = GetDlgItem(hWnd, 0x14C1); - hOk = GetDlgItem(hWnd, 0x14B7); - hCancel = GetDlgItem(hWnd, 0x14BA); - hDetail = GetDlgItem(hWnd, 0x14B9); - - if ((hStatic != NULL || hDetail != NULL) && hOk != NULL && hCancel != NULL) - { - char tmp[MAX_SIZE]; - bool b = false; - - if (GetClassName(hStatic, tmp, sizeof(tmp)) != 0) - { - if (StrCmpi(tmp, "static") == 0) - { - b = true; - } - } - - if (GetClassName(hDetail, tmp, sizeof(tmp)) != 0) - { - if (StrCmpi(tmp, "button") == 0) - { - b = true; - } - } - - if (b) - { - if (GetClassName(hOk, tmp, sizeof(tmp)) != 0) - { - if (StrCmpi(tmp, "button") == 0) - { - if (GetClassName(hCancel, tmp, sizeof(tmp)) != 0) - { - if (StrCmpi(tmp, "button") == 0) - { - // Press the OK button since it was found - PostMessage(hWnd, WM_COMMAND, 0x14B7, 0); - - ret = true; - } - } - } - } - } - } - } - else - { - // Windows Vista - char exe[MAX_PATH]; - - if (MsGetWindowOwnerProcessExeName(exe, sizeof(exe), hWnd)) - { - if (EndWith(exe, "rundll32.exe")) - { - LIST *o; - HWND h; - UINT i; - - o = EnumAllChildWindow(hWnd); - - if (o != NULL) - { - for (i = 0;i < LIST_NUM(o);i++) - { - char tmp[MAX_SIZE]; - - h = *((HWND *)LIST_DATA(o, i)); - - Zero(tmp, sizeof(tmp)); - GetClassNameA(h, tmp, sizeof(tmp)); - - if (StrCmpi(tmp, "DirectUIHWND") == 0) - { - LIST *o = EnumAllChildWindow(h); - - if (o != NULL) - { - UINT j; - UINT numDirectUIHWND = 0; - UINT numButton = 0; - HWND hButton1 = NULL; - HWND hButton2 = NULL; - - for (j = 0;j < LIST_NUM(o);j++) - { - HWND hh; - char tmp[MAX_SIZE]; - - hh = *((HWND *)LIST_DATA(o, j)); - - Zero(tmp, sizeof(tmp)); - GetClassNameA(hh, tmp, sizeof(tmp)); - - if (StrCmpi(tmp, "DirectUIHWND") == 0) - { - numDirectUIHWND++; - } - - if (StrCmpi(tmp, "button") == 0) - { - numButton++; - if (hButton1 == NULL) - { - hButton1 = hh; - } - else - { - hButton2 = hh; - } - } - } - - if ((numDirectUIHWND == 1 || numDirectUIHWND == 2) && numButton == 2) - { - if (hButton1 != NULL && hButton2 != NULL) - { - HWND hButton; - HWND hParent; - RECT r1, r2; - - GetWindowRect(hButton1, &r1); - GetWindowRect(hButton2, &r2); - - hButton = hButton1; - - if (numDirectUIHWND == 1) - { - // Warning that there is no signature - if (r1.top < r2.top) - { - hButton = hButton2; - } - } - else - { - // Notification that there is signature - if (r1.left >= r2.left) - { - hButton = hButton2; - } - } - - hParent = GetParent(hButton); - - // Press the OK button since it was found - if (press) - { - PostMessage(hParent, WM_COMMAND, 1, 0); - } - - ret = true; - } - } - - FreeWindowList(o); - } - } - } - - FreeWindowList(o); - } - } - } - } - } - } - } - - if (MsIsVista() == false) - { - ReleaseList(o); - } - else - { - FreeWindowList(o); - } - - if (press == false) - { - if (ret) - { - ret = false; - - if (nw->StartTick == 0) - { - nw->StartTick = Tick64() + nw->StartTimer; - } - } - } - - return ret; -} - -// Thread to suppress a warning message -void MsNoWarningThreadProc(THREAD *thread, void *param) -{ - NO_WARNING *nw; - UINT interval; - UINT i; - bool found0 = false; - // Validate arguments - if (thread == NULL) - { - return; - } - - nw = (NO_WARNING *)param; - - nw->NoWarningThread = thread; - AddRef(thread->ref); - - NoticeThreadInit(thread); - - interval = 50; - - if (MsIsVista()) - { - interval = 1000; - } - - i = 0; - - while (nw->Halt == false) - { - bool found = false; - - // Close the alert dialog - found = MsCloseWarningWindow(nw, nw->ThreadId); - if (i == 0) - { - found0 = found; - } - else - { - if (found0 == false && found) - { - break; - } - } - i++; - - // Loop until the command incomes from parent thread - Wait(nw->HaltEvent, interval); - } -} - -// Initialize the procedure to turn off the warning sound -char *MsNoWarningSoundInit() -{ - char *ret = MsRegReadStr(REG_CURRENT_USER, "AppEvents\\Schemes\\Apps\\.Default\\SystemAsterisk\\.Current", ""); - - if (IsEmptyStr(ret)) - { - Free(ret); - ret = NULL; - } - else - { - MsRegWriteStr(REG_CURRENT_USER, - "AppEvents\\Schemes\\Apps\\.Default\\SystemAsterisk\\.Current", - "", ""); - } - - return ret; -} - -// Release of procedure to turn off the warning sound -void MsNoWarningSoundFree(char *s) -{ - // Validate arguments - if (s == NULL) - { - return; - } - - MsRegWriteStrExpand(REG_CURRENT_USER, - "AppEvents\\Schemes\\Apps\\.Default\\SystemAsterisk\\.Current", - "", s); - - Free(s); -} - -// The start of the procedure to suppress the warning -NO_WARNING *MsInitNoWarning() -{ - return MsInitNoWarningEx(0); -} -NO_WARNING *MsInitNoWarningEx(UINT start_timer) -{ - THREAD *thread; - NO_WARNING *nw = ZeroMalloc(sizeof(NO_WARNING)); - - nw->StartTimer = (UINT64)start_timer; - - // Get the current sound file name - if (MsIsVista() == false) - { - wchar_t *tmp; - - // Turn off the unnecessary warning tone in Windows XP or earlier - tmp = MsRegReadStrW(REG_CURRENT_USER, "AppEvents\\Schemes\\Apps\\.Default\\SystemAsterisk\\.Current", ""); - if (UniIsEmptyStr(tmp) == false) - { - nw->SoundFileName = CopyUniStr(tmp); - - MsRegWriteStrW(REG_CURRENT_USER, - "AppEvents\\Schemes\\Apps\\.Default\\SystemAsterisk\\.Current", - "", L""); - } - - Free(tmp); - } - - nw->ThreadId = GetCurrentThreadId(); - nw->HaltEvent = NewEvent(); - - thread = NewThread(MsNoWarningThreadProc, nw); - WaitThreadInit(thread); - - ReleaseThread(thread); - - return nw; -} - -// End of the procedure to suppress the warning -void MsFreeNoWarning(NO_WARNING *nw) -{ - // Validate arguments - if (nw == NULL) - { - return; - } - - nw->Halt = true; - Set(nw->HaltEvent); - - WaitThread(nw->NoWarningThread, INFINITE); - ReleaseThread(nw->NoWarningThread); - - ReleaseEvent(nw->HaltEvent); - - if (MsIsVista() == false) - { - if (nw->SoundFileName != NULL) - { - MsRegWriteStrExpandW(REG_CURRENT_USER, - "AppEvents\\Schemes\\Apps\\.Default\\SystemAsterisk\\.Current", - "", nw->SoundFileName); - - Free(nw->SoundFileName); - } - } - - Free(nw); -} - -// Obtain the name of the directory that the inf catalog file is stored -void MsGetInfCatalogDir(char *dst, UINT size) -{ - // Validate arguments - if (dst == NULL) - { - return; - } - - Format(dst, size, "|DriverPackages\\%s\\%s", (MsIsWindows10() ? "Neo6_Win10" : "Neo6_Win8"), (MsIsX64() ? "x64" : "x86")); -} - -// Examine whether the virtual LAN card name can be used as a instance name of the VLAN -bool MsIsValidVLanInstanceNameForInfCatalog(char *instance_name) -{ - char src_dir[MAX_SIZE]; - char tmp[MAX_SIZE]; - bool ret; - // Validate arguments - if (instance_name == NULL) - { - return false; - } - - MsGetInfCatalogDir(src_dir, sizeof(src_dir)); - - Format(tmp, sizeof(tmp), "%s\\Neo6_%s_%s.inf", src_dir, (MsIsX64() ? "x64" : "x86"), instance_name); - - ret = IsFile(tmp); - - return ret; -} - -// Delete the device information that is about the device which failed during the installation of the same name before installing the virtual LAN card -void MsDeleteTroubleVLAN(char *tag_name, char *instance_name) -{ - HDEVINFO dev_info; - SP_DEVINFO_LIST_DETAIL_DATA detail_data; - SP_DEVINFO_DATA data; - UINT i; - char target_name[MAX_SIZE]; - LIST *o; - // Validate arguments - if (tag_name == NULL || instance_name == NULL) - { - return; - } - - Format(target_name, sizeof(target_name), DRIVER_DEVICE_ID_TAG, instance_name); - - // Create a device information list - dev_info = SetupDiGetClassDevsEx(NULL, NULL, NULL, DIGCF_ALLCLASSES | DIGCF_PRESENT, NULL, NULL, NULL); - if (dev_info == NULL) - { - return; - } - - Zero(&detail_data, sizeof(detail_data)); - detail_data.cbSize = sizeof(detail_data); - if (SetupDiGetDeviceInfoListDetail(dev_info, &detail_data) == false) - { - MsDestroyDevInfo(dev_info); - return; - } - - Zero(&data, sizeof(data)); - data.cbSize = sizeof(data); - - // Enumeration start - o = NewListFast(NULL); - - for (i = 0;SetupDiEnumDeviceInfo(dev_info, i, &data);i++) - { - char *buffer; - UINT buffer_size = 8092; - DWORD data_type; - - buffer = ZeroMalloc(buffer_size); - - if (SetupDiGetDeviceRegistryProperty(dev_info, &data, SPDRP_HARDWAREID, &data_type, (PBYTE)buffer, buffer_size, NULL)) - { - if (StrCmpi(buffer, target_name) == 0) - { - // Found - SP_DEVINFO_DATA *data2 = Clone(&data, sizeof(SP_DEVINFO_DATA)); - - Add(o, data2); - } - } - - Free(buffer); - } - - for (i = 0;i < LIST_NUM(o);i++) - { - SP_DEVINFO_DATA *data = LIST_DATA(o, i); - bool ret; - - ret = SetupDiRemoveDevice(dev_info, data); - - Debug("Deleting Troubled NIC %u: %u\n", i, ret); - - Free(data); - } - - ReleaseList(o); - - MsDestroyDevInfo(dev_info); -} - -// Install a virtual LAN card -bool MsInstallVLan(char *tag_name, char *connection_tag_name, char *instance_name, MS_DRIVER_VER *ver) -{ - bool ret; - - Lock(vlan_lock); - { - ret = MsInstallVLanWithoutLock(tag_name, connection_tag_name, instance_name, ver); - } - Unlock(vlan_lock); - - return ret; -} -bool MsInstallVLanWithoutLock(char *tag_name, char *connection_tag_name, char *instance_name, MS_DRIVER_VER *ver) -{ - wchar_t infpath[MAX_PATH]; - char hwid[MAX_PATH]; - wchar_t hwid_w[MAX_PATH]; - bool ret = false; - char neo_sys[MAX_PATH]; - UCHAR new_mac_address[6]; - UINT i; - // Validate arguments - if (instance_name == NULL || tag_name == NULL || connection_tag_name == NULL || ver == NULL) - { - return false; - } - - if (MsIsNt() == false) - { - // For Windows 9x - return MsInstallVLan9x(instance_name, ver); - } - - if (MsIsInfCatalogRequired()) - { - if (MsIsValidVLanInstanceNameForInfCatalog(instance_name) == false) - { - Debug("MsIsValidVLanInstanceNameForInfCatalog() returns false.\n"); - return false; - } - - StrUpper(instance_name); - } - - Zero(hwid, sizeof(hwid)); - Format(hwid, sizeof(hwid), DRIVER_DEVICE_ID_TAG, instance_name); - StrToUni(hwid_w, sizeof(hwid_w), hwid); - - // Examine whether the virtual LAN card with the specified name has already registered - if (MsIsVLanExists(tag_name, instance_name)) - { - // Already be registered - Debug("MsIsVLanExists() returns true.\n"); - return false; - } - - // Determining destination .sys file name of the installation - if (MsIsInfCatalogRequired() == false) - { - if (MsMakeNewNeoDriverFilename(neo_sys, sizeof(neo_sys)) == false) - { - return false; - } - } - else - { - if (MsIsWindows10() == false) - { - Format(neo_sys, sizeof(neo_sys), "Neo_%s.sys", instance_name); - } - else - { - Format(neo_sys, sizeof(neo_sys), "Neo6_%s_%s.sys", (MsIsX64() ? "x64" : "x86"), instance_name); - } - } - - // Starting the Installation - if (MsStartDriverInstall(instance_name, NULL, neo_sys, new_mac_address, ver) == false) - { - return false; - } - MsGetDriverPath(instance_name, NULL, NULL, infpath, NULL, NULL, NULL, neo_sys); - - // Delete the device information that is left on fail of installation - if (MsIsNt()) - { - MsDeleteTroubleVLAN(tag_name, instance_name); - } - - // Call the Win32 API - ret = MsInstallVLanInternal(infpath, hwid_w, hwid); - - // Installation complete - MsFinishDriverInstall(instance_name, neo_sys); - - for (i = 0;i < 5;i++) - { - MsInitNetworkConfig(tag_name, instance_name, connection_tag_name); - if (MsIsInfCatalogRequired()) - { - // Write the MAC address - char mac_address_str[MAX_SIZE]; - BinToStr(mac_address_str, sizeof(mac_address_str), new_mac_address, sizeof(new_mac_address)); - MsSetMacAddress(VLAN_ADAPTER_NAME_TAG, instance_name, mac_address_str); - } - - SleepThread(MsIsVista() ? 1000 : 300); - } - - if (ret) - { - MsDisableVLan(instance_name); - SleepThread(MsIsVista() ? 1000 : 300); - MsEnableVLan(instance_name); - } - - return ret; -} - -// Test function -void MsTest() -{ -} - -// Install a virtual LAN card (by calling Win32 API) -bool MsInstallVLanInternal(wchar_t *infpath, wchar_t *hwid_w, char *hwid) -{ - bool need_reboot; - bool ret = false; - wchar_t inf_class_name[MAX_PATH]; - GUID inf_class_guid; - HDEVINFO device_info; - SP_DEVINFO_DATA device_info_data; - // Validate arguments - if (infpath == NULL || hwid_w == NULL || hwid == NULL) - { - return false; - } - - Debug("MsInstallVLanInternal('%S', '%S', '%s');\n", - infpath, hwid_w, hwid); - - Zero(&inf_class_guid, sizeof(inf_class_guid)); - Zero(&device_info, sizeof(device_info)); - Zero(&device_info_data, sizeof(device_info_data)); - Zero(inf_class_name, sizeof(inf_class_name)); - - // Get the class GUID of the inf file - if (SetupDiGetINFClassW(infpath, &inf_class_guid, inf_class_name, sizeof(inf_class_name), NULL)) - { - // Get the device information set - device_info = SetupDiCreateDeviceInfoList(&inf_class_guid, NULL); - if (device_info != INVALID_HANDLE_VALUE) - { - // Windows 2000 or later - Zero(&device_info_data, sizeof(device_info_data)); - device_info_data.cbSize = sizeof(device_info_data); - if (SetupDiCreateDeviceInfoW(device_info, inf_class_name, &inf_class_guid, - NULL, NULL, DICD_GENERATE_ID, &device_info_data)) - { - char hwid_copy[MAX_SIZE]; - Zero(hwid_copy, sizeof(hwid_copy)); - StrCpy(hwid_copy, sizeof(hwid_copy), hwid); - - // Set the registry information - if (SetupDiSetDeviceRegistryProperty(device_info, &device_info_data, - SPDRP_HARDWAREID, (BYTE *)hwid_copy, sizeof(hwid_copy))) - { - NO_WARNING *nw = NULL; - - //if (MsIsVista() == false) - { - nw = MsInitNoWarning(); - } - - // Start the class installer - if (SetupDiCallClassInstaller(DIF_REGISTERDEVICE, device_info, - &device_info_data)) - { - // Do the installation - if (ms->nt->UpdateDriverForPlugAndPlayDevicesW( - NULL, hwid_w, infpath, 1, &need_reboot)) - { - ret = true; - } - else - { - // Installation Failed - Debug("UpdateDriverForPlugAndPlayDevicesW Error: %X\n", GetLastError()); - if (SetupDiCallClassInstaller(DIF_REMOVE, device_info, - &device_info_data) == false) - { - Debug("SetupDiCallClassInstaller for Delete Failed. Err=%X\n", GetLastError()); - } - - if (SetupDiRemoveDevice(device_info, &device_info_data) == false) - { - Debug("SetupDiRemoveDevice for Delete Failed. Err=%X\n", GetLastError()); - } - } - } - else - { - Debug("SetupDiCallClassInstaller for Create Error: %X\n", GetLastError()); - } - - MsFreeNoWarning(nw); - } - else - { - Debug("SetupDiSetDeviceRegistryProperty Error: %X\n", GetLastError()); - } - } - else - { - Debug("SetupDiCreateDeviceInfoW Error: %X\n", GetLastError()); - } - // Remove the device information set - SetupDiDestroyDeviceInfoList(device_info); - } - else - { - Debug("SetupDiCreateDeviceInfoList Error: %X\n", GetLastError()); - } - } - else - { - Debug("SetupDiGetINFClassW Error: %X\n", GetLastError()); - } - - return ret; -} - -// Get the device information from the device ID -HDEVINFO MsGetDevInfoFromDeviceId(SP_DEVINFO_DATA *dev_info_data, char *device_id) -{ - HDEVINFO dev_info; - SP_DEVINFO_LIST_DETAIL_DATA detail_data; - SP_DEVINFO_DATA data; - UINT i; - bool found; - char target_name[MAX_SIZE]; - // Validate arguments - if (dev_info_data == NULL || device_id == NULL) - { - return NULL; - } - - StrCpy(target_name, sizeof(target_name), device_id); - - // Create a device information list - dev_info = SetupDiGetClassDevsEx(NULL, NULL, NULL, DIGCF_ALLCLASSES | DIGCF_PRESENT, NULL, NULL, NULL); - if (dev_info == NULL) - { - return NULL; - } - - Zero(&detail_data, sizeof(detail_data)); - detail_data.cbSize = sizeof(detail_data); - if (SetupDiGetDeviceInfoListDetail(dev_info, &detail_data) == false) - { - MsDestroyDevInfo(dev_info); - return NULL; - } - - Zero(&data, sizeof(data)); - data.cbSize = sizeof(data); - - // Enumeration start - found = false; - for (i = 0;SetupDiEnumDeviceInfo(dev_info, i, &data);i++) - { - char *buffer; - UINT buffer_size = 8092; - DWORD data_type; - - buffer = ZeroMalloc(buffer_size); - - if (SetupDiGetDeviceRegistryProperty(dev_info, &data, SPDRP_HARDWAREID, &data_type, (PBYTE)buffer, buffer_size, NULL)) - { - if (StrCmpi(buffer, target_name) == 0) - { - // Found - found = true; - } - } - - Free(buffer); - - if (found) - { - break; - } - } - - if (found == false) - { - MsDestroyDevInfo(dev_info); - return NULL; - } - else - { - Copy(dev_info_data, &data, sizeof(data)); - return dev_info; - } -} - -// Examine whether the specified device is operating -bool MsIsDeviceRunning(HDEVINFO info, SP_DEVINFO_DATA *dev_info_data) -{ - SP_DEVINFO_LIST_DETAIL_DATA detail; - UINT status = 0, problem = 0; - // Validate arguments - if (info == NULL || dev_info_data == NULL) - { - return false; - } - - Zero(&detail, sizeof(detail)); - detail.cbSize = sizeof(detail); - - if (SetupDiGetDeviceInfoListDetail(info, &detail) == false || - ms->nt->CM_Get_DevNode_Status_Ex(&status, &problem, dev_info_data->DevInst, - 0, detail.RemoteMachineHandle) != CR_SUCCESS) - { - return false; - } - - if (status & 8) - { - return true; - } - else - { - return false; - } -} - -// Start the specified device -bool MsStartDevice(HDEVINFO info, SP_DEVINFO_DATA *dev_info_data) -{ - SP_PROPCHANGE_PARAMS p; - // Validate arguments - if (info == NULL || dev_info_data == NULL) - { - return false; - } - - Zero(&p, sizeof(p)); - p.ClassInstallHeader.cbSize = sizeof(SP_CLASSINSTALL_HEADER); - p.ClassInstallHeader.InstallFunction = DIF_PROPERTYCHANGE; - p.StateChange = DICS_ENABLE; - p.Scope = DICS_FLAG_GLOBAL; - if (SetupDiSetClassInstallParams(info, dev_info_data, &p.ClassInstallHeader, sizeof(p))) - { - SetupDiCallClassInstaller(DIF_PROPERTYCHANGE, info, dev_info_data); - } - - Zero(&p, sizeof(p)); - p.ClassInstallHeader.cbSize = sizeof(SP_CLASSINSTALL_HEADER); - p.ClassInstallHeader.InstallFunction = DIF_PROPERTYCHANGE; - p.StateChange = DICS_ENABLE; - p.Scope = DICS_FLAG_CONFIGSPECIFIC; - - if (SetupDiSetClassInstallParams(info, dev_info_data, &p.ClassInstallHeader, sizeof(p)) == false || - SetupDiCallClassInstaller(DIF_PROPERTYCHANGE, info, dev_info_data) == false) - { - return false; - } - - return true; -} - -// Stop the specified device -bool MsStopDevice(HDEVINFO info, SP_DEVINFO_DATA *dev_info_data) -{ - SP_PROPCHANGE_PARAMS p; - // Validate arguments - if (info == NULL || dev_info_data == NULL) - { - return false; - } - - Zero(&p, sizeof(p)); - p.ClassInstallHeader.cbSize = sizeof(SP_CLASSINSTALL_HEADER); - p.ClassInstallHeader.InstallFunction = DIF_PROPERTYCHANGE; - p.StateChange = DICS_DISABLE; - p.Scope = DICS_FLAG_CONFIGSPECIFIC; - - if (SetupDiSetClassInstallParams(info, dev_info_data, &p.ClassInstallHeader, sizeof(p)) == false || - SetupDiCallClassInstaller(DIF_PROPERTYCHANGE, info, dev_info_data) == false) - { - return false; - } - - return true; -} - -// Remove the specified device -bool MsDeleteDevice(HDEVINFO info, SP_DEVINFO_DATA *dev_info_data) -{ - SP_REMOVEDEVICE_PARAMS p; - SP_DEVINFO_LIST_DETAIL_DATA detail; - char device_id[MAX_PATH]; - CONFIGRET ret; - // Validate arguments - if (info == NULL || dev_info_data == NULL) - { - return false; - } - - Zero(&detail, sizeof(detail)); - detail.cbSize = sizeof(detail); - - if (SetupDiGetDeviceInfoListDetail(info, &detail) == false) - { - Debug("SetupDiGetDeviceInfoListDetail Failed. Err=0x%X\n", GetLastError()); - return false; - } - - ret = ms->nt->CM_Get_Device_ID_Ex(dev_info_data->DevInst, device_id, sizeof(device_id), - 0, detail.RemoteMachineHandle); - if (ret != CR_SUCCESS) - { - Debug("CM_Get_Device_ID_Ex Failed. Err=0x%X\n", ret); - return false; - } - - Zero(&p, sizeof(p)); - p.ClassInstallHeader.cbSize = sizeof(SP_CLASSINSTALL_HEADER); - p.ClassInstallHeader.InstallFunction = DIF_REMOVE; - p.Scope = DI_REMOVEDEVICE_GLOBAL; - - if (SetupDiSetClassInstallParams(info, dev_info_data, &p.ClassInstallHeader, sizeof(p)) == false) - { - Debug("SetupDiSetClassInstallParams Failed. Err=0x%X\n", GetLastError()); - return false; - } - - if (SetupDiCallClassInstaller(DIF_REMOVE, info, dev_info_data) == false) - { - Debug("SetupDiCallClassInstaller Failed. Err=0x%X\n", GetLastError()); - return false; - } - - return true; -} - -// Enable the virtual LAN card -bool MsEnableVLan(char *instance_name) -{ - bool ret; - - Lock(vlan_lock); - { - ret = MsEnableVLanWithoutLock(instance_name); - } - Unlock(vlan_lock); - - return ret; -} -bool MsEnableVLanWithoutLock(char *instance_name) -{ - char tmp[MAX_PATH]; - HDEVINFO h; - bool ret; - SP_DEVINFO_DATA data; - // Validate arguments - if (instance_name == NULL) - { - return false; - } - - if (MsIsNt() == false) - { - return false; - } - - Format(tmp, sizeof(tmp), DRIVER_DEVICE_ID_TAG, instance_name); - - h = MsGetDevInfoFromDeviceId(&data, tmp); - if (h == NULL) - { - return false; - } - - ret = MsStartDevice(h, &data); - - MsDestroyDevInfo(h); - - return ret; -} - -// Disable the virtual LAN card -bool MsDisableVLan(char *instance_name) -{ - bool ret; - - Lock(vlan_lock); - { - ret = MsDisableVLanWithoutLock(instance_name); - } - Unlock(vlan_lock); - - return ret; -} -bool MsDisableVLanWithoutLock(char *instance_name) -{ - char tmp[MAX_PATH]; - HDEVINFO h; - bool ret; - SP_DEVINFO_DATA data; - // Validate arguments - if (instance_name == NULL) - { - return false; - } - - if (MsIsNt() == false) - { - return false; - } - - Format(tmp, sizeof(tmp), DRIVER_DEVICE_ID_TAG, instance_name); - - h = MsGetDevInfoFromDeviceId(&data, tmp); - if (h == NULL) - { - return false; - } - - ret = MsStopDevice(h, &data); - - MsDestroyDevInfo(h); - - return ret; -} - -// Restart the virtual LAN card -void MsRestartVLan(char *instance_name) -{ - Lock(vlan_lock); - { - MsRestartVLanWithoutLock(instance_name); - } - Unlock(vlan_lock); -} -void MsRestartVLanWithoutLock(char *instance_name) -{ - // Validate arguments - if (instance_name == NULL) - { - return; - } - - if (MsIsNt() == false) - { - return; - } - - if (MsIsVLanEnabled(instance_name) == false) - { - return; - } - - MsDisableVLan(instance_name); - MsEnableVLan(instance_name); -} - -// Get whether the virtual LAN card is working -bool MsIsVLanEnabled(char *instance_name) -{ - bool ret; - - Lock(vlan_lock); - { - ret = MsIsVLanEnabledWithoutLock(instance_name); - } - Unlock(vlan_lock); - - return ret; -} -bool MsIsVLanEnabledWithoutLock(char *instance_name) -{ - char tmp[MAX_PATH]; - HDEVINFO h; - bool ret; - SP_DEVINFO_DATA data; - // Validate arguments - if (instance_name == NULL) - { - return false; - } - - if (MsIsNt() == false) - { - return true; - } - - Format(tmp, sizeof(tmp), DRIVER_DEVICE_ID_TAG, instance_name); - - h = MsGetDevInfoFromDeviceId(&data, tmp); - if (h == NULL) - { - return false; - } - - ret = MsIsDeviceRunning(h, &data); - - MsDestroyDevInfo(h); - - return ret; -} - -// Uninstall the virtual LAN card -bool MsUninstallVLan(char *instance_name) -{ - bool ret; - - Lock(vlan_lock); - { - ret = MsUninstallVLanWithoutLock(instance_name); - } - Unlock(vlan_lock); - - return ret; -} -bool MsUninstallVLanWithoutLock(char *instance_name) -{ - char tmp[MAX_PATH]; - HDEVINFO h; - bool ret; - SP_DEVINFO_DATA data; - // Validate arguments - if (instance_name == NULL) - { - return false; - } - - Format(tmp, sizeof(tmp), DRIVER_DEVICE_ID_TAG, instance_name); - - h = MsGetDevInfoFromDeviceId(&data, tmp); - if (h == NULL) - { - return false; - } - - ret = MsDeleteDevice(h, &data); - - MsDestroyDevInfo(h); - - return ret; -} - -// Dispose the device information -void MsDestroyDevInfo(HDEVINFO info) -{ - // Validate arguments - if (info == NULL) - { - return; - } - - SetupDiDestroyDeviceInfoList(info); -} - -// Start the driver installation -bool MsStartDriverInstall(char *instance_name, UCHAR *mac_address, char *neo_sys, UCHAR *ret_mac_address, MS_DRIVER_VER *ver) -{ - wchar_t src_inf[MAX_PATH]; - wchar_t src_sys[MAX_PATH]; - wchar_t dest_inf[MAX_PATH]; - wchar_t dest_sys[MAX_PATH]; - wchar_t src_cat[MAX_PATH]; - wchar_t dst_cat[MAX_PATH]; - UCHAR mac_address_bin[6]; - char mac_address_str[32]; - UINT size; - char *tmp; - BUF *b; - IO *io; - char str_year[16]; - char str_month[16]; - char str_day[16]; - char str_major[16]; - char str_minor[16]; - char str_build[16]; - // Validate arguments - if (instance_name == NULL || neo_sys == NULL || ver == NULL) - { - return false; - } - - Format(str_year, sizeof(str_year), "%04d", ver->Year); - Format(str_month, sizeof(str_month), "%02d", ver->Month); - Format(str_day, sizeof(str_day), "%02d", ver->Day); - - ToStr(str_major, ver->Major); - ToStr(str_minor, ver->Minor); - ToStr(str_build, ver->Build); - - MsGetDriverPath(instance_name, src_inf, src_sys, dest_inf, dest_sys, src_cat, dst_cat, neo_sys); - Debug("MsStartDriverInstall\n"); - Debug(" instance_name: %s\n", instance_name); - Debug(" src_inf: %S\n", src_inf); - Debug(" src_sys: %S\n", src_sys); - Debug(" dest_inf: %S\n", dest_inf); - Debug(" dest_sys: %S\n", dest_sys); - Debug(" src_cat: %S\n", src_cat); - Debug(" dst_cat: %S\n", dst_cat); - Debug(" neo_sys: %s\n", neo_sys); - - // Processing INF file - io = FileOpenW(src_inf, false); - if (io == NULL) - { - return false; - } - - size = FileSize(io); - tmp = ZeroMalloc(size * 2); - if (FileRead(io, tmp, size) == false) - { - FileClose(io); - Free(tmp); - return false; - } - - FileClose(io); - - if (mac_address == NULL) - { - MsGenMacAddress(mac_address_bin); - } - else - { - Copy(mac_address_bin, mac_address, 6); - } - - BinToStr(mac_address_str, sizeof(mac_address_str), mac_address_bin, sizeof(mac_address_bin)); - - //ReplaceStrEx(tmp, size * 2, tmp, "$TAG_DRIVER_VER$", DRIVER_VER_STR, false); - ReplaceStrEx(tmp, size * 2, tmp, "$TAG_INSTANCE_NAME$", instance_name, false); - ReplaceStrEx(tmp, size * 2, tmp, "$TAG_MAC_ADDRESS$", mac_address_str, false); - ReplaceStrEx(tmp, size * 2, tmp, "$TAG_SYS_NAME$", neo_sys, false); - ReplaceStrEx(tmp, size * 2, tmp, "$YEAR$", str_year, false); - ReplaceStrEx(tmp, size * 2, tmp, "$MONTH$", str_month, false); - ReplaceStrEx(tmp, size * 2, tmp, "$DAY$", str_day, false); - ReplaceStrEx(tmp, size * 2, tmp, "$VER_MAJOR$", str_major, false); - ReplaceStrEx(tmp, size * 2, tmp, "$VER_MINOR$", str_minor, false); - ReplaceStrEx(tmp, size * 2, tmp, "$VER_BUILD$", str_build, false); - - if (MsIsVista()) - { - //ReplaceStrEx(tmp, size * 2, tmp, "\"100\"", "\"2000\"", false); - } - - io = FileCreateW(dest_inf); - if (io == NULL) - { - Free(tmp); - return false; - } - - FileWrite(io, tmp, StrLen(tmp)); - FileClose(io); - - Free(tmp); - - // Processing the SYS file - b = ReadDumpW(src_sys); - if (b == NULL) - { - return false; - } - - if (DumpBufW(b, dest_sys) == false) - { - FreeBuf(b); - return false; - } - - FreeBuf(b); - - // Copy of the catalog file - if (IsEmptyUniStr(src_cat) == false && IsEmptyUniStr(dst_cat) == false) - { - if (FileCopyW(src_cat, dst_cat) == false) - { - return false; - } - } - - if (ret_mac_address != NULL) - { - Copy(ret_mac_address, mac_address_bin, 6); - } - - return true; -} - -// Generation of the MAC address -void MsGenMacAddress(UCHAR *mac) -{ - UCHAR hash_src[40]; - UCHAR hash[20]; - UINT64 now; - // Validate arguments - if (mac == NULL) - { - return; - } - - Rand(hash_src, 40); - now = SystemTime64(); - Copy(hash_src, &now, sizeof(now)); - - Sha0(hash, hash_src, sizeof(hash_src)); - - mac[0] = 0x5E; - mac[1] = hash[0]; - mac[2] = hash[1]; - mac[3] = hash[2]; - mac[4] = hash[3]; - mac[5] = hash[4]; -} - -// Finish the driver installation -void MsFinishDriverInstall(char *instance_name, char *neo_sys) -{ - wchar_t src_inf[MAX_PATH]; - wchar_t src_sys[MAX_PATH]; - wchar_t dest_inf[MAX_PATH]; - wchar_t dest_sys[MAX_PATH]; - wchar_t src_cat[MAX_SIZE]; - wchar_t dst_cat[MAX_SIZE]; - // Validate arguments - if (instance_name == NULL) - { - return; - } - - MsGetDriverPath(instance_name, src_inf, src_sys, dest_inf, dest_sys, src_cat, dst_cat, neo_sys); - - // Delete the files - FileDeleteW(dest_inf); - FileDeleteW(dest_sys); - - if (IsEmptyUniStr(dst_cat) == false) - { - FileDeleteW(dst_cat); - } -} - -// Get the path to the driver file -void MsGetDriverPath(char *instance_name, wchar_t *src_inf, wchar_t *src_sys, wchar_t *dest_inf, wchar_t *dest_sys, wchar_t *src_cat, wchar_t *dest_cat, char *neo_sys) -{ - wchar_t *src_filename; - wchar_t *src_sys_filename; - // Validate arguments - if (instance_name == NULL) - { - return; - } - - // WinNT x86 - src_filename = L"|DriverPackages\\Neo\\x86\\Neo_x86.inf"; - src_sys_filename = L"|DriverPackages\\Neo\\x86\\Neo_x86.sys"; - - if (MsIsNt() == false) - { - // Win9x - src_filename = L"|DriverPackages\\Neo9x\\x86\\Neo9x_x86.inf"; - src_sys_filename = L"|DriverPackages\\Neo9x\\x86\\Neo9x_x86.sys"; - } - else if (MsIsX64()) - { - // WinNT x64 - src_filename = L"|DriverPackages\\Neo\\x64\\Neo_x64.inf"; - src_sys_filename = L"|DriverPackages\\Neo\\x64\\Neo_x64.sys"; - } - - if (MsIsWindows7()) - { - // Use the NDIS 6.2 driver for Windows 7 or later - if (MsIsX64()) - { - src_filename = L"|DriverPackages\\Neo6\\x64\\Neo6_x64.inf"; - src_sys_filename = L"|DriverPackages\\Neo6\\x64\\Neo6_x64.sys"; - } - else - { - src_filename = L"|DriverPackages\\Neo6\\x86\\Neo6_x86.inf"; - src_sys_filename = L"|DriverPackages\\Neo6\\x86\\Neo6_x86.sys"; - } - } - - if (MsIsInfCatalogRequired()) - { - // Windows 8 or later - if (MsIsX64()) - { - src_filename = L"|DriverPackages\\Neo6_Win8\\x64\\Neo6_x64.inf"; - src_sys_filename = L"|DriverPackages\\Neo6_Win8\\x64\\Neo6_x64.sys"; - } - else - { - src_filename = L"|DriverPackages\\Neo6_Win8\\x86\\Neo6_x86.inf"; - src_sys_filename = L"|DriverPackages\\Neo6_Win8\\x86\\Neo6_x86.sys"; - } - } - - if (src_inf != NULL) - { - if (MsIsInfCatalogRequired() == false) - { - // Windows 7 or before - UniStrCpy(src_inf, MAX_PATH, src_filename); - } - else - { - // Windows 8.1 or later - char tmp[MAX_SIZE]; - - MsGetInfCatalogDir(tmp, sizeof(tmp)); - - UniFormat(src_inf, MAX_PATH, L"%S\\Neo6_%S_%S.inf", tmp, (MsIsX64() ? "x64" : "x86"), instance_name); - } - } - - if (src_sys != NULL) - { - UniStrCpy(src_sys, MAX_PATH, src_sys_filename); - - if (MsIsWindows10()) - { - UniFormat(src_sys, MAX_PATH, L"|DriverPackages\\Neo6_Win10\\%S\\Neo6_%S_%S.sys", - (MsIsX64() ? "x64" : "x86"), (MsIsX64() ? "x64" : "x86"), instance_name); - } - } - - if (dest_inf != NULL) - { - char inf_name[MAX_PATH]; - - if (MsIsInfCatalogRequired() == false) - { - Format(inf_name, sizeof(inf_name), "Neo_%s.inf", instance_name); - } - else - { - Format(inf_name, sizeof(inf_name), "Neo6_%s_%s.inf", (MsIsX64() ? "x64" : "x86"), instance_name); - } - UniFormat(dest_inf, MAX_PATH, L"%s\\%S", ms->MyTempDirW, inf_name); - } - - if (dest_sys != NULL) - { - char sys_name[MAX_PATH]; - StrCpy(sys_name, sizeof(sys_name), neo_sys); - UniFormat(dest_sys, MAX_PATH, L"%s\\%S", ms->MyTempDirW, sys_name); - } - - if (src_cat != NULL) - { - if (MsIsInfCatalogRequired()) - { - char tmp[MAX_SIZE]; - - MsGetInfCatalogDir(tmp, sizeof(tmp)); - - if (MsIsWindows8() == false) - { - // Windows Vista and Windows 7 uses SHA-1 catalog files - // (Unused? Never reach here!) - UniFormat(src_cat, MAX_PATH, L"%S\\inf.cat", tmp); - } - else - { - // Windows 8 or above uses SHA-256 catalog files - UniFormat(src_cat, MAX_PATH, L"%S\\inf2.cat", tmp); - } - - if (MsIsWindows10()) - { - // Windows 10 - UniFormat(src_cat, MAX_PATH, L"%S\\Neo6_%S_%S.cat", tmp, (MsIsX64() ? "x64" : "x86"), instance_name); - } - } - else - { - UniStrCpy(src_cat, MAX_PATH, L""); - } - } - - if (dest_cat != NULL) - { - if (MsIsInfCatalogRequired()) - { - if (MsIsWindows10() == false) - { - UniFormat(dest_cat, MAX_PATH, L"%s\\inf_%S.cat", ms->MyTempDirW, instance_name); - } - else - { - UniFormat(dest_cat, MAX_PATH, L"%s\\Neo6_%S_%S.cat", ms->MyTempDirW, (MsIsX64() ? "x64" : "x86"), instance_name); - } - } - else - { - UniStrCpy(dest_cat, MAX_PATH, L""); - } - } -} -void MsGetDriverPathA(char *instance_name, char *src_inf, char *src_sys, char *dest_inf, char *dest_sys, char *src_cat, char *dst_cat, char *neo_sys) -{ - wchar_t src_inf_w[MAX_PATH]; - wchar_t src_sys_w[MAX_PATH]; - wchar_t dest_inf_w[MAX_PATH]; - wchar_t dest_sys_w[MAX_PATH]; - wchar_t src_cat_w[MAX_PATH]; - wchar_t dst_cat_w[MAX_PATH]; - - // Validate arguments - if (instance_name == NULL) - { - return; - } - - MsGetDriverPath(instance_name, src_inf_w, src_sys_w, dest_inf_w, dest_sys_w, src_cat_w, dst_cat_w, neo_sys); - - UniToStr(src_inf, MAX_PATH, src_inf_w); - UniToStr(src_sys, MAX_PATH, src_sys_w); - UniToStr(dest_inf, MAX_PATH, dest_inf_w); - UniToStr(dest_sys, MAX_PATH, dest_sys_w); - UniToStr(src_cat, MAX_PATH, src_cat_w); - UniToStr(dst_cat, MAX_PATH, dst_cat_w); -} - -// Examine whether the virtual LAN card with the specified name has already registered -bool MsIsVLanExists(char *tag_name, char *instance_name) -{ - char *guid; - // Validate arguments - if (instance_name == NULL || tag_name == NULL) - { - return false; - } - - guid = MsGetNetworkAdapterGuid(tag_name, instance_name); - if (guid == NULL) - { - return false; - } - - Free(guid); - return true; -} - -// Delete VPN temporary directories that remain in the system but not used -void MsDeleteTempDir() -{ - HANDLE h; - wchar_t dir_mask[MAX_PATH]; - WIN32_FIND_DATAA data_a; - WIN32_FIND_DATAW data_w; - - Zero(&data_a, sizeof(data_a)); - Zero(&data_w, sizeof(data_w)); - - UniFormat(dir_mask, sizeof(dir_mask), L"%s\\*", ms->TempDirW); - - if (IsNt()) - { - h = FindFirstFileW(dir_mask, &data_w); - } - else - { - char *tmp_a = CopyUniToStr(dir_mask); - - h = FindFirstFileA(tmp_a, &data_a); - - Free(tmp_a); - } - - if (h != INVALID_HANDLE_VALUE) - { - bool b = true; - - do - { - if (IsNt() == false) - { - Zero(&data_w, sizeof(data_w)); - StrToUni(data_w.cFileName, sizeof(data_w.cFileName), data_a.cFileName); - data_w.dwFileAttributes = data_a.dwFileAttributes; - data_w.ftCreationTime = data_a.ftCreationTime; - data_w.ftLastWriteTime = data_a.ftLastWriteTime; - data_w.nFileSizeHigh = data_a.nFileSizeHigh; - data_w.nFileSizeLow = data_a.nFileSizeLow; - } - - if (UniStrCmpi(data_w.cFileName, L".") != 0 && - UniStrCmpi(data_w.cFileName, L"..") != 0) - { - if (data_w.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) - { - if (UniStartWith(data_w.cFileName, L"VPN_") && UniStrLen(data_w.cFileName) == 8) - { - wchar_t lock_file_name[MAX_PATH]; - wchar_t dir_name[MAX_PATH]; - bool delete_now = false; - IO *io; - - UniFormat(dir_name, sizeof(dir_name), L"%s\\%s", - ms->TempDirW, data_w.cFileName); - MsGenLockFile(lock_file_name, sizeof(lock_file_name), dir_name); - - io = FileOpenExW(lock_file_name, false, false); - if (io != NULL) - { - // Mark to delete if the lock file is not locked - FileClose(io); - io = FileOpenW(lock_file_name, true); - if (io != NULL) - { - delete_now = true; - FileClose(io); - } - } - else - { - DIRLIST *d; - - // Mark to delete if all files in this folder are not locked - delete_now = true; - - d = EnumDirW(dir_name); - if (d != NULL) - { - UINT i; - - for (i = 0;i < d->NumFiles;i++) - { - wchar_t full_path[MAX_PATH]; - - UniFormat(full_path, sizeof(full_path), L"%s\\%s", dir_name, d->File[i]->FileNameW); - - io = FileOpenW(full_path, true); - if (io != NULL) - { - delete_now = true; - FileClose(io); - } - } - FreeDir(d); - } - } - if (delete_now) - { - MsDeleteAllFileW(dir_name); - - Win32DeleteDirW(dir_name); - } - } - } - } - - - Zero(&data_w, sizeof(data_w)); - Zero(&data_a, sizeof(data_a)); - - if (IsNt()) - { - b = FindNextFileW(h, &data_w); - } - else - { - b = FindNextFileA(h, &data_a); - } - } - while (b); - - FindClose(h); - } -} - -// Delete all the files in the specified directory -void MsDeleteAllFile(char *dir) -{ - HANDLE h; - char file_mask[MAX_PATH]; - WIN32_FIND_DATA data; - // Validate arguments - if (dir == NULL || IsEmptyStr(dir)) - { - return; - } - - Format(file_mask, sizeof(file_mask), "%s\\*.*", dir); - - h = FindFirstFile(file_mask, &data); - if (h != INVALID_HANDLE_VALUE) - { - do - { - if (StrCmpi(data.cFileName, ".") != 0 && - StrCmpi(data.cFileName, "..") != 0) - { - char fullpath[MAX_PATH]; - Format(fullpath, sizeof(fullpath), "%s\\%s", dir, data.cFileName); - if ((data.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) == false) - { - DeleteFile(fullpath); - } - else - { - MsDeleteAllFile(fullpath); - RemoveDirectory(fullpath); - } - } - } - while (FindNextFile(h, &data)); - - FindClose(h); - } -} -void MsDeleteAllFileW(wchar_t *dir) -{ - HANDLE h; - wchar_t file_mask[MAX_PATH]; - WIN32_FIND_DATAW data; - // Validate arguments - if (dir == NULL || UniIsEmptyStr(dir)) - { - return; - } - - if (IsNt() == false) - { - char *dir_a = CopyUniToStr(dir); - - MsDeleteAllFile(dir_a); - - Free(dir_a); - - return; - } - - UniFormat(file_mask, sizeof(file_mask), L"%s\\*.*", dir); - - h = FindFirstFileW(file_mask, &data); - if (h != INVALID_HANDLE_VALUE) - { - do - { - if (UniStrCmpi(data.cFileName, L".") != 0 && - UniStrCmpi(data.cFileName, L"..") != 0) - { - wchar_t fullpath[MAX_PATH]; - - UniFormat(fullpath, sizeof(fullpath), L"%s\\%s", dir, data.cFileName); - - if ((data.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) == false) - { - DeleteFileW(fullpath); - } - else - { - MsDeleteAllFileW(fullpath); - RemoveDirectoryW(fullpath); - } - } - } - while (FindNextFileW(h, &data)); - - FindClose(h); - } -} - -// Initialize the temporary directory -void MsInitTempDir() -{ - wchar_t tmp[MAX_PATH]; - wchar_t tmp2[16]; - UCHAR random[2]; - wchar_t lockfilename[MAX_PATH]; - UINT num = 0; - - // Delete the unused temporary directory - MsDeleteTempDir(); - - // Determine the name of the temporary directory - while (true) - { - random[0] = rand() % 256; - random[1] = rand() % 256; - BinToStrW(tmp2, sizeof(tmp2), random, sizeof(random)); - - UniFormat(tmp, sizeof(tmp), L"%s\\VPN_%s", ms->TempDirW, tmp2); - - // Create Directory - if (MakeDirW(tmp)) - { - break; - } - - if ((num++) >= 100) - { - // Failed many times - char msg[MAX_SIZE]; - Format(msg, sizeof(msg), - "Couldn't create Temporary Directory: %s\r\n\r\n" - "Please contact your system administrator.", - tmp); - exit(0); - } - } - - ms->MyTempDirW = CopyUniStr(tmp); - ms->MyTempDir = CopyUniToStr(tmp); - - // Create a lock file - MsGenLockFile(lockfilename, sizeof(lockfilename), ms->MyTempDirW); - ms->LockFile = FileCreateW(lockfilename); -} - -// Release the temporary directory -void MsFreeTempDir() -{ - wchar_t lock_file_name[MAX_SIZE]; - - // Delete the lock file - MsGenLockFile(lock_file_name, sizeof(lock_file_name), ms->MyTempDirW); - FileClose(ms->LockFile); - - // Memory release - Free(ms->MyTempDir); - Free(ms->MyTempDirW); - ms->MyTempDir = NULL; - ms->MyTempDirW = NULL; - - // Delete directory - MsDeleteTempDir(); -} - -// Generation of the name of the lock file -void MsGenLockFile(wchar_t *name, UINT size, wchar_t *temp_dir) -{ - // Validate arguments - if (name == NULL || temp_dir == NULL) - { - return; - } - - UniFormat(name, size, L"%s\\VPN_Lock.dat", temp_dir); -} - -// Normalization of the configuration of the interface metric of the default gateway in the network configuration -void MsNormalizeInterfaceDefaultGatewaySettings(char *tag_name, char *instance_name) -{ - char tmp[MAX_SIZE]; - char netsh[MAX_PATH]; - char *config_str; - char tmp2[MAX_SIZE]; - UINT if_index; - UINT if_metric; - // Validate arguments - if (tag_name == NULL || instance_name == NULL) - { - return; - } - - Debug("MsNormalizeInterfaceDefaultGatewaySettings()\n"); - - if (MsIsVista() == false) - { - Debug("MsIsVista() == false\n"); - return; - } - - Format(tmp2, sizeof(tmp2), tag_name, instance_name); - if_index = Win32GetVLanInterfaceID(tmp2); - Debug("if_index=%u\n", if_index); - - if (if_index == 0) - { - return; - } - - CombinePath(netsh, sizeof(netsh), MsGetSystem32Dir(), "netsh.exe"); - - // Set the interface metric value - config_str = MsGetNetworkAdapterGuid(tag_name, instance_name); - if (config_str != NULL) - { - LIST *o; - LIST *o2; - - Debug("MsNormalizeInterfaceDefaultGatewaySettings()\n"); - Debug("if_index(%s) = %u\n", instance_name, if_index); - - Format(tmp, sizeof(tmp), "SYSTEM\\CurrentControlSet\\Services\\Tcpip\\Parameters\\Interfaces\\%s", - config_str); - - o = MsRegReadStrList(REG_LOCAL_MACHINE, tmp, "DefaultGateway"); - o2 = MsRegReadStrList(REG_LOCAL_MACHINE, tmp, "DefaultGatewayMetric"); - - if_metric = MsRegReadInt(REG_LOCAL_MACHINE, tmp, "InterfaceMetric"); - Debug("if_metric = %u\n", if_metric); - - if (if_metric != 0) - { - if (o != NULL) - { - UINT i; - - for (i = 0;i < LIST_NUM(o);i++) - { - char *s = LIST_DATA(o, i); - char tmp[MAX_SIZE]; - - char *cm = NULL; - UINT current_metric; - - if (o2 != NULL) - { - if (LIST_NUM(o2) > i) - { - current_metric = ToInt(LIST_DATA(o2, i)); - } - } - - Debug("gateway[%u] = %s\n", i, s); - Debug("current_metric[%u] = %u\n", i, current_metric); - - if (current_metric == 0) - { - if (IsEmptyStr(s) == false) - { - Format(tmp, sizeof(tmp), "int ipv4 delete route prefix=0.0.0.0/0 interface=%u nexthop=%s", - if_index, s); - Debug("netsh %s\n", tmp); - Run(netsh, tmp, true, true); - - Format(tmp, sizeof(tmp), "int ipv4 add route prefix=0.0.0.0/0 interface=%u nexthop=%s metric=%u", - if_index, s, if_metric); - Debug("netsh %s\n", tmp); - Run(netsh, tmp, true, true); - } - } - } - } - } - - FreeStrList(o); - FreeStrList(o2); - - Free(config_str); - } -} - -// Initialization of the network configuration -void MsInitNetworkConfig(char *tag_name, char *instance_name, char *connection_tag_name) -{ - char tmp[MAX_SIZE]; - char *config_str; - // Validate arguments - if (tag_name == NULL || instance_name == NULL || connection_tag_name == NULL) - { - return; - } - - if (MsIsNt() == false) - { - return; - } - - // Settings such as string - Format(tmp, sizeof(tmp), connection_tag_name, instance_name); - MsSetNetworkConfig(tag_name, instance_name, tmp, true); - - // Set the interface metric value - config_str = MsGetNetworkAdapterGuid(tag_name, instance_name); - if (config_str != NULL) - { - Format(tmp, sizeof(tmp), "SYSTEM\\CurrentControlSet\\Services\\Tcpip\\Parameters\\Interfaces\\%s", - config_str); - - MsRegWriteInt(REG_LOCAL_MACHINE, tmp, "InterfaceMetric", 1); - MsRegWriteInt(REG_LOCAL_MACHINE, tmp, "EnableDeadGWDetect", 0); - - if (MsRegReadInt(REG_LOCAL_MACHINE, - "SYSTEM\\CurrentControlSet\\Services\\Tcpip\\Parameters", - "packetix_no_optimize") == 0) - { - MsRegWriteInt(REG_LOCAL_MACHINE, - "SYSTEM\\CurrentControlSet\\Services\\Tcpip\\Parameters", - "EnableDeadGWDetect", - 0); - } - - Free(config_str); - } -} - -// Configure the network settings -void MsSetNetworkConfig(char *tag_name, char *instance_name, char *friendly_name, bool show_icon) -{ - char *key; - char *old_name; - // Validate arguments - if (tag_name == NULL || instance_name == NULL || friendly_name == NULL) - { - return; - } - - key = MsGetNetworkConfigRegKeyNameFromInstanceName(tag_name, instance_name); - if (key == NULL) - { - return; - } - - old_name = MsRegReadStr(REG_LOCAL_MACHINE, key, "Name"); - if (old_name != NULL) - { - if (MsIsVista()) - { - char arg[MAX_PATH]; - char netsh[MAX_PATH]; - - Format(netsh, sizeof(netsh), "%s\\netsh.exe", MsGetSystem32Dir()); - - if (StrCmp(old_name, friendly_name) != 0) - { - Format(arg, sizeof(arg), "interface set interface name=\"%s\" newname=\"%s\"", - old_name, friendly_name); - - Run(netsh, arg, true, true); - } - - Format(arg, sizeof(arg), "netsh interface ipv4 set interface interface=\"%s\" metric=1", - friendly_name); - - Run(netsh, arg, true, true); - } - } - - if (StrCmp(old_name, friendly_name) != 0) - { - MsRegWriteStr(REG_LOCAL_MACHINE, key, "Name", friendly_name); - } - - MsRegWriteInt(REG_LOCAL_MACHINE, key, "ShowIcon", show_icon ? 1 : 0); - - Free(key); - - Free(old_name); -} - -// Get the network configuration key name by the instance name -char *MsGetNetworkConfigRegKeyNameFromInstanceName(char *tag_name, char *instance_name) -{ - char *guid, *ret; - // Validate arguments - if (tag_name == NULL || instance_name == NULL) - { - return NULL; - } - - guid = MsGetNetworkAdapterGuid(tag_name, instance_name); - if (guid == NULL) - { - return NULL; - } - - ret = MsGetNetworkConfigRegKeyNameFromGuid(guid); - - Free(guid); - - return ret; -} - -// Get the network configuration key name by the GUID -char *MsGetNetworkConfigRegKeyNameFromGuid(char *guid) -{ - char tmp[MAX_SIZE]; - // Validate arguments - if (guid == NULL) - { - return NULL; - } - - Format(tmp, sizeof(tmp), - "SYSTEM\\CurrentControlSet\\Control\\Network\\{4D36E972-E325-11CE-BFC1-08002BE10318}\\%s\\Connection", - guid); - - return CopyStr(tmp); -} - -// Configuring the MAC address -void MsSetMacAddress(char *tag_name, char *instance_name, char *mac_address) -{ - TOKEN_LIST *key_list; - UINT i; - char dest_name[MAX_SIZE]; - char mac_str[MAX_SIZE]; - // Validate arguments - if (tag_name == NULL || instance_name == NULL) - { - return; - } - - // Normalization of the MAC address - if (NormalizeMacAddress(mac_str, sizeof(mac_str), mac_address) == false) - { - return; - } - - // Generate the desired name - Format(dest_name, sizeof(dest_name), tag_name, instance_name); - - // Enumerate the key - if (MsIsNt()) - { - key_list = MsRegEnumKey(REG_LOCAL_MACHINE, - "SYSTEM\\CurrentControlSet\\Control\\Class\\{4D36E972-E325-11CE-BFC1-08002bE10318}"); - } - else - { - key_list = MsRegEnumKey(REG_LOCAL_MACHINE, - "System\\CurrentControlSet\\Services\\Class\\Net"); - } - if (key_list == NULL) - { - return; - } - - for (i = 0;i < key_list->NumTokens;i++) - { - char *key_name = key_list->Token[i]; - char full_key_name[MAX_SIZE]; - char *driver_desc; - - if (MsIsNt()) - { - Format(full_key_name, sizeof(full_key_name), - "SYSTEM\\CurrentControlSet\\Control\\Class\\{4D36E972-E325-11CE-BFC1-08002bE10318}\\%s", - key_name); - } - else - { - Format(full_key_name, sizeof(full_key_name), - "System\\CurrentControlSet\\Services\\Class\\Net\\%s", - key_name); - } - - // Read the DriverDesc - driver_desc = MsRegReadStr(REG_LOCAL_MACHINE, full_key_name, "DriverDesc"); - if (driver_desc != NULL) - { - if (StrCmpi(dest_name, driver_desc) == 0) - { - // Writing of the MAC address - MsRegWriteStr(REG_LOCAL_MACHINE, full_key_name, "NetworkAddress", mac_str); - Free(driver_desc); - - // Restarting the driver - MsRestartVLan(instance_name); - break; - } - Free(driver_desc); - } - } - - FreeToken(key_list); - - return; -} - -// Get the file name of the device driver -char *MsGetDriverFileName(char *tag_name, char *instance_name) -{ - TOKEN_LIST *key_list; - UINT i; - char *ret = NULL; - char dest_name[MAX_SIZE]; - // Validate arguments - if (tag_name == NULL || instance_name == NULL) - { - return NULL; - } - - // Generate the desired name - Format(dest_name, sizeof(dest_name), tag_name, instance_name); - - // Enumerate the key - if (MsIsNt()) - { - key_list = MsRegEnumKey(REG_LOCAL_MACHINE, - "SYSTEM\\CurrentControlSet\\Control\\Class\\{4D36E972-E325-11CE-BFC1-08002bE10318}"); - } - else - { - key_list = MsRegEnumKey(REG_LOCAL_MACHINE, - "System\\CurrentControlSet\\Services\\Class\\Net"); - } - if (key_list == NULL) - { - return NULL; - } - - for (i = 0;i < key_list->NumTokens;i++) - { - char *key_name = key_list->Token[i]; - char full_key_name[MAX_SIZE]; - char *driver_desc; - - if (MsIsNt()) - { - Format(full_key_name, sizeof(full_key_name), - "SYSTEM\\CurrentControlSet\\Control\\Class\\{4D36E972-E325-11CE-BFC1-08002bE10318}\\%s", - key_name); - } - else - { - Format(full_key_name, sizeof(full_key_name), - "System\\CurrentControlSet\\Services\\Class\\Net\\%s", - key_name); - } - - // Read the DriverDesc - driver_desc = MsRegReadStr(REG_LOCAL_MACHINE, full_key_name, "DriverDesc"); - if (driver_desc != NULL) - { - if (StrCmpi(dest_name, driver_desc) == 0) - { - // Read the file name - ret = MsRegReadStr(REG_LOCAL_MACHINE, full_key_name, "DeviceVxDs"); - Free(driver_desc); - break; - } - Free(driver_desc); - } - } - - FreeToken(key_list); - - return ret; -} - -// Get the version of the device driver -char *MsGetDriverVersion(char *tag_name, char *instance_name) -{ - TOKEN_LIST *key_list; - TOKEN_LIST *t; - UINT i; - char *ret = NULL; - char dest_name[MAX_SIZE]; - // Validate arguments - if (tag_name == NULL || instance_name == NULL) - { - return NULL; - } - - // Generate the desired name - Format(dest_name, sizeof(dest_name), tag_name, instance_name); - - // Enumerate the key - if (MsIsNt()) - { - key_list = MsRegEnumKey(REG_LOCAL_MACHINE, - "SYSTEM\\CurrentControlSet\\Control\\Class\\{4D36E972-E325-11CE-BFC1-08002bE10318}"); - } - else - { - key_list = MsRegEnumKey(REG_LOCAL_MACHINE, - "System\\CurrentControlSet\\Services\\Class\\Net"); - } - if (key_list == NULL) - { - return NULL; - } - - for (i = 0;i < key_list->NumTokens;i++) - { - char *key_name = key_list->Token[i]; - char full_key_name[MAX_SIZE]; - char *driver_desc; - - if (MsIsNt()) - { - Format(full_key_name, sizeof(full_key_name), - "SYSTEM\\CurrentControlSet\\Control\\Class\\{4D36E972-E325-11CE-BFC1-08002bE10318}\\%s", - key_name); - } - else - { - Format(full_key_name, sizeof(full_key_name), - "System\\CurrentControlSet\\Services\\Class\\Net\\%s", - key_name); - } - - // Read the DriverDesc - driver_desc = MsRegReadStr(REG_LOCAL_MACHINE, full_key_name, "DriverDesc"); - if (driver_desc != NULL) - { - if (StrCmpi(dest_name, driver_desc) == 0) - { - // Read the version information - ret = MsRegReadStr(REG_LOCAL_MACHINE, full_key_name, "DriverVersion"); - if (ret == NULL) - { - ret = MsRegReadStr(REG_LOCAL_MACHINE, full_key_name, "NeoVersion"); - } - Free(driver_desc); - break; - } - Free(driver_desc); - } - } - - FreeToken(key_list); - - if (ret == NULL) - { - return NULL; - } - - t = ParseToken(ret, ", "); - if (t->NumTokens == 2) - { - Free(ret); - ret = CopyStr(t->Token[1]); - } - FreeToken(t); - - return ret; -} - -// Get the MAC address -char *MsGetMacAddress(char *tag_name, char *instance_name) -{ - TOKEN_LIST *key_list; - UINT i; - char *ret = NULL; - char dest_name[MAX_SIZE]; - // Validate arguments - if (tag_name == NULL || instance_name == NULL) - { - return NULL; - } - - // Generate the desired name - Format(dest_name, sizeof(dest_name), tag_name, instance_name); - - // Enumerate the key - if (MsIsNt()) - { - key_list = MsRegEnumKey(REG_LOCAL_MACHINE, - "SYSTEM\\CurrentControlSet\\Control\\Class\\{4D36E972-E325-11CE-BFC1-08002bE10318}"); - } - else - { - key_list = MsRegEnumKey(REG_LOCAL_MACHINE, - "System\\CurrentControlSet\\Services\\Class\\Net"); - } - - if (key_list == NULL) - { - return NULL; - } - - for (i = 0;i < key_list->NumTokens;i++) - { - char *key_name = key_list->Token[i]; - char full_key_name[MAX_SIZE]; - char *driver_desc; - - if (MsIsNt()) - { - Format(full_key_name, sizeof(full_key_name), - "SYSTEM\\CurrentControlSet\\Control\\Class\\{4D36E972-E325-11CE-BFC1-08002bE10318}\\%s", - key_name); - } - else - { - Format(full_key_name, sizeof(full_key_name), - "System\\CurrentControlSet\\Services\\Class\\Net\\%s", - key_name); - } - - // Read the DriverDesc - driver_desc = MsRegReadStr(REG_LOCAL_MACHINE, full_key_name, "DriverDesc"); - if (driver_desc != NULL) - { - if (StrCmpi(dest_name, driver_desc) == 0) - { - // Read the MAC address - ret = MsRegReadStr(REG_LOCAL_MACHINE, full_key_name, "NetworkAddress"); - - if (IsEmptyStr(ret) == false) - { - // Insert hyphens between the MAC address elements - BUF *b = StrToBin(ret); - if (b != NULL && b->Size == 6) - { - char tmp[MAX_SIZE]; - MacToStr(tmp, sizeof(tmp), b->Buf); - - Free(ret); - ret = CopyStr(tmp); - } - FreeBuf(b); - } - - Free(driver_desc); - break; - } - Free(driver_desc); - } - } - - FreeToken(key_list); - - return ret; -} - -// Check whether the device name of the virtual LAN card exists really -bool MsCheckVLanDeviceIdFromRootEnum(char *name) -{ - TOKEN_LIST *t; - char *root; - char *keyname; - UINT i; - bool ret; - // Validate arguments - if (name == NULL) - { - return false; - } - - if (MsIsNt()) - { - root = "SYSTEM\\CurrentControlSet\\Enum\\Root\\NET"; - keyname = "HardwareID"; - } - else - { - root = "Enum\\Root\\Net"; - keyname = "CompatibleIDs"; - } - - t = MsRegEnumKey(REG_LOCAL_MACHINE, root); - if (t == NULL) - { - return false; - } - - ret = false; - - for (i = 0;i < t->NumTokens;i++) - { - char *subname = t->Token[i]; - char fullname[MAX_SIZE]; - char *value; - - Format(fullname, sizeof(fullname), "%s\\%s", root, subname); - - value = MsRegReadStr(REG_LOCAL_MACHINE, fullname, keyname); - if (value != NULL) - { - if (StrCmpi(value, name) == 0) - { - ret = true; - } - Free(value); - } - - if (ret) - { - break; - } - } - - FreeToken(t); - - return ret; -} - -// Get the GUID of the network adapter -char *MsGetNetworkAdapterGuid(char *tag_name, char *instance_name) -{ - TOKEN_LIST *key_list; - UINT i; - char *ret = NULL; - char dest_name[MAX_SIZE]; - // Validate arguments - if (tag_name == NULL || instance_name == NULL) - { - return NULL; - } - - // Generate the desired name - Format(dest_name, sizeof(dest_name), tag_name, instance_name); - - // Enumerate the key - if (MsIsNt()) - { - key_list = MsRegEnumKey(REG_LOCAL_MACHINE, - "SYSTEM\\CurrentControlSet\\Control\\Class\\{4D36E972-E325-11CE-BFC1-08002bE10318}"); - } - else - { - key_list = MsRegEnumKey(REG_LOCAL_MACHINE, - "System\\CurrentControlSet\\Services\\Class\\Net"); - } - if (key_list == NULL) - { - return NULL; - } - - for (i = 0;i < key_list->NumTokens;i++) - { - char *key_name = key_list->Token[i]; - char full_key_name[MAX_SIZE]; - char *driver_desc; - char *device_id; - - if (MsIsNt()) - { - Format(full_key_name, sizeof(full_key_name), - "SYSTEM\\CurrentControlSet\\Control\\Class\\{4D36E972-E325-11CE-BFC1-08002bE10318}\\%s", - key_name); - } - else - { - Format(full_key_name, sizeof(full_key_name), - "System\\CurrentControlSet\\Services\\Class\\Net\\%s", - key_name); - } - - device_id = MsRegReadStr(REG_LOCAL_MACHINE, full_key_name, "MatchingDeviceId"); - - if (device_id != NULL) - { - if (MsCheckVLanDeviceIdFromRootEnum(device_id)) - { - // Read the DriverDesc - driver_desc = MsRegReadStr(REG_LOCAL_MACHINE, full_key_name, "DriverDesc"); - if (driver_desc != NULL) - { - if (StrCmpi(dest_name, driver_desc) == 0) - { - // Read the NetCfgInstanceId - if (MsIsNt()) - { - ret = MsRegReadStr(REG_LOCAL_MACHINE, full_key_name, "NetCfgInstanceId"); - } - else - { - ret = CopyStr(""); - } - Free(driver_desc); - Free(device_id); - break; - } - Free(driver_desc); - } - } - Free(device_id); - } - } - - FreeToken(key_list); - - return ret; -} -// Get the network connection name -wchar_t *MsGetNetworkConnectionName(char *guid) -{ - wchar_t *ncname = NULL; - // Validate arguments - if (guid == NULL) - { - return NULL; - } - - // Get the network connection name - if (IsNt() != false && GetOsInfo()->OsType >= OSTYPE_WINDOWS_2000_PROFESSIONAL) - { - char tmp[MAX_SIZE]; - Format(tmp, sizeof(tmp), "SYSTEM\\CurrentControlSet\\Control\\Network\\{4D36E972-E325-11CE-BFC1-08002BE10318}\\%s\\Connection", guid); - ncname = MsRegReadStrW(REG_LOCAL_MACHINE, tmp, "Name"); - } - - return ncname; -} - -// Generate driver file name for the new Neo -bool MsMakeNewNeoDriverFilename(char *name, UINT size) -{ - TOKEN_LIST *t = MsEnumNeoDriverFilenames(); - UINT i; - bool ret = false; - - i = 0; - while (true) - { - char tmp[MAX_PATH]; - UINT n; - - i++; - if (i >= 10000) - { - break; - } - - n = Rand32() % DRIVER_INSTALL_SYS_NAME_TAG_MAXID; - - MsGenerateNeoDriverFilenameFromInt(tmp, sizeof(tmp), n); - - if (IsInToken(t, tmp) == false) - { - StrCpy(name, size, tmp); - ret = true; - break; - } - } - - FreeToken(t); - - return ret; -} - -// Generate the driver file name of Neo from a integer -void MsGenerateNeoDriverFilenameFromInt(char *name, UINT size, UINT n) -{ - Format(name, size, DRIVER_INSTALL_SYS_NAME_TAG_NEW, n); -} - -// Enumeration of the driver file names of installed Neo -TOKEN_LIST *MsEnumNeoDriverFilenames() -{ - TOKEN_LIST *neos = MsEnumNetworkAdaptersNeo(); - LIST *o = NewListFast(NULL); - TOKEN_LIST *ret; - UINT i; - - for (i = 0;i < neos->NumTokens;i++) - { - char filename[MAX_PATH]; - if (MsGetNeoDriverFilename(filename, sizeof(filename), neos->Token[i])) - { - Add(o, CopyStr(filename)); - } - } - - FreeToken(neos); - - ret = ListToTokenList(o); - FreeStrList(o); - - return ret; -} - -// Get the driver file name of Neo -bool MsGetNeoDriverFilename(char *name, UINT size, char *instance_name) -{ - char tmp[MAX_SIZE]; - char *ret; - // Validate arguments - if (name == NULL || instance_name == NULL) - { - return false; - } - - Format(tmp, sizeof(tmp), "SYSTEM\\CurrentControlSet\\Services\\Neo_%s", instance_name); - - ret = MsRegReadStr(REG_LOCAL_MACHINE, tmp, "ImagePath"); - if (ret == NULL) - { - return false; - } - - GetFileNameFromFilePath(name, size, ret); - Free(ret); - - return true; -} - -// Enumeration of the network adapter (only Neo) -TOKEN_LIST *MsEnumNetworkAdaptersNeo() -{ - TOKEN_LIST *key_list; - TOKEN_LIST *ret; - LIST *o; - UINT i; - - // Enumerate the key - if (MsIsNt()) - { - key_list = MsRegEnumKey(REG_LOCAL_MACHINE, - "SYSTEM\\CurrentControlSet\\Control\\Class\\{4D36E972-E325-11CE-BFC1-08002bE10318}"); - } - else - { - key_list = MsRegEnumKey(REG_LOCAL_MACHINE, - "System\\CurrentControlSet\\Services\\Class\\Net"); - } - if (key_list == NULL) - { - return NULL; - } - - o = NewListFast(CompareStr); - - for (i = 0;i < key_list->NumTokens;i++) - { - char *key_name = key_list->Token[i]; - char full_key_name[MAX_SIZE]; - char *driver_desc; - char *device_id; - - if (MsIsNt()) - { - Format(full_key_name, sizeof(full_key_name), - "SYSTEM\\CurrentControlSet\\Control\\Class\\{4D36E972-E325-11CE-BFC1-08002bE10318}\\%s", - key_name); - } - else - { - Format(full_key_name, sizeof(full_key_name), - "System\\CurrentControlSet\\Services\\Class\\Net\\%s", - key_name); - } - - // Read the DriverDesc - driver_desc = MsRegReadStr(REG_LOCAL_MACHINE, full_key_name, "DriverDesc"); - if (driver_desc != NULL) - { - // Check whether it starts with the specific name - device_id = MsRegReadStr(REG_LOCAL_MACHINE, full_key_name, "MatchingDeviceId"); - - if (device_id != NULL) - { - if (MsCheckVLanDeviceIdFromRootEnum(device_id)) - { - char *tag = "neoadapter_"; - if (StartWith(device_id, tag)) - { - char tmp[MAX_SIZE]; - StrCpy(tmp, sizeof(tmp), &device_id[StrLen(tag)]); - - Add(o, CopyStr(tmp)); - } - } - Free(device_id); - } - - Free(driver_desc); - } - } - - FreeToken(key_list); - - ret = ZeroMalloc(sizeof(TOKEN_LIST)); - ret->NumTokens = LIST_NUM(o); - ret->Token = ZeroMalloc(sizeof(char *) * ret->NumTokens); - for (i = 0;i < ret->NumTokens;i++) - { - ret->Token[i] = LIST_DATA(o, i); - } - - ReleaseList(o); - - return ret; -} - -// Enumeration of the network adapter -TOKEN_LIST *MsEnumNetworkAdapters(char *start_with_name, char *start_with_name_2) -{ - TOKEN_LIST *key_list; - TOKEN_LIST *ret; - LIST *o; - UINT i; - - // Enumerate the key - if (MsIsNt()) - { - key_list = MsRegEnumKey(REG_LOCAL_MACHINE, - "SYSTEM\\CurrentControlSet\\Control\\Class\\{4D36E972-E325-11CE-BFC1-08002bE10318}"); - } - else - { - key_list = MsRegEnumKey(REG_LOCAL_MACHINE, - "System\\CurrentControlSet\\Services\\Class\\Net"); - } - if (key_list == NULL) - { - return NULL; - } - - o = NewListFast(CompareStr); - - for (i = 0;i < key_list->NumTokens;i++) - { - char *key_name = key_list->Token[i]; - char full_key_name[MAX_SIZE]; - char *driver_desc; - char *device_id; - - if (MsIsNt()) - { - Format(full_key_name, sizeof(full_key_name), - "SYSTEM\\CurrentControlSet\\Control\\Class\\{4D36E972-E325-11CE-BFC1-08002bE10318}\\%s", - key_name); - } - else - { - Format(full_key_name, sizeof(full_key_name), - "System\\CurrentControlSet\\Services\\Class\\Net\\%s", - key_name); - } - - // Read the DriverDesc - driver_desc = MsRegReadStr(REG_LOCAL_MACHINE, full_key_name, "DriverDesc"); - if (driver_desc != NULL) - { - // Check whether it starts with the specific name - if ((IsEmptyStr(start_with_name) && IsEmptyStr(start_with_name_2)) || - (StartWith(driver_desc, start_with_name) || StartWith(driver_desc, start_with_name_2))) - { - device_id = MsRegReadStr(REG_LOCAL_MACHINE, full_key_name, "MatchingDeviceId"); - - if (device_id != NULL) - { - if (MsCheckVLanDeviceIdFromRootEnum(device_id)) - { - char instance_name[MAX_SIZE]; - // Extract only the instance name from the name - if (StartWith(driver_desc, start_with_name)) - { - if (StrLen(driver_desc) > (StrLen(start_with_name) + 3)) - { - StrCpy(instance_name, sizeof(instance_name), - driver_desc + StrLen(start_with_name) + 3); - Add(o, CopyStr(instance_name)); - } - } - else - { - if (StrLen(driver_desc) > (StrLen(start_with_name_2) + 3)) - { - StrCpy(instance_name, sizeof(instance_name), - driver_desc + StrLen(start_with_name_2) + 3); - Add(o, CopyStr(instance_name)); - } - } - } - Free(device_id); - } - } - - Free(driver_desc); - } - } - - FreeToken(key_list); - - ret = ZeroMalloc(sizeof(TOKEN_LIST)); - ret->NumTokens = LIST_NUM(o); - ret->Token = ZeroMalloc(sizeof(char *) * ret->NumTokens); - for (i = 0;i < ret->NumTokens;i++) - { - ret->Token[i] = LIST_DATA(o, i); - } - - ReleaseList(o); - - return ret; -} - -// Attempt to logon to the domain -bool MsCheckLogon(wchar_t *username, char *password) -{ - wchar_t password_unicode[MAX_SIZE]; - HANDLE h; - // Validate arguments - if (username == NULL || password == NULL) - { - return false; - } - - if (MsIsNt() == false) - { - return false; - } - - StrToUni(password_unicode, sizeof(password_unicode), password); - - if (GET_KETA(GetOsInfo()->OsType, 100) >= 2) - { - if (ms->nt->LogonUserW(username, NULL, password_unicode, LOGON32_LOGON_NETWORK, LOGON32_PROVIDER_DEFAULT, &h) == false) - { - // Logon failure - return false; - } - } - else - { - char username_ansi[MAX_SIZE]; - UniToStr(username_ansi, sizeof(username_ansi), username); - - if (ms->nt->LogonUserA(username_ansi, NULL, password, LOGON32_LOGON_NETWORK, LOGON32_PROVIDER_DEFAULT, &h) == false) - { - // Logon failure - return false; - } - } - - CloseHandle(h); - - return true; -} - -// Execute the shutdown -bool MsShutdown(bool reboot, bool force) -{ - UINT flag = 0; - // Get the privilege - if (MsEnablePrivilege(SE_SHUTDOWN_NAME, true) == false) - { - return false; - } - - flag |= (reboot ? EWX_REBOOT : EWX_SHUTDOWN); - flag |= (force ? EWX_FORCE : 0); - - // Execute the shutdown - if (ExitWindowsEx(flag, 0) == false) - { - MsEnablePrivilege(SE_SHUTDOWN_NAME, false); - return false; - } - - // Release of privilege - MsEnablePrivilege(SE_SHUTDOWN_NAME, false); - - return true; -} - -// Enable or disable the privilege -bool MsEnablePrivilege(char *name, bool enable) -{ - HANDLE hToken; - NT_API *nt = ms->nt; - LUID luid; - TOKEN_PRIVILEGES *tp; - bool ret; - // Validate arguments - if (name == NULL) - { - return false; - } - if (MsIsNt() == false) - { - return true; - } - - // Open the process token - if (nt->OpenProcessToken(ms->hCurrentProcess, TOKEN_ADJUST_PRIVILEGES, &hToken) == false) - { - return false; - } - - // Get a local unique identifier - if (nt->LookupPrivilegeValue(NULL, name, &luid) == FALSE) - { - CloseHandle(hToken); - return false; - } - - // Create a structure to enable / disable the privilege - tp = ZeroMalloc(sizeof(TOKEN_PRIVILEGES)); - tp->PrivilegeCount = 1; - tp->Privileges[0].Attributes = enable ? SE_PRIVILEGE_ENABLED : 0; - Copy(&tp->Privileges[0].Luid, &luid, sizeof(LUID)); - - // Manipulate the privilege - ret = nt->AdjustTokenPrivileges(hToken, false, tp, sizeof(TOKEN_PRIVILEGES), 0, 0); - - Free(tp); - CloseHandle(hToken); - - return ret; -} - -// Get whether the current OS is a NT system -bool MsIsNt() -{ - if (ms == NULL) - { - OSVERSIONINFO os; - Zero(&os, sizeof(os)); - os.dwOSVersionInfoSize = sizeof(os); - GetVersionEx(&os); - if (os.dwPlatformId == VER_PLATFORM_WIN32_NT) - { - return true; - } - else - { - return false; - } - } - - return ms->IsNt; -} - -// Get whether the current system is WINE -bool MsIsWine() -{ - bool ret = false; - - if (ms == NULL) - { - HINSTANCE h = LoadLibrary("kernel32.dll"); - - if (h != NULL) - { - if (GetProcAddress(h, "wine_get_unix_file_name") != NULL) - { - ret = true; - } - - FreeLibrary(h); - } - } - else - { - ret = ms->IsWine; - } - - return ret; -} - -// Get whether the current user is an Admin -bool MsIsAdmin() -{ - return ms->IsAdmin; -} - -// Load the NT system function -NT_API *MsLoadNtApiFunctions() -{ - NT_API *nt = ZeroMalloc(sizeof(NT_API)); - OSVERSIONINFO info; - - Zero(&info, sizeof(info)); - info.dwOSVersionInfoSize = sizeof(info); - GetVersionEx(&info); - - nt->hKernel32 = LoadLibrary("kernel32.dll"); - if (nt->hKernel32 == NULL) - { - Free(nt); - return NULL; - } - - nt->hAdvapi32 = LoadLibrary("advapi32.dll"); - if (nt->hAdvapi32 == NULL) - { - Free(nt); - return NULL; - } - - nt->hShell32 = LoadLibrary("shell32.dll"); - if (nt->hShell32 == NULL) - { - FreeLibrary(nt->hAdvapi32); - Free(nt); - return NULL; - } - - nt->hPsApi = LoadLibrary("psapi.dll"); - - if (info.dwMajorVersion >= 5) - { - nt->hNewDev = LoadLibrary("newdev.dll"); - if (nt->hNewDev == NULL) - { - FreeLibrary(nt->hShell32); - FreeLibrary(nt->hAdvapi32); - Free(nt); - return NULL; - } - - nt->hSetupApi = LoadLibrary("setupapi.dll"); - } - - nt->hSecur32 = LoadLibrary("secur32.dll"); - - nt->hUser32 = LoadLibrary("user32.dll"); - - nt->hDbgHelp = LoadLibrary("dbghelp.dll"); - - nt->hWcmapi = LoadLibrary("wcmapi.dll"); - - nt->hDwmapi = LoadLibrary("dwmapi.dll"); - - // Read the function - nt->GetComputerNameExW = - (BOOL (__stdcall *)(COMPUTER_NAME_FORMAT,LPWSTR,LPDWORD)) - GetProcAddress(nt->hKernel32, "GetComputerNameExW"); - - nt->IsWow64Process = - (BOOL (__stdcall *)(HANDLE,BOOL *)) - GetProcAddress(nt->hKernel32, "IsWow64Process"); - - nt->GetFileInformationByHandle = - (BOOL (__stdcall *)(HANDLE,LPBY_HANDLE_FILE_INFORMATION)) - GetProcAddress(nt->hKernel32, "GetFileInformationByHandle"); - - nt->GetProcessHeap = - (HANDLE (__stdcall *)()) - GetProcAddress(nt->hKernel32, "GetProcessHeap"); - - nt->SetProcessShutdownParameters = - (BOOL (__stdcall *)(DWORD,DWORD)) - GetProcAddress(nt->hKernel32, "SetProcessShutdownParameters"); - - nt->GetNativeSystemInfo = - (void (__stdcall *)(SYSTEM_INFO *)) - GetProcAddress(nt->hKernel32, "GetNativeSystemInfo"); - - nt->AdjustTokenPrivileges = - (BOOL (__stdcall *)(HANDLE,BOOL,PTOKEN_PRIVILEGES,DWORD,PTOKEN_PRIVILEGES,PDWORD)) - GetProcAddress(nt->hAdvapi32, "AdjustTokenPrivileges"); - - nt->LookupPrivilegeValue = - (BOOL (__stdcall *)(char *,char *,PLUID)) - GetProcAddress(nt->hAdvapi32, "LookupPrivilegeValueA"); - - nt->OpenProcessToken = - (BOOL (__stdcall *)(HANDLE,DWORD,PHANDLE)) - GetProcAddress(nt->hAdvapi32, "OpenProcessToken"); - - nt->InitiateSystemShutdown = - (BOOL (__stdcall *)(LPTSTR,LPTSTR,DWORD,BOOL,BOOL)) - GetProcAddress(nt->hAdvapi32, "InitiateSystemShutdownA"); - - nt->LogonUserW = - (BOOL (__stdcall *)(wchar_t *,wchar_t *,wchar_t *,DWORD,DWORD,HANDLE *)) - GetProcAddress(nt->hAdvapi32, "LogonUserW"); - - nt->LogonUserA = - (BOOL (__stdcall *)(char *,char *,char *,DWORD,DWORD,HANDLE * )) - GetProcAddress(nt->hAdvapi32, "LogonUserA"); - - nt->DuplicateTokenEx = - (BOOL (__stdcall *)(HANDLE,DWORD,SECURITY_ATTRIBUTES *,SECURITY_IMPERSONATION_LEVEL,TOKEN_TYPE,HANDLE *)) - GetProcAddress(nt->hAdvapi32, "DuplicateTokenEx"); - - nt->ConvertStringSidToSidA = - (BOOL (__stdcall *)(LPCSTR,PSID *)) - GetProcAddress(nt->hAdvapi32, "ConvertStringSidToSidA"); - - nt->GetTokenInformation = - (BOOL (__stdcall *)(HANDLE,TOKEN_INFORMATION_CLASS,void *,DWORD,PDWORD)) - GetProcAddress(nt->hAdvapi32, "GetTokenInformation"); - - nt->SetTokenInformation = - (BOOL (__stdcall *)(HANDLE,TOKEN_INFORMATION_CLASS,void *,DWORD)) - GetProcAddress(nt->hAdvapi32, "SetTokenInformation"); - - nt->CreateProcessAsUserA = - (BOOL (__stdcall *)(HANDLE,LPCSTR,LPSTR,LPSECURITY_ATTRIBUTES,LPSECURITY_ATTRIBUTES,BOOL,DWORD,void *,LPCSTR,LPSTARTUPINFOA,LPPROCESS_INFORMATION)) - GetProcAddress(nt->hAdvapi32, "CreateProcessAsUserA"); - - nt->CreateProcessAsUserW = - (BOOL (__stdcall *)(HANDLE,LPCWSTR,LPWSTR,LPSECURITY_ATTRIBUTES,LPSECURITY_ATTRIBUTES,BOOL,DWORD,void *,LPCWSTR,LPSTARTUPINFOW,LPPROCESS_INFORMATION)) - GetProcAddress(nt->hAdvapi32, "CreateProcessAsUserW"); - - nt->LookupAccountSidA = - (BOOL (__stdcall *)(LPCSTR,PSID,LPSTR,LPDWORD,LPSTR,LPDWORD,PSID_NAME_USE)) - GetProcAddress(nt->hAdvapi32, "LookupAccountSidA"); - - nt->LookupAccountNameA = - (BOOL (__stdcall *)(LPCSTR,LPCSTR,PSID,LPDWORD,LPSTR,LPDWORD,PSID_NAME_USE)) - GetProcAddress(nt->hAdvapi32, "LookupAccountNameA"); - - nt->SetNamedSecurityInfoW = - (DWORD (__stdcall *)(LPWSTR,UINT,SECURITY_INFORMATION,PSID,PSID,PACL,PACL)) - GetProcAddress(nt->hAdvapi32, "SetNamedSecurityInfoW"); - - nt->AddAccessAllowedAceEx = - (BOOL (__stdcall *)(PACL,DWORD,DWORD,DWORD,PSID)) - GetProcAddress(nt->hAdvapi32, "AddAccessAllowedAceEx"); - - nt->QueryFullProcessImageNameA = - (BOOL (__stdcall *)(HANDLE,DWORD,LPSTR,PDWORD)) - GetProcAddress(nt->hKernel32, "QueryFullProcessImageNameA"); - - nt->QueryFullProcessImageNameW = - (BOOL (__stdcall *)(HANDLE,DWORD,LPWSTR,PDWORD)) - GetProcAddress(nt->hKernel32, "QueryFullProcessImageNameW"); - - nt->RegLoadKeyW = - (LSTATUS (__stdcall *)(HKEY,LPCWSTR,LPCWSTR)) - GetProcAddress(nt->hAdvapi32, "RegLoadKeyW"); - - nt->RegUnLoadKeyW = - (LSTATUS (__stdcall *)(HKEY,LPCWSTR)) - GetProcAddress(nt->hAdvapi32, "RegUnLoadKeyW"); - - if (info.dwMajorVersion >= 5) - { - nt->UpdateDriverForPlugAndPlayDevicesW = - (BOOL (__stdcall *)(HWND,wchar_t *,wchar_t *,UINT,BOOL *)) - GetProcAddress(nt->hNewDev, "UpdateDriverForPlugAndPlayDevicesW"); - - nt->CM_Get_Device_ID_ExA = - (UINT (__stdcall *)(DWORD,char *,UINT,UINT,HANDLE)) - GetProcAddress(nt->hSetupApi, "CM_Get_Device_ID_ExA"); - - nt->CM_Get_DevNode_Status_Ex = - (UINT (__stdcall *)(UINT *,UINT *,DWORD,UINT,HANDLE)) - GetProcAddress(nt->hSetupApi, "CM_Get_DevNode_Status_Ex"); - } - - nt->hWtsApi32 = LoadLibrary("wtsapi32.dll"); - if (nt->hWtsApi32 != NULL) - { - // Terminal Services related API - nt->WTSQuerySessionInformation = - (UINT (__stdcall *)(HANDLE,DWORD,WTS_INFO_CLASS,wchar_t *,DWORD *)) - GetProcAddress(nt->hWtsApi32, "WTSQuerySessionInformationW"); - nt->WTSFreeMemory = - (void (__stdcall *)(void *)) - GetProcAddress(nt->hWtsApi32, "WTSFreeMemory"); - nt->WTSDisconnectSession = - (BOOL (__stdcall *)(HANDLE,DWORD,BOOL)) - GetProcAddress(nt->hWtsApi32, "WTSDisconnectSession"); - nt->WTSEnumerateSessionsA = - (BOOL (__stdcall *)(HANDLE,DWORD,DWORD,PWTS_SESSION_INFOA *,DWORD *)) - GetProcAddress(nt->hWtsApi32, "WTSEnumerateSessionsA"); - nt->WTSRegisterSessionNotification = - (BOOL (__stdcall *)(HWND,DWORD)) - GetProcAddress(nt->hWtsApi32, "WTSRegisterSessionNotification"); - nt->WTSUnRegisterSessionNotification = - (BOOL (__stdcall *)(HWND)) - GetProcAddress(nt->hWtsApi32, "WTSUnRegisterSessionNotification"); - } - - // Service related API - nt->OpenSCManager = - (SC_HANDLE (__stdcall *)(LPCTSTR,LPCTSTR,DWORD)) - GetProcAddress(nt->hAdvapi32, "OpenSCManagerA"); - nt->CreateServiceA = - (SC_HANDLE (__stdcall *)(SC_HANDLE,LPCTSTR,LPCTSTR,DWORD,DWORD,DWORD,DWORD,LPCTSTR,LPCTSTR,LPDWORD,LPCTSTR,LPCTSTR,LPCTSTR)) - GetProcAddress(nt->hAdvapi32, "CreateServiceA"); - nt->CreateServiceW = - (SC_HANDLE (__stdcall *)(SC_HANDLE,LPCWSTR,LPCWSTR,DWORD,DWORD,DWORD,DWORD,LPCWSTR,LPCWSTR,LPDWORD,LPCWSTR,LPCWSTR,LPCWSTR)) - GetProcAddress(nt->hAdvapi32, "CreateServiceW"); - nt->ChangeServiceConfig2 = - (BOOL (__stdcall *)(SC_HANDLE,DWORD,LPVOID)) - GetProcAddress(nt->hAdvapi32, "ChangeServiceConfig2W"); - nt->CloseServiceHandle = - (BOOL (__stdcall *)(SC_HANDLE)) - GetProcAddress(nt->hAdvapi32, "CloseServiceHandle"); - nt->OpenService = - (SC_HANDLE (__stdcall *)(SC_HANDLE,LPCTSTR,DWORD)) - GetProcAddress(nt->hAdvapi32, "OpenServiceA"); - nt->QueryServiceStatus = - (BOOL (__stdcall *)(SC_HANDLE,LPSERVICE_STATUS)) - GetProcAddress(nt->hAdvapi32, "QueryServiceStatus"); - nt->StartService = - (BOOL (__stdcall *)(SC_HANDLE,DWORD,LPCTSTR)) - GetProcAddress(nt->hAdvapi32, "StartServiceA"); - nt->ControlService = - (BOOL (__stdcall *)(SC_HANDLE,DWORD,LPSERVICE_STATUS)) - GetProcAddress(nt->hAdvapi32, "ControlService"); - nt->SetServiceStatus = - (BOOL (__stdcall *)(SERVICE_STATUS_HANDLE,LPSERVICE_STATUS)) - GetProcAddress(nt->hAdvapi32, "SetServiceStatus"); - nt->RegisterServiceCtrlHandler = - (SERVICE_STATUS_HANDLE (__stdcall *)(LPCTSTR,LPHANDLER_FUNCTION)) - GetProcAddress(nt->hAdvapi32, "RegisterServiceCtrlHandlerW"); - nt->StartServiceCtrlDispatcher = - (BOOL (__stdcall *)(const LPSERVICE_TABLE_ENTRY)) - GetProcAddress(nt->hAdvapi32, "StartServiceCtrlDispatcherW"); - nt->DeleteService = - (BOOL (__stdcall *)(SC_HANDLE)) - GetProcAddress(nt->hAdvapi32, "DeleteService"); - nt->RegisterEventSourceW = - (HANDLE (__stdcall *)(LPCWSTR,LPCWSTR)) - GetProcAddress(nt->hAdvapi32, "RegisterEventSourceW"); - nt->ReportEventW = - (BOOL (__stdcall *)(HANDLE,WORD,WORD,DWORD,PSID,WORD,DWORD,LPCWSTR *,LPVOID)) - GetProcAddress(nt->hAdvapi32, "ReportEventW"); - nt->DeregisterEventSource = - (BOOL (__stdcall *)(HANDLE)) - GetProcAddress(nt->hAdvapi32, "DeregisterEventSource"); - nt->Wow64DisableWow64FsRedirection = - (BOOL (__stdcall *)(void **)) - GetProcAddress(nt->hKernel32, "Wow64DisableWow64FsRedirection"); - nt->Wow64EnableWow64FsRedirection = - (BOOLEAN (__stdcall *)(BOOLEAN)) - GetProcAddress(nt->hKernel32, "Wow64EnableWow64FsRedirection"); - nt->Wow64RevertWow64FsRedirection = - (BOOL (__stdcall *)(void *)) - GetProcAddress(nt->hKernel32, "Wow64RevertWow64FsRedirection"); - - if (nt->hPsApi != NULL) - { - // Process related API - nt->EnumProcesses = - (BOOL (__stdcall *)(DWORD *,DWORD,DWORD *)) - GetProcAddress(nt->hPsApi, "EnumProcesses"); - - nt->EnumProcessModules = - (BOOL (__stdcall *)(HANDLE,HMODULE * ,DWORD,DWORD *)) - GetProcAddress(nt->hPsApi, "EnumProcessModules"); - - nt->GetModuleFileNameExA = - (DWORD (__stdcall *)(HANDLE,HMODULE,LPSTR,DWORD)) - GetProcAddress(nt->hPsApi, "GetModuleFileNameExA"); - - nt->GetModuleFileNameExW = - (DWORD (__stdcall *)(HANDLE,HMODULE,LPWSTR,DWORD)) - GetProcAddress(nt->hPsApi, "GetModuleFileNameExW"); - - nt->GetProcessImageFileNameA = - (DWORD (__stdcall *)(HANDLE,LPSTR,DWORD)) - GetProcAddress(nt->hPsApi, "GetProcessImageFileNameA"); - - nt->GetProcessImageFileNameW = - (DWORD (__stdcall *)(HANDLE,LPWSTR,DWORD)) - GetProcAddress(nt->hPsApi, "GetProcessImageFileNameW"); - } - - // Registry related API - nt->RegDeleteKeyExA = - (LONG (__stdcall *)(HKEY,LPCTSTR,REGSAM,DWORD)) - GetProcAddress(nt->hAdvapi32, "RegDeleteKeyExA"); - - // Security related API - if (nt->hSecur32 != NULL) - { - nt->GetUserNameExA = - (BOOL (__stdcall *)(EXTENDED_NAME_FORMAT,LPSTR,PULONG)) - GetProcAddress(nt->hSecur32, "GetUserNameExA"); - - nt->GetUserNameExW = - (BOOL (__stdcall *)(EXTENDED_NAME_FORMAT,LPWSTR,PULONG)) - GetProcAddress(nt->hSecur32, "GetUserNameExW"); - - nt->LsaConnectUntrusted = - (NTSTATUS (__stdcall *)(PHANDLE)) - GetProcAddress(nt->hSecur32, "LsaConnectUntrusted"); - - nt->LsaLookupAuthenticationPackage = - (NTSTATUS (__stdcall *)(HANDLE,PLSA_STRING,PULONG)) - GetProcAddress(nt->hSecur32, "LsaLookupAuthenticationPackage"); - - nt->LsaLogonUser = - (NTSTATUS (__stdcall *)(HANDLE,PLSA_STRING,SECURITY_LOGON_TYPE,ULONG,PVOID,ULONG,PTOKEN_GROUPS,PTOKEN_SOURCE,PVOID,PULONG,PLUID,PHANDLE,PQUOTA_LIMITS,PNTSTATUS)) - GetProcAddress(nt->hSecur32, "LsaLogonUser"); - - nt->LsaDeregisterLogonProcess = - (NTSTATUS (__stdcall *)(HANDLE)) - GetProcAddress(nt->hSecur32, "LsaDeregisterLogonProcess"); - - nt->LsaFreeReturnBuffer = - (NTSTATUS (__stdcall *)(PVOID)) - GetProcAddress(nt->hSecur32, "LsaFreeReturnBuffer"); - } - - // WCM related API of Windows 8 - if (nt->hWcmapi != NULL) - { - nt->WcmQueryProperty = - (DWORD (__stdcall *)(const GUID *,LPCWSTR,MS_WCM_PROPERTY,PVOID,PDWORD,PBYTE *)) - GetProcAddress(nt->hWcmapi, "WcmQueryProperty"); - - nt->WcmSetProperty = - (DWORD (__stdcall *)(const GUID *,LPCWSTR,MS_WCM_PROPERTY,PVOID,DWORD,const BYTE *)) - GetProcAddress(nt->hWcmapi, "WcmSetProperty"); - - nt->WcmFreeMemory = - (void (__stdcall *)(PVOID)) - GetProcAddress(nt->hWcmapi, "WcmFreeMemory"); - - nt->WcmGetProfileList = - (DWORD (__stdcall *)(PVOID,MS_WCM_PROFILE_INFO_LIST **)) - GetProcAddress(nt->hWcmapi, "WcmGetProfileList"); - } - - nt->AllocateLocallyUniqueId = - (BOOL (__stdcall *)(PLUID)) - GetProcAddress(nt->hAdvapi32, "AllocateLocallyUniqueId"); - - // Desktop related API - if (nt->hUser32 != NULL) - { - nt->SwitchDesktop = - (BOOL (__stdcall *)(HDESK)) - GetProcAddress(nt->hUser32, "SwitchDesktop"); - nt->OpenDesktopA = - (HDESK (__stdcall *)(LPTSTR,DWORD,BOOL,ACCESS_MASK)) - GetProcAddress(nt->hUser32, "OpenDesktopA"); - nt->CloseDesktop = - (BOOL (__stdcall *)(HDESK)) - GetProcAddress(nt->hUser32, "CloseDesktop"); - } - - // DWM API - if (nt->hDwmapi) - { - nt->DwmIsCompositionEnabled = - (HRESULT (__stdcall *)(BOOL *)) - GetProcAddress(nt->hDwmapi, "DwmIsCompositionEnabled"); - } - - // Debug related API - if (nt->hDbgHelp != NULL) - { - nt->MiniDumpWriteDump = - (BOOL (__stdcall *)(HANDLE,DWORD,HANDLE,MINIDUMP_TYPE,PMINIDUMP_EXCEPTION_INFORMATION,PMINIDUMP_USER_STREAM_INFORMATION,PMINIDUMP_CALLBACK_INFORMATION)) - GetProcAddress(nt->hDbgHelp, "MiniDumpWriteDump"); - } - - return nt; -} - -// Release of NT system function -void MsFreeNtApiFunctions(NT_API *nt) -{ - // Validate arguments - if (nt == NULL) - { - return; - } - - if (nt->hSecur32 != NULL) - { - FreeLibrary(nt->hSecur32); - } - - if (nt->hNewDev != NULL) - { - FreeLibrary(nt->hSetupApi); - FreeLibrary(nt->hNewDev); - } - - FreeLibrary(nt->hAdvapi32); - - FreeLibrary(nt->hShell32); - - if (nt->hWtsApi32 != NULL) - { - FreeLibrary(nt->hWtsApi32); - } - - if (nt->hPsApi != NULL) - { - FreeLibrary(nt->hPsApi); - } - - if (nt->hUser32 != NULL) - { - FreeLibrary(nt->hUser32); - } - - if (nt->hDbgHelp != NULL) - { - FreeLibrary(nt->hDbgHelp); - } - - if (nt->hWcmapi != NULL) - { - FreeLibrary(nt->hWcmapi); - } - - if (nt->hDwmapi != NULL) - { - FreeLibrary(nt->hDwmapi); - } - - FreeLibrary(nt->hKernel32); - - Free(nt); -} - -// Get whether the screen color is like to Aero of Windows Vista or later -bool MsIsAeroColor() -{ - UINT r; - if (MsIsNt() == false) - { - return false; - } - - if (MsIsVista() == false) - { - return false; - } - - r = GetSysColor(COLOR_MENU); - if (r == 0xFFFFFF || r == 0xF0F0F0 || r >= 0xF00000) - { - return true; - } - - if (MsIsAeroEnabled()) - { - return true; - } - - return false; -} - -// Get whether Aero is enabled -bool MsIsAeroEnabled() -{ - bool ret; - if (MsIsNt() == false) - { - return false; - } - - if (ms->nt->DwmIsCompositionEnabled == NULL) - { - return false; - } - - ret = false; - - if (ms->nt->DwmIsCompositionEnabled(&ret) != S_OK) - { - return false; - } - - return ret; -} - -// Generate an access mask to force accessing to the 32 bit registry key for 64 bit application -UINT MsRegAccessMaskFor64BitEx(bool force32bit, bool force64bit) -{ - if (MsIs64BitWindows() == false) - { - return 0; - } - if (force32bit) - { - return KEY_WOW64_32KEY; - } - if (force64bit) - { - return KEY_WOW64_64KEY; - } - - return 0; -} - -// Load the hive -bool MsRegLoadHive(UINT root, wchar_t *keyname, wchar_t *filename) -{ - LONG ret; - if (keyname == NULL || filename == NULL) - { - WHERE; - return false; - } - - if (ms->nt == NULL || ms->nt->RegLoadKeyW == NULL || ms->nt->RegUnLoadKeyW == NULL) - { - WHERE; - return false; - } - - ret = ms->nt->RegLoadKeyW(MsGetRootKeyFromInt(root), keyname, filename); - - if (ret != ERROR_SUCCESS) - { - Debug("RegLoadKeyW: %S %S %u\n", keyname, filename, GetLastError()); - return false; - } - WHERE; - - return true; -} - -// Unload the hive -bool MsRegUnloadHive(UINT root, wchar_t *keyname) -{ - LONG ret; - if (keyname == NULL) - { - return false; - } - - if (ms->nt == NULL || ms->nt->RegLoadKeyW == NULL || ms->nt->RegUnLoadKeyW == NULL) - { - return false; - } - - ret = ms->nt->RegUnLoadKeyW(MsGetRootKeyFromInt(root), keyname); - - if (ret != ERROR_SUCCESS) - { - Debug("RegUnLoadKeyW: %u\n", GetLastError()); - return false; - } - - return true; -} - -// Delete the value -bool MsRegDeleteValue(UINT root, char *keyname, char *valuename) -{ - return MsRegDeleteValueEx(root, keyname, valuename, false); -} -bool MsRegDeleteValueEx(UINT root, char *keyname, char *valuename, bool force32bit) -{ - return MsRegDeleteValueEx2(root, keyname, valuename, force32bit, false); -} -bool MsRegDeleteValueEx2(UINT root, char *keyname, char *valuename, bool force32bit, bool force64bit) -{ - HKEY h; - bool ret; - // Validate arguments - if (keyname == NULL) - { - return false; - } - - if (RegOpenKeyEx(MsGetRootKeyFromInt(root), keyname, 0, KEY_ALL_ACCESS | MsRegAccessMaskFor64BitEx(force32bit, force64bit), &h) != ERROR_SUCCESS) - { - return false; - } - - if (RegDeleteValue(h, valuename) != ERROR_SUCCESS) - { - ret = false; - } - else - { - ret = true; - } - - RegCloseKey(h); - - return ret; -} - -// Delete the key -bool MsRegDeleteKey(UINT root, char *keyname) -{ - return MsRegDeleteKeyEx(root, keyname, false); -} -bool MsRegDeleteKeyEx(UINT root, char *keyname, bool force32bit) -{ - return MsRegDeleteKeyEx2(root, keyname, force32bit, false); -} -bool MsRegDeleteKeyEx2(UINT root, char *keyname, bool force32bit, bool force64bit) -{ - // Validate arguments - if (keyname == NULL) - { - return false; - } - - if (MsIsNt() && ms->nt->RegDeleteKeyExA != NULL) - { - if (ms->nt->RegDeleteKeyExA(MsGetRootKeyFromInt(root), keyname, MsRegAccessMaskFor64BitEx(force32bit, force64bit), 0) != ERROR_SUCCESS) - { - return false; - } - } - else - { - if (RegDeleteKey(MsGetRootKeyFromInt(root), keyname) != ERROR_SUCCESS) - { - return false; - } - } - - return true; -} - -// Enumeration of values -TOKEN_LIST *MsRegEnumValue(UINT root, char *keyname) -{ - return MsRegEnumValueEx(root, keyname, false); -} -TOKEN_LIST *MsRegEnumValueEx(UINT root, char *keyname, bool force32bit) -{ - return MsRegEnumValueEx2(root, keyname, force32bit, false); -} -TOKEN_LIST *MsRegEnumValueEx2(UINT root, char *keyname, bool force32bit, bool force64bit) -{ - HKEY h; - UINT i; - TOKEN_LIST *t; - LIST *o; - - if (keyname == NULL) - { - h = MsGetRootKeyFromInt(root); - } - else - { - if (RegOpenKeyEx(MsGetRootKeyFromInt(root), keyname, 0, KEY_READ | MsRegAccessMaskFor64BitEx(force32bit, force64bit), &h) != ERROR_SUCCESS) - { - return NULL; - } - } - - o = NewListFast(CompareStr); - - for (i = 0;;i++) - { - char tmp[MAX_SIZE]; - UINT ret; - UINT size = sizeof(tmp); - - Zero(tmp, sizeof(tmp)); - ret = RegEnumValue(h, i, tmp, &size, NULL, NULL, NULL, NULL); - if (ret == ERROR_NO_MORE_ITEMS) - { - break; - } - else if (ret != ERROR_SUCCESS) - { - break; - } - - Add(o, CopyStr(tmp)); - } - - Sort(o); - - t = ZeroMalloc(sizeof(TOKEN_LIST)); - t->NumTokens = LIST_NUM(o); - t->Token = ZeroMalloc(sizeof(char *) * t->NumTokens); - for (i = 0;i < t->NumTokens;i++) - { - t->Token[i] = LIST_DATA(o, i); - } - - ReleaseList(o); - - if (keyname != NULL) - { - RegCloseKey(h); - } - - return t; -} - -// Enumeration of the keys -TOKEN_LIST *MsRegEnumKey(UINT root, char *keyname) -{ - return MsRegEnumKeyEx(root, keyname, false); -} -TOKEN_LIST *MsRegEnumKeyEx(UINT root, char *keyname, bool force32bit) -{ - return MsRegEnumKeyEx2(root, keyname, force32bit, false); -} -TOKEN_LIST *MsRegEnumKeyEx2(UINT root, char *keyname, bool force32bit, bool force64bit) -{ - HKEY h; - UINT i; - TOKEN_LIST *t; - LIST *o; - - if (keyname == NULL) - { - h = MsGetRootKeyFromInt(root); - } - else - { - if (RegOpenKeyEx(MsGetRootKeyFromInt(root), keyname, 0, KEY_READ | MsRegAccessMaskFor64BitEx(force32bit, force64bit), &h) != ERROR_SUCCESS) - { - return NULL; - } - } - - o = NewListFast(CompareStr); - - for (i = 0;;i++) - { - char tmp[MAX_SIZE]; - UINT ret; - UINT size = sizeof(tmp); - FILETIME ft; - - Zero(tmp, sizeof(tmp)); - ret = RegEnumKeyEx(h, i, tmp, &size, NULL, NULL, NULL, &ft); - if (ret == ERROR_NO_MORE_ITEMS) - { - break; - } - else if (ret != ERROR_SUCCESS) - { - break; - } - - Add(o, CopyStr(tmp)); - } - - Sort(o); - - t = ZeroMalloc(sizeof(TOKEN_LIST)); - t->NumTokens = LIST_NUM(o); - t->Token = ZeroMalloc(sizeof(char *) * t->NumTokens); - for (i = 0;i < t->NumTokens;i++) - { - t->Token[i] = LIST_DATA(o, i); - } - - ReleaseList(o); - - if (keyname != NULL) - { - RegCloseKey(h); - } - - return t; -} - -// Set the binary data -bool MsRegWriteBin(UINT root, char *keyname, char *valuename, void *data, UINT size) -{ - return MsRegWriteBinEx(root, keyname, valuename, data, size, false); -} -bool MsRegWriteBinEx(UINT root, char *keyname, char *valuename, void *data, UINT size, bool force32bit) -{ - return MsRegWriteBinEx2(root, keyname, valuename, data, size, force32bit, false); -} -bool MsRegWriteBinEx2(UINT root, char *keyname, char *valuename, void *data, UINT size, bool force32bit, bool force64bit) -{ - // Validate arguments - if (keyname == NULL || (size != 0 && data == NULL)) - { - return false; - } - - return MsRegWriteValueEx2(root, keyname, valuename, REG_BINARY, data, size, force32bit, force64bit); -} - -// Set the integer value -bool MsRegWriteInt(UINT root, char *keyname, char *valuename, UINT value) -{ - return MsRegWriteIntEx(root, keyname, valuename, value, false); -} -bool MsRegWriteIntEx(UINT root, char *keyname, char *valuename, UINT value, bool force32bit) -{ - return MsRegWriteIntEx2(root, keyname, valuename, value, force32bit, false); -} -bool MsRegWriteIntEx2(UINT root, char *keyname, char *valuename, UINT value, bool force32bit, bool force64bit) -{ - // Validate arguments - if (keyname == NULL) - { - return false; - } - - // Endian correction - if (IsBigEndian()) - { - value = Swap32(value); - } - - return MsRegWriteValueEx2(root, keyname, valuename, REG_DWORD_LITTLE_ENDIAN, &value, sizeof(UINT), force32bit, force64bit); -} - -// Set the string -bool MsRegWriteStrExpand(UINT root, char *keyname, char *valuename, char *str) -{ - return MsRegWriteStrExpandEx(root, keyname, valuename, str, false); -} -bool MsRegWriteStrExpandEx(UINT root, char *keyname, char *valuename, char *str, bool force32bit) -{ - return MsRegWriteStrExpandEx2(root, keyname, valuename, str, force32bit, false); -} -bool MsRegWriteStrExpandEx2(UINT root, char *keyname, char *valuename, char *str, bool force32bit, bool force64bit) -{ - // Validate arguments - if (keyname == NULL || str == NULL) - { - return false; - } - - return MsRegWriteValueEx2(root, keyname, valuename, REG_EXPAND_SZ, str, StrSize(str), force32bit, force64bit); -} -bool MsRegWriteStrExpandW(UINT root, char *keyname, char *valuename, wchar_t *str) -{ - return MsRegWriteStrExpandExW(root, keyname, valuename, str, false); -} -bool MsRegWriteStrExpandExW(UINT root, char *keyname, char *valuename, wchar_t *str, bool force32bit) -{ - return MsRegWriteStrExpandEx2W(root, keyname, valuename, str, force32bit, false); -} -bool MsRegWriteStrExpandEx2W(UINT root, char *keyname, char *valuename, wchar_t *str, bool force32bit, bool force64bit) -{ - // Validate arguments - if (keyname == NULL || str == NULL) - { - return false; - } - - return MsRegWriteValueEx2W(root, keyname, valuename, REG_EXPAND_SZ, str, UniStrSize(str), force32bit, force64bit); -} - -bool MsRegWriteStr(UINT root, char *keyname, char *valuename, char *str) -{ - return MsRegWriteStrEx(root, keyname, valuename, str, false); -} -bool MsRegWriteStrEx(UINT root, char *keyname, char *valuename, char *str, bool force32bit) -{ - return MsRegWriteStrEx2(root, keyname, valuename, str, force32bit, false); -} -bool MsRegWriteStrEx2(UINT root, char *keyname, char *valuename, char *str, bool force32bit, bool force64bit) -{ - // Validate arguments - if (keyname == NULL || str == NULL) - { - return false; - } - - return MsRegWriteValueEx2(root, keyname, valuename, REG_SZ, str, StrSize(str), force32bit, force64bit); -} -bool MsRegWriteStrW(UINT root, char *keyname, char *valuename, wchar_t *str) -{ - return MsRegWriteStrExW(root, keyname, valuename, str, false); -} -bool MsRegWriteStrExW(UINT root, char *keyname, char *valuename, wchar_t *str, bool force32bit) -{ - return MsRegWriteStrEx2W(root, keyname, valuename, str, force32bit, false); -} -bool MsRegWriteStrEx2W(UINT root, char *keyname, char *valuename, wchar_t *str, bool force32bit, bool force64bit) -{ - // Validate arguments - if (keyname == NULL || str == NULL) - { - return false; - } - - return MsRegWriteValueEx2W(root, keyname, valuename, REG_SZ, str, UniStrSize(str), force32bit, force64bit); -} - -// Set the value -bool MsRegWriteValueEx2(UINT root, char *keyname, char *valuename, UINT type, void *data, UINT size, bool force32bit, bool force64bit) -{ - HKEY h; - // Validate arguments - if (keyname == NULL || (size != 0 && data == NULL)) - { - return false; - } - - // Create a key - MsRegNewKeyEx2(root, keyname, force32bit, force64bit); - - // Open the key - if (RegOpenKeyEx(MsGetRootKeyFromInt(root), keyname, 0, KEY_ALL_ACCESS | MsRegAccessMaskFor64BitEx(force32bit, force64bit), &h) != ERROR_SUCCESS) - { - return false; - } - - // Write the value - if (RegSetValueEx(h, valuename, 0, type, data, size) != ERROR_SUCCESS) - { - RegCloseKey(h); - return false; - } - - // Close the key - RegCloseKey(h); - - return true; -} -bool MsRegWriteValueEx2W(UINT root, char *keyname, char *valuename, UINT type, void *data, UINT size, bool force32bit, bool force64bit) -{ - HKEY h; - wchar_t *valuename_w; - // Validate arguments - if (keyname == NULL || (size != 0 && data == NULL)) - { - return false; - } - - if (IsNt() == false) - { - UINT size_a; - void *data_a; - bool ret; - - if (type == REG_SZ || type == REG_MULTI_SZ || type == REG_EXPAND_SZ) - { - data_a = CopyUniToStr(data); - size_a = StrSize(data_a); - } - else - { - data_a = Clone(data, size); - size_a = size; - } - - ret = MsRegWriteValueEx2(root, keyname, valuename, type, data_a, size_a, force32bit, force64bit); - - Free(data_a); - - return ret; - } - - // Create a key - MsRegNewKeyEx2(root, keyname, force32bit, force64bit); - - // Open the key - if (RegOpenKeyEx(MsGetRootKeyFromInt(root), keyname, 0, KEY_ALL_ACCESS | MsRegAccessMaskFor64BitEx(force32bit, force64bit), &h) != ERROR_SUCCESS) - { - return false; - } - - valuename_w = CopyStrToUni(valuename); - - // Write the value - if (RegSetValueExW(h, valuename_w, 0, type, data, size) != ERROR_SUCCESS) - { - RegCloseKey(h); - Free(valuename_w); - return false; - } - - // Close the key - RegCloseKey(h); - Free(valuename_w); - - return true; -} - -// Get the binary data -BUF *MsRegReadBin(UINT root, char *keyname, char *valuename) -{ - return MsRegReadBinEx(root, keyname, valuename, false); -} -BUF *MsRegReadBinEx(UINT root, char *keyname, char *valuename, bool force32bit) -{ - return MsRegReadBinEx2(root, keyname, valuename, force32bit, false); -} -BUF *MsRegReadBinEx2(UINT root, char *keyname, char *valuename, bool force32bit, bool force64bit) -{ - char *ret; - UINT type, size; - BUF *b; - // Validate arguments - if (keyname == NULL || valuename == NULL) - { - return 0; - } - - // Read the value - if (MsRegReadValueEx2(root, keyname, valuename, &ret, &type, &size, force32bit, force64bit) == false) - { - return 0; - } - - b = NewBuf(); - - WriteBuf(b, ret, size); - SeekBuf(b, 0, 0); - - Free(ret); - - return b; -} - -// Get an integer value -UINT MsRegReadInt(UINT root, char *keyname, char *valuename) -{ - return MsRegReadIntEx(root, keyname, valuename, false); -} -UINT MsRegReadIntEx(UINT root, char *keyname, char *valuename, bool force32bit) -{ - return MsRegReadIntEx2(root, keyname, valuename, force32bit, false); -} -UINT MsRegReadIntEx2(UINT root, char *keyname, char *valuename, bool force32bit, bool force64bit) -{ - char *ret; - UINT type, size; - UINT value; - // Validate arguments - if (keyname == NULL || valuename == NULL) - { - return 0; - } - - // Read the value - if (MsRegReadValueEx2(root, keyname, valuename, &ret, &type, &size, force32bit, force64bit) == false) - { - return 0; - } - - // Check the type - if (type != REG_DWORD_LITTLE_ENDIAN && type != REG_DWORD_BIG_ENDIAN) - { - // It is not a DWORD - Free(ret); - return 0; - } - - // Check the size - if (size != sizeof(UINT)) - { - Free(ret); - return 0; - } - - Copy(&value, ret, sizeof(UINT)); - - Free(ret); - - // Endian conversion - if (IsLittleEndian()) - { -#ifdef REG_DWORD_BIG_ENDIAN - if (type == REG_DWORD_BIG_ENDIAN) - { - value = Swap32(value); - } -#endif // REG_DWORD_BIG_ENDIAN - } - else - { -#ifdef REG_DWORD_LITTLE_ENDIAN_FLAG - if (type == REG_DWORD_LITTLE_ENDIAN_FLAG) - { - value = Swap32(value); - } -#endif // REG_DWORD_LITTLE_ENDIAN_FLAG - } - - return value; -} - -// Get a string list -LIST *MsRegReadStrList(UINT root, char *keyname, char *valuename) -{ - return MsRegReadStrListEx(root, keyname, valuename, false); -} -LIST *MsRegReadStrListEx(UINT root, char *keyname, char *valuename, bool force32bit) -{ - return MsRegReadStrListEx2(root, keyname, valuename, force32bit, false); -} -LIST *MsRegReadStrListEx2(UINT root, char *keyname, char *valuename, bool force32bit, bool force64bit) -{ - LIST *o; - char *ret; - UINT type, size; - // Validate arguments - if (keyname == NULL || valuename == NULL) - { - return NULL; - } - - // Read the value - if (MsRegReadValueEx2(root, keyname, valuename, &ret, &type, &size, force32bit, force64bit) == false) - { - return NULL; - } - - // Check the type - if (type != REG_MULTI_SZ) - { - // It is not a string list - Free(ret); - return NULL; - } - - if (size < 2) - { - // Invalid size - Free(ret); - return NULL; - } - - if (ret[size - 1] != 0) - { - // Invalid data - Free(ret); - return NULL; - } - - // Creating a list - o = StrToStrList(ret, size); - - Free(ret); - - return o; -} - -// Get a string -char *MsRegReadStr(UINT root, char *keyname, char *valuename) -{ - return MsRegReadStrEx(root, keyname, valuename, false); -} -char *MsRegReadStrEx(UINT root, char *keyname, char *valuename, bool force32bit) -{ - return MsRegReadStrEx2(root, keyname, valuename, force32bit, false); -} -char *MsRegReadStrEx2(UINT root, char *keyname, char *valuename, bool force32bit, bool force64bit) -{ - char *ret; - UINT type, size; - // Validate arguments - if (keyname == NULL || valuename == NULL) - { - return NULL; - } - - // Read the value - if (MsRegReadValueEx2(root, keyname, valuename, &ret, &type, &size, force32bit, force64bit) == false) - { - return NULL; - } - - // Check the type - if (type != REG_SZ && type != REG_EXPAND_SZ && type != REG_MULTI_SZ) - { - // It is not a string - Free(ret); - - if (type == REG_MULTI_SZ) - { - // It is a string list - LIST *o = MsRegReadStrList(root, keyname, valuename); - if (o != NULL) - { - if (LIST_NUM(o) >= 1) - { - ret = CopyStr(LIST_DATA(o, 0)); - FreeStrList(o); - return ret; - } - } - } - return NULL; - } - - if (size == 0) - { - // Invalid size - Free(ret); - - return CopyStr(""); - } - - if (ret[size - 1] != 0) - { - // Invalid data - Free(ret); - return NULL; - } - - return ret; -} -wchar_t *MsRegReadStrW(UINT root, char *keyname, char *valuename) -{ - return MsRegReadStrExW(root, keyname, valuename, false); -} -wchar_t *MsRegReadStrExW(UINT root, char *keyname, char *valuename, bool force32bit) -{ - return MsRegReadStrEx2W(root, keyname, valuename, force32bit, false); -} -wchar_t *MsRegReadStrEx2W(UINT root, char *keyname, char *valuename, bool force32bit, bool force64bit) -{ - wchar_t *ret; - UINT type, size; - // Validate arguments - if (keyname == NULL || valuename == NULL) - { - return NULL; - } - - // Read the value - if (MsRegReadValueEx2W(root, keyname, valuename, &ret, &type, &size, force32bit, force64bit) == false) - { - return NULL; - } - - // Check the type - if (type != REG_SZ && type != REG_EXPAND_SZ) - { - // It is not a string - Free(ret); - - return NULL; - } - - if (ret[size / sizeof(wchar_t) - 1] != 0) - { - // Invalid data - Free(ret); - return NULL; - } - - return ret; -} - -// Read the value -bool MsRegReadValueEx2(UINT root, char *keyname, char *valuename, void **data, UINT *type, UINT *size, bool force32bit, bool force64bit) -{ - HKEY h; - UINT ret; - // Validate arguments - if (keyname == NULL || data == NULL || type == NULL || size == NULL) - { - return false; - } - *type = 0; - *size = 0; - - // Open the key - if (RegOpenKeyEx(MsGetRootKeyFromInt(root), keyname, 0, KEY_READ | MsRegAccessMaskFor64BitEx(force32bit, force64bit), &h) != ERROR_SUCCESS) - { - return false; - } - - // Open up the value - *data = ZeroMalloc(*size); - ret = RegQueryValueEx(h, valuename, 0, type, *data, size); - - if (ret == ERROR_SUCCESS) - { - // Reading is complete - RegCloseKey(h); - return true; - } - - if (ret != ERROR_MORE_DATA) - { - // Strange error occurs - Free(*data); - *data = NULL; - RegCloseKey(h); - return false; - } - - // Get the data by re-allocating memory - *data = ReAlloc(*data, *size); - ret = RegQueryValueEx(h, valuename, 0, type, *data, size); - if (ret != ERROR_SUCCESS) - { - // An error has occured - Free(*data); - *data = NULL; - RegCloseKey(h); - } - - RegCloseKey(h); - - return true; -} -bool MsRegReadValueEx2W(UINT root, char *keyname, char *valuename, void **data, UINT *type, UINT *size, bool force32bit, bool force64bit) -{ - HKEY h; - UINT ret; - wchar_t *valuename_w; - // Validate arguments - if (keyname == NULL || data == NULL || type == NULL || size == NULL) - { - return false; - } - *type = 0; - *size = 0; - - if (IsNt() == false) - { - bool ret; - void *data_a = NULL; - UINT type_a = 0, size_a = 0; - - ret = MsRegReadValueEx2(root, keyname, valuename, &data_a, &type_a, &size_a, force32bit, force64bit); - - if (ret != false) - { - if (type_a == REG_SZ || type_a == REG_MULTI_SZ || type_a == REG_EXPAND_SZ) - { - *data = CopyStrToUni(data_a); - Free(data_a); - - size_a = UniStrSize(*data); - } - else - { - *data = data_a; - } - - *type = type_a; - *size = size_a; - } - - return ret; - } - - // Open the key - if (RegOpenKeyEx(MsGetRootKeyFromInt(root), keyname, 0, KEY_READ | MsRegAccessMaskFor64BitEx(force32bit, force64bit), &h) != ERROR_SUCCESS) - { - return false; - } - - valuename_w = CopyStrToUni(valuename); - - // Open up the value - *data = ZeroMalloc(*size); - ret = RegQueryValueExW(h, valuename_w, 0, type, *data, size); - - if (ret == ERROR_SUCCESS) - { - // Reading is complete - RegCloseKey(h); - Free(valuename_w); - return true; - } - - if (ret != ERROR_MORE_DATA) - { - // Strange error occurs - Free(*data); - *data = NULL; - Free(valuename_w); - RegCloseKey(h); - return false; - } - - // Get the data by re-allocating memory - *data = ReAlloc(*data, *size); - ret = RegQueryValueExW(h, valuename_w, 0, type, *data, size); - if (ret != ERROR_SUCCESS) - { - // An error has occured - Free(*data); - *data = NULL; - Free(valuename_w); - RegCloseKey(h); - } - - Free(valuename_w); - - RegCloseKey(h); - - return true; -} - -// Confirm that the specified value exists on the registry -bool MsRegIsValue(UINT root, char *keyname, char *valuename) -{ - return MsRegIsValueEx(root, keyname, valuename, false); -} -bool MsRegIsValueEx(UINT root, char *keyname, char *valuename, bool force32bit) -{ - return MsRegIsValueEx2(root, keyname, valuename, force32bit, false); -} -bool MsRegIsValueEx2(UINT root, char *keyname, char *valuename, bool force32bit, bool force64bit) -{ - HKEY h; - UINT type, size; - UINT ret; - // Validate arguments - if (keyname == NULL) - { - return false; - } - - // Open the key - if (RegOpenKeyEx(MsGetRootKeyFromInt(root), keyname, 0, KEY_READ | MsRegAccessMaskFor64BitEx(force32bit, force64bit), &h) != ERROR_SUCCESS) - { - return false; - } - - // Open up the value - size = 0; - ret = RegQueryValueEx(h, valuename, 0, &type, NULL, &size); - - if (ret == ERROR_SUCCESS || ret == ERROR_MORE_DATA) - { - RegCloseKey(h); - return true; - } - - RegCloseKey(h); - - return false; -} - -// Create a key in the registry -bool MsRegNewKeyEx2(UINT root, char *keyname, bool force32bit, bool force64bit) -{ - HKEY h; - // Validate arguments - if (keyname == NULL) - { - return false; - } - - // Confirm whether there is the key - if (MsRegIsKeyEx2(root, keyname, force32bit, force64bit)) - { - // Already exists - return true; - } - - // Create a key - if (RegCreateKeyEx(MsGetRootKeyFromInt(root), keyname, 0, NULL, REG_OPTION_NON_VOLATILE, - KEY_ALL_ACCESS | MsRegAccessMaskFor64BitEx(force32bit, force64bit), NULL, &h, NULL) != ERROR_SUCCESS) - { - // Failed - return false; - } - - RegCloseKey(h); - - return true; -} - -// Confirm the specified key exists on the registry -bool MsRegIsKey(UINT root, char *name) -{ - return MsRegIsKeyEx(root, name, false); -} -bool MsRegIsKeyEx(UINT root, char *name, bool force32bit) -{ - return MsRegIsKeyEx2(root, name, force32bit, false); -} -bool MsRegIsKeyEx2(UINT root, char *name, bool force32bit, bool force64bit) -{ - HKEY h; - // Validate arguments - if (name == NULL) - { - return false; - } - - if (RegOpenKeyEx(MsGetRootKeyFromInt(root), name, 0, KEY_READ | MsRegAccessMaskFor64BitEx(force32bit, force64bit), &h) != ERROR_SUCCESS) - { - return false; - } - - RegCloseKey(h); - - return true; -} - -// Getting root key handle -HKEY MsGetRootKeyFromInt(UINT root) -{ - switch (root) - { - case REG_CLASSES_ROOT: - return HKEY_CLASSES_ROOT; - - case REG_LOCAL_MACHINE: - return HKEY_LOCAL_MACHINE; - - case REG_CURRENT_USER: - return HKEY_CURRENT_USER; - - case REG_USERS: - return HKEY_USERS; - } - - return NULL; -} - -// Cut the executable file name from the command line string (Unicode version) -wchar_t *MsCutExeNameFromUniCommandLine(wchar_t *str) -{ - // Validate arguments - if (str == NULL) - { - return NULL; - } - - if (str[0] != L'\"') - { - UINT i = UniSearchStrEx(str, L" ", 0, true); - if (i == INFINITE) - { - return str + UniStrLen(str); - } - else - { - return str + i + 1; - } - } - else - { - str++; - while (true) - { - if ((*str) == 0) - { - return str + UniStrLen(str); - } - if ((*str) == L'\"') - { - break; - } - str++; - } - - while (true) - { - if ((*str) == 0) - { - return str + UniStrLen(str); - } - if ((*str) == L' ') - { - return str + 1; - } - str++; - } - } -} - -// Cut the executable file name from the command line string -char *MsCutExeNameFromCommandLine(char *str) -{ - // Validate arguments - if (str == NULL) - { - return NULL; - } - - if (str[0] != '\"') - { - UINT i = SearchStrEx(str, " ", 0, true); - if (i == INFINITE) - { - return str + StrLen(str); - } - else - { - return str + i + 1; - } - } - else - { - str++; - while (true) - { - if ((*str) == 0) - { - return str + StrLen(str); - } - if ((*str) == '\"') - { - break; - } - str++; - } - - while (true) - { - if ((*str) == 0) - { - return str + StrLen(str); - } - if ((*str) == ' ') - { - return str + 1; - } - str++; - } - } -} - -// Get the Process handle -void *MsGetCurrentProcess() -{ - return ms->hCurrentProcess; -} - -// Get the Process ID -UINT MsGetCurrentProcessId() -{ - return ms->CurrentProcessId; -} - -// Get the EXE file name -char *MsGetExeFileName() -{ - return ms == NULL ? "Unknown" : ms->ExeFileName; -} - -// Get the name of the directory where the EXE file is in -char *MsGetExeDirName() -{ - return ms->ExeFileDir; -} -wchar_t *MsGetExeDirNameW() -{ - return ms->ExeFileDirW; -} - -// Get the special directory name -char *MsGetSpecialDir(int id) -{ - LPITEMIDLIST t = NULL; - char tmp[MAX_PATH]; - - if (SHGetSpecialFolderLocation(NULL, id, &t) != S_OK) - { - return CopyStr(ms->ExeFileDir); - } - - if (SHGetPathFromIDList(t, tmp) == false) - { - return CopyStr(ms->ExeFileDir); - } - - Win32NukuEn(tmp, sizeof(tmp), tmp); - - return CopyStr(tmp); -} -wchar_t *MsGetSpecialDirW(int id) -{ - LPITEMIDLIST t = NULL; - wchar_t tmp[MAX_PATH]; - - if (IsNt() == false) - { - char *tmp = MsGetSpecialDir(id); - wchar_t *ret = CopyStrToUni(tmp); - - Free(tmp); - - return ret; - } - - if (SHGetSpecialFolderLocation(NULL, id, &t) != S_OK) - { - return UniCopyStr(ms->ExeFileDirW); - } - - if (SHGetPathFromIDListW(t, tmp) == false) - { - return UniCopyStr(ms->ExeFileDirW); - } - - Win32NukuEnW(tmp, sizeof(tmp), tmp); - - return UniCopyStr(tmp); -} - -// Get all the special directory -void MsGetSpecialDirs() -{ - char tmp[MAX_PATH]; - - // System32 - GetSystemDirectory(tmp, sizeof(tmp)); - Win32NukuEn(tmp, sizeof(tmp), tmp); - ms->System32Dir = CopyStr(tmp); - ms->System32DirW = CopyStrToUni(tmp); - - // The Windows directory is parent of the System32 directory - Win32GetDirFromPath(tmp, sizeof(tmp), tmp); - Win32NukuEn(tmp, sizeof(tmp), tmp); - ms->WindowsDir = CopyStr(tmp); - ms->WindowsDirW = CopyStrToUni(tmp); - - // Temp directory under the Windows directory - Format(tmp, sizeof(tmp), "%s\\Temp", ms->WindowsDir); - ms->WinTempDir = CopyStr(tmp); - ms->WinTempDirW = CopyStrToUni(tmp); - MsUniMakeDirEx(ms->WinTempDirW); - - // System drive - tmp[2] = 0; - ms->WindowsDrive = CopyStr(tmp); - ms->WindowsDriveW = CopyStrToUni(tmp); - - // Temp - GetTempPath(MAX_PATH, tmp); - Win32NukuEn(tmp, sizeof(tmp), tmp); - ms->TempDir = CopyStr(tmp); - - // Get the Temp (Unicode) - if (IsNt()) - { - wchar_t tmp_w[MAX_PATH]; - - GetTempPathW(MAX_PATH, tmp_w); - Win32NukuEnW(tmp_w, sizeof(tmp_w), tmp_w); - - ms->TempDirW = CopyUniStr(tmp_w); - } - else - { - ms->TempDirW = CopyStrToUni(tmp); - } - MakeDirExW(ms->TempDirW); - MakeDirEx(ms->TempDir); - - // Program Files - ms->ProgramFilesDir = MsGetSpecialDir(CSIDL_PROGRAM_FILES); - if (StrCmpi(ms->ProgramFilesDir, ms->ExeFileDir) == 0) - { - char tmp[MAX_PATH]; - Format(tmp, sizeof(tmp), "%s\\Program Files", ms->WindowsDrive); - - Free(ms->ProgramFilesDir); - ms->ProgramFilesDir = CopyStr(tmp); - } - - ms->ProgramFilesDirW = MsGetSpecialDirW(CSIDL_PROGRAM_FILES); - if (UniStrCmpi(ms->ProgramFilesDirW, ms->ExeFileDirW) == 0) - { - wchar_t tmp[MAX_PATH]; - UniFormat(tmp, sizeof(tmp), L"%s\\Program Files", ms->WindowsDriveW); - - Free(ms->ProgramFilesDirW); - ms->ProgramFilesDirW = UniCopyStr(tmp); - } - - // Program Files (x86) - ms->ProgramFilesDirX86 = MsGetSpecialDir(CSIDL_PROGRAM_FILESX86); - if (StrCmpi(ms->ProgramFilesDirX86, ms->ExeFileDir) == 0) - { - if (MsIs64BitWindows()) - { - char tmp[MAX_PATH]; - Format(tmp, sizeof(tmp), "%s\\Program Files (x86)", ms->WindowsDrive); - - Free(ms->ProgramFilesDirX86); - ms->ProgramFilesDirX86 = CopyStr(tmp); - } - else - { - Free(ms->ProgramFilesDirX86); - ms->ProgramFilesDirX86 = CopyStr(ms->ProgramFilesDir); - } - } - - ms->ProgramFilesDirX86W = MsGetSpecialDirW(CSIDL_PROGRAM_FILESX86); - if (UniStrCmpi(ms->ProgramFilesDirX86W, ms->ExeFileDirW) == 0) - { - if (MsIs64BitWindows()) - { - wchar_t tmp[MAX_PATH]; - UniFormat(tmp, sizeof(tmp), L"%s\\Program Files (x86)", ms->WindowsDriveW); - - Free(ms->ProgramFilesDirX86W); - ms->ProgramFilesDirX86W = UniCopyStr(tmp); - } - else - { - Free(ms->ProgramFilesDirX86W); - ms->ProgramFilesDirX86W = UniCopyStr(ms->ProgramFilesDirW); - } - } - - // Program Files (x64) - if (MsIs64BitWindows()) - { - if (Is64()) - { - ms->ProgramFilesDirX64 = CopyStr(ms->ProgramFilesDir); - ms->ProgramFilesDirX64W = CopyUniStr(ms->ProgramFilesDirW); - } - else - { - char tmpa[MAX_SIZE]; - wchar_t tmpw[MAX_SIZE]; - - ReplaceStrEx(tmpa, sizeof(tmpa), ms->ProgramFilesDir, "\\Program Files (x86)", "\\Program Files", false); - UniReplaceStrEx(tmpw, sizeof(tmpw), ms->ProgramFilesDirW, L"\\Program Files (x86)", L"\\Program Files", false); - - ms->ProgramFilesDirX64 = CopyStr(tmpa); - ms->ProgramFilesDirX64W = CopyUniStr(tmpw); - } - } - else - { - ms->ProgramFilesDirX64 = CopyStr(ms->ProgramFilesDir); - ms->ProgramFilesDirX64W = CopyUniStr(ms->ProgramFilesDirW); - } - - if (MsIsNt()) - { - // Common start menu - ms->CommonStartMenuDir = MsGetSpecialDir(CSIDL_COMMON_STARTMENU); - ms->CommonStartMenuDirW = MsGetSpecialDirW(CSIDL_COMMON_STARTMENU); - - // Common program - ms->CommonProgramsDir = MsGetSpecialDir(CSIDL_COMMON_PROGRAMS); - ms->CommonProgramsDirW = MsGetSpecialDirW(CSIDL_COMMON_PROGRAMS); - - // Common startup - ms->CommonStartupDir = MsGetSpecialDir(CSIDL_COMMON_STARTUP); - ms->CommonStartupDirW = MsGetSpecialDirW(CSIDL_COMMON_STARTUP); - - // Common application data - ms->CommonAppDataDir = MsGetSpecialDir(CSIDL_COMMON_APPDATA); - ms->CommonAppDataDirW = MsGetSpecialDirW(CSIDL_COMMON_APPDATA); - - // Common desktop - ms->CommonDesktopDir = MsGetSpecialDir(CSIDL_COMMON_DESKTOPDIRECTORY); - ms->CommonDesktopDirW = MsGetSpecialDirW(CSIDL_COMMON_DESKTOPDIRECTORY); - - // Local Settings - ms->LocalAppDataDir = MsGetSpecialDir(CSIDL_LOCAL_APPDATA); - ms->LocalAppDataDirW = MsGetSpecialDirW(CSIDL_LOCAL_APPDATA); - } - else - { - // Start menu of the individual - ms->PersonalStartMenuDir = MsGetSpecialDir(CSIDL_STARTMENU); - ms->CommonStartMenuDir = CopyStr(ms->PersonalStartMenuDir); - ms->PersonalStartMenuDirW = MsGetSpecialDirW(CSIDL_STARTMENU); - ms->CommonStartMenuDirW = CopyUniStr(ms->PersonalStartMenuDirW); - - // Program of the individual - ms->PersonalProgramsDir = MsGetSpecialDir(CSIDL_PROGRAMS); - ms->CommonProgramsDir = CopyStr(ms->PersonalProgramsDir); - ms->PersonalProgramsDirW = MsGetSpecialDirW(CSIDL_PROGRAMS); - ms->CommonProgramsDirW = CopyUniStr(ms->PersonalProgramsDirW); - - // Start-up of the individual - ms->PersonalStartupDir = MsGetSpecialDir(CSIDL_STARTUP); - ms->CommonStartupDir = CopyStr(ms->PersonalStartupDir); - ms->PersonalStartupDirW = MsGetSpecialDirW(CSIDL_STARTUP); - ms->CommonStartupDirW = CopyUniStr(ms->PersonalStartupDirW); - - // Application data of the individual - ms->PersonalAppDataDir = MsGetSpecialDir(CSIDL_APPDATA); - ms->CommonAppDataDir = CopyStr(ms->PersonalAppDataDir); - ms->PersonalAppDataDirW = MsGetSpecialDirW(CSIDL_APPDATA); - ms->CommonAppDataDirW = CopyUniStr(ms->PersonalAppDataDirW); - - // Desktops of the individual - ms->PersonalDesktopDir = MsGetSpecialDir(CSIDL_DESKTOP); - ms->CommonDesktopDir = CopyStr(ms->PersonalDesktopDir); - ms->PersonalDesktopDirW = MsGetSpecialDirW(CSIDL_DESKTOP); - ms->CommonDesktopDirW = CopyUniStr(ms->PersonalDesktopDirW); - - // Local Settings - ms->LocalAppDataDir = CopyStr(ms->PersonalAppDataDir); - ms->LocalAppDataDirW = CopyUniStr(ms->PersonalAppDataDirW); - } -} - -// Check whether the current user is a Administrators -bool MsCheckIsAdmin() -{ - UCHAR test_bit[32]; - UCHAR tmp[32]; - UCHAR exe_hash[SHA1_SIZE]; - char *name_tag = "Vpn_Check_Admin_Key_%u"; - DWORD type; - DWORD size; - char name[MAX_SIZE]; - - Sha1(exe_hash, MsGetExeFileNameW(), UniStrLen(MsGetExeFileNameW())); - - Format(name, sizeof(name), name_tag, *((UINT *)exe_hash)); - - Rand(test_bit, sizeof(test_bit)); - - if (RegSetValueEx(HKEY_LOCAL_MACHINE, name, 0, REG_BINARY, test_bit, sizeof(test_bit)) != ERROR_SUCCESS) - { - return false; - } - - size = sizeof(tmp); - if (RegQueryValueEx(HKEY_LOCAL_MACHINE, name, 0, &type, tmp, &size) != ERROR_SUCCESS) - { - RegDeleteValue(HKEY_LOCAL_MACHINE, name); - return false; - } - - RegDeleteValue(HKEY_LOCAL_MACHINE, name); - - if (Cmp(test_bit, tmp, 32) != 0) - { - return false; - } - - return true; -} - -// Library initialization -void MsInit() -{ - char *str_ansi; - wchar_t *str_unicode; - OSVERSIONINFO os; - char tmp[MAX_SIZE]; - UINT size; - if (ms != NULL) - { - // Already initialized - return; - } - - suspend_handler_singleton = NewCounter(); - vlan_card_counter = NewCounter(); - vlan_card_should_stop_flag = false; - - ms = ZeroMalloc(sizeof(MS)); - - // Getting instance handle - ms->hInst = GetModuleHandle(NULL); - - // Get the KERNEL32.DLL - ms->hKernel32 = LoadLibrary("kernel32.dll"); - - // Get a command line string from the OS - str_ansi = CopyStr(GetCommandLineA()); - Trim(str_ansi); - str_unicode = UniCopyStr(GetCommandLineW()); - UniTrim(str_unicode); - - SetCommandLineStr(MsCutExeNameFromCommandLine(str_ansi)); - SetCommandLineUniStr(MsCutExeNameFromUniCommandLine(str_unicode)); - - Free(str_unicode); - Free(str_ansi); - - // Get the version of the OS - Zero(&os, sizeof(os)); - os.dwOSVersionInfoSize = sizeof(os); - GetVersionEx(&os); - - if (os.dwPlatformId == VER_PLATFORM_WIN32_NT) - { - // NT series - ms->IsNt = true; - - ms->nt = MsLoadNtApiFunctions(); - - if (ms->nt == NULL) - { - ms->IsNt = false; - ms->IsAdmin = true; - } - else - { - // Whether I am an Administrators - ms->IsAdmin = MsCheckIsAdmin(); - } - } - else - { - // In 9x system: Impersonate a Administrators always - ms->IsAdmin = true; - } - - if (GetProcAddress(ms->hKernel32, "wine_get_unix_file_name") != NULL) - { - ms->IsWine = true; - } - - // Get information about the current process - ms->hCurrentProcess = GetCurrentProcess(); - ms->CurrentProcessId = GetCurrentProcessId(); - - // Get the EXE file name - GetModuleFileName(NULL, tmp, sizeof(tmp)); - ms->ExeFileName = CopyStr(tmp); - Win32GetDirFromPath(tmp, sizeof(tmp), tmp); - ms->ExeFileDir = CopyStr(tmp); - - // Get the EXE file name (Unicode) - if (IsNt()) - { - wchar_t tmp_w[MAX_PATH]; - - GetModuleFileNameW(NULL, tmp_w, sizeof(tmp_w)); - ms->ExeFileNameW = CopyUniStr(tmp_w); - - Win32GetDirFromPathW(tmp_w, sizeof(tmp_w), tmp_w); - ms->ExeFileDirW = CopyUniStr(tmp_w); - } - else - { - ms->ExeFileNameW = CopyStrToUni(ms->ExeFileName); - ms->ExeFileDirW = CopyStrToUni(ms->ExeFileDir); - } - - // Get the special directories - MsGetSpecialDirs(); - - // Initialize the temporary directory - MsInitTempDir(); - - // Get the user name - size = sizeof(tmp); - GetUserName(tmp, &size); - ms->UserName = CopyStr(tmp); - - // Get the user name (Unicode) - if (IsNt()) - { - wchar_t tmp_w[MAX_PATH]; - - size = sizeof(tmp_w); - - GetUserNameW(tmp_w, &size); - ms->UserNameW = CopyUniStr(tmp_w); - } - else - { - ms->UserNameW = CopyStrToUni(ms->UserName); - } - - // Get the full user name - if (ms->nt != NULL && ms->nt->GetUserNameExA != NULL) - { - wchar_t tmp_w[MAX_PATH]; - - size = sizeof(tmp); - if (ms->nt->GetUserNameExA(NameSamCompatible, tmp, &size)) - { - ms->UserNameEx = CopyStr(tmp); - } - - size = sizeof(tmp_w); - if (ms->nt->GetUserNameExW(NameSamCompatible, tmp_w, &size)) - { - ms->UserNameExW = CopyUniStr(tmp_w); - } - } - - if (ms->UserNameEx == NULL) - { - ms->UserNameEx = CopyStr(ms->UserName); - } - if (ms->UserNameExW == NULL) - { - ms->UserNameExW = CopyUniStr(ms->UserNameW); - } - - // Initialization of the adapter list - MsInitAdapterListModule(); - - // Initialization of minidump base file name - if (true) - { - wchar_t tmp[MAX_PATH]; - if (MsIsAdmin()) - { - CombinePathW(tmp, sizeof(tmp), ms->ExeFileDirW, L"vpn_debug\\dump"); - } - else - { - CombinePathW(tmp, sizeof(tmp), ms->TempDirW, L"vpn_debug\\dump"); - } - ms->MinidumpBaseFileNameW = CopyUniStr(tmp); - } - - MsSetEnableMinidump(true); - - if (MsIsNt()) - { - if (ms->nt->MiniDumpWriteDump != NULL) - { - SetUnhandledExceptionFilter(MsExceptionHandler); - } - } - - // Open a LSA handle - hLsa = NULL; - lsa_package_id = 0; - if (MsIsNt()) - { - MsEnablePrivilege(SE_TCB_NAME, true); - - if (ms->nt->AllocateLocallyUniqueId != NULL && - ms->nt->LsaConnectUntrusted != NULL && - ms->nt->LsaLookupAuthenticationPackage != NULL && - ms->nt->LsaLogonUser != NULL && - ms->nt->LsaDeregisterLogonProcess != NULL && - ms->nt->LsaFreeReturnBuffer != NULL) - { - HANDLE h = NULL; - NTSTATUS ret = ms->nt->LsaConnectUntrusted(&h); - - if (ret == 0) - { - LSA_STRING pkg_name; - ULONG ul = 0; - - Zero(&pkg_name, sizeof(pkg_name)); - pkg_name.Buffer = MSV1_0_PACKAGE_NAME; - pkg_name.Length = pkg_name.MaximumLength = StrLen(MSV1_0_PACKAGE_NAME); - - ret = ms->nt->LsaLookupAuthenticationPackage(h, &pkg_name, &ul); - - if (ret == 0) - { - Zero(&lsa_token_source, sizeof(lsa_token_source)); - - ms->nt->AllocateLocallyUniqueId(&lsa_token_source.SourceIdentifier); - Copy(lsa_token_source.SourceName, "SE-VPN ", 8); - - lsa_package_id = ul; - hLsa = h; - } - else - { - ms->nt->LsaDeregisterLogonProcess(h); - } - } - } - } - - // Read the msi.dll - if (hMsi == NULL) - { - hMsi = LoadLibrary("msi.dll"); - - if (hMsi != NULL) - { - _MsiConfigureProductW = - (UINT (__stdcall *)(LPCWSTR,int,INSTALLSTATE)) GetProcAddress(hMsi, "MsiConfigureProductW"); - _MsiGetProductInfoW = - (UINT (__stdcall *)(LPCWSTR,LPCWSTR,LPWSTR,LPDWORD)) GetProcAddress(hMsi, "MsiGetProductInfoW"); - _MsiSetInternalUI = - (INSTALLUILEVEL (__stdcall *)(INSTALLUILEVEL,HWND *)) GetProcAddress(hMsi, "MsiSetInternalUI"); - _MsiLocateComponentW = - (INSTALLSTATE (__stdcall *)(LPCWSTR,LPWSTR,LPDWORD)) GetProcAddress(hMsi, "MsiLocateComponentW"); - } - } - - // Lock created - vlan_lock = NewLock(); -} - -// Uninstall the MSI product -bool MsMsiUninstall(char *product_code, HWND hWnd, bool *reboot_required) -{ - wchar_t *product_code_w; - bool ret = false; - INSTALLUILEVEL old_level; - HWND old_hwnd; - UINT r; - // Validate arguments - if (product_code == NULL) - { - return false; - } - if (_MsiSetInternalUI == NULL || _MsiConfigureProductW == NULL) - { - return false; - } - - if (reboot_required != NULL) - { - *reboot_required = false; - } - - product_code_w = CopyStrToUni(product_code); - - old_hwnd = hWnd; - old_level = _MsiSetInternalUI(INSTALLUILEVEL_PROGRESSONLY, &old_hwnd); - - r = _MsiConfigureProductW(product_code_w, INSTALLLEVEL_DEFAULT, INSTALLSTATE_ABSENT); - - if (r == ERROR_SUCCESS || r == ERROR_SUCCESS_REBOOT_INITIATED || r == ERROR_SUCCESS_REBOOT_REQUIRED) - { - ret = true; - - if (r == ERROR_SUCCESS_REBOOT_INITIATED || r == ERROR_SUCCESS_REBOOT_REQUIRED) - { - if (reboot_required != NULL) - { - *reboot_required = true; - } - } - } - - if (old_level != INSTALLUILEVEL_NOCHANGE) - { - _MsiSetInternalUI(old_level, &old_hwnd); - } - - Free(product_code_w); - - return ret; -} - -// Get the installation directory of the MSI component -bool MsGetMsiInstalledDir(char *component_code, wchar_t *dir, UINT dir_size) -{ - wchar_t *component_code_w; - bool ret = false; - wchar_t tmp[MAX_SIZE]; - UINT sz = sizeof(tmp) / sizeof(wchar_t); - // Validate arguments - if (component_code == NULL || dir == NULL) - { - return false; - } - if (_MsiGetProductInfoW == NULL) - { - return false; - } - - component_code_w = CopyStrToUni(component_code); - - Zero(tmp, sizeof(tmp)); - - if (_MsiLocateComponentW(component_code_w, tmp, &sz) == INSTALLSTATE_LOCAL) - { - if (UniIsEmptyStr(tmp) == false) - { - GetDirNameFromFilePathW(dir, dir_size, tmp); - ret = true; - } - } - - Free(component_code_w); - - return ret; -} - -// Determine whether minidump is enabled -bool MsIsMinidumpEnabled() -{ - return ms->MiniDumpEnabled; -} - -// Determine whether to create a minidump -void MsSetEnableMinidump(bool enabled) -{ - ms->MiniDumpEnabled = enabled; -} - -// Output the minidump -void MsWriteMinidump(wchar_t *filename, void *ex) -{ - wchar_t tmp[MAX_PATH]; - wchar_t dir[MAX_PATH]; - HANDLE h; - MINIDUMP_EXCEPTION_INFORMATION info; - struct _EXCEPTION_POINTERS *exp = (struct _EXCEPTION_POINTERS *)ex; - - if (filename != NULL) - { - UniStrCpy(tmp, sizeof(tmp), filename); - } - else - { - SYSTEMTIME tm; - - Zero(&tm, sizeof(tm)); - GetLocalTime(&tm); - - UniFormat(tmp, sizeof(tmp), L"%s_%04u%02u%02u_%02u%02u%02u.dmp", - ms->MinidumpBaseFileNameW, - tm.wYear, tm.wMonth, tm.wDay, tm.wHour, tm.wMinute, tm.wSecond); - } - - GetDirNameFromFilePathW(dir, sizeof(dir), tmp); - - CreateDirectoryW(dir, NULL); - - Zero(&info, sizeof(info)); - - if (exp != NULL) - { - info.ThreadId = GetCurrentThreadId(); - info.ExceptionPointers = exp; - info.ClientPointers = true; - } - - h = CreateFileW(tmp, GENERIC_READ | GENERIC_WRITE, - FILE_SHARE_READ, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, - NULL); - if (h != INVALID_HANDLE_VALUE) - { - ms->nt->MiniDumpWriteDump(ms->hCurrentProcess, ms->CurrentProcessId, - h, - MiniDumpNormal | MiniDumpWithFullMemory | MiniDumpWithDataSegs | - MiniDumpWithHandleData - , - info.ThreadId == 0 ? NULL : &info, NULL, NULL); - - FlushFileBuffers(h); - CloseHandle(h); - } -} - -// Exception handler -LONG CALLBACK MsExceptionHandler(struct _EXCEPTION_POINTERS *ExceptionInfo) -{ - if (ms->MiniDumpEnabled) - { - MsWriteMinidump(NULL, ExceptionInfo); - } - - return EXCEPTION_CONTINUE_SEARCH; -} - -// Release of the library -void MsFree() -{ - if (ms == NULL) - { - // Uninitialized - return; - } - - // Release the LSA - if (hLsa != NULL) - { - ms->nt->LsaDeregisterLogonProcess(hLsa); - - hLsa = NULL; - } - - // Release of the adapter list - MsFreeAdapterListModule(); - - // Release of the temporary directory - MsFreeTempDir(); - - if (ms->IsNt) - { - // Release of NT series API - MsFreeNtApiFunctions(ms->nt); - } - - // Memory release - // ANSI - Free(ms->WindowsDir); - Free(ms->System32Dir); - Free(ms->TempDir); - Free(ms->WinTempDir); - Free(ms->WindowsDrive); - Free(ms->ProgramFilesDir); - Free(ms->CommonStartMenuDir); - Free(ms->CommonProgramsDir); - Free(ms->CommonStartupDir); - Free(ms->CommonAppDataDir); - Free(ms->CommonDesktopDir); - Free(ms->PersonalStartMenuDir); - Free(ms->PersonalProgramsDir); - Free(ms->PersonalStartupDir); - Free(ms->PersonalAppDataDir); - Free(ms->PersonalDesktopDir); - Free(ms->MyDocumentsDir); - Free(ms->ExeFileDir); - Free(ms->ExeFileName); - Free(ms->UserName); - Free(ms->UserNameEx); - Free(ms->LocalAppDataDir); - Free(ms->ProgramFilesDirX86); - Free(ms->ProgramFilesDirX64); - // Unicode - Free(ms->WindowsDirW); - Free(ms->System32DirW); - Free(ms->TempDirW); - Free(ms->WinTempDirW); - Free(ms->WindowsDriveW); - Free(ms->ProgramFilesDirW); - Free(ms->CommonStartMenuDirW); - Free(ms->CommonProgramsDirW); - Free(ms->CommonStartupDirW); - Free(ms->CommonAppDataDirW); - Free(ms->CommonDesktopDirW); - Free(ms->PersonalStartMenuDirW); - Free(ms->PersonalProgramsDirW); - Free(ms->PersonalStartupDirW); - Free(ms->PersonalAppDataDirW); - Free(ms->PersonalDesktopDirW); - Free(ms->MyDocumentsDirW); - Free(ms->ExeFileDirW); - Free(ms->ExeFileNameW); - Free(ms->UserNameW); - Free(ms->UserNameExW); - Free(ms->LocalAppDataDirW); - Free(ms->MinidumpBaseFileNameW); - Free(ms->ProgramFilesDirX86W); - Free(ms->ProgramFilesDirX64W); - - Free(ms); - ms = NULL; - - // Delete the lock - DeleteLock(vlan_lock); - vlan_lock = NULL; - - DeleteCounter(suspend_handler_singleton); - suspend_handler_singleton = NULL; - - DeleteCounter(vlan_card_counter); - vlan_card_counter = NULL; - vlan_card_should_stop_flag = false; -} - -// Directory acquisition related -char *MsGetWindowsDir() -{ - return ms->WindowsDir; -} -wchar_t *MsGetWindowsDirW() -{ - return ms->WindowsDirW; -} -char *MsGetSystem32Dir() -{ - return ms->System32Dir; -} -char *MsGetTempDir() -{ - return ms->TempDir; -} -char *MsGetProgramFilesDir() -{ - return ms->ProgramFilesDir; -} -char *MsGetCommonStartupDir() -{ - return ms->CommonStartupDir; -} -char *MsGetMyTempDir() -{ - return ms->MyTempDir; -} - -wchar_t *MsGetExeFileNameW() -{ - return ms == NULL ? L"Unknown" : ms->ExeFileNameW; -} -wchar_t *MsGetExeFileDirW() -{ - return ms->ExeFileDirW; -} -wchar_t *MsGetSystem32DirW() -{ - return ms->System32DirW; -} -wchar_t *MsGetTempDirW() -{ - return ms->TempDirW; -} -wchar_t *MsGetCommonStartMenuDirW() -{ - return ms->CommonStartMenuDirW; -} -wchar_t *MsGetCommonProgramsDirW() -{ - return ms->CommonProgramsDirW; -} -wchar_t *MsGetProgramFilesDirX64W() -{ - return ms->ProgramFilesDirX64W; -} -wchar_t *MsGetCommonStartupDirW() -{ - return ms->CommonStartupDirW; -} -wchar_t *MsGetCommonDesktopDirW() -{ - return ms->CommonDesktopDirW; -} -wchar_t *MsGetPersonalStartMenuDirW() -{ - if (ms->PersonalStartMenuDirW == NULL) - { - ms->PersonalStartMenuDirW = MsGetSpecialDirW(CSIDL_STARTMENU); - } - - return ms->PersonalStartMenuDirW; -} -wchar_t *MsGetPersonalProgramsDirW() -{ - if (ms->PersonalProgramsDirW == NULL) - { - ms->PersonalProgramsDirW = MsGetSpecialDirW(CSIDL_PROGRAMS); - } - - return ms->PersonalProgramsDirW; -} -wchar_t *MsGetPersonalStartupDirW() -{ - if (ms->PersonalStartupDirW == NULL) - { - ms->PersonalStartupDirW = MsGetSpecialDirW(CSIDL_STARTUP); - } - - return ms->PersonalStartupDirW; -} -wchar_t *MsGetPersonalAppDataDirW() -{ - if (ms->PersonalAppDataDirW == NULL) - { - ms->PersonalAppDataDirW = MsGetSpecialDirW(CSIDL_APPDATA); - } - - return ms->PersonalAppDataDirW; -} -wchar_t *MsGetPersonalDesktopDirW() -{ - if (ms->PersonalDesktopDirW == NULL) - { - ms->PersonalDesktopDirW = MsGetSpecialDirW(CSIDL_DESKTOP); - } - - return ms->PersonalDesktopDirW; -} -wchar_t *MsGetMyTempDirW() -{ - return ms->MyTempDirW; -} -wchar_t *MsGetUserNameW() -{ - return ms->UserNameW; -} - -#endif // WIN32 - +// SoftEther VPN Source Code - Developer Edition Master Branch +// Mayaqua Kernel + + +// Microsoft.c +// For Microsoft Windows code +// (not compiled on non-Windows environments) + +#include + +#ifdef WIN32 + +#define MICROSOFT_C + +typedef enum _PNP_VETO_TYPE { + PNP_VetoTypeUnknown, // Name is unspecified + PNP_VetoLegacyDevice, // Name is an Instance Path + PNP_VetoPendingClose, // Name is an Instance Path + PNP_VetoWindowsApp, // Name is a Module + PNP_VetoWindowsService, // Name is a Service + PNP_VetoOutstandingOpen, // Name is an Instance Path + PNP_VetoDevice, // Name is an Instance Path + PNP_VetoDriver, // Name is a Driver Service Name + PNP_VetoIllegalDeviceRequest, // Name is an Instance Path + PNP_VetoInsufficientPower, // Name is unspecified + PNP_VetoNonDisableable, // Name is an Instance Path + PNP_VetoLegacyDriver, // Name is a Service + PNP_VetoInsufficientRights // Name is unspecified +} PNP_VETO_TYPE, *PPNP_VETO_TYPE; + +#define _WIN32_IE 0x0600 +#define _WIN32_WINNT 0x0502 +#define WINVER 0x0502 +#define SECURITY_WIN32 +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +static MS *ms = NULL; + +// Function prototype +UINT MsgBox(HWND hWnd, UINT flag, wchar_t *msg); +UINT MsgBoxEx(HWND hWnd, UINT flag, wchar_t *msg, ...); +void ShowTcpIpConfigUtil(HWND hWnd, bool util_mode); +void CmTraffic(HWND hWnd); +void CnStart(); +void InitCedar(); +void FreeCedar(); +void InitWinUi(wchar_t *software_name, char *font, UINT fontsize); +void FreeWinUi(); + +// Global variable +UINT64 ms_uint64_1 = 0; + +// Adapter list related +static LOCK *lock_adapter_list = NULL; +static MS_ADAPTER_LIST *last_adapter_list = NULL; + +// Service related +static SERVICE_STATUS_HANDLE ssh = NULL; +static SERVICE_STATUS status = { 0 }; +static HANDLE service_stop_event = NULL; +static BOOL (WINAPI *_StartServiceCtrlDispatcher)(CONST LPSERVICE_TABLE_ENTRY) = NULL; +static SERVICE_STATUS_HANDLE (WINAPI *_RegisterServiceCtrlHandler)(LPCTSTR, LPHANDLER_FUNCTION) = NULL; +static BOOL (WINAPI *_SetServiceStatus)(SERVICE_STATUS_HANDLE, LPSERVICE_STATUS) = NULL; +static char g_service_name[MAX_SIZE]; +static SERVICE_FUNCTION *g_start, *g_stop; +static bool exiting = false; +static bool wnd_end; +static bool is_usermode = false; +static bool wts_is_locked_flag = false; +static HICON tray_icon; +static NOTIFYICONDATA nid; +static NOTIFYICONDATAW nid_nt; +static bool service_for_9x_mode = false; +static THREAD *service_stopper_thread = NULL; +static bool tray_inited = false; +static HWND hWndUsermode = NULL; +static HANDLE hLsa = NULL; +static ULONG lsa_package_id = 0; +static TOKEN_SOURCE lsa_token_source; +static LOCK *vlan_lock = NULL; +static COUNTER *suspend_handler_singleton = NULL; +static COUNTER *vlan_card_counter = NULL; +static volatile BOOL vlan_card_should_stop_flag = false; +static volatile BOOL vlan_is_in_suspend_mode = false; +static volatile UINT64 vlan_suspend_mode_begin_tick = 0; + +// msi.dll +static HINSTANCE hMsi = NULL; +static UINT (WINAPI *_MsiGetProductInfoW)(LPCWSTR, LPCWSTR, LPWSTR, LPDWORD) = NULL; +static UINT (WINAPI *_MsiConfigureProductW)(LPCWSTR, int, INSTALLSTATE) = NULL; +static INSTALLUILEVEL (WINAPI *_MsiSetInternalUI)(INSTALLUILEVEL, HWND *) = NULL; +static INSTALLSTATE (WINAPI *_MsiLocateComponentW)(LPCWSTR, LPWSTR, LPDWORD) = NULL; + +#define SE_GROUP_INTEGRITY (0x00000020L) + +typedef enum _TOKEN_INFORMATION_CLASS_VISTA +{ + VistaTokenUser = 1, + VistaTokenGroups, + VistaTokenPrivileges, + VistaTokenOwner, + VistaTokenPrimaryGroup, + VistaTokenDefaultDacl, + VistaTokenSource, + VistaTokenType, + VistaTokenImpersonationLevel, + VistaTokenStatistics, + VistaTokenRestrictedSids, + VistaTokenSessionId, + VistaTokenGroupsAndPrivileges, + VistaTokenSessionReference, + VistaTokenSandBoxInert, + VistaTokenAuditPolicy, + VistaTokenOrigin, + VistaTokenElevationType, + VistaTokenLinkedToken, + VistaTokenElevation, + VistaTokenHasRestrictions, + VistaTokenAccessInformation, + VistaTokenVirtualizationAllowed, + VistaTokenVirtualizationEnabled, + VistaTokenIntegrityLevel, + VistaTokenUIAccess, + VistaTokenMandatoryPolicy, + VistaTokenLogonSid, + VistaMaxTokenInfoClass +} TOKEN_INFORMATION_CLASS_VISTA, *PTOKEN_INFORMATION_CLASS_VISTA; + +typedef struct MS_MSCHAPV2_PARAMS +{ + wchar_t Username[MAX_SIZE]; + wchar_t Workstation[MAX_SIZE]; + wchar_t Domain[MAX_SIZE]; + UCHAR ClientResponse24[24]; + UCHAR ResponseBuffer[MAX_SIZE]; +} MS_MSCHAPV2_PARAMS; + +// The function which should be called once as soon as possible after the process is started +void MsInitProcessCallOnce() +{ + // Mitigate the DLL injection attack + char system_dir[MAX_PATH]; + char kernel32_path[MAX_PATH]; + UINT len; + HINSTANCE hKernel32; + + // Get the full path of kernel32.dll + memset(system_dir, 0, sizeof(system_dir)); + GetSystemDirectory(system_dir, sizeof(system_dir)); + len = lstrlenA(system_dir); + if (system_dir[len] == '\\') + { + system_dir[len] = 0; + } + wsprintfA(kernel32_path, "%s\\kernel32.dll", system_dir); + + // Load kernel32.dll + hKernel32 = LoadLibraryA(kernel32_path); + if (hKernel32 != NULL) + { + BOOL (WINAPI *_SetDllDirectoryA)(LPCTSTR); + + _SetDllDirectoryA = (BOOL (WINAPI *)(LPCTSTR)) + GetProcAddress(hKernel32, "SetDllDirectoryA"); + + if (_SetDllDirectoryA != NULL) + { + _SetDllDirectoryA(""); + } + + FreeLibrary(hKernel32); + } +} + +// Collect the information of the VPN software +bool MsCollectVpnInfo(BUF *bat, char *tmpdir, char *svc_name, wchar_t *config_name, wchar_t *logdir_name) +{ + wchar_t *inst_dir; + char subkey[MAX_PATH]; + bool ret = false; + wchar_t tmpdir_w[MAX_PATH]; + // Validate arguments + if (bat == NULL || tmpdir == NULL || svc_name == NULL || config_name == NULL || logdir_name == NULL) + { + return false; + } + + StrToUni(tmpdir_w, sizeof(tmpdir_w), tmpdir); + + Format(subkey, sizeof(subkey), "SOFTWARE\\" GC_REG_COMPANY_NAME "\\Setup Wizard Settings\\%s", svc_name); + inst_dir = MsRegReadStrEx2W(REG_LOCAL_MACHINE, subkey, "InstalledDir", false, true); + if (UniIsEmptyStr(inst_dir) == false) + { + wchar_t config_src[MAX_PATH]; + wchar_t config_dst[MAX_PATH]; + wchar_t log_dir[MAX_PATH]; + DIRLIST *dir; + UINT64 max_dt_file = 0; + + // config file + CombinePathW(config_src, sizeof(config_src), inst_dir, config_name); + UniFormat(config_dst, sizeof(config_dst), L"%s\\%S_%s", tmpdir_w, svc_name, config_name); + ret = FileCopyExW(config_src, config_dst, false); + + // Log file + CombinePathW(log_dir, sizeof(log_dir), inst_dir, logdir_name); + + dir = EnumDirW(log_dir); + + if (dir != NULL) + { + UINT i; + DIRENT *latest_log = NULL; + + for (i = 0;i < dir->NumFiles;i++) + { + DIRENT *e = dir->File[i]; + + // Get the most recent file + if (max_dt_file <= e->UpdateDate) + { + max_dt_file = e->UpdateDate; + + latest_log = e; + } + } + + if (latest_log != NULL) + { + wchar_t fullpath[MAX_SIZE]; + IO *f; + + // Open the log file + CombinePathW(fullpath, sizeof(fullpath), log_dir, latest_log->FileNameW); + f = FileOpenExW(fullpath, false, false); + + if (f != NULL) + { + UINT size = FileSize(f); + + if (size >= 1) + { + UINT copy_size = 1024 * 1024; + UINT seek_size = 0; + UCHAR *buf; + + if (copy_size < size) + { + seek_size = size - copy_size; + } + else + { + copy_size = size; + } + + FileSeek(f, 0, seek_size); + + buf = Malloc(copy_size + 3); + buf[0] = 0xEF; + buf[1] = 0xBB; + buf[2] = 0xBF; + if (FileRead(f, buf + 3, copy_size)) + { + char log_dst_filename[MAX_PATH]; + + Format(log_dst_filename, sizeof(log_dst_filename), "%s\\lastlog_%s_%s", + tmpdir, svc_name, latest_log->FileName); + + SaveFile(log_dst_filename, buf, copy_size + 3); + } + + Free(buf); + } + + FileClose(f); + } + } + + FreeDir(dir); + } + } + Free(inst_dir); + + return ret; +} + +// Save the system information +bool MsSaveSystemInfo(wchar_t *dst_filename) +{ + char tmpdir[MAX_PATH]; + UCHAR rand_data[SHA1_SIZE]; + char rand_str[MAX_SIZE]; + char filename_bat[MAX_PATH]; + BUF *bat; + char tmp[MAX_PATH]; + char cmd[MAX_PATH]; + char cmd_arg[MAX_PATH]; + bool ret = false; + DIRLIST *dir; + UINT i; + // Validate arguments + if (dst_filename == NULL) + { + return false; + } + if (MsIsAdmin() == false || MsIsWin2000OrGreater() == false) + { + return false; + } + + Rand(rand_data, sizeof(rand_data)); + BinToStr(rand_str, sizeof(rand_str), rand_data, 4); + + // Create a temporary directory + Format(tmpdir, sizeof(tmpdir), "%s\\Temp\\se_support_%s", MsGetWindowsDir(), rand_str); + MakeDirEx(tmpdir); + + // Create a batch file + CombinePath(filename_bat, sizeof(filename_bat), tmpdir, "make_system_info.cmd"); + bat = NewBuf(); + + Format(tmp, sizeof(tmp), "systeminfo > %s\\SystemInfo.txt", tmpdir); + WriteBufLine(bat, tmp); + + Format(tmp, sizeof(tmp), "ipconfig > %s\\ipconfig.txt", tmpdir); + WriteBufLine(bat, tmp); + + Format(tmp, sizeof(tmp), "netsh dump > %s\\netsh.txt", tmpdir); + WriteBufLine(bat, tmp); + + Format(tmp, sizeof(tmp), "route print > %s\\route.txt", tmpdir); + WriteBufLine(bat, tmp); + + Format(tmp, sizeof(tmp), "netstat -nab > %s\\netstat_nab.txt", tmpdir); + WriteBufLine(bat, tmp); + + Format(tmp, sizeof(tmp), "netstat -nao > %s\\netstat_nao.txt", tmpdir); + WriteBufLine(bat, tmp); + + Format(tmp, sizeof(tmp), "netstat -na > %s\\netstat_na.txt", tmpdir); + WriteBufLine(bat, tmp); + + Format(tmp, sizeof(tmp), "netstat -fab > %s\\netstat_fab.txt", tmpdir); + WriteBufLine(bat, tmp); + + Format(tmp, sizeof(tmp), "netstat -fao > %s\\netstat_fao.txt", tmpdir); + WriteBufLine(bat, tmp); + + Format(tmp, sizeof(tmp), "netstat -fa > %s\\netstat_fa.txt", tmpdir); + WriteBufLine(bat, tmp); + + Format(tmp, sizeof(tmp), "netstat -ab > %s\\netstat_ab.txt", tmpdir); + WriteBufLine(bat, tmp); + + Format(tmp, sizeof(tmp), "netstat -ao > %s\\netstat_ao.txt", tmpdir); + WriteBufLine(bat, tmp); + + Format(tmp, sizeof(tmp), "netstat -a > %s\\netstat_a.txt", tmpdir); + WriteBufLine(bat, tmp); + + Format(tmp, sizeof(tmp), "\"%s\\Common Files\\Microsoft Shared\\MSInfo\\msinfo32.exe\" /report %s\\SystemInfo.txt", MsGetProgramFilesDir(), tmpdir); + WriteBufLine(bat, tmp); + + // Collect the information of the VPN software + MsCollectVpnInfo(bat, tmpdir, "vpnclient", L"vpn_client.config", L"client_log"); + MsCollectVpnInfo(bat, tmpdir, "vpnserver", L"vpn_server.config", L"server_log"); + MsCollectVpnInfo(bat, tmpdir, "vpnbridge", L"vpn_bridge.config", L"server_log"); + + MsCollectVpnInfo(bat, tmpdir, "sevpnclient", L"vpn_client.config", L"client_log"); + MsCollectVpnInfo(bat, tmpdir, "sevpnserver", L"vpn_server.config", L"server_log"); + MsCollectVpnInfo(bat, tmpdir, "sevpnbridge", L"vpn_bridge.config", L"server_log"); + + WriteBufLine(bat, ""); + + DumpBuf(bat, filename_bat); + + FreeBuf(bat); + + // Run the batch file + CombinePath(cmd, sizeof(cmd), MsGetSystem32Dir(), "cmd.exe"); + Format(cmd_arg, sizeof(cmd_arg), "/C %s", filename_bat); + if (Win32Run(cmd, cmd_arg, false, true)) + { + dir = EnumDir(tmpdir); + if (dir != NULL) + { + ZIP_PACKER *zip; + zip = NewZipPacker(); + + for (i = 0;i < dir->NumFiles;i++) + { + char *name = dir->File[i]->FileName; + char full[MAX_PATH]; + + CombinePath(full, sizeof(full), tmpdir, name); + + ZipAddRealFile(zip, name, SystemTime64(), 0, full); + } + FreeDir(dir); + + ret = ZipWriteW(zip, dst_filename); + FreeZipPacker(zip); + } + } + + // Delete the temporary directory + dir = EnumDir(tmpdir); + if (dir != NULL) + { + for (i = 0;i < dir->NumFiles;i++) + { + char *name = dir->File[i]->FileName; + char full[MAX_PATH]; + + CombinePath(full, sizeof(full), tmpdir, name); + + if (EndWith(full, ".txt") || EndWith(full, ".cmd") || EndWith(full, ".config") || EndWith(full, ".log")) + { + FileDelete(full); + } + } + FreeDir(dir); + } + DeleteDir(tmpdir); + + return ret; +} + +// Determine whether this is running in a VM +bool MsIsInVmMain() +{ + char *bat_data = "On Error Resume Next\r\n\r\nDim str\r\n\r\nSet wmi_svc = GetObject(\"winmgmts:{impersonationLevel=impersonate}!\\\\.\\root\\cimv2\")\r\n\r\nSet items = wmi_svc.ExecQuery(\"Select * from Win32_BaseBoard\")\r\n\r\nFor Each item in items\r\n str = str & item.Manufacturer\r\nNext\r\n\r\nSet items = Nothing\r\n\r\nSet items = wmi_svc.ExecQuery(\"Select * from Win32_ComputerSystem\")\r\n\r\nFor Each item in items\r\n str = str & item.Manufacturer\r\nNext\r\n\r\nSet items = Nothing\r\n\r\nSet wmi_svc = Nothing\r\n\r\nstr = LCase(str)\r\n\r\nDim ret\r\n\r\nret = 0\r\n\r\nif InStr(str, \"microsoft corporation\") > 0 then\r\n ret = 1\r\nend if\r\n\r\nif InStr(str, \"vmware\") > 0 then\r\n ret = 1\r\nend if\r\n\r\nif InStr(str, \"virtualbox\") > 0 then\r\n ret = 1\r\nend if\r\n\r\nif InStr(str, \"virtualpc\") > 0 then\r\n ret = 1\r\nend if\r\n\r\nif InStr(str, \"xen\") > 0 then\r\n ret = 1\r\nend if\r\n\r\nif InStr(str, \"hvm\") > 0 then\r\n ret = 1\r\nend if\r\n\r\nif InStr(str, \"domu\") > 0 then\r\n ret = 1\r\nend if\r\n\r\nif InStr(str, \"kvm\") > 0 then\r\n ret = 1\r\nend if\r\n\r\nif InStr(str, \"oracle vm\") > 0 then\r\n ret = 1\r\nend if\r\n\r\nif InStr(str, \"qemu\") > 0 then\r\n ret = 1\r\nend if\r\n\r\nif InStr(str, \"parallels\") > 0 then\r\n ret = 1\r\nend if\r\n\r\nif InStr(str, \"xvm\") > 0 then\r\n ret = 1\r\nend if\r\n\r\nif InStr(str, \"virtual\") > 0 then\r\n ret = 1\r\nend if\r\n\r\nif InStr(str, \"bochs\") > 0 then\r\n ret = 1\r\nend if\r\n\r\nwscript.quit ret\r\n\r\n"; + wchar_t bat_filename[MAX_SIZE]; + wchar_t cscript_exe[MAX_SIZE]; + wchar_t tmp[MAX_SIZE]; + void *process; + bool ret = false; + + if (MsIsNt() == false) + { + return false; + } + + if (MsIsWin2000OrGreater() == false) + { + return false; + } + + CombinePathW(bat_filename, sizeof(bat_filename), MsGetMyTempDirW(), L"detectvm.vbs"); + + if (DumpDataW(bat_data, StrLen(bat_data), bat_filename) == false) + { + return false; + } + + CombinePathW(cscript_exe, sizeof(cscript_exe), MsGetSystem32DirW(), L"cscript.exe"); + + UniFormat(tmp, sizeof(tmp), L"\"%s\"", bat_filename); + + process = Win32RunEx3W(cscript_exe, tmp, true, NULL, true); + + if (process == NULL) + { + return false; + } + + if (Win32WaitProcess(process, 30000)) + { + DWORD exit_code = 0; + + if (GetExitCodeProcess(process, &exit_code)) + { + if (exit_code == 1) + { + ret = true; + } + } + } + + Win32CloseProcess(process); + + return ret; +} +bool MsIsInVm() +{ + static bool flag_detected = false; + static bool flag_is_vm = false; + + if (flag_detected == false) + { + flag_is_vm = MsIsInVmMain(); + + flag_detected = true; + } + + return flag_is_vm; +} + +// Get the current module handle +void *MsGetCurrentModuleHandle() +{ + return ms->hInst; +} + +// Resource enumeration procedure +bool CALLBACK MsEnumResourcesInternalProc(HMODULE hModule, const char *type, char *name, LONG_PTR lParam) +{ + LIST *o = (LIST *)lParam; + // Validate arguments + if (type == NULL || name == NULL || o == NULL) + { + return true; + } + + Add(o, CopyStr(name)); + + return true; +} + +// Enumeration of resources +TOKEN_LIST *MsEnumResources(void *hModule, char *type) +{ + LIST *o; + TOKEN_LIST *ret; + // Validate arguments + if (hModule == NULL) + { + hModule = MsGetCurrentModuleHandle(); + } + if (type == NULL) + { + return NullToken(); + } + + o = NewListFast(NULL); + + if (EnumResourceNamesA(hModule, type, MsEnumResourcesInternalProc, (LONG_PTR)o) == false) + { + ReleaseList(o); + return NullToken(); + } + + ret = ListToTokenList(o); + + FreeStrList(o); + + return ret; +} + +// Get whether the locale ID of the current user is Japanese +bool MsIsCurrentUserLocaleIdJapanese() +{ + UINT lcid = MsGetUserLocaleId(); + + if (lcid == 1041) + { + return true; + } + + return false; +} + +// Get the locale ID of the user +UINT MsGetUserLocaleId() +{ + static UINT lcid_cache = 0; + + if (lcid_cache == 0) + { + lcid_cache = (UINT)GetUserDefaultLCID(); + } + + return lcid_cache; +} + +// Set a secure ACL to the specified file or directory +bool MsSetFileSecureAcl(wchar_t *path) +{ + SID *sid_system; + SID *sid_admin; + bool ret = false; + // Validate arguments + if (path == NULL) + { + return false; + } + if (ms->nt == NULL) + { + return false; + } + if (ms->nt->SetNamedSecurityInfoW == NULL || ms->nt->AddAccessAllowedAceEx == NULL) + { + return false; + } + + sid_system = MsGetSidFromAccountName("SYSTEM"); + sid_admin = MsGetSidFromAccountName("Administrators"); + + if (sid_system != NULL && sid_admin != NULL) + { + UINT acl_size = 4096; + ACL *acl; + + acl = ZeroMalloc(acl_size); + + if (InitializeAcl(acl, acl_size, 2)) + { + if (ms->nt->AddAccessAllowedAceEx(acl, 2, CONTAINER_INHERIT_ACE | OBJECT_INHERIT_ACE, GENERIC_ALL, sid_system) && + ms->nt->AddAccessAllowedAceEx(acl, 2, CONTAINER_INHERIT_ACE | OBJECT_INHERIT_ACE, GENERIC_ALL, sid_admin)) + { + if (ms->nt->SetNamedSecurityInfoW(path, SE_FILE_OBJECT, DACL_SECURITY_INFORMATION | PROTECTED_DACL_SECURITY_INFORMATION, NULL, NULL, acl, NULL) == ERROR_SUCCESS) + { + ret = true; + } + } + } + + Free(acl); + } + + MsFreeSid(sid_system); + MsFreeSid(sid_admin); + + return ret; +} + +// Disable the minimization function of the number of network connections by WCM +void MsDisableWcmNetworkMinimize() +{ + MS_WCM_POLICY_VALUE v; + bool b; + if (ms->nt == NULL) + { + return; + } + if (ms->nt->WcmQueryProperty == NULL || ms->nt->WcmSetProperty == NULL || ms->nt->WcmFreeMemory == NULL || ms->nt->WcmGetProfileList == NULL) + { + return; + } + + if (MsIsWindows8() == false) + { + return; + } + + Zero(&v, sizeof(v)); + v.fIsGroupPolicy = true; + v.fValue = false; + b = false; + ms->nt->WcmSetProperty(NULL, NULL, ms_wcm_global_property_minimize_policy, NULL, sizeof(v), (const BYTE *)&v); + ms->nt->WcmSetProperty(NULL, NULL, ms_wcm_global_property_minimize_policy, NULL, sizeof(b), (const BYTE *)&b); + + Zero(&v, sizeof(v)); + v.fIsGroupPolicy = true; + v.fValue = false; + b = false; + ms->nt->WcmSetProperty(NULL, NULL, ms_wcm_global_property_domain_policy, NULL, sizeof(v), (const BYTE *)&v); + ms->nt->WcmSetProperty(NULL, NULL, ms_wcm_global_property_domain_policy, NULL, sizeof(b), (const BYTE *)&b); + + Zero(&v, sizeof(v)); + v.fIsGroupPolicy = false; + v.fValue = false; + ms->nt->WcmSetProperty(NULL, NULL, ms_wcm_global_property_minimize_policy, NULL, sizeof(v), (const BYTE *)&v); + ms->nt->WcmSetProperty(NULL, NULL, ms_wcm_global_property_minimize_policy, NULL, sizeof(b), (const BYTE *)&b); + + Zero(&v, sizeof(v)); + v.fIsGroupPolicy = false; + v.fValue = false; + ms->nt->WcmSetProperty(NULL, NULL, ms_wcm_global_property_domain_policy, NULL, sizeof(v), (const BYTE *)&v); + ms->nt->WcmSetProperty(NULL, NULL, ms_wcm_global_property_domain_policy, NULL, sizeof(b), (const BYTE *)&b); +} + +// Request the MS-CHAPv2 authentication to the LSA +bool MsPerformMsChapV2AuthByLsa(char *username, UCHAR *challenge8, UCHAR *client_response_24, UCHAR *ret_pw_hash_hash) +{ + bool ret = false; + char user[MAX_SIZE]; + char domain[MAX_SIZE]; + wchar_t workstation[MAX_SIZE + 1]; + LSA_STRING origin; + MSV1_0_LM20_LOGON *m; + MS_MSCHAPV2_PARAMS *p; + UINT m_size; + DWORD sz; + void *profile_buffer = NULL; + LUID logon_id; + UINT profile_buffer_size = 0; + UINT i; + HANDLE hLogon = NULL; + QUOTA_LIMITS q; + char *origin_str = "SE-VPN"; + NTSTATUS sub_status = 0; + // Validate arguments + if (username == NULL || challenge8 == NULL || client_response_24 == NULL || ret_pw_hash_hash == NULL) + { + return false; + } + if (hLsa == NULL) + { + return false; + } + + ParseNtUsername(username, user, sizeof(user), domain, sizeof(domain), false); + + // Get the machine name + Zero(workstation, sizeof(workstation)); + sz = MAX_SIZE; + GetComputerNameW(workstation, &sz); + + // Build a MSV1_0_INTERACTIVE_LOGON + m_size = sizeof(MSV1_0_LM20_LOGON) + sizeof(MS_MSCHAPV2_PARAMS); + m = ZeroMalloc(m_size); + p = (MS_MSCHAPV2_PARAMS *)(((UCHAR *)m) + sizeof(MSV1_0_LM20_LOGON)); + + StrToUni(p->Username, sizeof(p->Username), user); + StrToUni(p->Domain, sizeof(p->Domain), domain); + UniStrCpy(p->Workstation, sizeof(p->Workstation), workstation); + Copy(p->ClientResponse24, client_response_24, 24); + + m->MessageType = MsV1_0Lm20Logon; + + // User name + m->UserName.Length = m->UserName.MaximumLength = (USHORT)(UniStrLen(p->Username) * sizeof(wchar_t)); + m->UserName.Buffer = p->Username; + + // Workstation name + m->Workstation.Length = m->Workstation.MaximumLength = (USHORT)(UniStrLen(p->Workstation) * sizeof(wchar_t)); + m->Workstation.Buffer = p->Workstation; + + // Domain name + if (IsEmptyUniStr(p->Domain) == false) + { + m->LogonDomainName.Length = m->LogonDomainName.MaximumLength = (USHORT)(UniStrLen(p->Domain) * sizeof(wchar_t)); + m->LogonDomainName.Buffer = p->Domain; + } + + // Challenge + Copy(m->ChallengeToClient, challenge8, 8); + + // Response + m->CaseInsensitiveChallengeResponse.Length = m->CaseInsensitiveChallengeResponse.MaximumLength = 24; + m->CaseInsensitiveChallengeResponse.Buffer = p->ClientResponse24; + + m->CaseSensitiveChallengeResponse.Length = m->CaseSensitiveChallengeResponse.MaximumLength = sizeof(p->ResponseBuffer); + m->CaseSensitiveChallengeResponse.Buffer = p->ResponseBuffer; + + m->ParameterControl = MSV1_0_ALLOW_MSVCHAPV2; + + Zero(&origin, sizeof(origin)); + origin.Length = origin.MaximumLength = StrLen(origin_str); + origin.Buffer = origin_str; + + Zero(&logon_id, sizeof(logon_id)); + Zero(&q, sizeof(q)); + + i = ms->nt->LsaLogonUser(hLsa, &origin, Network, lsa_package_id, m, m_size, NULL, &lsa_token_source, + &profile_buffer, &profile_buffer_size, &logon_id, &hLogon, &q, &sub_status); + + if (i == 0) + { + if (profile_buffer != NULL) + { + MSV1_0_LM20_LOGON_PROFILE *response = (MSV1_0_LM20_LOGON_PROFILE *)profile_buffer; + + Copy(ret_pw_hash_hash, response->UserSessionKey, 16); + + ret = true; + + ms->nt->LsaFreeReturnBuffer(profile_buffer); + } + CloseHandle(hLogon); + } + + Free(m); + + return ret; +} + +// Send a pulse +void MsSendGlobalPulse(void *p) +{ + HANDLE h; + // Validate arguments + if (p == NULL) + { + return; + } + + h = (HANDLE)p; + + PulseEvent(h); +} + +// Release a pulse +void MsCloseGlobalPulse(void *p) +{ + HANDLE h; + // Validate arguments + if (p == NULL) + { + return; + } + + h = (HANDLE)p; + + CloseHandle(h); +} + +// Wait for arriving the pulse +bool MsWaitForGlobalPulse(void *p, UINT timeout) +{ + HANDLE h; + UINT ret; + // Validate arguments + if (p == NULL) + { + return false; + } + if (timeout == TIMEOUT_INFINITE) + { + timeout = INFINITE; + } + + h = (HANDLE)p; + + ret = WaitForSingleObject(h, timeout); + + if (ret == WAIT_OBJECT_0) + { + return true; + } + + return false; +} + +// Open or create a pulse +void *MsOpenOrCreateGlobalPulse(char *name) +{ + UCHAR hash[20]; + char tmp[MAX_SIZE]; + char tmp2[MAX_SIZE]; + HANDLE h; + // Validate arguments + if (name == NULL) + { + return NULL; + } + + StrCpy(tmp, sizeof(tmp), name); + Trim(tmp); + StrUpper(tmp); + + Sha1(hash, name, StrLen(name)); + + BinToStr(tmp, sizeof(tmp), hash, sizeof(hash)); + + Format(tmp2, sizeof(tmp2), "GlobalPulse_%s", tmp); + + if (OS_IS_WINDOWS_NT(GetOsInfo()->OsType)) + { + if (GET_KETA(GetOsInfo()->OsType, 100) >= 2 || + GetOsInfo()->OsType == OSTYPE_WINDOWS_NT_4_TERMINAL_SERVER) + { + Format(tmp2, sizeof(tmp2), "Global\\GlobalPulse_%s", tmp); + } + } + + h = CreateEvent(NULL, true, false, tmp2); + + return (void *)h; +} + +// Stop the IPsec service +bool MsStopIPsecService() +{ + if (MsIsServiceRunning(MsGetIPsecServiceName())) + { + Debug("Stopping Windows Service: %s\n", MsGetIPsecServiceName()); + if (MsStopService(MsGetIPsecServiceName())) + { + return true; + } + } + + return false; +} + +// Start the IPsec service +bool MsStartIPsecService() +{ + if (MsIsServiceRunning(MsGetIPsecServiceName()) == false) + { + Debug("Starting Windows Service: %s\n", MsGetIPsecServiceName()); + return MsStartService(MsGetIPsecServiceName()); + } + + return false; +} + +// Get the IPsec service name +char *MsGetIPsecServiceName() +{ + char *svc_name = "PolicyAgent"; + + if (MsIsVista()) + { + svc_name = "ikeext"; + } + + return svc_name; +} + +// Initialize the global lock +void *MsInitGlobalLock(char *name, bool ts_local) +{ + char tmp[MAX_SIZE]; + HANDLE h; + // Validate arguments + if (name == NULL) + { + name = "default_global_lock"; + } + + if (ts_local) + { + HashInstanceNameLocal(tmp, sizeof(tmp), name); + } + else + { + HashInstanceName(tmp, sizeof(tmp), name); + } + + h = CreateMutexA(NULL, false, tmp); + if (h == NULL || h == INVALID_HANDLE_VALUE) + { + return NULL; + } + + return (void *)h; +} + +// Get a global lock +void MsGlobalLock(void *p) +{ + HANDLE h = (HANDLE)p; + // Validate arguments + if (h == NULL) + { + return; + } + + WaitForSingleObject(p, INFINITE); +} + +// Unlock the global lock +void MsGlobalUnlock(void *p) +{ + HANDLE h = (HANDLE)p; + // Validate arguments + if (h == NULL) + { + return; + } + + ReleaseMutex(h); +} + +// Release the global lock +void MsFreeGlobalLock(void *p) +{ + HANDLE h = (HANDLE)p; + // Validate arguments + if (h == NULL) + { + return; + } + + CloseHandle(h); +} + + +// Set the mode not to show the errors +void MsSetErrorModeToSilent() +{ + SetErrorMode(SEM_FAILCRITICALERRORS | SEM_NOGPFAULTERRORBOX | SEM_NOOPENFILEERRORBOX); +} + +// Get the file information +bool MsGetFileInformation(void *h, void *info) +{ + // Validate arguments + if (h == INVALID_HANDLE_VALUE || info == NULL) + { + return false; + } + + if (MsIsNt() == false) + { + return false; + } + + if (ms->nt->GetFileInformationByHandle == NULL) + { + return false; + } + + return ms->nt->GetFileInformationByHandle(h, info); +} + +// Set the shutdown parameters of the process +void MsSetShutdownParameters(UINT level, UINT flag) +{ + if (MsIsNt() == false) + { + return; + } + + if (ms->nt == false || ms->nt->SetProcessShutdownParameters == NULL) + { + return; + } + + ms->nt->SetProcessShutdownParameters(level, flag); +} + +// Get whether the version of the OS is Windows XP or Windows Vista or later +bool MsIsWinXPOrWinVista() +{ + OS_INFO *info = GetOsInfo(); + if (info == NULL) + { + return false; + } + + if (OS_IS_WINDOWS_NT(info->OsType) == false) + { + return false; + } + + if (GET_KETA(info->OsType, 100) >= 3) + { + return true; + } + + return false; +} + +// Restart of MMCSS +void MsRestartMMCSS() +{ + MsStopService("CTAudSvcService"); + MsStopService("audiosrv"); + MsStopService("MMCSS"); + MsStartService("MMCSS"); + MsStartService("audiosrv"); + MsStartService("CTAudSvcService"); +} + +// Enable / disable network throttling by MMCSS +void MsSetMMCSSNetworkThrottlingEnable(bool enable) +{ + UINT value; + if (MsIsVista() == false) + { + return; + } + + if (enable) + { + value = 0x0000000a; + } + else + { + value = 0xffffffff; + } + + MsRegWriteIntEx2(REG_LOCAL_MACHINE, MMCSS_PROFILE_KEYNAME, "NetworkThrottlingIndex", + value, + false, true); + + MsRestartMMCSS(); +} + +// Examine whether the Network throttling by MMCSS is enabled +bool MsIsMMCSSNetworkThrottlingEnabled() +{ + UINT value; + if (MsIsVista() == false) + { + return false; + } + + if (MsRegIsKeyEx2(REG_LOCAL_MACHINE, MMCSS_PROFILE_KEYNAME, false, true) == false) + { + return false; + } + + value = MsRegReadIntEx2(REG_LOCAL_MACHINE, MMCSS_PROFILE_KEYNAME, + "NetworkThrottlingIndex", false, true); + + if (value == 0) + { + return false; + } + + if (value == 0x0000000a) + { + return true; + } + + return false; +} + +typedef struct _ASTAT_ +{ + ADAPTER_STATUS adapt; + NAME_BUFFER NameBuff[30]; +} ASTAT, *PASTAT; + +// Get the precise time from the value of the high-resolution counter +double MsGetHiResTimeSpan(UINT64 diff) +{ + LARGE_INTEGER t; + UINT64 freq; + + if (QueryPerformanceFrequency(&t) == false) + { + freq = 1000ULL; + } + else + { + Copy(&freq, &t, sizeof(UINT64)); + } + + return (double)diff / (double)freq; +} +UINT64 MsGetHiResTimeSpanUSec(UINT64 diff) +{ + LARGE_INTEGER t; + UINT64 freq; + + if (QueryPerformanceFrequency(&t) == false) + { + freq = 1000ULL; + } + else + { + Copy(&freq, &t, sizeof(UINT64)); + } + + return (UINT64)(diff) * 1000ULL * 1000ULL / (UINT64)freq; +} + +// Get a high-resolution counter +UINT64 MsGetHiResCounter() +{ + LARGE_INTEGER t; + UINT64 ret; + + if (QueryPerformanceCounter(&t) == false) + { + return Tick64(); + } + + Copy(&ret, &t, sizeof(UINT64)); + + return ret; +} + +// System-wide updating notification +void MsUpdateSystem() +{ + static DWORD dw = 0; + + SendMessageTimeoutA(HWND_BROADCAST, WM_WININICHANGE, 0, 0, SMTO_NORMAL, 1, (PDWORD_PTR)&dw); + SleepThread(25); + SendMessageTimeoutA(HWND_BROADCAST, WM_SETTINGCHANGE, 0, (LPARAM)"Environment", SMTO_NORMAL, 1, (PDWORD_PTR)&dw); + SleepThread(25); + SHChangeNotify(SHCNE_GLOBALEVENTS, SHCNF_IDLIST | SHCNF_FLUSHNOWAIT | SHCNF_NOTIFYRECURSIVE, NULL, NULL); + SleepThread(25); + SHChangeNotify(SHCNE_GLOBALEVENTS, SHCNF_IDLIST, NULL, NULL); + SleepThread(25); + SHChangeNotify(SHCNE_ASSOCCHANGED, SHCNF_IDLIST | SHCNF_FLUSHNOWAIT | SHCNF_NOTIFYRECURSIVE, NULL, NULL); + SleepThread(25); + SHChangeNotify(SHCNE_ASSOCCHANGED, SHCNF_IDLIST, NULL, NULL); + SleepThread(25); + SHChangeNotify(SHCNE_ALLEVENTS, SHCNF_IDLIST | SHCNF_FLUSHNOWAIT | SHCNF_NOTIFYRECURSIVE, NULL, NULL); + SleepThread(25); + SHChangeNotify(SHCNE_ALLEVENTS, SHCNF_IDLIST, NULL, NULL); + SleepThread(25); +} + +// Wait for the process termination +UINT MsWaitProcessExit(void *process_handle) +{ + HANDLE h = (HANDLE)process_handle; + UINT ret = 1; + + if (h == NULL) + { + return 1; + } + + while (true) + { + WaitForSingleObject(h, INFINITE); + + ret = 1; + if (GetExitCodeProcess(h, &ret) == false) + { + break; + } + + if (ret != STILL_ACTIVE) + { + break; + } + } + + CloseHandle(h); + + return ret; +} + +// Execution of the file (to get process handle) +bool MsExecuteEx(char *exe, char *arg, void **process_handle) +{ + return MsExecuteEx2(exe, arg, process_handle, false); +} +bool MsExecuteEx2(char *exe, char *arg, void **process_handle, bool runas) +{ + SHELLEXECUTEINFO info; + HANDLE h; + // Validate arguments + if (exe == NULL || process_handle == NULL) + { + return false; + } + + Zero(&info, sizeof(info)); + info.cbSize = sizeof(info); + info.lpVerb = (runas ? "runas" : "open"); + info.lpFile = exe; + info.fMask = SEE_MASK_NOCLOSEPROCESS; + info.lpParameters = arg; + info.nShow = SW_SHOWNORMAL; + if (ShellExecuteEx(&info) == false) + { + return false; + } + + h = info.hProcess; + + *process_handle = (void *)h; + + return true; +} +bool MsExecuteEx2W(wchar_t *exe, wchar_t *arg, void **process_handle, bool runas) +{ + SHELLEXECUTEINFOW info; + HANDLE h; + // Validate arguments + if (exe == NULL || process_handle == NULL) + { + return false; + } + + if (IsNt() == false) + { + char exe_a[MAX_SIZE]; + char arg_a[MAX_SIZE]; + + UniToStr(exe_a, sizeof(exe_a), exe); + UniToStr(arg_a, sizeof(arg_a), arg); + + return MsExecuteEx(exe_a, arg_a, process_handle); + } + + Zero(&info, sizeof(info)); + info.cbSize = sizeof(info); + info.lpVerb = (runas ? L"runas" : L"open"); + info.lpFile = exe; + info.fMask = SEE_MASK_NOCLOSEPROCESS; + info.lpParameters = arg; + info.nShow = SW_SHOWNORMAL; + if (ShellExecuteExW(&info) == false) + { + return false; + } + + h = info.hProcess; + + *process_handle = (void *)h; + + return true; +} + +// Close the handle +void MsCloseHandle(void *handle) +{ + if (handle != NULL) + { + CloseHandle(handle); + } +} + +// Execution of the file +bool MsExecute(char *exe, char *arg) +{ + return MsExecute2(exe, arg, false); +} +bool MsExecute2(char *exe, char *arg, bool runas) +{ + DWORD d; + // Validate arguments + if (exe == NULL) + { + return false; + } + + d = (DWORD)ShellExecuteA(NULL, (runas ? "runas" : "open"), exe, arg, MsGetExeDirName(), SW_SHOWNORMAL); + + if (d > 32) + { + return true; + } + + return false; +} +bool MsExecuteW(wchar_t *exe, wchar_t *arg) +{ + return MsExecute2W(exe, arg, false); +} +bool MsExecute2W(wchar_t *exe, wchar_t *arg, bool runas) +{ + DWORD d; + // Validate arguments + if (exe == NULL) + { + return false; + } + + if (IsNt() == false) + { + char exe_a[MAX_SIZE]; + char arg_a[MAX_SIZE]; + + UniToStr(exe_a, sizeof(exe_a), exe); + UniToStr(arg_a, sizeof(arg_a), arg); + + return MsExecute(exe_a, arg_a); + } + + d = (DWORD)ShellExecuteW(NULL, (runas ? L"runas" : L"open"), exe, arg, MsGetExeDirNameW(), SW_SHOWNORMAL); + + if (d > 32) + { + return true; + } + + return false; +} + +// Recursive directory creation +void MsUniMakeDirEx(wchar_t *name) +{ + UINT wp; + wchar_t *tmp; + UINT i, len; + // Validate arguments + if (name == NULL) + { + return; + } + + tmp = ZeroMalloc(UniStrSize(name) * 2); + wp = 0; + len = UniStrLen(name); + for (i = 0;i < len;i++) + { + wchar_t c = name[i]; + + if (c == '\\') + { + if (UniStrCmpi(tmp, L"\\\\") != 0 && UniStrCmpi(tmp, L"\\") != 0) + { + MsUniMakeDir(tmp); + } + } + + tmp[wp++] = c; + } + + Free(tmp); + + MsUniMakeDir(name); +} + +// Create a directory +bool MsUniMakeDir(wchar_t *name) +{ + // Validate arguments + if (name == NULL) + { + return false; + } + + if (MsIsNt() == false) + { + char *s = CopyUniToStr(name); + bool ret = MsMakeDir(s); + Free(s); + return ret; + } + + return CreateDirectoryW(name, NULL); +} +bool MsMakeDir(char *name) +{ + // Validate arguments + if (name == NULL) + { + return false; + } + + return CreateDirectoryA(name, NULL); +} + +static wchar_t ms_computer_name_full_cache[MAX_SIZE] = {0}; + +// Get the full name of the computer +void MsGetComputerNameFullEx(wchar_t *name, UINT size, bool with_cache) +{ + UINT size2 = size; + // Validate arguments + UniStrCpy(name, size, L""); + if (name == NULL || size == 0) + { + return; + } + + if (with_cache) + { + if (UniIsEmptyStr(ms_computer_name_full_cache) == false) + { + UniStrCpy(name, size, ms_computer_name_full_cache); + return; + } + } + + if (MsIsNt() == false || ms->nt->GetComputerNameExW == NULL || + ms->nt->GetComputerNameExW(ComputerNameDnsFullyQualified, name, &size2) == false) + { + char tmp[MAX_SIZE]; + + MsGetComputerName(tmp, sizeof(tmp)); + + StrToUni(name, size, tmp); + } + + if (with_cache) + { + UniStrCpy(ms_computer_name_full_cache, sizeof(ms_computer_name_full_cache), name); + } +} + +// Get the computer name +void MsGetComputerName(char *name, UINT size) +{ + DWORD sz; + // Validate arguments + if (name == NULL) + { + return; + } + + sz = size; + GetComputerName(name, &sz); +} + +// Get the hash value of the position of the mouse cursor +UINT MsGetCursorPosHash() +{ + POINT p; + + Zero(&p, sizeof(p)); + + if (GetCursorPos(&p) == false) + { + return 0; + } + + return MAKELONG((USHORT)p.x, (USHORT)p.y); +} + +// Start the process as a standard user privileges +void *MsRunAsUserExW(wchar_t *filename, wchar_t *arg, bool hide) +{ + void *ret = MsRunAsUserExInnerW(filename, arg, hide); + + if (ret == NULL) + { + Debug("MsRunAsUserExInner Failed.\n"); + ret = Win32RunExW(filename, arg, hide); + } + + return ret; +} +void *MsRunAsUserExInnerW(wchar_t *filename, wchar_t *arg, bool hide) +{ + STARTUPINFOW info; + PROCESS_INFORMATION ret; + wchar_t cmdline[MAX_SIZE]; + wchar_t name[MAX_PATH]; + HANDLE hToken; + // Validate arguments + if (filename == NULL) + { + return NULL; + } + + if (MsIsVista() == false) + { + // Can not be used in non-Windows Vista + return NULL; + } + + UniStrCpy(name, sizeof(name), filename); + UniTrim(name); + + if (UniSearchStr(name, L"\"", 0) == INFINITE) + { + if (arg == NULL) + { + UniFormat(cmdline, sizeof(cmdline), L"%s", name); + } + else + { + UniFormat(cmdline, sizeof(cmdline), L"%s %s", name, arg); + } + } + else + { + if (arg == NULL) + { + UniFormat(cmdline, sizeof(cmdline), L"\"%s\"", name); + } + else + { + UniFormat(cmdline, sizeof(cmdline), L"\"%s\" %s", name, arg); + } + } + + Zero(&info, sizeof(info)); + Zero(&ret, sizeof(ret)); + info.cb = sizeof(info); + info.dwFlags = STARTF_USESHOWWINDOW; + info.wShowWindow = (hide == false ? SW_SHOWDEFAULT : SW_HIDE); + + UniTrim(cmdline); + + hToken = MsCreateUserToken(); + + if (hToken == NULL) + { + return NULL; + } + + if (ms->nt->CreateProcessAsUserW(hToken, NULL, cmdline, NULL, NULL, FALSE, + (hide == false ? CREATE_NEW_CONSOLE : CREATE_NO_WINDOW | CREATE_NEW_CONSOLE) | NORMAL_PRIORITY_CLASS, + NULL, NULL, &info, &ret) == FALSE) + { + return NULL; + } + + CloseHandle(hToken); + + CloseHandle(ret.hThread); + return ret.hProcess; +} + +// Get the SID from the account name +SID *MsGetSidFromAccountName(char *name) +{ + SID *sid; + UINT sid_size = 4096; + char *domain_name; + UINT domain_name_size = 4096; + SID_NAME_USE use = SidTypeUser; + // Validate arguments + if (name == NULL) + { + return NULL; + } + + if (MsIsNt() == false) + { + return NULL; + } + + sid = ZeroMalloc(sid_size); + domain_name = ZeroMalloc(domain_name_size); + + if (ms->nt->LookupAccountNameA(NULL, name, sid, &sid_size, domain_name, &domain_name_size, &use) == false) + { + Free(sid); + Free(domain_name); + return NULL; + } + + Free(domain_name); + + return sid; +} + +// Release the SID +void MsFreeSid(SID *sid) +{ + // Validate arguments + if (sid == NULL) + { + return; + } + + Free(sid); +} + +// Create a token of standard user +HANDLE MsCreateUserToken() +{ + char *medium_sid = "S-1-16-8192"; + char *administrators_sid = "S-1-5-32-544"; + SID *sid = NULL; + TOKEN_MANDATORY_LABEL til; + HANDLE hCurrentToken, hNewToken; + if (MsIsNt() == false) + { + return NULL; + } + if (ms->nt->ConvertStringSidToSidA == NULL || + ms->nt->OpenProcessToken == NULL || + ms->nt->DuplicateTokenEx == NULL || + ms->nt->GetTokenInformation == NULL || + ms->nt->SetTokenInformation == NULL) + { + return NULL; + } + + Zero(&til, sizeof(til)); + + if (ms->nt->ConvertStringSidToSidA(medium_sid, &sid) == false) + { + return NULL; + } + + til.Label.Attributes = SE_GROUP_INTEGRITY; + til.Label.Sid = sid; + + if (ms->nt->OpenProcessToken(GetCurrentProcess(), MAXIMUM_ALLOWED, &hCurrentToken) == false) + { + LocalFree(sid); + return NULL; + } + + if (ms->nt->DuplicateTokenEx(hCurrentToken, MAXIMUM_ALLOWED, NULL, + SecurityImpersonation, TokenPrimary, &hNewToken) == false) + { + CloseHandle(hCurrentToken); + LocalFree(sid); + return NULL; + } + + if (ms->nt->SetTokenInformation(hNewToken, VistaTokenIntegrityLevel, &til, + sizeof(TOKEN_MANDATORY_LABEL) + GetLengthSid(sid)) == false) + { + CloseHandle(hNewToken); + CloseHandle(hCurrentToken); + LocalFree(sid); + return NULL; + } + + CloseHandle(hCurrentToken); + LocalFree(sid); + + return hNewToken; +} + +// Check whether SHA-2 kernel mode signature is supported +bool MsIsSha2KernelModeSignatureSupported() +{ + HINSTANCE hDll; + bool ret = false; + + if (MsIsWindows8()) + { + return true; + } + + hDll = LoadLibrary("Wintrust.dll"); + if (hDll == NULL) + { + return false; + } + + if (GetProcAddress(hDll, "CryptCATAdminAcquireContext2") != NULL) + { + ret = true; + } + + FreeLibrary(hDll); + + return ret; +} + +// Check whether KB3033929 is required +bool MsIsKB3033929RequiredAndMissing() +{ + OS_INFO *info = GetOsInfo(); + + if (info == NULL) + { + return false; + } + + if (OS_IS_WINDOWS_NT(info->OsType)) + { + if (GET_KETA(info->OsType, 100) == 6) + { + if (MsIsX64()) + { + if (MsIsSha2KernelModeSignatureSupported() == false) + { + return true; + } + } + } + } + + return false; +} + +// Check the digital signature of the file +bool MsCheckFileDigitalSignatureW(HWND hWnd, wchar_t *name, bool *danger) +{ + HRESULT ret = S_OK; + wchar_t *tmp; + LONG (WINAPI *_WinVerifyTrust)(HWND, GUID *, LPVOID) = NULL; + HINSTANCE hDll; + // Validate arguments + if (name == NULL) + { + return false; + } + + if (danger != NULL) + { + *danger = false; + } + + tmp = name; + + hDll = LoadLibrary("Wintrust.dll"); + if (hDll == NULL) + { + return false; + } + + _WinVerifyTrust = + (LONG (__stdcall *)(HWND,GUID *,LPVOID)) + GetProcAddress(hDll, "WinVerifyTrust"); + if (_WinVerifyTrust == NULL) + { + FreeLibrary(hDll); + return false; + } + else + { + GUID action_id = WINTRUST_ACTION_GENERIC_VERIFY_V2; + WINTRUST_FILE_INFO file; + WINTRUST_DATA data; + + Zero(&file, sizeof(file)); + file.cbStruct = sizeof(file); + file.pcwszFilePath = tmp; + + Zero(&data, sizeof(data)); + data.cbStruct = sizeof(data); + data.fdwRevocationChecks = WTD_REVOKE_WHOLECHAIN; + data.dwUIChoice = (hWnd != NULL ? WTD_UI_NOGOOD : WTD_UI_NONE); + data.dwProvFlags = WTD_REVOCATION_CHECK_CHAIN; + data.dwUnionChoice = WTD_CHOICE_FILE; + data.pFile = &file; + + ret = _WinVerifyTrust(hWnd, &action_id, &data); + + if (ret == ERROR_SUCCESS && danger != NULL) + { + if (hWnd != NULL) + { + if (MsCheckFileDigitalSignatureW(NULL, name, NULL) == false) + { + // It's a dangerous file, but the user had to select the [OK] + *danger = true; + } + } + } + } + + FreeLibrary(hDll); + + if (ret != ERROR_SUCCESS) + { + return false; + } + + return true; +} + +// Disable the WoW64 redirection +void *MsDisableWow64FileSystemRedirection() +{ + void *p = NULL; + if (MsIs64BitWindows() == false) + { + return NULL; + } + + if (ms->nt->Wow64DisableWow64FsRedirection == NULL || + ms->nt->Wow64RevertWow64FsRedirection == NULL) + { + return NULL; + } + + if (ms->nt->Wow64DisableWow64FsRedirection(&p) == false) + { + return NULL; + } + + if (p == NULL) + { + p = (void *)0x12345678; + } + + return p; +} + +// Restore the WoW64 redirection +void MsRestoreWow64FileSystemRedirection(void *p) +{ + // Validate arguments + if (p == NULL) + { + return; + } + if (p == (void *)0x12345678) + { + p = NULL; + } + if (MsIs64BitWindows() == false) + { + return; + } + + if (ms->nt->Wow64DisableWow64FsRedirection == NULL || + ms->nt->Wow64RevertWow64FsRedirection == NULL) + { + return; + } + + ms->nt->Wow64RevertWow64FsRedirection(p); +} + +// Get whether the x64 version of Windows is currently running +bool MsIsX64() +{ + SYSTEM_INFO info; + + if (MsIs64BitWindows() == false) + { + return false; + } + if (ms->nt->GetNativeSystemInfo == NULL) + { + return false; + } + + Zero(&info, sizeof(info)); + ms->nt->GetNativeSystemInfo(&info); + + if (info.wProcessorArchitecture == PROCESSOR_ARCHITECTURE_AMD64) + { + return true; + } + + return false; +} + +// Get whether the IA64 version of Windows is currently running +bool MsIsIA64() +{ + if (MsIs64BitWindows() == false) + { + return false; + } + + if (MsIsX64()) + { + return false; + } + + return true; +} + +// Acquisition whether it's a 64bit Windows +bool MsIs64BitWindows() +{ + if (Is64()) + { + return true; + } + else + { + if (MsIsNt() == false) + { + return false; + } + else + { + if (ms == NULL || ms->nt == NULL) + { + return false; + } + + if (ms->nt->IsWow64Process == NULL) + { + return false; + } + else + { + bool b = false; + if (ms->nt->IsWow64Process(GetCurrentProcess(), &b) == false) + { + return false; + } + return b; + } + } + } +} + +// Windows Firewall registration +void MsRegistWindowsFirewallEx2(char *title, char *exe, char *dir) +{ + char tmp[MAX_PATH]; + // Validate arguments + if (title == NULL || exe == NULL) + { + return; + } + if (dir == NULL || IsEmptyStr(dir)) + { + dir = MsGetExeDirName(); + } + + ConbinePath(tmp, sizeof(tmp), dir, exe); + + if (IsFileExists(tmp) == false) + { + return; + } + + MsRegistWindowsFirewallEx(title, tmp); +} +void MsRegistWindowsFirewallEx(char *title, char *exe) +{ + char *data = + "Option Explicit\r\nConst NET_FW_PROFILE_DOMAIN = 0\r\nConst NET_FW_PROFILE_STANDARD = 1\r\n" + "Const NET_FW_SCOPE_ALL = 0\r\nConst NET_FW_IP_VERSION_ANY = 2\r\nDim fwMgr\r\n" + "Set fwMgr = CreateObject(\"HNetCfg.FwMgr\")\r\nDim profile\r\n" + "Set profile = fwMgr.LocalPolicy.CurrentProfile\r\nDim app\r\n" + "Set app = CreateObject(\"HNetCfg.FwAuthorizedApplication\")\r\n" + "app.ProcessImageFileName = \"$PATH$\"\r\napp.Name = \"$TITLE$\"\r\n" + "app.Scope = NET_FW_SCOPE_ALL\r\napp.IpVersion = NET_FW_IP_VERSION_ANY\r\n" + "app.Enabled = TRUE\r\nOn Error Resume Next\r\nprofile.AuthorizedApplications." + "Add app\r\n"; + char *tmp; + UINT tmp_size; + char filename[MAX_PATH]; + char cscript[MAX_PATH]; + char arg[MAX_PATH]; + UINT ostype; + IO *o; + char hash[MAX_PATH]; + UCHAR hashbin[SHA1_SIZE]; + UCHAR file_hash_bin[SHA1_SIZE]; + char file_hash_str[MAX_SIZE]; + // Validate arguments + if (title == NULL || exe == NULL) + { + return; + } + + // OS check (This Is not performed except Windows XP, Windows Server 2003, Windows Vista or later) + ostype = GetOsInfo()->OsType; + if (OS_IS_WINDOWS_NT(ostype) == false) + { + return; + } + if (MsIsAdmin() == false) + { + return; + } + + if (MsIsVista()) + { + data = "Option Explicit\r\n\r\nConst PROFILES_ALL = 7\r\nConst NET_FW_ACTION_ALLOWNET_FW_ACTION_ALLOW = 1\r\n" + "\r\nDim policy2\r\nDim rules\r\nDim new_rule\r\n\r\nOn Error Resume Next\r\n\r\n" + "Set policy2 = CreateObject(\"HNetCfg.FwPolicy2\")\r\nSet rules = policy2.Rules\r\n" + "Set new_rule = CreateObject(\"HNetCfg.FWRule\")\r\nnew_rule.Name = \"$TITLE$\"\r\n" + "new_rule.Description = \"$TITLE$\"\r\nnew_rule.ApplicationName = \"$PATH$\"\r\n" + "new_rule.Enabled = TRUE\r\nnew_rule.Profiles = PROFILES_ALL\r\nnew_rule.Action = " + "NET_FW_ACTION_ALLOWNET_FW_ACTION_ALLOW\r\nrules.Add new_rule\r\n\r\n"; + } + + tmp_size = StrLen(data) * 4; + tmp = ZeroMalloc(tmp_size); + + Sha1(hashbin, exe, StrLen(exe)); + BinToStr(hash, sizeof(hash), hashbin, 6); + + ReplaceStrEx(tmp, tmp_size, data, "$TITLE$", title, false); + ReplaceStrEx(tmp, tmp_size, tmp, "$PATH$", exe, false); + + Sha1(file_hash_bin, tmp, StrLen(tmp)); + BinToStr(file_hash_str, sizeof(file_hash_str), file_hash_bin, sizeof(file_hash_bin)); + + if (MsIsVista() == false || MsRegReadIntEx2(REG_LOCAL_MACHINE, SOFTETHER_FW_SCRIPT_HASH, file_hash_str, false, true) == 0) + { + Format(filename, sizeof(filename), "%s\\winfire_%s.vbs", MsGetMyTempDir(), hash); + o = FileCreate(filename); + FileWrite(o, tmp, StrLen(tmp)); + FileClose(o); + + Format(cscript, sizeof(cscript), "%s\\cscript.exe", MsGetSystem32Dir()); + Format(arg, sizeof(arg), "\"%s\"", filename); + + if (Run(cscript, arg, true, false)) + { + MsRegWriteIntEx2(REG_LOCAL_MACHINE, SOFTETHER_FW_SCRIPT_HASH, file_hash_str, 1, false, true); + } + + Debug("cscript %s\n", arg); + } + + Free(tmp); +} + +// Run driver installer for Vista +bool MsExecDriverInstaller(char *arg) +{ + wchar_t tmp[MAX_PATH]; + wchar_t hamcore_dst[MAX_PATH]; + wchar_t hamcore_src[MAX_PATH]; + wchar_t lang_config_src[MAX_PATH]; + wchar_t lang_config_dst[MAX_PATH]; + HANDLE h; + UINT retcode; + SHELLEXECUTEINFOW info; + wchar_t *arg_w; + // Validate arguments + if (arg == NULL) + { + return false; + } + + UniFormat(hamcore_dst, sizeof(hamcore_dst), L"%s\\hamcore.se2", MsGetMyTempDirW()); + UniFormat(hamcore_src, sizeof(hamcore_src), L"%s\\hamcore.se2", MsGetExeDirNameW()); + + // Extract the File + UniFormat(tmp, sizeof(tmp), VISTA_DRIVER_INSTALLER_DST, MsGetMyTempDirW()); + + if (FileCopyW(VISTA_DRIVER_INSTALLER_SRC, tmp) == false) + { + return false; + } + + if (FileCopyW(hamcore_src, hamcore_dst) == false) + { + return false; + } + + ConbinePathW(lang_config_src, sizeof(lang_config_src), MsGetExeDirNameW(), L"lang.config"); + ConbinePathW(lang_config_dst, sizeof(lang_config_dst), MsGetMyTempDirW(), L"lang.config"); + FileCopyW(lang_config_src, lang_config_dst); + + arg_w = CopyStrToUni(arg); + + // Run + Zero(&info, sizeof(info)); + info.cbSize = sizeof(info); + info.lpVerb = L"open"; + info.lpFile = tmp; + info.fMask = SEE_MASK_NOCLOSEPROCESS; + info.lpParameters = arg_w; + info.nShow = SW_SHOWNORMAL; + if (ShellExecuteExW(&info) == false) + { + Free(arg_w); + return false; + } + + Free(arg_w); + + h = info.hProcess; + retcode = 1; + + while (true) + { + // Wait for completion + WaitForSingleObject(h, INFINITE); + + // Get the exit code + retcode = 1; + if (GetExitCodeProcess(h, &retcode) == false) + { + break; + } + + if (retcode != STILL_ACTIVE) + { + break; + } + } + + CloseHandle(h); + + if (retcode & 1) + { + return false; + } + + return true; +} + +// Get the locale of the current thread +UINT MsGetThreadLocale() +{ + return (UINT)GetThreadLocale(); +} + +// Set the width of the current console +UINT MsSetConsoleWidth(UINT size) +{ + HANDLE h = GetStdHandle(STD_OUTPUT_HANDLE); + CONSOLE_SCREEN_BUFFER_INFO info; + COORD c; + UINT old_x, old_y; + // Validate arguments + if (size == 0) + { + return 0; + } + if (h == INVALID_HANDLE_VALUE) + { + return 0; + } + + Zero(&info, sizeof(info)); + if (GetConsoleScreenBufferInfo(h, &info) == false) + { + return 0; + } + + old_x = info.dwSize.X; + old_y = info.dwSize.Y; + + c.X = size; + c.Y = old_y; + + SetConsoleScreenBufferSize(h, c); + + return old_x; +} + +// Get the width of the current console +UINT MsGetConsoleWidth() +{ + HANDLE h = GetStdHandle(STD_OUTPUT_HANDLE); + CONSOLE_SCREEN_BUFFER_INFO info; + + if (h == INVALID_HANDLE_VALUE) + { + return 80; + } + + Zero(&info, sizeof(info)); + if (GetConsoleScreenBufferInfo(h, &info) == false) + { + return 80; + } + + return info.dwSize.X; +} + +// Disable the MS-IME +bool MsDisableIme() +{ + HINSTANCE h; + bool ret = false; + char dll_name[MAX_PATH]; + BOOL (WINAPI *_ImmDisableIME)(DWORD); + + Format(dll_name, sizeof(dll_name), "%s\\imm32.dll", MsGetSystem32Dir()); + h = MsLoadLibrary(dll_name); + if (h == NULL) + { + return false; + } + + _ImmDisableIME = (BOOL (__stdcall *)(DWORD))GetProcAddress(h, "ImmDisableIME"); + + if (_ImmDisableIME != NULL) + { + ret = _ImmDisableIME(-1); + } + + FreeLibrary(h); + + return ret; +} + +// Display the current time +void MsPrintTick() +{ + UINT tick = timeGetTime(); + static UINT tick_init = 0; + if (tick_init == 0) + { + tick_init = tick; + tick = 0; + } + else + { + tick -= tick_init; + } + + printf("[%u]\n", tick); +} + +// LoadLibrary compatible for hamcore (Read as a data file) +void *MsLoadLibraryAsDataFileW(wchar_t *name) +{ + BUF *b; + wchar_t tmp_dll_name[MAX_SIZE]; + char hash_str[MAX_SIZE]; + UCHAR hash[SHA1_SIZE]; + // Validate arguments + if (name == NULL) + { + return NULL; + } + + Sha0(hash, name, UniStrLen(name)); + + BinToStr(hash_str, sizeof(hash_str), hash, 4); + + UniFormat(tmp_dll_name, sizeof(tmp_dll_name), L"%s\\%S.dll", MsGetMyTempDirW(), hash_str); + + if (IsFileExistsW(tmp_dll_name) == false) + { + b = ReadDumpW(name); + if (b == NULL) + { + return NULL; + } + + DumpBufW(b, tmp_dll_name); + FreeBuf(b); + } + + return LoadLibraryExW(tmp_dll_name, NULL, LOAD_LIBRARY_AS_DATAFILE); +} +void *MsLoadLibraryAsDataFile(char *name) +{ + wchar_t name_w[MAX_SIZE]; + // Validate arguments + if (name == NULL) + { + return NULL; + } + + StrToUni(name_w, sizeof(name_w), name); + + return MsLoadLibraryAsDataFileW(name_w); +} + +// LoadLibrary (compatible for Hamcore) +void *MsLoadLibraryW(wchar_t *name) +{ + BUF *b; + wchar_t tmp_dll_name[MAX_SIZE]; + char hash_str[MAX_SIZE]; + UCHAR hash[SHA1_SIZE]; + // Validate arguments + if (name == NULL) + { + return NULL; + } + + Sha0(hash, name, UniStrSize(name)); + + BinToStr(hash_str, sizeof(hash_str), hash, 4); + + UniFormat(tmp_dll_name, sizeof(tmp_dll_name), L"%s\\%S.dll", MsGetMyTempDirW(), hash_str); + + if (IsFileExistsW(tmp_dll_name) == false) + { + b = ReadDumpW(name); + if (b == NULL) + { + return NULL; + } + + DumpBufW(b, tmp_dll_name); + FreeBuf(b); + } + + if (IsNt()) + { + return LoadLibraryW(tmp_dll_name); + } + else + { + char tmp_dll_name_a[MAX_SIZE]; + HINSTANCE ret; + + UniToStr(tmp_dll_name_a, sizeof(tmp_dll_name_a), tmp_dll_name); + + ret = LoadLibraryA(tmp_dll_name_a); + + return ret; + } +} +void *MsLoadLibrary(char *name) +{ + wchar_t name_w[MAX_SIZE]; + // Validate arguments + if (name == NULL) + { + return NULL; + } + + StrToUni(name_w, sizeof(name_w), name); + + return MsLoadLibraryW(name_w); +} + +// Search for the adapter by GUID +MS_ADAPTER *MsGetAdapterByGuid(char *guid) +{ + MS_ADAPTER_LIST *o; + MS_ADAPTER *ret = NULL; + // Validate arguments + if (guid == NULL) + { + return NULL; + } + + o = MsCreateAdapterList(); + if (o == NULL) + { + return NULL; + } + + ret = MsGetAdapterByGuidFromList(o, guid); + + MsFreeAdapterList(o); + + return ret; +} +MS_ADAPTER *MsGetAdapterByGuidFromList(MS_ADAPTER_LIST *o, char *guid) +{ + MS_ADAPTER *ret = NULL; + UINT i; + // Validate arguments + if (o == NULL || guid == NULL) + { + return NULL; + } + + for (i = 0;i < o->Num;i++) + { + if (StrCmpi(o->Adapters[i]->Guid, guid) == 0) + { + ret = MsCloneAdapter(o->Adapters[i]); + break; + } + } + + return ret; +} + +// Get a single adapter +MS_ADAPTER *MsGetAdapter(char *title) +{ + MS_ADAPTER_LIST *o; + MS_ADAPTER *ret = NULL; + UINT i; + // Validate arguments + if (title == NULL) + { + return NULL; + } + + o = MsCreateAdapterList(); + if (o == NULL) + { + return NULL; + } + + for (i = 0;i < o->Num;i++) + { + if (StrCmpi(o->Adapters[i]->Title, title) == 0) + { + ret = MsCloneAdapter(o->Adapters[i]); + break; + } + } + + MsFreeAdapterList(o); + + return ret; +} + +// 32-bit overflow checking +#define CHECK_32BIT_OVERFLOW(old_value, new_value) \ +{ \ + if ((old_value) > (new_value)) \ + { \ + (new_value) += ((UINT64)4294967296ULL); \ + } \ +} + +// Get the TCP/IP information of the specified adapter +void MsGetAdapterTcpIpInformation(MS_ADAPTER *a) +{ + IP_ADAPTER_INFO *info, *info_top; + UINT info_size; + UINT ret; + // Validate arguments + if (a == NULL) + { + return; + } + + if (w32net->GetAdaptersInfo == NULL) + { + return; + } + + info_top = ZeroMalloc(sizeof(IP_ADAPTER_INFO)); + info_size = sizeof(IP_ADAPTER_INFO); + + ret = w32net->GetAdaptersInfo(info_top, &info_size); + if (ret == ERROR_INSUFFICIENT_BUFFER || ret == ERROR_BUFFER_OVERFLOW) + { + Free(info_top); + info_size *= 2; + info_top = ZeroMalloc(info_size); + + if (w32net->GetAdaptersInfo(info_top, &info_size) != NO_ERROR) + { + Free(info_top); + return; + } + } + else if (ret != NO_ERROR) + { + Free(info_top); + return; + } + + // Search for their own entry + info = info_top; + + while (info != NULL) + { + if (info->Index == a->Index) + { + IP_ADDR_STRING *s; + + // IP address + a->NumIpAddress = 0; + s = &info->IpAddressList; + while (s != NULL) + { + if (a->NumIpAddress < MAX_MS_ADAPTER_IP_ADDRESS) + { + StrToIP(&a->IpAddresses[a->NumIpAddress], s->IpAddress.String); + StrToIP(&a->SubnetMasks[a->NumIpAddress], s->IpMask.String); + a->NumIpAddress++; + } + s = s->Next; + } + + // Gateway + a->NumGateway = 0; + s = &info->GatewayList; + while (s != NULL) + { + if (a->NumGateway < MAX_MS_ADAPTER_IP_ADDRESS) + { + StrToIP(&a->Gateways[a->NumGateway], s->IpAddress.String); + a->NumGateway++; + } + s = s->Next; + } + + // DHCP Server + a->UseDhcp = (info->DhcpEnabled == 0 ? false : true); + if (a->UseDhcp) + { + SYSTEMTIME st; + + StrToIP(&a->DhcpServer, info->DhcpServer.IpAddress.String); + TimeToSystem(&st, info->LeaseObtained); + a->DhcpLeaseStart = SystemToUINT64(&st); + + TimeToSystem(&st, info->LeaseExpires); + a->DhcpLeaseExpires = SystemToUINT64(&st); + } + + // WINS server + a->UseWins = info->HaveWins; + if (a->UseWins) + { + StrToIP(&a->PrimaryWinsServer, info->PrimaryWinsServer.IpAddress.String); + StrToIP(&a->SecondaryWinsServer, info->SecondaryWinsServer.IpAddress.String); + } + + StrCpy(a->Guid, sizeof(a->Guid), info->AdapterName); + + a->Info = true; + + break; + } + + info = info->Next; + } + + Free(info_top); +} + +// Generation of adapter list +MS_ADAPTER_LIST *MsCreateAdapterList() +{ + return MsCreateAdapterListEx(false); +} +MS_ADAPTER_LIST *MsCreateAdapterListEx(bool no_info) +{ + MS_ADAPTER_LIST *ret; + + if (no_info) + { + ret = MsCreateAdapterListInnerEx(true); + + return ret; + } + + Lock(lock_adapter_list); + { + MS_ADAPTER_LIST *old = last_adapter_list; + UINT i; + + // Fetch a new adapter list + ret = MsCreateAdapterListInner(); + + if (ret == NULL) + { + Unlock(lock_adapter_list); + return NULL; + } + + // Check whether the previously acquired item exists for each entry + // in the list of adapters have been taken + for (i = 0;i < ret->Num;i++) + { + UINT j; + for (j = 0;j < old->Num;j++) + { + MS_ADAPTER *o = old->Adapters[j]; + MS_ADAPTER *n = ret->Adapters[i]; + + if (StrCmpi(o->Title, n->Title) == 0) + { + // If the value of older item is small, increment it + CHECK_32BIT_OVERFLOW(o->RecvBytes, n->RecvBytes); + CHECK_32BIT_OVERFLOW(o->RecvPacketsBroadcast, n->RecvPacketsBroadcast); + CHECK_32BIT_OVERFLOW(o->RecvPacketsUnicast, n->RecvPacketsUnicast); + CHECK_32BIT_OVERFLOW(o->SendBytes, n->SendBytes); + CHECK_32BIT_OVERFLOW(o->SendPacketsBroadcast, n->SendPacketsBroadcast); + CHECK_32BIT_OVERFLOW(o->SendPacketsUnicast, n->SendPacketsUnicast); + break; + } + } + } + + // Release the old adapter list + MsFreeAdapterList(old); + + // Save a clone of the adapter list that newly acquired + last_adapter_list = MsCloneAdapterList(ret); + } + Unlock(lock_adapter_list); + + return ret; +} + +// Initialization of the adapter module list +void MsInitAdapterListModule() +{ + lock_adapter_list = NewLock(NULL); + + last_adapter_list = MsCreateAdapterListInner(); +} + +// Release of the adapter module list +void MsFreeAdapterListModule() +{ + if (last_adapter_list != NULL) + { + MsFreeAdapterList(last_adapter_list); + last_adapter_list = NULL; + } + + DeleteLock(lock_adapter_list); + lock_adapter_list = NULL; +} + +// Clone the adapter list +MS_ADAPTER_LIST *MsCloneAdapterList(MS_ADAPTER_LIST *o) +{ + MS_ADAPTER_LIST *ret; + UINT i; + // Validate arguments + if (o == NULL) + { + return NULL; + } + + ret = ZeroMalloc(sizeof(MS_ADAPTER_LIST)); + ret->Num = o->Num; + ret->Adapters = ZeroMalloc(sizeof(MS_ADAPTER *) * ret->Num); + + for (i = 0;i < ret->Num;i++) + { + ret->Adapters[i] = ZeroMalloc(sizeof(MS_ADAPTER)); + Copy(ret->Adapters[i], o->Adapters[i], sizeof(MS_ADAPTER)); + } + + return ret; +} + +// Clone the adapter +MS_ADAPTER *MsCloneAdapter(MS_ADAPTER *a) +{ + MS_ADAPTER *ret; + // Validate arguments + if (a == NULL) + { + return NULL; + } + + ret = ZeroMalloc(sizeof(MS_ADAPTER)); + Copy(ret, a, sizeof(MS_ADAPTER)); + + return ret; +} + +// Creating an adapters list +MS_ADAPTER_LIST *MsCreateAdapterListInner() +{ + return MsCreateAdapterListInnerEx(false); +} +MS_ADAPTER_LIST *MsCreateAdapterListInnerEx(bool no_info) +{ + LIST *o; + UINT i; + UINT retcode; + MIB_IFTABLE *table; + UINT table_size = sizeof(MIB_IFTABLE); + MS_ADAPTER_LIST *ret; + + if (w32net->GetIfTable2 != NULL && w32net->FreeMibTable != NULL) + { + return MsCreateAdapterListInnerExVista(no_info); + } + + if (w32net->GetIfTable == NULL) + { + return ZeroMalloc(sizeof(MS_ADAPTER_LIST)); + } + + table = ZeroMalloc(table_size); + + retcode = w32net->GetIfTable(table, &table_size, TRUE); + if (retcode == ERROR_INSUFFICIENT_BUFFER || retcode == ERROR_BUFFER_OVERFLOW) + { + Free(table); + table_size *= 2; + table = ZeroMalloc(table_size); + if (w32net->GetIfTable(table, &table_size, TRUE) != NO_ERROR) + { + Free(table); + return ZeroMalloc(sizeof(MS_ADAPTER_LIST)); + } + } + else if (retcode != NO_ERROR) + { + Free(table); + return ZeroMalloc(sizeof(MS_ADAPTER_LIST)); + } + + o = NewListFast(NULL); + + for (i = 0;i < table->dwNumEntries;i++) + { + MIB_IFROW *r = &table->table[i]; + char title[MAX_PATH]; + UINT num = 0; + MS_ADAPTER *a; + UINT j; + + //if (r->dwOperStatus == MIB_IF_OPER_STATUS_CONNECTED || r->dwOperStatus == MIB_IF_OPER_STATUS_OPERATIONAL) + { + //if (r->dwType & IF_TYPE_ETHERNET_CSMACD) + { + for (j = 1;;j++) + { + UINT k; + bool exists; + if (j == 1) + { + StrCpy(title, sizeof(title), (char *)r->bDescr); + } + else + { + Format(title, sizeof(title), "%s (%u)", (char *)r->bDescr, j); + } + + exists = false; + + for (k = 0;k < LIST_NUM(o);k++) + { + MS_ADAPTER *a = LIST_DATA(o, k); + + if (StrCmpi(a->Title, title) == 0) + { + exists = true; + break; + } + } + + if (exists == false) + { + break; + } + } + + a = ZeroMalloc(sizeof(MS_ADAPTER)); + + // Create an adapter information + StrCpy(a->Title, sizeof(a->Title), title); + StrToUni(a->TitleW, sizeof(a->TitleW), title); + a->Index = r->dwIndex; + a->Type = r->dwType; + a->Status = r->dwOperStatus; + a->Mtu = r->dwMtu; + a->Speed = r->dwSpeed; + a->AddressSize = MIN(sizeof(a->Address), r->dwPhysAddrLen); + Copy(a->Address, r->bPhysAddr, a->AddressSize); + a->RecvBytes = r->dwInOctets; + a->RecvPacketsBroadcast = r->dwInNUcastPkts; + a->RecvPacketsUnicast = r->dwInUcastPkts; + a->SendBytes = r->dwOutOctets; + a->SendPacketsBroadcast = r->dwOutNUcastPkts; + a->SendPacketsUnicast = r->dwOutUcastPkts; + + if (a->Type != IF_TYPE_ETHERNET_CSMACD) + { + a->IsNotEthernetLan = true; + } + + // TCP/IP information acquisition + if (no_info == false) + { + MsGetAdapterTcpIpInformation(a); + } + + Add(o, a); + } + } + } + + ret = ZeroMalloc(sizeof(MS_ADAPTER_LIST)); + ret->Num = LIST_NUM(o); + ret->Adapters = ToArray(o); + + ReleaseList(o); + Free(table); + + return ret; +} + +// Creating an adapters list (Windows Vista version) +MS_ADAPTER_LIST *MsCreateAdapterListInnerExVista(bool no_info) +{ + LIST *o; + UINT i; + UINT retcode; + MIB_IF_TABLE2 *table; + UINT table_size = sizeof(MIB_IFTABLE); + MS_ADAPTER_LIST *ret; + + if (w32net->GetIfTable2 == NULL || w32net->FreeMibTable == NULL) + { + return ZeroMalloc(sizeof(MS_ADAPTER_LIST)); + } + + retcode = w32net->GetIfTable2(&table); + if (retcode != NO_ERROR || table == NULL) + { + return ZeroMalloc(sizeof(MS_ADAPTER_LIST)); + } + + o = NewListFast(NULL); + + for (i = 0;i < table->NumEntries;i++) + { + MIB_IF_ROW2 *r = &table->Table[i]; + wchar_t title[MAX_PATH]; + UINT num = 0; + MS_ADAPTER *a; + UINT j; + + //if (r->dwOperStatus == MIB_IF_OPER_STATUS_CONNECTED || r->dwOperStatus == MIB_IF_OPER_STATUS_OPERATIONAL) + { + //if (r->dwType & IF_TYPE_ETHERNET_CSMACD) + { + for (j = 1;;j++) + { + UINT k; + bool exists; + if (j == 1) + { + UniStrCpy(title, sizeof(title), r->Description); + } + else + { + UniFormat(title, sizeof(title), L"%s (%u)", r->Description, j); + } + + exists = false; + + for (k = 0;k < LIST_NUM(o);k++) + { + MS_ADAPTER *a = LIST_DATA(o, k); + + if (UniStrCmpi(a->TitleW, title) == 0) + { + exists = true; + break; + } + } + + if (exists == false) + { + break; + } + } + + a = ZeroMalloc(sizeof(MS_ADAPTER)); + + // Create an adapter information + UniStrCpy(a->TitleW, sizeof(a->TitleW), title); + UniToStr(a->Title, sizeof(a->Title), title); + a->Index = r->InterfaceIndex; + a->Type = r->Type; + a->Status = ConvertMidStatusVistaToXp(r->OperStatus); + a->Mtu = r->Mtu; + a->Speed = MAX((UINT)r->TransmitLinkSpeed, (UINT)r->ReceiveLinkSpeed); + a->AddressSize = MIN(sizeof(a->Address), r->PhysicalAddressLength); + Copy(a->Address, r->PhysicalAddress, a->AddressSize); + a->RecvBytes = r->InOctets; + a->RecvPacketsBroadcast = r->InNUcastPkts; + a->RecvPacketsUnicast = r->InUcastPkts; + a->SendBytes = r->OutOctets; + a->SendPacketsBroadcast = r->OutNUcastPkts; + a->SendPacketsUnicast = r->OutUcastPkts; + + if (r->MediaType == NdisMediumWirelessWan || r->PhysicalMediumType == NdisPhysicalMediumWirelessLan || + r->PhysicalMediumType == NdisPhysicalMediumWirelessWan || r->PhysicalMediumType == NdisPhysicalMediumWiMax || + r->Type == IF_TYPE_IEEE80211) + { + a->IsWireless = true; + } + + if (a->IsWireless || + r->Type != IF_TYPE_ETHERNET_CSMACD || + r->MediaType != NdisMedium802_3 || + (r->PhysicalMediumType != 0 && r->PhysicalMediumType != NdisPhysicalMedium802_3)) + { + a->IsNotEthernetLan = true; + } + + // TCP/IP information acquisition + if (no_info == false) + { + MsGetAdapterTcpIpInformation(a); + } + + Add(o, a); + } + } + } + + ret = ZeroMalloc(sizeof(MS_ADAPTER_LIST)); + ret->Num = LIST_NUM(o); + ret->Adapters = ToArray(o); + + ReleaseList(o); + w32net->FreeMibTable(table); + + return ret; +} + +// Convert the MIB Operational Status from Vista format to XP format +UINT ConvertMidStatusVistaToXp(UINT st) +{ + switch (st) + { + case IfOperStatusUp: + return MIB_IF_OPER_STATUS_CONNECTED; + + case IfOperStatusDown: + return MIB_IF_OPER_STATUS_DISCONNECTED; + } + + return MIB_IF_OPER_STATUS_NON_OPERATIONAL; +} + +// Release the adapter list +void MsFreeAdapterList(MS_ADAPTER_LIST *o) +{ + UINT i; + // Validate arguments + if (o == NULL) + { + return; + } + + for (i = 0;i < o->Num;i++) + { + MsFreeAdapter(o->Adapters[i]); + } + Free(o->Adapters); + + Free(o); +} + +// Release the adapter information +void MsFreeAdapter(MS_ADAPTER *a) +{ + // Validate arguments + if (a == NULL) + { + return; + } + + Free(a); +} + +// Get the status string of the adapter +wchar_t *MsGetAdapterStatusStr(UINT status) +{ + wchar_t *ret; + + switch (status) + { + case MIB_IF_OPER_STATUS_NON_OPERATIONAL: + ret = _UU("MS_NON_OPERATIONAL"); + break; + + case MIB_IF_OPER_STATUS_UNREACHABLE: + ret = _UU("MS_UNREACHABLE"); + break; + + case MIB_IF_OPER_STATUS_DISCONNECTED: + ret = _UU("MS_DISCONNECTED"); + break; + + case MIB_IF_OPER_STATUS_CONNECTING: + ret = _UU("MS_CONNECTING"); + break; + + case MIB_IF_OPER_STATUS_CONNECTED: + ret = _UU("MS_CONNECTED"); + break; + + default: + ret = _UU("MS_OPERATIONAL"); + break; + } + + return ret; +} + +// Get the type string of the adapter +wchar_t *MsGetAdapterTypeStr(UINT type) +{ + wchar_t *ret; + + switch (type) + { + case IF_TYPE_PROP_VIRTUAL: + ret = _UU("MS_VIRTUAL"); + break; + + case MIB_IF_TYPE_ETHERNET: + ret = _UU("MS_ETHERNET"); + break; + + case IF_TYPE_IEEE80211: + ret = _UU("MS_WLAN"); + break; + + case MIB_IF_TYPE_TOKENRING: + ret = _UU("MS_TOKENRING"); + break; + + case MIB_IF_TYPE_FDDI: + ret = _UU("MS_FDDI"); + break; + + case MIB_IF_TYPE_PPP: + ret = _UU("MS_PPP"); + break; + + case MIB_IF_TYPE_LOOPBACK: + ret = _UU("MS_LOOPBACK"); + break; + + case MIB_IF_TYPE_SLIP: + ret = _UU("MS_SLIP"); + break; + + default: + ret = _UU("MS_OTHER"); + break; + } + + return ret; +} + +// Kill the process of specified EXE file name +UINT MsKillProcessByExeName(wchar_t *name) +{ + LIST *o; + UINT me, i; + UINT num = 0; + // Validate arguments + if (name == NULL) + { + return 0; + } + + o = MsGetProcessList(); + me = MsGetProcessId(); + + for (i = 0;i < LIST_NUM(o);i++) + { + MS_PROCESS *p = LIST_DATA(o, i); + if (p->ProcessId != me) + { + if (UniStrCmpi(p->ExeFilenameW, name) == 0) + { + if (MsKillProcess(p->ProcessId)) + { + num++; + } + } + } + } + + MsFreeProcessList(o); + + return num; +} + +// Terminate all instances except the EXE itself +void MsKillOtherInstance() +{ + MsKillOtherInstanceEx(NULL); +} +void MsKillOtherInstanceEx(char *exclude_svcname) +{ + UINT me, i; + wchar_t me_path[MAX_PATH]; + wchar_t me_path_short[MAX_PATH]; + LIST *o = MsGetProcessList(); + UINT e_procid = 0; + UINT e_procid2 = 0; + + if (exclude_svcname != NULL) + { + e_procid = MsReadCallingServiceManagerProcessId(exclude_svcname, false); + e_procid2 = MsReadCallingServiceManagerProcessId(exclude_svcname, true); + } + + me = MsGetProcessId(); + + MsGetCurrentProcessExeNameW(me_path, sizeof(me_path)); + MsGetShortPathNameW(me_path, me_path_short, sizeof(me_path_short)); + + for (i = 0;i < LIST_NUM(o);i++) + { + MS_PROCESS *p = LIST_DATA(o, i); + if (p->ProcessId != me) + { + if ((e_procid == 0 || (e_procid != p->ProcessId)) && (e_procid2 == 0 || (e_procid2 != p->ProcessId))) + { + wchar_t tmp[MAX_PATH]; + MsGetShortPathNameW(p->ExeFilenameW, tmp, sizeof(tmp)); + if (UniStrCmpi(me_path_short, tmp) == 0) + { + MsKillProcess(p->ProcessId); + } + } + } + } + + MsFreeProcessList(o); +} + +// Get the short file name +bool MsGetShortPathNameA(char *long_path, char *short_path, UINT short_path_size) +{ + // Validate arguments + if (long_path == NULL || short_path == NULL) + { + return false; + } + + if (GetShortPathNameA(long_path, short_path, short_path_size) == 0) + { + StrCpy(short_path, short_path_size, long_path); + return false; + } + + return true; +} +bool MsGetShortPathNameW(wchar_t *long_path, wchar_t *short_path, UINT short_path_size) +{ + // Validate arguments + if (long_path == NULL || short_path == NULL) + { + return false; + } + + if (IsNt() == false) + { + char short_path_a[MAX_SIZE]; + char long_path_a[MAX_SIZE]; + bool ret; + + UniToStr(long_path_a, sizeof(long_path_a), long_path); + + ret = MsGetShortPathNameA(long_path_a, short_path_a, sizeof(short_path_a)); + + StrToUni(short_path, short_path_size, short_path_a); + + return ret; + } + + if (GetShortPathNameW(long_path, short_path, short_path_size) == 0) + { + UniStrCpy(short_path, short_path_size, long_path); + return false; + } + + return true; +} + +// Kill the specified process +bool MsKillProcess(UINT id) +{ + HANDLE h; + // Validate arguments + if (id == 0) + { + return false; + } + + h = OpenProcess(PROCESS_TERMINATE, FALSE, id); + if (h == NULL) + { + return false; + } + + if (TerminateProcess(h, 0) == FALSE) + { + CloseHandle(h); + return false; + } + + CloseHandle(h); + + return true; +} + +// Get the current EXE file name +void MsGetCurrentProcessExeNameW(wchar_t *name, UINT size) +{ + UINT id; + LIST *o; + MS_PROCESS *p; + // Validate arguments + if (name == NULL) + { + return; + } + + id = MsGetCurrentProcessId(); + o = MsGetProcessList(); + p = MsSearchProcessById(o, id); + if (p != NULL) + { + p = MsSearchProcessById(o, id); + UniStrCpy(name, size, p->ExeFilenameW); + } + else + { + UniStrCpy(name, size, MsGetExeFileNameW()); + } + MsFreeProcessList(o); +} + +// Search the process by the process ID +MS_PROCESS *MsSearchProcessById(LIST *o, UINT id) +{ + MS_PROCESS *p, t; + // Validate arguments + if (o == NULL) + { + return NULL; + } + + Zero(&t, sizeof(t)); + t.ProcessId = id; + + p = Search(o, &t); + + return p; +} + +// Compare the Process List items +int MsCompareProcessList(void *p1, void *p2) +{ + MS_PROCESS *e1, *e2; + if (p1 == NULL || p2 == NULL) + { + return 0; + } + e1 = *(MS_PROCESS **)p1; + e2 = *(MS_PROCESS **)p2; + if (e1 == NULL || e2 == NULL) + { + return 0; + } + + if (e1->ProcessId > e2->ProcessId) + { + return 1; + } + else if (e1->ProcessId < e2->ProcessId) + { + return -1; + } + else + { + return 0; + } +} + +// Release of the process list +void MsFreeProcessList(LIST *o) +{ + UINT i; + // Validate arguments + if (o == NULL) + { + return; + } + + for (i = 0;i < LIST_NUM(o);i++) + { + MS_PROCESS *p = LIST_DATA(o, i); + Free(p); + } + + ReleaseList(o); +} + +// Get the Process List (for WinNT) +LIST *MsGetProcessListNt() +{ + LIST *o; + UINT max = 16384; + DWORD *processes; + UINT needed, num; + UINT i; + + o = NewListFast(MsCompareProcessList); + + if (ms->nt->EnumProcesses == NULL) + { + return o; + } + + processes = ZeroMalloc(sizeof(DWORD) * max); + + if (ms->nt->EnumProcesses(processes, sizeof(DWORD) * max, &needed) == FALSE) + { + Free(processes); + return NULL; + } + + num = needed / sizeof(DWORD); + + for (i = 0;i < num;i++) + { + UINT id = processes[i]; + HANDLE h = OpenProcess(PROCESS_QUERY_INFORMATION | PROCESS_VM_READ, + false, id); + + if (h != NULL) + { + HINSTANCE hInst = NULL; + DWORD needed; + char exe[MAX_SIZE]; + wchar_t exe_w[MAX_SIZE]; + bool ok = false; + DWORD sz1, sz2; + + sz1 = sizeof(exe) - 1; + sz2 = sizeof(exe_w) / sizeof(wchar_t) - 1; + + if (ms->nt->EnumProcessModules(h, &hInst, sizeof(hInst), &needed) == false) + { + hInst = NULL; + } + + if (ms->nt->GetModuleFileNameExA(h, hInst, exe, sizeof(exe) - 1) && + ms->nt->GetModuleFileNameExW(h, hInst, exe_w, sizeof(exe_w) / sizeof(wchar_t) - 1)) + { + ok = true; + } + else if (ms->nt->QueryFullProcessImageNameA != NULL && + ms->nt->QueryFullProcessImageNameW != NULL && + ms->nt->QueryFullProcessImageNameA(h, 0, exe, &sz1) && + ms->nt->QueryFullProcessImageNameW(h, 0, exe_w, &sz2)) + { + ok = true; + } + + if (ok) + { + MS_PROCESS *p = ZeroMalloc(sizeof(MS_PROCESS)); + + StrCpy(p->ExeFilename, sizeof(p->ExeFilename), exe); + UniStrCpy(p->ExeFilenameW, sizeof(p->ExeFilenameW), exe_w); + p->ProcessId = id; + + Add(o, p); + } + + CloseHandle(h); + } + } + + Sort(o); + + Free(processes); + + return o; +} + +// Get the Process List (for Win9x) +LIST *MsGetProcessList9x() +{ + HANDLE h; + LIST *o; + HANDLE (WINAPI *CreateToolhelp32Snapshot)(DWORD, DWORD); + BOOL (WINAPI *Process32First)(HANDLE, LPPROCESSENTRY32); + BOOL (WINAPI *Process32Next)(HANDLE, LPPROCESSENTRY32); + + CreateToolhelp32Snapshot = + (HANDLE (__stdcall *)(DWORD,DWORD)) + GetProcAddress(ms->hKernel32, "CreateToolhelp32Snapshot"); + Process32First = + (BOOL (__stdcall *)(HANDLE,LPPROCESSENTRY32)) + GetProcAddress(ms->hKernel32, "Process32First"); + Process32Next = + (BOOL (__stdcall *)(HANDLE,LPPROCESSENTRY32)) + GetProcAddress(ms->hKernel32, "Process32Next"); + + o = NewListFast(MsCompareProcessList); + + if (CreateToolhelp32Snapshot != NULL && Process32First != NULL && Process32Next != NULL) + { + h = CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0); + if (h != INVALID_HANDLE_VALUE) + { + PROCESSENTRY32 e; + Zero(&e, sizeof(e)); + e.dwSize = sizeof(e); + + if (Process32First(h, &e)) + { + while (true) + { + MS_PROCESS *p = ZeroMalloc(sizeof(MS_PROCESS)); + StrCpy(p->ExeFilename, sizeof(p->ExeFilename), e.szExeFile); + StrToUni(p->ExeFilenameW, sizeof(p->ExeFilenameW), p->ExeFilename); + p->ProcessId = e.th32ProcessID; + Add(o, p); + if (Process32Next(h, &e) == false) + { + break; + } + } + } + CloseHandle(h); + } + } + + Sort(o); + + return o; +} + +// Get the Process List +LIST *MsGetProcessList() +{ + if (MsIsNt() == false) + { + // Windows 9x + return MsGetProcessList9x(); + } + else + { + // Windows NT, 2000, XP + return MsGetProcessListNt(); + } +} + +// Force to run the current thread on a single CPU +void MsSetThreadSingleCpu() +{ + SetThreadAffinityMask(GetCurrentThread(), 1); +} + +// Playback of sound +void MsPlaySound(char *name) +{ + char tmp[MAX_SIZE]; + char wav[MAX_SIZE]; + char *temp; + BUF *b; + // Validate arguments + if (name == NULL) + { + return; + } + + Format(tmp, sizeof(tmp), "|%s", name); + + b = ReadDump(tmp); + if (b == NULL) + { + return; + } + + temp = MsGetMyTempDir(); + Format(wav, sizeof(tmp), "%s\\%s", temp, name); + DumpBuf(b, wav); + + PlaySound(wav, NULL, SND_ASYNC | SND_FILENAME | SND_NODEFAULT); + + FreeBuf(b); +} + +// Show an icon in the task tray +bool MsShowIconOnTray(HWND hWnd, HICON icon, wchar_t *tooltip, UINT msg) +{ + bool ret = true; + // Validate arguments + if (hWnd == NULL || icon == NULL) + { + return true; + } + + if (MsIsNt() == false) + { + Zero(&nid, sizeof(nid)); + nid.cbSize = sizeof(nid); + nid.hWnd = hWnd; + nid.uID = 1; + nid.uFlags = NIF_ICON | NIF_MESSAGE | NIF_TIP | NIF_INFO; + nid.uCallbackMessage = msg; + nid.hIcon = icon; + UniToStr(nid.szTip, sizeof(nid.szTip), tooltip); + ret = Shell_NotifyIcon(NIM_ADD, &nid); + } + else + { + Zero(&nid_nt, sizeof(nid_nt)); + nid_nt.cbSize = sizeof(nid_nt); + nid_nt.hWnd = hWnd; + nid_nt.uID = 1; + nid_nt.uFlags = NIF_ICON | NIF_MESSAGE | NIF_TIP | NIF_INFO; + nid_nt.uCallbackMessage = msg; + nid_nt.hIcon = icon; + UniStrCpy(nid_nt.szTip, sizeof(nid_nt.szTip), tooltip); + + ret = Shell_NotifyIconW(NIM_ADD, &nid_nt); + } + + tray_inited = true; + + return ret; +} + +// Restore the icon in the task tray +void MsRestoreIconOnTray() +{ + if (tray_inited == false) + { + return; + } + + if (MsIsNt() == false) + { + Shell_NotifyIcon(NIM_ADD, &nid); + } + else + { + Shell_NotifyIconW(NIM_ADD, &nid_nt); + } +} + +// Change the icon in the task tray +void MsChangeIconOnTray(HICON icon, wchar_t *tooltip) +{ + MsChangeIconOnTrayEx(icon, tooltip, NULL, NULL, NIIF_NONE, false); +} +bool MsChangeIconOnTrayEx(HICON icon, wchar_t *tooltip, wchar_t *info_title, wchar_t *info, UINT info_flags, bool add) +{ + bool changed = false; + bool ret = true; + + if (tray_inited == false) + { + return ret; + } + + if (icon != NULL) + { + if (MsIsNt() == false) + { + if (nid.hIcon != icon) + { + changed = true; + nid.hIcon = icon; + } + } + else + { + if (nid_nt.hIcon != icon) + { + changed = true; + nid_nt.hIcon = icon; + } + } + } + + if (tooltip != NULL) + { + if (MsIsNt() == false) + { + char tmp[MAX_SIZE]; + + UniToStr(tmp, sizeof(tmp), tooltip); + + if (StrCmp(nid.szTip, tmp) != 0) + { + StrCpy(nid.szTip, sizeof(nid.szTip), tmp); + changed = true; + } + } + else + { + wchar_t tmp[MAX_SIZE]; + + UniStrCpy(tmp, sizeof(tmp), tooltip); + + if (UniStrCmp(nid_nt.szTip, tmp) != 0) + { + UniStrCpy(nid_nt.szTip, sizeof(nid_nt.szTip), tmp); + changed = true; + } + } + } + + if (info_title != NULL && info != NULL) + { + if (MsIsNt() == false) + { + char tmp1[MAX_SIZE]; + char tmp2[MAX_PATH]; + + UniToStr(tmp1, sizeof(tmp1), info_title); + UniToStr(tmp2, sizeof(tmp2), info); + + if (StrCmp(nid.szInfo, tmp1) != 0 || + StrCmp(nid.szInfoTitle, tmp2) != 0) + { + StrCpy(nid.szInfo, sizeof(nid.szInfo), tmp1); + StrCpy(nid.szInfoTitle, sizeof(nid.szInfoTitle), tmp2); + nid.dwInfoFlags = info_flags; + + changed = true; + } + } + else + { + wchar_t tmp1[MAX_SIZE]; + wchar_t tmp2[MAX_PATH]; + + UniStrCpy(tmp1, sizeof(tmp1), info_title); + UniStrCpy(tmp2, sizeof(tmp2), info); + + if (UniStrCmp(nid_nt.szInfo, tmp1) != 0 || + UniStrCmp(nid_nt.szInfoTitle, tmp2) != 0) + { + UniStrCpy(nid_nt.szInfo, sizeof(nid_nt.szInfo), tmp1); + UniStrCpy(nid_nt.szInfoTitle, sizeof(nid_nt.szInfoTitle), tmp2); + nid_nt.dwInfoFlags = info_flags; + + changed = true; + } + } + } + + if (changed || add) + { + UINT op = (add ? NIM_ADD : NIM_MODIFY); + if (MsIsNt() == false) + { + ret = Shell_NotifyIcon(op, &nid); + } + else + { + ret = Shell_NotifyIconW(op, &nid_nt); + } + } + + return ret; +} + +// Remove the icon in the task tray +void MsHideIconOnTray() +{ + if (MsIsNt() == false) + { + Shell_NotifyIcon(NIM_DELETE, &nid); + } + else + { + Shell_NotifyIconW(NIM_DELETE, &nid_nt); + } + + tray_inited = false; +} + +// Insert a menu item +bool MsInsertMenu(HMENU hMenu, UINT pos, UINT flags, UINT_PTR id_new_item, wchar_t *lp_new_item) +{ + bool ret; + + if (MsIsNt()) + { + ret = InsertMenuW(hMenu, pos, flags, id_new_item, lp_new_item); + } + else + { + char *s = CopyUniToStr(lp_new_item); + ret = InsertMenuA(hMenu, pos, flags, id_new_item, s); + Free(s); + } + + return ret; +} + +// Adding a menu item +bool MsAppendMenu(HMENU hMenu, UINT flags, UINT_PTR id, wchar_t *str) +{ + bool ret; + + if (MsIsNt()) + { + ret = AppendMenuW(hMenu, flags, id, str); + } + else + { + char *s = CopyUniToStr(str); + ret = AppendMenuA(hMenu, flags, id, s); + Free(s); + } + + return ret; +} + +// Display the menu +void MsUserModeTrayMenu(HWND hWnd) +{ + HMENU h; + POINT p; + wchar_t tmp[MAX_SIZE]; + wchar_t caption[MAX_SIZE]; + // Validate arguments + if (hWnd == NULL) + { + return; + } + + // Create a menu + h = CreatePopupMenu(); + MsAppendMenu(h, MF_ENABLED | MF_STRING, 10001, _UU("SVC_USERMODE_MENU_1")); + MsAppendMenu(h, MF_SEPARATOR, 10002, NULL); + + if (MsIsNt()) + { + GetWindowTextW(hWnd, caption, sizeof(caption)); + } + else + { + char tmp[MAX_SIZE]; + GetWindowTextA(hWnd, tmp, sizeof(tmp)); + StrToUni(caption, sizeof(caption), tmp); + } + + UniFormat(tmp, sizeof(tmp), _UU("SVC_USERMODE_MENU_2"), caption); + MsAppendMenu(h, MF_ENABLED | MF_STRING, 10003, tmp); + + // Display the menu + GetCursorPos(&p); + + SetForegroundWindow(hWnd); + TrackPopupMenu(h, TPM_LEFTALIGN, p.x, p.y, 0, hWnd, NULL); + PostMessage(hWnd, WM_NULL, 0, 0); + + DestroyMenu(h); +} + +// Window procedure for the user mode +LRESULT CALLBACK MsUserModeWindowProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam) +{ + wchar_t tmp[MAX_SIZE]; + char title[MAX_SIZE]; + wchar_t title_w[MAX_SIZE]; + char value_name[MAX_SIZE]; + static UINT taskbar_msg = 0; + // Validate arguments + if (hWnd == NULL) + { + return 0; + } + + if (msg == taskbar_msg && taskbar_msg != 0) + { + // The taskbar was regenerated + if (MsRegReadInt(REG_CURRENT_USER, SVC_USERMODE_SETTING_KEY, value_name) == 0 && + service_for_9x_mode == false) + { + MsRestoreIconOnTray(); + } + } + + switch (msg) + { + case WM_ENDSESSION: + // Resume + if (wParam == false) + { + break; + } + case WM_CREATE: + // Start + exiting = false; + g_start(); + GetWindowText(hWnd, title, sizeof(title)); + StrToUni(title_w, sizeof(title_w), title); + UniFormat(tmp, sizeof(tmp), _UU("SVC_TRAY_TOOLTIP"), title); + + if (taskbar_msg == 0) + { + taskbar_msg = RegisterWindowMessage("TaskbarCreated"); + } + + Format(value_name, sizeof(value_name), SVC_HIDETRAY_REG_VALUE, title_w); + if (MsRegReadInt(REG_CURRENT_USER, SVC_USERMODE_SETTING_KEY, value_name) == 0 && + service_for_9x_mode == false) + { + MsShowIconOnTray(hWnd, tray_icon, tmp, WM_APP + 33); + } + + break; + case WM_APP + 33: + if (wParam == 1) + { + // The operation to the icon in the task tray + switch (lParam) + { + case WM_RBUTTONDOWN: + // Right click + MsUserModeTrayMenu(hWnd); + break; + case WM_LBUTTONDBLCLK: + // Left double-click + break; + } + } + break; + case WM_LBUTTONDOWN: + MsUserModeTrayMenu(hWnd); + break; + case WM_QUERYENDSESSION: + if (exiting == false) + { + exiting = true; + MsHideIconOnTray(); + g_stop(); + DestroyWindow(hWnd); + } + return TRUE; + case WM_CLOSE: + // Stop + if (exiting == false) + { + exiting = true; + g_stop(); + MsHideIconOnTray(); + DestroyWindow(hWnd); + } + break; + case WM_DESTROY: + wnd_end = true; + break; + case WM_COMMAND: + switch (wParam) + { + case 10001: + GetWindowText(hWnd, title, sizeof(title)); + StrToUni(title_w, sizeof(title_w), title); + // Display a confirmation message + if (MsgBoxEx(hWnd, MB_ICONINFORMATION | MB_OKCANCEL | MB_DEFBUTTON2 | + MB_SYSTEMMODAL, _UU("SVC_HIDE_TRAY_MSG"), title, title) == IDOK) + { + char tmp[MAX_SIZE]; + Format(tmp, sizeof(tmp), SVC_HIDETRAY_REG_VALUE, title_w); + // Write to the registry + MsRegWriteInt(REG_CURRENT_USER, SVC_USERMODE_SETTING_KEY, tmp, 1); + // Hide the icon + MsHideIconOnTray(); + } + break; + case 10003: + SendMessage(hWnd, WM_CLOSE, 0, 0); + break; + } + break; + } + return DefWindowProc(hWnd, msg, wParam, lParam); +} + +// Get whether this instance is in user mode +bool MsIsUserMode() +{ + return is_usermode; +} + +// Only run the test (for debugging) +void MsTestOnly() +{ + g_start(); + GetLine(NULL, 0); + g_stop(); + + _exit(0); +} + +// Stop the user-mode service +void MsStopUserModeSvc(char *svc_name) +{ + void *p; + // Validate arguments + if (svc_name == NULL) + { + return; + } + + p = MsCreateUserModeSvcGlocalPulse(svc_name); + if (p == NULL) + { + return; + } + + MsSendGlobalPulse(p); + + MsCloseGlobalPulse(p); +} + +// Creating a global pulse for user-mode service +void *MsCreateUserModeSvcGlocalPulse(char *svc_name) +{ + char name[MAX_SIZE]; + // Validate arguments + if (svc_name == NULL) + { + return NULL; + } + + MsGenerateUserModeSvcGlobalPulseName(name, sizeof(name), svc_name); + + return MsOpenOrCreateGlobalPulse(name); +} + +// Get the global pulse name for the user-mode service +void MsGenerateUserModeSvcGlobalPulseName(char *name, UINT size, char *svc_name) +{ + wchar_t tmp[MAX_SIZE]; + UCHAR hash[SHA1_SIZE]; + // Validate arguments + if (name == NULL || svc_name == NULL) + { + return; + } + + UniFormat(tmp, sizeof(tmp), L"usersvc_%S_@_%s", svc_name, MsGetUserNameW()); + + UniTrim(tmp); + UniStrUpper(tmp); + + Sha1(hash, tmp, UniStrLen(tmp) * sizeof(wchar_t)); + + BinToStr(name, size, hash, sizeof(hash)); +} + +// Declare the beginning of use of a VLAN card +void MsBeginVLanCard() +{ + Inc(vlan_card_counter); +} + +// Declare the ending of use of a VLAN card +void MsEndVLanCard() +{ + Dec(vlan_card_counter); +} + +// Return the flag whether the VLAN cards must be stopped +bool MsIsVLanCardShouldStop() +{ + return vlan_card_should_stop_flag; +} + +// Suspend procs +void MsProcEnterSuspend() +{ + UINT64 giveup_tick = Tick64() + 2000; + UINT num = Count(vlan_card_counter); + + vlan_is_in_suspend_mode = true; + + vlan_card_should_stop_flag = true; + + vlan_suspend_mode_begin_tick = Tick64(); + + while (true) + { + UINT64 now = Tick64(); + + if (now >= giveup_tick) + { + break; + } + + if (Count(vlan_card_counter) == 0) + { + break; + } + + SleepThread(100); + } + + if (num >= 1) + { + SleepThread(3000); + } +} +void MsProcLeaveSuspend() +{ + vlan_card_should_stop_flag = false; + vlan_is_in_suspend_mode = false; + vlan_suspend_mode_begin_tick = Tick64(); +} +UINT64 MsGetSuspendModeBeginTick() +{ + if (vlan_is_in_suspend_mode) + { + return Tick64(); + } + + return vlan_suspend_mode_begin_tick; +} + +// Suspend handler window proc +LRESULT CALLBACK MsSuspendHandlerWindowProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam) +{ + MS_SUSPEND_HANDLER *h; + CREATESTRUCT *cs; + // Validate arguments + if (hWnd == NULL) + { + return 0; + } + + h = (MS_SUSPEND_HANDLER *)GetWindowLongPtrA(hWnd, GWLP_USERDATA); + if (h == NULL && msg != WM_CREATE) + { + goto LABEL_END; + } + + switch (msg) + { + case WM_CREATE: + cs = (CREATESTRUCT *)lParam; + h = (MS_SUSPEND_HANDLER *)cs->lpCreateParams; + SetWindowLongPtrA(hWnd, GWLP_USERDATA, (LONG_PTR)h); + break; + + case WM_POWERBROADCAST: + if (MsIsVista()) + { + switch (wParam) + { + case PBT_APMSUSPEND: + MsProcEnterSuspend(); + return 1; + + case PBT_APMRESUMEAUTOMATIC: + case PBT_APMRESUMESUSPEND: + MsProcLeaveSuspend(); + return 1; + } + } + break; + + case WM_CLOSE: + /*if (h->AboutToClose == false) + { + return 0; + }*/ + break; + + case WM_DESTROY: + PostQuitMessage(0); + break; + } + +LABEL_END: + return DefWindowProc(hWnd, msg, wParam, lParam); +} + +// Suspend handler thread +void MsSuspendHandlerThreadProc(THREAD *thread, void *param) +{ + char wndclass_name[MAX_PATH]; + WNDCLASS wc; + HWND hWnd; + MSG msg; + MS_SUSPEND_HANDLER *h = (MS_SUSPEND_HANDLER *)param; + // Validate arguments + if (h == NULL || thread == NULL) + { + return; + } + + Format(wndclass_name, sizeof(wndclass_name), "WNDCLASS_%X", Rand32()); + + Zero(&wc, sizeof(wc)); + wc.hbrBackground = (HBRUSH)GetStockObject(WHITE_BRUSH); + wc.hCursor = LoadCursor(NULL, IDC_ARROW); + wc.hIcon = NULL; + wc.hInstance = ms->hInst; + wc.lpfnWndProc = MsSuspendHandlerWindowProc; + wc.lpszClassName = wndclass_name; + if (RegisterClassA(&wc) == 0) + { + NoticeThreadInit(thread); + return; + } + + hWnd = CreateWindowA(wndclass_name, wndclass_name, WS_OVERLAPPEDWINDOW, + CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, + NULL, NULL, ms->hInst, h); + + h->hWnd = hWnd; + + NoticeThreadInit(thread); + + if (hWnd == NULL) + { + UnregisterClassA(wndclass_name, ms->hInst); + return; + } + + //ShowWindow(hWnd, SW_SHOWNORMAL); + + while (GetMessage(&msg, NULL, 0, 0)) + { + TranslateMessage(&msg); + DispatchMessage(&msg); + } + + vlan_card_should_stop_flag = false; + vlan_is_in_suspend_mode = false; + vlan_suspend_mode_begin_tick = 0; + + DestroyWindow(hWnd); + + UnregisterClassA(wndclass_name, ms->hInst); +} + +// New suspend handler +MS_SUSPEND_HANDLER *MsNewSuspendHandler() +{ + THREAD *t; + MS_SUSPEND_HANDLER *h; + + if (Inc(suspend_handler_singleton) >= 2) + { + Dec(suspend_handler_singleton); + return NULL; + } + + vlan_card_should_stop_flag = false; + vlan_is_in_suspend_mode = false; + vlan_suspend_mode_begin_tick = 0; + + h = ZeroMalloc(sizeof(MS_SUSPEND_HANDLER)); + + t = NewThread(MsSuspendHandlerThreadProc, h); + + WaitThreadInit(t); + + h->Thread = t; + + return h; +} + +void MsFreeSuspendHandler(MS_SUSPEND_HANDLER *h) +{ + // Validate arguments + if (h == NULL) + { + return; + } + + if (h->hWnd != NULL) + { + h->AboutToClose = true; + PostMessageA(h->hWnd, WM_CLOSE, 0, 0); + } + + WaitThread(h->Thread, INFINITE); + ReleaseThread(h->Thread); + + Free(h); + + Dec(suspend_handler_singleton); + + vlan_card_should_stop_flag = false; +} + +// Start in user mode +void MsUserModeW(wchar_t *title, SERVICE_FUNCTION *start, SERVICE_FUNCTION *stop, UINT icon) +{ + WNDCLASS wc; + HINSTANCE hDll; + HWND hWnd; + MSG msg; + INSTANCE *inst; + char title_a[MAX_PATH]; + MS_USERMODE_SVC_PULSE_THREAD_PARAM p; + THREAD *recv_thread = NULL; + // Validate arguments + if (title == NULL || start == NULL || stop == NULL) + { + return; + } + + UniToStr(title_a, sizeof(title_a), title); + + is_usermode = true; + g_start = start; + g_stop = stop; + + inst = NewSingleInstance(NULL); + if (inst == NULL) + { + if (service_for_9x_mode == false) + { + // Do not display an error if Win9x service mode + MsgBoxEx(NULL, MB_ICONINFORMATION, _UU("SVC_USERMODE_MUTEX"), ms->ExeFileNameW); + } + return; + } + + if (Is64()) + { + hDll = MsLoadLibraryAsDataFile(PENCORE_DLL_NAME); + } + else + { + hDll = MsLoadLibrary(PENCORE_DLL_NAME); + } + + // Read icon + tray_icon = LoadImage(hDll, MAKEINTRESOURCE(icon), IMAGE_ICON, 16, 16, + (MsIsNt() ? LR_SHARED : 0) | LR_VGACOLOR); + + // Creating the main window + Zero(&wc, sizeof(wc)); + wc.hbrBackground = (HBRUSH)GetStockObject(WHITE_BRUSH); + wc.hCursor = LoadCursor(NULL,IDC_ARROW); + wc.hIcon = LoadIcon(hDll, MAKEINTRESOURCE(icon)); + wc.hInstance = ms->hInst; + wc.lpfnWndProc = MsUserModeWindowProc; + wc.lpszClassName = title_a; + if (RegisterClass(&wc) == 0) + { + return; + } + + hWnd = CreateWindow(title_a, title_a, WS_OVERLAPPEDWINDOW, + CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, + NULL, NULL, ms->hInst, NULL); + + if (hWnd == NULL) + { + return; + } + + Zero(&p, sizeof(p)); + p.hWnd = hWnd; + p.GlobalPulse = MsCreateUserModeSvcGlocalPulse(g_service_name); + + if (p.GlobalPulse != NULL) + { + // Start the global pulse monitoring thread for termination + p.Halt = false; + + recv_thread = NewThread(MsUserModeGlobalPulseRecvThread, &p); + } + + hWndUsermode = hWnd; + + wnd_end = false; + // Window loop + while (wnd_end == false) + { + GetMessage(&msg, NULL, 0, 0); + TranslateMessage(&msg); + DispatchMessage(&msg); + } + + FreeSingleInstance(inst); + + p.hWnd = NULL; + + hWndUsermode = NULL; + + if (p.GlobalPulse != NULL) + { + // Terminate the monitoring thread of termination global pulse + p.Halt = true; + MsSendGlobalPulse(p.GlobalPulse); + + WaitThread(recv_thread, INFINITE); + ReleaseThread(recv_thread); + + MsCloseGlobalPulse(p.GlobalPulse); + } + + // Might abort + _exit(0); +} + +// The thread that wait for global pulse to stop the user mode service +void MsUserModeGlobalPulseRecvThread(THREAD *thread, void *param) +{ + MS_USERMODE_SVC_PULSE_THREAD_PARAM *p = (MS_USERMODE_SVC_PULSE_THREAD_PARAM *)param; + // Validate arguments + if (thread == NULL || p == NULL) + { + return; + } + + while (p->Halt == false) + { + if (MsWaitForGlobalPulse(p->GlobalPulse, INFINITE)) + { + break; + } + } + + if (p->hWnd != NULL) + { + PostMessageA(p->hWnd, WM_CLOSE, 0, 0); + } +} + +// Service stopping procedure main thread +void MsServiceStoperMainThread(THREAD *t, void *p) +{ + // Stopping procedure + g_stop(); +} + +// Service stop procedure +bool MsServiceStopProc() +{ + THREAD *thread; + bool ret = true; + UINT64 selfkill_timeout = Tick64() + SVC_SELFKILL_TIMEOUT; + + thread = NewThread(MsServiceStoperMainThread, NULL); + + while (WaitThread(thread, 250) == false) + { + if (Tick64() >= selfkill_timeout) + { + // Suicide when it freezes + ret = false; + break; + } + // During stopping procedure to complete, call the SetServiceStatus periodically + status.dwWin32ExitCode = 0; + status.dwWaitHint = 100000; + status.dwCheckPoint++; + status.dwCurrentState = SERVICE_STOP_PENDING; + _SetServiceStatus(ssh, &status); + } + + // Report that the stopping is complete + status.dwWin32ExitCode = 0; + status.dwWaitHint = 0; + status.dwCheckPoint = 0; + status.dwCurrentState = SERVICE_STOPPED; + _SetServiceStatus(ssh, &status); + + if (ret == false) + { + // Force termination here if this has committed suicide + _exit(-1); + } + else + { + ReleaseThread(thread); + } + + return ret; +} + +// Service handler +void CALLBACK MsServiceHandler(UINT opcode) +{ + switch (opcode) + { + case SERVICE_CONTROL_SHUTDOWN: + case SERVICE_CONTROL_STOP: + // Stopping request + status.dwWin32ExitCode = 0; + status.dwWaitHint = 100000; + status.dwCheckPoint = 0; + status.dwCurrentState = SERVICE_STOP_PENDING; + + // Set the stopping event + if (service_stop_event != NULL) + { + SetEvent(service_stop_event); + } + break; + } + + _SetServiceStatus(ssh, &status); +} + +// Dispatch function of the service +void CALLBACK MsServiceDispatcher(UINT argc, LPTSTR *argv) +{ + // Creating a stopping event + service_stop_event = CreateEventA(NULL, true, false, NULL); + + // Preparing for the service + Zero(&status, sizeof(status)); + status.dwServiceType = SERVICE_WIN32; + status.dwCurrentState = SERVICE_START_PENDING; + status.dwControlsAccepted = SERVICE_ACCEPT_STOP | SERVICE_ACCEPT_SHUTDOWN; + + ssh = _RegisterServiceCtrlHandler(g_service_name, MsServiceHandler); + + if (ssh == NULL) + { + MessageBox(NULL, "RegisterServiceCtrlHandler() Failed.", "MsServiceDispatcher()", MB_SETFOREGROUND | MB_TOPMOST | MB_SERVICE_NOTIFICATION | MB_OK | MB_ICONEXCLAMATION); + return; + } + + status.dwWaitHint = 300000; + status.dwCheckPoint = 0; + status.dwCheckPoint++; + status.dwCurrentState = SERVICE_START_PENDING; + _SetServiceStatus(ssh, &status); + + // Report the start completion + status.dwWaitHint = 0; + status.dwCheckPoint = 0; + status.dwCurrentState = SERVICE_RUNNING; + _SetServiceStatus(ssh, &status); + + //// Initialization + // Start of the Mayaqua +#if defined(_DEBUG) || defined(DEBUG) // In VC++ compilers, the macro is "_DEBUG", not "DEBUG". + // If set memcheck = true, the program will be vitally slow since it will log all malloc() / realloc() / free() calls to find the cause of memory leak. + // For normal debug we set memcheck = false. + // Please set memcheck = true if you want to test the cause of memory leaks. + InitMayaqua(false, true, 0, NULL); +#else + InitMayaqua(false, false, 0, NULL); +#endif + + // Stop the MS-IME + MsDisableIme(); + + // Service operation start + g_start(); + MsUpdateServiceConfig(g_service_name); + + // Wait for the stopping event to be signaled state + WaitForSingleObject(service_stop_event, INFINITE); + + // Service operation stop + MsServiceStopProc(); +} + +// Start as a test mode +void MsTestMode(char *title, SERVICE_FUNCTION *start, SERVICE_FUNCTION *stop) +{ + wchar_t *title_w = CopyStrToUni(title); + + MsTestModeW(title_w, start, stop); + Free(title_w); +} +void MsTestModeW(wchar_t *title, SERVICE_FUNCTION *start, SERVICE_FUNCTION *stop) +{ + INSTANCE *inst; + // Validate arguments + if (title == NULL || start == NULL || stop == NULL) + { + return; + } + + is_usermode = true; + + inst = NewSingleInstance(NULL); + if (inst == NULL) + { + // Already started + MsgBoxEx(NULL, MB_ICONINFORMATION, _UU("SVC_TEST_MUTEX"), ms->ExeFileNameW); + return; + } + + // Start + start(); + + // Display the message + MsgBoxEx(NULL, MB_ICONINFORMATION | MB_SYSTEMMODAL, _UU("SVC_TEST_MSG"), title); + + // Stop + stop(); + + FreeSingleInstance(inst); +} + +// Write the process ID of the process which is calling the service manager +void MsWriteCallingServiceManagerProcessId(char *svcname, UINT pid) +{ + char tmp[MAX_PATH]; + + Format(tmp, sizeof(tmp), SVC_CALLING_SM_PROCESS_ID_KEY, svcname); + + if (pid != 0) + { + MsRegWriteInt(REG_LOCAL_MACHINE, tmp, SVC_CALLING_SM_PROCESS_ID_VALUE, pid); + MsRegWriteInt(REG_CURRENT_USER, tmp, SVC_CALLING_SM_PROCESS_ID_VALUE, pid); + } + else + { + MsRegDeleteValue(REG_LOCAL_MACHINE, tmp, SVC_CALLING_SM_PROCESS_ID_VALUE); + MsRegDeleteKey(REG_LOCAL_MACHINE, tmp); + + MsRegDeleteValue(REG_CURRENT_USER, tmp, SVC_CALLING_SM_PROCESS_ID_VALUE); + MsRegDeleteKey(REG_CURRENT_USER, tmp); + } +} + +// Get the process ID of the process which is calling the service manager +UINT MsReadCallingServiceManagerProcessId(char *svcname, bool current_user) +{ + char tmp[MAX_PATH]; + // Validate arguments + if (svcname == NULL) + { + return 0; + } + + Format(tmp, sizeof(tmp), SVC_CALLING_SM_PROCESS_ID_KEY, svcname); + + return MsRegReadInt(current_user ? REG_CURRENT_USER : REG_LOCAL_MACHINE, tmp, SVC_CALLING_SM_PROCESS_ID_VALUE); +} + +// Service main function +UINT MsService(char *name, SERVICE_FUNCTION *start, SERVICE_FUNCTION *stop, UINT icon, char *cmd_line) +{ + UINT mode; + UINT ret = 0; + char *arg; + wchar_t *arg_w; + TOKEN_LIST *t = NULL; + UNI_TOKEN_LIST *ut = NULL; + char *service_name; + wchar_t *service_title; + wchar_t *service_description; + wchar_t *service_title_uni; + char tmp[MAX_SIZE]; + bool restoreReg = false; + bool silent = false; + bool is_win32_service_mode = false; + // Validate arguments + if (name == NULL || start == NULL || stop == NULL) + { + return ret; + } + + g_start = start; + g_stop = stop; + StrCpy(g_service_name, sizeof(g_service_name), name); + StrLower(g_service_name); + + // Determine whether it's in Win32 service mode + if (cmd_line != NULL && lstrcmpiA(cmd_line, SVC_ARG_SERVICE) == 0) + { + HINSTANCE h_advapi32 = LoadLibraryA("advapi32.dll"); + + if (h_advapi32 != NULL) + { + // Check whether there is the SCM in the service mode + _StartServiceCtrlDispatcher = + (BOOL (__stdcall *)(const LPSERVICE_TABLE_ENTRY)) + GetProcAddress(h_advapi32, "StartServiceCtrlDispatcherW"); + + _RegisterServiceCtrlHandler = + (SERVICE_STATUS_HANDLE (__stdcall *)(LPCTSTR,LPHANDLER_FUNCTION)) + GetProcAddress(h_advapi32, "RegisterServiceCtrlHandlerW"); + + _SetServiceStatus = + (BOOL (__stdcall *)(SERVICE_STATUS_HANDLE,LPSERVICE_STATUS)) + GetProcAddress(h_advapi32, "SetServiceStatus"); + + if (_StartServiceCtrlDispatcher != NULL && + _RegisterServiceCtrlHandler != NULL && + _SetServiceStatus != NULL) + { + is_win32_service_mode = true; + } + } + } + + // Run the service using the SCM in the case of Win32 service mode + if (is_win32_service_mode) + { + SERVICE_TABLE_ENTRY dispatch_table[] = + { + {"", MsServiceDispatcher}, + {NULL, NULL}, + }; + + MsSetErrorModeToSilent(); + + if (_StartServiceCtrlDispatcher(dispatch_table) == false) + { + MessageBox(NULL, "StartServiceCtrlDispatcher() Failed.", "MsServiceMode()", MB_SETFOREGROUND | MB_TOPMOST | MB_SERVICE_NOTIFICATION | MB_OK | MB_ICONEXCLAMATION); + } + else + { + MsUpdateServiceConfig(g_service_name); + } + + // Abort here in the case of using the SCM + _exit(0); + return 0; + } + + // Start of the Mayaqua +#if defined(_DEBUG) || defined(DEBUG) // In VC++ compilers, the macro is "_DEBUG", not "DEBUG". + // If set memcheck = true, the program will be vitally slow since it will log all malloc() / realloc() / free() calls to find the cause of memory leak. + // For normal debug we set memcheck = false. + // Please set memcheck = true if you want to test the cause of memory leaks. + InitMayaqua(false, true, 0, NULL); +#else + InitMayaqua(false, false, 0, NULL); +#endif + + // Stop the MS-IME + MsDisableIme(); + + // Get the information about the service from the string table + Format(tmp, sizeof(tmp), SVC_NAME, name); + service_name = _SS(tmp); + Format(tmp, sizeof(tmp), SVC_TITLE, name); + service_title = _UU(tmp); + service_title_uni = _UU(tmp); + Format(tmp, sizeof(tmp), SVC_DESCRIPT, name); + service_description = _UU(tmp); + + if (StrLen(service_name) == 0 || UniStrLen(service_title) == 0) + { + // The service information isn't found + MsgBoxEx(NULL, MB_ICONSTOP, _UU("SVC_NOT_FOUND"), name); + } + else + { + wchar_t path[MAX_SIZE]; + // Check the argument + mode = SVC_MODE_NONE; + + t = GetCommandLineToken(); + arg = NULL; + + ut = GetCommandLineUniToken(); + arg_w = NULL; + + if (t->NumTokens >= 1) + { + arg = t->Token[0]; + } + if(t->NumTokens >= 2) + { + if(StrCmpi(t->Token[1], SVC_ARG_SILENT) == 0) + { + silent = true; + } + } + + if (ut->NumTokens >= 1) + { + arg_w = ut->Token[0]; + } + + if (arg != NULL) + { + if (StrCmpi(arg, SVC_ARG_INSTALL) == 0) + { + mode = SVC_MODE_INSTALL; + } + if (StrCmpi(arg, SVC_ARG_UNINSTALL) == 0) + { + mode = SVC_MODE_UNINSTALL; + } + if (StrCmpi(arg, SVC_ARG_START) == 0) + { + mode = SVC_MODE_START; + } + if (StrCmpi(arg, SVC_ARG_STOP) == 0) + { + mode = SVC_MODE_STOP; + } + if (StrCmpi(arg, SVC_ARG_TEST) == 0) + { + mode = SVC_MODE_TEST; + } + if (StrCmpi(arg, SVC_ARG_USERMODE) == 0) + { + mode = SVC_MODE_USERMODE; + } + if (StrCmpi(arg, SVC_ARG_SETUP_INSTALL) == 0) + { + mode = SVC_MODE_SETUP_INSTALL; + } + if (StrCmpi(arg, SVC_ARG_SETUP_UNINSTALL) == 0) + { + mode = SVC_MODE_SETUP_UNINSTALL; + } + if (StrCmpi(arg, SVC_ARG_WIN9X_SERVICE) == 0) + { + mode = SVC_MODE_WIN9X_SERVICE; + } + if (StrCmpi(arg, SVC_ARG_WIN9X_INSTALL) == 0) + { + mode = SVC_MODE_WIN9X_INSTALL; + } + if (StrCmpi(arg, SVC_ARG_WIN9X_UNINSTALL) == 0) + { + mode = SVC_MODE_WIN9X_UNINSTALL; + } + if (StrCmpi(arg, SVC_ARG_TCP) == 0) + { + mode = SVC_MODE_TCP; + } + if (StrCmpi(arg, SVC_ARG_TCP_UAC) == 0) + { + mode = SVC_MODE_TCP_UAC; + } + if (StrCmpi(arg, SVC_ARG_TCP_SETUP) == 0) + { + mode = SVC_MODE_TCPSETUP; + } + if (StrCmpi(arg, SVC_ARG_TRAFFIC) == 0) + { + mode = SVC_MODE_TRAFFIC; + } + if (StrCmpi(arg, SVC_ARG_UIHELP) == 0) + { + mode = SVC_MODE_UIHELP; + } + if (StrCmpi(arg, SVC_ARG_USERMODE_SHOWTRAY) == 0) + { + char tmp[MAX_SIZE]; + mode = SVC_MODE_USERMODE; + Format(tmp, sizeof(tmp), SVC_HIDETRAY_REG_VALUE, service_title); + MsRegDeleteValue(REG_CURRENT_USER, SVC_USERMODE_SETTING_KEY, tmp); + } + if (StrCmpi(arg, SVC_ARG_USERMODE_HIDETRAY) == 0) + { + char tmp[MAX_SIZE]; + mode = SVC_MODE_USERMODE; + Format(tmp, sizeof(tmp), SVC_HIDETRAY_REG_VALUE, service_title); + MsRegWriteInt(REG_CURRENT_USER, SVC_USERMODE_SETTING_KEY, tmp, 1); + } + if (StrCmpi(arg, SVC_ARG_SERVICE) == 0) + { + mode = SVC_MODE_SERVICE; + } + + if (mode != SVC_MODE_NONE) + { + // Network Config + MsInitGlobalNetworkConfig(); + } + } + + // Get the command-line name when running as a service + UniFormat(path, sizeof(path), SVC_RUN_COMMANDLINE, ms->ExeFileNameW); + + if ((mode == SVC_MODE_INSTALL || mode == SVC_MODE_UNINSTALL || mode == SVC_MODE_START || + mode == SVC_MODE_STOP || mode == SVC_MODE_SERVICE) && + (ms->IsNt == false)) + { + // Tried to use the command for the NT in non-WindowsNT system + MsgBox(NULL, MB_ICONSTOP, _UU("SVC_NT_ONLY")); + } + else if ((mode == SVC_MODE_INSTALL || mode == SVC_MODE_UNINSTALL || mode == SVC_MODE_START || + mode == SVC_MODE_STOP || mode == SVC_MODE_SERVICE) && + (ms->IsAdmin == false)) + { + // Do not have Administrators privilege + MsgBox(NULL, MB_ICONEXCLAMATION, _UU("SVC_NOT_ADMIN")); + } + else + { + // Performs processing depend on mode + switch (mode) + { + case SVC_MODE_NONE: + // Exit by showing a guidance message + if (arg_w != NULL && UniEndWith(arg_w, L".vpn")) + { + if (MsgBox(NULL, MB_ICONQUESTION | MB_YESNO, _UU("CM_VPN_FILE_CLICKED")) == IDYES) + { + wchar_t vpncmgr[MAX_PATH]; + wchar_t filename[MAX_PATH]; + + UniFormat(filename, sizeof(filename), L"\"%s\"", arg_w); + UniFormat(vpncmgr, sizeof(vpncmgr), L"%s\\vpncmgr.exe", MsGetExeDirNameW()); + + RunW(vpncmgr, filename, false, false); + } + } + else + { + MsgBoxEx(NULL, MB_ICONINFORMATION, _UU("SVC_HELP"), + service_title, service_name, service_title, service_title, service_name, service_title, service_name, service_title, service_name, service_title, service_name, service_title, service_title); + } + break; + + case SVC_MODE_SETUP_INSTALL: + // Setup.exe installation mode + // Uninstall the old version + MsWriteCallingServiceManagerProcessId(service_name, MsGetCurrentProcessId()); + restoreReg = true; + + if (MsIsServiceInstalled(service_name)) + { + if (MsIsServiceRunning(service_name)) + { + MsStopService(service_name); + } + MsUninstallService(service_name); + } + if (MsInstallServiceW(service_name, service_title, service_description, path) == false) + { + ret = 1; + } + MsStartService(service_name); + MsWriteCallingServiceManagerProcessId(service_name, 0); + break; + + case SVC_MODE_SETUP_UNINSTALL: + // Setup.exe uninstall mode + MsWriteCallingServiceManagerProcessId(service_name, MsGetCurrentProcessId()); + restoreReg = true; + + if (MsIsServiceInstalled(service_name)) + { + if (MsIsServiceRunning(service_name)) + { + MsStopService(service_name); + } + if (MsUninstallService(service_name) == false) + { + ret = 1; + } + } + break; + + case SVC_MODE_INSTALL: + // Install the service + // Check whether it is already installed + MsWriteCallingServiceManagerProcessId(service_name, MsGetCurrentProcessId()); + restoreReg = true; + + if (MsIsServiceInstalled(service_name)) + { + // Already installed + // Show a message asking if you want to uninstall + if(silent == true) + { + // Always cancel the operation + break; + } + if (MsgBoxEx(NULL, MB_ICONQUESTION | MB_YESNO | MB_DEFBUTTON2, _UU("SVC_ALREADY_INSTALLED"), + service_title, service_name) == IDNO) + { + // Cancel the operation + break; + } + else + { + // Whether the existing service is working? + if (MsIsServiceRunning(service_name)) + { + // Try to stop + if (MsStopService(service_name) == false) + { + // Failed to stop + if(silent == false) + { + MsgBoxEx(NULL, MB_ICONSTOP, _UU("SVC_STOP_FAILED"), + service_title, service_name); + } + break; + } + } + // Uninstall + if (MsUninstallService(service_name) == false) + { + // Failed to uninstall + if(silent == false) + { + MsgBoxEx(NULL, MB_ICONSTOP, _UU("SVC_UNINSTALL_FAILED"), + service_title, service_name); + } + break; + } + } + } + + // Do the installation + if (MsInstallServiceW(service_name, service_title, service_description, path) == false) + { + // Failed to install + if(silent == false) + { + MsgBoxEx(NULL, MB_ICONSTOP, _UU("SVC_INSTALL_FAILED"), + service_title, service_name); + } + break; + } + + // Start the service + if (MsStartService(service_name) == false) + { + // Failed to start + if(silent == false) + { + MsgBoxEx(NULL, MB_ICONEXCLAMATION, _UU("SVC_INSTALL_FAILED_2"), + service_title, service_name, path); + } + break; + } + + // All successful + if(silent == false) + { + MsgBoxEx(NULL, MB_ICONINFORMATION, _UU("SVC_INSTALL_OK"), + service_title, service_name, path); + } + break; + + case SVC_MODE_UNINSTALL: + // Uninstall the service + // Check whether it is already installed + MsWriteCallingServiceManagerProcessId(service_name, MsGetCurrentProcessId()); + restoreReg = true; + + if (MsIsServiceInstalled(service_name) == false) + { + if(silent == false) + { + MsgBoxEx(NULL, MB_ICONEXCLAMATION, _UU("SVC_NOT_INSTALLED"), + service_title, service_name, path); + } + break; + } + + // If the service is currently running, stop it + if (MsIsServiceRunning(service_name)) + { + // Stop the service + if (MsStopService(service_name) == false) + { + // Failed to stop + if(silent == false) + { + MsgBoxEx(NULL, MB_ICONSTOP, _UU("SVC_STOP_FAILED"), + service_title, service_name); + } + break; + } + } + + // Uninstall the service + if (MsUninstallService(service_name) == false) + { + if(silent == false) + { + MsgBoxEx(NULL, MB_ICONSTOP, _UU("SVC_UNINSTALL_FAILED"), + service_title, service_name); + } + break; + } + + // All successful + if(silent == false) + { + MsgBoxEx(NULL, MB_ICONINFORMATION, _UU("SVC_UNINSTALL_OK"), + service_title, service_name); + } + break; + + case SVC_MODE_START: + // Start the service + MsWriteCallingServiceManagerProcessId(service_name, MsGetCurrentProcessId()); + restoreReg = true; + + if (MsIsServiceInstalled(service_name) == false) + { + // Service is not installed + if(silent == false) + { + MsgBoxEx(NULL, MB_ICONEXCLAMATION, _UU("SVC_NOT_INSTALLED"), + service_title, service_name); + } + break; + } + + // Confirm whether the service is running + if (MsIsServiceRunning(service_name)) + { + // Service is running + if(silent == false) + { + MsgBoxEx(NULL, MB_ICONINFORMATION, _UU("SVR_ALREADY_START"), + service_title, service_name); + } + break; + } + + // Start the service + if (MsStartService(service_name) == false) + { + // Failed to start + if(silent == false) + { + MsgBoxEx(NULL, MB_ICONEXCLAMATION, _UU("SVC_START_FAILED"), + service_title, service_name); + } + break; + } + + // All successful + if(silent == false) + { + MsgBoxEx(NULL, MB_ICONINFORMATION, _UU("SVC_START_OK"), + service_title, service_name); + } + break; + + case SVC_MODE_STOP: + // Stop the service + MsWriteCallingServiceManagerProcessId(service_name, MsGetCurrentProcessId()); + restoreReg = true; + + if (MsIsServiceInstalled(service_name) == false) + { + // Service is not installed + if(silent == false) + { + MsgBoxEx(NULL, MB_ICONEXCLAMATION, _UU("SVC_NOT_INSTALLED"), + service_title, service_name); + } + break; + } + + // Confirm whether the service is running + if (MsIsServiceRunning(service_name) == false) + { + // The service is stopped + if(silent == false) + { + MsgBoxEx(NULL, MB_ICONINFORMATION, _UU("SVC_ALREADY_STOP"), + service_title, service_name); + } + break; + } + // Stop the service + if (MsStopService(service_name) == false) + { + // Failed to stop + if(silent == false) + { + MsgBoxEx(NULL, MB_ICONEXCLAMATION, _UU("SVC_STOP_FAILED"), + service_title, service_name); + } + break; + } + + // All successful + if(silent == false) + { + MsgBoxEx(NULL, MB_ICONINFORMATION, _UU("SVC_STOP_OK"), + service_title, service_name); + } + break; + + case SVC_MODE_TEST: + // Test mode + MsTestModeW(service_title, start, stop); + break; + + case SVC_MODE_WIN9X_SERVICE: + // Win9x service mode (hide icon in the task tray unconditionally) + if (MsIsNt()) + { + // Don't do this on Windows 2000 or later + break; + } + service_for_9x_mode = true; + // Not a oblivion to break + case SVC_MODE_USERMODE: + // User mode + MsUserModeW(service_title, start, stop, icon); + break; + + case SVC_MODE_WIN9X_INSTALL: + // Win9x installation mode + MsWriteCallingServiceManagerProcessId(service_name, MsGetCurrentProcessId()); + restoreReg = true; + + if (MsIsNt() == false) + { + // Adding a registry key + char cmdline[MAX_PATH]; + Format(cmdline, sizeof(cmdline), "\"%s\" %s", + MsGetExeFileName(), SVC_ARG_WIN9X_SERVICE); + MsRegWriteStr(REG_LOCAL_MACHINE, WIN9X_SVC_REGKEY_1, + name, cmdline); + MsRegWriteStr(REG_LOCAL_MACHINE, WIN9X_SVC_REGKEY_2, + name, cmdline); + + // Start + //Run(MsGetExeFileName(), SVC_ARG_WIN9X_SERVICE, false, false); + } + break; + + case SVC_MODE_WIN9X_UNINSTALL: + // Win9x uninstall mode + MsWriteCallingServiceManagerProcessId(service_name, MsGetCurrentProcessId()); + restoreReg = true; + + if (MsIsNt() == false) + { + // Delete the registry key + MsRegDeleteValue(REG_LOCAL_MACHINE, WIN9X_SVC_REGKEY_1, + name); + MsRegDeleteValue(REG_LOCAL_MACHINE, WIN9X_SVC_REGKEY_2, + name); + + // Terminate all the processes of PacketiX VPN Client other than itself + MsKillOtherInstance(); + } + break; + + case SVC_MODE_SERVICE: + // Run as a service + // Obsoleted (2012.12.31) (Do this in the above code) + //MsServiceMode(start, stop); + break; + + case SVC_MODE_TCP: + case SVC_MODE_TCP_UAC: + // TCP Utility + InitCedar(); + InitWinUi(service_title_uni, NULL, 0); + + if (MsIsVista() && MsIsAdmin() == false && mode != SVC_MODE_TCP_UAC) + { + void *handle = NULL; + if (MsExecuteEx2W(ms->ExeFileNameW, SVC_ARG_TCP_UAC_W, &handle, true) == false) + { + ShowTcpIpConfigUtil(NULL, true); + } + else + { + MsWaitProcessExit(handle); + } + } + else + { + ShowTcpIpConfigUtil(NULL, true); + } + + FreeWinUi(); + FreeCedar(); + break; + + case SVC_MODE_TCPSETUP: + // TCP optimization mode (This is called by the installer) + InitCedar(); + InitWinUi(service_title_uni, NULL, 0); + + if (MsIsVista() && MsIsAdmin() == false) + { + void *handle = NULL; + if (MsExecuteEx2W(ms->ExeFileNameW, arg_w, &handle, true) == false) + { + ShowTcpIpConfigUtil(NULL, false); + } + else + { + MsWaitProcessExit(handle); + } + } + else + { + ShowTcpIpConfigUtil(NULL, false); + } + + FreeWinUi(); + FreeCedar(); + break; + + case SVC_MODE_TRAFFIC: + // Communication throughput measurement tool + InitCedar(); + InitWinUi(service_title_uni, NULL, 0); + CmTraffic(NULL); + FreeWinUi(); + FreeCedar(); + break; + + case SVC_MODE_UIHELP: + // Starting the UI Helper + CnStart(); + break; + } + + } + FreeToken(t); + UniFreeToken(ut); + + if (restoreReg) + { + MsWriteCallingServiceManagerProcessId(service_name, 0); + } + } + + FreeMayaqua(); + + return 0; +} + +// Get the user name of the specified session +wchar_t *MsGetSessionUserName(UINT session_id) +{ + if (MsIsTerminalServiceInstalled() || MsIsUserSwitchingInstalled()) + { + wchar_t *ret; + wchar_t *name; + UINT size = 0; + if (ms->nt->WTSQuerySessionInformation(WTS_CURRENT_SERVER_HANDLE, session_id, + WTSUserName, (wchar_t *)&name, &size) == false) + { + return NULL; + } + + if (name == NULL || UniStrLen(name) == 0) + { + ret = NULL; + } + else + { + ret = UniCopyStr(name); + } + + ms->nt->WTSFreeMemory(name); + + return ret; + } + return NULL; +} + +// Get whether the current terminal session is active +bool MsIsCurrentTerminalSessionActive() +{ + return MsIsTerminalSessionActive(MsGetCurrentTerminalSessionId()); +} + +// Get whether the specified terminal session is active +bool MsIsTerminalSessionActive(UINT session_id) +{ + if (MsIsTerminalServiceInstalled() || MsIsUserSwitchingInstalled()) + { + UINT *status = NULL; + UINT size = sizeof(status); + bool active = true; + + if (ms->nt->WTSQuerySessionInformation(WTS_CURRENT_SERVER_HANDLE, session_id, + WTSConnectState, (wchar_t *)&status, &size) == false) + { + return true; + } + + switch (*status) + { + case WTSDisconnected: + case WTSShadow: + case WTSIdle: + case WTSDown: + case WTSReset: + active = false; + break; + } + + ms->nt->WTSFreeMemory(status); + + return active; + } + + return true; +} + +// Get the current terminal session ID +UINT MsGetCurrentTerminalSessionId() +{ + if (MsIsTerminalServiceInstalled() || MsIsUserSwitchingInstalled()) + { + UINT ret; + UINT *session_id = NULL; + UINT size = sizeof(session_id); + if (ms->nt->WTSQuerySessionInformation(WTS_CURRENT_SERVER_HANDLE, WTS_CURRENT_SESSION, + WTSSessionId, (wchar_t *)&session_id, &size) == false) + { + return 0; + } + + ret = *session_id; + + ms->nt->WTSFreeMemory(session_id); + + return ret; + } + + return 0; +} + +// Examine whether the user switching is installed +bool MsIsUserSwitchingInstalled() +{ + OS_INFO *info = GetOsInfo(); + OSVERSIONINFOEX i; + + if (OS_IS_WINDOWS_NT(info->OsType) == false) + { + return false; + } + + if (ms->nt->WTSDisconnectSession == NULL || + ms->nt->WTSFreeMemory == NULL || + ms->nt->WTSQuerySessionInformation == NULL) + { + return false; + } + + if (GET_KETA(info->OsType, 100) < 2) + { + return false; + } + + Zero(&i, sizeof(i)); + i.dwOSVersionInfoSize = sizeof(i); + if (GetVersionEx((OSVERSIONINFO *)&i) == false) + { + return false; + } + + if (i.wSuiteMask & VER_SUITE_SINGLEUSERTS) + { + return true; + } + + return false; +} + +// Examine whether Windows 2000 or later +bool MsIsWin2000OrGreater() +{ + OS_INFO *info = GetOsInfo(); + + if (OS_IS_WINDOWS_NT(info->OsType) == false) + { + return false; + } + + if (GET_KETA(info->OsType, 100) >= 2) + { + return true; + } + + return false; +} + +// Examine whether Windows XP or later +bool MsIsWinXPOrGreater() +{ + OS_INFO *info = GetOsInfo(); + + if (OS_IS_WINDOWS_NT(info->OsType) == false) + { + return false; + } + + if (GET_KETA(info->OsType, 100) >= 3) + { + return true; + } + + return false; +} + +// Examine whether the Terminal Services is installed +bool MsIsTerminalServiceInstalled() +{ + OS_INFO *info = GetOsInfo(); + OSVERSIONINFOEX i; + + if (OS_IS_WINDOWS_NT(info->OsType) == false) + { + return false; + } + + if (ms->nt->WTSDisconnectSession == NULL || + ms->nt->WTSFreeMemory == NULL || + ms->nt->WTSQuerySessionInformation == NULL) + { + return false; + } + + if (GET_KETA(info->OsType, 100) < 2) + { + return false; + } + + Zero(&i, sizeof(i)); + i.dwOSVersionInfoSize = sizeof(i); + if (GetVersionEx((OSVERSIONINFO *)&i) == false) + { + return false; + } + + if (i.wSuiteMask & VER_SUITE_TERMINAL || i.wSuiteMask & VER_SUITE_SINGLEUSERTS) + { + return true; + } + + return false; +} + +// Stop the service +bool MsStopService(char *name) +{ + SC_HANDLE sc, service; + bool ret = false; + // Validate arguments + if (name == NULL) + { + return false; + } + if (ms->IsNt == false) + { + return false; + } + + sc = ms->nt->OpenSCManager(NULL, NULL, SC_MANAGER_ALL_ACCESS); + if (sc == NULL) + { + return false; + } + + service = ms->nt->OpenService(sc, name, SERVICE_ALL_ACCESS); + if (service != NULL) + { + SERVICE_STATUS st; + ret = ms->nt->ControlService(service, SERVICE_CONTROL_STOP, &st); + + ms->nt->CloseServiceHandle(service); + } + + if (ret) + { + UINT64 end = Tick64() + 10000ULL; + while (Tick64() < end) + { + if (MsIsServiceRunning(name) == false) + { + break; + } + + SleepThread(250); + } + } + + ms->nt->CloseServiceHandle(sc); + return ret; +} + +// Start the service +bool MsStartService(char *name) +{ + return MsStartServiceEx(name, NULL); +} +bool MsStartServiceEx(char *name, UINT *error_code) +{ + SC_HANDLE sc, service; + bool ret = false; + static UINT dummy = 0; + // Validate arguments + if (name == NULL) + { + return false; + } + if (ms->IsNt == false) + { + return false; + } + if (error_code == NULL) + { + error_code = &dummy; + } + + *error_code = 0; + + sc = ms->nt->OpenSCManager(NULL, NULL, SC_MANAGER_ALL_ACCESS); + if (sc == NULL) + { + *error_code = GetLastError(); + return false; + } + + service = ms->nt->OpenService(sc, name, SERVICE_ALL_ACCESS); + if (service != NULL) + { + ret = ms->nt->StartService(service, 0, NULL); + + ms->nt->CloseServiceHandle(service); + } + else + { + *error_code = GetLastError(); + } + + if (ret) + { + UINT64 end = Tick64() + 10000ULL; + while (Tick64() < end) + { + if (MsIsServiceRunning(name)) + { + break; + } + + SleepThread(250); + } + } + + ms->nt->CloseServiceHandle(sc); + return ret; +} + +// Get whether the service is running +bool MsIsServiceRunning(char *name) +{ + SC_HANDLE sc, service; + bool ret = false; + // Validate arguments + if (name == NULL || IsEmptyStr(name)) + { + return false; + } + if (ms->IsNt == false) + { + return false; + } + + sc = ms->nt->OpenSCManager(NULL, NULL, GENERIC_READ); + if (sc == NULL) + { + return false; + } + + service = ms->nt->OpenService(sc, name, GENERIC_READ); + if (service != NULL) + { + SERVICE_STATUS st; + Zero(&st, sizeof(st)); + if (ms->nt->QueryServiceStatus(service, &st)) + { + switch (st.dwCurrentState) + { + case SERVICE_CONTINUE_PENDING: + case SERVICE_PAUSE_PENDING: + case SERVICE_PAUSED: + case SERVICE_RUNNING: + case SERVICE_START_PENDING: + case SERVICE_STOP_PENDING: + ret = true; + break; + } + } + + ms->nt->CloseServiceHandle(service); + } + + ms->nt->CloseServiceHandle(sc); + return ret; +} + +// Uninstall the service +bool MsUninstallService(char *name) +{ + SC_HANDLE sc, service; + bool ret = false; + // Validate arguments + if (name == NULL) + { + return false; + } + if (ms->IsNt == false) + { + return false; + } + + MsStopService(name); + + sc = ms->nt->OpenSCManager(NULL, NULL, SC_MANAGER_ALL_ACCESS); + if (sc == NULL) + { + return false; + } + + service = ms->nt->OpenService(sc, name, SERVICE_ALL_ACCESS); + if (service != NULL) + { + if (ms->nt->DeleteService(service)) + { + ret = true; + } + ms->nt->CloseServiceHandle(service); + } + + ms->nt->CloseServiceHandle(sc); + + if (ret) + { + SleepThread(2000); + } + + return ret; +} + +// Update the title and description of the service +bool MsSetServiceDescription(char *name, wchar_t *description) +{ + SC_HANDLE sc, service; + // Validate arguments + if (name == NULL || description == NULL) + { + return false; + } + + sc = ms->nt->OpenSCManager(NULL, NULL, SC_MANAGER_ALL_ACCESS); + if (sc == NULL) + { + return false; + } + + service = ms->nt->OpenService(sc, name, SERVICE_ALL_ACCESS); + if (service != NULL) + { + if (GET_KETA(GetOsInfo()->OsType, 100) >= 2) + { + SERVICE_DESCRIPTIONW d; + + if (UniIsEmptyStr(description) == false) + { + Zero(&d, sizeof(d)); + d.lpDescription = description; + ms->nt->ChangeServiceConfig2(service, SERVICE_CONFIG_DESCRIPTION, &d); + } + } + + ms->nt->CloseServiceHandle(service); + } + + ms->nt->CloseServiceHandle(sc); + + return true; +} + +// Update the service setting +bool MsUpdateServiceConfig(char *name) +{ + SC_HANDLE sc, service; + // Validate arguments + if (name == NULL) + { + return false; + } + + // Whether just after Windows startup (deadlock prevention) + if (timeGetTime() <= (60 * 30 * 1000)) + { + if (MsRegReadInt(REG_LOCAL_MACHINE, "Software\\" GC_REG_COMPANY_NAME "\\Update Service Config", name) != 0) + { + return false; + } + } + + sc = ms->nt->OpenSCManager(NULL, NULL, SC_MANAGER_ALL_ACCESS); + if (sc == NULL) + { + return false; + } + + service = ms->nt->OpenService(sc, name, SERVICE_ALL_ACCESS); + if (service != NULL) + { + if (GET_KETA(GetOsInfo()->OsType, 100) >= 2) + { + SERVICE_FAILURE_ACTIONS action; + SC_ACTION *e; + Zero(&action, sizeof(action)); + e = ZeroMalloc(sizeof(SC_ACTION) * 3); + e[0].Delay = 10000; e[0].Type = SC_ACTION_RESTART; + e[1].Delay = 10000; e[1].Type = SC_ACTION_RESTART; + e[2].Delay = 10000; e[2].Type = SC_ACTION_RESTART; + action.cActions = 3; + action.lpsaActions = e; + action.dwResetPeriod = 1 * 60 * 60 * 24; + ms->nt->ChangeServiceConfig2(service, SERVICE_CONFIG_FAILURE_ACTIONS, &action); + + MsRegWriteInt(REG_LOCAL_MACHINE, "Software\\" GC_REG_COMPANY_NAME "\\Update Service Config", name, 1); + } + + + if (GET_KETA(GetOsInfo()->OsType, 100) >= 2) + { + SERVICE_DESCRIPTIONW d; + wchar_t *description; + char dname[MAX_SIZE]; + + Format(dname, sizeof(dname), "SVC_%s_DESCRIPT", name); + + description = _UU(dname); + + if (UniIsEmptyStr(description) == false) + { + Zero(&d, sizeof(d)); + d.lpDescription = description; + ms->nt->ChangeServiceConfig2(service, SERVICE_CONFIG_DESCRIPTION, &d); + } + } + + ms->nt->CloseServiceHandle(service); + } + + ms->nt->CloseServiceHandle(sc); + + return true; +} + +// Install the device driver +bool MsInstallDeviceDriverW(char *name, wchar_t *title, wchar_t *path, UINT *error_code) +{ + SC_HANDLE sc, service; + bool ret = false; + wchar_t name_w[MAX_SIZE]; + static UINT temp_int = 0; + // Validate arguments + if (name == NULL || title == NULL || path == NULL) + { + return false; + } + if (ms->IsNt == false) + { + return false; + } + if (error_code == NULL) + { + error_code = &temp_int; + } + + *error_code = 0; + + StrToUni(name_w, sizeof(name_w), name); + + sc = ms->nt->OpenSCManager(NULL, NULL, SC_MANAGER_ALL_ACCESS); + if (sc == NULL) + { + *error_code = GetLastError(); + return false; + } + + service = ms->nt->CreateServiceW(sc, name_w, title, SERVICE_ALL_ACCESS, + SERVICE_KERNEL_DRIVER, SERVICE_DEMAND_START, + SERVICE_ERROR_NORMAL, path, NULL, NULL, NULL, NULL, NULL); + + if (service != NULL) + { + ret = true; + + ms->nt->CloseServiceHandle(service); + } + else + { + *error_code = GetLastError(); + } + + ms->nt->CloseServiceHandle(sc); + + if (ret) + { + SleepThread(2000); + } + + return ret; +} + +// Install the service +bool MsInstallServiceW(char *name, wchar_t *title, wchar_t *description, wchar_t *path) +{ + return MsInstallServiceExW(name, title, description, path, NULL); +} +bool MsInstallServiceExW(char *name, wchar_t *title, wchar_t *description, wchar_t *path, UINT *error_code) +{ + SC_HANDLE sc, service; + bool ret = false; + wchar_t name_w[MAX_SIZE]; + static UINT temp_int = 0; + // Validate arguments + if (name == NULL || title == NULL || path == NULL) + { + return false; + } + if (ms->IsNt == false) + { + return false; + } + if (error_code == NULL) + { + error_code = &temp_int; + } + + *error_code = 0; + + StrToUni(name_w, sizeof(name_w), name); + + sc = ms->nt->OpenSCManager(NULL, NULL, SC_MANAGER_ALL_ACCESS); + if (sc == NULL) + { + *error_code = GetLastError(); + return false; + } + + service = ms->nt->CreateServiceW(sc, name_w, title, SERVICE_ALL_ACCESS, + SERVICE_WIN32_OWN_PROCESS | (MsIsVista() ? 0 : SERVICE_INTERACTIVE_PROCESS), SERVICE_AUTO_START, + SERVICE_ERROR_NORMAL, path, NULL, NULL, NULL, NULL, NULL); + + if (service != NULL) + { + ret = true; + + if (GET_KETA(GetOsInfo()->OsType, 100) >= 2) + { + SERVICE_DESCRIPTIONW d; + SERVICE_FAILURE_ACTIONS action; + SC_ACTION *e; + Zero(&d, sizeof(d)); + d.lpDescription = description; + ms->nt->ChangeServiceConfig2(service, SERVICE_CONFIG_DESCRIPTION, &d); + Zero(&action, sizeof(action)); + e = ZeroMalloc(sizeof(SC_ACTION) * 3); + e[0].Delay = 10000; e[0].Type = SC_ACTION_RESTART; + e[1].Delay = 10000; e[1].Type = SC_ACTION_RESTART; + e[2].Delay = 10000; e[2].Type = SC_ACTION_RESTART; + action.cActions = 3; + action.lpsaActions = e; + action.dwResetPeriod = 1 * 60 * 60 * 24; + ms->nt->ChangeServiceConfig2(service, SERVICE_CONFIG_FAILURE_ACTIONS, &action); + + Free(e); + } + + ms->nt->CloseServiceHandle(service); + } + else + { + *error_code = GetLastError(); + } + + ms->nt->CloseServiceHandle(sc); + + if (ret) + { + SleepThread(2000); + } + + return ret; +} + +// Check whether the specified service is installed +bool MsIsServiceInstalled(char *name) +{ + SC_HANDLE sc; + SC_HANDLE service; + bool ret = false; + // Validate arguments + if (name == NULL) + { + return false; + } + if (ms->IsNt == false) + { + return false; + } + + sc = ms->nt->OpenSCManager(NULL, NULL, GENERIC_READ); + if (sc == NULL) + { + return false; + } + + service = ms->nt->OpenService(sc, name, GENERIC_READ); + if (service != NULL) + { + ret = true; + } + + ms->nt->CloseServiceHandle(service); + ms->nt->CloseServiceHandle(sc); + + return ret; +} + +// Kill the process +void MsTerminateProcess() +{ + TerminateProcess(GetCurrentProcess(), 0); + _exit(0); +} + +// Get the Process ID +UINT MsGetProcessId() +{ + return GetCurrentProcessId(); +} + +// Lower the priority of the thread to lowest +void MsSetThreadPriorityIdle() +{ + SetThreadPriority(GetCurrentThread(), THREAD_PRIORITY_IDLE); +} + +// Raise the priority of a thread +void MsSetThreadPriorityHigh() +{ + SetThreadPriority(GetCurrentThread(), THREAD_PRIORITY_ABOVE_NORMAL); +} + +// Raise the priority of the thread to highest +void MsSetThreadPriorityRealtime() +{ + SetThreadPriority(GetCurrentThread(), THREAD_PRIORITY_ABOVE_NORMAL); + SetThreadPriority(GetCurrentThread(), THREAD_PRIORITY_HIGHEST); + SetThreadPriority(GetCurrentThread(), THREAD_PRIORITY_TIME_CRITICAL); +} + +// Restore the priority of the thread +void MsRestoreThreadPriority() +{ + SetThreadPriority(GetCurrentThread(), THREAD_PRIORITY_NORMAL); +} + +// Check whether should show the TCP setting application +bool MsIsShouldShowTcpConfigApp() +{ + MS_TCP tcp1, tcp2; + if (MsIsTcpConfigSupported() == false) + { + return false; + } + + MsGetTcpConfig(&tcp1); + if (MsLoadTcpConfigReg(&tcp2) == false) + { + return true; + } + + if (Cmp(&tcp1, &tcp2, sizeof(MS_TCP) != 0)) + { + return true; + } + + return false; +} + +// Apply the temporary settings data of registry to the TCP parameter of the Windows +void MsApplyTcpConfig() +{ + if (MsIsTcpConfigSupported()) + { + MS_TCP tcp; + + if (MsLoadTcpConfigReg(&tcp)) + { + MsSetTcpConfig(&tcp); + } + } +} + +// Check whether the dynamic configuration of TCP is supported in current state +bool MsIsTcpConfigSupported() +{ + if (MsIsNt() && MsIsAdmin()) + { + UINT type = GetOsInfo()->OsType; + + if (GET_KETA(type, 100) >= 2) + { + return true; + } + } + + return false; +} + +// Read the TCP settings from the registry setting +bool MsLoadTcpConfigReg(MS_TCP *tcp) +{ + // Validate arguments + if (tcp == NULL) + { + return false; + } + + if (MsIsNt()) + { + Zero(tcp, sizeof(MS_TCP)); + + if (MsRegIsValueEx(REG_LOCAL_MACHINE, MS_REG_TCP_SETTING_KEY, "RecvWindowSize", true) == false || + MsRegIsValueEx(REG_LOCAL_MACHINE, MS_REG_TCP_SETTING_KEY, "SendWindowSize", true) == false) + { + return false; + } + + tcp->RecvWindowSize = MsRegReadIntEx(REG_LOCAL_MACHINE, MS_REG_TCP_SETTING_KEY, "RecvWindowSize", true); + tcp->SendWindowSize = MsRegReadIntEx(REG_LOCAL_MACHINE, MS_REG_TCP_SETTING_KEY, "SendWindowSize", true); + + return true; + } + else + { + return false; + } +} + +// Remove the TCP settings from the registry +void MsDeleteTcpConfigReg() +{ + if (MsIsNt() && MsIsAdmin()) + { + MsRegDeleteKeyEx(REG_LOCAL_MACHINE, MS_REG_TCP_SETTING_KEY, true); + } +} + +// Write the TCP settings to the registry setting +void MsSaveTcpConfigReg(MS_TCP *tcp) +{ + // Validate arguments + if (tcp == NULL) + { + return; + } + + if (MsIsNt() && MsIsAdmin()) + { + MsRegWriteIntEx(REG_LOCAL_MACHINE, MS_REG_TCP_SETTING_KEY, "RecvWindowSize", tcp->RecvWindowSize, true); + MsRegWriteIntEx(REG_LOCAL_MACHINE, MS_REG_TCP_SETTING_KEY, "SendWindowSize", tcp->SendWindowSize, true); + } +} + +// Get the current TCP settings +void MsGetTcpConfig(MS_TCP *tcp) +{ + // Validate arguments + if (tcp == NULL) + { + return; + } + + Zero(tcp, sizeof(MS_TCP)); + + if (MsIsNt()) + { + UINT v; + // Initialize the network setting + MsInitGlobalNetworkConfig(); + + // Read the value of TcpWindowSize or GlobalMaxTcpWindowSize if there is + v = MsRegReadInt(REG_LOCAL_MACHINE, "SYSTEM\\CurrentControlSet\\Services\\Tcpip\\Parameters", "TcpWindowSize"); + tcp->RecvWindowSize = MAX(tcp->RecvWindowSize, v); + + v = MsRegReadInt(REG_LOCAL_MACHINE, "SYSTEM\\CurrentControlSet\\Services\\Tcpip\\Parameters", "GlobalMaxTcpWindowSize"); + tcp->RecvWindowSize = MAX(tcp->RecvWindowSize, v); + + v = MsRegReadInt(REG_LOCAL_MACHINE, "SYSTEM\\CurrentControlSet\\Services\\AFD\\Parameters", "DefaultReceiveWindow"); + tcp->RecvWindowSize = MAX(tcp->RecvWindowSize, v); + + // Read the value of DefaultSendWindow if there is + tcp->SendWindowSize = MsRegReadInt(REG_LOCAL_MACHINE, "SYSTEM\\CurrentControlSet\\Services\\AFD\\Parameters", "DefaultSendWindow"); + } +} + +// Write the TCP settings +void MsSetTcpConfig(MS_TCP *tcp) +{ + // Validate arguments + if (tcp == NULL) + { + return; + } + + if (MsIsNt() && MsIsAdmin()) + { + bool window_scaling = false; + UINT tcp1323opts; + + if (tcp->RecvWindowSize >= 65536 || tcp->SendWindowSize >= 65536) + { + window_scaling = true; + } + + // Set the Tcp1323Opts + tcp1323opts = MsRegReadInt(REG_LOCAL_MACHINE, "SYSTEM\\CurrentControlSet\\Services\\Tcpip\\Parameters", "Tcp1323Opts"); + if (window_scaling) + { + if (tcp1323opts == 0) + { + tcp1323opts = 1; + } + if (tcp1323opts == 2) + { + tcp1323opts = 3; + } + } + else + { + if (tcp1323opts == 1) + { + tcp1323opts = 0; + } + if (tcp1323opts == 3) + { + tcp1323opts = 2; + } + } + MsRegWriteInt(REG_LOCAL_MACHINE, "SYSTEM\\CurrentControlSet\\Services\\Tcpip\\Parameters", "Tcp1323Opts", tcp1323opts); + + // Set the Receive Window + if (tcp->RecvWindowSize == 0) + { + MsRegDeleteValue(REG_LOCAL_MACHINE, "SYSTEM\\CurrentControlSet\\Services\\AFD\\Parameters", + "DefaultReceiveWindow"); + MsRegDeleteValue(REG_LOCAL_MACHINE, "SYSTEM\\CurrentControlSet\\Services\\Tcpip\\Parameters", + "TcpWindowSize"); + MsRegDeleteValue(REG_LOCAL_MACHINE, "SYSTEM\\CurrentControlSet\\Services\\Tcpip\\Parameters", + "GlobalMaxTcpWindowSize"); + } + else + { + MsRegWriteInt(REG_LOCAL_MACHINE, "SYSTEM\\CurrentControlSet\\Services\\AFD\\Parameters", + "DefaultReceiveWindow", tcp->RecvWindowSize); + MsRegWriteInt(REG_LOCAL_MACHINE, "SYSTEM\\CurrentControlSet\\Services\\Tcpip\\Parameters", + "TcpWindowSize", tcp->RecvWindowSize); + MsRegWriteInt(REG_LOCAL_MACHINE, "SYSTEM\\CurrentControlSet\\Services\\Tcpip\\Parameters", + "GlobalMaxTcpWindowSize", tcp->RecvWindowSize); + } + + // Setting the Send Window + if (tcp->SendWindowSize == 0) + { + MsRegDeleteValue(REG_LOCAL_MACHINE, "SYSTEM\\CurrentControlSet\\Services\\AFD\\Parameters", + "DefaultSendWindow"); + } + else + { + MsRegWriteInt(REG_LOCAL_MACHINE, "SYSTEM\\CurrentControlSet\\Services\\AFD\\Parameters", + "DefaultSendWindow", tcp->SendWindowSize); + } + } +} + +// Initialize the global network settings +void MsInitGlobalNetworkConfig() +{ + if (MsIsNt()) + { + UINT current_window_size; + current_window_size = MsRegReadInt(REG_LOCAL_MACHINE, "SYSTEM\\CurrentControlSet\\Services\\Tcpip\\Parameters", "TcpWindowSize"); + + if (current_window_size == 65535 || current_window_size == 5980160 || + current_window_size == 16777216 || current_window_size == 16777214) + { + // Remove the strange value which is written by older version of PacketiX VPN + MsRegDeleteValue(REG_LOCAL_MACHINE, "SYSTEM\\CurrentControlSet\\Services\\AFD\\Parameters", + "DefaultReceiveWindow"); + MsRegDeleteValue(REG_LOCAL_MACHINE, "SYSTEM\\CurrentControlSet\\Services\\AFD\\Parameters", + "DefaultSendWindow"); + MsRegDeleteValue(REG_LOCAL_MACHINE, "SYSTEM\\CurrentControlSet\\Services\\Tcpip\\Parameters", + "Tcp1323Opts"); + MsRegDeleteValue(REG_LOCAL_MACHINE, "SYSTEM\\CurrentControlSet\\Services\\Tcpip\\Parameters", + "TcpWindowSize"); + MsRegDeleteValue(REG_LOCAL_MACHINE, "SYSTEM\\CurrentControlSet\\Services\\Tcpip\\Parameters", + "GlobalMaxTcpWindowSize"); + + // Set vpn_no_change = true + MsRegWriteInt(REG_LOCAL_MACHINE, "SYSTEM\\CurrentControlSet\\Services\\Tcpip\\Parameters", "vpn_no_change", 1); + MsRegWriteInt(REG_LOCAL_MACHINE, "SYSTEM\\CurrentControlSet\\Services\\AFD\\Parameters", "vpn_no_change", 1); + } + } + else + { + if (MsRegReadInt(REG_LOCAL_MACHINE, + "System\\CurrentControlSet\\Services\\VxD\\MSTCP", + "packetix_no_optimize") == 0) + { + // Disable the DeadGWDetect + MsRegWriteStr(REG_LOCAL_MACHINE, "System\\CurrentControlSet\\Services\\VxD\\MSTCP", + "DeadGWDetect", "0"); + } + } + + MsApplyTcpConfig(); +} + +// Process disabling other off-loading of network and others +void MsDisableNetworkOffloadingEtc() +{ + wchar_t netsh[MAX_SIZE]; + UINT exec_timeout = 10000; + if (MsIsNt() == false) + { + return; + } + + // Get the path of netsh.exe + CombinePathW(netsh, sizeof(netsh), MsGetSystem32DirW(), L"netsh.exe"); + + // Registry settings + MsRegWriteIntEx2(REG_LOCAL_MACHINE, "SYSTEM\\CurrentControlSet\\Services\\Tcpip\\Parameters", "DisableTaskOffload", 1, false, true); + MsRegWriteIntEx2(REG_LOCAL_MACHINE, "SYSTEM\\CurrentControlSet\\Services\\Tcpip\\Parameters", "TcpNumConnections", TCP_MAX_NUM_CONNECTIONS, false, true); + + if (MsIsVista() == false) + { + // Windows Server 2003 or earlier + MsRegWriteIntEx2(REG_LOCAL_MACHINE, "SYSTEM\\CurrentControlSet\\Services\\Tcpip\\Parameters", "EnableRSS", 1, false, true); + MsRegWriteIntEx2(REG_LOCAL_MACHINE, "SYSTEM\\CurrentControlSet\\Services\\Tcpip\\Parameters", "EnableTCPChimney", 1, false, true); + MsRegWriteIntEx2(REG_LOCAL_MACHINE, "SYSTEM\\CurrentControlSet\\Services\\Tcpip\\Parameters", "EnableTCPA", 1, false, true); + + Win32RunAndWaitProcess(netsh, L"netsh int ip set chimney disabled", true, true, exec_timeout); + SleepThread(250); + } + else + { + // Windows Vista or later + Win32RunAndWaitProcess(netsh, L"int ipv4 set global taskoffload=disabled", true, true, exec_timeout); + SleepThread(250); + Win32RunAndWaitProcess(netsh, L"int ipv6 set global taskoffload=disabled", true, true, exec_timeout); + SleepThread(250); + Win32RunAndWaitProcess(netsh, L"int tcp set global chimney=disabled", true, true, exec_timeout); + SleepThread(250); + } +} + +// Upgrade the virtual LAN card +bool MsUpgradeVLan(char *tag_name, char *connection_tag_name, char *instance_name, MS_DRIVER_VER *ver) +{ + bool ret; + + Lock(vlan_lock); + { + ret = MsUpgradeVLanWithoutLock(tag_name, connection_tag_name, instance_name, ver); + } + Unlock(vlan_lock); + + return ret; +} +bool MsUpgradeVLanWithoutLock(char *tag_name, char *connection_tag_name, char *instance_name, MS_DRIVER_VER *ver) +{ + char hwid[MAX_PATH]; + wchar_t hwid_w[MAX_PATH]; + bool ret = false; + UCHAR old_mac_address[6]; + char *s; + // Validate arguments + if (instance_name == NULL || tag_name == NULL || connection_tag_name == NULL || ver == NULL) + { + return false; + } + + if (MsIsNt() == false) + { + // Can not be upgraded in Windows 9x + return false; + } + + if (MsIsInfCatalogRequired()) + { + if (MsIsValidVLanInstanceNameForInfCatalog(instance_name) == false) + { + return false; + } + + StrUpper(instance_name); + } + + Zero(hwid, sizeof(hwid)); + Format(hwid, sizeof(hwid), DRIVER_DEVICE_ID_TAG, instance_name); + StrToUni(hwid_w, sizeof(hwid_w), hwid); + + // Examine whether the virtual LAN card with the specified name has already registered + if (MsIsVLanExists(tag_name, instance_name) == false) + { + // Not registered + return false; + } + + // Get the previous MAC address + s = MsGetMacAddress(tag_name, instance_name); + if (s == NULL) + { + Zero(old_mac_address, 6); + } + else + { + BUF *b; + b = StrToBin(s); + Free(s); + + if (b->Size == 6) + { + Copy(old_mac_address, b->Buf, b->Size); + } + else + { + Zero(old_mac_address, 6); + } + + FreeBuf(b); + } + + ret = MsUninstallVLanWithoutLock(instance_name); + + ret = MsInstallVLanWithoutLock(tag_name, connection_tag_name, instance_name, ver); + + return ret; +} + +// Test for Windows 9x +void MsWin9xTest() +{ +} + +// Update the CompatibleIDs of virtual LAN card +void MsUpdateCompatibleIDs(char *instance_name) +{ + TOKEN_LIST *t; + char id[MAX_SIZE]; + char device_title[MAX_SIZE]; + char device_title_old[MAX_SIZE]; + // Validate arguments + if (instance_name == NULL) + { + return; + } + + Format(id, sizeof(id), DRIVER_DEVICE_ID_TAG, instance_name); + Format(device_title, sizeof(device_title), VLAN_ADAPTER_NAME_TAG, instance_name); + Format(device_title_old, sizeof(device_title_old), VLAN_ADAPTER_NAME_TAG_OLD, instance_name); + + t = MsRegEnumKey(REG_LOCAL_MACHINE, "Enum\\Root\\Net"); + if (t != NULL) + { + UINT i; + for (i = 0;i < t->NumTokens;i++) + { + char keyname[MAX_PATH]; + char *str; + char *title; + + Format(keyname, sizeof(keyname), "Enum\\Root\\Net\\%s", t->Token[i]); + + title = MsRegReadStr(REG_LOCAL_MACHINE, keyname, "DeviceDesc"); + + if (title != NULL) + { + if (StrCmpi(title, device_title) == 0 || StrCmpi(title, device_title_old) == 0) + { + Format(keyname, sizeof(keyname), "Enum\\Root\\Net\\%s",t->Token[i]); + str = MsRegReadStr(REG_LOCAL_MACHINE, keyname, "CompatibleIDs"); + if (str != NULL) + { + Free(str); + } + else + { + MsRegWriteStr(REG_LOCAL_MACHINE, keyname, "CompatibleIDs", id); + } + } + Free(title); + } + } + + FreeToken(t); + } + + MsRegWriteStr(REG_LOCAL_MACHINE, "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Setup", "SourcePath", + ms->System32Dir); +} + +// Installing the virtual LAN card (for Win9x) +bool MsInstallVLan9x(char *instance_name, MS_DRIVER_VER *ver) +{ + char sysdir[MAX_PATH]; + char infdir[MAX_PATH]; + char otherdir[MAX_PATH]; + char syspath[MAX_PATH]; + char syspath2[MAX_PATH]; + char infpath[MAX_PATH]; + char vpn16[MAX_PATH]; + char infpath_src[MAX_PATH]; + char syspath_src[MAX_PATH]; + char neo_sys[MAX_PATH]; + // Validate arguments + if (instance_name == NULL || ver == NULL) + { + return false; + } + + StrCpy(sysdir, sizeof(sysdir), MsGetSystem32Dir()); + Format(infdir, sizeof(infdir), "%s\\inf", MsGetWindowsDir()); + Format(otherdir, sizeof(otherdir), "%s\\other", infdir); + Format(syspath, sizeof(syspath), "%s\\Neo_%s.sys", sysdir, instance_name); + Format(syspath2, sizeof(syspath2), "%s\\Neo_%s.sys", infdir, instance_name); + Format(infpath, sizeof(infpath), "%s\\Neo_%s.inf", infdir, instance_name); + Format(vpn16, sizeof(vpn16), "%s\\vpn16.exe", MsGetMyTempDir()); + + MakeDir(otherdir); + + Format(neo_sys, sizeof(neo_sys), "Neo_%s.sys", instance_name); + + // Copy of vpn16.exe + FileCopy("|vpn16.exe", vpn16); + + // Starting the installation + if (MsStartDriverInstall(instance_name, NULL, neo_sys, NULL, ver) == false) + { + return false; + } + MsGetDriverPathA(instance_name, NULL, NULL, infpath_src, syspath_src, NULL, NULL, neo_sys); + + // Copy of the inf file + FileCopy(infpath_src, infpath); + + // Copy of the sys file + FileCopy(syspath_src, syspath); + + // Install the device driver + if (Run(vpn16, instance_name, false, true) == false) + { + return false; + } + + // Update the CompatibleIDs + MsUpdateCompatibleIDs(instance_name); + + return true; +} + +// Child window enumeration procedure +bool CALLBACK MsEnumChildWindowProc(HWND hWnd, LPARAM lParam) +{ + LIST *o = (LIST *)lParam; + + if (o != NULL) + { + MsEnumChildWindows(o, hWnd); + } + + return true; +} + +// Enumerate specified window and all the its child windows +LIST *MsEnumChildWindows(LIST *o, HWND hWnd) +{ + // Validate arguments + if (hWnd == NULL) + { + return NULL; + } + + if (o == NULL) + { + o = NewListFast(NULL); + } + + MsAddWindowToList(o, hWnd); + + EnumChildWindows(hWnd, MsEnumChildWindowProc, (LPARAM)o); + + return o; +} + +// Add a window to the list +void MsAddWindowToList(LIST *o, HWND hWnd) +{ + // Validate arguments + if (o == NULL || hWnd == NULL) + { + return; + } + + if (IsInList(o, hWnd) == false) + { + Add(o, hWnd); + } +} + +// Enumeration of the window that the thread owns +bool CALLBACK MsEnumThreadWindowProc(HWND hWnd, LPARAM lParam) +{ + LIST *o = (LIST *)lParam; + + if (o == NULL) + { + return false; + } + + MsEnumChildWindows(o, hWnd); + + return true; +} + +// Window enumeration procedure +BOOL CALLBACK EnumTopWindowProc(HWND hWnd, LPARAM lParam) +{ + LIST *o = (LIST *)lParam; + HWND hParent; + char c1[MAX_SIZE], c2[MAX_SIZE]; + // Validate arguments + if (hWnd == NULL || o == NULL) + { + return TRUE; + } + + Zero(c1, sizeof(c1)); + Zero(c2, sizeof(c2)); + + hParent = GetParent(hWnd); + + GetClassName(hWnd, c1, sizeof(c1)); + + if (hParent != NULL) + { + GetClassName(hParent, c2, sizeof(c2)); + } + + if (StrCmpi(c1, "SysIPAddress32") != 0 && (IsEmptyStr(c2) || StrCmpi(c2, "SysIPAddress32") != 0)) + { + AddWindow(o, hWnd); + } + + return TRUE; +} + +// Child window enumeration procedure +BOOL CALLBACK EnumChildWindowProc(HWND hWnd, LPARAM lParam) +{ + ENUM_CHILD_WINDOW_PARAM *p = (ENUM_CHILD_WINDOW_PARAM *)lParam; + LIST *o; + HWND hParent; + char c1[MAX_SIZE], c2[MAX_SIZE]; + bool ok = false; + // Validate arguments + if (hWnd == NULL || p == NULL) + { + return TRUE; + } + + o = p->o; + + Zero(c1, sizeof(c1)); + Zero(c2, sizeof(c2)); + + hParent = GetParent(hWnd); + + GetClassName(hWnd, c1, sizeof(c1)); + + if (hParent != NULL) + { + GetClassName(hParent, c2, sizeof(c2)); + } + + if (p->include_ipcontrol || (StrCmpi(c1, "SysIPAddress32") != 0 && (IsEmptyStr(c2) || StrCmpi(c2, "SysIPAddress32") != 0))) + { + ok = true; + } + + if (MsIsWine()) + { + if (StrCmpi(c1, "SysIPAddress32") == 0 || StrCmpi(c2, "SysIPAddress32") == 0) + { + ok = true; + } + } + + if (ok) + { + AddWindow(o, hWnd); + + if (p->no_recursion == false) + { + EnumChildWindows(hWnd, EnumChildWindowProc, (LPARAM)p); + } + } + + return TRUE; +} +LIST *EnumAllTopWindow() +{ + LIST *o = NewWindowList(); + + EnumWindows(EnumTopWindowProc, (LPARAM)o); + + return o; +} + +// Enumerate the child windows of all that is in the specified window +LIST *EnumAllChildWindow(HWND hWnd) +{ + return EnumAllChildWindowEx(hWnd, false, false, false); +} +LIST *EnumAllChildWindowEx(HWND hWnd, bool no_recursion, bool include_ipcontrol, bool no_self) +{ + ENUM_CHILD_WINDOW_PARAM p; + LIST *o = NewWindowList(); + + Zero(&p, sizeof(p)); + p.include_ipcontrol = include_ipcontrol; + p.no_recursion = no_recursion; + p.o = o; + + if (no_self == false) + { + AddWindow(o, hWnd); + } + + EnumChildWindows(hWnd, EnumChildWindowProc, (LPARAM)&p); + + return o; +} + +// Release of the window list +void FreeWindowList(LIST *o) +{ + UINT i; + // Validate arguments + if (o == NULL) + { + return; + } + + for (i = 0;i < LIST_NUM(o);i++) + { + HWND *e = LIST_DATA(o, i); + + Free(e); + } + + ReleaseList(o); +} + +// Add a window to the window list +void AddWindow(LIST *o, HWND hWnd) +{ + HWND t, *e; + // Validate arguments + if (o == NULL || hWnd == NULL) + { + return; + } + + t = hWnd; + + if (Search(o, &t) != NULL) + { + return; + } + + e = ZeroMalloc(sizeof(HWND)); + *e = hWnd; + + Insert(o, e); +} + +// Comparison of the window list items +int CmpWindowList(void *p1, void *p2) +{ + HWND *h1, *h2; + if (p1 == NULL || p2 == NULL) + { + return 0; + } + h1 = *(HWND **)p1; + h2 = *(HWND **)p2; + if (h1 == NULL || h2 == NULL) + { + return 0; + } + + return Cmp(h1, h2, sizeof(HWND)); +} + +// Creating a new window list +LIST *NewWindowList() +{ + return NewListFast(CmpWindowList); +} + +// Determine whether it's Windows Vista or later +bool MsIsVista() +{ + OS_INFO *info = GetOsInfo(); + + if (info == NULL) + { + return false; + } + + if (OS_IS_WINDOWS_NT(info->OsType)) + { + if (GET_KETA(info->OsType, 100) >= 5) + { + return true; + } + } + + return false; +} + +// Determine whether it's Windows 7 or later +bool MsIsWindows7() +{ + OS_INFO *info = GetOsInfo(); + + if (info == NULL) + { + return false; + } + + if (OS_IS_WINDOWS_NT(info->OsType)) + { + if (GET_KETA(info->OsType, 100) >= 6) + { + return true; + } + } + + return false; +} + +// Determine whether it's Windows 10 or later +bool MsIsWindows10() +{ + OS_INFO *info = GetOsInfo(); + + if (info == NULL) + { + return false; + } + + if (OS_IS_WINDOWS_NT(info->OsType)) + { + if (GET_KETA(info->OsType, 100) == 7) + { + if (GET_KETA(info->OsType, 1) >= 2) + { + return true; + } + } + + if (GET_KETA(info->OsType, 100) >= 8) + { + return true; + } + } + + return false; +} + +// Determine whether it's Windows 8.1 or later +bool MsIsWindows81() +{ + OS_INFO *info = GetOsInfo(); + + if (info == NULL) + { + return false; + } + + if (OS_IS_WINDOWS_NT(info->OsType)) + { + if (GET_KETA(info->OsType, 100) == 7) + { + if (GET_KETA(info->OsType, 1) >= 1) + { + return true; + } + } + + if (GET_KETA(info->OsType, 100) >= 8) + { + return true; + } + } + + return false; +} + +// Determine whether it's Windows 8 or later +bool MsIsWindows8() +{ + OS_INFO *info = GetOsInfo(); + + if (info == NULL) + { + return false; + } + + if (OS_IS_WINDOWS_NT(info->OsType)) + { + if (GET_KETA(info->OsType, 100) >= 7) + { + return true; + } + } + + return false; +} + +// Whether INF catalog signature is required +bool MsIsInfCatalogRequired() +{ + return MsIsWindows8(); +} + +// Get the process path of the owner of the window +bool MsGetWindowOwnerProcessExeName(char *path, UINT size, HWND hWnd) +{ + DWORD procId = 0; + // Validate arguments + if (path == NULL || hWnd == NULL) + { + return false; + } + + GetWindowThreadProcessId(hWnd, &procId); + if (procId == 0) + { + return false; + } + + if (MsGetProcessExeName(path, size, procId) == false) + { + return false; + } + + return true; +} + +// Get the process path from process ID +bool MsGetProcessExeName(char *path, UINT size, UINT id) +{ + LIST *o; + MS_PROCESS *proc; + bool ret = false; + // Validate arguments + if (path == NULL) + { + return false; + } + + o = MsGetProcessList(); + proc = MsSearchProcessById(o, id); + + if (proc != NULL) + { + ret = true; + StrCpy(path, size, proc->ExeFilename); + } + + MsFreeProcessList(o); + + return ret; +} + +// Close the alert dialog +bool MsCloseWarningWindow(NO_WARNING *nw, UINT thread_id) +{ + UINT i; + LIST *o; + bool ret = false; + bool press = false; + + if (MsIsVista() == false || nw->StartTimer == 0) + { + press = true; + } + + if (nw->StartTick != 0 && nw->StartTick <= Tick64()) + { + press = true; + } + + if (MsIsVista() == false) + { + o = NewListFast(NULL); + EnumThreadWindows(thread_id, MsEnumThreadWindowProc, (LPARAM)o); + } + else + { + o = EnumAllTopWindow(); + } + + for (i = 0;i < LIST_NUM(o);i++) + { + HWND hWnd; + + if (nw->Halt) + { + break; + } + + if (MsIsVista() == false) + { + hWnd = LIST_DATA(o, i); + } + else + { + hWnd = *((HWND *)LIST_DATA(o, i)); + } + + if (hWnd != NULL) + { + OS_INFO *info = GetOsInfo(); + + if (MsIsNt()) + { + // Get whether this window is a warning screen of driver + if (MsIsVista() == false) + { + // Other than Windows Vista + HWND hStatic, hOk, hCancel, hDetail; + + hStatic = GetDlgItem(hWnd, 0x14C1); + hOk = GetDlgItem(hWnd, 0x14B7); + hCancel = GetDlgItem(hWnd, 0x14BA); + hDetail = GetDlgItem(hWnd, 0x14B9); + + if ((hStatic != NULL || hDetail != NULL) && hOk != NULL && hCancel != NULL) + { + char tmp[MAX_SIZE]; + bool b = false; + + if (GetClassName(hStatic, tmp, sizeof(tmp)) != 0) + { + if (StrCmpi(tmp, "static") == 0) + { + b = true; + } + } + + if (GetClassName(hDetail, tmp, sizeof(tmp)) != 0) + { + if (StrCmpi(tmp, "button") == 0) + { + b = true; + } + } + + if (b) + { + if (GetClassName(hOk, tmp, sizeof(tmp)) != 0) + { + if (StrCmpi(tmp, "button") == 0) + { + if (GetClassName(hCancel, tmp, sizeof(tmp)) != 0) + { + if (StrCmpi(tmp, "button") == 0) + { + // Press the OK button since it was found + PostMessage(hWnd, WM_COMMAND, 0x14B7, 0); + + ret = true; + } + } + } + } + } + } + } + else + { + // Windows Vista + char exe[MAX_PATH]; + + if (MsGetWindowOwnerProcessExeName(exe, sizeof(exe), hWnd)) + { + if (EndWith(exe, "rundll32.exe")) + { + LIST *o; + HWND h; + UINT i; + + o = EnumAllChildWindow(hWnd); + + if (o != NULL) + { + for (i = 0;i < LIST_NUM(o);i++) + { + char tmp[MAX_SIZE]; + + h = *((HWND *)LIST_DATA(o, i)); + + Zero(tmp, sizeof(tmp)); + GetClassNameA(h, tmp, sizeof(tmp)); + + if (StrCmpi(tmp, "DirectUIHWND") == 0) + { + LIST *o = EnumAllChildWindow(h); + + if (o != NULL) + { + UINT j; + UINT numDirectUIHWND = 0; + UINT numButton = 0; + HWND hButton1 = NULL; + HWND hButton2 = NULL; + + for (j = 0;j < LIST_NUM(o);j++) + { + HWND hh; + char tmp[MAX_SIZE]; + + hh = *((HWND *)LIST_DATA(o, j)); + + Zero(tmp, sizeof(tmp)); + GetClassNameA(hh, tmp, sizeof(tmp)); + + if (StrCmpi(tmp, "DirectUIHWND") == 0) + { + numDirectUIHWND++; + } + + if (StrCmpi(tmp, "button") == 0) + { + numButton++; + if (hButton1 == NULL) + { + hButton1 = hh; + } + else + { + hButton2 = hh; + } + } + } + + if ((numDirectUIHWND == 1 || numDirectUIHWND == 2) && numButton == 2) + { + if (hButton1 != NULL && hButton2 != NULL) + { + HWND hButton; + HWND hParent; + RECT r1, r2; + + GetWindowRect(hButton1, &r1); + GetWindowRect(hButton2, &r2); + + hButton = hButton1; + + if (numDirectUIHWND == 1) + { + // Warning that there is no signature + if (r1.top < r2.top) + { + hButton = hButton2; + } + } + else + { + // Notification that there is signature + if (r1.left >= r2.left) + { + hButton = hButton2; + } + } + + hParent = GetParent(hButton); + + // Press the OK button since it was found + if (press) + { + PostMessage(hParent, WM_COMMAND, 1, 0); + } + + ret = true; + } + } + + FreeWindowList(o); + } + } + } + + FreeWindowList(o); + } + } + } + } + } + } + } + + if (MsIsVista() == false) + { + ReleaseList(o); + } + else + { + FreeWindowList(o); + } + + if (press == false) + { + if (ret) + { + ret = false; + + if (nw->StartTick == 0) + { + nw->StartTick = Tick64() + nw->StartTimer; + } + } + } + + return ret; +} + +// Thread to suppress a warning message +void MsNoWarningThreadProc(THREAD *thread, void *param) +{ + NO_WARNING *nw; + UINT interval; + UINT i; + bool found0 = false; + // Validate arguments + if (thread == NULL) + { + return; + } + + nw = (NO_WARNING *)param; + + nw->NoWarningThread = thread; + AddRef(thread->ref); + + NoticeThreadInit(thread); + + interval = 50; + + if (MsIsVista()) + { + interval = 1000; + } + + i = 0; + + while (nw->Halt == false) + { + bool found = false; + + // Close the alert dialog + found = MsCloseWarningWindow(nw, nw->ThreadId); + if (i == 0) + { + found0 = found; + } + else + { + if (found0 == false && found) + { + break; + } + } + i++; + + // Loop until the command incomes from parent thread + Wait(nw->HaltEvent, interval); + } +} + +// Initialize the procedure to turn off the warning sound +char *MsNoWarningSoundInit() +{ + char *ret = MsRegReadStr(REG_CURRENT_USER, "AppEvents\\Schemes\\Apps\\.Default\\SystemAsterisk\\.Current", ""); + + if (IsEmptyStr(ret)) + { + Free(ret); + ret = NULL; + } + else + { + MsRegWriteStr(REG_CURRENT_USER, + "AppEvents\\Schemes\\Apps\\.Default\\SystemAsterisk\\.Current", + "", ""); + } + + return ret; +} + +// Release of procedure to turn off the warning sound +void MsNoWarningSoundFree(char *s) +{ + // Validate arguments + if (s == NULL) + { + return; + } + + MsRegWriteStrExpand(REG_CURRENT_USER, + "AppEvents\\Schemes\\Apps\\.Default\\SystemAsterisk\\.Current", + "", s); + + Free(s); +} + +// The start of the procedure to suppress the warning +NO_WARNING *MsInitNoWarning() +{ + return MsInitNoWarningEx(0); +} +NO_WARNING *MsInitNoWarningEx(UINT start_timer) +{ + THREAD *thread; + NO_WARNING *nw = ZeroMalloc(sizeof(NO_WARNING)); + + nw->StartTimer = (UINT64)start_timer; + + // Get the current sound file name + if (MsIsVista() == false) + { + wchar_t *tmp; + + // Turn off the unnecessary warning tone in Windows XP or earlier + tmp = MsRegReadStrW(REG_CURRENT_USER, "AppEvents\\Schemes\\Apps\\.Default\\SystemAsterisk\\.Current", ""); + if (UniIsEmptyStr(tmp) == false) + { + nw->SoundFileName = CopyUniStr(tmp); + + MsRegWriteStrW(REG_CURRENT_USER, + "AppEvents\\Schemes\\Apps\\.Default\\SystemAsterisk\\.Current", + "", L""); + } + + Free(tmp); + } + + nw->ThreadId = GetCurrentThreadId(); + nw->HaltEvent = NewEvent(); + + thread = NewThread(MsNoWarningThreadProc, nw); + WaitThreadInit(thread); + + ReleaseThread(thread); + + return nw; +} + +// End of the procedure to suppress the warning +void MsFreeNoWarning(NO_WARNING *nw) +{ + // Validate arguments + if (nw == NULL) + { + return; + } + + nw->Halt = true; + Set(nw->HaltEvent); + + WaitThread(nw->NoWarningThread, INFINITE); + ReleaseThread(nw->NoWarningThread); + + ReleaseEvent(nw->HaltEvent); + + if (MsIsVista() == false) + { + if (nw->SoundFileName != NULL) + { + MsRegWriteStrExpandW(REG_CURRENT_USER, + "AppEvents\\Schemes\\Apps\\.Default\\SystemAsterisk\\.Current", + "", nw->SoundFileName); + + Free(nw->SoundFileName); + } + } + + Free(nw); +} + +// Obtain the name of the directory that the inf catalog file is stored +void MsGetInfCatalogDir(char *dst, UINT size) +{ + // Validate arguments + if (dst == NULL) + { + return; + } + + Format(dst, size, "|DriverPackages\\%s\\%s", (MsIsWindows10() ? "Neo6_Win10" : "Neo6_Win8"), (MsIsX64() ? "x64" : "x86")); +} + +// Examine whether the virtual LAN card name can be used as a instance name of the VLAN +bool MsIsValidVLanInstanceNameForInfCatalog(char *instance_name) +{ + char src_dir[MAX_SIZE]; + char tmp[MAX_SIZE]; + bool ret; + // Validate arguments + if (instance_name == NULL) + { + return false; + } + + MsGetInfCatalogDir(src_dir, sizeof(src_dir)); + + Format(tmp, sizeof(tmp), "%s\\Neo6_%s_%s.inf", src_dir, (MsIsX64() ? "x64" : "x86"), instance_name); + + ret = IsFile(tmp); + + return ret; +} + +// Delete the device information that is about the device which failed during the installation of the same name before installing the virtual LAN card +void MsDeleteTroubleVLAN(char *tag_name, char *instance_name) +{ + HDEVINFO dev_info; + SP_DEVINFO_LIST_DETAIL_DATA detail_data; + SP_DEVINFO_DATA data; + UINT i; + char target_name[MAX_SIZE]; + LIST *o; + // Validate arguments + if (tag_name == NULL || instance_name == NULL) + { + return; + } + + Format(target_name, sizeof(target_name), DRIVER_DEVICE_ID_TAG, instance_name); + + // Create a device information list + dev_info = SetupDiGetClassDevsEx(NULL, NULL, NULL, DIGCF_ALLCLASSES | DIGCF_PRESENT, NULL, NULL, NULL); + if (dev_info == NULL) + { + return; + } + + Zero(&detail_data, sizeof(detail_data)); + detail_data.cbSize = sizeof(detail_data); + if (SetupDiGetDeviceInfoListDetail(dev_info, &detail_data) == false) + { + MsDestroyDevInfo(dev_info); + return; + } + + Zero(&data, sizeof(data)); + data.cbSize = sizeof(data); + + // Enumeration start + o = NewListFast(NULL); + + for (i = 0;SetupDiEnumDeviceInfo(dev_info, i, &data);i++) + { + char *buffer; + UINT buffer_size = 8092; + DWORD data_type; + + buffer = ZeroMalloc(buffer_size); + + if (SetupDiGetDeviceRegistryProperty(dev_info, &data, SPDRP_HARDWAREID, &data_type, (PBYTE)buffer, buffer_size, NULL)) + { + if (StrCmpi(buffer, target_name) == 0) + { + // Found + SP_DEVINFO_DATA *data2 = Clone(&data, sizeof(SP_DEVINFO_DATA)); + + Add(o, data2); + } + } + + Free(buffer); + } + + for (i = 0;i < LIST_NUM(o);i++) + { + SP_DEVINFO_DATA *data = LIST_DATA(o, i); + bool ret; + + ret = SetupDiRemoveDevice(dev_info, data); + + Debug("Deleting Troubled NIC %u: %u\n", i, ret); + + Free(data); + } + + ReleaseList(o); + + MsDestroyDevInfo(dev_info); +} + +// Install a virtual LAN card +bool MsInstallVLan(char *tag_name, char *connection_tag_name, char *instance_name, MS_DRIVER_VER *ver) +{ + bool ret; + + Lock(vlan_lock); + { + ret = MsInstallVLanWithoutLock(tag_name, connection_tag_name, instance_name, ver); + } + Unlock(vlan_lock); + + return ret; +} +bool MsInstallVLanWithoutLock(char *tag_name, char *connection_tag_name, char *instance_name, MS_DRIVER_VER *ver) +{ + wchar_t infpath[MAX_PATH]; + char hwid[MAX_PATH]; + wchar_t hwid_w[MAX_PATH]; + bool ret = false; + char neo_sys[MAX_PATH]; + UCHAR new_mac_address[6]; + UINT i; + // Validate arguments + if (instance_name == NULL || tag_name == NULL || connection_tag_name == NULL || ver == NULL) + { + return false; + } + + if (MsIsNt() == false) + { + // For Windows 9x + return MsInstallVLan9x(instance_name, ver); + } + + if (MsIsInfCatalogRequired()) + { + if (MsIsValidVLanInstanceNameForInfCatalog(instance_name) == false) + { + Debug("MsIsValidVLanInstanceNameForInfCatalog() returns false.\n"); + return false; + } + + StrUpper(instance_name); + } + + Zero(hwid, sizeof(hwid)); + Format(hwid, sizeof(hwid), DRIVER_DEVICE_ID_TAG, instance_name); + StrToUni(hwid_w, sizeof(hwid_w), hwid); + + // Examine whether the virtual LAN card with the specified name has already registered + if (MsIsVLanExists(tag_name, instance_name)) + { + // Already be registered + Debug("MsIsVLanExists() returns true.\n"); + return false; + } + + // Determining destination .sys file name of the installation + if (MsIsInfCatalogRequired() == false) + { + if (MsMakeNewNeoDriverFilename(neo_sys, sizeof(neo_sys)) == false) + { + return false; + } + } + else + { + if (MsIsWindows10() == false) + { + Format(neo_sys, sizeof(neo_sys), "Neo_%s.sys", instance_name); + } + else + { + Format(neo_sys, sizeof(neo_sys), "Neo6_%s_%s.sys", (MsIsX64() ? "x64" : "x86"), instance_name); + } + } + + // Starting the Installation + if (MsStartDriverInstall(instance_name, NULL, neo_sys, new_mac_address, ver) == false) + { + return false; + } + MsGetDriverPath(instance_name, NULL, NULL, infpath, NULL, NULL, NULL, neo_sys); + + // Delete the device information that is left on fail of installation + if (MsIsNt()) + { + MsDeleteTroubleVLAN(tag_name, instance_name); + } + + // Call the Win32 API + ret = MsInstallVLanInternal(infpath, hwid_w, hwid); + + // Installation complete + MsFinishDriverInstall(instance_name, neo_sys); + + for (i = 0;i < 5;i++) + { + MsInitNetworkConfig(tag_name, instance_name, connection_tag_name); + if (MsIsInfCatalogRequired()) + { + // Write the MAC address + char mac_address_str[MAX_SIZE]; + BinToStr(mac_address_str, sizeof(mac_address_str), new_mac_address, sizeof(new_mac_address)); + MsSetMacAddress(VLAN_ADAPTER_NAME_TAG, instance_name, mac_address_str); + } + + SleepThread(MsIsVista() ? 1000 : 300); + } + + if (ret) + { + MsDisableVLan(instance_name); + SleepThread(MsIsVista() ? 1000 : 300); + MsEnableVLan(instance_name); + } + + return ret; +} + +// Test function +void MsTest() +{ +} + +// Install a virtual LAN card (by calling Win32 API) +bool MsInstallVLanInternal(wchar_t *infpath, wchar_t *hwid_w, char *hwid) +{ + bool need_reboot; + bool ret = false; + wchar_t inf_class_name[MAX_PATH]; + GUID inf_class_guid; + HDEVINFO device_info; + SP_DEVINFO_DATA device_info_data; + // Validate arguments + if (infpath == NULL || hwid_w == NULL || hwid == NULL) + { + return false; + } + + Debug("MsInstallVLanInternal('%S', '%S', '%s');\n", + infpath, hwid_w, hwid); + + Zero(&inf_class_guid, sizeof(inf_class_guid)); + Zero(&device_info, sizeof(device_info)); + Zero(&device_info_data, sizeof(device_info_data)); + Zero(inf_class_name, sizeof(inf_class_name)); + + // Get the class GUID of the inf file + if (SetupDiGetINFClassW(infpath, &inf_class_guid, inf_class_name, sizeof(inf_class_name), NULL)) + { + // Get the device information set + device_info = SetupDiCreateDeviceInfoList(&inf_class_guid, NULL); + if (device_info != INVALID_HANDLE_VALUE) + { + // Windows 2000 or later + Zero(&device_info_data, sizeof(device_info_data)); + device_info_data.cbSize = sizeof(device_info_data); + if (SetupDiCreateDeviceInfoW(device_info, inf_class_name, &inf_class_guid, + NULL, NULL, DICD_GENERATE_ID, &device_info_data)) + { + char hwid_copy[MAX_SIZE]; + Zero(hwid_copy, sizeof(hwid_copy)); + StrCpy(hwid_copy, sizeof(hwid_copy), hwid); + + // Set the registry information + if (SetupDiSetDeviceRegistryProperty(device_info, &device_info_data, + SPDRP_HARDWAREID, (BYTE *)hwid_copy, sizeof(hwid_copy))) + { + NO_WARNING *nw = NULL; + + //if (MsIsVista() == false) + { + nw = MsInitNoWarning(); + } + + // Start the class installer + if (SetupDiCallClassInstaller(DIF_REGISTERDEVICE, device_info, + &device_info_data)) + { + // Do the installation + if (ms->nt->UpdateDriverForPlugAndPlayDevicesW( + NULL, hwid_w, infpath, 1, &need_reboot)) + { + ret = true; + } + else + { + // Installation Failed + Debug("UpdateDriverForPlugAndPlayDevicesW Error: %X\n", GetLastError()); + if (SetupDiCallClassInstaller(DIF_REMOVE, device_info, + &device_info_data) == false) + { + Debug("SetupDiCallClassInstaller for Delete Failed. Err=%X\n", GetLastError()); + } + + if (SetupDiRemoveDevice(device_info, &device_info_data) == false) + { + Debug("SetupDiRemoveDevice for Delete Failed. Err=%X\n", GetLastError()); + } + } + } + else + { + Debug("SetupDiCallClassInstaller for Create Error: %X\n", GetLastError()); + } + + MsFreeNoWarning(nw); + } + else + { + Debug("SetupDiSetDeviceRegistryProperty Error: %X\n", GetLastError()); + } + } + else + { + Debug("SetupDiCreateDeviceInfoW Error: %X\n", GetLastError()); + } + // Remove the device information set + SetupDiDestroyDeviceInfoList(device_info); + } + else + { + Debug("SetupDiCreateDeviceInfoList Error: %X\n", GetLastError()); + } + } + else + { + Debug("SetupDiGetINFClassW Error: %X\n", GetLastError()); + } + + return ret; +} + +// Get the device information from the device ID +HDEVINFO MsGetDevInfoFromDeviceId(SP_DEVINFO_DATA *dev_info_data, char *device_id) +{ + HDEVINFO dev_info; + SP_DEVINFO_LIST_DETAIL_DATA detail_data; + SP_DEVINFO_DATA data; + UINT i; + bool found; + char target_name[MAX_SIZE]; + // Validate arguments + if (dev_info_data == NULL || device_id == NULL) + { + return NULL; + } + + StrCpy(target_name, sizeof(target_name), device_id); + + // Create a device information list + dev_info = SetupDiGetClassDevsEx(NULL, NULL, NULL, DIGCF_ALLCLASSES | DIGCF_PRESENT, NULL, NULL, NULL); + if (dev_info == NULL) + { + return NULL; + } + + Zero(&detail_data, sizeof(detail_data)); + detail_data.cbSize = sizeof(detail_data); + if (SetupDiGetDeviceInfoListDetail(dev_info, &detail_data) == false) + { + MsDestroyDevInfo(dev_info); + return NULL; + } + + Zero(&data, sizeof(data)); + data.cbSize = sizeof(data); + + // Enumeration start + found = false; + for (i = 0;SetupDiEnumDeviceInfo(dev_info, i, &data);i++) + { + char *buffer; + UINT buffer_size = 8092; + DWORD data_type; + + buffer = ZeroMalloc(buffer_size); + + if (SetupDiGetDeviceRegistryProperty(dev_info, &data, SPDRP_HARDWAREID, &data_type, (PBYTE)buffer, buffer_size, NULL)) + { + if (StrCmpi(buffer, target_name) == 0) + { + // Found + found = true; + } + } + + Free(buffer); + + if (found) + { + break; + } + } + + if (found == false) + { + MsDestroyDevInfo(dev_info); + return NULL; + } + else + { + Copy(dev_info_data, &data, sizeof(data)); + return dev_info; + } +} + +// Examine whether the specified device is operating +bool MsIsDeviceRunning(HDEVINFO info, SP_DEVINFO_DATA *dev_info_data) +{ + SP_DEVINFO_LIST_DETAIL_DATA detail; + UINT status = 0, problem = 0; + // Validate arguments + if (info == NULL || dev_info_data == NULL) + { + return false; + } + + Zero(&detail, sizeof(detail)); + detail.cbSize = sizeof(detail); + + if (SetupDiGetDeviceInfoListDetail(info, &detail) == false || + ms->nt->CM_Get_DevNode_Status_Ex(&status, &problem, dev_info_data->DevInst, + 0, detail.RemoteMachineHandle) != CR_SUCCESS) + { + return false; + } + + if (status & 8) + { + return true; + } + else + { + return false; + } +} + +// Start the specified device +bool MsStartDevice(HDEVINFO info, SP_DEVINFO_DATA *dev_info_data) +{ + SP_PROPCHANGE_PARAMS p; + // Validate arguments + if (info == NULL || dev_info_data == NULL) + { + return false; + } + + Zero(&p, sizeof(p)); + p.ClassInstallHeader.cbSize = sizeof(SP_CLASSINSTALL_HEADER); + p.ClassInstallHeader.InstallFunction = DIF_PROPERTYCHANGE; + p.StateChange = DICS_ENABLE; + p.Scope = DICS_FLAG_GLOBAL; + if (SetupDiSetClassInstallParams(info, dev_info_data, &p.ClassInstallHeader, sizeof(p))) + { + SetupDiCallClassInstaller(DIF_PROPERTYCHANGE, info, dev_info_data); + } + + Zero(&p, sizeof(p)); + p.ClassInstallHeader.cbSize = sizeof(SP_CLASSINSTALL_HEADER); + p.ClassInstallHeader.InstallFunction = DIF_PROPERTYCHANGE; + p.StateChange = DICS_ENABLE; + p.Scope = DICS_FLAG_CONFIGSPECIFIC; + + if (SetupDiSetClassInstallParams(info, dev_info_data, &p.ClassInstallHeader, sizeof(p)) == false || + SetupDiCallClassInstaller(DIF_PROPERTYCHANGE, info, dev_info_data) == false) + { + return false; + } + + return true; +} + +// Stop the specified device +bool MsStopDevice(HDEVINFO info, SP_DEVINFO_DATA *dev_info_data) +{ + SP_PROPCHANGE_PARAMS p; + // Validate arguments + if (info == NULL || dev_info_data == NULL) + { + return false; + } + + Zero(&p, sizeof(p)); + p.ClassInstallHeader.cbSize = sizeof(SP_CLASSINSTALL_HEADER); + p.ClassInstallHeader.InstallFunction = DIF_PROPERTYCHANGE; + p.StateChange = DICS_DISABLE; + p.Scope = DICS_FLAG_CONFIGSPECIFIC; + + if (SetupDiSetClassInstallParams(info, dev_info_data, &p.ClassInstallHeader, sizeof(p)) == false || + SetupDiCallClassInstaller(DIF_PROPERTYCHANGE, info, dev_info_data) == false) + { + return false; + } + + return true; +} + +// Remove the specified device +bool MsDeleteDevice(HDEVINFO info, SP_DEVINFO_DATA *dev_info_data) +{ + SP_REMOVEDEVICE_PARAMS p; + SP_DEVINFO_LIST_DETAIL_DATA detail; + char device_id[MAX_PATH]; + CONFIGRET ret; + // Validate arguments + if (info == NULL || dev_info_data == NULL) + { + return false; + } + + Zero(&detail, sizeof(detail)); + detail.cbSize = sizeof(detail); + + if (SetupDiGetDeviceInfoListDetail(info, &detail) == false) + { + Debug("SetupDiGetDeviceInfoListDetail Failed. Err=0x%X\n", GetLastError()); + return false; + } + + ret = ms->nt->CM_Get_Device_ID_Ex(dev_info_data->DevInst, device_id, sizeof(device_id), + 0, detail.RemoteMachineHandle); + if (ret != CR_SUCCESS) + { + Debug("CM_Get_Device_ID_Ex Failed. Err=0x%X\n", ret); + return false; + } + + Zero(&p, sizeof(p)); + p.ClassInstallHeader.cbSize = sizeof(SP_CLASSINSTALL_HEADER); + p.ClassInstallHeader.InstallFunction = DIF_REMOVE; + p.Scope = DI_REMOVEDEVICE_GLOBAL; + + if (SetupDiSetClassInstallParams(info, dev_info_data, &p.ClassInstallHeader, sizeof(p)) == false) + { + Debug("SetupDiSetClassInstallParams Failed. Err=0x%X\n", GetLastError()); + return false; + } + + if (SetupDiCallClassInstaller(DIF_REMOVE, info, dev_info_data) == false) + { + Debug("SetupDiCallClassInstaller Failed. Err=0x%X\n", GetLastError()); + return false; + } + + return true; +} + +// Enable the virtual LAN card +bool MsEnableVLan(char *instance_name) +{ + bool ret; + + Lock(vlan_lock); + { + ret = MsEnableVLanWithoutLock(instance_name); + } + Unlock(vlan_lock); + + return ret; +} +bool MsEnableVLanWithoutLock(char *instance_name) +{ + char tmp[MAX_PATH]; + HDEVINFO h; + bool ret; + SP_DEVINFO_DATA data; + // Validate arguments + if (instance_name == NULL) + { + return false; + } + + if (MsIsNt() == false) + { + return false; + } + + Format(tmp, sizeof(tmp), DRIVER_DEVICE_ID_TAG, instance_name); + + h = MsGetDevInfoFromDeviceId(&data, tmp); + if (h == NULL) + { + return false; + } + + ret = MsStartDevice(h, &data); + + MsDestroyDevInfo(h); + + return ret; +} + +// Disable the virtual LAN card +bool MsDisableVLan(char *instance_name) +{ + bool ret; + + Lock(vlan_lock); + { + ret = MsDisableVLanWithoutLock(instance_name); + } + Unlock(vlan_lock); + + return ret; +} +bool MsDisableVLanWithoutLock(char *instance_name) +{ + char tmp[MAX_PATH]; + HDEVINFO h; + bool ret; + SP_DEVINFO_DATA data; + // Validate arguments + if (instance_name == NULL) + { + return false; + } + + if (MsIsNt() == false) + { + return false; + } + + Format(tmp, sizeof(tmp), DRIVER_DEVICE_ID_TAG, instance_name); + + h = MsGetDevInfoFromDeviceId(&data, tmp); + if (h == NULL) + { + return false; + } + + ret = MsStopDevice(h, &data); + + MsDestroyDevInfo(h); + + return ret; +} + +// Restart the virtual LAN card +void MsRestartVLan(char *instance_name) +{ + Lock(vlan_lock); + { + MsRestartVLanWithoutLock(instance_name); + } + Unlock(vlan_lock); +} +void MsRestartVLanWithoutLock(char *instance_name) +{ + // Validate arguments + if (instance_name == NULL) + { + return; + } + + if (MsIsNt() == false) + { + return; + } + + if (MsIsVLanEnabled(instance_name) == false) + { + return; + } + + MsDisableVLan(instance_name); + MsEnableVLan(instance_name); +} + +// Get whether the virtual LAN card is working +bool MsIsVLanEnabled(char *instance_name) +{ + bool ret; + + Lock(vlan_lock); + { + ret = MsIsVLanEnabledWithoutLock(instance_name); + } + Unlock(vlan_lock); + + return ret; +} +bool MsIsVLanEnabledWithoutLock(char *instance_name) +{ + char tmp[MAX_PATH]; + HDEVINFO h; + bool ret; + SP_DEVINFO_DATA data; + // Validate arguments + if (instance_name == NULL) + { + return false; + } + + if (MsIsNt() == false) + { + return true; + } + + Format(tmp, sizeof(tmp), DRIVER_DEVICE_ID_TAG, instance_name); + + h = MsGetDevInfoFromDeviceId(&data, tmp); + if (h == NULL) + { + return false; + } + + ret = MsIsDeviceRunning(h, &data); + + MsDestroyDevInfo(h); + + return ret; +} + +// Uninstall the virtual LAN card +bool MsUninstallVLan(char *instance_name) +{ + bool ret; + + Lock(vlan_lock); + { + ret = MsUninstallVLanWithoutLock(instance_name); + } + Unlock(vlan_lock); + + return ret; +} +bool MsUninstallVLanWithoutLock(char *instance_name) +{ + char tmp[MAX_PATH]; + HDEVINFO h; + bool ret; + SP_DEVINFO_DATA data; + // Validate arguments + if (instance_name == NULL) + { + return false; + } + + Format(tmp, sizeof(tmp), DRIVER_DEVICE_ID_TAG, instance_name); + + h = MsGetDevInfoFromDeviceId(&data, tmp); + if (h == NULL) + { + return false; + } + + ret = MsDeleteDevice(h, &data); + + MsDestroyDevInfo(h); + + return ret; +} + +// Dispose the device information +void MsDestroyDevInfo(HDEVINFO info) +{ + // Validate arguments + if (info == NULL) + { + return; + } + + SetupDiDestroyDeviceInfoList(info); +} + +// Start the driver installation +bool MsStartDriverInstall(char *instance_name, UCHAR *mac_address, char *neo_sys, UCHAR *ret_mac_address, MS_DRIVER_VER *ver) +{ + wchar_t src_inf[MAX_PATH]; + wchar_t src_sys[MAX_PATH]; + wchar_t dest_inf[MAX_PATH]; + wchar_t dest_sys[MAX_PATH]; + wchar_t src_cat[MAX_PATH]; + wchar_t dst_cat[MAX_PATH]; + UCHAR mac_address_bin[6]; + char mac_address_str[32]; + UINT size; + char *tmp; + BUF *b; + IO *io; + char str_year[16]; + char str_month[16]; + char str_day[16]; + char str_major[16]; + char str_minor[16]; + char str_build[16]; + // Validate arguments + if (instance_name == NULL || neo_sys == NULL || ver == NULL) + { + return false; + } + + Format(str_year, sizeof(str_year), "%04d", ver->Year); + Format(str_month, sizeof(str_month), "%02d", ver->Month); + Format(str_day, sizeof(str_day), "%02d", ver->Day); + + ToStr(str_major, ver->Major); + ToStr(str_minor, ver->Minor); + ToStr(str_build, ver->Build); + + MsGetDriverPath(instance_name, src_inf, src_sys, dest_inf, dest_sys, src_cat, dst_cat, neo_sys); + Debug("MsStartDriverInstall\n"); + Debug(" instance_name: %s\n", instance_name); + Debug(" src_inf: %S\n", src_inf); + Debug(" src_sys: %S\n", src_sys); + Debug(" dest_inf: %S\n", dest_inf); + Debug(" dest_sys: %S\n", dest_sys); + Debug(" src_cat: %S\n", src_cat); + Debug(" dst_cat: %S\n", dst_cat); + Debug(" neo_sys: %s\n", neo_sys); + + // Processing INF file + io = FileOpenW(src_inf, false); + if (io == NULL) + { + return false; + } + + size = FileSize(io); + tmp = ZeroMalloc(size * 2); + if (FileRead(io, tmp, size) == false) + { + FileClose(io); + Free(tmp); + return false; + } + + FileClose(io); + + if (mac_address == NULL) + { + MsGenMacAddress(mac_address_bin); + } + else + { + Copy(mac_address_bin, mac_address, 6); + } + + BinToStr(mac_address_str, sizeof(mac_address_str), mac_address_bin, sizeof(mac_address_bin)); + + //ReplaceStrEx(tmp, size * 2, tmp, "$TAG_DRIVER_VER$", DRIVER_VER_STR, false); + ReplaceStrEx(tmp, size * 2, tmp, "$TAG_INSTANCE_NAME$", instance_name, false); + ReplaceStrEx(tmp, size * 2, tmp, "$TAG_MAC_ADDRESS$", mac_address_str, false); + ReplaceStrEx(tmp, size * 2, tmp, "$TAG_SYS_NAME$", neo_sys, false); + ReplaceStrEx(tmp, size * 2, tmp, "$YEAR$", str_year, false); + ReplaceStrEx(tmp, size * 2, tmp, "$MONTH$", str_month, false); + ReplaceStrEx(tmp, size * 2, tmp, "$DAY$", str_day, false); + ReplaceStrEx(tmp, size * 2, tmp, "$VER_MAJOR$", str_major, false); + ReplaceStrEx(tmp, size * 2, tmp, "$VER_MINOR$", str_minor, false); + ReplaceStrEx(tmp, size * 2, tmp, "$VER_BUILD$", str_build, false); + + if (MsIsVista()) + { + //ReplaceStrEx(tmp, size * 2, tmp, "\"100\"", "\"2000\"", false); + } + + io = FileCreateW(dest_inf); + if (io == NULL) + { + Free(tmp); + return false; + } + + FileWrite(io, tmp, StrLen(tmp)); + FileClose(io); + + Free(tmp); + + // Processing the SYS file + b = ReadDumpW(src_sys); + if (b == NULL) + { + return false; + } + + if (DumpBufW(b, dest_sys) == false) + { + FreeBuf(b); + return false; + } + + FreeBuf(b); + + // Copy of the catalog file + if (IsEmptyUniStr(src_cat) == false && IsEmptyUniStr(dst_cat) == false) + { + if (FileCopyW(src_cat, dst_cat) == false) + { + return false; + } + } + + if (ret_mac_address != NULL) + { + Copy(ret_mac_address, mac_address_bin, 6); + } + + return true; +} + +// Generation of the MAC address +void MsGenMacAddress(UCHAR *mac) +{ + UCHAR hash_src[40]; + UCHAR hash[20]; + UINT64 now; + // Validate arguments + if (mac == NULL) + { + return; + } + + Rand(hash_src, 40); + now = SystemTime64(); + Copy(hash_src, &now, sizeof(now)); + + Sha0(hash, hash_src, sizeof(hash_src)); + + mac[0] = 0x5E; + mac[1] = hash[0]; + mac[2] = hash[1]; + mac[3] = hash[2]; + mac[4] = hash[3]; + mac[5] = hash[4]; +} + +// Finish the driver installation +void MsFinishDriverInstall(char *instance_name, char *neo_sys) +{ + wchar_t src_inf[MAX_PATH]; + wchar_t src_sys[MAX_PATH]; + wchar_t dest_inf[MAX_PATH]; + wchar_t dest_sys[MAX_PATH]; + wchar_t src_cat[MAX_SIZE]; + wchar_t dst_cat[MAX_SIZE]; + // Validate arguments + if (instance_name == NULL) + { + return; + } + + MsGetDriverPath(instance_name, src_inf, src_sys, dest_inf, dest_sys, src_cat, dst_cat, neo_sys); + + // Delete the files + FileDeleteW(dest_inf); + FileDeleteW(dest_sys); + + if (IsEmptyUniStr(dst_cat) == false) + { + FileDeleteW(dst_cat); + } +} + +// Get the path to the driver file +void MsGetDriverPath(char *instance_name, wchar_t *src_inf, wchar_t *src_sys, wchar_t *dest_inf, wchar_t *dest_sys, wchar_t *src_cat, wchar_t *dest_cat, char *neo_sys) +{ + wchar_t *src_filename; + wchar_t *src_sys_filename; + // Validate arguments + if (instance_name == NULL) + { + return; + } + + // WinNT x86 + src_filename = L"|DriverPackages\\Neo\\x86\\Neo_x86.inf"; + src_sys_filename = L"|DriverPackages\\Neo\\x86\\Neo_x86.sys"; + + if (MsIsNt() == false) + { + // Win9x + src_filename = L"|DriverPackages\\Neo9x\\x86\\Neo9x_x86.inf"; + src_sys_filename = L"|DriverPackages\\Neo9x\\x86\\Neo9x_x86.sys"; + } + else if (MsIsX64()) + { + // WinNT x64 + src_filename = L"|DriverPackages\\Neo\\x64\\Neo_x64.inf"; + src_sys_filename = L"|DriverPackages\\Neo\\x64\\Neo_x64.sys"; + } + + if (MsIsWindows7()) + { + // Use the NDIS 6.2 driver for Windows 7 or later + if (MsIsX64()) + { + src_filename = L"|DriverPackages\\Neo6\\x64\\Neo6_x64.inf"; + src_sys_filename = L"|DriverPackages\\Neo6\\x64\\Neo6_x64.sys"; + } + else + { + src_filename = L"|DriverPackages\\Neo6\\x86\\Neo6_x86.inf"; + src_sys_filename = L"|DriverPackages\\Neo6\\x86\\Neo6_x86.sys"; + } + } + + if (MsIsInfCatalogRequired()) + { + // Windows 8 or later + if (MsIsX64()) + { + src_filename = L"|DriverPackages\\Neo6_Win8\\x64\\Neo6_x64.inf"; + src_sys_filename = L"|DriverPackages\\Neo6_Win8\\x64\\Neo6_x64.sys"; + } + else + { + src_filename = L"|DriverPackages\\Neo6_Win8\\x86\\Neo6_x86.inf"; + src_sys_filename = L"|DriverPackages\\Neo6_Win8\\x86\\Neo6_x86.sys"; + } + } + + if (src_inf != NULL) + { + if (MsIsInfCatalogRequired() == false) + { + // Windows 7 or before + UniStrCpy(src_inf, MAX_PATH, src_filename); + } + else + { + // Windows 8.1 or later + char tmp[MAX_SIZE]; + + MsGetInfCatalogDir(tmp, sizeof(tmp)); + + UniFormat(src_inf, MAX_PATH, L"%S\\Neo6_%S_%S.inf", tmp, (MsIsX64() ? "x64" : "x86"), instance_name); + } + } + + if (src_sys != NULL) + { + UniStrCpy(src_sys, MAX_PATH, src_sys_filename); + + if (MsIsWindows10()) + { + UniFormat(src_sys, MAX_PATH, L"|DriverPackages\\Neo6_Win10\\%S\\Neo6_%S_%S.sys", + (MsIsX64() ? "x64" : "x86"), (MsIsX64() ? "x64" : "x86"), instance_name); + } + } + + if (dest_inf != NULL) + { + char inf_name[MAX_PATH]; + + if (MsIsInfCatalogRequired() == false) + { + Format(inf_name, sizeof(inf_name), "Neo_%s.inf", instance_name); + } + else + { + Format(inf_name, sizeof(inf_name), "Neo6_%s_%s.inf", (MsIsX64() ? "x64" : "x86"), instance_name); + } + UniFormat(dest_inf, MAX_PATH, L"%s\\%S", ms->MyTempDirW, inf_name); + } + + if (dest_sys != NULL) + { + char sys_name[MAX_PATH]; + StrCpy(sys_name, sizeof(sys_name), neo_sys); + UniFormat(dest_sys, MAX_PATH, L"%s\\%S", ms->MyTempDirW, sys_name); + } + + if (src_cat != NULL) + { + if (MsIsInfCatalogRequired()) + { + char tmp[MAX_SIZE]; + + MsGetInfCatalogDir(tmp, sizeof(tmp)); + + if (MsIsWindows8() == false) + { + // Windows Vista and Windows 7 uses SHA-1 catalog files + // (Unused? Never reach here!) + UniFormat(src_cat, MAX_PATH, L"%S\\inf.cat", tmp); + } + else + { + // Windows 8 or above uses SHA-256 catalog files + UniFormat(src_cat, MAX_PATH, L"%S\\inf2.cat", tmp); + } + + if (MsIsWindows10()) + { + // Windows 10 + UniFormat(src_cat, MAX_PATH, L"%S\\Neo6_%S_%S.cat", tmp, (MsIsX64() ? "x64" : "x86"), instance_name); + } + } + else + { + UniStrCpy(src_cat, MAX_PATH, L""); + } + } + + if (dest_cat != NULL) + { + if (MsIsInfCatalogRequired()) + { + if (MsIsWindows10() == false) + { + UniFormat(dest_cat, MAX_PATH, L"%s\\inf_%S.cat", ms->MyTempDirW, instance_name); + } + else + { + UniFormat(dest_cat, MAX_PATH, L"%s\\Neo6_%S_%S.cat", ms->MyTempDirW, (MsIsX64() ? "x64" : "x86"), instance_name); + } + } + else + { + UniStrCpy(dest_cat, MAX_PATH, L""); + } + } +} +void MsGetDriverPathA(char *instance_name, char *src_inf, char *src_sys, char *dest_inf, char *dest_sys, char *src_cat, char *dst_cat, char *neo_sys) +{ + wchar_t src_inf_w[MAX_PATH]; + wchar_t src_sys_w[MAX_PATH]; + wchar_t dest_inf_w[MAX_PATH]; + wchar_t dest_sys_w[MAX_PATH]; + wchar_t src_cat_w[MAX_PATH]; + wchar_t dst_cat_w[MAX_PATH]; + + // Validate arguments + if (instance_name == NULL) + { + return; + } + + MsGetDriverPath(instance_name, src_inf_w, src_sys_w, dest_inf_w, dest_sys_w, src_cat_w, dst_cat_w, neo_sys); + + UniToStr(src_inf, MAX_PATH, src_inf_w); + UniToStr(src_sys, MAX_PATH, src_sys_w); + UniToStr(dest_inf, MAX_PATH, dest_inf_w); + UniToStr(dest_sys, MAX_PATH, dest_sys_w); + UniToStr(src_cat, MAX_PATH, src_cat_w); + UniToStr(dst_cat, MAX_PATH, dst_cat_w); +} + +// Examine whether the virtual LAN card with the specified name has already registered +bool MsIsVLanExists(char *tag_name, char *instance_name) +{ + char *guid; + // Validate arguments + if (instance_name == NULL || tag_name == NULL) + { + return false; + } + + guid = MsGetNetworkAdapterGuid(tag_name, instance_name); + if (guid == NULL) + { + return false; + } + + Free(guid); + return true; +} + +// Delete VPN temporary directories that remain in the system but not used +void MsDeleteTempDir() +{ + HANDLE h; + wchar_t dir_mask[MAX_PATH]; + WIN32_FIND_DATAA data_a; + WIN32_FIND_DATAW data_w; + + Zero(&data_a, sizeof(data_a)); + Zero(&data_w, sizeof(data_w)); + + UniFormat(dir_mask, sizeof(dir_mask), L"%s\\*", ms->TempDirW); + + if (IsNt()) + { + h = FindFirstFileW(dir_mask, &data_w); + } + else + { + char *tmp_a = CopyUniToStr(dir_mask); + + h = FindFirstFileA(tmp_a, &data_a); + + Free(tmp_a); + } + + if (h != INVALID_HANDLE_VALUE) + { + bool b = true; + + do + { + if (IsNt() == false) + { + Zero(&data_w, sizeof(data_w)); + StrToUni(data_w.cFileName, sizeof(data_w.cFileName), data_a.cFileName); + data_w.dwFileAttributes = data_a.dwFileAttributes; + data_w.ftCreationTime = data_a.ftCreationTime; + data_w.ftLastWriteTime = data_a.ftLastWriteTime; + data_w.nFileSizeHigh = data_a.nFileSizeHigh; + data_w.nFileSizeLow = data_a.nFileSizeLow; + } + + if (UniStrCmpi(data_w.cFileName, L".") != 0 && + UniStrCmpi(data_w.cFileName, L"..") != 0) + { + if (data_w.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) + { + if (UniStartWith(data_w.cFileName, L"VPN_") && UniStrLen(data_w.cFileName) == 8) + { + wchar_t lock_file_name[MAX_PATH]; + wchar_t dir_name[MAX_PATH]; + bool delete_now = false; + IO *io; + + UniFormat(dir_name, sizeof(dir_name), L"%s\\%s", + ms->TempDirW, data_w.cFileName); + MsGenLockFile(lock_file_name, sizeof(lock_file_name), dir_name); + + io = FileOpenExW(lock_file_name, false, false); + if (io != NULL) + { + // Mark to delete if the lock file is not locked + FileClose(io); + io = FileOpenW(lock_file_name, true); + if (io != NULL) + { + delete_now = true; + FileClose(io); + } + } + else + { + DIRLIST *d; + + // Mark to delete if all files in this folder are not locked + delete_now = true; + + d = EnumDirW(dir_name); + if (d != NULL) + { + UINT i; + + for (i = 0;i < d->NumFiles;i++) + { + wchar_t full_path[MAX_PATH]; + + UniFormat(full_path, sizeof(full_path), L"%s\\%s", dir_name, d->File[i]->FileNameW); + + io = FileOpenW(full_path, true); + if (io != NULL) + { + delete_now = true; + FileClose(io); + } + } + FreeDir(d); + } + } + if (delete_now) + { + MsDeleteAllFileW(dir_name); + + Win32DeleteDirW(dir_name); + } + } + } + } + + + Zero(&data_w, sizeof(data_w)); + Zero(&data_a, sizeof(data_a)); + + if (IsNt()) + { + b = FindNextFileW(h, &data_w); + } + else + { + b = FindNextFileA(h, &data_a); + } + } + while (b); + + FindClose(h); + } +} + +// Delete all the files in the specified directory +void MsDeleteAllFile(char *dir) +{ + HANDLE h; + char file_mask[MAX_PATH]; + WIN32_FIND_DATA data; + // Validate arguments + if (dir == NULL || IsEmptyStr(dir)) + { + return; + } + + Format(file_mask, sizeof(file_mask), "%s\\*.*", dir); + + h = FindFirstFile(file_mask, &data); + if (h != INVALID_HANDLE_VALUE) + { + do + { + if (StrCmpi(data.cFileName, ".") != 0 && + StrCmpi(data.cFileName, "..") != 0) + { + char fullpath[MAX_PATH]; + Format(fullpath, sizeof(fullpath), "%s\\%s", dir, data.cFileName); + if ((data.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) == false) + { + DeleteFile(fullpath); + } + else + { + MsDeleteAllFile(fullpath); + RemoveDirectory(fullpath); + } + } + } + while (FindNextFile(h, &data)); + + FindClose(h); + } +} +void MsDeleteAllFileW(wchar_t *dir) +{ + HANDLE h; + wchar_t file_mask[MAX_PATH]; + WIN32_FIND_DATAW data; + // Validate arguments + if (dir == NULL || UniIsEmptyStr(dir)) + { + return; + } + + if (IsNt() == false) + { + char *dir_a = CopyUniToStr(dir); + + MsDeleteAllFile(dir_a); + + Free(dir_a); + + return; + } + + UniFormat(file_mask, sizeof(file_mask), L"%s\\*.*", dir); + + h = FindFirstFileW(file_mask, &data); + if (h != INVALID_HANDLE_VALUE) + { + do + { + if (UniStrCmpi(data.cFileName, L".") != 0 && + UniStrCmpi(data.cFileName, L"..") != 0) + { + wchar_t fullpath[MAX_PATH]; + + UniFormat(fullpath, sizeof(fullpath), L"%s\\%s", dir, data.cFileName); + + if ((data.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) == false) + { + DeleteFileW(fullpath); + } + else + { + MsDeleteAllFileW(fullpath); + RemoveDirectoryW(fullpath); + } + } + } + while (FindNextFileW(h, &data)); + + FindClose(h); + } +} + +// Initialize the temporary directory +void MsInitTempDir() +{ + wchar_t tmp[MAX_PATH]; + wchar_t tmp2[16]; + UCHAR random[2]; + wchar_t lockfilename[MAX_PATH]; + UINT num = 0; + + // Delete the unused temporary directory + MsDeleteTempDir(); + + // Determine the name of the temporary directory + while (true) + { + random[0] = rand() % 256; + random[1] = rand() % 256; + BinToStrW(tmp2, sizeof(tmp2), random, sizeof(random)); + + UniFormat(tmp, sizeof(tmp), L"%s\\VPN_%s", ms->TempDirW, tmp2); + + // Create Directory + if (MakeDirW(tmp)) + { + break; + } + + if ((num++) >= 100) + { + // Failed many times + char msg[MAX_SIZE]; + Format(msg, sizeof(msg), + "Couldn't create Temporary Directory: %s\r\n\r\n" + "Please contact your system administrator.", + tmp); + exit(0); + } + } + + ms->MyTempDirW = CopyUniStr(tmp); + ms->MyTempDir = CopyUniToStr(tmp); + + // Create a lock file + MsGenLockFile(lockfilename, sizeof(lockfilename), ms->MyTempDirW); + ms->LockFile = FileCreateW(lockfilename); +} + +// Release the temporary directory +void MsFreeTempDir() +{ + wchar_t lock_file_name[MAX_SIZE]; + + // Delete the lock file + MsGenLockFile(lock_file_name, sizeof(lock_file_name), ms->MyTempDirW); + FileClose(ms->LockFile); + + // Memory release + Free(ms->MyTempDir); + Free(ms->MyTempDirW); + ms->MyTempDir = NULL; + ms->MyTempDirW = NULL; + + // Delete directory + MsDeleteTempDir(); +} + +// Generation of the name of the lock file +void MsGenLockFile(wchar_t *name, UINT size, wchar_t *temp_dir) +{ + // Validate arguments + if (name == NULL || temp_dir == NULL) + { + return; + } + + UniFormat(name, size, L"%s\\VPN_Lock.dat", temp_dir); +} + +// Normalization of the configuration of the interface metric of the default gateway in the network configuration +void MsNormalizeInterfaceDefaultGatewaySettings(char *tag_name, char *instance_name) +{ + char tmp[MAX_SIZE]; + char netsh[MAX_PATH]; + char *config_str; + char tmp2[MAX_SIZE]; + UINT if_index; + UINT if_metric; + // Validate arguments + if (tag_name == NULL || instance_name == NULL) + { + return; + } + + Debug("MsNormalizeInterfaceDefaultGatewaySettings()\n"); + + if (MsIsVista() == false) + { + Debug("MsIsVista() == false\n"); + return; + } + + Format(tmp2, sizeof(tmp2), tag_name, instance_name); + if_index = Win32GetVLanInterfaceID(tmp2); + Debug("if_index=%u\n", if_index); + + if (if_index == 0) + { + return; + } + + CombinePath(netsh, sizeof(netsh), MsGetSystem32Dir(), "netsh.exe"); + + // Set the interface metric value + config_str = MsGetNetworkAdapterGuid(tag_name, instance_name); + if (config_str != NULL) + { + LIST *o; + LIST *o2; + + Debug("MsNormalizeInterfaceDefaultGatewaySettings()\n"); + Debug("if_index(%s) = %u\n", instance_name, if_index); + + Format(tmp, sizeof(tmp), "SYSTEM\\CurrentControlSet\\Services\\Tcpip\\Parameters\\Interfaces\\%s", + config_str); + + o = MsRegReadStrList(REG_LOCAL_MACHINE, tmp, "DefaultGateway"); + o2 = MsRegReadStrList(REG_LOCAL_MACHINE, tmp, "DefaultGatewayMetric"); + + if_metric = MsRegReadInt(REG_LOCAL_MACHINE, tmp, "InterfaceMetric"); + Debug("if_metric = %u\n", if_metric); + + if (if_metric != 0) + { + if (o != NULL) + { + UINT i; + + for (i = 0;i < LIST_NUM(o);i++) + { + char *s = LIST_DATA(o, i); + char tmp[MAX_SIZE]; + + char *cm = NULL; + UINT current_metric; + + if (o2 != NULL) + { + if (LIST_NUM(o2) > i) + { + current_metric = ToInt(LIST_DATA(o2, i)); + } + } + + Debug("gateway[%u] = %s\n", i, s); + Debug("current_metric[%u] = %u\n", i, current_metric); + + if (current_metric == 0) + { + if (IsEmptyStr(s) == false) + { + Format(tmp, sizeof(tmp), "int ipv4 delete route prefix=0.0.0.0/0 interface=%u nexthop=%s", + if_index, s); + Debug("netsh %s\n", tmp); + Run(netsh, tmp, true, true); + + Format(tmp, sizeof(tmp), "int ipv4 add route prefix=0.0.0.0/0 interface=%u nexthop=%s metric=%u", + if_index, s, if_metric); + Debug("netsh %s\n", tmp); + Run(netsh, tmp, true, true); + } + } + } + } + } + + FreeStrList(o); + FreeStrList(o2); + + Free(config_str); + } +} + +// Initialization of the network configuration +void MsInitNetworkConfig(char *tag_name, char *instance_name, char *connection_tag_name) +{ + char tmp[MAX_SIZE]; + char *config_str; + // Validate arguments + if (tag_name == NULL || instance_name == NULL || connection_tag_name == NULL) + { + return; + } + + if (MsIsNt() == false) + { + return; + } + + // Settings such as string + Format(tmp, sizeof(tmp), connection_tag_name, instance_name); + MsSetNetworkConfig(tag_name, instance_name, tmp, true); + + // Set the interface metric value + config_str = MsGetNetworkAdapterGuid(tag_name, instance_name); + if (config_str != NULL) + { + Format(tmp, sizeof(tmp), "SYSTEM\\CurrentControlSet\\Services\\Tcpip\\Parameters\\Interfaces\\%s", + config_str); + + MsRegWriteInt(REG_LOCAL_MACHINE, tmp, "InterfaceMetric", 1); + MsRegWriteInt(REG_LOCAL_MACHINE, tmp, "EnableDeadGWDetect", 0); + + if (MsRegReadInt(REG_LOCAL_MACHINE, + "SYSTEM\\CurrentControlSet\\Services\\Tcpip\\Parameters", + "packetix_no_optimize") == 0) + { + MsRegWriteInt(REG_LOCAL_MACHINE, + "SYSTEM\\CurrentControlSet\\Services\\Tcpip\\Parameters", + "EnableDeadGWDetect", + 0); + } + + Free(config_str); + } +} + +// Configure the network settings +void MsSetNetworkConfig(char *tag_name, char *instance_name, char *friendly_name, bool show_icon) +{ + char *key; + char *old_name; + // Validate arguments + if (tag_name == NULL || instance_name == NULL || friendly_name == NULL) + { + return; + } + + key = MsGetNetworkConfigRegKeyNameFromInstanceName(tag_name, instance_name); + if (key == NULL) + { + return; + } + + old_name = MsRegReadStr(REG_LOCAL_MACHINE, key, "Name"); + if (old_name != NULL) + { + if (MsIsVista()) + { + char arg[MAX_PATH]; + char netsh[MAX_PATH]; + + Format(netsh, sizeof(netsh), "%s\\netsh.exe", MsGetSystem32Dir()); + + if (StrCmp(old_name, friendly_name) != 0) + { + Format(arg, sizeof(arg), "interface set interface name=\"%s\" newname=\"%s\"", + old_name, friendly_name); + + Run(netsh, arg, true, true); + } + + Format(arg, sizeof(arg), "netsh interface ipv4 set interface interface=\"%s\" metric=1", + friendly_name); + + Run(netsh, arg, true, true); + } + } + + if (StrCmp(old_name, friendly_name) != 0) + { + MsRegWriteStr(REG_LOCAL_MACHINE, key, "Name", friendly_name); + } + + MsRegWriteInt(REG_LOCAL_MACHINE, key, "ShowIcon", show_icon ? 1 : 0); + + Free(key); + + Free(old_name); +} + +// Get the network configuration key name by the instance name +char *MsGetNetworkConfigRegKeyNameFromInstanceName(char *tag_name, char *instance_name) +{ + char *guid, *ret; + // Validate arguments + if (tag_name == NULL || instance_name == NULL) + { + return NULL; + } + + guid = MsGetNetworkAdapterGuid(tag_name, instance_name); + if (guid == NULL) + { + return NULL; + } + + ret = MsGetNetworkConfigRegKeyNameFromGuid(guid); + + Free(guid); + + return ret; +} + +// Get the network configuration key name by the GUID +char *MsGetNetworkConfigRegKeyNameFromGuid(char *guid) +{ + char tmp[MAX_SIZE]; + // Validate arguments + if (guid == NULL) + { + return NULL; + } + + Format(tmp, sizeof(tmp), + "SYSTEM\\CurrentControlSet\\Control\\Network\\{4D36E972-E325-11CE-BFC1-08002BE10318}\\%s\\Connection", + guid); + + return CopyStr(tmp); +} + +// Configuring the MAC address +void MsSetMacAddress(char *tag_name, char *instance_name, char *mac_address) +{ + TOKEN_LIST *key_list; + UINT i; + char dest_name[MAX_SIZE]; + char mac_str[MAX_SIZE]; + // Validate arguments + if (tag_name == NULL || instance_name == NULL) + { + return; + } + + // Normalization of the MAC address + if (NormalizeMacAddress(mac_str, sizeof(mac_str), mac_address) == false) + { + return; + } + + // Generate the desired name + Format(dest_name, sizeof(dest_name), tag_name, instance_name); + + // Enumerate the key + if (MsIsNt()) + { + key_list = MsRegEnumKey(REG_LOCAL_MACHINE, + "SYSTEM\\CurrentControlSet\\Control\\Class\\{4D36E972-E325-11CE-BFC1-08002bE10318}"); + } + else + { + key_list = MsRegEnumKey(REG_LOCAL_MACHINE, + "System\\CurrentControlSet\\Services\\Class\\Net"); + } + if (key_list == NULL) + { + return; + } + + for (i = 0;i < key_list->NumTokens;i++) + { + char *key_name = key_list->Token[i]; + char full_key_name[MAX_SIZE]; + char *driver_desc; + + if (MsIsNt()) + { + Format(full_key_name, sizeof(full_key_name), + "SYSTEM\\CurrentControlSet\\Control\\Class\\{4D36E972-E325-11CE-BFC1-08002bE10318}\\%s", + key_name); + } + else + { + Format(full_key_name, sizeof(full_key_name), + "System\\CurrentControlSet\\Services\\Class\\Net\\%s", + key_name); + } + + // Read the DriverDesc + driver_desc = MsRegReadStr(REG_LOCAL_MACHINE, full_key_name, "DriverDesc"); + if (driver_desc != NULL) + { + if (StrCmpi(dest_name, driver_desc) == 0) + { + // Writing of the MAC address + MsRegWriteStr(REG_LOCAL_MACHINE, full_key_name, "NetworkAddress", mac_str); + Free(driver_desc); + + // Restarting the driver + MsRestartVLan(instance_name); + break; + } + Free(driver_desc); + } + } + + FreeToken(key_list); + + return; +} + +// Get the file name of the device driver +char *MsGetDriverFileName(char *tag_name, char *instance_name) +{ + TOKEN_LIST *key_list; + UINT i; + char *ret = NULL; + char dest_name[MAX_SIZE]; + // Validate arguments + if (tag_name == NULL || instance_name == NULL) + { + return NULL; + } + + // Generate the desired name + Format(dest_name, sizeof(dest_name), tag_name, instance_name); + + // Enumerate the key + if (MsIsNt()) + { + key_list = MsRegEnumKey(REG_LOCAL_MACHINE, + "SYSTEM\\CurrentControlSet\\Control\\Class\\{4D36E972-E325-11CE-BFC1-08002bE10318}"); + } + else + { + key_list = MsRegEnumKey(REG_LOCAL_MACHINE, + "System\\CurrentControlSet\\Services\\Class\\Net"); + } + if (key_list == NULL) + { + return NULL; + } + + for (i = 0;i < key_list->NumTokens;i++) + { + char *key_name = key_list->Token[i]; + char full_key_name[MAX_SIZE]; + char *driver_desc; + + if (MsIsNt()) + { + Format(full_key_name, sizeof(full_key_name), + "SYSTEM\\CurrentControlSet\\Control\\Class\\{4D36E972-E325-11CE-BFC1-08002bE10318}\\%s", + key_name); + } + else + { + Format(full_key_name, sizeof(full_key_name), + "System\\CurrentControlSet\\Services\\Class\\Net\\%s", + key_name); + } + + // Read the DriverDesc + driver_desc = MsRegReadStr(REG_LOCAL_MACHINE, full_key_name, "DriverDesc"); + if (driver_desc != NULL) + { + if (StrCmpi(dest_name, driver_desc) == 0) + { + // Read the file name + ret = MsRegReadStr(REG_LOCAL_MACHINE, full_key_name, "DeviceVxDs"); + Free(driver_desc); + break; + } + Free(driver_desc); + } + } + + FreeToken(key_list); + + return ret; +} + +// Get the version of the device driver +char *MsGetDriverVersion(char *tag_name, char *instance_name) +{ + TOKEN_LIST *key_list; + TOKEN_LIST *t; + UINT i; + char *ret = NULL; + char dest_name[MAX_SIZE]; + // Validate arguments + if (tag_name == NULL || instance_name == NULL) + { + return NULL; + } + + // Generate the desired name + Format(dest_name, sizeof(dest_name), tag_name, instance_name); + + // Enumerate the key + if (MsIsNt()) + { + key_list = MsRegEnumKey(REG_LOCAL_MACHINE, + "SYSTEM\\CurrentControlSet\\Control\\Class\\{4D36E972-E325-11CE-BFC1-08002bE10318}"); + } + else + { + key_list = MsRegEnumKey(REG_LOCAL_MACHINE, + "System\\CurrentControlSet\\Services\\Class\\Net"); + } + if (key_list == NULL) + { + return NULL; + } + + for (i = 0;i < key_list->NumTokens;i++) + { + char *key_name = key_list->Token[i]; + char full_key_name[MAX_SIZE]; + char *driver_desc; + + if (MsIsNt()) + { + Format(full_key_name, sizeof(full_key_name), + "SYSTEM\\CurrentControlSet\\Control\\Class\\{4D36E972-E325-11CE-BFC1-08002bE10318}\\%s", + key_name); + } + else + { + Format(full_key_name, sizeof(full_key_name), + "System\\CurrentControlSet\\Services\\Class\\Net\\%s", + key_name); + } + + // Read the DriverDesc + driver_desc = MsRegReadStr(REG_LOCAL_MACHINE, full_key_name, "DriverDesc"); + if (driver_desc != NULL) + { + if (StrCmpi(dest_name, driver_desc) == 0) + { + // Read the version information + ret = MsRegReadStr(REG_LOCAL_MACHINE, full_key_name, "DriverVersion"); + if (ret == NULL) + { + ret = MsRegReadStr(REG_LOCAL_MACHINE, full_key_name, "NeoVersion"); + } + Free(driver_desc); + break; + } + Free(driver_desc); + } + } + + FreeToken(key_list); + + if (ret == NULL) + { + return NULL; + } + + t = ParseToken(ret, ", "); + if (t->NumTokens == 2) + { + Free(ret); + ret = CopyStr(t->Token[1]); + } + FreeToken(t); + + return ret; +} + +// Get the MAC address +char *MsGetMacAddress(char *tag_name, char *instance_name) +{ + TOKEN_LIST *key_list; + UINT i; + char *ret = NULL; + char dest_name[MAX_SIZE]; + // Validate arguments + if (tag_name == NULL || instance_name == NULL) + { + return NULL; + } + + // Generate the desired name + Format(dest_name, sizeof(dest_name), tag_name, instance_name); + + // Enumerate the key + if (MsIsNt()) + { + key_list = MsRegEnumKey(REG_LOCAL_MACHINE, + "SYSTEM\\CurrentControlSet\\Control\\Class\\{4D36E972-E325-11CE-BFC1-08002bE10318}"); + } + else + { + key_list = MsRegEnumKey(REG_LOCAL_MACHINE, + "System\\CurrentControlSet\\Services\\Class\\Net"); + } + + if (key_list == NULL) + { + return NULL; + } + + for (i = 0;i < key_list->NumTokens;i++) + { + char *key_name = key_list->Token[i]; + char full_key_name[MAX_SIZE]; + char *driver_desc; + + if (MsIsNt()) + { + Format(full_key_name, sizeof(full_key_name), + "SYSTEM\\CurrentControlSet\\Control\\Class\\{4D36E972-E325-11CE-BFC1-08002bE10318}\\%s", + key_name); + } + else + { + Format(full_key_name, sizeof(full_key_name), + "System\\CurrentControlSet\\Services\\Class\\Net\\%s", + key_name); + } + + // Read the DriverDesc + driver_desc = MsRegReadStr(REG_LOCAL_MACHINE, full_key_name, "DriverDesc"); + if (driver_desc != NULL) + { + if (StrCmpi(dest_name, driver_desc) == 0) + { + // Read the MAC address + ret = MsRegReadStr(REG_LOCAL_MACHINE, full_key_name, "NetworkAddress"); + + if (IsEmptyStr(ret) == false) + { + // Insert hyphens between the MAC address elements + BUF *b = StrToBin(ret); + if (b != NULL && b->Size == 6) + { + char tmp[MAX_SIZE]; + MacToStr(tmp, sizeof(tmp), b->Buf); + + Free(ret); + ret = CopyStr(tmp); + } + FreeBuf(b); + } + + Free(driver_desc); + break; + } + Free(driver_desc); + } + } + + FreeToken(key_list); + + return ret; +} + +// Check whether the device name of the virtual LAN card exists really +bool MsCheckVLanDeviceIdFromRootEnum(char *name) +{ + TOKEN_LIST *t; + char *root; + char *keyname; + UINT i; + bool ret; + // Validate arguments + if (name == NULL) + { + return false; + } + + if (MsIsNt()) + { + root = "SYSTEM\\CurrentControlSet\\Enum\\Root\\NET"; + keyname = "HardwareID"; + } + else + { + root = "Enum\\Root\\Net"; + keyname = "CompatibleIDs"; + } + + t = MsRegEnumKey(REG_LOCAL_MACHINE, root); + if (t == NULL) + { + return false; + } + + ret = false; + + for (i = 0;i < t->NumTokens;i++) + { + char *subname = t->Token[i]; + char fullname[MAX_SIZE]; + char *value; + + Format(fullname, sizeof(fullname), "%s\\%s", root, subname); + + value = MsRegReadStr(REG_LOCAL_MACHINE, fullname, keyname); + if (value != NULL) + { + if (StrCmpi(value, name) == 0) + { + ret = true; + } + Free(value); + } + + if (ret) + { + break; + } + } + + FreeToken(t); + + return ret; +} + +// Get the GUID of the network adapter +char *MsGetNetworkAdapterGuid(char *tag_name, char *instance_name) +{ + TOKEN_LIST *key_list; + UINT i; + char *ret = NULL; + char dest_name[MAX_SIZE]; + // Validate arguments + if (tag_name == NULL || instance_name == NULL) + { + return NULL; + } + + // Generate the desired name + Format(dest_name, sizeof(dest_name), tag_name, instance_name); + + // Enumerate the key + if (MsIsNt()) + { + key_list = MsRegEnumKey(REG_LOCAL_MACHINE, + "SYSTEM\\CurrentControlSet\\Control\\Class\\{4D36E972-E325-11CE-BFC1-08002bE10318}"); + } + else + { + key_list = MsRegEnumKey(REG_LOCAL_MACHINE, + "System\\CurrentControlSet\\Services\\Class\\Net"); + } + if (key_list == NULL) + { + return NULL; + } + + for (i = 0;i < key_list->NumTokens;i++) + { + char *key_name = key_list->Token[i]; + char full_key_name[MAX_SIZE]; + char *driver_desc; + char *device_id; + + if (MsIsNt()) + { + Format(full_key_name, sizeof(full_key_name), + "SYSTEM\\CurrentControlSet\\Control\\Class\\{4D36E972-E325-11CE-BFC1-08002bE10318}\\%s", + key_name); + } + else + { + Format(full_key_name, sizeof(full_key_name), + "System\\CurrentControlSet\\Services\\Class\\Net\\%s", + key_name); + } + + device_id = MsRegReadStr(REG_LOCAL_MACHINE, full_key_name, "MatchingDeviceId"); + + if (device_id != NULL) + { + if (MsCheckVLanDeviceIdFromRootEnum(device_id)) + { + // Read the DriverDesc + driver_desc = MsRegReadStr(REG_LOCAL_MACHINE, full_key_name, "DriverDesc"); + if (driver_desc != NULL) + { + if (StrCmpi(dest_name, driver_desc) == 0) + { + // Read the NetCfgInstanceId + if (MsIsNt()) + { + ret = MsRegReadStr(REG_LOCAL_MACHINE, full_key_name, "NetCfgInstanceId"); + } + else + { + ret = CopyStr(""); + } + Free(driver_desc); + Free(device_id); + break; + } + Free(driver_desc); + } + } + Free(device_id); + } + } + + FreeToken(key_list); + + return ret; +} +// Get the network connection name +wchar_t *MsGetNetworkConnectionName(char *guid) +{ + wchar_t *ncname = NULL; + // Validate arguments + if (guid == NULL) + { + return NULL; + } + + // Get the network connection name + if (IsNt() != false && GetOsInfo()->OsType >= OSTYPE_WINDOWS_2000_PROFESSIONAL) + { + char tmp[MAX_SIZE]; + Format(tmp, sizeof(tmp), "SYSTEM\\CurrentControlSet\\Control\\Network\\{4D36E972-E325-11CE-BFC1-08002BE10318}\\%s\\Connection", guid); + ncname = MsRegReadStrW(REG_LOCAL_MACHINE, tmp, "Name"); + } + + return ncname; +} + +// Generate driver file name for the new Neo +bool MsMakeNewNeoDriverFilename(char *name, UINT size) +{ + TOKEN_LIST *t = MsEnumNeoDriverFilenames(); + UINT i; + bool ret = false; + + i = 0; + while (true) + { + char tmp[MAX_PATH]; + UINT n; + + i++; + if (i >= 10000) + { + break; + } + + n = Rand32() % DRIVER_INSTALL_SYS_NAME_TAG_MAXID; + + MsGenerateNeoDriverFilenameFromInt(tmp, sizeof(tmp), n); + + if (IsInToken(t, tmp) == false) + { + StrCpy(name, size, tmp); + ret = true; + break; + } + } + + FreeToken(t); + + return ret; +} + +// Generate the driver file name of Neo from a integer +void MsGenerateNeoDriverFilenameFromInt(char *name, UINT size, UINT n) +{ + Format(name, size, DRIVER_INSTALL_SYS_NAME_TAG_NEW, n); +} + +// Enumeration of the driver file names of installed Neo +TOKEN_LIST *MsEnumNeoDriverFilenames() +{ + TOKEN_LIST *neos = MsEnumNetworkAdaptersNeo(); + LIST *o = NewListFast(NULL); + TOKEN_LIST *ret; + UINT i; + + for (i = 0;i < neos->NumTokens;i++) + { + char filename[MAX_PATH]; + if (MsGetNeoDriverFilename(filename, sizeof(filename), neos->Token[i])) + { + Add(o, CopyStr(filename)); + } + } + + FreeToken(neos); + + ret = ListToTokenList(o); + FreeStrList(o); + + return ret; +} + +// Get the driver file name of Neo +bool MsGetNeoDriverFilename(char *name, UINT size, char *instance_name) +{ + char tmp[MAX_SIZE]; + char *ret; + // Validate arguments + if (name == NULL || instance_name == NULL) + { + return false; + } + + Format(tmp, sizeof(tmp), "SYSTEM\\CurrentControlSet\\Services\\Neo_%s", instance_name); + + ret = MsRegReadStr(REG_LOCAL_MACHINE, tmp, "ImagePath"); + if (ret == NULL) + { + return false; + } + + GetFileNameFromFilePath(name, size, ret); + Free(ret); + + return true; +} + +// Enumeration of the network adapter (only Neo) +TOKEN_LIST *MsEnumNetworkAdaptersNeo() +{ + TOKEN_LIST *key_list; + TOKEN_LIST *ret; + LIST *o; + UINT i; + + // Enumerate the key + if (MsIsNt()) + { + key_list = MsRegEnumKey(REG_LOCAL_MACHINE, + "SYSTEM\\CurrentControlSet\\Control\\Class\\{4D36E972-E325-11CE-BFC1-08002bE10318}"); + } + else + { + key_list = MsRegEnumKey(REG_LOCAL_MACHINE, + "System\\CurrentControlSet\\Services\\Class\\Net"); + } + if (key_list == NULL) + { + return NULL; + } + + o = NewListFast(CompareStr); + + for (i = 0;i < key_list->NumTokens;i++) + { + char *key_name = key_list->Token[i]; + char full_key_name[MAX_SIZE]; + char *driver_desc; + char *device_id; + + if (MsIsNt()) + { + Format(full_key_name, sizeof(full_key_name), + "SYSTEM\\CurrentControlSet\\Control\\Class\\{4D36E972-E325-11CE-BFC1-08002bE10318}\\%s", + key_name); + } + else + { + Format(full_key_name, sizeof(full_key_name), + "System\\CurrentControlSet\\Services\\Class\\Net\\%s", + key_name); + } + + // Read the DriverDesc + driver_desc = MsRegReadStr(REG_LOCAL_MACHINE, full_key_name, "DriverDesc"); + if (driver_desc != NULL) + { + // Check whether it starts with the specific name + device_id = MsRegReadStr(REG_LOCAL_MACHINE, full_key_name, "MatchingDeviceId"); + + if (device_id != NULL) + { + if (MsCheckVLanDeviceIdFromRootEnum(device_id)) + { + char *tag = "neoadapter_"; + if (StartWith(device_id, tag)) + { + char tmp[MAX_SIZE]; + StrCpy(tmp, sizeof(tmp), &device_id[StrLen(tag)]); + + Add(o, CopyStr(tmp)); + } + } + Free(device_id); + } + + Free(driver_desc); + } + } + + FreeToken(key_list); + + ret = ZeroMalloc(sizeof(TOKEN_LIST)); + ret->NumTokens = LIST_NUM(o); + ret->Token = ZeroMalloc(sizeof(char *) * ret->NumTokens); + for (i = 0;i < ret->NumTokens;i++) + { + ret->Token[i] = LIST_DATA(o, i); + } + + ReleaseList(o); + + return ret; +} + +// Enumeration of the network adapter +TOKEN_LIST *MsEnumNetworkAdapters(char *start_with_name, char *start_with_name_2) +{ + TOKEN_LIST *key_list; + TOKEN_LIST *ret; + LIST *o; + UINT i; + + // Enumerate the key + if (MsIsNt()) + { + key_list = MsRegEnumKey(REG_LOCAL_MACHINE, + "SYSTEM\\CurrentControlSet\\Control\\Class\\{4D36E972-E325-11CE-BFC1-08002bE10318}"); + } + else + { + key_list = MsRegEnumKey(REG_LOCAL_MACHINE, + "System\\CurrentControlSet\\Services\\Class\\Net"); + } + if (key_list == NULL) + { + return NULL; + } + + o = NewListFast(CompareStr); + + for (i = 0;i < key_list->NumTokens;i++) + { + char *key_name = key_list->Token[i]; + char full_key_name[MAX_SIZE]; + char *driver_desc; + char *device_id; + + if (MsIsNt()) + { + Format(full_key_name, sizeof(full_key_name), + "SYSTEM\\CurrentControlSet\\Control\\Class\\{4D36E972-E325-11CE-BFC1-08002bE10318}\\%s", + key_name); + } + else + { + Format(full_key_name, sizeof(full_key_name), + "System\\CurrentControlSet\\Services\\Class\\Net\\%s", + key_name); + } + + // Read the DriverDesc + driver_desc = MsRegReadStr(REG_LOCAL_MACHINE, full_key_name, "DriverDesc"); + if (driver_desc != NULL) + { + // Check whether it starts with the specific name + if ((IsEmptyStr(start_with_name) && IsEmptyStr(start_with_name_2)) || + (StartWith(driver_desc, start_with_name) || StartWith(driver_desc, start_with_name_2))) + { + device_id = MsRegReadStr(REG_LOCAL_MACHINE, full_key_name, "MatchingDeviceId"); + + if (device_id != NULL) + { + if (MsCheckVLanDeviceIdFromRootEnum(device_id)) + { + char instance_name[MAX_SIZE]; + // Extract only the instance name from the name + if (StartWith(driver_desc, start_with_name)) + { + if (StrLen(driver_desc) > (StrLen(start_with_name) + 3)) + { + StrCpy(instance_name, sizeof(instance_name), + driver_desc + StrLen(start_with_name) + 3); + Add(o, CopyStr(instance_name)); + } + } + else + { + if (StrLen(driver_desc) > (StrLen(start_with_name_2) + 3)) + { + StrCpy(instance_name, sizeof(instance_name), + driver_desc + StrLen(start_with_name_2) + 3); + Add(o, CopyStr(instance_name)); + } + } + } + Free(device_id); + } + } + + Free(driver_desc); + } + } + + FreeToken(key_list); + + ret = ZeroMalloc(sizeof(TOKEN_LIST)); + ret->NumTokens = LIST_NUM(o); + ret->Token = ZeroMalloc(sizeof(char *) * ret->NumTokens); + for (i = 0;i < ret->NumTokens;i++) + { + ret->Token[i] = LIST_DATA(o, i); + } + + ReleaseList(o); + + return ret; +} + +// Attempt to logon to the domain +bool MsCheckLogon(wchar_t *username, char *password) +{ + wchar_t password_unicode[MAX_SIZE]; + HANDLE h; + // Validate arguments + if (username == NULL || password == NULL) + { + return false; + } + + if (MsIsNt() == false) + { + return false; + } + + StrToUni(password_unicode, sizeof(password_unicode), password); + + if (GET_KETA(GetOsInfo()->OsType, 100) >= 2) + { + if (ms->nt->LogonUserW(username, NULL, password_unicode, LOGON32_LOGON_NETWORK, LOGON32_PROVIDER_DEFAULT, &h) == false) + { + // Logon failure + return false; + } + } + else + { + char username_ansi[MAX_SIZE]; + UniToStr(username_ansi, sizeof(username_ansi), username); + + if (ms->nt->LogonUserA(username_ansi, NULL, password, LOGON32_LOGON_NETWORK, LOGON32_PROVIDER_DEFAULT, &h) == false) + { + // Logon failure + return false; + } + } + + CloseHandle(h); + + return true; +} + +// Execute the shutdown +bool MsShutdown(bool reboot, bool force) +{ + UINT flag = 0; + // Get the privilege + if (MsEnablePrivilege(SE_SHUTDOWN_NAME, true) == false) + { + return false; + } + + flag |= (reboot ? EWX_REBOOT : EWX_SHUTDOWN); + flag |= (force ? EWX_FORCE : 0); + + // Execute the shutdown + if (ExitWindowsEx(flag, 0) == false) + { + MsEnablePrivilege(SE_SHUTDOWN_NAME, false); + return false; + } + + // Release of privilege + MsEnablePrivilege(SE_SHUTDOWN_NAME, false); + + return true; +} + +// Enable or disable the privilege +bool MsEnablePrivilege(char *name, bool enable) +{ + HANDLE hToken; + NT_API *nt = ms->nt; + LUID luid; + TOKEN_PRIVILEGES *tp; + bool ret; + // Validate arguments + if (name == NULL) + { + return false; + } + if (MsIsNt() == false) + { + return true; + } + + // Open the process token + if (nt->OpenProcessToken(ms->hCurrentProcess, TOKEN_ADJUST_PRIVILEGES, &hToken) == false) + { + return false; + } + + // Get a local unique identifier + if (nt->LookupPrivilegeValue(NULL, name, &luid) == FALSE) + { + CloseHandle(hToken); + return false; + } + + // Create a structure to enable / disable the privilege + tp = ZeroMalloc(sizeof(TOKEN_PRIVILEGES)); + tp->PrivilegeCount = 1; + tp->Privileges[0].Attributes = enable ? SE_PRIVILEGE_ENABLED : 0; + Copy(&tp->Privileges[0].Luid, &luid, sizeof(LUID)); + + // Manipulate the privilege + ret = nt->AdjustTokenPrivileges(hToken, false, tp, sizeof(TOKEN_PRIVILEGES), 0, 0); + + Free(tp); + CloseHandle(hToken); + + return ret; +} + +// Get whether the current OS is a NT system +bool MsIsNt() +{ + if (ms == NULL) + { + OSVERSIONINFO os; + Zero(&os, sizeof(os)); + os.dwOSVersionInfoSize = sizeof(os); + GetVersionEx(&os); + if (os.dwPlatformId == VER_PLATFORM_WIN32_NT) + { + return true; + } + else + { + return false; + } + } + + return ms->IsNt; +} + +// Get whether the current system is WINE +bool MsIsWine() +{ + bool ret = false; + + if (ms == NULL) + { + HINSTANCE h = LoadLibrary("kernel32.dll"); + + if (h != NULL) + { + if (GetProcAddress(h, "wine_get_unix_file_name") != NULL) + { + ret = true; + } + + FreeLibrary(h); + } + } + else + { + ret = ms->IsWine; + } + + return ret; +} + +// Get whether the current user is an Admin +bool MsIsAdmin() +{ + return ms->IsAdmin; +} + +// Load the NT system function +NT_API *MsLoadNtApiFunctions() +{ + NT_API *nt = ZeroMalloc(sizeof(NT_API)); + OSVERSIONINFO info; + + Zero(&info, sizeof(info)); + info.dwOSVersionInfoSize = sizeof(info); + GetVersionEx(&info); + + nt->hKernel32 = LoadLibrary("kernel32.dll"); + if (nt->hKernel32 == NULL) + { + Free(nt); + return NULL; + } + + nt->hAdvapi32 = LoadLibrary("advapi32.dll"); + if (nt->hAdvapi32 == NULL) + { + Free(nt); + return NULL; + } + + nt->hShell32 = LoadLibrary("shell32.dll"); + if (nt->hShell32 == NULL) + { + FreeLibrary(nt->hAdvapi32); + Free(nt); + return NULL; + } + + nt->hPsApi = LoadLibrary("psapi.dll"); + + if (info.dwMajorVersion >= 5) + { + nt->hNewDev = LoadLibrary("newdev.dll"); + if (nt->hNewDev == NULL) + { + FreeLibrary(nt->hShell32); + FreeLibrary(nt->hAdvapi32); + Free(nt); + return NULL; + } + + nt->hSetupApi = LoadLibrary("setupapi.dll"); + } + + nt->hSecur32 = LoadLibrary("secur32.dll"); + + nt->hUser32 = LoadLibrary("user32.dll"); + + nt->hDbgHelp = LoadLibrary("dbghelp.dll"); + + nt->hWcmapi = LoadLibrary("wcmapi.dll"); + + nt->hDwmapi = LoadLibrary("dwmapi.dll"); + + // Read the function + nt->GetComputerNameExW = + (BOOL (__stdcall *)(COMPUTER_NAME_FORMAT,LPWSTR,LPDWORD)) + GetProcAddress(nt->hKernel32, "GetComputerNameExW"); + + nt->IsWow64Process = + (BOOL (__stdcall *)(HANDLE,BOOL *)) + GetProcAddress(nt->hKernel32, "IsWow64Process"); + + nt->GetFileInformationByHandle = + (BOOL (__stdcall *)(HANDLE,LPBY_HANDLE_FILE_INFORMATION)) + GetProcAddress(nt->hKernel32, "GetFileInformationByHandle"); + + nt->GetProcessHeap = + (HANDLE (__stdcall *)()) + GetProcAddress(nt->hKernel32, "GetProcessHeap"); + + nt->SetProcessShutdownParameters = + (BOOL (__stdcall *)(DWORD,DWORD)) + GetProcAddress(nt->hKernel32, "SetProcessShutdownParameters"); + + nt->GetNativeSystemInfo = + (void (__stdcall *)(SYSTEM_INFO *)) + GetProcAddress(nt->hKernel32, "GetNativeSystemInfo"); + + nt->AdjustTokenPrivileges = + (BOOL (__stdcall *)(HANDLE,BOOL,PTOKEN_PRIVILEGES,DWORD,PTOKEN_PRIVILEGES,PDWORD)) + GetProcAddress(nt->hAdvapi32, "AdjustTokenPrivileges"); + + nt->LookupPrivilegeValue = + (BOOL (__stdcall *)(char *,char *,PLUID)) + GetProcAddress(nt->hAdvapi32, "LookupPrivilegeValueA"); + + nt->OpenProcessToken = + (BOOL (__stdcall *)(HANDLE,DWORD,PHANDLE)) + GetProcAddress(nt->hAdvapi32, "OpenProcessToken"); + + nt->InitiateSystemShutdown = + (BOOL (__stdcall *)(LPTSTR,LPTSTR,DWORD,BOOL,BOOL)) + GetProcAddress(nt->hAdvapi32, "InitiateSystemShutdownA"); + + nt->LogonUserW = + (BOOL (__stdcall *)(wchar_t *,wchar_t *,wchar_t *,DWORD,DWORD,HANDLE *)) + GetProcAddress(nt->hAdvapi32, "LogonUserW"); + + nt->LogonUserA = + (BOOL (__stdcall *)(char *,char *,char *,DWORD,DWORD,HANDLE * )) + GetProcAddress(nt->hAdvapi32, "LogonUserA"); + + nt->DuplicateTokenEx = + (BOOL (__stdcall *)(HANDLE,DWORD,SECURITY_ATTRIBUTES *,SECURITY_IMPERSONATION_LEVEL,TOKEN_TYPE,HANDLE *)) + GetProcAddress(nt->hAdvapi32, "DuplicateTokenEx"); + + nt->ConvertStringSidToSidA = + (BOOL (__stdcall *)(LPCSTR,PSID *)) + GetProcAddress(nt->hAdvapi32, "ConvertStringSidToSidA"); + + nt->GetTokenInformation = + (BOOL (__stdcall *)(HANDLE,TOKEN_INFORMATION_CLASS,void *,DWORD,PDWORD)) + GetProcAddress(nt->hAdvapi32, "GetTokenInformation"); + + nt->SetTokenInformation = + (BOOL (__stdcall *)(HANDLE,TOKEN_INFORMATION_CLASS,void *,DWORD)) + GetProcAddress(nt->hAdvapi32, "SetTokenInformation"); + + nt->CreateProcessAsUserA = + (BOOL (__stdcall *)(HANDLE,LPCSTR,LPSTR,LPSECURITY_ATTRIBUTES,LPSECURITY_ATTRIBUTES,BOOL,DWORD,void *,LPCSTR,LPSTARTUPINFOA,LPPROCESS_INFORMATION)) + GetProcAddress(nt->hAdvapi32, "CreateProcessAsUserA"); + + nt->CreateProcessAsUserW = + (BOOL (__stdcall *)(HANDLE,LPCWSTR,LPWSTR,LPSECURITY_ATTRIBUTES,LPSECURITY_ATTRIBUTES,BOOL,DWORD,void *,LPCWSTR,LPSTARTUPINFOW,LPPROCESS_INFORMATION)) + GetProcAddress(nt->hAdvapi32, "CreateProcessAsUserW"); + + nt->LookupAccountSidA = + (BOOL (__stdcall *)(LPCSTR,PSID,LPSTR,LPDWORD,LPSTR,LPDWORD,PSID_NAME_USE)) + GetProcAddress(nt->hAdvapi32, "LookupAccountSidA"); + + nt->LookupAccountNameA = + (BOOL (__stdcall *)(LPCSTR,LPCSTR,PSID,LPDWORD,LPSTR,LPDWORD,PSID_NAME_USE)) + GetProcAddress(nt->hAdvapi32, "LookupAccountNameA"); + + nt->SetNamedSecurityInfoW = + (DWORD (__stdcall *)(LPWSTR,UINT,SECURITY_INFORMATION,PSID,PSID,PACL,PACL)) + GetProcAddress(nt->hAdvapi32, "SetNamedSecurityInfoW"); + + nt->AddAccessAllowedAceEx = + (BOOL (__stdcall *)(PACL,DWORD,DWORD,DWORD,PSID)) + GetProcAddress(nt->hAdvapi32, "AddAccessAllowedAceEx"); + + nt->QueryFullProcessImageNameA = + (BOOL (__stdcall *)(HANDLE,DWORD,LPSTR,PDWORD)) + GetProcAddress(nt->hKernel32, "QueryFullProcessImageNameA"); + + nt->QueryFullProcessImageNameW = + (BOOL (__stdcall *)(HANDLE,DWORD,LPWSTR,PDWORD)) + GetProcAddress(nt->hKernel32, "QueryFullProcessImageNameW"); + + nt->RegLoadKeyW = + (LSTATUS (__stdcall *)(HKEY,LPCWSTR,LPCWSTR)) + GetProcAddress(nt->hAdvapi32, "RegLoadKeyW"); + + nt->RegUnLoadKeyW = + (LSTATUS (__stdcall *)(HKEY,LPCWSTR)) + GetProcAddress(nt->hAdvapi32, "RegUnLoadKeyW"); + + if (info.dwMajorVersion >= 5) + { + nt->UpdateDriverForPlugAndPlayDevicesW = + (BOOL (__stdcall *)(HWND,wchar_t *,wchar_t *,UINT,BOOL *)) + GetProcAddress(nt->hNewDev, "UpdateDriverForPlugAndPlayDevicesW"); + + nt->CM_Get_Device_ID_ExA = + (UINT (__stdcall *)(DWORD,char *,UINT,UINT,HANDLE)) + GetProcAddress(nt->hSetupApi, "CM_Get_Device_ID_ExA"); + + nt->CM_Get_DevNode_Status_Ex = + (UINT (__stdcall *)(UINT *,UINT *,DWORD,UINT,HANDLE)) + GetProcAddress(nt->hSetupApi, "CM_Get_DevNode_Status_Ex"); + } + + nt->hWtsApi32 = LoadLibrary("wtsapi32.dll"); + if (nt->hWtsApi32 != NULL) + { + // Terminal Services related API + nt->WTSQuerySessionInformation = + (UINT (__stdcall *)(HANDLE,DWORD,WTS_INFO_CLASS,wchar_t *,DWORD *)) + GetProcAddress(nt->hWtsApi32, "WTSQuerySessionInformationW"); + nt->WTSFreeMemory = + (void (__stdcall *)(void *)) + GetProcAddress(nt->hWtsApi32, "WTSFreeMemory"); + nt->WTSDisconnectSession = + (BOOL (__stdcall *)(HANDLE,DWORD,BOOL)) + GetProcAddress(nt->hWtsApi32, "WTSDisconnectSession"); + nt->WTSEnumerateSessionsA = + (BOOL (__stdcall *)(HANDLE,DWORD,DWORD,PWTS_SESSION_INFOA *,DWORD *)) + GetProcAddress(nt->hWtsApi32, "WTSEnumerateSessionsA"); + nt->WTSRegisterSessionNotification = + (BOOL (__stdcall *)(HWND,DWORD)) + GetProcAddress(nt->hWtsApi32, "WTSRegisterSessionNotification"); + nt->WTSUnRegisterSessionNotification = + (BOOL (__stdcall *)(HWND)) + GetProcAddress(nt->hWtsApi32, "WTSUnRegisterSessionNotification"); + } + + // Service related API + nt->OpenSCManager = + (SC_HANDLE (__stdcall *)(LPCTSTR,LPCTSTR,DWORD)) + GetProcAddress(nt->hAdvapi32, "OpenSCManagerA"); + nt->CreateServiceA = + (SC_HANDLE (__stdcall *)(SC_HANDLE,LPCTSTR,LPCTSTR,DWORD,DWORD,DWORD,DWORD,LPCTSTR,LPCTSTR,LPDWORD,LPCTSTR,LPCTSTR,LPCTSTR)) + GetProcAddress(nt->hAdvapi32, "CreateServiceA"); + nt->CreateServiceW = + (SC_HANDLE (__stdcall *)(SC_HANDLE,LPCWSTR,LPCWSTR,DWORD,DWORD,DWORD,DWORD,LPCWSTR,LPCWSTR,LPDWORD,LPCWSTR,LPCWSTR,LPCWSTR)) + GetProcAddress(nt->hAdvapi32, "CreateServiceW"); + nt->ChangeServiceConfig2 = + (BOOL (__stdcall *)(SC_HANDLE,DWORD,LPVOID)) + GetProcAddress(nt->hAdvapi32, "ChangeServiceConfig2W"); + nt->CloseServiceHandle = + (BOOL (__stdcall *)(SC_HANDLE)) + GetProcAddress(nt->hAdvapi32, "CloseServiceHandle"); + nt->OpenService = + (SC_HANDLE (__stdcall *)(SC_HANDLE,LPCTSTR,DWORD)) + GetProcAddress(nt->hAdvapi32, "OpenServiceA"); + nt->QueryServiceStatus = + (BOOL (__stdcall *)(SC_HANDLE,LPSERVICE_STATUS)) + GetProcAddress(nt->hAdvapi32, "QueryServiceStatus"); + nt->StartService = + (BOOL (__stdcall *)(SC_HANDLE,DWORD,LPCTSTR)) + GetProcAddress(nt->hAdvapi32, "StartServiceA"); + nt->ControlService = + (BOOL (__stdcall *)(SC_HANDLE,DWORD,LPSERVICE_STATUS)) + GetProcAddress(nt->hAdvapi32, "ControlService"); + nt->SetServiceStatus = + (BOOL (__stdcall *)(SERVICE_STATUS_HANDLE,LPSERVICE_STATUS)) + GetProcAddress(nt->hAdvapi32, "SetServiceStatus"); + nt->RegisterServiceCtrlHandler = + (SERVICE_STATUS_HANDLE (__stdcall *)(LPCTSTR,LPHANDLER_FUNCTION)) + GetProcAddress(nt->hAdvapi32, "RegisterServiceCtrlHandlerW"); + nt->StartServiceCtrlDispatcher = + (BOOL (__stdcall *)(const LPSERVICE_TABLE_ENTRY)) + GetProcAddress(nt->hAdvapi32, "StartServiceCtrlDispatcherW"); + nt->DeleteService = + (BOOL (__stdcall *)(SC_HANDLE)) + GetProcAddress(nt->hAdvapi32, "DeleteService"); + nt->RegisterEventSourceW = + (HANDLE (__stdcall *)(LPCWSTR,LPCWSTR)) + GetProcAddress(nt->hAdvapi32, "RegisterEventSourceW"); + nt->ReportEventW = + (BOOL (__stdcall *)(HANDLE,WORD,WORD,DWORD,PSID,WORD,DWORD,LPCWSTR *,LPVOID)) + GetProcAddress(nt->hAdvapi32, "ReportEventW"); + nt->DeregisterEventSource = + (BOOL (__stdcall *)(HANDLE)) + GetProcAddress(nt->hAdvapi32, "DeregisterEventSource"); + nt->Wow64DisableWow64FsRedirection = + (BOOL (__stdcall *)(void **)) + GetProcAddress(nt->hKernel32, "Wow64DisableWow64FsRedirection"); + nt->Wow64EnableWow64FsRedirection = + (BOOLEAN (__stdcall *)(BOOLEAN)) + GetProcAddress(nt->hKernel32, "Wow64EnableWow64FsRedirection"); + nt->Wow64RevertWow64FsRedirection = + (BOOL (__stdcall *)(void *)) + GetProcAddress(nt->hKernel32, "Wow64RevertWow64FsRedirection"); + + if (nt->hPsApi != NULL) + { + // Process related API + nt->EnumProcesses = + (BOOL (__stdcall *)(DWORD *,DWORD,DWORD *)) + GetProcAddress(nt->hPsApi, "EnumProcesses"); + + nt->EnumProcessModules = + (BOOL (__stdcall *)(HANDLE,HMODULE * ,DWORD,DWORD *)) + GetProcAddress(nt->hPsApi, "EnumProcessModules"); + + nt->GetModuleFileNameExA = + (DWORD (__stdcall *)(HANDLE,HMODULE,LPSTR,DWORD)) + GetProcAddress(nt->hPsApi, "GetModuleFileNameExA"); + + nt->GetModuleFileNameExW = + (DWORD (__stdcall *)(HANDLE,HMODULE,LPWSTR,DWORD)) + GetProcAddress(nt->hPsApi, "GetModuleFileNameExW"); + + nt->GetProcessImageFileNameA = + (DWORD (__stdcall *)(HANDLE,LPSTR,DWORD)) + GetProcAddress(nt->hPsApi, "GetProcessImageFileNameA"); + + nt->GetProcessImageFileNameW = + (DWORD (__stdcall *)(HANDLE,LPWSTR,DWORD)) + GetProcAddress(nt->hPsApi, "GetProcessImageFileNameW"); + } + + // Registry related API + nt->RegDeleteKeyExA = + (LONG (__stdcall *)(HKEY,LPCTSTR,REGSAM,DWORD)) + GetProcAddress(nt->hAdvapi32, "RegDeleteKeyExA"); + + // Security related API + if (nt->hSecur32 != NULL) + { + nt->GetUserNameExA = + (BOOL (__stdcall *)(EXTENDED_NAME_FORMAT,LPSTR,PULONG)) + GetProcAddress(nt->hSecur32, "GetUserNameExA"); + + nt->GetUserNameExW = + (BOOL (__stdcall *)(EXTENDED_NAME_FORMAT,LPWSTR,PULONG)) + GetProcAddress(nt->hSecur32, "GetUserNameExW"); + + nt->LsaConnectUntrusted = + (NTSTATUS (__stdcall *)(PHANDLE)) + GetProcAddress(nt->hSecur32, "LsaConnectUntrusted"); + + nt->LsaLookupAuthenticationPackage = + (NTSTATUS (__stdcall *)(HANDLE,PLSA_STRING,PULONG)) + GetProcAddress(nt->hSecur32, "LsaLookupAuthenticationPackage"); + + nt->LsaLogonUser = + (NTSTATUS (__stdcall *)(HANDLE,PLSA_STRING,SECURITY_LOGON_TYPE,ULONG,PVOID,ULONG,PTOKEN_GROUPS,PTOKEN_SOURCE,PVOID,PULONG,PLUID,PHANDLE,PQUOTA_LIMITS,PNTSTATUS)) + GetProcAddress(nt->hSecur32, "LsaLogonUser"); + + nt->LsaDeregisterLogonProcess = + (NTSTATUS (__stdcall *)(HANDLE)) + GetProcAddress(nt->hSecur32, "LsaDeregisterLogonProcess"); + + nt->LsaFreeReturnBuffer = + (NTSTATUS (__stdcall *)(PVOID)) + GetProcAddress(nt->hSecur32, "LsaFreeReturnBuffer"); + } + + // WCM related API of Windows 8 + if (nt->hWcmapi != NULL) + { + nt->WcmQueryProperty = + (DWORD (__stdcall *)(const GUID *,LPCWSTR,MS_WCM_PROPERTY,PVOID,PDWORD,PBYTE *)) + GetProcAddress(nt->hWcmapi, "WcmQueryProperty"); + + nt->WcmSetProperty = + (DWORD (__stdcall *)(const GUID *,LPCWSTR,MS_WCM_PROPERTY,PVOID,DWORD,const BYTE *)) + GetProcAddress(nt->hWcmapi, "WcmSetProperty"); + + nt->WcmFreeMemory = + (void (__stdcall *)(PVOID)) + GetProcAddress(nt->hWcmapi, "WcmFreeMemory"); + + nt->WcmGetProfileList = + (DWORD (__stdcall *)(PVOID,MS_WCM_PROFILE_INFO_LIST **)) + GetProcAddress(nt->hWcmapi, "WcmGetProfileList"); + } + + nt->AllocateLocallyUniqueId = + (BOOL (__stdcall *)(PLUID)) + GetProcAddress(nt->hAdvapi32, "AllocateLocallyUniqueId"); + + // Desktop related API + if (nt->hUser32 != NULL) + { + nt->SwitchDesktop = + (BOOL (__stdcall *)(HDESK)) + GetProcAddress(nt->hUser32, "SwitchDesktop"); + nt->OpenDesktopA = + (HDESK (__stdcall *)(LPTSTR,DWORD,BOOL,ACCESS_MASK)) + GetProcAddress(nt->hUser32, "OpenDesktopA"); + nt->CloseDesktop = + (BOOL (__stdcall *)(HDESK)) + GetProcAddress(nt->hUser32, "CloseDesktop"); + } + + // DWM API + if (nt->hDwmapi) + { + nt->DwmIsCompositionEnabled = + (HRESULT (__stdcall *)(BOOL *)) + GetProcAddress(nt->hDwmapi, "DwmIsCompositionEnabled"); + } + + // Debug related API + if (nt->hDbgHelp != NULL) + { + nt->MiniDumpWriteDump = + (BOOL (__stdcall *)(HANDLE,DWORD,HANDLE,MINIDUMP_TYPE,PMINIDUMP_EXCEPTION_INFORMATION,PMINIDUMP_USER_STREAM_INFORMATION,PMINIDUMP_CALLBACK_INFORMATION)) + GetProcAddress(nt->hDbgHelp, "MiniDumpWriteDump"); + } + + return nt; +} + +// Release of NT system function +void MsFreeNtApiFunctions(NT_API *nt) +{ + // Validate arguments + if (nt == NULL) + { + return; + } + + if (nt->hSecur32 != NULL) + { + FreeLibrary(nt->hSecur32); + } + + if (nt->hNewDev != NULL) + { + FreeLibrary(nt->hSetupApi); + FreeLibrary(nt->hNewDev); + } + + FreeLibrary(nt->hAdvapi32); + + FreeLibrary(nt->hShell32); + + if (nt->hWtsApi32 != NULL) + { + FreeLibrary(nt->hWtsApi32); + } + + if (nt->hPsApi != NULL) + { + FreeLibrary(nt->hPsApi); + } + + if (nt->hUser32 != NULL) + { + FreeLibrary(nt->hUser32); + } + + if (nt->hDbgHelp != NULL) + { + FreeLibrary(nt->hDbgHelp); + } + + if (nt->hWcmapi != NULL) + { + FreeLibrary(nt->hWcmapi); + } + + if (nt->hDwmapi != NULL) + { + FreeLibrary(nt->hDwmapi); + } + + FreeLibrary(nt->hKernel32); + + Free(nt); +} + +// Get whether the screen color is like to Aero of Windows Vista or later +bool MsIsAeroColor() +{ + UINT r; + if (MsIsNt() == false) + { + return false; + } + + if (MsIsVista() == false) + { + return false; + } + + r = GetSysColor(COLOR_MENU); + if (r == 0xFFFFFF || r == 0xF0F0F0 || r >= 0xF00000) + { + return true; + } + + if (MsIsAeroEnabled()) + { + return true; + } + + return false; +} + +// Get whether Aero is enabled +bool MsIsAeroEnabled() +{ + bool ret; + if (MsIsNt() == false) + { + return false; + } + + if (ms->nt->DwmIsCompositionEnabled == NULL) + { + return false; + } + + ret = false; + + if (ms->nt->DwmIsCompositionEnabled(&ret) != S_OK) + { + return false; + } + + return ret; +} + +// Generate an access mask to force accessing to the 32 bit registry key for 64 bit application +UINT MsRegAccessMaskFor64BitEx(bool force32bit, bool force64bit) +{ + if (MsIs64BitWindows() == false) + { + return 0; + } + if (force32bit) + { + return KEY_WOW64_32KEY; + } + if (force64bit) + { + return KEY_WOW64_64KEY; + } + + return 0; +} + +// Load the hive +bool MsRegLoadHive(UINT root, wchar_t *keyname, wchar_t *filename) +{ + LONG ret; + if (keyname == NULL || filename == NULL) + { + WHERE; + return false; + } + + if (ms->nt == NULL || ms->nt->RegLoadKeyW == NULL || ms->nt->RegUnLoadKeyW == NULL) + { + WHERE; + return false; + } + + ret = ms->nt->RegLoadKeyW(MsGetRootKeyFromInt(root), keyname, filename); + + if (ret != ERROR_SUCCESS) + { + Debug("RegLoadKeyW: %S %S %u\n", keyname, filename, GetLastError()); + return false; + } + WHERE; + + return true; +} + +// Unload the hive +bool MsRegUnloadHive(UINT root, wchar_t *keyname) +{ + LONG ret; + if (keyname == NULL) + { + return false; + } + + if (ms->nt == NULL || ms->nt->RegLoadKeyW == NULL || ms->nt->RegUnLoadKeyW == NULL) + { + return false; + } + + ret = ms->nt->RegUnLoadKeyW(MsGetRootKeyFromInt(root), keyname); + + if (ret != ERROR_SUCCESS) + { + Debug("RegUnLoadKeyW: %u\n", GetLastError()); + return false; + } + + return true; +} + +// Delete the value +bool MsRegDeleteValue(UINT root, char *keyname, char *valuename) +{ + return MsRegDeleteValueEx(root, keyname, valuename, false); +} +bool MsRegDeleteValueEx(UINT root, char *keyname, char *valuename, bool force32bit) +{ + return MsRegDeleteValueEx2(root, keyname, valuename, force32bit, false); +} +bool MsRegDeleteValueEx2(UINT root, char *keyname, char *valuename, bool force32bit, bool force64bit) +{ + HKEY h; + bool ret; + // Validate arguments + if (keyname == NULL) + { + return false; + } + + if (RegOpenKeyEx(MsGetRootKeyFromInt(root), keyname, 0, KEY_ALL_ACCESS | MsRegAccessMaskFor64BitEx(force32bit, force64bit), &h) != ERROR_SUCCESS) + { + return false; + } + + if (RegDeleteValue(h, valuename) != ERROR_SUCCESS) + { + ret = false; + } + else + { + ret = true; + } + + RegCloseKey(h); + + return ret; +} + +// Delete the key +bool MsRegDeleteKey(UINT root, char *keyname) +{ + return MsRegDeleteKeyEx(root, keyname, false); +} +bool MsRegDeleteKeyEx(UINT root, char *keyname, bool force32bit) +{ + return MsRegDeleteKeyEx2(root, keyname, force32bit, false); +} +bool MsRegDeleteKeyEx2(UINT root, char *keyname, bool force32bit, bool force64bit) +{ + // Validate arguments + if (keyname == NULL) + { + return false; + } + + if (MsIsNt() && ms->nt->RegDeleteKeyExA != NULL) + { + if (ms->nt->RegDeleteKeyExA(MsGetRootKeyFromInt(root), keyname, MsRegAccessMaskFor64BitEx(force32bit, force64bit), 0) != ERROR_SUCCESS) + { + return false; + } + } + else + { + if (RegDeleteKey(MsGetRootKeyFromInt(root), keyname) != ERROR_SUCCESS) + { + return false; + } + } + + return true; +} + +// Enumeration of values +TOKEN_LIST *MsRegEnumValue(UINT root, char *keyname) +{ + return MsRegEnumValueEx(root, keyname, false); +} +TOKEN_LIST *MsRegEnumValueEx(UINT root, char *keyname, bool force32bit) +{ + return MsRegEnumValueEx2(root, keyname, force32bit, false); +} +TOKEN_LIST *MsRegEnumValueEx2(UINT root, char *keyname, bool force32bit, bool force64bit) +{ + HKEY h; + UINT i; + TOKEN_LIST *t; + LIST *o; + + if (keyname == NULL) + { + h = MsGetRootKeyFromInt(root); + } + else + { + if (RegOpenKeyEx(MsGetRootKeyFromInt(root), keyname, 0, KEY_READ | MsRegAccessMaskFor64BitEx(force32bit, force64bit), &h) != ERROR_SUCCESS) + { + return NULL; + } + } + + o = NewListFast(CompareStr); + + for (i = 0;;i++) + { + char tmp[MAX_SIZE]; + UINT ret; + UINT size = sizeof(tmp); + + Zero(tmp, sizeof(tmp)); + ret = RegEnumValue(h, i, tmp, &size, NULL, NULL, NULL, NULL); + if (ret == ERROR_NO_MORE_ITEMS) + { + break; + } + else if (ret != ERROR_SUCCESS) + { + break; + } + + Add(o, CopyStr(tmp)); + } + + Sort(o); + + t = ZeroMalloc(sizeof(TOKEN_LIST)); + t->NumTokens = LIST_NUM(o); + t->Token = ZeroMalloc(sizeof(char *) * t->NumTokens); + for (i = 0;i < t->NumTokens;i++) + { + t->Token[i] = LIST_DATA(o, i); + } + + ReleaseList(o); + + if (keyname != NULL) + { + RegCloseKey(h); + } + + return t; +} + +// Enumeration of the keys +TOKEN_LIST *MsRegEnumKey(UINT root, char *keyname) +{ + return MsRegEnumKeyEx(root, keyname, false); +} +TOKEN_LIST *MsRegEnumKeyEx(UINT root, char *keyname, bool force32bit) +{ + return MsRegEnumKeyEx2(root, keyname, force32bit, false); +} +TOKEN_LIST *MsRegEnumKeyEx2(UINT root, char *keyname, bool force32bit, bool force64bit) +{ + HKEY h; + UINT i; + TOKEN_LIST *t; + LIST *o; + + if (keyname == NULL) + { + h = MsGetRootKeyFromInt(root); + } + else + { + if (RegOpenKeyEx(MsGetRootKeyFromInt(root), keyname, 0, KEY_READ | MsRegAccessMaskFor64BitEx(force32bit, force64bit), &h) != ERROR_SUCCESS) + { + return NULL; + } + } + + o = NewListFast(CompareStr); + + for (i = 0;;i++) + { + char tmp[MAX_SIZE]; + UINT ret; + UINT size = sizeof(tmp); + FILETIME ft; + + Zero(tmp, sizeof(tmp)); + ret = RegEnumKeyEx(h, i, tmp, &size, NULL, NULL, NULL, &ft); + if (ret == ERROR_NO_MORE_ITEMS) + { + break; + } + else if (ret != ERROR_SUCCESS) + { + break; + } + + Add(o, CopyStr(tmp)); + } + + Sort(o); + + t = ZeroMalloc(sizeof(TOKEN_LIST)); + t->NumTokens = LIST_NUM(o); + t->Token = ZeroMalloc(sizeof(char *) * t->NumTokens); + for (i = 0;i < t->NumTokens;i++) + { + t->Token[i] = LIST_DATA(o, i); + } + + ReleaseList(o); + + if (keyname != NULL) + { + RegCloseKey(h); + } + + return t; +} + +// Set the binary data +bool MsRegWriteBin(UINT root, char *keyname, char *valuename, void *data, UINT size) +{ + return MsRegWriteBinEx(root, keyname, valuename, data, size, false); +} +bool MsRegWriteBinEx(UINT root, char *keyname, char *valuename, void *data, UINT size, bool force32bit) +{ + return MsRegWriteBinEx2(root, keyname, valuename, data, size, force32bit, false); +} +bool MsRegWriteBinEx2(UINT root, char *keyname, char *valuename, void *data, UINT size, bool force32bit, bool force64bit) +{ + // Validate arguments + if (keyname == NULL || (size != 0 && data == NULL)) + { + return false; + } + + return MsRegWriteValueEx2(root, keyname, valuename, REG_BINARY, data, size, force32bit, force64bit); +} + +// Set the integer value +bool MsRegWriteInt(UINT root, char *keyname, char *valuename, UINT value) +{ + return MsRegWriteIntEx(root, keyname, valuename, value, false); +} +bool MsRegWriteIntEx(UINT root, char *keyname, char *valuename, UINT value, bool force32bit) +{ + return MsRegWriteIntEx2(root, keyname, valuename, value, force32bit, false); +} +bool MsRegWriteIntEx2(UINT root, char *keyname, char *valuename, UINT value, bool force32bit, bool force64bit) +{ + // Validate arguments + if (keyname == NULL) + { + return false; + } + + // Endian correction + if (IsBigEndian()) + { + value = Swap32(value); + } + + return MsRegWriteValueEx2(root, keyname, valuename, REG_DWORD_LITTLE_ENDIAN, &value, sizeof(UINT), force32bit, force64bit); +} + +// Set the string +bool MsRegWriteStrExpand(UINT root, char *keyname, char *valuename, char *str) +{ + return MsRegWriteStrExpandEx(root, keyname, valuename, str, false); +} +bool MsRegWriteStrExpandEx(UINT root, char *keyname, char *valuename, char *str, bool force32bit) +{ + return MsRegWriteStrExpandEx2(root, keyname, valuename, str, force32bit, false); +} +bool MsRegWriteStrExpandEx2(UINT root, char *keyname, char *valuename, char *str, bool force32bit, bool force64bit) +{ + // Validate arguments + if (keyname == NULL || str == NULL) + { + return false; + } + + return MsRegWriteValueEx2(root, keyname, valuename, REG_EXPAND_SZ, str, StrSize(str), force32bit, force64bit); +} +bool MsRegWriteStrExpandW(UINT root, char *keyname, char *valuename, wchar_t *str) +{ + return MsRegWriteStrExpandExW(root, keyname, valuename, str, false); +} +bool MsRegWriteStrExpandExW(UINT root, char *keyname, char *valuename, wchar_t *str, bool force32bit) +{ + return MsRegWriteStrExpandEx2W(root, keyname, valuename, str, force32bit, false); +} +bool MsRegWriteStrExpandEx2W(UINT root, char *keyname, char *valuename, wchar_t *str, bool force32bit, bool force64bit) +{ + // Validate arguments + if (keyname == NULL || str == NULL) + { + return false; + } + + return MsRegWriteValueEx2W(root, keyname, valuename, REG_EXPAND_SZ, str, UniStrSize(str), force32bit, force64bit); +} + +bool MsRegWriteStr(UINT root, char *keyname, char *valuename, char *str) +{ + return MsRegWriteStrEx(root, keyname, valuename, str, false); +} +bool MsRegWriteStrEx(UINT root, char *keyname, char *valuename, char *str, bool force32bit) +{ + return MsRegWriteStrEx2(root, keyname, valuename, str, force32bit, false); +} +bool MsRegWriteStrEx2(UINT root, char *keyname, char *valuename, char *str, bool force32bit, bool force64bit) +{ + // Validate arguments + if (keyname == NULL || str == NULL) + { + return false; + } + + return MsRegWriteValueEx2(root, keyname, valuename, REG_SZ, str, StrSize(str), force32bit, force64bit); +} +bool MsRegWriteStrW(UINT root, char *keyname, char *valuename, wchar_t *str) +{ + return MsRegWriteStrExW(root, keyname, valuename, str, false); +} +bool MsRegWriteStrExW(UINT root, char *keyname, char *valuename, wchar_t *str, bool force32bit) +{ + return MsRegWriteStrEx2W(root, keyname, valuename, str, force32bit, false); +} +bool MsRegWriteStrEx2W(UINT root, char *keyname, char *valuename, wchar_t *str, bool force32bit, bool force64bit) +{ + // Validate arguments + if (keyname == NULL || str == NULL) + { + return false; + } + + return MsRegWriteValueEx2W(root, keyname, valuename, REG_SZ, str, UniStrSize(str), force32bit, force64bit); +} + +// Set the value +bool MsRegWriteValueEx2(UINT root, char *keyname, char *valuename, UINT type, void *data, UINT size, bool force32bit, bool force64bit) +{ + HKEY h; + // Validate arguments + if (keyname == NULL || (size != 0 && data == NULL)) + { + return false; + } + + // Create a key + MsRegNewKeyEx2(root, keyname, force32bit, force64bit); + + // Open the key + if (RegOpenKeyEx(MsGetRootKeyFromInt(root), keyname, 0, KEY_ALL_ACCESS | MsRegAccessMaskFor64BitEx(force32bit, force64bit), &h) != ERROR_SUCCESS) + { + return false; + } + + // Write the value + if (RegSetValueEx(h, valuename, 0, type, data, size) != ERROR_SUCCESS) + { + RegCloseKey(h); + return false; + } + + // Close the key + RegCloseKey(h); + + return true; +} +bool MsRegWriteValueEx2W(UINT root, char *keyname, char *valuename, UINT type, void *data, UINT size, bool force32bit, bool force64bit) +{ + HKEY h; + wchar_t *valuename_w; + // Validate arguments + if (keyname == NULL || (size != 0 && data == NULL)) + { + return false; + } + + if (IsNt() == false) + { + UINT size_a; + void *data_a; + bool ret; + + if (type == REG_SZ || type == REG_MULTI_SZ || type == REG_EXPAND_SZ) + { + data_a = CopyUniToStr(data); + size_a = StrSize(data_a); + } + else + { + data_a = Clone(data, size); + size_a = size; + } + + ret = MsRegWriteValueEx2(root, keyname, valuename, type, data_a, size_a, force32bit, force64bit); + + Free(data_a); + + return ret; + } + + // Create a key + MsRegNewKeyEx2(root, keyname, force32bit, force64bit); + + // Open the key + if (RegOpenKeyEx(MsGetRootKeyFromInt(root), keyname, 0, KEY_ALL_ACCESS | MsRegAccessMaskFor64BitEx(force32bit, force64bit), &h) != ERROR_SUCCESS) + { + return false; + } + + valuename_w = CopyStrToUni(valuename); + + // Write the value + if (RegSetValueExW(h, valuename_w, 0, type, data, size) != ERROR_SUCCESS) + { + RegCloseKey(h); + Free(valuename_w); + return false; + } + + // Close the key + RegCloseKey(h); + Free(valuename_w); + + return true; +} + +// Get the binary data +BUF *MsRegReadBin(UINT root, char *keyname, char *valuename) +{ + return MsRegReadBinEx(root, keyname, valuename, false); +} +BUF *MsRegReadBinEx(UINT root, char *keyname, char *valuename, bool force32bit) +{ + return MsRegReadBinEx2(root, keyname, valuename, force32bit, false); +} +BUF *MsRegReadBinEx2(UINT root, char *keyname, char *valuename, bool force32bit, bool force64bit) +{ + char *ret; + UINT type, size; + BUF *b; + // Validate arguments + if (keyname == NULL || valuename == NULL) + { + return 0; + } + + // Read the value + if (MsRegReadValueEx2(root, keyname, valuename, &ret, &type, &size, force32bit, force64bit) == false) + { + return 0; + } + + b = NewBuf(); + + WriteBuf(b, ret, size); + SeekBuf(b, 0, 0); + + Free(ret); + + return b; +} + +// Get an integer value +UINT MsRegReadInt(UINT root, char *keyname, char *valuename) +{ + return MsRegReadIntEx(root, keyname, valuename, false); +} +UINT MsRegReadIntEx(UINT root, char *keyname, char *valuename, bool force32bit) +{ + return MsRegReadIntEx2(root, keyname, valuename, force32bit, false); +} +UINT MsRegReadIntEx2(UINT root, char *keyname, char *valuename, bool force32bit, bool force64bit) +{ + char *ret; + UINT type, size; + UINT value; + // Validate arguments + if (keyname == NULL || valuename == NULL) + { + return 0; + } + + // Read the value + if (MsRegReadValueEx2(root, keyname, valuename, &ret, &type, &size, force32bit, force64bit) == false) + { + return 0; + } + + // Check the type + if (type != REG_DWORD_LITTLE_ENDIAN && type != REG_DWORD_BIG_ENDIAN) + { + // It is not a DWORD + Free(ret); + return 0; + } + + // Check the size + if (size != sizeof(UINT)) + { + Free(ret); + return 0; + } + + Copy(&value, ret, sizeof(UINT)); + + Free(ret); + + // Endian conversion + if (IsLittleEndian()) + { +#ifdef REG_DWORD_BIG_ENDIAN + if (type == REG_DWORD_BIG_ENDIAN) + { + value = Swap32(value); + } +#endif // REG_DWORD_BIG_ENDIAN + } + else + { +#ifdef REG_DWORD_LITTLE_ENDIAN_FLAG + if (type == REG_DWORD_LITTLE_ENDIAN_FLAG) + { + value = Swap32(value); + } +#endif // REG_DWORD_LITTLE_ENDIAN_FLAG + } + + return value; +} + +// Get a string list +LIST *MsRegReadStrList(UINT root, char *keyname, char *valuename) +{ + return MsRegReadStrListEx(root, keyname, valuename, false); +} +LIST *MsRegReadStrListEx(UINT root, char *keyname, char *valuename, bool force32bit) +{ + return MsRegReadStrListEx2(root, keyname, valuename, force32bit, false); +} +LIST *MsRegReadStrListEx2(UINT root, char *keyname, char *valuename, bool force32bit, bool force64bit) +{ + LIST *o; + char *ret; + UINT type, size; + // Validate arguments + if (keyname == NULL || valuename == NULL) + { + return NULL; + } + + // Read the value + if (MsRegReadValueEx2(root, keyname, valuename, &ret, &type, &size, force32bit, force64bit) == false) + { + return NULL; + } + + // Check the type + if (type != REG_MULTI_SZ) + { + // It is not a string list + Free(ret); + return NULL; + } + + if (size < 2) + { + // Invalid size + Free(ret); + return NULL; + } + + if (ret[size - 1] != 0) + { + // Invalid data + Free(ret); + return NULL; + } + + // Creating a list + o = StrToStrList(ret, size); + + Free(ret); + + return o; +} + +// Get a string +char *MsRegReadStr(UINT root, char *keyname, char *valuename) +{ + return MsRegReadStrEx(root, keyname, valuename, false); +} +char *MsRegReadStrEx(UINT root, char *keyname, char *valuename, bool force32bit) +{ + return MsRegReadStrEx2(root, keyname, valuename, force32bit, false); +} +char *MsRegReadStrEx2(UINT root, char *keyname, char *valuename, bool force32bit, bool force64bit) +{ + char *ret; + UINT type, size; + // Validate arguments + if (keyname == NULL || valuename == NULL) + { + return NULL; + } + + // Read the value + if (MsRegReadValueEx2(root, keyname, valuename, &ret, &type, &size, force32bit, force64bit) == false) + { + return NULL; + } + + // Check the type + if (type != REG_SZ && type != REG_EXPAND_SZ && type != REG_MULTI_SZ) + { + // It is not a string + Free(ret); + + if (type == REG_MULTI_SZ) + { + // It is a string list + LIST *o = MsRegReadStrList(root, keyname, valuename); + if (o != NULL) + { + if (LIST_NUM(o) >= 1) + { + ret = CopyStr(LIST_DATA(o, 0)); + FreeStrList(o); + return ret; + } + } + } + return NULL; + } + + if (size == 0) + { + // Invalid size + Free(ret); + + return CopyStr(""); + } + + if (ret[size - 1] != 0) + { + // Invalid data + Free(ret); + return NULL; + } + + return ret; +} +wchar_t *MsRegReadStrW(UINT root, char *keyname, char *valuename) +{ + return MsRegReadStrExW(root, keyname, valuename, false); +} +wchar_t *MsRegReadStrExW(UINT root, char *keyname, char *valuename, bool force32bit) +{ + return MsRegReadStrEx2W(root, keyname, valuename, force32bit, false); +} +wchar_t *MsRegReadStrEx2W(UINT root, char *keyname, char *valuename, bool force32bit, bool force64bit) +{ + wchar_t *ret; + UINT type, size; + // Validate arguments + if (keyname == NULL || valuename == NULL) + { + return NULL; + } + + // Read the value + if (MsRegReadValueEx2W(root, keyname, valuename, &ret, &type, &size, force32bit, force64bit) == false) + { + return NULL; + } + + // Check the type + if (type != REG_SZ && type != REG_EXPAND_SZ) + { + // It is not a string + Free(ret); + + return NULL; + } + + if (ret[size / sizeof(wchar_t) - 1] != 0) + { + // Invalid data + Free(ret); + return NULL; + } + + return ret; +} + +// Read the value +bool MsRegReadValueEx2(UINT root, char *keyname, char *valuename, void **data, UINT *type, UINT *size, bool force32bit, bool force64bit) +{ + HKEY h; + UINT ret; + // Validate arguments + if (keyname == NULL || data == NULL || type == NULL || size == NULL) + { + return false; + } + *type = 0; + *size = 0; + + // Open the key + if (RegOpenKeyEx(MsGetRootKeyFromInt(root), keyname, 0, KEY_READ | MsRegAccessMaskFor64BitEx(force32bit, force64bit), &h) != ERROR_SUCCESS) + { + return false; + } + + // Open up the value + *data = ZeroMalloc(*size); + ret = RegQueryValueEx(h, valuename, 0, type, *data, size); + + if (ret == ERROR_SUCCESS) + { + // Reading is complete + RegCloseKey(h); + return true; + } + + if (ret != ERROR_MORE_DATA) + { + // Strange error occurs + Free(*data); + *data = NULL; + RegCloseKey(h); + return false; + } + + // Get the data by re-allocating memory + *data = ReAlloc(*data, *size); + ret = RegQueryValueEx(h, valuename, 0, type, *data, size); + if (ret != ERROR_SUCCESS) + { + // An error has occured + Free(*data); + *data = NULL; + RegCloseKey(h); + } + + RegCloseKey(h); + + return true; +} +bool MsRegReadValueEx2W(UINT root, char *keyname, char *valuename, void **data, UINT *type, UINT *size, bool force32bit, bool force64bit) +{ + HKEY h; + UINT ret; + wchar_t *valuename_w; + // Validate arguments + if (keyname == NULL || data == NULL || type == NULL || size == NULL) + { + return false; + } + *type = 0; + *size = 0; + + if (IsNt() == false) + { + bool ret; + void *data_a = NULL; + UINT type_a = 0, size_a = 0; + + ret = MsRegReadValueEx2(root, keyname, valuename, &data_a, &type_a, &size_a, force32bit, force64bit); + + if (ret != false) + { + if (type_a == REG_SZ || type_a == REG_MULTI_SZ || type_a == REG_EXPAND_SZ) + { + *data = CopyStrToUni(data_a); + Free(data_a); + + size_a = UniStrSize(*data); + } + else + { + *data = data_a; + } + + *type = type_a; + *size = size_a; + } + + return ret; + } + + // Open the key + if (RegOpenKeyEx(MsGetRootKeyFromInt(root), keyname, 0, KEY_READ | MsRegAccessMaskFor64BitEx(force32bit, force64bit), &h) != ERROR_SUCCESS) + { + return false; + } + + valuename_w = CopyStrToUni(valuename); + + // Open up the value + *data = ZeroMalloc(*size); + ret = RegQueryValueExW(h, valuename_w, 0, type, *data, size); + + if (ret == ERROR_SUCCESS) + { + // Reading is complete + RegCloseKey(h); + Free(valuename_w); + return true; + } + + if (ret != ERROR_MORE_DATA) + { + // Strange error occurs + Free(*data); + *data = NULL; + Free(valuename_w); + RegCloseKey(h); + return false; + } + + // Get the data by re-allocating memory + *data = ReAlloc(*data, *size); + ret = RegQueryValueExW(h, valuename_w, 0, type, *data, size); + if (ret != ERROR_SUCCESS) + { + // An error has occured + Free(*data); + *data = NULL; + Free(valuename_w); + RegCloseKey(h); + } + + Free(valuename_w); + + RegCloseKey(h); + + return true; +} + +// Confirm that the specified value exists on the registry +bool MsRegIsValue(UINT root, char *keyname, char *valuename) +{ + return MsRegIsValueEx(root, keyname, valuename, false); +} +bool MsRegIsValueEx(UINT root, char *keyname, char *valuename, bool force32bit) +{ + return MsRegIsValueEx2(root, keyname, valuename, force32bit, false); +} +bool MsRegIsValueEx2(UINT root, char *keyname, char *valuename, bool force32bit, bool force64bit) +{ + HKEY h; + UINT type, size; + UINT ret; + // Validate arguments + if (keyname == NULL) + { + return false; + } + + // Open the key + if (RegOpenKeyEx(MsGetRootKeyFromInt(root), keyname, 0, KEY_READ | MsRegAccessMaskFor64BitEx(force32bit, force64bit), &h) != ERROR_SUCCESS) + { + return false; + } + + // Open up the value + size = 0; + ret = RegQueryValueEx(h, valuename, 0, &type, NULL, &size); + + if (ret == ERROR_SUCCESS || ret == ERROR_MORE_DATA) + { + RegCloseKey(h); + return true; + } + + RegCloseKey(h); + + return false; +} + +// Create a key in the registry +bool MsRegNewKeyEx2(UINT root, char *keyname, bool force32bit, bool force64bit) +{ + HKEY h; + // Validate arguments + if (keyname == NULL) + { + return false; + } + + // Confirm whether there is the key + if (MsRegIsKeyEx2(root, keyname, force32bit, force64bit)) + { + // Already exists + return true; + } + + // Create a key + if (RegCreateKeyEx(MsGetRootKeyFromInt(root), keyname, 0, NULL, REG_OPTION_NON_VOLATILE, + KEY_ALL_ACCESS | MsRegAccessMaskFor64BitEx(force32bit, force64bit), NULL, &h, NULL) != ERROR_SUCCESS) + { + // Failed + return false; + } + + RegCloseKey(h); + + return true; +} + +// Confirm the specified key exists on the registry +bool MsRegIsKey(UINT root, char *name) +{ + return MsRegIsKeyEx(root, name, false); +} +bool MsRegIsKeyEx(UINT root, char *name, bool force32bit) +{ + return MsRegIsKeyEx2(root, name, force32bit, false); +} +bool MsRegIsKeyEx2(UINT root, char *name, bool force32bit, bool force64bit) +{ + HKEY h; + // Validate arguments + if (name == NULL) + { + return false; + } + + if (RegOpenKeyEx(MsGetRootKeyFromInt(root), name, 0, KEY_READ | MsRegAccessMaskFor64BitEx(force32bit, force64bit), &h) != ERROR_SUCCESS) + { + return false; + } + + RegCloseKey(h); + + return true; +} + +// Getting root key handle +HKEY MsGetRootKeyFromInt(UINT root) +{ + switch (root) + { + case REG_CLASSES_ROOT: + return HKEY_CLASSES_ROOT; + + case REG_LOCAL_MACHINE: + return HKEY_LOCAL_MACHINE; + + case REG_CURRENT_USER: + return HKEY_CURRENT_USER; + + case REG_USERS: + return HKEY_USERS; + } + + return NULL; +} + +// Cut the executable file name from the command line string (Unicode version) +wchar_t *MsCutExeNameFromUniCommandLine(wchar_t *str) +{ + // Validate arguments + if (str == NULL) + { + return NULL; + } + + if (str[0] != L'\"') + { + UINT i = UniSearchStrEx(str, L" ", 0, true); + if (i == INFINITE) + { + return str + UniStrLen(str); + } + else + { + return str + i + 1; + } + } + else + { + str++; + while (true) + { + if ((*str) == 0) + { + return str + UniStrLen(str); + } + if ((*str) == L'\"') + { + break; + } + str++; + } + + while (true) + { + if ((*str) == 0) + { + return str + UniStrLen(str); + } + if ((*str) == L' ') + { + return str + 1; + } + str++; + } + } +} + +// Cut the executable file name from the command line string +char *MsCutExeNameFromCommandLine(char *str) +{ + // Validate arguments + if (str == NULL) + { + return NULL; + } + + if (str[0] != '\"') + { + UINT i = SearchStrEx(str, " ", 0, true); + if (i == INFINITE) + { + return str + StrLen(str); + } + else + { + return str + i + 1; + } + } + else + { + str++; + while (true) + { + if ((*str) == 0) + { + return str + StrLen(str); + } + if ((*str) == '\"') + { + break; + } + str++; + } + + while (true) + { + if ((*str) == 0) + { + return str + StrLen(str); + } + if ((*str) == ' ') + { + return str + 1; + } + str++; + } + } +} + +// Get the Process handle +void *MsGetCurrentProcess() +{ + return ms->hCurrentProcess; +} + +// Get the Process ID +UINT MsGetCurrentProcessId() +{ + return ms->CurrentProcessId; +} + +// Get the EXE file name +char *MsGetExeFileName() +{ + return ms == NULL ? "Unknown" : ms->ExeFileName; +} + +// Get the name of the directory where the EXE file is in +char *MsGetExeDirName() +{ + return ms->ExeFileDir; +} +wchar_t *MsGetExeDirNameW() +{ + return ms->ExeFileDirW; +} + +// Get the special directory name +char *MsGetSpecialDir(int id) +{ + LPITEMIDLIST t = NULL; + char tmp[MAX_PATH]; + + if (SHGetSpecialFolderLocation(NULL, id, &t) != S_OK) + { + return CopyStr(ms->ExeFileDir); + } + + if (SHGetPathFromIDList(t, tmp) == false) + { + return CopyStr(ms->ExeFileDir); + } + + Win32NukuEn(tmp, sizeof(tmp), tmp); + + return CopyStr(tmp); +} +wchar_t *MsGetSpecialDirW(int id) +{ + LPITEMIDLIST t = NULL; + wchar_t tmp[MAX_PATH]; + + if (IsNt() == false) + { + char *tmp = MsGetSpecialDir(id); + wchar_t *ret = CopyStrToUni(tmp); + + Free(tmp); + + return ret; + } + + if (SHGetSpecialFolderLocation(NULL, id, &t) != S_OK) + { + return UniCopyStr(ms->ExeFileDirW); + } + + if (SHGetPathFromIDListW(t, tmp) == false) + { + return UniCopyStr(ms->ExeFileDirW); + } + + Win32NukuEnW(tmp, sizeof(tmp), tmp); + + return UniCopyStr(tmp); +} + +// Get all the special directory +void MsGetSpecialDirs() +{ + char tmp[MAX_PATH]; + + // System32 + GetSystemDirectory(tmp, sizeof(tmp)); + Win32NukuEn(tmp, sizeof(tmp), tmp); + ms->System32Dir = CopyStr(tmp); + ms->System32DirW = CopyStrToUni(tmp); + + // The Windows directory is parent of the System32 directory + Win32GetDirFromPath(tmp, sizeof(tmp), tmp); + Win32NukuEn(tmp, sizeof(tmp), tmp); + ms->WindowsDir = CopyStr(tmp); + ms->WindowsDirW = CopyStrToUni(tmp); + + // Temp directory under the Windows directory + Format(tmp, sizeof(tmp), "%s\\Temp", ms->WindowsDir); + ms->WinTempDir = CopyStr(tmp); + ms->WinTempDirW = CopyStrToUni(tmp); + MsUniMakeDirEx(ms->WinTempDirW); + + // System drive + tmp[2] = 0; + ms->WindowsDrive = CopyStr(tmp); + ms->WindowsDriveW = CopyStrToUni(tmp); + + // Temp + GetTempPath(MAX_PATH, tmp); + Win32NukuEn(tmp, sizeof(tmp), tmp); + ms->TempDir = CopyStr(tmp); + + // Get the Temp (Unicode) + if (IsNt()) + { + wchar_t tmp_w[MAX_PATH]; + + GetTempPathW(MAX_PATH, tmp_w); + Win32NukuEnW(tmp_w, sizeof(tmp_w), tmp_w); + + ms->TempDirW = CopyUniStr(tmp_w); + } + else + { + ms->TempDirW = CopyStrToUni(tmp); + } + MakeDirExW(ms->TempDirW); + MakeDirEx(ms->TempDir); + + // Program Files + ms->ProgramFilesDir = MsGetSpecialDir(CSIDL_PROGRAM_FILES); + if (StrCmpi(ms->ProgramFilesDir, ms->ExeFileDir) == 0) + { + char tmp[MAX_PATH]; + Format(tmp, sizeof(tmp), "%s\\Program Files", ms->WindowsDrive); + + Free(ms->ProgramFilesDir); + ms->ProgramFilesDir = CopyStr(tmp); + } + + ms->ProgramFilesDirW = MsGetSpecialDirW(CSIDL_PROGRAM_FILES); + if (UniStrCmpi(ms->ProgramFilesDirW, ms->ExeFileDirW) == 0) + { + wchar_t tmp[MAX_PATH]; + UniFormat(tmp, sizeof(tmp), L"%s\\Program Files", ms->WindowsDriveW); + + Free(ms->ProgramFilesDirW); + ms->ProgramFilesDirW = UniCopyStr(tmp); + } + + // Program Files (x86) + ms->ProgramFilesDirX86 = MsGetSpecialDir(CSIDL_PROGRAM_FILESX86); + if (StrCmpi(ms->ProgramFilesDirX86, ms->ExeFileDir) == 0) + { + if (MsIs64BitWindows()) + { + char tmp[MAX_PATH]; + Format(tmp, sizeof(tmp), "%s\\Program Files (x86)", ms->WindowsDrive); + + Free(ms->ProgramFilesDirX86); + ms->ProgramFilesDirX86 = CopyStr(tmp); + } + else + { + Free(ms->ProgramFilesDirX86); + ms->ProgramFilesDirX86 = CopyStr(ms->ProgramFilesDir); + } + } + + ms->ProgramFilesDirX86W = MsGetSpecialDirW(CSIDL_PROGRAM_FILESX86); + if (UniStrCmpi(ms->ProgramFilesDirX86W, ms->ExeFileDirW) == 0) + { + if (MsIs64BitWindows()) + { + wchar_t tmp[MAX_PATH]; + UniFormat(tmp, sizeof(tmp), L"%s\\Program Files (x86)", ms->WindowsDriveW); + + Free(ms->ProgramFilesDirX86W); + ms->ProgramFilesDirX86W = UniCopyStr(tmp); + } + else + { + Free(ms->ProgramFilesDirX86W); + ms->ProgramFilesDirX86W = UniCopyStr(ms->ProgramFilesDirW); + } + } + + // Program Files (x64) + if (MsIs64BitWindows()) + { + if (Is64()) + { + ms->ProgramFilesDirX64 = CopyStr(ms->ProgramFilesDir); + ms->ProgramFilesDirX64W = CopyUniStr(ms->ProgramFilesDirW); + } + else + { + char tmpa[MAX_SIZE]; + wchar_t tmpw[MAX_SIZE]; + + ReplaceStrEx(tmpa, sizeof(tmpa), ms->ProgramFilesDir, "\\Program Files (x86)", "\\Program Files", false); + UniReplaceStrEx(tmpw, sizeof(tmpw), ms->ProgramFilesDirW, L"\\Program Files (x86)", L"\\Program Files", false); + + ms->ProgramFilesDirX64 = CopyStr(tmpa); + ms->ProgramFilesDirX64W = CopyUniStr(tmpw); + } + } + else + { + ms->ProgramFilesDirX64 = CopyStr(ms->ProgramFilesDir); + ms->ProgramFilesDirX64W = CopyUniStr(ms->ProgramFilesDirW); + } + + if (MsIsNt()) + { + // Common start menu + ms->CommonStartMenuDir = MsGetSpecialDir(CSIDL_COMMON_STARTMENU); + ms->CommonStartMenuDirW = MsGetSpecialDirW(CSIDL_COMMON_STARTMENU); + + // Common program + ms->CommonProgramsDir = MsGetSpecialDir(CSIDL_COMMON_PROGRAMS); + ms->CommonProgramsDirW = MsGetSpecialDirW(CSIDL_COMMON_PROGRAMS); + + // Common startup + ms->CommonStartupDir = MsGetSpecialDir(CSIDL_COMMON_STARTUP); + ms->CommonStartupDirW = MsGetSpecialDirW(CSIDL_COMMON_STARTUP); + + // Common application data + ms->CommonAppDataDir = MsGetSpecialDir(CSIDL_COMMON_APPDATA); + ms->CommonAppDataDirW = MsGetSpecialDirW(CSIDL_COMMON_APPDATA); + + // Common desktop + ms->CommonDesktopDir = MsGetSpecialDir(CSIDL_COMMON_DESKTOPDIRECTORY); + ms->CommonDesktopDirW = MsGetSpecialDirW(CSIDL_COMMON_DESKTOPDIRECTORY); + + // Local Settings + ms->LocalAppDataDir = MsGetSpecialDir(CSIDL_LOCAL_APPDATA); + ms->LocalAppDataDirW = MsGetSpecialDirW(CSIDL_LOCAL_APPDATA); + } + else + { + // Start menu of the individual + ms->PersonalStartMenuDir = MsGetSpecialDir(CSIDL_STARTMENU); + ms->CommonStartMenuDir = CopyStr(ms->PersonalStartMenuDir); + ms->PersonalStartMenuDirW = MsGetSpecialDirW(CSIDL_STARTMENU); + ms->CommonStartMenuDirW = CopyUniStr(ms->PersonalStartMenuDirW); + + // Program of the individual + ms->PersonalProgramsDir = MsGetSpecialDir(CSIDL_PROGRAMS); + ms->CommonProgramsDir = CopyStr(ms->PersonalProgramsDir); + ms->PersonalProgramsDirW = MsGetSpecialDirW(CSIDL_PROGRAMS); + ms->CommonProgramsDirW = CopyUniStr(ms->PersonalProgramsDirW); + + // Start-up of the individual + ms->PersonalStartupDir = MsGetSpecialDir(CSIDL_STARTUP); + ms->CommonStartupDir = CopyStr(ms->PersonalStartupDir); + ms->PersonalStartupDirW = MsGetSpecialDirW(CSIDL_STARTUP); + ms->CommonStartupDirW = CopyUniStr(ms->PersonalStartupDirW); + + // Application data of the individual + ms->PersonalAppDataDir = MsGetSpecialDir(CSIDL_APPDATA); + ms->CommonAppDataDir = CopyStr(ms->PersonalAppDataDir); + ms->PersonalAppDataDirW = MsGetSpecialDirW(CSIDL_APPDATA); + ms->CommonAppDataDirW = CopyUniStr(ms->PersonalAppDataDirW); + + // Desktops of the individual + ms->PersonalDesktopDir = MsGetSpecialDir(CSIDL_DESKTOP); + ms->CommonDesktopDir = CopyStr(ms->PersonalDesktopDir); + ms->PersonalDesktopDirW = MsGetSpecialDirW(CSIDL_DESKTOP); + ms->CommonDesktopDirW = CopyUniStr(ms->PersonalDesktopDirW); + + // Local Settings + ms->LocalAppDataDir = CopyStr(ms->PersonalAppDataDir); + ms->LocalAppDataDirW = CopyUniStr(ms->PersonalAppDataDirW); + } +} + +// Check whether the current user is a Administrators +bool MsCheckIsAdmin() +{ + UCHAR test_bit[32]; + UCHAR tmp[32]; + UCHAR exe_hash[SHA1_SIZE]; + char *name_tag = "Vpn_Check_Admin_Key_%u"; + DWORD type; + DWORD size; + char name[MAX_SIZE]; + + Sha1(exe_hash, MsGetExeFileNameW(), UniStrLen(MsGetExeFileNameW())); + + Format(name, sizeof(name), name_tag, *((UINT *)exe_hash)); + + Rand(test_bit, sizeof(test_bit)); + + if (RegSetValueEx(HKEY_LOCAL_MACHINE, name, 0, REG_BINARY, test_bit, sizeof(test_bit)) != ERROR_SUCCESS) + { + return false; + } + + size = sizeof(tmp); + if (RegQueryValueEx(HKEY_LOCAL_MACHINE, name, 0, &type, tmp, &size) != ERROR_SUCCESS) + { + RegDeleteValue(HKEY_LOCAL_MACHINE, name); + return false; + } + + RegDeleteValue(HKEY_LOCAL_MACHINE, name); + + if (Cmp(test_bit, tmp, 32) != 0) + { + return false; + } + + return true; +} + +// Library initialization +void MsInit() +{ + char *str_ansi; + wchar_t *str_unicode; + OSVERSIONINFO os; + char tmp[MAX_SIZE]; + UINT size; + if (ms != NULL) + { + // Already initialized + return; + } + + suspend_handler_singleton = NewCounter(); + vlan_card_counter = NewCounter(); + vlan_card_should_stop_flag = false; + + ms = ZeroMalloc(sizeof(MS)); + + // Getting instance handle + ms->hInst = GetModuleHandle(NULL); + + // Get the KERNEL32.DLL + ms->hKernel32 = LoadLibrary("kernel32.dll"); + + // Get a command line string from the OS + str_ansi = CopyStr(GetCommandLineA()); + Trim(str_ansi); + str_unicode = UniCopyStr(GetCommandLineW()); + UniTrim(str_unicode); + + SetCommandLineStr(MsCutExeNameFromCommandLine(str_ansi)); + SetCommandLineUniStr(MsCutExeNameFromUniCommandLine(str_unicode)); + + Free(str_unicode); + Free(str_ansi); + + // Get the version of the OS + Zero(&os, sizeof(os)); + os.dwOSVersionInfoSize = sizeof(os); + GetVersionEx(&os); + + if (os.dwPlatformId == VER_PLATFORM_WIN32_NT) + { + // NT series + ms->IsNt = true; + + ms->nt = MsLoadNtApiFunctions(); + + if (ms->nt == NULL) + { + ms->IsNt = false; + ms->IsAdmin = true; + } + else + { + // Whether I am an Administrators + ms->IsAdmin = MsCheckIsAdmin(); + } + } + else + { + // In 9x system: Impersonate a Administrators always + ms->IsAdmin = true; + } + + if (GetProcAddress(ms->hKernel32, "wine_get_unix_file_name") != NULL) + { + ms->IsWine = true; + } + + // Get information about the current process + ms->hCurrentProcess = GetCurrentProcess(); + ms->CurrentProcessId = GetCurrentProcessId(); + + // Get the EXE file name + GetModuleFileName(NULL, tmp, sizeof(tmp)); + ms->ExeFileName = CopyStr(tmp); + Win32GetDirFromPath(tmp, sizeof(tmp), tmp); + ms->ExeFileDir = CopyStr(tmp); + + // Get the EXE file name (Unicode) + if (IsNt()) + { + wchar_t tmp_w[MAX_PATH]; + + GetModuleFileNameW(NULL, tmp_w, sizeof(tmp_w)); + ms->ExeFileNameW = CopyUniStr(tmp_w); + + Win32GetDirFromPathW(tmp_w, sizeof(tmp_w), tmp_w); + ms->ExeFileDirW = CopyUniStr(tmp_w); + } + else + { + ms->ExeFileNameW = CopyStrToUni(ms->ExeFileName); + ms->ExeFileDirW = CopyStrToUni(ms->ExeFileDir); + } + + // Get the special directories + MsGetSpecialDirs(); + + // Initialize the temporary directory + MsInitTempDir(); + + // Get the user name + size = sizeof(tmp); + GetUserName(tmp, &size); + ms->UserName = CopyStr(tmp); + + // Get the user name (Unicode) + if (IsNt()) + { + wchar_t tmp_w[MAX_PATH]; + + size = sizeof(tmp_w); + + GetUserNameW(tmp_w, &size); + ms->UserNameW = CopyUniStr(tmp_w); + } + else + { + ms->UserNameW = CopyStrToUni(ms->UserName); + } + + // Get the full user name + if (ms->nt != NULL && ms->nt->GetUserNameExA != NULL) + { + wchar_t tmp_w[MAX_PATH]; + + size = sizeof(tmp); + if (ms->nt->GetUserNameExA(NameSamCompatible, tmp, &size)) + { + ms->UserNameEx = CopyStr(tmp); + } + + size = sizeof(tmp_w); + if (ms->nt->GetUserNameExW(NameSamCompatible, tmp_w, &size)) + { + ms->UserNameExW = CopyUniStr(tmp_w); + } + } + + if (ms->UserNameEx == NULL) + { + ms->UserNameEx = CopyStr(ms->UserName); + } + if (ms->UserNameExW == NULL) + { + ms->UserNameExW = CopyUniStr(ms->UserNameW); + } + + // Initialization of the adapter list + MsInitAdapterListModule(); + + // Initialization of minidump base file name + if (true) + { + wchar_t tmp[MAX_PATH]; + if (MsIsAdmin()) + { + CombinePathW(tmp, sizeof(tmp), ms->ExeFileDirW, L"vpn_debug\\dump"); + } + else + { + CombinePathW(tmp, sizeof(tmp), ms->TempDirW, L"vpn_debug\\dump"); + } + ms->MinidumpBaseFileNameW = CopyUniStr(tmp); + } + + MsSetEnableMinidump(true); + + if (MsIsNt()) + { + if (ms->nt->MiniDumpWriteDump != NULL) + { + SetUnhandledExceptionFilter(MsExceptionHandler); + } + } + + // Open a LSA handle + hLsa = NULL; + lsa_package_id = 0; + if (MsIsNt()) + { + MsEnablePrivilege(SE_TCB_NAME, true); + + if (ms->nt->AllocateLocallyUniqueId != NULL && + ms->nt->LsaConnectUntrusted != NULL && + ms->nt->LsaLookupAuthenticationPackage != NULL && + ms->nt->LsaLogonUser != NULL && + ms->nt->LsaDeregisterLogonProcess != NULL && + ms->nt->LsaFreeReturnBuffer != NULL) + { + HANDLE h = NULL; + NTSTATUS ret = ms->nt->LsaConnectUntrusted(&h); + + if (ret == 0) + { + LSA_STRING pkg_name; + ULONG ul = 0; + + Zero(&pkg_name, sizeof(pkg_name)); + pkg_name.Buffer = MSV1_0_PACKAGE_NAME; + pkg_name.Length = pkg_name.MaximumLength = StrLen(MSV1_0_PACKAGE_NAME); + + ret = ms->nt->LsaLookupAuthenticationPackage(h, &pkg_name, &ul); + + if (ret == 0) + { + Zero(&lsa_token_source, sizeof(lsa_token_source)); + + ms->nt->AllocateLocallyUniqueId(&lsa_token_source.SourceIdentifier); + Copy(lsa_token_source.SourceName, "SE-VPN ", 8); + + lsa_package_id = ul; + hLsa = h; + } + else + { + ms->nt->LsaDeregisterLogonProcess(h); + } + } + } + } + + // Read the msi.dll + if (hMsi == NULL) + { + hMsi = LoadLibrary("msi.dll"); + + if (hMsi != NULL) + { + _MsiConfigureProductW = + (UINT (__stdcall *)(LPCWSTR,int,INSTALLSTATE)) GetProcAddress(hMsi, "MsiConfigureProductW"); + _MsiGetProductInfoW = + (UINT (__stdcall *)(LPCWSTR,LPCWSTR,LPWSTR,LPDWORD)) GetProcAddress(hMsi, "MsiGetProductInfoW"); + _MsiSetInternalUI = + (INSTALLUILEVEL (__stdcall *)(INSTALLUILEVEL,HWND *)) GetProcAddress(hMsi, "MsiSetInternalUI"); + _MsiLocateComponentW = + (INSTALLSTATE (__stdcall *)(LPCWSTR,LPWSTR,LPDWORD)) GetProcAddress(hMsi, "MsiLocateComponentW"); + } + } + + // Lock created + vlan_lock = NewLock(); +} + +// Uninstall the MSI product +bool MsMsiUninstall(char *product_code, HWND hWnd, bool *reboot_required) +{ + wchar_t *product_code_w; + bool ret = false; + INSTALLUILEVEL old_level; + HWND old_hwnd; + UINT r; + // Validate arguments + if (product_code == NULL) + { + return false; + } + if (_MsiSetInternalUI == NULL || _MsiConfigureProductW == NULL) + { + return false; + } + + if (reboot_required != NULL) + { + *reboot_required = false; + } + + product_code_w = CopyStrToUni(product_code); + + old_hwnd = hWnd; + old_level = _MsiSetInternalUI(INSTALLUILEVEL_PROGRESSONLY, &old_hwnd); + + r = _MsiConfigureProductW(product_code_w, INSTALLLEVEL_DEFAULT, INSTALLSTATE_ABSENT); + + if (r == ERROR_SUCCESS || r == ERROR_SUCCESS_REBOOT_INITIATED || r == ERROR_SUCCESS_REBOOT_REQUIRED) + { + ret = true; + + if (r == ERROR_SUCCESS_REBOOT_INITIATED || r == ERROR_SUCCESS_REBOOT_REQUIRED) + { + if (reboot_required != NULL) + { + *reboot_required = true; + } + } + } + + if (old_level != INSTALLUILEVEL_NOCHANGE) + { + _MsiSetInternalUI(old_level, &old_hwnd); + } + + Free(product_code_w); + + return ret; +} + +// Get the installation directory of the MSI component +bool MsGetMsiInstalledDir(char *component_code, wchar_t *dir, UINT dir_size) +{ + wchar_t *component_code_w; + bool ret = false; + wchar_t tmp[MAX_SIZE]; + UINT sz = sizeof(tmp) / sizeof(wchar_t); + // Validate arguments + if (component_code == NULL || dir == NULL) + { + return false; + } + if (_MsiGetProductInfoW == NULL) + { + return false; + } + + component_code_w = CopyStrToUni(component_code); + + Zero(tmp, sizeof(tmp)); + + if (_MsiLocateComponentW(component_code_w, tmp, &sz) == INSTALLSTATE_LOCAL) + { + if (UniIsEmptyStr(tmp) == false) + { + GetDirNameFromFilePathW(dir, dir_size, tmp); + ret = true; + } + } + + Free(component_code_w); + + return ret; +} + +// Determine whether minidump is enabled +bool MsIsMinidumpEnabled() +{ + return ms->MiniDumpEnabled; +} + +// Determine whether to create a minidump +void MsSetEnableMinidump(bool enabled) +{ + ms->MiniDumpEnabled = enabled; +} + +// Output the minidump +void MsWriteMinidump(wchar_t *filename, void *ex) +{ + wchar_t tmp[MAX_PATH]; + wchar_t dir[MAX_PATH]; + HANDLE h; + MINIDUMP_EXCEPTION_INFORMATION info; + struct _EXCEPTION_POINTERS *exp = (struct _EXCEPTION_POINTERS *)ex; + + if (filename != NULL) + { + UniStrCpy(tmp, sizeof(tmp), filename); + } + else + { + SYSTEMTIME tm; + + Zero(&tm, sizeof(tm)); + GetLocalTime(&tm); + + UniFormat(tmp, sizeof(tmp), L"%s_%04u%02u%02u_%02u%02u%02u.dmp", + ms->MinidumpBaseFileNameW, + tm.wYear, tm.wMonth, tm.wDay, tm.wHour, tm.wMinute, tm.wSecond); + } + + GetDirNameFromFilePathW(dir, sizeof(dir), tmp); + + CreateDirectoryW(dir, NULL); + + Zero(&info, sizeof(info)); + + if (exp != NULL) + { + info.ThreadId = GetCurrentThreadId(); + info.ExceptionPointers = exp; + info.ClientPointers = true; + } + + h = CreateFileW(tmp, GENERIC_READ | GENERIC_WRITE, + FILE_SHARE_READ, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, + NULL); + if (h != INVALID_HANDLE_VALUE) + { + ms->nt->MiniDumpWriteDump(ms->hCurrentProcess, ms->CurrentProcessId, + h, + MiniDumpNormal | MiniDumpWithFullMemory | MiniDumpWithDataSegs | + MiniDumpWithHandleData + , + info.ThreadId == 0 ? NULL : &info, NULL, NULL); + + FlushFileBuffers(h); + CloseHandle(h); + } +} + +// Exception handler +LONG CALLBACK MsExceptionHandler(struct _EXCEPTION_POINTERS *ExceptionInfo) +{ + if (ms->MiniDumpEnabled) + { + MsWriteMinidump(NULL, ExceptionInfo); + } + + return EXCEPTION_CONTINUE_SEARCH; +} + +// Release of the library +void MsFree() +{ + if (ms == NULL) + { + // Uninitialized + return; + } + + // Release the LSA + if (hLsa != NULL) + { + ms->nt->LsaDeregisterLogonProcess(hLsa); + + hLsa = NULL; + } + + // Release of the adapter list + MsFreeAdapterListModule(); + + // Release of the temporary directory + MsFreeTempDir(); + + if (ms->IsNt) + { + // Release of NT series API + MsFreeNtApiFunctions(ms->nt); + } + + // Memory release + // ANSI + Free(ms->WindowsDir); + Free(ms->System32Dir); + Free(ms->TempDir); + Free(ms->WinTempDir); + Free(ms->WindowsDrive); + Free(ms->ProgramFilesDir); + Free(ms->CommonStartMenuDir); + Free(ms->CommonProgramsDir); + Free(ms->CommonStartupDir); + Free(ms->CommonAppDataDir); + Free(ms->CommonDesktopDir); + Free(ms->PersonalStartMenuDir); + Free(ms->PersonalProgramsDir); + Free(ms->PersonalStartupDir); + Free(ms->PersonalAppDataDir); + Free(ms->PersonalDesktopDir); + Free(ms->MyDocumentsDir); + Free(ms->ExeFileDir); + Free(ms->ExeFileName); + Free(ms->UserName); + Free(ms->UserNameEx); + Free(ms->LocalAppDataDir); + Free(ms->ProgramFilesDirX86); + Free(ms->ProgramFilesDirX64); + // Unicode + Free(ms->WindowsDirW); + Free(ms->System32DirW); + Free(ms->TempDirW); + Free(ms->WinTempDirW); + Free(ms->WindowsDriveW); + Free(ms->ProgramFilesDirW); + Free(ms->CommonStartMenuDirW); + Free(ms->CommonProgramsDirW); + Free(ms->CommonStartupDirW); + Free(ms->CommonAppDataDirW); + Free(ms->CommonDesktopDirW); + Free(ms->PersonalStartMenuDirW); + Free(ms->PersonalProgramsDirW); + Free(ms->PersonalStartupDirW); + Free(ms->PersonalAppDataDirW); + Free(ms->PersonalDesktopDirW); + Free(ms->MyDocumentsDirW); + Free(ms->ExeFileDirW); + Free(ms->ExeFileNameW); + Free(ms->UserNameW); + Free(ms->UserNameExW); + Free(ms->LocalAppDataDirW); + Free(ms->MinidumpBaseFileNameW); + Free(ms->ProgramFilesDirX86W); + Free(ms->ProgramFilesDirX64W); + + Free(ms); + ms = NULL; + + // Delete the lock + DeleteLock(vlan_lock); + vlan_lock = NULL; + + DeleteCounter(suspend_handler_singleton); + suspend_handler_singleton = NULL; + + DeleteCounter(vlan_card_counter); + vlan_card_counter = NULL; + vlan_card_should_stop_flag = false; +} + +// Directory acquisition related +char *MsGetWindowsDir() +{ + return ms->WindowsDir; +} +wchar_t *MsGetWindowsDirW() +{ + return ms->WindowsDirW; +} +char *MsGetSystem32Dir() +{ + return ms->System32Dir; +} +char *MsGetTempDir() +{ + return ms->TempDir; +} +char *MsGetProgramFilesDir() +{ + return ms->ProgramFilesDir; +} +char *MsGetCommonStartupDir() +{ + return ms->CommonStartupDir; +} +char *MsGetMyTempDir() +{ + return ms->MyTempDir; +} + +wchar_t *MsGetExeFileNameW() +{ + return ms == NULL ? L"Unknown" : ms->ExeFileNameW; +} +wchar_t *MsGetExeFileDirW() +{ + return ms->ExeFileDirW; +} +wchar_t *MsGetSystem32DirW() +{ + return ms->System32DirW; +} +wchar_t *MsGetTempDirW() +{ + return ms->TempDirW; +} +wchar_t *MsGetCommonStartMenuDirW() +{ + return ms->CommonStartMenuDirW; +} +wchar_t *MsGetCommonProgramsDirW() +{ + return ms->CommonProgramsDirW; +} +wchar_t *MsGetProgramFilesDirX64W() +{ + return ms->ProgramFilesDirX64W; +} +wchar_t *MsGetCommonStartupDirW() +{ + return ms->CommonStartupDirW; +} +wchar_t *MsGetCommonDesktopDirW() +{ + return ms->CommonDesktopDirW; +} +wchar_t *MsGetPersonalStartMenuDirW() +{ + if (ms->PersonalStartMenuDirW == NULL) + { + ms->PersonalStartMenuDirW = MsGetSpecialDirW(CSIDL_STARTMENU); + } + + return ms->PersonalStartMenuDirW; +} +wchar_t *MsGetPersonalProgramsDirW() +{ + if (ms->PersonalProgramsDirW == NULL) + { + ms->PersonalProgramsDirW = MsGetSpecialDirW(CSIDL_PROGRAMS); + } + + return ms->PersonalProgramsDirW; +} +wchar_t *MsGetPersonalStartupDirW() +{ + if (ms->PersonalStartupDirW == NULL) + { + ms->PersonalStartupDirW = MsGetSpecialDirW(CSIDL_STARTUP); + } + + return ms->PersonalStartupDirW; +} +wchar_t *MsGetPersonalAppDataDirW() +{ + if (ms->PersonalAppDataDirW == NULL) + { + ms->PersonalAppDataDirW = MsGetSpecialDirW(CSIDL_APPDATA); + } + + return ms->PersonalAppDataDirW; +} +wchar_t *MsGetPersonalDesktopDirW() +{ + if (ms->PersonalDesktopDirW == NULL) + { + ms->PersonalDesktopDirW = MsGetSpecialDirW(CSIDL_DESKTOP); + } + + return ms->PersonalDesktopDirW; +} +wchar_t *MsGetMyTempDirW() +{ + return ms->MyTempDirW; +} +wchar_t *MsGetUserNameW() +{ + return ms->UserNameW; +} + +#endif // WIN32 + diff --git a/src/Mayaqua/Microsoft.h b/src/Mayaqua/Microsoft.h index 29512a4f..b0c4ae71 100644 --- a/src/Mayaqua/Microsoft.h +++ b/src/Mayaqua/Microsoft.h @@ -1,980 +1,980 @@ -// SoftEther VPN Source Code - Developer Edition Master Branch -// Mayaqua Kernel - - -// Microsoft.h -// Header of Microsoft.c - -#ifdef OS_WIN32 - -// Make available the types for Windows even if windows.h is not included -#ifndef _WINDEF_ - -typedef void *HWND; - -#endif // _WINDEF_ - -#ifndef MICROSOFT_H -#define MICROSOFT_H - - -// Constant for Event log -#define MS_EVENTLOG_TYPE_INFORMATION 0 -#define MS_EVENTLOG_TYPE_WARNING 1 -#define MS_EVENTLOG_TYPE_ERROR 2 - -#define MS_RC_EVENTLOG_TYPE_INFORMATION 0x40000001L -#define MS_RC_EVENTLOG_TYPE_WARNING 0x80000002L -#define MS_RC_EVENTLOG_TYPE_ERROR 0xC0000003L - - -// TCP/IP registry value -#define TCP_MAX_NUM_CONNECTIONS 16777214 - -#define DEFAULT_TCP_MAX_WINDOW_SIZE_RECV 5955584 -#define DEFAULT_TCP_MAX_WINDOW_SIZE_SEND 131072 -#define DEFAULT_TCP_MAX_NUM_CONNECTIONS 16777214 - -// Constant -#define SVC_ARG_INSTALL "/install" -#define SVC_ARG_UNINSTALL "/uninstall" -#define SVC_ARG_START "/start" -#define SVC_ARG_STOP "/stop" -#define SVC_ARG_TEST "/test" -#define SVC_ARG_USERMODE "/usermode" -#define SVC_ARG_USERMODE_SHOWTRAY "/usermode_showtray" -#define SVC_ARG_USERMODE_HIDETRAY "/usermode_hidetray" -#define SVC_ARG_SERVICE "/service" -#define SVC_ARG_SETUP_INSTALL "/setup_install" -#define SVC_ARG_SETUP_UNINSTALL "/setup_uninstall" -#define SVC_ARG_WIN9X_SERVICE "/win9x_service" -#define SVC_ARG_WIN9X_INSTALL "/win9x_install" -#define SVC_ARG_WIN9X_UNINSTALL "/win9x_uninstall" -#define SVC_ARG_TCP "/tcp" -#define SVC_ARG_TCP_UAC "/tcp_uac" -#define SVC_ARG_TCP_UAC_W L"/tcp_uac" -#define SVC_ARG_TCP_SETUP "/tcpsetup" -#define SVC_ARG_TRAFFIC "/traffic" -#define SVC_ARG_UIHELP "/uihelp" -#define SVC_ARG_UIHELP_W L"/uihelp" -#define SVC_ARG_SILENT "/silent" - -// Time to suicide, if the service freezed -#define SVC_SELFKILL_TIMEOUT (5 * 60 * 1000) - -// The name of the device driver of the virtual LAN card for Win32 (first part) -#define VLAN_ADAPTER_NAME "VPN Client Adapter" -#define VLAN_ADAPTER_NAME_OLD "SoftEther VPN Client 2.0 Adapter" - -// The name of the device driver of the virtual LAN card for Win32 (full name) -#define VLAN_ADAPTER_NAME_TAG "VPN Client Adapter - %s" -#define VLAN_ADAPTER_NAME_TAG_OLD "SoftEther VPN Client 2.0 Adapter - %s" - -// Display name of Virtual LAN card in the [Network Connections] in Win32 (full name) -#define VLAN_CONNECTION_NAME "%s - VPN Client" -#define VLAN_CONNECTION_NAME_OLD "%s - SoftEther VPN Client 2.0" - - -// Suspend handler windows class name -#define MS_SUSPEND_HANDLER_WNDCLASSNAME "MS_SUSPEND_HANDLER" - -// Command line format in the service mode -#define SVC_RUN_COMMANDLINE L"\"%s\" /service" - -// Mode value -#define SVC_MODE_NONE 0 -#define SVC_MODE_INSTALL 1 -#define SVC_MODE_UNINSTALL 2 -#define SVC_MODE_START 3 -#define SVC_MODE_STOP 4 -#define SVC_MODE_TEST 5 -#define SVC_MODE_USERMODE 6 -#define SVC_MODE_SERVICE 7 -#define SVC_MODE_SETUP_INSTALL 8 -#define SVC_MODE_SETUP_UNINSTALL 9 -#define SVC_MODE_WIN9X_SERVICE 10 -#define SVC_MODE_WIN9X_INSTALL 11 -#define SVC_MODE_WIN9X_UNINSTALL 12 -#define SVC_MODE_TCP 13 -#define SVC_MODE_TCPSETUP 14 -#define SVC_MODE_TRAFFIC 15 -#define SVC_MODE_UIHELP 16 -#define SVC_MODE_TCP_UAC 17 - - -#define WIN9X_SVC_REGKEY_1 "Software\\Microsoft\\Windows\\CurrentVersion\\RunServices" -#define WIN9X_SVC_REGKEY_2 "Software\\Microsoft\\Windows\\CurrentVersion\\Run" - -#define VISTA_MMCSS_KEYNAME "SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Multimedia\\SystemProfile\\Tasks" -#define VISTA_MMCSS_FILENAME "mmcss_backup.dat" - -#define SVC_NAME "SVC_%s_NAME" -#define SVC_TITLE "SVC_%s_TITLE" -#define SVC_DESCRIPT "SVC_%s_DESCRIPT" - -#define SVC_USERMODE_SETTING_KEY "Software\\" GC_REG_COMPANY_NAME "\\PacketiX VPN\\UserMode Settings" -#define SVC_HIDETRAY_REG_VALUE "HideTray_%S" - -#define SVC_CALLING_SM_PROCESS_ID_KEY "Software\\" GC_REG_COMPANY_NAME "\\PacketiX VPN\\Service Control\\%s" -#define SVC_CALLING_SM_PROCESS_ID_VALUE "ProcessId" - -#define SOFTETHER_FW_SCRIPT_HASH "Software\\" GC_REG_COMPANY_NAME "\\PacketiX VPN\\FW ScriptHash" - -#define MMCSS_PROFILE_KEYNAME "SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Multimedia\\SystemProfile" - -// Other constants -#define MS_REG_TCP_SETTING_KEY "Software\\" GC_REG_COMPANY_NAME "\\Network Settings" - - - -// Constants about driver -#define DRIVER_INSTALL_SYS_NAME_TAG_NEW "Neo_%04u.sys" -#define DRIVER_INSTALL_SYS_NAME_TAG_MAXID 128 // Maximum number of install - - -// Vista driver installer related -#define VISTA_DRIVER_INSTALLER_SRC L"|vpndrvinst.exe" -#define VISTA_DRIVER_INSTALLER_DST L"%s\\vpndrvinst.exe" - -#define DRIVER_DEVICE_ID_TAG "NeoAdapter_%s" - - -#if (defined(MICROSOFT_C) || defined(NETWORK_C)) && (defined(OS_WIN32)) - -typedef enum __TCP_TABLE_CLASS { - _TCP_TABLE_BASIC_LISTENER, - _TCP_TABLE_BASIC_CONNECTIONS, - _TCP_TABLE_BASIC_ALL, - _TCP_TABLE_OWNER_PID_LISTENER, - _TCP_TABLE_OWNER_PID_CONNECTIONS, - _TCP_TABLE_OWNER_PID_ALL, - _TCP_TABLE_OWNER_MODULE_LISTENER, - _TCP_TABLE_OWNER_MODULE_CONNECTIONS, - _TCP_TABLE_OWNER_MODULE_ALL -} _TCP_TABLE_CLASS, *_PTCP_TABLE_CLASS; - -// A pointer to the network related Win32 API function -typedef struct NETWORK_WIN32_FUNCTIONS -{ - HINSTANCE hIpHlpApi32; - HINSTANCE hIcmp; - UINT (WINAPI *DeleteIpForwardEntry)(PMIB_IPFORWARDROW); - UINT (WINAPI *CreateIpForwardEntry)(PMIB_IPFORWARDROW); - UINT (WINAPI *GetIpForwardTable)(PMIB_IPFORWARDTABLE, PULONG, BOOL); - UINT (WINAPI *GetNetworkParams)(PFIXED_INFO, PULONG); - ULONG (WINAPI *GetAdaptersAddresses)(ULONG, ULONG, PVOID, PIP_ADAPTER_ADDRESSES, PULONG); - UINT (WINAPI *GetIfTable)(PMIB_IFTABLE, PULONG, BOOL); - UINT (WINAPI *GetIfTable2)(void **); - void (WINAPI *FreeMibTable)(PVOID); - UINT (WINAPI *IpRenewAddress)(PIP_ADAPTER_INDEX_MAP); - UINT (WINAPI *IpReleaseAddress)(PIP_ADAPTER_INDEX_MAP); - UINT (WINAPI *GetInterfaceInfo)(PIP_INTERFACE_INFO, PULONG); - UINT (WINAPI *GetAdaptersInfo)(PIP_ADAPTER_INFO, PULONG); - UINT (WINAPI *GetExtendedTcpTable)(PVOID, PUINT, BOOL, ULONG, _TCP_TABLE_CLASS, ULONG); - UINT (WINAPI *AllocateAndGetTcpExTableFromStack)(PVOID *, BOOL, HANDLE, UINT, UINT); - UINT (WINAPI *GetTcpTable)(PMIB_TCPTABLE, PUINT, BOOL); - UINT (WINAPI *NotifyRouteChange)(PHANDLE, LPOVERLAPPED); - BOOL (WINAPI *CancelIPChangeNotify)(LPOVERLAPPED); - UINT (WINAPI *NhpAllocateAndGetInterfaceInfoFromStack)(IP_INTERFACE_NAME_INFO **, - PUINT, BOOL, HANDLE, UINT); - HANDLE (WINAPI *IcmpCreateFile)(); - BOOL (WINAPI *IcmpCloseHandle)(HANDLE); - UINT (WINAPI *IcmpSendEcho)(HANDLE, IPAddr, LPVOID, WORD, PIP_OPTION_INFORMATION, - LPVOID, UINT, UINT); -} NETWORK_WIN32_FUNCTIONS; -#endif - - -#ifdef MICROSOFT_C -// WCM related code on Windows 8 -typedef enum _MS_WCM_PROPERTY -{ - ms_wcm_global_property_domain_policy, - ms_wcm_global_property_minimize_policy, - ms_wcm_global_property_roaming_policy, - ms_wcm_global_property_powermanagement_policy, - ms_wcm_intf_property_connection_cost, //used to set/get cost level and flags for the connection - ms_wcm_intf_property_dataplan_status, //used by MNO to indicate plan data associated with new cost - ms_wcm_intf_property_hotspot_profile, //used to store hotspot profile (WISPr credentials) -} MS_WCM_PROPERTY, *MS_PWCM_PROPERTY; - -typedef struct _MS_WCM_POLICY_VALUE { - BOOL fValue; - BOOL fIsGroupPolicy; -} MS_WCM_POLICY_VALUE, *MS_PWCM_POLICY_VALUE; - -#define MS_WCM_MAX_PROFILE_NAME 256 - -typedef enum _MS_WCM_MEDIA_TYPE -{ - ms_wcm_media_unknown, - ms_wcm_media_ethernet, - ms_wcm_media_wlan, - ms_wcm_media_mbn, - ms_wcm_media_invalid, - ms_wcm_media_max -} MS_WCM_MEDIA_TYPE, *MS_PWCM_MEDIA_TYPE; - -typedef struct _MS_WCM_PROFILE_INFO { - WCHAR strProfileName[MS_WCM_MAX_PROFILE_NAME]; - GUID AdapterGUID; - MS_WCM_MEDIA_TYPE Media; -} MS_WCM_PROFILE_INFO, *MS_PWCM_PROFILE_INFO; - -typedef struct _MS_WCM_PROFILE_INFO_LIST { - UINT dwNumberOfItems; - - MS_WCM_PROFILE_INFO ProfileInfo[1]; - -} MS_WCM_PROFILE_INFO_LIST, *MS_PWCM_PROFILE_INFO_LIST; - - -// Internal structure -typedef struct MS -{ - HINSTANCE hInst; - HINSTANCE hKernel32; - bool IsNt; - bool IsAdmin; - struct NT_API *nt; - HANDLE hCurrentProcess; - UINT CurrentProcessId; - bool MiniDumpEnabled; - char *ExeFileName; - char *ExeFileDir; - char *WindowsDir; - char *System32Dir; - char *TempDir; - char *WinTempDir; - char *WindowsDrive; - char *ProgramFilesDir; - char *ProgramFilesDirX86; - char *ProgramFilesDirX64; - char *CommonStartMenuDir; - char *CommonProgramsDir; - char *CommonStartupDir; - char *CommonAppDataDir; - char *CommonDesktopDir; - char *PersonalStartMenuDir; - char *PersonalProgramsDir; - char *PersonalStartupDir; - char *PersonalAppDataDir; - char *PersonalDesktopDir; - char *MyDocumentsDir; - char *LocalAppDataDir; - char *MyTempDir; - char *UserName; - char *UserNameEx; - wchar_t *ExeFileNameW; - wchar_t *ExeFileDirW; - wchar_t *WindowsDirW; - wchar_t *System32DirW; - wchar_t *TempDirW; - wchar_t *WinTempDirW; - wchar_t *WindowsDriveW; - wchar_t *ProgramFilesDirW; - wchar_t *ProgramFilesDirX86W; - wchar_t *ProgramFilesDirX64W; - wchar_t *CommonStartMenuDirW; - wchar_t *CommonProgramsDirW; - wchar_t *CommonStartupDirW; - wchar_t *CommonAppDataDirW; - wchar_t *CommonDesktopDirW; - wchar_t *PersonalStartMenuDirW; - wchar_t *PersonalProgramsDirW; - wchar_t *PersonalStartupDirW; - wchar_t *PersonalAppDataDirW; - wchar_t *PersonalDesktopDirW; - wchar_t *MyDocumentsDirW; - wchar_t *LocalAppDataDirW; - wchar_t *MyTempDirW; - wchar_t *UserNameW; - wchar_t *UserNameExW; - wchar_t *MinidumpBaseFileNameW; - IO *LockFile; - bool IsWine; -} MS; - -// For Windows NT API -typedef struct NT_API -{ - HINSTANCE hAdvapi32; - HINSTANCE hShell32; - HINSTANCE hNewDev; - HINSTANCE hSetupApi; - HINSTANCE hWtsApi32; - HINSTANCE hPsApi; - HINSTANCE hKernel32; - HINSTANCE hSecur32; - HINSTANCE hUser32; - HINSTANCE hDbgHelp; - HINSTANCE hWcmapi; - HINSTANCE hDwmapi; - BOOL (WINAPI *OpenProcessToken)(HANDLE, UINT, PHANDLE); - BOOL (WINAPI *LookupPrivilegeValue)(char *, char *, PLUID); - BOOL (WINAPI *AdjustTokenPrivileges)(HANDLE, BOOL, PTOKEN_PRIVILEGES, UINT, PTOKEN_PRIVILEGES, PUINT); - BOOL (WINAPI *InitiateSystemShutdown)(LPTSTR, LPTSTR, UINT, BOOL, BOOL); - BOOL (WINAPI *LogonUserW)(wchar_t *, wchar_t *, wchar_t *, UINT, UINT, HANDLE *); - BOOL (WINAPI *LogonUserA)(char *, char *, char *, UINT, UINT, HANDLE *); - BOOL (WINAPI *UpdateDriverForPlugAndPlayDevicesW)(HWND hWnd, wchar_t *hardware_id, wchar_t *inf_path, UINT flag, BOOL *need_reboot); - UINT (WINAPI *CM_Get_DevNode_Status_Ex)(UINT *, UINT *, UINT, UINT, HANDLE); - UINT (WINAPI *CM_Get_Device_ID_ExA)(UINT, char *, UINT, UINT, HANDLE); - UINT (WINAPI *WTSQuerySessionInformation)(HANDLE, UINT, WTS_INFO_CLASS, wchar_t *, UINT *); - void (WINAPI *WTSFreeMemory)(void *); - BOOL (WINAPI *WTSDisconnectSession)(HANDLE, UINT, BOOL); - BOOL (WINAPI *WTSEnumerateSessions)(HANDLE, UINT, UINT, PWTS_SESSION_INFO *, UINT *); - BOOL (WINAPI *WTSRegisterSessionNotification)(HWND, UINT); - BOOL (WINAPI *WTSUnRegisterSessionNotification)(HWND); - SC_HANDLE (WINAPI *OpenSCManager)(LPCTSTR, LPCTSTR, UINT); - SC_HANDLE (WINAPI *CreateServiceA)(SC_HANDLE, LPCTSTR, LPCTSTR, UINT, UINT, UINT, UINT, LPCTSTR, LPCTSTR, LPUINT, LPCTSTR, LPCTSTR, LPCTSTR); - SC_HANDLE (WINAPI *CreateServiceW)(SC_HANDLE, LPCWSTR, LPCWSTR, UINT, UINT, UINT, UINT, LPCWSTR, LPCWSTR, LPUINT, LPCWSTR, LPCWSTR, LPCWSTR); - BOOL (WINAPI *ChangeServiceConfig2)(SC_HANDLE, UINT, LPVOID); - BOOL (WINAPI *CloseServiceHandle)(SC_HANDLE); - SC_HANDLE (WINAPI *OpenService)(SC_HANDLE, LPCTSTR, UINT); - BOOL (WINAPI *QueryServiceStatus)(SC_HANDLE, LPSERVICE_STATUS); - BOOL (WINAPI *StartService)(SC_HANDLE, UINT, LPCTSTR); - BOOL (WINAPI *ControlService)(SC_HANDLE, UINT, LPSERVICE_STATUS); - BOOL (WINAPI *SetServiceStatus)(SERVICE_STATUS_HANDLE, LPSERVICE_STATUS); - SERVICE_STATUS_HANDLE (WINAPI *RegisterServiceCtrlHandler)(LPCTSTR, LPHANDLER_FUNCTION); - BOOL (WINAPI *StartServiceCtrlDispatcher)(CONST LPSERVICE_TABLE_ENTRY); - BOOL (WINAPI *DeleteService)(SC_HANDLE); - BOOL (WINAPI *EnumProcesses)(UINT *, UINT, UINT *); - BOOL (WINAPI *EnumProcessModules)(HANDLE, HMODULE *, UINT, UINT *); - UINT (WINAPI *GetModuleFileNameExA)(HANDLE, HMODULE, LPSTR, UINT); - UINT (WINAPI *GetModuleFileNameExW)(HANDLE, HMODULE, LPWSTR, UINT); - UINT (WINAPI *GetProcessImageFileNameA)(HANDLE, LPSTR, UINT); - UINT (WINAPI *GetProcessImageFileNameW)(HANDLE, LPWSTR, UINT); - BOOL (WINAPI *QueryFullProcessImageNameA)(HANDLE, UINT, LPSTR, PUINT); - BOOL (WINAPI *QueryFullProcessImageNameW)(HANDLE, UINT, LPWSTR, PUINT); - LONG (WINAPI *RegDeleteKeyExA)(HKEY, LPCTSTR, REGSAM, UINT); - BOOL (WINAPI *IsWow64Process)(HANDLE, BOOL *); - void (WINAPI *GetNativeSystemInfo)(SYSTEM_INFO *); - BOOL (WINAPI *DuplicateTokenEx)(HANDLE, UINT, SECURITY_ATTRIBUTES *, SECURITY_IMPERSONATION_LEVEL, TOKEN_TYPE, HANDLE *); - BOOL (WINAPI *ConvertStringSidToSidA)(LPCSTR, PSID *); - BOOL (WINAPI *SetTokenInformation)(HANDLE, TOKEN_INFORMATION_CLASS, void *, UINT); - BOOL (WINAPI *GetTokenInformation)(HANDLE, TOKEN_INFORMATION_CLASS, void *, UINT, PUINT); - BOOL (WINAPI *CreateProcessAsUserA)(HANDLE, LPCSTR, LPSTR, LPSECURITY_ATTRIBUTES, LPSECURITY_ATTRIBUTES, BOOL, UINT, void *, LPCSTR, LPSTARTUPINFOA, LPPROCESS_INFORMATION); - BOOL (WINAPI *CreateProcessAsUserW)(HANDLE, LPCWSTR, LPWSTR, LPSECURITY_ATTRIBUTES, LPSECURITY_ATTRIBUTES, BOOL, UINT, void *, LPCWSTR, LPSTARTUPINFOW, LPPROCESS_INFORMATION); - BOOL (WINAPI *LookupAccountSidA)(LPCSTR,PSID,LPSTR,LPUINT,LPSTR,LPUINT,PSID_NAME_USE); - BOOL (WINAPI *LookupAccountNameA)(LPCSTR,LPCSTR,PSID,LPUINT,LPSTR,LPUINT,PSID_NAME_USE); - BOOL (WINAPI *GetUserNameExA)(EXTENDED_NAME_FORMAT, LPSTR, PULONG); - BOOL (WINAPI *GetUserNameExW)(EXTENDED_NAME_FORMAT, LPWSTR, PULONG); - BOOL (WINAPI *SwitchDesktop)(HDESK); - HDESK (WINAPI *OpenDesktopA)(LPTSTR, UINT, BOOL, ACCESS_MASK); - BOOL (WINAPI *CloseDesktop)(HDESK); - BOOL (WINAPI *SetProcessShutdownParameters)(UINT, UINT); - HANDLE (WINAPI *RegisterEventSourceW)(LPCWSTR, LPCWSTR); - BOOL (WINAPI *ReportEventW)(HANDLE, WORD, WORD, UINT, PSID, WORD, UINT, LPCWSTR *, LPVOID); - BOOL (WINAPI *DeregisterEventSource)(HANDLE); - BOOL (WINAPI *Wow64DisableWow64FsRedirection)(void **); - BOOLEAN (WINAPI *Wow64EnableWow64FsRedirection)(BOOLEAN); - BOOL (WINAPI *Wow64RevertWow64FsRedirection)(void *); - BOOL (WINAPI *GetFileInformationByHandle)(HANDLE, LPBY_HANDLE_FILE_INFORMATION); - HANDLE (WINAPI *GetProcessHeap)(); - BOOL (WINAPI *MiniDumpWriteDump)(HANDLE, UINT, HANDLE, MINIDUMP_TYPE, - PMINIDUMP_EXCEPTION_INFORMATION, PMINIDUMP_USER_STREAM_INFORMATION, - PMINIDUMP_CALLBACK_INFORMATION); - BOOL (WINAPI *AllocateLocallyUniqueId)(PLUID); - NTSTATUS (NTAPI *LsaConnectUntrusted)(PHANDLE); - NTSTATUS (NTAPI *LsaLookupAuthenticationPackage)(HANDLE, PLSA_STRING, PULONG); - NTSTATUS (NTAPI *LsaLogonUser)(HANDLE, PLSA_STRING, SECURITY_LOGON_TYPE, ULONG, - PVOID, ULONG, PTOKEN_GROUPS, PTOKEN_SOURCE, PVOID, PULONG, PLUID, PHANDLE, - PQUOTA_LIMITS, PNTSTATUS); - NTSTATUS (NTAPI *LsaDeregisterLogonProcess)(HANDLE); - NTSTATUS (NTAPI *LsaFreeReturnBuffer)(PVOID); - UINT (WINAPI *WcmQueryProperty)(const GUID *, LPCWSTR, MS_WCM_PROPERTY, PVOID, PUINT, PBYTE *); - UINT (WINAPI *WcmSetProperty)(const GUID *, LPCWSTR, MS_WCM_PROPERTY, PVOID, UINT, const BYTE *); - void (WINAPI *WcmFreeMemory)(PVOID); - UINT (WINAPI *WcmGetProfileList)(PVOID, MS_WCM_PROFILE_INFO_LIST **ppProfileList); - UINT (WINAPI *SetNamedSecurityInfoW)(LPWSTR, UINT, SECURITY_INFORMATION, PSID, PSID, PACL, PACL); - BOOL (WINAPI *AddAccessAllowedAceEx)(PACL, UINT, UINT, UINT, PSID); - HRESULT (WINAPI *DwmIsCompositionEnabled)(BOOL *); - BOOL (WINAPI *GetComputerNameExW)(COMPUTER_NAME_FORMAT, LPWSTR, LPUINT); - LONG (WINAPI *RegLoadKeyW)(HKEY, LPCWSTR, LPCWSTR); - LONG (WINAPI *RegUnLoadKeyW)(HKEY, LPCWSTR); -} NT_API; - -typedef struct MS_EVENTLOG -{ - HANDLE hEventLog; -} MS_EVENTLOG; - -extern NETWORK_WIN32_FUNCTIONS *w32net; - -typedef struct MS_USERMODE_SVC_PULSE_THREAD_PARAM -{ - void *hWnd; - void *GlobalPulse; - volatile bool Halt; -} MS_USERMODE_SVC_PULSE_THREAD_PARAM; - -#endif // MICROSOFT_C - -// Structure to suppress the warning message -typedef struct NO_WARNING -{ - UINT ThreadId; - THREAD *NoWarningThread; - EVENT *HaltEvent; - volatile bool Halt; - wchar_t *SoundFileName; - UINT64 StartTimer; - UINT64 StartTick; -} NO_WARNING; - -// ID of the root key -#define REG_CLASSES_ROOT 0 // HKEY_CLASSES_ROOT -#define REG_LOCAL_MACHINE 1 // HKEY_LOCAL_MACHINE -#define REG_CURRENT_USER 2 // HKEY_CURRENT_USER -#define REG_USERS 3 // HKEY_USERS - -// Service Functions -typedef void (SERVICE_FUNCTION)(); - -// Process list item -typedef struct MS_PROCESS -{ - char ExeFilename[MAX_PATH]; // EXE file name - wchar_t ExeFilenameW[MAX_PATH]; // EXE file name (Unicode) - UINT ProcessId; // Process ID -} MS_PROCESS; - -#define MAX_MS_ADAPTER_IP_ADDRESS 64 - -// Network adapter -typedef struct MS_ADAPTER -{ - char Title[MAX_PATH]; // Display name - wchar_t TitleW[MAX_PATH]; // Display Name (Unicode) - UINT Index; // Index - UINT Type; // Type - UINT Status; // Status - UINT Mtu; // MTU - UINT Speed; // Speed - UINT AddressSize; // Address size - UCHAR Address[8]; // Address - UINT64 RecvBytes; // Number of received bytes - UINT64 RecvPacketsBroadcast; // Number of broadcast packets received - UINT64 RecvPacketsUnicast; // Number of unicast packets received - UINT64 SendBytes; // Number of bytes sent - UINT64 SendPacketsBroadcast; // Number of sent broadcast packets - UINT64 SendPacketsUnicast; // Number of sent unicast packets - bool Info; // Whether there is detailed information - char Guid[MAX_SIZE]; // GUID - UINT NumIpAddress; // The number of IP addresses - IP IpAddresses[MAX_MS_ADAPTER_IP_ADDRESS]; // IP address - IP SubnetMasks[MAX_MS_ADAPTER_IP_ADDRESS]; // Subnet mask - UINT NumGateway; // The number of the gateway - IP Gateways[MAX_MS_ADAPTER_IP_ADDRESS]; // Gateway - bool UseDhcp; // Using DHCP flag - IP DhcpServer; // DHCP Server - UINT64 DhcpLeaseStart; // DHCP lease start date and time - UINT64 DhcpLeaseExpires; // DHCP lease expiration date and time - bool UseWins; // WINS use flag - IP PrimaryWinsServer; // Primary WINS server - IP SecondaryWinsServer; // Secondary WINS server - bool IsWireless; // Whether wireless - bool IsNotEthernetLan; // Whether It isn't a Ethernet LAN -} MS_ADAPTER; - -// Network adapter list -typedef struct MS_ADAPTER_LIST -{ - UINT Num; // Count - MS_ADAPTER **Adapters; // Content -} MS_ADAPTER_LIST; - -typedef struct MS_ISLOCKED -{ - HWND hWnd; - THREAD *Thread; - volatile bool IsLockedFlag; -} MS_ISLOCKED; - -// TCP setting -typedef struct MS_TCP -{ - UINT RecvWindowSize; // Receive window size - UINT SendWindowSize; // Send window size -} MS_TCP; - -// Sleep prevention -typedef struct MS_NOSLEEP -{ - THREAD *Thread; // Thread - EVENT *HaltEvent; // Halting event - volatile bool Halt; // Halting flag - bool NoScreenSaver; // Prevent Screensaver - - // Following is for Windows Vista - wchar_t ScreenSaveActive[MAX_PATH]; - wchar_t SCRNSAVE_EXE[MAX_PATH]; -} MS_NOSLEEP; - -// Child window enumeration -typedef struct ENUM_CHILD_WINDOW_PARAM -{ - LIST *o; - bool no_recursion; - bool include_ipcontrol; -} ENUM_CHILD_WINDOW_PARAM; - -// Driver version information -typedef struct MS_DRIVER_VER -{ - UINT Year, Month, Day; - UINT Major, Minor, Build; -} MS_DRIVER_VER; - -// Suspend handler -typedef struct MS_SUSPEND_HANDLER -{ - HWND hWnd; - THREAD *Thread; - volatile bool AboutToClose; -} MS_SUSPEND_HANDLER; - - -// Function prototype -void MsInit(); -void MsFree(); -char *MsCutExeNameFromCommandLine(char *str); -wchar_t *MsCutExeNameFromUniCommandLine(wchar_t *str); - -UINT MsRegAccessMaskFor64BitEx(bool force32bit, bool force64bit); - -bool MsRegIsKey(UINT root, char *name); -bool MsRegIsKeyEx(UINT root, char *name, bool force32bit); -bool MsRegIsKeyEx2(UINT root, char *name, bool force32bit, bool force64bit); - -bool MsRegIsValue(UINT root, char *keyname, char *valuename); -bool MsRegIsValueEx(UINT root, char *keyname, char *valuename, bool force32bit); -bool MsRegIsValueEx2(UINT root, char *keyname, char *valuename, bool force32bit, bool force64bit); - -bool MsRegReadValueEx2(UINT root, char *keyname, char *valuename, void **data, UINT *type, UINT *size, bool force32bit, bool force64bit); -bool MsRegReadValueEx2W(UINT root, char *keyname, char *valuename, void **data, UINT *type, UINT *size, bool force32bit, bool force64bit); - -char *MsRegReadStr(UINT root, char *keyname, char *valuename); -char *MsRegReadStrEx(UINT root, char *keyname, char *valuename, bool force32bit); -char *MsRegReadStrEx2(UINT root, char *keyname, char *valuename, bool force32bit, bool force64bit); -wchar_t *MsRegReadStrW(UINT root, char *keyname, char *valuename); -wchar_t *MsRegReadStrExW(UINT root, char *keyname, char *valuename, bool force32bit); -wchar_t *MsRegReadStrEx2W(UINT root, char *keyname, char *valuename, bool force32bit, bool force64bit); - -UINT MsRegReadInt(UINT root, char *keyname, char *valuename); -UINT MsRegReadIntEx(UINT root, char *keyname, char *valuename, bool force32bit); -UINT MsRegReadIntEx2(UINT root, char *keyname, char *valuename, bool force32bit, bool force64bit); -LIST *MsRegReadStrList(UINT root, char *keyname, char *valuename); -LIST *MsRegReadStrListEx(UINT root, char *keyname, char *valuename, bool force32bit); -LIST *MsRegReadStrListEx2(UINT root, char *keyname, char *valuename, bool force32bit, bool force64bit); - -BUF *MsRegReadBin(UINT root, char *keyname, char *valuename); -BUF *MsRegReadBinEx(UINT root, char *keyname, char *valuename, bool force32bit); -BUF *MsRegReadBinEx2(UINT root, char *keyname, char *valuename, bool force32bit, bool force64bit); - -bool MsRegNewKeyEx2(UINT root, char *keyname, bool force32bit, bool force64bit); - -bool MsRegWriteValueEx2(UINT root, char *keyname, char *valuename, UINT type, void *data, UINT size, bool force32bit, bool force64bit); -bool MsRegWriteValueEx2W(UINT root, char *keyname, char *valuename, UINT type, void *data, UINT size, bool force32bit, bool force64bit); - -bool MsRegWriteStr(UINT root, char *keyname, char *valuename, char *str); -bool MsRegWriteStrEx(UINT root, char *keyname, char *valuename, char *str, bool force32bit); -bool MsRegWriteStrEx2(UINT root, char *keyname, char *valuename, char *str, bool force32bit, bool force64bit); -bool MsRegWriteStrExpand(UINT root, char *keyname, char *valuename, char *str); -bool MsRegWriteStrExpandEx(UINT root, char *keyname, char *valuename, char *str, bool force32bit); -bool MsRegWriteStrExpandEx2(UINT root, char *keyname, char *valuename, char *str, bool force32bit, bool force64bit); -bool MsRegWriteStrW(UINT root, char *keyname, char *valuename, wchar_t *str); -bool MsRegWriteStrExW(UINT root, char *keyname, char *valuename, wchar_t *str, bool force32bit); -bool MsRegWriteStrEx2W(UINT root, char *keyname, char *valuename, wchar_t *str, bool force32bit, bool force64bit); -bool MsRegWriteStrExpandW(UINT root, char *keyname, char *valuename, wchar_t *str); -bool MsRegWriteStrExpandExW(UINT root, char *keyname, char *valuename, wchar_t *str, bool force32bit); -bool MsRegWriteStrExpandEx2W(UINT root, char *keyname, char *valuename, wchar_t *str, bool force32bit, bool force64bit); - -bool MsRegWriteInt(UINT root, char *keyname, char *valuename, UINT value); -bool MsRegWriteIntEx(UINT root, char *keyname, char *valuename, UINT value, bool force32bit); -bool MsRegWriteIntEx2(UINT root, char *keyname, char *valuename, UINT value, bool force32bit, bool force64bit); -bool MsRegWriteBin(UINT root, char *keyname, char *valuename, void *data, UINT size); -bool MsRegWriteBinEx(UINT root, char *keyname, char *valuename, void *data, UINT size, bool force32bit); -bool MsRegWriteBinEx2(UINT root, char *keyname, char *valuename, void *data, UINT size, bool force32bit, bool force64bit); - -TOKEN_LIST *MsRegEnumKey(UINT root, char *keyname); -TOKEN_LIST *MsRegEnumKeyEx(UINT root, char *keyname, bool force32bit); -TOKEN_LIST *MsRegEnumKeyEx2(UINT root, char *keyname, bool force32bit, bool force64bit); -TOKEN_LIST *MsRegEnumValue(UINT root, char *keyname); -TOKEN_LIST *MsRegEnumValueEx(UINT root, char *keyname, bool force32bit); -TOKEN_LIST *MsRegEnumValueEx2(UINT root, char *keyname, bool force32bit, bool force64bit); - -bool MsRegDeleteKey(UINT root, char *keyname); -bool MsRegDeleteKeyEx(UINT root, char *keyname, bool force32bit); -bool MsRegDeleteKeyEx2(UINT root, char *keyname, bool force32bit, bool force64bit); -bool MsRegDeleteValue(UINT root, char *keyname, char *valuename); -bool MsRegDeleteValueEx(UINT root, char *keyname, char *valuename, bool force32bit); -bool MsRegDeleteValueEx2(UINT root, char *keyname, char *valuename, bool force32bit, bool force64bit); - -bool MsRegLoadHive(UINT root, wchar_t *keyname, wchar_t *filename); -bool MsRegUnloadHive(UINT root, wchar_t *keyname); - -bool MsIsNt(); -bool MsIsAdmin(); -bool MsIsWine(); -bool MsEnablePrivilege(char *name, bool enable); -void *MsGetCurrentProcess(); -UINT MsGetCurrentProcessId(); -char *MsGetExeFileName(); -char *MsGetExeDirName(); -wchar_t *MsGetExeDirNameW(); - -void MsStartIsLockedThread(); -void MsStopIsLockedThread(); - -bool MsShutdown(bool reboot, bool force); -bool MsCheckLogon(wchar_t *username, char *password); -TOKEN_LIST *MsEnumNetworkAdapters(char *start_with_name, char *start_with_name_2); -TOKEN_LIST *MsEnumNetworkAdaptersNeo(); -bool MsGetNeoDriverFilename(char *name, UINT size, char *instance_name); -bool MsMakeNewNeoDriverFilename(char *name, UINT size); -void MsGenerateNeoDriverFilenameFromInt(char *name, UINT size, UINT n); -TOKEN_LIST *MsEnumNeoDriverFilenames(); -char *MsGetNetworkAdapterGuid(char *tag_name, char *instance_name); -wchar_t *MsGetNetworkConnectionName(char *guid); -char *MsGetNetworkConfigRegKeyNameFromGuid(char *guid); -char *MsGetNetworkConfigRegKeyNameFromInstanceName(char *tag_name, char *instance_name); -void MsSetNetworkConfig(char *tag_name, char *instance_name, char *friendly_name, bool show_icon); -void MsInitNetworkConfig(char *tag_name, char *instance_name, char *connection_tag_name); -void MsNormalizeInterfaceDefaultGatewaySettings(char *tag_name, char *instance_name); - -char *MsGetSpecialDir(int id); -wchar_t *MsGetSpecialDirW(int id); -void MsGetSpecialDirs(); -bool MsCheckIsAdmin(); -void MsInitTempDir(); -void MsFreeTempDir(); -void MsGenLockFile(wchar_t *name, UINT size, wchar_t *temp_dir); -void MsDeleteTempDir(); -void MsDeleteAllFile(char *dir); -void MsDeleteAllFileW(wchar_t *dir); - -bool MsInstallVLan(char *tag_name, char *connection_tag_name, char *instance_name, MS_DRIVER_VER *ver); -bool MsInstallVLanWithoutLock(char *tag_name, char *connection_tag_name, char *instance_name, MS_DRIVER_VER *ver); -bool MsInstallVLanInternal(wchar_t *infpath, wchar_t *hwid_w, char *hwid); -bool MsUpgradeVLan(char *tag_name, char *connection_tag_name, char *instance_name, MS_DRIVER_VER *ver); -bool MsUpgradeVLanWithoutLock(char *tag_name, char *connection_tag_name, char *instance_name, MS_DRIVER_VER *ver); -bool MsEnableVLan(char *instance_name); -bool MsEnableVLanWithoutLock(char *instance_name); -bool MsDisableVLan(char *instance_name); -bool MsDisableVLanWithoutLock(char *instance_name); -bool MsUninstallVLan(char *instance_name); -bool MsUninstallVLanWithoutLock(char *instance_name); -bool MsIsVLanEnabled(char *instance_name); -bool MsIsVLanEnabledWithoutLock(char *instance_name); -bool MsIsValidVLanInstanceNameForInfCatalog(char *instance_name); -void MsGetInfCatalogDir(char *dst, UINT size); -void MsRestartVLan(char *instance_name); -void MsRestartVLanWithoutLock(char *instance_name); -bool MsIsVLanExists(char *tag_name, char *instance_name); -void MsDeleteTroubleVLAN(char *tag_name, char *instance_name); -bool MsStartDriverInstall(char *instance_name, UCHAR *mac_address, char *neo_sys, UCHAR *ret_mac_address, MS_DRIVER_VER *ver); -void MsFinishDriverInstall(char *instance_name, char *neo_sys); -void MsGetDriverPath(char *instance_name, wchar_t *src_inf, wchar_t *src_sys, wchar_t *dest_inf, wchar_t *dest_sys, wchar_t *src_cat, wchar_t *dest_cat, char *neo_sys); -void MsGetDriverPathA(char *instance_name, char *src_inf, char *src_sys, char *dest_inf, char *dest_sys, char *src_cat, char *dst_cat, char *neo_sys); -void MsGenMacAddress(UCHAR *mac); -char *MsGetMacAddress(char *tag_name, char *instance_name); -void MsSetMacAddress(char *tag_name, char *instance_name, char *mac_address); -char *MsGetDriverVersion(char *tag_name, char *instance_name); -char *MsGetDriverFileName(char *tag_name, char *instance_name); -void MsTest(); -void MsInitGlobalNetworkConfig(); -void MsDisableNetworkOffloadingEtc(); -void MsSetThreadPriorityHigh(); -void MsSetThreadPriorityIdle(); -void MsSetThreadPriorityRealtime(); -void MsRestoreThreadPriority(); -char *MsGetWindowsDir(); -char *MsGetSystem32Dir(); -char *MsGetTempDir(); -char *MsGetProgramFilesDir(); -char *MsGetCommonStartupDir(); -char *MsGetMyTempDir(); -wchar_t *MsGetWindowsDirW(); -wchar_t *MsGetExeFileNameW(); -wchar_t *MsGetExeFileDirW(); -wchar_t *MsGetSystem32DirW(); -wchar_t *MsGetTempDirW(); -wchar_t *MsGetProgramFilesDirX64W(); -wchar_t *MsGetCommonStartMenuDirW(); -wchar_t *MsGetCommonProgramsDirW(); -wchar_t *MsGetCommonStartupDirW(); -wchar_t *MsGetCommonDesktopDirW(); -wchar_t *MsGetPersonalStartMenuDirW(); -wchar_t *MsGetPersonalProgramsDirW(); -wchar_t *MsGetPersonalStartupDirW(); -wchar_t *MsGetPersonalAppDataDirW(); -wchar_t *MsGetPersonalDesktopDirW(); -wchar_t *MsGetMyTempDirW(); -wchar_t *MsGetUserNameW(); -struct SAFE_TABLE *MsGetSafeTable(); -UINT MsGetProcessId(); -void MsTerminateProcess(); -bool MsIsServiceInstalled(char *name); -bool MsInstallServiceExW(char *name, wchar_t *title, wchar_t *description, wchar_t *path, UINT *error_code); -bool MsInstallServiceW(char *name, wchar_t *title, wchar_t *description, wchar_t *path); -bool MsInstallDeviceDriverW(char *name, wchar_t *title, wchar_t *path, UINT *error_code); -bool MsUpdateServiceConfig(char *name); -bool MsSetServiceDescription(char *name, wchar_t *description); -bool MsUninstallService(char *name); -bool MsStartService(char *name); -bool MsStartServiceEx(char *name, UINT *error_code); -bool MsStopService(char *name); -bool MsIsServiceRunning(char *name); -bool MsIsTerminalServiceInstalled(); -bool MsIsUserSwitchingInstalled(); -UINT MsGetCurrentTerminalSessionId(); -bool MsIsTerminalSessionActive(UINT session_id); -bool MsIsCurrentTerminalSessionActive(); -wchar_t *MsGetSessionUserName(UINT session_id); -UINT MsService(char *name, SERVICE_FUNCTION *start, SERVICE_FUNCTION *stop, UINT icon, char *cmd_line); -void MsTestModeW(wchar_t *title, SERVICE_FUNCTION *start, SERVICE_FUNCTION *stop); -void MsTestMode(char *title, SERVICE_FUNCTION *start, SERVICE_FUNCTION *stop); -void MsServiceMode(SERVICE_FUNCTION *start, SERVICE_FUNCTION *stop); -void MsUserModeW(wchar_t *title, SERVICE_FUNCTION *start, SERVICE_FUNCTION *stop, UINT icon); -bool MsIsUserMode(); -void MsTestOnly(); -void MsPlaySound(char *name); -void MsSetThreadSingleCpu(); -void MsWin9xTest(); -bool MsCheckVLanDeviceIdFromRootEnum(char *name); -bool MsInstallVLan9x(char *instance_name, MS_DRIVER_VER *ver); -void MsUpdateCompatibleIDs(char *instance_name); -LIST *MsGetProcessList(); -LIST *MsGetProcessList9x(); -LIST *MsGetProcessListNt(); -void MsFreeProcessList(LIST *o); -int MsCompareProcessList(void *p1, void *p2); -MS_PROCESS *MsSearchProcessById(LIST *o, UINT id); -void MsGetCurrentProcessExeNameW(wchar_t *name, UINT size); -bool MsKillProcess(UINT id); -UINT MsKillProcessByExeName(wchar_t *name); -void MsKillOtherInstance(); -void MsKillOtherInstanceEx(char *exclude_svcname); -bool MsGetShortPathNameA(char *long_path, char *short_path, UINT short_path_size); -bool MsGetShortPathNameW(wchar_t *long_path, wchar_t *short_path, UINT short_path_size); -void MsWriteCallingServiceManagerProcessId(char *svcname, UINT pid); -UINT MsReadCallingServiceManagerProcessId(char *svcname, bool current_user); -bool MsStopIPsecService(); -char *MsGetIPsecServiceName(); -bool MsStartIPsecService(); - -void MsGenerateUserModeSvcGlobalPulseName(char *name, UINT size, char *svc_name); -void *MsCreateUserModeSvcGlocalPulse(char *svc_name); -void MsStopUserModeSvc(char *svc_name); -void MsUserModeGlobalPulseRecvThread(THREAD *thread, void *param); - -MS_ADAPTER_LIST *MsCreateAdapterListInner(); -MS_ADAPTER_LIST *MsCreateAdapterListInnerEx(bool no_info); -MS_ADAPTER_LIST *MsCreateAdapterListInnerExVista(bool no_info); -void MsFreeAdapter(MS_ADAPTER *a); -void MsFreeAdapterList(MS_ADAPTER_LIST *o); -wchar_t *MsGetAdapterTypeStr(UINT type); -wchar_t *MsGetAdapterStatusStr(UINT status); -MS_ADAPTER *MsCloneAdapter(MS_ADAPTER *a); -MS_ADAPTER_LIST *MsCloneAdapterList(MS_ADAPTER_LIST *o); -void MsInitAdapterListModule(); -void MsFreeAdapterListModule(); -MS_ADAPTER_LIST *MsCreateAdapterList(); -MS_ADAPTER_LIST *MsCreateAdapterListEx(bool no_info); -void MsGetAdapterTcpIpInformation(MS_ADAPTER *a); -MS_ADAPTER *MsGetAdapter(char *title); -MS_ADAPTER *MsGetAdapterByGuid(char *guid); -MS_ADAPTER *MsGetAdapterByGuidFromList(MS_ADAPTER_LIST *o, char *guid); -UINT ConvertMidStatusVistaToXp(UINT st); - -void *MsLoadLibrary(char *name); -void *MsLoadLibraryW(wchar_t *name); -void *MsLoadLibraryAsDataFile(char *name); -void *MsLoadLibraryAsDataFileW(wchar_t *name); - -void MsPrintTick(); -bool MsDisableIme(); - -void MsGetTcpConfig(MS_TCP *tcp); -void MsSetTcpConfig(MS_TCP *tcp); -void MsSaveTcpConfigReg(MS_TCP *tcp); -bool MsLoadTcpConfigReg(MS_TCP *tcp); -bool MsIsTcpConfigSupported(); -void MsApplyTcpConfig(); -bool MsIsShouldShowTcpConfigApp(); -void MsDeleteTcpConfigReg(); - -UINT MsGetConsoleWidth(); -UINT MsSetConsoleWidth(UINT size); -NO_WARNING *MsInitNoWarning(); -NO_WARNING *MsInitNoWarningEx(UINT start_timer); -void MsFreeNoWarning(NO_WARNING *nw); -void MsNoWarningThreadProc(THREAD *thread, void *param); -char *MsNoWarningSoundInit(); -void MsNoWarningSoundFree(char *s); -bool MsCloseWarningWindow(NO_WARNING *nw, UINT thread_id); -LIST *MsEnumChildWindows(LIST *o, HWND hWnd); -void MsAddWindowToList(LIST *o, HWND hWnd); -UINT MsGetThreadLocale(); -LIST *NewWindowList(); -int CmpWindowList(void *p1, void *p2); -void AddWindow(LIST *o, HWND hWnd); -void FreeWindowList(LIST *o); -LIST *EnumAllChildWindow(HWND hWnd); -LIST *EnumAllChildWindowEx(HWND hWnd, bool no_recursion, bool include_ipcontrol, bool no_self); -LIST *EnumAllTopWindow(); - -bool MsExecDriverInstaller(char *arg); -bool MsIsVista(); -bool MsIsWin2000OrGreater(); -bool MsIsWinXPOrGreater(); -void MsRegistWindowsFirewallEx(char *title, char *exe); -void MsRegistWindowsFirewallEx2(char *title, char *exe, char *dir); -bool MsIs64BitWindows(); -bool MsIsX64(); -bool MsIsIA64(); -void *MsDisableWow64FileSystemRedirection(); -void MsRestoreWow64FileSystemRedirection(void *p); -bool MsIsWindows10(); -bool MsIsWindows81(); -bool MsIsWindows8(); -bool MsIsWindows7(); -bool MsIsInfCatalogRequired(); - -bool MsCheckFileDigitalSignatureW(HWND hWnd, wchar_t *name, bool *danger); - -bool MsIsKB3033929RequiredAndMissing(); -bool MsIsSha2KernelModeSignatureSupported(); - -bool MsGetProcessExeName(char *path, UINT size, UINT id); -bool MsGetWindowOwnerProcessExeName(char *path, UINT size, HWND hWnd); - -void *MsRunAsUserExW(wchar_t *filename, wchar_t *arg, bool hide); -void *MsRunAsUserExInnerW(wchar_t *filename, wchar_t *arg, bool hide); - -UINT MsGetCursorPosHash(); - -void MsGetComputerName(char *name, UINT size); -void MsGetComputerNameFullEx(wchar_t *name, UINT size, bool with_cache); -UINT64 MsGetScreenSaverTimeout(); - -bool MsUniMakeDir(wchar_t *name); -void MsUniMakeDirEx(wchar_t *name); -bool MsMakeDir(char *name); -bool MsExecute(char *exe, char *arg); -bool MsExecute2(char *exe, char *arg, bool runas); -bool MsExecuteW(wchar_t *exe, wchar_t *arg); -bool MsExecute2W(wchar_t *exe, wchar_t *arg, bool runas); -bool MsExecuteEx(char *exe, char *arg, void **process_handle); -bool MsExecuteEx2(char *exe, char *arg, void **process_handle, bool runas); -bool MsExecuteEx2W(wchar_t *exe, wchar_t *arg, void **process_handle, bool runas); -void MsCloseHandle(void *handle); -UINT MsWaitProcessExit(void *process_handle); -void MsUpdateSystem(); -UINT64 MsGetHiResCounter(); -double MsGetHiResTimeSpan(UINT64 diff); -UINT64 MsGetHiResTimeSpanUSec(UINT64 diff); -void MsRestartMMCSS(); -bool MsIsMMCSSNetworkThrottlingEnabled(); -void MsSetMMCSSNetworkThrottlingEnable(bool enable); -void MsSetShutdownParameters(UINT level, UINT flag); -bool MsIsWinXPOrWinVista(); -bool MsGetFileInformation(void *h, void *info); -void MsSetErrorModeToSilent(); -void MsSetEnableMinidump(bool enabled); -bool MsIsMinidumpEnabled(); -void MsWriteMinidump(wchar_t *filename, void *ex); - - -void *MsInitGlobalLock(char *name, bool ts_local); -void MsGlobalLock(void *p); -void MsGlobalUnlock(void *p); -void MsFreeGlobalLock(void *p); - -void *MsOpenOrCreateGlobalPulse(char *name); -bool MsWaitForGlobalPulse(void *p, UINT timeout); -void MsCloseGlobalPulse(void *p); -void MsSendGlobalPulse(void *p); - -bool MsPerformMsChapV2AuthByLsa(char *username, UCHAR *challenge8, UCHAR *client_response_24, UCHAR *ret_pw_hash_hash); - -void MsDisableWcmNetworkMinimize(); -bool MsSetFileSecureAcl(wchar_t *path); - -bool MsGetMsiInstalledDir(char *component_code, wchar_t *dir, UINT dir_size); -bool MsMsiUninstall(char *product_code, HWND hWnd, bool *reboot_required); - -UINT MsGetUserLocaleId(); -bool MsIsCurrentUserLocaleIdJapanese(); - -TOKEN_LIST *MsEnumResources(void *hModule, char *type); -void *MsGetCurrentModuleHandle(); - -bool MsIsAeroEnabled(); -bool MsIsAeroColor(); - -bool MsIsInVmMain(); -bool MsIsInVm(); - -void MsTest(); - -bool MsSaveSystemInfo(wchar_t *dst_filename); -bool MsCollectVpnInfo(BUF *bat, char *tmpdir, char *svc_name, wchar_t *config_name, wchar_t *logdir_name); -void MsInitProcessCallOnce(); - -MS_SUSPEND_HANDLER *MsNewSuspendHandler(); -void MsFreeSuspendHandler(MS_SUSPEND_HANDLER *h); - -void MsBeginVLanCard(); -void MsEndVLanCard(); -bool MsIsVLanCardShouldStop(); -void MsProcEnterSuspend(); -void MsProcLeaveSuspend(); -UINT64 MsGetSuspendModeBeginTick(); - -// Inner functions -#ifdef MICROSOFT_C - -LONG CALLBACK MsExceptionHandler(struct _EXCEPTION_POINTERS *ExceptionInfo); -HKEY MsGetRootKeyFromInt(UINT root); -NT_API *MsLoadNtApiFunctions(); -void MsFreeNtApiFunctions(NT_API *nt); -void MsDestroyDevInfo(HDEVINFO info); -HDEVINFO MsGetDevInfoFromDeviceId(SP_DEVINFO_DATA *dev_info_data, char *device_id); -bool MsStartDevice(HDEVINFO info, SP_DEVINFO_DATA *dev_info_data); -bool MsStopDevice(HDEVINFO info, SP_DEVINFO_DATA *dev_info_data); -bool MsDeleteDevice(HDEVINFO info, SP_DEVINFO_DATA *dev_info_data); -bool MsIsDeviceRunning(HDEVINFO info, SP_DEVINFO_DATA *dev_info_data); -void CALLBACK MsServiceDispatcher(UINT argc, LPTSTR *argv); -void CALLBACK MsServiceHandler(UINT opcode); -bool MsServiceStopProc(); -void MsServiceStoperMainThread(THREAD *t, void *p); -void MsServiceStarterMainThread(THREAD *t, void *p); -LRESULT CALLBACK MsUserModeWindowProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam); -bool MsShowIconOnTray(HWND hWnd, HICON icon, wchar_t *tooltip, UINT msg); -void MsRestoreIconOnTray(); -void MsChangeIconOnTray(HICON icon, wchar_t *tooltip); -bool MsChangeIconOnTrayEx(HICON icon, wchar_t *tooltip, wchar_t *info_title, wchar_t *info, UINT info_flags, bool add); -void MsHideIconOnTray(); -void MsUserModeTrayMenu(HWND hWnd); -bool MsAppendMenu(HMENU hMenu, UINT flags, UINT_PTR id, wchar_t *str); -bool MsInsertMenu(HMENU hMenu, UINT pos, UINT flags, UINT_PTR id_new_item, wchar_t *lp_new_item); -bool CALLBACK MsEnumChildWindowProc(HWND hWnd, LPARAM lParam); -BOOL CALLBACK EnumTopWindowProc(HWND hWnd, LPARAM lParam); -bool CALLBACK MsEnumThreadWindowProc(HWND hWnd, LPARAM lParam); -HANDLE MsCreateUserToken(); -SID *MsGetSidFromAccountName(char *name); -void MsFreeSid(SID *sid); -bool CALLBACK MsEnumResourcesInternalProc(HMODULE hModule, const char *type, char *name, LONG_PTR lParam); -LRESULT CALLBACK MsSuspendHandlerWindowProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam); -void MsSuspendHandlerThreadProc(THREAD *thread, void *param); - - - -#endif // MICROSOFT_C - -#endif // MICROSOFT_H - -#endif // OS_WIN32 - +// SoftEther VPN Source Code - Developer Edition Master Branch +// Mayaqua Kernel + + +// Microsoft.h +// Header of Microsoft.c + +#ifdef OS_WIN32 + +// Make available the types for Windows even if windows.h is not included +#ifndef _WINDEF_ + +typedef void *HWND; + +#endif // _WINDEF_ + +#ifndef MICROSOFT_H +#define MICROSOFT_H + + +// Constant for Event log +#define MS_EVENTLOG_TYPE_INFORMATION 0 +#define MS_EVENTLOG_TYPE_WARNING 1 +#define MS_EVENTLOG_TYPE_ERROR 2 + +#define MS_RC_EVENTLOG_TYPE_INFORMATION 0x40000001L +#define MS_RC_EVENTLOG_TYPE_WARNING 0x80000002L +#define MS_RC_EVENTLOG_TYPE_ERROR 0xC0000003L + + +// TCP/IP registry value +#define TCP_MAX_NUM_CONNECTIONS 16777214 + +#define DEFAULT_TCP_MAX_WINDOW_SIZE_RECV 5955584 +#define DEFAULT_TCP_MAX_WINDOW_SIZE_SEND 131072 +#define DEFAULT_TCP_MAX_NUM_CONNECTIONS 16777214 + +// Constant +#define SVC_ARG_INSTALL "/install" +#define SVC_ARG_UNINSTALL "/uninstall" +#define SVC_ARG_START "/start" +#define SVC_ARG_STOP "/stop" +#define SVC_ARG_TEST "/test" +#define SVC_ARG_USERMODE "/usermode" +#define SVC_ARG_USERMODE_SHOWTRAY "/usermode_showtray" +#define SVC_ARG_USERMODE_HIDETRAY "/usermode_hidetray" +#define SVC_ARG_SERVICE "/service" +#define SVC_ARG_SETUP_INSTALL "/setup_install" +#define SVC_ARG_SETUP_UNINSTALL "/setup_uninstall" +#define SVC_ARG_WIN9X_SERVICE "/win9x_service" +#define SVC_ARG_WIN9X_INSTALL "/win9x_install" +#define SVC_ARG_WIN9X_UNINSTALL "/win9x_uninstall" +#define SVC_ARG_TCP "/tcp" +#define SVC_ARG_TCP_UAC "/tcp_uac" +#define SVC_ARG_TCP_UAC_W L"/tcp_uac" +#define SVC_ARG_TCP_SETUP "/tcpsetup" +#define SVC_ARG_TRAFFIC "/traffic" +#define SVC_ARG_UIHELP "/uihelp" +#define SVC_ARG_UIHELP_W L"/uihelp" +#define SVC_ARG_SILENT "/silent" + +// Time to suicide, if the service freezed +#define SVC_SELFKILL_TIMEOUT (5 * 60 * 1000) + +// The name of the device driver of the virtual LAN card for Win32 (first part) +#define VLAN_ADAPTER_NAME "VPN Client Adapter" +#define VLAN_ADAPTER_NAME_OLD "SoftEther VPN Client 2.0 Adapter" + +// The name of the device driver of the virtual LAN card for Win32 (full name) +#define VLAN_ADAPTER_NAME_TAG "VPN Client Adapter - %s" +#define VLAN_ADAPTER_NAME_TAG_OLD "SoftEther VPN Client 2.0 Adapter - %s" + +// Display name of Virtual LAN card in the [Network Connections] in Win32 (full name) +#define VLAN_CONNECTION_NAME "%s - VPN Client" +#define VLAN_CONNECTION_NAME_OLD "%s - SoftEther VPN Client 2.0" + + +// Suspend handler windows class name +#define MS_SUSPEND_HANDLER_WNDCLASSNAME "MS_SUSPEND_HANDLER" + +// Command line format in the service mode +#define SVC_RUN_COMMANDLINE L"\"%s\" /service" + +// Mode value +#define SVC_MODE_NONE 0 +#define SVC_MODE_INSTALL 1 +#define SVC_MODE_UNINSTALL 2 +#define SVC_MODE_START 3 +#define SVC_MODE_STOP 4 +#define SVC_MODE_TEST 5 +#define SVC_MODE_USERMODE 6 +#define SVC_MODE_SERVICE 7 +#define SVC_MODE_SETUP_INSTALL 8 +#define SVC_MODE_SETUP_UNINSTALL 9 +#define SVC_MODE_WIN9X_SERVICE 10 +#define SVC_MODE_WIN9X_INSTALL 11 +#define SVC_MODE_WIN9X_UNINSTALL 12 +#define SVC_MODE_TCP 13 +#define SVC_MODE_TCPSETUP 14 +#define SVC_MODE_TRAFFIC 15 +#define SVC_MODE_UIHELP 16 +#define SVC_MODE_TCP_UAC 17 + + +#define WIN9X_SVC_REGKEY_1 "Software\\Microsoft\\Windows\\CurrentVersion\\RunServices" +#define WIN9X_SVC_REGKEY_2 "Software\\Microsoft\\Windows\\CurrentVersion\\Run" + +#define VISTA_MMCSS_KEYNAME "SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Multimedia\\SystemProfile\\Tasks" +#define VISTA_MMCSS_FILENAME "mmcss_backup.dat" + +#define SVC_NAME "SVC_%s_NAME" +#define SVC_TITLE "SVC_%s_TITLE" +#define SVC_DESCRIPT "SVC_%s_DESCRIPT" + +#define SVC_USERMODE_SETTING_KEY "Software\\" GC_REG_COMPANY_NAME "\\PacketiX VPN\\UserMode Settings" +#define SVC_HIDETRAY_REG_VALUE "HideTray_%S" + +#define SVC_CALLING_SM_PROCESS_ID_KEY "Software\\" GC_REG_COMPANY_NAME "\\PacketiX VPN\\Service Control\\%s" +#define SVC_CALLING_SM_PROCESS_ID_VALUE "ProcessId" + +#define SOFTETHER_FW_SCRIPT_HASH "Software\\" GC_REG_COMPANY_NAME "\\PacketiX VPN\\FW ScriptHash" + +#define MMCSS_PROFILE_KEYNAME "SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Multimedia\\SystemProfile" + +// Other constants +#define MS_REG_TCP_SETTING_KEY "Software\\" GC_REG_COMPANY_NAME "\\Network Settings" + + + +// Constants about driver +#define DRIVER_INSTALL_SYS_NAME_TAG_NEW "Neo_%04u.sys" +#define DRIVER_INSTALL_SYS_NAME_TAG_MAXID 128 // Maximum number of install + + +// Vista driver installer related +#define VISTA_DRIVER_INSTALLER_SRC L"|vpndrvinst.exe" +#define VISTA_DRIVER_INSTALLER_DST L"%s\\vpndrvinst.exe" + +#define DRIVER_DEVICE_ID_TAG "NeoAdapter_%s" + + +#if (defined(MICROSOFT_C) || defined(NETWORK_C)) && (defined(OS_WIN32)) + +typedef enum __TCP_TABLE_CLASS { + _TCP_TABLE_BASIC_LISTENER, + _TCP_TABLE_BASIC_CONNECTIONS, + _TCP_TABLE_BASIC_ALL, + _TCP_TABLE_OWNER_PID_LISTENER, + _TCP_TABLE_OWNER_PID_CONNECTIONS, + _TCP_TABLE_OWNER_PID_ALL, + _TCP_TABLE_OWNER_MODULE_LISTENER, + _TCP_TABLE_OWNER_MODULE_CONNECTIONS, + _TCP_TABLE_OWNER_MODULE_ALL +} _TCP_TABLE_CLASS, *_PTCP_TABLE_CLASS; + +// A pointer to the network related Win32 API function +typedef struct NETWORK_WIN32_FUNCTIONS +{ + HINSTANCE hIpHlpApi32; + HINSTANCE hIcmp; + UINT (WINAPI *DeleteIpForwardEntry)(PMIB_IPFORWARDROW); + UINT (WINAPI *CreateIpForwardEntry)(PMIB_IPFORWARDROW); + UINT (WINAPI *GetIpForwardTable)(PMIB_IPFORWARDTABLE, PULONG, BOOL); + UINT (WINAPI *GetNetworkParams)(PFIXED_INFO, PULONG); + ULONG (WINAPI *GetAdaptersAddresses)(ULONG, ULONG, PVOID, PIP_ADAPTER_ADDRESSES, PULONG); + UINT (WINAPI *GetIfTable)(PMIB_IFTABLE, PULONG, BOOL); + UINT (WINAPI *GetIfTable2)(void **); + void (WINAPI *FreeMibTable)(PVOID); + UINT (WINAPI *IpRenewAddress)(PIP_ADAPTER_INDEX_MAP); + UINT (WINAPI *IpReleaseAddress)(PIP_ADAPTER_INDEX_MAP); + UINT (WINAPI *GetInterfaceInfo)(PIP_INTERFACE_INFO, PULONG); + UINT (WINAPI *GetAdaptersInfo)(PIP_ADAPTER_INFO, PULONG); + UINT (WINAPI *GetExtendedTcpTable)(PVOID, PUINT, BOOL, ULONG, _TCP_TABLE_CLASS, ULONG); + UINT (WINAPI *AllocateAndGetTcpExTableFromStack)(PVOID *, BOOL, HANDLE, UINT, UINT); + UINT (WINAPI *GetTcpTable)(PMIB_TCPTABLE, PUINT, BOOL); + UINT (WINAPI *NotifyRouteChange)(PHANDLE, LPOVERLAPPED); + BOOL (WINAPI *CancelIPChangeNotify)(LPOVERLAPPED); + UINT (WINAPI *NhpAllocateAndGetInterfaceInfoFromStack)(IP_INTERFACE_NAME_INFO **, + PUINT, BOOL, HANDLE, UINT); + HANDLE (WINAPI *IcmpCreateFile)(); + BOOL (WINAPI *IcmpCloseHandle)(HANDLE); + UINT (WINAPI *IcmpSendEcho)(HANDLE, IPAddr, LPVOID, WORD, PIP_OPTION_INFORMATION, + LPVOID, UINT, UINT); +} NETWORK_WIN32_FUNCTIONS; +#endif + + +#ifdef MICROSOFT_C +// WCM related code on Windows 8 +typedef enum _MS_WCM_PROPERTY +{ + ms_wcm_global_property_domain_policy, + ms_wcm_global_property_minimize_policy, + ms_wcm_global_property_roaming_policy, + ms_wcm_global_property_powermanagement_policy, + ms_wcm_intf_property_connection_cost, //used to set/get cost level and flags for the connection + ms_wcm_intf_property_dataplan_status, //used by MNO to indicate plan data associated with new cost + ms_wcm_intf_property_hotspot_profile, //used to store hotspot profile (WISPr credentials) +} MS_WCM_PROPERTY, *MS_PWCM_PROPERTY; + +typedef struct _MS_WCM_POLICY_VALUE { + BOOL fValue; + BOOL fIsGroupPolicy; +} MS_WCM_POLICY_VALUE, *MS_PWCM_POLICY_VALUE; + +#define MS_WCM_MAX_PROFILE_NAME 256 + +typedef enum _MS_WCM_MEDIA_TYPE +{ + ms_wcm_media_unknown, + ms_wcm_media_ethernet, + ms_wcm_media_wlan, + ms_wcm_media_mbn, + ms_wcm_media_invalid, + ms_wcm_media_max +} MS_WCM_MEDIA_TYPE, *MS_PWCM_MEDIA_TYPE; + +typedef struct _MS_WCM_PROFILE_INFO { + WCHAR strProfileName[MS_WCM_MAX_PROFILE_NAME]; + GUID AdapterGUID; + MS_WCM_MEDIA_TYPE Media; +} MS_WCM_PROFILE_INFO, *MS_PWCM_PROFILE_INFO; + +typedef struct _MS_WCM_PROFILE_INFO_LIST { + UINT dwNumberOfItems; + + MS_WCM_PROFILE_INFO ProfileInfo[1]; + +} MS_WCM_PROFILE_INFO_LIST, *MS_PWCM_PROFILE_INFO_LIST; + + +// Internal structure +typedef struct MS +{ + HINSTANCE hInst; + HINSTANCE hKernel32; + bool IsNt; + bool IsAdmin; + struct NT_API *nt; + HANDLE hCurrentProcess; + UINT CurrentProcessId; + bool MiniDumpEnabled; + char *ExeFileName; + char *ExeFileDir; + char *WindowsDir; + char *System32Dir; + char *TempDir; + char *WinTempDir; + char *WindowsDrive; + char *ProgramFilesDir; + char *ProgramFilesDirX86; + char *ProgramFilesDirX64; + char *CommonStartMenuDir; + char *CommonProgramsDir; + char *CommonStartupDir; + char *CommonAppDataDir; + char *CommonDesktopDir; + char *PersonalStartMenuDir; + char *PersonalProgramsDir; + char *PersonalStartupDir; + char *PersonalAppDataDir; + char *PersonalDesktopDir; + char *MyDocumentsDir; + char *LocalAppDataDir; + char *MyTempDir; + char *UserName; + char *UserNameEx; + wchar_t *ExeFileNameW; + wchar_t *ExeFileDirW; + wchar_t *WindowsDirW; + wchar_t *System32DirW; + wchar_t *TempDirW; + wchar_t *WinTempDirW; + wchar_t *WindowsDriveW; + wchar_t *ProgramFilesDirW; + wchar_t *ProgramFilesDirX86W; + wchar_t *ProgramFilesDirX64W; + wchar_t *CommonStartMenuDirW; + wchar_t *CommonProgramsDirW; + wchar_t *CommonStartupDirW; + wchar_t *CommonAppDataDirW; + wchar_t *CommonDesktopDirW; + wchar_t *PersonalStartMenuDirW; + wchar_t *PersonalProgramsDirW; + wchar_t *PersonalStartupDirW; + wchar_t *PersonalAppDataDirW; + wchar_t *PersonalDesktopDirW; + wchar_t *MyDocumentsDirW; + wchar_t *LocalAppDataDirW; + wchar_t *MyTempDirW; + wchar_t *UserNameW; + wchar_t *UserNameExW; + wchar_t *MinidumpBaseFileNameW; + IO *LockFile; + bool IsWine; +} MS; + +// For Windows NT API +typedef struct NT_API +{ + HINSTANCE hAdvapi32; + HINSTANCE hShell32; + HINSTANCE hNewDev; + HINSTANCE hSetupApi; + HINSTANCE hWtsApi32; + HINSTANCE hPsApi; + HINSTANCE hKernel32; + HINSTANCE hSecur32; + HINSTANCE hUser32; + HINSTANCE hDbgHelp; + HINSTANCE hWcmapi; + HINSTANCE hDwmapi; + BOOL (WINAPI *OpenProcessToken)(HANDLE, UINT, PHANDLE); + BOOL (WINAPI *LookupPrivilegeValue)(char *, char *, PLUID); + BOOL (WINAPI *AdjustTokenPrivileges)(HANDLE, BOOL, PTOKEN_PRIVILEGES, UINT, PTOKEN_PRIVILEGES, PUINT); + BOOL (WINAPI *InitiateSystemShutdown)(LPTSTR, LPTSTR, UINT, BOOL, BOOL); + BOOL (WINAPI *LogonUserW)(wchar_t *, wchar_t *, wchar_t *, UINT, UINT, HANDLE *); + BOOL (WINAPI *LogonUserA)(char *, char *, char *, UINT, UINT, HANDLE *); + BOOL (WINAPI *UpdateDriverForPlugAndPlayDevicesW)(HWND hWnd, wchar_t *hardware_id, wchar_t *inf_path, UINT flag, BOOL *need_reboot); + UINT (WINAPI *CM_Get_DevNode_Status_Ex)(UINT *, UINT *, UINT, UINT, HANDLE); + UINT (WINAPI *CM_Get_Device_ID_ExA)(UINT, char *, UINT, UINT, HANDLE); + UINT (WINAPI *WTSQuerySessionInformation)(HANDLE, UINT, WTS_INFO_CLASS, wchar_t *, UINT *); + void (WINAPI *WTSFreeMemory)(void *); + BOOL (WINAPI *WTSDisconnectSession)(HANDLE, UINT, BOOL); + BOOL (WINAPI *WTSEnumerateSessions)(HANDLE, UINT, UINT, PWTS_SESSION_INFO *, UINT *); + BOOL (WINAPI *WTSRegisterSessionNotification)(HWND, UINT); + BOOL (WINAPI *WTSUnRegisterSessionNotification)(HWND); + SC_HANDLE (WINAPI *OpenSCManager)(LPCTSTR, LPCTSTR, UINT); + SC_HANDLE (WINAPI *CreateServiceA)(SC_HANDLE, LPCTSTR, LPCTSTR, UINT, UINT, UINT, UINT, LPCTSTR, LPCTSTR, LPUINT, LPCTSTR, LPCTSTR, LPCTSTR); + SC_HANDLE (WINAPI *CreateServiceW)(SC_HANDLE, LPCWSTR, LPCWSTR, UINT, UINT, UINT, UINT, LPCWSTR, LPCWSTR, LPUINT, LPCWSTR, LPCWSTR, LPCWSTR); + BOOL (WINAPI *ChangeServiceConfig2)(SC_HANDLE, UINT, LPVOID); + BOOL (WINAPI *CloseServiceHandle)(SC_HANDLE); + SC_HANDLE (WINAPI *OpenService)(SC_HANDLE, LPCTSTR, UINT); + BOOL (WINAPI *QueryServiceStatus)(SC_HANDLE, LPSERVICE_STATUS); + BOOL (WINAPI *StartService)(SC_HANDLE, UINT, LPCTSTR); + BOOL (WINAPI *ControlService)(SC_HANDLE, UINT, LPSERVICE_STATUS); + BOOL (WINAPI *SetServiceStatus)(SERVICE_STATUS_HANDLE, LPSERVICE_STATUS); + SERVICE_STATUS_HANDLE (WINAPI *RegisterServiceCtrlHandler)(LPCTSTR, LPHANDLER_FUNCTION); + BOOL (WINAPI *StartServiceCtrlDispatcher)(CONST LPSERVICE_TABLE_ENTRY); + BOOL (WINAPI *DeleteService)(SC_HANDLE); + BOOL (WINAPI *EnumProcesses)(UINT *, UINT, UINT *); + BOOL (WINAPI *EnumProcessModules)(HANDLE, HMODULE *, UINT, UINT *); + UINT (WINAPI *GetModuleFileNameExA)(HANDLE, HMODULE, LPSTR, UINT); + UINT (WINAPI *GetModuleFileNameExW)(HANDLE, HMODULE, LPWSTR, UINT); + UINT (WINAPI *GetProcessImageFileNameA)(HANDLE, LPSTR, UINT); + UINT (WINAPI *GetProcessImageFileNameW)(HANDLE, LPWSTR, UINT); + BOOL (WINAPI *QueryFullProcessImageNameA)(HANDLE, UINT, LPSTR, PUINT); + BOOL (WINAPI *QueryFullProcessImageNameW)(HANDLE, UINT, LPWSTR, PUINT); + LONG (WINAPI *RegDeleteKeyExA)(HKEY, LPCTSTR, REGSAM, UINT); + BOOL (WINAPI *IsWow64Process)(HANDLE, BOOL *); + void (WINAPI *GetNativeSystemInfo)(SYSTEM_INFO *); + BOOL (WINAPI *DuplicateTokenEx)(HANDLE, UINT, SECURITY_ATTRIBUTES *, SECURITY_IMPERSONATION_LEVEL, TOKEN_TYPE, HANDLE *); + BOOL (WINAPI *ConvertStringSidToSidA)(LPCSTR, PSID *); + BOOL (WINAPI *SetTokenInformation)(HANDLE, TOKEN_INFORMATION_CLASS, void *, UINT); + BOOL (WINAPI *GetTokenInformation)(HANDLE, TOKEN_INFORMATION_CLASS, void *, UINT, PUINT); + BOOL (WINAPI *CreateProcessAsUserA)(HANDLE, LPCSTR, LPSTR, LPSECURITY_ATTRIBUTES, LPSECURITY_ATTRIBUTES, BOOL, UINT, void *, LPCSTR, LPSTARTUPINFOA, LPPROCESS_INFORMATION); + BOOL (WINAPI *CreateProcessAsUserW)(HANDLE, LPCWSTR, LPWSTR, LPSECURITY_ATTRIBUTES, LPSECURITY_ATTRIBUTES, BOOL, UINT, void *, LPCWSTR, LPSTARTUPINFOW, LPPROCESS_INFORMATION); + BOOL (WINAPI *LookupAccountSidA)(LPCSTR,PSID,LPSTR,LPUINT,LPSTR,LPUINT,PSID_NAME_USE); + BOOL (WINAPI *LookupAccountNameA)(LPCSTR,LPCSTR,PSID,LPUINT,LPSTR,LPUINT,PSID_NAME_USE); + BOOL (WINAPI *GetUserNameExA)(EXTENDED_NAME_FORMAT, LPSTR, PULONG); + BOOL (WINAPI *GetUserNameExW)(EXTENDED_NAME_FORMAT, LPWSTR, PULONG); + BOOL (WINAPI *SwitchDesktop)(HDESK); + HDESK (WINAPI *OpenDesktopA)(LPTSTR, UINT, BOOL, ACCESS_MASK); + BOOL (WINAPI *CloseDesktop)(HDESK); + BOOL (WINAPI *SetProcessShutdownParameters)(UINT, UINT); + HANDLE (WINAPI *RegisterEventSourceW)(LPCWSTR, LPCWSTR); + BOOL (WINAPI *ReportEventW)(HANDLE, WORD, WORD, UINT, PSID, WORD, UINT, LPCWSTR *, LPVOID); + BOOL (WINAPI *DeregisterEventSource)(HANDLE); + BOOL (WINAPI *Wow64DisableWow64FsRedirection)(void **); + BOOLEAN (WINAPI *Wow64EnableWow64FsRedirection)(BOOLEAN); + BOOL (WINAPI *Wow64RevertWow64FsRedirection)(void *); + BOOL (WINAPI *GetFileInformationByHandle)(HANDLE, LPBY_HANDLE_FILE_INFORMATION); + HANDLE (WINAPI *GetProcessHeap)(); + BOOL (WINAPI *MiniDumpWriteDump)(HANDLE, UINT, HANDLE, MINIDUMP_TYPE, + PMINIDUMP_EXCEPTION_INFORMATION, PMINIDUMP_USER_STREAM_INFORMATION, + PMINIDUMP_CALLBACK_INFORMATION); + BOOL (WINAPI *AllocateLocallyUniqueId)(PLUID); + NTSTATUS (NTAPI *LsaConnectUntrusted)(PHANDLE); + NTSTATUS (NTAPI *LsaLookupAuthenticationPackage)(HANDLE, PLSA_STRING, PULONG); + NTSTATUS (NTAPI *LsaLogonUser)(HANDLE, PLSA_STRING, SECURITY_LOGON_TYPE, ULONG, + PVOID, ULONG, PTOKEN_GROUPS, PTOKEN_SOURCE, PVOID, PULONG, PLUID, PHANDLE, + PQUOTA_LIMITS, PNTSTATUS); + NTSTATUS (NTAPI *LsaDeregisterLogonProcess)(HANDLE); + NTSTATUS (NTAPI *LsaFreeReturnBuffer)(PVOID); + UINT (WINAPI *WcmQueryProperty)(const GUID *, LPCWSTR, MS_WCM_PROPERTY, PVOID, PUINT, PBYTE *); + UINT (WINAPI *WcmSetProperty)(const GUID *, LPCWSTR, MS_WCM_PROPERTY, PVOID, UINT, const BYTE *); + void (WINAPI *WcmFreeMemory)(PVOID); + UINT (WINAPI *WcmGetProfileList)(PVOID, MS_WCM_PROFILE_INFO_LIST **ppProfileList); + UINT (WINAPI *SetNamedSecurityInfoW)(LPWSTR, UINT, SECURITY_INFORMATION, PSID, PSID, PACL, PACL); + BOOL (WINAPI *AddAccessAllowedAceEx)(PACL, UINT, UINT, UINT, PSID); + HRESULT (WINAPI *DwmIsCompositionEnabled)(BOOL *); + BOOL (WINAPI *GetComputerNameExW)(COMPUTER_NAME_FORMAT, LPWSTR, LPUINT); + LONG (WINAPI *RegLoadKeyW)(HKEY, LPCWSTR, LPCWSTR); + LONG (WINAPI *RegUnLoadKeyW)(HKEY, LPCWSTR); +} NT_API; + +typedef struct MS_EVENTLOG +{ + HANDLE hEventLog; +} MS_EVENTLOG; + +extern NETWORK_WIN32_FUNCTIONS *w32net; + +typedef struct MS_USERMODE_SVC_PULSE_THREAD_PARAM +{ + void *hWnd; + void *GlobalPulse; + volatile bool Halt; +} MS_USERMODE_SVC_PULSE_THREAD_PARAM; + +#endif // MICROSOFT_C + +// Structure to suppress the warning message +typedef struct NO_WARNING +{ + UINT ThreadId; + THREAD *NoWarningThread; + EVENT *HaltEvent; + volatile bool Halt; + wchar_t *SoundFileName; + UINT64 StartTimer; + UINT64 StartTick; +} NO_WARNING; + +// ID of the root key +#define REG_CLASSES_ROOT 0 // HKEY_CLASSES_ROOT +#define REG_LOCAL_MACHINE 1 // HKEY_LOCAL_MACHINE +#define REG_CURRENT_USER 2 // HKEY_CURRENT_USER +#define REG_USERS 3 // HKEY_USERS + +// Service Functions +typedef void (SERVICE_FUNCTION)(); + +// Process list item +typedef struct MS_PROCESS +{ + char ExeFilename[MAX_PATH]; // EXE file name + wchar_t ExeFilenameW[MAX_PATH]; // EXE file name (Unicode) + UINT ProcessId; // Process ID +} MS_PROCESS; + +#define MAX_MS_ADAPTER_IP_ADDRESS 64 + +// Network adapter +typedef struct MS_ADAPTER +{ + char Title[MAX_PATH]; // Display name + wchar_t TitleW[MAX_PATH]; // Display Name (Unicode) + UINT Index; // Index + UINT Type; // Type + UINT Status; // Status + UINT Mtu; // MTU + UINT Speed; // Speed + UINT AddressSize; // Address size + UCHAR Address[8]; // Address + UINT64 RecvBytes; // Number of received bytes + UINT64 RecvPacketsBroadcast; // Number of broadcast packets received + UINT64 RecvPacketsUnicast; // Number of unicast packets received + UINT64 SendBytes; // Number of bytes sent + UINT64 SendPacketsBroadcast; // Number of sent broadcast packets + UINT64 SendPacketsUnicast; // Number of sent unicast packets + bool Info; // Whether there is detailed information + char Guid[MAX_SIZE]; // GUID + UINT NumIpAddress; // The number of IP addresses + IP IpAddresses[MAX_MS_ADAPTER_IP_ADDRESS]; // IP address + IP SubnetMasks[MAX_MS_ADAPTER_IP_ADDRESS]; // Subnet mask + UINT NumGateway; // The number of the gateway + IP Gateways[MAX_MS_ADAPTER_IP_ADDRESS]; // Gateway + bool UseDhcp; // Using DHCP flag + IP DhcpServer; // DHCP Server + UINT64 DhcpLeaseStart; // DHCP lease start date and time + UINT64 DhcpLeaseExpires; // DHCP lease expiration date and time + bool UseWins; // WINS use flag + IP PrimaryWinsServer; // Primary WINS server + IP SecondaryWinsServer; // Secondary WINS server + bool IsWireless; // Whether wireless + bool IsNotEthernetLan; // Whether It isn't a Ethernet LAN +} MS_ADAPTER; + +// Network adapter list +typedef struct MS_ADAPTER_LIST +{ + UINT Num; // Count + MS_ADAPTER **Adapters; // Content +} MS_ADAPTER_LIST; + +typedef struct MS_ISLOCKED +{ + HWND hWnd; + THREAD *Thread; + volatile bool IsLockedFlag; +} MS_ISLOCKED; + +// TCP setting +typedef struct MS_TCP +{ + UINT RecvWindowSize; // Receive window size + UINT SendWindowSize; // Send window size +} MS_TCP; + +// Sleep prevention +typedef struct MS_NOSLEEP +{ + THREAD *Thread; // Thread + EVENT *HaltEvent; // Halting event + volatile bool Halt; // Halting flag + bool NoScreenSaver; // Prevent Screensaver + + // Following is for Windows Vista + wchar_t ScreenSaveActive[MAX_PATH]; + wchar_t SCRNSAVE_EXE[MAX_PATH]; +} MS_NOSLEEP; + +// Child window enumeration +typedef struct ENUM_CHILD_WINDOW_PARAM +{ + LIST *o; + bool no_recursion; + bool include_ipcontrol; +} ENUM_CHILD_WINDOW_PARAM; + +// Driver version information +typedef struct MS_DRIVER_VER +{ + UINT Year, Month, Day; + UINT Major, Minor, Build; +} MS_DRIVER_VER; + +// Suspend handler +typedef struct MS_SUSPEND_HANDLER +{ + HWND hWnd; + THREAD *Thread; + volatile bool AboutToClose; +} MS_SUSPEND_HANDLER; + + +// Function prototype +void MsInit(); +void MsFree(); +char *MsCutExeNameFromCommandLine(char *str); +wchar_t *MsCutExeNameFromUniCommandLine(wchar_t *str); + +UINT MsRegAccessMaskFor64BitEx(bool force32bit, bool force64bit); + +bool MsRegIsKey(UINT root, char *name); +bool MsRegIsKeyEx(UINT root, char *name, bool force32bit); +bool MsRegIsKeyEx2(UINT root, char *name, bool force32bit, bool force64bit); + +bool MsRegIsValue(UINT root, char *keyname, char *valuename); +bool MsRegIsValueEx(UINT root, char *keyname, char *valuename, bool force32bit); +bool MsRegIsValueEx2(UINT root, char *keyname, char *valuename, bool force32bit, bool force64bit); + +bool MsRegReadValueEx2(UINT root, char *keyname, char *valuename, void **data, UINT *type, UINT *size, bool force32bit, bool force64bit); +bool MsRegReadValueEx2W(UINT root, char *keyname, char *valuename, void **data, UINT *type, UINT *size, bool force32bit, bool force64bit); + +char *MsRegReadStr(UINT root, char *keyname, char *valuename); +char *MsRegReadStrEx(UINT root, char *keyname, char *valuename, bool force32bit); +char *MsRegReadStrEx2(UINT root, char *keyname, char *valuename, bool force32bit, bool force64bit); +wchar_t *MsRegReadStrW(UINT root, char *keyname, char *valuename); +wchar_t *MsRegReadStrExW(UINT root, char *keyname, char *valuename, bool force32bit); +wchar_t *MsRegReadStrEx2W(UINT root, char *keyname, char *valuename, bool force32bit, bool force64bit); + +UINT MsRegReadInt(UINT root, char *keyname, char *valuename); +UINT MsRegReadIntEx(UINT root, char *keyname, char *valuename, bool force32bit); +UINT MsRegReadIntEx2(UINT root, char *keyname, char *valuename, bool force32bit, bool force64bit); +LIST *MsRegReadStrList(UINT root, char *keyname, char *valuename); +LIST *MsRegReadStrListEx(UINT root, char *keyname, char *valuename, bool force32bit); +LIST *MsRegReadStrListEx2(UINT root, char *keyname, char *valuename, bool force32bit, bool force64bit); + +BUF *MsRegReadBin(UINT root, char *keyname, char *valuename); +BUF *MsRegReadBinEx(UINT root, char *keyname, char *valuename, bool force32bit); +BUF *MsRegReadBinEx2(UINT root, char *keyname, char *valuename, bool force32bit, bool force64bit); + +bool MsRegNewKeyEx2(UINT root, char *keyname, bool force32bit, bool force64bit); + +bool MsRegWriteValueEx2(UINT root, char *keyname, char *valuename, UINT type, void *data, UINT size, bool force32bit, bool force64bit); +bool MsRegWriteValueEx2W(UINT root, char *keyname, char *valuename, UINT type, void *data, UINT size, bool force32bit, bool force64bit); + +bool MsRegWriteStr(UINT root, char *keyname, char *valuename, char *str); +bool MsRegWriteStrEx(UINT root, char *keyname, char *valuename, char *str, bool force32bit); +bool MsRegWriteStrEx2(UINT root, char *keyname, char *valuename, char *str, bool force32bit, bool force64bit); +bool MsRegWriteStrExpand(UINT root, char *keyname, char *valuename, char *str); +bool MsRegWriteStrExpandEx(UINT root, char *keyname, char *valuename, char *str, bool force32bit); +bool MsRegWriteStrExpandEx2(UINT root, char *keyname, char *valuename, char *str, bool force32bit, bool force64bit); +bool MsRegWriteStrW(UINT root, char *keyname, char *valuename, wchar_t *str); +bool MsRegWriteStrExW(UINT root, char *keyname, char *valuename, wchar_t *str, bool force32bit); +bool MsRegWriteStrEx2W(UINT root, char *keyname, char *valuename, wchar_t *str, bool force32bit, bool force64bit); +bool MsRegWriteStrExpandW(UINT root, char *keyname, char *valuename, wchar_t *str); +bool MsRegWriteStrExpandExW(UINT root, char *keyname, char *valuename, wchar_t *str, bool force32bit); +bool MsRegWriteStrExpandEx2W(UINT root, char *keyname, char *valuename, wchar_t *str, bool force32bit, bool force64bit); + +bool MsRegWriteInt(UINT root, char *keyname, char *valuename, UINT value); +bool MsRegWriteIntEx(UINT root, char *keyname, char *valuename, UINT value, bool force32bit); +bool MsRegWriteIntEx2(UINT root, char *keyname, char *valuename, UINT value, bool force32bit, bool force64bit); +bool MsRegWriteBin(UINT root, char *keyname, char *valuename, void *data, UINT size); +bool MsRegWriteBinEx(UINT root, char *keyname, char *valuename, void *data, UINT size, bool force32bit); +bool MsRegWriteBinEx2(UINT root, char *keyname, char *valuename, void *data, UINT size, bool force32bit, bool force64bit); + +TOKEN_LIST *MsRegEnumKey(UINT root, char *keyname); +TOKEN_LIST *MsRegEnumKeyEx(UINT root, char *keyname, bool force32bit); +TOKEN_LIST *MsRegEnumKeyEx2(UINT root, char *keyname, bool force32bit, bool force64bit); +TOKEN_LIST *MsRegEnumValue(UINT root, char *keyname); +TOKEN_LIST *MsRegEnumValueEx(UINT root, char *keyname, bool force32bit); +TOKEN_LIST *MsRegEnumValueEx2(UINT root, char *keyname, bool force32bit, bool force64bit); + +bool MsRegDeleteKey(UINT root, char *keyname); +bool MsRegDeleteKeyEx(UINT root, char *keyname, bool force32bit); +bool MsRegDeleteKeyEx2(UINT root, char *keyname, bool force32bit, bool force64bit); +bool MsRegDeleteValue(UINT root, char *keyname, char *valuename); +bool MsRegDeleteValueEx(UINT root, char *keyname, char *valuename, bool force32bit); +bool MsRegDeleteValueEx2(UINT root, char *keyname, char *valuename, bool force32bit, bool force64bit); + +bool MsRegLoadHive(UINT root, wchar_t *keyname, wchar_t *filename); +bool MsRegUnloadHive(UINT root, wchar_t *keyname); + +bool MsIsNt(); +bool MsIsAdmin(); +bool MsIsWine(); +bool MsEnablePrivilege(char *name, bool enable); +void *MsGetCurrentProcess(); +UINT MsGetCurrentProcessId(); +char *MsGetExeFileName(); +char *MsGetExeDirName(); +wchar_t *MsGetExeDirNameW(); + +void MsStartIsLockedThread(); +void MsStopIsLockedThread(); + +bool MsShutdown(bool reboot, bool force); +bool MsCheckLogon(wchar_t *username, char *password); +TOKEN_LIST *MsEnumNetworkAdapters(char *start_with_name, char *start_with_name_2); +TOKEN_LIST *MsEnumNetworkAdaptersNeo(); +bool MsGetNeoDriverFilename(char *name, UINT size, char *instance_name); +bool MsMakeNewNeoDriverFilename(char *name, UINT size); +void MsGenerateNeoDriverFilenameFromInt(char *name, UINT size, UINT n); +TOKEN_LIST *MsEnumNeoDriverFilenames(); +char *MsGetNetworkAdapterGuid(char *tag_name, char *instance_name); +wchar_t *MsGetNetworkConnectionName(char *guid); +char *MsGetNetworkConfigRegKeyNameFromGuid(char *guid); +char *MsGetNetworkConfigRegKeyNameFromInstanceName(char *tag_name, char *instance_name); +void MsSetNetworkConfig(char *tag_name, char *instance_name, char *friendly_name, bool show_icon); +void MsInitNetworkConfig(char *tag_name, char *instance_name, char *connection_tag_name); +void MsNormalizeInterfaceDefaultGatewaySettings(char *tag_name, char *instance_name); + +char *MsGetSpecialDir(int id); +wchar_t *MsGetSpecialDirW(int id); +void MsGetSpecialDirs(); +bool MsCheckIsAdmin(); +void MsInitTempDir(); +void MsFreeTempDir(); +void MsGenLockFile(wchar_t *name, UINT size, wchar_t *temp_dir); +void MsDeleteTempDir(); +void MsDeleteAllFile(char *dir); +void MsDeleteAllFileW(wchar_t *dir); + +bool MsInstallVLan(char *tag_name, char *connection_tag_name, char *instance_name, MS_DRIVER_VER *ver); +bool MsInstallVLanWithoutLock(char *tag_name, char *connection_tag_name, char *instance_name, MS_DRIVER_VER *ver); +bool MsInstallVLanInternal(wchar_t *infpath, wchar_t *hwid_w, char *hwid); +bool MsUpgradeVLan(char *tag_name, char *connection_tag_name, char *instance_name, MS_DRIVER_VER *ver); +bool MsUpgradeVLanWithoutLock(char *tag_name, char *connection_tag_name, char *instance_name, MS_DRIVER_VER *ver); +bool MsEnableVLan(char *instance_name); +bool MsEnableVLanWithoutLock(char *instance_name); +bool MsDisableVLan(char *instance_name); +bool MsDisableVLanWithoutLock(char *instance_name); +bool MsUninstallVLan(char *instance_name); +bool MsUninstallVLanWithoutLock(char *instance_name); +bool MsIsVLanEnabled(char *instance_name); +bool MsIsVLanEnabledWithoutLock(char *instance_name); +bool MsIsValidVLanInstanceNameForInfCatalog(char *instance_name); +void MsGetInfCatalogDir(char *dst, UINT size); +void MsRestartVLan(char *instance_name); +void MsRestartVLanWithoutLock(char *instance_name); +bool MsIsVLanExists(char *tag_name, char *instance_name); +void MsDeleteTroubleVLAN(char *tag_name, char *instance_name); +bool MsStartDriverInstall(char *instance_name, UCHAR *mac_address, char *neo_sys, UCHAR *ret_mac_address, MS_DRIVER_VER *ver); +void MsFinishDriverInstall(char *instance_name, char *neo_sys); +void MsGetDriverPath(char *instance_name, wchar_t *src_inf, wchar_t *src_sys, wchar_t *dest_inf, wchar_t *dest_sys, wchar_t *src_cat, wchar_t *dest_cat, char *neo_sys); +void MsGetDriverPathA(char *instance_name, char *src_inf, char *src_sys, char *dest_inf, char *dest_sys, char *src_cat, char *dst_cat, char *neo_sys); +void MsGenMacAddress(UCHAR *mac); +char *MsGetMacAddress(char *tag_name, char *instance_name); +void MsSetMacAddress(char *tag_name, char *instance_name, char *mac_address); +char *MsGetDriverVersion(char *tag_name, char *instance_name); +char *MsGetDriverFileName(char *tag_name, char *instance_name); +void MsTest(); +void MsInitGlobalNetworkConfig(); +void MsDisableNetworkOffloadingEtc(); +void MsSetThreadPriorityHigh(); +void MsSetThreadPriorityIdle(); +void MsSetThreadPriorityRealtime(); +void MsRestoreThreadPriority(); +char *MsGetWindowsDir(); +char *MsGetSystem32Dir(); +char *MsGetTempDir(); +char *MsGetProgramFilesDir(); +char *MsGetCommonStartupDir(); +char *MsGetMyTempDir(); +wchar_t *MsGetWindowsDirW(); +wchar_t *MsGetExeFileNameW(); +wchar_t *MsGetExeFileDirW(); +wchar_t *MsGetSystem32DirW(); +wchar_t *MsGetTempDirW(); +wchar_t *MsGetProgramFilesDirX64W(); +wchar_t *MsGetCommonStartMenuDirW(); +wchar_t *MsGetCommonProgramsDirW(); +wchar_t *MsGetCommonStartupDirW(); +wchar_t *MsGetCommonDesktopDirW(); +wchar_t *MsGetPersonalStartMenuDirW(); +wchar_t *MsGetPersonalProgramsDirW(); +wchar_t *MsGetPersonalStartupDirW(); +wchar_t *MsGetPersonalAppDataDirW(); +wchar_t *MsGetPersonalDesktopDirW(); +wchar_t *MsGetMyTempDirW(); +wchar_t *MsGetUserNameW(); +struct SAFE_TABLE *MsGetSafeTable(); +UINT MsGetProcessId(); +void MsTerminateProcess(); +bool MsIsServiceInstalled(char *name); +bool MsInstallServiceExW(char *name, wchar_t *title, wchar_t *description, wchar_t *path, UINT *error_code); +bool MsInstallServiceW(char *name, wchar_t *title, wchar_t *description, wchar_t *path); +bool MsInstallDeviceDriverW(char *name, wchar_t *title, wchar_t *path, UINT *error_code); +bool MsUpdateServiceConfig(char *name); +bool MsSetServiceDescription(char *name, wchar_t *description); +bool MsUninstallService(char *name); +bool MsStartService(char *name); +bool MsStartServiceEx(char *name, UINT *error_code); +bool MsStopService(char *name); +bool MsIsServiceRunning(char *name); +bool MsIsTerminalServiceInstalled(); +bool MsIsUserSwitchingInstalled(); +UINT MsGetCurrentTerminalSessionId(); +bool MsIsTerminalSessionActive(UINT session_id); +bool MsIsCurrentTerminalSessionActive(); +wchar_t *MsGetSessionUserName(UINT session_id); +UINT MsService(char *name, SERVICE_FUNCTION *start, SERVICE_FUNCTION *stop, UINT icon, char *cmd_line); +void MsTestModeW(wchar_t *title, SERVICE_FUNCTION *start, SERVICE_FUNCTION *stop); +void MsTestMode(char *title, SERVICE_FUNCTION *start, SERVICE_FUNCTION *stop); +void MsServiceMode(SERVICE_FUNCTION *start, SERVICE_FUNCTION *stop); +void MsUserModeW(wchar_t *title, SERVICE_FUNCTION *start, SERVICE_FUNCTION *stop, UINT icon); +bool MsIsUserMode(); +void MsTestOnly(); +void MsPlaySound(char *name); +void MsSetThreadSingleCpu(); +void MsWin9xTest(); +bool MsCheckVLanDeviceIdFromRootEnum(char *name); +bool MsInstallVLan9x(char *instance_name, MS_DRIVER_VER *ver); +void MsUpdateCompatibleIDs(char *instance_name); +LIST *MsGetProcessList(); +LIST *MsGetProcessList9x(); +LIST *MsGetProcessListNt(); +void MsFreeProcessList(LIST *o); +int MsCompareProcessList(void *p1, void *p2); +MS_PROCESS *MsSearchProcessById(LIST *o, UINT id); +void MsGetCurrentProcessExeNameW(wchar_t *name, UINT size); +bool MsKillProcess(UINT id); +UINT MsKillProcessByExeName(wchar_t *name); +void MsKillOtherInstance(); +void MsKillOtherInstanceEx(char *exclude_svcname); +bool MsGetShortPathNameA(char *long_path, char *short_path, UINT short_path_size); +bool MsGetShortPathNameW(wchar_t *long_path, wchar_t *short_path, UINT short_path_size); +void MsWriteCallingServiceManagerProcessId(char *svcname, UINT pid); +UINT MsReadCallingServiceManagerProcessId(char *svcname, bool current_user); +bool MsStopIPsecService(); +char *MsGetIPsecServiceName(); +bool MsStartIPsecService(); + +void MsGenerateUserModeSvcGlobalPulseName(char *name, UINT size, char *svc_name); +void *MsCreateUserModeSvcGlocalPulse(char *svc_name); +void MsStopUserModeSvc(char *svc_name); +void MsUserModeGlobalPulseRecvThread(THREAD *thread, void *param); + +MS_ADAPTER_LIST *MsCreateAdapterListInner(); +MS_ADAPTER_LIST *MsCreateAdapterListInnerEx(bool no_info); +MS_ADAPTER_LIST *MsCreateAdapterListInnerExVista(bool no_info); +void MsFreeAdapter(MS_ADAPTER *a); +void MsFreeAdapterList(MS_ADAPTER_LIST *o); +wchar_t *MsGetAdapterTypeStr(UINT type); +wchar_t *MsGetAdapterStatusStr(UINT status); +MS_ADAPTER *MsCloneAdapter(MS_ADAPTER *a); +MS_ADAPTER_LIST *MsCloneAdapterList(MS_ADAPTER_LIST *o); +void MsInitAdapterListModule(); +void MsFreeAdapterListModule(); +MS_ADAPTER_LIST *MsCreateAdapterList(); +MS_ADAPTER_LIST *MsCreateAdapterListEx(bool no_info); +void MsGetAdapterTcpIpInformation(MS_ADAPTER *a); +MS_ADAPTER *MsGetAdapter(char *title); +MS_ADAPTER *MsGetAdapterByGuid(char *guid); +MS_ADAPTER *MsGetAdapterByGuidFromList(MS_ADAPTER_LIST *o, char *guid); +UINT ConvertMidStatusVistaToXp(UINT st); + +void *MsLoadLibrary(char *name); +void *MsLoadLibraryW(wchar_t *name); +void *MsLoadLibraryAsDataFile(char *name); +void *MsLoadLibraryAsDataFileW(wchar_t *name); + +void MsPrintTick(); +bool MsDisableIme(); + +void MsGetTcpConfig(MS_TCP *tcp); +void MsSetTcpConfig(MS_TCP *tcp); +void MsSaveTcpConfigReg(MS_TCP *tcp); +bool MsLoadTcpConfigReg(MS_TCP *tcp); +bool MsIsTcpConfigSupported(); +void MsApplyTcpConfig(); +bool MsIsShouldShowTcpConfigApp(); +void MsDeleteTcpConfigReg(); + +UINT MsGetConsoleWidth(); +UINT MsSetConsoleWidth(UINT size); +NO_WARNING *MsInitNoWarning(); +NO_WARNING *MsInitNoWarningEx(UINT start_timer); +void MsFreeNoWarning(NO_WARNING *nw); +void MsNoWarningThreadProc(THREAD *thread, void *param); +char *MsNoWarningSoundInit(); +void MsNoWarningSoundFree(char *s); +bool MsCloseWarningWindow(NO_WARNING *nw, UINT thread_id); +LIST *MsEnumChildWindows(LIST *o, HWND hWnd); +void MsAddWindowToList(LIST *o, HWND hWnd); +UINT MsGetThreadLocale(); +LIST *NewWindowList(); +int CmpWindowList(void *p1, void *p2); +void AddWindow(LIST *o, HWND hWnd); +void FreeWindowList(LIST *o); +LIST *EnumAllChildWindow(HWND hWnd); +LIST *EnumAllChildWindowEx(HWND hWnd, bool no_recursion, bool include_ipcontrol, bool no_self); +LIST *EnumAllTopWindow(); + +bool MsExecDriverInstaller(char *arg); +bool MsIsVista(); +bool MsIsWin2000OrGreater(); +bool MsIsWinXPOrGreater(); +void MsRegistWindowsFirewallEx(char *title, char *exe); +void MsRegistWindowsFirewallEx2(char *title, char *exe, char *dir); +bool MsIs64BitWindows(); +bool MsIsX64(); +bool MsIsIA64(); +void *MsDisableWow64FileSystemRedirection(); +void MsRestoreWow64FileSystemRedirection(void *p); +bool MsIsWindows10(); +bool MsIsWindows81(); +bool MsIsWindows8(); +bool MsIsWindows7(); +bool MsIsInfCatalogRequired(); + +bool MsCheckFileDigitalSignatureW(HWND hWnd, wchar_t *name, bool *danger); + +bool MsIsKB3033929RequiredAndMissing(); +bool MsIsSha2KernelModeSignatureSupported(); + +bool MsGetProcessExeName(char *path, UINT size, UINT id); +bool MsGetWindowOwnerProcessExeName(char *path, UINT size, HWND hWnd); + +void *MsRunAsUserExW(wchar_t *filename, wchar_t *arg, bool hide); +void *MsRunAsUserExInnerW(wchar_t *filename, wchar_t *arg, bool hide); + +UINT MsGetCursorPosHash(); + +void MsGetComputerName(char *name, UINT size); +void MsGetComputerNameFullEx(wchar_t *name, UINT size, bool with_cache); +UINT64 MsGetScreenSaverTimeout(); + +bool MsUniMakeDir(wchar_t *name); +void MsUniMakeDirEx(wchar_t *name); +bool MsMakeDir(char *name); +bool MsExecute(char *exe, char *arg); +bool MsExecute2(char *exe, char *arg, bool runas); +bool MsExecuteW(wchar_t *exe, wchar_t *arg); +bool MsExecute2W(wchar_t *exe, wchar_t *arg, bool runas); +bool MsExecuteEx(char *exe, char *arg, void **process_handle); +bool MsExecuteEx2(char *exe, char *arg, void **process_handle, bool runas); +bool MsExecuteEx2W(wchar_t *exe, wchar_t *arg, void **process_handle, bool runas); +void MsCloseHandle(void *handle); +UINT MsWaitProcessExit(void *process_handle); +void MsUpdateSystem(); +UINT64 MsGetHiResCounter(); +double MsGetHiResTimeSpan(UINT64 diff); +UINT64 MsGetHiResTimeSpanUSec(UINT64 diff); +void MsRestartMMCSS(); +bool MsIsMMCSSNetworkThrottlingEnabled(); +void MsSetMMCSSNetworkThrottlingEnable(bool enable); +void MsSetShutdownParameters(UINT level, UINT flag); +bool MsIsWinXPOrWinVista(); +bool MsGetFileInformation(void *h, void *info); +void MsSetErrorModeToSilent(); +void MsSetEnableMinidump(bool enabled); +bool MsIsMinidumpEnabled(); +void MsWriteMinidump(wchar_t *filename, void *ex); + + +void *MsInitGlobalLock(char *name, bool ts_local); +void MsGlobalLock(void *p); +void MsGlobalUnlock(void *p); +void MsFreeGlobalLock(void *p); + +void *MsOpenOrCreateGlobalPulse(char *name); +bool MsWaitForGlobalPulse(void *p, UINT timeout); +void MsCloseGlobalPulse(void *p); +void MsSendGlobalPulse(void *p); + +bool MsPerformMsChapV2AuthByLsa(char *username, UCHAR *challenge8, UCHAR *client_response_24, UCHAR *ret_pw_hash_hash); + +void MsDisableWcmNetworkMinimize(); +bool MsSetFileSecureAcl(wchar_t *path); + +bool MsGetMsiInstalledDir(char *component_code, wchar_t *dir, UINT dir_size); +bool MsMsiUninstall(char *product_code, HWND hWnd, bool *reboot_required); + +UINT MsGetUserLocaleId(); +bool MsIsCurrentUserLocaleIdJapanese(); + +TOKEN_LIST *MsEnumResources(void *hModule, char *type); +void *MsGetCurrentModuleHandle(); + +bool MsIsAeroEnabled(); +bool MsIsAeroColor(); + +bool MsIsInVmMain(); +bool MsIsInVm(); + +void MsTest(); + +bool MsSaveSystemInfo(wchar_t *dst_filename); +bool MsCollectVpnInfo(BUF *bat, char *tmpdir, char *svc_name, wchar_t *config_name, wchar_t *logdir_name); +void MsInitProcessCallOnce(); + +MS_SUSPEND_HANDLER *MsNewSuspendHandler(); +void MsFreeSuspendHandler(MS_SUSPEND_HANDLER *h); + +void MsBeginVLanCard(); +void MsEndVLanCard(); +bool MsIsVLanCardShouldStop(); +void MsProcEnterSuspend(); +void MsProcLeaveSuspend(); +UINT64 MsGetSuspendModeBeginTick(); + +// Inner functions +#ifdef MICROSOFT_C + +LONG CALLBACK MsExceptionHandler(struct _EXCEPTION_POINTERS *ExceptionInfo); +HKEY MsGetRootKeyFromInt(UINT root); +NT_API *MsLoadNtApiFunctions(); +void MsFreeNtApiFunctions(NT_API *nt); +void MsDestroyDevInfo(HDEVINFO info); +HDEVINFO MsGetDevInfoFromDeviceId(SP_DEVINFO_DATA *dev_info_data, char *device_id); +bool MsStartDevice(HDEVINFO info, SP_DEVINFO_DATA *dev_info_data); +bool MsStopDevice(HDEVINFO info, SP_DEVINFO_DATA *dev_info_data); +bool MsDeleteDevice(HDEVINFO info, SP_DEVINFO_DATA *dev_info_data); +bool MsIsDeviceRunning(HDEVINFO info, SP_DEVINFO_DATA *dev_info_data); +void CALLBACK MsServiceDispatcher(UINT argc, LPTSTR *argv); +void CALLBACK MsServiceHandler(UINT opcode); +bool MsServiceStopProc(); +void MsServiceStoperMainThread(THREAD *t, void *p); +void MsServiceStarterMainThread(THREAD *t, void *p); +LRESULT CALLBACK MsUserModeWindowProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam); +bool MsShowIconOnTray(HWND hWnd, HICON icon, wchar_t *tooltip, UINT msg); +void MsRestoreIconOnTray(); +void MsChangeIconOnTray(HICON icon, wchar_t *tooltip); +bool MsChangeIconOnTrayEx(HICON icon, wchar_t *tooltip, wchar_t *info_title, wchar_t *info, UINT info_flags, bool add); +void MsHideIconOnTray(); +void MsUserModeTrayMenu(HWND hWnd); +bool MsAppendMenu(HMENU hMenu, UINT flags, UINT_PTR id, wchar_t *str); +bool MsInsertMenu(HMENU hMenu, UINT pos, UINT flags, UINT_PTR id_new_item, wchar_t *lp_new_item); +bool CALLBACK MsEnumChildWindowProc(HWND hWnd, LPARAM lParam); +BOOL CALLBACK EnumTopWindowProc(HWND hWnd, LPARAM lParam); +bool CALLBACK MsEnumThreadWindowProc(HWND hWnd, LPARAM lParam); +HANDLE MsCreateUserToken(); +SID *MsGetSidFromAccountName(char *name); +void MsFreeSid(SID *sid); +bool CALLBACK MsEnumResourcesInternalProc(HMODULE hModule, const char *type, char *name, LONG_PTR lParam); +LRESULT CALLBACK MsSuspendHandlerWindowProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam); +void MsSuspendHandlerThreadProc(THREAD *thread, void *param); + + + +#endif // MICROSOFT_C + +#endif // MICROSOFT_H + +#endif // OS_WIN32 + diff --git a/src/Mayaqua/Network.c b/src/Mayaqua/Network.c index 5a86df41..502eac5d 100644 --- a/src/Mayaqua/Network.c +++ b/src/Mayaqua/Network.c @@ -1,20887 +1,20887 @@ -// SoftEther VPN Source Code - Developer Edition Master Branch -// Mayaqua Kernel - - -// Network.c -// Network communication module - -#include - -#define ENCRYPT_C -#define NETWORK_C - -#define __WINCRYPT_H__ - -#ifdef WIN32 -// Include windows.h for Socket API -#define _WIN32_WINNT 0x0502 -#define WINVER 0x0502 -#include -#include -#include -#include -#include -#include -#include -#include -#endif // WIN32 - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#ifdef UNIX_MACOS -#include -#endif // UNIX_MACOS - -#ifdef OS_WIN32 -NETWORK_WIN32_FUNCTIONS *w32net; -struct ROUTE_CHANGE_DATA -{ - OVERLAPPED Overlapped; - HANDLE Handle; - UINT NumCalled; -}; -#endif // OS_WIN32 - -// Whether the blocking occurs in SSL -#if defined(UNIX_BSD) || defined(UNIX_MACOS) -#define FIX_SSL_BLOCKING -#endif - -// IPV6_V6ONLY constant -#ifdef UNIX_LINUX -#ifndef IPV6_V6ONLY -#define IPV6_V6ONLY 26 -#endif // IPV6_V6ONLY -#endif // UNIX_LINUX - -#ifdef UNIX_SOLARIS -#ifndef IPV6_V6ONLY -#define IPV6_V6ONLY 0x27 -#endif // IPV6_V6ONLY -#endif // UNIX_SOLARIS - -// HTTP constant -static char http_detect_server_startwith[] = "\r\n\r\n403 Forbidden\r\n\r\n

Forbidden

\r\nYou don't have permission to access "; -static char http_detect_server_tag_future[] = "9C37197CA7C2428388C2E6E59B829B30"; - -// DNS cache list -static LIST *DnsCache; - -// Lock related -static LOCK *machine_name_lock = NULL; -static LOCK *disconnect_function_lock = NULL; -static LOCK *aho = NULL; -static LOCK *socket_library_lock = NULL; -extern LOCK *openssl_lock; -static LOCK *ssl_accept_lock = NULL; -static LOCK *ssl_connect_lock = NULL; -static COUNTER *num_tcp_connections = NULL; -static LOCK *dns_lock = NULL; -static LOCK *unix_dns_server_addr_lock = NULL; -static IP unix_dns_server; -static LIST *HostCacheList = NULL; -static LIST *WaitThreadList = NULL; -static bool disable_cache = false; -static bool NetworkReleaseMode = false; // Network release mode -static UCHAR machine_ip_process_hash[SHA1_SIZE]; -static LOCK *machine_ip_process_hash_lock = NULL; -static LOCK *current_global_ip_lock = NULL; -static LOCK *current_fqdn_lock = NULL; -static bool current_global_ip_set = false; -static IP current_glocal_ipv4 = {0}; -static IP current_glocal_ipv6 = {0}; -static char current_fqdn[MAX_SIZE]; -static bool g_no_rudp_server = false; -static bool g_no_rudp_register = false; -static bool g_natt_low_priority = false; -static LOCK *host_ip_address_list_cache_lock = NULL; -static UINT64 host_ip_address_list_cache_last = 0; -static LIST *host_ip_address_cache = NULL; -static bool disable_gethostname_by_accept = false; -static COUNTER *getip_thread_counter = NULL; -static UINT max_getip_thread = 0; - - -static LIST *ip_clients = NULL; - -static LIST *local_mac_list = NULL; -static LOCK *local_mac_list_lock = NULL; - -static UINT rand_port_numbers[256] = {0}; - - -static bool g_use_privateip_file = false; -static bool g_source_ip_validation_force_disable = false; - -static DH_CTX *dh_param = NULL; - -typedef struct PRIVATE_IP_SUBNET -{ - UINT Ip, Mask, Ip2; -} PRIVATE_IP_SUBNET; - -static LIST *g_private_ip_list = NULL; - - -static LIST *g_dyn_value_list = NULL; - - - -//#define RUDP_DETAIL_LOG - - - - -// Get a value from a dynamic value list (Returns a default value if the value is not found) -UINT64 GetDynValueOrDefault(char *name, UINT64 default_value, UINT64 min_value, UINT64 max_value) -{ - UINT64 ret = GetDynValue(name); - - if (ret == 0) - { - return default_value; - } - - if (ret < min_value) - { - ret = min_value; - } - - if (ret > max_value) - { - ret = max_value; - } - - return ret; -} - -// Get a value from a dynamic value list (Returns a default value if the value is not found) -// The value is limited to 1/5 to 50 times of the default value for safety -UINT64 GetDynValueOrDefaultSafe(char *name, UINT64 default_value) -{ - return GetDynValueOrDefault(name, default_value, default_value / (UINT64)5, default_value * (UINT64)50); -} - -// Get a value from a dynamic value list -UINT64 GetDynValue(char *name) -{ - UINT64 ret = 0; - // Validate arguments - if (name == NULL) - { - return 0; - } - - if (g_dyn_value_list == NULL) - { - return 0; - } - - LockList(g_dyn_value_list); - { - UINT i; - - for (i = 0; i < LIST_NUM(g_dyn_value_list); i++) - { - DYN_VALUE *vv = LIST_DATA(g_dyn_value_list, i); - - if (StrCmpi(vv->Name, name) == 0) - { - ret = vv->Value; - break; - } - } - } - UnlockList(g_dyn_value_list); - - return ret; -} - -// Set the value to the dynamic value list -void SetDynListValue(char *name, UINT64 value) -{ - // Validate arguments - if (name == NULL) - { - return; - } - - if (g_dyn_value_list == NULL) - { - return; - } - - LockList(g_dyn_value_list); - { - UINT i; - DYN_VALUE *v = NULL; - - for (i = 0; i < LIST_NUM(g_dyn_value_list); i++) - { - DYN_VALUE *vv = LIST_DATA(g_dyn_value_list, i); - - if (StrCmpi(vv->Name, name) == 0) - { - v = vv; - break; - } - } - - if (v == NULL) - { - v = ZeroMalloc(sizeof(DYN_VALUE)); - StrCpy(v->Name, sizeof(v->Name), name); - - Add(g_dyn_value_list, v); - } - - v->Value = value; - } - UnlockList(g_dyn_value_list); -} - -// Apply by extracting dynamic value list from the specified PACK -void ExtractAndApplyDynList(PACK *p) -{ - BUF *b; - // Validate arguments - if (p == NULL) - { - return; - } - - b = PackGetBuf(p, "DynList"); - if (b == NULL) - { - return; - } - - AddDynList(b); - - FreeBuf(b); -} - -// Insert the data to the dynamic value list -void AddDynList(BUF *b) -{ - PACK *p; - TOKEN_LIST *t; - // Validate arguments - if (b == NULL) - { - return; - } - - SeekBufToBegin(b); - - p = BufToPack(b); - if (p == NULL) - { - return; - } - - t = GetPackElementNames(p); - if (t != NULL) - { - UINT i; - - for (i = 0; i < t->NumTokens; i++) - { - char *name = t->Token[i]; - UINT64 v = PackGetInt64(p, name); - - SetDynListValue(name, v); - } - - FreeToken(t); - } - - FreePack(p); -} - -// Initialization of the dynamic value list -void InitDynList() -{ - g_dyn_value_list = NewList(NULL); -} - -// Solution of dynamic value list -void FreeDynList() -{ - UINT i; - if (g_dyn_value_list == NULL) - { - return; - } - - for (i = 0; i < LIST_NUM(g_dyn_value_list); i++) - { - DYN_VALUE *d = LIST_DATA(g_dyn_value_list, i); - - Free(d); - } - - ReleaseList(g_dyn_value_list); - - g_dyn_value_list = NULL; -} - -// Disable NAT-T function globally -void DisableRDUPServerGlobally() -{ - g_no_rudp_server = true; -} - -// Get the current time zone -int GetCurrentTimezone() -{ - int ret = 0; - -#ifdef OS_WIN32 - ret = GetCurrentTimezoneWin32(); -#else // OS_WIN32 - { -#if defined(UNIX_MACOS) || defined(UNIX_BSD) - struct timeval tv; - struct timezone tz; - - Zero(&tv, sizeof(tv)); - Zero(&tz, sizeof(tz)); - - gettimeofday(&tv, &tz); - - ret = tz.tz_minuteswest; - -#else // defined(UNIX_MACOS) || defined(UNIX_BSD) - tzset(); - - ret = timezone / 60; -#endif // defined(UNIX_MACOS) || defined(UNIX_BSD) - } -#endif // OS_WIN32 - - return ret; -} - -// Flag of whether to use the DNS proxy -bool IsUseDnsProxy() -{ - return false; -} - -// Flag of whether to use an alternate host name -bool IsUseAlternativeHostname() -{ - - return false; -} - -#ifdef OS_WIN32 -// Get the current time zone (Win32) -int GetCurrentTimezoneWin32() -{ - TIME_ZONE_INFORMATION info; - Zero(&info, sizeof(info)); - - if (GetTimeZoneInformation(&info) == TIME_ZONE_ID_INVALID) - { - return 0; - } - - return info.Bias; -} -#endif // OS_WIN32 - - -// Set the current FQDN of the DDNS -void SetCurrentDDnsFqdn(char *name) -{ - // Validate arguments - if (name == NULL) - { - return; - } - - Lock(current_fqdn_lock); - { - StrCpy(current_fqdn, sizeof(current_fqdn), name); - } - Unlock(current_fqdn_lock); -} - -// Get the current DDNS FQDN hash -UINT GetCurrentDDnsFqdnHash() -{ - UINT ret; - UCHAR hash[SHA1_SIZE]; - char name[MAX_SIZE]; - - ClearStr(name, sizeof(name)); - GetCurrentDDnsFqdn(name, sizeof(name)); - - Trim(name); - StrUpper(name); - - Sha1(hash, name, StrLen(name)); - - Copy(&ret, hash, sizeof(UINT)); - - return ret; -} - -// Get the current DDNS FQDN -void GetCurrentDDnsFqdn(char *name, UINT size) -{ - ClearStr(name, size); - // Validate arguments - if (name == NULL || size == 0) - { - return; - } - - Lock(current_fqdn_lock); - { - StrCpy(name, size, current_fqdn); - } - Unlock(current_fqdn_lock); - - Trim(name); -} - -// Check whether the specified MAC address exists on the local host (high speed) -bool IsMacAddressLocalFast(void *addr) -{ - bool ret = false; - // Validate arguments - if (addr == NULL) - { - return false; - } - - Lock(local_mac_list_lock); - { - if (local_mac_list == NULL) - { - // First enumeration - RefreshLocalMacAddressList(); - } - - ret = IsMacAddressLocalInner(local_mac_list, addr); - } - Unlock(local_mac_list_lock); - - return ret; -} - -// Update the local MAC address list -void RefreshLocalMacAddressList() -{ - Lock(local_mac_list_lock); - { - if (local_mac_list != NULL) - { - FreeNicList(local_mac_list); - } - - local_mac_list = GetNicList(); - } - Unlock(local_mac_list_lock); -} - -// Check whether the specified MAC address exists on the local host -bool IsMacAddressLocalInner(LIST *o, void *addr) -{ - bool ret = false; - UINT i; - // Validate arguments - if (o == NULL || addr == NULL) - { - return false; - } - - for (i = 0; i < LIST_NUM(o); i++) - { - NIC_ENTRY *e = LIST_DATA(o, i); - - if (Cmp(e->MacAddress, addr, 6) == 0) - { - ret = true; - break; - } - } - - return ret; -} - -// Get a list of the NICs on the computer -LIST *GetNicList() -{ - LIST *o = NULL; - -#ifdef OS_WIN32 - o = Win32GetNicList(); - - if (o != NULL) - { - return o; - } - -#endif // OS_WIN32 - - return NewListFast(NULL); -} - -#ifdef OS_WIN32 -LIST *Win32GetNicList() -{ - UINT i; - LIST *o = NewListFast(NULL); - MS_ADAPTER_LIST *al = MsCreateAdapterList(); - - if (al == NULL) - { - return NULL; - } - - for (i = 0; i < al->Num; i++) - { - MS_ADAPTER *a = al->Adapters[i]; - - if (a->Type == 6 && a->AddressSize == 6) - { - NIC_ENTRY *e = ZeroMalloc(sizeof(NIC_ENTRY)); - - StrCpy(e->IfName, sizeof(e->IfName), a->Title); - Copy(e->MacAddress, a->Address, 6); - - Add(o, e); - } - } - - MsFreeAdapterList(al); - - return o; -} -#endif // OS_WIN32 - -// Release the NIC list -void FreeNicList(LIST *o) -{ - UINT i; - // Validate arguments - if (o == NULL) - { - return; - } - - for (i = 0; i < LIST_NUM(o); i++) - { - NIC_ENTRY *e = LIST_DATA(o, i); - - Free(e); - } - - ReleaseList(o); -} - -// If the computer is connected to the FLET'S line currently, detect the type of the line (obsolete) -UINT DetectFletsType() -{ - UINT ret = 0; - //LIST *o = GetHostIPAddressList(); -// UINT i; - - /* - for (i = 0;i < LIST_NUM(o);i++) - { - IP *ip = LIST_DATA(o, i); - - if (IsIP6(ip)) - { - char ip_str[MAX_SIZE]; - - IPToStr(ip_str, sizeof(ip_str), ip); - - if (IsInSameNetwork6ByStr(ip_str, "2001:c90::", "/32")) - { - // NTT East B-FLETs - ret |= FLETS_DETECT_TYPE_EAST_BFLETS_PRIVATE; - } - - if (IsInSameNetwork6ByStr(ip_str, "2408:200::", "/23")) - { - // Wrapping in network of NTT East NGN - ret |= FLETS_DETECT_TYPE_EAST_NGN_PRIVATE; - } - - if (IsInSameNetwork6ByStr(ip_str, "2001:a200::", "/23")) - { - // Wrapping in network of NTT West NGN - ret |= FLETS_DETECT_TYPE_WEST_NGN_PRIVATE; - } - } - } - - FreeHostIPAddressList(o); - */ - return ret; -} - -// Query for the IP address using the DNS proxy for the B FLETs -bool GetIPViaDnsProxyForJapanFlets(IP *ip_ret, char *hostname, bool ipv6, UINT timeout, bool *cancel, char *dns_proxy_hostname) -{ - SOCK *s; - char connect_hostname[MAX_SIZE]; - char connect_hostname2[MAX_SIZE]; - IP dns_proxy_ip; - bool ret = false; - bool dummy_flag = false; - char request_str[512]; - // Validate arguments - if (ip_ret == NULL || hostname == NULL) - { - return false; - } - if (timeout == 0) - { - timeout = BFLETS_DNS_PROXY_TIMEOUT_FOR_QUERY; - } - if (cancel == NULL) - { - cancel = &dummy_flag; - } - - // Get the IP address of the DNS proxy server - if (IsEmptyStr(dns_proxy_hostname)) - { - // B FLETs - if (GetDnsProxyIPAddressForJapanBFlets(&dns_proxy_ip, BFLETS_DNS_PROXY_TIMEOUT_FOR_GET_F, cancel) == false) - { - return false; - } - } - else - { - // FLET'S NEXT - if (GetIP4Ex6Ex2(&dns_proxy_ip, dns_proxy_hostname, FLETS_NGN_DNS_QUERY_TIMEOUT, true, cancel, true) == false) - { - return false; - } - } - - if (*cancel) - { - return false; - } - - IPToStr(connect_hostname, sizeof(connect_hostname), &dns_proxy_ip); - - /*{ - StrCpy(connect_hostname, sizeof(connect_hostname), "2409:250:62c0:100:6a05:caff:fe09:5158"); - }*/ - - StrCpy(connect_hostname2, sizeof(connect_hostname2), connect_hostname); - if (IsIP6(&dns_proxy_ip)) - { - Format(connect_hostname2, sizeof(connect_hostname2), "[%s]", connect_hostname); - } - - s = ConnectEx3(connect_hostname, BFLETS_DNS_PROXY_PORT, timeout, cancel, NULL, NULL, false, false); - - if (s == NULL) - { - return false; - } - - if (*cancel) - { - Disconnect(s); - ReleaseSock(s); - - return false; - } - - SetTimeout(s, timeout); - - // Start the SSL - if (StartSSLEx(s, NULL, NULL, 0, NULL) && (*cancel == false)) - { - UCHAR hash[SHA1_SIZE]; - BUF *hash2 = StrToBin(BFLETS_DNS_PROXY_CERT_HASH); - - Zero(hash, sizeof(hash)); - GetXDigest(s->RemoteX, hash, true); - - if (Cmp(hash, hash2->Buf, SHA1_SIZE) == 0) - { - // Send the HTTP Request - Format(request_str, sizeof(request_str), - "GET " BFLETS_DNS_PROXY_PATH "?q=%s&ipv6=%u\r\n" - "\r\n", - hostname, ipv6, connect_hostname2); - - if (SendAll(s, request_str, StrLen(request_str), true)) - { - if (*cancel == false) - { - BUF *recv_buf = NewBuf(); - UINT port_ret; - - while (true) - { - UCHAR tmp[MAX_SIZE]; - UINT r; - - r = Recv(s, tmp, sizeof(tmp), true); - - if (r == 0 || (recv_buf->Size > 65536)) - { - break; - } - else - { - WriteBuf(recv_buf, tmp, r); - } - } - - ret = RUDPParseIPAndPortStr(recv_buf->Buf, recv_buf->Size, ip_ret, &port_ret); - - FreeBuf(recv_buf); - } - } - } - - FreeBuf(hash2); - } - - Disconnect(s); - ReleaseSock(s); - - if (ret) - { - NewDnsCache(hostname, ip_ret); - } - - return ret; -} - -// Get the IP address of the available DNS proxy in B-FLET'S service that is provided by NTT East of Japan -bool GetDnsProxyIPAddressForJapanBFlets(IP *ip_ret, UINT timeout, bool *cancel) -{ - BUF *b; - LIST *o; - bool ret = false; - // Validate arguments - if (ip_ret == NULL) - { - return false; - } - if (timeout == 0) - { - timeout = BFLETS_DNS_PROXY_TIMEOUT_FOR_GET_F; - } - - b = QueryFileByUdpForJapanBFlets(timeout, cancel); - - if (b == NULL) - { - return false; - } - - o = ReadIni(b); - - if (o != NULL) - { - INI_ENTRY *e = GetIniEntry(o, "DDnsServerForBFlets"); - - if (e != NULL) - { - char *s = e->Value; - - if (IsEmptyStr(s) == false) - { - IP ip; - - if (StrToIP(&ip, s)) - { - if (IsZeroIp(&ip) == false) - { - Copy(ip_ret, &ip, sizeof(IP)); - ret = true; - } - } - } - } - } - - FreeIni(o); - FreeBuf(b); - - return ret; -} - -// Get a valid F.txt file in B-FLET'S service that is provided by NTT East of Japan -BUF *QueryFileByUdpForJapanBFlets(UINT timeout, bool *cancel) -{ - bool dummy_flag = false; - BUF *txt_buf = NULL; - BUF *ret = NULL; - LIST *ip_list = NULL; - UINT i; - // Validate arguments - if (cancel == NULL) - { - cancel = &dummy_flag; - } - if (timeout == 0) - { - timeout = BFLETS_DNS_PROXY_TIMEOUT_FOR_GET_F; - } - - txt_buf = ReadDump(UDP_FILE_QUERY_BFLETS_TXT_FILENAME); - if (txt_buf == NULL) - { - return NULL; - } - - ip_list = NewListFast(NULL); - - while (true) - { - char *line = CfgReadNextLine(txt_buf); - if (line == NULL) - { - break; - } - - Trim(line); - - if (IsEmptyStr(line) == false && StartWith(line, "#") == false) - { - IP ip; - - if (StrToIP6(&ip, line)) - { - if (IsZeroIp(&ip) == false) - { - if (IsIPv6LocalNetworkAddress(&ip) == false) - { - Add(ip_list, Clone(&ip, sizeof(IP))); - } - } - } - } - - Free(line); - } - - FreeBuf(txt_buf); - - ret = QueryFileByIPv6Udp(ip_list, timeout, cancel); - - for (i = 0; i < LIST_NUM(ip_list); i++) - { - IP *ip = LIST_DATA(ip_list, i); - - Free(ip); - } - - ReleaseList(ip_list); - - return ret; -} - -// Request a file by UDP (send the requests to the multiple IP addresses at the same time) -BUF *QueryFileByIPv6Udp(LIST *ip_list, UINT timeout, bool *cancel) -{ - bool dummy_flag = false; - UINT64 start_tick, giveup_tick; - UINT64 next_send_tick; - SOCK *s; - INTERRUPT_MANAGER *interrupt; - BUF *buf = NULL; - SOCK_EVENT *se; - UCHAR *tmp_buf; - UINT tmp_buf_size = 65535; - // Validate arguments - if (cancel == NULL) - { - cancel = &dummy_flag; - } - if (ip_list == NULL) - { - return NULL; - } - - s = NewUDP6(0, NULL); - if (s == NULL) - { - return NULL; - } - - tmp_buf = Malloc(tmp_buf_size); - - start_tick = Tick64(); - giveup_tick = start_tick + (UINT64)timeout; - next_send_tick = 0; - - interrupt = NewInterruptManager(); - - AddInterrupt(interrupt, giveup_tick); - - se = NewSockEvent(); - JoinSockToSockEvent(s, se); - - while (true) - { - UINT64 now = Tick64(); - - if (now >= giveup_tick) - { - // Time-out - break; - } - - if (*cancel) - { - // User canceled - break; - } - - // Receive - while (true) - { - IP src_ip; - UINT src_port; - UINT r; - - r = RecvFrom(s, &src_ip, &src_port, tmp_buf, tmp_buf_size); - - if (r == SOCK_LATER || r == 0) - { - break; - } - - if (src_port == UDP_FILE_QUERY_DST_PORT) - { - if (r >= 40) - { - if (Cmp(tmp_buf, UDP_FILE_QUERY_MAGIC_NUMBER, StrLen(UDP_FILE_QUERY_MAGIC_NUMBER)) == 0) - { - // Successful reception - buf = NewBuf(); - WriteBuf(buf, tmp_buf, r); - SeekBuf(buf, 0, 0); - break; - } - } - } - } - - if (buf != NULL) - { - // Successful reception - break; - } - - if (next_send_tick == 0 || (now >= next_send_tick)) - { - // Transmission - UINT i; - for (i = 0; i < LIST_NUM(ip_list); i++) - { - IP *ip = LIST_DATA(ip_list, i); - UCHAR c = 'F'; - - SendTo(s, ip, UDP_FILE_QUERY_DST_PORT, &c, 1); - } - - next_send_tick = now + (UINT64)UDP_FILE_QUERY_RETRY_INTERVAL; - AddInterrupt(interrupt, next_send_tick); - } - - WaitSockEvent(se, GetNextIntervalForInterrupt(interrupt)); - } - - FreeInterruptManager(interrupt); - - Disconnect(s); - ReleaseSock(s); - - ReleaseSockEvent(se); - - Free(tmp_buf); - - return buf; -} - -// Parse the user name of the NT -void ParseNtUsername(char *src_username, char *dst_username, UINT dst_username_size, char *dst_domain, UINT dst_domain_size, bool do_not_parse_atmark) -{ - char tmp_username[MAX_SIZE]; - char tmp_domain[MAX_SIZE]; - TOKEN_LIST *t; - - if (src_username != dst_username) - { - ClearStr(dst_username, dst_username_size); - } - - ClearStr(dst_domain, dst_domain_size); - // Validate arguments - if (src_username == NULL || dst_username == NULL || dst_domain == NULL) - { - return; - } - - StrCpy(tmp_username, sizeof(tmp_username), src_username); - ClearStr(tmp_domain, sizeof(tmp_domain)); - - // Analysis of username@domain.name format - if (do_not_parse_atmark == false) - { - t = ParseTokenWithNullStr(tmp_username, "@"); - if (t->NumTokens >= 1) - { - StrCpy(tmp_username, sizeof(tmp_username), t->Token[0]); - } - if (t->NumTokens >= 2) - { - StrCpy(tmp_domain, sizeof(tmp_domain), t->Token[1]); - } - FreeToken(t); - } - - // If the username part is in "domain\username" format, split it - t = ParseTokenWithNullStr(tmp_username, "\\"); - if (t->NumTokens >= 2) - { - if (IsEmptyStr(tmp_domain)) - { - StrCpy(tmp_domain, sizeof(tmp_domain), t->Token[0]); - } - - StrCpy(tmp_username, sizeof(tmp_username), t->Token[1]); - } - FreeToken(t); - - StrCpy(dst_username, dst_username_size, tmp_username); - StrCpy(dst_domain, dst_domain_size, tmp_domain); -} - -// The calculation of the optimum MSS value for use in TCP/IP packet in the payload of bulk transfer in R-UDP session -UINT RUDPCalcBestMssForBulk(RUDP_STACK *r, RUDP_SESSION *se) -{ - UINT ret; - // Validate arguments - if (r == NULL || se == NULL) - { - return 0; - } - - ret = MTU_FOR_PPPOE; - - // IPv4 - if (IsIP6(&se->YourIp) == false) - { - ret -= 20; - } - else - { - ret -= 40; - } - - if (r->Protocol == RUDP_PROTOCOL_ICMP) - { - // ICMP - ret -= 8; - - ret -= SHA1_SIZE; - } - else if (r->Protocol == RUDP_PROTOCOL_DNS) - { - // UDP - ret -= 8; - - // DNS - ret -= 42; - } - - // IV - ret -= SHA1_SIZE; - - // Sign - ret -= SHA1_SIZE; - - // SEQ_NO - ret -= sizeof(UINT64); - - // Padding Max - ret -= 31; - - // Ethernet header (target packets of communication) - ret -= 14; - - // IPv4 Header (target packet of communication) - ret -= 20; - - // TCP header (target packet of communication) - ret -= 20; - - // I don't know well, but subtract 24 bytes - ret -= 24; - - return ret; -} - -// Processing of the reply packet from the NAT-T server -void RUDPProcess_NatT_Recv(RUDP_STACK *r, UDPPACKET *udp) -{ - BUF *b; - PACK *p; - // Validate arguments - if (r == NULL || udp == NULL) - { - return; - } - - if (udp->Size >= 8) - { - char tmp[128]; - - Zero(tmp, sizeof(tmp)); - Copy(tmp, udp->Data, MIN(udp->Size, sizeof(tmp) - 1)); - - if (StartWith(tmp, "IP=")) - { - IP my_ip; - UINT my_port; - - // There was a response to the packet to determine the NAT state - if (IsEmptyStr(r->NatT_Registered_IPAndPort) == false) - { - if (StrCmpi(r->NatT_Registered_IPAndPort, tmp) != 0) - { - // Redo getting the token and registration because the NAT state is changed - ClearStr(r->NatT_Registered_IPAndPort, sizeof(r->NatT_Registered_IPAndPort)); - - r->NatT_GetTokenNextTick = 0; - r->NatT_GetTokenFailNum = 0; - r->NatT_Token_Ok = false; - Zero(r->NatT_Token, sizeof(r->NatT_Token)); - - r->NatT_RegisterNextTick = 0; - r->NatT_RegisterFailNum = 0; - r->NatT_Register_Ok = false; - } - } - - if (RUDPParseIPAndPortStr(udp->Data, udp->Size, &my_ip, &my_port)) - { - if (r->NatTGlobalUdpPort != NULL) - { - *r->NatTGlobalUdpPort = my_port; - } - } - - return; - } - } - - // Interpret the UDP packet - b = NewBuf(); - WriteBuf(b, udp->Data, udp->Size); - SeekBuf(b, 0, 0); - - p = BufToPack(b); - - if (p != NULL) - { - bool is_ok = PackGetBool(p, "ok"); - UINT64 tran_id = PackGetInt64(p, "tran_id"); - - ExtractAndApplyDynList(p); - - if (r->ServerMode) - { - if (PackCmpStr(p, "opcode", "get_token")) - { - // Get the Token - if (is_ok && (tran_id == r->NatT_TranId)) - { - char tmp[MAX_SIZE]; - - if (PackGetStr(p, "token", tmp, sizeof(tmp)) && IsEmptyStr(tmp) == false) - { - char myip[MAX_SIZE]; - // Acquisition success - StrCpy(r->NatT_Token, sizeof(r->NatT_Token), tmp); - r->NatT_Token_Ok = true; - r->NatT_GetTokenNextTick = r->Now + (UINT64)GenRandInterval(UDP_NAT_T_GET_TOKEN_INTERVAL_2_MIN, UDP_NAT_T_GET_TOKEN_INTERVAL_2_MAX); - r->NatT_GetTokenFailNum = 0; - - // Since success to obtain the self global IPv4 address, - // re-obtain the destination NAT-T host from this IPv4 address - if (PackGetStr(p, "your_ip", myip, sizeof(myip))) - { - IP ip; - char new_hostname[MAX_SIZE]; - - StrToIP(&ip, myip); - - SetCurrentGlobalIP(&ip, false); - - RUDPGetRegisterHostNameByIP(new_hostname, - sizeof(new_hostname), &ip); - - Lock(r->Lock); - { - if (StrCmpi(r->CurrentRegisterHostname, new_hostname) != 0) - { - r->NumChangedHostname++; - - if (r->NumChangedHostname <= RUDP_NATT_MAX_CONT_CHANGE_HOSTNAME) - { - if (r->NumChangedHostnameValueResetTick == 0) - { - r->NumChangedHostnameValueResetTick = r->Now + (UINT64)RUDP_NATT_CONT_CHANGE_HOSTNAME_RESET_INTERVAL; - } - - // Change the host name - Debug("CurrentRegisterHostname Changed: New=%s\n", new_hostname); - StrCpy(r->CurrentRegisterHostname, sizeof(r->CurrentRegisterHostname), new_hostname); - - Zero(&r->NatT_IP, sizeof(r->NatT_IP)); - //Zero(&r->NatT_IP_Safe, sizeof(r->NatT_IP_Safe)); - - Set(r->HaltEvent); - } - else - { - if (r->NumChangedHostnameValueResetTick == 0) - { - r->NumChangedHostnameValueResetTick = r->Now + (UINT64)RUDP_NATT_CONT_CHANGE_HOSTNAME_RESET_INTERVAL; - } - - if (r->Now >= r->NumChangedHostnameValueResetTick) - { - r->NumChangedHostname = 0; - r->NumChangedHostnameValueResetTick = 0; - } - } - } - else - { - r->NumChangedHostname = 0; - r->NumChangedHostnameValueResetTick = 0; - } - } - Unlock(r->Lock); - } - - AddInterrupt(r->Interrupt, r->NatT_GetTokenNextTick); - } - } - } - else if (PackCmpStr(p, "opcode", "nat_t_register")) - { - // NAT-T server registration result - if (is_ok && (tran_id == r->NatT_TranId)) - { - UINT my_global_port; - // Successful registration - r->NatT_Register_Ok = true; - r->NatT_RegisterNextTick = r->Now + (UINT64)GenRandInterval(UDP_NAT_T_REGISTER_INTERVAL_MIN, UDP_NAT_T_REGISTER_INTERVAL_MAX); - r->NatT_RegisterFailNum = 0; - - Debug("NAT-T Registered.\n"); - - // Save the IP address and port number at the time of registration - PackGetStr(p, "your_ip_and_port", r->NatT_Registered_IPAndPort, sizeof(r->NatT_Registered_IPAndPort)); - - if (g_source_ip_validation_force_disable == false) - { - // Enable the source IP address validation mechanism - r->NatT_EnableSourceIpValidation = PackGetBool(p, "enable_source_ip_validation"); - - } - else - { - // Force disable the source IP address validation mechanism - r->NatT_EnableSourceIpValidation = false; - } - - // Global port of itself - my_global_port = PackGetInt(p, "your_port"); - - if (my_global_port != 0) - { - if (r->NatTGlobalUdpPort != NULL) - { - *r->NatTGlobalUdpPort = my_global_port; - } - } - - AddInterrupt(r->Interrupt, r->NatT_RegisterNextTick); - } - } - else if (PackCmpStr(p, "opcode", "nat_t_connect_relay")) - { - // Connection request from the client via the NAT-T server - if (is_ok && (PackGetInt64(p, "session_key") == r->NatT_SessionKey)) - { - char client_ip_str[MAX_SIZE]; - UINT client_port; - IP client_ip; - - PackGetStr(p, "client_ip", client_ip_str, sizeof(client_ip_str)); - client_port = PackGetInt(p, "client_port"); - StrToIP(&client_ip, client_ip_str); - - if (IsZeroIp(&client_ip) == false && client_port != 0) - { - UCHAR *rand_data; - UINT rand_size; - - if (r->NatT_EnableSourceIpValidation) - { - RUDPAddIpToValidateList(r, &client_ip); - } - - rand_size = Rand32() % 19; - rand_data = Malloc(rand_size); - - Rand(rand_data, rand_size); - - RUDPSendPacket(r, &client_ip, client_port, rand_data, rand_size, 0); - - Free(rand_data); - } - } - } - } - - FreePack(p); - } - - FreeBuf(b); -} - -// Process such as packet transmission for NAT-T server -void RUDPDo_NatT_Interrupt(RUDP_STACK *r) -{ - // Validate arguments - if (r == NULL) - { - return; - } - - if (r->ServerMode) - { - - if (g_no_rudp_register == false && IsZeroIp(&r->NatT_IP_Safe) == false) - { - if (r->NatT_GetTokenNextTick == 0 || r->Now >= r->NatT_GetTokenNextTick) - { - // Try to get a token from the NAT-T server periodically - PACK *p = NewPack(); - BUF *b; - - PackAddStr(p, "opcode", "get_token"); - PackAddInt64(p, "tran_id", r->NatT_TranId); - PackAddInt(p, "nat_traversal_version", UDP_NAT_TRAVERSAL_VERSION); - - b = PackToBuf(p); - FreePack(p); - - RUDPSendPacket(r, &r->NatT_IP_Safe, UDP_NAT_T_PORT, b->Buf, b->Size, 0); - - FreeBuf(b); - - // Determine the next acquisition time - r->NatT_GetTokenFailNum++; - r->NatT_GetTokenNextTick = r->Now + (UINT64)(UDP_NAT_T_GET_TOKEN_INTERVAL_1 * (UINT64)MIN(r->NatT_GetTokenFailNum, UDP_NAT_T_GET_TOKEN_INTERVAL_FAIL_MAX)); - AddInterrupt(r->Interrupt, r->NatT_GetTokenNextTick); - r->NatT_Token_Ok = false; - } - } - - { - if (IsZeroIp(&r->NatT_IP_Safe) == false) - { - // Normal servers: Send request packets to the NAT-T server - if (r->NatT_NextNatStatusCheckTick == 0 || r->Now >= r->NatT_NextNatStatusCheckTick) - { - UCHAR a = 'A'; - UINT ddns_hash; - // Check of the NAT state - RUDPSendPacket(r, &r->NatT_IP_Safe, UDP_NAT_T_PORT, &a, 1, 0); - - // Execution time of the next - r->NatT_NextNatStatusCheckTick = r->Now + (UINT64)GenRandInterval(UDP_NAT_T_NAT_STATUS_CHECK_INTERVAL_MIN, UDP_NAT_T_NAT_STATUS_CHECK_INTERVAL_MAX); - AddInterrupt(r->Interrupt, r->NatT_NextNatStatusCheckTick); - - // Check whether the DDNS host name changing have not occurred - ddns_hash = GetCurrentDDnsFqdnHash(); - - if (r->LastDDnsFqdnHash != ddns_hash) - { - r->LastDDnsFqdnHash = ddns_hash; - // Do the Register immediately if there is a change in the DDNS host name - r->NatT_RegisterNextTick = 0; - } - } - } - } - - if (r->NatT_Token_Ok && g_no_rudp_register == false && IsZeroIp(&r->NatT_IP_Safe) == false) - { - if (r->NatT_RegisterNextTick == 0 || r->Now >= r->NatT_RegisterNextTick) - { - // Try to register itself periodically for NAT-T server - PACK *p = NewPack(); - BUF *b; - char private_ip_str[MAX_SIZE]; - char machine_key[MAX_SIZE]; - char machine_name[MAX_SIZE]; - UCHAR hash[SHA1_SIZE]; - char ddns_fqdn[MAX_SIZE]; - - Debug("NAT-T Registering...\n"); - - GetCurrentDDnsFqdn(ddns_fqdn, sizeof(ddns_fqdn)); - - PackAddStr(p, "opcode", "nat_t_register"); - PackAddInt64(p, "tran_id", r->NatT_TranId); - PackAddStr(p, "token", r->NatT_Token); - PackAddStr(p, "svc_name", r->SvcName); - PackAddStr(p, "product_str", "SoftEther OSS"); - PackAddInt64(p, "session_key", r->NatT_SessionKey); - PackAddInt(p, "nat_traversal_version", UDP_NAT_TRAVERSAL_VERSION); - - - if (g_natt_low_priority) - { - PackAddBool(p, "low_priority", g_natt_low_priority); - } - - Zero(private_ip_str, sizeof(private_ip_str)); - if (IsZeroIp(&r->My_Private_IP_Safe) == false) - { - IPToStr(private_ip_str, sizeof(private_ip_str), &r->My_Private_IP_Safe); - PackAddStr(p, "private_ip", private_ip_str); - } - - PackAddInt(p, "private_port", r->UdpSock->LocalPort); - - Zero(hash, sizeof(hash)); - GetCurrentMachineIpProcessHash(hash); - BinToStr(machine_key, sizeof(machine_key), hash, sizeof(hash)); - PackAddStr(p, "machine_key", machine_key); - - Zero(machine_name, sizeof(machine_name)); - GetMachineName(machine_name, sizeof(machine_name)); - PackAddStr(p, "host_name", machine_name); - PackAddStr(p, "ddns_fqdn", ddns_fqdn); - - b = PackToBuf(p); - FreePack(p); - - RUDPSendPacket(r, &r->NatT_IP_Safe, UDP_NAT_T_PORT, b->Buf, b->Size, 0); - //RUDPSendPacket(r, &r->NatT_IP_Safe, UDP_NAT_T_PORT, "a", 1); - - FreeBuf(b); - - // Determine the next acquisition time - r->NatT_RegisterFailNum++; - r->NatT_RegisterNextTick = r->Now + (UINT64)UDP_NAT_T_REGISTER_INTERVAL_INITIAL * (UINT64)MIN(r->NatT_RegisterFailNum, UDP_NAT_T_REGISTER_INTERVAL_FAIL_MAX); - AddInterrupt(r->Interrupt, r->NatT_RegisterNextTick); - r->NatT_Register_Ok = false; - } - } - } -} - -// R-UDP packet reception procedure -void RUDPRecvProc(RUDP_STACK *r, UDPPACKET *p) -{ - RUDP_SESSION *se = NULL; - // Validate arguments - if (r == NULL || p == NULL) - { - return; - } - - if (r->ServerMode) - { - if (g_no_rudp_server) - { - return; - } - } - - if (r->ServerMode && r->NoNatTRegister == false) - { - - if (p->SrcPort == UDP_NAT_T_PORT && CmpIpAddr(&p->SrcIP, &r->NatT_IP_Safe) == 0) - { - // There was a response from the NAT-T server - RUDPProcess_NatT_Recv(r, p); - return; - } - } - - if (r->ServerMode) - { - if (r->ProcRpcRecv != NULL) - { - if (r->ProcRpcRecv(r, p)) - { - return; - } - } - } - - if (r->ServerMode) - { - // Search the session by the end-point information if in the server mode - se = RUDPSearchSession(r, &p->DstIP, p->DestPort, &p->SrcIP, p->SrcPort); - } - else - { - // Session should exist only one in the case of client mode - if (LIST_NUM(r->SessionList) >= 1) - { - se = LIST_DATA(r->SessionList, 0); - } - else - { - se = NULL; - } - } - - if (p->Size < 20) - { - // The received packet is too small - if (r->ServerMode == false) - { - if (se != NULL && se->Status == RUDP_SESSION_STATUS_CONNECT_SENT) - { - if (CmpIpAddr(&se->YourIp, &p->SrcIP) == 0) - { - // If the connection initialization packet which is shorter than 20 bytes - // has been received from the server side, overwrite the source port number - // of the packet to the client-side session information (for some NAT) - se->YourPort = p->SrcPort; - } - } - } - return; - } - - if (se == NULL && r->ServerMode && p->Size >= 40) - { - // Corresponding to a sudden change of port number on the client side. - // The target session is a session which matches the client side IP address - // and the key and the signature is verified - UINT i; - for (i = 0; i < LIST_NUM(r->SessionList); i++) - { - RUDP_SESSION *s = LIST_DATA(r->SessionList, i); - - if (CmpIpAddr(&s->YourIp, &p->SrcIP) == 0) - { - if (RUDPCheckSignOfRecvPacket(r, s, p->Data, p->Size)) - { - // Signature matched - se = s; - break; - } - } - } - } - - if (se == NULL) - { - // There is no session - if (r->ServerMode) - { - if (p->Size < 40) - { - bool ok = true; - UCHAR ctoken_hash[SHA1_SIZE]; - - Zero(ctoken_hash, sizeof(ctoken_hash)); - - // Examine the quota of new session creation - if (LIST_NUM(r->SessionList) >= RUDP_QUOTA_MAX_NUM_SESSIONS) - { - // Entire number of sessions exceeds the limit - ok = false; - } - else if (r->NatT_EnableSourceIpValidation && RUDPIsIpInValidateList(r, &p->SrcIP) == false) - { - // Invalid source IP address, which is not registered on the validated source IP address list - ok = false; - } - else - { - UINT i; - // Check the number of sessions per IP address - UINT num = 0; - - for (i = 0; i < LIST_NUM(r->SessionList); i++) - { - RUDP_SESSION *se = LIST_DATA(r->SessionList, i); - - if (CmpIpAddr(&se->YourIp, &p->SrcIP) == 0) - { - num++; - } - } - - if (num >= RUDP_QUOTA_MAX_NUM_SESSIONS_PER_IP) - { - // Limit exceeded the number of sessions per IP address - ok = false; - } - } - - - if (ok) - { - char ip_str[64]; - - // Create a session since a new session creation request packet was received - se = RUDPNewSession(true, &p->DstIP, p->DestPort, &p->SrcIP, p->SrcPort, p->Data); - se->Status = RUDP_SESSION_STATUS_ESTABLISHED; - Insert(r->SessionList, se); - - IPToStr(ip_str, sizeof(ip_str), &p->SrcIP); - Debug("RUDPNewSession %X %s:%u\n", se, ip_str, p->SrcPort); - - if (r->Protocol == RUDP_PROTOCOL_ICMP) - { - // In case of ICMP, save the ICMP TYPE number to use - se->Icmp_Type = (p->Type == ICMP_TYPE_INFORMATION_REQUEST ? ICMP_TYPE_INFORMATION_REPLY : p->Type); - } - else if (r->Protocol == RUDP_PROTOCOL_DNS) - { - // Save the Tran ID to be used if it's a DNS - se->Dns_TranId = (USHORT)p->Type; - } - } - } - } - } - else - { - if (p->Size < 40) - { - if (r->ServerMode) - { - if (Cmp(se->Key_Init, p->Data, SHA1_SIZE) == 0) - { - // New session creation request packet have received more than once. reply an ACK immediately for second and subsequent - se->LastSentTick = 0; - - // Update the endpoint information - Copy(&se->YourIp, &p->SrcIP, sizeof(IP)); - se->YourPort = p->SrcPort; - - if (r->Protocol == RUDP_PROTOCOL_ICMP) - { - // In case of ICMP, save the ICMP TYPE number to use - se->Icmp_Type = (p->Type == ICMP_TYPE_INFORMATION_REQUEST ? ICMP_TYPE_INFORMATION_REPLY : p->Type); - } - else if (r->Protocol == RUDP_PROTOCOL_DNS) - { - // Save the Tran ID to be used if it's a DNS - se->Dns_TranId = (USHORT)p->Type; - } - } - else - { - // Since the different session creation request packet have been received from the same end point, ignore it - } - } - } - else - { - // Process the received packet - if (RUDPProcessRecvPacket(r, se, p->Data, p->Size) || RUDPProcessBulkRecvPacket(r, se, p->Data, p->Size)) - { - // Update endpoint information (only the port number) - //Copy(&se->YourIp, &p->SrcIP, sizeof(IP)); - se->YourPort = p->SrcPort; - - if (r->Protocol == RUDP_PROTOCOL_ICMP) - { - // In case of ICMP, save the ICMP TYPE number to use - if (r->ServerMode) - { - se->Icmp_Type = (p->Type == ICMP_TYPE_INFORMATION_REQUEST ? ICMP_TYPE_INFORMATION_REPLY : p->Type); - } - else - { - se->Icmp_Type = (p->Type == ICMP_TYPE_INFORMATION_REPLY ? ICMP_TYPE_INFORMATION_REQUEST : p->Type); - } - } - else if (r->Protocol == RUDP_PROTOCOL_DNS) - { - if (r->ServerMode) - { - // Save the Tran ID to be used if it's a DNS - se->Dns_TranId = (USHORT)p->Type; - } - } - } - } - } -} - -// Check whether the specificed IP address is in the validated source IP address list -bool RUDPIsIpInValidateList(RUDP_STACK *r, IP *ip) -{ - UINT i; - UINT64 now = Tick64(); - LIST *o = NULL; - bool ret = false; - // Validate arguments - if (r == NULL || ip == NULL) - { - return false; - } - - // Always allow private IP addresses - if (IsIPPrivate(ip)) - { - return true; - } - - if (IsIPAddressInSameLocalNetwork(ip)) - { - return true; - } - - for (i = 0; i < LIST_NUM(r->NatT_SourceIpList); i++) - { - RUDP_SOURCE_IP *s = (RUDP_SOURCE_IP *)LIST_DATA(r->NatT_SourceIpList, i); - - if (s->ExpiresTick <= now) - { - if (o == NULL) - { - o = NewListFast(NULL); - } - - Add(o, s); - } - } - - if (o != NULL) - { - for (i = 0; i < LIST_NUM(o); i++) - { - RUDP_SOURCE_IP *s = (RUDP_SOURCE_IP *)LIST_DATA(o, i); - - Delete(r->NatT_SourceIpList, s); - - Free(s); - } - - ReleaseList(o); - } - - for (i = 0; i < LIST_NUM(r->NatT_SourceIpList); i++) - { - RUDP_SOURCE_IP *s = (RUDP_SOURCE_IP *)LIST_DATA(r->NatT_SourceIpList, i); - - if (CmpIpAddr(&s->ClientIP, ip) == 0) - { - ret = true; - break; - } - } - - Debug("RUDP: NAT-T: Validate IP: %r, ret=%u (current list len = %u)\n", ip, ret, LIST_NUM(r->NatT_SourceIpList)); - - return ret; -} - -// Add an IP address to the validated source IP address list -void RUDPAddIpToValidateList(RUDP_STACK *r, IP *ip) -{ - UINT i; - RUDP_SOURCE_IP *sip; - UINT64 now = Tick64(); - LIST *o = NULL; - // Validate arguments - if (r == NULL || ip == NULL) - { - return; - } - - if (LIST_NUM(r->NatT_SourceIpList) >= RUDP_MAX_VALIDATED_SOURCE_IP_ADDRESSES) - { - return; - } - - for (i = 0; i < LIST_NUM(r->NatT_SourceIpList); i++) - { - RUDP_SOURCE_IP *s = (RUDP_SOURCE_IP *)LIST_DATA(r->NatT_SourceIpList, i); - - if (s->ExpiresTick <= now) - { - if (o == NULL) - { - o = NewListFast(NULL); - } - - Add(o, s); - } - } - - if (o != NULL) - { - for (i = 0; i < LIST_NUM(o); i++) - { - RUDP_SOURCE_IP *s = (RUDP_SOURCE_IP *)LIST_DATA(o, i); - - Delete(r->NatT_SourceIpList, s); - - Free(s); - } - - ReleaseList(o); - } - - sip = NULL; - - for (i = 0; i < LIST_NUM(r->NatT_SourceIpList); i++) - { - RUDP_SOURCE_IP *s = (RUDP_SOURCE_IP *)LIST_DATA(r->NatT_SourceIpList, i); - - if (CmpIpAddr(&s->ClientIP, ip) == 0) - { - sip = s; - break; - } - } - - if (sip == NULL) - { - sip = ZeroMalloc(sizeof(RUDP_SOURCE_IP)); - - Copy(&sip->ClientIP, ip, sizeof(IP)); - - Add(r->NatT_SourceIpList, sip); - } - - sip->ExpiresTick = now + (UINT64)RUDP_VALIDATED_SOURCE_IP_ADDRESS_EXPIRES; - - Debug("RUDP: NAT-T: Src IP added: %r (current list len = %u)\n", ip, LIST_NUM(r->NatT_SourceIpList)); -} - -// R-UDP interrupt processing procedure -void RUDPInterruptProc(RUDP_STACK *r) -{ - UINT i; - LIST *o; - // Validate arguments - if (r == NULL) - { - return; - } - - // Packet transmission and other process for NAT-T server - if (r->NoNatTRegister == false) - { - RUDPDo_NatT_Interrupt(r); - } - - if (r->ServerMode == false) - { - if (r->ClientInitiated == false) - { - bool client_target_inited = false; - Lock(r->Lock); - { - client_target_inited = r->TargetIpAndPortInited; - } - Unlock(r->Lock); - - if (client_target_inited) - { - // Start a connection when there is the end point information of the destination server to connect as a client - RUDP_SESSION *se; - UCHAR init_key[SHA1_SIZE]; - char ip_str[128]; - UINT64 ui; - - Rand(init_key, SHA1_SIZE); - - se = RUDPNewSession(false, &r->UdpSock->LocalIP, r->UdpSock->LocalPort, - &r->TargetIp, r->TargetPort, init_key); - - IPToStr(ip_str, sizeof(ip_str), &r->TargetIp); - Debug("RUDPNewSession %X %s:%u\n", se, ip_str, r->TargetPort); - - Insert(r->SessionList, se); - - ui = Endian64(se->Magic_Disconnect); - WriteFifo(se->SendFifo, &ui, sizeof(UINT64)); - - r->ClientInitiated = true; - } - } - } - - // Process for all the sessions - for (i = 0; i < LIST_NUM(r->SessionList); i++) - { - RUDP_SESSION *se = LIST_DATA(r->SessionList, i); - - if (r->Halt) - { - // Disconnect all the sessions if the R-UDP stack stopped - RUDPDisconnectSession(r, se, false); - } - - if (se->FlushBulkSendTube) - { - if (se->TcpSock != NULL && se->TcpSock->BulkSendTube != NULL) - { - TubeFlush(se->TcpSock->BulkSendTube); - } - - se->FlushBulkSendTube = false; - } - - if (se->Status == RUDP_SESSION_STATUS_ESTABLISHED) - { - // Process for all of the sessions which is established a connection - UINT j; - - if (r->Now >= (se->LatestRecvMyTick + (UINT64)RUDP_TIMEOUT)) - { - // Disconnect the session because the fully communication failure is detected for a while - Debug("R-UDP Session %X Timed Out.\n", se); - - RUDPDisconnectSession(r, se, false); - } - - // If there are received segments, read to the part that has arrived in succession - if (FifoSize(se->RecvFifo) <= RUDP_MAX_FIFO_SIZE) - { - LIST *o; - UINT64 current_seq_no; - - o = NULL; - current_seq_no = se->LastRecvCompleteSeqNo; - for (j = 0; j < LIST_NUM(se->RecvSegmentList); j++) - { - RUDP_SEGMENT *s; - - current_seq_no++; - - s = LIST_DATA(se->RecvSegmentList, j); - - if (s->SeqNo == current_seq_no) - { -#ifdef RUDP_DETAIL_LOG - Debug("%X s->SeqNo = %I64u, current_seq_no = %I64u\n", se, s->SeqNo, current_seq_no); -#endif // RUDP_DETAIL_LOG - - if (s->Size == sizeof(se->Magic_KeepAliveRequest) && Cmp(s->Data, se->Magic_KeepAliveRequest, sizeof(se->Magic_KeepAliveRequest)) == 0) - { - // Receive the KeepAlive Request -#ifdef RUDP_DETAIL_LOG - Debug("Recv KeepAlive Request\n"); -#endif // RUDP_DETAIL_LOG - - // Send a KeepAlive Response if the transmisson queue is empty - if (LIST_NUM(se->SendSegmentList) == 0) - { -#ifdef RUDP_DETAIL_LOG - Debug("Send KeepAlive Response\n"); -#endif // RUDP_DETAIL_LOG - - RUDPSendSegment(r, se, se->Magic_KeepAliveResponse, sizeof(se->Magic_KeepAliveResponse)); - } - } - else if (s->Size == sizeof(se->Magic_KeepAliveResponse) && Cmp(s->Data, se->Magic_KeepAliveResponse, sizeof(se->Magic_KeepAliveResponse)) == 0) - { - // Receive the KeepAlive Response -#ifdef RUDP_DETAIL_LOG - Debug("Recv KeepAlive Response\n"); -#endif // RUDP_DETAIL_LOG - } - else - { - // Write to the receive FIFO - WriteFifo(se->RecvFifo, s->Data, s->Size); - } - r->TotalLogicalReceived += s->Size; - - // Advance the SEQ NO which has been received completely - se->LastRecvCompleteSeqNo = s->SeqNo; - - // Add to the Delete list - if (o == NULL) - { - o = NewListFast(NULL); - } - Add(o, s); - } - else - { - // Continuous reading is interrupted -#ifdef RUDP_DETAIL_LOG - Debug("%X s->SeqNo = %I64u, current_seq_no = %I64u\n", se, s->SeqNo, current_seq_no); - WHERE; -#endif // RUDP_DETAIL_LOG - break; - } - } - - // Delete the segment which has been received completely - if (o != NULL) - { - for (j = 0; j < LIST_NUM(o); j++) - { - RUDP_SEGMENT *s = LIST_DATA(o, j); - - Delete(se->RecvSegmentList, s); - Free(s); - } - ReleaseList(o); - } - } - - if (r->ServerMode && se->Magic_Disconnect == 0) - { - if (FifoSize(se->RecvFifo) >= sizeof(UINT64)) - { - UINT64 ui; - - if (ReadFifo(se->RecvFifo, &ui, sizeof(UINT64)) == sizeof(UINT64)) - { - ui = Endian64(ui); - - if ((ui & 0xffffffff00000000ULL) != 0ULL) - { - se->Magic_Disconnect = ui; - } - } - } - } - - // If the data remains in FIFO, write it to the TCP socket as possible - if (r->ServerMode == false || se->Magic_Disconnect != 0) - { - while (FifoSize(se->RecvFifo) >= 1) - { - UINT ret; - - RUDPInitSock(r, se); - - ret = Send(se->TcpSock, FifoPtr(se->RecvFifo), FifoSize(se->RecvFifo), false); - - if (ret == SOCK_LATER) - { - // Can not write any more - break; - } - else if (ret == 0) - { - // Disconnected - Disconnect(se->TcpSock); - RUDPDisconnectSession(r, se, false); - break; - } - else - { - // Writing success - ReadFifo(se->RecvFifo, NULL, ret); - } - } - } - - // Read the data as much as possible from the TCP socket and store it to FIFO - if (se->TcpSock != NULL) - { - SetNoNeedToRead(se->TcpSock); - - while (FifoSize(se->SendFifo) <= RUDP_MAX_FIFO_SIZE) - { - UINT ret = Recv(se->TcpSock, r->TmpBuf, sizeof(r->TmpBuf), false); - - if (ret == SOCK_LATER) - { - // Can not read any more - break; - } - else if (ret == 0) - { - // Disconnected - Disconnect(se->TcpSock); - RUDPDisconnectSession(r, se, false); - break; - } - else - { - // Reading success - WriteFifo(se->SendFifo, r->TmpBuf, ret); - } - } - } - - // Attempt to send a divided segment - while (true) - { - UINT64 seq_no_min, seq_no_max; - - seq_no_min = RUDPGetCurrentSendingMinSeqNo(se); - seq_no_max = RUDPGetCurrentSendingMaxSeqNo(se); - -#ifdef RUDP_DETAIL_LOG - Debug("min=%I64u max=%I64u\n", seq_no_min, seq_no_max); -#endif // RUDP_DETAIL_LOG - - if (seq_no_min == 0 || ((seq_no_min + RUDP_MAX_NUM_ACK - 1) >= se->NextSendSeqNo)) - { - // Because there is a room to send a new segment, send a segment - UINT size = MIN(FifoSize(se->SendFifo), RUDP_MAX_SEGMENT_SIZE); - - if (size == 0) - { - // There is no more data to send in FIFO - break; - } - - // Transmission - RUDPSendSegment(r, se, FifoPtr(se->SendFifo), size); - - r->TotalLogicalSent += size; - - // Advance the FIFO - ReadFifo(se->SendFifo, NULL, size); - } - else - { - // There is no room to send a new segment further - break; - } - } - - if (se->DisconnectFlag == false) - { - UINT64 seq_no_min; - - if (se->LastSentTick == 0 || (r->Now >= (se->LastSentTick + (UINT64)se->NextKeepAliveInterval))) - { - if (LIST_NUM(se->SendSegmentList) == 0) - { - // Send a Keep-Alive if no data was sent for a while and the transmission queue is empty - RUDPSendSegment(r, se, se->Magic_KeepAliveRequest, sizeof(se->Magic_KeepAliveRequest)); - -#ifdef RUDP_DETAIL_LOG - Debug("Sent KeepAlive Request\n"); -#endif // RUDP_DETAIL_LOG - } - - se->NextKeepAliveInterval = RUDP_KEEPALIVE_INTERVAL_MIN + (Rand32() % (RUDP_KEEPALIVE_INTERVAL_MAX - RUDP_KEEPALIVE_INTERVAL_MIN)); - - AddInterrupt(r->Interrupt, r->Now + se->NextKeepAliveInterval); - } - - seq_no_min = RUDPGetCurrentSendingMinSeqNo(se); - for (j = 0; j < LIST_NUM(se->SendSegmentList); j++) - { - RUDP_SEGMENT *s = LIST_DATA(se->SendSegmentList, j); - - if (s->SeqNo <= (seq_no_min + RUDP_MAX_NUM_ACK - 1)) - { - if (s->NextSendTick == 0 || r->Now >= s->NextSendTick) - { - UINT next_interval; - // Transmits a segment which has not been sent even once yet, or whose retransmission time has arrived - RUDPSendSegmentNow(r, se, s->SeqNo, s->Data, s->Size); - - if (se->CurrentRtt != 0) - { - next_interval = (se->CurrentRtt * 120 / 100) * Power(2, MIN(s->NumSent, 10)); - } - else - { - next_interval = RUDP_RESEND_TIMER * Power(2, MIN(s->NumSent, 10)); - } - - next_interval = MIN(next_interval, RUDP_RESEND_TIMER_MAX); - - s->NumSent++; - - s->NextSendTick = r->Now + next_interval; - - AddInterrupt(r->Interrupt, s->NextSendTick); - } - } - } - - while (LIST_NUM(se->ReplyAckList) >= 1) - { - // If there are ACKs which is not responded yet in the list, send all of them - RUDPSendSegmentNow(r, se, se->NextSendSeqNo, NULL, 0); - } - - // Send all if there are bulk transfer data - if (se->TcpSock != NULL) - { - SOCK *s = se->TcpSock; - - if (s->BulkRecvTube != NULL) - { - TUBE *t = s->BulkRecvTube; - - while (true) - { - TUBEDATA *d = TubeRecvAsync(t); - - if (d == NULL) - { - break; - } - - if (d->Header != NULL && d->HeaderSize == sizeof(TCP_PAIR_HEADER)) - { - TCP_PAIR_HEADER *h = d->Header; - - if (h->EnableHMac) - { - se->UseHMac = true; - } - } - - RUDPBulkSend(r, se, d->Data, d->DataSize); - - FreeTubeData(d); - } - } - } - } - } - - if (r->ServerMode == false) - { - if (se->Status == RUDP_SESSION_STATUS_CONNECT_SENT) - { - // Send a connection request periodically from the client side - if (se->LastSentTick == 0 || ((se->LastSentTick + (UINT64)RUDP_RESEND_TIMER) <= r->Now)) - { - UCHAR tmp[40]; - UINT size_of_padding = 19; - UINT size = size_of_padding + SHA1_SIZE; - - se->LastSentTick = r->Now; - - Copy(tmp, se->Key_Init, SHA1_SIZE); - Rand(tmp + SHA1_SIZE, size_of_padding); - - if (r->Protocol == RUDP_PROTOCOL_ICMP) - { - // ICMP packet - UCHAR *rand_data; - UINT rand_size; - - rand_size = Rand32() % 64 + 64; - rand_data = Malloc(rand_size); - Rand(rand_data, rand_size); - - RUDPSendPacket(r, &se->YourIp, se->YourPort, rand_data, rand_size, ICMP_TYPE_ECHO_REQUEST); - Free(rand_data); - - se->Client_Icmp_NextSendEchoRequest = r->Now + GenRandInterval(RUDP_CLIENT_ECHO_REQUEST_SEND_INTERVAL_MIN, RUDP_CLIENT_ECHO_REQUEST_SEND_INTERVAL_MAX); - AddInterrupt(r->Interrupt, se->Client_Icmp_NextSendEchoRequest); - - // Try in both INFORMATION_REQUEST and ECHO_RESPONSE from the client side first - RUDPSendPacket(r, &se->YourIp, se->YourPort, tmp, size, ICMP_TYPE_ECHO_RESPONSE); - RUDPSendPacket(r, &se->YourIp, se->YourPort, tmp, size, ICMP_TYPE_INFORMATION_REQUEST); - } - else if (r->Protocol == RUDP_PROTOCOL_DNS) - { - // DNS - RUDPSendPacket(r, &se->YourIp, se->YourPort, tmp, size, se->Dns_TranId); - } - else - { - // Normal UDP - RUDPSendPacket(r, &se->YourIp, se->YourPort, tmp, size, 0); - } - - AddInterrupt(r->Interrupt, r->Now + (UINT64)RUDP_RESEND_TIMER); - } - } - - if (r->Protocol == RUDP_PROTOCOL_ICMP) - { - if (se->Client_Icmp_NextSendEchoRequest == 0 || (r->Now >= se->Client_Icmp_NextSendEchoRequest)) - { - // Periodic ICMP Echo transmission from the client side when R-UDP used in ICMP mode - // (To maintain the mapping table of the NAT) - UCHAR *rand_data; - UINT rand_size; - - rand_size = Rand32() % 64 + 64; - rand_data = Malloc(rand_size); - Rand(rand_data, rand_size); - - RUDPSendPacket(r, &se->YourIp, se->YourPort, rand_data, rand_size, ICMP_TYPE_ECHO_REQUEST); - Free(rand_data); - - se->Client_Icmp_NextSendEchoRequest = r->Now + GenRandInterval(RUDP_CLIENT_ECHO_REQUEST_SEND_INTERVAL_MIN, RUDP_CLIENT_ECHO_REQUEST_SEND_INTERVAL_MAX); - AddInterrupt(r->Interrupt, se->Client_Icmp_NextSendEchoRequest); - } - } - } - } - - // Release the disconnected sessions - o = NULL; - for (i = 0; i < LIST_NUM(r->SessionList); i++) - { - RUDP_SESSION *se = LIST_DATA(r->SessionList, i); - - if (se->DisconnectFlag) - { - if (o == NULL) - { - o = NewListFast(NULL); - } - - Add(o, se); - } - } - if (o != NULL) - { - for (i = 0; i < LIST_NUM(o); i++) - { - RUDP_SESSION *se = LIST_DATA(o, i); - - Delete(r->SessionList, se); - - RUDPFreeSession(se); - } - - ReleaseList(o); - } -} - -// Do the bulk send -void RUDPBulkSend(RUDP_STACK *r, RUDP_SESSION *se, void *data, UINT data_size) -{ - UCHAR *buf; - UINT i, icmp_type, buf_size, padding_size; - icmp_type = 0; - // Validate arguments - if (r == NULL || se == NULL || (data == NULL && data_size != 0)) - { - return; - } - - if (se->BulkSendKey->Size == RUDP_BULK_KEY_SIZE_V2) - { - UCHAR *tmp, iv[RUDP_BULK_IV_SIZE_V2]; - UINT size; - CIPHER *c; - - padding_size = Rand32() % 31 + 1; - - size = sizeof(UINT64) + data_size + padding_size; - - // Packet: IV + Encrypted(SEQ_NO + Data + padding) + MAC - buf_size = RUDP_BULK_IV_SIZE_V2 + sizeof(UINT64) + data_size + padding_size + RUDP_BULK_MAC_SIZE_V2; - buf = Malloc(buf_size); - - // IV - Copy(iv, se->BulkNextIv_V2, RUDP_BULK_IV_SIZE_V2); - Copy(buf, iv, RUDP_BULK_IV_SIZE_V2); - - // SEQ NO - WRITE_UINT64(buf + RUDP_BULK_IV_SIZE_V2, se->BulkNextSeqNo); - se->BulkNextSeqNo++; - - // Data - Copy(buf + RUDP_BULK_IV_SIZE_V2 + sizeof(UINT64), data, data_size); - - // Padding - for (i = 0; i < padding_size; i++) - { - buf[RUDP_BULK_IV_SIZE_V2 + sizeof(UINT64) + data_size + i] = (UCHAR)padding_size; - } - - size = sizeof(UINT64) + data_size + padding_size; - tmp = buf + RUDP_BULK_IV_SIZE_V2; - - // Encryption - c = NewCipher("ChaCha20-Poly1305"); - SetCipherKey(c, se->BulkSendKey->Data, true); - CipherProcessAead(c, iv, tmp + size, RUDP_BULK_MAC_SIZE_V2, tmp, tmp, size - RUDP_BULK_MAC_SIZE_V2, NULL, 0); - FreeCipher(c); - - // Next IV - Copy(se->BulkNextIv_V2, buf + sizeof(UINT64) + data_size + padding_size, RUDP_BULK_IV_SIZE_V2); - } - else - { - UCHAR crypt_key_src[SHA1_SIZE * 2]; - UCHAR crypt_key[SHA1_SIZE]; - UCHAR sign[SHA1_SIZE]; - UCHAR iv[SHA1_SIZE]; - CRYPT *c; - - padding_size = Rand32() % 31 + 1; - - buf_size = SHA1_SIZE + SHA1_SIZE + sizeof(UINT64) + data_size + padding_size; - buf = Malloc(buf_size); - - // SEQ NO - WRITE_UINT64(buf + SHA1_SIZE + SHA1_SIZE, se->BulkNextSeqNo); - se->BulkNextSeqNo++; - - // Data - Copy(buf + SHA1_SIZE + SHA1_SIZE + sizeof(UINT64), data, data_size); - - // Padding - for (i = 0; i < padding_size; i++) - { - buf[SHA1_SIZE + SHA1_SIZE + sizeof(UINT64) + data_size + i] = (UCHAR)padding_size; - } - - // Encryption - Copy(iv, se->BulkNextIv, SHA1_SIZE); - Copy(crypt_key_src + 0, se->BulkSendKey->Data, SHA1_SIZE); - Copy(crypt_key_src + SHA1_SIZE, iv, SHA1_SIZE); - Sha1(crypt_key, crypt_key_src, SHA1_SIZE * 2); - c = NewCrypt(crypt_key, sizeof(crypt_key)); - Encrypt(c, buf + SHA1_SIZE + SHA1_SIZE, buf + SHA1_SIZE + SHA1_SIZE, sizeof(UINT64) + data_size + padding_size); - FreeCrypt(c); - - // IV - Copy(buf + SHA1_SIZE, iv, SHA1_SIZE); - - // Sign - if (se->UseHMac == false) - { - Copy(buf + 0, se->BulkSendKey->Data, SHA1_SIZE); - Sha1(sign, buf, SHA1_SIZE + SHA1_SIZE + sizeof(UINT64) + data_size + padding_size); - Copy(buf + 0, sign, SHA1_SIZE); - } - else - { - HMacSha1(buf + 0, se->BulkSendKey->Data, SHA1_SIZE, buf + SHA1_SIZE, SHA1_SIZE + sizeof(UINT64) + data_size + padding_size); - } - - // Next IV - Copy(se->BulkNextIv, buf + buf_size - SHA1_SIZE, SHA1_SIZE); - } - - if (r->Protocol == RUDP_PROTOCOL_ICMP) - { - icmp_type = se->Icmp_Type; - } - else if (r->Protocol == RUDP_PROTOCOL_DNS) - { - icmp_type = se->Dns_TranId; - } - - RUDPSendPacket(r, &se->YourIp, se->YourPort, buf, buf_size, icmp_type); - - Free(buf); -} - -// Start a socket for R-UDP Listening -SOCK *ListenRUDP(char *svc_name, RUDP_STACK_INTERRUPTS_PROC *proc_interrupts, RUDP_STACK_RPC_RECV_PROC *proc_rpc_recv, void *param, UINT port, bool no_natt_register, bool over_dns_mode) -{ - return ListenRUDPEx(svc_name, proc_interrupts, proc_rpc_recv, param, port, no_natt_register, over_dns_mode, NULL, 0, NULL); -} -SOCK *ListenRUDPEx(char *svc_name, RUDP_STACK_INTERRUPTS_PROC *proc_interrupts, RUDP_STACK_RPC_RECV_PROC *proc_rpc_recv, void *param, UINT port, bool no_natt_register, bool over_dns_mode, - volatile UINT *natt_global_udp_port, UCHAR rand_port_id, IP *listen_ip) -{ - SOCK *s; - RUDP_STACK *r; - - // Creating a R-UDP stack - r = NewRUDPServer(svc_name, proc_interrupts, proc_rpc_recv, param, port, no_natt_register, over_dns_mode, natt_global_udp_port, rand_port_id, listen_ip); - if (r == NULL) - { - return NULL; - } - - s = NewSock(); - - s->Type = SOCK_RUDP_LISTEN; - s->ListenMode = true; - s->Connected = true; - - s->LocalPort = r->UdpSock->LocalPort; - - s->R_UDP_Stack = r; - - return s; -} - -// Accept on the R-UDP socket -SOCK *AcceptRUDP(SOCK *s) -{ - // Validate arguments - if (s == NULL || s->Type != SOCK_RUDP_LISTEN || s->ListenMode == false) - { - return NULL; - } - - while (true) - { - RUDP_STACK *r = s->R_UDP_Stack; - SOCK *ret; - - if (s->Disconnecting || s->CancelAccept) - { - return NULL; - } - - ret = GetNextWithLock(r->NewSockQueue); - - if (ret != NULL) - { - switch (r->Protocol) - { - case RUDP_PROTOCOL_UDP: - StrCpy(ret->UnderlayProtocol, sizeof(ret->UnderlayProtocol), SOCK_UNDERLAY_NAT_T); - AddProtocolDetailsStr(ret->ProtocolDetails, sizeof(ret->ProtocolDetails), "RUDP/UDP"); - break; - - case RUDP_PROTOCOL_DNS: - StrCpy(ret->UnderlayProtocol, sizeof(ret->UnderlayProtocol), SOCK_UNDERLAY_DNS); - AddProtocolDetailsStr(ret->ProtocolDetails, sizeof(ret->ProtocolDetails), "RUDP/DNS"); - break; - - case RUDP_PROTOCOL_ICMP: - StrCpy(ret->UnderlayProtocol, sizeof(ret->UnderlayProtocol), SOCK_UNDERLAY_ICMP); - AddProtocolDetailsStr(ret->ProtocolDetails, sizeof(ret->ProtocolDetails), "RUDP/ICMP"); - break; - } - - return ret; - } - - Wait(r->NewSockConnectEvent, INFINITE); - } -} - -// Verify the signature of the received packet -bool RUDPCheckSignOfRecvPacket(RUDP_STACK *r, RUDP_SESSION *se, void *recv_data, UINT recv_size) -{ - UCHAR sign[SHA1_SIZE]; - UCHAR sign2[SHA1_SIZE]; - UCHAR *p; - UINT size; - // Validate arguments - if (r == NULL || se == NULL || recv_data == NULL || recv_size == 0) - { - return false; - } - - p = (UCHAR *)recv_data; - size = recv_size; - if (size < SHA1_SIZE) - { - return false; - } - - // Verification the signature (segment packet) - Copy(sign, p, SHA1_SIZE); - Copy(p, se->Key_Recv, SHA1_SIZE); - Sha1(sign2, p, recv_size); - - if (r->Protocol == RUDP_PROTOCOL_DNS || r->Protocol == RUDP_PROTOCOL_ICMP) - { - XorData(sign2, sign2, r->SvcNameHash, SHA1_SIZE); - } - - Copy(p, sign, SHA1_SIZE); - if (Cmp(sign, sign2, SHA1_SIZE) == 0) - { - return true; - } - - if (se->BulkRecvKey == NULL) - { - return false; - } - - // Verification signature (bulk packet) - if (se->BulkRecvKey->Size == RUDP_BULK_KEY_SIZE_V2) - { - UCHAR *iv = p; - CIPHER *c; - - // Packet: IV + Encrypted(SEQ_NO + Data + padding) + MAC - // IV - if (size < RUDP_BULK_IV_SIZE_V2) - { - return false; - } - iv = p; - p += RUDP_BULK_IV_SIZE_V2; - size -= RUDP_BULK_IV_SIZE_V2; - - // Decrypt - if (size < (RUDP_BULK_MAC_SIZE_V2 + 1)) - { - return false; - } - - c = NewCipher("ChaCha20-Poly1305"); - SetCipherKey(c, se->BulkRecvKey->Data, false); - size = CipherProcessAead(c, iv, p + size, RUDP_BULK_MAC_SIZE_V2, r->TmpBuf, p, size - RUDP_BULK_MAC_SIZE_V2, NULL, 0); - FreeCipher(c); - - if (size == 0) - { - return false; - } - - return true; - } - else - { - if (se->UseHMac == false) - { - Copy(sign, p, SHA1_SIZE); - Copy(p, se->BulkRecvKey->Data, SHA1_SIZE); - Sha1(sign2, p, recv_size); - Copy(p, sign, SHA1_SIZE); - - if (Cmp(sign, sign2, SHA1_SIZE) == 0) - { - return true; - } - } - - HMacSha1(sign2, se->BulkRecvKey->Data, SHA1_SIZE, p + SHA1_SIZE, size - SHA1_SIZE); - if (Cmp(p, sign2, SHA1_SIZE) == 0) - { - se->UseHMac = true; - return true; - } - } - - return false; -} - -// Process the received packet (bulk) -bool RUDPProcessBulkRecvPacket(RUDP_STACK *r, RUDP_SESSION *se, void *recv_data, UINT recv_size) -{ - UCHAR *p; - UCHAR *iv; - UINT size; - UCHAR padlen; - UINT64 seq_no; - UCHAR *payload; - UINT payload_size; - // Validate arguments - if (r == NULL || se == NULL || recv_data == NULL || recv_size == 0 || se->BulkRecvKey == NULL) - { - return false; - } - - p = (UCHAR *)recv_data; - size = recv_size; - if (size < SHA1_SIZE) - { - return false; - } - - if (se->BulkRecvKey->Size == RUDP_BULK_KEY_SIZE_V2) - { - UINT ret; - CIPHER *c; - - // Packet: IV + Encrypted(SEQ_NO + Data + padding) + MAC - // IV - if (size < RUDP_BULK_IV_SIZE_V2) - { - WHERE; - return false; - } - iv = p; - p += RUDP_BULK_IV_SIZE_V2; - size -= RUDP_BULK_IV_SIZE_V2; - - // Decrypt - if (size < (RUDP_BULK_MAC_SIZE_V2 + 1)) - { - WHERE; - return false; - } - - c = NewCipher("ChaCha20-Poly1305"); - SetCipherKey(c, se->BulkRecvKey->Data, false); - ret = CipherProcessAead(c, iv, p + size, RUDP_BULK_MAC_SIZE_V2, p, p, size - RUDP_BULK_MAC_SIZE_V2, NULL, 0); - FreeCipher(c); - - if (ret == 0) - { - WHERE; - return false; - } - - size -= RUDP_BULK_MAC_SIZE_V2; - - // padlen - padlen = p[size - 1]; - if (padlen == 0) - { - WHERE; - return false; - } - if (size < padlen) - { - WHERE; - return false; - } - size -= padlen; - } - else - { - CRYPT *c; - UCHAR sign[SHA1_SIZE], sign2[SHA1_SIZE]; - UCHAR key[SHA1_SIZE], keygen[SHA1_SIZE * 2]; - - // Validate the signature - if (se->UseHMac == false) - { - Copy(sign, p, SHA1_SIZE); - Copy(p, se->BulkRecvKey->Data, SHA1_SIZE); - Sha1(sign2, p, recv_size); - Copy(p, sign, SHA1_SIZE); - - if (Cmp(sign, sign2, SHA1_SIZE) != 0) - { - HMacSha1(sign2, se->BulkRecvKey->Data, SHA1_SIZE, p + SHA1_SIZE, recv_size - SHA1_SIZE); - - if (Cmp(p, sign2, SHA1_SIZE) != 0) - { - return false; - } - else - { - se->UseHMac = true; - } - } - } - else - { - HMacSha1(sign2, se->BulkRecvKey->Data, SHA1_SIZE, p + SHA1_SIZE, recv_size - SHA1_SIZE); - - if (Cmp(p, sign2, SHA1_SIZE) != 0) - { - return false; - } - } - - p += SHA1_SIZE; - size -= SHA1_SIZE; - - // IV - if (size < SHA1_SIZE) - { - return false; - } - iv = p; - p += SHA1_SIZE; - size -= SHA1_SIZE; - - // Decrypt - if (size < 1) - { - return false; - } - Copy(keygen + 0, se->BulkRecvKey->Data, SHA1_SIZE); - Copy(keygen + SHA1_SIZE, iv, SHA1_SIZE); - Sha1(key, keygen, sizeof(keygen)); - - c = NewCrypt(key, sizeof(key)); - Encrypt(c, p, p, size); - FreeCrypt(c); - - // padlen - padlen = p[size - 1]; - if (padlen == 0) - { - return false; - } - if (size < padlen) - { - return false; - } - size -= padlen; - } - - // SEQ NO - seq_no = READ_UINT64(p); - p += sizeof(UINT64); - size -= sizeof(UINT64); - - if (seq_no == 0 || seq_no >= (0xF000000000000000ULL)) - { - // Sequence number is invalid - return false; - } - - if ((seq_no + RUDP_BULK_SEQ_NO_RANGE) < se->BulkRecvSeqNoMax) - { - // Sequence number is too small - return false; - } - - se->LastRecvTick = r->Now; - - payload = p; - payload_size = size; - - se->BulkRecvSeqNoMax = MAX(seq_no, se->BulkRecvSeqNoMax); - - // Send the received bulk packet to the Tube of the socket - RUDPInitSock(r, se); - - if (se->TcpSock != NULL) - { - SOCK *s = se->TcpSock; - TUBE *t = s->BulkSendTube; - - if (t != NULL) - { - TubeSendEx2(t, payload, payload_size, NULL, true, RUDP_BULK_MAX_RECV_PKTS_IN_QUEUE); - - se->FlushBulkSendTube = true; - } - } - - return true; -} - -// Process the received packet (segment) -bool RUDPProcessRecvPacket(RUDP_STACK *r, RUDP_SESSION *se, void *recv_data, UINT recv_size) -{ - UCHAR sign[SHA1_SIZE]; - UCHAR sign2[SHA1_SIZE]; - UCHAR *p; - UCHAR *iv; - UINT size; - UCHAR keygen[SHA1_SIZE * 2]; - UCHAR key[SHA1_SIZE]; - CRYPT *c; - UCHAR padlen; - UINT num_ack; - UINT i; - UINT64 seq_no; - UCHAR *payload; - UINT payload_size; - UINT64 max_ack; - UINT64 my_tick, your_tick; - // Validate arguments - if (r == NULL || se == NULL || recv_data == NULL || recv_size == 0) - { - return false; - } - - p = (UCHAR *)recv_data; - size = recv_size; - if (size < SHA1_SIZE) - { - return false; - } - - // Validate the signature - Copy(sign, p, SHA1_SIZE); - Copy(p, se->Key_Recv, SHA1_SIZE); - Sha1(sign2, p, recv_size); - Copy(p, sign, SHA1_SIZE); - - if (r->Protocol == RUDP_PROTOCOL_DNS || r->Protocol == RUDP_PROTOCOL_ICMP) - { - XorData(sign2, sign2, r->SvcNameHash, SHA1_SIZE); - } - - if (Cmp(sign, sign2, SHA1_SIZE) != 0) - { - //WHERE; - return false; - } - p += SHA1_SIZE; - size -= SHA1_SIZE; - - // IV - if (size < SHA1_SIZE) - { - return false; - } - iv = p; - p += SHA1_SIZE; - size -= SHA1_SIZE; - - // Decrypt - if (size < 1) - { - return false; - } - Copy(keygen + 0, iv, SHA1_SIZE); - Copy(keygen + SHA1_SIZE, se->Key_Recv, SHA1_SIZE); - Sha1(key, keygen, sizeof(keygen)); - - c = NewCrypt(key, sizeof(key)); - Encrypt(c, p, p, size); - FreeCrypt(c); - - // padlen - padlen = p[size - 1]; - if (padlen == 0) - { - return false; - } - if (size < padlen) - { - return false; - } - size -= padlen; - - // MyTick - if (size < sizeof(UINT64)) - { - return false; - } - my_tick = READ_UINT64(p); - p += sizeof(UINT64); - size -= sizeof(UINT64); - - // YourTick - if (size < sizeof(UINT64)) - { - return false; - } - your_tick = READ_UINT64(p); - p += sizeof(UINT64); - size -= sizeof(UINT64); - - if (your_tick > r->Now) - { - return false; - } - - // MAX_ACK - if (size < sizeof(UINT64)) - { - return false; - } - max_ack = READ_UINT64(p); - p += sizeof(UINT64); - size -= sizeof(UINT64); - - // num_ack - if (size < sizeof(UINT)) - { - return false; - } - - num_ack = READ_UINT(p); - if (num_ack > RUDP_MAX_NUM_ACK) - { - return false; - } - p += sizeof(UINT); - size -= sizeof(UINT); - - // ACKs - if (size < (sizeof(UINT64) * num_ack + sizeof(UINT64))) - { - return false; - } - - if (max_ack >= 1) - { - RUDPProcessAck2(r, se, max_ack); - } - - for (i = 0; i < num_ack; i++) - { - UINT64 seq = READ_UINT64(p); - - RUDPProcessAck(r, se, seq); - - p += sizeof(UINT64); - size -= sizeof(UINT64); - } - - // Processing of the Tick (Calculation of RTT) - if (my_tick >= 2) - { - my_tick--; - } - se->YourTick = MAX(se->YourTick, my_tick); - - se->LatestRecvMyTick = MAX(se->LatestRecvMyTick, your_tick); - - if (se->LatestRecvMyTick2 != se->LatestRecvMyTick) - { - se->LatestRecvMyTick2 = se->LatestRecvMyTick; - se->CurrentRtt = (UINT)(r->Now - se->LatestRecvMyTick); - -#ifdef RUDP_DETAIL_LOG - Debug("CurrentRTT = %u\n", se->CurrentRtt); -#endif // RUDP_DETAIL_LOG - } - - // SEQ NO - seq_no = READ_UINT64(p); - p += sizeof(UINT64); - size -= sizeof(UINT64); - - if (seq_no == 0) - { - // Sequence number of 0 is a invalid packet - return true; - } - - if (seq_no == se->Magic_Disconnect) - { - // Disconnected from opponent - RUDPDisconnectSession(r, se, true); - return true; - } - - // Update the last reception date and time - se->LastRecvTick = r->Now; - - payload = p; - payload_size = size; - -#ifdef RUDP_DETAIL_LOG - Debug("RUDP %X Segment Recv: %I64u (num_ack=%u, size=%u)\n", se, seq_no, num_ack, size); -#endif // RUDP_DETAIL_LOG - - if (payload_size >= 1 && payload_size <= RUDP_MAX_SEGMENT_SIZE) - { - // Received one or more bytes of data - -#ifdef RUDP_DETAIL_LOG - Debug("Recv Size: %X %I64u %u %u\n", se, seq_no, payload_size, recv_size); -#endif // RUDP_DETAIL_LOG - - RUDPProcessRecvPayload(r, se, seq_no, payload, payload_size); - } - - if (r->ServerMode == false) - { - if (se->Status == RUDP_SESSION_STATUS_CONNECT_SENT) - { - // Shift to the established state if the connection is not yet in established state - se->Status = RUDP_SESSION_STATUS_ESTABLISHED; - - RUDPInitSock(r, se); - } - } - - return true; -} - -// Disconnect the session -void RUDPDisconnectSession(RUDP_STACK *r, RUDP_SESSION *se, bool disconnected_by_you) -{ - // Validate arguments - if (r == NULL || se == NULL) - { - return; - } - - if (se->DisconnectFlag == false) - { - UINT i; - - se->DisconnectFlag = true; - se->DisconnectedByYou = disconnected_by_you; - - Debug("R-UDP Session %X Disconnected. by you flag: %u\n", se, disconnected_by_you); - - if (se->TcpSock != NULL) - { - // Disconnect a TCP socket - Disconnect(se->TcpSock); - ReleaseSock(se->TcpSock); - - se->TcpSock = NULL; - } - - // Send 5 disconnect signals serially if to disconnect from here - if (disconnected_by_you == false) - { - for (i = 0; i < 5; i++) - { - RUDPSendSegmentNow(r, se, se->Magic_Disconnect, NULL, 0); - } - } - } -} - -// Initialize the TCP socket for the session -void RUDPInitSock(RUDP_STACK *r, RUDP_SESSION *se) -{ - SOCK *s1, *s2; - UINT mss; - // Validate arguments - if (r == NULL || se == NULL || se->DisconnectFlag) - { - return; - } - - if (se->TcpSock != NULL) - { - // It has already been created - return; - } - - // Creating a TCP socket pair - if (NewTcpPair(&s1, &s2) == false) - { - // Failed to create. Disconnect the session - RUDPDisconnectSession(r, se, false); - return; - } - - // Calculate the optimal MSS - mss = RUDPCalcBestMssForBulk(r, se); - - if (r->ServerMode) - { - // Server mode - se->TcpSock = s2; - - JoinSockToSockEvent(s2, r->SockEvent); - - // Update the end point information of the socket s1 - ZeroIP4(&s1->LocalIP); - s1->LocalPort = se->MyPort; - Copy(&s1->RemoteIP, &se->YourIp, sizeof(IP)); - s1->RemotePort = se->YourPort; - if (IsLocalHostIP(&s1->RemoteIP) == false) - { - AddIpClient(&s1->RemoteIP); - s1->IpClientAdded = true; - } - s1->IsRUDPSocket = true; - - s1->BulkSendKey = se->BulkSendKey; - s1->BulkRecvKey = se->BulkRecvKey; - - AddRef(s1->BulkSendKey->Ref); - AddRef(s1->BulkRecvKey->Ref); - - s1->RUDP_OptimizedMss = mss; - - // Enqueue the newly created socket, and set the event - InsertQueueWithLock(r->NewSockQueue, s1); - Set(r->NewSockConnectEvent); - } - else - { - // Client mode - Lock(r->Lock); - { - if (r->TargetConnectedSock == NULL && r->DoNotSetTargetConnectedSock == false) - { - // Update the end point information of the socket s2 - Copy(&s2->LocalIP, &r->UdpSock->LocalIP, sizeof(IP)); - s2->LocalPort = se->MyPort; - Copy(&s2->RemoteIP, &se->YourIp, sizeof(IP)); - s2->RemotePort = se->YourPort; - if (IsLocalHostIP(&s2->RemoteIP) == false) - { - AddIpClient(&s2->RemoteIP); - s2->IpClientAdded = true; - } - s2->IsRUDPSocket = true; - - s2->BulkSendKey = se->BulkSendKey; - s2->BulkRecvKey = se->BulkRecvKey; - - AddRef(s2->BulkSendKey->Ref); - AddRef(s2->BulkRecvKey->Ref); - - s2->RUDP_OptimizedMss = mss; - - // Register the socket to the RUDP stack - r->TargetConnectedSock = s2; - s2->R_UDP_Stack = r; - se->TcpSock = s1; - - JoinSockToSockEvent(s1, r->SockEvent); - - // Set the event to be set when the connection is successful - Set(r->TargetConnectedEvent); - } - else - { - Disconnect(s1); - Disconnect(s2); - ReleaseSock(s1); - ReleaseSock(s2); - } - } - Unlock(r->Lock); - } -} - -// Process the received payload -void RUDPProcessRecvPayload(RUDP_STACK *r, RUDP_SESSION *se, UINT64 seq, void *payload_data, UINT payload_size) -{ - RUDP_SEGMENT t; - RUDP_SEGMENT *s; - // Validate arguments - if (r == NULL || se == NULL || seq == 0 || payload_data == NULL || payload_size == 0 || payload_size > RUDP_MAX_SEGMENT_SIZE) - { - return; - } - - if (seq > (se->LastRecvCompleteSeqNo + RUDP_MAX_NUM_ACK)) - { - // Ignore the segment which have sequence number beyond the window size, and also not to reply an ACK - return; - } - - if (seq <= se->LastRecvCompleteSeqNo) - { - // Do not receive the segment which have the sequence number that has been already received. However, reply an ACK for it - AddInt64Distinct(se->ReplyAckList, seq); - return; - } - - Zero(&t, sizeof(t)); - t.SeqNo = seq; - - s = Search(se->RecvSegmentList, &t); - if (s != NULL) - { - // Do not receive the segment which have the sequence number that has been already received. However, reply an ACK for it - AddInt64Distinct(se->ReplyAckList, seq); - return; - } - - // Received a segment of the new sequence number - s = ZeroMalloc(sizeof(RUDP_SEGMENT)); - s->SeqNo = seq; - Copy(s->Data, payload_data, payload_size); - s->Size = payload_size; - Insert(se->RecvSegmentList, s); - - // Reply an ACK - AddInt64Distinct(se->ReplyAckList, seq); - - // Create a socket for session if it have not been created yet - //RUDPInitSock(r, se); -} - -// Process the incoming ACK -void RUDPProcessAck(RUDP_STACK *r, RUDP_SESSION *se, UINT64 seq) -{ - RUDP_SEGMENT t; - RUDP_SEGMENT *s; - // Validate arguments - if (r == NULL || se == NULL || seq == 0) - { - return; - } - - Zero(&t, sizeof(t)); - t.SeqNo = seq; - - s = Search(se->SendSegmentList, &t); - if (s == NULL) - { - return; - } - - Delete(se->SendSegmentList, s); - Free(s); -} - -// Remove all segments which are preceding max_seq as already delivered -void RUDPProcessAck2(RUDP_STACK *r, RUDP_SESSION *se, UINT64 max_seq) -{ - LIST *o; - UINT i; - // Validate arguments - if (r == NULL || se == NULL || max_seq == 0) - { - return; - } - - o = NULL; - - for (i = 0; i < LIST_NUM(se->SendSegmentList); i++) - { - RUDP_SEGMENT *s = LIST_DATA(se->SendSegmentList, i); - - if (s->SeqNo <= max_seq) - { - if (o == NULL) - { - o = NewListFast(NULL); - } - - Add(o, s); - } - } - - if (o != NULL) - { - for (i = 0; i < LIST_NUM(o); i++) - { - RUDP_SEGMENT *s = LIST_DATA(o, i); - - Delete(se->SendSegmentList, s); - - Free(s); - } - - ReleaseList(o); - } -} - -// Get the minimum sequence number which is trying to send -UINT64 RUDPGetCurrentSendingMinSeqNo(RUDP_SESSION *se) -{ - RUDP_SEGMENT *s; - // Validate arguments - if (se == NULL) - { - return 0; - } - - if (LIST_NUM(se->SendSegmentList) == 0) - { - return 0; - } - - s = LIST_DATA(se->SendSegmentList, 0); - - return s->SeqNo; -} - -// Get the maximum sequence number which is trying to send -UINT64 RUDPGetCurrentSendingMaxSeqNo(RUDP_SESSION *se) -{ - RUDP_SEGMENT *s; - // Validate arguments - if (se == NULL) - { - return 0; - } - - if (LIST_NUM(se->SendSegmentList) == 0) - { - return 0; - } - - s = LIST_DATA(se->SendSegmentList, (LIST_NUM(se->SendSegmentList) - 1)); - - return s->SeqNo; -} - -// R-UDP segment transmission -void RUDPSendSegmentNow(RUDP_STACK *r, RUDP_SESSION *se, UINT64 seq_no, void *data, UINT size) -{ - UCHAR dst[RUDP_MAX_PACKET_SIZE]; - UCHAR *p; - UCHAR *iv; - LIST *o = NULL; - UINT i; - UCHAR padlen; - UINT current_size; - UCHAR sign[SHA1_SIZE]; - UCHAR key[SHA1_SIZE]; - UCHAR keygen[SHA1_SIZE * 2]; - CRYPT *c; - UINT next_iv_pos; - UINT num_ack; - UINT icmp_type = 0; - // Validate arguments - if (r == NULL || se == NULL || (size != 0 && data == NULL) || (size > RUDP_MAX_SEGMENT_SIZE)) - { - return; - } - - Zero(dst, sizeof(dst)); - p = dst; - - // SIGN - Copy(p, se->Key_Send, SHA1_SIZE); - p += SHA1_SIZE; - - // IV - iv = p; - Copy(iv, se->NextIv, SHA1_SIZE); - p += SHA1_SIZE; - - for (i = 0; i < MIN(LIST_NUM(se->ReplyAckList), RUDP_MAX_NUM_ACK); i++) - { - UINT64 *seq = LIST_DATA(se->ReplyAckList, i); - - if (o == NULL) - { - o = NewListFast(NULL); - } - - Add(o, seq); - } - - // MyTick - WRITE_UINT64(p, r->Now); - p += sizeof(UINT64); - - // YourTick - WRITE_UINT64(p, se->YourTick); - p += sizeof(UINT64); - - // MAX_ACK - WRITE_UINT64(p, se->LastRecvCompleteSeqNo); - p += sizeof(UINT64); - - // NUM_ACK - num_ack = LIST_NUM(o); - WRITE_UINT(p, num_ack); - p += sizeof(UINT); - - if (o != NULL) - { - // ACK body - for (i = 0; i < LIST_NUM(o); i++) - { - UINT64 *seq = LIST_DATA(o, i); - - WRITE_UINT64(p, *seq); - p += sizeof(UINT64); - - Delete(se->ReplyAckList, seq); - - Free(seq); - } - ReleaseList(o); - } - - // SEQ - WRITE_UINT64(p, seq_no); - p += sizeof(UINT64); - - // data - Copy(p, data, size); - p += size; - - // padding - padlen = Rand8(); - padlen = MAX(padlen, 1); - - for (i = 0; i < padlen; i++) - { - *p = padlen; - p++; - } - - current_size = (UINT)(p - dst); - - // Encrypt - Copy(keygen + 0, iv, SHA1_SIZE); - Copy(keygen + SHA1_SIZE, se->Key_Send, SHA1_SIZE); - Sha1(key, keygen, sizeof(keygen)); - c = NewCrypt(key, sizeof(key)); - Encrypt(c, dst + SHA1_SIZE * 2, dst + SHA1_SIZE * 2, current_size - (SHA1_SIZE * 2)); - FreeCrypt(c); - - // Sign - Sha1(sign, dst, current_size); - if (r->Protocol == RUDP_PROTOCOL_DNS || r->Protocol == RUDP_PROTOCOL_ICMP) - { - XorData(sign, sign, r->SvcNameHash, SHA1_SIZE); - } - Copy(dst, sign, SHA1_SIZE); - - if (r->Protocol == RUDP_PROTOCOL_ICMP) - { - icmp_type = se->Icmp_Type; - } - else if (r->Protocol == RUDP_PROTOCOL_DNS) - { - icmp_type = se->Dns_TranId; - } - RUDPSendPacket(r, &se->YourIp, se->YourPort, dst, current_size, icmp_type); - - if (size >= 1) - { - se->LastSentTick = r->Now; - } - - // Next IV - next_iv_pos = Rand32() % (current_size - SHA1_SIZE); - Copy(se->NextIv, dst + next_iv_pos, SHA1_SIZE); - -#ifdef RUDP_DETAIL_LOG - Debug("RUDP %X Segment Sent: %I64u (num_ack=%u, size=%u)\n", se, seq_no, num_ack, size); -#endif // RUDP_DETAIL_LOG - - if (size >= 1) - { -#ifdef RUDP_DETAIL_LOG - Debug("Send Size: %X %I64u %u %u\n", se, seq_no, size, current_size); -#endif // RUDP_DETAIL_LOG - } -} - -// R-UDP segment transmission (only put into the queue) -void RUDPSendSegment(RUDP_STACK *r, RUDP_SESSION *se, void *data, UINT size) -{ - RUDP_SEGMENT *s; - // Validate arguments - if (r == NULL || se == NULL || (size != 0 && data == NULL) || (size > RUDP_MAX_SEGMENT_SIZE)) - { - return; - } - - s = ZeroMalloc(sizeof(RUDP_SEGMENT)); - - Copy(s->Data, data, size); - s->Size = size; - - s->SeqNo = se->NextSendSeqNo++; - - Insert(se->SendSegmentList, s); -} - -// Search for a session -RUDP_SESSION *RUDPSearchSession(RUDP_STACK *r, IP *my_ip, UINT my_port, IP *your_ip, UINT your_port) -{ - RUDP_SESSION t; - RUDP_SESSION *se; - // Validate arguments - if (r == NULL || my_ip == NULL || your_ip == NULL) - { - return NULL; - } - - Copy(&t.MyIp, my_ip, sizeof(IP)); - t.MyPort = my_port; - Copy(&t.YourIp, your_ip, sizeof(IP)); - t.YourPort = your_port; - - se = Search(r->SessionList, &t); - - return se; -} - -// Release of the session -void RUDPFreeSession(RUDP_SESSION *se) -{ - UINT i; - // Validate arguments - if (se == NULL) - { - return; - } - - Debug("RUDPFreeSession %X\n", se); - - for (i = 0; i < LIST_NUM(se->SendSegmentList); i++) - { - RUDP_SEGMENT *s = LIST_DATA(se->SendSegmentList, i); - - Free(s); - } - - ReleaseList(se->SendSegmentList); - - for (i = 0; i < LIST_NUM(se->RecvSegmentList); i++) - { - RUDP_SEGMENT *s = LIST_DATA(se->RecvSegmentList, i); - - Free(s); - } - - ReleaseList(se->RecvSegmentList); - - if (se->TcpSock != NULL) - { - Disconnect(se->TcpSock); - ReleaseSock(se->TcpSock); - } - - ReleaseInt64List(se->ReplyAckList); - - ReleaseFifo(se->RecvFifo); - ReleaseFifo(se->SendFifo); - - ReleaseSharedBuffer(se->BulkSendKey); - ReleaseSharedBuffer(se->BulkRecvKey); - - Free(se); -} - -// Create a new session -RUDP_SESSION *RUDPNewSession(bool server_mode, IP *my_ip, UINT my_port, IP *your_ip, UINT your_port, UCHAR *init_key) -{ - RUDP_SESSION *se; - UCHAR key1[SHA1_SIZE]; - UCHAR key2[SHA1_SIZE]; - UCHAR bulk_send_key[RUDP_BULK_KEY_SIZE_MAX]; - UCHAR bulk_recv_key[RUDP_BULK_KEY_SIZE_MAX]; - BUF *b; - - se = ZeroMalloc(sizeof(RUDP_SESSION)); - - Copy(&se->MyIp, my_ip, sizeof(IP)); - se->MyPort = my_port; - - Copy(&se->YourIp, your_ip, sizeof(IP)); - se->YourPort = your_port; - - Copy(se->Key_Init, init_key, SHA1_SIZE); - se->LastSentTick = 0; - se->LastRecvTick = Tick64(); - se->LatestRecvMyTick = Tick64(); - - se->NextSendSeqNo = 1; - - se->ServerMode = server_mode; - - se->SendSegmentList = NewList(RUDPCompareSegmentList); - se->RecvSegmentList = NewList(RUDPCompareSegmentList); - - // Generate the two keys - b = NewBuf(); - WriteBuf(b, init_key, SHA1_SIZE); - WriteBufStr(b, "zurukko"); - Sha1(key1, b->Buf, b->Size); - FreeBuf(b); - - b = NewBuf(); - WriteBuf(b, init_key, SHA1_SIZE); - WriteBuf(b, key1, SHA1_SIZE); - WriteBufStr(b, "yasushineko"); - Sha1(key2, b->Buf, b->Size); - FreeBuf(b); - - // Generate the magic number for the KeepAlive - b = NewBuf(); - WriteBuf(b, init_key, SHA1_SIZE); - WriteBufStr(b, "Magic_KeepAliveRequest"); - Sha1(se->Magic_KeepAliveRequest, b->Buf, b->Size); - FreeBuf(b); - b = NewBuf(); - WriteBuf(b, init_key, SHA1_SIZE); - WriteBufStr(b, "Magic_KeepAliveResponse"); - Sha1(se->Magic_KeepAliveResponse, b->Buf, b->Size); - FreeBuf(b); - - if (server_mode == false) - { - se->Magic_Disconnect = 0xffffffff00000000ULL | (UINT64)(Rand32()); - } - - Copy(se->Key_Init, init_key, SHA1_SIZE); - - if (se->ServerMode) - { - Copy(se->Key_Send, key1, SHA1_SIZE); - Copy(se->Key_Recv, key2, SHA1_SIZE); - } - else - { - Copy(se->Key_Send, key2, SHA1_SIZE); - Copy(se->Key_Recv, key1, SHA1_SIZE); - } - - Rand(se->NextIv, sizeof(se->NextIv)); - - se->ReplyAckList = NewInt64List(true); - - se->NextKeepAliveInterval = RUDP_KEEPALIVE_INTERVAL_MIN + (Rand32() % (RUDP_KEEPALIVE_INTERVAL_MAX - RUDP_KEEPALIVE_INTERVAL_MIN)); - - se->RecvFifo = NewFifo(); - se->SendFifo = NewFifo(); - - se->Dns_TranId = Rand16() % 65535 + 1; - - // Generate the bulk transfer key - Rand(bulk_send_key, sizeof(bulk_send_key)); - Rand(bulk_recv_key, sizeof(bulk_recv_key)); - - se->BulkSendKey = NewSharedBuffer(bulk_send_key, sizeof(bulk_send_key)); - se->BulkRecvKey = NewSharedBuffer(bulk_recv_key, sizeof(bulk_recv_key)); - - Rand(se->BulkNextIv, sizeof(se->BulkNextIv)); - Rand(se->BulkNextIv_V2, sizeof(se->BulkNextIv_V2)); - - se->BulkNextSeqNo = 1; - - return se; -} - -// Comparison function of the segment list items -int RUDPCompareSegmentList(void *p1, void *p2) -{ - RUDP_SEGMENT *s1, *s2; - UINT r; - // Validate arguments - if (p1 == NULL || p2 == NULL) - { - return 0; - } - s1 = *((RUDP_SEGMENT **)p1); - s2 = *((RUDP_SEGMENT **)p2); - if (s1 == NULL || s2 == NULL) - { - return 0; - } - - r = COMPARE_RET(s1->SeqNo, s2->SeqNo); - - return r; -} - -// Send a UDP packet -void RUDPSendPacket(RUDP_STACK *r, IP *dest_ip, UINT dest_port, void *data, UINT size, UINT icmp_type) -{ - UDPPACKET *p; - // Validate arguments - if (r == NULL || dest_ip == NULL || dest_port == 0 || data == NULL || size == 0) - { - return; - } - - p = NewUdpPacket(&r->UdpSock->LocalIP, r->UdpSock->LocalPort, - dest_ip, dest_port, - Clone(data, size), size); - - if (r->Protocol == RUDP_PROTOCOL_ICMP || r->Protocol == RUDP_PROTOCOL_DNS) - { - // ICMP Type / DNS Tran ID - p->Type = icmp_type; - } - - Add(r->SendPacketList, p); -} - -// R-UDP main thread -void RUDPMainThread(THREAD *thread, void *param) -{ - RUDP_STACK *r; - bool halt_flag = false; - // Validate arguments - if (thread == NULL || param == NULL) - { - return; - } - - r = (RUDP_STACK *)param; - - AddWaitThread(thread); - NoticeThreadInit(thread); - - while (true) - { - UINT wait_interval; - UINT i; - UINT min_wait_interval; - UINT num_ignore_errors = 0; - - r->Now = Tick64(); - - Lock(r->Lock); - { - Copy(&r->NatT_IP_Safe, &r->NatT_IP, sizeof(IP)); - Copy(&r->My_Private_IP_Safe, &r->My_Private_IP, sizeof(IP)); - } - Unlock(r->Lock); - - // Receive the data from the UDP socket - while (true) - { - UINT ret; - IP ip_src; - UINT port_src; - - ret = RecvFrom(r->UdpSock, &ip_src, &port_src, r->TmpBuf, sizeof(r->TmpBuf)); - - if (ret == SOCK_LATER) - { - // There is no packet more - break; - } - else if (ret != 0) - { - // Receive a Packet - bool ok = false; - UDPPACKET *p = NewUdpPacket(&ip_src, port_src, - &r->UdpSock->LocalIP, r->UdpSock->LocalPort, - Clone(r->TmpBuf, ret), ret); - - if (r->Protocol == RUDP_PROTOCOL_ICMP) - { - // Analyse the incoming ICMP packet - UINT ip_header_size = GetIpHeaderSize(p->Data, p->Size); - - if (ip_header_size >= sizeof(IPV4_HEADER)) - { - if (p->Size >= (ip_header_size + sizeof(ICMP_HEADER) + sizeof(ICMP_ECHO) + SHA1_SIZE)) - { - IPV4_HEADER *ip_header = (IPV4_HEADER *)(((UCHAR *)p->Data) + 0); - ICMP_HEADER *icmp_header = (ICMP_HEADER *)(((UCHAR *)p->Data) + ip_header_size); - ICMP_ECHO *echo_header = (ICMP_ECHO *)(((UCHAR *)p->Data) + ip_header_size + sizeof(ICMP_HEADER)); - - if (icmp_header->Type == ICMP_TYPE_ECHO_RESPONSE || - icmp_header->Type == (r->ServerMode ? ICMP_TYPE_INFORMATION_REQUEST : ICMP_TYPE_INFORMATION_REPLY)) - { - UCHAR hash[SHA1_SIZE]; - - Sha1(hash, ((UCHAR *)p->Data) + ip_header_size + sizeof(ICMP_HEADER) + sizeof(ICMP_ECHO) + SHA1_SIZE, - p->Size - (ip_header_size + sizeof(ICMP_HEADER) + sizeof(ICMP_ECHO) + SHA1_SIZE)); - - if (Cmp(hash, ((UCHAR *)p->Data) + ip_header_size + sizeof(ICMP_HEADER) + sizeof(ICMP_ECHO), SHA1_SIZE) == 0) - { - UCHAR *new_data; - UINT new_data_size; - if (r->ServerMode) - { - // On the server side, the ICMP ID and the SEQ NO of received messages are treated as a source port number - Copy(&p->SrcPort, echo_header, sizeof(UINT)); - } - - // Record the Type - p->Type = icmp_header->Type; - - // Erase the header part - new_data_size = p->Size - (ip_header_size + sizeof(ICMP_HEADER) + sizeof(ICMP_ECHO) + SHA1_SIZE); - new_data = Clone(((UCHAR *)p->Data) + ip_header_size + sizeof(ICMP_HEADER) + sizeof(ICMP_ECHO) + SHA1_SIZE, new_data_size); - Free(p->Data); - p->Data = new_data; - p->Size = new_data_size; - - ok = true; - } - } - } - } - } - else if (r->Protocol == RUDP_PROTOCOL_DNS) - { - // Analyse the incoming DNS packet - UINT offset; - - if (r->ServerMode == false) - { - offset = 42; - } - else - { - offset = 37; - } - - if (p->Size > offset) - { - UCHAR *new_data; - UINT new_size = p->Size - offset; - - p->Type = *((USHORT *)p->Data); - - new_data = Clone(((UCHAR *)p->Data) + offset, new_size); - - Free(p->Data); - p->Data = new_data; - p->Size = new_size; - - ok = true; - } - } - else - { - // Don't do anything for ordinary UDP packet - ok = true; - } - - if (ok) - { - // Process the received packet - RUDPRecvProc(r, p); - - r->TotalPhysicalReceived += ret; - } - - FreeUdpPacket(p); - } - else - { - if (r->UdpSock->IgnoreRecvErr) - { - // An ignorable reception error occurs - if ((num_ignore_errors++) >= MAX_NUM_IGNORE_ERRORS) - { - break; - } - } - else - { - // A non-ignorable reception error occurs - break; - } - } - } - - // Call the interrupt notification callback function - if (r->ProcInterrupts != NULL) - { - r->ProcInterrupts(r); - } - - RUDPInterruptProc(r); - - // Send all packets in the transmission packet list - for (i = 0; i < LIST_NUM(r->SendPacketList); i++) - { - UDPPACKET *p = LIST_DATA(r->SendPacketList, i); - - if (r->Protocol == RUDP_PROTOCOL_ICMP) - { - // In case of the ICMP protocol, assemble an ICMP header - UINT dst_size = sizeof(ICMP_HEADER) + sizeof(ICMP_ECHO) + SHA1_SIZE + p->Size; - UCHAR *dst_data = ZeroMalloc(dst_size); - - ICMP_HEADER *icmp_header = (ICMP_HEADER *)dst_data; - ICMP_ECHO *icmp_echo = (ICMP_ECHO *)(dst_data + sizeof(ICMP_HEADER)); - UCHAR *hash = dst_data + sizeof(ICMP_HEADER) + sizeof(ICMP_ECHO); - UCHAR *icmp_data = dst_data + sizeof(ICMP_HEADER) + sizeof(ICMP_ECHO) + SHA1_SIZE; - - // Header - icmp_header->Type = (UCHAR)p->Type; - icmp_header->Code = 0; - icmp_header->Checksum = 0; - - if (r->ServerMode) - { - // On the server side, use the port number in the opponent internal data as ICMP ID and SEQ NO - Copy(icmp_echo, &p->DestPort, 4); - } - else - { - // Use the fixed ICMP ID and SEQ NO on the client side - icmp_echo->Identifier = Endian16(r->Client_IcmpId); - icmp_echo->SeqNo = Endian16(r->Client_IcmpSeqNo); - } - - // Data body - Copy(icmp_data, p->Data, p->Size); - - // Hash - Sha1(hash, icmp_data, p->Size); - - // Checksum calculation - icmp_header->Checksum = IpChecksum(dst_data, dst_size); - - // Replacement - Free(p->Data); - p->Data = dst_data; - p->Size = dst_size; - } - else if (r->Protocol == RUDP_PROTOCOL_DNS) - { - BUF *b = NewBuf(); - // In case of over DNS protocol, assemble a header that conforms to the DNS protocol - if (r->ServerMode == false) - { - // DNS query header - USHORT us = Rand16() % 65535 + 1; - static UCHAR dns_query_header_1[] = - { - 0x01, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x08, - }; - static UCHAR dns_query_header_2[] = - { - 0x00, 0x00, 0x30, 0x00, 0x01, 0x00, 0x00, 0x29, 0x10, - 0x00, 0x00, 0x00, 0x80, 0x00, - }; - UCHAR rand_data[4]; - char rand_str[MAX_SIZE]; - - Rand(rand_data, sizeof(rand_data)); - BinToStr(rand_str, sizeof(rand_str), rand_data, sizeof(rand_data)); - StrLower(rand_str); - - WriteBuf(b, &us, sizeof(USHORT)); - WriteBuf(b, dns_query_header_1, sizeof(dns_query_header_1)); - WriteBuf(b, rand_str, 8); - WriteBuf(b, dns_query_header_2, sizeof(dns_query_header_2)); - us = Endian16((USHORT)p->Size); - WriteBuf(b, &us, sizeof(USHORT)); - WriteBuf(b, p->Data, p->Size); - } - else - { - // DNS response header - USHORT us = p->Type; - UINT ui; - static UCHAR dns_response_header_1[] = - { - 0x81, 0x80, 0x00, 0x01, 0x00, 0x01, 0x00, 0x00, - 0x00, 0x00, 0x08, - }; - static UCHAR dns_response_header_2[] = - { - 0x00, 0x00, 0x30, 0x00, 0x01, - 0xc0, 0x0c, 0x00, 0x30, 0x00, 0x01, 0x00, 0x00, 0xa4, 0x5b, - }; - static UCHAR dns_response_header_3[] = - { - 0x01, 0x00, 0x03, 0x08, - }; - UCHAR rand_data[4]; - char rand_str[MAX_SIZE]; - - Rand(rand_data, sizeof(rand_data)); - BinToStr(rand_str, sizeof(rand_str), rand_data, sizeof(rand_data)); - StrLower(rand_str); - - WriteBuf(b, &us, sizeof(USHORT)); - WriteBuf(b, dns_response_header_1, sizeof(dns_response_header_1)); - WriteBuf(b, rand_str, 8); - WriteBuf(b, dns_response_header_2, sizeof(dns_response_header_2)); - us = Endian16((USHORT)(p->Size + 4)); - WriteBuf(b, &us, sizeof(USHORT)); - WriteBuf(b, dns_response_header_3, sizeof(dns_response_header_3)); - WriteBuf(b, p->Data, p->Size); - - ui = Rand16() % (60 * 60 * 12) + (60 * 60 * 12); - WRITE_UINT(((UCHAR *)b->Buf) + 0x20, ui); - } - Free(p->Data); - p->Data = b->Buf; - p->Size = b->Size; - Free(b); - } - - SendTo(r->UdpSock, &p->DstIP, p->DestPort, p->Data, p->Size); - - r->TotalPhysicalSent += p->Size; - - FreeUdpPacket(p); - } - DeleteAll(r->SendPacketList); - - if (r->Halt) - { - // If it is necessary to stop, stop it after cycling through a loop - if (halt_flag == false) - { - halt_flag = true; - continue; - } - else - { - break; - } - } - - // Rest the CPU until the next event - wait_interval = GetNextIntervalForInterrupt(r->Interrupt); - if (r->ServerMode) - { - min_wait_interval = RUDP_LOOP_WAIT_INTERVAL_S; - } - else - { - min_wait_interval = RUDP_LOOP_WAIT_INTERVAL_C; - } - - if (wait_interval == INFINITE) - { - wait_interval = min_wait_interval; - } - else - { - wait_interval = MIN(min_wait_interval, wait_interval); - } - -#ifdef RUDP_DETAIL_LOG - Debug("wait_interval = %u\n", wait_interval); -#endif // RUDP_DETAIL_LOG - - if (wait_interval >= 1) - { - WaitSockEvent(r->SockEvent, wait_interval); - } - -#ifdef RUDP_DETAIL_LOG - if (r->ServerMode) - { - char str1[MAX_SIZE]; - char str2[MAX_SIZE]; - double rate = 0.0; - - ToStr64(str1, r->TotalPhysicalReceived); - ToStr64(str2, r->TotalLogicalReceived); - - if (r->TotalPhysicalReceived >= 1) - { - rate = (double)r->TotalLogicalReceived / (double)r->TotalPhysicalReceived; - } - - Debug("%s / %s %.4f\n", str1, str2, rate); - } -#endif // RUDP_DETAIL_LOG - } - - Disconnect(r->UdpSock); - - DelWaitThread(thread); -} - -// Generate a appropriate register host name from the IP address -void RUDPGetRegisterHostNameByIP(char *dst, UINT size, IP *ip) -{ - char tmp[16]; - // Validate arguments - if (dst == NULL) - { - return; - } - - if (ip != NULL && IsIP4(ip)) - { - UCHAR hash[SHA1_SIZE]; - - Sha1(hash, ip->addr, 4); - BinToStr(tmp, sizeof(tmp), hash, 2); - } - else - { - UCHAR rand[2]; - Rand(rand, 2); - BinToStr(tmp, sizeof(tmp), rand, 2); - } - - StrLower(tmp); - Format(dst, size, - (IsUseAlternativeHostname() ? UDP_NAT_T_SERVER_TAG_ALT : UDP_NAT_T_SERVER_TAG), - tmp[2], tmp[3]); - - - if (false) - { - Debug("Hash Src IP: %r\n" - "Hash Dst HN: %s\n", - ip, - dst); - } -} - -// Analyze the IP address and port number from the string -bool RUDPParseIPAndPortStr(void *data, UINT data_size, IP *ip, UINT *port) -{ - char tmp[MAX_SIZE]; - UINT i; - char ipstr[MAX_SIZE]; - char *portstr; - // Validate arguments - if (data == NULL || ip == NULL || port == NULL) - { - return false; - } - - Zero(tmp, sizeof(tmp)); - - Copy(tmp, data, MIN(data_size, sizeof(tmp) - 1)); - - if (StartWith(tmp, "IP=") == false) - { - return false; - } - - i = SearchStrEx(tmp, "#", 0, true); - if (i != INFINITE) - { - tmp[i] = 0; - } - - StrCpy(ipstr, sizeof(ipstr), tmp + 3); - - i = SearchStrEx(ipstr, ",PORT=", 0, true); - if (i == INFINITE) - { - return false; - } - - ipstr[i] = 0; - portstr = ipstr + i + 6; - - StrToIP(ip, ipstr); - *port = ToInt(portstr); - - return true; -} - -// R-UDP NAT-T IP address acquisition thread -void RUDPIpQueryThread(THREAD *thread, void *param) -{ - RUDP_STACK *r; - UINT64 next_getip_tick = 0; - UINT64 next_getprivate_ip_tick = 0; - UINT last_ip_hash = 0; - void *route_change_poller = NULL; - char current_hostname[MAX_SIZE]; - bool last_time_ip_changed = false; - UINT num_retry = 0; - // Validate arguments - if (thread == NULL || param == NULL) - { - return; - } - - r = (RUDP_STACK *)param; - - last_ip_hash = GetHostIPAddressHash32(); - - route_change_poller = NewRouteChange(); - IsRouteChanged(route_change_poller); - - Zero(current_hostname, sizeof(current_hostname)); - - while (r->Halt == false) - { - UINT ip_hash = GetHostIPAddressHash32(); - UINT64 now = Tick64(); - bool ip_changed = false; - - if (ip_hash != last_ip_hash) - { - last_time_ip_changed = false; - } - - if ((ip_hash != last_ip_hash) || (IsRouteChanged(route_change_poller))) - { - if (last_time_ip_changed == false) - { - // Call all getting functions from the beginning - // if the routing table or the IP address of this host has changed - next_getip_tick = 0; - next_getprivate_ip_tick = 0; - ip_changed = true; - - last_ip_hash = ip_hash; - - last_time_ip_changed = true; - } - } - else - { - last_time_ip_changed = false; - } - - Lock(r->Lock); - { - if (StrCmpi(current_hostname, r->CurrentRegisterHostname) != 0) - { - // The target host name has changed - next_getip_tick = 0; - StrCpy(current_hostname, sizeof(current_hostname), r->CurrentRegisterHostname); - } - } - Unlock(r->Lock); - - // Get the IP address of the NAT-T server with DNS - if (next_getip_tick == 0 || now >= next_getip_tick) - { - IP ip; - - if (GetIP4(&ip, current_hostname) && IsZeroIp(&ip) == false) - { - Lock(r->Lock); - { -// Debug("%r %r\n",&r->NatT_IP, &ip); - if (CmpIpAddr(&r->NatT_IP, &ip) != 0) - { -// WHERE; - ip_changed = true; - Copy(&r->NatT_IP, &ip, sizeof(IP)); - } - } - Unlock(r->Lock); - } - - if (IsZeroIp(&r->NatT_IP)) - { - num_retry++; - - next_getip_tick = now + MIN((UINT64)UDP_NAT_T_GET_IP_INTERVAL * (UINT64)num_retry, (UINT64)UDP_NAT_T_GET_IP_INTERVAL_MAX); - } - else - { - next_getip_tick = now + (UINT64)UDP_NAT_T_GET_IP_INTERVAL_AFTER; - } - - if (ip_changed) - { - Debug("NAT-T: NAT-T Server IP (%s): %r\n", current_hostname, &r->NatT_IP); - - r->NatT_GetTokenNextTick = 0; - r->NatT_RegisterNextTick = 0; - r->NatT_GetTokenFailNum = 0; - r->NatT_RegisterFailNum = 0; - - r->NatT_TranId = Rand64(); - - SetSockEvent(r->SockEvent); - } - } - - // Get a private IP address of this host using TCP - if (next_getprivate_ip_tick == 0 || now >= next_getprivate_ip_tick) - { - IP ip; - - if (GetMyPrivateIP(&ip, false)) - { - Lock(r->Lock); - { - Copy(&r->My_Private_IP, &ip, sizeof(IP)); - } - Unlock(r->Lock); - } - - if (IsZeroIp(&r->My_Private_IP)) - { - next_getprivate_ip_tick = now + (UINT64)UDP_NAT_T_GET_PRIVATE_IP_INTERVAL; - } - else - { - next_getprivate_ip_tick = now + (UINT64)GenRandInterval(UDP_NAT_T_GET_PRIVATE_IP_INTERVAL_AFTER_MIN, UDP_NAT_T_GET_PRIVATE_IP_INTERVAL_AFTER_MAX); - } - - Debug("NAT-T: My Private IP: %r\n", &r->My_Private_IP); - } - - if (r->Halt) - { - break; - } - - Wait(r->HaltEvent, RUDP_LOOP_WAIT_INTERVAL_S); - } - - FreeRouteChange(route_change_poller); -} - -// Generate a random intervals -UINT GenRandInterval(UINT min, UINT max) -{ - UINT a, b; - - a = MIN(min, max); - b = MAX(min, max); - - if (a == b) - { - return a; - } - - return (Rand32() % (b - a)) + a; -} - -// Identify the private IP of the interface which is used to connect to the Internet currently -bool GetMyPrivateIP(IP *ip, bool from_vg) -{ - SOCK *s; - IP t; - char *hostname = UDP_NAT_T_GET_PRIVATE_IP_TCP_SERVER; - // Validate arguments - if (ip == NULL) - { - return false; - } - - s = ConnectEx(hostname, UDP_NAT_T_PORT_FOR_TCP_1, UDP_NAT_T_GET_PRIVATE_IP_CONNECT_TIMEOUT); - - if (s == NULL) - { - s = ConnectEx(hostname, UDP_NAT_T_PORT_FOR_TCP_2, UDP_NAT_T_GET_PRIVATE_IP_CONNECT_TIMEOUT); - - if (s == NULL) - { - s = ConnectEx(GetRandHostNameForGetMyPrivateIP(), UDP_NAT_T_PORT_FOR_TCP_1, UDP_NAT_T_GET_PRIVATE_IP_CONNECT_TIMEOUT); - - if (s == NULL) - { - return false; - } - } - } - - Copy(&t, &s->LocalIP, sizeof(IP)); - - Disconnect(s); - ReleaseSock(s); - - if (IsZeroIp(&t)) - { - return false; - } - - Copy(ip, &t, sizeof(IP)); - - return true; -} -char *GetRandHostNameForGetMyPrivateIP() -{ - char *hosts[] = - { - "www.microsoft.com", - "www.yahoo.com", - "www.bing.com", - }; - UINT num_hosts = 3; - - return hosts[Rand32() % num_hosts]; -} - -// Function to wait until changing any IP address of the host or expiring the specified time or waking the event -void WaitUntilHostIPAddressChanged(void *p, EVENT *event, UINT timeout, UINT ip_check_interval) -{ - UINT64 start, end; - UINT last_hash; - // Validate arguments - if (timeout == 0x7FFFFFFF) - { - timeout = 0xFFFFFFFF; - } - if (ip_check_interval == 0) - { - ip_check_interval = 0xFFFFFFFF; - } - if (event == NULL || timeout == 0) - { - return; - } - - start = Tick64(); - end = start + (UINT64)timeout; - last_hash = GetHostIPAddressHash32(); - - while (true) - { - UINT64 now = Tick64(); - UINT next_interval; - - if (now >= end) - { - break; - } - - if (p != NULL) - { - if (IsRouteChanged(p)) - { - break; - } - } - - if (last_hash != GetHostIPAddressHash32()) - { - break; - } - - next_interval = (UINT)(end - now); - next_interval = MIN(next_interval, ip_check_interval); - - if (Wait(event, next_interval)) - { - break; - } - } -} -void *InitWaitUntilHostIPAddressChanged() -{ - void *p = NewRouteChange(); - - if (p != NULL) - { - IsRouteChanged(p); - } - - return p; -} -void FreeWaitUntilHostIPAddressChanged(void *p) -{ - FreeRouteChange(p); -} - -// Get whether the specified IPv6 address is on the local network -bool IsIPv6LocalNetworkAddress(IP *ip) -{ - UINT type; - LIST *o; - UINT i; - bool ret = false; - IP mask64; - // Validate arguments - if (ip == NULL) - { - return false; - } - if (IsIP6(ip) == false) - { - return false; - } - if (IsZeroIp(ip)) - { - return false; - } - - type = GetIPAddrType6(ip); - - if (type & IPV6_ADDR_LOCAL_UNICAST) - { - return true; - } - - if ((type & IPV6_ADDR_GLOBAL_UNICAST) == 0) - { - return false; - } - - IntToSubnetMask6(&mask64, 64); - - o = GetHostIPAddressList(); - - ret = false; - - for (i = 0; i < LIST_NUM(o); i++) - { - IP *p = LIST_DATA(o, i); - - if (IsIP6(p)) - { - if (IsZeroIp(p) == false) - { - if (IsLocalHostIP6(p) == false) - { - if (IsInSameNetwork6(p, ip, &mask64)) - { - ret = true; - } - } - } - } - } - - FreeHostIPAddressList(o); - - return ret; -} - -// Check whether the specified IP address is localhost or the IP address of the local interface of itself -bool IsIPLocalHostOrMySelf(IP *ip) -{ - LIST *o; - bool ret = false; - UINT i; - // Validate arguments - if (ip == NULL) - { - return false; - } - - o = GetHostIPAddressList(); - if (o == NULL) - { - return false; - } - - for (i = 0; i < LIST_NUM(o); i++) - { - IP *p = LIST_DATA(o, i); - - if (CmpIpAddr(p, ip) == 0) - { - ret = true; - - break; - } - } - - FreeHostIPAddressList(o); - - if (IsLocalHostIP4(ip) || IsLocalHostIP6(ip)) - { - ret = true; - } - - return ret; -} - -// Obtain the hash value of combining all of the IP address assigned to the host -UINT GetHostIPAddressHash32() -{ - BUF *b; - UINT i; - UCHAR hash[SHA1_SIZE]; - UINT ret; - LIST *o = GetHostIPAddressList(); - - if (o == NULL) - { - return 0; - } - - b = NewBuf(); - for (i = 0; i < LIST_NUM(o); i++) - { - IP *ip = LIST_DATA(o, i); - - WriteBuf(b, ip, sizeof(IP)); - - WriteBufStr(b, ":-) yas (-:"); - } - FreeHostIPAddressList(o); - - WriteBuf(b, rand_port_numbers, sizeof(rand_port_numbers)); - - Sha1(hash, b->Buf, b->Size); - - FreeBuf(b); - - Copy(&ret, hash, sizeof(UINT)); - - return ret; -} - -// Create an IPv4 UDP socket destined for a particular target -SOCK *NewUDP4ForSpecificIp(IP *target_ip, UINT port) -{ - SOCK *s; - IP local_ip; - // Validate arguments - if (target_ip == NULL || IsZeroIP(target_ip) || IsIP4(target_ip) == false) - { - target_ip = NULL; - } - - Zero(&local_ip, sizeof(local_ip)); - GetBestLocalIpForTarget(&local_ip, target_ip); - - s = NewUDP4(port, &local_ip); - - if (s == NULL) - { - s = NewUDP4(port, NULL); - } - - return s; -} - -// Get the best self IPv4 address to connect to the target IPv4 address -bool GetBestLocalIpForTarget(IP *local_ip, IP *target_ip) -{ - bool ret = false; - ROUTE_ENTRY *e; - IP ip2; - UINT n = 0; - IP zero_ip; - // Validate arguments - Zero(local_ip, sizeof(IP)); - ZeroIP4(&zero_ip); - if (target_ip == NULL) - { - target_ip = &zero_ip; - } - if (local_ip == NULL || IsIP4(target_ip) == false) - { - return false; - } - - Copy(&ip2, target_ip, sizeof(IP)); - - while (true) - { - n++; - if (n >= 64) - { - break; - } - - e = GetBestRouteEntry(&ip2); - if (e != NULL) - { - if (IsZeroIp(&e->GatewayIP)) - { - Free(e); - break; - } - - if (e->LocalRouting) - { - ret = true; - Copy(local_ip, &e->GatewayIP, sizeof(IP)); - Free(e); - break; - } - else - { - Copy(&ip2, &e->GatewayIP, sizeof(IP)); - } - - Free(e); - } - } - - if (ret == false) - { - if (IsLocalHostIP4(target_ip)) - { - GetLocalHostIP4(local_ip); - ret = true; - } - } - - return ret; -} - -// Create a R-UDP client (Connection via NAT-T gateway) -SOCK *NewRUDPClientNatT(char *svc_name, IP *ip, UINT *error_code, UINT timeout, bool *cancel, char *hint_str, char *target_hostname) -{ - IP nat_t_ip; - UINT dummy_int = 0; - UINT64 giveup_tick; - bool dummy_bool = false; - SOCK_EVENT *sock_event; - SOCK *sock; - bool same_lan = false; - char hostname[MAX_SIZE]; - - - - if (timeout == 0) - { - timeout = RUDP_TIMEOUT; - } - if (error_code == NULL) - { - error_code = &dummy_int; - } - if (cancel == NULL) - { - cancel = &dummy_bool; - } - *error_code = RUDP_ERROR_UNKNOWN; - if (svc_name == NULL || ip == NULL) - { - return NULL; - } - - ListenTcpForPopupFirewallDialog(); - - giveup_tick = Tick64() + (UINT64)timeout; - - // Get the IP address of the NAT-T server - RUDPGetRegisterHostNameByIP(hostname, sizeof(hostname), ip); - if (GetIP4Ex(&nat_t_ip, hostname, 0, cancel) == false) - { - *error_code = RUDP_ERROR_NAT_T_NO_RESPONSE; - return NULL; - } - - if (Tick64() >= giveup_tick) - { - *error_code = RUDP_ERROR_TIMEOUT; - return NULL; - } - if (*cancel) - { - *error_code = RUDP_ERROR_USER_CANCELED; - return NULL; - } - - sock = NewUDP4ForSpecificIp(&nat_t_ip, 0); - if (sock == NULL) - { - *error_code = RUDP_ERROR_UNKNOWN; - return NULL; - } - else - { - UINT64 next_send_request_tick = 0; - INTERRUPT_MANAGER *interrupt = NewInterruptManager(); - UINT64 tran_id = Rand64(); - UINT tmp_size = 65536; - UCHAR *tmp = Malloc(tmp_size); - char result_ip_str[MAX_SIZE]; - IP result_ip; - UINT result_port; - SOCK *ret = NULL; - UINT num_tries = 0; - UINT64 current_cookie = 0; - - AddInterrupt(interrupt, giveup_tick); - - sock_event = NewSockEvent(); - JoinSockToSockEvent(sock, sock_event); - - // Communication with the NAT-T server - while (true) - { - UINT64 now = Tick64(); - UINT interval; - UINT r; - IP src_ip; - UINT src_port; - UINT err; - UINT num_ignore_errors = 0; - - if (now >= giveup_tick) - { - // Time-out -LABEL_TIMEOUT: - *error_code = RUDP_ERROR_NAT_T_NO_RESPONSE; - break; - } - - if (*cancel) - { - // User canceled - *error_code = RUDP_ERROR_USER_CANCELED; - break; - } - - err = INFINITE; - - // Receive a response packet from the NAT-T server - while (err == INFINITE) - { - r = RecvFrom(sock, &src_ip, &src_port, tmp, tmp_size); - if (r == SOCK_LATER) - { - // No packet - break; - } - else if (r == 0) - { - if (sock->IgnoreRecvErr == false) - { - // Communication error - goto LABEL_TIMEOUT; - } - else - { - if ((num_ignore_errors++) >= MAX_NUM_IGNORE_ERRORS) - { - goto LABEL_TIMEOUT; - } - } - } - else - { - // Check the source IP address and the port number - if (CmpIpAddr(&src_ip, &nat_t_ip) == 0 && src_port == UDP_NAT_T_PORT) - { - BUF *b = NewBuf(); - PACK *p; - - WriteBuf(b, tmp, r); - SeekBuf(b, 0, 0); - - - p = BufToPack(b); - - if (p != NULL) - { - UINT64 cookie = PackGetInt64(p, "cookie"); - if (cookie != 0) - { - current_cookie = cookie; - } - - // Compare tran_id - if (PackGetInt64(p, "tran_id") == tran_id) - { - // Compare opcode - if (PackCmpStr(p, "opcode", "nat_t_connect_request")) - { - bool ok = PackGetBool(p, "ok"); - bool multi_candidate = PackGetBool(p, "multi_candidates"); - - if (ok) - { - // Success - PackGetStr(p, "result_ip", result_ip_str, sizeof(result_ip_str)); - StrToIP(&result_ip, result_ip_str); - - result_port = PackGetInt(p, "result_port"); - - same_lan = PackGetBool(p, "same_lan"); - - if (result_port != 0) - { - if (IsZeroIp(&result_ip) == false) - { - if ((sock->IPv6 == false && IsIP4(&result_ip)) || - (sock->IPv6 && IsIP6(&result_ip))) - { - err = RUDP_ERROR_OK; - } - } - } - } - else if (multi_candidate) - { - // There are two or more computers behind the specified IP address - err = RUDP_ERROR_NAT_T_TWO_OR_MORE; - } - else - { - // Failure - err = RUDP_ERROR_NAT_T_NOT_FOUND; - } - } - } - - FreePack(p); - } - - FreeBuf(b); - } - } - } - - if (err != INFINITE) - { - *error_code = err; - break; - } - - if (next_send_request_tick == 0 || now >= next_send_request_tick) - { - // Send a connection request to the NAT-T server - BUF *b; - char ip_str[MAX_SIZE]; - PACK *p = NewPack(); - - PackAddStr(p, "opcode", "nat_t_connect_request"); - PackAddInt64(p, "tran_id", tran_id); - IPToStr(ip_str, sizeof(ip_str), ip); - PackAddStr(p, "dest_ip", ip_str); - PackAddInt64(p, "cookie", current_cookie); - if (IsEmptyStr(hint_str) == false) - { - PackAddStr(p, "hint", hint_str); - } - if (IsEmptyStr(target_hostname) == false) - { - PackAddStr(p, "target_hostname", target_hostname); - } - PackAddStr(p, "svc_name", svc_name); - - PackAddInt(p, "nat_traversal_version", UDP_NAT_TRAVERSAL_VERSION); - - b = PackToBuf(p); - FreePack(p); - - SendTo(sock, &nat_t_ip, UDP_NAT_T_PORT, b->Buf, b->Size); - FreeBuf(b); - - // Determine the next transmission time - next_send_request_tick = now + (UINT64)UDP_NAT_T_CONNECT_INTERVAL * (UINT64)(Power(2, MAX(num_tries, 6))); - num_tries++; - AddInterrupt(interrupt, next_send_request_tick); - } - - interval = GetNextIntervalForInterrupt(interrupt); - interval = MIN(interval, 50); - - WaitSockEvent(sock_event, interval); - } - - Free(tmp); - FreeInterruptManager(interrupt); - - if (*error_code == RUDP_ERROR_OK) - { - UINT remain_timeout; - UINT64 now = Tick64(); - // Success to get the IP address and the port number of the target - - // Get the rest timeout tolerance - if (now <= giveup_tick) - { - remain_timeout = (UINT)(giveup_tick - now); - } - else - { - remain_timeout = 0; - } - - remain_timeout = MAX(remain_timeout, 2000); - - if (same_lan) - { - // Discard current UDP socket and create a new UDP socket in NewRUDPClientDirect(). - // Because using a UDP socket which used for communication with the NAT-T server - // can cause trouble when the client and the server exists in the same LAN. - ReleaseSockEvent(sock_event); - ReleaseSock(sock); - - sock = NULL; - sock_event = NULL; - } - - ret = NewRUDPClientDirect(svc_name, &result_ip, result_port, error_code, remain_timeout, cancel, - sock, sock_event, 0, false); - } - - if (sock_event != NULL) - { - ReleaseSockEvent(sock_event); - } - - if (sock != NULL) - { - if (ret == NULL) - { - Disconnect(sock); - } - - ReleaseSock(sock); - } - - return ret; - } -} - -// Listen to the TCP for a moment to show the firewall dialog -void ListenTcpForPopupFirewallDialog() -{ -#ifdef OS_WIN32 - static bool tried = false; - - if (tried == false) - { - SOCK *s; - tried = true; - s = ListenAnyPortEx2(false, true); - - if (s != NULL) - { - Disconnect(s); - ReleaseSock(s); - } - } -#endif // OS_WIN32 -} - -// Create a R-UDP client (direct connection) -SOCK *NewRUDPClientDirect(char *svc_name, IP *ip, UINT port, UINT *error_code, UINT timeout, bool *cancel, SOCK *sock, SOCK_EVENT *sock_event, UINT local_port, bool over_dns_mode) -{ - RUDP_STACK *r; - UINT dummy_int = 0; - SOCK *ret = NULL; - // Validate arguments - if (error_code == NULL) - { - error_code = &dummy_int; - } - if (timeout == 0) - { - timeout = RUDP_TIMEOUT; - } - *error_code = RUDP_ERROR_UNKNOWN; - if (svc_name == NULL || ip == NULL || port == 0) - { - return NULL; - } - - r = NewRUDP(false, svc_name, NULL, NULL, NULL, local_port, sock, sock_event, false, over_dns_mode, ip, NULL, 0, NULL); - if (r == NULL) - { - *error_code = RUDP_ERROR_UNKNOWN; - return NULL; - } - - // Set the port number and the target IP address - Lock(r->Lock); - { - Copy(&r->TargetIp, ip, sizeof(IP)); - r->TargetPort = port; - r->TargetIpAndPortInited = true; - } - Unlock(r->Lock); - SetSockEvent(r->SockEvent); - - // Wait for a connection success/failure to the target IP address - WaitEx(r->TargetConnectedEvent, timeout, cancel); - Lock(r->Lock); - { - if (r->TargetConnectedSock != NULL) - { - // The connection succeeded - ret = r->TargetConnectedSock; - r->TargetConnectedSock = NULL; - } - else - { - r->DoNotSetTargetConnectedSock = true; - } - } - Unlock(r->Lock); - - if (ret == NULL) - { - // Stop the R-UDP stack if the connection has failed - *error_code = RUDP_ERROR_TIMEOUT; - FreeRUDP(r); - } - else if (cancel != NULL && (*cancel)) - { - // User canceled - *error_code = RUDP_ERROR_USER_CANCELED; - - Disconnect(ret); - ReleaseSock(ret); - - ret = NULL; - } - else - { - *error_code = RUDP_ERROR_OK; - } - - return ret; -} - -// Creating a R-UDP server -RUDP_STACK *NewRUDPServer(char *svc_name, RUDP_STACK_INTERRUPTS_PROC *proc_interrupts, RUDP_STACK_RPC_RECV_PROC *proc_rpc_recv, void *param, UINT port, bool no_natt_register, bool over_dns_mode, volatile UINT *natt_global_udp_port, UCHAR rand_port_id, IP *listen_ip) -{ - RUDP_STACK *r; - // Validate arguments - if (IsEmptyStr(svc_name)) - { - return NULL; - } - - if (g_no_rudp_server) - { - return NULL; - } - - ListenTcpForPopupFirewallDialog(); - - r = NewRUDP(true, svc_name, proc_interrupts, proc_rpc_recv, param, port, NULL, NULL, no_natt_register, over_dns_mode, NULL, natt_global_udp_port, rand_port_id, listen_ip); - - if (r == NULL) - { - return NULL; - } - - return r; -} - -// Creating a R-UDP -RUDP_STACK *NewRUDP(bool server_mode, char *svc_name, RUDP_STACK_INTERRUPTS_PROC *proc_interrupts, RUDP_STACK_RPC_RECV_PROC *proc_rpc_recv, void *param, UINT port, SOCK *sock, SOCK_EVENT *sock_event, bool server_no_natt_register, bool over_dns_mode, IP *client_target_ip, volatile UINT *natt_global_udp_port, UCHAR rand_port_id, IP *listen_ip) -{ - RUDP_STACK *r; - char tmp[MAX_SIZE]; - UCHAR pid_hash[SHA1_SIZE]; - UINT pid; - USHORT pid_us; - - // Validate arguments - if (IsEmptyStr(svc_name)) - { - return NULL; - } - - ListenTcpForPopupFirewallDialog(); - - if (sock == NULL) - { - if (server_mode == false && client_target_ip != NULL) - { - sock = NewUDP4ForSpecificIp(client_target_ip, port); - } - else - { - if (rand_port_id == 0) - { - sock = NewUDPEx2(port, false, listen_ip); - } - else - { - sock = NewUDPEx2RandMachineAndExePath(false, listen_ip, 0, rand_port_id); - } - } - - if (sock == NULL) - { - return NULL; - } - } - else - { - AddRef(sock->ref); - } - - if (port == 0) - { - port = sock->LocalPort; - } - - if (rand_port_id != 0) - { - rand_port_numbers[rand_port_id] = port; - } - - if (sock_event == NULL) - { - sock_event = NewSockEvent(); - } - else - { - AddRef(sock_event->ref); - } - - r = ZeroMalloc(sizeof(RUDP_STACK)); - - r->NatT_SessionKey = Rand64(); - - StrCpy(r->SvcName, sizeof(r->SvcName), svc_name); - r->RandPortId = rand_port_id; - r->NatTGlobalUdpPort = natt_global_udp_port; - r->ServerMode = server_mode; - r->Interrupt = NewInterruptManager(); - r->SessionList = NewList(RUDPCompareSessionList); - r->UdpSock = sock; - r->Port = port; - r->SockEvent = sock_event; - r->HaltEvent = NewEvent(); - r->Now = Tick64(); - r->Lock = NewLock(); - r->Param = param; - r->TargetConnectedEvent = NewEvent(); - r->SendPacketList = NewList(NULL); - r->NewSockConnectEvent = NewEvent(); - r->NewSockQueue = NewQueue(); - r->NatT_TranId = Rand64(); - - r->NatT_SourceIpList = NewListFast(NULL); - - StrCpy(tmp, sizeof(tmp), r->SvcName); - Trim(tmp); - StrLower(tmp); - - Sha1(r->SvcNameHash, tmp, StrLen(tmp)); - - r->Client_IcmpId = (USHORT)(Rand32() % 65534 + 1); - r->Client_IcmpSeqNo = (USHORT)(Rand32() % 65534 + 1); - - // Determination of the type of the protocol - r->Protocol = RUDP_PROTOCOL_UDP; - if (r->Port == MAKE_SPECIAL_PORT(IP_PROTO_ICMPV4)) - { - r->Protocol = RUDP_PROTOCOL_ICMP; - - // Generate the ICMP ID based on the process ID -#ifdef OS_WIN32 - pid = (UINT)MsGetProcessId(); -#else // OS_WIN32 - pid = (UINT)getpid(); -#endif // OS_WIN32 - - pid = Endian32(pid); - Sha1(pid_hash, &pid, sizeof(UINT)); - - pid_us = READ_USHORT(pid_hash); - if (pid_us == 0 || pid_us == 0xFFFF) - { - pid_us = 1; - } - - r->Client_IcmpId = pid_us; - } - else if (over_dns_mode) - { - r->Protocol = RUDP_PROTOCOL_DNS; - } - - if (r->ServerMode) - { - r->NoNatTRegister = server_no_natt_register; - - if (r->Protocol == RUDP_PROTOCOL_ICMP || r->Protocol == RUDP_PROTOCOL_DNS) - { - // Never register to the NAT-T server in case of using the DNS or the ICMP - r->NoNatTRegister = true; - } - } - - if (true - ) - { - RUDPGetRegisterHostNameByIP(r->CurrentRegisterHostname, sizeof(r->CurrentRegisterHostname), NULL); - } - - if (r->ServerMode) - { - r->ProcInterrupts = proc_interrupts; - r->ProcRpcRecv = proc_rpc_recv; - } - - if (r->ServerMode && r->NoNatTRegister == false - ) - { - r->IpQueryThread = NewThread(RUDPIpQueryThread, r); - } - - JoinSockToSockEvent(r->UdpSock, r->SockEvent); - - r->Thread = NewThread(RUDPMainThread, r); - WaitThreadInit(r->Thread); - - return r; -} - -// R-UDP session comparison function -int RUDPCompareSessionList(void *p1, void *p2) -{ - RUDP_SESSION *s1, *s2; - UINT r; - // Validate arguments - if (p1 == NULL || p2 == NULL) - { - return 0; - } - s1 = *((RUDP_SESSION **)p1); - s2 = *((RUDP_SESSION **)p2); - if (s1 == NULL || s2 == NULL) - { - return 0; - } - - r = CmpIpAddr(&s1->YourIp, &s2->YourIp); - if (r != 0) - { - return r; - } - - r = COMPARE_RET(s1->YourPort, s2->YourPort); - if (r != 0) - { - return r; - } - - r = CmpIpAddr(&s1->MyIp, &s2->MyIp); - if (r != 0) - { - return r; - } - - r = COMPARE_RET(s1->MyPort, s2->MyPort); - if (r != 0) - { - return r; - } - - return 0; -} - -// Release of the R-UDP -void FreeRUDP(RUDP_STACK *r) -{ - UINT i; - // Validate arguments - if (r == NULL) - { - return; - } - - r->Halt = true; - Set(r->HaltEvent); - SetSockEvent(r->SockEvent); - - if (r->ServerMode && r->NoNatTRegister == false) - { - if (r->IpQueryThread != NULL) - { - WaitThread(r->IpQueryThread, INFINITE); - ReleaseThread(r->IpQueryThread); - } - } - - WaitThread(r->Thread, INFINITE); - ReleaseThread(r->Thread); - - for (i = 0; i < LIST_NUM(r->SessionList); i++) - { - RUDP_SESSION *se = LIST_DATA(r->SessionList, i); - - RUDPFreeSession(se); - } - - ReleaseList(r->SessionList); - - for (i = 0; i < LIST_NUM(r->SendPacketList); i++) - { - UDPPACKET *p = LIST_DATA(r->SendPacketList, i); - - FreeUdpPacket(p); - } - - while (true) - { - SOCK *s = GetNext(r->NewSockQueue); - if (s == NULL) - { - break; - } - - Disconnect(s); - ReleaseSock(s); - } - - for (i = 0; i < LIST_NUM(r->NatT_SourceIpList); i++) - { - RUDP_SOURCE_IP *sip = (RUDP_SOURCE_IP *)LIST_DATA(r->NatT_SourceIpList, i); - - Free(sip); - } - - ReleaseList(r->NatT_SourceIpList); - - ReleaseQueue(r->NewSockQueue); - - ReleaseList(r->SendPacketList); - - FreeInterruptManager(r->Interrupt); - - Disconnect(r->UdpSock); - ReleaseSock(r->UdpSock); - ReleaseSockEvent(r->SockEvent); - ReleaseEvent(r->HaltEvent); - ReleaseEvent(r->TargetConnectedEvent); - - ReleaseEvent(r->NewSockConnectEvent); - - Disconnect(r->TargetConnectedSock); - ReleaseSock(r->TargetConnectedSock); - - DeleteLock(r->Lock); - - if (r->RandPortId != 0) - { - rand_port_numbers[r->RandPortId] = 0; - } - - Free(r); -} - -// Generate a hash from the current computer name and the process name -void GetCurrentMachineIpProcessHash(void *hash) -{ - // Validate arguments - if (hash == NULL) - { - return; - } - - Lock(machine_ip_process_hash_lock); - { - if (IsZero(machine_ip_process_hash, SHA1_SIZE)) - { - GetCurrentMachineIpProcessHashInternal(machine_ip_process_hash); - } - - Copy(hash, machine_ip_process_hash, SHA1_SIZE); - } - Unlock(machine_ip_process_hash_lock); -} -void GetCurrentMachineIpProcessHashInternal(void *hash) -{ - BUF *b; - LIST *ip_list; - char machine_name[MAX_SIZE]; - wchar_t exe_path[MAX_PATH]; - char *product_id = NULL; - // Validate arguments - if (hash == NULL) - { - return; - } - -#ifdef OS_WIN32 - product_id = MsRegReadStr(REG_LOCAL_MACHINE, "SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion", "ProductId"); - if (product_id == NULL) - { - product_id = MsRegReadStr(REG_LOCAL_MACHINE, "SOFTWARE\\Microsoft\\Windows\\CurrentVersion", "ProductId"); - } -#endif // OS_WIN32 - - b = NewBuf(); - - GetMachineHostName(machine_name, sizeof(machine_name)); - Trim(machine_name); - StrUpper(machine_name); - - GetExeNameW(exe_path, sizeof(exe_path)); - UniTrim(exe_path); - UniStrUpper(exe_path); - - WriteBuf(b, machine_name, StrSize(machine_name)); - WriteBuf(b, exe_path, UniStrSize(exe_path)); - WriteBuf(b, product_id, StrSize(product_id)); - - ip_list = GetHostIPAddressList(); - if (ip_list != NULL) - { - UINT i; - for (i = 0; i < LIST_NUM(ip_list); i++) - { - IP *ip = LIST_DATA(ip_list, i); - - WriteBuf(b, ip, sizeof(IP)); - } - } - FreeHostIPAddressList(ip_list); - - Sha1(hash, b->Buf, b->Size); - - FreeBuf(b); - - Free(product_id); -} - -// Create a pair of pre-bound TCP sockets -bool NewTcpPair(SOCK **s1, SOCK **s2) -{ - SOCK *a; - SOCK *s, *c; - TUBE *t1, *t2; - SOCK_EVENT *e1, *e2; - // Validate arguments - if (s1 == NULL || s2 == NULL) - { - return false; - } - - a = ListenAnyPortEx2(true, true); - if (a == NULL) - { - return false; - } - - c = Connect("127.0.0.1", a->LocalPort); - if (c == NULL) - { - ReleaseSock(a); - return false; - } - - s = Accept(a); - if (s == NULL) - { - ReleaseSock(c); - ReleaseSock(a); - return false; - } - - ReleaseSock(a); - - if ((s->LocalPort != c->RemotePort) || (s->RemotePort != c->LocalPort)) - { - ReleaseSock(s); - ReleaseSock(c); - return false; - } - - NewTubePair(&t1, &t2, sizeof(TCP_PAIR_HEADER)); - - // Creating a socket event - e1 = NewSockEvent(); - e2 = NewSockEvent(); - - SetTubeSockEvent(t1, e1); - SetTubeSockEvent(t2, e2); - - AddRef(t1->Ref); - AddRef(t2->Ref); - s->BulkRecvTube = c->BulkSendTube = t1; - s->BulkSendTube = c->BulkRecvTube = t2; - - ReleaseSockEvent(e1); - ReleaseSockEvent(e2); - - *s1 = s; - *s2 = c; - - return true; -} - -// Listen in any available port -SOCK *ListenAnyPortEx2(bool local_only, bool disable_ca) -{ - UINT i; - SOCK *s; - for (i = 40000; i < 65536; i++) - { - s = ListenEx(i, local_only); - if (s != NULL) - { - return s; - } - } - - return NULL; -} - - -#if OPENSSL_VERSION_NUMBER < 0x10100000L -#define X509_STORE_CTX_get0_cert(o) ((o)->cert) -#endif - -// Verify client SSL certificate during TLS handshake. -// -// (actually, only save the certificate for later authentication in Protocol.c) -int SslCertVerifyCallback(int preverify_ok, X509_STORE_CTX *ctx) -{ - SSL *ssl; - struct SslClientCertInfo *clientcert; - X509 *cert; - - ssl = X509_STORE_CTX_get_ex_data(ctx, SSL_get_ex_data_X509_STORE_CTX_idx()); - clientcert = SSL_get_ex_data(ssl, GetSslClientCertIndex()); - - if (clientcert != NULL) - { - clientcert->PreverifyErr = X509_STORE_CTX_get_error(ctx); - clientcert->PreverifyErrMessage[0] = '\0'; - if (!preverify_ok) - { - const char *msg = X509_verify_cert_error_string(clientcert->PreverifyErr); - StrCpy(clientcert->PreverifyErrMessage, PREVERIFY_ERR_MESSAGE_SIZE, (char *)msg); - Debug("SslCertVerifyCallback preverify error: '%s'\n", msg); - } - else - { - cert = X509_STORE_CTX_get0_cert(ctx); - if (cert != NULL) - { - X *tmpX = X509ToX(cert); // this only wraps cert, but we need to make a copy - if (!CompareX(tmpX, clientcert->X)) - { - X *copyX = CloneX(tmpX); - if (clientcert->X != NULL) - { - FreeX(clientcert->X); - } - clientcert->X = copyX; - } - tmpX->do_not_free = true; // do not release inner X509 object - FreeX(tmpX); - } - } - } - - return 1; /* allow the verification process to continue */ -} - -// Create a new SSL pipe -SSL_PIPE *NewSslPipe(bool server_mode, X *x, K *k, DH_CTX *dh) -{ - return NewSslPipeEx(server_mode, x, k, dh, false, NULL); -} - -// Create a new SSL pipe with extended options -SSL_PIPE *NewSslPipeEx(bool server_mode, X *x, K *k, DH_CTX *dh, bool verify_peer, struct SslClientCertInfo *clientcert) -{ - SSL_PIPE *s; - SSL *ssl; - SSL_CTX *ssl_ctx = NewSSLCtx(server_mode); - - Lock(openssl_lock); - { - if (server_mode) - { -#ifdef SSL_OP_NO_TLSv1_3 - SSL_CTX_set_options(ssl_ctx, SSL_OP_NO_TLSv1_3); // For some reason pppd under linux doesn't like it -#endif - - AddChainSslCertOnDirectory(ssl_ctx); - - if (dh != NULL) - { - SSL_CTX_set_tmp_dh(ssl_ctx, dh->dh); - } - -#if 0 - // Cannot get config -#ifdef SSL_SECOP_VERSION - if (sock->SslAcceptSettings.Override_Security_Level) - { - SSL_CTX_set_security_level(ssl_ctx, sock->SslAcceptSettings.Override_Security_Level_Value); - } -#endif -#endif - } - - if (verify_peer) - { - SSL_CTX_set_verify(ssl_ctx, SSL_VERIFY_PEER, SslCertVerifyCallback); - } - - if (dh != NULL) - { - SSL_CTX_set_options(ssl_ctx, SSL_OP_SINGLE_DH_USE); - } - - if (server_mode == false) - { - SSL_CTX_set_options(ssl_ctx, SSL_OP_DONT_INSERT_EMPTY_FRAGMENTS); - } - - ssl = SSL_new(ssl_ctx); - - SSL_set_ex_data(ssl, GetSslClientCertIndex(), clientcert); - } - Unlock(openssl_lock); - - s = ZeroMalloc(sizeof(SSL_PIPE)); - - s->ssl = ssl; - s->ssl_ctx = ssl_ctx; - s->ServerMode = server_mode; - - s->SslInOut = NewSslBioSsl(); - s->RawIn = NewSslBioMem(); - s->RawOut = NewSslBioMem(); - - if (x != NULL && k != NULL) - { - Lock(openssl_lock); - { - SSL_use_certificate(s->ssl, x->x509); - SSL_use_PrivateKey(s->ssl, k->pkey); - } - Unlock(openssl_lock); - } - - if (s->ServerMode == false) - { - SSL_set_connect_state(s->ssl); - } - else - { - SSL_set_accept_state(s->ssl); - } - - SSL_set_bio(s->ssl, s->RawIn->bio, s->RawOut->bio); - BIO_set_ssl(s->SslInOut->bio, s->ssl, BIO_NOCLOSE); - - //s->RawIn->NoFree = true; - s->RawOut->NoFree = true; - - return s; -} - -// Synchronization of the SSL pipe -bool SyncSslPipe(SSL_PIPE *s) -{ - UINT i; - // Validate arguments - if (s == NULL || s->IsDisconnected) - { - return false; - } - - for (i = 0; i < 2; i++) - { - if (SslBioSync(s->RawIn, true, false) == false) - { - s->IsDisconnected = true; - Debug("SyncSslPipe: s->RawIn error.\n"); - return false; - } - - if (SslBioSync(s->RawOut, false, true) == false) - { - s->IsDisconnected = true; - Debug("SyncSslPipe: s->RawOut error.\n"); - return false; - } - - if (SslBioSync(s->SslInOut, true, true) == false) - { - s->IsDisconnected = true; - Debug("SyncSslPipe: s->SslInOut error.\n"); - return false; - } - } - - return true; -} - -// Release of the SSL pipe -void FreeSslPipe(SSL_PIPE *s) -{ - // Validate arguments - if (s == NULL) - { - return; - } - - FreeSslBio(s->SslInOut); - FreeSslBio(s->RawIn); - FreeSslBio(s->RawOut); - - SSL_free(s->ssl); - SSL_CTX_free(s->ssl_ctx); - - Free(s); -} - -// Release of the SSL BIO -void FreeSslBio(SSL_BIO *b) -{ - // Validate arguments - if (b == NULL) - { - return; - } - - if (b->NoFree == false) - { - BIO_free(b->bio); - } - - ReleaseFifo(b->RecvFifo); - ReleaseFifo(b->SendFifo); - - Free(b); -} - -// Create a new SSL BIO (SSL) -SSL_BIO *NewSslBioSsl() -{ - SSL_BIO *b = ZeroMalloc(sizeof(SSL_BIO)); - - b->bio = BIO_new(BIO_f_ssl()); - - b->RecvFifo = NewFifo(); - b->SendFifo = NewFifo(); - - return b; -} - -// Create a new SSL BIO (memory) -SSL_BIO *NewSslBioMem() -{ - SSL_BIO *b = ZeroMalloc(sizeof(SSL_BIO)); - - b->bio = BIO_new(BIO_s_mem()); - - b->RecvFifo = NewFifo(); - b->SendFifo = NewFifo(); - - return b; -} - -// Synchronize memory contents of the SSL BIO with the FIFO -bool SslBioSync(SSL_BIO *b, bool sync_send, bool sync_recv) -{ - // Validate arguments - if (b == NULL) - { - return false; - } - - if (b->IsDisconnected) - { - return false; - } - - // Write the contents of the SendFifo to the BIO - if (sync_send) - { - while (b->SendFifo->size >= 1) - { - int r = BIO_write(b->bio, GetFifoPointer(b->SendFifo), FifoSize(b->SendFifo)); - - if (r == 0) - { - b->IsDisconnected = true; - WHERE; - return false; - } - else - { - if (r < 0) - { - if (BIO_should_retry(b->bio)) - { - break; - } - else - { - b->IsDisconnected = true; - WHERE; - return false; - } - } - else - { - ReadFifo(b->SendFifo, NULL, (UINT)r); - } - } - } - } - - // Save to the RecvFifo by reading from the BIO - if (sync_recv) - { - while (true) - { - UCHAR tmp[4096]; - int r; - - r = BIO_read(b->bio, tmp, sizeof(tmp)); - - if (r == 0) - { - b->IsDisconnected = true; - WHERE; - return false; - } - else - { - if (r < 0) - { - if (BIO_should_retry(b->bio)) - { - break; - } - else - { - b->IsDisconnected = true; - WHERE; - Debug("OpenSSL Error: %s\n", ERR_error_string(ERR_peek_last_error(), NULL)); - return false; - } - } - else - { - WriteFifo(b->RecvFifo, tmp, (UINT)r); - } - } - } - } - - return true; -} - -// Release the memory for the return value of the ICMP API -void IcmpApiFreeResult(ICMP_RESULT *ret) -{ - // Validate arguments - if (ret == NULL) - { - return; - } - - if (ret->Data != NULL) - { - Free(ret->Data); - } - - Free(ret); -} - -// Send an ICMP Echo using ICMP API -ICMP_RESULT *IcmpApiEchoSend(IP *dest_ip, UCHAR ttl, UCHAR *data, UINT size, UINT timeout) -{ -#ifdef OS_WIN32 - // Validate arguments - if (dest_ip == NULL || IsIP4(dest_ip) == false || (size != 0 && data == NULL)) - { - return NULL; - } - if (ttl == 0) - { - ttl = 127; - } - - if (IsIcmpApiSupported()) - { - HANDLE h; - DWORD dw; - IPAddr dest_addr; - UINT reply_size; - ICMP_ECHO_REPLY *reply; - ICMP_RESULT *ret = NULL; - IP_OPTION_INFORMATION opt; - - h = w32net->IcmpCreateFile(); - - if (h == INVALID_HANDLE_VALUE) - { - return NULL; - } - - Zero(&opt, sizeof(opt)); - opt.Ttl = ttl; - - IPToInAddr((struct in_addr *)&dest_addr, dest_ip); - - reply_size = sizeof(*reply) + size + 64; - reply = ZeroMalloc(reply_size); - - dw = w32net->IcmpSendEcho(h, dest_addr, data, size, &opt, reply, reply_size, timeout); - - ret = ZeroMalloc(sizeof(ICMP_RESULT)); - - if (dw >= 1 && reply->Status == IP_SUCCESS) - { - ret->Ok = true; - } - else - { - switch (reply->Status) - { - case IP_DEST_NET_UNREACHABLE: - ret->Type = ICMP_TYPE_DESTINATION_UNREACHABLE; - ret->Code = ICMP_CODE_NET_UNREACHABLE; - break; - - case IP_DEST_HOST_UNREACHABLE: - ret->Type = ICMP_TYPE_DESTINATION_UNREACHABLE; - ret->Code = ICMP_CODE_HOST_UNREACHABLE; - break; - - case IP_DEST_PROT_UNREACHABLE: - ret->Type = ICMP_TYPE_DESTINATION_UNREACHABLE; - ret->Code = ICMP_CODE_PROTOCOL_UNREACHABLE; - break; - - case IP_DEST_PORT_UNREACHABLE: - ret->Type = ICMP_TYPE_DESTINATION_UNREACHABLE; - ret->Code = ICMP_CODE_PORT_UNREACHABLE; - break; - - case IP_TTL_EXPIRED_TRANSIT: - ret->Type = ICMP_TYPE_TIME_EXCEEDED; - ret->Code = ICMP_CODE_TTL_EXCEEDED_IN_TRANSIT; - break; - - case IP_TTL_EXPIRED_REASSEM: - ret->Type = ICMP_TYPE_TIME_EXCEEDED; - ret->Code = ICMP_CODE_FRAGMENT_REASSEMBLY_TIME_EXCEEDED; - break; - - default: - ret->Timeout = true; - break; - } - } - - if (ret->Timeout == false) - { - ret->Ttl = reply->Options.Ttl; - ret->Rtt = reply->RoundTripTime; - InAddrToIP(&ret->IpAddress, (struct in_addr *)&reply->Address); - - if (reply->DataSize >= 1 && reply->Data != NULL) - { - ret->DataSize = reply->DataSize; - ret->Data = Clone(reply->Data, reply->DataSize); - } - } - - Free(reply); - - w32net->IcmpCloseHandle(h); - - return ret; - } - else - { - return NULL; - } - -#else // OS_WIN32 - return NULL; -#endif // OS_WIN32 -} - -// Detect whether the ICMP API is supported -bool IsIcmpApiSupported() -{ -#ifdef OS_WIN32 - if (w32net->IcmpCloseHandle != NULL && - w32net->IcmpCreateFile != NULL && - w32net->IcmpSendEcho != NULL) - { - return true; - } -#endif // OS_WIN32 - - return false; -} - -// Initialize the routing table change detector -ROUTE_CHANGE *NewRouteChange() -{ -#ifdef OS_WIN32 - return Win32NewRouteChange(); -#else // OS_WIN32 - return NULL; -#endif // OS_WIN32 -} - -// Release the routing table change detector -void FreeRouteChange(ROUTE_CHANGE *r) -{ -#ifdef OS_WIN32 - Win32FreeRouteChange(r); -#endif // OS_WIN32 -} - -// Get whether the routing table has been changed -bool IsRouteChanged(ROUTE_CHANGE *r) -{ -#ifdef OS_WIN32 - return Win32IsRouteChanged(r); -#else // OS_WIN32 - return false; -#endif // OS_WIN32 -} - -// Routing table change detector function (Win32) -#ifdef OS_WIN32 -ROUTE_CHANGE *Win32NewRouteChange() -{ - ROUTE_CHANGE *r; - bool ret; - - if (MsIsNt() == false) - { - return NULL; - } - - if (w32net->CancelIPChangeNotify == NULL || - w32net->NotifyRouteChange == NULL) - { - return NULL; - } - - r = ZeroMalloc(sizeof(ROUTE_CHANGE)); - - r->Data = ZeroMalloc(sizeof(ROUTE_CHANGE_DATA)); - - r->Data->Overlapped.hEvent = CreateEventA(NULL, false, true, NULL); - - ret = w32net->NotifyRouteChange(&r->Data->Handle, &r->Data->Overlapped); - if (!(ret == NO_ERROR || ret == WSA_IO_PENDING || WSAGetLastError() == WSA_IO_PENDING)) - { - Free(r->Data); - Free(r); - - return NULL; - } - - return r; -} - -void Win32FreeRouteChange(ROUTE_CHANGE *r) -{ - // Validate arguments - if (r == NULL) - { - return; - } - - w32net->CancelIPChangeNotify(&r->Data->Overlapped); - CloseHandle(r->Data->Overlapped.hEvent); - - Free(r->Data); - Free(r); -} - -bool Win32IsRouteChanged(ROUTE_CHANGE *r) -{ - // Validate arguments - if (r == NULL) - { - return false; - } - - if ((r->Data->NumCalled++) == 0) - { - return true; - } - - if (WaitForSingleObject(r->Data->Overlapped.hEvent, 0) == WAIT_OBJECT_0) - { - w32net->NotifyRouteChange(&r->Data->Handle, &r->Data->Overlapped); - return true; - } - - return false; -} - -typedef struct WIN32_ACCEPT_CHECK_DATA -{ - bool IsIPv6; - bool Rejected; -} WIN32_ACCEPT_CHECK_DATA; - -int CALLBACK Win32AcceptCheckCallback(LPWSABUF lpCallerId, LPWSABUF lpCallerData, LPQOS pQos, - LPQOS lpGQOS, LPWSABUF lpCalleeId, LPWSABUF lpCalleeData, - GROUP FAR *g, DWORD_PTR dwCallbackData) -{ - return CF_ACCEPT; -} - -// Accept function for Win32 -SOCKET Win32Accept(SOCK *sock, SOCKET s, struct sockaddr *addr, int *addrlen, bool ipv6) -{ - SOCKET ret; - WIN32_ACCEPT_CHECK_DATA d; - UINT err; - int initial_addrlen = *addrlen; - UINT num_error = 0; - UINT zero = 0; - UINT tmp = 0; - UINT ret_size = 0; - // Validate arguments - if (sock == NULL || s == INVALID_SOCKET) - { - return INVALID_SOCKET; - } - - if (sock->hAcceptEvent == NULL) - { - sock->hAcceptEvent = CreateEvent(NULL, FALSE, FALSE, NULL); - - WSAEventSelect(s, sock->hAcceptEvent, FD_ACCEPT | FD_CLOSE); - } - -L_LOOP: - - if (sock->CancelAccept) - { - return INVALID_SOCKET; - } - - Zero(&d, sizeof(d)); - - d.IsIPv6 = ipv6; - - *addrlen = initial_addrlen; - Zero(addr, initial_addrlen); - ret = WSAAccept(s, addr, addrlen, Win32AcceptCheckCallback, (DWORD_PTR)&d); - - if (ret == INVALID_SOCKET) - { - err = WSAGetLastError(); - - if (err == WSAEWOULDBLOCK) - { - //Debug("!!! WSAAccept: WSAEWOULDBLOCK\n"); - UINT wait_ret = WaitForSingleObject(sock->hAcceptEvent, 1234); - - if (wait_ret == WAIT_OBJECT_0 || wait_ret == WAIT_TIMEOUT) - { - goto L_LOOP; - } - - Debug("!!! WaitForSingleObject Error. ret=%u GetLastError=%u\n", wait_ret, GetLastError()); - } - - num_error++; - - Debug("!!! WSAAccept Error: %u rej=%u num=%u tick=%I64u\n", err, d.Rejected, num_error, Tick64()); - - if (d.Rejected && err == WSAECONNREFUSED) - { - goto L_LOOP; - } - - if (err == WSAETIMEDOUT) - { - goto L_LOOP; - } - } - else - { - // Remove a new socket from the event - WSAEventSelect(ret, sock->hAcceptEvent, 0); - - // Restore the new socket to synchronized - WSAIoctl(ret, FIONBIO, &zero, sizeof(zero), &tmp, sizeof(tmp), &ret_size, NULL, NULL); - } - - return ret; -} - -#endif // OS_WIN32 - -#define USE_OLD_GETIP - -// Set the arp_filter in Linux -void SetLinuxArpFilter() -{ - char *filename = "/proc/sys/net/ipv4/conf/all/arp_filter"; - char *data = "1\n"; - IO *o; - - o = FileCreate(filename); - if (o == NULL) - { - return; - } - - FileWrite(o, data, StrLen(data)); - FileFlush(o); - - FileClose(o); -} - -// Determine whether the string is a IPv6 mask -bool IsIpMask6(char *str) -{ - IP mask; - // Validate arguments - if (str == NULL) - { - return false; - } - - return StrToMask6(&mask, str); -} - -// Determine whether the string is a IPv6 address -bool IsStrIPv6Address(char *str) -{ - IP ip; - // Validate arguments - if (str == NULL) - { - return false; - } - - if (StrToIP6(&ip, str) == false) - { - return false; - } - - return true; -} - -// Convert the subnet mask to an integer -UINT SubnetMaskToInt6(IP *a) -{ - UINT i; - // Validate arguments - if (IsIP6(a) == false) - { - return 0; - } - - for (i = 0; i <= 128; i++) - { - IP tmp; - - IntToSubnetMask6(&tmp, i); - - if (CmpIpAddr(a, &tmp) == 0) - { - return i; - } - } - - return 0; -} -UINT SubnetMaskToInt4(IP *a) -{ - UINT i; - // Validate arguments - if (IsIP4(a) == false) - { - return 0; - } - - for (i = 0; i <= 32; i++) - { - IP tmp; - - IntToSubnetMask4(&tmp, i); - - if (CmpIpAddr(a, &tmp) == 0) - { - return i; - } - } - - return 0; -} -UINT SubnetMaskToInt(IP *a) -{ - if (IsIP6(a)) - { - return SubnetMaskToInt6(a); - } - else - { - return SubnetMaskToInt4(a); - } -} - -// Determine whether the specified IP address is a subnet mask -bool IsSubnetMask6(IP *a) -{ - UINT i; - // Validate arguments - if (IsIP6(a) == false) - { - return false; - } - - for (i = 0; i <= 128; i++) - { - IP tmp; - - IntToSubnetMask6(&tmp, i); - - if (CmpIpAddr(a, &tmp) == 0) - { - return true; - } - } - - return false; -} - -// Generate a local address from the MAC address -void GenerateEui64LocalAddress(IP *a, UCHAR *mac) -{ - UCHAR tmp[8]; - // Validate arguments - if (a == NULL || mac == NULL) - { - return; - } - - GenerateEui64Address6(tmp, mac); - - ZeroIP6(a); - a->ipv6_addr[0] = 0xfe; - a->ipv6_addr[1] = 0x80; - - Copy(&a->ipv6_addr[8], tmp, 8); -} - -// Generate the EUI-64 address from the MAC address -void GenerateEui64Address6(UCHAR *dst, UCHAR *mac) -{ - // Validate arguments - if (dst == NULL || mac == NULL) - { - return; - } - - Copy(dst, mac, 3); - Copy(dst + 5, mac, 3); - - dst[3] = 0xff; - dst[4] = 0xfe; - dst[0] = ((~(dst[0] & 0x02)) & 0x02) | (dst[0] & 0xfd); -} - -// Examine whether two IP addresses are in the same network -bool IsInSameNetwork6ByStr(char *ip1, char *ip2, char *subnet) -{ - IP p1, p2, s; - - if (StrToIP6(&p1, ip1) == false) - { - return false; - } - - if (StrToIP6(&p2, ip2) == false) - { - return false; - } - - if (StrToMask6(&s, subnet) == false) - { - return false; - } - - return IsInSameNetwork6(&p1, &p2, &s); -} -bool IsInSameNetwork6(IP *a1, IP *a2, IP *subnet) -{ - IP prefix1, prefix2; - // Validate arguments - if (IsIP6(a1) == false || IsIP6(a2) == false || IsIP6(subnet) == false) - { - return false; - } - - if (a1->ipv6_scope_id != a2->ipv6_scope_id) - { - return false; - } - - GetPrefixAddress6(&prefix1, a1, subnet); - GetPrefixAddress6(&prefix2, a2, subnet); - - if (CmpIpAddr(&prefix1, &prefix2) == 0) - { - return true; - } - - return false; -} -bool IsInSameNetwork4(IP *a1, IP *a2, IP *subnet) -{ - IP net1, net2; - // Validate arguments - if (IsIP4(a1) == false || IsIP4(a2) == false || IsIP4(subnet) == false) - { - return false; - } - - IPAnd4(&net1, a1, subnet); - IPAnd4(&net2, a2, subnet); - - if (CmpIpAddr(&net1, &net2) == 0) - { - return true; - } - - return false; -} -bool IsInSameNetwork4Standard(IP *a1, IP *a2) -{ - IP subnet; - - SetIP(&subnet, 255, 255, 0, 0); - - return IsInSameNetwork4(a1, a2, &subnet); -} - -// Get the prefix address -void GetPrefixAddress6(IP *dst, IP *ip, IP *subnet) -{ - // Validate arguments - if (dst == NULL || ip == NULL || subnet == NULL) - { - return; - } - - IPAnd6(dst, ip, subnet); - - dst->ipv6_scope_id = ip->ipv6_scope_id; -} - -// Get the type of the IPv6 address -UINT GetIPv6AddrType(IPV6_ADDR *addr) -{ - IP ip; - // Validate arguments - if (addr == NULL) - { - return 0; - } - - IPv6AddrToIP(&ip, addr); - - return GetIPAddrType6(&ip); -} -UINT GetIPAddrType6(IP *ip) -{ - UINT ret = 0; - // Validate arguments - if (IsIP6(ip) == false) - { - return 0; - } - - if (ip->ipv6_addr[0] == 0xff) - { - IP all_node, all_router; - - GetAllNodeMulticaseAddress6(&all_node); - - GetAllRouterMulticastAddress6(&all_router); - - ret |= IPV6_ADDR_MULTICAST; - - if (Cmp(ip->ipv6_addr, all_node.ipv6_addr, 16) == 0) - { - ret |= IPV6_ADDR_ALL_NODE_MULTICAST; - } - else if (Cmp(ip->ipv6_addr, all_router.ipv6_addr, 16) == 0) - { - ret |= IPV6_ADDR_ALL_ROUTER_MULTICAST; - } - else - { - if (ip->ipv6_addr[1] == 0x02 && ip->ipv6_addr[2] == 0 && ip->ipv6_addr[3] == 0 && - ip->ipv6_addr[4] == 0 && ip->ipv6_addr[5] == 0 && ip->ipv6_addr[6] == 0 && - ip->ipv6_addr[7] == 0 && ip->ipv6_addr[8] == 0 && ip->ipv6_addr[9] == 0 && - ip->ipv6_addr[10] == 0 && ip->ipv6_addr[11] == 0x01 && ip->ipv6_addr[12] == 0xff) - { - ret |= IPV6_ADDR_SOLICIATION_MULTICAST; - } - } - } - else - { - ret |= IPV6_ADDR_UNICAST; - - if (ip->ipv6_addr[0] == 0xfe && (ip->ipv6_addr[1] & 0xc0) == 0x80) - { - ret |= IPV6_ADDR_LOCAL_UNICAST; - } - else - { - ret |= IPV6_ADDR_GLOBAL_UNICAST; - - if (IsZero(&ip->ipv6_addr, 16)) - { - ret |= IPV6_ADDR_ZERO; - } - else - { - IP loopback; - - GetLoopbackAddress6(&loopback); - - if (Cmp(ip->ipv6_addr, loopback.ipv6_addr, 16) == 0) - { - ret |= IPV6_ADDR_LOOPBACK; - } - } - } - } - - return ret; -} - -// Loopback address -void GetLoopbackAddress6(IP *ip) -{ - // Validate arguments - if (ip == NULL) - { - return; - } - - ZeroIP6(ip); - - ip->ipv6_addr[15] = 0x01; -} - -// All-nodes multicast address -void GetAllNodeMulticaseAddress6(IP *ip) -{ - // Validate arguments - if (ip == NULL) - { - return; - } - - ZeroIP6(ip); - - ip->ipv6_addr[0] = 0xff; - ip->ipv6_addr[1] = 0x02; - ip->ipv6_addr[15] = 0x01; -} - -// All-routers multicast address -void GetAllRouterMulticastAddress6(IP *ip) -{ - // Validate arguments - if (ip == NULL) - { - return; - } - - ZeroIP6(ip); - - ip->ipv6_addr[0] = 0xff; - ip->ipv6_addr[1] = 0x02; - ip->ipv6_addr[15] = 0x02; -} - -// Logical operation of the IPv4 address -void IPAnd4(IP *dst, IP *a, IP *b) -{ - UINT i; - // Validate arguments - if (dst == NULL || a == NULL || b == NULL || IsIP4(a) == false || IsIP4(b) == false) - { - Zero(dst, sizeof(IP)); - return; - } - - i = IPToUINT(a) & IPToUINT(b); - - UINTToIP(dst, i); -} - -// Logical operation of the IPv6 address -void IPAnd6(IP *dst, IP *a, IP *b) -{ - UINT i; - // Validate arguments - if (dst == NULL || IsIP6(a) == false || IsIP6(b) == false) - { - ZeroIP6(dst); - return; - } - - ZeroIP6(dst); - for (i = 0; i < 16; i++) - { - dst->ipv6_addr[i] = a->ipv6_addr[i] & b->ipv6_addr[i]; - } -} - -// Creating a subnet mask -void IntToSubnetMask6(IP *ip, UINT i) -{ - UINT j = i / 8; - UINT k = i % 8; - UINT z; - IP a; - - ZeroIP6(&a); - - for (z = 0; z < 16; z++) - { - if (z < j) - { - a.ipv6_addr[z] = 0xff; - } - else if (z == j) - { - a.ipv6_addr[z] = ~(0xff >> k); - } - } - - Copy(ip, &a, sizeof(IP)); -} - -// Convert the IP address to a string -void IP6AddrToStr(char *str, UINT size, IPV6_ADDR *addr) -{ - // Validate arguments - if (str == NULL || addr == NULL) - { - return; - } - - IPToStr6Array(str, size, addr->Value); -} -void IPToStr6Array(char *str, UINT size, UCHAR *bytes) -{ - IP ip; - // Validate arguments - if (str == NULL || bytes == NULL) - { - return; - } - - SetIP6(&ip, bytes); - - IPToStr6(str, size, &ip); -} -void IPToStr6(char *str, UINT size, IP *ip) -{ - char tmp[MAX_SIZE]; - - IPToStr6Inner(tmp, ip); - - StrCpy(str, size, tmp); -} -void IPToStr6Inner(char *str, IP *ip) -{ - UINT i; - USHORT values[8]; - UINT zero_started_index; - UINT max_zero_len; - UINT max_zero_start; - IP a; - // Validate arguments - if (str == NULL || ip == NULL) - { - return; - } - - Copy(&a, ip, sizeof(IP)); - - for (i = 0; i < 8; i++) - { - Copy(&values[i], &a.ipv6_addr[i * 2], sizeof(USHORT)); - values[i] = Endian16(values[i]); - } - - // Search for omittable part - zero_started_index = INFINITE; - max_zero_len = 0; - max_zero_start = INFINITE; - for (i = 0; i < 9; i++) - { - USHORT v = (i != 8 ? values[i] : 1); - - if (v == 0) - { - if (zero_started_index == INFINITE) - { - zero_started_index = i; - } - } - else - { - UINT zero_len; - - if (zero_started_index != INFINITE) - { - zero_len = i - zero_started_index; - if (zero_len >= 2) - { - if (max_zero_len < zero_len) - { - max_zero_start = zero_started_index; - max_zero_len = zero_len; - } - } - - zero_started_index = INFINITE; - } - } - } - - // Format a string - StrCpy(str, 0, ""); - for (i = 0; i < 8; i++) - { - char tmp[16]; - - ToHex(tmp, values[i]); - StrLower(tmp); - - if (i == max_zero_start) - { - if (i == 0) - { - StrCat(str, 0, "::"); - } - else - { - StrCat(str, 0, ":"); - } - i += max_zero_len - 1; - } - else - { - StrCat(str, 0, tmp); - if (i != 7) - { - StrCat(str, 0, ":"); - } - } - } - - // Scope ID - if (ip->ipv6_scope_id != 0) - { - char tmp[64]; - - StrCat(str, 0, "%"); - ToStr(tmp, ip->ipv6_scope_id); - - StrCat(str, 0, tmp); - } -} - -// Convert the string to an IP address -bool StrToIP6(IP *ip, char *str) -{ - TOKEN_LIST *t; - char tmp[MAX_PATH]; - IP a; - UINT i; - UINT scope_id = 0; - // Validate arguments - if (str == NULL || ip == NULL) - { - return false; - } - - ZeroIP6(&a); - - StrCpy(tmp, sizeof(tmp), str); - Trim(tmp); - - if (StartWith(tmp, "[") && EndWith(tmp, "]")) - { - // If the string is enclosed in square brackets, remove brackets - StrCpyAllowOverlap(tmp, sizeof(tmp), &tmp[1]); - - if (StrLen(tmp) >= 1) - { - tmp[StrLen(tmp) - 1] = 0; - } - } - - // Remove the scope ID by analyzing if there is it - i = SearchStrEx(tmp, "%", 0, false); - if (i != INFINITE) - { - char ss[MAX_PATH]; - - StrCpy(ss, sizeof(ss), &tmp[i + 1]); - - tmp[i] = 0; - - Trim(tmp); - - Trim(ss); - - scope_id = ToInt(ss); - } - - // Tokenize - t = ParseTokenWithNullStr(tmp, ":"); - if (t->NumTokens >= 3 && t->NumTokens <= 8) - { - UINT i, n; - bool b = true; - UINT k = 0; - - n = 0; - - for (i = 0; i < t->NumTokens; i++) - { - char *str = t->Token[i]; - - if (i != 0 && i != (t->NumTokens - 1) && StrLen(str) == 0) - { - n++; - if (n == 1) - { - k += 2 * (8 - t->NumTokens + 1); - } - else - { - b = false; - break; - } - } - else - { - UCHAR chars[2]; - - if (CheckIPItemStr6(str) == false) - { - b = false; - break; - } - - IPItemStrToChars6(chars, str); - - a.ipv6_addr[k++] = chars[0]; - a.ipv6_addr[k++] = chars[1]; - } - } - - if (n != 0 && n != 1) - { - b = false; - } - else if (n == 0 && t->NumTokens != 8) - { - b = false; - } - - if (b == false) - { - FreeToken(t); - return false; - } - } - else - { - FreeToken(t); - return false; - } - - FreeToken(t); - - Copy(ip, &a, sizeof(IP)); - - ip->ipv6_scope_id = scope_id; - - return true; -} -bool StrToIP6Addr(IPV6_ADDR *ip, char *str) -{ - IP ip2; - // Validate arguments - if (ip == NULL || str == NULL) - { - Zero(ip, sizeof(IPV6_ADDR)); - return false; - } - - if (StrToIP6(&ip2, str) == false) - { - return false; - } - - if (IPToIPv6Addr(ip, &ip2) == false) - { - return false; - } - - return true; -} - -// Convert an IP address character to the UCHAR type -void IPItemStrToChars6(UCHAR *chars, char *str) -{ - char tmp[5]; - BUF *b; - UINT len; - // Validate arguments - if (chars == NULL) - { - return; - } - - Zero(tmp, sizeof(tmp)); - - len = StrLen(str); - switch (len) - { - case 0: - tmp[0] = tmp[1] = tmp[2] = tmp[3] = '0'; - break; - - case 1: - tmp[0] = tmp[1] = tmp[2] = '0'; - tmp[3] = str[0]; - break; - - case 2: - tmp[0] = tmp[1] = '0'; - tmp[2] = str[0]; - tmp[3] = str[1]; - break; - - case 3: - tmp[0] = '0'; - tmp[1] = str[0]; - tmp[2] = str[1]; - tmp[3] = str[2]; - break; - - case 4: - tmp[0] = str[0]; - tmp[1] = str[1]; - tmp[2] = str[2]; - tmp[3] = str[3]; - break; - } - - b = StrToBin(tmp); - - chars[0] = ((UCHAR *)b->Buf)[0]; - chars[1] = ((UCHAR *)b->Buf)[1]; - - FreeBuf(b); -} - -// Check whether invalid characters are included in the element string of the IP address -bool CheckIPItemStr6(char *str) -{ - UINT i, len; - // Validate arguments - if (str == NULL) - { - return false; - } - - len = StrLen(str); - if (len >= 5) - { - // Invalid length - return false; - } - - for (i = 0; i < len; i++) - { - char c = str[i]; - - if ((c >= 'a' && c <= 'f') || - (c >= 'A' && c <= 'F') || - (c >= '0' && c <= '9')) - { - } - else - { - return false; - } - } - - return true; -} - -// Create an IPv4 address of all zero -void ZeroIP4(IP *ip) -{ - // Validate arguments - if (ip == NULL) - { - return; - } - - Zero(ip, sizeof(IP)); -} - -// Create an IPv6 address of all zero -void ZeroIP6(IP *ip) -{ - // Validate arguments - if (ip == NULL) - { - return; - } - - SetIP6(ip, NULL); -} - -// Get the IP address of the localhost -void GetLocalHostIP6(IP *ip) -{ - // Validate arguments - if (ip == NULL) - { - return; - } - ZeroIP6(ip); - - ip->ipv6_addr[15] = 1; -} -void GetLocalHostIP4(IP *ip) -{ - // Validate arguments - if (ip == NULL) - { - return; - } - - SetIP(ip, 127, 0, 0, 1); -} - -// Check whether the specified address is a localhost -bool IsLocalHostIP6(IP *ip) -{ - IP local; - // Validate arguments - if (ip == NULL) - { - return false; - } - if (IsIP6(ip) == false) - { - return false; - } - - GetLocalHostIP6(&local); - - if (CmpIpAddr(&local, ip) == 0) - { - return true; - } - - return false; -} -bool IsLocalHostIP4(IP *ip) -{ - // Validate arguments - if (ip == NULL) - { - return false; - } - if (IsIP4(ip) == false) - { - return false; - } - - if (ip->addr[0] == 127) - { - return true; - } - - return false; -} -bool IsLocalHostIP(IP *ip) -{ - // Validate arguments - if (ip == NULL) - { - return false; - } - - if (IsIP4(ip)) - { - return IsLocalHostIP4(ip); - } - else - { - return IsLocalHostIP6(ip); - } -} - -// Convert the IPV6_ADDR to an IP -void IPv6AddrToIP(IP *ip, IPV6_ADDR *addr) -{ - // Validate arguments - if (ip == NULL || addr == NULL) - { - return; - } - - SetIP6(ip, addr->Value); -} - -// Convert the IP to an IPV6_ADDR -bool IPToIPv6Addr(IPV6_ADDR *addr, IP *ip) -{ - UINT i; - // Validate arguments - if (addr == NULL || ip == NULL) - { - Zero(addr, sizeof(IPV6_ADDR)); - return false; - } - - if (IsIP6(ip) == false) - { - Zero(addr, sizeof(IPV6_ADDR)); - return false; - } - - for (i = 0; i < 16; i++) - { - addr->Value[i] = ip->ipv6_addr[i]; - } - - return true; -} - -// Set an IPv6 address -void SetIP6(IP *ip, UCHAR *value) -{ - // Validate arguments - if (ip == NULL) - { - return; - } - - Zero(ip, sizeof(IP)); - - ip->addr[0] = 192; - ip->addr[1] = 0; - ip->addr[2] = 2; - ip->addr[3] = 254; - - if (value != NULL) - { - UINT i; - - for (i = 0; i < 16; i++) - { - ip->ipv6_addr[i] = value[i]; - } - } -} - -// Check whether the specified address is a IPv6 address -bool IsIP6(IP *ip) -{ - // Validate arguments - if (ip == NULL) - { - return false; - } - - if (ip->addr[0] == 192 && ip->addr[1] == 0 && ip->addr[2] == 2 && ip->addr[3] == 254) - { - return true; - } - - return false; -} -bool IsIP4(IP *ip) -{ - // Validate arguments - if (ip == NULL) - { - return false; - } - - return (IsIP6(ip) ? false : true); -} - -// Copy the IP address -void CopyIP(IP *dst, IP *src) -{ - Copy(dst, src, sizeof(IP)); -} - -// Utility functions about IP and MAC address types -// Identify whether the IP address is a normal unicast address -bool IsValidUnicastIPAddress4(IP *ip) -{ - UINT i; - // Validate arguments - if (IsIP4(ip) == false) - { - return false; - } - - if (IsZeroIP(ip)) - { - return false; - } - - if (ip->addr[0] >= 224 && ip->addr[0] <= 239) - { - // IPv4 Multicast - return false; - } - - - /// TODO: this is kinda incorrect, but for the correct parsing we need the netmask anyway - for (i = 0; i < 4; i++) - { - if (ip->addr[i] != 255) - { - return true; - } - } - - return false; -} -bool IsValidUnicastIPAddressUINT4(UINT ip) -{ - IP a; - - UINTToIP(&a, ip); - - return IsValidUnicastIPAddress4(&a); -} - -bool IsValidUnicastIPAddress6(IP *ip) -{ - UINT ipv6Type; - - if (!IsIP6(ip)) - { - return false; - } - - if (IsZeroIP(ip)) - { - return false; - } - - ipv6Type = GetIPAddrType6(ip); - - if (!(ipv6Type & IPV6_ADDR_LOCAL_UNICAST) && - !(ipv6Type & IPV6_ADDR_GLOBAL_UNICAST)) - { - return false; - } - - return true; -} - -// Check whether the MAC address is valid -bool IsMacInvalid(UCHAR *mac) -{ - UINT i; - // Validate arguments - if (mac == NULL) - { - return false; - } - - for (i = 0; i < 6; i++) - { - if (mac[i] != 0x00) - { - return false; - } - } - return true; -} - -// Check whether the MAC address is a broadcast address -bool IsMacBroadcast(UCHAR *mac) -{ - UINT i; - // Validate arguments - if (mac == NULL) - { - return false; - } - - for (i = 0; i < 6; i++) - { - if (mac[i] != 0xff) - { - return false; - } - } - return true; -} - -// Check wether the MAC address is an IPv4 multicast or an IPv6 multicast -bool IsMacMulticast(UCHAR *mac) -{ - // Validate arguments - if (mac == NULL) - { - return false; - } - - if (mac[0] == 0x01 && - mac[1] == 0x00 && - mac[2] == 0x5e) - { - // Multicast IPv4 and other IANA multicasts - return true; - } - - if (mac[0] == 0x01) - { - // That's not a really reserved for multicast range, but it seems like anything with 0x01 is used as multicast anyway - // Remove or specify if it causes problems - return true; - } - - if (mac[0] == 0x33 && - mac[1] == 0x33) - { - // Multicast IPv6 - return true; - } - - return false; -} - -// Check wether the MAC address is a unicast one -bool IsMacUnicast(UCHAR *mac) -{ - // Validate arguments - if (mac == NULL) - { - return false; - } - - if (IsMacInvalid(mac)) - { - return false; - } - - if (IsMacBroadcast(mac)) - { - return false; - } - - if (IsMacMulticast(mac)) - { - return false; - } - - return true; -} - -// Get the number of clients connected from the specified IP address -UINT GetNumIpClient(IP *ip) -{ - IP_CLIENT *c; - UINT ret = 0; - // Validate arguments - if (ip == NULL) - { - return 0; - } - - LockList(ip_clients); - { - c = SearchIpClient(ip); - - if (c != NULL) - { - ret = c->NumConnections; - } - } - UnlockList(ip_clients); - - return ret; -} - -// Add to the IP client entry -void AddIpClient(IP *ip) -{ - IP_CLIENT *c; - // Validate arguments - if (ip == NULL) - { - return; - } - - LockList(ip_clients); - { - c = SearchIpClient(ip); - - if (c == NULL) - { - c = ZeroMallocFast(sizeof(IP_CLIENT)); - Copy(&c->IpAddress, ip, sizeof(IP)); - c->NumConnections = 0; - - Add(ip_clients, c); - } - - c->NumConnections++; - } - UnlockList(ip_clients); - - //Debug("AddIpClient: %r\n", ip); -} - -// Remove from the IP client list -void DelIpClient(IP *ip) -{ - IP_CLIENT *c; - // Validate arguments - if (ip == NULL) - { - return; - } - - LockList(ip_clients); - { - c = SearchIpClient(ip); - - if (c != NULL) - { - c->NumConnections--; - - if (c->NumConnections == 0) - { - Delete(ip_clients, c); - Free(c); - } - } - } - UnlockList(ip_clients); - - //Debug("DelIpClient: %r\n", ip); -} - -// Search for the IP client entry -IP_CLIENT *SearchIpClient(IP *ip) -{ - IP_CLIENT t; - // Validate arguments - if (ip == NULL) - { - return NULL; - } - - Zero(&t, sizeof(t)); - Copy(&t.IpAddress, ip, sizeof(IP)); - - return Search(ip_clients, &t); -} - -// Initialization of the client list -void InitIpClientList() -{ - ip_clients = NewList(CompareIpClientList); -} - -// Release of the client list -void FreeIpClientList() -{ - UINT i; - - for (i = 0; i < LIST_NUM(ip_clients); i++) - { - IP_CLIENT *c = LIST_DATA(ip_clients, i); - - Free(c); - } - - ReleaseList(ip_clients); - ip_clients = NULL; -} - -// Comparison of the client list entries -int CompareIpClientList(void *p1, void *p2) -{ - IP_CLIENT *c1, *c2; - if (p1 == NULL || p2 == NULL) - { - return 0; - } - c1 = *(IP_CLIENT **)p1; - c2 = *(IP_CLIENT **)p2; - if (c1 == NULL || c2 == NULL) - { - return 0; - } - - return CmpIpAddr(&c1->IpAddress, &c2->IpAddress); -} - -// Normalization of the MAC address -bool NormalizeMacAddress(char *dst, UINT size, char *src) -{ - BUF *b; - bool ret = false; - // Validate arguments - if (dst == NULL || src == NULL) - { - return false; - } - - b = StrToBin(src); - - if (b != NULL && b->Size == 6) - { - ret = true; - - BinToStr(dst, size, b->Buf, b->Size); - } - - FreeBuf(b); - - return ret; -} - -// Identify whether the IP address is empty -bool IsZeroIP(IP *ip) -{ - return IsZeroIp(ip); -} -bool IsZeroIp(IP *ip) -{ - // Validate arguments - if (ip == NULL) - { - return true; - } - - if (IsIP6(ip) == false) - { - return IsZero(ip->addr, sizeof(ip->addr)); - } - else - { - return IsZero(ip->ipv6_addr, sizeof(ip->ipv6_addr)); - } -} -bool IsZeroIP6Addr(IPV6_ADDR *addr) -{ - // Validate arguments - if (addr == NULL) - { - return true; - } - - return IsZero(addr, sizeof(IPV6_ADDR)); -} - -// Examine whether the specified IP address is meaningful as a host -bool IsHostIPAddress4(IP *ip) -{ - UINT a; - // Validate arguments - if (ip == NULL) - { - return false; - } - - a = IPToUINT(ip); - - if (a == 0 || a == 0xffffffff) - { - return false; - } - - return true; -} -bool IsHostIPAddress32(UINT ip) -{ - IP p; - - UINTToIP(&p, ip); - - return IsHostIPAddress4(&p); -} - -// Check whether the specified IP address and subnet mask indicates a network correctly -bool IsNetworkAddress4(IP *ip, IP *mask) -{ - UINT a, b; - // Validate arguments - if (ip == NULL || mask == NULL) - { - return false; - } - - if (IsIP4(ip) == false || IsIP4(mask) == false) - { - return false; - } - - if (IsSubnetMask4(mask) == false) - { - return false; - } - - a = IPToUINT(ip); - b = IPToUINT(mask); - - if ((a & b) == a) - { - return true; - } - - return false; -} -bool IsNetworkAddress32(UINT ip, UINT mask) -{ - IP a, b; - - UINTToIP(&a, ip); - UINTToIP(&b, mask); - - return IsNetworkAddress4(&a, &b); -} - -// Convert the integer to a subnet mask -UINT IntToSubnetMask32(UINT i) -{ - UINT ret = 0xFFFFFFFF; - - switch (i) - { - case 0: - ret = 0x00000000; - break; - case 1: - ret = 0x80000000; - break; - case 2: - ret = 0xC0000000; - break; - case 3: - ret = 0xE0000000; - break; - case 4: - ret = 0xF0000000; - break; - case 5: - ret = 0xF8000000; - break; - case 6: - ret = 0xFC000000; - break; - case 7: - ret = 0xFE000000; - break; - case 8: - ret = 0xFF000000; - break; - case 9: - ret = 0xFF800000; - break; - case 10: - ret = 0xFFC00000; - break; - case 11: - ret = 0xFFE00000; - break; - case 12: - ret = 0xFFF00000; - break; - case 13: - ret = 0xFFF80000; - break; - case 14: - ret = 0xFFFC0000; - break; - case 15: - ret = 0xFFFE0000; - break; - case 16: - ret = 0xFFFF0000; - break; - case 17: - ret = 0xFFFF8000; - break; - case 18: - ret = 0xFFFFC000; - break; - case 19: - ret = 0xFFFFE000; - break; - case 20: - ret = 0xFFFFF000; - break; - case 21: - ret = 0xFFFFF800; - break; - case 22: - ret = 0xFFFFFC00; - break; - case 23: - ret = 0xFFFFFE00; - break; - case 24: - ret = 0xFFFFFF00; - break; - case 25: - ret = 0xFFFFFF80; - break; - case 26: - ret = 0xFFFFFFC0; - break; - case 27: - ret = 0xFFFFFFE0; - break; - case 28: - ret = 0xFFFFFFF0; - break; - case 29: - ret = 0xFFFFFFF8; - break; - case 30: - ret = 0xFFFFFFFC; - break; - case 31: - ret = 0xFFFFFFFE; - break; - case 32: - ret = 0xFFFFFFFF; - break; - } - - if (IsLittleEndian()) - { - ret = Swap32(ret); - } - - return ret; -} -void IntToSubnetMask4(IP *ip, UINT i) -{ - UINT m; - // Validate arguments - if (ip == NULL) - { - return; - } - - m = IntToSubnetMask32(i); - - UINTToIP(ip, m); -} - -// Examine whether the specified IP address is a subnet mask -bool IsSubnetMask(IP *ip) -{ - if (IsIP6(ip)) - { - return IsSubnetMask6(ip); - } - else - { - return IsSubnetMask4(ip); - } -} -bool IsSubnetMask4(IP *ip) -{ - UINT i; - // Validate arguments - if (ip == NULL) - { - return false; - } - - if (IsIP6(ip)) - { - return false; - } - - i = IPToUINT(ip); - - if (IsLittleEndian()) - { - i = Swap32(i); - } - - switch (i) - { - case 0x00000000: - case 0x80000000: - case 0xC0000000: - case 0xE0000000: - case 0xF0000000: - case 0xF8000000: - case 0xFC000000: - case 0xFE000000: - case 0xFF000000: - case 0xFF800000: - case 0xFFC00000: - case 0xFFE00000: - case 0xFFF00000: - case 0xFFF80000: - case 0xFFFC0000: - case 0xFFFE0000: - case 0xFFFF0000: - case 0xFFFF8000: - case 0xFFFFC000: - case 0xFFFFE000: - case 0xFFFFF000: - case 0xFFFFF800: - case 0xFFFFFC00: - case 0xFFFFFE00: - case 0xFFFFFF00: - case 0xFFFFFF80: - case 0xFFFFFFC0: - case 0xFFFFFFE0: - case 0xFFFFFFF0: - case 0xFFFFFFF8: - case 0xFFFFFFFC: - case 0xFFFFFFFE: - case 0xFFFFFFFF: - return true; - } - - return false; -} -bool IsSubnetMask32(UINT ip) -{ - IP p; - - UINTToIP(&p, ip); - - return IsSubnetMask4(&p); -} - -#ifdef OS_UNIX // Code for UNIX - -// Turn on and off the non-blocking mode of the socket -void UnixSetSocketNonBlockingMode(int fd, bool nonblock) -{ - UINT flag = 0; - // Validate arguments - if (fd == INVALID_SOCKET) - { - return; - } - - if (nonblock) - { - flag = 1; - } - -#ifdef FIONBIO - ioctl(fd, FIONBIO, &flag); -#else // FIONBIO - { - int flag = fcntl(fd, F_GETFL, 0); - if (flag != -1) - { - if (nonblock) - { - flag |= O_NONBLOCK; - } - else - { - flag = flag & ~O_NONBLOCK; - - fcntl(fd, F_SETFL, flag); - } - } - } -#endif // FIONBIO -} - -// Do Nothing -ROUTE_TABLE *UnixGetRouteTable() -{ - ROUTE_TABLE *ret = ZeroMalloc(sizeof(ROUTE_TABLE)); - ret->NumEntry = 0; - ret->Entry = ZeroMalloc(0); - - return ret; -} - -// Do Nothing -bool UnixAddRouteEntry(ROUTE_ENTRY *e, bool *already_exists) -{ - return true; -} - -// Do Nothing -void UnixDeleteRouteEntry(ROUTE_ENTRY *e) -{ - return; -} - -// Do Nothing -UINT UnixGetVLanInterfaceID(char *instance_name) -{ - return 1; -} - -// Do Nothing -char **UnixEnumVLan(char *tag_name) -{ - char **list; - - list = ZeroMalloc(sizeof(char *)); - - return list; -} - -// Get the IP address of the default DNS server -bool UnixGetDefaultDns(IP *ip) -{ - BUF *b; - // Validate arguments - if (ip == NULL) - { - return false; - } - - Lock(unix_dns_server_addr_lock); - { - if (IsZero(&unix_dns_server, sizeof(IP)) == false) - { - Copy(ip, &unix_dns_server, sizeof(IP)); - Unlock(unix_dns_server_addr_lock); - return true; - } - - ip->addr[0] = 127; - ip->addr[1] = 0; - ip->addr[2] = 0; - ip->addr[3] = 1; - - b = ReadDump("/etc/resolv.conf"); - if (b != NULL) - { - char *s; - bool f = false; - while ((s = CfgReadNextLine(b)) != NULL) - { - TOKEN_LIST *t = ParseToken(s, "\" \t,"); - if (t->NumTokens == 2) - { - if (StrCmpi(t->Token[0], "nameserver") == 0) - { - StrToIP(ip, t->Token[1]); - f = true; - } - } - FreeToken(t); - - Free(s); - - if (f) - { - break; - } - } - FreeBuf(b); - } - Copy(&unix_dns_server, ip, sizeof(IP)); - } - Unlock(unix_dns_server_addr_lock); - - return true; -} - - -// Select procedure -void UnixSelect(SOCKSET *set, UINT timeout, CANCEL *c1, CANCEL *c2) -{ - UINT reads[MAXIMUM_WAIT_OBJECTS]; - UINT writes[MAXIMUM_WAIT_OBJECTS]; - UINT num_read, num_write, i; - UINT p1, p2; - SOCK_EVENT *sock_events[MAXIMUM_WAIT_OBJECTS]; - UINT num_sock_events; - SOCK *s; - UCHAR tmp[MAX_SIZE]; - int ret; - bool any_of_tubes_are_readable = false; - // Initialization of array - Zero(reads, sizeof(reads)); - Zero(writes, sizeof(writes)); - Zero(sock_events, sizeof(sock_events)); - num_read = num_write = num_sock_events = 0; - - // Setting the event array - if (set != NULL) - { - for (i = 0; i < set->NumSocket; i++) - { - s = set->Sock[i]; - if (s != NULL) - { - UnixInitAsyncSocket(s); - if (s->Type == SOCK_INPROC) - { - TUBE *t = s->RecvTube; - if (t != NULL) - { - reads[num_read++] = t->SockEvent->pipe_read; - - sock_events[num_sock_events++] = t->SockEvent; - - if (t->SockEvent->current_pipe_data != 0) - { - any_of_tubes_are_readable = true; - } - } - } - else - { - if (s->NoNeedToRead == false) - { - reads[num_read++] = s->socket; - } - } - - if (s->BulkRecvTube != NULL) - { - TUBE *t = s->BulkRecvTube; - if (t != NULL) - { - reads[num_read++] = t->SockEvent->pipe_read; - - sock_events[num_sock_events++] = t->SockEvent; - - if (t->SockEvent->current_pipe_data != 0) - { - any_of_tubes_are_readable = true; - } - } - } - - if (s->WriteBlocked) - { - writes[num_write++] = s->socket; - } - } - } - } - - if (timeout == 0) - { - return; - } - - p1 = p2 = -1; - - if (c1 != NULL) - { - reads[num_read++] = p1 = c1->pipe_read; - - if (c1->SpecialFlag) - { - if (c1->pipe_special_read2 != -1 && c1->pipe_special_read2 != 0) - { - reads[num_read++] = c1->pipe_special_read2; - } - - if (c1->pipe_special_read3 != -1 && c1->pipe_special_read3 != 0) - { - reads[num_read++] = c1->pipe_special_read3; - } - } - } - if (c2 != NULL) - { - reads[num_read++] = p2 = c2->pipe_read; - - if (c2->SpecialFlag) - { - if (c2->pipe_special_read2 != -1 && c2->pipe_special_read2 != 0) - { - reads[num_read++] = c2->pipe_special_read2; - } - - if (c2->pipe_special_read3 != -1 && c2->pipe_special_read3 != 0) - { - reads[num_read++] = c2->pipe_special_read3; - } - } - } - - // Call the select - if (any_of_tubes_are_readable == false) - { - UnixSelectInner(num_read, reads, num_write, writes, timeout); - } - - // Read from the pipe - if (c1 != NULL && c1->SpecialFlag == false && p1 != -1) - { - do - { - ret = read(p1, tmp, sizeof(tmp)); - } - while (ret >= 1); - } - if (c2 != NULL && c2->SpecialFlag == false && p2 != -1) - { - do - { - ret = read(p2, tmp, sizeof(tmp)); - } - while (ret >= 1); - } - - // Read from the pipe of sockevent - for (i = 0; i < num_sock_events; i++) - { - SOCK_EVENT *e = sock_events[i]; - - e->current_pipe_data = 0; - - do - { - ret = read(e->pipe_read, tmp, sizeof(tmp)); - } - while (ret >= 1); - } -} - -// Cancel -void UnixCancel(CANCEL *c) -{ - // Validate arguments - if (c == NULL) - { - return; - } - - UnixWritePipe(c->pipe_write); -} - -// Release of the cancel object -void UnixCleanupCancel(CANCEL *c) -{ - // Validate arguments - if (c == NULL) - { - return; - } - - if (c->SpecialFlag == false) - { - UnixDeletePipe(c->pipe_read, c->pipe_write); - } - - Free(c); -} - -// Creating a new cancel object -CANCEL *UnixNewCancel() -{ - CANCEL *c = ZeroMallocFast(sizeof(CANCEL)); - - c->ref = NewRef(); - c->SpecialFlag = false; - - UnixNewPipe(&c->pipe_read, &c->pipe_write); - - c->pipe_special_read2 = c->pipe_special_read3 = -1; - - return c; -} - -// Add the socket to the socket event -void UnixJoinSockToSockEvent(SOCK *sock, SOCK_EVENT *event) -{ - // Validate arguments - if (sock == NULL || event == NULL || sock->AsyncMode) - { - return; - } - if (sock->ListenMode != false || (sock->Type == SOCK_TCP && sock->Connected == false)) - { - return; - } - - sock->AsyncMode = true; - - LockList(event->SockList); - { - Add(event->SockList, sock); - AddRef(sock->ref); - } - UnlockList(event->SockList); - - // Make the socket asynchronous mode - if (sock->Type != SOCK_INPROC) - { - UnixSetSocketNonBlockingMode(sock->socket, true); - } - - // Increase the reference count of the SOCK_EVENT - AddRef(event->ref); - sock->SockEvent = event; - - // Set the socket event - SetSockEvent(event); -} - -// Wait for a socket event -bool UnixWaitSockEvent(SOCK_EVENT *event, UINT timeout) -{ - UINT num_read, num_write; - UINT *reads, *writes; - UINT n; - char tmp[MAX_SIZE]; - int readret = 0; - bool event_pipe_is_readable = false; - // Validate arguments - if (event == NULL) - { - return false; - } - - LockList(event->SockList); - { - UINT i; - reads = ZeroMallocFast(sizeof(SOCK *) * (LIST_NUM(event->SockList) + 1)); - - num_write = 0; - num_read = 0; - - for (i = 0; i < LIST_NUM(event->SockList); i++) - { - SOCK *s = LIST_DATA(event->SockList, i); - - if (s->NoNeedToRead == false) - { - reads[num_read++] = s->socket; - } - - if (s->WriteBlocked) - { - num_write++; - } - } - - reads[num_read++] = event->pipe_read; - - if (event->current_pipe_data != 0) - { - event_pipe_is_readable = true; - } - - writes = ZeroMallocFast(sizeof(SOCK *) * num_write); - - n = 0; - - for (i = 0; i < (num_read - 1); i++) - { - SOCK *s = LIST_DATA(event->SockList, i); - if (s->WriteBlocked) - { - writes[n++] = s->socket; - } - } - } - UnlockList(event->SockList); - - if (event_pipe_is_readable == false) - { - UnixSelectInner(num_read, reads, num_write, writes, timeout); - } - - event->current_pipe_data = 0; - do - { - readret = read(event->pipe_read, tmp, sizeof(tmp)); - } - while (readret >= 1); - - Free(reads); - Free(writes); - - return true; -} - -// Set the socket event -void UnixSetSockEvent(SOCK_EVENT *event) -{ - // Validate arguments - if (event == NULL) - { - return; - } - - if (event->current_pipe_data <= 100) - { - UnixWritePipe(event->pipe_write); - event->current_pipe_data++; - } -} - -// This is a helper function for select() -int safe_fd_set(int fd, fd_set *fds, int *max_fd) { - FD_SET(fd, fds); - if (fd > *max_fd) { - *max_fd = fd; - } - return 0; -} - -// Execute 'select' for the socket -void UnixSelectInner(UINT num_read, UINT *reads, UINT num_write, UINT *writes, UINT timeout) -{ -#ifdef UNIX_MACOS - fd_set rfds; //read descriptors - fd_set wfds; //write descriptors - int max_fd = 0; //maximum descriptor id - struct timeval tv; //timeval for timeout -#else // UNIX_MACOS - struct pollfd *p; -#endif // UNIX_MACOS - UINT num; - UINT i; - UINT n; - UINT num_read_total, num_write_total; - - if (num_read != 0 && reads == NULL) - { - num_read = 0; - } - if (num_write != 0 && writes == NULL) - { - num_write = 0; - } - - if (timeout == 0) - { - return; - } - - num_read_total = num_write_total = 0; - for (i = 0; i < num_read; i++) - { - if (reads[i] != INVALID_SOCKET) - { - num_read_total++; - } - } - for (i = 0; i < num_write; i++) - { - if (writes[i] != INVALID_SOCKET) - { - num_write_total++; - } - } - - num = num_read_total + num_write_total; -#ifdef UNIX_MACOS - FD_ZERO(&rfds); //zero out descriptor set for read descriptors - FD_ZERO(&wfds); //same for write -#else // UNIX_MACOS - p = ZeroMallocFast(sizeof(struct pollfd) * num); -#endif // UNIX_MACOS - - n = 0; - - for (i = 0; i < num_read; i++) - { - if (reads[i] != INVALID_SOCKET) - { -#ifdef UNIX_MACOS - safe_fd_set(reads[i], &rfds, &max_fd); -#else // UNIX_MACOS - struct pollfd *pfd = &p[n++]; - pfd->fd = reads[i]; - pfd->events = POLLIN | POLLPRI | POLLERR | POLLHUP; -#endif // UNIX_MACOS - } - } - - for (i = 0; i < num_write; i++) - { - if (writes[i] != INVALID_SOCKET) - { -#ifdef UNIX_MACOS - safe_fd_set(writes[i], &wfds, &max_fd); -#else // UNIX_MACOS - struct pollfd *pfd = &p[n++]; - pfd->fd = writes[i]; - pfd->events = POLLIN | POLLPRI | POLLERR | POLLHUP | POLLOUT; -#endif // UNIX_MACOS - } - } - - if (num != 0) - { -#ifdef UNIX_MACOS - tv.tv_sec = timeout / 1000; - tv.tv_usec = (timeout % 1000) * 1000l; - select(max_fd + 1, &rfds, &wfds, NULL, timeout == INFINITE ? NULL : &tv); -#else // UNIX_MACOS - (void)poll(p, num, timeout == INFINITE ? -1 : (int)timeout); -#endif // UNIX_MACOS - } - else - { - SleepThread(timeout); - } - -#ifndef UNIX_MACOS - Free(p); -#endif // not UNIX_MACOS -} - -// Clean-up of the socket event -void UnixCleanupSockEvent(SOCK_EVENT *event) -{ - UINT i; - // Validate arguments - if (event == NULL) - { - return; - } - - for (i = 0; i < LIST_NUM(event->SockList); i++) - { - SOCK *s = LIST_DATA(event->SockList, i); - - ReleaseSock(s); - } - - ReleaseList(event->SockList); - - UnixDeletePipe(event->pipe_read, event->pipe_write); - - Free(event); -} - -// Create a socket event -SOCK_EVENT *UnixNewSockEvent() -{ - SOCK_EVENT *e = ZeroMallocFast(sizeof(SOCK_EVENT)); - - e->SockList = NewList(NULL); - e->ref = NewRef(); - - UnixNewPipe(&e->pipe_read, &e->pipe_write); - - return e; -} - -// Close the pipe -void UnixDeletePipe(int p1, int p2) -{ - if (p1 != -1) - { - close(p1); - } - - if (p2 != -1) - { - close(p2); - } -} - -// Write to the pipe -void UnixWritePipe(int pipe_write) -{ - char c = 1; - write(pipe_write, &c, 1); -} - -// Create a new pipe -void UnixNewPipe(int *pipe_read, int *pipe_write) -{ - int fd[2]; - // Validate arguments - if (pipe_read == NULL || pipe_write == NULL) - { - return; - } - - fd[0] = fd[1] = 0; - - pipe(fd); - - *pipe_read = fd[0]; - *pipe_write = fd[1]; - - UnixSetSocketNonBlockingMode(*pipe_write, true); - UnixSetSocketNonBlockingMode(*pipe_read, true); -} - -// Release the asynchronous socket -void UnixFreeAsyncSocket(SOCK *sock) -{ - UINT p; - // Validate arguments - if (sock == NULL) - { - return; - } - - Lock(sock->lock); - { - if (sock->AsyncMode == false) - { - Unlock(sock->lock); - return; - } - - sock->AsyncMode = false; - - // Examine whether this socket are associated to SockEvent - if (sock->SockEvent != NULL) - { - SOCK_EVENT *e = sock->SockEvent; - - AddRef(e->ref); - - p = e->pipe_write; - LockList(e->SockList); - { - if (Delete(e->SockList, sock)) - { - ReleaseSock(sock); - } - } - UnlockList(e->SockList); - - // Release the socket event - ReleaseSockEvent(sock->SockEvent); - sock->SockEvent = NULL; - - SetSockEvent(e); - - ReleaseSockEvent(e); - } - } - Unlock(sock->lock); -} - -// Set the socket to asynchronous mode -void UnixInitAsyncSocket(SOCK *sock) -{ - // Validate arguments - if (sock == NULL) - { - return; - } - if (sock->AsyncMode) - { - // The socket has been set in asynchronous mode already - return; - } - if (sock->ListenMode != false || ((sock->Type == SOCK_TCP || sock->Type == SOCK_INPROC) && sock->Connected == false)) - { - return; - } - - sock->AsyncMode = true; - - if (sock->Type != SOCK_INPROC) - { - UnixSetSocketNonBlockingMode(sock->socket, true); - } - -#if OPENSSL_VERSION_NUMBER < 0x10100000L - if (sock->ssl != NULL && sock->ssl->s3 != NULL) - { - sock->Ssl_Init_Async_SendAlert[0] = sock->ssl->s3->send_alert[0]; - sock->Ssl_Init_Async_SendAlert[1] = sock->ssl->s3->send_alert[1]; - } -#endif -} - -// Initializing the socket library -void UnixInitSocketLibrary() -{ - // Do not do anything special -} - -// Release of the socket library -void UnixFreeSocketLibrary() -{ - // Do not do anything special -} - -#endif // OS_UNIX - -#ifdef OS_WIN32 // Code for Windows - -NETWORK_WIN32_FUNCTIONS *w32net; - -// Comparison of IP_ADAPTER_INDEX_MAP -int CompareIpAdapterIndexMap(void *p1, void *p2) -{ - IP_ADAPTER_INDEX_MAP *a1, *a2; - if (p1 == NULL || p2 == NULL) - { - return 0; - } - a1 = *(IP_ADAPTER_INDEX_MAP **)p1; - a2 = *(IP_ADAPTER_INDEX_MAP **)p2; - if (a1 == NULL || a2 == NULL) - { - return 0; - } - - if (a1->Index > a2->Index) - { - return 1; - } - else if (a1->Index < a2->Index) - { - return -1; - } - else - { - return 0; - } -} - -// Update the IP address of the adapter -bool Win32RenewAddressByGuid(char *guid) -{ - IP_ADAPTER_INDEX_MAP a; - // Validate arguments - if (guid == NULL) - { - return false; - } - - Zero(&a, sizeof(a)); - if (Win32GetAdapterFromGuid(&a, guid) == false) - { - return false; - } - - return Win32RenewAddress(&a); -} -bool Win32RenewAddress(void *a) -{ - DWORD ret; - // Validate arguments - if (a == NULL) - { - return false; - } - if (w32net->IpRenewAddress == NULL) - { - return false; - } - - ret = w32net->IpRenewAddress(a); - - if (ret == NO_ERROR) - { - return true; - } - else - { - Debug("IpRenewAddress: Error: %u\n", ret); - return false; - } -} - -// Release the IP address of the adapter -bool Win32ReleaseAddress(void *a) -{ - DWORD ret; - // Validate arguments - if (a == NULL) - { - return false; - } - if (w32net->IpReleaseAddress == NULL) - { - return false; - } - - ret = w32net->IpReleaseAddress(a); - - if (ret == NO_ERROR) - { - return true; - } - else - { - Debug("IpReleaseAddress: Error: %u\n", ret); - return false; - } -} -bool Win32ReleaseAddressByGuid(char *guid) -{ - IP_ADAPTER_INDEX_MAP a; - // Validate arguments - if (guid == NULL) - { - return false; - } - - Zero(&a, sizeof(a)); - if (Win32GetAdapterFromGuid(&a, guid) == false) - { - return false; - } - - return Win32ReleaseAddress(&a); -} -void Win32ReleaseAddressByGuidExThread(THREAD *t, void *param) -{ - WIN32_RELEASEADDRESS_THREAD_PARAM *p; - // Validate arguments - if (t == NULL || param == NULL) - { - return; - } - - p = (WIN32_RELEASEADDRESS_THREAD_PARAM *)param; - - AddRef(p->Ref); - - NoticeThreadInit(t); - - AddWaitThread(t); - - if (p->Renew == false) - { - p->Ok = Win32ReleaseAddressByGuid(p->Guid); - } - else - { - p->Ok = Win32RenewAddressByGuid(p->Guid); - } - - ReleaseWin32ReleaseAddressByGuidThreadParam(p); - - DelWaitThread(t); -} -bool Win32RenewAddressByGuidEx(char *guid, UINT timeout) -{ - return Win32ReleaseOrRenewAddressByGuidEx(guid, timeout, true); -} -bool Win32ReleaseAddressByGuidEx(char *guid, UINT timeout) -{ - return Win32ReleaseOrRenewAddressByGuidEx(guid, timeout, false); -} -bool Win32ReleaseOrRenewAddressByGuidEx(char *guid, UINT timeout, bool renew) -{ - THREAD *t; - WIN32_RELEASEADDRESS_THREAD_PARAM *p; - bool ret = false; - UINT64 start_tick = 0; - UINT64 end_tick = 0; - // Validate arguments - if (guid == NULL) - { - return false; - } - if (timeout == 0) - { - timeout = INFINITE; - } - - p = ZeroMalloc(sizeof(WIN32_RELEASEADDRESS_THREAD_PARAM)); - p->Ref = NewRef(); - StrCpy(p->Guid, sizeof(p->Guid), guid); - p->Timeout = timeout; - p->Renew = renew; - - t = NewThread(Win32ReleaseAddressByGuidExThread, p); - WaitThreadInit(t); - start_tick = Tick64(); - end_tick = start_tick + (UINT64)timeout; - - while (true) - { - UINT64 now = Tick64(); - UINT64 remain; - UINT remain32; - - if (now >= end_tick) - { - break; - } - - remain = end_tick - now; - remain32 = MIN((UINT)remain, 100); - - if (WaitThread(t, remain32)) - { - break; - } - } - - ReleaseThread(t); - - if (p->Ok) - { - ret = true; - } - - ReleaseWin32ReleaseAddressByGuidThreadParam(p); - - return ret; -} -void ReleaseWin32ReleaseAddressByGuidThreadParam(WIN32_RELEASEADDRESS_THREAD_PARAM *p) -{ - // Validate arguments - if (p == NULL) - { - return; - } - - if (Release(p->Ref) == 0) - { - Free(p); - } -} - -// Get the adapter by the GUID -bool Win32GetAdapterFromGuid(void *a, char *guid) -{ - bool ret = false; - IP_INTERFACE_INFO *info; - UINT size; - int i; - LIST *o; - wchar_t tmp[MAX_SIZE]; - - // Validate arguments - if (a == NULL || guid == NULL) - { - return false; - } - if (w32net->GetInterfaceInfo == NULL) - { - return false; - } - - UniFormat(tmp, sizeof(tmp), L"\\DEVICE\\TCPIP_%S", guid); - - size = sizeof(IP_INTERFACE_INFO); - info = ZeroMallocFast(size); - - if (w32net->GetInterfaceInfo(info, &size) == ERROR_INSUFFICIENT_BUFFER) - { - Free(info); - info = ZeroMallocFast(size); - } - - if (w32net->GetInterfaceInfo(info, &size) != NO_ERROR) - { - Free(info); - return false; - } - - o = NewListFast(CompareIpAdapterIndexMap); - - for (i = 0; i < info->NumAdapters; i++) - { - IP_ADAPTER_INDEX_MAP *a = &info->Adapter[i]; - - Add(o, a); - } - - Sort(o); - - for (i = 0; i < (int)(LIST_NUM(o)); i++) - { - IP_ADAPTER_INDEX_MAP *e = LIST_DATA(o, i); - - if (UniStrCmpi(e->Name, tmp) == 0) - { - Copy(a, e, sizeof(IP_ADAPTER_INDEX_MAP)); - ret = true; - break; - } - } - - ReleaseList(o); - - Free(info); - - return ret; -} - -// Clear the DNS cache on Win32 -void Win32FlushDnsCache() -{ - Run("ipconfig.exe", "/flushdns", true, false); -} - -// Update the DHCP address of the specified LAN card -void Win32RenewDhcp9x(UINT if_id) -{ - IP_INTERFACE_INFO *info; - UINT size; - int i; - LIST *o; - // Validate arguments - if (if_id == 0) - { - return; - } - - size = sizeof(IP_INTERFACE_INFO); - info = ZeroMallocFast(size); - - if (w32net->GetInterfaceInfo(info, &size) == ERROR_INSUFFICIENT_BUFFER) - { - Free(info); - info = ZeroMallocFast(size); - } - - if (w32net->GetInterfaceInfo(info, &size) != NO_ERROR) - { - Free(info); - return; - } - - o = NewListFast(CompareIpAdapterIndexMap); - - for (i = 0; i < info->NumAdapters; i++) - { - IP_ADAPTER_INDEX_MAP *a = &info->Adapter[i]; - - Add(o, a); - } - - Sort(o); - - for (i = 0; i < (int)(LIST_NUM(o)); i++) - { - IP_ADAPTER_INDEX_MAP *a = LIST_DATA(o, i); - - if (a->Index == if_id) - { - char arg[MAX_PATH]; - Format(arg, sizeof(arg), "/renew %u", i); - Run("ipconfig.exe", arg, true, false); - } - } - - ReleaseList(o); - - Free(info); -} - -// Release the DHCP address of the specified LAN card -void Win32ReleaseDhcp9x(UINT if_id, bool wait) -{ - IP_INTERFACE_INFO *info; - UINT size; - int i; - LIST *o; - // Validate arguments - if (if_id == 0) - { - return; - } - - size = sizeof(IP_INTERFACE_INFO); - info = ZeroMallocFast(size); - - if (w32net->GetInterfaceInfo(info, &size) == ERROR_INSUFFICIENT_BUFFER) - { - Free(info); - info = ZeroMallocFast(size); - } - - if (w32net->GetInterfaceInfo(info, &size) != NO_ERROR) - { - Free(info); - return; - } - - o = NewListFast(CompareIpAdapterIndexMap); - - for (i = 0; i < info->NumAdapters; i++) - { - IP_ADAPTER_INDEX_MAP *a = &info->Adapter[i]; - - Add(o, a); - } - - Sort(o); - - for (i = 0; i < (int)(LIST_NUM(o)); i++) - { - IP_ADAPTER_INDEX_MAP *a = LIST_DATA(o, i); - - if (a->Index == if_id) - { - char arg[MAX_PATH]; - Format(arg, sizeof(arg), "/release %u", i); - Run("ipconfig.exe", arg, true, wait); - } - } - - ReleaseList(o); - - Free(info); -} - -// Enumerate a list of virtual LAN cards that contains the specified string -char **Win32EnumVLan(char *tag_name) -{ - MIB_IFTABLE *p; - UINT ret; - UINT size_needed; - UINT num_retry = 0; - UINT i; - LIST *o; - char **ss; - // Validate arguments - if (tag_name == 0) - { - return NULL; - } - -RETRY: - p = ZeroMallocFast(sizeof(MIB_IFTABLE)); - size_needed = 0; - - // Examine the needed size - ret = w32net->GetIfTable(p, &size_needed, 0); - if (ret == ERROR_INSUFFICIENT_BUFFER) - { - // Re-allocate the memory block of the needed size - Free(p); - p = ZeroMallocFast(size_needed); - } - else if (ret != NO_ERROR) - { - // Acquisition failure -FAILED: - Free(p); - return NULL; - } - - // Actually get - ret = w32net->GetIfTable(p, &size_needed, FALSE); - if (ret != NO_ERROR) - { - // Acquisition failure - if ((++num_retry) >= 5) - { - goto FAILED; - } - Free(p); - goto RETRY; - } - - // Search - ret = 0; - o = NewListFast(CompareStr); - for (i = 0; i < p->dwNumEntries; i++) - { - MIB_IFROW *r = &p->table[i]; - if (SearchStrEx(r->bDescr, tag_name, 0, false) != INFINITE) - { - char *s = CopyStr(r->bDescr); - Add(o, s); - } - } - - Free(p); - - // Sort - Sort(o); - - // Convert to string - ss = ZeroMallocFast(sizeof(char *) * (LIST_NUM(o) + 1)); - for (i = 0; i < LIST_NUM(o); i++) - { - ss[i] = LIST_DATA(o, i); - } - ss[LIST_NUM(o)] = NULL; - - ReleaseList(o); - - return ss; -} - -// Get the ID of the virtual LAN card from the instance name of the virtual LAN card -UINT Win32GetVLanInterfaceID(char *instance_name) -{ - MIB_IFTABLE *p; - UINT ret; - UINT size_needed; - UINT num_retry = 0; - UINT i; - char ps_miniport_str[MAX_SIZE]; - char ps_miniport_str2[MAX_SIZE]; - UINT min_len = 0x7FFFFFFF; - // Validate arguments - if (instance_name == 0) - { - return 0; - } - -RETRY: - p = ZeroMallocFast(sizeof(MIB_IFTABLE)); - size_needed = 0; - - // Examine the needed size - ret = w32net->GetIfTable(p, &size_needed, 0); - if (ret == ERROR_INSUFFICIENT_BUFFER) - { - // Re-allocate the memory block of the needed size - Free(p); - p = ZeroMallocFast(size_needed); - } - else if (ret != NO_ERROR) - { - // Acquisition failure -FAILED: - Free(p); - Debug("******** GetIfTable Failed 1. Err = %u\n", ret); - return 0; - } - - // Actually get - ret = w32net->GetIfTable(p, &size_needed, FALSE); - if (ret != NO_ERROR) - { - // Acquisition failure - if ((++num_retry) >= 5) - { - goto FAILED; - } - Free(p); - Debug("******** GetIfTable Failed 2. Err = %u\n", ret); - goto RETRY; - } - - // "%s - Packet scheduler miniport" - Format(ps_miniport_str, sizeof(ps_miniport_str), "%s - ", instance_name); - Format(ps_miniport_str2, sizeof(ps_miniport_str2), "%s (Microsoft", instance_name); - - // Search - ret = 0; - for (i = 0; i < p->dwNumEntries; i++) - { - MIB_IFROW *r = &p->table[i]; - if (instance_name[0] != '@') - { - if (StrCmpi(r->bDescr, instance_name) == 0 || StartWith(r->bDescr, ps_miniport_str) || StartWith(r->bDescr, ps_miniport_str2)) - { - UINT len = StrLen(r->bDescr); - - if (len < min_len) - { - ret = r->dwIndex; - - min_len = len; - } - } - } - else - { - if (SearchStrEx(r->bDescr, &instance_name[1], 0, false) != INFINITE) - { - ret = r->dwIndex; - } - } - - //Debug("if[%u] (dwIndex=%u): %u, %s\n", i, r->dwIndex, r->dwType, r->bDescr); - } - - Free(p); - - return ret; -} - -// Get the DNS suffix in another way -bool Win32GetDnsSuffix(char *domain, UINT size) -{ - IP_ADAPTER_ADDRESSES_XP *info; - IP_ADAPTER_ADDRESSES_XP *cur; - UINT info_size; - bool ret = false; - // Validate arguments - ClearStr(domain, size); - if (domain == NULL) - { - return false; - } - if (w32net->GetAdaptersAddresses == NULL) - { - return false; - } - - info_size = 0; - info = ZeroMalloc(sizeof(IP_ADAPTER_ADDRESSES_XP)); - if (w32net->GetAdaptersAddresses(AF_INET, 0, NULL, info, &info_size) == ERROR_BUFFER_OVERFLOW) - { - Free(info); - info = ZeroMalloc(info_size); - } - if (w32net->GetAdaptersAddresses(AF_INET, 0, NULL, info, &info_size) != NO_ERROR) - { - Free(info); - return false; - } - - cur = info; - - while (cur != NULL) - { - if (UniIsEmptyStr(cur->DnsSuffix) == false) - { - UniToStr(domain, size, cur->DnsSuffix); - ret = true; - break; - } - - cur = cur->Next; - } - - Free(info); - - return ret; -} - -// Get the DNS server address of the default -bool Win32GetDefaultDns(IP *ip, char *domain, UINT size) -{ - FIXED_INFO *info; - UINT info_size; - char *dns_name; - // Validate arguments - ClearStr(domain, size); - if (ip == NULL) - { - return false; - } - Zero(ip, sizeof(IP)); - if (w32net->GetNetworkParams == NULL) - { - return false; - } - info_size = 0; - info = ZeroMallocFast(sizeof(FIXED_INFO)); - if (w32net->GetNetworkParams(info, &info_size) == ERROR_BUFFER_OVERFLOW) - { - Free(info); - info = ZeroMallocFast(info_size); - } - if (w32net->GetNetworkParams(info, &info_size) != NO_ERROR) - { - Free(info); - return false; - } - - if (info->DnsServerList.IpAddress.String == NULL) - { - Free(info); - return false; - } - - dns_name = info->DnsServerList.IpAddress.String; - StrToIP(ip, dns_name); - - if (domain != NULL) - { - StrCpy(domain, size, info->DomainName); - Trim(domain); - } - - Free(info); - - return true; -} - -// IP conversion function for Win32 -void Win32UINTToIP(IP *ip, UINT i) -{ - UINTToIP(ip, i); -} - -// IP conversion function for Win32 -UINT Win32IPToUINT(IP *ip) -{ - return IPToUINT(ip); -} - -// Remove a routing entry from the routing table -void Win32DeleteRouteEntry(ROUTE_ENTRY *e) -{ - MIB_IPFORWARDROW *p; - // Validate arguments - if (e == NULL) - { - return; - } - - p = ZeroMallocFast(sizeof(MIB_IPFORWARDROW)); - Win32RouteEntryToIpForwardRow(p, e); - - // Delete - w32net->DeleteIpForwardEntry(p); - - Free(p); -} - -// Add a routing entry to the routing table -bool Win32AddRouteEntry(ROUTE_ENTRY *e, bool *already_exists) -{ - bool ret = false; - bool dummy = false; - MIB_IPFORWARDROW *p; - UINT err = 0; - // Validate arguments - if (e == NULL) - { - return false; - } - if (already_exists == NULL) - { - already_exists = &dummy; - } - - *already_exists = false; - - p = ZeroMallocFast(sizeof(MIB_IPFORWARDROW)); - Win32RouteEntryToIpForwardRow(p, e); - - // Adding - err = w32net->CreateIpForwardEntry(p); - if (err != 0) - { - if (err == ERROR_OBJECT_ALREADY_EXISTS) - { - Debug("CreateIpForwardEntry: Already Exists\n"); - *already_exists = true; - ret = true; - } - else - { - Debug("CreateIpForwardEntry Error: %u\n", err); - ret = false; - } - } - else - { - ret = true; - } - - Free(p); - - return ret; -} - -// Get the routing table -ROUTE_TABLE *Win32GetRouteTable() -{ - ROUTE_TABLE *t = ZeroMallocFast(sizeof(ROUTE_TABLE)); - MIB_IPFORWARDTABLE *p; - UINT ret; - UINT size_needed; - UINT num_retry = 0; - LIST *o; - UINT i; - ROUTE_ENTRY *e; - -RETRY: - p = ZeroMallocFast(sizeof(MIB_IFTABLE)); - size_needed = 0; - - // Examine the needed size - ret = w32net->GetIpForwardTable(p, &size_needed, 0); - if (ret == ERROR_INSUFFICIENT_BUFFER) - { - // Re-allocate the memory block of the needed size - Free(p); - p = ZeroMallocFast(size_needed); - } - else if (ret != NO_ERROR) - { - // Acquisition failure -FAILED: - Free(p); - t->Entry = MallocFast(0); - return t; - } - - // Actually get - ret = w32net->GetIpForwardTable(p, &size_needed, FALSE); - if (ret != NO_ERROR) - { - // Acquisition failure - if ((++num_retry) >= 5) - { - goto FAILED; - } - Free(p); - goto RETRY; - } - - // Add to the list along - o = NewListFast(Win32CompareRouteEntryByMetric); - for (i = 0; i < p->dwNumEntries; i++) - { - e = ZeroMallocFast(sizeof(ROUTE_ENTRY)); - Win32IpForwardRowToRouteEntry(e, &p->table[i]); - Add(o, e); - } - Free(p); - - // Sort by metric - Sort(o); - - // Combine the results - t->NumEntry = LIST_NUM(o); - t->Entry = ToArrayEx(o, true); - ReleaseList(o); - - return t; -} - -// Sort the routing entries by metric -int Win32CompareRouteEntryByMetric(void *p1, void *p2) -{ - ROUTE_ENTRY *e1, *e2; - // Validate arguments - if (p1 == NULL || p2 == NULL) - { - return 0; - } - - e1 = *(ROUTE_ENTRY **)p1; - e2 = *(ROUTE_ENTRY **)p2; - if (e1 == NULL || e2 == NULL) - { - return 0; - } - - if (e1->Metric > e2->Metric) - { - return 1; - } - else if (e1->Metric == e2->Metric) - { - return 0; - } - else - { - return -1; - } -} - -// Convert the ROUTE_ENTRY to a MIB_IPFORWARDROW -void Win32RouteEntryToIpForwardRow(void *ip_forward_row, ROUTE_ENTRY *entry) -{ - MIB_IPFORWARDROW *r; - // Validate arguments - if (entry == NULL || ip_forward_row == NULL) - { - return; - } - - r = (MIB_IPFORWARDROW *)ip_forward_row; - Zero(r, sizeof(MIB_IPFORWARDROW)); - - // IP address - r->dwForwardDest = Win32IPToUINT(&entry->DestIP); - // Subnet mask - r->dwForwardMask = Win32IPToUINT(&entry->DestMask); - // Gateway IP address - r->dwForwardNextHop = Win32IPToUINT(&entry->GatewayIP); - // Local routing flag - if (entry->LocalRouting) - { - // Local - r->dwForwardType = 3; - } - else - { - // Remote router - r->dwForwardType = 4; - } - // Protocol - r->dwForwardProto = r->dwForwardType - 1; // Subtract by 1 in most cases - if (entry->PPPConnection) - { - // Isn't this a PPP? Danger! - r->dwForwardProto++; - } - // Metric - r->dwForwardMetric1 = entry->Metric; - - if (MsIsVista() == false) - { - r->dwForwardMetric2 = r->dwForwardMetric3 = r->dwForwardMetric4 = r->dwForwardMetric5 = INFINITE; - } - else - { - r->dwForwardMetric2 = r->dwForwardMetric3 = r->dwForwardMetric4 = r->dwForwardMetric5 = 0; - r->dwForwardAge = 163240; - } - - // Interface ID - r->dwForwardIfIndex = entry->InterfaceID; - - Debug("Win32RouteEntryToIpForwardRow()\n"); - Debug(" r->dwForwardDest=%X\n", r->dwForwardDest); - Debug(" r->dwForwardMask=%X\n", r->dwForwardMask); - Debug(" r->dwForwardNextHop=%X\n", r->dwForwardNextHop); - Debug(" r->dwForwardType=%u\n", r->dwForwardType); - Debug(" r->dwForwardProto=%u\n", r->dwForwardProto); - Debug(" r->dwForwardMetric1=%u\n", r->dwForwardMetric1); - Debug(" r->dwForwardMetric2=%u\n", r->dwForwardMetric2); - Debug(" r->dwForwardIfIndex=%u\n", r->dwForwardIfIndex); -} - -// Convert the MIB_IPFORWARDROW to a ROUTE_ENTRY -void Win32IpForwardRowToRouteEntry(ROUTE_ENTRY *entry, void *ip_forward_row) -{ - MIB_IPFORWARDROW *r; - // Validate arguments - if (entry == NULL || ip_forward_row == NULL) - { - return; - } - - r = (MIB_IPFORWARDROW *)ip_forward_row; - - Zero(entry, sizeof(ROUTE_ENTRY)); - // IP address - Win32UINTToIP(&entry->DestIP, r->dwForwardDest); - // Subnet mask - Win32UINTToIP(&entry->DestMask, r->dwForwardMask); - // Gateway IP address - Win32UINTToIP(&entry->GatewayIP, r->dwForwardNextHop); - // Local routing flag - if (r->dwForwardType == 3) - { - entry->LocalRouting = true; - } - else - { - entry->LocalRouting = false; - } - if (entry->LocalRouting && r->dwForwardProto == 3) - { - // PPP. Danger! - entry->PPPConnection = true; - } - // Metric - entry->Metric = r->dwForwardMetric1; - // Interface ID - entry->InterfaceID = r->dwForwardIfIndex; -} - -// Initializing the socket library -void Win32InitSocketLibrary() -{ - WSADATA data; - Zero(&data, sizeof(data)); - WSAStartup(MAKEWORD(2, 2), &data); - - // Load the DLL functions - w32net = ZeroMalloc(sizeof(NETWORK_WIN32_FUNCTIONS)); - w32net->hIpHlpApi32 = LoadLibrary("iphlpapi.dll"); - w32net->hIcmp = LoadLibrary("icmp.dll"); - - if (w32net->hIpHlpApi32 != NULL) - { - w32net->CreateIpForwardEntry = - (DWORD (__stdcall *)(PMIB_IPFORWARDROW)) - GetProcAddress(w32net->hIpHlpApi32, "CreateIpForwardEntry"); - - w32net->DeleteIpForwardEntry = - (DWORD (__stdcall *)(PMIB_IPFORWARDROW)) - GetProcAddress(w32net->hIpHlpApi32, "DeleteIpForwardEntry"); - - w32net->GetIfTable = - (DWORD (__stdcall *)(PMIB_IFTABLE, PULONG, BOOL)) - GetProcAddress(w32net->hIpHlpApi32, "GetIfTable"); - - w32net->GetIfTable2 = - (DWORD (__stdcall *)(void **)) - GetProcAddress(w32net->hIpHlpApi32, "GetIfTable2"); - - w32net->FreeMibTable = - (void (__stdcall *)(PVOID)) - GetProcAddress(w32net->hIpHlpApi32, "FreeMibTable"); - - w32net->GetIpForwardTable = - (DWORD (__stdcall *)(PMIB_IPFORWARDTABLE, PULONG, BOOL)) - GetProcAddress(w32net->hIpHlpApi32, "GetIpForwardTable"); - - w32net->GetNetworkParams = - (DWORD (__stdcall *)(PFIXED_INFO,PULONG)) - GetProcAddress(w32net->hIpHlpApi32, "GetNetworkParams"); - - w32net->GetAdaptersAddresses = - (ULONG (__stdcall *)(ULONG,ULONG,PVOID,PIP_ADAPTER_ADDRESSES,PULONG)) - GetProcAddress(w32net->hIpHlpApi32, "GetAdaptersAddresses"); - - w32net->IpRenewAddress = - (DWORD (__stdcall *)(PIP_ADAPTER_INDEX_MAP)) - GetProcAddress(w32net->hIpHlpApi32, "IpRenewAddress"); - - w32net->IpReleaseAddress = - (DWORD (__stdcall *)(PIP_ADAPTER_INDEX_MAP)) - GetProcAddress(w32net->hIpHlpApi32, "IpReleaseAddress"); - - w32net->GetInterfaceInfo = - (DWORD (__stdcall *)(PIP_INTERFACE_INFO, PULONG)) - GetProcAddress(w32net->hIpHlpApi32, "GetInterfaceInfo"); - - w32net->GetAdaptersInfo = - (DWORD (__stdcall *)(PIP_ADAPTER_INFO, PULONG)) - GetProcAddress(w32net->hIpHlpApi32, "GetAdaptersInfo"); - - w32net->GetExtendedTcpTable = - (DWORD (__stdcall *)(PVOID,PDWORD,BOOL,ULONG,_TCP_TABLE_CLASS,ULONG)) - GetProcAddress(w32net->hIpHlpApi32, "GetExtendedTcpTable"); - - w32net->AllocateAndGetTcpExTableFromStack = - (DWORD (__stdcall *)(PVOID *,BOOL,HANDLE,DWORD,DWORD)) - GetProcAddress(w32net->hIpHlpApi32, "AllocateAndGetTcpExTableFromStack"); - - w32net->GetTcpTable = - (DWORD (__stdcall *)(PMIB_TCPTABLE,PDWORD,BOOL)) - GetProcAddress(w32net->hIpHlpApi32, "GetTcpTable"); - - w32net->NotifyRouteChange = - (DWORD (__stdcall *)(PHANDLE,LPOVERLAPPED)) - GetProcAddress(w32net->hIpHlpApi32, "NotifyRouteChange"); - - w32net->CancelIPChangeNotify = - (BOOL (__stdcall *)(LPOVERLAPPED)) - GetProcAddress(w32net->hIpHlpApi32, "CancelIPChangeNotify"); - - w32net->NhpAllocateAndGetInterfaceInfoFromStack = - (DWORD (__stdcall *)(IP_INTERFACE_NAME_INFO **,PDWORD,BOOL,HANDLE,DWORD)) - GetProcAddress(w32net->hIpHlpApi32, "NhpAllocateAndGetInterfaceInfoFromStack"); - - w32net->IcmpCreateFile = - (HANDLE (__stdcall *)()) - GetProcAddress(w32net->hIpHlpApi32, "IcmpCreateFile"); - - w32net->IcmpCloseHandle = - (BOOL (__stdcall *)(HANDLE)) - GetProcAddress(w32net->hIpHlpApi32, "IcmpCloseHandle"); - - w32net->IcmpSendEcho = - (DWORD (__stdcall *)(HANDLE,IPAddr,LPVOID,WORD,PIP_OPTION_INFORMATION,LPVOID,DWORD,DWORD)) - GetProcAddress(w32net->hIpHlpApi32, "IcmpSendEcho"); - } - - if (w32net->hIcmp != NULL) - { - if (w32net->IcmpCreateFile == NULL || w32net->IcmpCloseHandle == NULL || w32net->IcmpSendEcho == NULL) - { - w32net->IcmpCreateFile = - (HANDLE (__stdcall *)()) - GetProcAddress(w32net->hIcmp, "IcmpCreateFile"); - - w32net->IcmpCloseHandle = - (BOOL (__stdcall *)(HANDLE)) - GetProcAddress(w32net->hIcmp, "IcmpCloseHandle"); - - w32net->IcmpSendEcho = - (DWORD (__stdcall *)(HANDLE,IPAddr,LPVOID,WORD,PIP_OPTION_INFORMATION,LPVOID,DWORD,DWORD)) - GetProcAddress(w32net->hIcmp, "IcmpSendEcho"); - } - } - - if (w32net->IcmpCreateFile == NULL || w32net->IcmpCloseHandle == NULL || w32net->IcmpSendEcho == NULL) - { - w32net->IcmpCreateFile = NULL; - w32net->IcmpCloseHandle = NULL; - w32net->IcmpSendEcho = NULL; - } -} - -// Release of the socket library -void Win32FreeSocketLibrary() -{ - if (w32net != NULL) - { - if (w32net->hIpHlpApi32 != NULL) - { - FreeLibrary(w32net->hIpHlpApi32); - } - - if (w32net->hIcmp != NULL) - { - FreeLibrary(w32net->hIcmp); - } - - Free(w32net); - w32net = NULL; - } - - WSACleanup(); -} - -// Cancel -void Win32Cancel(CANCEL *c) -{ - // Validate arguments - if (c == NULL) - { - return; - } - - SetEvent((HANDLE)c->hEvent); -} - -// Cleanup of the cancel object -void Win32CleanupCancel(CANCEL *c) -{ - // Validate arguments - if (c == NULL) - { - return; - } - - if (c->SpecialFlag == false) - { - CloseHandle(c->hEvent); - } - - Free(c); -} - -// New cancel object -CANCEL *Win32NewCancel() -{ - CANCEL *c = ZeroMallocFast(sizeof(CANCEL)); - c->ref = NewRef(); - c->SpecialFlag = false; - c->hEvent = CreateEvent(NULL, FALSE, FALSE, NULL); - - return c; -} - -// Waiting for a socket event -bool Win32WaitSockEvent(SOCK_EVENT *event, UINT timeout) -{ - // Validate arguments - if (event == NULL || timeout == 0) - { - return false; - } - - if (WaitForSingleObject((HANDLE)event->hEvent, timeout) == WAIT_OBJECT_0) - { - return true; - } - else - { - return false; - } -} - -// Clean-up of the socket event -void Win32CleanupSockEvent(SOCK_EVENT *event) -{ - // Validate arguments - if (event == NULL) - { - return; - } - - CloseHandle((HANDLE)event->hEvent); - - Free(event); -} - -// Set of the socket event -void Win32SetSockEvent(SOCK_EVENT *event) -{ - // Validate arguments - if (event == NULL) - { - return; - } - - SetEvent((HANDLE)event->hEvent); -} - -// Creating a socket event -SOCK_EVENT *Win32NewSockEvent() -{ - SOCK_EVENT *e = ZeroMallocFast(sizeof(SOCK_EVENT)); - - e->ref = NewRef(); - e->hEvent = (void *)CreateEvent(NULL, FALSE, FALSE, NULL); - - return e; -} - -// Associate the socket with socket event and set it to asynchronous mode -void Win32JoinSockToSockEvent(SOCK *sock, SOCK_EVENT *event) -{ - HANDLE hEvent; - // Validate arguments - if (sock == NULL || event == NULL || sock->AsyncMode) - { - return; - } - if (sock->ListenMode != false || (sock->Type != SOCK_UDP && sock->Connected == false)) - { - return; - } - - sock->AsyncMode = true; - - hEvent = event->hEvent; - - // Association - WSAEventSelect(sock->socket, hEvent, FD_READ | FD_WRITE | FD_CLOSE); - - // Increase the reference count of the SOCK_EVENT - AddRef(event->ref); - sock->SockEvent = event; -} - -// Set the socket to asynchronous mode -void Win32InitAsyncSocket(SOCK *sock) -{ - // Validate arguments - if (sock == NULL) - { - return; - } - if (sock->AsyncMode) - { - // This socket is already in asynchronous mode - return; - } - if (sock->ListenMode || ((sock->Type == SOCK_TCP || sock->Type == SOCK_INPROC) && sock->Connected == false)) - { - return; - } - - sock->AsyncMode = true; - - if (sock->Type == SOCK_INPROC) - { - // Fetch the event of the TUBE - TUBE *t = sock->RecvTube; - - if (t != NULL) - { - if (t->SockEvent != NULL) - { - sock->hEvent = t->SockEvent->hEvent; - } - } - } - else - { - // Creating an Event - sock->hEvent = (void *)CreateEvent(NULL, FALSE, FALSE, NULL); - - // Association - WSAEventSelect(sock->socket, sock->hEvent, FD_READ | FD_WRITE | FD_CLOSE); - } -} - -// Release the asynchronous socket -void Win32FreeAsyncSocket(SOCK *sock) -{ - // Validate arguments - if (sock == NULL) - { - return; - } - - // Asynchronous socket - if (sock->hEvent != NULL) - { - if (sock->Type != SOCK_INPROC) - { - CloseHandle((HANDLE)sock->hEvent); - } - } - sock->hEvent = NULL; - sock->AsyncMode = false; - - // Socket event - if (sock->SockEvent != NULL) - { - ReleaseSockEvent(sock->SockEvent); - sock->SockEvent = NULL; - } -} - -// Select function for Win32 -void Win32Select(SOCKSET *set, UINT timeout, CANCEL *c1, CANCEL *c2) -{ - HANDLE array[MAXIMUM_WAIT_OBJECTS]; - UINT n, i; - SOCK *s; - // Initialization of array - Zero(array, sizeof(array)); - n = 0; - - // Setting the event array - if (set != NULL) - { - for (i = 0; i < set->NumSocket; i++) - { - s = set->Sock[i]; - if (s != NULL) - { - Win32InitAsyncSocket(s); - if (s->hEvent != NULL) - { - array[n++] = (HANDLE)s->hEvent; - } - - if (s->BulkRecvTube != NULL) - { - array[n++] = (HANDLE)s->BulkRecvTube->SockEvent->hEvent; - } - } - } - } - if (c1 != NULL && c1->hEvent != NULL) - { - array[n++] = c1->hEvent; - } - if (c2 != NULL && c2->hEvent != NULL) - { - array[n++] = c2->hEvent; - } - - if (timeout == 0) - { - return; - } - - if (n == 0) - { - // Call normal waiting function if no events to wait are registered - SleepThread(timeout); - } - else - { - // Wait for the event if events are registered at least one - if (n == 1) - { - // Calling a lightweight version If the event is only one - WaitForSingleObject(array[0], timeout); - } - else - { - // In case of multiple events - WaitForMultipleObjects(n, array, false, timeout); - } - } -} - -#endif // OS_WIN32 - -// Check whether the IPv6 is supported -bool IsIPv6Supported() -{ -#ifdef NO_IPV6 - return false; -#else // NO_IPV6 - SOCKET s; - - s = socket(AF_INET6, SOCK_STREAM, 0); - if (s == INVALID_SOCKET) - { - return false; - } - - closesocket(s); - - return true; -#endif // NO_IPV6 -} - -// Get the host name from the host cache -bool GetHostCache(char *hostname, UINT size, IP *ip) -{ - bool ret; - // Validate arguments - if (hostname == NULL || ip == NULL) - { - return false; - } - - ret = false; - - LockList(HostCacheList); - { - HOSTCACHE t, *c; - Zero(&t, sizeof(t)); - Copy(&t.IpAddress, ip, sizeof(IP)); - - c = Search(HostCacheList, &t); - if (c != NULL) - { - if (IsEmptyStr(c->HostName) == false) - { - ret = true; - StrCpy(hostname, size, c->HostName); - } - else - { - ret = true; - StrCpy(hostname, size, ""); - } - } - } - UnlockList(HostCacheList); - - return ret; -} - -// Add to the host name cache -void AddHostCache(IP *ip, char *hostname) -{ - // Validate arguments - if (ip == NULL || hostname == NULL) - { - return; - } - if (IsNetworkNameCacheEnabled() == false) - { - return; - } - - LockList(HostCacheList); - { - HOSTCACHE t, *c; - UINT i; - LIST *o; - - Zero(&t, sizeof(t)); - Copy(&t.IpAddress, ip, sizeof(IP)); - - c = Search(HostCacheList, &t); - if (c == NULL) - { - c = ZeroMalloc(sizeof(HOSTCACHE)); - Copy(&c->IpAddress, ip, sizeof(IP)); - Add(HostCacheList, c); - } - - StrCpy(c->HostName, sizeof(c->HostName), hostname); - c->Expires = Tick64() + (UINT64)EXPIRES_HOSTNAME; - - o = NewListFast(NULL); - - for (i = 0; i < LIST_NUM(HostCacheList); i++) - { - HOSTCACHE *c = LIST_DATA(HostCacheList, i); - - if (c->Expires <= Tick64()) - { - Add(o, c); - } - } - - for (i = 0; i < LIST_NUM(o); i++) - { - HOSTCACHE *c = LIST_DATA(o, i); - - if (Delete(HostCacheList, c)) - { - Free(c); - } - } - - ReleaseList(o); - } - UnlockList(HostCacheList); -} - -// Comparison of host name cache entries -int CompareHostCache(void *p1, void *p2) -{ - HOSTCACHE *c1, *c2; - if (p1 == NULL || p2 == NULL) - { - return 0; - } - c1 = *(HOSTCACHE **)p1; - c2 = *(HOSTCACHE **)p2; - if (c1 == NULL || c2 == NULL) - { - return 0; - } - - return CmpIpAddr(&c1->IpAddress, &c2->IpAddress); -} - -// Release of the host name cache -void FreeHostCache() -{ - UINT i; - - for (i = 0; i < LIST_NUM(HostCacheList); i++) - { - HOSTCACHE *c = LIST_DATA(HostCacheList, i); - - Free(c); - } - - ReleaseList(HostCacheList); - HostCacheList = NULL; -} - -// Initialization of the host name cache -void InitHostCache() -{ - HostCacheList = NewList(CompareHostCache); -} - -// Add the thread to the thread waiting list -void AddWaitThread(THREAD *t) -{ - // Validate arguments - if (t == NULL) - { - return; - } - - AddRef(t->ref); - - LockList(WaitThreadList); - { - Add(WaitThreadList, t); - } - UnlockList(WaitThreadList); -} - -// Remove the thread from the waiting list -void DelWaitThread(THREAD *t) -{ - // Validate arguments - if (t == NULL) - { - return; - } - - LockList(WaitThreadList); - { - if (Delete(WaitThreadList, t)) - { - ReleaseThread(t); - } - } - UnlockList(WaitThreadList); -} - -// Creating a thread waiting list -void InitWaitThread() -{ - WaitThreadList = NewList(NULL); -} - -// Release of the thread waiting list -void FreeWaitThread() -{ - UINT i, num; - THREAD **threads; - - LockList(WaitThreadList); - { - num = LIST_NUM(WaitThreadList); - threads = ToArray(WaitThreadList); - DeleteAll(WaitThreadList); - } - UnlockList(WaitThreadList); - - for (i = 0; i < num; i++) - { - THREAD *t = threads[i]; - WaitThread(t, INFINITE); - ReleaseThread(t); - } - - Free(threads); - - ReleaseList(WaitThreadList); - WaitThreadList = NULL; -} - -// Get a domain name for UNIX -bool UnixGetDomainName(char *name, UINT size) -{ - bool ret = false; - BUF *b = ReadDump("/etc/resolv.conf"); - - if (b == NULL) - { - return false; - } - - while (true) - { - char *s = CfgReadNextLine(b); - TOKEN_LIST *t; - - if (s == NULL) - { - break; - } - - Trim(s); - - t = ParseToken(s, " \t"); - if (t != NULL) - { - if (t->NumTokens == 2) - { - if (StrCmpi(t->Token[0], "domain") == 0) - { - StrCpy(name, size, t->Token[1]); - ret = true; - } - } - FreeToken(t); - } - - Free(s); - } - - FreeBuf(b); - - return ret; -} - -// Get the domain name -bool GetDomainName(char *name, UINT size) -{ - bool ret = false; - IP ip; - // Validate arguments - ClearStr(name, size); - if (name == NULL) - { - return false; - } - -#ifdef OS_WIN32 - ClearStr(name, size); - ret = Win32GetDefaultDns(&ip, name, size); - - if (ret == false || IsEmptyStr(name)) - { - ret = Win32GetDnsSuffix(name, size); - } -#else // OS_WIN32 - ret = UnixGetDomainName(name, size); -#endif // OS_WIN32 - - if (ret == false) - { - return false; - } - - return (IsEmptyStr(name) ? false : true); -} - -// Get the default DNS server -bool GetDefaultDns(IP *ip) -{ -#ifdef OS_WIN32 - return Win32GetDefaultDns(ip, NULL, 0); -#else - return UnixGetDefaultDns(ip); -#endif // OS_WIN32 -} - -// Creating a socket event -SOCK_EVENT *NewSockEvent() -{ -#ifdef OS_WIN32 - return Win32NewSockEvent(); -#else - return UnixNewSockEvent(); -#endif // OS_WIN32 -} - -// Set of the socket event -void SetSockEvent(SOCK_EVENT *event) -{ -#ifdef OS_WIN32 - Win32SetSockEvent(event); -#else - UnixSetSockEvent(event); -#endif // OS_WIN32 -} - -// Clean-up of the socket event -void CleanupSockEvent(SOCK_EVENT *event) -{ -#ifdef OS_WIN32 - Win32CleanupSockEvent(event); -#else - UnixCleanupSockEvent(event); -#endif // OS_WIN32 -} - -// Waiting for the socket event -bool WaitSockEvent(SOCK_EVENT *event, UINT timeout) -{ - bool ret = false; -#ifdef OS_WIN32 - ret = Win32WaitSockEvent(event, timeout); -#else - ret = UnixWaitSockEvent(event, timeout); -#endif // OS_WIN32 - return ret; -} - -// Release of the socket event -void ReleaseSockEvent(SOCK_EVENT *event) -{ - // Validate arguments - if (event == NULL) - { - return; - } - - if (Release(event->ref) == 0) - { - CleanupSockEvent(event); - } -} - -// Let belonging the socket to the socket event -void JoinSockToSockEvent(SOCK *sock, SOCK_EVENT *event) -{ - // Validate arguments - if (sock == NULL || event == NULL) - { - return; - } - - if (sock->Type == SOCK_INPROC) - { - // Set the SockEvent on the receiver TUBE for in-process type socket - SetTubeSockEvent(sock->RecvTube, event); - return; - } - - if (sock->BulkRecvTube != NULL) - { - // Set the SockEvent on the receiver TUBE in case of R-UDP socket - SetTubeSockEvent(sock->BulkRecvTube, event); - } - -#ifdef OS_WIN32 - Win32JoinSockToSockEvent(sock, event); -#else - UnixJoinSockToSockEvent(sock, event); -#endif // OS_WIN32 -} - -// New special cancel object -CANCEL *NewCancelSpecial(void *hEvent) -{ - CANCEL *c; - // Validate arguments - if (hEvent == NULL) - { - return NULL; - } - - c = ZeroMalloc(sizeof(CANCEL)); - c->ref = NewRef(); - c->SpecialFlag = true; - -#ifdef OS_WIN32 - c->hEvent = (HANDLE)hEvent; -#else // OS_WIN32 - c->pipe_read = (int)hEvent; - c->pipe_write = -1; -#endif // OS_WIN32 - - return c; -} - -// Creating a cancel object -CANCEL *NewCancel() -{ - CANCEL *c = NULL; -#ifdef OS_WIN32 - c = Win32NewCancel(); -#else - c = UnixNewCancel(); -#endif // OS_WIN32 - return c; -} - -// Release of the cancel object -void ReleaseCancel(CANCEL *c) -{ - // Validate arguments - if (c == NULL) - { - return; - } - - if (Release(c->ref) == 0) - { - CleanupCancel(c); - } -} - -// Clean up of the cancel object -void CleanupCancel(CANCEL *c) -{ -#ifdef OS_WIN32 - Win32CleanupCancel(c); -#else - UnixCleanupCancel(c); -#endif -} - -// Cancellation triggered -void Cancel(CANCEL *c) -{ -#ifdef OS_WIN32 - Win32Cancel(c); -#else - UnixCancel(c); -#endif -} - -// Calculate the optimal route from the specified routing table -ROUTE_ENTRY *GetBestRouteEntryFromRouteTableEx(ROUTE_TABLE *table, IP *ip, UINT exclude_if_id) -{ - UINT i; - ROUTE_ENTRY *ret = NULL; - ROUTE_ENTRY *tmp = NULL; - UINT64 min_score = 0; - // Validate arguments - if (ip == NULL || table == NULL) - { - return NULL; - } - - if (IsIP6(ip)) - { - // IPv6 is not supported - return NULL; - } - - // Select routing table entry by following rule - // 1. Largest subnet mask - // 2. Smallest metric value - for (i = 0; i < table->NumEntry; i++) - { - ROUTE_ENTRY *e = table->Entry[i]; - UINT dest, net, mask; - - dest = IPToUINT(ip); - net = IPToUINT(&e->DestIP); - mask = IPToUINT(&e->DestMask); - - if (exclude_if_id != 0) - { - if (e->InterfaceID == exclude_if_id) - { - continue; - } - } - - // Mask test - if ((dest & mask) == (net & mask)) - { - // Calculate the score - UINT score_high32 = mask; - UINT score_low32 = 0xFFFFFFFF - e->Metric; - UINT64 score64 = (UINT64)score_high32 * (UINT64)0x80000000 * (UINT64)2 + (UINT64)score_low32; - if (score64 == 0) - { - score64 = 1; - } - - e->InnerScore = score64; - } - } - - tmp = NULL; - - // Search for the item with maximum score - for (i = 0; i < table->NumEntry; i++) - { - ROUTE_ENTRY *e = table->Entry[i]; - - if (e->InnerScore != 0) - { - if (e->InnerScore >= min_score) - { - tmp = e; - min_score = e->InnerScore; - } - } - } - - if (tmp != NULL) - { - UINT dest, gateway, mask; - - // Generate an entry - ret = ZeroMallocFast(sizeof(ROUTE_ENTRY)); - - Copy(&ret->DestIP, ip, sizeof(IP)); - ret->DestMask.addr[0] = 255; - ret->DestMask.addr[1] = 255; - ret->DestMask.addr[2] = 255; - ret->DestMask.addr[3] = 255; - Copy(&ret->GatewayIP, &tmp->GatewayIP, sizeof(IP)); - ret->InterfaceID = tmp->InterfaceID; - ret->LocalRouting = tmp->LocalRouting; - ret->OldIfMetric = tmp->Metric; - ret->Metric = 1; - ret->PPPConnection = tmp->PPPConnection; - - // Calculation related to routing control - dest = IPToUINT(&tmp->DestIP); - gateway = IPToUINT(&tmp->GatewayIP); - mask = IPToUINT(&tmp->DestMask); - if ((dest & mask) == (gateway & mask)) - { -#ifdef OS_WIN32 - if (MsIsVista() == false) - { - // Adjust for Windows - ret->PPPConnection = true; - } -#endif // OS_WIN32 - } - } - - return ret; -} - -// Release the routing entry -void FreeRouteEntry(ROUTE_ENTRY *e) -{ - // Validate arguments - if (e == NULL) - { - return; - } - - Free(e); -} - -// Get the best route entry by analyzing the current routing table -ROUTE_ENTRY *GetBestRouteEntry(IP *ip) -{ - return GetBestRouteEntryEx(ip, 0); -} -ROUTE_ENTRY *GetBestRouteEntryEx(IP *ip, UINT exclude_if_id) -{ - ROUTE_TABLE *table; - ROUTE_ENTRY *e = NULL; - // Validate arguments - if (ip == NULL) - { - return NULL; - } - - table = GetRouteTable(); - if (table == NULL) - { - return NULL; - } - - e = GetBestRouteEntryFromRouteTableEx(table, ip, exclude_if_id); - FreeRouteTable(table); - - return e; -} - -// Get the interface ID of the virtual LAN card -UINT GetVLanInterfaceID(char *tag_name) -{ - UINT ret = 0; -#ifdef OS_WIN32 - ret = Win32GetVLanInterfaceID(tag_name); -#else // OS_WIN32 - ret = UnixGetVLanInterfaceID(tag_name); -#endif // OS_WIN32 - return ret; -} - -// Release of enumeration variable of virtual LAN card -void FreeEnumVLan(char **s) -{ - char *a; - UINT i; - // Validate arguments - if (s == NULL) - { - return; - } - - i = 0; - while (true) - { - a = s[i++]; - if (a == NULL) - { - break; - } - Free(a); - } - - Free(s); -} - -// Enumeration of virtual LAN cards -char **EnumVLan(char *tag_name) -{ - char **ret = NULL; -#ifdef OS_WIN32 - ret = Win32EnumVLan(tag_name); -#else // OS_WIN32 - ret = UnixEnumVLan(tag_name); -#endif // OS_WIN32 - return ret; -} - -// Display the routing table -void DebugPrintRouteTable(ROUTE_TABLE *r) -{ - UINT i; - // Validate arguments - if (r == NULL) - { - return; - } - - if (IsDebug() == false) - { - return; - } - - Debug("---- Routing Table (%u Entries) ----\n", r->NumEntry); - - for (i = 0; i < r->NumEntry; i++) - { - Debug(" "); - - DebugPrintRoute(r->Entry[i]); - } - - Debug("------------------------------------\n"); -} - -// Display the routing table entry -void DebugPrintRoute(ROUTE_ENTRY *e) -{ - char tmp[MAX_SIZE]; - // Validate arguments - if (e == NULL) - { - return; - } - - if (IsDebug() == false) - { - return; - } - - RouteToStr(tmp, sizeof(tmp), e); - - Debug("%s\n", tmp); -} - -// Convert the routing table entry to string -void RouteToStr(char *str, UINT str_size, ROUTE_ENTRY *e) -{ - char dest_ip[MAX_PATH]; - char dest_mask[MAX_PATH]; - char gateway_ip[MAX_PATH]; - // Validate arguments - if (str == NULL || e == NULL) - { - return; - } - - IPToStr(dest_ip, sizeof(dest_ip), &e->DestIP); - IPToStr(dest_mask, sizeof(dest_mask), &e->DestMask); - IPToStr(gateway_ip, sizeof(gateway_ip), &e->GatewayIP); - - Format(str, str_size, "%s/%s %s m=%u oif=%u if=%u lo=%u p=%u", - dest_ip, dest_mask, gateway_ip, - e->Metric, e->OldIfMetric, e->InterfaceID, - e->LocalRouting, e->PPPConnection); -} - -// Delete the routing table -void DeleteRouteEntry(ROUTE_ENTRY *e) -{ - Debug("DeleteRouteEntry();\n"); -#ifdef OS_WIN32 - Win32DeleteRouteEntry(e); -#else // OS_WIN32 - UnixDeleteRouteEntry(e); -#endif -} - -// Add to the routing table -bool AddRouteEntry(ROUTE_ENTRY *e) -{ - bool dummy = false; - return AddRouteEntryEx(e, &dummy); -} -bool AddRouteEntryEx(ROUTE_ENTRY *e, bool *already_exists) -{ - bool ret = false; - Debug("AddRouteEntryEx();\n"); -#ifdef OS_WIN32 - ret = Win32AddRouteEntry(e, already_exists); -#else // OS_WIN32 - ret = UnixAddRouteEntry(e, already_exists); -#endif - return ret; -} - -// Get the routing table -ROUTE_TABLE *GetRouteTable() -{ - ROUTE_TABLE *t = NULL; - UINT i; - BUF *buf = NewBuf(); - UCHAR hash[MD5_SIZE]; - -#ifdef OS_WIN32 - t = Win32GetRouteTable(); -#else //OS_WIN32 - t = UnixGetRouteTable(); -#endif // OS_WIN32 - - WriteBuf(buf, &t->NumEntry, sizeof(t->NumEntry)); - - for (i = 0; i < t->NumEntry; i++) - { - ROUTE_ENTRY *e = t->Entry[i]; - - WriteBuf(buf, e, sizeof(ROUTE_ENTRY)); - } - - Md5(hash, buf->Buf, buf->Size); - - FreeBuf(buf); - - Copy(&t->HashedValue, hash, sizeof(t->HashedValue)); - - return t; -} - -// Release of the routing table -void FreeRouteTable(ROUTE_TABLE *t) -{ - UINT i; - // Validate arguments - if (t == NULL) - { - return; - } - - for (i = 0; i < t->NumEntry; i++) - { - Free(t->Entry[i]); - } - Free(t->Entry); - Free(t); -} - -// UDP receiving -UINT RecvFrom(SOCK *sock, IP *src_addr, UINT *src_port, void *data, UINT size) -{ - struct sockaddr_in addr; - int ret = 0; -#ifdef OS_WIN32 - int socklen = sizeof(addr); -#else - socklen_t socklen = sizeof(addr); -#endif - - // Validate arguments - if (sock != NULL) - { - if (sock->IPv6) - { - return RecvFrom6(sock, src_addr, src_port, data, size); - } - - sock->IgnoreRecvErr = false; - } - else - { - return 0; - } - - if (src_addr == NULL || src_port == NULL || data == NULL || size == 0) - { - return 0; - } - - if (sock->Type != SOCK_UDP || sock->socket == INVALID_SOCKET) - { - return 0; - } - - ret = recvfrom(sock->socket, data, size, 0, (struct sockaddr *)&addr, &socklen); - if (ret > 0) - { - InAddrToIP(src_addr, &addr.sin_addr); - *src_port = (UINT)ntohs(addr.sin_port); - if (sock->IsRawSocket) - { - *src_port = sock->LocalPort; - } - - Lock(sock->lock); - { - sock->RecvNum++; - sock->RecvSize += (UINT64)ret; - } - Unlock(sock->lock); - - return (UINT)ret; - } - else - { -#ifdef OS_WIN32 - if (WSAGetLastError() == WSAECONNRESET || WSAGetLastError() == WSAENETRESET || WSAGetLastError() == WSAEMSGSIZE || WSAGetLastError() == WSAENETUNREACH || - WSAGetLastError() == WSAENOBUFS || WSAGetLastError() == WSAEHOSTUNREACH || WSAGetLastError() == WSAEUSERS || WSAGetLastError() == WSAEADDRNOTAVAIL || WSAGetLastError() == WSAEADDRNOTAVAIL) - { - sock->IgnoreRecvErr = true; - } - else if (WSAGetLastError() == WSAEWOULDBLOCK || WSAGetLastError() == WSAEINPROGRESS) - { - return SOCK_LATER; - } - else - { - Debug("RecvFrom(): recvfrom() failed with error: %u\n", WSAGetLastError()); - } -#else - if (errno == ECONNREFUSED || errno == ECONNRESET || errno == EMSGSIZE || errno == ENOBUFS || errno == ENOMEM || errno == EINTR) - { - sock->IgnoreRecvErr = true; - } - else if (errno == EAGAIN) - { - return SOCK_LATER; - } - else - { - Debug("RecvFrom(): recvfrom() failed with error: %s\n", strerror(errno)); - } -#endif - return 0; - } -} -UINT RecvFrom6(SOCK *sock, IP *src_addr, UINT *src_port, void *data, UINT size) -{ - struct sockaddr_in6 addr; - int ret = 0; -#ifdef OS_WIN32 - int socklen = sizeof(addr); -#else - socklen_t socklen = sizeof(addr); -#endif - - // Validate arguments - if (sock != NULL) - { - sock->IgnoreRecvErr = false; - } - else - { - return 0; - } - - if (src_addr == NULL || src_port == NULL || data == NULL || size == 0) - { - return 0; - } - - if (sock->Type != SOCK_UDP || sock->socket == INVALID_SOCKET) - { - return 0; - } - - - ret = recvfrom(sock->socket, data, size, 0, (struct sockaddr *)&addr, &socklen); - if (ret > 0) - { - InAddrToIP6(src_addr, &addr.sin6_addr); - src_addr->ipv6_scope_id = addr.sin6_scope_id; - *src_port = (UINT)ntohs(addr.sin6_port); - if (sock->IsRawSocket) - { - *src_port = sock->LocalPort; - } - - Lock(sock->lock); - { - sock->RecvNum++; - sock->RecvSize += (UINT64)ret; - } - Unlock(sock->lock); - - return (UINT)ret; - } - else - { -#ifdef OS_WIN32 - if (WSAGetLastError() == WSAECONNRESET || WSAGetLastError() == WSAENETRESET || WSAGetLastError() == WSAEMSGSIZE || WSAGetLastError() == WSAENETUNREACH || - WSAGetLastError() == WSAENOBUFS || WSAGetLastError() == WSAEHOSTUNREACH || WSAGetLastError() == WSAEUSERS || WSAGetLastError() == WSAEADDRNOTAVAIL || WSAGetLastError() == WSAEADDRNOTAVAIL) - { - sock->IgnoreRecvErr = true; - } - else if (WSAGetLastError() == WSAEWOULDBLOCK || WSAGetLastError() == WSAEINPROGRESS) - { - return SOCK_LATER; - } - else - { - Debug("RecvFrom(): recvfrom() failed with error: %u\n", WSAGetLastError()); - } -#else - if (errno == ECONNREFUSED || errno == ECONNRESET || errno == EMSGSIZE || errno == ENOBUFS || errno == ENOMEM || errno == EINTR) - { - sock->IgnoreRecvErr = true; - } - else if (errno == EAGAIN) - { - return SOCK_LATER; - } - else - { - Debug("RecvFrom(): recvfrom() failed with error: %s\n", strerror(errno)); - } -#endif - return 0; - } -} - -// UDP transmission -UINT SendTo(SOCK *sock, IP *dest_addr, UINT dest_port, void *data, UINT size) -{ - return SendToEx(sock, dest_addr, dest_port, data, size, false); -} -UINT SendToEx(SOCK *sock, IP *dest_addr, UINT dest_port, void *data, UINT size, bool broadcast) -{ - SOCKET s; - int ret; - struct sockaddr_in addr; - // Validate arguments - if (sock != NULL) - { - sock->IgnoreSendErr = false; - } - if (sock == NULL || dest_addr == NULL || (sock->IsRawSocket == false && dest_port == 0) || data == NULL) - { - return 0; - } - if (dest_port >= 65536 && sock->IsRawSocket == false) - { - return 0; - } - if (sock->Type != SOCK_UDP || sock->socket == INVALID_SOCKET) - { - return 0; - } - if (size == 0) - { - return 0; - } - - if (sock->IPv6) - { - return SendTo6Ex(sock, dest_addr, dest_port, data, size, broadcast); - } - - if (IsIP4(dest_addr) == false) - { - return 0; - } - - s = sock->socket; - Zero(&addr, sizeof(addr)); - addr.sin_family = AF_INET; - if (sock->IsRawSocket == false) - { - addr.sin_port = htons((USHORT)dest_port); - } - IPToInAddr(&addr.sin_addr, dest_addr); - - if ((dest_addr->addr[0] == 255 && dest_addr->addr[1] == 255 && - dest_addr->addr[2] == 255 && dest_addr->addr[3] == 255) || - (dest_addr->addr[0] >= 224 && dest_addr->addr[0] <= 239) - || broadcast) - { - if (sock->UdpBroadcast == false) - { - bool yes = true; - - sock->UdpBroadcast = true; - - (void)setsockopt(s, SOL_SOCKET, SO_BROADCAST, (char *)&yes, sizeof(yes)); - } - } - - ret = sendto(s, data, size, 0, (struct sockaddr *)&addr, sizeof(addr)); - if (ret != (int)size) - { - sock->IgnoreSendErr = false; - -#ifdef OS_WIN32 - if (WSAGetLastError() == WSAECONNRESET || WSAGetLastError() == WSAENETRESET || WSAGetLastError() == WSAEMSGSIZE || WSAGetLastError() == WSAENETUNREACH || - WSAGetLastError() == WSAENOBUFS || WSAGetLastError() == WSAEHOSTUNREACH || WSAGetLastError() == WSAEUSERS || WSAGetLastError() == WSAEINVAL || WSAGetLastError() == WSAEADDRNOTAVAIL) - { - sock->IgnoreSendErr = true; - } - else if (WSAGetLastError() == WSAEWOULDBLOCK || WSAGetLastError() == WSAEINPROGRESS) - { - return SOCK_LATER; - } - else - { - UINT e = WSAGetLastError(); - Debug("SendTo Error; %u\n", e); - } -#else // OS_WIN32 - if (errno == ECONNREFUSED || errno == ECONNRESET || errno == EMSGSIZE || errno == ENOBUFS || errno == ENOMEM || errno == EINTR) - { - sock->IgnoreSendErr = true; - } - else if (errno == EAGAIN) - { - return SOCK_LATER; - } -#endif // OS_WIN32 - return 0; - } - - Lock(sock->lock); - { - sock->SendSize += (UINT64)size; - sock->SendNum++; - } - Unlock(sock->lock); - - return ret; -} -UINT SendTo6Ex(SOCK *sock, IP *dest_addr, UINT dest_port, void *data, UINT size, bool broadcast) -{ - SOCKET s; - int ret; - struct sockaddr_in6 addr; - UINT type; - // Validate arguments - if (sock != NULL) - { - sock->IgnoreSendErr = false; - } - if (sock == NULL || dest_addr == NULL || (sock->IsRawSocket == false && dest_port == 0) || data == NULL) - { - return 0; - } - if (dest_port >= 65536 && sock->IsRawSocket == false) - { - return 0; - } - if (sock->Type != SOCK_UDP || sock->socket == INVALID_SOCKET) - { - return 0; - } - if (size == 0) - { - return 0; - } - - if (IsIP6(dest_addr) == false) - { - return 0; - } - - s = sock->socket; - Zero(&addr, sizeof(addr)); - addr.sin6_family = AF_INET6; - if (sock->IsRawSocket == false) - { - addr.sin6_port = htons((USHORT)dest_port); - } - IPToInAddr6(&addr.sin6_addr, dest_addr); - addr.sin6_scope_id = dest_addr->ipv6_scope_id; - - type = GetIPAddrType6(dest_addr); - - if ((type & IPV6_ADDR_MULTICAST) || broadcast) - { - if (sock->UdpBroadcast == false) - { - bool yes = true; - - sock->UdpBroadcast = true; - - (void)setsockopt(s, SOL_SOCKET, SO_BROADCAST, (char *)&yes, sizeof(yes)); - } - } - - ret = sendto(s, data, size, 0, (struct sockaddr *)&addr, sizeof(addr)); - if (ret != (int)size) - { - sock->IgnoreSendErr = false; - -#ifdef OS_WIN32 - if (WSAGetLastError() == WSAECONNRESET || WSAGetLastError() == WSAENETRESET || WSAGetLastError() == WSAEMSGSIZE || WSAGetLastError() == WSAENETUNREACH || - WSAGetLastError() == WSAENOBUFS || WSAGetLastError() == WSAEHOSTUNREACH || WSAGetLastError() == WSAEUSERS || WSAGetLastError() == WSAEINVAL || WSAGetLastError() == WSAEADDRNOTAVAIL) - { - sock->IgnoreSendErr = true; - } - else if (WSAGetLastError() == WSAEWOULDBLOCK || WSAGetLastError() == WSAEINPROGRESS) - { - return SOCK_LATER; - } - else - { - UINT e = WSAGetLastError(); - } -#else // OS_WIN32 - if (errno == ECONNREFUSED || errno == ECONNRESET || errno == EMSGSIZE || errno == ENOBUFS || errno == ENOMEM || errno == EINTR) - { - sock->IgnoreSendErr = true; - } - else if (errno == EAGAIN) - { - return SOCK_LATER; - } -#endif // OS_WIN32 - return 0; - } - - Lock(sock->lock); - { - sock->SendSize += (UINT64)size; - sock->SendNum++; - } - Unlock(sock->lock); - - return ret; -} - -// Open a UDP port (port number is random, but determine the randomness in the seed) -SOCK *NewUDPEx2Rand(bool ipv6, IP *ip, void *rand_seed, UINT rand_seed_size, UINT num_retry) -{ - UINT i; - // Validate arguments - if (rand_seed == NULL || rand_seed_size == 0) - { - return NULL; - } - if (num_retry == 0) - { - num_retry = RAND_UDP_PORT_DEFAULT_NUM_RETRY; - } - - for (i = 0; i < (num_retry + 1); i++) - { - BUF *buf = NewBuf(); - UCHAR hash[SHA1_SIZE]; - UINT port = 0; - SOCK *s; - - WriteBuf(buf, rand_seed, rand_seed_size); - WriteBufInt(buf, i); - - Sha1(hash, buf->Buf, buf->Size); - - FreeBuf(buf); - - port = READ_UINT(hash); - - port = RAND_UDP_PORT_START + (port % (RAND_UDP_PORT_END - RAND_UDP_PORT_START)); - - s = NewUDPEx2(port, ipv6, ip); - - if (s != NULL) - { - return s; - } - } - - return NewUDPEx2(0, ipv6, ip); -} - -// Open the UDP port (based on the EXE path and machine key) -SOCK *NewUDPEx2RandMachineAndExePath(bool ipv6, IP *ip, UINT num_retry, UCHAR rand_port_id) -{ - BUF *b; - char machine_name[MAX_SIZE]; - wchar_t exe_path[MAX_PATH]; - char *product_id = NULL; - UCHAR hash[SHA1_SIZE]; - -#ifdef OS_WIN32 - product_id = MsRegReadStr(REG_LOCAL_MACHINE, "SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion", "ProductId"); - if (product_id == NULL) - { - product_id = MsRegReadStr(REG_LOCAL_MACHINE, "SOFTWARE\\Microsoft\\Windows\\CurrentVersion", "ProductId"); - } -#endif // OS_WIN32 - - b = NewBuf(); - - GetMachineHostName(machine_name, sizeof(machine_name)); - Trim(machine_name); - StrUpper(machine_name); - - GetExeNameW(exe_path, sizeof(exe_path)); - UniTrim(exe_path); - UniStrUpper(exe_path); - - WriteBuf(b, machine_name, StrSize(machine_name)); - WriteBuf(b, exe_path, UniStrSize(exe_path)); - WriteBuf(b, product_id, StrSize(product_id)); - WriteBufChar(b, rand_port_id); - //WriteBufInt(b, GetHostIPAddressHash32()); - - Sha1(hash, b->Buf, b->Size); - - FreeBuf(b); - - Free(product_id); - - return NewUDPEx2Rand(ipv6, ip, hash, sizeof(hash), num_retry); -} - -// Set the DF bit of the socket -void ClearSockDfBit(SOCK *s) -{ -#ifdef IP_PMTUDISC_DONT -#ifdef IP_MTU_DISCOVER - UINT value = IP_PMTUDISC_DONT; - if (s == NULL) - { - return; - } - - (void)setsockopt(s->socket, IPPROTO_IP, IP_MTU_DISCOVER, (char *)&value, sizeof(value)); -#endif // IP_MTU_DISCOVER -#endif // IP_PMTUDISC_DONT -} - -// Set the header-include option -void SetRawSockHeaderIncludeOption(SOCK *s, bool enable) -{ - UINT value = BOOL_TO_INT(enable); - if (s == NULL || s->IsRawSocket == false) - { - return; - } - - (void)setsockopt(s->socket, IPPROTO_IP, IP_HDRINCL, (char *)&value, sizeof(value)); - - s->RawIP_HeaderIncludeFlag = enable; -} - -// Create and initialize the UDP socket -// If port is specified as 0, system assigns a certain port. -SOCK *NewUDP(UINT port) -{ - return NewUDPEx(port, false); -} -SOCK *NewUDPEx(UINT port, bool ipv6) -{ - return NewUDPEx2(port, ipv6, NULL); -} -SOCK *NewUDPEx2(UINT port, bool ipv6, IP *ip) -{ - if (ipv6 == false) - { - return NewUDP4(port, ip); - } - else - { - return NewUDP6(port, ip); - } -} -SOCK *NewUDPEx3(UINT port, IP *ip) -{ - // Validate arguments - if (ip == NULL) - { - return NewUDPEx2(port, false, NULL); - } - - if (IsIP4(ip)) - { - return NewUDPEx2(port, false, ip); - } - else - { - return NewUDPEx2(port, true, ip); - } -} -SOCK *NewUDP4(UINT port, IP *ip) -{ - SOCK *sock; - SOCKET s; - struct sockaddr_in addr; - // Validate arguments - if (ip != NULL && IsIP4(ip) == false) - { - return NULL; - } - - if (IS_SPECIAL_PORT(port) == false) - { - s = socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP); - } - else - { - s = socket(AF_INET, SOCK_RAW, GET_SPECIAL_PORT(port)); - } - if (s == INVALID_SOCKET) - { - return NULL; - } - - Zero(&addr, sizeof(addr)); - addr.sin_family = AF_INET; - - if (ip == NULL || IsZeroIP(ip)) - { - addr.sin_addr.s_addr = htonl(INADDR_ANY); - } - else - { - IPToInAddr(&addr.sin_addr, ip); - } - - if (port == 0 || IS_SPECIAL_PORT(port)) - { - addr.sin_port = 0; - } - else - { - addr.sin_port = htons((USHORT)port); - } - - if (bind(s, (struct sockaddr *)&addr, sizeof(addr)) != 0) - { - // Failure - if (port != 0) - { - bool true_flag = true; - (void)setsockopt(s, SOL_SOCKET, SO_REUSEADDR, (char *)&true_flag, sizeof(bool)); - if (bind(s, (struct sockaddr *)&addr, sizeof(addr)) != 0) - { - bool false_flag = false; - (void)setsockopt(s, SOL_SOCKET, SO_REUSEADDR, (char *)&false_flag, sizeof(bool)); -#ifdef SO_EXCLUSIVEADDRUSE - (void)setsockopt(s, SOL_SOCKET, SO_EXCLUSIVEADDRUSE, (char *)&true_flag, sizeof(bool)); -#endif // SO_EXCLUSIVEADDRUSE - if (bind(s, (struct sockaddr *)&addr, sizeof(addr)) != 0) - { - closesocket(s); - return NULL; - } - } - } - else - { - closesocket(s); - return NULL; - } - } - - sock = NewSock(); - - sock->Type = SOCK_UDP; - sock->Connected = false; - sock->AsyncMode = false; - sock->ServerMode = false; - if (port != 0) - { - sock->ServerMode = true; - } - - sock->socket = s; - - InitUdpSocketBufferSize((int)s); - - if (IS_SPECIAL_PORT(port)) - { - bool no = false; - (void)setsockopt(sock->socket, IPPROTO_IP, IP_HDRINCL, (char *)&no, sizeof(no)); - - sock->IsRawSocket = true; - sock->RawSocketIPProtocol = GET_SPECIAL_PORT(port); - } - - QuerySocketInformation(sock); - - return sock; -} -SOCK *NewUDP6(UINT port, IP *ip) -{ - SOCK *sock; - SOCKET s; - struct sockaddr_in6 addr; - // Validate arguments - if (ip != NULL && IsIP6(ip) == false) - { - return NULL; - } - - if (IS_SPECIAL_PORT(port) == false) - { - s = socket(AF_INET6, SOCK_DGRAM, IPPROTO_UDP); - } - else - { - s = socket(AF_INET6, SOCK_RAW, GET_SPECIAL_PORT(port)); - } - if (s == INVALID_SOCKET) - { - return NULL; - } - - Zero(&addr, sizeof(addr)); - addr.sin6_family = AF_INET6; - if (port == 0) - { - addr.sin6_port = 0; - } - else - { - addr.sin6_port = htons((USHORT)port); - } - - if (ip != NULL && IsZeroIP(ip) == false) - { - IPToInAddr6(&addr.sin6_addr, ip); - addr.sin6_scope_id = ip->ipv6_scope_id; - } - - if (bind(s, (struct sockaddr *)&addr, sizeof(addr)) != 0) - { - // Failure - if (port != 0) - { - bool true_flag = true; - (void)setsockopt(s, SOL_SOCKET, SO_REUSEADDR, (char *)&true_flag, sizeof(bool)); - if (bind(s, (struct sockaddr *)&addr, sizeof(addr)) != 0) - { - bool false_flag = false; - (void)setsockopt(s, SOL_SOCKET, SO_REUSEADDR, (char *)&false_flag, sizeof(bool)); -#ifdef SO_EXCLUSIVEADDRUSE - (void)setsockopt(s, SOL_SOCKET, SO_EXCLUSIVEADDRUSE, (char *)&true_flag, sizeof(bool)); -#endif // SO_EXCLUSIVEADDRUSE - if (bind(s, (struct sockaddr *)&addr, sizeof(addr)) != 0) - { - closesocket(s); - return NULL; - } - } - } - else - { - closesocket(s); - return NULL; - } - } - - sock = NewSock(); - - sock->Type = SOCK_UDP; - sock->Connected = false; - sock->AsyncMode = false; - sock->ServerMode = false; - sock->IPv6 = true; - if (port != 0) - { - sock->ServerMode = true; - } - - sock->socket = s; - - InitUdpSocketBufferSize(s); - - if (IS_SPECIAL_PORT(port)) - { - bool no = false; -#ifdef IPV6_HDRINCL - (void)setsockopt(sock->socket, IPPROTO_IP, IPV6_HDRINCL, (char *)&no, sizeof(no)); -#endif // IPV6_HDRINCL - (void)setsockopt(sock->socket, IPPROTO_IP, IP_HDRINCL, (char *)&no, sizeof(no)); - - sock->IsRawSocket = true; - sock->RawSocketIPProtocol = GET_SPECIAL_PORT(port); - } - - QuerySocketInformation(sock); - - return sock; -} - -// Select function -void Select(SOCKSET *set, UINT timeout, CANCEL *c1, CANCEL *c2) -{ -#ifdef OS_WIN32 - Win32Select(set, timeout, c1, c2); -#else - UnixSelect(set, timeout, c1, c2); -#endif // OS_WIN32 -} - -// Add a socket to the socket set -void AddSockSet(SOCKSET *set, SOCK *sock) -{ - // Validate arguments - if (set == NULL || sock == NULL) - { - return; - } - if (sock->Type == SOCK_TCP && sock->Connected == false) - { - return; - } - - if (set->NumSocket >= MAX_SOCKSET_NUM) - { - // Upper limit - return; - } - set->Sock[set->NumSocket++] = sock; -} - -// Initializing the socket set -void InitSockSet(SOCKSET *set) -{ - // Validate arguments - if (set == NULL) - { - return; - } - - Zero(set, sizeof(SOCKSET)); -} - -// Receive data and discard all of them -bool RecvAllWithDiscard(SOCK *sock, UINT size, bool secure) -{ - static UCHAR buffer[4096]; - UINT recv_size, sz, ret; - if (sock == NULL) - { - return false; - } - if (size == 0) - { - return true; - } - if (sock->AsyncMode) - { - return false; - } - - recv_size = 0; - - while (true) - { - sz = MIN(size - recv_size, sizeof(buffer)); - ret = Recv(sock, buffer, sz, secure); - if (ret == 0) - { - return false; - } - if (ret == SOCK_LATER) - { - // I suppose that this is safe because the RecvAll() function is used only - // if the sock->AsyncMode == true. And the Recv() function may return - // SOCK_LATER only if the sock->AsyncMode == false. Therefore the call of - // Recv() function in the RecvAll() function never returns SOCK_LATER. - return false; - } - recv_size += ret; - if (recv_size >= size) - { - return true; - } - } -} - -// Receive all by TCP -bool RecvAll(SOCK *sock, void *data, UINT size, bool secure) -{ - UINT recv_size, sz, ret; - // Validate arguments - if (sock == NULL || data == NULL) - { - return false; - } - if (size == 0) - { - return true; - } - if (sock->AsyncMode) - { - return false; - } - - recv_size = 0; - - while (true) - { - sz = size - recv_size; - ret = Recv(sock, (UCHAR *)data + recv_size, sz, secure); - if (ret == 0) - { - return false; - } - if (ret == SOCK_LATER) - { - // I suppose that this is safe because the RecvAll() function is used only - // if the sock->AsyncMode == true. And the Recv() function may return - // SOCK_LATER only if the sock->AsyncMode == false. Therefore the call of - // Recv() function in the RecvAll() function never returns SOCK_LATER. - return false; - } - recv_size += ret; - if (recv_size >= size) - { - return true; - } - } -} - -// Send the TCP send buffer -bool SendNow(SOCK *sock, int secure) -{ - bool ret; - // Validate arguments - if (sock == NULL || sock->AsyncMode != false) - { - return false; - } - if (sock->SendBuf->Size == 0) - { - return true; - } - - ret = SendAll(sock, sock->SendBuf->Buf, sock->SendBuf->Size, secure); - ClearBuf(sock->SendBuf); - - return ret; -} - -// Append to the TCP send buffer -void SendAdd(SOCK *sock, void *data, UINT size) -{ - // Validate arguments - if (sock == NULL || data == NULL || size == 0 || sock->AsyncMode != false) - { - return; - } - - WriteBuf(sock->SendBuf, data, size); -} - -// Send all by TCP -bool SendAll(SOCK *sock, void *data, UINT size, bool secure) -{ - UCHAR *buf; - UINT sent_size; - UINT ret; - // Validate arguments - if (sock == NULL || data == NULL) - { - return false; - } - if (sock->AsyncMode) - { - return false; - } - if (size == 0) - { - return true; - } - - buf = (UCHAR *)data; - sent_size = 0; - - while (true) - { - ret = Send(sock, buf, size - sent_size, secure); - if (ret == 0) - { - return false; - } - sent_size += ret; - buf += ret; - if (sent_size >= size) - { - return true; - } - } -} - -// Set the cipher algorithm name to want to use -void SetWantToUseCipher(SOCK *sock, char *name) -{ - // Validate arguments - if (sock == NULL || name == NULL) - { - return; - } - - if (sock->WaitToUseCipher) - { - Free(sock->WaitToUseCipher); - } - - sock->WaitToUseCipher = CopyStr(name); -} - -// Add all the chain certificates in the chain_certs directory -void AddChainSslCertOnDirectory(struct ssl_ctx_st *ctx) -{ - wchar_t dirname[MAX_SIZE]; - wchar_t exedir[MAX_SIZE]; - wchar_t txtname[MAX_SIZE]; - DIRLIST *dir; - LIST *o; - UINT i; - - // Validate arguments - if (ctx == NULL) - { - return; - } - - o = NewListFast(NULL); - - GetDbDirW(exedir, sizeof(exedir)); - - CombinePathW(dirname, sizeof(dirname), exedir, L"chain_certs"); - - MakeDirExW(dirname); - - CombinePathW(txtname, sizeof(txtname), dirname, L"Readme_Chain_Certs.txt"); - - if (IsFileExistsW(txtname) == false) - { - FileCopyW(L"|chain_certs.txt", txtname); - } - - dir = EnumDirW(dirname); - - if (dir != NULL) - { - for (i = 0; i < dir->NumFiles; i++) - { - DIRENT *e = dir->File[i]; - - if (e->Folder == false) - { - wchar_t tmp[MAX_SIZE]; - X *x; - - CombinePathW(tmp, sizeof(tmp), dirname, e->FileNameW); - - x = FileToXW(tmp); - - if (x != NULL) - { - UINT j; - bool exists = false; - UCHAR hash[SHA1_SIZE]; - - GetXDigest(x, hash, true); - - for (j = 0; j < LIST_NUM(o); j++) - { - UCHAR *hash2 = LIST_DATA(o, j); - - if (Cmp(hash, hash2, SHA1_SIZE) == 0) - { - exists = true; - } - } - - if (exists == false) - { - AddChainSslCert(ctx, x); - - Add(o, Clone(hash, SHA1_SIZE)); - } - - FreeX(x); - } - } - } - - FreeDir(dir); - } - - for (i = 0; i < LIST_NUM(o); i++) - { - UCHAR *hash = LIST_DATA(o, i); - - Free(hash); - } - - ReleaseList(o); -} - -// Add the chain certificate -bool AddChainSslCert(struct ssl_ctx_st *ctx, X *x) -{ - bool ret = false; - X *x_copy; - // Validate arguments - if (ctx == NULL || x == NULL) - { - return ret; - } - - x_copy = CloneX(x); - - if (x_copy != NULL) - { - if (x_copy->root_cert) - { - X509_STORE *store = SSL_CTX_get_cert_store(ctx); - X509_STORE_add_cert(store, x_copy->x509); - X509_free(x_copy->x509); - } - else - { - SSL_CTX_add_extra_chain_cert(ctx, x_copy->x509); - } - x_copy->do_not_free = true; - - ret = true; - - FreeX(x_copy); - } - - return ret; -} - -// Start a TCP-SSL communication -bool StartSSL(SOCK *sock, X *x, K *priv) -{ - return StartSSLEx(sock, x, priv, 0, NULL); -} -bool StartSSLEx(SOCK *sock, X *x, K *priv, UINT ssl_timeout, char *sni_hostname) -{ - X509 *x509; - EVP_PKEY *key; - UINT prev_timeout = 1024; - SSL_CTX *ssl_ctx; - -#ifdef UNIX_SOLARIS - SOCKET_TIMEOUT_PARAM *ttparam; -#endif //UNIX_SOLARIS - - // Validate arguments - if (sock == NULL) - { - Debug("StartSSL Error: #0\n"); - return false; - } - if (sock->Connected && sock->Type == SOCK_INPROC && sock->ListenMode == false) - { - sock->SecureMode = true; - return true; - } - if (sock->Connected == false || sock->socket == INVALID_SOCKET || - sock->ListenMode != false) - { - Debug("StartSSL Error: #1\n"); - return false; - } - if (x != NULL && priv == NULL) - { - Debug("StartSSL Error: #2\n"); - return false; - } - if (ssl_timeout == 0) - { - ssl_timeout = TIMEOUT_SSL_CONNECT; - } - - if (sock->SecureMode) - { - //Debug("StartSSL Error: #3\n"); - // SSL communication has already started - return true; - } - - Lock(sock->ssl_lock); - if (sock->SecureMode) - { - //Debug("StartSSL Error: #4\n"); - // SSL communication has already started - Unlock(sock->ssl_lock); - return true; - } - - ssl_ctx = NewSSLCtx(sock->ServerMode); - - Lock(openssl_lock); - { - if (sock->ServerMode) - { -#ifdef SSL_OP_NO_TLSv1 - if (sock->SslAcceptSettings.Tls_Disable1_0) - { - SSL_CTX_set_options(ssl_ctx, SSL_OP_NO_TLSv1); - } -#endif // SSL_OP_NO_TLSv1 - -#ifdef SSL_OP_NO_TLSv1_1 - if (sock->SslAcceptSettings.Tls_Disable1_1) - { - SSL_CTX_set_options(ssl_ctx, SSL_OP_NO_TLSv1_1); - } -#endif // SSL_OP_NO_TLSv1_1 - -#ifdef SSL_OP_NO_TLSv1_2 - if (sock->SslAcceptSettings.Tls_Disable1_2) - { - SSL_CTX_set_options(ssl_ctx, SSL_OP_NO_TLSv1_2); - } -#endif // SSL_OP_NO_TLSv1_2 - -#ifdef SSL_OP_NO_TLSv1_3 - if (sock->SslAcceptSettings.Tls_Disable1_3) - { - SSL_CTX_set_options(ssl_ctx, SSL_OP_NO_TLSv1_3); - } -#endif // SSL_OP_NO_TLSv1_3 - -#if OPENSSL_VERSION_NUMBER >= 0x10100000L && !defined(LIBRESSL_VERSION_NUMBER) - if (sock->SslAcceptSettings.Override_Security_Level) - { - SSL_CTX_set_security_level(ssl_ctx, sock->SslAcceptSettings.Override_Security_Level_Value); - } -#endif - - Unlock(openssl_lock); - AddChainSslCertOnDirectory(ssl_ctx); - Lock(openssl_lock); - } - - sock->ssl = SSL_new(ssl_ctx); - SSL_set_fd(sock->ssl, (int)sock->socket); - -#ifdef SSL_CTRL_SET_TLSEXT_HOSTNAME - if (sock->ServerMode == false) - { - if (IsEmptyStr(sni_hostname) == false) - { - // Set the SNI host name - SSL_set_tlsext_host_name(sock->ssl, sni_hostname); - } - } -#endif // SSL_CTRL_SET_TLSEXT_HOSTNAME - - } - Unlock(openssl_lock); - - if (x != NULL) - { - // Check the certificate and the private key - if (CheckXandK(x, priv)) - { - // Use the certificate - x509 = x->x509; - key = priv->pkey; - - Lock(openssl_lock); - { - SSL_use_certificate(sock->ssl, x509); - SSL_use_PrivateKey(sock->ssl, key); - } - Unlock(openssl_lock); - } - } - - if (sock->WaitToUseCipher != NULL) - { - // Set the cipher algorithm name to want to use - Lock(openssl_lock); - { - if (SSL_set_cipher_list(sock->ssl, sock->WaitToUseCipher) == 0) - SSL_set_cipher_list(sock->ssl, DEFAULT_CIPHER_LIST); - } - Unlock(openssl_lock); - } - - if (sock->ServerMode) - { -// Lock(ssl_connect_lock); - -// Run the time-out thread for SOLARIS -#ifdef UNIX_SOLARIS - ttparam = NewSocketTimeout(sock); -#endif // UNIX_SOLARIS - - // Server mode - if (SSL_accept(sock->ssl) <= 0) - { - -// Stop the timeout thread -#ifdef UNIX_SOLARIS - FreeSocketTimeout(ttparam); -#endif // UNIX_SOLARIS - - // Unlock(ssl_connect_lock); - // SSL-Accept failure - Lock(openssl_lock); - { - SSL_free(sock->ssl); - sock->ssl = NULL; - } - Unlock(openssl_lock); - - Unlock(sock->ssl_lock); - Debug("StartSSL Error: #5\n"); - FreeSSLCtx(ssl_ctx); - return false; - } - -#ifdef SSL_CTRL_SET_TLSEXT_HOSTNAME -#ifdef TLSEXT_NAMETYPE_host_name - if (true) - { - // Get the SNI host name - const char *sni_recv_hostname = SSL_get_servername(sock->ssl, TLSEXT_NAMETYPE_host_name); - - if (IsEmptyStr((char *)sni_recv_hostname) == false) - { - StrCpy(sock->SniHostname, sizeof(sock->SniHostname), (char *)sni_recv_hostname); - } - } -#endif // TLSEXT_NAMETYPE_host_name -#endif // SSL_CTRL_SET_TLSEXT_HOSTNAME - -// Stop the timeout thread -#ifdef UNIX_SOLARIS - FreeSocketTimeout(ttparam); -#endif // UNIX_SOLARIS - - // Unlock(ssl_connect_lock); - } - else - { - prev_timeout = GetTimeout(sock); - SetTimeout(sock, ssl_timeout); - Lock(ssl_connect_lock); - // Client mode - if (SSL_connect(sock->ssl) <= 0) - { - Unlock(ssl_connect_lock); - // SSL-connect failure - Lock(openssl_lock); - { - SSL_free(sock->ssl); - sock->ssl = NULL; - } - Unlock(openssl_lock); - - Unlock(sock->ssl_lock); - Debug("StartSSL Error: #5\n"); - SetTimeout(sock, prev_timeout); - FreeSSLCtx(ssl_ctx); - return false; - } - Unlock(ssl_connect_lock); - SetTimeout(sock, prev_timeout); - } - - // SSL communication is initiated - sock->SecureMode = true; - - // Get the certificate of the remote host - Lock(openssl_lock); - { - x509 = SSL_get_peer_certificate(sock->ssl); - - sock->SslVersion = SSL_get_version(sock->ssl); - } - Unlock(openssl_lock); - - if (x509 == NULL) - { - // The certificate does not exist on the remote host - sock->RemoteX = NULL; - } - else - { - // Got a certificate - sock->RemoteX = X509ToX(x509); - } - - // Get the certificate of local host - Lock(openssl_lock); - { - x509 = SSL_get_certificate(sock->ssl); - } - Unlock(openssl_lock); - - if (x509 == NULL) - { - // The certificate does not exist on the remote host - sock->LocalX = NULL; - } - else - { - X *local_x; - // Got a certificate - local_x = X509ToX(x509); - local_x->do_not_free = true; - sock->LocalX = CloneX(local_x); - FreeX(local_x); - } - - // Automatic retry mode - SSL_set_mode(sock->ssl, SSL_MODE_AUTO_RETRY); - - // Strange flag - SSL_set_mode(sock->ssl, SSL_MODE_ACCEPT_MOVING_WRITE_BUFFER); - - sock->ssl_ctx = ssl_ctx; - - // Get the algorithm name used to encrypt - Lock(openssl_lock); - { - sock->CipherName = CopyStr((char *)SSL_get_cipher(sock->ssl)); - } - Unlock(openssl_lock); - - Unlock(sock->ssl_lock); - -#ifdef ENABLE_SSL_LOGGING - if (sock->ServerMode) - { - SockEnableSslLogging(sock); - } -#endif // ENABLE_SSL_LOGGING - - return true; -} - - - -#ifdef ENABLE_SSL_LOGGING - -// Enable SSL logging -void SockEnableSslLogging(SOCK *s) -{ - char dirname[MAX_PATH]; - char tmp[MAX_PATH]; - char dtstr[MAX_PATH]; - char fn1[MAX_PATH], fn2[MAX_PATH]; - // Validate arguments - if (s == NULL) - { - return; - } - - if (s->IsSslLoggingEnabled) - { - return; - } - - s->IsSslLoggingEnabled = true; - - GetDateTimeStrMilli64ForFileName(dtstr, sizeof(dtstr), LocalTime64()); - Format(tmp, sizeof(tmp), "%s__%r_%u__%r_%u", dtstr, - &s->LocalIP, s->LocalPort, &s->RemoteIP, s->RemotePort); - - CombinePath(dirname, sizeof(dirname), SSL_LOGGING_DIRNAME, tmp); - - MakeDirEx(dirname); - - CombinePath(fn1, sizeof(fn1), dirname, "send.c"); - CombinePath(fn2, sizeof(fn2), dirname, "recv.c"); - - s->SslLogging_Send = FileCreate(fn1); - s->SslLogging_Recv = FileCreate(fn2); - - s->SslLogging_Lock = NewLock(); -} - -// Close SSL logging -void SockCloseSslLogging(SOCK *s) -{ - // Validate arguments - if (s == NULL) - { - return; - } - - if (s->IsSslLoggingEnabled == false) - { - return; - } - - s->IsSslLoggingEnabled = false; - - FileClose(s->SslLogging_Recv); - s->SslLogging_Recv = NULL; - - FileClose(s->SslLogging_Send); - s->SslLogging_Send = NULL; - - DeleteLock(s->SslLogging_Lock); - s->SslLogging_Lock = NULL; -} - -// Write SSL log -void SockWriteSslLog(SOCK *s, void *send_data, UINT send_size, void *recv_data, UINT recv_size) -{ - // Validate arguments - if (s == NULL) - { - return; - } - - if (s->IsSslLoggingEnabled == false) - { - return; - } - - Lock(s->SslLogging_Lock); - { - if (s->SslLogging_Send != NULL) - { - if (send_size >= 1 && send_data != NULL) - { - FileWrite(s->SslLogging_Send, send_data, send_size); - } - } - - if (s->SslLogging_Recv != NULL) - { - if (recv_size >= 1 && recv_data != NULL) - { - FileWrite(s->SslLogging_Recv, recv_data, recv_size); - } - } - } - Unlock(s->SslLogging_Lock); -} - -#endif // ENABLE_SSL_LOGGING - -// Set the flag to indicate that the socket doesn't require reading -void SetNoNeedToRead(SOCK *sock) -{ - // Validate arguments - if (sock == NULL) - { - return; - } - - sock->NoNeedToRead = true; -} - -// TCP-SSL receive -UINT SecureRecv(SOCK *sock, void *data, UINT size) -{ - int ret, e = SSL_ERROR_NONE; - SSL *ssl; - -#ifdef UNIX_SOLARIS - SOCKET_TIMEOUT_PARAM *ttparam; -#endif //UNIX_SOLARIS - - ssl = sock->ssl; - - if (sock->AsyncMode) - { - // Confirm whether the data is readable even 1 byte in the case of asynchronous mode. - // To read data results blocking, if there is no readable data. - // We must avoid blocking. - char c; - Lock(sock->ssl_lock); - { - if (sock->Connected == false) - { - Unlock(sock->ssl_lock); - Debug("%s %u SecureRecv() Disconnect\n", __FILE__, __LINE__); - return 0; - } - ret = SSL_peek(ssl, &c, sizeof(c)); - } - Unlock(sock->ssl_lock); - if (ret == 0) - { - // The communication have been disconnected - Disconnect(sock); - Debug("%s %u SecureRecv() Disconnect\n", __FILE__, __LINE__); - return 0; - } - if (ret < 0) - { - // An error has occurred - e = SSL_get_error(ssl, ret); - if (e == SSL_ERROR_WANT_READ || e == SSL_ERROR_WANT_WRITE || e == SSL_ERROR_SSL) - { - if (e == SSL_ERROR_SSL -#if OPENSSL_VERSION_NUMBER < 0x10100000L - && - sock->ssl->s3->send_alert[0] == SSL3_AL_FATAL && - sock->ssl->s3->send_alert[0] != sock->Ssl_Init_Async_SendAlert[0] && - sock->ssl->s3->send_alert[1] != sock->Ssl_Init_Async_SendAlert[1] -#endif - ) - { - Debug("%s %u SSL Fatal Error on ASYNC socket !!!\n", __FILE__, __LINE__); - Disconnect(sock); - return 0; - } - // Packet has not arrived yet, that is not to be read - return SOCK_LATER; - } - } - } - - // Receive - Lock(sock->ssl_lock); - { - if (sock->Connected == false) - { - Unlock(sock->ssl_lock); - Debug("%s %u SecureRecv() Disconnect\n", __FILE__, __LINE__); - return 0; - } - -#ifdef OS_UNIX - if (sock->AsyncMode == false) - { - sock->CallingThread = pthread_self(); - } -#endif // OS_UNIX - -// Run the time-out thread for SOLARIS -#ifdef UNIX_SOLARIS - ttparam = NewSocketTimeout(sock); -#endif // UNIX_SOLARIS - - ret = SSL_read(ssl, data, size); - -// Stop the timeout thread -#ifdef UNIX_SOLARIS - FreeSocketTimeout(ttparam); -#endif // UNIX_SOLARIS - - -#ifdef OS_UNIX - if (sock->AsyncMode == false) - { - sock->CallingThread = 0; - } -#endif // OS_UNIX - - if (ret < 0) - { - e = SSL_get_error(ssl, ret); - } - - } - Unlock(sock->ssl_lock); - -#ifdef ENABLE_SSL_LOGGING - if (ret > 0) - { - SockWriteSslLog(sock, NULL, 0, data, ret); - } -#endif // ENABLE_SSL_LOGGING - - if (ret > 0) - { - // Successful reception - sock->RecvSize += (UINT64)ret; - sock->RecvNum++; - - return (UINT)ret; - } - if (ret == 0) - { - // Disconnect the communication - Disconnect(sock); - //Debug("%s %u SecureRecv() Disconnect\n", __FILE__, __LINE__); - return 0; - } - if (sock->AsyncMode) - { - if (e == SSL_ERROR_WANT_READ || e == SSL_ERROR_WANT_WRITE || e == SSL_ERROR_SSL) - { - if (e == SSL_ERROR_SSL -#if OPENSSL_VERSION_NUMBER < 0x10100000L - && - sock->ssl->s3->send_alert[0] == SSL3_AL_FATAL && - sock->ssl->s3->send_alert[0] != sock->Ssl_Init_Async_SendAlert[0] && - sock->ssl->s3->send_alert[1] != sock->Ssl_Init_Async_SendAlert[1] -#endif - ) - { - Debug("%s %u SSL Fatal Error on ASYNC socket !!!\n", __FILE__, __LINE__); - Disconnect(sock); - return 0; - } - - // Packet has not yet arrived - return SOCK_LATER; - } - } - Disconnect(sock); - Debug("%s %u SecureRecv() Disconnect\n", __FILE__, __LINE__); - return 0; -} - -// TCP-SSL transmission -UINT SecureSend(SOCK *sock, void *data, UINT size) -{ - int ret, e = SSL_ERROR_NONE; - SSL *ssl; - ssl = sock->ssl; - - if (sock->AsyncMode) - { - // Asynchronous mode - SSL_set_mode(ssl, SSL_MODE_ENABLE_PARTIAL_WRITE); - } - - // Transmission - Lock(sock->ssl_lock); - { - if (sock->Connected == false) - { - Unlock(sock->ssl_lock); - Debug("%s %u SecureSend() Disconnect\n", __FILE__, __LINE__); - return 0; - } - - ret = SSL_write(ssl, data, size); - if (ret < 0) - { - e = SSL_get_error(ssl, ret); - } - } - Unlock(sock->ssl_lock); - -#ifdef ENABLE_SSL_LOGGING - if (ret > 0) - { - SockWriteSslLog(sock, data, ret, NULL, 0); - } -#endif // ENABLE_SSL_LOGGING - - if (ret > 0) - { - // Successful transmission - sock->SendSize += (UINT64)ret; - sock->SendNum++; - sock->WriteBlocked = false; - return (UINT)ret; - } - if (ret == 0) - { - // Disconnect - Debug("%s %u SecureSend() Disconnect\n", __FILE__, __LINE__); - Disconnect(sock); - return 0; - } - - if (sock->AsyncMode) - { - // Confirmation of the error value - if (e == SSL_ERROR_WANT_READ || e == SSL_ERROR_WANT_WRITE || e == SSL_ERROR_SSL) - { - sock->WriteBlocked = true; - return SOCK_LATER; - } - Debug("%s %u e=%u\n", __FILE__, __LINE__, e); - } - //Debug("%s %u SecureSend() Disconnect\n", __FILE__, __LINE__); - Disconnect(sock); - return 0; -} - -// Peep the TCP -UINT Peek(SOCK *sock, void *data, UINT size) -{ - SOCKET s; - int ret; - - // Validate arguments - if (sock == NULL || data == NULL || size == 0) - { - return 0; - } - if (sock->Type == SOCK_INPROC) - { - return 0; - } - if (sock->Type != SOCK_TCP || sock->Connected == false || sock->ListenMode != false || - sock->socket == INVALID_SOCKET) - { - return 0; - } - if (sock->AsyncMode) - { - return 0; - } - - // Receive - s = sock->socket; - - ret = recv(s, data, size, MSG_PEEK); - - //Debug("Peek: %u\n", ret); - - if (ret > 0) - { - return ret; - } - - return 0; -} - -// TCP receive -UINT Recv(SOCK *sock, void *data, UINT size, bool secure) -{ - SOCKET s; - int ret; - -#ifdef UNIX_SOLARIS - SOCKET_TIMEOUT_PARAM *ttparam; -#endif //UNIX_SOLARIS - - // Validate arguments - if (sock == NULL || data == NULL || size == 0) - { - return 0; - } - - sock->NoNeedToRead = false; - - if (sock->Type == SOCK_INPROC) - { - return RecvInProc(sock, data, size); - } - if (sock->Type != SOCK_TCP || sock->Connected == false || sock->ListenMode != false || - sock->socket == INVALID_SOCKET) - { - return 0; - } - if (secure != false && sock->SecureMode == false) - { - return 0; - } - - if (secure) - { - return SecureRecv(sock, data, size); - } - - // Receive - s = sock->socket; - - -#ifdef OS_UNIX - if (sock->AsyncMode == false) - { - sock->CallingThread = pthread_self(); - } -#endif // OS_UNIX - -// Start of the timeout thread for SOLARIS -#ifdef UNIX_SOLARIS - ttparam = NewSocketTimeout(sock); -#endif // UNIX_SOLARIS - - ret = recv(s, data, size, 0); - -// Stop the timeout thread -#ifdef UNIX_SOLARIS - FreeSocketTimeout(ttparam); -#endif // UNIX_SOLARIS - -#ifdef OS_UNIX - if (sock->AsyncMode == false) - { - sock->CallingThread = 0; - } -#endif // OS_UNIX - - if (ret > 0) - { - // Successful reception - Lock(sock->lock); - { - sock->RecvSize += (UINT64)ret; - sock->SendNum++; - } - Unlock(sock->lock); - return (UINT)ret; - } - - // Transmission failure - if (sock->AsyncMode) - { - // In asynchronous mode, examine the error - if (ret == SOCKET_ERROR) - { -#ifdef OS_WIN32 - if (WSAGetLastError() == WSAEWOULDBLOCK) - { - // In blocking - return SOCK_LATER; - } - else - { - //Debug("Socket Error: %u\n", WSAGetLastError()); - } -#else // OS_WIN32 - if (errno == EAGAIN) - { - // In blocking - return SOCK_LATER; - } -#endif // OS_WIN32 - } - } - - // Disconnected - Disconnect(sock); - return 0; -} - -// TCP transmission -UINT Send(SOCK *sock, void *data, UINT size, bool secure) -{ - SOCKET s; - int ret; - // Validate arguments - if (sock == NULL || data == NULL || size == 0) - { - return 0; - } - if (sock->Type == SOCK_INPROC) - { - return SendInProc(sock, data, size); - } - size = MIN(size, MAX_SEND_BUF_MEM_SIZE); - if (sock->Type != SOCK_TCP || sock->Connected == false || sock->ListenMode != false || - sock->socket == INVALID_SOCKET) - { - return 0; - } - if (secure != false && sock->SecureMode == false) - { - return 0; - } - - if (secure) - { - return SecureSend(sock, data, size); - } - - // Transmission - s = sock->socket; - ret = send(s, data, size, 0); - if (ret > 0) - { - // Successful transmission - Lock(sock->lock); - { - sock->SendSize += (UINT64)ret; - sock->SendNum++; - } - Unlock(sock->lock); - sock->WriteBlocked = false; - return (UINT)ret; - } - - // Transmission failure - if (sock->AsyncMode) - { - // In asynchronous mode, examine the error - if (ret == SOCKET_ERROR) - { -#ifdef OS_WIN32 - if (WSAGetLastError() == WSAEWOULDBLOCK) - { - // In blocking - sock->WriteBlocked = true; - return SOCK_LATER; - } - else - { - //Debug("Socket Error: %u\n", WSAGetLastError()); - } -#else // OS_WIN32 - if (errno == EAGAIN) - { - // In blocking - sock->WriteBlocked = true; - return SOCK_LATER; - } -#endif // OS_WIN32 - } - } - - // Disconnected - Disconnect(sock); - return 0; -} - -// Get the time-out value (in milliseconds) -UINT GetTimeout(SOCK *sock) -{ - // Validate arguments - if (sock == NULL) - { - return INFINITE; - } - if (sock->Type != SOCK_TCP && sock->Type != SOCK_INPROC) - { - return INFINITE; - } - - return sock->TimeOut; -} - -// Setting the time-out value (in milliseconds) -void SetTimeout(SOCK *sock, UINT timeout) -{ - // Validate arguments - if (sock == NULL) - { - return; - } - if (sock->Type == SOCK_UDP) - { - return; - } - - if (timeout == INFINITE) - { - timeout = TIMEOUT_INFINITE; - } - - sock->TimeOut = timeout; - -// Debug("SetTimeout(%u)\n",timeout); - - if (sock->Type != SOCK_INPROC) - { -#ifdef OS_WIN32 - setsockopt(sock->socket, SOL_SOCKET, SO_SNDTIMEO, (char *)&timeout, sizeof(UINT)); - setsockopt(sock->socket, SOL_SOCKET, SO_RCVTIMEO, (char *)&timeout, sizeof(UINT)); -#endif - -#ifdef OS_UNIX -#ifndef UNIX_SOLARIS - { - struct timeval tv_timeout; - - tv_timeout.tv_sec = timeout / 1000; // miliseconds to seconds - tv_timeout.tv_usec = (timeout % 1000) * 1000; // miliseconds to microseconds - - (void)setsockopt(sock->socket, SOL_SOCKET, SO_SNDTIMEO, (char *)&tv_timeout, sizeof(tv_timeout)); - (void)setsockopt(sock->socket, SOL_SOCKET, SO_RCVTIMEO, (char *)&tv_timeout, sizeof(tv_timeout)); - } -#endif // UNIX_SOLARIS -#endif // OS_UNIX - } -} - -// Disable GetHostName call by accepting new TCP connection -void DisableGetHostNameWhenAcceptInit() -{ - disable_gethostname_by_accept = true; -} - -// Initialize the connection acceptance -void AcceptInit(SOCK *s) -{ - AcceptInitEx(s, false); -} -void AcceptInitEx(SOCK *s, bool no_lookup_hostname) -{ - char tmp[MAX_SIZE]; - // Validate arguments - if (s == NULL) - { - return; - } - - Zero(tmp, sizeof(tmp)); - - if (disable_gethostname_by_accept == false && no_lookup_hostname == false) - { - if (GetHostName(tmp, sizeof(tmp), &s->RemoteIP) == false || - IsEmptyStr(tmp)) - { - IPToStr(tmp, sizeof(tmp), &s->RemoteIP); - } - } - else - { - IPToStr(tmp, sizeof(tmp), &s->RemoteIP); - } - - if (s->RemoteHostname != NULL) - { - Free(s->RemoteHostname); - } - - s->RemoteHostname = CopyStr(tmp); -} - -// TCP connection acceptance (IPv4) -SOCK *Accept(SOCK *sock) -{ - SOCK *ret; - SOCKET s, new_socket; - int size; - struct sockaddr_in addr; - bool true_flag = true; - // Validate arguments - if (sock == NULL) - { - return NULL; - } - if (sock->Type == SOCK_INPROC) - { - return AcceptInProc(sock); - } - if (sock->Type == SOCK_REVERSE_LISTEN) - { - return AcceptReverse(sock); - } - if (sock->Type == SOCK_RUDP_LISTEN) - { - return AcceptRUDP(sock); - } - if (sock->ListenMode == false || sock->Type != SOCK_TCP || sock->ServerMode == false) - { - return NULL; - } - if (sock->CancelAccept) - { - return NULL; - } - if (sock->IPv6) - { - return Accept6(sock); - } - - s = sock->socket; - if (s == INVALID_SOCKET) - { - return NULL; - } - Zero(&addr, sizeof(addr)); - size = sizeof(addr); - -#ifdef OS_UNIX -#if defined(UNIX_LINUX) || defined(UNIX_MACOS) - UnixIgnoreSignalForThread(SIGUSR1); -#endif // defined(UNIX_LINUX) || defined(UNIX_MACOS) - sock->CallingThread = pthread_self(); -#endif // OS_UNIX - -#ifdef OS_WIN32 - if (sock->EnableConditionalAccept) - { - new_socket = Win32Accept(sock, s, (struct sockaddr *)&addr,(int *)&size, false); - } - else - { - new_socket = accept(s, (struct sockaddr *)&addr,(int *)&size); - } -#else // OS_WIN32 - new_socket = accept(s, (struct sockaddr *)&addr,(int *)&size); -#endif // OS_WIN32 - -#ifdef OS_UNIX - sock->CallingThread = 0; -#endif // OS_UNIX - - if (new_socket == INVALID_SOCKET) - { - if (sock->CancelAccept) - { - sock->AcceptCanceled = true; - } - return NULL; - } - if (sock->CancelAccept) - { - sock->AcceptCanceled = true; - closesocket(new_socket); - return NULL; - } - - ret = NewSock(); - ret->socket = new_socket; - ret->Connected = true; - ret->AsyncMode = false; - ret->Type = SOCK_TCP; - ret->ServerMode = true; - ret->SecureMode = false; - - // Configuring the TCP options - (void)setsockopt(ret->socket, IPPROTO_TCP, TCP_NODELAY, (char *)&true_flag, sizeof(bool)); - - // Initialization of the time-out value - SetTimeout(ret, TIMEOUT_INFINITE); - - // Socket information - QuerySocketInformation(ret); - - if (IsLocalHostIP(&ret->RemoteIP) == false) - { - ret->IpClientAdded = true; - AddIpClient(&ret->RemoteIP); - } - - if (IsZeroIp(&sock->LocalIP) == false && IsLocalHostIP(&sock->LocalIP) == false) - { - IP current_ip; - - if (GetCurrentGlobalIP(¤t_ip, false) == false) - { - SetCurrentGlobalIP(&sock->LocalIP, false); - } - } - - StrCpy(ret->UnderlayProtocol, sizeof(ret->UnderlayProtocol), SOCK_UNDERLAY_NATIVE_V4); - - AddProtocolDetailsStr(ret->ProtocolDetails, sizeof(ret->ProtocolDetails), "IPv4"); - - return ret; -} - -// TCP connection acceptance (IPv6) -SOCK *Accept6(SOCK *sock) -{ - SOCK *ret; - SOCKET s, new_socket; - int size; - struct sockaddr_in6 addr; - bool true_flag = true; - // Validate arguments - if (sock == NULL) - { - return NULL; - } - if (sock->ListenMode == false || sock->Type != SOCK_TCP || sock->ServerMode == false) - { - return NULL; - } - if (sock->CancelAccept) - { - return NULL; - } - if (sock->IPv6 == false) - { - return NULL; - } - - s = sock->socket; - if (s == INVALID_SOCKET) - { - return NULL; - } - Zero(&addr, sizeof(addr)); - size = sizeof(addr); - -#ifdef OS_UNIX -#if defined(UNIX_LINUX) || defined(UNIX_MACOS) - UnixIgnoreSignalForThread(SIGUSR1); -#endif // defined(UNIX_LINUX) || defined(UNIX_MACOS) - sock->CallingThread = pthread_self(); -#endif // OS_UNIX - -#ifdef OS_WIN32 - if (sock->EnableConditionalAccept) - { - new_socket = Win32Accept(sock, s, (struct sockaddr *)&addr,(int *)&size, true); - } - else - { - new_socket = accept(s, (struct sockaddr *)&addr,(int *)&size); - } -#else // OS_WIN32 - new_socket = accept(s, (struct sockaddr *)&addr,(int *)&size); -#endif // OS_WIN32 - -#ifdef OS_UNIX - sock->CallingThread = 0; -#endif // OS_UNIX - - if (new_socket == INVALID_SOCKET) - { - if (sock->CancelAccept) - { - sock->AcceptCanceled = true; - } - return NULL; - } - if (sock->CancelAccept) - { - sock->AcceptCanceled = true; - closesocket(new_socket); - return NULL; - } - - ret = NewSock(); - ret->socket = new_socket; - ret->Connected = true; - ret->AsyncMode = false; - ret->Type = SOCK_TCP; - ret->ServerMode = true; - ret->SecureMode = false; - - // Configuring the TCP options - (void)setsockopt(ret->socket, IPPROTO_TCP, TCP_NODELAY, (char *)&true_flag, sizeof(bool)); - - // Initialize the time-out value - SetTimeout(ret, TIMEOUT_INFINITE); - - // Socket information - QuerySocketInformation(ret); - - if (IsLocalHostIP(&ret->RemoteIP) == false) - { - ret->IpClientAdded = true; - AddIpClient(&ret->RemoteIP); - } - if (IsZeroIp(&sock->LocalIP) == false && IsLocalHostIP(&sock->LocalIP) == false) - { - IP current_ip; - - if (GetCurrentGlobalIP(¤t_ip, true) == false) - { - SetCurrentGlobalIP(&sock->LocalIP, true); - } - } - - StrCpy(ret->UnderlayProtocol, sizeof(ret->UnderlayProtocol), SOCK_UNDERLAY_NATIVE_V6); - - AddProtocolDetailsStr(ret->ProtocolDetails, sizeof(ret->ProtocolDetails), "IPv6"); - - return ret; -} - -// Standby for TCP (IPv6) -SOCK *ListenEx6(UINT port, bool local_only) -{ - return ListenEx62(port, local_only, false); -} -SOCK *ListenEx62(UINT port, bool local_only, bool enable_ca) -{ - SOCKET s; - SOCK *sock; - struct sockaddr_in6 addr; - struct in6_addr in; - bool true_flag = true; - IP localhost; - UINT backlog = SOMAXCONN; - // Validate arguments - if (port == 0 || port >= 65536) - { - return NULL; - } - -#ifdef OS_WIN32 - if (MsIsVista() == false) - { - // Disable the Conditional Accept due to a bug in Windows - enable_ca = false; - } -#endif // OS_WIN32 - - // Initialization - Zero(&addr, sizeof(addr)); - Zero(&in, sizeof(in)); - GetLocalHostIP6(&localhost); - - addr.sin6_port = htons((UINT)port); - addr.sin6_family = AF_INET6; - - if (local_only) - { - IPToInAddr6(&addr.sin6_addr, &localhost); - - enable_ca = false; - } - - // Creating a socket - s = socket(AF_INET6, SOCK_STREAM, 0); - if (s == INVALID_SOCKET) - { - return NULL; - } - -#ifdef OS_UNIX - // It is necessary to set the IPv6 Only flag on a UNIX system - (void)setsockopt(s, IPPROTO_IPV6, IPV6_V6ONLY, &true_flag, sizeof(true_flag)); -#endif // OS_UNIX - -#ifdef OS_UNIX - // This only have enabled for UNIX system since there is a bug - // in the implementation of REUSEADDR in Windows OS - (void)setsockopt(s, SOL_SOCKET, SO_REUSEADDR, (char *)&true_flag, sizeof(bool)); -#endif // OS_UNIX - - if (bind(s, (struct sockaddr *)&addr, sizeof(struct sockaddr_in6)) != 0) - { - // Bind failure - closesocket(s); - return NULL; - } - -#ifdef OS_WIN32 - if (enable_ca) - { - if (MsIsWinXPOrGreater()) - { - setsockopt(s, SOL_SOCKET, SO_CONDITIONAL_ACCEPT, (char *)&true_flag, sizeof(bool)); - - backlog = 1; - } - } -#endif // OS_WIN32 - - if (listen(s, backlog)) - { - // Listen failure - closesocket(s); - return NULL; - } - - // Success - sock = NewSock(); - sock->Connected = false; - sock->AsyncMode = false; - sock->ServerMode = true; - sock->Type = SOCK_TCP; - sock->socket = s; - sock->ListenMode = true; - sock->SecureMode = false; - sock->LocalPort = port; - sock->IPv6 = true; - sock->LocalOnly = local_only; - sock->EnableConditionalAccept = enable_ca; - - return sock; -} - -// Standby for the TCP -SOCK *Listen(UINT port) -{ - return ListenEx(port, false); -} -SOCK *ListenEx(UINT port, bool local_only) -{ - return ListenEx2(port, local_only, false, NULL); -} -SOCK *ListenEx2(UINT port, bool local_only, bool enable_ca, IP *listen_ip) -{ - SOCKET s; - SOCK *sock; - struct sockaddr_in addr; - struct in_addr in; - bool true_flag = true; - IP localhost; - UINT backlog = SOMAXCONN; - // Validate arguments - if (port == 0 || port >= 65536) - { - return NULL; - } - -#ifdef OS_WIN32 - if (MsIsVista() == false) - { - // Disable the Conditional Accept due to a bug in Windows - enable_ca = false; - } -#endif // OS_WIN32 - - // Initialization - Zero(&addr, sizeof(addr)); - Zero(&in, sizeof(in)); - SetIP(&localhost, 127, 0, 0, 1); - - addr.sin_port = htons((UINT)port); - if (listen_ip == NULL) - { - *((UINT *)&addr.sin_addr) = htonl(INADDR_ANY); - } - else - { - IPToInAddr(&addr.sin_addr, listen_ip); - } - addr.sin_family = AF_INET; - - if (local_only) - { - IPToInAddr(&addr.sin_addr, &localhost); - - enable_ca = false; - } - - // Creating a socket - s = socket(AF_INET, SOCK_STREAM, 0); - if (s == INVALID_SOCKET) - { - return NULL; - } - -#ifdef OS_UNIX - // This only have enabled for UNIX system since there is a bug - // in the implementation of REUSEADDR in Windows OS - (void)setsockopt(s, SOL_SOCKET, SO_REUSEADDR, (char *)&true_flag, sizeof(bool)); -#endif // OS_UNIX - - if (bind(s, (struct sockaddr *)&addr, sizeof(struct sockaddr_in)) != 0) - { - // Bind failure - closesocket(s); - return NULL; - } - -#ifdef OS_WIN32 - if (enable_ca) - { - if (MsIsWinXPOrGreater()) - { - setsockopt(s, SOL_SOCKET, SO_CONDITIONAL_ACCEPT, (char *)&true_flag, sizeof(bool)); - - backlog = 1; - } - } -#endif // OS_WIN32 - - if (listen(s, backlog)) - { - // Listen failure - closesocket(s); - return NULL; - } - - // Success - sock = NewSock(); - sock->Connected = false; - sock->AsyncMode = false; - sock->ServerMode = true; - sock->Type = SOCK_TCP; - sock->socket = s; - sock->ListenMode = true; - sock->SecureMode = false; - sock->LocalPort = port; - sock->LocalOnly = local_only; - sock->EnableConditionalAccept = enable_ca; - - return sock; -} - -// TCP disconnect -void Disconnect(SOCK *sock) -{ - SOCKET s; - bool true_flag = true; - bool false_flag = false; - // Validate arguments - if (sock == NULL) - { - return; - } - - sock->Disconnecting = true; - -#ifdef ENABLE_SSL_LOGGING - SockCloseSslLogging(sock); -#endif // ENABLE_SSL_LOGGING - -#ifdef OS_UNIX - UnixFreeAsyncSocket(sock); -#endif // UnixFreeAsyncSocket - - if (sock->Type == SOCK_TCP && sock->ListenMode) - { - bool no_tcp_check_port = false; - - // Connect to localhost if the socket is in listening - sock->CancelAccept = true; - -#if defined(UNIX_LINUX) || defined(UNIX_MACOS) - { - pthread_t t = sock->CallingThread; - - // Send a signal to the socket to abort accept() forcibly on Linux - if (t != 0) - { - pthread_kill(t, SIGUSR1); - - SleepThread(200); - } - } -#endif // defined(UNIX_LINUX) || defined(UNIX_MACOS) - -#ifdef OS_WIN32 - if (sock->hAcceptEvent != NULL) - { - SetEvent(sock->hAcceptEvent); - - no_tcp_check_port = true; - } -#endif // OS_WIN32 - - if (sock->AcceptCanceled == false) - { - if (no_tcp_check_port == false) - { - if (sock->IPv6 == false) - { - CheckTCPPort("127.0.0.1", sock->LocalPort); - } - else - { - CheckTCPPort("::1", sock->LocalPort); - } - } - } - } - - Lock(disconnect_function_lock); - - Lock(sock->disconnect_lock); - - if (sock->Type == SOCK_TCP) - { - if (sock->socket != INVALID_SOCKET) - { - // Forced disconnection flag -#ifdef SO_DONTLINGER - (void)setsockopt(sock->socket, SOL_SOCKET, SO_DONTLINGER, (char *)&true_flag, sizeof(bool)); -#else // SO_DONTLINGER - (void)setsockopt(sock->socket, SOL_SOCKET, SO_LINGER, (char *)&false_flag, sizeof(bool)); -#endif // SO_DONTLINGER -// setsockopt(sock->socket, SOL_SOCKET, SO_REUSEADDR, (char *)&true_flag, sizeof(bool)); - } - - // TCP socket - Lock(sock->lock); - { - if (sock->socket == INVALID_SOCKET) - { - Unlock(sock->lock); - Unlock(sock->disconnect_lock); - Unlock(disconnect_function_lock); - return; - } - s = sock->socket; - - if (sock->Connected) - { - struct linger ling; - Zero(&ling, sizeof(ling)); - - -#if 0 - // SSL disconnect - Lock(sock->ssl_lock); - { - if (sock->SecureMode) - { - SSL_shutdown(sock->ssl); - } - } - Unlock(sock->ssl_lock); -#endif - // Disconnect - shutdown(s, 2); - } - - // Close the socket - closesocket(s); - -#ifdef OS_UNIX -#ifdef FIX_SSL_BLOCKING - if (sock->CallingThread != NULL) - { - pthread_kill(sock->CallingThread, 64); - } -#endif // FIX_SSL_BLOCKING -#endif // OS_UNIX - - // Release the SSL - Lock(sock->ssl_lock); - { - if (sock->SecureMode) - { - if (sock->ssl != NULL) - { - Lock(openssl_lock); - { - SSL_free(sock->ssl); - FreeSSLCtx(sock->ssl_ctx); - } - Unlock(openssl_lock); - sock->ssl = NULL; - sock->ssl_ctx = NULL; - } - sock->Connected = false; - sock->SecureMode = false; - } - } - Unlock(sock->ssl_lock); - - // Initialization - sock->socket = INVALID_SOCKET; - sock->Type = 0; - sock->AsyncMode = false; - sock->Connected = false; - sock->ListenMode = false; - sock->SecureMode = false; - - if (sock->IpClientAdded) - { - DelIpClient(&sock->RemoteIP); - sock->IpClientAdded = false; - } - } - Unlock(sock->lock); - - if (sock->BulkSendTube != NULL) - { - TubeDisconnect(sock->BulkSendTube); - } - - if (sock->BulkRecvTube != NULL) - { - TubeDisconnect(sock->BulkRecvTube); - } - } - else if (sock->Type == SOCK_UDP) - { - // UDP socket - Lock(sock->lock); - { - if (sock->socket == INVALID_SOCKET) - { - Unlock(sock->lock); - Unlock(sock->disconnect_lock); - Unlock(disconnect_function_lock); - return; - } - - s = sock->socket; - - // Close the socket - closesocket(s); - - // Initialization - sock->socket = INVALID_SOCKET; - sock->Type = 0; - sock->AsyncMode = false; - sock->Connected = false; - sock->ListenMode = false; - sock->SecureMode = false; - } - Unlock(sock->lock); - } - else if (sock->Type == SOCK_INPROC) - { - // In-process socket - if (sock->ListenMode) - { - // Stop the Accept process - sock->CancelAccept = true; - - Set(sock->InProcAcceptEvent); - - LockQueue(sock->InProcAcceptQueue); - { - while (true) - { - SOCK *ss = GetNext(sock->InProcAcceptQueue); - if (ss == NULL) - { - break; - } - - Disconnect(ss); - ReleaseSock(ss); - } - } - UnlockQueue(sock->InProcAcceptQueue); - } - else - { - // Disconnect the Tube - TubeDisconnect(sock->SendTube); - TubeDisconnect(sock->RecvTube); - - sock->socket = INVALID_SOCKET; - sock->AsyncMode = false; - sock->Connected = false; - sock->ListenMode = false; - sock->SecureMode = false; - } - } - else if (sock->Type == SOCK_RUDP_LISTEN) - { - // RUDP Listen socket - if (sock->ListenMode) - { - // Stop the Accept process - sock->CancelAccept = true; - - Set(sock->R_UDP_Stack->NewSockConnectEvent); - - sock->R_UDP_Stack->Halt = true; - Set(sock->R_UDP_Stack->HaltEvent); - SetSockEvent(sock->R_UDP_Stack->SockEvent); - } - } - else if (sock->Type == SOCK_REVERSE_LISTEN) - { - // Reverse Listen socket - if (sock->ListenMode) - { - // Stop the Accept process - sock->CancelAccept = true; - - Set(sock->ReverseAcceptEvent); - - LockQueue(sock->ReverseAcceptQueue); - { - while (true) - { - SOCK *ss = GetNext(sock->ReverseAcceptQueue); - if (ss == NULL) - { - break; - } - - Disconnect(ss); - ReleaseSock(ss); - } - } - UnlockQueue(sock->ReverseAcceptQueue); - } - } - Unlock(sock->disconnect_lock); - - Unlock(disconnect_function_lock); -} - -typedef struct TCP_PORT_CHECK -{ - REF *ref; - char hostname[MAX_SIZE]; - UINT port; - bool ok; -} TCP_PORT_CHECK; - -// Check whether the TCP port can be connected -bool CheckTCPPortEx(char *hostname, UINT port, UINT timeout) -{ - SOCK *s; - // Validate arguments - if (hostname == NULL || port == 0 || port >= 65536) - { - return false; - } - - if (timeout == 0) - { - timeout = TIMEOUT_TCP_PORT_CHECK; - } - - s = ConnectEx(hostname, port, timeout); - if (s == NULL) - { - return false; - } - else - { - Disconnect(s); - ReleaseSock(s); - return true; - } -} -bool CheckTCPPort(char *hostname, UINT port) -{ - return CheckTCPPortEx(hostname, port, TIMEOUT_TCP_PORT_CHECK); -} - -#ifdef OS_UNIX -// Connection with timeout (UNIX version) -int connect_timeout(SOCKET s, struct sockaddr *addr, int size, int timeout, bool *cancel_flag) -{ - SOCKSET set; - bool ok = false; - UINT64 start_time; - // Validate arguments - if (s == INVALID_SOCKET || addr == NULL) - { - return -1; - } - if (timeout == 0) - { - timeout = TIMEOUT_TCP_PORT_CHECK; - } - - UnixSetSocketNonBlockingMode(s, true); - - start_time = Tick64(); - - while (true) - { - int ret; - ret = connect(s, addr, size); - if (ret == 0 || errno == EISCONN) - { - ok = true; - break; - } - else - { - if (((start_time + (UINT64)timeout) <= Tick64()) || (errno != EAGAIN && errno != EINPROGRESS && errno != EALREADY)) - { - // Failure - break; - } - else if (*cancel_flag) - { - // Cancel - break; - } - else - { - // Connecting - SleepThread(50); - UnixSelectInner(1, (UINT *)&s, 1, (UINT *)&s, 100); - } - } - } - - UnixSetSocketNonBlockingMode(s, false); - - if (ok) - { - return 0; - } - else - { - return -1; - } -} -#else -// Connection with timeout (Win32 version) -int connect_timeout(SOCKET s, struct sockaddr *addr, int size, int timeout, bool *cancel_flag) -{ - UINT64 start_time; - bool ok = false; - bool timeouted = false; - WSAEVENT hEvent; - UINT zero = 0; - UINT tmp = 0; - UINT ret_size = 0; - bool is_nt = false; - // Validate arguments - if (s == INVALID_SOCKET || addr == NULL) - { - return -1; - } - if (timeout == 0) - { - timeout = TIMEOUT_TCP_PORT_CHECK; - } - - is_nt = OS_IS_WINDOWS_NT(GetOsInfo()->OsType); - - // Create an event - hEvent = CreateEvent(NULL, FALSE, FALSE, NULL); - - // Associate the socket with the event - WSAEventSelect(s, hEvent, FD_CONNECT); - - start_time = Tick64(); - - while (true) - { - int ret; - - ret = connect(s, addr, size); - - if (ret == 0) - { - ok = true; - break; - } - else - { - int err = WSAGetLastError(); - //Debug("err=%u\n", err); - //Debug("cancel_flag=%u\n", *cancel_flag); - if (timeouted && ((err == WSAEALREADY) || (err == WSAEWOULDBLOCK && !is_nt))) - { - // Time-out - ok = false; - break; - } - if (*cancel_flag) - { - // Cancel - ok = false; - break; - } - if (err == WSAEISCONN || (err == WSAEINVAL && is_nt)) - { - ok = true; - break; - } - if (((start_time + (UINT64)timeout) <= Tick64()) || (err != WSAEWOULDBLOCK && err != WSAEALREADY && (is_nt || err != WSAEINVAL))) - { - // Failure (timeout) - break; - } - else - { - SleepThread(10); - // Connecting - if (WaitForSingleObject(hEvent, 100) == WAIT_OBJECT_0) - { - timeouted = true; - } - } - } - } - - // Remove the socket from the event - WSAEventSelect(s, hEvent, 0); - - // Restore to synchronized socket - WSAIoctl(s, FIONBIO, &zero, sizeof(zero), &tmp, sizeof(tmp), &ret_size, NULL, NULL); - - // Close the event - CloseHandle(hEvent); - - if (ok) - { - return 0; - } - else - { - return -1; - } -} -#endif // OS_UNIX - -// Set the TOS value of the socket -void SetSockTos(SOCK *s, int tos) -{ - // Validate arguments - if (s == NULL) - { - return; - } - - if (s->CurrentTos == tos) - { - return; - } - -#ifdef IP_TOS - (void)setsockopt(s->socket, IPPROTO_IP, IP_TOS, (char *)&tos, sizeof(int)); -#endif // IP_TOS - - s->CurrentTos = tos; -} - -// Set the priority of the socket -void SetSockHighPriority(SOCK *s, bool flag) -{ - // Validate arguments - if (s == NULL) - { - return; - } - - SetSockTos(s, (flag ? 16 : 0)); -} - -// Connect to the IPv4 host using a socket -SOCKET ConnectTimeoutIPv4(IP *ip, UINT port, UINT timeout, bool *cancel_flag) -{ - SOCKET s; - struct sockaddr_in sockaddr4; - struct in_addr addr4; - - Zero(&sockaddr4, sizeof(sockaddr4)); - Zero(&addr4, sizeof(addr4)); - - // Generate a sockaddr_in - IPToInAddr(&addr4, ip); - sockaddr4.sin_port = htons((USHORT)port); - sockaddr4.sin_family = AF_INET; - sockaddr4.sin_addr.s_addr = addr4.s_addr; - - // Socket creation - s = socket(AF_INET, SOCK_STREAM, 0); - if (s != INVALID_SOCKET) - { - // Connection - if (connect_timeout(s, (struct sockaddr *)&sockaddr4, sizeof(struct sockaddr_in), timeout, cancel_flag) != 0) - { - // Connection failure - closesocket(s); - s = INVALID_SOCKET; - } - } - - return s; -} - -// Identify whether the HTTPS server to be connected is a SoftEther VPN -bool DetectIsServerSoftEtherVPN(SOCK *s) -{ - HTTP_HEADER *h; - char ip_str[MAX_SIZE]; - char *send_str; - UINT content_len; - BUF *recv_buf; - void *socket_buffer; - UINT socket_buffer_size = 32768; - bool ok = false; - // Validate arguments - if (s == NULL) - { - return false; - } - - IPToStr(ip_str, sizeof(ip_str), &s->RemoteIP); - - // Request generation - h = NewHttpHeaderEx("GET", "/", "HTTP/1.1", true); - AddHttpValue(h, NewHttpValue("X-VPN", "1")); - AddHttpValue(h, NewHttpValue("Host", ip_str)); - AddHttpValue(h, NewHttpValue("Keep-Alive", HTTP_KEEP_ALIVE)); - AddHttpValue(h, NewHttpValue("Connection", "Keep-Alive")); - AddHttpValue(h, NewHttpValue("Accept-Language", "ja")); - AddHttpValue(h, NewHttpValue("User-Agent", DEFAULT_USER_AGENT)); - AddHttpValue(h, NewHttpValue("Pragma", "no-cache")); - AddHttpValue(h, NewHttpValue("Cache-Control", "no-cache")); - - - - send_str = HttpHeaderToStr(h); - FreeHttpHeader(h); - - // Transmission - if (SendAll(s, send_str, StrLen(send_str), true) == false) - { - Free(send_str); - return false; - } - - Free(send_str); - - // Receive - h = RecvHttpHeader(s); - if (h == NULL) - { - return false; - } - - // Get the length of the content - content_len = GetContentLength(h); - FreeHttpHeader(h); - - if (content_len == 0 || content_len >= (1024 * 1024)) - { - return false; - } - - // Receive contents - recv_buf = NewBuf(); - socket_buffer = Malloc(socket_buffer_size); - - while (true) - { - UINT recvsize = MIN(socket_buffer_size, content_len - recv_buf->Size); - UINT size; - - if (recvsize == 0) - { - ok = true; - break; - } - - size = Recv(s, socket_buffer, recvsize, true); - if (size == 0) - { - // Disconnected - break; - } - - WriteBuf(recv_buf, socket_buffer, size); - } - - SeekBuf(recv_buf, 0, 0); - Free(socket_buffer); - - if (ok) - { - // Examine to confirm whether the incoming data is a SoftEther VPN protocol - char tmp[1024]; - - Zero(tmp, sizeof(tmp)); - - Copy(tmp, recv_buf->Buf, MIN(recv_buf->Size, (sizeof(tmp) - 1))); - - ok = false; - - if (StartWith(tmp, http_detect_server_startwith)) - { - ok = true; - } - else if (InStr(tmp, http_detect_server_tag_future)) - { - ok = true; - } - } - - FreeBuf(recv_buf); - - return ok; -} - -// TCP connection thread -void ConnectThreadForTcp(THREAD *thread, void *param) -{ - SOCK *sock; - char hostname[MAX_SIZE]; - CONNECT_TCP_RUDP_PARAM *p = (CONNECT_TCP_RUDP_PARAM *)param; - if (thread == NULL || p == NULL) - { - return; - } - - // Delay - if (p->Delay >= 1) - { - WaitEx(NULL, p->Delay, p->CancelFlag); - } - - // Connecting process - IPToStr(hostname, sizeof(hostname), &p->Ip); - sock = ConnectEx3(hostname, p->Port, p->Timeout, p->CancelFlag, NULL, NULL, false, true); - - if (sock != NULL && p->Tcp_TryStartSsl) - { - bool ssl_ret = false; - - p->Tcp_InNegotiation = true; - - // Attempt the SSL negotiation to take this opportunity - Lock(p->CancelLock); - { - if ((*p->CancelFlag) == false) - { - p->CancelDisconnectSock = sock; - AddRef(sock->ref); - } - else - { - Debug("User Cancel to StartSSL.\n"); - goto LABEL_CANCEL; - } - } - Unlock(p->CancelLock); - - // Start the SSL communication - ssl_ret = StartSSLEx(sock, NULL, NULL, 0, p->Hostname); - - if (ssl_ret) - { - // Identify whether the HTTPS server to be connected is a SoftEther VPN - SetTimeout(sock, (10 * 1000)); - ssl_ret = DetectIsServerSoftEtherVPN(sock); - SetTimeout(sock, INFINITE); - - if (ssl_ret == false) - { - Debug("DetectIsServerSoftEtherVPN Error.\n"); - } - } - - Lock(p->CancelLock); - { - ReleaseSock(p->CancelDisconnectSock); - p->CancelDisconnectSock = NULL; - } -LABEL_CANCEL: - Unlock(p->CancelLock); - - if (ssl_ret == false) - { - // SSL negotiation failure - Disconnect(sock); - ReleaseSock(sock); - - Debug("Fail to StartSSL.\n"); - - sock = NULL; - } - } - - p->Result_Tcp_Sock = sock; - p->Ok = (p->Result_Tcp_Sock == NULL ? false : true); - p->FinishedTick = Tick64(); - p->Finished = true; - p->Tcp_InNegotiation = false; - - Set(p->FinishEvent); -} - -// R-UDP over ICMP / over DNS connection thread -void ConnectThreadForOverDnsOrIcmp(THREAD *thread, void *param) -{ - SOCK *sock; - CONNECT_TCP_RUDP_PARAM *p = (CONNECT_TCP_RUDP_PARAM *)param; - if (thread == NULL || p == NULL) - { - return; - } - - // Delay - if (p->Delay >= 1) - { - WaitEx(NULL, p->Delay, p->CancelFlag); - } - - // Connecting process - sock = NewRUDPClientDirect(p->SvcName, &p->Ip, - (p->RUdpProtocol == RUDP_PROTOCOL_DNS ? 53 : MAKE_SPECIAL_PORT(IP_PROTO_ICMPV4)), - &p->NatT_ErrorCode, p->Timeout, p->CancelFlag, NULL, NULL, - (p->RUdpProtocol == RUDP_PROTOCOL_DNS ? 0 : MAKE_SPECIAL_PORT(IP_PROTO_ICMPV4)), - (p->RUdpProtocol == RUDP_PROTOCOL_DNS ? true : false)); - - p->Result_Nat_T_Sock = sock; - p->Ok = (p->Result_Nat_T_Sock == NULL ? false : true); - p->FinishedTick = Tick64(); - p->Finished = true; - - Set(p->FinishEvent); -} - -// R-UDP (via NAT-T) connection thread -void ConnectThreadForRUDP(THREAD *thread, void *param) -{ - SOCK *sock; - CONNECT_TCP_RUDP_PARAM *p = (CONNECT_TCP_RUDP_PARAM *)param; - if (thread == NULL || p == NULL) - { - return; - } - - // Delay - if (p->Delay >= 1) - { - WaitEx(NULL, p->Delay, p->CancelFlag); - } - - // Connecting process - sock = NewRUDPClientNatT(p->SvcName, &p->Ip, &p->NatT_ErrorCode, p->Timeout, p->CancelFlag, p->HintStr, p->TargetHostname); - - p->Result_Nat_T_Sock = sock; - p->Ok = (p->Result_Nat_T_Sock == NULL ? false : true); - p->FinishedTick = Tick64(); - p->Finished = true; - - Set(p->FinishEvent); -} - -// TCP connection -SOCK *Connect(char *hostname, UINT port) -{ - return ConnectEx(hostname, port, 0); -} -SOCK *ConnectEx(char *hostname, UINT port, UINT timeout) -{ - return ConnectEx2(hostname, port, timeout, NULL); -} -SOCK *ConnectEx2(char *hostname, UINT port, UINT timeout, bool *cancel_flag) -{ - return ConnectEx3(hostname, port, timeout, cancel_flag, NULL, NULL, false, true); -} -SOCK *ConnectEx3(char *hostname, UINT port, UINT timeout, bool *cancel_flag, char *nat_t_svc_name, UINT *nat_t_error_code, bool try_start_ssl, bool no_get_hostname) -{ - return ConnectEx4(hostname, port, timeout, cancel_flag, nat_t_svc_name, nat_t_error_code, try_start_ssl, no_get_hostname, NULL); -} -SOCK *ConnectEx4(char *hostname, UINT port, UINT timeout, bool *cancel_flag, char *nat_t_svc_name, UINT *nat_t_error_code, bool try_start_ssl, bool no_get_hostname, IP *ret_ip) -{ - SOCK *sock; - SOCKET s; - struct linger ling; - IP ip4; - IP ip6; - bool true_flag = true; - bool false_flag = false; - char tmp[MAX_SIZE]; - IP current_ip; - bool is_ipv6 = false; - bool dummy = false; - bool use_natt = false; - char hostname_original[MAX_SIZE]; - char hint_str[MAX_SIZE]; - bool force_use_natt = false; - UINT dummy_int = 0; - IP dummy_ret_ip; - // Validate arguments - if (hostname == NULL || port == 0 || port >= 65536 || IsEmptyStr(hostname)) - { - return NULL; - } - if (timeout == 0) - { - timeout = TIMEOUT_TCP_PORT_CHECK; - } - if (cancel_flag == NULL) - { - cancel_flag = &dummy; - } - if (nat_t_error_code == NULL) - { - nat_t_error_code = &dummy_int; - } - - Zero(&dummy_ret_ip, sizeof(IP)); - if (ret_ip == NULL) - { - ret_ip = &dummy_ret_ip; - } - - Zero(hint_str, sizeof(hint_str)); - StrCpy(hostname_original, sizeof(hostname_original), hostname); - - use_natt = (IsEmptyStr(nat_t_svc_name) ? false : true); - - if (use_natt) - { - // In case of using NAT-T, split host name if the '/' is included in the host name - UINT i = SearchStrEx(hostname, "/", 0, false); - - if (i == INFINITE) - { - // Not included - StrCpy(hostname_original, sizeof(hostname_original), hostname); - } - else - { - // Included - StrCpy(hostname_original, sizeof(hostname_original), hostname); - hostname_original[i] = 0; - - // Force to use the NAT-T - force_use_natt = true; - - // Copy the hint string - StrCpy(hint_str, sizeof(hint_str), hostname + i + 1); - - if (StrCmpi(hint_str, "tcp") == 0 || StrCmpi(hint_str, "disable") == 0 - || StrCmpi(hint_str, "disabled") == 0 - || StrCmpi(hint_str, "no") == 0 || StrCmpi(hint_str, "none") == 0) - { - // Force not to use the NAT-T - force_use_natt = false; - use_natt = false; - } - } - } - else - { - StrCpy(hostname_original, sizeof(hostname_original), hostname); - } - - Zero(¤t_ip, sizeof(current_ip)); - - Zero(&ip4, sizeof(ip4)); - Zero(&ip6, sizeof(ip6)); - - if (IsZeroIp(ret_ip) == false) - { - // Skip name resolution - if (IsIP6(ret_ip)) - { - Copy(&ip6, ret_ip, sizeof(IP)); - } - else - { - Copy(&ip4, ret_ip, sizeof(IP)); - } - - //Debug("Using cached IP address: %s = %r\n", hostname_original, ret_ip); - } - else - { - // Forward resolution - if (GetIP46Ex(&ip4, &ip6, hostname_original, 0, cancel_flag) == false) - { - return NULL; - } - } - - if (IsZeroIp(&ip4) == false && IsIPLocalHostOrMySelf(&ip4)) - { - // NAT-T isn't used in the case of connection to localhost - force_use_natt = false; - use_natt = false; - } - - s = INVALID_SOCKET; - - // Attempt to connect with IPv4 - if (IsZeroIp(&ip4) == false) - { - if (use_natt == false) - { - // Normal connection without using NAT-T - s = ConnectTimeoutIPv4(&ip4, port, timeout, cancel_flag); - - if (s != INVALID_SOCKET) - { - Copy(¤t_ip, &ip4, sizeof(IP)); - - Copy(ret_ip, &ip4, sizeof(IP)); - } - } - else if (force_use_natt) - { - // The connection by forcing the use of NAT-T (not to connection with normal TCP) - SOCK *nat_t_sock = NewRUDPClientNatT(nat_t_svc_name, &ip4, nat_t_error_code, timeout, cancel_flag, - hint_str, hostname); - - if (nat_t_sock != NULL) - { - StrCpy(nat_t_sock->UnderlayProtocol, sizeof(nat_t_sock->UnderlayProtocol), SOCK_UNDERLAY_NAT_T); - AddProtocolDetailsStr(nat_t_sock->ProtocolDetails, sizeof(nat_t_sock->ProtocolDetails), "RUDP"); - } - - Copy(ret_ip, &ip4, sizeof(IP)); - - return nat_t_sock; - } - else - { - // Use the connections using NAT-T with normal TCP connection together - // (Use multiple threads to try to connect in four connection methods concurrently) - CONNECT_TCP_RUDP_PARAM p1, p2, p3, p4; - EVENT *finish_event; - THREAD *t1, *t2, *t3, *t4; - UINT64 start_tick = Tick64(); - UINT64 giveup_for_all_tick = start_tick + (UINT64)SOCK_CONNECT_WAIT_FOR_ICMP_AND_DNS_AT_LEAST; - bool cancel_flag2 = false; - SOCK *cancel_sock = NULL; - - finish_event = NewEvent(); - - Zero(&p1, sizeof(p1)); - Zero(&p2, sizeof(p2)); - Zero(&p3, sizeof(p3)); - Zero(&p4, sizeof(p4)); - - // p1: TCP - StrCpy(p1.Hostname, sizeof(p1.Hostname), hostname_original); - Copy(&p1.Ip, &ip4, sizeof(IP)); - p1.Port = port; - p1.Timeout = timeout; - p1.CancelFlag = &cancel_flag2; - p1.FinishEvent = finish_event; - p1.Tcp_TryStartSsl = try_start_ssl; - p1.CancelLock = NewLock(); - - // p2: NAT-T - StrCpy(p2.Hostname, sizeof(p2.Hostname), hostname_original); - Copy(&p2.Ip, &ip4, sizeof(IP)); - p2.Port = port; - p2.Timeout = timeout; - p2.CancelFlag = &cancel_flag2; - p2.FinishEvent = finish_event; - - StrCpy(p2.HintStr, sizeof(p2.HintStr), hint_str); - StrCpy(p2.TargetHostname, sizeof(p2.TargetHostname), hostname); - StrCpy(p2.SvcName, sizeof(p2.SvcName), nat_t_svc_name); - p2.Delay = 30; // Delay by 30ms - - // p3: over ICMP - StrCpy(p3.Hostname, sizeof(p3.Hostname), hostname_original); - Copy(&p3.Ip, &ip4, sizeof(IP)); - p3.Port = port; - p3.Timeout = timeout; - p3.CancelFlag = &cancel_flag2; - p3.FinishEvent = finish_event; - StrCpy(p3.SvcName, sizeof(p3.SvcName), nat_t_svc_name); - p3.RUdpProtocol = RUDP_PROTOCOL_ICMP; - p3.Delay = 200; // Delay by 200ms - - // p4: over DNS - StrCpy(p4.Hostname, sizeof(p4.Hostname), hostname_original); - Copy(&p4.Ip, &ip4, sizeof(IP)); - p4.Port = port; - p4.Timeout = timeout; - p4.CancelFlag = &cancel_flag2; - p4.FinishEvent = finish_event; - StrCpy(p4.SvcName, sizeof(p4.SvcName), nat_t_svc_name); - p4.RUdpProtocol = RUDP_PROTOCOL_DNS; - p4.Delay = 100; // Delay by 100ms - - t1 = NewThread(ConnectThreadForTcp, &p1); - t2 = NewThread(ConnectThreadForRUDP, &p2); - t4 = NewThread(ConnectThreadForOverDnsOrIcmp, &p4); - t3 = NewThread(ConnectThreadForOverDnsOrIcmp, &p3); - - while (true) - { - UINT64 now = Tick64(); - - if (*cancel_flag) - { - // Cancel by the user - break; - } - - if (p1.Finished && p2.Finished) - { - // Results for both the TCP and the NAT-T were confirmed - if (now >= giveup_for_all_tick) - { - // Wait at least minimum time until successful of the ICMP or the DNS - break; - } - - if (p3.Ok || p4.Ok) - { - // Exit the loop immediately if any of the ICMP or the DNS is successful - break; - } - } - - if (p1.Finished && p1.Ok) - { - // Have successfully connected by TCP - break; - } - - if (p2.Finished && p2.Ok) - { - UINT p1_wait_time; - UINT64 tcp_giveup_tick; - UINT p2_spent_time; - // Have successfully connected by R-UDP - if (p1.Finished) - { - // Result of TCP is confirmed - break; - } - - // Calculate the time takes to complete connection of R-UDP - p2_spent_time = (UINT)(p2.FinishedTick - start_tick); - - // Decide the grace time for results of TCP until settled. - // The grace time is four times the duration of the R-UDP, and at least 400 milliseconds from the start, - // and up to 2500 milliseconds after the R-UDP results settled - p1_wait_time = p2_spent_time * 4; - p1_wait_time = MAX(p1_wait_time, 400); - //Debug("p2_spent_time = %u, p1_wait_time = %u\n", p2_spent_time, p1_wait_time); - - tcp_giveup_tick = start_tick + (UINT64)p1_wait_time; - tcp_giveup_tick = MIN(tcp_giveup_tick, (p2.FinishedTick + 2500ULL)); - - if (now >= tcp_giveup_tick) - { - // Result of the TCP is uncertain, but give up - if (p1.Finished || p1.Tcp_InNegotiation == false) - { - // Break only when TCP SSL negotiation is not being processed - break; - } - } - } - - Wait(finish_event, 25); - } - - cancel_flag2 = true; - - Lock(p1.CancelLock); - { - if (p1.CancelDisconnectSock != NULL) - { - cancel_sock = p1.CancelDisconnectSock; - - AddRef(cancel_sock->ref); - } - } - Unlock(p1.CancelLock); - - if (cancel_sock != NULL) - { - Disconnect(cancel_sock); - ReleaseSock(cancel_sock); - } - - WaitThread(t1, INFINITE); - WaitThread(t2, INFINITE); - WaitThread(t3, INFINITE); - WaitThread(t4, INFINITE); - ReleaseThread(t1); - ReleaseThread(t2); - ReleaseThread(t3); - ReleaseThread(t4); - ReleaseEvent(finish_event); - - DeleteLock(p1.CancelLock); - - if (*cancel_flag) - { - // Abandon all the results because the user canceled - Disconnect(p1.Result_Nat_T_Sock); - ReleaseSock(p1.Result_Nat_T_Sock); - Disconnect(p2.Result_Nat_T_Sock); - ReleaseSock(p2.Result_Nat_T_Sock); - Disconnect(p3.Result_Nat_T_Sock); - ReleaseSock(p3.Result_Nat_T_Sock); - Disconnect(p4.Result_Nat_T_Sock); - ReleaseSock(p4.Result_Nat_T_Sock); - - return NULL; - } - - if (p1.Ok) - { - char hostname[MAX_SIZE]; - - // Use the results of the TCP - // Dispose other results - Disconnect(p2.Result_Nat_T_Sock); - ReleaseSock(p2.Result_Nat_T_Sock); - Disconnect(p3.Result_Nat_T_Sock); - ReleaseSock(p3.Result_Nat_T_Sock); - Disconnect(p4.Result_Nat_T_Sock); - ReleaseSock(p4.Result_Nat_T_Sock); - - if (GetHostName(hostname, sizeof(hostname), &ip4)) - { - Free(p1.Result_Tcp_Sock->RemoteHostname); - p1.Result_Tcp_Sock->RemoteHostname = CopyStr(hostname); - } - - Copy(ret_ip, &ip4, sizeof(IP)); - - return p1.Result_Tcp_Sock; - } - else if (p2.Ok) - { - // Use the results of the R-UDP - // Dispose other results - Disconnect(p3.Result_Nat_T_Sock); - ReleaseSock(p3.Result_Nat_T_Sock); - Disconnect(p4.Result_Nat_T_Sock); - ReleaseSock(p4.Result_Nat_T_Sock); - - StrCpy(p2.Result_Nat_T_Sock->UnderlayProtocol, sizeof(p2.Result_Nat_T_Sock->UnderlayProtocol), SOCK_UNDERLAY_NAT_T); - AddProtocolDetailsStr(p2.Result_Nat_T_Sock->UnderlayProtocol, sizeof(p2.Result_Nat_T_Sock->UnderlayProtocol), "RUDP/UDP"); - - Copy(ret_ip, &ip4, sizeof(IP)); - - return p2.Result_Nat_T_Sock; - } - else if (p4.Ok) - { - // Use this if over-DNS success - // Dispose other results - Disconnect(p3.Result_Nat_T_Sock); - ReleaseSock(p3.Result_Nat_T_Sock); - - StrCpy(p4.Result_Nat_T_Sock->UnderlayProtocol, sizeof(p4.Result_Nat_T_Sock->UnderlayProtocol), SOCK_UNDERLAY_DNS); - AddProtocolDetailsStr(p4.Result_Nat_T_Sock->UnderlayProtocol, sizeof(p4.Result_Nat_T_Sock->UnderlayProtocol), "RUDP/DNS"); - - Copy(ret_ip, &ip4, sizeof(IP)); - - return p4.Result_Nat_T_Sock; - } - else if (p3.Ok) - { - // Use this if over ICMP success - StrCpy(p3.Result_Nat_T_Sock->UnderlayProtocol, sizeof(p3.Result_Nat_T_Sock->UnderlayProtocol), SOCK_UNDERLAY_ICMP); - AddProtocolDetailsStr(p3.Result_Nat_T_Sock->UnderlayProtocol, sizeof(p3.Result_Nat_T_Sock->UnderlayProtocol), "RUDP/ICMP"); - - Copy(ret_ip, &ip4, sizeof(IP)); - - return p3.Result_Nat_T_Sock; - } - else - { - // Continue the process if all trials failed - *nat_t_error_code = p2.NatT_ErrorCode; - } - } - } - - // Attempt to connect with IPv6 - if (s == INVALID_SOCKET && IsZeroIp(&ip6) == false) - { - struct sockaddr_in6 sockaddr6; - struct in6_addr addr6; - - Zero(&sockaddr6, sizeof(sockaddr6)); - Zero(&addr6, sizeof(addr6)); - - // Generation of the sockaddr_in6 - IPToInAddr6(&addr6, &ip6); - sockaddr6.sin6_port = htons((USHORT)port); - sockaddr6.sin6_family = AF_INET6; - sockaddr6.sin6_scope_id = ip6.ipv6_scope_id; - Copy(&sockaddr6.sin6_addr, &addr6, sizeof(addr6)); - - // Socket creation - s = socket(AF_INET6, SOCK_STREAM, 0); - if (s != INVALID_SOCKET) - { - // Connection - if (connect_timeout(s, (struct sockaddr *)&sockaddr6, sizeof(struct sockaddr_in6), timeout, cancel_flag) != 0) - { - // Connection failure - closesocket(s); - s = INVALID_SOCKET; - } - else - { - Copy(¤t_ip, &ip6, sizeof(IP)); - - is_ipv6 = true; - - Copy(ret_ip, &ip6, sizeof(IP)); - } - } - } - - if (s == INVALID_SOCKET) - { - // Connection fails on both of IPv4, IPv6 - return NULL; - } - - // Creating a SOCK - sock = NewSock(); - sock->socket = s; - sock->Type = SOCK_TCP; - sock->ServerMode = false; - - StrCpy(sock->UnderlayProtocol, sizeof(sock->UnderlayProtocol), is_ipv6 ? SOCK_UNDERLAY_NATIVE_V6 : SOCK_UNDERLAY_NATIVE_V4); - AddProtocolDetailsStr(sock->ProtocolDetails, sizeof(sock->ProtocolDetails), is_ipv6 ? "IPv6" : "IPv4"); - - // Host name resolution - if (no_get_hostname || (GetHostName(tmp, sizeof(tmp), ¤t_ip) == false)) - { - StrCpy(tmp, sizeof(tmp), hostname_original); - } - - //Debug("PTR: %s\n", tmp); - - sock->RemoteHostname = CopyStr(tmp); - -// Debug("new socket: %u\n", s); - - Zero(&ling, sizeof(ling)); - // Forced disconnection flag -#ifdef SO_DONTLINGER - (void)setsockopt(sock->socket, SOL_SOCKET, SO_DONTLINGER, (char *)&true_flag, sizeof(bool)); -#else // SO_DONTLINGER - (void)setsockopt(sock->socket, SOL_SOCKET, SO_LINGER, (char *)&false_flag, sizeof(bool)); -#endif // SO_DONTLINGER -// setsockopt(sock->socket, SOL_SOCKET, SO_REUSEADDR, (char *)&true_flag, sizeof(bool)); - - // Configuring TCP options - (void)setsockopt(sock->socket, IPPROTO_TCP, TCP_NODELAY, (char *)&true_flag, sizeof(bool)); - - // Initialization of the time-out value - SetTimeout(sock, TIMEOUT_INFINITE); - - // Get the socket information - QuerySocketInformation(sock); - - if (IsZeroIp(&sock->LocalIP) == false && IsLocalHostIP(&sock->LocalIP) == false) - { - IP current_ip; - - if (GetCurrentGlobalIP(¤t_ip, is_ipv6) == false) - { - SetCurrentGlobalIP(&sock->LocalIP, is_ipv6); - } - } - - sock->Connected = true; - sock->AsyncMode = false; - sock->SecureMode = false; - sock->IPv6 = is_ipv6; - - return sock; -} - -// Add a protocol details strings -void AddProtocolDetailsStr(char *dst, UINT dst_size, char *str) -{ - TOKEN_LIST *t1, *t2; - UINT i, j; - if (dst == NULL || str == NULL) - { - return; - } - - t1 = ParseTokenWithoutNullStr(dst, " "); - t2 = ParseTokenWithoutNullStr(str, " "); - - for (i = 0; i < t2->NumTokens; i++) - { - bool exists = false; - for (j = 0; j < t1->NumTokens; j++) - { - if (StrCmpi(t1->Token[j], t2->Token[i]) == 0) - { - exists = true; - break; - } - } - - if (exists == false) - { - StrCat(dst, dst_size, t2->Token[i]); - StrCat(dst, dst_size, " "); - } - } - - FreeToken(t1); - FreeToken(t2); -} - -void AddProtocolDetailsKeyValueStr(char *dst, UINT dst_size, char *key, char *value) -{ - char tmp[128]; - StrCpy(tmp, sizeof(tmp), key); - StrCat(tmp, sizeof(tmp), "="); - StrCat(tmp, sizeof(tmp), value); - AddProtocolDetailsStr(dst, dst_size, tmp); -} - -void AddProtocolDetailsKeyValueInt(char *dst, UINT dst_size, char *key, UINT value) -{ - char tmp[128]; - ToStr(tmp, value); - AddProtocolDetailsKeyValueStr(dst, dst_size, key, tmp); -} - - -// Setting the buffer size of the socket -bool SetSocketBufferSize(SOCKET s, bool send, UINT size) -{ - int value = (int)size; - // Validate arguments - if (s == INVALID_SOCKET) - { - return false; - } - - if (setsockopt(s, SOL_SOCKET, (send ? SO_SNDBUF : SO_RCVBUF), (char *)&value, sizeof(int)) != 0) - { - return false; - } - - return true; -} -UINT SetSocketBufferSizeWithBestEffort(SOCKET s, bool send, UINT size) -{ - // Validate arguments - if (s == INVALID_SOCKET) - { - return 0; - } - - while (true) - { - if (SetSocketBufferSize(s, send, size)) - { - return size; - } - - size = (UINT)((double)size / 1.5); - - if (size <= 32767) - { - return 0; - } - } -} - -// Initialize the buffer size of the UDP socket -void InitUdpSocketBufferSize(SOCKET s) -{ - SetSocketBufferSizeWithBestEffort(s, true, UDP_MAX_BUFFER_SIZE); - SetSocketBufferSizeWithBestEffort(s, false, UDP_MAX_BUFFER_SIZE); -} - -// Get the socket information -void QuerySocketInformation(SOCK *sock) -{ - // Validate arguments - if (sock == NULL) - { - return; - } - - Lock(sock->lock); - { - struct sockaddr_in6 sockaddr6; - struct in6_addr *addr6; - int size; - UINT dw; - UINT opt_value = 0; - - if (sock->Type == SOCK_TCP) - { - // Get the information of the remote host - size = sizeof(sockaddr6); - if (getpeername(sock->socket, (struct sockaddr *)&sockaddr6, (int *)&size) == 0) - { - if (size >= sizeof(struct sockaddr_in6)) - { - sock->RemotePort = (UINT)ntohs(sockaddr6.sin6_port); - addr6 = &sockaddr6.sin6_addr; - InAddrToIP6(&sock->RemoteIP, addr6); - sock->RemoteIP.ipv6_scope_id = sockaddr6.sin6_scope_id; - } - else - { - struct sockaddr_in *sockaddr; - struct in_addr *addr; - - sockaddr = (struct sockaddr_in *)&sockaddr6; - sock->RemotePort = (UINT)ntohs(sockaddr->sin_port); - addr = &sockaddr->sin_addr; - InAddrToIP(&sock->RemoteIP, addr); - } - } - } - - // Get the local host information - size = sizeof(sockaddr6); - if (getsockname(sock->socket, (struct sockaddr *)&sockaddr6, (int *)&size) == 0) - { - if (size >= sizeof(struct sockaddr_in6)) - { - sock->LocalPort = (UINT)ntohs(sockaddr6.sin6_port); - addr6 = &sockaddr6.sin6_addr; - InAddrToIP6(&sock->LocalIP, addr6); - sock->LocalIP.ipv6_scope_id = sockaddr6.sin6_scope_id; - } - else - { - struct sockaddr_in *sockaddr; - struct in_addr *addr; - - sockaddr = (struct sockaddr_in *)&sockaddr6; - sock->LocalPort = (UINT)ntohs(sockaddr->sin_port); - addr = &sockaddr->sin_addr; - InAddrToIP(&sock->LocalIP, addr); - } - } - - if (sock->IsRawSocket) - { - sock->LocalPort = sock->RemotePort = MAKE_SPECIAL_PORT(sock->RawSocketIPProtocol); - } - - if (sock->Type == SOCK_UDP) - { - sock->UdpMaxMsgSize = UDP_MAX_MSG_SIZE_DEFAULT; - -#ifdef OS_WIN32 - if (true) - { - // Get the buffer size that can be transmitted and received at once - UINT max_value = 0; - int len = sizeof(UINT); - - if (getsockopt(sock->socket, SOL_SOCKET, SO_MAX_MSG_SIZE, (char *)&max_value, &len) == 0) - { - sock->UdpMaxMsgSize = max_value; - } - } -#endif // OS_WIN32 - } - - if (sock->IPv6) - { -#ifdef IPV6_UNICAST_HOPS - opt_value = IPV6_UNICAST_HOPS; -#endif // IPV6_UNICAST_HOPS - } - else - { -#ifdef IP_TTL - opt_value = IP_TTL; -#endif // IP_TTL - } - - // Support of the TTL value - size = sizeof(UINT); - if (opt_value == 0 || - getsockopt(sock->socket, (sock->IPv6 ? IPPROTO_IPV6 : IPPROTO_IP), opt_value, (char *)&dw, &size) != 0) - { - sock->IsTtlSupported = false; - } - else - { - sock->IsTtlSupported = true; - sock->CurrentTtl = dw; - } - } - Unlock(sock->lock); -} - -// Setting the TTL value -bool SetTtl(SOCK *sock, UINT ttl) -{ - UINT dw; - int size; - UINT opt_value = 0; - // Validate arguments - if (sock == NULL) - { - return false; - } - - if (sock->IsTtlSupported == false) - { - return false; - } - - if (sock->CurrentTtl == ttl) - { - return true; - } - - dw = ttl; - size = sizeof(UINT); - - if (sock->IPv6) - { -#ifdef IPV6_UNICAST_HOPS - opt_value = IPV6_UNICAST_HOPS; -#endif // IPV6_UNICAST_HOPS - } - else - { -#ifdef IP_TTL - opt_value = IP_TTL; -#endif // IP_TTL - } - - if (opt_value == 0 || - setsockopt(sock->socket, (sock->IPv6 ? IPPROTO_IPV6 : IPPROTO_IP), opt_value, (char *)&dw, size) == false) - { - return false; - } - - sock->CurrentTtl = ttl; - - return true; -} - -// Release of the socket -void ReleaseSock(SOCK *s) -{ - // Validate arguments - if (s == NULL) - { - return; - } - - if (Release(s->ref) == 0) - { - if (s->ListenMode == false && s->ServerMode) - { - Print(""); - } - CleanupSock(s); - } -} - -// Clean-up of the socket -void CleanupSock(SOCK *s) -{ - // Validate arguments - if (s == NULL) - { - return; - } - -// {Debug("CleanupSock: Disconnect() Called: %s %u\n", __FILE__, __LINE__);Disconnect(s);} - Disconnect(s); - - if (s->InProcAcceptQueue != NULL) - { - while (true) - { - SOCK *ss = GetNext(s->InProcAcceptQueue); - if (ss == NULL) - { - break; - } - - Disconnect(ss); - ReleaseSock(ss); - } - - ReleaseQueue(s->InProcAcceptQueue); - } - - if (s->InProcAcceptEvent != NULL) - { - ReleaseEvent(s->InProcAcceptEvent); - } - - if (s->ReverseAcceptQueue != NULL) - { - while (true) - { - SOCK *ss = GetNext(s->ReverseAcceptQueue); - if (ss == NULL) - { - break; - } - - Disconnect(ss); - ReleaseSock(ss); - } - - ReleaseQueue(s->ReverseAcceptQueue); - } - - if (s->ReverseAcceptEvent != NULL) - { - ReleaseEvent(s->ReverseAcceptEvent); - } - - if (s->SendTube != NULL) - { - TubeDisconnect(s->SendTube); - ReleaseTube(s->SendTube); - } - - if (s->RecvTube != NULL) - { - TubeDisconnect(s->RecvTube); - ReleaseTube(s->RecvTube); - } - - if (s->BulkRecvTube != NULL) - { - TubeDisconnect(s->BulkRecvTube); - ReleaseTube(s->BulkRecvTube); - } - - if (s->BulkSendTube != NULL) - { - TubeDisconnect(s->BulkSendTube); - ReleaseTube(s->BulkSendTube); - } - - if (s->BulkSendKey != NULL) - { - ReleaseSharedBuffer(s->BulkSendKey); - } - - if (s->BulkRecvKey != NULL) - { - ReleaseSharedBuffer(s->BulkRecvKey); - } - - if (s->InProcRecvFifo != NULL) - { - ReleaseFifo(s->InProcRecvFifo); - } - - if (s->R_UDP_Stack != NULL) - { - FreeRUDP(s->R_UDP_Stack); - } - -#ifdef OS_WIN32 - Win32FreeAsyncSocket(s); -#else // OS_WIN32 - UnixFreeAsyncSocket(s); -#endif // OS_WIN32 - - FreeBuf(s->SendBuf); - if (s->socket != INVALID_SOCKET) - { -#ifdef OS_WIN32 - closesocket(s->socket); -#else // OS_WIN32 - close(s->socket); -#endif // OS_WIN32 - } - Free(s->RemoteHostname); - -#ifdef OS_WIN32 - if (s->hAcceptEvent != NULL) - { - CloseHandle(s->hAcceptEvent); - } -#endif // OS_WIN32 - - // Release the certificate - if (s->RemoteX != NULL) - { - FreeX(s->RemoteX); - s->RemoteX = NULL; - } - if (s->LocalX != NULL) - { - FreeX(s->LocalX); - s->LocalX = NULL; - } - - // Cipher algorithm name - if (s->CipherName != NULL) - { - Free(s->CipherName); - s->CipherName = NULL; - } - - Free(s->WaitToUseCipher); - DeleteLock(s->lock); - DeleteLock(s->ssl_lock); - DeleteLock(s->disconnect_lock); - - Dec(num_tcp_connections); - - Free(s); -} - -// Creating a new socket -SOCK *NewSock() -{ - SOCK *s = ZeroMallocFast(sizeof(SOCK)); - - s->ref = NewRef(); - s->lock = NewLock(); - s->SendBuf = NewBuf(); - s->socket = INVALID_SOCKET; - s->ssl_lock = NewLock(); - s->disconnect_lock = NewLock(); - - Inc(num_tcp_connections); - - return s; -} - -// Convert the IP to UINT -UINT IPToUINT(IP *ip) -{ - UCHAR *b; - UINT i, value = 0; - // Validate arguments - if (ip == NULL) - { - return 0; - } - - b = (UCHAR *)&value; - for (i = 0; i < 4; i++) - { - b[i] = ip->addr[i]; - } - - return value; -} - -// Convert UINT to IP -void UINTToIP(IP *ip, UINT value) -{ - UCHAR *b; - UINT i; - // Validate arguments - if (ip == NULL) - { - return; - } - - ZeroIP4(ip); - - b = (UCHAR *)&value; - for (i = 0; i < 4; i++) - { - ip->addr[i] = b[i]; - } -} - -// Get the host name of the computer -void GetMachineHostName(char *name, UINT size) -{ - char tmp[MAX_SIZE]; - UINT i, len; - // Validate arguments - if (name == NULL) - { - return; - } - - GetMachineName(tmp, sizeof(tmp)); - - len = StrLen(tmp); - for (i = 0; i < len; i++) - { - if (tmp[i] == '.') - { - tmp[i] = 0; - } - } - - ConvertSafeFileName(name, size, tmp); -} - -// Get the computer name from 'hosts' -bool GetMachineNameFromHosts(char *name, UINT size) -{ - bool ret = false; - char *s; - BUF *b; - // Validate arguments - if (name == NULL) - { - return false; - } - - b = ReadDump("/etc/hosts"); - if (b == NULL) - { - return false; - } - - while (true) - { - s = CfgReadNextLine(b); - if (s == NULL) - { - break; - } - else - { - TOKEN_LIST *t = ParseToken(s, " \t"); - - if (t != NULL) - { - if (t->NumTokens >= 2) - { - if (StrCmpi(t->Token[0], "127.0.0.1") == 0) - { - UINT i; - - for (i = 1; i < t->NumTokens; i++) - { - if (StartWith(t->Token[i], "localhost") == false) - { - StrCpy(name, size, t->Token[i]); - ret = true; - } - } - } - } - } - FreeToken(t); - } - - Free(s); - } - - FreeBuf(b); - - return ret; -} - -// Get the computer name of this computer -void GetMachineName(char *name, UINT size) -{ - GetMachineNameEx(name, size, false); -} -void GetMachineNameEx(char *name, UINT size, bool no_load_hosts) -{ - static char name_cache[MAX_SIZE]; - static bool name_cached = false; - char tmp[MAX_SIZE]; - char tmp2[MAX_SIZE]; - // Validate arguments - if (name == NULL) - { - return; - } - - Lock(machine_name_lock); - { - if (name_cached != false) - { - StrCpy(name, size, name_cache); - Unlock(machine_name_lock); - return; - } - ClearStr(tmp, sizeof(tmp)); - if (gethostname(tmp, MAX_SIZE) != 0) - { - StrCpy(name, size, "Unknown"); - Unlock(machine_name_lock); - return; - } - ClearStr(name, size); - StrCpy(name, size, tmp); - if (IsEmptyStr(name) || StartWith(name, "localhost")) - { -#ifdef OS_WIN32 - ClearStr(name, size); - MsGetComputerName(name, size); -#endif // OS_WIN32 - } - if (IsEmptyStr(name) || StartWith(name, "localhost")) - { - if (no_load_hosts == false && OS_IS_UNIX(GetOsInfo()->OsType)) - { - if (GetMachineNameFromHosts(tmp2, sizeof(tmp2))) - { - StrCpy(name, size, tmp2); - } - } - } - - StrCpy(name_cache, sizeof(name_cache), name); - name_cached = true; - } - Unlock(machine_name_lock); -} - -// Host name acquisition thread -void GetHostNameThread(THREAD *t, void *p) -{ - IP *ip; - char hostname[256]; - // Validate arguments - if (t == NULL || p == NULL) - { - return; - } - - ip = (IP *)p; - - AddWaitThread(t); - - NoticeThreadInit(t); - - if (GetHostNameInner(hostname, sizeof(hostname), ip)) - { - AddHostCache(ip, hostname); - } - - Free(ip); - - DelWaitThread(t); -} - -// Get the host name -bool GetHostName(char *hostname, UINT size, IP *ip) -{ - THREAD *t; - IP *p_ip; - bool ret; - // Validate arguments - if (hostname == NULL || ip == NULL) - { - return false; - } - - if (GetHostCache(hostname, size, ip)) - { - if (IsEmptyStr(hostname) == false) - { - return true; - } - else - { - return false; - } - } - - p_ip = ZeroMalloc(sizeof(IP)); - Copy(p_ip, ip, sizeof(IP)); - - t = NewThread(GetHostNameThread, p_ip); - - WaitThreadInit(t); - - WaitThread(t, TIMEOUT_HOSTNAME); - - ReleaseThread(t); - - ret = GetHostCache(hostname, size, ip); - if (ret == false) - { - if (IsIP4(ip)) - { - ret = GetNetBiosName(hostname, size, ip); - if (ret) - { - AddHostCache(ip, hostname); - } - } - } - else - { - if (IsEmptyStr(hostname)) - { - ret = false; - } - } - if (ret == false) - { - AddHostCache(ip, ""); - StrCpy(hostname, size, ""); - } - - return ret; -} - -// Perform a DNS reverse query -bool GetHostNameInner(char *hostname, UINT size, IP *ip) -{ - struct in_addr addr; - struct sockaddr_in sa; - char tmp[MAX_SIZE]; - char ip_str[64]; - // Validate arguments - if (hostname == NULL || ip == NULL) - { - return false; - } - - if (IsIP6(ip)) - { - return GetHostNameInner6(hostname, size, ip); - } - - // Reverse resolution - IPToInAddr(&addr, ip); - Zero(&sa, sizeof(sa)); - sa.sin_family = AF_INET; - -#if defined(UNIX_BSD) || defined(UNIX_MACOS) - sa.sin_len = INET_ADDRSTRLEN; -#endif // UNIX_BSD || UNIX_MACOS - - Copy(&sa.sin_addr, &addr, sizeof(struct in_addr)); - sa.sin_port = 0; - - if (getnameinfo((struct sockaddr *)&sa, sizeof(sa), tmp, sizeof(tmp), NULL, 0, 0) != 0) - { - return false; - } - - IPToStr(ip_str, sizeof(ip_str), ip); - - if (StrCmpi(tmp, ip_str) == 0) - { - return false; - } - - if (IsEmptyStr(tmp)) - { - return false; - } - - StrCpy(hostname, size, tmp); - - return true; -} -bool GetHostNameInner6(char *hostname, UINT size, IP *ip) -{ - struct in6_addr addr; - struct sockaddr_in6 sa; - char tmp[MAX_SIZE]; - char ip_str[256]; - // Validate arguments - if (hostname == NULL || ip == NULL) - { - return false; - } - - // Reverse resolution - IPToInAddr6(&addr, ip); - Zero(&sa, sizeof(sa)); - sa.sin6_family = AF_INET6; - -#if defined(UNIX_BSD) || defined(UNIX_MACOS) - sa.sin6_len = INET6_ADDRSTRLEN; -#endif // UNIX_BSD || UNIX_MACOS - - Copy(&sa.sin6_addr, &addr, sizeof(struct in6_addr)); - sa.sin6_port = 0; - - if (getnameinfo((struct sockaddr *)&sa, sizeof(sa), tmp, sizeof(tmp), NULL, 0, 0) != 0) - { - return false; - } - - IPToStr(ip_str, sizeof(ip_str), ip); - - if (StrCmpi(tmp, ip_str) == 0) - { - return false; - } - - if (IsEmptyStr(tmp)) - { - return false; - } - - StrCpy(hostname, size, tmp); - - return true; -} - -#define NUM_NBT_QUERYS_SEND 3 - -// Get the NetBIOS name of the machine from the IP address -bool GetNetBiosName(char *name, UINT size, IP *ip) -{ - SOCK *s; - UINT i, j; - bool flag = false; - bool ok = false; - NBTREQUEST req; - UCHAR buf[1024]; - USHORT tran_id[NUM_NBT_QUERYS_SEND]; - UINT64 timeout_tick; - // Validate arguments - if (name == NULL || ip == NULL) - { - return false; - } - - IPToStr(name, size, ip); - - for (i = 0; i < NUM_NBT_QUERYS_SEND; i++) - { - tran_id[i] = Rand16(); - } - - s = NewUDP(0); - if (s == NULL) - { - return false; - } - - for (j = 0; j < NUM_NBT_QUERYS_SEND; j++) - { - Zero(&req, sizeof(req)); - req.TransactionId = Endian16(tran_id[j]); - req.NumQuestions = Endian16(1); - req.Query[0] = 0x20; - req.Query[1] = 0x43; - req.Query[2] = 0x4b; - for (i = 3; i <= 32; i++) - { - req.Query[i] = 0x41; - } - req.Query[35] = 0x21; - req.Query[37] = 0x01; - - if (SendTo(s, ip, 137, &req, sizeof(req)) == 0) - { - ReleaseSock(s); - return false; - } - } - - timeout_tick = Tick64() + (UINT64)TIMEOUT_NETBIOS_HOSTNAME; - - while (1) - { - UINT ret; - IP src_ip; - UINT src_port; - SOCKSET set; - if (Tick64() >= timeout_tick) - { - break; - } - InitSockSet(&set); - AddSockSet(&set, s); - Select(&set, 100, NULL, NULL); - - if (flag == false) - { - flag = true; - } - else - { - SleepThread(10); - } - - ret = RecvFrom(s, &src_ip, &src_port, buf, sizeof(buf)); - - if (ret == SOCK_LATER) - { - continue; - } - else if (ret == 0) - { - break; - } - else - { - if (ret >= sizeof(NBTRESPONSE)) - { - NBTRESPONSE *r = (NBTRESPONSE *)buf; - bool b = false; - UINT i; - USHORT id = Endian16(r->TransactionId); - for (i = 0; i < NUM_NBT_QUERYS_SEND; i++) - { - if (id == tran_id[i]) - { - b = true; - break; - } - } - if (b) - { - if (r->Flags != 0 && r->NumQuestions == 0 && r->AnswerRRs >= 1) - { - if (r->Response[0] == 0x20 && r->Response[1] == 0x43 && - r->Response[2] == 0x4b) - { - if (r->Response[34] == 0x00 && r->Response[35] == 0x21 && - r->Response[36] == 0x00 && r->Response[37] == 0x01) - { - char *a = (char *)(&r->Response[45]); - if (StrCheckLen(a, 15)) - { - if (IsEmptyStr(a) == false) - { - StrCpy(name, size, a); - Trim(name); - ok = true; - } - else - { - ok = false; - break; - } - } - } - } - } - } - } - } - } - - ReleaseSock(s); - return ok; -} - -// Set the IP address -void SetIP(IP *ip, UCHAR a1, UCHAR a2, UCHAR a3, UCHAR a4) -{ - // Validate arguments - if (ip == NULL) - { - return; - } - - Zero(ip, sizeof(IP)); - ip->addr[0] = a1; - ip->addr[1] = a2; - ip->addr[2] = a3; - ip->addr[3] = a4; -} -UINT SetIP32(UCHAR a1, UCHAR a2, UCHAR a3, UCHAR a4) -{ - IP ip; - - Zero(&ip, sizeof(ip)); - SetIP(&ip, a1, a2, a3, a4); - - return IPToUINT(&ip); -} - -// Obtain in both v4 and v6 results with a DNS forward lookup -bool GetIP46Ex(IP *ip4, IP *ip6, char *hostname, UINT timeout, bool *cancel) -{ - IP a, b; - bool ok_a, ok_b; - // Validate arguments - if (ip4 == NULL || ip6 == NULL || hostname == NULL) - { - return false; - } - - ZeroIP4(ip4); - ZeroIP6(ip6); - - ok_a = ok_b = false; - - if (GetIP6Ex(&a, hostname, timeout, cancel)) - { - ok_a = true; - } - - if (GetIP4Ex(&b, hostname, timeout, cancel)) - { - ok_b = true; - } - - if (ok_a) - { - if (IsIP4(&a)) - { - Copy(ip4, &a, sizeof(IP)); - } - } - if (ok_b) - { - if (IsIP4(&b)) - { - Copy(ip4, &b, sizeof(IP)); - } - - if (IsIP6(&b)) - { - Copy(ip6, &b, sizeof(IP)); - } - } - if (ok_a) - { - if (IsIP6(&a)) - { - Copy(ip6, &a, sizeof(IP)); - } - } - - if (IsZeroIp(ip4) && IsZeroIp(ip6)) - { - return false; - } - - return true; -} - -// Clean-up of the parameters for GetIP thread -void CleanupGetIPThreadParam(GETIP_THREAD_PARAM *p) -{ - // Validate arguments - if (p == NULL) - { - return; - } - - Free(p); -} - -// Release of the parameters of the GetIP for thread -void ReleaseGetIPThreadParam(GETIP_THREAD_PARAM *p) -{ - // Validate arguments - if (p == NULL) - { - return; - } - - if (Release(p->Ref) == 0) - { - CleanupGetIPThreadParam(p); - } -} - -// Thread to perform to query the DNS forward lookup (with timeout) -void GetIP4Ex6ExThread(THREAD *t, void *param) -{ - GETIP_THREAD_PARAM *p; - // Validate arguments - if (t == NULL || param == NULL) - { - return; - } - - p = (GETIP_THREAD_PARAM *)param; - - AddRef(p->Ref); - - NoticeThreadInit(t); - - AddWaitThread(t); - - // Execution of resolution - if (p->IPv6 == false) - { - // IPv4 - p->Ok = GetIP4Inner(&p->Ip, p->HostName); - } - else - { - // IPv6 - p->Ok = GetIP6Inner(&p->Ip, p->HostName); - } - - ReleaseGetIPThreadParam(p); - - DelWaitThread(t); - - Dec(getip_thread_counter); -} - -// Perform a forward DNS query (with timeout) -bool GetIP4Ex6Ex(IP *ip, char *hostname_arg, UINT timeout, bool ipv6, bool *cancel) -{ - return GetIP4Ex6Ex2(ip, hostname_arg, timeout, ipv6, cancel, false); -} -bool GetIP4Ex6Ex2(IP *ip, char *hostname_arg, UINT timeout, bool ipv6, bool *cancel, bool only_direct_dns) -{ - GETIP_THREAD_PARAM *p; - THREAD *t; - bool ret = false; - UINT64 start_tick = 0; - UINT64 end_tick = 0; - UINT64 spent_time = 0; - UINT64 now; - UINT n; - bool use_dns_proxy = false; - char hostname[260]; - UINT i; - bool timed_out; - // Validate arguments - if (ip == NULL || hostname_arg == NULL) - { - return false; - } - if (timeout == 0) - { - timeout = TIMEOUT_GETIP; - } - - Zero(hostname, sizeof(hostname)); - StrCpy(hostname, sizeof(hostname), hostname_arg); - - i = SearchStrEx(hostname, "/", 0, true); - if (i != INFINITE) - { - hostname[i] = 0; - } - - if (ipv6 == false) - { - IP ip2; - - if (StrToIP(&ip2, hostname) && IsZeroIp(&ip2) == false) - { - if (IsIP4(&ip2)) - { - // IPv4 address direct specification - Copy(ip, &ip2, sizeof(IP)); - return true; - } - else - { - // IPv6 address direct specification - return false; - } - } - } - else - { - IP ip2; - - if (StrToIP(&ip2, hostname) && IsZeroIp(&ip2) == false) - { - if (IsIP6(&ip2)) - { - // IPv6 address direct specification - Copy(ip, &ip2, sizeof(IP)); - return true; - } - else - { - // IPv4 address direct specification - return false; - } - } - } - - if (only_direct_dns == false) - { - if (ipv6 == false) - { - if (IsUseDnsProxy()) - { - use_dns_proxy = true; - } - } - } - - - // check the quota - start_tick = Tick64(); - end_tick = start_tick + (UINT64)timeout; - - n = 0; - - timed_out = false; - - while (true) - { - UINT64 now = Tick64(); - UINT64 remain; - UINT remain32; - - if (GetGetIpThreadMaxNum() > GetCurrentGetIpThreadNum()) - { - // below the quota - break; - } - - if (now >= end_tick) - { - // timeouted - timed_out = true; - break; - } - - if (cancel != NULL && (*cancel)) - { - // cancelled - timed_out = true; - break; - } - - remain = end_tick - now; - remain32 = MIN((UINT)remain, 100); - - SleepThread(remain32); - n++; - } - - now = Tick64(); - spent_time = now - start_tick; - - if (n == 0) - { - spent_time = 0; - } - - if ((UINT)spent_time >= timeout) - { - timed_out = true; - } - - if (timed_out) - { - IP ip2; - - // timed out, cancelled - if (QueryDnsCache(&ip2, hostname)) - { - ret = true; - - Copy(ip, &ip2, sizeof(IP)); - } - - Debug("GetIP4Ex6Ex2: Worker thread quota exceeded: max=%u current=%u\n", - GetGetIpThreadMaxNum(), GetCurrentGetIpThreadNum()); - - return ret; - } - - // Increment the counter - Inc(getip_thread_counter); - - if (spent_time != 0) - { - Debug("GetIP4Ex6Ex2: Waited for %u msecs to create a worker thread.\n", - spent_time); - } - - timeout -= (UINT)spent_time; - - p = ZeroMalloc(sizeof(GETIP_THREAD_PARAM)); - p->Ref = NewRef(); - StrCpy(p->HostName, sizeof(p->HostName), hostname); - p->IPv6 = ipv6; - p->Timeout = timeout; - p->Ok = false; - - t = NewThread(GetIP4Ex6ExThread, p); - WaitThreadInit(t); - - if (cancel == NULL) - { - WaitThread(t, timeout); - } - else - { - start_tick = Tick64(); - end_tick = start_tick + (UINT64)timeout; - - while (true) - { - UINT64 now = Tick64(); - UINT64 remain; - UINT remain32; - - if (*cancel) - { - break; - } - - if (now >= end_tick) - { - break; - } - - remain = end_tick - now; - remain32 = MIN((UINT)remain, 100); - - if (WaitThread(t, remain32)) - { - break; - } - } - } - - ReleaseThread(t); - - if (p->Ok) - { - ret = true; - Copy(ip, &p->Ip, sizeof(IP)); - } - else - { - IP ip2; - -#if 0 - if (only_direct_dns == false) - { - if (ipv6) - { - UINT flets_type = DetectFletsType(); - - // if I'm in the FLETs of NTT East, - // try to get an IP address using the DNS proxy server - if ((flets_type & FLETS_DETECT_TYPE_EAST_BFLETS_PRIVATE) && - GetIPViaDnsProxyForJapanFlets(ip, hostname, true, 0, cancel, NULL)) - { - // B FLETs - ret = true; - } - else if ((flets_type & FLETS_DETECT_TYPE_EAST_NGN_PRIVATE) && - GetIPViaDnsProxyForJapanFlets(ip, hostname, true, 0, cancel, FLETS_NGN_EAST_DNS_PROXY_HOSTNAME)) - { - // FLET'S Hikar-Next (NTT East) - ret = true; - } - else if ((flets_type & FLETS_DETECT_TYPE_WEST_NGN_PRIVATE) && - GetIPViaDnsProxyForJapanFlets(ip, hostname, true, 0, cancel, FLETS_NGN_WEST_DNS_PROXY_HOSTNAME)) - { - // FLET'S Hikar-Next (NTT West) - ret = true; - } - } - } -#endif - - if (QueryDnsCache(&ip2, hostname)) - { - ret = true; - - Copy(ip, &ip2, sizeof(IP)); - } - } - - - ReleaseGetIPThreadParam(p); - - return ret; -} -bool GetIP4Ex(IP *ip, char *hostname, UINT timeout, bool *cancel) -{ - return GetIP4Ex6Ex(ip, hostname, timeout, false, cancel); -} -bool GetIP6Ex(IP *ip, char *hostname, UINT timeout, bool *cancel) -{ - return GetIP4Ex6Ex(ip, hostname, timeout, true, cancel); -} -bool GetIP4(IP *ip, char *hostname) -{ - return GetIP4Ex(ip, hostname, 0, NULL); -} -bool GetIP6(IP *ip, char *hostname) -{ - return GetIP6Ex(ip, hostname, 0, NULL); -} - -// Perform a DNS forward lookup query -bool GetIP(IP *ip, char *hostname) -{ - return GetIPEx(ip, hostname, false); -} -bool GetIPEx(IP *ip, char *hostname, bool ipv6) -{ - if (ipv6 == false) - { - return GetIP4(ip, hostname); - } - else - { - return GetIP6(ip, hostname); - } -} -bool GetIP6Inner(IP *ip, char *hostname) -{ - struct sockaddr_in6 in; - struct in6_addr addr; - struct addrinfo hint; - struct addrinfo *info; - // Validate arguments - if (ip == NULL || hostname == NULL) - { - return false; - } - - if (IsEmptyStr(hostname)) - { - return false; - } - - if (StrCmpi(hostname, "localhost") == 0) - { - GetLocalHostIP6(ip); - return true; - } - - if (StrToIP6(ip, hostname) == false && StrToIP(ip, hostname) == false) - { - // Forward resolution - Zero(&hint, sizeof(hint)); - hint.ai_family = AF_INET6; - hint.ai_socktype = SOCK_STREAM; - hint.ai_protocol = IPPROTO_TCP; - info = NULL; - - if (getaddrinfo(hostname, NULL, &hint, &info) != 0 || - info->ai_family != AF_INET6) - { - if (info) - { - freeaddrinfo(info); - } - return QueryDnsCacheEx(ip, hostname, true); - } - // Forward resolution success - Copy(&in, info->ai_addr, sizeof(struct sockaddr_in6)); - freeaddrinfo(info); - - Copy(&addr, &in.sin6_addr, sizeof(addr)); - InAddrToIP6(ip, &addr); - } - - // Save Cache - NewDnsCache(hostname, ip); - - return true; -} -bool GetIP4Inner(IP *ip, char *hostname) -{ - struct sockaddr_in in; - struct in_addr addr; - struct addrinfo hint; - struct addrinfo *info; - // Validate arguments - if (ip == NULL || hostname == NULL) - { - return false; - } - - if (IsEmptyStr(hostname)) - { - return false; - } - - if (StrCmpi(hostname, "localhost") == 0) - { - SetIP(ip, 127, 0, 0, 1); - return true; - } - - if (StrToIP6(ip, hostname) == false && StrToIP(ip, hostname) == false) - { - // Forward resolution - Zero(&hint, sizeof(hint)); - hint.ai_family = AF_INET; - hint.ai_socktype = SOCK_STREAM; - hint.ai_protocol = IPPROTO_TCP; - info = NULL; - - if (getaddrinfo(hostname, NULL, &hint, &info) != 0 || - info->ai_family != AF_INET) - { - if (info) - { - freeaddrinfo(info); - } - return QueryDnsCache(ip, hostname); - } - // Forward resolution success - Copy(&in, info->ai_addr, sizeof(struct sockaddr_in)); - freeaddrinfo(info); - Copy(&addr, &in.sin_addr, sizeof(addr)); - InAddrToIP(ip, &addr); - } - - // Save Cache - NewDnsCache(hostname, ip); - - return true; -} - -// Search in the DNS cache -bool QueryDnsCache(IP *ip, char *hostname) -{ - return QueryDnsCacheEx(ip, hostname, false); -} -bool QueryDnsCacheEx(IP *ip, char *hostname, bool ipv6) -{ - DNSCACHE *c; - char tmp[MAX_SIZE]; - // Validate arguments - if (ip == NULL || hostname == NULL) - { - return false; - } - - GenDnsCacheKeyName(tmp, sizeof(tmp), hostname, ipv6); - - c = FindDnsCache(tmp); - if (c == NULL) - { - return false; - } - - Copy(ip, &c->IpAddress, sizeof(IP)); - - return true; -} - -// Convert the IP to a string -void IPToUniStr(wchar_t *str, UINT size, IP *ip) -{ - char tmp[128]; - - IPToStr(tmp, sizeof(tmp), ip); - StrToUni(str, size, tmp); -} - -// Convert the IP to a string (32bit UINT) -void IPToUniStr32(wchar_t *str, UINT size, UINT ip) -{ - char tmp[128]; - - IPToStr32(tmp, sizeof(tmp), ip); - StrToUni(str, size, tmp); -} - -// Convert the IP to a string (32bit UINT) -void IPToStr32(char *str, UINT size, UINT ip) -{ - IP ip_st; - // Validate arguments - if (str == NULL) - { - return; - } - - UINTToIP(&ip_st, ip); - IPToStr(str, size, &ip_st); -} - -// Convert IPv4 or IPv6 to a string -void IPToStr4or6(char *str, UINT size, UINT ip_4_uint, UCHAR *ip_6_bytes) -{ - IP ip4; - IP ip6; - IP ip; - // Validate arguments - if (str == NULL) - { - return; - } - - Zero(&ip, sizeof(ip)); - - UINTToIP(&ip4, ip_4_uint); - SetIP6(&ip6, ip_6_bytes); - - if (IsIP6(&ip4) || (IsZeroIp(&ip4) && (IsZeroIp(&ip6) == false))) - { - Copy(&ip, &ip6, sizeof(IP)); - } - else - { - Copy(&ip, &ip4, sizeof(IP)); - } - - IPToStr(str, size, &ip); -} - -// Convert the IP to a string -void IPToStr(char *str, UINT size, IP *ip) -{ - // Validate arguments - if (str == NULL || ip == NULL) - { - return; - } - - if (IsIP6(ip)) - { - IPToStr6(str, size, ip); - } - else - { - IPToStr4(str, size, ip); - } -} - -// Convert the IPv4 to a string -void IPToStr4(char *str, UINT size, IP *ip) -{ - // Validate arguments - if (str == NULL || ip == NULL) - { - return; - } - - // Conversion - snprintf(str, size != 0 ? size : 64, "%u.%u.%u.%u", ip->addr[0], ip->addr[1], ip->addr[2], ip->addr[3]); -} - -// Convert the string to an IP -bool StrToIP(IP *ip, char *str) -{ - TOKEN_LIST *token; - char *tmp; - UINT i; - // Validate arguments - if (ip == NULL || str == NULL) - { - return false; - } - - if (StrToIP6(ip, str)) - { - return true; - } - - Zero(ip, sizeof(IP)); - - tmp = CopyStr(str); - Trim(tmp); - token = ParseToken(tmp, "."); - Free(tmp); - - if (token->NumTokens != 4) - { - FreeToken(token); - return false; - } - for (i = 0; i < 4; i++) - { - char *s = token->Token[i]; - if (s[0] < '0' || s[0] > '9' || - (ToInt(s) >= 256)) - { - FreeToken(token); - return false; - } - } - Zero(ip, sizeof(IP)); - for (i = 0; i < 4; i++) - { - ip->addr[i] = (UCHAR)ToInt(token->Token[i]); - } - - FreeToken(token); - - return true; -} -UINT StrToIP32(char *str) -{ - IP ip; - // Validate arguments - if (str == NULL) - { - return 0; - } - - if (StrToIP(&ip, str) == false) - { - return 0; - } - - return IPToUINT(&ip); -} -UINT UniStrToIP32(wchar_t *str) -{ - UINT ret; - char *tmp; - - tmp = CopyUniToStr(str); - ret = StrToIP32(tmp); - Free(tmp); - - return ret; -} - -// Convert the IP to the in_addr -void IPToInAddr(struct in_addr *addr, IP *ip) -{ - UINT i; - // Validate arguments - if (addr == NULL || ip == NULL) - { - return; - } - - Zero(addr, sizeof(struct in_addr)); - - if (IsIP6(ip) == false) - { - for (i = 0; i < 4; i++) - { - ((UCHAR *)addr)[i] = ip->addr[i]; - } - } -} - -// Convert the IP to the in6_addr -void IPToInAddr6(struct in6_addr *addr, IP *ip) -{ - UINT i; - // Validate arguments - if (addr == NULL || ip == NULL) - { - return; - } - - Zero(addr, sizeof(struct in6_addr)); - - if (IsIP6(ip)) - { - for (i = 0; i < 16; i++) - { - ((UCHAR *)addr)[i] = ip->ipv6_addr[i]; - } - } -} - -// Convert the in_addr to the IP -void InAddrToIP(IP *ip, struct in_addr *addr) -{ - UINT i; - // Validate arguments - if (ip == NULL || addr == NULL) - { - return; - } - - Zero(ip, sizeof(IP)); - - for (i = 0; i < 4; i++) - { - ip->addr[i] = ((UCHAR *)addr)[i]; - } -} - -// Convert the in6_addr to the IP -void InAddrToIP6(IP *ip, struct in6_addr *addr) -{ - UINT i; - // Validate arguments - if (ip == NULL || addr == NULL) - { - return; - } - - ZeroIP6(ip); - for (i = 0; i < 16; i++) - { - ip->ipv6_addr[i] = ((UCHAR *)addr)[i]; - } -} - -// Search in the DNS cache -DNSCACHE *FindDnsCache(char *hostname) -{ - return FindDnsCacheEx(hostname, false); -} -DNSCACHE *FindDnsCacheEx(char *hostname, bool ipv6) -{ - DNSCACHE *c; - char tmp[MAX_SIZE]; - if (hostname == NULL) - { - return NULL; - } - - GenDnsCacheKeyName(tmp, sizeof(tmp), hostname, ipv6); - - LockDnsCache(); - { - DNSCACHE t; - t.HostName = tmp; - c = Search(DnsCache, &t); - } - UnlockDnsCache(); - - return c; -} - -// Generate the IPv4 / IPv6 key name for the DNS cache -void GenDnsCacheKeyName(char *dst, UINT size, char *src, bool ipv6) -{ - // Validate arguments - if (dst == NULL || src == NULL) - { - return; - } - - if (ipv6 == false) - { - StrCpy(dst, size, src); - } - else - { - Format(dst, size, "%s@ipv6", src); - } -} - -// Registration of the new DNS cache -void NewDnsCache(char *hostname, IP *ip) -{ - NewDnsCacheEx(hostname, ip, IsIP6(ip)); -} -void NewDnsCacheEx(char *hostname, IP *ip, bool ipv6) -{ - DNSCACHE *c; - char tmp[MAX_PATH]; - // Validate arguments - if (hostname == NULL || ip == NULL) - { - return; - } - - if (IsNetworkNameCacheEnabled() == false) - { - return; - } - - GenDnsCacheKeyName(tmp, sizeof(tmp), hostname, ipv6); - - LockDnsCache(); - { - DNSCACHE t; - - // Search for anything matches to the hostname first - t.HostName = tmp; - c = Search(DnsCache, &t); - - if (c == NULL) - { - // Newly register - c = ZeroMalloc(sizeof(DNSCACHE)); - c->HostName = CopyStr(tmp); - - Copy(&c->IpAddress, ip, sizeof(IP)); - - Add(DnsCache, c); - } - else - { - // Update - Copy(&c->IpAddress, ip, sizeof(IP)); - } - } - UnlockDnsCache(); -} - -// Name comparison of the DNS cache entries -int CompareDnsCache(void *p1, void *p2) -{ - DNSCACHE *c1, *c2; - if (p1 == NULL || p2 == NULL) - { - return 0; - } - c1 = *(DNSCACHE **)p1; - c2 = *(DNSCACHE **)p2; - if (c1 == NULL || c2 == NULL) - { - return 0; - } - - return StrCmpi(c1->HostName, c2->HostName); -} - -// Initialization of the DNS cache -void InitDnsCache() -{ - // Creating a List - DnsCache = NewList(CompareDnsCache); -} - -// Release of the DNS cache -void FreeDnsCache() -{ - LockDnsCache(); - { - DNSCACHE *c; - UINT i; - for (i = 0; i < LIST_NUM(DnsCache); i++) - { - // Release the memory for the entry - c = LIST_DATA(DnsCache, i); - Free(c->HostName); - Free(c); - } - } - UnlockDnsCache(); - - // Release the list - ReleaseList(DnsCache); - DnsCache = NULL; -} - -// Lock the DNS cache -void LockDnsCache() -{ - LockList(DnsCache); -} - -// Unlock the DNS cache -void UnlockDnsCache() -{ - UnlockList(DnsCache); -} - -// DH temp key callback -DH *TmpDhCallback(SSL *ssl, int is_export, int keylength) -{ - DH *ret = NULL; - - if (dh_param != NULL) - { - ret = dh_param->dh; - } - - return ret; -} - -// Create the SSL_CTX -struct ssl_ctx_st *NewSSLCtx(bool server_mode) -{ - struct ssl_ctx_st *ctx = SSL_CTX_new(SSLv23_method()); - - // It resets some parameters. - if (server_mode) - { - SSL_CTX_set_ssl_version(ctx, SSLv23_server_method()); - } - else - { - SSL_CTX_set_ssl_version(ctx, SSLv23_client_method()); - } - -#ifdef SSL_OP_NO_SSLv3 - SSL_CTX_set_options(ctx, SSL_OP_NO_SSLv3); -#endif // SSL_OP_NO_SSLv3 - -#ifdef SSL_OP_NO_TICKET - SSL_CTX_set_options(ctx, SSL_OP_NO_TICKET); -#endif // SSL_OP_NO_TICKET - -#ifdef SSL_OP_CIPHER_SERVER_PREFERENCE - if (server_mode) - { - SSL_CTX_set_options(ctx, SSL_OP_CIPHER_SERVER_PREFERENCE); - } -#endif // SSL_OP_CIPHER_SERVER_PREFERENCE - - SSL_CTX_set_tmp_dh_callback(ctx, TmpDhCallback); - -#ifdef SSL_CTX_set_ecdh_auto - SSL_CTX_set_ecdh_auto(ctx, 1); -#endif // SSL_CTX_set_ecdh_auto - - return ctx; -} - -// Release of the SSL_CTX -void FreeSSLCtx(struct ssl_ctx_st *ctx) -{ - // Validate arguments - if (ctx == NULL) - { - return; - } - - SSL_CTX_free(ctx); -} - -// Get OS (maximum) Security Level -UINT GetOSSecurityLevel() -{ - UINT security_level_new = 0, security_level_set_ssl_version = 0; - struct ssl_ctx_st *ctx = SSL_CTX_new(SSLv23_method()); - -#if OPENSSL_VERSION_NUMBER >= 0x10100000L && !defined(LIBRESSL_VERSION_NUMBER) - security_level_new = SSL_CTX_get_security_level(ctx); -#endif - - security_level_set_ssl_version = SSL_CTX_set_ssl_version(ctx, SSLv23_server_method()); - - FreeSSLCtx(ctx); - - if(security_level_new >= security_level_set_ssl_version) - { - return security_level_new; - } - - return security_level_set_ssl_version; -} - -// The number of get ip threads -void SetGetIpThreadMaxNum(UINT num) -{ - max_getip_thread = num; -} -UINT GetGetIpThreadMaxNum() -{ - UINT ret = max_getip_thread; - - if (ret == 0) - { - ret = 0x7FFFFFFF; - } - - return ret; -} -UINT GetCurrentGetIpThreadNum() -{ - return Count(getip_thread_counter); -} - -// Initialize the network communication module -void InitNetwork() -{ - disable_gethostname_by_accept = false; - - - InitDynList(); - - - host_ip_address_list_cache_lock = NewLock(); - host_ip_address_list_cache_last = 0; - - num_tcp_connections = NewCounter(); - - getip_thread_counter = NewCounter(); - - // Initialization of client list - InitIpClientList(); - - // Thread related initialization - InitWaitThread(); - - // Initialization of the host name cache - InitHostCache(); - -#ifdef OS_WIN32 - // Initializing the socket library - Win32InitSocketLibrary(); -#else - UnixInitSocketLibrary(); -#endif // OS_WIN32 - - // Initialization of the DNS cache - InitDnsCache(); - - // Locking initialization - machine_name_lock = NewLock(); - disconnect_function_lock = NewLock(); - aho = NewLock(); - machine_ip_process_hash_lock = NewLock(); - socket_library_lock = NewLock(); - //ssl_connect_lock = NewLock(); //2012.9.28 Not required for recent OpenSSL -// ssl_accept_lock = NewLock(); - dns_lock = NewLock(); - unix_dns_server_addr_lock = NewLock(); - Zero(&unix_dns_server, sizeof(unix_dns_server)); - local_mac_list_lock = NewLock(); - - current_global_ip_lock = NewLock(); - current_fqdn_lock = NewLock(); - current_global_ip_set = false; - - disable_cache = false; - - Zero(rand_port_numbers, sizeof(rand_port_numbers)); - - SetGetIpThreadMaxNum(DEFAULT_GETIP_THREAD_MAX_NUM); -} - -// Enable the network name cache -void EnableNetworkNameCache() -{ - disable_cache = false; -} - -// Disable the network name cache -void DisableNetworkNameCache() -{ - disable_cache = true; -} - -// Get whether the network name cache is enabled -bool IsNetworkNameCacheEnabled() -{ - return !disable_cache; -} - -// Get the cipher algorithm list -TOKEN_LIST *GetCipherList() -{ - UINT i; - SSL *ssl; - SSL_CTX *ctx; - const char *name; - STACK_OF(SSL_CIPHER) *sk; - - TOKEN_LIST *ciphers = ZeroMalloc(sizeof(TOKEN_LIST)); - - ctx = NewSSLCtx(true); - if (ctx == NULL) - { - return ciphers; - } - - ssl = SSL_new(ctx); - if (ssl == NULL) - { - FreeSSLCtx(ctx); - return ciphers; - } - -#if OPENSSL_VERSION_NUMBER >= 0x10100000L && !defined(LIBRESSL_VERSION_NUMBER) - sk = SSL_get1_supported_ciphers(ssl); -#else - sk = SSL_get_ciphers(ssl); -#endif - - for (i = 0; i < (UINT)sk_SSL_CIPHER_num(sk); i++) - { - const SSL_CIPHER *c = sk_SSL_CIPHER_value(sk, i); - - name = SSL_CIPHER_get_name(c); - if (IsEmptyStr((char *)name)) - { - break; - } - - ciphers->NumTokens++; - - if (ciphers->Token != NULL) - { - ciphers->Token = ReAlloc(ciphers->Token, sizeof(char *) * ciphers->NumTokens); - } - else - { - ciphers->Token = Malloc(sizeof(char *)); - } - - ciphers->Token[i] = CopyStr((char *)name); - } - - sk_SSL_CIPHER_free(sk); - SSL_free(ssl); - - return ciphers; -} - -// Get the TCP connections counter -COUNTER *GetNumTcpConnectionsCounter() -{ - return num_tcp_connections; -} - -// Get the current global IP address -bool GetCurrentGlobalIP(IP *ip, bool ipv6) -{ - bool ret = false; - // Validate arguments - if (ip == NULL) - { - return false; - } - - Zero(ip, sizeof(IP)); - - Lock(current_global_ip_lock); - { - if (ipv6 == false) - { - Copy(ip, ¤t_glocal_ipv4, sizeof(IP)); - } - else - { - Copy(ip, ¤t_glocal_ipv6, sizeof(IP)); - } - - ret = current_global_ip_set; - } - Unlock(current_global_ip_lock); - - return ret; -} - -// Check whether the specified IP address is assigned to the local host -bool IsIPMyHost(IP *ip) -{ - LIST *o; - UINT i; - bool ret = false; - // Validate arguments - if (ip == NULL) - { - return false; - } - - if (IsZeroIp(ip)) - { - return false; - } - - // Search to check whether it matches to any of the IP of the local host - o = GetHostIPAddressList(); - - for (i = 0; i < LIST_NUM(o); i++) - { - IP *p = LIST_DATA(o, i); - - if (CmpIpAddr(p, ip) == 0) - { - // Matched - ret = true; - break; - } - } - - FreeHostIPAddressList(o); - - if (ret == false) - { - if (IsLocalHostIP(ip)) - { - // localhost IP addresses - ret = true; - } - } - - return ret; -} - -// Check whether the specified IP address is a private IP address -bool IsIPPrivate(IP *ip) -{ - // Validate arguments - if (ip == NULL) - { - return false; - } - - if (ip->addr[0] == 10) - { - return true; - } - - if (ip->addr[0] == 172) - { - if (ip->addr[1] >= 16 && ip->addr[1] <= 31) - { - return true; - } - } - - if (ip->addr[0] == 192 && ip->addr[1] == 168) - { - return true; - } - - if (ip->addr[0] == 169 && ip->addr[1] == 254) - { - return true; - } - - if (ip->addr[0] == 100) - { - if (ip->addr[1] >= 64 && ip->addr[1] <= 127) - { - return true; - } - } - - if (g_private_ip_list != NULL) - { - if (IsIP4(ip)) - { - UINT ip4 = IPToUINT(ip); - - return IsOnPrivateIPFile(ip4); - } - } - - return false; -} - -// Read a private IP list file -void LoadPrivateIPFile() -{ - BUF *b = ReadDump(PRIVATE_IP_TXT_FILENAME); - LIST *o; - if (b == NULL) - { - return; - } - - o = NewList(NULL); - - while (true) - { - char *line = CfgReadNextLine(b); - if (line == NULL) - { - break; - } - - Trim(line); - - if (IsEmptyStr(line) == false) - { - UINT ip = 0, mask = 0; - - if (ParseIpAndSubnetMask4(line, &ip, &mask)) - { - PRIVATE_IP_SUBNET *p = ZeroMalloc(sizeof(PRIVATE_IP_SUBNET)); - - p->Ip = ip; - p->Mask = mask; - p->Ip2 = ip & mask; - - Add(o, p); - } - } - - Free(line); - } - - g_private_ip_list = o; - g_use_privateip_file = true; - - FreeBuf(b); -} - -// Examine whether the specified IP address is in the private IP file -bool IsOnPrivateIPFile(UINT ip) -{ - bool ret = false; - - if (g_private_ip_list != NULL) - { - LIST *o = g_private_ip_list; - UINT i; - - for (i = 0; i < LIST_NUM(o); i++) - { - PRIVATE_IP_SUBNET *p = LIST_DATA(o, i); - - if ((ip & p->Mask) == p->Ip2) - { - ret = true; - } - } - } - - return ret; -} - -// Free the private IP file -void FreePrivateIPFile() -{ - if (g_private_ip_list != NULL) - { - LIST *o = g_private_ip_list; - UINT i; - - g_private_ip_list = NULL; - - for (i = 0; i < LIST_NUM(o); i++) - { - PRIVATE_IP_SUBNET *p = LIST_DATA(o, i); - - Free(p); - } - - ReleaseList(o); - } - - g_use_privateip_file = false; -} - -// Check whether the specified IP address is in the same network to this computer -bool IsIPAddressInSameLocalNetwork(IP *a) -{ - bool ret = false; - LIST *o; - UINT i; - // Validate arguments - if (a == NULL) - { - return false; - } - - o = GetHostIPAddressList(); - - if (o != NULL) - { - for (i = 0; i < LIST_NUM(o); i++) - { - IP *p = LIST_DATA(o, i); - - if (IsIP4(p)) - { - if (IsZeroIp(p) == false && p->addr[0] != 127) - { - if (IsInSameNetwork4Standard(p, a)) - { - ret = true; - break; - } - } - } - } - - FreeHostIPAddressList(o); - } - - return ret; -} - -// Guess the IPv4, IPv6 global address from the IP address list of the current interface -void GetCurrentGlobalIPGuess(IP *ip, bool ipv6) -{ - LIST *o; - UINT i; - // Validate arguments - if (ip == NULL) - { - return; - } - - Zero(ip, sizeof(IP)); - - o = GetHostIPAddressList(); - - if (ipv6 == false) - { - // IPv4 - for (i = 0; i < LIST_NUM(o); i++) - { - IP *p = LIST_DATA(o, i); - - if (IsIP4(p)) - { - if (IsZeroIp(p) == false && IsIPPrivate(p) == false && p->addr[0] != 127) - { - Copy(ip, p, sizeof(IP)); - } - } - } - - if (IsZeroIp(ip)) - { - for (i = 0; i < LIST_NUM(o); i++) - { - IP *p = LIST_DATA(o, i); - - if (IsIP4(p)) - { - if (IsZeroIp(p) == false && IsIPPrivate(p) && p->addr[0] != 127) - { - Copy(ip, p, sizeof(IP)); - } - } - } - } - - if (IsZeroIp(ip)) - { - SetIP(ip, 127, 0, 0, 1); - } - } - else - { - // IPv6 - for (i = 0; i < LIST_NUM(o); i++) - { - IP *p = LIST_DATA(o, i); - - if (IsIP6(p)) - { - UINT type = GetIPAddrType6(p); - - if ((type & IPV6_ADDR_GLOBAL_UNICAST) && ((type & IPV6_ADDR_ZERO) == 0) && ((type & IPV6_ADDR_LOOPBACK) == 0)) - { - Copy(ip, p, sizeof(IP)); - } - } - } - } - - FreeHostIPAddressList(o); -} - -// Record the current global IP address -void SetCurrentGlobalIP(IP *ip, bool ipv6) -{ - // Validate arguments - if (ip == NULL) - { - return; - } - - if (IsZeroIp(ip)) - { - return; - } - - Lock(current_global_ip_lock); - { - if (ipv6 == false) - { - Copy(¤t_glocal_ipv4, ip, sizeof(IP)); - } - else - { - Copy(¤t_glocal_ipv6, ip, sizeof(IP)); - } - - current_global_ip_set = true; - } - Unlock(current_global_ip_lock); -} - -// Release of the network communication module -void FreeNetwork() -{ - - if (dh_param != NULL) - { - DhFree(dh_param); - dh_param = NULL; - } - - // Release of thread-related - FreeWaitThread(); - - Zero(&unix_dns_server, sizeof(unix_dns_server)); - - // Release the locks - DeleteLock(unix_dns_server_addr_lock); - DeleteLock(dns_lock); - DeleteLock(ssl_accept_lock); - DeleteLock(machine_name_lock); - DeleteLock(disconnect_function_lock); - DeleteLock(aho); - DeleteLock(socket_library_lock); - DeleteLock(ssl_connect_lock); - DeleteLock(machine_ip_process_hash_lock); - machine_name_lock = NULL; - ssl_accept_lock = machine_name_lock = disconnect_function_lock = - aho = socket_library_lock = ssl_connect_lock = machine_ip_process_hash_lock = NULL; - - // Release of the DNS cache - FreeDnsCache(); - - // Release of the host name cache - FreeHostCache(); - -#ifdef OS_WIN32 - // Release of the socket library - Win32FreeSocketLibrary(); -#else - UnixFreeSocketLibrary(); -#endif // OS_WIN32 - - DeleteCounter(num_tcp_connections); - num_tcp_connections = NULL; - - // Release of client list - FreeIpClientList(); - - DeleteLock(current_global_ip_lock); - current_global_ip_lock = NULL; - - DeleteLock(current_fqdn_lock); - current_fqdn_lock = NULL; - - // Release of the local MAC list - if (local_mac_list != NULL) - { - FreeNicList(local_mac_list); - local_mac_list = NULL; - } - - DeleteLock(local_mac_list_lock); - local_mac_list_lock = NULL; - - DeleteLock(host_ip_address_list_cache_lock); - host_ip_address_list_cache_lock = NULL; - - FreeHostIPAddressList(host_ip_address_cache); - host_ip_address_cache = NULL; - - - FreeDynList(); - - DeleteCounter(getip_thread_counter); - getip_thread_counter = NULL; - -} - -// Stop all the sockets in the list and delete it -void StopSockList(SOCKLIST *sl) -{ - SOCK **ss; - UINT num, i; - // Validate arguments - if (sl == NULL) - { - return; - } - - LockList(sl->SockList); - { - num = LIST_NUM(sl->SockList); - ss = ToArray(sl->SockList); - - DeleteAll(sl->SockList); - } - UnlockList(sl->SockList); - - for (i = 0; i < num; i++) - { - SOCK *s = ss[i]; - - Disconnect(s); - ReleaseSock(s); - } - - Free(ss); -} - -// Delete the socket list -void FreeSockList(SOCKLIST *sl) -{ - // Validate arguments - if (sl == NULL) - { - return; - } - - StopSockList(sl); - - ReleaseList(sl->SockList); - - Free(sl); -} - -// Creating a socket list -SOCKLIST *NewSockList() -{ - SOCKLIST *sl = ZeroMallocFast(sizeof(SOCKLIST)); - - sl->SockList = NewList(NULL); - - return sl; -} - -// Time-out thread of the socket on Solaris -void SocketTimeoutThread(THREAD *t, void *param) -{ - SOCKET_TIMEOUT_PARAM *ttparam; - ttparam = (SOCKET_TIMEOUT_PARAM *)param; - - // Wait for time-out period - Select(NULL, ttparam->sock->TimeOut, ttparam->cancel, NULL); - - // Disconnect if it is blocked - if(! ttparam->unblocked) - { -// Debug("Socket timeouted\n"); - closesocket(ttparam->sock->socket); - } - else - { -// Debug("Socket timeout cancelled\n"); - } -} - -// Initialize and start the thread for time-out -SOCKET_TIMEOUT_PARAM *NewSocketTimeout(SOCK *sock) -{ - SOCKET_TIMEOUT_PARAM *ttp; - if(! sock->AsyncMode && sock->TimeOut != TIMEOUT_INFINITE) - { -// Debug("NewSockTimeout(%u)\n",sock->TimeOut); - - ttp = (SOCKET_TIMEOUT_PARAM *)Malloc(sizeof(SOCKET_TIMEOUT_PARAM)); - - // Set the parameters of the time-out thread - ttp->cancel = NewCancel(); - ttp->sock = sock; - ttp->unblocked = false; - ttp->thread = NewThread(SocketTimeoutThread, ttp); - return ttp; - } - return NULL; -} - -// Stop and free the thread for timeout -void FreeSocketTimeout(SOCKET_TIMEOUT_PARAM *ttp) -{ - if(ttp == NULL) - { - return; - } - - ttp->unblocked = true; - Cancel(ttp->cancel); - WaitThread(ttp->thread, INFINITE); - ReleaseCancel(ttp->cancel); - ReleaseThread(ttp->thread); - Free(ttp); -// Debug("FreeSocketTimeout succeed\n"); - return; -} - -// Parse the IP address and subnet mask -bool ParseIpAndSubnetMask46(char *src, IP *ip, IP *mask) -{ - // Validate arguments - if (src == NULL || ip == NULL || mask == NULL) - { - return false; - } - - if (ParseIpAndMask46(src, ip, mask) == false) - { - return false; - } - - if (IsIP4(ip)) - { - return IsSubnetMask4(mask); - } - else - { - return IsSubnetMask6(mask); - } -} -bool ParseIpAndSubnetMask4(char *src, UINT *ip, UINT *mask) -{ - IP ip2, mask2; - // Validate arguments - if (src == NULL) - { - return false; - } - - if (ParseIpAndSubnetMask46(src, &ip2, &mask2) == false) - { - return false; - } - - if (IsIP4(&ip2) == false) - { - return false; - } - - if (ip != NULL) - { - *ip = IPToUINT(&ip2); - } - - if (mask != NULL) - { - *mask = IPToUINT(&mask2); - } - - return true; -} - - -// Parse the IP address and the mask -bool ParseIpAndMask46(char *src, IP *ip, IP *mask) -{ - TOKEN_LIST *t; - char *ipstr; - char *subnetstr; - bool ret = false; - IP ip2; - IP mask2; - // Validate arguments - if (src == NULL || ip == NULL || mask == NULL) - { - return false; - } - - Zero(&ip2, sizeof(IP)); - Zero(&mask2, sizeof(IP)); - - t = ParseToken(src, "/"); - if (t->NumTokens != 2) - { - FreeToken(t); - return false; - } - - ipstr = t->Token[0]; - subnetstr = t->Token[1]; - Trim(ipstr); - Trim(subnetstr); - - if (StrToIP(&ip2, ipstr)) - { - if (StrToIP(&mask2, subnetstr)) - { - // Compare the kind of the mask part and the IP address part to confirm same - if (IsIP6(&ip2) && IsIP6(&mask2)) - { - // Both are IPv6 - ret = true; - Copy(ip, &ip2, sizeof(IP)); - Copy(mask, &mask2, sizeof(IP)); - } - else if (IsIP4(&ip2) && IsIP4(&mask2)) - { - // Both are IPv4 - ret = true; - Copy(ip, &ip2, sizeof(IP)); - Copy(mask, &mask2, sizeof(IP)); - } - } - else - { - if (IsNum(subnetstr)) - { - UINT i = ToInt(subnetstr); - // Mask part is a number - if (IsIP6(&ip2) && i <= 128) - { - ret = true; - Copy(ip, &ip2, sizeof(IP)); - IntToSubnetMask6(mask, i); - } - else if (i <= 32) - { - ret = true; - Copy(ip, &ip2, sizeof(IP)); - IntToSubnetMask4(mask, i); - } - } - } - } - - FreeToken(t); - - return ret; -} -bool ParseIpAndMask4(char *src, UINT *ip, UINT *mask) -{ - IP ip_ip, ip_mask; - if (ParseIpAndMask46(src, &ip_ip, &ip_mask) == false) - { - return false; - } - - if (IsIP4(&ip_ip) == false) - { - return false; - } - - if (ip != NULL) - { - *ip = IPToUINT(&ip_ip); - } - - if (mask != NULL) - { - *mask = IPToUINT(&ip_mask); - } - - return true; -} -bool ParseIpAndMask6(char *src, IP *ip, IP *mask) -{ - if (ParseIpAndMask46(src, ip, mask) == false) - { - return false; - } - - if (IsIP6(ip) == false) - { - return false; - } - - return true; -} - - -// Check whether the specification of the IPv4 address is correct -bool IsIpStr4(char *str) -{ - // Validate arguments - if (str == NULL) - { - return false; - } - - if (StrToIP32(str) == 0 && StrCmpi(str, "0.0.0.0") != 0) - { - return false; - } - - return true; -} - -// Check whether the specification of the IPv6 address is correct -bool IsIpStr6(char *str) -{ - IP ip; - // Validate arguments - if (str == NULL) - { - return false; - } - - if (StrToIP6(&ip, str) == false) - { - return false; - } - - return true; -} - -// Convert the string to an IPv6 mask -bool StrToMask6(IP *mask, char *str) -{ - // Validate arguments - if (mask == NULL || str == NULL) - { - return false; - } - - if (str[0] == '/') - { - str++; - } - - if (IsNum(str)) - { - UINT n = ToInt(str); - - if (n <= 128) - { - IntToSubnetMask6(mask, n); - return true; - } - else - { - return false; - } - } - else - { - if (StrToIP(mask, str) == false) - { - return false; - } - else - { - return IsIP6(mask); - } - } -} -bool StrToMask6Addr(IPV6_ADDR *mask, char *str) -{ - IP ip; - - if (StrToMask6(&ip, str) == false) - { - return false; - } - - if (IPToIPv6Addr(mask, &ip) == false) - { - return false; - } - - return true; -} - -// Convert the IPv4 / IPv6 mask to a string -void MaskToStr(char *str, UINT size, IP *mask) -{ - MaskToStrEx(str, size, mask, false); -} -void MaskToStrEx(char *str, UINT size, IP *mask, bool always_full_address) -{ - // Validate arguments - if (str == NULL || mask == NULL) - { - return; - } - - if (always_full_address == false && IsSubnetMask(mask)) - { - ToStr(str, SubnetMaskToInt(mask)); - } - else - { - IPToStr(str, size, mask); - } -} -void MaskToStr32(char *str, UINT size, UINT mask) -{ - MaskToStr32Ex(str, size, mask, false); -} -void MaskToStr32Ex(char *str, UINT size, UINT mask, bool always_full_address) -{ - IP ip; - - UINTToIP(&ip, mask); - - MaskToStrEx(str, size, &ip, always_full_address); -} -void Mask6AddrToStrEx(char *str, UINT size, IPV6_ADDR *mask, bool always_full_address) -{ - IP ip; - - // Validate arguments - if (str == NULL || mask == NULL) - { - StrCpy(str, size, ""); - return; - } - - IPv6AddrToIP(&ip, mask); - - MaskToStrEx(str, size, &ip, always_full_address); -} -void Mask6AddrToStr(char *str, UINT size, IPV6_ADDR *mask) -{ - Mask6AddrToStrEx(str, size, mask, false); -} - -// Disconnecting of the tube -void TubeDisconnect(TUBE *t) -{ - // Validate arguments - if (t == NULL) - { - return; - } - - if (t->TubePairData == NULL) - { - return; - } - - Lock(t->TubePairData->Lock); - { - t->TubePairData->IsDisconnected = true; - - Set(t->TubePairData->Event1); - Set(t->TubePairData->Event2); - SetSockEvent(t->TubePairData->SockEvent1); - SetSockEvent(t->TubePairData->SockEvent2); - } - Unlock(t->TubePairData->Lock); -} - -// Creating a tube pair -void NewTubePair(TUBE **t1, TUBE **t2, UINT size_of_header) -{ - TUBEPAIR_DATA *d; - // Validate arguments - if (t1 == NULL || t2 == NULL) - { - return; - } - - *t1 = NewTube(size_of_header); - *t2 = NewTube(size_of_header); - - (*t1)->IndexInTubePair = 0; - (*t2)->IndexInTubePair = 1; - - d = NewTubePairData(); - AddRef(d->Ref); - - (*t1)->TubePairData = d; - (*t2)->TubePairData = d; - - d->Event1 = (*t1)->Event; - d->Event2 = (*t2)->Event; - - AddRef(d->Event1->ref); - AddRef(d->Event2->ref); -} - -// Creating a tube pair data -TUBEPAIR_DATA *NewTubePairData() -{ - TUBEPAIR_DATA *d = ZeroMalloc(sizeof(TUBEPAIR_DATA)); - - d->Ref = NewRef(); - - d->Lock = NewLock(); - - return d; -} - -// Set the SockEvent to the tube -void SetTubeSockEvent(TUBE *t, SOCK_EVENT *e) -{ - // Validate arguments - if (t == NULL) - { - return; - } - - Lock(t->Lock); - { - TUBEPAIR_DATA *d; - - if (t->SockEvent != e) - { - if (t->SockEvent != NULL) - { - ReleaseSockEvent(t->SockEvent); - } - - if (e != NULL) - { - AddRef(e->ref); - } - - t->SockEvent = e; - } - - d = t->TubePairData; - - if (d != NULL) - { - Lock(d->Lock); - { - SOCK_EVENT **sep = (t->IndexInTubePair == 0 ? &d->SockEvent1 : &d->SockEvent2); - - if (*sep != e) - { - if (*sep != NULL) - { - ReleaseSockEvent(*sep); - } - - if (e != NULL) - { - AddRef(e->ref); - } - - *sep = e; - } - } - Unlock(d->Lock); - } - } - Unlock(t->Lock); -} - -// Release of the tube pair data -void ReleaseTubePairData(TUBEPAIR_DATA *d) -{ - // Validate arguments - if (d == NULL) - { - return; - } - - if (Release(d->Ref) == 0) - { - CleanupTubePairData(d); - } -} -void CleanupTubePairData(TUBEPAIR_DATA *d) -{ - // Validate arguments - if (d == NULL) - { - return; - } - - ReleaseEvent(d->Event1); - ReleaseEvent(d->Event2); - - ReleaseSockEvent(d->SockEvent1); - ReleaseSockEvent(d->SockEvent2); - - DeleteLock(d->Lock); - - Free(d); -} - -// Check whether the tube is connected to the opponent still -bool IsTubeConnected(TUBE *t) -{ - // Validate arguments - if (t == NULL) - { - return false; - } - - if (t->TubePairData == NULL) - { - return true; - } - - if (t->TubePairData->IsDisconnected) - { - return false; - } - - return true; -} - -// Send the data to the tube -bool TubeSend(TUBE *t, void *data, UINT size, void *header) -{ - return TubeSendEx(t, data, size, header, false); -} -bool TubeSendEx(TUBE *t, void *data, UINT size, void *header, bool no_flush) -{ - return TubeSendEx2(t, data, size, header, no_flush, 0); -} -bool TubeSendEx2(TUBE *t, void *data, UINT size, void *header, bool no_flush, UINT max_num_in_queue) -{ - // Validate arguments - if (t == NULL || data == NULL || size == 0) - { - return false; - } - - if (IsTubeConnected(t) == false) - { - return false; - } - - LockQueue(t->Queue); - { - if (max_num_in_queue == 0 || (t->Queue->num_item <= max_num_in_queue)) - { - InsertQueue(t->Queue, NewTubeData(data, size, header, t->SizeOfHeader)); - } - else - { - no_flush = true; - } - } - UnlockQueue(t->Queue); - - if (no_flush == false) - { - Set(t->Event); - SetSockEvent(t->SockEvent); - } - - return true; -} - -// Flush the tube -void TubeFlush(TUBE *t) -{ - TubeFlushEx(t, false); -} -void TubeFlushEx(TUBE *t, bool force) -{ - // Validate arguments - if (t == NULL) - { - return; - } - - if (IsTubeConnected(t) == false) - { - return; - } - - if (force == false) - { - if (t->Queue->num_item == 0) - { - return; - } - } - - Set(t->Event); - SetSockEvent(t->SockEvent); -} - -// Receive the data from the tube (asynchronous) -TUBEDATA *TubeRecvAsync(TUBE *t) -{ - TUBEDATA *d; - // Validate arguments - if (t == NULL) - { - return NULL; - } - - if (IsTubeConnected(t) == false) - { - return NULL; - } - - LockQueue(t->Queue); - { - d = GetNext(t->Queue); - } - UnlockQueue(t->Queue); - - return d; -} - -// Get the SockEvent associated with the tube -SOCK_EVENT *GetTubeSockEvent(TUBE *t) -{ - SOCK_EVENT *e = NULL; - // Validate arguments - if (t == NULL) - { - return NULL; - } - - Lock(t->Lock); - { - if (t->SockEvent != NULL) - { - AddRef(t->SockEvent->ref); - - e = t->SockEvent; - } - } - Unlock(t->Lock); - - return e; -} - -// Receive the data from the tube (synchronous) -TUBEDATA *TubeRecvSync(TUBE *t, UINT timeout) -{ - UINT64 start_tick, timeout_tick; - TUBEDATA *d = NULL; - // Validate arguments - if (t == NULL) - { - return NULL; - } - - if (IsTubeConnected(t) == false) - { - return NULL; - } - - start_tick = Tick64(); - timeout_tick = start_tick + (UINT64)timeout; - - while (true) - { - UINT64 now = Tick64(); - UINT remain_time; - SOCK_EVENT *e; - UINT interval; - - d = NULL; - - if (IsTubeConnected(t) == false) - { - break; - } - - LockQueue(t->Queue); - { - d = GetNext(t->Queue); - } - UnlockQueue(t->Queue); - - if (d != NULL) - { - break; - } - - if (timeout != INFINITE && now >= timeout_tick) - { - return NULL; - } - - remain_time = (UINT)(timeout_tick - now); - - e = GetTubeSockEvent(t); - - interval = (timeout == INFINITE ? INFINITE : remain_time); - - if (e == NULL) - { - Wait(t->Event, interval); - } - else - { - WaitSockEvent(e, interval); - - ReleaseSockEvent(e); - } - } - - return d; -} - -// Creating a tube -TUBE *NewTube(UINT size_of_header) -{ - TUBE *t = ZeroMalloc(sizeof(TUBE)); - - t->Event = NewEvent(); - t->Queue = NewQueue(); - t->Ref = NewRef(); - t->Lock = NewLock(); - t->SockEvent = NewSockEvent(); - - t->SizeOfHeader = size_of_header; - - return t; -} - -// Release of the tube -void ReleaseTube(TUBE *t) -{ - // Validate arguments - if (t == NULL) - { - return; - } - - if (Release(t->Ref) == 0) - { - CleanupTube(t); - } -} -void CleanupTube(TUBE *t) -{ - // Validate arguments - if (t == NULL) - { - return; - } - - while (true) - { - TUBEDATA *d = GetNext(t->Queue); - if (d == NULL) - { - break; - } - - FreeTubeData(d); - } - - ReleaseQueue(t->Queue); - ReleaseEvent(t->Event); - ReleaseSockEvent(t->SockEvent); - - ReleaseTubePairData(t->TubePairData); - - DeleteLock(t->Lock); - - Free(t); -} - -// Creating a tube data -TUBEDATA *NewTubeData(void *data, UINT size, void *header, UINT header_size) -{ - TUBEDATA *d; - // Validate arguments - if (size == 0 || data == NULL) - { - return NULL; - } - - d = ZeroMalloc(sizeof(TUBEDATA)); - - d->Data = Clone(data, size); - d->DataSize = size; - if (header != NULL) - { - d->Header = Clone(header, header_size); - d->HeaderSize = header_size; - } - else - { - d->Header = ZeroMalloc(header_size); - } - - return d; -} - -// Release of the tube data -void FreeTubeData(TUBEDATA *d) -{ - // Validate arguments - if (d == NULL) - { - return; - } - - Free(d->Data); - Free(d->Header); - - Free(d); -} - -// Release of the IP address list of the host -void FreeHostIPAddressList(LIST *o) -{ - UINT i; - // Validate arguments - if (o == NULL) - { - return; - } - - for (i = 0; i < LIST_NUM(o); i++) - { - IP *ip = LIST_DATA(o, i); - - Free(ip); - } - - ReleaseList(o); -} - -// Get whether the specified IP address is held by this host -bool IsMyIPAddress(IP *ip) -{ - LIST *o; - UINT i; - bool ret = false; - // Validate arguments - if (ip == NULL) - { - return false; - } - - o = GetHostIPAddressList(); - - for (i = 0; i < LIST_NUM(o); i++) - { - IP *a = LIST_DATA(o, i); - - if (CmpIpAddr(ip, a) == 0) - { - ret = true; - break; - } - } - - FreeHostIPAddressList(o); - - return ret; -} - -// Add the IP address to the list -void AddHostIPAddressToList(LIST *o, IP *ip) -{ - IP *r; - // Validate arguments - if (o == NULL || ip == NULL) - { - return; - } - - r = Search(o, ip); - if (r != NULL) - { - return; - } - - Insert(o, Clone(ip, sizeof(IP))); -} - -// Comparison of the IP address list items -int CmpIpAddressList(void *p1, void *p2) -{ - IP *ip1, *ip2; - UINT r; - // Validate arguments - if (p1 == NULL || p2 == NULL) - { - return 0; - } - ip1 = *(IP **)p1; - ip2 = *(IP **)p2; - if (ip1 == NULL || ip2 == NULL) - { - return 0; - } - - // IPv4 < IPv6 - r = COMPARE_RET(IsIP6(ip1), IsIP6(ip2)); - if (r != 0) - { - return r; - } - - // any > specified IP - if (IsZeroIP(ip1) && IsZeroIP(ip2) == false) - { - return 1; - } - if (IsZeroIP(ip1) == false && IsZeroIP(ip2)) - { - return -1; - } - - // local > others - if (IsLocalHostIP(ip1) && IsLocalHostIP(ip2) == false) - { - return 1; - } - if (IsLocalHostIP(ip1) == false && IsLocalHostIP(ip2)) - { - return -1; - } - - // ip address - r = CmpIpAddr(ip1, ip2); - if (r != 0) - { - return r; - } - - // interface index - if (IsIP6(ip1)) - { - r = COMPARE_RET(ip1->ipv6_scope_id, ip2->ipv6_scope_id); - } - else - { - r = 0; - } - - return r; -} - -// Get the IP address list hash of the host -UINT64 GetHostIPAddressListHash() -{ - UINT i; - LIST *o; - BUF *buf = NewBuf(); - UCHAR hash[SHA1_SIZE]; - UINT64 ret = 0; - - o = GetHostIPAddressList(); - - if (o != NULL) - { - for (i = 0; i < LIST_NUM(o); i++) - { - IP *ip = LIST_DATA(o, i); - char tmp[128]; - - Zero(tmp, sizeof(tmp)); - IPToStr(tmp, sizeof(tmp), ip); - - WriteBufStr(buf, tmp); - } - - FreeHostIPAddressList(o); - } - - WriteBufStr(buf, "test"); - - Sha1(hash, buf->Buf, buf->Size); - - FreeBuf(buf); - - Copy(&ret, hash, sizeof(UINT64)); - - ret = Endian64(ret); - - return ret; -} - -// Get the IP address list of the host (using cache) -LIST *GetHostIPAddressList() -{ - LIST *o = NULL; - if (host_ip_address_list_cache_lock == NULL) - { - return GetHostIPAddressListInternal(); - } - - Lock(host_ip_address_list_cache_lock); - { - UINT64 now = Tick64(); - - if (host_ip_address_list_cache_last == 0 || - ((host_ip_address_list_cache_last + (UINT64)HOST_IP_ADDRESS_LIST_CACHE) < now) || - host_ip_address_cache == NULL) - { - if (host_ip_address_cache != NULL) - { - FreeHostIPAddressList(host_ip_address_cache); - } - - host_ip_address_cache = GetHostIPAddressListInternal(); - - host_ip_address_list_cache_last = now; - } - - o = CloneIPAddressList(host_ip_address_cache); - } - Unlock(host_ip_address_list_cache_lock); - - if (o == NULL) - { - o = GetHostIPAddressListInternal(); - } - - return o; -} - -// Copy of the IP address list -LIST *CloneIPAddressList(LIST *o) -{ - LIST *ret; - UINT i; - // Validate arguments - if (o == NULL) - { - return NULL; - } - - ret = NewListFast(CmpIpAddressList); - - for (i = 0; i < LIST_NUM(o); i++) - { - IP *ip = LIST_DATA(o, i); - - if (ip != NULL) - { - ip = Clone(ip, sizeof(IP)); - - Add(ret, ip); - } - } - - return ret; -} - -// Get an IP address list of the host -LIST *GetHostIPAddressListInternal() -{ - char hostname[MAX_SIZE]; - LIST *o; - IP any6, any4; - IP local6, local4; - bool is_v6_supported = IsIPv6Supported(); - - GetLocalHostIP4(&local4); - GetLocalHostIP6(&local6); - - ZeroIP4(&any4); - ZeroIP6(&any6); - - Zero(hostname, sizeof(hostname)); - - gethostname(hostname, sizeof(hostname)); - - o = NewListFast(CmpIpAddressList); - - // any - AddHostIPAddressToList(o, &any4); - if (is_v6_supported) - { - AddHostIPAddressToList(o, &any6); - } - - // localhost - AddHostIPAddressToList(o, &local4); - if (is_v6_supported) - { - AddHostIPAddressToList(o, &local6); - } - -#ifndef MAYAQUA_SUPPORTS_GETIFADDRS - // IPv4 - if (true) - { - struct sockaddr_in in; - struct in_addr addr; - struct addrinfo hint; - struct addrinfo *info; - - Zero(&hint, sizeof(hint)); - hint.ai_family = AF_INET; - hint.ai_socktype = SOCK_DGRAM; - hint.ai_protocol = IPPROTO_UDP; - info = NULL; - - if (getaddrinfo(hostname, NULL, &hint, &info) == 0) - { - if (info->ai_family == AF_INET) - { - struct addrinfo *current = info; - while (current != NULL) - { - IP ip; - - Copy(&in, current->ai_addr, sizeof(in)); - Copy(&addr, &in.sin_addr, sizeof(addr)); - - InAddrToIP(&ip, &addr); - AddHostIPAddressToList(o, &ip); - - current = current->ai_next; - } - } - - freeaddrinfo(info); - } - } - -#ifndef UNIX_LINUX - // IPv6 - if (is_v6_supported) - { - struct sockaddr_in6 in; - struct in6_addr addr; - struct addrinfo hint; - struct addrinfo *info; - - Zero(&hint, sizeof(hint)); - hint.ai_family = AF_INET6; - hint.ai_socktype = SOCK_DGRAM; - hint.ai_protocol = IPPROTO_UDP; - info = NULL; - - if (getaddrinfo(hostname, NULL, &hint, &info) == 0) - { - if (info->ai_family == AF_INET6) - { - struct addrinfo *current = info; - while (current != NULL) - { - IP ip; - - Copy(&in, current->ai_addr, sizeof(in)); - Copy(&addr, &in.sin6_addr, sizeof(addr)); - - InAddrToIP6(&ip, &addr); - ip.ipv6_scope_id = in.sin6_scope_id; - - AddHostIPAddressToList(o, &ip); - - current = current->ai_next; - } - } - - freeaddrinfo(info); - } - } -#endif // UNIX_LINUX -#endif // MAYAQUA_SUPPORTS_GETIFADDRS - -#ifdef MAYAQUA_SUPPORTS_GETIFADDRS - // If the getifaddrs is available, use this - if (true) - { - struct ifaddrs *aa = NULL; - - if (getifaddrs(&aa) == 0) - { - struct ifaddrs *a = aa; - - while (a != NULL) - { - if (a->ifa_addr != NULL) - { - struct sockaddr *addr = a->ifa_addr; - - if (addr->sa_family == AF_INET) - { - IP ip; - struct sockaddr_in *d = (struct sockaddr_in *)addr; - struct in_addr *addr = &d->sin_addr; - - InAddrToIP(&ip, addr); - - AddHostIPAddressToList(o, &ip); - } - else if (addr->sa_family == AF_INET6) - { - IP ip; - struct sockaddr_in6 *d = (struct sockaddr_in6 *)addr; - UINT scope_id = d->sin6_scope_id; - struct in6_addr *addr = &d->sin6_addr; - - InAddrToIP6(&ip, addr); - ip.ipv6_scope_id = scope_id; - - AddHostIPAddressToList(o, &ip); - } - } - - a = a->ifa_next; - } - - freeifaddrs(aa); - } - } -#endif // MAYAQUA_SUPPORTS_GETIFADDRS - - return o; -} - -// Get whether the UDP listener opens the specified port -bool IsUdpPortOpened(UDPLISTENER *u, IP *server_ip, UINT port) -{ - UINT i; - // Validate arguments - if (u == NULL || port == 0) - { - return false; - } - - if (server_ip != NULL) - { - for (i = 0; i < LIST_NUM(u->SockList); i++) - { - UDPLISTENER_SOCK *us = LIST_DATA(u->SockList, i); - - if (us->Sock != NULL && us->HasError == false) - { - if (us->Port == port) - { - if (CmpIpAddr(server_ip, &us->IpAddress) == 0) - { - return true; - } - } - } - } - } - - for (i = 0; i < LIST_NUM(u->SockList); i++) - { - UDPLISTENER_SOCK *us = LIST_DATA(u->SockList, i); - - if (us->Sock != NULL && us->HasError == false) - { - if (us->Port == port) - { - if (IsZeroIP(&us->IpAddress)) - { - return true; - } - } - } - } - - return false; -} - -// IP address acquisition thread -void QueryIpThreadMain(THREAD *thread, void *param) -{ - QUERYIPTHREAD *t = (QUERYIPTHREAD *)param; - // Validate arguments - if (thread == NULL || param == NULL) - { - return; - } - - while (t->Halt == false) - { - UINT next_wait_time = 0; - IP ip; - bool ok = false; - - if (GetIP4Ex(&ip, t->Hostname, 5000, &t->Halt)) - { - if (IsZeroIP(&ip) == false) - { - Lock(t->Lock); - { - Copy(&t->Ip, &ip, sizeof(IP)); - } - Unlock(t->Lock); - - ok = true; - } - } - - if (ok == false) - { - next_wait_time = t->IntervalLastNg; - } - else - { - next_wait_time = t->IntervalLastOk; - } - - if (t->Halt) - { - break; - } - - Wait(t->HaltEvent, next_wait_time); - } -} - -// Creating an IP address acquisition thread -QUERYIPTHREAD *NewQueryIpThread(char *hostname, UINT interval_last_ok, UINT interval_last_ng) -{ - QUERYIPTHREAD *t; - - t = ZeroMalloc(sizeof(QUERYIPTHREAD)); - - t->HaltEvent = NewEvent(); - t->Lock = NewLock(); - StrCpy(t->Hostname, sizeof(t->Hostname), hostname); - t->IntervalLastOk = interval_last_ok; - t->IntervalLastNg = interval_last_ng; - - t->Thread = NewThread(QueryIpThreadMain, t); - - return t; -} - -// Get the results of the IP address acquisition thread -bool GetQueryIpThreadResult(QUERYIPTHREAD *t, IP *ip) -{ - bool ret = false; - Zero(ip, sizeof(IP)); - // Validate arguments - if (t == NULL || ip == NULL) - { - return false; - } - - Lock(t->Lock); - - if (IsZero(&t->Ip, sizeof(IP))) - { - ret = false; - } - else - { - Copy(ip, &t->Ip, sizeof(IP)); - } - - Unlock(t->Lock); - - return ret; -} - -// Release of the IP address acquisition thread -void FreeQueryIpThread(QUERYIPTHREAD *t) -{ - // Validate arguments - if (t == NULL) - { - return; - } - - t->Halt = true; - Set(t->HaltEvent); - - WaitThread(t->Thread, INFINITE); - ReleaseThread(t->Thread); - - ReleaseEvent(t->HaltEvent); - - DeleteLock(t->Lock); - - Free(t); -} - -// UDP listener thread -void UdpListenerThread(THREAD *thread, void *param) -{ - UDPLISTENER *u = (UDPLISTENER *)param; - UINT i, j, k; - UINT buf_size = 65536; - void *buf; - bool cont_flag; - BUF *ip_list_buf = NewBuf(); - // Validate arguments - if (thread == NULL || param == NULL) - { - return; - } - - buf = Malloc(buf_size); - - // Initializing the socket list - u->SockList = NewList(NULL); - - u->LastCheckTick = 0; - -// u->PollMyIpAndPort = true; - - // Main loop - while (u->Halt == false) - { - LIST *recv_list; - UINT64 now = Tick64(); - UINT interval; - bool stage_changed = false; - IP nat_t_ip; - - Zero(&nat_t_ip, sizeof(nat_t_ip)); - - - if (u->LastCheckTick == 0 || (now >= (u->LastCheckTick + UDPLISTENER_CHECK_INTERVAL))) - { - LIST *iplist; - LIST *del_us_list = NewListFast(NULL); - BUF *ip_list_buf_new = NewBuf(); - - u->LastCheckTick = now; - - // Obtain an IP address list - iplist = GetHostIPAddressList(); - - LockList(u->PortList); - { - for (k = 0; k < LIST_NUM(u->SockList); k++) - { - UDPLISTENER_SOCK *us = LIST_DATA(u->SockList, k); - - us->Mark = false; - } - - // If the combination of the IP address and the port number doesn't exist in the list, add it to the list - for (i = 0; i < LIST_NUM(iplist); i++) - { - IP *ip = LIST_DATA(iplist, i); - - if (CmpIpAddr(ip, &u->ListenIP) != 0) - { - continue; - } - - WriteBuf(ip_list_buf_new, ip, sizeof(IP)); - - for (j = 0; j < LIST_NUM(u->PortList); j++) - { - UINT k; - UINT *port = LIST_DATA(u->PortList, j); - bool existing = false; - - if (IsZeroIP(ip) && (IS_SPECIAL_PORT(*port))) - { - continue; - } - - - for (k = 0; k < LIST_NUM(u->SockList); k++) - { - UDPLISTENER_SOCK *us = LIST_DATA(u->SockList, k); - - if (CmpIpAddr(&us->IpAddress, ip) == 0 && us->Port == *port) - { - existing = true; - - us->Mark = true; - - break; - } - } - - if (existing == false) - { - UDPLISTENER_SOCK *us = ZeroMalloc(sizeof(UDPLISTENER_SOCK)); - - Copy(&us->IpAddress, ip, sizeof(IP)); - us->Port = *port; - - us->Mark = true; - - Add(u->SockList, us); - } - } - } - - // If any errors suspected or the combination of IP address and port number - // has been regarded to delete already, delete it - for (k = 0; k < LIST_NUM(u->SockList); k++) - { - UDPLISTENER_SOCK *us = LIST_DATA(u->SockList, k); - - if (us->Mark == false || us->HasError) - { - Debug("mark=%u error=%u\n", us->Mark, us->HasError); - Add(del_us_list, us); - } - } - - for (i = 0; i < LIST_NUM(del_us_list); i++) - { - UDPLISTENER_SOCK *us = LIST_DATA(del_us_list, i); - - char ipstr[MAX_SIZE]; - - IPToStr(ipstr, sizeof(ipstr), &us->IpAddress); - Debug("Closed UDP Port %u at %s.\n", us->Port, ipstr); - - Delete(u->SockList, us); - - if (us->Sock != NULL) - { - Disconnect(us->Sock); - ReleaseSock(us->Sock); - } - - Free(us); - } - } - UnlockList(u->PortList); - - // Open the UDP sockets which is not opend yet - for (k = 0; k < LIST_NUM(u->SockList); k++) - { - UDPLISTENER_SOCK *us = LIST_DATA(u->SockList, k); - - if (us->Sock == NULL) - { - char ipstr[MAX_SIZE]; - - IPToStr(ipstr, sizeof(ipstr), &us->IpAddress); - - if (us->ErrorDebugDisplayed == false) - { - Debug("Opening UDP Port %u at %s ...", us->Port, ipstr); - } - - us->Sock = NewUDPEx2(us->Port, IsIP6(&us->IpAddress), &us->IpAddress); - - if (us->Sock != NULL) - { - if (us->ErrorDebugDisplayed == false) - { - Debug("Ok.\n"); - } - else - { - Debug("Opening UDP Port %u at %s ...", us->Port, ipstr); - Debug("Ok.\n"); - } - JoinSockToSockEvent(us->Sock, u->Event); - - us->ErrorDebugDisplayed = false; - } - else - { - if (us->ErrorDebugDisplayed == false) - { - Debug("Error.\n"); - } - - us->ErrorDebugDisplayed = true; - } - } - } - - FreeHostIPAddressList(iplist); - - ReleaseList(del_us_list); - - if (CompareBuf(ip_list_buf, ip_list_buf_new) == false) - { - u->HostIPAddressListChanged = true; - } - - FreeBuf(ip_list_buf); - ip_list_buf = ip_list_buf_new; - } - -LABEL_RESTART: - - stage_changed = false; - - recv_list = NewListFast(NULL); - - if (u->PollMyIpAndPort) - { - // Create a thread to get a NAT-T IP address if necessary - if (u->GetNatTIpThread == NULL) - { - char natt_hostname[MAX_SIZE]; - RUDPGetRegisterHostNameByIP(natt_hostname, sizeof(natt_hostname), NULL); - u->GetNatTIpThread = NewQueryIpThread(natt_hostname, QUERYIPTHREAD_INTERVAL_LAST_OK, QUERYIPTHREAD_INTERVAL_LAST_NG); - GetQueryIpThreadResult(u->GetNatTIpThread, &nat_t_ip); - } - } - - // Receive the data that is arriving at the socket - for (k = 0; k < LIST_NUM(u->SockList); k++) - { - UDPLISTENER_SOCK *us = LIST_DATA(u->SockList, k); - - if (us->Sock != NULL) - { - UINT num_ignore_errors = 0; - - if (u->PollMyIpAndPort && IsIP4(&us->IpAddress)) - { - if (us->NextMyIpAndPortPollTick == 0 || us->NextMyIpAndPortPollTick <= now) - { - // Examine the self IP address and the self port number by using NAT-T server - us->NextMyIpAndPortPollTick = now + (UINT64)GenRandInterval(UDP_NAT_T_NAT_STATUS_CHECK_INTERVAL_MIN, UDP_NAT_T_NAT_STATUS_CHECK_INTERVAL_MAX); - - if (IsZeroIP(&nat_t_ip) == false - ) - { - UCHAR c = 'A'; - - SendTo(us->Sock, &nat_t_ip, UDP_NAT_T_PORT, &c, 1); - } - } - } - - while (true) - { - IP src_addr; - UINT src_port; - UDPPACKET *p; - - UINT size = RecvFrom(us->Sock, &src_addr, &src_port, buf, buf_size); - if (size == 0) - { - // Socket failure - if (us->Sock->IgnoreRecvErr == false) - { -LABEL_FATAL_ERROR: - Debug("RecvFrom has Error.\n"); - us->HasError = true; - } - else - { - if ((num_ignore_errors++) >= MAX_NUM_IGNORE_ERRORS) - { - goto LABEL_FATAL_ERROR; - } - } - break; - } - else if (size == SOCK_LATER) - { - // No packet - break; - } - //Debug("UDP %u\n", size); - - if (src_port == UDP_NAT_T_PORT && CmpIpAddr(&src_addr, &nat_t_ip) == 0) - { - // Receive a packet in which the IP address and the port number are written from the NAT-T server - if (size >= 8) - { - IP my_ip; - UINT my_port; - - if (RUDPParseIPAndPortStr(buf, size, &my_ip, &my_port)) - { - Copy(&us->PublicIpAddress, &my_ip, sizeof(IP)); - us->PublicPort = my_port; - } - } - } - else - { - // Receive a regular packet - p = NewUdpPacket(&src_addr, src_port, &us->Sock->LocalIP, us->Sock->LocalPort, - Clone(buf, size), size); - - if (p->SrcPort == MAKE_SPECIAL_PORT(52)) - { - p->SrcPort = p->DestPort = MAKE_SPECIAL_PORT(50); - } - - p->Type = u->PacketType; - - Add(recv_list, p); - } - - stage_changed = true; - } - } - } - - // Pass the received packet to the procedure - u->RecvProc(u, recv_list); - - // Release the packet - for (i = 0; i < LIST_NUM(recv_list); i++) - { - UDPPACKET *p = LIST_DATA(recv_list, i); - - FreeUdpPacket(p); - } - - ReleaseList(recv_list); - - cont_flag = true; - - do - { - // When there are packets to be transmitted, transmit it - LockList(u->SendPacketList); - { - UDPLISTENER_SOCK *last_us = NULL; - IP last_src_ip; - UINT last_src_port; - - Zero(&last_src_ip, sizeof(IP)); - last_src_port = 0; - - for (i = 0; i < LIST_NUM(u->SendPacketList); i++) - { - UDPPACKET *p = LIST_DATA(u->SendPacketList, i); - UDPLISTENER_SOCK *us; - - if (last_us != NULL && last_src_port == p->SrcPort && CmpIpAddr(&last_src_ip, &p->SrcIP) == 0) - { - us = last_us; - } - else - { - // Search for a good interface for the transmission - us = DetermineUdpSocketForSending(u, p); - - if (us != NULL) - { - last_us = us; - last_src_port = p->SrcPort; - Copy(&last_src_ip, &p->SrcIP, sizeof(IP)); - } - } - - if (us != NULL) - { - // Send - UINT ret = SendTo(us->Sock, &p->DstIP, p->DestPort, p->Data, p->Size); - - if (ret == 0) - { - if (us->Sock->IgnoreSendErr == false) - { - // Socket failure - Debug("SendTo has Error.\n"); - us->HasError = true; - last_us = NULL; - } - } - else - { - if (ret != SOCK_LATER) - { - stage_changed = true; - } - } - } - - FreeUdpPacket(p); - } - DeleteAll(u->SendPacketList); - } - UnlockList(u->SendPacketList); - - if (LIST_NUM(u->SendPacketList) == 0) - { - cont_flag = false; - } - } - while (cont_flag); - - if (stage_changed && u->Halt == false) - { - goto LABEL_RESTART; - } - - // Timing adjustment - interval = GetNextIntervalForInterrupt(u->Interrupts); - - if (interval == INFINITE) - { - interval = UDPLISTENER_WAIT_INTERVAL; - } - else - { - interval = MIN(UDPLISTENER_WAIT_INTERVAL, interval); - } - - if (interval >= 1) - { - WaitSockEvent(u->Event, interval); - } - } - - if (u->GetNatTIpThread != NULL) - { - FreeQueryIpThread(u->GetNatTIpThread); - } - - // Release of the socket list - for (i = 0; i < LIST_NUM(u->SockList); i++) - { - UDPLISTENER_SOCK *us = (UDPLISTENER_SOCK *)LIST_DATA(u->SockList, i); - - Disconnect(us->Sock); - ReleaseSock(us->Sock); - - Free(us); - } - ReleaseList(u->SockList); - - FreeBuf(ip_list_buf); - - Free(buf); -} - -// Select the best UDP socket to be used for transmission -UDPLISTENER_SOCK *DetermineUdpSocketForSending(UDPLISTENER *u, UDPPACKET *p) -{ - UINT i; - // Validate arguments - if (u == NULL || p == NULL) - { - return NULL; - } - - for (i = 0; i < LIST_NUM(u->SockList); i++) - { - UDPLISTENER_SOCK *us = LIST_DATA(u->SockList, i); - - if (us->Sock != NULL && us->HasError == false) - { - if (us->Port == p->SrcPort) - { - if (CmpIpAddr(&us->IpAddress, &p->SrcIP) == 0) - { - return us; - } - } - } - } - - for (i = 0; i < LIST_NUM(u->SockList); i++) - { - UDPLISTENER_SOCK *us = LIST_DATA(u->SockList, i); - - if (us->Sock != NULL && us->HasError == false) - { - if (us->Port == p->SrcPort) - { - if (IsZeroIP(&us->IpAddress)) - { - if ((IsIP4(&p->DstIP) && IsIP4(&us->IpAddress)) || - (IsIP6(&p->DstIP) && IsIP6(&us->IpAddress))) - { - return us; - } - } - } - } - } - - return NULL; -} - -void FreeTcpRawData(TCP_RAW_DATA *trd) -{ - // Validate arguments - if (trd == NULL) - { - return; - } - - ReleaseFifo(trd->Data); - Free(trd); -} - -TCP_RAW_DATA *NewTcpRawData(IP *src_ip, UINT src_port, IP *dst_ip, UINT dst_port) -{ - TCP_RAW_DATA *trd; - // Validate arguments - if (dst_ip == NULL || dst_port == 0) - { - return NULL; - } - - trd = ZeroMalloc(sizeof(TCP_RAW_DATA)); - - Copy(&trd->SrcIP, src_ip, sizeof(IP)); - trd->SrcPort = src_port; - - Copy(&trd->DstIP, dst_ip, sizeof(IP)); - trd->DstPort = dst_port; - - trd->Data = NewFifoFast(); - - return trd; -} - -// Release of the UDP packet -void FreeUdpPacket(UDPPACKET *p) -{ - // Validate arguments - if (p == NULL) - { - return; - } - - Free(p->Data); - Free(p); -} - -// Create a new UDP packet -UDPPACKET *NewUdpPacket(IP *src_ip, UINT src_port, IP *dst_ip, UINT dst_port, void *data, UINT size) -{ - UDPPACKET *p; - // Validate arguments - if (data == NULL || size == 0 || dst_ip == NULL || dst_port == 0) - { - return NULL; - } - - p = ZeroMalloc(sizeof(UDPPACKET)); - - p->Data = data; - p->Size = size; - - Copy(&p->SrcIP, src_ip, sizeof(IP)); - p->SrcPort = src_port; - - Copy(&p->DstIP, dst_ip, sizeof(IP)); - p->DestPort = dst_port; - - return p; -} - -// Transmit the packets via UDP Listener -void UdpListenerSendPackets(UDPLISTENER *u, LIST *packet_list) -{ - UINT num = 0; - // Validate arguments - if (u == NULL || packet_list == NULL) - { - return; - } - - LockList(u->SendPacketList); - { - UINT i; - - num = LIST_NUM(packet_list); - - for (i = 0; i < LIST_NUM(packet_list); i++) - { - UDPPACKET *p = LIST_DATA(packet_list, i); - - Add(u->SendPacketList, p); - } - } - UnlockList(u->SendPacketList); - - if (num >= 1) - { - SetSockEvent(u->Event); - } -} - -// Creating a UDP listener -UDPLISTENER *NewUdpListener(UDPLISTENER_RECV_PROC *recv_proc, void *param, IP *listen_ip) -{ - return NewUdpListenerEx(recv_proc, param, listen_ip, INFINITE); -} - -UDPLISTENER *NewUdpListenerEx(UDPLISTENER_RECV_PROC *recv_proc, void *param, IP *listen_ip, UINT packet_type) -{ - UDPLISTENER *u; - // Validate arguments - if (recv_proc == NULL) - { - return NULL; - } - - u = ZeroMalloc(sizeof(UDPLISTENER)); - - u->Param = param; - u->PacketType = packet_type; - - u->PortList = NewList(NULL); - u->Event = NewSockEvent(); - - if (listen_ip) - { - Copy(&u->ListenIP, listen_ip, sizeof(IP)); - } - - u->RecvProc = recv_proc; - u->SendPacketList = NewList(NULL); - - u->Interrupts = NewInterruptManager(); - - u->Thread = NewThread(UdpListenerThread, u); - - return u; -} - -// Stop the UDP listener -void StopUdpListener(UDPLISTENER *u) -{ - if (u == NULL) - { - return; - } - - u->Halt = true; - SetSockEvent(u->Event); - WaitThread(u->Thread, INFINITE); -} - -// Release the UDP listener -void FreeUdpListener(UDPLISTENER *u) -{ - UINT i; - // Validate arguments - if (u == NULL) - { - return; - } - - StopUdpListener(u); - - ReleaseThread(u->Thread); - ReleaseSockEvent(u->Event); - - ReleaseIntList(u->PortList); - - for (i = 0; i < LIST_NUM(u->SendPacketList); i++) - { - UDPPACKET *p = LIST_DATA(u->SendPacketList, i); - - FreeUdpPacket(p); - } - - ReleaseList(u->SendPacketList); - - FreeInterruptManager(u->Interrupts); - - Free(u); -} - -// Add the UDP port -void AddPortToUdpListener(UDPLISTENER *u, UINT port) -{ - // Validate arguments - if (u == NULL || port == 0) - { - return; - } - - LockList(u->PortList); - { - AddIntDistinct(u->PortList, port); - } - UnlockList(u->PortList); - - SetSockEvent(u->Event); -} - -// Delete all the UDP ports -void DeleteAllPortFromUdpListener(UDPLISTENER *u) -{ - // Validate arguments - if (u == NULL) - { - return; - } - - LockList(u->PortList); - { - UINT num_ports = LIST_NUM(u->PortList); - UINT *ports = ZeroMalloc(sizeof(UINT) * num_ports); - UINT i; - - for (i = 0; i < num_ports; i++) - { - ports[i] = *((UINT *)(LIST_DATA(u->PortList, i))); - } - - for (i = 0; i < num_ports; i++) - { - UINT port = ports[i]; - - DelInt(u->PortList, port); - } - - Free(ports); - } - UnlockList(u->PortList); - - SetSockEvent(u->Event); -} - -// Delete the UDP port -void DeletePortFromUdpListener(UDPLISTENER *u, UINT port) -{ - // Validate arguments - if (u == NULL || port == 0) - { - return; - } - - LockList(u->PortList); - { - DelInt(u->PortList, port); - } - UnlockList(u->PortList); - - SetSockEvent(u->Event); -} - -// Sort function of the interrupt management list -int CmpInterruptManagerTickList(void *p1, void *p2) -{ - UINT64 *v1, *v2; - if (p1 == NULL || p2 == NULL) - { - return 0; - } - - v1 = *(UINT64 **)p1; - v2 = *(UINT64 **)p2; - if (v1 == NULL || v2 == NULL) - { - return 0; - } - - if (*v1 > *v2) - { - return 1; - } - else if (*v1 < *v2) - { - return -1; - } - else - { - return 0; - } -} - -// Initialization of the interrupt management -INTERRUPT_MANAGER *NewInterruptManager() -{ - INTERRUPT_MANAGER *m = ZeroMalloc(sizeof(INTERRUPT_MANAGER)); - - m->TickList = NewList(CmpInterruptManagerTickList); - - return m; -} - -// Release of the interrupt management -void FreeInterruptManager(INTERRUPT_MANAGER *m) -{ - UINT i; - // Validate arguments - if (m == NULL) - { - return; - } - - for (i = 0; i < LIST_NUM(m->TickList); i++) - { - UINT64 *v = LIST_DATA(m->TickList, i); - - Free(v); - } - - ReleaseList(m->TickList); - - Free(m); -} - -// Add a number to the interrupt management -void AddInterrupt(INTERRUPT_MANAGER *m, UINT64 tick) -{ - // Validate arguments - if (tick == 0) - { - return; - } - - LockList(m->TickList); - { - if (Search(m->TickList, &tick) == NULL) - { - Insert(m->TickList, Clone(&tick, sizeof(UINT64))); - } - } - UnlockList(m->TickList); -} - -// Get the interval to the next calling -UINT GetNextIntervalForInterrupt(INTERRUPT_MANAGER *m) -{ - UINT ret = INFINITE; - UINT i; - LIST *o = NULL; - UINT64 now = Tick64(); - // Validate arguments - if (m == NULL) - { - return 0; - } - - LockList(m->TickList); - { - // Remove entries older than now already - for (i = 0; i < LIST_NUM(m->TickList); i++) - { - UINT64 *v = LIST_DATA(m->TickList, i); - - if (now >= *v) - { - ret = 0; - - if (o == NULL) - { - o = NewListFast(NULL); - } - - Add(o, v); - } - else - { - break; - } - } - - for (i = 0; i < LIST_NUM(o); i++) - { - UINT64 *v = LIST_DATA(o, i); - - Free(v); - - Delete(m->TickList, v); - } - - if (o != NULL) - { - ReleaseList(o); - } - - if (ret == INFINITE) - { - if (LIST_NUM(m->TickList) >= 1) - { - UINT64 *v = LIST_DATA(m->TickList, 0); - - ret = (UINT)(*v - now); - } - } - } - UnlockList(m->TickList); - - return ret; -} - -// Let that the listening socket for the reverse socket to accept the new socket -void InjectNewReverseSocketToAccept(SOCK *listen_sock, SOCK *s, IP *client_ip, UINT client_port) -{ - bool ok = false; - // Validate arguments - if (listen_sock == NULL || s == NULL) - { - return; - } - - LockQueue(listen_sock->ReverseAcceptQueue); - { - if (listen_sock->CancelAccept == false && listen_sock->Disconnecting == false) - { - InsertQueue(listen_sock->ReverseAcceptQueue, s); - - ok = true; - - s->ServerMode = true; - s->IsReverseAcceptedSocket = true; - - Copy(&s->RemoteIP, client_ip, sizeof(IP)); - s->RemotePort = client_port; - } - } - UnlockQueue(listen_sock->ReverseAcceptQueue); - - if (ok == false) - { - Disconnect(s); - ReleaseSock(s); - } - else - { - Set(listen_sock->ReverseAcceptEvent); - } -} - -// Create a listening socket for the reverse socket -SOCK *ListenReverse() -{ - SOCK *s = NewSock(); - - s->Type = SOCK_REVERSE_LISTEN; - s->ListenMode = true; - s->ReverseAcceptQueue = NewQueue(); - s->ReverseAcceptEvent = NewEvent(); - s->Connected = true; - - return s; -} - -// Accept on the reverse socket -SOCK *AcceptReverse(SOCK *s) -{ - // Validate arguments - if (s == NULL || s->Type != SOCK_REVERSE_LISTEN || s->ListenMode == false) - { - return NULL; - } - - while (true) - { - SOCK *ret; - if (s->Disconnecting || s->CancelAccept) - { - return NULL; - } - - LockQueue(s->ReverseAcceptQueue); - { - ret = GetNext(s->ReverseAcceptQueue); - } - UnlockQueue(s->ReverseAcceptQueue); - - if (ret != NULL) - { - StrCpy(ret->UnderlayProtocol, sizeof(ret->UnderlayProtocol), SOCK_UNDERLAY_AZURE); - - AddProtocolDetailsStr(ret->ProtocolDetails, sizeof(ret->ProtocolDetails), "VPN Azure"); - - return ret; - } - - Wait(s->ReverseAcceptEvent, INFINITE); - } -} - -// Start listening on the in-process socket -SOCK *ListenInProc() -{ - SOCK *s = NewSock(); - - s->Type = SOCK_INPROC; - s->ListenMode = true; - s->InProcAcceptQueue = NewQueue(); - s->InProcAcceptEvent = NewEvent(); - s->Connected = true; - - return s; -} - -// Accept at the in-process socket -SOCK *AcceptInProc(SOCK *s) -{ - // Validate arguments - if (s == NULL || s->Type != SOCK_INPROC || s->ListenMode == false) - { - return NULL; - } - - while (true) - { - SOCK *ret; - if (s->Disconnecting || s->CancelAccept) - { - return NULL; - } - - LockQueue(s->InProcAcceptQueue); - { - ret = GetNext(s->InProcAcceptQueue); - } - UnlockQueue(s->InProcAcceptQueue); - - if (ret != NULL) - { - StrCpy(ret->UnderlayProtocol, sizeof(ret->UnderlayProtocol), SOCK_UNDERLAY_INPROC); - - AddProtocolDetailsStr(ret->ProtocolDetails, sizeof(ret->ProtocolDetails), "InProc"); - - return ret; - } - - Wait(s->InProcAcceptEvent, INFINITE); - } -} - -// Connect by the in-process socket -SOCK *ConnectInProc(SOCK *listen_sock, IP *client_ip, UINT client_port, IP *server_ip, UINT server_port) -{ - SOCK *ss, *sc; - bool ok = false; - // Validate arguments - if (listen_sock == NULL || listen_sock->Type != SOCK_INPROC || listen_sock->ListenMode == false) - { - return NULL; - } - - NewSocketPair(&sc, &ss, client_ip, client_port, server_ip, server_port); - - LockQueue(listen_sock->InProcAcceptQueue); - { - if (listen_sock->CancelAccept == false && listen_sock->Disconnecting == false) - { - InsertQueue(listen_sock->InProcAcceptQueue, ss); - - ok = true; - } - } - UnlockQueue(listen_sock->InProcAcceptQueue); - - if (ok == false) - { - ReleaseSock(ss); - ReleaseSock(sc); - return NULL; - } - - Set(listen_sock->InProcAcceptEvent); - - return sc; -} - -// Creating a new socket pair -void NewSocketPair(SOCK **client, SOCK **server, IP *client_ip, UINT client_port, IP *server_ip, UINT server_port) -{ - IP iptmp; - TUBE *t1, *t2; - SOCK *sc, *ss; - SOCK_EVENT *e1, *e2; - // Validate arguments - if (client == NULL || server == NULL) - { - return; - } - - SetIP(&iptmp, 127, 0, 0, 1); - if (client_ip == NULL) - { - client_ip = &iptmp; - } - if (server_ip == NULL) - { - server_ip = &iptmp; - } - - // Creating a tube - NewTubePair(&t1, &t2, 0); // t1: C -> S, t2: S -> C - - // Creating a socket event - e1 = NewSockEvent(); - e2 = NewSockEvent(); - - SetTubeSockEvent(t1, e1); - SetTubeSockEvent(t2, e2); - - sc = NewInProcSocket(t1, t2); - ss = NewInProcSocket(t2, t1); - - Copy(&sc->LocalIP, client_ip, sizeof(IP)); - sc->LocalPort = client_port; - Copy(&sc->RemoteIP, server_ip, sizeof(IP)); - sc->RemotePort = server_port; - - Copy(&ss->LocalIP, server_ip, sizeof(IP)); - ss->LocalPort = server_port; - Copy(&ss->RemoteIP, client_ip, sizeof(IP)); - ss->RemotePort = client_port; - - sc->Connected = true; - sc->ServerMode = false; - - ss->Connected = true; - ss->ServerMode = true; - - SetTimeout(sc, INFINITE); - SetTimeout(ss, INFINITE); - - QuerySocketInformation(sc); - QuerySocketInformation(ss); - - ReleaseSockEvent(e1); - ReleaseSockEvent(e2); - - ReleaseTube(t1); - ReleaseTube(t2); - - *client = sc; - *server = ss; -} - -// Creating a new in-process socket -SOCK *NewInProcSocket(TUBE *tube_send, TUBE *tube_recv) -{ - SOCK *s; - // Validate arguments - if (tube_recv == NULL || tube_send == NULL) - { - return NULL; - } - - s = NewSock(); - - s->Type = SOCK_INPROC; - - s->SendTube = tube_send; - s->RecvTube = tube_recv; - - AddRef(tube_send->Ref); - AddRef(tube_recv->Ref); - - s->InProcRecvFifo = NewFifo(); - - s->Connected = true; - - return s; -} - -// Transmission process for the in-process socket -UINT SendInProc(SOCK *sock, void *data, UINT size) -{ - if (sock == NULL || sock->Type != SOCK_INPROC || sock->Disconnecting || sock->Connected == false) - { - return 0; - } - - if (IsTubeConnected(sock->SendTube) == false) - { - return 0; - } - - if (TubeSend(sock->SendTube, data, size, NULL) == false) - { - return 0; - } - - return size; -} - -// Receiving process for the in-process socket -UINT RecvInProc(SOCK *sock, void *data, UINT size) -{ - FIFO *f; - UINT ret; - UINT timeout; - UINT64 giveup_time; - TUBEDATA *d = NULL; - if (sock == NULL || sock->Type != SOCK_INPROC || sock->Disconnecting || sock->Connected == false) - { - return 0; - } - - if (IsTubeConnected(sock->SendTube) == false) - { - return 0; - } - - f = sock->InProcRecvFifo; - if (f == NULL) - { - return 0; - } - - // If there is data in the FIFO, return it immediately - ret = ReadFifo(f, data, size); - if (ret != 0) - { - return ret; - } - - timeout = GetTimeout(sock); - - giveup_time = Tick64() + (UINT)timeout; - - // When there is no data in the FIFO, read the next data from the tube - d = NULL; - - while (true) - { - UINT64 now = 0; - UINT interval; - - if (sock->AsyncMode == false) - { - now = Tick64(); - - if (now >= giveup_time) - { - break; - } - } - - d = TubeRecvAsync(sock->RecvTube); - - if (d != NULL) - { - break; - } - - if (IsTubeConnected(sock->RecvTube) == false) - { - break; - } - - if (sock->AsyncMode) - { - break; - } - - interval = (UINT)(giveup_time - now); - - Wait(sock->RecvTube->Event, interval); - } - - if (d == NULL) - { - if (IsTubeConnected(sock->RecvTube) == false) - { - return 0; - } - - if (sock->AsyncMode == false) - { - // If a timeout occurs in synchronous mode, disconnect ir - Disconnect(sock); - - return 0; - } - else - { - // If a timeout occurs in asynchronous mode, returns the blocking error - return SOCK_LATER; - } - } - else - { - // If the received data is larger than the requested size, write the rest to FIFO - if (d->DataSize > size) - { - WriteFifo(f, ((UCHAR *)d->Data) + size, d->DataSize - size); - ret = size; - } - else - { - ret = d->DataSize; - } - - Copy(data, d->Data, ret); - - FreeTubeData(d); - - return ret; - } -} - -// Wait for the arrival of data on multiple tubes -void WaitForTubes(TUBE **tubes, UINT num, UINT timeout) -{ - // Validate arguments - if (num != 0 && tubes == NULL) - { - return; - } - if (timeout == 0) - { - return; - } - if (num == 0) - { - SleepThread(timeout); - return; - } - -#ifdef OS_WIN32 - Win32WaitForTubes(tubes, num, timeout); -#else // OS_WIN32 - UnixWaitForTubes(tubes, num, timeout); -#endif // OS_WIN32 -} - -#ifdef OS_WIN32 -void Win32WaitForTubes(TUBE **tubes, UINT num, UINT timeout) -{ - HANDLE array[MAXIMUM_WAIT_OBJECTS]; - UINT i; - - Zero(array, sizeof(array)); - - for (i = 0; i < num; i++) - { - TUBE *t = tubes[i]; - - array[i] = t->Event->pData; - } - - if (num == 1) - { - WaitForSingleObject(array[0], timeout); - } - else - { - WaitForMultipleObjects(num, array, false, timeout); - } -} -#else // OS_WIN32 -void UnixWaitForTubes(TUBE **tubes, UINT num, UINT timeout) -{ - int *fds; - UINT i; - char tmp[MAX_SIZE]; - bool any_of_tubes_are_readable = false; - - fds = ZeroMalloc(sizeof(int) * num); - - for (i = 0; i < num; i++) - { - fds[i] = tubes[i]->SockEvent->pipe_read; - - if (tubes[i]->SockEvent->current_pipe_data != 0) - { - any_of_tubes_are_readable = true; - } - } - - if (any_of_tubes_are_readable == false) - { - UnixSelectInner(num, fds, 0, NULL, timeout); - } - - for (i = 0; i < num; i++) - { - int fd = fds[i]; - int readret; - - tubes[i]->SockEvent->current_pipe_data = 0; - - do - { - readret = read(fd, tmp, sizeof(tmp)); - } - while (readret >= 1); - } - - Free(fds); -} -#endif // OS_WIN32 - -// Creating a Tube Flush List -TUBE_FLUSH_LIST *NewTubeFlushList() -{ - TUBE_FLUSH_LIST *f = ZeroMalloc(sizeof(TUBE_FLUSH_LIST)); - - f->List = NewListFast(NULL); - - return f; -} - -// Release of the Tube Flush List -void FreeTubeFlushList(TUBE_FLUSH_LIST *f) -{ - UINT i; - // Validate arguments - if (f == NULL) - { - return; - } - - for (i = 0; i < LIST_NUM(f->List); i++) - { - TUBE *t = LIST_DATA(f->List, i); - - ReleaseTube(t); - } - - ReleaseList(f->List); - - Free(f); -} - -// Add a Tube to the Tube Flush List -void AddTubeToFlushList(TUBE_FLUSH_LIST *f, TUBE *t) -{ - // Validate arguments - if (f == NULL || t == NULL) - { - return; - } - - if (t->IsInFlushList) - { - return; - } - - if (IsInList(f->List, t) == false) - { - Add(f->List, t); - - AddRef(t->Ref); - - t->IsInFlushList = true; - } -} - -// Flush the all tubes in the Tube Flush List -void FlushTubeFlushList(TUBE_FLUSH_LIST *f) -{ - UINT i; - // Validate arguments - if (f == NULL) - { - return; - } - - for (i = 0; i < LIST_NUM(f->List); i++) - { - TUBE *t = LIST_DATA(f->List, i); - - TubeFlush(t); - t->IsInFlushList = false; - - ReleaseTube(t); - } - - DeleteAll(f->List); -} - -// Store the error value into PACK -PACK *PackError(UINT error) -{ - PACK *p; - - p = NewPack(); - PackAddInt(p, "error", error); - - return p; -} - -// Get the error value from PACK -UINT GetErrorFromPack(PACK *p) -{ - // Validate arguments - if (p == NULL) - { - return 0; - } - - return PackGetInt(p, "error"); -} - -// Create an entry to PACK for the dummy -void CreateDummyValue(PACK *p) -{ - UINT size; - UCHAR *buf; - // Validate arguments - if (p == NULL) - { - return; - } - - size = Rand32() % HTTP_PACK_RAND_SIZE_MAX; - buf = Malloc(size); - Rand(buf, size); - - PackAddData(p, "pencore", buf, size); - - Free(buf); -} - -// Receive a line -char *RecvLine(SOCK *s, UINT max_size) -{ - BUF *b; - char c; - char *str; - // Validate arguments - if (s == NULL || max_size == 0) - { - return NULL; - } - - b = NewBuf(); - while (true) - { - UCHAR *buf; - if (RecvAll(s, &c, sizeof(c), s->SecureMode) == false) - { - FreeBuf(b); - return NULL; - } - WriteBuf(b, &c, sizeof(c)); - buf = (UCHAR *)b->Buf; - if (b->Size > max_size) - { - FreeBuf(b); - return NULL; - } - if (b->Size >= 1) - { - if (buf[b->Size - 1] == '\n') - { - b->Size--; - if (b->Size >= 1) - { - if (buf[b->Size - 1] == '\r') - { - b->Size--; - } - } - str = Malloc(b->Size + 1); - Copy(str, b->Buf, b->Size); - str[b->Size] = 0; - FreeBuf(b); - - return str; - } - } - } -} - -// Receive a PACK -PACK *RecvPack(SOCK *s) -{ - PACK *p; - BUF *b; - void *data; - UINT sz; - // Validate arguments - if (s == NULL || s->Type != SOCK_TCP) - { - return false; - } - - if (RecvAll(s, &sz, sizeof(UINT), s->SecureMode) == false) - { - return false; - } - sz = Endian32(sz); - if (sz > MAX_PACK_SIZE) - { - return false; - } - data = MallocEx(sz, true); - if (RecvAll(s, data, sz, s->SecureMode) == false) - { - Free(data); - return false; - } - - b = NewBuf(); - WriteBuf(b, data, sz); - SeekBuf(b, 0, 0); - p = BufToPack(b); - FreeBuf(b); - Free(data); - - return p; -} - -// Receive a PACK (with checking the hash) -PACK *RecvPackWithHash(SOCK *s) -{ - PACK *p; - BUF *b; - void *data; - UINT sz; - UCHAR hash1[SHA1_SIZE]; - UCHAR hash2[SHA1_SIZE]; - // Validate arguments - if (s == NULL || s->Type != SOCK_TCP) - { - return false; - } - - if (RecvAll(s, &sz, sizeof(UINT), s->SecureMode) == false) - { - return false; - } - sz = Endian32(sz); - if (sz > MAX_PACK_SIZE) - { - return false; - } - data = MallocEx(sz, true); - if (RecvAll(s, data, sz, s->SecureMode) == false) - { - Free(data); - return false; - } - - Sha1(hash1, data, sz); - if (RecvAll(s, hash2, sizeof(hash2), s->SecureMode) == false) - { - Free(data); - return false; - } - - if (Cmp(hash1, hash2, SHA1_SIZE) != 0) - { - Free(data); - return false; - } - - b = NewBuf(); - WriteBuf(b, data, sz); - SeekBuf(b, 0, 0); - p = BufToPack(b); - FreeBuf(b); - Free(data); - - return p; -} - -// Send a PACK -bool SendPack(SOCK *s, PACK *p) -{ - BUF *b; - UINT sz; - // Validate arguments - if (s == NULL || p == NULL || s->Type != SOCK_TCP) - { - return false; - } - - b = PackToBuf(p); - sz = Endian32(b->Size); - - SendAdd(s, &sz, sizeof(UINT)); - SendAdd(s, b->Buf, b->Size); - FreeBuf(b); - - return SendNow(s, s->SecureMode); -} - -// Send a Pack (with adding a hash) -bool SendPackWithHash(SOCK *s, PACK *p) -{ - BUF *b; - UINT sz; - UCHAR hash[SHA1_SIZE]; - // Validate arguments - if (s == NULL || p == NULL || s->Type != SOCK_TCP) - { - return false; - } - - b = PackToBuf(p); - sz = Endian32(b->Size); - - SendAdd(s, &sz, sizeof(UINT)); - SendAdd(s, b->Buf, b->Size); - Sha1(hash, b->Buf, b->Size); - SendAdd(s, hash, sizeof(hash)); - - FreeBuf(b); - - return SendNow(s, s->SecureMode); -} - -// Get SNI name from the SSL packet -bool GetSniNameFromSslPacket(UCHAR *packet_buf, UINT packet_size, char *sni, UINT sni_size) -{ - BUF *buf; - bool ret = false; - UCHAR content_type; - USHORT version; - USHORT handshake_length; - - // Validate arguments - if (packet_buf == NULL || packet_size <= 11) - { - return false; - } - - if (!(packet_buf[0] == 0x16 && packet_buf[1] >= 0x03 && - packet_buf[5] == 0x01 && packet_buf[6] == 0x00 && - packet_buf[9] >= 0x03)) - { - return false; - } - - buf = NewBufFromMemory(packet_buf, packet_size); - - if (ReadBuf(buf, &content_type, sizeof(UCHAR)) == sizeof(UCHAR) && - ReadBuf(buf, &version, sizeof(USHORT)) == sizeof(USHORT) && - ReadBuf(buf, &handshake_length, sizeof(USHORT)) == sizeof(USHORT)) - { - version = Endian16(version); - handshake_length = Endian16(handshake_length); - - if (content_type == 0x16 && version >= 0x0301) - { - UCHAR *handshake_data = Malloc(handshake_length); - - if (ReadBuf(buf, handshake_data, handshake_length) == handshake_length) - { - BUF *buf2 = NewBufFromMemory(handshake_data, handshake_length); - USHORT handshake_type; - USHORT handshake_length_2; - - if (ReadBuf(buf2, &handshake_type, sizeof(USHORT)) == sizeof(USHORT) && - ReadBuf(buf2, &handshake_length_2, sizeof(USHORT)) == sizeof(USHORT)) - { - handshake_type = Endian16(handshake_type); - handshake_length_2 = Endian16(handshake_length_2); - - if (handshake_type == 0x0100 && handshake_length_2 <= (handshake_length - 4)) - { - USHORT version2; - - if (ReadBuf(buf2, &version2, sizeof(USHORT)) == sizeof(USHORT)) - { - version2 = Endian16(version2); - - if (version2 >= 0x0301) - { - UCHAR rand[32]; - - if (ReadBuf(buf2, rand, sizeof(rand)) == sizeof(rand)) - { - UCHAR session_id_len; - - if (ReadBuf(buf2, &session_id_len, sizeof(UCHAR)) == sizeof(UCHAR)) - { - if (ReadBuf(buf2, NULL, session_id_len) == session_id_len) - { - USHORT cipher_len; - - if (ReadBuf(buf2, &cipher_len, sizeof(USHORT)) == sizeof(USHORT)) - { - cipher_len = Endian16(cipher_len); - - if (ReadBuf(buf2, NULL, cipher_len) == cipher_len) - { - UCHAR comps_len; - - if (ReadBuf(buf2, &comps_len, sizeof(UCHAR)) == sizeof(UCHAR)) - { - if (ReadBuf(buf2, NULL, comps_len) == comps_len) - { - USHORT ext_length; - - if (ReadBuf(buf2, &ext_length, sizeof(USHORT)) == sizeof(USHORT)) - { - UCHAR *ext_buf; - - ext_length = Endian16(ext_length); - - ext_buf = Malloc(ext_length); - - if (ReadBuf(buf2, ext_buf, ext_length) == ext_length) - { - BUF *ebuf = NewBufFromMemory(ext_buf, ext_length); - - while (ret == false) - { - USHORT type; - USHORT data_len; - UCHAR *data; - - if (ReadBuf(ebuf, &type, sizeof(USHORT)) != sizeof(USHORT)) - { - break; - } - - if (ReadBuf(ebuf, &data_len, sizeof(USHORT)) != sizeof(USHORT)) - { - break; - } - - type = Endian16(type); - data_len = Endian16(data_len); - - data = Malloc(data_len); - - if (ReadBuf(ebuf, data, data_len) != data_len) - { - Free(data); - break; - } - - if (type == 0x0000) - { - BUF *dbuf = NewBufFromMemory(data, data_len); - - USHORT total_len; - - if (ReadBuf(dbuf, &total_len, sizeof(USHORT)) == sizeof(USHORT)) - { - UCHAR c; - total_len = Endian16(total_len); - - if (ReadBuf(dbuf, &c, sizeof(UCHAR)) == sizeof(UCHAR)) - { - if (c == 0) - { - USHORT name_len; - - if (ReadBuf(dbuf, &name_len, sizeof(USHORT)) == sizeof(USHORT)) - { - char *name_buf; - name_len = Endian16(name_len); - - name_buf = ZeroMalloc(name_len + 1); - - if (ReadBuf(dbuf, name_buf, name_len) == name_len) - { - if (StrLen(name_buf) >= 1) - { - ret = true; - - StrCpy(sni, sni_size, name_buf); - } - } - - Free(name_buf); - } - } - } - } - - FreeBuf(dbuf); - } - - Free(data); - } - - FreeBuf(ebuf); - } - - Free(ext_buf); - } - } - } - } - } - } - } - } - } - } - } - } - - FreeBuf(buf2); - } - - Free(handshake_data); - } - } - - FreeBuf(buf); - - if (ret) - { - Trim(sni); - - if (IsEmptyStr(sni)) - { - ret = false; - } - } - - return ret; -} - -void SetDhParam(DH_CTX *dh) -{ - if (dh_param) - { - DhFree(dh_param); - } - - dh_param = dh; -} +// SoftEther VPN Source Code - Developer Edition Master Branch +// Mayaqua Kernel + + +// Network.c +// Network communication module + +#include + +#define ENCRYPT_C +#define NETWORK_C + +#define __WINCRYPT_H__ + +#ifdef WIN32 +// Include windows.h for Socket API +#define _WIN32_WINNT 0x0502 +#define WINVER 0x0502 +#include +#include +#include +#include +#include +#include +#include +#include +#endif // WIN32 + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#ifdef UNIX_MACOS +#include +#endif // UNIX_MACOS + +#ifdef OS_WIN32 +NETWORK_WIN32_FUNCTIONS *w32net; +struct ROUTE_CHANGE_DATA +{ + OVERLAPPED Overlapped; + HANDLE Handle; + UINT NumCalled; +}; +#endif // OS_WIN32 + +// Whether the blocking occurs in SSL +#if defined(UNIX_BSD) || defined(UNIX_MACOS) +#define FIX_SSL_BLOCKING +#endif + +// IPV6_V6ONLY constant +#ifdef UNIX_LINUX +#ifndef IPV6_V6ONLY +#define IPV6_V6ONLY 26 +#endif // IPV6_V6ONLY +#endif // UNIX_LINUX + +#ifdef UNIX_SOLARIS +#ifndef IPV6_V6ONLY +#define IPV6_V6ONLY 0x27 +#endif // IPV6_V6ONLY +#endif // UNIX_SOLARIS + +// HTTP constant +static char http_detect_server_startwith[] = "\r\n\r\n403 Forbidden\r\n\r\n

Forbidden

\r\nYou don't have permission to access "; +static char http_detect_server_tag_future[] = "9C37197CA7C2428388C2E6E59B829B30"; + +// DNS cache list +static LIST *DnsCache; + +// Lock related +static LOCK *machine_name_lock = NULL; +static LOCK *disconnect_function_lock = NULL; +static LOCK *aho = NULL; +static LOCK *socket_library_lock = NULL; +extern LOCK *openssl_lock; +static LOCK *ssl_accept_lock = NULL; +static LOCK *ssl_connect_lock = NULL; +static COUNTER *num_tcp_connections = NULL; +static LOCK *dns_lock = NULL; +static LOCK *unix_dns_server_addr_lock = NULL; +static IP unix_dns_server; +static LIST *HostCacheList = NULL; +static LIST *WaitThreadList = NULL; +static bool disable_cache = false; +static bool NetworkReleaseMode = false; // Network release mode +static UCHAR machine_ip_process_hash[SHA1_SIZE]; +static LOCK *machine_ip_process_hash_lock = NULL; +static LOCK *current_global_ip_lock = NULL; +static LOCK *current_fqdn_lock = NULL; +static bool current_global_ip_set = false; +static IP current_glocal_ipv4 = {0}; +static IP current_glocal_ipv6 = {0}; +static char current_fqdn[MAX_SIZE]; +static bool g_no_rudp_server = false; +static bool g_no_rudp_register = false; +static bool g_natt_low_priority = false; +static LOCK *host_ip_address_list_cache_lock = NULL; +static UINT64 host_ip_address_list_cache_last = 0; +static LIST *host_ip_address_cache = NULL; +static bool disable_gethostname_by_accept = false; +static COUNTER *getip_thread_counter = NULL; +static UINT max_getip_thread = 0; + + +static LIST *ip_clients = NULL; + +static LIST *local_mac_list = NULL; +static LOCK *local_mac_list_lock = NULL; + +static UINT rand_port_numbers[256] = {0}; + + +static bool g_use_privateip_file = false; +static bool g_source_ip_validation_force_disable = false; + +static DH_CTX *dh_param = NULL; + +typedef struct PRIVATE_IP_SUBNET +{ + UINT Ip, Mask, Ip2; +} PRIVATE_IP_SUBNET; + +static LIST *g_private_ip_list = NULL; + + +static LIST *g_dyn_value_list = NULL; + + + +//#define RUDP_DETAIL_LOG + + + + +// Get a value from a dynamic value list (Returns a default value if the value is not found) +UINT64 GetDynValueOrDefault(char *name, UINT64 default_value, UINT64 min_value, UINT64 max_value) +{ + UINT64 ret = GetDynValue(name); + + if (ret == 0) + { + return default_value; + } + + if (ret < min_value) + { + ret = min_value; + } + + if (ret > max_value) + { + ret = max_value; + } + + return ret; +} + +// Get a value from a dynamic value list (Returns a default value if the value is not found) +// The value is limited to 1/5 to 50 times of the default value for safety +UINT64 GetDynValueOrDefaultSafe(char *name, UINT64 default_value) +{ + return GetDynValueOrDefault(name, default_value, default_value / (UINT64)5, default_value * (UINT64)50); +} + +// Get a value from a dynamic value list +UINT64 GetDynValue(char *name) +{ + UINT64 ret = 0; + // Validate arguments + if (name == NULL) + { + return 0; + } + + if (g_dyn_value_list == NULL) + { + return 0; + } + + LockList(g_dyn_value_list); + { + UINT i; + + for (i = 0; i < LIST_NUM(g_dyn_value_list); i++) + { + DYN_VALUE *vv = LIST_DATA(g_dyn_value_list, i); + + if (StrCmpi(vv->Name, name) == 0) + { + ret = vv->Value; + break; + } + } + } + UnlockList(g_dyn_value_list); + + return ret; +} + +// Set the value to the dynamic value list +void SetDynListValue(char *name, UINT64 value) +{ + // Validate arguments + if (name == NULL) + { + return; + } + + if (g_dyn_value_list == NULL) + { + return; + } + + LockList(g_dyn_value_list); + { + UINT i; + DYN_VALUE *v = NULL; + + for (i = 0; i < LIST_NUM(g_dyn_value_list); i++) + { + DYN_VALUE *vv = LIST_DATA(g_dyn_value_list, i); + + if (StrCmpi(vv->Name, name) == 0) + { + v = vv; + break; + } + } + + if (v == NULL) + { + v = ZeroMalloc(sizeof(DYN_VALUE)); + StrCpy(v->Name, sizeof(v->Name), name); + + Add(g_dyn_value_list, v); + } + + v->Value = value; + } + UnlockList(g_dyn_value_list); +} + +// Apply by extracting dynamic value list from the specified PACK +void ExtractAndApplyDynList(PACK *p) +{ + BUF *b; + // Validate arguments + if (p == NULL) + { + return; + } + + b = PackGetBuf(p, "DynList"); + if (b == NULL) + { + return; + } + + AddDynList(b); + + FreeBuf(b); +} + +// Insert the data to the dynamic value list +void AddDynList(BUF *b) +{ + PACK *p; + TOKEN_LIST *t; + // Validate arguments + if (b == NULL) + { + return; + } + + SeekBufToBegin(b); + + p = BufToPack(b); + if (p == NULL) + { + return; + } + + t = GetPackElementNames(p); + if (t != NULL) + { + UINT i; + + for (i = 0; i < t->NumTokens; i++) + { + char *name = t->Token[i]; + UINT64 v = PackGetInt64(p, name); + + SetDynListValue(name, v); + } + + FreeToken(t); + } + + FreePack(p); +} + +// Initialization of the dynamic value list +void InitDynList() +{ + g_dyn_value_list = NewList(NULL); +} + +// Solution of dynamic value list +void FreeDynList() +{ + UINT i; + if (g_dyn_value_list == NULL) + { + return; + } + + for (i = 0; i < LIST_NUM(g_dyn_value_list); i++) + { + DYN_VALUE *d = LIST_DATA(g_dyn_value_list, i); + + Free(d); + } + + ReleaseList(g_dyn_value_list); + + g_dyn_value_list = NULL; +} + +// Disable NAT-T function globally +void DisableRDUPServerGlobally() +{ + g_no_rudp_server = true; +} + +// Get the current time zone +int GetCurrentTimezone() +{ + int ret = 0; + +#ifdef OS_WIN32 + ret = GetCurrentTimezoneWin32(); +#else // OS_WIN32 + { +#if defined(UNIX_MACOS) || defined(UNIX_BSD) + struct timeval tv; + struct timezone tz; + + Zero(&tv, sizeof(tv)); + Zero(&tz, sizeof(tz)); + + gettimeofday(&tv, &tz); + + ret = tz.tz_minuteswest; + +#else // defined(UNIX_MACOS) || defined(UNIX_BSD) + tzset(); + + ret = timezone / 60; +#endif // defined(UNIX_MACOS) || defined(UNIX_BSD) + } +#endif // OS_WIN32 + + return ret; +} + +// Flag of whether to use the DNS proxy +bool IsUseDnsProxy() +{ + return false; +} + +// Flag of whether to use an alternate host name +bool IsUseAlternativeHostname() +{ + + return false; +} + +#ifdef OS_WIN32 +// Get the current time zone (Win32) +int GetCurrentTimezoneWin32() +{ + TIME_ZONE_INFORMATION info; + Zero(&info, sizeof(info)); + + if (GetTimeZoneInformation(&info) == TIME_ZONE_ID_INVALID) + { + return 0; + } + + return info.Bias; +} +#endif // OS_WIN32 + + +// Set the current FQDN of the DDNS +void SetCurrentDDnsFqdn(char *name) +{ + // Validate arguments + if (name == NULL) + { + return; + } + + Lock(current_fqdn_lock); + { + StrCpy(current_fqdn, sizeof(current_fqdn), name); + } + Unlock(current_fqdn_lock); +} + +// Get the current DDNS FQDN hash +UINT GetCurrentDDnsFqdnHash() +{ + UINT ret; + UCHAR hash[SHA1_SIZE]; + char name[MAX_SIZE]; + + ClearStr(name, sizeof(name)); + GetCurrentDDnsFqdn(name, sizeof(name)); + + Trim(name); + StrUpper(name); + + Sha1(hash, name, StrLen(name)); + + Copy(&ret, hash, sizeof(UINT)); + + return ret; +} + +// Get the current DDNS FQDN +void GetCurrentDDnsFqdn(char *name, UINT size) +{ + ClearStr(name, size); + // Validate arguments + if (name == NULL || size == 0) + { + return; + } + + Lock(current_fqdn_lock); + { + StrCpy(name, size, current_fqdn); + } + Unlock(current_fqdn_lock); + + Trim(name); +} + +// Check whether the specified MAC address exists on the local host (high speed) +bool IsMacAddressLocalFast(void *addr) +{ + bool ret = false; + // Validate arguments + if (addr == NULL) + { + return false; + } + + Lock(local_mac_list_lock); + { + if (local_mac_list == NULL) + { + // First enumeration + RefreshLocalMacAddressList(); + } + + ret = IsMacAddressLocalInner(local_mac_list, addr); + } + Unlock(local_mac_list_lock); + + return ret; +} + +// Update the local MAC address list +void RefreshLocalMacAddressList() +{ + Lock(local_mac_list_lock); + { + if (local_mac_list != NULL) + { + FreeNicList(local_mac_list); + } + + local_mac_list = GetNicList(); + } + Unlock(local_mac_list_lock); +} + +// Check whether the specified MAC address exists on the local host +bool IsMacAddressLocalInner(LIST *o, void *addr) +{ + bool ret = false; + UINT i; + // Validate arguments + if (o == NULL || addr == NULL) + { + return false; + } + + for (i = 0; i < LIST_NUM(o); i++) + { + NIC_ENTRY *e = LIST_DATA(o, i); + + if (Cmp(e->MacAddress, addr, 6) == 0) + { + ret = true; + break; + } + } + + return ret; +} + +// Get a list of the NICs on the computer +LIST *GetNicList() +{ + LIST *o = NULL; + +#ifdef OS_WIN32 + o = Win32GetNicList(); + + if (o != NULL) + { + return o; + } + +#endif // OS_WIN32 + + return NewListFast(NULL); +} + +#ifdef OS_WIN32 +LIST *Win32GetNicList() +{ + UINT i; + LIST *o = NewListFast(NULL); + MS_ADAPTER_LIST *al = MsCreateAdapterList(); + + if (al == NULL) + { + return NULL; + } + + for (i = 0; i < al->Num; i++) + { + MS_ADAPTER *a = al->Adapters[i]; + + if (a->Type == 6 && a->AddressSize == 6) + { + NIC_ENTRY *e = ZeroMalloc(sizeof(NIC_ENTRY)); + + StrCpy(e->IfName, sizeof(e->IfName), a->Title); + Copy(e->MacAddress, a->Address, 6); + + Add(o, e); + } + } + + MsFreeAdapterList(al); + + return o; +} +#endif // OS_WIN32 + +// Release the NIC list +void FreeNicList(LIST *o) +{ + UINT i; + // Validate arguments + if (o == NULL) + { + return; + } + + for (i = 0; i < LIST_NUM(o); i++) + { + NIC_ENTRY *e = LIST_DATA(o, i); + + Free(e); + } + + ReleaseList(o); +} + +// If the computer is connected to the FLET'S line currently, detect the type of the line (obsolete) +UINT DetectFletsType() +{ + UINT ret = 0; + //LIST *o = GetHostIPAddressList(); +// UINT i; + + /* + for (i = 0;i < LIST_NUM(o);i++) + { + IP *ip = LIST_DATA(o, i); + + if (IsIP6(ip)) + { + char ip_str[MAX_SIZE]; + + IPToStr(ip_str, sizeof(ip_str), ip); + + if (IsInSameNetwork6ByStr(ip_str, "2001:c90::", "/32")) + { + // NTT East B-FLETs + ret |= FLETS_DETECT_TYPE_EAST_BFLETS_PRIVATE; + } + + if (IsInSameNetwork6ByStr(ip_str, "2408:200::", "/23")) + { + // Wrapping in network of NTT East NGN + ret |= FLETS_DETECT_TYPE_EAST_NGN_PRIVATE; + } + + if (IsInSameNetwork6ByStr(ip_str, "2001:a200::", "/23")) + { + // Wrapping in network of NTT West NGN + ret |= FLETS_DETECT_TYPE_WEST_NGN_PRIVATE; + } + } + } + + FreeHostIPAddressList(o); + */ + return ret; +} + +// Query for the IP address using the DNS proxy for the B FLETs +bool GetIPViaDnsProxyForJapanFlets(IP *ip_ret, char *hostname, bool ipv6, UINT timeout, bool *cancel, char *dns_proxy_hostname) +{ + SOCK *s; + char connect_hostname[MAX_SIZE]; + char connect_hostname2[MAX_SIZE]; + IP dns_proxy_ip; + bool ret = false; + bool dummy_flag = false; + char request_str[512]; + // Validate arguments + if (ip_ret == NULL || hostname == NULL) + { + return false; + } + if (timeout == 0) + { + timeout = BFLETS_DNS_PROXY_TIMEOUT_FOR_QUERY; + } + if (cancel == NULL) + { + cancel = &dummy_flag; + } + + // Get the IP address of the DNS proxy server + if (IsEmptyStr(dns_proxy_hostname)) + { + // B FLETs + if (GetDnsProxyIPAddressForJapanBFlets(&dns_proxy_ip, BFLETS_DNS_PROXY_TIMEOUT_FOR_GET_F, cancel) == false) + { + return false; + } + } + else + { + // FLET'S NEXT + if (GetIP4Ex6Ex2(&dns_proxy_ip, dns_proxy_hostname, FLETS_NGN_DNS_QUERY_TIMEOUT, true, cancel, true) == false) + { + return false; + } + } + + if (*cancel) + { + return false; + } + + IPToStr(connect_hostname, sizeof(connect_hostname), &dns_proxy_ip); + + /*{ + StrCpy(connect_hostname, sizeof(connect_hostname), "2409:250:62c0:100:6a05:caff:fe09:5158"); + }*/ + + StrCpy(connect_hostname2, sizeof(connect_hostname2), connect_hostname); + if (IsIP6(&dns_proxy_ip)) + { + Format(connect_hostname2, sizeof(connect_hostname2), "[%s]", connect_hostname); + } + + s = ConnectEx3(connect_hostname, BFLETS_DNS_PROXY_PORT, timeout, cancel, NULL, NULL, false, false); + + if (s == NULL) + { + return false; + } + + if (*cancel) + { + Disconnect(s); + ReleaseSock(s); + + return false; + } + + SetTimeout(s, timeout); + + // Start the SSL + if (StartSSLEx(s, NULL, NULL, 0, NULL) && (*cancel == false)) + { + UCHAR hash[SHA1_SIZE]; + BUF *hash2 = StrToBin(BFLETS_DNS_PROXY_CERT_HASH); + + Zero(hash, sizeof(hash)); + GetXDigest(s->RemoteX, hash, true); + + if (Cmp(hash, hash2->Buf, SHA1_SIZE) == 0) + { + // Send the HTTP Request + Format(request_str, sizeof(request_str), + "GET " BFLETS_DNS_PROXY_PATH "?q=%s&ipv6=%u\r\n" + "\r\n", + hostname, ipv6, connect_hostname2); + + if (SendAll(s, request_str, StrLen(request_str), true)) + { + if (*cancel == false) + { + BUF *recv_buf = NewBuf(); + UINT port_ret; + + while (true) + { + UCHAR tmp[MAX_SIZE]; + UINT r; + + r = Recv(s, tmp, sizeof(tmp), true); + + if (r == 0 || (recv_buf->Size > 65536)) + { + break; + } + else + { + WriteBuf(recv_buf, tmp, r); + } + } + + ret = RUDPParseIPAndPortStr(recv_buf->Buf, recv_buf->Size, ip_ret, &port_ret); + + FreeBuf(recv_buf); + } + } + } + + FreeBuf(hash2); + } + + Disconnect(s); + ReleaseSock(s); + + if (ret) + { + NewDnsCache(hostname, ip_ret); + } + + return ret; +} + +// Get the IP address of the available DNS proxy in B-FLET'S service that is provided by NTT East of Japan +bool GetDnsProxyIPAddressForJapanBFlets(IP *ip_ret, UINT timeout, bool *cancel) +{ + BUF *b; + LIST *o; + bool ret = false; + // Validate arguments + if (ip_ret == NULL) + { + return false; + } + if (timeout == 0) + { + timeout = BFLETS_DNS_PROXY_TIMEOUT_FOR_GET_F; + } + + b = QueryFileByUdpForJapanBFlets(timeout, cancel); + + if (b == NULL) + { + return false; + } + + o = ReadIni(b); + + if (o != NULL) + { + INI_ENTRY *e = GetIniEntry(o, "DDnsServerForBFlets"); + + if (e != NULL) + { + char *s = e->Value; + + if (IsEmptyStr(s) == false) + { + IP ip; + + if (StrToIP(&ip, s)) + { + if (IsZeroIp(&ip) == false) + { + Copy(ip_ret, &ip, sizeof(IP)); + ret = true; + } + } + } + } + } + + FreeIni(o); + FreeBuf(b); + + return ret; +} + +// Get a valid F.txt file in B-FLET'S service that is provided by NTT East of Japan +BUF *QueryFileByUdpForJapanBFlets(UINT timeout, bool *cancel) +{ + bool dummy_flag = false; + BUF *txt_buf = NULL; + BUF *ret = NULL; + LIST *ip_list = NULL; + UINT i; + // Validate arguments + if (cancel == NULL) + { + cancel = &dummy_flag; + } + if (timeout == 0) + { + timeout = BFLETS_DNS_PROXY_TIMEOUT_FOR_GET_F; + } + + txt_buf = ReadDump(UDP_FILE_QUERY_BFLETS_TXT_FILENAME); + if (txt_buf == NULL) + { + return NULL; + } + + ip_list = NewListFast(NULL); + + while (true) + { + char *line = CfgReadNextLine(txt_buf); + if (line == NULL) + { + break; + } + + Trim(line); + + if (IsEmptyStr(line) == false && StartWith(line, "#") == false) + { + IP ip; + + if (StrToIP6(&ip, line)) + { + if (IsZeroIp(&ip) == false) + { + if (IsIPv6LocalNetworkAddress(&ip) == false) + { + Add(ip_list, Clone(&ip, sizeof(IP))); + } + } + } + } + + Free(line); + } + + FreeBuf(txt_buf); + + ret = QueryFileByIPv6Udp(ip_list, timeout, cancel); + + for (i = 0; i < LIST_NUM(ip_list); i++) + { + IP *ip = LIST_DATA(ip_list, i); + + Free(ip); + } + + ReleaseList(ip_list); + + return ret; +} + +// Request a file by UDP (send the requests to the multiple IP addresses at the same time) +BUF *QueryFileByIPv6Udp(LIST *ip_list, UINT timeout, bool *cancel) +{ + bool dummy_flag = false; + UINT64 start_tick, giveup_tick; + UINT64 next_send_tick; + SOCK *s; + INTERRUPT_MANAGER *interrupt; + BUF *buf = NULL; + SOCK_EVENT *se; + UCHAR *tmp_buf; + UINT tmp_buf_size = 65535; + // Validate arguments + if (cancel == NULL) + { + cancel = &dummy_flag; + } + if (ip_list == NULL) + { + return NULL; + } + + s = NewUDP6(0, NULL); + if (s == NULL) + { + return NULL; + } + + tmp_buf = Malloc(tmp_buf_size); + + start_tick = Tick64(); + giveup_tick = start_tick + (UINT64)timeout; + next_send_tick = 0; + + interrupt = NewInterruptManager(); + + AddInterrupt(interrupt, giveup_tick); + + se = NewSockEvent(); + JoinSockToSockEvent(s, se); + + while (true) + { + UINT64 now = Tick64(); + + if (now >= giveup_tick) + { + // Time-out + break; + } + + if (*cancel) + { + // User canceled + break; + } + + // Receive + while (true) + { + IP src_ip; + UINT src_port; + UINT r; + + r = RecvFrom(s, &src_ip, &src_port, tmp_buf, tmp_buf_size); + + if (r == SOCK_LATER || r == 0) + { + break; + } + + if (src_port == UDP_FILE_QUERY_DST_PORT) + { + if (r >= 40) + { + if (Cmp(tmp_buf, UDP_FILE_QUERY_MAGIC_NUMBER, StrLen(UDP_FILE_QUERY_MAGIC_NUMBER)) == 0) + { + // Successful reception + buf = NewBuf(); + WriteBuf(buf, tmp_buf, r); + SeekBuf(buf, 0, 0); + break; + } + } + } + } + + if (buf != NULL) + { + // Successful reception + break; + } + + if (next_send_tick == 0 || (now >= next_send_tick)) + { + // Transmission + UINT i; + for (i = 0; i < LIST_NUM(ip_list); i++) + { + IP *ip = LIST_DATA(ip_list, i); + UCHAR c = 'F'; + + SendTo(s, ip, UDP_FILE_QUERY_DST_PORT, &c, 1); + } + + next_send_tick = now + (UINT64)UDP_FILE_QUERY_RETRY_INTERVAL; + AddInterrupt(interrupt, next_send_tick); + } + + WaitSockEvent(se, GetNextIntervalForInterrupt(interrupt)); + } + + FreeInterruptManager(interrupt); + + Disconnect(s); + ReleaseSock(s); + + ReleaseSockEvent(se); + + Free(tmp_buf); + + return buf; +} + +// Parse the user name of the NT +void ParseNtUsername(char *src_username, char *dst_username, UINT dst_username_size, char *dst_domain, UINT dst_domain_size, bool do_not_parse_atmark) +{ + char tmp_username[MAX_SIZE]; + char tmp_domain[MAX_SIZE]; + TOKEN_LIST *t; + + if (src_username != dst_username) + { + ClearStr(dst_username, dst_username_size); + } + + ClearStr(dst_domain, dst_domain_size); + // Validate arguments + if (src_username == NULL || dst_username == NULL || dst_domain == NULL) + { + return; + } + + StrCpy(tmp_username, sizeof(tmp_username), src_username); + ClearStr(tmp_domain, sizeof(tmp_domain)); + + // Analysis of username@domain.name format + if (do_not_parse_atmark == false) + { + t = ParseTokenWithNullStr(tmp_username, "@"); + if (t->NumTokens >= 1) + { + StrCpy(tmp_username, sizeof(tmp_username), t->Token[0]); + } + if (t->NumTokens >= 2) + { + StrCpy(tmp_domain, sizeof(tmp_domain), t->Token[1]); + } + FreeToken(t); + } + + // If the username part is in "domain\username" format, split it + t = ParseTokenWithNullStr(tmp_username, "\\"); + if (t->NumTokens >= 2) + { + if (IsEmptyStr(tmp_domain)) + { + StrCpy(tmp_domain, sizeof(tmp_domain), t->Token[0]); + } + + StrCpy(tmp_username, sizeof(tmp_username), t->Token[1]); + } + FreeToken(t); + + StrCpy(dst_username, dst_username_size, tmp_username); + StrCpy(dst_domain, dst_domain_size, tmp_domain); +} + +// The calculation of the optimum MSS value for use in TCP/IP packet in the payload of bulk transfer in R-UDP session +UINT RUDPCalcBestMssForBulk(RUDP_STACK *r, RUDP_SESSION *se) +{ + UINT ret; + // Validate arguments + if (r == NULL || se == NULL) + { + return 0; + } + + ret = MTU_FOR_PPPOE; + + // IPv4 + if (IsIP6(&se->YourIp) == false) + { + ret -= 20; + } + else + { + ret -= 40; + } + + if (r->Protocol == RUDP_PROTOCOL_ICMP) + { + // ICMP + ret -= 8; + + ret -= SHA1_SIZE; + } + else if (r->Protocol == RUDP_PROTOCOL_DNS) + { + // UDP + ret -= 8; + + // DNS + ret -= 42; + } + + // IV + ret -= SHA1_SIZE; + + // Sign + ret -= SHA1_SIZE; + + // SEQ_NO + ret -= sizeof(UINT64); + + // Padding Max + ret -= 31; + + // Ethernet header (target packets of communication) + ret -= 14; + + // IPv4 Header (target packet of communication) + ret -= 20; + + // TCP header (target packet of communication) + ret -= 20; + + // I don't know well, but subtract 24 bytes + ret -= 24; + + return ret; +} + +// Processing of the reply packet from the NAT-T server +void RUDPProcess_NatT_Recv(RUDP_STACK *r, UDPPACKET *udp) +{ + BUF *b; + PACK *p; + // Validate arguments + if (r == NULL || udp == NULL) + { + return; + } + + if (udp->Size >= 8) + { + char tmp[128]; + + Zero(tmp, sizeof(tmp)); + Copy(tmp, udp->Data, MIN(udp->Size, sizeof(tmp) - 1)); + + if (StartWith(tmp, "IP=")) + { + IP my_ip; + UINT my_port; + + // There was a response to the packet to determine the NAT state + if (IsEmptyStr(r->NatT_Registered_IPAndPort) == false) + { + if (StrCmpi(r->NatT_Registered_IPAndPort, tmp) != 0) + { + // Redo getting the token and registration because the NAT state is changed + ClearStr(r->NatT_Registered_IPAndPort, sizeof(r->NatT_Registered_IPAndPort)); + + r->NatT_GetTokenNextTick = 0; + r->NatT_GetTokenFailNum = 0; + r->NatT_Token_Ok = false; + Zero(r->NatT_Token, sizeof(r->NatT_Token)); + + r->NatT_RegisterNextTick = 0; + r->NatT_RegisterFailNum = 0; + r->NatT_Register_Ok = false; + } + } + + if (RUDPParseIPAndPortStr(udp->Data, udp->Size, &my_ip, &my_port)) + { + if (r->NatTGlobalUdpPort != NULL) + { + *r->NatTGlobalUdpPort = my_port; + } + } + + return; + } + } + + // Interpret the UDP packet + b = NewBuf(); + WriteBuf(b, udp->Data, udp->Size); + SeekBuf(b, 0, 0); + + p = BufToPack(b); + + if (p != NULL) + { + bool is_ok = PackGetBool(p, "ok"); + UINT64 tran_id = PackGetInt64(p, "tran_id"); + + ExtractAndApplyDynList(p); + + if (r->ServerMode) + { + if (PackCmpStr(p, "opcode", "get_token")) + { + // Get the Token + if (is_ok && (tran_id == r->NatT_TranId)) + { + char tmp[MAX_SIZE]; + + if (PackGetStr(p, "token", tmp, sizeof(tmp)) && IsEmptyStr(tmp) == false) + { + char myip[MAX_SIZE]; + // Acquisition success + StrCpy(r->NatT_Token, sizeof(r->NatT_Token), tmp); + r->NatT_Token_Ok = true; + r->NatT_GetTokenNextTick = r->Now + (UINT64)GenRandInterval(UDP_NAT_T_GET_TOKEN_INTERVAL_2_MIN, UDP_NAT_T_GET_TOKEN_INTERVAL_2_MAX); + r->NatT_GetTokenFailNum = 0; + + // Since success to obtain the self global IPv4 address, + // re-obtain the destination NAT-T host from this IPv4 address + if (PackGetStr(p, "your_ip", myip, sizeof(myip))) + { + IP ip; + char new_hostname[MAX_SIZE]; + + StrToIP(&ip, myip); + + SetCurrentGlobalIP(&ip, false); + + RUDPGetRegisterHostNameByIP(new_hostname, + sizeof(new_hostname), &ip); + + Lock(r->Lock); + { + if (StrCmpi(r->CurrentRegisterHostname, new_hostname) != 0) + { + r->NumChangedHostname++; + + if (r->NumChangedHostname <= RUDP_NATT_MAX_CONT_CHANGE_HOSTNAME) + { + if (r->NumChangedHostnameValueResetTick == 0) + { + r->NumChangedHostnameValueResetTick = r->Now + (UINT64)RUDP_NATT_CONT_CHANGE_HOSTNAME_RESET_INTERVAL; + } + + // Change the host name + Debug("CurrentRegisterHostname Changed: New=%s\n", new_hostname); + StrCpy(r->CurrentRegisterHostname, sizeof(r->CurrentRegisterHostname), new_hostname); + + Zero(&r->NatT_IP, sizeof(r->NatT_IP)); + //Zero(&r->NatT_IP_Safe, sizeof(r->NatT_IP_Safe)); + + Set(r->HaltEvent); + } + else + { + if (r->NumChangedHostnameValueResetTick == 0) + { + r->NumChangedHostnameValueResetTick = r->Now + (UINT64)RUDP_NATT_CONT_CHANGE_HOSTNAME_RESET_INTERVAL; + } + + if (r->Now >= r->NumChangedHostnameValueResetTick) + { + r->NumChangedHostname = 0; + r->NumChangedHostnameValueResetTick = 0; + } + } + } + else + { + r->NumChangedHostname = 0; + r->NumChangedHostnameValueResetTick = 0; + } + } + Unlock(r->Lock); + } + + AddInterrupt(r->Interrupt, r->NatT_GetTokenNextTick); + } + } + } + else if (PackCmpStr(p, "opcode", "nat_t_register")) + { + // NAT-T server registration result + if (is_ok && (tran_id == r->NatT_TranId)) + { + UINT my_global_port; + // Successful registration + r->NatT_Register_Ok = true; + r->NatT_RegisterNextTick = r->Now + (UINT64)GenRandInterval(UDP_NAT_T_REGISTER_INTERVAL_MIN, UDP_NAT_T_REGISTER_INTERVAL_MAX); + r->NatT_RegisterFailNum = 0; + + Debug("NAT-T Registered.\n"); + + // Save the IP address and port number at the time of registration + PackGetStr(p, "your_ip_and_port", r->NatT_Registered_IPAndPort, sizeof(r->NatT_Registered_IPAndPort)); + + if (g_source_ip_validation_force_disable == false) + { + // Enable the source IP address validation mechanism + r->NatT_EnableSourceIpValidation = PackGetBool(p, "enable_source_ip_validation"); + + } + else + { + // Force disable the source IP address validation mechanism + r->NatT_EnableSourceIpValidation = false; + } + + // Global port of itself + my_global_port = PackGetInt(p, "your_port"); + + if (my_global_port != 0) + { + if (r->NatTGlobalUdpPort != NULL) + { + *r->NatTGlobalUdpPort = my_global_port; + } + } + + AddInterrupt(r->Interrupt, r->NatT_RegisterNextTick); + } + } + else if (PackCmpStr(p, "opcode", "nat_t_connect_relay")) + { + // Connection request from the client via the NAT-T server + if (is_ok && (PackGetInt64(p, "session_key") == r->NatT_SessionKey)) + { + char client_ip_str[MAX_SIZE]; + UINT client_port; + IP client_ip; + + PackGetStr(p, "client_ip", client_ip_str, sizeof(client_ip_str)); + client_port = PackGetInt(p, "client_port"); + StrToIP(&client_ip, client_ip_str); + + if (IsZeroIp(&client_ip) == false && client_port != 0) + { + UCHAR *rand_data; + UINT rand_size; + + if (r->NatT_EnableSourceIpValidation) + { + RUDPAddIpToValidateList(r, &client_ip); + } + + rand_size = Rand32() % 19; + rand_data = Malloc(rand_size); + + Rand(rand_data, rand_size); + + RUDPSendPacket(r, &client_ip, client_port, rand_data, rand_size, 0); + + Free(rand_data); + } + } + } + } + + FreePack(p); + } + + FreeBuf(b); +} + +// Process such as packet transmission for NAT-T server +void RUDPDo_NatT_Interrupt(RUDP_STACK *r) +{ + // Validate arguments + if (r == NULL) + { + return; + } + + if (r->ServerMode) + { + + if (g_no_rudp_register == false && IsZeroIp(&r->NatT_IP_Safe) == false) + { + if (r->NatT_GetTokenNextTick == 0 || r->Now >= r->NatT_GetTokenNextTick) + { + // Try to get a token from the NAT-T server periodically + PACK *p = NewPack(); + BUF *b; + + PackAddStr(p, "opcode", "get_token"); + PackAddInt64(p, "tran_id", r->NatT_TranId); + PackAddInt(p, "nat_traversal_version", UDP_NAT_TRAVERSAL_VERSION); + + b = PackToBuf(p); + FreePack(p); + + RUDPSendPacket(r, &r->NatT_IP_Safe, UDP_NAT_T_PORT, b->Buf, b->Size, 0); + + FreeBuf(b); + + // Determine the next acquisition time + r->NatT_GetTokenFailNum++; + r->NatT_GetTokenNextTick = r->Now + (UINT64)(UDP_NAT_T_GET_TOKEN_INTERVAL_1 * (UINT64)MIN(r->NatT_GetTokenFailNum, UDP_NAT_T_GET_TOKEN_INTERVAL_FAIL_MAX)); + AddInterrupt(r->Interrupt, r->NatT_GetTokenNextTick); + r->NatT_Token_Ok = false; + } + } + + { + if (IsZeroIp(&r->NatT_IP_Safe) == false) + { + // Normal servers: Send request packets to the NAT-T server + if (r->NatT_NextNatStatusCheckTick == 0 || r->Now >= r->NatT_NextNatStatusCheckTick) + { + UCHAR a = 'A'; + UINT ddns_hash; + // Check of the NAT state + RUDPSendPacket(r, &r->NatT_IP_Safe, UDP_NAT_T_PORT, &a, 1, 0); + + // Execution time of the next + r->NatT_NextNatStatusCheckTick = r->Now + (UINT64)GenRandInterval(UDP_NAT_T_NAT_STATUS_CHECK_INTERVAL_MIN, UDP_NAT_T_NAT_STATUS_CHECK_INTERVAL_MAX); + AddInterrupt(r->Interrupt, r->NatT_NextNatStatusCheckTick); + + // Check whether the DDNS host name changing have not occurred + ddns_hash = GetCurrentDDnsFqdnHash(); + + if (r->LastDDnsFqdnHash != ddns_hash) + { + r->LastDDnsFqdnHash = ddns_hash; + // Do the Register immediately if there is a change in the DDNS host name + r->NatT_RegisterNextTick = 0; + } + } + } + } + + if (r->NatT_Token_Ok && g_no_rudp_register == false && IsZeroIp(&r->NatT_IP_Safe) == false) + { + if (r->NatT_RegisterNextTick == 0 || r->Now >= r->NatT_RegisterNextTick) + { + // Try to register itself periodically for NAT-T server + PACK *p = NewPack(); + BUF *b; + char private_ip_str[MAX_SIZE]; + char machine_key[MAX_SIZE]; + char machine_name[MAX_SIZE]; + UCHAR hash[SHA1_SIZE]; + char ddns_fqdn[MAX_SIZE]; + + Debug("NAT-T Registering...\n"); + + GetCurrentDDnsFqdn(ddns_fqdn, sizeof(ddns_fqdn)); + + PackAddStr(p, "opcode", "nat_t_register"); + PackAddInt64(p, "tran_id", r->NatT_TranId); + PackAddStr(p, "token", r->NatT_Token); + PackAddStr(p, "svc_name", r->SvcName); + PackAddStr(p, "product_str", "SoftEther OSS"); + PackAddInt64(p, "session_key", r->NatT_SessionKey); + PackAddInt(p, "nat_traversal_version", UDP_NAT_TRAVERSAL_VERSION); + + + if (g_natt_low_priority) + { + PackAddBool(p, "low_priority", g_natt_low_priority); + } + + Zero(private_ip_str, sizeof(private_ip_str)); + if (IsZeroIp(&r->My_Private_IP_Safe) == false) + { + IPToStr(private_ip_str, sizeof(private_ip_str), &r->My_Private_IP_Safe); + PackAddStr(p, "private_ip", private_ip_str); + } + + PackAddInt(p, "private_port", r->UdpSock->LocalPort); + + Zero(hash, sizeof(hash)); + GetCurrentMachineIpProcessHash(hash); + BinToStr(machine_key, sizeof(machine_key), hash, sizeof(hash)); + PackAddStr(p, "machine_key", machine_key); + + Zero(machine_name, sizeof(machine_name)); + GetMachineName(machine_name, sizeof(machine_name)); + PackAddStr(p, "host_name", machine_name); + PackAddStr(p, "ddns_fqdn", ddns_fqdn); + + b = PackToBuf(p); + FreePack(p); + + RUDPSendPacket(r, &r->NatT_IP_Safe, UDP_NAT_T_PORT, b->Buf, b->Size, 0); + //RUDPSendPacket(r, &r->NatT_IP_Safe, UDP_NAT_T_PORT, "a", 1); + + FreeBuf(b); + + // Determine the next acquisition time + r->NatT_RegisterFailNum++; + r->NatT_RegisterNextTick = r->Now + (UINT64)UDP_NAT_T_REGISTER_INTERVAL_INITIAL * (UINT64)MIN(r->NatT_RegisterFailNum, UDP_NAT_T_REGISTER_INTERVAL_FAIL_MAX); + AddInterrupt(r->Interrupt, r->NatT_RegisterNextTick); + r->NatT_Register_Ok = false; + } + } + } +} + +// R-UDP packet reception procedure +void RUDPRecvProc(RUDP_STACK *r, UDPPACKET *p) +{ + RUDP_SESSION *se = NULL; + // Validate arguments + if (r == NULL || p == NULL) + { + return; + } + + if (r->ServerMode) + { + if (g_no_rudp_server) + { + return; + } + } + + if (r->ServerMode && r->NoNatTRegister == false) + { + + if (p->SrcPort == UDP_NAT_T_PORT && CmpIpAddr(&p->SrcIP, &r->NatT_IP_Safe) == 0) + { + // There was a response from the NAT-T server + RUDPProcess_NatT_Recv(r, p); + return; + } + } + + if (r->ServerMode) + { + if (r->ProcRpcRecv != NULL) + { + if (r->ProcRpcRecv(r, p)) + { + return; + } + } + } + + if (r->ServerMode) + { + // Search the session by the end-point information if in the server mode + se = RUDPSearchSession(r, &p->DstIP, p->DestPort, &p->SrcIP, p->SrcPort); + } + else + { + // Session should exist only one in the case of client mode + if (LIST_NUM(r->SessionList) >= 1) + { + se = LIST_DATA(r->SessionList, 0); + } + else + { + se = NULL; + } + } + + if (p->Size < 20) + { + // The received packet is too small + if (r->ServerMode == false) + { + if (se != NULL && se->Status == RUDP_SESSION_STATUS_CONNECT_SENT) + { + if (CmpIpAddr(&se->YourIp, &p->SrcIP) == 0) + { + // If the connection initialization packet which is shorter than 20 bytes + // has been received from the server side, overwrite the source port number + // of the packet to the client-side session information (for some NAT) + se->YourPort = p->SrcPort; + } + } + } + return; + } + + if (se == NULL && r->ServerMode && p->Size >= 40) + { + // Corresponding to a sudden change of port number on the client side. + // The target session is a session which matches the client side IP address + // and the key and the signature is verified + UINT i; + for (i = 0; i < LIST_NUM(r->SessionList); i++) + { + RUDP_SESSION *s = LIST_DATA(r->SessionList, i); + + if (CmpIpAddr(&s->YourIp, &p->SrcIP) == 0) + { + if (RUDPCheckSignOfRecvPacket(r, s, p->Data, p->Size)) + { + // Signature matched + se = s; + break; + } + } + } + } + + if (se == NULL) + { + // There is no session + if (r->ServerMode) + { + if (p->Size < 40) + { + bool ok = true; + UCHAR ctoken_hash[SHA1_SIZE]; + + Zero(ctoken_hash, sizeof(ctoken_hash)); + + // Examine the quota of new session creation + if (LIST_NUM(r->SessionList) >= RUDP_QUOTA_MAX_NUM_SESSIONS) + { + // Entire number of sessions exceeds the limit + ok = false; + } + else if (r->NatT_EnableSourceIpValidation && RUDPIsIpInValidateList(r, &p->SrcIP) == false) + { + // Invalid source IP address, which is not registered on the validated source IP address list + ok = false; + } + else + { + UINT i; + // Check the number of sessions per IP address + UINT num = 0; + + for (i = 0; i < LIST_NUM(r->SessionList); i++) + { + RUDP_SESSION *se = LIST_DATA(r->SessionList, i); + + if (CmpIpAddr(&se->YourIp, &p->SrcIP) == 0) + { + num++; + } + } + + if (num >= RUDP_QUOTA_MAX_NUM_SESSIONS_PER_IP) + { + // Limit exceeded the number of sessions per IP address + ok = false; + } + } + + + if (ok) + { + char ip_str[64]; + + // Create a session since a new session creation request packet was received + se = RUDPNewSession(true, &p->DstIP, p->DestPort, &p->SrcIP, p->SrcPort, p->Data); + se->Status = RUDP_SESSION_STATUS_ESTABLISHED; + Insert(r->SessionList, se); + + IPToStr(ip_str, sizeof(ip_str), &p->SrcIP); + Debug("RUDPNewSession %X %s:%u\n", se, ip_str, p->SrcPort); + + if (r->Protocol == RUDP_PROTOCOL_ICMP) + { + // In case of ICMP, save the ICMP TYPE number to use + se->Icmp_Type = (p->Type == ICMP_TYPE_INFORMATION_REQUEST ? ICMP_TYPE_INFORMATION_REPLY : p->Type); + } + else if (r->Protocol == RUDP_PROTOCOL_DNS) + { + // Save the Tran ID to be used if it's a DNS + se->Dns_TranId = (USHORT)p->Type; + } + } + } + } + } + else + { + if (p->Size < 40) + { + if (r->ServerMode) + { + if (Cmp(se->Key_Init, p->Data, SHA1_SIZE) == 0) + { + // New session creation request packet have received more than once. reply an ACK immediately for second and subsequent + se->LastSentTick = 0; + + // Update the endpoint information + Copy(&se->YourIp, &p->SrcIP, sizeof(IP)); + se->YourPort = p->SrcPort; + + if (r->Protocol == RUDP_PROTOCOL_ICMP) + { + // In case of ICMP, save the ICMP TYPE number to use + se->Icmp_Type = (p->Type == ICMP_TYPE_INFORMATION_REQUEST ? ICMP_TYPE_INFORMATION_REPLY : p->Type); + } + else if (r->Protocol == RUDP_PROTOCOL_DNS) + { + // Save the Tran ID to be used if it's a DNS + se->Dns_TranId = (USHORT)p->Type; + } + } + else + { + // Since the different session creation request packet have been received from the same end point, ignore it + } + } + } + else + { + // Process the received packet + if (RUDPProcessRecvPacket(r, se, p->Data, p->Size) || RUDPProcessBulkRecvPacket(r, se, p->Data, p->Size)) + { + // Update endpoint information (only the port number) + //Copy(&se->YourIp, &p->SrcIP, sizeof(IP)); + se->YourPort = p->SrcPort; + + if (r->Protocol == RUDP_PROTOCOL_ICMP) + { + // In case of ICMP, save the ICMP TYPE number to use + if (r->ServerMode) + { + se->Icmp_Type = (p->Type == ICMP_TYPE_INFORMATION_REQUEST ? ICMP_TYPE_INFORMATION_REPLY : p->Type); + } + else + { + se->Icmp_Type = (p->Type == ICMP_TYPE_INFORMATION_REPLY ? ICMP_TYPE_INFORMATION_REQUEST : p->Type); + } + } + else if (r->Protocol == RUDP_PROTOCOL_DNS) + { + if (r->ServerMode) + { + // Save the Tran ID to be used if it's a DNS + se->Dns_TranId = (USHORT)p->Type; + } + } + } + } + } +} + +// Check whether the specificed IP address is in the validated source IP address list +bool RUDPIsIpInValidateList(RUDP_STACK *r, IP *ip) +{ + UINT i; + UINT64 now = Tick64(); + LIST *o = NULL; + bool ret = false; + // Validate arguments + if (r == NULL || ip == NULL) + { + return false; + } + + // Always allow private IP addresses + if (IsIPPrivate(ip)) + { + return true; + } + + if (IsIPAddressInSameLocalNetwork(ip)) + { + return true; + } + + for (i = 0; i < LIST_NUM(r->NatT_SourceIpList); i++) + { + RUDP_SOURCE_IP *s = (RUDP_SOURCE_IP *)LIST_DATA(r->NatT_SourceIpList, i); + + if (s->ExpiresTick <= now) + { + if (o == NULL) + { + o = NewListFast(NULL); + } + + Add(o, s); + } + } + + if (o != NULL) + { + for (i = 0; i < LIST_NUM(o); i++) + { + RUDP_SOURCE_IP *s = (RUDP_SOURCE_IP *)LIST_DATA(o, i); + + Delete(r->NatT_SourceIpList, s); + + Free(s); + } + + ReleaseList(o); + } + + for (i = 0; i < LIST_NUM(r->NatT_SourceIpList); i++) + { + RUDP_SOURCE_IP *s = (RUDP_SOURCE_IP *)LIST_DATA(r->NatT_SourceIpList, i); + + if (CmpIpAddr(&s->ClientIP, ip) == 0) + { + ret = true; + break; + } + } + + Debug("RUDP: NAT-T: Validate IP: %r, ret=%u (current list len = %u)\n", ip, ret, LIST_NUM(r->NatT_SourceIpList)); + + return ret; +} + +// Add an IP address to the validated source IP address list +void RUDPAddIpToValidateList(RUDP_STACK *r, IP *ip) +{ + UINT i; + RUDP_SOURCE_IP *sip; + UINT64 now = Tick64(); + LIST *o = NULL; + // Validate arguments + if (r == NULL || ip == NULL) + { + return; + } + + if (LIST_NUM(r->NatT_SourceIpList) >= RUDP_MAX_VALIDATED_SOURCE_IP_ADDRESSES) + { + return; + } + + for (i = 0; i < LIST_NUM(r->NatT_SourceIpList); i++) + { + RUDP_SOURCE_IP *s = (RUDP_SOURCE_IP *)LIST_DATA(r->NatT_SourceIpList, i); + + if (s->ExpiresTick <= now) + { + if (o == NULL) + { + o = NewListFast(NULL); + } + + Add(o, s); + } + } + + if (o != NULL) + { + for (i = 0; i < LIST_NUM(o); i++) + { + RUDP_SOURCE_IP *s = (RUDP_SOURCE_IP *)LIST_DATA(o, i); + + Delete(r->NatT_SourceIpList, s); + + Free(s); + } + + ReleaseList(o); + } + + sip = NULL; + + for (i = 0; i < LIST_NUM(r->NatT_SourceIpList); i++) + { + RUDP_SOURCE_IP *s = (RUDP_SOURCE_IP *)LIST_DATA(r->NatT_SourceIpList, i); + + if (CmpIpAddr(&s->ClientIP, ip) == 0) + { + sip = s; + break; + } + } + + if (sip == NULL) + { + sip = ZeroMalloc(sizeof(RUDP_SOURCE_IP)); + + Copy(&sip->ClientIP, ip, sizeof(IP)); + + Add(r->NatT_SourceIpList, sip); + } + + sip->ExpiresTick = now + (UINT64)RUDP_VALIDATED_SOURCE_IP_ADDRESS_EXPIRES; + + Debug("RUDP: NAT-T: Src IP added: %r (current list len = %u)\n", ip, LIST_NUM(r->NatT_SourceIpList)); +} + +// R-UDP interrupt processing procedure +void RUDPInterruptProc(RUDP_STACK *r) +{ + UINT i; + LIST *o; + // Validate arguments + if (r == NULL) + { + return; + } + + // Packet transmission and other process for NAT-T server + if (r->NoNatTRegister == false) + { + RUDPDo_NatT_Interrupt(r); + } + + if (r->ServerMode == false) + { + if (r->ClientInitiated == false) + { + bool client_target_inited = false; + Lock(r->Lock); + { + client_target_inited = r->TargetIpAndPortInited; + } + Unlock(r->Lock); + + if (client_target_inited) + { + // Start a connection when there is the end point information of the destination server to connect as a client + RUDP_SESSION *se; + UCHAR init_key[SHA1_SIZE]; + char ip_str[128]; + UINT64 ui; + + Rand(init_key, SHA1_SIZE); + + se = RUDPNewSession(false, &r->UdpSock->LocalIP, r->UdpSock->LocalPort, + &r->TargetIp, r->TargetPort, init_key); + + IPToStr(ip_str, sizeof(ip_str), &r->TargetIp); + Debug("RUDPNewSession %X %s:%u\n", se, ip_str, r->TargetPort); + + Insert(r->SessionList, se); + + ui = Endian64(se->Magic_Disconnect); + WriteFifo(se->SendFifo, &ui, sizeof(UINT64)); + + r->ClientInitiated = true; + } + } + } + + // Process for all the sessions + for (i = 0; i < LIST_NUM(r->SessionList); i++) + { + RUDP_SESSION *se = LIST_DATA(r->SessionList, i); + + if (r->Halt) + { + // Disconnect all the sessions if the R-UDP stack stopped + RUDPDisconnectSession(r, se, false); + } + + if (se->FlushBulkSendTube) + { + if (se->TcpSock != NULL && se->TcpSock->BulkSendTube != NULL) + { + TubeFlush(se->TcpSock->BulkSendTube); + } + + se->FlushBulkSendTube = false; + } + + if (se->Status == RUDP_SESSION_STATUS_ESTABLISHED) + { + // Process for all of the sessions which is established a connection + UINT j; + + if (r->Now >= (se->LatestRecvMyTick + (UINT64)RUDP_TIMEOUT)) + { + // Disconnect the session because the fully communication failure is detected for a while + Debug("R-UDP Session %X Timed Out.\n", se); + + RUDPDisconnectSession(r, se, false); + } + + // If there are received segments, read to the part that has arrived in succession + if (FifoSize(se->RecvFifo) <= RUDP_MAX_FIFO_SIZE) + { + LIST *o; + UINT64 current_seq_no; + + o = NULL; + current_seq_no = se->LastRecvCompleteSeqNo; + for (j = 0; j < LIST_NUM(se->RecvSegmentList); j++) + { + RUDP_SEGMENT *s; + + current_seq_no++; + + s = LIST_DATA(se->RecvSegmentList, j); + + if (s->SeqNo == current_seq_no) + { +#ifdef RUDP_DETAIL_LOG + Debug("%X s->SeqNo = %I64u, current_seq_no = %I64u\n", se, s->SeqNo, current_seq_no); +#endif // RUDP_DETAIL_LOG + + if (s->Size == sizeof(se->Magic_KeepAliveRequest) && Cmp(s->Data, se->Magic_KeepAliveRequest, sizeof(se->Magic_KeepAliveRequest)) == 0) + { + // Receive the KeepAlive Request +#ifdef RUDP_DETAIL_LOG + Debug("Recv KeepAlive Request\n"); +#endif // RUDP_DETAIL_LOG + + // Send a KeepAlive Response if the transmisson queue is empty + if (LIST_NUM(se->SendSegmentList) == 0) + { +#ifdef RUDP_DETAIL_LOG + Debug("Send KeepAlive Response\n"); +#endif // RUDP_DETAIL_LOG + + RUDPSendSegment(r, se, se->Magic_KeepAliveResponse, sizeof(se->Magic_KeepAliveResponse)); + } + } + else if (s->Size == sizeof(se->Magic_KeepAliveResponse) && Cmp(s->Data, se->Magic_KeepAliveResponse, sizeof(se->Magic_KeepAliveResponse)) == 0) + { + // Receive the KeepAlive Response +#ifdef RUDP_DETAIL_LOG + Debug("Recv KeepAlive Response\n"); +#endif // RUDP_DETAIL_LOG + } + else + { + // Write to the receive FIFO + WriteFifo(se->RecvFifo, s->Data, s->Size); + } + r->TotalLogicalReceived += s->Size; + + // Advance the SEQ NO which has been received completely + se->LastRecvCompleteSeqNo = s->SeqNo; + + // Add to the Delete list + if (o == NULL) + { + o = NewListFast(NULL); + } + Add(o, s); + } + else + { + // Continuous reading is interrupted +#ifdef RUDP_DETAIL_LOG + Debug("%X s->SeqNo = %I64u, current_seq_no = %I64u\n", se, s->SeqNo, current_seq_no); + WHERE; +#endif // RUDP_DETAIL_LOG + break; + } + } + + // Delete the segment which has been received completely + if (o != NULL) + { + for (j = 0; j < LIST_NUM(o); j++) + { + RUDP_SEGMENT *s = LIST_DATA(o, j); + + Delete(se->RecvSegmentList, s); + Free(s); + } + ReleaseList(o); + } + } + + if (r->ServerMode && se->Magic_Disconnect == 0) + { + if (FifoSize(se->RecvFifo) >= sizeof(UINT64)) + { + UINT64 ui; + + if (ReadFifo(se->RecvFifo, &ui, sizeof(UINT64)) == sizeof(UINT64)) + { + ui = Endian64(ui); + + if ((ui & 0xffffffff00000000ULL) != 0ULL) + { + se->Magic_Disconnect = ui; + } + } + } + } + + // If the data remains in FIFO, write it to the TCP socket as possible + if (r->ServerMode == false || se->Magic_Disconnect != 0) + { + while (FifoSize(se->RecvFifo) >= 1) + { + UINT ret; + + RUDPInitSock(r, se); + + ret = Send(se->TcpSock, FifoPtr(se->RecvFifo), FifoSize(se->RecvFifo), false); + + if (ret == SOCK_LATER) + { + // Can not write any more + break; + } + else if (ret == 0) + { + // Disconnected + Disconnect(se->TcpSock); + RUDPDisconnectSession(r, se, false); + break; + } + else + { + // Writing success + ReadFifo(se->RecvFifo, NULL, ret); + } + } + } + + // Read the data as much as possible from the TCP socket and store it to FIFO + if (se->TcpSock != NULL) + { + SetNoNeedToRead(se->TcpSock); + + while (FifoSize(se->SendFifo) <= RUDP_MAX_FIFO_SIZE) + { + UINT ret = Recv(se->TcpSock, r->TmpBuf, sizeof(r->TmpBuf), false); + + if (ret == SOCK_LATER) + { + // Can not read any more + break; + } + else if (ret == 0) + { + // Disconnected + Disconnect(se->TcpSock); + RUDPDisconnectSession(r, se, false); + break; + } + else + { + // Reading success + WriteFifo(se->SendFifo, r->TmpBuf, ret); + } + } + } + + // Attempt to send a divided segment + while (true) + { + UINT64 seq_no_min, seq_no_max; + + seq_no_min = RUDPGetCurrentSendingMinSeqNo(se); + seq_no_max = RUDPGetCurrentSendingMaxSeqNo(se); + +#ifdef RUDP_DETAIL_LOG + Debug("min=%I64u max=%I64u\n", seq_no_min, seq_no_max); +#endif // RUDP_DETAIL_LOG + + if (seq_no_min == 0 || ((seq_no_min + RUDP_MAX_NUM_ACK - 1) >= se->NextSendSeqNo)) + { + // Because there is a room to send a new segment, send a segment + UINT size = MIN(FifoSize(se->SendFifo), RUDP_MAX_SEGMENT_SIZE); + + if (size == 0) + { + // There is no more data to send in FIFO + break; + } + + // Transmission + RUDPSendSegment(r, se, FifoPtr(se->SendFifo), size); + + r->TotalLogicalSent += size; + + // Advance the FIFO + ReadFifo(se->SendFifo, NULL, size); + } + else + { + // There is no room to send a new segment further + break; + } + } + + if (se->DisconnectFlag == false) + { + UINT64 seq_no_min; + + if (se->LastSentTick == 0 || (r->Now >= (se->LastSentTick + (UINT64)se->NextKeepAliveInterval))) + { + if (LIST_NUM(se->SendSegmentList) == 0) + { + // Send a Keep-Alive if no data was sent for a while and the transmission queue is empty + RUDPSendSegment(r, se, se->Magic_KeepAliveRequest, sizeof(se->Magic_KeepAliveRequest)); + +#ifdef RUDP_DETAIL_LOG + Debug("Sent KeepAlive Request\n"); +#endif // RUDP_DETAIL_LOG + } + + se->NextKeepAliveInterval = RUDP_KEEPALIVE_INTERVAL_MIN + (Rand32() % (RUDP_KEEPALIVE_INTERVAL_MAX - RUDP_KEEPALIVE_INTERVAL_MIN)); + + AddInterrupt(r->Interrupt, r->Now + se->NextKeepAliveInterval); + } + + seq_no_min = RUDPGetCurrentSendingMinSeqNo(se); + for (j = 0; j < LIST_NUM(se->SendSegmentList); j++) + { + RUDP_SEGMENT *s = LIST_DATA(se->SendSegmentList, j); + + if (s->SeqNo <= (seq_no_min + RUDP_MAX_NUM_ACK - 1)) + { + if (s->NextSendTick == 0 || r->Now >= s->NextSendTick) + { + UINT next_interval; + // Transmits a segment which has not been sent even once yet, or whose retransmission time has arrived + RUDPSendSegmentNow(r, se, s->SeqNo, s->Data, s->Size); + + if (se->CurrentRtt != 0) + { + next_interval = (se->CurrentRtt * 120 / 100) * Power(2, MIN(s->NumSent, 10)); + } + else + { + next_interval = RUDP_RESEND_TIMER * Power(2, MIN(s->NumSent, 10)); + } + + next_interval = MIN(next_interval, RUDP_RESEND_TIMER_MAX); + + s->NumSent++; + + s->NextSendTick = r->Now + next_interval; + + AddInterrupt(r->Interrupt, s->NextSendTick); + } + } + } + + while (LIST_NUM(se->ReplyAckList) >= 1) + { + // If there are ACKs which is not responded yet in the list, send all of them + RUDPSendSegmentNow(r, se, se->NextSendSeqNo, NULL, 0); + } + + // Send all if there are bulk transfer data + if (se->TcpSock != NULL) + { + SOCK *s = se->TcpSock; + + if (s->BulkRecvTube != NULL) + { + TUBE *t = s->BulkRecvTube; + + while (true) + { + TUBEDATA *d = TubeRecvAsync(t); + + if (d == NULL) + { + break; + } + + if (d->Header != NULL && d->HeaderSize == sizeof(TCP_PAIR_HEADER)) + { + TCP_PAIR_HEADER *h = d->Header; + + if (h->EnableHMac) + { + se->UseHMac = true; + } + } + + RUDPBulkSend(r, se, d->Data, d->DataSize); + + FreeTubeData(d); + } + } + } + } + } + + if (r->ServerMode == false) + { + if (se->Status == RUDP_SESSION_STATUS_CONNECT_SENT) + { + // Send a connection request periodically from the client side + if (se->LastSentTick == 0 || ((se->LastSentTick + (UINT64)RUDP_RESEND_TIMER) <= r->Now)) + { + UCHAR tmp[40]; + UINT size_of_padding = 19; + UINT size = size_of_padding + SHA1_SIZE; + + se->LastSentTick = r->Now; + + Copy(tmp, se->Key_Init, SHA1_SIZE); + Rand(tmp + SHA1_SIZE, size_of_padding); + + if (r->Protocol == RUDP_PROTOCOL_ICMP) + { + // ICMP packet + UCHAR *rand_data; + UINT rand_size; + + rand_size = Rand32() % 64 + 64; + rand_data = Malloc(rand_size); + Rand(rand_data, rand_size); + + RUDPSendPacket(r, &se->YourIp, se->YourPort, rand_data, rand_size, ICMP_TYPE_ECHO_REQUEST); + Free(rand_data); + + se->Client_Icmp_NextSendEchoRequest = r->Now + GenRandInterval(RUDP_CLIENT_ECHO_REQUEST_SEND_INTERVAL_MIN, RUDP_CLIENT_ECHO_REQUEST_SEND_INTERVAL_MAX); + AddInterrupt(r->Interrupt, se->Client_Icmp_NextSendEchoRequest); + + // Try in both INFORMATION_REQUEST and ECHO_RESPONSE from the client side first + RUDPSendPacket(r, &se->YourIp, se->YourPort, tmp, size, ICMP_TYPE_ECHO_RESPONSE); + RUDPSendPacket(r, &se->YourIp, se->YourPort, tmp, size, ICMP_TYPE_INFORMATION_REQUEST); + } + else if (r->Protocol == RUDP_PROTOCOL_DNS) + { + // DNS + RUDPSendPacket(r, &se->YourIp, se->YourPort, tmp, size, se->Dns_TranId); + } + else + { + // Normal UDP + RUDPSendPacket(r, &se->YourIp, se->YourPort, tmp, size, 0); + } + + AddInterrupt(r->Interrupt, r->Now + (UINT64)RUDP_RESEND_TIMER); + } + } + + if (r->Protocol == RUDP_PROTOCOL_ICMP) + { + if (se->Client_Icmp_NextSendEchoRequest == 0 || (r->Now >= se->Client_Icmp_NextSendEchoRequest)) + { + // Periodic ICMP Echo transmission from the client side when R-UDP used in ICMP mode + // (To maintain the mapping table of the NAT) + UCHAR *rand_data; + UINT rand_size; + + rand_size = Rand32() % 64 + 64; + rand_data = Malloc(rand_size); + Rand(rand_data, rand_size); + + RUDPSendPacket(r, &se->YourIp, se->YourPort, rand_data, rand_size, ICMP_TYPE_ECHO_REQUEST); + Free(rand_data); + + se->Client_Icmp_NextSendEchoRequest = r->Now + GenRandInterval(RUDP_CLIENT_ECHO_REQUEST_SEND_INTERVAL_MIN, RUDP_CLIENT_ECHO_REQUEST_SEND_INTERVAL_MAX); + AddInterrupt(r->Interrupt, se->Client_Icmp_NextSendEchoRequest); + } + } + } + } + + // Release the disconnected sessions + o = NULL; + for (i = 0; i < LIST_NUM(r->SessionList); i++) + { + RUDP_SESSION *se = LIST_DATA(r->SessionList, i); + + if (se->DisconnectFlag) + { + if (o == NULL) + { + o = NewListFast(NULL); + } + + Add(o, se); + } + } + if (o != NULL) + { + for (i = 0; i < LIST_NUM(o); i++) + { + RUDP_SESSION *se = LIST_DATA(o, i); + + Delete(r->SessionList, se); + + RUDPFreeSession(se); + } + + ReleaseList(o); + } +} + +// Do the bulk send +void RUDPBulkSend(RUDP_STACK *r, RUDP_SESSION *se, void *data, UINT data_size) +{ + UCHAR *buf; + UINT i, icmp_type, buf_size, padding_size; + icmp_type = 0; + // Validate arguments + if (r == NULL || se == NULL || (data == NULL && data_size != 0)) + { + return; + } + + if (se->BulkSendKey->Size == RUDP_BULK_KEY_SIZE_V2) + { + UCHAR *tmp, iv[RUDP_BULK_IV_SIZE_V2]; + UINT size; + CIPHER *c; + + padding_size = Rand32() % 31 + 1; + + size = sizeof(UINT64) + data_size + padding_size; + + // Packet: IV + Encrypted(SEQ_NO + Data + padding) + MAC + buf_size = RUDP_BULK_IV_SIZE_V2 + sizeof(UINT64) + data_size + padding_size + RUDP_BULK_MAC_SIZE_V2; + buf = Malloc(buf_size); + + // IV + Copy(iv, se->BulkNextIv_V2, RUDP_BULK_IV_SIZE_V2); + Copy(buf, iv, RUDP_BULK_IV_SIZE_V2); + + // SEQ NO + WRITE_UINT64(buf + RUDP_BULK_IV_SIZE_V2, se->BulkNextSeqNo); + se->BulkNextSeqNo++; + + // Data + Copy(buf + RUDP_BULK_IV_SIZE_V2 + sizeof(UINT64), data, data_size); + + // Padding + for (i = 0; i < padding_size; i++) + { + buf[RUDP_BULK_IV_SIZE_V2 + sizeof(UINT64) + data_size + i] = (UCHAR)padding_size; + } + + size = sizeof(UINT64) + data_size + padding_size; + tmp = buf + RUDP_BULK_IV_SIZE_V2; + + // Encryption + c = NewCipher("ChaCha20-Poly1305"); + SetCipherKey(c, se->BulkSendKey->Data, true); + CipherProcessAead(c, iv, tmp + size, RUDP_BULK_MAC_SIZE_V2, tmp, tmp, size - RUDP_BULK_MAC_SIZE_V2, NULL, 0); + FreeCipher(c); + + // Next IV + Copy(se->BulkNextIv_V2, buf + sizeof(UINT64) + data_size + padding_size, RUDP_BULK_IV_SIZE_V2); + } + else + { + UCHAR crypt_key_src[SHA1_SIZE * 2]; + UCHAR crypt_key[SHA1_SIZE]; + UCHAR sign[SHA1_SIZE]; + UCHAR iv[SHA1_SIZE]; + CRYPT *c; + + padding_size = Rand32() % 31 + 1; + + buf_size = SHA1_SIZE + SHA1_SIZE + sizeof(UINT64) + data_size + padding_size; + buf = Malloc(buf_size); + + // SEQ NO + WRITE_UINT64(buf + SHA1_SIZE + SHA1_SIZE, se->BulkNextSeqNo); + se->BulkNextSeqNo++; + + // Data + Copy(buf + SHA1_SIZE + SHA1_SIZE + sizeof(UINT64), data, data_size); + + // Padding + for (i = 0; i < padding_size; i++) + { + buf[SHA1_SIZE + SHA1_SIZE + sizeof(UINT64) + data_size + i] = (UCHAR)padding_size; + } + + // Encryption + Copy(iv, se->BulkNextIv, SHA1_SIZE); + Copy(crypt_key_src + 0, se->BulkSendKey->Data, SHA1_SIZE); + Copy(crypt_key_src + SHA1_SIZE, iv, SHA1_SIZE); + Sha1(crypt_key, crypt_key_src, SHA1_SIZE * 2); + c = NewCrypt(crypt_key, sizeof(crypt_key)); + Encrypt(c, buf + SHA1_SIZE + SHA1_SIZE, buf + SHA1_SIZE + SHA1_SIZE, sizeof(UINT64) + data_size + padding_size); + FreeCrypt(c); + + // IV + Copy(buf + SHA1_SIZE, iv, SHA1_SIZE); + + // Sign + if (se->UseHMac == false) + { + Copy(buf + 0, se->BulkSendKey->Data, SHA1_SIZE); + Sha1(sign, buf, SHA1_SIZE + SHA1_SIZE + sizeof(UINT64) + data_size + padding_size); + Copy(buf + 0, sign, SHA1_SIZE); + } + else + { + HMacSha1(buf + 0, se->BulkSendKey->Data, SHA1_SIZE, buf + SHA1_SIZE, SHA1_SIZE + sizeof(UINT64) + data_size + padding_size); + } + + // Next IV + Copy(se->BulkNextIv, buf + buf_size - SHA1_SIZE, SHA1_SIZE); + } + + if (r->Protocol == RUDP_PROTOCOL_ICMP) + { + icmp_type = se->Icmp_Type; + } + else if (r->Protocol == RUDP_PROTOCOL_DNS) + { + icmp_type = se->Dns_TranId; + } + + RUDPSendPacket(r, &se->YourIp, se->YourPort, buf, buf_size, icmp_type); + + Free(buf); +} + +// Start a socket for R-UDP Listening +SOCK *ListenRUDP(char *svc_name, RUDP_STACK_INTERRUPTS_PROC *proc_interrupts, RUDP_STACK_RPC_RECV_PROC *proc_rpc_recv, void *param, UINT port, bool no_natt_register, bool over_dns_mode) +{ + return ListenRUDPEx(svc_name, proc_interrupts, proc_rpc_recv, param, port, no_natt_register, over_dns_mode, NULL, 0, NULL); +} +SOCK *ListenRUDPEx(char *svc_name, RUDP_STACK_INTERRUPTS_PROC *proc_interrupts, RUDP_STACK_RPC_RECV_PROC *proc_rpc_recv, void *param, UINT port, bool no_natt_register, bool over_dns_mode, + volatile UINT *natt_global_udp_port, UCHAR rand_port_id, IP *listen_ip) +{ + SOCK *s; + RUDP_STACK *r; + + // Creating a R-UDP stack + r = NewRUDPServer(svc_name, proc_interrupts, proc_rpc_recv, param, port, no_natt_register, over_dns_mode, natt_global_udp_port, rand_port_id, listen_ip); + if (r == NULL) + { + return NULL; + } + + s = NewSock(); + + s->Type = SOCK_RUDP_LISTEN; + s->ListenMode = true; + s->Connected = true; + + s->LocalPort = r->UdpSock->LocalPort; + + s->R_UDP_Stack = r; + + return s; +} + +// Accept on the R-UDP socket +SOCK *AcceptRUDP(SOCK *s) +{ + // Validate arguments + if (s == NULL || s->Type != SOCK_RUDP_LISTEN || s->ListenMode == false) + { + return NULL; + } + + while (true) + { + RUDP_STACK *r = s->R_UDP_Stack; + SOCK *ret; + + if (s->Disconnecting || s->CancelAccept) + { + return NULL; + } + + ret = GetNextWithLock(r->NewSockQueue); + + if (ret != NULL) + { + switch (r->Protocol) + { + case RUDP_PROTOCOL_UDP: + StrCpy(ret->UnderlayProtocol, sizeof(ret->UnderlayProtocol), SOCK_UNDERLAY_NAT_T); + AddProtocolDetailsStr(ret->ProtocolDetails, sizeof(ret->ProtocolDetails), "RUDP/UDP"); + break; + + case RUDP_PROTOCOL_DNS: + StrCpy(ret->UnderlayProtocol, sizeof(ret->UnderlayProtocol), SOCK_UNDERLAY_DNS); + AddProtocolDetailsStr(ret->ProtocolDetails, sizeof(ret->ProtocolDetails), "RUDP/DNS"); + break; + + case RUDP_PROTOCOL_ICMP: + StrCpy(ret->UnderlayProtocol, sizeof(ret->UnderlayProtocol), SOCK_UNDERLAY_ICMP); + AddProtocolDetailsStr(ret->ProtocolDetails, sizeof(ret->ProtocolDetails), "RUDP/ICMP"); + break; + } + + return ret; + } + + Wait(r->NewSockConnectEvent, INFINITE); + } +} + +// Verify the signature of the received packet +bool RUDPCheckSignOfRecvPacket(RUDP_STACK *r, RUDP_SESSION *se, void *recv_data, UINT recv_size) +{ + UCHAR sign[SHA1_SIZE]; + UCHAR sign2[SHA1_SIZE]; + UCHAR *p; + UINT size; + // Validate arguments + if (r == NULL || se == NULL || recv_data == NULL || recv_size == 0) + { + return false; + } + + p = (UCHAR *)recv_data; + size = recv_size; + if (size < SHA1_SIZE) + { + return false; + } + + // Verification the signature (segment packet) + Copy(sign, p, SHA1_SIZE); + Copy(p, se->Key_Recv, SHA1_SIZE); + Sha1(sign2, p, recv_size); + + if (r->Protocol == RUDP_PROTOCOL_DNS || r->Protocol == RUDP_PROTOCOL_ICMP) + { + XorData(sign2, sign2, r->SvcNameHash, SHA1_SIZE); + } + + Copy(p, sign, SHA1_SIZE); + if (Cmp(sign, sign2, SHA1_SIZE) == 0) + { + return true; + } + + if (se->BulkRecvKey == NULL) + { + return false; + } + + // Verification signature (bulk packet) + if (se->BulkRecvKey->Size == RUDP_BULK_KEY_SIZE_V2) + { + UCHAR *iv = p; + CIPHER *c; + + // Packet: IV + Encrypted(SEQ_NO + Data + padding) + MAC + // IV + if (size < RUDP_BULK_IV_SIZE_V2) + { + return false; + } + iv = p; + p += RUDP_BULK_IV_SIZE_V2; + size -= RUDP_BULK_IV_SIZE_V2; + + // Decrypt + if (size < (RUDP_BULK_MAC_SIZE_V2 + 1)) + { + return false; + } + + c = NewCipher("ChaCha20-Poly1305"); + SetCipherKey(c, se->BulkRecvKey->Data, false); + size = CipherProcessAead(c, iv, p + size, RUDP_BULK_MAC_SIZE_V2, r->TmpBuf, p, size - RUDP_BULK_MAC_SIZE_V2, NULL, 0); + FreeCipher(c); + + if (size == 0) + { + return false; + } + + return true; + } + else + { + if (se->UseHMac == false) + { + Copy(sign, p, SHA1_SIZE); + Copy(p, se->BulkRecvKey->Data, SHA1_SIZE); + Sha1(sign2, p, recv_size); + Copy(p, sign, SHA1_SIZE); + + if (Cmp(sign, sign2, SHA1_SIZE) == 0) + { + return true; + } + } + + HMacSha1(sign2, se->BulkRecvKey->Data, SHA1_SIZE, p + SHA1_SIZE, size - SHA1_SIZE); + if (Cmp(p, sign2, SHA1_SIZE) == 0) + { + se->UseHMac = true; + return true; + } + } + + return false; +} + +// Process the received packet (bulk) +bool RUDPProcessBulkRecvPacket(RUDP_STACK *r, RUDP_SESSION *se, void *recv_data, UINT recv_size) +{ + UCHAR *p; + UCHAR *iv; + UINT size; + UCHAR padlen; + UINT64 seq_no; + UCHAR *payload; + UINT payload_size; + // Validate arguments + if (r == NULL || se == NULL || recv_data == NULL || recv_size == 0 || se->BulkRecvKey == NULL) + { + return false; + } + + p = (UCHAR *)recv_data; + size = recv_size; + if (size < SHA1_SIZE) + { + return false; + } + + if (se->BulkRecvKey->Size == RUDP_BULK_KEY_SIZE_V2) + { + UINT ret; + CIPHER *c; + + // Packet: IV + Encrypted(SEQ_NO + Data + padding) + MAC + // IV + if (size < RUDP_BULK_IV_SIZE_V2) + { + WHERE; + return false; + } + iv = p; + p += RUDP_BULK_IV_SIZE_V2; + size -= RUDP_BULK_IV_SIZE_V2; + + // Decrypt + if (size < (RUDP_BULK_MAC_SIZE_V2 + 1)) + { + WHERE; + return false; + } + + c = NewCipher("ChaCha20-Poly1305"); + SetCipherKey(c, se->BulkRecvKey->Data, false); + ret = CipherProcessAead(c, iv, p + size, RUDP_BULK_MAC_SIZE_V2, p, p, size - RUDP_BULK_MAC_SIZE_V2, NULL, 0); + FreeCipher(c); + + if (ret == 0) + { + WHERE; + return false; + } + + size -= RUDP_BULK_MAC_SIZE_V2; + + // padlen + padlen = p[size - 1]; + if (padlen == 0) + { + WHERE; + return false; + } + if (size < padlen) + { + WHERE; + return false; + } + size -= padlen; + } + else + { + CRYPT *c; + UCHAR sign[SHA1_SIZE], sign2[SHA1_SIZE]; + UCHAR key[SHA1_SIZE], keygen[SHA1_SIZE * 2]; + + // Validate the signature + if (se->UseHMac == false) + { + Copy(sign, p, SHA1_SIZE); + Copy(p, se->BulkRecvKey->Data, SHA1_SIZE); + Sha1(sign2, p, recv_size); + Copy(p, sign, SHA1_SIZE); + + if (Cmp(sign, sign2, SHA1_SIZE) != 0) + { + HMacSha1(sign2, se->BulkRecvKey->Data, SHA1_SIZE, p + SHA1_SIZE, recv_size - SHA1_SIZE); + + if (Cmp(p, sign2, SHA1_SIZE) != 0) + { + return false; + } + else + { + se->UseHMac = true; + } + } + } + else + { + HMacSha1(sign2, se->BulkRecvKey->Data, SHA1_SIZE, p + SHA1_SIZE, recv_size - SHA1_SIZE); + + if (Cmp(p, sign2, SHA1_SIZE) != 0) + { + return false; + } + } + + p += SHA1_SIZE; + size -= SHA1_SIZE; + + // IV + if (size < SHA1_SIZE) + { + return false; + } + iv = p; + p += SHA1_SIZE; + size -= SHA1_SIZE; + + // Decrypt + if (size < 1) + { + return false; + } + Copy(keygen + 0, se->BulkRecvKey->Data, SHA1_SIZE); + Copy(keygen + SHA1_SIZE, iv, SHA1_SIZE); + Sha1(key, keygen, sizeof(keygen)); + + c = NewCrypt(key, sizeof(key)); + Encrypt(c, p, p, size); + FreeCrypt(c); + + // padlen + padlen = p[size - 1]; + if (padlen == 0) + { + return false; + } + if (size < padlen) + { + return false; + } + size -= padlen; + } + + // SEQ NO + seq_no = READ_UINT64(p); + p += sizeof(UINT64); + size -= sizeof(UINT64); + + if (seq_no == 0 || seq_no >= (0xF000000000000000ULL)) + { + // Sequence number is invalid + return false; + } + + if ((seq_no + RUDP_BULK_SEQ_NO_RANGE) < se->BulkRecvSeqNoMax) + { + // Sequence number is too small + return false; + } + + se->LastRecvTick = r->Now; + + payload = p; + payload_size = size; + + se->BulkRecvSeqNoMax = MAX(seq_no, se->BulkRecvSeqNoMax); + + // Send the received bulk packet to the Tube of the socket + RUDPInitSock(r, se); + + if (se->TcpSock != NULL) + { + SOCK *s = se->TcpSock; + TUBE *t = s->BulkSendTube; + + if (t != NULL) + { + TubeSendEx2(t, payload, payload_size, NULL, true, RUDP_BULK_MAX_RECV_PKTS_IN_QUEUE); + + se->FlushBulkSendTube = true; + } + } + + return true; +} + +// Process the received packet (segment) +bool RUDPProcessRecvPacket(RUDP_STACK *r, RUDP_SESSION *se, void *recv_data, UINT recv_size) +{ + UCHAR sign[SHA1_SIZE]; + UCHAR sign2[SHA1_SIZE]; + UCHAR *p; + UCHAR *iv; + UINT size; + UCHAR keygen[SHA1_SIZE * 2]; + UCHAR key[SHA1_SIZE]; + CRYPT *c; + UCHAR padlen; + UINT num_ack; + UINT i; + UINT64 seq_no; + UCHAR *payload; + UINT payload_size; + UINT64 max_ack; + UINT64 my_tick, your_tick; + // Validate arguments + if (r == NULL || se == NULL || recv_data == NULL || recv_size == 0) + { + return false; + } + + p = (UCHAR *)recv_data; + size = recv_size; + if (size < SHA1_SIZE) + { + return false; + } + + // Validate the signature + Copy(sign, p, SHA1_SIZE); + Copy(p, se->Key_Recv, SHA1_SIZE); + Sha1(sign2, p, recv_size); + Copy(p, sign, SHA1_SIZE); + + if (r->Protocol == RUDP_PROTOCOL_DNS || r->Protocol == RUDP_PROTOCOL_ICMP) + { + XorData(sign2, sign2, r->SvcNameHash, SHA1_SIZE); + } + + if (Cmp(sign, sign2, SHA1_SIZE) != 0) + { + //WHERE; + return false; + } + p += SHA1_SIZE; + size -= SHA1_SIZE; + + // IV + if (size < SHA1_SIZE) + { + return false; + } + iv = p; + p += SHA1_SIZE; + size -= SHA1_SIZE; + + // Decrypt + if (size < 1) + { + return false; + } + Copy(keygen + 0, iv, SHA1_SIZE); + Copy(keygen + SHA1_SIZE, se->Key_Recv, SHA1_SIZE); + Sha1(key, keygen, sizeof(keygen)); + + c = NewCrypt(key, sizeof(key)); + Encrypt(c, p, p, size); + FreeCrypt(c); + + // padlen + padlen = p[size - 1]; + if (padlen == 0) + { + return false; + } + if (size < padlen) + { + return false; + } + size -= padlen; + + // MyTick + if (size < sizeof(UINT64)) + { + return false; + } + my_tick = READ_UINT64(p); + p += sizeof(UINT64); + size -= sizeof(UINT64); + + // YourTick + if (size < sizeof(UINT64)) + { + return false; + } + your_tick = READ_UINT64(p); + p += sizeof(UINT64); + size -= sizeof(UINT64); + + if (your_tick > r->Now) + { + return false; + } + + // MAX_ACK + if (size < sizeof(UINT64)) + { + return false; + } + max_ack = READ_UINT64(p); + p += sizeof(UINT64); + size -= sizeof(UINT64); + + // num_ack + if (size < sizeof(UINT)) + { + return false; + } + + num_ack = READ_UINT(p); + if (num_ack > RUDP_MAX_NUM_ACK) + { + return false; + } + p += sizeof(UINT); + size -= sizeof(UINT); + + // ACKs + if (size < (sizeof(UINT64) * num_ack + sizeof(UINT64))) + { + return false; + } + + if (max_ack >= 1) + { + RUDPProcessAck2(r, se, max_ack); + } + + for (i = 0; i < num_ack; i++) + { + UINT64 seq = READ_UINT64(p); + + RUDPProcessAck(r, se, seq); + + p += sizeof(UINT64); + size -= sizeof(UINT64); + } + + // Processing of the Tick (Calculation of RTT) + if (my_tick >= 2) + { + my_tick--; + } + se->YourTick = MAX(se->YourTick, my_tick); + + se->LatestRecvMyTick = MAX(se->LatestRecvMyTick, your_tick); + + if (se->LatestRecvMyTick2 != se->LatestRecvMyTick) + { + se->LatestRecvMyTick2 = se->LatestRecvMyTick; + se->CurrentRtt = (UINT)(r->Now - se->LatestRecvMyTick); + +#ifdef RUDP_DETAIL_LOG + Debug("CurrentRTT = %u\n", se->CurrentRtt); +#endif // RUDP_DETAIL_LOG + } + + // SEQ NO + seq_no = READ_UINT64(p); + p += sizeof(UINT64); + size -= sizeof(UINT64); + + if (seq_no == 0) + { + // Sequence number of 0 is a invalid packet + return true; + } + + if (seq_no == se->Magic_Disconnect) + { + // Disconnected from opponent + RUDPDisconnectSession(r, se, true); + return true; + } + + // Update the last reception date and time + se->LastRecvTick = r->Now; + + payload = p; + payload_size = size; + +#ifdef RUDP_DETAIL_LOG + Debug("RUDP %X Segment Recv: %I64u (num_ack=%u, size=%u)\n", se, seq_no, num_ack, size); +#endif // RUDP_DETAIL_LOG + + if (payload_size >= 1 && payload_size <= RUDP_MAX_SEGMENT_SIZE) + { + // Received one or more bytes of data + +#ifdef RUDP_DETAIL_LOG + Debug("Recv Size: %X %I64u %u %u\n", se, seq_no, payload_size, recv_size); +#endif // RUDP_DETAIL_LOG + + RUDPProcessRecvPayload(r, se, seq_no, payload, payload_size); + } + + if (r->ServerMode == false) + { + if (se->Status == RUDP_SESSION_STATUS_CONNECT_SENT) + { + // Shift to the established state if the connection is not yet in established state + se->Status = RUDP_SESSION_STATUS_ESTABLISHED; + + RUDPInitSock(r, se); + } + } + + return true; +} + +// Disconnect the session +void RUDPDisconnectSession(RUDP_STACK *r, RUDP_SESSION *se, bool disconnected_by_you) +{ + // Validate arguments + if (r == NULL || se == NULL) + { + return; + } + + if (se->DisconnectFlag == false) + { + UINT i; + + se->DisconnectFlag = true; + se->DisconnectedByYou = disconnected_by_you; + + Debug("R-UDP Session %X Disconnected. by you flag: %u\n", se, disconnected_by_you); + + if (se->TcpSock != NULL) + { + // Disconnect a TCP socket + Disconnect(se->TcpSock); + ReleaseSock(se->TcpSock); + + se->TcpSock = NULL; + } + + // Send 5 disconnect signals serially if to disconnect from here + if (disconnected_by_you == false) + { + for (i = 0; i < 5; i++) + { + RUDPSendSegmentNow(r, se, se->Magic_Disconnect, NULL, 0); + } + } + } +} + +// Initialize the TCP socket for the session +void RUDPInitSock(RUDP_STACK *r, RUDP_SESSION *se) +{ + SOCK *s1, *s2; + UINT mss; + // Validate arguments + if (r == NULL || se == NULL || se->DisconnectFlag) + { + return; + } + + if (se->TcpSock != NULL) + { + // It has already been created + return; + } + + // Creating a TCP socket pair + if (NewTcpPair(&s1, &s2) == false) + { + // Failed to create. Disconnect the session + RUDPDisconnectSession(r, se, false); + return; + } + + // Calculate the optimal MSS + mss = RUDPCalcBestMssForBulk(r, se); + + if (r->ServerMode) + { + // Server mode + se->TcpSock = s2; + + JoinSockToSockEvent(s2, r->SockEvent); + + // Update the end point information of the socket s1 + ZeroIP4(&s1->LocalIP); + s1->LocalPort = se->MyPort; + Copy(&s1->RemoteIP, &se->YourIp, sizeof(IP)); + s1->RemotePort = se->YourPort; + if (IsLocalHostIP(&s1->RemoteIP) == false) + { + AddIpClient(&s1->RemoteIP); + s1->IpClientAdded = true; + } + s1->IsRUDPSocket = true; + + s1->BulkSendKey = se->BulkSendKey; + s1->BulkRecvKey = se->BulkRecvKey; + + AddRef(s1->BulkSendKey->Ref); + AddRef(s1->BulkRecvKey->Ref); + + s1->RUDP_OptimizedMss = mss; + + // Enqueue the newly created socket, and set the event + InsertQueueWithLock(r->NewSockQueue, s1); + Set(r->NewSockConnectEvent); + } + else + { + // Client mode + Lock(r->Lock); + { + if (r->TargetConnectedSock == NULL && r->DoNotSetTargetConnectedSock == false) + { + // Update the end point information of the socket s2 + Copy(&s2->LocalIP, &r->UdpSock->LocalIP, sizeof(IP)); + s2->LocalPort = se->MyPort; + Copy(&s2->RemoteIP, &se->YourIp, sizeof(IP)); + s2->RemotePort = se->YourPort; + if (IsLocalHostIP(&s2->RemoteIP) == false) + { + AddIpClient(&s2->RemoteIP); + s2->IpClientAdded = true; + } + s2->IsRUDPSocket = true; + + s2->BulkSendKey = se->BulkSendKey; + s2->BulkRecvKey = se->BulkRecvKey; + + AddRef(s2->BulkSendKey->Ref); + AddRef(s2->BulkRecvKey->Ref); + + s2->RUDP_OptimizedMss = mss; + + // Register the socket to the RUDP stack + r->TargetConnectedSock = s2; + s2->R_UDP_Stack = r; + se->TcpSock = s1; + + JoinSockToSockEvent(s1, r->SockEvent); + + // Set the event to be set when the connection is successful + Set(r->TargetConnectedEvent); + } + else + { + Disconnect(s1); + Disconnect(s2); + ReleaseSock(s1); + ReleaseSock(s2); + } + } + Unlock(r->Lock); + } +} + +// Process the received payload +void RUDPProcessRecvPayload(RUDP_STACK *r, RUDP_SESSION *se, UINT64 seq, void *payload_data, UINT payload_size) +{ + RUDP_SEGMENT t; + RUDP_SEGMENT *s; + // Validate arguments + if (r == NULL || se == NULL || seq == 0 || payload_data == NULL || payload_size == 0 || payload_size > RUDP_MAX_SEGMENT_SIZE) + { + return; + } + + if (seq > (se->LastRecvCompleteSeqNo + RUDP_MAX_NUM_ACK)) + { + // Ignore the segment which have sequence number beyond the window size, and also not to reply an ACK + return; + } + + if (seq <= se->LastRecvCompleteSeqNo) + { + // Do not receive the segment which have the sequence number that has been already received. However, reply an ACK for it + AddInt64Distinct(se->ReplyAckList, seq); + return; + } + + Zero(&t, sizeof(t)); + t.SeqNo = seq; + + s = Search(se->RecvSegmentList, &t); + if (s != NULL) + { + // Do not receive the segment which have the sequence number that has been already received. However, reply an ACK for it + AddInt64Distinct(se->ReplyAckList, seq); + return; + } + + // Received a segment of the new sequence number + s = ZeroMalloc(sizeof(RUDP_SEGMENT)); + s->SeqNo = seq; + Copy(s->Data, payload_data, payload_size); + s->Size = payload_size; + Insert(se->RecvSegmentList, s); + + // Reply an ACK + AddInt64Distinct(se->ReplyAckList, seq); + + // Create a socket for session if it have not been created yet + //RUDPInitSock(r, se); +} + +// Process the incoming ACK +void RUDPProcessAck(RUDP_STACK *r, RUDP_SESSION *se, UINT64 seq) +{ + RUDP_SEGMENT t; + RUDP_SEGMENT *s; + // Validate arguments + if (r == NULL || se == NULL || seq == 0) + { + return; + } + + Zero(&t, sizeof(t)); + t.SeqNo = seq; + + s = Search(se->SendSegmentList, &t); + if (s == NULL) + { + return; + } + + Delete(se->SendSegmentList, s); + Free(s); +} + +// Remove all segments which are preceding max_seq as already delivered +void RUDPProcessAck2(RUDP_STACK *r, RUDP_SESSION *se, UINT64 max_seq) +{ + LIST *o; + UINT i; + // Validate arguments + if (r == NULL || se == NULL || max_seq == 0) + { + return; + } + + o = NULL; + + for (i = 0; i < LIST_NUM(se->SendSegmentList); i++) + { + RUDP_SEGMENT *s = LIST_DATA(se->SendSegmentList, i); + + if (s->SeqNo <= max_seq) + { + if (o == NULL) + { + o = NewListFast(NULL); + } + + Add(o, s); + } + } + + if (o != NULL) + { + for (i = 0; i < LIST_NUM(o); i++) + { + RUDP_SEGMENT *s = LIST_DATA(o, i); + + Delete(se->SendSegmentList, s); + + Free(s); + } + + ReleaseList(o); + } +} + +// Get the minimum sequence number which is trying to send +UINT64 RUDPGetCurrentSendingMinSeqNo(RUDP_SESSION *se) +{ + RUDP_SEGMENT *s; + // Validate arguments + if (se == NULL) + { + return 0; + } + + if (LIST_NUM(se->SendSegmentList) == 0) + { + return 0; + } + + s = LIST_DATA(se->SendSegmentList, 0); + + return s->SeqNo; +} + +// Get the maximum sequence number which is trying to send +UINT64 RUDPGetCurrentSendingMaxSeqNo(RUDP_SESSION *se) +{ + RUDP_SEGMENT *s; + // Validate arguments + if (se == NULL) + { + return 0; + } + + if (LIST_NUM(se->SendSegmentList) == 0) + { + return 0; + } + + s = LIST_DATA(se->SendSegmentList, (LIST_NUM(se->SendSegmentList) - 1)); + + return s->SeqNo; +} + +// R-UDP segment transmission +void RUDPSendSegmentNow(RUDP_STACK *r, RUDP_SESSION *se, UINT64 seq_no, void *data, UINT size) +{ + UCHAR dst[RUDP_MAX_PACKET_SIZE]; + UCHAR *p; + UCHAR *iv; + LIST *o = NULL; + UINT i; + UCHAR padlen; + UINT current_size; + UCHAR sign[SHA1_SIZE]; + UCHAR key[SHA1_SIZE]; + UCHAR keygen[SHA1_SIZE * 2]; + CRYPT *c; + UINT next_iv_pos; + UINT num_ack; + UINT icmp_type = 0; + // Validate arguments + if (r == NULL || se == NULL || (size != 0 && data == NULL) || (size > RUDP_MAX_SEGMENT_SIZE)) + { + return; + } + + Zero(dst, sizeof(dst)); + p = dst; + + // SIGN + Copy(p, se->Key_Send, SHA1_SIZE); + p += SHA1_SIZE; + + // IV + iv = p; + Copy(iv, se->NextIv, SHA1_SIZE); + p += SHA1_SIZE; + + for (i = 0; i < MIN(LIST_NUM(se->ReplyAckList), RUDP_MAX_NUM_ACK); i++) + { + UINT64 *seq = LIST_DATA(se->ReplyAckList, i); + + if (o == NULL) + { + o = NewListFast(NULL); + } + + Add(o, seq); + } + + // MyTick + WRITE_UINT64(p, r->Now); + p += sizeof(UINT64); + + // YourTick + WRITE_UINT64(p, se->YourTick); + p += sizeof(UINT64); + + // MAX_ACK + WRITE_UINT64(p, se->LastRecvCompleteSeqNo); + p += sizeof(UINT64); + + // NUM_ACK + num_ack = LIST_NUM(o); + WRITE_UINT(p, num_ack); + p += sizeof(UINT); + + if (o != NULL) + { + // ACK body + for (i = 0; i < LIST_NUM(o); i++) + { + UINT64 *seq = LIST_DATA(o, i); + + WRITE_UINT64(p, *seq); + p += sizeof(UINT64); + + Delete(se->ReplyAckList, seq); + + Free(seq); + } + ReleaseList(o); + } + + // SEQ + WRITE_UINT64(p, seq_no); + p += sizeof(UINT64); + + // data + Copy(p, data, size); + p += size; + + // padding + padlen = Rand8(); + padlen = MAX(padlen, 1); + + for (i = 0; i < padlen; i++) + { + *p = padlen; + p++; + } + + current_size = (UINT)(p - dst); + + // Encrypt + Copy(keygen + 0, iv, SHA1_SIZE); + Copy(keygen + SHA1_SIZE, se->Key_Send, SHA1_SIZE); + Sha1(key, keygen, sizeof(keygen)); + c = NewCrypt(key, sizeof(key)); + Encrypt(c, dst + SHA1_SIZE * 2, dst + SHA1_SIZE * 2, current_size - (SHA1_SIZE * 2)); + FreeCrypt(c); + + // Sign + Sha1(sign, dst, current_size); + if (r->Protocol == RUDP_PROTOCOL_DNS || r->Protocol == RUDP_PROTOCOL_ICMP) + { + XorData(sign, sign, r->SvcNameHash, SHA1_SIZE); + } + Copy(dst, sign, SHA1_SIZE); + + if (r->Protocol == RUDP_PROTOCOL_ICMP) + { + icmp_type = se->Icmp_Type; + } + else if (r->Protocol == RUDP_PROTOCOL_DNS) + { + icmp_type = se->Dns_TranId; + } + RUDPSendPacket(r, &se->YourIp, se->YourPort, dst, current_size, icmp_type); + + if (size >= 1) + { + se->LastSentTick = r->Now; + } + + // Next IV + next_iv_pos = Rand32() % (current_size - SHA1_SIZE); + Copy(se->NextIv, dst + next_iv_pos, SHA1_SIZE); + +#ifdef RUDP_DETAIL_LOG + Debug("RUDP %X Segment Sent: %I64u (num_ack=%u, size=%u)\n", se, seq_no, num_ack, size); +#endif // RUDP_DETAIL_LOG + + if (size >= 1) + { +#ifdef RUDP_DETAIL_LOG + Debug("Send Size: %X %I64u %u %u\n", se, seq_no, size, current_size); +#endif // RUDP_DETAIL_LOG + } +} + +// R-UDP segment transmission (only put into the queue) +void RUDPSendSegment(RUDP_STACK *r, RUDP_SESSION *se, void *data, UINT size) +{ + RUDP_SEGMENT *s; + // Validate arguments + if (r == NULL || se == NULL || (size != 0 && data == NULL) || (size > RUDP_MAX_SEGMENT_SIZE)) + { + return; + } + + s = ZeroMalloc(sizeof(RUDP_SEGMENT)); + + Copy(s->Data, data, size); + s->Size = size; + + s->SeqNo = se->NextSendSeqNo++; + + Insert(se->SendSegmentList, s); +} + +// Search for a session +RUDP_SESSION *RUDPSearchSession(RUDP_STACK *r, IP *my_ip, UINT my_port, IP *your_ip, UINT your_port) +{ + RUDP_SESSION t; + RUDP_SESSION *se; + // Validate arguments + if (r == NULL || my_ip == NULL || your_ip == NULL) + { + return NULL; + } + + Copy(&t.MyIp, my_ip, sizeof(IP)); + t.MyPort = my_port; + Copy(&t.YourIp, your_ip, sizeof(IP)); + t.YourPort = your_port; + + se = Search(r->SessionList, &t); + + return se; +} + +// Release of the session +void RUDPFreeSession(RUDP_SESSION *se) +{ + UINT i; + // Validate arguments + if (se == NULL) + { + return; + } + + Debug("RUDPFreeSession %X\n", se); + + for (i = 0; i < LIST_NUM(se->SendSegmentList); i++) + { + RUDP_SEGMENT *s = LIST_DATA(se->SendSegmentList, i); + + Free(s); + } + + ReleaseList(se->SendSegmentList); + + for (i = 0; i < LIST_NUM(se->RecvSegmentList); i++) + { + RUDP_SEGMENT *s = LIST_DATA(se->RecvSegmentList, i); + + Free(s); + } + + ReleaseList(se->RecvSegmentList); + + if (se->TcpSock != NULL) + { + Disconnect(se->TcpSock); + ReleaseSock(se->TcpSock); + } + + ReleaseInt64List(se->ReplyAckList); + + ReleaseFifo(se->RecvFifo); + ReleaseFifo(se->SendFifo); + + ReleaseSharedBuffer(se->BulkSendKey); + ReleaseSharedBuffer(se->BulkRecvKey); + + Free(se); +} + +// Create a new session +RUDP_SESSION *RUDPNewSession(bool server_mode, IP *my_ip, UINT my_port, IP *your_ip, UINT your_port, UCHAR *init_key) +{ + RUDP_SESSION *se; + UCHAR key1[SHA1_SIZE]; + UCHAR key2[SHA1_SIZE]; + UCHAR bulk_send_key[RUDP_BULK_KEY_SIZE_MAX]; + UCHAR bulk_recv_key[RUDP_BULK_KEY_SIZE_MAX]; + BUF *b; + + se = ZeroMalloc(sizeof(RUDP_SESSION)); + + Copy(&se->MyIp, my_ip, sizeof(IP)); + se->MyPort = my_port; + + Copy(&se->YourIp, your_ip, sizeof(IP)); + se->YourPort = your_port; + + Copy(se->Key_Init, init_key, SHA1_SIZE); + se->LastSentTick = 0; + se->LastRecvTick = Tick64(); + se->LatestRecvMyTick = Tick64(); + + se->NextSendSeqNo = 1; + + se->ServerMode = server_mode; + + se->SendSegmentList = NewList(RUDPCompareSegmentList); + se->RecvSegmentList = NewList(RUDPCompareSegmentList); + + // Generate the two keys + b = NewBuf(); + WriteBuf(b, init_key, SHA1_SIZE); + WriteBufStr(b, "zurukko"); + Sha1(key1, b->Buf, b->Size); + FreeBuf(b); + + b = NewBuf(); + WriteBuf(b, init_key, SHA1_SIZE); + WriteBuf(b, key1, SHA1_SIZE); + WriteBufStr(b, "yasushineko"); + Sha1(key2, b->Buf, b->Size); + FreeBuf(b); + + // Generate the magic number for the KeepAlive + b = NewBuf(); + WriteBuf(b, init_key, SHA1_SIZE); + WriteBufStr(b, "Magic_KeepAliveRequest"); + Sha1(se->Magic_KeepAliveRequest, b->Buf, b->Size); + FreeBuf(b); + b = NewBuf(); + WriteBuf(b, init_key, SHA1_SIZE); + WriteBufStr(b, "Magic_KeepAliveResponse"); + Sha1(se->Magic_KeepAliveResponse, b->Buf, b->Size); + FreeBuf(b); + + if (server_mode == false) + { + se->Magic_Disconnect = 0xffffffff00000000ULL | (UINT64)(Rand32()); + } + + Copy(se->Key_Init, init_key, SHA1_SIZE); + + if (se->ServerMode) + { + Copy(se->Key_Send, key1, SHA1_SIZE); + Copy(se->Key_Recv, key2, SHA1_SIZE); + } + else + { + Copy(se->Key_Send, key2, SHA1_SIZE); + Copy(se->Key_Recv, key1, SHA1_SIZE); + } + + Rand(se->NextIv, sizeof(se->NextIv)); + + se->ReplyAckList = NewInt64List(true); + + se->NextKeepAliveInterval = RUDP_KEEPALIVE_INTERVAL_MIN + (Rand32() % (RUDP_KEEPALIVE_INTERVAL_MAX - RUDP_KEEPALIVE_INTERVAL_MIN)); + + se->RecvFifo = NewFifo(); + se->SendFifo = NewFifo(); + + se->Dns_TranId = Rand16() % 65535 + 1; + + // Generate the bulk transfer key + Rand(bulk_send_key, sizeof(bulk_send_key)); + Rand(bulk_recv_key, sizeof(bulk_recv_key)); + + se->BulkSendKey = NewSharedBuffer(bulk_send_key, sizeof(bulk_send_key)); + se->BulkRecvKey = NewSharedBuffer(bulk_recv_key, sizeof(bulk_recv_key)); + + Rand(se->BulkNextIv, sizeof(se->BulkNextIv)); + Rand(se->BulkNextIv_V2, sizeof(se->BulkNextIv_V2)); + + se->BulkNextSeqNo = 1; + + return se; +} + +// Comparison function of the segment list items +int RUDPCompareSegmentList(void *p1, void *p2) +{ + RUDP_SEGMENT *s1, *s2; + UINT r; + // Validate arguments + if (p1 == NULL || p2 == NULL) + { + return 0; + } + s1 = *((RUDP_SEGMENT **)p1); + s2 = *((RUDP_SEGMENT **)p2); + if (s1 == NULL || s2 == NULL) + { + return 0; + } + + r = COMPARE_RET(s1->SeqNo, s2->SeqNo); + + return r; +} + +// Send a UDP packet +void RUDPSendPacket(RUDP_STACK *r, IP *dest_ip, UINT dest_port, void *data, UINT size, UINT icmp_type) +{ + UDPPACKET *p; + // Validate arguments + if (r == NULL || dest_ip == NULL || dest_port == 0 || data == NULL || size == 0) + { + return; + } + + p = NewUdpPacket(&r->UdpSock->LocalIP, r->UdpSock->LocalPort, + dest_ip, dest_port, + Clone(data, size), size); + + if (r->Protocol == RUDP_PROTOCOL_ICMP || r->Protocol == RUDP_PROTOCOL_DNS) + { + // ICMP Type / DNS Tran ID + p->Type = icmp_type; + } + + Add(r->SendPacketList, p); +} + +// R-UDP main thread +void RUDPMainThread(THREAD *thread, void *param) +{ + RUDP_STACK *r; + bool halt_flag = false; + // Validate arguments + if (thread == NULL || param == NULL) + { + return; + } + + r = (RUDP_STACK *)param; + + AddWaitThread(thread); + NoticeThreadInit(thread); + + while (true) + { + UINT wait_interval; + UINT i; + UINT min_wait_interval; + UINT num_ignore_errors = 0; + + r->Now = Tick64(); + + Lock(r->Lock); + { + Copy(&r->NatT_IP_Safe, &r->NatT_IP, sizeof(IP)); + Copy(&r->My_Private_IP_Safe, &r->My_Private_IP, sizeof(IP)); + } + Unlock(r->Lock); + + // Receive the data from the UDP socket + while (true) + { + UINT ret; + IP ip_src; + UINT port_src; + + ret = RecvFrom(r->UdpSock, &ip_src, &port_src, r->TmpBuf, sizeof(r->TmpBuf)); + + if (ret == SOCK_LATER) + { + // There is no packet more + break; + } + else if (ret != 0) + { + // Receive a Packet + bool ok = false; + UDPPACKET *p = NewUdpPacket(&ip_src, port_src, + &r->UdpSock->LocalIP, r->UdpSock->LocalPort, + Clone(r->TmpBuf, ret), ret); + + if (r->Protocol == RUDP_PROTOCOL_ICMP) + { + // Analyse the incoming ICMP packet + UINT ip_header_size = GetIpHeaderSize(p->Data, p->Size); + + if (ip_header_size >= sizeof(IPV4_HEADER)) + { + if (p->Size >= (ip_header_size + sizeof(ICMP_HEADER) + sizeof(ICMP_ECHO) + SHA1_SIZE)) + { + IPV4_HEADER *ip_header = (IPV4_HEADER *)(((UCHAR *)p->Data) + 0); + ICMP_HEADER *icmp_header = (ICMP_HEADER *)(((UCHAR *)p->Data) + ip_header_size); + ICMP_ECHO *echo_header = (ICMP_ECHO *)(((UCHAR *)p->Data) + ip_header_size + sizeof(ICMP_HEADER)); + + if (icmp_header->Type == ICMP_TYPE_ECHO_RESPONSE || + icmp_header->Type == (r->ServerMode ? ICMP_TYPE_INFORMATION_REQUEST : ICMP_TYPE_INFORMATION_REPLY)) + { + UCHAR hash[SHA1_SIZE]; + + Sha1(hash, ((UCHAR *)p->Data) + ip_header_size + sizeof(ICMP_HEADER) + sizeof(ICMP_ECHO) + SHA1_SIZE, + p->Size - (ip_header_size + sizeof(ICMP_HEADER) + sizeof(ICMP_ECHO) + SHA1_SIZE)); + + if (Cmp(hash, ((UCHAR *)p->Data) + ip_header_size + sizeof(ICMP_HEADER) + sizeof(ICMP_ECHO), SHA1_SIZE) == 0) + { + UCHAR *new_data; + UINT new_data_size; + if (r->ServerMode) + { + // On the server side, the ICMP ID and the SEQ NO of received messages are treated as a source port number + Copy(&p->SrcPort, echo_header, sizeof(UINT)); + } + + // Record the Type + p->Type = icmp_header->Type; + + // Erase the header part + new_data_size = p->Size - (ip_header_size + sizeof(ICMP_HEADER) + sizeof(ICMP_ECHO) + SHA1_SIZE); + new_data = Clone(((UCHAR *)p->Data) + ip_header_size + sizeof(ICMP_HEADER) + sizeof(ICMP_ECHO) + SHA1_SIZE, new_data_size); + Free(p->Data); + p->Data = new_data; + p->Size = new_data_size; + + ok = true; + } + } + } + } + } + else if (r->Protocol == RUDP_PROTOCOL_DNS) + { + // Analyse the incoming DNS packet + UINT offset; + + if (r->ServerMode == false) + { + offset = 42; + } + else + { + offset = 37; + } + + if (p->Size > offset) + { + UCHAR *new_data; + UINT new_size = p->Size - offset; + + p->Type = *((USHORT *)p->Data); + + new_data = Clone(((UCHAR *)p->Data) + offset, new_size); + + Free(p->Data); + p->Data = new_data; + p->Size = new_size; + + ok = true; + } + } + else + { + // Don't do anything for ordinary UDP packet + ok = true; + } + + if (ok) + { + // Process the received packet + RUDPRecvProc(r, p); + + r->TotalPhysicalReceived += ret; + } + + FreeUdpPacket(p); + } + else + { + if (r->UdpSock->IgnoreRecvErr) + { + // An ignorable reception error occurs + if ((num_ignore_errors++) >= MAX_NUM_IGNORE_ERRORS) + { + break; + } + } + else + { + // A non-ignorable reception error occurs + break; + } + } + } + + // Call the interrupt notification callback function + if (r->ProcInterrupts != NULL) + { + r->ProcInterrupts(r); + } + + RUDPInterruptProc(r); + + // Send all packets in the transmission packet list + for (i = 0; i < LIST_NUM(r->SendPacketList); i++) + { + UDPPACKET *p = LIST_DATA(r->SendPacketList, i); + + if (r->Protocol == RUDP_PROTOCOL_ICMP) + { + // In case of the ICMP protocol, assemble an ICMP header + UINT dst_size = sizeof(ICMP_HEADER) + sizeof(ICMP_ECHO) + SHA1_SIZE + p->Size; + UCHAR *dst_data = ZeroMalloc(dst_size); + + ICMP_HEADER *icmp_header = (ICMP_HEADER *)dst_data; + ICMP_ECHO *icmp_echo = (ICMP_ECHO *)(dst_data + sizeof(ICMP_HEADER)); + UCHAR *hash = dst_data + sizeof(ICMP_HEADER) + sizeof(ICMP_ECHO); + UCHAR *icmp_data = dst_data + sizeof(ICMP_HEADER) + sizeof(ICMP_ECHO) + SHA1_SIZE; + + // Header + icmp_header->Type = (UCHAR)p->Type; + icmp_header->Code = 0; + icmp_header->Checksum = 0; + + if (r->ServerMode) + { + // On the server side, use the port number in the opponent internal data as ICMP ID and SEQ NO + Copy(icmp_echo, &p->DestPort, 4); + } + else + { + // Use the fixed ICMP ID and SEQ NO on the client side + icmp_echo->Identifier = Endian16(r->Client_IcmpId); + icmp_echo->SeqNo = Endian16(r->Client_IcmpSeqNo); + } + + // Data body + Copy(icmp_data, p->Data, p->Size); + + // Hash + Sha1(hash, icmp_data, p->Size); + + // Checksum calculation + icmp_header->Checksum = IpChecksum(dst_data, dst_size); + + // Replacement + Free(p->Data); + p->Data = dst_data; + p->Size = dst_size; + } + else if (r->Protocol == RUDP_PROTOCOL_DNS) + { + BUF *b = NewBuf(); + // In case of over DNS protocol, assemble a header that conforms to the DNS protocol + if (r->ServerMode == false) + { + // DNS query header + USHORT us = Rand16() % 65535 + 1; + static UCHAR dns_query_header_1[] = + { + 0x01, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x08, + }; + static UCHAR dns_query_header_2[] = + { + 0x00, 0x00, 0x30, 0x00, 0x01, 0x00, 0x00, 0x29, 0x10, + 0x00, 0x00, 0x00, 0x80, 0x00, + }; + UCHAR rand_data[4]; + char rand_str[MAX_SIZE]; + + Rand(rand_data, sizeof(rand_data)); + BinToStr(rand_str, sizeof(rand_str), rand_data, sizeof(rand_data)); + StrLower(rand_str); + + WriteBuf(b, &us, sizeof(USHORT)); + WriteBuf(b, dns_query_header_1, sizeof(dns_query_header_1)); + WriteBuf(b, rand_str, 8); + WriteBuf(b, dns_query_header_2, sizeof(dns_query_header_2)); + us = Endian16((USHORT)p->Size); + WriteBuf(b, &us, sizeof(USHORT)); + WriteBuf(b, p->Data, p->Size); + } + else + { + // DNS response header + USHORT us = p->Type; + UINT ui; + static UCHAR dns_response_header_1[] = + { + 0x81, 0x80, 0x00, 0x01, 0x00, 0x01, 0x00, 0x00, + 0x00, 0x00, 0x08, + }; + static UCHAR dns_response_header_2[] = + { + 0x00, 0x00, 0x30, 0x00, 0x01, + 0xc0, 0x0c, 0x00, 0x30, 0x00, 0x01, 0x00, 0x00, 0xa4, 0x5b, + }; + static UCHAR dns_response_header_3[] = + { + 0x01, 0x00, 0x03, 0x08, + }; + UCHAR rand_data[4]; + char rand_str[MAX_SIZE]; + + Rand(rand_data, sizeof(rand_data)); + BinToStr(rand_str, sizeof(rand_str), rand_data, sizeof(rand_data)); + StrLower(rand_str); + + WriteBuf(b, &us, sizeof(USHORT)); + WriteBuf(b, dns_response_header_1, sizeof(dns_response_header_1)); + WriteBuf(b, rand_str, 8); + WriteBuf(b, dns_response_header_2, sizeof(dns_response_header_2)); + us = Endian16((USHORT)(p->Size + 4)); + WriteBuf(b, &us, sizeof(USHORT)); + WriteBuf(b, dns_response_header_3, sizeof(dns_response_header_3)); + WriteBuf(b, p->Data, p->Size); + + ui = Rand16() % (60 * 60 * 12) + (60 * 60 * 12); + WRITE_UINT(((UCHAR *)b->Buf) + 0x20, ui); + } + Free(p->Data); + p->Data = b->Buf; + p->Size = b->Size; + Free(b); + } + + SendTo(r->UdpSock, &p->DstIP, p->DestPort, p->Data, p->Size); + + r->TotalPhysicalSent += p->Size; + + FreeUdpPacket(p); + } + DeleteAll(r->SendPacketList); + + if (r->Halt) + { + // If it is necessary to stop, stop it after cycling through a loop + if (halt_flag == false) + { + halt_flag = true; + continue; + } + else + { + break; + } + } + + // Rest the CPU until the next event + wait_interval = GetNextIntervalForInterrupt(r->Interrupt); + if (r->ServerMode) + { + min_wait_interval = RUDP_LOOP_WAIT_INTERVAL_S; + } + else + { + min_wait_interval = RUDP_LOOP_WAIT_INTERVAL_C; + } + + if (wait_interval == INFINITE) + { + wait_interval = min_wait_interval; + } + else + { + wait_interval = MIN(min_wait_interval, wait_interval); + } + +#ifdef RUDP_DETAIL_LOG + Debug("wait_interval = %u\n", wait_interval); +#endif // RUDP_DETAIL_LOG + + if (wait_interval >= 1) + { + WaitSockEvent(r->SockEvent, wait_interval); + } + +#ifdef RUDP_DETAIL_LOG + if (r->ServerMode) + { + char str1[MAX_SIZE]; + char str2[MAX_SIZE]; + double rate = 0.0; + + ToStr64(str1, r->TotalPhysicalReceived); + ToStr64(str2, r->TotalLogicalReceived); + + if (r->TotalPhysicalReceived >= 1) + { + rate = (double)r->TotalLogicalReceived / (double)r->TotalPhysicalReceived; + } + + Debug("%s / %s %.4f\n", str1, str2, rate); + } +#endif // RUDP_DETAIL_LOG + } + + Disconnect(r->UdpSock); + + DelWaitThread(thread); +} + +// Generate a appropriate register host name from the IP address +void RUDPGetRegisterHostNameByIP(char *dst, UINT size, IP *ip) +{ + char tmp[16]; + // Validate arguments + if (dst == NULL) + { + return; + } + + if (ip != NULL && IsIP4(ip)) + { + UCHAR hash[SHA1_SIZE]; + + Sha1(hash, ip->addr, 4); + BinToStr(tmp, sizeof(tmp), hash, 2); + } + else + { + UCHAR rand[2]; + Rand(rand, 2); + BinToStr(tmp, sizeof(tmp), rand, 2); + } + + StrLower(tmp); + Format(dst, size, + (IsUseAlternativeHostname() ? UDP_NAT_T_SERVER_TAG_ALT : UDP_NAT_T_SERVER_TAG), + tmp[2], tmp[3]); + + + if (false) + { + Debug("Hash Src IP: %r\n" + "Hash Dst HN: %s\n", + ip, + dst); + } +} + +// Analyze the IP address and port number from the string +bool RUDPParseIPAndPortStr(void *data, UINT data_size, IP *ip, UINT *port) +{ + char tmp[MAX_SIZE]; + UINT i; + char ipstr[MAX_SIZE]; + char *portstr; + // Validate arguments + if (data == NULL || ip == NULL || port == NULL) + { + return false; + } + + Zero(tmp, sizeof(tmp)); + + Copy(tmp, data, MIN(data_size, sizeof(tmp) - 1)); + + if (StartWith(tmp, "IP=") == false) + { + return false; + } + + i = SearchStrEx(tmp, "#", 0, true); + if (i != INFINITE) + { + tmp[i] = 0; + } + + StrCpy(ipstr, sizeof(ipstr), tmp + 3); + + i = SearchStrEx(ipstr, ",PORT=", 0, true); + if (i == INFINITE) + { + return false; + } + + ipstr[i] = 0; + portstr = ipstr + i + 6; + + StrToIP(ip, ipstr); + *port = ToInt(portstr); + + return true; +} + +// R-UDP NAT-T IP address acquisition thread +void RUDPIpQueryThread(THREAD *thread, void *param) +{ + RUDP_STACK *r; + UINT64 next_getip_tick = 0; + UINT64 next_getprivate_ip_tick = 0; + UINT last_ip_hash = 0; + void *route_change_poller = NULL; + char current_hostname[MAX_SIZE]; + bool last_time_ip_changed = false; + UINT num_retry = 0; + // Validate arguments + if (thread == NULL || param == NULL) + { + return; + } + + r = (RUDP_STACK *)param; + + last_ip_hash = GetHostIPAddressHash32(); + + route_change_poller = NewRouteChange(); + IsRouteChanged(route_change_poller); + + Zero(current_hostname, sizeof(current_hostname)); + + while (r->Halt == false) + { + UINT ip_hash = GetHostIPAddressHash32(); + UINT64 now = Tick64(); + bool ip_changed = false; + + if (ip_hash != last_ip_hash) + { + last_time_ip_changed = false; + } + + if ((ip_hash != last_ip_hash) || (IsRouteChanged(route_change_poller))) + { + if (last_time_ip_changed == false) + { + // Call all getting functions from the beginning + // if the routing table or the IP address of this host has changed + next_getip_tick = 0; + next_getprivate_ip_tick = 0; + ip_changed = true; + + last_ip_hash = ip_hash; + + last_time_ip_changed = true; + } + } + else + { + last_time_ip_changed = false; + } + + Lock(r->Lock); + { + if (StrCmpi(current_hostname, r->CurrentRegisterHostname) != 0) + { + // The target host name has changed + next_getip_tick = 0; + StrCpy(current_hostname, sizeof(current_hostname), r->CurrentRegisterHostname); + } + } + Unlock(r->Lock); + + // Get the IP address of the NAT-T server with DNS + if (next_getip_tick == 0 || now >= next_getip_tick) + { + IP ip; + + if (GetIP4(&ip, current_hostname) && IsZeroIp(&ip) == false) + { + Lock(r->Lock); + { +// Debug("%r %r\n",&r->NatT_IP, &ip); + if (CmpIpAddr(&r->NatT_IP, &ip) != 0) + { +// WHERE; + ip_changed = true; + Copy(&r->NatT_IP, &ip, sizeof(IP)); + } + } + Unlock(r->Lock); + } + + if (IsZeroIp(&r->NatT_IP)) + { + num_retry++; + + next_getip_tick = now + MIN((UINT64)UDP_NAT_T_GET_IP_INTERVAL * (UINT64)num_retry, (UINT64)UDP_NAT_T_GET_IP_INTERVAL_MAX); + } + else + { + next_getip_tick = now + (UINT64)UDP_NAT_T_GET_IP_INTERVAL_AFTER; + } + + if (ip_changed) + { + Debug("NAT-T: NAT-T Server IP (%s): %r\n", current_hostname, &r->NatT_IP); + + r->NatT_GetTokenNextTick = 0; + r->NatT_RegisterNextTick = 0; + r->NatT_GetTokenFailNum = 0; + r->NatT_RegisterFailNum = 0; + + r->NatT_TranId = Rand64(); + + SetSockEvent(r->SockEvent); + } + } + + // Get a private IP address of this host using TCP + if (next_getprivate_ip_tick == 0 || now >= next_getprivate_ip_tick) + { + IP ip; + + if (GetMyPrivateIP(&ip, false)) + { + Lock(r->Lock); + { + Copy(&r->My_Private_IP, &ip, sizeof(IP)); + } + Unlock(r->Lock); + } + + if (IsZeroIp(&r->My_Private_IP)) + { + next_getprivate_ip_tick = now + (UINT64)UDP_NAT_T_GET_PRIVATE_IP_INTERVAL; + } + else + { + next_getprivate_ip_tick = now + (UINT64)GenRandInterval(UDP_NAT_T_GET_PRIVATE_IP_INTERVAL_AFTER_MIN, UDP_NAT_T_GET_PRIVATE_IP_INTERVAL_AFTER_MAX); + } + + Debug("NAT-T: My Private IP: %r\n", &r->My_Private_IP); + } + + if (r->Halt) + { + break; + } + + Wait(r->HaltEvent, RUDP_LOOP_WAIT_INTERVAL_S); + } + + FreeRouteChange(route_change_poller); +} + +// Generate a random intervals +UINT GenRandInterval(UINT min, UINT max) +{ + UINT a, b; + + a = MIN(min, max); + b = MAX(min, max); + + if (a == b) + { + return a; + } + + return (Rand32() % (b - a)) + a; +} + +// Identify the private IP of the interface which is used to connect to the Internet currently +bool GetMyPrivateIP(IP *ip, bool from_vg) +{ + SOCK *s; + IP t; + char *hostname = UDP_NAT_T_GET_PRIVATE_IP_TCP_SERVER; + // Validate arguments + if (ip == NULL) + { + return false; + } + + s = ConnectEx(hostname, UDP_NAT_T_PORT_FOR_TCP_1, UDP_NAT_T_GET_PRIVATE_IP_CONNECT_TIMEOUT); + + if (s == NULL) + { + s = ConnectEx(hostname, UDP_NAT_T_PORT_FOR_TCP_2, UDP_NAT_T_GET_PRIVATE_IP_CONNECT_TIMEOUT); + + if (s == NULL) + { + s = ConnectEx(GetRandHostNameForGetMyPrivateIP(), UDP_NAT_T_PORT_FOR_TCP_1, UDP_NAT_T_GET_PRIVATE_IP_CONNECT_TIMEOUT); + + if (s == NULL) + { + return false; + } + } + } + + Copy(&t, &s->LocalIP, sizeof(IP)); + + Disconnect(s); + ReleaseSock(s); + + if (IsZeroIp(&t)) + { + return false; + } + + Copy(ip, &t, sizeof(IP)); + + return true; +} +char *GetRandHostNameForGetMyPrivateIP() +{ + char *hosts[] = + { + "www.microsoft.com", + "www.yahoo.com", + "www.bing.com", + }; + UINT num_hosts = 3; + + return hosts[Rand32() % num_hosts]; +} + +// Function to wait until changing any IP address of the host or expiring the specified time or waking the event +void WaitUntilHostIPAddressChanged(void *p, EVENT *event, UINT timeout, UINT ip_check_interval) +{ + UINT64 start, end; + UINT last_hash; + // Validate arguments + if (timeout == 0x7FFFFFFF) + { + timeout = 0xFFFFFFFF; + } + if (ip_check_interval == 0) + { + ip_check_interval = 0xFFFFFFFF; + } + if (event == NULL || timeout == 0) + { + return; + } + + start = Tick64(); + end = start + (UINT64)timeout; + last_hash = GetHostIPAddressHash32(); + + while (true) + { + UINT64 now = Tick64(); + UINT next_interval; + + if (now >= end) + { + break; + } + + if (p != NULL) + { + if (IsRouteChanged(p)) + { + break; + } + } + + if (last_hash != GetHostIPAddressHash32()) + { + break; + } + + next_interval = (UINT)(end - now); + next_interval = MIN(next_interval, ip_check_interval); + + if (Wait(event, next_interval)) + { + break; + } + } +} +void *InitWaitUntilHostIPAddressChanged() +{ + void *p = NewRouteChange(); + + if (p != NULL) + { + IsRouteChanged(p); + } + + return p; +} +void FreeWaitUntilHostIPAddressChanged(void *p) +{ + FreeRouteChange(p); +} + +// Get whether the specified IPv6 address is on the local network +bool IsIPv6LocalNetworkAddress(IP *ip) +{ + UINT type; + LIST *o; + UINT i; + bool ret = false; + IP mask64; + // Validate arguments + if (ip == NULL) + { + return false; + } + if (IsIP6(ip) == false) + { + return false; + } + if (IsZeroIp(ip)) + { + return false; + } + + type = GetIPAddrType6(ip); + + if (type & IPV6_ADDR_LOCAL_UNICAST) + { + return true; + } + + if ((type & IPV6_ADDR_GLOBAL_UNICAST) == 0) + { + return false; + } + + IntToSubnetMask6(&mask64, 64); + + o = GetHostIPAddressList(); + + ret = false; + + for (i = 0; i < LIST_NUM(o); i++) + { + IP *p = LIST_DATA(o, i); + + if (IsIP6(p)) + { + if (IsZeroIp(p) == false) + { + if (IsLocalHostIP6(p) == false) + { + if (IsInSameNetwork6(p, ip, &mask64)) + { + ret = true; + } + } + } + } + } + + FreeHostIPAddressList(o); + + return ret; +} + +// Check whether the specified IP address is localhost or the IP address of the local interface of itself +bool IsIPLocalHostOrMySelf(IP *ip) +{ + LIST *o; + bool ret = false; + UINT i; + // Validate arguments + if (ip == NULL) + { + return false; + } + + o = GetHostIPAddressList(); + if (o == NULL) + { + return false; + } + + for (i = 0; i < LIST_NUM(o); i++) + { + IP *p = LIST_DATA(o, i); + + if (CmpIpAddr(p, ip) == 0) + { + ret = true; + + break; + } + } + + FreeHostIPAddressList(o); + + if (IsLocalHostIP4(ip) || IsLocalHostIP6(ip)) + { + ret = true; + } + + return ret; +} + +// Obtain the hash value of combining all of the IP address assigned to the host +UINT GetHostIPAddressHash32() +{ + BUF *b; + UINT i; + UCHAR hash[SHA1_SIZE]; + UINT ret; + LIST *o = GetHostIPAddressList(); + + if (o == NULL) + { + return 0; + } + + b = NewBuf(); + for (i = 0; i < LIST_NUM(o); i++) + { + IP *ip = LIST_DATA(o, i); + + WriteBuf(b, ip, sizeof(IP)); + + WriteBufStr(b, ":-) yas (-:"); + } + FreeHostIPAddressList(o); + + WriteBuf(b, rand_port_numbers, sizeof(rand_port_numbers)); + + Sha1(hash, b->Buf, b->Size); + + FreeBuf(b); + + Copy(&ret, hash, sizeof(UINT)); + + return ret; +} + +// Create an IPv4 UDP socket destined for a particular target +SOCK *NewUDP4ForSpecificIp(IP *target_ip, UINT port) +{ + SOCK *s; + IP local_ip; + // Validate arguments + if (target_ip == NULL || IsZeroIP(target_ip) || IsIP4(target_ip) == false) + { + target_ip = NULL; + } + + Zero(&local_ip, sizeof(local_ip)); + GetBestLocalIpForTarget(&local_ip, target_ip); + + s = NewUDP4(port, &local_ip); + + if (s == NULL) + { + s = NewUDP4(port, NULL); + } + + return s; +} + +// Get the best self IPv4 address to connect to the target IPv4 address +bool GetBestLocalIpForTarget(IP *local_ip, IP *target_ip) +{ + bool ret = false; + ROUTE_ENTRY *e; + IP ip2; + UINT n = 0; + IP zero_ip; + // Validate arguments + Zero(local_ip, sizeof(IP)); + ZeroIP4(&zero_ip); + if (target_ip == NULL) + { + target_ip = &zero_ip; + } + if (local_ip == NULL || IsIP4(target_ip) == false) + { + return false; + } + + Copy(&ip2, target_ip, sizeof(IP)); + + while (true) + { + n++; + if (n >= 64) + { + break; + } + + e = GetBestRouteEntry(&ip2); + if (e != NULL) + { + if (IsZeroIp(&e->GatewayIP)) + { + Free(e); + break; + } + + if (e->LocalRouting) + { + ret = true; + Copy(local_ip, &e->GatewayIP, sizeof(IP)); + Free(e); + break; + } + else + { + Copy(&ip2, &e->GatewayIP, sizeof(IP)); + } + + Free(e); + } + } + + if (ret == false) + { + if (IsLocalHostIP4(target_ip)) + { + GetLocalHostIP4(local_ip); + ret = true; + } + } + + return ret; +} + +// Create a R-UDP client (Connection via NAT-T gateway) +SOCK *NewRUDPClientNatT(char *svc_name, IP *ip, UINT *error_code, UINT timeout, bool *cancel, char *hint_str, char *target_hostname) +{ + IP nat_t_ip; + UINT dummy_int = 0; + UINT64 giveup_tick; + bool dummy_bool = false; + SOCK_EVENT *sock_event; + SOCK *sock; + bool same_lan = false; + char hostname[MAX_SIZE]; + + + + if (timeout == 0) + { + timeout = RUDP_TIMEOUT; + } + if (error_code == NULL) + { + error_code = &dummy_int; + } + if (cancel == NULL) + { + cancel = &dummy_bool; + } + *error_code = RUDP_ERROR_UNKNOWN; + if (svc_name == NULL || ip == NULL) + { + return NULL; + } + + ListenTcpForPopupFirewallDialog(); + + giveup_tick = Tick64() + (UINT64)timeout; + + // Get the IP address of the NAT-T server + RUDPGetRegisterHostNameByIP(hostname, sizeof(hostname), ip); + if (GetIP4Ex(&nat_t_ip, hostname, 0, cancel) == false) + { + *error_code = RUDP_ERROR_NAT_T_NO_RESPONSE; + return NULL; + } + + if (Tick64() >= giveup_tick) + { + *error_code = RUDP_ERROR_TIMEOUT; + return NULL; + } + if (*cancel) + { + *error_code = RUDP_ERROR_USER_CANCELED; + return NULL; + } + + sock = NewUDP4ForSpecificIp(&nat_t_ip, 0); + if (sock == NULL) + { + *error_code = RUDP_ERROR_UNKNOWN; + return NULL; + } + else + { + UINT64 next_send_request_tick = 0; + INTERRUPT_MANAGER *interrupt = NewInterruptManager(); + UINT64 tran_id = Rand64(); + UINT tmp_size = 65536; + UCHAR *tmp = Malloc(tmp_size); + char result_ip_str[MAX_SIZE]; + IP result_ip; + UINT result_port; + SOCK *ret = NULL; + UINT num_tries = 0; + UINT64 current_cookie = 0; + + AddInterrupt(interrupt, giveup_tick); + + sock_event = NewSockEvent(); + JoinSockToSockEvent(sock, sock_event); + + // Communication with the NAT-T server + while (true) + { + UINT64 now = Tick64(); + UINT interval; + UINT r; + IP src_ip; + UINT src_port; + UINT err; + UINT num_ignore_errors = 0; + + if (now >= giveup_tick) + { + // Time-out +LABEL_TIMEOUT: + *error_code = RUDP_ERROR_NAT_T_NO_RESPONSE; + break; + } + + if (*cancel) + { + // User canceled + *error_code = RUDP_ERROR_USER_CANCELED; + break; + } + + err = INFINITE; + + // Receive a response packet from the NAT-T server + while (err == INFINITE) + { + r = RecvFrom(sock, &src_ip, &src_port, tmp, tmp_size); + if (r == SOCK_LATER) + { + // No packet + break; + } + else if (r == 0) + { + if (sock->IgnoreRecvErr == false) + { + // Communication error + goto LABEL_TIMEOUT; + } + else + { + if ((num_ignore_errors++) >= MAX_NUM_IGNORE_ERRORS) + { + goto LABEL_TIMEOUT; + } + } + } + else + { + // Check the source IP address and the port number + if (CmpIpAddr(&src_ip, &nat_t_ip) == 0 && src_port == UDP_NAT_T_PORT) + { + BUF *b = NewBuf(); + PACK *p; + + WriteBuf(b, tmp, r); + SeekBuf(b, 0, 0); + + + p = BufToPack(b); + + if (p != NULL) + { + UINT64 cookie = PackGetInt64(p, "cookie"); + if (cookie != 0) + { + current_cookie = cookie; + } + + // Compare tran_id + if (PackGetInt64(p, "tran_id") == tran_id) + { + // Compare opcode + if (PackCmpStr(p, "opcode", "nat_t_connect_request")) + { + bool ok = PackGetBool(p, "ok"); + bool multi_candidate = PackGetBool(p, "multi_candidates"); + + if (ok) + { + // Success + PackGetStr(p, "result_ip", result_ip_str, sizeof(result_ip_str)); + StrToIP(&result_ip, result_ip_str); + + result_port = PackGetInt(p, "result_port"); + + same_lan = PackGetBool(p, "same_lan"); + + if (result_port != 0) + { + if (IsZeroIp(&result_ip) == false) + { + if ((sock->IPv6 == false && IsIP4(&result_ip)) || + (sock->IPv6 && IsIP6(&result_ip))) + { + err = RUDP_ERROR_OK; + } + } + } + } + else if (multi_candidate) + { + // There are two or more computers behind the specified IP address + err = RUDP_ERROR_NAT_T_TWO_OR_MORE; + } + else + { + // Failure + err = RUDP_ERROR_NAT_T_NOT_FOUND; + } + } + } + + FreePack(p); + } + + FreeBuf(b); + } + } + } + + if (err != INFINITE) + { + *error_code = err; + break; + } + + if (next_send_request_tick == 0 || now >= next_send_request_tick) + { + // Send a connection request to the NAT-T server + BUF *b; + char ip_str[MAX_SIZE]; + PACK *p = NewPack(); + + PackAddStr(p, "opcode", "nat_t_connect_request"); + PackAddInt64(p, "tran_id", tran_id); + IPToStr(ip_str, sizeof(ip_str), ip); + PackAddStr(p, "dest_ip", ip_str); + PackAddInt64(p, "cookie", current_cookie); + if (IsEmptyStr(hint_str) == false) + { + PackAddStr(p, "hint", hint_str); + } + if (IsEmptyStr(target_hostname) == false) + { + PackAddStr(p, "target_hostname", target_hostname); + } + PackAddStr(p, "svc_name", svc_name); + + PackAddInt(p, "nat_traversal_version", UDP_NAT_TRAVERSAL_VERSION); + + b = PackToBuf(p); + FreePack(p); + + SendTo(sock, &nat_t_ip, UDP_NAT_T_PORT, b->Buf, b->Size); + FreeBuf(b); + + // Determine the next transmission time + next_send_request_tick = now + (UINT64)UDP_NAT_T_CONNECT_INTERVAL * (UINT64)(Power(2, MAX(num_tries, 6))); + num_tries++; + AddInterrupt(interrupt, next_send_request_tick); + } + + interval = GetNextIntervalForInterrupt(interrupt); + interval = MIN(interval, 50); + + WaitSockEvent(sock_event, interval); + } + + Free(tmp); + FreeInterruptManager(interrupt); + + if (*error_code == RUDP_ERROR_OK) + { + UINT remain_timeout; + UINT64 now = Tick64(); + // Success to get the IP address and the port number of the target + + // Get the rest timeout tolerance + if (now <= giveup_tick) + { + remain_timeout = (UINT)(giveup_tick - now); + } + else + { + remain_timeout = 0; + } + + remain_timeout = MAX(remain_timeout, 2000); + + if (same_lan) + { + // Discard current UDP socket and create a new UDP socket in NewRUDPClientDirect(). + // Because using a UDP socket which used for communication with the NAT-T server + // can cause trouble when the client and the server exists in the same LAN. + ReleaseSockEvent(sock_event); + ReleaseSock(sock); + + sock = NULL; + sock_event = NULL; + } + + ret = NewRUDPClientDirect(svc_name, &result_ip, result_port, error_code, remain_timeout, cancel, + sock, sock_event, 0, false); + } + + if (sock_event != NULL) + { + ReleaseSockEvent(sock_event); + } + + if (sock != NULL) + { + if (ret == NULL) + { + Disconnect(sock); + } + + ReleaseSock(sock); + } + + return ret; + } +} + +// Listen to the TCP for a moment to show the firewall dialog +void ListenTcpForPopupFirewallDialog() +{ +#ifdef OS_WIN32 + static bool tried = false; + + if (tried == false) + { + SOCK *s; + tried = true; + s = ListenAnyPortEx2(false, true); + + if (s != NULL) + { + Disconnect(s); + ReleaseSock(s); + } + } +#endif // OS_WIN32 +} + +// Create a R-UDP client (direct connection) +SOCK *NewRUDPClientDirect(char *svc_name, IP *ip, UINT port, UINT *error_code, UINT timeout, bool *cancel, SOCK *sock, SOCK_EVENT *sock_event, UINT local_port, bool over_dns_mode) +{ + RUDP_STACK *r; + UINT dummy_int = 0; + SOCK *ret = NULL; + // Validate arguments + if (error_code == NULL) + { + error_code = &dummy_int; + } + if (timeout == 0) + { + timeout = RUDP_TIMEOUT; + } + *error_code = RUDP_ERROR_UNKNOWN; + if (svc_name == NULL || ip == NULL || port == 0) + { + return NULL; + } + + r = NewRUDP(false, svc_name, NULL, NULL, NULL, local_port, sock, sock_event, false, over_dns_mode, ip, NULL, 0, NULL); + if (r == NULL) + { + *error_code = RUDP_ERROR_UNKNOWN; + return NULL; + } + + // Set the port number and the target IP address + Lock(r->Lock); + { + Copy(&r->TargetIp, ip, sizeof(IP)); + r->TargetPort = port; + r->TargetIpAndPortInited = true; + } + Unlock(r->Lock); + SetSockEvent(r->SockEvent); + + // Wait for a connection success/failure to the target IP address + WaitEx(r->TargetConnectedEvent, timeout, cancel); + Lock(r->Lock); + { + if (r->TargetConnectedSock != NULL) + { + // The connection succeeded + ret = r->TargetConnectedSock; + r->TargetConnectedSock = NULL; + } + else + { + r->DoNotSetTargetConnectedSock = true; + } + } + Unlock(r->Lock); + + if (ret == NULL) + { + // Stop the R-UDP stack if the connection has failed + *error_code = RUDP_ERROR_TIMEOUT; + FreeRUDP(r); + } + else if (cancel != NULL && (*cancel)) + { + // User canceled + *error_code = RUDP_ERROR_USER_CANCELED; + + Disconnect(ret); + ReleaseSock(ret); + + ret = NULL; + } + else + { + *error_code = RUDP_ERROR_OK; + } + + return ret; +} + +// Creating a R-UDP server +RUDP_STACK *NewRUDPServer(char *svc_name, RUDP_STACK_INTERRUPTS_PROC *proc_interrupts, RUDP_STACK_RPC_RECV_PROC *proc_rpc_recv, void *param, UINT port, bool no_natt_register, bool over_dns_mode, volatile UINT *natt_global_udp_port, UCHAR rand_port_id, IP *listen_ip) +{ + RUDP_STACK *r; + // Validate arguments + if (IsEmptyStr(svc_name)) + { + return NULL; + } + + if (g_no_rudp_server) + { + return NULL; + } + + ListenTcpForPopupFirewallDialog(); + + r = NewRUDP(true, svc_name, proc_interrupts, proc_rpc_recv, param, port, NULL, NULL, no_natt_register, over_dns_mode, NULL, natt_global_udp_port, rand_port_id, listen_ip); + + if (r == NULL) + { + return NULL; + } + + return r; +} + +// Creating a R-UDP +RUDP_STACK *NewRUDP(bool server_mode, char *svc_name, RUDP_STACK_INTERRUPTS_PROC *proc_interrupts, RUDP_STACK_RPC_RECV_PROC *proc_rpc_recv, void *param, UINT port, SOCK *sock, SOCK_EVENT *sock_event, bool server_no_natt_register, bool over_dns_mode, IP *client_target_ip, volatile UINT *natt_global_udp_port, UCHAR rand_port_id, IP *listen_ip) +{ + RUDP_STACK *r; + char tmp[MAX_SIZE]; + UCHAR pid_hash[SHA1_SIZE]; + UINT pid; + USHORT pid_us; + + // Validate arguments + if (IsEmptyStr(svc_name)) + { + return NULL; + } + + ListenTcpForPopupFirewallDialog(); + + if (sock == NULL) + { + if (server_mode == false && client_target_ip != NULL) + { + sock = NewUDP4ForSpecificIp(client_target_ip, port); + } + else + { + if (rand_port_id == 0) + { + sock = NewUDPEx2(port, false, listen_ip); + } + else + { + sock = NewUDPEx2RandMachineAndExePath(false, listen_ip, 0, rand_port_id); + } + } + + if (sock == NULL) + { + return NULL; + } + } + else + { + AddRef(sock->ref); + } + + if (port == 0) + { + port = sock->LocalPort; + } + + if (rand_port_id != 0) + { + rand_port_numbers[rand_port_id] = port; + } + + if (sock_event == NULL) + { + sock_event = NewSockEvent(); + } + else + { + AddRef(sock_event->ref); + } + + r = ZeroMalloc(sizeof(RUDP_STACK)); + + r->NatT_SessionKey = Rand64(); + + StrCpy(r->SvcName, sizeof(r->SvcName), svc_name); + r->RandPortId = rand_port_id; + r->NatTGlobalUdpPort = natt_global_udp_port; + r->ServerMode = server_mode; + r->Interrupt = NewInterruptManager(); + r->SessionList = NewList(RUDPCompareSessionList); + r->UdpSock = sock; + r->Port = port; + r->SockEvent = sock_event; + r->HaltEvent = NewEvent(); + r->Now = Tick64(); + r->Lock = NewLock(); + r->Param = param; + r->TargetConnectedEvent = NewEvent(); + r->SendPacketList = NewList(NULL); + r->NewSockConnectEvent = NewEvent(); + r->NewSockQueue = NewQueue(); + r->NatT_TranId = Rand64(); + + r->NatT_SourceIpList = NewListFast(NULL); + + StrCpy(tmp, sizeof(tmp), r->SvcName); + Trim(tmp); + StrLower(tmp); + + Sha1(r->SvcNameHash, tmp, StrLen(tmp)); + + r->Client_IcmpId = (USHORT)(Rand32() % 65534 + 1); + r->Client_IcmpSeqNo = (USHORT)(Rand32() % 65534 + 1); + + // Determination of the type of the protocol + r->Protocol = RUDP_PROTOCOL_UDP; + if (r->Port == MAKE_SPECIAL_PORT(IP_PROTO_ICMPV4)) + { + r->Protocol = RUDP_PROTOCOL_ICMP; + + // Generate the ICMP ID based on the process ID +#ifdef OS_WIN32 + pid = (UINT)MsGetProcessId(); +#else // OS_WIN32 + pid = (UINT)getpid(); +#endif // OS_WIN32 + + pid = Endian32(pid); + Sha1(pid_hash, &pid, sizeof(UINT)); + + pid_us = READ_USHORT(pid_hash); + if (pid_us == 0 || pid_us == 0xFFFF) + { + pid_us = 1; + } + + r->Client_IcmpId = pid_us; + } + else if (over_dns_mode) + { + r->Protocol = RUDP_PROTOCOL_DNS; + } + + if (r->ServerMode) + { + r->NoNatTRegister = server_no_natt_register; + + if (r->Protocol == RUDP_PROTOCOL_ICMP || r->Protocol == RUDP_PROTOCOL_DNS) + { + // Never register to the NAT-T server in case of using the DNS or the ICMP + r->NoNatTRegister = true; + } + } + + if (true + ) + { + RUDPGetRegisterHostNameByIP(r->CurrentRegisterHostname, sizeof(r->CurrentRegisterHostname), NULL); + } + + if (r->ServerMode) + { + r->ProcInterrupts = proc_interrupts; + r->ProcRpcRecv = proc_rpc_recv; + } + + if (r->ServerMode && r->NoNatTRegister == false + ) + { + r->IpQueryThread = NewThread(RUDPIpQueryThread, r); + } + + JoinSockToSockEvent(r->UdpSock, r->SockEvent); + + r->Thread = NewThread(RUDPMainThread, r); + WaitThreadInit(r->Thread); + + return r; +} + +// R-UDP session comparison function +int RUDPCompareSessionList(void *p1, void *p2) +{ + RUDP_SESSION *s1, *s2; + UINT r; + // Validate arguments + if (p1 == NULL || p2 == NULL) + { + return 0; + } + s1 = *((RUDP_SESSION **)p1); + s2 = *((RUDP_SESSION **)p2); + if (s1 == NULL || s2 == NULL) + { + return 0; + } + + r = CmpIpAddr(&s1->YourIp, &s2->YourIp); + if (r != 0) + { + return r; + } + + r = COMPARE_RET(s1->YourPort, s2->YourPort); + if (r != 0) + { + return r; + } + + r = CmpIpAddr(&s1->MyIp, &s2->MyIp); + if (r != 0) + { + return r; + } + + r = COMPARE_RET(s1->MyPort, s2->MyPort); + if (r != 0) + { + return r; + } + + return 0; +} + +// Release of the R-UDP +void FreeRUDP(RUDP_STACK *r) +{ + UINT i; + // Validate arguments + if (r == NULL) + { + return; + } + + r->Halt = true; + Set(r->HaltEvent); + SetSockEvent(r->SockEvent); + + if (r->ServerMode && r->NoNatTRegister == false) + { + if (r->IpQueryThread != NULL) + { + WaitThread(r->IpQueryThread, INFINITE); + ReleaseThread(r->IpQueryThread); + } + } + + WaitThread(r->Thread, INFINITE); + ReleaseThread(r->Thread); + + for (i = 0; i < LIST_NUM(r->SessionList); i++) + { + RUDP_SESSION *se = LIST_DATA(r->SessionList, i); + + RUDPFreeSession(se); + } + + ReleaseList(r->SessionList); + + for (i = 0; i < LIST_NUM(r->SendPacketList); i++) + { + UDPPACKET *p = LIST_DATA(r->SendPacketList, i); + + FreeUdpPacket(p); + } + + while (true) + { + SOCK *s = GetNext(r->NewSockQueue); + if (s == NULL) + { + break; + } + + Disconnect(s); + ReleaseSock(s); + } + + for (i = 0; i < LIST_NUM(r->NatT_SourceIpList); i++) + { + RUDP_SOURCE_IP *sip = (RUDP_SOURCE_IP *)LIST_DATA(r->NatT_SourceIpList, i); + + Free(sip); + } + + ReleaseList(r->NatT_SourceIpList); + + ReleaseQueue(r->NewSockQueue); + + ReleaseList(r->SendPacketList); + + FreeInterruptManager(r->Interrupt); + + Disconnect(r->UdpSock); + ReleaseSock(r->UdpSock); + ReleaseSockEvent(r->SockEvent); + ReleaseEvent(r->HaltEvent); + ReleaseEvent(r->TargetConnectedEvent); + + ReleaseEvent(r->NewSockConnectEvent); + + Disconnect(r->TargetConnectedSock); + ReleaseSock(r->TargetConnectedSock); + + DeleteLock(r->Lock); + + if (r->RandPortId != 0) + { + rand_port_numbers[r->RandPortId] = 0; + } + + Free(r); +} + +// Generate a hash from the current computer name and the process name +void GetCurrentMachineIpProcessHash(void *hash) +{ + // Validate arguments + if (hash == NULL) + { + return; + } + + Lock(machine_ip_process_hash_lock); + { + if (IsZero(machine_ip_process_hash, SHA1_SIZE)) + { + GetCurrentMachineIpProcessHashInternal(machine_ip_process_hash); + } + + Copy(hash, machine_ip_process_hash, SHA1_SIZE); + } + Unlock(machine_ip_process_hash_lock); +} +void GetCurrentMachineIpProcessHashInternal(void *hash) +{ + BUF *b; + LIST *ip_list; + char machine_name[MAX_SIZE]; + wchar_t exe_path[MAX_PATH]; + char *product_id = NULL; + // Validate arguments + if (hash == NULL) + { + return; + } + +#ifdef OS_WIN32 + product_id = MsRegReadStr(REG_LOCAL_MACHINE, "SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion", "ProductId"); + if (product_id == NULL) + { + product_id = MsRegReadStr(REG_LOCAL_MACHINE, "SOFTWARE\\Microsoft\\Windows\\CurrentVersion", "ProductId"); + } +#endif // OS_WIN32 + + b = NewBuf(); + + GetMachineHostName(machine_name, sizeof(machine_name)); + Trim(machine_name); + StrUpper(machine_name); + + GetExeNameW(exe_path, sizeof(exe_path)); + UniTrim(exe_path); + UniStrUpper(exe_path); + + WriteBuf(b, machine_name, StrSize(machine_name)); + WriteBuf(b, exe_path, UniStrSize(exe_path)); + WriteBuf(b, product_id, StrSize(product_id)); + + ip_list = GetHostIPAddressList(); + if (ip_list != NULL) + { + UINT i; + for (i = 0; i < LIST_NUM(ip_list); i++) + { + IP *ip = LIST_DATA(ip_list, i); + + WriteBuf(b, ip, sizeof(IP)); + } + } + FreeHostIPAddressList(ip_list); + + Sha1(hash, b->Buf, b->Size); + + FreeBuf(b); + + Free(product_id); +} + +// Create a pair of pre-bound TCP sockets +bool NewTcpPair(SOCK **s1, SOCK **s2) +{ + SOCK *a; + SOCK *s, *c; + TUBE *t1, *t2; + SOCK_EVENT *e1, *e2; + // Validate arguments + if (s1 == NULL || s2 == NULL) + { + return false; + } + + a = ListenAnyPortEx2(true, true); + if (a == NULL) + { + return false; + } + + c = Connect("127.0.0.1", a->LocalPort); + if (c == NULL) + { + ReleaseSock(a); + return false; + } + + s = Accept(a); + if (s == NULL) + { + ReleaseSock(c); + ReleaseSock(a); + return false; + } + + ReleaseSock(a); + + if ((s->LocalPort != c->RemotePort) || (s->RemotePort != c->LocalPort)) + { + ReleaseSock(s); + ReleaseSock(c); + return false; + } + + NewTubePair(&t1, &t2, sizeof(TCP_PAIR_HEADER)); + + // Creating a socket event + e1 = NewSockEvent(); + e2 = NewSockEvent(); + + SetTubeSockEvent(t1, e1); + SetTubeSockEvent(t2, e2); + + AddRef(t1->Ref); + AddRef(t2->Ref); + s->BulkRecvTube = c->BulkSendTube = t1; + s->BulkSendTube = c->BulkRecvTube = t2; + + ReleaseSockEvent(e1); + ReleaseSockEvent(e2); + + *s1 = s; + *s2 = c; + + return true; +} + +// Listen in any available port +SOCK *ListenAnyPortEx2(bool local_only, bool disable_ca) +{ + UINT i; + SOCK *s; + for (i = 40000; i < 65536; i++) + { + s = ListenEx(i, local_only); + if (s != NULL) + { + return s; + } + } + + return NULL; +} + + +#if OPENSSL_VERSION_NUMBER < 0x10100000L +#define X509_STORE_CTX_get0_cert(o) ((o)->cert) +#endif + +// Verify client SSL certificate during TLS handshake. +// +// (actually, only save the certificate for later authentication in Protocol.c) +int SslCertVerifyCallback(int preverify_ok, X509_STORE_CTX *ctx) +{ + SSL *ssl; + struct SslClientCertInfo *clientcert; + X509 *cert; + + ssl = X509_STORE_CTX_get_ex_data(ctx, SSL_get_ex_data_X509_STORE_CTX_idx()); + clientcert = SSL_get_ex_data(ssl, GetSslClientCertIndex()); + + if (clientcert != NULL) + { + clientcert->PreverifyErr = X509_STORE_CTX_get_error(ctx); + clientcert->PreverifyErrMessage[0] = '\0'; + if (!preverify_ok) + { + const char *msg = X509_verify_cert_error_string(clientcert->PreverifyErr); + StrCpy(clientcert->PreverifyErrMessage, PREVERIFY_ERR_MESSAGE_SIZE, (char *)msg); + Debug("SslCertVerifyCallback preverify error: '%s'\n", msg); + } + else + { + cert = X509_STORE_CTX_get0_cert(ctx); + if (cert != NULL) + { + X *tmpX = X509ToX(cert); // this only wraps cert, but we need to make a copy + if (!CompareX(tmpX, clientcert->X)) + { + X *copyX = CloneX(tmpX); + if (clientcert->X != NULL) + { + FreeX(clientcert->X); + } + clientcert->X = copyX; + } + tmpX->do_not_free = true; // do not release inner X509 object + FreeX(tmpX); + } + } + } + + return 1; /* allow the verification process to continue */ +} + +// Create a new SSL pipe +SSL_PIPE *NewSslPipe(bool server_mode, X *x, K *k, DH_CTX *dh) +{ + return NewSslPipeEx(server_mode, x, k, dh, false, NULL); +} + +// Create a new SSL pipe with extended options +SSL_PIPE *NewSslPipeEx(bool server_mode, X *x, K *k, DH_CTX *dh, bool verify_peer, struct SslClientCertInfo *clientcert) +{ + SSL_PIPE *s; + SSL *ssl; + SSL_CTX *ssl_ctx = NewSSLCtx(server_mode); + + Lock(openssl_lock); + { + if (server_mode) + { +#ifdef SSL_OP_NO_TLSv1_3 + SSL_CTX_set_options(ssl_ctx, SSL_OP_NO_TLSv1_3); // For some reason pppd under linux doesn't like it +#endif + + AddChainSslCertOnDirectory(ssl_ctx); + + if (dh != NULL) + { + SSL_CTX_set_tmp_dh(ssl_ctx, dh->dh); + } + +#if 0 + // Cannot get config +#ifdef SSL_SECOP_VERSION + if (sock->SslAcceptSettings.Override_Security_Level) + { + SSL_CTX_set_security_level(ssl_ctx, sock->SslAcceptSettings.Override_Security_Level_Value); + } +#endif +#endif + } + + if (verify_peer) + { + SSL_CTX_set_verify(ssl_ctx, SSL_VERIFY_PEER, SslCertVerifyCallback); + } + + if (dh != NULL) + { + SSL_CTX_set_options(ssl_ctx, SSL_OP_SINGLE_DH_USE); + } + + if (server_mode == false) + { + SSL_CTX_set_options(ssl_ctx, SSL_OP_DONT_INSERT_EMPTY_FRAGMENTS); + } + + ssl = SSL_new(ssl_ctx); + + SSL_set_ex_data(ssl, GetSslClientCertIndex(), clientcert); + } + Unlock(openssl_lock); + + s = ZeroMalloc(sizeof(SSL_PIPE)); + + s->ssl = ssl; + s->ssl_ctx = ssl_ctx; + s->ServerMode = server_mode; + + s->SslInOut = NewSslBioSsl(); + s->RawIn = NewSslBioMem(); + s->RawOut = NewSslBioMem(); + + if (x != NULL && k != NULL) + { + Lock(openssl_lock); + { + SSL_use_certificate(s->ssl, x->x509); + SSL_use_PrivateKey(s->ssl, k->pkey); + } + Unlock(openssl_lock); + } + + if (s->ServerMode == false) + { + SSL_set_connect_state(s->ssl); + } + else + { + SSL_set_accept_state(s->ssl); + } + + SSL_set_bio(s->ssl, s->RawIn->bio, s->RawOut->bio); + BIO_set_ssl(s->SslInOut->bio, s->ssl, BIO_NOCLOSE); + + //s->RawIn->NoFree = true; + s->RawOut->NoFree = true; + + return s; +} + +// Synchronization of the SSL pipe +bool SyncSslPipe(SSL_PIPE *s) +{ + UINT i; + // Validate arguments + if (s == NULL || s->IsDisconnected) + { + return false; + } + + for (i = 0; i < 2; i++) + { + if (SslBioSync(s->RawIn, true, false) == false) + { + s->IsDisconnected = true; + Debug("SyncSslPipe: s->RawIn error.\n"); + return false; + } + + if (SslBioSync(s->RawOut, false, true) == false) + { + s->IsDisconnected = true; + Debug("SyncSslPipe: s->RawOut error.\n"); + return false; + } + + if (SslBioSync(s->SslInOut, true, true) == false) + { + s->IsDisconnected = true; + Debug("SyncSslPipe: s->SslInOut error.\n"); + return false; + } + } + + return true; +} + +// Release of the SSL pipe +void FreeSslPipe(SSL_PIPE *s) +{ + // Validate arguments + if (s == NULL) + { + return; + } + + FreeSslBio(s->SslInOut); + FreeSslBio(s->RawIn); + FreeSslBio(s->RawOut); + + SSL_free(s->ssl); + SSL_CTX_free(s->ssl_ctx); + + Free(s); +} + +// Release of the SSL BIO +void FreeSslBio(SSL_BIO *b) +{ + // Validate arguments + if (b == NULL) + { + return; + } + + if (b->NoFree == false) + { + BIO_free(b->bio); + } + + ReleaseFifo(b->RecvFifo); + ReleaseFifo(b->SendFifo); + + Free(b); +} + +// Create a new SSL BIO (SSL) +SSL_BIO *NewSslBioSsl() +{ + SSL_BIO *b = ZeroMalloc(sizeof(SSL_BIO)); + + b->bio = BIO_new(BIO_f_ssl()); + + b->RecvFifo = NewFifo(); + b->SendFifo = NewFifo(); + + return b; +} + +// Create a new SSL BIO (memory) +SSL_BIO *NewSslBioMem() +{ + SSL_BIO *b = ZeroMalloc(sizeof(SSL_BIO)); + + b->bio = BIO_new(BIO_s_mem()); + + b->RecvFifo = NewFifo(); + b->SendFifo = NewFifo(); + + return b; +} + +// Synchronize memory contents of the SSL BIO with the FIFO +bool SslBioSync(SSL_BIO *b, bool sync_send, bool sync_recv) +{ + // Validate arguments + if (b == NULL) + { + return false; + } + + if (b->IsDisconnected) + { + return false; + } + + // Write the contents of the SendFifo to the BIO + if (sync_send) + { + while (b->SendFifo->size >= 1) + { + int r = BIO_write(b->bio, GetFifoPointer(b->SendFifo), FifoSize(b->SendFifo)); + + if (r == 0) + { + b->IsDisconnected = true; + WHERE; + return false; + } + else + { + if (r < 0) + { + if (BIO_should_retry(b->bio)) + { + break; + } + else + { + b->IsDisconnected = true; + WHERE; + return false; + } + } + else + { + ReadFifo(b->SendFifo, NULL, (UINT)r); + } + } + } + } + + // Save to the RecvFifo by reading from the BIO + if (sync_recv) + { + while (true) + { + UCHAR tmp[4096]; + int r; + + r = BIO_read(b->bio, tmp, sizeof(tmp)); + + if (r == 0) + { + b->IsDisconnected = true; + WHERE; + return false; + } + else + { + if (r < 0) + { + if (BIO_should_retry(b->bio)) + { + break; + } + else + { + b->IsDisconnected = true; + WHERE; + Debug("OpenSSL Error: %s\n", ERR_error_string(ERR_peek_last_error(), NULL)); + return false; + } + } + else + { + WriteFifo(b->RecvFifo, tmp, (UINT)r); + } + } + } + } + + return true; +} + +// Release the memory for the return value of the ICMP API +void IcmpApiFreeResult(ICMP_RESULT *ret) +{ + // Validate arguments + if (ret == NULL) + { + return; + } + + if (ret->Data != NULL) + { + Free(ret->Data); + } + + Free(ret); +} + +// Send an ICMP Echo using ICMP API +ICMP_RESULT *IcmpApiEchoSend(IP *dest_ip, UCHAR ttl, UCHAR *data, UINT size, UINT timeout) +{ +#ifdef OS_WIN32 + // Validate arguments + if (dest_ip == NULL || IsIP4(dest_ip) == false || (size != 0 && data == NULL)) + { + return NULL; + } + if (ttl == 0) + { + ttl = 127; + } + + if (IsIcmpApiSupported()) + { + HANDLE h; + DWORD dw; + IPAddr dest_addr; + UINT reply_size; + ICMP_ECHO_REPLY *reply; + ICMP_RESULT *ret = NULL; + IP_OPTION_INFORMATION opt; + + h = w32net->IcmpCreateFile(); + + if (h == INVALID_HANDLE_VALUE) + { + return NULL; + } + + Zero(&opt, sizeof(opt)); + opt.Ttl = ttl; + + IPToInAddr((struct in_addr *)&dest_addr, dest_ip); + + reply_size = sizeof(*reply) + size + 64; + reply = ZeroMalloc(reply_size); + + dw = w32net->IcmpSendEcho(h, dest_addr, data, size, &opt, reply, reply_size, timeout); + + ret = ZeroMalloc(sizeof(ICMP_RESULT)); + + if (dw >= 1 && reply->Status == IP_SUCCESS) + { + ret->Ok = true; + } + else + { + switch (reply->Status) + { + case IP_DEST_NET_UNREACHABLE: + ret->Type = ICMP_TYPE_DESTINATION_UNREACHABLE; + ret->Code = ICMP_CODE_NET_UNREACHABLE; + break; + + case IP_DEST_HOST_UNREACHABLE: + ret->Type = ICMP_TYPE_DESTINATION_UNREACHABLE; + ret->Code = ICMP_CODE_HOST_UNREACHABLE; + break; + + case IP_DEST_PROT_UNREACHABLE: + ret->Type = ICMP_TYPE_DESTINATION_UNREACHABLE; + ret->Code = ICMP_CODE_PROTOCOL_UNREACHABLE; + break; + + case IP_DEST_PORT_UNREACHABLE: + ret->Type = ICMP_TYPE_DESTINATION_UNREACHABLE; + ret->Code = ICMP_CODE_PORT_UNREACHABLE; + break; + + case IP_TTL_EXPIRED_TRANSIT: + ret->Type = ICMP_TYPE_TIME_EXCEEDED; + ret->Code = ICMP_CODE_TTL_EXCEEDED_IN_TRANSIT; + break; + + case IP_TTL_EXPIRED_REASSEM: + ret->Type = ICMP_TYPE_TIME_EXCEEDED; + ret->Code = ICMP_CODE_FRAGMENT_REASSEMBLY_TIME_EXCEEDED; + break; + + default: + ret->Timeout = true; + break; + } + } + + if (ret->Timeout == false) + { + ret->Ttl = reply->Options.Ttl; + ret->Rtt = reply->RoundTripTime; + InAddrToIP(&ret->IpAddress, (struct in_addr *)&reply->Address); + + if (reply->DataSize >= 1 && reply->Data != NULL) + { + ret->DataSize = reply->DataSize; + ret->Data = Clone(reply->Data, reply->DataSize); + } + } + + Free(reply); + + w32net->IcmpCloseHandle(h); + + return ret; + } + else + { + return NULL; + } + +#else // OS_WIN32 + return NULL; +#endif // OS_WIN32 +} + +// Detect whether the ICMP API is supported +bool IsIcmpApiSupported() +{ +#ifdef OS_WIN32 + if (w32net->IcmpCloseHandle != NULL && + w32net->IcmpCreateFile != NULL && + w32net->IcmpSendEcho != NULL) + { + return true; + } +#endif // OS_WIN32 + + return false; +} + +// Initialize the routing table change detector +ROUTE_CHANGE *NewRouteChange() +{ +#ifdef OS_WIN32 + return Win32NewRouteChange(); +#else // OS_WIN32 + return NULL; +#endif // OS_WIN32 +} + +// Release the routing table change detector +void FreeRouteChange(ROUTE_CHANGE *r) +{ +#ifdef OS_WIN32 + Win32FreeRouteChange(r); +#endif // OS_WIN32 +} + +// Get whether the routing table has been changed +bool IsRouteChanged(ROUTE_CHANGE *r) +{ +#ifdef OS_WIN32 + return Win32IsRouteChanged(r); +#else // OS_WIN32 + return false; +#endif // OS_WIN32 +} + +// Routing table change detector function (Win32) +#ifdef OS_WIN32 +ROUTE_CHANGE *Win32NewRouteChange() +{ + ROUTE_CHANGE *r; + bool ret; + + if (MsIsNt() == false) + { + return NULL; + } + + if (w32net->CancelIPChangeNotify == NULL || + w32net->NotifyRouteChange == NULL) + { + return NULL; + } + + r = ZeroMalloc(sizeof(ROUTE_CHANGE)); + + r->Data = ZeroMalloc(sizeof(ROUTE_CHANGE_DATA)); + + r->Data->Overlapped.hEvent = CreateEventA(NULL, false, true, NULL); + + ret = w32net->NotifyRouteChange(&r->Data->Handle, &r->Data->Overlapped); + if (!(ret == NO_ERROR || ret == WSA_IO_PENDING || WSAGetLastError() == WSA_IO_PENDING)) + { + Free(r->Data); + Free(r); + + return NULL; + } + + return r; +} + +void Win32FreeRouteChange(ROUTE_CHANGE *r) +{ + // Validate arguments + if (r == NULL) + { + return; + } + + w32net->CancelIPChangeNotify(&r->Data->Overlapped); + CloseHandle(r->Data->Overlapped.hEvent); + + Free(r->Data); + Free(r); +} + +bool Win32IsRouteChanged(ROUTE_CHANGE *r) +{ + // Validate arguments + if (r == NULL) + { + return false; + } + + if ((r->Data->NumCalled++) == 0) + { + return true; + } + + if (WaitForSingleObject(r->Data->Overlapped.hEvent, 0) == WAIT_OBJECT_0) + { + w32net->NotifyRouteChange(&r->Data->Handle, &r->Data->Overlapped); + return true; + } + + return false; +} + +typedef struct WIN32_ACCEPT_CHECK_DATA +{ + bool IsIPv6; + bool Rejected; +} WIN32_ACCEPT_CHECK_DATA; + +int CALLBACK Win32AcceptCheckCallback(LPWSABUF lpCallerId, LPWSABUF lpCallerData, LPQOS pQos, + LPQOS lpGQOS, LPWSABUF lpCalleeId, LPWSABUF lpCalleeData, + GROUP FAR *g, DWORD_PTR dwCallbackData) +{ + return CF_ACCEPT; +} + +// Accept function for Win32 +SOCKET Win32Accept(SOCK *sock, SOCKET s, struct sockaddr *addr, int *addrlen, bool ipv6) +{ + SOCKET ret; + WIN32_ACCEPT_CHECK_DATA d; + UINT err; + int initial_addrlen = *addrlen; + UINT num_error = 0; + UINT zero = 0; + UINT tmp = 0; + UINT ret_size = 0; + // Validate arguments + if (sock == NULL || s == INVALID_SOCKET) + { + return INVALID_SOCKET; + } + + if (sock->hAcceptEvent == NULL) + { + sock->hAcceptEvent = CreateEvent(NULL, FALSE, FALSE, NULL); + + WSAEventSelect(s, sock->hAcceptEvent, FD_ACCEPT | FD_CLOSE); + } + +L_LOOP: + + if (sock->CancelAccept) + { + return INVALID_SOCKET; + } + + Zero(&d, sizeof(d)); + + d.IsIPv6 = ipv6; + + *addrlen = initial_addrlen; + Zero(addr, initial_addrlen); + ret = WSAAccept(s, addr, addrlen, Win32AcceptCheckCallback, (DWORD_PTR)&d); + + if (ret == INVALID_SOCKET) + { + err = WSAGetLastError(); + + if (err == WSAEWOULDBLOCK) + { + //Debug("!!! WSAAccept: WSAEWOULDBLOCK\n"); + UINT wait_ret = WaitForSingleObject(sock->hAcceptEvent, 1234); + + if (wait_ret == WAIT_OBJECT_0 || wait_ret == WAIT_TIMEOUT) + { + goto L_LOOP; + } + + Debug("!!! WaitForSingleObject Error. ret=%u GetLastError=%u\n", wait_ret, GetLastError()); + } + + num_error++; + + Debug("!!! WSAAccept Error: %u rej=%u num=%u tick=%I64u\n", err, d.Rejected, num_error, Tick64()); + + if (d.Rejected && err == WSAECONNREFUSED) + { + goto L_LOOP; + } + + if (err == WSAETIMEDOUT) + { + goto L_LOOP; + } + } + else + { + // Remove a new socket from the event + WSAEventSelect(ret, sock->hAcceptEvent, 0); + + // Restore the new socket to synchronized + WSAIoctl(ret, FIONBIO, &zero, sizeof(zero), &tmp, sizeof(tmp), &ret_size, NULL, NULL); + } + + return ret; +} + +#endif // OS_WIN32 + +#define USE_OLD_GETIP + +// Set the arp_filter in Linux +void SetLinuxArpFilter() +{ + char *filename = "/proc/sys/net/ipv4/conf/all/arp_filter"; + char *data = "1\n"; + IO *o; + + o = FileCreate(filename); + if (o == NULL) + { + return; + } + + FileWrite(o, data, StrLen(data)); + FileFlush(o); + + FileClose(o); +} + +// Determine whether the string is a IPv6 mask +bool IsIpMask6(char *str) +{ + IP mask; + // Validate arguments + if (str == NULL) + { + return false; + } + + return StrToMask6(&mask, str); +} + +// Determine whether the string is a IPv6 address +bool IsStrIPv6Address(char *str) +{ + IP ip; + // Validate arguments + if (str == NULL) + { + return false; + } + + if (StrToIP6(&ip, str) == false) + { + return false; + } + + return true; +} + +// Convert the subnet mask to an integer +UINT SubnetMaskToInt6(IP *a) +{ + UINT i; + // Validate arguments + if (IsIP6(a) == false) + { + return 0; + } + + for (i = 0; i <= 128; i++) + { + IP tmp; + + IntToSubnetMask6(&tmp, i); + + if (CmpIpAddr(a, &tmp) == 0) + { + return i; + } + } + + return 0; +} +UINT SubnetMaskToInt4(IP *a) +{ + UINT i; + // Validate arguments + if (IsIP4(a) == false) + { + return 0; + } + + for (i = 0; i <= 32; i++) + { + IP tmp; + + IntToSubnetMask4(&tmp, i); + + if (CmpIpAddr(a, &tmp) == 0) + { + return i; + } + } + + return 0; +} +UINT SubnetMaskToInt(IP *a) +{ + if (IsIP6(a)) + { + return SubnetMaskToInt6(a); + } + else + { + return SubnetMaskToInt4(a); + } +} + +// Determine whether the specified IP address is a subnet mask +bool IsSubnetMask6(IP *a) +{ + UINT i; + // Validate arguments + if (IsIP6(a) == false) + { + return false; + } + + for (i = 0; i <= 128; i++) + { + IP tmp; + + IntToSubnetMask6(&tmp, i); + + if (CmpIpAddr(a, &tmp) == 0) + { + return true; + } + } + + return false; +} + +// Generate a local address from the MAC address +void GenerateEui64LocalAddress(IP *a, UCHAR *mac) +{ + UCHAR tmp[8]; + // Validate arguments + if (a == NULL || mac == NULL) + { + return; + } + + GenerateEui64Address6(tmp, mac); + + ZeroIP6(a); + a->ipv6_addr[0] = 0xfe; + a->ipv6_addr[1] = 0x80; + + Copy(&a->ipv6_addr[8], tmp, 8); +} + +// Generate the EUI-64 address from the MAC address +void GenerateEui64Address6(UCHAR *dst, UCHAR *mac) +{ + // Validate arguments + if (dst == NULL || mac == NULL) + { + return; + } + + Copy(dst, mac, 3); + Copy(dst + 5, mac, 3); + + dst[3] = 0xff; + dst[4] = 0xfe; + dst[0] = ((~(dst[0] & 0x02)) & 0x02) | (dst[0] & 0xfd); +} + +// Examine whether two IP addresses are in the same network +bool IsInSameNetwork6ByStr(char *ip1, char *ip2, char *subnet) +{ + IP p1, p2, s; + + if (StrToIP6(&p1, ip1) == false) + { + return false; + } + + if (StrToIP6(&p2, ip2) == false) + { + return false; + } + + if (StrToMask6(&s, subnet) == false) + { + return false; + } + + return IsInSameNetwork6(&p1, &p2, &s); +} +bool IsInSameNetwork6(IP *a1, IP *a2, IP *subnet) +{ + IP prefix1, prefix2; + // Validate arguments + if (IsIP6(a1) == false || IsIP6(a2) == false || IsIP6(subnet) == false) + { + return false; + } + + if (a1->ipv6_scope_id != a2->ipv6_scope_id) + { + return false; + } + + GetPrefixAddress6(&prefix1, a1, subnet); + GetPrefixAddress6(&prefix2, a2, subnet); + + if (CmpIpAddr(&prefix1, &prefix2) == 0) + { + return true; + } + + return false; +} +bool IsInSameNetwork4(IP *a1, IP *a2, IP *subnet) +{ + IP net1, net2; + // Validate arguments + if (IsIP4(a1) == false || IsIP4(a2) == false || IsIP4(subnet) == false) + { + return false; + } + + IPAnd4(&net1, a1, subnet); + IPAnd4(&net2, a2, subnet); + + if (CmpIpAddr(&net1, &net2) == 0) + { + return true; + } + + return false; +} +bool IsInSameNetwork4Standard(IP *a1, IP *a2) +{ + IP subnet; + + SetIP(&subnet, 255, 255, 0, 0); + + return IsInSameNetwork4(a1, a2, &subnet); +} + +// Get the prefix address +void GetPrefixAddress6(IP *dst, IP *ip, IP *subnet) +{ + // Validate arguments + if (dst == NULL || ip == NULL || subnet == NULL) + { + return; + } + + IPAnd6(dst, ip, subnet); + + dst->ipv6_scope_id = ip->ipv6_scope_id; +} + +// Get the type of the IPv6 address +UINT GetIPv6AddrType(IPV6_ADDR *addr) +{ + IP ip; + // Validate arguments + if (addr == NULL) + { + return 0; + } + + IPv6AddrToIP(&ip, addr); + + return GetIPAddrType6(&ip); +} +UINT GetIPAddrType6(IP *ip) +{ + UINT ret = 0; + // Validate arguments + if (IsIP6(ip) == false) + { + return 0; + } + + if (ip->ipv6_addr[0] == 0xff) + { + IP all_node, all_router; + + GetAllNodeMulticaseAddress6(&all_node); + + GetAllRouterMulticastAddress6(&all_router); + + ret |= IPV6_ADDR_MULTICAST; + + if (Cmp(ip->ipv6_addr, all_node.ipv6_addr, 16) == 0) + { + ret |= IPV6_ADDR_ALL_NODE_MULTICAST; + } + else if (Cmp(ip->ipv6_addr, all_router.ipv6_addr, 16) == 0) + { + ret |= IPV6_ADDR_ALL_ROUTER_MULTICAST; + } + else + { + if (ip->ipv6_addr[1] == 0x02 && ip->ipv6_addr[2] == 0 && ip->ipv6_addr[3] == 0 && + ip->ipv6_addr[4] == 0 && ip->ipv6_addr[5] == 0 && ip->ipv6_addr[6] == 0 && + ip->ipv6_addr[7] == 0 && ip->ipv6_addr[8] == 0 && ip->ipv6_addr[9] == 0 && + ip->ipv6_addr[10] == 0 && ip->ipv6_addr[11] == 0x01 && ip->ipv6_addr[12] == 0xff) + { + ret |= IPV6_ADDR_SOLICIATION_MULTICAST; + } + } + } + else + { + ret |= IPV6_ADDR_UNICAST; + + if (ip->ipv6_addr[0] == 0xfe && (ip->ipv6_addr[1] & 0xc0) == 0x80) + { + ret |= IPV6_ADDR_LOCAL_UNICAST; + } + else + { + ret |= IPV6_ADDR_GLOBAL_UNICAST; + + if (IsZero(&ip->ipv6_addr, 16)) + { + ret |= IPV6_ADDR_ZERO; + } + else + { + IP loopback; + + GetLoopbackAddress6(&loopback); + + if (Cmp(ip->ipv6_addr, loopback.ipv6_addr, 16) == 0) + { + ret |= IPV6_ADDR_LOOPBACK; + } + } + } + } + + return ret; +} + +// Loopback address +void GetLoopbackAddress6(IP *ip) +{ + // Validate arguments + if (ip == NULL) + { + return; + } + + ZeroIP6(ip); + + ip->ipv6_addr[15] = 0x01; +} + +// All-nodes multicast address +void GetAllNodeMulticaseAddress6(IP *ip) +{ + // Validate arguments + if (ip == NULL) + { + return; + } + + ZeroIP6(ip); + + ip->ipv6_addr[0] = 0xff; + ip->ipv6_addr[1] = 0x02; + ip->ipv6_addr[15] = 0x01; +} + +// All-routers multicast address +void GetAllRouterMulticastAddress6(IP *ip) +{ + // Validate arguments + if (ip == NULL) + { + return; + } + + ZeroIP6(ip); + + ip->ipv6_addr[0] = 0xff; + ip->ipv6_addr[1] = 0x02; + ip->ipv6_addr[15] = 0x02; +} + +// Logical operation of the IPv4 address +void IPAnd4(IP *dst, IP *a, IP *b) +{ + UINT i; + // Validate arguments + if (dst == NULL || a == NULL || b == NULL || IsIP4(a) == false || IsIP4(b) == false) + { + Zero(dst, sizeof(IP)); + return; + } + + i = IPToUINT(a) & IPToUINT(b); + + UINTToIP(dst, i); +} + +// Logical operation of the IPv6 address +void IPAnd6(IP *dst, IP *a, IP *b) +{ + UINT i; + // Validate arguments + if (dst == NULL || IsIP6(a) == false || IsIP6(b) == false) + { + ZeroIP6(dst); + return; + } + + ZeroIP6(dst); + for (i = 0; i < 16; i++) + { + dst->ipv6_addr[i] = a->ipv6_addr[i] & b->ipv6_addr[i]; + } +} + +// Creating a subnet mask +void IntToSubnetMask6(IP *ip, UINT i) +{ + UINT j = i / 8; + UINT k = i % 8; + UINT z; + IP a; + + ZeroIP6(&a); + + for (z = 0; z < 16; z++) + { + if (z < j) + { + a.ipv6_addr[z] = 0xff; + } + else if (z == j) + { + a.ipv6_addr[z] = ~(0xff >> k); + } + } + + Copy(ip, &a, sizeof(IP)); +} + +// Convert the IP address to a string +void IP6AddrToStr(char *str, UINT size, IPV6_ADDR *addr) +{ + // Validate arguments + if (str == NULL || addr == NULL) + { + return; + } + + IPToStr6Array(str, size, addr->Value); +} +void IPToStr6Array(char *str, UINT size, UCHAR *bytes) +{ + IP ip; + // Validate arguments + if (str == NULL || bytes == NULL) + { + return; + } + + SetIP6(&ip, bytes); + + IPToStr6(str, size, &ip); +} +void IPToStr6(char *str, UINT size, IP *ip) +{ + char tmp[MAX_SIZE]; + + IPToStr6Inner(tmp, ip); + + StrCpy(str, size, tmp); +} +void IPToStr6Inner(char *str, IP *ip) +{ + UINT i; + USHORT values[8]; + UINT zero_started_index; + UINT max_zero_len; + UINT max_zero_start; + IP a; + // Validate arguments + if (str == NULL || ip == NULL) + { + return; + } + + Copy(&a, ip, sizeof(IP)); + + for (i = 0; i < 8; i++) + { + Copy(&values[i], &a.ipv6_addr[i * 2], sizeof(USHORT)); + values[i] = Endian16(values[i]); + } + + // Search for omittable part + zero_started_index = INFINITE; + max_zero_len = 0; + max_zero_start = INFINITE; + for (i = 0; i < 9; i++) + { + USHORT v = (i != 8 ? values[i] : 1); + + if (v == 0) + { + if (zero_started_index == INFINITE) + { + zero_started_index = i; + } + } + else + { + UINT zero_len; + + if (zero_started_index != INFINITE) + { + zero_len = i - zero_started_index; + if (zero_len >= 2) + { + if (max_zero_len < zero_len) + { + max_zero_start = zero_started_index; + max_zero_len = zero_len; + } + } + + zero_started_index = INFINITE; + } + } + } + + // Format a string + StrCpy(str, 0, ""); + for (i = 0; i < 8; i++) + { + char tmp[16]; + + ToHex(tmp, values[i]); + StrLower(tmp); + + if (i == max_zero_start) + { + if (i == 0) + { + StrCat(str, 0, "::"); + } + else + { + StrCat(str, 0, ":"); + } + i += max_zero_len - 1; + } + else + { + StrCat(str, 0, tmp); + if (i != 7) + { + StrCat(str, 0, ":"); + } + } + } + + // Scope ID + if (ip->ipv6_scope_id != 0) + { + char tmp[64]; + + StrCat(str, 0, "%"); + ToStr(tmp, ip->ipv6_scope_id); + + StrCat(str, 0, tmp); + } +} + +// Convert the string to an IP address +bool StrToIP6(IP *ip, char *str) +{ + TOKEN_LIST *t; + char tmp[MAX_PATH]; + IP a; + UINT i; + UINT scope_id = 0; + // Validate arguments + if (str == NULL || ip == NULL) + { + return false; + } + + ZeroIP6(&a); + + StrCpy(tmp, sizeof(tmp), str); + Trim(tmp); + + if (StartWith(tmp, "[") && EndWith(tmp, "]")) + { + // If the string is enclosed in square brackets, remove brackets + StrCpyAllowOverlap(tmp, sizeof(tmp), &tmp[1]); + + if (StrLen(tmp) >= 1) + { + tmp[StrLen(tmp) - 1] = 0; + } + } + + // Remove the scope ID by analyzing if there is it + i = SearchStrEx(tmp, "%", 0, false); + if (i != INFINITE) + { + char ss[MAX_PATH]; + + StrCpy(ss, sizeof(ss), &tmp[i + 1]); + + tmp[i] = 0; + + Trim(tmp); + + Trim(ss); + + scope_id = ToInt(ss); + } + + // Tokenize + t = ParseTokenWithNullStr(tmp, ":"); + if (t->NumTokens >= 3 && t->NumTokens <= 8) + { + UINT i, n; + bool b = true; + UINT k = 0; + + n = 0; + + for (i = 0; i < t->NumTokens; i++) + { + char *str = t->Token[i]; + + if (i != 0 && i != (t->NumTokens - 1) && StrLen(str) == 0) + { + n++; + if (n == 1) + { + k += 2 * (8 - t->NumTokens + 1); + } + else + { + b = false; + break; + } + } + else + { + UCHAR chars[2]; + + if (CheckIPItemStr6(str) == false) + { + b = false; + break; + } + + IPItemStrToChars6(chars, str); + + a.ipv6_addr[k++] = chars[0]; + a.ipv6_addr[k++] = chars[1]; + } + } + + if (n != 0 && n != 1) + { + b = false; + } + else if (n == 0 && t->NumTokens != 8) + { + b = false; + } + + if (b == false) + { + FreeToken(t); + return false; + } + } + else + { + FreeToken(t); + return false; + } + + FreeToken(t); + + Copy(ip, &a, sizeof(IP)); + + ip->ipv6_scope_id = scope_id; + + return true; +} +bool StrToIP6Addr(IPV6_ADDR *ip, char *str) +{ + IP ip2; + // Validate arguments + if (ip == NULL || str == NULL) + { + Zero(ip, sizeof(IPV6_ADDR)); + return false; + } + + if (StrToIP6(&ip2, str) == false) + { + return false; + } + + if (IPToIPv6Addr(ip, &ip2) == false) + { + return false; + } + + return true; +} + +// Convert an IP address character to the UCHAR type +void IPItemStrToChars6(UCHAR *chars, char *str) +{ + char tmp[5]; + BUF *b; + UINT len; + // Validate arguments + if (chars == NULL) + { + return; + } + + Zero(tmp, sizeof(tmp)); + + len = StrLen(str); + switch (len) + { + case 0: + tmp[0] = tmp[1] = tmp[2] = tmp[3] = '0'; + break; + + case 1: + tmp[0] = tmp[1] = tmp[2] = '0'; + tmp[3] = str[0]; + break; + + case 2: + tmp[0] = tmp[1] = '0'; + tmp[2] = str[0]; + tmp[3] = str[1]; + break; + + case 3: + tmp[0] = '0'; + tmp[1] = str[0]; + tmp[2] = str[1]; + tmp[3] = str[2]; + break; + + case 4: + tmp[0] = str[0]; + tmp[1] = str[1]; + tmp[2] = str[2]; + tmp[3] = str[3]; + break; + } + + b = StrToBin(tmp); + + chars[0] = ((UCHAR *)b->Buf)[0]; + chars[1] = ((UCHAR *)b->Buf)[1]; + + FreeBuf(b); +} + +// Check whether invalid characters are included in the element string of the IP address +bool CheckIPItemStr6(char *str) +{ + UINT i, len; + // Validate arguments + if (str == NULL) + { + return false; + } + + len = StrLen(str); + if (len >= 5) + { + // Invalid length + return false; + } + + for (i = 0; i < len; i++) + { + char c = str[i]; + + if ((c >= 'a' && c <= 'f') || + (c >= 'A' && c <= 'F') || + (c >= '0' && c <= '9')) + { + } + else + { + return false; + } + } + + return true; +} + +// Create an IPv4 address of all zero +void ZeroIP4(IP *ip) +{ + // Validate arguments + if (ip == NULL) + { + return; + } + + Zero(ip, sizeof(IP)); +} + +// Create an IPv6 address of all zero +void ZeroIP6(IP *ip) +{ + // Validate arguments + if (ip == NULL) + { + return; + } + + SetIP6(ip, NULL); +} + +// Get the IP address of the localhost +void GetLocalHostIP6(IP *ip) +{ + // Validate arguments + if (ip == NULL) + { + return; + } + ZeroIP6(ip); + + ip->ipv6_addr[15] = 1; +} +void GetLocalHostIP4(IP *ip) +{ + // Validate arguments + if (ip == NULL) + { + return; + } + + SetIP(ip, 127, 0, 0, 1); +} + +// Check whether the specified address is a localhost +bool IsLocalHostIP6(IP *ip) +{ + IP local; + // Validate arguments + if (ip == NULL) + { + return false; + } + if (IsIP6(ip) == false) + { + return false; + } + + GetLocalHostIP6(&local); + + if (CmpIpAddr(&local, ip) == 0) + { + return true; + } + + return false; +} +bool IsLocalHostIP4(IP *ip) +{ + // Validate arguments + if (ip == NULL) + { + return false; + } + if (IsIP4(ip) == false) + { + return false; + } + + if (ip->addr[0] == 127) + { + return true; + } + + return false; +} +bool IsLocalHostIP(IP *ip) +{ + // Validate arguments + if (ip == NULL) + { + return false; + } + + if (IsIP4(ip)) + { + return IsLocalHostIP4(ip); + } + else + { + return IsLocalHostIP6(ip); + } +} + +// Convert the IPV6_ADDR to an IP +void IPv6AddrToIP(IP *ip, IPV6_ADDR *addr) +{ + // Validate arguments + if (ip == NULL || addr == NULL) + { + return; + } + + SetIP6(ip, addr->Value); +} + +// Convert the IP to an IPV6_ADDR +bool IPToIPv6Addr(IPV6_ADDR *addr, IP *ip) +{ + UINT i; + // Validate arguments + if (addr == NULL || ip == NULL) + { + Zero(addr, sizeof(IPV6_ADDR)); + return false; + } + + if (IsIP6(ip) == false) + { + Zero(addr, sizeof(IPV6_ADDR)); + return false; + } + + for (i = 0; i < 16; i++) + { + addr->Value[i] = ip->ipv6_addr[i]; + } + + return true; +} + +// Set an IPv6 address +void SetIP6(IP *ip, UCHAR *value) +{ + // Validate arguments + if (ip == NULL) + { + return; + } + + Zero(ip, sizeof(IP)); + + ip->addr[0] = 192; + ip->addr[1] = 0; + ip->addr[2] = 2; + ip->addr[3] = 254; + + if (value != NULL) + { + UINT i; + + for (i = 0; i < 16; i++) + { + ip->ipv6_addr[i] = value[i]; + } + } +} + +// Check whether the specified address is a IPv6 address +bool IsIP6(IP *ip) +{ + // Validate arguments + if (ip == NULL) + { + return false; + } + + if (ip->addr[0] == 192 && ip->addr[1] == 0 && ip->addr[2] == 2 && ip->addr[3] == 254) + { + return true; + } + + return false; +} +bool IsIP4(IP *ip) +{ + // Validate arguments + if (ip == NULL) + { + return false; + } + + return (IsIP6(ip) ? false : true); +} + +// Copy the IP address +void CopyIP(IP *dst, IP *src) +{ + Copy(dst, src, sizeof(IP)); +} + +// Utility functions about IP and MAC address types +// Identify whether the IP address is a normal unicast address +bool IsValidUnicastIPAddress4(IP *ip) +{ + UINT i; + // Validate arguments + if (IsIP4(ip) == false) + { + return false; + } + + if (IsZeroIP(ip)) + { + return false; + } + + if (ip->addr[0] >= 224 && ip->addr[0] <= 239) + { + // IPv4 Multicast + return false; + } + + + /// TODO: this is kinda incorrect, but for the correct parsing we need the netmask anyway + for (i = 0; i < 4; i++) + { + if (ip->addr[i] != 255) + { + return true; + } + } + + return false; +} +bool IsValidUnicastIPAddressUINT4(UINT ip) +{ + IP a; + + UINTToIP(&a, ip); + + return IsValidUnicastIPAddress4(&a); +} + +bool IsValidUnicastIPAddress6(IP *ip) +{ + UINT ipv6Type; + + if (!IsIP6(ip)) + { + return false; + } + + if (IsZeroIP(ip)) + { + return false; + } + + ipv6Type = GetIPAddrType6(ip); + + if (!(ipv6Type & IPV6_ADDR_LOCAL_UNICAST) && + !(ipv6Type & IPV6_ADDR_GLOBAL_UNICAST)) + { + return false; + } + + return true; +} + +// Check whether the MAC address is valid +bool IsMacInvalid(UCHAR *mac) +{ + UINT i; + // Validate arguments + if (mac == NULL) + { + return false; + } + + for (i = 0; i < 6; i++) + { + if (mac[i] != 0x00) + { + return false; + } + } + return true; +} + +// Check whether the MAC address is a broadcast address +bool IsMacBroadcast(UCHAR *mac) +{ + UINT i; + // Validate arguments + if (mac == NULL) + { + return false; + } + + for (i = 0; i < 6; i++) + { + if (mac[i] != 0xff) + { + return false; + } + } + return true; +} + +// Check wether the MAC address is an IPv4 multicast or an IPv6 multicast +bool IsMacMulticast(UCHAR *mac) +{ + // Validate arguments + if (mac == NULL) + { + return false; + } + + if (mac[0] == 0x01 && + mac[1] == 0x00 && + mac[2] == 0x5e) + { + // Multicast IPv4 and other IANA multicasts + return true; + } + + if (mac[0] == 0x01) + { + // That's not a really reserved for multicast range, but it seems like anything with 0x01 is used as multicast anyway + // Remove or specify if it causes problems + return true; + } + + if (mac[0] == 0x33 && + mac[1] == 0x33) + { + // Multicast IPv6 + return true; + } + + return false; +} + +// Check wether the MAC address is a unicast one +bool IsMacUnicast(UCHAR *mac) +{ + // Validate arguments + if (mac == NULL) + { + return false; + } + + if (IsMacInvalid(mac)) + { + return false; + } + + if (IsMacBroadcast(mac)) + { + return false; + } + + if (IsMacMulticast(mac)) + { + return false; + } + + return true; +} + +// Get the number of clients connected from the specified IP address +UINT GetNumIpClient(IP *ip) +{ + IP_CLIENT *c; + UINT ret = 0; + // Validate arguments + if (ip == NULL) + { + return 0; + } + + LockList(ip_clients); + { + c = SearchIpClient(ip); + + if (c != NULL) + { + ret = c->NumConnections; + } + } + UnlockList(ip_clients); + + return ret; +} + +// Add to the IP client entry +void AddIpClient(IP *ip) +{ + IP_CLIENT *c; + // Validate arguments + if (ip == NULL) + { + return; + } + + LockList(ip_clients); + { + c = SearchIpClient(ip); + + if (c == NULL) + { + c = ZeroMallocFast(sizeof(IP_CLIENT)); + Copy(&c->IpAddress, ip, sizeof(IP)); + c->NumConnections = 0; + + Add(ip_clients, c); + } + + c->NumConnections++; + } + UnlockList(ip_clients); + + //Debug("AddIpClient: %r\n", ip); +} + +// Remove from the IP client list +void DelIpClient(IP *ip) +{ + IP_CLIENT *c; + // Validate arguments + if (ip == NULL) + { + return; + } + + LockList(ip_clients); + { + c = SearchIpClient(ip); + + if (c != NULL) + { + c->NumConnections--; + + if (c->NumConnections == 0) + { + Delete(ip_clients, c); + Free(c); + } + } + } + UnlockList(ip_clients); + + //Debug("DelIpClient: %r\n", ip); +} + +// Search for the IP client entry +IP_CLIENT *SearchIpClient(IP *ip) +{ + IP_CLIENT t; + // Validate arguments + if (ip == NULL) + { + return NULL; + } + + Zero(&t, sizeof(t)); + Copy(&t.IpAddress, ip, sizeof(IP)); + + return Search(ip_clients, &t); +} + +// Initialization of the client list +void InitIpClientList() +{ + ip_clients = NewList(CompareIpClientList); +} + +// Release of the client list +void FreeIpClientList() +{ + UINT i; + + for (i = 0; i < LIST_NUM(ip_clients); i++) + { + IP_CLIENT *c = LIST_DATA(ip_clients, i); + + Free(c); + } + + ReleaseList(ip_clients); + ip_clients = NULL; +} + +// Comparison of the client list entries +int CompareIpClientList(void *p1, void *p2) +{ + IP_CLIENT *c1, *c2; + if (p1 == NULL || p2 == NULL) + { + return 0; + } + c1 = *(IP_CLIENT **)p1; + c2 = *(IP_CLIENT **)p2; + if (c1 == NULL || c2 == NULL) + { + return 0; + } + + return CmpIpAddr(&c1->IpAddress, &c2->IpAddress); +} + +// Normalization of the MAC address +bool NormalizeMacAddress(char *dst, UINT size, char *src) +{ + BUF *b; + bool ret = false; + // Validate arguments + if (dst == NULL || src == NULL) + { + return false; + } + + b = StrToBin(src); + + if (b != NULL && b->Size == 6) + { + ret = true; + + BinToStr(dst, size, b->Buf, b->Size); + } + + FreeBuf(b); + + return ret; +} + +// Identify whether the IP address is empty +bool IsZeroIP(IP *ip) +{ + return IsZeroIp(ip); +} +bool IsZeroIp(IP *ip) +{ + // Validate arguments + if (ip == NULL) + { + return true; + } + + if (IsIP6(ip) == false) + { + return IsZero(ip->addr, sizeof(ip->addr)); + } + else + { + return IsZero(ip->ipv6_addr, sizeof(ip->ipv6_addr)); + } +} +bool IsZeroIP6Addr(IPV6_ADDR *addr) +{ + // Validate arguments + if (addr == NULL) + { + return true; + } + + return IsZero(addr, sizeof(IPV6_ADDR)); +} + +// Examine whether the specified IP address is meaningful as a host +bool IsHostIPAddress4(IP *ip) +{ + UINT a; + // Validate arguments + if (ip == NULL) + { + return false; + } + + a = IPToUINT(ip); + + if (a == 0 || a == 0xffffffff) + { + return false; + } + + return true; +} +bool IsHostIPAddress32(UINT ip) +{ + IP p; + + UINTToIP(&p, ip); + + return IsHostIPAddress4(&p); +} + +// Check whether the specified IP address and subnet mask indicates a network correctly +bool IsNetworkAddress4(IP *ip, IP *mask) +{ + UINT a, b; + // Validate arguments + if (ip == NULL || mask == NULL) + { + return false; + } + + if (IsIP4(ip) == false || IsIP4(mask) == false) + { + return false; + } + + if (IsSubnetMask4(mask) == false) + { + return false; + } + + a = IPToUINT(ip); + b = IPToUINT(mask); + + if ((a & b) == a) + { + return true; + } + + return false; +} +bool IsNetworkAddress32(UINT ip, UINT mask) +{ + IP a, b; + + UINTToIP(&a, ip); + UINTToIP(&b, mask); + + return IsNetworkAddress4(&a, &b); +} + +// Convert the integer to a subnet mask +UINT IntToSubnetMask32(UINT i) +{ + UINT ret = 0xFFFFFFFF; + + switch (i) + { + case 0: + ret = 0x00000000; + break; + case 1: + ret = 0x80000000; + break; + case 2: + ret = 0xC0000000; + break; + case 3: + ret = 0xE0000000; + break; + case 4: + ret = 0xF0000000; + break; + case 5: + ret = 0xF8000000; + break; + case 6: + ret = 0xFC000000; + break; + case 7: + ret = 0xFE000000; + break; + case 8: + ret = 0xFF000000; + break; + case 9: + ret = 0xFF800000; + break; + case 10: + ret = 0xFFC00000; + break; + case 11: + ret = 0xFFE00000; + break; + case 12: + ret = 0xFFF00000; + break; + case 13: + ret = 0xFFF80000; + break; + case 14: + ret = 0xFFFC0000; + break; + case 15: + ret = 0xFFFE0000; + break; + case 16: + ret = 0xFFFF0000; + break; + case 17: + ret = 0xFFFF8000; + break; + case 18: + ret = 0xFFFFC000; + break; + case 19: + ret = 0xFFFFE000; + break; + case 20: + ret = 0xFFFFF000; + break; + case 21: + ret = 0xFFFFF800; + break; + case 22: + ret = 0xFFFFFC00; + break; + case 23: + ret = 0xFFFFFE00; + break; + case 24: + ret = 0xFFFFFF00; + break; + case 25: + ret = 0xFFFFFF80; + break; + case 26: + ret = 0xFFFFFFC0; + break; + case 27: + ret = 0xFFFFFFE0; + break; + case 28: + ret = 0xFFFFFFF0; + break; + case 29: + ret = 0xFFFFFFF8; + break; + case 30: + ret = 0xFFFFFFFC; + break; + case 31: + ret = 0xFFFFFFFE; + break; + case 32: + ret = 0xFFFFFFFF; + break; + } + + if (IsLittleEndian()) + { + ret = Swap32(ret); + } + + return ret; +} +void IntToSubnetMask4(IP *ip, UINT i) +{ + UINT m; + // Validate arguments + if (ip == NULL) + { + return; + } + + m = IntToSubnetMask32(i); + + UINTToIP(ip, m); +} + +// Examine whether the specified IP address is a subnet mask +bool IsSubnetMask(IP *ip) +{ + if (IsIP6(ip)) + { + return IsSubnetMask6(ip); + } + else + { + return IsSubnetMask4(ip); + } +} +bool IsSubnetMask4(IP *ip) +{ + UINT i; + // Validate arguments + if (ip == NULL) + { + return false; + } + + if (IsIP6(ip)) + { + return false; + } + + i = IPToUINT(ip); + + if (IsLittleEndian()) + { + i = Swap32(i); + } + + switch (i) + { + case 0x00000000: + case 0x80000000: + case 0xC0000000: + case 0xE0000000: + case 0xF0000000: + case 0xF8000000: + case 0xFC000000: + case 0xFE000000: + case 0xFF000000: + case 0xFF800000: + case 0xFFC00000: + case 0xFFE00000: + case 0xFFF00000: + case 0xFFF80000: + case 0xFFFC0000: + case 0xFFFE0000: + case 0xFFFF0000: + case 0xFFFF8000: + case 0xFFFFC000: + case 0xFFFFE000: + case 0xFFFFF000: + case 0xFFFFF800: + case 0xFFFFFC00: + case 0xFFFFFE00: + case 0xFFFFFF00: + case 0xFFFFFF80: + case 0xFFFFFFC0: + case 0xFFFFFFE0: + case 0xFFFFFFF0: + case 0xFFFFFFF8: + case 0xFFFFFFFC: + case 0xFFFFFFFE: + case 0xFFFFFFFF: + return true; + } + + return false; +} +bool IsSubnetMask32(UINT ip) +{ + IP p; + + UINTToIP(&p, ip); + + return IsSubnetMask4(&p); +} + +#ifdef OS_UNIX // Code for UNIX + +// Turn on and off the non-blocking mode of the socket +void UnixSetSocketNonBlockingMode(int fd, bool nonblock) +{ + UINT flag = 0; + // Validate arguments + if (fd == INVALID_SOCKET) + { + return; + } + + if (nonblock) + { + flag = 1; + } + +#ifdef FIONBIO + ioctl(fd, FIONBIO, &flag); +#else // FIONBIO + { + int flag = fcntl(fd, F_GETFL, 0); + if (flag != -1) + { + if (nonblock) + { + flag |= O_NONBLOCK; + } + else + { + flag = flag & ~O_NONBLOCK; + + fcntl(fd, F_SETFL, flag); + } + } + } +#endif // FIONBIO +} + +// Do Nothing +ROUTE_TABLE *UnixGetRouteTable() +{ + ROUTE_TABLE *ret = ZeroMalloc(sizeof(ROUTE_TABLE)); + ret->NumEntry = 0; + ret->Entry = ZeroMalloc(0); + + return ret; +} + +// Do Nothing +bool UnixAddRouteEntry(ROUTE_ENTRY *e, bool *already_exists) +{ + return true; +} + +// Do Nothing +void UnixDeleteRouteEntry(ROUTE_ENTRY *e) +{ + return; +} + +// Do Nothing +UINT UnixGetVLanInterfaceID(char *instance_name) +{ + return 1; +} + +// Do Nothing +char **UnixEnumVLan(char *tag_name) +{ + char **list; + + list = ZeroMalloc(sizeof(char *)); + + return list; +} + +// Get the IP address of the default DNS server +bool UnixGetDefaultDns(IP *ip) +{ + BUF *b; + // Validate arguments + if (ip == NULL) + { + return false; + } + + Lock(unix_dns_server_addr_lock); + { + if (IsZero(&unix_dns_server, sizeof(IP)) == false) + { + Copy(ip, &unix_dns_server, sizeof(IP)); + Unlock(unix_dns_server_addr_lock); + return true; + } + + ip->addr[0] = 127; + ip->addr[1] = 0; + ip->addr[2] = 0; + ip->addr[3] = 1; + + b = ReadDump("/etc/resolv.conf"); + if (b != NULL) + { + char *s; + bool f = false; + while ((s = CfgReadNextLine(b)) != NULL) + { + TOKEN_LIST *t = ParseToken(s, "\" \t,"); + if (t->NumTokens == 2) + { + if (StrCmpi(t->Token[0], "nameserver") == 0) + { + StrToIP(ip, t->Token[1]); + f = true; + } + } + FreeToken(t); + + Free(s); + + if (f) + { + break; + } + } + FreeBuf(b); + } + Copy(&unix_dns_server, ip, sizeof(IP)); + } + Unlock(unix_dns_server_addr_lock); + + return true; +} + + +// Select procedure +void UnixSelect(SOCKSET *set, UINT timeout, CANCEL *c1, CANCEL *c2) +{ + UINT reads[MAXIMUM_WAIT_OBJECTS]; + UINT writes[MAXIMUM_WAIT_OBJECTS]; + UINT num_read, num_write, i; + UINT p1, p2; + SOCK_EVENT *sock_events[MAXIMUM_WAIT_OBJECTS]; + UINT num_sock_events; + SOCK *s; + UCHAR tmp[MAX_SIZE]; + int ret; + bool any_of_tubes_are_readable = false; + // Initialization of array + Zero(reads, sizeof(reads)); + Zero(writes, sizeof(writes)); + Zero(sock_events, sizeof(sock_events)); + num_read = num_write = num_sock_events = 0; + + // Setting the event array + if (set != NULL) + { + for (i = 0; i < set->NumSocket; i++) + { + s = set->Sock[i]; + if (s != NULL) + { + UnixInitAsyncSocket(s); + if (s->Type == SOCK_INPROC) + { + TUBE *t = s->RecvTube; + if (t != NULL) + { + reads[num_read++] = t->SockEvent->pipe_read; + + sock_events[num_sock_events++] = t->SockEvent; + + if (t->SockEvent->current_pipe_data != 0) + { + any_of_tubes_are_readable = true; + } + } + } + else + { + if (s->NoNeedToRead == false) + { + reads[num_read++] = s->socket; + } + } + + if (s->BulkRecvTube != NULL) + { + TUBE *t = s->BulkRecvTube; + if (t != NULL) + { + reads[num_read++] = t->SockEvent->pipe_read; + + sock_events[num_sock_events++] = t->SockEvent; + + if (t->SockEvent->current_pipe_data != 0) + { + any_of_tubes_are_readable = true; + } + } + } + + if (s->WriteBlocked) + { + writes[num_write++] = s->socket; + } + } + } + } + + if (timeout == 0) + { + return; + } + + p1 = p2 = -1; + + if (c1 != NULL) + { + reads[num_read++] = p1 = c1->pipe_read; + + if (c1->SpecialFlag) + { + if (c1->pipe_special_read2 != -1 && c1->pipe_special_read2 != 0) + { + reads[num_read++] = c1->pipe_special_read2; + } + + if (c1->pipe_special_read3 != -1 && c1->pipe_special_read3 != 0) + { + reads[num_read++] = c1->pipe_special_read3; + } + } + } + if (c2 != NULL) + { + reads[num_read++] = p2 = c2->pipe_read; + + if (c2->SpecialFlag) + { + if (c2->pipe_special_read2 != -1 && c2->pipe_special_read2 != 0) + { + reads[num_read++] = c2->pipe_special_read2; + } + + if (c2->pipe_special_read3 != -1 && c2->pipe_special_read3 != 0) + { + reads[num_read++] = c2->pipe_special_read3; + } + } + } + + // Call the select + if (any_of_tubes_are_readable == false) + { + UnixSelectInner(num_read, reads, num_write, writes, timeout); + } + + // Read from the pipe + if (c1 != NULL && c1->SpecialFlag == false && p1 != -1) + { + do + { + ret = read(p1, tmp, sizeof(tmp)); + } + while (ret >= 1); + } + if (c2 != NULL && c2->SpecialFlag == false && p2 != -1) + { + do + { + ret = read(p2, tmp, sizeof(tmp)); + } + while (ret >= 1); + } + + // Read from the pipe of sockevent + for (i = 0; i < num_sock_events; i++) + { + SOCK_EVENT *e = sock_events[i]; + + e->current_pipe_data = 0; + + do + { + ret = read(e->pipe_read, tmp, sizeof(tmp)); + } + while (ret >= 1); + } +} + +// Cancel +void UnixCancel(CANCEL *c) +{ + // Validate arguments + if (c == NULL) + { + return; + } + + UnixWritePipe(c->pipe_write); +} + +// Release of the cancel object +void UnixCleanupCancel(CANCEL *c) +{ + // Validate arguments + if (c == NULL) + { + return; + } + + if (c->SpecialFlag == false) + { + UnixDeletePipe(c->pipe_read, c->pipe_write); + } + + Free(c); +} + +// Creating a new cancel object +CANCEL *UnixNewCancel() +{ + CANCEL *c = ZeroMallocFast(sizeof(CANCEL)); + + c->ref = NewRef(); + c->SpecialFlag = false; + + UnixNewPipe(&c->pipe_read, &c->pipe_write); + + c->pipe_special_read2 = c->pipe_special_read3 = -1; + + return c; +} + +// Add the socket to the socket event +void UnixJoinSockToSockEvent(SOCK *sock, SOCK_EVENT *event) +{ + // Validate arguments + if (sock == NULL || event == NULL || sock->AsyncMode) + { + return; + } + if (sock->ListenMode != false || (sock->Type == SOCK_TCP && sock->Connected == false)) + { + return; + } + + sock->AsyncMode = true; + + LockList(event->SockList); + { + Add(event->SockList, sock); + AddRef(sock->ref); + } + UnlockList(event->SockList); + + // Make the socket asynchronous mode + if (sock->Type != SOCK_INPROC) + { + UnixSetSocketNonBlockingMode(sock->socket, true); + } + + // Increase the reference count of the SOCK_EVENT + AddRef(event->ref); + sock->SockEvent = event; + + // Set the socket event + SetSockEvent(event); +} + +// Wait for a socket event +bool UnixWaitSockEvent(SOCK_EVENT *event, UINT timeout) +{ + UINT num_read, num_write; + UINT *reads, *writes; + UINT n; + char tmp[MAX_SIZE]; + int readret = 0; + bool event_pipe_is_readable = false; + // Validate arguments + if (event == NULL) + { + return false; + } + + LockList(event->SockList); + { + UINT i; + reads = ZeroMallocFast(sizeof(SOCK *) * (LIST_NUM(event->SockList) + 1)); + + num_write = 0; + num_read = 0; + + for (i = 0; i < LIST_NUM(event->SockList); i++) + { + SOCK *s = LIST_DATA(event->SockList, i); + + if (s->NoNeedToRead == false) + { + reads[num_read++] = s->socket; + } + + if (s->WriteBlocked) + { + num_write++; + } + } + + reads[num_read++] = event->pipe_read; + + if (event->current_pipe_data != 0) + { + event_pipe_is_readable = true; + } + + writes = ZeroMallocFast(sizeof(SOCK *) * num_write); + + n = 0; + + for (i = 0; i < (num_read - 1); i++) + { + SOCK *s = LIST_DATA(event->SockList, i); + if (s->WriteBlocked) + { + writes[n++] = s->socket; + } + } + } + UnlockList(event->SockList); + + if (event_pipe_is_readable == false) + { + UnixSelectInner(num_read, reads, num_write, writes, timeout); + } + + event->current_pipe_data = 0; + do + { + readret = read(event->pipe_read, tmp, sizeof(tmp)); + } + while (readret >= 1); + + Free(reads); + Free(writes); + + return true; +} + +// Set the socket event +void UnixSetSockEvent(SOCK_EVENT *event) +{ + // Validate arguments + if (event == NULL) + { + return; + } + + if (event->current_pipe_data <= 100) + { + UnixWritePipe(event->pipe_write); + event->current_pipe_data++; + } +} + +// This is a helper function for select() +int safe_fd_set(int fd, fd_set *fds, int *max_fd) { + FD_SET(fd, fds); + if (fd > *max_fd) { + *max_fd = fd; + } + return 0; +} + +// Execute 'select' for the socket +void UnixSelectInner(UINT num_read, UINT *reads, UINT num_write, UINT *writes, UINT timeout) +{ +#ifdef UNIX_MACOS + fd_set rfds; //read descriptors + fd_set wfds; //write descriptors + int max_fd = 0; //maximum descriptor id + struct timeval tv; //timeval for timeout +#else // UNIX_MACOS + struct pollfd *p; +#endif // UNIX_MACOS + UINT num; + UINT i; + UINT n; + UINT num_read_total, num_write_total; + + if (num_read != 0 && reads == NULL) + { + num_read = 0; + } + if (num_write != 0 && writes == NULL) + { + num_write = 0; + } + + if (timeout == 0) + { + return; + } + + num_read_total = num_write_total = 0; + for (i = 0; i < num_read; i++) + { + if (reads[i] != INVALID_SOCKET) + { + num_read_total++; + } + } + for (i = 0; i < num_write; i++) + { + if (writes[i] != INVALID_SOCKET) + { + num_write_total++; + } + } + + num = num_read_total + num_write_total; +#ifdef UNIX_MACOS + FD_ZERO(&rfds); //zero out descriptor set for read descriptors + FD_ZERO(&wfds); //same for write +#else // UNIX_MACOS + p = ZeroMallocFast(sizeof(struct pollfd) * num); +#endif // UNIX_MACOS + + n = 0; + + for (i = 0; i < num_read; i++) + { + if (reads[i] != INVALID_SOCKET) + { +#ifdef UNIX_MACOS + safe_fd_set(reads[i], &rfds, &max_fd); +#else // UNIX_MACOS + struct pollfd *pfd = &p[n++]; + pfd->fd = reads[i]; + pfd->events = POLLIN | POLLPRI | POLLERR | POLLHUP; +#endif // UNIX_MACOS + } + } + + for (i = 0; i < num_write; i++) + { + if (writes[i] != INVALID_SOCKET) + { +#ifdef UNIX_MACOS + safe_fd_set(writes[i], &wfds, &max_fd); +#else // UNIX_MACOS + struct pollfd *pfd = &p[n++]; + pfd->fd = writes[i]; + pfd->events = POLLIN | POLLPRI | POLLERR | POLLHUP | POLLOUT; +#endif // UNIX_MACOS + } + } + + if (num != 0) + { +#ifdef UNIX_MACOS + tv.tv_sec = timeout / 1000; + tv.tv_usec = (timeout % 1000) * 1000l; + select(max_fd + 1, &rfds, &wfds, NULL, timeout == INFINITE ? NULL : &tv); +#else // UNIX_MACOS + (void)poll(p, num, timeout == INFINITE ? -1 : (int)timeout); +#endif // UNIX_MACOS + } + else + { + SleepThread(timeout); + } + +#ifndef UNIX_MACOS + Free(p); +#endif // not UNIX_MACOS +} + +// Clean-up of the socket event +void UnixCleanupSockEvent(SOCK_EVENT *event) +{ + UINT i; + // Validate arguments + if (event == NULL) + { + return; + } + + for (i = 0; i < LIST_NUM(event->SockList); i++) + { + SOCK *s = LIST_DATA(event->SockList, i); + + ReleaseSock(s); + } + + ReleaseList(event->SockList); + + UnixDeletePipe(event->pipe_read, event->pipe_write); + + Free(event); +} + +// Create a socket event +SOCK_EVENT *UnixNewSockEvent() +{ + SOCK_EVENT *e = ZeroMallocFast(sizeof(SOCK_EVENT)); + + e->SockList = NewList(NULL); + e->ref = NewRef(); + + UnixNewPipe(&e->pipe_read, &e->pipe_write); + + return e; +} + +// Close the pipe +void UnixDeletePipe(int p1, int p2) +{ + if (p1 != -1) + { + close(p1); + } + + if (p2 != -1) + { + close(p2); + } +} + +// Write to the pipe +void UnixWritePipe(int pipe_write) +{ + char c = 1; + write(pipe_write, &c, 1); +} + +// Create a new pipe +void UnixNewPipe(int *pipe_read, int *pipe_write) +{ + int fd[2]; + // Validate arguments + if (pipe_read == NULL || pipe_write == NULL) + { + return; + } + + fd[0] = fd[1] = 0; + + pipe(fd); + + *pipe_read = fd[0]; + *pipe_write = fd[1]; + + UnixSetSocketNonBlockingMode(*pipe_write, true); + UnixSetSocketNonBlockingMode(*pipe_read, true); +} + +// Release the asynchronous socket +void UnixFreeAsyncSocket(SOCK *sock) +{ + UINT p; + // Validate arguments + if (sock == NULL) + { + return; + } + + Lock(sock->lock); + { + if (sock->AsyncMode == false) + { + Unlock(sock->lock); + return; + } + + sock->AsyncMode = false; + + // Examine whether this socket are associated to SockEvent + if (sock->SockEvent != NULL) + { + SOCK_EVENT *e = sock->SockEvent; + + AddRef(e->ref); + + p = e->pipe_write; + LockList(e->SockList); + { + if (Delete(e->SockList, sock)) + { + ReleaseSock(sock); + } + } + UnlockList(e->SockList); + + // Release the socket event + ReleaseSockEvent(sock->SockEvent); + sock->SockEvent = NULL; + + SetSockEvent(e); + + ReleaseSockEvent(e); + } + } + Unlock(sock->lock); +} + +// Set the socket to asynchronous mode +void UnixInitAsyncSocket(SOCK *sock) +{ + // Validate arguments + if (sock == NULL) + { + return; + } + if (sock->AsyncMode) + { + // The socket has been set in asynchronous mode already + return; + } + if (sock->ListenMode != false || ((sock->Type == SOCK_TCP || sock->Type == SOCK_INPROC) && sock->Connected == false)) + { + return; + } + + sock->AsyncMode = true; + + if (sock->Type != SOCK_INPROC) + { + UnixSetSocketNonBlockingMode(sock->socket, true); + } + +#if OPENSSL_VERSION_NUMBER < 0x10100000L + if (sock->ssl != NULL && sock->ssl->s3 != NULL) + { + sock->Ssl_Init_Async_SendAlert[0] = sock->ssl->s3->send_alert[0]; + sock->Ssl_Init_Async_SendAlert[1] = sock->ssl->s3->send_alert[1]; + } +#endif +} + +// Initializing the socket library +void UnixInitSocketLibrary() +{ + // Do not do anything special +} + +// Release of the socket library +void UnixFreeSocketLibrary() +{ + // Do not do anything special +} + +#endif // OS_UNIX + +#ifdef OS_WIN32 // Code for Windows + +NETWORK_WIN32_FUNCTIONS *w32net; + +// Comparison of IP_ADAPTER_INDEX_MAP +int CompareIpAdapterIndexMap(void *p1, void *p2) +{ + IP_ADAPTER_INDEX_MAP *a1, *a2; + if (p1 == NULL || p2 == NULL) + { + return 0; + } + a1 = *(IP_ADAPTER_INDEX_MAP **)p1; + a2 = *(IP_ADAPTER_INDEX_MAP **)p2; + if (a1 == NULL || a2 == NULL) + { + return 0; + } + + if (a1->Index > a2->Index) + { + return 1; + } + else if (a1->Index < a2->Index) + { + return -1; + } + else + { + return 0; + } +} + +// Update the IP address of the adapter +bool Win32RenewAddressByGuid(char *guid) +{ + IP_ADAPTER_INDEX_MAP a; + // Validate arguments + if (guid == NULL) + { + return false; + } + + Zero(&a, sizeof(a)); + if (Win32GetAdapterFromGuid(&a, guid) == false) + { + return false; + } + + return Win32RenewAddress(&a); +} +bool Win32RenewAddress(void *a) +{ + DWORD ret; + // Validate arguments + if (a == NULL) + { + return false; + } + if (w32net->IpRenewAddress == NULL) + { + return false; + } + + ret = w32net->IpRenewAddress(a); + + if (ret == NO_ERROR) + { + return true; + } + else + { + Debug("IpRenewAddress: Error: %u\n", ret); + return false; + } +} + +// Release the IP address of the adapter +bool Win32ReleaseAddress(void *a) +{ + DWORD ret; + // Validate arguments + if (a == NULL) + { + return false; + } + if (w32net->IpReleaseAddress == NULL) + { + return false; + } + + ret = w32net->IpReleaseAddress(a); + + if (ret == NO_ERROR) + { + return true; + } + else + { + Debug("IpReleaseAddress: Error: %u\n", ret); + return false; + } +} +bool Win32ReleaseAddressByGuid(char *guid) +{ + IP_ADAPTER_INDEX_MAP a; + // Validate arguments + if (guid == NULL) + { + return false; + } + + Zero(&a, sizeof(a)); + if (Win32GetAdapterFromGuid(&a, guid) == false) + { + return false; + } + + return Win32ReleaseAddress(&a); +} +void Win32ReleaseAddressByGuidExThread(THREAD *t, void *param) +{ + WIN32_RELEASEADDRESS_THREAD_PARAM *p; + // Validate arguments + if (t == NULL || param == NULL) + { + return; + } + + p = (WIN32_RELEASEADDRESS_THREAD_PARAM *)param; + + AddRef(p->Ref); + + NoticeThreadInit(t); + + AddWaitThread(t); + + if (p->Renew == false) + { + p->Ok = Win32ReleaseAddressByGuid(p->Guid); + } + else + { + p->Ok = Win32RenewAddressByGuid(p->Guid); + } + + ReleaseWin32ReleaseAddressByGuidThreadParam(p); + + DelWaitThread(t); +} +bool Win32RenewAddressByGuidEx(char *guid, UINT timeout) +{ + return Win32ReleaseOrRenewAddressByGuidEx(guid, timeout, true); +} +bool Win32ReleaseAddressByGuidEx(char *guid, UINT timeout) +{ + return Win32ReleaseOrRenewAddressByGuidEx(guid, timeout, false); +} +bool Win32ReleaseOrRenewAddressByGuidEx(char *guid, UINT timeout, bool renew) +{ + THREAD *t; + WIN32_RELEASEADDRESS_THREAD_PARAM *p; + bool ret = false; + UINT64 start_tick = 0; + UINT64 end_tick = 0; + // Validate arguments + if (guid == NULL) + { + return false; + } + if (timeout == 0) + { + timeout = INFINITE; + } + + p = ZeroMalloc(sizeof(WIN32_RELEASEADDRESS_THREAD_PARAM)); + p->Ref = NewRef(); + StrCpy(p->Guid, sizeof(p->Guid), guid); + p->Timeout = timeout; + p->Renew = renew; + + t = NewThread(Win32ReleaseAddressByGuidExThread, p); + WaitThreadInit(t); + start_tick = Tick64(); + end_tick = start_tick + (UINT64)timeout; + + while (true) + { + UINT64 now = Tick64(); + UINT64 remain; + UINT remain32; + + if (now >= end_tick) + { + break; + } + + remain = end_tick - now; + remain32 = MIN((UINT)remain, 100); + + if (WaitThread(t, remain32)) + { + break; + } + } + + ReleaseThread(t); + + if (p->Ok) + { + ret = true; + } + + ReleaseWin32ReleaseAddressByGuidThreadParam(p); + + return ret; +} +void ReleaseWin32ReleaseAddressByGuidThreadParam(WIN32_RELEASEADDRESS_THREAD_PARAM *p) +{ + // Validate arguments + if (p == NULL) + { + return; + } + + if (Release(p->Ref) == 0) + { + Free(p); + } +} + +// Get the adapter by the GUID +bool Win32GetAdapterFromGuid(void *a, char *guid) +{ + bool ret = false; + IP_INTERFACE_INFO *info; + UINT size; + int i; + LIST *o; + wchar_t tmp[MAX_SIZE]; + + // Validate arguments + if (a == NULL || guid == NULL) + { + return false; + } + if (w32net->GetInterfaceInfo == NULL) + { + return false; + } + + UniFormat(tmp, sizeof(tmp), L"\\DEVICE\\TCPIP_%S", guid); + + size = sizeof(IP_INTERFACE_INFO); + info = ZeroMallocFast(size); + + if (w32net->GetInterfaceInfo(info, &size) == ERROR_INSUFFICIENT_BUFFER) + { + Free(info); + info = ZeroMallocFast(size); + } + + if (w32net->GetInterfaceInfo(info, &size) != NO_ERROR) + { + Free(info); + return false; + } + + o = NewListFast(CompareIpAdapterIndexMap); + + for (i = 0; i < info->NumAdapters; i++) + { + IP_ADAPTER_INDEX_MAP *a = &info->Adapter[i]; + + Add(o, a); + } + + Sort(o); + + for (i = 0; i < (int)(LIST_NUM(o)); i++) + { + IP_ADAPTER_INDEX_MAP *e = LIST_DATA(o, i); + + if (UniStrCmpi(e->Name, tmp) == 0) + { + Copy(a, e, sizeof(IP_ADAPTER_INDEX_MAP)); + ret = true; + break; + } + } + + ReleaseList(o); + + Free(info); + + return ret; +} + +// Clear the DNS cache on Win32 +void Win32FlushDnsCache() +{ + Run("ipconfig.exe", "/flushdns", true, false); +} + +// Update the DHCP address of the specified LAN card +void Win32RenewDhcp9x(UINT if_id) +{ + IP_INTERFACE_INFO *info; + UINT size; + int i; + LIST *o; + // Validate arguments + if (if_id == 0) + { + return; + } + + size = sizeof(IP_INTERFACE_INFO); + info = ZeroMallocFast(size); + + if (w32net->GetInterfaceInfo(info, &size) == ERROR_INSUFFICIENT_BUFFER) + { + Free(info); + info = ZeroMallocFast(size); + } + + if (w32net->GetInterfaceInfo(info, &size) != NO_ERROR) + { + Free(info); + return; + } + + o = NewListFast(CompareIpAdapterIndexMap); + + for (i = 0; i < info->NumAdapters; i++) + { + IP_ADAPTER_INDEX_MAP *a = &info->Adapter[i]; + + Add(o, a); + } + + Sort(o); + + for (i = 0; i < (int)(LIST_NUM(o)); i++) + { + IP_ADAPTER_INDEX_MAP *a = LIST_DATA(o, i); + + if (a->Index == if_id) + { + char arg[MAX_PATH]; + Format(arg, sizeof(arg), "/renew %u", i); + Run("ipconfig.exe", arg, true, false); + } + } + + ReleaseList(o); + + Free(info); +} + +// Release the DHCP address of the specified LAN card +void Win32ReleaseDhcp9x(UINT if_id, bool wait) +{ + IP_INTERFACE_INFO *info; + UINT size; + int i; + LIST *o; + // Validate arguments + if (if_id == 0) + { + return; + } + + size = sizeof(IP_INTERFACE_INFO); + info = ZeroMallocFast(size); + + if (w32net->GetInterfaceInfo(info, &size) == ERROR_INSUFFICIENT_BUFFER) + { + Free(info); + info = ZeroMallocFast(size); + } + + if (w32net->GetInterfaceInfo(info, &size) != NO_ERROR) + { + Free(info); + return; + } + + o = NewListFast(CompareIpAdapterIndexMap); + + for (i = 0; i < info->NumAdapters; i++) + { + IP_ADAPTER_INDEX_MAP *a = &info->Adapter[i]; + + Add(o, a); + } + + Sort(o); + + for (i = 0; i < (int)(LIST_NUM(o)); i++) + { + IP_ADAPTER_INDEX_MAP *a = LIST_DATA(o, i); + + if (a->Index == if_id) + { + char arg[MAX_PATH]; + Format(arg, sizeof(arg), "/release %u", i); + Run("ipconfig.exe", arg, true, wait); + } + } + + ReleaseList(o); + + Free(info); +} + +// Enumerate a list of virtual LAN cards that contains the specified string +char **Win32EnumVLan(char *tag_name) +{ + MIB_IFTABLE *p; + UINT ret; + UINT size_needed; + UINT num_retry = 0; + UINT i; + LIST *o; + char **ss; + // Validate arguments + if (tag_name == 0) + { + return NULL; + } + +RETRY: + p = ZeroMallocFast(sizeof(MIB_IFTABLE)); + size_needed = 0; + + // Examine the needed size + ret = w32net->GetIfTable(p, &size_needed, 0); + if (ret == ERROR_INSUFFICIENT_BUFFER) + { + // Re-allocate the memory block of the needed size + Free(p); + p = ZeroMallocFast(size_needed); + } + else if (ret != NO_ERROR) + { + // Acquisition failure +FAILED: + Free(p); + return NULL; + } + + // Actually get + ret = w32net->GetIfTable(p, &size_needed, FALSE); + if (ret != NO_ERROR) + { + // Acquisition failure + if ((++num_retry) >= 5) + { + goto FAILED; + } + Free(p); + goto RETRY; + } + + // Search + ret = 0; + o = NewListFast(CompareStr); + for (i = 0; i < p->dwNumEntries; i++) + { + MIB_IFROW *r = &p->table[i]; + if (SearchStrEx(r->bDescr, tag_name, 0, false) != INFINITE) + { + char *s = CopyStr(r->bDescr); + Add(o, s); + } + } + + Free(p); + + // Sort + Sort(o); + + // Convert to string + ss = ZeroMallocFast(sizeof(char *) * (LIST_NUM(o) + 1)); + for (i = 0; i < LIST_NUM(o); i++) + { + ss[i] = LIST_DATA(o, i); + } + ss[LIST_NUM(o)] = NULL; + + ReleaseList(o); + + return ss; +} + +// Get the ID of the virtual LAN card from the instance name of the virtual LAN card +UINT Win32GetVLanInterfaceID(char *instance_name) +{ + MIB_IFTABLE *p; + UINT ret; + UINT size_needed; + UINT num_retry = 0; + UINT i; + char ps_miniport_str[MAX_SIZE]; + char ps_miniport_str2[MAX_SIZE]; + UINT min_len = 0x7FFFFFFF; + // Validate arguments + if (instance_name == 0) + { + return 0; + } + +RETRY: + p = ZeroMallocFast(sizeof(MIB_IFTABLE)); + size_needed = 0; + + // Examine the needed size + ret = w32net->GetIfTable(p, &size_needed, 0); + if (ret == ERROR_INSUFFICIENT_BUFFER) + { + // Re-allocate the memory block of the needed size + Free(p); + p = ZeroMallocFast(size_needed); + } + else if (ret != NO_ERROR) + { + // Acquisition failure +FAILED: + Free(p); + Debug("******** GetIfTable Failed 1. Err = %u\n", ret); + return 0; + } + + // Actually get + ret = w32net->GetIfTable(p, &size_needed, FALSE); + if (ret != NO_ERROR) + { + // Acquisition failure + if ((++num_retry) >= 5) + { + goto FAILED; + } + Free(p); + Debug("******** GetIfTable Failed 2. Err = %u\n", ret); + goto RETRY; + } + + // "%s - Packet scheduler miniport" + Format(ps_miniport_str, sizeof(ps_miniport_str), "%s - ", instance_name); + Format(ps_miniport_str2, sizeof(ps_miniport_str2), "%s (Microsoft", instance_name); + + // Search + ret = 0; + for (i = 0; i < p->dwNumEntries; i++) + { + MIB_IFROW *r = &p->table[i]; + if (instance_name[0] != '@') + { + if (StrCmpi(r->bDescr, instance_name) == 0 || StartWith(r->bDescr, ps_miniport_str) || StartWith(r->bDescr, ps_miniport_str2)) + { + UINT len = StrLen(r->bDescr); + + if (len < min_len) + { + ret = r->dwIndex; + + min_len = len; + } + } + } + else + { + if (SearchStrEx(r->bDescr, &instance_name[1], 0, false) != INFINITE) + { + ret = r->dwIndex; + } + } + + //Debug("if[%u] (dwIndex=%u): %u, %s\n", i, r->dwIndex, r->dwType, r->bDescr); + } + + Free(p); + + return ret; +} + +// Get the DNS suffix in another way +bool Win32GetDnsSuffix(char *domain, UINT size) +{ + IP_ADAPTER_ADDRESSES_XP *info; + IP_ADAPTER_ADDRESSES_XP *cur; + UINT info_size; + bool ret = false; + // Validate arguments + ClearStr(domain, size); + if (domain == NULL) + { + return false; + } + if (w32net->GetAdaptersAddresses == NULL) + { + return false; + } + + info_size = 0; + info = ZeroMalloc(sizeof(IP_ADAPTER_ADDRESSES_XP)); + if (w32net->GetAdaptersAddresses(AF_INET, 0, NULL, info, &info_size) == ERROR_BUFFER_OVERFLOW) + { + Free(info); + info = ZeroMalloc(info_size); + } + if (w32net->GetAdaptersAddresses(AF_INET, 0, NULL, info, &info_size) != NO_ERROR) + { + Free(info); + return false; + } + + cur = info; + + while (cur != NULL) + { + if (UniIsEmptyStr(cur->DnsSuffix) == false) + { + UniToStr(domain, size, cur->DnsSuffix); + ret = true; + break; + } + + cur = cur->Next; + } + + Free(info); + + return ret; +} + +// Get the DNS server address of the default +bool Win32GetDefaultDns(IP *ip, char *domain, UINT size) +{ + FIXED_INFO *info; + UINT info_size; + char *dns_name; + // Validate arguments + ClearStr(domain, size); + if (ip == NULL) + { + return false; + } + Zero(ip, sizeof(IP)); + if (w32net->GetNetworkParams == NULL) + { + return false; + } + info_size = 0; + info = ZeroMallocFast(sizeof(FIXED_INFO)); + if (w32net->GetNetworkParams(info, &info_size) == ERROR_BUFFER_OVERFLOW) + { + Free(info); + info = ZeroMallocFast(info_size); + } + if (w32net->GetNetworkParams(info, &info_size) != NO_ERROR) + { + Free(info); + return false; + } + + if (info->DnsServerList.IpAddress.String == NULL) + { + Free(info); + return false; + } + + dns_name = info->DnsServerList.IpAddress.String; + StrToIP(ip, dns_name); + + if (domain != NULL) + { + StrCpy(domain, size, info->DomainName); + Trim(domain); + } + + Free(info); + + return true; +} + +// IP conversion function for Win32 +void Win32UINTToIP(IP *ip, UINT i) +{ + UINTToIP(ip, i); +} + +// IP conversion function for Win32 +UINT Win32IPToUINT(IP *ip) +{ + return IPToUINT(ip); +} + +// Remove a routing entry from the routing table +void Win32DeleteRouteEntry(ROUTE_ENTRY *e) +{ + MIB_IPFORWARDROW *p; + // Validate arguments + if (e == NULL) + { + return; + } + + p = ZeroMallocFast(sizeof(MIB_IPFORWARDROW)); + Win32RouteEntryToIpForwardRow(p, e); + + // Delete + w32net->DeleteIpForwardEntry(p); + + Free(p); +} + +// Add a routing entry to the routing table +bool Win32AddRouteEntry(ROUTE_ENTRY *e, bool *already_exists) +{ + bool ret = false; + bool dummy = false; + MIB_IPFORWARDROW *p; + UINT err = 0; + // Validate arguments + if (e == NULL) + { + return false; + } + if (already_exists == NULL) + { + already_exists = &dummy; + } + + *already_exists = false; + + p = ZeroMallocFast(sizeof(MIB_IPFORWARDROW)); + Win32RouteEntryToIpForwardRow(p, e); + + // Adding + err = w32net->CreateIpForwardEntry(p); + if (err != 0) + { + if (err == ERROR_OBJECT_ALREADY_EXISTS) + { + Debug("CreateIpForwardEntry: Already Exists\n"); + *already_exists = true; + ret = true; + } + else + { + Debug("CreateIpForwardEntry Error: %u\n", err); + ret = false; + } + } + else + { + ret = true; + } + + Free(p); + + return ret; +} + +// Get the routing table +ROUTE_TABLE *Win32GetRouteTable() +{ + ROUTE_TABLE *t = ZeroMallocFast(sizeof(ROUTE_TABLE)); + MIB_IPFORWARDTABLE *p; + UINT ret; + UINT size_needed; + UINT num_retry = 0; + LIST *o; + UINT i; + ROUTE_ENTRY *e; + +RETRY: + p = ZeroMallocFast(sizeof(MIB_IFTABLE)); + size_needed = 0; + + // Examine the needed size + ret = w32net->GetIpForwardTable(p, &size_needed, 0); + if (ret == ERROR_INSUFFICIENT_BUFFER) + { + // Re-allocate the memory block of the needed size + Free(p); + p = ZeroMallocFast(size_needed); + } + else if (ret != NO_ERROR) + { + // Acquisition failure +FAILED: + Free(p); + t->Entry = MallocFast(0); + return t; + } + + // Actually get + ret = w32net->GetIpForwardTable(p, &size_needed, FALSE); + if (ret != NO_ERROR) + { + // Acquisition failure + if ((++num_retry) >= 5) + { + goto FAILED; + } + Free(p); + goto RETRY; + } + + // Add to the list along + o = NewListFast(Win32CompareRouteEntryByMetric); + for (i = 0; i < p->dwNumEntries; i++) + { + e = ZeroMallocFast(sizeof(ROUTE_ENTRY)); + Win32IpForwardRowToRouteEntry(e, &p->table[i]); + Add(o, e); + } + Free(p); + + // Sort by metric + Sort(o); + + // Combine the results + t->NumEntry = LIST_NUM(o); + t->Entry = ToArrayEx(o, true); + ReleaseList(o); + + return t; +} + +// Sort the routing entries by metric +int Win32CompareRouteEntryByMetric(void *p1, void *p2) +{ + ROUTE_ENTRY *e1, *e2; + // Validate arguments + if (p1 == NULL || p2 == NULL) + { + return 0; + } + + e1 = *(ROUTE_ENTRY **)p1; + e2 = *(ROUTE_ENTRY **)p2; + if (e1 == NULL || e2 == NULL) + { + return 0; + } + + if (e1->Metric > e2->Metric) + { + return 1; + } + else if (e1->Metric == e2->Metric) + { + return 0; + } + else + { + return -1; + } +} + +// Convert the ROUTE_ENTRY to a MIB_IPFORWARDROW +void Win32RouteEntryToIpForwardRow(void *ip_forward_row, ROUTE_ENTRY *entry) +{ + MIB_IPFORWARDROW *r; + // Validate arguments + if (entry == NULL || ip_forward_row == NULL) + { + return; + } + + r = (MIB_IPFORWARDROW *)ip_forward_row; + Zero(r, sizeof(MIB_IPFORWARDROW)); + + // IP address + r->dwForwardDest = Win32IPToUINT(&entry->DestIP); + // Subnet mask + r->dwForwardMask = Win32IPToUINT(&entry->DestMask); + // Gateway IP address + r->dwForwardNextHop = Win32IPToUINT(&entry->GatewayIP); + // Local routing flag + if (entry->LocalRouting) + { + // Local + r->dwForwardType = 3; + } + else + { + // Remote router + r->dwForwardType = 4; + } + // Protocol + r->dwForwardProto = r->dwForwardType - 1; // Subtract by 1 in most cases + if (entry->PPPConnection) + { + // Isn't this a PPP? Danger! + r->dwForwardProto++; + } + // Metric + r->dwForwardMetric1 = entry->Metric; + + if (MsIsVista() == false) + { + r->dwForwardMetric2 = r->dwForwardMetric3 = r->dwForwardMetric4 = r->dwForwardMetric5 = INFINITE; + } + else + { + r->dwForwardMetric2 = r->dwForwardMetric3 = r->dwForwardMetric4 = r->dwForwardMetric5 = 0; + r->dwForwardAge = 163240; + } + + // Interface ID + r->dwForwardIfIndex = entry->InterfaceID; + + Debug("Win32RouteEntryToIpForwardRow()\n"); + Debug(" r->dwForwardDest=%X\n", r->dwForwardDest); + Debug(" r->dwForwardMask=%X\n", r->dwForwardMask); + Debug(" r->dwForwardNextHop=%X\n", r->dwForwardNextHop); + Debug(" r->dwForwardType=%u\n", r->dwForwardType); + Debug(" r->dwForwardProto=%u\n", r->dwForwardProto); + Debug(" r->dwForwardMetric1=%u\n", r->dwForwardMetric1); + Debug(" r->dwForwardMetric2=%u\n", r->dwForwardMetric2); + Debug(" r->dwForwardIfIndex=%u\n", r->dwForwardIfIndex); +} + +// Convert the MIB_IPFORWARDROW to a ROUTE_ENTRY +void Win32IpForwardRowToRouteEntry(ROUTE_ENTRY *entry, void *ip_forward_row) +{ + MIB_IPFORWARDROW *r; + // Validate arguments + if (entry == NULL || ip_forward_row == NULL) + { + return; + } + + r = (MIB_IPFORWARDROW *)ip_forward_row; + + Zero(entry, sizeof(ROUTE_ENTRY)); + // IP address + Win32UINTToIP(&entry->DestIP, r->dwForwardDest); + // Subnet mask + Win32UINTToIP(&entry->DestMask, r->dwForwardMask); + // Gateway IP address + Win32UINTToIP(&entry->GatewayIP, r->dwForwardNextHop); + // Local routing flag + if (r->dwForwardType == 3) + { + entry->LocalRouting = true; + } + else + { + entry->LocalRouting = false; + } + if (entry->LocalRouting && r->dwForwardProto == 3) + { + // PPP. Danger! + entry->PPPConnection = true; + } + // Metric + entry->Metric = r->dwForwardMetric1; + // Interface ID + entry->InterfaceID = r->dwForwardIfIndex; +} + +// Initializing the socket library +void Win32InitSocketLibrary() +{ + WSADATA data; + Zero(&data, sizeof(data)); + WSAStartup(MAKEWORD(2, 2), &data); + + // Load the DLL functions + w32net = ZeroMalloc(sizeof(NETWORK_WIN32_FUNCTIONS)); + w32net->hIpHlpApi32 = LoadLibrary("iphlpapi.dll"); + w32net->hIcmp = LoadLibrary("icmp.dll"); + + if (w32net->hIpHlpApi32 != NULL) + { + w32net->CreateIpForwardEntry = + (DWORD (__stdcall *)(PMIB_IPFORWARDROW)) + GetProcAddress(w32net->hIpHlpApi32, "CreateIpForwardEntry"); + + w32net->DeleteIpForwardEntry = + (DWORD (__stdcall *)(PMIB_IPFORWARDROW)) + GetProcAddress(w32net->hIpHlpApi32, "DeleteIpForwardEntry"); + + w32net->GetIfTable = + (DWORD (__stdcall *)(PMIB_IFTABLE, PULONG, BOOL)) + GetProcAddress(w32net->hIpHlpApi32, "GetIfTable"); + + w32net->GetIfTable2 = + (DWORD (__stdcall *)(void **)) + GetProcAddress(w32net->hIpHlpApi32, "GetIfTable2"); + + w32net->FreeMibTable = + (void (__stdcall *)(PVOID)) + GetProcAddress(w32net->hIpHlpApi32, "FreeMibTable"); + + w32net->GetIpForwardTable = + (DWORD (__stdcall *)(PMIB_IPFORWARDTABLE, PULONG, BOOL)) + GetProcAddress(w32net->hIpHlpApi32, "GetIpForwardTable"); + + w32net->GetNetworkParams = + (DWORD (__stdcall *)(PFIXED_INFO,PULONG)) + GetProcAddress(w32net->hIpHlpApi32, "GetNetworkParams"); + + w32net->GetAdaptersAddresses = + (ULONG (__stdcall *)(ULONG,ULONG,PVOID,PIP_ADAPTER_ADDRESSES,PULONG)) + GetProcAddress(w32net->hIpHlpApi32, "GetAdaptersAddresses"); + + w32net->IpRenewAddress = + (DWORD (__stdcall *)(PIP_ADAPTER_INDEX_MAP)) + GetProcAddress(w32net->hIpHlpApi32, "IpRenewAddress"); + + w32net->IpReleaseAddress = + (DWORD (__stdcall *)(PIP_ADAPTER_INDEX_MAP)) + GetProcAddress(w32net->hIpHlpApi32, "IpReleaseAddress"); + + w32net->GetInterfaceInfo = + (DWORD (__stdcall *)(PIP_INTERFACE_INFO, PULONG)) + GetProcAddress(w32net->hIpHlpApi32, "GetInterfaceInfo"); + + w32net->GetAdaptersInfo = + (DWORD (__stdcall *)(PIP_ADAPTER_INFO, PULONG)) + GetProcAddress(w32net->hIpHlpApi32, "GetAdaptersInfo"); + + w32net->GetExtendedTcpTable = + (DWORD (__stdcall *)(PVOID,PDWORD,BOOL,ULONG,_TCP_TABLE_CLASS,ULONG)) + GetProcAddress(w32net->hIpHlpApi32, "GetExtendedTcpTable"); + + w32net->AllocateAndGetTcpExTableFromStack = + (DWORD (__stdcall *)(PVOID *,BOOL,HANDLE,DWORD,DWORD)) + GetProcAddress(w32net->hIpHlpApi32, "AllocateAndGetTcpExTableFromStack"); + + w32net->GetTcpTable = + (DWORD (__stdcall *)(PMIB_TCPTABLE,PDWORD,BOOL)) + GetProcAddress(w32net->hIpHlpApi32, "GetTcpTable"); + + w32net->NotifyRouteChange = + (DWORD (__stdcall *)(PHANDLE,LPOVERLAPPED)) + GetProcAddress(w32net->hIpHlpApi32, "NotifyRouteChange"); + + w32net->CancelIPChangeNotify = + (BOOL (__stdcall *)(LPOVERLAPPED)) + GetProcAddress(w32net->hIpHlpApi32, "CancelIPChangeNotify"); + + w32net->NhpAllocateAndGetInterfaceInfoFromStack = + (DWORD (__stdcall *)(IP_INTERFACE_NAME_INFO **,PDWORD,BOOL,HANDLE,DWORD)) + GetProcAddress(w32net->hIpHlpApi32, "NhpAllocateAndGetInterfaceInfoFromStack"); + + w32net->IcmpCreateFile = + (HANDLE (__stdcall *)()) + GetProcAddress(w32net->hIpHlpApi32, "IcmpCreateFile"); + + w32net->IcmpCloseHandle = + (BOOL (__stdcall *)(HANDLE)) + GetProcAddress(w32net->hIpHlpApi32, "IcmpCloseHandle"); + + w32net->IcmpSendEcho = + (DWORD (__stdcall *)(HANDLE,IPAddr,LPVOID,WORD,PIP_OPTION_INFORMATION,LPVOID,DWORD,DWORD)) + GetProcAddress(w32net->hIpHlpApi32, "IcmpSendEcho"); + } + + if (w32net->hIcmp != NULL) + { + if (w32net->IcmpCreateFile == NULL || w32net->IcmpCloseHandle == NULL || w32net->IcmpSendEcho == NULL) + { + w32net->IcmpCreateFile = + (HANDLE (__stdcall *)()) + GetProcAddress(w32net->hIcmp, "IcmpCreateFile"); + + w32net->IcmpCloseHandle = + (BOOL (__stdcall *)(HANDLE)) + GetProcAddress(w32net->hIcmp, "IcmpCloseHandle"); + + w32net->IcmpSendEcho = + (DWORD (__stdcall *)(HANDLE,IPAddr,LPVOID,WORD,PIP_OPTION_INFORMATION,LPVOID,DWORD,DWORD)) + GetProcAddress(w32net->hIcmp, "IcmpSendEcho"); + } + } + + if (w32net->IcmpCreateFile == NULL || w32net->IcmpCloseHandle == NULL || w32net->IcmpSendEcho == NULL) + { + w32net->IcmpCreateFile = NULL; + w32net->IcmpCloseHandle = NULL; + w32net->IcmpSendEcho = NULL; + } +} + +// Release of the socket library +void Win32FreeSocketLibrary() +{ + if (w32net != NULL) + { + if (w32net->hIpHlpApi32 != NULL) + { + FreeLibrary(w32net->hIpHlpApi32); + } + + if (w32net->hIcmp != NULL) + { + FreeLibrary(w32net->hIcmp); + } + + Free(w32net); + w32net = NULL; + } + + WSACleanup(); +} + +// Cancel +void Win32Cancel(CANCEL *c) +{ + // Validate arguments + if (c == NULL) + { + return; + } + + SetEvent((HANDLE)c->hEvent); +} + +// Cleanup of the cancel object +void Win32CleanupCancel(CANCEL *c) +{ + // Validate arguments + if (c == NULL) + { + return; + } + + if (c->SpecialFlag == false) + { + CloseHandle(c->hEvent); + } + + Free(c); +} + +// New cancel object +CANCEL *Win32NewCancel() +{ + CANCEL *c = ZeroMallocFast(sizeof(CANCEL)); + c->ref = NewRef(); + c->SpecialFlag = false; + c->hEvent = CreateEvent(NULL, FALSE, FALSE, NULL); + + return c; +} + +// Waiting for a socket event +bool Win32WaitSockEvent(SOCK_EVENT *event, UINT timeout) +{ + // Validate arguments + if (event == NULL || timeout == 0) + { + return false; + } + + if (WaitForSingleObject((HANDLE)event->hEvent, timeout) == WAIT_OBJECT_0) + { + return true; + } + else + { + return false; + } +} + +// Clean-up of the socket event +void Win32CleanupSockEvent(SOCK_EVENT *event) +{ + // Validate arguments + if (event == NULL) + { + return; + } + + CloseHandle((HANDLE)event->hEvent); + + Free(event); +} + +// Set of the socket event +void Win32SetSockEvent(SOCK_EVENT *event) +{ + // Validate arguments + if (event == NULL) + { + return; + } + + SetEvent((HANDLE)event->hEvent); +} + +// Creating a socket event +SOCK_EVENT *Win32NewSockEvent() +{ + SOCK_EVENT *e = ZeroMallocFast(sizeof(SOCK_EVENT)); + + e->ref = NewRef(); + e->hEvent = (void *)CreateEvent(NULL, FALSE, FALSE, NULL); + + return e; +} + +// Associate the socket with socket event and set it to asynchronous mode +void Win32JoinSockToSockEvent(SOCK *sock, SOCK_EVENT *event) +{ + HANDLE hEvent; + // Validate arguments + if (sock == NULL || event == NULL || sock->AsyncMode) + { + return; + } + if (sock->ListenMode != false || (sock->Type != SOCK_UDP && sock->Connected == false)) + { + return; + } + + sock->AsyncMode = true; + + hEvent = event->hEvent; + + // Association + WSAEventSelect(sock->socket, hEvent, FD_READ | FD_WRITE | FD_CLOSE); + + // Increase the reference count of the SOCK_EVENT + AddRef(event->ref); + sock->SockEvent = event; +} + +// Set the socket to asynchronous mode +void Win32InitAsyncSocket(SOCK *sock) +{ + // Validate arguments + if (sock == NULL) + { + return; + } + if (sock->AsyncMode) + { + // This socket is already in asynchronous mode + return; + } + if (sock->ListenMode || ((sock->Type == SOCK_TCP || sock->Type == SOCK_INPROC) && sock->Connected == false)) + { + return; + } + + sock->AsyncMode = true; + + if (sock->Type == SOCK_INPROC) + { + // Fetch the event of the TUBE + TUBE *t = sock->RecvTube; + + if (t != NULL) + { + if (t->SockEvent != NULL) + { + sock->hEvent = t->SockEvent->hEvent; + } + } + } + else + { + // Creating an Event + sock->hEvent = (void *)CreateEvent(NULL, FALSE, FALSE, NULL); + + // Association + WSAEventSelect(sock->socket, sock->hEvent, FD_READ | FD_WRITE | FD_CLOSE); + } +} + +// Release the asynchronous socket +void Win32FreeAsyncSocket(SOCK *sock) +{ + // Validate arguments + if (sock == NULL) + { + return; + } + + // Asynchronous socket + if (sock->hEvent != NULL) + { + if (sock->Type != SOCK_INPROC) + { + CloseHandle((HANDLE)sock->hEvent); + } + } + sock->hEvent = NULL; + sock->AsyncMode = false; + + // Socket event + if (sock->SockEvent != NULL) + { + ReleaseSockEvent(sock->SockEvent); + sock->SockEvent = NULL; + } +} + +// Select function for Win32 +void Win32Select(SOCKSET *set, UINT timeout, CANCEL *c1, CANCEL *c2) +{ + HANDLE array[MAXIMUM_WAIT_OBJECTS]; + UINT n, i; + SOCK *s; + // Initialization of array + Zero(array, sizeof(array)); + n = 0; + + // Setting the event array + if (set != NULL) + { + for (i = 0; i < set->NumSocket; i++) + { + s = set->Sock[i]; + if (s != NULL) + { + Win32InitAsyncSocket(s); + if (s->hEvent != NULL) + { + array[n++] = (HANDLE)s->hEvent; + } + + if (s->BulkRecvTube != NULL) + { + array[n++] = (HANDLE)s->BulkRecvTube->SockEvent->hEvent; + } + } + } + } + if (c1 != NULL && c1->hEvent != NULL) + { + array[n++] = c1->hEvent; + } + if (c2 != NULL && c2->hEvent != NULL) + { + array[n++] = c2->hEvent; + } + + if (timeout == 0) + { + return; + } + + if (n == 0) + { + // Call normal waiting function if no events to wait are registered + SleepThread(timeout); + } + else + { + // Wait for the event if events are registered at least one + if (n == 1) + { + // Calling a lightweight version If the event is only one + WaitForSingleObject(array[0], timeout); + } + else + { + // In case of multiple events + WaitForMultipleObjects(n, array, false, timeout); + } + } +} + +#endif // OS_WIN32 + +// Check whether the IPv6 is supported +bool IsIPv6Supported() +{ +#ifdef NO_IPV6 + return false; +#else // NO_IPV6 + SOCKET s; + + s = socket(AF_INET6, SOCK_STREAM, 0); + if (s == INVALID_SOCKET) + { + return false; + } + + closesocket(s); + + return true; +#endif // NO_IPV6 +} + +// Get the host name from the host cache +bool GetHostCache(char *hostname, UINT size, IP *ip) +{ + bool ret; + // Validate arguments + if (hostname == NULL || ip == NULL) + { + return false; + } + + ret = false; + + LockList(HostCacheList); + { + HOSTCACHE t, *c; + Zero(&t, sizeof(t)); + Copy(&t.IpAddress, ip, sizeof(IP)); + + c = Search(HostCacheList, &t); + if (c != NULL) + { + if (IsEmptyStr(c->HostName) == false) + { + ret = true; + StrCpy(hostname, size, c->HostName); + } + else + { + ret = true; + StrCpy(hostname, size, ""); + } + } + } + UnlockList(HostCacheList); + + return ret; +} + +// Add to the host name cache +void AddHostCache(IP *ip, char *hostname) +{ + // Validate arguments + if (ip == NULL || hostname == NULL) + { + return; + } + if (IsNetworkNameCacheEnabled() == false) + { + return; + } + + LockList(HostCacheList); + { + HOSTCACHE t, *c; + UINT i; + LIST *o; + + Zero(&t, sizeof(t)); + Copy(&t.IpAddress, ip, sizeof(IP)); + + c = Search(HostCacheList, &t); + if (c == NULL) + { + c = ZeroMalloc(sizeof(HOSTCACHE)); + Copy(&c->IpAddress, ip, sizeof(IP)); + Add(HostCacheList, c); + } + + StrCpy(c->HostName, sizeof(c->HostName), hostname); + c->Expires = Tick64() + (UINT64)EXPIRES_HOSTNAME; + + o = NewListFast(NULL); + + for (i = 0; i < LIST_NUM(HostCacheList); i++) + { + HOSTCACHE *c = LIST_DATA(HostCacheList, i); + + if (c->Expires <= Tick64()) + { + Add(o, c); + } + } + + for (i = 0; i < LIST_NUM(o); i++) + { + HOSTCACHE *c = LIST_DATA(o, i); + + if (Delete(HostCacheList, c)) + { + Free(c); + } + } + + ReleaseList(o); + } + UnlockList(HostCacheList); +} + +// Comparison of host name cache entries +int CompareHostCache(void *p1, void *p2) +{ + HOSTCACHE *c1, *c2; + if (p1 == NULL || p2 == NULL) + { + return 0; + } + c1 = *(HOSTCACHE **)p1; + c2 = *(HOSTCACHE **)p2; + if (c1 == NULL || c2 == NULL) + { + return 0; + } + + return CmpIpAddr(&c1->IpAddress, &c2->IpAddress); +} + +// Release of the host name cache +void FreeHostCache() +{ + UINT i; + + for (i = 0; i < LIST_NUM(HostCacheList); i++) + { + HOSTCACHE *c = LIST_DATA(HostCacheList, i); + + Free(c); + } + + ReleaseList(HostCacheList); + HostCacheList = NULL; +} + +// Initialization of the host name cache +void InitHostCache() +{ + HostCacheList = NewList(CompareHostCache); +} + +// Add the thread to the thread waiting list +void AddWaitThread(THREAD *t) +{ + // Validate arguments + if (t == NULL) + { + return; + } + + AddRef(t->ref); + + LockList(WaitThreadList); + { + Add(WaitThreadList, t); + } + UnlockList(WaitThreadList); +} + +// Remove the thread from the waiting list +void DelWaitThread(THREAD *t) +{ + // Validate arguments + if (t == NULL) + { + return; + } + + LockList(WaitThreadList); + { + if (Delete(WaitThreadList, t)) + { + ReleaseThread(t); + } + } + UnlockList(WaitThreadList); +} + +// Creating a thread waiting list +void InitWaitThread() +{ + WaitThreadList = NewList(NULL); +} + +// Release of the thread waiting list +void FreeWaitThread() +{ + UINT i, num; + THREAD **threads; + + LockList(WaitThreadList); + { + num = LIST_NUM(WaitThreadList); + threads = ToArray(WaitThreadList); + DeleteAll(WaitThreadList); + } + UnlockList(WaitThreadList); + + for (i = 0; i < num; i++) + { + THREAD *t = threads[i]; + WaitThread(t, INFINITE); + ReleaseThread(t); + } + + Free(threads); + + ReleaseList(WaitThreadList); + WaitThreadList = NULL; +} + +// Get a domain name for UNIX +bool UnixGetDomainName(char *name, UINT size) +{ + bool ret = false; + BUF *b = ReadDump("/etc/resolv.conf"); + + if (b == NULL) + { + return false; + } + + while (true) + { + char *s = CfgReadNextLine(b); + TOKEN_LIST *t; + + if (s == NULL) + { + break; + } + + Trim(s); + + t = ParseToken(s, " \t"); + if (t != NULL) + { + if (t->NumTokens == 2) + { + if (StrCmpi(t->Token[0], "domain") == 0) + { + StrCpy(name, size, t->Token[1]); + ret = true; + } + } + FreeToken(t); + } + + Free(s); + } + + FreeBuf(b); + + return ret; +} + +// Get the domain name +bool GetDomainName(char *name, UINT size) +{ + bool ret = false; + IP ip; + // Validate arguments + ClearStr(name, size); + if (name == NULL) + { + return false; + } + +#ifdef OS_WIN32 + ClearStr(name, size); + ret = Win32GetDefaultDns(&ip, name, size); + + if (ret == false || IsEmptyStr(name)) + { + ret = Win32GetDnsSuffix(name, size); + } +#else // OS_WIN32 + ret = UnixGetDomainName(name, size); +#endif // OS_WIN32 + + if (ret == false) + { + return false; + } + + return (IsEmptyStr(name) ? false : true); +} + +// Get the default DNS server +bool GetDefaultDns(IP *ip) +{ +#ifdef OS_WIN32 + return Win32GetDefaultDns(ip, NULL, 0); +#else + return UnixGetDefaultDns(ip); +#endif // OS_WIN32 +} + +// Creating a socket event +SOCK_EVENT *NewSockEvent() +{ +#ifdef OS_WIN32 + return Win32NewSockEvent(); +#else + return UnixNewSockEvent(); +#endif // OS_WIN32 +} + +// Set of the socket event +void SetSockEvent(SOCK_EVENT *event) +{ +#ifdef OS_WIN32 + Win32SetSockEvent(event); +#else + UnixSetSockEvent(event); +#endif // OS_WIN32 +} + +// Clean-up of the socket event +void CleanupSockEvent(SOCK_EVENT *event) +{ +#ifdef OS_WIN32 + Win32CleanupSockEvent(event); +#else + UnixCleanupSockEvent(event); +#endif // OS_WIN32 +} + +// Waiting for the socket event +bool WaitSockEvent(SOCK_EVENT *event, UINT timeout) +{ + bool ret = false; +#ifdef OS_WIN32 + ret = Win32WaitSockEvent(event, timeout); +#else + ret = UnixWaitSockEvent(event, timeout); +#endif // OS_WIN32 + return ret; +} + +// Release of the socket event +void ReleaseSockEvent(SOCK_EVENT *event) +{ + // Validate arguments + if (event == NULL) + { + return; + } + + if (Release(event->ref) == 0) + { + CleanupSockEvent(event); + } +} + +// Let belonging the socket to the socket event +void JoinSockToSockEvent(SOCK *sock, SOCK_EVENT *event) +{ + // Validate arguments + if (sock == NULL || event == NULL) + { + return; + } + + if (sock->Type == SOCK_INPROC) + { + // Set the SockEvent on the receiver TUBE for in-process type socket + SetTubeSockEvent(sock->RecvTube, event); + return; + } + + if (sock->BulkRecvTube != NULL) + { + // Set the SockEvent on the receiver TUBE in case of R-UDP socket + SetTubeSockEvent(sock->BulkRecvTube, event); + } + +#ifdef OS_WIN32 + Win32JoinSockToSockEvent(sock, event); +#else + UnixJoinSockToSockEvent(sock, event); +#endif // OS_WIN32 +} + +// New special cancel object +CANCEL *NewCancelSpecial(void *hEvent) +{ + CANCEL *c; + // Validate arguments + if (hEvent == NULL) + { + return NULL; + } + + c = ZeroMalloc(sizeof(CANCEL)); + c->ref = NewRef(); + c->SpecialFlag = true; + +#ifdef OS_WIN32 + c->hEvent = (HANDLE)hEvent; +#else // OS_WIN32 + c->pipe_read = (int)hEvent; + c->pipe_write = -1; +#endif // OS_WIN32 + + return c; +} + +// Creating a cancel object +CANCEL *NewCancel() +{ + CANCEL *c = NULL; +#ifdef OS_WIN32 + c = Win32NewCancel(); +#else + c = UnixNewCancel(); +#endif // OS_WIN32 + return c; +} + +// Release of the cancel object +void ReleaseCancel(CANCEL *c) +{ + // Validate arguments + if (c == NULL) + { + return; + } + + if (Release(c->ref) == 0) + { + CleanupCancel(c); + } +} + +// Clean up of the cancel object +void CleanupCancel(CANCEL *c) +{ +#ifdef OS_WIN32 + Win32CleanupCancel(c); +#else + UnixCleanupCancel(c); +#endif +} + +// Cancellation triggered +void Cancel(CANCEL *c) +{ +#ifdef OS_WIN32 + Win32Cancel(c); +#else + UnixCancel(c); +#endif +} + +// Calculate the optimal route from the specified routing table +ROUTE_ENTRY *GetBestRouteEntryFromRouteTableEx(ROUTE_TABLE *table, IP *ip, UINT exclude_if_id) +{ + UINT i; + ROUTE_ENTRY *ret = NULL; + ROUTE_ENTRY *tmp = NULL; + UINT64 min_score = 0; + // Validate arguments + if (ip == NULL || table == NULL) + { + return NULL; + } + + if (IsIP6(ip)) + { + // IPv6 is not supported + return NULL; + } + + // Select routing table entry by following rule + // 1. Largest subnet mask + // 2. Smallest metric value + for (i = 0; i < table->NumEntry; i++) + { + ROUTE_ENTRY *e = table->Entry[i]; + UINT dest, net, mask; + + dest = IPToUINT(ip); + net = IPToUINT(&e->DestIP); + mask = IPToUINT(&e->DestMask); + + if (exclude_if_id != 0) + { + if (e->InterfaceID == exclude_if_id) + { + continue; + } + } + + // Mask test + if ((dest & mask) == (net & mask)) + { + // Calculate the score + UINT score_high32 = mask; + UINT score_low32 = 0xFFFFFFFF - e->Metric; + UINT64 score64 = (UINT64)score_high32 * (UINT64)0x80000000 * (UINT64)2 + (UINT64)score_low32; + if (score64 == 0) + { + score64 = 1; + } + + e->InnerScore = score64; + } + } + + tmp = NULL; + + // Search for the item with maximum score + for (i = 0; i < table->NumEntry; i++) + { + ROUTE_ENTRY *e = table->Entry[i]; + + if (e->InnerScore != 0) + { + if (e->InnerScore >= min_score) + { + tmp = e; + min_score = e->InnerScore; + } + } + } + + if (tmp != NULL) + { + UINT dest, gateway, mask; + + // Generate an entry + ret = ZeroMallocFast(sizeof(ROUTE_ENTRY)); + + Copy(&ret->DestIP, ip, sizeof(IP)); + ret->DestMask.addr[0] = 255; + ret->DestMask.addr[1] = 255; + ret->DestMask.addr[2] = 255; + ret->DestMask.addr[3] = 255; + Copy(&ret->GatewayIP, &tmp->GatewayIP, sizeof(IP)); + ret->InterfaceID = tmp->InterfaceID; + ret->LocalRouting = tmp->LocalRouting; + ret->OldIfMetric = tmp->Metric; + ret->Metric = 1; + ret->PPPConnection = tmp->PPPConnection; + + // Calculation related to routing control + dest = IPToUINT(&tmp->DestIP); + gateway = IPToUINT(&tmp->GatewayIP); + mask = IPToUINT(&tmp->DestMask); + if ((dest & mask) == (gateway & mask)) + { +#ifdef OS_WIN32 + if (MsIsVista() == false) + { + // Adjust for Windows + ret->PPPConnection = true; + } +#endif // OS_WIN32 + } + } + + return ret; +} + +// Release the routing entry +void FreeRouteEntry(ROUTE_ENTRY *e) +{ + // Validate arguments + if (e == NULL) + { + return; + } + + Free(e); +} + +// Get the best route entry by analyzing the current routing table +ROUTE_ENTRY *GetBestRouteEntry(IP *ip) +{ + return GetBestRouteEntryEx(ip, 0); +} +ROUTE_ENTRY *GetBestRouteEntryEx(IP *ip, UINT exclude_if_id) +{ + ROUTE_TABLE *table; + ROUTE_ENTRY *e = NULL; + // Validate arguments + if (ip == NULL) + { + return NULL; + } + + table = GetRouteTable(); + if (table == NULL) + { + return NULL; + } + + e = GetBestRouteEntryFromRouteTableEx(table, ip, exclude_if_id); + FreeRouteTable(table); + + return e; +} + +// Get the interface ID of the virtual LAN card +UINT GetVLanInterfaceID(char *tag_name) +{ + UINT ret = 0; +#ifdef OS_WIN32 + ret = Win32GetVLanInterfaceID(tag_name); +#else // OS_WIN32 + ret = UnixGetVLanInterfaceID(tag_name); +#endif // OS_WIN32 + return ret; +} + +// Release of enumeration variable of virtual LAN card +void FreeEnumVLan(char **s) +{ + char *a; + UINT i; + // Validate arguments + if (s == NULL) + { + return; + } + + i = 0; + while (true) + { + a = s[i++]; + if (a == NULL) + { + break; + } + Free(a); + } + + Free(s); +} + +// Enumeration of virtual LAN cards +char **EnumVLan(char *tag_name) +{ + char **ret = NULL; +#ifdef OS_WIN32 + ret = Win32EnumVLan(tag_name); +#else // OS_WIN32 + ret = UnixEnumVLan(tag_name); +#endif // OS_WIN32 + return ret; +} + +// Display the routing table +void DebugPrintRouteTable(ROUTE_TABLE *r) +{ + UINT i; + // Validate arguments + if (r == NULL) + { + return; + } + + if (IsDebug() == false) + { + return; + } + + Debug("---- Routing Table (%u Entries) ----\n", r->NumEntry); + + for (i = 0; i < r->NumEntry; i++) + { + Debug(" "); + + DebugPrintRoute(r->Entry[i]); + } + + Debug("------------------------------------\n"); +} + +// Display the routing table entry +void DebugPrintRoute(ROUTE_ENTRY *e) +{ + char tmp[MAX_SIZE]; + // Validate arguments + if (e == NULL) + { + return; + } + + if (IsDebug() == false) + { + return; + } + + RouteToStr(tmp, sizeof(tmp), e); + + Debug("%s\n", tmp); +} + +// Convert the routing table entry to string +void RouteToStr(char *str, UINT str_size, ROUTE_ENTRY *e) +{ + char dest_ip[MAX_PATH]; + char dest_mask[MAX_PATH]; + char gateway_ip[MAX_PATH]; + // Validate arguments + if (str == NULL || e == NULL) + { + return; + } + + IPToStr(dest_ip, sizeof(dest_ip), &e->DestIP); + IPToStr(dest_mask, sizeof(dest_mask), &e->DestMask); + IPToStr(gateway_ip, sizeof(gateway_ip), &e->GatewayIP); + + Format(str, str_size, "%s/%s %s m=%u oif=%u if=%u lo=%u p=%u", + dest_ip, dest_mask, gateway_ip, + e->Metric, e->OldIfMetric, e->InterfaceID, + e->LocalRouting, e->PPPConnection); +} + +// Delete the routing table +void DeleteRouteEntry(ROUTE_ENTRY *e) +{ + Debug("DeleteRouteEntry();\n"); +#ifdef OS_WIN32 + Win32DeleteRouteEntry(e); +#else // OS_WIN32 + UnixDeleteRouteEntry(e); +#endif +} + +// Add to the routing table +bool AddRouteEntry(ROUTE_ENTRY *e) +{ + bool dummy = false; + return AddRouteEntryEx(e, &dummy); +} +bool AddRouteEntryEx(ROUTE_ENTRY *e, bool *already_exists) +{ + bool ret = false; + Debug("AddRouteEntryEx();\n"); +#ifdef OS_WIN32 + ret = Win32AddRouteEntry(e, already_exists); +#else // OS_WIN32 + ret = UnixAddRouteEntry(e, already_exists); +#endif + return ret; +} + +// Get the routing table +ROUTE_TABLE *GetRouteTable() +{ + ROUTE_TABLE *t = NULL; + UINT i; + BUF *buf = NewBuf(); + UCHAR hash[MD5_SIZE]; + +#ifdef OS_WIN32 + t = Win32GetRouteTable(); +#else //OS_WIN32 + t = UnixGetRouteTable(); +#endif // OS_WIN32 + + WriteBuf(buf, &t->NumEntry, sizeof(t->NumEntry)); + + for (i = 0; i < t->NumEntry; i++) + { + ROUTE_ENTRY *e = t->Entry[i]; + + WriteBuf(buf, e, sizeof(ROUTE_ENTRY)); + } + + Md5(hash, buf->Buf, buf->Size); + + FreeBuf(buf); + + Copy(&t->HashedValue, hash, sizeof(t->HashedValue)); + + return t; +} + +// Release of the routing table +void FreeRouteTable(ROUTE_TABLE *t) +{ + UINT i; + // Validate arguments + if (t == NULL) + { + return; + } + + for (i = 0; i < t->NumEntry; i++) + { + Free(t->Entry[i]); + } + Free(t->Entry); + Free(t); +} + +// UDP receiving +UINT RecvFrom(SOCK *sock, IP *src_addr, UINT *src_port, void *data, UINT size) +{ + struct sockaddr_in addr; + int ret = 0; +#ifdef OS_WIN32 + int socklen = sizeof(addr); +#else + socklen_t socklen = sizeof(addr); +#endif + + // Validate arguments + if (sock != NULL) + { + if (sock->IPv6) + { + return RecvFrom6(sock, src_addr, src_port, data, size); + } + + sock->IgnoreRecvErr = false; + } + else + { + return 0; + } + + if (src_addr == NULL || src_port == NULL || data == NULL || size == 0) + { + return 0; + } + + if (sock->Type != SOCK_UDP || sock->socket == INVALID_SOCKET) + { + return 0; + } + + ret = recvfrom(sock->socket, data, size, 0, (struct sockaddr *)&addr, &socklen); + if (ret > 0) + { + InAddrToIP(src_addr, &addr.sin_addr); + *src_port = (UINT)ntohs(addr.sin_port); + if (sock->IsRawSocket) + { + *src_port = sock->LocalPort; + } + + Lock(sock->lock); + { + sock->RecvNum++; + sock->RecvSize += (UINT64)ret; + } + Unlock(sock->lock); + + return (UINT)ret; + } + else + { +#ifdef OS_WIN32 + if (WSAGetLastError() == WSAECONNRESET || WSAGetLastError() == WSAENETRESET || WSAGetLastError() == WSAEMSGSIZE || WSAGetLastError() == WSAENETUNREACH || + WSAGetLastError() == WSAENOBUFS || WSAGetLastError() == WSAEHOSTUNREACH || WSAGetLastError() == WSAEUSERS || WSAGetLastError() == WSAEADDRNOTAVAIL || WSAGetLastError() == WSAEADDRNOTAVAIL) + { + sock->IgnoreRecvErr = true; + } + else if (WSAGetLastError() == WSAEWOULDBLOCK || WSAGetLastError() == WSAEINPROGRESS) + { + return SOCK_LATER; + } + else + { + Debug("RecvFrom(): recvfrom() failed with error: %u\n", WSAGetLastError()); + } +#else + if (errno == ECONNREFUSED || errno == ECONNRESET || errno == EMSGSIZE || errno == ENOBUFS || errno == ENOMEM || errno == EINTR) + { + sock->IgnoreRecvErr = true; + } + else if (errno == EAGAIN) + { + return SOCK_LATER; + } + else + { + Debug("RecvFrom(): recvfrom() failed with error: %s\n", strerror(errno)); + } +#endif + return 0; + } +} +UINT RecvFrom6(SOCK *sock, IP *src_addr, UINT *src_port, void *data, UINT size) +{ + struct sockaddr_in6 addr; + int ret = 0; +#ifdef OS_WIN32 + int socklen = sizeof(addr); +#else + socklen_t socklen = sizeof(addr); +#endif + + // Validate arguments + if (sock != NULL) + { + sock->IgnoreRecvErr = false; + } + else + { + return 0; + } + + if (src_addr == NULL || src_port == NULL || data == NULL || size == 0) + { + return 0; + } + + if (sock->Type != SOCK_UDP || sock->socket == INVALID_SOCKET) + { + return 0; + } + + + ret = recvfrom(sock->socket, data, size, 0, (struct sockaddr *)&addr, &socklen); + if (ret > 0) + { + InAddrToIP6(src_addr, &addr.sin6_addr); + src_addr->ipv6_scope_id = addr.sin6_scope_id; + *src_port = (UINT)ntohs(addr.sin6_port); + if (sock->IsRawSocket) + { + *src_port = sock->LocalPort; + } + + Lock(sock->lock); + { + sock->RecvNum++; + sock->RecvSize += (UINT64)ret; + } + Unlock(sock->lock); + + return (UINT)ret; + } + else + { +#ifdef OS_WIN32 + if (WSAGetLastError() == WSAECONNRESET || WSAGetLastError() == WSAENETRESET || WSAGetLastError() == WSAEMSGSIZE || WSAGetLastError() == WSAENETUNREACH || + WSAGetLastError() == WSAENOBUFS || WSAGetLastError() == WSAEHOSTUNREACH || WSAGetLastError() == WSAEUSERS || WSAGetLastError() == WSAEADDRNOTAVAIL || WSAGetLastError() == WSAEADDRNOTAVAIL) + { + sock->IgnoreRecvErr = true; + } + else if (WSAGetLastError() == WSAEWOULDBLOCK || WSAGetLastError() == WSAEINPROGRESS) + { + return SOCK_LATER; + } + else + { + Debug("RecvFrom(): recvfrom() failed with error: %u\n", WSAGetLastError()); + } +#else + if (errno == ECONNREFUSED || errno == ECONNRESET || errno == EMSGSIZE || errno == ENOBUFS || errno == ENOMEM || errno == EINTR) + { + sock->IgnoreRecvErr = true; + } + else if (errno == EAGAIN) + { + return SOCK_LATER; + } + else + { + Debug("RecvFrom(): recvfrom() failed with error: %s\n", strerror(errno)); + } +#endif + return 0; + } +} + +// UDP transmission +UINT SendTo(SOCK *sock, IP *dest_addr, UINT dest_port, void *data, UINT size) +{ + return SendToEx(sock, dest_addr, dest_port, data, size, false); +} +UINT SendToEx(SOCK *sock, IP *dest_addr, UINT dest_port, void *data, UINT size, bool broadcast) +{ + SOCKET s; + int ret; + struct sockaddr_in addr; + // Validate arguments + if (sock != NULL) + { + sock->IgnoreSendErr = false; + } + if (sock == NULL || dest_addr == NULL || (sock->IsRawSocket == false && dest_port == 0) || data == NULL) + { + return 0; + } + if (dest_port >= 65536 && sock->IsRawSocket == false) + { + return 0; + } + if (sock->Type != SOCK_UDP || sock->socket == INVALID_SOCKET) + { + return 0; + } + if (size == 0) + { + return 0; + } + + if (sock->IPv6) + { + return SendTo6Ex(sock, dest_addr, dest_port, data, size, broadcast); + } + + if (IsIP4(dest_addr) == false) + { + return 0; + } + + s = sock->socket; + Zero(&addr, sizeof(addr)); + addr.sin_family = AF_INET; + if (sock->IsRawSocket == false) + { + addr.sin_port = htons((USHORT)dest_port); + } + IPToInAddr(&addr.sin_addr, dest_addr); + + if ((dest_addr->addr[0] == 255 && dest_addr->addr[1] == 255 && + dest_addr->addr[2] == 255 && dest_addr->addr[3] == 255) || + (dest_addr->addr[0] >= 224 && dest_addr->addr[0] <= 239) + || broadcast) + { + if (sock->UdpBroadcast == false) + { + bool yes = true; + + sock->UdpBroadcast = true; + + (void)setsockopt(s, SOL_SOCKET, SO_BROADCAST, (char *)&yes, sizeof(yes)); + } + } + + ret = sendto(s, data, size, 0, (struct sockaddr *)&addr, sizeof(addr)); + if (ret != (int)size) + { + sock->IgnoreSendErr = false; + +#ifdef OS_WIN32 + if (WSAGetLastError() == WSAECONNRESET || WSAGetLastError() == WSAENETRESET || WSAGetLastError() == WSAEMSGSIZE || WSAGetLastError() == WSAENETUNREACH || + WSAGetLastError() == WSAENOBUFS || WSAGetLastError() == WSAEHOSTUNREACH || WSAGetLastError() == WSAEUSERS || WSAGetLastError() == WSAEINVAL || WSAGetLastError() == WSAEADDRNOTAVAIL) + { + sock->IgnoreSendErr = true; + } + else if (WSAGetLastError() == WSAEWOULDBLOCK || WSAGetLastError() == WSAEINPROGRESS) + { + return SOCK_LATER; + } + else + { + UINT e = WSAGetLastError(); + Debug("SendTo Error; %u\n", e); + } +#else // OS_WIN32 + if (errno == ECONNREFUSED || errno == ECONNRESET || errno == EMSGSIZE || errno == ENOBUFS || errno == ENOMEM || errno == EINTR) + { + sock->IgnoreSendErr = true; + } + else if (errno == EAGAIN) + { + return SOCK_LATER; + } +#endif // OS_WIN32 + return 0; + } + + Lock(sock->lock); + { + sock->SendSize += (UINT64)size; + sock->SendNum++; + } + Unlock(sock->lock); + + return ret; +} +UINT SendTo6Ex(SOCK *sock, IP *dest_addr, UINT dest_port, void *data, UINT size, bool broadcast) +{ + SOCKET s; + int ret; + struct sockaddr_in6 addr; + UINT type; + // Validate arguments + if (sock != NULL) + { + sock->IgnoreSendErr = false; + } + if (sock == NULL || dest_addr == NULL || (sock->IsRawSocket == false && dest_port == 0) || data == NULL) + { + return 0; + } + if (dest_port >= 65536 && sock->IsRawSocket == false) + { + return 0; + } + if (sock->Type != SOCK_UDP || sock->socket == INVALID_SOCKET) + { + return 0; + } + if (size == 0) + { + return 0; + } + + if (IsIP6(dest_addr) == false) + { + return 0; + } + + s = sock->socket; + Zero(&addr, sizeof(addr)); + addr.sin6_family = AF_INET6; + if (sock->IsRawSocket == false) + { + addr.sin6_port = htons((USHORT)dest_port); + } + IPToInAddr6(&addr.sin6_addr, dest_addr); + addr.sin6_scope_id = dest_addr->ipv6_scope_id; + + type = GetIPAddrType6(dest_addr); + + if ((type & IPV6_ADDR_MULTICAST) || broadcast) + { + if (sock->UdpBroadcast == false) + { + bool yes = true; + + sock->UdpBroadcast = true; + + (void)setsockopt(s, SOL_SOCKET, SO_BROADCAST, (char *)&yes, sizeof(yes)); + } + } + + ret = sendto(s, data, size, 0, (struct sockaddr *)&addr, sizeof(addr)); + if (ret != (int)size) + { + sock->IgnoreSendErr = false; + +#ifdef OS_WIN32 + if (WSAGetLastError() == WSAECONNRESET || WSAGetLastError() == WSAENETRESET || WSAGetLastError() == WSAEMSGSIZE || WSAGetLastError() == WSAENETUNREACH || + WSAGetLastError() == WSAENOBUFS || WSAGetLastError() == WSAEHOSTUNREACH || WSAGetLastError() == WSAEUSERS || WSAGetLastError() == WSAEINVAL || WSAGetLastError() == WSAEADDRNOTAVAIL) + { + sock->IgnoreSendErr = true; + } + else if (WSAGetLastError() == WSAEWOULDBLOCK || WSAGetLastError() == WSAEINPROGRESS) + { + return SOCK_LATER; + } + else + { + UINT e = WSAGetLastError(); + } +#else // OS_WIN32 + if (errno == ECONNREFUSED || errno == ECONNRESET || errno == EMSGSIZE || errno == ENOBUFS || errno == ENOMEM || errno == EINTR) + { + sock->IgnoreSendErr = true; + } + else if (errno == EAGAIN) + { + return SOCK_LATER; + } +#endif // OS_WIN32 + return 0; + } + + Lock(sock->lock); + { + sock->SendSize += (UINT64)size; + sock->SendNum++; + } + Unlock(sock->lock); + + return ret; +} + +// Open a UDP port (port number is random, but determine the randomness in the seed) +SOCK *NewUDPEx2Rand(bool ipv6, IP *ip, void *rand_seed, UINT rand_seed_size, UINT num_retry) +{ + UINT i; + // Validate arguments + if (rand_seed == NULL || rand_seed_size == 0) + { + return NULL; + } + if (num_retry == 0) + { + num_retry = RAND_UDP_PORT_DEFAULT_NUM_RETRY; + } + + for (i = 0; i < (num_retry + 1); i++) + { + BUF *buf = NewBuf(); + UCHAR hash[SHA1_SIZE]; + UINT port = 0; + SOCK *s; + + WriteBuf(buf, rand_seed, rand_seed_size); + WriteBufInt(buf, i); + + Sha1(hash, buf->Buf, buf->Size); + + FreeBuf(buf); + + port = READ_UINT(hash); + + port = RAND_UDP_PORT_START + (port % (RAND_UDP_PORT_END - RAND_UDP_PORT_START)); + + s = NewUDPEx2(port, ipv6, ip); + + if (s != NULL) + { + return s; + } + } + + return NewUDPEx2(0, ipv6, ip); +} + +// Open the UDP port (based on the EXE path and machine key) +SOCK *NewUDPEx2RandMachineAndExePath(bool ipv6, IP *ip, UINT num_retry, UCHAR rand_port_id) +{ + BUF *b; + char machine_name[MAX_SIZE]; + wchar_t exe_path[MAX_PATH]; + char *product_id = NULL; + UCHAR hash[SHA1_SIZE]; + +#ifdef OS_WIN32 + product_id = MsRegReadStr(REG_LOCAL_MACHINE, "SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion", "ProductId"); + if (product_id == NULL) + { + product_id = MsRegReadStr(REG_LOCAL_MACHINE, "SOFTWARE\\Microsoft\\Windows\\CurrentVersion", "ProductId"); + } +#endif // OS_WIN32 + + b = NewBuf(); + + GetMachineHostName(machine_name, sizeof(machine_name)); + Trim(machine_name); + StrUpper(machine_name); + + GetExeNameW(exe_path, sizeof(exe_path)); + UniTrim(exe_path); + UniStrUpper(exe_path); + + WriteBuf(b, machine_name, StrSize(machine_name)); + WriteBuf(b, exe_path, UniStrSize(exe_path)); + WriteBuf(b, product_id, StrSize(product_id)); + WriteBufChar(b, rand_port_id); + //WriteBufInt(b, GetHostIPAddressHash32()); + + Sha1(hash, b->Buf, b->Size); + + FreeBuf(b); + + Free(product_id); + + return NewUDPEx2Rand(ipv6, ip, hash, sizeof(hash), num_retry); +} + +// Set the DF bit of the socket +void ClearSockDfBit(SOCK *s) +{ +#ifdef IP_PMTUDISC_DONT +#ifdef IP_MTU_DISCOVER + UINT value = IP_PMTUDISC_DONT; + if (s == NULL) + { + return; + } + + (void)setsockopt(s->socket, IPPROTO_IP, IP_MTU_DISCOVER, (char *)&value, sizeof(value)); +#endif // IP_MTU_DISCOVER +#endif // IP_PMTUDISC_DONT +} + +// Set the header-include option +void SetRawSockHeaderIncludeOption(SOCK *s, bool enable) +{ + UINT value = BOOL_TO_INT(enable); + if (s == NULL || s->IsRawSocket == false) + { + return; + } + + (void)setsockopt(s->socket, IPPROTO_IP, IP_HDRINCL, (char *)&value, sizeof(value)); + + s->RawIP_HeaderIncludeFlag = enable; +} + +// Create and initialize the UDP socket +// If port is specified as 0, system assigns a certain port. +SOCK *NewUDP(UINT port) +{ + return NewUDPEx(port, false); +} +SOCK *NewUDPEx(UINT port, bool ipv6) +{ + return NewUDPEx2(port, ipv6, NULL); +} +SOCK *NewUDPEx2(UINT port, bool ipv6, IP *ip) +{ + if (ipv6 == false) + { + return NewUDP4(port, ip); + } + else + { + return NewUDP6(port, ip); + } +} +SOCK *NewUDPEx3(UINT port, IP *ip) +{ + // Validate arguments + if (ip == NULL) + { + return NewUDPEx2(port, false, NULL); + } + + if (IsIP4(ip)) + { + return NewUDPEx2(port, false, ip); + } + else + { + return NewUDPEx2(port, true, ip); + } +} +SOCK *NewUDP4(UINT port, IP *ip) +{ + SOCK *sock; + SOCKET s; + struct sockaddr_in addr; + // Validate arguments + if (ip != NULL && IsIP4(ip) == false) + { + return NULL; + } + + if (IS_SPECIAL_PORT(port) == false) + { + s = socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP); + } + else + { + s = socket(AF_INET, SOCK_RAW, GET_SPECIAL_PORT(port)); + } + if (s == INVALID_SOCKET) + { + return NULL; + } + + Zero(&addr, sizeof(addr)); + addr.sin_family = AF_INET; + + if (ip == NULL || IsZeroIP(ip)) + { + addr.sin_addr.s_addr = htonl(INADDR_ANY); + } + else + { + IPToInAddr(&addr.sin_addr, ip); + } + + if (port == 0 || IS_SPECIAL_PORT(port)) + { + addr.sin_port = 0; + } + else + { + addr.sin_port = htons((USHORT)port); + } + + if (bind(s, (struct sockaddr *)&addr, sizeof(addr)) != 0) + { + // Failure + if (port != 0) + { + bool true_flag = true; + (void)setsockopt(s, SOL_SOCKET, SO_REUSEADDR, (char *)&true_flag, sizeof(bool)); + if (bind(s, (struct sockaddr *)&addr, sizeof(addr)) != 0) + { + bool false_flag = false; + (void)setsockopt(s, SOL_SOCKET, SO_REUSEADDR, (char *)&false_flag, sizeof(bool)); +#ifdef SO_EXCLUSIVEADDRUSE + (void)setsockopt(s, SOL_SOCKET, SO_EXCLUSIVEADDRUSE, (char *)&true_flag, sizeof(bool)); +#endif // SO_EXCLUSIVEADDRUSE + if (bind(s, (struct sockaddr *)&addr, sizeof(addr)) != 0) + { + closesocket(s); + return NULL; + } + } + } + else + { + closesocket(s); + return NULL; + } + } + + sock = NewSock(); + + sock->Type = SOCK_UDP; + sock->Connected = false; + sock->AsyncMode = false; + sock->ServerMode = false; + if (port != 0) + { + sock->ServerMode = true; + } + + sock->socket = s; + + InitUdpSocketBufferSize((int)s); + + if (IS_SPECIAL_PORT(port)) + { + bool no = false; + (void)setsockopt(sock->socket, IPPROTO_IP, IP_HDRINCL, (char *)&no, sizeof(no)); + + sock->IsRawSocket = true; + sock->RawSocketIPProtocol = GET_SPECIAL_PORT(port); + } + + QuerySocketInformation(sock); + + return sock; +} +SOCK *NewUDP6(UINT port, IP *ip) +{ + SOCK *sock; + SOCKET s; + struct sockaddr_in6 addr; + // Validate arguments + if (ip != NULL && IsIP6(ip) == false) + { + return NULL; + } + + if (IS_SPECIAL_PORT(port) == false) + { + s = socket(AF_INET6, SOCK_DGRAM, IPPROTO_UDP); + } + else + { + s = socket(AF_INET6, SOCK_RAW, GET_SPECIAL_PORT(port)); + } + if (s == INVALID_SOCKET) + { + return NULL; + } + + Zero(&addr, sizeof(addr)); + addr.sin6_family = AF_INET6; + if (port == 0) + { + addr.sin6_port = 0; + } + else + { + addr.sin6_port = htons((USHORT)port); + } + + if (ip != NULL && IsZeroIP(ip) == false) + { + IPToInAddr6(&addr.sin6_addr, ip); + addr.sin6_scope_id = ip->ipv6_scope_id; + } + + if (bind(s, (struct sockaddr *)&addr, sizeof(addr)) != 0) + { + // Failure + if (port != 0) + { + bool true_flag = true; + (void)setsockopt(s, SOL_SOCKET, SO_REUSEADDR, (char *)&true_flag, sizeof(bool)); + if (bind(s, (struct sockaddr *)&addr, sizeof(addr)) != 0) + { + bool false_flag = false; + (void)setsockopt(s, SOL_SOCKET, SO_REUSEADDR, (char *)&false_flag, sizeof(bool)); +#ifdef SO_EXCLUSIVEADDRUSE + (void)setsockopt(s, SOL_SOCKET, SO_EXCLUSIVEADDRUSE, (char *)&true_flag, sizeof(bool)); +#endif // SO_EXCLUSIVEADDRUSE + if (bind(s, (struct sockaddr *)&addr, sizeof(addr)) != 0) + { + closesocket(s); + return NULL; + } + } + } + else + { + closesocket(s); + return NULL; + } + } + + sock = NewSock(); + + sock->Type = SOCK_UDP; + sock->Connected = false; + sock->AsyncMode = false; + sock->ServerMode = false; + sock->IPv6 = true; + if (port != 0) + { + sock->ServerMode = true; + } + + sock->socket = s; + + InitUdpSocketBufferSize(s); + + if (IS_SPECIAL_PORT(port)) + { + bool no = false; +#ifdef IPV6_HDRINCL + (void)setsockopt(sock->socket, IPPROTO_IP, IPV6_HDRINCL, (char *)&no, sizeof(no)); +#endif // IPV6_HDRINCL + (void)setsockopt(sock->socket, IPPROTO_IP, IP_HDRINCL, (char *)&no, sizeof(no)); + + sock->IsRawSocket = true; + sock->RawSocketIPProtocol = GET_SPECIAL_PORT(port); + } + + QuerySocketInformation(sock); + + return sock; +} + +// Select function +void Select(SOCKSET *set, UINT timeout, CANCEL *c1, CANCEL *c2) +{ +#ifdef OS_WIN32 + Win32Select(set, timeout, c1, c2); +#else + UnixSelect(set, timeout, c1, c2); +#endif // OS_WIN32 +} + +// Add a socket to the socket set +void AddSockSet(SOCKSET *set, SOCK *sock) +{ + // Validate arguments + if (set == NULL || sock == NULL) + { + return; + } + if (sock->Type == SOCK_TCP && sock->Connected == false) + { + return; + } + + if (set->NumSocket >= MAX_SOCKSET_NUM) + { + // Upper limit + return; + } + set->Sock[set->NumSocket++] = sock; +} + +// Initializing the socket set +void InitSockSet(SOCKSET *set) +{ + // Validate arguments + if (set == NULL) + { + return; + } + + Zero(set, sizeof(SOCKSET)); +} + +// Receive data and discard all of them +bool RecvAllWithDiscard(SOCK *sock, UINT size, bool secure) +{ + static UCHAR buffer[4096]; + UINT recv_size, sz, ret; + if (sock == NULL) + { + return false; + } + if (size == 0) + { + return true; + } + if (sock->AsyncMode) + { + return false; + } + + recv_size = 0; + + while (true) + { + sz = MIN(size - recv_size, sizeof(buffer)); + ret = Recv(sock, buffer, sz, secure); + if (ret == 0) + { + return false; + } + if (ret == SOCK_LATER) + { + // I suppose that this is safe because the RecvAll() function is used only + // if the sock->AsyncMode == true. And the Recv() function may return + // SOCK_LATER only if the sock->AsyncMode == false. Therefore the call of + // Recv() function in the RecvAll() function never returns SOCK_LATER. + return false; + } + recv_size += ret; + if (recv_size >= size) + { + return true; + } + } +} + +// Receive all by TCP +bool RecvAll(SOCK *sock, void *data, UINT size, bool secure) +{ + UINT recv_size, sz, ret; + // Validate arguments + if (sock == NULL || data == NULL) + { + return false; + } + if (size == 0) + { + return true; + } + if (sock->AsyncMode) + { + return false; + } + + recv_size = 0; + + while (true) + { + sz = size - recv_size; + ret = Recv(sock, (UCHAR *)data + recv_size, sz, secure); + if (ret == 0) + { + return false; + } + if (ret == SOCK_LATER) + { + // I suppose that this is safe because the RecvAll() function is used only + // if the sock->AsyncMode == true. And the Recv() function may return + // SOCK_LATER only if the sock->AsyncMode == false. Therefore the call of + // Recv() function in the RecvAll() function never returns SOCK_LATER. + return false; + } + recv_size += ret; + if (recv_size >= size) + { + return true; + } + } +} + +// Send the TCP send buffer +bool SendNow(SOCK *sock, int secure) +{ + bool ret; + // Validate arguments + if (sock == NULL || sock->AsyncMode != false) + { + return false; + } + if (sock->SendBuf->Size == 0) + { + return true; + } + + ret = SendAll(sock, sock->SendBuf->Buf, sock->SendBuf->Size, secure); + ClearBuf(sock->SendBuf); + + return ret; +} + +// Append to the TCP send buffer +void SendAdd(SOCK *sock, void *data, UINT size) +{ + // Validate arguments + if (sock == NULL || data == NULL || size == 0 || sock->AsyncMode != false) + { + return; + } + + WriteBuf(sock->SendBuf, data, size); +} + +// Send all by TCP +bool SendAll(SOCK *sock, void *data, UINT size, bool secure) +{ + UCHAR *buf; + UINT sent_size; + UINT ret; + // Validate arguments + if (sock == NULL || data == NULL) + { + return false; + } + if (sock->AsyncMode) + { + return false; + } + if (size == 0) + { + return true; + } + + buf = (UCHAR *)data; + sent_size = 0; + + while (true) + { + ret = Send(sock, buf, size - sent_size, secure); + if (ret == 0) + { + return false; + } + sent_size += ret; + buf += ret; + if (sent_size >= size) + { + return true; + } + } +} + +// Set the cipher algorithm name to want to use +void SetWantToUseCipher(SOCK *sock, char *name) +{ + // Validate arguments + if (sock == NULL || name == NULL) + { + return; + } + + if (sock->WaitToUseCipher) + { + Free(sock->WaitToUseCipher); + } + + sock->WaitToUseCipher = CopyStr(name); +} + +// Add all the chain certificates in the chain_certs directory +void AddChainSslCertOnDirectory(struct ssl_ctx_st *ctx) +{ + wchar_t dirname[MAX_SIZE]; + wchar_t exedir[MAX_SIZE]; + wchar_t txtname[MAX_SIZE]; + DIRLIST *dir; + LIST *o; + UINT i; + + // Validate arguments + if (ctx == NULL) + { + return; + } + + o = NewListFast(NULL); + + GetDbDirW(exedir, sizeof(exedir)); + + CombinePathW(dirname, sizeof(dirname), exedir, L"chain_certs"); + + MakeDirExW(dirname); + + CombinePathW(txtname, sizeof(txtname), dirname, L"Readme_Chain_Certs.txt"); + + if (IsFileExistsW(txtname) == false) + { + FileCopyW(L"|chain_certs.txt", txtname); + } + + dir = EnumDirW(dirname); + + if (dir != NULL) + { + for (i = 0; i < dir->NumFiles; i++) + { + DIRENT *e = dir->File[i]; + + if (e->Folder == false) + { + wchar_t tmp[MAX_SIZE]; + X *x; + + CombinePathW(tmp, sizeof(tmp), dirname, e->FileNameW); + + x = FileToXW(tmp); + + if (x != NULL) + { + UINT j; + bool exists = false; + UCHAR hash[SHA1_SIZE]; + + GetXDigest(x, hash, true); + + for (j = 0; j < LIST_NUM(o); j++) + { + UCHAR *hash2 = LIST_DATA(o, j); + + if (Cmp(hash, hash2, SHA1_SIZE) == 0) + { + exists = true; + } + } + + if (exists == false) + { + AddChainSslCert(ctx, x); + + Add(o, Clone(hash, SHA1_SIZE)); + } + + FreeX(x); + } + } + } + + FreeDir(dir); + } + + for (i = 0; i < LIST_NUM(o); i++) + { + UCHAR *hash = LIST_DATA(o, i); + + Free(hash); + } + + ReleaseList(o); +} + +// Add the chain certificate +bool AddChainSslCert(struct ssl_ctx_st *ctx, X *x) +{ + bool ret = false; + X *x_copy; + // Validate arguments + if (ctx == NULL || x == NULL) + { + return ret; + } + + x_copy = CloneX(x); + + if (x_copy != NULL) + { + if (x_copy->root_cert) + { + X509_STORE *store = SSL_CTX_get_cert_store(ctx); + X509_STORE_add_cert(store, x_copy->x509); + X509_free(x_copy->x509); + } + else + { + SSL_CTX_add_extra_chain_cert(ctx, x_copy->x509); + } + x_copy->do_not_free = true; + + ret = true; + + FreeX(x_copy); + } + + return ret; +} + +// Start a TCP-SSL communication +bool StartSSL(SOCK *sock, X *x, K *priv) +{ + return StartSSLEx(sock, x, priv, 0, NULL); +} +bool StartSSLEx(SOCK *sock, X *x, K *priv, UINT ssl_timeout, char *sni_hostname) +{ + X509 *x509; + EVP_PKEY *key; + UINT prev_timeout = 1024; + SSL_CTX *ssl_ctx; + +#ifdef UNIX_SOLARIS + SOCKET_TIMEOUT_PARAM *ttparam; +#endif //UNIX_SOLARIS + + // Validate arguments + if (sock == NULL) + { + Debug("StartSSL Error: #0\n"); + return false; + } + if (sock->Connected && sock->Type == SOCK_INPROC && sock->ListenMode == false) + { + sock->SecureMode = true; + return true; + } + if (sock->Connected == false || sock->socket == INVALID_SOCKET || + sock->ListenMode != false) + { + Debug("StartSSL Error: #1\n"); + return false; + } + if (x != NULL && priv == NULL) + { + Debug("StartSSL Error: #2\n"); + return false; + } + if (ssl_timeout == 0) + { + ssl_timeout = TIMEOUT_SSL_CONNECT; + } + + if (sock->SecureMode) + { + //Debug("StartSSL Error: #3\n"); + // SSL communication has already started + return true; + } + + Lock(sock->ssl_lock); + if (sock->SecureMode) + { + //Debug("StartSSL Error: #4\n"); + // SSL communication has already started + Unlock(sock->ssl_lock); + return true; + } + + ssl_ctx = NewSSLCtx(sock->ServerMode); + + Lock(openssl_lock); + { + if (sock->ServerMode) + { +#ifdef SSL_OP_NO_TLSv1 + if (sock->SslAcceptSettings.Tls_Disable1_0) + { + SSL_CTX_set_options(ssl_ctx, SSL_OP_NO_TLSv1); + } +#endif // SSL_OP_NO_TLSv1 + +#ifdef SSL_OP_NO_TLSv1_1 + if (sock->SslAcceptSettings.Tls_Disable1_1) + { + SSL_CTX_set_options(ssl_ctx, SSL_OP_NO_TLSv1_1); + } +#endif // SSL_OP_NO_TLSv1_1 + +#ifdef SSL_OP_NO_TLSv1_2 + if (sock->SslAcceptSettings.Tls_Disable1_2) + { + SSL_CTX_set_options(ssl_ctx, SSL_OP_NO_TLSv1_2); + } +#endif // SSL_OP_NO_TLSv1_2 + +#ifdef SSL_OP_NO_TLSv1_3 + if (sock->SslAcceptSettings.Tls_Disable1_3) + { + SSL_CTX_set_options(ssl_ctx, SSL_OP_NO_TLSv1_3); + } +#endif // SSL_OP_NO_TLSv1_3 + +#if OPENSSL_VERSION_NUMBER >= 0x10100000L && !defined(LIBRESSL_VERSION_NUMBER) + if (sock->SslAcceptSettings.Override_Security_Level) + { + SSL_CTX_set_security_level(ssl_ctx, sock->SslAcceptSettings.Override_Security_Level_Value); + } +#endif + + Unlock(openssl_lock); + AddChainSslCertOnDirectory(ssl_ctx); + Lock(openssl_lock); + } + + sock->ssl = SSL_new(ssl_ctx); + SSL_set_fd(sock->ssl, (int)sock->socket); + +#ifdef SSL_CTRL_SET_TLSEXT_HOSTNAME + if (sock->ServerMode == false) + { + if (IsEmptyStr(sni_hostname) == false) + { + // Set the SNI host name + SSL_set_tlsext_host_name(sock->ssl, sni_hostname); + } + } +#endif // SSL_CTRL_SET_TLSEXT_HOSTNAME + + } + Unlock(openssl_lock); + + if (x != NULL) + { + // Check the certificate and the private key + if (CheckXandK(x, priv)) + { + // Use the certificate + x509 = x->x509; + key = priv->pkey; + + Lock(openssl_lock); + { + SSL_use_certificate(sock->ssl, x509); + SSL_use_PrivateKey(sock->ssl, key); + } + Unlock(openssl_lock); + } + } + + if (sock->WaitToUseCipher != NULL) + { + // Set the cipher algorithm name to want to use + Lock(openssl_lock); + { + if (SSL_set_cipher_list(sock->ssl, sock->WaitToUseCipher) == 0) + SSL_set_cipher_list(sock->ssl, DEFAULT_CIPHER_LIST); + } + Unlock(openssl_lock); + } + + if (sock->ServerMode) + { +// Lock(ssl_connect_lock); + +// Run the time-out thread for SOLARIS +#ifdef UNIX_SOLARIS + ttparam = NewSocketTimeout(sock); +#endif // UNIX_SOLARIS + + // Server mode + if (SSL_accept(sock->ssl) <= 0) + { + +// Stop the timeout thread +#ifdef UNIX_SOLARIS + FreeSocketTimeout(ttparam); +#endif // UNIX_SOLARIS + + // Unlock(ssl_connect_lock); + // SSL-Accept failure + Lock(openssl_lock); + { + SSL_free(sock->ssl); + sock->ssl = NULL; + } + Unlock(openssl_lock); + + Unlock(sock->ssl_lock); + Debug("StartSSL Error: #5\n"); + FreeSSLCtx(ssl_ctx); + return false; + } + +#ifdef SSL_CTRL_SET_TLSEXT_HOSTNAME +#ifdef TLSEXT_NAMETYPE_host_name + if (true) + { + // Get the SNI host name + const char *sni_recv_hostname = SSL_get_servername(sock->ssl, TLSEXT_NAMETYPE_host_name); + + if (IsEmptyStr((char *)sni_recv_hostname) == false) + { + StrCpy(sock->SniHostname, sizeof(sock->SniHostname), (char *)sni_recv_hostname); + } + } +#endif // TLSEXT_NAMETYPE_host_name +#endif // SSL_CTRL_SET_TLSEXT_HOSTNAME + +// Stop the timeout thread +#ifdef UNIX_SOLARIS + FreeSocketTimeout(ttparam); +#endif // UNIX_SOLARIS + + // Unlock(ssl_connect_lock); + } + else + { + prev_timeout = GetTimeout(sock); + SetTimeout(sock, ssl_timeout); + Lock(ssl_connect_lock); + // Client mode + if (SSL_connect(sock->ssl) <= 0) + { + Unlock(ssl_connect_lock); + // SSL-connect failure + Lock(openssl_lock); + { + SSL_free(sock->ssl); + sock->ssl = NULL; + } + Unlock(openssl_lock); + + Unlock(sock->ssl_lock); + Debug("StartSSL Error: #5\n"); + SetTimeout(sock, prev_timeout); + FreeSSLCtx(ssl_ctx); + return false; + } + Unlock(ssl_connect_lock); + SetTimeout(sock, prev_timeout); + } + + // SSL communication is initiated + sock->SecureMode = true; + + // Get the certificate of the remote host + Lock(openssl_lock); + { + x509 = SSL_get_peer_certificate(sock->ssl); + + sock->SslVersion = SSL_get_version(sock->ssl); + } + Unlock(openssl_lock); + + if (x509 == NULL) + { + // The certificate does not exist on the remote host + sock->RemoteX = NULL; + } + else + { + // Got a certificate + sock->RemoteX = X509ToX(x509); + } + + // Get the certificate of local host + Lock(openssl_lock); + { + x509 = SSL_get_certificate(sock->ssl); + } + Unlock(openssl_lock); + + if (x509 == NULL) + { + // The certificate does not exist on the remote host + sock->LocalX = NULL; + } + else + { + X *local_x; + // Got a certificate + local_x = X509ToX(x509); + local_x->do_not_free = true; + sock->LocalX = CloneX(local_x); + FreeX(local_x); + } + + // Automatic retry mode + SSL_set_mode(sock->ssl, SSL_MODE_AUTO_RETRY); + + // Strange flag + SSL_set_mode(sock->ssl, SSL_MODE_ACCEPT_MOVING_WRITE_BUFFER); + + sock->ssl_ctx = ssl_ctx; + + // Get the algorithm name used to encrypt + Lock(openssl_lock); + { + sock->CipherName = CopyStr((char *)SSL_get_cipher(sock->ssl)); + } + Unlock(openssl_lock); + + Unlock(sock->ssl_lock); + +#ifdef ENABLE_SSL_LOGGING + if (sock->ServerMode) + { + SockEnableSslLogging(sock); + } +#endif // ENABLE_SSL_LOGGING + + return true; +} + + + +#ifdef ENABLE_SSL_LOGGING + +// Enable SSL logging +void SockEnableSslLogging(SOCK *s) +{ + char dirname[MAX_PATH]; + char tmp[MAX_PATH]; + char dtstr[MAX_PATH]; + char fn1[MAX_PATH], fn2[MAX_PATH]; + // Validate arguments + if (s == NULL) + { + return; + } + + if (s->IsSslLoggingEnabled) + { + return; + } + + s->IsSslLoggingEnabled = true; + + GetDateTimeStrMilli64ForFileName(dtstr, sizeof(dtstr), LocalTime64()); + Format(tmp, sizeof(tmp), "%s__%r_%u__%r_%u", dtstr, + &s->LocalIP, s->LocalPort, &s->RemoteIP, s->RemotePort); + + CombinePath(dirname, sizeof(dirname), SSL_LOGGING_DIRNAME, tmp); + + MakeDirEx(dirname); + + CombinePath(fn1, sizeof(fn1), dirname, "send.c"); + CombinePath(fn2, sizeof(fn2), dirname, "recv.c"); + + s->SslLogging_Send = FileCreate(fn1); + s->SslLogging_Recv = FileCreate(fn2); + + s->SslLogging_Lock = NewLock(); +} + +// Close SSL logging +void SockCloseSslLogging(SOCK *s) +{ + // Validate arguments + if (s == NULL) + { + return; + } + + if (s->IsSslLoggingEnabled == false) + { + return; + } + + s->IsSslLoggingEnabled = false; + + FileClose(s->SslLogging_Recv); + s->SslLogging_Recv = NULL; + + FileClose(s->SslLogging_Send); + s->SslLogging_Send = NULL; + + DeleteLock(s->SslLogging_Lock); + s->SslLogging_Lock = NULL; +} + +// Write SSL log +void SockWriteSslLog(SOCK *s, void *send_data, UINT send_size, void *recv_data, UINT recv_size) +{ + // Validate arguments + if (s == NULL) + { + return; + } + + if (s->IsSslLoggingEnabled == false) + { + return; + } + + Lock(s->SslLogging_Lock); + { + if (s->SslLogging_Send != NULL) + { + if (send_size >= 1 && send_data != NULL) + { + FileWrite(s->SslLogging_Send, send_data, send_size); + } + } + + if (s->SslLogging_Recv != NULL) + { + if (recv_size >= 1 && recv_data != NULL) + { + FileWrite(s->SslLogging_Recv, recv_data, recv_size); + } + } + } + Unlock(s->SslLogging_Lock); +} + +#endif // ENABLE_SSL_LOGGING + +// Set the flag to indicate that the socket doesn't require reading +void SetNoNeedToRead(SOCK *sock) +{ + // Validate arguments + if (sock == NULL) + { + return; + } + + sock->NoNeedToRead = true; +} + +// TCP-SSL receive +UINT SecureRecv(SOCK *sock, void *data, UINT size) +{ + int ret, e = SSL_ERROR_NONE; + SSL *ssl; + +#ifdef UNIX_SOLARIS + SOCKET_TIMEOUT_PARAM *ttparam; +#endif //UNIX_SOLARIS + + ssl = sock->ssl; + + if (sock->AsyncMode) + { + // Confirm whether the data is readable even 1 byte in the case of asynchronous mode. + // To read data results blocking, if there is no readable data. + // We must avoid blocking. + char c; + Lock(sock->ssl_lock); + { + if (sock->Connected == false) + { + Unlock(sock->ssl_lock); + Debug("%s %u SecureRecv() Disconnect\n", __FILE__, __LINE__); + return 0; + } + ret = SSL_peek(ssl, &c, sizeof(c)); + } + Unlock(sock->ssl_lock); + if (ret == 0) + { + // The communication have been disconnected + Disconnect(sock); + Debug("%s %u SecureRecv() Disconnect\n", __FILE__, __LINE__); + return 0; + } + if (ret < 0) + { + // An error has occurred + e = SSL_get_error(ssl, ret); + if (e == SSL_ERROR_WANT_READ || e == SSL_ERROR_WANT_WRITE || e == SSL_ERROR_SSL) + { + if (e == SSL_ERROR_SSL +#if OPENSSL_VERSION_NUMBER < 0x10100000L + && + sock->ssl->s3->send_alert[0] == SSL3_AL_FATAL && + sock->ssl->s3->send_alert[0] != sock->Ssl_Init_Async_SendAlert[0] && + sock->ssl->s3->send_alert[1] != sock->Ssl_Init_Async_SendAlert[1] +#endif + ) + { + Debug("%s %u SSL Fatal Error on ASYNC socket !!!\n", __FILE__, __LINE__); + Disconnect(sock); + return 0; + } + // Packet has not arrived yet, that is not to be read + return SOCK_LATER; + } + } + } + + // Receive + Lock(sock->ssl_lock); + { + if (sock->Connected == false) + { + Unlock(sock->ssl_lock); + Debug("%s %u SecureRecv() Disconnect\n", __FILE__, __LINE__); + return 0; + } + +#ifdef OS_UNIX + if (sock->AsyncMode == false) + { + sock->CallingThread = pthread_self(); + } +#endif // OS_UNIX + +// Run the time-out thread for SOLARIS +#ifdef UNIX_SOLARIS + ttparam = NewSocketTimeout(sock); +#endif // UNIX_SOLARIS + + ret = SSL_read(ssl, data, size); + +// Stop the timeout thread +#ifdef UNIX_SOLARIS + FreeSocketTimeout(ttparam); +#endif // UNIX_SOLARIS + + +#ifdef OS_UNIX + if (sock->AsyncMode == false) + { + sock->CallingThread = 0; + } +#endif // OS_UNIX + + if (ret < 0) + { + e = SSL_get_error(ssl, ret); + } + + } + Unlock(sock->ssl_lock); + +#ifdef ENABLE_SSL_LOGGING + if (ret > 0) + { + SockWriteSslLog(sock, NULL, 0, data, ret); + } +#endif // ENABLE_SSL_LOGGING + + if (ret > 0) + { + // Successful reception + sock->RecvSize += (UINT64)ret; + sock->RecvNum++; + + return (UINT)ret; + } + if (ret == 0) + { + // Disconnect the communication + Disconnect(sock); + //Debug("%s %u SecureRecv() Disconnect\n", __FILE__, __LINE__); + return 0; + } + if (sock->AsyncMode) + { + if (e == SSL_ERROR_WANT_READ || e == SSL_ERROR_WANT_WRITE || e == SSL_ERROR_SSL) + { + if (e == SSL_ERROR_SSL +#if OPENSSL_VERSION_NUMBER < 0x10100000L + && + sock->ssl->s3->send_alert[0] == SSL3_AL_FATAL && + sock->ssl->s3->send_alert[0] != sock->Ssl_Init_Async_SendAlert[0] && + sock->ssl->s3->send_alert[1] != sock->Ssl_Init_Async_SendAlert[1] +#endif + ) + { + Debug("%s %u SSL Fatal Error on ASYNC socket !!!\n", __FILE__, __LINE__); + Disconnect(sock); + return 0; + } + + // Packet has not yet arrived + return SOCK_LATER; + } + } + Disconnect(sock); + Debug("%s %u SecureRecv() Disconnect\n", __FILE__, __LINE__); + return 0; +} + +// TCP-SSL transmission +UINT SecureSend(SOCK *sock, void *data, UINT size) +{ + int ret, e = SSL_ERROR_NONE; + SSL *ssl; + ssl = sock->ssl; + + if (sock->AsyncMode) + { + // Asynchronous mode + SSL_set_mode(ssl, SSL_MODE_ENABLE_PARTIAL_WRITE); + } + + // Transmission + Lock(sock->ssl_lock); + { + if (sock->Connected == false) + { + Unlock(sock->ssl_lock); + Debug("%s %u SecureSend() Disconnect\n", __FILE__, __LINE__); + return 0; + } + + ret = SSL_write(ssl, data, size); + if (ret < 0) + { + e = SSL_get_error(ssl, ret); + } + } + Unlock(sock->ssl_lock); + +#ifdef ENABLE_SSL_LOGGING + if (ret > 0) + { + SockWriteSslLog(sock, data, ret, NULL, 0); + } +#endif // ENABLE_SSL_LOGGING + + if (ret > 0) + { + // Successful transmission + sock->SendSize += (UINT64)ret; + sock->SendNum++; + sock->WriteBlocked = false; + return (UINT)ret; + } + if (ret == 0) + { + // Disconnect + Debug("%s %u SecureSend() Disconnect\n", __FILE__, __LINE__); + Disconnect(sock); + return 0; + } + + if (sock->AsyncMode) + { + // Confirmation of the error value + if (e == SSL_ERROR_WANT_READ || e == SSL_ERROR_WANT_WRITE || e == SSL_ERROR_SSL) + { + sock->WriteBlocked = true; + return SOCK_LATER; + } + Debug("%s %u e=%u\n", __FILE__, __LINE__, e); + } + //Debug("%s %u SecureSend() Disconnect\n", __FILE__, __LINE__); + Disconnect(sock); + return 0; +} + +// Peep the TCP +UINT Peek(SOCK *sock, void *data, UINT size) +{ + SOCKET s; + int ret; + + // Validate arguments + if (sock == NULL || data == NULL || size == 0) + { + return 0; + } + if (sock->Type == SOCK_INPROC) + { + return 0; + } + if (sock->Type != SOCK_TCP || sock->Connected == false || sock->ListenMode != false || + sock->socket == INVALID_SOCKET) + { + return 0; + } + if (sock->AsyncMode) + { + return 0; + } + + // Receive + s = sock->socket; + + ret = recv(s, data, size, MSG_PEEK); + + //Debug("Peek: %u\n", ret); + + if (ret > 0) + { + return ret; + } + + return 0; +} + +// TCP receive +UINT Recv(SOCK *sock, void *data, UINT size, bool secure) +{ + SOCKET s; + int ret; + +#ifdef UNIX_SOLARIS + SOCKET_TIMEOUT_PARAM *ttparam; +#endif //UNIX_SOLARIS + + // Validate arguments + if (sock == NULL || data == NULL || size == 0) + { + return 0; + } + + sock->NoNeedToRead = false; + + if (sock->Type == SOCK_INPROC) + { + return RecvInProc(sock, data, size); + } + if (sock->Type != SOCK_TCP || sock->Connected == false || sock->ListenMode != false || + sock->socket == INVALID_SOCKET) + { + return 0; + } + if (secure != false && sock->SecureMode == false) + { + return 0; + } + + if (secure) + { + return SecureRecv(sock, data, size); + } + + // Receive + s = sock->socket; + + +#ifdef OS_UNIX + if (sock->AsyncMode == false) + { + sock->CallingThread = pthread_self(); + } +#endif // OS_UNIX + +// Start of the timeout thread for SOLARIS +#ifdef UNIX_SOLARIS + ttparam = NewSocketTimeout(sock); +#endif // UNIX_SOLARIS + + ret = recv(s, data, size, 0); + +// Stop the timeout thread +#ifdef UNIX_SOLARIS + FreeSocketTimeout(ttparam); +#endif // UNIX_SOLARIS + +#ifdef OS_UNIX + if (sock->AsyncMode == false) + { + sock->CallingThread = 0; + } +#endif // OS_UNIX + + if (ret > 0) + { + // Successful reception + Lock(sock->lock); + { + sock->RecvSize += (UINT64)ret; + sock->SendNum++; + } + Unlock(sock->lock); + return (UINT)ret; + } + + // Transmission failure + if (sock->AsyncMode) + { + // In asynchronous mode, examine the error + if (ret == SOCKET_ERROR) + { +#ifdef OS_WIN32 + if (WSAGetLastError() == WSAEWOULDBLOCK) + { + // In blocking + return SOCK_LATER; + } + else + { + //Debug("Socket Error: %u\n", WSAGetLastError()); + } +#else // OS_WIN32 + if (errno == EAGAIN) + { + // In blocking + return SOCK_LATER; + } +#endif // OS_WIN32 + } + } + + // Disconnected + Disconnect(sock); + return 0; +} + +// TCP transmission +UINT Send(SOCK *sock, void *data, UINT size, bool secure) +{ + SOCKET s; + int ret; + // Validate arguments + if (sock == NULL || data == NULL || size == 0) + { + return 0; + } + if (sock->Type == SOCK_INPROC) + { + return SendInProc(sock, data, size); + } + size = MIN(size, MAX_SEND_BUF_MEM_SIZE); + if (sock->Type != SOCK_TCP || sock->Connected == false || sock->ListenMode != false || + sock->socket == INVALID_SOCKET) + { + return 0; + } + if (secure != false && sock->SecureMode == false) + { + return 0; + } + + if (secure) + { + return SecureSend(sock, data, size); + } + + // Transmission + s = sock->socket; + ret = send(s, data, size, 0); + if (ret > 0) + { + // Successful transmission + Lock(sock->lock); + { + sock->SendSize += (UINT64)ret; + sock->SendNum++; + } + Unlock(sock->lock); + sock->WriteBlocked = false; + return (UINT)ret; + } + + // Transmission failure + if (sock->AsyncMode) + { + // In asynchronous mode, examine the error + if (ret == SOCKET_ERROR) + { +#ifdef OS_WIN32 + if (WSAGetLastError() == WSAEWOULDBLOCK) + { + // In blocking + sock->WriteBlocked = true; + return SOCK_LATER; + } + else + { + //Debug("Socket Error: %u\n", WSAGetLastError()); + } +#else // OS_WIN32 + if (errno == EAGAIN) + { + // In blocking + sock->WriteBlocked = true; + return SOCK_LATER; + } +#endif // OS_WIN32 + } + } + + // Disconnected + Disconnect(sock); + return 0; +} + +// Get the time-out value (in milliseconds) +UINT GetTimeout(SOCK *sock) +{ + // Validate arguments + if (sock == NULL) + { + return INFINITE; + } + if (sock->Type != SOCK_TCP && sock->Type != SOCK_INPROC) + { + return INFINITE; + } + + return sock->TimeOut; +} + +// Setting the time-out value (in milliseconds) +void SetTimeout(SOCK *sock, UINT timeout) +{ + // Validate arguments + if (sock == NULL) + { + return; + } + if (sock->Type == SOCK_UDP) + { + return; + } + + if (timeout == INFINITE) + { + timeout = TIMEOUT_INFINITE; + } + + sock->TimeOut = timeout; + +// Debug("SetTimeout(%u)\n",timeout); + + if (sock->Type != SOCK_INPROC) + { +#ifdef OS_WIN32 + setsockopt(sock->socket, SOL_SOCKET, SO_SNDTIMEO, (char *)&timeout, sizeof(UINT)); + setsockopt(sock->socket, SOL_SOCKET, SO_RCVTIMEO, (char *)&timeout, sizeof(UINT)); +#endif + +#ifdef OS_UNIX +#ifndef UNIX_SOLARIS + { + struct timeval tv_timeout; + + tv_timeout.tv_sec = timeout / 1000; // miliseconds to seconds + tv_timeout.tv_usec = (timeout % 1000) * 1000; // miliseconds to microseconds + + (void)setsockopt(sock->socket, SOL_SOCKET, SO_SNDTIMEO, (char *)&tv_timeout, sizeof(tv_timeout)); + (void)setsockopt(sock->socket, SOL_SOCKET, SO_RCVTIMEO, (char *)&tv_timeout, sizeof(tv_timeout)); + } +#endif // UNIX_SOLARIS +#endif // OS_UNIX + } +} + +// Disable GetHostName call by accepting new TCP connection +void DisableGetHostNameWhenAcceptInit() +{ + disable_gethostname_by_accept = true; +} + +// Initialize the connection acceptance +void AcceptInit(SOCK *s) +{ + AcceptInitEx(s, false); +} +void AcceptInitEx(SOCK *s, bool no_lookup_hostname) +{ + char tmp[MAX_SIZE]; + // Validate arguments + if (s == NULL) + { + return; + } + + Zero(tmp, sizeof(tmp)); + + if (disable_gethostname_by_accept == false && no_lookup_hostname == false) + { + if (GetHostName(tmp, sizeof(tmp), &s->RemoteIP) == false || + IsEmptyStr(tmp)) + { + IPToStr(tmp, sizeof(tmp), &s->RemoteIP); + } + } + else + { + IPToStr(tmp, sizeof(tmp), &s->RemoteIP); + } + + if (s->RemoteHostname != NULL) + { + Free(s->RemoteHostname); + } + + s->RemoteHostname = CopyStr(tmp); +} + +// TCP connection acceptance (IPv4) +SOCK *Accept(SOCK *sock) +{ + SOCK *ret; + SOCKET s, new_socket; + int size; + struct sockaddr_in addr; + bool true_flag = true; + // Validate arguments + if (sock == NULL) + { + return NULL; + } + if (sock->Type == SOCK_INPROC) + { + return AcceptInProc(sock); + } + if (sock->Type == SOCK_REVERSE_LISTEN) + { + return AcceptReverse(sock); + } + if (sock->Type == SOCK_RUDP_LISTEN) + { + return AcceptRUDP(sock); + } + if (sock->ListenMode == false || sock->Type != SOCK_TCP || sock->ServerMode == false) + { + return NULL; + } + if (sock->CancelAccept) + { + return NULL; + } + if (sock->IPv6) + { + return Accept6(sock); + } + + s = sock->socket; + if (s == INVALID_SOCKET) + { + return NULL; + } + Zero(&addr, sizeof(addr)); + size = sizeof(addr); + +#ifdef OS_UNIX +#if defined(UNIX_LINUX) || defined(UNIX_MACOS) + UnixIgnoreSignalForThread(SIGUSR1); +#endif // defined(UNIX_LINUX) || defined(UNIX_MACOS) + sock->CallingThread = pthread_self(); +#endif // OS_UNIX + +#ifdef OS_WIN32 + if (sock->EnableConditionalAccept) + { + new_socket = Win32Accept(sock, s, (struct sockaddr *)&addr,(int *)&size, false); + } + else + { + new_socket = accept(s, (struct sockaddr *)&addr,(int *)&size); + } +#else // OS_WIN32 + new_socket = accept(s, (struct sockaddr *)&addr,(int *)&size); +#endif // OS_WIN32 + +#ifdef OS_UNIX + sock->CallingThread = 0; +#endif // OS_UNIX + + if (new_socket == INVALID_SOCKET) + { + if (sock->CancelAccept) + { + sock->AcceptCanceled = true; + } + return NULL; + } + if (sock->CancelAccept) + { + sock->AcceptCanceled = true; + closesocket(new_socket); + return NULL; + } + + ret = NewSock(); + ret->socket = new_socket; + ret->Connected = true; + ret->AsyncMode = false; + ret->Type = SOCK_TCP; + ret->ServerMode = true; + ret->SecureMode = false; + + // Configuring the TCP options + (void)setsockopt(ret->socket, IPPROTO_TCP, TCP_NODELAY, (char *)&true_flag, sizeof(bool)); + + // Initialization of the time-out value + SetTimeout(ret, TIMEOUT_INFINITE); + + // Socket information + QuerySocketInformation(ret); + + if (IsLocalHostIP(&ret->RemoteIP) == false) + { + ret->IpClientAdded = true; + AddIpClient(&ret->RemoteIP); + } + + if (IsZeroIp(&sock->LocalIP) == false && IsLocalHostIP(&sock->LocalIP) == false) + { + IP current_ip; + + if (GetCurrentGlobalIP(¤t_ip, false) == false) + { + SetCurrentGlobalIP(&sock->LocalIP, false); + } + } + + StrCpy(ret->UnderlayProtocol, sizeof(ret->UnderlayProtocol), SOCK_UNDERLAY_NATIVE_V4); + + AddProtocolDetailsStr(ret->ProtocolDetails, sizeof(ret->ProtocolDetails), "IPv4"); + + return ret; +} + +// TCP connection acceptance (IPv6) +SOCK *Accept6(SOCK *sock) +{ + SOCK *ret; + SOCKET s, new_socket; + int size; + struct sockaddr_in6 addr; + bool true_flag = true; + // Validate arguments + if (sock == NULL) + { + return NULL; + } + if (sock->ListenMode == false || sock->Type != SOCK_TCP || sock->ServerMode == false) + { + return NULL; + } + if (sock->CancelAccept) + { + return NULL; + } + if (sock->IPv6 == false) + { + return NULL; + } + + s = sock->socket; + if (s == INVALID_SOCKET) + { + return NULL; + } + Zero(&addr, sizeof(addr)); + size = sizeof(addr); + +#ifdef OS_UNIX +#if defined(UNIX_LINUX) || defined(UNIX_MACOS) + UnixIgnoreSignalForThread(SIGUSR1); +#endif // defined(UNIX_LINUX) || defined(UNIX_MACOS) + sock->CallingThread = pthread_self(); +#endif // OS_UNIX + +#ifdef OS_WIN32 + if (sock->EnableConditionalAccept) + { + new_socket = Win32Accept(sock, s, (struct sockaddr *)&addr,(int *)&size, true); + } + else + { + new_socket = accept(s, (struct sockaddr *)&addr,(int *)&size); + } +#else // OS_WIN32 + new_socket = accept(s, (struct sockaddr *)&addr,(int *)&size); +#endif // OS_WIN32 + +#ifdef OS_UNIX + sock->CallingThread = 0; +#endif // OS_UNIX + + if (new_socket == INVALID_SOCKET) + { + if (sock->CancelAccept) + { + sock->AcceptCanceled = true; + } + return NULL; + } + if (sock->CancelAccept) + { + sock->AcceptCanceled = true; + closesocket(new_socket); + return NULL; + } + + ret = NewSock(); + ret->socket = new_socket; + ret->Connected = true; + ret->AsyncMode = false; + ret->Type = SOCK_TCP; + ret->ServerMode = true; + ret->SecureMode = false; + + // Configuring the TCP options + (void)setsockopt(ret->socket, IPPROTO_TCP, TCP_NODELAY, (char *)&true_flag, sizeof(bool)); + + // Initialize the time-out value + SetTimeout(ret, TIMEOUT_INFINITE); + + // Socket information + QuerySocketInformation(ret); + + if (IsLocalHostIP(&ret->RemoteIP) == false) + { + ret->IpClientAdded = true; + AddIpClient(&ret->RemoteIP); + } + if (IsZeroIp(&sock->LocalIP) == false && IsLocalHostIP(&sock->LocalIP) == false) + { + IP current_ip; + + if (GetCurrentGlobalIP(¤t_ip, true) == false) + { + SetCurrentGlobalIP(&sock->LocalIP, true); + } + } + + StrCpy(ret->UnderlayProtocol, sizeof(ret->UnderlayProtocol), SOCK_UNDERLAY_NATIVE_V6); + + AddProtocolDetailsStr(ret->ProtocolDetails, sizeof(ret->ProtocolDetails), "IPv6"); + + return ret; +} + +// Standby for TCP (IPv6) +SOCK *ListenEx6(UINT port, bool local_only) +{ + return ListenEx62(port, local_only, false); +} +SOCK *ListenEx62(UINT port, bool local_only, bool enable_ca) +{ + SOCKET s; + SOCK *sock; + struct sockaddr_in6 addr; + struct in6_addr in; + bool true_flag = true; + IP localhost; + UINT backlog = SOMAXCONN; + // Validate arguments + if (port == 0 || port >= 65536) + { + return NULL; + } + +#ifdef OS_WIN32 + if (MsIsVista() == false) + { + // Disable the Conditional Accept due to a bug in Windows + enable_ca = false; + } +#endif // OS_WIN32 + + // Initialization + Zero(&addr, sizeof(addr)); + Zero(&in, sizeof(in)); + GetLocalHostIP6(&localhost); + + addr.sin6_port = htons((UINT)port); + addr.sin6_family = AF_INET6; + + if (local_only) + { + IPToInAddr6(&addr.sin6_addr, &localhost); + + enable_ca = false; + } + + // Creating a socket + s = socket(AF_INET6, SOCK_STREAM, 0); + if (s == INVALID_SOCKET) + { + return NULL; + } + +#ifdef OS_UNIX + // It is necessary to set the IPv6 Only flag on a UNIX system + (void)setsockopt(s, IPPROTO_IPV6, IPV6_V6ONLY, &true_flag, sizeof(true_flag)); +#endif // OS_UNIX + +#ifdef OS_UNIX + // This only have enabled for UNIX system since there is a bug + // in the implementation of REUSEADDR in Windows OS + (void)setsockopt(s, SOL_SOCKET, SO_REUSEADDR, (char *)&true_flag, sizeof(bool)); +#endif // OS_UNIX + + if (bind(s, (struct sockaddr *)&addr, sizeof(struct sockaddr_in6)) != 0) + { + // Bind failure + closesocket(s); + return NULL; + } + +#ifdef OS_WIN32 + if (enable_ca) + { + if (MsIsWinXPOrGreater()) + { + setsockopt(s, SOL_SOCKET, SO_CONDITIONAL_ACCEPT, (char *)&true_flag, sizeof(bool)); + + backlog = 1; + } + } +#endif // OS_WIN32 + + if (listen(s, backlog)) + { + // Listen failure + closesocket(s); + return NULL; + } + + // Success + sock = NewSock(); + sock->Connected = false; + sock->AsyncMode = false; + sock->ServerMode = true; + sock->Type = SOCK_TCP; + sock->socket = s; + sock->ListenMode = true; + sock->SecureMode = false; + sock->LocalPort = port; + sock->IPv6 = true; + sock->LocalOnly = local_only; + sock->EnableConditionalAccept = enable_ca; + + return sock; +} + +// Standby for the TCP +SOCK *Listen(UINT port) +{ + return ListenEx(port, false); +} +SOCK *ListenEx(UINT port, bool local_only) +{ + return ListenEx2(port, local_only, false, NULL); +} +SOCK *ListenEx2(UINT port, bool local_only, bool enable_ca, IP *listen_ip) +{ + SOCKET s; + SOCK *sock; + struct sockaddr_in addr; + struct in_addr in; + bool true_flag = true; + IP localhost; + UINT backlog = SOMAXCONN; + // Validate arguments + if (port == 0 || port >= 65536) + { + return NULL; + } + +#ifdef OS_WIN32 + if (MsIsVista() == false) + { + // Disable the Conditional Accept due to a bug in Windows + enable_ca = false; + } +#endif // OS_WIN32 + + // Initialization + Zero(&addr, sizeof(addr)); + Zero(&in, sizeof(in)); + SetIP(&localhost, 127, 0, 0, 1); + + addr.sin_port = htons((UINT)port); + if (listen_ip == NULL) + { + *((UINT *)&addr.sin_addr) = htonl(INADDR_ANY); + } + else + { + IPToInAddr(&addr.sin_addr, listen_ip); + } + addr.sin_family = AF_INET; + + if (local_only) + { + IPToInAddr(&addr.sin_addr, &localhost); + + enable_ca = false; + } + + // Creating a socket + s = socket(AF_INET, SOCK_STREAM, 0); + if (s == INVALID_SOCKET) + { + return NULL; + } + +#ifdef OS_UNIX + // This only have enabled for UNIX system since there is a bug + // in the implementation of REUSEADDR in Windows OS + (void)setsockopt(s, SOL_SOCKET, SO_REUSEADDR, (char *)&true_flag, sizeof(bool)); +#endif // OS_UNIX + + if (bind(s, (struct sockaddr *)&addr, sizeof(struct sockaddr_in)) != 0) + { + // Bind failure + closesocket(s); + return NULL; + } + +#ifdef OS_WIN32 + if (enable_ca) + { + if (MsIsWinXPOrGreater()) + { + setsockopt(s, SOL_SOCKET, SO_CONDITIONAL_ACCEPT, (char *)&true_flag, sizeof(bool)); + + backlog = 1; + } + } +#endif // OS_WIN32 + + if (listen(s, backlog)) + { + // Listen failure + closesocket(s); + return NULL; + } + + // Success + sock = NewSock(); + sock->Connected = false; + sock->AsyncMode = false; + sock->ServerMode = true; + sock->Type = SOCK_TCP; + sock->socket = s; + sock->ListenMode = true; + sock->SecureMode = false; + sock->LocalPort = port; + sock->LocalOnly = local_only; + sock->EnableConditionalAccept = enable_ca; + + return sock; +} + +// TCP disconnect +void Disconnect(SOCK *sock) +{ + SOCKET s; + bool true_flag = true; + bool false_flag = false; + // Validate arguments + if (sock == NULL) + { + return; + } + + sock->Disconnecting = true; + +#ifdef ENABLE_SSL_LOGGING + SockCloseSslLogging(sock); +#endif // ENABLE_SSL_LOGGING + +#ifdef OS_UNIX + UnixFreeAsyncSocket(sock); +#endif // UnixFreeAsyncSocket + + if (sock->Type == SOCK_TCP && sock->ListenMode) + { + bool no_tcp_check_port = false; + + // Connect to localhost if the socket is in listening + sock->CancelAccept = true; + +#if defined(UNIX_LINUX) || defined(UNIX_MACOS) + { + pthread_t t = sock->CallingThread; + + // Send a signal to the socket to abort accept() forcibly on Linux + if (t != 0) + { + pthread_kill(t, SIGUSR1); + + SleepThread(200); + } + } +#endif // defined(UNIX_LINUX) || defined(UNIX_MACOS) + +#ifdef OS_WIN32 + if (sock->hAcceptEvent != NULL) + { + SetEvent(sock->hAcceptEvent); + + no_tcp_check_port = true; + } +#endif // OS_WIN32 + + if (sock->AcceptCanceled == false) + { + if (no_tcp_check_port == false) + { + if (sock->IPv6 == false) + { + CheckTCPPort("127.0.0.1", sock->LocalPort); + } + else + { + CheckTCPPort("::1", sock->LocalPort); + } + } + } + } + + Lock(disconnect_function_lock); + + Lock(sock->disconnect_lock); + + if (sock->Type == SOCK_TCP) + { + if (sock->socket != INVALID_SOCKET) + { + // Forced disconnection flag +#ifdef SO_DONTLINGER + (void)setsockopt(sock->socket, SOL_SOCKET, SO_DONTLINGER, (char *)&true_flag, sizeof(bool)); +#else // SO_DONTLINGER + (void)setsockopt(sock->socket, SOL_SOCKET, SO_LINGER, (char *)&false_flag, sizeof(bool)); +#endif // SO_DONTLINGER +// setsockopt(sock->socket, SOL_SOCKET, SO_REUSEADDR, (char *)&true_flag, sizeof(bool)); + } + + // TCP socket + Lock(sock->lock); + { + if (sock->socket == INVALID_SOCKET) + { + Unlock(sock->lock); + Unlock(sock->disconnect_lock); + Unlock(disconnect_function_lock); + return; + } + s = sock->socket; + + if (sock->Connected) + { + struct linger ling; + Zero(&ling, sizeof(ling)); + + +#if 0 + // SSL disconnect + Lock(sock->ssl_lock); + { + if (sock->SecureMode) + { + SSL_shutdown(sock->ssl); + } + } + Unlock(sock->ssl_lock); +#endif + // Disconnect + shutdown(s, 2); + } + + // Close the socket + closesocket(s); + +#ifdef OS_UNIX +#ifdef FIX_SSL_BLOCKING + if (sock->CallingThread != NULL) + { + pthread_kill(sock->CallingThread, 64); + } +#endif // FIX_SSL_BLOCKING +#endif // OS_UNIX + + // Release the SSL + Lock(sock->ssl_lock); + { + if (sock->SecureMode) + { + if (sock->ssl != NULL) + { + Lock(openssl_lock); + { + SSL_free(sock->ssl); + FreeSSLCtx(sock->ssl_ctx); + } + Unlock(openssl_lock); + sock->ssl = NULL; + sock->ssl_ctx = NULL; + } + sock->Connected = false; + sock->SecureMode = false; + } + } + Unlock(sock->ssl_lock); + + // Initialization + sock->socket = INVALID_SOCKET; + sock->Type = 0; + sock->AsyncMode = false; + sock->Connected = false; + sock->ListenMode = false; + sock->SecureMode = false; + + if (sock->IpClientAdded) + { + DelIpClient(&sock->RemoteIP); + sock->IpClientAdded = false; + } + } + Unlock(sock->lock); + + if (sock->BulkSendTube != NULL) + { + TubeDisconnect(sock->BulkSendTube); + } + + if (sock->BulkRecvTube != NULL) + { + TubeDisconnect(sock->BulkRecvTube); + } + } + else if (sock->Type == SOCK_UDP) + { + // UDP socket + Lock(sock->lock); + { + if (sock->socket == INVALID_SOCKET) + { + Unlock(sock->lock); + Unlock(sock->disconnect_lock); + Unlock(disconnect_function_lock); + return; + } + + s = sock->socket; + + // Close the socket + closesocket(s); + + // Initialization + sock->socket = INVALID_SOCKET; + sock->Type = 0; + sock->AsyncMode = false; + sock->Connected = false; + sock->ListenMode = false; + sock->SecureMode = false; + } + Unlock(sock->lock); + } + else if (sock->Type == SOCK_INPROC) + { + // In-process socket + if (sock->ListenMode) + { + // Stop the Accept process + sock->CancelAccept = true; + + Set(sock->InProcAcceptEvent); + + LockQueue(sock->InProcAcceptQueue); + { + while (true) + { + SOCK *ss = GetNext(sock->InProcAcceptQueue); + if (ss == NULL) + { + break; + } + + Disconnect(ss); + ReleaseSock(ss); + } + } + UnlockQueue(sock->InProcAcceptQueue); + } + else + { + // Disconnect the Tube + TubeDisconnect(sock->SendTube); + TubeDisconnect(sock->RecvTube); + + sock->socket = INVALID_SOCKET; + sock->AsyncMode = false; + sock->Connected = false; + sock->ListenMode = false; + sock->SecureMode = false; + } + } + else if (sock->Type == SOCK_RUDP_LISTEN) + { + // RUDP Listen socket + if (sock->ListenMode) + { + // Stop the Accept process + sock->CancelAccept = true; + + Set(sock->R_UDP_Stack->NewSockConnectEvent); + + sock->R_UDP_Stack->Halt = true; + Set(sock->R_UDP_Stack->HaltEvent); + SetSockEvent(sock->R_UDP_Stack->SockEvent); + } + } + else if (sock->Type == SOCK_REVERSE_LISTEN) + { + // Reverse Listen socket + if (sock->ListenMode) + { + // Stop the Accept process + sock->CancelAccept = true; + + Set(sock->ReverseAcceptEvent); + + LockQueue(sock->ReverseAcceptQueue); + { + while (true) + { + SOCK *ss = GetNext(sock->ReverseAcceptQueue); + if (ss == NULL) + { + break; + } + + Disconnect(ss); + ReleaseSock(ss); + } + } + UnlockQueue(sock->ReverseAcceptQueue); + } + } + Unlock(sock->disconnect_lock); + + Unlock(disconnect_function_lock); +} + +typedef struct TCP_PORT_CHECK +{ + REF *ref; + char hostname[MAX_SIZE]; + UINT port; + bool ok; +} TCP_PORT_CHECK; + +// Check whether the TCP port can be connected +bool CheckTCPPortEx(char *hostname, UINT port, UINT timeout) +{ + SOCK *s; + // Validate arguments + if (hostname == NULL || port == 0 || port >= 65536) + { + return false; + } + + if (timeout == 0) + { + timeout = TIMEOUT_TCP_PORT_CHECK; + } + + s = ConnectEx(hostname, port, timeout); + if (s == NULL) + { + return false; + } + else + { + Disconnect(s); + ReleaseSock(s); + return true; + } +} +bool CheckTCPPort(char *hostname, UINT port) +{ + return CheckTCPPortEx(hostname, port, TIMEOUT_TCP_PORT_CHECK); +} + +#ifdef OS_UNIX +// Connection with timeout (UNIX version) +int connect_timeout(SOCKET s, struct sockaddr *addr, int size, int timeout, bool *cancel_flag) +{ + SOCKSET set; + bool ok = false; + UINT64 start_time; + // Validate arguments + if (s == INVALID_SOCKET || addr == NULL) + { + return -1; + } + if (timeout == 0) + { + timeout = TIMEOUT_TCP_PORT_CHECK; + } + + UnixSetSocketNonBlockingMode(s, true); + + start_time = Tick64(); + + while (true) + { + int ret; + ret = connect(s, addr, size); + if (ret == 0 || errno == EISCONN) + { + ok = true; + break; + } + else + { + if (((start_time + (UINT64)timeout) <= Tick64()) || (errno != EAGAIN && errno != EINPROGRESS && errno != EALREADY)) + { + // Failure + break; + } + else if (*cancel_flag) + { + // Cancel + break; + } + else + { + // Connecting + SleepThread(50); + UnixSelectInner(1, (UINT *)&s, 1, (UINT *)&s, 100); + } + } + } + + UnixSetSocketNonBlockingMode(s, false); + + if (ok) + { + return 0; + } + else + { + return -1; + } +} +#else +// Connection with timeout (Win32 version) +int connect_timeout(SOCKET s, struct sockaddr *addr, int size, int timeout, bool *cancel_flag) +{ + UINT64 start_time; + bool ok = false; + bool timeouted = false; + WSAEVENT hEvent; + UINT zero = 0; + UINT tmp = 0; + UINT ret_size = 0; + bool is_nt = false; + // Validate arguments + if (s == INVALID_SOCKET || addr == NULL) + { + return -1; + } + if (timeout == 0) + { + timeout = TIMEOUT_TCP_PORT_CHECK; + } + + is_nt = OS_IS_WINDOWS_NT(GetOsInfo()->OsType); + + // Create an event + hEvent = CreateEvent(NULL, FALSE, FALSE, NULL); + + // Associate the socket with the event + WSAEventSelect(s, hEvent, FD_CONNECT); + + start_time = Tick64(); + + while (true) + { + int ret; + + ret = connect(s, addr, size); + + if (ret == 0) + { + ok = true; + break; + } + else + { + int err = WSAGetLastError(); + //Debug("err=%u\n", err); + //Debug("cancel_flag=%u\n", *cancel_flag); + if (timeouted && ((err == WSAEALREADY) || (err == WSAEWOULDBLOCK && !is_nt))) + { + // Time-out + ok = false; + break; + } + if (*cancel_flag) + { + // Cancel + ok = false; + break; + } + if (err == WSAEISCONN || (err == WSAEINVAL && is_nt)) + { + ok = true; + break; + } + if (((start_time + (UINT64)timeout) <= Tick64()) || (err != WSAEWOULDBLOCK && err != WSAEALREADY && (is_nt || err != WSAEINVAL))) + { + // Failure (timeout) + break; + } + else + { + SleepThread(10); + // Connecting + if (WaitForSingleObject(hEvent, 100) == WAIT_OBJECT_0) + { + timeouted = true; + } + } + } + } + + // Remove the socket from the event + WSAEventSelect(s, hEvent, 0); + + // Restore to synchronized socket + WSAIoctl(s, FIONBIO, &zero, sizeof(zero), &tmp, sizeof(tmp), &ret_size, NULL, NULL); + + // Close the event + CloseHandle(hEvent); + + if (ok) + { + return 0; + } + else + { + return -1; + } +} +#endif // OS_UNIX + +// Set the TOS value of the socket +void SetSockTos(SOCK *s, int tos) +{ + // Validate arguments + if (s == NULL) + { + return; + } + + if (s->CurrentTos == tos) + { + return; + } + +#ifdef IP_TOS + (void)setsockopt(s->socket, IPPROTO_IP, IP_TOS, (char *)&tos, sizeof(int)); +#endif // IP_TOS + + s->CurrentTos = tos; +} + +// Set the priority of the socket +void SetSockHighPriority(SOCK *s, bool flag) +{ + // Validate arguments + if (s == NULL) + { + return; + } + + SetSockTos(s, (flag ? 16 : 0)); +} + +// Connect to the IPv4 host using a socket +SOCKET ConnectTimeoutIPv4(IP *ip, UINT port, UINT timeout, bool *cancel_flag) +{ + SOCKET s; + struct sockaddr_in sockaddr4; + struct in_addr addr4; + + Zero(&sockaddr4, sizeof(sockaddr4)); + Zero(&addr4, sizeof(addr4)); + + // Generate a sockaddr_in + IPToInAddr(&addr4, ip); + sockaddr4.sin_port = htons((USHORT)port); + sockaddr4.sin_family = AF_INET; + sockaddr4.sin_addr.s_addr = addr4.s_addr; + + // Socket creation + s = socket(AF_INET, SOCK_STREAM, 0); + if (s != INVALID_SOCKET) + { + // Connection + if (connect_timeout(s, (struct sockaddr *)&sockaddr4, sizeof(struct sockaddr_in), timeout, cancel_flag) != 0) + { + // Connection failure + closesocket(s); + s = INVALID_SOCKET; + } + } + + return s; +} + +// Identify whether the HTTPS server to be connected is a SoftEther VPN +bool DetectIsServerSoftEtherVPN(SOCK *s) +{ + HTTP_HEADER *h; + char ip_str[MAX_SIZE]; + char *send_str; + UINT content_len; + BUF *recv_buf; + void *socket_buffer; + UINT socket_buffer_size = 32768; + bool ok = false; + // Validate arguments + if (s == NULL) + { + return false; + } + + IPToStr(ip_str, sizeof(ip_str), &s->RemoteIP); + + // Request generation + h = NewHttpHeaderEx("GET", "/", "HTTP/1.1", true); + AddHttpValue(h, NewHttpValue("X-VPN", "1")); + AddHttpValue(h, NewHttpValue("Host", ip_str)); + AddHttpValue(h, NewHttpValue("Keep-Alive", HTTP_KEEP_ALIVE)); + AddHttpValue(h, NewHttpValue("Connection", "Keep-Alive")); + AddHttpValue(h, NewHttpValue("Accept-Language", "ja")); + AddHttpValue(h, NewHttpValue("User-Agent", DEFAULT_USER_AGENT)); + AddHttpValue(h, NewHttpValue("Pragma", "no-cache")); + AddHttpValue(h, NewHttpValue("Cache-Control", "no-cache")); + + + + send_str = HttpHeaderToStr(h); + FreeHttpHeader(h); + + // Transmission + if (SendAll(s, send_str, StrLen(send_str), true) == false) + { + Free(send_str); + return false; + } + + Free(send_str); + + // Receive + h = RecvHttpHeader(s); + if (h == NULL) + { + return false; + } + + // Get the length of the content + content_len = GetContentLength(h); + FreeHttpHeader(h); + + if (content_len == 0 || content_len >= (1024 * 1024)) + { + return false; + } + + // Receive contents + recv_buf = NewBuf(); + socket_buffer = Malloc(socket_buffer_size); + + while (true) + { + UINT recvsize = MIN(socket_buffer_size, content_len - recv_buf->Size); + UINT size; + + if (recvsize == 0) + { + ok = true; + break; + } + + size = Recv(s, socket_buffer, recvsize, true); + if (size == 0) + { + // Disconnected + break; + } + + WriteBuf(recv_buf, socket_buffer, size); + } + + SeekBuf(recv_buf, 0, 0); + Free(socket_buffer); + + if (ok) + { + // Examine to confirm whether the incoming data is a SoftEther VPN protocol + char tmp[1024]; + + Zero(tmp, sizeof(tmp)); + + Copy(tmp, recv_buf->Buf, MIN(recv_buf->Size, (sizeof(tmp) - 1))); + + ok = false; + + if (StartWith(tmp, http_detect_server_startwith)) + { + ok = true; + } + else if (InStr(tmp, http_detect_server_tag_future)) + { + ok = true; + } + } + + FreeBuf(recv_buf); + + return ok; +} + +// TCP connection thread +void ConnectThreadForTcp(THREAD *thread, void *param) +{ + SOCK *sock; + char hostname[MAX_SIZE]; + CONNECT_TCP_RUDP_PARAM *p = (CONNECT_TCP_RUDP_PARAM *)param; + if (thread == NULL || p == NULL) + { + return; + } + + // Delay + if (p->Delay >= 1) + { + WaitEx(NULL, p->Delay, p->CancelFlag); + } + + // Connecting process + IPToStr(hostname, sizeof(hostname), &p->Ip); + sock = ConnectEx3(hostname, p->Port, p->Timeout, p->CancelFlag, NULL, NULL, false, true); + + if (sock != NULL && p->Tcp_TryStartSsl) + { + bool ssl_ret = false; + + p->Tcp_InNegotiation = true; + + // Attempt the SSL negotiation to take this opportunity + Lock(p->CancelLock); + { + if ((*p->CancelFlag) == false) + { + p->CancelDisconnectSock = sock; + AddRef(sock->ref); + } + else + { + Debug("User Cancel to StartSSL.\n"); + goto LABEL_CANCEL; + } + } + Unlock(p->CancelLock); + + // Start the SSL communication + ssl_ret = StartSSLEx(sock, NULL, NULL, 0, p->Hostname); + + if (ssl_ret) + { + // Identify whether the HTTPS server to be connected is a SoftEther VPN + SetTimeout(sock, (10 * 1000)); + ssl_ret = DetectIsServerSoftEtherVPN(sock); + SetTimeout(sock, INFINITE); + + if (ssl_ret == false) + { + Debug("DetectIsServerSoftEtherVPN Error.\n"); + } + } + + Lock(p->CancelLock); + { + ReleaseSock(p->CancelDisconnectSock); + p->CancelDisconnectSock = NULL; + } +LABEL_CANCEL: + Unlock(p->CancelLock); + + if (ssl_ret == false) + { + // SSL negotiation failure + Disconnect(sock); + ReleaseSock(sock); + + Debug("Fail to StartSSL.\n"); + + sock = NULL; + } + } + + p->Result_Tcp_Sock = sock; + p->Ok = (p->Result_Tcp_Sock == NULL ? false : true); + p->FinishedTick = Tick64(); + p->Finished = true; + p->Tcp_InNegotiation = false; + + Set(p->FinishEvent); +} + +// R-UDP over ICMP / over DNS connection thread +void ConnectThreadForOverDnsOrIcmp(THREAD *thread, void *param) +{ + SOCK *sock; + CONNECT_TCP_RUDP_PARAM *p = (CONNECT_TCP_RUDP_PARAM *)param; + if (thread == NULL || p == NULL) + { + return; + } + + // Delay + if (p->Delay >= 1) + { + WaitEx(NULL, p->Delay, p->CancelFlag); + } + + // Connecting process + sock = NewRUDPClientDirect(p->SvcName, &p->Ip, + (p->RUdpProtocol == RUDP_PROTOCOL_DNS ? 53 : MAKE_SPECIAL_PORT(IP_PROTO_ICMPV4)), + &p->NatT_ErrorCode, p->Timeout, p->CancelFlag, NULL, NULL, + (p->RUdpProtocol == RUDP_PROTOCOL_DNS ? 0 : MAKE_SPECIAL_PORT(IP_PROTO_ICMPV4)), + (p->RUdpProtocol == RUDP_PROTOCOL_DNS ? true : false)); + + p->Result_Nat_T_Sock = sock; + p->Ok = (p->Result_Nat_T_Sock == NULL ? false : true); + p->FinishedTick = Tick64(); + p->Finished = true; + + Set(p->FinishEvent); +} + +// R-UDP (via NAT-T) connection thread +void ConnectThreadForRUDP(THREAD *thread, void *param) +{ + SOCK *sock; + CONNECT_TCP_RUDP_PARAM *p = (CONNECT_TCP_RUDP_PARAM *)param; + if (thread == NULL || p == NULL) + { + return; + } + + // Delay + if (p->Delay >= 1) + { + WaitEx(NULL, p->Delay, p->CancelFlag); + } + + // Connecting process + sock = NewRUDPClientNatT(p->SvcName, &p->Ip, &p->NatT_ErrorCode, p->Timeout, p->CancelFlag, p->HintStr, p->TargetHostname); + + p->Result_Nat_T_Sock = sock; + p->Ok = (p->Result_Nat_T_Sock == NULL ? false : true); + p->FinishedTick = Tick64(); + p->Finished = true; + + Set(p->FinishEvent); +} + +// TCP connection +SOCK *Connect(char *hostname, UINT port) +{ + return ConnectEx(hostname, port, 0); +} +SOCK *ConnectEx(char *hostname, UINT port, UINT timeout) +{ + return ConnectEx2(hostname, port, timeout, NULL); +} +SOCK *ConnectEx2(char *hostname, UINT port, UINT timeout, bool *cancel_flag) +{ + return ConnectEx3(hostname, port, timeout, cancel_flag, NULL, NULL, false, true); +} +SOCK *ConnectEx3(char *hostname, UINT port, UINT timeout, bool *cancel_flag, char *nat_t_svc_name, UINT *nat_t_error_code, bool try_start_ssl, bool no_get_hostname) +{ + return ConnectEx4(hostname, port, timeout, cancel_flag, nat_t_svc_name, nat_t_error_code, try_start_ssl, no_get_hostname, NULL); +} +SOCK *ConnectEx4(char *hostname, UINT port, UINT timeout, bool *cancel_flag, char *nat_t_svc_name, UINT *nat_t_error_code, bool try_start_ssl, bool no_get_hostname, IP *ret_ip) +{ + SOCK *sock; + SOCKET s; + struct linger ling; + IP ip4; + IP ip6; + bool true_flag = true; + bool false_flag = false; + char tmp[MAX_SIZE]; + IP current_ip; + bool is_ipv6 = false; + bool dummy = false; + bool use_natt = false; + char hostname_original[MAX_SIZE]; + char hint_str[MAX_SIZE]; + bool force_use_natt = false; + UINT dummy_int = 0; + IP dummy_ret_ip; + // Validate arguments + if (hostname == NULL || port == 0 || port >= 65536 || IsEmptyStr(hostname)) + { + return NULL; + } + if (timeout == 0) + { + timeout = TIMEOUT_TCP_PORT_CHECK; + } + if (cancel_flag == NULL) + { + cancel_flag = &dummy; + } + if (nat_t_error_code == NULL) + { + nat_t_error_code = &dummy_int; + } + + Zero(&dummy_ret_ip, sizeof(IP)); + if (ret_ip == NULL) + { + ret_ip = &dummy_ret_ip; + } + + Zero(hint_str, sizeof(hint_str)); + StrCpy(hostname_original, sizeof(hostname_original), hostname); + + use_natt = (IsEmptyStr(nat_t_svc_name) ? false : true); + + if (use_natt) + { + // In case of using NAT-T, split host name if the '/' is included in the host name + UINT i = SearchStrEx(hostname, "/", 0, false); + + if (i == INFINITE) + { + // Not included + StrCpy(hostname_original, sizeof(hostname_original), hostname); + } + else + { + // Included + StrCpy(hostname_original, sizeof(hostname_original), hostname); + hostname_original[i] = 0; + + // Force to use the NAT-T + force_use_natt = true; + + // Copy the hint string + StrCpy(hint_str, sizeof(hint_str), hostname + i + 1); + + if (StrCmpi(hint_str, "tcp") == 0 || StrCmpi(hint_str, "disable") == 0 + || StrCmpi(hint_str, "disabled") == 0 + || StrCmpi(hint_str, "no") == 0 || StrCmpi(hint_str, "none") == 0) + { + // Force not to use the NAT-T + force_use_natt = false; + use_natt = false; + } + } + } + else + { + StrCpy(hostname_original, sizeof(hostname_original), hostname); + } + + Zero(¤t_ip, sizeof(current_ip)); + + Zero(&ip4, sizeof(ip4)); + Zero(&ip6, sizeof(ip6)); + + if (IsZeroIp(ret_ip) == false) + { + // Skip name resolution + if (IsIP6(ret_ip)) + { + Copy(&ip6, ret_ip, sizeof(IP)); + } + else + { + Copy(&ip4, ret_ip, sizeof(IP)); + } + + //Debug("Using cached IP address: %s = %r\n", hostname_original, ret_ip); + } + else + { + // Forward resolution + if (GetIP46Ex(&ip4, &ip6, hostname_original, 0, cancel_flag) == false) + { + return NULL; + } + } + + if (IsZeroIp(&ip4) == false && IsIPLocalHostOrMySelf(&ip4)) + { + // NAT-T isn't used in the case of connection to localhost + force_use_natt = false; + use_natt = false; + } + + s = INVALID_SOCKET; + + // Attempt to connect with IPv4 + if (IsZeroIp(&ip4) == false) + { + if (use_natt == false) + { + // Normal connection without using NAT-T + s = ConnectTimeoutIPv4(&ip4, port, timeout, cancel_flag); + + if (s != INVALID_SOCKET) + { + Copy(¤t_ip, &ip4, sizeof(IP)); + + Copy(ret_ip, &ip4, sizeof(IP)); + } + } + else if (force_use_natt) + { + // The connection by forcing the use of NAT-T (not to connection with normal TCP) + SOCK *nat_t_sock = NewRUDPClientNatT(nat_t_svc_name, &ip4, nat_t_error_code, timeout, cancel_flag, + hint_str, hostname); + + if (nat_t_sock != NULL) + { + StrCpy(nat_t_sock->UnderlayProtocol, sizeof(nat_t_sock->UnderlayProtocol), SOCK_UNDERLAY_NAT_T); + AddProtocolDetailsStr(nat_t_sock->ProtocolDetails, sizeof(nat_t_sock->ProtocolDetails), "RUDP"); + } + + Copy(ret_ip, &ip4, sizeof(IP)); + + return nat_t_sock; + } + else + { + // Use the connections using NAT-T with normal TCP connection together + // (Use multiple threads to try to connect in four connection methods concurrently) + CONNECT_TCP_RUDP_PARAM p1, p2, p3, p4; + EVENT *finish_event; + THREAD *t1, *t2, *t3, *t4; + UINT64 start_tick = Tick64(); + UINT64 giveup_for_all_tick = start_tick + (UINT64)SOCK_CONNECT_WAIT_FOR_ICMP_AND_DNS_AT_LEAST; + bool cancel_flag2 = false; + SOCK *cancel_sock = NULL; + + finish_event = NewEvent(); + + Zero(&p1, sizeof(p1)); + Zero(&p2, sizeof(p2)); + Zero(&p3, sizeof(p3)); + Zero(&p4, sizeof(p4)); + + // p1: TCP + StrCpy(p1.Hostname, sizeof(p1.Hostname), hostname_original); + Copy(&p1.Ip, &ip4, sizeof(IP)); + p1.Port = port; + p1.Timeout = timeout; + p1.CancelFlag = &cancel_flag2; + p1.FinishEvent = finish_event; + p1.Tcp_TryStartSsl = try_start_ssl; + p1.CancelLock = NewLock(); + + // p2: NAT-T + StrCpy(p2.Hostname, sizeof(p2.Hostname), hostname_original); + Copy(&p2.Ip, &ip4, sizeof(IP)); + p2.Port = port; + p2.Timeout = timeout; + p2.CancelFlag = &cancel_flag2; + p2.FinishEvent = finish_event; + + StrCpy(p2.HintStr, sizeof(p2.HintStr), hint_str); + StrCpy(p2.TargetHostname, sizeof(p2.TargetHostname), hostname); + StrCpy(p2.SvcName, sizeof(p2.SvcName), nat_t_svc_name); + p2.Delay = 30; // Delay by 30ms + + // p3: over ICMP + StrCpy(p3.Hostname, sizeof(p3.Hostname), hostname_original); + Copy(&p3.Ip, &ip4, sizeof(IP)); + p3.Port = port; + p3.Timeout = timeout; + p3.CancelFlag = &cancel_flag2; + p3.FinishEvent = finish_event; + StrCpy(p3.SvcName, sizeof(p3.SvcName), nat_t_svc_name); + p3.RUdpProtocol = RUDP_PROTOCOL_ICMP; + p3.Delay = 200; // Delay by 200ms + + // p4: over DNS + StrCpy(p4.Hostname, sizeof(p4.Hostname), hostname_original); + Copy(&p4.Ip, &ip4, sizeof(IP)); + p4.Port = port; + p4.Timeout = timeout; + p4.CancelFlag = &cancel_flag2; + p4.FinishEvent = finish_event; + StrCpy(p4.SvcName, sizeof(p4.SvcName), nat_t_svc_name); + p4.RUdpProtocol = RUDP_PROTOCOL_DNS; + p4.Delay = 100; // Delay by 100ms + + t1 = NewThread(ConnectThreadForTcp, &p1); + t2 = NewThread(ConnectThreadForRUDP, &p2); + t4 = NewThread(ConnectThreadForOverDnsOrIcmp, &p4); + t3 = NewThread(ConnectThreadForOverDnsOrIcmp, &p3); + + while (true) + { + UINT64 now = Tick64(); + + if (*cancel_flag) + { + // Cancel by the user + break; + } + + if (p1.Finished && p2.Finished) + { + // Results for both the TCP and the NAT-T were confirmed + if (now >= giveup_for_all_tick) + { + // Wait at least minimum time until successful of the ICMP or the DNS + break; + } + + if (p3.Ok || p4.Ok) + { + // Exit the loop immediately if any of the ICMP or the DNS is successful + break; + } + } + + if (p1.Finished && p1.Ok) + { + // Have successfully connected by TCP + break; + } + + if (p2.Finished && p2.Ok) + { + UINT p1_wait_time; + UINT64 tcp_giveup_tick; + UINT p2_spent_time; + // Have successfully connected by R-UDP + if (p1.Finished) + { + // Result of TCP is confirmed + break; + } + + // Calculate the time takes to complete connection of R-UDP + p2_spent_time = (UINT)(p2.FinishedTick - start_tick); + + // Decide the grace time for results of TCP until settled. + // The grace time is four times the duration of the R-UDP, and at least 400 milliseconds from the start, + // and up to 2500 milliseconds after the R-UDP results settled + p1_wait_time = p2_spent_time * 4; + p1_wait_time = MAX(p1_wait_time, 400); + //Debug("p2_spent_time = %u, p1_wait_time = %u\n", p2_spent_time, p1_wait_time); + + tcp_giveup_tick = start_tick + (UINT64)p1_wait_time; + tcp_giveup_tick = MIN(tcp_giveup_tick, (p2.FinishedTick + 2500ULL)); + + if (now >= tcp_giveup_tick) + { + // Result of the TCP is uncertain, but give up + if (p1.Finished || p1.Tcp_InNegotiation == false) + { + // Break only when TCP SSL negotiation is not being processed + break; + } + } + } + + Wait(finish_event, 25); + } + + cancel_flag2 = true; + + Lock(p1.CancelLock); + { + if (p1.CancelDisconnectSock != NULL) + { + cancel_sock = p1.CancelDisconnectSock; + + AddRef(cancel_sock->ref); + } + } + Unlock(p1.CancelLock); + + if (cancel_sock != NULL) + { + Disconnect(cancel_sock); + ReleaseSock(cancel_sock); + } + + WaitThread(t1, INFINITE); + WaitThread(t2, INFINITE); + WaitThread(t3, INFINITE); + WaitThread(t4, INFINITE); + ReleaseThread(t1); + ReleaseThread(t2); + ReleaseThread(t3); + ReleaseThread(t4); + ReleaseEvent(finish_event); + + DeleteLock(p1.CancelLock); + + if (*cancel_flag) + { + // Abandon all the results because the user canceled + Disconnect(p1.Result_Nat_T_Sock); + ReleaseSock(p1.Result_Nat_T_Sock); + Disconnect(p2.Result_Nat_T_Sock); + ReleaseSock(p2.Result_Nat_T_Sock); + Disconnect(p3.Result_Nat_T_Sock); + ReleaseSock(p3.Result_Nat_T_Sock); + Disconnect(p4.Result_Nat_T_Sock); + ReleaseSock(p4.Result_Nat_T_Sock); + + return NULL; + } + + if (p1.Ok) + { + char hostname[MAX_SIZE]; + + // Use the results of the TCP + // Dispose other results + Disconnect(p2.Result_Nat_T_Sock); + ReleaseSock(p2.Result_Nat_T_Sock); + Disconnect(p3.Result_Nat_T_Sock); + ReleaseSock(p3.Result_Nat_T_Sock); + Disconnect(p4.Result_Nat_T_Sock); + ReleaseSock(p4.Result_Nat_T_Sock); + + if (GetHostName(hostname, sizeof(hostname), &ip4)) + { + Free(p1.Result_Tcp_Sock->RemoteHostname); + p1.Result_Tcp_Sock->RemoteHostname = CopyStr(hostname); + } + + Copy(ret_ip, &ip4, sizeof(IP)); + + return p1.Result_Tcp_Sock; + } + else if (p2.Ok) + { + // Use the results of the R-UDP + // Dispose other results + Disconnect(p3.Result_Nat_T_Sock); + ReleaseSock(p3.Result_Nat_T_Sock); + Disconnect(p4.Result_Nat_T_Sock); + ReleaseSock(p4.Result_Nat_T_Sock); + + StrCpy(p2.Result_Nat_T_Sock->UnderlayProtocol, sizeof(p2.Result_Nat_T_Sock->UnderlayProtocol), SOCK_UNDERLAY_NAT_T); + AddProtocolDetailsStr(p2.Result_Nat_T_Sock->UnderlayProtocol, sizeof(p2.Result_Nat_T_Sock->UnderlayProtocol), "RUDP/UDP"); + + Copy(ret_ip, &ip4, sizeof(IP)); + + return p2.Result_Nat_T_Sock; + } + else if (p4.Ok) + { + // Use this if over-DNS success + // Dispose other results + Disconnect(p3.Result_Nat_T_Sock); + ReleaseSock(p3.Result_Nat_T_Sock); + + StrCpy(p4.Result_Nat_T_Sock->UnderlayProtocol, sizeof(p4.Result_Nat_T_Sock->UnderlayProtocol), SOCK_UNDERLAY_DNS); + AddProtocolDetailsStr(p4.Result_Nat_T_Sock->UnderlayProtocol, sizeof(p4.Result_Nat_T_Sock->UnderlayProtocol), "RUDP/DNS"); + + Copy(ret_ip, &ip4, sizeof(IP)); + + return p4.Result_Nat_T_Sock; + } + else if (p3.Ok) + { + // Use this if over ICMP success + StrCpy(p3.Result_Nat_T_Sock->UnderlayProtocol, sizeof(p3.Result_Nat_T_Sock->UnderlayProtocol), SOCK_UNDERLAY_ICMP); + AddProtocolDetailsStr(p3.Result_Nat_T_Sock->UnderlayProtocol, sizeof(p3.Result_Nat_T_Sock->UnderlayProtocol), "RUDP/ICMP"); + + Copy(ret_ip, &ip4, sizeof(IP)); + + return p3.Result_Nat_T_Sock; + } + else + { + // Continue the process if all trials failed + *nat_t_error_code = p2.NatT_ErrorCode; + } + } + } + + // Attempt to connect with IPv6 + if (s == INVALID_SOCKET && IsZeroIp(&ip6) == false) + { + struct sockaddr_in6 sockaddr6; + struct in6_addr addr6; + + Zero(&sockaddr6, sizeof(sockaddr6)); + Zero(&addr6, sizeof(addr6)); + + // Generation of the sockaddr_in6 + IPToInAddr6(&addr6, &ip6); + sockaddr6.sin6_port = htons((USHORT)port); + sockaddr6.sin6_family = AF_INET6; + sockaddr6.sin6_scope_id = ip6.ipv6_scope_id; + Copy(&sockaddr6.sin6_addr, &addr6, sizeof(addr6)); + + // Socket creation + s = socket(AF_INET6, SOCK_STREAM, 0); + if (s != INVALID_SOCKET) + { + // Connection + if (connect_timeout(s, (struct sockaddr *)&sockaddr6, sizeof(struct sockaddr_in6), timeout, cancel_flag) != 0) + { + // Connection failure + closesocket(s); + s = INVALID_SOCKET; + } + else + { + Copy(¤t_ip, &ip6, sizeof(IP)); + + is_ipv6 = true; + + Copy(ret_ip, &ip6, sizeof(IP)); + } + } + } + + if (s == INVALID_SOCKET) + { + // Connection fails on both of IPv4, IPv6 + return NULL; + } + + // Creating a SOCK + sock = NewSock(); + sock->socket = s; + sock->Type = SOCK_TCP; + sock->ServerMode = false; + + StrCpy(sock->UnderlayProtocol, sizeof(sock->UnderlayProtocol), is_ipv6 ? SOCK_UNDERLAY_NATIVE_V6 : SOCK_UNDERLAY_NATIVE_V4); + AddProtocolDetailsStr(sock->ProtocolDetails, sizeof(sock->ProtocolDetails), is_ipv6 ? "IPv6" : "IPv4"); + + // Host name resolution + if (no_get_hostname || (GetHostName(tmp, sizeof(tmp), ¤t_ip) == false)) + { + StrCpy(tmp, sizeof(tmp), hostname_original); + } + + //Debug("PTR: %s\n", tmp); + + sock->RemoteHostname = CopyStr(tmp); + +// Debug("new socket: %u\n", s); + + Zero(&ling, sizeof(ling)); + // Forced disconnection flag +#ifdef SO_DONTLINGER + (void)setsockopt(sock->socket, SOL_SOCKET, SO_DONTLINGER, (char *)&true_flag, sizeof(bool)); +#else // SO_DONTLINGER + (void)setsockopt(sock->socket, SOL_SOCKET, SO_LINGER, (char *)&false_flag, sizeof(bool)); +#endif // SO_DONTLINGER +// setsockopt(sock->socket, SOL_SOCKET, SO_REUSEADDR, (char *)&true_flag, sizeof(bool)); + + // Configuring TCP options + (void)setsockopt(sock->socket, IPPROTO_TCP, TCP_NODELAY, (char *)&true_flag, sizeof(bool)); + + // Initialization of the time-out value + SetTimeout(sock, TIMEOUT_INFINITE); + + // Get the socket information + QuerySocketInformation(sock); + + if (IsZeroIp(&sock->LocalIP) == false && IsLocalHostIP(&sock->LocalIP) == false) + { + IP current_ip; + + if (GetCurrentGlobalIP(¤t_ip, is_ipv6) == false) + { + SetCurrentGlobalIP(&sock->LocalIP, is_ipv6); + } + } + + sock->Connected = true; + sock->AsyncMode = false; + sock->SecureMode = false; + sock->IPv6 = is_ipv6; + + return sock; +} + +// Add a protocol details strings +void AddProtocolDetailsStr(char *dst, UINT dst_size, char *str) +{ + TOKEN_LIST *t1, *t2; + UINT i, j; + if (dst == NULL || str == NULL) + { + return; + } + + t1 = ParseTokenWithoutNullStr(dst, " "); + t2 = ParseTokenWithoutNullStr(str, " "); + + for (i = 0; i < t2->NumTokens; i++) + { + bool exists = false; + for (j = 0; j < t1->NumTokens; j++) + { + if (StrCmpi(t1->Token[j], t2->Token[i]) == 0) + { + exists = true; + break; + } + } + + if (exists == false) + { + StrCat(dst, dst_size, t2->Token[i]); + StrCat(dst, dst_size, " "); + } + } + + FreeToken(t1); + FreeToken(t2); +} + +void AddProtocolDetailsKeyValueStr(char *dst, UINT dst_size, char *key, char *value) +{ + char tmp[128]; + StrCpy(tmp, sizeof(tmp), key); + StrCat(tmp, sizeof(tmp), "="); + StrCat(tmp, sizeof(tmp), value); + AddProtocolDetailsStr(dst, dst_size, tmp); +} + +void AddProtocolDetailsKeyValueInt(char *dst, UINT dst_size, char *key, UINT value) +{ + char tmp[128]; + ToStr(tmp, value); + AddProtocolDetailsKeyValueStr(dst, dst_size, key, tmp); +} + + +// Setting the buffer size of the socket +bool SetSocketBufferSize(SOCKET s, bool send, UINT size) +{ + int value = (int)size; + // Validate arguments + if (s == INVALID_SOCKET) + { + return false; + } + + if (setsockopt(s, SOL_SOCKET, (send ? SO_SNDBUF : SO_RCVBUF), (char *)&value, sizeof(int)) != 0) + { + return false; + } + + return true; +} +UINT SetSocketBufferSizeWithBestEffort(SOCKET s, bool send, UINT size) +{ + // Validate arguments + if (s == INVALID_SOCKET) + { + return 0; + } + + while (true) + { + if (SetSocketBufferSize(s, send, size)) + { + return size; + } + + size = (UINT)((double)size / 1.5); + + if (size <= 32767) + { + return 0; + } + } +} + +// Initialize the buffer size of the UDP socket +void InitUdpSocketBufferSize(SOCKET s) +{ + SetSocketBufferSizeWithBestEffort(s, true, UDP_MAX_BUFFER_SIZE); + SetSocketBufferSizeWithBestEffort(s, false, UDP_MAX_BUFFER_SIZE); +} + +// Get the socket information +void QuerySocketInformation(SOCK *sock) +{ + // Validate arguments + if (sock == NULL) + { + return; + } + + Lock(sock->lock); + { + struct sockaddr_in6 sockaddr6; + struct in6_addr *addr6; + int size; + UINT dw; + UINT opt_value = 0; + + if (sock->Type == SOCK_TCP) + { + // Get the information of the remote host + size = sizeof(sockaddr6); + if (getpeername(sock->socket, (struct sockaddr *)&sockaddr6, (int *)&size) == 0) + { + if (size >= sizeof(struct sockaddr_in6)) + { + sock->RemotePort = (UINT)ntohs(sockaddr6.sin6_port); + addr6 = &sockaddr6.sin6_addr; + InAddrToIP6(&sock->RemoteIP, addr6); + sock->RemoteIP.ipv6_scope_id = sockaddr6.sin6_scope_id; + } + else + { + struct sockaddr_in *sockaddr; + struct in_addr *addr; + + sockaddr = (struct sockaddr_in *)&sockaddr6; + sock->RemotePort = (UINT)ntohs(sockaddr->sin_port); + addr = &sockaddr->sin_addr; + InAddrToIP(&sock->RemoteIP, addr); + } + } + } + + // Get the local host information + size = sizeof(sockaddr6); + if (getsockname(sock->socket, (struct sockaddr *)&sockaddr6, (int *)&size) == 0) + { + if (size >= sizeof(struct sockaddr_in6)) + { + sock->LocalPort = (UINT)ntohs(sockaddr6.sin6_port); + addr6 = &sockaddr6.sin6_addr; + InAddrToIP6(&sock->LocalIP, addr6); + sock->LocalIP.ipv6_scope_id = sockaddr6.sin6_scope_id; + } + else + { + struct sockaddr_in *sockaddr; + struct in_addr *addr; + + sockaddr = (struct sockaddr_in *)&sockaddr6; + sock->LocalPort = (UINT)ntohs(sockaddr->sin_port); + addr = &sockaddr->sin_addr; + InAddrToIP(&sock->LocalIP, addr); + } + } + + if (sock->IsRawSocket) + { + sock->LocalPort = sock->RemotePort = MAKE_SPECIAL_PORT(sock->RawSocketIPProtocol); + } + + if (sock->Type == SOCK_UDP) + { + sock->UdpMaxMsgSize = UDP_MAX_MSG_SIZE_DEFAULT; + +#ifdef OS_WIN32 + if (true) + { + // Get the buffer size that can be transmitted and received at once + UINT max_value = 0; + int len = sizeof(UINT); + + if (getsockopt(sock->socket, SOL_SOCKET, SO_MAX_MSG_SIZE, (char *)&max_value, &len) == 0) + { + sock->UdpMaxMsgSize = max_value; + } + } +#endif // OS_WIN32 + } + + if (sock->IPv6) + { +#ifdef IPV6_UNICAST_HOPS + opt_value = IPV6_UNICAST_HOPS; +#endif // IPV6_UNICAST_HOPS + } + else + { +#ifdef IP_TTL + opt_value = IP_TTL; +#endif // IP_TTL + } + + // Support of the TTL value + size = sizeof(UINT); + if (opt_value == 0 || + getsockopt(sock->socket, (sock->IPv6 ? IPPROTO_IPV6 : IPPROTO_IP), opt_value, (char *)&dw, &size) != 0) + { + sock->IsTtlSupported = false; + } + else + { + sock->IsTtlSupported = true; + sock->CurrentTtl = dw; + } + } + Unlock(sock->lock); +} + +// Setting the TTL value +bool SetTtl(SOCK *sock, UINT ttl) +{ + UINT dw; + int size; + UINT opt_value = 0; + // Validate arguments + if (sock == NULL) + { + return false; + } + + if (sock->IsTtlSupported == false) + { + return false; + } + + if (sock->CurrentTtl == ttl) + { + return true; + } + + dw = ttl; + size = sizeof(UINT); + + if (sock->IPv6) + { +#ifdef IPV6_UNICAST_HOPS + opt_value = IPV6_UNICAST_HOPS; +#endif // IPV6_UNICAST_HOPS + } + else + { +#ifdef IP_TTL + opt_value = IP_TTL; +#endif // IP_TTL + } + + if (opt_value == 0 || + setsockopt(sock->socket, (sock->IPv6 ? IPPROTO_IPV6 : IPPROTO_IP), opt_value, (char *)&dw, size) == false) + { + return false; + } + + sock->CurrentTtl = ttl; + + return true; +} + +// Release of the socket +void ReleaseSock(SOCK *s) +{ + // Validate arguments + if (s == NULL) + { + return; + } + + if (Release(s->ref) == 0) + { + if (s->ListenMode == false && s->ServerMode) + { + Print(""); + } + CleanupSock(s); + } +} + +// Clean-up of the socket +void CleanupSock(SOCK *s) +{ + // Validate arguments + if (s == NULL) + { + return; + } + +// {Debug("CleanupSock: Disconnect() Called: %s %u\n", __FILE__, __LINE__);Disconnect(s);} + Disconnect(s); + + if (s->InProcAcceptQueue != NULL) + { + while (true) + { + SOCK *ss = GetNext(s->InProcAcceptQueue); + if (ss == NULL) + { + break; + } + + Disconnect(ss); + ReleaseSock(ss); + } + + ReleaseQueue(s->InProcAcceptQueue); + } + + if (s->InProcAcceptEvent != NULL) + { + ReleaseEvent(s->InProcAcceptEvent); + } + + if (s->ReverseAcceptQueue != NULL) + { + while (true) + { + SOCK *ss = GetNext(s->ReverseAcceptQueue); + if (ss == NULL) + { + break; + } + + Disconnect(ss); + ReleaseSock(ss); + } + + ReleaseQueue(s->ReverseAcceptQueue); + } + + if (s->ReverseAcceptEvent != NULL) + { + ReleaseEvent(s->ReverseAcceptEvent); + } + + if (s->SendTube != NULL) + { + TubeDisconnect(s->SendTube); + ReleaseTube(s->SendTube); + } + + if (s->RecvTube != NULL) + { + TubeDisconnect(s->RecvTube); + ReleaseTube(s->RecvTube); + } + + if (s->BulkRecvTube != NULL) + { + TubeDisconnect(s->BulkRecvTube); + ReleaseTube(s->BulkRecvTube); + } + + if (s->BulkSendTube != NULL) + { + TubeDisconnect(s->BulkSendTube); + ReleaseTube(s->BulkSendTube); + } + + if (s->BulkSendKey != NULL) + { + ReleaseSharedBuffer(s->BulkSendKey); + } + + if (s->BulkRecvKey != NULL) + { + ReleaseSharedBuffer(s->BulkRecvKey); + } + + if (s->InProcRecvFifo != NULL) + { + ReleaseFifo(s->InProcRecvFifo); + } + + if (s->R_UDP_Stack != NULL) + { + FreeRUDP(s->R_UDP_Stack); + } + +#ifdef OS_WIN32 + Win32FreeAsyncSocket(s); +#else // OS_WIN32 + UnixFreeAsyncSocket(s); +#endif // OS_WIN32 + + FreeBuf(s->SendBuf); + if (s->socket != INVALID_SOCKET) + { +#ifdef OS_WIN32 + closesocket(s->socket); +#else // OS_WIN32 + close(s->socket); +#endif // OS_WIN32 + } + Free(s->RemoteHostname); + +#ifdef OS_WIN32 + if (s->hAcceptEvent != NULL) + { + CloseHandle(s->hAcceptEvent); + } +#endif // OS_WIN32 + + // Release the certificate + if (s->RemoteX != NULL) + { + FreeX(s->RemoteX); + s->RemoteX = NULL; + } + if (s->LocalX != NULL) + { + FreeX(s->LocalX); + s->LocalX = NULL; + } + + // Cipher algorithm name + if (s->CipherName != NULL) + { + Free(s->CipherName); + s->CipherName = NULL; + } + + Free(s->WaitToUseCipher); + DeleteLock(s->lock); + DeleteLock(s->ssl_lock); + DeleteLock(s->disconnect_lock); + + Dec(num_tcp_connections); + + Free(s); +} + +// Creating a new socket +SOCK *NewSock() +{ + SOCK *s = ZeroMallocFast(sizeof(SOCK)); + + s->ref = NewRef(); + s->lock = NewLock(); + s->SendBuf = NewBuf(); + s->socket = INVALID_SOCKET; + s->ssl_lock = NewLock(); + s->disconnect_lock = NewLock(); + + Inc(num_tcp_connections); + + return s; +} + +// Convert the IP to UINT +UINT IPToUINT(IP *ip) +{ + UCHAR *b; + UINT i, value = 0; + // Validate arguments + if (ip == NULL) + { + return 0; + } + + b = (UCHAR *)&value; + for (i = 0; i < 4; i++) + { + b[i] = ip->addr[i]; + } + + return value; +} + +// Convert UINT to IP +void UINTToIP(IP *ip, UINT value) +{ + UCHAR *b; + UINT i; + // Validate arguments + if (ip == NULL) + { + return; + } + + ZeroIP4(ip); + + b = (UCHAR *)&value; + for (i = 0; i < 4; i++) + { + ip->addr[i] = b[i]; + } +} + +// Get the host name of the computer +void GetMachineHostName(char *name, UINT size) +{ + char tmp[MAX_SIZE]; + UINT i, len; + // Validate arguments + if (name == NULL) + { + return; + } + + GetMachineName(tmp, sizeof(tmp)); + + len = StrLen(tmp); + for (i = 0; i < len; i++) + { + if (tmp[i] == '.') + { + tmp[i] = 0; + } + } + + ConvertSafeFileName(name, size, tmp); +} + +// Get the computer name from 'hosts' +bool GetMachineNameFromHosts(char *name, UINT size) +{ + bool ret = false; + char *s; + BUF *b; + // Validate arguments + if (name == NULL) + { + return false; + } + + b = ReadDump("/etc/hosts"); + if (b == NULL) + { + return false; + } + + while (true) + { + s = CfgReadNextLine(b); + if (s == NULL) + { + break; + } + else + { + TOKEN_LIST *t = ParseToken(s, " \t"); + + if (t != NULL) + { + if (t->NumTokens >= 2) + { + if (StrCmpi(t->Token[0], "127.0.0.1") == 0) + { + UINT i; + + for (i = 1; i < t->NumTokens; i++) + { + if (StartWith(t->Token[i], "localhost") == false) + { + StrCpy(name, size, t->Token[i]); + ret = true; + } + } + } + } + } + FreeToken(t); + } + + Free(s); + } + + FreeBuf(b); + + return ret; +} + +// Get the computer name of this computer +void GetMachineName(char *name, UINT size) +{ + GetMachineNameEx(name, size, false); +} +void GetMachineNameEx(char *name, UINT size, bool no_load_hosts) +{ + static char name_cache[MAX_SIZE]; + static bool name_cached = false; + char tmp[MAX_SIZE]; + char tmp2[MAX_SIZE]; + // Validate arguments + if (name == NULL) + { + return; + } + + Lock(machine_name_lock); + { + if (name_cached != false) + { + StrCpy(name, size, name_cache); + Unlock(machine_name_lock); + return; + } + ClearStr(tmp, sizeof(tmp)); + if (gethostname(tmp, MAX_SIZE) != 0) + { + StrCpy(name, size, "Unknown"); + Unlock(machine_name_lock); + return; + } + ClearStr(name, size); + StrCpy(name, size, tmp); + if (IsEmptyStr(name) || StartWith(name, "localhost")) + { +#ifdef OS_WIN32 + ClearStr(name, size); + MsGetComputerName(name, size); +#endif // OS_WIN32 + } + if (IsEmptyStr(name) || StartWith(name, "localhost")) + { + if (no_load_hosts == false && OS_IS_UNIX(GetOsInfo()->OsType)) + { + if (GetMachineNameFromHosts(tmp2, sizeof(tmp2))) + { + StrCpy(name, size, tmp2); + } + } + } + + StrCpy(name_cache, sizeof(name_cache), name); + name_cached = true; + } + Unlock(machine_name_lock); +} + +// Host name acquisition thread +void GetHostNameThread(THREAD *t, void *p) +{ + IP *ip; + char hostname[256]; + // Validate arguments + if (t == NULL || p == NULL) + { + return; + } + + ip = (IP *)p; + + AddWaitThread(t); + + NoticeThreadInit(t); + + if (GetHostNameInner(hostname, sizeof(hostname), ip)) + { + AddHostCache(ip, hostname); + } + + Free(ip); + + DelWaitThread(t); +} + +// Get the host name +bool GetHostName(char *hostname, UINT size, IP *ip) +{ + THREAD *t; + IP *p_ip; + bool ret; + // Validate arguments + if (hostname == NULL || ip == NULL) + { + return false; + } + + if (GetHostCache(hostname, size, ip)) + { + if (IsEmptyStr(hostname) == false) + { + return true; + } + else + { + return false; + } + } + + p_ip = ZeroMalloc(sizeof(IP)); + Copy(p_ip, ip, sizeof(IP)); + + t = NewThread(GetHostNameThread, p_ip); + + WaitThreadInit(t); + + WaitThread(t, TIMEOUT_HOSTNAME); + + ReleaseThread(t); + + ret = GetHostCache(hostname, size, ip); + if (ret == false) + { + if (IsIP4(ip)) + { + ret = GetNetBiosName(hostname, size, ip); + if (ret) + { + AddHostCache(ip, hostname); + } + } + } + else + { + if (IsEmptyStr(hostname)) + { + ret = false; + } + } + if (ret == false) + { + AddHostCache(ip, ""); + StrCpy(hostname, size, ""); + } + + return ret; +} + +// Perform a DNS reverse query +bool GetHostNameInner(char *hostname, UINT size, IP *ip) +{ + struct in_addr addr; + struct sockaddr_in sa; + char tmp[MAX_SIZE]; + char ip_str[64]; + // Validate arguments + if (hostname == NULL || ip == NULL) + { + return false; + } + + if (IsIP6(ip)) + { + return GetHostNameInner6(hostname, size, ip); + } + + // Reverse resolution + IPToInAddr(&addr, ip); + Zero(&sa, sizeof(sa)); + sa.sin_family = AF_INET; + +#if defined(UNIX_BSD) || defined(UNIX_MACOS) + sa.sin_len = INET_ADDRSTRLEN; +#endif // UNIX_BSD || UNIX_MACOS + + Copy(&sa.sin_addr, &addr, sizeof(struct in_addr)); + sa.sin_port = 0; + + if (getnameinfo((struct sockaddr *)&sa, sizeof(sa), tmp, sizeof(tmp), NULL, 0, 0) != 0) + { + return false; + } + + IPToStr(ip_str, sizeof(ip_str), ip); + + if (StrCmpi(tmp, ip_str) == 0) + { + return false; + } + + if (IsEmptyStr(tmp)) + { + return false; + } + + StrCpy(hostname, size, tmp); + + return true; +} +bool GetHostNameInner6(char *hostname, UINT size, IP *ip) +{ + struct in6_addr addr; + struct sockaddr_in6 sa; + char tmp[MAX_SIZE]; + char ip_str[256]; + // Validate arguments + if (hostname == NULL || ip == NULL) + { + return false; + } + + // Reverse resolution + IPToInAddr6(&addr, ip); + Zero(&sa, sizeof(sa)); + sa.sin6_family = AF_INET6; + +#if defined(UNIX_BSD) || defined(UNIX_MACOS) + sa.sin6_len = INET6_ADDRSTRLEN; +#endif // UNIX_BSD || UNIX_MACOS + + Copy(&sa.sin6_addr, &addr, sizeof(struct in6_addr)); + sa.sin6_port = 0; + + if (getnameinfo((struct sockaddr *)&sa, sizeof(sa), tmp, sizeof(tmp), NULL, 0, 0) != 0) + { + return false; + } + + IPToStr(ip_str, sizeof(ip_str), ip); + + if (StrCmpi(tmp, ip_str) == 0) + { + return false; + } + + if (IsEmptyStr(tmp)) + { + return false; + } + + StrCpy(hostname, size, tmp); + + return true; +} + +#define NUM_NBT_QUERYS_SEND 3 + +// Get the NetBIOS name of the machine from the IP address +bool GetNetBiosName(char *name, UINT size, IP *ip) +{ + SOCK *s; + UINT i, j; + bool flag = false; + bool ok = false; + NBTREQUEST req; + UCHAR buf[1024]; + USHORT tran_id[NUM_NBT_QUERYS_SEND]; + UINT64 timeout_tick; + // Validate arguments + if (name == NULL || ip == NULL) + { + return false; + } + + IPToStr(name, size, ip); + + for (i = 0; i < NUM_NBT_QUERYS_SEND; i++) + { + tran_id[i] = Rand16(); + } + + s = NewUDP(0); + if (s == NULL) + { + return false; + } + + for (j = 0; j < NUM_NBT_QUERYS_SEND; j++) + { + Zero(&req, sizeof(req)); + req.TransactionId = Endian16(tran_id[j]); + req.NumQuestions = Endian16(1); + req.Query[0] = 0x20; + req.Query[1] = 0x43; + req.Query[2] = 0x4b; + for (i = 3; i <= 32; i++) + { + req.Query[i] = 0x41; + } + req.Query[35] = 0x21; + req.Query[37] = 0x01; + + if (SendTo(s, ip, 137, &req, sizeof(req)) == 0) + { + ReleaseSock(s); + return false; + } + } + + timeout_tick = Tick64() + (UINT64)TIMEOUT_NETBIOS_HOSTNAME; + + while (1) + { + UINT ret; + IP src_ip; + UINT src_port; + SOCKSET set; + if (Tick64() >= timeout_tick) + { + break; + } + InitSockSet(&set); + AddSockSet(&set, s); + Select(&set, 100, NULL, NULL); + + if (flag == false) + { + flag = true; + } + else + { + SleepThread(10); + } + + ret = RecvFrom(s, &src_ip, &src_port, buf, sizeof(buf)); + + if (ret == SOCK_LATER) + { + continue; + } + else if (ret == 0) + { + break; + } + else + { + if (ret >= sizeof(NBTRESPONSE)) + { + NBTRESPONSE *r = (NBTRESPONSE *)buf; + bool b = false; + UINT i; + USHORT id = Endian16(r->TransactionId); + for (i = 0; i < NUM_NBT_QUERYS_SEND; i++) + { + if (id == tran_id[i]) + { + b = true; + break; + } + } + if (b) + { + if (r->Flags != 0 && r->NumQuestions == 0 && r->AnswerRRs >= 1) + { + if (r->Response[0] == 0x20 && r->Response[1] == 0x43 && + r->Response[2] == 0x4b) + { + if (r->Response[34] == 0x00 && r->Response[35] == 0x21 && + r->Response[36] == 0x00 && r->Response[37] == 0x01) + { + char *a = (char *)(&r->Response[45]); + if (StrCheckLen(a, 15)) + { + if (IsEmptyStr(a) == false) + { + StrCpy(name, size, a); + Trim(name); + ok = true; + } + else + { + ok = false; + break; + } + } + } + } + } + } + } + } + } + + ReleaseSock(s); + return ok; +} + +// Set the IP address +void SetIP(IP *ip, UCHAR a1, UCHAR a2, UCHAR a3, UCHAR a4) +{ + // Validate arguments + if (ip == NULL) + { + return; + } + + Zero(ip, sizeof(IP)); + ip->addr[0] = a1; + ip->addr[1] = a2; + ip->addr[2] = a3; + ip->addr[3] = a4; +} +UINT SetIP32(UCHAR a1, UCHAR a2, UCHAR a3, UCHAR a4) +{ + IP ip; + + Zero(&ip, sizeof(ip)); + SetIP(&ip, a1, a2, a3, a4); + + return IPToUINT(&ip); +} + +// Obtain in both v4 and v6 results with a DNS forward lookup +bool GetIP46Ex(IP *ip4, IP *ip6, char *hostname, UINT timeout, bool *cancel) +{ + IP a, b; + bool ok_a, ok_b; + // Validate arguments + if (ip4 == NULL || ip6 == NULL || hostname == NULL) + { + return false; + } + + ZeroIP4(ip4); + ZeroIP6(ip6); + + ok_a = ok_b = false; + + if (GetIP6Ex(&a, hostname, timeout, cancel)) + { + ok_a = true; + } + + if (GetIP4Ex(&b, hostname, timeout, cancel)) + { + ok_b = true; + } + + if (ok_a) + { + if (IsIP4(&a)) + { + Copy(ip4, &a, sizeof(IP)); + } + } + if (ok_b) + { + if (IsIP4(&b)) + { + Copy(ip4, &b, sizeof(IP)); + } + + if (IsIP6(&b)) + { + Copy(ip6, &b, sizeof(IP)); + } + } + if (ok_a) + { + if (IsIP6(&a)) + { + Copy(ip6, &a, sizeof(IP)); + } + } + + if (IsZeroIp(ip4) && IsZeroIp(ip6)) + { + return false; + } + + return true; +} + +// Clean-up of the parameters for GetIP thread +void CleanupGetIPThreadParam(GETIP_THREAD_PARAM *p) +{ + // Validate arguments + if (p == NULL) + { + return; + } + + Free(p); +} + +// Release of the parameters of the GetIP for thread +void ReleaseGetIPThreadParam(GETIP_THREAD_PARAM *p) +{ + // Validate arguments + if (p == NULL) + { + return; + } + + if (Release(p->Ref) == 0) + { + CleanupGetIPThreadParam(p); + } +} + +// Thread to perform to query the DNS forward lookup (with timeout) +void GetIP4Ex6ExThread(THREAD *t, void *param) +{ + GETIP_THREAD_PARAM *p; + // Validate arguments + if (t == NULL || param == NULL) + { + return; + } + + p = (GETIP_THREAD_PARAM *)param; + + AddRef(p->Ref); + + NoticeThreadInit(t); + + AddWaitThread(t); + + // Execution of resolution + if (p->IPv6 == false) + { + // IPv4 + p->Ok = GetIP4Inner(&p->Ip, p->HostName); + } + else + { + // IPv6 + p->Ok = GetIP6Inner(&p->Ip, p->HostName); + } + + ReleaseGetIPThreadParam(p); + + DelWaitThread(t); + + Dec(getip_thread_counter); +} + +// Perform a forward DNS query (with timeout) +bool GetIP4Ex6Ex(IP *ip, char *hostname_arg, UINT timeout, bool ipv6, bool *cancel) +{ + return GetIP4Ex6Ex2(ip, hostname_arg, timeout, ipv6, cancel, false); +} +bool GetIP4Ex6Ex2(IP *ip, char *hostname_arg, UINT timeout, bool ipv6, bool *cancel, bool only_direct_dns) +{ + GETIP_THREAD_PARAM *p; + THREAD *t; + bool ret = false; + UINT64 start_tick = 0; + UINT64 end_tick = 0; + UINT64 spent_time = 0; + UINT64 now; + UINT n; + bool use_dns_proxy = false; + char hostname[260]; + UINT i; + bool timed_out; + // Validate arguments + if (ip == NULL || hostname_arg == NULL) + { + return false; + } + if (timeout == 0) + { + timeout = TIMEOUT_GETIP; + } + + Zero(hostname, sizeof(hostname)); + StrCpy(hostname, sizeof(hostname), hostname_arg); + + i = SearchStrEx(hostname, "/", 0, true); + if (i != INFINITE) + { + hostname[i] = 0; + } + + if (ipv6 == false) + { + IP ip2; + + if (StrToIP(&ip2, hostname) && IsZeroIp(&ip2) == false) + { + if (IsIP4(&ip2)) + { + // IPv4 address direct specification + Copy(ip, &ip2, sizeof(IP)); + return true; + } + else + { + // IPv6 address direct specification + return false; + } + } + } + else + { + IP ip2; + + if (StrToIP(&ip2, hostname) && IsZeroIp(&ip2) == false) + { + if (IsIP6(&ip2)) + { + // IPv6 address direct specification + Copy(ip, &ip2, sizeof(IP)); + return true; + } + else + { + // IPv4 address direct specification + return false; + } + } + } + + if (only_direct_dns == false) + { + if (ipv6 == false) + { + if (IsUseDnsProxy()) + { + use_dns_proxy = true; + } + } + } + + + // check the quota + start_tick = Tick64(); + end_tick = start_tick + (UINT64)timeout; + + n = 0; + + timed_out = false; + + while (true) + { + UINT64 now = Tick64(); + UINT64 remain; + UINT remain32; + + if (GetGetIpThreadMaxNum() > GetCurrentGetIpThreadNum()) + { + // below the quota + break; + } + + if (now >= end_tick) + { + // timeouted + timed_out = true; + break; + } + + if (cancel != NULL && (*cancel)) + { + // cancelled + timed_out = true; + break; + } + + remain = end_tick - now; + remain32 = MIN((UINT)remain, 100); + + SleepThread(remain32); + n++; + } + + now = Tick64(); + spent_time = now - start_tick; + + if (n == 0) + { + spent_time = 0; + } + + if ((UINT)spent_time >= timeout) + { + timed_out = true; + } + + if (timed_out) + { + IP ip2; + + // timed out, cancelled + if (QueryDnsCache(&ip2, hostname)) + { + ret = true; + + Copy(ip, &ip2, sizeof(IP)); + } + + Debug("GetIP4Ex6Ex2: Worker thread quota exceeded: max=%u current=%u\n", + GetGetIpThreadMaxNum(), GetCurrentGetIpThreadNum()); + + return ret; + } + + // Increment the counter + Inc(getip_thread_counter); + + if (spent_time != 0) + { + Debug("GetIP4Ex6Ex2: Waited for %u msecs to create a worker thread.\n", + spent_time); + } + + timeout -= (UINT)spent_time; + + p = ZeroMalloc(sizeof(GETIP_THREAD_PARAM)); + p->Ref = NewRef(); + StrCpy(p->HostName, sizeof(p->HostName), hostname); + p->IPv6 = ipv6; + p->Timeout = timeout; + p->Ok = false; + + t = NewThread(GetIP4Ex6ExThread, p); + WaitThreadInit(t); + + if (cancel == NULL) + { + WaitThread(t, timeout); + } + else + { + start_tick = Tick64(); + end_tick = start_tick + (UINT64)timeout; + + while (true) + { + UINT64 now = Tick64(); + UINT64 remain; + UINT remain32; + + if (*cancel) + { + break; + } + + if (now >= end_tick) + { + break; + } + + remain = end_tick - now; + remain32 = MIN((UINT)remain, 100); + + if (WaitThread(t, remain32)) + { + break; + } + } + } + + ReleaseThread(t); + + if (p->Ok) + { + ret = true; + Copy(ip, &p->Ip, sizeof(IP)); + } + else + { + IP ip2; + +#if 0 + if (only_direct_dns == false) + { + if (ipv6) + { + UINT flets_type = DetectFletsType(); + + // if I'm in the FLETs of NTT East, + // try to get an IP address using the DNS proxy server + if ((flets_type & FLETS_DETECT_TYPE_EAST_BFLETS_PRIVATE) && + GetIPViaDnsProxyForJapanFlets(ip, hostname, true, 0, cancel, NULL)) + { + // B FLETs + ret = true; + } + else if ((flets_type & FLETS_DETECT_TYPE_EAST_NGN_PRIVATE) && + GetIPViaDnsProxyForJapanFlets(ip, hostname, true, 0, cancel, FLETS_NGN_EAST_DNS_PROXY_HOSTNAME)) + { + // FLET'S Hikar-Next (NTT East) + ret = true; + } + else if ((flets_type & FLETS_DETECT_TYPE_WEST_NGN_PRIVATE) && + GetIPViaDnsProxyForJapanFlets(ip, hostname, true, 0, cancel, FLETS_NGN_WEST_DNS_PROXY_HOSTNAME)) + { + // FLET'S Hikar-Next (NTT West) + ret = true; + } + } + } +#endif + + if (QueryDnsCache(&ip2, hostname)) + { + ret = true; + + Copy(ip, &ip2, sizeof(IP)); + } + } + + + ReleaseGetIPThreadParam(p); + + return ret; +} +bool GetIP4Ex(IP *ip, char *hostname, UINT timeout, bool *cancel) +{ + return GetIP4Ex6Ex(ip, hostname, timeout, false, cancel); +} +bool GetIP6Ex(IP *ip, char *hostname, UINT timeout, bool *cancel) +{ + return GetIP4Ex6Ex(ip, hostname, timeout, true, cancel); +} +bool GetIP4(IP *ip, char *hostname) +{ + return GetIP4Ex(ip, hostname, 0, NULL); +} +bool GetIP6(IP *ip, char *hostname) +{ + return GetIP6Ex(ip, hostname, 0, NULL); +} + +// Perform a DNS forward lookup query +bool GetIP(IP *ip, char *hostname) +{ + return GetIPEx(ip, hostname, false); +} +bool GetIPEx(IP *ip, char *hostname, bool ipv6) +{ + if (ipv6 == false) + { + return GetIP4(ip, hostname); + } + else + { + return GetIP6(ip, hostname); + } +} +bool GetIP6Inner(IP *ip, char *hostname) +{ + struct sockaddr_in6 in; + struct in6_addr addr; + struct addrinfo hint; + struct addrinfo *info; + // Validate arguments + if (ip == NULL || hostname == NULL) + { + return false; + } + + if (IsEmptyStr(hostname)) + { + return false; + } + + if (StrCmpi(hostname, "localhost") == 0) + { + GetLocalHostIP6(ip); + return true; + } + + if (StrToIP6(ip, hostname) == false && StrToIP(ip, hostname) == false) + { + // Forward resolution + Zero(&hint, sizeof(hint)); + hint.ai_family = AF_INET6; + hint.ai_socktype = SOCK_STREAM; + hint.ai_protocol = IPPROTO_TCP; + info = NULL; + + if (getaddrinfo(hostname, NULL, &hint, &info) != 0 || + info->ai_family != AF_INET6) + { + if (info) + { + freeaddrinfo(info); + } + return QueryDnsCacheEx(ip, hostname, true); + } + // Forward resolution success + Copy(&in, info->ai_addr, sizeof(struct sockaddr_in6)); + freeaddrinfo(info); + + Copy(&addr, &in.sin6_addr, sizeof(addr)); + InAddrToIP6(ip, &addr); + } + + // Save Cache + NewDnsCache(hostname, ip); + + return true; +} +bool GetIP4Inner(IP *ip, char *hostname) +{ + struct sockaddr_in in; + struct in_addr addr; + struct addrinfo hint; + struct addrinfo *info; + // Validate arguments + if (ip == NULL || hostname == NULL) + { + return false; + } + + if (IsEmptyStr(hostname)) + { + return false; + } + + if (StrCmpi(hostname, "localhost") == 0) + { + SetIP(ip, 127, 0, 0, 1); + return true; + } + + if (StrToIP6(ip, hostname) == false && StrToIP(ip, hostname) == false) + { + // Forward resolution + Zero(&hint, sizeof(hint)); + hint.ai_family = AF_INET; + hint.ai_socktype = SOCK_STREAM; + hint.ai_protocol = IPPROTO_TCP; + info = NULL; + + if (getaddrinfo(hostname, NULL, &hint, &info) != 0 || + info->ai_family != AF_INET) + { + if (info) + { + freeaddrinfo(info); + } + return QueryDnsCache(ip, hostname); + } + // Forward resolution success + Copy(&in, info->ai_addr, sizeof(struct sockaddr_in)); + freeaddrinfo(info); + Copy(&addr, &in.sin_addr, sizeof(addr)); + InAddrToIP(ip, &addr); + } + + // Save Cache + NewDnsCache(hostname, ip); + + return true; +} + +// Search in the DNS cache +bool QueryDnsCache(IP *ip, char *hostname) +{ + return QueryDnsCacheEx(ip, hostname, false); +} +bool QueryDnsCacheEx(IP *ip, char *hostname, bool ipv6) +{ + DNSCACHE *c; + char tmp[MAX_SIZE]; + // Validate arguments + if (ip == NULL || hostname == NULL) + { + return false; + } + + GenDnsCacheKeyName(tmp, sizeof(tmp), hostname, ipv6); + + c = FindDnsCache(tmp); + if (c == NULL) + { + return false; + } + + Copy(ip, &c->IpAddress, sizeof(IP)); + + return true; +} + +// Convert the IP to a string +void IPToUniStr(wchar_t *str, UINT size, IP *ip) +{ + char tmp[128]; + + IPToStr(tmp, sizeof(tmp), ip); + StrToUni(str, size, tmp); +} + +// Convert the IP to a string (32bit UINT) +void IPToUniStr32(wchar_t *str, UINT size, UINT ip) +{ + char tmp[128]; + + IPToStr32(tmp, sizeof(tmp), ip); + StrToUni(str, size, tmp); +} + +// Convert the IP to a string (32bit UINT) +void IPToStr32(char *str, UINT size, UINT ip) +{ + IP ip_st; + // Validate arguments + if (str == NULL) + { + return; + } + + UINTToIP(&ip_st, ip); + IPToStr(str, size, &ip_st); +} + +// Convert IPv4 or IPv6 to a string +void IPToStr4or6(char *str, UINT size, UINT ip_4_uint, UCHAR *ip_6_bytes) +{ + IP ip4; + IP ip6; + IP ip; + // Validate arguments + if (str == NULL) + { + return; + } + + Zero(&ip, sizeof(ip)); + + UINTToIP(&ip4, ip_4_uint); + SetIP6(&ip6, ip_6_bytes); + + if (IsIP6(&ip4) || (IsZeroIp(&ip4) && (IsZeroIp(&ip6) == false))) + { + Copy(&ip, &ip6, sizeof(IP)); + } + else + { + Copy(&ip, &ip4, sizeof(IP)); + } + + IPToStr(str, size, &ip); +} + +// Convert the IP to a string +void IPToStr(char *str, UINT size, IP *ip) +{ + // Validate arguments + if (str == NULL || ip == NULL) + { + return; + } + + if (IsIP6(ip)) + { + IPToStr6(str, size, ip); + } + else + { + IPToStr4(str, size, ip); + } +} + +// Convert the IPv4 to a string +void IPToStr4(char *str, UINT size, IP *ip) +{ + // Validate arguments + if (str == NULL || ip == NULL) + { + return; + } + + // Conversion + snprintf(str, size != 0 ? size : 64, "%u.%u.%u.%u", ip->addr[0], ip->addr[1], ip->addr[2], ip->addr[3]); +} + +// Convert the string to an IP +bool StrToIP(IP *ip, char *str) +{ + TOKEN_LIST *token; + char *tmp; + UINT i; + // Validate arguments + if (ip == NULL || str == NULL) + { + return false; + } + + if (StrToIP6(ip, str)) + { + return true; + } + + Zero(ip, sizeof(IP)); + + tmp = CopyStr(str); + Trim(tmp); + token = ParseToken(tmp, "."); + Free(tmp); + + if (token->NumTokens != 4) + { + FreeToken(token); + return false; + } + for (i = 0; i < 4; i++) + { + char *s = token->Token[i]; + if (s[0] < '0' || s[0] > '9' || + (ToInt(s) >= 256)) + { + FreeToken(token); + return false; + } + } + Zero(ip, sizeof(IP)); + for (i = 0; i < 4; i++) + { + ip->addr[i] = (UCHAR)ToInt(token->Token[i]); + } + + FreeToken(token); + + return true; +} +UINT StrToIP32(char *str) +{ + IP ip; + // Validate arguments + if (str == NULL) + { + return 0; + } + + if (StrToIP(&ip, str) == false) + { + return 0; + } + + return IPToUINT(&ip); +} +UINT UniStrToIP32(wchar_t *str) +{ + UINT ret; + char *tmp; + + tmp = CopyUniToStr(str); + ret = StrToIP32(tmp); + Free(tmp); + + return ret; +} + +// Convert the IP to the in_addr +void IPToInAddr(struct in_addr *addr, IP *ip) +{ + UINT i; + // Validate arguments + if (addr == NULL || ip == NULL) + { + return; + } + + Zero(addr, sizeof(struct in_addr)); + + if (IsIP6(ip) == false) + { + for (i = 0; i < 4; i++) + { + ((UCHAR *)addr)[i] = ip->addr[i]; + } + } +} + +// Convert the IP to the in6_addr +void IPToInAddr6(struct in6_addr *addr, IP *ip) +{ + UINT i; + // Validate arguments + if (addr == NULL || ip == NULL) + { + return; + } + + Zero(addr, sizeof(struct in6_addr)); + + if (IsIP6(ip)) + { + for (i = 0; i < 16; i++) + { + ((UCHAR *)addr)[i] = ip->ipv6_addr[i]; + } + } +} + +// Convert the in_addr to the IP +void InAddrToIP(IP *ip, struct in_addr *addr) +{ + UINT i; + // Validate arguments + if (ip == NULL || addr == NULL) + { + return; + } + + Zero(ip, sizeof(IP)); + + for (i = 0; i < 4; i++) + { + ip->addr[i] = ((UCHAR *)addr)[i]; + } +} + +// Convert the in6_addr to the IP +void InAddrToIP6(IP *ip, struct in6_addr *addr) +{ + UINT i; + // Validate arguments + if (ip == NULL || addr == NULL) + { + return; + } + + ZeroIP6(ip); + for (i = 0; i < 16; i++) + { + ip->ipv6_addr[i] = ((UCHAR *)addr)[i]; + } +} + +// Search in the DNS cache +DNSCACHE *FindDnsCache(char *hostname) +{ + return FindDnsCacheEx(hostname, false); +} +DNSCACHE *FindDnsCacheEx(char *hostname, bool ipv6) +{ + DNSCACHE *c; + char tmp[MAX_SIZE]; + if (hostname == NULL) + { + return NULL; + } + + GenDnsCacheKeyName(tmp, sizeof(tmp), hostname, ipv6); + + LockDnsCache(); + { + DNSCACHE t; + t.HostName = tmp; + c = Search(DnsCache, &t); + } + UnlockDnsCache(); + + return c; +} + +// Generate the IPv4 / IPv6 key name for the DNS cache +void GenDnsCacheKeyName(char *dst, UINT size, char *src, bool ipv6) +{ + // Validate arguments + if (dst == NULL || src == NULL) + { + return; + } + + if (ipv6 == false) + { + StrCpy(dst, size, src); + } + else + { + Format(dst, size, "%s@ipv6", src); + } +} + +// Registration of the new DNS cache +void NewDnsCache(char *hostname, IP *ip) +{ + NewDnsCacheEx(hostname, ip, IsIP6(ip)); +} +void NewDnsCacheEx(char *hostname, IP *ip, bool ipv6) +{ + DNSCACHE *c; + char tmp[MAX_PATH]; + // Validate arguments + if (hostname == NULL || ip == NULL) + { + return; + } + + if (IsNetworkNameCacheEnabled() == false) + { + return; + } + + GenDnsCacheKeyName(tmp, sizeof(tmp), hostname, ipv6); + + LockDnsCache(); + { + DNSCACHE t; + + // Search for anything matches to the hostname first + t.HostName = tmp; + c = Search(DnsCache, &t); + + if (c == NULL) + { + // Newly register + c = ZeroMalloc(sizeof(DNSCACHE)); + c->HostName = CopyStr(tmp); + + Copy(&c->IpAddress, ip, sizeof(IP)); + + Add(DnsCache, c); + } + else + { + // Update + Copy(&c->IpAddress, ip, sizeof(IP)); + } + } + UnlockDnsCache(); +} + +// Name comparison of the DNS cache entries +int CompareDnsCache(void *p1, void *p2) +{ + DNSCACHE *c1, *c2; + if (p1 == NULL || p2 == NULL) + { + return 0; + } + c1 = *(DNSCACHE **)p1; + c2 = *(DNSCACHE **)p2; + if (c1 == NULL || c2 == NULL) + { + return 0; + } + + return StrCmpi(c1->HostName, c2->HostName); +} + +// Initialization of the DNS cache +void InitDnsCache() +{ + // Creating a List + DnsCache = NewList(CompareDnsCache); +} + +// Release of the DNS cache +void FreeDnsCache() +{ + LockDnsCache(); + { + DNSCACHE *c; + UINT i; + for (i = 0; i < LIST_NUM(DnsCache); i++) + { + // Release the memory for the entry + c = LIST_DATA(DnsCache, i); + Free(c->HostName); + Free(c); + } + } + UnlockDnsCache(); + + // Release the list + ReleaseList(DnsCache); + DnsCache = NULL; +} + +// Lock the DNS cache +void LockDnsCache() +{ + LockList(DnsCache); +} + +// Unlock the DNS cache +void UnlockDnsCache() +{ + UnlockList(DnsCache); +} + +// DH temp key callback +DH *TmpDhCallback(SSL *ssl, int is_export, int keylength) +{ + DH *ret = NULL; + + if (dh_param != NULL) + { + ret = dh_param->dh; + } + + return ret; +} + +// Create the SSL_CTX +struct ssl_ctx_st *NewSSLCtx(bool server_mode) +{ + struct ssl_ctx_st *ctx = SSL_CTX_new(SSLv23_method()); + + // It resets some parameters. + if (server_mode) + { + SSL_CTX_set_ssl_version(ctx, SSLv23_server_method()); + } + else + { + SSL_CTX_set_ssl_version(ctx, SSLv23_client_method()); + } + +#ifdef SSL_OP_NO_SSLv3 + SSL_CTX_set_options(ctx, SSL_OP_NO_SSLv3); +#endif // SSL_OP_NO_SSLv3 + +#ifdef SSL_OP_NO_TICKET + SSL_CTX_set_options(ctx, SSL_OP_NO_TICKET); +#endif // SSL_OP_NO_TICKET + +#ifdef SSL_OP_CIPHER_SERVER_PREFERENCE + if (server_mode) + { + SSL_CTX_set_options(ctx, SSL_OP_CIPHER_SERVER_PREFERENCE); + } +#endif // SSL_OP_CIPHER_SERVER_PREFERENCE + + SSL_CTX_set_tmp_dh_callback(ctx, TmpDhCallback); + +#ifdef SSL_CTX_set_ecdh_auto + SSL_CTX_set_ecdh_auto(ctx, 1); +#endif // SSL_CTX_set_ecdh_auto + + return ctx; +} + +// Release of the SSL_CTX +void FreeSSLCtx(struct ssl_ctx_st *ctx) +{ + // Validate arguments + if (ctx == NULL) + { + return; + } + + SSL_CTX_free(ctx); +} + +// Get OS (maximum) Security Level +UINT GetOSSecurityLevel() +{ + UINT security_level_new = 0, security_level_set_ssl_version = 0; + struct ssl_ctx_st *ctx = SSL_CTX_new(SSLv23_method()); + +#if OPENSSL_VERSION_NUMBER >= 0x10100000L && !defined(LIBRESSL_VERSION_NUMBER) + security_level_new = SSL_CTX_get_security_level(ctx); +#endif + + security_level_set_ssl_version = SSL_CTX_set_ssl_version(ctx, SSLv23_server_method()); + + FreeSSLCtx(ctx); + + if(security_level_new >= security_level_set_ssl_version) + { + return security_level_new; + } + + return security_level_set_ssl_version; +} + +// The number of get ip threads +void SetGetIpThreadMaxNum(UINT num) +{ + max_getip_thread = num; +} +UINT GetGetIpThreadMaxNum() +{ + UINT ret = max_getip_thread; + + if (ret == 0) + { + ret = 0x7FFFFFFF; + } + + return ret; +} +UINT GetCurrentGetIpThreadNum() +{ + return Count(getip_thread_counter); +} + +// Initialize the network communication module +void InitNetwork() +{ + disable_gethostname_by_accept = false; + + + InitDynList(); + + + host_ip_address_list_cache_lock = NewLock(); + host_ip_address_list_cache_last = 0; + + num_tcp_connections = NewCounter(); + + getip_thread_counter = NewCounter(); + + // Initialization of client list + InitIpClientList(); + + // Thread related initialization + InitWaitThread(); + + // Initialization of the host name cache + InitHostCache(); + +#ifdef OS_WIN32 + // Initializing the socket library + Win32InitSocketLibrary(); +#else + UnixInitSocketLibrary(); +#endif // OS_WIN32 + + // Initialization of the DNS cache + InitDnsCache(); + + // Locking initialization + machine_name_lock = NewLock(); + disconnect_function_lock = NewLock(); + aho = NewLock(); + machine_ip_process_hash_lock = NewLock(); + socket_library_lock = NewLock(); + //ssl_connect_lock = NewLock(); //2012.9.28 Not required for recent OpenSSL +// ssl_accept_lock = NewLock(); + dns_lock = NewLock(); + unix_dns_server_addr_lock = NewLock(); + Zero(&unix_dns_server, sizeof(unix_dns_server)); + local_mac_list_lock = NewLock(); + + current_global_ip_lock = NewLock(); + current_fqdn_lock = NewLock(); + current_global_ip_set = false; + + disable_cache = false; + + Zero(rand_port_numbers, sizeof(rand_port_numbers)); + + SetGetIpThreadMaxNum(DEFAULT_GETIP_THREAD_MAX_NUM); +} + +// Enable the network name cache +void EnableNetworkNameCache() +{ + disable_cache = false; +} + +// Disable the network name cache +void DisableNetworkNameCache() +{ + disable_cache = true; +} + +// Get whether the network name cache is enabled +bool IsNetworkNameCacheEnabled() +{ + return !disable_cache; +} + +// Get the cipher algorithm list +TOKEN_LIST *GetCipherList() +{ + UINT i; + SSL *ssl; + SSL_CTX *ctx; + const char *name; + STACK_OF(SSL_CIPHER) *sk; + + TOKEN_LIST *ciphers = ZeroMalloc(sizeof(TOKEN_LIST)); + + ctx = NewSSLCtx(true); + if (ctx == NULL) + { + return ciphers; + } + + ssl = SSL_new(ctx); + if (ssl == NULL) + { + FreeSSLCtx(ctx); + return ciphers; + } + +#if OPENSSL_VERSION_NUMBER >= 0x10100000L && !defined(LIBRESSL_VERSION_NUMBER) + sk = SSL_get1_supported_ciphers(ssl); +#else + sk = SSL_get_ciphers(ssl); +#endif + + for (i = 0; i < (UINT)sk_SSL_CIPHER_num(sk); i++) + { + const SSL_CIPHER *c = sk_SSL_CIPHER_value(sk, i); + + name = SSL_CIPHER_get_name(c); + if (IsEmptyStr((char *)name)) + { + break; + } + + ciphers->NumTokens++; + + if (ciphers->Token != NULL) + { + ciphers->Token = ReAlloc(ciphers->Token, sizeof(char *) * ciphers->NumTokens); + } + else + { + ciphers->Token = Malloc(sizeof(char *)); + } + + ciphers->Token[i] = CopyStr((char *)name); + } + + sk_SSL_CIPHER_free(sk); + SSL_free(ssl); + + return ciphers; +} + +// Get the TCP connections counter +COUNTER *GetNumTcpConnectionsCounter() +{ + return num_tcp_connections; +} + +// Get the current global IP address +bool GetCurrentGlobalIP(IP *ip, bool ipv6) +{ + bool ret = false; + // Validate arguments + if (ip == NULL) + { + return false; + } + + Zero(ip, sizeof(IP)); + + Lock(current_global_ip_lock); + { + if (ipv6 == false) + { + Copy(ip, ¤t_glocal_ipv4, sizeof(IP)); + } + else + { + Copy(ip, ¤t_glocal_ipv6, sizeof(IP)); + } + + ret = current_global_ip_set; + } + Unlock(current_global_ip_lock); + + return ret; +} + +// Check whether the specified IP address is assigned to the local host +bool IsIPMyHost(IP *ip) +{ + LIST *o; + UINT i; + bool ret = false; + // Validate arguments + if (ip == NULL) + { + return false; + } + + if (IsZeroIp(ip)) + { + return false; + } + + // Search to check whether it matches to any of the IP of the local host + o = GetHostIPAddressList(); + + for (i = 0; i < LIST_NUM(o); i++) + { + IP *p = LIST_DATA(o, i); + + if (CmpIpAddr(p, ip) == 0) + { + // Matched + ret = true; + break; + } + } + + FreeHostIPAddressList(o); + + if (ret == false) + { + if (IsLocalHostIP(ip)) + { + // localhost IP addresses + ret = true; + } + } + + return ret; +} + +// Check whether the specified IP address is a private IP address +bool IsIPPrivate(IP *ip) +{ + // Validate arguments + if (ip == NULL) + { + return false; + } + + if (ip->addr[0] == 10) + { + return true; + } + + if (ip->addr[0] == 172) + { + if (ip->addr[1] >= 16 && ip->addr[1] <= 31) + { + return true; + } + } + + if (ip->addr[0] == 192 && ip->addr[1] == 168) + { + return true; + } + + if (ip->addr[0] == 169 && ip->addr[1] == 254) + { + return true; + } + + if (ip->addr[0] == 100) + { + if (ip->addr[1] >= 64 && ip->addr[1] <= 127) + { + return true; + } + } + + if (g_private_ip_list != NULL) + { + if (IsIP4(ip)) + { + UINT ip4 = IPToUINT(ip); + + return IsOnPrivateIPFile(ip4); + } + } + + return false; +} + +// Read a private IP list file +void LoadPrivateIPFile() +{ + BUF *b = ReadDump(PRIVATE_IP_TXT_FILENAME); + LIST *o; + if (b == NULL) + { + return; + } + + o = NewList(NULL); + + while (true) + { + char *line = CfgReadNextLine(b); + if (line == NULL) + { + break; + } + + Trim(line); + + if (IsEmptyStr(line) == false) + { + UINT ip = 0, mask = 0; + + if (ParseIpAndSubnetMask4(line, &ip, &mask)) + { + PRIVATE_IP_SUBNET *p = ZeroMalloc(sizeof(PRIVATE_IP_SUBNET)); + + p->Ip = ip; + p->Mask = mask; + p->Ip2 = ip & mask; + + Add(o, p); + } + } + + Free(line); + } + + g_private_ip_list = o; + g_use_privateip_file = true; + + FreeBuf(b); +} + +// Examine whether the specified IP address is in the private IP file +bool IsOnPrivateIPFile(UINT ip) +{ + bool ret = false; + + if (g_private_ip_list != NULL) + { + LIST *o = g_private_ip_list; + UINT i; + + for (i = 0; i < LIST_NUM(o); i++) + { + PRIVATE_IP_SUBNET *p = LIST_DATA(o, i); + + if ((ip & p->Mask) == p->Ip2) + { + ret = true; + } + } + } + + return ret; +} + +// Free the private IP file +void FreePrivateIPFile() +{ + if (g_private_ip_list != NULL) + { + LIST *o = g_private_ip_list; + UINT i; + + g_private_ip_list = NULL; + + for (i = 0; i < LIST_NUM(o); i++) + { + PRIVATE_IP_SUBNET *p = LIST_DATA(o, i); + + Free(p); + } + + ReleaseList(o); + } + + g_use_privateip_file = false; +} + +// Check whether the specified IP address is in the same network to this computer +bool IsIPAddressInSameLocalNetwork(IP *a) +{ + bool ret = false; + LIST *o; + UINT i; + // Validate arguments + if (a == NULL) + { + return false; + } + + o = GetHostIPAddressList(); + + if (o != NULL) + { + for (i = 0; i < LIST_NUM(o); i++) + { + IP *p = LIST_DATA(o, i); + + if (IsIP4(p)) + { + if (IsZeroIp(p) == false && p->addr[0] != 127) + { + if (IsInSameNetwork4Standard(p, a)) + { + ret = true; + break; + } + } + } + } + + FreeHostIPAddressList(o); + } + + return ret; +} + +// Guess the IPv4, IPv6 global address from the IP address list of the current interface +void GetCurrentGlobalIPGuess(IP *ip, bool ipv6) +{ + LIST *o; + UINT i; + // Validate arguments + if (ip == NULL) + { + return; + } + + Zero(ip, sizeof(IP)); + + o = GetHostIPAddressList(); + + if (ipv6 == false) + { + // IPv4 + for (i = 0; i < LIST_NUM(o); i++) + { + IP *p = LIST_DATA(o, i); + + if (IsIP4(p)) + { + if (IsZeroIp(p) == false && IsIPPrivate(p) == false && p->addr[0] != 127) + { + Copy(ip, p, sizeof(IP)); + } + } + } + + if (IsZeroIp(ip)) + { + for (i = 0; i < LIST_NUM(o); i++) + { + IP *p = LIST_DATA(o, i); + + if (IsIP4(p)) + { + if (IsZeroIp(p) == false && IsIPPrivate(p) && p->addr[0] != 127) + { + Copy(ip, p, sizeof(IP)); + } + } + } + } + + if (IsZeroIp(ip)) + { + SetIP(ip, 127, 0, 0, 1); + } + } + else + { + // IPv6 + for (i = 0; i < LIST_NUM(o); i++) + { + IP *p = LIST_DATA(o, i); + + if (IsIP6(p)) + { + UINT type = GetIPAddrType6(p); + + if ((type & IPV6_ADDR_GLOBAL_UNICAST) && ((type & IPV6_ADDR_ZERO) == 0) && ((type & IPV6_ADDR_LOOPBACK) == 0)) + { + Copy(ip, p, sizeof(IP)); + } + } + } + } + + FreeHostIPAddressList(o); +} + +// Record the current global IP address +void SetCurrentGlobalIP(IP *ip, bool ipv6) +{ + // Validate arguments + if (ip == NULL) + { + return; + } + + if (IsZeroIp(ip)) + { + return; + } + + Lock(current_global_ip_lock); + { + if (ipv6 == false) + { + Copy(¤t_glocal_ipv4, ip, sizeof(IP)); + } + else + { + Copy(¤t_glocal_ipv6, ip, sizeof(IP)); + } + + current_global_ip_set = true; + } + Unlock(current_global_ip_lock); +} + +// Release of the network communication module +void FreeNetwork() +{ + + if (dh_param != NULL) + { + DhFree(dh_param); + dh_param = NULL; + } + + // Release of thread-related + FreeWaitThread(); + + Zero(&unix_dns_server, sizeof(unix_dns_server)); + + // Release the locks + DeleteLock(unix_dns_server_addr_lock); + DeleteLock(dns_lock); + DeleteLock(ssl_accept_lock); + DeleteLock(machine_name_lock); + DeleteLock(disconnect_function_lock); + DeleteLock(aho); + DeleteLock(socket_library_lock); + DeleteLock(ssl_connect_lock); + DeleteLock(machine_ip_process_hash_lock); + machine_name_lock = NULL; + ssl_accept_lock = machine_name_lock = disconnect_function_lock = + aho = socket_library_lock = ssl_connect_lock = machine_ip_process_hash_lock = NULL; + + // Release of the DNS cache + FreeDnsCache(); + + // Release of the host name cache + FreeHostCache(); + +#ifdef OS_WIN32 + // Release of the socket library + Win32FreeSocketLibrary(); +#else + UnixFreeSocketLibrary(); +#endif // OS_WIN32 + + DeleteCounter(num_tcp_connections); + num_tcp_connections = NULL; + + // Release of client list + FreeIpClientList(); + + DeleteLock(current_global_ip_lock); + current_global_ip_lock = NULL; + + DeleteLock(current_fqdn_lock); + current_fqdn_lock = NULL; + + // Release of the local MAC list + if (local_mac_list != NULL) + { + FreeNicList(local_mac_list); + local_mac_list = NULL; + } + + DeleteLock(local_mac_list_lock); + local_mac_list_lock = NULL; + + DeleteLock(host_ip_address_list_cache_lock); + host_ip_address_list_cache_lock = NULL; + + FreeHostIPAddressList(host_ip_address_cache); + host_ip_address_cache = NULL; + + + FreeDynList(); + + DeleteCounter(getip_thread_counter); + getip_thread_counter = NULL; + +} + +// Stop all the sockets in the list and delete it +void StopSockList(SOCKLIST *sl) +{ + SOCK **ss; + UINT num, i; + // Validate arguments + if (sl == NULL) + { + return; + } + + LockList(sl->SockList); + { + num = LIST_NUM(sl->SockList); + ss = ToArray(sl->SockList); + + DeleteAll(sl->SockList); + } + UnlockList(sl->SockList); + + for (i = 0; i < num; i++) + { + SOCK *s = ss[i]; + + Disconnect(s); + ReleaseSock(s); + } + + Free(ss); +} + +// Delete the socket list +void FreeSockList(SOCKLIST *sl) +{ + // Validate arguments + if (sl == NULL) + { + return; + } + + StopSockList(sl); + + ReleaseList(sl->SockList); + + Free(sl); +} + +// Creating a socket list +SOCKLIST *NewSockList() +{ + SOCKLIST *sl = ZeroMallocFast(sizeof(SOCKLIST)); + + sl->SockList = NewList(NULL); + + return sl; +} + +// Time-out thread of the socket on Solaris +void SocketTimeoutThread(THREAD *t, void *param) +{ + SOCKET_TIMEOUT_PARAM *ttparam; + ttparam = (SOCKET_TIMEOUT_PARAM *)param; + + // Wait for time-out period + Select(NULL, ttparam->sock->TimeOut, ttparam->cancel, NULL); + + // Disconnect if it is blocked + if(! ttparam->unblocked) + { +// Debug("Socket timeouted\n"); + closesocket(ttparam->sock->socket); + } + else + { +// Debug("Socket timeout cancelled\n"); + } +} + +// Initialize and start the thread for time-out +SOCKET_TIMEOUT_PARAM *NewSocketTimeout(SOCK *sock) +{ + SOCKET_TIMEOUT_PARAM *ttp; + if(! sock->AsyncMode && sock->TimeOut != TIMEOUT_INFINITE) + { +// Debug("NewSockTimeout(%u)\n",sock->TimeOut); + + ttp = (SOCKET_TIMEOUT_PARAM *)Malloc(sizeof(SOCKET_TIMEOUT_PARAM)); + + // Set the parameters of the time-out thread + ttp->cancel = NewCancel(); + ttp->sock = sock; + ttp->unblocked = false; + ttp->thread = NewThread(SocketTimeoutThread, ttp); + return ttp; + } + return NULL; +} + +// Stop and free the thread for timeout +void FreeSocketTimeout(SOCKET_TIMEOUT_PARAM *ttp) +{ + if(ttp == NULL) + { + return; + } + + ttp->unblocked = true; + Cancel(ttp->cancel); + WaitThread(ttp->thread, INFINITE); + ReleaseCancel(ttp->cancel); + ReleaseThread(ttp->thread); + Free(ttp); +// Debug("FreeSocketTimeout succeed\n"); + return; +} + +// Parse the IP address and subnet mask +bool ParseIpAndSubnetMask46(char *src, IP *ip, IP *mask) +{ + // Validate arguments + if (src == NULL || ip == NULL || mask == NULL) + { + return false; + } + + if (ParseIpAndMask46(src, ip, mask) == false) + { + return false; + } + + if (IsIP4(ip)) + { + return IsSubnetMask4(mask); + } + else + { + return IsSubnetMask6(mask); + } +} +bool ParseIpAndSubnetMask4(char *src, UINT *ip, UINT *mask) +{ + IP ip2, mask2; + // Validate arguments + if (src == NULL) + { + return false; + } + + if (ParseIpAndSubnetMask46(src, &ip2, &mask2) == false) + { + return false; + } + + if (IsIP4(&ip2) == false) + { + return false; + } + + if (ip != NULL) + { + *ip = IPToUINT(&ip2); + } + + if (mask != NULL) + { + *mask = IPToUINT(&mask2); + } + + return true; +} + + +// Parse the IP address and the mask +bool ParseIpAndMask46(char *src, IP *ip, IP *mask) +{ + TOKEN_LIST *t; + char *ipstr; + char *subnetstr; + bool ret = false; + IP ip2; + IP mask2; + // Validate arguments + if (src == NULL || ip == NULL || mask == NULL) + { + return false; + } + + Zero(&ip2, sizeof(IP)); + Zero(&mask2, sizeof(IP)); + + t = ParseToken(src, "/"); + if (t->NumTokens != 2) + { + FreeToken(t); + return false; + } + + ipstr = t->Token[0]; + subnetstr = t->Token[1]; + Trim(ipstr); + Trim(subnetstr); + + if (StrToIP(&ip2, ipstr)) + { + if (StrToIP(&mask2, subnetstr)) + { + // Compare the kind of the mask part and the IP address part to confirm same + if (IsIP6(&ip2) && IsIP6(&mask2)) + { + // Both are IPv6 + ret = true; + Copy(ip, &ip2, sizeof(IP)); + Copy(mask, &mask2, sizeof(IP)); + } + else if (IsIP4(&ip2) && IsIP4(&mask2)) + { + // Both are IPv4 + ret = true; + Copy(ip, &ip2, sizeof(IP)); + Copy(mask, &mask2, sizeof(IP)); + } + } + else + { + if (IsNum(subnetstr)) + { + UINT i = ToInt(subnetstr); + // Mask part is a number + if (IsIP6(&ip2) && i <= 128) + { + ret = true; + Copy(ip, &ip2, sizeof(IP)); + IntToSubnetMask6(mask, i); + } + else if (i <= 32) + { + ret = true; + Copy(ip, &ip2, sizeof(IP)); + IntToSubnetMask4(mask, i); + } + } + } + } + + FreeToken(t); + + return ret; +} +bool ParseIpAndMask4(char *src, UINT *ip, UINT *mask) +{ + IP ip_ip, ip_mask; + if (ParseIpAndMask46(src, &ip_ip, &ip_mask) == false) + { + return false; + } + + if (IsIP4(&ip_ip) == false) + { + return false; + } + + if (ip != NULL) + { + *ip = IPToUINT(&ip_ip); + } + + if (mask != NULL) + { + *mask = IPToUINT(&ip_mask); + } + + return true; +} +bool ParseIpAndMask6(char *src, IP *ip, IP *mask) +{ + if (ParseIpAndMask46(src, ip, mask) == false) + { + return false; + } + + if (IsIP6(ip) == false) + { + return false; + } + + return true; +} + + +// Check whether the specification of the IPv4 address is correct +bool IsIpStr4(char *str) +{ + // Validate arguments + if (str == NULL) + { + return false; + } + + if (StrToIP32(str) == 0 && StrCmpi(str, "0.0.0.0") != 0) + { + return false; + } + + return true; +} + +// Check whether the specification of the IPv6 address is correct +bool IsIpStr6(char *str) +{ + IP ip; + // Validate arguments + if (str == NULL) + { + return false; + } + + if (StrToIP6(&ip, str) == false) + { + return false; + } + + return true; +} + +// Convert the string to an IPv6 mask +bool StrToMask6(IP *mask, char *str) +{ + // Validate arguments + if (mask == NULL || str == NULL) + { + return false; + } + + if (str[0] == '/') + { + str++; + } + + if (IsNum(str)) + { + UINT n = ToInt(str); + + if (n <= 128) + { + IntToSubnetMask6(mask, n); + return true; + } + else + { + return false; + } + } + else + { + if (StrToIP(mask, str) == false) + { + return false; + } + else + { + return IsIP6(mask); + } + } +} +bool StrToMask6Addr(IPV6_ADDR *mask, char *str) +{ + IP ip; + + if (StrToMask6(&ip, str) == false) + { + return false; + } + + if (IPToIPv6Addr(mask, &ip) == false) + { + return false; + } + + return true; +} + +// Convert the IPv4 / IPv6 mask to a string +void MaskToStr(char *str, UINT size, IP *mask) +{ + MaskToStrEx(str, size, mask, false); +} +void MaskToStrEx(char *str, UINT size, IP *mask, bool always_full_address) +{ + // Validate arguments + if (str == NULL || mask == NULL) + { + return; + } + + if (always_full_address == false && IsSubnetMask(mask)) + { + ToStr(str, SubnetMaskToInt(mask)); + } + else + { + IPToStr(str, size, mask); + } +} +void MaskToStr32(char *str, UINT size, UINT mask) +{ + MaskToStr32Ex(str, size, mask, false); +} +void MaskToStr32Ex(char *str, UINT size, UINT mask, bool always_full_address) +{ + IP ip; + + UINTToIP(&ip, mask); + + MaskToStrEx(str, size, &ip, always_full_address); +} +void Mask6AddrToStrEx(char *str, UINT size, IPV6_ADDR *mask, bool always_full_address) +{ + IP ip; + + // Validate arguments + if (str == NULL || mask == NULL) + { + StrCpy(str, size, ""); + return; + } + + IPv6AddrToIP(&ip, mask); + + MaskToStrEx(str, size, &ip, always_full_address); +} +void Mask6AddrToStr(char *str, UINT size, IPV6_ADDR *mask) +{ + Mask6AddrToStrEx(str, size, mask, false); +} + +// Disconnecting of the tube +void TubeDisconnect(TUBE *t) +{ + // Validate arguments + if (t == NULL) + { + return; + } + + if (t->TubePairData == NULL) + { + return; + } + + Lock(t->TubePairData->Lock); + { + t->TubePairData->IsDisconnected = true; + + Set(t->TubePairData->Event1); + Set(t->TubePairData->Event2); + SetSockEvent(t->TubePairData->SockEvent1); + SetSockEvent(t->TubePairData->SockEvent2); + } + Unlock(t->TubePairData->Lock); +} + +// Creating a tube pair +void NewTubePair(TUBE **t1, TUBE **t2, UINT size_of_header) +{ + TUBEPAIR_DATA *d; + // Validate arguments + if (t1 == NULL || t2 == NULL) + { + return; + } + + *t1 = NewTube(size_of_header); + *t2 = NewTube(size_of_header); + + (*t1)->IndexInTubePair = 0; + (*t2)->IndexInTubePair = 1; + + d = NewTubePairData(); + AddRef(d->Ref); + + (*t1)->TubePairData = d; + (*t2)->TubePairData = d; + + d->Event1 = (*t1)->Event; + d->Event2 = (*t2)->Event; + + AddRef(d->Event1->ref); + AddRef(d->Event2->ref); +} + +// Creating a tube pair data +TUBEPAIR_DATA *NewTubePairData() +{ + TUBEPAIR_DATA *d = ZeroMalloc(sizeof(TUBEPAIR_DATA)); + + d->Ref = NewRef(); + + d->Lock = NewLock(); + + return d; +} + +// Set the SockEvent to the tube +void SetTubeSockEvent(TUBE *t, SOCK_EVENT *e) +{ + // Validate arguments + if (t == NULL) + { + return; + } + + Lock(t->Lock); + { + TUBEPAIR_DATA *d; + + if (t->SockEvent != e) + { + if (t->SockEvent != NULL) + { + ReleaseSockEvent(t->SockEvent); + } + + if (e != NULL) + { + AddRef(e->ref); + } + + t->SockEvent = e; + } + + d = t->TubePairData; + + if (d != NULL) + { + Lock(d->Lock); + { + SOCK_EVENT **sep = (t->IndexInTubePair == 0 ? &d->SockEvent1 : &d->SockEvent2); + + if (*sep != e) + { + if (*sep != NULL) + { + ReleaseSockEvent(*sep); + } + + if (e != NULL) + { + AddRef(e->ref); + } + + *sep = e; + } + } + Unlock(d->Lock); + } + } + Unlock(t->Lock); +} + +// Release of the tube pair data +void ReleaseTubePairData(TUBEPAIR_DATA *d) +{ + // Validate arguments + if (d == NULL) + { + return; + } + + if (Release(d->Ref) == 0) + { + CleanupTubePairData(d); + } +} +void CleanupTubePairData(TUBEPAIR_DATA *d) +{ + // Validate arguments + if (d == NULL) + { + return; + } + + ReleaseEvent(d->Event1); + ReleaseEvent(d->Event2); + + ReleaseSockEvent(d->SockEvent1); + ReleaseSockEvent(d->SockEvent2); + + DeleteLock(d->Lock); + + Free(d); +} + +// Check whether the tube is connected to the opponent still +bool IsTubeConnected(TUBE *t) +{ + // Validate arguments + if (t == NULL) + { + return false; + } + + if (t->TubePairData == NULL) + { + return true; + } + + if (t->TubePairData->IsDisconnected) + { + return false; + } + + return true; +} + +// Send the data to the tube +bool TubeSend(TUBE *t, void *data, UINT size, void *header) +{ + return TubeSendEx(t, data, size, header, false); +} +bool TubeSendEx(TUBE *t, void *data, UINT size, void *header, bool no_flush) +{ + return TubeSendEx2(t, data, size, header, no_flush, 0); +} +bool TubeSendEx2(TUBE *t, void *data, UINT size, void *header, bool no_flush, UINT max_num_in_queue) +{ + // Validate arguments + if (t == NULL || data == NULL || size == 0) + { + return false; + } + + if (IsTubeConnected(t) == false) + { + return false; + } + + LockQueue(t->Queue); + { + if (max_num_in_queue == 0 || (t->Queue->num_item <= max_num_in_queue)) + { + InsertQueue(t->Queue, NewTubeData(data, size, header, t->SizeOfHeader)); + } + else + { + no_flush = true; + } + } + UnlockQueue(t->Queue); + + if (no_flush == false) + { + Set(t->Event); + SetSockEvent(t->SockEvent); + } + + return true; +} + +// Flush the tube +void TubeFlush(TUBE *t) +{ + TubeFlushEx(t, false); +} +void TubeFlushEx(TUBE *t, bool force) +{ + // Validate arguments + if (t == NULL) + { + return; + } + + if (IsTubeConnected(t) == false) + { + return; + } + + if (force == false) + { + if (t->Queue->num_item == 0) + { + return; + } + } + + Set(t->Event); + SetSockEvent(t->SockEvent); +} + +// Receive the data from the tube (asynchronous) +TUBEDATA *TubeRecvAsync(TUBE *t) +{ + TUBEDATA *d; + // Validate arguments + if (t == NULL) + { + return NULL; + } + + if (IsTubeConnected(t) == false) + { + return NULL; + } + + LockQueue(t->Queue); + { + d = GetNext(t->Queue); + } + UnlockQueue(t->Queue); + + return d; +} + +// Get the SockEvent associated with the tube +SOCK_EVENT *GetTubeSockEvent(TUBE *t) +{ + SOCK_EVENT *e = NULL; + // Validate arguments + if (t == NULL) + { + return NULL; + } + + Lock(t->Lock); + { + if (t->SockEvent != NULL) + { + AddRef(t->SockEvent->ref); + + e = t->SockEvent; + } + } + Unlock(t->Lock); + + return e; +} + +// Receive the data from the tube (synchronous) +TUBEDATA *TubeRecvSync(TUBE *t, UINT timeout) +{ + UINT64 start_tick, timeout_tick; + TUBEDATA *d = NULL; + // Validate arguments + if (t == NULL) + { + return NULL; + } + + if (IsTubeConnected(t) == false) + { + return NULL; + } + + start_tick = Tick64(); + timeout_tick = start_tick + (UINT64)timeout; + + while (true) + { + UINT64 now = Tick64(); + UINT remain_time; + SOCK_EVENT *e; + UINT interval; + + d = NULL; + + if (IsTubeConnected(t) == false) + { + break; + } + + LockQueue(t->Queue); + { + d = GetNext(t->Queue); + } + UnlockQueue(t->Queue); + + if (d != NULL) + { + break; + } + + if (timeout != INFINITE && now >= timeout_tick) + { + return NULL; + } + + remain_time = (UINT)(timeout_tick - now); + + e = GetTubeSockEvent(t); + + interval = (timeout == INFINITE ? INFINITE : remain_time); + + if (e == NULL) + { + Wait(t->Event, interval); + } + else + { + WaitSockEvent(e, interval); + + ReleaseSockEvent(e); + } + } + + return d; +} + +// Creating a tube +TUBE *NewTube(UINT size_of_header) +{ + TUBE *t = ZeroMalloc(sizeof(TUBE)); + + t->Event = NewEvent(); + t->Queue = NewQueue(); + t->Ref = NewRef(); + t->Lock = NewLock(); + t->SockEvent = NewSockEvent(); + + t->SizeOfHeader = size_of_header; + + return t; +} + +// Release of the tube +void ReleaseTube(TUBE *t) +{ + // Validate arguments + if (t == NULL) + { + return; + } + + if (Release(t->Ref) == 0) + { + CleanupTube(t); + } +} +void CleanupTube(TUBE *t) +{ + // Validate arguments + if (t == NULL) + { + return; + } + + while (true) + { + TUBEDATA *d = GetNext(t->Queue); + if (d == NULL) + { + break; + } + + FreeTubeData(d); + } + + ReleaseQueue(t->Queue); + ReleaseEvent(t->Event); + ReleaseSockEvent(t->SockEvent); + + ReleaseTubePairData(t->TubePairData); + + DeleteLock(t->Lock); + + Free(t); +} + +// Creating a tube data +TUBEDATA *NewTubeData(void *data, UINT size, void *header, UINT header_size) +{ + TUBEDATA *d; + // Validate arguments + if (size == 0 || data == NULL) + { + return NULL; + } + + d = ZeroMalloc(sizeof(TUBEDATA)); + + d->Data = Clone(data, size); + d->DataSize = size; + if (header != NULL) + { + d->Header = Clone(header, header_size); + d->HeaderSize = header_size; + } + else + { + d->Header = ZeroMalloc(header_size); + } + + return d; +} + +// Release of the tube data +void FreeTubeData(TUBEDATA *d) +{ + // Validate arguments + if (d == NULL) + { + return; + } + + Free(d->Data); + Free(d->Header); + + Free(d); +} + +// Release of the IP address list of the host +void FreeHostIPAddressList(LIST *o) +{ + UINT i; + // Validate arguments + if (o == NULL) + { + return; + } + + for (i = 0; i < LIST_NUM(o); i++) + { + IP *ip = LIST_DATA(o, i); + + Free(ip); + } + + ReleaseList(o); +} + +// Get whether the specified IP address is held by this host +bool IsMyIPAddress(IP *ip) +{ + LIST *o; + UINT i; + bool ret = false; + // Validate arguments + if (ip == NULL) + { + return false; + } + + o = GetHostIPAddressList(); + + for (i = 0; i < LIST_NUM(o); i++) + { + IP *a = LIST_DATA(o, i); + + if (CmpIpAddr(ip, a) == 0) + { + ret = true; + break; + } + } + + FreeHostIPAddressList(o); + + return ret; +} + +// Add the IP address to the list +void AddHostIPAddressToList(LIST *o, IP *ip) +{ + IP *r; + // Validate arguments + if (o == NULL || ip == NULL) + { + return; + } + + r = Search(o, ip); + if (r != NULL) + { + return; + } + + Insert(o, Clone(ip, sizeof(IP))); +} + +// Comparison of the IP address list items +int CmpIpAddressList(void *p1, void *p2) +{ + IP *ip1, *ip2; + UINT r; + // Validate arguments + if (p1 == NULL || p2 == NULL) + { + return 0; + } + ip1 = *(IP **)p1; + ip2 = *(IP **)p2; + if (ip1 == NULL || ip2 == NULL) + { + return 0; + } + + // IPv4 < IPv6 + r = COMPARE_RET(IsIP6(ip1), IsIP6(ip2)); + if (r != 0) + { + return r; + } + + // any > specified IP + if (IsZeroIP(ip1) && IsZeroIP(ip2) == false) + { + return 1; + } + if (IsZeroIP(ip1) == false && IsZeroIP(ip2)) + { + return -1; + } + + // local > others + if (IsLocalHostIP(ip1) && IsLocalHostIP(ip2) == false) + { + return 1; + } + if (IsLocalHostIP(ip1) == false && IsLocalHostIP(ip2)) + { + return -1; + } + + // ip address + r = CmpIpAddr(ip1, ip2); + if (r != 0) + { + return r; + } + + // interface index + if (IsIP6(ip1)) + { + r = COMPARE_RET(ip1->ipv6_scope_id, ip2->ipv6_scope_id); + } + else + { + r = 0; + } + + return r; +} + +// Get the IP address list hash of the host +UINT64 GetHostIPAddressListHash() +{ + UINT i; + LIST *o; + BUF *buf = NewBuf(); + UCHAR hash[SHA1_SIZE]; + UINT64 ret = 0; + + o = GetHostIPAddressList(); + + if (o != NULL) + { + for (i = 0; i < LIST_NUM(o); i++) + { + IP *ip = LIST_DATA(o, i); + char tmp[128]; + + Zero(tmp, sizeof(tmp)); + IPToStr(tmp, sizeof(tmp), ip); + + WriteBufStr(buf, tmp); + } + + FreeHostIPAddressList(o); + } + + WriteBufStr(buf, "test"); + + Sha1(hash, buf->Buf, buf->Size); + + FreeBuf(buf); + + Copy(&ret, hash, sizeof(UINT64)); + + ret = Endian64(ret); + + return ret; +} + +// Get the IP address list of the host (using cache) +LIST *GetHostIPAddressList() +{ + LIST *o = NULL; + if (host_ip_address_list_cache_lock == NULL) + { + return GetHostIPAddressListInternal(); + } + + Lock(host_ip_address_list_cache_lock); + { + UINT64 now = Tick64(); + + if (host_ip_address_list_cache_last == 0 || + ((host_ip_address_list_cache_last + (UINT64)HOST_IP_ADDRESS_LIST_CACHE) < now) || + host_ip_address_cache == NULL) + { + if (host_ip_address_cache != NULL) + { + FreeHostIPAddressList(host_ip_address_cache); + } + + host_ip_address_cache = GetHostIPAddressListInternal(); + + host_ip_address_list_cache_last = now; + } + + o = CloneIPAddressList(host_ip_address_cache); + } + Unlock(host_ip_address_list_cache_lock); + + if (o == NULL) + { + o = GetHostIPAddressListInternal(); + } + + return o; +} + +// Copy of the IP address list +LIST *CloneIPAddressList(LIST *o) +{ + LIST *ret; + UINT i; + // Validate arguments + if (o == NULL) + { + return NULL; + } + + ret = NewListFast(CmpIpAddressList); + + for (i = 0; i < LIST_NUM(o); i++) + { + IP *ip = LIST_DATA(o, i); + + if (ip != NULL) + { + ip = Clone(ip, sizeof(IP)); + + Add(ret, ip); + } + } + + return ret; +} + +// Get an IP address list of the host +LIST *GetHostIPAddressListInternal() +{ + char hostname[MAX_SIZE]; + LIST *o; + IP any6, any4; + IP local6, local4; + bool is_v6_supported = IsIPv6Supported(); + + GetLocalHostIP4(&local4); + GetLocalHostIP6(&local6); + + ZeroIP4(&any4); + ZeroIP6(&any6); + + Zero(hostname, sizeof(hostname)); + + gethostname(hostname, sizeof(hostname)); + + o = NewListFast(CmpIpAddressList); + + // any + AddHostIPAddressToList(o, &any4); + if (is_v6_supported) + { + AddHostIPAddressToList(o, &any6); + } + + // localhost + AddHostIPAddressToList(o, &local4); + if (is_v6_supported) + { + AddHostIPAddressToList(o, &local6); + } + +#ifndef MAYAQUA_SUPPORTS_GETIFADDRS + // IPv4 + if (true) + { + struct sockaddr_in in; + struct in_addr addr; + struct addrinfo hint; + struct addrinfo *info; + + Zero(&hint, sizeof(hint)); + hint.ai_family = AF_INET; + hint.ai_socktype = SOCK_DGRAM; + hint.ai_protocol = IPPROTO_UDP; + info = NULL; + + if (getaddrinfo(hostname, NULL, &hint, &info) == 0) + { + if (info->ai_family == AF_INET) + { + struct addrinfo *current = info; + while (current != NULL) + { + IP ip; + + Copy(&in, current->ai_addr, sizeof(in)); + Copy(&addr, &in.sin_addr, sizeof(addr)); + + InAddrToIP(&ip, &addr); + AddHostIPAddressToList(o, &ip); + + current = current->ai_next; + } + } + + freeaddrinfo(info); + } + } + +#ifndef UNIX_LINUX + // IPv6 + if (is_v6_supported) + { + struct sockaddr_in6 in; + struct in6_addr addr; + struct addrinfo hint; + struct addrinfo *info; + + Zero(&hint, sizeof(hint)); + hint.ai_family = AF_INET6; + hint.ai_socktype = SOCK_DGRAM; + hint.ai_protocol = IPPROTO_UDP; + info = NULL; + + if (getaddrinfo(hostname, NULL, &hint, &info) == 0) + { + if (info->ai_family == AF_INET6) + { + struct addrinfo *current = info; + while (current != NULL) + { + IP ip; + + Copy(&in, current->ai_addr, sizeof(in)); + Copy(&addr, &in.sin6_addr, sizeof(addr)); + + InAddrToIP6(&ip, &addr); + ip.ipv6_scope_id = in.sin6_scope_id; + + AddHostIPAddressToList(o, &ip); + + current = current->ai_next; + } + } + + freeaddrinfo(info); + } + } +#endif // UNIX_LINUX +#endif // MAYAQUA_SUPPORTS_GETIFADDRS + +#ifdef MAYAQUA_SUPPORTS_GETIFADDRS + // If the getifaddrs is available, use this + if (true) + { + struct ifaddrs *aa = NULL; + + if (getifaddrs(&aa) == 0) + { + struct ifaddrs *a = aa; + + while (a != NULL) + { + if (a->ifa_addr != NULL) + { + struct sockaddr *addr = a->ifa_addr; + + if (addr->sa_family == AF_INET) + { + IP ip; + struct sockaddr_in *d = (struct sockaddr_in *)addr; + struct in_addr *addr = &d->sin_addr; + + InAddrToIP(&ip, addr); + + AddHostIPAddressToList(o, &ip); + } + else if (addr->sa_family == AF_INET6) + { + IP ip; + struct sockaddr_in6 *d = (struct sockaddr_in6 *)addr; + UINT scope_id = d->sin6_scope_id; + struct in6_addr *addr = &d->sin6_addr; + + InAddrToIP6(&ip, addr); + ip.ipv6_scope_id = scope_id; + + AddHostIPAddressToList(o, &ip); + } + } + + a = a->ifa_next; + } + + freeifaddrs(aa); + } + } +#endif // MAYAQUA_SUPPORTS_GETIFADDRS + + return o; +} + +// Get whether the UDP listener opens the specified port +bool IsUdpPortOpened(UDPLISTENER *u, IP *server_ip, UINT port) +{ + UINT i; + // Validate arguments + if (u == NULL || port == 0) + { + return false; + } + + if (server_ip != NULL) + { + for (i = 0; i < LIST_NUM(u->SockList); i++) + { + UDPLISTENER_SOCK *us = LIST_DATA(u->SockList, i); + + if (us->Sock != NULL && us->HasError == false) + { + if (us->Port == port) + { + if (CmpIpAddr(server_ip, &us->IpAddress) == 0) + { + return true; + } + } + } + } + } + + for (i = 0; i < LIST_NUM(u->SockList); i++) + { + UDPLISTENER_SOCK *us = LIST_DATA(u->SockList, i); + + if (us->Sock != NULL && us->HasError == false) + { + if (us->Port == port) + { + if (IsZeroIP(&us->IpAddress)) + { + return true; + } + } + } + } + + return false; +} + +// IP address acquisition thread +void QueryIpThreadMain(THREAD *thread, void *param) +{ + QUERYIPTHREAD *t = (QUERYIPTHREAD *)param; + // Validate arguments + if (thread == NULL || param == NULL) + { + return; + } + + while (t->Halt == false) + { + UINT next_wait_time = 0; + IP ip; + bool ok = false; + + if (GetIP4Ex(&ip, t->Hostname, 5000, &t->Halt)) + { + if (IsZeroIP(&ip) == false) + { + Lock(t->Lock); + { + Copy(&t->Ip, &ip, sizeof(IP)); + } + Unlock(t->Lock); + + ok = true; + } + } + + if (ok == false) + { + next_wait_time = t->IntervalLastNg; + } + else + { + next_wait_time = t->IntervalLastOk; + } + + if (t->Halt) + { + break; + } + + Wait(t->HaltEvent, next_wait_time); + } +} + +// Creating an IP address acquisition thread +QUERYIPTHREAD *NewQueryIpThread(char *hostname, UINT interval_last_ok, UINT interval_last_ng) +{ + QUERYIPTHREAD *t; + + t = ZeroMalloc(sizeof(QUERYIPTHREAD)); + + t->HaltEvent = NewEvent(); + t->Lock = NewLock(); + StrCpy(t->Hostname, sizeof(t->Hostname), hostname); + t->IntervalLastOk = interval_last_ok; + t->IntervalLastNg = interval_last_ng; + + t->Thread = NewThread(QueryIpThreadMain, t); + + return t; +} + +// Get the results of the IP address acquisition thread +bool GetQueryIpThreadResult(QUERYIPTHREAD *t, IP *ip) +{ + bool ret = false; + Zero(ip, sizeof(IP)); + // Validate arguments + if (t == NULL || ip == NULL) + { + return false; + } + + Lock(t->Lock); + + if (IsZero(&t->Ip, sizeof(IP))) + { + ret = false; + } + else + { + Copy(ip, &t->Ip, sizeof(IP)); + } + + Unlock(t->Lock); + + return ret; +} + +// Release of the IP address acquisition thread +void FreeQueryIpThread(QUERYIPTHREAD *t) +{ + // Validate arguments + if (t == NULL) + { + return; + } + + t->Halt = true; + Set(t->HaltEvent); + + WaitThread(t->Thread, INFINITE); + ReleaseThread(t->Thread); + + ReleaseEvent(t->HaltEvent); + + DeleteLock(t->Lock); + + Free(t); +} + +// UDP listener thread +void UdpListenerThread(THREAD *thread, void *param) +{ + UDPLISTENER *u = (UDPLISTENER *)param; + UINT i, j, k; + UINT buf_size = 65536; + void *buf; + bool cont_flag; + BUF *ip_list_buf = NewBuf(); + // Validate arguments + if (thread == NULL || param == NULL) + { + return; + } + + buf = Malloc(buf_size); + + // Initializing the socket list + u->SockList = NewList(NULL); + + u->LastCheckTick = 0; + +// u->PollMyIpAndPort = true; + + // Main loop + while (u->Halt == false) + { + LIST *recv_list; + UINT64 now = Tick64(); + UINT interval; + bool stage_changed = false; + IP nat_t_ip; + + Zero(&nat_t_ip, sizeof(nat_t_ip)); + + + if (u->LastCheckTick == 0 || (now >= (u->LastCheckTick + UDPLISTENER_CHECK_INTERVAL))) + { + LIST *iplist; + LIST *del_us_list = NewListFast(NULL); + BUF *ip_list_buf_new = NewBuf(); + + u->LastCheckTick = now; + + // Obtain an IP address list + iplist = GetHostIPAddressList(); + + LockList(u->PortList); + { + for (k = 0; k < LIST_NUM(u->SockList); k++) + { + UDPLISTENER_SOCK *us = LIST_DATA(u->SockList, k); + + us->Mark = false; + } + + // If the combination of the IP address and the port number doesn't exist in the list, add it to the list + for (i = 0; i < LIST_NUM(iplist); i++) + { + IP *ip = LIST_DATA(iplist, i); + + if (CmpIpAddr(ip, &u->ListenIP) != 0) + { + continue; + } + + WriteBuf(ip_list_buf_new, ip, sizeof(IP)); + + for (j = 0; j < LIST_NUM(u->PortList); j++) + { + UINT k; + UINT *port = LIST_DATA(u->PortList, j); + bool existing = false; + + if (IsZeroIP(ip) && (IS_SPECIAL_PORT(*port))) + { + continue; + } + + + for (k = 0; k < LIST_NUM(u->SockList); k++) + { + UDPLISTENER_SOCK *us = LIST_DATA(u->SockList, k); + + if (CmpIpAddr(&us->IpAddress, ip) == 0 && us->Port == *port) + { + existing = true; + + us->Mark = true; + + break; + } + } + + if (existing == false) + { + UDPLISTENER_SOCK *us = ZeroMalloc(sizeof(UDPLISTENER_SOCK)); + + Copy(&us->IpAddress, ip, sizeof(IP)); + us->Port = *port; + + us->Mark = true; + + Add(u->SockList, us); + } + } + } + + // If any errors suspected or the combination of IP address and port number + // has been regarded to delete already, delete it + for (k = 0; k < LIST_NUM(u->SockList); k++) + { + UDPLISTENER_SOCK *us = LIST_DATA(u->SockList, k); + + if (us->Mark == false || us->HasError) + { + Debug("mark=%u error=%u\n", us->Mark, us->HasError); + Add(del_us_list, us); + } + } + + for (i = 0; i < LIST_NUM(del_us_list); i++) + { + UDPLISTENER_SOCK *us = LIST_DATA(del_us_list, i); + + char ipstr[MAX_SIZE]; + + IPToStr(ipstr, sizeof(ipstr), &us->IpAddress); + Debug("Closed UDP Port %u at %s.\n", us->Port, ipstr); + + Delete(u->SockList, us); + + if (us->Sock != NULL) + { + Disconnect(us->Sock); + ReleaseSock(us->Sock); + } + + Free(us); + } + } + UnlockList(u->PortList); + + // Open the UDP sockets which is not opend yet + for (k = 0; k < LIST_NUM(u->SockList); k++) + { + UDPLISTENER_SOCK *us = LIST_DATA(u->SockList, k); + + if (us->Sock == NULL) + { + char ipstr[MAX_SIZE]; + + IPToStr(ipstr, sizeof(ipstr), &us->IpAddress); + + if (us->ErrorDebugDisplayed == false) + { + Debug("Opening UDP Port %u at %s ...", us->Port, ipstr); + } + + us->Sock = NewUDPEx2(us->Port, IsIP6(&us->IpAddress), &us->IpAddress); + + if (us->Sock != NULL) + { + if (us->ErrorDebugDisplayed == false) + { + Debug("Ok.\n"); + } + else + { + Debug("Opening UDP Port %u at %s ...", us->Port, ipstr); + Debug("Ok.\n"); + } + JoinSockToSockEvent(us->Sock, u->Event); + + us->ErrorDebugDisplayed = false; + } + else + { + if (us->ErrorDebugDisplayed == false) + { + Debug("Error.\n"); + } + + us->ErrorDebugDisplayed = true; + } + } + } + + FreeHostIPAddressList(iplist); + + ReleaseList(del_us_list); + + if (CompareBuf(ip_list_buf, ip_list_buf_new) == false) + { + u->HostIPAddressListChanged = true; + } + + FreeBuf(ip_list_buf); + ip_list_buf = ip_list_buf_new; + } + +LABEL_RESTART: + + stage_changed = false; + + recv_list = NewListFast(NULL); + + if (u->PollMyIpAndPort) + { + // Create a thread to get a NAT-T IP address if necessary + if (u->GetNatTIpThread == NULL) + { + char natt_hostname[MAX_SIZE]; + RUDPGetRegisterHostNameByIP(natt_hostname, sizeof(natt_hostname), NULL); + u->GetNatTIpThread = NewQueryIpThread(natt_hostname, QUERYIPTHREAD_INTERVAL_LAST_OK, QUERYIPTHREAD_INTERVAL_LAST_NG); + GetQueryIpThreadResult(u->GetNatTIpThread, &nat_t_ip); + } + } + + // Receive the data that is arriving at the socket + for (k = 0; k < LIST_NUM(u->SockList); k++) + { + UDPLISTENER_SOCK *us = LIST_DATA(u->SockList, k); + + if (us->Sock != NULL) + { + UINT num_ignore_errors = 0; + + if (u->PollMyIpAndPort && IsIP4(&us->IpAddress)) + { + if (us->NextMyIpAndPortPollTick == 0 || us->NextMyIpAndPortPollTick <= now) + { + // Examine the self IP address and the self port number by using NAT-T server + us->NextMyIpAndPortPollTick = now + (UINT64)GenRandInterval(UDP_NAT_T_NAT_STATUS_CHECK_INTERVAL_MIN, UDP_NAT_T_NAT_STATUS_CHECK_INTERVAL_MAX); + + if (IsZeroIP(&nat_t_ip) == false + ) + { + UCHAR c = 'A'; + + SendTo(us->Sock, &nat_t_ip, UDP_NAT_T_PORT, &c, 1); + } + } + } + + while (true) + { + IP src_addr; + UINT src_port; + UDPPACKET *p; + + UINT size = RecvFrom(us->Sock, &src_addr, &src_port, buf, buf_size); + if (size == 0) + { + // Socket failure + if (us->Sock->IgnoreRecvErr == false) + { +LABEL_FATAL_ERROR: + Debug("RecvFrom has Error.\n"); + us->HasError = true; + } + else + { + if ((num_ignore_errors++) >= MAX_NUM_IGNORE_ERRORS) + { + goto LABEL_FATAL_ERROR; + } + } + break; + } + else if (size == SOCK_LATER) + { + // No packet + break; + } + //Debug("UDP %u\n", size); + + if (src_port == UDP_NAT_T_PORT && CmpIpAddr(&src_addr, &nat_t_ip) == 0) + { + // Receive a packet in which the IP address and the port number are written from the NAT-T server + if (size >= 8) + { + IP my_ip; + UINT my_port; + + if (RUDPParseIPAndPortStr(buf, size, &my_ip, &my_port)) + { + Copy(&us->PublicIpAddress, &my_ip, sizeof(IP)); + us->PublicPort = my_port; + } + } + } + else + { + // Receive a regular packet + p = NewUdpPacket(&src_addr, src_port, &us->Sock->LocalIP, us->Sock->LocalPort, + Clone(buf, size), size); + + if (p->SrcPort == MAKE_SPECIAL_PORT(52)) + { + p->SrcPort = p->DestPort = MAKE_SPECIAL_PORT(50); + } + + p->Type = u->PacketType; + + Add(recv_list, p); + } + + stage_changed = true; + } + } + } + + // Pass the received packet to the procedure + u->RecvProc(u, recv_list); + + // Release the packet + for (i = 0; i < LIST_NUM(recv_list); i++) + { + UDPPACKET *p = LIST_DATA(recv_list, i); + + FreeUdpPacket(p); + } + + ReleaseList(recv_list); + + cont_flag = true; + + do + { + // When there are packets to be transmitted, transmit it + LockList(u->SendPacketList); + { + UDPLISTENER_SOCK *last_us = NULL; + IP last_src_ip; + UINT last_src_port; + + Zero(&last_src_ip, sizeof(IP)); + last_src_port = 0; + + for (i = 0; i < LIST_NUM(u->SendPacketList); i++) + { + UDPPACKET *p = LIST_DATA(u->SendPacketList, i); + UDPLISTENER_SOCK *us; + + if (last_us != NULL && last_src_port == p->SrcPort && CmpIpAddr(&last_src_ip, &p->SrcIP) == 0) + { + us = last_us; + } + else + { + // Search for a good interface for the transmission + us = DetermineUdpSocketForSending(u, p); + + if (us != NULL) + { + last_us = us; + last_src_port = p->SrcPort; + Copy(&last_src_ip, &p->SrcIP, sizeof(IP)); + } + } + + if (us != NULL) + { + // Send + UINT ret = SendTo(us->Sock, &p->DstIP, p->DestPort, p->Data, p->Size); + + if (ret == 0) + { + if (us->Sock->IgnoreSendErr == false) + { + // Socket failure + Debug("SendTo has Error.\n"); + us->HasError = true; + last_us = NULL; + } + } + else + { + if (ret != SOCK_LATER) + { + stage_changed = true; + } + } + } + + FreeUdpPacket(p); + } + DeleteAll(u->SendPacketList); + } + UnlockList(u->SendPacketList); + + if (LIST_NUM(u->SendPacketList) == 0) + { + cont_flag = false; + } + } + while (cont_flag); + + if (stage_changed && u->Halt == false) + { + goto LABEL_RESTART; + } + + // Timing adjustment + interval = GetNextIntervalForInterrupt(u->Interrupts); + + if (interval == INFINITE) + { + interval = UDPLISTENER_WAIT_INTERVAL; + } + else + { + interval = MIN(UDPLISTENER_WAIT_INTERVAL, interval); + } + + if (interval >= 1) + { + WaitSockEvent(u->Event, interval); + } + } + + if (u->GetNatTIpThread != NULL) + { + FreeQueryIpThread(u->GetNatTIpThread); + } + + // Release of the socket list + for (i = 0; i < LIST_NUM(u->SockList); i++) + { + UDPLISTENER_SOCK *us = (UDPLISTENER_SOCK *)LIST_DATA(u->SockList, i); + + Disconnect(us->Sock); + ReleaseSock(us->Sock); + + Free(us); + } + ReleaseList(u->SockList); + + FreeBuf(ip_list_buf); + + Free(buf); +} + +// Select the best UDP socket to be used for transmission +UDPLISTENER_SOCK *DetermineUdpSocketForSending(UDPLISTENER *u, UDPPACKET *p) +{ + UINT i; + // Validate arguments + if (u == NULL || p == NULL) + { + return NULL; + } + + for (i = 0; i < LIST_NUM(u->SockList); i++) + { + UDPLISTENER_SOCK *us = LIST_DATA(u->SockList, i); + + if (us->Sock != NULL && us->HasError == false) + { + if (us->Port == p->SrcPort) + { + if (CmpIpAddr(&us->IpAddress, &p->SrcIP) == 0) + { + return us; + } + } + } + } + + for (i = 0; i < LIST_NUM(u->SockList); i++) + { + UDPLISTENER_SOCK *us = LIST_DATA(u->SockList, i); + + if (us->Sock != NULL && us->HasError == false) + { + if (us->Port == p->SrcPort) + { + if (IsZeroIP(&us->IpAddress)) + { + if ((IsIP4(&p->DstIP) && IsIP4(&us->IpAddress)) || + (IsIP6(&p->DstIP) && IsIP6(&us->IpAddress))) + { + return us; + } + } + } + } + } + + return NULL; +} + +void FreeTcpRawData(TCP_RAW_DATA *trd) +{ + // Validate arguments + if (trd == NULL) + { + return; + } + + ReleaseFifo(trd->Data); + Free(trd); +} + +TCP_RAW_DATA *NewTcpRawData(IP *src_ip, UINT src_port, IP *dst_ip, UINT dst_port) +{ + TCP_RAW_DATA *trd; + // Validate arguments + if (dst_ip == NULL || dst_port == 0) + { + return NULL; + } + + trd = ZeroMalloc(sizeof(TCP_RAW_DATA)); + + Copy(&trd->SrcIP, src_ip, sizeof(IP)); + trd->SrcPort = src_port; + + Copy(&trd->DstIP, dst_ip, sizeof(IP)); + trd->DstPort = dst_port; + + trd->Data = NewFifoFast(); + + return trd; +} + +// Release of the UDP packet +void FreeUdpPacket(UDPPACKET *p) +{ + // Validate arguments + if (p == NULL) + { + return; + } + + Free(p->Data); + Free(p); +} + +// Create a new UDP packet +UDPPACKET *NewUdpPacket(IP *src_ip, UINT src_port, IP *dst_ip, UINT dst_port, void *data, UINT size) +{ + UDPPACKET *p; + // Validate arguments + if (data == NULL || size == 0 || dst_ip == NULL || dst_port == 0) + { + return NULL; + } + + p = ZeroMalloc(sizeof(UDPPACKET)); + + p->Data = data; + p->Size = size; + + Copy(&p->SrcIP, src_ip, sizeof(IP)); + p->SrcPort = src_port; + + Copy(&p->DstIP, dst_ip, sizeof(IP)); + p->DestPort = dst_port; + + return p; +} + +// Transmit the packets via UDP Listener +void UdpListenerSendPackets(UDPLISTENER *u, LIST *packet_list) +{ + UINT num = 0; + // Validate arguments + if (u == NULL || packet_list == NULL) + { + return; + } + + LockList(u->SendPacketList); + { + UINT i; + + num = LIST_NUM(packet_list); + + for (i = 0; i < LIST_NUM(packet_list); i++) + { + UDPPACKET *p = LIST_DATA(packet_list, i); + + Add(u->SendPacketList, p); + } + } + UnlockList(u->SendPacketList); + + if (num >= 1) + { + SetSockEvent(u->Event); + } +} + +// Creating a UDP listener +UDPLISTENER *NewUdpListener(UDPLISTENER_RECV_PROC *recv_proc, void *param, IP *listen_ip) +{ + return NewUdpListenerEx(recv_proc, param, listen_ip, INFINITE); +} + +UDPLISTENER *NewUdpListenerEx(UDPLISTENER_RECV_PROC *recv_proc, void *param, IP *listen_ip, UINT packet_type) +{ + UDPLISTENER *u; + // Validate arguments + if (recv_proc == NULL) + { + return NULL; + } + + u = ZeroMalloc(sizeof(UDPLISTENER)); + + u->Param = param; + u->PacketType = packet_type; + + u->PortList = NewList(NULL); + u->Event = NewSockEvent(); + + if (listen_ip) + { + Copy(&u->ListenIP, listen_ip, sizeof(IP)); + } + + u->RecvProc = recv_proc; + u->SendPacketList = NewList(NULL); + + u->Interrupts = NewInterruptManager(); + + u->Thread = NewThread(UdpListenerThread, u); + + return u; +} + +// Stop the UDP listener +void StopUdpListener(UDPLISTENER *u) +{ + if (u == NULL) + { + return; + } + + u->Halt = true; + SetSockEvent(u->Event); + WaitThread(u->Thread, INFINITE); +} + +// Release the UDP listener +void FreeUdpListener(UDPLISTENER *u) +{ + UINT i; + // Validate arguments + if (u == NULL) + { + return; + } + + StopUdpListener(u); + + ReleaseThread(u->Thread); + ReleaseSockEvent(u->Event); + + ReleaseIntList(u->PortList); + + for (i = 0; i < LIST_NUM(u->SendPacketList); i++) + { + UDPPACKET *p = LIST_DATA(u->SendPacketList, i); + + FreeUdpPacket(p); + } + + ReleaseList(u->SendPacketList); + + FreeInterruptManager(u->Interrupts); + + Free(u); +} + +// Add the UDP port +void AddPortToUdpListener(UDPLISTENER *u, UINT port) +{ + // Validate arguments + if (u == NULL || port == 0) + { + return; + } + + LockList(u->PortList); + { + AddIntDistinct(u->PortList, port); + } + UnlockList(u->PortList); + + SetSockEvent(u->Event); +} + +// Delete all the UDP ports +void DeleteAllPortFromUdpListener(UDPLISTENER *u) +{ + // Validate arguments + if (u == NULL) + { + return; + } + + LockList(u->PortList); + { + UINT num_ports = LIST_NUM(u->PortList); + UINT *ports = ZeroMalloc(sizeof(UINT) * num_ports); + UINT i; + + for (i = 0; i < num_ports; i++) + { + ports[i] = *((UINT *)(LIST_DATA(u->PortList, i))); + } + + for (i = 0; i < num_ports; i++) + { + UINT port = ports[i]; + + DelInt(u->PortList, port); + } + + Free(ports); + } + UnlockList(u->PortList); + + SetSockEvent(u->Event); +} + +// Delete the UDP port +void DeletePortFromUdpListener(UDPLISTENER *u, UINT port) +{ + // Validate arguments + if (u == NULL || port == 0) + { + return; + } + + LockList(u->PortList); + { + DelInt(u->PortList, port); + } + UnlockList(u->PortList); + + SetSockEvent(u->Event); +} + +// Sort function of the interrupt management list +int CmpInterruptManagerTickList(void *p1, void *p2) +{ + UINT64 *v1, *v2; + if (p1 == NULL || p2 == NULL) + { + return 0; + } + + v1 = *(UINT64 **)p1; + v2 = *(UINT64 **)p2; + if (v1 == NULL || v2 == NULL) + { + return 0; + } + + if (*v1 > *v2) + { + return 1; + } + else if (*v1 < *v2) + { + return -1; + } + else + { + return 0; + } +} + +// Initialization of the interrupt management +INTERRUPT_MANAGER *NewInterruptManager() +{ + INTERRUPT_MANAGER *m = ZeroMalloc(sizeof(INTERRUPT_MANAGER)); + + m->TickList = NewList(CmpInterruptManagerTickList); + + return m; +} + +// Release of the interrupt management +void FreeInterruptManager(INTERRUPT_MANAGER *m) +{ + UINT i; + // Validate arguments + if (m == NULL) + { + return; + } + + for (i = 0; i < LIST_NUM(m->TickList); i++) + { + UINT64 *v = LIST_DATA(m->TickList, i); + + Free(v); + } + + ReleaseList(m->TickList); + + Free(m); +} + +// Add a number to the interrupt management +void AddInterrupt(INTERRUPT_MANAGER *m, UINT64 tick) +{ + // Validate arguments + if (tick == 0) + { + return; + } + + LockList(m->TickList); + { + if (Search(m->TickList, &tick) == NULL) + { + Insert(m->TickList, Clone(&tick, sizeof(UINT64))); + } + } + UnlockList(m->TickList); +} + +// Get the interval to the next calling +UINT GetNextIntervalForInterrupt(INTERRUPT_MANAGER *m) +{ + UINT ret = INFINITE; + UINT i; + LIST *o = NULL; + UINT64 now = Tick64(); + // Validate arguments + if (m == NULL) + { + return 0; + } + + LockList(m->TickList); + { + // Remove entries older than now already + for (i = 0; i < LIST_NUM(m->TickList); i++) + { + UINT64 *v = LIST_DATA(m->TickList, i); + + if (now >= *v) + { + ret = 0; + + if (o == NULL) + { + o = NewListFast(NULL); + } + + Add(o, v); + } + else + { + break; + } + } + + for (i = 0; i < LIST_NUM(o); i++) + { + UINT64 *v = LIST_DATA(o, i); + + Free(v); + + Delete(m->TickList, v); + } + + if (o != NULL) + { + ReleaseList(o); + } + + if (ret == INFINITE) + { + if (LIST_NUM(m->TickList) >= 1) + { + UINT64 *v = LIST_DATA(m->TickList, 0); + + ret = (UINT)(*v - now); + } + } + } + UnlockList(m->TickList); + + return ret; +} + +// Let that the listening socket for the reverse socket to accept the new socket +void InjectNewReverseSocketToAccept(SOCK *listen_sock, SOCK *s, IP *client_ip, UINT client_port) +{ + bool ok = false; + // Validate arguments + if (listen_sock == NULL || s == NULL) + { + return; + } + + LockQueue(listen_sock->ReverseAcceptQueue); + { + if (listen_sock->CancelAccept == false && listen_sock->Disconnecting == false) + { + InsertQueue(listen_sock->ReverseAcceptQueue, s); + + ok = true; + + s->ServerMode = true; + s->IsReverseAcceptedSocket = true; + + Copy(&s->RemoteIP, client_ip, sizeof(IP)); + s->RemotePort = client_port; + } + } + UnlockQueue(listen_sock->ReverseAcceptQueue); + + if (ok == false) + { + Disconnect(s); + ReleaseSock(s); + } + else + { + Set(listen_sock->ReverseAcceptEvent); + } +} + +// Create a listening socket for the reverse socket +SOCK *ListenReverse() +{ + SOCK *s = NewSock(); + + s->Type = SOCK_REVERSE_LISTEN; + s->ListenMode = true; + s->ReverseAcceptQueue = NewQueue(); + s->ReverseAcceptEvent = NewEvent(); + s->Connected = true; + + return s; +} + +// Accept on the reverse socket +SOCK *AcceptReverse(SOCK *s) +{ + // Validate arguments + if (s == NULL || s->Type != SOCK_REVERSE_LISTEN || s->ListenMode == false) + { + return NULL; + } + + while (true) + { + SOCK *ret; + if (s->Disconnecting || s->CancelAccept) + { + return NULL; + } + + LockQueue(s->ReverseAcceptQueue); + { + ret = GetNext(s->ReverseAcceptQueue); + } + UnlockQueue(s->ReverseAcceptQueue); + + if (ret != NULL) + { + StrCpy(ret->UnderlayProtocol, sizeof(ret->UnderlayProtocol), SOCK_UNDERLAY_AZURE); + + AddProtocolDetailsStr(ret->ProtocolDetails, sizeof(ret->ProtocolDetails), "VPN Azure"); + + return ret; + } + + Wait(s->ReverseAcceptEvent, INFINITE); + } +} + +// Start listening on the in-process socket +SOCK *ListenInProc() +{ + SOCK *s = NewSock(); + + s->Type = SOCK_INPROC; + s->ListenMode = true; + s->InProcAcceptQueue = NewQueue(); + s->InProcAcceptEvent = NewEvent(); + s->Connected = true; + + return s; +} + +// Accept at the in-process socket +SOCK *AcceptInProc(SOCK *s) +{ + // Validate arguments + if (s == NULL || s->Type != SOCK_INPROC || s->ListenMode == false) + { + return NULL; + } + + while (true) + { + SOCK *ret; + if (s->Disconnecting || s->CancelAccept) + { + return NULL; + } + + LockQueue(s->InProcAcceptQueue); + { + ret = GetNext(s->InProcAcceptQueue); + } + UnlockQueue(s->InProcAcceptQueue); + + if (ret != NULL) + { + StrCpy(ret->UnderlayProtocol, sizeof(ret->UnderlayProtocol), SOCK_UNDERLAY_INPROC); + + AddProtocolDetailsStr(ret->ProtocolDetails, sizeof(ret->ProtocolDetails), "InProc"); + + return ret; + } + + Wait(s->InProcAcceptEvent, INFINITE); + } +} + +// Connect by the in-process socket +SOCK *ConnectInProc(SOCK *listen_sock, IP *client_ip, UINT client_port, IP *server_ip, UINT server_port) +{ + SOCK *ss, *sc; + bool ok = false; + // Validate arguments + if (listen_sock == NULL || listen_sock->Type != SOCK_INPROC || listen_sock->ListenMode == false) + { + return NULL; + } + + NewSocketPair(&sc, &ss, client_ip, client_port, server_ip, server_port); + + LockQueue(listen_sock->InProcAcceptQueue); + { + if (listen_sock->CancelAccept == false && listen_sock->Disconnecting == false) + { + InsertQueue(listen_sock->InProcAcceptQueue, ss); + + ok = true; + } + } + UnlockQueue(listen_sock->InProcAcceptQueue); + + if (ok == false) + { + ReleaseSock(ss); + ReleaseSock(sc); + return NULL; + } + + Set(listen_sock->InProcAcceptEvent); + + return sc; +} + +// Creating a new socket pair +void NewSocketPair(SOCK **client, SOCK **server, IP *client_ip, UINT client_port, IP *server_ip, UINT server_port) +{ + IP iptmp; + TUBE *t1, *t2; + SOCK *sc, *ss; + SOCK_EVENT *e1, *e2; + // Validate arguments + if (client == NULL || server == NULL) + { + return; + } + + SetIP(&iptmp, 127, 0, 0, 1); + if (client_ip == NULL) + { + client_ip = &iptmp; + } + if (server_ip == NULL) + { + server_ip = &iptmp; + } + + // Creating a tube + NewTubePair(&t1, &t2, 0); // t1: C -> S, t2: S -> C + + // Creating a socket event + e1 = NewSockEvent(); + e2 = NewSockEvent(); + + SetTubeSockEvent(t1, e1); + SetTubeSockEvent(t2, e2); + + sc = NewInProcSocket(t1, t2); + ss = NewInProcSocket(t2, t1); + + Copy(&sc->LocalIP, client_ip, sizeof(IP)); + sc->LocalPort = client_port; + Copy(&sc->RemoteIP, server_ip, sizeof(IP)); + sc->RemotePort = server_port; + + Copy(&ss->LocalIP, server_ip, sizeof(IP)); + ss->LocalPort = server_port; + Copy(&ss->RemoteIP, client_ip, sizeof(IP)); + ss->RemotePort = client_port; + + sc->Connected = true; + sc->ServerMode = false; + + ss->Connected = true; + ss->ServerMode = true; + + SetTimeout(sc, INFINITE); + SetTimeout(ss, INFINITE); + + QuerySocketInformation(sc); + QuerySocketInformation(ss); + + ReleaseSockEvent(e1); + ReleaseSockEvent(e2); + + ReleaseTube(t1); + ReleaseTube(t2); + + *client = sc; + *server = ss; +} + +// Creating a new in-process socket +SOCK *NewInProcSocket(TUBE *tube_send, TUBE *tube_recv) +{ + SOCK *s; + // Validate arguments + if (tube_recv == NULL || tube_send == NULL) + { + return NULL; + } + + s = NewSock(); + + s->Type = SOCK_INPROC; + + s->SendTube = tube_send; + s->RecvTube = tube_recv; + + AddRef(tube_send->Ref); + AddRef(tube_recv->Ref); + + s->InProcRecvFifo = NewFifo(); + + s->Connected = true; + + return s; +} + +// Transmission process for the in-process socket +UINT SendInProc(SOCK *sock, void *data, UINT size) +{ + if (sock == NULL || sock->Type != SOCK_INPROC || sock->Disconnecting || sock->Connected == false) + { + return 0; + } + + if (IsTubeConnected(sock->SendTube) == false) + { + return 0; + } + + if (TubeSend(sock->SendTube, data, size, NULL) == false) + { + return 0; + } + + return size; +} + +// Receiving process for the in-process socket +UINT RecvInProc(SOCK *sock, void *data, UINT size) +{ + FIFO *f; + UINT ret; + UINT timeout; + UINT64 giveup_time; + TUBEDATA *d = NULL; + if (sock == NULL || sock->Type != SOCK_INPROC || sock->Disconnecting || sock->Connected == false) + { + return 0; + } + + if (IsTubeConnected(sock->SendTube) == false) + { + return 0; + } + + f = sock->InProcRecvFifo; + if (f == NULL) + { + return 0; + } + + // If there is data in the FIFO, return it immediately + ret = ReadFifo(f, data, size); + if (ret != 0) + { + return ret; + } + + timeout = GetTimeout(sock); + + giveup_time = Tick64() + (UINT)timeout; + + // When there is no data in the FIFO, read the next data from the tube + d = NULL; + + while (true) + { + UINT64 now = 0; + UINT interval; + + if (sock->AsyncMode == false) + { + now = Tick64(); + + if (now >= giveup_time) + { + break; + } + } + + d = TubeRecvAsync(sock->RecvTube); + + if (d != NULL) + { + break; + } + + if (IsTubeConnected(sock->RecvTube) == false) + { + break; + } + + if (sock->AsyncMode) + { + break; + } + + interval = (UINT)(giveup_time - now); + + Wait(sock->RecvTube->Event, interval); + } + + if (d == NULL) + { + if (IsTubeConnected(sock->RecvTube) == false) + { + return 0; + } + + if (sock->AsyncMode == false) + { + // If a timeout occurs in synchronous mode, disconnect ir + Disconnect(sock); + + return 0; + } + else + { + // If a timeout occurs in asynchronous mode, returns the blocking error + return SOCK_LATER; + } + } + else + { + // If the received data is larger than the requested size, write the rest to FIFO + if (d->DataSize > size) + { + WriteFifo(f, ((UCHAR *)d->Data) + size, d->DataSize - size); + ret = size; + } + else + { + ret = d->DataSize; + } + + Copy(data, d->Data, ret); + + FreeTubeData(d); + + return ret; + } +} + +// Wait for the arrival of data on multiple tubes +void WaitForTubes(TUBE **tubes, UINT num, UINT timeout) +{ + // Validate arguments + if (num != 0 && tubes == NULL) + { + return; + } + if (timeout == 0) + { + return; + } + if (num == 0) + { + SleepThread(timeout); + return; + } + +#ifdef OS_WIN32 + Win32WaitForTubes(tubes, num, timeout); +#else // OS_WIN32 + UnixWaitForTubes(tubes, num, timeout); +#endif // OS_WIN32 +} + +#ifdef OS_WIN32 +void Win32WaitForTubes(TUBE **tubes, UINT num, UINT timeout) +{ + HANDLE array[MAXIMUM_WAIT_OBJECTS]; + UINT i; + + Zero(array, sizeof(array)); + + for (i = 0; i < num; i++) + { + TUBE *t = tubes[i]; + + array[i] = t->Event->pData; + } + + if (num == 1) + { + WaitForSingleObject(array[0], timeout); + } + else + { + WaitForMultipleObjects(num, array, false, timeout); + } +} +#else // OS_WIN32 +void UnixWaitForTubes(TUBE **tubes, UINT num, UINT timeout) +{ + int *fds; + UINT i; + char tmp[MAX_SIZE]; + bool any_of_tubes_are_readable = false; + + fds = ZeroMalloc(sizeof(int) * num); + + for (i = 0; i < num; i++) + { + fds[i] = tubes[i]->SockEvent->pipe_read; + + if (tubes[i]->SockEvent->current_pipe_data != 0) + { + any_of_tubes_are_readable = true; + } + } + + if (any_of_tubes_are_readable == false) + { + UnixSelectInner(num, fds, 0, NULL, timeout); + } + + for (i = 0; i < num; i++) + { + int fd = fds[i]; + int readret; + + tubes[i]->SockEvent->current_pipe_data = 0; + + do + { + readret = read(fd, tmp, sizeof(tmp)); + } + while (readret >= 1); + } + + Free(fds); +} +#endif // OS_WIN32 + +// Creating a Tube Flush List +TUBE_FLUSH_LIST *NewTubeFlushList() +{ + TUBE_FLUSH_LIST *f = ZeroMalloc(sizeof(TUBE_FLUSH_LIST)); + + f->List = NewListFast(NULL); + + return f; +} + +// Release of the Tube Flush List +void FreeTubeFlushList(TUBE_FLUSH_LIST *f) +{ + UINT i; + // Validate arguments + if (f == NULL) + { + return; + } + + for (i = 0; i < LIST_NUM(f->List); i++) + { + TUBE *t = LIST_DATA(f->List, i); + + ReleaseTube(t); + } + + ReleaseList(f->List); + + Free(f); +} + +// Add a Tube to the Tube Flush List +void AddTubeToFlushList(TUBE_FLUSH_LIST *f, TUBE *t) +{ + // Validate arguments + if (f == NULL || t == NULL) + { + return; + } + + if (t->IsInFlushList) + { + return; + } + + if (IsInList(f->List, t) == false) + { + Add(f->List, t); + + AddRef(t->Ref); + + t->IsInFlushList = true; + } +} + +// Flush the all tubes in the Tube Flush List +void FlushTubeFlushList(TUBE_FLUSH_LIST *f) +{ + UINT i; + // Validate arguments + if (f == NULL) + { + return; + } + + for (i = 0; i < LIST_NUM(f->List); i++) + { + TUBE *t = LIST_DATA(f->List, i); + + TubeFlush(t); + t->IsInFlushList = false; + + ReleaseTube(t); + } + + DeleteAll(f->List); +} + +// Store the error value into PACK +PACK *PackError(UINT error) +{ + PACK *p; + + p = NewPack(); + PackAddInt(p, "error", error); + + return p; +} + +// Get the error value from PACK +UINT GetErrorFromPack(PACK *p) +{ + // Validate arguments + if (p == NULL) + { + return 0; + } + + return PackGetInt(p, "error"); +} + +// Create an entry to PACK for the dummy +void CreateDummyValue(PACK *p) +{ + UINT size; + UCHAR *buf; + // Validate arguments + if (p == NULL) + { + return; + } + + size = Rand32() % HTTP_PACK_RAND_SIZE_MAX; + buf = Malloc(size); + Rand(buf, size); + + PackAddData(p, "pencore", buf, size); + + Free(buf); +} + +// Receive a line +char *RecvLine(SOCK *s, UINT max_size) +{ + BUF *b; + char c; + char *str; + // Validate arguments + if (s == NULL || max_size == 0) + { + return NULL; + } + + b = NewBuf(); + while (true) + { + UCHAR *buf; + if (RecvAll(s, &c, sizeof(c), s->SecureMode) == false) + { + FreeBuf(b); + return NULL; + } + WriteBuf(b, &c, sizeof(c)); + buf = (UCHAR *)b->Buf; + if (b->Size > max_size) + { + FreeBuf(b); + return NULL; + } + if (b->Size >= 1) + { + if (buf[b->Size - 1] == '\n') + { + b->Size--; + if (b->Size >= 1) + { + if (buf[b->Size - 1] == '\r') + { + b->Size--; + } + } + str = Malloc(b->Size + 1); + Copy(str, b->Buf, b->Size); + str[b->Size] = 0; + FreeBuf(b); + + return str; + } + } + } +} + +// Receive a PACK +PACK *RecvPack(SOCK *s) +{ + PACK *p; + BUF *b; + void *data; + UINT sz; + // Validate arguments + if (s == NULL || s->Type != SOCK_TCP) + { + return false; + } + + if (RecvAll(s, &sz, sizeof(UINT), s->SecureMode) == false) + { + return false; + } + sz = Endian32(sz); + if (sz > MAX_PACK_SIZE) + { + return false; + } + data = MallocEx(sz, true); + if (RecvAll(s, data, sz, s->SecureMode) == false) + { + Free(data); + return false; + } + + b = NewBuf(); + WriteBuf(b, data, sz); + SeekBuf(b, 0, 0); + p = BufToPack(b); + FreeBuf(b); + Free(data); + + return p; +} + +// Receive a PACK (with checking the hash) +PACK *RecvPackWithHash(SOCK *s) +{ + PACK *p; + BUF *b; + void *data; + UINT sz; + UCHAR hash1[SHA1_SIZE]; + UCHAR hash2[SHA1_SIZE]; + // Validate arguments + if (s == NULL || s->Type != SOCK_TCP) + { + return false; + } + + if (RecvAll(s, &sz, sizeof(UINT), s->SecureMode) == false) + { + return false; + } + sz = Endian32(sz); + if (sz > MAX_PACK_SIZE) + { + return false; + } + data = MallocEx(sz, true); + if (RecvAll(s, data, sz, s->SecureMode) == false) + { + Free(data); + return false; + } + + Sha1(hash1, data, sz); + if (RecvAll(s, hash2, sizeof(hash2), s->SecureMode) == false) + { + Free(data); + return false; + } + + if (Cmp(hash1, hash2, SHA1_SIZE) != 0) + { + Free(data); + return false; + } + + b = NewBuf(); + WriteBuf(b, data, sz); + SeekBuf(b, 0, 0); + p = BufToPack(b); + FreeBuf(b); + Free(data); + + return p; +} + +// Send a PACK +bool SendPack(SOCK *s, PACK *p) +{ + BUF *b; + UINT sz; + // Validate arguments + if (s == NULL || p == NULL || s->Type != SOCK_TCP) + { + return false; + } + + b = PackToBuf(p); + sz = Endian32(b->Size); + + SendAdd(s, &sz, sizeof(UINT)); + SendAdd(s, b->Buf, b->Size); + FreeBuf(b); + + return SendNow(s, s->SecureMode); +} + +// Send a Pack (with adding a hash) +bool SendPackWithHash(SOCK *s, PACK *p) +{ + BUF *b; + UINT sz; + UCHAR hash[SHA1_SIZE]; + // Validate arguments + if (s == NULL || p == NULL || s->Type != SOCK_TCP) + { + return false; + } + + b = PackToBuf(p); + sz = Endian32(b->Size); + + SendAdd(s, &sz, sizeof(UINT)); + SendAdd(s, b->Buf, b->Size); + Sha1(hash, b->Buf, b->Size); + SendAdd(s, hash, sizeof(hash)); + + FreeBuf(b); + + return SendNow(s, s->SecureMode); +} + +// Get SNI name from the SSL packet +bool GetSniNameFromSslPacket(UCHAR *packet_buf, UINT packet_size, char *sni, UINT sni_size) +{ + BUF *buf; + bool ret = false; + UCHAR content_type; + USHORT version; + USHORT handshake_length; + + // Validate arguments + if (packet_buf == NULL || packet_size <= 11) + { + return false; + } + + if (!(packet_buf[0] == 0x16 && packet_buf[1] >= 0x03 && + packet_buf[5] == 0x01 && packet_buf[6] == 0x00 && + packet_buf[9] >= 0x03)) + { + return false; + } + + buf = NewBufFromMemory(packet_buf, packet_size); + + if (ReadBuf(buf, &content_type, sizeof(UCHAR)) == sizeof(UCHAR) && + ReadBuf(buf, &version, sizeof(USHORT)) == sizeof(USHORT) && + ReadBuf(buf, &handshake_length, sizeof(USHORT)) == sizeof(USHORT)) + { + version = Endian16(version); + handshake_length = Endian16(handshake_length); + + if (content_type == 0x16 && version >= 0x0301) + { + UCHAR *handshake_data = Malloc(handshake_length); + + if (ReadBuf(buf, handshake_data, handshake_length) == handshake_length) + { + BUF *buf2 = NewBufFromMemory(handshake_data, handshake_length); + USHORT handshake_type; + USHORT handshake_length_2; + + if (ReadBuf(buf2, &handshake_type, sizeof(USHORT)) == sizeof(USHORT) && + ReadBuf(buf2, &handshake_length_2, sizeof(USHORT)) == sizeof(USHORT)) + { + handshake_type = Endian16(handshake_type); + handshake_length_2 = Endian16(handshake_length_2); + + if (handshake_type == 0x0100 && handshake_length_2 <= (handshake_length - 4)) + { + USHORT version2; + + if (ReadBuf(buf2, &version2, sizeof(USHORT)) == sizeof(USHORT)) + { + version2 = Endian16(version2); + + if (version2 >= 0x0301) + { + UCHAR rand[32]; + + if (ReadBuf(buf2, rand, sizeof(rand)) == sizeof(rand)) + { + UCHAR session_id_len; + + if (ReadBuf(buf2, &session_id_len, sizeof(UCHAR)) == sizeof(UCHAR)) + { + if (ReadBuf(buf2, NULL, session_id_len) == session_id_len) + { + USHORT cipher_len; + + if (ReadBuf(buf2, &cipher_len, sizeof(USHORT)) == sizeof(USHORT)) + { + cipher_len = Endian16(cipher_len); + + if (ReadBuf(buf2, NULL, cipher_len) == cipher_len) + { + UCHAR comps_len; + + if (ReadBuf(buf2, &comps_len, sizeof(UCHAR)) == sizeof(UCHAR)) + { + if (ReadBuf(buf2, NULL, comps_len) == comps_len) + { + USHORT ext_length; + + if (ReadBuf(buf2, &ext_length, sizeof(USHORT)) == sizeof(USHORT)) + { + UCHAR *ext_buf; + + ext_length = Endian16(ext_length); + + ext_buf = Malloc(ext_length); + + if (ReadBuf(buf2, ext_buf, ext_length) == ext_length) + { + BUF *ebuf = NewBufFromMemory(ext_buf, ext_length); + + while (ret == false) + { + USHORT type; + USHORT data_len; + UCHAR *data; + + if (ReadBuf(ebuf, &type, sizeof(USHORT)) != sizeof(USHORT)) + { + break; + } + + if (ReadBuf(ebuf, &data_len, sizeof(USHORT)) != sizeof(USHORT)) + { + break; + } + + type = Endian16(type); + data_len = Endian16(data_len); + + data = Malloc(data_len); + + if (ReadBuf(ebuf, data, data_len) != data_len) + { + Free(data); + break; + } + + if (type == 0x0000) + { + BUF *dbuf = NewBufFromMemory(data, data_len); + + USHORT total_len; + + if (ReadBuf(dbuf, &total_len, sizeof(USHORT)) == sizeof(USHORT)) + { + UCHAR c; + total_len = Endian16(total_len); + + if (ReadBuf(dbuf, &c, sizeof(UCHAR)) == sizeof(UCHAR)) + { + if (c == 0) + { + USHORT name_len; + + if (ReadBuf(dbuf, &name_len, sizeof(USHORT)) == sizeof(USHORT)) + { + char *name_buf; + name_len = Endian16(name_len); + + name_buf = ZeroMalloc(name_len + 1); + + if (ReadBuf(dbuf, name_buf, name_len) == name_len) + { + if (StrLen(name_buf) >= 1) + { + ret = true; + + StrCpy(sni, sni_size, name_buf); + } + } + + Free(name_buf); + } + } + } + } + + FreeBuf(dbuf); + } + + Free(data); + } + + FreeBuf(ebuf); + } + + Free(ext_buf); + } + } + } + } + } + } + } + } + } + } + } + } + + FreeBuf(buf2); + } + + Free(handshake_data); + } + } + + FreeBuf(buf); + + if (ret) + { + Trim(sni); + + if (IsEmptyStr(sni)) + { + ret = false; + } + } + + return ret; +} + +void SetDhParam(DH_CTX *dh) +{ + if (dh_param) + { + DhFree(dh_param); + } + + dh_param = dh; +} diff --git a/src/Mayaqua/Network.h b/src/Mayaqua/Network.h index bd4b535d..e3de52b7 100644 --- a/src/Mayaqua/Network.h +++ b/src/Mayaqua/Network.h @@ -1,1486 +1,1486 @@ -// SoftEther VPN Source Code - Developer Edition Master Branch -// Mayaqua Kernel - - -// Network.h -// Header of Network.c - -#ifndef NETWORK_H -#define NETWORK_H - -// Dynamic Value -struct DYN_VALUE -{ - char Name[256]; // Name - UINT64 Value; // Value -}; - -#define DYN64(id, default_value) ( (UINT64)GetDynValueOrDefaultSafe ( #id , (UINT64)( default_value ))) -#define DYN32(id, default_value) (UINT)DYN64(id, (UINT)default_value) - -#define MAX_HOST_NAME_LEN 255 // Maximum length of the host name - -#define TIMEOUT_GETIP 2300 - -#define TIMEOUT_INFINITE (0x7fffffff) -#define TIMEOUT_TCP_PORT_CHECK (10 * 1000) -#define TIMEOUT_SSL_CONNECT (15 * 1000) - -#define TIMEOUT_HOSTNAME (500) -#define TIMEOUT_NETBIOS_HOSTNAME (100) -#define EXPIRES_HOSTNAME (10 * 60 * 1000) - -#define SOCKET_BUFFER_SIZE 0x10000000 - -#define IPV6_DUMMY_FOR_IPV4 0xFEFFFFDF - -#define UDPLISTENER_CHECK_INTERVAL 1000ULL -#define UDPLISTENER_WAIT_INTERVAL 1234 - -#define UDP_MAX_MSG_SIZE_DEFAULT 65507 - -#define MAX_NUM_IGNORE_ERRORS 1024 - -#ifndef USE_STRATEGY_LOW_MEMORY -#define DEFAULT_GETIP_THREAD_MAX_NUM 512 -#else // USE_STRATEGY_LOW_MEMORY -#define DEFAULT_GETIP_THREAD_MAX_NUM 64 -#endif // USE_STRATEGY_LOW_MEMORY - -#define DEFAULT_CIPHER_LIST "ECDHE+AESGCM:ECDHE+CHACHA20:DHE+AESGCM:DHE+CHACHA20:ECDHE+AES256:DHE+AES256:RSA+AES" - -// SSL logging function -//#define ENABLE_SSL_LOGGING -#define SSL_LOGGING_DIRNAME "@ssl_log" - -// Private IP list file -#define PRIVATE_IP_TXT_FILENAME "$private_ip.txt" - -// Start range of the random UDP port -#define RAND_UDP_PORT_START 5000 -#define RAND_UDP_PORT_END 65530 -#define RAND_UDP_PORT_DEFAULT_NUM_RETRY 64 - -// Special Port -#define MAKE_SPECIAL_PORT(p) (UINT)((UINT)0x10000 | (UINT)(p)) -#define IS_SPECIAL_PORT(p) (MAKEBOOL((p) & (UINT)0x10000)) -#define GET_SPECIAL_PORT(p) (UINT)((UINT)(p) & (UINT)0xffff) - -// Random R-UDP port ID -#define RAND_PORT_ID_SERVER_LISTEN 1 - -// UDP buffer size -#define UDP_MAX_BUFFER_SIZE 11911168 - -// Expiration of the cache acquired from the IP address list of the host -#define HOST_IP_ADDRESS_LIST_CACHE (5 * 1000) - -// IP address -struct IP -{ - UCHAR addr[4]; // IPv4 address, (meaning that 192.0.2.254 = IPv6) - UCHAR ipv6_addr[16]; // IPv6 address - UINT ipv6_scope_id; // IPv6 scope ID -}; - -// Size when comparing the IP structures only in the address part -#define SIZE_OF_IP_FOR_ADDR (sizeof(UCHAR) * 20) - -// Compare the IP address part -#define CmpIpAddr(ip1, ip2) (Cmp((ip1), (ip2), SIZE_OF_IP_FOR_ADDR)) - -// IPv6 address (different format) -struct IPV6_ADDR -{ - UCHAR Value[16]; // Value -} GCC_PACKED; - -// IPv6 Address Types -#define IPV6_ADDR_UNICAST 1 // Unicast -#define IPV6_ADDR_LOCAL_UNICAST 2 // Local unicast -#define IPV6_ADDR_GLOBAL_UNICAST 4 // Global Unicast -#define IPV6_ADDR_MULTICAST 8 // Multicast -#define IPV6_ADDR_ALL_NODE_MULTICAST 16 // All-nodes multicast -#define IPV6_ADDR_ALL_ROUTER_MULTICAST 32 // All routers multicast -#define IPV6_ADDR_SOLICIATION_MULTICAST 64 // Solicited-node multicast -#define IPV6_ADDR_ZERO 128 // All zeros -#define IPV6_ADDR_LOOPBACK 256 // Loop-back - - -// DNS cache list -struct DNSCACHE -{ - char *HostName; - IP IpAddress; -}; - -// Client list -struct IP_CLIENT -{ - IP IpAddress; // IP address - UINT NumConnections; // The number of connections -}; - -// Socket event -struct SOCK_EVENT -{ - REF *ref; // Reference counter -#ifdef OS_WIN32 - void *hEvent; // Pointer to a Win32 event handle -#else // OS_WIN32 - LIST *SockList; // Socket list - int pipe_read, pipe_write; // Pipe - UINT current_pipe_data; // Amount of data in the current pipe -#endif // OS_WIN32 -}; - -// Type of socket -#define SOCK_TCP 1 -#define SOCK_UDP 2 -#define SOCK_INPROC 3 -#define SOCK_RUDP_LISTEN 5 -#define SOCK_REVERSE_LISTEN 6 - -// SSL Accept Settings -struct SSL_ACCEPT_SETTINGS -{ - bool Tls_Disable1_0; - bool Tls_Disable1_1; - bool Tls_Disable1_2; - bool Tls_Disable1_3; - bool Override_Security_Level; - UINT Override_Security_Level_Value; -}; - -// Socket -struct SOCK -{ - REF *ref; // Reference counter - LOCK *lock; // Lock - LOCK *ssl_lock; // Lock related to the SSL - LOCK *disconnect_lock; // Disconnection lock - SOCKET socket; // Socket number - SSL *ssl; // SSL object - struct ssl_ctx_st *ssl_ctx; // SSL_CTX - char SniHostname[256]; // SNI host name - UINT Type; // Type of socket - bool Connected; // Connecting flag - bool ServerMode; // Server mode - bool AsyncMode; // Asynchronous mode - bool SecureMode; // SSL communication mode - bool ListenMode; // In listening - BUF *SendBuf; // Transmission buffer - bool IpClientAdded; // Whether it has been added to the list IP_CLIENT - bool LocalOnly; // Only local - bool EnableConditionalAccept; // Conditional Accept is Enabled - IP RemoteIP; // IP address of the remote host - IP LocalIP; // IP address of the local host - char *RemoteHostname; // Remote host name - UINT RemotePort; // Port number of the remote side - UINT LocalPort; // Port number of the local side - UINT64 SendSize; // Total size of the sent data - UINT64 RecvSize; // Total size of received data - UINT64 SendNum; // Number of sent data blocks - UINT64 RecvNum; // Number of received data blocks - X *RemoteX; // Certificate of the remote host - X *LocalX; // Certificate of the local host - char *CipherName; // Cipher algorithm name - char *WaitToUseCipher; // Set the algorithm name to want to use - bool IgnoreRecvErr; // Whether the RecvFrom error is ignorable - bool IgnoreSendErr; // Whether the SendTo error is ignorable - UINT TimeOut; // Time-out value - SOCK_EVENT *SockEvent; // Associated socket-event - bool CancelAccept; // Cancel flag of the Accept - bool AcceptCanceled; // Flag which shows canceling of the Accept - bool WriteBlocked; // Previous write is blocked - bool NoNeedToRead; // Is not required to read - bool Disconnecting; // Disconnecting - bool UdpBroadcast; // UDP broadcast mode - void *Param; // Any parameters - bool IPv6; // IPv6 - bool IsRawSocket; // Whether it is a raw socket - const char *SslVersion; // SSL version - UINT RawSocketIPProtocol; // IP protocol number if it's a raw socket - TUBE *SendTube; // Tube for transmission - TUBE *RecvTube; // Tube for reception - QUEUE *InProcAcceptQueue; // Accept queue of the in-process socket - EVENT *InProcAcceptEvent; // Accept event of the in-process socket - FIFO *InProcRecvFifo; // Receive FIFO of the in-process socket - UINT UdpMaxMsgSize; // Maximum transmitting and receiving size at a time on UDP - int CurrentTos; // Current ToS value - bool IsTtlSupported; // Whether the TTL value is supported - UINT CurrentTtl; // Current TTL value - RUDP_STACK *R_UDP_Stack; // R-UDP stack - char UnderlayProtocol[64]; // Underlying protocol - char ProtocolDetails[256]; // Protocol details - QUEUE *ReverseAcceptQueue; // Accept queue for the reverse socket - EVENT *ReverseAcceptEvent; // Accept event for the reverse socket - bool IsReverseAcceptedSocket; // Whether it is a reverse socket - IP Reverse_MyServerGlobalIp; // Self global IP address when using the reverse socket - UINT Reverse_MyServerPort; // Self port number when using the reverse socket - UCHAR Ssl_Init_Async_SendAlert[2]; // Initial state of SSL send_alert - SSL_ACCEPT_SETTINGS SslAcceptSettings; // SSL Accept Settings - bool RawIP_HeaderIncludeFlag; - -#ifdef ENABLE_SSL_LOGGING - // SSL Logging (for debug) - bool IsSslLoggingEnabled; // Flag - IO *SslLogging_Recv; // for Recv - IO *SslLogging_Send; // for Send - LOCK *SslLogging_Lock; // Locking -#endif // ENABLE_SSL_LOGGING - - void *hAcceptEvent; // Event for Accept - - // R-UDP socket related - bool IsRUDPSocket; // Whether this is R-UDP socket - TUBE *BulkSendTube; // Tube for Bulk send - TUBE *BulkRecvTube; // Tube for Bulk receive - SHARED_BUFFER *BulkSendKey; // Bulk send key - SHARED_BUFFER *BulkRecvKey; // Bulk receive key - UINT RUDP_OptimizedMss; // Optimal MSS value - -#ifdef OS_UNIX - pthread_t CallingThread; // Thread that is calling the system call -#endif // OS_UNIX - -#ifdef OS_WIN32 - void *hEvent; // Event for asynchronous mode -#endif // OS_WIN32 -}; - -// Underlying protocol description string of socket -#define SOCK_UNDERLAY_NATIVE_V6 "Standard TCP/IP (IPv6)" -#define SOCK_UNDERLAY_NATIVE_V4 "Standard TCP/IP (IPv4)" -#define SOCK_UNDERLAY_NAT_T "VPN over UDP with NAT-T (IPv4)" -#define SOCK_UNDERLAY_DNS "VPN over DNS (IPv4)" -#define SOCK_UNDERLAY_ICMP "VPN over ICMP (IPv4)" -#define SOCK_UNDERLAY_INPROC "In-Process Pipe" -#define SOCK_UNDERLAY_INPROC_EX "Legacy VPN - %s" -#define SOCK_UNDERLAY_AZURE "TCP/IP via VPN Azure (IPv4)" - -// Constant of the return value -#define SOCK_LATER (0xffffffff) // In blocking - -// Socket Set -#define MAX_SOCKSET_NUM 60 // Number of sockets that can be stored in a socket set -struct SOCKSET -{ - UINT NumSocket; // The number of sockets - SOCK *Sock[MAX_SOCKSET_NUM]; // Array of pointers to the socket -}; - -// Cancel object -struct CANCEL -{ - REF *ref; // Reference counter - bool SpecialFlag; // Special flag (associated to the event which is generated by Win32 driver) -#ifdef OS_WIN32 - void *hEvent; // Pointer to a Win32 event handle -#else // OS_WIN32 - int pipe_read, pipe_write; // Pipe - int pipe_special_read2, pipe_special_read3; -#endif // OS_WIN32 -}; - -// Routing table entry -struct ROUTE_ENTRY -{ - IP DestIP; - IP DestMask; - IP GatewayIP; - bool LocalRouting; - bool PPPConnection; - UINT Metric; - UINT OldIfMetric; - UINT InterfaceID; - UINT64 InnerScore; -}; - -// Routing table -struct ROUTE_TABLE -{ - UINT NumEntry; - UINT HashedValue; - ROUTE_ENTRY **Entry; -}; - -// ICMP response result -struct ICMP_RESULT -{ - bool Ok; // Whether a correct response returned - bool Timeout; // Whether a time-out is occurred - UCHAR Type; // Message type - UCHAR Code; // Message code - UCHAR Ttl; // TTL - UCHAR *Data; // Data body - UINT DataSize; // Data size - UINT Rtt; // Round Trip Time - IP IpAddress; // IP address -}; - - -// Host name cache list -typedef struct HOSTCACHE -{ - UINT64 Expires; // Expiration - IP IpAddress; // IP address - char HostName[256]; // Host name -} HOSTCACHE; - -// NETBIOS name requests -typedef struct NBTREQUEST -{ - USHORT TransactionId; - USHORT Flags; - USHORT NumQuestions; - USHORT AnswerRRs; - USHORT AuthorityRRs; - USHORT AdditionalRRs; - UCHAR Query[38]; -} NBTREQUEST; - -// NETBIOS name response -typedef struct NBTRESPONSE -{ - USHORT TransactionId; - USHORT Flags; - USHORT NumQuestions; - USHORT AnswerRRs; - USHORT AuthorityRRs; - USHORT AdditionalRRs; - UCHAR Response[61]; -} NBTRESPONSE; - -// Socket list -typedef struct SOCKLIST -{ - LIST *SockList; -} SOCKLIST; - - -// Parameters for timeout thread for Solaris -typedef struct SOCKET_TIMEOUT_PARAM { - SOCK *sock; - CANCEL *cancel; - THREAD *thread; - bool unblocked; -} SOCKET_TIMEOUT_PARAM; - -// Parameters for GetIP thread -struct GETIP_THREAD_PARAM -{ - REF *Ref; - char HostName[MAX_PATH]; - bool IPv6; - UINT Timeout; - IP Ip; - bool Ok; -}; - -// Parameters for the IP address release thread -struct WIN32_RELEASEADDRESS_THREAD_PARAM -{ - REF *Ref; - char Guid[MAX_SIZE]; - UINT Timeout; - bool Ok; - bool Renew; -}; - -// TCP table entry -typedef struct TCPTABLE -{ - UINT Status; - IP LocalIP; - UINT LocalPort; - IP RemoteIP; - UINT RemotePort; - UINT ProcessId; -} TCPTABLE; - -// State of TCP -#define TCP_STATE_CLOSED 1 -#define TCP_STATE_LISTEN 2 -#define TCP_STATE_SYN_SENT 3 -#define TCP_STATE_SYN_RCVD 4 -#define TCP_STATE_ESTAB 5 -#define TCP_STATE_FIN_WAIT1 6 -#define TCP_STATE_FIN_WAIT2 7 -#define TCP_STATE_CLOSE_WAIT 8 -#define TCP_STATE_CLOSING 9 -#define TCP_STATE_LAST_ACK 10 -#define TCP_STATE_TIME_WAIT 11 -#define TCP_STATE_DELETE_TCB 12 - -// Routing table changing notification -struct ROUTE_CHANGE -{ - ROUTE_CHANGE_DATA *Data; -}; - -// Tube flush list -struct TUBE_FLUSH_LIST -{ - LIST *List; // List -}; - -// Tube -struct TUBE -{ - REF *Ref; // Reference counter - LOCK *Lock; // Lock - QUEUE *Queue; // Packet queue - EVENT *Event; // Event - SOCK_EVENT *SockEvent; // SockEvent - UINT SizeOfHeader; // Header size - TUBEPAIR_DATA *TubePairData; // Tube pair data - UINT IndexInTubePair; // Number in the tube pair - bool IsInFlushList; // Whether it is registered in the Tube Flush List - void *Param1, *Param2, *Param3; - UINT IntParam1, IntParam2, IntParam3; -}; - -// Data that is to send and to receive in the tube -struct TUBEDATA -{ - void *Data; // Body of data - UINT DataSize; // The size of the data - void *Header; // The body of the header - UINT HeaderSize; // Size of the header -}; - -// Tube pair data -struct TUBEPAIR_DATA -{ - bool IsDisconnected; // Disconnection flag - REF *Ref; // Reference counter - LOCK *Lock; // Lock - EVENT *Event1, *Event2; // Event - SOCK_EVENT *SockEvent1, *SockEvent2; // SockEvent -}; - -// TCP raw data -struct TCP_RAW_DATA -{ - IP SrcIP; // Source IP address - IP DstIP; // Destination IP address - UINT SrcPort; // Source port - UINT DstPort; // Destination port - FIFO *Data; // Data body -}; - -// UDP listener socket entry -struct UDPLISTENER_SOCK -{ - IP IpAddress; // IP address - UINT Port; // Port number - SOCK *Sock; // Socket - bool HasError; // Whether an error occurs - bool Mark; // Mark - bool ErrorDebugDisplayed; // Whether the error has been displayed - UINT64 NextMyIpAndPortPollTick; // Time to check the self IP address and port number next - IP PublicIpAddress; // Global IP address - UINT PublicPort; // Global port number -}; - -// UDP packet -struct UDPPACKET -{ - IP SrcIP; // Source IP address - IP DstIP; // Destination IP address - UINT SrcPort; // Source port - UINT DestPort; // Destination port - UINT Size; // Data size - void *Data; // Data body - UINT Type; // Type -}; - -// UDP listener packet receipt notification procedure -typedef void (UDPLISTENER_RECV_PROC)(UDPLISTENER *u, LIST *packet_list); - -// UDP listener -struct UDPLISTENER -{ - bool Halt; // Halting flag - SOCK_EVENT *Event; // Event - THREAD *Thread; // Thread - LIST *PortList; // Port list - LIST *SockList; // Socket list - UINT64 LastCheckTick; // Time which the socket list was checked last - UDPLISTENER_RECV_PROC *RecvProc; // Receive procedure - LIST *SendPacketList; // Transmission packet list - UINT PacketType; // The type to set when creating an UDPPACKET - void *Param; // Parameters - INTERRUPT_MANAGER *Interrupts; // Interrupt manager - bool HostIPAddressListChanged; // IP address list of the host has changed - bool IsEspRawPortOpened; // Whether the raw port opens - bool PollMyIpAndPort; // Examine whether the global IP and the port number of its own - QUERYIPTHREAD *GetNatTIpThread; // NAT-T IP address acquisition thread - IP ListenIP; // Listen IP -}; - -#define QUERYIPTHREAD_INTERVAL_LAST_OK (3 * 60 * 60 * 1000) -#define QUERYIPTHREAD_INTERVAL_LAST_NG (30 * 1000) - -// IP address acquisition thread -struct QUERYIPTHREAD -{ - THREAD *Thread; // Thread - EVENT *HaltEvent; // Halting event - bool Halt; // Halting flag - LOCK *Lock; // Lock - IP Ip; // Get the IP address - char Hostname[MAX_SIZE]; // Host name - UINT IntervalLastOk; // Interval if last was OK - UINT IntervalLastNg; // Interval if last was NG -}; - -// Interrupt management -struct INTERRUPT_MANAGER -{ - LIST *TickList; // Time list -}; - -// SSL BIO -struct SSL_BIO -{ - BIO *bio; // BIO - FIFO *SendFifo; // Transmission FIFO - FIFO *RecvFifo; // Reception FIFO - bool IsDisconnected; // Disconnected - bool NoFree; // Not to release the BIO -}; - -// SSL pipe -struct SSL_PIPE -{ - bool ServerMode; // Whether it's in the server mode - bool IsDisconnected; // Disconnected - SSL *ssl; // SSL object - struct ssl_ctx_st *ssl_ctx; // SSL_CTX - SSL_BIO *SslInOut; // I/O BIO for the data in the SSL tunnel - SSL_BIO *RawIn, *RawOut; // Input and output BIO of the data flowing through the physical network -}; - -// IP address block list -struct IPBLOCK -{ - IP Ip; // IP address - IP Mask; // Subnet mask -}; - - -// R-UDP related constants -#define RUDP_RESEND_TIMER 200 // Retransmission timer (initial value) -#define RUDP_RESEND_TIMER_MAX 4792 // Retransmission timer (maximum value) -#define RUDP_KEEPALIVE_INTERVAL_MIN 2500 // Transmission interval of Keep Alive (minimum) -#define RUDP_KEEPALIVE_INTERVAL_MAX 4792 // Transmission interval of Keep Alive (maximum) -#define RUDP_TIMEOUT 12000 // Time-out of R-UDP communication -#define RUDP_DIRECT_CONNECT_TIMEOUT 5000 // R-UDP direct connection time-out -#define RUDP_MAX_SEGMENT_SIZE 512 // Maximum segment size -#define RUDP_BULK_KEY_SIZE_MAX 128 // Bulk key size Max - -#define RUDP_BULK_KEY_SIZE_V2 32 // V2: Bulk key size -#define RUDP_BULK_IV_SIZE_V2 12 // V2: Bulk IV size -#define RUDP_BULK_MAC_SIZE_V2 16 // V2: Bulk MAC size - -// Maximum R-UDP packet size -#define RUDP_MAX_PACKET_SIZE (RUDP_MAX_SEGMENT_SIZE + sizeof(UINT64) * RUDP_MAX_NUM_ACK + SHA1_SIZE * 2 + sizeof(UINT64) * 4 + sizeof(UINT) + 255) -#define RUDP_MAX_NUM_ACK 64 // Maximum number of ACKs -#define RUDP_LOOP_WAIT_INTERVAL_S 1234 // Waiting time in the thread main loop (in server side) -#define RUDP_LOOP_WAIT_INTERVAL_C 100 // Waiting time in the thread main loop (in client side) -#define RUDP_MAX_FIFO_SIZE (1600 * 1600) // The maximum FIFO buffer size - -// Interval for sending ICMP Echo from the client side when R-UDP used in ICMP mode -#define RUDP_CLIENT_ECHO_REQUEST_SEND_INTERVAL_MIN 1000 -#define RUDP_CLIENT_ECHO_REQUEST_SEND_INTERVAL_MAX 3000 - -// R-UDP error code -#define RUDP_ERROR_OK 0 // Success -#define RUDP_ERROR_UNKNOWN 1 // Unknown Error -#define RUDP_ERROR_TIMEOUT 2 // Time-out -#define RUDP_ERROR_NAT_T_GETIP_FAILED 3 // IP address acquisition failure of NAT-T server -#define RUDP_ERROR_NAT_T_NO_RESPONSE 4 // There is no response from the NAT-T server -#define RUDP_ERROR_NAT_T_TWO_OR_MORE 5 // There are two or more hosts on the same destination IP address -#define RUDP_ERROR_NAT_T_NOT_FOUND 6 // Host does not exist at the specified IP address -#define RUDP_ERROR_USER_CANCELED 7 // Cancel by the user - -// R-UDP segment -struct RUDP_SEGMENT -{ - UINT64 SeqNo; // Sequence number - UINT Size; // Size - UCHAR Data[RUDP_MAX_SEGMENT_SIZE]; // Data - UINT64 NextSendTick; // Next transmission time - UINT NumSent; // Number of times sent -}; - -// Status of R-UDP session -#define RUDP_SESSION_STATUS_CONNECT_SENT 0 // Connection request sent -#define RUDP_SESSION_STATUS_ESTABLISHED 1 // Connection established - -// Quota -#define RUDP_QUOTA_MAX_NUM_SESSIONS_PER_IP DYN32(RUDP_QUOTA_MAX_NUM_SESSIONS_PER_IP, 1000) // The number of R-UDP sessions per an IP address -#define RUDP_QUOTA_MAX_NUM_SESSIONS DYN32(RUDP_QUOTA_MAX_NUM_SESSIONS, 30000) // Limit of the Number of sessions - -// Range of the sequence numbers of bulk packet -#define RUDP_BULK_SEQ_NO_RANGE 16384ULL -#define RUDP_BULK_MAX_RECV_PKTS_IN_QUEUE 8192 - -// R-UDP session -struct RUDP_SESSION -{ - UINT Status; // Status - bool ServerMode; // Whether it's in the server mode - bool DisconnectFlag; // Disconnection flag - bool DisconnectedByYou; // Disconnected from opponent - bool UseHMac; - IP MyIp; // IP address of itself - UINT MyPort; // Port number of itself - IP YourIp; // Opponent IP address - UINT YourPort; // Opponent port number - LIST *SendSegmentList; // Transmission segment list - LIST *RecvSegmentList; // Received segments list - LIST *ReplyAckList; // List of ACKs in response - SOCK *TcpSock; // Corresponding TCP socket - UINT64 LastSentTick; // Time which the data has been sent last - UINT64 LastRecvTick; // Time which the data has been received last - UCHAR Key_Init[SHA1_SIZE]; // Initial key - UCHAR Key_Send[SHA1_SIZE]; // Key that is used to send - UCHAR Key_Recv[SHA1_SIZE]; // Key that is used to receive - UCHAR Magic_KeepAliveRequest[SHA1_SIZE]; // The magic number for the KeepAlive request - UCHAR Magic_KeepAliveResponse[SHA1_SIZE]; // The magic number for KeepAlive response - UINT64 Magic_Disconnect; // Disconnection Signal - UINT64 NextSendSeqNo; // Transmission sequence number to be used next - UINT64 LastRecvCompleteSeqNo; // Sequence number of receiving complete - // (This indicates all segments which have sequence number up to this number are received completely) - UCHAR NextIv[SHA1_SIZE]; // IV value to be used next - UINT NextKeepAliveInterval; // Interval value of KeepAlive to be used next - FIFO *RecvFifo; // Reception FIFO - FIFO *SendFifo; // Transmission FIFO - UINT64 YourTick; // The largest value among received Tick from the opponent - UINT64 LatestRecvMyTick; // Value of the last tick among the received tick values - UINT64 LatestRecvMyTick2; // Variable for confirming whether LatestRecvMyTick2 changes - UINT CurrentRtt; // Current RTT value - - UINT Icmp_Type; // Number of Type to be used in the ICMP - USHORT Dns_TranId; // Value of transaction ID used in DNS - UINT64 Client_Icmp_NextSendEchoRequest; // Time to send the next Echo Request in the ICMP - SHARED_BUFFER *BulkSendKey; // Bulk send key - SHARED_BUFFER *BulkRecvKey; // Bulk receive key - UCHAR BulkNextIv[SHA1_SIZE]; // Next IV to the bulk send - UINT64 BulkNextSeqNo; // Next SEQ NO to the bulk send - bool FlushBulkSendTube; // Flag to be Flush the bulk send Tube - UINT64 BulkRecvSeqNoMax; // Highest sequence number received - UCHAR BulkNextIv_V2[RUDP_BULK_IV_SIZE_V2]; // Next IV to the bulk send (version 2) -}; - -// NAT Traversal Server Information -#define UDP_NAT_T_SERVER_TAG "x%c.x%c.dev.servers.nat-traversal.softether-network.net." -#define UDP_NAT_T_SERVER_TAG_ALT "x%c.x%c.dev.servers.nat-traversal.uxcom.jp." -#define UDP_NAT_T_PORT 5004 - -// Related to processing to get the IP address of the NAT-T server -#define UDP_NAT_T_GET_IP_INTERVAL DYN32(UDP_NAT_T_GET_IP_INTERVAL, (5 * 1000)) // IP address acquisition interval of NAT-T server (before success) -#define UDP_NAT_T_GET_IP_INTERVAL_MAX DYN32(UDP_NAT_T_GET_IP_INTERVAL, (150 * 1000)) // IP address acquisition interval of NAT-T server (before success) -#define UDP_NAT_T_GET_IP_INTERVAL_AFTER DYN32(UDP_NAT_T_GET_IP_INTERVAL_AFTER, (5 * 60 * 1000)) // IP address acquisition interval of NAT-T server (after success) - -// Related to process to get the private IP address of itself with making a TCP connection to the NAT-T server -#define UDP_NAT_T_GET_PRIVATE_IP_TCP_SERVER "www.msftncsi.com." - -#define UDP_NAT_T_PORT_FOR_TCP_1 80 -#define UDP_NAT_T_PORT_FOR_TCP_2 443 - -#define UDP_NAT_TRAVERSAL_VERSION 1 - -#define UDP_NAT_T_GET_PRIVATE_IP_INTERVAL DYN32(UDP_NAT_T_GET_PRIVATE_IP_INTERVAL, (15 * 60 * 1000)) // Polling interval (before success) -#define UDP_NAT_T_GET_PRIVATE_IP_INTERVAL_AFTER_MIN DYN32(UDP_NAT_T_GET_PRIVATE_IP_INTERVAL_AFTER_MIN, (30 * 60 * 1000)) // Polling interval (after success) -#define UDP_NAT_T_GET_PRIVATE_IP_INTERVAL_AFTER_MAX DYN32(UDP_NAT_T_GET_PRIVATE_IP_INTERVAL_AFTER_MAX, (60 * 60 * 1000)) // Polling interval (after success) -#define UDP_NAT_T_GET_PRIVATE_IP_CONNECT_TIMEOUT DYN32(UDP_NAT_T_GET_PRIVATE_IP_CONNECT_TIMEOUT, (5 * 1000)) // TCP connection time-out - -// About token acquisition from the NAT-T server -#define UDP_NAT_T_GET_TOKEN_INTERVAL_1 DYN32(UDP_NAT_T_GET_TOKEN_INTERVAL_1, (5 * 1000)) // Token acquisition interval from the NAT-T server (If not acquired) -#define UDP_NAT_T_GET_TOKEN_INTERVAL_FAIL_MAX DYN32(UDP_NAT_T_GET_TOKEN_INTERVAL_FAIL_MAX, 20) -#define UDP_NAT_T_GET_TOKEN_INTERVAL_2_MIN DYN32(UDP_NAT_T_GET_TOKEN_INTERVAL_2_MIN, (20 * 60 * 1000)) // Token acquisition interval minimum value from the NAT-T server (If token have been obtained) -#define UDP_NAT_T_GET_TOKEN_INTERVAL_2_MAX DYN32(UDP_NAT_T_GET_TOKEN_INTERVAL_2_MAX, (30 * 60 * 1000)) // Token acquisition interval maximum value from the NAT-T server (If token have been obtained) - -// The Register interval for NAT-T server -#define UDP_NAT_T_REGISTER_INTERVAL_INITIAL DYN32(UDP_NAT_T_REGISTER_INTERVAL_INITIAL, (5 * 1000)) // Transmission interval when the Register is not completed -#define UDP_NAT_T_REGISTER_INTERVAL_FAIL_MAX DYN32(UDP_NAT_T_REGISTER_INTERVAL_FAIL_MAX, 20) -#define UDP_NAT_T_REGISTER_INTERVAL_MIN DYN32(UDP_NAT_T_REGISTER_INTERVAL_MIN, (220 * 1000)) // Minimum value of the Register interval -#define UDP_NAT_T_REGISTER_INTERVAL_MAX DYN32(UDP_NAT_T_REGISTER_INTERVAL_MAX, (240 * 1000)) // Maximum value of the Register interval - -// Interval for checking whether the port number or the IP address is changed -#define UDP_NAT_T_NAT_STATUS_CHECK_INTERVAL_MIN DYN32(UDP_NAT_T_NAT_STATUS_CHECK_INTERVAL_MIN, (24 * 1000)) -#define UDP_NAT_T_NAT_STATUS_CHECK_INTERVAL_MAX DYN32(UDP_NAT_T_NAT_STATUS_CHECK_INTERVAL_MAX, (28 * 1000)) - -// The Connect Request interval for NAT-T server -#define UDP_NAT_T_CONNECT_INTERVAL DYN32(UDP_NAT_T_CONNECT_INTERVAL, 200) - -// Polling interval for its own IP information acquisition to the NAT-T server in regular communication between the client and the server -#define UDP_NAT_T_INTERVAL_MIN DYN32(UDP_NAT_T_INTERVAL_MIN, (5 * 60 * 1000)) -#define UDP_NAT_T_INTERVAL_MAX DYN32(UDP_NAT_T_INTERVAL_MAX, (10 * 60 * 1000)) -#define UDP_NAT_T_INTERVAL_INITIAL DYN32(UDP_NAT_T_INTERVAL_INITIAL, (3 * 1000)) -#define UDP_NAT_T_INTERVAL_FAIL_MAX DYN32(UDP_NAT_T_INTERVAL_FAIL_MAX, 60) - -// R-UDP stack callback function definition -typedef void (RUDP_STACK_INTERRUPTS_PROC)(RUDP_STACK *r); -typedef bool (RUDP_STACK_RPC_RECV_PROC)(RUDP_STACK *r, UDPPACKET *p); - -// ICMP protocol number -#define IP_PROTO_ICMPV4 0x01 // ICMPv4 protocol -#define IP_PROTO_ICMPV6 0x3a // ICMPv6 protocol - -// R-UDP protocol -#define RUDP_PROTOCOL_UDP 0 // UDP -#define RUDP_PROTOCOL_ICMP 1 // ICMP -#define RUDP_PROTOCOL_DNS 2 // DNS - -// Maximum time of continuously changing of the NAT-T hostname -#define RUDP_NATT_MAX_CONT_CHANGE_HOSTNAME 30 -#define RUDP_NATT_CONT_CHANGE_HOSTNAME_RESET_INTERVAL (5 * 60 * 1000) - -// Minimum time to wait for a trial to connect by ICMP and DNS in case failing to connect by TCP -#define SOCK_CONNECT_WAIT_FOR_ICMP_AND_DNS_AT_LEAST 5000 - -#define RUDP_MAX_VALIDATED_SOURCE_IP_ADDRESSES 512 -#define RUDP_VALIDATED_SOURCE_IP_ADDRESS_EXPIRES (RUDP_TIMEOUT * 2) - -// Validated Source IP Addresses for R-UDP -struct RUDP_SOURCE_IP -{ - UINT64 ExpiresTick; // Expires - IP ClientIP; // Client IP address -}; - -// R-UDP stack -struct RUDP_STACK -{ - bool ServerMode; // Whether it's in the server mode - char SvcName[MAX_SIZE]; // Service name - UCHAR SvcNameHash[SHA1_SIZE]; // Hash of the service name - bool Halt; // Halting flag - void *Param; // Parameters that can be used by developers - UINT64 Now; // Current time - EVENT *HaltEvent; // Halting event - INTERRUPT_MANAGER *Interrupt; // Interrupt manager - LIST *SessionList; // Session List - SOCK *UdpSock; // UDP socket - UINT Port; // Port number - UINT Protocol; // Protocol - SOCK_EVENT *SockEvent; // Socket event - THREAD *Thread; // Thread - LOCK *Lock; // Lock - RUDP_STACK_INTERRUPTS_PROC *ProcInterrupts; // Interrupt notification callback - RUDP_STACK_RPC_RECV_PROC *ProcRpcRecv; // RPC reception notification callback - THREAD *IpQueryThread; // NAT-T server IP inquiry thread - UCHAR TmpBuf[65536]; // Temporary buffer - LIST *SendPacketList; // Transmission UDP packet list - EVENT *NewSockConnectEvent; // Event to inform that a new socket is connected - QUEUE *NewSockQueue; // Queue of new socket - UINT64 TotalPhysicalReceived; // Physical amount of data received - UINT64 TotalLogicalReceived; // Logical amount of data received - UINT64 TotalPhysicalSent; // Physical amount of data transmitted - UINT64 TotalLogicalSent; // Logical amount of data transmitted - char CurrentRegisterHostname[MAX_SIZE]; // The host name of the the current destination of registration - UINT NumChangedHostname; // How number of changing NAT-T hostname has occured continuously - UINT64 NumChangedHostnameValueResetTick; - - // NAT-T server related - bool NoNatTRegister; // Flag not to register with the NAT-T server - UINT64 NatT_TranId; // Transaction ID is used to communicate with the NAT-T server - UINT64 NatT_SessionKey; // Current Session Key - IP NatT_IP; // IP address of the NAT-T server - IP NatT_IP_Safe; // IP address of the NAT-T server (thread-safe) - IP My_Private_IP; // Private IP address of itself - IP My_Private_IP_Safe; // Private IP address of itself (thread-safe) - UINT64 NatT_GetTokenNextTick; // Time to get the next token - UINT NatT_GetTokenFailNum; // Token acquisition failure times - char NatT_Token[MAX_SIZE]; // Token needed to communicate with NAT-T Server - bool NatT_Token_Ok; // Flag of whether it have a valid token - UINT64 NatT_RegisterNextTick; // Time to register next - UINT NatT_RegisterFailNum; // The number of Register failures - bool NatT_Register_Ok; // Is a successful registration - char NatT_Registered_IPAndPort[128]; // IP address and port number at the time of registration success - UINT64 NatT_NextNatStatusCheckTick; // Time to check the NAT state next - UINT LastDDnsFqdnHash; // DNS FQDN hash value when last checked - volatile UINT *NatTGlobalUdpPort; // NAT-T global UDP port - UCHAR RandPortId; // Random UDP port ID - bool NatT_EnableSourceIpValidation; // Enable the source IP address validation mechanism - LIST *NatT_SourceIpList; // Authenticated source IP address list - - // For Client - bool TargetIpAndPortInited; // The target IP address and the port number are initialized - IP TargetIp; // Target IP address - UINT TargetPort; // Target port number - EVENT *TargetConnectedEvent; // Event to be set when the connection to the target is successful - SOCK *TargetConnectedSock; // Connected socket - bool ClientInitiated; // Flag to indicate that the connection is initiated - bool DoNotSetTargetConnectedSock; // Flag indicating that it should not set the TargetConnectedSock - USHORT Client_IcmpId, Client_IcmpSeqNo; // Sequence number and ICMP ID that is randomly generated on the client side -}; - -// Data for the thread for concurrent connection attempts for the R-UDP and TCP -struct CONNECT_TCP_RUDP_PARAM -{ - IP Ip; - UINT Port; - UINT Timeout; - char Hostname[MAX_SIZE]; - bool *CancelFlag; - UINT NatT_ErrorCode; - char SvcName[MAX_SIZE]; - char HintStr[MAX_SIZE]; - char TargetHostname[MAX_SIZE]; - SOCK *Result_Nat_T_Sock; - SOCK *Result_Tcp_Sock; - bool Finished; - bool Ok; - UINT64 FinishedTick; - EVENT *FinishEvent; - UINT RUdpProtocol; - UINT Delay; - bool Tcp_TryStartSsl; - LOCK *CancelLock; - SOCK *CancelDisconnectSock; - bool Tcp_InNegotiation; -}; - -#define SSL_DEFAULT_CONNECT_TIMEOUT (15 * 1000) // SSL default timeout - -// Header for TCP Pair -struct TCP_PAIR_HEADER -{ - bool EnableHMac; -}; - -// The constants for file query by using UDP -#define UDP_FILE_QUERY_RETRY_INTERVAL 100 // Retry interval -#define UDP_FILE_QUERY_DST_PORT 5004 // Destination UDP port number -#define UDP_FILE_QUERY_MAGIC_NUMBER "{5E465695-7923-4CCD-9B51-44444BE1E758}" // Magic number -#define UDP_FILE_QUERY_BFLETS_TXT_FILENAME "|BFletsUdpList.txt" // Text file name of the IPv6 node list - -// The constant for DNS proxy for the B FLETs -#define BFLETS_DNS_PROXY_PORT 443 -#define BFLETS_DNS_PROXY_PATH "/ddns/queryhost.aspx" -#define BFLETS_DNS_PROXY_CERT_HASH "EFAC5FA0CDD14E0F864EED58A73C35D7E33B62F3" -#define BFLETS_DNS_PROXY_TIMEOUT_FOR_GET_F 500 // Timeout when searching for the server by UDP -#define BFLETS_DNS_PROXY_TIMEOUT_FOR_QUERY 3000 // Timeout for the response from the proxy DNS server - -// FLET'S Hikar-Next (East) DNS proxy host name -#define FLETS_NGN_EAST_DNS_PROXY_HOSTNAME "senet.aoi.flets-east.jp" -#define FLETS_NGN_WEST_DNS_PROXY_HOSTNAME "senet.p-ns.flets-west.jp" -#define FLETS_NGN_DNS_QUERY_TIMEOUT 1000 // FLET'S Hikar-Next host name query timeout - -// Detection result of the type of FLET'S line -#define FLETS_DETECT_TYPE_EAST_BFLETS_PRIVATE 1 // NTT East B-FLETs -#define FLETS_DETECT_TYPE_EAST_NGN_PRIVATE 2 // Wrapping in network of NTT East NGN -#define FLETS_DETECT_TYPE_WEST_NGN_PRIVATE 4 // Wrapping in network of NTT West NGN - -// NIC adapter entry -struct NIC_ENTRY -{ - char IfName[MAX_SIZE]; - UCHAR MacAddress[6]; -}; - -int GetCurrentTimezone(); - -bool GetSniNameFromSslPacket(UCHAR *packet_buf, UINT packet_size, char *sni, UINT sni_size); - -void SetDhParam(DH_CTX *dh); - -bool IsUseDnsProxy(); -bool IsUseAlternativeHostname(); - -#ifdef OS_WIN32 -int GetCurrentTimezoneWin32(); -#endif // OS_WIN32 - -bool SendPack(SOCK *s, PACK *p); -PACK *RecvPack(SOCK *s); -PACK *RecvPackWithHash(SOCK *s); -bool SendPackWithHash(SOCK *s, PACK *p); - -UINT GetErrorFromPack(PACK *p); -PACK *PackError(UINT error); - -void CreateDummyValue(PACK *p); - -char *RecvLine(SOCK *s, UINT max_size); - -bool GetIPViaDnsProxyForJapanFlets(IP *ip_ret, char *hostname, bool ipv6, UINT timeout, bool *cancel, char *dns_proxy_hostname); -bool GetDnsProxyIPAddressForJapanBFlets(IP *ip_ret, UINT timeout, bool *cancel); -BUF *QueryFileByUdpForJapanBFlets(UINT timeout, bool *cancel); -BUF *QueryFileByIPv6Udp(LIST *ip_list, UINT timeout, bool *cancel); -UINT DetectFletsType(); - -void ListenTcpForPopupFirewallDialog(); - -bool DetectIsServerSoftEtherVPN(SOCK *s); -void ConnectThreadForTcp(THREAD *thread, void *param); -void ConnectThreadForRUDP(THREAD *thread, void *param); -void ConnectThreadForOverDnsOrIcmp(THREAD *thread, void *param); -SOCK *NewRUDPClientNatT(char *svc_name, IP *ip, UINT *error_code, UINT timeout, bool *cancel, char *hint_str, char *target_hostname); -RUDP_STACK *NewRUDPServer(char *svc_name, RUDP_STACK_INTERRUPTS_PROC *proc_interrupts, RUDP_STACK_RPC_RECV_PROC *proc_rpc_recv, void *param, UINT port, bool no_natt_register, bool over_dns_mode, volatile UINT *natt_global_udp_port, UCHAR rand_port_id, IP *listen_ip); -SOCK *NewRUDPClientDirect(char *svc_name, IP *ip, UINT port, UINT *error_code, UINT timeout, bool *cancel, SOCK *sock, SOCK_EVENT *sock_event, UINT local_port, bool over_dns_mode); -RUDP_STACK *NewRUDP(bool server_mode, char *svc_name, RUDP_STACK_INTERRUPTS_PROC *proc_interrupts, RUDP_STACK_RPC_RECV_PROC *proc_rpc_recv, void *param, UINT port, SOCK *sock, SOCK_EVENT *sock_event, bool server_no_natt_register, bool over_dns_mode, IP *client_target_ip, volatile UINT *natt_global_udp_port, UCHAR rand_port_id, IP *listen_ip); -void FreeRUDP(RUDP_STACK *r); -void RUDPMainThread(THREAD *thread, void *param); -void RUDPRecvProc(RUDP_STACK *r, UDPPACKET *p); -void RUDPInterruptProc(RUDP_STACK *r); -void RUDPIpQueryThread(THREAD *thread, void *param); -void RUDPSendPacket(RUDP_STACK *r, IP *dest_ip, UINT dest_port, void *data, UINT size, UINT icmp_type); -void GetCurrentMachineIpProcessHash(void *hash); -void GetCurrentMachineIpProcessHashInternal(void *hash); -int RUDPCompareSessionList(void *p1, void *p2); -RUDP_SESSION *RUDPNewSession(bool server_mode, IP *my_ip, UINT my_port, IP *your_ip, UINT your_port, UCHAR *init_key); -void RUDPFreeSession(RUDP_SESSION *se); -int RUDPCompareSegmentList(void *p1, void *p2); -RUDP_SESSION *RUDPSearchSession(RUDP_STACK *r, IP *my_ip, UINT my_port, IP *your_ip, UINT your_port); -void RUDPSendSegmentNow(RUDP_STACK *r, RUDP_SESSION *se, UINT64 seq_no, void *data, UINT size); -void RUDPSendSegment(RUDP_STACK *r, RUDP_SESSION *se, void *data, UINT size); -bool RUDPProcessRecvPacket(RUDP_STACK *r, RUDP_SESSION *se, void *recv_data, UINT recv_size); -bool RUDPCheckSignOfRecvPacket(RUDP_STACK *r, RUDP_SESSION *se, void *recv_data, UINT recv_size); -void RUDPProcessAck(RUDP_STACK *r, RUDP_SESSION *se, UINT64 seq); -void RUDPProcessAck2(RUDP_STACK *r, RUDP_SESSION *se, UINT64 max_seq); -void RUDPProcessRecvPayload(RUDP_STACK *r, RUDP_SESSION *se, UINT64 seq, void *payload_data, UINT payload_size); -void RUDPInitSock(RUDP_STACK *r, RUDP_SESSION *se); -void RUDPDisconnectSession(RUDP_STACK *r, RUDP_SESSION *se, bool disconnected_by_you); -UINT64 RUDPGetCurrentSendingMinSeqNo(RUDP_SESSION *se); -UINT64 RUDPGetCurrentSendingMaxSeqNo(RUDP_SESSION *se); -SOCK *ListenRUDP(char *svc_name, RUDP_STACK_INTERRUPTS_PROC *proc_interrupts, RUDP_STACK_RPC_RECV_PROC *proc_rpc_recv, void *param, UINT port, bool no_natt_register, bool over_dns_mode); -SOCK *ListenRUDPEx(char *svc_name, RUDP_STACK_INTERRUPTS_PROC *proc_interrupts, RUDP_STACK_RPC_RECV_PROC *proc_rpc_recv, void *param, UINT port, bool no_natt_register, bool over_dns_mode, - volatile UINT *natt_global_udp_port, UCHAR rand_port_id, IP *listen_ip); -SOCK *AcceptRUDP(SOCK *s); -void *InitWaitUntilHostIPAddressChanged(); -void FreeWaitUntilHostIPAddressChanged(void *p); -void WaitUntilHostIPAddressChanged(void *p, EVENT *event, UINT timeout, UINT ip_check_interval); -UINT GetHostIPAddressHash32(); -bool GetMyPrivateIP(IP *ip, bool from_vg); -char *GetRandHostNameForGetMyPrivateIP(); -UINT GenRandInterval(UINT min, UINT max); -void RUDPProcess_NatT_Recv(RUDP_STACK *r, UDPPACKET *udp); -void RUDPDo_NatT_Interrupt(RUDP_STACK *r); -void RUDPGetRegisterHostNameByIP(char *dst, UINT size, IP *ip); -bool RUDPParseIPAndPortStr(void *data, UINT data_size, IP *ip, UINT *port); -void ParseNtUsername(char *src_username, char *dst_username, UINT dst_username_size, char *dst_domain, UINT dst_domain_size, bool do_not_parse_atmark); -void RUDPBulkSend(RUDP_STACK *r, RUDP_SESSION *se, void *data, UINT data_size); -bool RUDPProcessBulkRecvPacket(RUDP_STACK *r, RUDP_SESSION *se, void *recv_data, UINT recv_size); -UINT RUDPCalcBestMssForBulk(RUDP_STACK *r, RUDP_SESSION *se); -bool IsIPLocalHostOrMySelf(IP *ip); -bool RUDPIsIpInValidateList(RUDP_STACK *r, IP *ip); -void RUDPAddIpToValidateList(RUDP_STACK *r, IP *ip); - -bool GetBestLocalIpForTarget(IP *local_ip, IP *target_ip); -SOCK *NewUDP4ForSpecificIp(IP *target_ip, UINT port); - -#ifdef OS_WIN32 - -// Function prototype for Win32 -void Win32InitSocketLibrary(); -void Win32FreeSocketLibrary(); -void Win32Select(SOCKSET *set, UINT timeout, CANCEL *c1, CANCEL *c2); -void Win32InitAsyncSocket(SOCK *sock); -void Win32JoinSockToSockEvent(SOCK *sock, SOCK_EVENT *event); -void Win32FreeAsyncSocket(SOCK *sock); -void Win32IpForwardRowToRouteEntry(ROUTE_ENTRY *entry, void *ip_forward_row); -void Win32RouteEntryToIpForwardRow(void *ip_forward_row, ROUTE_ENTRY *entry); -int Win32CompareRouteEntryByMetric(void *p1, void *p2); -ROUTE_TABLE *Win32GetRouteTable(); -bool Win32AddRouteEntry(ROUTE_ENTRY *e, bool *already_exists); -void Win32DeleteRouteEntry(ROUTE_ENTRY *e); -void Win32UINTToIP(IP *ip, UINT i); -UINT Win32IPToUINT(IP *ip); -UINT Win32GetVLanInterfaceID(char *instance_name); -char **Win32EnumVLan(char *tag_name); -void Win32Cancel(CANCEL *c); -void Win32CleanupCancel(CANCEL *c); -CANCEL *Win32NewCancel(); -SOCK_EVENT *Win32NewSockEvent(); -void Win32SetSockEvent(SOCK_EVENT *event); -void Win32CleanupSockEvent(SOCK_EVENT *event); -bool Win32WaitSockEvent(SOCK_EVENT *event, UINT timeout); -bool Win32GetDefaultDns(IP *ip, char *domain, UINT size); -bool Win32GetDnsSuffix(char *domain, UINT size); -void Win32RenewDhcp9x(UINT if_id); -void Win32ReleaseDhcp9x(UINT if_id, bool wait); -void Win32FlushDnsCache(); -int CompareIpAdapterIndexMap(void *p1, void *p2); -ROUTE_CHANGE *Win32NewRouteChange(); -void Win32FreeRouteChange(ROUTE_CHANGE *r); -bool Win32IsRouteChanged(ROUTE_CHANGE *r); -bool Win32GetAdapterFromGuid(void *a, char *guid); -SOCKET Win32Accept(SOCK *sock, SOCKET s, struct sockaddr *addr, int *addrlen, bool ipv6); - -bool Win32ReleaseAddress(void *a); -bool Win32ReleaseAddressByGuid(char *guid); -bool Win32ReleaseAddressByGuidEx(char *guid, UINT timeout); -void Win32ReleaseAddressByGuidExThread(THREAD *t, void *param); -void ReleaseWin32ReleaseAddressByGuidThreadParam(WIN32_RELEASEADDRESS_THREAD_PARAM *p); -bool Win32ReleaseOrRenewAddressByGuidEx(char *guid, UINT timeout, bool renew); -bool Win32RenewAddress(void *a); -bool Win32RenewAddressByGuid(char *guid); -bool Win32RenewAddressByGuidEx(char *guid, UINT timeout); - - -#else // OS_WIN32 - -// Function prototype for UNIX -void UnixInitSocketLibrary(); -void UnixFreeSocketLibrary(); -void UnixSelect(SOCKSET *set, UINT timeout, CANCEL *c1, CANCEL *c2); -void UnixInitAsyncSocket(SOCK *sock); -void UnixJoinSockToSockEvent(SOCK *sock, SOCK_EVENT *event); -void UnixFreeAsyncSocket(SOCK *sock); -ROUTE_TABLE *UnixGetRouteTable(); -bool UnixAddRouteEntry(ROUTE_ENTRY *e, bool *already_exists); -void UnixDeleteRouteEntry(ROUTE_ENTRY *e); -UINT UnixGetVLanInterfaceID(char *instance_name); -char **UnixEnumVLan(char *tag_name); -void UnixCancel(CANCEL *c); -void UnixCleanupCancel(CANCEL *c); -CANCEL *UnixNewCancel(); -SOCK_EVENT *UnixNewSockEvent(); -void UnixSetSockEvent(SOCK_EVENT *event); -void UnixCleanupSockEvent(SOCK_EVENT *event); -bool UnixWaitSockEvent(SOCK_EVENT *event, UINT timeout); -bool UnixGetDefaultDns(IP *ip); -void UnixNewPipe(int *pipe_read, int *pipe_write); -void UnixWritePipe(int pipe_write); -void UnixDeletePipe(int p1, int p2); -void UnixSelectInner(UINT num_read, UINT *reads, UINT num_write, UINT *writes, UINT timeout); -void UnixSetSocketNonBlockingMode(int fd, bool nonblock); - -#endif // OS_WIN32 - -// Function prototype -void InitNetwork(); -void FreeNetwork(); -void InitDnsCache(); -void FreeDnsCache(); -void LockDnsCache(); -void UnlockDnsCache(); -int CompareDnsCache(void *p1, void *p2); -void GenDnsCacheKeyName(char *dst, UINT size, char *src, bool ipv6); -void NewDnsCacheEx(char *hostname, IP *ip, bool ipv6); -DNSCACHE *FindDnsCacheEx(char *hostname, bool ipv6); -bool QueryDnsCacheEx(IP *ip, char *hostname, bool ipv6); -void NewDnsCache(char *hostname, IP *ip); -DNSCACHE *FindDnsCache(char *hostname); -bool QueryDnsCache(IP *ip, char *hostname); -void InAddrToIP(IP *ip, struct in_addr *addr); -void InAddrToIP6(IP *ip, struct in6_addr *addr); -void IPToInAddr(struct in_addr *addr, IP *ip); -void IPToInAddr6(struct in6_addr *addr, IP *ip); -bool StrToIP(IP *ip, char *str); -UINT StrToIP32(char *str); -UINT UniStrToIP32(wchar_t *str); -void IPToStr(char *str, UINT size, IP *ip); -void IPToStr4(char *str, UINT size, IP *ip); -void IPToStr32(char *str, UINT size, UINT ip); -void IPToStr4or6(char *str, UINT size, UINT ip_4_uint, UCHAR *ip_6_bytes); -void IPToUniStr(wchar_t *str, UINT size, IP *ip); -void IPToUniStr32(wchar_t *str, UINT size, UINT ip); -bool GetIPEx(IP *ip, char *hostname, bool ipv6); -bool GetIP46Ex(IP *ip4, IP *ip6, char *hostname, UINT timeout, bool *cancel); -bool GetIP(IP *ip, char *hostname); -bool GetIP4(IP *ip, char *hostname); -bool GetIP6(IP *ip, char *hostname); -bool GetIP4Ex(IP *ip, char *hostname, UINT timeout, bool *cancel); -bool GetIP6Ex(IP *ip, char *hostname, UINT timeout, bool *cancel); -bool GetIP4Ex6Ex(IP *ip, char *hostname, UINT timeout, bool ipv6, bool *cancel); -bool GetIP4Ex6Ex2(IP *ip, char *hostname, UINT timeout, bool ipv6, bool *cancel, bool only_direct_dns); -void GetIP4Ex6ExThread(THREAD *t, void *param); -void ReleaseGetIPThreadParam(GETIP_THREAD_PARAM *p); -void CleanupGetIPThreadParam(GETIP_THREAD_PARAM *p); -bool GetIP4Inner(IP *ip, char *hostname); -bool GetIP6Inner(IP *ip, char *hostname); -bool GetHostNameInner(char *hostname, UINT size, IP *ip); -bool GetHostNameInner6(char *hostname, UINT size, IP *ip); -bool GetHostName(char *hostname, UINT size, IP *ip); -void GetHostNameThread(THREAD *t, void *p); -void GetMachineName(char *name, UINT size); -void GetMachineNameEx(char *name, UINT size, bool no_load_hosts); -bool GetMachineNameFromHosts(char *name, UINT size); -void GetMachineHostName(char *name, UINT size); -void UINTToIP(IP *ip, UINT value); -UINT IPToUINT(IP *ip); -SOCK *NewSock(); -void ReleaseSock(SOCK *s); -void CleanupSock(SOCK *s); -SOCK *Connect(char *hostname, UINT port); -SOCK *ConnectEx(char *hostname, UINT port, UINT timeout); -SOCK *ConnectEx2(char *hostname, UINT port, UINT timeout, bool *cancel_flag); -SOCK *ConnectEx3(char *hostname, UINT port, UINT timeout, bool *cancel_flag, char *nat_t_svc_name, UINT *nat_t_error_code, bool try_start_ssl, bool no_get_hostname); -SOCK *ConnectEx4(char *hostname, UINT port, UINT timeout, bool *cancel_flag, char *nat_t_svc_name, UINT *nat_t_error_code, bool try_start_ssl, bool no_get_hostname, IP *ret_ip); -SOCKET ConnectTimeoutIPv4(IP *ip, UINT port, UINT timeout, bool *cancel_flag); -bool SetSocketBufferSize(SOCKET s, bool send, UINT size); -UINT SetSocketBufferSizeWithBestEffort(SOCKET s, bool send, UINT size); -void InitUdpSocketBufferSize(SOCKET s); -void QuerySocketInformation(SOCK *sock); -bool SetTtl(SOCK *sock, UINT ttl); -void Disconnect(SOCK *sock); -SOCK *Listen(UINT port); -SOCK *ListenEx(UINT port, bool local_only); -SOCK *ListenEx2(UINT port, bool local_only, bool enable_ca, IP *listen_ip); -SOCK *ListenEx6(UINT port, bool local_only); -SOCK *ListenEx62(UINT port, bool local_only, bool enable_ca); -SOCK *Accept(SOCK *sock); -SOCK *Accept6(SOCK *sock); -UINT Send(SOCK *sock, void *data, UINT size, bool secure); -UINT Recv(SOCK *sock, void *data, UINT size, bool secure); -UINT Peek(SOCK *sock, void *data, UINT size); -void SetNoNeedToRead(SOCK *sock); -UINT SecureSend(SOCK *sock, void *data, UINT size); -UINT SecureRecv(SOCK *sock, void *data, UINT size); -bool StartSSL(SOCK *sock, X *x, K *priv); -bool StartSSLEx(SOCK *sock, X *x, K *priv, UINT ssl_timeout, char *sni_hostname); -bool AddChainSslCert(struct ssl_ctx_st *ctx, X *x); -void AddChainSslCertOnDirectory(struct ssl_ctx_st *ctx); -bool SendAll(SOCK *sock, void *data, UINT size, bool secure); -void SendAdd(SOCK *sock, void *data, UINT size); -bool SendNow(SOCK *sock, int secure); -bool RecvAll(SOCK *sock, void *data, UINT size, bool secure); -bool RecvAllEx(SOCK *sock, void **data_new_ptr, UINT size, bool secure); -bool RecvAllWithDiscard(SOCK *sock, UINT size, bool secure); -void InitSockSet(SOCKSET *set); -void AddSockSet(SOCKSET *set, SOCK *sock); -CANCEL *NewCancel(); -CANCEL *NewCancelSpecial(void *hEvent); -void ReleaseCancel(CANCEL *c); -void CleanupCancel(CANCEL *c); -void Cancel(CANCEL *c); -void Select(SOCKSET *set, UINT timeout, CANCEL *c1, CANCEL *c2); -void SetWantToUseCipher(SOCK *sock, char *name); -SOCK *NewUDP(UINT port); -SOCK *NewUDPEx(UINT port, bool ipv6); -SOCK *NewUDPEx2(UINT port, bool ipv6, IP *ip); -SOCK *NewUDPEx3(UINT port, IP *ip); -SOCK *NewUDP4(UINT port, IP *ip); -SOCK *NewUDP6(UINT port, IP *ip); -SOCK *NewUDPEx2Rand(bool ipv6, IP *ip, void *rand_seed, UINT rand_seed_size, UINT num_retry); -SOCK *NewUDPEx2RandMachineAndExePath(bool ipv6, IP *ip, UINT num_retry, UCHAR rand_port_id); -void ClearSockDfBit(SOCK *s); -void SetRawSockHeaderIncludeOption(SOCK *s, bool enable); -UINT SendTo(SOCK *sock, IP *dest_addr, UINT dest_port, void *data, UINT size); -UINT SendToEx(SOCK *sock, IP *dest_addr, UINT dest_port, void *data, UINT size, bool broadcast); -UINT SendTo6Ex(SOCK *sock, IP *dest_addr, UINT dest_port, void *data, UINT size, bool broadcast); -UINT RecvFrom(SOCK *sock, IP *src_addr, UINT *src_port, void *data, UINT size); -UINT RecvFrom6(SOCK *sock, IP *src_addr, UINT *src_port, void *data, UINT size); -void SetTimeout(SOCK *sock, UINT timeout); -UINT GetTimeout(SOCK *sock); -bool CheckTCPPort(char *hostname, UINT port); -bool CheckTCPPortEx(char *hostname, UINT port, UINT timeout); -ROUTE_TABLE *GetRouteTable(); -void FreeRouteTable(ROUTE_TABLE *t); -bool AddRouteEntryEx(ROUTE_ENTRY *e, bool *already_exists); -bool AddRouteEntry(ROUTE_ENTRY *e); -void DeleteRouteEntry(ROUTE_ENTRY *e); -char **EnumVLan(char *tag_name); -void FreeEnumVLan(char **s); -UINT GetVLanInterfaceID(char *tag_name); -ROUTE_ENTRY *GetBestRouteEntry(IP *ip); -ROUTE_ENTRY *GetBestRouteEntryEx(IP *ip, UINT exclude_if_id); -ROUTE_ENTRY *GetBestRouteEntryFromRouteTableEx(ROUTE_TABLE *table, IP *ip, UINT exclude_if_id); -void FreeRouteEntry(ROUTE_ENTRY *e); -void JoinSockToSockEvent(SOCK *sock, SOCK_EVENT *event); -SOCK_EVENT *NewSockEvent(); -void SetSockEvent(SOCK_EVENT *event); -void CleanupSockEvent(SOCK_EVENT *event); -bool WaitSockEvent(SOCK_EVENT *event, UINT timeout); -void ReleaseSockEvent(SOCK_EVENT *event); -void SetIP(IP *ip, UCHAR a1, UCHAR a2, UCHAR a3, UCHAR a4); -UINT SetIP32(UCHAR a1, UCHAR a2, UCHAR a3, UCHAR a4); -bool GetDefaultDns(IP *ip); -bool GetDomainName(char *name, UINT size); -bool UnixGetDomainName(char *name, UINT size); -void AcceptInit(SOCK *s); -void AcceptInitEx(SOCK *s, bool no_lookup_hostname); -void DisableGetHostNameWhenAcceptInit(); -TOKEN_LIST *GetCipherList(); -COUNTER *GetNumTcpConnectionsCounter(); -void InitWaitThread(); -void FreeWaitThread(); -void AddWaitThread(THREAD *t); -void DelWaitThread(THREAD *t); -void InitHostCache(); -void FreeHostCache(); -int CompareHostCache(void *p1, void *p2); -void AddHostCache(IP *ip, char *hostname); -bool GetHostCache(char *hostname, UINT size, IP *ip); -bool IsSubnetMask(IP *ip); -bool IsSubnetMask4(IP *ip); -bool IsSubnetMask32(UINT ip); -bool IsNetworkAddress4(IP *ip, IP *mask); -bool IsNetworkAddress32(UINT ip, UINT mask); -bool IsHostIPAddress4(IP *ip); -bool IsHostIPAddress32(UINT ip); -bool IsZeroIp(IP *ip); -bool IsZeroIP(IP *ip); -bool IsZeroIP6Addr(IPV6_ADDR *addr); -UINT IntToSubnetMask32(UINT i); -void IntToSubnetMask4(IP *ip, UINT i); -bool GetNetBiosName(char *name, UINT size, IP *ip); -bool NormalizeMacAddress(char *dst, UINT size, char *src); -SOCKLIST *NewSockList(); -void StopSockList(SOCKLIST *sl); -void FreeSockList(SOCKLIST *sl); -bool IsIPv6Supported(); -void SetSockTos(SOCK *s, int tos); -void SetSockHighPriority(SOCK *s, bool flag); -void InitIpClientList(); -void FreeIpClientList(); -int CompareIpClientList(void *p1, void *p2); -void AddIpClient(IP *ip); -void DelIpClient(IP *ip); -IP_CLIENT *SearchIpClient(IP *ip); -UINT GetNumIpClient(IP *ip); -void SetLinuxArpFilter(); -int connect_timeout(SOCKET s, struct sockaddr *addr, int size, int timeout, bool *cancel_flag); -void EnableNetworkNameCache(); -void DisableNetworkNameCache(); -bool IsNetworkNameCacheEnabled(); -ROUTE_CHANGE *NewRouteChange(); -void FreeRouteChange(ROUTE_CHANGE *r); -bool IsRouteChanged(ROUTE_CHANGE *r); -void RouteToStr(char *str, UINT str_size, ROUTE_ENTRY *e); -void DebugPrintRoute(ROUTE_ENTRY *e); -void DebugPrintRouteTable(ROUTE_TABLE *r); -bool IsIPv6LocalNetworkAddress(IP *ip); -void AddProtocolDetailsStr(char *dst, UINT dst_size, char *str); -void AddProtocolDetailsKeyValueStr(char *dst, UINT dst_size, char *key, char *value); -void AddProtocolDetailsKeyValueInt(char *dst, UINT dst_size, char *key, UINT value); - -#ifdef ENABLE_SSL_LOGGING -void SockEnableSslLogging(SOCK *s); -void SockWriteSslLog(SOCK *s, void *send_data, UINT send_size, void *recv_data, UINT recv_size); -void SockCloseSslLogging(SOCK *s); -#endif // ENABLE_SSL_LOGGING - -void SocketTimeoutThread(THREAD *t, void *param); -SOCKET_TIMEOUT_PARAM *NewSocketTimeout(SOCK *sock); -void FreeSocketTimeout(SOCKET_TIMEOUT_PARAM *ttp); - -void CopyIP(IP *dst, IP *src); -bool IsIP6(IP *ip); -bool IsIP4(IP *ip); -void IPv6AddrToIP(IP *ip, IPV6_ADDR *addr); -bool IPToIPv6Addr(IPV6_ADDR *addr, IP *ip); -void SetIP6(IP *ip, UCHAR *value); -void GetLocalHostIP6(IP *ip); -void GetLocalHostIP4(IP *ip); -bool IsLocalHostIP6(IP *ip); -bool IsLocalHostIP4(IP *ip); -bool IsLocalHostIP(IP *ip); -void ZeroIP6(IP *ip); -void ZeroIP4(IP *ip); -bool CheckIPItemStr6(char *str); -void IPItemStrToChars6(UCHAR *chars, char *str); -bool StrToIP6(IP *ip, char *str); -bool StrToIP6Addr(IPV6_ADDR *ip, char *str); -void IPToStr6(char *str, UINT size, IP *ip); -void IP6AddrToStr(char *str, UINT size, IPV6_ADDR *addr); -void IPToStr6Array(char *str, UINT size, UCHAR *bytes); -void IPToStr6Inner(char *str, IP *ip); -void IntToSubnetMask6(IP *ip, UINT i); -void IPAnd6(IP *dst, IP *a, IP *b); -void GetAllRouterMulticastAddress6(IP *ip); -void GetAllNodeMulticaseAddress6(IP *ip); -void GetLoopbackAddress6(IP *ip); -UINT GetIPAddrType6(IP *ip); -UINT GetIPv6AddrType(IPV6_ADDR *addr); -void GetPrefixAddress6(IP *dst, IP *ip, IP *subnet); -bool IsInSameNetwork6(IP *a1, IP *a2, IP *subnet); -bool IsInSameNetwork6ByStr(char *ip1, char *ip2, char *subnet); -void GenerateEui64Address6(UCHAR *dst, UCHAR *mac); -void GenerateEui64LocalAddress(IP *a, UCHAR *mac); -bool IsSubnetMask6(IP *a); -UINT SubnetMaskToInt(IP *a); -UINT SubnetMaskToInt6(IP *a); -UINT SubnetMaskToInt4(IP *a); -bool IsStrIPv6Address(char *str); -void IPAnd4(IP *dst, IP *a, IP *b); -bool IsInSameNetwork4(IP *a1, IP *a2, IP *subnet); -bool IsInSameNetwork4Standard(IP *a1, IP *a2); - -// Utility functions about IP and MAC address types -bool IsValidUnicastIPAddress4(IP *ip); -bool IsValidUnicastIPAddressUINT4(UINT ip); -bool IsValidUnicastIPAddress6(IP *ip); -bool IsMacUnicast(UCHAR *mac); -bool IsMacBroadcast(UCHAR *mac); -bool IsMacMulticast(UCHAR *mac); -bool IsMacInvalid(UCHAR *mac); - -bool ParseIpAndSubnetMask4(char *src, UINT *ip, UINT *mask); -bool ParseIpAndSubnetMask46(char *src, IP *ip, IP *mask); -bool ParseIpAndMask4(char *src, UINT *ip, UINT *mask); -bool ParseIpAndMask6(char *src, IP *ip, IP *mask); -bool ParseIpAndMask46(char *src, IP *ip, IP *mask); -bool IsIpStr4(char *str); -bool IsIpStr6(char *str); -bool IsIpMask6(char *str); -bool StrToMask6(IP *mask, char *str); -bool StrToMask6Addr(IPV6_ADDR *mask, char *str); -void MaskToStr(char *str, UINT size, IP *mask); -void Mask6AddrToStrEx(char *str, UINT size, IPV6_ADDR *mask, bool always_full_address); -void Mask6AddrToStr(char *str, UINT size, IPV6_ADDR *mask); -void MaskToStr32(char *str, UINT size, UINT mask); -void MaskToStr32Ex(char *str, UINT size, UINT mask, bool always_full_address); -void MaskToStrEx(char *str, UINT size, IP *mask, bool always_full_address); - -TUBEDATA *NewTubeData(void *data, UINT size, void *header, UINT header_size); -void FreeTubeData(TUBEDATA *d); -TUBE *NewTube(UINT size_of_header); -void ReleaseTube(TUBE *t); -void CleanupTube(TUBE *t); -bool TubeSend(TUBE *t, void *data, UINT size, void *header); -bool TubeSendEx(TUBE *t, void *data, UINT size, void *header, bool no_flush); -bool TubeSendEx2(TUBE *t, void *data, UINT size, void *header, bool no_flush, UINT max_num_in_queue); -void TubeFlush(TUBE *t); -void TubeFlushEx(TUBE *t, bool force); -TUBEDATA *TubeRecvAsync(TUBE *t); -TUBEDATA *TubeRecvSync(TUBE *t, UINT timeout); -TUBEPAIR_DATA *NewTubePairData(); -void ReleaseTubePairData(TUBEPAIR_DATA *d); -void CleanupTubePairData(TUBEPAIR_DATA *d); -void NewTubePair(TUBE **t1, TUBE **t2, UINT size_of_header); -void TubeDisconnect(TUBE *t); -bool IsTubeConnected(TUBE *t); -void SetTubeSockEvent(TUBE *t, SOCK_EVENT *e); -SOCK_EVENT *GetTubeSockEvent(TUBE *t); - -TUBE_FLUSH_LIST *NewTubeFlushList(); -void FreeTubeFlushList(TUBE_FLUSH_LIST *f); -void AddTubeToFlushList(TUBE_FLUSH_LIST *f, TUBE *t); -void FlushTubeFlushList(TUBE_FLUSH_LIST *f); - -LIST *GetHostIPAddressListInternal(); -LIST *GetHostIPAddressList(); -LIST *CloneIPAddressList(LIST *o); -bool IsMyIPAddress(IP *ip); -void FreeHostIPAddressList(LIST *o); -void AddHostIPAddressToList(LIST *o, IP *ip); -int CmpIpAddressList(void *p1, void *p2); -UINT64 GetHostIPAddressListHash(); - -UDPLISTENER *NewUdpListener(UDPLISTENER_RECV_PROC *recv_proc, void *param, IP *listen_ip); -UDPLISTENER *NewUdpListenerEx(UDPLISTENER_RECV_PROC *recv_proc, void *param, IP *listen_ip, UINT packet_type); -void UdpListenerThread(THREAD *thread, void *param); -void StopUdpListener(UDPLISTENER *u); -void FreeUdpListener(UDPLISTENER *u); -void AddPortToUdpListener(UDPLISTENER *u, UINT port); -void DeletePortFromUdpListener(UDPLISTENER *u, UINT port); -void DeleteAllPortFromUdpListener(UDPLISTENER *u); -void UdpListenerSendPackets(UDPLISTENER *u, LIST *packet_list); -TCP_RAW_DATA *NewTcpRawData(IP *src_ip, UINT src_port, IP *dst_ip, UINT dst_port); -void FreeTcpRawData(TCP_RAW_DATA *trd); -UDPPACKET *NewUdpPacket(IP *src_ip, UINT src_port, IP *dst_ip, UINT dst_port, void *data, UINT size); -void FreeUdpPacket(UDPPACKET *p); -UDPLISTENER_SOCK *DetermineUdpSocketForSending(UDPLISTENER *u, UDPPACKET *p); -bool IsUdpPortOpened(UDPLISTENER *u, IP *server_ip, UINT port); - -INTERRUPT_MANAGER *NewInterruptManager(); -void FreeInterruptManager(INTERRUPT_MANAGER *m); -void AddInterrupt(INTERRUPT_MANAGER *m, UINT64 tick); -UINT GetNextIntervalForInterrupt(INTERRUPT_MANAGER *m); - -void NewSocketPair(SOCK **client, SOCK **server, IP *client_ip, UINT client_port, IP *server_ip, UINT server_port); -SOCK *NewInProcSocket(TUBE *tube_send, TUBE *tube_recv); -SOCK *ListenInProc(); -SOCK *AcceptInProc(SOCK *s); -SOCK *ConnectInProc(SOCK *listen_sock, IP *client_ip, UINT client_port, IP *server_ip, UINT server_port); -UINT SendInProc(SOCK *sock, void *data, UINT size); -UINT RecvInProc(SOCK *sock, void *data, UINT size); -void WaitForTubes(TUBE **tubes, UINT num, UINT timeout); - -SOCK *ListenReverse(); -SOCK *AcceptReverse(SOCK *s); -void InjectNewReverseSocketToAccept(SOCK *listen_sock, SOCK *s, IP *client_ip, UINT client_port); - -bool NewTcpPair(SOCK **s1, SOCK **s2); -SOCK *ListenAnyPortEx2(bool local_only, bool disable_ca); - -bool IsIcmpApiSupported(); -ICMP_RESULT *IcmpApiEchoSend(IP *dest_ip, UCHAR ttl, UCHAR *data, UINT size, UINT timeout); -void IcmpApiFreeResult(ICMP_RESULT *ret); - -#ifdef OS_WIN32 -void Win32WaitForTubes(TUBE **tubes, UINT num, UINT timeout); -#else // OS_WIN32 -void UnixWaitForTubes(TUBE **tubes, UINT num, UINT timeout); -#endif // OS_WIN32 - -#define PREVERIFY_ERR_MESSAGE_SIZE 100 -// Info on client certificate collected during TLS handshake -struct SslClientCertInfo { - int PreverifyErr; - char PreverifyErrMessage[PREVERIFY_ERR_MESSAGE_SIZE]; - X *X; -}; - -SSL_PIPE *NewSslPipe(bool server_mode, X *x, K *k, DH_CTX *dh); -SSL_PIPE *NewSslPipeEx(bool server_mode, X *x, K *k, DH_CTX *dh, bool verify_peer, struct SslClientCertInfo *clientcert); -void FreeSslPipe(SSL_PIPE *s); -bool SyncSslPipe(SSL_PIPE *s); - -SSL_BIO *NewSslBioMem(); -SSL_BIO *NewSslBioSsl(); -void FreeSslBio(SSL_BIO *b); -bool SslBioSync(SSL_BIO *b, bool sync_send, bool sync_recv); - -void SetCurrentGlobalIP(IP *ip, bool ipv6); -bool GetCurrentGlobalIP(IP *ip, bool ipv6); -void GetCurrentGlobalIPGuess(IP *ip, bool ipv6); -bool IsIPAddressInSameLocalNetwork(IP *a); - -bool IsIPPrivate(IP *ip); -bool IsIPMyHost(IP *ip); -void LoadPrivateIPFile(); -bool IsOnPrivateIPFile(UINT ip); -void FreePrivateIPFile(); - -LIST *GetNicList(); -void FreeNicList(LIST *o); -bool IsMacAddressLocalInner(LIST *o, void *addr); -bool IsMacAddressLocalFast(void *addr); -void RefreshLocalMacAddressList(); - -struct ssl_ctx_st *NewSSLCtx(bool server_mode); -void FreeSSLCtx(struct ssl_ctx_st *ctx); -UINT GetOSSecurityLevel(); - -void SetCurrentDDnsFqdn(char *name); -void GetCurrentDDnsFqdn(char *name, UINT size); -UINT GetCurrentDDnsFqdnHash(); - -void DisableRDUPServerGlobally(); - -void QueryIpThreadMain(THREAD *thread, void *param); -QUERYIPTHREAD *NewQueryIpThread(char *hostname, UINT interval_last_ok, UINT interval_last_ng); -bool GetQueryIpThreadResult(QUERYIPTHREAD *t, IP *ip); -void FreeQueryIpThread(QUERYIPTHREAD *t); - -void SetGetIpThreadMaxNum(UINT num); -UINT GetGetIpThreadMaxNum(); -UINT GetCurrentGetIpThreadNum(); - -#ifdef OS_WIN32 -LIST *Win32GetNicList(); -#endif // OS_WIN32 - - -void InitDynList(); -void FreeDynList(); -void AddDynList(BUF *b); -void ExtractAndApplyDynList(PACK *p); -void SetDynListValue(char *name, UINT64 value); -UINT64 GetDynValue(char *name); -UINT64 GetDynValueOrDefault(char *name, UINT64 default_value, UINT64 min_value, UINT64 max_value); -UINT64 GetDynValueOrDefaultSafe(char *name, UINT64 default_value); - - -#endif // NETWORK_H - +// SoftEther VPN Source Code - Developer Edition Master Branch +// Mayaqua Kernel + + +// Network.h +// Header of Network.c + +#ifndef NETWORK_H +#define NETWORK_H + +// Dynamic Value +struct DYN_VALUE +{ + char Name[256]; // Name + UINT64 Value; // Value +}; + +#define DYN64(id, default_value) ( (UINT64)GetDynValueOrDefaultSafe ( #id , (UINT64)( default_value ))) +#define DYN32(id, default_value) (UINT)DYN64(id, (UINT)default_value) + +#define MAX_HOST_NAME_LEN 255 // Maximum length of the host name + +#define TIMEOUT_GETIP 2300 + +#define TIMEOUT_INFINITE (0x7fffffff) +#define TIMEOUT_TCP_PORT_CHECK (10 * 1000) +#define TIMEOUT_SSL_CONNECT (15 * 1000) + +#define TIMEOUT_HOSTNAME (500) +#define TIMEOUT_NETBIOS_HOSTNAME (100) +#define EXPIRES_HOSTNAME (10 * 60 * 1000) + +#define SOCKET_BUFFER_SIZE 0x10000000 + +#define IPV6_DUMMY_FOR_IPV4 0xFEFFFFDF + +#define UDPLISTENER_CHECK_INTERVAL 1000ULL +#define UDPLISTENER_WAIT_INTERVAL 1234 + +#define UDP_MAX_MSG_SIZE_DEFAULT 65507 + +#define MAX_NUM_IGNORE_ERRORS 1024 + +#ifndef USE_STRATEGY_LOW_MEMORY +#define DEFAULT_GETIP_THREAD_MAX_NUM 512 +#else // USE_STRATEGY_LOW_MEMORY +#define DEFAULT_GETIP_THREAD_MAX_NUM 64 +#endif // USE_STRATEGY_LOW_MEMORY + +#define DEFAULT_CIPHER_LIST "ECDHE+AESGCM:ECDHE+CHACHA20:DHE+AESGCM:DHE+CHACHA20:ECDHE+AES256:DHE+AES256:RSA+AES" + +// SSL logging function +//#define ENABLE_SSL_LOGGING +#define SSL_LOGGING_DIRNAME "@ssl_log" + +// Private IP list file +#define PRIVATE_IP_TXT_FILENAME "$private_ip.txt" + +// Start range of the random UDP port +#define RAND_UDP_PORT_START 5000 +#define RAND_UDP_PORT_END 65530 +#define RAND_UDP_PORT_DEFAULT_NUM_RETRY 64 + +// Special Port +#define MAKE_SPECIAL_PORT(p) (UINT)((UINT)0x10000 | (UINT)(p)) +#define IS_SPECIAL_PORT(p) (MAKEBOOL((p) & (UINT)0x10000)) +#define GET_SPECIAL_PORT(p) (UINT)((UINT)(p) & (UINT)0xffff) + +// Random R-UDP port ID +#define RAND_PORT_ID_SERVER_LISTEN 1 + +// UDP buffer size +#define UDP_MAX_BUFFER_SIZE 11911168 + +// Expiration of the cache acquired from the IP address list of the host +#define HOST_IP_ADDRESS_LIST_CACHE (5 * 1000) + +// IP address +struct IP +{ + UCHAR addr[4]; // IPv4 address, (meaning that 192.0.2.254 = IPv6) + UCHAR ipv6_addr[16]; // IPv6 address + UINT ipv6_scope_id; // IPv6 scope ID +}; + +// Size when comparing the IP structures only in the address part +#define SIZE_OF_IP_FOR_ADDR (sizeof(UCHAR) * 20) + +// Compare the IP address part +#define CmpIpAddr(ip1, ip2) (Cmp((ip1), (ip2), SIZE_OF_IP_FOR_ADDR)) + +// IPv6 address (different format) +struct IPV6_ADDR +{ + UCHAR Value[16]; // Value +} GCC_PACKED; + +// IPv6 Address Types +#define IPV6_ADDR_UNICAST 1 // Unicast +#define IPV6_ADDR_LOCAL_UNICAST 2 // Local unicast +#define IPV6_ADDR_GLOBAL_UNICAST 4 // Global Unicast +#define IPV6_ADDR_MULTICAST 8 // Multicast +#define IPV6_ADDR_ALL_NODE_MULTICAST 16 // All-nodes multicast +#define IPV6_ADDR_ALL_ROUTER_MULTICAST 32 // All routers multicast +#define IPV6_ADDR_SOLICIATION_MULTICAST 64 // Solicited-node multicast +#define IPV6_ADDR_ZERO 128 // All zeros +#define IPV6_ADDR_LOOPBACK 256 // Loop-back + + +// DNS cache list +struct DNSCACHE +{ + char *HostName; + IP IpAddress; +}; + +// Client list +struct IP_CLIENT +{ + IP IpAddress; // IP address + UINT NumConnections; // The number of connections +}; + +// Socket event +struct SOCK_EVENT +{ + REF *ref; // Reference counter +#ifdef OS_WIN32 + void *hEvent; // Pointer to a Win32 event handle +#else // OS_WIN32 + LIST *SockList; // Socket list + int pipe_read, pipe_write; // Pipe + UINT current_pipe_data; // Amount of data in the current pipe +#endif // OS_WIN32 +}; + +// Type of socket +#define SOCK_TCP 1 +#define SOCK_UDP 2 +#define SOCK_INPROC 3 +#define SOCK_RUDP_LISTEN 5 +#define SOCK_REVERSE_LISTEN 6 + +// SSL Accept Settings +struct SSL_ACCEPT_SETTINGS +{ + bool Tls_Disable1_0; + bool Tls_Disable1_1; + bool Tls_Disable1_2; + bool Tls_Disable1_3; + bool Override_Security_Level; + UINT Override_Security_Level_Value; +}; + +// Socket +struct SOCK +{ + REF *ref; // Reference counter + LOCK *lock; // Lock + LOCK *ssl_lock; // Lock related to the SSL + LOCK *disconnect_lock; // Disconnection lock + SOCKET socket; // Socket number + SSL *ssl; // SSL object + struct ssl_ctx_st *ssl_ctx; // SSL_CTX + char SniHostname[256]; // SNI host name + UINT Type; // Type of socket + bool Connected; // Connecting flag + bool ServerMode; // Server mode + bool AsyncMode; // Asynchronous mode + bool SecureMode; // SSL communication mode + bool ListenMode; // In listening + BUF *SendBuf; // Transmission buffer + bool IpClientAdded; // Whether it has been added to the list IP_CLIENT + bool LocalOnly; // Only local + bool EnableConditionalAccept; // Conditional Accept is Enabled + IP RemoteIP; // IP address of the remote host + IP LocalIP; // IP address of the local host + char *RemoteHostname; // Remote host name + UINT RemotePort; // Port number of the remote side + UINT LocalPort; // Port number of the local side + UINT64 SendSize; // Total size of the sent data + UINT64 RecvSize; // Total size of received data + UINT64 SendNum; // Number of sent data blocks + UINT64 RecvNum; // Number of received data blocks + X *RemoteX; // Certificate of the remote host + X *LocalX; // Certificate of the local host + char *CipherName; // Cipher algorithm name + char *WaitToUseCipher; // Set the algorithm name to want to use + bool IgnoreRecvErr; // Whether the RecvFrom error is ignorable + bool IgnoreSendErr; // Whether the SendTo error is ignorable + UINT TimeOut; // Time-out value + SOCK_EVENT *SockEvent; // Associated socket-event + bool CancelAccept; // Cancel flag of the Accept + bool AcceptCanceled; // Flag which shows canceling of the Accept + bool WriteBlocked; // Previous write is blocked + bool NoNeedToRead; // Is not required to read + bool Disconnecting; // Disconnecting + bool UdpBroadcast; // UDP broadcast mode + void *Param; // Any parameters + bool IPv6; // IPv6 + bool IsRawSocket; // Whether it is a raw socket + const char *SslVersion; // SSL version + UINT RawSocketIPProtocol; // IP protocol number if it's a raw socket + TUBE *SendTube; // Tube for transmission + TUBE *RecvTube; // Tube for reception + QUEUE *InProcAcceptQueue; // Accept queue of the in-process socket + EVENT *InProcAcceptEvent; // Accept event of the in-process socket + FIFO *InProcRecvFifo; // Receive FIFO of the in-process socket + UINT UdpMaxMsgSize; // Maximum transmitting and receiving size at a time on UDP + int CurrentTos; // Current ToS value + bool IsTtlSupported; // Whether the TTL value is supported + UINT CurrentTtl; // Current TTL value + RUDP_STACK *R_UDP_Stack; // R-UDP stack + char UnderlayProtocol[64]; // Underlying protocol + char ProtocolDetails[256]; // Protocol details + QUEUE *ReverseAcceptQueue; // Accept queue for the reverse socket + EVENT *ReverseAcceptEvent; // Accept event for the reverse socket + bool IsReverseAcceptedSocket; // Whether it is a reverse socket + IP Reverse_MyServerGlobalIp; // Self global IP address when using the reverse socket + UINT Reverse_MyServerPort; // Self port number when using the reverse socket + UCHAR Ssl_Init_Async_SendAlert[2]; // Initial state of SSL send_alert + SSL_ACCEPT_SETTINGS SslAcceptSettings; // SSL Accept Settings + bool RawIP_HeaderIncludeFlag; + +#ifdef ENABLE_SSL_LOGGING + // SSL Logging (for debug) + bool IsSslLoggingEnabled; // Flag + IO *SslLogging_Recv; // for Recv + IO *SslLogging_Send; // for Send + LOCK *SslLogging_Lock; // Locking +#endif // ENABLE_SSL_LOGGING + + void *hAcceptEvent; // Event for Accept + + // R-UDP socket related + bool IsRUDPSocket; // Whether this is R-UDP socket + TUBE *BulkSendTube; // Tube for Bulk send + TUBE *BulkRecvTube; // Tube for Bulk receive + SHARED_BUFFER *BulkSendKey; // Bulk send key + SHARED_BUFFER *BulkRecvKey; // Bulk receive key + UINT RUDP_OptimizedMss; // Optimal MSS value + +#ifdef OS_UNIX + pthread_t CallingThread; // Thread that is calling the system call +#endif // OS_UNIX + +#ifdef OS_WIN32 + void *hEvent; // Event for asynchronous mode +#endif // OS_WIN32 +}; + +// Underlying protocol description string of socket +#define SOCK_UNDERLAY_NATIVE_V6 "Standard TCP/IP (IPv6)" +#define SOCK_UNDERLAY_NATIVE_V4 "Standard TCP/IP (IPv4)" +#define SOCK_UNDERLAY_NAT_T "VPN over UDP with NAT-T (IPv4)" +#define SOCK_UNDERLAY_DNS "VPN over DNS (IPv4)" +#define SOCK_UNDERLAY_ICMP "VPN over ICMP (IPv4)" +#define SOCK_UNDERLAY_INPROC "In-Process Pipe" +#define SOCK_UNDERLAY_INPROC_EX "Legacy VPN - %s" +#define SOCK_UNDERLAY_AZURE "TCP/IP via VPN Azure (IPv4)" + +// Constant of the return value +#define SOCK_LATER (0xffffffff) // In blocking + +// Socket Set +#define MAX_SOCKSET_NUM 60 // Number of sockets that can be stored in a socket set +struct SOCKSET +{ + UINT NumSocket; // The number of sockets + SOCK *Sock[MAX_SOCKSET_NUM]; // Array of pointers to the socket +}; + +// Cancel object +struct CANCEL +{ + REF *ref; // Reference counter + bool SpecialFlag; // Special flag (associated to the event which is generated by Win32 driver) +#ifdef OS_WIN32 + void *hEvent; // Pointer to a Win32 event handle +#else // OS_WIN32 + int pipe_read, pipe_write; // Pipe + int pipe_special_read2, pipe_special_read3; +#endif // OS_WIN32 +}; + +// Routing table entry +struct ROUTE_ENTRY +{ + IP DestIP; + IP DestMask; + IP GatewayIP; + bool LocalRouting; + bool PPPConnection; + UINT Metric; + UINT OldIfMetric; + UINT InterfaceID; + UINT64 InnerScore; +}; + +// Routing table +struct ROUTE_TABLE +{ + UINT NumEntry; + UINT HashedValue; + ROUTE_ENTRY **Entry; +}; + +// ICMP response result +struct ICMP_RESULT +{ + bool Ok; // Whether a correct response returned + bool Timeout; // Whether a time-out is occurred + UCHAR Type; // Message type + UCHAR Code; // Message code + UCHAR Ttl; // TTL + UCHAR *Data; // Data body + UINT DataSize; // Data size + UINT Rtt; // Round Trip Time + IP IpAddress; // IP address +}; + + +// Host name cache list +typedef struct HOSTCACHE +{ + UINT64 Expires; // Expiration + IP IpAddress; // IP address + char HostName[256]; // Host name +} HOSTCACHE; + +// NETBIOS name requests +typedef struct NBTREQUEST +{ + USHORT TransactionId; + USHORT Flags; + USHORT NumQuestions; + USHORT AnswerRRs; + USHORT AuthorityRRs; + USHORT AdditionalRRs; + UCHAR Query[38]; +} NBTREQUEST; + +// NETBIOS name response +typedef struct NBTRESPONSE +{ + USHORT TransactionId; + USHORT Flags; + USHORT NumQuestions; + USHORT AnswerRRs; + USHORT AuthorityRRs; + USHORT AdditionalRRs; + UCHAR Response[61]; +} NBTRESPONSE; + +// Socket list +typedef struct SOCKLIST +{ + LIST *SockList; +} SOCKLIST; + + +// Parameters for timeout thread for Solaris +typedef struct SOCKET_TIMEOUT_PARAM { + SOCK *sock; + CANCEL *cancel; + THREAD *thread; + bool unblocked; +} SOCKET_TIMEOUT_PARAM; + +// Parameters for GetIP thread +struct GETIP_THREAD_PARAM +{ + REF *Ref; + char HostName[MAX_PATH]; + bool IPv6; + UINT Timeout; + IP Ip; + bool Ok; +}; + +// Parameters for the IP address release thread +struct WIN32_RELEASEADDRESS_THREAD_PARAM +{ + REF *Ref; + char Guid[MAX_SIZE]; + UINT Timeout; + bool Ok; + bool Renew; +}; + +// TCP table entry +typedef struct TCPTABLE +{ + UINT Status; + IP LocalIP; + UINT LocalPort; + IP RemoteIP; + UINT RemotePort; + UINT ProcessId; +} TCPTABLE; + +// State of TCP +#define TCP_STATE_CLOSED 1 +#define TCP_STATE_LISTEN 2 +#define TCP_STATE_SYN_SENT 3 +#define TCP_STATE_SYN_RCVD 4 +#define TCP_STATE_ESTAB 5 +#define TCP_STATE_FIN_WAIT1 6 +#define TCP_STATE_FIN_WAIT2 7 +#define TCP_STATE_CLOSE_WAIT 8 +#define TCP_STATE_CLOSING 9 +#define TCP_STATE_LAST_ACK 10 +#define TCP_STATE_TIME_WAIT 11 +#define TCP_STATE_DELETE_TCB 12 + +// Routing table changing notification +struct ROUTE_CHANGE +{ + ROUTE_CHANGE_DATA *Data; +}; + +// Tube flush list +struct TUBE_FLUSH_LIST +{ + LIST *List; // List +}; + +// Tube +struct TUBE +{ + REF *Ref; // Reference counter + LOCK *Lock; // Lock + QUEUE *Queue; // Packet queue + EVENT *Event; // Event + SOCK_EVENT *SockEvent; // SockEvent + UINT SizeOfHeader; // Header size + TUBEPAIR_DATA *TubePairData; // Tube pair data + UINT IndexInTubePair; // Number in the tube pair + bool IsInFlushList; // Whether it is registered in the Tube Flush List + void *Param1, *Param2, *Param3; + UINT IntParam1, IntParam2, IntParam3; +}; + +// Data that is to send and to receive in the tube +struct TUBEDATA +{ + void *Data; // Body of data + UINT DataSize; // The size of the data + void *Header; // The body of the header + UINT HeaderSize; // Size of the header +}; + +// Tube pair data +struct TUBEPAIR_DATA +{ + bool IsDisconnected; // Disconnection flag + REF *Ref; // Reference counter + LOCK *Lock; // Lock + EVENT *Event1, *Event2; // Event + SOCK_EVENT *SockEvent1, *SockEvent2; // SockEvent +}; + +// TCP raw data +struct TCP_RAW_DATA +{ + IP SrcIP; // Source IP address + IP DstIP; // Destination IP address + UINT SrcPort; // Source port + UINT DstPort; // Destination port + FIFO *Data; // Data body +}; + +// UDP listener socket entry +struct UDPLISTENER_SOCK +{ + IP IpAddress; // IP address + UINT Port; // Port number + SOCK *Sock; // Socket + bool HasError; // Whether an error occurs + bool Mark; // Mark + bool ErrorDebugDisplayed; // Whether the error has been displayed + UINT64 NextMyIpAndPortPollTick; // Time to check the self IP address and port number next + IP PublicIpAddress; // Global IP address + UINT PublicPort; // Global port number +}; + +// UDP packet +struct UDPPACKET +{ + IP SrcIP; // Source IP address + IP DstIP; // Destination IP address + UINT SrcPort; // Source port + UINT DestPort; // Destination port + UINT Size; // Data size + void *Data; // Data body + UINT Type; // Type +}; + +// UDP listener packet receipt notification procedure +typedef void (UDPLISTENER_RECV_PROC)(UDPLISTENER *u, LIST *packet_list); + +// UDP listener +struct UDPLISTENER +{ + bool Halt; // Halting flag + SOCK_EVENT *Event; // Event + THREAD *Thread; // Thread + LIST *PortList; // Port list + LIST *SockList; // Socket list + UINT64 LastCheckTick; // Time which the socket list was checked last + UDPLISTENER_RECV_PROC *RecvProc; // Receive procedure + LIST *SendPacketList; // Transmission packet list + UINT PacketType; // The type to set when creating an UDPPACKET + void *Param; // Parameters + INTERRUPT_MANAGER *Interrupts; // Interrupt manager + bool HostIPAddressListChanged; // IP address list of the host has changed + bool IsEspRawPortOpened; // Whether the raw port opens + bool PollMyIpAndPort; // Examine whether the global IP and the port number of its own + QUERYIPTHREAD *GetNatTIpThread; // NAT-T IP address acquisition thread + IP ListenIP; // Listen IP +}; + +#define QUERYIPTHREAD_INTERVAL_LAST_OK (3 * 60 * 60 * 1000) +#define QUERYIPTHREAD_INTERVAL_LAST_NG (30 * 1000) + +// IP address acquisition thread +struct QUERYIPTHREAD +{ + THREAD *Thread; // Thread + EVENT *HaltEvent; // Halting event + bool Halt; // Halting flag + LOCK *Lock; // Lock + IP Ip; // Get the IP address + char Hostname[MAX_SIZE]; // Host name + UINT IntervalLastOk; // Interval if last was OK + UINT IntervalLastNg; // Interval if last was NG +}; + +// Interrupt management +struct INTERRUPT_MANAGER +{ + LIST *TickList; // Time list +}; + +// SSL BIO +struct SSL_BIO +{ + BIO *bio; // BIO + FIFO *SendFifo; // Transmission FIFO + FIFO *RecvFifo; // Reception FIFO + bool IsDisconnected; // Disconnected + bool NoFree; // Not to release the BIO +}; + +// SSL pipe +struct SSL_PIPE +{ + bool ServerMode; // Whether it's in the server mode + bool IsDisconnected; // Disconnected + SSL *ssl; // SSL object + struct ssl_ctx_st *ssl_ctx; // SSL_CTX + SSL_BIO *SslInOut; // I/O BIO for the data in the SSL tunnel + SSL_BIO *RawIn, *RawOut; // Input and output BIO of the data flowing through the physical network +}; + +// IP address block list +struct IPBLOCK +{ + IP Ip; // IP address + IP Mask; // Subnet mask +}; + + +// R-UDP related constants +#define RUDP_RESEND_TIMER 200 // Retransmission timer (initial value) +#define RUDP_RESEND_TIMER_MAX 4792 // Retransmission timer (maximum value) +#define RUDP_KEEPALIVE_INTERVAL_MIN 2500 // Transmission interval of Keep Alive (minimum) +#define RUDP_KEEPALIVE_INTERVAL_MAX 4792 // Transmission interval of Keep Alive (maximum) +#define RUDP_TIMEOUT 12000 // Time-out of R-UDP communication +#define RUDP_DIRECT_CONNECT_TIMEOUT 5000 // R-UDP direct connection time-out +#define RUDP_MAX_SEGMENT_SIZE 512 // Maximum segment size +#define RUDP_BULK_KEY_SIZE_MAX 128 // Bulk key size Max + +#define RUDP_BULK_KEY_SIZE_V2 32 // V2: Bulk key size +#define RUDP_BULK_IV_SIZE_V2 12 // V2: Bulk IV size +#define RUDP_BULK_MAC_SIZE_V2 16 // V2: Bulk MAC size + +// Maximum R-UDP packet size +#define RUDP_MAX_PACKET_SIZE (RUDP_MAX_SEGMENT_SIZE + sizeof(UINT64) * RUDP_MAX_NUM_ACK + SHA1_SIZE * 2 + sizeof(UINT64) * 4 + sizeof(UINT) + 255) +#define RUDP_MAX_NUM_ACK 64 // Maximum number of ACKs +#define RUDP_LOOP_WAIT_INTERVAL_S 1234 // Waiting time in the thread main loop (in server side) +#define RUDP_LOOP_WAIT_INTERVAL_C 100 // Waiting time in the thread main loop (in client side) +#define RUDP_MAX_FIFO_SIZE (1600 * 1600) // The maximum FIFO buffer size + +// Interval for sending ICMP Echo from the client side when R-UDP used in ICMP mode +#define RUDP_CLIENT_ECHO_REQUEST_SEND_INTERVAL_MIN 1000 +#define RUDP_CLIENT_ECHO_REQUEST_SEND_INTERVAL_MAX 3000 + +// R-UDP error code +#define RUDP_ERROR_OK 0 // Success +#define RUDP_ERROR_UNKNOWN 1 // Unknown Error +#define RUDP_ERROR_TIMEOUT 2 // Time-out +#define RUDP_ERROR_NAT_T_GETIP_FAILED 3 // IP address acquisition failure of NAT-T server +#define RUDP_ERROR_NAT_T_NO_RESPONSE 4 // There is no response from the NAT-T server +#define RUDP_ERROR_NAT_T_TWO_OR_MORE 5 // There are two or more hosts on the same destination IP address +#define RUDP_ERROR_NAT_T_NOT_FOUND 6 // Host does not exist at the specified IP address +#define RUDP_ERROR_USER_CANCELED 7 // Cancel by the user + +// R-UDP segment +struct RUDP_SEGMENT +{ + UINT64 SeqNo; // Sequence number + UINT Size; // Size + UCHAR Data[RUDP_MAX_SEGMENT_SIZE]; // Data + UINT64 NextSendTick; // Next transmission time + UINT NumSent; // Number of times sent +}; + +// Status of R-UDP session +#define RUDP_SESSION_STATUS_CONNECT_SENT 0 // Connection request sent +#define RUDP_SESSION_STATUS_ESTABLISHED 1 // Connection established + +// Quota +#define RUDP_QUOTA_MAX_NUM_SESSIONS_PER_IP DYN32(RUDP_QUOTA_MAX_NUM_SESSIONS_PER_IP, 1000) // The number of R-UDP sessions per an IP address +#define RUDP_QUOTA_MAX_NUM_SESSIONS DYN32(RUDP_QUOTA_MAX_NUM_SESSIONS, 30000) // Limit of the Number of sessions + +// Range of the sequence numbers of bulk packet +#define RUDP_BULK_SEQ_NO_RANGE 16384ULL +#define RUDP_BULK_MAX_RECV_PKTS_IN_QUEUE 8192 + +// R-UDP session +struct RUDP_SESSION +{ + UINT Status; // Status + bool ServerMode; // Whether it's in the server mode + bool DisconnectFlag; // Disconnection flag + bool DisconnectedByYou; // Disconnected from opponent + bool UseHMac; + IP MyIp; // IP address of itself + UINT MyPort; // Port number of itself + IP YourIp; // Opponent IP address + UINT YourPort; // Opponent port number + LIST *SendSegmentList; // Transmission segment list + LIST *RecvSegmentList; // Received segments list + LIST *ReplyAckList; // List of ACKs in response + SOCK *TcpSock; // Corresponding TCP socket + UINT64 LastSentTick; // Time which the data has been sent last + UINT64 LastRecvTick; // Time which the data has been received last + UCHAR Key_Init[SHA1_SIZE]; // Initial key + UCHAR Key_Send[SHA1_SIZE]; // Key that is used to send + UCHAR Key_Recv[SHA1_SIZE]; // Key that is used to receive + UCHAR Magic_KeepAliveRequest[SHA1_SIZE]; // The magic number for the KeepAlive request + UCHAR Magic_KeepAliveResponse[SHA1_SIZE]; // The magic number for KeepAlive response + UINT64 Magic_Disconnect; // Disconnection Signal + UINT64 NextSendSeqNo; // Transmission sequence number to be used next + UINT64 LastRecvCompleteSeqNo; // Sequence number of receiving complete + // (This indicates all segments which have sequence number up to this number are received completely) + UCHAR NextIv[SHA1_SIZE]; // IV value to be used next + UINT NextKeepAliveInterval; // Interval value of KeepAlive to be used next + FIFO *RecvFifo; // Reception FIFO + FIFO *SendFifo; // Transmission FIFO + UINT64 YourTick; // The largest value among received Tick from the opponent + UINT64 LatestRecvMyTick; // Value of the last tick among the received tick values + UINT64 LatestRecvMyTick2; // Variable for confirming whether LatestRecvMyTick2 changes + UINT CurrentRtt; // Current RTT value + + UINT Icmp_Type; // Number of Type to be used in the ICMP + USHORT Dns_TranId; // Value of transaction ID used in DNS + UINT64 Client_Icmp_NextSendEchoRequest; // Time to send the next Echo Request in the ICMP + SHARED_BUFFER *BulkSendKey; // Bulk send key + SHARED_BUFFER *BulkRecvKey; // Bulk receive key + UCHAR BulkNextIv[SHA1_SIZE]; // Next IV to the bulk send + UINT64 BulkNextSeqNo; // Next SEQ NO to the bulk send + bool FlushBulkSendTube; // Flag to be Flush the bulk send Tube + UINT64 BulkRecvSeqNoMax; // Highest sequence number received + UCHAR BulkNextIv_V2[RUDP_BULK_IV_SIZE_V2]; // Next IV to the bulk send (version 2) +}; + +// NAT Traversal Server Information +#define UDP_NAT_T_SERVER_TAG "x%c.x%c.dev.servers.nat-traversal.softether-network.net." +#define UDP_NAT_T_SERVER_TAG_ALT "x%c.x%c.dev.servers.nat-traversal.uxcom.jp." +#define UDP_NAT_T_PORT 5004 + +// Related to processing to get the IP address of the NAT-T server +#define UDP_NAT_T_GET_IP_INTERVAL DYN32(UDP_NAT_T_GET_IP_INTERVAL, (5 * 1000)) // IP address acquisition interval of NAT-T server (before success) +#define UDP_NAT_T_GET_IP_INTERVAL_MAX DYN32(UDP_NAT_T_GET_IP_INTERVAL, (150 * 1000)) // IP address acquisition interval of NAT-T server (before success) +#define UDP_NAT_T_GET_IP_INTERVAL_AFTER DYN32(UDP_NAT_T_GET_IP_INTERVAL_AFTER, (5 * 60 * 1000)) // IP address acquisition interval of NAT-T server (after success) + +// Related to process to get the private IP address of itself with making a TCP connection to the NAT-T server +#define UDP_NAT_T_GET_PRIVATE_IP_TCP_SERVER "www.msftncsi.com." + +#define UDP_NAT_T_PORT_FOR_TCP_1 80 +#define UDP_NAT_T_PORT_FOR_TCP_2 443 + +#define UDP_NAT_TRAVERSAL_VERSION 1 + +#define UDP_NAT_T_GET_PRIVATE_IP_INTERVAL DYN32(UDP_NAT_T_GET_PRIVATE_IP_INTERVAL, (15 * 60 * 1000)) // Polling interval (before success) +#define UDP_NAT_T_GET_PRIVATE_IP_INTERVAL_AFTER_MIN DYN32(UDP_NAT_T_GET_PRIVATE_IP_INTERVAL_AFTER_MIN, (30 * 60 * 1000)) // Polling interval (after success) +#define UDP_NAT_T_GET_PRIVATE_IP_INTERVAL_AFTER_MAX DYN32(UDP_NAT_T_GET_PRIVATE_IP_INTERVAL_AFTER_MAX, (60 * 60 * 1000)) // Polling interval (after success) +#define UDP_NAT_T_GET_PRIVATE_IP_CONNECT_TIMEOUT DYN32(UDP_NAT_T_GET_PRIVATE_IP_CONNECT_TIMEOUT, (5 * 1000)) // TCP connection time-out + +// About token acquisition from the NAT-T server +#define UDP_NAT_T_GET_TOKEN_INTERVAL_1 DYN32(UDP_NAT_T_GET_TOKEN_INTERVAL_1, (5 * 1000)) // Token acquisition interval from the NAT-T server (If not acquired) +#define UDP_NAT_T_GET_TOKEN_INTERVAL_FAIL_MAX DYN32(UDP_NAT_T_GET_TOKEN_INTERVAL_FAIL_MAX, 20) +#define UDP_NAT_T_GET_TOKEN_INTERVAL_2_MIN DYN32(UDP_NAT_T_GET_TOKEN_INTERVAL_2_MIN, (20 * 60 * 1000)) // Token acquisition interval minimum value from the NAT-T server (If token have been obtained) +#define UDP_NAT_T_GET_TOKEN_INTERVAL_2_MAX DYN32(UDP_NAT_T_GET_TOKEN_INTERVAL_2_MAX, (30 * 60 * 1000)) // Token acquisition interval maximum value from the NAT-T server (If token have been obtained) + +// The Register interval for NAT-T server +#define UDP_NAT_T_REGISTER_INTERVAL_INITIAL DYN32(UDP_NAT_T_REGISTER_INTERVAL_INITIAL, (5 * 1000)) // Transmission interval when the Register is not completed +#define UDP_NAT_T_REGISTER_INTERVAL_FAIL_MAX DYN32(UDP_NAT_T_REGISTER_INTERVAL_FAIL_MAX, 20) +#define UDP_NAT_T_REGISTER_INTERVAL_MIN DYN32(UDP_NAT_T_REGISTER_INTERVAL_MIN, (220 * 1000)) // Minimum value of the Register interval +#define UDP_NAT_T_REGISTER_INTERVAL_MAX DYN32(UDP_NAT_T_REGISTER_INTERVAL_MAX, (240 * 1000)) // Maximum value of the Register interval + +// Interval for checking whether the port number or the IP address is changed +#define UDP_NAT_T_NAT_STATUS_CHECK_INTERVAL_MIN DYN32(UDP_NAT_T_NAT_STATUS_CHECK_INTERVAL_MIN, (24 * 1000)) +#define UDP_NAT_T_NAT_STATUS_CHECK_INTERVAL_MAX DYN32(UDP_NAT_T_NAT_STATUS_CHECK_INTERVAL_MAX, (28 * 1000)) + +// The Connect Request interval for NAT-T server +#define UDP_NAT_T_CONNECT_INTERVAL DYN32(UDP_NAT_T_CONNECT_INTERVAL, 200) + +// Polling interval for its own IP information acquisition to the NAT-T server in regular communication between the client and the server +#define UDP_NAT_T_INTERVAL_MIN DYN32(UDP_NAT_T_INTERVAL_MIN, (5 * 60 * 1000)) +#define UDP_NAT_T_INTERVAL_MAX DYN32(UDP_NAT_T_INTERVAL_MAX, (10 * 60 * 1000)) +#define UDP_NAT_T_INTERVAL_INITIAL DYN32(UDP_NAT_T_INTERVAL_INITIAL, (3 * 1000)) +#define UDP_NAT_T_INTERVAL_FAIL_MAX DYN32(UDP_NAT_T_INTERVAL_FAIL_MAX, 60) + +// R-UDP stack callback function definition +typedef void (RUDP_STACK_INTERRUPTS_PROC)(RUDP_STACK *r); +typedef bool (RUDP_STACK_RPC_RECV_PROC)(RUDP_STACK *r, UDPPACKET *p); + +// ICMP protocol number +#define IP_PROTO_ICMPV4 0x01 // ICMPv4 protocol +#define IP_PROTO_ICMPV6 0x3a // ICMPv6 protocol + +// R-UDP protocol +#define RUDP_PROTOCOL_UDP 0 // UDP +#define RUDP_PROTOCOL_ICMP 1 // ICMP +#define RUDP_PROTOCOL_DNS 2 // DNS + +// Maximum time of continuously changing of the NAT-T hostname +#define RUDP_NATT_MAX_CONT_CHANGE_HOSTNAME 30 +#define RUDP_NATT_CONT_CHANGE_HOSTNAME_RESET_INTERVAL (5 * 60 * 1000) + +// Minimum time to wait for a trial to connect by ICMP and DNS in case failing to connect by TCP +#define SOCK_CONNECT_WAIT_FOR_ICMP_AND_DNS_AT_LEAST 5000 + +#define RUDP_MAX_VALIDATED_SOURCE_IP_ADDRESSES 512 +#define RUDP_VALIDATED_SOURCE_IP_ADDRESS_EXPIRES (RUDP_TIMEOUT * 2) + +// Validated Source IP Addresses for R-UDP +struct RUDP_SOURCE_IP +{ + UINT64 ExpiresTick; // Expires + IP ClientIP; // Client IP address +}; + +// R-UDP stack +struct RUDP_STACK +{ + bool ServerMode; // Whether it's in the server mode + char SvcName[MAX_SIZE]; // Service name + UCHAR SvcNameHash[SHA1_SIZE]; // Hash of the service name + bool Halt; // Halting flag + void *Param; // Parameters that can be used by developers + UINT64 Now; // Current time + EVENT *HaltEvent; // Halting event + INTERRUPT_MANAGER *Interrupt; // Interrupt manager + LIST *SessionList; // Session List + SOCK *UdpSock; // UDP socket + UINT Port; // Port number + UINT Protocol; // Protocol + SOCK_EVENT *SockEvent; // Socket event + THREAD *Thread; // Thread + LOCK *Lock; // Lock + RUDP_STACK_INTERRUPTS_PROC *ProcInterrupts; // Interrupt notification callback + RUDP_STACK_RPC_RECV_PROC *ProcRpcRecv; // RPC reception notification callback + THREAD *IpQueryThread; // NAT-T server IP inquiry thread + UCHAR TmpBuf[65536]; // Temporary buffer + LIST *SendPacketList; // Transmission UDP packet list + EVENT *NewSockConnectEvent; // Event to inform that a new socket is connected + QUEUE *NewSockQueue; // Queue of new socket + UINT64 TotalPhysicalReceived; // Physical amount of data received + UINT64 TotalLogicalReceived; // Logical amount of data received + UINT64 TotalPhysicalSent; // Physical amount of data transmitted + UINT64 TotalLogicalSent; // Logical amount of data transmitted + char CurrentRegisterHostname[MAX_SIZE]; // The host name of the the current destination of registration + UINT NumChangedHostname; // How number of changing NAT-T hostname has occured continuously + UINT64 NumChangedHostnameValueResetTick; + + // NAT-T server related + bool NoNatTRegister; // Flag not to register with the NAT-T server + UINT64 NatT_TranId; // Transaction ID is used to communicate with the NAT-T server + UINT64 NatT_SessionKey; // Current Session Key + IP NatT_IP; // IP address of the NAT-T server + IP NatT_IP_Safe; // IP address of the NAT-T server (thread-safe) + IP My_Private_IP; // Private IP address of itself + IP My_Private_IP_Safe; // Private IP address of itself (thread-safe) + UINT64 NatT_GetTokenNextTick; // Time to get the next token + UINT NatT_GetTokenFailNum; // Token acquisition failure times + char NatT_Token[MAX_SIZE]; // Token needed to communicate with NAT-T Server + bool NatT_Token_Ok; // Flag of whether it have a valid token + UINT64 NatT_RegisterNextTick; // Time to register next + UINT NatT_RegisterFailNum; // The number of Register failures + bool NatT_Register_Ok; // Is a successful registration + char NatT_Registered_IPAndPort[128]; // IP address and port number at the time of registration success + UINT64 NatT_NextNatStatusCheckTick; // Time to check the NAT state next + UINT LastDDnsFqdnHash; // DNS FQDN hash value when last checked + volatile UINT *NatTGlobalUdpPort; // NAT-T global UDP port + UCHAR RandPortId; // Random UDP port ID + bool NatT_EnableSourceIpValidation; // Enable the source IP address validation mechanism + LIST *NatT_SourceIpList; // Authenticated source IP address list + + // For Client + bool TargetIpAndPortInited; // The target IP address and the port number are initialized + IP TargetIp; // Target IP address + UINT TargetPort; // Target port number + EVENT *TargetConnectedEvent; // Event to be set when the connection to the target is successful + SOCK *TargetConnectedSock; // Connected socket + bool ClientInitiated; // Flag to indicate that the connection is initiated + bool DoNotSetTargetConnectedSock; // Flag indicating that it should not set the TargetConnectedSock + USHORT Client_IcmpId, Client_IcmpSeqNo; // Sequence number and ICMP ID that is randomly generated on the client side +}; + +// Data for the thread for concurrent connection attempts for the R-UDP and TCP +struct CONNECT_TCP_RUDP_PARAM +{ + IP Ip; + UINT Port; + UINT Timeout; + char Hostname[MAX_SIZE]; + bool *CancelFlag; + UINT NatT_ErrorCode; + char SvcName[MAX_SIZE]; + char HintStr[MAX_SIZE]; + char TargetHostname[MAX_SIZE]; + SOCK *Result_Nat_T_Sock; + SOCK *Result_Tcp_Sock; + bool Finished; + bool Ok; + UINT64 FinishedTick; + EVENT *FinishEvent; + UINT RUdpProtocol; + UINT Delay; + bool Tcp_TryStartSsl; + LOCK *CancelLock; + SOCK *CancelDisconnectSock; + bool Tcp_InNegotiation; +}; + +#define SSL_DEFAULT_CONNECT_TIMEOUT (15 * 1000) // SSL default timeout + +// Header for TCP Pair +struct TCP_PAIR_HEADER +{ + bool EnableHMac; +}; + +// The constants for file query by using UDP +#define UDP_FILE_QUERY_RETRY_INTERVAL 100 // Retry interval +#define UDP_FILE_QUERY_DST_PORT 5004 // Destination UDP port number +#define UDP_FILE_QUERY_MAGIC_NUMBER "{5E465695-7923-4CCD-9B51-44444BE1E758}" // Magic number +#define UDP_FILE_QUERY_BFLETS_TXT_FILENAME "|BFletsUdpList.txt" // Text file name of the IPv6 node list + +// The constant for DNS proxy for the B FLETs +#define BFLETS_DNS_PROXY_PORT 443 +#define BFLETS_DNS_PROXY_PATH "/ddns/queryhost.aspx" +#define BFLETS_DNS_PROXY_CERT_HASH "EFAC5FA0CDD14E0F864EED58A73C35D7E33B62F3" +#define BFLETS_DNS_PROXY_TIMEOUT_FOR_GET_F 500 // Timeout when searching for the server by UDP +#define BFLETS_DNS_PROXY_TIMEOUT_FOR_QUERY 3000 // Timeout for the response from the proxy DNS server + +// FLET'S Hikar-Next (East) DNS proxy host name +#define FLETS_NGN_EAST_DNS_PROXY_HOSTNAME "senet.aoi.flets-east.jp" +#define FLETS_NGN_WEST_DNS_PROXY_HOSTNAME "senet.p-ns.flets-west.jp" +#define FLETS_NGN_DNS_QUERY_TIMEOUT 1000 // FLET'S Hikar-Next host name query timeout + +// Detection result of the type of FLET'S line +#define FLETS_DETECT_TYPE_EAST_BFLETS_PRIVATE 1 // NTT East B-FLETs +#define FLETS_DETECT_TYPE_EAST_NGN_PRIVATE 2 // Wrapping in network of NTT East NGN +#define FLETS_DETECT_TYPE_WEST_NGN_PRIVATE 4 // Wrapping in network of NTT West NGN + +// NIC adapter entry +struct NIC_ENTRY +{ + char IfName[MAX_SIZE]; + UCHAR MacAddress[6]; +}; + +int GetCurrentTimezone(); + +bool GetSniNameFromSslPacket(UCHAR *packet_buf, UINT packet_size, char *sni, UINT sni_size); + +void SetDhParam(DH_CTX *dh); + +bool IsUseDnsProxy(); +bool IsUseAlternativeHostname(); + +#ifdef OS_WIN32 +int GetCurrentTimezoneWin32(); +#endif // OS_WIN32 + +bool SendPack(SOCK *s, PACK *p); +PACK *RecvPack(SOCK *s); +PACK *RecvPackWithHash(SOCK *s); +bool SendPackWithHash(SOCK *s, PACK *p); + +UINT GetErrorFromPack(PACK *p); +PACK *PackError(UINT error); + +void CreateDummyValue(PACK *p); + +char *RecvLine(SOCK *s, UINT max_size); + +bool GetIPViaDnsProxyForJapanFlets(IP *ip_ret, char *hostname, bool ipv6, UINT timeout, bool *cancel, char *dns_proxy_hostname); +bool GetDnsProxyIPAddressForJapanBFlets(IP *ip_ret, UINT timeout, bool *cancel); +BUF *QueryFileByUdpForJapanBFlets(UINT timeout, bool *cancel); +BUF *QueryFileByIPv6Udp(LIST *ip_list, UINT timeout, bool *cancel); +UINT DetectFletsType(); + +void ListenTcpForPopupFirewallDialog(); + +bool DetectIsServerSoftEtherVPN(SOCK *s); +void ConnectThreadForTcp(THREAD *thread, void *param); +void ConnectThreadForRUDP(THREAD *thread, void *param); +void ConnectThreadForOverDnsOrIcmp(THREAD *thread, void *param); +SOCK *NewRUDPClientNatT(char *svc_name, IP *ip, UINT *error_code, UINT timeout, bool *cancel, char *hint_str, char *target_hostname); +RUDP_STACK *NewRUDPServer(char *svc_name, RUDP_STACK_INTERRUPTS_PROC *proc_interrupts, RUDP_STACK_RPC_RECV_PROC *proc_rpc_recv, void *param, UINT port, bool no_natt_register, bool over_dns_mode, volatile UINT *natt_global_udp_port, UCHAR rand_port_id, IP *listen_ip); +SOCK *NewRUDPClientDirect(char *svc_name, IP *ip, UINT port, UINT *error_code, UINT timeout, bool *cancel, SOCK *sock, SOCK_EVENT *sock_event, UINT local_port, bool over_dns_mode); +RUDP_STACK *NewRUDP(bool server_mode, char *svc_name, RUDP_STACK_INTERRUPTS_PROC *proc_interrupts, RUDP_STACK_RPC_RECV_PROC *proc_rpc_recv, void *param, UINT port, SOCK *sock, SOCK_EVENT *sock_event, bool server_no_natt_register, bool over_dns_mode, IP *client_target_ip, volatile UINT *natt_global_udp_port, UCHAR rand_port_id, IP *listen_ip); +void FreeRUDP(RUDP_STACK *r); +void RUDPMainThread(THREAD *thread, void *param); +void RUDPRecvProc(RUDP_STACK *r, UDPPACKET *p); +void RUDPInterruptProc(RUDP_STACK *r); +void RUDPIpQueryThread(THREAD *thread, void *param); +void RUDPSendPacket(RUDP_STACK *r, IP *dest_ip, UINT dest_port, void *data, UINT size, UINT icmp_type); +void GetCurrentMachineIpProcessHash(void *hash); +void GetCurrentMachineIpProcessHashInternal(void *hash); +int RUDPCompareSessionList(void *p1, void *p2); +RUDP_SESSION *RUDPNewSession(bool server_mode, IP *my_ip, UINT my_port, IP *your_ip, UINT your_port, UCHAR *init_key); +void RUDPFreeSession(RUDP_SESSION *se); +int RUDPCompareSegmentList(void *p1, void *p2); +RUDP_SESSION *RUDPSearchSession(RUDP_STACK *r, IP *my_ip, UINT my_port, IP *your_ip, UINT your_port); +void RUDPSendSegmentNow(RUDP_STACK *r, RUDP_SESSION *se, UINT64 seq_no, void *data, UINT size); +void RUDPSendSegment(RUDP_STACK *r, RUDP_SESSION *se, void *data, UINT size); +bool RUDPProcessRecvPacket(RUDP_STACK *r, RUDP_SESSION *se, void *recv_data, UINT recv_size); +bool RUDPCheckSignOfRecvPacket(RUDP_STACK *r, RUDP_SESSION *se, void *recv_data, UINT recv_size); +void RUDPProcessAck(RUDP_STACK *r, RUDP_SESSION *se, UINT64 seq); +void RUDPProcessAck2(RUDP_STACK *r, RUDP_SESSION *se, UINT64 max_seq); +void RUDPProcessRecvPayload(RUDP_STACK *r, RUDP_SESSION *se, UINT64 seq, void *payload_data, UINT payload_size); +void RUDPInitSock(RUDP_STACK *r, RUDP_SESSION *se); +void RUDPDisconnectSession(RUDP_STACK *r, RUDP_SESSION *se, bool disconnected_by_you); +UINT64 RUDPGetCurrentSendingMinSeqNo(RUDP_SESSION *se); +UINT64 RUDPGetCurrentSendingMaxSeqNo(RUDP_SESSION *se); +SOCK *ListenRUDP(char *svc_name, RUDP_STACK_INTERRUPTS_PROC *proc_interrupts, RUDP_STACK_RPC_RECV_PROC *proc_rpc_recv, void *param, UINT port, bool no_natt_register, bool over_dns_mode); +SOCK *ListenRUDPEx(char *svc_name, RUDP_STACK_INTERRUPTS_PROC *proc_interrupts, RUDP_STACK_RPC_RECV_PROC *proc_rpc_recv, void *param, UINT port, bool no_natt_register, bool over_dns_mode, + volatile UINT *natt_global_udp_port, UCHAR rand_port_id, IP *listen_ip); +SOCK *AcceptRUDP(SOCK *s); +void *InitWaitUntilHostIPAddressChanged(); +void FreeWaitUntilHostIPAddressChanged(void *p); +void WaitUntilHostIPAddressChanged(void *p, EVENT *event, UINT timeout, UINT ip_check_interval); +UINT GetHostIPAddressHash32(); +bool GetMyPrivateIP(IP *ip, bool from_vg); +char *GetRandHostNameForGetMyPrivateIP(); +UINT GenRandInterval(UINT min, UINT max); +void RUDPProcess_NatT_Recv(RUDP_STACK *r, UDPPACKET *udp); +void RUDPDo_NatT_Interrupt(RUDP_STACK *r); +void RUDPGetRegisterHostNameByIP(char *dst, UINT size, IP *ip); +bool RUDPParseIPAndPortStr(void *data, UINT data_size, IP *ip, UINT *port); +void ParseNtUsername(char *src_username, char *dst_username, UINT dst_username_size, char *dst_domain, UINT dst_domain_size, bool do_not_parse_atmark); +void RUDPBulkSend(RUDP_STACK *r, RUDP_SESSION *se, void *data, UINT data_size); +bool RUDPProcessBulkRecvPacket(RUDP_STACK *r, RUDP_SESSION *se, void *recv_data, UINT recv_size); +UINT RUDPCalcBestMssForBulk(RUDP_STACK *r, RUDP_SESSION *se); +bool IsIPLocalHostOrMySelf(IP *ip); +bool RUDPIsIpInValidateList(RUDP_STACK *r, IP *ip); +void RUDPAddIpToValidateList(RUDP_STACK *r, IP *ip); + +bool GetBestLocalIpForTarget(IP *local_ip, IP *target_ip); +SOCK *NewUDP4ForSpecificIp(IP *target_ip, UINT port); + +#ifdef OS_WIN32 + +// Function prototype for Win32 +void Win32InitSocketLibrary(); +void Win32FreeSocketLibrary(); +void Win32Select(SOCKSET *set, UINT timeout, CANCEL *c1, CANCEL *c2); +void Win32InitAsyncSocket(SOCK *sock); +void Win32JoinSockToSockEvent(SOCK *sock, SOCK_EVENT *event); +void Win32FreeAsyncSocket(SOCK *sock); +void Win32IpForwardRowToRouteEntry(ROUTE_ENTRY *entry, void *ip_forward_row); +void Win32RouteEntryToIpForwardRow(void *ip_forward_row, ROUTE_ENTRY *entry); +int Win32CompareRouteEntryByMetric(void *p1, void *p2); +ROUTE_TABLE *Win32GetRouteTable(); +bool Win32AddRouteEntry(ROUTE_ENTRY *e, bool *already_exists); +void Win32DeleteRouteEntry(ROUTE_ENTRY *e); +void Win32UINTToIP(IP *ip, UINT i); +UINT Win32IPToUINT(IP *ip); +UINT Win32GetVLanInterfaceID(char *instance_name); +char **Win32EnumVLan(char *tag_name); +void Win32Cancel(CANCEL *c); +void Win32CleanupCancel(CANCEL *c); +CANCEL *Win32NewCancel(); +SOCK_EVENT *Win32NewSockEvent(); +void Win32SetSockEvent(SOCK_EVENT *event); +void Win32CleanupSockEvent(SOCK_EVENT *event); +bool Win32WaitSockEvent(SOCK_EVENT *event, UINT timeout); +bool Win32GetDefaultDns(IP *ip, char *domain, UINT size); +bool Win32GetDnsSuffix(char *domain, UINT size); +void Win32RenewDhcp9x(UINT if_id); +void Win32ReleaseDhcp9x(UINT if_id, bool wait); +void Win32FlushDnsCache(); +int CompareIpAdapterIndexMap(void *p1, void *p2); +ROUTE_CHANGE *Win32NewRouteChange(); +void Win32FreeRouteChange(ROUTE_CHANGE *r); +bool Win32IsRouteChanged(ROUTE_CHANGE *r); +bool Win32GetAdapterFromGuid(void *a, char *guid); +SOCKET Win32Accept(SOCK *sock, SOCKET s, struct sockaddr *addr, int *addrlen, bool ipv6); + +bool Win32ReleaseAddress(void *a); +bool Win32ReleaseAddressByGuid(char *guid); +bool Win32ReleaseAddressByGuidEx(char *guid, UINT timeout); +void Win32ReleaseAddressByGuidExThread(THREAD *t, void *param); +void ReleaseWin32ReleaseAddressByGuidThreadParam(WIN32_RELEASEADDRESS_THREAD_PARAM *p); +bool Win32ReleaseOrRenewAddressByGuidEx(char *guid, UINT timeout, bool renew); +bool Win32RenewAddress(void *a); +bool Win32RenewAddressByGuid(char *guid); +bool Win32RenewAddressByGuidEx(char *guid, UINT timeout); + + +#else // OS_WIN32 + +// Function prototype for UNIX +void UnixInitSocketLibrary(); +void UnixFreeSocketLibrary(); +void UnixSelect(SOCKSET *set, UINT timeout, CANCEL *c1, CANCEL *c2); +void UnixInitAsyncSocket(SOCK *sock); +void UnixJoinSockToSockEvent(SOCK *sock, SOCK_EVENT *event); +void UnixFreeAsyncSocket(SOCK *sock); +ROUTE_TABLE *UnixGetRouteTable(); +bool UnixAddRouteEntry(ROUTE_ENTRY *e, bool *already_exists); +void UnixDeleteRouteEntry(ROUTE_ENTRY *e); +UINT UnixGetVLanInterfaceID(char *instance_name); +char **UnixEnumVLan(char *tag_name); +void UnixCancel(CANCEL *c); +void UnixCleanupCancel(CANCEL *c); +CANCEL *UnixNewCancel(); +SOCK_EVENT *UnixNewSockEvent(); +void UnixSetSockEvent(SOCK_EVENT *event); +void UnixCleanupSockEvent(SOCK_EVENT *event); +bool UnixWaitSockEvent(SOCK_EVENT *event, UINT timeout); +bool UnixGetDefaultDns(IP *ip); +void UnixNewPipe(int *pipe_read, int *pipe_write); +void UnixWritePipe(int pipe_write); +void UnixDeletePipe(int p1, int p2); +void UnixSelectInner(UINT num_read, UINT *reads, UINT num_write, UINT *writes, UINT timeout); +void UnixSetSocketNonBlockingMode(int fd, bool nonblock); + +#endif // OS_WIN32 + +// Function prototype +void InitNetwork(); +void FreeNetwork(); +void InitDnsCache(); +void FreeDnsCache(); +void LockDnsCache(); +void UnlockDnsCache(); +int CompareDnsCache(void *p1, void *p2); +void GenDnsCacheKeyName(char *dst, UINT size, char *src, bool ipv6); +void NewDnsCacheEx(char *hostname, IP *ip, bool ipv6); +DNSCACHE *FindDnsCacheEx(char *hostname, bool ipv6); +bool QueryDnsCacheEx(IP *ip, char *hostname, bool ipv6); +void NewDnsCache(char *hostname, IP *ip); +DNSCACHE *FindDnsCache(char *hostname); +bool QueryDnsCache(IP *ip, char *hostname); +void InAddrToIP(IP *ip, struct in_addr *addr); +void InAddrToIP6(IP *ip, struct in6_addr *addr); +void IPToInAddr(struct in_addr *addr, IP *ip); +void IPToInAddr6(struct in6_addr *addr, IP *ip); +bool StrToIP(IP *ip, char *str); +UINT StrToIP32(char *str); +UINT UniStrToIP32(wchar_t *str); +void IPToStr(char *str, UINT size, IP *ip); +void IPToStr4(char *str, UINT size, IP *ip); +void IPToStr32(char *str, UINT size, UINT ip); +void IPToStr4or6(char *str, UINT size, UINT ip_4_uint, UCHAR *ip_6_bytes); +void IPToUniStr(wchar_t *str, UINT size, IP *ip); +void IPToUniStr32(wchar_t *str, UINT size, UINT ip); +bool GetIPEx(IP *ip, char *hostname, bool ipv6); +bool GetIP46Ex(IP *ip4, IP *ip6, char *hostname, UINT timeout, bool *cancel); +bool GetIP(IP *ip, char *hostname); +bool GetIP4(IP *ip, char *hostname); +bool GetIP6(IP *ip, char *hostname); +bool GetIP4Ex(IP *ip, char *hostname, UINT timeout, bool *cancel); +bool GetIP6Ex(IP *ip, char *hostname, UINT timeout, bool *cancel); +bool GetIP4Ex6Ex(IP *ip, char *hostname, UINT timeout, bool ipv6, bool *cancel); +bool GetIP4Ex6Ex2(IP *ip, char *hostname, UINT timeout, bool ipv6, bool *cancel, bool only_direct_dns); +void GetIP4Ex6ExThread(THREAD *t, void *param); +void ReleaseGetIPThreadParam(GETIP_THREAD_PARAM *p); +void CleanupGetIPThreadParam(GETIP_THREAD_PARAM *p); +bool GetIP4Inner(IP *ip, char *hostname); +bool GetIP6Inner(IP *ip, char *hostname); +bool GetHostNameInner(char *hostname, UINT size, IP *ip); +bool GetHostNameInner6(char *hostname, UINT size, IP *ip); +bool GetHostName(char *hostname, UINT size, IP *ip); +void GetHostNameThread(THREAD *t, void *p); +void GetMachineName(char *name, UINT size); +void GetMachineNameEx(char *name, UINT size, bool no_load_hosts); +bool GetMachineNameFromHosts(char *name, UINT size); +void GetMachineHostName(char *name, UINT size); +void UINTToIP(IP *ip, UINT value); +UINT IPToUINT(IP *ip); +SOCK *NewSock(); +void ReleaseSock(SOCK *s); +void CleanupSock(SOCK *s); +SOCK *Connect(char *hostname, UINT port); +SOCK *ConnectEx(char *hostname, UINT port, UINT timeout); +SOCK *ConnectEx2(char *hostname, UINT port, UINT timeout, bool *cancel_flag); +SOCK *ConnectEx3(char *hostname, UINT port, UINT timeout, bool *cancel_flag, char *nat_t_svc_name, UINT *nat_t_error_code, bool try_start_ssl, bool no_get_hostname); +SOCK *ConnectEx4(char *hostname, UINT port, UINT timeout, bool *cancel_flag, char *nat_t_svc_name, UINT *nat_t_error_code, bool try_start_ssl, bool no_get_hostname, IP *ret_ip); +SOCKET ConnectTimeoutIPv4(IP *ip, UINT port, UINT timeout, bool *cancel_flag); +bool SetSocketBufferSize(SOCKET s, bool send, UINT size); +UINT SetSocketBufferSizeWithBestEffort(SOCKET s, bool send, UINT size); +void InitUdpSocketBufferSize(SOCKET s); +void QuerySocketInformation(SOCK *sock); +bool SetTtl(SOCK *sock, UINT ttl); +void Disconnect(SOCK *sock); +SOCK *Listen(UINT port); +SOCK *ListenEx(UINT port, bool local_only); +SOCK *ListenEx2(UINT port, bool local_only, bool enable_ca, IP *listen_ip); +SOCK *ListenEx6(UINT port, bool local_only); +SOCK *ListenEx62(UINT port, bool local_only, bool enable_ca); +SOCK *Accept(SOCK *sock); +SOCK *Accept6(SOCK *sock); +UINT Send(SOCK *sock, void *data, UINT size, bool secure); +UINT Recv(SOCK *sock, void *data, UINT size, bool secure); +UINT Peek(SOCK *sock, void *data, UINT size); +void SetNoNeedToRead(SOCK *sock); +UINT SecureSend(SOCK *sock, void *data, UINT size); +UINT SecureRecv(SOCK *sock, void *data, UINT size); +bool StartSSL(SOCK *sock, X *x, K *priv); +bool StartSSLEx(SOCK *sock, X *x, K *priv, UINT ssl_timeout, char *sni_hostname); +bool AddChainSslCert(struct ssl_ctx_st *ctx, X *x); +void AddChainSslCertOnDirectory(struct ssl_ctx_st *ctx); +bool SendAll(SOCK *sock, void *data, UINT size, bool secure); +void SendAdd(SOCK *sock, void *data, UINT size); +bool SendNow(SOCK *sock, int secure); +bool RecvAll(SOCK *sock, void *data, UINT size, bool secure); +bool RecvAllEx(SOCK *sock, void **data_new_ptr, UINT size, bool secure); +bool RecvAllWithDiscard(SOCK *sock, UINT size, bool secure); +void InitSockSet(SOCKSET *set); +void AddSockSet(SOCKSET *set, SOCK *sock); +CANCEL *NewCancel(); +CANCEL *NewCancelSpecial(void *hEvent); +void ReleaseCancel(CANCEL *c); +void CleanupCancel(CANCEL *c); +void Cancel(CANCEL *c); +void Select(SOCKSET *set, UINT timeout, CANCEL *c1, CANCEL *c2); +void SetWantToUseCipher(SOCK *sock, char *name); +SOCK *NewUDP(UINT port); +SOCK *NewUDPEx(UINT port, bool ipv6); +SOCK *NewUDPEx2(UINT port, bool ipv6, IP *ip); +SOCK *NewUDPEx3(UINT port, IP *ip); +SOCK *NewUDP4(UINT port, IP *ip); +SOCK *NewUDP6(UINT port, IP *ip); +SOCK *NewUDPEx2Rand(bool ipv6, IP *ip, void *rand_seed, UINT rand_seed_size, UINT num_retry); +SOCK *NewUDPEx2RandMachineAndExePath(bool ipv6, IP *ip, UINT num_retry, UCHAR rand_port_id); +void ClearSockDfBit(SOCK *s); +void SetRawSockHeaderIncludeOption(SOCK *s, bool enable); +UINT SendTo(SOCK *sock, IP *dest_addr, UINT dest_port, void *data, UINT size); +UINT SendToEx(SOCK *sock, IP *dest_addr, UINT dest_port, void *data, UINT size, bool broadcast); +UINT SendTo6Ex(SOCK *sock, IP *dest_addr, UINT dest_port, void *data, UINT size, bool broadcast); +UINT RecvFrom(SOCK *sock, IP *src_addr, UINT *src_port, void *data, UINT size); +UINT RecvFrom6(SOCK *sock, IP *src_addr, UINT *src_port, void *data, UINT size); +void SetTimeout(SOCK *sock, UINT timeout); +UINT GetTimeout(SOCK *sock); +bool CheckTCPPort(char *hostname, UINT port); +bool CheckTCPPortEx(char *hostname, UINT port, UINT timeout); +ROUTE_TABLE *GetRouteTable(); +void FreeRouteTable(ROUTE_TABLE *t); +bool AddRouteEntryEx(ROUTE_ENTRY *e, bool *already_exists); +bool AddRouteEntry(ROUTE_ENTRY *e); +void DeleteRouteEntry(ROUTE_ENTRY *e); +char **EnumVLan(char *tag_name); +void FreeEnumVLan(char **s); +UINT GetVLanInterfaceID(char *tag_name); +ROUTE_ENTRY *GetBestRouteEntry(IP *ip); +ROUTE_ENTRY *GetBestRouteEntryEx(IP *ip, UINT exclude_if_id); +ROUTE_ENTRY *GetBestRouteEntryFromRouteTableEx(ROUTE_TABLE *table, IP *ip, UINT exclude_if_id); +void FreeRouteEntry(ROUTE_ENTRY *e); +void JoinSockToSockEvent(SOCK *sock, SOCK_EVENT *event); +SOCK_EVENT *NewSockEvent(); +void SetSockEvent(SOCK_EVENT *event); +void CleanupSockEvent(SOCK_EVENT *event); +bool WaitSockEvent(SOCK_EVENT *event, UINT timeout); +void ReleaseSockEvent(SOCK_EVENT *event); +void SetIP(IP *ip, UCHAR a1, UCHAR a2, UCHAR a3, UCHAR a4); +UINT SetIP32(UCHAR a1, UCHAR a2, UCHAR a3, UCHAR a4); +bool GetDefaultDns(IP *ip); +bool GetDomainName(char *name, UINT size); +bool UnixGetDomainName(char *name, UINT size); +void AcceptInit(SOCK *s); +void AcceptInitEx(SOCK *s, bool no_lookup_hostname); +void DisableGetHostNameWhenAcceptInit(); +TOKEN_LIST *GetCipherList(); +COUNTER *GetNumTcpConnectionsCounter(); +void InitWaitThread(); +void FreeWaitThread(); +void AddWaitThread(THREAD *t); +void DelWaitThread(THREAD *t); +void InitHostCache(); +void FreeHostCache(); +int CompareHostCache(void *p1, void *p2); +void AddHostCache(IP *ip, char *hostname); +bool GetHostCache(char *hostname, UINT size, IP *ip); +bool IsSubnetMask(IP *ip); +bool IsSubnetMask4(IP *ip); +bool IsSubnetMask32(UINT ip); +bool IsNetworkAddress4(IP *ip, IP *mask); +bool IsNetworkAddress32(UINT ip, UINT mask); +bool IsHostIPAddress4(IP *ip); +bool IsHostIPAddress32(UINT ip); +bool IsZeroIp(IP *ip); +bool IsZeroIP(IP *ip); +bool IsZeroIP6Addr(IPV6_ADDR *addr); +UINT IntToSubnetMask32(UINT i); +void IntToSubnetMask4(IP *ip, UINT i); +bool GetNetBiosName(char *name, UINT size, IP *ip); +bool NormalizeMacAddress(char *dst, UINT size, char *src); +SOCKLIST *NewSockList(); +void StopSockList(SOCKLIST *sl); +void FreeSockList(SOCKLIST *sl); +bool IsIPv6Supported(); +void SetSockTos(SOCK *s, int tos); +void SetSockHighPriority(SOCK *s, bool flag); +void InitIpClientList(); +void FreeIpClientList(); +int CompareIpClientList(void *p1, void *p2); +void AddIpClient(IP *ip); +void DelIpClient(IP *ip); +IP_CLIENT *SearchIpClient(IP *ip); +UINT GetNumIpClient(IP *ip); +void SetLinuxArpFilter(); +int connect_timeout(SOCKET s, struct sockaddr *addr, int size, int timeout, bool *cancel_flag); +void EnableNetworkNameCache(); +void DisableNetworkNameCache(); +bool IsNetworkNameCacheEnabled(); +ROUTE_CHANGE *NewRouteChange(); +void FreeRouteChange(ROUTE_CHANGE *r); +bool IsRouteChanged(ROUTE_CHANGE *r); +void RouteToStr(char *str, UINT str_size, ROUTE_ENTRY *e); +void DebugPrintRoute(ROUTE_ENTRY *e); +void DebugPrintRouteTable(ROUTE_TABLE *r); +bool IsIPv6LocalNetworkAddress(IP *ip); +void AddProtocolDetailsStr(char *dst, UINT dst_size, char *str); +void AddProtocolDetailsKeyValueStr(char *dst, UINT dst_size, char *key, char *value); +void AddProtocolDetailsKeyValueInt(char *dst, UINT dst_size, char *key, UINT value); + +#ifdef ENABLE_SSL_LOGGING +void SockEnableSslLogging(SOCK *s); +void SockWriteSslLog(SOCK *s, void *send_data, UINT send_size, void *recv_data, UINT recv_size); +void SockCloseSslLogging(SOCK *s); +#endif // ENABLE_SSL_LOGGING + +void SocketTimeoutThread(THREAD *t, void *param); +SOCKET_TIMEOUT_PARAM *NewSocketTimeout(SOCK *sock); +void FreeSocketTimeout(SOCKET_TIMEOUT_PARAM *ttp); + +void CopyIP(IP *dst, IP *src); +bool IsIP6(IP *ip); +bool IsIP4(IP *ip); +void IPv6AddrToIP(IP *ip, IPV6_ADDR *addr); +bool IPToIPv6Addr(IPV6_ADDR *addr, IP *ip); +void SetIP6(IP *ip, UCHAR *value); +void GetLocalHostIP6(IP *ip); +void GetLocalHostIP4(IP *ip); +bool IsLocalHostIP6(IP *ip); +bool IsLocalHostIP4(IP *ip); +bool IsLocalHostIP(IP *ip); +void ZeroIP6(IP *ip); +void ZeroIP4(IP *ip); +bool CheckIPItemStr6(char *str); +void IPItemStrToChars6(UCHAR *chars, char *str); +bool StrToIP6(IP *ip, char *str); +bool StrToIP6Addr(IPV6_ADDR *ip, char *str); +void IPToStr6(char *str, UINT size, IP *ip); +void IP6AddrToStr(char *str, UINT size, IPV6_ADDR *addr); +void IPToStr6Array(char *str, UINT size, UCHAR *bytes); +void IPToStr6Inner(char *str, IP *ip); +void IntToSubnetMask6(IP *ip, UINT i); +void IPAnd6(IP *dst, IP *a, IP *b); +void GetAllRouterMulticastAddress6(IP *ip); +void GetAllNodeMulticaseAddress6(IP *ip); +void GetLoopbackAddress6(IP *ip); +UINT GetIPAddrType6(IP *ip); +UINT GetIPv6AddrType(IPV6_ADDR *addr); +void GetPrefixAddress6(IP *dst, IP *ip, IP *subnet); +bool IsInSameNetwork6(IP *a1, IP *a2, IP *subnet); +bool IsInSameNetwork6ByStr(char *ip1, char *ip2, char *subnet); +void GenerateEui64Address6(UCHAR *dst, UCHAR *mac); +void GenerateEui64LocalAddress(IP *a, UCHAR *mac); +bool IsSubnetMask6(IP *a); +UINT SubnetMaskToInt(IP *a); +UINT SubnetMaskToInt6(IP *a); +UINT SubnetMaskToInt4(IP *a); +bool IsStrIPv6Address(char *str); +void IPAnd4(IP *dst, IP *a, IP *b); +bool IsInSameNetwork4(IP *a1, IP *a2, IP *subnet); +bool IsInSameNetwork4Standard(IP *a1, IP *a2); + +// Utility functions about IP and MAC address types +bool IsValidUnicastIPAddress4(IP *ip); +bool IsValidUnicastIPAddressUINT4(UINT ip); +bool IsValidUnicastIPAddress6(IP *ip); +bool IsMacUnicast(UCHAR *mac); +bool IsMacBroadcast(UCHAR *mac); +bool IsMacMulticast(UCHAR *mac); +bool IsMacInvalid(UCHAR *mac); + +bool ParseIpAndSubnetMask4(char *src, UINT *ip, UINT *mask); +bool ParseIpAndSubnetMask46(char *src, IP *ip, IP *mask); +bool ParseIpAndMask4(char *src, UINT *ip, UINT *mask); +bool ParseIpAndMask6(char *src, IP *ip, IP *mask); +bool ParseIpAndMask46(char *src, IP *ip, IP *mask); +bool IsIpStr4(char *str); +bool IsIpStr6(char *str); +bool IsIpMask6(char *str); +bool StrToMask6(IP *mask, char *str); +bool StrToMask6Addr(IPV6_ADDR *mask, char *str); +void MaskToStr(char *str, UINT size, IP *mask); +void Mask6AddrToStrEx(char *str, UINT size, IPV6_ADDR *mask, bool always_full_address); +void Mask6AddrToStr(char *str, UINT size, IPV6_ADDR *mask); +void MaskToStr32(char *str, UINT size, UINT mask); +void MaskToStr32Ex(char *str, UINT size, UINT mask, bool always_full_address); +void MaskToStrEx(char *str, UINT size, IP *mask, bool always_full_address); + +TUBEDATA *NewTubeData(void *data, UINT size, void *header, UINT header_size); +void FreeTubeData(TUBEDATA *d); +TUBE *NewTube(UINT size_of_header); +void ReleaseTube(TUBE *t); +void CleanupTube(TUBE *t); +bool TubeSend(TUBE *t, void *data, UINT size, void *header); +bool TubeSendEx(TUBE *t, void *data, UINT size, void *header, bool no_flush); +bool TubeSendEx2(TUBE *t, void *data, UINT size, void *header, bool no_flush, UINT max_num_in_queue); +void TubeFlush(TUBE *t); +void TubeFlushEx(TUBE *t, bool force); +TUBEDATA *TubeRecvAsync(TUBE *t); +TUBEDATA *TubeRecvSync(TUBE *t, UINT timeout); +TUBEPAIR_DATA *NewTubePairData(); +void ReleaseTubePairData(TUBEPAIR_DATA *d); +void CleanupTubePairData(TUBEPAIR_DATA *d); +void NewTubePair(TUBE **t1, TUBE **t2, UINT size_of_header); +void TubeDisconnect(TUBE *t); +bool IsTubeConnected(TUBE *t); +void SetTubeSockEvent(TUBE *t, SOCK_EVENT *e); +SOCK_EVENT *GetTubeSockEvent(TUBE *t); + +TUBE_FLUSH_LIST *NewTubeFlushList(); +void FreeTubeFlushList(TUBE_FLUSH_LIST *f); +void AddTubeToFlushList(TUBE_FLUSH_LIST *f, TUBE *t); +void FlushTubeFlushList(TUBE_FLUSH_LIST *f); + +LIST *GetHostIPAddressListInternal(); +LIST *GetHostIPAddressList(); +LIST *CloneIPAddressList(LIST *o); +bool IsMyIPAddress(IP *ip); +void FreeHostIPAddressList(LIST *o); +void AddHostIPAddressToList(LIST *o, IP *ip); +int CmpIpAddressList(void *p1, void *p2); +UINT64 GetHostIPAddressListHash(); + +UDPLISTENER *NewUdpListener(UDPLISTENER_RECV_PROC *recv_proc, void *param, IP *listen_ip); +UDPLISTENER *NewUdpListenerEx(UDPLISTENER_RECV_PROC *recv_proc, void *param, IP *listen_ip, UINT packet_type); +void UdpListenerThread(THREAD *thread, void *param); +void StopUdpListener(UDPLISTENER *u); +void FreeUdpListener(UDPLISTENER *u); +void AddPortToUdpListener(UDPLISTENER *u, UINT port); +void DeletePortFromUdpListener(UDPLISTENER *u, UINT port); +void DeleteAllPortFromUdpListener(UDPLISTENER *u); +void UdpListenerSendPackets(UDPLISTENER *u, LIST *packet_list); +TCP_RAW_DATA *NewTcpRawData(IP *src_ip, UINT src_port, IP *dst_ip, UINT dst_port); +void FreeTcpRawData(TCP_RAW_DATA *trd); +UDPPACKET *NewUdpPacket(IP *src_ip, UINT src_port, IP *dst_ip, UINT dst_port, void *data, UINT size); +void FreeUdpPacket(UDPPACKET *p); +UDPLISTENER_SOCK *DetermineUdpSocketForSending(UDPLISTENER *u, UDPPACKET *p); +bool IsUdpPortOpened(UDPLISTENER *u, IP *server_ip, UINT port); + +INTERRUPT_MANAGER *NewInterruptManager(); +void FreeInterruptManager(INTERRUPT_MANAGER *m); +void AddInterrupt(INTERRUPT_MANAGER *m, UINT64 tick); +UINT GetNextIntervalForInterrupt(INTERRUPT_MANAGER *m); + +void NewSocketPair(SOCK **client, SOCK **server, IP *client_ip, UINT client_port, IP *server_ip, UINT server_port); +SOCK *NewInProcSocket(TUBE *tube_send, TUBE *tube_recv); +SOCK *ListenInProc(); +SOCK *AcceptInProc(SOCK *s); +SOCK *ConnectInProc(SOCK *listen_sock, IP *client_ip, UINT client_port, IP *server_ip, UINT server_port); +UINT SendInProc(SOCK *sock, void *data, UINT size); +UINT RecvInProc(SOCK *sock, void *data, UINT size); +void WaitForTubes(TUBE **tubes, UINT num, UINT timeout); + +SOCK *ListenReverse(); +SOCK *AcceptReverse(SOCK *s); +void InjectNewReverseSocketToAccept(SOCK *listen_sock, SOCK *s, IP *client_ip, UINT client_port); + +bool NewTcpPair(SOCK **s1, SOCK **s2); +SOCK *ListenAnyPortEx2(bool local_only, bool disable_ca); + +bool IsIcmpApiSupported(); +ICMP_RESULT *IcmpApiEchoSend(IP *dest_ip, UCHAR ttl, UCHAR *data, UINT size, UINT timeout); +void IcmpApiFreeResult(ICMP_RESULT *ret); + +#ifdef OS_WIN32 +void Win32WaitForTubes(TUBE **tubes, UINT num, UINT timeout); +#else // OS_WIN32 +void UnixWaitForTubes(TUBE **tubes, UINT num, UINT timeout); +#endif // OS_WIN32 + +#define PREVERIFY_ERR_MESSAGE_SIZE 100 +// Info on client certificate collected during TLS handshake +struct SslClientCertInfo { + int PreverifyErr; + char PreverifyErrMessage[PREVERIFY_ERR_MESSAGE_SIZE]; + X *X; +}; + +SSL_PIPE *NewSslPipe(bool server_mode, X *x, K *k, DH_CTX *dh); +SSL_PIPE *NewSslPipeEx(bool server_mode, X *x, K *k, DH_CTX *dh, bool verify_peer, struct SslClientCertInfo *clientcert); +void FreeSslPipe(SSL_PIPE *s); +bool SyncSslPipe(SSL_PIPE *s); + +SSL_BIO *NewSslBioMem(); +SSL_BIO *NewSslBioSsl(); +void FreeSslBio(SSL_BIO *b); +bool SslBioSync(SSL_BIO *b, bool sync_send, bool sync_recv); + +void SetCurrentGlobalIP(IP *ip, bool ipv6); +bool GetCurrentGlobalIP(IP *ip, bool ipv6); +void GetCurrentGlobalIPGuess(IP *ip, bool ipv6); +bool IsIPAddressInSameLocalNetwork(IP *a); + +bool IsIPPrivate(IP *ip); +bool IsIPMyHost(IP *ip); +void LoadPrivateIPFile(); +bool IsOnPrivateIPFile(UINT ip); +void FreePrivateIPFile(); + +LIST *GetNicList(); +void FreeNicList(LIST *o); +bool IsMacAddressLocalInner(LIST *o, void *addr); +bool IsMacAddressLocalFast(void *addr); +void RefreshLocalMacAddressList(); + +struct ssl_ctx_st *NewSSLCtx(bool server_mode); +void FreeSSLCtx(struct ssl_ctx_st *ctx); +UINT GetOSSecurityLevel(); + +void SetCurrentDDnsFqdn(char *name); +void GetCurrentDDnsFqdn(char *name, UINT size); +UINT GetCurrentDDnsFqdnHash(); + +void DisableRDUPServerGlobally(); + +void QueryIpThreadMain(THREAD *thread, void *param); +QUERYIPTHREAD *NewQueryIpThread(char *hostname, UINT interval_last_ok, UINT interval_last_ng); +bool GetQueryIpThreadResult(QUERYIPTHREAD *t, IP *ip); +void FreeQueryIpThread(QUERYIPTHREAD *t); + +void SetGetIpThreadMaxNum(UINT num); +UINT GetGetIpThreadMaxNum(); +UINT GetCurrentGetIpThreadNum(); + +#ifdef OS_WIN32 +LIST *Win32GetNicList(); +#endif // OS_WIN32 + + +void InitDynList(); +void FreeDynList(); +void AddDynList(BUF *b); +void ExtractAndApplyDynList(PACK *p); +void SetDynListValue(char *name, UINT64 value); +UINT64 GetDynValue(char *name); +UINT64 GetDynValueOrDefault(char *name, UINT64 default_value, UINT64 min_value, UINT64 max_value); +UINT64 GetDynValueOrDefaultSafe(char *name, UINT64 default_value); + + +#endif // NETWORK_H + diff --git a/src/Mayaqua/OS.c b/src/Mayaqua/OS.c index 272a9eeb..14453be5 100644 --- a/src/Mayaqua/OS.c +++ b/src/Mayaqua/OS.c @@ -1,409 +1,409 @@ -// SoftEther VPN Source Code - Developer Edition Master Branch -// Mayaqua Kernel - - -// OS.c -// Operating system dependent code - -#include - -#include -#include -#include -#include -#include -#include -#include -#include - -#undef Lock -#undef Unlock - -// Dispatch table -static OS_DISPATCH_TABLE *os = NULL; - -// Convert OS type to a string -char *OsTypeToStr(UINT type) -{ - switch (type) - { - case 0: - return "Unsupported OS by SoftEther VPN\0\n"; - case OSTYPE_WINDOWS_95: - return "Windows 95\0\n"; - case OSTYPE_WINDOWS_98: - return "Windows 98\0\n"; - case OSTYPE_WINDOWS_ME: - return "Windows Millennium Edition\0\n"; - case OSTYPE_WINDOWS_UNKNOWN: - return "Windows 9x Unknown Version\0\n"; - case OSTYPE_WINDOWS_NT_4_WORKSTATION: - return "Windows NT 4.0 Workstation\0\n"; - case OSTYPE_WINDOWS_NT_4_SERVER: - return "Windows NT 4.0 Server\0\n"; - case OSTYPE_WINDOWS_NT_4_SERVER_ENTERPRISE: - return "Windows NT 4.0 Server, Enterprise Edition\0\n"; - case OSTYPE_WINDOWS_NT_4_BACKOFFICE: - return "BackOffice Server 4.5\0\n"; - case OSTYPE_WINDOWS_NT_4_SMS: - return "Small Business Server 4.5\0\n"; - case OSTYPE_WINDOWS_2000_PROFESSIONAL: - return "Windows 2000 Professional\0\n"; - case OSTYPE_WINDOWS_2000_SERVER: - return "Windows 2000 Server\0\n"; - case OSTYPE_WINDOWS_2000_ADVANCED_SERVER: - return "Windows 2000 Advanced Server\0\n"; - case OSTYPE_WINDOWS_2000_DATACENTER_SERVER: - return "Windows 2000 Datacenter Server\0\n"; - case OSTYPE_WINDOWS_2000_BACKOFFICE: - return "BackOffice Server 2000\0\n"; - case OSTYPE_WINDOWS_2000_SBS: - return "Small Business Server 2000\0\n"; - case OSTYPE_WINDOWS_XP_HOME: - return "Windows XP Home Edition\0\n"; - case OSTYPE_WINDOWS_XP_PROFESSIONAL: - return "Windows XP Professional\0\n"; - case OSTYPE_WINDOWS_2003_WEB: - return "Windows Server 2003 Web Edition\0\n"; - case OSTYPE_WINDOWS_2003_STANDARD: - return "Windows Server 2003 Standard Edition\0\n"; - case OSTYPE_WINDOWS_2003_ENTERPRISE: - return "Windows Server 2003 Enterprise Edition\0\n"; - case OSTYPE_WINDOWS_2003_DATACENTER: - return "Windows Server 2003 Datacenter Edition\0\n"; - case OSTYPE_WINDOWS_2003_BACKOFFICE: - return "BackOffice Server 2003\0\n"; - case OSTYPE_WINDOWS_2003_SBS: - return "Small Business Server 2003\0\n"; - case OSTYPE_WINDOWS_LONGHORN_PROFESSIONAL: - return "Windows Vista\0\n"; - case OSTYPE_WINDOWS_LONGHORN_SERVER: - return "Windows Server 2008\0\n"; - case OSTYPE_WINDOWS_7: - return "Windows 7\0\n"; - case OSTYPE_WINDOWS_SERVER_2008_R2: - return "Windows Server 2008 R2\0\n"; - case OSTYPE_WINDOWS_8: - return "Windows 8\0\n"; - case OSTYPE_WINDOWS_SERVER_8: - return "Windows Server 2012\0\n"; - case OSTYPE_WINDOWS_81: - return "Windows 8.1\0\n"; - case OSTYPE_WINDOWS_SERVER_81: - return "Windows Server 2012 R2\0\n"; - case OSTYPE_WINDOWS_10: - return "Windows 10\0\n"; - case OSTYPE_WINDOWS_SERVER_10: - return "Windows Server 2016\0\n"; - case OSTYPE_WINDOWS_11: - return "Newer than Windows 10\0\n"; - case OSTYPE_WINDOWS_SERVER_11: - return "Newer than Windows Server 2016\0\n"; - case OSTYPE_UNIX_UNKNOWN: - return "UNIX System\0\n"; - case OSTYPE_LINUX: - return "Linux\0\n"; - case OSTYPE_SOLARIS: - return "Sun Solaris\0\n"; - case OSTYPE_CYGWIN: - return "Gnu Cygwin\0\n"; - case OSTYPE_BSD: - return "BSD System\0\n"; - case OSTYPE_MACOS_X: - return "Mac OS X\0\n"; - } - - return "Unknown OS"; -} - -// Initialization -void OSInit() -{ - // Get the dispatch table -#ifdef OS_WIN32 - os = Win32GetDispatchTable(); -#else // OS_WIN32 - os = UnixGetDispatchTable(); -#endif // OS_WIN32 - - // Calling the OS-specific initialization function - os->Init(); -} - -// Release -void OSFree() -{ - os->Free(); -} - -// Get the memory information -void OSGetMemInfo(MEMINFO *info) -{ - // Validate arguments - if (info == NULL) - { - return; - } - - os->GetMemInfo(info); -} - -// Yield -void OSYield() -{ - os->Yield(); -} - -// Start a Single instance -void *OSNewSingleInstance(char *instance_name) -{ - return os->NewSingleInstance(instance_name); -} - -void OSFreeSingleInstance(void *data) -{ - os->FreeSingleInstance(data); -} - -// Raise the priority -void OSSetHighPriority() -{ - os->SetHighPriority(); -} - -// Restore the priority -void OSRestorePriority() -{ - os->RestorePriority(); -} - -// Get the product ID -char* OSGetProductId() -{ - return os->GetProductId(); -} - -// Check whether the OS is supported -bool OSIsSupportedOs() -{ - return os->IsSupportedOs(); -} - -// Getting OS information -void OSGetOsInfo(OS_INFO *info) -{ - os->GetOsInfo(info); -} - -// Show an alert -void OSAlert(char *msg, char *caption) -{ - os->Alert(msg, caption); -} -void OSAlertW(wchar_t *msg, wchar_t *caption) -{ - os->AlertW(msg, caption); -} - -// Run a process -bool OSRun(char *filename, char *arg, bool hide, bool wait) -{ - return os->Run(filename, arg, hide, wait); -} -bool OSRunW(wchar_t *filename, wchar_t *arg, bool hide, bool wait) -{ - return os->RunW(filename, arg, hide, wait); -} - -// Get the Thread ID -UINT OSThreadId() -{ - return os->ThreadId(); -} - -// Rename -bool OSFileRenameW(wchar_t *old_name, wchar_t *new_name) -{ - return os->FileRenameW(old_name, new_name); -} - -// Get the file size -UINT64 OSFileSize(void *pData) -{ - return os->FileSize(pData); -} - -// Seek the file -bool OSFileSeek(void *pData, UINT mode, int offset) -{ - return os->FileSeek(pData, mode, offset); -} - -// Delete the file -bool OSFileDeleteW(wchar_t *name) -{ - return os->FileDeleteW(name); -} - -// Create a directory -bool OSMakeDirW(wchar_t *name) -{ - return os->MakeDirW(name); -} - -// Delete the directory -bool OSDeleteDirW(wchar_t *name) -{ - return os->DeleteDirW(name); -} - -// Open the file -void *OSFileOpenW(wchar_t *name, bool write_mode, bool read_lock) -{ - return os->FileOpenW(name, write_mode, read_lock); -} - -// Create a file -void *OSFileCreateW(wchar_t *name) -{ - return os->FileCreateW(name); -} - -// Write to a file -bool OSFileWrite(void *pData, void *buf, UINT size) -{ - return os->FileWrite(pData, buf, size); -} - -// Read from a file -bool OSFileRead(void *pData, void *buf, UINT size) -{ - return os->FileRead(pData, buf, size); -} - -// Close the file -void OSFileClose(void *pData, bool no_flush) -{ - os->FileClose(pData, no_flush); -} - -// Flush to the file -void OSFileFlush(void *pData) -{ - os->FileFlush(pData); -} - -// Get the call stack -CALLSTACK_DATA *OSGetCallStack() -{ - return os->GetCallStack(); -} - -// Get the symbol information -bool OSGetCallStackSymbolInfo(CALLSTACK_DATA *s) -{ - return os->GetCallStackSymbolInfo(s); -} - -// Wait for the termination of the thread -bool OSWaitThread(THREAD *t) -{ - return os->WaitThread(t); -} - -// Release of thread -void OSFreeThread(THREAD *t) -{ - os->FreeThread(t); -} - -// Thread initialization -bool OSInitThread(THREAD *t) -{ - return os->InitThread(t); -} - -// Memory allocation -void *OSMemoryAlloc(UINT size) -{ - return os->MemoryAlloc(size); -} - -// Memory reallocation -void *OSMemoryReAlloc(void *addr, UINT size) -{ - return os->MemoryReAlloc(addr, size); -} - -// Memory release -void OSMemoryFree(void *addr) -{ - os->MemoryFree(addr); -} - -// Get the system timer -UINT OSGetTick() -{ - return os->GetTick(); -} - -// Get the System Time -void OSGetSystemTime(SYSTEMTIME *system_time) -{ - os->GetSystemTime(system_time); -} - -// Sleep the thread -void OSSleep(UINT time) -{ - os->Sleep(time); -} - -// Create a Lock -LOCK *OSNewLock() -{ - return os->NewLock(); -} - -// Lock -bool OSLock(LOCK *lock) -{ - return os->Lock(lock); -} - -// Unlock -void OSUnlock(LOCK *lock) -{ - os->Unlock(lock); -} - -// Delete the lock -void OSDeleteLock(LOCK *lock) -{ - os->DeleteLock(lock); -} - -// Event initialization -void OSInitEvent(EVENT *event) -{ - os->InitEvent(event); -} - -// Set event -void OSSetEvent(EVENT *event) -{ - os->SetEvent(event); -} - -// Wait for event -bool OSWaitEvent(EVENT *event, UINT timeout) -{ - return os->WaitEvent(event, timeout); -} - -// Release of the event -void OSFreeEvent(EVENT *event) -{ - os->FreeEvent(event); -} - +// SoftEther VPN Source Code - Developer Edition Master Branch +// Mayaqua Kernel + + +// OS.c +// Operating system dependent code + +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +#undef Lock +#undef Unlock + +// Dispatch table +static OS_DISPATCH_TABLE *os = NULL; + +// Convert OS type to a string +char *OsTypeToStr(UINT type) +{ + switch (type) + { + case 0: + return "Unsupported OS by SoftEther VPN\0\n"; + case OSTYPE_WINDOWS_95: + return "Windows 95\0\n"; + case OSTYPE_WINDOWS_98: + return "Windows 98\0\n"; + case OSTYPE_WINDOWS_ME: + return "Windows Millennium Edition\0\n"; + case OSTYPE_WINDOWS_UNKNOWN: + return "Windows 9x Unknown Version\0\n"; + case OSTYPE_WINDOWS_NT_4_WORKSTATION: + return "Windows NT 4.0 Workstation\0\n"; + case OSTYPE_WINDOWS_NT_4_SERVER: + return "Windows NT 4.0 Server\0\n"; + case OSTYPE_WINDOWS_NT_4_SERVER_ENTERPRISE: + return "Windows NT 4.0 Server, Enterprise Edition\0\n"; + case OSTYPE_WINDOWS_NT_4_BACKOFFICE: + return "BackOffice Server 4.5\0\n"; + case OSTYPE_WINDOWS_NT_4_SMS: + return "Small Business Server 4.5\0\n"; + case OSTYPE_WINDOWS_2000_PROFESSIONAL: + return "Windows 2000 Professional\0\n"; + case OSTYPE_WINDOWS_2000_SERVER: + return "Windows 2000 Server\0\n"; + case OSTYPE_WINDOWS_2000_ADVANCED_SERVER: + return "Windows 2000 Advanced Server\0\n"; + case OSTYPE_WINDOWS_2000_DATACENTER_SERVER: + return "Windows 2000 Datacenter Server\0\n"; + case OSTYPE_WINDOWS_2000_BACKOFFICE: + return "BackOffice Server 2000\0\n"; + case OSTYPE_WINDOWS_2000_SBS: + return "Small Business Server 2000\0\n"; + case OSTYPE_WINDOWS_XP_HOME: + return "Windows XP Home Edition\0\n"; + case OSTYPE_WINDOWS_XP_PROFESSIONAL: + return "Windows XP Professional\0\n"; + case OSTYPE_WINDOWS_2003_WEB: + return "Windows Server 2003 Web Edition\0\n"; + case OSTYPE_WINDOWS_2003_STANDARD: + return "Windows Server 2003 Standard Edition\0\n"; + case OSTYPE_WINDOWS_2003_ENTERPRISE: + return "Windows Server 2003 Enterprise Edition\0\n"; + case OSTYPE_WINDOWS_2003_DATACENTER: + return "Windows Server 2003 Datacenter Edition\0\n"; + case OSTYPE_WINDOWS_2003_BACKOFFICE: + return "BackOffice Server 2003\0\n"; + case OSTYPE_WINDOWS_2003_SBS: + return "Small Business Server 2003\0\n"; + case OSTYPE_WINDOWS_LONGHORN_PROFESSIONAL: + return "Windows Vista\0\n"; + case OSTYPE_WINDOWS_LONGHORN_SERVER: + return "Windows Server 2008\0\n"; + case OSTYPE_WINDOWS_7: + return "Windows 7\0\n"; + case OSTYPE_WINDOWS_SERVER_2008_R2: + return "Windows Server 2008 R2\0\n"; + case OSTYPE_WINDOWS_8: + return "Windows 8\0\n"; + case OSTYPE_WINDOWS_SERVER_8: + return "Windows Server 2012\0\n"; + case OSTYPE_WINDOWS_81: + return "Windows 8.1\0\n"; + case OSTYPE_WINDOWS_SERVER_81: + return "Windows Server 2012 R2\0\n"; + case OSTYPE_WINDOWS_10: + return "Windows 10\0\n"; + case OSTYPE_WINDOWS_SERVER_10: + return "Windows Server 2016\0\n"; + case OSTYPE_WINDOWS_11: + return "Newer than Windows 10\0\n"; + case OSTYPE_WINDOWS_SERVER_11: + return "Newer than Windows Server 2016\0\n"; + case OSTYPE_UNIX_UNKNOWN: + return "UNIX System\0\n"; + case OSTYPE_LINUX: + return "Linux\0\n"; + case OSTYPE_SOLARIS: + return "Sun Solaris\0\n"; + case OSTYPE_CYGWIN: + return "Gnu Cygwin\0\n"; + case OSTYPE_BSD: + return "BSD System\0\n"; + case OSTYPE_MACOS_X: + return "Mac OS X\0\n"; + } + + return "Unknown OS"; +} + +// Initialization +void OSInit() +{ + // Get the dispatch table +#ifdef OS_WIN32 + os = Win32GetDispatchTable(); +#else // OS_WIN32 + os = UnixGetDispatchTable(); +#endif // OS_WIN32 + + // Calling the OS-specific initialization function + os->Init(); +} + +// Release +void OSFree() +{ + os->Free(); +} + +// Get the memory information +void OSGetMemInfo(MEMINFO *info) +{ + // Validate arguments + if (info == NULL) + { + return; + } + + os->GetMemInfo(info); +} + +// Yield +void OSYield() +{ + os->Yield(); +} + +// Start a Single instance +void *OSNewSingleInstance(char *instance_name) +{ + return os->NewSingleInstance(instance_name); +} + +void OSFreeSingleInstance(void *data) +{ + os->FreeSingleInstance(data); +} + +// Raise the priority +void OSSetHighPriority() +{ + os->SetHighPriority(); +} + +// Restore the priority +void OSRestorePriority() +{ + os->RestorePriority(); +} + +// Get the product ID +char* OSGetProductId() +{ + return os->GetProductId(); +} + +// Check whether the OS is supported +bool OSIsSupportedOs() +{ + return os->IsSupportedOs(); +} + +// Getting OS information +void OSGetOsInfo(OS_INFO *info) +{ + os->GetOsInfo(info); +} + +// Show an alert +void OSAlert(char *msg, char *caption) +{ + os->Alert(msg, caption); +} +void OSAlertW(wchar_t *msg, wchar_t *caption) +{ + os->AlertW(msg, caption); +} + +// Run a process +bool OSRun(char *filename, char *arg, bool hide, bool wait) +{ + return os->Run(filename, arg, hide, wait); +} +bool OSRunW(wchar_t *filename, wchar_t *arg, bool hide, bool wait) +{ + return os->RunW(filename, arg, hide, wait); +} + +// Get the Thread ID +UINT OSThreadId() +{ + return os->ThreadId(); +} + +// Rename +bool OSFileRenameW(wchar_t *old_name, wchar_t *new_name) +{ + return os->FileRenameW(old_name, new_name); +} + +// Get the file size +UINT64 OSFileSize(void *pData) +{ + return os->FileSize(pData); +} + +// Seek the file +bool OSFileSeek(void *pData, UINT mode, int offset) +{ + return os->FileSeek(pData, mode, offset); +} + +// Delete the file +bool OSFileDeleteW(wchar_t *name) +{ + return os->FileDeleteW(name); +} + +// Create a directory +bool OSMakeDirW(wchar_t *name) +{ + return os->MakeDirW(name); +} + +// Delete the directory +bool OSDeleteDirW(wchar_t *name) +{ + return os->DeleteDirW(name); +} + +// Open the file +void *OSFileOpenW(wchar_t *name, bool write_mode, bool read_lock) +{ + return os->FileOpenW(name, write_mode, read_lock); +} + +// Create a file +void *OSFileCreateW(wchar_t *name) +{ + return os->FileCreateW(name); +} + +// Write to a file +bool OSFileWrite(void *pData, void *buf, UINT size) +{ + return os->FileWrite(pData, buf, size); +} + +// Read from a file +bool OSFileRead(void *pData, void *buf, UINT size) +{ + return os->FileRead(pData, buf, size); +} + +// Close the file +void OSFileClose(void *pData, bool no_flush) +{ + os->FileClose(pData, no_flush); +} + +// Flush to the file +void OSFileFlush(void *pData) +{ + os->FileFlush(pData); +} + +// Get the call stack +CALLSTACK_DATA *OSGetCallStack() +{ + return os->GetCallStack(); +} + +// Get the symbol information +bool OSGetCallStackSymbolInfo(CALLSTACK_DATA *s) +{ + return os->GetCallStackSymbolInfo(s); +} + +// Wait for the termination of the thread +bool OSWaitThread(THREAD *t) +{ + return os->WaitThread(t); +} + +// Release of thread +void OSFreeThread(THREAD *t) +{ + os->FreeThread(t); +} + +// Thread initialization +bool OSInitThread(THREAD *t) +{ + return os->InitThread(t); +} + +// Memory allocation +void *OSMemoryAlloc(UINT size) +{ + return os->MemoryAlloc(size); +} + +// Memory reallocation +void *OSMemoryReAlloc(void *addr, UINT size) +{ + return os->MemoryReAlloc(addr, size); +} + +// Memory release +void OSMemoryFree(void *addr) +{ + os->MemoryFree(addr); +} + +// Get the system timer +UINT OSGetTick() +{ + return os->GetTick(); +} + +// Get the System Time +void OSGetSystemTime(SYSTEMTIME *system_time) +{ + os->GetSystemTime(system_time); +} + +// Sleep the thread +void OSSleep(UINT time) +{ + os->Sleep(time); +} + +// Create a Lock +LOCK *OSNewLock() +{ + return os->NewLock(); +} + +// Lock +bool OSLock(LOCK *lock) +{ + return os->Lock(lock); +} + +// Unlock +void OSUnlock(LOCK *lock) +{ + os->Unlock(lock); +} + +// Delete the lock +void OSDeleteLock(LOCK *lock) +{ + os->DeleteLock(lock); +} + +// Event initialization +void OSInitEvent(EVENT *event) +{ + os->InitEvent(event); +} + +// Set event +void OSSetEvent(EVENT *event) +{ + os->SetEvent(event); +} + +// Wait for event +bool OSWaitEvent(EVENT *event, UINT timeout) +{ + return os->WaitEvent(event, timeout); +} + +// Release of the event +void OSFreeEvent(EVENT *event) +{ + os->FreeEvent(event); +} + diff --git a/src/Mayaqua/OS.h b/src/Mayaqua/OS.h index 247eed1e..d76db0e6 100644 --- a/src/Mayaqua/OS.h +++ b/src/Mayaqua/OS.h @@ -1,131 +1,131 @@ -// SoftEther VPN Source Code - Developer Edition Master Branch -// Mayaqua Kernel - - -// OS.h -// Header of OS.c - -#ifndef OS_H -#define OS_H - -// Function prototype -char *OsTypeToStr(UINT type); - -void OSInit(); -void OSFree(); -void *OSMemoryAlloc(UINT size); -void *OSMemoryReAlloc(void *addr, UINT size); -void OSMemoryFree(void *addr); -UINT OSGetTick(); -void OSGetSystemTime(SYSTEMTIME *system_time); -void OSSleep(UINT time); -LOCK *OSNewLock(); -bool OSLock(LOCK *lock); -void OSUnlock(LOCK *lock); -void OSDeleteLock(LOCK *lock); -void OSInitEvent(EVENT *event); -void OSSetEvent(EVENT *event); -bool OSWaitEvent(EVENT *event, UINT timeout); -void OSFreeEvent(EVENT *event); -bool OSWaitThread(THREAD *t); -void OSFreeThread(THREAD *t); -bool OSInitThread(THREAD *t); -void *OSFileOpenW(wchar_t *name, bool write_mode, bool read_lock); -void *OSFileCreateW(wchar_t *name); -bool OSFileWrite(void *pData, void *buf, UINT size); -bool OSFileRead(void *pData, void *buf, UINT size); -void OSFileClose(void *pData, bool no_flush); -void OSFileFlush(void *pData); -UINT64 OSFileSize(void *pData); -bool OSFileSeek(void *pData, UINT mode, int offset); -bool OSFileDeleteW(wchar_t *name); -bool OSMakeDirW(wchar_t *name); -bool OSDeleteDirW(wchar_t *name); -CALLSTACK_DATA *OSGetCallStack(); -bool OSGetCallStackSymbolInfo(CALLSTACK_DATA *s); -bool OSFileRenameW(wchar_t *old_name, wchar_t *new_name); -UINT OSThreadId(); -bool OSRun(char *filename, char *arg, bool hide, bool wait); -bool OSRunW(wchar_t *filename, wchar_t *arg, bool hide, bool wait); -bool OSIsSupportedOs(); -void OSGetOsInfo(OS_INFO *info); -void OSAlert(char *msg, char *caption); -void OSAlertW(wchar_t *msg, wchar_t *caption); -char* OSGetProductId(); -void OSSetHighPriority(); -void OSRestorePriority(); -void *OSNewSingleInstance(char *instance_name); -void OSFreeSingleInstance(void *data); -void OSGetMemInfo(MEMINFO *info); -void OSYield(); - -// Dispatch table -typedef struct OS_DISPATCH_TABLE -{ - void (*Init)(); - void (*Free)(); - void *(*MemoryAlloc)(UINT size); - void *(*MemoryReAlloc)(void *addr, UINT size); - void (*MemoryFree)(void *addr); - UINT (*GetTick)(); - void (*GetSystemTime)(SYSTEMTIME *system_time); - void (*Inc32)(UINT *value); - void (*Dec32)(UINT *value); - void (*Sleep)(UINT time); - LOCK *(*NewLock)(); - bool (*Lock)(LOCK *lock); - void (*Unlock)(LOCK *lock); - void (*DeleteLock)(LOCK *lock); - void (*InitEvent)(EVENT *event); - void (*SetEvent)(EVENT *event); - void (*ResetEvent)(EVENT *event); - bool (*WaitEvent)(EVENT *event, UINT timeout); - void (*FreeEvent)(EVENT *event); - bool (*WaitThread)(THREAD *t); - void (*FreeThread)(THREAD *t); - bool (*InitThread)(THREAD *t); - UINT (*ThreadId)(); - void *(*FileOpen)(char *name, bool write_mode, bool read_lock); - void *(*FileOpenW)(wchar_t *name, bool write_mode, bool read_lock); - void *(*FileCreate)(char *name); - void *(*FileCreateW)(wchar_t *name); - bool (*FileWrite)(void *pData, void *buf, UINT size); - bool (*FileRead)(void *pData, void *buf, UINT size); - void (*FileClose)(void *pData, bool no_flush); - void (*FileFlush)(void *pData); - UINT64 (*FileSize)(void *pData); - bool (*FileSeek)(void *pData, UINT mode, int offset); - bool (*FileDelete)(char *name); - bool (*FileDeleteW)(wchar_t *name); - bool (*MakeDir)(char *name); - bool (*MakeDirW)(wchar_t *name); - bool (*DeleteDir)(char *name); - bool (*DeleteDirW)(wchar_t *name); - CALLSTACK_DATA *(*GetCallStack)(); - bool (*GetCallStackSymbolInfo)(CALLSTACK_DATA *s); - bool (*FileRename)(char *old_name, char *new_name); - bool (*FileRenameW)(wchar_t *old_name, wchar_t *new_name); - bool (*Run)(char *filename, char *arg, bool hide, bool wait); - bool (*RunW)(wchar_t *filename, wchar_t *arg, bool hide, bool wait); - bool (*IsSupportedOs)(); - void (*GetOsInfo)(OS_INFO *info); - void (*Alert)(char *msg, char *caption); - void (*AlertW)(wchar_t *msg, wchar_t *caption); - char *(*GetProductId)(); - void (*SetHighPriority)(); - void (*RestorePriority)(); - void *(*NewSingleInstance)(char *instance_name); - void (*FreeSingleInstance)(void *data); - void (*GetMemInfo)(MEMINFO *info); - void (*Yield)(); -} OS_DISPATCH_TABLE; - -// Include the OS-specific header -#ifdef OS_WIN32 -#include -#else //OS_WIN32 -#include -#endif // OS_WIN32 - -#endif // OS_H - +// SoftEther VPN Source Code - Developer Edition Master Branch +// Mayaqua Kernel + + +// OS.h +// Header of OS.c + +#ifndef OS_H +#define OS_H + +// Function prototype +char *OsTypeToStr(UINT type); + +void OSInit(); +void OSFree(); +void *OSMemoryAlloc(UINT size); +void *OSMemoryReAlloc(void *addr, UINT size); +void OSMemoryFree(void *addr); +UINT OSGetTick(); +void OSGetSystemTime(SYSTEMTIME *system_time); +void OSSleep(UINT time); +LOCK *OSNewLock(); +bool OSLock(LOCK *lock); +void OSUnlock(LOCK *lock); +void OSDeleteLock(LOCK *lock); +void OSInitEvent(EVENT *event); +void OSSetEvent(EVENT *event); +bool OSWaitEvent(EVENT *event, UINT timeout); +void OSFreeEvent(EVENT *event); +bool OSWaitThread(THREAD *t); +void OSFreeThread(THREAD *t); +bool OSInitThread(THREAD *t); +void *OSFileOpenW(wchar_t *name, bool write_mode, bool read_lock); +void *OSFileCreateW(wchar_t *name); +bool OSFileWrite(void *pData, void *buf, UINT size); +bool OSFileRead(void *pData, void *buf, UINT size); +void OSFileClose(void *pData, bool no_flush); +void OSFileFlush(void *pData); +UINT64 OSFileSize(void *pData); +bool OSFileSeek(void *pData, UINT mode, int offset); +bool OSFileDeleteW(wchar_t *name); +bool OSMakeDirW(wchar_t *name); +bool OSDeleteDirW(wchar_t *name); +CALLSTACK_DATA *OSGetCallStack(); +bool OSGetCallStackSymbolInfo(CALLSTACK_DATA *s); +bool OSFileRenameW(wchar_t *old_name, wchar_t *new_name); +UINT OSThreadId(); +bool OSRun(char *filename, char *arg, bool hide, bool wait); +bool OSRunW(wchar_t *filename, wchar_t *arg, bool hide, bool wait); +bool OSIsSupportedOs(); +void OSGetOsInfo(OS_INFO *info); +void OSAlert(char *msg, char *caption); +void OSAlertW(wchar_t *msg, wchar_t *caption); +char* OSGetProductId(); +void OSSetHighPriority(); +void OSRestorePriority(); +void *OSNewSingleInstance(char *instance_name); +void OSFreeSingleInstance(void *data); +void OSGetMemInfo(MEMINFO *info); +void OSYield(); + +// Dispatch table +typedef struct OS_DISPATCH_TABLE +{ + void (*Init)(); + void (*Free)(); + void *(*MemoryAlloc)(UINT size); + void *(*MemoryReAlloc)(void *addr, UINT size); + void (*MemoryFree)(void *addr); + UINT (*GetTick)(); + void (*GetSystemTime)(SYSTEMTIME *system_time); + void (*Inc32)(UINT *value); + void (*Dec32)(UINT *value); + void (*Sleep)(UINT time); + LOCK *(*NewLock)(); + bool (*Lock)(LOCK *lock); + void (*Unlock)(LOCK *lock); + void (*DeleteLock)(LOCK *lock); + void (*InitEvent)(EVENT *event); + void (*SetEvent)(EVENT *event); + void (*ResetEvent)(EVENT *event); + bool (*WaitEvent)(EVENT *event, UINT timeout); + void (*FreeEvent)(EVENT *event); + bool (*WaitThread)(THREAD *t); + void (*FreeThread)(THREAD *t); + bool (*InitThread)(THREAD *t); + UINT (*ThreadId)(); + void *(*FileOpen)(char *name, bool write_mode, bool read_lock); + void *(*FileOpenW)(wchar_t *name, bool write_mode, bool read_lock); + void *(*FileCreate)(char *name); + void *(*FileCreateW)(wchar_t *name); + bool (*FileWrite)(void *pData, void *buf, UINT size); + bool (*FileRead)(void *pData, void *buf, UINT size); + void (*FileClose)(void *pData, bool no_flush); + void (*FileFlush)(void *pData); + UINT64 (*FileSize)(void *pData); + bool (*FileSeek)(void *pData, UINT mode, int offset); + bool (*FileDelete)(char *name); + bool (*FileDeleteW)(wchar_t *name); + bool (*MakeDir)(char *name); + bool (*MakeDirW)(wchar_t *name); + bool (*DeleteDir)(char *name); + bool (*DeleteDirW)(wchar_t *name); + CALLSTACK_DATA *(*GetCallStack)(); + bool (*GetCallStackSymbolInfo)(CALLSTACK_DATA *s); + bool (*FileRename)(char *old_name, char *new_name); + bool (*FileRenameW)(wchar_t *old_name, wchar_t *new_name); + bool (*Run)(char *filename, char *arg, bool hide, bool wait); + bool (*RunW)(wchar_t *filename, wchar_t *arg, bool hide, bool wait); + bool (*IsSupportedOs)(); + void (*GetOsInfo)(OS_INFO *info); + void (*Alert)(char *msg, char *caption); + void (*AlertW)(wchar_t *msg, wchar_t *caption); + char *(*GetProductId)(); + void (*SetHighPriority)(); + void (*RestorePriority)(); + void *(*NewSingleInstance)(char *instance_name); + void (*FreeSingleInstance)(void *data); + void (*GetMemInfo)(MEMINFO *info); + void (*Yield)(); +} OS_DISPATCH_TABLE; + +// Include the OS-specific header +#ifdef OS_WIN32 +#include +#else //OS_WIN32 +#include +#endif // OS_WIN32 + +#endif // OS_H + diff --git a/src/Mayaqua/Object.c b/src/Mayaqua/Object.c index 904aa344..0034fe4e 100644 --- a/src/Mayaqua/Object.c +++ b/src/Mayaqua/Object.c @@ -1,495 +1,495 @@ -// SoftEther VPN Source Code - Developer Edition Master Branch -// Mayaqua Kernel - - -// Object.c -// Object management code - -#include - -#include -#include -#include -#include -#include -#include -#include -#include - -// Thread to try to lock -void CheckDeadLockThread(THREAD *t, void *param) -{ - DEADCHECK *c = (DEADCHECK *)param; - - if (t == NULL || c == NULL) - { - return; - } - - NoticeThreadInit(t); - - Lock(c->Lock); - Unlock(c->Lock); - c->Unlocked = true; -} - -// Deadlock Detection -void CheckDeadLock(LOCK *lock, UINT timeout, char *name) -{ - DEADCHECK c; - THREAD *t; - char msg[MAX_PATH]; - - if (lock == NULL) - { - return; - } - if (name == NULL) - { - name = "Unknown"; - } - - Format(msg, sizeof(msg), "error: CheckDeadLock() Failed: %s\n", name); - - Zero(&c, sizeof(c)); - c.Lock = lock; - c.Timeout = timeout; - c.Unlocked = false; - - t = NewThread(CheckDeadLockThread, &c); - WaitThreadInit(t); - if (WaitThread(t, timeout) == false) - { - if (c.Unlocked == false) - { - // Deadlock occured - AbortExitEx(msg); - } - else - { - WaitThread(t, INFINITE); - } - } - - ReleaseThread(t); -} - -// Create a lock object -LOCK *NewLockMain() -{ - LOCK *lock; - UINT retry = 0; - - while (true) - { - if ((retry++) > OBJECT_ALLOC__MAX_RETRY) - { - AbortExitEx("error: OSNewLock() failed.\n\n"); - } - lock = OSNewLock(); - if (lock != NULL) - { - break; - } - SleepThread(OBJECT_ALLOC_FAIL_SLEEP_TIME); - } - - return lock; -} -LOCK *NewLock() -{ - LOCK *lock = NewLockMain(); - - // KS - KS_INC(KS_NEWLOCK_COUNT); - KS_INC(KS_CURRENT_LOCK_COUNT); - - return lock; -} - -// Delete the lock object -void DeleteLock(LOCK *lock) -{ - // Validate arguments - if (lock == NULL) - { - return; - } - - // KS - KS_INC(KS_DELETELOCK_COUNT); - KS_DEC(KS_CURRENT_LOCK_COUNT); - - OSDeleteLock(lock); -} - -// Lock -bool LockInner(LOCK *lock) -{ - // Validate arguments - if (lock == NULL) - { - return false; - } - - // KS - KS_INC(KS_LOCK_COUNT); - KS_INC(KS_CURRENT_LOCKED_COUNT); - - return OSLock(lock); -} - -// Unlock -void UnlockInner(LOCK *lock) -{ - // Validate arguments - if (lock == NULL) - { - return; - } - - // KS - KS_INC(KS_UNLOCK_COUNT); - KS_DEC(KS_CURRENT_LOCKED_COUNT); - - OSUnlock(lock); -} - -// Creating a counter -COUNTER *NewCounter() -{ - COUNTER *c; - - // Memory allocation - c = Malloc(sizeof(COUNTER)); - - // Initialization - c->Ready = true; - c->c = 0; - - // Lock created - c->lock = NewLock(); - - // KS - KS_INC(KS_NEW_COUNTER_COUNT); - - return c; -} - -// Delete the counter -void DeleteCounter(COUNTER *c) -{ - // Validate arguments - if (c == NULL) - { - return; - } - - // KS - KS_INC(KS_DELETE_COUNTER_COUNT); - KS_SUB(KS_CURRENT_COUNT, c->c); - - DeleteLock(c->lock); - Free(c); -} - -// Get the count value -UINT Count(COUNTER *c) -{ - UINT ret; - // Validate arguments - if (c == NULL) - { - return 0; - } - if (c->Ready == false) - { - return 0; - } - - Lock(c->lock); - { - ret = c->c; - } - Unlock(c->lock); - - return ret; -} - -// Increment -UINT Inc(COUNTER *c) -{ - UINT ret; - // Validate arguments - if (c == NULL) - { - return 0; - } - if (c->Ready == false) - { - return 0; - } - - Lock(c->lock); - { - c->c++; - ret = c->c; - } - Unlock(c->lock); - - // KS - KS_INC(KS_INC_COUNT); - KS_INC(KS_CURRENT_COUNT); - - return ret; -} - -// Decrement -UINT Dec(COUNTER *c) -{ - UINT ret; - // Validate arguments - if (c == NULL) - { - return 0; - } - if (c->Ready == false) - { - return 0; - } - - Lock(c->lock); - { - if (c->c != 0) - { - c->c--; - ret = c->c; - } - else - { - ret = 0; - } - } - Unlock(c->lock); - - // KS - KS_INC(KS_DEC_COUNT); - KS_DEC(KS_CURRENT_COUNT); - - return ret; -} - - -// Release of the reference counter -UINT Release(REF *ref) -{ - UINT c; - // Validate arguments - if (ref == NULL) - { - return 0; - } - - // KS - KS_INC(KS_RELEASE_COUNT); - KS_DEC(KS_CURRENT_REFED_COUNT); - - c = Dec(ref->c); - if (c == 0) - { - // KS - KS_DEC(KS_CURRENT_REF_COUNT); - KS_INC(KS_FREEREF_COUNT); - - DeleteCounter(ref->c); - ref->c = 0; - Free(ref); - } - return c; -} - -// Increase of the reference counter -UINT AddRef(REF *ref) -{ - UINT c; - // Validate arguments - if (ref == NULL) - { - return 0; - } - - c = Inc(ref->c); - - // KS - KS_INC(KS_ADDREF_COUNT); - KS_INC(KS_CURRENT_REFED_COUNT); - - return c; -} - -// Create a reference counter -REF *NewRef() -{ - REF *ref; - - // Memory allocation - ref = Malloc(sizeof(REF)); - - // Create a Counter - ref->c = NewCounter(); - - // Increment only once - Inc(ref->c); - - // KS - KS_INC(KS_NEWREF_COUNT); - KS_INC(KS_CURRENT_REF_COUNT); - KS_INC(KS_ADDREF_COUNT); - KS_INC(KS_CURRENT_REFED_COUNT); - - return ref; -} - -// Creating an event object -EVENT *NewEvent() -{ - // Memory allocation - EVENT *e = Malloc(sizeof(EVENT)); - - // Reference counter - e->ref = NewRef(); - - // Event initialization - OSInitEvent(e); - - // KS - KS_INC(KS_NEWEVENT_COUNT); - - return e; -} - -// Release of the event -void ReleaseEvent(EVENT *e) -{ - // Validate arguments - if (e == NULL) - { - return; - } - - if (Release(e->ref) == 0) - { - CleanupEvent(e); - } -} - -// Delete the event -void CleanupEvent(EVENT *e) -{ - // Validate arguments - if (e == NULL) - { - return; - } - - // Release event - OSFreeEvent(e); - - // Memory release - Free(e); - - // KS - KS_INC(KS_FREEEVENT_COUNT); -} - -// Set event -void Set(EVENT *e) -{ - // Validate arguments - if (e == NULL) - { - return; - } - - OSSetEvent(e); -} - -// Wait for event -bool Wait(EVENT *e, UINT timeout) -{ - // Validate arguments - if (e == NULL) - { - return false; - } - - // KS - KS_INC(KS_WAIT_COUNT); - - return OSWaitEvent(e, timeout); -} - -// Wait for a event until the cancel flag becomes true -bool WaitEx(EVENT *e, UINT timeout, volatile bool *cancel) -{ - bool dummy_bool = false; - UINT64 start, giveup; - // Validate arguments - if (cancel == NULL) - { - cancel = &dummy_bool; - } - - start = Tick64(); - - if (timeout == INFINITE || timeout == 0x7FFFFFFF) - { - giveup = 0; - } - else - { - giveup = start + (UINT64)timeout; - } - - while (true) - { - UINT64 now = Tick64(); - UINT interval_to_giveup = (UINT)(giveup - now); - if (giveup == 0) - { - interval_to_giveup = INFINITE; - } - else - { - if (now >= giveup) - { - // Time-out occurs - return false; - } - } - - interval_to_giveup = MIN(interval_to_giveup, 25); - - if (*cancel) - { - // Cancel flag is set to true. Time-out occurs - return false; - } - - if (e != NULL) - { - if (Wait(e, interval_to_giveup)) - { - // Event is set - return true; - } - } - else - { - SleepThread(interval_to_giveup); - } - } -} - - - +// SoftEther VPN Source Code - Developer Edition Master Branch +// Mayaqua Kernel + + +// Object.c +// Object management code + +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +// Thread to try to lock +void CheckDeadLockThread(THREAD *t, void *param) +{ + DEADCHECK *c = (DEADCHECK *)param; + + if (t == NULL || c == NULL) + { + return; + } + + NoticeThreadInit(t); + + Lock(c->Lock); + Unlock(c->Lock); + c->Unlocked = true; +} + +// Deadlock Detection +void CheckDeadLock(LOCK *lock, UINT timeout, char *name) +{ + DEADCHECK c; + THREAD *t; + char msg[MAX_PATH]; + + if (lock == NULL) + { + return; + } + if (name == NULL) + { + name = "Unknown"; + } + + Format(msg, sizeof(msg), "error: CheckDeadLock() Failed: %s\n", name); + + Zero(&c, sizeof(c)); + c.Lock = lock; + c.Timeout = timeout; + c.Unlocked = false; + + t = NewThread(CheckDeadLockThread, &c); + WaitThreadInit(t); + if (WaitThread(t, timeout) == false) + { + if (c.Unlocked == false) + { + // Deadlock occured + AbortExitEx(msg); + } + else + { + WaitThread(t, INFINITE); + } + } + + ReleaseThread(t); +} + +// Create a lock object +LOCK *NewLockMain() +{ + LOCK *lock; + UINT retry = 0; + + while (true) + { + if ((retry++) > OBJECT_ALLOC__MAX_RETRY) + { + AbortExitEx("error: OSNewLock() failed.\n\n"); + } + lock = OSNewLock(); + if (lock != NULL) + { + break; + } + SleepThread(OBJECT_ALLOC_FAIL_SLEEP_TIME); + } + + return lock; +} +LOCK *NewLock() +{ + LOCK *lock = NewLockMain(); + + // KS + KS_INC(KS_NEWLOCK_COUNT); + KS_INC(KS_CURRENT_LOCK_COUNT); + + return lock; +} + +// Delete the lock object +void DeleteLock(LOCK *lock) +{ + // Validate arguments + if (lock == NULL) + { + return; + } + + // KS + KS_INC(KS_DELETELOCK_COUNT); + KS_DEC(KS_CURRENT_LOCK_COUNT); + + OSDeleteLock(lock); +} + +// Lock +bool LockInner(LOCK *lock) +{ + // Validate arguments + if (lock == NULL) + { + return false; + } + + // KS + KS_INC(KS_LOCK_COUNT); + KS_INC(KS_CURRENT_LOCKED_COUNT); + + return OSLock(lock); +} + +// Unlock +void UnlockInner(LOCK *lock) +{ + // Validate arguments + if (lock == NULL) + { + return; + } + + // KS + KS_INC(KS_UNLOCK_COUNT); + KS_DEC(KS_CURRENT_LOCKED_COUNT); + + OSUnlock(lock); +} + +// Creating a counter +COUNTER *NewCounter() +{ + COUNTER *c; + + // Memory allocation + c = Malloc(sizeof(COUNTER)); + + // Initialization + c->Ready = true; + c->c = 0; + + // Lock created + c->lock = NewLock(); + + // KS + KS_INC(KS_NEW_COUNTER_COUNT); + + return c; +} + +// Delete the counter +void DeleteCounter(COUNTER *c) +{ + // Validate arguments + if (c == NULL) + { + return; + } + + // KS + KS_INC(KS_DELETE_COUNTER_COUNT); + KS_SUB(KS_CURRENT_COUNT, c->c); + + DeleteLock(c->lock); + Free(c); +} + +// Get the count value +UINT Count(COUNTER *c) +{ + UINT ret; + // Validate arguments + if (c == NULL) + { + return 0; + } + if (c->Ready == false) + { + return 0; + } + + Lock(c->lock); + { + ret = c->c; + } + Unlock(c->lock); + + return ret; +} + +// Increment +UINT Inc(COUNTER *c) +{ + UINT ret; + // Validate arguments + if (c == NULL) + { + return 0; + } + if (c->Ready == false) + { + return 0; + } + + Lock(c->lock); + { + c->c++; + ret = c->c; + } + Unlock(c->lock); + + // KS + KS_INC(KS_INC_COUNT); + KS_INC(KS_CURRENT_COUNT); + + return ret; +} + +// Decrement +UINT Dec(COUNTER *c) +{ + UINT ret; + // Validate arguments + if (c == NULL) + { + return 0; + } + if (c->Ready == false) + { + return 0; + } + + Lock(c->lock); + { + if (c->c != 0) + { + c->c--; + ret = c->c; + } + else + { + ret = 0; + } + } + Unlock(c->lock); + + // KS + KS_INC(KS_DEC_COUNT); + KS_DEC(KS_CURRENT_COUNT); + + return ret; +} + + +// Release of the reference counter +UINT Release(REF *ref) +{ + UINT c; + // Validate arguments + if (ref == NULL) + { + return 0; + } + + // KS + KS_INC(KS_RELEASE_COUNT); + KS_DEC(KS_CURRENT_REFED_COUNT); + + c = Dec(ref->c); + if (c == 0) + { + // KS + KS_DEC(KS_CURRENT_REF_COUNT); + KS_INC(KS_FREEREF_COUNT); + + DeleteCounter(ref->c); + ref->c = 0; + Free(ref); + } + return c; +} + +// Increase of the reference counter +UINT AddRef(REF *ref) +{ + UINT c; + // Validate arguments + if (ref == NULL) + { + return 0; + } + + c = Inc(ref->c); + + // KS + KS_INC(KS_ADDREF_COUNT); + KS_INC(KS_CURRENT_REFED_COUNT); + + return c; +} + +// Create a reference counter +REF *NewRef() +{ + REF *ref; + + // Memory allocation + ref = Malloc(sizeof(REF)); + + // Create a Counter + ref->c = NewCounter(); + + // Increment only once + Inc(ref->c); + + // KS + KS_INC(KS_NEWREF_COUNT); + KS_INC(KS_CURRENT_REF_COUNT); + KS_INC(KS_ADDREF_COUNT); + KS_INC(KS_CURRENT_REFED_COUNT); + + return ref; +} + +// Creating an event object +EVENT *NewEvent() +{ + // Memory allocation + EVENT *e = Malloc(sizeof(EVENT)); + + // Reference counter + e->ref = NewRef(); + + // Event initialization + OSInitEvent(e); + + // KS + KS_INC(KS_NEWEVENT_COUNT); + + return e; +} + +// Release of the event +void ReleaseEvent(EVENT *e) +{ + // Validate arguments + if (e == NULL) + { + return; + } + + if (Release(e->ref) == 0) + { + CleanupEvent(e); + } +} + +// Delete the event +void CleanupEvent(EVENT *e) +{ + // Validate arguments + if (e == NULL) + { + return; + } + + // Release event + OSFreeEvent(e); + + // Memory release + Free(e); + + // KS + KS_INC(KS_FREEEVENT_COUNT); +} + +// Set event +void Set(EVENT *e) +{ + // Validate arguments + if (e == NULL) + { + return; + } + + OSSetEvent(e); +} + +// Wait for event +bool Wait(EVENT *e, UINT timeout) +{ + // Validate arguments + if (e == NULL) + { + return false; + } + + // KS + KS_INC(KS_WAIT_COUNT); + + return OSWaitEvent(e, timeout); +} + +// Wait for a event until the cancel flag becomes true +bool WaitEx(EVENT *e, UINT timeout, volatile bool *cancel) +{ + bool dummy_bool = false; + UINT64 start, giveup; + // Validate arguments + if (cancel == NULL) + { + cancel = &dummy_bool; + } + + start = Tick64(); + + if (timeout == INFINITE || timeout == 0x7FFFFFFF) + { + giveup = 0; + } + else + { + giveup = start + (UINT64)timeout; + } + + while (true) + { + UINT64 now = Tick64(); + UINT interval_to_giveup = (UINT)(giveup - now); + if (giveup == 0) + { + interval_to_giveup = INFINITE; + } + else + { + if (now >= giveup) + { + // Time-out occurs + return false; + } + } + + interval_to_giveup = MIN(interval_to_giveup, 25); + + if (*cancel) + { + // Cancel flag is set to true. Time-out occurs + return false; + } + + if (e != NULL) + { + if (Wait(e, interval_to_giveup)) + { + // Event is set + return true; + } + } + else + { + SleepThread(interval_to_giveup); + } + } +} + + + diff --git a/src/Mayaqua/Object.h b/src/Mayaqua/Object.h index 4e63c3dd..92d65e22 100644 --- a/src/Mayaqua/Object.h +++ b/src/Mayaqua/Object.h @@ -1,109 +1,109 @@ -// SoftEther VPN Source Code - Developer Edition Master Branch -// Mayaqua Kernel - - -// Object.h -// Header of Object.c - -#ifndef OBJECT_H -#define OBJECT_H - - -// Constants -#define OBJECT_ALLOC_FAIL_SLEEP_TIME 150 -#define OBJECT_ALLOC__MAX_RETRY 30 - -// Lock object -struct LOCK -{ - void *pData; - bool Ready; -#ifdef OS_UNIX - UINT thread_id; - UINT locked_count; -#endif // OS_UNIX -#ifdef _DEBUG - char *FileName; - UINT Line; - UINT ThreadId; -#endif // _DEBUG -}; - -// Counter object -struct COUNTER -{ - LOCK *lock; - UINT c; - bool Ready; -}; - -// Reference counter -struct REF -{ - COUNTER *c; -}; - -// Event object -struct EVENT -{ - REF *ref; - void *pData; -}; - -// Deadlock detection -struct DEADCHECK -{ - LOCK *Lock; - UINT Timeout; - bool Unlocked; -}; - - -// Lock function -#ifndef _DEBUG - -#define Lock(lock) LockInner((lock)) -#define Unlock(lock) UnlockInner((lock)) - -#else // _DEBUG - -#define Lock(lock) \ - { \ - LockInner(lock); \ - if (lock != NULL) { lock->FileName = __FILE__; lock->Line = __LINE__; lock->ThreadId = ThreadId();} \ - } - -#define Unlock(lock) \ - { \ - if (lock != NULL) { lock->FileName = NULL; lock->Line = 0; lock->ThreadId = 0;} \ - UnlockInner(lock); \ - } - -#endif // _DEBUG - - -// Function prototype -LOCK *NewLock(); -LOCK *NewLockMain(); -void DeleteLock(LOCK *lock); -COUNTER *NewCounter(); -void UnlockInner(LOCK *lock); -bool LockInner(LOCK *lock); -void DeleteCounter(COUNTER *c); -UINT Count(COUNTER *c); -UINT Inc(COUNTER *c); -UINT Dec(COUNTER *c); -UINT Release(REF *ref); -UINT AddRef(REF *ref); -REF *NewRef(); -EVENT *NewEvent(); -void ReleaseEvent(EVENT *e); -void CleanupEvent(EVENT *e); -void Set(EVENT *e); -bool Wait(EVENT *e, UINT timeout); -bool WaitEx(EVENT *e, UINT timeout, volatile bool *cancel); -void CheckDeadLock(LOCK *lock, UINT timeout, char *name); -void CheckDeadLockThread(THREAD *t, void *param); - -#endif // OBJECT_H - +// SoftEther VPN Source Code - Developer Edition Master Branch +// Mayaqua Kernel + + +// Object.h +// Header of Object.c + +#ifndef OBJECT_H +#define OBJECT_H + + +// Constants +#define OBJECT_ALLOC_FAIL_SLEEP_TIME 150 +#define OBJECT_ALLOC__MAX_RETRY 30 + +// Lock object +struct LOCK +{ + void *pData; + bool Ready; +#ifdef OS_UNIX + UINT thread_id; + UINT locked_count; +#endif // OS_UNIX +#ifdef _DEBUG + char *FileName; + UINT Line; + UINT ThreadId; +#endif // _DEBUG +}; + +// Counter object +struct COUNTER +{ + LOCK *lock; + UINT c; + bool Ready; +}; + +// Reference counter +struct REF +{ + COUNTER *c; +}; + +// Event object +struct EVENT +{ + REF *ref; + void *pData; +}; + +// Deadlock detection +struct DEADCHECK +{ + LOCK *Lock; + UINT Timeout; + bool Unlocked; +}; + + +// Lock function +#ifndef _DEBUG + +#define Lock(lock) LockInner((lock)) +#define Unlock(lock) UnlockInner((lock)) + +#else // _DEBUG + +#define Lock(lock) \ + { \ + LockInner(lock); \ + if (lock != NULL) { lock->FileName = __FILE__; lock->Line = __LINE__; lock->ThreadId = ThreadId();} \ + } + +#define Unlock(lock) \ + { \ + if (lock != NULL) { lock->FileName = NULL; lock->Line = 0; lock->ThreadId = 0;} \ + UnlockInner(lock); \ + } + +#endif // _DEBUG + + +// Function prototype +LOCK *NewLock(); +LOCK *NewLockMain(); +void DeleteLock(LOCK *lock); +COUNTER *NewCounter(); +void UnlockInner(LOCK *lock); +bool LockInner(LOCK *lock); +void DeleteCounter(COUNTER *c); +UINT Count(COUNTER *c); +UINT Inc(COUNTER *c); +UINT Dec(COUNTER *c); +UINT Release(REF *ref); +UINT AddRef(REF *ref); +REF *NewRef(); +EVENT *NewEvent(); +void ReleaseEvent(EVENT *e); +void CleanupEvent(EVENT *e); +void Set(EVENT *e); +bool Wait(EVENT *e, UINT timeout); +bool WaitEx(EVENT *e, UINT timeout, volatile bool *cancel); +void CheckDeadLock(LOCK *lock, UINT timeout, char *name); +void CheckDeadLockThread(THREAD *t, void *param); + +#endif // OBJECT_H + diff --git a/src/Mayaqua/Pack.c b/src/Mayaqua/Pack.c index 5c11061f..d5113d47 100644 --- a/src/Mayaqua/Pack.c +++ b/src/Mayaqua/Pack.c @@ -1,2494 +1,2494 @@ -// SoftEther VPN Source Code - Developer Edition Master Branch -// Mayaqua Kernel - - -// Pack.c -// Data package code - -#include - -#include -#include -#include -#include -#include -#include -#include -#include - -// Get a list of the element names in the PACK -TOKEN_LIST *GetPackElementNames(PACK *p) -{ - TOKEN_LIST *ret; - UINT i; - // Validate arguments - if (p == NULL) - { - return NULL; - } - - ret = ZeroMalloc(sizeof(TOKEN_LIST)); - - ret->NumTokens = LIST_NUM(p->elements); - ret->Token = ZeroMalloc(sizeof(char *) * ret->NumTokens); - - for (i = 0;i < ret->NumTokens;i++) - { - ELEMENT *e = LIST_DATA(p->elements, i); - - ret->Token[i] = CopyStr(e->name); - } - - return ret; -} - -// Convert the BUF to a PACK -PACK *BufToPack(BUF *b) -{ - PACK *p; - // Validate arguments - if (b == NULL) - { - return NULL; - } - - p = NewPack(); - if (ReadPack(b, p) == false) - { - FreePack(p); - return NULL; - } - - return p; -} - -// Convert the PACK to the BUF -BUF *PackToBuf(PACK *p) -{ - BUF *b; - // Validate arguments - if (p == NULL) - { - return NULL; - } - - b = NewBuf(); - WritePack(b, p); - - return b; -} - -// Read the PACK -bool ReadPack(BUF *b, PACK *p) -{ - UINT i, num; - // Validate arguments - if (b == NULL || p == NULL) - { - return false; - } - - // The number of ELEMENTs - num = ReadBufInt(b); - if (num > MAX_ELEMENT_NUM) - { - // Number exceeds - return false; - } - - // Read the ELEMENT - for (i = 0;i < num;i++) - { - ELEMENT *e; - e = ReadElement(b); - if (AddElement(p, e) == false) - { - // Adding error - return false; - } - } - - return true; -} - -// Write down the PACK -void WritePack(BUF *b, PACK *p) -{ - UINT i; - // Validate arguments - if (b == NULL || p == NULL) - { - return; - } - - // The number of ELEMENTs - WriteBufInt(b, LIST_NUM(p->elements)); - - // Write the ELEMENT - for (i = 0;i < LIST_NUM(p->elements);i++) - { - ELEMENT *e = LIST_DATA(p->elements, i); - WriteElement(b, e); - } -} - -// Read the ELEMENT -ELEMENT *ReadElement(BUF *b) -{ - UINT i; - char name[MAX_ELEMENT_NAME_LEN + 1]; - UINT type, num_value; - VALUE **values; - ELEMENT *e; - // Validate arguments - if (b == NULL) - { - return NULL; - } - - // Name - if (ReadBufStr(b, name, sizeof(name)) == false) - { - return NULL; - } - - // Type of item - type = ReadBufInt(b); - - // Number of items - num_value = ReadBufInt(b); - if (num_value > MAX_VALUE_NUM) - { - // Number exceeds - return NULL; - } - - // VALUE - values = (VALUE **)Malloc(sizeof(VALUE *) * num_value); - for (i = 0;i < num_value;i++) - { - values[i] = ReadValue(b, type); - } - - // Create a ELEMENT - e = NewElement(name, type, num_value, values); - - Free(values); - - return e; -} - -// Write the ELEMENT -void WriteElement(BUF *b, ELEMENT *e) -{ - UINT i; - // Validate arguments - if (b == NULL || e == NULL) - { - return; - } - - // Name - WriteBufStr(b, e->name); - // Type of item - WriteBufInt(b, e->type); - // Number of items - WriteBufInt(b, e->num_value); - // VALUE - for (i = 0;i < e->num_value;i++) - { - VALUE *v = e->values[i]; - WriteValue(b, v, e->type); - } -} - -// Read the VALUE -VALUE *ReadValue(BUF *b, UINT type) -{ - UINT len; - BYTE *u; - void *data; - char *str; - wchar_t *unistr; - UINT unistr_size; - UINT size; - UINT u_size; - VALUE *v = NULL; - // Validate arguments - if (b == NULL) - { - return NULL; - } - - // Data item - switch (type) - { - case VALUE_INT: // Integer - v = NewIntValue(ReadBufInt(b)); - break; - case VALUE_INT64: - v = NewInt64Value(ReadBufInt64(b)); - break; - case VALUE_DATA: // Data - size = ReadBufInt(b); - if (size > MAX_VALUE_SIZE) - { - // Size over - break; - } - data = Malloc(size); - if (ReadBuf(b, data, size) != size) - { - // Read failure - Free(data); - break; - } - v = NewDataValue(data, size); - Free(data); - break; - case VALUE_STR: // ANSI string - len = ReadBufInt(b); - if (len > (MAX_VALUE_SIZE - 1)) - { - // Size over - break; - } - str = Malloc(len + 1); - // String body - if (ReadBuf(b, str, len) != len) - { - // Read failure - Free(str); - break; - } - str[len] = 0; - v = NewStrValue(str); - Free(str); - break; - case VALUE_UNISTR: // Unicode string - u_size = ReadBufInt(b); - if (u_size > MAX_VALUE_SIZE) - { - // Size over - break; - } - // Reading an UTF-8 string - u = ZeroMalloc(u_size + 1); - if (ReadBuf(b, u, u_size) != u_size) - { - // Read failure - Free(u); - break; - } - // Convert to a Unicode string - unistr_size = CalcUtf8ToUni(u, u_size); - if (unistr_size == 0) - { - Free(u); - break; - } - unistr = Malloc(unistr_size); - Utf8ToUni(unistr, unistr_size, u, u_size); - Free(u); - v = NewUniStrValue(unistr); - Free(unistr); - break; - } - - return v; -} - -// Write the VALUE -void WriteValue(BUF *b, VALUE *v, UINT type) -{ - UINT len; - BYTE *u; - UINT u_size; - // Validate arguments - if (b == NULL || v == NULL) - { - return; - } - - // Data item - switch (type) - { - case VALUE_INT: // Integer - WriteBufInt(b, v->IntValue); - break; - case VALUE_INT64: // 64 bit integer - WriteBufInt64(b, v->Int64Value); - break; - case VALUE_DATA: // Data - // Size - WriteBufInt(b, v->Size); - // Body - WriteBuf(b, v->Data, v->Size); - break; - case VALUE_STR: // ANSI string - len = StrLen(v->Str); - // Length - WriteBufInt(b, len); - // String body - WriteBuf(b, v->Str, len); - break; - case VALUE_UNISTR: // Unicode string - // Convert to UTF-8 - u_size = CalcUniToUtf8(v->UniStr) + 1; - u = ZeroMalloc(u_size); - UniToUtf8(u, u_size, v->UniStr); - // Size - WriteBufInt(b, u_size); - // UTF-8 string body - WriteBuf(b, u, u_size); - Free(u); - break; - } -} - -// Get data size -UINT GetDataValueSize(ELEMENT *e, UINT index) -{ - // Validate arguments - if (e == NULL) - { - return 0; - } - if (e->values == NULL) - { - return 0; - } - if (index >= e->num_value) - { - return 0; - } - if (e->values[index] == NULL) - { - return 0; - } - - return e->values[index]->Size; -} - -// Get the data -void *GetDataValue(ELEMENT *e, UINT index) -{ - // Validate arguments - if (e == NULL) - { - return NULL; - } - if (e->values == NULL) - { - return NULL; - } - if (index >= e->num_value) - { - return NULL; - } - if (e->values[index] == NULL) - { - return NULL; - } - - return e->values[index]->Data; -} - -// Get the Unicode string type -wchar_t *GetUniStrValue(ELEMENT *e, UINT index) -{ - // Validate arguments - if (e == NULL) - { - return 0; - } - if (index >= e->num_value) - { - return 0; - } - if (e->values[index] == NULL) - { - return NULL; - } - - return e->values[index]->UniStr; -} - -// Get the ANSI string type -char *GetStrValue(ELEMENT *e, UINT index) -{ - // Validate arguments - if (e == NULL) - { - return 0; - } - if (index >= e->num_value) - { - return 0; - } - if (e->values[index] == NULL) - { - return NULL; - } - - return e->values[index]->Str; -} - -// Get the 64 bit integer value -UINT64 GetInt64Value(ELEMENT *e, UINT index) -{ - // Validate arguments - if (e == NULL) - { - return 0; - } - if (index >= e->num_value) - { - return 0; - } - if (e->values[index] == NULL) - { - return 0; - } - - return e->values[index]->Int64Value; -} - -// Get the integer value -UINT GetIntValue(ELEMENT *e, UINT index) -{ - // Validate arguments - if (e == NULL) - { - return 0; - } - if (index >= e->num_value) - { - return 0; - } - if (e->values[index] == NULL) - { - return 0; - } - - return e->values[index]->IntValue; -} - -// Function of sort for PACK -int ComparePackName(void *p1, void *p2) -{ - ELEMENT *o1, *o2; - if (p1 == NULL || p2 == NULL) - { - return 0; - } - o1 = *(ELEMENT **)p1; - o2 = *(ELEMENT **)p2; - if (o1 == NULL || o2 == NULL) - { - return 0; - } - - return StrCmpi(o1->name, o2->name); -} - -// Delete the VALUE -void FreeValue(VALUE *v, UINT type) -{ - // Validate arguments - if (v == NULL) - { - return; - } - - switch (type) - { - case VALUE_INT: - case VALUE_INT64: - break; - case VALUE_DATA: - Free(v->Data); - break; - case VALUE_STR: - Free(v->Str); - break; - case VALUE_UNISTR: - Free(v->UniStr); - break; - } - - // Memory release - Free(v); -} - -// Create a VALUE of Unicode String type -VALUE *NewUniStrValue(wchar_t *str) -{ - VALUE *v; - // Validate arguments - if (str == NULL) - { - return NULL; - } - - // Memory allocation - v = Malloc(sizeof(VALUE)); - - // String copy - v->Size = UniStrSize(str); - v->UniStr = Malloc(v->Size); - UniStrCpy(v->UniStr, v->Size, str); - - UniTrim(v->UniStr); - - return v; -} - -// Creation of the VALUE of ANSI string type -VALUE *NewStrValue(char *str) -{ - VALUE *v; - // Validate arguments - if (str == NULL) - { - return NULL; - } - - // Memory allocation - v = Malloc(sizeof(VALUE)); - - // String copy - v->Size = StrLen(str) + 1; - v->Str = Malloc(v->Size); - StrCpy(v->Str, v->Size, str); - - Trim(v->Str); - - return v; -} - -// Create the VALUE of the data type -VALUE *NewDataValue(void *data, UINT size) -{ - VALUE *v; - // Validate arguments - if (data == NULL) - { - return NULL; - } - - // Memory allocation - v = Malloc(sizeof(VALUE)); - - // Data copy - v->Size = size; - v->Data = Malloc(v->Size); - Copy(v->Data, data, size); - - return v; -} - -// Create the VALUE of 64 bit integer type -VALUE *NewInt64Value(UINT64 i) -{ - VALUE *v; - - v = Malloc(sizeof(VALUE)); - v->Int64Value = i; - v->Size = sizeof(UINT64); - - return v; -} - -// Create the VALUE of integer type -VALUE *NewIntValue(UINT i) -{ - VALUE *v; - - // Memory allocation - v = Malloc(sizeof(VALUE)); - v->IntValue = i; - v->Size = sizeof(UINT); - - return v; -} - -// Delete the ELEMENT -void FreeElement(ELEMENT *e) -{ - UINT i; - // Validate arguments - if (e == NULL) - { - return; - } - - for (i = 0;i < e->num_value;i++) - { - FreeValue(e->values[i], e->type); - } - Free(e->values); - - Free(e); -} - -// Create a ELEMENT -ELEMENT *NewElement(char *name, UINT type, UINT num_value, VALUE **values) -{ - ELEMENT *e; - UINT i; - // Validate arguments - if (name == NULL || num_value == 0 || values == NULL) - { - return NULL; - } - - // Memory allocation - e = ZeroMalloc(sizeof(ELEMENT)); - StrCpy(e->name, sizeof(e->name), name); - e->num_value = num_value; - e->type = type; - - // Copy of the pointer list to the element - e->values = (VALUE **)ZeroMalloc(sizeof(VALUE *) * num_value); - for (i = 0;i < e->num_value;i++) - { - e->values[i] = values[i]; - } - - return e; -} - -// Search and retrieve a ELEMENT from the PACK -ELEMENT *GetElement(PACK *p, char *name, UINT type) -{ - ELEMENT t; - ELEMENT *e; - // Validate arguments - if (p == NULL || name == NULL) - { - return NULL; - } - - // Search - StrCpy(t.name, sizeof(t.name), name); - e = Search(p->elements, &t); - - if (e == NULL) - { - return NULL; - } - - // Type checking - if (type != INFINITE) - { - if (e->type != type) - { - return NULL; - } - } - - return e; -} - -// Check whether the specified element exists -bool IsElement(PACK *p, char *name) -{ - ELEMENT t; - ELEMENT *e; - // Validate arguments - if (p == NULL || name == NULL) - { - return false; - } - - // Search - StrCpy(t.name, sizeof(t.name), name); - e = Search(p->elements, &t); - - if (e == NULL) - { - return false; - } - - return true; -} - -// Remove the ELEMENT from the PACK -void DelElement(PACK *p, char *name) -{ - ELEMENT *e; - // Validate arguments - if (p == NULL || name == NULL) - { - return; - } - - e = GetElement(p, name, INFINITE); - if (e != NULL) - { - Delete(p->elements, e); - - FreeElement(e); - } -} - -// Add an ELEMENT to the PACK -bool AddElement(PACK *p, ELEMENT *e) -{ - // Validate arguments - if (p == NULL || e == NULL) - { - return false; - } - - // Size Check - if (LIST_NUM(p->elements) >= MAX_ELEMENT_NUM) - { - // Can not add any more - FreeElement(e); - return false; - } - - // Check whether there is another item which have same name - if (GetElement(p, e->name, INFINITE)) - { - // Exists - FreeElement(e); - return false; - } - - if (e->num_value == 0) - { - // VALUE without any items can not be added - FreeElement(e); - return false; - } - - // Set JsonHint_GroupName - StrCpy(e->JsonHint_GroupName, sizeof(e->JsonHint_GroupName), p->CurrentJsonHint_GroupName); - - // Adding - Add(p->elements, e); - return true; -} - -// Release of the PACK object -void FreePack(PACK *p) -{ - UINT i; - ELEMENT **elements; - // Validate arguments - if (p == NULL) - { - return; - } - - elements = ToArray(p->elements); - for (i = 0;i < LIST_NUM(p->elements);i++) - { - FreeElement(elements[i]); - } - Free(elements); - - if (p->json_subitem_names != NULL) - { - FreeStrList(p->json_subitem_names); - } - - ReleaseList(p->elements); - Free(p); -} - -// Create a PACK object -PACK *NewPack() -{ - PACK *p; - - // Memory allocation - p = ZeroMallocEx(sizeof(PACK), true); - - // Creating a List - p->elements = NewListFast(ComparePackName); - - return p; -} - -// Get the K from the PACK -K *PackGetK(PACK *p, char *name) -{ - K *k; - BUF *b; - // Validate arguments - if (p == NULL || name == NULL) - { - return NULL; - } - - b = PackGetBuf(p, name); - if (b == NULL) - { - return NULL; - } - - k = BufToK(b, true, false, NULL); - - if (k == NULL) - { - k = BufToK(b, true, true, NULL); - } - - FreeBuf(b); - - return k; -} - -// Get the X from the PACK -X *PackGetX(PACK *p, char *name) -{ - X *x; - BUF *b; - // Validate arguments - if (p == NULL || name == NULL) - { - return NULL; - } - - b = PackGetBuf(p, name); - if (b == NULL) - { - return NULL; - } - - x = BufToX(b, false); - - if (x == NULL) - { - x = BufToX(b, true); - } - - FreeBuf(b); - - return x; -} - -// Add the K to the PACK -ELEMENT *PackAddK(PACK *p, char *name, K *k) -{ - BUF *b; - ELEMENT *e = NULL; - // Validate arguments - if (p == NULL || name == NULL || k == NULL) - { - return NULL; - } - - b = KToBuf(k, false, NULL); - if (b == NULL) - { - return NULL; - } - - e = PackAddBuf(p, name, b); - FreeBuf(b); - - return e; -} - -// Add an X into the PACK -ELEMENT *PackAddX(PACK *p, char *name, X *x) -{ - BUF *b; - ELEMENT *e = NULL; - // Validate arguments - if (p == NULL || name == NULL || x == NULL) - { - return NULL; - } - - b = XToBuf(x, false); - if (b == NULL) - { - return NULL; - } - - e = PackAddBuf(p, name, b); - FreeBuf(b); - - return e; -} - -// Get a buffer from the PACK -BUF *PackGetBuf(PACK *p, char *name) -{ - return PackGetBufEx(p, name, 0); -} -BUF *PackGetBufEx(PACK *p, char *name, UINT index) -{ - UINT size; - void *tmp; - BUF *b; - // Validate arguments - if (p == NULL || name == NULL) - { - return NULL; - } - - size = PackGetDataSizeEx(p, name, index); - tmp = MallocEx(size, true); - if (PackGetDataEx(p, name, tmp, index) == false) - { - Free(tmp); - return NULL; - } - - b = NewBuf(); - WriteBuf(b, tmp, size); - SeekBuf(b, 0, 0); - - Free(tmp); - - return b; -} - -// Get the data from the PACK -bool PackGetData(PACK *p, char *name, void *data) -{ - return PackGetDataEx(p, name, data, 0); -} -bool PackGetDataEx(PACK *p, char *name, void *data, UINT index) -{ - ELEMENT *e; - // Validate arguments - if (p == NULL || name == NULL) - { - return false; - } - - e = GetElement(p, name, VALUE_DATA); - if (e == NULL) - { - return false; - } - Copy(data, GetDataValue(e, index), GetDataValueSize(e, index)); - return true; -} -bool PackGetData2(PACK *p, char *name, void *data, UINT size) -{ - return PackGetDataEx2(p, name, data, size, 0); -} -bool PackGetDataEx2(PACK *p, char *name, void *data, UINT size, UINT index) -{ - ELEMENT *e; - // Validate arguments - if (p == NULL || name == NULL) - { - return false; - } - - e = GetElement(p, name, VALUE_DATA); - if (e == NULL) - { - return false; - } - if (GetDataValueSize(e, index) != size) - { - return false; - } - Copy(data, GetDataValue(e, index), GetDataValueSize(e, index)); - return true; -} - -// Get the data size from the PACK -UINT PackGetDataSize(PACK *p, char *name) -{ - return PackGetDataSizeEx(p, name, 0); -} -UINT PackGetDataSizeEx(PACK *p, char *name, UINT index) -{ - ELEMENT *e; - // Validate arguments - if (p == NULL || name == NULL) - { - return 0; - } - - e = GetElement(p, name, VALUE_DATA); - if (e == NULL) - { - return 0; - } - return GetDataValueSize(e, index); -} - -// Get an integer from the PACK -UINT64 PackGetInt64(PACK *p, char *name) -{ - return PackGetInt64Ex(p, name, 0); -} -UINT64 PackGetInt64Ex(PACK *p, char *name, UINT index) -{ - ELEMENT *e; - // Validate arguments - if (p == NULL || name == NULL) - { - return 0; - } - - e = GetElement(p, name, VALUE_INT64); - if (e == NULL) - { - return 0; - } - return GetInt64Value(e, index); -} - -// Get the index number from the PACK -UINT PackGetIndexCount(PACK *p, char *name) -{ - ELEMENT *e; - // Validate arguments - if (p == NULL || name == NULL) - { - return 0; - } - - e = GetElement(p, name, INFINITE); - if (e == NULL) - { - return 0; - } - - return e->num_value; -} - -// Get the number from the PACK -UINT PackGetNum(PACK *p, char *name) -{ - return MIN(PackGetInt(p, name), 65536); -} - -// Get a bool type from the PACK -bool PackGetBool(PACK *p, char *name) -{ - return PackGetInt(p, name) == 0 ? false : true; -} -bool PackGetBoolEx(PACK *p, char *name, UINT index) -{ - return PackGetIntEx(p, name, index) == 0 ? false : true; -} - -// Set CurrentJsonHint_GroupName to PACK -void PackSetCurrentJsonGroupName(PACK *p, char *json_group_name) -{ - if (p == NULL) - { - return; - } - - if (json_group_name == NULL) - { - ClearStr(p->CurrentJsonHint_GroupName, sizeof(p->CurrentJsonHint_GroupName)); - } - else - { - StrCpy(p->CurrentJsonHint_GroupName, sizeof(p->CurrentJsonHint_GroupName), json_group_name); - - if (p->json_subitem_names == NULL) - { - p->json_subitem_names = NewStrList(); - } - - AddStrToStrListDistinct(p->json_subitem_names, json_group_name); - } -} - -// Add a bool type into the PACK -ELEMENT *PackAddBool(PACK *p, char *name, bool b) -{ - ELEMENT *e = PackAddInt(p, name, b ? 1 : 0); - if (e != NULL) - { - e->JsonHint_IsBool = true; - } - return e; -} -ELEMENT *PackAddBoolEx(PACK *p, char *name, bool b, UINT index, UINT total) -{ - ELEMENT *e = PackAddIntEx(p, name, b ? 1 : 0, index, total); - if (e != NULL) - { - e->JsonHint_IsBool = true; - } - return e; -} - -// Add the IPV6_ADDR to the PACK -ELEMENT *PackAddIp6AddrEx(PACK *p, char *name, IPV6_ADDR *addr, UINT index, UINT total) -{ - // Validate arguments - if (p == NULL || name == NULL || addr == NULL) - { - return NULL; - } - - return PackAddDataEx(p, name, addr, sizeof(IPV6_ADDR), index, total); -} -ELEMENT *PackAddIp6Addr(PACK *p, char *name, IPV6_ADDR *addr) -{ - return PackAddIp6AddrEx(p, name, addr, 0, 1); -} - -// Get an IPV6_ADDR from the PACK -bool PackGetIp6AddrEx(PACK *p, char *name, IPV6_ADDR *addr, UINT index) -{ - // Validate arguments - if (p == NULL || name == NULL || addr == NULL) - { - Zero(addr, sizeof(IPV6_ADDR)); - return false; - } - - return PackGetDataEx2(p, name, addr, sizeof(IPV6_ADDR), index); -} -bool PackGetIp6Addr(PACK *p, char *name, IPV6_ADDR *addr) -{ - return PackGetIp6AddrEx(p, name, addr, 0); -} - -// Add the IP to the PACK -void PackAddIp32Ex(PACK *p, char *name, UINT ip32, UINT index, UINT total) -{ - PackAddIp32Ex2(p, name, ip32, index, total, false); -} -void PackAddIp32Ex2(PACK *p, char *name, UINT ip32, UINT index, UINT total, bool is_single) -{ - IP ip; - // Validate arguments - if (p == NULL || name == NULL) - { - return; - } - - UINTToIP(&ip, ip32); - - PackAddIpEx2(p, name, &ip, index, total, is_single); -} -void PackAddIp32(PACK *p, char *name, UINT ip32) -{ - PackAddIp32Ex2(p, name, ip32, 0, 1, true); -} -void PackAddIpEx(PACK *p, char *name, IP *ip, UINT index, UINT total) -{ - PackAddIpEx2(p, name, ip, index, total, false); -} -void PackAddIpEx2(PACK *p, char *name, IP *ip, UINT index, UINT total, bool is_single) -{ - UINT i; - bool b = false; - char tmp[MAX_PATH]; - ELEMENT *e; - // Validate arguments - if (p == NULL || name == NULL || ip == NULL) - { - return; - } - if (total >= 2) - { - is_single = false; - } - - b = IsIP6(ip); - - Format(tmp, sizeof(tmp), "%s@ipv6_bool", name); - e = PackAddBoolEx(p, tmp, b, index, total); - if (e != NULL && is_single) e->JsonHint_IsArray = false; - if (e != NULL) e->JsonHint_IsIP = true; - - Format(tmp, sizeof(tmp), "%s@ipv6_array", name); - if (b) - { - e = PackAddDataEx(p, tmp, ip->ipv6_addr, sizeof(ip->ipv6_addr), index, total); - if (e != NULL && is_single) e->JsonHint_IsArray = false; - if (e != NULL) e->JsonHint_IsIP = true; - } - else - { - UCHAR dummy[16]; - - Zero(dummy, sizeof(dummy)); - - e = PackAddDataEx(p, tmp, dummy, sizeof(dummy), index, total); - if (e != NULL && is_single) e->JsonHint_IsArray = false; - if (e != NULL) e->JsonHint_IsIP = true; - } - - Format(tmp, sizeof(tmp), "%s@ipv6_scope_id", name); - if (b) - { - e = PackAddIntEx(p, tmp, ip->ipv6_scope_id, index, total); - if (e != NULL && is_single) e->JsonHint_IsArray = false; - if (e != NULL) e->JsonHint_IsIP = true; - } - else - { - e = PackAddIntEx(p, tmp, 0, index, total); - if (e != NULL && is_single) e->JsonHint_IsArray = false; - if (e != NULL) e->JsonHint_IsIP = true; - } - - i = IPToUINT(ip); - - if (IsBigEndian()) - { - i = Swap32(i); - } - - e = PackAddIntEx(p, name, i, index, total); - if (e != NULL && is_single) e->JsonHint_IsArray = false; - if (e != NULL) e->JsonHint_IsIP = true; -} -void PackAddIp(PACK *p, char *name, IP *ip) -{ - PackAddIpEx2(p, name, ip, 0, 1, true); -} - -// Get an IP from the PACK -UINT PackGetIp32Ex(PACK *p, char *name, UINT index) -{ - IP ip; - // Validate arguments - if (p == NULL || name == NULL) - { - return 0; - } - - if (PackGetIpEx(p, name, &ip, index) == false) - { - return 0; - } - - return IPToUINT(&ip); -} -UINT PackGetIp32(PACK *p, char *name) -{ - return PackGetIp32Ex(p, name, 0); -} -bool PackGetIpEx(PACK *p, char *name, IP *ip, UINT index) -{ - UINT i; - char tmp[MAX_PATH]; - // Validate arguments - if (p == NULL || ip == NULL || name == NULL) - { - return false; - } - - Format(tmp, sizeof(tmp), "%s@ipv6_bool", name); - if (PackGetBoolEx(p, tmp, index)) - { - UCHAR data[16]; - UINT scope_id; - - Zero(data, sizeof(data)); - - Format(tmp, sizeof(tmp), "%s@ipv6_array", name); - PackGetDataEx2(p, tmp, data, sizeof(data), index); - - Format(tmp, sizeof(tmp), "%s@ipv6_scope_id", name); - scope_id = PackGetIntEx(p, tmp, index); - - SetIP6(ip, data); - ip->ipv6_scope_id = scope_id; - } - else - { - if (GetElement(p, name, VALUE_INT) == NULL) - { - Zero(ip, sizeof(IP)); - return false; - } - - i = PackGetIntEx(p, name, index); - - if (IsBigEndian()) - { - i = Swap32(i); - } - - UINTToIP(ip, i); - } - - return true; -} -bool PackGetIp(PACK *p, char *name, IP *ip) -{ - return PackGetIpEx(p, name, ip, 0); -} - -// Check whether the specified value is existing on the Pack -bool PackIsValueExists(PACK *p, char *name) -{ - // Validate arguments - if (p == NULL || name == NULL) - { - return false; - } - - return IsElement(p, name); -} - -// Get an integer from the PACK -UINT PackGetInt(PACK *p, char *name) -{ - return PackGetIntEx(p, name, 0); -} -UINT PackGetIntEx(PACK *p, char *name, UINT index) -{ - ELEMENT *e; - // Validate arguments - if (p == NULL || name == NULL) - { - return 0; - } - - e = GetElement(p, name, VALUE_INT); - if (e == NULL) - { - return 0; - } - return GetIntValue(e, index); -} - -// Get an Unicode string from the PACK -bool PackGetUniStr(PACK *p, char *name, wchar_t *unistr, UINT size) -{ - return PackGetUniStrEx(p, name, unistr, size, 0); -} -bool PackGetUniStrEx(PACK *p, char *name, wchar_t *unistr, UINT size, UINT index) -{ - ELEMENT *e; - // Validate arguments - if (p == NULL || name == NULL || unistr == NULL || size == 0) - { - return false; - } - - unistr[0] = 0; - - e = GetElement(p, name, VALUE_UNISTR); - if (e == NULL) - { - return false; - } - UniStrCpy(unistr, size, GetUniStrValue(e, index)); - return true; -} - -// Compare strings in the PACK -bool PackCmpStr(PACK *p, char *name, char *str) -{ - char tmp[MAX_SIZE]; - - if (PackGetStr(p, name, tmp, sizeof(tmp)) == false) - { - return false; - } - - if (StrCmpi(tmp, str) == 0) - { - return true; - } - - return false; -} - -// Get a string from the PACK -bool PackGetStr(PACK *p, char *name, char *str, UINT size) -{ - return PackGetStrEx(p, name, str, size, 0); -} -bool PackGetStrEx(PACK *p, char *name, char *str, UINT size, UINT index) -{ - ELEMENT *e; - // Validate arguments - if (p == NULL || name == NULL || str == NULL || size == 0) - { - return false; - } - - str[0] = 0; - - e = GetElement(p, name, VALUE_STR); - if (e == NULL) - { - return false; - } - - StrCpy(str, size, GetStrValue(e, index)); - return true; -} - -// Get the string size from the PACK -bool PackGetStrSize(PACK *p, char *name) -{ - return PackGetStrSizeEx(p, name, 0); -} -bool PackGetStrSizeEx(PACK *p, char *name, UINT index) -{ - ELEMENT *e; - // Validate arguments - if (p == NULL || name == NULL) - { - return 0; - } - - e = GetElement(p, name, VALUE_STR); - if (e == NULL) - { - return 0; - } - return GetDataValueSize(e, index); -} - -// Add the buffer to the PACK (array) -ELEMENT *PackAddBufEx(PACK *p, char *name, BUF *b, UINT index, UINT total) -{ - // Validate arguments - if (p == NULL || name == NULL || b == NULL || total == 0) - { - return NULL; - } - - return PackAddDataEx(p, name, b->Buf, b->Size, index, total); -} - -// Add the data to the PACK (array) -ELEMENT *PackAddDataEx(PACK *p, char *name, void *data, UINT size, UINT index, UINT total) -{ - VALUE *v; - ELEMENT *e; - // Validate arguments - if (p == NULL || data == NULL || name == NULL || total == 0) - { - return NULL; - } - - v = NewDataValue(data, size); - e = GetElement(p, name, VALUE_DATA); - if (e != NULL) - { - if (e->num_value >= total) - { - FreeValue(e->values[index], VALUE_DATA); - e->values[index] = v; - } - else - { - FreeValue(v, VALUE_DATA); - } - } - else - { - e = ZeroMallocEx(sizeof(ELEMENT), true); - StrCpy(e->name, sizeof(e->name), name); - e->num_value = total; - e->type = VALUE_DATA; - e->values = ZeroMallocEx(sizeof(VALUE *) * total, true); - e->values[index] = v; - if (AddElement(p, e) == false) - { - return NULL; - } - } - - e->JsonHint_IsArray = true; - - return e; -} - -// Add the buffer to the PACK -ELEMENT *PackAddBuf(PACK *p, char *name, BUF *b) -{ - // Validate arguments - if (p == NULL || name == NULL || b == NULL) - { - return NULL; - } - - return PackAddData(p, name, b->Buf, b->Size); -} - -// Add the data to the PACK -ELEMENT *PackAddData(PACK *p, char *name, void *data, UINT size) -{ - VALUE *v; - ELEMENT *e; - // Validate arguments - if (p == NULL || data == NULL || name == NULL) - { - return NULL; - } - - v = NewDataValue(data, size); - e = NewElement(name, VALUE_DATA, 1, &v); - if (AddElement(p, e) == false) - { - return NULL; - } - - return e; -} - -// Add a 64 bit integer (array) to the PACK -ELEMENT *PackAddInt64Ex(PACK *p, char *name, UINT64 i, UINT index, UINT total) -{ - VALUE *v; - ELEMENT *e; - // Validate arguments - if (p == NULL || name == NULL || total == 0) - { - return NULL; - } - - v = NewInt64Value(i); - e = GetElement(p, name, VALUE_INT64); - if (e != NULL) - { - if (e->num_value >= total) - { - FreeValue(e->values[index], VALUE_INT64); - e->values[index] = v; - } - else - { - FreeValue(v, VALUE_INT64); - } - } - else - { - e = ZeroMallocEx(sizeof(ELEMENT), true); - StrCpy(e->name, sizeof(e->name), name); - e->num_value = total; - e->type = VALUE_INT64; - e->values = ZeroMallocEx(sizeof(VALUE *) * total, true); - e->values[index] = v; - - if (AddElement(p, e) == false) - { - return NULL; - } - } - - e->JsonHint_IsArray = true; - - return e; -} - -// Add an integer to the PACK (array) -ELEMENT *PackAddIntEx(PACK *p, char *name, UINT i, UINT index, UINT total) -{ - VALUE *v; - ELEMENT *e; - // Validate arguments - if (p == NULL || name == NULL || total == 0) - { - return NULL; - } - - v = NewIntValue(i); - e = GetElement(p, name, VALUE_INT); - if (e != NULL) - { - if (e->num_value >= total) - { - FreeValue(e->values[index], VALUE_INT); - e->values[index] = v; - } - else - { - FreeValue(v, VALUE_INT); - } - } - else - { - e = ZeroMallocEx(sizeof(ELEMENT), true); - StrCpy(e->name, sizeof(e->name), name); - e->num_value = total; - e->type = VALUE_INT; - e->values = ZeroMallocEx(sizeof(VALUE *) * total, true); - e->values[index] = v; - - if (AddElement(p, e) == false) - { - return NULL; - } - } - - e->JsonHint_IsArray = true; - - return e; -} - -// Add 64 bit integer time value to the PACK -ELEMENT *PackAddTime64(PACK *p, char *name, UINT64 i) -{ - ELEMENT *e = PackAddInt64(p, name, i); - if (e != NULL) - { - e->JsonHint_IsDateTime = true; - } - return e; -} -ELEMENT *PackAddTime64Ex(PACK *p, char *name, UINT64 i, UINT index, UINT total) -{ - ELEMENT *e = PackAddInt64Ex(p, name, i, index, total); - if (e != NULL) - { - e->JsonHint_IsDateTime = true; - } - return e; -} - - -// Add a 64 bit integer to the PACK -ELEMENT *PackAddInt64(PACK *p, char *name, UINT64 i) -{ - VALUE *v; - ELEMENT *e; - // Validate arguments - if (p == NULL || name == NULL) - { - return NULL; - } - - v = NewInt64Value(i); - e = NewElement(name, VALUE_INT64, 1, &v); - if (AddElement(p, e) == false) - { - return NULL; - } - return e; -} - -// Add the number of items to the PACK -ELEMENT *PackAddNum(PACK *p, char *name, UINT num) -{ - return PackAddInt(p, name, num); -} - -// Add an integer to the PACK -ELEMENT *PackAddInt(PACK *p, char *name, UINT i) -{ - VALUE *v; - ELEMENT *e = NULL; - // Validate arguments - if (p == NULL || name == NULL) - { - return NULL; - } - - v = NewIntValue(i); - e = NewElement(name, VALUE_INT, 1, &v); - if (AddElement(p, e) == false) - { - return NULL; - } - return e; -} - -// Add a Unicode string (array) to the PACK -ELEMENT *PackAddUniStrEx(PACK *p, char *name, wchar_t *unistr, UINT index, UINT total) -{ - VALUE *v; - ELEMENT *e; - // Validate arguments - if (p == NULL || name == NULL || unistr == NULL || total == 0) - { - return NULL; - } - - v = NewUniStrValue(unistr); - e = GetElement(p, name, VALUE_UNISTR); - if (e != NULL) - { - if (e->num_value >= total) - { - FreeValue(e->values[index], VALUE_UNISTR); - e->values[index] = v; - } - else - { - FreeValue(v, VALUE_UNISTR); - } - } - else - { - e = ZeroMallocEx(sizeof(ELEMENT), true); - StrCpy(e->name, sizeof(e->name), name); - e->num_value = total; - e->type = VALUE_UNISTR; - e->values = ZeroMallocEx(sizeof(VALUE *) * total, true); - e->values[index] = v; - if (AddElement(p, e) == false) - { - return NULL; - } - } - - e->JsonHint_IsArray = true; - - return e; -} - -// Add a Unicode string to the PACK -ELEMENT *PackAddUniStr(PACK *p, char *name, wchar_t *unistr) -{ - VALUE *v; - ELEMENT *e = NULL; - // Validate arguments - if (p == NULL || name == NULL || unistr == NULL) - { - return NULL; - } - - v = NewUniStrValue(unistr); - e = NewElement(name, VALUE_UNISTR, 1, &v); - if (AddElement(p, e) == false) - { - return NULL; - } - return e; -} - -// Add a string to the PACK (array) -ELEMENT *PackAddStrEx(PACK *p, char *name, char *str, UINT index, UINT total) -{ - VALUE *v; - ELEMENT *e; - // Validate arguments - if (p == NULL || name == NULL || str == NULL || total == 0) - { - return NULL; - } - - v = NewStrValue(str); - e = GetElement(p, name, VALUE_STR); - if (e != NULL) - { - if (e->num_value >= total) - { - FreeValue(e->values[index], VALUE_STR); - e->values[index] = v; - } - else - { - FreeValue(v, VALUE_STR); - } - } - else - { - e = ZeroMallocEx(sizeof(ELEMENT), true); - StrCpy(e->name, sizeof(e->name), name); - e->num_value = total; - e->type = VALUE_STR; - e->values = ZeroMallocEx(sizeof(VALUE *) * total, true); - e->values[index] = v; - if (AddElement(p, e) == false) - { - return NULL; - } - } - - e->JsonHint_IsArray = true; - - return e; -} - -// Add a string to the PACK -ELEMENT *PackAddStr(PACK *p, char *name, char *str) -{ - VALUE *v; - ELEMENT *e = NULL; - // Validate arguments - if (p == NULL || name == NULL || str == NULL) - { - return NULL; - } - - v = NewStrValue(str); - e = NewElement(name, VALUE_STR, 1, &v); - if (AddElement(p, e) == false) - { - return NULL; - } - return e; -} - -// Add an element of PACK array to JSON Array -void PackArrayElementToJsonArray(JSON_ARRAY *ja, PACK *p, ELEMENT *e, UINT index) -{ - if (ja == NULL || p == NULL || e == NULL || index >= e->num_value) - { - return; - } - - switch (e->type) - { - case VALUE_INT: - if (e->JsonHint_IsIP) - { - if (InStr(e->name, "@") == false) - { - IP ip; - if (PackGetIpEx(p, e->name, &ip, index)) - { - char ip_str[64]; - IPToStr(ip_str, sizeof(ip_str), &ip); - JsonArrayAddStr(ja, ip_str); - } - } - } - else if (e->JsonHint_IsBool) - { - JsonArrayAddBool(ja, PackGetBoolEx(p, e->name, index)); - } - else - { - JsonArrayAddNumber(ja, PackGetIntEx(p, e->name, index)); - } - break; - case VALUE_INT64: - if (e->JsonHint_IsIP == false) - { - if (e->JsonHint_IsDateTime == false) - { - JsonArrayAddNumber(ja, PackGetInt64Ex(p, e->name, index)); - } - else - { - char dtstr[64]; - - SystemTime64ToJsonStr(dtstr, sizeof(dtstr), PackGetInt64Ex(p, e->name, index)); - JsonArrayAddStr(ja, dtstr); - } - } - break; - case VALUE_DATA: - if (e->JsonHint_IsIP == false) - { - BUF *buf = PackGetBufEx(p, e->name, index); - if (buf != NULL) - { - JsonArrayAddData(ja, buf->Buf, buf->Size); - FreeBuf(buf); - } - else - { - UCHAR zero = 0; - JsonArrayAddData(ja, &zero, 0); - } - } - break; - case VALUE_STR: - if (e->JsonHint_IsIP == false) - { - if (e->values[index] != NULL) - { - JsonArrayAddStr(ja, e->values[index]->Str); - } - else - { - JsonArrayAddStr(ja, ""); - } - } - break; - case VALUE_UNISTR: - if (e->JsonHint_IsIP == false) - { - if (e->values[index] != NULL) - { - JsonArrayAddUniStr(ja, e->values[index]->UniStr); - } - else - { - JsonArrayAddUniStr(ja, L""); - } - } - break; - } -} - -// Add an element of PACK to JSON Object -void PackElementToJsonObject(JSON_OBJECT *o, PACK *p, ELEMENT *e, UINT index) -{ - char *suffix; - char name[MAX_PATH]; - if (o == NULL || p == NULL || e == NULL) - { - return; - } - - suffix = DetermineJsonSuffixForPackElement(e); - - if (suffix == NULL) - { - return; - } - - StrCpy(name, sizeof(name), e->name); - StrCat(name, sizeof(name), suffix); - - switch (e->type) - { - case VALUE_INT: - if (e->JsonHint_IsIP) - { - if (InStr(e->name, "@") == false) - { - IP ip; - if (PackGetIpEx(p, e->name, &ip, index)) - { - char ip_str[64]; - IPToStr(ip_str, sizeof(ip_str), &ip); - JsonSetStr(o, name, ip_str); - } - } - } - else if (e->JsonHint_IsBool) - { - JsonSetBool(o, name, PackGetBoolEx(p, e->name, index)); - } - else - { - JsonSetNumber(o, name, PackGetIntEx(p, e->name, index)); - } - break; - case VALUE_INT64: - if (e->JsonHint_IsIP == false) - { - if (e->JsonHint_IsDateTime == false) - { - JsonSetNumber(o, name, PackGetInt64Ex(p, e->name, index)); - } - else - { - char dtstr[64]; - - SystemTime64ToJsonStr(dtstr, sizeof(dtstr), PackGetInt64Ex(p, e->name, index)); - JsonSetStr(o, name, dtstr); - } - } - break; - case VALUE_DATA: - if (e->JsonHint_IsIP == false) - { - BUF *buf = PackGetBufEx(p, e->name, index); - if (buf != NULL) - { - JsonSetData(o, name, buf->Buf, buf->Size); - FreeBuf(buf); - } - else - { - UCHAR zero = 0; - JsonSetData(o, name, &zero, 0); - } - } - break; - case VALUE_STR: - if (e->JsonHint_IsIP == false) - { - if (e->values[index] != NULL) - { - JsonSetStr(o, name, e->values[index]->Str); - } - else - { - JsonSetStr(o, name, ""); - } - } - break; - case VALUE_UNISTR: - if (e->JsonHint_IsIP == false) - { - if (e->values[index] != NULL) - { - JsonSetUniStr(o, name, e->values[index]->UniStr); - } - else - { - JsonSetUniStr(o, name, L""); - } - } - break; - } -} - -// Determine JSON element suffix for PACK element -char *DetermineJsonSuffixForPackElement(ELEMENT *e) -{ - switch (e->type) - { - case VALUE_INT: - if (e->JsonHint_IsIP) - { - if (InStr(e->name, "@") == false) - { - return "_ip"; - } - } - else if (e->JsonHint_IsBool) - { - return "_bool"; - } - else - { - return "_u32"; - } - break; - case VALUE_INT64: - if (e->JsonHint_IsIP == false) - { - if (e->JsonHint_IsDateTime == false) - { - return "_u64"; - } - else - { - return "_dt"; - } - } - break; - case VALUE_DATA: - if (e->JsonHint_IsIP == false) - { - return "_bin"; - } - break; - case VALUE_STR: - if (e->JsonHint_IsIP == false) - { - return "_str"; - } - break; - case VALUE_UNISTR: - if (e->JsonHint_IsIP == false) - { - return "_utf"; - } - break; - } - - return NULL; -} - -// Convert JSON to PACK -PACK *JsonToPack(JSON_VALUE *v) -{ - PACK *p = NULL; - JSON_OBJECT *jo; - if (v == NULL) - { - return NULL; - } - - p = NewPack(); - - jo = JsonValueGetObject(v); - - if (jo != NULL) - { - UINT i; - for (i = 0;i < jo->count;i++) - { - char *name = jo->names[i]; - JSON_VALUE *value = jo->values[i]; - - if (value->type == JSON_TYPE_ARRAY) - { - UINT j; - JSON_ARRAY *ja = value->value.array; - - for (j = 0;j < ja->count;j++) - { - if (ja->items[j]->type != JSON_TYPE_OBJECT) - { - JsonTryParseValueAddToPack(p, ja->items[j], name, j, ja->count, false); - } - else - { - JSON_VALUE *v = ja->items[j]; - JSON_OBJECT *o = v->value.object; - UINT k; - - for (k = 0;k < o->count;k++) - { - char *name2 = o->names[k]; - JSON_VALUE *value2 = o->values[k]; - - PackSetCurrentJsonGroupName(p, name); - JsonTryParseValueAddToPack(p, value2, name2, j, ja->count, false); - PackSetCurrentJsonGroupName(p, NULL); - } - } - } - } - else - { - JsonTryParseValueAddToPack(p, value, name, 0, 1, true); - } - } - } - - return p; -} - -ELEMENT *ElementNullSafe(ELEMENT *p) -{ - static ELEMENT dummy; - if (p == NULL) - { - Zero(&dummy, sizeof(dummy)); - return &dummy; - } - return p; -} - -bool JsonTryParseValueAddToPack(PACK *p, JSON_VALUE *v, char *v_name, UINT index, UINT total, bool is_single) -{ - char name[MAX_PATH]; - bool ok = true; - if (p == NULL || v == NULL) - { - return false; - } - - if (TrimEndWith(name, sizeof(name), v_name, "_bool")) - { - if (v->type == JSON_TYPE_BOOL) - { - ElementNullSafe(PackAddBoolEx(p, name, MAKEBOOL(v->value.boolean), index, total))->JsonHint_IsArray = !is_single; - ok = true; - } - else if (v->type == JSON_TYPE_NUMBER) - { - ElementNullSafe(PackAddBoolEx(p, name, MAKEBOOL(v->value.number), index, total))->JsonHint_IsArray = !is_single; - ok = true; - } - else if (v->type == JSON_TYPE_STRING) - { - ElementNullSafe(PackAddBoolEx(p, name, ToBool(v->value.string), index, total))->JsonHint_IsArray = !is_single; - ok = true; - } - } - else if (TrimEndWith(name, sizeof(name), v_name, "_u32")) - { - if (v->type == JSON_TYPE_BOOL) - { - ElementNullSafe(PackAddIntEx(p, name, MAKEBOOL(v->value.boolean), index, total))->JsonHint_IsArray = !is_single; - ok = true; - } - else if (v->type == JSON_TYPE_NUMBER) - { - ElementNullSafe(PackAddIntEx(p, name, (UINT)v->value.number, index, total))->JsonHint_IsArray = !is_single; - ok = true; - } - else if (v->type == JSON_TYPE_STRING) - { - ElementNullSafe(PackAddIntEx(p, name, ToInt(v->value.string), index, total))->JsonHint_IsArray = !is_single; - ok = true; - } - } - else if (TrimEndWith(name, sizeof(name), v_name, "_u64")) - { - if (v->type == JSON_TYPE_BOOL) - { - ElementNullSafe(PackAddInt64Ex(p, name, MAKEBOOL(v->value.boolean), index, total))->JsonHint_IsArray = !is_single; - ok = true; - } - else if (v->type == JSON_TYPE_NUMBER) - { - ElementNullSafe(PackAddInt64Ex(p, name, v->value.number, index, total))->JsonHint_IsArray = !is_single; - ok = true; - } - else if (v->type == JSON_TYPE_STRING) - { - ElementNullSafe(PackAddInt64Ex(p, name, ToInt64(v->value.string), index, total))->JsonHint_IsArray = !is_single; - ok = true; - } - } - else if (TrimEndWith(name, sizeof(name), v_name, "_str")) - { - if (v->type == JSON_TYPE_BOOL) - { - ElementNullSafe(PackAddStrEx(p, name, MAKEBOOL(v->value.boolean) ? "true" : "false", index, total))->JsonHint_IsArray = !is_single; - ok = true; - } - else if (v->type == JSON_TYPE_NUMBER) - { - char tmp[64]; - ToStr64(tmp, v->value.number); - ElementNullSafe(PackAddStrEx(p, name, tmp, index, total))->JsonHint_IsArray = !is_single; - ok = true; - } - else if (v->type == JSON_TYPE_STRING) - { - ElementNullSafe(PackAddStrEx(p, name, v->value.string, index, total))->JsonHint_IsArray = !is_single; - ok = true; - } - } - else if (TrimEndWith(name, sizeof(name), v_name, "_utf")) - { - if (v->type == JSON_TYPE_BOOL) - { - ElementNullSafe(PackAddUniStrEx(p, name, MAKEBOOL(v->value.boolean) ? L"true" : L"false", index, total))->JsonHint_IsArray = !is_single; - ok = true; - } - else if (v->type == JSON_TYPE_NUMBER) - { - char tmp[64]; - wchar_t tmp2[64]; - ToStr64(tmp, v->value.number); - StrToUni(tmp2, sizeof(tmp2), tmp); - ElementNullSafe(PackAddUniStrEx(p, name, tmp2, index, total))->JsonHint_IsArray = !is_single; - ok = true; - } - else if (v->type == JSON_TYPE_STRING) - { - wchar_t *uni = CopyUtfToUni(v->value.string); - ElementNullSafe(PackAddUniStrEx(p, name, uni, index, total))->JsonHint_IsArray = !is_single; - Free(uni); - ok = true; - } - } - else if (TrimEndWith(name, sizeof(name), v_name, "_bin")) - { - if (v->type == JSON_TYPE_STRING) - { - UINT len = StrLen(v->value.string); - UCHAR *data = ZeroMalloc(len * 4 + 64); - UINT size = B64_Decode(data, v->value.string, len); - ElementNullSafe(PackAddDataEx(p, name, data, size, index, total))->JsonHint_IsArray = !is_single; - Free(data); - ok = true; - } - } - else if (TrimEndWith(name, sizeof(name), v_name, "_dt")) - { - if (v->type == JSON_TYPE_NUMBER) - { - ElementNullSafe(PackAddInt64Ex(p, name, v->value.number, index, total))->JsonHint_IsArray = !is_single; - ok = true; - } - else if (v->type == JSON_TYPE_STRING) - { - UINT64 time = DateTimeStrRFC3339ToSystemTime64(v->value.string); - ELEMENT *e = PackAddInt64Ex(p, name, time, index, total); - if (e != NULL) - { - e->JsonHint_IsArray = !is_single; - e->JsonHint_IsDateTime = true; - } - ok = true; - } - } - else if (TrimEndWith(name, sizeof(name), v_name, "_ip")) - { - if (v->type == JSON_TYPE_STRING) - { - IP ip; - if (StrToIP(&ip, v->value.string)) - { - PackAddIpEx2(p, name, &ip, index, total, is_single); - ok = true; - } - } - } - - return ok; -} - -// Convert JSON string to PACK -PACK *JsonStrToPack(char *str) -{ - JSON_VALUE *v = StrToJson(str); - PACK *ret; - - if (v == NULL) - { - return NULL; - } - - ret = JsonToPack(v); - - JsonFree(v); - - return ret; -} - -// Convert PACK to JSON string -char *PackToJsonStr(PACK *p) -{ - char *ret; - JSON_VALUE *json = PackToJson(p); - - ret = JsonToStr(json); - - JsonFree(json); - - return ret; -} - -// Convert PACK to JSON -JSON_VALUE *PackToJson(PACK *p) -{ - JSON_VALUE *v; - JSON_OBJECT *o; - UINT i, j, k; - LIST *json_group_id_list; - if (p == NULL) - { - return JsonNewObject(); - } - - json_group_id_list = NewStrList(); - - for (i = 0;i < LIST_NUM(p->elements);i++) - { - ELEMENT *e = LIST_DATA(p->elements, i); - - if (e->num_value >= 2 || e->JsonHint_IsArray) - { - if (IsEmptyStr(e->JsonHint_GroupName) == false) - { - AddStrToStrListDistinct(json_group_id_list, e->JsonHint_GroupName); - } - } - } - - for (i = 0;i < LIST_NUM(p->json_subitem_names);i++) - { - char *group_name = LIST_DATA(p->json_subitem_names, i); - - if (IsEmptyStr(group_name) == false) - { - AddStrToStrListDistinct(json_group_id_list, group_name); - } - } - - v = JsonNewObject(); - o = JsonValueGetObject(v); - - for (k = 0;k < LIST_NUM(json_group_id_list);k++) - { - char *group_name = LIST_DATA(json_group_id_list, k); - UINT array_count = INFINITE; - bool ok = true; - - for (i = 0;i < LIST_NUM(p->elements);i++) - { - ELEMENT *e = LIST_DATA(p->elements, i); - - if (e->num_value >= 2 || e->JsonHint_IsArray) - { - if (StrCmpi(e->JsonHint_GroupName, group_name) == 0) - { - if (array_count == INFINITE) - { - array_count = e->num_value; - } - else - { - if (array_count != e->num_value) - { - ok = false; - } - } - } - } - } - - if (array_count == INFINITE) - { - array_count = 0; - } - - if (ok) - { - JSON_VALUE **json_objects = ZeroMalloc(sizeof(void *) * array_count); - JSON_VALUE *jav = JsonNewArray(); - JSON_ARRAY *ja = JsonArray(jav); - - JsonSet(o, group_name, jav); - - for (j = 0;j < array_count;j++) - { - json_objects[j] = JsonNewObject(); - - JsonArrayAdd(ja, json_objects[j]); - } - - for (i = 0;i < LIST_NUM(p->elements);i++) - { - ELEMENT *e = LIST_DATA(p->elements, i); - - if (e->num_value >= 2 || e->JsonHint_IsArray) - { - if (StrCmpi(e->JsonHint_GroupName, group_name) == 0) - { - for (j = 0;j < e->num_value;j++) - { - PackElementToJsonObject(JsonValueGetObject(json_objects[j]), - p, e, j); - } - } - } - } - - Free(json_objects); - } - } - - for (i = 0;i < LIST_NUM(p->elements);i++) - { - ELEMENT *e = LIST_DATA(p->elements, i); - - if (e->num_value >= 2 || e->JsonHint_IsArray) - { - if (IsEmptyStr(e->JsonHint_GroupName)) - { - char *suffix = DetermineJsonSuffixForPackElement(e); - - if (suffix != NULL) - { - JSON_VALUE *jav = JsonNewArray(); - JSON_ARRAY *ja = JsonArray(jav); - char name[MAX_PATH]; - - for (j = 0;j < e->num_value;j++) - { - PackArrayElementToJsonArray(ja, p, e, j); - } - - StrCpy(name, sizeof(name), e->name); - StrCat(name, sizeof(name), suffix); - - JsonSet(o, name, jav); - } - } - } - else if (e->num_value == 1) - { - PackElementToJsonObject(o, p, e, 0); - } - } - - ReleaseStrList(json_group_id_list); - - return v; -} - - - - +// SoftEther VPN Source Code - Developer Edition Master Branch +// Mayaqua Kernel + + +// Pack.c +// Data package code + +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +// Get a list of the element names in the PACK +TOKEN_LIST *GetPackElementNames(PACK *p) +{ + TOKEN_LIST *ret; + UINT i; + // Validate arguments + if (p == NULL) + { + return NULL; + } + + ret = ZeroMalloc(sizeof(TOKEN_LIST)); + + ret->NumTokens = LIST_NUM(p->elements); + ret->Token = ZeroMalloc(sizeof(char *) * ret->NumTokens); + + for (i = 0;i < ret->NumTokens;i++) + { + ELEMENT *e = LIST_DATA(p->elements, i); + + ret->Token[i] = CopyStr(e->name); + } + + return ret; +} + +// Convert the BUF to a PACK +PACK *BufToPack(BUF *b) +{ + PACK *p; + // Validate arguments + if (b == NULL) + { + return NULL; + } + + p = NewPack(); + if (ReadPack(b, p) == false) + { + FreePack(p); + return NULL; + } + + return p; +} + +// Convert the PACK to the BUF +BUF *PackToBuf(PACK *p) +{ + BUF *b; + // Validate arguments + if (p == NULL) + { + return NULL; + } + + b = NewBuf(); + WritePack(b, p); + + return b; +} + +// Read the PACK +bool ReadPack(BUF *b, PACK *p) +{ + UINT i, num; + // Validate arguments + if (b == NULL || p == NULL) + { + return false; + } + + // The number of ELEMENTs + num = ReadBufInt(b); + if (num > MAX_ELEMENT_NUM) + { + // Number exceeds + return false; + } + + // Read the ELEMENT + for (i = 0;i < num;i++) + { + ELEMENT *e; + e = ReadElement(b); + if (AddElement(p, e) == false) + { + // Adding error + return false; + } + } + + return true; +} + +// Write down the PACK +void WritePack(BUF *b, PACK *p) +{ + UINT i; + // Validate arguments + if (b == NULL || p == NULL) + { + return; + } + + // The number of ELEMENTs + WriteBufInt(b, LIST_NUM(p->elements)); + + // Write the ELEMENT + for (i = 0;i < LIST_NUM(p->elements);i++) + { + ELEMENT *e = LIST_DATA(p->elements, i); + WriteElement(b, e); + } +} + +// Read the ELEMENT +ELEMENT *ReadElement(BUF *b) +{ + UINT i; + char name[MAX_ELEMENT_NAME_LEN + 1]; + UINT type, num_value; + VALUE **values; + ELEMENT *e; + // Validate arguments + if (b == NULL) + { + return NULL; + } + + // Name + if (ReadBufStr(b, name, sizeof(name)) == false) + { + return NULL; + } + + // Type of item + type = ReadBufInt(b); + + // Number of items + num_value = ReadBufInt(b); + if (num_value > MAX_VALUE_NUM) + { + // Number exceeds + return NULL; + } + + // VALUE + values = (VALUE **)Malloc(sizeof(VALUE *) * num_value); + for (i = 0;i < num_value;i++) + { + values[i] = ReadValue(b, type); + } + + // Create a ELEMENT + e = NewElement(name, type, num_value, values); + + Free(values); + + return e; +} + +// Write the ELEMENT +void WriteElement(BUF *b, ELEMENT *e) +{ + UINT i; + // Validate arguments + if (b == NULL || e == NULL) + { + return; + } + + // Name + WriteBufStr(b, e->name); + // Type of item + WriteBufInt(b, e->type); + // Number of items + WriteBufInt(b, e->num_value); + // VALUE + for (i = 0;i < e->num_value;i++) + { + VALUE *v = e->values[i]; + WriteValue(b, v, e->type); + } +} + +// Read the VALUE +VALUE *ReadValue(BUF *b, UINT type) +{ + UINT len; + BYTE *u; + void *data; + char *str; + wchar_t *unistr; + UINT unistr_size; + UINT size; + UINT u_size; + VALUE *v = NULL; + // Validate arguments + if (b == NULL) + { + return NULL; + } + + // Data item + switch (type) + { + case VALUE_INT: // Integer + v = NewIntValue(ReadBufInt(b)); + break; + case VALUE_INT64: + v = NewInt64Value(ReadBufInt64(b)); + break; + case VALUE_DATA: // Data + size = ReadBufInt(b); + if (size > MAX_VALUE_SIZE) + { + // Size over + break; + } + data = Malloc(size); + if (ReadBuf(b, data, size) != size) + { + // Read failure + Free(data); + break; + } + v = NewDataValue(data, size); + Free(data); + break; + case VALUE_STR: // ANSI string + len = ReadBufInt(b); + if (len > (MAX_VALUE_SIZE - 1)) + { + // Size over + break; + } + str = Malloc(len + 1); + // String body + if (ReadBuf(b, str, len) != len) + { + // Read failure + Free(str); + break; + } + str[len] = 0; + v = NewStrValue(str); + Free(str); + break; + case VALUE_UNISTR: // Unicode string + u_size = ReadBufInt(b); + if (u_size > MAX_VALUE_SIZE) + { + // Size over + break; + } + // Reading an UTF-8 string + u = ZeroMalloc(u_size + 1); + if (ReadBuf(b, u, u_size) != u_size) + { + // Read failure + Free(u); + break; + } + // Convert to a Unicode string + unistr_size = CalcUtf8ToUni(u, u_size); + if (unistr_size == 0) + { + Free(u); + break; + } + unistr = Malloc(unistr_size); + Utf8ToUni(unistr, unistr_size, u, u_size); + Free(u); + v = NewUniStrValue(unistr); + Free(unistr); + break; + } + + return v; +} + +// Write the VALUE +void WriteValue(BUF *b, VALUE *v, UINT type) +{ + UINT len; + BYTE *u; + UINT u_size; + // Validate arguments + if (b == NULL || v == NULL) + { + return; + } + + // Data item + switch (type) + { + case VALUE_INT: // Integer + WriteBufInt(b, v->IntValue); + break; + case VALUE_INT64: // 64 bit integer + WriteBufInt64(b, v->Int64Value); + break; + case VALUE_DATA: // Data + // Size + WriteBufInt(b, v->Size); + // Body + WriteBuf(b, v->Data, v->Size); + break; + case VALUE_STR: // ANSI string + len = StrLen(v->Str); + // Length + WriteBufInt(b, len); + // String body + WriteBuf(b, v->Str, len); + break; + case VALUE_UNISTR: // Unicode string + // Convert to UTF-8 + u_size = CalcUniToUtf8(v->UniStr) + 1; + u = ZeroMalloc(u_size); + UniToUtf8(u, u_size, v->UniStr); + // Size + WriteBufInt(b, u_size); + // UTF-8 string body + WriteBuf(b, u, u_size); + Free(u); + break; + } +} + +// Get data size +UINT GetDataValueSize(ELEMENT *e, UINT index) +{ + // Validate arguments + if (e == NULL) + { + return 0; + } + if (e->values == NULL) + { + return 0; + } + if (index >= e->num_value) + { + return 0; + } + if (e->values[index] == NULL) + { + return 0; + } + + return e->values[index]->Size; +} + +// Get the data +void *GetDataValue(ELEMENT *e, UINT index) +{ + // Validate arguments + if (e == NULL) + { + return NULL; + } + if (e->values == NULL) + { + return NULL; + } + if (index >= e->num_value) + { + return NULL; + } + if (e->values[index] == NULL) + { + return NULL; + } + + return e->values[index]->Data; +} + +// Get the Unicode string type +wchar_t *GetUniStrValue(ELEMENT *e, UINT index) +{ + // Validate arguments + if (e == NULL) + { + return 0; + } + if (index >= e->num_value) + { + return 0; + } + if (e->values[index] == NULL) + { + return NULL; + } + + return e->values[index]->UniStr; +} + +// Get the ANSI string type +char *GetStrValue(ELEMENT *e, UINT index) +{ + // Validate arguments + if (e == NULL) + { + return 0; + } + if (index >= e->num_value) + { + return 0; + } + if (e->values[index] == NULL) + { + return NULL; + } + + return e->values[index]->Str; +} + +// Get the 64 bit integer value +UINT64 GetInt64Value(ELEMENT *e, UINT index) +{ + // Validate arguments + if (e == NULL) + { + return 0; + } + if (index >= e->num_value) + { + return 0; + } + if (e->values[index] == NULL) + { + return 0; + } + + return e->values[index]->Int64Value; +} + +// Get the integer value +UINT GetIntValue(ELEMENT *e, UINT index) +{ + // Validate arguments + if (e == NULL) + { + return 0; + } + if (index >= e->num_value) + { + return 0; + } + if (e->values[index] == NULL) + { + return 0; + } + + return e->values[index]->IntValue; +} + +// Function of sort for PACK +int ComparePackName(void *p1, void *p2) +{ + ELEMENT *o1, *o2; + if (p1 == NULL || p2 == NULL) + { + return 0; + } + o1 = *(ELEMENT **)p1; + o2 = *(ELEMENT **)p2; + if (o1 == NULL || o2 == NULL) + { + return 0; + } + + return StrCmpi(o1->name, o2->name); +} + +// Delete the VALUE +void FreeValue(VALUE *v, UINT type) +{ + // Validate arguments + if (v == NULL) + { + return; + } + + switch (type) + { + case VALUE_INT: + case VALUE_INT64: + break; + case VALUE_DATA: + Free(v->Data); + break; + case VALUE_STR: + Free(v->Str); + break; + case VALUE_UNISTR: + Free(v->UniStr); + break; + } + + // Memory release + Free(v); +} + +// Create a VALUE of Unicode String type +VALUE *NewUniStrValue(wchar_t *str) +{ + VALUE *v; + // Validate arguments + if (str == NULL) + { + return NULL; + } + + // Memory allocation + v = Malloc(sizeof(VALUE)); + + // String copy + v->Size = UniStrSize(str); + v->UniStr = Malloc(v->Size); + UniStrCpy(v->UniStr, v->Size, str); + + UniTrim(v->UniStr); + + return v; +} + +// Creation of the VALUE of ANSI string type +VALUE *NewStrValue(char *str) +{ + VALUE *v; + // Validate arguments + if (str == NULL) + { + return NULL; + } + + // Memory allocation + v = Malloc(sizeof(VALUE)); + + // String copy + v->Size = StrLen(str) + 1; + v->Str = Malloc(v->Size); + StrCpy(v->Str, v->Size, str); + + Trim(v->Str); + + return v; +} + +// Create the VALUE of the data type +VALUE *NewDataValue(void *data, UINT size) +{ + VALUE *v; + // Validate arguments + if (data == NULL) + { + return NULL; + } + + // Memory allocation + v = Malloc(sizeof(VALUE)); + + // Data copy + v->Size = size; + v->Data = Malloc(v->Size); + Copy(v->Data, data, size); + + return v; +} + +// Create the VALUE of 64 bit integer type +VALUE *NewInt64Value(UINT64 i) +{ + VALUE *v; + + v = Malloc(sizeof(VALUE)); + v->Int64Value = i; + v->Size = sizeof(UINT64); + + return v; +} + +// Create the VALUE of integer type +VALUE *NewIntValue(UINT i) +{ + VALUE *v; + + // Memory allocation + v = Malloc(sizeof(VALUE)); + v->IntValue = i; + v->Size = sizeof(UINT); + + return v; +} + +// Delete the ELEMENT +void FreeElement(ELEMENT *e) +{ + UINT i; + // Validate arguments + if (e == NULL) + { + return; + } + + for (i = 0;i < e->num_value;i++) + { + FreeValue(e->values[i], e->type); + } + Free(e->values); + + Free(e); +} + +// Create a ELEMENT +ELEMENT *NewElement(char *name, UINT type, UINT num_value, VALUE **values) +{ + ELEMENT *e; + UINT i; + // Validate arguments + if (name == NULL || num_value == 0 || values == NULL) + { + return NULL; + } + + // Memory allocation + e = ZeroMalloc(sizeof(ELEMENT)); + StrCpy(e->name, sizeof(e->name), name); + e->num_value = num_value; + e->type = type; + + // Copy of the pointer list to the element + e->values = (VALUE **)ZeroMalloc(sizeof(VALUE *) * num_value); + for (i = 0;i < e->num_value;i++) + { + e->values[i] = values[i]; + } + + return e; +} + +// Search and retrieve a ELEMENT from the PACK +ELEMENT *GetElement(PACK *p, char *name, UINT type) +{ + ELEMENT t; + ELEMENT *e; + // Validate arguments + if (p == NULL || name == NULL) + { + return NULL; + } + + // Search + StrCpy(t.name, sizeof(t.name), name); + e = Search(p->elements, &t); + + if (e == NULL) + { + return NULL; + } + + // Type checking + if (type != INFINITE) + { + if (e->type != type) + { + return NULL; + } + } + + return e; +} + +// Check whether the specified element exists +bool IsElement(PACK *p, char *name) +{ + ELEMENT t; + ELEMENT *e; + // Validate arguments + if (p == NULL || name == NULL) + { + return false; + } + + // Search + StrCpy(t.name, sizeof(t.name), name); + e = Search(p->elements, &t); + + if (e == NULL) + { + return false; + } + + return true; +} + +// Remove the ELEMENT from the PACK +void DelElement(PACK *p, char *name) +{ + ELEMENT *e; + // Validate arguments + if (p == NULL || name == NULL) + { + return; + } + + e = GetElement(p, name, INFINITE); + if (e != NULL) + { + Delete(p->elements, e); + + FreeElement(e); + } +} + +// Add an ELEMENT to the PACK +bool AddElement(PACK *p, ELEMENT *e) +{ + // Validate arguments + if (p == NULL || e == NULL) + { + return false; + } + + // Size Check + if (LIST_NUM(p->elements) >= MAX_ELEMENT_NUM) + { + // Can not add any more + FreeElement(e); + return false; + } + + // Check whether there is another item which have same name + if (GetElement(p, e->name, INFINITE)) + { + // Exists + FreeElement(e); + return false; + } + + if (e->num_value == 0) + { + // VALUE without any items can not be added + FreeElement(e); + return false; + } + + // Set JsonHint_GroupName + StrCpy(e->JsonHint_GroupName, sizeof(e->JsonHint_GroupName), p->CurrentJsonHint_GroupName); + + // Adding + Add(p->elements, e); + return true; +} + +// Release of the PACK object +void FreePack(PACK *p) +{ + UINT i; + ELEMENT **elements; + // Validate arguments + if (p == NULL) + { + return; + } + + elements = ToArray(p->elements); + for (i = 0;i < LIST_NUM(p->elements);i++) + { + FreeElement(elements[i]); + } + Free(elements); + + if (p->json_subitem_names != NULL) + { + FreeStrList(p->json_subitem_names); + } + + ReleaseList(p->elements); + Free(p); +} + +// Create a PACK object +PACK *NewPack() +{ + PACK *p; + + // Memory allocation + p = ZeroMallocEx(sizeof(PACK), true); + + // Creating a List + p->elements = NewListFast(ComparePackName); + + return p; +} + +// Get the K from the PACK +K *PackGetK(PACK *p, char *name) +{ + K *k; + BUF *b; + // Validate arguments + if (p == NULL || name == NULL) + { + return NULL; + } + + b = PackGetBuf(p, name); + if (b == NULL) + { + return NULL; + } + + k = BufToK(b, true, false, NULL); + + if (k == NULL) + { + k = BufToK(b, true, true, NULL); + } + + FreeBuf(b); + + return k; +} + +// Get the X from the PACK +X *PackGetX(PACK *p, char *name) +{ + X *x; + BUF *b; + // Validate arguments + if (p == NULL || name == NULL) + { + return NULL; + } + + b = PackGetBuf(p, name); + if (b == NULL) + { + return NULL; + } + + x = BufToX(b, false); + + if (x == NULL) + { + x = BufToX(b, true); + } + + FreeBuf(b); + + return x; +} + +// Add the K to the PACK +ELEMENT *PackAddK(PACK *p, char *name, K *k) +{ + BUF *b; + ELEMENT *e = NULL; + // Validate arguments + if (p == NULL || name == NULL || k == NULL) + { + return NULL; + } + + b = KToBuf(k, false, NULL); + if (b == NULL) + { + return NULL; + } + + e = PackAddBuf(p, name, b); + FreeBuf(b); + + return e; +} + +// Add an X into the PACK +ELEMENT *PackAddX(PACK *p, char *name, X *x) +{ + BUF *b; + ELEMENT *e = NULL; + // Validate arguments + if (p == NULL || name == NULL || x == NULL) + { + return NULL; + } + + b = XToBuf(x, false); + if (b == NULL) + { + return NULL; + } + + e = PackAddBuf(p, name, b); + FreeBuf(b); + + return e; +} + +// Get a buffer from the PACK +BUF *PackGetBuf(PACK *p, char *name) +{ + return PackGetBufEx(p, name, 0); +} +BUF *PackGetBufEx(PACK *p, char *name, UINT index) +{ + UINT size; + void *tmp; + BUF *b; + // Validate arguments + if (p == NULL || name == NULL) + { + return NULL; + } + + size = PackGetDataSizeEx(p, name, index); + tmp = MallocEx(size, true); + if (PackGetDataEx(p, name, tmp, index) == false) + { + Free(tmp); + return NULL; + } + + b = NewBuf(); + WriteBuf(b, tmp, size); + SeekBuf(b, 0, 0); + + Free(tmp); + + return b; +} + +// Get the data from the PACK +bool PackGetData(PACK *p, char *name, void *data) +{ + return PackGetDataEx(p, name, data, 0); +} +bool PackGetDataEx(PACK *p, char *name, void *data, UINT index) +{ + ELEMENT *e; + // Validate arguments + if (p == NULL || name == NULL) + { + return false; + } + + e = GetElement(p, name, VALUE_DATA); + if (e == NULL) + { + return false; + } + Copy(data, GetDataValue(e, index), GetDataValueSize(e, index)); + return true; +} +bool PackGetData2(PACK *p, char *name, void *data, UINT size) +{ + return PackGetDataEx2(p, name, data, size, 0); +} +bool PackGetDataEx2(PACK *p, char *name, void *data, UINT size, UINT index) +{ + ELEMENT *e; + // Validate arguments + if (p == NULL || name == NULL) + { + return false; + } + + e = GetElement(p, name, VALUE_DATA); + if (e == NULL) + { + return false; + } + if (GetDataValueSize(e, index) != size) + { + return false; + } + Copy(data, GetDataValue(e, index), GetDataValueSize(e, index)); + return true; +} + +// Get the data size from the PACK +UINT PackGetDataSize(PACK *p, char *name) +{ + return PackGetDataSizeEx(p, name, 0); +} +UINT PackGetDataSizeEx(PACK *p, char *name, UINT index) +{ + ELEMENT *e; + // Validate arguments + if (p == NULL || name == NULL) + { + return 0; + } + + e = GetElement(p, name, VALUE_DATA); + if (e == NULL) + { + return 0; + } + return GetDataValueSize(e, index); +} + +// Get an integer from the PACK +UINT64 PackGetInt64(PACK *p, char *name) +{ + return PackGetInt64Ex(p, name, 0); +} +UINT64 PackGetInt64Ex(PACK *p, char *name, UINT index) +{ + ELEMENT *e; + // Validate arguments + if (p == NULL || name == NULL) + { + return 0; + } + + e = GetElement(p, name, VALUE_INT64); + if (e == NULL) + { + return 0; + } + return GetInt64Value(e, index); +} + +// Get the index number from the PACK +UINT PackGetIndexCount(PACK *p, char *name) +{ + ELEMENT *e; + // Validate arguments + if (p == NULL || name == NULL) + { + return 0; + } + + e = GetElement(p, name, INFINITE); + if (e == NULL) + { + return 0; + } + + return e->num_value; +} + +// Get the number from the PACK +UINT PackGetNum(PACK *p, char *name) +{ + return MIN(PackGetInt(p, name), 65536); +} + +// Get a bool type from the PACK +bool PackGetBool(PACK *p, char *name) +{ + return PackGetInt(p, name) == 0 ? false : true; +} +bool PackGetBoolEx(PACK *p, char *name, UINT index) +{ + return PackGetIntEx(p, name, index) == 0 ? false : true; +} + +// Set CurrentJsonHint_GroupName to PACK +void PackSetCurrentJsonGroupName(PACK *p, char *json_group_name) +{ + if (p == NULL) + { + return; + } + + if (json_group_name == NULL) + { + ClearStr(p->CurrentJsonHint_GroupName, sizeof(p->CurrentJsonHint_GroupName)); + } + else + { + StrCpy(p->CurrentJsonHint_GroupName, sizeof(p->CurrentJsonHint_GroupName), json_group_name); + + if (p->json_subitem_names == NULL) + { + p->json_subitem_names = NewStrList(); + } + + AddStrToStrListDistinct(p->json_subitem_names, json_group_name); + } +} + +// Add a bool type into the PACK +ELEMENT *PackAddBool(PACK *p, char *name, bool b) +{ + ELEMENT *e = PackAddInt(p, name, b ? 1 : 0); + if (e != NULL) + { + e->JsonHint_IsBool = true; + } + return e; +} +ELEMENT *PackAddBoolEx(PACK *p, char *name, bool b, UINT index, UINT total) +{ + ELEMENT *e = PackAddIntEx(p, name, b ? 1 : 0, index, total); + if (e != NULL) + { + e->JsonHint_IsBool = true; + } + return e; +} + +// Add the IPV6_ADDR to the PACK +ELEMENT *PackAddIp6AddrEx(PACK *p, char *name, IPV6_ADDR *addr, UINT index, UINT total) +{ + // Validate arguments + if (p == NULL || name == NULL || addr == NULL) + { + return NULL; + } + + return PackAddDataEx(p, name, addr, sizeof(IPV6_ADDR), index, total); +} +ELEMENT *PackAddIp6Addr(PACK *p, char *name, IPV6_ADDR *addr) +{ + return PackAddIp6AddrEx(p, name, addr, 0, 1); +} + +// Get an IPV6_ADDR from the PACK +bool PackGetIp6AddrEx(PACK *p, char *name, IPV6_ADDR *addr, UINT index) +{ + // Validate arguments + if (p == NULL || name == NULL || addr == NULL) + { + Zero(addr, sizeof(IPV6_ADDR)); + return false; + } + + return PackGetDataEx2(p, name, addr, sizeof(IPV6_ADDR), index); +} +bool PackGetIp6Addr(PACK *p, char *name, IPV6_ADDR *addr) +{ + return PackGetIp6AddrEx(p, name, addr, 0); +} + +// Add the IP to the PACK +void PackAddIp32Ex(PACK *p, char *name, UINT ip32, UINT index, UINT total) +{ + PackAddIp32Ex2(p, name, ip32, index, total, false); +} +void PackAddIp32Ex2(PACK *p, char *name, UINT ip32, UINT index, UINT total, bool is_single) +{ + IP ip; + // Validate arguments + if (p == NULL || name == NULL) + { + return; + } + + UINTToIP(&ip, ip32); + + PackAddIpEx2(p, name, &ip, index, total, is_single); +} +void PackAddIp32(PACK *p, char *name, UINT ip32) +{ + PackAddIp32Ex2(p, name, ip32, 0, 1, true); +} +void PackAddIpEx(PACK *p, char *name, IP *ip, UINT index, UINT total) +{ + PackAddIpEx2(p, name, ip, index, total, false); +} +void PackAddIpEx2(PACK *p, char *name, IP *ip, UINT index, UINT total, bool is_single) +{ + UINT i; + bool b = false; + char tmp[MAX_PATH]; + ELEMENT *e; + // Validate arguments + if (p == NULL || name == NULL || ip == NULL) + { + return; + } + if (total >= 2) + { + is_single = false; + } + + b = IsIP6(ip); + + Format(tmp, sizeof(tmp), "%s@ipv6_bool", name); + e = PackAddBoolEx(p, tmp, b, index, total); + if (e != NULL && is_single) e->JsonHint_IsArray = false; + if (e != NULL) e->JsonHint_IsIP = true; + + Format(tmp, sizeof(tmp), "%s@ipv6_array", name); + if (b) + { + e = PackAddDataEx(p, tmp, ip->ipv6_addr, sizeof(ip->ipv6_addr), index, total); + if (e != NULL && is_single) e->JsonHint_IsArray = false; + if (e != NULL) e->JsonHint_IsIP = true; + } + else + { + UCHAR dummy[16]; + + Zero(dummy, sizeof(dummy)); + + e = PackAddDataEx(p, tmp, dummy, sizeof(dummy), index, total); + if (e != NULL && is_single) e->JsonHint_IsArray = false; + if (e != NULL) e->JsonHint_IsIP = true; + } + + Format(tmp, sizeof(tmp), "%s@ipv6_scope_id", name); + if (b) + { + e = PackAddIntEx(p, tmp, ip->ipv6_scope_id, index, total); + if (e != NULL && is_single) e->JsonHint_IsArray = false; + if (e != NULL) e->JsonHint_IsIP = true; + } + else + { + e = PackAddIntEx(p, tmp, 0, index, total); + if (e != NULL && is_single) e->JsonHint_IsArray = false; + if (e != NULL) e->JsonHint_IsIP = true; + } + + i = IPToUINT(ip); + + if (IsBigEndian()) + { + i = Swap32(i); + } + + e = PackAddIntEx(p, name, i, index, total); + if (e != NULL && is_single) e->JsonHint_IsArray = false; + if (e != NULL) e->JsonHint_IsIP = true; +} +void PackAddIp(PACK *p, char *name, IP *ip) +{ + PackAddIpEx2(p, name, ip, 0, 1, true); +} + +// Get an IP from the PACK +UINT PackGetIp32Ex(PACK *p, char *name, UINT index) +{ + IP ip; + // Validate arguments + if (p == NULL || name == NULL) + { + return 0; + } + + if (PackGetIpEx(p, name, &ip, index) == false) + { + return 0; + } + + return IPToUINT(&ip); +} +UINT PackGetIp32(PACK *p, char *name) +{ + return PackGetIp32Ex(p, name, 0); +} +bool PackGetIpEx(PACK *p, char *name, IP *ip, UINT index) +{ + UINT i; + char tmp[MAX_PATH]; + // Validate arguments + if (p == NULL || ip == NULL || name == NULL) + { + return false; + } + + Format(tmp, sizeof(tmp), "%s@ipv6_bool", name); + if (PackGetBoolEx(p, tmp, index)) + { + UCHAR data[16]; + UINT scope_id; + + Zero(data, sizeof(data)); + + Format(tmp, sizeof(tmp), "%s@ipv6_array", name); + PackGetDataEx2(p, tmp, data, sizeof(data), index); + + Format(tmp, sizeof(tmp), "%s@ipv6_scope_id", name); + scope_id = PackGetIntEx(p, tmp, index); + + SetIP6(ip, data); + ip->ipv6_scope_id = scope_id; + } + else + { + if (GetElement(p, name, VALUE_INT) == NULL) + { + Zero(ip, sizeof(IP)); + return false; + } + + i = PackGetIntEx(p, name, index); + + if (IsBigEndian()) + { + i = Swap32(i); + } + + UINTToIP(ip, i); + } + + return true; +} +bool PackGetIp(PACK *p, char *name, IP *ip) +{ + return PackGetIpEx(p, name, ip, 0); +} + +// Check whether the specified value is existing on the Pack +bool PackIsValueExists(PACK *p, char *name) +{ + // Validate arguments + if (p == NULL || name == NULL) + { + return false; + } + + return IsElement(p, name); +} + +// Get an integer from the PACK +UINT PackGetInt(PACK *p, char *name) +{ + return PackGetIntEx(p, name, 0); +} +UINT PackGetIntEx(PACK *p, char *name, UINT index) +{ + ELEMENT *e; + // Validate arguments + if (p == NULL || name == NULL) + { + return 0; + } + + e = GetElement(p, name, VALUE_INT); + if (e == NULL) + { + return 0; + } + return GetIntValue(e, index); +} + +// Get an Unicode string from the PACK +bool PackGetUniStr(PACK *p, char *name, wchar_t *unistr, UINT size) +{ + return PackGetUniStrEx(p, name, unistr, size, 0); +} +bool PackGetUniStrEx(PACK *p, char *name, wchar_t *unistr, UINT size, UINT index) +{ + ELEMENT *e; + // Validate arguments + if (p == NULL || name == NULL || unistr == NULL || size == 0) + { + return false; + } + + unistr[0] = 0; + + e = GetElement(p, name, VALUE_UNISTR); + if (e == NULL) + { + return false; + } + UniStrCpy(unistr, size, GetUniStrValue(e, index)); + return true; +} + +// Compare strings in the PACK +bool PackCmpStr(PACK *p, char *name, char *str) +{ + char tmp[MAX_SIZE]; + + if (PackGetStr(p, name, tmp, sizeof(tmp)) == false) + { + return false; + } + + if (StrCmpi(tmp, str) == 0) + { + return true; + } + + return false; +} + +// Get a string from the PACK +bool PackGetStr(PACK *p, char *name, char *str, UINT size) +{ + return PackGetStrEx(p, name, str, size, 0); +} +bool PackGetStrEx(PACK *p, char *name, char *str, UINT size, UINT index) +{ + ELEMENT *e; + // Validate arguments + if (p == NULL || name == NULL || str == NULL || size == 0) + { + return false; + } + + str[0] = 0; + + e = GetElement(p, name, VALUE_STR); + if (e == NULL) + { + return false; + } + + StrCpy(str, size, GetStrValue(e, index)); + return true; +} + +// Get the string size from the PACK +bool PackGetStrSize(PACK *p, char *name) +{ + return PackGetStrSizeEx(p, name, 0); +} +bool PackGetStrSizeEx(PACK *p, char *name, UINT index) +{ + ELEMENT *e; + // Validate arguments + if (p == NULL || name == NULL) + { + return 0; + } + + e = GetElement(p, name, VALUE_STR); + if (e == NULL) + { + return 0; + } + return GetDataValueSize(e, index); +} + +// Add the buffer to the PACK (array) +ELEMENT *PackAddBufEx(PACK *p, char *name, BUF *b, UINT index, UINT total) +{ + // Validate arguments + if (p == NULL || name == NULL || b == NULL || total == 0) + { + return NULL; + } + + return PackAddDataEx(p, name, b->Buf, b->Size, index, total); +} + +// Add the data to the PACK (array) +ELEMENT *PackAddDataEx(PACK *p, char *name, void *data, UINT size, UINT index, UINT total) +{ + VALUE *v; + ELEMENT *e; + // Validate arguments + if (p == NULL || data == NULL || name == NULL || total == 0) + { + return NULL; + } + + v = NewDataValue(data, size); + e = GetElement(p, name, VALUE_DATA); + if (e != NULL) + { + if (e->num_value >= total) + { + FreeValue(e->values[index], VALUE_DATA); + e->values[index] = v; + } + else + { + FreeValue(v, VALUE_DATA); + } + } + else + { + e = ZeroMallocEx(sizeof(ELEMENT), true); + StrCpy(e->name, sizeof(e->name), name); + e->num_value = total; + e->type = VALUE_DATA; + e->values = ZeroMallocEx(sizeof(VALUE *) * total, true); + e->values[index] = v; + if (AddElement(p, e) == false) + { + return NULL; + } + } + + e->JsonHint_IsArray = true; + + return e; +} + +// Add the buffer to the PACK +ELEMENT *PackAddBuf(PACK *p, char *name, BUF *b) +{ + // Validate arguments + if (p == NULL || name == NULL || b == NULL) + { + return NULL; + } + + return PackAddData(p, name, b->Buf, b->Size); +} + +// Add the data to the PACK +ELEMENT *PackAddData(PACK *p, char *name, void *data, UINT size) +{ + VALUE *v; + ELEMENT *e; + // Validate arguments + if (p == NULL || data == NULL || name == NULL) + { + return NULL; + } + + v = NewDataValue(data, size); + e = NewElement(name, VALUE_DATA, 1, &v); + if (AddElement(p, e) == false) + { + return NULL; + } + + return e; +} + +// Add a 64 bit integer (array) to the PACK +ELEMENT *PackAddInt64Ex(PACK *p, char *name, UINT64 i, UINT index, UINT total) +{ + VALUE *v; + ELEMENT *e; + // Validate arguments + if (p == NULL || name == NULL || total == 0) + { + return NULL; + } + + v = NewInt64Value(i); + e = GetElement(p, name, VALUE_INT64); + if (e != NULL) + { + if (e->num_value >= total) + { + FreeValue(e->values[index], VALUE_INT64); + e->values[index] = v; + } + else + { + FreeValue(v, VALUE_INT64); + } + } + else + { + e = ZeroMallocEx(sizeof(ELEMENT), true); + StrCpy(e->name, sizeof(e->name), name); + e->num_value = total; + e->type = VALUE_INT64; + e->values = ZeroMallocEx(sizeof(VALUE *) * total, true); + e->values[index] = v; + + if (AddElement(p, e) == false) + { + return NULL; + } + } + + e->JsonHint_IsArray = true; + + return e; +} + +// Add an integer to the PACK (array) +ELEMENT *PackAddIntEx(PACK *p, char *name, UINT i, UINT index, UINT total) +{ + VALUE *v; + ELEMENT *e; + // Validate arguments + if (p == NULL || name == NULL || total == 0) + { + return NULL; + } + + v = NewIntValue(i); + e = GetElement(p, name, VALUE_INT); + if (e != NULL) + { + if (e->num_value >= total) + { + FreeValue(e->values[index], VALUE_INT); + e->values[index] = v; + } + else + { + FreeValue(v, VALUE_INT); + } + } + else + { + e = ZeroMallocEx(sizeof(ELEMENT), true); + StrCpy(e->name, sizeof(e->name), name); + e->num_value = total; + e->type = VALUE_INT; + e->values = ZeroMallocEx(sizeof(VALUE *) * total, true); + e->values[index] = v; + + if (AddElement(p, e) == false) + { + return NULL; + } + } + + e->JsonHint_IsArray = true; + + return e; +} + +// Add 64 bit integer time value to the PACK +ELEMENT *PackAddTime64(PACK *p, char *name, UINT64 i) +{ + ELEMENT *e = PackAddInt64(p, name, i); + if (e != NULL) + { + e->JsonHint_IsDateTime = true; + } + return e; +} +ELEMENT *PackAddTime64Ex(PACK *p, char *name, UINT64 i, UINT index, UINT total) +{ + ELEMENT *e = PackAddInt64Ex(p, name, i, index, total); + if (e != NULL) + { + e->JsonHint_IsDateTime = true; + } + return e; +} + + +// Add a 64 bit integer to the PACK +ELEMENT *PackAddInt64(PACK *p, char *name, UINT64 i) +{ + VALUE *v; + ELEMENT *e; + // Validate arguments + if (p == NULL || name == NULL) + { + return NULL; + } + + v = NewInt64Value(i); + e = NewElement(name, VALUE_INT64, 1, &v); + if (AddElement(p, e) == false) + { + return NULL; + } + return e; +} + +// Add the number of items to the PACK +ELEMENT *PackAddNum(PACK *p, char *name, UINT num) +{ + return PackAddInt(p, name, num); +} + +// Add an integer to the PACK +ELEMENT *PackAddInt(PACK *p, char *name, UINT i) +{ + VALUE *v; + ELEMENT *e = NULL; + // Validate arguments + if (p == NULL || name == NULL) + { + return NULL; + } + + v = NewIntValue(i); + e = NewElement(name, VALUE_INT, 1, &v); + if (AddElement(p, e) == false) + { + return NULL; + } + return e; +} + +// Add a Unicode string (array) to the PACK +ELEMENT *PackAddUniStrEx(PACK *p, char *name, wchar_t *unistr, UINT index, UINT total) +{ + VALUE *v; + ELEMENT *e; + // Validate arguments + if (p == NULL || name == NULL || unistr == NULL || total == 0) + { + return NULL; + } + + v = NewUniStrValue(unistr); + e = GetElement(p, name, VALUE_UNISTR); + if (e != NULL) + { + if (e->num_value >= total) + { + FreeValue(e->values[index], VALUE_UNISTR); + e->values[index] = v; + } + else + { + FreeValue(v, VALUE_UNISTR); + } + } + else + { + e = ZeroMallocEx(sizeof(ELEMENT), true); + StrCpy(e->name, sizeof(e->name), name); + e->num_value = total; + e->type = VALUE_UNISTR; + e->values = ZeroMallocEx(sizeof(VALUE *) * total, true); + e->values[index] = v; + if (AddElement(p, e) == false) + { + return NULL; + } + } + + e->JsonHint_IsArray = true; + + return e; +} + +// Add a Unicode string to the PACK +ELEMENT *PackAddUniStr(PACK *p, char *name, wchar_t *unistr) +{ + VALUE *v; + ELEMENT *e = NULL; + // Validate arguments + if (p == NULL || name == NULL || unistr == NULL) + { + return NULL; + } + + v = NewUniStrValue(unistr); + e = NewElement(name, VALUE_UNISTR, 1, &v); + if (AddElement(p, e) == false) + { + return NULL; + } + return e; +} + +// Add a string to the PACK (array) +ELEMENT *PackAddStrEx(PACK *p, char *name, char *str, UINT index, UINT total) +{ + VALUE *v; + ELEMENT *e; + // Validate arguments + if (p == NULL || name == NULL || str == NULL || total == 0) + { + return NULL; + } + + v = NewStrValue(str); + e = GetElement(p, name, VALUE_STR); + if (e != NULL) + { + if (e->num_value >= total) + { + FreeValue(e->values[index], VALUE_STR); + e->values[index] = v; + } + else + { + FreeValue(v, VALUE_STR); + } + } + else + { + e = ZeroMallocEx(sizeof(ELEMENT), true); + StrCpy(e->name, sizeof(e->name), name); + e->num_value = total; + e->type = VALUE_STR; + e->values = ZeroMallocEx(sizeof(VALUE *) * total, true); + e->values[index] = v; + if (AddElement(p, e) == false) + { + return NULL; + } + } + + e->JsonHint_IsArray = true; + + return e; +} + +// Add a string to the PACK +ELEMENT *PackAddStr(PACK *p, char *name, char *str) +{ + VALUE *v; + ELEMENT *e = NULL; + // Validate arguments + if (p == NULL || name == NULL || str == NULL) + { + return NULL; + } + + v = NewStrValue(str); + e = NewElement(name, VALUE_STR, 1, &v); + if (AddElement(p, e) == false) + { + return NULL; + } + return e; +} + +// Add an element of PACK array to JSON Array +void PackArrayElementToJsonArray(JSON_ARRAY *ja, PACK *p, ELEMENT *e, UINT index) +{ + if (ja == NULL || p == NULL || e == NULL || index >= e->num_value) + { + return; + } + + switch (e->type) + { + case VALUE_INT: + if (e->JsonHint_IsIP) + { + if (InStr(e->name, "@") == false) + { + IP ip; + if (PackGetIpEx(p, e->name, &ip, index)) + { + char ip_str[64]; + IPToStr(ip_str, sizeof(ip_str), &ip); + JsonArrayAddStr(ja, ip_str); + } + } + } + else if (e->JsonHint_IsBool) + { + JsonArrayAddBool(ja, PackGetBoolEx(p, e->name, index)); + } + else + { + JsonArrayAddNumber(ja, PackGetIntEx(p, e->name, index)); + } + break; + case VALUE_INT64: + if (e->JsonHint_IsIP == false) + { + if (e->JsonHint_IsDateTime == false) + { + JsonArrayAddNumber(ja, PackGetInt64Ex(p, e->name, index)); + } + else + { + char dtstr[64]; + + SystemTime64ToJsonStr(dtstr, sizeof(dtstr), PackGetInt64Ex(p, e->name, index)); + JsonArrayAddStr(ja, dtstr); + } + } + break; + case VALUE_DATA: + if (e->JsonHint_IsIP == false) + { + BUF *buf = PackGetBufEx(p, e->name, index); + if (buf != NULL) + { + JsonArrayAddData(ja, buf->Buf, buf->Size); + FreeBuf(buf); + } + else + { + UCHAR zero = 0; + JsonArrayAddData(ja, &zero, 0); + } + } + break; + case VALUE_STR: + if (e->JsonHint_IsIP == false) + { + if (e->values[index] != NULL) + { + JsonArrayAddStr(ja, e->values[index]->Str); + } + else + { + JsonArrayAddStr(ja, ""); + } + } + break; + case VALUE_UNISTR: + if (e->JsonHint_IsIP == false) + { + if (e->values[index] != NULL) + { + JsonArrayAddUniStr(ja, e->values[index]->UniStr); + } + else + { + JsonArrayAddUniStr(ja, L""); + } + } + break; + } +} + +// Add an element of PACK to JSON Object +void PackElementToJsonObject(JSON_OBJECT *o, PACK *p, ELEMENT *e, UINT index) +{ + char *suffix; + char name[MAX_PATH]; + if (o == NULL || p == NULL || e == NULL) + { + return; + } + + suffix = DetermineJsonSuffixForPackElement(e); + + if (suffix == NULL) + { + return; + } + + StrCpy(name, sizeof(name), e->name); + StrCat(name, sizeof(name), suffix); + + switch (e->type) + { + case VALUE_INT: + if (e->JsonHint_IsIP) + { + if (InStr(e->name, "@") == false) + { + IP ip; + if (PackGetIpEx(p, e->name, &ip, index)) + { + char ip_str[64]; + IPToStr(ip_str, sizeof(ip_str), &ip); + JsonSetStr(o, name, ip_str); + } + } + } + else if (e->JsonHint_IsBool) + { + JsonSetBool(o, name, PackGetBoolEx(p, e->name, index)); + } + else + { + JsonSetNumber(o, name, PackGetIntEx(p, e->name, index)); + } + break; + case VALUE_INT64: + if (e->JsonHint_IsIP == false) + { + if (e->JsonHint_IsDateTime == false) + { + JsonSetNumber(o, name, PackGetInt64Ex(p, e->name, index)); + } + else + { + char dtstr[64]; + + SystemTime64ToJsonStr(dtstr, sizeof(dtstr), PackGetInt64Ex(p, e->name, index)); + JsonSetStr(o, name, dtstr); + } + } + break; + case VALUE_DATA: + if (e->JsonHint_IsIP == false) + { + BUF *buf = PackGetBufEx(p, e->name, index); + if (buf != NULL) + { + JsonSetData(o, name, buf->Buf, buf->Size); + FreeBuf(buf); + } + else + { + UCHAR zero = 0; + JsonSetData(o, name, &zero, 0); + } + } + break; + case VALUE_STR: + if (e->JsonHint_IsIP == false) + { + if (e->values[index] != NULL) + { + JsonSetStr(o, name, e->values[index]->Str); + } + else + { + JsonSetStr(o, name, ""); + } + } + break; + case VALUE_UNISTR: + if (e->JsonHint_IsIP == false) + { + if (e->values[index] != NULL) + { + JsonSetUniStr(o, name, e->values[index]->UniStr); + } + else + { + JsonSetUniStr(o, name, L""); + } + } + break; + } +} + +// Determine JSON element suffix for PACK element +char *DetermineJsonSuffixForPackElement(ELEMENT *e) +{ + switch (e->type) + { + case VALUE_INT: + if (e->JsonHint_IsIP) + { + if (InStr(e->name, "@") == false) + { + return "_ip"; + } + } + else if (e->JsonHint_IsBool) + { + return "_bool"; + } + else + { + return "_u32"; + } + break; + case VALUE_INT64: + if (e->JsonHint_IsIP == false) + { + if (e->JsonHint_IsDateTime == false) + { + return "_u64"; + } + else + { + return "_dt"; + } + } + break; + case VALUE_DATA: + if (e->JsonHint_IsIP == false) + { + return "_bin"; + } + break; + case VALUE_STR: + if (e->JsonHint_IsIP == false) + { + return "_str"; + } + break; + case VALUE_UNISTR: + if (e->JsonHint_IsIP == false) + { + return "_utf"; + } + break; + } + + return NULL; +} + +// Convert JSON to PACK +PACK *JsonToPack(JSON_VALUE *v) +{ + PACK *p = NULL; + JSON_OBJECT *jo; + if (v == NULL) + { + return NULL; + } + + p = NewPack(); + + jo = JsonValueGetObject(v); + + if (jo != NULL) + { + UINT i; + for (i = 0;i < jo->count;i++) + { + char *name = jo->names[i]; + JSON_VALUE *value = jo->values[i]; + + if (value->type == JSON_TYPE_ARRAY) + { + UINT j; + JSON_ARRAY *ja = value->value.array; + + for (j = 0;j < ja->count;j++) + { + if (ja->items[j]->type != JSON_TYPE_OBJECT) + { + JsonTryParseValueAddToPack(p, ja->items[j], name, j, ja->count, false); + } + else + { + JSON_VALUE *v = ja->items[j]; + JSON_OBJECT *o = v->value.object; + UINT k; + + for (k = 0;k < o->count;k++) + { + char *name2 = o->names[k]; + JSON_VALUE *value2 = o->values[k]; + + PackSetCurrentJsonGroupName(p, name); + JsonTryParseValueAddToPack(p, value2, name2, j, ja->count, false); + PackSetCurrentJsonGroupName(p, NULL); + } + } + } + } + else + { + JsonTryParseValueAddToPack(p, value, name, 0, 1, true); + } + } + } + + return p; +} + +ELEMENT *ElementNullSafe(ELEMENT *p) +{ + static ELEMENT dummy; + if (p == NULL) + { + Zero(&dummy, sizeof(dummy)); + return &dummy; + } + return p; +} + +bool JsonTryParseValueAddToPack(PACK *p, JSON_VALUE *v, char *v_name, UINT index, UINT total, bool is_single) +{ + char name[MAX_PATH]; + bool ok = true; + if (p == NULL || v == NULL) + { + return false; + } + + if (TrimEndWith(name, sizeof(name), v_name, "_bool")) + { + if (v->type == JSON_TYPE_BOOL) + { + ElementNullSafe(PackAddBoolEx(p, name, MAKEBOOL(v->value.boolean), index, total))->JsonHint_IsArray = !is_single; + ok = true; + } + else if (v->type == JSON_TYPE_NUMBER) + { + ElementNullSafe(PackAddBoolEx(p, name, MAKEBOOL(v->value.number), index, total))->JsonHint_IsArray = !is_single; + ok = true; + } + else if (v->type == JSON_TYPE_STRING) + { + ElementNullSafe(PackAddBoolEx(p, name, ToBool(v->value.string), index, total))->JsonHint_IsArray = !is_single; + ok = true; + } + } + else if (TrimEndWith(name, sizeof(name), v_name, "_u32")) + { + if (v->type == JSON_TYPE_BOOL) + { + ElementNullSafe(PackAddIntEx(p, name, MAKEBOOL(v->value.boolean), index, total))->JsonHint_IsArray = !is_single; + ok = true; + } + else if (v->type == JSON_TYPE_NUMBER) + { + ElementNullSafe(PackAddIntEx(p, name, (UINT)v->value.number, index, total))->JsonHint_IsArray = !is_single; + ok = true; + } + else if (v->type == JSON_TYPE_STRING) + { + ElementNullSafe(PackAddIntEx(p, name, ToInt(v->value.string), index, total))->JsonHint_IsArray = !is_single; + ok = true; + } + } + else if (TrimEndWith(name, sizeof(name), v_name, "_u64")) + { + if (v->type == JSON_TYPE_BOOL) + { + ElementNullSafe(PackAddInt64Ex(p, name, MAKEBOOL(v->value.boolean), index, total))->JsonHint_IsArray = !is_single; + ok = true; + } + else if (v->type == JSON_TYPE_NUMBER) + { + ElementNullSafe(PackAddInt64Ex(p, name, v->value.number, index, total))->JsonHint_IsArray = !is_single; + ok = true; + } + else if (v->type == JSON_TYPE_STRING) + { + ElementNullSafe(PackAddInt64Ex(p, name, ToInt64(v->value.string), index, total))->JsonHint_IsArray = !is_single; + ok = true; + } + } + else if (TrimEndWith(name, sizeof(name), v_name, "_str")) + { + if (v->type == JSON_TYPE_BOOL) + { + ElementNullSafe(PackAddStrEx(p, name, MAKEBOOL(v->value.boolean) ? "true" : "false", index, total))->JsonHint_IsArray = !is_single; + ok = true; + } + else if (v->type == JSON_TYPE_NUMBER) + { + char tmp[64]; + ToStr64(tmp, v->value.number); + ElementNullSafe(PackAddStrEx(p, name, tmp, index, total))->JsonHint_IsArray = !is_single; + ok = true; + } + else if (v->type == JSON_TYPE_STRING) + { + ElementNullSafe(PackAddStrEx(p, name, v->value.string, index, total))->JsonHint_IsArray = !is_single; + ok = true; + } + } + else if (TrimEndWith(name, sizeof(name), v_name, "_utf")) + { + if (v->type == JSON_TYPE_BOOL) + { + ElementNullSafe(PackAddUniStrEx(p, name, MAKEBOOL(v->value.boolean) ? L"true" : L"false", index, total))->JsonHint_IsArray = !is_single; + ok = true; + } + else if (v->type == JSON_TYPE_NUMBER) + { + char tmp[64]; + wchar_t tmp2[64]; + ToStr64(tmp, v->value.number); + StrToUni(tmp2, sizeof(tmp2), tmp); + ElementNullSafe(PackAddUniStrEx(p, name, tmp2, index, total))->JsonHint_IsArray = !is_single; + ok = true; + } + else if (v->type == JSON_TYPE_STRING) + { + wchar_t *uni = CopyUtfToUni(v->value.string); + ElementNullSafe(PackAddUniStrEx(p, name, uni, index, total))->JsonHint_IsArray = !is_single; + Free(uni); + ok = true; + } + } + else if (TrimEndWith(name, sizeof(name), v_name, "_bin")) + { + if (v->type == JSON_TYPE_STRING) + { + UINT len = StrLen(v->value.string); + UCHAR *data = ZeroMalloc(len * 4 + 64); + UINT size = B64_Decode(data, v->value.string, len); + ElementNullSafe(PackAddDataEx(p, name, data, size, index, total))->JsonHint_IsArray = !is_single; + Free(data); + ok = true; + } + } + else if (TrimEndWith(name, sizeof(name), v_name, "_dt")) + { + if (v->type == JSON_TYPE_NUMBER) + { + ElementNullSafe(PackAddInt64Ex(p, name, v->value.number, index, total))->JsonHint_IsArray = !is_single; + ok = true; + } + else if (v->type == JSON_TYPE_STRING) + { + UINT64 time = DateTimeStrRFC3339ToSystemTime64(v->value.string); + ELEMENT *e = PackAddInt64Ex(p, name, time, index, total); + if (e != NULL) + { + e->JsonHint_IsArray = !is_single; + e->JsonHint_IsDateTime = true; + } + ok = true; + } + } + else if (TrimEndWith(name, sizeof(name), v_name, "_ip")) + { + if (v->type == JSON_TYPE_STRING) + { + IP ip; + if (StrToIP(&ip, v->value.string)) + { + PackAddIpEx2(p, name, &ip, index, total, is_single); + ok = true; + } + } + } + + return ok; +} + +// Convert JSON string to PACK +PACK *JsonStrToPack(char *str) +{ + JSON_VALUE *v = StrToJson(str); + PACK *ret; + + if (v == NULL) + { + return NULL; + } + + ret = JsonToPack(v); + + JsonFree(v); + + return ret; +} + +// Convert PACK to JSON string +char *PackToJsonStr(PACK *p) +{ + char *ret; + JSON_VALUE *json = PackToJson(p); + + ret = JsonToStr(json); + + JsonFree(json); + + return ret; +} + +// Convert PACK to JSON +JSON_VALUE *PackToJson(PACK *p) +{ + JSON_VALUE *v; + JSON_OBJECT *o; + UINT i, j, k; + LIST *json_group_id_list; + if (p == NULL) + { + return JsonNewObject(); + } + + json_group_id_list = NewStrList(); + + for (i = 0;i < LIST_NUM(p->elements);i++) + { + ELEMENT *e = LIST_DATA(p->elements, i); + + if (e->num_value >= 2 || e->JsonHint_IsArray) + { + if (IsEmptyStr(e->JsonHint_GroupName) == false) + { + AddStrToStrListDistinct(json_group_id_list, e->JsonHint_GroupName); + } + } + } + + for (i = 0;i < LIST_NUM(p->json_subitem_names);i++) + { + char *group_name = LIST_DATA(p->json_subitem_names, i); + + if (IsEmptyStr(group_name) == false) + { + AddStrToStrListDistinct(json_group_id_list, group_name); + } + } + + v = JsonNewObject(); + o = JsonValueGetObject(v); + + for (k = 0;k < LIST_NUM(json_group_id_list);k++) + { + char *group_name = LIST_DATA(json_group_id_list, k); + UINT array_count = INFINITE; + bool ok = true; + + for (i = 0;i < LIST_NUM(p->elements);i++) + { + ELEMENT *e = LIST_DATA(p->elements, i); + + if (e->num_value >= 2 || e->JsonHint_IsArray) + { + if (StrCmpi(e->JsonHint_GroupName, group_name) == 0) + { + if (array_count == INFINITE) + { + array_count = e->num_value; + } + else + { + if (array_count != e->num_value) + { + ok = false; + } + } + } + } + } + + if (array_count == INFINITE) + { + array_count = 0; + } + + if (ok) + { + JSON_VALUE **json_objects = ZeroMalloc(sizeof(void *) * array_count); + JSON_VALUE *jav = JsonNewArray(); + JSON_ARRAY *ja = JsonArray(jav); + + JsonSet(o, group_name, jav); + + for (j = 0;j < array_count;j++) + { + json_objects[j] = JsonNewObject(); + + JsonArrayAdd(ja, json_objects[j]); + } + + for (i = 0;i < LIST_NUM(p->elements);i++) + { + ELEMENT *e = LIST_DATA(p->elements, i); + + if (e->num_value >= 2 || e->JsonHint_IsArray) + { + if (StrCmpi(e->JsonHint_GroupName, group_name) == 0) + { + for (j = 0;j < e->num_value;j++) + { + PackElementToJsonObject(JsonValueGetObject(json_objects[j]), + p, e, j); + } + } + } + } + + Free(json_objects); + } + } + + for (i = 0;i < LIST_NUM(p->elements);i++) + { + ELEMENT *e = LIST_DATA(p->elements, i); + + if (e->num_value >= 2 || e->JsonHint_IsArray) + { + if (IsEmptyStr(e->JsonHint_GroupName)) + { + char *suffix = DetermineJsonSuffixForPackElement(e); + + if (suffix != NULL) + { + JSON_VALUE *jav = JsonNewArray(); + JSON_ARRAY *ja = JsonArray(jav); + char name[MAX_PATH]; + + for (j = 0;j < e->num_value;j++) + { + PackArrayElementToJsonArray(ja, p, e, j); + } + + StrCpy(name, sizeof(name), e->name); + StrCat(name, sizeof(name), suffix); + + JsonSet(o, name, jav); + } + } + } + else if (e->num_value == 1) + { + PackElementToJsonObject(o, p, e, 0); + } + } + + ReleaseStrList(json_group_id_list); + + return v; +} + + + + diff --git a/src/Mayaqua/Pack.h b/src/Mayaqua/Pack.h index 2260d4cd..a735a476 100644 --- a/src/Mayaqua/Pack.h +++ b/src/Mayaqua/Pack.h @@ -1,200 +1,200 @@ -// SoftEther VPN Source Code - Developer Edition Master Branch -// Mayaqua Kernel - - -// Pack.h -// Header of Pack.c - -#ifndef PACK_H -#define PACK_H - -// Constant -#ifdef CPU_64 - -#define MAX_VALUE_SIZE (384 * 1024 * 1024) // Maximum Data size that can be stored in a single VALUE -#define MAX_VALUE_NUM 262144 // Maximum VALUE number that can be stored in a single ELEMENT -#define MAX_ELEMENT_NAME_LEN 63 // The length of the name that can be attached to the ELEMENT -#define MAX_ELEMENT_NUM 262144 // Maximum ELEMENT number that can be stored in a single PACK -#define MAX_PACK_SIZE (512 * 1024 * 1024) // Maximum size of a serialized PACK - -#else // CPU_64 - -#define MAX_VALUE_SIZE (96 * 1024 * 1024) // Maximum Data size that can be stored in a single VALUE -#define MAX_VALUE_NUM 65536 // Maximum VALUE number that can be stored in a single ELEMENT -#define MAX_ELEMENT_NAME_LEN 63 // The length of the name that can be attached to the ELEMENT -#define MAX_ELEMENT_NUM 131072 // Maximum ELEMENT number that can be stored in a single PACK -#define MAX_PACK_SIZE (128 * 1024 * 1024) // Maximum size of a serialized PACK - -#endif // CPU_64 - -// Type of VALUE -#define VALUE_INT 0 // Integer type -#define VALUE_DATA 1 // Data type -#define VALUE_STR 2 // ANSI string type -#define VALUE_UNISTR 3 // Unicode string type -#define VALUE_INT64 4 // 64 bit integer type - -// The number of allowable NOOP -#define MAX_NOOP_PER_SESSION 30 - -// VALUE object -struct VALUE -{ - UINT Size; // Size - UINT IntValue; // Integer value - void *Data; // Data - char *Str; // ANSI string - wchar_t *UniStr; // Unicode strings - UINT64 Int64Value; // 64 bit integer type -}; - -// ELEMENT object -struct ELEMENT -{ - char name[MAX_ELEMENT_NAME_LEN + 1]; // Element name - UINT num_value; // Number of values (>=1) - UINT type; // Type - VALUE **values; // List of pointers to the value - bool JsonHint_IsArray; - bool JsonHint_IsBool; - bool JsonHint_IsDateTime; - bool JsonHint_IsIP; - char JsonHint_GroupName[MAX_ELEMENT_NAME_LEN + 1]; -}; - -// PACK object -struct PACK -{ - LIST *elements; // Element list - LIST *json_subitem_names; // JSON sub-item names - char CurrentJsonHint_GroupName[MAX_ELEMENT_NAME_LEN + 1]; -}; - - -#define MAX_JSONPACK_HINT_ITEMS 64 -#define JSONPACK_HINT_TYPE_ARRAY 1 - -// JSON/PACK converter hint element -struct JSONPACKHINT_ITEM -{ - UINT Type; - char ArrayNumNameInPack[MAX_ELEMENT_NAME_LEN + 1]; - char ArrayMembersInPack[MAX_SIZE + 1]; -}; - -// JSON/PACK converter hint -struct JSONPACKHINT -{ - UINT NumHints; - JSONPACKHINT_ITEM Hints[MAX_JSONPACK_HINT_ITEMS]; -}; - - -// Function prototype -PACK *NewPack(); -bool AddElement(PACK *p, ELEMENT *e); -void DelElement(PACK *p, char *name); -bool IsElement(PACK *p, char *name); -ELEMENT *GetElement(PACK *p, char *name, UINT type); -void FreePack(PACK *p); -ELEMENT *NewElement(char *name, UINT type, UINT num_value, VALUE **values); -VALUE *NewIntValue(UINT i); -VALUE *NewDataValue(void *data, UINT size); -VALUE *NewStrValue(char *str); -VALUE *NewUniStrValue(wchar_t *str); -void FreeValue(VALUE *v, UINT type); -int ComparePackName(void *p1, void *p2); -void FreeElement(ELEMENT *e); -UINT GetValueNum(ELEMENT *e); -UINT GetIntValue(ELEMENT *e, UINT index); -UINT64 GetInt64Value(ELEMENT *e, UINT index); -char *GetStrValue(ELEMENT *e, UINT index); -wchar_t *GetUniStrValue(ELEMENT *e, UINT index); -UINT GetDataValueSize(ELEMENT *e, UINT index); -void *GetDataValue(ELEMENT *e, UINT index); -BUF *PackToBuf(PACK *p); -void WritePack(BUF *b, PACK *p); -void WriteElement(BUF *b, ELEMENT *e); -void WriteValue(BUF *b, VALUE *v, UINT type); -PACK *BufToPack(BUF *b); -bool ReadPack(BUF *b, PACK *p); -ELEMENT *ReadElement(BUF *b); -VALUE *ReadValue(BUF *b, UINT type); -void Bit160ToStr(char *str, UCHAR *data); -VALUE *NewInt64Value(UINT64 i); -TOKEN_LIST *GetPackElementNames(PACK *p); - -X *PackGetX(PACK *p, char *name); -K *PackGetK(PACK *p, char *name); -ELEMENT *PackAddX(PACK *p, char *name, X *x); -ELEMENT *PackAddK(PACK *p, char *name, K *k); -ELEMENT *PackAddStr(PACK *p, char *name, char *str); -ELEMENT *PackAddStrEx(PACK *p, char *name, char *str, UINT index, UINT total); -ELEMENT *PackAddUniStr(PACK *p, char *name, wchar_t *unistr); -ELEMENT *PackAddUniStrEx(PACK *p, char *name, wchar_t *unistr, UINT index, UINT total); -ELEMENT *PackAddInt(PACK *p, char *name, UINT i); -ELEMENT *PackAddNum(PACK *p, char *name, UINT num); -ELEMENT *PackAddIntEx(PACK *p, char *name, UINT i, UINT index, UINT total); -ELEMENT *PackAddInt64(PACK *p, char *name, UINT64 i); -ELEMENT *PackAddInt64Ex(PACK *p, char *name, UINT64 i, UINT index, UINT total); -ELEMENT *PackAddTime64(PACK *p, char *name, UINT64 i); -ELEMENT *PackAddTime64Ex(PACK *p, char *name, UINT64 i, UINT index, UINT total); -ELEMENT *PackAddData(PACK *p, char *name, void *data, UINT size); -ELEMENT *PackAddDataEx(PACK *p, char *name, void *data, UINT size, UINT index, UINT total); -ELEMENT *PackAddBuf(PACK *p, char *name, BUF *b); -ELEMENT *PackAddBufEx(PACK *p, char *name, BUF *b, UINT index, UINT total); -bool PackGetStrSize(PACK *p, char *name); -bool PackGetStrSizeEx(PACK *p, char *name, UINT index); -bool PackGetStr(PACK *p, char *name, char *str, UINT size); -bool PackGetStrEx(PACK *p, char *name, char *str, UINT size, UINT index); -bool PackGetUniStr(PACK *p, char *name, wchar_t *unistr, UINT size); -bool PackGetUniStrEx(PACK *p, char *name, wchar_t *unistr, UINT size, UINT index); -bool PackCmpStr(PACK *p, char *name, char *str); -UINT PackGetIndexCount(PACK *p, char *name); -UINT PackGetInt(PACK *p, char *name); -UINT PackGetNum(PACK *p, char *name); -UINT PackGetIntEx(PACK *p, char *name, UINT index); -UINT64 PackGetInt64(PACK *p, char *name); -UINT64 PackGetInt64Ex(PACK *p, char *name, UINT index); -UINT PackGetDataSizeEx(PACK *p, char *name, UINT index); -UINT PackGetDataSize(PACK *p, char *name); -bool PackGetData(PACK *p, char *name, void *data); -bool PackGetDataEx(PACK *p, char *name, void *data, UINT index); -BUF *PackGetBuf(PACK *p, char *name); -BUF *PackGetBufEx(PACK *p, char *name, UINT index); -bool PackGetBool(PACK *p, char *name); -ELEMENT *PackAddBool(PACK *p, char *name, bool b); -ELEMENT *PackAddBoolEx(PACK *p, char *name, bool b, UINT index, UINT total); -bool PackGetBoolEx(PACK *p, char *name, UINT index); -void PackAddIp(PACK *p, char *name, IP *ip); -void PackAddIpEx(PACK *p, char *name, IP *ip, UINT index, UINT total); -void PackAddIpEx2(PACK *p, char *name, IP *ip, UINT index, UINT total, bool is_single); -bool PackGetIp(PACK *p, char *name, IP *ip); -bool PackGetIpEx(PACK *p, char *name, IP *ip, UINT index); -UINT PackGetIp32(PACK *p, char *name); -UINT PackGetIp32Ex(PACK *p, char *name, UINT index); -void PackAddIp32(PACK *p, char *name, UINT ip32); -void PackAddIp32Ex(PACK *p, char *name, UINT ip32, UINT index, UINT total); -void PackAddIp32Ex2(PACK *p, char *name, UINT ip32, UINT index, UINT total, bool is_single); -ELEMENT *PackAddIp6AddrEx(PACK *p, char *name, IPV6_ADDR *addr, UINT index, UINT total); -bool PackGetIp6AddrEx(PACK *p, char *name, IPV6_ADDR *addr, UINT index); -ELEMENT *PackAddIp6Addr(PACK *p, char *name, IPV6_ADDR *addr); -bool PackGetIp6Addr(PACK *p, char *name, IPV6_ADDR *addr); -bool PackGetData2(PACK *p, char *name, void *data, UINT size); -bool PackGetDataEx2(PACK *p, char *name, void *data, UINT size, UINT index); -bool PackIsValueExists(PACK *p, char *name); -void PackSetCurrentJsonGroupName(PACK *p, char *json_group_name); -ELEMENT *ElementNullSafe(ELEMENT *p); - -JSON_VALUE *PackToJson(PACK *p); -char *PackToJsonStr(PACK *p); - -PACK *JsonToPack(JSON_VALUE *v); -PACK *JsonStrToPack(char *str); - -void PackArrayElementToJsonArray(JSON_ARRAY *ja, PACK *p, ELEMENT *e, UINT index); -void PackElementToJsonObject(JSON_OBJECT *o, PACK *p, ELEMENT *e, UINT index); -char *DetermineJsonSuffixForPackElement(ELEMENT *e); -bool JsonTryParseValueAddToPack(PACK *p, JSON_VALUE *v, char *v_name, UINT index, UINT total, bool is_single); - -#endif // PACK_H +// SoftEther VPN Source Code - Developer Edition Master Branch +// Mayaqua Kernel + + +// Pack.h +// Header of Pack.c + +#ifndef PACK_H +#define PACK_H + +// Constant +#ifdef CPU_64 + +#define MAX_VALUE_SIZE (384 * 1024 * 1024) // Maximum Data size that can be stored in a single VALUE +#define MAX_VALUE_NUM 262144 // Maximum VALUE number that can be stored in a single ELEMENT +#define MAX_ELEMENT_NAME_LEN 63 // The length of the name that can be attached to the ELEMENT +#define MAX_ELEMENT_NUM 262144 // Maximum ELEMENT number that can be stored in a single PACK +#define MAX_PACK_SIZE (512 * 1024 * 1024) // Maximum size of a serialized PACK + +#else // CPU_64 + +#define MAX_VALUE_SIZE (96 * 1024 * 1024) // Maximum Data size that can be stored in a single VALUE +#define MAX_VALUE_NUM 65536 // Maximum VALUE number that can be stored in a single ELEMENT +#define MAX_ELEMENT_NAME_LEN 63 // The length of the name that can be attached to the ELEMENT +#define MAX_ELEMENT_NUM 131072 // Maximum ELEMENT number that can be stored in a single PACK +#define MAX_PACK_SIZE (128 * 1024 * 1024) // Maximum size of a serialized PACK + +#endif // CPU_64 + +// Type of VALUE +#define VALUE_INT 0 // Integer type +#define VALUE_DATA 1 // Data type +#define VALUE_STR 2 // ANSI string type +#define VALUE_UNISTR 3 // Unicode string type +#define VALUE_INT64 4 // 64 bit integer type + +// The number of allowable NOOP +#define MAX_NOOP_PER_SESSION 30 + +// VALUE object +struct VALUE +{ + UINT Size; // Size + UINT IntValue; // Integer value + void *Data; // Data + char *Str; // ANSI string + wchar_t *UniStr; // Unicode strings + UINT64 Int64Value; // 64 bit integer type +}; + +// ELEMENT object +struct ELEMENT +{ + char name[MAX_ELEMENT_NAME_LEN + 1]; // Element name + UINT num_value; // Number of values (>=1) + UINT type; // Type + VALUE **values; // List of pointers to the value + bool JsonHint_IsArray; + bool JsonHint_IsBool; + bool JsonHint_IsDateTime; + bool JsonHint_IsIP; + char JsonHint_GroupName[MAX_ELEMENT_NAME_LEN + 1]; +}; + +// PACK object +struct PACK +{ + LIST *elements; // Element list + LIST *json_subitem_names; // JSON sub-item names + char CurrentJsonHint_GroupName[MAX_ELEMENT_NAME_LEN + 1]; +}; + + +#define MAX_JSONPACK_HINT_ITEMS 64 +#define JSONPACK_HINT_TYPE_ARRAY 1 + +// JSON/PACK converter hint element +struct JSONPACKHINT_ITEM +{ + UINT Type; + char ArrayNumNameInPack[MAX_ELEMENT_NAME_LEN + 1]; + char ArrayMembersInPack[MAX_SIZE + 1]; +}; + +// JSON/PACK converter hint +struct JSONPACKHINT +{ + UINT NumHints; + JSONPACKHINT_ITEM Hints[MAX_JSONPACK_HINT_ITEMS]; +}; + + +// Function prototype +PACK *NewPack(); +bool AddElement(PACK *p, ELEMENT *e); +void DelElement(PACK *p, char *name); +bool IsElement(PACK *p, char *name); +ELEMENT *GetElement(PACK *p, char *name, UINT type); +void FreePack(PACK *p); +ELEMENT *NewElement(char *name, UINT type, UINT num_value, VALUE **values); +VALUE *NewIntValue(UINT i); +VALUE *NewDataValue(void *data, UINT size); +VALUE *NewStrValue(char *str); +VALUE *NewUniStrValue(wchar_t *str); +void FreeValue(VALUE *v, UINT type); +int ComparePackName(void *p1, void *p2); +void FreeElement(ELEMENT *e); +UINT GetValueNum(ELEMENT *e); +UINT GetIntValue(ELEMENT *e, UINT index); +UINT64 GetInt64Value(ELEMENT *e, UINT index); +char *GetStrValue(ELEMENT *e, UINT index); +wchar_t *GetUniStrValue(ELEMENT *e, UINT index); +UINT GetDataValueSize(ELEMENT *e, UINT index); +void *GetDataValue(ELEMENT *e, UINT index); +BUF *PackToBuf(PACK *p); +void WritePack(BUF *b, PACK *p); +void WriteElement(BUF *b, ELEMENT *e); +void WriteValue(BUF *b, VALUE *v, UINT type); +PACK *BufToPack(BUF *b); +bool ReadPack(BUF *b, PACK *p); +ELEMENT *ReadElement(BUF *b); +VALUE *ReadValue(BUF *b, UINT type); +void Bit160ToStr(char *str, UCHAR *data); +VALUE *NewInt64Value(UINT64 i); +TOKEN_LIST *GetPackElementNames(PACK *p); + +X *PackGetX(PACK *p, char *name); +K *PackGetK(PACK *p, char *name); +ELEMENT *PackAddX(PACK *p, char *name, X *x); +ELEMENT *PackAddK(PACK *p, char *name, K *k); +ELEMENT *PackAddStr(PACK *p, char *name, char *str); +ELEMENT *PackAddStrEx(PACK *p, char *name, char *str, UINT index, UINT total); +ELEMENT *PackAddUniStr(PACK *p, char *name, wchar_t *unistr); +ELEMENT *PackAddUniStrEx(PACK *p, char *name, wchar_t *unistr, UINT index, UINT total); +ELEMENT *PackAddInt(PACK *p, char *name, UINT i); +ELEMENT *PackAddNum(PACK *p, char *name, UINT num); +ELEMENT *PackAddIntEx(PACK *p, char *name, UINT i, UINT index, UINT total); +ELEMENT *PackAddInt64(PACK *p, char *name, UINT64 i); +ELEMENT *PackAddInt64Ex(PACK *p, char *name, UINT64 i, UINT index, UINT total); +ELEMENT *PackAddTime64(PACK *p, char *name, UINT64 i); +ELEMENT *PackAddTime64Ex(PACK *p, char *name, UINT64 i, UINT index, UINT total); +ELEMENT *PackAddData(PACK *p, char *name, void *data, UINT size); +ELEMENT *PackAddDataEx(PACK *p, char *name, void *data, UINT size, UINT index, UINT total); +ELEMENT *PackAddBuf(PACK *p, char *name, BUF *b); +ELEMENT *PackAddBufEx(PACK *p, char *name, BUF *b, UINT index, UINT total); +bool PackGetStrSize(PACK *p, char *name); +bool PackGetStrSizeEx(PACK *p, char *name, UINT index); +bool PackGetStr(PACK *p, char *name, char *str, UINT size); +bool PackGetStrEx(PACK *p, char *name, char *str, UINT size, UINT index); +bool PackGetUniStr(PACK *p, char *name, wchar_t *unistr, UINT size); +bool PackGetUniStrEx(PACK *p, char *name, wchar_t *unistr, UINT size, UINT index); +bool PackCmpStr(PACK *p, char *name, char *str); +UINT PackGetIndexCount(PACK *p, char *name); +UINT PackGetInt(PACK *p, char *name); +UINT PackGetNum(PACK *p, char *name); +UINT PackGetIntEx(PACK *p, char *name, UINT index); +UINT64 PackGetInt64(PACK *p, char *name); +UINT64 PackGetInt64Ex(PACK *p, char *name, UINT index); +UINT PackGetDataSizeEx(PACK *p, char *name, UINT index); +UINT PackGetDataSize(PACK *p, char *name); +bool PackGetData(PACK *p, char *name, void *data); +bool PackGetDataEx(PACK *p, char *name, void *data, UINT index); +BUF *PackGetBuf(PACK *p, char *name); +BUF *PackGetBufEx(PACK *p, char *name, UINT index); +bool PackGetBool(PACK *p, char *name); +ELEMENT *PackAddBool(PACK *p, char *name, bool b); +ELEMENT *PackAddBoolEx(PACK *p, char *name, bool b, UINT index, UINT total); +bool PackGetBoolEx(PACK *p, char *name, UINT index); +void PackAddIp(PACK *p, char *name, IP *ip); +void PackAddIpEx(PACK *p, char *name, IP *ip, UINT index, UINT total); +void PackAddIpEx2(PACK *p, char *name, IP *ip, UINT index, UINT total, bool is_single); +bool PackGetIp(PACK *p, char *name, IP *ip); +bool PackGetIpEx(PACK *p, char *name, IP *ip, UINT index); +UINT PackGetIp32(PACK *p, char *name); +UINT PackGetIp32Ex(PACK *p, char *name, UINT index); +void PackAddIp32(PACK *p, char *name, UINT ip32); +void PackAddIp32Ex(PACK *p, char *name, UINT ip32, UINT index, UINT total); +void PackAddIp32Ex2(PACK *p, char *name, UINT ip32, UINT index, UINT total, bool is_single); +ELEMENT *PackAddIp6AddrEx(PACK *p, char *name, IPV6_ADDR *addr, UINT index, UINT total); +bool PackGetIp6AddrEx(PACK *p, char *name, IPV6_ADDR *addr, UINT index); +ELEMENT *PackAddIp6Addr(PACK *p, char *name, IPV6_ADDR *addr); +bool PackGetIp6Addr(PACK *p, char *name, IPV6_ADDR *addr); +bool PackGetData2(PACK *p, char *name, void *data, UINT size); +bool PackGetDataEx2(PACK *p, char *name, void *data, UINT size, UINT index); +bool PackIsValueExists(PACK *p, char *name); +void PackSetCurrentJsonGroupName(PACK *p, char *json_group_name); +ELEMENT *ElementNullSafe(ELEMENT *p); + +JSON_VALUE *PackToJson(PACK *p); +char *PackToJsonStr(PACK *p); + +PACK *JsonToPack(JSON_VALUE *v); +PACK *JsonStrToPack(char *str); + +void PackArrayElementToJsonArray(JSON_ARRAY *ja, PACK *p, ELEMENT *e, UINT index); +void PackElementToJsonObject(JSON_OBJECT *o, PACK *p, ELEMENT *e, UINT index); +char *DetermineJsonSuffixForPackElement(ELEMENT *e); +bool JsonTryParseValueAddToPack(PACK *p, JSON_VALUE *v, char *v_name, UINT index, UINT total, bool is_single); + +#endif // PACK_H diff --git a/src/Mayaqua/Secure.c b/src/Mayaqua/Secure.c index 69eef15b..fdc0e7b6 100644 --- a/src/Mayaqua/Secure.c +++ b/src/Mayaqua/Secure.c @@ -1,2150 +1,2150 @@ -// SoftEther VPN Source Code - Developer Edition Master Branch -// Mayaqua Kernel - - -// Secure.c -// Security token management module - -#include - -#define SECURE_C -#define ENCRYPT_C - -#ifdef WIN32 -#include -#endif // WIN32 - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - - -#define MAX_OBJ 1024 // Maximum number of objects in the hardware (assumed) - -#define A_SIZE(a, i) (a[(i)].ulValueLen) -#define A_SET(a, i, value, size) (a[i].pValue = value;a[i].ulValueLen = size;) - -#ifdef OS_WIN32 -// Code for Win32 - -// DLL reading for Win32 -HINSTANCE Win32SecureLoadLibraryEx(char *dllname, DWORD flags) -{ - char tmp1[MAX_PATH]; - char tmp2[MAX_PATH]; - char tmp3[MAX_PATH]; - HINSTANCE h; - // Validate arguments - if (dllname == NULL) - { - return NULL; - } - - Format(tmp1, sizeof(tmp1), "%s\\%s", MsGetSystem32Dir(), dllname); - Format(tmp2, sizeof(tmp2), "%s\\JPKI\\%s", MsGetProgramFilesDir(), dllname); - Format(tmp3, sizeof(tmp3), "%s\\LGWAN\\%s", MsGetProgramFilesDir(), dllname); - - h = LoadLibraryEx(dllname, NULL, flags); - if (h != NULL) - { - return h; - } - - h = LoadLibraryEx(tmp1, NULL, flags); - if (h != NULL) - { - return h; - } - - h = LoadLibraryEx(tmp2, NULL, flags); - if (h != NULL) - { - return h; - } - - h = LoadLibraryEx(tmp3, NULL, flags); - if (h != NULL) - { - return h; - } - - return NULL; -} - -// Examine whether the specified device is installed -bool Win32IsDeviceSupported(SECURE_DEVICE *dev) -{ - HINSTANCE hInst; - // Validate arguments - if (dev == NULL) - { - return false; - } - - // Check whether the DLL is readable - hInst = Win32SecureLoadLibraryEx(dev->ModuleName, DONT_RESOLVE_DLL_REFERENCES); - if (hInst == NULL) - { - return false; - } - - FreeLibrary(hInst); - - return true; -} - -// Load the device module -bool Win32LoadSecModule(SECURE *sec) -{ - SEC_DATA_WIN32 *w; - HINSTANCE hInst; - CK_FUNCTION_LIST_PTR api = NULL; - CK_RV (*get_function_list)(CK_FUNCTION_LIST_PTR_PTR); - // Validate arguments - if (sec == NULL) - { - return false; - } - - if (sec->Dev->Id == 9) - { - char username[MAX_SIZE]; - DWORD size; - // Because the device driver of Juki-Net needs the contents - // of the Software\JPKI registry key on HKLU of SYSTEM, - // if there is no key, copy the key from the value of other user -// if (MsRegIsValue(REG_CURRENT_USER, "Software\\JPKI", "Name") == false || -// MsRegIsValue(REG_CURRENT_USER, "Software\\JPKI", "RWType") == false) - size = sizeof(username); - GetUserName(username, &size); - if (StrCmpi(username, "System") == 0) - { - TOKEN_LIST *t = MsRegEnumKey(REG_USERS, NULL); - - if (t != NULL) - { - UINT i; - - for (i = 0;i < t->NumTokens;i++) - { - char tmp[MAX_PATH]; - - if (StrCmpi(t->Token[i], ".DEFAULT") != 0 && StrCmpi(t->Token[i], "S-1-5-18") != 0) - { - Format(tmp, sizeof(tmp), "%s\\Software\\JPKI", t->Token[i]); - - if (MsRegIsValue(REG_USERS, tmp, "Name") && MsRegIsValue(REG_USERS, tmp, "RWType")) - { - char *name = MsRegReadStr(REG_USERS, tmp, "Name"); - char *port = MsRegReadStr(REG_USERS, tmp, "Port"); - UINT type = MsRegReadInt(REG_USERS, tmp, "RWType"); - - MsRegWriteStr(REG_CURRENT_USER, "Software\\JPKI", "Name", name); - MsRegWriteStr(REG_CURRENT_USER, "Software\\JPKI", "Port", port); - MsRegWriteInt(REG_CURRENT_USER, "Software\\JPKI", "RWType", type); - - Free(name); - Free(port); - break; - } - } - } - - FreeToken(t); - } - } - } - - // Load the Library - hInst = Win32SecureLoadLibraryEx(sec->Dev->ModuleName, 0); - if (hInst == NULL) - { - // Failure - return false; - } - - // Get the API - get_function_list = (CK_RV (*)(CK_FUNCTION_LIST_PTR_PTR)) - GetProcAddress(hInst, "C_GetFunctionList"); - - if (get_function_list == NULL) - { - // Failure - FreeLibrary(hInst); - return false; - } - - get_function_list(&api); - if (api == NULL) - { - // Failure - FreeLibrary(hInst); - return false; - } - - sec->Data = ZeroMalloc(sizeof(SEC_DATA_WIN32)); - w = sec->Data; - - w->hInst = hInst; - sec->Api = api; - - return true; -} - -// Unload the device module -void Win32FreeSecModule(SECURE *sec) -{ - // Validate arguments - if (sec == NULL) - { - return; - } - if (sec->Data == NULL) - { - return; - } - - // Unload - FreeLibrary(sec->Data->hInst); - Free(sec->Data); - - sec->Data = NULL; -} - -#endif // OS_WIN32 - - -// Whether the specified device is a JPKI -bool IsJPKI(bool id) -{ - if (id == 9 || id == 13) - { - return true; - } - - return false; -} - -// Sign with the private key which is specified by the name in the secure device -bool SignSec(SECURE *sec, char *name, void *dst, void *src, UINT size) -{ - SEC_OBJ *obj; - UINT ret; - // Validate arguments - if (sec == NULL) - { - return false; - } - if (name == NULL || dst == NULL || src == NULL) - { - sec->Error = SEC_ERROR_BAD_PARAMETER; - return false; - } - - obj = FindSecObject(sec, name, SEC_K); - if (obj == NULL) - { - return false; - } - - ret = SignSecByObject(sec, obj, dst, src, size); - - FreeSecObject(obj); - - return ret; -} - -// Sign with the private key of the secure device -bool SignSecByObject(SECURE *sec, SEC_OBJ *obj, void *dst, void *src, UINT size) -{ - CK_MECHANISM mechanism = {CKM_RSA_PKCS, NULL, 0}; - UINT ret; - UCHAR hash[SIGN_HASH_SIZE]; - // Validate arguments - if (sec == NULL) - { - return false; - } - if (obj == NULL || dst == NULL || src == NULL) - { - sec->Error = SEC_ERROR_BAD_PARAMETER; - return false; - } - if (sec->SessionCreated == false) - { - sec->Error = SEC_ERROR_NO_SESSION; - return false; - } - if (sec->LoginFlag == false && obj->Private) - { - sec->Error = SEC_ERROR_NOT_LOGIN; - return false; - } - if (obj->Type != SEC_K) - { - sec->Error = SEC_ERROR_BAD_PARAMETER; - return false; - } - - // Hash - HashForSign(hash, sizeof(hash), src, size); - - // Signature initialization - ret = sec->Api->C_SignInit(sec->SessionId, &mechanism, obj->Object); - if (ret != CKR_OK) - { - // Failure - sec->Error = SEC_ERROR_HARDWARE_ERROR; - Debug("C_SignInit Error: 0x%x\n", ret); - return false; - } - - // Perform Signing - size = 128; - // First try with 1024 bit - ret = sec->Api->C_Sign(sec->SessionId, hash, sizeof(hash), dst, &size); - if (ret != CKR_OK && 128 < size && size <= 4096/8) - { - // Retry with expanded bits - ret = sec->Api->C_Sign(sec->SessionId, hash, sizeof(hash), dst, &size); - } - if (ret != CKR_OK || size == 0 || size > 4096/8) - { - // Failure - sec->Error = SEC_ERROR_HARDWARE_ERROR; - Debug("C_Sign Error: 0x%x size:%d\n", ret, size); - return false; - } - - return true; -} - -// Changing the PIN code -bool ChangePin(SECURE *sec, char *old_pin, char *new_pin) -{ - // Validate arguments - if (sec == NULL || old_pin == NULL || new_pin == NULL) - { - return false; - } - if (sec->SessionCreated == false) - { - sec->Error = SEC_ERROR_NO_SESSION; - return false; - } - if (sec->LoginFlag == false) - { - sec->Error = SEC_ERROR_NOT_LOGIN; - return false; - } - if (sec->IsReadOnly) - { - sec->Error = SEC_ERROR_OPEN_SESSION; - return false; - } - - // Change then PIN - if (sec->Api->C_SetPIN(sec->SessionId, old_pin, StrLen(old_pin), - new_pin, StrLen(new_pin)) != CKR_OK) - { - return false; - } - - return true; -} - -// Write the private key object -bool WriteSecKey(SECURE *sec, bool private_obj, char *name, K *k) -{ - UINT key_type = CKK_RSA; - CK_BBOOL b_true = true, b_false = false, b_private_obj = private_obj; - UINT obj_class = CKO_PRIVATE_KEY; - UINT object; - UINT ret; - BUF *b; - RSA *rsa; - UCHAR modules[MAX_SIZE], pub[MAX_SIZE], pri[MAX_SIZE], prime1[MAX_SIZE], prime2[MAX_SIZE]; - UCHAR exp1[MAX_SIZE], exp2[MAX_SIZE], coeff[MAX_SIZE]; - const BIGNUM *n, *e, *d, *p, *q, *dmp1, *dmq1, *iqmp; - CK_ATTRIBUTE a[] = - { - {CKA_MODULUS, modules, 0}, // 0 - {CKA_PUBLIC_EXPONENT, pub, 0}, // 1 - {CKA_PRIVATE_EXPONENT, pri, 0}, // 2 - {CKA_PRIME_1, prime1, 0}, // 3 - {CKA_PRIME_2, prime2, 0}, // 4 - {CKA_EXPONENT_1, exp1, 0}, // 5 - {CKA_EXPONENT_2, exp2, 0}, // 6 - {CKA_COEFFICIENT, coeff, 0}, // 7 - - {CKA_CLASS, &obj_class, sizeof(obj_class)}, - {CKA_TOKEN, &b_true, sizeof(b_true)}, - {CKA_PRIVATE, &b_private_obj, sizeof(b_private_obj)}, - {CKA_LABEL, name, StrLen(name)}, - {CKA_KEY_TYPE, &key_type, sizeof(key_type)}, - {CKA_DERIVE, &b_false, sizeof(b_false)}, - {CKA_SUBJECT, name, StrLen(name)}, - {CKA_SENSITIVE, &b_true, sizeof(b_true)}, - {CKA_DECRYPT, &b_true, sizeof(b_true)}, - {CKA_SIGN, &b_true, sizeof(b_true)}, - {CKA_SIGN_RECOVER, &b_false, sizeof(b_false)}, - {CKA_EXTRACTABLE, &b_false, sizeof(b_false)}, - {CKA_MODIFIABLE, &b_false, sizeof(b_false)}, - }; - - // Validate arguments - if (sec == NULL) - { - return false; - } - if (name == NULL || k == NULL || k->private_key == false) - { - sec->Error = SEC_ERROR_BAD_PARAMETER; - return false; - } - if (sec->SessionCreated == false) - { - sec->Error = SEC_ERROR_NO_SESSION; - return false; - } - if (sec->LoginFlag == false && private_obj) - { - sec->Error = SEC_ERROR_NOT_LOGIN; - return false; - } - - // Numeric data generation - rsa = EVP_PKEY_get0_RSA(k->pkey); - if (rsa == NULL) - { - sec->Error = SEC_ERROR_BAD_PARAMETER; - return false; - } - -#if OPENSSL_VERSION_NUMBER >= 0x10100000L - RSA_get0_key(rsa, &n, &e, &d); - RSA_get0_factors(rsa, &p, &q); - RSA_get0_crt_params(rsa, &dmp1, &dmq1, &iqmp); -#else - n = rsa->n; - e = rsa->e; - d = rsa->d; - p = rsa->p; - q = rsa->q; - dmp1 = rsa->dmp1; - dmq1 = rsa->dmq1; - iqmp = rsa->iqmp; -#endif - - b = BigNumToBuf(n); - ReadBuf(b, modules, sizeof(modules)); - A_SIZE(a, 0) = b->Size; - FreeBuf(b); - - b = BigNumToBuf(e); - ReadBuf(b, pub, sizeof(pub)); - A_SIZE(a, 1) = b->Size; - FreeBuf(b); - - b = BigNumToBuf(d); - ReadBuf(b, pri, sizeof(pri)); - A_SIZE(a, 2) = b->Size; - FreeBuf(b); - - b = BigNumToBuf(p); - ReadBuf(b, prime1, sizeof(prime1)); - A_SIZE(a, 3) = b->Size; - FreeBuf(b); - - b = BigNumToBuf(q); - ReadBuf(b, prime2, sizeof(prime2)); - A_SIZE(a, 4) = b->Size; - FreeBuf(b); - - b = BigNumToBuf(dmp1); - ReadBuf(b, exp1, sizeof(exp1)); - A_SIZE(a, 5) = b->Size; - FreeBuf(b); - - b = BigNumToBuf(dmq1); - ReadBuf(b, exp2, sizeof(exp2)); - A_SIZE(a, 6) = b->Size; - FreeBuf(b); - - b = BigNumToBuf(iqmp); - ReadBuf(b, coeff, sizeof(coeff)); - A_SIZE(a, 7) = b->Size; - FreeBuf(b); - - // Delete the old key if it exists - if (CheckSecObject(sec, name, SEC_K)) - { - DeleteSecKey(sec, name); - } - - // Creating - if ((ret = sec->Api->C_CreateObject(sec->SessionId, a, sizeof(a) / sizeof(a[0]), &object)) != CKR_OK) - { - // Failure - sec->Error = SEC_ERROR_HARDWARE_ERROR; - Debug("ret: 0x%x\n", ret); - return false; - } - - // Clear Cache - EraseEnumSecObjectCache(sec); - - return true; -} - -// Read the certificate object by specifying the name -X *ReadSecCert(SECURE *sec, char *name) -{ - SEC_OBJ *obj; - X *x; - // Validate arguments - if (sec == NULL) - { - return false; - } - if (sec->SessionCreated == false) - { - sec->Error = SEC_ERROR_NO_SESSION; - return false; - } - - // Search - obj = FindSecObject(sec, name, SEC_X); - if (obj == NULL) - { - return false; - } - - // Acquisition - x = ReadSecCertFromObject(sec, obj); - - FreeSecObject(obj); - - return x; -} - -// Read the certificate object -X *ReadSecCertFromObject(SECURE *sec, SEC_OBJ *obj) -{ - UINT size; - X *x; - UCHAR value[4096]; - BUF *b; - CK_ATTRIBUTE get[] = - { - {CKA_VALUE, value, sizeof(value)}, - }; - // Validate arguments - if (sec == NULL) - { - return false; - } - if (sec->SessionCreated == false) - { - sec->Error = SEC_ERROR_NO_SESSION; - return false; - } - if (sec->LoginFlag == false && obj->Private) - { - sec->Error = SEC_ERROR_NOT_LOGIN; - return false; - } - if (obj->Type != SEC_X) - { - sec->Error = SEC_ERROR_BAD_PARAMETER; - return false; - } - - // Acquisition - if (sec->Api->C_GetAttributeValue( - sec->SessionId, obj->Object, get, sizeof(get) / sizeof(get[0])) != CKR_OK) - { - sec->Error = SEC_ERROR_HARDWARE_ERROR; - return 0; - } - - size = A_SIZE(get, 0); - - // Conversion - b = NewBuf(); - WriteBuf(b, value, size); - SeekBuf(b, 0, 0); - - x = BufToX(b, false); - if (x == NULL) - { - sec->Error = SEC_ERROR_INVALID_CERT; - } - - FreeBuf(b); - - return x; -} - -// Write the certificate object -bool WriteSecCert(SECURE *sec, bool private_obj, char *name, X *x) -{ - UINT obj_class = CKO_CERTIFICATE; - CK_BBOOL b_true = true, b_false = false, b_private_obj = private_obj; - UINT cert_type = CKC_X_509; - CK_DATE start_date, end_date; - UCHAR subject[MAX_SIZE]; - UCHAR issuer[MAX_SIZE]; - wchar_t w_subject[MAX_SIZE]; - wchar_t w_issuer[MAX_SIZE]; - UCHAR serial_number[MAX_SIZE]; - UCHAR value[4096]; - UINT ret; - BUF *b; - UINT object; - CK_ATTRIBUTE a[] = - { - {CKA_SUBJECT, subject, 0}, // 0 - {CKA_ISSUER, issuer, 0}, // 1 - {CKA_SERIAL_NUMBER, serial_number, 0}, // 2 - {CKA_VALUE, value, 0}, // 3 - {CKA_CLASS, &obj_class, sizeof(obj_class)}, - {CKA_TOKEN, &b_true, sizeof(b_true)}, - {CKA_PRIVATE, &b_private_obj, sizeof(b_private_obj)}, - {CKA_LABEL, name, StrLen(name)}, - {CKA_CERTIFICATE_TYPE, &cert_type, sizeof(cert_type)}, -#if 0 // Don't use these because some tokens fail - {CKA_START_DATE, &start_date, sizeof(start_date)}, - {CKA_END_DATE, &end_date, sizeof(end_date)}, -#endif - }; - // Validate arguments - if (sec == NULL) - { - return false; - } - if (name == NULL) - { - sec->Error = SEC_ERROR_BAD_PARAMETER; - return false; - } - if (sec->SessionCreated == false) - { - sec->Error = SEC_ERROR_NO_SESSION; - return false; - } - if (sec->LoginFlag == false && private_obj) - { - sec->Error = SEC_ERROR_NOT_LOGIN; - return false; - } - - // Copy the certificate to the buffer - b = XToBuf(x, false); - if (b == NULL) - { - sec->Error = SEC_ERROR_INVALID_CERT; - return false; - } - if (b->Size > sizeof(value)) - { - // Size is too large - FreeBuf(b); - sec->Error = SEC_ERROR_DATA_TOO_BIG; - return false; - } - Copy(value, b->Buf, b->Size); - A_SIZE(a, 3) = b->Size; - FreeBuf(b); - - // Store the Subject and the Issuer by encoding into UTF-8 - GetPrintNameFromName(w_subject, sizeof(w_subject), x->subject_name); - UniToUtf8(subject, sizeof(subject), w_subject); - A_SIZE(a, 0) = StrLen(subject); - if (x->root_cert == false) - { - GetPrintNameFromName(w_issuer, sizeof(w_issuer), x->issuer_name); - UniToUtf8(issuer, sizeof(issuer), w_issuer); - A_SIZE(a, 1) = StrLen(issuer); - } - - // Copy the serial number - Copy(serial_number, x->serial->data, MIN(x->serial->size, sizeof(serial_number))); - A_SIZE(a, 2) = MIN(x->serial->size, sizeof(serial_number)); - - // Expiration date information - UINT64ToCkDate(&start_date, SystemToLocal64(x->notBefore)); - UINT64ToCkDate(&end_date, SystemToLocal64(x->notAfter)); - - // Workaround for Gemalto PKCS#11 API. It rejects a private certificate. - if(sec->Dev->Id == 18 || sec->Dev->Id == 19) - { - b_private_obj = false; - } - - // Remove objects which have the same name - if (CheckSecObject(sec, name, SEC_X)) - { - DeleteSecCert(sec, name); - } - - // Creating - if ((ret = sec->Api->C_CreateObject(sec->SessionId, a, sizeof(a) / sizeof(a[0]), &object)) != CKR_OK) - { - // Failure - sec->Error = SEC_ERROR_HARDWARE_ERROR; - Debug("Error: 0x%02x\n", ret); - return false; - } - - // Clear Cache - EraseEnumSecObjectCache(sec); - - return true; -} - -// Delete the private key object -bool DeleteSecKey(SECURE *sec, char *name) -{ - return DeleteSecObjectByName(sec, name, SEC_K); -} - -// Delete the certificate object -bool DeleteSecCert(SECURE *sec, char *name) -{ - return DeleteSecObjectByName(sec, name, SEC_X); -} - -// Convert the the CK_DATE to the 64 bit time -UINT64 CkDateToUINT64(struct CK_DATE *ck_date) -{ - SYSTEMTIME st; - char year[32], month[32], day[32]; - // Validate arguments - if (ck_date == NULL) - { - return 0; - } - - Zero(year, sizeof(year)); - Zero(month, sizeof(month)); - Zero(day, sizeof(day)); - - Copy(year, ck_date->year, 4); - Copy(month, ck_date->month, 2); - Copy(day, ck_date->day, 2); - - st.wYear = ToInt(year); - st.wMonth = ToInt(month); - st.wDay = ToInt(day); - - return SystemToUINT64(&st); -} - -// Convert the 64 bit time to the CK_DATE -void UINT64ToCkDate(void *p_ck_date, UINT64 time64) -{ - SYSTEMTIME st; - char year[32], month[32], day[32]; - struct CK_DATE *ck_date = (CK_DATE *)p_ck_date; - // Validate arguments - if (ck_date == NULL) - { - return; - } - - UINT64ToSystem(&st, time64); - - Format(year, sizeof(year), "%04u", st.wYear); - Format(month, sizeof(month), "%04u", st.wMonth); - Format(day, sizeof(day), "%04u", st.wDay); - - Zero(ck_date, sizeof(CK_DATE)); - - Copy(ck_date->year, year, 4); - Copy(ck_date->month, month, 2); - Copy(ck_date->day, day, 2); -} - -// Delete the object by specifying the name -bool DeleteSecObjectByName(SECURE *sec, char *name, UINT type) -{ - bool ret; - SEC_OBJ *obj; - // Validate arguments - if (sec == NULL) - { - return false; - } - if (name == NULL) - { - sec->Error = SEC_ERROR_BAD_PARAMETER; - return false; - } - if (sec->SessionCreated == false) - { - sec->Error = SEC_ERROR_NO_SESSION; - return false; - } - - // Get the Object - obj = FindSecObject(sec, name, type); - if (obj == NULL) - { - // Failure - return false; - } - - // Delete the Object - ret = DeleteSecObject(sec, obj); - - // Memory release - FreeSecObject(obj); - - return ret; -} - -// Delete the Data -bool DeleteSecData(SECURE *sec, char *name) -{ - // Validate arguments - if (sec == NULL) - { - return false; - } - if (name == NULL) - { - sec->Error = SEC_ERROR_BAD_PARAMETER; - return false; - } - - return DeleteSecObjectByName(sec, name, SEC_DATA); -} - -// Delete the secure object -bool DeleteSecObject(SECURE *sec, SEC_OBJ *obj) -{ - // Validate arguments - if (sec == NULL) - { - return false; - } - if (obj == NULL) - { - sec->Error = SEC_ERROR_BAD_PARAMETER; - return false; - } - if (sec->SessionCreated == false) - { - sec->Error = SEC_ERROR_NO_SESSION; - return false; - } - if (sec->LoginFlag == false && obj->Private) - { - sec->Error = SEC_ERROR_NOT_LOGIN; - return false; - } - - // Delete the Object - if (sec->Api->C_DestroyObject(sec->SessionId, obj->Object) != CKR_OK) - { - sec->Error = SEC_ERROR_HARDWARE_ERROR; - return false; - } - - // Clear the Cache - DeleteSecObjFromEnumCache(sec, obj->Name, obj->Type); - - return true; -} - -// Remove the object which have the specified name from the cache -void DeleteSecObjFromEnumCache(SECURE *sec, char *name, UINT type) -{ - UINT i; - // Validate arguments - if (sec == NULL || name == NULL || sec->EnumCache == NULL) - { - return; - } - - for (i = 0;i < LIST_NUM(sec->EnumCache);i++) - { - SEC_OBJ *obj = LIST_DATA(sec->EnumCache, i); - - if (StrCmpi(obj->Name, name) == 0) - { - if (obj->Type == type) - { - Delete(sec->EnumCache, obj); - FreeSecObject(obj); - break; - } - } - } -} - -// Read by searching a secure object by name -int ReadSecData(SECURE *sec, char *name, void *data, UINT size) -{ - UINT ret = 0; - SEC_OBJ *obj; - // Validate arguments - if (sec == NULL || name == NULL || data == NULL) - { - return 0; - } - if (sec->SessionCreated == false) - { - sec->Error = SEC_ERROR_NO_SESSION; - return 0; - } - - // Read - obj = FindSecObject(sec, name, SEC_DATA); - if (obj == NULL) - { - // Not found - return 0; - } - - // Read - ret = ReadSecDataFromObject(sec, obj, data, size); - - FreeSecObject(obj); - - return ret; -} - -// Clear the cache -void EraseEnumSecObjectCache(SECURE *sec) -{ - // Validate arguments - if (sec == NULL || sec->EnumCache == NULL) - { - return; - } - - FreeEnumSecObject(sec->EnumCache); - sec->EnumCache = NULL; -} - -// Check for the existence of a secure object -bool CheckSecObject(SECURE *sec, char *name, UINT type) -{ - SEC_OBJ *obj; - // Validate arguments - if (sec == NULL) - { - return false; - } - if (name == NULL) - { - sec->Error = SEC_ERROR_BAD_PARAMETER; - return false; - } - if (sec->SessionCreated == false) - { - sec->Error = SEC_ERROR_NO_SESSION; - return 0; - } - - obj = FindSecObject(sec, name, type); - - if (obj == NULL) - { - return false; - } - else - { - FreeSecObject(obj); - return true; - } -} - -// Cloning a secure object structure -SEC_OBJ *CloneSecObject(SEC_OBJ *obj) -{ - SEC_OBJ *ret; - // Validate arguments - if (obj == NULL) - { - return NULL; - } - - ret = ZeroMalloc(sizeof(SEC_OBJ)); - ret->Name = CopyStr(obj->Name); - ret->Object = obj->Object; - ret->Private = obj->Private; - ret->Type = obj->Type; - - return ret; -} - -// Search a secure object by the name -SEC_OBJ *FindSecObject(SECURE *sec, char *name, UINT type) -{ - LIST *o; - UINT i; - SEC_OBJ *ret = NULL; - // Validate arguments - if (sec == NULL) - { - return NULL; - } - if (name == NULL) - { - sec->Error = SEC_ERROR_BAD_PARAMETER; - return NULL; - } - if (sec->SessionCreated == false) - { - sec->Error = SEC_ERROR_NO_SESSION; - return 0; - } - - // Enumeration - o = EnumSecObject(sec); - if (o == NULL) - { - return NULL; - } - for (i = 0;i < LIST_NUM(o);i++) - { - SEC_OBJ *obj = LIST_DATA(o, i); - - if (obj->Type == type || type == INFINITE) - { - if (StrCmpi(obj->Name, name) == 0) - { - ret = CloneSecObject(obj); - break; - } - } - } - FreeEnumSecObject(o); - - if (ret == NULL) - { - sec->Error = SEC_ERROR_OBJ_NOT_FOUND; - } - - return ret; -} - -// Reading a secure object -int ReadSecDataFromObject(SECURE *sec, SEC_OBJ *obj, void *data, UINT size) -{ - UCHAR buf[MAX_SEC_DATA_SIZE]; - UINT i; - CK_ATTRIBUTE get[] = - { - {CKA_VALUE, buf, sizeof(buf)}, - }; - // Validate arguments - if (sec == NULL) - { - return 0; - } - if (obj == NULL || data == NULL || size == 0) - { - sec->Error = SEC_ERROR_BAD_PARAMETER; - return 0; - } - if (obj->Type != SEC_DATA) - { - sec->Error = SEC_ERROR_BAD_PARAMETER; - return false; - } - if (sec->SessionCreated == false) - { - sec->Error = SEC_ERROR_NO_SESSION; - return 0; - } - if (sec->LoginFlag == false && obj->Private) - { - sec->Error = SEC_ERROR_NOT_LOGIN; - return 0; - } - - // Acquisition - if (sec->Api->C_GetAttributeValue( - sec->SessionId, obj->Object, get, sizeof(get) / sizeof(get[0])) != CKR_OK) - { - sec->Error = SEC_ERROR_HARDWARE_ERROR; - return 0; - } - - // Return the result - i = get[0].ulValueLen; - if (i > MAX_SEC_DATA_SIZE || i > size) - { - // Data is too large - sec->Error = SEC_ERROR_DATA_TOO_BIG; - return 0; - } - - // Memory copy - Copy(data, buf, i); - - return i; -} - -// Release of enumeration results of the secure object -void FreeEnumSecObject(LIST *o) -{ - UINT i; - // Validate arguments - if (o == NULL) - { - return; - } - - for (i = 0;i < LIST_NUM(o);i++) - { - SEC_OBJ *obj = LIST_DATA(o, i); - - FreeSecObject(obj); - } - - ReleaseList(o); -} - -// Release the secure object -void FreeSecObject(SEC_OBJ *obj) -{ - // Validate arguments - if (obj == NULL) - { - return; - } - - Free(obj->Name); - Free(obj); -} - -// Clone the secure object enumeration results -LIST *CloneEnumSecObject(LIST *o) -{ - LIST *ret; - UINT i; - // Validate arguments - if (o == NULL) - { - return NULL; - } - - ret = NewListFast(NULL); - for (i = 0;i < LIST_NUM(o);i++) - { - SEC_OBJ *obj = LIST_DATA(o, i); - - Add(ret, CloneSecObject(obj)); - } - - return ret; -} - -// Enumeration of the secure objects -LIST *EnumSecObject(SECURE *sec) -{ - CK_BBOOL b_true = true, b_false = false; - UINT objects[MAX_OBJ]; - UINT i; - UINT ret; - LIST *o; - CK_ATTRIBUTE dummy[1]; - CK_ATTRIBUTE a[] = - { - {CKA_TOKEN, &b_true, sizeof(b_true)}, - }; - UINT num_objects = MAX_OBJ; - // Validate arguments - if (sec == NULL) - { - return NULL; - } - if (sec->SessionCreated == false) - { - sec->Error = SEC_ERROR_NO_SESSION; - return NULL; - } - - Zero(dummy, sizeof(dummy)); - - // If there is a cache, return it - if (sec->EnumCache != NULL) - { - return CloneEnumSecObject(sec->EnumCache); - } - - // Enumerate -// if (sec->Dev->Id != 2 && sec->Dev->Id != 14) -// { - // Normal tokens - ret = sec->Api->C_FindObjectsInit(sec->SessionId, a, sizeof(a) / sizeof(a[0])); -// } -// else -// { - // ePass and SafeSign -// ret = sec->Api->C_FindObjectsInit(sec->SessionId, dummy, 0); -// } - - if (ret != CKR_OK) - { - sec->Error = SEC_ERROR_HARDWARE_ERROR; - return NULL; - } - if (sec->Api->C_FindObjects(sec->SessionId, objects, sizeof(objects) / sizeof(objects[0]), &num_objects) != CKR_OK) - { - sec->Api->C_FindObjectsFinal(sec->SessionId); - sec->Error = SEC_ERROR_HARDWARE_ERROR; - return NULL; - } - sec->Api->C_FindObjectsFinal(sec->SessionId); - - o = NewListFast(NULL); - - for (i = 0;i < num_objects;i++) - { - char label[MAX_SIZE]; - UINT obj_class = 0; - bool priv = false; - CK_ATTRIBUTE get[] = - { - {CKA_LABEL, label, sizeof(label) - 1}, - {CKA_CLASS, &obj_class, sizeof(obj_class)}, - {CKA_PRIVATE, &priv, sizeof(priv)}, - }; - - Zero(label, sizeof(label)); - - if (sec->Api->C_GetAttributeValue(sec->SessionId, objects[i], - get, sizeof(get) / sizeof(get[0])) == CKR_OK) - { - UINT type = INFINITE; - - switch (obj_class) - { - case CKO_DATA: - // Data - type = SEC_DATA; - break; - - case CKO_CERTIFICATE: - // Certificate - type = SEC_X; - break; - - case CKO_PUBLIC_KEY: - // Public key - type = SEC_P; - break; - - case CKO_PRIVATE_KEY: - // Secret key - type = SEC_K; - break; - } - - if (type != INFINITE) - { - SEC_OBJ *obj = ZeroMalloc(sizeof(SEC_OBJ)); - - obj->Type = type; - obj->Object = objects[i]; - obj->Private = (priv == false) ? false : true; - EnSafeStr(label, '?'); - TruncateCharFromStr(label, '?'); - obj->Name = CopyStr(label); - - Add(o, obj); - } - } - } - - // Creating a cache - sec->EnumCache = CloneEnumSecObject(o); - - return o; -} - -// Write the data -bool WriteSecData(SECURE *sec, bool private_obj, char *name, void *data, UINT size) -{ - UINT object_class = CKO_DATA; - CK_BBOOL b_true = true, b_false = false, b_private_obj = private_obj; - UINT object; - CK_ATTRIBUTE a[] = - { - {CKA_TOKEN, &b_true, sizeof(b_true)}, - {CKA_CLASS, &object_class, sizeof(object_class)}, - {CKA_PRIVATE, &b_private_obj, sizeof(b_private_obj)}, - {CKA_LABEL, name, StrLen(name)}, - {CKA_VALUE, data, size}, - }; - // Validate arguments - if (sec == NULL) - { - return false; - } - if (sec->SessionCreated == false) - { - sec->Error = SEC_ERROR_NO_SESSION; - return false; - } - if (private_obj && sec->LoginFlag == false) - { - sec->Error = SEC_ERROR_NOT_LOGIN; - return false; - } - if (name == NULL || data == NULL || size == 0) - { - sec->Error = SEC_ERROR_BAD_PARAMETER; - return false; - } - if (size > MAX_SEC_DATA_SIZE) - { - sec->Error = SEC_ERROR_DATA_TOO_BIG; - return false; - } - - // Delete any objects with the same name - if (CheckSecObject(sec, name, SEC_DATA)) - { - DeleteSecData(sec, name); - } - - // Object creation - if (sec->Api->C_CreateObject(sec->SessionId, a, sizeof(a) / sizeof(a[0]), &object) != CKR_OK) - { - sec->Error = SEC_ERROR_HARDWARE_ERROR; - return false; - } - - // Clear the cache - EraseEnumSecObjectCache(sec); - - return true; -} - -// Display the token information -void PrintSecInfo(SECURE *sec) -{ - SEC_INFO *s; - // Validate arguments - if (sec == NULL) - { - return; - } - - s = sec->Info; - if (s == NULL) - { - Print("No Token Info.\n"); - return; - } - - Print( - " Label: %S\n" - " ManufacturerId: %S\n" - " Model: %S\n" - " SerialNumber: %S\n" - " MaxSession: %u\n" - " MaxRWSession: %u\n" - " MinPinLen: %u\n" - " MaxPinLen: %u\n" - " TotalPublicMemory: %u\n" - " FreePublicMemory: %u\n" - " TotalPrivateMemory: %u\n" - " FreePrivateMemory: %u\n" - " HardwareVersion: %s\n" - " FirmwareVersion: %s\n", - s->Label, s->ManufacturerId, s->Model, s->SerialNumber, - s->MaxSession, s->MaxRWSession, s->MinPinLen, s->MaxPinLen, - s->TotalPublicMemory, s->FreePublicMemory, s->TotalPrivateMemory, - s->FreePrivateMemory, s->HardwareVersion, s->FirmwareVersion - ); -} - -// Get the token information -void GetSecInfo(SECURE *sec) -{ - CK_TOKEN_INFO token_info; - // Validate arguments - if (sec == NULL) - { - return; - } - if (sec->Info != NULL) - { - return; - } - - // Acquisition - Zero(&token_info, sizeof(token_info)); - if (sec->Api->C_GetTokenInfo(sec->SlotIdList[sec->SessionSlotNumber], &token_info) != CKR_OK) - { - // Failure - return; - } - - sec->Info = TokenInfoToSecInfo(&token_info); -} - -// Release the token information -void FreeSecInfo(SECURE *sec) -{ - // Validate arguments - if (sec == NULL) - { - return; - } - if (sec->Info == NULL) - { - return; - } - - FreeSecInfoMemory(sec->Info); - sec->Info = NULL; -} - -// Convert the token information to the SEC_INFO -SEC_INFO *TokenInfoToSecInfo(void *p_t) -{ - SEC_INFO *s; - char buf[MAX_SIZE]; - CK_TOKEN_INFO *t = (CK_TOKEN_INFO *)p_t; - // Validate arguments - if (t == NULL) - { - return NULL; - } - - s = ZeroMalloc(sizeof(SEC_INFO)); - - // Label - Zero(buf, sizeof(buf)); - Copy(buf, t->label, sizeof(t->label)); - s->Label = ZeroMalloc(CalcUtf8ToUni(buf, 0)); - Utf8ToUni(s->Label, 0, buf, 0); - - // ManufacturerId - Zero(buf, sizeof(buf)); - Copy(buf, t->manufacturerID, sizeof(t->manufacturerID)); - s->ManufacturerId = ZeroMalloc(CalcUtf8ToUni(buf, 0)); - Utf8ToUni(s->ManufacturerId, 0, buf, 0); - - // Model - Zero(buf, sizeof(buf)); - Copy(buf, t->model, sizeof(t->model)); - s->Model = ZeroMalloc(CalcUtf8ToUni(buf, 0)); - Utf8ToUni(s->Model, 0, buf, 0); - - // SerialNumber - Zero(buf, sizeof(buf)); - Copy(buf, t->serialNumber, sizeof(t->serialNumber)); - s->SerialNumber = ZeroMalloc(CalcUtf8ToUni(buf, 0)); - Utf8ToUni(s->SerialNumber, 0, buf, 0); - - // Numeric value - s->MaxSession = t->ulMaxSessionCount; - s->MaxRWSession = t->ulMaxRwSessionCount; - s->MinPinLen = t->ulMinPinLen; - s->MaxPinLen = t->ulMaxPinLen; - s->TotalPublicMemory = t->ulTotalPublicMemory; - s->FreePublicMemory = t->ulFreePublicMemory; - s->TotalPrivateMemory = t->ulTotalPrivateMemory; - s->FreePrivateMemory = t->ulFreePrivateMemory; - - // Hardware version - Format(buf, sizeof(buf), "%u.%02u", t->hardwareVersion.major, t->hardwareVersion.minor); - s->HardwareVersion = CopyStr(buf); - - // Firmware version - Format(buf, sizeof(buf), "%u.%02u", t->firmwareVersion.major, t->firmwareVersion.minor); - s->FirmwareVersion = CopyStr(buf); - - return s; -} - -// Release the memory of the SEC_INFO -void FreeSecInfoMemory(SEC_INFO *s) -{ - // Validate arguments - if (s == NULL) - { - return; - } - - Free(s->Label); - Free(s->ManufacturerId); - Free(s->Model); - Free(s->SerialNumber); - Free(s->HardwareVersion); - Free(s->FirmwareVersion); - Free(s); -} - -// Log-out -void LogoutSec(SECURE *sec) -{ - // Validate arguments - if (sec == NULL) - { - return; - } - if (sec->LoginFlag == false) - { - return; - } - - // Log-out - sec->Api->C_Logout(sec->SessionId); - - // Clear Cache - EraseEnumSecObjectCache(sec); - - sec->LoginFlag = false; -} - -// Log-in -bool LoginSec(SECURE *sec, char *pin) -{ - // Validate arguments - if (sec == NULL) - { - return false; - } - if (sec->SessionCreated == false) - { - sec->Error = SEC_ERROR_NO_SESSION; - return false; - - } - if (sec->LoginFlag) - { - sec->Error = SEC_ERROR_ALREADY_LOGIN; - return false; - } - if (pin == NULL) - { - sec->Error = SEC_ERROR_NO_PIN_STR; - return false; - } - - // Log-in - if (sec->Api->C_Login(sec->SessionId, CKU_USER, pin, StrLen(pin)) != CKR_OK) - { - // Login failure - sec->Error = SEC_ERROR_BAD_PIN_CODE; - return false; - } - - // Clear the cache - EraseEnumSecObjectCache(sec); - - sec->LoginFlag = true; - - return true; -} - -// Close the session -void CloseSecSession(SECURE *sec) -{ - // Validate arguments - if (sec == NULL) - { - return; - } - if (sec->SessionCreated == false) - { - return; - } - - // Close the session - sec->Api->C_CloseSession(sec->SessionId); - - sec->SessionCreated = false; - sec->SessionId = 0; - sec->SessionSlotNumber = 0; - - FreeSecInfo(sec); - - // Clear the cache - EraseEnumSecObjectCache(sec); -} - -// Open the session -bool OpenSecSession(SECURE *sec, UINT slot_number) -{ - UINT err = 0; - UINT session; - // Validate arguments - if (sec == NULL) - { - return false; - } - if (sec->SessionCreated) - { - // Already been created - sec->Error = SEC_ERROR_SESSION_EXISTS; - return false; - } - if (slot_number >= sec->NumSlot) - { - // Slot number is invalid - sec->Error = SEC_ERROR_INVALID_SLOT_NUMBER; - return false; - } - - // Create a session - if ((err = sec->Api->C_OpenSession(sec->SlotIdList[slot_number], - CKF_RW_SESSION | CKF_SERIAL_SESSION, NULL, NULL, &session)) != CKR_OK) - { - // Failed to initialize session in read / write mode - // Read-only mode? - if ((err = sec->Api->C_OpenSession(sec->SlotIdList[slot_number], - CKF_SERIAL_SESSION, NULL, NULL, &session)) != CKR_OK) - { - // Failure to create - sec->Error = SEC_ERROR_OPEN_SESSION; - return false; - } - else - { - sec->IsReadOnly = true; - } - } - - sec->SessionCreated = true; - sec->SessionId = session; - sec->SessionSlotNumber = slot_number; - - // Get the token information - GetSecInfo(sec); - - return true; -} - -// Close the secure device -void CloseSec(SECURE *sec) -{ - // Validate arguments - if (sec == NULL) - { - return; - } - - // Log out - LogoutSec(sec); - - // Close the session - CloseSecSession(sec); - - // Release the token information - FreeSecInfo(sec); - - // Release of the slot list memory - if (sec->SlotIdList != NULL) - { - Free(sec->SlotIdList); - sec->SlotIdList = NULL; - } - - // Unload the module - FreeSecModule(sec); - - // Memory release - DeleteLock(sec->lock); - Free(sec); -} - -// Open a secure device -SECURE *OpenSec(UINT id) -{ - SECURE_DEVICE *dev = GetSecureDevice(id); - SECURE *sec; - UINT err; - - if (dev == NULL) - { - return NULL; - } - - sec = ZeroMalloc(sizeof(SECURE)); - - sec->lock = NewLock(); - sec->Error = SEC_ERROR_NOERROR; - sec->Dev = dev; - - // Get whether it's a ePass or not - if (SearchStrEx(dev->DeviceName, "epass", 0, false) != INFINITE) - { - sec->IsEPass1000 = true; - } - - // Load the module - if (LoadSecModule(sec) == false) - { - CloseSec(sec); - return NULL; - } - - // Get the slot list - sec->NumSlot = 0; - if ((err = sec->Api->C_GetSlotList(true, NULL, &sec->NumSlot)) != CKR_OK || sec->NumSlot == 0) - { - // Failure - FreeSecModule(sec); - CloseSec(sec); - return NULL; - } - - sec->SlotIdList = (UINT *)ZeroMalloc(sizeof(UINT) * sec->NumSlot); - - if (sec->Api->C_GetSlotList(TRUE, sec->SlotIdList, &sec->NumSlot) != CKR_OK) - { - // Failure - Free(sec->SlotIdList); - sec->SlotIdList = NULL; - FreeSecModule(sec); - CloseSec(sec); - return NULL; - } - - return sec; -} - -// Load the module of the secure device -bool LoadSecModule(SECURE *sec) -{ - bool ret = false; - // Validate arguments - if (sec == NULL) - { - return false; - } - -#ifdef OS_WIN32 - ret = Win32LoadSecModule(sec); -#endif // OS_WIN32 - - // Initialization - if (sec->Api->C_Initialize(NULL) != CKR_OK) - { - // Initialization Failed - FreeSecModule(sec); - return false; - } - - sec->Initialized = true; - - return ret; -} - -// Unload the module of the secure device -void FreeSecModule(SECURE *sec) -{ - // Validate arguments - if (sec == NULL) - { - return; - } - - if (sec->Initialized) - { - // Release because it is initialized - sec->Api->C_Finalize(NULL); - sec->Initialized = false; - } - -#ifdef OS_WIN32 - Win32FreeSecModule(sec); -#endif // OS_WIN32 - -} - - -// Get a secure device -SECURE_DEVICE *GetSecureDevice(UINT id) -{ - UINT i; - - if (id == 0) - { - return NULL; - } - - for (i = 0;i < LIST_NUM(SecureDeviceList);i++) - { - SECURE_DEVICE *dev = LIST_DATA(SecureDeviceList, i); - - if (dev->Id == id) - { - return dev; - } - } - - return NULL; -} - -// Confirm the ID of the secure device -bool CheckSecureDeviceId(UINT id) -{ - UINT i; - - for (i = 0;i < LIST_NUM(SecureDeviceList);i++) - { - SECURE_DEVICE *dev = LIST_DATA(SecureDeviceList, i); - - if (dev->Id == id) - { - return true; - } - } - - return false; -} - -// Get a list of supported devices -LIST *GetSecureDeviceList() -{ - return GetSupportedDeviceList(); -} - -// Get a list of supported devices -LIST *GetSupportedDeviceList() -{ - // Increase the reference count - AddRef(SecureDeviceList->ref); - - return SecureDeviceList; -} - -// Examine whether the specified device is installed and available -bool IsDeviceSupported(SECURE_DEVICE *dev) -{ - bool b = false; -#ifdef OS_WIN32 - b = Win32IsDeviceSupported(dev); -#endif // OS_WIN32 - return b; -} - -// Initialization of the secure device list -void InitSecureDeviceList() -{ - UINT i, num_supported_list; - SecureDeviceList = NewList(NULL); - - num_supported_list = sizeof(SupportedList) / sizeof(SECURE_DEVICE); - for (i = 0; i < num_supported_list;i++) - { - SECURE_DEVICE *dev = &SupportedList[i]; - - // Support Checking - if (IsDeviceSupported(dev)) - { - // Add the device to the list because it is supported - Add(SecureDeviceList, dev); - } - } -} - -// Test main procedure -void TestSecMain(SECURE *sec) -{ - char *test_str = CEDAR_PRODUCT_STR " VPN"; - K *public_key, *private_key; - // Validate arguments - if (sec == NULL) - { - return; - } - - Print("test_str: \"%s\"\n", test_str); - - Print("Writing Data...\n"); - if (WriteSecData(sec, true, "test_str", test_str, StrLen(test_str)) == false) - { - Print("WriteSecData() Failed.\n"); - } - else - { - char data[MAX_SIZE]; - Zero(data, sizeof(data)); - Print("Reading Data...\n"); - if (ReadSecData(sec, "test_str", data, sizeof(data)) == false) - { - Print("ReadSecData() Failed.\n"); - } - else - { - Print("test_str: \"%s\"\n", data); - } - Print("Deleting Data...\n"); - DeleteSecData(sec, "test_str"); - } - - Print("Generating Key...\n"); - if (RsaGen(&private_key, &public_key, 2048) == false) - { - Print("RsaGen() Failed.\n"); - } - else - { - X *cert; - NAME *name; - X_SERIAL *serial; - UINT num = 0x11220000; - - Print("Creating Cert...\n"); - serial = NewXSerial(&num, sizeof(UINT)); - name = NewName(L"Test", L"Test", L"Test", L"JP", L"Test", L"Test"); - cert = NewRootX(public_key, private_key, name, 365, NULL); - FreeXSerial(serial); - if (cert == NULL) - { - Print("NewRootX() Failed.\n"); - } - else - { - Print("Writing Cert...\n"); - DeleteSecData(sec, "test_cer"); - if (WriteSecCert(sec, true, "test_cer", cert) == false) - { - Print("WriteSecCert() Failed.\n"); - } - else - { - X *x; - Print("Reading Cert...\n"); - x = ReadSecCert(sec, "test_cer"); - if (x == NULL) - { - Print("ReadSecCert() Failed.\n"); - } - else - { - Print("Checking two Certs... "); - if (CompareX(x, cert) == false) - { - Print("[FAILED]\n"); - } - else - { - Print("Ok.\n"); - } - FreeX(x); - } - if (cert != NULL) - { - X *x; - XToFile(cert, "cert_tmp.cer", true); - x = FileToX("cert_tmp.cer"); - if (CompareX(x, cert) == false) - { - Print("[FAILED]\n"); - } - else - { - Print("Ok.\n"); - Print("Writing Private Key...\n"); - DeleteSecKey(sec, "test_key"); - if (WriteSecKey(sec, false, "test_key", private_key) == false) - { - Print("WriteSecKey() Failed.\n"); - } - else - { - UCHAR sign_cpu[512]; - UCHAR sign_sec[512]; - K *pub = GetKFromX(cert); - UINT keybytes = (cert->bits)/8; - Print("Ok.\n"); - Print("Signing Data by CPU...\n"); - if (RsaSign(sign_cpu, test_str, StrLen(test_str), private_key) == false) - { - Print("RsaSign() Failed.\n"); - } - else - { - Print("Ok.\n"); - Print("sign_cpu: "); - PrintBin(sign_cpu, keybytes); - Print("Signing Data by %s..\n", sec->Dev->DeviceName); - if (SignSec(sec, "test_key", sign_sec, test_str, StrLen(test_str)) == false) - { - Print("SignSec() Failed.\n"); - } - else - { - Print("Ok.\n"); - Print("sign_sec: "); - PrintBin(sign_sec, keybytes); - Print("Compare..."); - if (Cmp(sign_sec, sign_cpu, keybytes) == 0) - { - Print("Ok.\n"); - Print("Verify..."); - if (RsaVerifyEx(test_str, StrLen(test_str), - sign_sec, pub, cert->bits) == false) - { - Print("[FAILED]\n"); - } - else - { - Print("Ok.\n"); - } - } - else - { - Print("[DIFFERENT]\n"); - } - } - } - Print("Deleting test_key...\n"); -// DeleteSecKey(sec, "test_key"); - FreeK(pub); - } - } - FreeX(x); - } - } - Print("Deleting Cert..\n"); -// DeleteSecCert(sec, "test_cer"); - FreeX(cert); - } - FreeName(name); - FreeK(private_key); - FreeK(public_key); - } -} - -// Test the security device -void TestSec() -{ - UINT i; - LIST *secure_device_list; - Print("Secure Device Test Program\n" - "Copyright (c) SoftEther Corporation. All Rights Reserved.\n\n"); - - // Get the secure device list - secure_device_list = GetSecureDeviceList(); - if (secure_device_list != NULL) - { - UINT use_device_id; - char tmp[MAX_SIZE]; - Print("--- Secure Device List ---\n"); - for (i = 0;i < LIST_NUM(secure_device_list);i++) - { - SECURE_DEVICE *dev = LIST_DATA(secure_device_list, i); - Print("%2u - %s\n", dev->Id, dev->DeviceName); - } - Print("\n"); - Print("Device ID >"); - GetLine(tmp, sizeof(tmp)); - use_device_id = ToInt(tmp); - if (use_device_id == 0) - { - Print("Canceled.\n"); - } - else - { - SECURE *sec = OpenSec(use_device_id); - Print("Opening Device...\n"); - if (sec == NULL) - { - Print("OpenSec() Failed.\n"); - } - else - { - Print("Opening Session...\n"); - if (OpenSecSession(sec, 0) == false) - { - Print("OpenSecSession() Failed.\n"); - } - else - { - while (true) - { - char pin[MAX_SIZE]; - Print("PIN Code >"); - GetLine(pin, sizeof(pin)); - Trim(pin); - if (StrLen(pin) == 0) - { - Print("Canceled.\n"); - break; - } - else - { - Print("Login...\n"); - if (LoginSec(sec, pin)) - { - TestSecMain(sec); - Print("Logout...\n"); - LogoutSec(sec); - break; - } - else - { - Print("Login Failed. Please Try Again.\n"); - } - } - } - Print("Closing Session...\n"); - CloseSecSession(sec); - } - Print("Closing Device...\n"); - CloseSec(sec); - } - } - ReleaseList(secure_device_list); - } - else - { - Print("GetSecureDeviceList() Error.\n"); - } -} - -// Release of the secure device list -void FreeSecureDeviceList() -{ - ReleaseList(SecureDeviceList); -} - -// Initialization of the security token module -void InitSecure() -{ - // Initialization of the secure device list - InitSecureDeviceList(); -} - -// Release of the security token module -void FreeSecure() -{ - // Release of the secure device list - FreeSecureDeviceList(); -} - - +// SoftEther VPN Source Code - Developer Edition Master Branch +// Mayaqua Kernel + + +// Secure.c +// Security token management module + +#include + +#define SECURE_C +#define ENCRYPT_C + +#ifdef WIN32 +#include +#endif // WIN32 + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + + +#define MAX_OBJ 1024 // Maximum number of objects in the hardware (assumed) + +#define A_SIZE(a, i) (a[(i)].ulValueLen) +#define A_SET(a, i, value, size) (a[i].pValue = value;a[i].ulValueLen = size;) + +#ifdef OS_WIN32 +// Code for Win32 + +// DLL reading for Win32 +HINSTANCE Win32SecureLoadLibraryEx(char *dllname, DWORD flags) +{ + char tmp1[MAX_PATH]; + char tmp2[MAX_PATH]; + char tmp3[MAX_PATH]; + HINSTANCE h; + // Validate arguments + if (dllname == NULL) + { + return NULL; + } + + Format(tmp1, sizeof(tmp1), "%s\\%s", MsGetSystem32Dir(), dllname); + Format(tmp2, sizeof(tmp2), "%s\\JPKI\\%s", MsGetProgramFilesDir(), dllname); + Format(tmp3, sizeof(tmp3), "%s\\LGWAN\\%s", MsGetProgramFilesDir(), dllname); + + h = LoadLibraryEx(dllname, NULL, flags); + if (h != NULL) + { + return h; + } + + h = LoadLibraryEx(tmp1, NULL, flags); + if (h != NULL) + { + return h; + } + + h = LoadLibraryEx(tmp2, NULL, flags); + if (h != NULL) + { + return h; + } + + h = LoadLibraryEx(tmp3, NULL, flags); + if (h != NULL) + { + return h; + } + + return NULL; +} + +// Examine whether the specified device is installed +bool Win32IsDeviceSupported(SECURE_DEVICE *dev) +{ + HINSTANCE hInst; + // Validate arguments + if (dev == NULL) + { + return false; + } + + // Check whether the DLL is readable + hInst = Win32SecureLoadLibraryEx(dev->ModuleName, DONT_RESOLVE_DLL_REFERENCES); + if (hInst == NULL) + { + return false; + } + + FreeLibrary(hInst); + + return true; +} + +// Load the device module +bool Win32LoadSecModule(SECURE *sec) +{ + SEC_DATA_WIN32 *w; + HINSTANCE hInst; + CK_FUNCTION_LIST_PTR api = NULL; + CK_RV (*get_function_list)(CK_FUNCTION_LIST_PTR_PTR); + // Validate arguments + if (sec == NULL) + { + return false; + } + + if (sec->Dev->Id == 9) + { + char username[MAX_SIZE]; + DWORD size; + // Because the device driver of Juki-Net needs the contents + // of the Software\JPKI registry key on HKLU of SYSTEM, + // if there is no key, copy the key from the value of other user +// if (MsRegIsValue(REG_CURRENT_USER, "Software\\JPKI", "Name") == false || +// MsRegIsValue(REG_CURRENT_USER, "Software\\JPKI", "RWType") == false) + size = sizeof(username); + GetUserName(username, &size); + if (StrCmpi(username, "System") == 0) + { + TOKEN_LIST *t = MsRegEnumKey(REG_USERS, NULL); + + if (t != NULL) + { + UINT i; + + for (i = 0;i < t->NumTokens;i++) + { + char tmp[MAX_PATH]; + + if (StrCmpi(t->Token[i], ".DEFAULT") != 0 && StrCmpi(t->Token[i], "S-1-5-18") != 0) + { + Format(tmp, sizeof(tmp), "%s\\Software\\JPKI", t->Token[i]); + + if (MsRegIsValue(REG_USERS, tmp, "Name") && MsRegIsValue(REG_USERS, tmp, "RWType")) + { + char *name = MsRegReadStr(REG_USERS, tmp, "Name"); + char *port = MsRegReadStr(REG_USERS, tmp, "Port"); + UINT type = MsRegReadInt(REG_USERS, tmp, "RWType"); + + MsRegWriteStr(REG_CURRENT_USER, "Software\\JPKI", "Name", name); + MsRegWriteStr(REG_CURRENT_USER, "Software\\JPKI", "Port", port); + MsRegWriteInt(REG_CURRENT_USER, "Software\\JPKI", "RWType", type); + + Free(name); + Free(port); + break; + } + } + } + + FreeToken(t); + } + } + } + + // Load the Library + hInst = Win32SecureLoadLibraryEx(sec->Dev->ModuleName, 0); + if (hInst == NULL) + { + // Failure + return false; + } + + // Get the API + get_function_list = (CK_RV (*)(CK_FUNCTION_LIST_PTR_PTR)) + GetProcAddress(hInst, "C_GetFunctionList"); + + if (get_function_list == NULL) + { + // Failure + FreeLibrary(hInst); + return false; + } + + get_function_list(&api); + if (api == NULL) + { + // Failure + FreeLibrary(hInst); + return false; + } + + sec->Data = ZeroMalloc(sizeof(SEC_DATA_WIN32)); + w = sec->Data; + + w->hInst = hInst; + sec->Api = api; + + return true; +} + +// Unload the device module +void Win32FreeSecModule(SECURE *sec) +{ + // Validate arguments + if (sec == NULL) + { + return; + } + if (sec->Data == NULL) + { + return; + } + + // Unload + FreeLibrary(sec->Data->hInst); + Free(sec->Data); + + sec->Data = NULL; +} + +#endif // OS_WIN32 + + +// Whether the specified device is a JPKI +bool IsJPKI(bool id) +{ + if (id == 9 || id == 13) + { + return true; + } + + return false; +} + +// Sign with the private key which is specified by the name in the secure device +bool SignSec(SECURE *sec, char *name, void *dst, void *src, UINT size) +{ + SEC_OBJ *obj; + UINT ret; + // Validate arguments + if (sec == NULL) + { + return false; + } + if (name == NULL || dst == NULL || src == NULL) + { + sec->Error = SEC_ERROR_BAD_PARAMETER; + return false; + } + + obj = FindSecObject(sec, name, SEC_K); + if (obj == NULL) + { + return false; + } + + ret = SignSecByObject(sec, obj, dst, src, size); + + FreeSecObject(obj); + + return ret; +} + +// Sign with the private key of the secure device +bool SignSecByObject(SECURE *sec, SEC_OBJ *obj, void *dst, void *src, UINT size) +{ + CK_MECHANISM mechanism = {CKM_RSA_PKCS, NULL, 0}; + UINT ret; + UCHAR hash[SIGN_HASH_SIZE]; + // Validate arguments + if (sec == NULL) + { + return false; + } + if (obj == NULL || dst == NULL || src == NULL) + { + sec->Error = SEC_ERROR_BAD_PARAMETER; + return false; + } + if (sec->SessionCreated == false) + { + sec->Error = SEC_ERROR_NO_SESSION; + return false; + } + if (sec->LoginFlag == false && obj->Private) + { + sec->Error = SEC_ERROR_NOT_LOGIN; + return false; + } + if (obj->Type != SEC_K) + { + sec->Error = SEC_ERROR_BAD_PARAMETER; + return false; + } + + // Hash + HashForSign(hash, sizeof(hash), src, size); + + // Signature initialization + ret = sec->Api->C_SignInit(sec->SessionId, &mechanism, obj->Object); + if (ret != CKR_OK) + { + // Failure + sec->Error = SEC_ERROR_HARDWARE_ERROR; + Debug("C_SignInit Error: 0x%x\n", ret); + return false; + } + + // Perform Signing + size = 128; + // First try with 1024 bit + ret = sec->Api->C_Sign(sec->SessionId, hash, sizeof(hash), dst, &size); + if (ret != CKR_OK && 128 < size && size <= 4096/8) + { + // Retry with expanded bits + ret = sec->Api->C_Sign(sec->SessionId, hash, sizeof(hash), dst, &size); + } + if (ret != CKR_OK || size == 0 || size > 4096/8) + { + // Failure + sec->Error = SEC_ERROR_HARDWARE_ERROR; + Debug("C_Sign Error: 0x%x size:%d\n", ret, size); + return false; + } + + return true; +} + +// Changing the PIN code +bool ChangePin(SECURE *sec, char *old_pin, char *new_pin) +{ + // Validate arguments + if (sec == NULL || old_pin == NULL || new_pin == NULL) + { + return false; + } + if (sec->SessionCreated == false) + { + sec->Error = SEC_ERROR_NO_SESSION; + return false; + } + if (sec->LoginFlag == false) + { + sec->Error = SEC_ERROR_NOT_LOGIN; + return false; + } + if (sec->IsReadOnly) + { + sec->Error = SEC_ERROR_OPEN_SESSION; + return false; + } + + // Change then PIN + if (sec->Api->C_SetPIN(sec->SessionId, old_pin, StrLen(old_pin), + new_pin, StrLen(new_pin)) != CKR_OK) + { + return false; + } + + return true; +} + +// Write the private key object +bool WriteSecKey(SECURE *sec, bool private_obj, char *name, K *k) +{ + UINT key_type = CKK_RSA; + CK_BBOOL b_true = true, b_false = false, b_private_obj = private_obj; + UINT obj_class = CKO_PRIVATE_KEY; + UINT object; + UINT ret; + BUF *b; + RSA *rsa; + UCHAR modules[MAX_SIZE], pub[MAX_SIZE], pri[MAX_SIZE], prime1[MAX_SIZE], prime2[MAX_SIZE]; + UCHAR exp1[MAX_SIZE], exp2[MAX_SIZE], coeff[MAX_SIZE]; + const BIGNUM *n, *e, *d, *p, *q, *dmp1, *dmq1, *iqmp; + CK_ATTRIBUTE a[] = + { + {CKA_MODULUS, modules, 0}, // 0 + {CKA_PUBLIC_EXPONENT, pub, 0}, // 1 + {CKA_PRIVATE_EXPONENT, pri, 0}, // 2 + {CKA_PRIME_1, prime1, 0}, // 3 + {CKA_PRIME_2, prime2, 0}, // 4 + {CKA_EXPONENT_1, exp1, 0}, // 5 + {CKA_EXPONENT_2, exp2, 0}, // 6 + {CKA_COEFFICIENT, coeff, 0}, // 7 + + {CKA_CLASS, &obj_class, sizeof(obj_class)}, + {CKA_TOKEN, &b_true, sizeof(b_true)}, + {CKA_PRIVATE, &b_private_obj, sizeof(b_private_obj)}, + {CKA_LABEL, name, StrLen(name)}, + {CKA_KEY_TYPE, &key_type, sizeof(key_type)}, + {CKA_DERIVE, &b_false, sizeof(b_false)}, + {CKA_SUBJECT, name, StrLen(name)}, + {CKA_SENSITIVE, &b_true, sizeof(b_true)}, + {CKA_DECRYPT, &b_true, sizeof(b_true)}, + {CKA_SIGN, &b_true, sizeof(b_true)}, + {CKA_SIGN_RECOVER, &b_false, sizeof(b_false)}, + {CKA_EXTRACTABLE, &b_false, sizeof(b_false)}, + {CKA_MODIFIABLE, &b_false, sizeof(b_false)}, + }; + + // Validate arguments + if (sec == NULL) + { + return false; + } + if (name == NULL || k == NULL || k->private_key == false) + { + sec->Error = SEC_ERROR_BAD_PARAMETER; + return false; + } + if (sec->SessionCreated == false) + { + sec->Error = SEC_ERROR_NO_SESSION; + return false; + } + if (sec->LoginFlag == false && private_obj) + { + sec->Error = SEC_ERROR_NOT_LOGIN; + return false; + } + + // Numeric data generation + rsa = EVP_PKEY_get0_RSA(k->pkey); + if (rsa == NULL) + { + sec->Error = SEC_ERROR_BAD_PARAMETER; + return false; + } + +#if OPENSSL_VERSION_NUMBER >= 0x10100000L + RSA_get0_key(rsa, &n, &e, &d); + RSA_get0_factors(rsa, &p, &q); + RSA_get0_crt_params(rsa, &dmp1, &dmq1, &iqmp); +#else + n = rsa->n; + e = rsa->e; + d = rsa->d; + p = rsa->p; + q = rsa->q; + dmp1 = rsa->dmp1; + dmq1 = rsa->dmq1; + iqmp = rsa->iqmp; +#endif + + b = BigNumToBuf(n); + ReadBuf(b, modules, sizeof(modules)); + A_SIZE(a, 0) = b->Size; + FreeBuf(b); + + b = BigNumToBuf(e); + ReadBuf(b, pub, sizeof(pub)); + A_SIZE(a, 1) = b->Size; + FreeBuf(b); + + b = BigNumToBuf(d); + ReadBuf(b, pri, sizeof(pri)); + A_SIZE(a, 2) = b->Size; + FreeBuf(b); + + b = BigNumToBuf(p); + ReadBuf(b, prime1, sizeof(prime1)); + A_SIZE(a, 3) = b->Size; + FreeBuf(b); + + b = BigNumToBuf(q); + ReadBuf(b, prime2, sizeof(prime2)); + A_SIZE(a, 4) = b->Size; + FreeBuf(b); + + b = BigNumToBuf(dmp1); + ReadBuf(b, exp1, sizeof(exp1)); + A_SIZE(a, 5) = b->Size; + FreeBuf(b); + + b = BigNumToBuf(dmq1); + ReadBuf(b, exp2, sizeof(exp2)); + A_SIZE(a, 6) = b->Size; + FreeBuf(b); + + b = BigNumToBuf(iqmp); + ReadBuf(b, coeff, sizeof(coeff)); + A_SIZE(a, 7) = b->Size; + FreeBuf(b); + + // Delete the old key if it exists + if (CheckSecObject(sec, name, SEC_K)) + { + DeleteSecKey(sec, name); + } + + // Creating + if ((ret = sec->Api->C_CreateObject(sec->SessionId, a, sizeof(a) / sizeof(a[0]), &object)) != CKR_OK) + { + // Failure + sec->Error = SEC_ERROR_HARDWARE_ERROR; + Debug("ret: 0x%x\n", ret); + return false; + } + + // Clear Cache + EraseEnumSecObjectCache(sec); + + return true; +} + +// Read the certificate object by specifying the name +X *ReadSecCert(SECURE *sec, char *name) +{ + SEC_OBJ *obj; + X *x; + // Validate arguments + if (sec == NULL) + { + return false; + } + if (sec->SessionCreated == false) + { + sec->Error = SEC_ERROR_NO_SESSION; + return false; + } + + // Search + obj = FindSecObject(sec, name, SEC_X); + if (obj == NULL) + { + return false; + } + + // Acquisition + x = ReadSecCertFromObject(sec, obj); + + FreeSecObject(obj); + + return x; +} + +// Read the certificate object +X *ReadSecCertFromObject(SECURE *sec, SEC_OBJ *obj) +{ + UINT size; + X *x; + UCHAR value[4096]; + BUF *b; + CK_ATTRIBUTE get[] = + { + {CKA_VALUE, value, sizeof(value)}, + }; + // Validate arguments + if (sec == NULL) + { + return false; + } + if (sec->SessionCreated == false) + { + sec->Error = SEC_ERROR_NO_SESSION; + return false; + } + if (sec->LoginFlag == false && obj->Private) + { + sec->Error = SEC_ERROR_NOT_LOGIN; + return false; + } + if (obj->Type != SEC_X) + { + sec->Error = SEC_ERROR_BAD_PARAMETER; + return false; + } + + // Acquisition + if (sec->Api->C_GetAttributeValue( + sec->SessionId, obj->Object, get, sizeof(get) / sizeof(get[0])) != CKR_OK) + { + sec->Error = SEC_ERROR_HARDWARE_ERROR; + return 0; + } + + size = A_SIZE(get, 0); + + // Conversion + b = NewBuf(); + WriteBuf(b, value, size); + SeekBuf(b, 0, 0); + + x = BufToX(b, false); + if (x == NULL) + { + sec->Error = SEC_ERROR_INVALID_CERT; + } + + FreeBuf(b); + + return x; +} + +// Write the certificate object +bool WriteSecCert(SECURE *sec, bool private_obj, char *name, X *x) +{ + UINT obj_class = CKO_CERTIFICATE; + CK_BBOOL b_true = true, b_false = false, b_private_obj = private_obj; + UINT cert_type = CKC_X_509; + CK_DATE start_date, end_date; + UCHAR subject[MAX_SIZE]; + UCHAR issuer[MAX_SIZE]; + wchar_t w_subject[MAX_SIZE]; + wchar_t w_issuer[MAX_SIZE]; + UCHAR serial_number[MAX_SIZE]; + UCHAR value[4096]; + UINT ret; + BUF *b; + UINT object; + CK_ATTRIBUTE a[] = + { + {CKA_SUBJECT, subject, 0}, // 0 + {CKA_ISSUER, issuer, 0}, // 1 + {CKA_SERIAL_NUMBER, serial_number, 0}, // 2 + {CKA_VALUE, value, 0}, // 3 + {CKA_CLASS, &obj_class, sizeof(obj_class)}, + {CKA_TOKEN, &b_true, sizeof(b_true)}, + {CKA_PRIVATE, &b_private_obj, sizeof(b_private_obj)}, + {CKA_LABEL, name, StrLen(name)}, + {CKA_CERTIFICATE_TYPE, &cert_type, sizeof(cert_type)}, +#if 0 // Don't use these because some tokens fail + {CKA_START_DATE, &start_date, sizeof(start_date)}, + {CKA_END_DATE, &end_date, sizeof(end_date)}, +#endif + }; + // Validate arguments + if (sec == NULL) + { + return false; + } + if (name == NULL) + { + sec->Error = SEC_ERROR_BAD_PARAMETER; + return false; + } + if (sec->SessionCreated == false) + { + sec->Error = SEC_ERROR_NO_SESSION; + return false; + } + if (sec->LoginFlag == false && private_obj) + { + sec->Error = SEC_ERROR_NOT_LOGIN; + return false; + } + + // Copy the certificate to the buffer + b = XToBuf(x, false); + if (b == NULL) + { + sec->Error = SEC_ERROR_INVALID_CERT; + return false; + } + if (b->Size > sizeof(value)) + { + // Size is too large + FreeBuf(b); + sec->Error = SEC_ERROR_DATA_TOO_BIG; + return false; + } + Copy(value, b->Buf, b->Size); + A_SIZE(a, 3) = b->Size; + FreeBuf(b); + + // Store the Subject and the Issuer by encoding into UTF-8 + GetPrintNameFromName(w_subject, sizeof(w_subject), x->subject_name); + UniToUtf8(subject, sizeof(subject), w_subject); + A_SIZE(a, 0) = StrLen(subject); + if (x->root_cert == false) + { + GetPrintNameFromName(w_issuer, sizeof(w_issuer), x->issuer_name); + UniToUtf8(issuer, sizeof(issuer), w_issuer); + A_SIZE(a, 1) = StrLen(issuer); + } + + // Copy the serial number + Copy(serial_number, x->serial->data, MIN(x->serial->size, sizeof(serial_number))); + A_SIZE(a, 2) = MIN(x->serial->size, sizeof(serial_number)); + + // Expiration date information + UINT64ToCkDate(&start_date, SystemToLocal64(x->notBefore)); + UINT64ToCkDate(&end_date, SystemToLocal64(x->notAfter)); + + // Workaround for Gemalto PKCS#11 API. It rejects a private certificate. + if(sec->Dev->Id == 18 || sec->Dev->Id == 19) + { + b_private_obj = false; + } + + // Remove objects which have the same name + if (CheckSecObject(sec, name, SEC_X)) + { + DeleteSecCert(sec, name); + } + + // Creating + if ((ret = sec->Api->C_CreateObject(sec->SessionId, a, sizeof(a) / sizeof(a[0]), &object)) != CKR_OK) + { + // Failure + sec->Error = SEC_ERROR_HARDWARE_ERROR; + Debug("Error: 0x%02x\n", ret); + return false; + } + + // Clear Cache + EraseEnumSecObjectCache(sec); + + return true; +} + +// Delete the private key object +bool DeleteSecKey(SECURE *sec, char *name) +{ + return DeleteSecObjectByName(sec, name, SEC_K); +} + +// Delete the certificate object +bool DeleteSecCert(SECURE *sec, char *name) +{ + return DeleteSecObjectByName(sec, name, SEC_X); +} + +// Convert the the CK_DATE to the 64 bit time +UINT64 CkDateToUINT64(struct CK_DATE *ck_date) +{ + SYSTEMTIME st; + char year[32], month[32], day[32]; + // Validate arguments + if (ck_date == NULL) + { + return 0; + } + + Zero(year, sizeof(year)); + Zero(month, sizeof(month)); + Zero(day, sizeof(day)); + + Copy(year, ck_date->year, 4); + Copy(month, ck_date->month, 2); + Copy(day, ck_date->day, 2); + + st.wYear = ToInt(year); + st.wMonth = ToInt(month); + st.wDay = ToInt(day); + + return SystemToUINT64(&st); +} + +// Convert the 64 bit time to the CK_DATE +void UINT64ToCkDate(void *p_ck_date, UINT64 time64) +{ + SYSTEMTIME st; + char year[32], month[32], day[32]; + struct CK_DATE *ck_date = (CK_DATE *)p_ck_date; + // Validate arguments + if (ck_date == NULL) + { + return; + } + + UINT64ToSystem(&st, time64); + + Format(year, sizeof(year), "%04u", st.wYear); + Format(month, sizeof(month), "%04u", st.wMonth); + Format(day, sizeof(day), "%04u", st.wDay); + + Zero(ck_date, sizeof(CK_DATE)); + + Copy(ck_date->year, year, 4); + Copy(ck_date->month, month, 2); + Copy(ck_date->day, day, 2); +} + +// Delete the object by specifying the name +bool DeleteSecObjectByName(SECURE *sec, char *name, UINT type) +{ + bool ret; + SEC_OBJ *obj; + // Validate arguments + if (sec == NULL) + { + return false; + } + if (name == NULL) + { + sec->Error = SEC_ERROR_BAD_PARAMETER; + return false; + } + if (sec->SessionCreated == false) + { + sec->Error = SEC_ERROR_NO_SESSION; + return false; + } + + // Get the Object + obj = FindSecObject(sec, name, type); + if (obj == NULL) + { + // Failure + return false; + } + + // Delete the Object + ret = DeleteSecObject(sec, obj); + + // Memory release + FreeSecObject(obj); + + return ret; +} + +// Delete the Data +bool DeleteSecData(SECURE *sec, char *name) +{ + // Validate arguments + if (sec == NULL) + { + return false; + } + if (name == NULL) + { + sec->Error = SEC_ERROR_BAD_PARAMETER; + return false; + } + + return DeleteSecObjectByName(sec, name, SEC_DATA); +} + +// Delete the secure object +bool DeleteSecObject(SECURE *sec, SEC_OBJ *obj) +{ + // Validate arguments + if (sec == NULL) + { + return false; + } + if (obj == NULL) + { + sec->Error = SEC_ERROR_BAD_PARAMETER; + return false; + } + if (sec->SessionCreated == false) + { + sec->Error = SEC_ERROR_NO_SESSION; + return false; + } + if (sec->LoginFlag == false && obj->Private) + { + sec->Error = SEC_ERROR_NOT_LOGIN; + return false; + } + + // Delete the Object + if (sec->Api->C_DestroyObject(sec->SessionId, obj->Object) != CKR_OK) + { + sec->Error = SEC_ERROR_HARDWARE_ERROR; + return false; + } + + // Clear the Cache + DeleteSecObjFromEnumCache(sec, obj->Name, obj->Type); + + return true; +} + +// Remove the object which have the specified name from the cache +void DeleteSecObjFromEnumCache(SECURE *sec, char *name, UINT type) +{ + UINT i; + // Validate arguments + if (sec == NULL || name == NULL || sec->EnumCache == NULL) + { + return; + } + + for (i = 0;i < LIST_NUM(sec->EnumCache);i++) + { + SEC_OBJ *obj = LIST_DATA(sec->EnumCache, i); + + if (StrCmpi(obj->Name, name) == 0) + { + if (obj->Type == type) + { + Delete(sec->EnumCache, obj); + FreeSecObject(obj); + break; + } + } + } +} + +// Read by searching a secure object by name +int ReadSecData(SECURE *sec, char *name, void *data, UINT size) +{ + UINT ret = 0; + SEC_OBJ *obj; + // Validate arguments + if (sec == NULL || name == NULL || data == NULL) + { + return 0; + } + if (sec->SessionCreated == false) + { + sec->Error = SEC_ERROR_NO_SESSION; + return 0; + } + + // Read + obj = FindSecObject(sec, name, SEC_DATA); + if (obj == NULL) + { + // Not found + return 0; + } + + // Read + ret = ReadSecDataFromObject(sec, obj, data, size); + + FreeSecObject(obj); + + return ret; +} + +// Clear the cache +void EraseEnumSecObjectCache(SECURE *sec) +{ + // Validate arguments + if (sec == NULL || sec->EnumCache == NULL) + { + return; + } + + FreeEnumSecObject(sec->EnumCache); + sec->EnumCache = NULL; +} + +// Check for the existence of a secure object +bool CheckSecObject(SECURE *sec, char *name, UINT type) +{ + SEC_OBJ *obj; + // Validate arguments + if (sec == NULL) + { + return false; + } + if (name == NULL) + { + sec->Error = SEC_ERROR_BAD_PARAMETER; + return false; + } + if (sec->SessionCreated == false) + { + sec->Error = SEC_ERROR_NO_SESSION; + return 0; + } + + obj = FindSecObject(sec, name, type); + + if (obj == NULL) + { + return false; + } + else + { + FreeSecObject(obj); + return true; + } +} + +// Cloning a secure object structure +SEC_OBJ *CloneSecObject(SEC_OBJ *obj) +{ + SEC_OBJ *ret; + // Validate arguments + if (obj == NULL) + { + return NULL; + } + + ret = ZeroMalloc(sizeof(SEC_OBJ)); + ret->Name = CopyStr(obj->Name); + ret->Object = obj->Object; + ret->Private = obj->Private; + ret->Type = obj->Type; + + return ret; +} + +// Search a secure object by the name +SEC_OBJ *FindSecObject(SECURE *sec, char *name, UINT type) +{ + LIST *o; + UINT i; + SEC_OBJ *ret = NULL; + // Validate arguments + if (sec == NULL) + { + return NULL; + } + if (name == NULL) + { + sec->Error = SEC_ERROR_BAD_PARAMETER; + return NULL; + } + if (sec->SessionCreated == false) + { + sec->Error = SEC_ERROR_NO_SESSION; + return 0; + } + + // Enumeration + o = EnumSecObject(sec); + if (o == NULL) + { + return NULL; + } + for (i = 0;i < LIST_NUM(o);i++) + { + SEC_OBJ *obj = LIST_DATA(o, i); + + if (obj->Type == type || type == INFINITE) + { + if (StrCmpi(obj->Name, name) == 0) + { + ret = CloneSecObject(obj); + break; + } + } + } + FreeEnumSecObject(o); + + if (ret == NULL) + { + sec->Error = SEC_ERROR_OBJ_NOT_FOUND; + } + + return ret; +} + +// Reading a secure object +int ReadSecDataFromObject(SECURE *sec, SEC_OBJ *obj, void *data, UINT size) +{ + UCHAR buf[MAX_SEC_DATA_SIZE]; + UINT i; + CK_ATTRIBUTE get[] = + { + {CKA_VALUE, buf, sizeof(buf)}, + }; + // Validate arguments + if (sec == NULL) + { + return 0; + } + if (obj == NULL || data == NULL || size == 0) + { + sec->Error = SEC_ERROR_BAD_PARAMETER; + return 0; + } + if (obj->Type != SEC_DATA) + { + sec->Error = SEC_ERROR_BAD_PARAMETER; + return false; + } + if (sec->SessionCreated == false) + { + sec->Error = SEC_ERROR_NO_SESSION; + return 0; + } + if (sec->LoginFlag == false && obj->Private) + { + sec->Error = SEC_ERROR_NOT_LOGIN; + return 0; + } + + // Acquisition + if (sec->Api->C_GetAttributeValue( + sec->SessionId, obj->Object, get, sizeof(get) / sizeof(get[0])) != CKR_OK) + { + sec->Error = SEC_ERROR_HARDWARE_ERROR; + return 0; + } + + // Return the result + i = get[0].ulValueLen; + if (i > MAX_SEC_DATA_SIZE || i > size) + { + // Data is too large + sec->Error = SEC_ERROR_DATA_TOO_BIG; + return 0; + } + + // Memory copy + Copy(data, buf, i); + + return i; +} + +// Release of enumeration results of the secure object +void FreeEnumSecObject(LIST *o) +{ + UINT i; + // Validate arguments + if (o == NULL) + { + return; + } + + for (i = 0;i < LIST_NUM(o);i++) + { + SEC_OBJ *obj = LIST_DATA(o, i); + + FreeSecObject(obj); + } + + ReleaseList(o); +} + +// Release the secure object +void FreeSecObject(SEC_OBJ *obj) +{ + // Validate arguments + if (obj == NULL) + { + return; + } + + Free(obj->Name); + Free(obj); +} + +// Clone the secure object enumeration results +LIST *CloneEnumSecObject(LIST *o) +{ + LIST *ret; + UINT i; + // Validate arguments + if (o == NULL) + { + return NULL; + } + + ret = NewListFast(NULL); + for (i = 0;i < LIST_NUM(o);i++) + { + SEC_OBJ *obj = LIST_DATA(o, i); + + Add(ret, CloneSecObject(obj)); + } + + return ret; +} + +// Enumeration of the secure objects +LIST *EnumSecObject(SECURE *sec) +{ + CK_BBOOL b_true = true, b_false = false; + UINT objects[MAX_OBJ]; + UINT i; + UINT ret; + LIST *o; + CK_ATTRIBUTE dummy[1]; + CK_ATTRIBUTE a[] = + { + {CKA_TOKEN, &b_true, sizeof(b_true)}, + }; + UINT num_objects = MAX_OBJ; + // Validate arguments + if (sec == NULL) + { + return NULL; + } + if (sec->SessionCreated == false) + { + sec->Error = SEC_ERROR_NO_SESSION; + return NULL; + } + + Zero(dummy, sizeof(dummy)); + + // If there is a cache, return it + if (sec->EnumCache != NULL) + { + return CloneEnumSecObject(sec->EnumCache); + } + + // Enumerate +// if (sec->Dev->Id != 2 && sec->Dev->Id != 14) +// { + // Normal tokens + ret = sec->Api->C_FindObjectsInit(sec->SessionId, a, sizeof(a) / sizeof(a[0])); +// } +// else +// { + // ePass and SafeSign +// ret = sec->Api->C_FindObjectsInit(sec->SessionId, dummy, 0); +// } + + if (ret != CKR_OK) + { + sec->Error = SEC_ERROR_HARDWARE_ERROR; + return NULL; + } + if (sec->Api->C_FindObjects(sec->SessionId, objects, sizeof(objects) / sizeof(objects[0]), &num_objects) != CKR_OK) + { + sec->Api->C_FindObjectsFinal(sec->SessionId); + sec->Error = SEC_ERROR_HARDWARE_ERROR; + return NULL; + } + sec->Api->C_FindObjectsFinal(sec->SessionId); + + o = NewListFast(NULL); + + for (i = 0;i < num_objects;i++) + { + char label[MAX_SIZE]; + UINT obj_class = 0; + bool priv = false; + CK_ATTRIBUTE get[] = + { + {CKA_LABEL, label, sizeof(label) - 1}, + {CKA_CLASS, &obj_class, sizeof(obj_class)}, + {CKA_PRIVATE, &priv, sizeof(priv)}, + }; + + Zero(label, sizeof(label)); + + if (sec->Api->C_GetAttributeValue(sec->SessionId, objects[i], + get, sizeof(get) / sizeof(get[0])) == CKR_OK) + { + UINT type = INFINITE; + + switch (obj_class) + { + case CKO_DATA: + // Data + type = SEC_DATA; + break; + + case CKO_CERTIFICATE: + // Certificate + type = SEC_X; + break; + + case CKO_PUBLIC_KEY: + // Public key + type = SEC_P; + break; + + case CKO_PRIVATE_KEY: + // Secret key + type = SEC_K; + break; + } + + if (type != INFINITE) + { + SEC_OBJ *obj = ZeroMalloc(sizeof(SEC_OBJ)); + + obj->Type = type; + obj->Object = objects[i]; + obj->Private = (priv == false) ? false : true; + EnSafeStr(label, '?'); + TruncateCharFromStr(label, '?'); + obj->Name = CopyStr(label); + + Add(o, obj); + } + } + } + + // Creating a cache + sec->EnumCache = CloneEnumSecObject(o); + + return o; +} + +// Write the data +bool WriteSecData(SECURE *sec, bool private_obj, char *name, void *data, UINT size) +{ + UINT object_class = CKO_DATA; + CK_BBOOL b_true = true, b_false = false, b_private_obj = private_obj; + UINT object; + CK_ATTRIBUTE a[] = + { + {CKA_TOKEN, &b_true, sizeof(b_true)}, + {CKA_CLASS, &object_class, sizeof(object_class)}, + {CKA_PRIVATE, &b_private_obj, sizeof(b_private_obj)}, + {CKA_LABEL, name, StrLen(name)}, + {CKA_VALUE, data, size}, + }; + // Validate arguments + if (sec == NULL) + { + return false; + } + if (sec->SessionCreated == false) + { + sec->Error = SEC_ERROR_NO_SESSION; + return false; + } + if (private_obj && sec->LoginFlag == false) + { + sec->Error = SEC_ERROR_NOT_LOGIN; + return false; + } + if (name == NULL || data == NULL || size == 0) + { + sec->Error = SEC_ERROR_BAD_PARAMETER; + return false; + } + if (size > MAX_SEC_DATA_SIZE) + { + sec->Error = SEC_ERROR_DATA_TOO_BIG; + return false; + } + + // Delete any objects with the same name + if (CheckSecObject(sec, name, SEC_DATA)) + { + DeleteSecData(sec, name); + } + + // Object creation + if (sec->Api->C_CreateObject(sec->SessionId, a, sizeof(a) / sizeof(a[0]), &object) != CKR_OK) + { + sec->Error = SEC_ERROR_HARDWARE_ERROR; + return false; + } + + // Clear the cache + EraseEnumSecObjectCache(sec); + + return true; +} + +// Display the token information +void PrintSecInfo(SECURE *sec) +{ + SEC_INFO *s; + // Validate arguments + if (sec == NULL) + { + return; + } + + s = sec->Info; + if (s == NULL) + { + Print("No Token Info.\n"); + return; + } + + Print( + " Label: %S\n" + " ManufacturerId: %S\n" + " Model: %S\n" + " SerialNumber: %S\n" + " MaxSession: %u\n" + " MaxRWSession: %u\n" + " MinPinLen: %u\n" + " MaxPinLen: %u\n" + " TotalPublicMemory: %u\n" + " FreePublicMemory: %u\n" + " TotalPrivateMemory: %u\n" + " FreePrivateMemory: %u\n" + " HardwareVersion: %s\n" + " FirmwareVersion: %s\n", + s->Label, s->ManufacturerId, s->Model, s->SerialNumber, + s->MaxSession, s->MaxRWSession, s->MinPinLen, s->MaxPinLen, + s->TotalPublicMemory, s->FreePublicMemory, s->TotalPrivateMemory, + s->FreePrivateMemory, s->HardwareVersion, s->FirmwareVersion + ); +} + +// Get the token information +void GetSecInfo(SECURE *sec) +{ + CK_TOKEN_INFO token_info; + // Validate arguments + if (sec == NULL) + { + return; + } + if (sec->Info != NULL) + { + return; + } + + // Acquisition + Zero(&token_info, sizeof(token_info)); + if (sec->Api->C_GetTokenInfo(sec->SlotIdList[sec->SessionSlotNumber], &token_info) != CKR_OK) + { + // Failure + return; + } + + sec->Info = TokenInfoToSecInfo(&token_info); +} + +// Release the token information +void FreeSecInfo(SECURE *sec) +{ + // Validate arguments + if (sec == NULL) + { + return; + } + if (sec->Info == NULL) + { + return; + } + + FreeSecInfoMemory(sec->Info); + sec->Info = NULL; +} + +// Convert the token information to the SEC_INFO +SEC_INFO *TokenInfoToSecInfo(void *p_t) +{ + SEC_INFO *s; + char buf[MAX_SIZE]; + CK_TOKEN_INFO *t = (CK_TOKEN_INFO *)p_t; + // Validate arguments + if (t == NULL) + { + return NULL; + } + + s = ZeroMalloc(sizeof(SEC_INFO)); + + // Label + Zero(buf, sizeof(buf)); + Copy(buf, t->label, sizeof(t->label)); + s->Label = ZeroMalloc(CalcUtf8ToUni(buf, 0)); + Utf8ToUni(s->Label, 0, buf, 0); + + // ManufacturerId + Zero(buf, sizeof(buf)); + Copy(buf, t->manufacturerID, sizeof(t->manufacturerID)); + s->ManufacturerId = ZeroMalloc(CalcUtf8ToUni(buf, 0)); + Utf8ToUni(s->ManufacturerId, 0, buf, 0); + + // Model + Zero(buf, sizeof(buf)); + Copy(buf, t->model, sizeof(t->model)); + s->Model = ZeroMalloc(CalcUtf8ToUni(buf, 0)); + Utf8ToUni(s->Model, 0, buf, 0); + + // SerialNumber + Zero(buf, sizeof(buf)); + Copy(buf, t->serialNumber, sizeof(t->serialNumber)); + s->SerialNumber = ZeroMalloc(CalcUtf8ToUni(buf, 0)); + Utf8ToUni(s->SerialNumber, 0, buf, 0); + + // Numeric value + s->MaxSession = t->ulMaxSessionCount; + s->MaxRWSession = t->ulMaxRwSessionCount; + s->MinPinLen = t->ulMinPinLen; + s->MaxPinLen = t->ulMaxPinLen; + s->TotalPublicMemory = t->ulTotalPublicMemory; + s->FreePublicMemory = t->ulFreePublicMemory; + s->TotalPrivateMemory = t->ulTotalPrivateMemory; + s->FreePrivateMemory = t->ulFreePrivateMemory; + + // Hardware version + Format(buf, sizeof(buf), "%u.%02u", t->hardwareVersion.major, t->hardwareVersion.minor); + s->HardwareVersion = CopyStr(buf); + + // Firmware version + Format(buf, sizeof(buf), "%u.%02u", t->firmwareVersion.major, t->firmwareVersion.minor); + s->FirmwareVersion = CopyStr(buf); + + return s; +} + +// Release the memory of the SEC_INFO +void FreeSecInfoMemory(SEC_INFO *s) +{ + // Validate arguments + if (s == NULL) + { + return; + } + + Free(s->Label); + Free(s->ManufacturerId); + Free(s->Model); + Free(s->SerialNumber); + Free(s->HardwareVersion); + Free(s->FirmwareVersion); + Free(s); +} + +// Log-out +void LogoutSec(SECURE *sec) +{ + // Validate arguments + if (sec == NULL) + { + return; + } + if (sec->LoginFlag == false) + { + return; + } + + // Log-out + sec->Api->C_Logout(sec->SessionId); + + // Clear Cache + EraseEnumSecObjectCache(sec); + + sec->LoginFlag = false; +} + +// Log-in +bool LoginSec(SECURE *sec, char *pin) +{ + // Validate arguments + if (sec == NULL) + { + return false; + } + if (sec->SessionCreated == false) + { + sec->Error = SEC_ERROR_NO_SESSION; + return false; + + } + if (sec->LoginFlag) + { + sec->Error = SEC_ERROR_ALREADY_LOGIN; + return false; + } + if (pin == NULL) + { + sec->Error = SEC_ERROR_NO_PIN_STR; + return false; + } + + // Log-in + if (sec->Api->C_Login(sec->SessionId, CKU_USER, pin, StrLen(pin)) != CKR_OK) + { + // Login failure + sec->Error = SEC_ERROR_BAD_PIN_CODE; + return false; + } + + // Clear the cache + EraseEnumSecObjectCache(sec); + + sec->LoginFlag = true; + + return true; +} + +// Close the session +void CloseSecSession(SECURE *sec) +{ + // Validate arguments + if (sec == NULL) + { + return; + } + if (sec->SessionCreated == false) + { + return; + } + + // Close the session + sec->Api->C_CloseSession(sec->SessionId); + + sec->SessionCreated = false; + sec->SessionId = 0; + sec->SessionSlotNumber = 0; + + FreeSecInfo(sec); + + // Clear the cache + EraseEnumSecObjectCache(sec); +} + +// Open the session +bool OpenSecSession(SECURE *sec, UINT slot_number) +{ + UINT err = 0; + UINT session; + // Validate arguments + if (sec == NULL) + { + return false; + } + if (sec->SessionCreated) + { + // Already been created + sec->Error = SEC_ERROR_SESSION_EXISTS; + return false; + } + if (slot_number >= sec->NumSlot) + { + // Slot number is invalid + sec->Error = SEC_ERROR_INVALID_SLOT_NUMBER; + return false; + } + + // Create a session + if ((err = sec->Api->C_OpenSession(sec->SlotIdList[slot_number], + CKF_RW_SESSION | CKF_SERIAL_SESSION, NULL, NULL, &session)) != CKR_OK) + { + // Failed to initialize session in read / write mode + // Read-only mode? + if ((err = sec->Api->C_OpenSession(sec->SlotIdList[slot_number], + CKF_SERIAL_SESSION, NULL, NULL, &session)) != CKR_OK) + { + // Failure to create + sec->Error = SEC_ERROR_OPEN_SESSION; + return false; + } + else + { + sec->IsReadOnly = true; + } + } + + sec->SessionCreated = true; + sec->SessionId = session; + sec->SessionSlotNumber = slot_number; + + // Get the token information + GetSecInfo(sec); + + return true; +} + +// Close the secure device +void CloseSec(SECURE *sec) +{ + // Validate arguments + if (sec == NULL) + { + return; + } + + // Log out + LogoutSec(sec); + + // Close the session + CloseSecSession(sec); + + // Release the token information + FreeSecInfo(sec); + + // Release of the slot list memory + if (sec->SlotIdList != NULL) + { + Free(sec->SlotIdList); + sec->SlotIdList = NULL; + } + + // Unload the module + FreeSecModule(sec); + + // Memory release + DeleteLock(sec->lock); + Free(sec); +} + +// Open a secure device +SECURE *OpenSec(UINT id) +{ + SECURE_DEVICE *dev = GetSecureDevice(id); + SECURE *sec; + UINT err; + + if (dev == NULL) + { + return NULL; + } + + sec = ZeroMalloc(sizeof(SECURE)); + + sec->lock = NewLock(); + sec->Error = SEC_ERROR_NOERROR; + sec->Dev = dev; + + // Get whether it's a ePass or not + if (SearchStrEx(dev->DeviceName, "epass", 0, false) != INFINITE) + { + sec->IsEPass1000 = true; + } + + // Load the module + if (LoadSecModule(sec) == false) + { + CloseSec(sec); + return NULL; + } + + // Get the slot list + sec->NumSlot = 0; + if ((err = sec->Api->C_GetSlotList(true, NULL, &sec->NumSlot)) != CKR_OK || sec->NumSlot == 0) + { + // Failure + FreeSecModule(sec); + CloseSec(sec); + return NULL; + } + + sec->SlotIdList = (UINT *)ZeroMalloc(sizeof(UINT) * sec->NumSlot); + + if (sec->Api->C_GetSlotList(TRUE, sec->SlotIdList, &sec->NumSlot) != CKR_OK) + { + // Failure + Free(sec->SlotIdList); + sec->SlotIdList = NULL; + FreeSecModule(sec); + CloseSec(sec); + return NULL; + } + + return sec; +} + +// Load the module of the secure device +bool LoadSecModule(SECURE *sec) +{ + bool ret = false; + // Validate arguments + if (sec == NULL) + { + return false; + } + +#ifdef OS_WIN32 + ret = Win32LoadSecModule(sec); +#endif // OS_WIN32 + + // Initialization + if (sec->Api->C_Initialize(NULL) != CKR_OK) + { + // Initialization Failed + FreeSecModule(sec); + return false; + } + + sec->Initialized = true; + + return ret; +} + +// Unload the module of the secure device +void FreeSecModule(SECURE *sec) +{ + // Validate arguments + if (sec == NULL) + { + return; + } + + if (sec->Initialized) + { + // Release because it is initialized + sec->Api->C_Finalize(NULL); + sec->Initialized = false; + } + +#ifdef OS_WIN32 + Win32FreeSecModule(sec); +#endif // OS_WIN32 + +} + + +// Get a secure device +SECURE_DEVICE *GetSecureDevice(UINT id) +{ + UINT i; + + if (id == 0) + { + return NULL; + } + + for (i = 0;i < LIST_NUM(SecureDeviceList);i++) + { + SECURE_DEVICE *dev = LIST_DATA(SecureDeviceList, i); + + if (dev->Id == id) + { + return dev; + } + } + + return NULL; +} + +// Confirm the ID of the secure device +bool CheckSecureDeviceId(UINT id) +{ + UINT i; + + for (i = 0;i < LIST_NUM(SecureDeviceList);i++) + { + SECURE_DEVICE *dev = LIST_DATA(SecureDeviceList, i); + + if (dev->Id == id) + { + return true; + } + } + + return false; +} + +// Get a list of supported devices +LIST *GetSecureDeviceList() +{ + return GetSupportedDeviceList(); +} + +// Get a list of supported devices +LIST *GetSupportedDeviceList() +{ + // Increase the reference count + AddRef(SecureDeviceList->ref); + + return SecureDeviceList; +} + +// Examine whether the specified device is installed and available +bool IsDeviceSupported(SECURE_DEVICE *dev) +{ + bool b = false; +#ifdef OS_WIN32 + b = Win32IsDeviceSupported(dev); +#endif // OS_WIN32 + return b; +} + +// Initialization of the secure device list +void InitSecureDeviceList() +{ + UINT i, num_supported_list; + SecureDeviceList = NewList(NULL); + + num_supported_list = sizeof(SupportedList) / sizeof(SECURE_DEVICE); + for (i = 0; i < num_supported_list;i++) + { + SECURE_DEVICE *dev = &SupportedList[i]; + + // Support Checking + if (IsDeviceSupported(dev)) + { + // Add the device to the list because it is supported + Add(SecureDeviceList, dev); + } + } +} + +// Test main procedure +void TestSecMain(SECURE *sec) +{ + char *test_str = CEDAR_PRODUCT_STR " VPN"; + K *public_key, *private_key; + // Validate arguments + if (sec == NULL) + { + return; + } + + Print("test_str: \"%s\"\n", test_str); + + Print("Writing Data...\n"); + if (WriteSecData(sec, true, "test_str", test_str, StrLen(test_str)) == false) + { + Print("WriteSecData() Failed.\n"); + } + else + { + char data[MAX_SIZE]; + Zero(data, sizeof(data)); + Print("Reading Data...\n"); + if (ReadSecData(sec, "test_str", data, sizeof(data)) == false) + { + Print("ReadSecData() Failed.\n"); + } + else + { + Print("test_str: \"%s\"\n", data); + } + Print("Deleting Data...\n"); + DeleteSecData(sec, "test_str"); + } + + Print("Generating Key...\n"); + if (RsaGen(&private_key, &public_key, 2048) == false) + { + Print("RsaGen() Failed.\n"); + } + else + { + X *cert; + NAME *name; + X_SERIAL *serial; + UINT num = 0x11220000; + + Print("Creating Cert...\n"); + serial = NewXSerial(&num, sizeof(UINT)); + name = NewName(L"Test", L"Test", L"Test", L"JP", L"Test", L"Test"); + cert = NewRootX(public_key, private_key, name, 365, NULL); + FreeXSerial(serial); + if (cert == NULL) + { + Print("NewRootX() Failed.\n"); + } + else + { + Print("Writing Cert...\n"); + DeleteSecData(sec, "test_cer"); + if (WriteSecCert(sec, true, "test_cer", cert) == false) + { + Print("WriteSecCert() Failed.\n"); + } + else + { + X *x; + Print("Reading Cert...\n"); + x = ReadSecCert(sec, "test_cer"); + if (x == NULL) + { + Print("ReadSecCert() Failed.\n"); + } + else + { + Print("Checking two Certs... "); + if (CompareX(x, cert) == false) + { + Print("[FAILED]\n"); + } + else + { + Print("Ok.\n"); + } + FreeX(x); + } + if (cert != NULL) + { + X *x; + XToFile(cert, "cert_tmp.cer", true); + x = FileToX("cert_tmp.cer"); + if (CompareX(x, cert) == false) + { + Print("[FAILED]\n"); + } + else + { + Print("Ok.\n"); + Print("Writing Private Key...\n"); + DeleteSecKey(sec, "test_key"); + if (WriteSecKey(sec, false, "test_key", private_key) == false) + { + Print("WriteSecKey() Failed.\n"); + } + else + { + UCHAR sign_cpu[512]; + UCHAR sign_sec[512]; + K *pub = GetKFromX(cert); + UINT keybytes = (cert->bits)/8; + Print("Ok.\n"); + Print("Signing Data by CPU...\n"); + if (RsaSign(sign_cpu, test_str, StrLen(test_str), private_key) == false) + { + Print("RsaSign() Failed.\n"); + } + else + { + Print("Ok.\n"); + Print("sign_cpu: "); + PrintBin(sign_cpu, keybytes); + Print("Signing Data by %s..\n", sec->Dev->DeviceName); + if (SignSec(sec, "test_key", sign_sec, test_str, StrLen(test_str)) == false) + { + Print("SignSec() Failed.\n"); + } + else + { + Print("Ok.\n"); + Print("sign_sec: "); + PrintBin(sign_sec, keybytes); + Print("Compare..."); + if (Cmp(sign_sec, sign_cpu, keybytes) == 0) + { + Print("Ok.\n"); + Print("Verify..."); + if (RsaVerifyEx(test_str, StrLen(test_str), + sign_sec, pub, cert->bits) == false) + { + Print("[FAILED]\n"); + } + else + { + Print("Ok.\n"); + } + } + else + { + Print("[DIFFERENT]\n"); + } + } + } + Print("Deleting test_key...\n"); +// DeleteSecKey(sec, "test_key"); + FreeK(pub); + } + } + FreeX(x); + } + } + Print("Deleting Cert..\n"); +// DeleteSecCert(sec, "test_cer"); + FreeX(cert); + } + FreeName(name); + FreeK(private_key); + FreeK(public_key); + } +} + +// Test the security device +void TestSec() +{ + UINT i; + LIST *secure_device_list; + Print("Secure Device Test Program\n" + "Copyright (c) SoftEther Corporation. All Rights Reserved.\n\n"); + + // Get the secure device list + secure_device_list = GetSecureDeviceList(); + if (secure_device_list != NULL) + { + UINT use_device_id; + char tmp[MAX_SIZE]; + Print("--- Secure Device List ---\n"); + for (i = 0;i < LIST_NUM(secure_device_list);i++) + { + SECURE_DEVICE *dev = LIST_DATA(secure_device_list, i); + Print("%2u - %s\n", dev->Id, dev->DeviceName); + } + Print("\n"); + Print("Device ID >"); + GetLine(tmp, sizeof(tmp)); + use_device_id = ToInt(tmp); + if (use_device_id == 0) + { + Print("Canceled.\n"); + } + else + { + SECURE *sec = OpenSec(use_device_id); + Print("Opening Device...\n"); + if (sec == NULL) + { + Print("OpenSec() Failed.\n"); + } + else + { + Print("Opening Session...\n"); + if (OpenSecSession(sec, 0) == false) + { + Print("OpenSecSession() Failed.\n"); + } + else + { + while (true) + { + char pin[MAX_SIZE]; + Print("PIN Code >"); + GetLine(pin, sizeof(pin)); + Trim(pin); + if (StrLen(pin) == 0) + { + Print("Canceled.\n"); + break; + } + else + { + Print("Login...\n"); + if (LoginSec(sec, pin)) + { + TestSecMain(sec); + Print("Logout...\n"); + LogoutSec(sec); + break; + } + else + { + Print("Login Failed. Please Try Again.\n"); + } + } + } + Print("Closing Session...\n"); + CloseSecSession(sec); + } + Print("Closing Device...\n"); + CloseSec(sec); + } + } + ReleaseList(secure_device_list); + } + else + { + Print("GetSecureDeviceList() Error.\n"); + } +} + +// Release of the secure device list +void FreeSecureDeviceList() +{ + ReleaseList(SecureDeviceList); +} + +// Initialization of the security token module +void InitSecure() +{ + // Initialization of the secure device list + InitSecureDeviceList(); +} + +// Release of the security token module +void FreeSecure() +{ + // Release of the secure device list + FreeSecureDeviceList(); +} + + diff --git a/src/Mayaqua/Secure.h b/src/Mayaqua/Secure.h index 53ccc599..d903ce1e 100644 --- a/src/Mayaqua/Secure.h +++ b/src/Mayaqua/Secure.h @@ -1,220 +1,220 @@ -// SoftEther VPN Source Code - Developer Edition Master Branch -// Mayaqua Kernel - - -// Secure.h -// Header of Secure.c - -#ifndef SECURE_H -#define SECURE_H - -// Constant -#define MAX_SEC_DATA_SIZE 4096 - -// Type declaration related to PKCS#11 -#ifndef SECURE_C -typedef struct CK_FUNCTION_LIST *CK_FUNCTION_LIST_PTR; -typedef struct SEC_DATA_WIN32 SEC_DATA_WIN32; -typedef struct CK_TOKEN_INFO CK_TOKEN_INFO; -typedef struct CK_DATE CK_DATE; -#endif // SECURE_C - -// Secure device -struct SECURE_DEVICE -{ - UINT Id; // Device ID - UINT Type; // Type - char *DeviceName; // Device name - char *Manufacturer; // Manufacturer - char *ModuleName; // Module name -}; - -// Type of secure device -#define SECURE_IC_CARD 0 // IC card -#define SECURE_USB_TOKEN 1 // USB token - -// Secure device information -struct SEC_INFO -{ - wchar_t *Label; // Label - wchar_t *ManufacturerId; // Vendor ID - wchar_t *Model; // Model - wchar_t *SerialNumber; // Serial number - UINT MaxSession; // Maximum number of sessions - UINT MaxRWSession; // Maximum Number of R/W sessions - UINT MinPinLen; // Minimum length of the PIN string - UINT MaxPinLen; // Maximum length of the PIN string - UINT TotalPublicMemory; // Total memory capacity (Public) - UINT FreePublicMemory; // Free memory capacity (Public) - UINT TotalPrivateMemory; // Total memory capacity (Private) - UINT FreePrivateMemory; // Free memory capacity (Private) - char *HardwareVersion; // Hardware version - char *FirmwareVersion; // Firmware version -}; - -// Secure device structure -struct SECURE -{ - LOCK *lock; // Lock - SECURE_DEVICE *Dev; // Device Information - UINT Error; // The error that last occurred - struct CK_FUNCTION_LIST *Api; // API - bool Initialized; // Initialization flag - UINT NumSlot; // The number of slots - UINT *SlotIdList; // Slot ID list - bool SessionCreated; // Session creation flags - UINT SessionId; // Session ID - UINT SessionSlotNumber; // Slot ID of the session - bool LoginFlag; // Logged-in flag - SEC_INFO *Info; // Token information - LIST *EnumCache; // Enumeration cache - - // Attribute value for the different behavior for each driver - bool IsEPass1000; // ePass 1000 - bool IsReadOnly; // Read-only mode - -#ifdef OS_WIN32 - struct SEC_DATA_WIN32 *Data; // Data -#endif // OS_WIN32 -}; - -// Secure device object structure -struct SEC_OBJ -{ - UINT Type; // Type of object - UINT Object; // Object handle - bool Private; // Private flag - char *Name; // Name -}; - -#define SEC_ERROR_NOERROR 0 // No Error -#define SEC_ERROR_INVALID_SLOT_NUMBER 1 // Slot number is invalid -#define SEC_ERROR_OPEN_SESSION 2 // Session creation failure -#define SEC_ERROR_SESSION_EXISTS 3 // The session already exists -#define SEC_ERROR_NO_PIN_STR 4 // PIN string is not specified -#define SEC_ERROR_ALREADY_LOGIN 5 // Already logged in -#define SEC_ERROR_BAD_PIN_CODE 6 // PIN code is invalid -#define SEC_ERROR_NO_SESSION 7 // There is no session -#define SEC_ERROR_DATA_TOO_BIG 8 // Data is too large -#define SEC_ERROR_NOT_LOGIN 9 // Not logged in -#define SEC_ERROR_BAD_PARAMETER 10 // Invalid Parameters -#define SEC_ERROR_HARDWARE_ERROR 11 // Hardware error -#define SEC_ERROR_OBJ_NOT_FOUND 12 // Object is not found -#define SEC_ERROR_INVALID_CERT 13 // The certificate is invalid - - -#define SEC_DATA 0 // Data -#define SEC_X 1 // Certificate -#define SEC_K 2 // Secret key -#define SEC_P 3 // Public key - - - -// Function prototype -void InitSecure(); -void FreeSecure(); -void InitSecureDeviceList(); -void FreeSecureDeviceList(); -bool IsDeviceSupported(SECURE_DEVICE *dev); -LIST *GetSupportedDeviceList(); -LIST *GetSecureDeviceList(); -bool CheckSecureDeviceId(UINT id); -SECURE_DEVICE *GetSecureDevice(UINT id); -SECURE *OpenSec(UINT id); -void CloseSec(SECURE *sec); -bool OpenSecSession(SECURE *sec, UINT slot_number); -void CloseSecSession(SECURE *sec); -bool LoginSec(SECURE *sec, char *pin); -void LogoutSec(SECURE *sec); -void PrintSecInfo(SECURE *sec); -LIST *EnumSecObject(SECURE *sec); -void FreeSecObject(SEC_OBJ *obj); -void FreeEnumSecObject(LIST *o); -SEC_OBJ *FindSecObject(SECURE *sec, char *name, UINT type); -bool CheckSecObject(SECURE *sec, char *name, UINT type); -bool DeleteSecObjectByName(SECURE *sec, char *name, UINT type); -SEC_OBJ *CloneSecObject(SEC_OBJ *obj); -LIST *CloneEnumSecObject(LIST *o); -void EraseEnumSecObjectCache(SECURE *sec); -void DeleteSecObjFromEnumCache(SECURE *sec, char *name, UINT type); -bool WriteSecData(SECURE *sec, bool private_obj, char *name, void *data, UINT size); -int ReadSecDataFromObject(SECURE *sec, SEC_OBJ *obj, void *data, UINT size); -int ReadSecData(SECURE *sec, char *name, void *data, UINT size); -bool DeleteSecObject(SECURE *sec, SEC_OBJ *obj); -bool DeleteSecData(SECURE *sec, char *name); -void UINT64ToCkDate(void *p_ck_date, UINT64 time64); -bool WriteSecCert(SECURE *sec, bool private_obj, char *name, X *x); -bool DeleteSecCert(SECURE *sec, char *name); -X *ReadSecCertFromObject(SECURE *sec, SEC_OBJ *obj); -X *ReadSecCert(SECURE *sec, char *name); -bool WriteSecKey(SECURE *sec, bool private_obj, char *name, K *k); -bool DeleteSecKey(SECURE *sec, char *name); -bool SignSecByObject(SECURE *sec, SEC_OBJ *obj, void *dst, void *src, UINT size); -bool SignSec(SECURE *sec, char *name, void *dst, void *src, UINT size); -bool ChangePin(SECURE *sec, char *old_pin, char *new_pin); -void TestSec(); -void TestSecMain(SECURE *sec); -bool IsJPKI(bool id); - -bool LoadSecModule(SECURE *sec); -void FreeSecModule(SECURE *sec); -void GetSecInfo(SECURE *sec); -void FreeSecInfo(SECURE *sec); -SEC_INFO *TokenInfoToSecInfo(void *p_t); -void FreeSecInfoMemory(SEC_INFO *s); - -#ifdef OS_WIN32 - -bool Win32IsDeviceSupported(SECURE_DEVICE *dev); -bool Win32LoadSecModule(SECURE *sec); -void Win32FreeSecModule(SECURE *sec); - -#endif // OS_WIN32 - - -#ifdef SECURE_C -// Internal data structure -// The list of supported secure devices -static LIST *SecureDeviceList = NULL; - -// Supported hardware list -SECURE_DEVICE SupportedList[] = -{ - {1, SECURE_IC_CARD, "Standard-9 IC Card", "Dai Nippon Printing", "DNPS9P11.DLL"}, - {2, SECURE_USB_TOKEN, "ePass 1000", "Feitian Technologies", "EP1PK111.DLL"}, - {3, SECURE_IC_CARD, "DNP Felica", "Dai Nippon Printing", "DNPFP11.DLL"}, - {4, SECURE_USB_TOKEN, "eToken", "Aladdin", "ETPKCS11.DLL"}, - {5, SECURE_IC_CARD, "Standard-9 IC Card", "Fujitsu", "F3EZSCL2.DLL"}, - {6, SECURE_IC_CARD, "ASECard", "Athena", "ASEPKCS.DLL"}, - {7, SECURE_IC_CARD, "Gemplus IC Card", "Gemplus", "PK2PRIV.DLL"}, - {8, SECURE_IC_CARD, "1-Wire & iButton", "DALLAS SEMICONDUCTOR", "DSPKCS.DLL"}, - {9, SECURE_IC_CARD, "JPKI IC Card", "Japanese Government", "JPKIPKCS11.DLL"}, - {10, SECURE_IC_CARD, "LGWAN IC Card", "Japanese Government", "P11STD9.DLL"}, - {11, SECURE_IC_CARD, "LGWAN IC Card", "Japanese Government", "P11STD9A.DLL"}, - {12, SECURE_USB_TOKEN, "iKey 1000", "Rainbow Technologies", "K1PK112.DLL"}, - {13, SECURE_IC_CARD, "JPKI IC Card #2", "Japanese Government", "libmusclepkcs11.dll"}, - {14, SECURE_USB_TOKEN, "SafeSign", "A.E.T.", "aetpkss1.dll"}, - {15, SECURE_USB_TOKEN, "LOCK STAR-PKI", "Logicaltech Co.,LTD", "LTPKCS11.dll"}, - {16, SECURE_USB_TOKEN, "ePass 2000", "Feitian Technologies", "ep2pk11.dll"}, - {17, SECURE_IC_CARD, "myuToken", "iCanal Inc.", "icardmodpk.dll"}, - {18, SECURE_IC_CARD, "Gemalto .NET", "Gemalto", "gtop11dotnet.dll"}, - {19, SECURE_IC_CARD, "Gemalto .NET 64bit", "Gemalto", "gtop11dotnet64.dll"}, - {20, SECURE_USB_TOKEN, "ePass 2003", "Feitian Technologies", "eps2003csp11.dll"}, - {21, SECURE_USB_TOKEN, "ePass 1000ND/2000/3000", "Feitian Technologies", "ngp11v211.dll"}, - {22, SECURE_USB_TOKEN, "CryptoID", "Longmai Technology", "cryptoide_pkcs11.dll"}, - {23, SECURE_USB_TOKEN, "RuToken", "Aktiv Co.", "rtPKCS11.dll"}, -}; - -#ifdef OS_WIN32 - -// Win32 internal data -typedef struct SEC_DATA_WIN32 -{ - HINSTANCE hInst; -} SEC_DATA_WIN32; - -#endif // OS_WIN32 - -#endif // SECURE_C - -#endif // SECURE_H +// SoftEther VPN Source Code - Developer Edition Master Branch +// Mayaqua Kernel + + +// Secure.h +// Header of Secure.c + +#ifndef SECURE_H +#define SECURE_H + +// Constant +#define MAX_SEC_DATA_SIZE 4096 + +// Type declaration related to PKCS#11 +#ifndef SECURE_C +typedef struct CK_FUNCTION_LIST *CK_FUNCTION_LIST_PTR; +typedef struct SEC_DATA_WIN32 SEC_DATA_WIN32; +typedef struct CK_TOKEN_INFO CK_TOKEN_INFO; +typedef struct CK_DATE CK_DATE; +#endif // SECURE_C + +// Secure device +struct SECURE_DEVICE +{ + UINT Id; // Device ID + UINT Type; // Type + char *DeviceName; // Device name + char *Manufacturer; // Manufacturer + char *ModuleName; // Module name +}; + +// Type of secure device +#define SECURE_IC_CARD 0 // IC card +#define SECURE_USB_TOKEN 1 // USB token + +// Secure device information +struct SEC_INFO +{ + wchar_t *Label; // Label + wchar_t *ManufacturerId; // Vendor ID + wchar_t *Model; // Model + wchar_t *SerialNumber; // Serial number + UINT MaxSession; // Maximum number of sessions + UINT MaxRWSession; // Maximum Number of R/W sessions + UINT MinPinLen; // Minimum length of the PIN string + UINT MaxPinLen; // Maximum length of the PIN string + UINT TotalPublicMemory; // Total memory capacity (Public) + UINT FreePublicMemory; // Free memory capacity (Public) + UINT TotalPrivateMemory; // Total memory capacity (Private) + UINT FreePrivateMemory; // Free memory capacity (Private) + char *HardwareVersion; // Hardware version + char *FirmwareVersion; // Firmware version +}; + +// Secure device structure +struct SECURE +{ + LOCK *lock; // Lock + SECURE_DEVICE *Dev; // Device Information + UINT Error; // The error that last occurred + struct CK_FUNCTION_LIST *Api; // API + bool Initialized; // Initialization flag + UINT NumSlot; // The number of slots + UINT *SlotIdList; // Slot ID list + bool SessionCreated; // Session creation flags + UINT SessionId; // Session ID + UINT SessionSlotNumber; // Slot ID of the session + bool LoginFlag; // Logged-in flag + SEC_INFO *Info; // Token information + LIST *EnumCache; // Enumeration cache + + // Attribute value for the different behavior for each driver + bool IsEPass1000; // ePass 1000 + bool IsReadOnly; // Read-only mode + +#ifdef OS_WIN32 + struct SEC_DATA_WIN32 *Data; // Data +#endif // OS_WIN32 +}; + +// Secure device object structure +struct SEC_OBJ +{ + UINT Type; // Type of object + UINT Object; // Object handle + bool Private; // Private flag + char *Name; // Name +}; + +#define SEC_ERROR_NOERROR 0 // No Error +#define SEC_ERROR_INVALID_SLOT_NUMBER 1 // Slot number is invalid +#define SEC_ERROR_OPEN_SESSION 2 // Session creation failure +#define SEC_ERROR_SESSION_EXISTS 3 // The session already exists +#define SEC_ERROR_NO_PIN_STR 4 // PIN string is not specified +#define SEC_ERROR_ALREADY_LOGIN 5 // Already logged in +#define SEC_ERROR_BAD_PIN_CODE 6 // PIN code is invalid +#define SEC_ERROR_NO_SESSION 7 // There is no session +#define SEC_ERROR_DATA_TOO_BIG 8 // Data is too large +#define SEC_ERROR_NOT_LOGIN 9 // Not logged in +#define SEC_ERROR_BAD_PARAMETER 10 // Invalid Parameters +#define SEC_ERROR_HARDWARE_ERROR 11 // Hardware error +#define SEC_ERROR_OBJ_NOT_FOUND 12 // Object is not found +#define SEC_ERROR_INVALID_CERT 13 // The certificate is invalid + + +#define SEC_DATA 0 // Data +#define SEC_X 1 // Certificate +#define SEC_K 2 // Secret key +#define SEC_P 3 // Public key + + + +// Function prototype +void InitSecure(); +void FreeSecure(); +void InitSecureDeviceList(); +void FreeSecureDeviceList(); +bool IsDeviceSupported(SECURE_DEVICE *dev); +LIST *GetSupportedDeviceList(); +LIST *GetSecureDeviceList(); +bool CheckSecureDeviceId(UINT id); +SECURE_DEVICE *GetSecureDevice(UINT id); +SECURE *OpenSec(UINT id); +void CloseSec(SECURE *sec); +bool OpenSecSession(SECURE *sec, UINT slot_number); +void CloseSecSession(SECURE *sec); +bool LoginSec(SECURE *sec, char *pin); +void LogoutSec(SECURE *sec); +void PrintSecInfo(SECURE *sec); +LIST *EnumSecObject(SECURE *sec); +void FreeSecObject(SEC_OBJ *obj); +void FreeEnumSecObject(LIST *o); +SEC_OBJ *FindSecObject(SECURE *sec, char *name, UINT type); +bool CheckSecObject(SECURE *sec, char *name, UINT type); +bool DeleteSecObjectByName(SECURE *sec, char *name, UINT type); +SEC_OBJ *CloneSecObject(SEC_OBJ *obj); +LIST *CloneEnumSecObject(LIST *o); +void EraseEnumSecObjectCache(SECURE *sec); +void DeleteSecObjFromEnumCache(SECURE *sec, char *name, UINT type); +bool WriteSecData(SECURE *sec, bool private_obj, char *name, void *data, UINT size); +int ReadSecDataFromObject(SECURE *sec, SEC_OBJ *obj, void *data, UINT size); +int ReadSecData(SECURE *sec, char *name, void *data, UINT size); +bool DeleteSecObject(SECURE *sec, SEC_OBJ *obj); +bool DeleteSecData(SECURE *sec, char *name); +void UINT64ToCkDate(void *p_ck_date, UINT64 time64); +bool WriteSecCert(SECURE *sec, bool private_obj, char *name, X *x); +bool DeleteSecCert(SECURE *sec, char *name); +X *ReadSecCertFromObject(SECURE *sec, SEC_OBJ *obj); +X *ReadSecCert(SECURE *sec, char *name); +bool WriteSecKey(SECURE *sec, bool private_obj, char *name, K *k); +bool DeleteSecKey(SECURE *sec, char *name); +bool SignSecByObject(SECURE *sec, SEC_OBJ *obj, void *dst, void *src, UINT size); +bool SignSec(SECURE *sec, char *name, void *dst, void *src, UINT size); +bool ChangePin(SECURE *sec, char *old_pin, char *new_pin); +void TestSec(); +void TestSecMain(SECURE *sec); +bool IsJPKI(bool id); + +bool LoadSecModule(SECURE *sec); +void FreeSecModule(SECURE *sec); +void GetSecInfo(SECURE *sec); +void FreeSecInfo(SECURE *sec); +SEC_INFO *TokenInfoToSecInfo(void *p_t); +void FreeSecInfoMemory(SEC_INFO *s); + +#ifdef OS_WIN32 + +bool Win32IsDeviceSupported(SECURE_DEVICE *dev); +bool Win32LoadSecModule(SECURE *sec); +void Win32FreeSecModule(SECURE *sec); + +#endif // OS_WIN32 + + +#ifdef SECURE_C +// Internal data structure +// The list of supported secure devices +static LIST *SecureDeviceList = NULL; + +// Supported hardware list +SECURE_DEVICE SupportedList[] = +{ + {1, SECURE_IC_CARD, "Standard-9 IC Card", "Dai Nippon Printing", "DNPS9P11.DLL"}, + {2, SECURE_USB_TOKEN, "ePass 1000", "Feitian Technologies", "EP1PK111.DLL"}, + {3, SECURE_IC_CARD, "DNP Felica", "Dai Nippon Printing", "DNPFP11.DLL"}, + {4, SECURE_USB_TOKEN, "eToken", "Aladdin", "ETPKCS11.DLL"}, + {5, SECURE_IC_CARD, "Standard-9 IC Card", "Fujitsu", "F3EZSCL2.DLL"}, + {6, SECURE_IC_CARD, "ASECard", "Athena", "ASEPKCS.DLL"}, + {7, SECURE_IC_CARD, "Gemplus IC Card", "Gemplus", "PK2PRIV.DLL"}, + {8, SECURE_IC_CARD, "1-Wire & iButton", "DALLAS SEMICONDUCTOR", "DSPKCS.DLL"}, + {9, SECURE_IC_CARD, "JPKI IC Card", "Japanese Government", "JPKIPKCS11.DLL"}, + {10, SECURE_IC_CARD, "LGWAN IC Card", "Japanese Government", "P11STD9.DLL"}, + {11, SECURE_IC_CARD, "LGWAN IC Card", "Japanese Government", "P11STD9A.DLL"}, + {12, SECURE_USB_TOKEN, "iKey 1000", "Rainbow Technologies", "K1PK112.DLL"}, + {13, SECURE_IC_CARD, "JPKI IC Card #2", "Japanese Government", "libmusclepkcs11.dll"}, + {14, SECURE_USB_TOKEN, "SafeSign", "A.E.T.", "aetpkss1.dll"}, + {15, SECURE_USB_TOKEN, "LOCK STAR-PKI", "Logicaltech Co.,LTD", "LTPKCS11.dll"}, + {16, SECURE_USB_TOKEN, "ePass 2000", "Feitian Technologies", "ep2pk11.dll"}, + {17, SECURE_IC_CARD, "myuToken", "iCanal Inc.", "icardmodpk.dll"}, + {18, SECURE_IC_CARD, "Gemalto .NET", "Gemalto", "gtop11dotnet.dll"}, + {19, SECURE_IC_CARD, "Gemalto .NET 64bit", "Gemalto", "gtop11dotnet64.dll"}, + {20, SECURE_USB_TOKEN, "ePass 2003", "Feitian Technologies", "eps2003csp11.dll"}, + {21, SECURE_USB_TOKEN, "ePass 1000ND/2000/3000", "Feitian Technologies", "ngp11v211.dll"}, + {22, SECURE_USB_TOKEN, "CryptoID", "Longmai Technology", "cryptoide_pkcs11.dll"}, + {23, SECURE_USB_TOKEN, "RuToken", "Aktiv Co.", "rtPKCS11.dll"}, +}; + +#ifdef OS_WIN32 + +// Win32 internal data +typedef struct SEC_DATA_WIN32 +{ + HINSTANCE hInst; +} SEC_DATA_WIN32; + +#endif // OS_WIN32 + +#endif // SECURE_C + +#endif // SECURE_H diff --git a/src/Mayaqua/Str.c b/src/Mayaqua/Str.c index f44efa67..ee884789 100644 --- a/src/Mayaqua/Str.c +++ b/src/Mayaqua/Str.c @@ -1,5090 +1,5090 @@ -// SoftEther VPN Source Code - Developer Edition Master Branch -// Mayaqua Kernel - - -// Str.c -// String processing routine - -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include - -// Locking for call the token handling function -LOCK *token_lock = NULL; -static char *default_spliter = " ,\t\r\n"; - -typedef struct BYTESTR -{ - UINT64 base_value; - char *string; -} BYTESTR; - -static BYTESTR bytestr[] = -{ - {0, "PBytes"}, - {0, "TBytes"}, - {0, "GBytes"}, - {0, "MBytes"}, - {0, "KBytes"}, - {0, "Bytes"}, -}; - -// Decode URL string -char *UrlDecode(char *url_str) -{ - UINT i, len; - BUF *b; - char *ret; - if (url_str == NULL) - { - return NULL; - } - - len = StrLen(url_str); - - b = NewBuf(); - - for (i = 0;i < len;i++) - { - char c = url_str[i]; - - if (c == '%' && ((i + 2) < len)) - { - char hex_str[8]; - UINT value; - - hex_str[0] = url_str[i + 1]; - hex_str[1] = url_str[i + 2]; - hex_str[2] = 0; - - value = HexToInt(hex_str); - - WriteBufChar(b, (UCHAR)value); - - i += 2; - continue; - } - else - { - if (c == '+') - { - c = ' '; - } - WriteBufChar(b, c); - } - } - - WriteBufChar(b, 0); - - ret = CopyStr(b->Buf); - - FreeBuf(b); - - return ret; -} - -// Change the case of the string by the bit array -void SetStrCaseAccordingToBits(char *str, UINT bits) -{ - UINT i, len; - // Validate arguments - if (str == NULL) - { - return; - } - - len = StrLen(str); - - for (i = 0;i < len;i++) - { - char c = str[i]; - - if (bits & 0x01) - { - c = ToUpper(c); - } - else - { - c = ToLower(c); - } - - str[i] = c; - - bits = bits / 2; - } -} - -// Normalize the integer list string -void NormalizeIntListStr(char *dst, UINT dst_size, char *src, bool sorted, char *separate_str) -{ - LIST *o; - - o = StrToIntList(src, sorted); - - IntListToStr(dst, dst_size, o, separate_str); - - ReleaseIntList(o); -} - -// Convert the string to an integer list -LIST *StrToIntList(char *str, bool sorted) -{ - LIST *o; - TOKEN_LIST *t; - - o = NewIntList(sorted); - - t = ParseTokenWithoutNullStr(str, " ,/;\t"); - - if (t != NULL) - { - UINT i; - - for (i = 0;i < t->NumTokens;i++) - { - char *s = t->Token[i]; - - if (IsEmptyStr(s) == false) - { - if (IsNum(s)) - { - InsertIntDistinct(o, ToInt(s)); - } - } - } - - FreeToken(t); - } - - return o; -} - -// Convert an integer list to a string -void IntListToStr(char *str, UINT str_size, LIST *o, char *separate_str) -{ - UINT i; - ClearStr(str, str_size); - // Validate arguments - if (o == NULL) - { - return; - } - if (IsEmptyStr(separate_str)) - { - separate_str = ", "; - } - - for (i = 0;i < LIST_NUM(o);i++) - { - char tmp[MAX_SIZE]; - UINT *v = LIST_DATA(o, i); - - ToStr(tmp, *v); - - StrCat(str, str_size, tmp); - - if (i != (LIST_NUM(o) - 1)) - { - StrCat(str, str_size, separate_str); - } - } -} - -// Initialize the string -void ClearStr(char *str, UINT str_size) -{ - StrCpy(str, str_size, ""); -} - -// Search for the ASCII string in the binary data sequence -UINT SearchAsciiInBinary(void *data, UINT size, char *str, bool case_sensitive) -{ - UINT ret = INFINITE; - char *tmp; - // Validate arguments - if (data == NULL || size == 0 || str == NULL) - { - return INFINITE; - } - - tmp = ZeroMalloc(size + 1); - Copy(tmp, data, size); - - ret = SearchStrEx(tmp, str, 0, case_sensitive); - - Free(tmp); - - return ret; -} - -// Convert the HEX string to a 32 bit integer -UINT HexToInt(char *str) -{ - UINT len, i; - UINT ret = 0; - // Validate arguments - if (str == NULL) - { - return 0; - } - - if (str[0] == '0' && (str[1] == 'x' || str[1] == 'X')) - { - str += 2; - } - - len = StrLen(str); - for (i = 0;i < len;i++) - { - char c = str[i]; - - if ((c >= '0' && c <= '9') || (c >= 'a' && c <= 'f') || (c >= 'A' && c <= 'F')) - { - ret = ret * 16 + (UINT)HexTo4Bit(c); - } - else - { - break; - } - } - - return ret; -} - -// Convert a 32 bit integer into HEX -void ToHex(char *str, UINT value) -{ - char tmp[MAX_SIZE]; - UINT wp = 0; - UINT len, i; - // Validate arguments - if (str == NULL) - { - return; - } - - // Set to empty character - StrCpy(tmp, 0, ""); - - // Append from the last digit - while (true) - { - UINT a = (UINT)(value % (UINT)16); - value = value / (UINT)16; - tmp[wp++] = FourBitToHex(a); - if (value == 0) - { - tmp[wp++] = 0; - break; - } - } - - // Reverse order - len = StrLen(tmp); - for (i = 0;i < len;i++) - { - str[len - i - 1] = tmp[i]; - } - str[len] = 0; -} - -// Converts a 4 bit value to hexadecimal string -char FourBitToHex(UINT value) -{ - value = value % 16; - - if (value <= 9) - { - return '0' + value; - } - else - { - return 'a' + (value - 10); - } -} - -// Convert a hexadecimal string to a 4 bit integer -UINT HexTo4Bit(char c) -{ - if ('0' <= c && c <= '9') - { - return c - '0'; - } - else if ('a' <= c && c <= 'f') - { - return c - 'a' + 10; - } - else if ('A' <= c && c <= 'F') - { - return c - 'A' + 10; - } - else - { - return 0; - } -} - -// Get a standard token delimiter -char *DefaultTokenSplitChars() -{ - return " ,\t\r\n"; -} - -// Check whether the specified character is in the string -bool IsCharInStr(char *str, char c) -{ - UINT i, len; - // Validate arguments - if (str == NULL) - { - return false; - } - - len = StrLen(str); - for (i = 0;i < len;i++) - { - if (str[i] == c) - { - return true; - } - } - - return false; -} - -// Cut out the token from the string (not ignore the blanks between delimiters) -TOKEN_LIST *ParseTokenWithNullStr(char *str, char *split_chars) -{ - LIST *o; - UINT i, len; - BUF *b; - char zero = 0; - TOKEN_LIST *t; - // Validate arguments - if (str == NULL) - { - return NullToken(); - } - if (split_chars == NULL) - { - split_chars = DefaultTokenSplitChars(); - } - - b = NewBuf(); - o = NewListFast(NULL); - - len = StrLen(str); - - for (i = 0;i < (len + 1);i++) - { - char c = str[i]; - bool flag = IsCharInStr(split_chars, c); - - if (c == '\0') - { - flag = true; - } - - if (flag == false) - { - WriteBuf(b, &c, sizeof(char)); - } - else - { - WriteBuf(b, &zero, sizeof(char)); - - Insert(o, CopyStr((char *)b->Buf)); - ClearBuf(b); - } - } - - t = ZeroMalloc(sizeof(TOKEN_LIST)); - t->NumTokens = LIST_NUM(o); - t->Token = ZeroMalloc(sizeof(char *) * t->NumTokens); - - for (i = 0;i < t->NumTokens;i++) - { - t->Token[i] = LIST_DATA(o, i); - } - - ReleaseList(o); - FreeBuf(b); - - return t; -} - -// Check whether the string contains at least one of the specified tokens -bool InStrList(char *target_str, char *tokens, char *splitter, bool case_sensitive) -{ - TOKEN_LIST *t; - bool ret = false; - UINT i; - // Validate arguments - if (target_str == NULL || tokens == NULL || splitter == NULL) - { - return false; - } - - t = ParseTokenWithoutNullStr(tokens, splitter); - - if (t != NULL) - { - for (i = 0;i < t->NumTokens;i++) - { - if (InStrEx(target_str, t->Token[i], case_sensitive)) - { - ret = true; -// printf("%s\n", t->Token[i]); - } - - if (ret) - { - break; - } - } - - FreeToken(t); - } - - return ret; -} - -// Cut out the token from string (Ignore blanks between delimiters) -TOKEN_LIST *ParseTokenWithoutNullStr(char *str, char *split_chars) -{ - LIST *o; - UINT i, len; - bool last_flag; - BUF *b; - char zero = 0; - TOKEN_LIST *t; - // Validate arguments - if (str == NULL) - { - return NullToken(); - } - if (split_chars == NULL) - { - split_chars = DefaultTokenSplitChars(); - } - - b = NewBuf(); - o = NewListFast(NULL); - - len = StrLen(str); - last_flag = false; - - for (i = 0;i < (len + 1);i++) - { - char c = str[i]; - bool flag = IsCharInStr(split_chars, c); - - if (c == '\0') - { - flag = true; - } - - if (flag == false) - { - WriteBuf(b, &c, sizeof(char)); - } - else - { - if (last_flag == false) - { - WriteBuf(b, &zero, sizeof(char)); - - if ((StrLen((char *)b->Buf)) != 0) - { - Insert(o, CopyStr((char *)b->Buf)); - } - ClearBuf(b); - } - } - - last_flag = flag; - } - - t = ZeroMalloc(sizeof(TOKEN_LIST)); - t->NumTokens = LIST_NUM(o); - t->Token = ZeroMalloc(sizeof(char *) * t->NumTokens); - - for (i = 0;i < t->NumTokens;i++) - { - t->Token[i] = LIST_DATA(o, i); - } - - ReleaseList(o); - FreeBuf(b); - - return t; -} - -// Check whether the string is included -bool InStr(char *str, char *keyword) -{ - return InStrEx(str, keyword, false); -} -bool InStrEx(char *str, char *keyword, bool case_sensitive) -{ - // Validate arguments - if (IsEmptyStr(str) || IsEmptyStr(keyword)) - { - return false; - } - - if (SearchStrEx(str, keyword, 0, case_sensitive) == INFINITE) - { - return false; - } - - return true; -} - -// Get a value from the INI -UINT IniIntValue(LIST *o, char *key) -{ - INI_ENTRY *e; - // Validate arguments - if (o == NULL || key == NULL) - { - return 0; - } - - e = GetIniEntry(o, key); - if (e == NULL) - { - return 0; - } - - return ToInt(e->Value); -} -char *IniStrValue(LIST *o, char *key) -{ - INI_ENTRY *e; - // Validate arguments - if (o == NULL || key == NULL) - { - return 0; - } - - e = GetIniEntry(o, key); - if (e == NULL) - { - return ""; - } - - return e->Value; -} - -// Release the INI -void FreeIni(LIST *o) -{ - UINT i; - // Validate arguments - if (o == NULL) - { - return; - } - - for (i = 0;i < LIST_NUM(o);i++) - { - INI_ENTRY *e = LIST_DATA(o, i); - - Free(e->Key); - Free(e->Value); - Free(e->UnicodeValue); - - Free(e); - } - - ReleaseList(o); -} - -// Get an entry in the INI file -INI_ENTRY *GetIniEntry(LIST *o, char *key) -{ - UINT i; - // Validate arguments - if (o == NULL || key == NULL) - { - return NULL; - } - - for (i = 0;i < LIST_NUM(o);i++) - { - INI_ENTRY *e = LIST_DATA(o, i); - - if (StrCmpi(e->Key, key) == 0) - { - return e; - } - } - - return NULL; -} - -// Read an INI file -LIST *ReadIni(BUF *b) -{ - LIST *o; - // Validate arguments - if (b == NULL) - { - return NULL; - } - - o = NewListFast(NULL); - - SeekBuf(b, 0, 0); - - while (true) - { - char *line = CfgReadNextLine(b); - - if (line == NULL) - { - break; - } - - Trim(line); - - if (IsEmptyStr(line) == false) - { - if (StartWith(line, "#") == false && - StartWith(line, "//") == false && - StartWith(line, ";") == false) - { - char *key, *value; - UINT size = StrLen(line) + 1; - - key = ZeroMalloc(size); - value = ZeroMalloc(size); - - if (GetKeyAndValue(line, key, size, value, size, NULL)) - { - UINT uni_size; - INI_ENTRY *e = ZeroMalloc(sizeof(INI_ENTRY)); - e->Key = CopyStr(key); - e->Value = CopyStr(value); - - uni_size = CalcUtf8ToUni((BYTE *)value, StrLen(value)); - e->UnicodeValue = ZeroMalloc(uni_size); - Utf8ToUni(e->UnicodeValue, uni_size, (BYTE *)value, StrLen(value)); - - Add(o, e); - } - - Free(key); - Free(value); - } - } - - Free(line); - } - - return o; -} - -// Check whether the specified character is a delimiter -bool IsSplitChar(char c, char *split_str) -{ - UINT i, len; - char c_upper = ToUpper(c); - if (split_str == NULL) - { - split_str = default_spliter; - } - - len = StrLen(split_str); - - for (i = 0;i < len;i++) - { - if (ToUpper(split_str[i]) == c_upper) - { - return true; - } - } - - return false; -} - -// Get the keys and the value from the string -bool GetKeyAndValue(char *str, char *key, UINT key_size, char *value, UINT value_size, char *split_str) -{ - UINT mode = 0; - UINT wp1 = 0, wp2 = 0; - UINT i, len; - char *key_tmp, *value_tmp; - bool ret = false; - if (split_str == NULL) - { - split_str = default_spliter; - } - - len = StrLen(str); - - key_tmp = ZeroMalloc(len + 1); - value_tmp = ZeroMalloc(len + 1); - - for (i = 0;i < len;i++) - { - char c = str[i]; - - switch (mode) - { - case 0: - if (IsSplitChar(c, split_str) == false) - { - mode = 1; - key_tmp[wp1] = c; - wp1++; - } - break; - - case 1: - if (IsSplitChar(c, split_str) == false) - { - key_tmp[wp1] = c; - wp1++; - } - else - { - mode = 2; - } - break; - - case 2: - if (IsSplitChar(c, split_str) == false) - { - mode = 3; - value_tmp[wp2] = c; - wp2++; - } - break; - - case 3: - value_tmp[wp2] = c; - wp2++; - break; - } - } - - if (mode != 0) - { - ret = true; - StrCpy(key, key_size, key_tmp); - StrCpy(value, value_size, value_tmp); - } - - Free(key_tmp); - Free(value_tmp); - - return ret; -} - -// Generate a sequence of specified character -char *MakeCharArray(char c, UINT count) -{ - UINT i; - char *ret = Malloc(count + 1); - - for (i = 0;i < count;i++) - { - ret[i] = c; - } - - ret[count] = 0; - - return ret; -} -void MakeCharArray2(char *str, char c, UINT count) -{ - UINT i; - - for (i = 0;i < count;i++) - { - str[i] = c; - } - - str[count] = 0; -} - -// Get the width of the specified string -UINT StrWidth(char *str) -{ - wchar_t *s; - UINT ret; - // Validate arguments - if (str == NULL) - { - return 0; - } - - s = CopyStrToUni(str); - ret = UniStrWidth(s); - Free(s); - - return ret; -} - -// Check whether the specified string is all uppercase -bool IsAllUpperStr(char *str) -{ - UINT i, len; - // Validate arguments - if (str == NULL) - { - return false; - } - - len = StrLen(str); - - for (i = 0;i < len;i++) - { - char c = str[i]; - - if ((c >= '0' && c <= '9') || - (c >= 'A' && c <= 'Z')) - { - } - else - { - return false; - } - } - - return true; -} - -// Remove duplications from the token list -TOKEN_LIST *UniqueToken(TOKEN_LIST *t) -{ - UINT i, num, j, n; - TOKEN_LIST *ret; - // Validate arguments - if (t == NULL) - { - return NULL; - } - - num = 0; - for (i = 0;i < t->NumTokens;i++) - { - bool exists = false; - - for (j = 0;j < i;j++) - { - if (StrCmpi(t->Token[j], t->Token[i]) == 0) - { - exists = true; - break; - } - } - - if (exists == false) - { - num++; - } - } - - ret = ZeroMalloc(sizeof(TOKEN_LIST)); - ret->Token = ZeroMalloc(sizeof(char *) * num); - ret->NumTokens = num; - - n = 0; - - for (i = 0;i < t->NumTokens;i++) - { - bool exists = false; - - for (j = 0;j < i;j++) - { - if (StrCmpi(t->Token[j], t->Token[i]) == 0) - { - exists = true; - break; - } - } - - if (exists == false) - { - ret->Token[n++] = CopyStr(t->Token[i]); - } - } - - return ret; -} - -// Convert a value to a byte string (by 1,000) -void ToStrByte1000(char *str, UINT size, UINT64 v) -{ - UINT i; - // Validate arguments - if (str == NULL) - { - return; - } - - // Warning measures in gcc - bytestr[0].base_value = 1000000000UL; - bytestr[0].base_value *= 1000UL; - bytestr[0].base_value *= 1000UL; - bytestr[1].base_value = 1000000000UL; - bytestr[1].base_value *= 1000UL; - bytestr[2].base_value = 1000000000UL; - bytestr[3].base_value = 1000000UL; - bytestr[4].base_value = 1000UL; - bytestr[5].base_value = 0UL; - - for (i = 0;i < sizeof(bytestr) / sizeof(bytestr[0]);i++) - { - BYTESTR *b = &bytestr[i]; - - if ((v * 11UL) / 10UL >= b->base_value) - { - if (b->base_value != 0) - { - double d = (double)v / (double)b->base_value; - Format(str, size, "%.2f %s", d, b->string); - } - else - { - Format(str, size, "%I64u %s", v, b->string); - } - - break; - } - } -} - -// Convert a value to a byte string -void ToStrByte(char *str, UINT size, UINT64 v) -{ - UINT i; - // Validate arguments - if (str == NULL) - { - return; - } - - // Warning measures in gcc - bytestr[0].base_value = 1073741824UL; - bytestr[0].base_value *= 1024UL; - bytestr[0].base_value *= 1024UL; - bytestr[1].base_value = 1073741824UL; - bytestr[1].base_value *= 1024UL; - bytestr[2].base_value = 1073741824UL; - bytestr[3].base_value = 1048576UL; - bytestr[4].base_value = 1024UL; - bytestr[5].base_value = 0UL; - - for (i = 0;i < sizeof(bytestr) / sizeof(bytestr[0]);i++) - { - BYTESTR *b = &bytestr[i]; - - if ((v * 11UL) / 10UL >= b->base_value) - { - if (b->base_value != 0) - { - double d = (double)v / (double)b->base_value; - Format(str, size, "%.2f %s", d, b->string); - } - else - { - Format(str, size, "%I64u %s", v, b->string); - } - - break; - } - } -} - -// Convert the number to a string, and separate it with commas by three orders of magnitude -void ToStr3(char *str, UINT size, UINT64 v) -{ - char tmp[128]; - char tmp2[128]; - UINT i, len, wp; - // Validate arguments - if (str == NULL) - { - return; - } - - ToStr64(tmp, v); - - wp = 0; - len = StrLen(tmp); - - for (i = len - 1;((int)i) >= 0;i--) - { - tmp2[wp++] = tmp[i]; - } - tmp2[wp++] = 0; - - wp = 0; - - for (i = 0;i < len;i++) - { - if (i != 0 && (i % 3) == 0) - { - tmp[wp++] = ','; - } - tmp[wp++] = tmp2[i]; - } - tmp[wp++] = 0; - wp = 0; - len = StrLen(tmp); - - for (i = len - 1;((int)i) >= 0;i--) - { - tmp2[wp++] = tmp[i]; - } - tmp2[wp++] = 0; - - StrCpy(str, size, tmp2); -} - -// Convert the MAC address to a string -void MacToStr(char *str, UINT size, UCHAR *mac_address) -{ - // Validate arguments - if (str == NULL || mac_address == NULL) - { - return; - } - - Format(str, size, "%02X-%02X-%02X-%02X-%02X-%02X", - mac_address[0], - mac_address[1], - mac_address[2], - mac_address[3], - mac_address[4], - mac_address[5]); -} - -// Examine whether the string is empty -bool IsEmptyStr(char *str) -{ - char *s; - // Validate arguments - if (str == NULL) - { - return true; - } - - s = CopyStr(str); - Trim(s); - - if (StrLen(s) == 0) - { - Free(s); - return true; - } - else - { - Free(s); - return false; - } -} - -// Convert a string list to a token list -TOKEN_LIST *ListToTokenList(LIST *o) -{ - UINT i; - TOKEN_LIST *t; - // Validate arguments - if (o == NULL) - { - return NULL; - } - - t = ZeroMalloc(sizeof(TOKEN_LIST)); - t->NumTokens = LIST_NUM(o); - t->Token = ZeroMalloc(sizeof(char *) * t->NumTokens); - for (i = 0;i < LIST_NUM(o);i++) - { - t->Token[i] = CopyStr(LIST_DATA(o, i)); - } - - return t; -} - -// Free the string list -void FreeStrList(LIST *o) -{ - UINT i; - // Validate arguments - if (o == NULL) - { - return; - } - - for (i = 0;i < LIST_NUM(o);i++) - { - char *s = LIST_DATA(o, i); - Free(s); - } - - ReleaseList(o); -} - -// Convert a (NULL delimited) string to a list -LIST *StrToStrList(char *str, UINT size) -{ - LIST *o; - char *tmp; - UINT tmp_size; - UINT i; - // Validate arguments - if (str == NULL) - { - return NULL; - } - - o = NewListFast(NULL); - - i = 0; - while (true) - { - if (i >= size) - { - break; - } - if (*str == 0) - { - break; - } - - tmp_size = StrSize(str); - tmp = ZeroMalloc(tmp_size); - StrCpy(tmp, tmp_size, str); - Add(o, tmp); - str += StrLen(str) + 1; - i++; - } - - return o; -} - -// Check whether the specified string is a number -bool IsNum(char *str) -{ - char c; - UINT i, len; - UINT n = 0; - char tmp[MAX_SIZE]; - TOKEN_LIST *t; - // Validate arguments - if (str == NULL) - { - return false; - } - - StrCpy(tmp, sizeof(tmp), str); - Trim(tmp); - - if (StrLen(tmp) == 0) - { - return false; - } - - t = ParseToken(tmp, " "); - - if (t->NumTokens >= 1) - { - StrCpy(tmp, sizeof(tmp), t->Token[0]); - } - - FreeToken(t); - - len = StrLen(tmp); - for (i = 0;i < len;i++) - { - bool b = false; - c = tmp[i]; - if (('0' <= c && c <= '9') || (c == '+') || (c == '-') || (c == ',')) - { - b = true; - } - - if (b == false) - { - return false; - } - } - - for (i = 0;i < len;i++) - { - c = tmp[i]; - if (c == '-') - { - n++; - } - } - if (n >= 2) - { - return false; - } - - return true; -} - -// Empty token list -TOKEN_LIST *NullToken() -{ - TOKEN_LIST *ret = ZeroMalloc(sizeof(TOKEN_LIST)); - ret->Token = ZeroMalloc(0); - - return ret; -} - -// Copy the token list -TOKEN_LIST *CopyToken(TOKEN_LIST *src) -{ - TOKEN_LIST *ret; - UINT i; - // Validate arguments - if (src == NULL) - { - return NULL; - } - - ret = ZeroMalloc(sizeof(TOKEN_LIST)); - ret->NumTokens = src->NumTokens; - ret->Token = ZeroMalloc(sizeof(char *) * ret->NumTokens); - for (i = 0;i < ret->NumTokens;i++) - { - ret->Token[i] = CopyStr(src->Token[i]); - } - - return ret; -} - -// Parse the command line -TOKEN_LIST *ParseCmdLine(char *str) -{ - TOKEN_LIST *t; - LIST *o; - UINT i, len, wp, mode; - char c; - char *tmp; - bool ignore_space = false; - // Validate arguments - if (str == NULL) - { - // There is no token - return NullToken(); - } - - o = NewListFast(NULL); - tmp = Malloc(StrSize(str) + 32); - - wp = 0; - mode = 0; - - len = StrLen(str); - for (i = 0;i < len;i++) - { - c = str[i]; - - switch (mode) - { - case 0: - // Mode to discover the next token - if (c == ' ' || c == '\t') - { - // Advance to the next character - } - else - { - // Start of the token - if (c == '\"') - { - if (str[i + 1] == '\"') - { - // Regard "" as a single " - tmp[wp++] = '\"'; - i++; - } - else - { - // Enable the ignoring space flag for a single " - ignore_space = true; - } - } - else - { - tmp[wp++] = c; - } - - mode = 1; - } - break; - - case 1: - if (ignore_space == false && (c == ' ' || c == '\t')) - { - // End of the token - tmp[wp++] = 0; - wp = 0; - - Insert(o, CopyStr(tmp)); - mode = 0; - } - else - { - if (c == '\"') - { - if (str[i + 1] == '\"') - { - // Regard "" as a single " - tmp[wp++] = L'\"'; - i++; - } - else - { - if (ignore_space == false) - { - // Enable the ignoring space flag for a single " - ignore_space = true; - } - else - { - // Disable the space ignore flag - ignore_space = false; - } - } - } - else - { - tmp[wp++] = c; - } - } - break; - } - } - - if (wp != 0) - { - tmp[wp++] = 0; - Insert(o, CopyStr(tmp)); - } - - Free(tmp); - - t = ZeroMalloc(sizeof(TOKEN_LIST)); - t->NumTokens = LIST_NUM(o); - t->Token = ZeroMalloc(sizeof(char *) * t->NumTokens); - for (i = 0;i < t->NumTokens;i++) - { - t->Token[i] = LIST_DATA(o, i); - } - - ReleaseList(o); - - return t; -} - -// Convert a 64-bit integer to a string -void ToStr64(char *str, UINT64 value) -{ - char tmp[MAX_SIZE]; - UINT wp = 0; - UINT len, i; - // Validate arguments - if (str == NULL) - { - return; - } - - // Set to empty character - StrCpy(tmp, 0, ""); - - // Append from the last digit - while (true) - { - UINT a = (UINT)(value % (UINT64)10); - value = value / (UINT64)10; - tmp[wp++] = (char)('0' + a); - if (value == 0) - { - tmp[wp++] = 0; - break; - } - } - - // Reverse order - len = StrLen(tmp); - for (i = 0;i < len;i++) - { - str[len - i - 1] = tmp[i]; - } - str[len] = 0; -} - -// Convert a string to a 64-bit integer -UINT64 ToInt64(char *str) -{ - UINT len, i; - UINT64 ret = 0; - // Validate arguments - if (str == NULL) - { - return 0; - } - - len = StrLen(str); - for (i = 0;i < len;i++) - { - char c = str[i]; - if (c != ',') - { - if ('0' <= c && c <= '9') - { - ret = ret * (UINT64)10 + (UINT64)(c - '0'); - } - else - { - break; - } - } - } - - return ret; -} - - -UINT64 Json_ToInt64Ex(char *str, char **endptr, bool *error) -{ - UINT i; - UINT64 ret = 0; - if (error != NULL) *error = true; - // Validate arguments - if (str == NULL) - { - if (endptr != NULL) - { - *endptr = NULL; - } - return 0; - } - - for (i = 0;;i++) - { - char c = str[i]; - if (endptr != NULL) - { - *endptr = &str[i]; - } - if (c == 0) - { - break; - } - if ('0' <= c && c <= '9') - { - ret = ret * (UINT64)10 + (UINT64)(c - '0'); - if (error != NULL) *error = false; - } - else - { - break; - } - } - - return ret; -} - -// Trim EndWith -bool TrimEndWith(char *dst, UINT dst_size, char *str, char *key) -{ - if (dst == NULL || str == NULL) - { - ClearStr(dst, dst_size); - return false; - } - - StrCpy(dst, dst_size, str); - - if (EndWith(str, key)) - { - UINT src_len = StrLen(str); - UINT key_len = StrLen(key); - - if (src_len >= key_len) - { - dst[src_len - key_len] = 0; - } - - return true; - } - - return false; -} - -// Check whether the str ends with the key -bool EndWith(char *str, char *key) -{ - UINT str_len; - UINT key_len; - // Validate arguments - if (str == NULL || key == NULL) - { - return false; - } - - // Comparison - str_len = StrLen(str); - key_len = StrLen(key); - if (str_len < key_len) - { - return false; - } - - if (StrCmpi(str + (str_len - key_len), key) == 0) - { - return true; - } - else - { - return false; - } -} - -// Check whether the str starts with the key -bool StartWith(char *str, char *key) -{ - UINT str_len; - UINT key_len; - char *tmp; - bool ret; - // Validate arguments - if (str == NULL || key == NULL) - { - return false; - } - - // Comparison - str_len = StrLen(str); - key_len = StrLen(key); - if (str_len < key_len) - { - return false; - } - if (str_len == 0 || key_len == 0) - { - return false; - } - tmp = CopyStr(str); - tmp[key_len] = 0; - - if (StrCmpi(tmp, key) == 0) - { - ret = true; - } - else - { - ret = false; - } - - Free(tmp); - - return ret; -} - -// Display the binary data -void PrintBin(void *data, UINT size) -{ - char *tmp; - UINT i; - // Validate arguments - if (data == NULL) - { - return; - } - - i = size * 3 + 1; - tmp = Malloc(i); - BinToStrEx(tmp, i, data, size); - Print("%s\n", tmp); - Free(tmp); -} - -// Convert the string to a MAC address -bool StrToMac(UCHAR *mac_address, char *str) -{ - BUF *b; - // Validate arguments - if (mac_address == NULL || str == NULL) - { - return false; - } - - b = StrToBin(str); - if (b == NULL) - { - return false; - } - - if (b->Size != 6) - { - FreeBuf(b); - return false; - } - - Copy(mac_address, b->Buf, 6); - - FreeBuf(b); - - return true; -} - -// Convert a hexadecimal string to a binary data -BUF *StrToBin(char *str) -{ - BUF *b; - UINT len, i; - char tmp[3]; - // Validate arguments - if (str == NULL) - { - return NULL; - } - - len = StrLen(str); - tmp[0] = 0; - b = NewBuf(); - for (i = 0;i < len;i++) - { - char c = str[i]; - c = ToUpper(c); - if (('0' <= c && c <= '9') || ('A' <= c && c <= 'F')) - { - if (tmp[0] == 0) - { - tmp[0] = c; - tmp[1] = 0; - } - else if (tmp[1] == 0) - { - UCHAR data; - char tmp2[64]; - tmp[1] = c; - tmp[2] = 0; - StrCpy(tmp2, sizeof(tmp2), "0x"); - StrCat(tmp2, sizeof(tmp2), tmp); - data = (UCHAR)strtoul(tmp2, NULL, 0); - WriteBuf(b, &data, 1); - Zero(tmp, sizeof(tmp)); - } - } - else if (c == ' ' || c == ',' || c == '-' || c == ':') - { - // Do Nothing - } - else - { - break; - } - } - - return b; -} - -// Convert the binary data to a hexadecimal string (with space) -void BinToStrEx(char *str, UINT str_size, void *data, UINT data_size) -{ - char *tmp; - UCHAR *buf = (UCHAR *)data; - UINT size; - UINT i; - // Validate arguments - if (str == NULL || data == NULL) - { - return; - } - - // Calculation of size - size = data_size * 3 + 1; - // Memory allocation - tmp = ZeroMalloc(size); - // Conversion - for (i = 0;i < data_size;i++) - { - Format(&tmp[i * 3], 0, "%02X ", buf[i]); - } - Trim(tmp); - // Copy - StrCpy(str, str_size, tmp); - // Memory release - Free(tmp); -} -void BinToStrEx2(char *str, UINT str_size, void *data, UINT data_size, char padding_char) -{ - char *tmp; - UCHAR *buf = (UCHAR *)data; - UINT size; - UINT i; - // Validate arguments - if (str == NULL || data == NULL) - { - return; - } - - // Calculation of size - size = data_size * 3 + 1; - // Memory allocation - tmp = ZeroMalloc(size); - // Conversion - for (i = 0;i < data_size;i++) - { - Format(&tmp[i * 3], 0, "%02X%c", buf[i], padding_char); - } - if (StrLen(tmp) >= 1) - { - if (tmp[StrLen(tmp) - 1] == padding_char) - { - tmp[StrLen(tmp) - 1] = 0; - } - } - // Copy - StrCpy(str, str_size, tmp); - // Memory release - Free(tmp); -} -// Convert the binary data to a string, and copy it -char *CopyBinToStrEx(void *data, UINT data_size) -{ - char *ret; - UINT size; - // Validate arguments - if (data == NULL) - { - return NULL; - } - - size = data_size * 3 + 1; - ret = ZeroMalloc(size); - - BinToStrEx(ret, size, data, data_size); - - return ret; -} -char *CopyBinToStr(void *data, UINT data_size) -{ - char *ret; - UINT size; - // Validate arguments - if (data == NULL) - { - return NULL; - } - - size = data_size * 2 + 1; - ret = ZeroMalloc(size); - - BinToStr(ret, size, data, data_size); - - return ret; -} - -// Convert the binary data to a hexadecimal string -void BinToStr(char *str, UINT str_size, void *data, UINT data_size) -{ - char *tmp; - UCHAR *buf = (UCHAR *)data; - UINT size; - UINT i; - // Validate arguments - if (str == NULL || data == NULL) - { - if (str != NULL) - { - str[0] = 0; - } - return; - } - - // Calculation of size - size = data_size * 2 + 1; - // Memory allocation - tmp = ZeroMalloc(size); - // Conversion - for (i = 0;i < data_size;i++) - { - sprintf(&tmp[i * 2], "%02X", buf[i]); - } - // Copy - StrCpy(str, str_size, tmp); - // Memory release - Free(tmp); -} -void BinToStrW(wchar_t *str, UINT str_size, void *data, UINT data_size) -{ - char *tmp; - UINT tmp_size; - // Validate arguments - if (str == NULL || data == NULL) - { - if (str != NULL) - { - str[0] = 0; - } - return; - } - - tmp_size = (data_size * 2 + 4) * sizeof(wchar_t); - tmp = ZeroMalloc(tmp_size); - - BinToStr(tmp, tmp_size, data, data_size); - - StrToUni(str, str_size, tmp); - - Free(tmp); -} - -// Convert a 160-bit sequence into a string -void Bit160ToStr(char *str, UCHAR *data) -{ - // Validate arguments - if (str == NULL || data == NULL) - { - return; - } - - Format(str, 0, - "%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X", - data[0], data[1], data[2], data[3], data[4], data[5], data[6], data[7], data[8], data[9], - data[10], data[11], data[12], data[13], data[14], data[15], data[16], data[17], data[18], data[19]); -} - -// Copy a string -char *CopyStr(char *str) -{ - UINT len; - char *dst; - // Validate arguments - if (str == NULL) - { - return NULL; - } - - len = StrLen(str); - dst = Malloc(len + 1); - StrCpy(dst, len + 1, str); - return dst; -} - -// Check whether the string is safe -bool IsSafeStr(char *str) -{ - UINT i, len; - // Validate arguments - if (str == NULL) - { - return false; - } - - len = StrLen(str); - for (i = 0;i < len;i++) - { - if (IsSafeChar(str[i]) == false) - { - return false; - } - } - if (str[0] == ' ') - { - return false; - } - if (len != 0) - { - if (str[len - 1] == ' ') - { - return false; - } - } - return true; -} - -// Check whether the character can be displayed -bool IsPrintableAsciiChar(char c) -{ - UCHAR uc = (UCHAR)c; - if (uc <= 31) - { - return false; - } - if (uc >= 127) - { - return false; - } - return true; -} - -// Convert a string to a displayable string -void EnPrintableAsciiStr(char *str, char replace) -{ - UINT i, len; - // Validate arguments - if (str == NULL) - { - return; - } - - len = StrLen(str); - - for (i = 0;i < len;i++) - { - char c = str[i]; - - if (IsPrintableAsciiChar(c) == false) - { - str[i] = replace; - } - } -} - -// Check whether the character is safe -bool IsSafeChar(char c) -{ - UINT i, len; - char *check_str = - "ABCDEFGHIJKLMNOPQRSTUVWXYZ" - "abcdefghijklmnopqrstuvwxyz" - "0123456789" - " ()-_#%&."; - - len = StrLen(check_str); - for (i = 0;i < len;i++) - { - if (c == check_str[i]) - { - return true; - } - } - return false; -} - -// Remove the specified character from a string -void TruncateCharFromStr(char *str, char replace) -{ - char *src,*dst; - - if (str == NULL) - { - return; - } - - src = dst = str; - - while(*src != '\0') - { - if(*src != replace) - { - *dst = *src; - dst++; - } - src++; - } - *dst = *src; - - //BUF *b = NewBuf(); - //UINT i, len; - //char zero = 0; - - //len = StrLen(str); - //for (i = 0;i < len;i++) - //{ - // char c = str[i]; - - // if (c != replace) - // { - // WriteBuf(b, &c, 1); - // } - //} - - //if (b->Size == 0) - //{ - // char c = '_'; - // WriteBuf(b, &c, 1); - //} - - //WriteBuf(b, &zero, 1); - - //StrCpy(str, 0, b->Buf); - - //FreeBuf(b); -} - -// Replace the unsafe characters -void EnSafeStr(char *str, char replace) -{ - if (str == NULL) - { - return; - } - - while(*str != '\0') - { - if(IsSafeChar(*str) == false) - { - *str = replace; - } - str++; - } -} - -// Replace '\r' and '\n' with the specified character. -// If the specified character is a space (unsafe), the original character is removed. -void EnSafeHttpHeaderValueStr(char *str, char replace) -{ - UINT length = 0; - UINT index = 0; - - // Validate arguments - if (str == NULL) - { - return; - } - - length = StrLen(str); - while (index < length) - { - if (str[index] == '\r' || str[index] == '\n') - { - if (replace == ' ') - { - Move(&str[index], &str[index + 1], length - index); - } - else - { - str[index] = replace; - } - } - else if (str[index] == '\\') - { - if (str[index + 1] == 'r' || str[index + 1] == 'n') - { - if (replace == ' ') - { - Move(&str[index], &str[index + 2], length - index); - index--; - } - else - { - str[index] = str[index + 1] = replace; - index++; - } - } - } - index++; - } -} - -// Operation check of string library -bool CheckStringLibrary() -{ - wchar_t *compare_str = L"TEST_TEST_123_123456789012345"; - char *teststr = "TEST"; - wchar_t *testunistr = L"TEST"; - wchar_t tmp[64]; - UINT i1 = 123; - UINT64 i2 = 123456789012345ULL; - - UniFormat(tmp, sizeof(tmp), L"%S_%s_%u_%I64u", teststr, testunistr, - i1, i2); - - if (UniStrCmpi(tmp, compare_str) != 0) - { - return false; - } - - return true; -} - -// Initialize the string library -void InitStringLibrary() -{ - // Create a lock for token - token_lock = NewLock(); - - // Initialization of the International Library - InitInternational(); - - // Operation check - if (CheckStringLibrary() == false) - { -#ifdef OS_WIN32 - Alert("String Library Init Failed.\r\nPlease check your locale settings.", NULL); -#else // OS_WIN32 - Alert("String Library Init Failed.\r\nPlease check your locale settings and iconv() libraries.", NULL); -#endif // OS_WIN32 - exit(0); - } -} - -// Release of the string library -void FreeStringLibrary() -{ - // Release of the International Library - FreeInternational(); - - // Release of the lock for token - DeleteLock(token_lock); - token_lock = NULL; -} - -// String replaceing (case insensitive) -UINT ReplaceStri(char *dst, UINT size, char *string, char *old_keyword, char *new_keyword) -{ - return ReplaceStrEx(dst, size, string, old_keyword, new_keyword, false); -} - -// String replaceing (case sensitive) -UINT ReplaceStr(char *dst, UINT size, char *string, char *old_keyword, char *new_keyword) -{ - return ReplaceStrEx(dst, size, string, old_keyword, new_keyword, true); -} - -// String replaceing -UINT ReplaceStrEx(char *dst, UINT size, char *string, char *old_keyword, char *new_keyword, bool case_sensitive) -{ - UINT i, j, num; - UINT len_string, len_old, len_new; - UINT len_ret; - UINT wp; - char *ret; - // Validate arguments - if (string == NULL || old_keyword == NULL || new_keyword == NULL) - { - return 0; - } - - // Get the length of the string - len_string = StrLen(string); - len_old = StrLen(old_keyword); - len_new = StrLen(new_keyword); - - // Calculate the final string length - len_ret = CalcReplaceStrEx(string, old_keyword, new_keyword, case_sensitive); - // Memory allocation - ret = Malloc(len_ret + 1); - ret[len_ret] = '\0'; - - // Search and Replace - i = 0; - j = 0; - num = 0; - wp = 0; - while (true) - { - i = SearchStrEx(string, old_keyword, i, case_sensitive); - if (i == INFINITE) - { - Copy(ret + wp, string + j, len_string - j); - wp += len_string - j; - break; - } - num++; - Copy(ret + wp, string + j, i - j); - wp += i - j; - Copy(ret + wp, new_keyword, len_new); - wp += len_new; - i += len_old; - j = i; - } - - // Copy of the search results - StrCpy(dst, size, ret); - - // Memory release - Free(ret); - - return num; -} - -// Calculate the length of the result of string replacement -UINT CalcReplaceStrEx(char *string, char *old_keyword, char *new_keyword, bool case_sensitive) -{ - UINT i, num; - UINT len_string, len_old, len_new; - // Validate arguments - if (string == NULL || old_keyword == NULL || new_keyword == NULL) - { - return 0; - } - - // Get the length of the string - len_string = StrLen(string); - len_old = StrLen(old_keyword); - len_new = StrLen(new_keyword); - - if (len_old == len_new) - { - return len_string; - } - - // Search - num = 0; - i = 0; - while (true) - { - i = SearchStrEx(string, old_keyword, i, case_sensitive); - if (i == INFINITE) - { - break; - } - i += len_old; - num++; - } - - // Calculation - return len_string + len_new * num - len_old * num; -} - -// Search for a string (distinguish between upper / lower case) -UINT SearchStr(char *string, char *keyword, UINT start) -{ - return SearchStrEx(string, keyword, start, true); -} - -// Return the position of the first found keyword in the string -// (Found at first character: returns 0, Not found: returns INFINITE) -UINT SearchStrEx(char *string, char *keyword, UINT start, bool case_sensitive) -{ - UINT len_string, len_keyword; - UINT i; - char *cmp_string, *cmp_keyword; - bool found; - // Validate arguments - if (string == NULL || keyword == NULL) - { - return INFINITE; - } - - // Get the length of string - len_string = StrLen(string); - if (len_string <= start) - { - // Value of start is invalid - return INFINITE; - } - - // Get the length of the keyword - len_keyword = StrLen(keyword); - if (len_keyword == 0) - { - // There is no keyword in the string - return INFINITE; - } - - if ((len_string - start) < len_keyword) - { - // The keyword is longer than the string - return INFINITE; - } - - if (case_sensitive) - { - cmp_string = string; - cmp_keyword = keyword; - } - else - { - cmp_string = Malloc(len_string + 1); - StrCpy(cmp_string, len_string + 1, string); - cmp_keyword = Malloc(len_keyword + 1); - StrCpy(cmp_keyword, len_keyword + 1, keyword); - StrUpper(cmp_string); - StrUpper(cmp_keyword); - } - - // Search - found = false; - for (i = start;i < (len_string - len_keyword + 1);i++) - { - // Compare - if (!strncmp(&cmp_string[i], cmp_keyword, len_keyword)) - { - // Found - found = true; - break; - } - } - - if (case_sensitive == false) - { - // Memory release - Free(cmp_keyword); - Free(cmp_string); - } - - if (found == false) - { - return INFINITE; - } - return i; -} - -// Determine whether the specified character is in the token list -bool IsInToken(TOKEN_LIST *t, char *str) -{ - UINT i; - // Validate arguments - if (t == NULL || str == NULL) - { - return false; - } - - for (i = 0;i < t->NumTokens;i++) - { - if (StrCmpi(t->Token[i], str) == 0) - { - return true; - } - } - - return false; -} - -// Release of the token list -void FreeToken(TOKEN_LIST *tokens) -{ - UINT i; - if (tokens == NULL) - { - return; - } - for (i = 0;i < tokens->NumTokens;i++) - { - if (tokens->Token[i] != 0) - { - Free(tokens->Token[i]); - } - } - Free(tokens->Token); - Free(tokens); -} - -// Parse the token -TOKEN_LIST *ParseToken(char *src, char *separator) -{ - // 2020/7/20 remove strtok by dnobori - return ParseTokenWithoutNullStr(src, separator); -} - -// Get a line from standard input -bool GetLine(char *str, UINT size) -{ - bool ret; - wchar_t *unistr; - UINT unistr_size = (size + 1) * sizeof(wchar_t); - - unistr = Malloc(unistr_size); - - ret = UniGetLine(unistr, unistr_size); - - UniToStr(str, size, unistr); - - Free(unistr); - - return ret; -} - -// Remove '\r' and '\n' at the end -void TrimCrlf(char *str) -{ - UINT len; - // Validate arguments - if (str == NULL) - { - return; - } - len = StrLen(str); - if (len == 0) - { - return; - } - - if (str[len - 1] == '\n') - { - if (len >= 2 && str[len - 2] == '\r') - { - str[len - 2] = 0; - } - str[len - 1] = 0; - } - else if (str[len - 1] == '\r') - { - str[len - 1] = 0; - } -} - -// Remove quotes at the beginning and at the end of the string -void TrimQuotes(char *str) -{ - UINT len = 0; - // Validate arguments - if (str == NULL) - { - return; - } - - len = StrLen(str); - if (len == 0) - { - return; - } - - if (str[len - 1] == '\"') - { - str[len - 1] = 0; - } - - if (str[0] == '\"') - { - Move(str, str + 1, len); - } -} - -// Remove white spaces of the both side of the string -void Trim(char *str) -{ - // Validate arguments - if (str == NULL) - { - return; - } - - // Trim on the left side - TrimLeft(str); - - // Trim on the right side - TrimRight(str); -} - -// Remove white spaces on the right side of the string -void TrimRight(char *str) -{ - char *buf, *tmp; - UINT len, i, wp, wp2; - // Validate arguments - if (str == NULL) - { - return; - } - len = StrLen(str); - if (len == 0) - { - return; - } - if (str[len - 1] != ' ' && str[len - 1] != '\t') - { - return; - } - - buf = Malloc(len + 1); - tmp = Malloc(len + 1); - wp = 0; - wp2 = 0; - for (i = 0; i < len; ++i) - { - if (str[i] != ' ' && str[i] != '\t') - { - Copy(buf + wp, tmp, wp2); - wp += wp2; - wp2 = 0; - buf[wp++] = str[i]; - } - else - { - tmp[wp2++] = str[i]; - } - } - buf[wp] = 0; - StrCpy(str, 0, buf); - Free(buf); - Free(tmp); -} - -// Remove white spaces from the left side of the string -void TrimLeft(char *str) -{ - char *buf; - UINT len, i, wp; - bool flag; - // Validate arguments - if (str == NULL) - { - return; - } - len = StrLen(str); - if (len == 0) - { - return; - } - if (str[0] != ' ' && str[0] != '\t') - { - return; - } - - buf = Malloc(len + 1); - flag = false; - wp = 0; - for (i = 0;i < len;i++) - { - if (str[i] != ' ' && str[i] != '\t') - { - flag = true; - } - if (flag) - { - buf[wp++] = str[i]; - } - } - buf[wp] = 0; - StrCpy(str, 0, buf); - Free(buf); -} - -// Convert an integer to a string -void ToStr(char *str, UINT i) -{ - sprintf(str, "%u", i); -} - -// Convert the string to a signed integer -int ToInti(char *str) -{ - // Validate arguments - if (str == NULL) - { - return 0; - } - - return (int)ToInt(str); -} - -// Convert a string to a Boolean value -bool ToBool(char *str) -{ - char tmp[MAX_SIZE]; - // Validate arguments - if (str == NULL) - { - return false; - } - - StrCpy(tmp, sizeof(tmp), str); - Trim(tmp); - - if (IsEmptyStr(tmp)) - { - return false; - } - - if (ToInt(tmp) != 0) - { - return true; - } - - if (StartWith("true", tmp)) - { - return true; - } - - if (StartWith("yes", tmp)) - { - return true; - } - - if (StartWith(tmp, "true")) - { - return true; - } - - if (StartWith(tmp, "yes")) - { - return true; - } - - return false; -} - -// Convert a string to an integer -UINT ToInt(char *str) -{ - // Validate arguments - if (str == NULL) - { - return 0; - } - - // Ignore the octal literal - while (true) - { - if (*str != '0') - { - break; - } - if ((*(str + 1) == 'x') || (*(str + 1) == 'X')) - { - break; - } - str++; - } - - return (UINT)strtoul(str, NULL, 0); -} - -// Display the string on the screen -void PrintStr(char *str) -{ - wchar_t *unistr = NULL; - // Validate arguments - if (str == NULL) - { - return; - } - -#ifdef OS_UNIX - fputs(str, stdout); -#else // OS_UNIX - unistr = CopyStrToUni(str); - UniPrintStr(unistr); - Free(unistr); -#endif // OS_UNIX -} - -// Display a string with arguments -void PrintArgs(char *fmt, va_list args) -{ - wchar_t *ret; - wchar_t *fmt_wchar; - char *tmp; - // Validate arguments - if (fmt == NULL) - { - return; - } - - fmt_wchar = CopyStrToUni(fmt); - ret = InternalFormatArgs(fmt_wchar, args, true); - - tmp = CopyUniToStr(ret); - PrintStr(tmp); - Free(tmp); - - Free(ret); - Free(fmt_wchar); -} - -// Display a string -void Print(char *fmt, ...) -{ - va_list args; - if (fmt == NULL) - { - return; - } - - va_start(args, fmt); - PrintArgs(fmt, args); - va_end(args); -} - -// Display a debug string with arguments -void DebugArgs(char *fmt, va_list args) -{ - // Validate arguments - if (fmt == NULL) - { - return; - } - if (g_debug == false) - { - return; - } - - PrintArgs(fmt, args); -} - -// Display a debug string -void Debug(char *fmt, ...) -{ - va_list args; - // Validate arguments - if (fmt == NULL) - { - return; - } - if (g_debug == false) - { - return; - } - - va_start(args, fmt); - - DebugArgs(fmt, args); - - va_end(args); -} - -// Format the string -void Format(char *buf, UINT size, char *fmt, ...) -{ - va_list args; - // Validate arguments - if (buf == NULL || fmt == NULL) - { - return; - } - - va_start(args, fmt); - FormatArgs(buf, size, fmt, args); - va_end(args); -} - -// Format the string (argument list) -void FormatArgs(char *buf, UINT size, char *fmt, va_list args) -{ - wchar_t *tag; - wchar_t *ret; - // Validate arguments - if (buf == NULL || fmt == NULL) - { - return; - } - - tag = CopyStrToUni(fmt); - ret = InternalFormatArgs(tag, args, true); - - UniToStr(buf, size, ret); - Free(ret); - Free(tag); -} - -// Compare the strings in case-insensitive mode -int StrCmpi(char *str1, char *str2) -{ - UINT i; - // Validate arguments - if (str1 == NULL && str2 == NULL) - { - return 0; - } - if (str1 == NULL) - { - return 1; - } - if (str2 == NULL) - { - return -1; - } - - // String comparison - i = 0; - while (true) - { - char c1, c2; - c1 = ToUpper(str1[i]); - c2 = ToUpper(str2[i]); - if (c1 > c2) - { - return 1; - } - else if (c1 < c2) - { - return -1; - } - if (str1[i] == 0 || str2[i] == 0) - { - return 0; - } - i++; - } -} - -// Compare the string -int StrCmp(char *str1, char *str2) -{ - // Validate arguments - if (str1 == NULL && str2 == NULL) - { - return 0; - } - if (str1 == NULL) - { - return 1; - } - if (str2 == NULL) - { - return -1; - } - - return strcmp(str1, str2); -} - -// Uncapitalize the string -void StrLower(char *str) -{ - UINT len, i; - // Validate arguments - if (str == NULL) - { - return; - } - - len = StrLen(str); - for (i = 0;i < len;i++) - { - str[i] = ToLower(str[i]); - } -} - -// Capitalize the string -void StrUpper(char *str) -{ - UINT len, i; - // Validate arguments - if (str == NULL) - { - return; - } - - len = StrLen(str); - for (i = 0;i < len;i++) - { - str[i] = ToUpper(str[i]); - } -} - -// Uncapitalize a character -char ToLower(char c) -{ - if ('A' <= c && c <= 'Z') - { - c += 'z' - 'Z'; - } - return c; -} - -// Capitalize a character -char ToUpper(char c) -{ - if ('a' <= c && c <= 'z') - { - c += 'Z' - 'z'; - } - return c; -} - -// Combine the string -UINT StrCat(char *dst, UINT size, char *src) -{ - UINT len1, len2, len_test; - // Validate arguments - if (dst == NULL || src == NULL) - { - return 0; - } - - // KS - KS_INC(KS_STRCAT_COUNT); - - if (size == 0) - { - // Ignore the length - size = 0x7fffffff; - } - - len1 = StrLen(dst); - len2 = StrLen(src); - len_test = len1 + len2 + 1; - if (len_test > size) - { - if (len2 <= (len_test - size)) - { - return 0; - } - len2 -= len_test - size; - } - Copy(dst + len1, src, len2); - dst[len1 + len2] = 0; - - return len1 + len2; -} -UINT StrCatLeft(char *dst, UINT size, char *src) -{ - char *s; - // Validate arguments - if (dst == NULL || src == NULL) - { - return 0; - } - - s = CopyStr(dst); - StrCpy(dst, size, src); - StrCat(dst, size, s); - - Free(s); - - return StrLen(dst); -} - -// Copy a string -UINT StrCpy(char *dst, UINT size, char *src) -{ - UINT len; - // Validate arguments - if (dst == src) - { - return StrLen(src); - } - if (dst == NULL || src == NULL) - { - if (src == NULL && dst != NULL) - { - if (size >= 1) - { - dst[0] = '\0'; - } - } - return 0; - } - if (size == 1) - { - dst[0] = '\0'; - return 0; - } - if (size == 0) - { - // Ignore the length - size = 0x7fffffff; - } - - // Check the length - len = StrLen(src); - if (len <= (size - 1)) - { - Copy(dst, src, len + 1); - } - else - { - len = size - 1; - Copy(dst, src, len); - dst[len] = '\0'; - } - - // KS - KS_INC(KS_STRCPY_COUNT); - - return len; -} -UINT StrCpyAllowOverlap(char *dst, UINT size, char *src) -{ - UINT len; - // Validate arguments - if (dst == src) - { - return StrLen(src); - } - if (dst == NULL || src == NULL) - { - if (src == NULL && dst != NULL) - { - if (size >= 1) - { - dst[0] = '\0'; - } - } - return 0; - } - if (size == 1) - { - dst[0] = '\0'; - return 0; - } - if (size == 0) - { - // Ignore the length - size = 0x7fffffff; - } - - // Check the length - len = StrLen(src); - if (len <= (size - 1)) - { - Move(dst, src, len + 1); - } - else - { - len = size - 1; - Move(dst, src, len); - dst[len] = '\0'; - } - - // KS - KS_INC(KS_STRCPY_COUNT); - - return len; -} - -// Make sure that the string is within the specified length -bool StrCheckLen(char *str, UINT len) -{ - UINT count = 0; - UINT i; - // Validate arguments - if (str == NULL) - { - return false; - } - - // KS - KS_INC(KS_STRCHECK_COUNT); - - for (i = 0;;i++) - { - if (str[i] == '\0') - { - return true; - } - count++; - if (count > len) - { - return false; - } - } -} - -// Get the memory size needed to store the string -UINT StrSize(char *str) -{ - // Validate arguments - if (str == NULL) - { - return 0; - } - - return StrLen(str) + 1; -} - -// Get the length of the string -UINT StrLen(char *str) -{ - // Validate arguments - if (str == NULL) - { - return 0; - } - - // KS - KS_INC(KS_STRLEN_COUNT); - - return (UINT)strlen(str); -} - - - - - - -// *** JSON strings support -// Original source code from Parson ( http://kgabis.github.com/parson/ ) -// Modified by dnobori -/* -Parson ( http://kgabis.github.com/parson/ ) -Copyright (c) 2012 - 2017 Krzysztof Gabis - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. -*/ - - - -/* Apparently sscanf is not implemented in some "standard" libraries, so don't use it, if you -* don't have to. */ -#define sscanf THINK_TWICE_ABOUT_USING_SSCANF - -#define STARTING_CAPACITY 16 -#define MAX_NESTING 2048 -#define FLOAT_FORMAT "%1.17g" - -#define SIZEOF_TOKEN(a) (sizeof(a) - 1) -#define SKIP_CHAR(str) ((*str)++) -#define SKIP_WHITESPACES(str) while (isspace((unsigned char)(**str))) { SKIP_CHAR(str); } - -static JSON_Malloc_Function parson_malloc = Malloc; -static JSON_Free_Function parson_free = Free; - -#define IS_CONT(b) (((unsigned char)(b) & 0xC0) == 0x80) /* is utf-8 continuation byte */ - -/* Various */ -static void remove_comments(char *string, char *start_token, char *end_token); -static char * parson_strndup(char *string, UINT n); -static char * parson_strdup(char *string); -static int hex_char_to_int(char c); -static int parse_utf16_hex(char *string, unsigned int *result); -static int num_bytes_in_utf8_sequence(unsigned char c); -static int verify_utf8_sequence(unsigned char *string, int *len); -static int is_valid_utf8(char *string, UINT string_len); -static int is_decimal(char *string, UINT length); - -/* JSON Object */ -static JSON_OBJECT * json_object_init(JSON_VALUE *wrapping_value); -static UINT json_object_add(JSON_OBJECT *object, char *name, JSON_VALUE *value); -static UINT json_object_resize(JSON_OBJECT *object, UINT new_capacity); -static JSON_VALUE * json_object_nget_value(JSON_OBJECT *object, char *name, UINT n); -static void json_object_free(JSON_OBJECT *object); - -/* JSON Array */ -static JSON_ARRAY * json_array_init(JSON_VALUE *wrapping_value); -static UINT json_array_add(JSON_ARRAY *array, JSON_VALUE *value); -static UINT json_array_resize(JSON_ARRAY *array, UINT new_capacity); -static void json_array_free(JSON_ARRAY *array); - -/* JSON Value */ -static JSON_VALUE * json_value_init_string_no_copy(char *string); - -/* Parser */ -static UINT skip_quotes(char **string); -static int parse_utf16(char **unprocessed, char **processed); -static char * process_string(char *input, UINT len); -static char * get_quoted_string(char **string); -static JSON_VALUE * parse_object_value(char **string, UINT nesting); -static JSON_VALUE * parse_array_value(char **string, UINT nesting); -static JSON_VALUE * parse_string_value(char **string); -static JSON_VALUE * parse_boolean_value(char **string); -static JSON_VALUE * parse_number_value(char **string); -static JSON_VALUE * parse_null_value(char **string); -static JSON_VALUE * parse_value(char **string, UINT nesting); - -/* Serialization */ -static int json_serialize_to_buffer_r(JSON_VALUE *value, char *buf, int level, int is_pretty, char *num_buf); -static int json_serialize_string(char *string, char *buf); -static int append_indent(char *buf, int level); -static int append_string(char *buf, char *string); - -/* Various */ -static char * parson_strndup(char *string, UINT n) { - char *output_string = (char*)parson_malloc(n + 1); - if (!output_string) { - return NULL; - } - output_string[n] = '\0'; - strncpy(output_string, string, n); - return output_string; -} - -static char * parson_strdup(char *string) { - return parson_strndup(string, StrLen(string)); -} - -static int hex_char_to_int(char c) { - if (c >= '0' && c <= '9') { - return c - '0'; - } - else if (c >= 'a' && c <= 'f') { - return c - 'a' + 10; - } - else if (c >= 'A' && c <= 'F') { - return c - 'A' + 10; - } - return -1; -} - -static int parse_utf16_hex(char *s, unsigned int *result) { - int x1, x2, x3, x4; - if (s[0] == '\0' || s[1] == '\0' || s[2] == '\0' || s[3] == '\0') { - return 0; - } - x1 = hex_char_to_int(s[0]); - x2 = hex_char_to_int(s[1]); - x3 = hex_char_to_int(s[2]); - x4 = hex_char_to_int(s[3]); - if (x1 == -1 || x2 == -1 || x3 == -1 || x4 == -1) { - return 0; - } - *result = (unsigned int)((x1 << 12) | (x2 << 8) | (x3 << 4) | x4); - return 1; -} - -static int num_bytes_in_utf8_sequence(unsigned char c) { - if (c == 0xC0 || c == 0xC1 || c > 0xF4 || IS_CONT(c)) { - return 0; - } - else if ((c & 0x80) == 0) { /* 0xxxxxxx */ - return 1; - } - else if ((c & 0xE0) == 0xC0) { /* 110xxxxx */ - return 2; - } - else if ((c & 0xF0) == 0xE0) { /* 1110xxxx */ - return 3; - } - else if ((c & 0xF8) == 0xF0) { /* 11110xxx */ - return 4; - } - return 0; /* won't happen */ -} - -static int verify_utf8_sequence(unsigned char *string, int *len) { - unsigned int cp = 0; - *len = num_bytes_in_utf8_sequence(string[0]); - - if (*len == 1) { - cp = string[0]; - } - else if (*len == 2 && IS_CONT(string[1])) { - cp = string[0] & 0x1F; - cp = (cp << 6) | (string[1] & 0x3F); - } - else if (*len == 3 && IS_CONT(string[1]) && IS_CONT(string[2])) { - cp = ((unsigned char)string[0]) & 0xF; - cp = (cp << 6) | (string[1] & 0x3F); - cp = (cp << 6) | (string[2] & 0x3F); - } - else if (*len == 4 && IS_CONT(string[1]) && IS_CONT(string[2]) && IS_CONT(string[3])) { - cp = string[0] & 0x7; - cp = (cp << 6) | (string[1] & 0x3F); - cp = (cp << 6) | (string[2] & 0x3F); - cp = (cp << 6) | (string[3] & 0x3F); - } - else { - return 0; - } - - /* overlong encodings */ - if ((cp < 0x80 && *len > 1) || - (cp < 0x800 && *len > 2) || - (cp < 0x10000 && *len > 3)) { - return 0; - } - - /* invalid unicode */ - if (cp > 0x10FFFF) { - return 0; - } - - /* surrogate halves */ - if (cp >= 0xD800 && cp <= 0xDFFF) { - return 0; - } - - return 1; -} - -static int is_valid_utf8(char *string, UINT string_len) { - int len = 0; - char *string_end = string + string_len; - while (string < string_end) { - if (!verify_utf8_sequence((unsigned char*)string, &len)) { - return 0; - } - string += len; - } - return 1; -} - -static int is_decimal(char *string, UINT length) { - if (length > 1 && string[0] == '0' && string[1] != '.') { - return 0; - } - if (length > 2 && !strncmp(string, "-0", 2) && string[2] != '.') { - return 0; - } - while (length--) { - if (strchr("xX", string[length])) { - return 0; - } - } - return 1; -} - -static void remove_comments(char *string, char *start_token, char *end_token) { - int in_string = 0, escaped = 0; - UINT i; - char *ptr = NULL, current_char; - UINT start_token_len = StrLen(start_token); - UINT end_token_len = StrLen(end_token); - if (start_token_len == 0 || end_token_len == 0) { - return; - } - while ((current_char = *string) != '\0') { - if (current_char == '\\' && !escaped) { - escaped = 1; - string++; - continue; - } - else if (current_char == '\"' && !escaped) { - in_string = !in_string; - } - else if (!in_string && strncmp(string, start_token, start_token_len) == 0) { - for (i = 0; i < start_token_len; i++) { - string[i] = ' '; - } - string = string + start_token_len; - ptr = strstr(string, end_token); - if (!ptr) { - return; - } - for (i = 0; i < (ptr - string) + end_token_len; i++) { - string[i] = ' '; - } - string = ptr + end_token_len - 1; - } - escaped = 0; - string++; - } -} - -/* JSON Object */ -static JSON_OBJECT * json_object_init(JSON_VALUE *wrapping_value) { - JSON_OBJECT *new_obj = (JSON_OBJECT*)parson_malloc(sizeof(JSON_OBJECT)); - if (new_obj == NULL) { - return NULL; - } - new_obj->wrapping_value = wrapping_value; - new_obj->names = (char**)NULL; - new_obj->values = (JSON_VALUE**)NULL; - new_obj->capacity = 0; - new_obj->count = 0; - return new_obj; -} - -static UINT json_object_add(JSON_OBJECT *object, char *name, JSON_VALUE *value) { - UINT index = 0; - if (object == NULL || name == NULL || value == NULL) { - return JSON_RET_ERROR; - } - if (JsonGet(object, name) != NULL) { - return JSON_RET_ERROR; - } - if (object->count >= object->capacity) { - UINT new_capacity = MAX(object->capacity * 2, STARTING_CAPACITY); - if (json_object_resize(object, new_capacity) == JSON_RET_ERROR) { - return JSON_RET_ERROR; - } - } - index = object->count; - object->names[index] = parson_strdup(name); - if (object->names[index] == NULL) { - return JSON_RET_ERROR; - } - value->parent = JsonGetWrappingValue(object); - object->values[index] = value; - object->count++; - return JSON_RET_OK; -} - -static UINT json_object_resize(JSON_OBJECT *object, UINT new_capacity) { - char **temp_names = NULL; - JSON_VALUE **temp_values = NULL; - - if ((object->names == NULL && object->values != NULL) || - (object->names != NULL && object->values == NULL) || - new_capacity == 0) { - return JSON_RET_ERROR; /* Shouldn't happen */ - } - temp_names = (char**)parson_malloc(new_capacity * sizeof(char*)); - if (temp_names == NULL) { - return JSON_RET_ERROR; - } - temp_values = (JSON_VALUE**)parson_malloc(new_capacity * sizeof(JSON_VALUE*)); - if (temp_values == NULL) { - parson_free(temp_names); - return JSON_RET_ERROR; - } - if (object->names != NULL && object->values != NULL && object->count > 0) { - memcpy(temp_names, object->names, object->count * sizeof(char*)); - memcpy(temp_values, object->values, object->count * sizeof(JSON_VALUE*)); - } - parson_free(object->names); - parson_free(object->values); - object->names = temp_names; - object->values = temp_values; - object->capacity = new_capacity; - return JSON_RET_OK; -} - -static JSON_VALUE * json_object_nget_value(JSON_OBJECT *object, char *name, UINT n) { - UINT i, name_length; - for (i = 0; i < JsonGetCount(object); i++) { - name_length = StrLen(object->names[i]); - if (name_length != n) { - continue; - } - if (strncmp(object->names[i], name, n) == 0) { - return object->values[i]; - } - } - return NULL; -} - -static void json_object_free(JSON_OBJECT *object) { - UINT i; - for (i = 0; i < object->count; i++) { - parson_free(object->names[i]); - JsonFree(object->values[i]); - } - parson_free(object->names); - parson_free(object->values); - parson_free(object); -} - -/* JSON Array */ -static JSON_ARRAY * json_array_init(JSON_VALUE *wrapping_value) { - JSON_ARRAY *new_array = (JSON_ARRAY*)parson_malloc(sizeof(JSON_ARRAY)); - if (new_array == NULL) { - return NULL; - } - new_array->wrapping_value = wrapping_value; - new_array->items = (JSON_VALUE**)NULL; - new_array->capacity = 0; - new_array->count = 0; - return new_array; -} - -static UINT json_array_add(JSON_ARRAY *array, JSON_VALUE *value) { - if (array->count >= array->capacity) { - UINT new_capacity = MAX(array->capacity * 2, STARTING_CAPACITY); - if (json_array_resize(array, new_capacity) == JSON_RET_ERROR) { - return JSON_RET_ERROR; - } - } - value->parent = JsonArrayGetWrappingValue(array); - array->items[array->count] = value; - array->count++; - return JSON_RET_OK; -} - -static UINT json_array_resize(JSON_ARRAY *array, UINT new_capacity) { - JSON_VALUE **new_items = NULL; - if (new_capacity == 0) { - return JSON_RET_ERROR; - } - new_items = (JSON_VALUE**)parson_malloc(new_capacity * sizeof(JSON_VALUE*)); - if (new_items == NULL) { - return JSON_RET_ERROR; - } - if (array->items != NULL && array->count > 0) { - memcpy(new_items, array->items, array->count * sizeof(JSON_VALUE*)); - } - parson_free(array->items); - array->items = new_items; - array->capacity = new_capacity; - return JSON_RET_OK; -} - -static void json_array_free(JSON_ARRAY *array) { - UINT i; - for (i = 0; i < array->count; i++) { - JsonFree(array->items[i]); - } - parson_free(array->items); - parson_free(array); -} - -/* JSON Value */ -static JSON_VALUE * json_value_init_string_no_copy(char *string) { - JSON_VALUE *new_value = (JSON_VALUE*)parson_malloc(sizeof(JSON_VALUE)); - if (!new_value) { - return NULL; - } - new_value->parent = NULL; - new_value->type = JSON_TYPE_STRING; - new_value->value.string = string; - return new_value; -} - -/* Parser */ -static UINT skip_quotes(char **string) { - if (**string != '\"') { - return JSON_RET_ERROR; - } - SKIP_CHAR(string); - while (**string != '\"') { - if (**string == '\0') { - return JSON_RET_ERROR; - } - else if (**string == '\\') { - SKIP_CHAR(string); - if (**string == '\0') { - return JSON_RET_ERROR; - } - } - SKIP_CHAR(string); - } - SKIP_CHAR(string); - return JSON_RET_OK; -} - -static int parse_utf16(char **unprocessed, char **processed) { - unsigned int cp, lead, trail; - int parse_succeeded = 0; - char *processed_ptr = *processed; - char *unprocessed_ptr = *unprocessed; - unprocessed_ptr++; /* skips u */ - parse_succeeded = parse_utf16_hex(unprocessed_ptr, &cp); - if (!parse_succeeded) { - return JSON_RET_ERROR; - } - if (cp < 0x80) { - processed_ptr[0] = (char)cp; /* 0xxxxxxx */ - } - else if (cp < 0x800) { - processed_ptr[0] = ((cp >> 6) & 0x1F) | 0xC0; /* 110xxxxx */ - processed_ptr[1] = ((cp) & 0x3F) | 0x80; /* 10xxxxxx */ - processed_ptr += 1; - } - else if (cp < 0xD800 || cp > 0xDFFF) { - processed_ptr[0] = ((cp >> 12) & 0x0F) | 0xE0; /* 1110xxxx */ - processed_ptr[1] = ((cp >> 6) & 0x3F) | 0x80; /* 10xxxxxx */ - processed_ptr[2] = ((cp) & 0x3F) | 0x80; /* 10xxxxxx */ - processed_ptr += 2; - } - else if (cp >= 0xD800 && cp <= 0xDBFF) { /* lead surrogate (0xD800..0xDBFF) */ - lead = cp; - unprocessed_ptr += 4; /* should always be within the buffer, otherwise previous sscanf would fail */ - if (*unprocessed_ptr++ != '\\' || *unprocessed_ptr++ != 'u') { - return JSON_RET_ERROR; - } - parse_succeeded = parse_utf16_hex(unprocessed_ptr, &trail); - if (!parse_succeeded || trail < 0xDC00 || trail > 0xDFFF) { /* valid trail surrogate? (0xDC00..0xDFFF) */ - return JSON_RET_ERROR; - } - cp = ((((lead - 0xD800) & 0x3FF) << 10) | ((trail - 0xDC00) & 0x3FF)) + 0x010000; - processed_ptr[0] = (((cp >> 18) & 0x07) | 0xF0); /* 11110xxx */ - processed_ptr[1] = (((cp >> 12) & 0x3F) | 0x80); /* 10xxxxxx */ - processed_ptr[2] = (((cp >> 6) & 0x3F) | 0x80); /* 10xxxxxx */ - processed_ptr[3] = (((cp) & 0x3F) | 0x80); /* 10xxxxxx */ - processed_ptr += 3; - } - else { /* trail surrogate before lead surrogate */ - return JSON_RET_ERROR; - } - unprocessed_ptr += 3; - *processed = processed_ptr; - *unprocessed = unprocessed_ptr; - return JSON_RET_OK; -} - - -/* Copies and processes passed string up to supplied length. -Example: "\u006Corem ipsum" -> lorem ipsum */ -static char* process_string(char *input, UINT len) { - char *input_ptr = input; - UINT initial_size = (len + 1) * sizeof(char); - UINT final_size = 0; - char *output = NULL, *output_ptr = NULL, *resized_output = NULL; - output = (char*)parson_malloc(initial_size); - if (output == NULL) { - goto error; - } - output_ptr = output; - while ((*input_ptr != '\0') && (UINT)(input_ptr - input) < len) { - if (*input_ptr == '\\') { - input_ptr++; - switch (*input_ptr) { - case '\"': *output_ptr = '\"'; break; - case '\\': *output_ptr = '\\'; break; - case '/': *output_ptr = '/'; break; - case 'b': *output_ptr = '\b'; break; - case 'f': *output_ptr = '\f'; break; - case 'n': *output_ptr = '\n'; break; - case 'r': *output_ptr = '\r'; break; - case 't': *output_ptr = '\t'; break; - case 'u': - if (parse_utf16(&input_ptr, &output_ptr) == JSON_RET_ERROR) { - goto error; - } - break; - default: - goto error; - } - } - else if ((unsigned char)*input_ptr < 0x20) { - goto error; /* 0x00-0x19 are invalid characters for json string (http://www.ietf.org/rfc/rfc4627.txt) */ - } - else { - *output_ptr = *input_ptr; - } - output_ptr++; - input_ptr++; - } - *output_ptr = '\0'; - /* resize to new length */ - final_size = (UINT)(output_ptr - output) + 1; - /* todo: don't resize if final_size == initial_size */ - resized_output = (char*)parson_malloc(final_size); - if (resized_output == NULL) { - goto error; - } - memcpy(resized_output, output, final_size); - parson_free(output); - return resized_output; -error: - parson_free(output); - return NULL; -} - -/* Return processed contents of a string between quotes and -skips passed argument to a matching quote. */ -static char * get_quoted_string(char **string) { - char *string_start = *string; - UINT string_len = 0; - UINT status = skip_quotes(string); - if (status != JSON_RET_OK) { - return NULL; - } - string_len = (UINT)(*string - string_start - 2); /* length without quotes */ - return process_string(string_start + 1, string_len); -} - -static JSON_VALUE * parse_value(char **string, UINT nesting) { - if (nesting > MAX_NESTING) { - return NULL; - } - SKIP_WHITESPACES(string); - switch (**string) { - case '{': - return parse_object_value(string, nesting + 1); - case '[': - return parse_array_value(string, nesting + 1); - case '\"': - return parse_string_value(string); - case 'f': case 't': - return parse_boolean_value(string); - case '-': - case '0': case '1': case '2': case '3': case '4': - case '5': case '6': case '7': case '8': case '9': - return parse_number_value(string); - case 'n': - return parse_null_value(string); - default: - return NULL; - } -} - -static JSON_VALUE * parse_object_value(char **string, UINT nesting) { - JSON_VALUE *output_value = JsonNewObject(), *new_value = NULL; - JSON_OBJECT *output_object = JsonValueGetObject(output_value); - char *new_key = NULL; - if (output_value == NULL || **string != '{') { - return NULL; - } - SKIP_CHAR(string); - SKIP_WHITESPACES(string); - if (**string == '}') { /* empty object */ - SKIP_CHAR(string); - return output_value; - } - while (**string != '\0') { - new_key = get_quoted_string(string); - if (new_key == NULL) { - JsonFree(output_value); - return NULL; - } - SKIP_WHITESPACES(string); - if (**string != ':') { - parson_free(new_key); - JsonFree(output_value); - return NULL; - } - SKIP_CHAR(string); - new_value = parse_value(string, nesting); - if (new_value == NULL) { - parson_free(new_key); - JsonFree(output_value); - return NULL; - } - if (json_object_add(output_object, new_key, new_value) == JSON_RET_ERROR) { - parson_free(new_key); - JsonFree(new_value); - JsonFree(output_value); - return NULL; - } - parson_free(new_key); - SKIP_WHITESPACES(string); - if (**string != ',') { - break; - } - SKIP_CHAR(string); - SKIP_WHITESPACES(string); - } - SKIP_WHITESPACES(string); - if (**string != '}' || /* Trim object after parsing is over */ - json_object_resize(output_object, JsonGetCount(output_object)) == JSON_RET_ERROR) { - JsonFree(output_value); - return NULL; - } - SKIP_CHAR(string); - return output_value; -} - -static JSON_VALUE * parse_array_value(char **string, UINT nesting) { - JSON_VALUE *output_value = JsonNewArray(), *new_array_value = NULL; - JSON_ARRAY *output_array = JsonValueGetArray(output_value); - if (!output_value || **string != '[') { - return NULL; - } - SKIP_CHAR(string); - SKIP_WHITESPACES(string); - if (**string == ']') { /* empty array */ - SKIP_CHAR(string); - return output_value; - } - while (**string != '\0') { - new_array_value = parse_value(string, nesting); - if (new_array_value == NULL) { - JsonFree(output_value); - return NULL; - } - if (json_array_add(output_array, new_array_value) == JSON_RET_ERROR) { - JsonFree(new_array_value); - JsonFree(output_value); - return NULL; - } - SKIP_WHITESPACES(string); - if (**string != ',') { - break; - } - SKIP_CHAR(string); - SKIP_WHITESPACES(string); - } - SKIP_WHITESPACES(string); - if (**string != ']' || /* Trim array after parsing is over */ - json_array_resize(output_array, JsonArrayGetCount(output_array)) == JSON_RET_ERROR) { - JsonFree(output_value); - return NULL; - } - SKIP_CHAR(string); - return output_value; -} - -static JSON_VALUE * parse_string_value(char **string) { - JSON_VALUE *value = NULL; - char *new_string = get_quoted_string(string); - if (new_string == NULL) { - return NULL; - } - value = json_value_init_string_no_copy(new_string); - if (value == NULL) { - parson_free(new_string); - return NULL; - } - return value; -} - -static JSON_VALUE * parse_boolean_value(char **string) { - UINT true_token_size = SIZEOF_TOKEN("true"); - UINT false_token_size = SIZEOF_TOKEN("false"); - if (strncmp("true", *string, true_token_size) == 0) { - *string += true_token_size; - return JsonNewBool(1); - } - else if (strncmp("false", *string, false_token_size) == 0) { - *string += false_token_size; - return JsonNewBool(0); - } - return NULL; -} - -static JSON_VALUE * parse_number_value(char **string) { - char *end; - bool error = false; - UINT64 number = 0; - number = Json_ToInt64Ex(*string, &end, &error); - - if (error) - { - return NULL; - } - *string = end; - return JsonNewNumber(number); -} - -static JSON_VALUE * parse_null_value(char **string) { - UINT token_size = SIZEOF_TOKEN("null"); - if (strncmp("null", *string, token_size) == 0) { - *string += token_size; - return JsonNewNull(); - } - return NULL; -} - -/* Serialization */ -#define APPEND_STRING(str) do { written = append_string(buf, (str));\ - if (written < 0) { return -1; }\ - if (buf != NULL) { buf += written; }\ - written_total += written; } while(0) - -#define APPEND_INDENT(level) do { written = append_indent(buf, (level));\ - if (written < 0) { return -1; }\ - if (buf != NULL) { buf += written; }\ - written_total += written; } while(0) - -static int json_serialize_to_buffer_r(JSON_VALUE *value, char *buf, int level, int is_pretty, char *num_buf) -{ - char *key = NULL, *string = NULL; - JSON_VALUE *temp_value = NULL; - JSON_ARRAY *array = NULL; - JSON_OBJECT *object = NULL; - UINT i = 0, count = 0; - UINT64 num = 0; - int written = -1, written_total = 0; - char tmp[32]; - - switch (JsonValueGetType(value)) { - case JSON_TYPE_ARRAY: - array = JsonValueGetArray(value); - count = JsonArrayGetCount(array); - APPEND_STRING("["); - if (count > 0 && is_pretty) { - APPEND_STRING("\n"); - } - for (i = 0; i < count; i++) { - if (is_pretty) { - APPEND_INDENT(level + 1); - } - temp_value = JsonArrayGet(array, i); - written = json_serialize_to_buffer_r(temp_value, buf, level + 1, is_pretty, num_buf); - if (written < 0) { - return -1; - } - if (buf != NULL) { - buf += written; - } - written_total += written; - if (i < (count - 1)) { - APPEND_STRING(","); - } - if (is_pretty) { - APPEND_STRING("\n"); - } - } - if (count > 0 && is_pretty) { - APPEND_INDENT(level); - } - APPEND_STRING("]"); - return written_total; - case JSON_TYPE_OBJECT: - object = JsonValueGetObject(value); - count = JsonGetCount(object); - APPEND_STRING("{"); - if (count > 0 && is_pretty) { - APPEND_STRING("\n"); - } - for (i = 0; i < count; i++) { - key = JsonGetName(object, i); - if (key == NULL) { - return -1; - } - if (is_pretty) { - APPEND_INDENT(level + 1); - } - written = json_serialize_string(key, buf); - if (written < 0) { - return -1; - } - if (buf != NULL) { - buf += written; - } - written_total += written; - APPEND_STRING(":"); - if (is_pretty) { - APPEND_STRING(" "); - } - temp_value = JsonGet(object, key); - written = json_serialize_to_buffer_r(temp_value, buf, level + 1, is_pretty, num_buf); - if (written < 0) { - return -1; - } - if (buf != NULL) { - buf += written; - } - written_total += written; - if (i < (count - 1)) { - APPEND_STRING(","); - } - if (is_pretty) { - APPEND_STRING("\n"); - } - } - if (count > 0 && is_pretty) { - APPEND_INDENT(level); - } - APPEND_STRING("}"); - return written_total; - case JSON_TYPE_STRING: - string = JsonValueGetStr(value); - if (string == NULL) { - return -1; - } - written = json_serialize_string(string, buf); - if (written < 0) { - return -1; - } - if (buf != NULL) { - buf += written; - } - written_total += written; - return written_total; - case JSON_TYPE_BOOL: - if (JsonValueGetBool(value)) { - APPEND_STRING("true"); - } - else { - APPEND_STRING("false"); - } - return written_total; - case JSON_TYPE_NUMBER: - num = JsonValueGetNumber(value); - if (buf != NULL) { - num_buf = buf; - } - ToStr64(tmp, num); - Copy(num_buf, tmp, StrLen(tmp)); - written = StrLen(tmp); - if (buf != NULL) { - buf += written; - } - written_total += written; - return written_total; - case JSON_TYPE_NULL: - APPEND_STRING("null"); - return written_total; - case JSON_TYPE_ERROR: - return -1; - default: - return -1; - } -} - -static int json_serialize_string(char *string, char *buf) { - UINT i = 0, len = StrLen(string); - char c = '\0'; - int written = -1, written_total = 0; - APPEND_STRING("\""); - for (i = 0; i < len; i++) { - c = string[i]; - switch (c) { - case '\"': APPEND_STRING("\\\""); break; - case '\\': APPEND_STRING("\\\\"); break; - case '/': APPEND_STRING("\\/"); break; /* to make json embeddable in xml\/html */ - case '\b': APPEND_STRING("\\b"); break; - case '\f': APPEND_STRING("\\f"); break; - case '\n': APPEND_STRING("\\n"); break; - case '\r': APPEND_STRING("\\r"); break; - case '\t': APPEND_STRING("\\t"); break; - case '\x00': APPEND_STRING("\\u0000"); break; - case '\x01': APPEND_STRING("\\u0001"); break; - case '\x02': APPEND_STRING("\\u0002"); break; - case '\x03': APPEND_STRING("\\u0003"); break; - case '\x04': APPEND_STRING("\\u0004"); break; - case '\x05': APPEND_STRING("\\u0005"); break; - case '\x06': APPEND_STRING("\\u0006"); break; - case '\x07': APPEND_STRING("\\u0007"); break; - /* '\x08' duplicate: '\b' */ - /* '\x09' duplicate: '\t' */ - /* '\x0a' duplicate: '\n' */ - case '\x0b': APPEND_STRING("\\u000b"); break; - /* '\x0c' duplicate: '\f' */ - /* '\x0d' duplicate: '\r' */ - case '\x0e': APPEND_STRING("\\u000e"); break; - case '\x0f': APPEND_STRING("\\u000f"); break; - case '\x10': APPEND_STRING("\\u0010"); break; - case '\x11': APPEND_STRING("\\u0011"); break; - case '\x12': APPEND_STRING("\\u0012"); break; - case '\x13': APPEND_STRING("\\u0013"); break; - case '\x14': APPEND_STRING("\\u0014"); break; - case '\x15': APPEND_STRING("\\u0015"); break; - case '\x16': APPEND_STRING("\\u0016"); break; - case '\x17': APPEND_STRING("\\u0017"); break; - case '\x18': APPEND_STRING("\\u0018"); break; - case '\x19': APPEND_STRING("\\u0019"); break; - case '\x1a': APPEND_STRING("\\u001a"); break; - case '\x1b': APPEND_STRING("\\u001b"); break; - case '\x1c': APPEND_STRING("\\u001c"); break; - case '\x1d': APPEND_STRING("\\u001d"); break; - case '\x1e': APPEND_STRING("\\u001e"); break; - case '\x1f': APPEND_STRING("\\u001f"); break; - default: - if (buf != NULL) { - buf[0] = c; - buf += 1; - } - written_total += 1; - break; - } - } - APPEND_STRING("\""); - return written_total; -} - -static int append_indent(char *buf, int level) { - int i; - int written = -1, written_total = 0; - for (i = 0; i < level; i++) { - APPEND_STRING(" "); - } - return written_total; -} - -static int append_string(char *buf, char *string) { - if (buf == NULL) { - return (int)strlen(string); - } - return sprintf(buf, "%s", string); -} - -#undef APPEND_STRING -#undef APPEND_INDENT - -JSON_VALUE * JsonParseString(char *string) { - if (string == NULL) { - return NULL; - } - if (string[0] == '\xEF' && string[1] == '\xBB' && string[2] == '\xBF') { - string = string + 3; /* Support for UTF-8 BOM */ - } - return parse_value((char**)&string, 0); -} - -JSON_VALUE * JsonParseStringWithComments(char *string) { - JSON_VALUE *result = NULL; - char *string_mutable_copy = NULL, *string_mutable_copy_ptr = NULL; - string_mutable_copy = parson_strdup(string); - if (string_mutable_copy == NULL) { - return NULL; - } - remove_comments(string_mutable_copy, "/*", "*/"); - remove_comments(string_mutable_copy, "//", "\n"); - string_mutable_copy_ptr = string_mutable_copy; - result = parse_value((char**)&string_mutable_copy_ptr, 0); - parson_free(string_mutable_copy); - return result; -} - -/* JSON Object API */ - -JSON_VALUE * JsonGet(JSON_OBJECT *object, char *name) { - if (object == NULL || name == NULL) { - return NULL; - } - return json_object_nget_value(object, name, StrLen(name)); -} - -char * JsonGetStr(JSON_OBJECT *object, char *name) { - return JsonValueGetStr(JsonGet(object, name)); -} - -UINT64 JsonGetNumber(JSON_OBJECT *object, char *name) { - return JsonValueGetNumber(JsonGet(object, name)); -} - -JSON_OBJECT * JsonGetObj(JSON_OBJECT *object, char *name) { - return JsonValueGetObject(JsonGet(object, name)); -} - -JSON_ARRAY * JsonGetArray(JSON_OBJECT *object, char *name) { - return JsonValueGetArray(JsonGet(object, name)); -} - -bool JsonGetBool(JSON_OBJECT *object, char *name) { - return JsonValueGetBool(JsonGet(object, name)); -} - -JSON_VALUE * JsonDotGet(JSON_OBJECT *object, char *name) { - char *dot_position = strchr(name, '.'); - if (!dot_position) { - return JsonGet(object, name); - } - object = JsonValueGetObject(json_object_nget_value(object, name, (UINT)(dot_position - name))); - return JsonDotGet(object, dot_position + 1); -} - -char * JsonDotGetStr(JSON_OBJECT *object, char *name) { - return JsonValueGetStr(JsonDotGet(object, name)); -} - -UINT64 JsonDotGetNumber(JSON_OBJECT *object, char *name) { - return JsonValueGetNumber(JsonDotGet(object, name)); -} - -JSON_OBJECT * JsonDotGetObj(JSON_OBJECT *object, char *name) { - return JsonValueGetObject(JsonDotGet(object, name)); -} - -JSON_ARRAY * JsonDotGetArray(JSON_OBJECT *object, char *name) { - return JsonValueGetArray(JsonDotGet(object, name)); -} - -bool JsonDotGetBool(JSON_OBJECT *object, char *name) { - return JsonValueGetBool(JsonDotGet(object, name)); -} - -UINT JsonGetCount(JSON_OBJECT *object) { - return object ? object->count : 0; -} - -char * JsonGetName(JSON_OBJECT *object, UINT index) { - if (object == NULL || index >= JsonGetCount(object)) { - return NULL; - } - return object->names[index]; -} - -JSON_VALUE * JsonGetValueAt(JSON_OBJECT *object, UINT index) { - if (object == NULL || index >= JsonGetCount(object)) { - return NULL; - } - return object->values[index]; -} - -JSON_VALUE *JsonGetWrappingValue(JSON_OBJECT *object) { - return object->wrapping_value; -} - -int JsonIsExists(JSON_OBJECT *object, char *name) { - return JsonGet(object, name) != NULL; -} - -int JsonIsExistsWithValueType(JSON_OBJECT *object, char *name, UINT type) { - JSON_VALUE *val = JsonGet(object, name); - return val != NULL && JsonValueGetType(val) == type; -} - -int JsonDotIsExists(JSON_OBJECT *object, char *name) { - return JsonDotGet(object, name) != NULL; -} - -int JsonDotIsExistsWithValueType(JSON_OBJECT *object, char *name, UINT type) { - JSON_VALUE *val = JsonDotGet(object, name); - return val != NULL && JsonValueGetType(val) == type; -} - -/* JSON Array API */ -JSON_VALUE * JsonArrayGet(JSON_ARRAY *array, UINT index) { - if (array == NULL || index >= JsonArrayGetCount(array)) { - return NULL; - } - return array->items[index]; -} - -char * JsonArrayGetStr(JSON_ARRAY *array, UINT index) { - return JsonValueGetStr(JsonArrayGet(array, index)); -} - -UINT64 JsonArrayGetNumber(JSON_ARRAY *array, UINT index) { - return JsonValueGetNumber(JsonArrayGet(array, index)); -} - -JSON_OBJECT * JsonArrayGetObj(JSON_ARRAY *array, UINT index) { - return JsonValueGetObject(JsonArrayGet(array, index)); -} - -JSON_ARRAY * JsonArrayGetArray(JSON_ARRAY *array, UINT index) { - return JsonValueGetArray(JsonArrayGet(array, index)); -} - -bool JsonArrayGetBool(JSON_ARRAY *array, UINT index) { - return JsonValueGetBool(JsonArrayGet(array, index)); -} - -UINT JsonArrayGetCount(JSON_ARRAY *array) { - return array ? array->count : 0; -} - -JSON_VALUE * JsonArrayGetWrappingValue(JSON_ARRAY *array) { - return array->wrapping_value; -} - -/* JSON Value API */ -UINT JsonValueGetType(JSON_VALUE *value) { - return value ? value->type : JSON_TYPE_ERROR; -} - -JSON_OBJECT * JsonValueGetObject(JSON_VALUE *value) { - if (value == NULL) - { - return NULL; - } - return JsonValueGetType(value) == JSON_TYPE_OBJECT ? value->value.object : NULL; -} - -JSON_ARRAY * JsonValueGetArray(JSON_VALUE *value) { - return JsonValueGetType(value) == JSON_TYPE_ARRAY ? value->value.array : NULL; -} - -char * JsonValueGetStr(JSON_VALUE *value) { - return JsonValueGetType(value) == JSON_TYPE_STRING ? value->value.string : NULL; -} - -UINT64 JsonValueGetNumber(JSON_VALUE *value) { - return JsonValueGetType(value) == JSON_TYPE_NUMBER ? value->value.number : 0; -} - -bool JsonValueGetBool(JSON_VALUE *value) { - return JsonValueGetType(value) == JSON_TYPE_BOOL ? value->value.boolean : 0; -} - -JSON_VALUE * JsonValueGetParent(JSON_VALUE *value) { - return value ? value->parent : NULL; -} - -void JsonFree(JSON_VALUE *value) { - if (value == NULL) - { - return; - } - switch (JsonValueGetType(value)) { - case JSON_TYPE_OBJECT: - json_object_free(value->value.object); - break; - case JSON_TYPE_STRING: - parson_free(value->value.string); - break; - case JSON_TYPE_ARRAY: - json_array_free(value->value.array); - break; - default: - break; - } - parson_free(value); -} - -JSON_VALUE * JsonNewObject(void) { - JSON_VALUE *new_value = (JSON_VALUE*)parson_malloc(sizeof(JSON_VALUE)); - if (!new_value) { - return NULL; - } - new_value->parent = NULL; - new_value->type = JSON_TYPE_OBJECT; - new_value->value.object = json_object_init(new_value); - if (!new_value->value.object) { - parson_free(new_value); - return NULL; - } - return new_value; -} - -JSON_VALUE * JsonNewArray(void) { - JSON_VALUE *new_value = (JSON_VALUE*)parson_malloc(sizeof(JSON_VALUE)); - if (!new_value) { - return NULL; - } - new_value->parent = NULL; - new_value->type = JSON_TYPE_ARRAY; - new_value->value.array = json_array_init(new_value); - if (!new_value->value.array) { - parson_free(new_value); - return NULL; - } - return new_value; -} - -JSON_VALUE * JsonNewStr(char *string) { - char *copy = NULL; - JSON_VALUE *value; - UINT string_len = 0; - if (string == NULL) { - return NULL; - } - string_len = StrLen(string); - if (!is_valid_utf8(string, string_len)) { - return NULL; - } - copy = parson_strndup(string, string_len); - if (copy == NULL) { - return NULL; - } - value = json_value_init_string_no_copy(copy); - if (value == NULL) { - parson_free(copy); - } - return value; -} - -JSON_VALUE * JsonNewNumber(UINT64 number) { - JSON_VALUE *new_value = NULL; - new_value = (JSON_VALUE*)parson_malloc(sizeof(JSON_VALUE)); - if (new_value == NULL) { - return NULL; - } - new_value->parent = NULL; - new_value->type = JSON_TYPE_NUMBER; - new_value->value.number = number; - return new_value; -} - -JSON_VALUE * JsonNewBool(int boolean) { - JSON_VALUE *new_value = (JSON_VALUE*)parson_malloc(sizeof(JSON_VALUE)); - if (!new_value) { - return NULL; - } - new_value->parent = NULL; - new_value->type = JSON_TYPE_BOOL; - new_value->value.boolean = boolean ? 1 : 0; - return new_value; -} - -JSON_VALUE * JsonNewNull(void) { - JSON_VALUE *new_value = (JSON_VALUE*)parson_malloc(sizeof(JSON_VALUE)); - if (!new_value) { - return NULL; - } - new_value->parent = NULL; - new_value->type = JSON_TYPE_NULL; - return new_value; -} - -JSON_VALUE * JsonDeepCopy(JSON_VALUE *value) { - UINT i = 0; - JSON_VALUE *return_value = NULL, *temp_value_copy = NULL, *temp_value = NULL; - char *temp_string = NULL, *temp_key = NULL; - char *temp_string_copy = NULL; - JSON_ARRAY *temp_array = NULL, *temp_array_copy = NULL; - JSON_OBJECT *temp_object = NULL, *temp_object_copy = NULL; - - switch (JsonValueGetType(value)) { - case JSON_TYPE_ARRAY: - temp_array = JsonValueGetArray(value); - return_value = JsonNewArray(); - if (return_value == NULL) { - return NULL; - } - temp_array_copy = JsonValueGetArray(return_value); - for (i = 0; i < JsonArrayGetCount(temp_array); i++) { - temp_value = JsonArrayGet(temp_array, i); - temp_value_copy = JsonDeepCopy(temp_value); - if (temp_value_copy == NULL) { - JsonFree(return_value); - return NULL; - } - if (json_array_add(temp_array_copy, temp_value_copy) == JSON_RET_ERROR) { - JsonFree(return_value); - JsonFree(temp_value_copy); - return NULL; - } - } - return return_value; - case JSON_TYPE_OBJECT: - temp_object = JsonValueGetObject(value); - return_value = JsonNewObject(); - if (return_value == NULL) { - return NULL; - } - temp_object_copy = JsonValueGetObject(return_value); - for (i = 0; i < JsonGetCount(temp_object); i++) { - temp_key = JsonGetName(temp_object, i); - temp_value = JsonGet(temp_object, temp_key); - temp_value_copy = JsonDeepCopy(temp_value); - if (temp_value_copy == NULL) { - JsonFree(return_value); - return NULL; - } - if (json_object_add(temp_object_copy, temp_key, temp_value_copy) == JSON_RET_ERROR) { - JsonFree(return_value); - JsonFree(temp_value_copy); - return NULL; - } - } - return return_value; - case JSON_TYPE_BOOL: - return JsonNewBool(JsonValueGetBool(value)); - case JSON_TYPE_NUMBER: - return JsonNewNumber(JsonValueGetNumber(value)); - case JSON_TYPE_STRING: - temp_string = JsonValueGetStr(value); - if (temp_string == NULL) { - return NULL; - } - temp_string_copy = parson_strdup(temp_string); - if (temp_string_copy == NULL) { - return NULL; - } - return_value = json_value_init_string_no_copy(temp_string_copy); - if (return_value == NULL) { - parson_free(temp_string_copy); - } - return return_value; - case JSON_TYPE_NULL: - return JsonNewNull(); - case JSON_TYPE_ERROR: - return NULL; - default: - return NULL; - } -} - -UINT JsonGetSerializationSize(JSON_VALUE *value) { - char num_buf[1100]; /* recursively allocating buffer on stack is a bad idea, so let's do it only once */ - int res = json_serialize_to_buffer_r(value, NULL, 0, 0, num_buf); - return res < 0 ? 0 : (UINT)(res + 1); -} - -UINT JsonSerializeToBuffer(JSON_VALUE *value, char *buf, UINT buf_size_in_bytes) { - int written = -1; - UINT needed_size_in_bytes = JsonGetSerializationSize(value); - if (needed_size_in_bytes == 0 || buf_size_in_bytes < needed_size_in_bytes) { - return JSON_RET_ERROR; - } - written = json_serialize_to_buffer_r(value, buf, 0, 0, NULL); - if (written < 0) { - return JSON_RET_ERROR; - } - return JSON_RET_OK; -} - -char * JsonSerializeToString(JSON_VALUE *value) { - UINT serialization_result = JSON_RET_ERROR; - UINT buf_size_bytes = JsonGetSerializationSize(value); - char *buf = NULL; - if (buf_size_bytes == 0) { - return NULL; - } - buf = (char*)parson_malloc(buf_size_bytes); - if (buf == NULL) { - return NULL; - } - serialization_result = JsonSerializeToBuffer(value, buf, buf_size_bytes); - if (serialization_result == JSON_RET_ERROR) { - JsonFreeString(buf); - return NULL; - } - return buf; -} - -UINT JsonGetSerializationSizePretty(JSON_VALUE *value) { - char num_buf[1100]; /* recursively allocating buffer on stack is a bad idea, so let's do it only once */ - int res = json_serialize_to_buffer_r(value, NULL, 0, 1, num_buf); - return res < 0 ? 0 : (UINT)(res + 1); -} - -UINT JsonSerializeToBufferPretty(JSON_VALUE *value, char *buf, UINT buf_size_in_bytes) { - int written = -1; - UINT needed_size_in_bytes = JsonGetSerializationSizePretty(value); - if (needed_size_in_bytes == 0 || buf_size_in_bytes < needed_size_in_bytes) { - return JSON_RET_ERROR; - } - written = json_serialize_to_buffer_r(value, buf, 0, 1, NULL); - if (written < 0) { - return JSON_RET_ERROR; - } - return JSON_RET_OK; -} - -JSON_VALUE *StrToJson(char *str) -{ - if (str == NULL) - { - return NULL; - } - - return JsonParseString(str); -} - -char *JsonToStr(JSON_VALUE *v) -{ - return JsonSerializeToStringPretty(v); -} -char * JsonSerializeToStringPretty(JSON_VALUE *value) { - UINT serialization_result = JSON_RET_ERROR; - UINT buf_size_bytes = JsonGetSerializationSizePretty(value); - char *buf = NULL; - if (buf_size_bytes == 0) { - return NULL; - } - buf = (char*)parson_malloc(buf_size_bytes); - if (buf == NULL) { - return NULL; - } - serialization_result = JsonSerializeToBufferPretty(value, buf, buf_size_bytes); - if (serialization_result == JSON_RET_ERROR) { - JsonFreeString(buf); - return NULL; - } - return buf; -} - -void JsonFreeString(char *string) { - parson_free(string); -} - -UINT JsonArrayDelete(JSON_ARRAY *array, UINT ix) { - UINT to_move_bytes = 0; - if (array == NULL || ix >= JsonArrayGetCount(array)) { - return JSON_RET_ERROR; - } - JsonFree(JsonArrayGet(array, ix)); - to_move_bytes = (JsonArrayGetCount(array) - 1 - ix) * sizeof(JSON_VALUE*); - memmove(array->items + ix, array->items + ix + 1, to_move_bytes); - array->count -= 1; - return JSON_RET_OK; -} - -UINT JsonArrayReplace(JSON_ARRAY *array, UINT ix, JSON_VALUE *value) { - if (array == NULL || value == NULL || value->parent != NULL || ix >= JsonArrayGetCount(array)) { - return JSON_RET_ERROR; - } - JsonFree(JsonArrayGet(array, ix)); - value->parent = JsonArrayGetWrappingValue(array); - array->items[ix] = value; - return JSON_RET_OK; -} - -UINT JsonArrayReplaceStr(JSON_ARRAY *array, UINT i, char* string) { - JSON_VALUE *value = JsonNewStr(string); - if (value == NULL) { - return JSON_RET_ERROR; - } - if (JsonArrayReplace(array, i, value) == JSON_RET_ERROR) { - JsonFree(value); - return JSON_RET_ERROR; - } - return JSON_RET_OK; -} - -UINT JsonArrayReplaceNumber(JSON_ARRAY *array, UINT i, UINT64 number) { - JSON_VALUE *value = JsonNewNumber(number); - if (value == NULL) { - return JSON_RET_ERROR; - } - if (JsonArrayReplace(array, i, value) == JSON_RET_ERROR) { - JsonFree(value); - return JSON_RET_ERROR; - } - return JSON_RET_OK; -} - -UINT JsonArrayReplaceBool(JSON_ARRAY *array, UINT i, int boolean) { - JSON_VALUE *value = JsonNewBool(boolean); - if (value == NULL) { - return JSON_RET_ERROR; - } - if (JsonArrayReplace(array, i, value) == JSON_RET_ERROR) { - JsonFree(value); - return JSON_RET_ERROR; - } - return JSON_RET_OK; -} - -UINT JsonArrayReplaceNull(JSON_ARRAY *array, UINT i) { - JSON_VALUE *value = JsonNewNull(); - if (value == NULL) { - return JSON_RET_ERROR; - } - if (JsonArrayReplace(array, i, value) == JSON_RET_ERROR) { - JsonFree(value); - return JSON_RET_ERROR; - } - return JSON_RET_OK; -} - -UINT JsonArrayDeleteAll(JSON_ARRAY *array) { - UINT i = 0; - if (array == NULL) { - return JSON_RET_ERROR; - } - for (i = 0; i < JsonArrayGetCount(array); i++) { - JsonFree(JsonArrayGet(array, i)); - } - array->count = 0; - return JSON_RET_OK; -} - -UINT JsonArrayAdd(JSON_ARRAY *array, JSON_VALUE *value) { - if (array == NULL || value == NULL || value->parent != NULL) { - return JSON_RET_ERROR; - } - return json_array_add(array, value); -} - -UINT JsonArrayAddStr(JSON_ARRAY *array, char *string) { - JSON_VALUE *value = JsonNewStr(string); - if (value == NULL) { - return JSON_RET_ERROR; - } - if (JsonArrayAdd(array, value) == JSON_RET_ERROR) { - JsonFree(value); - return JSON_RET_ERROR; - } - return JSON_RET_OK; -} - -UINT JsonArrayAddUniStr(JSON_ARRAY *array, wchar_t *string) -{ - UINT ret; - char *utf8 = CopyUniToUtf(string); - - ret = JsonArrayAddStr(array, utf8); - - Free(utf8); - return ret; -} - -UINT JsonArrayAddNumber(JSON_ARRAY *array, UINT64 number) { - JSON_VALUE *value = JsonNewNumber(number); - if (value == NULL) { - return JSON_RET_ERROR; - } - if (JsonArrayAdd(array, value) == JSON_RET_ERROR) { - JsonFree(value); - return JSON_RET_ERROR; - } - return JSON_RET_OK; -} - -UINT JsonArrayAddData(JSON_ARRAY *array, void *data, UINT size) -{ - UINT ret; - char *b64 = ZeroMalloc(size * 4 + 32); - B64_Encode(b64, data, size); - - ret = JsonArrayAddStr(array, b64); - - Free(b64); - return ret; -} - -UINT JsonArrayAddBool(JSON_ARRAY *array, int boolean) { - JSON_VALUE *value = JsonNewBool(boolean); - if (value == NULL) { - return JSON_RET_ERROR; - } - if (JsonArrayAdd(array, value) == JSON_RET_ERROR) { - JsonFree(value); - return JSON_RET_ERROR; - } - return JSON_RET_OK; -} - -UINT JsonArrayAddNull(JSON_ARRAY *array) { - JSON_VALUE *value = JsonNewNull(); - if (value == NULL) { - return JSON_RET_ERROR; - } - if (JsonArrayAdd(array, value) == JSON_RET_ERROR) { - JsonFree(value); - return JSON_RET_ERROR; - } - return JSON_RET_OK; -} - -UINT JsonSet(JSON_OBJECT *object, char *name, JSON_VALUE *value) { - UINT i = 0; - JSON_VALUE *old_value; - if (object == NULL || name == NULL || value == NULL || value->parent != NULL) { - return JSON_RET_ERROR; - } - old_value = JsonGet(object, name); - if (old_value != NULL) { /* free and overwrite old value */ - JsonFree(old_value); - for (i = 0; i < JsonGetCount(object); i++) { - if (strcmp(object->names[i], name) == 0) { - value->parent = JsonGetWrappingValue(object); - object->values[i] = value; - return JSON_RET_OK; - } - } - } - /* add new key value pair */ - return json_object_add(object, name, value); -} - -UINT JsonSetData(JSON_OBJECT *object, char *name, void *data, UINT size) -{ - UINT ret; - char *b64 = ZeroMalloc(size * 4 + 32); - B64_Encode(b64, data, size); - - ret = JsonSetStr(object, name, b64); - - Free(b64); - return ret; -} - -UINT JsonSetStr(JSON_OBJECT *object, char *name, char *string) { - return JsonSet(object, name, JsonNewStr(string)); -} - -UINT JsonSetUniStr(JSON_OBJECT *object, char *name, wchar_t *string) -{ - UINT ret; - char *utf8 = CopyUniToUtf(string); - - ret = JsonSetStr(object, name, utf8); - - Free(utf8); - return ret; -} - -UINT JsonSetNumber(JSON_OBJECT *object, char *name, UINT64 number) { - return JsonSet(object, name, JsonNewNumber(number)); -} - -UINT JsonSetBool(JSON_OBJECT *object, char *name, int boolean) { - return JsonSet(object, name, JsonNewBool(boolean)); -} - -UINT JsonSetNull(JSON_OBJECT *object, char *name) { - return JsonSet(object, name, JsonNewNull()); -} - -UINT JsonDotSet(JSON_OBJECT *object, char *name, JSON_VALUE *value) { - char *dot_pos = NULL; - char *current_name = NULL; - JSON_OBJECT *temp_obj = NULL; - JSON_VALUE *new_value = NULL; - if (object == NULL || name == NULL || value == NULL) { - return JSON_RET_ERROR; - } - dot_pos = strchr(name, '.'); - if (dot_pos == NULL) { - return JsonSet(object, name, value); - } - else { - current_name = parson_strndup(name, (UINT)(dot_pos - name)); - temp_obj = JsonGetObj(object, current_name); - if (temp_obj == NULL) { - new_value = JsonNewObject(); - if (new_value == NULL) { - parson_free(current_name); - return JSON_RET_ERROR; - } - if (json_object_add(object, current_name, new_value) == JSON_RET_ERROR) { - JsonFree(new_value); - parson_free(current_name); - return JSON_RET_ERROR; - } - temp_obj = JsonGetObj(object, current_name); - } - parson_free(current_name); - return JsonDotSet(temp_obj, dot_pos + 1, value); - } -} - -UINT JsonDotSetStr(JSON_OBJECT *object, char *name, char *string) { - JSON_VALUE *value = JsonNewStr(string); - if (value == NULL) { - return JSON_RET_ERROR; - } - if (JsonDotSet(object, name, value) == JSON_RET_ERROR) { - JsonFree(value); - return JSON_RET_ERROR; - } - return JSON_RET_OK; -} - -UINT JsonDotSetNumber(JSON_OBJECT *object, char *name, UINT64 number) { - JSON_VALUE *value = JsonNewNumber(number); - if (value == NULL) { - return JSON_RET_ERROR; - } - if (JsonDotSet(object, name, value) == JSON_RET_ERROR) { - JsonFree(value); - return JSON_RET_ERROR; - } - return JSON_RET_OK; -} - -UINT JsonDotSetBool(JSON_OBJECT *object, char *name, int boolean) { - JSON_VALUE *value = JsonNewBool(boolean); - if (value == NULL) { - return JSON_RET_ERROR; - } - if (JsonDotSet(object, name, value) == JSON_RET_ERROR) { - JsonFree(value); - return JSON_RET_ERROR; - } - return JSON_RET_OK; -} - -UINT JsonDotSetNull(JSON_OBJECT *object, char *name) { - JSON_VALUE *value = JsonNewNull(); - if (value == NULL) { - return JSON_RET_ERROR; - } - if (JsonDotSet(object, name, value) == JSON_RET_ERROR) { - JsonFree(value); - return JSON_RET_ERROR; - } - return JSON_RET_OK; -} - -UINT JsonDelete(JSON_OBJECT *object, char *name) { - UINT i = 0, last_item_index = 0; - if (object == NULL || JsonGet(object, name) == NULL) { - return JSON_RET_ERROR; - } - last_item_index = JsonGetCount(object) - 1; - for (i = 0; i < JsonGetCount(object); i++) { - if (strcmp(object->names[i], name) == 0) { - parson_free(object->names[i]); - JsonFree(object->values[i]); - if (i != last_item_index) { /* Replace key value pair with one from the end */ - object->names[i] = object->names[last_item_index]; - object->values[i] = object->values[last_item_index]; - } - object->count -= 1; - return JSON_RET_OK; - } - } - return JSON_RET_ERROR; /* No execution path should end here */ -} - -UINT JsonDotDelete(JSON_OBJECT *object, char *name) { - char *dot_pos = strchr(name, '.'); - char *current_name = NULL; - JSON_OBJECT *temp_obj = NULL; - if (dot_pos == NULL) { - return JsonDelete(object, name); - } - else { - current_name = parson_strndup(name, (UINT)(dot_pos - name)); - temp_obj = JsonGetObj(object, current_name); - parson_free(current_name); - if (temp_obj == NULL) { - return JSON_RET_ERROR; - } - return JsonDotDelete(temp_obj, dot_pos + 1); - } -} - -UINT JsonDeleteAll(JSON_OBJECT *object) { - UINT i = 0; - if (object == NULL) { - return JSON_RET_ERROR; - } - for (i = 0; i < JsonGetCount(object); i++) { - parson_free(object->names[i]); - JsonFree(object->values[i]); - } - object->count = 0; - return JSON_RET_OK; -} - -UINT JsonValidate(JSON_VALUE *schema, JSON_VALUE *value) { - JSON_VALUE *temp_schema_value = NULL, *temp_value = NULL; - JSON_ARRAY *schema_array = NULL, *value_array = NULL; - JSON_OBJECT *schema_object = NULL, *value_object = NULL; - UINT schema_type = JSON_TYPE_ERROR, value_type = JSON_TYPE_ERROR; - char *key = NULL; - UINT i = 0, count = 0; - if (schema == NULL || value == NULL) { - return JSON_RET_ERROR; - } - schema_type = JsonValueGetType(schema); - value_type = JsonValueGetType(value); - if (schema_type != value_type && schema_type != JSON_TYPE_NULL) { /* null represents all values */ - return JSON_RET_ERROR; - } - switch (schema_type) { - case JSON_TYPE_ARRAY: - schema_array = JsonValueGetArray(schema); - value_array = JsonValueGetArray(value); - count = JsonArrayGetCount(schema_array); - if (count == 0) { - return JSON_RET_OK; /* Empty array allows all types */ - } - /* Get first value from array, rest is ignored */ - temp_schema_value = JsonArrayGet(schema_array, 0); - for (i = 0; i < JsonArrayGetCount(value_array); i++) { - temp_value = JsonArrayGet(value_array, i); - if (JsonValidate(temp_schema_value, temp_value) == JSON_RET_ERROR) { - return JSON_RET_ERROR; - } - } - return JSON_RET_OK; - case JSON_TYPE_OBJECT: - schema_object = JsonValueGetObject(schema); - value_object = JsonValueGetObject(value); - count = JsonGetCount(schema_object); - if (count == 0) { - return JSON_RET_OK; /* Empty object allows all objects */ - } - else if (JsonGetCount(value_object) < count) { - return JSON_RET_ERROR; /* Tested object mustn't have less name-value pairs than schema */ - } - for (i = 0; i < count; i++) { - key = JsonGetName(schema_object, i); - temp_schema_value = JsonGet(schema_object, key); - temp_value = JsonGet(value_object, key); - if (temp_value == NULL) { - return JSON_RET_ERROR; - } - if (JsonValidate(temp_schema_value, temp_value) == JSON_RET_ERROR) { - return JSON_RET_ERROR; - } - } - return JSON_RET_OK; - case JSON_TYPE_STRING: case JSON_TYPE_NUMBER: case JSON_TYPE_BOOL: case JSON_TYPE_NULL: - return JSON_RET_OK; /* equality already tested before switch */ - case JSON_TYPE_ERROR: default: - return JSON_RET_ERROR; - } -} - -int JsonCmp(JSON_VALUE *a, JSON_VALUE *b) { - JSON_OBJECT *a_object = NULL, *b_object = NULL; - JSON_ARRAY *a_array = NULL, *b_array = NULL; - char *a_string = NULL, *b_string = NULL; - char *key = NULL; - UINT a_count = 0, b_count = 0, i = 0; - UINT a_type, b_type; - UINT64 a_num, b_num; - a_type = JsonValueGetType(a); - b_type = JsonValueGetType(b); - if (a_type != b_type) { - return 0; - } - switch (a_type) { - case JSON_TYPE_ARRAY: - a_array = JsonValueGetArray(a); - b_array = JsonValueGetArray(b); - a_count = JsonArrayGetCount(a_array); - b_count = JsonArrayGetCount(b_array); - if (a_count != b_count) { - return 0; - } - for (i = 0; i < a_count; i++) { - if (!JsonCmp(JsonArrayGet(a_array, i), - JsonArrayGet(b_array, i))) { - return 0; - } - } - return 1; - case JSON_TYPE_OBJECT: - a_object = JsonValueGetObject(a); - b_object = JsonValueGetObject(b); - a_count = JsonGetCount(a_object); - b_count = JsonGetCount(b_object); - if (a_count != b_count) { - return 0; - } - for (i = 0; i < a_count; i++) { - key = JsonGetName(a_object, i); - if (!JsonCmp(JsonGet(a_object, key), - JsonGet(b_object, key))) { - return 0; - } - } - return 1; - case JSON_TYPE_STRING: - a_string = JsonValueGetStr(a); - b_string = JsonValueGetStr(b); - if (a_string == NULL || b_string == NULL) { - return 0; /* shouldn't happen */ - } - return strcmp(a_string, b_string) == 0; - case JSON_TYPE_BOOL: - return JsonValueGetBool(a) == JsonValueGetBool(b); - case JSON_TYPE_NUMBER: - a_num = JsonValueGetNumber(a); - b_num = JsonValueGetNumber(b); - return a_num == b_num; - case JSON_TYPE_ERROR: - return 1; - case JSON_TYPE_NULL: - return 1; - default: - return 1; - } -} - -UINT JsonType(JSON_VALUE *value) { - return JsonValueGetType(value); -} - -JSON_OBJECT * JsonObject(JSON_VALUE *value) { - return JsonValueGetObject(value); -} - -JSON_ARRAY * JsonArray(JSON_VALUE *value) { - return JsonValueGetArray(value); -} - -char * JsonString(JSON_VALUE *value) { - return JsonValueGetStr(value); -} - -UINT64 JsonNumber(JSON_VALUE *value) { - return JsonValueGetNumber(value); -} - -int JsonBool(JSON_VALUE *value) { - return JsonValueGetBool(value); -} - -void JsonSetAllocationFunctions(JSON_Malloc_Function malloc_fun, JSON_Free_Function free_fun) { - parson_malloc = malloc_fun; - parson_free = free_fun; -} - -// SYSTEMTIME to JSON string -void SystemTimeToJsonStr(char *dst, UINT size, SYSTEMTIME *t) -{ - if (dst == NULL) - { - return; - } - - if (t == NULL) - { - ClearStr(dst, size); - } - else - { - GetDateTimeStrRFC3339(dst, size, t, 0); - } -} - -// UINT64 System Time to JSON string -void SystemTime64ToJsonStr(char *dst, UINT size, UINT64 t) -{ - SYSTEMTIME st; - if (dst == NULL) - { - return; - } - - if (t == 0) - { - ClearStr(dst, size); - } - - UINT64ToSystem(&st, t); - - SystemTimeToJsonStr(dst, size, &st); -} - - - - +// SoftEther VPN Source Code - Developer Edition Master Branch +// Mayaqua Kernel + + +// Str.c +// String processing routine + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +// Locking for call the token handling function +LOCK *token_lock = NULL; +static char *default_spliter = " ,\t\r\n"; + +typedef struct BYTESTR +{ + UINT64 base_value; + char *string; +} BYTESTR; + +static BYTESTR bytestr[] = +{ + {0, "PBytes"}, + {0, "TBytes"}, + {0, "GBytes"}, + {0, "MBytes"}, + {0, "KBytes"}, + {0, "Bytes"}, +}; + +// Decode URL string +char *UrlDecode(char *url_str) +{ + UINT i, len; + BUF *b; + char *ret; + if (url_str == NULL) + { + return NULL; + } + + len = StrLen(url_str); + + b = NewBuf(); + + for (i = 0;i < len;i++) + { + char c = url_str[i]; + + if (c == '%' && ((i + 2) < len)) + { + char hex_str[8]; + UINT value; + + hex_str[0] = url_str[i + 1]; + hex_str[1] = url_str[i + 2]; + hex_str[2] = 0; + + value = HexToInt(hex_str); + + WriteBufChar(b, (UCHAR)value); + + i += 2; + continue; + } + else + { + if (c == '+') + { + c = ' '; + } + WriteBufChar(b, c); + } + } + + WriteBufChar(b, 0); + + ret = CopyStr(b->Buf); + + FreeBuf(b); + + return ret; +} + +// Change the case of the string by the bit array +void SetStrCaseAccordingToBits(char *str, UINT bits) +{ + UINT i, len; + // Validate arguments + if (str == NULL) + { + return; + } + + len = StrLen(str); + + for (i = 0;i < len;i++) + { + char c = str[i]; + + if (bits & 0x01) + { + c = ToUpper(c); + } + else + { + c = ToLower(c); + } + + str[i] = c; + + bits = bits / 2; + } +} + +// Normalize the integer list string +void NormalizeIntListStr(char *dst, UINT dst_size, char *src, bool sorted, char *separate_str) +{ + LIST *o; + + o = StrToIntList(src, sorted); + + IntListToStr(dst, dst_size, o, separate_str); + + ReleaseIntList(o); +} + +// Convert the string to an integer list +LIST *StrToIntList(char *str, bool sorted) +{ + LIST *o; + TOKEN_LIST *t; + + o = NewIntList(sorted); + + t = ParseTokenWithoutNullStr(str, " ,/;\t"); + + if (t != NULL) + { + UINT i; + + for (i = 0;i < t->NumTokens;i++) + { + char *s = t->Token[i]; + + if (IsEmptyStr(s) == false) + { + if (IsNum(s)) + { + InsertIntDistinct(o, ToInt(s)); + } + } + } + + FreeToken(t); + } + + return o; +} + +// Convert an integer list to a string +void IntListToStr(char *str, UINT str_size, LIST *o, char *separate_str) +{ + UINT i; + ClearStr(str, str_size); + // Validate arguments + if (o == NULL) + { + return; + } + if (IsEmptyStr(separate_str)) + { + separate_str = ", "; + } + + for (i = 0;i < LIST_NUM(o);i++) + { + char tmp[MAX_SIZE]; + UINT *v = LIST_DATA(o, i); + + ToStr(tmp, *v); + + StrCat(str, str_size, tmp); + + if (i != (LIST_NUM(o) - 1)) + { + StrCat(str, str_size, separate_str); + } + } +} + +// Initialize the string +void ClearStr(char *str, UINT str_size) +{ + StrCpy(str, str_size, ""); +} + +// Search for the ASCII string in the binary data sequence +UINT SearchAsciiInBinary(void *data, UINT size, char *str, bool case_sensitive) +{ + UINT ret = INFINITE; + char *tmp; + // Validate arguments + if (data == NULL || size == 0 || str == NULL) + { + return INFINITE; + } + + tmp = ZeroMalloc(size + 1); + Copy(tmp, data, size); + + ret = SearchStrEx(tmp, str, 0, case_sensitive); + + Free(tmp); + + return ret; +} + +// Convert the HEX string to a 32 bit integer +UINT HexToInt(char *str) +{ + UINT len, i; + UINT ret = 0; + // Validate arguments + if (str == NULL) + { + return 0; + } + + if (str[0] == '0' && (str[1] == 'x' || str[1] == 'X')) + { + str += 2; + } + + len = StrLen(str); + for (i = 0;i < len;i++) + { + char c = str[i]; + + if ((c >= '0' && c <= '9') || (c >= 'a' && c <= 'f') || (c >= 'A' && c <= 'F')) + { + ret = ret * 16 + (UINT)HexTo4Bit(c); + } + else + { + break; + } + } + + return ret; +} + +// Convert a 32 bit integer into HEX +void ToHex(char *str, UINT value) +{ + char tmp[MAX_SIZE]; + UINT wp = 0; + UINT len, i; + // Validate arguments + if (str == NULL) + { + return; + } + + // Set to empty character + StrCpy(tmp, 0, ""); + + // Append from the last digit + while (true) + { + UINT a = (UINT)(value % (UINT)16); + value = value / (UINT)16; + tmp[wp++] = FourBitToHex(a); + if (value == 0) + { + tmp[wp++] = 0; + break; + } + } + + // Reverse order + len = StrLen(tmp); + for (i = 0;i < len;i++) + { + str[len - i - 1] = tmp[i]; + } + str[len] = 0; +} + +// Converts a 4 bit value to hexadecimal string +char FourBitToHex(UINT value) +{ + value = value % 16; + + if (value <= 9) + { + return '0' + value; + } + else + { + return 'a' + (value - 10); + } +} + +// Convert a hexadecimal string to a 4 bit integer +UINT HexTo4Bit(char c) +{ + if ('0' <= c && c <= '9') + { + return c - '0'; + } + else if ('a' <= c && c <= 'f') + { + return c - 'a' + 10; + } + else if ('A' <= c && c <= 'F') + { + return c - 'A' + 10; + } + else + { + return 0; + } +} + +// Get a standard token delimiter +char *DefaultTokenSplitChars() +{ + return " ,\t\r\n"; +} + +// Check whether the specified character is in the string +bool IsCharInStr(char *str, char c) +{ + UINT i, len; + // Validate arguments + if (str == NULL) + { + return false; + } + + len = StrLen(str); + for (i = 0;i < len;i++) + { + if (str[i] == c) + { + return true; + } + } + + return false; +} + +// Cut out the token from the string (not ignore the blanks between delimiters) +TOKEN_LIST *ParseTokenWithNullStr(char *str, char *split_chars) +{ + LIST *o; + UINT i, len; + BUF *b; + char zero = 0; + TOKEN_LIST *t; + // Validate arguments + if (str == NULL) + { + return NullToken(); + } + if (split_chars == NULL) + { + split_chars = DefaultTokenSplitChars(); + } + + b = NewBuf(); + o = NewListFast(NULL); + + len = StrLen(str); + + for (i = 0;i < (len + 1);i++) + { + char c = str[i]; + bool flag = IsCharInStr(split_chars, c); + + if (c == '\0') + { + flag = true; + } + + if (flag == false) + { + WriteBuf(b, &c, sizeof(char)); + } + else + { + WriteBuf(b, &zero, sizeof(char)); + + Insert(o, CopyStr((char *)b->Buf)); + ClearBuf(b); + } + } + + t = ZeroMalloc(sizeof(TOKEN_LIST)); + t->NumTokens = LIST_NUM(o); + t->Token = ZeroMalloc(sizeof(char *) * t->NumTokens); + + for (i = 0;i < t->NumTokens;i++) + { + t->Token[i] = LIST_DATA(o, i); + } + + ReleaseList(o); + FreeBuf(b); + + return t; +} + +// Check whether the string contains at least one of the specified tokens +bool InStrList(char *target_str, char *tokens, char *splitter, bool case_sensitive) +{ + TOKEN_LIST *t; + bool ret = false; + UINT i; + // Validate arguments + if (target_str == NULL || tokens == NULL || splitter == NULL) + { + return false; + } + + t = ParseTokenWithoutNullStr(tokens, splitter); + + if (t != NULL) + { + for (i = 0;i < t->NumTokens;i++) + { + if (InStrEx(target_str, t->Token[i], case_sensitive)) + { + ret = true; +// printf("%s\n", t->Token[i]); + } + + if (ret) + { + break; + } + } + + FreeToken(t); + } + + return ret; +} + +// Cut out the token from string (Ignore blanks between delimiters) +TOKEN_LIST *ParseTokenWithoutNullStr(char *str, char *split_chars) +{ + LIST *o; + UINT i, len; + bool last_flag; + BUF *b; + char zero = 0; + TOKEN_LIST *t; + // Validate arguments + if (str == NULL) + { + return NullToken(); + } + if (split_chars == NULL) + { + split_chars = DefaultTokenSplitChars(); + } + + b = NewBuf(); + o = NewListFast(NULL); + + len = StrLen(str); + last_flag = false; + + for (i = 0;i < (len + 1);i++) + { + char c = str[i]; + bool flag = IsCharInStr(split_chars, c); + + if (c == '\0') + { + flag = true; + } + + if (flag == false) + { + WriteBuf(b, &c, sizeof(char)); + } + else + { + if (last_flag == false) + { + WriteBuf(b, &zero, sizeof(char)); + + if ((StrLen((char *)b->Buf)) != 0) + { + Insert(o, CopyStr((char *)b->Buf)); + } + ClearBuf(b); + } + } + + last_flag = flag; + } + + t = ZeroMalloc(sizeof(TOKEN_LIST)); + t->NumTokens = LIST_NUM(o); + t->Token = ZeroMalloc(sizeof(char *) * t->NumTokens); + + for (i = 0;i < t->NumTokens;i++) + { + t->Token[i] = LIST_DATA(o, i); + } + + ReleaseList(o); + FreeBuf(b); + + return t; +} + +// Check whether the string is included +bool InStr(char *str, char *keyword) +{ + return InStrEx(str, keyword, false); +} +bool InStrEx(char *str, char *keyword, bool case_sensitive) +{ + // Validate arguments + if (IsEmptyStr(str) || IsEmptyStr(keyword)) + { + return false; + } + + if (SearchStrEx(str, keyword, 0, case_sensitive) == INFINITE) + { + return false; + } + + return true; +} + +// Get a value from the INI +UINT IniIntValue(LIST *o, char *key) +{ + INI_ENTRY *e; + // Validate arguments + if (o == NULL || key == NULL) + { + return 0; + } + + e = GetIniEntry(o, key); + if (e == NULL) + { + return 0; + } + + return ToInt(e->Value); +} +char *IniStrValue(LIST *o, char *key) +{ + INI_ENTRY *e; + // Validate arguments + if (o == NULL || key == NULL) + { + return 0; + } + + e = GetIniEntry(o, key); + if (e == NULL) + { + return ""; + } + + return e->Value; +} + +// Release the INI +void FreeIni(LIST *o) +{ + UINT i; + // Validate arguments + if (o == NULL) + { + return; + } + + for (i = 0;i < LIST_NUM(o);i++) + { + INI_ENTRY *e = LIST_DATA(o, i); + + Free(e->Key); + Free(e->Value); + Free(e->UnicodeValue); + + Free(e); + } + + ReleaseList(o); +} + +// Get an entry in the INI file +INI_ENTRY *GetIniEntry(LIST *o, char *key) +{ + UINT i; + // Validate arguments + if (o == NULL || key == NULL) + { + return NULL; + } + + for (i = 0;i < LIST_NUM(o);i++) + { + INI_ENTRY *e = LIST_DATA(o, i); + + if (StrCmpi(e->Key, key) == 0) + { + return e; + } + } + + return NULL; +} + +// Read an INI file +LIST *ReadIni(BUF *b) +{ + LIST *o; + // Validate arguments + if (b == NULL) + { + return NULL; + } + + o = NewListFast(NULL); + + SeekBuf(b, 0, 0); + + while (true) + { + char *line = CfgReadNextLine(b); + + if (line == NULL) + { + break; + } + + Trim(line); + + if (IsEmptyStr(line) == false) + { + if (StartWith(line, "#") == false && + StartWith(line, "//") == false && + StartWith(line, ";") == false) + { + char *key, *value; + UINT size = StrLen(line) + 1; + + key = ZeroMalloc(size); + value = ZeroMalloc(size); + + if (GetKeyAndValue(line, key, size, value, size, NULL)) + { + UINT uni_size; + INI_ENTRY *e = ZeroMalloc(sizeof(INI_ENTRY)); + e->Key = CopyStr(key); + e->Value = CopyStr(value); + + uni_size = CalcUtf8ToUni((BYTE *)value, StrLen(value)); + e->UnicodeValue = ZeroMalloc(uni_size); + Utf8ToUni(e->UnicodeValue, uni_size, (BYTE *)value, StrLen(value)); + + Add(o, e); + } + + Free(key); + Free(value); + } + } + + Free(line); + } + + return o; +} + +// Check whether the specified character is a delimiter +bool IsSplitChar(char c, char *split_str) +{ + UINT i, len; + char c_upper = ToUpper(c); + if (split_str == NULL) + { + split_str = default_spliter; + } + + len = StrLen(split_str); + + for (i = 0;i < len;i++) + { + if (ToUpper(split_str[i]) == c_upper) + { + return true; + } + } + + return false; +} + +// Get the keys and the value from the string +bool GetKeyAndValue(char *str, char *key, UINT key_size, char *value, UINT value_size, char *split_str) +{ + UINT mode = 0; + UINT wp1 = 0, wp2 = 0; + UINT i, len; + char *key_tmp, *value_tmp; + bool ret = false; + if (split_str == NULL) + { + split_str = default_spliter; + } + + len = StrLen(str); + + key_tmp = ZeroMalloc(len + 1); + value_tmp = ZeroMalloc(len + 1); + + for (i = 0;i < len;i++) + { + char c = str[i]; + + switch (mode) + { + case 0: + if (IsSplitChar(c, split_str) == false) + { + mode = 1; + key_tmp[wp1] = c; + wp1++; + } + break; + + case 1: + if (IsSplitChar(c, split_str) == false) + { + key_tmp[wp1] = c; + wp1++; + } + else + { + mode = 2; + } + break; + + case 2: + if (IsSplitChar(c, split_str) == false) + { + mode = 3; + value_tmp[wp2] = c; + wp2++; + } + break; + + case 3: + value_tmp[wp2] = c; + wp2++; + break; + } + } + + if (mode != 0) + { + ret = true; + StrCpy(key, key_size, key_tmp); + StrCpy(value, value_size, value_tmp); + } + + Free(key_tmp); + Free(value_tmp); + + return ret; +} + +// Generate a sequence of specified character +char *MakeCharArray(char c, UINT count) +{ + UINT i; + char *ret = Malloc(count + 1); + + for (i = 0;i < count;i++) + { + ret[i] = c; + } + + ret[count] = 0; + + return ret; +} +void MakeCharArray2(char *str, char c, UINT count) +{ + UINT i; + + for (i = 0;i < count;i++) + { + str[i] = c; + } + + str[count] = 0; +} + +// Get the width of the specified string +UINT StrWidth(char *str) +{ + wchar_t *s; + UINT ret; + // Validate arguments + if (str == NULL) + { + return 0; + } + + s = CopyStrToUni(str); + ret = UniStrWidth(s); + Free(s); + + return ret; +} + +// Check whether the specified string is all uppercase +bool IsAllUpperStr(char *str) +{ + UINT i, len; + // Validate arguments + if (str == NULL) + { + return false; + } + + len = StrLen(str); + + for (i = 0;i < len;i++) + { + char c = str[i]; + + if ((c >= '0' && c <= '9') || + (c >= 'A' && c <= 'Z')) + { + } + else + { + return false; + } + } + + return true; +} + +// Remove duplications from the token list +TOKEN_LIST *UniqueToken(TOKEN_LIST *t) +{ + UINT i, num, j, n; + TOKEN_LIST *ret; + // Validate arguments + if (t == NULL) + { + return NULL; + } + + num = 0; + for (i = 0;i < t->NumTokens;i++) + { + bool exists = false; + + for (j = 0;j < i;j++) + { + if (StrCmpi(t->Token[j], t->Token[i]) == 0) + { + exists = true; + break; + } + } + + if (exists == false) + { + num++; + } + } + + ret = ZeroMalloc(sizeof(TOKEN_LIST)); + ret->Token = ZeroMalloc(sizeof(char *) * num); + ret->NumTokens = num; + + n = 0; + + for (i = 0;i < t->NumTokens;i++) + { + bool exists = false; + + for (j = 0;j < i;j++) + { + if (StrCmpi(t->Token[j], t->Token[i]) == 0) + { + exists = true; + break; + } + } + + if (exists == false) + { + ret->Token[n++] = CopyStr(t->Token[i]); + } + } + + return ret; +} + +// Convert a value to a byte string (by 1,000) +void ToStrByte1000(char *str, UINT size, UINT64 v) +{ + UINT i; + // Validate arguments + if (str == NULL) + { + return; + } + + // Warning measures in gcc + bytestr[0].base_value = 1000000000UL; + bytestr[0].base_value *= 1000UL; + bytestr[0].base_value *= 1000UL; + bytestr[1].base_value = 1000000000UL; + bytestr[1].base_value *= 1000UL; + bytestr[2].base_value = 1000000000UL; + bytestr[3].base_value = 1000000UL; + bytestr[4].base_value = 1000UL; + bytestr[5].base_value = 0UL; + + for (i = 0;i < sizeof(bytestr) / sizeof(bytestr[0]);i++) + { + BYTESTR *b = &bytestr[i]; + + if ((v * 11UL) / 10UL >= b->base_value) + { + if (b->base_value != 0) + { + double d = (double)v / (double)b->base_value; + Format(str, size, "%.2f %s", d, b->string); + } + else + { + Format(str, size, "%I64u %s", v, b->string); + } + + break; + } + } +} + +// Convert a value to a byte string +void ToStrByte(char *str, UINT size, UINT64 v) +{ + UINT i; + // Validate arguments + if (str == NULL) + { + return; + } + + // Warning measures in gcc + bytestr[0].base_value = 1073741824UL; + bytestr[0].base_value *= 1024UL; + bytestr[0].base_value *= 1024UL; + bytestr[1].base_value = 1073741824UL; + bytestr[1].base_value *= 1024UL; + bytestr[2].base_value = 1073741824UL; + bytestr[3].base_value = 1048576UL; + bytestr[4].base_value = 1024UL; + bytestr[5].base_value = 0UL; + + for (i = 0;i < sizeof(bytestr) / sizeof(bytestr[0]);i++) + { + BYTESTR *b = &bytestr[i]; + + if ((v * 11UL) / 10UL >= b->base_value) + { + if (b->base_value != 0) + { + double d = (double)v / (double)b->base_value; + Format(str, size, "%.2f %s", d, b->string); + } + else + { + Format(str, size, "%I64u %s", v, b->string); + } + + break; + } + } +} + +// Convert the number to a string, and separate it with commas by three orders of magnitude +void ToStr3(char *str, UINT size, UINT64 v) +{ + char tmp[128]; + char tmp2[128]; + UINT i, len, wp; + // Validate arguments + if (str == NULL) + { + return; + } + + ToStr64(tmp, v); + + wp = 0; + len = StrLen(tmp); + + for (i = len - 1;((int)i) >= 0;i--) + { + tmp2[wp++] = tmp[i]; + } + tmp2[wp++] = 0; + + wp = 0; + + for (i = 0;i < len;i++) + { + if (i != 0 && (i % 3) == 0) + { + tmp[wp++] = ','; + } + tmp[wp++] = tmp2[i]; + } + tmp[wp++] = 0; + wp = 0; + len = StrLen(tmp); + + for (i = len - 1;((int)i) >= 0;i--) + { + tmp2[wp++] = tmp[i]; + } + tmp2[wp++] = 0; + + StrCpy(str, size, tmp2); +} + +// Convert the MAC address to a string +void MacToStr(char *str, UINT size, UCHAR *mac_address) +{ + // Validate arguments + if (str == NULL || mac_address == NULL) + { + return; + } + + Format(str, size, "%02X-%02X-%02X-%02X-%02X-%02X", + mac_address[0], + mac_address[1], + mac_address[2], + mac_address[3], + mac_address[4], + mac_address[5]); +} + +// Examine whether the string is empty +bool IsEmptyStr(char *str) +{ + char *s; + // Validate arguments + if (str == NULL) + { + return true; + } + + s = CopyStr(str); + Trim(s); + + if (StrLen(s) == 0) + { + Free(s); + return true; + } + else + { + Free(s); + return false; + } +} + +// Convert a string list to a token list +TOKEN_LIST *ListToTokenList(LIST *o) +{ + UINT i; + TOKEN_LIST *t; + // Validate arguments + if (o == NULL) + { + return NULL; + } + + t = ZeroMalloc(sizeof(TOKEN_LIST)); + t->NumTokens = LIST_NUM(o); + t->Token = ZeroMalloc(sizeof(char *) * t->NumTokens); + for (i = 0;i < LIST_NUM(o);i++) + { + t->Token[i] = CopyStr(LIST_DATA(o, i)); + } + + return t; +} + +// Free the string list +void FreeStrList(LIST *o) +{ + UINT i; + // Validate arguments + if (o == NULL) + { + return; + } + + for (i = 0;i < LIST_NUM(o);i++) + { + char *s = LIST_DATA(o, i); + Free(s); + } + + ReleaseList(o); +} + +// Convert a (NULL delimited) string to a list +LIST *StrToStrList(char *str, UINT size) +{ + LIST *o; + char *tmp; + UINT tmp_size; + UINT i; + // Validate arguments + if (str == NULL) + { + return NULL; + } + + o = NewListFast(NULL); + + i = 0; + while (true) + { + if (i >= size) + { + break; + } + if (*str == 0) + { + break; + } + + tmp_size = StrSize(str); + tmp = ZeroMalloc(tmp_size); + StrCpy(tmp, tmp_size, str); + Add(o, tmp); + str += StrLen(str) + 1; + i++; + } + + return o; +} + +// Check whether the specified string is a number +bool IsNum(char *str) +{ + char c; + UINT i, len; + UINT n = 0; + char tmp[MAX_SIZE]; + TOKEN_LIST *t; + // Validate arguments + if (str == NULL) + { + return false; + } + + StrCpy(tmp, sizeof(tmp), str); + Trim(tmp); + + if (StrLen(tmp) == 0) + { + return false; + } + + t = ParseToken(tmp, " "); + + if (t->NumTokens >= 1) + { + StrCpy(tmp, sizeof(tmp), t->Token[0]); + } + + FreeToken(t); + + len = StrLen(tmp); + for (i = 0;i < len;i++) + { + bool b = false; + c = tmp[i]; + if (('0' <= c && c <= '9') || (c == '+') || (c == '-') || (c == ',')) + { + b = true; + } + + if (b == false) + { + return false; + } + } + + for (i = 0;i < len;i++) + { + c = tmp[i]; + if (c == '-') + { + n++; + } + } + if (n >= 2) + { + return false; + } + + return true; +} + +// Empty token list +TOKEN_LIST *NullToken() +{ + TOKEN_LIST *ret = ZeroMalloc(sizeof(TOKEN_LIST)); + ret->Token = ZeroMalloc(0); + + return ret; +} + +// Copy the token list +TOKEN_LIST *CopyToken(TOKEN_LIST *src) +{ + TOKEN_LIST *ret; + UINT i; + // Validate arguments + if (src == NULL) + { + return NULL; + } + + ret = ZeroMalloc(sizeof(TOKEN_LIST)); + ret->NumTokens = src->NumTokens; + ret->Token = ZeroMalloc(sizeof(char *) * ret->NumTokens); + for (i = 0;i < ret->NumTokens;i++) + { + ret->Token[i] = CopyStr(src->Token[i]); + } + + return ret; +} + +// Parse the command line +TOKEN_LIST *ParseCmdLine(char *str) +{ + TOKEN_LIST *t; + LIST *o; + UINT i, len, wp, mode; + char c; + char *tmp; + bool ignore_space = false; + // Validate arguments + if (str == NULL) + { + // There is no token + return NullToken(); + } + + o = NewListFast(NULL); + tmp = Malloc(StrSize(str) + 32); + + wp = 0; + mode = 0; + + len = StrLen(str); + for (i = 0;i < len;i++) + { + c = str[i]; + + switch (mode) + { + case 0: + // Mode to discover the next token + if (c == ' ' || c == '\t') + { + // Advance to the next character + } + else + { + // Start of the token + if (c == '\"') + { + if (str[i + 1] == '\"') + { + // Regard "" as a single " + tmp[wp++] = '\"'; + i++; + } + else + { + // Enable the ignoring space flag for a single " + ignore_space = true; + } + } + else + { + tmp[wp++] = c; + } + + mode = 1; + } + break; + + case 1: + if (ignore_space == false && (c == ' ' || c == '\t')) + { + // End of the token + tmp[wp++] = 0; + wp = 0; + + Insert(o, CopyStr(tmp)); + mode = 0; + } + else + { + if (c == '\"') + { + if (str[i + 1] == '\"') + { + // Regard "" as a single " + tmp[wp++] = L'\"'; + i++; + } + else + { + if (ignore_space == false) + { + // Enable the ignoring space flag for a single " + ignore_space = true; + } + else + { + // Disable the space ignore flag + ignore_space = false; + } + } + } + else + { + tmp[wp++] = c; + } + } + break; + } + } + + if (wp != 0) + { + tmp[wp++] = 0; + Insert(o, CopyStr(tmp)); + } + + Free(tmp); + + t = ZeroMalloc(sizeof(TOKEN_LIST)); + t->NumTokens = LIST_NUM(o); + t->Token = ZeroMalloc(sizeof(char *) * t->NumTokens); + for (i = 0;i < t->NumTokens;i++) + { + t->Token[i] = LIST_DATA(o, i); + } + + ReleaseList(o); + + return t; +} + +// Convert a 64-bit integer to a string +void ToStr64(char *str, UINT64 value) +{ + char tmp[MAX_SIZE]; + UINT wp = 0; + UINT len, i; + // Validate arguments + if (str == NULL) + { + return; + } + + // Set to empty character + StrCpy(tmp, 0, ""); + + // Append from the last digit + while (true) + { + UINT a = (UINT)(value % (UINT64)10); + value = value / (UINT64)10; + tmp[wp++] = (char)('0' + a); + if (value == 0) + { + tmp[wp++] = 0; + break; + } + } + + // Reverse order + len = StrLen(tmp); + for (i = 0;i < len;i++) + { + str[len - i - 1] = tmp[i]; + } + str[len] = 0; +} + +// Convert a string to a 64-bit integer +UINT64 ToInt64(char *str) +{ + UINT len, i; + UINT64 ret = 0; + // Validate arguments + if (str == NULL) + { + return 0; + } + + len = StrLen(str); + for (i = 0;i < len;i++) + { + char c = str[i]; + if (c != ',') + { + if ('0' <= c && c <= '9') + { + ret = ret * (UINT64)10 + (UINT64)(c - '0'); + } + else + { + break; + } + } + } + + return ret; +} + + +UINT64 Json_ToInt64Ex(char *str, char **endptr, bool *error) +{ + UINT i; + UINT64 ret = 0; + if (error != NULL) *error = true; + // Validate arguments + if (str == NULL) + { + if (endptr != NULL) + { + *endptr = NULL; + } + return 0; + } + + for (i = 0;;i++) + { + char c = str[i]; + if (endptr != NULL) + { + *endptr = &str[i]; + } + if (c == 0) + { + break; + } + if ('0' <= c && c <= '9') + { + ret = ret * (UINT64)10 + (UINT64)(c - '0'); + if (error != NULL) *error = false; + } + else + { + break; + } + } + + return ret; +} + +// Trim EndWith +bool TrimEndWith(char *dst, UINT dst_size, char *str, char *key) +{ + if (dst == NULL || str == NULL) + { + ClearStr(dst, dst_size); + return false; + } + + StrCpy(dst, dst_size, str); + + if (EndWith(str, key)) + { + UINT src_len = StrLen(str); + UINT key_len = StrLen(key); + + if (src_len >= key_len) + { + dst[src_len - key_len] = 0; + } + + return true; + } + + return false; +} + +// Check whether the str ends with the key +bool EndWith(char *str, char *key) +{ + UINT str_len; + UINT key_len; + // Validate arguments + if (str == NULL || key == NULL) + { + return false; + } + + // Comparison + str_len = StrLen(str); + key_len = StrLen(key); + if (str_len < key_len) + { + return false; + } + + if (StrCmpi(str + (str_len - key_len), key) == 0) + { + return true; + } + else + { + return false; + } +} + +// Check whether the str starts with the key +bool StartWith(char *str, char *key) +{ + UINT str_len; + UINT key_len; + char *tmp; + bool ret; + // Validate arguments + if (str == NULL || key == NULL) + { + return false; + } + + // Comparison + str_len = StrLen(str); + key_len = StrLen(key); + if (str_len < key_len) + { + return false; + } + if (str_len == 0 || key_len == 0) + { + return false; + } + tmp = CopyStr(str); + tmp[key_len] = 0; + + if (StrCmpi(tmp, key) == 0) + { + ret = true; + } + else + { + ret = false; + } + + Free(tmp); + + return ret; +} + +// Display the binary data +void PrintBin(void *data, UINT size) +{ + char *tmp; + UINT i; + // Validate arguments + if (data == NULL) + { + return; + } + + i = size * 3 + 1; + tmp = Malloc(i); + BinToStrEx(tmp, i, data, size); + Print("%s\n", tmp); + Free(tmp); +} + +// Convert the string to a MAC address +bool StrToMac(UCHAR *mac_address, char *str) +{ + BUF *b; + // Validate arguments + if (mac_address == NULL || str == NULL) + { + return false; + } + + b = StrToBin(str); + if (b == NULL) + { + return false; + } + + if (b->Size != 6) + { + FreeBuf(b); + return false; + } + + Copy(mac_address, b->Buf, 6); + + FreeBuf(b); + + return true; +} + +// Convert a hexadecimal string to a binary data +BUF *StrToBin(char *str) +{ + BUF *b; + UINT len, i; + char tmp[3]; + // Validate arguments + if (str == NULL) + { + return NULL; + } + + len = StrLen(str); + tmp[0] = 0; + b = NewBuf(); + for (i = 0;i < len;i++) + { + char c = str[i]; + c = ToUpper(c); + if (('0' <= c && c <= '9') || ('A' <= c && c <= 'F')) + { + if (tmp[0] == 0) + { + tmp[0] = c; + tmp[1] = 0; + } + else if (tmp[1] == 0) + { + UCHAR data; + char tmp2[64]; + tmp[1] = c; + tmp[2] = 0; + StrCpy(tmp2, sizeof(tmp2), "0x"); + StrCat(tmp2, sizeof(tmp2), tmp); + data = (UCHAR)strtoul(tmp2, NULL, 0); + WriteBuf(b, &data, 1); + Zero(tmp, sizeof(tmp)); + } + } + else if (c == ' ' || c == ',' || c == '-' || c == ':') + { + // Do Nothing + } + else + { + break; + } + } + + return b; +} + +// Convert the binary data to a hexadecimal string (with space) +void BinToStrEx(char *str, UINT str_size, void *data, UINT data_size) +{ + char *tmp; + UCHAR *buf = (UCHAR *)data; + UINT size; + UINT i; + // Validate arguments + if (str == NULL || data == NULL) + { + return; + } + + // Calculation of size + size = data_size * 3 + 1; + // Memory allocation + tmp = ZeroMalloc(size); + // Conversion + for (i = 0;i < data_size;i++) + { + Format(&tmp[i * 3], 0, "%02X ", buf[i]); + } + Trim(tmp); + // Copy + StrCpy(str, str_size, tmp); + // Memory release + Free(tmp); +} +void BinToStrEx2(char *str, UINT str_size, void *data, UINT data_size, char padding_char) +{ + char *tmp; + UCHAR *buf = (UCHAR *)data; + UINT size; + UINT i; + // Validate arguments + if (str == NULL || data == NULL) + { + return; + } + + // Calculation of size + size = data_size * 3 + 1; + // Memory allocation + tmp = ZeroMalloc(size); + // Conversion + for (i = 0;i < data_size;i++) + { + Format(&tmp[i * 3], 0, "%02X%c", buf[i], padding_char); + } + if (StrLen(tmp) >= 1) + { + if (tmp[StrLen(tmp) - 1] == padding_char) + { + tmp[StrLen(tmp) - 1] = 0; + } + } + // Copy + StrCpy(str, str_size, tmp); + // Memory release + Free(tmp); +} +// Convert the binary data to a string, and copy it +char *CopyBinToStrEx(void *data, UINT data_size) +{ + char *ret; + UINT size; + // Validate arguments + if (data == NULL) + { + return NULL; + } + + size = data_size * 3 + 1; + ret = ZeroMalloc(size); + + BinToStrEx(ret, size, data, data_size); + + return ret; +} +char *CopyBinToStr(void *data, UINT data_size) +{ + char *ret; + UINT size; + // Validate arguments + if (data == NULL) + { + return NULL; + } + + size = data_size * 2 + 1; + ret = ZeroMalloc(size); + + BinToStr(ret, size, data, data_size); + + return ret; +} + +// Convert the binary data to a hexadecimal string +void BinToStr(char *str, UINT str_size, void *data, UINT data_size) +{ + char *tmp; + UCHAR *buf = (UCHAR *)data; + UINT size; + UINT i; + // Validate arguments + if (str == NULL || data == NULL) + { + if (str != NULL) + { + str[0] = 0; + } + return; + } + + // Calculation of size + size = data_size * 2 + 1; + // Memory allocation + tmp = ZeroMalloc(size); + // Conversion + for (i = 0;i < data_size;i++) + { + sprintf(&tmp[i * 2], "%02X", buf[i]); + } + // Copy + StrCpy(str, str_size, tmp); + // Memory release + Free(tmp); +} +void BinToStrW(wchar_t *str, UINT str_size, void *data, UINT data_size) +{ + char *tmp; + UINT tmp_size; + // Validate arguments + if (str == NULL || data == NULL) + { + if (str != NULL) + { + str[0] = 0; + } + return; + } + + tmp_size = (data_size * 2 + 4) * sizeof(wchar_t); + tmp = ZeroMalloc(tmp_size); + + BinToStr(tmp, tmp_size, data, data_size); + + StrToUni(str, str_size, tmp); + + Free(tmp); +} + +// Convert a 160-bit sequence into a string +void Bit160ToStr(char *str, UCHAR *data) +{ + // Validate arguments + if (str == NULL || data == NULL) + { + return; + } + + Format(str, 0, + "%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X", + data[0], data[1], data[2], data[3], data[4], data[5], data[6], data[7], data[8], data[9], + data[10], data[11], data[12], data[13], data[14], data[15], data[16], data[17], data[18], data[19]); +} + +// Copy a string +char *CopyStr(char *str) +{ + UINT len; + char *dst; + // Validate arguments + if (str == NULL) + { + return NULL; + } + + len = StrLen(str); + dst = Malloc(len + 1); + StrCpy(dst, len + 1, str); + return dst; +} + +// Check whether the string is safe +bool IsSafeStr(char *str) +{ + UINT i, len; + // Validate arguments + if (str == NULL) + { + return false; + } + + len = StrLen(str); + for (i = 0;i < len;i++) + { + if (IsSafeChar(str[i]) == false) + { + return false; + } + } + if (str[0] == ' ') + { + return false; + } + if (len != 0) + { + if (str[len - 1] == ' ') + { + return false; + } + } + return true; +} + +// Check whether the character can be displayed +bool IsPrintableAsciiChar(char c) +{ + UCHAR uc = (UCHAR)c; + if (uc <= 31) + { + return false; + } + if (uc >= 127) + { + return false; + } + return true; +} + +// Convert a string to a displayable string +void EnPrintableAsciiStr(char *str, char replace) +{ + UINT i, len; + // Validate arguments + if (str == NULL) + { + return; + } + + len = StrLen(str); + + for (i = 0;i < len;i++) + { + char c = str[i]; + + if (IsPrintableAsciiChar(c) == false) + { + str[i] = replace; + } + } +} + +// Check whether the character is safe +bool IsSafeChar(char c) +{ + UINT i, len; + char *check_str = + "ABCDEFGHIJKLMNOPQRSTUVWXYZ" + "abcdefghijklmnopqrstuvwxyz" + "0123456789" + " ()-_#%&."; + + len = StrLen(check_str); + for (i = 0;i < len;i++) + { + if (c == check_str[i]) + { + return true; + } + } + return false; +} + +// Remove the specified character from a string +void TruncateCharFromStr(char *str, char replace) +{ + char *src,*dst; + + if (str == NULL) + { + return; + } + + src = dst = str; + + while(*src != '\0') + { + if(*src != replace) + { + *dst = *src; + dst++; + } + src++; + } + *dst = *src; + + //BUF *b = NewBuf(); + //UINT i, len; + //char zero = 0; + + //len = StrLen(str); + //for (i = 0;i < len;i++) + //{ + // char c = str[i]; + + // if (c != replace) + // { + // WriteBuf(b, &c, 1); + // } + //} + + //if (b->Size == 0) + //{ + // char c = '_'; + // WriteBuf(b, &c, 1); + //} + + //WriteBuf(b, &zero, 1); + + //StrCpy(str, 0, b->Buf); + + //FreeBuf(b); +} + +// Replace the unsafe characters +void EnSafeStr(char *str, char replace) +{ + if (str == NULL) + { + return; + } + + while(*str != '\0') + { + if(IsSafeChar(*str) == false) + { + *str = replace; + } + str++; + } +} + +// Replace '\r' and '\n' with the specified character. +// If the specified character is a space (unsafe), the original character is removed. +void EnSafeHttpHeaderValueStr(char *str, char replace) +{ + UINT length = 0; + UINT index = 0; + + // Validate arguments + if (str == NULL) + { + return; + } + + length = StrLen(str); + while (index < length) + { + if (str[index] == '\r' || str[index] == '\n') + { + if (replace == ' ') + { + Move(&str[index], &str[index + 1], length - index); + } + else + { + str[index] = replace; + } + } + else if (str[index] == '\\') + { + if (str[index + 1] == 'r' || str[index + 1] == 'n') + { + if (replace == ' ') + { + Move(&str[index], &str[index + 2], length - index); + index--; + } + else + { + str[index] = str[index + 1] = replace; + index++; + } + } + } + index++; + } +} + +// Operation check of string library +bool CheckStringLibrary() +{ + wchar_t *compare_str = L"TEST_TEST_123_123456789012345"; + char *teststr = "TEST"; + wchar_t *testunistr = L"TEST"; + wchar_t tmp[64]; + UINT i1 = 123; + UINT64 i2 = 123456789012345ULL; + + UniFormat(tmp, sizeof(tmp), L"%S_%s_%u_%I64u", teststr, testunistr, + i1, i2); + + if (UniStrCmpi(tmp, compare_str) != 0) + { + return false; + } + + return true; +} + +// Initialize the string library +void InitStringLibrary() +{ + // Create a lock for token + token_lock = NewLock(); + + // Initialization of the International Library + InitInternational(); + + // Operation check + if (CheckStringLibrary() == false) + { +#ifdef OS_WIN32 + Alert("String Library Init Failed.\r\nPlease check your locale settings.", NULL); +#else // OS_WIN32 + Alert("String Library Init Failed.\r\nPlease check your locale settings and iconv() libraries.", NULL); +#endif // OS_WIN32 + exit(0); + } +} + +// Release of the string library +void FreeStringLibrary() +{ + // Release of the International Library + FreeInternational(); + + // Release of the lock for token + DeleteLock(token_lock); + token_lock = NULL; +} + +// String replaceing (case insensitive) +UINT ReplaceStri(char *dst, UINT size, char *string, char *old_keyword, char *new_keyword) +{ + return ReplaceStrEx(dst, size, string, old_keyword, new_keyword, false); +} + +// String replaceing (case sensitive) +UINT ReplaceStr(char *dst, UINT size, char *string, char *old_keyword, char *new_keyword) +{ + return ReplaceStrEx(dst, size, string, old_keyword, new_keyword, true); +} + +// String replaceing +UINT ReplaceStrEx(char *dst, UINT size, char *string, char *old_keyword, char *new_keyword, bool case_sensitive) +{ + UINT i, j, num; + UINT len_string, len_old, len_new; + UINT len_ret; + UINT wp; + char *ret; + // Validate arguments + if (string == NULL || old_keyword == NULL || new_keyword == NULL) + { + return 0; + } + + // Get the length of the string + len_string = StrLen(string); + len_old = StrLen(old_keyword); + len_new = StrLen(new_keyword); + + // Calculate the final string length + len_ret = CalcReplaceStrEx(string, old_keyword, new_keyword, case_sensitive); + // Memory allocation + ret = Malloc(len_ret + 1); + ret[len_ret] = '\0'; + + // Search and Replace + i = 0; + j = 0; + num = 0; + wp = 0; + while (true) + { + i = SearchStrEx(string, old_keyword, i, case_sensitive); + if (i == INFINITE) + { + Copy(ret + wp, string + j, len_string - j); + wp += len_string - j; + break; + } + num++; + Copy(ret + wp, string + j, i - j); + wp += i - j; + Copy(ret + wp, new_keyword, len_new); + wp += len_new; + i += len_old; + j = i; + } + + // Copy of the search results + StrCpy(dst, size, ret); + + // Memory release + Free(ret); + + return num; +} + +// Calculate the length of the result of string replacement +UINT CalcReplaceStrEx(char *string, char *old_keyword, char *new_keyword, bool case_sensitive) +{ + UINT i, num; + UINT len_string, len_old, len_new; + // Validate arguments + if (string == NULL || old_keyword == NULL || new_keyword == NULL) + { + return 0; + } + + // Get the length of the string + len_string = StrLen(string); + len_old = StrLen(old_keyword); + len_new = StrLen(new_keyword); + + if (len_old == len_new) + { + return len_string; + } + + // Search + num = 0; + i = 0; + while (true) + { + i = SearchStrEx(string, old_keyword, i, case_sensitive); + if (i == INFINITE) + { + break; + } + i += len_old; + num++; + } + + // Calculation + return len_string + len_new * num - len_old * num; +} + +// Search for a string (distinguish between upper / lower case) +UINT SearchStr(char *string, char *keyword, UINT start) +{ + return SearchStrEx(string, keyword, start, true); +} + +// Return the position of the first found keyword in the string +// (Found at first character: returns 0, Not found: returns INFINITE) +UINT SearchStrEx(char *string, char *keyword, UINT start, bool case_sensitive) +{ + UINT len_string, len_keyword; + UINT i; + char *cmp_string, *cmp_keyword; + bool found; + // Validate arguments + if (string == NULL || keyword == NULL) + { + return INFINITE; + } + + // Get the length of string + len_string = StrLen(string); + if (len_string <= start) + { + // Value of start is invalid + return INFINITE; + } + + // Get the length of the keyword + len_keyword = StrLen(keyword); + if (len_keyword == 0) + { + // There is no keyword in the string + return INFINITE; + } + + if ((len_string - start) < len_keyword) + { + // The keyword is longer than the string + return INFINITE; + } + + if (case_sensitive) + { + cmp_string = string; + cmp_keyword = keyword; + } + else + { + cmp_string = Malloc(len_string + 1); + StrCpy(cmp_string, len_string + 1, string); + cmp_keyword = Malloc(len_keyword + 1); + StrCpy(cmp_keyword, len_keyword + 1, keyword); + StrUpper(cmp_string); + StrUpper(cmp_keyword); + } + + // Search + found = false; + for (i = start;i < (len_string - len_keyword + 1);i++) + { + // Compare + if (!strncmp(&cmp_string[i], cmp_keyword, len_keyword)) + { + // Found + found = true; + break; + } + } + + if (case_sensitive == false) + { + // Memory release + Free(cmp_keyword); + Free(cmp_string); + } + + if (found == false) + { + return INFINITE; + } + return i; +} + +// Determine whether the specified character is in the token list +bool IsInToken(TOKEN_LIST *t, char *str) +{ + UINT i; + // Validate arguments + if (t == NULL || str == NULL) + { + return false; + } + + for (i = 0;i < t->NumTokens;i++) + { + if (StrCmpi(t->Token[i], str) == 0) + { + return true; + } + } + + return false; +} + +// Release of the token list +void FreeToken(TOKEN_LIST *tokens) +{ + UINT i; + if (tokens == NULL) + { + return; + } + for (i = 0;i < tokens->NumTokens;i++) + { + if (tokens->Token[i] != 0) + { + Free(tokens->Token[i]); + } + } + Free(tokens->Token); + Free(tokens); +} + +// Parse the token +TOKEN_LIST *ParseToken(char *src, char *separator) +{ + // 2020/7/20 remove strtok by dnobori + return ParseTokenWithoutNullStr(src, separator); +} + +// Get a line from standard input +bool GetLine(char *str, UINT size) +{ + bool ret; + wchar_t *unistr; + UINT unistr_size = (size + 1) * sizeof(wchar_t); + + unistr = Malloc(unistr_size); + + ret = UniGetLine(unistr, unistr_size); + + UniToStr(str, size, unistr); + + Free(unistr); + + return ret; +} + +// Remove '\r' and '\n' at the end +void TrimCrlf(char *str) +{ + UINT len; + // Validate arguments + if (str == NULL) + { + return; + } + len = StrLen(str); + if (len == 0) + { + return; + } + + if (str[len - 1] == '\n') + { + if (len >= 2 && str[len - 2] == '\r') + { + str[len - 2] = 0; + } + str[len - 1] = 0; + } + else if (str[len - 1] == '\r') + { + str[len - 1] = 0; + } +} + +// Remove quotes at the beginning and at the end of the string +void TrimQuotes(char *str) +{ + UINT len = 0; + // Validate arguments + if (str == NULL) + { + return; + } + + len = StrLen(str); + if (len == 0) + { + return; + } + + if (str[len - 1] == '\"') + { + str[len - 1] = 0; + } + + if (str[0] == '\"') + { + Move(str, str + 1, len); + } +} + +// Remove white spaces of the both side of the string +void Trim(char *str) +{ + // Validate arguments + if (str == NULL) + { + return; + } + + // Trim on the left side + TrimLeft(str); + + // Trim on the right side + TrimRight(str); +} + +// Remove white spaces on the right side of the string +void TrimRight(char *str) +{ + char *buf, *tmp; + UINT len, i, wp, wp2; + // Validate arguments + if (str == NULL) + { + return; + } + len = StrLen(str); + if (len == 0) + { + return; + } + if (str[len - 1] != ' ' && str[len - 1] != '\t') + { + return; + } + + buf = Malloc(len + 1); + tmp = Malloc(len + 1); + wp = 0; + wp2 = 0; + for (i = 0; i < len; ++i) + { + if (str[i] != ' ' && str[i] != '\t') + { + Copy(buf + wp, tmp, wp2); + wp += wp2; + wp2 = 0; + buf[wp++] = str[i]; + } + else + { + tmp[wp2++] = str[i]; + } + } + buf[wp] = 0; + StrCpy(str, 0, buf); + Free(buf); + Free(tmp); +} + +// Remove white spaces from the left side of the string +void TrimLeft(char *str) +{ + char *buf; + UINT len, i, wp; + bool flag; + // Validate arguments + if (str == NULL) + { + return; + } + len = StrLen(str); + if (len == 0) + { + return; + } + if (str[0] != ' ' && str[0] != '\t') + { + return; + } + + buf = Malloc(len + 1); + flag = false; + wp = 0; + for (i = 0;i < len;i++) + { + if (str[i] != ' ' && str[i] != '\t') + { + flag = true; + } + if (flag) + { + buf[wp++] = str[i]; + } + } + buf[wp] = 0; + StrCpy(str, 0, buf); + Free(buf); +} + +// Convert an integer to a string +void ToStr(char *str, UINT i) +{ + sprintf(str, "%u", i); +} + +// Convert the string to a signed integer +int ToInti(char *str) +{ + // Validate arguments + if (str == NULL) + { + return 0; + } + + return (int)ToInt(str); +} + +// Convert a string to a Boolean value +bool ToBool(char *str) +{ + char tmp[MAX_SIZE]; + // Validate arguments + if (str == NULL) + { + return false; + } + + StrCpy(tmp, sizeof(tmp), str); + Trim(tmp); + + if (IsEmptyStr(tmp)) + { + return false; + } + + if (ToInt(tmp) != 0) + { + return true; + } + + if (StartWith("true", tmp)) + { + return true; + } + + if (StartWith("yes", tmp)) + { + return true; + } + + if (StartWith(tmp, "true")) + { + return true; + } + + if (StartWith(tmp, "yes")) + { + return true; + } + + return false; +} + +// Convert a string to an integer +UINT ToInt(char *str) +{ + // Validate arguments + if (str == NULL) + { + return 0; + } + + // Ignore the octal literal + while (true) + { + if (*str != '0') + { + break; + } + if ((*(str + 1) == 'x') || (*(str + 1) == 'X')) + { + break; + } + str++; + } + + return (UINT)strtoul(str, NULL, 0); +} + +// Display the string on the screen +void PrintStr(char *str) +{ + wchar_t *unistr = NULL; + // Validate arguments + if (str == NULL) + { + return; + } + +#ifdef OS_UNIX + fputs(str, stdout); +#else // OS_UNIX + unistr = CopyStrToUni(str); + UniPrintStr(unistr); + Free(unistr); +#endif // OS_UNIX +} + +// Display a string with arguments +void PrintArgs(char *fmt, va_list args) +{ + wchar_t *ret; + wchar_t *fmt_wchar; + char *tmp; + // Validate arguments + if (fmt == NULL) + { + return; + } + + fmt_wchar = CopyStrToUni(fmt); + ret = InternalFormatArgs(fmt_wchar, args, true); + + tmp = CopyUniToStr(ret); + PrintStr(tmp); + Free(tmp); + + Free(ret); + Free(fmt_wchar); +} + +// Display a string +void Print(char *fmt, ...) +{ + va_list args; + if (fmt == NULL) + { + return; + } + + va_start(args, fmt); + PrintArgs(fmt, args); + va_end(args); +} + +// Display a debug string with arguments +void DebugArgs(char *fmt, va_list args) +{ + // Validate arguments + if (fmt == NULL) + { + return; + } + if (g_debug == false) + { + return; + } + + PrintArgs(fmt, args); +} + +// Display a debug string +void Debug(char *fmt, ...) +{ + va_list args; + // Validate arguments + if (fmt == NULL) + { + return; + } + if (g_debug == false) + { + return; + } + + va_start(args, fmt); + + DebugArgs(fmt, args); + + va_end(args); +} + +// Format the string +void Format(char *buf, UINT size, char *fmt, ...) +{ + va_list args; + // Validate arguments + if (buf == NULL || fmt == NULL) + { + return; + } + + va_start(args, fmt); + FormatArgs(buf, size, fmt, args); + va_end(args); +} + +// Format the string (argument list) +void FormatArgs(char *buf, UINT size, char *fmt, va_list args) +{ + wchar_t *tag; + wchar_t *ret; + // Validate arguments + if (buf == NULL || fmt == NULL) + { + return; + } + + tag = CopyStrToUni(fmt); + ret = InternalFormatArgs(tag, args, true); + + UniToStr(buf, size, ret); + Free(ret); + Free(tag); +} + +// Compare the strings in case-insensitive mode +int StrCmpi(char *str1, char *str2) +{ + UINT i; + // Validate arguments + if (str1 == NULL && str2 == NULL) + { + return 0; + } + if (str1 == NULL) + { + return 1; + } + if (str2 == NULL) + { + return -1; + } + + // String comparison + i = 0; + while (true) + { + char c1, c2; + c1 = ToUpper(str1[i]); + c2 = ToUpper(str2[i]); + if (c1 > c2) + { + return 1; + } + else if (c1 < c2) + { + return -1; + } + if (str1[i] == 0 || str2[i] == 0) + { + return 0; + } + i++; + } +} + +// Compare the string +int StrCmp(char *str1, char *str2) +{ + // Validate arguments + if (str1 == NULL && str2 == NULL) + { + return 0; + } + if (str1 == NULL) + { + return 1; + } + if (str2 == NULL) + { + return -1; + } + + return strcmp(str1, str2); +} + +// Uncapitalize the string +void StrLower(char *str) +{ + UINT len, i; + // Validate arguments + if (str == NULL) + { + return; + } + + len = StrLen(str); + for (i = 0;i < len;i++) + { + str[i] = ToLower(str[i]); + } +} + +// Capitalize the string +void StrUpper(char *str) +{ + UINT len, i; + // Validate arguments + if (str == NULL) + { + return; + } + + len = StrLen(str); + for (i = 0;i < len;i++) + { + str[i] = ToUpper(str[i]); + } +} + +// Uncapitalize a character +char ToLower(char c) +{ + if ('A' <= c && c <= 'Z') + { + c += 'z' - 'Z'; + } + return c; +} + +// Capitalize a character +char ToUpper(char c) +{ + if ('a' <= c && c <= 'z') + { + c += 'Z' - 'z'; + } + return c; +} + +// Combine the string +UINT StrCat(char *dst, UINT size, char *src) +{ + UINT len1, len2, len_test; + // Validate arguments + if (dst == NULL || src == NULL) + { + return 0; + } + + // KS + KS_INC(KS_STRCAT_COUNT); + + if (size == 0) + { + // Ignore the length + size = 0x7fffffff; + } + + len1 = StrLen(dst); + len2 = StrLen(src); + len_test = len1 + len2 + 1; + if (len_test > size) + { + if (len2 <= (len_test - size)) + { + return 0; + } + len2 -= len_test - size; + } + Copy(dst + len1, src, len2); + dst[len1 + len2] = 0; + + return len1 + len2; +} +UINT StrCatLeft(char *dst, UINT size, char *src) +{ + char *s; + // Validate arguments + if (dst == NULL || src == NULL) + { + return 0; + } + + s = CopyStr(dst); + StrCpy(dst, size, src); + StrCat(dst, size, s); + + Free(s); + + return StrLen(dst); +} + +// Copy a string +UINT StrCpy(char *dst, UINT size, char *src) +{ + UINT len; + // Validate arguments + if (dst == src) + { + return StrLen(src); + } + if (dst == NULL || src == NULL) + { + if (src == NULL && dst != NULL) + { + if (size >= 1) + { + dst[0] = '\0'; + } + } + return 0; + } + if (size == 1) + { + dst[0] = '\0'; + return 0; + } + if (size == 0) + { + // Ignore the length + size = 0x7fffffff; + } + + // Check the length + len = StrLen(src); + if (len <= (size - 1)) + { + Copy(dst, src, len + 1); + } + else + { + len = size - 1; + Copy(dst, src, len); + dst[len] = '\0'; + } + + // KS + KS_INC(KS_STRCPY_COUNT); + + return len; +} +UINT StrCpyAllowOverlap(char *dst, UINT size, char *src) +{ + UINT len; + // Validate arguments + if (dst == src) + { + return StrLen(src); + } + if (dst == NULL || src == NULL) + { + if (src == NULL && dst != NULL) + { + if (size >= 1) + { + dst[0] = '\0'; + } + } + return 0; + } + if (size == 1) + { + dst[0] = '\0'; + return 0; + } + if (size == 0) + { + // Ignore the length + size = 0x7fffffff; + } + + // Check the length + len = StrLen(src); + if (len <= (size - 1)) + { + Move(dst, src, len + 1); + } + else + { + len = size - 1; + Move(dst, src, len); + dst[len] = '\0'; + } + + // KS + KS_INC(KS_STRCPY_COUNT); + + return len; +} + +// Make sure that the string is within the specified length +bool StrCheckLen(char *str, UINT len) +{ + UINT count = 0; + UINT i; + // Validate arguments + if (str == NULL) + { + return false; + } + + // KS + KS_INC(KS_STRCHECK_COUNT); + + for (i = 0;;i++) + { + if (str[i] == '\0') + { + return true; + } + count++; + if (count > len) + { + return false; + } + } +} + +// Get the memory size needed to store the string +UINT StrSize(char *str) +{ + // Validate arguments + if (str == NULL) + { + return 0; + } + + return StrLen(str) + 1; +} + +// Get the length of the string +UINT StrLen(char *str) +{ + // Validate arguments + if (str == NULL) + { + return 0; + } + + // KS + KS_INC(KS_STRLEN_COUNT); + + return (UINT)strlen(str); +} + + + + + + +// *** JSON strings support +// Original source code from Parson ( http://kgabis.github.com/parson/ ) +// Modified by dnobori +/* +Parson ( http://kgabis.github.com/parson/ ) +Copyright (c) 2012 - 2017 Krzysztof Gabis + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. +*/ + + + +/* Apparently sscanf is not implemented in some "standard" libraries, so don't use it, if you +* don't have to. */ +#define sscanf THINK_TWICE_ABOUT_USING_SSCANF + +#define STARTING_CAPACITY 16 +#define MAX_NESTING 2048 +#define FLOAT_FORMAT "%1.17g" + +#define SIZEOF_TOKEN(a) (sizeof(a) - 1) +#define SKIP_CHAR(str) ((*str)++) +#define SKIP_WHITESPACES(str) while (isspace((unsigned char)(**str))) { SKIP_CHAR(str); } + +static JSON_Malloc_Function parson_malloc = Malloc; +static JSON_Free_Function parson_free = Free; + +#define IS_CONT(b) (((unsigned char)(b) & 0xC0) == 0x80) /* is utf-8 continuation byte */ + +/* Various */ +static void remove_comments(char *string, char *start_token, char *end_token); +static char * parson_strndup(char *string, UINT n); +static char * parson_strdup(char *string); +static int hex_char_to_int(char c); +static int parse_utf16_hex(char *string, unsigned int *result); +static int num_bytes_in_utf8_sequence(unsigned char c); +static int verify_utf8_sequence(unsigned char *string, int *len); +static int is_valid_utf8(char *string, UINT string_len); +static int is_decimal(char *string, UINT length); + +/* JSON Object */ +static JSON_OBJECT * json_object_init(JSON_VALUE *wrapping_value); +static UINT json_object_add(JSON_OBJECT *object, char *name, JSON_VALUE *value); +static UINT json_object_resize(JSON_OBJECT *object, UINT new_capacity); +static JSON_VALUE * json_object_nget_value(JSON_OBJECT *object, char *name, UINT n); +static void json_object_free(JSON_OBJECT *object); + +/* JSON Array */ +static JSON_ARRAY * json_array_init(JSON_VALUE *wrapping_value); +static UINT json_array_add(JSON_ARRAY *array, JSON_VALUE *value); +static UINT json_array_resize(JSON_ARRAY *array, UINT new_capacity); +static void json_array_free(JSON_ARRAY *array); + +/* JSON Value */ +static JSON_VALUE * json_value_init_string_no_copy(char *string); + +/* Parser */ +static UINT skip_quotes(char **string); +static int parse_utf16(char **unprocessed, char **processed); +static char * process_string(char *input, UINT len); +static char * get_quoted_string(char **string); +static JSON_VALUE * parse_object_value(char **string, UINT nesting); +static JSON_VALUE * parse_array_value(char **string, UINT nesting); +static JSON_VALUE * parse_string_value(char **string); +static JSON_VALUE * parse_boolean_value(char **string); +static JSON_VALUE * parse_number_value(char **string); +static JSON_VALUE * parse_null_value(char **string); +static JSON_VALUE * parse_value(char **string, UINT nesting); + +/* Serialization */ +static int json_serialize_to_buffer_r(JSON_VALUE *value, char *buf, int level, int is_pretty, char *num_buf); +static int json_serialize_string(char *string, char *buf); +static int append_indent(char *buf, int level); +static int append_string(char *buf, char *string); + +/* Various */ +static char * parson_strndup(char *string, UINT n) { + char *output_string = (char*)parson_malloc(n + 1); + if (!output_string) { + return NULL; + } + output_string[n] = '\0'; + strncpy(output_string, string, n); + return output_string; +} + +static char * parson_strdup(char *string) { + return parson_strndup(string, StrLen(string)); +} + +static int hex_char_to_int(char c) { + if (c >= '0' && c <= '9') { + return c - '0'; + } + else if (c >= 'a' && c <= 'f') { + return c - 'a' + 10; + } + else if (c >= 'A' && c <= 'F') { + return c - 'A' + 10; + } + return -1; +} + +static int parse_utf16_hex(char *s, unsigned int *result) { + int x1, x2, x3, x4; + if (s[0] == '\0' || s[1] == '\0' || s[2] == '\0' || s[3] == '\0') { + return 0; + } + x1 = hex_char_to_int(s[0]); + x2 = hex_char_to_int(s[1]); + x3 = hex_char_to_int(s[2]); + x4 = hex_char_to_int(s[3]); + if (x1 == -1 || x2 == -1 || x3 == -1 || x4 == -1) { + return 0; + } + *result = (unsigned int)((x1 << 12) | (x2 << 8) | (x3 << 4) | x4); + return 1; +} + +static int num_bytes_in_utf8_sequence(unsigned char c) { + if (c == 0xC0 || c == 0xC1 || c > 0xF4 || IS_CONT(c)) { + return 0; + } + else if ((c & 0x80) == 0) { /* 0xxxxxxx */ + return 1; + } + else if ((c & 0xE0) == 0xC0) { /* 110xxxxx */ + return 2; + } + else if ((c & 0xF0) == 0xE0) { /* 1110xxxx */ + return 3; + } + else if ((c & 0xF8) == 0xF0) { /* 11110xxx */ + return 4; + } + return 0; /* won't happen */ +} + +static int verify_utf8_sequence(unsigned char *string, int *len) { + unsigned int cp = 0; + *len = num_bytes_in_utf8_sequence(string[0]); + + if (*len == 1) { + cp = string[0]; + } + else if (*len == 2 && IS_CONT(string[1])) { + cp = string[0] & 0x1F; + cp = (cp << 6) | (string[1] & 0x3F); + } + else if (*len == 3 && IS_CONT(string[1]) && IS_CONT(string[2])) { + cp = ((unsigned char)string[0]) & 0xF; + cp = (cp << 6) | (string[1] & 0x3F); + cp = (cp << 6) | (string[2] & 0x3F); + } + else if (*len == 4 && IS_CONT(string[1]) && IS_CONT(string[2]) && IS_CONT(string[3])) { + cp = string[0] & 0x7; + cp = (cp << 6) | (string[1] & 0x3F); + cp = (cp << 6) | (string[2] & 0x3F); + cp = (cp << 6) | (string[3] & 0x3F); + } + else { + return 0; + } + + /* overlong encodings */ + if ((cp < 0x80 && *len > 1) || + (cp < 0x800 && *len > 2) || + (cp < 0x10000 && *len > 3)) { + return 0; + } + + /* invalid unicode */ + if (cp > 0x10FFFF) { + return 0; + } + + /* surrogate halves */ + if (cp >= 0xD800 && cp <= 0xDFFF) { + return 0; + } + + return 1; +} + +static int is_valid_utf8(char *string, UINT string_len) { + int len = 0; + char *string_end = string + string_len; + while (string < string_end) { + if (!verify_utf8_sequence((unsigned char*)string, &len)) { + return 0; + } + string += len; + } + return 1; +} + +static int is_decimal(char *string, UINT length) { + if (length > 1 && string[0] == '0' && string[1] != '.') { + return 0; + } + if (length > 2 && !strncmp(string, "-0", 2) && string[2] != '.') { + return 0; + } + while (length--) { + if (strchr("xX", string[length])) { + return 0; + } + } + return 1; +} + +static void remove_comments(char *string, char *start_token, char *end_token) { + int in_string = 0, escaped = 0; + UINT i; + char *ptr = NULL, current_char; + UINT start_token_len = StrLen(start_token); + UINT end_token_len = StrLen(end_token); + if (start_token_len == 0 || end_token_len == 0) { + return; + } + while ((current_char = *string) != '\0') { + if (current_char == '\\' && !escaped) { + escaped = 1; + string++; + continue; + } + else if (current_char == '\"' && !escaped) { + in_string = !in_string; + } + else if (!in_string && strncmp(string, start_token, start_token_len) == 0) { + for (i = 0; i < start_token_len; i++) { + string[i] = ' '; + } + string = string + start_token_len; + ptr = strstr(string, end_token); + if (!ptr) { + return; + } + for (i = 0; i < (ptr - string) + end_token_len; i++) { + string[i] = ' '; + } + string = ptr + end_token_len - 1; + } + escaped = 0; + string++; + } +} + +/* JSON Object */ +static JSON_OBJECT * json_object_init(JSON_VALUE *wrapping_value) { + JSON_OBJECT *new_obj = (JSON_OBJECT*)parson_malloc(sizeof(JSON_OBJECT)); + if (new_obj == NULL) { + return NULL; + } + new_obj->wrapping_value = wrapping_value; + new_obj->names = (char**)NULL; + new_obj->values = (JSON_VALUE**)NULL; + new_obj->capacity = 0; + new_obj->count = 0; + return new_obj; +} + +static UINT json_object_add(JSON_OBJECT *object, char *name, JSON_VALUE *value) { + UINT index = 0; + if (object == NULL || name == NULL || value == NULL) { + return JSON_RET_ERROR; + } + if (JsonGet(object, name) != NULL) { + return JSON_RET_ERROR; + } + if (object->count >= object->capacity) { + UINT new_capacity = MAX(object->capacity * 2, STARTING_CAPACITY); + if (json_object_resize(object, new_capacity) == JSON_RET_ERROR) { + return JSON_RET_ERROR; + } + } + index = object->count; + object->names[index] = parson_strdup(name); + if (object->names[index] == NULL) { + return JSON_RET_ERROR; + } + value->parent = JsonGetWrappingValue(object); + object->values[index] = value; + object->count++; + return JSON_RET_OK; +} + +static UINT json_object_resize(JSON_OBJECT *object, UINT new_capacity) { + char **temp_names = NULL; + JSON_VALUE **temp_values = NULL; + + if ((object->names == NULL && object->values != NULL) || + (object->names != NULL && object->values == NULL) || + new_capacity == 0) { + return JSON_RET_ERROR; /* Shouldn't happen */ + } + temp_names = (char**)parson_malloc(new_capacity * sizeof(char*)); + if (temp_names == NULL) { + return JSON_RET_ERROR; + } + temp_values = (JSON_VALUE**)parson_malloc(new_capacity * sizeof(JSON_VALUE*)); + if (temp_values == NULL) { + parson_free(temp_names); + return JSON_RET_ERROR; + } + if (object->names != NULL && object->values != NULL && object->count > 0) { + memcpy(temp_names, object->names, object->count * sizeof(char*)); + memcpy(temp_values, object->values, object->count * sizeof(JSON_VALUE*)); + } + parson_free(object->names); + parson_free(object->values); + object->names = temp_names; + object->values = temp_values; + object->capacity = new_capacity; + return JSON_RET_OK; +} + +static JSON_VALUE * json_object_nget_value(JSON_OBJECT *object, char *name, UINT n) { + UINT i, name_length; + for (i = 0; i < JsonGetCount(object); i++) { + name_length = StrLen(object->names[i]); + if (name_length != n) { + continue; + } + if (strncmp(object->names[i], name, n) == 0) { + return object->values[i]; + } + } + return NULL; +} + +static void json_object_free(JSON_OBJECT *object) { + UINT i; + for (i = 0; i < object->count; i++) { + parson_free(object->names[i]); + JsonFree(object->values[i]); + } + parson_free(object->names); + parson_free(object->values); + parson_free(object); +} + +/* JSON Array */ +static JSON_ARRAY * json_array_init(JSON_VALUE *wrapping_value) { + JSON_ARRAY *new_array = (JSON_ARRAY*)parson_malloc(sizeof(JSON_ARRAY)); + if (new_array == NULL) { + return NULL; + } + new_array->wrapping_value = wrapping_value; + new_array->items = (JSON_VALUE**)NULL; + new_array->capacity = 0; + new_array->count = 0; + return new_array; +} + +static UINT json_array_add(JSON_ARRAY *array, JSON_VALUE *value) { + if (array->count >= array->capacity) { + UINT new_capacity = MAX(array->capacity * 2, STARTING_CAPACITY); + if (json_array_resize(array, new_capacity) == JSON_RET_ERROR) { + return JSON_RET_ERROR; + } + } + value->parent = JsonArrayGetWrappingValue(array); + array->items[array->count] = value; + array->count++; + return JSON_RET_OK; +} + +static UINT json_array_resize(JSON_ARRAY *array, UINT new_capacity) { + JSON_VALUE **new_items = NULL; + if (new_capacity == 0) { + return JSON_RET_ERROR; + } + new_items = (JSON_VALUE**)parson_malloc(new_capacity * sizeof(JSON_VALUE*)); + if (new_items == NULL) { + return JSON_RET_ERROR; + } + if (array->items != NULL && array->count > 0) { + memcpy(new_items, array->items, array->count * sizeof(JSON_VALUE*)); + } + parson_free(array->items); + array->items = new_items; + array->capacity = new_capacity; + return JSON_RET_OK; +} + +static void json_array_free(JSON_ARRAY *array) { + UINT i; + for (i = 0; i < array->count; i++) { + JsonFree(array->items[i]); + } + parson_free(array->items); + parson_free(array); +} + +/* JSON Value */ +static JSON_VALUE * json_value_init_string_no_copy(char *string) { + JSON_VALUE *new_value = (JSON_VALUE*)parson_malloc(sizeof(JSON_VALUE)); + if (!new_value) { + return NULL; + } + new_value->parent = NULL; + new_value->type = JSON_TYPE_STRING; + new_value->value.string = string; + return new_value; +} + +/* Parser */ +static UINT skip_quotes(char **string) { + if (**string != '\"') { + return JSON_RET_ERROR; + } + SKIP_CHAR(string); + while (**string != '\"') { + if (**string == '\0') { + return JSON_RET_ERROR; + } + else if (**string == '\\') { + SKIP_CHAR(string); + if (**string == '\0') { + return JSON_RET_ERROR; + } + } + SKIP_CHAR(string); + } + SKIP_CHAR(string); + return JSON_RET_OK; +} + +static int parse_utf16(char **unprocessed, char **processed) { + unsigned int cp, lead, trail; + int parse_succeeded = 0; + char *processed_ptr = *processed; + char *unprocessed_ptr = *unprocessed; + unprocessed_ptr++; /* skips u */ + parse_succeeded = parse_utf16_hex(unprocessed_ptr, &cp); + if (!parse_succeeded) { + return JSON_RET_ERROR; + } + if (cp < 0x80) { + processed_ptr[0] = (char)cp; /* 0xxxxxxx */ + } + else if (cp < 0x800) { + processed_ptr[0] = ((cp >> 6) & 0x1F) | 0xC0; /* 110xxxxx */ + processed_ptr[1] = ((cp) & 0x3F) | 0x80; /* 10xxxxxx */ + processed_ptr += 1; + } + else if (cp < 0xD800 || cp > 0xDFFF) { + processed_ptr[0] = ((cp >> 12) & 0x0F) | 0xE0; /* 1110xxxx */ + processed_ptr[1] = ((cp >> 6) & 0x3F) | 0x80; /* 10xxxxxx */ + processed_ptr[2] = ((cp) & 0x3F) | 0x80; /* 10xxxxxx */ + processed_ptr += 2; + } + else if (cp >= 0xD800 && cp <= 0xDBFF) { /* lead surrogate (0xD800..0xDBFF) */ + lead = cp; + unprocessed_ptr += 4; /* should always be within the buffer, otherwise previous sscanf would fail */ + if (*unprocessed_ptr++ != '\\' || *unprocessed_ptr++ != 'u') { + return JSON_RET_ERROR; + } + parse_succeeded = parse_utf16_hex(unprocessed_ptr, &trail); + if (!parse_succeeded || trail < 0xDC00 || trail > 0xDFFF) { /* valid trail surrogate? (0xDC00..0xDFFF) */ + return JSON_RET_ERROR; + } + cp = ((((lead - 0xD800) & 0x3FF) << 10) | ((trail - 0xDC00) & 0x3FF)) + 0x010000; + processed_ptr[0] = (((cp >> 18) & 0x07) | 0xF0); /* 11110xxx */ + processed_ptr[1] = (((cp >> 12) & 0x3F) | 0x80); /* 10xxxxxx */ + processed_ptr[2] = (((cp >> 6) & 0x3F) | 0x80); /* 10xxxxxx */ + processed_ptr[3] = (((cp) & 0x3F) | 0x80); /* 10xxxxxx */ + processed_ptr += 3; + } + else { /* trail surrogate before lead surrogate */ + return JSON_RET_ERROR; + } + unprocessed_ptr += 3; + *processed = processed_ptr; + *unprocessed = unprocessed_ptr; + return JSON_RET_OK; +} + + +/* Copies and processes passed string up to supplied length. +Example: "\u006Corem ipsum" -> lorem ipsum */ +static char* process_string(char *input, UINT len) { + char *input_ptr = input; + UINT initial_size = (len + 1) * sizeof(char); + UINT final_size = 0; + char *output = NULL, *output_ptr = NULL, *resized_output = NULL; + output = (char*)parson_malloc(initial_size); + if (output == NULL) { + goto error; + } + output_ptr = output; + while ((*input_ptr != '\0') && (UINT)(input_ptr - input) < len) { + if (*input_ptr == '\\') { + input_ptr++; + switch (*input_ptr) { + case '\"': *output_ptr = '\"'; break; + case '\\': *output_ptr = '\\'; break; + case '/': *output_ptr = '/'; break; + case 'b': *output_ptr = '\b'; break; + case 'f': *output_ptr = '\f'; break; + case 'n': *output_ptr = '\n'; break; + case 'r': *output_ptr = '\r'; break; + case 't': *output_ptr = '\t'; break; + case 'u': + if (parse_utf16(&input_ptr, &output_ptr) == JSON_RET_ERROR) { + goto error; + } + break; + default: + goto error; + } + } + else if ((unsigned char)*input_ptr < 0x20) { + goto error; /* 0x00-0x19 are invalid characters for json string (http://www.ietf.org/rfc/rfc4627.txt) */ + } + else { + *output_ptr = *input_ptr; + } + output_ptr++; + input_ptr++; + } + *output_ptr = '\0'; + /* resize to new length */ + final_size = (UINT)(output_ptr - output) + 1; + /* todo: don't resize if final_size == initial_size */ + resized_output = (char*)parson_malloc(final_size); + if (resized_output == NULL) { + goto error; + } + memcpy(resized_output, output, final_size); + parson_free(output); + return resized_output; +error: + parson_free(output); + return NULL; +} + +/* Return processed contents of a string between quotes and +skips passed argument to a matching quote. */ +static char * get_quoted_string(char **string) { + char *string_start = *string; + UINT string_len = 0; + UINT status = skip_quotes(string); + if (status != JSON_RET_OK) { + return NULL; + } + string_len = (UINT)(*string - string_start - 2); /* length without quotes */ + return process_string(string_start + 1, string_len); +} + +static JSON_VALUE * parse_value(char **string, UINT nesting) { + if (nesting > MAX_NESTING) { + return NULL; + } + SKIP_WHITESPACES(string); + switch (**string) { + case '{': + return parse_object_value(string, nesting + 1); + case '[': + return parse_array_value(string, nesting + 1); + case '\"': + return parse_string_value(string); + case 'f': case 't': + return parse_boolean_value(string); + case '-': + case '0': case '1': case '2': case '3': case '4': + case '5': case '6': case '7': case '8': case '9': + return parse_number_value(string); + case 'n': + return parse_null_value(string); + default: + return NULL; + } +} + +static JSON_VALUE * parse_object_value(char **string, UINT nesting) { + JSON_VALUE *output_value = JsonNewObject(), *new_value = NULL; + JSON_OBJECT *output_object = JsonValueGetObject(output_value); + char *new_key = NULL; + if (output_value == NULL || **string != '{') { + return NULL; + } + SKIP_CHAR(string); + SKIP_WHITESPACES(string); + if (**string == '}') { /* empty object */ + SKIP_CHAR(string); + return output_value; + } + while (**string != '\0') { + new_key = get_quoted_string(string); + if (new_key == NULL) { + JsonFree(output_value); + return NULL; + } + SKIP_WHITESPACES(string); + if (**string != ':') { + parson_free(new_key); + JsonFree(output_value); + return NULL; + } + SKIP_CHAR(string); + new_value = parse_value(string, nesting); + if (new_value == NULL) { + parson_free(new_key); + JsonFree(output_value); + return NULL; + } + if (json_object_add(output_object, new_key, new_value) == JSON_RET_ERROR) { + parson_free(new_key); + JsonFree(new_value); + JsonFree(output_value); + return NULL; + } + parson_free(new_key); + SKIP_WHITESPACES(string); + if (**string != ',') { + break; + } + SKIP_CHAR(string); + SKIP_WHITESPACES(string); + } + SKIP_WHITESPACES(string); + if (**string != '}' || /* Trim object after parsing is over */ + json_object_resize(output_object, JsonGetCount(output_object)) == JSON_RET_ERROR) { + JsonFree(output_value); + return NULL; + } + SKIP_CHAR(string); + return output_value; +} + +static JSON_VALUE * parse_array_value(char **string, UINT nesting) { + JSON_VALUE *output_value = JsonNewArray(), *new_array_value = NULL; + JSON_ARRAY *output_array = JsonValueGetArray(output_value); + if (!output_value || **string != '[') { + return NULL; + } + SKIP_CHAR(string); + SKIP_WHITESPACES(string); + if (**string == ']') { /* empty array */ + SKIP_CHAR(string); + return output_value; + } + while (**string != '\0') { + new_array_value = parse_value(string, nesting); + if (new_array_value == NULL) { + JsonFree(output_value); + return NULL; + } + if (json_array_add(output_array, new_array_value) == JSON_RET_ERROR) { + JsonFree(new_array_value); + JsonFree(output_value); + return NULL; + } + SKIP_WHITESPACES(string); + if (**string != ',') { + break; + } + SKIP_CHAR(string); + SKIP_WHITESPACES(string); + } + SKIP_WHITESPACES(string); + if (**string != ']' || /* Trim array after parsing is over */ + json_array_resize(output_array, JsonArrayGetCount(output_array)) == JSON_RET_ERROR) { + JsonFree(output_value); + return NULL; + } + SKIP_CHAR(string); + return output_value; +} + +static JSON_VALUE * parse_string_value(char **string) { + JSON_VALUE *value = NULL; + char *new_string = get_quoted_string(string); + if (new_string == NULL) { + return NULL; + } + value = json_value_init_string_no_copy(new_string); + if (value == NULL) { + parson_free(new_string); + return NULL; + } + return value; +} + +static JSON_VALUE * parse_boolean_value(char **string) { + UINT true_token_size = SIZEOF_TOKEN("true"); + UINT false_token_size = SIZEOF_TOKEN("false"); + if (strncmp("true", *string, true_token_size) == 0) { + *string += true_token_size; + return JsonNewBool(1); + } + else if (strncmp("false", *string, false_token_size) == 0) { + *string += false_token_size; + return JsonNewBool(0); + } + return NULL; +} + +static JSON_VALUE * parse_number_value(char **string) { + char *end; + bool error = false; + UINT64 number = 0; + number = Json_ToInt64Ex(*string, &end, &error); + + if (error) + { + return NULL; + } + *string = end; + return JsonNewNumber(number); +} + +static JSON_VALUE * parse_null_value(char **string) { + UINT token_size = SIZEOF_TOKEN("null"); + if (strncmp("null", *string, token_size) == 0) { + *string += token_size; + return JsonNewNull(); + } + return NULL; +} + +/* Serialization */ +#define APPEND_STRING(str) do { written = append_string(buf, (str));\ + if (written < 0) { return -1; }\ + if (buf != NULL) { buf += written; }\ + written_total += written; } while(0) + +#define APPEND_INDENT(level) do { written = append_indent(buf, (level));\ + if (written < 0) { return -1; }\ + if (buf != NULL) { buf += written; }\ + written_total += written; } while(0) + +static int json_serialize_to_buffer_r(JSON_VALUE *value, char *buf, int level, int is_pretty, char *num_buf) +{ + char *key = NULL, *string = NULL; + JSON_VALUE *temp_value = NULL; + JSON_ARRAY *array = NULL; + JSON_OBJECT *object = NULL; + UINT i = 0, count = 0; + UINT64 num = 0; + int written = -1, written_total = 0; + char tmp[32]; + + switch (JsonValueGetType(value)) { + case JSON_TYPE_ARRAY: + array = JsonValueGetArray(value); + count = JsonArrayGetCount(array); + APPEND_STRING("["); + if (count > 0 && is_pretty) { + APPEND_STRING("\n"); + } + for (i = 0; i < count; i++) { + if (is_pretty) { + APPEND_INDENT(level + 1); + } + temp_value = JsonArrayGet(array, i); + written = json_serialize_to_buffer_r(temp_value, buf, level + 1, is_pretty, num_buf); + if (written < 0) { + return -1; + } + if (buf != NULL) { + buf += written; + } + written_total += written; + if (i < (count - 1)) { + APPEND_STRING(","); + } + if (is_pretty) { + APPEND_STRING("\n"); + } + } + if (count > 0 && is_pretty) { + APPEND_INDENT(level); + } + APPEND_STRING("]"); + return written_total; + case JSON_TYPE_OBJECT: + object = JsonValueGetObject(value); + count = JsonGetCount(object); + APPEND_STRING("{"); + if (count > 0 && is_pretty) { + APPEND_STRING("\n"); + } + for (i = 0; i < count; i++) { + key = JsonGetName(object, i); + if (key == NULL) { + return -1; + } + if (is_pretty) { + APPEND_INDENT(level + 1); + } + written = json_serialize_string(key, buf); + if (written < 0) { + return -1; + } + if (buf != NULL) { + buf += written; + } + written_total += written; + APPEND_STRING(":"); + if (is_pretty) { + APPEND_STRING(" "); + } + temp_value = JsonGet(object, key); + written = json_serialize_to_buffer_r(temp_value, buf, level + 1, is_pretty, num_buf); + if (written < 0) { + return -1; + } + if (buf != NULL) { + buf += written; + } + written_total += written; + if (i < (count - 1)) { + APPEND_STRING(","); + } + if (is_pretty) { + APPEND_STRING("\n"); + } + } + if (count > 0 && is_pretty) { + APPEND_INDENT(level); + } + APPEND_STRING("}"); + return written_total; + case JSON_TYPE_STRING: + string = JsonValueGetStr(value); + if (string == NULL) { + return -1; + } + written = json_serialize_string(string, buf); + if (written < 0) { + return -1; + } + if (buf != NULL) { + buf += written; + } + written_total += written; + return written_total; + case JSON_TYPE_BOOL: + if (JsonValueGetBool(value)) { + APPEND_STRING("true"); + } + else { + APPEND_STRING("false"); + } + return written_total; + case JSON_TYPE_NUMBER: + num = JsonValueGetNumber(value); + if (buf != NULL) { + num_buf = buf; + } + ToStr64(tmp, num); + Copy(num_buf, tmp, StrLen(tmp)); + written = StrLen(tmp); + if (buf != NULL) { + buf += written; + } + written_total += written; + return written_total; + case JSON_TYPE_NULL: + APPEND_STRING("null"); + return written_total; + case JSON_TYPE_ERROR: + return -1; + default: + return -1; + } +} + +static int json_serialize_string(char *string, char *buf) { + UINT i = 0, len = StrLen(string); + char c = '\0'; + int written = -1, written_total = 0; + APPEND_STRING("\""); + for (i = 0; i < len; i++) { + c = string[i]; + switch (c) { + case '\"': APPEND_STRING("\\\""); break; + case '\\': APPEND_STRING("\\\\"); break; + case '/': APPEND_STRING("\\/"); break; /* to make json embeddable in xml\/html */ + case '\b': APPEND_STRING("\\b"); break; + case '\f': APPEND_STRING("\\f"); break; + case '\n': APPEND_STRING("\\n"); break; + case '\r': APPEND_STRING("\\r"); break; + case '\t': APPEND_STRING("\\t"); break; + case '\x00': APPEND_STRING("\\u0000"); break; + case '\x01': APPEND_STRING("\\u0001"); break; + case '\x02': APPEND_STRING("\\u0002"); break; + case '\x03': APPEND_STRING("\\u0003"); break; + case '\x04': APPEND_STRING("\\u0004"); break; + case '\x05': APPEND_STRING("\\u0005"); break; + case '\x06': APPEND_STRING("\\u0006"); break; + case '\x07': APPEND_STRING("\\u0007"); break; + /* '\x08' duplicate: '\b' */ + /* '\x09' duplicate: '\t' */ + /* '\x0a' duplicate: '\n' */ + case '\x0b': APPEND_STRING("\\u000b"); break; + /* '\x0c' duplicate: '\f' */ + /* '\x0d' duplicate: '\r' */ + case '\x0e': APPEND_STRING("\\u000e"); break; + case '\x0f': APPEND_STRING("\\u000f"); break; + case '\x10': APPEND_STRING("\\u0010"); break; + case '\x11': APPEND_STRING("\\u0011"); break; + case '\x12': APPEND_STRING("\\u0012"); break; + case '\x13': APPEND_STRING("\\u0013"); break; + case '\x14': APPEND_STRING("\\u0014"); break; + case '\x15': APPEND_STRING("\\u0015"); break; + case '\x16': APPEND_STRING("\\u0016"); break; + case '\x17': APPEND_STRING("\\u0017"); break; + case '\x18': APPEND_STRING("\\u0018"); break; + case '\x19': APPEND_STRING("\\u0019"); break; + case '\x1a': APPEND_STRING("\\u001a"); break; + case '\x1b': APPEND_STRING("\\u001b"); break; + case '\x1c': APPEND_STRING("\\u001c"); break; + case '\x1d': APPEND_STRING("\\u001d"); break; + case '\x1e': APPEND_STRING("\\u001e"); break; + case '\x1f': APPEND_STRING("\\u001f"); break; + default: + if (buf != NULL) { + buf[0] = c; + buf += 1; + } + written_total += 1; + break; + } + } + APPEND_STRING("\""); + return written_total; +} + +static int append_indent(char *buf, int level) { + int i; + int written = -1, written_total = 0; + for (i = 0; i < level; i++) { + APPEND_STRING(" "); + } + return written_total; +} + +static int append_string(char *buf, char *string) { + if (buf == NULL) { + return (int)strlen(string); + } + return sprintf(buf, "%s", string); +} + +#undef APPEND_STRING +#undef APPEND_INDENT + +JSON_VALUE * JsonParseString(char *string) { + if (string == NULL) { + return NULL; + } + if (string[0] == '\xEF' && string[1] == '\xBB' && string[2] == '\xBF') { + string = string + 3; /* Support for UTF-8 BOM */ + } + return parse_value((char**)&string, 0); +} + +JSON_VALUE * JsonParseStringWithComments(char *string) { + JSON_VALUE *result = NULL; + char *string_mutable_copy = NULL, *string_mutable_copy_ptr = NULL; + string_mutable_copy = parson_strdup(string); + if (string_mutable_copy == NULL) { + return NULL; + } + remove_comments(string_mutable_copy, "/*", "*/"); + remove_comments(string_mutable_copy, "//", "\n"); + string_mutable_copy_ptr = string_mutable_copy; + result = parse_value((char**)&string_mutable_copy_ptr, 0); + parson_free(string_mutable_copy); + return result; +} + +/* JSON Object API */ + +JSON_VALUE * JsonGet(JSON_OBJECT *object, char *name) { + if (object == NULL || name == NULL) { + return NULL; + } + return json_object_nget_value(object, name, StrLen(name)); +} + +char * JsonGetStr(JSON_OBJECT *object, char *name) { + return JsonValueGetStr(JsonGet(object, name)); +} + +UINT64 JsonGetNumber(JSON_OBJECT *object, char *name) { + return JsonValueGetNumber(JsonGet(object, name)); +} + +JSON_OBJECT * JsonGetObj(JSON_OBJECT *object, char *name) { + return JsonValueGetObject(JsonGet(object, name)); +} + +JSON_ARRAY * JsonGetArray(JSON_OBJECT *object, char *name) { + return JsonValueGetArray(JsonGet(object, name)); +} + +bool JsonGetBool(JSON_OBJECT *object, char *name) { + return JsonValueGetBool(JsonGet(object, name)); +} + +JSON_VALUE * JsonDotGet(JSON_OBJECT *object, char *name) { + char *dot_position = strchr(name, '.'); + if (!dot_position) { + return JsonGet(object, name); + } + object = JsonValueGetObject(json_object_nget_value(object, name, (UINT)(dot_position - name))); + return JsonDotGet(object, dot_position + 1); +} + +char * JsonDotGetStr(JSON_OBJECT *object, char *name) { + return JsonValueGetStr(JsonDotGet(object, name)); +} + +UINT64 JsonDotGetNumber(JSON_OBJECT *object, char *name) { + return JsonValueGetNumber(JsonDotGet(object, name)); +} + +JSON_OBJECT * JsonDotGetObj(JSON_OBJECT *object, char *name) { + return JsonValueGetObject(JsonDotGet(object, name)); +} + +JSON_ARRAY * JsonDotGetArray(JSON_OBJECT *object, char *name) { + return JsonValueGetArray(JsonDotGet(object, name)); +} + +bool JsonDotGetBool(JSON_OBJECT *object, char *name) { + return JsonValueGetBool(JsonDotGet(object, name)); +} + +UINT JsonGetCount(JSON_OBJECT *object) { + return object ? object->count : 0; +} + +char * JsonGetName(JSON_OBJECT *object, UINT index) { + if (object == NULL || index >= JsonGetCount(object)) { + return NULL; + } + return object->names[index]; +} + +JSON_VALUE * JsonGetValueAt(JSON_OBJECT *object, UINT index) { + if (object == NULL || index >= JsonGetCount(object)) { + return NULL; + } + return object->values[index]; +} + +JSON_VALUE *JsonGetWrappingValue(JSON_OBJECT *object) { + return object->wrapping_value; +} + +int JsonIsExists(JSON_OBJECT *object, char *name) { + return JsonGet(object, name) != NULL; +} + +int JsonIsExistsWithValueType(JSON_OBJECT *object, char *name, UINT type) { + JSON_VALUE *val = JsonGet(object, name); + return val != NULL && JsonValueGetType(val) == type; +} + +int JsonDotIsExists(JSON_OBJECT *object, char *name) { + return JsonDotGet(object, name) != NULL; +} + +int JsonDotIsExistsWithValueType(JSON_OBJECT *object, char *name, UINT type) { + JSON_VALUE *val = JsonDotGet(object, name); + return val != NULL && JsonValueGetType(val) == type; +} + +/* JSON Array API */ +JSON_VALUE * JsonArrayGet(JSON_ARRAY *array, UINT index) { + if (array == NULL || index >= JsonArrayGetCount(array)) { + return NULL; + } + return array->items[index]; +} + +char * JsonArrayGetStr(JSON_ARRAY *array, UINT index) { + return JsonValueGetStr(JsonArrayGet(array, index)); +} + +UINT64 JsonArrayGetNumber(JSON_ARRAY *array, UINT index) { + return JsonValueGetNumber(JsonArrayGet(array, index)); +} + +JSON_OBJECT * JsonArrayGetObj(JSON_ARRAY *array, UINT index) { + return JsonValueGetObject(JsonArrayGet(array, index)); +} + +JSON_ARRAY * JsonArrayGetArray(JSON_ARRAY *array, UINT index) { + return JsonValueGetArray(JsonArrayGet(array, index)); +} + +bool JsonArrayGetBool(JSON_ARRAY *array, UINT index) { + return JsonValueGetBool(JsonArrayGet(array, index)); +} + +UINT JsonArrayGetCount(JSON_ARRAY *array) { + return array ? array->count : 0; +} + +JSON_VALUE * JsonArrayGetWrappingValue(JSON_ARRAY *array) { + return array->wrapping_value; +} + +/* JSON Value API */ +UINT JsonValueGetType(JSON_VALUE *value) { + return value ? value->type : JSON_TYPE_ERROR; +} + +JSON_OBJECT * JsonValueGetObject(JSON_VALUE *value) { + if (value == NULL) + { + return NULL; + } + return JsonValueGetType(value) == JSON_TYPE_OBJECT ? value->value.object : NULL; +} + +JSON_ARRAY * JsonValueGetArray(JSON_VALUE *value) { + return JsonValueGetType(value) == JSON_TYPE_ARRAY ? value->value.array : NULL; +} + +char * JsonValueGetStr(JSON_VALUE *value) { + return JsonValueGetType(value) == JSON_TYPE_STRING ? value->value.string : NULL; +} + +UINT64 JsonValueGetNumber(JSON_VALUE *value) { + return JsonValueGetType(value) == JSON_TYPE_NUMBER ? value->value.number : 0; +} + +bool JsonValueGetBool(JSON_VALUE *value) { + return JsonValueGetType(value) == JSON_TYPE_BOOL ? value->value.boolean : 0; +} + +JSON_VALUE * JsonValueGetParent(JSON_VALUE *value) { + return value ? value->parent : NULL; +} + +void JsonFree(JSON_VALUE *value) { + if (value == NULL) + { + return; + } + switch (JsonValueGetType(value)) { + case JSON_TYPE_OBJECT: + json_object_free(value->value.object); + break; + case JSON_TYPE_STRING: + parson_free(value->value.string); + break; + case JSON_TYPE_ARRAY: + json_array_free(value->value.array); + break; + default: + break; + } + parson_free(value); +} + +JSON_VALUE * JsonNewObject(void) { + JSON_VALUE *new_value = (JSON_VALUE*)parson_malloc(sizeof(JSON_VALUE)); + if (!new_value) { + return NULL; + } + new_value->parent = NULL; + new_value->type = JSON_TYPE_OBJECT; + new_value->value.object = json_object_init(new_value); + if (!new_value->value.object) { + parson_free(new_value); + return NULL; + } + return new_value; +} + +JSON_VALUE * JsonNewArray(void) { + JSON_VALUE *new_value = (JSON_VALUE*)parson_malloc(sizeof(JSON_VALUE)); + if (!new_value) { + return NULL; + } + new_value->parent = NULL; + new_value->type = JSON_TYPE_ARRAY; + new_value->value.array = json_array_init(new_value); + if (!new_value->value.array) { + parson_free(new_value); + return NULL; + } + return new_value; +} + +JSON_VALUE * JsonNewStr(char *string) { + char *copy = NULL; + JSON_VALUE *value; + UINT string_len = 0; + if (string == NULL) { + return NULL; + } + string_len = StrLen(string); + if (!is_valid_utf8(string, string_len)) { + return NULL; + } + copy = parson_strndup(string, string_len); + if (copy == NULL) { + return NULL; + } + value = json_value_init_string_no_copy(copy); + if (value == NULL) { + parson_free(copy); + } + return value; +} + +JSON_VALUE * JsonNewNumber(UINT64 number) { + JSON_VALUE *new_value = NULL; + new_value = (JSON_VALUE*)parson_malloc(sizeof(JSON_VALUE)); + if (new_value == NULL) { + return NULL; + } + new_value->parent = NULL; + new_value->type = JSON_TYPE_NUMBER; + new_value->value.number = number; + return new_value; +} + +JSON_VALUE * JsonNewBool(int boolean) { + JSON_VALUE *new_value = (JSON_VALUE*)parson_malloc(sizeof(JSON_VALUE)); + if (!new_value) { + return NULL; + } + new_value->parent = NULL; + new_value->type = JSON_TYPE_BOOL; + new_value->value.boolean = boolean ? 1 : 0; + return new_value; +} + +JSON_VALUE * JsonNewNull(void) { + JSON_VALUE *new_value = (JSON_VALUE*)parson_malloc(sizeof(JSON_VALUE)); + if (!new_value) { + return NULL; + } + new_value->parent = NULL; + new_value->type = JSON_TYPE_NULL; + return new_value; +} + +JSON_VALUE * JsonDeepCopy(JSON_VALUE *value) { + UINT i = 0; + JSON_VALUE *return_value = NULL, *temp_value_copy = NULL, *temp_value = NULL; + char *temp_string = NULL, *temp_key = NULL; + char *temp_string_copy = NULL; + JSON_ARRAY *temp_array = NULL, *temp_array_copy = NULL; + JSON_OBJECT *temp_object = NULL, *temp_object_copy = NULL; + + switch (JsonValueGetType(value)) { + case JSON_TYPE_ARRAY: + temp_array = JsonValueGetArray(value); + return_value = JsonNewArray(); + if (return_value == NULL) { + return NULL; + } + temp_array_copy = JsonValueGetArray(return_value); + for (i = 0; i < JsonArrayGetCount(temp_array); i++) { + temp_value = JsonArrayGet(temp_array, i); + temp_value_copy = JsonDeepCopy(temp_value); + if (temp_value_copy == NULL) { + JsonFree(return_value); + return NULL; + } + if (json_array_add(temp_array_copy, temp_value_copy) == JSON_RET_ERROR) { + JsonFree(return_value); + JsonFree(temp_value_copy); + return NULL; + } + } + return return_value; + case JSON_TYPE_OBJECT: + temp_object = JsonValueGetObject(value); + return_value = JsonNewObject(); + if (return_value == NULL) { + return NULL; + } + temp_object_copy = JsonValueGetObject(return_value); + for (i = 0; i < JsonGetCount(temp_object); i++) { + temp_key = JsonGetName(temp_object, i); + temp_value = JsonGet(temp_object, temp_key); + temp_value_copy = JsonDeepCopy(temp_value); + if (temp_value_copy == NULL) { + JsonFree(return_value); + return NULL; + } + if (json_object_add(temp_object_copy, temp_key, temp_value_copy) == JSON_RET_ERROR) { + JsonFree(return_value); + JsonFree(temp_value_copy); + return NULL; + } + } + return return_value; + case JSON_TYPE_BOOL: + return JsonNewBool(JsonValueGetBool(value)); + case JSON_TYPE_NUMBER: + return JsonNewNumber(JsonValueGetNumber(value)); + case JSON_TYPE_STRING: + temp_string = JsonValueGetStr(value); + if (temp_string == NULL) { + return NULL; + } + temp_string_copy = parson_strdup(temp_string); + if (temp_string_copy == NULL) { + return NULL; + } + return_value = json_value_init_string_no_copy(temp_string_copy); + if (return_value == NULL) { + parson_free(temp_string_copy); + } + return return_value; + case JSON_TYPE_NULL: + return JsonNewNull(); + case JSON_TYPE_ERROR: + return NULL; + default: + return NULL; + } +} + +UINT JsonGetSerializationSize(JSON_VALUE *value) { + char num_buf[1100]; /* recursively allocating buffer on stack is a bad idea, so let's do it only once */ + int res = json_serialize_to_buffer_r(value, NULL, 0, 0, num_buf); + return res < 0 ? 0 : (UINT)(res + 1); +} + +UINT JsonSerializeToBuffer(JSON_VALUE *value, char *buf, UINT buf_size_in_bytes) { + int written = -1; + UINT needed_size_in_bytes = JsonGetSerializationSize(value); + if (needed_size_in_bytes == 0 || buf_size_in_bytes < needed_size_in_bytes) { + return JSON_RET_ERROR; + } + written = json_serialize_to_buffer_r(value, buf, 0, 0, NULL); + if (written < 0) { + return JSON_RET_ERROR; + } + return JSON_RET_OK; +} + +char * JsonSerializeToString(JSON_VALUE *value) { + UINT serialization_result = JSON_RET_ERROR; + UINT buf_size_bytes = JsonGetSerializationSize(value); + char *buf = NULL; + if (buf_size_bytes == 0) { + return NULL; + } + buf = (char*)parson_malloc(buf_size_bytes); + if (buf == NULL) { + return NULL; + } + serialization_result = JsonSerializeToBuffer(value, buf, buf_size_bytes); + if (serialization_result == JSON_RET_ERROR) { + JsonFreeString(buf); + return NULL; + } + return buf; +} + +UINT JsonGetSerializationSizePretty(JSON_VALUE *value) { + char num_buf[1100]; /* recursively allocating buffer on stack is a bad idea, so let's do it only once */ + int res = json_serialize_to_buffer_r(value, NULL, 0, 1, num_buf); + return res < 0 ? 0 : (UINT)(res + 1); +} + +UINT JsonSerializeToBufferPretty(JSON_VALUE *value, char *buf, UINT buf_size_in_bytes) { + int written = -1; + UINT needed_size_in_bytes = JsonGetSerializationSizePretty(value); + if (needed_size_in_bytes == 0 || buf_size_in_bytes < needed_size_in_bytes) { + return JSON_RET_ERROR; + } + written = json_serialize_to_buffer_r(value, buf, 0, 1, NULL); + if (written < 0) { + return JSON_RET_ERROR; + } + return JSON_RET_OK; +} + +JSON_VALUE *StrToJson(char *str) +{ + if (str == NULL) + { + return NULL; + } + + return JsonParseString(str); +} + +char *JsonToStr(JSON_VALUE *v) +{ + return JsonSerializeToStringPretty(v); +} +char * JsonSerializeToStringPretty(JSON_VALUE *value) { + UINT serialization_result = JSON_RET_ERROR; + UINT buf_size_bytes = JsonGetSerializationSizePretty(value); + char *buf = NULL; + if (buf_size_bytes == 0) { + return NULL; + } + buf = (char*)parson_malloc(buf_size_bytes); + if (buf == NULL) { + return NULL; + } + serialization_result = JsonSerializeToBufferPretty(value, buf, buf_size_bytes); + if (serialization_result == JSON_RET_ERROR) { + JsonFreeString(buf); + return NULL; + } + return buf; +} + +void JsonFreeString(char *string) { + parson_free(string); +} + +UINT JsonArrayDelete(JSON_ARRAY *array, UINT ix) { + UINT to_move_bytes = 0; + if (array == NULL || ix >= JsonArrayGetCount(array)) { + return JSON_RET_ERROR; + } + JsonFree(JsonArrayGet(array, ix)); + to_move_bytes = (JsonArrayGetCount(array) - 1 - ix) * sizeof(JSON_VALUE*); + memmove(array->items + ix, array->items + ix + 1, to_move_bytes); + array->count -= 1; + return JSON_RET_OK; +} + +UINT JsonArrayReplace(JSON_ARRAY *array, UINT ix, JSON_VALUE *value) { + if (array == NULL || value == NULL || value->parent != NULL || ix >= JsonArrayGetCount(array)) { + return JSON_RET_ERROR; + } + JsonFree(JsonArrayGet(array, ix)); + value->parent = JsonArrayGetWrappingValue(array); + array->items[ix] = value; + return JSON_RET_OK; +} + +UINT JsonArrayReplaceStr(JSON_ARRAY *array, UINT i, char* string) { + JSON_VALUE *value = JsonNewStr(string); + if (value == NULL) { + return JSON_RET_ERROR; + } + if (JsonArrayReplace(array, i, value) == JSON_RET_ERROR) { + JsonFree(value); + return JSON_RET_ERROR; + } + return JSON_RET_OK; +} + +UINT JsonArrayReplaceNumber(JSON_ARRAY *array, UINT i, UINT64 number) { + JSON_VALUE *value = JsonNewNumber(number); + if (value == NULL) { + return JSON_RET_ERROR; + } + if (JsonArrayReplace(array, i, value) == JSON_RET_ERROR) { + JsonFree(value); + return JSON_RET_ERROR; + } + return JSON_RET_OK; +} + +UINT JsonArrayReplaceBool(JSON_ARRAY *array, UINT i, int boolean) { + JSON_VALUE *value = JsonNewBool(boolean); + if (value == NULL) { + return JSON_RET_ERROR; + } + if (JsonArrayReplace(array, i, value) == JSON_RET_ERROR) { + JsonFree(value); + return JSON_RET_ERROR; + } + return JSON_RET_OK; +} + +UINT JsonArrayReplaceNull(JSON_ARRAY *array, UINT i) { + JSON_VALUE *value = JsonNewNull(); + if (value == NULL) { + return JSON_RET_ERROR; + } + if (JsonArrayReplace(array, i, value) == JSON_RET_ERROR) { + JsonFree(value); + return JSON_RET_ERROR; + } + return JSON_RET_OK; +} + +UINT JsonArrayDeleteAll(JSON_ARRAY *array) { + UINT i = 0; + if (array == NULL) { + return JSON_RET_ERROR; + } + for (i = 0; i < JsonArrayGetCount(array); i++) { + JsonFree(JsonArrayGet(array, i)); + } + array->count = 0; + return JSON_RET_OK; +} + +UINT JsonArrayAdd(JSON_ARRAY *array, JSON_VALUE *value) { + if (array == NULL || value == NULL || value->parent != NULL) { + return JSON_RET_ERROR; + } + return json_array_add(array, value); +} + +UINT JsonArrayAddStr(JSON_ARRAY *array, char *string) { + JSON_VALUE *value = JsonNewStr(string); + if (value == NULL) { + return JSON_RET_ERROR; + } + if (JsonArrayAdd(array, value) == JSON_RET_ERROR) { + JsonFree(value); + return JSON_RET_ERROR; + } + return JSON_RET_OK; +} + +UINT JsonArrayAddUniStr(JSON_ARRAY *array, wchar_t *string) +{ + UINT ret; + char *utf8 = CopyUniToUtf(string); + + ret = JsonArrayAddStr(array, utf8); + + Free(utf8); + return ret; +} + +UINT JsonArrayAddNumber(JSON_ARRAY *array, UINT64 number) { + JSON_VALUE *value = JsonNewNumber(number); + if (value == NULL) { + return JSON_RET_ERROR; + } + if (JsonArrayAdd(array, value) == JSON_RET_ERROR) { + JsonFree(value); + return JSON_RET_ERROR; + } + return JSON_RET_OK; +} + +UINT JsonArrayAddData(JSON_ARRAY *array, void *data, UINT size) +{ + UINT ret; + char *b64 = ZeroMalloc(size * 4 + 32); + B64_Encode(b64, data, size); + + ret = JsonArrayAddStr(array, b64); + + Free(b64); + return ret; +} + +UINT JsonArrayAddBool(JSON_ARRAY *array, int boolean) { + JSON_VALUE *value = JsonNewBool(boolean); + if (value == NULL) { + return JSON_RET_ERROR; + } + if (JsonArrayAdd(array, value) == JSON_RET_ERROR) { + JsonFree(value); + return JSON_RET_ERROR; + } + return JSON_RET_OK; +} + +UINT JsonArrayAddNull(JSON_ARRAY *array) { + JSON_VALUE *value = JsonNewNull(); + if (value == NULL) { + return JSON_RET_ERROR; + } + if (JsonArrayAdd(array, value) == JSON_RET_ERROR) { + JsonFree(value); + return JSON_RET_ERROR; + } + return JSON_RET_OK; +} + +UINT JsonSet(JSON_OBJECT *object, char *name, JSON_VALUE *value) { + UINT i = 0; + JSON_VALUE *old_value; + if (object == NULL || name == NULL || value == NULL || value->parent != NULL) { + return JSON_RET_ERROR; + } + old_value = JsonGet(object, name); + if (old_value != NULL) { /* free and overwrite old value */ + JsonFree(old_value); + for (i = 0; i < JsonGetCount(object); i++) { + if (strcmp(object->names[i], name) == 0) { + value->parent = JsonGetWrappingValue(object); + object->values[i] = value; + return JSON_RET_OK; + } + } + } + /* add new key value pair */ + return json_object_add(object, name, value); +} + +UINT JsonSetData(JSON_OBJECT *object, char *name, void *data, UINT size) +{ + UINT ret; + char *b64 = ZeroMalloc(size * 4 + 32); + B64_Encode(b64, data, size); + + ret = JsonSetStr(object, name, b64); + + Free(b64); + return ret; +} + +UINT JsonSetStr(JSON_OBJECT *object, char *name, char *string) { + return JsonSet(object, name, JsonNewStr(string)); +} + +UINT JsonSetUniStr(JSON_OBJECT *object, char *name, wchar_t *string) +{ + UINT ret; + char *utf8 = CopyUniToUtf(string); + + ret = JsonSetStr(object, name, utf8); + + Free(utf8); + return ret; +} + +UINT JsonSetNumber(JSON_OBJECT *object, char *name, UINT64 number) { + return JsonSet(object, name, JsonNewNumber(number)); +} + +UINT JsonSetBool(JSON_OBJECT *object, char *name, int boolean) { + return JsonSet(object, name, JsonNewBool(boolean)); +} + +UINT JsonSetNull(JSON_OBJECT *object, char *name) { + return JsonSet(object, name, JsonNewNull()); +} + +UINT JsonDotSet(JSON_OBJECT *object, char *name, JSON_VALUE *value) { + char *dot_pos = NULL; + char *current_name = NULL; + JSON_OBJECT *temp_obj = NULL; + JSON_VALUE *new_value = NULL; + if (object == NULL || name == NULL || value == NULL) { + return JSON_RET_ERROR; + } + dot_pos = strchr(name, '.'); + if (dot_pos == NULL) { + return JsonSet(object, name, value); + } + else { + current_name = parson_strndup(name, (UINT)(dot_pos - name)); + temp_obj = JsonGetObj(object, current_name); + if (temp_obj == NULL) { + new_value = JsonNewObject(); + if (new_value == NULL) { + parson_free(current_name); + return JSON_RET_ERROR; + } + if (json_object_add(object, current_name, new_value) == JSON_RET_ERROR) { + JsonFree(new_value); + parson_free(current_name); + return JSON_RET_ERROR; + } + temp_obj = JsonGetObj(object, current_name); + } + parson_free(current_name); + return JsonDotSet(temp_obj, dot_pos + 1, value); + } +} + +UINT JsonDotSetStr(JSON_OBJECT *object, char *name, char *string) { + JSON_VALUE *value = JsonNewStr(string); + if (value == NULL) { + return JSON_RET_ERROR; + } + if (JsonDotSet(object, name, value) == JSON_RET_ERROR) { + JsonFree(value); + return JSON_RET_ERROR; + } + return JSON_RET_OK; +} + +UINT JsonDotSetNumber(JSON_OBJECT *object, char *name, UINT64 number) { + JSON_VALUE *value = JsonNewNumber(number); + if (value == NULL) { + return JSON_RET_ERROR; + } + if (JsonDotSet(object, name, value) == JSON_RET_ERROR) { + JsonFree(value); + return JSON_RET_ERROR; + } + return JSON_RET_OK; +} + +UINT JsonDotSetBool(JSON_OBJECT *object, char *name, int boolean) { + JSON_VALUE *value = JsonNewBool(boolean); + if (value == NULL) { + return JSON_RET_ERROR; + } + if (JsonDotSet(object, name, value) == JSON_RET_ERROR) { + JsonFree(value); + return JSON_RET_ERROR; + } + return JSON_RET_OK; +} + +UINT JsonDotSetNull(JSON_OBJECT *object, char *name) { + JSON_VALUE *value = JsonNewNull(); + if (value == NULL) { + return JSON_RET_ERROR; + } + if (JsonDotSet(object, name, value) == JSON_RET_ERROR) { + JsonFree(value); + return JSON_RET_ERROR; + } + return JSON_RET_OK; +} + +UINT JsonDelete(JSON_OBJECT *object, char *name) { + UINT i = 0, last_item_index = 0; + if (object == NULL || JsonGet(object, name) == NULL) { + return JSON_RET_ERROR; + } + last_item_index = JsonGetCount(object) - 1; + for (i = 0; i < JsonGetCount(object); i++) { + if (strcmp(object->names[i], name) == 0) { + parson_free(object->names[i]); + JsonFree(object->values[i]); + if (i != last_item_index) { /* Replace key value pair with one from the end */ + object->names[i] = object->names[last_item_index]; + object->values[i] = object->values[last_item_index]; + } + object->count -= 1; + return JSON_RET_OK; + } + } + return JSON_RET_ERROR; /* No execution path should end here */ +} + +UINT JsonDotDelete(JSON_OBJECT *object, char *name) { + char *dot_pos = strchr(name, '.'); + char *current_name = NULL; + JSON_OBJECT *temp_obj = NULL; + if (dot_pos == NULL) { + return JsonDelete(object, name); + } + else { + current_name = parson_strndup(name, (UINT)(dot_pos - name)); + temp_obj = JsonGetObj(object, current_name); + parson_free(current_name); + if (temp_obj == NULL) { + return JSON_RET_ERROR; + } + return JsonDotDelete(temp_obj, dot_pos + 1); + } +} + +UINT JsonDeleteAll(JSON_OBJECT *object) { + UINT i = 0; + if (object == NULL) { + return JSON_RET_ERROR; + } + for (i = 0; i < JsonGetCount(object); i++) { + parson_free(object->names[i]); + JsonFree(object->values[i]); + } + object->count = 0; + return JSON_RET_OK; +} + +UINT JsonValidate(JSON_VALUE *schema, JSON_VALUE *value) { + JSON_VALUE *temp_schema_value = NULL, *temp_value = NULL; + JSON_ARRAY *schema_array = NULL, *value_array = NULL; + JSON_OBJECT *schema_object = NULL, *value_object = NULL; + UINT schema_type = JSON_TYPE_ERROR, value_type = JSON_TYPE_ERROR; + char *key = NULL; + UINT i = 0, count = 0; + if (schema == NULL || value == NULL) { + return JSON_RET_ERROR; + } + schema_type = JsonValueGetType(schema); + value_type = JsonValueGetType(value); + if (schema_type != value_type && schema_type != JSON_TYPE_NULL) { /* null represents all values */ + return JSON_RET_ERROR; + } + switch (schema_type) { + case JSON_TYPE_ARRAY: + schema_array = JsonValueGetArray(schema); + value_array = JsonValueGetArray(value); + count = JsonArrayGetCount(schema_array); + if (count == 0) { + return JSON_RET_OK; /* Empty array allows all types */ + } + /* Get first value from array, rest is ignored */ + temp_schema_value = JsonArrayGet(schema_array, 0); + for (i = 0; i < JsonArrayGetCount(value_array); i++) { + temp_value = JsonArrayGet(value_array, i); + if (JsonValidate(temp_schema_value, temp_value) == JSON_RET_ERROR) { + return JSON_RET_ERROR; + } + } + return JSON_RET_OK; + case JSON_TYPE_OBJECT: + schema_object = JsonValueGetObject(schema); + value_object = JsonValueGetObject(value); + count = JsonGetCount(schema_object); + if (count == 0) { + return JSON_RET_OK; /* Empty object allows all objects */ + } + else if (JsonGetCount(value_object) < count) { + return JSON_RET_ERROR; /* Tested object mustn't have less name-value pairs than schema */ + } + for (i = 0; i < count; i++) { + key = JsonGetName(schema_object, i); + temp_schema_value = JsonGet(schema_object, key); + temp_value = JsonGet(value_object, key); + if (temp_value == NULL) { + return JSON_RET_ERROR; + } + if (JsonValidate(temp_schema_value, temp_value) == JSON_RET_ERROR) { + return JSON_RET_ERROR; + } + } + return JSON_RET_OK; + case JSON_TYPE_STRING: case JSON_TYPE_NUMBER: case JSON_TYPE_BOOL: case JSON_TYPE_NULL: + return JSON_RET_OK; /* equality already tested before switch */ + case JSON_TYPE_ERROR: default: + return JSON_RET_ERROR; + } +} + +int JsonCmp(JSON_VALUE *a, JSON_VALUE *b) { + JSON_OBJECT *a_object = NULL, *b_object = NULL; + JSON_ARRAY *a_array = NULL, *b_array = NULL; + char *a_string = NULL, *b_string = NULL; + char *key = NULL; + UINT a_count = 0, b_count = 0, i = 0; + UINT a_type, b_type; + UINT64 a_num, b_num; + a_type = JsonValueGetType(a); + b_type = JsonValueGetType(b); + if (a_type != b_type) { + return 0; + } + switch (a_type) { + case JSON_TYPE_ARRAY: + a_array = JsonValueGetArray(a); + b_array = JsonValueGetArray(b); + a_count = JsonArrayGetCount(a_array); + b_count = JsonArrayGetCount(b_array); + if (a_count != b_count) { + return 0; + } + for (i = 0; i < a_count; i++) { + if (!JsonCmp(JsonArrayGet(a_array, i), + JsonArrayGet(b_array, i))) { + return 0; + } + } + return 1; + case JSON_TYPE_OBJECT: + a_object = JsonValueGetObject(a); + b_object = JsonValueGetObject(b); + a_count = JsonGetCount(a_object); + b_count = JsonGetCount(b_object); + if (a_count != b_count) { + return 0; + } + for (i = 0; i < a_count; i++) { + key = JsonGetName(a_object, i); + if (!JsonCmp(JsonGet(a_object, key), + JsonGet(b_object, key))) { + return 0; + } + } + return 1; + case JSON_TYPE_STRING: + a_string = JsonValueGetStr(a); + b_string = JsonValueGetStr(b); + if (a_string == NULL || b_string == NULL) { + return 0; /* shouldn't happen */ + } + return strcmp(a_string, b_string) == 0; + case JSON_TYPE_BOOL: + return JsonValueGetBool(a) == JsonValueGetBool(b); + case JSON_TYPE_NUMBER: + a_num = JsonValueGetNumber(a); + b_num = JsonValueGetNumber(b); + return a_num == b_num; + case JSON_TYPE_ERROR: + return 1; + case JSON_TYPE_NULL: + return 1; + default: + return 1; + } +} + +UINT JsonType(JSON_VALUE *value) { + return JsonValueGetType(value); +} + +JSON_OBJECT * JsonObject(JSON_VALUE *value) { + return JsonValueGetObject(value); +} + +JSON_ARRAY * JsonArray(JSON_VALUE *value) { + return JsonValueGetArray(value); +} + +char * JsonString(JSON_VALUE *value) { + return JsonValueGetStr(value); +} + +UINT64 JsonNumber(JSON_VALUE *value) { + return JsonValueGetNumber(value); +} + +int JsonBool(JSON_VALUE *value) { + return JsonValueGetBool(value); +} + +void JsonSetAllocationFunctions(JSON_Malloc_Function malloc_fun, JSON_Free_Function free_fun) { + parson_malloc = malloc_fun; + parson_free = free_fun; +} + +// SYSTEMTIME to JSON string +void SystemTimeToJsonStr(char *dst, UINT size, SYSTEMTIME *t) +{ + if (dst == NULL) + { + return; + } + + if (t == NULL) + { + ClearStr(dst, size); + } + else + { + GetDateTimeStrRFC3339(dst, size, t, 0); + } +} + +// UINT64 System Time to JSON string +void SystemTime64ToJsonStr(char *dst, UINT size, UINT64 t) +{ + SYSTEMTIME st; + if (dst == NULL) + { + return; + } + + if (t == 0) + { + ClearStr(dst, size); + } + + UINT64ToSystem(&st, t); + + SystemTimeToJsonStr(dst, size, &st); +} + + + + diff --git a/src/Mayaqua/Str.h b/src/Mayaqua/Str.h index 6ff9051c..576bb58c 100644 --- a/src/Mayaqua/Str.h +++ b/src/Mayaqua/Str.h @@ -1,388 +1,388 @@ -// SoftEther VPN Source Code - Developer Edition Master Branch -// Mayaqua Kernel - - -// Str.h -// Header of Str.c - -#ifndef STR_H -#define STR_H - -// String token -struct TOKEN_LIST -{ - UINT NumTokens; - char **Token; -}; - -// INI_ENTRY -struct INI_ENTRY -{ - char *Key; - char *Value; - wchar_t *UnicodeValue; -}; - -// Function prototype -UINT StrLen(char *str); -UINT StrSize(char *str); -bool StrCheckLen(char *str, UINT len); -UINT StrCpy(char *dst, UINT size, char *src); -UINT StrCpyAllowOverlap(char *dst, UINT size, char *src); -UINT StrCat(char *dst, UINT size, char *src); -UINT StrCatLeft(char *dst, UINT size, char *src); -char ToLower(char c); -char ToUpper(char c); -void StrUpper(char *str); -void StrLower(char *str); -int StrCmp(char *str1, char *str2); -int StrCmpi(char *str1, char *str2); -void FormatArgs(char *buf, UINT size, char *fmt, va_list args); -void Format(char *buf, UINT size, char *fmt, ...); -void Print(char *fmt, ...); -void PrintArgs(char *fmt, va_list args); -void PrintStr(char *str); -void Debug(char *fmt, ...); -void DebugArgs(char *fmt, va_list args); -UINT ToInt(char *str); -bool ToBool(char *str); -int ToInti(char *str); -void ToStr(char *str, UINT i); -void TrimCrlf(char *str); -void TrimQuotes(char *str); -void Trim(char *str); -void TrimRight(char *str); -void TrimLeft(char *str); -bool GetLine(char *str, UINT size); -void FreeToken(TOKEN_LIST *tokens); -bool IsInToken(TOKEN_LIST *t, char *str); -TOKEN_LIST *ParseToken(char *src, char *separator); -void InitStringLibrary(); -void FreeStringLibrary(); -bool CheckStringLibrary(); -UINT SearchStrEx(char *string, char *keyword, UINT start, bool case_sensitive); -UINT SearchStr(char *string, char *keyword, UINT start); -UINT CalcReplaceStrEx(char *string, char *old_keyword, char *new_keyword, bool case_sensitive); -UINT ReplaceStrEx(char *dst, UINT size, char *string, char *old_keyword, char *new_keyword, bool case_sensitive); -UINT ReplaceStr(char *dst, UINT size, char *string, char *old_keyword, char *new_keyword); -UINT ReplaceStri(char *dst, UINT size, char *string, char *old_keyword, char *new_keyword); -bool IsPrintableAsciiChar(char c); -void EnPrintableAsciiStr(char *str, char replace); -bool IsSafeChar(char c); -bool IsSafeStr(char *str); -void EnSafeStr(char *str, char replace); -void EnSafeHttpHeaderValueStr(char *str, char replace); -void TruncateCharFromStr(char *str, char replace); -char *CopyStr(char *str); -void BinToStr(char *str, UINT str_size, void *data, UINT data_size); -void BinToStrW(wchar_t *str, UINT str_size, void *data, UINT data_size); -void PrintBin(void *data, UINT size); -bool StartWith(char *str, char *key); -bool EndWith(char *str, char *key); -bool TrimEndWith(char *dst, UINT dst_size, char *str, char *key); -UINT64 ToInt64(char *str); -UINT64 Json_ToInt64Ex(char *str, char **endptr, bool *error); -void ToStr64(char *str, UINT64 value); -TOKEN_LIST *ParseCmdLine(char *str); -TOKEN_LIST *CopyToken(TOKEN_LIST *src); -TOKEN_LIST *NullToken(); -bool IsNum(char *str); -LIST *StrToStrList(char *str, UINT size); -void FreeStrList(LIST *o); -TOKEN_LIST *ListToTokenList(LIST *o); -bool IsEmptyStr(char *str); -void BinToStrEx(char *str, UINT str_size, void *data, UINT data_size); -void BinToStrEx2(char *str, UINT str_size, void *data, UINT data_size, char padding_char); -char *CopyBinToStrEx(void *data, UINT data_size); -char *CopyBinToStr(void *data, UINT data_size); -BUF *StrToBin(char *str); -void MacToStr(char *str, UINT size, UCHAR *mac_address); -void ToStr3(char *str, UINT size, UINT64 v); -void ToStrByte(char *str, UINT size, UINT64 v); -void ToStrByte1000(char *str, UINT size, UINT64 v); -TOKEN_LIST *UniqueToken(TOKEN_LIST *t); -bool IsAllUpperStr(char *str); -UINT StrWidth(char *str); -char *MakeCharArray(char c, UINT count); -void MakeCharArray2(char *str, char c, UINT count); -bool StrToMac(UCHAR *mac_address, char *str); -bool IsSplitChar(char c, char *split_str); -bool GetKeyAndValue(char *str, char *key, UINT key_size, char *value, UINT value_size, char *split_str); -LIST *ReadIni(BUF *b); -INI_ENTRY *GetIniEntry(LIST *o, char *key); -void FreeIni(LIST *o); -UINT IniIntValue(LIST *o, char *key); -char *IniStrValue(LIST *o, char *key); -bool InStr(char *str, char *keyword); -bool InStrEx(char *str, char *keyword, bool case_sensitive); -bool InStrList(char *target_str, char *tokens, char *splitter, bool case_sensitive); -TOKEN_LIST *ParseTokenWithoutNullStr(char *str, char *split_chars); -TOKEN_LIST *ParseTokenWithNullStr(char *str, char *split_chars); -char *DefaultTokenSplitChars(); -bool IsCharInStr(char *str, char c); -UINT HexTo4Bit(char c); -char FourBitToHex(UINT value); -void ToHex(char *str, UINT value); -UINT HexToInt(char *str); -UINT SearchAsciiInBinary(void *data, UINT size, char *str, bool case_sensitive); -void IntListToStr(char *str, UINT str_size, LIST *o, char *separate_str); -LIST *StrToIntList(char *str, bool sorted); -void NormalizeIntListStr(char *dst, UINT dst_size, char *src, bool sorted, char *separate_str); -void ClearStr(char *str, UINT str_size); -void SetStrCaseAccordingToBits(char *str, UINT bits); -char *UrlDecode(char *url_str); - - -// *** JSON strings support -// Original source code from Parson ( http://kgabis.github.com/parson/ ) -// Modified by dnobori -/* -Parson ( http://kgabis.github.com/parson/ ) -Copyright (c) 2012 - 2017 Krzysztof Gabis - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. -*/ - - -/* Type definitions */ -typedef union JSON_VALUE_UNION { - char *string; - UINT64 number; - JSON_OBJECT *object; - JSON_ARRAY *array; - int boolean; - int null; -} JSON_VALUE_UNION; - -struct JSON_VALUE { - JSON_VALUE *parent; - UINT type; - JSON_VALUE_UNION value; -}; - -struct JSON_OBJECT { - JSON_VALUE *wrapping_value; - char **names; - JSON_VALUE **values; - UINT count; - UINT capacity; -}; - -struct JSON_ARRAY { - JSON_VALUE *wrapping_value; - JSON_VALUE **items; - UINT count; - UINT capacity; -}; - - -enum JSON_TYPES { - JSON_TYPE_ERROR = -1, - JSON_TYPE_NULL = 1, - JSON_TYPE_STRING = 2, - JSON_TYPE_NUMBER = 3, - JSON_TYPE_OBJECT = 4, - JSON_TYPE_ARRAY = 5, - JSON_TYPE_BOOL = 6 -}; -typedef unsigned int UINT; - -enum JSON_RETS { - JSON_RET_OK = 0, - JSON_RET_ERROR = -1 -}; - -typedef void * (*JSON_Malloc_Function)(UINT); -typedef void(*JSON_Free_Function)(void *); - -/* Call only once, before calling any other function from parson API. If not called, malloc and free -from stdlib will be used for all allocations */ -void JsonSetAllocationFunctions(JSON_Malloc_Function malloc_fun, JSON_Free_Function free_fun); - -/* Parses first JSON value in a string, returns NULL in case of error */ -JSON_VALUE * JsonParseString(char *string); - -/* Parses first JSON value in a string and ignores comments (/ * * / and //), -returns NULL in case of error */ -JSON_VALUE * JsonParseStringWithComments(char *string); - -/* Serialization */ -UINT JsonGetSerializationSize(JSON_VALUE *value); /* returns 0 on fail */ -UINT JsonSerializeToBuffer(JSON_VALUE *value, char *buf, UINT buf_size_in_bytes); -char * JsonSerializeToString(JSON_VALUE *value); - -/* Pretty serialization */ -UINT JsonGetSerializationSizePretty(JSON_VALUE *value); /* returns 0 on fail */ -UINT JsonSerializeToBufferPretty(JSON_VALUE *value, char *buf, UINT buf_size_in_bytes); -char * JsonSerializeToStringPretty(JSON_VALUE *value); -char *JsonToStr(JSON_VALUE *v); - -void JsonFreeString(char *string); /* frees string from json_serialize_to_string and json_serialize_to_string_pretty */ - - /* Comparing */ -int JsonCmp(JSON_VALUE *a, JSON_VALUE *b); - -/* Validation -This is *NOT* JSON Schema. It validates json by checking if object have identically -named fields with matching types. -For example schema {"name":"", "age":0} will validate -{"name":"Joe", "age":25} and {"name":"Joe", "age":25, "gender":"m"}, -but not {"name":"Joe"} or {"name":"Joe", "age":"Cucumber"}. -In case of arrays, only first value in schema is checked against all values in tested array. -Empty objects ({}) validate all objects, empty arrays ([]) validate all arrays, -null validates values of every type. -*/ -UINT JsonValidate(JSON_VALUE *schema, JSON_VALUE *value); - -/* -* JSON Object -*/ -JSON_VALUE * JsonGet(JSON_OBJECT *object, char *name); -char * JsonGetStr(JSON_OBJECT *object, char *name); -JSON_OBJECT * JsonGetObj(JSON_OBJECT *object, char *name); -JSON_ARRAY * JsonGetArray(JSON_OBJECT *object, char *name); -UINT64 JsonGetNumber(JSON_OBJECT *object, char *name); /* returns 0 on fail */ -bool JsonGetBool(JSON_OBJECT *object, char *name); /* returns 0 on fail */ - - /* dotget functions enable addressing values with dot notation in nested objects, - just like in structs or c++/java/c# objects (e.g. objectA.objectB.value). - Because valid names in JSON can contain dots, some values may be inaccessible - this way. */ -JSON_VALUE * JsonDotGet(JSON_OBJECT *object, char *name); -char * JsonDotGetStr(JSON_OBJECT *object, char *name); -JSON_OBJECT * JsonDotGetObj(JSON_OBJECT *object, char *name); -JSON_ARRAY * JsonDotGetArray(JSON_OBJECT *object, char *name); -UINT64 JsonDotGetNumber(JSON_OBJECT *object, char *name); /* returns 0 on fail */ -bool JsonDotGetBool(JSON_OBJECT *object, char *name); /* returns -1 on fail */ - - /* Functions to get available names */ -UINT JsonGetCount(JSON_OBJECT *object); -char * JsonGetName(JSON_OBJECT *object, UINT index); -JSON_VALUE * JsonGetValueAt(JSON_OBJECT *object, UINT index); -JSON_VALUE * JsonGetWrappingValue(JSON_OBJECT *object); - -/* Functions to check if object has a value with a specific name. Returned value is 1 if object has -* a value and 0 if it doesn't. dothas functions behave exactly like dotget functions. */ -int JsonIsExists(JSON_OBJECT *object, char *name); -int JsonIsExistsWithValueType(JSON_OBJECT *object, char *name, UINT type); - -int JsonDotIsExists(JSON_OBJECT *object, char *name); -int JsonDotIsExistsWithValueType(JSON_OBJECT *object, char *name, UINT type); - -/* Creates new name-value pair or frees and replaces old value with a new one. -* json_object_set_value does not copy passed value so it shouldn't be freed afterwards. */ -UINT JsonSet(JSON_OBJECT *object, char *name, JSON_VALUE *value); -UINT JsonSetStr(JSON_OBJECT *object, char *name, char *string); -UINT JsonSetUniStr(JSON_OBJECT *object, char *name, wchar_t *string); -UINT JsonSetNumber(JSON_OBJECT *object, char *name, UINT64 number); -UINT JsonSetBool(JSON_OBJECT *object, char *name, int boolean); -UINT JsonSetNull(JSON_OBJECT *object, char *name); -UINT JsonSetData(JSON_OBJECT *object, char *name, void *data, UINT size); - -/* Works like dotget functions, but creates whole hierarchy if necessary. -* json_object_dotset_value does not copy passed value so it shouldn't be freed afterwards. */ -UINT JsonDotSet(JSON_OBJECT *object, char *name, JSON_VALUE *value); -UINT JsonDotSetStr(JSON_OBJECT *object, char *name, char *string); -UINT JsonDotSetNumber(JSON_OBJECT *object, char *name, UINT64 number); -UINT JsonDotSetBool(JSON_OBJECT *object, char *name, int boolean); -UINT JsonDotSetNull(JSON_OBJECT *object, char *name); - -/* Frees and removes name-value pair */ -UINT JsonDelete(JSON_OBJECT *object, char *name); - -/* Works like dotget function, but removes name-value pair only on exact match. */ -UINT JsonDotDelete(JSON_OBJECT *object, char *key); - -/* Removes all name-value pairs in object */ -UINT JsonDeleteAll(JSON_OBJECT *object); - -/* -*JSON Array -*/ -JSON_VALUE * JsonArrayGet(JSON_ARRAY *array, UINT index); -char * JsonArrayGetStr(JSON_ARRAY *array, UINT index); -JSON_OBJECT * JsonArrayGetObj(JSON_ARRAY *array, UINT index); -JSON_ARRAY * JsonArrayGetArray(JSON_ARRAY *array, UINT index); -UINT64 JsonArrayGetNumber(JSON_ARRAY *array, UINT index); /* returns 0 on fail */ -bool JsonArrayGetBool(JSON_ARRAY *array, UINT index); /* returns 0 on fail */ -UINT JsonArrayGetCount(JSON_ARRAY *array); -JSON_VALUE * JsonArrayGetWrappingValue(JSON_ARRAY *array); - -/* Frees and removes value at given index, does nothing and returns JSONFailure if index doesn't exist. -* Order of values in array may change during execution. */ -UINT JsonArrayDelete(JSON_ARRAY *array, UINT i); - -/* Frees and removes from array value at given index and replaces it with given one. -* Does nothing and returns JSONFailure if index doesn't exist. -* json_array_replace_value does not copy passed value so it shouldn't be freed afterwards. */ -UINT JsonArrayReplace(JSON_ARRAY *array, UINT i, JSON_VALUE *value); -UINT JsonArrayReplaceStr(JSON_ARRAY *array, UINT i, char* string); -UINT JsonArrayReplaceNumber(JSON_ARRAY *array, UINT i, UINT64 number); -UINT JsonArrayReplaceBool(JSON_ARRAY *array, UINT i, int boolean); -UINT JsonArrayReplaceNull(JSON_ARRAY *array, UINT i); - -/* Frees and removes all values from array */ -UINT JsonArrayDeleteAll(JSON_ARRAY *array); - -/* Appends new value at the end of array. -* json_array_append_value does not copy passed value so it shouldn't be freed afterwards. */ -UINT JsonArrayAdd(JSON_ARRAY *array, JSON_VALUE *value); -UINT JsonArrayAddStr(JSON_ARRAY *array, char *string); -UINT JsonArrayAddUniStr(JSON_ARRAY *array, wchar_t *string); -UINT JsonArrayAddNumber(JSON_ARRAY *array, UINT64 number); -UINT JsonArrayAddData(JSON_ARRAY *array, void *data, UINT size); -UINT JsonArrayAddBool(JSON_ARRAY *array, int boolean); -UINT JsonArrayAddNull(JSON_ARRAY *array); - - -/* -*JSON Value -*/ -JSON_VALUE * JsonNewObject(void); -JSON_VALUE * JsonNewArray(void); -JSON_VALUE * JsonNewStr(char *string); /* copies passed string */ -JSON_VALUE * JsonNewNumber(UINT64 number); -JSON_VALUE * JsonNewBool(int boolean); -JSON_VALUE * JsonNewNull(void); -JSON_VALUE * JsonDeepCopy(JSON_VALUE *value); -void JsonFree(JSON_VALUE *value); - -UINT JsonValueGetType(JSON_VALUE *value); -JSON_OBJECT * JsonValueGetObject(JSON_VALUE *value); -JSON_ARRAY * JsonValueGetArray(JSON_VALUE *value); -char * JsonValueGetStr(JSON_VALUE *value); -UINT64 JsonValueGetNumber(JSON_VALUE *value); -bool JsonValueGetBool(JSON_VALUE *value); -JSON_VALUE * JsonValueGetParent(JSON_VALUE *value); - -/* Same as above, but shorter */ -UINT JsonType(JSON_VALUE *value); -JSON_OBJECT * JsonObject(JSON_VALUE *value); -JSON_ARRAY * JsonArray(JSON_VALUE *value); -char * JsonString(JSON_VALUE *value); -UINT64 JsonNumber(JSON_VALUE *value); -int JsonBool(JSON_VALUE *value); - -void SystemTimeToJsonStr(char *dst, UINT size, SYSTEMTIME *t); -void SystemTime64ToJsonStr(char *dst, UINT size, UINT64 t); - -JSON_VALUE *StrToJson(char *str); - -#endif // STR_H - +// SoftEther VPN Source Code - Developer Edition Master Branch +// Mayaqua Kernel + + +// Str.h +// Header of Str.c + +#ifndef STR_H +#define STR_H + +// String token +struct TOKEN_LIST +{ + UINT NumTokens; + char **Token; +}; + +// INI_ENTRY +struct INI_ENTRY +{ + char *Key; + char *Value; + wchar_t *UnicodeValue; +}; + +// Function prototype +UINT StrLen(char *str); +UINT StrSize(char *str); +bool StrCheckLen(char *str, UINT len); +UINT StrCpy(char *dst, UINT size, char *src); +UINT StrCpyAllowOverlap(char *dst, UINT size, char *src); +UINT StrCat(char *dst, UINT size, char *src); +UINT StrCatLeft(char *dst, UINT size, char *src); +char ToLower(char c); +char ToUpper(char c); +void StrUpper(char *str); +void StrLower(char *str); +int StrCmp(char *str1, char *str2); +int StrCmpi(char *str1, char *str2); +void FormatArgs(char *buf, UINT size, char *fmt, va_list args); +void Format(char *buf, UINT size, char *fmt, ...); +void Print(char *fmt, ...); +void PrintArgs(char *fmt, va_list args); +void PrintStr(char *str); +void Debug(char *fmt, ...); +void DebugArgs(char *fmt, va_list args); +UINT ToInt(char *str); +bool ToBool(char *str); +int ToInti(char *str); +void ToStr(char *str, UINT i); +void TrimCrlf(char *str); +void TrimQuotes(char *str); +void Trim(char *str); +void TrimRight(char *str); +void TrimLeft(char *str); +bool GetLine(char *str, UINT size); +void FreeToken(TOKEN_LIST *tokens); +bool IsInToken(TOKEN_LIST *t, char *str); +TOKEN_LIST *ParseToken(char *src, char *separator); +void InitStringLibrary(); +void FreeStringLibrary(); +bool CheckStringLibrary(); +UINT SearchStrEx(char *string, char *keyword, UINT start, bool case_sensitive); +UINT SearchStr(char *string, char *keyword, UINT start); +UINT CalcReplaceStrEx(char *string, char *old_keyword, char *new_keyword, bool case_sensitive); +UINT ReplaceStrEx(char *dst, UINT size, char *string, char *old_keyword, char *new_keyword, bool case_sensitive); +UINT ReplaceStr(char *dst, UINT size, char *string, char *old_keyword, char *new_keyword); +UINT ReplaceStri(char *dst, UINT size, char *string, char *old_keyword, char *new_keyword); +bool IsPrintableAsciiChar(char c); +void EnPrintableAsciiStr(char *str, char replace); +bool IsSafeChar(char c); +bool IsSafeStr(char *str); +void EnSafeStr(char *str, char replace); +void EnSafeHttpHeaderValueStr(char *str, char replace); +void TruncateCharFromStr(char *str, char replace); +char *CopyStr(char *str); +void BinToStr(char *str, UINT str_size, void *data, UINT data_size); +void BinToStrW(wchar_t *str, UINT str_size, void *data, UINT data_size); +void PrintBin(void *data, UINT size); +bool StartWith(char *str, char *key); +bool EndWith(char *str, char *key); +bool TrimEndWith(char *dst, UINT dst_size, char *str, char *key); +UINT64 ToInt64(char *str); +UINT64 Json_ToInt64Ex(char *str, char **endptr, bool *error); +void ToStr64(char *str, UINT64 value); +TOKEN_LIST *ParseCmdLine(char *str); +TOKEN_LIST *CopyToken(TOKEN_LIST *src); +TOKEN_LIST *NullToken(); +bool IsNum(char *str); +LIST *StrToStrList(char *str, UINT size); +void FreeStrList(LIST *o); +TOKEN_LIST *ListToTokenList(LIST *o); +bool IsEmptyStr(char *str); +void BinToStrEx(char *str, UINT str_size, void *data, UINT data_size); +void BinToStrEx2(char *str, UINT str_size, void *data, UINT data_size, char padding_char); +char *CopyBinToStrEx(void *data, UINT data_size); +char *CopyBinToStr(void *data, UINT data_size); +BUF *StrToBin(char *str); +void MacToStr(char *str, UINT size, UCHAR *mac_address); +void ToStr3(char *str, UINT size, UINT64 v); +void ToStrByte(char *str, UINT size, UINT64 v); +void ToStrByte1000(char *str, UINT size, UINT64 v); +TOKEN_LIST *UniqueToken(TOKEN_LIST *t); +bool IsAllUpperStr(char *str); +UINT StrWidth(char *str); +char *MakeCharArray(char c, UINT count); +void MakeCharArray2(char *str, char c, UINT count); +bool StrToMac(UCHAR *mac_address, char *str); +bool IsSplitChar(char c, char *split_str); +bool GetKeyAndValue(char *str, char *key, UINT key_size, char *value, UINT value_size, char *split_str); +LIST *ReadIni(BUF *b); +INI_ENTRY *GetIniEntry(LIST *o, char *key); +void FreeIni(LIST *o); +UINT IniIntValue(LIST *o, char *key); +char *IniStrValue(LIST *o, char *key); +bool InStr(char *str, char *keyword); +bool InStrEx(char *str, char *keyword, bool case_sensitive); +bool InStrList(char *target_str, char *tokens, char *splitter, bool case_sensitive); +TOKEN_LIST *ParseTokenWithoutNullStr(char *str, char *split_chars); +TOKEN_LIST *ParseTokenWithNullStr(char *str, char *split_chars); +char *DefaultTokenSplitChars(); +bool IsCharInStr(char *str, char c); +UINT HexTo4Bit(char c); +char FourBitToHex(UINT value); +void ToHex(char *str, UINT value); +UINT HexToInt(char *str); +UINT SearchAsciiInBinary(void *data, UINT size, char *str, bool case_sensitive); +void IntListToStr(char *str, UINT str_size, LIST *o, char *separate_str); +LIST *StrToIntList(char *str, bool sorted); +void NormalizeIntListStr(char *dst, UINT dst_size, char *src, bool sorted, char *separate_str); +void ClearStr(char *str, UINT str_size); +void SetStrCaseAccordingToBits(char *str, UINT bits); +char *UrlDecode(char *url_str); + + +// *** JSON strings support +// Original source code from Parson ( http://kgabis.github.com/parson/ ) +// Modified by dnobori +/* +Parson ( http://kgabis.github.com/parson/ ) +Copyright (c) 2012 - 2017 Krzysztof Gabis + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. +*/ + + +/* Type definitions */ +typedef union JSON_VALUE_UNION { + char *string; + UINT64 number; + JSON_OBJECT *object; + JSON_ARRAY *array; + int boolean; + int null; +} JSON_VALUE_UNION; + +struct JSON_VALUE { + JSON_VALUE *parent; + UINT type; + JSON_VALUE_UNION value; +}; + +struct JSON_OBJECT { + JSON_VALUE *wrapping_value; + char **names; + JSON_VALUE **values; + UINT count; + UINT capacity; +}; + +struct JSON_ARRAY { + JSON_VALUE *wrapping_value; + JSON_VALUE **items; + UINT count; + UINT capacity; +}; + + +enum JSON_TYPES { + JSON_TYPE_ERROR = -1, + JSON_TYPE_NULL = 1, + JSON_TYPE_STRING = 2, + JSON_TYPE_NUMBER = 3, + JSON_TYPE_OBJECT = 4, + JSON_TYPE_ARRAY = 5, + JSON_TYPE_BOOL = 6 +}; +typedef unsigned int UINT; + +enum JSON_RETS { + JSON_RET_OK = 0, + JSON_RET_ERROR = -1 +}; + +typedef void * (*JSON_Malloc_Function)(UINT); +typedef void(*JSON_Free_Function)(void *); + +/* Call only once, before calling any other function from parson API. If not called, malloc and free +from stdlib will be used for all allocations */ +void JsonSetAllocationFunctions(JSON_Malloc_Function malloc_fun, JSON_Free_Function free_fun); + +/* Parses first JSON value in a string, returns NULL in case of error */ +JSON_VALUE * JsonParseString(char *string); + +/* Parses first JSON value in a string and ignores comments (/ * * / and //), +returns NULL in case of error */ +JSON_VALUE * JsonParseStringWithComments(char *string); + +/* Serialization */ +UINT JsonGetSerializationSize(JSON_VALUE *value); /* returns 0 on fail */ +UINT JsonSerializeToBuffer(JSON_VALUE *value, char *buf, UINT buf_size_in_bytes); +char * JsonSerializeToString(JSON_VALUE *value); + +/* Pretty serialization */ +UINT JsonGetSerializationSizePretty(JSON_VALUE *value); /* returns 0 on fail */ +UINT JsonSerializeToBufferPretty(JSON_VALUE *value, char *buf, UINT buf_size_in_bytes); +char * JsonSerializeToStringPretty(JSON_VALUE *value); +char *JsonToStr(JSON_VALUE *v); + +void JsonFreeString(char *string); /* frees string from json_serialize_to_string and json_serialize_to_string_pretty */ + + /* Comparing */ +int JsonCmp(JSON_VALUE *a, JSON_VALUE *b); + +/* Validation +This is *NOT* JSON Schema. It validates json by checking if object have identically +named fields with matching types. +For example schema {"name":"", "age":0} will validate +{"name":"Joe", "age":25} and {"name":"Joe", "age":25, "gender":"m"}, +but not {"name":"Joe"} or {"name":"Joe", "age":"Cucumber"}. +In case of arrays, only first value in schema is checked against all values in tested array. +Empty objects ({}) validate all objects, empty arrays ([]) validate all arrays, +null validates values of every type. +*/ +UINT JsonValidate(JSON_VALUE *schema, JSON_VALUE *value); + +/* +* JSON Object +*/ +JSON_VALUE * JsonGet(JSON_OBJECT *object, char *name); +char * JsonGetStr(JSON_OBJECT *object, char *name); +JSON_OBJECT * JsonGetObj(JSON_OBJECT *object, char *name); +JSON_ARRAY * JsonGetArray(JSON_OBJECT *object, char *name); +UINT64 JsonGetNumber(JSON_OBJECT *object, char *name); /* returns 0 on fail */ +bool JsonGetBool(JSON_OBJECT *object, char *name); /* returns 0 on fail */ + + /* dotget functions enable addressing values with dot notation in nested objects, + just like in structs or c++/java/c# objects (e.g. objectA.objectB.value). + Because valid names in JSON can contain dots, some values may be inaccessible + this way. */ +JSON_VALUE * JsonDotGet(JSON_OBJECT *object, char *name); +char * JsonDotGetStr(JSON_OBJECT *object, char *name); +JSON_OBJECT * JsonDotGetObj(JSON_OBJECT *object, char *name); +JSON_ARRAY * JsonDotGetArray(JSON_OBJECT *object, char *name); +UINT64 JsonDotGetNumber(JSON_OBJECT *object, char *name); /* returns 0 on fail */ +bool JsonDotGetBool(JSON_OBJECT *object, char *name); /* returns -1 on fail */ + + /* Functions to get available names */ +UINT JsonGetCount(JSON_OBJECT *object); +char * JsonGetName(JSON_OBJECT *object, UINT index); +JSON_VALUE * JsonGetValueAt(JSON_OBJECT *object, UINT index); +JSON_VALUE * JsonGetWrappingValue(JSON_OBJECT *object); + +/* Functions to check if object has a value with a specific name. Returned value is 1 if object has +* a value and 0 if it doesn't. dothas functions behave exactly like dotget functions. */ +int JsonIsExists(JSON_OBJECT *object, char *name); +int JsonIsExistsWithValueType(JSON_OBJECT *object, char *name, UINT type); + +int JsonDotIsExists(JSON_OBJECT *object, char *name); +int JsonDotIsExistsWithValueType(JSON_OBJECT *object, char *name, UINT type); + +/* Creates new name-value pair or frees and replaces old value with a new one. +* json_object_set_value does not copy passed value so it shouldn't be freed afterwards. */ +UINT JsonSet(JSON_OBJECT *object, char *name, JSON_VALUE *value); +UINT JsonSetStr(JSON_OBJECT *object, char *name, char *string); +UINT JsonSetUniStr(JSON_OBJECT *object, char *name, wchar_t *string); +UINT JsonSetNumber(JSON_OBJECT *object, char *name, UINT64 number); +UINT JsonSetBool(JSON_OBJECT *object, char *name, int boolean); +UINT JsonSetNull(JSON_OBJECT *object, char *name); +UINT JsonSetData(JSON_OBJECT *object, char *name, void *data, UINT size); + +/* Works like dotget functions, but creates whole hierarchy if necessary. +* json_object_dotset_value does not copy passed value so it shouldn't be freed afterwards. */ +UINT JsonDotSet(JSON_OBJECT *object, char *name, JSON_VALUE *value); +UINT JsonDotSetStr(JSON_OBJECT *object, char *name, char *string); +UINT JsonDotSetNumber(JSON_OBJECT *object, char *name, UINT64 number); +UINT JsonDotSetBool(JSON_OBJECT *object, char *name, int boolean); +UINT JsonDotSetNull(JSON_OBJECT *object, char *name); + +/* Frees and removes name-value pair */ +UINT JsonDelete(JSON_OBJECT *object, char *name); + +/* Works like dotget function, but removes name-value pair only on exact match. */ +UINT JsonDotDelete(JSON_OBJECT *object, char *key); + +/* Removes all name-value pairs in object */ +UINT JsonDeleteAll(JSON_OBJECT *object); + +/* +*JSON Array +*/ +JSON_VALUE * JsonArrayGet(JSON_ARRAY *array, UINT index); +char * JsonArrayGetStr(JSON_ARRAY *array, UINT index); +JSON_OBJECT * JsonArrayGetObj(JSON_ARRAY *array, UINT index); +JSON_ARRAY * JsonArrayGetArray(JSON_ARRAY *array, UINT index); +UINT64 JsonArrayGetNumber(JSON_ARRAY *array, UINT index); /* returns 0 on fail */ +bool JsonArrayGetBool(JSON_ARRAY *array, UINT index); /* returns 0 on fail */ +UINT JsonArrayGetCount(JSON_ARRAY *array); +JSON_VALUE * JsonArrayGetWrappingValue(JSON_ARRAY *array); + +/* Frees and removes value at given index, does nothing and returns JSONFailure if index doesn't exist. +* Order of values in array may change during execution. */ +UINT JsonArrayDelete(JSON_ARRAY *array, UINT i); + +/* Frees and removes from array value at given index and replaces it with given one. +* Does nothing and returns JSONFailure if index doesn't exist. +* json_array_replace_value does not copy passed value so it shouldn't be freed afterwards. */ +UINT JsonArrayReplace(JSON_ARRAY *array, UINT i, JSON_VALUE *value); +UINT JsonArrayReplaceStr(JSON_ARRAY *array, UINT i, char* string); +UINT JsonArrayReplaceNumber(JSON_ARRAY *array, UINT i, UINT64 number); +UINT JsonArrayReplaceBool(JSON_ARRAY *array, UINT i, int boolean); +UINT JsonArrayReplaceNull(JSON_ARRAY *array, UINT i); + +/* Frees and removes all values from array */ +UINT JsonArrayDeleteAll(JSON_ARRAY *array); + +/* Appends new value at the end of array. +* json_array_append_value does not copy passed value so it shouldn't be freed afterwards. */ +UINT JsonArrayAdd(JSON_ARRAY *array, JSON_VALUE *value); +UINT JsonArrayAddStr(JSON_ARRAY *array, char *string); +UINT JsonArrayAddUniStr(JSON_ARRAY *array, wchar_t *string); +UINT JsonArrayAddNumber(JSON_ARRAY *array, UINT64 number); +UINT JsonArrayAddData(JSON_ARRAY *array, void *data, UINT size); +UINT JsonArrayAddBool(JSON_ARRAY *array, int boolean); +UINT JsonArrayAddNull(JSON_ARRAY *array); + + +/* +*JSON Value +*/ +JSON_VALUE * JsonNewObject(void); +JSON_VALUE * JsonNewArray(void); +JSON_VALUE * JsonNewStr(char *string); /* copies passed string */ +JSON_VALUE * JsonNewNumber(UINT64 number); +JSON_VALUE * JsonNewBool(int boolean); +JSON_VALUE * JsonNewNull(void); +JSON_VALUE * JsonDeepCopy(JSON_VALUE *value); +void JsonFree(JSON_VALUE *value); + +UINT JsonValueGetType(JSON_VALUE *value); +JSON_OBJECT * JsonValueGetObject(JSON_VALUE *value); +JSON_ARRAY * JsonValueGetArray(JSON_VALUE *value); +char * JsonValueGetStr(JSON_VALUE *value); +UINT64 JsonValueGetNumber(JSON_VALUE *value); +bool JsonValueGetBool(JSON_VALUE *value); +JSON_VALUE * JsonValueGetParent(JSON_VALUE *value); + +/* Same as above, but shorter */ +UINT JsonType(JSON_VALUE *value); +JSON_OBJECT * JsonObject(JSON_VALUE *value); +JSON_ARRAY * JsonArray(JSON_VALUE *value); +char * JsonString(JSON_VALUE *value); +UINT64 JsonNumber(JSON_VALUE *value); +int JsonBool(JSON_VALUE *value); + +void SystemTimeToJsonStr(char *dst, UINT size, SYSTEMTIME *t); +void SystemTime64ToJsonStr(char *dst, UINT size, UINT64 t); + +JSON_VALUE *StrToJson(char *str); + +#endif // STR_H + diff --git a/src/Mayaqua/Table.c b/src/Mayaqua/Table.c index 084b04d7..dca74841 100644 --- a/src/Mayaqua/Table.c +++ b/src/Mayaqua/Table.c @@ -1,1392 +1,1392 @@ -// SoftEther VPN Source Code - Developer Edition Master Branch -// Mayaqua Kernel - - -// Table.c -// Read and management routines for string table - -#include - -#include -#include -#include -#include -#include -#include -#include -#include - -// List of TABLE -static LIST *TableList = NULL; -static wchar_t old_table_name[MAX_SIZE] = {0}; // Old table name -static LANGLIST current_lang = {0}; -static LANGLIST current_os_lang = {0}; - -// Initialization of string table routine -void InitTable() -{ - LIST *o; - char tmp[MAX_SIZE]; - LANGLIST *e = NULL; - LANGLIST *os_lang = NULL; - char table_name[MAX_SIZE]; - if (MayaquaIsMinimalMode()) - { - // Not to load in case of minimum mode - return; - } - - o = LoadLangList(); - if (o == NULL) - { -LABEL_FATAL_ERROR: - Alert("Fatal Error: The file \"hamcore.se2\" is missing or broken.\r\nPlease check hamcore.se2.\r\n\r\n(First, reboot the computer. If this problem occurs again, please reinstall VPN software files.)", NULL); - exit(-1); - return; - } - - // Read the lang.config - if (LoadLangConfigCurrentDir(tmp, sizeof(tmp))) - { - e = GetBestLangByName(o, tmp); - } - - os_lang = GetBestLangForCurrentEnvironment(o); - - if (e == NULL) - { - e = os_lang; - } - - if (e == NULL) - { - goto LABEL_FATAL_ERROR; - } - - SaveLangConfigCurrentDir(e->Name); - - Copy(¤t_lang, e, sizeof(LANGLIST)); - Copy(¤t_os_lang, os_lang, sizeof(LANGLIST)); - - current_lang.LangList = current_lang.LcidList = NULL; - current_os_lang.LangList = current_os_lang.LcidList = NULL; - - // Read the corresponding string table - Format(table_name, sizeof(table_name), "|strtable_%s.stb", current_lang.Name); - if (LoadTable(table_name) == false) - { - goto LABEL_FATAL_ERROR; - } - - FreeLangList(o); -} - -// Get the language of the current OS -void GetCurrentOsLang(LANGLIST *e) -{ - // Validate arguments - if (e == NULL) - { - return; - } - - Copy(e, ¤t_os_lang, sizeof(LANGLIST)); -} - -// Get the language ID of the current OS -UINT GetCurrentOsLangId() -{ - LANGLIST e; - - Zero(&e, sizeof(e)); - - GetCurrentOsLang(&e); - - return e.Id; -} - -// Get the current language -void GetCurrentLang(LANGLIST *e) -{ - // Validate arguments - if (e == NULL) - { - return; - } - - Copy(e, ¤t_lang, sizeof(LANGLIST)); -} - -// Get the current language ID -UINT GetCurrentLangId() -{ - LANGLIST e; - - Zero(&e, sizeof(e)); - - GetCurrentLang(&e); - - return e.Id; -} - -// Write to the lang.config file in the current directory -bool SaveLangConfigCurrentDir(char *str) -{ - // Validate arguments - if (str == NULL) - { - return false; - } - - return SaveLangConfig(LANG_CONFIG_FILENAME, str); -} - -// Write to the lang.config file -bool SaveLangConfig(wchar_t *filename, char *str) -{ - BUF *b; - LIST *o; - UINT i; - bool ret; - // Validate arguments - if (filename == NULL) - { - return false; - } - - // Read the template - b = ReadDump(LANG_CONFIG_TEMPLETE); - if (b == NULL) - { - return false; - } - - SeekBuf(b, b->Size, 0); - - o = LoadLangList(); - if (o != NULL) - { - wchar_t tmp[MAX_SIZE]; - - AppendBufStr(b, "# Available Language IDs are:\r\n"); - - for (i = 0;i < LIST_NUM(o);i++) - { - LANGLIST *e = LIST_DATA(o, i); - - UniFormat(tmp, sizeof(tmp), L"# %S: %s (%s)\r\n", - e->Name, e->TitleEnglish, e->TitleLocal); - - AppendBufUtf8(b, tmp); - } - - AppendBufStr(b, "\r\n\r\n# Specify a Language ID here.\r\n"); - AppendBufStr(b, str); - AppendBufStr(b, "\r\n\r\n"); - - FreeLangList(o); - } - - ret = DumpBufWIfNecessary(b, filename); - - FreeBuf(b); - - return ret; -} - -// Read the lang.config file in the current directory -bool LoadLangConfigCurrentDir(char *str, UINT str_size) -{ - // Validate arguments - if (str == NULL) - { - return false; - } - - return LoadLangConfig(LANG_CONFIG_FILENAME, str, str_size); -} - -// Read the lang.config file -bool LoadLangConfig(wchar_t *filename, char *str, UINT str_size) -{ - BUF *b; - bool ret = false; - // Validate arguments - if (filename == NULL || str == NULL) - { - return false; - } - - b = ReadDumpW(filename); - if (b == NULL) - { - return false; - } - - while (true) - { - char *line = CfgReadNextLine(b); - - if (line == NULL) - { - break; - } - - Trim(line); - - if (IsEmptyStr(line) == false) - { - if (StartWith(line, "#") == false && StartWith(line, "//") == false && StartWith(line, ";") == false && - InStr(line, "#") == false) - { - StrCpy(str, str_size, line); - ret = true; - } - } - - Free(line); - } - - FreeBuf(b); - - return ret; -} - -// Choose the language from the ID -LANGLIST *GetLangById(LIST *o, UINT id) -{ - UINT i; - // Validate arguments - if (o == NULL) - { - return NULL; - } - - for (i = 0;i < LIST_NUM(o);i++) - { - LANGLIST *e = LIST_DATA(o, i); - - if (e->Id == id) - { - return e; - } - } - - return NULL; -} - -// Choice the best language for the current environment -LANGLIST *GetBestLangForCurrentEnvironment(LIST *o) -{ - LANGLIST *ret = NULL; - // Validate arguments - if (o == NULL) - { - return NULL; - } - -#ifdef OS_WIN32 - ret = GetBestLangByLcid(o, MsGetUserLocaleId()); -#else // OS_WIN32 - if (true) - { - char lang[MAX_SIZE]; - - if (GetEnv("LANG", lang, sizeof(lang))) - { - ret = GetBestLangByLangStr(o, lang); - } - else - { - ret = GetBestLangByLangStr(o, "C"); - } - } -#endif // OS_WIN32 - - return ret; -} - -// Search for the best language from LANG string of UNIX -LANGLIST *GetBestLangByLangStr(LIST *o, char *str) -{ - UINT i; - LANGLIST *ret; - // Validate arguments - if (o == NULL) - { - return NULL; - } - - for (i = 0;i < LIST_NUM(o);i++) - { - LANGLIST *e = LIST_DATA(o, i); - UINT j; - - for (j = 0;j < LIST_NUM(e->LangList);j++) - { - char *v = LIST_DATA(e->LangList, j); - - if (StrCmpi(v, str) == 0) - { - return e; - } - } - } - - for (i = 0;i < LIST_NUM(o);i++) - { - LANGLIST *e = LIST_DATA(o, i); - UINT j; - - for (j = 0;j < LIST_NUM(e->LangList);j++) - { - char *v = LIST_DATA(e->LangList, j); - - if (StartWith(str, v) || StartWith(v, str)) - { - return e; - } - } - } - - ret = GetBestLangByName(o, "en"); - - return ret; -} - -// Search for the best language from LCID -LANGLIST *GetBestLangByLcid(LIST *o, UINT lcid) -{ - LANGLIST *ret; - UINT i; - // Validate arguments - if (o == NULL) - { - return NULL; - } - - for (i = 0;i < LIST_NUM(o);i++) - { - LANGLIST *e = LIST_DATA(o, i); - - if (IsIntInList(e->LcidList, lcid)) - { - return e; - } - } - - ret = GetBestLangByName(o, "en"); - - return ret; -} - -// Search for the best language from the name -LANGLIST *GetBestLangByName(LIST *o, char *name) -{ - UINT i; - LANGLIST *ret = NULL; - // Validate arguments - if (o == NULL) - { - return NULL; - } - - for (i = 0;i < LIST_NUM(o);i++) - { - LANGLIST *e = LIST_DATA(o, i); - - if (StrCmpi(e->Name, name) == 0) - { - ret = e; - break; - } - } - - if (ret != NULL) - { - return ret; - } - - for (i = 0;i < LIST_NUM(o);i++) - { - LANGLIST *e = LIST_DATA(o, i); - - if (StartWith(e->Name, name) || StartWith(name, e->Name)) - { - ret = e; - break; - } - } - - if (ret != NULL) - { - return ret; - } - - return ret; -} - -// Release the language list -void FreeLangList(LIST *o) -{ - UINT i; - // Validate arguments - if (o == NULL) - { - return; - } - - for (i = 0;i < LIST_NUM(o);i++) - { - LANGLIST *e = LIST_DATA(o, i); - - FreeStrList(e->LangList); - ReleaseIntList(e->LcidList); - - Free(e); - } - - ReleaseList(o); -} - -// Read the language list -LIST *LoadLangList() -{ - LIST *o = NewListFast(NULL); - char *filename = LANGLIST_FILENAME; - BUF *b; - -#ifdef OS_WIN32 - if (MsIsWine()) - { - filename = LANGLIST_FILENAME_WINE; - } -#endif // OS_WIN32 - - b = ReadDump(filename); - if (b == NULL) - { - return NULL; - } - - while (true) - { - char *line = CfgReadNextLine(b); - - if (line == NULL) - { - break; - } - - Trim(line); - - if (IsEmptyStr(line) == false && StartWith(line, "#") == false) - { - TOKEN_LIST *t = ParseToken(line, "\t "); - if (t != NULL) - { - if (t->NumTokens == 6) - { - LANGLIST *e = ZeroMalloc(sizeof(LANGLIST)); - TOKEN_LIST *t2; - - e->Id = ToInt(t->Token[0]); - StrCpy(e->Name, sizeof(e->Name), t->Token[1]); - Utf8ToUni(e->TitleEnglish, sizeof(e->TitleEnglish), t->Token[2], StrLen(t->Token[2])); - Utf8ToUni(e->TitleLocal, sizeof(e->TitleLocal), t->Token[3], StrLen(t->Token[3])); - - UniReplaceStrEx(e->TitleEnglish, sizeof(e->TitleEnglish), e->TitleEnglish, - L"_", L" ", true); - - UniReplaceStrEx(e->TitleLocal, sizeof(e->TitleLocal), e->TitleLocal, - L"_", L" ", true); - - e->LcidList = NewIntList(false); - - t2 = ParseToken(t->Token[4], ","); - if (t2 != NULL) - { - UINT i; - - for (i = 0;i < t2->NumTokens;i++) - { - UINT id = ToInt(t2->Token[i]); - - AddIntDistinct(e->LcidList, id); - } - - FreeToken(t2); - } - - e->LangList = NewListFast(NULL); - - t2 = ParseToken(t->Token[5], ","); - if (t2 != NULL) - { - UINT i; - - for (i = 0;i < t2->NumTokens;i++) - { - Add(e->LangList, CopyStr(t2->Token[i])); - } - - FreeToken(t2); - } - - Add(o, e); - } - - FreeToken(t); - } - } - - Free(line); - } - - FreeBuf(b); - - return o; -} - -// Get an error string in Unicode -wchar_t *GetUniErrorStr(UINT err) -{ - wchar_t *ret; - char name[MAX_SIZE]; - Format(name, sizeof(name), "ERR_%u", err); - - ret = GetTableUniStr(name); - if (UniStrLen(ret) != 0) - { - return ret; - } - else - { - return _UU("ERR_UNKNOWN"); - } -} - -// Get an error string -char *GetErrorStr(UINT err) -{ - char *ret; - char name[MAX_SIZE]; - Format(name, sizeof(name), "ERR_%u", err); - - ret = GetTableStr(name); - if (StrLen(ret) != 0) - { - return ret; - } - else - { - return _SS("ERR_UNKNOWN"); - } -} - -// Load the integer value from the table -UINT GetTableInt(char *name) -{ - char *str; - // Validate arguments - if (name == NULL) - { - return 0; - } - - str = GetTableStr(name); - return ToInt(str); -} - -// Load a Unicode string from the table -wchar_t *GetTableUniStr(char *name) -{ - TABLE *t; - // Validate arguments - if (name == NULL) - { -// Debug("%s: ************\n", name); - return L""; - } - - // Search - t = FindTable(name); - if (t == NULL) - { - //Debug("%s: UNICODE STRING NOT FOUND\n", name); - return L""; - } - - return t->unistr; -} - -// Load the string from the table -char *GetTableStr(char *name) -{ - TABLE *t; - // Validate arguments - if (name == NULL) - { - return ""; - } - -#ifdef OS_WIN32 - if (StrCmpi(name, "DEFAULT_FONT") == 0) - { - if (_II("LANG") == 2) - { - UINT os_type = GetOsType(); - if (OS_IS_WINDOWS_9X(os_type) || - GET_KETA(os_type, 100) <= 4) - { - // Use the SimSun font in Windows 9x, Windows NT 4.0, Windows 2000, Windows XP, and Windows Server 2003 - return "SimSun"; - } - } - } -#endif // OS_WIN32 - - // Search - t = FindTable(name); - if (t == NULL) - { - //Debug("%s: ANSI STRING NOT FOUND\n", name); - return ""; - } - - return t->str; -} - -// Get the string name that begins with the specified name -TOKEN_LIST *GetTableNameStartWith(char *str) -{ - UINT i; - UINT len; - LIST *o; - TOKEN_LIST *t; - char tmp[MAX_SIZE]; - // Validate arguments - if (str == NULL) - { - return NullToken(); - } - - StrCpy(tmp, sizeof(tmp), str); - StrUpper(tmp); - - len = StrLen(tmp); - - o = NewListFast(NULL); - - for (i = 0;i < LIST_NUM(TableList);i++) - { - TABLE *t = LIST_DATA(TableList, i); - UINT len2 = StrLen(t->name); - - if (len2 >= len) - { - if (Cmp(t->name, tmp, len) == 0) - { - Insert(o, CopyStr(t->name)); - } - } - } - - t = ZeroMalloc(sizeof(TOKEN_LIST)); - t->NumTokens = LIST_NUM(o); - t->Token = ZeroMalloc(sizeof(char *) * t->NumTokens); - - for (i = 0;i < t->NumTokens;i++) - { - t->Token[i] = LIST_DATA(o, i); - } - - ReleaseList(o); - - return t; -} - -// Search the table -TABLE *FindTable(char *name) -{ - TABLE *t, tt; - // Validate arguments - if (name == NULL || TableList == NULL) - { - return NULL; - } - - tt.name = CopyStr(name); - t = Search(TableList, &tt); - Free(tt.name); - - return t; -} - -// A function that compares the table name -int CmpTableName(void *p1, void *p2) -{ - TABLE *t1, *t2; - if (p1 == NULL || p2 == NULL) - { - return 0; - } - t1 = *(TABLE **)p1; - t2 = *(TABLE **)p2; - if (t1 == NULL || t2 == NULL) - { - return 0; - } - - return StrCmpi(t1->name, t2->name); -} - -// Interpret a line -TABLE *ParseTableLine(char *line, char *prefix, UINT prefix_size, LIST *replace_list) -{ - UINT i, len; - UINT len_name; - UINT string_start; - char *name; - char *name2; - UINT name2_size; - wchar_t *unistr; - char *str; - UINT unistr_size, str_size; - TABLE *t; - // Validate arguments - if (line == NULL || prefix == NULL) - { - return NULL; - } - TrimLeft(line); - - // No line - len = StrLen(line); - if (len == 0) - { - return NULL; - } - - // Comment - if (line[0] == '#' || (line[0] == '/' && line[1] == '/')) - { - return NULL; - } - - // Search to the end position of the name - len_name = 0; - for (i = 0;;i++) - { - if (line[i] == 0) - { - // There is only one token - return NULL; - } - if (line[i] == ' ' || line[i] == '\t') - { - break; - } - len_name++; - } - - name = Malloc(len_name + 1); - StrCpy(name, len_name + 1, line); - - string_start = len_name; - for (i = len_name;i < len;i++) - { - if (line[i] != ' ' && line[i] != '\t') - { - break; - } - string_start++; - } - if (i == len) - { - Free(name); - return NULL; - } - - // Unescape - UnescapeStr(&line[string_start]); - - // Convert to Unicode - unistr_size = CalcUtf8ToUni(&line[string_start], StrLen(&line[string_start])); - if (unistr_size == 0) - { - Free(name); - return NULL; - } - unistr = Malloc(unistr_size); - Utf8ToUni(unistr, unistr_size, &line[string_start], StrLen(&line[string_start])); - - if (UniInChar(unistr, L'$')) - { - // Replace the replacement string - wchar_t *tmp; - UINT tmp_size = (UniStrSize(unistr) + 1024) * 2; - UINT i; - - tmp = Malloc(tmp_size); - - UniStrCpy(tmp, tmp_size, unistr); - - for (i = 0; i < LIST_NUM(replace_list);i++) - { - TABLE *r = LIST_DATA(replace_list, i); - - UniReplaceStrEx(tmp, tmp_size, tmp, (wchar_t *)r->name, r->unistr, false); - } - - Free(unistr); - - unistr = CopyUniStr(tmp); - - Free(tmp); - } - - // Convert to ANSI - str_size = CalcUniToStr(unistr); - if (str_size == 0) - { - str_size = 1; - str = Malloc(1); - str[0] = 0; - } - else - { - str = Malloc(str_size); - UniToStr(str, str_size, unistr); - } - - if (StrCmpi(name, "PREFIX") == 0) - { - // Prefix is specified - StrCpy(prefix, prefix_size, str); - Trim(prefix); - - if (StrCmpi(prefix, "$") == 0 || StrCmpi(prefix, "NULL") == 0) - { - prefix[0] = 0; - } - - Free(name); - Free(str); - Free(unistr); - - return NULL; - } - - name2_size = StrLen(name) + StrLen(prefix) + 2; - name2 = ZeroMalloc(name2_size); - - if (prefix[0] != 0) - { - StrCat(name2, name2_size, prefix); - StrCat(name2, name2_size, "@"); - } - - StrCat(name2, name2_size, name); - - Free(name); - - // Create a TABLE - t = Malloc(sizeof(TABLE)); - StrUpper(name2); - t->name = name2; - t->str = str; - t->unistr = unistr; - - return t; -} - -// Unescape the string -void UnescapeStr(char *src) -{ - UINT i, len, wp; - char *tmp; - // Validate arguments - if (src == NULL) - { - return; - } - - len = StrLen(src); - tmp = Malloc(len + 1); - wp = 0; - for (i = 0;i < len;i++) - { - if (src[i] == '\\') - { - i++; - switch (src[i]) - { - case 0: - goto FINISH; - case '\\': - tmp[wp++] = '\\'; - break; - case ' ': - tmp[wp++] = ' '; - break; - case 'n': - case 'N': - tmp[wp++] = '\n'; - break; - case 'r': - case 'R': - tmp[wp++] = '\r'; - break; - case 't': - case 'T': - tmp[wp++] = '\t'; - break; - } - } - else - { - tmp[wp++] = src[i]; - } - } -FINISH: - tmp[wp++] = 0; - StrCpy(src, 0, tmp); - Free(tmp); -} - -// Release the table -void FreeTable() -{ - UINT i, num; - TABLE **tables; - if (TableList == NULL) - { - return; - } - - num = LIST_NUM(TableList); - tables = ToArray(TableList); - for (i = 0;i < num;i++) - { - TABLE *t = tables[i]; - Free(t->name); - Free(t->str); - Free(t->unistr); - Free(t); - } - ReleaseList(TableList); - TableList = NULL; - Free(tables); - - Zero(old_table_name, sizeof(old_table_name)); -} - -// Read a string table from the buffer -bool LoadTableFromBuf(BUF *b) -{ - char *tmp; - char prefix[MAX_SIZE]; - LIST *replace_list = NULL; - UINT i; - // Validate arguments - if (b == NULL) - { - return false; - } - - // If the table already exists, delete it - FreeTable(); - - // Create a list - TableList = NewList(CmpTableName); - - Zero(prefix, sizeof(prefix)); - - replace_list = NewListFast(NULL); - - // Read the contents of the buffer line by line - while (true) - { - TABLE *t; - bool ok = true; - - tmp = CfgReadNextLine(b); - if (tmp == NULL) - { - break; - } - - if (tmp[0] == '$') - { - char key[128]; - char value[MAX_SIZE]; - if (GetKeyAndValue(tmp, key, sizeof(key), value, sizeof(value), " \t")) - { - if (StartWith(key, "$") && EndWith(key, "$") && StrLen(key) >= 3) - { - TABLE *t; - wchar_t univalue[MAX_SIZE]; - wchar_t uniname[MAX_SIZE]; - - t = ZeroMalloc(sizeof(TABLE)); - - Zero(univalue, sizeof(univalue)); - Utf8ToUni(univalue, sizeof(univalue), value, StrLen(value)); - - StrToUni(uniname, sizeof(uniname), key); - - t->name = (char *)CopyUniStr(uniname); - t->unistr = CopyUniStr(univalue); - - Add(replace_list, t); - - // Found a replacement definition - ok = false; - } - } - } - - if (ok) - { - t = ParseTableLine(tmp, prefix, sizeof(prefix), replace_list); - if (t != NULL) - { - // Register - Insert(TableList, t); - } - } - - Free(tmp); - } - - for (i = 0;i < LIST_NUM(replace_list);i++) - { - TABLE *t = LIST_DATA(replace_list, i); - - Free(t->name); - Free(t->str); - Free(t->unistr); - - Free(t); - } - - ReleaseList(replace_list); - - return true; -} - -// Generate the Unicode string cache file name -void GenerateUnicodeCacheFileName(wchar_t *name, UINT size, wchar_t *strfilename, UINT strfilesize, UCHAR *filehash) -{ - wchar_t tmp[MAX_SIZE]; - wchar_t hashstr[64]; - wchar_t hashtemp[MAX_SIZE]; - wchar_t exe[MAX_SIZE]; - UCHAR hash[SHA1_SIZE]; - // Validate arguments - if (name == NULL || strfilename == NULL || filehash == NULL) - { - return; - } - - GetExeDirW(exe, sizeof(exe)); - UniStrCpy(hashtemp, sizeof(hashtemp), strfilename); - BinToStrW(tmp, sizeof(tmp), filehash, MD5_SIZE); - UniStrCat(hashtemp, sizeof(hashtemp), tmp); - UniStrCat(hashtemp, sizeof(hashtemp), exe); - UniStrLower(hashtemp); - - Sha0(hash, hashtemp, UniStrLen(hashtemp) * sizeof(wchar_t)); - BinToStrW(hashstr, sizeof(hashstr), hash, 4); - UniFormat(tmp, sizeof(tmp), UNICODE_CACHE_FILE, hashstr); - UniStrLower(tmp); - -#ifndef OS_WIN32 - UniStrCpy(exe, sizeof(exe), L"/tmp"); -#else // OS_WIN32 - StrToUni(exe, sizeof(exe), MsGetTempDir()); -#endif // OS_WIN32 - - UniFormat(name, size, L"%s/%s", exe, tmp); - NormalizePathW(name, size, name); -} - -// Save the Unicode cache -void SaveUnicodeCache(wchar_t *strfilename, UINT strfilesize, UCHAR *hash) -{ - UNICODE_CACHE c; - BUF *b; - UINT i; - IO *io; - wchar_t name[MAX_PATH]; - UCHAR binhash[MD5_SIZE]; - // Validate arguments - if (strfilename == NULL || hash == NULL) - { - return; - } - - Zero(&c, sizeof(c)); - UniToStr(c.StrFileName, sizeof(c.StrFileName), strfilename); - c.StrFileSize = strfilesize; - GetMachineName(c.MachineName, sizeof(c.MachineName)); - c.OsType = GetOsInfo()->OsType; - Copy(c.hash, hash, MD5_SIZE); - -#ifdef OS_UNIX - GetCurrentCharSet(c.CharSet, sizeof(c.CharSet)); -#else // OS_UNIX - { - UINT id = MsGetThreadLocale(); - Copy(c.CharSet, &id, sizeof(id)); - } -#endif // OS_UNIX - - b = NewBuf(); - WriteBuf(b, &c, sizeof(c)); - - WriteBufInt(b, LIST_NUM(TableList)); - for (i = 0;i < LIST_NUM(TableList);i++) - { - TABLE *t = LIST_DATA(TableList, i); - WriteBufInt(b, StrLen(t->name)); - WriteBuf(b, t->name, StrLen(t->name)); - WriteBufInt(b, StrLen(t->str)); - WriteBuf(b, t->str, StrLen(t->str)); - WriteBufInt(b, UniStrLen(t->unistr)); - WriteBuf(b, t->unistr, UniStrLen(t->unistr) * sizeof(wchar_t)); - } - - Md5(binhash, b->Buf, b->Size); - WriteBuf(b, binhash, MD5_SIZE); - - GenerateUnicodeCacheFileName(name, sizeof(name), strfilename, strfilesize, hash); - - io = FileCreateW(name); - if (io != NULL) - { - SeekBuf(b, 0, 0); - BufToFile(io, b); - FileClose(io); - } - - FreeBuf(b); -} - -// Reading the Unicode cache -bool LoadUnicodeCache(wchar_t *strfilename, UINT strfilesize, UCHAR *hash) -{ - UNICODE_CACHE c, t; - BUF *b; - UINT i, num; - IO *io; - wchar_t name[MAX_PATH]; - UCHAR binhash[MD5_SIZE]; - UCHAR binhash_2[MD5_SIZE]; - // Validate arguments - if (strfilename == NULL || hash == NULL) - { - return false; - } - - GenerateUnicodeCacheFileName(name, sizeof(name), strfilename, strfilesize, hash); - - io = FileOpenW(name, false); - if (io == NULL) - { - return false; - } - - b = FileToBuf(io); - if (b == NULL) - { - FileClose(io); - return false; - } - - SeekBuf(b, 0, 0); - FileClose(io); - - Md5(binhash, b->Buf, b->Size >= MD5_SIZE ? (b->Size - MD5_SIZE) : 0); - Copy(binhash_2, ((UCHAR *)b->Buf) + (b->Size >= MD5_SIZE ? (b->Size - MD5_SIZE) : 0), MD5_SIZE); - if (Cmp(binhash, binhash_2, MD5_SIZE) != 0) - { - FreeBuf(b); - return false; - } - - Zero(&c, sizeof(c)); - UniToStr(c.StrFileName, sizeof(c.StrFileName), strfilename); - c.StrFileSize = strfilesize; - DisableNetworkNameCache(); - GetMachineName(c.MachineName, sizeof(c.MachineName)); - EnableNetworkNameCache(); - c.OsType = GetOsInfo()->OsType; - Copy(c.hash, hash, MD5_SIZE); - -#ifdef OS_UNIX - GetCurrentCharSet(c.CharSet, sizeof(c.CharSet)); -#else // OS_UNIX - { - UINT id = MsGetThreadLocale(); - Copy(c.CharSet, &id, sizeof(id)); - } -#endif // OS_UNIX - - Zero(&t, sizeof(t)); - ReadBuf(b, &t, sizeof(t)); - - if (Cmp(&c, &t, sizeof(UNICODE_CACHE)) != 0) - { - FreeBuf(b); - return false; - } - - num = ReadBufInt(b); - - FreeTable(); - TableList = NewList(CmpTableName); - - for (i = 0;i < num;i++) - { - UINT len; - TABLE *t = ZeroMalloc(sizeof(TABLE)); - - len = ReadBufInt(b); - t->name = ZeroMalloc(len + 1); - ReadBuf(b, t->name, len); - - len = ReadBufInt(b); - t->str = ZeroMalloc(len + 1); - ReadBuf(b, t->str, len); - - len = ReadBufInt(b); - t->unistr = ZeroMalloc((len + 1) * sizeof(wchar_t)); - ReadBuf(b, t->unistr, len * sizeof(wchar_t)); - - Add(TableList, t); - } - - FreeBuf(b); - - Sort(TableList); - - return true; -} - -// Read the string table -bool LoadTableMain(wchar_t *filename) -{ - BUF *b; - UINT64 t1, t2; - UCHAR hash[MD5_SIZE]; - // Validate arguments - if (filename == NULL) - { - return false; - } - - if (MayaquaIsMinimalMode()) - { - return true; - } - - if (UniStrCmpi(old_table_name, filename) == 0) - { - // Already loaded - return true; - } - - t1 = Tick64(); - - // Open the file - b = ReadDumpW(filename); - if (b == NULL) - { - char tmp[MAX_SIZE]; - StrCpy(tmp, sizeof(tmp), "Error: Can't read string tables (file not found).\r\nPlease check hamcore.se2.\r\n\r\n(First, reboot the computer. If this problem occurs again, please reinstall VPN software files.)"); - Alert(tmp, NULL); - exit(-1); - return false; - } - - Md5(hash, b->Buf, b->Size); - - if (LoadUnicodeCache(filename, b->Size, hash) == false) - { - if (LoadTableFromBuf(b) == false) - { - FreeBuf(b); - return false; - } - - SaveUnicodeCache(filename, b->Size, hash); - - //Debug("Unicode Source: strtable.stb\n"); - } - else - { - //Debug("Unicode Source: unicode_cache\n"); - } - - FreeBuf(b); - - SetLocale(_UU("DEFAULT_LOCALE")); - - UniStrCpy(old_table_name, sizeof(old_table_name), filename); - - t2 = Tick64(); - - if (StrCmpi(_SS("STRTABLE_ID"), STRTABLE_ID) != 0) - { - char tmp[MAX_SIZE]; - Format(tmp, sizeof(tmp), "Error: Can't read string tables (invalid version: '%s'!='%s').\r\nPlease check hamcore.se2.\r\n\r\n(First, reboot the computer. If this problem occurs again, please reinstall VPN software files.)", - _SS("STRTABLE_ID"), STRTABLE_ID); - Alert(tmp, NULL); - exit(-1); - return false; - } - - //Debug("Unicode File Read Cost: %u (%u Lines)\n", (UINT)(t2 - t1), LIST_NUM(TableList)); - - return true; -} -bool LoadTable(char *filename) -{ - wchar_t *filename_a = CopyStrToUni(filename); - bool ret = LoadTableW(filename_a); - - Free(filename_a); - - return ret; -} -bool LoadTableW(wchar_t *filename) -{ - bool ret; - BUF *b; - wchar_t replace_name[MAX_PATH]; - - Zero(replace_name, sizeof(replace_name)); - - b = ReadDump("@table_name.txt"); - if (b != NULL) - { - char *s = CfgReadNextLine(b); - if (s != NULL) - { - if (IsEmptyStr(s) == false) - { - StrToUni(replace_name, sizeof(replace_name), s); - filename = replace_name; - } - - Free(s); - } - FreeBuf(b); - } - - ret = LoadTableMain(filename); - - return ret; -} +// SoftEther VPN Source Code - Developer Edition Master Branch +// Mayaqua Kernel + + +// Table.c +// Read and management routines for string table + +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +// List of TABLE +static LIST *TableList = NULL; +static wchar_t old_table_name[MAX_SIZE] = {0}; // Old table name +static LANGLIST current_lang = {0}; +static LANGLIST current_os_lang = {0}; + +// Initialization of string table routine +void InitTable() +{ + LIST *o; + char tmp[MAX_SIZE]; + LANGLIST *e = NULL; + LANGLIST *os_lang = NULL; + char table_name[MAX_SIZE]; + if (MayaquaIsMinimalMode()) + { + // Not to load in case of minimum mode + return; + } + + o = LoadLangList(); + if (o == NULL) + { +LABEL_FATAL_ERROR: + Alert("Fatal Error: The file \"hamcore.se2\" is missing or broken.\r\nPlease check hamcore.se2.\r\n\r\n(First, reboot the computer. If this problem occurs again, please reinstall VPN software files.)", NULL); + exit(-1); + return; + } + + // Read the lang.config + if (LoadLangConfigCurrentDir(tmp, sizeof(tmp))) + { + e = GetBestLangByName(o, tmp); + } + + os_lang = GetBestLangForCurrentEnvironment(o); + + if (e == NULL) + { + e = os_lang; + } + + if (e == NULL) + { + goto LABEL_FATAL_ERROR; + } + + SaveLangConfigCurrentDir(e->Name); + + Copy(¤t_lang, e, sizeof(LANGLIST)); + Copy(¤t_os_lang, os_lang, sizeof(LANGLIST)); + + current_lang.LangList = current_lang.LcidList = NULL; + current_os_lang.LangList = current_os_lang.LcidList = NULL; + + // Read the corresponding string table + Format(table_name, sizeof(table_name), "|strtable_%s.stb", current_lang.Name); + if (LoadTable(table_name) == false) + { + goto LABEL_FATAL_ERROR; + } + + FreeLangList(o); +} + +// Get the language of the current OS +void GetCurrentOsLang(LANGLIST *e) +{ + // Validate arguments + if (e == NULL) + { + return; + } + + Copy(e, ¤t_os_lang, sizeof(LANGLIST)); +} + +// Get the language ID of the current OS +UINT GetCurrentOsLangId() +{ + LANGLIST e; + + Zero(&e, sizeof(e)); + + GetCurrentOsLang(&e); + + return e.Id; +} + +// Get the current language +void GetCurrentLang(LANGLIST *e) +{ + // Validate arguments + if (e == NULL) + { + return; + } + + Copy(e, ¤t_lang, sizeof(LANGLIST)); +} + +// Get the current language ID +UINT GetCurrentLangId() +{ + LANGLIST e; + + Zero(&e, sizeof(e)); + + GetCurrentLang(&e); + + return e.Id; +} + +// Write to the lang.config file in the current directory +bool SaveLangConfigCurrentDir(char *str) +{ + // Validate arguments + if (str == NULL) + { + return false; + } + + return SaveLangConfig(LANG_CONFIG_FILENAME, str); +} + +// Write to the lang.config file +bool SaveLangConfig(wchar_t *filename, char *str) +{ + BUF *b; + LIST *o; + UINT i; + bool ret; + // Validate arguments + if (filename == NULL) + { + return false; + } + + // Read the template + b = ReadDump(LANG_CONFIG_TEMPLETE); + if (b == NULL) + { + return false; + } + + SeekBuf(b, b->Size, 0); + + o = LoadLangList(); + if (o != NULL) + { + wchar_t tmp[MAX_SIZE]; + + AppendBufStr(b, "# Available Language IDs are:\r\n"); + + for (i = 0;i < LIST_NUM(o);i++) + { + LANGLIST *e = LIST_DATA(o, i); + + UniFormat(tmp, sizeof(tmp), L"# %S: %s (%s)\r\n", + e->Name, e->TitleEnglish, e->TitleLocal); + + AppendBufUtf8(b, tmp); + } + + AppendBufStr(b, "\r\n\r\n# Specify a Language ID here.\r\n"); + AppendBufStr(b, str); + AppendBufStr(b, "\r\n\r\n"); + + FreeLangList(o); + } + + ret = DumpBufWIfNecessary(b, filename); + + FreeBuf(b); + + return ret; +} + +// Read the lang.config file in the current directory +bool LoadLangConfigCurrentDir(char *str, UINT str_size) +{ + // Validate arguments + if (str == NULL) + { + return false; + } + + return LoadLangConfig(LANG_CONFIG_FILENAME, str, str_size); +} + +// Read the lang.config file +bool LoadLangConfig(wchar_t *filename, char *str, UINT str_size) +{ + BUF *b; + bool ret = false; + // Validate arguments + if (filename == NULL || str == NULL) + { + return false; + } + + b = ReadDumpW(filename); + if (b == NULL) + { + return false; + } + + while (true) + { + char *line = CfgReadNextLine(b); + + if (line == NULL) + { + break; + } + + Trim(line); + + if (IsEmptyStr(line) == false) + { + if (StartWith(line, "#") == false && StartWith(line, "//") == false && StartWith(line, ";") == false && + InStr(line, "#") == false) + { + StrCpy(str, str_size, line); + ret = true; + } + } + + Free(line); + } + + FreeBuf(b); + + return ret; +} + +// Choose the language from the ID +LANGLIST *GetLangById(LIST *o, UINT id) +{ + UINT i; + // Validate arguments + if (o == NULL) + { + return NULL; + } + + for (i = 0;i < LIST_NUM(o);i++) + { + LANGLIST *e = LIST_DATA(o, i); + + if (e->Id == id) + { + return e; + } + } + + return NULL; +} + +// Choice the best language for the current environment +LANGLIST *GetBestLangForCurrentEnvironment(LIST *o) +{ + LANGLIST *ret = NULL; + // Validate arguments + if (o == NULL) + { + return NULL; + } + +#ifdef OS_WIN32 + ret = GetBestLangByLcid(o, MsGetUserLocaleId()); +#else // OS_WIN32 + if (true) + { + char lang[MAX_SIZE]; + + if (GetEnv("LANG", lang, sizeof(lang))) + { + ret = GetBestLangByLangStr(o, lang); + } + else + { + ret = GetBestLangByLangStr(o, "C"); + } + } +#endif // OS_WIN32 + + return ret; +} + +// Search for the best language from LANG string of UNIX +LANGLIST *GetBestLangByLangStr(LIST *o, char *str) +{ + UINT i; + LANGLIST *ret; + // Validate arguments + if (o == NULL) + { + return NULL; + } + + for (i = 0;i < LIST_NUM(o);i++) + { + LANGLIST *e = LIST_DATA(o, i); + UINT j; + + for (j = 0;j < LIST_NUM(e->LangList);j++) + { + char *v = LIST_DATA(e->LangList, j); + + if (StrCmpi(v, str) == 0) + { + return e; + } + } + } + + for (i = 0;i < LIST_NUM(o);i++) + { + LANGLIST *e = LIST_DATA(o, i); + UINT j; + + for (j = 0;j < LIST_NUM(e->LangList);j++) + { + char *v = LIST_DATA(e->LangList, j); + + if (StartWith(str, v) || StartWith(v, str)) + { + return e; + } + } + } + + ret = GetBestLangByName(o, "en"); + + return ret; +} + +// Search for the best language from LCID +LANGLIST *GetBestLangByLcid(LIST *o, UINT lcid) +{ + LANGLIST *ret; + UINT i; + // Validate arguments + if (o == NULL) + { + return NULL; + } + + for (i = 0;i < LIST_NUM(o);i++) + { + LANGLIST *e = LIST_DATA(o, i); + + if (IsIntInList(e->LcidList, lcid)) + { + return e; + } + } + + ret = GetBestLangByName(o, "en"); + + return ret; +} + +// Search for the best language from the name +LANGLIST *GetBestLangByName(LIST *o, char *name) +{ + UINT i; + LANGLIST *ret = NULL; + // Validate arguments + if (o == NULL) + { + return NULL; + } + + for (i = 0;i < LIST_NUM(o);i++) + { + LANGLIST *e = LIST_DATA(o, i); + + if (StrCmpi(e->Name, name) == 0) + { + ret = e; + break; + } + } + + if (ret != NULL) + { + return ret; + } + + for (i = 0;i < LIST_NUM(o);i++) + { + LANGLIST *e = LIST_DATA(o, i); + + if (StartWith(e->Name, name) || StartWith(name, e->Name)) + { + ret = e; + break; + } + } + + if (ret != NULL) + { + return ret; + } + + return ret; +} + +// Release the language list +void FreeLangList(LIST *o) +{ + UINT i; + // Validate arguments + if (o == NULL) + { + return; + } + + for (i = 0;i < LIST_NUM(o);i++) + { + LANGLIST *e = LIST_DATA(o, i); + + FreeStrList(e->LangList); + ReleaseIntList(e->LcidList); + + Free(e); + } + + ReleaseList(o); +} + +// Read the language list +LIST *LoadLangList() +{ + LIST *o = NewListFast(NULL); + char *filename = LANGLIST_FILENAME; + BUF *b; + +#ifdef OS_WIN32 + if (MsIsWine()) + { + filename = LANGLIST_FILENAME_WINE; + } +#endif // OS_WIN32 + + b = ReadDump(filename); + if (b == NULL) + { + return NULL; + } + + while (true) + { + char *line = CfgReadNextLine(b); + + if (line == NULL) + { + break; + } + + Trim(line); + + if (IsEmptyStr(line) == false && StartWith(line, "#") == false) + { + TOKEN_LIST *t = ParseToken(line, "\t "); + if (t != NULL) + { + if (t->NumTokens == 6) + { + LANGLIST *e = ZeroMalloc(sizeof(LANGLIST)); + TOKEN_LIST *t2; + + e->Id = ToInt(t->Token[0]); + StrCpy(e->Name, sizeof(e->Name), t->Token[1]); + Utf8ToUni(e->TitleEnglish, sizeof(e->TitleEnglish), t->Token[2], StrLen(t->Token[2])); + Utf8ToUni(e->TitleLocal, sizeof(e->TitleLocal), t->Token[3], StrLen(t->Token[3])); + + UniReplaceStrEx(e->TitleEnglish, sizeof(e->TitleEnglish), e->TitleEnglish, + L"_", L" ", true); + + UniReplaceStrEx(e->TitleLocal, sizeof(e->TitleLocal), e->TitleLocal, + L"_", L" ", true); + + e->LcidList = NewIntList(false); + + t2 = ParseToken(t->Token[4], ","); + if (t2 != NULL) + { + UINT i; + + for (i = 0;i < t2->NumTokens;i++) + { + UINT id = ToInt(t2->Token[i]); + + AddIntDistinct(e->LcidList, id); + } + + FreeToken(t2); + } + + e->LangList = NewListFast(NULL); + + t2 = ParseToken(t->Token[5], ","); + if (t2 != NULL) + { + UINT i; + + for (i = 0;i < t2->NumTokens;i++) + { + Add(e->LangList, CopyStr(t2->Token[i])); + } + + FreeToken(t2); + } + + Add(o, e); + } + + FreeToken(t); + } + } + + Free(line); + } + + FreeBuf(b); + + return o; +} + +// Get an error string in Unicode +wchar_t *GetUniErrorStr(UINT err) +{ + wchar_t *ret; + char name[MAX_SIZE]; + Format(name, sizeof(name), "ERR_%u", err); + + ret = GetTableUniStr(name); + if (UniStrLen(ret) != 0) + { + return ret; + } + else + { + return _UU("ERR_UNKNOWN"); + } +} + +// Get an error string +char *GetErrorStr(UINT err) +{ + char *ret; + char name[MAX_SIZE]; + Format(name, sizeof(name), "ERR_%u", err); + + ret = GetTableStr(name); + if (StrLen(ret) != 0) + { + return ret; + } + else + { + return _SS("ERR_UNKNOWN"); + } +} + +// Load the integer value from the table +UINT GetTableInt(char *name) +{ + char *str; + // Validate arguments + if (name == NULL) + { + return 0; + } + + str = GetTableStr(name); + return ToInt(str); +} + +// Load a Unicode string from the table +wchar_t *GetTableUniStr(char *name) +{ + TABLE *t; + // Validate arguments + if (name == NULL) + { +// Debug("%s: ************\n", name); + return L""; + } + + // Search + t = FindTable(name); + if (t == NULL) + { + //Debug("%s: UNICODE STRING NOT FOUND\n", name); + return L""; + } + + return t->unistr; +} + +// Load the string from the table +char *GetTableStr(char *name) +{ + TABLE *t; + // Validate arguments + if (name == NULL) + { + return ""; + } + +#ifdef OS_WIN32 + if (StrCmpi(name, "DEFAULT_FONT") == 0) + { + if (_II("LANG") == 2) + { + UINT os_type = GetOsType(); + if (OS_IS_WINDOWS_9X(os_type) || + GET_KETA(os_type, 100) <= 4) + { + // Use the SimSun font in Windows 9x, Windows NT 4.0, Windows 2000, Windows XP, and Windows Server 2003 + return "SimSun"; + } + } + } +#endif // OS_WIN32 + + // Search + t = FindTable(name); + if (t == NULL) + { + //Debug("%s: ANSI STRING NOT FOUND\n", name); + return ""; + } + + return t->str; +} + +// Get the string name that begins with the specified name +TOKEN_LIST *GetTableNameStartWith(char *str) +{ + UINT i; + UINT len; + LIST *o; + TOKEN_LIST *t; + char tmp[MAX_SIZE]; + // Validate arguments + if (str == NULL) + { + return NullToken(); + } + + StrCpy(tmp, sizeof(tmp), str); + StrUpper(tmp); + + len = StrLen(tmp); + + o = NewListFast(NULL); + + for (i = 0;i < LIST_NUM(TableList);i++) + { + TABLE *t = LIST_DATA(TableList, i); + UINT len2 = StrLen(t->name); + + if (len2 >= len) + { + if (Cmp(t->name, tmp, len) == 0) + { + Insert(o, CopyStr(t->name)); + } + } + } + + t = ZeroMalloc(sizeof(TOKEN_LIST)); + t->NumTokens = LIST_NUM(o); + t->Token = ZeroMalloc(sizeof(char *) * t->NumTokens); + + for (i = 0;i < t->NumTokens;i++) + { + t->Token[i] = LIST_DATA(o, i); + } + + ReleaseList(o); + + return t; +} + +// Search the table +TABLE *FindTable(char *name) +{ + TABLE *t, tt; + // Validate arguments + if (name == NULL || TableList == NULL) + { + return NULL; + } + + tt.name = CopyStr(name); + t = Search(TableList, &tt); + Free(tt.name); + + return t; +} + +// A function that compares the table name +int CmpTableName(void *p1, void *p2) +{ + TABLE *t1, *t2; + if (p1 == NULL || p2 == NULL) + { + return 0; + } + t1 = *(TABLE **)p1; + t2 = *(TABLE **)p2; + if (t1 == NULL || t2 == NULL) + { + return 0; + } + + return StrCmpi(t1->name, t2->name); +} + +// Interpret a line +TABLE *ParseTableLine(char *line, char *prefix, UINT prefix_size, LIST *replace_list) +{ + UINT i, len; + UINT len_name; + UINT string_start; + char *name; + char *name2; + UINT name2_size; + wchar_t *unistr; + char *str; + UINT unistr_size, str_size; + TABLE *t; + // Validate arguments + if (line == NULL || prefix == NULL) + { + return NULL; + } + TrimLeft(line); + + // No line + len = StrLen(line); + if (len == 0) + { + return NULL; + } + + // Comment + if (line[0] == '#' || (line[0] == '/' && line[1] == '/')) + { + return NULL; + } + + // Search to the end position of the name + len_name = 0; + for (i = 0;;i++) + { + if (line[i] == 0) + { + // There is only one token + return NULL; + } + if (line[i] == ' ' || line[i] == '\t') + { + break; + } + len_name++; + } + + name = Malloc(len_name + 1); + StrCpy(name, len_name + 1, line); + + string_start = len_name; + for (i = len_name;i < len;i++) + { + if (line[i] != ' ' && line[i] != '\t') + { + break; + } + string_start++; + } + if (i == len) + { + Free(name); + return NULL; + } + + // Unescape + UnescapeStr(&line[string_start]); + + // Convert to Unicode + unistr_size = CalcUtf8ToUni(&line[string_start], StrLen(&line[string_start])); + if (unistr_size == 0) + { + Free(name); + return NULL; + } + unistr = Malloc(unistr_size); + Utf8ToUni(unistr, unistr_size, &line[string_start], StrLen(&line[string_start])); + + if (UniInChar(unistr, L'$')) + { + // Replace the replacement string + wchar_t *tmp; + UINT tmp_size = (UniStrSize(unistr) + 1024) * 2; + UINT i; + + tmp = Malloc(tmp_size); + + UniStrCpy(tmp, tmp_size, unistr); + + for (i = 0; i < LIST_NUM(replace_list);i++) + { + TABLE *r = LIST_DATA(replace_list, i); + + UniReplaceStrEx(tmp, tmp_size, tmp, (wchar_t *)r->name, r->unistr, false); + } + + Free(unistr); + + unistr = CopyUniStr(tmp); + + Free(tmp); + } + + // Convert to ANSI + str_size = CalcUniToStr(unistr); + if (str_size == 0) + { + str_size = 1; + str = Malloc(1); + str[0] = 0; + } + else + { + str = Malloc(str_size); + UniToStr(str, str_size, unistr); + } + + if (StrCmpi(name, "PREFIX") == 0) + { + // Prefix is specified + StrCpy(prefix, prefix_size, str); + Trim(prefix); + + if (StrCmpi(prefix, "$") == 0 || StrCmpi(prefix, "NULL") == 0) + { + prefix[0] = 0; + } + + Free(name); + Free(str); + Free(unistr); + + return NULL; + } + + name2_size = StrLen(name) + StrLen(prefix) + 2; + name2 = ZeroMalloc(name2_size); + + if (prefix[0] != 0) + { + StrCat(name2, name2_size, prefix); + StrCat(name2, name2_size, "@"); + } + + StrCat(name2, name2_size, name); + + Free(name); + + // Create a TABLE + t = Malloc(sizeof(TABLE)); + StrUpper(name2); + t->name = name2; + t->str = str; + t->unistr = unistr; + + return t; +} + +// Unescape the string +void UnescapeStr(char *src) +{ + UINT i, len, wp; + char *tmp; + // Validate arguments + if (src == NULL) + { + return; + } + + len = StrLen(src); + tmp = Malloc(len + 1); + wp = 0; + for (i = 0;i < len;i++) + { + if (src[i] == '\\') + { + i++; + switch (src[i]) + { + case 0: + goto FINISH; + case '\\': + tmp[wp++] = '\\'; + break; + case ' ': + tmp[wp++] = ' '; + break; + case 'n': + case 'N': + tmp[wp++] = '\n'; + break; + case 'r': + case 'R': + tmp[wp++] = '\r'; + break; + case 't': + case 'T': + tmp[wp++] = '\t'; + break; + } + } + else + { + tmp[wp++] = src[i]; + } + } +FINISH: + tmp[wp++] = 0; + StrCpy(src, 0, tmp); + Free(tmp); +} + +// Release the table +void FreeTable() +{ + UINT i, num; + TABLE **tables; + if (TableList == NULL) + { + return; + } + + num = LIST_NUM(TableList); + tables = ToArray(TableList); + for (i = 0;i < num;i++) + { + TABLE *t = tables[i]; + Free(t->name); + Free(t->str); + Free(t->unistr); + Free(t); + } + ReleaseList(TableList); + TableList = NULL; + Free(tables); + + Zero(old_table_name, sizeof(old_table_name)); +} + +// Read a string table from the buffer +bool LoadTableFromBuf(BUF *b) +{ + char *tmp; + char prefix[MAX_SIZE]; + LIST *replace_list = NULL; + UINT i; + // Validate arguments + if (b == NULL) + { + return false; + } + + // If the table already exists, delete it + FreeTable(); + + // Create a list + TableList = NewList(CmpTableName); + + Zero(prefix, sizeof(prefix)); + + replace_list = NewListFast(NULL); + + // Read the contents of the buffer line by line + while (true) + { + TABLE *t; + bool ok = true; + + tmp = CfgReadNextLine(b); + if (tmp == NULL) + { + break; + } + + if (tmp[0] == '$') + { + char key[128]; + char value[MAX_SIZE]; + if (GetKeyAndValue(tmp, key, sizeof(key), value, sizeof(value), " \t")) + { + if (StartWith(key, "$") && EndWith(key, "$") && StrLen(key) >= 3) + { + TABLE *t; + wchar_t univalue[MAX_SIZE]; + wchar_t uniname[MAX_SIZE]; + + t = ZeroMalloc(sizeof(TABLE)); + + Zero(univalue, sizeof(univalue)); + Utf8ToUni(univalue, sizeof(univalue), value, StrLen(value)); + + StrToUni(uniname, sizeof(uniname), key); + + t->name = (char *)CopyUniStr(uniname); + t->unistr = CopyUniStr(univalue); + + Add(replace_list, t); + + // Found a replacement definition + ok = false; + } + } + } + + if (ok) + { + t = ParseTableLine(tmp, prefix, sizeof(prefix), replace_list); + if (t != NULL) + { + // Register + Insert(TableList, t); + } + } + + Free(tmp); + } + + for (i = 0;i < LIST_NUM(replace_list);i++) + { + TABLE *t = LIST_DATA(replace_list, i); + + Free(t->name); + Free(t->str); + Free(t->unistr); + + Free(t); + } + + ReleaseList(replace_list); + + return true; +} + +// Generate the Unicode string cache file name +void GenerateUnicodeCacheFileName(wchar_t *name, UINT size, wchar_t *strfilename, UINT strfilesize, UCHAR *filehash) +{ + wchar_t tmp[MAX_SIZE]; + wchar_t hashstr[64]; + wchar_t hashtemp[MAX_SIZE]; + wchar_t exe[MAX_SIZE]; + UCHAR hash[SHA1_SIZE]; + // Validate arguments + if (name == NULL || strfilename == NULL || filehash == NULL) + { + return; + } + + GetExeDirW(exe, sizeof(exe)); + UniStrCpy(hashtemp, sizeof(hashtemp), strfilename); + BinToStrW(tmp, sizeof(tmp), filehash, MD5_SIZE); + UniStrCat(hashtemp, sizeof(hashtemp), tmp); + UniStrCat(hashtemp, sizeof(hashtemp), exe); + UniStrLower(hashtemp); + + Sha0(hash, hashtemp, UniStrLen(hashtemp) * sizeof(wchar_t)); + BinToStrW(hashstr, sizeof(hashstr), hash, 4); + UniFormat(tmp, sizeof(tmp), UNICODE_CACHE_FILE, hashstr); + UniStrLower(tmp); + +#ifndef OS_WIN32 + UniStrCpy(exe, sizeof(exe), L"/tmp"); +#else // OS_WIN32 + StrToUni(exe, sizeof(exe), MsGetTempDir()); +#endif // OS_WIN32 + + UniFormat(name, size, L"%s/%s", exe, tmp); + NormalizePathW(name, size, name); +} + +// Save the Unicode cache +void SaveUnicodeCache(wchar_t *strfilename, UINT strfilesize, UCHAR *hash) +{ + UNICODE_CACHE c; + BUF *b; + UINT i; + IO *io; + wchar_t name[MAX_PATH]; + UCHAR binhash[MD5_SIZE]; + // Validate arguments + if (strfilename == NULL || hash == NULL) + { + return; + } + + Zero(&c, sizeof(c)); + UniToStr(c.StrFileName, sizeof(c.StrFileName), strfilename); + c.StrFileSize = strfilesize; + GetMachineName(c.MachineName, sizeof(c.MachineName)); + c.OsType = GetOsInfo()->OsType; + Copy(c.hash, hash, MD5_SIZE); + +#ifdef OS_UNIX + GetCurrentCharSet(c.CharSet, sizeof(c.CharSet)); +#else // OS_UNIX + { + UINT id = MsGetThreadLocale(); + Copy(c.CharSet, &id, sizeof(id)); + } +#endif // OS_UNIX + + b = NewBuf(); + WriteBuf(b, &c, sizeof(c)); + + WriteBufInt(b, LIST_NUM(TableList)); + for (i = 0;i < LIST_NUM(TableList);i++) + { + TABLE *t = LIST_DATA(TableList, i); + WriteBufInt(b, StrLen(t->name)); + WriteBuf(b, t->name, StrLen(t->name)); + WriteBufInt(b, StrLen(t->str)); + WriteBuf(b, t->str, StrLen(t->str)); + WriteBufInt(b, UniStrLen(t->unistr)); + WriteBuf(b, t->unistr, UniStrLen(t->unistr) * sizeof(wchar_t)); + } + + Md5(binhash, b->Buf, b->Size); + WriteBuf(b, binhash, MD5_SIZE); + + GenerateUnicodeCacheFileName(name, sizeof(name), strfilename, strfilesize, hash); + + io = FileCreateW(name); + if (io != NULL) + { + SeekBuf(b, 0, 0); + BufToFile(io, b); + FileClose(io); + } + + FreeBuf(b); +} + +// Reading the Unicode cache +bool LoadUnicodeCache(wchar_t *strfilename, UINT strfilesize, UCHAR *hash) +{ + UNICODE_CACHE c, t; + BUF *b; + UINT i, num; + IO *io; + wchar_t name[MAX_PATH]; + UCHAR binhash[MD5_SIZE]; + UCHAR binhash_2[MD5_SIZE]; + // Validate arguments + if (strfilename == NULL || hash == NULL) + { + return false; + } + + GenerateUnicodeCacheFileName(name, sizeof(name), strfilename, strfilesize, hash); + + io = FileOpenW(name, false); + if (io == NULL) + { + return false; + } + + b = FileToBuf(io); + if (b == NULL) + { + FileClose(io); + return false; + } + + SeekBuf(b, 0, 0); + FileClose(io); + + Md5(binhash, b->Buf, b->Size >= MD5_SIZE ? (b->Size - MD5_SIZE) : 0); + Copy(binhash_2, ((UCHAR *)b->Buf) + (b->Size >= MD5_SIZE ? (b->Size - MD5_SIZE) : 0), MD5_SIZE); + if (Cmp(binhash, binhash_2, MD5_SIZE) != 0) + { + FreeBuf(b); + return false; + } + + Zero(&c, sizeof(c)); + UniToStr(c.StrFileName, sizeof(c.StrFileName), strfilename); + c.StrFileSize = strfilesize; + DisableNetworkNameCache(); + GetMachineName(c.MachineName, sizeof(c.MachineName)); + EnableNetworkNameCache(); + c.OsType = GetOsInfo()->OsType; + Copy(c.hash, hash, MD5_SIZE); + +#ifdef OS_UNIX + GetCurrentCharSet(c.CharSet, sizeof(c.CharSet)); +#else // OS_UNIX + { + UINT id = MsGetThreadLocale(); + Copy(c.CharSet, &id, sizeof(id)); + } +#endif // OS_UNIX + + Zero(&t, sizeof(t)); + ReadBuf(b, &t, sizeof(t)); + + if (Cmp(&c, &t, sizeof(UNICODE_CACHE)) != 0) + { + FreeBuf(b); + return false; + } + + num = ReadBufInt(b); + + FreeTable(); + TableList = NewList(CmpTableName); + + for (i = 0;i < num;i++) + { + UINT len; + TABLE *t = ZeroMalloc(sizeof(TABLE)); + + len = ReadBufInt(b); + t->name = ZeroMalloc(len + 1); + ReadBuf(b, t->name, len); + + len = ReadBufInt(b); + t->str = ZeroMalloc(len + 1); + ReadBuf(b, t->str, len); + + len = ReadBufInt(b); + t->unistr = ZeroMalloc((len + 1) * sizeof(wchar_t)); + ReadBuf(b, t->unistr, len * sizeof(wchar_t)); + + Add(TableList, t); + } + + FreeBuf(b); + + Sort(TableList); + + return true; +} + +// Read the string table +bool LoadTableMain(wchar_t *filename) +{ + BUF *b; + UINT64 t1, t2; + UCHAR hash[MD5_SIZE]; + // Validate arguments + if (filename == NULL) + { + return false; + } + + if (MayaquaIsMinimalMode()) + { + return true; + } + + if (UniStrCmpi(old_table_name, filename) == 0) + { + // Already loaded + return true; + } + + t1 = Tick64(); + + // Open the file + b = ReadDumpW(filename); + if (b == NULL) + { + char tmp[MAX_SIZE]; + StrCpy(tmp, sizeof(tmp), "Error: Can't read string tables (file not found).\r\nPlease check hamcore.se2.\r\n\r\n(First, reboot the computer. If this problem occurs again, please reinstall VPN software files.)"); + Alert(tmp, NULL); + exit(-1); + return false; + } + + Md5(hash, b->Buf, b->Size); + + if (LoadUnicodeCache(filename, b->Size, hash) == false) + { + if (LoadTableFromBuf(b) == false) + { + FreeBuf(b); + return false; + } + + SaveUnicodeCache(filename, b->Size, hash); + + //Debug("Unicode Source: strtable.stb\n"); + } + else + { + //Debug("Unicode Source: unicode_cache\n"); + } + + FreeBuf(b); + + SetLocale(_UU("DEFAULT_LOCALE")); + + UniStrCpy(old_table_name, sizeof(old_table_name), filename); + + t2 = Tick64(); + + if (StrCmpi(_SS("STRTABLE_ID"), STRTABLE_ID) != 0) + { + char tmp[MAX_SIZE]; + Format(tmp, sizeof(tmp), "Error: Can't read string tables (invalid version: '%s'!='%s').\r\nPlease check hamcore.se2.\r\n\r\n(First, reboot the computer. If this problem occurs again, please reinstall VPN software files.)", + _SS("STRTABLE_ID"), STRTABLE_ID); + Alert(tmp, NULL); + exit(-1); + return false; + } + + //Debug("Unicode File Read Cost: %u (%u Lines)\n", (UINT)(t2 - t1), LIST_NUM(TableList)); + + return true; +} +bool LoadTable(char *filename) +{ + wchar_t *filename_a = CopyStrToUni(filename); + bool ret = LoadTableW(filename_a); + + Free(filename_a); + + return ret; +} +bool LoadTableW(wchar_t *filename) +{ + bool ret; + BUF *b; + wchar_t replace_name[MAX_PATH]; + + Zero(replace_name, sizeof(replace_name)); + + b = ReadDump("@table_name.txt"); + if (b != NULL) + { + char *s = CfgReadNextLine(b); + if (s != NULL) + { + if (IsEmptyStr(s) == false) + { + StrToUni(replace_name, sizeof(replace_name), s); + filename = replace_name; + } + + Free(s); + } + FreeBuf(b); + } + + ret = LoadTableMain(filename); + + return ret; +} diff --git a/src/Mayaqua/Table.h b/src/Mayaqua/Table.h index 84cb8fe6..8011a752 100644 --- a/src/Mayaqua/Table.h +++ b/src/Mayaqua/Table.h @@ -1,108 +1,108 @@ -// SoftEther VPN Source Code - Developer Edition Master Branch -// Mayaqua Kernel - - -// Table.h -// Header of Table.c - -#ifndef TABLE_H -#define TABLE_H - -#define UNICODE_CACHE_FILE L".unicode_cache_%s.dat" - -#define LANGLIST_FILENAME "|languages.txt" -#define LANGLIST_FILENAME_WINE "|languages_wine.txt" - -#define LANG_CONFIG_FILENAME L"$lang.config" -#define LANG_CONFIG_TEMPLETE "|lang.config" - -// Language constant -#define SE_LANG_JAPANESE 0 // Japanese -#define SE_LANG_ENGLISH 1 // English -#define SE_LANG_CHINESE_ZH 2 // Simplified Chinese - - -// String table -struct TABLE -{ - char *name; - char *str; - wchar_t *unistr; -}; - -// Unicode cache structure -typedef struct UNICODE_CACHE -{ - char StrFileName[256]; // String file name - UINT StrFileSize; // String file size - char MachineName[256]; // Machine name - UINT OsType; // OS type - UCHAR hash[MD5_SIZE]; // Hash - UCHAR CharSet[64]; // Type of character code -} UNICODE_CACHE; - -// Macro -#define _SS(name) (GetTableStr((char *)(name))) -#define _UU(name) (GetTableUniStr((char *)(name))) -#define _II(name) (GetTableInt((char *)(name))) -#define _E(name) (GetUniErrorStr((UINT)(name))) -#define _EA(name) (GetErrorStr((UINT)(name))) -#define _GETLANG() (_II("LANG")) - -// Language list -struct LANGLIST -{ - UINT Id; // Number - char Name[32]; // Identifier - wchar_t TitleEnglish[128]; // English notation - wchar_t TitleLocal[128]; // Local notation - LIST *LcidList; // Windows LCID list - LIST *LangList; // UNIX LANG environment variable list -}; - - -// Function prototype -bool LoadTable(char *filename); -bool LoadTableW(wchar_t *filename); -bool LoadTableMain(wchar_t *filename); -bool LoadTableFromBuf(BUF *b); -void FreeTable(); -TABLE *ParseTableLine(char *line, char *prefix, UINT prefix_size, LIST *replace_list); -void UnescapeStr(char *src); -int CmpTableName(void *p1, void *p2); -TABLE *FindTable(char *name); -TOKEN_LIST *GetTableNameStartWith(char *str); -char *GetTableStr(char *name); -wchar_t *GetTableUniStr(char *name); -char *GetErrorStr(UINT err); -wchar_t *GetUniErrorStr(UINT err); -UINT GetTableInt(char *name); -void GenerateUnicodeCacheFileName(wchar_t *name, UINT size, wchar_t *strfilename, UINT strfilesize, UCHAR *filehash); -void SaveUnicodeCache(wchar_t *strfilename, UINT strfilesize, UCHAR *hash); -bool LoadUnicodeCache(wchar_t *strfilename, UINT strfilesize, UCHAR *hash); -void InitTable(); - -LIST *LoadLangList(); -void FreeLangList(LIST *o); - -LANGLIST *GetBestLangByName(LIST *o, char *name); -LANGLIST *GetBestLangByLcid(LIST *o, UINT lcid); -LANGLIST *GetBestLangByLangStr(LIST *o, char *str); -LANGLIST *GetBestLangForCurrentEnvironment(LIST *o); -LANGLIST *GetLangById(LIST *o, UINT id); - -bool LoadLangConfig(wchar_t *filename, char *str, UINT str_size); -bool LoadLangConfigCurrentDir(char *str, UINT str_size); -bool SaveLangConfig(wchar_t *filename, char *str); -bool SaveLangConfigCurrentDir(char *str); - -void GetCurrentLang(LANGLIST *e); -UINT GetCurrentLangId(); - -void GetCurrentOsLang(LANGLIST *e); -UINT GetCurrentOsLangId(); - -#endif // TABLE_H - - - +// SoftEther VPN Source Code - Developer Edition Master Branch +// Mayaqua Kernel + + +// Table.h +// Header of Table.c + +#ifndef TABLE_H +#define TABLE_H + +#define UNICODE_CACHE_FILE L".unicode_cache_%s.dat" + +#define LANGLIST_FILENAME "|languages.txt" +#define LANGLIST_FILENAME_WINE "|languages_wine.txt" + +#define LANG_CONFIG_FILENAME L"$lang.config" +#define LANG_CONFIG_TEMPLETE "|lang.config" + +// Language constant +#define SE_LANG_JAPANESE 0 // Japanese +#define SE_LANG_ENGLISH 1 // English +#define SE_LANG_CHINESE_ZH 2 // Simplified Chinese + + +// String table +struct TABLE +{ + char *name; + char *str; + wchar_t *unistr; +}; + +// Unicode cache structure +typedef struct UNICODE_CACHE +{ + char StrFileName[256]; // String file name + UINT StrFileSize; // String file size + char MachineName[256]; // Machine name + UINT OsType; // OS type + UCHAR hash[MD5_SIZE]; // Hash + UCHAR CharSet[64]; // Type of character code +} UNICODE_CACHE; + +// Macro +#define _SS(name) (GetTableStr((char *)(name))) +#define _UU(name) (GetTableUniStr((char *)(name))) +#define _II(name) (GetTableInt((char *)(name))) +#define _E(name) (GetUniErrorStr((UINT)(name))) +#define _EA(name) (GetErrorStr((UINT)(name))) +#define _GETLANG() (_II("LANG")) + +// Language list +struct LANGLIST +{ + UINT Id; // Number + char Name[32]; // Identifier + wchar_t TitleEnglish[128]; // English notation + wchar_t TitleLocal[128]; // Local notation + LIST *LcidList; // Windows LCID list + LIST *LangList; // UNIX LANG environment variable list +}; + + +// Function prototype +bool LoadTable(char *filename); +bool LoadTableW(wchar_t *filename); +bool LoadTableMain(wchar_t *filename); +bool LoadTableFromBuf(BUF *b); +void FreeTable(); +TABLE *ParseTableLine(char *line, char *prefix, UINT prefix_size, LIST *replace_list); +void UnescapeStr(char *src); +int CmpTableName(void *p1, void *p2); +TABLE *FindTable(char *name); +TOKEN_LIST *GetTableNameStartWith(char *str); +char *GetTableStr(char *name); +wchar_t *GetTableUniStr(char *name); +char *GetErrorStr(UINT err); +wchar_t *GetUniErrorStr(UINT err); +UINT GetTableInt(char *name); +void GenerateUnicodeCacheFileName(wchar_t *name, UINT size, wchar_t *strfilename, UINT strfilesize, UCHAR *filehash); +void SaveUnicodeCache(wchar_t *strfilename, UINT strfilesize, UCHAR *hash); +bool LoadUnicodeCache(wchar_t *strfilename, UINT strfilesize, UCHAR *hash); +void InitTable(); + +LIST *LoadLangList(); +void FreeLangList(LIST *o); + +LANGLIST *GetBestLangByName(LIST *o, char *name); +LANGLIST *GetBestLangByLcid(LIST *o, UINT lcid); +LANGLIST *GetBestLangByLangStr(LIST *o, char *str); +LANGLIST *GetBestLangForCurrentEnvironment(LIST *o); +LANGLIST *GetLangById(LIST *o, UINT id); + +bool LoadLangConfig(wchar_t *filename, char *str, UINT str_size); +bool LoadLangConfigCurrentDir(char *str, UINT str_size); +bool SaveLangConfig(wchar_t *filename, char *str); +bool SaveLangConfigCurrentDir(char *str); + +void GetCurrentLang(LANGLIST *e); +UINT GetCurrentLangId(); + +void GetCurrentOsLang(LANGLIST *e); +UINT GetCurrentOsLangId(); + +#endif // TABLE_H + + + diff --git a/src/Mayaqua/TcpIp.c b/src/Mayaqua/TcpIp.c index b16f508d..314cb5f3 100644 --- a/src/Mayaqua/TcpIp.c +++ b/src/Mayaqua/TcpIp.c @@ -1,4307 +1,4307 @@ -// SoftEther VPN Source Code - Developer Edition Master Branch -// Mayaqua Kernel - - -// TcpIp.c -// Utility module for TCP/IP packet processing - -#include - -#include -#include -#include -#include -#include -#include -#include -#include - -// Release the memory for the ICMP response -void IcmpFreeResult(ICMP_RESULT *r) -{ - // Validate arguments - if (r == NULL) - { - return; - } - - IcmpApiFreeResult(r); -} - -// Parse the ICMP reply packet received from the socket -ICMP_RESULT *IcmpParseResult(IP *dest_ip, USHORT src_id, USHORT src_seqno, UCHAR *recv_buffer, UINT recv_buffer_size) -{ - ICMP_RESULT *ret = NULL; - UINT i; - // Validate arguments - if (dest_ip == NULL || IsIP4(dest_ip) == false || recv_buffer == NULL || recv_buffer_size == 0) - { - return NULL; - } - - i = recv_buffer_size; - - if (true) - { - UINT ip_header_size = GetIpHeaderSize(recv_buffer, i); - if (ip_header_size >= sizeof(IPV4_HEADER) && (ip_header_size <= i)) - { - IPV4_HEADER *ipv4 = (IPV4_HEADER *)recv_buffer; - if ((IPV4_GET_VERSION(ipv4) == 4) && (ipv4->Protocol == IP_PROTO_ICMPV4)) - { - UINT ip_total_len = (UINT)Endian16(ipv4->TotalLength); - - if ((ip_total_len >= sizeof(IPV4_HEADER)) && (ip_total_len <= i) && (ip_total_len >= ip_header_size)) - { - UINT icmp_packet_size = ip_total_len - ip_header_size; - ICMP_HEADER *icmp = (ICMP_HEADER *)(recv_buffer + ip_header_size); - - if (icmp_packet_size >= sizeof(ICMP_HEADER)) - { - USHORT chksum = icmp->Checksum; - USHORT chksum2; - icmp->Checksum = 0; - - chksum2 = IpChecksum(icmp, icmp_packet_size); - - if (chksum2 == chksum) - { - if (icmp->Type == ICMP_TYPE_ECHO_RESPONSE) - { - ICMP_ECHO *echo = (ICMP_ECHO *)(recv_buffer + ip_header_size + sizeof(ICMP_HEADER)); - if (icmp_packet_size >= (sizeof(ICMP_HEADER) + sizeof(ICMP_ECHO))) - { - if (Endian16(echo->Identifier) == src_id && (src_seqno == 0 || Endian16(echo->SeqNo) == src_seqno)) - { - IP ip; - - UINTToIP(&ip, ipv4->SrcIP); - - // Received the correct Echo response - ret = ZeroMalloc(sizeof(ICMP_RESULT)); - - ret->Ok = true; - ret->Ttl = ipv4->TimeToLive; - ret->DataSize = icmp_packet_size - (sizeof(ICMP_HEADER) + sizeof(ICMP_ECHO)); - ret->Data = Clone(recv_buffer + ip_header_size + sizeof(ICMP_HEADER) + sizeof(ICMP_ECHO), - ret->DataSize); - Copy(&ret->IpAddress, &ip, sizeof(IP)); - } - } - } - else if (icmp->Type == ICMP_TYPE_ECHO_REQUEST) - { - // Ignore because an Echo request should not arrive - } - else - { - // If an error is returned, compare to the copy of - // the ICMP packet last sent - IPV4_HEADER *orig_ipv4 = (IPV4_HEADER *)(recv_buffer + ip_header_size + 4 + sizeof(ICMP_HEADER)); - if (icmp_packet_size >= (sizeof(ICMP_HEADER) + 4 + sizeof(IPV4_HEADER))) - { - UINT orig_ipv4_header_size = GetIpHeaderSize((UCHAR *)orig_ipv4, icmp_packet_size - 4 - sizeof(ICMP_HEADER)); - if (orig_ipv4_header_size >= sizeof(IPV4_HEADER)) - { - if ((IPV4_GET_VERSION(orig_ipv4) == 4) && (orig_ipv4->Protocol == IP_PROTO_ICMPV4)) - { - if (icmp_packet_size >= (sizeof(ICMP_HEADER) + 4 + orig_ipv4_header_size + sizeof(ICMP_HEADER) + sizeof(ICMP_ECHO))) - { - ICMP_HEADER *orig_icmp = (ICMP_HEADER *)(recv_buffer + ip_header_size + sizeof(ICMP_HEADER) + 4 + orig_ipv4_header_size); - ICMP_ECHO *orig_echo = (ICMP_ECHO *)(recv_buffer + ip_header_size + sizeof(ICMP_HEADER) + 4 + orig_ipv4_header_size + sizeof(ICMP_HEADER)); - - if (orig_icmp->Type == ICMP_TYPE_ECHO_REQUEST && orig_echo->Identifier == Endian16(src_id) && (src_seqno == 0 || orig_echo->SeqNo == Endian16(src_seqno))) - { - IP ip; - - UINTToIP(&ip, ipv4->SrcIP); - - ret = ZeroMalloc(sizeof(ICMP_RESULT)); - - ret->Type = icmp->Type; - ret->Code = icmp->Code; - ret->Ttl = ipv4->TimeToLive; - ret->DataSize = icmp_packet_size - (sizeof(ICMP_HEADER) + sizeof(ICMP_ECHO)); - ret->Data = Clone(recv_buffer + ip_header_size + sizeof(ICMP_HEADER) + sizeof(ICMP_ECHO), - ret->DataSize); - Copy(&ret->IpAddress, &ip, sizeof(IP)); - } - } - } - } - } - } - } - } - } - } - } - } - - return ret; -} - -// Get whether the packet is a DHCP packet associated with the specified MAC address -bool IsDhcpPacketForSpecificMac(UCHAR *data, UINT size, UCHAR *mac_address) -{ - USHORT *us; - IPV4_HEADER *ip; - UDP_HEADER *udp; - UINT ip_header_size; - bool is_send = false, is_recv = false; - // Validate arguments - if (data == NULL || mac_address == NULL || IsZero(mac_address, 6)) - { - return false; - } - - // Whether the src or the dest matches - if (size < 14) - { - return false; - } - - // Destination MAC address - if (Cmp(data, mac_address, 6) == 0) - { - is_recv = true; - } - size -= 6; - data += 6; - - // Source MAC address - if (Cmp(data, mac_address, 6) == 0) - { - is_send = true; - } - size -= 6; - data += 6; - - if (is_send == false && is_recv == false) - { - return false; - } - if (is_send && is_recv) - { - return false; - } - - // TPID - us = (USHORT *)data; - size -= 2; - data += 2; - - if (READ_USHORT(us) != MAC_PROTO_IPV4) - { - // Other than IPv4 - return false; - } - - // IP header - ip_header_size = GetIpHeaderSize(data, size); - if (ip_header_size == 0) - { - // IPv4 header analysis failure - return false; - } - - ip = (IPV4_HEADER *)data; - data += ip_header_size; - size -= ip_header_size; - - if (ip->Protocol != IP_PROTO_UDP) - { - // Not an UDP packet - return false; - } - - // UDP header - if (size < sizeof(UDP_HEADER)) - { - return false; - } - udp = (UDP_HEADER *)data; - data += sizeof(UDP_HEADER); - size -= sizeof(UDP_HEADER); - - if (is_send) - { - // Detect whether it's a DHCP Request packet - if (Endian16(udp->DstPort) == 67) - { - Debug("IsDhcpPacketForSpecificMac: DHCP Request Packet is Detected.\n"); - return true; - } - } - else if (is_recv) - { - // Detect whether it's a DHCP Response packet - if (Endian16(udp->SrcPort) == 67) - { - Debug("IsDhcpPacketForSpecificMac: DHCP Response Packet is Detected.\n"); - return true; - } - } - - return false; -} - -// Adjust the MSS of the TCP in the IP packet (L2) -bool AdjustTcpMssL2(UCHAR *src, UINT src_size, UINT mss, USHORT tag_vlan_tpid) -{ - MAC_HEADER *mac; - USHORT proto; - // Validate arguments - if (src == NULL || src_size == 0 || mss == 0) - { - return false; - } - if (tag_vlan_tpid == 0) - { - tag_vlan_tpid = MAC_PROTO_TAGVLAN; - } - - if (src_size < sizeof(MAC_HEADER)) - { - return false; - } - - mac = (MAC_HEADER *)src; - - src += sizeof(MAC_HEADER); - src_size -= sizeof(MAC_HEADER); - - proto = Endian16(mac->Protocol); - - if (proto == MAC_PROTO_IPV4 || proto == MAC_PROTO_IPV6) - { - // Ordinary IPv4 / IPv6 packet - return AdjustTcpMssL3(src, src_size, mss); - } - else if (proto == tag_vlan_tpid) - { - // IPv4 / IPv6 packets in the VLAN tag - if (src_size < 4) - { - return false; - } - - src += 2; - src_size -= 2; - - proto = READ_USHORT(src); - - if (proto == MAC_PROTO_IPV4 || proto == MAC_PROTO_IPV6) - { - if (mss >= 5) - { - mss -= 4; - - src += 2; - src_size -= 2; - - return AdjustTcpMssL3(src, src_size, mss); - } - } - } - - return false; -} - -// Get an IP header size -UINT GetIpHeaderSize(UCHAR *src, UINT src_size) -{ - UCHAR ip_ver; - TCP_HEADER *tcp = NULL; - IPV4_HEADER *ip = NULL; - IPV6_HEADER *ip6 = NULL; - // Validate arguments - if (src == NULL || src_size == 0) - { - return 0; - } - - // Get the IP version number - ip_ver = (src[0] >> 4) & 0x0f; - - if (ip_ver == 4) - { - // IPv4 - UINT ip_header_size; - if (src_size < sizeof(IPV4_HEADER)) - { - // No IPv4 header - return 0; - } - - ip = (IPV4_HEADER *)src; - - ip_header_size = IPV4_GET_HEADER_LEN(ip) * 4; - if (ip_header_size < sizeof(IPV4_HEADER)) - { - // Header size is invalid - return 0; - } - - if (src_size < ip_header_size) - { - // No IPv4 header - return 0; - } - - return ip_header_size; - } - else if (ip_ver == 6) - { - // IPv6 - IPV6_HEADER_PACKET_INFO v6; - - if (ParsePacketIPv6Header(&v6, src, src_size) == false) - { - // IPv6 analysis failure - return 0; - } - - ip6 = v6.IPv6Header; - if (ip6 == NULL) - { - return 0; - } - - if (src_size < v6.TotalHeaderSize) - { - // No header data - return 0; - } - - return v6.TotalHeaderSize; - } - else - { - // Invalid - return 0; - } -} - -// Adjust the MSS of TCP in the IP packet (L3) -bool AdjustTcpMssL3(UCHAR *src, UINT src_size, UINT mss) -{ - UCHAR ip_ver; - TCP_HEADER *tcp = NULL; - UINT tcp_size = 0; - UINT tcp_header_size; - UCHAR *options; - UINT options_size; - IPV4_HEADER *ip = NULL; - IPV6_HEADER *ip6 = NULL; - // Validate arguments - if (src == NULL || src_size == 0 || mss == 0) - { - return false; - } - - // Get the IP version number - ip_ver = (src[0] >> 4) & 0x0f; - - if (ip_ver == 4) - { - UINT ip_header_size; - UINT ip_total_length; - // IPv4 - if (src_size < sizeof(IPV4_HEADER)) - { - // No IPv4 header - return false; - } - - ip = (IPV4_HEADER *)src; - - if (ip->Protocol != IP_PROTO_TCP) - { - // Non-TCP - return false; - } - - if (IPV4_GET_OFFSET(ip) != 0) - { - // It is the second or later packet of fragmented packet - return false; - } - - if (IPV4_GET_FLAGS(ip) & 0x01) - { - // Fragmented packet - return false; - } - - ip_header_size = IPV4_GET_HEADER_LEN(ip) * 4; - if (ip_header_size < sizeof(IPV4_HEADER)) - { - // Header size is invalid - return false; - } - - if (src_size < ip_header_size) - { - // No IPv4 header - return false; - } - - ip_total_length = READ_USHORT(&ip->TotalLength); - - if (ip_total_length < ip_header_size) - { - // Invalid total length - return false; - } - - if (src_size < ip_total_length) - { - // No total length - return false; - } - - src += ip_header_size; - src_size = ip_total_length - ip_header_size; - - if (src_size < sizeof(TCP_HEADER)) - { - // No TCP header - return false; - } - - tcp = (TCP_HEADER *)src; - tcp_size = src_size; - } - else if (ip_ver == 6) - { - // IPv6 - IPV6_HEADER_PACKET_INFO v6; - - if (ParsePacketIPv6Header(&v6, src, src_size) == false) - { - // IPv6 analysis failure - return false; - } - - ip6 = v6.IPv6Header; - if (ip6 == NULL) - { - return false; - } - - if (v6.Protocol != IP_PROTO_TCP) - { - // Non-TCP - return false; - } - - if (v6.IsFragment) - { - // It is the second or later packet of fragmented packet - return false; - } - - if (v6.FragmentHeader != NULL) - { - if (IPV6_GET_FLAGS(v6.FragmentHeader) & IPV6_FRAGMENT_HEADER_FLAG_MORE_FRAGMENTS) - { - // Fragmented packet - return false; - } - } - - tcp = (TCP_HEADER *)v6.Payload; - tcp_size = v6.PayloadSize; - } - else - { - // This isn't either IPv4, IPv6 - return false; - } - - // Processing of the TCP header - if (tcp == NULL || tcp_size < sizeof(TCP_HEADER)) - { - return false; - } - - tcp_header_size = TCP_GET_HEADER_SIZE(tcp) * 4; - if (tcp_header_size < sizeof(TCP_HEADER)) - { - // TCP header size is invalid - return false; - } - - if (tcp_size < tcp_header_size) - { - // Packet length shortage - return false; - } - - if (((tcp->Flag & TCP_SYN) == false) || - ((tcp->Flag & TCP_RST) || - (tcp->Flag & TCP_PSH) || - (tcp->Flag & TCP_URG))) - { - // Not a SYN packet - return false; - } - - // Get the option field - options = ((UCHAR *)tcp) + sizeof(TCP_HEADER); - options_size = tcp_header_size - sizeof(TCP_HEADER); - - if (ip6 != NULL) - { - // Reduce MSS by 20 since an IP header for IPv6 is 20 bytes larger than IPv4 - if (mss >= 20) - { - mss -= 20; - } - } - - // MSS should be at least 64 - mss = MAX(mss, 64); - - if (options_size >= 4 && options[0] == 0x02 && options[1] == 0x04) - { - // MSS option of TCP is added - USHORT current_mss = READ_USHORT(((UCHAR *)options) + 2); - - if (current_mss <= mss) - { - // if the value of the MSS is smaller than the specified size - // from the beginning, it doesn't need to be rewritten - return false; - } - else - { - WRITE_USHORT(((UCHAR *)options) + 2, mss); - - // Clear the checksum - tcp->Checksum = 0; - - if (ip != NULL) - { - // Calculate the TCPv4 checksum - tcp->Checksum = CalcChecksumForIPv4(ip->SrcIP, ip->DstIP, IP_PROTO_TCP, tcp, tcp_size, 0); - } - else - { - // Calculate the TCPv6 checksum - tcp->Checksum = CalcChecksumForIPv6(&ip6->SrcAddress, &ip6->DestAddress, - IP_PROTO_TCP, tcp, tcp_size, 0); - } - - return true; - } - } - else - { - // MSS option of TCP is not added - return false; - } -} - - -// Parse the DHCPv4 packet -DHCPV4_DATA *ParseDHCPv4Data(PKT *pkt) -{ - DHCPV4_DATA *d; - UCHAR *data; - UINT size; - UINT magic_cookie = Endian32(DHCP_MAGIC_COOKIE); - bool ok = false; - DHCP_OPTION *o; - // Validate arguments - if (pkt == NULL) - { - return NULL; - } - if (pkt->TypeL3 != L3_IPV4 || pkt->TypeL4 != L4_UDP || pkt->TypeL7 != L7_DHCPV4) - { - return NULL; - } - - d = ZeroMalloc(sizeof(DHCPV4_DATA)); - d->Size = (UINT)(pkt->PacketSize - (((UCHAR *)pkt->L7.PointerL7) - ((UCHAR *)pkt->PacketData))); - d->Data = Clone(pkt->L7.PointerL7, d->Size); - - if (d->Size < sizeof(DHCPV4_HEADER)) - { - goto LABEL_ERROR; - } - - // Header - d->Header = (DHCPV4_HEADER *)d->Data; - - data = d->Data; - size = d->Size; - - // Search for the Magic Cookie - ok = false; - while (size >= 5) - { - if (Cmp(data, &magic_cookie, 4) == 0) - { - // Found - data += 4; - size -= 4; - ok = true; - break; - } - - data++; - size--; - } - - if (ok == false) - { - // Magic Cookie not found - goto LABEL_ERROR; - } - - // Parse the DHCP Options - d->OptionData = data; - d->OptionSize = size; - - d->OptionList = ParseDhcpOptions(data, size); - if (d->OptionList == NULL) - { - // Parsing failure - goto LABEL_ERROR; - } - - UINTToIP(&d->SrcIP, pkt->L3.IPv4Header->SrcIP); - UINTToIP(&d->DestIP, pkt->L3.IPv4Header->DstIP); - - d->SrcPort = Endian16(pkt->L4.UDPHeader->SrcPort); - d->DestPort = Endian16(pkt->L4.UDPHeader->DstPort); - - o = GetDhcpOption(d->OptionList, DHCP_ID_MESSAGE_TYPE); - if (o == NULL || o->Size != 1) - { - goto LABEL_ERROR; - } - - d->OpCode = *((UCHAR *)o->Data); - - d->ParsedOptionList = ParseDhcpOptionList(d->OptionData, d->OptionSize); - - if (d->ParsedOptionList == NULL) - { - goto LABEL_ERROR; - } - - if (d->ParsedOptionList->ServerAddress == 0) - { - d->ParsedOptionList->ServerAddress = d->Header->ServerIP; - } - - d->ParsedOptionList->ClientAddress = d->Header->YourIP; - - return d; - -LABEL_ERROR: - FreeDHCPv4Data(d); - return NULL; -} - -// Release the DHCPv4 packet -void FreeDHCPv4Data(DHCPV4_DATA *d) -{ - // Validate arguments - if (d == NULL) - { - return; - } - - FreeDhcpOptions(d->OptionList); - Free(d->Data); - - Free(d->ParsedOptionList); - - Free(d); -} - -// Embed a VLAN tag to the packet -void VLanInsertTag(void **packet_data, UINT *packet_size, UINT vlan_id, UINT vlan_tpid) -{ - UINT dest_size; - UCHAR *dest_data; - UINT src_size; - UCHAR *src_data; - USHORT vlan_ushort = Endian16(((USHORT)vlan_id) & 0xFFF); - USHORT vlan_tpid_ushort; - // Validate arguments - if (packet_data == NULL || *packet_data == NULL || packet_size == NULL || - *packet_size < 14 || vlan_id == 0) - { - return; - } - if (vlan_tpid == 0) - { - vlan_tpid = MAC_PROTO_TAGVLAN; - } - - vlan_tpid_ushort = Endian16((USHORT)vlan_tpid); - - src_size = *packet_size; - src_data = (UCHAR *)(*packet_data); - - dest_size = src_size + 4; - dest_data = Malloc(dest_size); - - Copy(&dest_data[12], &vlan_tpid_ushort, sizeof(USHORT)); - Copy(&dest_data[14], &vlan_ushort, sizeof(USHORT)); - - Copy(&dest_data[0], &src_data[0], 12); - Copy(&dest_data[16], &src_data[12], src_size - 12); - - *packet_size = dest_size; - *packet_data = dest_data; - - Free(src_data); -} - -// Remove the VLAN tag from the packet -bool VLanRemoveTag(void **packet_data, UINT *packet_size, UINT vlan_id, UINT vlan_tpid) -{ - UCHAR *src_data; - UINT src_size; - USHORT vlan_tpid_ushort; - UCHAR *vlan_tpid_uchar; - // Validate arguments - if (packet_data == NULL || *packet_data == NULL || packet_size == NULL || - *packet_size < 14) - { - return false; - } - - if (vlan_tpid == 0) - { - vlan_tpid = MAC_PROTO_TAGVLAN; - } - - vlan_tpid_ushort = Endian16((USHORT)vlan_tpid); - vlan_tpid_uchar = (UCHAR *)(&vlan_tpid_ushort); - - src_data = (UCHAR *)(*packet_data); - src_size = *packet_size; - - if (src_data[12] == vlan_tpid_uchar[0] && src_data[13] == vlan_tpid_uchar[1]) - { - if (src_size >= 18) - { - USHORT vlan_ushort; - - vlan_ushort = READ_USHORT(&src_data[14]); - vlan_ushort = vlan_ushort & 0xFFF; - - if (vlan_id == 0 || (vlan_ushort == vlan_id)) - { - UINT dest_size = src_size - 4; - UINT i; - - for (i = 12; i < dest_size; i++) - { - src_data[i] = src_data[i + 4]; - } - - *packet_size = dest_size; - - return true; - } - } - } - - return false; -} - -// Sending of an ICMPv6 packet -BUF *BuildICMPv6(IPV6_ADDR *src_ip, IPV6_ADDR *dest_ip, UCHAR hop_limit, UCHAR type, UCHAR code, void *data, UINT size, UINT id) -{ - ICMP_HEADER *icmp; - void *data_buf; - BUF *ret; - // Validate arguments - if (src_ip == NULL || dest_ip == NULL || data == NULL) - { - return NULL; - } - - // Assemble the header - icmp = ZeroMalloc(sizeof(ICMP_HEADER) + size); - data_buf = ((UCHAR *)icmp) + sizeof(ICMP_HEADER); - Copy(data_buf, data, size); - - icmp->Type = type; - icmp->Code = code; - icmp->Checksum = CalcChecksumForIPv6(src_ip, dest_ip, IP_PROTO_ICMPV6, icmp, - sizeof(ICMP_HEADER) + size, 0); - - ret = BuildIPv6(dest_ip, src_ip, id, IP_PROTO_ICMPV6, hop_limit, icmp, - sizeof(ICMP_HEADER) + size); - - Free(icmp); - - return ret; -} - -// Build an ICMPv6 Neighbor Solicitation packet -BUF *BuildICMPv6NeighborSoliciation(IPV6_ADDR *src_ip, IPV6_ADDR *target_ip, UCHAR *my_mac_address, UINT id) -{ - ICMPV6_OPTION_LIST opt; - ICMPV6_OPTION_LINK_LAYER link; - ICMPV6_NEIGHBOR_SOLICIATION_HEADER header; - BUF *b; - BUF *b2; - BUF *ret; - // Validate arguments - if (src_ip == NULL || target_ip == NULL || my_mac_address == NULL) - { - return NULL; - } - - Zero(&link, sizeof(link)); - Copy(link.Address, my_mac_address, 6); - - Zero(&opt, sizeof(opt)); - opt.SourceLinkLayer = &link; - - b = BuildICMPv6Options(&opt); - - Zero(&header, sizeof(header)); - Copy(&header.TargetAddress, target_ip, sizeof(IPV6_ADDR)); - - b2 = NewBuf(); - - WriteBuf(b2, &header, sizeof(header)); - WriteBufBuf(b2, b); - - ret = BuildICMPv6(src_ip, target_ip, 255, - ICMPV6_TYPE_NEIGHBOR_SOLICIATION, 0, b2->Buf, b2->Size, id); - - FreeBuf(b); - FreeBuf(b2); - - return ret; -} - -BUF *BuildICMPv6RouterSoliciation(IPV6_ADDR *src_ip, IPV6_ADDR *target_ip, UCHAR *my_mac_address, UINT id) -{ - ICMPV6_OPTION_LIST opt; - ICMPV6_OPTION_LINK_LAYER link; - ICMPV6_ROUTER_SOLICIATION_HEADER header; - BUF *b; - BUF *b2; - BUF *ret; - - if (src_ip == NULL || target_ip == NULL || my_mac_address == NULL) - { - return NULL; - } - - Zero(&link, sizeof(link)); - Copy(link.Address, my_mac_address, 6); - - Zero(&opt, sizeof(opt)); - opt.SourceLinkLayer = &link; - - b = BuildICMPv6Options(&opt); - - Zero(&header, sizeof(header)); - - b2 = NewBuf(); - - WriteBuf(b2, &header, sizeof(header)); - WriteBufBuf(b2, b); - - ret = BuildICMPv6(src_ip, target_ip, 255, - ICMPV6_TYPE_ROUTER_SOLICIATION, 0, b2->Buf, b2->Size, id); - - FreeBuf(b); - FreeBuf(b2); - - return ret; -} - -// Get the next header number from the queue -UCHAR IPv6GetNextHeaderFromQueue(QUEUE *q) -{ - UINT *p; - UCHAR v = 0; - // Validate arguments - if (q == NULL) - { - return IPV6_HEADER_NONE; - } - - p = (UINT *)GetNext(q); - if (p != NULL) - { - v = (UCHAR)(*p); - Free(p); - } - - return v; -} - -// Add an IPv6 extension header option (variable length) -void BuildAndAddIPv6PacketOptionHeader(BUF *b, IPV6_OPTION_HEADER *opt, UCHAR next_header, UINT size) -{ - IPV6_OPTION_HEADER *h; - UINT total_size; - // Validate arguments - if (b == NULL || opt == NULL) - { - return; - } - - total_size = size; - if ((total_size % 8) != 0) - { - total_size = ((total_size / 8) + 1) * 8; - } - - h = ZeroMalloc(total_size); - Copy(h, opt, size); - h->Size = (total_size / 8) - 1; - h->NextHeader = next_header; - - WriteBuf(b, h, total_size); - - Free(h); -} - -// Build an IPv6 packet -BUF *BuildIPv6(IPV6_ADDR *dest_ip, IPV6_ADDR *src_ip, UINT id, UCHAR protocol, UCHAR hop_limit, void *data, - UINT size) -{ - IPV6_HEADER_PACKET_INFO info; - IPV6_HEADER ip_header; - BUF *buf; - UINT size_for_headers; - // Validate arguments - if (dest_ip == NULL || src_ip == NULL || data == NULL) - { - return NULL; - } - if (hop_limit == 0) - { - hop_limit = 255; - } - - // IPv6 header - Zero(&ip_header, sizeof(ip_header)); - IPV6_SET_VERSION(&ip_header, 6); - ip_header.HopLimit = hop_limit; - Copy(&ip_header.SrcAddress, src_ip, sizeof(IPV6_ADDR)); - Copy(&ip_header.DestAddress, dest_ip, sizeof(IPV6_ADDR)); - - // Arrangement of the packet header information - Zero(&info, sizeof(info)); - info.IPv6Header = &ip_header; - info.Protocol = protocol; - info.Payload = data; - info.PayloadSize = size; - - buf = BuildIPv6PacketHeader(&info, &size_for_headers); - if (buf == NULL) - { - return NULL; - } - - return buf; -} - -// Build the IPv6 packet header section -BUF *BuildIPv6PacketHeader(IPV6_HEADER_PACKET_INFO *info, UINT *bytes_before_payload) -{ - BUF *b; - QUEUE *q; - UINT bbp = 0; - // Validate arguments - if (info == NULL) - { - return NULL; - } - - b = NewBuf(); - q = NewQueueFast(); - - // Create the list of options headers - if (info->HopHeader != NULL) - { - InsertQueueInt(q, IPV6_HEADER_HOP); - } - if (info->EndPointHeader != NULL) - { - InsertQueueInt(q, IPV6_HEADER_ENDPOINT); - } - if (info->RoutingHeader != NULL) - { - InsertQueueInt(q, IPV6_HEADER_ROUTING); - } - if (info->FragmentHeader != NULL) - { - InsertQueueInt(q, IPV6_HEADER_FRAGMENT); - } - InsertQueueInt(q, info->Protocol); - - // IPv6 header - info->IPv6Header->NextHeader = IPv6GetNextHeaderFromQueue(q); - WriteBuf(b, info->IPv6Header, sizeof(IPV6_HEADER)); - - // Hop-by-hop option header - if (info->HopHeader != NULL) - { - BuildAndAddIPv6PacketOptionHeader(b, info->HopHeader, - IPv6GetNextHeaderFromQueue(q), info->HopHeaderSize); - } - - // End point option header - if (info->EndPointHeader != NULL) - { - BuildAndAddIPv6PacketOptionHeader(b, info->EndPointHeader, - IPv6GetNextHeaderFromQueue(q), info->EndPointHeaderSize); - } - - // Routing header - if (info->RoutingHeader != NULL) - { - BuildAndAddIPv6PacketOptionHeader(b, info->RoutingHeader, - IPv6GetNextHeaderFromQueue(q), info->RoutingHeaderSize); - } - - // Fragment header - if (info->FragmentHeader != NULL) - { - info->FragmentHeader->NextHeader = IPv6GetNextHeaderFromQueue(q); - WriteBuf(b, info->FragmentHeader, sizeof(IPV6_FRAGMENT_HEADER)); - } - - bbp = b->Size; - if (info->FragmentHeader == NULL) - { - bbp += sizeof(IPV6_FRAGMENT_HEADER); - } - - // Payload - if (info->Protocol != IPV6_HEADER_NONE) - { - WriteBuf(b, info->Payload, info->PayloadSize); - } - - ReleaseQueue(q); - - SeekBuf(b, 0, 0); - - // Payload length - ((IPV6_HEADER *)b->Buf)->PayloadLength = Endian16(b->Size - (USHORT)sizeof(IPV6_HEADER)); - - if (bytes_before_payload != NULL) - { - // Calculate the length just before the payload - // (by assuming fragment header is always included) - *bytes_before_payload = bbp; - } - - return b; -} - -// Build the option values of an ICMPv6 packet -void BuildICMPv6OptionValue(BUF *b, UCHAR type, void *header_pointer, UINT total_size) -{ - UINT packet_size; - UCHAR *packet; - ICMPV6_OPTION *opt; - // Validate arguments - if (b == NULL || header_pointer == NULL) - { - return; - } - - packet_size = ((total_size + 7) / 8) * 8; - packet = ZeroMalloc(packet_size); - - Copy(packet, header_pointer, total_size); - opt = (ICMPV6_OPTION *)packet; - opt->Length = (UCHAR)(packet_size / 8); - opt->Type = type; - - WriteBuf(b, packet, packet_size); - - Free(packet); -} - -// Build the options of the ICMPv6 packet -BUF *BuildICMPv6Options(ICMPV6_OPTION_LIST *o) -{ - BUF *b; - UINT i; - // Validate arguments - if (o == NULL) - { - return NULL; - } - - b = NewBuf(); - - if (o->SourceLinkLayer != NULL) - { - BuildICMPv6OptionValue(b, ICMPV6_OPTION_TYPE_SOURCE_LINK_LAYER, o->SourceLinkLayer, sizeof(ICMPV6_OPTION_LINK_LAYER)); - } - if (o->TargetLinkLayer != NULL) - { - BuildICMPv6OptionValue(b, ICMPV6_OPTION_TYPE_TARGET_LINK_LAYER, o->TargetLinkLayer, sizeof(ICMPV6_OPTION_LINK_LAYER)); - } - for (i = 0; i < ICMPV6_OPTION_PREFIXES_MAX_COUNT; i++) - { - if (o->Prefix[i] != NULL) - { - BuildICMPv6OptionValue(b, ICMPV6_OPTION_TYPE_PREFIX, o->Prefix[i], sizeof(ICMPV6_OPTION_PREFIX)); - } - else - { - break; - } - } - if (o->Mtu != NULL) - { - BuildICMPv6OptionValue(b, ICMPV6_OPTION_TYPE_MTU, o->Mtu, sizeof(ICMPV6_OPTION_MTU)); - } - - SeekBuf(b, 0, 0); - - return b; -} - -// Checksum calculation (IPv4) -USHORT CalcChecksumForIPv4(UINT src_ip, UINT dst_ip, UCHAR protocol, void *data, UINT size, UINT real_size) -{ - UCHAR *tmp; - UINT tmp_size; - IPV4_PSEUDO_HEADER *ph; - USHORT ret; - bool use_free = false; - UCHAR tmp_buffer[1600]; - // Validate arguments - if (data == NULL && size != 0) - { - return 0; - } - - if (real_size == 0) - { - real_size = size; - } - - if (real_size == INFINITE) - { - real_size = 0; - } - - tmp_size = size + sizeof(IPV4_PSEUDO_HEADER); - - if (tmp_size > sizeof(tmp_buffer)) - { - tmp = Malloc(tmp_size); - - use_free = true; - } - else - { - tmp = tmp_buffer; - } - - ph = (IPV4_PSEUDO_HEADER *)tmp; - ph->SrcIP = src_ip; - ph->DstIP = dst_ip; - ph->PacketLength = Endian16(real_size); - ph->Protocol = protocol; - ph->Reserved = 0; - - if (size >= 1) - { - Copy(((UCHAR *)tmp) + sizeof(IPV4_PSEUDO_HEADER), data, size); - } - - ret = IpChecksum(tmp, tmp_size); - - if (use_free) - { - Free(tmp); - } - - return ret; -} - -// Checksum calculation (IPv6) -USHORT CalcChecksumForIPv6(IPV6_ADDR *src_ip, IPV6_ADDR *dest_ip, UCHAR protocol, void *data, UINT size, UINT real_size) -{ - UCHAR *tmp; - UINT tmp_size; - IPV6_PSEUDO_HEADER *ph; - USHORT ret; - bool use_free = false; - UCHAR tmp_buffer[256]; - // Validate arguments - if (data == NULL && size != 0) - { - return 0; - } - - if (real_size == 0) - { - real_size = size; - } - - if (real_size == INFINITE) - { - real_size = 0; - } - - tmp_size = size + sizeof(IPV6_PSEUDO_HEADER); - - if (tmp_size > sizeof(tmp_buffer)) - { - tmp = Malloc(tmp_size); - - use_free = true; - } - else - { - tmp = tmp_buffer; - } - - ph = (IPV6_PSEUDO_HEADER *)tmp; - Zero(ph, sizeof(IPV6_PSEUDO_HEADER)); - Copy(&ph->SrcAddress, src_ip, sizeof(IPV6_ADDR)); - Copy(&ph->DestAddress, dest_ip, sizeof(IPV6_ADDR)); - ph->UpperLayerPacketSize = Endian32(real_size); - ph->NextHeader = protocol; - - Copy(((UCHAR *)tmp) + sizeof(IPV6_PSEUDO_HEADER), data, size); - - ret = IpChecksum(tmp, tmp_size); - - if (use_free) - { - Free(tmp); - } - - return ret; -} - -// Release the cloned packet -void FreeClonePacket(PKT *p) -{ - // Validate arguments - if (p == NULL) - { - return; - } - - Free(p->IPv6HeaderPacketInfo.IPv6Header); - Free(p->IPv6HeaderPacketInfo.HopHeader); - Free(p->IPv6HeaderPacketInfo.EndPointHeader); - Free(p->IPv6HeaderPacketInfo.RoutingHeader); - Free(p->IPv6HeaderPacketInfo.FragmentHeader); - Free(p->IPv6HeaderPacketInfo.Payload); - Free(p->ICMPv6HeaderPacketInfo.Data); - Free(p->ICMPv6HeaderPacketInfo.EchoData); - Free(p->ICMPv6HeaderPacketInfo.Headers.HeaderPointer); - FreeCloneICMPv6Options(&p->ICMPv6HeaderPacketInfo.OptionList); - Free(p->L3.PointerL3); - Free(p->L4.PointerL4); - Free(p->L7.PointerL7); - Free(p->PacketData); - Free(p->MacHeader); - Free(p->HttpLog); - Free(p); -} - -// Copy the packet header -PKT *ClonePacket(PKT *p, bool copy_data) -{ - PKT *ret; - // Validate arguments - if (p == NULL) - { - return NULL; - } - - ret = ZeroMallocFast(sizeof(PKT)); - ret->PacketSize = p->PacketSize; - - // Copy of the MAC header - ret->MacHeader = MallocFast(sizeof(MAC_HEADER)); - Copy(ret->MacHeader, p->MacHeader, sizeof(MAC_HEADER)); - - // Copy of the MAC flag - ret->BroadcastPacket = p->BroadcastPacket; - ret->InvalidSourcePacket = p->InvalidSourcePacket; - - // Copy of the IPv6 related structure - Copy(&ret->IPv6HeaderPacketInfo, &p->IPv6HeaderPacketInfo, sizeof(IPV6_HEADER_PACKET_INFO)); - Copy(&ret->ICMPv6HeaderPacketInfo, &p->ICMPv6HeaderPacketInfo, sizeof(ICMPV6_HEADER_INFO)); - - // Layer 3 - ret->TypeL3 = p->TypeL3; - switch (ret->TypeL3) - { - case L3_ARPV4: - // ARP packet - ret->L3.ARPv4Header = MallocFast(sizeof(ARPV4_HEADER)); - Copy(ret->L3.ARPv4Header, p->L3.ARPv4Header, sizeof(ARPV4_HEADER)); - break; - - case L3_IPV4: - // IPv4 packet - ret->L3.IPv4Header = MallocFast(sizeof(IPV4_HEADER)); - Copy(ret->L3.IPv4Header, p->L3.IPv4Header, sizeof(IPV4_HEADER)); - break; - - case L3_IPV6: - // IPv6 packet - ret->L3.IPv6Header = MallocFast(sizeof(IPV6_HEADER)); - Copy(ret->L3.IPv6Header, p->L3.IPv6Header, sizeof(IPV6_HEADER)); - - ret->IPv6HeaderPacketInfo.IPv6Header = Clone(p->IPv6HeaderPacketInfo.IPv6Header, - sizeof(IPV6_HEADER)); - - ret->IPv6HeaderPacketInfo.HopHeader = Clone(p->IPv6HeaderPacketInfo.HopHeader, - sizeof(IPV6_OPTION_HEADER)); - - ret->IPv6HeaderPacketInfo.EndPointHeader = Clone(p->IPv6HeaderPacketInfo.EndPointHeader, - sizeof(IPV6_OPTION_HEADER)); - - ret->IPv6HeaderPacketInfo.RoutingHeader = Clone(p->IPv6HeaderPacketInfo.RoutingHeader, - sizeof(IPV6_OPTION_HEADER)); - - ret->IPv6HeaderPacketInfo.FragmentHeader = Clone(p->IPv6HeaderPacketInfo.FragmentHeader, - sizeof(IPV6_FRAGMENT_HEADER)); - - ret->IPv6HeaderPacketInfo.Payload = Clone(p->IPv6HeaderPacketInfo.Payload, - p->IPv6HeaderPacketInfo.PayloadSize); - break; - } - - // Layer 4 - ret->TypeL4 = p->TypeL4; - switch (ret->TypeL4) - { - case L4_ICMPV4: - // ICMPv4 packet - ret->L4.ICMPHeader = MallocFast(sizeof(ICMP_HEADER)); - Copy(ret->L4.ICMPHeader, p->L4.ICMPHeader, sizeof(ICMP_HEADER)); - break; - - case L4_ICMPV6: - // ICMPv6 packet - ret->L4.ICMPHeader = MallocFast(sizeof(ICMP_HEADER)); - Copy(ret->L4.ICMPHeader, p->L4.ICMPHeader, sizeof(ICMP_HEADER)); - - ret->ICMPv6HeaderPacketInfo.Data = Clone(p->ICMPv6HeaderPacketInfo.Data, - p->ICMPv6HeaderPacketInfo.DataSize); - - ret->ICMPv6HeaderPacketInfo.EchoData = Clone(p->ICMPv6HeaderPacketInfo.EchoData, - p->ICMPv6HeaderPacketInfo.EchoDataSize); - - switch (ret->ICMPv6HeaderPacketInfo.Type) - { - case ICMPV6_TYPE_ECHO_REQUEST: - case ICMPV6_TYPE_ECHO_RESPONSE: - break; - - case ICMPV6_TYPE_ROUTER_SOLICIATION: - ret->ICMPv6HeaderPacketInfo.Headers.RouterSoliciationHeader = - Clone(p->ICMPv6HeaderPacketInfo.Headers.RouterSoliciationHeader, - sizeof(ICMPV6_ROUTER_SOLICIATION_HEADER)); - break; - - case ICMPV6_TYPE_ROUTER_ADVERTISEMENT: - ret->ICMPv6HeaderPacketInfo.Headers.RouterAdvertisementHeader = - Clone(p->ICMPv6HeaderPacketInfo.Headers.RouterAdvertisementHeader, - sizeof(ICMPV6_ROUTER_ADVERTISEMENT_HEADER)); - break; - - case ICMPV6_TYPE_NEIGHBOR_SOLICIATION: - ret->ICMPv6HeaderPacketInfo.Headers.NeighborSoliciationHeader = - Clone(p->ICMPv6HeaderPacketInfo.Headers.NeighborSoliciationHeader, - sizeof(ICMPV6_NEIGHBOR_SOLICIATION_HEADER)); - break; - - case ICMPV6_TYPE_NEIGHBOR_ADVERTISEMENT: - ret->ICMPv6HeaderPacketInfo.Headers.NeighborAdvertisementHeader = - Clone(p->ICMPv6HeaderPacketInfo.Headers.NeighborAdvertisementHeader, - sizeof(ICMPV6_NEIGHBOR_ADVERTISEMENT_HEADER)); - break; - } - - CloneICMPv6Options(&ret->ICMPv6HeaderPacketInfo.OptionList, - &p->ICMPv6HeaderPacketInfo.OptionList); - break; - - case L4_TCP: - // TCP packet - ret->L4.TCPHeader = MallocFast(sizeof(TCP_HEADER)); - Copy(ret->L4.TCPHeader, p->L4.TCPHeader, sizeof(TCP_HEADER)); - break; - - case L4_UDP: - // UDP packet - ret->L4.UDPHeader = MallocFast(sizeof(UDP_HEADER)); - Copy(ret->L4.UDPHeader, p->L4.UDPHeader, sizeof(UDP_HEADER)); - break; - } - - // Layer 7 - ret->TypeL7 = p->TypeL7; - switch (ret->TypeL7) - { - case L7_DHCPV4: - // DHCP packet - ret->L7.DHCPv4Header = MallocFast(sizeof(DHCPV4_HEADER)); - Copy(ret->L7.DHCPv4Header, p->L7.DHCPv4Header, sizeof(DHCPV4_HEADER)); - break; - - case L7_IKECONN: - // IKE packet - ret->L7.IkeHeader = MallocFast(sizeof(IKE_HEADER)); - Copy(ret->L7.IkeHeader, p->L7.IkeHeader, sizeof(IKE_HEADER)); - break; - - case L7_DNS: - StrCpy(ret->DnsQueryHost, sizeof(ret->DnsQueryHost), p->DnsQueryHost); - break; - } - - // Address data - ret->MacAddressSrc = ret->MacHeader->SrcAddress; - ret->MacAddressDest = ret->MacHeader->DestAddress; - - if (copy_data) - { - // Copy also the packet body - ret->PacketData = MallocFast(p->PacketSize); - Copy(ret->PacketData, p->PacketData, p->PacketSize); - } - - if (p->HttpLog != NULL) - { - ret->HttpLog = Clone(p->HttpLog, sizeof(HTTPLOG)); - } - - return ret; -} - -// Parse the packet but without data layer except for ICMP -PKT *ParsePacketUpToICMPv6(UCHAR *buf, UINT size) -{ - return ParsePacketEx5(buf, size, false, 0, true, true, false, true); -} - -// Parse the contents of the packet -PKT *ParsePacket(UCHAR *buf, UINT size) -{ - return ParsePacketEx(buf, size, false); -} -PKT *ParsePacketEx(UCHAR *buf, UINT size, bool no_l3) -{ - return ParsePacketEx2(buf, size, no_l3, 0); -} -PKT *ParsePacketEx2(UCHAR *buf, UINT size, bool no_l3, UINT vlan_type_id) -{ - return ParsePacketEx3(buf, size, no_l3, vlan_type_id, true); -} -PKT *ParsePacketEx3(UCHAR *buf, UINT size, bool no_l3, UINT vlan_type_id, bool bridge_id_as_mac_address) -{ - return ParsePacketEx4(buf, size, no_l3, vlan_type_id, bridge_id_as_mac_address, false, false); -} -PKT *ParsePacketEx4(UCHAR *buf, UINT size, bool no_l3, UINT vlan_type_id, bool bridge_id_as_mac_address, bool no_http, bool correct_checksum) -{ - return ParsePacketEx5(buf, size, no_l3, vlan_type_id, bridge_id_as_mac_address, no_http, correct_checksum, false); -} -PKT *ParsePacketEx5(UCHAR *buf, UINT size, bool no_l3, UINT vlan_type_id, bool bridge_id_as_mac_address, bool no_http, bool correct_checksum, bool no_l3_l4_except_icmpv6) -{ - PKT *p; - USHORT vlan_type_id_16; - // Validate arguments - if (buf == NULL || size == 0) - { - return NULL; - } - - if (vlan_type_id == 0) - { - vlan_type_id = MAC_PROTO_TAGVLAN; - } - - vlan_type_id_16 = Endian16((USHORT)vlan_type_id); - - p = ZeroMallocFast(sizeof(PKT)); - - p->VlanTypeID = vlan_type_id; - - // If there is garbage after the payload in IPv4 and IPv6 packets, eliminate it - if (size >= 24) - { - if (buf[12] == 0x08 && buf[13] == 0x00) - { - USHORT ip_total_size2 = READ_USHORT(&buf[16]); - UINT mac_packet_size; - - if (ip_total_size2 >= 1) - { - mac_packet_size = (UINT)ip_total_size2 + 14; - - if (size > mac_packet_size) - { - size = mac_packet_size; - } - } - } - else if (buf[12] == 0x86 && buf[13] == 0xdd) - { - USHORT ip_payload_size_2 = READ_USHORT(&buf[18]); - UINT mac_packet_size; - - if (ip_payload_size_2 >= 1) - { - mac_packet_size = (UINT)ip_payload_size_2 + 14 + 40; - - if (size > mac_packet_size) - { - size = mac_packet_size; - } - } - } - else if (buf[12] == ((UCHAR *)&vlan_type_id_16)[0] && buf[13] == ((UCHAR *)&vlan_type_id_16)[1]) - { - if (buf[16] == 0x08 && buf[17] == 0x00) - { - USHORT ip_total_size2 = READ_USHORT(&buf[20]); - UINT mac_packet_size; - - if (ip_total_size2 >= 1) - { - mac_packet_size = (UINT)ip_total_size2 + 14 + 4; - - if (size > mac_packet_size) - { - size = mac_packet_size; - } - } - } - else if (buf[16] == 0x86 && buf[17] == 0xdd) - { - USHORT ip_payload_size_2 = READ_USHORT(&buf[22]); - UINT mac_packet_size; - - if (ip_payload_size_2 >= 1) - { - mac_packet_size = (UINT)ip_payload_size_2 + 14 + 40 + 4; - - if (size > mac_packet_size) - { - size = mac_packet_size; - } - } - } - } - } - - // Do parse - if (ParsePacketL2Ex(p, buf, size, no_l3, no_l3_l4_except_icmpv6) == false) - { - // Parsing failure - FreePacket(p); - return NULL; - } - - p->PacketData = buf; - p->PacketSize = size; - - p->MacAddressSrc = p->MacHeader->SrcAddress; - p->MacAddressDest = p->MacHeader->DestAddress; - - if (bridge_id_as_mac_address) - { - if (p->TypeL3 == L3_BPDU) - { - if (p->L3.BpduHeader != NULL) - { - p->MacAddressSrc = p->L3.BpduHeader->BridgeMacAddress; - } - } - } - - if (no_http == false) - { - USHORT port_raw = Endian16(80); - USHORT port_raw2 = Endian16(8080); - USHORT port_raw3 = Endian16(443); - USHORT port_raw4 = Endian16(3128); - - // Analyze if the packet is a part of HTTP - if ((p->TypeL3 == L3_IPV4 || p->TypeL3 == L3_IPV6) && p->TypeL4 == L4_TCP) - { - TCP_HEADER *tcp = p->L4.TCPHeader; - if (tcp != NULL && (tcp->DstPort == port_raw || tcp->DstPort == port_raw2 || tcp->DstPort == port_raw4) && - (!((tcp->Flag & TCP_SYN) || (tcp->Flag & TCP_RST) || (tcp->Flag & TCP_FIN)))) - { - if (p->PayloadSize >= 1) - { - p->HttpLog = ParseHttpAccessLog(p); - } - } - if (tcp != NULL && tcp->DstPort == port_raw3 && - (!((tcp->Flag & TCP_SYN) || (tcp->Flag & TCP_RST) || (tcp->Flag & TCP_FIN)))) - { - if (p->PayloadSize >= 1) - { - p->HttpLog = ParseHttpsAccessLog(p); - } - } - } - } - - if (p->TypeL3 == L3_IPV4 && p->TypeL4 == L4_UDP && p->TypeL7 == L7_DHCPV4) - { - // Get the DHCP opcode - DHCPV4_DATA *d = ParseDHCPv4Data(p); - - if (d != NULL) - { - p->DhcpOpCode = d->OpCode; - - FreeDHCPv4Data(d); - } - } - - if (correct_checksum) - { - // Correct the checksum of the UDP, IP and TCP - CorrectChecksum(p); - } - - // Parsing success - return p; -} - -// Correct the checksum (store the correct value in the header by recalculating the checksum which is by off-load processing) -void CorrectChecksum(PKT *p) -{ - // Validate arguments - if (p == NULL) - { - return; - } - - if (p->TypeL3 == L3_IPV4) - { - IPV4_HEADER *v4 = p->L3.IPv4Header; - - if (v4 != NULL) - { - if (v4->Checksum == 0x0000) - { - v4->Checksum = IpChecksum(v4, IPV4_GET_HEADER_LEN(v4) * 4); - } - - if (p->TypeL4 == L4_TCP) - { - // Recalculate the TCP checksum - if (IPV4_GET_OFFSET(v4) == 0 && (IPV4_GET_FLAGS(v4) & 0x01) == 0) - { - // TCP checksuming doesn't target fragmented IP packets - TCP_HEADER *tcp = p->L4.TCPHeader; - - if (tcp != NULL) - { - USHORT tcp_offloading_checksum1 = CalcChecksumForIPv4(v4->SrcIP, v4->DstIP, IP_PROTO_TCP, NULL, 0, p->IPv4PayloadSize); - USHORT tcp_offloading_checksum2 = ~tcp_offloading_checksum1; - - if (tcp->Checksum == 0 || tcp->Checksum == tcp_offloading_checksum1 || tcp->Checksum == tcp_offloading_checksum2) - { - tcp->Checksum = 0; - tcp->Checksum = CalcChecksumForIPv4(v4->SrcIP, v4->DstIP, IP_PROTO_TCP, tcp, p->IPv4PayloadSize, 0); - } - } - } - } - - if (p->TypeL4 == L4_UDP) - { - // Recalculation of the UDP checksum - if (IPV4_GET_OFFSET(v4) == 0 || (IPV4_GET_FLAGS(v4) & 0x01) == 0) - { - // If it is not divided, or it is divided but it is the first fragment of the UDP packet - UDP_HEADER *udp = p->L4.UDPHeader; - - if (udp != NULL && udp->Checksum != 0) - { - USHORT udp_len = Endian16(udp->PacketLength); - USHORT udp_offloading_checksum1 = CalcChecksumForIPv4(v4->SrcIP, v4->DstIP, IP_PROTO_UDP, NULL, 0, udp_len); - USHORT udp_offloading_checksum2 = ~udp_offloading_checksum1; - - if (udp->Checksum == udp_offloading_checksum1 || udp->Checksum == udp_offloading_checksum2) - { - udp->Checksum = 0; - - if ((IPV4_GET_FLAGS(v4) & 0x01) == 0 && (p->IPv4PayloadSize >= udp_len)) - { - // Calculate the checksum correctly based on the data in case of a non-fragmented packet - udp->Checksum = CalcChecksumForIPv4(v4->SrcIP, v4->DstIP, IP_PROTO_UDP, udp, udp_len, 0); - } - else - { - // In case of the first fragment of the packet, set the checksum to 0 - // because there isn't entire data of the packet - udp->Checksum = 0; - } - } - } - } - } - } - } - else if (p->TypeL3 == L3_IPV6) - { - IPV6_HEADER *v6 = p->L3.IPv6Header; - IPV6_HEADER_PACKET_INFO *v6info = &p->IPv6HeaderPacketInfo; - - if (v6 != NULL) - { - if (p->TypeL4 == L4_TCP) - { - // Recalculate the TCP checksum - if (v6info->IsFragment == false) - { - if (v6info->FragmentHeader == NULL || ((IPV6_GET_FLAGS(v6info->FragmentHeader) & IPV6_FRAGMENT_HEADER_FLAG_MORE_FRAGMENTS) == 0)) - { - // TCP checksuming doesn't target fragmented packets - TCP_HEADER *tcp = p->L4.TCPHeader; - - if (tcp != NULL) - { - USHORT tcp_offloading_checksum1 = CalcChecksumForIPv6(&v6->SrcAddress, &v6->DestAddress, IP_PROTO_TCP, NULL, 0, v6info->PayloadSize); - USHORT tcp_offloading_checksum2 = ~tcp_offloading_checksum1; - - if (tcp->Checksum == 0 || tcp->Checksum == tcp_offloading_checksum1 || tcp->Checksum == tcp_offloading_checksum2) - { - tcp->Checksum = 0; - tcp->Checksum = CalcChecksumForIPv6(&v6->SrcAddress, &v6->DestAddress, IP_PROTO_TCP, tcp, v6info->PayloadSize, 0); - } - } - } - } - } - else if (p->TypeL4 == L4_UDP) - { - // Recalculation of the UDP checksum - if (v6info->IsFragment == false) - { - UDP_HEADER *udp = p->L4.UDPHeader; - - if (udp != NULL && udp->Checksum != 0) - { - USHORT udp_len = Endian16(udp->PacketLength); - USHORT udp_offloading_checksum1 = CalcChecksumForIPv6(&v6->SrcAddress, &v6->DestAddress, IP_PROTO_UDP, NULL, 0, udp_len); - USHORT udp_offloading_checksum2 = ~udp_offloading_checksum1; - - if (udp->Checksum == 0 || udp->Checksum == udp_offloading_checksum1 || udp->Checksum == udp_offloading_checksum2) - { - udp->Checksum = 0; - - if ((v6info->FragmentHeader == NULL || ((IPV6_GET_FLAGS(v6info->FragmentHeader) & IPV6_FRAGMENT_HEADER_FLAG_MORE_FRAGMENTS) == 0)) && (v6info->PayloadSize >= udp_len)) - { - // If the packet is not fragmented, recalculate the checksum - udp->Checksum = CalcChecksumForIPv6(&v6->SrcAddress, &v6->DestAddress, IP_PROTO_UDP, udp, udp_len, 0); - } - else - { - // Don't do (can't do) anything in the case of fragmented packet - } - } - } - } - } - } - } -} - - -// Parse the HTTPS access log -HTTPLOG *ParseHttpsAccessLog(PKT *pkt) -{ - HTTPLOG h; - char sni[MAX_PATH]; - // Validate arguments - if (pkt == NULL) - { - return NULL; - } - - if (GetSniNameFromSslPacket(pkt->Payload, pkt->PayloadSize, sni, sizeof(sni)) == false) - { - return NULL; - } - - Zero(&h, sizeof(h)); - - StrCpy(h.Method, sizeof(h.Method), "SSL_Connect"); - StrCpy(h.Hostname, sizeof(h.Hostname), sni); - h.Port = Endian16(pkt->L4.TCPHeader->DstPort); - StrCpy(h.Path, sizeof(h.Path), "/"); - h.IsSsl = true; - - return Clone(&h, sizeof(h)); -} - -// Parse the HTTP access log -HTTPLOG *ParseHttpAccessLog(PKT *pkt) -{ - HTTPLOG h; - UCHAR *buf; - UINT size; - BUF *b; - char *line1; - bool ok = false; - // Validate arguments - if (pkt == NULL) - { - return NULL; - } - - buf = pkt->Payload; - size = pkt->PayloadSize; - - if (size <= 5) - { - return NULL; - } - - // Check whether it starts with the HTTP-specific string - if (CmpCaseIgnore(buf, "GET ", 4) != 0 && - CmpCaseIgnore(buf, "HEAD ", 5) != 0 && - CmpCaseIgnore(buf, "POST ", 5) != 0) - { - return NULL; - } - - Zero(&h, sizeof(h)); - - h.Port = Endian16(pkt->L4.TCPHeader->DstPort); - - b = NewBuf(); - WriteBuf(b, buf, size); - SeekBuf(b, 0, 0); - - line1 = CfgReadNextLine(b); - - if (line1 != NULL) - { - TOKEN_LIST *tokens = ParseToken(line1, " \t"); - if (tokens != NULL) - { - if (tokens->NumTokens == 3) - { - StrCpy(h.Method, sizeof(h.Hostname), tokens->Token[0]); - Trim(h.Method); - - StrCpy(h.Path, sizeof(h.Path), tokens->Token[1]); - Trim(h.Path); - - StrCpy(h.Protocol, sizeof(h.Protocol), tokens->Token[2]); - Trim(h.Protocol); - - StrUpper(h.Method); - - while (true) - { - char *line = CfgReadNextLine(b); - UINT i; - - if (line == NULL) - { - break; - } - - i = SearchStr(line, ":", 0); - if (i != INFINITE && i < (MAX_SIZE / 2)) - { - char name[MAX_SIZE]; - char value[MAX_SIZE]; - - StrCpy(name, sizeof(name), line); - name[i] = 0; - Trim(name); - - StrCpy(value, sizeof(value), line + i + 1); - Trim(value); - - if (StrCmpi(name, "host") == 0) - { - StrCpy(h.Hostname, sizeof(h.Hostname), value); - } - else if (StrCmpi(name, "referer") == 0) - { - StrCpy(h.Referer, sizeof(h.Referer), value); - } - else if (StrCmpi(name, "user-agent") == 0) - { - StrCpy(h.UserAgent, sizeof(h.UserAgent), value); - } - } - - Free(line); - } - - if (IsEmptyStr(h.Hostname) == false) - { - ok = true; - } - } - FreeToken(tokens); - } - } - - Free(line1); - FreeBuf(b); - - if (ok) - { - return Clone(&h, sizeof(h)); - } - else - { - return NULL; - } -} - - -// Layer-2 parsing -bool ParsePacketL2Ex(PKT *p, UCHAR *buf, UINT size, bool no_l3, bool no_l3_l4_except_icmpv6) -{ - UINT i; - bool b1, b2; - USHORT type_id_16; - // Validate arguments - if (p == NULL || buf == NULL) - { - return false; - } - - // Check the size - if (size < sizeof(MAC_HEADER)) - { - return false; - } - - // MAC header - p->MacHeader = (MAC_HEADER *)buf; - - buf += sizeof(MAC_HEADER); - size -= sizeof(MAC_HEADER); - - // Analysis of the MAC header - p->BroadcastPacket = true; - b1 = true; - b2 = true; - for (i = 0; i < 6; i++) - { - if (p->MacHeader->DestAddress[i] != 0xff) - { - p->BroadcastPacket = false; - } - if (p->MacHeader->SrcAddress[i] != 0xff) - { - b1 = false; - } - if (p->MacHeader->SrcAddress[i] != 0x00) - { - b2 = false; - } - } - if (b1 || b2 || (memcmp(p->MacHeader->SrcAddress, p->MacHeader->DestAddress, 6) == 0)) - { - p->InvalidSourcePacket = true; - } - else - { - p->InvalidSourcePacket = false; - } - - if (p->MacHeader->DestAddress[0] & 0x01) - { - p->BroadcastPacket = true; - } - - // Parse L3 packet - type_id_16 = Endian16(p->MacHeader->Protocol); - - if (type_id_16 > 1500) - { - // Ordinary Ethernet frame - switch (type_id_16) - { - case MAC_PROTO_ARPV4: // ARPv4 - if (no_l3 || no_l3_l4_except_icmpv6) - { - return true; - } - - return ParsePacketARPv4(p, buf, size); - - case MAC_PROTO_IPV4: // IPv4 - if (no_l3 || no_l3_l4_except_icmpv6) - { - return true; - } - - return ParsePacketIPv4(p, buf, size); - - case MAC_PROTO_IPV6: // IPv6 - if (no_l3) - { - return true; - } - - return ParsePacketIPv6(p, buf, size, no_l3_l4_except_icmpv6); - - default: // Unknown - if (type_id_16 == p->VlanTypeID) - { - // VLAN - return ParsePacketTAGVLAN(p, buf, size); - } - else - { - return true; - } - } - } - else - { - // Old IEEE 802.3 frame (payload length of the packet is written in the header) - // (It has been used in the BPDU, etc.) - UINT length = (UINT)type_id_16; - LLC_HEADER *llc; - - // Check whether the length is remaining - if (size < length || size < sizeof(LLC_HEADER)) - { - return true; - } - - // Read an LLC header - llc = (LLC_HEADER *)buf; - buf += sizeof(LLC_HEADER); - size -= sizeof(LLC_HEADER); - - // Determine the protocol by the value of DSAP and SSAP - if (llc->Dsap == LLC_DSAP_BPDU && llc->Ssap == LLC_SSAP_BPDU) - { - // This is a BPDU (Spanning Tree) - return ParsePacketBPDU(p, buf, size); - } - else - { - // Unknown protocol - return true; - } - } -} - -// TAG VLAN parsing -bool ParsePacketTAGVLAN(PKT *p, UCHAR *buf, UINT size) -{ - USHORT vlan_ushort; - // Validate arguments - if (p == NULL || buf == NULL) - { - return false; - } - - // Check the size - if (size < sizeof(TAGVLAN_HEADER)) - { - return false; - } - - // TAG VLAN header - p->L3.TagVlanHeader = (TAGVLAN_HEADER *)buf; - p->TypeL3 = L3_TAGVLAN; - - buf += sizeof(TAGVLAN_HEADER); - size -= sizeof(TAGVLAN_HEADER); - - vlan_ushort = READ_USHORT(p->L3.TagVlanHeader->Data); - vlan_ushort = vlan_ushort & 0xFFF; - - p->VlanId = vlan_ushort; - - return true; -} - -// BPDU Parsing -bool ParsePacketBPDU(PKT *p, UCHAR *buf, UINT size) -{ - // Validate arguments - if (p == NULL || buf == NULL) - { - return false; - } - - // Check the size - if (size < sizeof(BPDU_HEADER)) - { - return true; - } - - // BPDU header - p->L3.BpduHeader = (BPDU_HEADER *)buf; - p->TypeL3 = L3_BPDU; - - buf += sizeof(BPDU_HEADER); - size -= sizeof(BPDU_HEADER); - - return true; -} - -// ARPv4 Parsing -bool ParsePacketARPv4(PKT *p, UCHAR *buf, UINT size) -{ - // Validate arguments - if (p == NULL || buf == NULL) - { - return false; - } - - // Check the size - if (size < sizeof(ARPV4_HEADER)) - { - return false; - } - - // ARPv4 header - p->L3.ARPv4Header = (ARPV4_HEADER *)buf; - p->TypeL3 = L3_ARPV4; - - buf += sizeof(ARPV4_HEADER); - size -= sizeof(ARPV4_HEADER); - - return true; -} - -// Analysis of the IPv6 extension header -bool ParseIPv6ExtHeader(IPV6_HEADER_PACKET_INFO *info, UCHAR next_header, UCHAR *buf, UINT size) -{ - bool ret = false; - IPV6_OPTION_HEADER *option_header; - UINT option_header_size; - UCHAR next_header_2 = IPV6_HEADER_NONE; - // Validate arguments - if (info == NULL || buf == NULL) - { - return false; - } - - info->IsFragment = false; - - while (true) - { - if (size > 8) - { - next_header_2 = *((UCHAR *)buf); - } - - switch (next_header) - { - case IPV6_HEADER_HOP: - case IPV6_HEADER_ENDPOINT: - case IPV6_HEADER_ROUTING: - // Variable-length header - if (size < 8) - { - return false; - } - - option_header = (IPV6_OPTION_HEADER *)buf; - option_header_size = (option_header->Size + 1) * 8; - if (size < option_header_size) - { - return false; - } - - switch (next_header) - { - case IPV6_HEADER_HOP: - info->HopHeader = (IPV6_OPTION_HEADER *)buf; - info->HopHeaderSize = option_header_size; - break; - - case IPV6_HEADER_ENDPOINT: - info->EndPointHeader = (IPV6_OPTION_HEADER *)buf; - info->EndPointHeaderSize = option_header_size; - break; - - case IPV6_HEADER_ROUTING: - info->RoutingHeader = (IPV6_OPTION_HEADER *)buf; - info->RoutingHeaderSize = option_header_size; - break; - } - - buf += option_header_size; - size -= option_header_size; - break; - - case IPV6_HEADER_FRAGMENT: - // Fragment header (fixed length) - if (size < sizeof(IPV6_FRAGMENT_HEADER)) - { - return false; - } - - info->FragmentHeader = (IPV6_FRAGMENT_HEADER *)buf; - - if (IPV6_GET_FRAGMENT_OFFSET(info->FragmentHeader) != 0) - { - info->IsFragment = true; - } - - buf += sizeof(IPV6_FRAGMENT_HEADER); - size -= sizeof(IPV6_FRAGMENT_HEADER); - break; - - default: - // Considered that the payload follows - if (next_header != IPV6_HEADER_NONE) - { - info->Payload = buf; - info->PayloadSize = size; - } - else - { - info->Payload = NULL; - info->PayloadSize = 0; - } - info->Protocol = next_header; - return true; - } - - next_header = next_header_2; - } -} - -// Analysis of the IPv6 header -bool ParsePacketIPv6Header(IPV6_HEADER_PACKET_INFO *info, UCHAR *buf, UINT size) -{ - // Validate arguments - if (info == NULL || buf == NULL) - { - Zero(info, sizeof(IPV6_HEADER_PACKET_INFO)); - return false; - } - - Zero(info, sizeof(IPV6_HEADER_PACKET_INFO)); - - // IPv6 header - if (size < sizeof(IPV6_HEADER)) - { - // Invalid size - return false; - } - - info->IPv6Header = (IPV6_HEADER *)buf; - buf += sizeof(IPV6_HEADER); - size -= sizeof(IPV6_HEADER); - - if (IPV6_GET_VERSION(info->IPv6Header) != 6) - { - // Invalid version - return false; - } - - // Analysis of the extension header - if (ParseIPv6ExtHeader(info, info->IPv6Header->NextHeader, buf, size) == false) - { - return false; - } - - // Record the header size - if (info->Payload != NULL) - { - info->TotalHeaderSize = (UINT)((UINT64)(info->Payload) - (UINT64)(info->IPv6Header)); - } - - return true; -} - -// Analyse the options of ICMPv6 packet -bool ParseICMPv6Options(ICMPV6_OPTION_LIST *o, UCHAR *buf, UINT size) -{ - // Validate arguments - if (o == NULL || buf == NULL) - { - return false; - } - - Zero(o, sizeof(ICMPV6_OPTION_LIST)); - - // Read the header part - while (true) - { - ICMPV6_OPTION *option_header; - UINT header_total_size; - UCHAR *header_pointer; - if (size < sizeof(ICMPV6_OPTION)) - { - // Size shortage - return true; - } - - option_header = (ICMPV6_OPTION *)buf; - // Calculate the entire header size - header_total_size = option_header->Length * 8; - if (header_total_size == 0) - { - // The size is zero - return true; - } - if (size < header_total_size) - { - // Size shortage - return true; - } - - header_pointer = buf; - buf += header_total_size; - size -= header_total_size; - - switch (option_header->Type) - { - case ICMPV6_OPTION_TYPE_SOURCE_LINK_LAYER: - case ICMPV6_OPTION_TYPE_TARGET_LINK_LAYER: - // Source or target link-layer option - if (header_total_size >= sizeof(ICMPV6_OPTION_LINK_LAYER)) - { - if (option_header->Type == ICMPV6_OPTION_TYPE_SOURCE_LINK_LAYER) - { - o->SourceLinkLayer = (ICMPV6_OPTION_LINK_LAYER *)header_pointer; - } - else - { - o->TargetLinkLayer = (ICMPV6_OPTION_LINK_LAYER *)header_pointer; - } - } - else - { - // ICMPv6 packet corruption? - return false; - } - break; - - case ICMPV6_OPTION_TYPE_PREFIX: - // Prefix Information - if (header_total_size >= sizeof(ICMPV6_OPTION_PREFIX)) - { - UINT i; - for (i = 0; i < ICMPV6_OPTION_PREFIXES_MAX_COUNT; i++) - { - if (o->Prefix[i] == NULL) - { - o->Prefix[i] = (ICMPV6_OPTION_PREFIX *)header_pointer; - break; - } - } - } - else - { - // ICMPv6 packet corruption? - } - break; - - case ICMPV6_OPTION_TYPE_MTU: - // MTU - if (header_total_size >= sizeof(ICMPV6_OPTION_MTU)) - { - o->Mtu = (ICMPV6_OPTION_MTU *)header_pointer; - } - else - { - // ICMPv6 packet corruption? - } - break; - } - } -} - -// ICMPv6 parsing -bool ParseICMPv6(PKT *p, UCHAR *buf, UINT size) -{ - ICMPV6_HEADER_INFO icmp_info; - ICMP_HEADER *icmp; - ICMP_ECHO *echo; - UINT msg_size; - // Validate arguments - if (p == NULL || buf == NULL) - { - return false; - } - - Zero(&icmp_info, sizeof(icmp_info)); - - if (size < sizeof(ICMP_HEADER)) - { - return false; - } - - icmp = (ICMP_HEADER *)buf; - p->L4.ICMPHeader = icmp; - - msg_size = size - sizeof(ICMP_HEADER); - - icmp_info.Type = icmp->Type; - icmp_info.Code = icmp->Code; - icmp_info.Data = ((UCHAR *)buf) + sizeof(ICMP_HEADER); - icmp_info.DataSize = msg_size; - - switch (icmp_info.Type) - { - case ICMPV6_TYPE_ECHO_REQUEST: - case ICMPV6_TYPE_ECHO_RESPONSE: - // ICMP Echo Request / Response - if (icmp_info.DataSize < sizeof(ICMP_ECHO)) - { - return false; - } - - echo = (ICMP_ECHO *)icmp_info.Data; - - icmp_info.EchoHeader.Identifier = Endian16(echo->Identifier); - icmp_info.EchoHeader.SeqNo = Endian16(echo->SeqNo); - icmp_info.EchoData = (UCHAR *)echo + sizeof(ICMP_ECHO); - icmp_info.EchoDataSize = icmp_info.DataSize - sizeof(ICMP_ECHO); - - break; - - case ICMPV6_TYPE_ROUTER_SOLICIATION: - // Router Solicitation - if (icmp_info.DataSize < sizeof(ICMPV6_ROUTER_SOLICIATION_HEADER)) - { - return false; - } - - icmp_info.Headers.RouterSoliciationHeader = - (ICMPV6_ROUTER_SOLICIATION_HEADER *)(((UCHAR *)icmp_info.Data)); - - if (ParseICMPv6Options(&icmp_info.OptionList, ((UCHAR *)icmp_info.Headers.HeaderPointer) + sizeof(ICMPV6_ROUTER_SOLICIATION_HEADER), - icmp_info.DataSize - sizeof(ICMPV6_ROUTER_SOLICIATION_HEADER)) == false) - { - return false; - } - - break; - - case ICMPV6_TYPE_ROUTER_ADVERTISEMENT: - // Router Advertisement - if (icmp_info.DataSize < sizeof(ICMPV6_ROUTER_ADVERTISEMENT_HEADER)) - { - return false; - } - - icmp_info.Headers.RouterAdvertisementHeader = - (ICMPV6_ROUTER_ADVERTISEMENT_HEADER *)(((UCHAR *)icmp_info.Data)); - - if (ParseICMPv6Options(&icmp_info.OptionList, ((UCHAR *)icmp_info.Headers.HeaderPointer) + sizeof(ICMPV6_ROUTER_ADVERTISEMENT_HEADER), - icmp_info.DataSize - sizeof(ICMPV6_ROUTER_ADVERTISEMENT_HEADER)) == false) - { - return false; - } - - break; - - case ICMPV6_TYPE_NEIGHBOR_SOLICIATION: - // Neighbor Solicitation - if (icmp_info.DataSize < sizeof(ICMPV6_NEIGHBOR_SOLICIATION_HEADER)) - { - return false; - } - - icmp_info.Headers.NeighborSoliciationHeader = - (ICMPV6_NEIGHBOR_SOLICIATION_HEADER *)(((UCHAR *)icmp_info.Data)); - - if (ParseICMPv6Options(&icmp_info.OptionList, ((UCHAR *)icmp_info.Headers.HeaderPointer) + sizeof(ICMPV6_NEIGHBOR_SOLICIATION_HEADER), - icmp_info.DataSize - sizeof(ICMPV6_NEIGHBOR_SOLICIATION_HEADER)) == false) - { - return false; - } - - break; - - case ICMPV6_TYPE_NEIGHBOR_ADVERTISEMENT: - // Neighbor Advertisement - if (icmp_info.DataSize < sizeof(ICMPV6_NEIGHBOR_ADVERTISEMENT_HEADER)) - { - return false; - } - - icmp_info.Headers.NeighborAdvertisementHeader = - (ICMPV6_NEIGHBOR_ADVERTISEMENT_HEADER *)(((UCHAR *)icmp_info.Data)); - - if (ParseICMPv6Options(&icmp_info.OptionList, ((UCHAR *)icmp_info.Headers.HeaderPointer) + sizeof(ICMPV6_NEIGHBOR_ADVERTISEMENT_HEADER), - icmp_info.DataSize - sizeof(ICMPV6_NEIGHBOR_ADVERTISEMENT_HEADER)) == false) - { - return false; - } - - break; - } - - p->TypeL4 = L4_ICMPV6; - Copy(&p->ICMPv6HeaderPacketInfo, &icmp_info, sizeof(ICMPV6_HEADER_INFO)); - - return true; -} - -// Release of the ICMPv6 options -void FreeCloneICMPv6Options(ICMPV6_OPTION_LIST *o) -{ - UINT i; - // Validate arguments - if (o == NULL) - { - return; - } - - Free(o->SourceLinkLayer); - Free(o->TargetLinkLayer); - - for (i = 0; i < ICMPV6_OPTION_PREFIXES_MAX_COUNT; i++) - { - Free(o->Prefix[i]); - o->Prefix[i] = NULL; - } - Free(o->Mtu); -} - -// Clone of the ICMPv6 options -void CloneICMPv6Options(ICMPV6_OPTION_LIST *dst, ICMPV6_OPTION_LIST *src) -{ - UINT i; - // Validate arguments - if (dst == NULL || src == NULL) - { - return; - } - - Zero(dst, sizeof(ICMPV6_OPTION_LIST)); - - dst->SourceLinkLayer = Clone(src->SourceLinkLayer, sizeof(ICMPV6_OPTION_LINK_LAYER)); - dst->TargetLinkLayer = Clone(src->TargetLinkLayer, sizeof(ICMPV6_OPTION_LINK_LAYER)); - for (i = 0; i < ICMPV6_OPTION_PREFIXES_MAX_COUNT; i++) - { - if (src->Prefix[i] != NULL) - { - dst->Prefix[i] = Clone(src->Prefix[i], sizeof(ICMPV6_OPTION_PREFIX)); - } - else - { - break; - } - } - dst->Mtu = Clone(src->Mtu, sizeof(ICMPV6_OPTION_MTU)); -} - -// IPv6 parsing -bool ParsePacketIPv6(PKT *p, UCHAR *buf, UINT size, bool no_l3_l4_except_icmpv6) -{ - // Validate arguments - if (p == NULL || buf == NULL) - { - return false; - } - - if (ParsePacketIPv6Header(&p->IPv6HeaderPacketInfo, buf, size) == false) - { - return false; - } - - p->TypeL3 = L3_IPV6; - p->L3.IPv6Header = p->IPv6HeaderPacketInfo.IPv6Header; - - if (p->IPv6HeaderPacketInfo.Payload == NULL) - { - // No payload - return true; - } - - buf = p->IPv6HeaderPacketInfo.Payload; - size = p->IPv6HeaderPacketInfo.PayloadSize; - - if (p->IPv6HeaderPacketInfo.IsFragment) - { - // This is a fragmented packet. Quit interpreting - p->TypeL4 = L4_FRAGMENT; - return true; - } - - // Parse a L4 packet - switch (p->IPv6HeaderPacketInfo.Protocol) - { - case IP_PROTO_ICMPV6: // ICMPv6 - if (ParseICMPv6(p, buf, size) == false) - { - // Returns true also if it fails to parse ICMPv6 - return true; - } - else - { - return true; - } - - case IP_PROTO_TCP: // TCP - if (no_l3_l4_except_icmpv6) - { - return true; - } - return ParseTCP(p, buf, size); - - case IP_PROTO_UDP: // UDP - if (no_l3_l4_except_icmpv6) - { - return true; - } - return ParseUDP(p, buf, size); - - default: // Unknown - return true; - } - - return true; -} - -// Parse the IPv4 by adding a dummy MAC header -PKT *ParsePacketIPv4WithDummyMacHeader(UCHAR *buf, UINT size) -{ - UCHAR *tmp; - UINT tmp_size; - PKT *ret; - // Validate arguments - if (buf == NULL) - { - return NULL; - } - - tmp_size = size + 14; - tmp = Malloc(tmp_size); - Zero(tmp, 12); - WRITE_USHORT(tmp + 12, MAC_PROTO_IPV4); - Copy(tmp + 14, buf, size); - - ret = ParsePacket(tmp, tmp_size); - - if (ret == NULL) - { - Free(tmp); - } - - return ret; -} - -// IPv4 parsing -bool ParsePacketIPv4(PKT *p, UCHAR *buf, UINT size) -{ - UINT header_size; - // Validate arguments - if (p == NULL || buf == NULL) - { - return false; - } - - // Check the size - if (size < sizeof(IPV4_HEADER)) - { - return false; - } - - // IPv4 header - p->L3.IPv4Header = (IPV4_HEADER *)buf; - p->TypeL3 = L3_IPV4; - - // Check the header - header_size = IPV4_GET_HEADER_LEN(p->L3.IPv4Header) * 4; - if (header_size < sizeof(IPV4_HEADER) || size < header_size) - { - // Header size is invalid - p->L3.IPv4Header = NULL; - p->TypeL3= L3_UNKNOWN; - return true; - } - - buf += header_size; - size -= header_size; - - p->IPv4PayloadSize = MIN(size, Endian16(p->L3.IPv4Header->TotalLength) - header_size); - if (Endian16(p->L3.IPv4Header->TotalLength) < header_size) - { - p->IPv4PayloadSize = 0; - } - - p->IPv4PayloadData = buf; - - if (IPV4_GET_OFFSET(p->L3.IPv4Header) != 0) - { - // Quit analysing since this is fragmented - p->TypeL4 = L4_FRAGMENT; - - return true; - } - - // Parse a L4 packet - switch (p->L3.IPv4Header->Protocol) - { - case IP_PROTO_ICMPV4: // ICMPv4 - return ParseICMPv4(p, buf, size); - - case IP_PROTO_UDP: // UDP - return ParseUDP(p, buf, size); - - case IP_PROTO_TCP: // TCP - return ParseTCP(p, buf, size); - - default: // Unknown - return true; - } -} - -// ICMPv4 parsing -bool ParseICMPv4(PKT *p, UCHAR *buf, UINT size) -{ - // Validate arguments - if (p == NULL || buf == NULL) - { - return false; - } - - // Check the size - if (size < sizeof(ICMP_HEADER)) - { - // Size is invalid - return false; - } - - // ICMPv4 header - p->L4.ICMPHeader = (ICMP_HEADER *)buf; - p->TypeL4 = L4_ICMPV4; - - buf += sizeof(ICMP_HEADER); - size -= sizeof(ICMP_HEADER); - - return true; -} - -// TCP parsing -bool ParseTCP(PKT *p, UCHAR *buf, UINT size) -{ - UINT header_size; - // Validate arguments - if (p == NULL || buf == NULL) - { - return false; - } - - // Check the size - if (size < sizeof(TCP_HEADER)) - { - // Size is invalid - return false; - } - - // TCP header - p->L4.TCPHeader = (TCP_HEADER *)buf; - p->TypeL4 = L4_TCP; - - // Check the header size - header_size = TCP_GET_HEADER_SIZE(p->L4.TCPHeader) * 4; - if (header_size < sizeof(TCP_HEADER) || size < header_size) - { - // Header size is invalid - p->L4.TCPHeader = NULL; - p->TypeL4 = L4_UNKNOWN; - return true; - } - - buf += header_size; - size -= header_size; - - p->Payload = buf; - p->PayloadSize = size; - - return true; -} - -// Get the next byte -UCHAR GetNextByte(BUF *b) -{ - UCHAR c = 0; - // Validate arguments - if (b == NULL) - { - return 0; - } - - if (ReadBuf(b, &c, 1) != 1) - { - return 0; - } - - return c; -} - -// Interpret the DNS query -bool ParseDnsQuery(char *name, UINT name_size, void *data, UINT data_size) -{ - BUF *b; - char tmp[257]; - bool ok = true; - USHORT val; - // Validate arguments - if (name == NULL || data == NULL || data_size == 0) - { - return false; - } - StrCpy(name, name_size, ""); - - b = NewBuf(); - WriteBuf(b, data, data_size); - SeekBuf(b, 0, 0); - - while (true) - { - UINT next_len = (UINT)GetNextByte(b); - if (next_len > 0) - { - // Read only the specified length - Zero(tmp, sizeof(tmp)); - if (ReadBuf(b, tmp, next_len) != next_len) - { - ok = false; - break; - } - // Append - if (StrLen(name) != 0) - { - StrCat(name, name_size, "."); - } - StrCat(name, name_size, tmp); - } - else - { - // Read all - break; - } - } - - if (ReadBuf(b, &val, sizeof(val)) != sizeof(val)) - { - ok = false; - } - else - { - if (Endian16(val) != 0x01 && Endian16(val) != 0x0c) - { - ok = false; - } - } - - if (ReadBuf(b, &val, sizeof(val)) != sizeof(val)) - { - ok = false; - } - else - { - if (Endian16(val) != 0x01) - { - ok = false; - } - } - - FreeBuf(b); - - if (ok == false || StrLen(name) == 0) - { - return false; - } - else - { - return true; - } -} - -// DNS parsing -void ParseDNS(PKT *p, UCHAR *buf, UINT size) -{ - UCHAR *query_data; - UINT query_data_size; - DNSV4_HEADER *dns; - char hostname[MAX_SIZE]; - if (p == NULL|| buf == NULL) - { - return; - } - - if (size < sizeof(DNSV4_HEADER)) - { - return; - } - - dns = (DNSV4_HEADER *)buf; - - if ((dns->Flag1 & 78) != 0 || (dns->Flag1 & 0x80) != 0) - { - // Illegal opcode - return; - } - if (Endian16(dns->NumQuery) != 1) - { - // Number of queries is invalid - return; - } - - query_data = ((UCHAR *)dns) + sizeof(DNSV4_HEADER); - query_data_size = size - sizeof(DNSV4_HEADER); - - // Interpret the query - if (ParseDnsQuery(hostname, sizeof(hostname), query_data, query_data_size) == false) - { - // Interpretation fails - return; - } - - StrCpy(p->DnsQueryHost, sizeof(p->DnsQueryHost), hostname); - p->TypeL7 = L7_DNS; -} - -// UDP parsing -bool ParseUDP(PKT *p, UCHAR *buf, UINT size) -{ - USHORT src_port, dst_port; - // Validate arguments - if (p == NULL || buf == NULL) - { - return false; - } - - // Check the size - if (size < sizeof(UDP_HEADER)) - { - // Size is invalid - return false; - } - - // UDP header - p->L4.UDPHeader = (UDP_HEADER *)buf; - p->TypeL4 = L4_UDP; - - buf += sizeof(UDP_HEADER); - size -= sizeof(UDP_HEADER); - - p->Payload = buf; - p->PayloadSize = size; - - // Check the port number - src_port = Endian16(p->L4.UDPHeader->SrcPort); - dst_port = Endian16(p->L4.UDPHeader->DstPort); - - if ((src_port == 67 && dst_port == 68) || - (src_port == 68 && dst_port == 67)) - { - if (p->TypeL3 == L3_IPV4) - { - // A DHCP packet is found - ParseDHCPv4(p, buf, size); - - return true; - } - } - - if (dst_port == 53) - { - ParseDNS(p, buf, size); - return true; - } - - - if (src_port == 500 || dst_port == 500 || src_port == 4500 || dst_port == 4500) - { - if (p->PayloadSize >= sizeof(IKE_HEADER)) - { - IKE_HEADER *ike_header = (IKE_HEADER *)p->Payload; - - if (ike_header->InitiatorCookie != 0 && ike_header->ResponderCookie == 0 && - (ike_header->ExchangeType == IKE_EXCHANGE_TYPE_MAIN || - ike_header->ExchangeType == IKE_EXCHANGE_TYPE_AGGRESSIVE)) - { - // the IKE connection request packet is found - p->TypeL7 = L7_IKECONN; - p->L7.IkeHeader = ike_header; - return true; - } - } - } - - // Determine whether it's an OpenVPN UDP packet - if (size == 14) - { - if (buf[0] == 0x38) - { - if (IsZero(buf + 9, 5)) - { - if (IsZero(buf + 1, 8) == false) - { - // An OpenVPN connection request packet is found - p->TypeL7 = L7_OPENVPNCONN; - return true; - } - } - } - } - - return true; -} - -// DHCPv4 parsing -void ParseDHCPv4(PKT *p, UCHAR *buf, UINT size) -{ - // Validate arguments - if (p == NULL || buf == NULL) - { - return; - } - - // Check the size - if (size < sizeof(DHCPV4_HEADER)) - { - // Size is invalid - return; - } - - // DHCPv4 header - p->L7.DHCPv4Header = (DHCPV4_HEADER *)buf; - p->TypeL7 = L7_DHCPV4; -} - -// Release the memory of the packet -void FreePacket(PKT *p) -{ - // Validate arguments - if (p == NULL) - { - return; - } - - if (p->MacHeader != NULL) - { - switch (p->TypeL3) - { - case L3_IPV4: - FreePacketIPv4(p); - break; - - case L3_ARPV4: - FreePacketARPv4(p); - break; - - case L3_TAGVLAN: - FreePacketTagVlan(p); - break; - } - } - - if (p->HttpLog != NULL) - { - Free(p->HttpLog); - } - - Free(p); -} - -// Release the memory of the packet with data -void FreePacketWithData(PKT *p) -{ - void *data; - // Validate arguments - if (p == NULL) - { - return; - } - - data = p->PacketData; - - FreePacket(p); - - Free(data); -} - -// Release the memory for the IPv4 packet -void FreePacketIPv4(PKT *p) -{ - // Validate arguments - if (p == NULL) - { - return; - } - - switch (p->TypeL4) - { - case L4_ICMPV4: - FreePacketICMPv4(p); - break; - - case L4_TCP: - FreePacketTCPv4(p); - break; - - case L4_UDP: - FreePacketUDPv4(p); - break; - } - - p->L3.IPv4Header = NULL; - p->TypeL3 = L3_UNKNOWN; -} - -// Release the memory for the tagged VLAN packet -void FreePacketTagVlan(PKT *p) -{ - // Validate arguments - if (p == NULL) - { - return; - } - - p->L3.TagVlanHeader = NULL; - p->TypeL3 = L3_UNKNOWN; -} - -// Release the memory for the ARPv4 packet -void FreePacketARPv4(PKT *p) -{ - // Validate arguments - if (p == NULL) - { - return; - } - - p->L3.ARPv4Header = NULL; - p->TypeL3 = L3_UNKNOWN; -} - -// Release the memory of the UDPv4 packet -void FreePacketUDPv4(PKT *p) -{ - // Validate arguments - if (p == NULL) - { - return; - } - - switch (p->TypeL7) - { - case L7_DHCPV4: - FreePacketDHCPv4(p); - break; - } - - p->L4.UDPHeader = NULL; - p->TypeL4 = L4_UNKNOWN; -} - -// Release the memory for the TCPv4 packet -void FreePacketTCPv4(PKT *p) -{ - // Validate arguments - if (p == NULL) - { - return; - } - - p->L4.TCPHeader = NULL; - p->TypeL4 = L4_UNKNOWN; -} - -// Release the memory for the ICMPv4 packet -void FreePacketICMPv4(PKT *p) -{ - // Validate arguments - if (p == NULL) - { - return; - } - - p->L4.ICMPHeader = NULL; - p->TypeL4 = L4_UNKNOWN; -} - -// Release the memory for the DHCPv4 packet -void FreePacketDHCPv4(PKT *p) -{ - // Validate arguments - if (p == NULL) - { - return; - } - - p->L7.DHCPv4Header = NULL; - p->TypeL7 = L7_UNKNOWN; -} - - -// Confirm the checksum of the IP header -bool IpCheckChecksum(IPV4_HEADER *ip) -{ - UINT header_size; - USHORT checksum_original, checksum_calc; - // Validate arguments - if (ip == NULL) - { - return false; - } - - header_size = IPV4_GET_HEADER_LEN(ip) * 4; - checksum_original = ip->Checksum; - ip->Checksum = 0; - checksum_calc = IpChecksum(ip, header_size); - ip->Checksum = checksum_original; - - if (checksum_original == checksum_calc) - { - return true; - } - else - { - return false; - } -} - -// Calculate the checksum -USHORT IpChecksum(void *buf, UINT size) -{ - int sum = 0; - USHORT *addr = (USHORT *)buf; - int len = (int)size; - USHORT *w = addr; - int nleft = len; - USHORT answer = 0; - - while (nleft > 1) - { - USHORT ww = 0; - Copy(&ww, w++, sizeof(USHORT)); - sum += ww; - nleft -= 2; - } - - if (nleft == 1) - { - *(UCHAR *)(&answer) = *(UCHAR *)w; - sum += answer; - } - - sum = (sum >> 16) + (sum & 0xffff); - sum += (sum >> 16); - - answer = ~sum; - - return answer; -} - -// Convert a DHCP option list into a buffer -BUF *BuildDhcpOptionsBuf(LIST *o) -{ - BUF *b; - UINT i; - UCHAR id; - UCHAR sz; - // Validate arguments - if (o == NULL) - { - return NULL; - } - - b = NewBuf(); - for (i = 0; i < LIST_NUM(o); i++) - { - DHCP_OPTION *d = LIST_DATA(o, i); - UINT current_size = d->Size; - UINT current_pos = 0; - - id = (UCHAR)d->Id; - if (d->Size <= 255) - { - sz = (UCHAR)d->Size; - } - else - { - sz = 0xFF; - } - WriteBuf(b, &id, 1); - WriteBuf(b, &sz, 1); - WriteBuf(b, d->Data, sz); - - current_size -= sz; - current_pos += sz; - - while (current_size != 0) - { - id = DHCP_ID_PRIVATE; - if (current_size <= 255) - { - sz = (UCHAR)current_size; - } - else - { - sz = 0xFF; - } - WriteBuf(b, &id, 1); - WriteBuf(b, &sz, 1); - WriteBuf(b, ((UCHAR *)d->Data) + current_pos, sz); - - current_size -= sz; - current_pos += sz; - } - - } - - id = 0xff; - WriteBuf(b, &id, 1); - - return b; -} - -// Convert a DHCP option list to the DHCP option -LIST *BuildDhcpOption(DHCP_OPTION_LIST *opt) -{ - LIST *o; - UCHAR opcode; - BUF *dns_buf; - // Validate arguments - if (opt == NULL) - { - return NULL; - } - - o = NewListFast(NULL); - - // Op-code - opcode = (UCHAR)opt->Opcode; - Add(o, NewDhcpOption(DHCP_ID_MESSAGE_TYPE, &opcode, sizeof(opcode))); - Add(o, NewDhcpOption(DHCP_ID_SERVER_ADDRESS, &opt->ServerAddress, sizeof(opt->ServerAddress))); - - if (opt->LeaseTime != 0) - { - Add(o, NewDhcpOption(DHCP_ID_LEASE_TIME, &opt->LeaseTime, sizeof(opt->LeaseTime))); - } - - if (StrLen(opt->DomainName) != 0 && opt->DnsServer != 0) - { - Add(o, NewDhcpOption(DHCP_ID_DOMAIN_NAME, opt->DomainName, StrLen(opt->DomainName))); - } - if (opt->SubnetMask != 0) - { - Add(o, NewDhcpOption(DHCP_ID_SUBNET_MASK, &opt->SubnetMask, sizeof(opt->SubnetMask))); - } - if (opt->Gateway != 0) - { - Add(o, NewDhcpOption(DHCP_ID_GATEWAY_ADDR, &opt->Gateway, sizeof(opt->Gateway))); - } - - dns_buf = NewBuf(); - - if (opt->DnsServer != 0) - { - WriteBuf(dns_buf, &opt->DnsServer, sizeof(opt->DnsServer)); - } - if (opt->DnsServer2 != 0) - { - WriteBuf(dns_buf, &opt->DnsServer2, sizeof(opt->DnsServer2)); - } - - if (dns_buf->Size >= 1) - { - Add(o, NewDhcpOption(DHCP_ID_DNS_ADDR, dns_buf->Buf, dns_buf->Size)); - } - - FreeBuf(dns_buf); - - if (opt->ClasslessRoute.NumExistingRoutes >= 1) - { - BUF *b = DhcpBuildClasslessRouteData(&opt->ClasslessRoute); - - if (b != NULL) - { - Add(o, NewDhcpOption(DHCP_ID_CLASSLESS_ROUTE, b->Buf, b->Size)); - Add(o, NewDhcpOption(DHCP_ID_MS_CLASSLESS_ROUTE, b->Buf, b->Size)); - - FreeBuf(b); - } - } - - return o; -} - -// Create a new DHCP option item -DHCP_OPTION *NewDhcpOption(UINT id, void *data, UINT size) -{ - DHCP_OPTION *ret; - if (size != 0 && data == NULL) - { - return NULL; - } - - ret = ZeroMalloc(sizeof(DHCP_OPTION)); - ret->Data = ZeroMalloc(size); - Copy(ret->Data, data, size); - ret->Size = size; - ret->Id = id; - - return ret; -} - -// Parse a DHCP options list -DHCP_OPTION_LIST *ParseDhcpOptionList(void *data, UINT size) -{ - DHCP_OPTION_LIST *ret; - LIST *o; - DHCP_OPTION *a; - // Validate arguments - if (data == NULL) - { - return NULL; - } - - // Parse the list - o = ParseDhcpOptions(data, size); - if (o == NULL) - { - return NULL; - } - - ret = ZeroMalloc(sizeof(DHCP_OPTION_LIST)); - - // Get the opcode - a = GetDhcpOption(o, DHCP_ID_MESSAGE_TYPE); - if (a != NULL) - { - if (a->Size == 1) - { - ret->Opcode = *((UCHAR *)a->Data); - } - } - - switch (ret->Opcode) - { - case DHCP_DISCOVER: - case DHCP_REQUEST: - // Parse this more finely because this is client requests - // Requested IP address - a = GetDhcpOption(o, DHCP_ID_REQUEST_IP_ADDRESS); - if (a != NULL && a->Size == 4) - { - Copy(&ret->RequestedIp, a->Data, 4); - } - // Host name - a = GetDhcpOption(o, DHCP_ID_HOST_NAME); - if (a != NULL) - { - if (a->Size > 1) - { - Copy(ret->Hostname, a->Data, MIN(a->Size, sizeof(ret->Hostname) - 1)); - } - } - break; - - case DHCP_OFFER: - case DHCP_ACK: - // Subnet mask - a = GetDhcpOption(o, DHCP_ID_SUBNET_MASK); - if (a != NULL && a->Size >= 4) - { - Copy(&ret->SubnetMask, a->Data, 4); - } - - // Lease time - a = GetDhcpOption(o, DHCP_ID_LEASE_TIME); - if (a != NULL && a->Size == 4) - { - ret->LeaseTime = READ_UINT(a->Data); - } - - // Server IP address - a = GetDhcpOption(o, DHCP_ID_SERVER_ADDRESS); - if (a != NULL && a->Size >= 4) - { - Copy(&ret->ServerAddress, a->Data, 4); - } - - // Domain name - a = GetDhcpOption(o, DHCP_ID_DOMAIN_NAME); - if (a != NULL && a->Size >= 1) - { - Zero(ret->DomainName, sizeof(ret->DomainName)); - Copy(ret->DomainName, a->Data, MIN(a->Size, sizeof(ret->DomainName) - 1)); - } - - // Gateway - a = GetDhcpOption(o, DHCP_ID_GATEWAY_ADDR); - if (a != NULL && a->Size >= 4) - { - Copy(&ret->Gateway, a->Data, 4); - } - - // DNS server - a = GetDhcpOption(o, DHCP_ID_DNS_ADDR); - if (a != NULL && a->Size >= 4) - { - Copy(&ret->DnsServer, a->Data, 4); - - if (a->Size >= 8) - { - Copy(&ret->DnsServer2, ((UCHAR *)a->Data) + 4, 4); - } - } - - // WINS server - a = GetDhcpOption(o, DHCP_ID_WINS_ADDR); - if (a != NULL && a->Size >= 4) - { - Copy(&ret->WinsServer, a->Data, 4); - - if (a->Size >= 8) - { - Copy(&ret->WinsServer2, ((UCHAR *)a->Data) + 4, 4); - } - } - - // Classless static routing table entries - // RFC 3442 - a = GetDhcpOption(o, DHCP_ID_CLASSLESS_ROUTE); - if (a != NULL) - { - DhcpParseClasslessRouteData(&ret->ClasslessRoute, a->Data, a->Size); - } - // Microsoft Extension - a = GetDhcpOption(o, DHCP_ID_MS_CLASSLESS_ROUTE); - if (a != NULL) - { - DhcpParseClasslessRouteData(&ret->ClasslessRoute, a->Data, a->Size); - } - - break; - } - - // Release the list - FreeDhcpOptions(o); - - return ret; -} - -// Normalize the classless routing table string -bool NormalizeClasslessRouteTableStr(char *dst, UINT dst_size, char *src) -{ - DHCP_CLASSLESS_ROUTE_TABLE t; - // Validate arguments - if (dst == NULL || src == NULL) - { - return false; - } - - Zero(&t, sizeof(t)); - if (ParseClasslessRouteTableStr(&t, src)) - { - BuildClasslessRouteTableStr(dst, dst_size, &t); - - return true; - } - - return false; -} - -// Build the string from the classless routing table -void BuildClasslessRouteTableStr(char *str, UINT str_size, DHCP_CLASSLESS_ROUTE_TABLE *t) -{ - UINT i; - UINT num = 0; - ClearStr(str, str_size); - // Validate arguments - if (str == NULL || t == NULL) - { - return; - } - - for (i = 0; i < MAX_DHCP_CLASSLESS_ROUTE_ENTRIES; i++) - { - DHCP_CLASSLESS_ROUTE *r = &t->Entries[i]; - - if (r->Exists) - { - char tmp[128]; - - Zero(tmp, sizeof(tmp)); - BuildClasslessRouteStr(tmp, sizeof(tmp), r); - - if (IsEmptyStr(tmp) == false) - { - if (num >= 1) - { - StrCat(str, str_size, ", "); - } - - StrCat(str, str_size, tmp); - - num++; - } - } - } -} - -// Build the string from the classless routing table entry -void BuildClasslessRouteStr(char *str, UINT str_size, DHCP_CLASSLESS_ROUTE *r) -{ - ClearStr(str, str_size); - // Validate arguments - if (str == NULL || r == NULL || r->Exists == false) - { - return; - } - - Format(str, str_size, "%r/%r/%r", &r->Network, &r->SubnetMask, &r->Gateway); -} - -// Check the classless routing table string -bool CheckClasslessRouteTableStr(char *str) -{ - DHCP_CLASSLESS_ROUTE_TABLE d; - - // Validate arguments - if (str == NULL) - { - return false; - } - - return ParseClasslessRouteTableStr(&d, str); -} - -// Parse the classless routing table string -bool ParseClasslessRouteTableStr(DHCP_CLASSLESS_ROUTE_TABLE *d, char *str) -{ - bool ret = true; - TOKEN_LIST *t; - // Validate arguments - if (d == NULL || str == NULL) - { - return false; - } - - Zero(d, sizeof(DHCP_CLASSLESS_ROUTE_TABLE)); - - t = ParseTokenWithoutNullStr(str, NULL); - - if (t != NULL) - { - UINT i; - - for (i = 0; i < t->NumTokens; i++) - { - DHCP_CLASSLESS_ROUTE r; - - Zero(&r, sizeof(r)); - if (ParseClasslessRouteStr(&r, t->Token[i])) - { - if (d->NumExistingRoutes < MAX_DHCP_CLASSLESS_ROUTE_ENTRIES) - { - Copy(&d->Entries[d->NumExistingRoutes], &r, sizeof(DHCP_CLASSLESS_ROUTE)); - d->NumExistingRoutes++; - } - else - { - // Overflow - ret = false; - break; - } - } - else - { - // Parse error - ret = false; - break; - } - } - } - - FreeToken(t); - - return ret; -} - -// Parse the classless routing table entry string -bool ParseClasslessRouteStr(DHCP_CLASSLESS_ROUTE *r, char *str) -{ - TOKEN_LIST *t; - bool ret = false; - char tmp[MAX_PATH]; - // Validate arguments - if (r == NULL || str == NULL) - { - return false; - } - - StrCpy(tmp, sizeof(tmp), str); - Trim(tmp); - - t = ParseTokenWithoutNullStr(str, "/"); - if (t == NULL) - { - return false; - } - - if (t->NumTokens == 3) - { - char ip_and_mask[MAX_PATH]; - char gateway[MAX_PATH]; - - Zero(r, sizeof(DHCP_CLASSLESS_ROUTE)); - - Format(ip_and_mask, sizeof(ip_and_mask), "%s/%s", t->Token[0], t->Token[1]); - StrCpy(gateway, sizeof(gateway), t->Token[2]); - - if (ParseIpAndSubnetMask46(ip_and_mask, &r->Network, &r->SubnetMask)) - { - r->SubnetMaskLen = SubnetMaskToInt4(&r->SubnetMask); - - if (StrToIP(&r->Gateway, gateway)) - { - if (IsIP4(&r->Gateway) && IsIP4(&r->Network) && IsIP4(&r->SubnetMask)) - { - r->Exists = true; - - IPAnd4(&r->Network, &r->Network, &r->SubnetMask); - - ret = true; - } - } - } - } - - FreeToken(t); - - return ret; -} - -// Build the classless static routing table data for a DHCP message -BUF *DhcpBuildClasslessRouteData(DHCP_CLASSLESS_ROUTE_TABLE *t) -{ - BUF *b; - UINT i; - // Validate arguments - if (t == NULL || t->NumExistingRoutes == 0) - { - return NULL; - } - - b = NewBuf(); - - for (i = 0; i < MAX_DHCP_CLASSLESS_ROUTE_ENTRIES; i++) - { - DHCP_CLASSLESS_ROUTE *r = &t->Entries[i]; - - if (r->Exists && r->SubnetMaskLen <= 32) - { - UCHAR c; - UINT data_len; - UINT ip32; - UCHAR tmp[4]; - - // Width of subnet mask - c = (UCHAR)r->SubnetMaskLen; - WriteBuf(b, &c, 1); - - // Number of significant octets - data_len = (r->SubnetMaskLen + 7) / 8; - Zero(tmp, sizeof(tmp)); - Copy(tmp, &r->Network, data_len); - WriteBuf(b, tmp, data_len); - - // Gateway - ip32 = IPToUINT(&r->Gateway); - WriteBuf(b, &ip32, sizeof(UINT)); - } - } - - SeekBufToBegin(b); - - return b; -} - -// Parse a classless static routing table entries from the DHCP message -void DhcpParseClasslessRouteData(DHCP_CLASSLESS_ROUTE_TABLE *t, void *data, UINT size) -{ - BUF *b; - // Validate arguments - if (t == NULL || data == NULL || size == 0) - { - return; - } - - b = MemToBuf(data, size); - - while (b->Current < b->Size) - { - UCHAR c; - UINT subnet_mask_len; - UINT data_len; - UCHAR tmp[4]; - IP ip; - IP mask; - IP gateway; - DHCP_CLASSLESS_ROUTE r; - UINT ip32; - bool exists = false; - UINT i; - - // Subnet mask length - c = ReadBufChar(b); - subnet_mask_len = c; - if (subnet_mask_len > 32) - { - // Invalid data - break; - } - - data_len = (subnet_mask_len + 7) / 8; - - Zero(tmp, sizeof(tmp)); - if (ReadBuf(b, tmp, data_len) != data_len) - { - // Invalid data - break; - } - - // IP address body - Zero(&ip, sizeof(IP)); - Copy(ip.addr, tmp, data_len); - - Zero(&mask, sizeof(mask)); - IntToSubnetMask4(&mask, subnet_mask_len); - - // Gateway address - Zero(&gateway, sizeof(gateway)); - if (ReadBuf(b, &ip32, sizeof(UINT)) != sizeof(UINT)) - { - // Invalid data - break; - } - UINTToIP(&gateway, ip32); - - Zero(&r, sizeof(r)); - r.Exists = true; - Copy(&r.Gateway, &gateway, sizeof(IP)); - Copy(&r.Network, &ip, sizeof(IP)); - Copy(&r.SubnetMask, &mask, sizeof(IP)); - r.SubnetMaskLen = subnet_mask_len; - - for (i = 0; i < MAX_DHCP_CLASSLESS_ROUTE_ENTRIES; i++) - { - if (Cmp(&t->Entries[i], &r, sizeof(DHCP_CLASSLESS_ROUTE)) == 0) - { - exists = true; - break; - } - } - - if (exists == false) - { - if (t->NumExistingRoutes >= MAX_DHCP_CLASSLESS_ROUTE_ENTRIES) - { - // Overflow - break; - } - - Copy(&t->Entries[t->NumExistingRoutes], &r, sizeof(DHCP_CLASSLESS_ROUTE)); - t->NumExistingRoutes++; - } - } - - FreeBuf(b); -} - -// Finding a DHCP option -DHCP_OPTION *GetDhcpOption(LIST *o, UINT id) -{ - UINT i; - DHCP_OPTION *ret = NULL; - // Validate arguments - if (o == NULL) - { - return NULL; - } - - for (i = 0; i < LIST_NUM(o); i++) - { - DHCP_OPTION *opt = LIST_DATA(o, i); - if (opt->Id == id) - { - ret = opt; - } - } - - return ret; -} - -// Get the best classless routing table entry from the routing table -DHCP_CLASSLESS_ROUTE *GetBestClasslessRoute(DHCP_CLASSLESS_ROUTE_TABLE *t, IP *ip) -{ - DHCP_CLASSLESS_ROUTE *ret = NULL; - UINT i; - UINT max_mask = 0; - // Validate arguments - if (t == NULL || ip == NULL) - { - return NULL; - } - if (t->NumExistingRoutes == 0) - { - return NULL; - } - - for (i = 0; i < MAX_DHCP_CLASSLESS_ROUTE_ENTRIES; i++) - { - DHCP_CLASSLESS_ROUTE *e = &t->Entries[i]; - - if (e->Exists) - { - if (IsInSameNetwork4(ip, &e->Network, &e->SubnetMask)) - { - if (max_mask <= e->SubnetMaskLen) - { - max_mask = e->SubnetMaskLen; - ret = e; - } - } - } - } - - return ret; -} - -// Release the DHCP option -void FreeDhcpOptions(LIST *o) -{ - UINT i; - // Validate arguments - if (o == NULL) - { - return; - } - - for (i = 0; i < LIST_NUM(o); i++) - { - DHCP_OPTION *opt = LIST_DATA(o, i); - Free(opt->Data); - Free(opt); - } - - ReleaseList(o); -} - -// Parse the DHCP Options -LIST *ParseDhcpOptions(void *data, UINT size) -{ - BUF *b; - LIST *o; - DHCP_OPTION *last_opt; - // Validate arguments - if (data == NULL) - { - return NULL; - } - - b = NewBuf(); - WriteBuf(b, data, size); - SeekBuf(b, 0, 0); - - o = NewListFast(NULL); - - last_opt = NULL; - - while (true) - { - UCHAR c = 0; - UCHAR sz = 0; - DHCP_OPTION *opt; - if (ReadBuf(b, &c, 1) != 1) - { - break; - } - if (c == 0xff) - { - break; - } - if (ReadBuf(b, &sz, 1) != 1) - { - break; - } - - if (c == DHCP_ID_PRIVATE && last_opt != NULL) - { - UINT new_size = last_opt->Size + (UINT)sz; - UCHAR *new_buf = ZeroMalloc(new_size); - Copy(new_buf, last_opt->Data, last_opt->Size); - ReadBuf(b, new_buf + last_opt->Size, sz); - Free(last_opt->Data); - last_opt->Data = new_buf; - last_opt->Size = new_size; - } - else - { - opt = ZeroMalloc(sizeof(DHCP_OPTION)); - opt->Id = (UINT)c; - opt->Size = (UINT)sz; - opt->Data = ZeroMalloc((UINT)sz); - ReadBuf(b, opt->Data, sz); - Add(o, opt); - - last_opt = opt; - } - } - - FreeBuf(b); - - return o; -} - -// Rewrite the DHCP message data in the requested IPv4 packet appropriately -BUF *DhcpModifyIPv4(DHCP_MODIFY_OPTION *m, void *data, UINT size) -{ - PKT *p; - BUF *ret = NULL; - // Validate arguments - if (m == NULL || data == NULL || size == 0) - { - return NULL; - } - - p = ParsePacketEx4(data, size, false, 0, false, false, false); - - if (p != NULL && p->TypeL3 == L3_IPV4 && p->TypeL4 == L4_UDP && p->TypeL7 == L7_DHCPV4) - { - BUF *new_buf = DhcpModify(m, p->Payload, p->PayloadSize); - - if (new_buf != NULL) - { - ret = NewBuf(); - - WriteBuf(ret, p->PacketData, p->PacketSize - p->PayloadSize); - WriteBuf(ret, new_buf->Buf, new_buf->Size); - - FreeBuf(new_buf); - } - } - - FreePacket(p); - - if (ret != NULL) - { - PKT *p = ParsePacketEx4(ret->Buf, ret->Size, false, 0, false, false, false); - - if (p != NULL) - { - // Recalculation of the UDP checksum - if (p->TypeL3 == L3_IPV4 && p->TypeL4 == L4_UDP) - { - UDP_HEADER *udp = p->L4.UDPHeader; - - udp->Checksum = 0; - udp->Checksum = CalcChecksumForIPv4(p->L3.IPv4Header->SrcIP, - p->L3.IPv4Header->DstIP, - IP_PROTO_UDP, - udp, - p->PacketSize - (UINT)(((UCHAR *)udp) - ((UCHAR *)p->PacketData)), 0); - } - - FreePacket(p); - } - } - - return ret; -} - -// Rewrite the DHCP packet appropriately -BUF *DhcpModify(DHCP_MODIFY_OPTION *m, void *data, UINT size) -{ - DHCPV4_HEADER *dhcp_header; - UCHAR *data_ptr; - bool ret_ok = false; - BUF *ret = NULL; - BUF *opt_buf = NULL; - UINT magic_cookie = Endian32(DHCP_MAGIC_COOKIE); - bool ok = false; - DHCP_OPTION_LIST *opt = NULL; - LIST *opt_list = NULL; - LIST *opt_list2 = NULL; - UINT src_size = size; - UINT i; - // Validate arguments - if (m == NULL || data == NULL || size == 0) - { - return NULL; - } - - data_ptr = (UCHAR *)data; - - if (size < sizeof(DHCPV4_HEADER)) - { - goto LABEL_CLEANUP; - } - - dhcp_header = (DHCPV4_HEADER *)data_ptr; - data_ptr += sizeof(DHCPV4_HEADER); - - // Search for a Magic Cookie - while (size >= 5) - { - if (Cmp(data_ptr, &magic_cookie, sizeof(UINT)) == 0) - { - // Found - data_ptr += sizeof(UINT); - size -= sizeof(UINT); - ok = true; - break; - } - - data_ptr++; - size--; - } - - if (ok == false) - { - // The packet is invalid - goto LABEL_CLEANUP; - } - - ret = NewBuf(); - WriteBuf(ret, data, (UINT)(data_ptr - ((UCHAR *)data))); - - // Parse the DHCP options list - opt = ParseDhcpOptionList(data_ptr, size); - if (opt == NULL) - { - // The packet is invalid - goto LABEL_CLEANUP; - } - - opt_list = ParseDhcpOptions(data_ptr, size); - if (opt_list == NULL) - { - // The packet is invalid - goto LABEL_CLEANUP; - } - - // Rebuilding the options list - opt_list2 = NewListFast(NULL); - - for (i = 0; i < LIST_NUM(opt_list); i++) - { - DHCP_OPTION *o = LIST_DATA(opt_list, i); - DHCP_OPTION *o2 = NULL; - bool ok = true; - - if (m->RemoveDefaultGatewayOnReply) - { - if (opt->Opcode == DHCP_OFFER || opt->Opcode == DHCP_ACK) - { - // Remove the default gateway from the DHCP Reply - if (o->Id == DHCP_ID_GATEWAY_ADDR) - { - ok = false; - } - if (o->Id == DHCP_ID_DNS_ADDR || o->Id == DHCP_ID_WINS_ADDR || o->Id == DHCP_ID_DOMAIN_NAME) - { - ok = false; - } - } - } - - if (ok && o2 == NULL) - { - o2 = NewDhcpOption(o->Id, o->Data, o->Size); - } - - if (o2 != NULL) - { - Add(opt_list2, o2); - } - } - - opt_buf = BuildDhcpOptionsBuf(opt_list2); - - WriteBuf(ret, opt_buf->Buf, opt_buf->Size); - - if (src_size != ret->Size || Cmp(data, ret->Buf, ret->Size) != 0) - { - // Rewrite if anything changes. Do not rewrite if there is no change - ret_ok = true; - - if (ret->Size < DHCP_MIN_SIZE) - { - // Padding - UCHAR *pad_buf; - UINT pad_size = DHCP_MIN_SIZE - ret->Size; - - pad_buf = ZeroMalloc(pad_size); - - WriteBuf(ret, pad_buf, pad_size); - - Free(pad_buf); - } - } - -LABEL_CLEANUP: - // Memory release - if (opt_buf != NULL) - { - FreeBuf(opt_buf); - } - - if (opt != NULL) - { - Free(opt); - } - - if (opt_list != NULL) - { - FreeDhcpOptions(opt_list); - } - - if (opt_list2 != NULL) - { - FreeDhcpOptions(opt_list2); - } - - // Return a value - if (ret_ok) - { - return ret; - } - else - { - FreeBuf(ret); - return NULL; - } -} +// SoftEther VPN Source Code - Developer Edition Master Branch +// Mayaqua Kernel + + +// TcpIp.c +// Utility module for TCP/IP packet processing + +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +// Release the memory for the ICMP response +void IcmpFreeResult(ICMP_RESULT *r) +{ + // Validate arguments + if (r == NULL) + { + return; + } + + IcmpApiFreeResult(r); +} + +// Parse the ICMP reply packet received from the socket +ICMP_RESULT *IcmpParseResult(IP *dest_ip, USHORT src_id, USHORT src_seqno, UCHAR *recv_buffer, UINT recv_buffer_size) +{ + ICMP_RESULT *ret = NULL; + UINT i; + // Validate arguments + if (dest_ip == NULL || IsIP4(dest_ip) == false || recv_buffer == NULL || recv_buffer_size == 0) + { + return NULL; + } + + i = recv_buffer_size; + + if (true) + { + UINT ip_header_size = GetIpHeaderSize(recv_buffer, i); + if (ip_header_size >= sizeof(IPV4_HEADER) && (ip_header_size <= i)) + { + IPV4_HEADER *ipv4 = (IPV4_HEADER *)recv_buffer; + if ((IPV4_GET_VERSION(ipv4) == 4) && (ipv4->Protocol == IP_PROTO_ICMPV4)) + { + UINT ip_total_len = (UINT)Endian16(ipv4->TotalLength); + + if ((ip_total_len >= sizeof(IPV4_HEADER)) && (ip_total_len <= i) && (ip_total_len >= ip_header_size)) + { + UINT icmp_packet_size = ip_total_len - ip_header_size; + ICMP_HEADER *icmp = (ICMP_HEADER *)(recv_buffer + ip_header_size); + + if (icmp_packet_size >= sizeof(ICMP_HEADER)) + { + USHORT chksum = icmp->Checksum; + USHORT chksum2; + icmp->Checksum = 0; + + chksum2 = IpChecksum(icmp, icmp_packet_size); + + if (chksum2 == chksum) + { + if (icmp->Type == ICMP_TYPE_ECHO_RESPONSE) + { + ICMP_ECHO *echo = (ICMP_ECHO *)(recv_buffer + ip_header_size + sizeof(ICMP_HEADER)); + if (icmp_packet_size >= (sizeof(ICMP_HEADER) + sizeof(ICMP_ECHO))) + { + if (Endian16(echo->Identifier) == src_id && (src_seqno == 0 || Endian16(echo->SeqNo) == src_seqno)) + { + IP ip; + + UINTToIP(&ip, ipv4->SrcIP); + + // Received the correct Echo response + ret = ZeroMalloc(sizeof(ICMP_RESULT)); + + ret->Ok = true; + ret->Ttl = ipv4->TimeToLive; + ret->DataSize = icmp_packet_size - (sizeof(ICMP_HEADER) + sizeof(ICMP_ECHO)); + ret->Data = Clone(recv_buffer + ip_header_size + sizeof(ICMP_HEADER) + sizeof(ICMP_ECHO), + ret->DataSize); + Copy(&ret->IpAddress, &ip, sizeof(IP)); + } + } + } + else if (icmp->Type == ICMP_TYPE_ECHO_REQUEST) + { + // Ignore because an Echo request should not arrive + } + else + { + // If an error is returned, compare to the copy of + // the ICMP packet last sent + IPV4_HEADER *orig_ipv4 = (IPV4_HEADER *)(recv_buffer + ip_header_size + 4 + sizeof(ICMP_HEADER)); + if (icmp_packet_size >= (sizeof(ICMP_HEADER) + 4 + sizeof(IPV4_HEADER))) + { + UINT orig_ipv4_header_size = GetIpHeaderSize((UCHAR *)orig_ipv4, icmp_packet_size - 4 - sizeof(ICMP_HEADER)); + if (orig_ipv4_header_size >= sizeof(IPV4_HEADER)) + { + if ((IPV4_GET_VERSION(orig_ipv4) == 4) && (orig_ipv4->Protocol == IP_PROTO_ICMPV4)) + { + if (icmp_packet_size >= (sizeof(ICMP_HEADER) + 4 + orig_ipv4_header_size + sizeof(ICMP_HEADER) + sizeof(ICMP_ECHO))) + { + ICMP_HEADER *orig_icmp = (ICMP_HEADER *)(recv_buffer + ip_header_size + sizeof(ICMP_HEADER) + 4 + orig_ipv4_header_size); + ICMP_ECHO *orig_echo = (ICMP_ECHO *)(recv_buffer + ip_header_size + sizeof(ICMP_HEADER) + 4 + orig_ipv4_header_size + sizeof(ICMP_HEADER)); + + if (orig_icmp->Type == ICMP_TYPE_ECHO_REQUEST && orig_echo->Identifier == Endian16(src_id) && (src_seqno == 0 || orig_echo->SeqNo == Endian16(src_seqno))) + { + IP ip; + + UINTToIP(&ip, ipv4->SrcIP); + + ret = ZeroMalloc(sizeof(ICMP_RESULT)); + + ret->Type = icmp->Type; + ret->Code = icmp->Code; + ret->Ttl = ipv4->TimeToLive; + ret->DataSize = icmp_packet_size - (sizeof(ICMP_HEADER) + sizeof(ICMP_ECHO)); + ret->Data = Clone(recv_buffer + ip_header_size + sizeof(ICMP_HEADER) + sizeof(ICMP_ECHO), + ret->DataSize); + Copy(&ret->IpAddress, &ip, sizeof(IP)); + } + } + } + } + } + } + } + } + } + } + } + } + + return ret; +} + +// Get whether the packet is a DHCP packet associated with the specified MAC address +bool IsDhcpPacketForSpecificMac(UCHAR *data, UINT size, UCHAR *mac_address) +{ + USHORT *us; + IPV4_HEADER *ip; + UDP_HEADER *udp; + UINT ip_header_size; + bool is_send = false, is_recv = false; + // Validate arguments + if (data == NULL || mac_address == NULL || IsZero(mac_address, 6)) + { + return false; + } + + // Whether the src or the dest matches + if (size < 14) + { + return false; + } + + // Destination MAC address + if (Cmp(data, mac_address, 6) == 0) + { + is_recv = true; + } + size -= 6; + data += 6; + + // Source MAC address + if (Cmp(data, mac_address, 6) == 0) + { + is_send = true; + } + size -= 6; + data += 6; + + if (is_send == false && is_recv == false) + { + return false; + } + if (is_send && is_recv) + { + return false; + } + + // TPID + us = (USHORT *)data; + size -= 2; + data += 2; + + if (READ_USHORT(us) != MAC_PROTO_IPV4) + { + // Other than IPv4 + return false; + } + + // IP header + ip_header_size = GetIpHeaderSize(data, size); + if (ip_header_size == 0) + { + // IPv4 header analysis failure + return false; + } + + ip = (IPV4_HEADER *)data; + data += ip_header_size; + size -= ip_header_size; + + if (ip->Protocol != IP_PROTO_UDP) + { + // Not an UDP packet + return false; + } + + // UDP header + if (size < sizeof(UDP_HEADER)) + { + return false; + } + udp = (UDP_HEADER *)data; + data += sizeof(UDP_HEADER); + size -= sizeof(UDP_HEADER); + + if (is_send) + { + // Detect whether it's a DHCP Request packet + if (Endian16(udp->DstPort) == 67) + { + Debug("IsDhcpPacketForSpecificMac: DHCP Request Packet is Detected.\n"); + return true; + } + } + else if (is_recv) + { + // Detect whether it's a DHCP Response packet + if (Endian16(udp->SrcPort) == 67) + { + Debug("IsDhcpPacketForSpecificMac: DHCP Response Packet is Detected.\n"); + return true; + } + } + + return false; +} + +// Adjust the MSS of the TCP in the IP packet (L2) +bool AdjustTcpMssL2(UCHAR *src, UINT src_size, UINT mss, USHORT tag_vlan_tpid) +{ + MAC_HEADER *mac; + USHORT proto; + // Validate arguments + if (src == NULL || src_size == 0 || mss == 0) + { + return false; + } + if (tag_vlan_tpid == 0) + { + tag_vlan_tpid = MAC_PROTO_TAGVLAN; + } + + if (src_size < sizeof(MAC_HEADER)) + { + return false; + } + + mac = (MAC_HEADER *)src; + + src += sizeof(MAC_HEADER); + src_size -= sizeof(MAC_HEADER); + + proto = Endian16(mac->Protocol); + + if (proto == MAC_PROTO_IPV4 || proto == MAC_PROTO_IPV6) + { + // Ordinary IPv4 / IPv6 packet + return AdjustTcpMssL3(src, src_size, mss); + } + else if (proto == tag_vlan_tpid) + { + // IPv4 / IPv6 packets in the VLAN tag + if (src_size < 4) + { + return false; + } + + src += 2; + src_size -= 2; + + proto = READ_USHORT(src); + + if (proto == MAC_PROTO_IPV4 || proto == MAC_PROTO_IPV6) + { + if (mss >= 5) + { + mss -= 4; + + src += 2; + src_size -= 2; + + return AdjustTcpMssL3(src, src_size, mss); + } + } + } + + return false; +} + +// Get an IP header size +UINT GetIpHeaderSize(UCHAR *src, UINT src_size) +{ + UCHAR ip_ver; + TCP_HEADER *tcp = NULL; + IPV4_HEADER *ip = NULL; + IPV6_HEADER *ip6 = NULL; + // Validate arguments + if (src == NULL || src_size == 0) + { + return 0; + } + + // Get the IP version number + ip_ver = (src[0] >> 4) & 0x0f; + + if (ip_ver == 4) + { + // IPv4 + UINT ip_header_size; + if (src_size < sizeof(IPV4_HEADER)) + { + // No IPv4 header + return 0; + } + + ip = (IPV4_HEADER *)src; + + ip_header_size = IPV4_GET_HEADER_LEN(ip) * 4; + if (ip_header_size < sizeof(IPV4_HEADER)) + { + // Header size is invalid + return 0; + } + + if (src_size < ip_header_size) + { + // No IPv4 header + return 0; + } + + return ip_header_size; + } + else if (ip_ver == 6) + { + // IPv6 + IPV6_HEADER_PACKET_INFO v6; + + if (ParsePacketIPv6Header(&v6, src, src_size) == false) + { + // IPv6 analysis failure + return 0; + } + + ip6 = v6.IPv6Header; + if (ip6 == NULL) + { + return 0; + } + + if (src_size < v6.TotalHeaderSize) + { + // No header data + return 0; + } + + return v6.TotalHeaderSize; + } + else + { + // Invalid + return 0; + } +} + +// Adjust the MSS of TCP in the IP packet (L3) +bool AdjustTcpMssL3(UCHAR *src, UINT src_size, UINT mss) +{ + UCHAR ip_ver; + TCP_HEADER *tcp = NULL; + UINT tcp_size = 0; + UINT tcp_header_size; + UCHAR *options; + UINT options_size; + IPV4_HEADER *ip = NULL; + IPV6_HEADER *ip6 = NULL; + // Validate arguments + if (src == NULL || src_size == 0 || mss == 0) + { + return false; + } + + // Get the IP version number + ip_ver = (src[0] >> 4) & 0x0f; + + if (ip_ver == 4) + { + UINT ip_header_size; + UINT ip_total_length; + // IPv4 + if (src_size < sizeof(IPV4_HEADER)) + { + // No IPv4 header + return false; + } + + ip = (IPV4_HEADER *)src; + + if (ip->Protocol != IP_PROTO_TCP) + { + // Non-TCP + return false; + } + + if (IPV4_GET_OFFSET(ip) != 0) + { + // It is the second or later packet of fragmented packet + return false; + } + + if (IPV4_GET_FLAGS(ip) & 0x01) + { + // Fragmented packet + return false; + } + + ip_header_size = IPV4_GET_HEADER_LEN(ip) * 4; + if (ip_header_size < sizeof(IPV4_HEADER)) + { + // Header size is invalid + return false; + } + + if (src_size < ip_header_size) + { + // No IPv4 header + return false; + } + + ip_total_length = READ_USHORT(&ip->TotalLength); + + if (ip_total_length < ip_header_size) + { + // Invalid total length + return false; + } + + if (src_size < ip_total_length) + { + // No total length + return false; + } + + src += ip_header_size; + src_size = ip_total_length - ip_header_size; + + if (src_size < sizeof(TCP_HEADER)) + { + // No TCP header + return false; + } + + tcp = (TCP_HEADER *)src; + tcp_size = src_size; + } + else if (ip_ver == 6) + { + // IPv6 + IPV6_HEADER_PACKET_INFO v6; + + if (ParsePacketIPv6Header(&v6, src, src_size) == false) + { + // IPv6 analysis failure + return false; + } + + ip6 = v6.IPv6Header; + if (ip6 == NULL) + { + return false; + } + + if (v6.Protocol != IP_PROTO_TCP) + { + // Non-TCP + return false; + } + + if (v6.IsFragment) + { + // It is the second or later packet of fragmented packet + return false; + } + + if (v6.FragmentHeader != NULL) + { + if (IPV6_GET_FLAGS(v6.FragmentHeader) & IPV6_FRAGMENT_HEADER_FLAG_MORE_FRAGMENTS) + { + // Fragmented packet + return false; + } + } + + tcp = (TCP_HEADER *)v6.Payload; + tcp_size = v6.PayloadSize; + } + else + { + // This isn't either IPv4, IPv6 + return false; + } + + // Processing of the TCP header + if (tcp == NULL || tcp_size < sizeof(TCP_HEADER)) + { + return false; + } + + tcp_header_size = TCP_GET_HEADER_SIZE(tcp) * 4; + if (tcp_header_size < sizeof(TCP_HEADER)) + { + // TCP header size is invalid + return false; + } + + if (tcp_size < tcp_header_size) + { + // Packet length shortage + return false; + } + + if (((tcp->Flag & TCP_SYN) == false) || + ((tcp->Flag & TCP_RST) || + (tcp->Flag & TCP_PSH) || + (tcp->Flag & TCP_URG))) + { + // Not a SYN packet + return false; + } + + // Get the option field + options = ((UCHAR *)tcp) + sizeof(TCP_HEADER); + options_size = tcp_header_size - sizeof(TCP_HEADER); + + if (ip6 != NULL) + { + // Reduce MSS by 20 since an IP header for IPv6 is 20 bytes larger than IPv4 + if (mss >= 20) + { + mss -= 20; + } + } + + // MSS should be at least 64 + mss = MAX(mss, 64); + + if (options_size >= 4 && options[0] == 0x02 && options[1] == 0x04) + { + // MSS option of TCP is added + USHORT current_mss = READ_USHORT(((UCHAR *)options) + 2); + + if (current_mss <= mss) + { + // if the value of the MSS is smaller than the specified size + // from the beginning, it doesn't need to be rewritten + return false; + } + else + { + WRITE_USHORT(((UCHAR *)options) + 2, mss); + + // Clear the checksum + tcp->Checksum = 0; + + if (ip != NULL) + { + // Calculate the TCPv4 checksum + tcp->Checksum = CalcChecksumForIPv4(ip->SrcIP, ip->DstIP, IP_PROTO_TCP, tcp, tcp_size, 0); + } + else + { + // Calculate the TCPv6 checksum + tcp->Checksum = CalcChecksumForIPv6(&ip6->SrcAddress, &ip6->DestAddress, + IP_PROTO_TCP, tcp, tcp_size, 0); + } + + return true; + } + } + else + { + // MSS option of TCP is not added + return false; + } +} + + +// Parse the DHCPv4 packet +DHCPV4_DATA *ParseDHCPv4Data(PKT *pkt) +{ + DHCPV4_DATA *d; + UCHAR *data; + UINT size; + UINT magic_cookie = Endian32(DHCP_MAGIC_COOKIE); + bool ok = false; + DHCP_OPTION *o; + // Validate arguments + if (pkt == NULL) + { + return NULL; + } + if (pkt->TypeL3 != L3_IPV4 || pkt->TypeL4 != L4_UDP || pkt->TypeL7 != L7_DHCPV4) + { + return NULL; + } + + d = ZeroMalloc(sizeof(DHCPV4_DATA)); + d->Size = (UINT)(pkt->PacketSize - (((UCHAR *)pkt->L7.PointerL7) - ((UCHAR *)pkt->PacketData))); + d->Data = Clone(pkt->L7.PointerL7, d->Size); + + if (d->Size < sizeof(DHCPV4_HEADER)) + { + goto LABEL_ERROR; + } + + // Header + d->Header = (DHCPV4_HEADER *)d->Data; + + data = d->Data; + size = d->Size; + + // Search for the Magic Cookie + ok = false; + while (size >= 5) + { + if (Cmp(data, &magic_cookie, 4) == 0) + { + // Found + data += 4; + size -= 4; + ok = true; + break; + } + + data++; + size--; + } + + if (ok == false) + { + // Magic Cookie not found + goto LABEL_ERROR; + } + + // Parse the DHCP Options + d->OptionData = data; + d->OptionSize = size; + + d->OptionList = ParseDhcpOptions(data, size); + if (d->OptionList == NULL) + { + // Parsing failure + goto LABEL_ERROR; + } + + UINTToIP(&d->SrcIP, pkt->L3.IPv4Header->SrcIP); + UINTToIP(&d->DestIP, pkt->L3.IPv4Header->DstIP); + + d->SrcPort = Endian16(pkt->L4.UDPHeader->SrcPort); + d->DestPort = Endian16(pkt->L4.UDPHeader->DstPort); + + o = GetDhcpOption(d->OptionList, DHCP_ID_MESSAGE_TYPE); + if (o == NULL || o->Size != 1) + { + goto LABEL_ERROR; + } + + d->OpCode = *((UCHAR *)o->Data); + + d->ParsedOptionList = ParseDhcpOptionList(d->OptionData, d->OptionSize); + + if (d->ParsedOptionList == NULL) + { + goto LABEL_ERROR; + } + + if (d->ParsedOptionList->ServerAddress == 0) + { + d->ParsedOptionList->ServerAddress = d->Header->ServerIP; + } + + d->ParsedOptionList->ClientAddress = d->Header->YourIP; + + return d; + +LABEL_ERROR: + FreeDHCPv4Data(d); + return NULL; +} + +// Release the DHCPv4 packet +void FreeDHCPv4Data(DHCPV4_DATA *d) +{ + // Validate arguments + if (d == NULL) + { + return; + } + + FreeDhcpOptions(d->OptionList); + Free(d->Data); + + Free(d->ParsedOptionList); + + Free(d); +} + +// Embed a VLAN tag to the packet +void VLanInsertTag(void **packet_data, UINT *packet_size, UINT vlan_id, UINT vlan_tpid) +{ + UINT dest_size; + UCHAR *dest_data; + UINT src_size; + UCHAR *src_data; + USHORT vlan_ushort = Endian16(((USHORT)vlan_id) & 0xFFF); + USHORT vlan_tpid_ushort; + // Validate arguments + if (packet_data == NULL || *packet_data == NULL || packet_size == NULL || + *packet_size < 14 || vlan_id == 0) + { + return; + } + if (vlan_tpid == 0) + { + vlan_tpid = MAC_PROTO_TAGVLAN; + } + + vlan_tpid_ushort = Endian16((USHORT)vlan_tpid); + + src_size = *packet_size; + src_data = (UCHAR *)(*packet_data); + + dest_size = src_size + 4; + dest_data = Malloc(dest_size); + + Copy(&dest_data[12], &vlan_tpid_ushort, sizeof(USHORT)); + Copy(&dest_data[14], &vlan_ushort, sizeof(USHORT)); + + Copy(&dest_data[0], &src_data[0], 12); + Copy(&dest_data[16], &src_data[12], src_size - 12); + + *packet_size = dest_size; + *packet_data = dest_data; + + Free(src_data); +} + +// Remove the VLAN tag from the packet +bool VLanRemoveTag(void **packet_data, UINT *packet_size, UINT vlan_id, UINT vlan_tpid) +{ + UCHAR *src_data; + UINT src_size; + USHORT vlan_tpid_ushort; + UCHAR *vlan_tpid_uchar; + // Validate arguments + if (packet_data == NULL || *packet_data == NULL || packet_size == NULL || + *packet_size < 14) + { + return false; + } + + if (vlan_tpid == 0) + { + vlan_tpid = MAC_PROTO_TAGVLAN; + } + + vlan_tpid_ushort = Endian16((USHORT)vlan_tpid); + vlan_tpid_uchar = (UCHAR *)(&vlan_tpid_ushort); + + src_data = (UCHAR *)(*packet_data); + src_size = *packet_size; + + if (src_data[12] == vlan_tpid_uchar[0] && src_data[13] == vlan_tpid_uchar[1]) + { + if (src_size >= 18) + { + USHORT vlan_ushort; + + vlan_ushort = READ_USHORT(&src_data[14]); + vlan_ushort = vlan_ushort & 0xFFF; + + if (vlan_id == 0 || (vlan_ushort == vlan_id)) + { + UINT dest_size = src_size - 4; + UINT i; + + for (i = 12; i < dest_size; i++) + { + src_data[i] = src_data[i + 4]; + } + + *packet_size = dest_size; + + return true; + } + } + } + + return false; +} + +// Sending of an ICMPv6 packet +BUF *BuildICMPv6(IPV6_ADDR *src_ip, IPV6_ADDR *dest_ip, UCHAR hop_limit, UCHAR type, UCHAR code, void *data, UINT size, UINT id) +{ + ICMP_HEADER *icmp; + void *data_buf; + BUF *ret; + // Validate arguments + if (src_ip == NULL || dest_ip == NULL || data == NULL) + { + return NULL; + } + + // Assemble the header + icmp = ZeroMalloc(sizeof(ICMP_HEADER) + size); + data_buf = ((UCHAR *)icmp) + sizeof(ICMP_HEADER); + Copy(data_buf, data, size); + + icmp->Type = type; + icmp->Code = code; + icmp->Checksum = CalcChecksumForIPv6(src_ip, dest_ip, IP_PROTO_ICMPV6, icmp, + sizeof(ICMP_HEADER) + size, 0); + + ret = BuildIPv6(dest_ip, src_ip, id, IP_PROTO_ICMPV6, hop_limit, icmp, + sizeof(ICMP_HEADER) + size); + + Free(icmp); + + return ret; +} + +// Build an ICMPv6 Neighbor Solicitation packet +BUF *BuildICMPv6NeighborSoliciation(IPV6_ADDR *src_ip, IPV6_ADDR *target_ip, UCHAR *my_mac_address, UINT id) +{ + ICMPV6_OPTION_LIST opt; + ICMPV6_OPTION_LINK_LAYER link; + ICMPV6_NEIGHBOR_SOLICIATION_HEADER header; + BUF *b; + BUF *b2; + BUF *ret; + // Validate arguments + if (src_ip == NULL || target_ip == NULL || my_mac_address == NULL) + { + return NULL; + } + + Zero(&link, sizeof(link)); + Copy(link.Address, my_mac_address, 6); + + Zero(&opt, sizeof(opt)); + opt.SourceLinkLayer = &link; + + b = BuildICMPv6Options(&opt); + + Zero(&header, sizeof(header)); + Copy(&header.TargetAddress, target_ip, sizeof(IPV6_ADDR)); + + b2 = NewBuf(); + + WriteBuf(b2, &header, sizeof(header)); + WriteBufBuf(b2, b); + + ret = BuildICMPv6(src_ip, target_ip, 255, + ICMPV6_TYPE_NEIGHBOR_SOLICIATION, 0, b2->Buf, b2->Size, id); + + FreeBuf(b); + FreeBuf(b2); + + return ret; +} + +BUF *BuildICMPv6RouterSoliciation(IPV6_ADDR *src_ip, IPV6_ADDR *target_ip, UCHAR *my_mac_address, UINT id) +{ + ICMPV6_OPTION_LIST opt; + ICMPV6_OPTION_LINK_LAYER link; + ICMPV6_ROUTER_SOLICIATION_HEADER header; + BUF *b; + BUF *b2; + BUF *ret; + + if (src_ip == NULL || target_ip == NULL || my_mac_address == NULL) + { + return NULL; + } + + Zero(&link, sizeof(link)); + Copy(link.Address, my_mac_address, 6); + + Zero(&opt, sizeof(opt)); + opt.SourceLinkLayer = &link; + + b = BuildICMPv6Options(&opt); + + Zero(&header, sizeof(header)); + + b2 = NewBuf(); + + WriteBuf(b2, &header, sizeof(header)); + WriteBufBuf(b2, b); + + ret = BuildICMPv6(src_ip, target_ip, 255, + ICMPV6_TYPE_ROUTER_SOLICIATION, 0, b2->Buf, b2->Size, id); + + FreeBuf(b); + FreeBuf(b2); + + return ret; +} + +// Get the next header number from the queue +UCHAR IPv6GetNextHeaderFromQueue(QUEUE *q) +{ + UINT *p; + UCHAR v = 0; + // Validate arguments + if (q == NULL) + { + return IPV6_HEADER_NONE; + } + + p = (UINT *)GetNext(q); + if (p != NULL) + { + v = (UCHAR)(*p); + Free(p); + } + + return v; +} + +// Add an IPv6 extension header option (variable length) +void BuildAndAddIPv6PacketOptionHeader(BUF *b, IPV6_OPTION_HEADER *opt, UCHAR next_header, UINT size) +{ + IPV6_OPTION_HEADER *h; + UINT total_size; + // Validate arguments + if (b == NULL || opt == NULL) + { + return; + } + + total_size = size; + if ((total_size % 8) != 0) + { + total_size = ((total_size / 8) + 1) * 8; + } + + h = ZeroMalloc(total_size); + Copy(h, opt, size); + h->Size = (total_size / 8) - 1; + h->NextHeader = next_header; + + WriteBuf(b, h, total_size); + + Free(h); +} + +// Build an IPv6 packet +BUF *BuildIPv6(IPV6_ADDR *dest_ip, IPV6_ADDR *src_ip, UINT id, UCHAR protocol, UCHAR hop_limit, void *data, + UINT size) +{ + IPV6_HEADER_PACKET_INFO info; + IPV6_HEADER ip_header; + BUF *buf; + UINT size_for_headers; + // Validate arguments + if (dest_ip == NULL || src_ip == NULL || data == NULL) + { + return NULL; + } + if (hop_limit == 0) + { + hop_limit = 255; + } + + // IPv6 header + Zero(&ip_header, sizeof(ip_header)); + IPV6_SET_VERSION(&ip_header, 6); + ip_header.HopLimit = hop_limit; + Copy(&ip_header.SrcAddress, src_ip, sizeof(IPV6_ADDR)); + Copy(&ip_header.DestAddress, dest_ip, sizeof(IPV6_ADDR)); + + // Arrangement of the packet header information + Zero(&info, sizeof(info)); + info.IPv6Header = &ip_header; + info.Protocol = protocol; + info.Payload = data; + info.PayloadSize = size; + + buf = BuildIPv6PacketHeader(&info, &size_for_headers); + if (buf == NULL) + { + return NULL; + } + + return buf; +} + +// Build the IPv6 packet header section +BUF *BuildIPv6PacketHeader(IPV6_HEADER_PACKET_INFO *info, UINT *bytes_before_payload) +{ + BUF *b; + QUEUE *q; + UINT bbp = 0; + // Validate arguments + if (info == NULL) + { + return NULL; + } + + b = NewBuf(); + q = NewQueueFast(); + + // Create the list of options headers + if (info->HopHeader != NULL) + { + InsertQueueInt(q, IPV6_HEADER_HOP); + } + if (info->EndPointHeader != NULL) + { + InsertQueueInt(q, IPV6_HEADER_ENDPOINT); + } + if (info->RoutingHeader != NULL) + { + InsertQueueInt(q, IPV6_HEADER_ROUTING); + } + if (info->FragmentHeader != NULL) + { + InsertQueueInt(q, IPV6_HEADER_FRAGMENT); + } + InsertQueueInt(q, info->Protocol); + + // IPv6 header + info->IPv6Header->NextHeader = IPv6GetNextHeaderFromQueue(q); + WriteBuf(b, info->IPv6Header, sizeof(IPV6_HEADER)); + + // Hop-by-hop option header + if (info->HopHeader != NULL) + { + BuildAndAddIPv6PacketOptionHeader(b, info->HopHeader, + IPv6GetNextHeaderFromQueue(q), info->HopHeaderSize); + } + + // End point option header + if (info->EndPointHeader != NULL) + { + BuildAndAddIPv6PacketOptionHeader(b, info->EndPointHeader, + IPv6GetNextHeaderFromQueue(q), info->EndPointHeaderSize); + } + + // Routing header + if (info->RoutingHeader != NULL) + { + BuildAndAddIPv6PacketOptionHeader(b, info->RoutingHeader, + IPv6GetNextHeaderFromQueue(q), info->RoutingHeaderSize); + } + + // Fragment header + if (info->FragmentHeader != NULL) + { + info->FragmentHeader->NextHeader = IPv6GetNextHeaderFromQueue(q); + WriteBuf(b, info->FragmentHeader, sizeof(IPV6_FRAGMENT_HEADER)); + } + + bbp = b->Size; + if (info->FragmentHeader == NULL) + { + bbp += sizeof(IPV6_FRAGMENT_HEADER); + } + + // Payload + if (info->Protocol != IPV6_HEADER_NONE) + { + WriteBuf(b, info->Payload, info->PayloadSize); + } + + ReleaseQueue(q); + + SeekBuf(b, 0, 0); + + // Payload length + ((IPV6_HEADER *)b->Buf)->PayloadLength = Endian16(b->Size - (USHORT)sizeof(IPV6_HEADER)); + + if (bytes_before_payload != NULL) + { + // Calculate the length just before the payload + // (by assuming fragment header is always included) + *bytes_before_payload = bbp; + } + + return b; +} + +// Build the option values of an ICMPv6 packet +void BuildICMPv6OptionValue(BUF *b, UCHAR type, void *header_pointer, UINT total_size) +{ + UINT packet_size; + UCHAR *packet; + ICMPV6_OPTION *opt; + // Validate arguments + if (b == NULL || header_pointer == NULL) + { + return; + } + + packet_size = ((total_size + 7) / 8) * 8; + packet = ZeroMalloc(packet_size); + + Copy(packet, header_pointer, total_size); + opt = (ICMPV6_OPTION *)packet; + opt->Length = (UCHAR)(packet_size / 8); + opt->Type = type; + + WriteBuf(b, packet, packet_size); + + Free(packet); +} + +// Build the options of the ICMPv6 packet +BUF *BuildICMPv6Options(ICMPV6_OPTION_LIST *o) +{ + BUF *b; + UINT i; + // Validate arguments + if (o == NULL) + { + return NULL; + } + + b = NewBuf(); + + if (o->SourceLinkLayer != NULL) + { + BuildICMPv6OptionValue(b, ICMPV6_OPTION_TYPE_SOURCE_LINK_LAYER, o->SourceLinkLayer, sizeof(ICMPV6_OPTION_LINK_LAYER)); + } + if (o->TargetLinkLayer != NULL) + { + BuildICMPv6OptionValue(b, ICMPV6_OPTION_TYPE_TARGET_LINK_LAYER, o->TargetLinkLayer, sizeof(ICMPV6_OPTION_LINK_LAYER)); + } + for (i = 0; i < ICMPV6_OPTION_PREFIXES_MAX_COUNT; i++) + { + if (o->Prefix[i] != NULL) + { + BuildICMPv6OptionValue(b, ICMPV6_OPTION_TYPE_PREFIX, o->Prefix[i], sizeof(ICMPV6_OPTION_PREFIX)); + } + else + { + break; + } + } + if (o->Mtu != NULL) + { + BuildICMPv6OptionValue(b, ICMPV6_OPTION_TYPE_MTU, o->Mtu, sizeof(ICMPV6_OPTION_MTU)); + } + + SeekBuf(b, 0, 0); + + return b; +} + +// Checksum calculation (IPv4) +USHORT CalcChecksumForIPv4(UINT src_ip, UINT dst_ip, UCHAR protocol, void *data, UINT size, UINT real_size) +{ + UCHAR *tmp; + UINT tmp_size; + IPV4_PSEUDO_HEADER *ph; + USHORT ret; + bool use_free = false; + UCHAR tmp_buffer[1600]; + // Validate arguments + if (data == NULL && size != 0) + { + return 0; + } + + if (real_size == 0) + { + real_size = size; + } + + if (real_size == INFINITE) + { + real_size = 0; + } + + tmp_size = size + sizeof(IPV4_PSEUDO_HEADER); + + if (tmp_size > sizeof(tmp_buffer)) + { + tmp = Malloc(tmp_size); + + use_free = true; + } + else + { + tmp = tmp_buffer; + } + + ph = (IPV4_PSEUDO_HEADER *)tmp; + ph->SrcIP = src_ip; + ph->DstIP = dst_ip; + ph->PacketLength = Endian16(real_size); + ph->Protocol = protocol; + ph->Reserved = 0; + + if (size >= 1) + { + Copy(((UCHAR *)tmp) + sizeof(IPV4_PSEUDO_HEADER), data, size); + } + + ret = IpChecksum(tmp, tmp_size); + + if (use_free) + { + Free(tmp); + } + + return ret; +} + +// Checksum calculation (IPv6) +USHORT CalcChecksumForIPv6(IPV6_ADDR *src_ip, IPV6_ADDR *dest_ip, UCHAR protocol, void *data, UINT size, UINT real_size) +{ + UCHAR *tmp; + UINT tmp_size; + IPV6_PSEUDO_HEADER *ph; + USHORT ret; + bool use_free = false; + UCHAR tmp_buffer[256]; + // Validate arguments + if (data == NULL && size != 0) + { + return 0; + } + + if (real_size == 0) + { + real_size = size; + } + + if (real_size == INFINITE) + { + real_size = 0; + } + + tmp_size = size + sizeof(IPV6_PSEUDO_HEADER); + + if (tmp_size > sizeof(tmp_buffer)) + { + tmp = Malloc(tmp_size); + + use_free = true; + } + else + { + tmp = tmp_buffer; + } + + ph = (IPV6_PSEUDO_HEADER *)tmp; + Zero(ph, sizeof(IPV6_PSEUDO_HEADER)); + Copy(&ph->SrcAddress, src_ip, sizeof(IPV6_ADDR)); + Copy(&ph->DestAddress, dest_ip, sizeof(IPV6_ADDR)); + ph->UpperLayerPacketSize = Endian32(real_size); + ph->NextHeader = protocol; + + Copy(((UCHAR *)tmp) + sizeof(IPV6_PSEUDO_HEADER), data, size); + + ret = IpChecksum(tmp, tmp_size); + + if (use_free) + { + Free(tmp); + } + + return ret; +} + +// Release the cloned packet +void FreeClonePacket(PKT *p) +{ + // Validate arguments + if (p == NULL) + { + return; + } + + Free(p->IPv6HeaderPacketInfo.IPv6Header); + Free(p->IPv6HeaderPacketInfo.HopHeader); + Free(p->IPv6HeaderPacketInfo.EndPointHeader); + Free(p->IPv6HeaderPacketInfo.RoutingHeader); + Free(p->IPv6HeaderPacketInfo.FragmentHeader); + Free(p->IPv6HeaderPacketInfo.Payload); + Free(p->ICMPv6HeaderPacketInfo.Data); + Free(p->ICMPv6HeaderPacketInfo.EchoData); + Free(p->ICMPv6HeaderPacketInfo.Headers.HeaderPointer); + FreeCloneICMPv6Options(&p->ICMPv6HeaderPacketInfo.OptionList); + Free(p->L3.PointerL3); + Free(p->L4.PointerL4); + Free(p->L7.PointerL7); + Free(p->PacketData); + Free(p->MacHeader); + Free(p->HttpLog); + Free(p); +} + +// Copy the packet header +PKT *ClonePacket(PKT *p, bool copy_data) +{ + PKT *ret; + // Validate arguments + if (p == NULL) + { + return NULL; + } + + ret = ZeroMallocFast(sizeof(PKT)); + ret->PacketSize = p->PacketSize; + + // Copy of the MAC header + ret->MacHeader = MallocFast(sizeof(MAC_HEADER)); + Copy(ret->MacHeader, p->MacHeader, sizeof(MAC_HEADER)); + + // Copy of the MAC flag + ret->BroadcastPacket = p->BroadcastPacket; + ret->InvalidSourcePacket = p->InvalidSourcePacket; + + // Copy of the IPv6 related structure + Copy(&ret->IPv6HeaderPacketInfo, &p->IPv6HeaderPacketInfo, sizeof(IPV6_HEADER_PACKET_INFO)); + Copy(&ret->ICMPv6HeaderPacketInfo, &p->ICMPv6HeaderPacketInfo, sizeof(ICMPV6_HEADER_INFO)); + + // Layer 3 + ret->TypeL3 = p->TypeL3; + switch (ret->TypeL3) + { + case L3_ARPV4: + // ARP packet + ret->L3.ARPv4Header = MallocFast(sizeof(ARPV4_HEADER)); + Copy(ret->L3.ARPv4Header, p->L3.ARPv4Header, sizeof(ARPV4_HEADER)); + break; + + case L3_IPV4: + // IPv4 packet + ret->L3.IPv4Header = MallocFast(sizeof(IPV4_HEADER)); + Copy(ret->L3.IPv4Header, p->L3.IPv4Header, sizeof(IPV4_HEADER)); + break; + + case L3_IPV6: + // IPv6 packet + ret->L3.IPv6Header = MallocFast(sizeof(IPV6_HEADER)); + Copy(ret->L3.IPv6Header, p->L3.IPv6Header, sizeof(IPV6_HEADER)); + + ret->IPv6HeaderPacketInfo.IPv6Header = Clone(p->IPv6HeaderPacketInfo.IPv6Header, + sizeof(IPV6_HEADER)); + + ret->IPv6HeaderPacketInfo.HopHeader = Clone(p->IPv6HeaderPacketInfo.HopHeader, + sizeof(IPV6_OPTION_HEADER)); + + ret->IPv6HeaderPacketInfo.EndPointHeader = Clone(p->IPv6HeaderPacketInfo.EndPointHeader, + sizeof(IPV6_OPTION_HEADER)); + + ret->IPv6HeaderPacketInfo.RoutingHeader = Clone(p->IPv6HeaderPacketInfo.RoutingHeader, + sizeof(IPV6_OPTION_HEADER)); + + ret->IPv6HeaderPacketInfo.FragmentHeader = Clone(p->IPv6HeaderPacketInfo.FragmentHeader, + sizeof(IPV6_FRAGMENT_HEADER)); + + ret->IPv6HeaderPacketInfo.Payload = Clone(p->IPv6HeaderPacketInfo.Payload, + p->IPv6HeaderPacketInfo.PayloadSize); + break; + } + + // Layer 4 + ret->TypeL4 = p->TypeL4; + switch (ret->TypeL4) + { + case L4_ICMPV4: + // ICMPv4 packet + ret->L4.ICMPHeader = MallocFast(sizeof(ICMP_HEADER)); + Copy(ret->L4.ICMPHeader, p->L4.ICMPHeader, sizeof(ICMP_HEADER)); + break; + + case L4_ICMPV6: + // ICMPv6 packet + ret->L4.ICMPHeader = MallocFast(sizeof(ICMP_HEADER)); + Copy(ret->L4.ICMPHeader, p->L4.ICMPHeader, sizeof(ICMP_HEADER)); + + ret->ICMPv6HeaderPacketInfo.Data = Clone(p->ICMPv6HeaderPacketInfo.Data, + p->ICMPv6HeaderPacketInfo.DataSize); + + ret->ICMPv6HeaderPacketInfo.EchoData = Clone(p->ICMPv6HeaderPacketInfo.EchoData, + p->ICMPv6HeaderPacketInfo.EchoDataSize); + + switch (ret->ICMPv6HeaderPacketInfo.Type) + { + case ICMPV6_TYPE_ECHO_REQUEST: + case ICMPV6_TYPE_ECHO_RESPONSE: + break; + + case ICMPV6_TYPE_ROUTER_SOLICIATION: + ret->ICMPv6HeaderPacketInfo.Headers.RouterSoliciationHeader = + Clone(p->ICMPv6HeaderPacketInfo.Headers.RouterSoliciationHeader, + sizeof(ICMPV6_ROUTER_SOLICIATION_HEADER)); + break; + + case ICMPV6_TYPE_ROUTER_ADVERTISEMENT: + ret->ICMPv6HeaderPacketInfo.Headers.RouterAdvertisementHeader = + Clone(p->ICMPv6HeaderPacketInfo.Headers.RouterAdvertisementHeader, + sizeof(ICMPV6_ROUTER_ADVERTISEMENT_HEADER)); + break; + + case ICMPV6_TYPE_NEIGHBOR_SOLICIATION: + ret->ICMPv6HeaderPacketInfo.Headers.NeighborSoliciationHeader = + Clone(p->ICMPv6HeaderPacketInfo.Headers.NeighborSoliciationHeader, + sizeof(ICMPV6_NEIGHBOR_SOLICIATION_HEADER)); + break; + + case ICMPV6_TYPE_NEIGHBOR_ADVERTISEMENT: + ret->ICMPv6HeaderPacketInfo.Headers.NeighborAdvertisementHeader = + Clone(p->ICMPv6HeaderPacketInfo.Headers.NeighborAdvertisementHeader, + sizeof(ICMPV6_NEIGHBOR_ADVERTISEMENT_HEADER)); + break; + } + + CloneICMPv6Options(&ret->ICMPv6HeaderPacketInfo.OptionList, + &p->ICMPv6HeaderPacketInfo.OptionList); + break; + + case L4_TCP: + // TCP packet + ret->L4.TCPHeader = MallocFast(sizeof(TCP_HEADER)); + Copy(ret->L4.TCPHeader, p->L4.TCPHeader, sizeof(TCP_HEADER)); + break; + + case L4_UDP: + // UDP packet + ret->L4.UDPHeader = MallocFast(sizeof(UDP_HEADER)); + Copy(ret->L4.UDPHeader, p->L4.UDPHeader, sizeof(UDP_HEADER)); + break; + } + + // Layer 7 + ret->TypeL7 = p->TypeL7; + switch (ret->TypeL7) + { + case L7_DHCPV4: + // DHCP packet + ret->L7.DHCPv4Header = MallocFast(sizeof(DHCPV4_HEADER)); + Copy(ret->L7.DHCPv4Header, p->L7.DHCPv4Header, sizeof(DHCPV4_HEADER)); + break; + + case L7_IKECONN: + // IKE packet + ret->L7.IkeHeader = MallocFast(sizeof(IKE_HEADER)); + Copy(ret->L7.IkeHeader, p->L7.IkeHeader, sizeof(IKE_HEADER)); + break; + + case L7_DNS: + StrCpy(ret->DnsQueryHost, sizeof(ret->DnsQueryHost), p->DnsQueryHost); + break; + } + + // Address data + ret->MacAddressSrc = ret->MacHeader->SrcAddress; + ret->MacAddressDest = ret->MacHeader->DestAddress; + + if (copy_data) + { + // Copy also the packet body + ret->PacketData = MallocFast(p->PacketSize); + Copy(ret->PacketData, p->PacketData, p->PacketSize); + } + + if (p->HttpLog != NULL) + { + ret->HttpLog = Clone(p->HttpLog, sizeof(HTTPLOG)); + } + + return ret; +} + +// Parse the packet but without data layer except for ICMP +PKT *ParsePacketUpToICMPv6(UCHAR *buf, UINT size) +{ + return ParsePacketEx5(buf, size, false, 0, true, true, false, true); +} + +// Parse the contents of the packet +PKT *ParsePacket(UCHAR *buf, UINT size) +{ + return ParsePacketEx(buf, size, false); +} +PKT *ParsePacketEx(UCHAR *buf, UINT size, bool no_l3) +{ + return ParsePacketEx2(buf, size, no_l3, 0); +} +PKT *ParsePacketEx2(UCHAR *buf, UINT size, bool no_l3, UINT vlan_type_id) +{ + return ParsePacketEx3(buf, size, no_l3, vlan_type_id, true); +} +PKT *ParsePacketEx3(UCHAR *buf, UINT size, bool no_l3, UINT vlan_type_id, bool bridge_id_as_mac_address) +{ + return ParsePacketEx4(buf, size, no_l3, vlan_type_id, bridge_id_as_mac_address, false, false); +} +PKT *ParsePacketEx4(UCHAR *buf, UINT size, bool no_l3, UINT vlan_type_id, bool bridge_id_as_mac_address, bool no_http, bool correct_checksum) +{ + return ParsePacketEx5(buf, size, no_l3, vlan_type_id, bridge_id_as_mac_address, no_http, correct_checksum, false); +} +PKT *ParsePacketEx5(UCHAR *buf, UINT size, bool no_l3, UINT vlan_type_id, bool bridge_id_as_mac_address, bool no_http, bool correct_checksum, bool no_l3_l4_except_icmpv6) +{ + PKT *p; + USHORT vlan_type_id_16; + // Validate arguments + if (buf == NULL || size == 0) + { + return NULL; + } + + if (vlan_type_id == 0) + { + vlan_type_id = MAC_PROTO_TAGVLAN; + } + + vlan_type_id_16 = Endian16((USHORT)vlan_type_id); + + p = ZeroMallocFast(sizeof(PKT)); + + p->VlanTypeID = vlan_type_id; + + // If there is garbage after the payload in IPv4 and IPv6 packets, eliminate it + if (size >= 24) + { + if (buf[12] == 0x08 && buf[13] == 0x00) + { + USHORT ip_total_size2 = READ_USHORT(&buf[16]); + UINT mac_packet_size; + + if (ip_total_size2 >= 1) + { + mac_packet_size = (UINT)ip_total_size2 + 14; + + if (size > mac_packet_size) + { + size = mac_packet_size; + } + } + } + else if (buf[12] == 0x86 && buf[13] == 0xdd) + { + USHORT ip_payload_size_2 = READ_USHORT(&buf[18]); + UINT mac_packet_size; + + if (ip_payload_size_2 >= 1) + { + mac_packet_size = (UINT)ip_payload_size_2 + 14 + 40; + + if (size > mac_packet_size) + { + size = mac_packet_size; + } + } + } + else if (buf[12] == ((UCHAR *)&vlan_type_id_16)[0] && buf[13] == ((UCHAR *)&vlan_type_id_16)[1]) + { + if (buf[16] == 0x08 && buf[17] == 0x00) + { + USHORT ip_total_size2 = READ_USHORT(&buf[20]); + UINT mac_packet_size; + + if (ip_total_size2 >= 1) + { + mac_packet_size = (UINT)ip_total_size2 + 14 + 4; + + if (size > mac_packet_size) + { + size = mac_packet_size; + } + } + } + else if (buf[16] == 0x86 && buf[17] == 0xdd) + { + USHORT ip_payload_size_2 = READ_USHORT(&buf[22]); + UINT mac_packet_size; + + if (ip_payload_size_2 >= 1) + { + mac_packet_size = (UINT)ip_payload_size_2 + 14 + 40 + 4; + + if (size > mac_packet_size) + { + size = mac_packet_size; + } + } + } + } + } + + // Do parse + if (ParsePacketL2Ex(p, buf, size, no_l3, no_l3_l4_except_icmpv6) == false) + { + // Parsing failure + FreePacket(p); + return NULL; + } + + p->PacketData = buf; + p->PacketSize = size; + + p->MacAddressSrc = p->MacHeader->SrcAddress; + p->MacAddressDest = p->MacHeader->DestAddress; + + if (bridge_id_as_mac_address) + { + if (p->TypeL3 == L3_BPDU) + { + if (p->L3.BpduHeader != NULL) + { + p->MacAddressSrc = p->L3.BpduHeader->BridgeMacAddress; + } + } + } + + if (no_http == false) + { + USHORT port_raw = Endian16(80); + USHORT port_raw2 = Endian16(8080); + USHORT port_raw3 = Endian16(443); + USHORT port_raw4 = Endian16(3128); + + // Analyze if the packet is a part of HTTP + if ((p->TypeL3 == L3_IPV4 || p->TypeL3 == L3_IPV6) && p->TypeL4 == L4_TCP) + { + TCP_HEADER *tcp = p->L4.TCPHeader; + if (tcp != NULL && (tcp->DstPort == port_raw || tcp->DstPort == port_raw2 || tcp->DstPort == port_raw4) && + (!((tcp->Flag & TCP_SYN) || (tcp->Flag & TCP_RST) || (tcp->Flag & TCP_FIN)))) + { + if (p->PayloadSize >= 1) + { + p->HttpLog = ParseHttpAccessLog(p); + } + } + if (tcp != NULL && tcp->DstPort == port_raw3 && + (!((tcp->Flag & TCP_SYN) || (tcp->Flag & TCP_RST) || (tcp->Flag & TCP_FIN)))) + { + if (p->PayloadSize >= 1) + { + p->HttpLog = ParseHttpsAccessLog(p); + } + } + } + } + + if (p->TypeL3 == L3_IPV4 && p->TypeL4 == L4_UDP && p->TypeL7 == L7_DHCPV4) + { + // Get the DHCP opcode + DHCPV4_DATA *d = ParseDHCPv4Data(p); + + if (d != NULL) + { + p->DhcpOpCode = d->OpCode; + + FreeDHCPv4Data(d); + } + } + + if (correct_checksum) + { + // Correct the checksum of the UDP, IP and TCP + CorrectChecksum(p); + } + + // Parsing success + return p; +} + +// Correct the checksum (store the correct value in the header by recalculating the checksum which is by off-load processing) +void CorrectChecksum(PKT *p) +{ + // Validate arguments + if (p == NULL) + { + return; + } + + if (p->TypeL3 == L3_IPV4) + { + IPV4_HEADER *v4 = p->L3.IPv4Header; + + if (v4 != NULL) + { + if (v4->Checksum == 0x0000) + { + v4->Checksum = IpChecksum(v4, IPV4_GET_HEADER_LEN(v4) * 4); + } + + if (p->TypeL4 == L4_TCP) + { + // Recalculate the TCP checksum + if (IPV4_GET_OFFSET(v4) == 0 && (IPV4_GET_FLAGS(v4) & 0x01) == 0) + { + // TCP checksuming doesn't target fragmented IP packets + TCP_HEADER *tcp = p->L4.TCPHeader; + + if (tcp != NULL) + { + USHORT tcp_offloading_checksum1 = CalcChecksumForIPv4(v4->SrcIP, v4->DstIP, IP_PROTO_TCP, NULL, 0, p->IPv4PayloadSize); + USHORT tcp_offloading_checksum2 = ~tcp_offloading_checksum1; + + if (tcp->Checksum == 0 || tcp->Checksum == tcp_offloading_checksum1 || tcp->Checksum == tcp_offloading_checksum2) + { + tcp->Checksum = 0; + tcp->Checksum = CalcChecksumForIPv4(v4->SrcIP, v4->DstIP, IP_PROTO_TCP, tcp, p->IPv4PayloadSize, 0); + } + } + } + } + + if (p->TypeL4 == L4_UDP) + { + // Recalculation of the UDP checksum + if (IPV4_GET_OFFSET(v4) == 0 || (IPV4_GET_FLAGS(v4) & 0x01) == 0) + { + // If it is not divided, or it is divided but it is the first fragment of the UDP packet + UDP_HEADER *udp = p->L4.UDPHeader; + + if (udp != NULL && udp->Checksum != 0) + { + USHORT udp_len = Endian16(udp->PacketLength); + USHORT udp_offloading_checksum1 = CalcChecksumForIPv4(v4->SrcIP, v4->DstIP, IP_PROTO_UDP, NULL, 0, udp_len); + USHORT udp_offloading_checksum2 = ~udp_offloading_checksum1; + + if (udp->Checksum == udp_offloading_checksum1 || udp->Checksum == udp_offloading_checksum2) + { + udp->Checksum = 0; + + if ((IPV4_GET_FLAGS(v4) & 0x01) == 0 && (p->IPv4PayloadSize >= udp_len)) + { + // Calculate the checksum correctly based on the data in case of a non-fragmented packet + udp->Checksum = CalcChecksumForIPv4(v4->SrcIP, v4->DstIP, IP_PROTO_UDP, udp, udp_len, 0); + } + else + { + // In case of the first fragment of the packet, set the checksum to 0 + // because there isn't entire data of the packet + udp->Checksum = 0; + } + } + } + } + } + } + } + else if (p->TypeL3 == L3_IPV6) + { + IPV6_HEADER *v6 = p->L3.IPv6Header; + IPV6_HEADER_PACKET_INFO *v6info = &p->IPv6HeaderPacketInfo; + + if (v6 != NULL) + { + if (p->TypeL4 == L4_TCP) + { + // Recalculate the TCP checksum + if (v6info->IsFragment == false) + { + if (v6info->FragmentHeader == NULL || ((IPV6_GET_FLAGS(v6info->FragmentHeader) & IPV6_FRAGMENT_HEADER_FLAG_MORE_FRAGMENTS) == 0)) + { + // TCP checksuming doesn't target fragmented packets + TCP_HEADER *tcp = p->L4.TCPHeader; + + if (tcp != NULL) + { + USHORT tcp_offloading_checksum1 = CalcChecksumForIPv6(&v6->SrcAddress, &v6->DestAddress, IP_PROTO_TCP, NULL, 0, v6info->PayloadSize); + USHORT tcp_offloading_checksum2 = ~tcp_offloading_checksum1; + + if (tcp->Checksum == 0 || tcp->Checksum == tcp_offloading_checksum1 || tcp->Checksum == tcp_offloading_checksum2) + { + tcp->Checksum = 0; + tcp->Checksum = CalcChecksumForIPv6(&v6->SrcAddress, &v6->DestAddress, IP_PROTO_TCP, tcp, v6info->PayloadSize, 0); + } + } + } + } + } + else if (p->TypeL4 == L4_UDP) + { + // Recalculation of the UDP checksum + if (v6info->IsFragment == false) + { + UDP_HEADER *udp = p->L4.UDPHeader; + + if (udp != NULL && udp->Checksum != 0) + { + USHORT udp_len = Endian16(udp->PacketLength); + USHORT udp_offloading_checksum1 = CalcChecksumForIPv6(&v6->SrcAddress, &v6->DestAddress, IP_PROTO_UDP, NULL, 0, udp_len); + USHORT udp_offloading_checksum2 = ~udp_offloading_checksum1; + + if (udp->Checksum == 0 || udp->Checksum == udp_offloading_checksum1 || udp->Checksum == udp_offloading_checksum2) + { + udp->Checksum = 0; + + if ((v6info->FragmentHeader == NULL || ((IPV6_GET_FLAGS(v6info->FragmentHeader) & IPV6_FRAGMENT_HEADER_FLAG_MORE_FRAGMENTS) == 0)) && (v6info->PayloadSize >= udp_len)) + { + // If the packet is not fragmented, recalculate the checksum + udp->Checksum = CalcChecksumForIPv6(&v6->SrcAddress, &v6->DestAddress, IP_PROTO_UDP, udp, udp_len, 0); + } + else + { + // Don't do (can't do) anything in the case of fragmented packet + } + } + } + } + } + } + } +} + + +// Parse the HTTPS access log +HTTPLOG *ParseHttpsAccessLog(PKT *pkt) +{ + HTTPLOG h; + char sni[MAX_PATH]; + // Validate arguments + if (pkt == NULL) + { + return NULL; + } + + if (GetSniNameFromSslPacket(pkt->Payload, pkt->PayloadSize, sni, sizeof(sni)) == false) + { + return NULL; + } + + Zero(&h, sizeof(h)); + + StrCpy(h.Method, sizeof(h.Method), "SSL_Connect"); + StrCpy(h.Hostname, sizeof(h.Hostname), sni); + h.Port = Endian16(pkt->L4.TCPHeader->DstPort); + StrCpy(h.Path, sizeof(h.Path), "/"); + h.IsSsl = true; + + return Clone(&h, sizeof(h)); +} + +// Parse the HTTP access log +HTTPLOG *ParseHttpAccessLog(PKT *pkt) +{ + HTTPLOG h; + UCHAR *buf; + UINT size; + BUF *b; + char *line1; + bool ok = false; + // Validate arguments + if (pkt == NULL) + { + return NULL; + } + + buf = pkt->Payload; + size = pkt->PayloadSize; + + if (size <= 5) + { + return NULL; + } + + // Check whether it starts with the HTTP-specific string + if (CmpCaseIgnore(buf, "GET ", 4) != 0 && + CmpCaseIgnore(buf, "HEAD ", 5) != 0 && + CmpCaseIgnore(buf, "POST ", 5) != 0) + { + return NULL; + } + + Zero(&h, sizeof(h)); + + h.Port = Endian16(pkt->L4.TCPHeader->DstPort); + + b = NewBuf(); + WriteBuf(b, buf, size); + SeekBuf(b, 0, 0); + + line1 = CfgReadNextLine(b); + + if (line1 != NULL) + { + TOKEN_LIST *tokens = ParseToken(line1, " \t"); + if (tokens != NULL) + { + if (tokens->NumTokens == 3) + { + StrCpy(h.Method, sizeof(h.Hostname), tokens->Token[0]); + Trim(h.Method); + + StrCpy(h.Path, sizeof(h.Path), tokens->Token[1]); + Trim(h.Path); + + StrCpy(h.Protocol, sizeof(h.Protocol), tokens->Token[2]); + Trim(h.Protocol); + + StrUpper(h.Method); + + while (true) + { + char *line = CfgReadNextLine(b); + UINT i; + + if (line == NULL) + { + break; + } + + i = SearchStr(line, ":", 0); + if (i != INFINITE && i < (MAX_SIZE / 2)) + { + char name[MAX_SIZE]; + char value[MAX_SIZE]; + + StrCpy(name, sizeof(name), line); + name[i] = 0; + Trim(name); + + StrCpy(value, sizeof(value), line + i + 1); + Trim(value); + + if (StrCmpi(name, "host") == 0) + { + StrCpy(h.Hostname, sizeof(h.Hostname), value); + } + else if (StrCmpi(name, "referer") == 0) + { + StrCpy(h.Referer, sizeof(h.Referer), value); + } + else if (StrCmpi(name, "user-agent") == 0) + { + StrCpy(h.UserAgent, sizeof(h.UserAgent), value); + } + } + + Free(line); + } + + if (IsEmptyStr(h.Hostname) == false) + { + ok = true; + } + } + FreeToken(tokens); + } + } + + Free(line1); + FreeBuf(b); + + if (ok) + { + return Clone(&h, sizeof(h)); + } + else + { + return NULL; + } +} + + +// Layer-2 parsing +bool ParsePacketL2Ex(PKT *p, UCHAR *buf, UINT size, bool no_l3, bool no_l3_l4_except_icmpv6) +{ + UINT i; + bool b1, b2; + USHORT type_id_16; + // Validate arguments + if (p == NULL || buf == NULL) + { + return false; + } + + // Check the size + if (size < sizeof(MAC_HEADER)) + { + return false; + } + + // MAC header + p->MacHeader = (MAC_HEADER *)buf; + + buf += sizeof(MAC_HEADER); + size -= sizeof(MAC_HEADER); + + // Analysis of the MAC header + p->BroadcastPacket = true; + b1 = true; + b2 = true; + for (i = 0; i < 6; i++) + { + if (p->MacHeader->DestAddress[i] != 0xff) + { + p->BroadcastPacket = false; + } + if (p->MacHeader->SrcAddress[i] != 0xff) + { + b1 = false; + } + if (p->MacHeader->SrcAddress[i] != 0x00) + { + b2 = false; + } + } + if (b1 || b2 || (memcmp(p->MacHeader->SrcAddress, p->MacHeader->DestAddress, 6) == 0)) + { + p->InvalidSourcePacket = true; + } + else + { + p->InvalidSourcePacket = false; + } + + if (p->MacHeader->DestAddress[0] & 0x01) + { + p->BroadcastPacket = true; + } + + // Parse L3 packet + type_id_16 = Endian16(p->MacHeader->Protocol); + + if (type_id_16 > 1500) + { + // Ordinary Ethernet frame + switch (type_id_16) + { + case MAC_PROTO_ARPV4: // ARPv4 + if (no_l3 || no_l3_l4_except_icmpv6) + { + return true; + } + + return ParsePacketARPv4(p, buf, size); + + case MAC_PROTO_IPV4: // IPv4 + if (no_l3 || no_l3_l4_except_icmpv6) + { + return true; + } + + return ParsePacketIPv4(p, buf, size); + + case MAC_PROTO_IPV6: // IPv6 + if (no_l3) + { + return true; + } + + return ParsePacketIPv6(p, buf, size, no_l3_l4_except_icmpv6); + + default: // Unknown + if (type_id_16 == p->VlanTypeID) + { + // VLAN + return ParsePacketTAGVLAN(p, buf, size); + } + else + { + return true; + } + } + } + else + { + // Old IEEE 802.3 frame (payload length of the packet is written in the header) + // (It has been used in the BPDU, etc.) + UINT length = (UINT)type_id_16; + LLC_HEADER *llc; + + // Check whether the length is remaining + if (size < length || size < sizeof(LLC_HEADER)) + { + return true; + } + + // Read an LLC header + llc = (LLC_HEADER *)buf; + buf += sizeof(LLC_HEADER); + size -= sizeof(LLC_HEADER); + + // Determine the protocol by the value of DSAP and SSAP + if (llc->Dsap == LLC_DSAP_BPDU && llc->Ssap == LLC_SSAP_BPDU) + { + // This is a BPDU (Spanning Tree) + return ParsePacketBPDU(p, buf, size); + } + else + { + // Unknown protocol + return true; + } + } +} + +// TAG VLAN parsing +bool ParsePacketTAGVLAN(PKT *p, UCHAR *buf, UINT size) +{ + USHORT vlan_ushort; + // Validate arguments + if (p == NULL || buf == NULL) + { + return false; + } + + // Check the size + if (size < sizeof(TAGVLAN_HEADER)) + { + return false; + } + + // TAG VLAN header + p->L3.TagVlanHeader = (TAGVLAN_HEADER *)buf; + p->TypeL3 = L3_TAGVLAN; + + buf += sizeof(TAGVLAN_HEADER); + size -= sizeof(TAGVLAN_HEADER); + + vlan_ushort = READ_USHORT(p->L3.TagVlanHeader->Data); + vlan_ushort = vlan_ushort & 0xFFF; + + p->VlanId = vlan_ushort; + + return true; +} + +// BPDU Parsing +bool ParsePacketBPDU(PKT *p, UCHAR *buf, UINT size) +{ + // Validate arguments + if (p == NULL || buf == NULL) + { + return false; + } + + // Check the size + if (size < sizeof(BPDU_HEADER)) + { + return true; + } + + // BPDU header + p->L3.BpduHeader = (BPDU_HEADER *)buf; + p->TypeL3 = L3_BPDU; + + buf += sizeof(BPDU_HEADER); + size -= sizeof(BPDU_HEADER); + + return true; +} + +// ARPv4 Parsing +bool ParsePacketARPv4(PKT *p, UCHAR *buf, UINT size) +{ + // Validate arguments + if (p == NULL || buf == NULL) + { + return false; + } + + // Check the size + if (size < sizeof(ARPV4_HEADER)) + { + return false; + } + + // ARPv4 header + p->L3.ARPv4Header = (ARPV4_HEADER *)buf; + p->TypeL3 = L3_ARPV4; + + buf += sizeof(ARPV4_HEADER); + size -= sizeof(ARPV4_HEADER); + + return true; +} + +// Analysis of the IPv6 extension header +bool ParseIPv6ExtHeader(IPV6_HEADER_PACKET_INFO *info, UCHAR next_header, UCHAR *buf, UINT size) +{ + bool ret = false; + IPV6_OPTION_HEADER *option_header; + UINT option_header_size; + UCHAR next_header_2 = IPV6_HEADER_NONE; + // Validate arguments + if (info == NULL || buf == NULL) + { + return false; + } + + info->IsFragment = false; + + while (true) + { + if (size > 8) + { + next_header_2 = *((UCHAR *)buf); + } + + switch (next_header) + { + case IPV6_HEADER_HOP: + case IPV6_HEADER_ENDPOINT: + case IPV6_HEADER_ROUTING: + // Variable-length header + if (size < 8) + { + return false; + } + + option_header = (IPV6_OPTION_HEADER *)buf; + option_header_size = (option_header->Size + 1) * 8; + if (size < option_header_size) + { + return false; + } + + switch (next_header) + { + case IPV6_HEADER_HOP: + info->HopHeader = (IPV6_OPTION_HEADER *)buf; + info->HopHeaderSize = option_header_size; + break; + + case IPV6_HEADER_ENDPOINT: + info->EndPointHeader = (IPV6_OPTION_HEADER *)buf; + info->EndPointHeaderSize = option_header_size; + break; + + case IPV6_HEADER_ROUTING: + info->RoutingHeader = (IPV6_OPTION_HEADER *)buf; + info->RoutingHeaderSize = option_header_size; + break; + } + + buf += option_header_size; + size -= option_header_size; + break; + + case IPV6_HEADER_FRAGMENT: + // Fragment header (fixed length) + if (size < sizeof(IPV6_FRAGMENT_HEADER)) + { + return false; + } + + info->FragmentHeader = (IPV6_FRAGMENT_HEADER *)buf; + + if (IPV6_GET_FRAGMENT_OFFSET(info->FragmentHeader) != 0) + { + info->IsFragment = true; + } + + buf += sizeof(IPV6_FRAGMENT_HEADER); + size -= sizeof(IPV6_FRAGMENT_HEADER); + break; + + default: + // Considered that the payload follows + if (next_header != IPV6_HEADER_NONE) + { + info->Payload = buf; + info->PayloadSize = size; + } + else + { + info->Payload = NULL; + info->PayloadSize = 0; + } + info->Protocol = next_header; + return true; + } + + next_header = next_header_2; + } +} + +// Analysis of the IPv6 header +bool ParsePacketIPv6Header(IPV6_HEADER_PACKET_INFO *info, UCHAR *buf, UINT size) +{ + // Validate arguments + if (info == NULL || buf == NULL) + { + Zero(info, sizeof(IPV6_HEADER_PACKET_INFO)); + return false; + } + + Zero(info, sizeof(IPV6_HEADER_PACKET_INFO)); + + // IPv6 header + if (size < sizeof(IPV6_HEADER)) + { + // Invalid size + return false; + } + + info->IPv6Header = (IPV6_HEADER *)buf; + buf += sizeof(IPV6_HEADER); + size -= sizeof(IPV6_HEADER); + + if (IPV6_GET_VERSION(info->IPv6Header) != 6) + { + // Invalid version + return false; + } + + // Analysis of the extension header + if (ParseIPv6ExtHeader(info, info->IPv6Header->NextHeader, buf, size) == false) + { + return false; + } + + // Record the header size + if (info->Payload != NULL) + { + info->TotalHeaderSize = (UINT)((UINT64)(info->Payload) - (UINT64)(info->IPv6Header)); + } + + return true; +} + +// Analyse the options of ICMPv6 packet +bool ParseICMPv6Options(ICMPV6_OPTION_LIST *o, UCHAR *buf, UINT size) +{ + // Validate arguments + if (o == NULL || buf == NULL) + { + return false; + } + + Zero(o, sizeof(ICMPV6_OPTION_LIST)); + + // Read the header part + while (true) + { + ICMPV6_OPTION *option_header; + UINT header_total_size; + UCHAR *header_pointer; + if (size < sizeof(ICMPV6_OPTION)) + { + // Size shortage + return true; + } + + option_header = (ICMPV6_OPTION *)buf; + // Calculate the entire header size + header_total_size = option_header->Length * 8; + if (header_total_size == 0) + { + // The size is zero + return true; + } + if (size < header_total_size) + { + // Size shortage + return true; + } + + header_pointer = buf; + buf += header_total_size; + size -= header_total_size; + + switch (option_header->Type) + { + case ICMPV6_OPTION_TYPE_SOURCE_LINK_LAYER: + case ICMPV6_OPTION_TYPE_TARGET_LINK_LAYER: + // Source or target link-layer option + if (header_total_size >= sizeof(ICMPV6_OPTION_LINK_LAYER)) + { + if (option_header->Type == ICMPV6_OPTION_TYPE_SOURCE_LINK_LAYER) + { + o->SourceLinkLayer = (ICMPV6_OPTION_LINK_LAYER *)header_pointer; + } + else + { + o->TargetLinkLayer = (ICMPV6_OPTION_LINK_LAYER *)header_pointer; + } + } + else + { + // ICMPv6 packet corruption? + return false; + } + break; + + case ICMPV6_OPTION_TYPE_PREFIX: + // Prefix Information + if (header_total_size >= sizeof(ICMPV6_OPTION_PREFIX)) + { + UINT i; + for (i = 0; i < ICMPV6_OPTION_PREFIXES_MAX_COUNT; i++) + { + if (o->Prefix[i] == NULL) + { + o->Prefix[i] = (ICMPV6_OPTION_PREFIX *)header_pointer; + break; + } + } + } + else + { + // ICMPv6 packet corruption? + } + break; + + case ICMPV6_OPTION_TYPE_MTU: + // MTU + if (header_total_size >= sizeof(ICMPV6_OPTION_MTU)) + { + o->Mtu = (ICMPV6_OPTION_MTU *)header_pointer; + } + else + { + // ICMPv6 packet corruption? + } + break; + } + } +} + +// ICMPv6 parsing +bool ParseICMPv6(PKT *p, UCHAR *buf, UINT size) +{ + ICMPV6_HEADER_INFO icmp_info; + ICMP_HEADER *icmp; + ICMP_ECHO *echo; + UINT msg_size; + // Validate arguments + if (p == NULL || buf == NULL) + { + return false; + } + + Zero(&icmp_info, sizeof(icmp_info)); + + if (size < sizeof(ICMP_HEADER)) + { + return false; + } + + icmp = (ICMP_HEADER *)buf; + p->L4.ICMPHeader = icmp; + + msg_size = size - sizeof(ICMP_HEADER); + + icmp_info.Type = icmp->Type; + icmp_info.Code = icmp->Code; + icmp_info.Data = ((UCHAR *)buf) + sizeof(ICMP_HEADER); + icmp_info.DataSize = msg_size; + + switch (icmp_info.Type) + { + case ICMPV6_TYPE_ECHO_REQUEST: + case ICMPV6_TYPE_ECHO_RESPONSE: + // ICMP Echo Request / Response + if (icmp_info.DataSize < sizeof(ICMP_ECHO)) + { + return false; + } + + echo = (ICMP_ECHO *)icmp_info.Data; + + icmp_info.EchoHeader.Identifier = Endian16(echo->Identifier); + icmp_info.EchoHeader.SeqNo = Endian16(echo->SeqNo); + icmp_info.EchoData = (UCHAR *)echo + sizeof(ICMP_ECHO); + icmp_info.EchoDataSize = icmp_info.DataSize - sizeof(ICMP_ECHO); + + break; + + case ICMPV6_TYPE_ROUTER_SOLICIATION: + // Router Solicitation + if (icmp_info.DataSize < sizeof(ICMPV6_ROUTER_SOLICIATION_HEADER)) + { + return false; + } + + icmp_info.Headers.RouterSoliciationHeader = + (ICMPV6_ROUTER_SOLICIATION_HEADER *)(((UCHAR *)icmp_info.Data)); + + if (ParseICMPv6Options(&icmp_info.OptionList, ((UCHAR *)icmp_info.Headers.HeaderPointer) + sizeof(ICMPV6_ROUTER_SOLICIATION_HEADER), + icmp_info.DataSize - sizeof(ICMPV6_ROUTER_SOLICIATION_HEADER)) == false) + { + return false; + } + + break; + + case ICMPV6_TYPE_ROUTER_ADVERTISEMENT: + // Router Advertisement + if (icmp_info.DataSize < sizeof(ICMPV6_ROUTER_ADVERTISEMENT_HEADER)) + { + return false; + } + + icmp_info.Headers.RouterAdvertisementHeader = + (ICMPV6_ROUTER_ADVERTISEMENT_HEADER *)(((UCHAR *)icmp_info.Data)); + + if (ParseICMPv6Options(&icmp_info.OptionList, ((UCHAR *)icmp_info.Headers.HeaderPointer) + sizeof(ICMPV6_ROUTER_ADVERTISEMENT_HEADER), + icmp_info.DataSize - sizeof(ICMPV6_ROUTER_ADVERTISEMENT_HEADER)) == false) + { + return false; + } + + break; + + case ICMPV6_TYPE_NEIGHBOR_SOLICIATION: + // Neighbor Solicitation + if (icmp_info.DataSize < sizeof(ICMPV6_NEIGHBOR_SOLICIATION_HEADER)) + { + return false; + } + + icmp_info.Headers.NeighborSoliciationHeader = + (ICMPV6_NEIGHBOR_SOLICIATION_HEADER *)(((UCHAR *)icmp_info.Data)); + + if (ParseICMPv6Options(&icmp_info.OptionList, ((UCHAR *)icmp_info.Headers.HeaderPointer) + sizeof(ICMPV6_NEIGHBOR_SOLICIATION_HEADER), + icmp_info.DataSize - sizeof(ICMPV6_NEIGHBOR_SOLICIATION_HEADER)) == false) + { + return false; + } + + break; + + case ICMPV6_TYPE_NEIGHBOR_ADVERTISEMENT: + // Neighbor Advertisement + if (icmp_info.DataSize < sizeof(ICMPV6_NEIGHBOR_ADVERTISEMENT_HEADER)) + { + return false; + } + + icmp_info.Headers.NeighborAdvertisementHeader = + (ICMPV6_NEIGHBOR_ADVERTISEMENT_HEADER *)(((UCHAR *)icmp_info.Data)); + + if (ParseICMPv6Options(&icmp_info.OptionList, ((UCHAR *)icmp_info.Headers.HeaderPointer) + sizeof(ICMPV6_NEIGHBOR_ADVERTISEMENT_HEADER), + icmp_info.DataSize - sizeof(ICMPV6_NEIGHBOR_ADVERTISEMENT_HEADER)) == false) + { + return false; + } + + break; + } + + p->TypeL4 = L4_ICMPV6; + Copy(&p->ICMPv6HeaderPacketInfo, &icmp_info, sizeof(ICMPV6_HEADER_INFO)); + + return true; +} + +// Release of the ICMPv6 options +void FreeCloneICMPv6Options(ICMPV6_OPTION_LIST *o) +{ + UINT i; + // Validate arguments + if (o == NULL) + { + return; + } + + Free(o->SourceLinkLayer); + Free(o->TargetLinkLayer); + + for (i = 0; i < ICMPV6_OPTION_PREFIXES_MAX_COUNT; i++) + { + Free(o->Prefix[i]); + o->Prefix[i] = NULL; + } + Free(o->Mtu); +} + +// Clone of the ICMPv6 options +void CloneICMPv6Options(ICMPV6_OPTION_LIST *dst, ICMPV6_OPTION_LIST *src) +{ + UINT i; + // Validate arguments + if (dst == NULL || src == NULL) + { + return; + } + + Zero(dst, sizeof(ICMPV6_OPTION_LIST)); + + dst->SourceLinkLayer = Clone(src->SourceLinkLayer, sizeof(ICMPV6_OPTION_LINK_LAYER)); + dst->TargetLinkLayer = Clone(src->TargetLinkLayer, sizeof(ICMPV6_OPTION_LINK_LAYER)); + for (i = 0; i < ICMPV6_OPTION_PREFIXES_MAX_COUNT; i++) + { + if (src->Prefix[i] != NULL) + { + dst->Prefix[i] = Clone(src->Prefix[i], sizeof(ICMPV6_OPTION_PREFIX)); + } + else + { + break; + } + } + dst->Mtu = Clone(src->Mtu, sizeof(ICMPV6_OPTION_MTU)); +} + +// IPv6 parsing +bool ParsePacketIPv6(PKT *p, UCHAR *buf, UINT size, bool no_l3_l4_except_icmpv6) +{ + // Validate arguments + if (p == NULL || buf == NULL) + { + return false; + } + + if (ParsePacketIPv6Header(&p->IPv6HeaderPacketInfo, buf, size) == false) + { + return false; + } + + p->TypeL3 = L3_IPV6; + p->L3.IPv6Header = p->IPv6HeaderPacketInfo.IPv6Header; + + if (p->IPv6HeaderPacketInfo.Payload == NULL) + { + // No payload + return true; + } + + buf = p->IPv6HeaderPacketInfo.Payload; + size = p->IPv6HeaderPacketInfo.PayloadSize; + + if (p->IPv6HeaderPacketInfo.IsFragment) + { + // This is a fragmented packet. Quit interpreting + p->TypeL4 = L4_FRAGMENT; + return true; + } + + // Parse a L4 packet + switch (p->IPv6HeaderPacketInfo.Protocol) + { + case IP_PROTO_ICMPV6: // ICMPv6 + if (ParseICMPv6(p, buf, size) == false) + { + // Returns true also if it fails to parse ICMPv6 + return true; + } + else + { + return true; + } + + case IP_PROTO_TCP: // TCP + if (no_l3_l4_except_icmpv6) + { + return true; + } + return ParseTCP(p, buf, size); + + case IP_PROTO_UDP: // UDP + if (no_l3_l4_except_icmpv6) + { + return true; + } + return ParseUDP(p, buf, size); + + default: // Unknown + return true; + } + + return true; +} + +// Parse the IPv4 by adding a dummy MAC header +PKT *ParsePacketIPv4WithDummyMacHeader(UCHAR *buf, UINT size) +{ + UCHAR *tmp; + UINT tmp_size; + PKT *ret; + // Validate arguments + if (buf == NULL) + { + return NULL; + } + + tmp_size = size + 14; + tmp = Malloc(tmp_size); + Zero(tmp, 12); + WRITE_USHORT(tmp + 12, MAC_PROTO_IPV4); + Copy(tmp + 14, buf, size); + + ret = ParsePacket(tmp, tmp_size); + + if (ret == NULL) + { + Free(tmp); + } + + return ret; +} + +// IPv4 parsing +bool ParsePacketIPv4(PKT *p, UCHAR *buf, UINT size) +{ + UINT header_size; + // Validate arguments + if (p == NULL || buf == NULL) + { + return false; + } + + // Check the size + if (size < sizeof(IPV4_HEADER)) + { + return false; + } + + // IPv4 header + p->L3.IPv4Header = (IPV4_HEADER *)buf; + p->TypeL3 = L3_IPV4; + + // Check the header + header_size = IPV4_GET_HEADER_LEN(p->L3.IPv4Header) * 4; + if (header_size < sizeof(IPV4_HEADER) || size < header_size) + { + // Header size is invalid + p->L3.IPv4Header = NULL; + p->TypeL3= L3_UNKNOWN; + return true; + } + + buf += header_size; + size -= header_size; + + p->IPv4PayloadSize = MIN(size, Endian16(p->L3.IPv4Header->TotalLength) - header_size); + if (Endian16(p->L3.IPv4Header->TotalLength) < header_size) + { + p->IPv4PayloadSize = 0; + } + + p->IPv4PayloadData = buf; + + if (IPV4_GET_OFFSET(p->L3.IPv4Header) != 0) + { + // Quit analysing since this is fragmented + p->TypeL4 = L4_FRAGMENT; + + return true; + } + + // Parse a L4 packet + switch (p->L3.IPv4Header->Protocol) + { + case IP_PROTO_ICMPV4: // ICMPv4 + return ParseICMPv4(p, buf, size); + + case IP_PROTO_UDP: // UDP + return ParseUDP(p, buf, size); + + case IP_PROTO_TCP: // TCP + return ParseTCP(p, buf, size); + + default: // Unknown + return true; + } +} + +// ICMPv4 parsing +bool ParseICMPv4(PKT *p, UCHAR *buf, UINT size) +{ + // Validate arguments + if (p == NULL || buf == NULL) + { + return false; + } + + // Check the size + if (size < sizeof(ICMP_HEADER)) + { + // Size is invalid + return false; + } + + // ICMPv4 header + p->L4.ICMPHeader = (ICMP_HEADER *)buf; + p->TypeL4 = L4_ICMPV4; + + buf += sizeof(ICMP_HEADER); + size -= sizeof(ICMP_HEADER); + + return true; +} + +// TCP parsing +bool ParseTCP(PKT *p, UCHAR *buf, UINT size) +{ + UINT header_size; + // Validate arguments + if (p == NULL || buf == NULL) + { + return false; + } + + // Check the size + if (size < sizeof(TCP_HEADER)) + { + // Size is invalid + return false; + } + + // TCP header + p->L4.TCPHeader = (TCP_HEADER *)buf; + p->TypeL4 = L4_TCP; + + // Check the header size + header_size = TCP_GET_HEADER_SIZE(p->L4.TCPHeader) * 4; + if (header_size < sizeof(TCP_HEADER) || size < header_size) + { + // Header size is invalid + p->L4.TCPHeader = NULL; + p->TypeL4 = L4_UNKNOWN; + return true; + } + + buf += header_size; + size -= header_size; + + p->Payload = buf; + p->PayloadSize = size; + + return true; +} + +// Get the next byte +UCHAR GetNextByte(BUF *b) +{ + UCHAR c = 0; + // Validate arguments + if (b == NULL) + { + return 0; + } + + if (ReadBuf(b, &c, 1) != 1) + { + return 0; + } + + return c; +} + +// Interpret the DNS query +bool ParseDnsQuery(char *name, UINT name_size, void *data, UINT data_size) +{ + BUF *b; + char tmp[257]; + bool ok = true; + USHORT val; + // Validate arguments + if (name == NULL || data == NULL || data_size == 0) + { + return false; + } + StrCpy(name, name_size, ""); + + b = NewBuf(); + WriteBuf(b, data, data_size); + SeekBuf(b, 0, 0); + + while (true) + { + UINT next_len = (UINT)GetNextByte(b); + if (next_len > 0) + { + // Read only the specified length + Zero(tmp, sizeof(tmp)); + if (ReadBuf(b, tmp, next_len) != next_len) + { + ok = false; + break; + } + // Append + if (StrLen(name) != 0) + { + StrCat(name, name_size, "."); + } + StrCat(name, name_size, tmp); + } + else + { + // Read all + break; + } + } + + if (ReadBuf(b, &val, sizeof(val)) != sizeof(val)) + { + ok = false; + } + else + { + if (Endian16(val) != 0x01 && Endian16(val) != 0x0c) + { + ok = false; + } + } + + if (ReadBuf(b, &val, sizeof(val)) != sizeof(val)) + { + ok = false; + } + else + { + if (Endian16(val) != 0x01) + { + ok = false; + } + } + + FreeBuf(b); + + if (ok == false || StrLen(name) == 0) + { + return false; + } + else + { + return true; + } +} + +// DNS parsing +void ParseDNS(PKT *p, UCHAR *buf, UINT size) +{ + UCHAR *query_data; + UINT query_data_size; + DNSV4_HEADER *dns; + char hostname[MAX_SIZE]; + if (p == NULL|| buf == NULL) + { + return; + } + + if (size < sizeof(DNSV4_HEADER)) + { + return; + } + + dns = (DNSV4_HEADER *)buf; + + if ((dns->Flag1 & 78) != 0 || (dns->Flag1 & 0x80) != 0) + { + // Illegal opcode + return; + } + if (Endian16(dns->NumQuery) != 1) + { + // Number of queries is invalid + return; + } + + query_data = ((UCHAR *)dns) + sizeof(DNSV4_HEADER); + query_data_size = size - sizeof(DNSV4_HEADER); + + // Interpret the query + if (ParseDnsQuery(hostname, sizeof(hostname), query_data, query_data_size) == false) + { + // Interpretation fails + return; + } + + StrCpy(p->DnsQueryHost, sizeof(p->DnsQueryHost), hostname); + p->TypeL7 = L7_DNS; +} + +// UDP parsing +bool ParseUDP(PKT *p, UCHAR *buf, UINT size) +{ + USHORT src_port, dst_port; + // Validate arguments + if (p == NULL || buf == NULL) + { + return false; + } + + // Check the size + if (size < sizeof(UDP_HEADER)) + { + // Size is invalid + return false; + } + + // UDP header + p->L4.UDPHeader = (UDP_HEADER *)buf; + p->TypeL4 = L4_UDP; + + buf += sizeof(UDP_HEADER); + size -= sizeof(UDP_HEADER); + + p->Payload = buf; + p->PayloadSize = size; + + // Check the port number + src_port = Endian16(p->L4.UDPHeader->SrcPort); + dst_port = Endian16(p->L4.UDPHeader->DstPort); + + if ((src_port == 67 && dst_port == 68) || + (src_port == 68 && dst_port == 67)) + { + if (p->TypeL3 == L3_IPV4) + { + // A DHCP packet is found + ParseDHCPv4(p, buf, size); + + return true; + } + } + + if (dst_port == 53) + { + ParseDNS(p, buf, size); + return true; + } + + + if (src_port == 500 || dst_port == 500 || src_port == 4500 || dst_port == 4500) + { + if (p->PayloadSize >= sizeof(IKE_HEADER)) + { + IKE_HEADER *ike_header = (IKE_HEADER *)p->Payload; + + if (ike_header->InitiatorCookie != 0 && ike_header->ResponderCookie == 0 && + (ike_header->ExchangeType == IKE_EXCHANGE_TYPE_MAIN || + ike_header->ExchangeType == IKE_EXCHANGE_TYPE_AGGRESSIVE)) + { + // the IKE connection request packet is found + p->TypeL7 = L7_IKECONN; + p->L7.IkeHeader = ike_header; + return true; + } + } + } + + // Determine whether it's an OpenVPN UDP packet + if (size == 14) + { + if (buf[0] == 0x38) + { + if (IsZero(buf + 9, 5)) + { + if (IsZero(buf + 1, 8) == false) + { + // An OpenVPN connection request packet is found + p->TypeL7 = L7_OPENVPNCONN; + return true; + } + } + } + } + + return true; +} + +// DHCPv4 parsing +void ParseDHCPv4(PKT *p, UCHAR *buf, UINT size) +{ + // Validate arguments + if (p == NULL || buf == NULL) + { + return; + } + + // Check the size + if (size < sizeof(DHCPV4_HEADER)) + { + // Size is invalid + return; + } + + // DHCPv4 header + p->L7.DHCPv4Header = (DHCPV4_HEADER *)buf; + p->TypeL7 = L7_DHCPV4; +} + +// Release the memory of the packet +void FreePacket(PKT *p) +{ + // Validate arguments + if (p == NULL) + { + return; + } + + if (p->MacHeader != NULL) + { + switch (p->TypeL3) + { + case L3_IPV4: + FreePacketIPv4(p); + break; + + case L3_ARPV4: + FreePacketARPv4(p); + break; + + case L3_TAGVLAN: + FreePacketTagVlan(p); + break; + } + } + + if (p->HttpLog != NULL) + { + Free(p->HttpLog); + } + + Free(p); +} + +// Release the memory of the packet with data +void FreePacketWithData(PKT *p) +{ + void *data; + // Validate arguments + if (p == NULL) + { + return; + } + + data = p->PacketData; + + FreePacket(p); + + Free(data); +} + +// Release the memory for the IPv4 packet +void FreePacketIPv4(PKT *p) +{ + // Validate arguments + if (p == NULL) + { + return; + } + + switch (p->TypeL4) + { + case L4_ICMPV4: + FreePacketICMPv4(p); + break; + + case L4_TCP: + FreePacketTCPv4(p); + break; + + case L4_UDP: + FreePacketUDPv4(p); + break; + } + + p->L3.IPv4Header = NULL; + p->TypeL3 = L3_UNKNOWN; +} + +// Release the memory for the tagged VLAN packet +void FreePacketTagVlan(PKT *p) +{ + // Validate arguments + if (p == NULL) + { + return; + } + + p->L3.TagVlanHeader = NULL; + p->TypeL3 = L3_UNKNOWN; +} + +// Release the memory for the ARPv4 packet +void FreePacketARPv4(PKT *p) +{ + // Validate arguments + if (p == NULL) + { + return; + } + + p->L3.ARPv4Header = NULL; + p->TypeL3 = L3_UNKNOWN; +} + +// Release the memory of the UDPv4 packet +void FreePacketUDPv4(PKT *p) +{ + // Validate arguments + if (p == NULL) + { + return; + } + + switch (p->TypeL7) + { + case L7_DHCPV4: + FreePacketDHCPv4(p); + break; + } + + p->L4.UDPHeader = NULL; + p->TypeL4 = L4_UNKNOWN; +} + +// Release the memory for the TCPv4 packet +void FreePacketTCPv4(PKT *p) +{ + // Validate arguments + if (p == NULL) + { + return; + } + + p->L4.TCPHeader = NULL; + p->TypeL4 = L4_UNKNOWN; +} + +// Release the memory for the ICMPv4 packet +void FreePacketICMPv4(PKT *p) +{ + // Validate arguments + if (p == NULL) + { + return; + } + + p->L4.ICMPHeader = NULL; + p->TypeL4 = L4_UNKNOWN; +} + +// Release the memory for the DHCPv4 packet +void FreePacketDHCPv4(PKT *p) +{ + // Validate arguments + if (p == NULL) + { + return; + } + + p->L7.DHCPv4Header = NULL; + p->TypeL7 = L7_UNKNOWN; +} + + +// Confirm the checksum of the IP header +bool IpCheckChecksum(IPV4_HEADER *ip) +{ + UINT header_size; + USHORT checksum_original, checksum_calc; + // Validate arguments + if (ip == NULL) + { + return false; + } + + header_size = IPV4_GET_HEADER_LEN(ip) * 4; + checksum_original = ip->Checksum; + ip->Checksum = 0; + checksum_calc = IpChecksum(ip, header_size); + ip->Checksum = checksum_original; + + if (checksum_original == checksum_calc) + { + return true; + } + else + { + return false; + } +} + +// Calculate the checksum +USHORT IpChecksum(void *buf, UINT size) +{ + int sum = 0; + USHORT *addr = (USHORT *)buf; + int len = (int)size; + USHORT *w = addr; + int nleft = len; + USHORT answer = 0; + + while (nleft > 1) + { + USHORT ww = 0; + Copy(&ww, w++, sizeof(USHORT)); + sum += ww; + nleft -= 2; + } + + if (nleft == 1) + { + *(UCHAR *)(&answer) = *(UCHAR *)w; + sum += answer; + } + + sum = (sum >> 16) + (sum & 0xffff); + sum += (sum >> 16); + + answer = ~sum; + + return answer; +} + +// Convert a DHCP option list into a buffer +BUF *BuildDhcpOptionsBuf(LIST *o) +{ + BUF *b; + UINT i; + UCHAR id; + UCHAR sz; + // Validate arguments + if (o == NULL) + { + return NULL; + } + + b = NewBuf(); + for (i = 0; i < LIST_NUM(o); i++) + { + DHCP_OPTION *d = LIST_DATA(o, i); + UINT current_size = d->Size; + UINT current_pos = 0; + + id = (UCHAR)d->Id; + if (d->Size <= 255) + { + sz = (UCHAR)d->Size; + } + else + { + sz = 0xFF; + } + WriteBuf(b, &id, 1); + WriteBuf(b, &sz, 1); + WriteBuf(b, d->Data, sz); + + current_size -= sz; + current_pos += sz; + + while (current_size != 0) + { + id = DHCP_ID_PRIVATE; + if (current_size <= 255) + { + sz = (UCHAR)current_size; + } + else + { + sz = 0xFF; + } + WriteBuf(b, &id, 1); + WriteBuf(b, &sz, 1); + WriteBuf(b, ((UCHAR *)d->Data) + current_pos, sz); + + current_size -= sz; + current_pos += sz; + } + + } + + id = 0xff; + WriteBuf(b, &id, 1); + + return b; +} + +// Convert a DHCP option list to the DHCP option +LIST *BuildDhcpOption(DHCP_OPTION_LIST *opt) +{ + LIST *o; + UCHAR opcode; + BUF *dns_buf; + // Validate arguments + if (opt == NULL) + { + return NULL; + } + + o = NewListFast(NULL); + + // Op-code + opcode = (UCHAR)opt->Opcode; + Add(o, NewDhcpOption(DHCP_ID_MESSAGE_TYPE, &opcode, sizeof(opcode))); + Add(o, NewDhcpOption(DHCP_ID_SERVER_ADDRESS, &opt->ServerAddress, sizeof(opt->ServerAddress))); + + if (opt->LeaseTime != 0) + { + Add(o, NewDhcpOption(DHCP_ID_LEASE_TIME, &opt->LeaseTime, sizeof(opt->LeaseTime))); + } + + if (StrLen(opt->DomainName) != 0 && opt->DnsServer != 0) + { + Add(o, NewDhcpOption(DHCP_ID_DOMAIN_NAME, opt->DomainName, StrLen(opt->DomainName))); + } + if (opt->SubnetMask != 0) + { + Add(o, NewDhcpOption(DHCP_ID_SUBNET_MASK, &opt->SubnetMask, sizeof(opt->SubnetMask))); + } + if (opt->Gateway != 0) + { + Add(o, NewDhcpOption(DHCP_ID_GATEWAY_ADDR, &opt->Gateway, sizeof(opt->Gateway))); + } + + dns_buf = NewBuf(); + + if (opt->DnsServer != 0) + { + WriteBuf(dns_buf, &opt->DnsServer, sizeof(opt->DnsServer)); + } + if (opt->DnsServer2 != 0) + { + WriteBuf(dns_buf, &opt->DnsServer2, sizeof(opt->DnsServer2)); + } + + if (dns_buf->Size >= 1) + { + Add(o, NewDhcpOption(DHCP_ID_DNS_ADDR, dns_buf->Buf, dns_buf->Size)); + } + + FreeBuf(dns_buf); + + if (opt->ClasslessRoute.NumExistingRoutes >= 1) + { + BUF *b = DhcpBuildClasslessRouteData(&opt->ClasslessRoute); + + if (b != NULL) + { + Add(o, NewDhcpOption(DHCP_ID_CLASSLESS_ROUTE, b->Buf, b->Size)); + Add(o, NewDhcpOption(DHCP_ID_MS_CLASSLESS_ROUTE, b->Buf, b->Size)); + + FreeBuf(b); + } + } + + return o; +} + +// Create a new DHCP option item +DHCP_OPTION *NewDhcpOption(UINT id, void *data, UINT size) +{ + DHCP_OPTION *ret; + if (size != 0 && data == NULL) + { + return NULL; + } + + ret = ZeroMalloc(sizeof(DHCP_OPTION)); + ret->Data = ZeroMalloc(size); + Copy(ret->Data, data, size); + ret->Size = size; + ret->Id = id; + + return ret; +} + +// Parse a DHCP options list +DHCP_OPTION_LIST *ParseDhcpOptionList(void *data, UINT size) +{ + DHCP_OPTION_LIST *ret; + LIST *o; + DHCP_OPTION *a; + // Validate arguments + if (data == NULL) + { + return NULL; + } + + // Parse the list + o = ParseDhcpOptions(data, size); + if (o == NULL) + { + return NULL; + } + + ret = ZeroMalloc(sizeof(DHCP_OPTION_LIST)); + + // Get the opcode + a = GetDhcpOption(o, DHCP_ID_MESSAGE_TYPE); + if (a != NULL) + { + if (a->Size == 1) + { + ret->Opcode = *((UCHAR *)a->Data); + } + } + + switch (ret->Opcode) + { + case DHCP_DISCOVER: + case DHCP_REQUEST: + // Parse this more finely because this is client requests + // Requested IP address + a = GetDhcpOption(o, DHCP_ID_REQUEST_IP_ADDRESS); + if (a != NULL && a->Size == 4) + { + Copy(&ret->RequestedIp, a->Data, 4); + } + // Host name + a = GetDhcpOption(o, DHCP_ID_HOST_NAME); + if (a != NULL) + { + if (a->Size > 1) + { + Copy(ret->Hostname, a->Data, MIN(a->Size, sizeof(ret->Hostname) - 1)); + } + } + break; + + case DHCP_OFFER: + case DHCP_ACK: + // Subnet mask + a = GetDhcpOption(o, DHCP_ID_SUBNET_MASK); + if (a != NULL && a->Size >= 4) + { + Copy(&ret->SubnetMask, a->Data, 4); + } + + // Lease time + a = GetDhcpOption(o, DHCP_ID_LEASE_TIME); + if (a != NULL && a->Size == 4) + { + ret->LeaseTime = READ_UINT(a->Data); + } + + // Server IP address + a = GetDhcpOption(o, DHCP_ID_SERVER_ADDRESS); + if (a != NULL && a->Size >= 4) + { + Copy(&ret->ServerAddress, a->Data, 4); + } + + // Domain name + a = GetDhcpOption(o, DHCP_ID_DOMAIN_NAME); + if (a != NULL && a->Size >= 1) + { + Zero(ret->DomainName, sizeof(ret->DomainName)); + Copy(ret->DomainName, a->Data, MIN(a->Size, sizeof(ret->DomainName) - 1)); + } + + // Gateway + a = GetDhcpOption(o, DHCP_ID_GATEWAY_ADDR); + if (a != NULL && a->Size >= 4) + { + Copy(&ret->Gateway, a->Data, 4); + } + + // DNS server + a = GetDhcpOption(o, DHCP_ID_DNS_ADDR); + if (a != NULL && a->Size >= 4) + { + Copy(&ret->DnsServer, a->Data, 4); + + if (a->Size >= 8) + { + Copy(&ret->DnsServer2, ((UCHAR *)a->Data) + 4, 4); + } + } + + // WINS server + a = GetDhcpOption(o, DHCP_ID_WINS_ADDR); + if (a != NULL && a->Size >= 4) + { + Copy(&ret->WinsServer, a->Data, 4); + + if (a->Size >= 8) + { + Copy(&ret->WinsServer2, ((UCHAR *)a->Data) + 4, 4); + } + } + + // Classless static routing table entries + // RFC 3442 + a = GetDhcpOption(o, DHCP_ID_CLASSLESS_ROUTE); + if (a != NULL) + { + DhcpParseClasslessRouteData(&ret->ClasslessRoute, a->Data, a->Size); + } + // Microsoft Extension + a = GetDhcpOption(o, DHCP_ID_MS_CLASSLESS_ROUTE); + if (a != NULL) + { + DhcpParseClasslessRouteData(&ret->ClasslessRoute, a->Data, a->Size); + } + + break; + } + + // Release the list + FreeDhcpOptions(o); + + return ret; +} + +// Normalize the classless routing table string +bool NormalizeClasslessRouteTableStr(char *dst, UINT dst_size, char *src) +{ + DHCP_CLASSLESS_ROUTE_TABLE t; + // Validate arguments + if (dst == NULL || src == NULL) + { + return false; + } + + Zero(&t, sizeof(t)); + if (ParseClasslessRouteTableStr(&t, src)) + { + BuildClasslessRouteTableStr(dst, dst_size, &t); + + return true; + } + + return false; +} + +// Build the string from the classless routing table +void BuildClasslessRouteTableStr(char *str, UINT str_size, DHCP_CLASSLESS_ROUTE_TABLE *t) +{ + UINT i; + UINT num = 0; + ClearStr(str, str_size); + // Validate arguments + if (str == NULL || t == NULL) + { + return; + } + + for (i = 0; i < MAX_DHCP_CLASSLESS_ROUTE_ENTRIES; i++) + { + DHCP_CLASSLESS_ROUTE *r = &t->Entries[i]; + + if (r->Exists) + { + char tmp[128]; + + Zero(tmp, sizeof(tmp)); + BuildClasslessRouteStr(tmp, sizeof(tmp), r); + + if (IsEmptyStr(tmp) == false) + { + if (num >= 1) + { + StrCat(str, str_size, ", "); + } + + StrCat(str, str_size, tmp); + + num++; + } + } + } +} + +// Build the string from the classless routing table entry +void BuildClasslessRouteStr(char *str, UINT str_size, DHCP_CLASSLESS_ROUTE *r) +{ + ClearStr(str, str_size); + // Validate arguments + if (str == NULL || r == NULL || r->Exists == false) + { + return; + } + + Format(str, str_size, "%r/%r/%r", &r->Network, &r->SubnetMask, &r->Gateway); +} + +// Check the classless routing table string +bool CheckClasslessRouteTableStr(char *str) +{ + DHCP_CLASSLESS_ROUTE_TABLE d; + + // Validate arguments + if (str == NULL) + { + return false; + } + + return ParseClasslessRouteTableStr(&d, str); +} + +// Parse the classless routing table string +bool ParseClasslessRouteTableStr(DHCP_CLASSLESS_ROUTE_TABLE *d, char *str) +{ + bool ret = true; + TOKEN_LIST *t; + // Validate arguments + if (d == NULL || str == NULL) + { + return false; + } + + Zero(d, sizeof(DHCP_CLASSLESS_ROUTE_TABLE)); + + t = ParseTokenWithoutNullStr(str, NULL); + + if (t != NULL) + { + UINT i; + + for (i = 0; i < t->NumTokens; i++) + { + DHCP_CLASSLESS_ROUTE r; + + Zero(&r, sizeof(r)); + if (ParseClasslessRouteStr(&r, t->Token[i])) + { + if (d->NumExistingRoutes < MAX_DHCP_CLASSLESS_ROUTE_ENTRIES) + { + Copy(&d->Entries[d->NumExistingRoutes], &r, sizeof(DHCP_CLASSLESS_ROUTE)); + d->NumExistingRoutes++; + } + else + { + // Overflow + ret = false; + break; + } + } + else + { + // Parse error + ret = false; + break; + } + } + } + + FreeToken(t); + + return ret; +} + +// Parse the classless routing table entry string +bool ParseClasslessRouteStr(DHCP_CLASSLESS_ROUTE *r, char *str) +{ + TOKEN_LIST *t; + bool ret = false; + char tmp[MAX_PATH]; + // Validate arguments + if (r == NULL || str == NULL) + { + return false; + } + + StrCpy(tmp, sizeof(tmp), str); + Trim(tmp); + + t = ParseTokenWithoutNullStr(str, "/"); + if (t == NULL) + { + return false; + } + + if (t->NumTokens == 3) + { + char ip_and_mask[MAX_PATH]; + char gateway[MAX_PATH]; + + Zero(r, sizeof(DHCP_CLASSLESS_ROUTE)); + + Format(ip_and_mask, sizeof(ip_and_mask), "%s/%s", t->Token[0], t->Token[1]); + StrCpy(gateway, sizeof(gateway), t->Token[2]); + + if (ParseIpAndSubnetMask46(ip_and_mask, &r->Network, &r->SubnetMask)) + { + r->SubnetMaskLen = SubnetMaskToInt4(&r->SubnetMask); + + if (StrToIP(&r->Gateway, gateway)) + { + if (IsIP4(&r->Gateway) && IsIP4(&r->Network) && IsIP4(&r->SubnetMask)) + { + r->Exists = true; + + IPAnd4(&r->Network, &r->Network, &r->SubnetMask); + + ret = true; + } + } + } + } + + FreeToken(t); + + return ret; +} + +// Build the classless static routing table data for a DHCP message +BUF *DhcpBuildClasslessRouteData(DHCP_CLASSLESS_ROUTE_TABLE *t) +{ + BUF *b; + UINT i; + // Validate arguments + if (t == NULL || t->NumExistingRoutes == 0) + { + return NULL; + } + + b = NewBuf(); + + for (i = 0; i < MAX_DHCP_CLASSLESS_ROUTE_ENTRIES; i++) + { + DHCP_CLASSLESS_ROUTE *r = &t->Entries[i]; + + if (r->Exists && r->SubnetMaskLen <= 32) + { + UCHAR c; + UINT data_len; + UINT ip32; + UCHAR tmp[4]; + + // Width of subnet mask + c = (UCHAR)r->SubnetMaskLen; + WriteBuf(b, &c, 1); + + // Number of significant octets + data_len = (r->SubnetMaskLen + 7) / 8; + Zero(tmp, sizeof(tmp)); + Copy(tmp, &r->Network, data_len); + WriteBuf(b, tmp, data_len); + + // Gateway + ip32 = IPToUINT(&r->Gateway); + WriteBuf(b, &ip32, sizeof(UINT)); + } + } + + SeekBufToBegin(b); + + return b; +} + +// Parse a classless static routing table entries from the DHCP message +void DhcpParseClasslessRouteData(DHCP_CLASSLESS_ROUTE_TABLE *t, void *data, UINT size) +{ + BUF *b; + // Validate arguments + if (t == NULL || data == NULL || size == 0) + { + return; + } + + b = MemToBuf(data, size); + + while (b->Current < b->Size) + { + UCHAR c; + UINT subnet_mask_len; + UINT data_len; + UCHAR tmp[4]; + IP ip; + IP mask; + IP gateway; + DHCP_CLASSLESS_ROUTE r; + UINT ip32; + bool exists = false; + UINT i; + + // Subnet mask length + c = ReadBufChar(b); + subnet_mask_len = c; + if (subnet_mask_len > 32) + { + // Invalid data + break; + } + + data_len = (subnet_mask_len + 7) / 8; + + Zero(tmp, sizeof(tmp)); + if (ReadBuf(b, tmp, data_len) != data_len) + { + // Invalid data + break; + } + + // IP address body + Zero(&ip, sizeof(IP)); + Copy(ip.addr, tmp, data_len); + + Zero(&mask, sizeof(mask)); + IntToSubnetMask4(&mask, subnet_mask_len); + + // Gateway address + Zero(&gateway, sizeof(gateway)); + if (ReadBuf(b, &ip32, sizeof(UINT)) != sizeof(UINT)) + { + // Invalid data + break; + } + UINTToIP(&gateway, ip32); + + Zero(&r, sizeof(r)); + r.Exists = true; + Copy(&r.Gateway, &gateway, sizeof(IP)); + Copy(&r.Network, &ip, sizeof(IP)); + Copy(&r.SubnetMask, &mask, sizeof(IP)); + r.SubnetMaskLen = subnet_mask_len; + + for (i = 0; i < MAX_DHCP_CLASSLESS_ROUTE_ENTRIES; i++) + { + if (Cmp(&t->Entries[i], &r, sizeof(DHCP_CLASSLESS_ROUTE)) == 0) + { + exists = true; + break; + } + } + + if (exists == false) + { + if (t->NumExistingRoutes >= MAX_DHCP_CLASSLESS_ROUTE_ENTRIES) + { + // Overflow + break; + } + + Copy(&t->Entries[t->NumExistingRoutes], &r, sizeof(DHCP_CLASSLESS_ROUTE)); + t->NumExistingRoutes++; + } + } + + FreeBuf(b); +} + +// Finding a DHCP option +DHCP_OPTION *GetDhcpOption(LIST *o, UINT id) +{ + UINT i; + DHCP_OPTION *ret = NULL; + // Validate arguments + if (o == NULL) + { + return NULL; + } + + for (i = 0; i < LIST_NUM(o); i++) + { + DHCP_OPTION *opt = LIST_DATA(o, i); + if (opt->Id == id) + { + ret = opt; + } + } + + return ret; +} + +// Get the best classless routing table entry from the routing table +DHCP_CLASSLESS_ROUTE *GetBestClasslessRoute(DHCP_CLASSLESS_ROUTE_TABLE *t, IP *ip) +{ + DHCP_CLASSLESS_ROUTE *ret = NULL; + UINT i; + UINT max_mask = 0; + // Validate arguments + if (t == NULL || ip == NULL) + { + return NULL; + } + if (t->NumExistingRoutes == 0) + { + return NULL; + } + + for (i = 0; i < MAX_DHCP_CLASSLESS_ROUTE_ENTRIES; i++) + { + DHCP_CLASSLESS_ROUTE *e = &t->Entries[i]; + + if (e->Exists) + { + if (IsInSameNetwork4(ip, &e->Network, &e->SubnetMask)) + { + if (max_mask <= e->SubnetMaskLen) + { + max_mask = e->SubnetMaskLen; + ret = e; + } + } + } + } + + return ret; +} + +// Release the DHCP option +void FreeDhcpOptions(LIST *o) +{ + UINT i; + // Validate arguments + if (o == NULL) + { + return; + } + + for (i = 0; i < LIST_NUM(o); i++) + { + DHCP_OPTION *opt = LIST_DATA(o, i); + Free(opt->Data); + Free(opt); + } + + ReleaseList(o); +} + +// Parse the DHCP Options +LIST *ParseDhcpOptions(void *data, UINT size) +{ + BUF *b; + LIST *o; + DHCP_OPTION *last_opt; + // Validate arguments + if (data == NULL) + { + return NULL; + } + + b = NewBuf(); + WriteBuf(b, data, size); + SeekBuf(b, 0, 0); + + o = NewListFast(NULL); + + last_opt = NULL; + + while (true) + { + UCHAR c = 0; + UCHAR sz = 0; + DHCP_OPTION *opt; + if (ReadBuf(b, &c, 1) != 1) + { + break; + } + if (c == 0xff) + { + break; + } + if (ReadBuf(b, &sz, 1) != 1) + { + break; + } + + if (c == DHCP_ID_PRIVATE && last_opt != NULL) + { + UINT new_size = last_opt->Size + (UINT)sz; + UCHAR *new_buf = ZeroMalloc(new_size); + Copy(new_buf, last_opt->Data, last_opt->Size); + ReadBuf(b, new_buf + last_opt->Size, sz); + Free(last_opt->Data); + last_opt->Data = new_buf; + last_opt->Size = new_size; + } + else + { + opt = ZeroMalloc(sizeof(DHCP_OPTION)); + opt->Id = (UINT)c; + opt->Size = (UINT)sz; + opt->Data = ZeroMalloc((UINT)sz); + ReadBuf(b, opt->Data, sz); + Add(o, opt); + + last_opt = opt; + } + } + + FreeBuf(b); + + return o; +} + +// Rewrite the DHCP message data in the requested IPv4 packet appropriately +BUF *DhcpModifyIPv4(DHCP_MODIFY_OPTION *m, void *data, UINT size) +{ + PKT *p; + BUF *ret = NULL; + // Validate arguments + if (m == NULL || data == NULL || size == 0) + { + return NULL; + } + + p = ParsePacketEx4(data, size, false, 0, false, false, false); + + if (p != NULL && p->TypeL3 == L3_IPV4 && p->TypeL4 == L4_UDP && p->TypeL7 == L7_DHCPV4) + { + BUF *new_buf = DhcpModify(m, p->Payload, p->PayloadSize); + + if (new_buf != NULL) + { + ret = NewBuf(); + + WriteBuf(ret, p->PacketData, p->PacketSize - p->PayloadSize); + WriteBuf(ret, new_buf->Buf, new_buf->Size); + + FreeBuf(new_buf); + } + } + + FreePacket(p); + + if (ret != NULL) + { + PKT *p = ParsePacketEx4(ret->Buf, ret->Size, false, 0, false, false, false); + + if (p != NULL) + { + // Recalculation of the UDP checksum + if (p->TypeL3 == L3_IPV4 && p->TypeL4 == L4_UDP) + { + UDP_HEADER *udp = p->L4.UDPHeader; + + udp->Checksum = 0; + udp->Checksum = CalcChecksumForIPv4(p->L3.IPv4Header->SrcIP, + p->L3.IPv4Header->DstIP, + IP_PROTO_UDP, + udp, + p->PacketSize - (UINT)(((UCHAR *)udp) - ((UCHAR *)p->PacketData)), 0); + } + + FreePacket(p); + } + } + + return ret; +} + +// Rewrite the DHCP packet appropriately +BUF *DhcpModify(DHCP_MODIFY_OPTION *m, void *data, UINT size) +{ + DHCPV4_HEADER *dhcp_header; + UCHAR *data_ptr; + bool ret_ok = false; + BUF *ret = NULL; + BUF *opt_buf = NULL; + UINT magic_cookie = Endian32(DHCP_MAGIC_COOKIE); + bool ok = false; + DHCP_OPTION_LIST *opt = NULL; + LIST *opt_list = NULL; + LIST *opt_list2 = NULL; + UINT src_size = size; + UINT i; + // Validate arguments + if (m == NULL || data == NULL || size == 0) + { + return NULL; + } + + data_ptr = (UCHAR *)data; + + if (size < sizeof(DHCPV4_HEADER)) + { + goto LABEL_CLEANUP; + } + + dhcp_header = (DHCPV4_HEADER *)data_ptr; + data_ptr += sizeof(DHCPV4_HEADER); + + // Search for a Magic Cookie + while (size >= 5) + { + if (Cmp(data_ptr, &magic_cookie, sizeof(UINT)) == 0) + { + // Found + data_ptr += sizeof(UINT); + size -= sizeof(UINT); + ok = true; + break; + } + + data_ptr++; + size--; + } + + if (ok == false) + { + // The packet is invalid + goto LABEL_CLEANUP; + } + + ret = NewBuf(); + WriteBuf(ret, data, (UINT)(data_ptr - ((UCHAR *)data))); + + // Parse the DHCP options list + opt = ParseDhcpOptionList(data_ptr, size); + if (opt == NULL) + { + // The packet is invalid + goto LABEL_CLEANUP; + } + + opt_list = ParseDhcpOptions(data_ptr, size); + if (opt_list == NULL) + { + // The packet is invalid + goto LABEL_CLEANUP; + } + + // Rebuilding the options list + opt_list2 = NewListFast(NULL); + + for (i = 0; i < LIST_NUM(opt_list); i++) + { + DHCP_OPTION *o = LIST_DATA(opt_list, i); + DHCP_OPTION *o2 = NULL; + bool ok = true; + + if (m->RemoveDefaultGatewayOnReply) + { + if (opt->Opcode == DHCP_OFFER || opt->Opcode == DHCP_ACK) + { + // Remove the default gateway from the DHCP Reply + if (o->Id == DHCP_ID_GATEWAY_ADDR) + { + ok = false; + } + if (o->Id == DHCP_ID_DNS_ADDR || o->Id == DHCP_ID_WINS_ADDR || o->Id == DHCP_ID_DOMAIN_NAME) + { + ok = false; + } + } + } + + if (ok && o2 == NULL) + { + o2 = NewDhcpOption(o->Id, o->Data, o->Size); + } + + if (o2 != NULL) + { + Add(opt_list2, o2); + } + } + + opt_buf = BuildDhcpOptionsBuf(opt_list2); + + WriteBuf(ret, opt_buf->Buf, opt_buf->Size); + + if (src_size != ret->Size || Cmp(data, ret->Buf, ret->Size) != 0) + { + // Rewrite if anything changes. Do not rewrite if there is no change + ret_ok = true; + + if (ret->Size < DHCP_MIN_SIZE) + { + // Padding + UCHAR *pad_buf; + UINT pad_size = DHCP_MIN_SIZE - ret->Size; + + pad_buf = ZeroMalloc(pad_size); + + WriteBuf(ret, pad_buf, pad_size); + + Free(pad_buf); + } + } + +LABEL_CLEANUP: + // Memory release + if (opt_buf != NULL) + { + FreeBuf(opt_buf); + } + + if (opt != NULL) + { + Free(opt); + } + + if (opt_list != NULL) + { + FreeDhcpOptions(opt_list); + } + + if (opt_list2 != NULL) + { + FreeDhcpOptions(opt_list2); + } + + // Return a value + if (ret_ok) + { + return ret; + } + else + { + FreeBuf(ret); + return NULL; + } +} diff --git a/src/Mayaqua/TcpIp.h b/src/Mayaqua/TcpIp.h index 83a4db8e..9a5d2103 100644 --- a/src/Mayaqua/TcpIp.h +++ b/src/Mayaqua/TcpIp.h @@ -1,847 +1,847 @@ -// SoftEther VPN Source Code - Developer Edition Master Branch -// Mayaqua Kernel - - -// TcpIp.h -// Header of TcpIp.c - -#ifndef TCPIP_H -#define TCPIP_H - -#ifdef OS_WIN32 -#pragma pack(push, 1) -#endif // OS_WIN32 - -// MTU when using of the PPPoE -#define MTU_FOR_PPPOE (1500 - 46) - -// MAC header -struct MAC_HEADER -{ - UCHAR DestAddress[6]; // Source MAC address - UCHAR SrcAddress[6]; // Destination MAC address - USHORT Protocol; // Protocol -} GCC_PACKED; - -// MAC protocol -#define MAC_PROTO_ARPV4 0x0806 // ARPv4 packet -#define MAC_PROTO_IPV4 0x0800 // IPv4 packets -#define MAC_PROTO_IPV6 0x86dd // IPv6 packets -#define MAC_PROTO_TAGVLAN 0x8100 // Tagged VLAN packets - -// LLC header -struct LLC_HEADER -{ - UCHAR Dsap; - UCHAR Ssap; - UCHAR Ctl; -} GCC_PACKED; - -// The value of the SSAP and the DSAP of the LLC header -#define LLC_DSAP_BPDU 0x42 -#define LLC_SSAP_BPDU 0x42 - -// BPDU header -struct BPDU_HEADER -{ - USHORT ProtocolId; // Protocol ID (STP == 0x0000) - UCHAR Version; // Version - UCHAR Type; // Type - UCHAR Flags; // Flag - USHORT RootPriority; // Priority of the root bridge - UCHAR RootMacAddress[6]; // MAC address of the root bridge - UINT RootPathCost; // Path cost to the root bridge - USHORT BridgePriority; // Priority of the outgoing bridge - UCHAR BridgeMacAddress[6]; // MAC address of the outgoing bridge - USHORT BridgePortId; // Port ID of the outgoing bridge - USHORT MessageAge; // Expiration date - USHORT MaxAge; // Maximum expiration date - USHORT HelloTime; // Hello Time - USHORT ForwardDelay; // Forward Delay -} GCC_PACKED; - -// ARPv4 header -struct ARPV4_HEADER -{ - USHORT HardwareType; // Hardware type - USHORT ProtocolType; // Protocol type - UCHAR HardwareSize; // Hardware size - UCHAR ProtocolSize; // Protocol size - USHORT Operation; // Operation - UCHAR SrcAddress[6]; // Source MAC address - UINT SrcIP; // Source IP address - UCHAR TargetAddress[6]; // Target MAC address - UINT TargetIP; // Target IP address -} GCC_PACKED; - -// ARP hardware type -#define ARP_HARDWARE_TYPE_ETHERNET 0x0001 - -// ARP operation type -#define ARP_OPERATION_REQUEST 1 -#define ARP_OPERATION_RESPONSE 2 - -// Tagged VLAN header -struct TAGVLAN_HEADER -{ - UCHAR Data[2]; // Data -} GCC_PACKED; - -// IPv4 header -struct IPV4_HEADER -{ - UCHAR VersionAndHeaderLength; // Version and header size - UCHAR TypeOfService; // Service Type - USHORT TotalLength; // Total size - USHORT Identification; // Identifier - UCHAR FlagsAndFragmentOffset[2]; // Flag and Fragment offset - UCHAR TimeToLive; // TTL - UCHAR Protocol; // Protocol - USHORT Checksum; // Checksum - UINT SrcIP; // Source IP address - UINT DstIP; // Destination IP address -} GCC_PACKED; - -// Macro for IPv4 header operation -#define IPV4_GET_VERSION(h) (((h)->VersionAndHeaderLength >> 4 & 0x0f)) -#define IPV4_SET_VERSION(h, v) ((h)->VersionAndHeaderLength |= (((v) & 0x0f) << 4)) -#define IPV4_GET_HEADER_LEN(h) ((h)->VersionAndHeaderLength & 0x0f) -#define IPV4_SET_HEADER_LEN(h, v) ((h)->VersionAndHeaderLength |= ((v) & 0x0f)) - -// Macro for IPv4 fragment related operation -#define IPV4_GET_FLAGS(h) (((h)->FlagsAndFragmentOffset[0] >> 5) & 0x07) -#define IPV4_SET_FLAGS(h, v) ((h)->FlagsAndFragmentOffset[0] |= (((v) & 0x07) << 5)) -#define IPV4_GET_OFFSET(h) (((h)->FlagsAndFragmentOffset[0] & 0x1f) * 256 + ((h)->FlagsAndFragmentOffset[1])) -#define IPV4_SET_OFFSET(h, v) {(h)->FlagsAndFragmentOffset[0] |= (UCHAR)((v) / 256); (h)->FlagsAndFragmentOffset[1] = (UCHAR)((v) % 256);} - -// IPv4 / IPv6 common protocol -#define IP_PROTO_TCP 0x06 // TCP protocol -#define IP_PROTO_UDP 0x11 // UDP protocol -#define IP_PROTO_ESP 50 // ESP protocol -#define IP_PROTO_ETHERIP 97 // EtherIP protocol -#define IP_PROTO_L2TPV3 115 // L2TPv3 protocol - - -// UDP header -struct UDP_HEADER -{ - USHORT SrcPort; // Source port number - USHORT DstPort; // Destination port number - USHORT PacketLength; // Data length - USHORT Checksum; // Checksum -} GCC_PACKED; - -// UDPv4 pseudo header -struct UDPV4_PSEUDO_HEADER -{ - UINT SrcIP; // Source IP address - UINT DstIP; // Destination IP address - UCHAR Reserved; // Unused - UCHAR Protocol; // Protocol number - USHORT PacketLength1; // UDP data length 1 - USHORT SrcPort; // Source port number - USHORT DstPort; // Destination port number - USHORT PacketLength2; // UDP data length 2 - USHORT Checksum; // Checksum -} GCC_PACKED; - -// IPv4 pseudo header -struct IPV4_PSEUDO_HEADER -{ - UINT SrcIP; // Source IP address - UINT DstIP; // Destination IP address - UCHAR Reserved; // Unused - UCHAR Protocol; // Protocol number - USHORT PacketLength; // Packet size -} GCC_PACKED; - -// TCP header -struct TCP_HEADER -{ - USHORT SrcPort; // Source port number - USHORT DstPort; // Destination port number - UINT SeqNumber; // Sequence number - UINT AckNumber; // Acknowledgment number - UCHAR HeaderSizeAndReserved; // Header size and Reserved area - UCHAR Flag; // Flag - USHORT WindowSize; // Window size - USHORT Checksum; // Checksum - USHORT UrgentPointer; // Urgent Pointer -} GCC_PACKED; - -// TCP macro -#define TCP_GET_HEADER_SIZE(h) (((h)->HeaderSizeAndReserved >> 4) & 0x0f) -#define TCP_SET_HEADER_SIZE(h, v) ((h)->HeaderSizeAndReserved = (((v) & 0x0f) << 4)) - -// TCP flags -#define TCP_FIN 1 -#define TCP_SYN 2 -#define TCP_RST 4 -#define TCP_PSH 8 -#define TCP_ACK 16 -#define TCP_URG 32 - -// ICMP header -struct ICMP_HEADER -{ - UCHAR Type; // Type - UCHAR Code; // Code - USHORT Checksum; // Checksum -} GCC_PACKED; - -// ICMP Echo -struct ICMP_ECHO -{ - USHORT Identifier; // ID - USHORT SeqNo; // Sequence number -} GCC_PACKED; - -// ICMP message type -#define ICMP_TYPE_ECHO_REQUEST 8 -#define ICMP_TYPE_ECHO_RESPONSE 0 -#define ICMP_TYPE_DESTINATION_UNREACHABLE 3 -#define ICMP_TYPE_TIME_EXCEEDED 11 -#define ICMP_TYPE_INFORMATION_REQUEST 15 -#define ICMP_TYPE_INFORMATION_REPLY 16 - -// ICMP message code -// In case of ICMP_TYPE_DESTINATION_UNREACHABLE -#define ICMP_CODE_NET_UNREACHABLE 0 -#define ICMP_CODE_HOST_UNREACHABLE 1 -#define ICMP_CODE_PROTOCOL_UNREACHABLE 2 -#define ICMP_CODE_PORT_UNREACHABLE 3 -#define ICMP_CODE_FRAGMENTATION_NEEDED_DF_SET 4 -#define ICMP_CODE_SOURCE_ROUTE_FAILED 5 - -// In case of TIME_EXCEEDED -#define ICMP_CODE_TTL_EXCEEDED_IN_TRANSIT 0 -#define ICMP_CODE_FRAGMENT_REASSEMBLY_TIME_EXCEEDED 1 - -// DHCPv4 Header -struct DHCPV4_HEADER -{ - UCHAR OpCode; // Op-code - UCHAR HardwareType; // Hardware type - UCHAR HardwareAddressSize; // Hardware address size - UCHAR Hops; // Number of hops - UINT TransactionId; // Transaction ID - USHORT Seconds; // Seconds - USHORT Flags; // Flag - UINT ClientIP; // Client IP address - UINT YourIP; // Assigned IP address - UINT ServerIP; // Server IP address - UINT RelayIP; // Relay IP address - UCHAR ClientMacAddress[6]; // Client MAC address - UCHAR Padding[10]; // Padding for non-Ethernet -} GCC_PACKED; - -// DNSv4 header -struct DNSV4_HEADER -{ - USHORT TransactionId; // Transaction ID - UCHAR Flag1; // Flag 1 - UCHAR Flag2; // Flag 2 - USHORT NumQuery; // Number of queries - USHORT AnswerRRs; // Answer RR number - USHORT AuthorityRRs; // Authority RR number - USHORT AdditionalRRs; // Additional RR number -} GCC_PACKED; - -#define DHCP_MAGIC_COOKIE 0x63825363 // Magic Cookie (fixed) - -// NetBIOS Datagram header -struct NBTDG_HEADER -{ - UCHAR MessageType; - UCHAR MoreFragments; - USHORT DatagramId; - UINT SrcIP; - USHORT SrcPort; - USHORT DatagramLen; - USHORT PacketOffset; -} GCC_PACKED; - -// IPv6 packet header information -struct IPV6_HEADER_PACKET_INFO -{ - IPV6_HEADER *IPv6Header; // IPv6 header - IPV6_OPTION_HEADER *HopHeader; // Hop-by-hop option header - UINT HopHeaderSize; // Hop-by-hop option header size - IPV6_OPTION_HEADER *EndPointHeader; // End point option header - UINT EndPointHeaderSize; // End point option header size - IPV6_OPTION_HEADER *RoutingHeader; // Routing header - UINT RoutingHeaderSize; // Routing header size - IPV6_FRAGMENT_HEADER *FragmentHeader; // Fragment header - void *Payload; // Payload - UINT PayloadSize; // Payload size - UCHAR Protocol; // Payload protocol - bool IsFragment; // Whether it's a fragmented packet - UINT TotalHeaderSize; // Total header size -}; - -// IPv6 header -struct IPV6_HEADER -{ - UCHAR VersionAndTrafficClass1; // Version Number (4 bit) and Traffic Class 1 (4 bit) - UCHAR TrafficClass2AndFlowLabel1; // Traffic Class 2 (4 bit) and Flow Label 1 (4 bit) - UCHAR FlowLabel2; // Flow Label 2 (8 bit) - UCHAR FlowLabel3; // Flow Label 3 (8 bit) - USHORT PayloadLength; // Length of the payload (including extension header) - UCHAR NextHeader; // Next header - UCHAR HopLimit; // Hop limit - IPV6_ADDR SrcAddress; // Source address - IPV6_ADDR DestAddress; // Destination address -} GCC_PACKED; - - -// Macro for IPv6 header operation -#define IPV6_GET_VERSION(h) (((h)->VersionAndTrafficClass1 >> 4) & 0x0f) -#define IPV6_SET_VERSION(h, v) ((h)->VersionAndTrafficClass1 = ((h)->VersionAndTrafficClass1 & 0x0f) | ((v) << 4) & 0xf0) -#define IPV6_GET_TRAFFIC_CLASS(h) ((((h)->VersionAndTrafficClass1 << 4) & 0xf0) | ((h)->TrafficClass2AndFlowLabel1 >> 4) & 0x0f) -#define IPV6_SET_TRAFFIC_CLASS(h, v) ((h)->VersionAndTrafficClass1 = ((h)->VersionAndTrafficClass1 & 0xf0) | (((v) >> 4) & 0x0f),\ - (h)->TrafficClass2AndFlowLabel1 = (h)->TrafficClass2AndFlowLabel1 & 0x0f | ((v) << 4) & 0xf0) -#define IPV6_GET_FLOW_LABEL(h) ((((h)->TrafficClass2AndFlowLabel1 << 16) & 0xf0000) | (((h)->FlowLabel2 << 8) & 0xff00) |\ - (((h)->FlowLabel3) & 0xff)) -#define IPV6_SET_FLOW_LABEL(h, v) ((h)->TrafficClass2AndFlowLabel1 = ((h)->TrafficClass2AndFlowLabel1 & 0xf0 | ((v) >> 16) & 0x0f),\ - (h)->FlowLabel2 = ((v) >> 8) & 0xff,\ - (h)->FlowLabel3 = (v) & 0xff) - - -// Maximum hops of IPv6 (not routing) -#define IPV6_HOP_MAX 255 - -// Standard hops of IPv6 -#define IPV6_HOP_DEFAULT 127 - -// IPv6 header number -#define IPV6_HEADER_HOP 0 // Hop-by-hop option header -#define IPV6_HEADER_ENDPOINT 60 // End point option header -#define IPV6_HEADER_ROUTING 43 // Routing header -#define IPV6_HEADER_FRAGMENT 44 // Fragment header -#define IPV6_HEADER_NONE 59 // No Next Header - -// IPv6 option header -// (Used on hop option header, end point option header, routing header) -struct IPV6_OPTION_HEADER -{ - UCHAR NextHeader; // Next header - UCHAR Size; // Header size (/8) -} GCC_PACKED; - -// IPv6 fragment header -// (fragment impossible part is until just before the routing header -// or hop-by-hop option header or first extended header or payload) -struct IPV6_FRAGMENT_HEADER -{ - UCHAR NextHeader; // Next header - UCHAR Reserved; // Reserved - UCHAR FragmentOffset1; // Fragment offset 1 (/8, 8 bit) - UCHAR FragmentOffset2AndFlags; // Fragment offset 2 (/8, 5 bit) + Reserved (2 bit) + More flag (1 bit) - UINT Identification; // ID -} GCC_PACKED; - -// Macro for IPv6 fragment header operation -#define IPV6_GET_FRAGMENT_OFFSET(h) (((((h)->FragmentOffset1) << 5) & 0x1fe0) | (((h)->FragmentOffset2AndFlags >> 3) & 0x1f)) -#define IPV6_SET_FRAGMENT_OFFSET(h, v) ((h)->FragmentOffset1 = (v / 32) & 0xff, \ - ((h)->FragmentOffset2AndFlags = ((v % 256) << 3) & 0xf8) | ((h)->FragmentOffset2AndFlags & 0x07)) -#define IPV6_GET_FLAGS(h) ((h)->FragmentOffset2AndFlags & 0x0f) -#define IPV6_SET_FLAGS(h, v) ((h)->FragmentOffset2AndFlags = (((h)->FragmentOffset2AndFlags & 0xf8) | (v & 0x07))) - -// Flag -#define IPV6_FRAGMENT_HEADER_FLAG_MORE_FRAGMENTS 0x01 // There are more fragments - -// Virtual IPv6 header -struct IPV6_PSEUDO_HEADER -{ - IPV6_ADDR SrcAddress; // Source address - IPV6_ADDR DestAddress; // Destination address - UINT UpperLayerPacketSize; // Upper layer packet size - UCHAR Padding[3]; // Padding - UCHAR NextHeader; // Next Header (TCP / UDP) -} GCC_PACKED; - -// ICMPv6 Router Solicitation header -struct ICMPV6_ROUTER_SOLICIATION_HEADER -{ - UINT Reserved; // Reserved - // + Option (source link-layer address [optional]) -} GCC_PACKED; - -// ICMPv6 Router Advertisement header -struct ICMPV6_ROUTER_ADVERTISEMENT_HEADER -{ - UCHAR CurHopLimit; // Hop limit of the default - UCHAR Flags; // Flag (0) - USHORT Lifetime; // Lifetime - UINT ReachableTime; // 0 - UINT RetransTimer; // 0 - // + Option (prefix information [required], MTU [optional]) -} GCC_PACKED; - -// ICMPv6 Neighbor Solicitation header -struct ICMPV6_NEIGHBOR_SOLICIATION_HEADER -{ - UINT Reserved; // Reserved - IPV6_ADDR TargetAddress; // Target address - // + Option (source link-layer address [required]) -} GCC_PACKED; - -// ICMPv6 Neighbor Advertisement header -struct ICMPV6_NEIGHBOR_ADVERTISEMENT_HEADER -{ - UCHAR Flags; // Flag - UCHAR Reserved[3]; // Reserved - IPV6_ADDR TargetAddress; // Target address - // + Option (target link-layer address) -} GCC_PACKED; - -#define ICMPV6_NEIGHBOR_ADVERTISEMENT_FLAG_ROUTER 0x80 // Router -#define ICMPV6_NEIGHBOR_ADVERTISEMENT_FLAG_SOLICITED 0x40 // Solicited flag -#define ICMPV6_NEIGHBOR_ADVERTISEMENT_FLAG_OVERWRITE 0x20 // Overwrite flag - -#define ICMPV6_OPTION_PREFIXES_MAX_COUNT 10 - -// ICMPv6 option list -struct ICMPV6_OPTION_LIST -{ - ICMPV6_OPTION_LINK_LAYER *SourceLinkLayer; // Source link-layer address - ICMPV6_OPTION_LINK_LAYER *TargetLinkLayer; // Target link-layer address - ICMPV6_OPTION_PREFIX *Prefix[ICMPV6_OPTION_PREFIXES_MAX_COUNT]; // Prefix Information - may be multiple in one request - ICMPV6_OPTION_MTU *Mtu; // MTU -} GCC_PACKED; - -// ICMPv6 option -struct ICMPV6_OPTION -{ - UCHAR Type; // Type - UCHAR Length; // Length (/8, include type and length) -} GCC_PACKED; - -#define ICMPV6_OPTION_TYPE_SOURCE_LINK_LAYER 1 // Source link-layer address -#define ICMPV6_OPTION_TYPE_TARGET_LINK_LAYER 2 // Target link-layer address -#define ICMPV6_OPTION_TYPE_PREFIX 3 // Prefix Information -#define ICMPV6_OPTION_TYPE_MTU 5 // MTU - -// ICMPv6 link layer options -struct ICMPV6_OPTION_LINK_LAYER -{ - ICMPV6_OPTION IcmpOptionHeader; // Option header - UCHAR Address[6]; // MAC address -} GCC_PACKED; - -// ICMPv6 prefix information option -struct ICMPV6_OPTION_PREFIX -{ - ICMPV6_OPTION IcmpOptionHeader; // Option header - UCHAR SubnetLength; // Subnet length - UCHAR Flags; // Flag - UINT ValidLifetime; // Formal lifetime - UINT PreferredLifetime; // Preferred lifetime - UINT Reserved; // Reserved - IPV6_ADDR Prefix; // Prefix address -} GCC_PACKED; - -#define ICMPV6_OPTION_PREFIX_FLAG_ONLINK 0x80 // On link -#define ICMPV6_OPTION_PREFIX_FLAG_AUTO 0x40 // Automatic - -// ICMPv6 MTU option -struct ICMPV6_OPTION_MTU -{ - ICMPV6_OPTION IcmpOptionHeader; // Option header - USHORT Reserved; // Reserved - UINT Mtu; // MTU value -} GCC_PACKED; - - -// IPv6 header information -struct IPV6_HEADER_INFO -{ - bool IsRawIpPacket; - USHORT Size; - UINT Id; - UCHAR Protocol; - UCHAR HopLimit; - IPV6_ADDR SrcIpAddress; - IPV6_ADDR DestIpAddress; - bool UnicastForMe; - bool UnicastForRouting; - bool UnicastForRoutingWithProxyNdp; - bool IsBroadcast; - UINT TypeL4; -}; - -// ICMPv6 header information -struct ICMPV6_HEADER_INFO -{ - UCHAR Type; - UCHAR Code; - USHORT DataSize; - void *Data; - ICMP_ECHO EchoHeader; - void *EchoData; - UINT EchoDataSize; - - union - { - // Meaning is determined by the value of the Type - ICMPV6_ROUTER_SOLICIATION_HEADER *RouterSoliciationHeader; - ICMPV6_ROUTER_ADVERTISEMENT_HEADER *RouterAdvertisementHeader; - ICMPV6_NEIGHBOR_SOLICIATION_HEADER *NeighborSoliciationHeader; - ICMPV6_NEIGHBOR_ADVERTISEMENT_HEADER *NeighborAdvertisementHeader; - void *HeaderPointer; - } Headers; - - ICMPV6_OPTION_LIST OptionList; -}; - -// The Type value of ICMPv6 -#define ICMPV6_TYPE_ECHO_REQUEST 128 // ICMPv6 Echo request -#define ICMPV6_TYPE_ECHO_RESPONSE 129 // ICMPv6 Echo response -#define ICMPV6_TYPE_ROUTER_SOLICIATION 133 // Router Solicitation -#define ICMPV6_TYPE_ROUTER_ADVERTISEMENT 134 // Router Advertisement -#define ICMPV6_TYPE_NEIGHBOR_SOLICIATION 135 // Neighbor Solicitation -#define ICMPV6_TYPE_NEIGHBOR_ADVERTISEMENT 136 // Neighbor Advertisement - -// Minimum DHCP packet size -#define DHCP_MIN_SIZE 300 - -// Constants about DHCP -#define DHCP_ID_MESSAGE_TYPE 0x35 -#define DHCP_ID_REQUEST_IP_ADDRESS 0x32 -#define DHCP_ID_HOST_NAME 0x0c -#define DHCP_ID_SERVER_ADDRESS 0x36 -#define DHCP_ID_LEASE_TIME 0x33 -#define DHCP_ID_DOMAIN_NAME 0x0f -#define DHCP_ID_SUBNET_MASK 0x01 -#define DHCP_ID_GATEWAY_ADDR 0x03 -#define DHCP_ID_DNS_ADDR 0x06 -#define DHCP_ID_WINS_ADDR 0x2C -#define DHCP_ID_CLIENT_ID 0x3d -#define DHCP_ID_VENDOR_ID 0x3c -#define DHCP_ID_REQ_PARAM_LIST 0x37 -#define DHCP_ID_USER_CLASS 0x4d -#define DHCP_ID_CLASSLESS_ROUTE 0x79 -#define DHCP_ID_MS_CLASSLESS_ROUTE 0xF9 -#define DHCP_ID_PRIVATE 0xFA - - -// DHCP client action -#define DHCP_DISCOVER 1 -#define DHCP_REQUEST 3 -#define DHCP_RELEASE 7 -#define DHCP_INFORM 8 - -// DHCP server action -#define DHCP_OFFER 2 -#define DHCP_DECLINE 4 -#define DHCP_ACK 5 -#define DHCP_NACK 6 - -// HTTPLOG data structure -struct HTTPLOG -{ - char Method[32]; // Method - char Hostname[MAX_HOST_NAME_LEN + 1]; // Host name - UINT Port; // Port number - char Path[MAX_SIZE]; // Path - char Protocol[64]; // Protocol - char UserAgent[MAX_SIZE]; // User Agent value - char Referer[MAX_SIZE]; // Referer - bool IsSsl; // Is SSL -}; - -// Packet -struct PKT -{ - UCHAR *PacketData; // Packet data body - UINT PacketSize; // Packet size - MAC_HEADER *MacHeader; // MAC header - UCHAR *MacAddressSrc; // Source MAC address - UCHAR *MacAddressDest; // Destination MAC address - bool BroadcastPacket; // Broadcast packet - bool InvalidSourcePacket; // Packet with an invalid source address - bool AccessChecked; // Packets that pass was confirmed by the access list - UINT VlanTypeID; // TypeID of the tagged VLAN (usually 0x8100) - UINT VlanId; // VLAN ID - UINT Delay; // Delay - UINT Jitter; // Jitter - UINT Loss; // Packet loss - UINT64 DelayedForwardTick; // Sending time in case of delayed - struct SESSION *DelayedSrcSession; // Source session - UINT TypeL3; // Layer-3 packet classification - IPV6_HEADER_PACKET_INFO IPv6HeaderPacketInfo; // IPv6 packet header information (only for TypeL3 == L3_IPV6) - ICMPV6_HEADER_INFO ICMPv6HeaderPacketInfo; // ICMPv6 header information (Only for TypeL4 == L4_ICMPV6) - UINT DhcpOpCode; // DHCP opcode - union - { - IPV4_HEADER *IPv4Header; // IPv4 header - ARPV4_HEADER *ARPv4Header; // ARPv4 header - IPV6_HEADER *IPv6Header; // IPv6 header - TAGVLAN_HEADER *TagVlanHeader; // Tag header - BPDU_HEADER *BpduHeader; // BPDU header - void *PointerL3; - } L3; - UINT TypeL4; // Layer-4 packet classification - UINT IPv4PayloadSize; // IPv4 payload size - void *IPv4PayloadData; // IPv4 payload data - union - { - UDP_HEADER *UDPHeader; // UDP header - TCP_HEADER *TCPHeader; // TCP header - ICMP_HEADER *ICMPHeader; // ICMP header - void *PointerL4; - } L4; - UINT TypeL7; // Layer-7 packet classification - union - { - DHCPV4_HEADER *DHCPv4Header; // DHCPv4 header - IKE_HEADER *IkeHeader; // IKE header - void *PointerL7; - } L7; - UCHAR *Payload; // Pointer to the payload of TCP or UDP - UINT PayloadSize; // Payload size - struct HTTPLOG *HttpLog; // HTTP log - char DnsQueryHost[64]; // DNS hostname -} GCC_PACKED; - -// Layer-3 packet classification -#define L3_UNKNOWN 0 // Unknown -#define L3_ARPV4 1 // ARPv4 packet -#define L3_IPV4 2 // IPv4 packet -#define L3_TAGVLAN 3 // Tagged VLAN packet -#define L3_BPDU 4 // BPDU packet -#define L3_IPV6 5 // IPv6 packet - -// Layer-4 packet classification -#define L4_UNKNOWN 0 // Unknown -#define L4_UDP 1 // UDPv4 packet -#define L4_TCP 2 // TCPv4 packet -#define L4_ICMPV4 3 // ICMPv4 packet -#define L4_ICMPV6 4 // ICMPv6 packet -#define L4_FRAGMENT 5 // Fragment packet - -// Layer-7 packet classification -#define L7_UNKNOWN 0 // Unknown -#define L7_DHCPV4 1 // DHCPv4 packet -#define L7_IKECONN 2 // IKE connection request packet -#define L7_OPENVPNCONN 3 // OpenVPN connection request packet -#define L7_DNS 4 // DNS packet - - -// IKE header -struct IKE_HEADER -{ - UINT64 InitiatorCookie; // Initiator cookie - UINT64 ResponderCookie; // Responder cookie - UCHAR NextPayload; // Next payload - UCHAR Version; // Version - UCHAR ExchangeType; // Exchange type - UCHAR Flag; // Flag - UINT MessageId; // Message ID - UINT MessageSize; // Message size -} GCC_PACKED; - -// IKE exchange type -#define IKE_EXCHANGE_TYPE_MAIN 2 // Main mode -#define IKE_EXCHANGE_TYPE_AGGRESSIVE 4 // Aggressive mode -#define IKE_EXCHANGE_TYPE_INFORMATION 5 // Information exchange -#define IKE_EXCHANGE_TYPE_QUICK 32 // Quick mode - -// DHCPv4 data -struct DHCPV4_DATA -{ - UCHAR *Data; - UINT Size; - IP SrcIP; - UINT SrcPort; - IP DestIP; - UINT DestPort; - UINT OpCode; - - UCHAR *OptionData; - UINT OptionSize; - - DHCPV4_HEADER *Header; - LIST *OptionList; - - struct DHCP_OPTION_LIST *ParsedOptionList; -}; -// DHCP Option -struct DHCP_OPTION -{ - UINT Id; // ID - UINT Size; // Size - void *Data; // Data -}; - -// DHCP classless static route entry -struct DHCP_CLASSLESS_ROUTE -{ - bool Exists; // Existing flag - IP Network; // Network address - IP SubnetMask; // Subnet mask - IP Gateway; // Gateway - UINT SubnetMaskLen; // Subnet mask length -}; - -#define MAX_DHCP_CLASSLESS_ROUTE_ENTRIES 64 -#define MAX_DHCP_CLASSLESS_ROUTE_TABLE_STR_SIZE 3200 - -// DHCP classless static route table -struct DHCP_CLASSLESS_ROUTE_TABLE -{ - UINT NumExistingRoutes; // Number of existing routing table entries - DHCP_CLASSLESS_ROUTE Entries[MAX_DHCP_CLASSLESS_ROUTE_ENTRIES]; // Entries -}; - -#define MAX_USER_CLASS_LEN 255 - -// DHCP option list -struct DHCP_OPTION_LIST -{ - // Common Item - UINT Opcode; // DHCP opcode - - // Client request - UINT RequestedIp; // Requested IP address - char Hostname[MAX_HOST_NAME_LEN + 1]; // Host name - char UserClass[MAX_USER_CLASS_LEN + 1]; // User class - // RFC3003 defines that User Class option is array of text strings, - // but the most popular DHCP clients and servers, - // i.e. ISC DHCP and Microsoft DHCP Server, consider it a text string - - // Server response - UINT ClientAddress; // Client address - UINT ServerAddress; // DHCP server address - UINT LeaseTime; // Lease time - char DomainName[MAX_HOST_NAME_LEN + 1]; // Domain name - UINT SubnetMask; // Subnet mask - UINT Gateway; // Gateway address - UINT DnsServer; // DNS server address 1 - UINT DnsServer2; // DNS server address 2 - UINT WinsServer; // WINS server address 1 - UINT WinsServer2; // WINS server address 2 - DHCP_CLASSLESS_ROUTE_TABLE ClasslessRoute; // Classless static routing table -}; - -// Modification option in the DHCP packet -struct DHCP_MODIFY_OPTION -{ - bool RemoveDefaultGatewayOnReply; // Remove the default gateway from the DHCP Reply -}; - -// Special IP address -#define SPECIAL_IPV4_ADDR_LLMNR_DEST 0xE00000FC // 224.0.0.252 - -// Special port -#define SPECIAL_UDP_PORT_LLMNR 5355 // LLMNR -#define SPECIAL_UDP_PORT_NBTNS 137 // NetBIOS Name Service -#define SPECIAL_UDP_PORT_NBTDGM 138 // NetBIOS Datagram -#define SPECIAL_UDP_PORT_WSD 3702 // WS-Discovery -#define SPECIAL_UDP_PORT_SSDP 1900 // SSDP - - -PKT *ParsePacketIPv4WithDummyMacHeader(UCHAR *buf, UINT size); -PKT *ParsePacket(UCHAR *buf, UINT size); -PKT *ParsePacketEx(UCHAR *buf, UINT size, bool no_l3); -PKT *ParsePacketEx2(UCHAR *buf, UINT size, bool no_l3, UINT vlan_type_id); -PKT *ParsePacketEx3(UCHAR *buf, UINT size, bool no_l3, UINT vlan_type_id, bool bridge_id_as_mac_address); -PKT *ParsePacketEx4(UCHAR *buf, UINT size, bool no_l3, UINT vlan_type_id, bool bridge_id_as_mac_address, bool no_http, bool correct_checksum); -PKT *ParsePacketEx5(UCHAR *buf, UINT size, bool no_l3, UINT vlan_type_id, bool bridge_id_as_mac_address, bool no_http, bool correct_checksum, bool no_l3_l4_except_icmpv6); -PKT *ParsePacketUpToICMPv6(UCHAR *buf, UINT size); -void FreePacket(PKT *p); -void FreePacketWithData(PKT *p); -void FreePacketIPv4(PKT *p); -void FreePacketTagVlan(PKT *p); -void FreePacketARPv4(PKT *p); -void FreePacketUDPv4(PKT *p); -void FreePacketTCPv4(PKT *p); -void FreePacketICMPv4(PKT *p); -void FreePacketDHCPv4(PKT *p); -bool ParsePacketL2Ex(PKT *p, UCHAR *buf, UINT size, bool no_l3, bool no_l3_l4_except_icmpv6); -bool ParsePacketARPv4(PKT *p, UCHAR *buf, UINT size); -bool ParsePacketIPv4(PKT *p, UCHAR *buf, UINT size); -bool ParsePacketBPDU(PKT *p, UCHAR *buf, UINT size); -bool ParsePacketTAGVLAN(PKT *p, UCHAR *buf, UINT size); -bool ParseICMPv4(PKT *p, UCHAR *buf, UINT size); -bool ParseICMPv6(PKT *p, UCHAR *buf, UINT size); -bool ParseTCP(PKT *p, UCHAR *buf, UINT size); -bool ParseUDP(PKT *p, UCHAR *buf, UINT size); -void ParseDHCPv4(PKT *p, UCHAR *buf, UINT size); -void ParseDNS(PKT *p, UCHAR *buf, UINT size); -PKT *ClonePacket(PKT *p, bool copy_data); -void FreeClonePacket(PKT *p); - -void CorrectChecksum(PKT *p); - -bool ParsePacketIPv6(PKT *p, UCHAR *buf, UINT size, bool no_l3_l4_except_icmpv6); -bool ParsePacketIPv6Header(IPV6_HEADER_PACKET_INFO *info, UCHAR *buf, UINT size); -bool ParseIPv6ExtHeader(IPV6_HEADER_PACKET_INFO *info, UCHAR next_header, UCHAR *buf, UINT size); -bool ParseICMPv6Options(ICMPV6_OPTION_LIST *o, UCHAR *buf, UINT size); -void CloneICMPv6Options(ICMPV6_OPTION_LIST *dst, ICMPV6_OPTION_LIST *src); -void FreeCloneICMPv6Options(ICMPV6_OPTION_LIST *o); -USHORT CalcChecksumForIPv4(UINT src_ip, UINT dst_ip, UCHAR protocol, void *data, UINT size, UINT real_size); -USHORT CalcChecksumForIPv6(IPV6_ADDR *src_ip, IPV6_ADDR *dest_ip, UCHAR protocol, void *data, UINT size, UINT real_size); -BUF *BuildICMPv6Options(ICMPV6_OPTION_LIST *o); -void BuildICMPv6OptionValue(BUF *b, UCHAR type, void *header_pointer, UINT total_size); -BUF *BuildIPv6(IPV6_ADDR *dest_ip, IPV6_ADDR *src_ip, UINT id, UCHAR protocol, UCHAR hop_limit, void *data, - UINT size); -BUF *BuildIPv6PacketHeader(IPV6_HEADER_PACKET_INFO *info, UINT *bytes_before_payload); -UCHAR IPv6GetNextHeaderFromQueue(QUEUE *q); -void BuildAndAddIPv6PacketOptionHeader(BUF *b, IPV6_OPTION_HEADER *opt, UCHAR next_header, UINT size); -BUF *BuildICMPv6NeighborSoliciation(IPV6_ADDR *src_ip, IPV6_ADDR *target_ip, UCHAR *my_mac_address, UINT id); -BUF *BuildICMPv6RouterSoliciation(IPV6_ADDR *src_ip, IPV6_ADDR *target_ip, UCHAR *my_mac_address, UINT id); -BUF *BuildICMPv6(IPV6_ADDR *src_ip, IPV6_ADDR *dest_ip, UCHAR hop_limit, UCHAR type, UCHAR code, void *data, UINT size, UINT id); - -bool VLanRemoveTag(void **packet_data, UINT *packet_size, UINT vlan_id, UINT vlan_tpid); -void VLanInsertTag(void **packet_data, UINT *packet_size, UINT vlan_id, UINT vlan_tpid); - -DHCPV4_DATA *ParseDHCPv4Data(PKT *pkt); -void FreeDHCPv4Data(DHCPV4_DATA *d); - -bool AdjustTcpMssL3(UCHAR *src, UINT src_size, UINT mss); -bool AdjustTcpMssL2(UCHAR *src, UINT src_size, UINT mss, USHORT tag_vlan_tpid); -UINT GetIpHeaderSize(UCHAR *src, UINT src_size); -bool ParseDnsQuery(char *name, UINT name_size, void *data, UINT data_size); -UCHAR GetNextByte(BUF *b); - -bool IsDhcpPacketForSpecificMac(UCHAR *data, UINT size, UCHAR *mac_address); - -ICMP_RESULT *IcmpParseResult(IP *dest_ip, USHORT src_id, USHORT src_seqno, UCHAR *recv_buffer, UINT recv_buffer_size); -void IcmpFreeResult(ICMP_RESULT *r); - -USHORT IpChecksum(void *buf, UINT size); -bool IpCheckChecksum(IPV4_HEADER *ip); - -LIST *BuildDhcpOption(DHCP_OPTION_LIST *opt); -DHCP_OPTION *NewDhcpOption(UINT id, void *data, UINT size); -DHCP_OPTION_LIST *ParseDhcpOptionList(void *data, UINT size); -DHCP_OPTION *GetDhcpOption(LIST *o, UINT id); -void FreeDhcpOptions(LIST *o); -LIST *ParseDhcpOptions(void *data, UINT size); -BUF *BuildDhcpOptionsBuf(LIST *o); -HTTPLOG *ParseHttpAccessLog(PKT *pkt); -HTTPLOG *ParseHttpsAccessLog(PKT *pkt); - -BUF *DhcpModify(DHCP_MODIFY_OPTION *m, void *data, UINT size); -BUF *DhcpModifyIPv4(DHCP_MODIFY_OPTION *m, void *data, UINT size); - -DHCP_CLASSLESS_ROUTE *GetBestClasslessRoute(DHCP_CLASSLESS_ROUTE_TABLE *t, IP *ip); -void DhcpParseClasslessRouteData(DHCP_CLASSLESS_ROUTE_TABLE *t, void *data, UINT size); -BUF *DhcpBuildClasslessRouteData(DHCP_CLASSLESS_ROUTE_TABLE *t); -bool ParseClasslessRouteStr(DHCP_CLASSLESS_ROUTE *r, char *str); -bool ParseClasslessRouteTableStr(DHCP_CLASSLESS_ROUTE_TABLE *d, char *str); -bool CheckClasslessRouteTableStr(char *str); -void BuildClasslessRouteStr(char *str, UINT str_size, DHCP_CLASSLESS_ROUTE *r); -void BuildClasslessRouteTableStr(char *str, UINT str_size, DHCP_CLASSLESS_ROUTE_TABLE *t); -bool NormalizeClasslessRouteTableStr(char *dst, UINT dst_size, char *src); - - - -#ifdef OS_WIN32 -#pragma pack(pop) -#endif // OS_WIN32 - -#endif // TCPIP_H - - +// SoftEther VPN Source Code - Developer Edition Master Branch +// Mayaqua Kernel + + +// TcpIp.h +// Header of TcpIp.c + +#ifndef TCPIP_H +#define TCPIP_H + +#ifdef OS_WIN32 +#pragma pack(push, 1) +#endif // OS_WIN32 + +// MTU when using of the PPPoE +#define MTU_FOR_PPPOE (1500 - 46) + +// MAC header +struct MAC_HEADER +{ + UCHAR DestAddress[6]; // Source MAC address + UCHAR SrcAddress[6]; // Destination MAC address + USHORT Protocol; // Protocol +} GCC_PACKED; + +// MAC protocol +#define MAC_PROTO_ARPV4 0x0806 // ARPv4 packet +#define MAC_PROTO_IPV4 0x0800 // IPv4 packets +#define MAC_PROTO_IPV6 0x86dd // IPv6 packets +#define MAC_PROTO_TAGVLAN 0x8100 // Tagged VLAN packets + +// LLC header +struct LLC_HEADER +{ + UCHAR Dsap; + UCHAR Ssap; + UCHAR Ctl; +} GCC_PACKED; + +// The value of the SSAP and the DSAP of the LLC header +#define LLC_DSAP_BPDU 0x42 +#define LLC_SSAP_BPDU 0x42 + +// BPDU header +struct BPDU_HEADER +{ + USHORT ProtocolId; // Protocol ID (STP == 0x0000) + UCHAR Version; // Version + UCHAR Type; // Type + UCHAR Flags; // Flag + USHORT RootPriority; // Priority of the root bridge + UCHAR RootMacAddress[6]; // MAC address of the root bridge + UINT RootPathCost; // Path cost to the root bridge + USHORT BridgePriority; // Priority of the outgoing bridge + UCHAR BridgeMacAddress[6]; // MAC address of the outgoing bridge + USHORT BridgePortId; // Port ID of the outgoing bridge + USHORT MessageAge; // Expiration date + USHORT MaxAge; // Maximum expiration date + USHORT HelloTime; // Hello Time + USHORT ForwardDelay; // Forward Delay +} GCC_PACKED; + +// ARPv4 header +struct ARPV4_HEADER +{ + USHORT HardwareType; // Hardware type + USHORT ProtocolType; // Protocol type + UCHAR HardwareSize; // Hardware size + UCHAR ProtocolSize; // Protocol size + USHORT Operation; // Operation + UCHAR SrcAddress[6]; // Source MAC address + UINT SrcIP; // Source IP address + UCHAR TargetAddress[6]; // Target MAC address + UINT TargetIP; // Target IP address +} GCC_PACKED; + +// ARP hardware type +#define ARP_HARDWARE_TYPE_ETHERNET 0x0001 + +// ARP operation type +#define ARP_OPERATION_REQUEST 1 +#define ARP_OPERATION_RESPONSE 2 + +// Tagged VLAN header +struct TAGVLAN_HEADER +{ + UCHAR Data[2]; // Data +} GCC_PACKED; + +// IPv4 header +struct IPV4_HEADER +{ + UCHAR VersionAndHeaderLength; // Version and header size + UCHAR TypeOfService; // Service Type + USHORT TotalLength; // Total size + USHORT Identification; // Identifier + UCHAR FlagsAndFragmentOffset[2]; // Flag and Fragment offset + UCHAR TimeToLive; // TTL + UCHAR Protocol; // Protocol + USHORT Checksum; // Checksum + UINT SrcIP; // Source IP address + UINT DstIP; // Destination IP address +} GCC_PACKED; + +// Macro for IPv4 header operation +#define IPV4_GET_VERSION(h) (((h)->VersionAndHeaderLength >> 4 & 0x0f)) +#define IPV4_SET_VERSION(h, v) ((h)->VersionAndHeaderLength |= (((v) & 0x0f) << 4)) +#define IPV4_GET_HEADER_LEN(h) ((h)->VersionAndHeaderLength & 0x0f) +#define IPV4_SET_HEADER_LEN(h, v) ((h)->VersionAndHeaderLength |= ((v) & 0x0f)) + +// Macro for IPv4 fragment related operation +#define IPV4_GET_FLAGS(h) (((h)->FlagsAndFragmentOffset[0] >> 5) & 0x07) +#define IPV4_SET_FLAGS(h, v) ((h)->FlagsAndFragmentOffset[0] |= (((v) & 0x07) << 5)) +#define IPV4_GET_OFFSET(h) (((h)->FlagsAndFragmentOffset[0] & 0x1f) * 256 + ((h)->FlagsAndFragmentOffset[1])) +#define IPV4_SET_OFFSET(h, v) {(h)->FlagsAndFragmentOffset[0] |= (UCHAR)((v) / 256); (h)->FlagsAndFragmentOffset[1] = (UCHAR)((v) % 256);} + +// IPv4 / IPv6 common protocol +#define IP_PROTO_TCP 0x06 // TCP protocol +#define IP_PROTO_UDP 0x11 // UDP protocol +#define IP_PROTO_ESP 50 // ESP protocol +#define IP_PROTO_ETHERIP 97 // EtherIP protocol +#define IP_PROTO_L2TPV3 115 // L2TPv3 protocol + + +// UDP header +struct UDP_HEADER +{ + USHORT SrcPort; // Source port number + USHORT DstPort; // Destination port number + USHORT PacketLength; // Data length + USHORT Checksum; // Checksum +} GCC_PACKED; + +// UDPv4 pseudo header +struct UDPV4_PSEUDO_HEADER +{ + UINT SrcIP; // Source IP address + UINT DstIP; // Destination IP address + UCHAR Reserved; // Unused + UCHAR Protocol; // Protocol number + USHORT PacketLength1; // UDP data length 1 + USHORT SrcPort; // Source port number + USHORT DstPort; // Destination port number + USHORT PacketLength2; // UDP data length 2 + USHORT Checksum; // Checksum +} GCC_PACKED; + +// IPv4 pseudo header +struct IPV4_PSEUDO_HEADER +{ + UINT SrcIP; // Source IP address + UINT DstIP; // Destination IP address + UCHAR Reserved; // Unused + UCHAR Protocol; // Protocol number + USHORT PacketLength; // Packet size +} GCC_PACKED; + +// TCP header +struct TCP_HEADER +{ + USHORT SrcPort; // Source port number + USHORT DstPort; // Destination port number + UINT SeqNumber; // Sequence number + UINT AckNumber; // Acknowledgment number + UCHAR HeaderSizeAndReserved; // Header size and Reserved area + UCHAR Flag; // Flag + USHORT WindowSize; // Window size + USHORT Checksum; // Checksum + USHORT UrgentPointer; // Urgent Pointer +} GCC_PACKED; + +// TCP macro +#define TCP_GET_HEADER_SIZE(h) (((h)->HeaderSizeAndReserved >> 4) & 0x0f) +#define TCP_SET_HEADER_SIZE(h, v) ((h)->HeaderSizeAndReserved = (((v) & 0x0f) << 4)) + +// TCP flags +#define TCP_FIN 1 +#define TCP_SYN 2 +#define TCP_RST 4 +#define TCP_PSH 8 +#define TCP_ACK 16 +#define TCP_URG 32 + +// ICMP header +struct ICMP_HEADER +{ + UCHAR Type; // Type + UCHAR Code; // Code + USHORT Checksum; // Checksum +} GCC_PACKED; + +// ICMP Echo +struct ICMP_ECHO +{ + USHORT Identifier; // ID + USHORT SeqNo; // Sequence number +} GCC_PACKED; + +// ICMP message type +#define ICMP_TYPE_ECHO_REQUEST 8 +#define ICMP_TYPE_ECHO_RESPONSE 0 +#define ICMP_TYPE_DESTINATION_UNREACHABLE 3 +#define ICMP_TYPE_TIME_EXCEEDED 11 +#define ICMP_TYPE_INFORMATION_REQUEST 15 +#define ICMP_TYPE_INFORMATION_REPLY 16 + +// ICMP message code +// In case of ICMP_TYPE_DESTINATION_UNREACHABLE +#define ICMP_CODE_NET_UNREACHABLE 0 +#define ICMP_CODE_HOST_UNREACHABLE 1 +#define ICMP_CODE_PROTOCOL_UNREACHABLE 2 +#define ICMP_CODE_PORT_UNREACHABLE 3 +#define ICMP_CODE_FRAGMENTATION_NEEDED_DF_SET 4 +#define ICMP_CODE_SOURCE_ROUTE_FAILED 5 + +// In case of TIME_EXCEEDED +#define ICMP_CODE_TTL_EXCEEDED_IN_TRANSIT 0 +#define ICMP_CODE_FRAGMENT_REASSEMBLY_TIME_EXCEEDED 1 + +// DHCPv4 Header +struct DHCPV4_HEADER +{ + UCHAR OpCode; // Op-code + UCHAR HardwareType; // Hardware type + UCHAR HardwareAddressSize; // Hardware address size + UCHAR Hops; // Number of hops + UINT TransactionId; // Transaction ID + USHORT Seconds; // Seconds + USHORT Flags; // Flag + UINT ClientIP; // Client IP address + UINT YourIP; // Assigned IP address + UINT ServerIP; // Server IP address + UINT RelayIP; // Relay IP address + UCHAR ClientMacAddress[6]; // Client MAC address + UCHAR Padding[10]; // Padding for non-Ethernet +} GCC_PACKED; + +// DNSv4 header +struct DNSV4_HEADER +{ + USHORT TransactionId; // Transaction ID + UCHAR Flag1; // Flag 1 + UCHAR Flag2; // Flag 2 + USHORT NumQuery; // Number of queries + USHORT AnswerRRs; // Answer RR number + USHORT AuthorityRRs; // Authority RR number + USHORT AdditionalRRs; // Additional RR number +} GCC_PACKED; + +#define DHCP_MAGIC_COOKIE 0x63825363 // Magic Cookie (fixed) + +// NetBIOS Datagram header +struct NBTDG_HEADER +{ + UCHAR MessageType; + UCHAR MoreFragments; + USHORT DatagramId; + UINT SrcIP; + USHORT SrcPort; + USHORT DatagramLen; + USHORT PacketOffset; +} GCC_PACKED; + +// IPv6 packet header information +struct IPV6_HEADER_PACKET_INFO +{ + IPV6_HEADER *IPv6Header; // IPv6 header + IPV6_OPTION_HEADER *HopHeader; // Hop-by-hop option header + UINT HopHeaderSize; // Hop-by-hop option header size + IPV6_OPTION_HEADER *EndPointHeader; // End point option header + UINT EndPointHeaderSize; // End point option header size + IPV6_OPTION_HEADER *RoutingHeader; // Routing header + UINT RoutingHeaderSize; // Routing header size + IPV6_FRAGMENT_HEADER *FragmentHeader; // Fragment header + void *Payload; // Payload + UINT PayloadSize; // Payload size + UCHAR Protocol; // Payload protocol + bool IsFragment; // Whether it's a fragmented packet + UINT TotalHeaderSize; // Total header size +}; + +// IPv6 header +struct IPV6_HEADER +{ + UCHAR VersionAndTrafficClass1; // Version Number (4 bit) and Traffic Class 1 (4 bit) + UCHAR TrafficClass2AndFlowLabel1; // Traffic Class 2 (4 bit) and Flow Label 1 (4 bit) + UCHAR FlowLabel2; // Flow Label 2 (8 bit) + UCHAR FlowLabel3; // Flow Label 3 (8 bit) + USHORT PayloadLength; // Length of the payload (including extension header) + UCHAR NextHeader; // Next header + UCHAR HopLimit; // Hop limit + IPV6_ADDR SrcAddress; // Source address + IPV6_ADDR DestAddress; // Destination address +} GCC_PACKED; + + +// Macro for IPv6 header operation +#define IPV6_GET_VERSION(h) (((h)->VersionAndTrafficClass1 >> 4) & 0x0f) +#define IPV6_SET_VERSION(h, v) ((h)->VersionAndTrafficClass1 = ((h)->VersionAndTrafficClass1 & 0x0f) | ((v) << 4) & 0xf0) +#define IPV6_GET_TRAFFIC_CLASS(h) ((((h)->VersionAndTrafficClass1 << 4) & 0xf0) | ((h)->TrafficClass2AndFlowLabel1 >> 4) & 0x0f) +#define IPV6_SET_TRAFFIC_CLASS(h, v) ((h)->VersionAndTrafficClass1 = ((h)->VersionAndTrafficClass1 & 0xf0) | (((v) >> 4) & 0x0f),\ + (h)->TrafficClass2AndFlowLabel1 = (h)->TrafficClass2AndFlowLabel1 & 0x0f | ((v) << 4) & 0xf0) +#define IPV6_GET_FLOW_LABEL(h) ((((h)->TrafficClass2AndFlowLabel1 << 16) & 0xf0000) | (((h)->FlowLabel2 << 8) & 0xff00) |\ + (((h)->FlowLabel3) & 0xff)) +#define IPV6_SET_FLOW_LABEL(h, v) ((h)->TrafficClass2AndFlowLabel1 = ((h)->TrafficClass2AndFlowLabel1 & 0xf0 | ((v) >> 16) & 0x0f),\ + (h)->FlowLabel2 = ((v) >> 8) & 0xff,\ + (h)->FlowLabel3 = (v) & 0xff) + + +// Maximum hops of IPv6 (not routing) +#define IPV6_HOP_MAX 255 + +// Standard hops of IPv6 +#define IPV6_HOP_DEFAULT 127 + +// IPv6 header number +#define IPV6_HEADER_HOP 0 // Hop-by-hop option header +#define IPV6_HEADER_ENDPOINT 60 // End point option header +#define IPV6_HEADER_ROUTING 43 // Routing header +#define IPV6_HEADER_FRAGMENT 44 // Fragment header +#define IPV6_HEADER_NONE 59 // No Next Header + +// IPv6 option header +// (Used on hop option header, end point option header, routing header) +struct IPV6_OPTION_HEADER +{ + UCHAR NextHeader; // Next header + UCHAR Size; // Header size (/8) +} GCC_PACKED; + +// IPv6 fragment header +// (fragment impossible part is until just before the routing header +// or hop-by-hop option header or first extended header or payload) +struct IPV6_FRAGMENT_HEADER +{ + UCHAR NextHeader; // Next header + UCHAR Reserved; // Reserved + UCHAR FragmentOffset1; // Fragment offset 1 (/8, 8 bit) + UCHAR FragmentOffset2AndFlags; // Fragment offset 2 (/8, 5 bit) + Reserved (2 bit) + More flag (1 bit) + UINT Identification; // ID +} GCC_PACKED; + +// Macro for IPv6 fragment header operation +#define IPV6_GET_FRAGMENT_OFFSET(h) (((((h)->FragmentOffset1) << 5) & 0x1fe0) | (((h)->FragmentOffset2AndFlags >> 3) & 0x1f)) +#define IPV6_SET_FRAGMENT_OFFSET(h, v) ((h)->FragmentOffset1 = (v / 32) & 0xff, \ + ((h)->FragmentOffset2AndFlags = ((v % 256) << 3) & 0xf8) | ((h)->FragmentOffset2AndFlags & 0x07)) +#define IPV6_GET_FLAGS(h) ((h)->FragmentOffset2AndFlags & 0x0f) +#define IPV6_SET_FLAGS(h, v) ((h)->FragmentOffset2AndFlags = (((h)->FragmentOffset2AndFlags & 0xf8) | (v & 0x07))) + +// Flag +#define IPV6_FRAGMENT_HEADER_FLAG_MORE_FRAGMENTS 0x01 // There are more fragments + +// Virtual IPv6 header +struct IPV6_PSEUDO_HEADER +{ + IPV6_ADDR SrcAddress; // Source address + IPV6_ADDR DestAddress; // Destination address + UINT UpperLayerPacketSize; // Upper layer packet size + UCHAR Padding[3]; // Padding + UCHAR NextHeader; // Next Header (TCP / UDP) +} GCC_PACKED; + +// ICMPv6 Router Solicitation header +struct ICMPV6_ROUTER_SOLICIATION_HEADER +{ + UINT Reserved; // Reserved + // + Option (source link-layer address [optional]) +} GCC_PACKED; + +// ICMPv6 Router Advertisement header +struct ICMPV6_ROUTER_ADVERTISEMENT_HEADER +{ + UCHAR CurHopLimit; // Hop limit of the default + UCHAR Flags; // Flag (0) + USHORT Lifetime; // Lifetime + UINT ReachableTime; // 0 + UINT RetransTimer; // 0 + // + Option (prefix information [required], MTU [optional]) +} GCC_PACKED; + +// ICMPv6 Neighbor Solicitation header +struct ICMPV6_NEIGHBOR_SOLICIATION_HEADER +{ + UINT Reserved; // Reserved + IPV6_ADDR TargetAddress; // Target address + // + Option (source link-layer address [required]) +} GCC_PACKED; + +// ICMPv6 Neighbor Advertisement header +struct ICMPV6_NEIGHBOR_ADVERTISEMENT_HEADER +{ + UCHAR Flags; // Flag + UCHAR Reserved[3]; // Reserved + IPV6_ADDR TargetAddress; // Target address + // + Option (target link-layer address) +} GCC_PACKED; + +#define ICMPV6_NEIGHBOR_ADVERTISEMENT_FLAG_ROUTER 0x80 // Router +#define ICMPV6_NEIGHBOR_ADVERTISEMENT_FLAG_SOLICITED 0x40 // Solicited flag +#define ICMPV6_NEIGHBOR_ADVERTISEMENT_FLAG_OVERWRITE 0x20 // Overwrite flag + +#define ICMPV6_OPTION_PREFIXES_MAX_COUNT 10 + +// ICMPv6 option list +struct ICMPV6_OPTION_LIST +{ + ICMPV6_OPTION_LINK_LAYER *SourceLinkLayer; // Source link-layer address + ICMPV6_OPTION_LINK_LAYER *TargetLinkLayer; // Target link-layer address + ICMPV6_OPTION_PREFIX *Prefix[ICMPV6_OPTION_PREFIXES_MAX_COUNT]; // Prefix Information - may be multiple in one request + ICMPV6_OPTION_MTU *Mtu; // MTU +} GCC_PACKED; + +// ICMPv6 option +struct ICMPV6_OPTION +{ + UCHAR Type; // Type + UCHAR Length; // Length (/8, include type and length) +} GCC_PACKED; + +#define ICMPV6_OPTION_TYPE_SOURCE_LINK_LAYER 1 // Source link-layer address +#define ICMPV6_OPTION_TYPE_TARGET_LINK_LAYER 2 // Target link-layer address +#define ICMPV6_OPTION_TYPE_PREFIX 3 // Prefix Information +#define ICMPV6_OPTION_TYPE_MTU 5 // MTU + +// ICMPv6 link layer options +struct ICMPV6_OPTION_LINK_LAYER +{ + ICMPV6_OPTION IcmpOptionHeader; // Option header + UCHAR Address[6]; // MAC address +} GCC_PACKED; + +// ICMPv6 prefix information option +struct ICMPV6_OPTION_PREFIX +{ + ICMPV6_OPTION IcmpOptionHeader; // Option header + UCHAR SubnetLength; // Subnet length + UCHAR Flags; // Flag + UINT ValidLifetime; // Formal lifetime + UINT PreferredLifetime; // Preferred lifetime + UINT Reserved; // Reserved + IPV6_ADDR Prefix; // Prefix address +} GCC_PACKED; + +#define ICMPV6_OPTION_PREFIX_FLAG_ONLINK 0x80 // On link +#define ICMPV6_OPTION_PREFIX_FLAG_AUTO 0x40 // Automatic + +// ICMPv6 MTU option +struct ICMPV6_OPTION_MTU +{ + ICMPV6_OPTION IcmpOptionHeader; // Option header + USHORT Reserved; // Reserved + UINT Mtu; // MTU value +} GCC_PACKED; + + +// IPv6 header information +struct IPV6_HEADER_INFO +{ + bool IsRawIpPacket; + USHORT Size; + UINT Id; + UCHAR Protocol; + UCHAR HopLimit; + IPV6_ADDR SrcIpAddress; + IPV6_ADDR DestIpAddress; + bool UnicastForMe; + bool UnicastForRouting; + bool UnicastForRoutingWithProxyNdp; + bool IsBroadcast; + UINT TypeL4; +}; + +// ICMPv6 header information +struct ICMPV6_HEADER_INFO +{ + UCHAR Type; + UCHAR Code; + USHORT DataSize; + void *Data; + ICMP_ECHO EchoHeader; + void *EchoData; + UINT EchoDataSize; + + union + { + // Meaning is determined by the value of the Type + ICMPV6_ROUTER_SOLICIATION_HEADER *RouterSoliciationHeader; + ICMPV6_ROUTER_ADVERTISEMENT_HEADER *RouterAdvertisementHeader; + ICMPV6_NEIGHBOR_SOLICIATION_HEADER *NeighborSoliciationHeader; + ICMPV6_NEIGHBOR_ADVERTISEMENT_HEADER *NeighborAdvertisementHeader; + void *HeaderPointer; + } Headers; + + ICMPV6_OPTION_LIST OptionList; +}; + +// The Type value of ICMPv6 +#define ICMPV6_TYPE_ECHO_REQUEST 128 // ICMPv6 Echo request +#define ICMPV6_TYPE_ECHO_RESPONSE 129 // ICMPv6 Echo response +#define ICMPV6_TYPE_ROUTER_SOLICIATION 133 // Router Solicitation +#define ICMPV6_TYPE_ROUTER_ADVERTISEMENT 134 // Router Advertisement +#define ICMPV6_TYPE_NEIGHBOR_SOLICIATION 135 // Neighbor Solicitation +#define ICMPV6_TYPE_NEIGHBOR_ADVERTISEMENT 136 // Neighbor Advertisement + +// Minimum DHCP packet size +#define DHCP_MIN_SIZE 300 + +// Constants about DHCP +#define DHCP_ID_MESSAGE_TYPE 0x35 +#define DHCP_ID_REQUEST_IP_ADDRESS 0x32 +#define DHCP_ID_HOST_NAME 0x0c +#define DHCP_ID_SERVER_ADDRESS 0x36 +#define DHCP_ID_LEASE_TIME 0x33 +#define DHCP_ID_DOMAIN_NAME 0x0f +#define DHCP_ID_SUBNET_MASK 0x01 +#define DHCP_ID_GATEWAY_ADDR 0x03 +#define DHCP_ID_DNS_ADDR 0x06 +#define DHCP_ID_WINS_ADDR 0x2C +#define DHCP_ID_CLIENT_ID 0x3d +#define DHCP_ID_VENDOR_ID 0x3c +#define DHCP_ID_REQ_PARAM_LIST 0x37 +#define DHCP_ID_USER_CLASS 0x4d +#define DHCP_ID_CLASSLESS_ROUTE 0x79 +#define DHCP_ID_MS_CLASSLESS_ROUTE 0xF9 +#define DHCP_ID_PRIVATE 0xFA + + +// DHCP client action +#define DHCP_DISCOVER 1 +#define DHCP_REQUEST 3 +#define DHCP_RELEASE 7 +#define DHCP_INFORM 8 + +// DHCP server action +#define DHCP_OFFER 2 +#define DHCP_DECLINE 4 +#define DHCP_ACK 5 +#define DHCP_NACK 6 + +// HTTPLOG data structure +struct HTTPLOG +{ + char Method[32]; // Method + char Hostname[MAX_HOST_NAME_LEN + 1]; // Host name + UINT Port; // Port number + char Path[MAX_SIZE]; // Path + char Protocol[64]; // Protocol + char UserAgent[MAX_SIZE]; // User Agent value + char Referer[MAX_SIZE]; // Referer + bool IsSsl; // Is SSL +}; + +// Packet +struct PKT +{ + UCHAR *PacketData; // Packet data body + UINT PacketSize; // Packet size + MAC_HEADER *MacHeader; // MAC header + UCHAR *MacAddressSrc; // Source MAC address + UCHAR *MacAddressDest; // Destination MAC address + bool BroadcastPacket; // Broadcast packet + bool InvalidSourcePacket; // Packet with an invalid source address + bool AccessChecked; // Packets that pass was confirmed by the access list + UINT VlanTypeID; // TypeID of the tagged VLAN (usually 0x8100) + UINT VlanId; // VLAN ID + UINT Delay; // Delay + UINT Jitter; // Jitter + UINT Loss; // Packet loss + UINT64 DelayedForwardTick; // Sending time in case of delayed + struct SESSION *DelayedSrcSession; // Source session + UINT TypeL3; // Layer-3 packet classification + IPV6_HEADER_PACKET_INFO IPv6HeaderPacketInfo; // IPv6 packet header information (only for TypeL3 == L3_IPV6) + ICMPV6_HEADER_INFO ICMPv6HeaderPacketInfo; // ICMPv6 header information (Only for TypeL4 == L4_ICMPV6) + UINT DhcpOpCode; // DHCP opcode + union + { + IPV4_HEADER *IPv4Header; // IPv4 header + ARPV4_HEADER *ARPv4Header; // ARPv4 header + IPV6_HEADER *IPv6Header; // IPv6 header + TAGVLAN_HEADER *TagVlanHeader; // Tag header + BPDU_HEADER *BpduHeader; // BPDU header + void *PointerL3; + } L3; + UINT TypeL4; // Layer-4 packet classification + UINT IPv4PayloadSize; // IPv4 payload size + void *IPv4PayloadData; // IPv4 payload data + union + { + UDP_HEADER *UDPHeader; // UDP header + TCP_HEADER *TCPHeader; // TCP header + ICMP_HEADER *ICMPHeader; // ICMP header + void *PointerL4; + } L4; + UINT TypeL7; // Layer-7 packet classification + union + { + DHCPV4_HEADER *DHCPv4Header; // DHCPv4 header + IKE_HEADER *IkeHeader; // IKE header + void *PointerL7; + } L7; + UCHAR *Payload; // Pointer to the payload of TCP or UDP + UINT PayloadSize; // Payload size + struct HTTPLOG *HttpLog; // HTTP log + char DnsQueryHost[64]; // DNS hostname +} GCC_PACKED; + +// Layer-3 packet classification +#define L3_UNKNOWN 0 // Unknown +#define L3_ARPV4 1 // ARPv4 packet +#define L3_IPV4 2 // IPv4 packet +#define L3_TAGVLAN 3 // Tagged VLAN packet +#define L3_BPDU 4 // BPDU packet +#define L3_IPV6 5 // IPv6 packet + +// Layer-4 packet classification +#define L4_UNKNOWN 0 // Unknown +#define L4_UDP 1 // UDPv4 packet +#define L4_TCP 2 // TCPv4 packet +#define L4_ICMPV4 3 // ICMPv4 packet +#define L4_ICMPV6 4 // ICMPv6 packet +#define L4_FRAGMENT 5 // Fragment packet + +// Layer-7 packet classification +#define L7_UNKNOWN 0 // Unknown +#define L7_DHCPV4 1 // DHCPv4 packet +#define L7_IKECONN 2 // IKE connection request packet +#define L7_OPENVPNCONN 3 // OpenVPN connection request packet +#define L7_DNS 4 // DNS packet + + +// IKE header +struct IKE_HEADER +{ + UINT64 InitiatorCookie; // Initiator cookie + UINT64 ResponderCookie; // Responder cookie + UCHAR NextPayload; // Next payload + UCHAR Version; // Version + UCHAR ExchangeType; // Exchange type + UCHAR Flag; // Flag + UINT MessageId; // Message ID + UINT MessageSize; // Message size +} GCC_PACKED; + +// IKE exchange type +#define IKE_EXCHANGE_TYPE_MAIN 2 // Main mode +#define IKE_EXCHANGE_TYPE_AGGRESSIVE 4 // Aggressive mode +#define IKE_EXCHANGE_TYPE_INFORMATION 5 // Information exchange +#define IKE_EXCHANGE_TYPE_QUICK 32 // Quick mode + +// DHCPv4 data +struct DHCPV4_DATA +{ + UCHAR *Data; + UINT Size; + IP SrcIP; + UINT SrcPort; + IP DestIP; + UINT DestPort; + UINT OpCode; + + UCHAR *OptionData; + UINT OptionSize; + + DHCPV4_HEADER *Header; + LIST *OptionList; + + struct DHCP_OPTION_LIST *ParsedOptionList; +}; +// DHCP Option +struct DHCP_OPTION +{ + UINT Id; // ID + UINT Size; // Size + void *Data; // Data +}; + +// DHCP classless static route entry +struct DHCP_CLASSLESS_ROUTE +{ + bool Exists; // Existing flag + IP Network; // Network address + IP SubnetMask; // Subnet mask + IP Gateway; // Gateway + UINT SubnetMaskLen; // Subnet mask length +}; + +#define MAX_DHCP_CLASSLESS_ROUTE_ENTRIES 64 +#define MAX_DHCP_CLASSLESS_ROUTE_TABLE_STR_SIZE 3200 + +// DHCP classless static route table +struct DHCP_CLASSLESS_ROUTE_TABLE +{ + UINT NumExistingRoutes; // Number of existing routing table entries + DHCP_CLASSLESS_ROUTE Entries[MAX_DHCP_CLASSLESS_ROUTE_ENTRIES]; // Entries +}; + +#define MAX_USER_CLASS_LEN 255 + +// DHCP option list +struct DHCP_OPTION_LIST +{ + // Common Item + UINT Opcode; // DHCP opcode + + // Client request + UINT RequestedIp; // Requested IP address + char Hostname[MAX_HOST_NAME_LEN + 1]; // Host name + char UserClass[MAX_USER_CLASS_LEN + 1]; // User class + // RFC3003 defines that User Class option is array of text strings, + // but the most popular DHCP clients and servers, + // i.e. ISC DHCP and Microsoft DHCP Server, consider it a text string + + // Server response + UINT ClientAddress; // Client address + UINT ServerAddress; // DHCP server address + UINT LeaseTime; // Lease time + char DomainName[MAX_HOST_NAME_LEN + 1]; // Domain name + UINT SubnetMask; // Subnet mask + UINT Gateway; // Gateway address + UINT DnsServer; // DNS server address 1 + UINT DnsServer2; // DNS server address 2 + UINT WinsServer; // WINS server address 1 + UINT WinsServer2; // WINS server address 2 + DHCP_CLASSLESS_ROUTE_TABLE ClasslessRoute; // Classless static routing table +}; + +// Modification option in the DHCP packet +struct DHCP_MODIFY_OPTION +{ + bool RemoveDefaultGatewayOnReply; // Remove the default gateway from the DHCP Reply +}; + +// Special IP address +#define SPECIAL_IPV4_ADDR_LLMNR_DEST 0xE00000FC // 224.0.0.252 + +// Special port +#define SPECIAL_UDP_PORT_LLMNR 5355 // LLMNR +#define SPECIAL_UDP_PORT_NBTNS 137 // NetBIOS Name Service +#define SPECIAL_UDP_PORT_NBTDGM 138 // NetBIOS Datagram +#define SPECIAL_UDP_PORT_WSD 3702 // WS-Discovery +#define SPECIAL_UDP_PORT_SSDP 1900 // SSDP + + +PKT *ParsePacketIPv4WithDummyMacHeader(UCHAR *buf, UINT size); +PKT *ParsePacket(UCHAR *buf, UINT size); +PKT *ParsePacketEx(UCHAR *buf, UINT size, bool no_l3); +PKT *ParsePacketEx2(UCHAR *buf, UINT size, bool no_l3, UINT vlan_type_id); +PKT *ParsePacketEx3(UCHAR *buf, UINT size, bool no_l3, UINT vlan_type_id, bool bridge_id_as_mac_address); +PKT *ParsePacketEx4(UCHAR *buf, UINT size, bool no_l3, UINT vlan_type_id, bool bridge_id_as_mac_address, bool no_http, bool correct_checksum); +PKT *ParsePacketEx5(UCHAR *buf, UINT size, bool no_l3, UINT vlan_type_id, bool bridge_id_as_mac_address, bool no_http, bool correct_checksum, bool no_l3_l4_except_icmpv6); +PKT *ParsePacketUpToICMPv6(UCHAR *buf, UINT size); +void FreePacket(PKT *p); +void FreePacketWithData(PKT *p); +void FreePacketIPv4(PKT *p); +void FreePacketTagVlan(PKT *p); +void FreePacketARPv4(PKT *p); +void FreePacketUDPv4(PKT *p); +void FreePacketTCPv4(PKT *p); +void FreePacketICMPv4(PKT *p); +void FreePacketDHCPv4(PKT *p); +bool ParsePacketL2Ex(PKT *p, UCHAR *buf, UINT size, bool no_l3, bool no_l3_l4_except_icmpv6); +bool ParsePacketARPv4(PKT *p, UCHAR *buf, UINT size); +bool ParsePacketIPv4(PKT *p, UCHAR *buf, UINT size); +bool ParsePacketBPDU(PKT *p, UCHAR *buf, UINT size); +bool ParsePacketTAGVLAN(PKT *p, UCHAR *buf, UINT size); +bool ParseICMPv4(PKT *p, UCHAR *buf, UINT size); +bool ParseICMPv6(PKT *p, UCHAR *buf, UINT size); +bool ParseTCP(PKT *p, UCHAR *buf, UINT size); +bool ParseUDP(PKT *p, UCHAR *buf, UINT size); +void ParseDHCPv4(PKT *p, UCHAR *buf, UINT size); +void ParseDNS(PKT *p, UCHAR *buf, UINT size); +PKT *ClonePacket(PKT *p, bool copy_data); +void FreeClonePacket(PKT *p); + +void CorrectChecksum(PKT *p); + +bool ParsePacketIPv6(PKT *p, UCHAR *buf, UINT size, bool no_l3_l4_except_icmpv6); +bool ParsePacketIPv6Header(IPV6_HEADER_PACKET_INFO *info, UCHAR *buf, UINT size); +bool ParseIPv6ExtHeader(IPV6_HEADER_PACKET_INFO *info, UCHAR next_header, UCHAR *buf, UINT size); +bool ParseICMPv6Options(ICMPV6_OPTION_LIST *o, UCHAR *buf, UINT size); +void CloneICMPv6Options(ICMPV6_OPTION_LIST *dst, ICMPV6_OPTION_LIST *src); +void FreeCloneICMPv6Options(ICMPV6_OPTION_LIST *o); +USHORT CalcChecksumForIPv4(UINT src_ip, UINT dst_ip, UCHAR protocol, void *data, UINT size, UINT real_size); +USHORT CalcChecksumForIPv6(IPV6_ADDR *src_ip, IPV6_ADDR *dest_ip, UCHAR protocol, void *data, UINT size, UINT real_size); +BUF *BuildICMPv6Options(ICMPV6_OPTION_LIST *o); +void BuildICMPv6OptionValue(BUF *b, UCHAR type, void *header_pointer, UINT total_size); +BUF *BuildIPv6(IPV6_ADDR *dest_ip, IPV6_ADDR *src_ip, UINT id, UCHAR protocol, UCHAR hop_limit, void *data, + UINT size); +BUF *BuildIPv6PacketHeader(IPV6_HEADER_PACKET_INFO *info, UINT *bytes_before_payload); +UCHAR IPv6GetNextHeaderFromQueue(QUEUE *q); +void BuildAndAddIPv6PacketOptionHeader(BUF *b, IPV6_OPTION_HEADER *opt, UCHAR next_header, UINT size); +BUF *BuildICMPv6NeighborSoliciation(IPV6_ADDR *src_ip, IPV6_ADDR *target_ip, UCHAR *my_mac_address, UINT id); +BUF *BuildICMPv6RouterSoliciation(IPV6_ADDR *src_ip, IPV6_ADDR *target_ip, UCHAR *my_mac_address, UINT id); +BUF *BuildICMPv6(IPV6_ADDR *src_ip, IPV6_ADDR *dest_ip, UCHAR hop_limit, UCHAR type, UCHAR code, void *data, UINT size, UINT id); + +bool VLanRemoveTag(void **packet_data, UINT *packet_size, UINT vlan_id, UINT vlan_tpid); +void VLanInsertTag(void **packet_data, UINT *packet_size, UINT vlan_id, UINT vlan_tpid); + +DHCPV4_DATA *ParseDHCPv4Data(PKT *pkt); +void FreeDHCPv4Data(DHCPV4_DATA *d); + +bool AdjustTcpMssL3(UCHAR *src, UINT src_size, UINT mss); +bool AdjustTcpMssL2(UCHAR *src, UINT src_size, UINT mss, USHORT tag_vlan_tpid); +UINT GetIpHeaderSize(UCHAR *src, UINT src_size); +bool ParseDnsQuery(char *name, UINT name_size, void *data, UINT data_size); +UCHAR GetNextByte(BUF *b); + +bool IsDhcpPacketForSpecificMac(UCHAR *data, UINT size, UCHAR *mac_address); + +ICMP_RESULT *IcmpParseResult(IP *dest_ip, USHORT src_id, USHORT src_seqno, UCHAR *recv_buffer, UINT recv_buffer_size); +void IcmpFreeResult(ICMP_RESULT *r); + +USHORT IpChecksum(void *buf, UINT size); +bool IpCheckChecksum(IPV4_HEADER *ip); + +LIST *BuildDhcpOption(DHCP_OPTION_LIST *opt); +DHCP_OPTION *NewDhcpOption(UINT id, void *data, UINT size); +DHCP_OPTION_LIST *ParseDhcpOptionList(void *data, UINT size); +DHCP_OPTION *GetDhcpOption(LIST *o, UINT id); +void FreeDhcpOptions(LIST *o); +LIST *ParseDhcpOptions(void *data, UINT size); +BUF *BuildDhcpOptionsBuf(LIST *o); +HTTPLOG *ParseHttpAccessLog(PKT *pkt); +HTTPLOG *ParseHttpsAccessLog(PKT *pkt); + +BUF *DhcpModify(DHCP_MODIFY_OPTION *m, void *data, UINT size); +BUF *DhcpModifyIPv4(DHCP_MODIFY_OPTION *m, void *data, UINT size); + +DHCP_CLASSLESS_ROUTE *GetBestClasslessRoute(DHCP_CLASSLESS_ROUTE_TABLE *t, IP *ip); +void DhcpParseClasslessRouteData(DHCP_CLASSLESS_ROUTE_TABLE *t, void *data, UINT size); +BUF *DhcpBuildClasslessRouteData(DHCP_CLASSLESS_ROUTE_TABLE *t); +bool ParseClasslessRouteStr(DHCP_CLASSLESS_ROUTE *r, char *str); +bool ParseClasslessRouteTableStr(DHCP_CLASSLESS_ROUTE_TABLE *d, char *str); +bool CheckClasslessRouteTableStr(char *str); +void BuildClasslessRouteStr(char *str, UINT str_size, DHCP_CLASSLESS_ROUTE *r); +void BuildClasslessRouteTableStr(char *str, UINT str_size, DHCP_CLASSLESS_ROUTE_TABLE *t); +bool NormalizeClasslessRouteTableStr(char *dst, UINT dst_size, char *src); + + + +#ifdef OS_WIN32 +#pragma pack(pop) +#endif // OS_WIN32 + +#endif // TCPIP_H + + diff --git a/src/Mayaqua/Tick64.c b/src/Mayaqua/Tick64.c index 71cecace..9446cda2 100644 --- a/src/Mayaqua/Tick64.c +++ b/src/Mayaqua/Tick64.c @@ -1,297 +1,297 @@ -// SoftEther VPN Source Code - Developer Edition Master Branch -// Mayaqua Kernel - - -// Tick64.c -// 64-bit real-time clock program - -#include - -#ifdef WIN32 -#include -#endif // WIN32 - -#include -#include -#include -#include -#include -#include -#include -#include -#include - -static TICK64 *tk64 = NULL; -static EVENT *halt_tick_event = NULL; - -// Get the high-resolution time -UINT64 TickHighres64() -{ - -#ifdef OS_WIN32 - - return (UINT64)(MsGetHiResTimeSpan(MsGetHiResCounter()) * 1000.0f); - -#else // OS_WIN32 - - return Tick64(); - -#endif // OS_WIN32 - -} - -// Convert the Tick value to time -UINT64 Tick64ToTime64(UINT64 tick) -{ - UINT64 ret = 0; - if (tick == 0) - { - return 0; - } - LockList(tk64->AdjustTime); - { - INT i; - for (i = ((INT)LIST_NUM(tk64->AdjustTime) - 1); i >= 0; i--) - { - ADJUST_TIME *t = LIST_DATA(tk64->AdjustTime, i); - if (t->Tick <= tick) - { - ret = t->Time + (tick - t->Tick); - break; - } - } - } - UnlockList(tk64->AdjustTime); - if (ret == 0) - { - ret++; - } - return ret; -} - -// Convert the Tick value to time -UINT64 TickToTime(UINT64 tick) -{ - return Tick64ToTime64(tick); -} - -// Get the Tick value -UINT64 Tick64() -{ -#ifdef OS_WIN32 - return Win32FastTick64(); -#else // OS_WIN32 - UINT64 tick64; - if (tk64 == NULL) - { - return 0; - } - Lock(tk64->TickLock); - { - tick64 = tk64->Tick; - } - Unlock(tk64->TickLock); - return tick64; -#endif // OS_WIN32 -} - -// Real-time clock measuring thread -void Tick64Thread(THREAD *thread, void *param) -{ - UINT n = 0; - bool first = false; - bool create_first_entry = true; - UINT tick_span; - // Validate arguments - if (thread == NULL) - { - return; - } - -#ifdef OS_WIN32 - - // Raise the priority of the Win32 thread - MsSetThreadPriorityRealtime(); - - tick_span = TICK64_SPAN_WIN32; - -#else // OS_WIN32 - - // Raise the priority of a POSIX threads - UnixSetThreadPriorityRealtime(); - - tick_span = TICK64_SPAN; - -#endif // OS_WIN32 - - while (true) - { - UINT tick; - UINT64 tick64; - -#ifndef OS_WIN32 - tick = TickRealtime(); // Get the current system clock - - if (tk64->LastTick > tick) - { - if ((tk64->LastTick - tick) >= (UINT64)0x0fffffff) - { - // The Tick has gone lap around - tk64->RoundCount++; - } - else - { - // tick skewed (System administrator might change hardware clock) - // Normally, the clock skew appears as sub-seconds error - tick = tk64->LastTick; - } - } - tk64->LastTick = tick; - - tick64 = (UINT64)tk64->RoundCount * (UINT64)4294967296LL + (UINT64)tick; - - Lock(tk64->TickLock); - { - if (tk64->TickStart == 0) - { - tk64->TickStart = tick64; - } - tick64 = tk64->Tick = tick64 - tk64->TickStart + (UINT64)1; - } - Unlock(tk64->TickLock); -#else // OS_WIN32 - tick64 = Win32FastTick64(); - tick = (UINT)tick64; -#endif // OS_WIN32 - - if (create_first_entry) - { - ADJUST_TIME *t = ZeroMalloc(sizeof(ADJUST_TIME)); - t->Tick = tick64; - t->Time = SystemTime64(); - tk64->Tick64WithTime64 = tick64; - tk64->Time64 = t->Time; - Add(tk64->AdjustTime, t); - - // Notify the completion of the initialization - NoticeThreadInit(thread); - create_first_entry = false; - } - - // Time correction - n += tick_span; - if (n >= 1000 || first == false) - { - UINT64 now = SystemTime64(); - - if (now < tk64->Time64 || - Diff64((now - tk64->Time64) + tk64->Tick64WithTime64, tick64) >= tick_span) - { - ADJUST_TIME *t = ZeroMalloc(sizeof(ADJUST_TIME)); - LockList(tk64->AdjustTime); - { - t->Tick = tick64; - t->Time = now; - Add(tk64->AdjustTime, t); - Debug("Adjust Time: Tick = %I64u, Time = %I64u\n", - t->Tick, t->Time); - - // To prevent consuming memory infinite on a system that clock is skewd - if (LIST_NUM(tk64->AdjustTime) > MAX_ADJUST_TIME) - { - // Remove the second - ADJUST_TIME *t2 = LIST_DATA(tk64->AdjustTime, 1); - - Delete(tk64->AdjustTime, t2); - - Debug("NUM_ADJUST TIME: %u\n", LIST_NUM(tk64->AdjustTime)); - - Free(t2); - } - } - UnlockList(tk64->AdjustTime); - tk64->Time64 = now; - tk64->Tick64WithTime64 = tick64; - } - first = true; - n = 0; - } - - if (tk64->Halt) - { - break; - } - -#ifdef OS_WIN32 - Wait(halt_tick_event, tick_span); -#else // OS_WIN32 - SleepThread(tick_span); -#endif // OS_WIN32 - } -} - -// Get the absolute value of the difference between the two 64 bit integers -UINT64 Diff64(UINT64 a, UINT64 b) -{ - if (a > b) - { - return a - b; - } - else - { - return b - a; - } -} - -// Initialization of the Tick64 -void InitTick64() -{ - if (tk64 != NULL) - { - // Already initialized - return; - } - - halt_tick_event = NewEvent(); - - // Initialize the structure - tk64 = ZeroMalloc(sizeof(TICK64)); - tk64->TickLock = NewLock(); - tk64->AdjustTime = NewList(NULL); - - // Creating a thread - tk64->Thread = NewThread(Tick64Thread, NULL); - WaitThreadInit(tk64->Thread); -} - -// Release of the Tick64 -void FreeTick64() -{ - UINT i; - if (tk64 == NULL) - { - // Uninitialized - return; - } - - // Termination process - tk64->Halt = true; - Set(halt_tick_event); - WaitThread(tk64->Thread, INFINITE); - ReleaseThread(tk64->Thread); - - // Releasing process - for (i = 0;i < LIST_NUM(tk64->AdjustTime);i++) - { - ADJUST_TIME *t = LIST_DATA(tk64->AdjustTime, i); - Free(t); - } - ReleaseList(tk64->AdjustTime); - DeleteLock(tk64->TickLock); - Free(tk64); - tk64 = NULL; - - ReleaseEvent(halt_tick_event); - halt_tick_event = NULL; -} - +// SoftEther VPN Source Code - Developer Edition Master Branch +// Mayaqua Kernel + + +// Tick64.c +// 64-bit real-time clock program + +#include + +#ifdef WIN32 +#include +#endif // WIN32 + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +static TICK64 *tk64 = NULL; +static EVENT *halt_tick_event = NULL; + +// Get the high-resolution time +UINT64 TickHighres64() +{ + +#ifdef OS_WIN32 + + return (UINT64)(MsGetHiResTimeSpan(MsGetHiResCounter()) * 1000.0f); + +#else // OS_WIN32 + + return Tick64(); + +#endif // OS_WIN32 + +} + +// Convert the Tick value to time +UINT64 Tick64ToTime64(UINT64 tick) +{ + UINT64 ret = 0; + if (tick == 0) + { + return 0; + } + LockList(tk64->AdjustTime); + { + INT i; + for (i = ((INT)LIST_NUM(tk64->AdjustTime) - 1); i >= 0; i--) + { + ADJUST_TIME *t = LIST_DATA(tk64->AdjustTime, i); + if (t->Tick <= tick) + { + ret = t->Time + (tick - t->Tick); + break; + } + } + } + UnlockList(tk64->AdjustTime); + if (ret == 0) + { + ret++; + } + return ret; +} + +// Convert the Tick value to time +UINT64 TickToTime(UINT64 tick) +{ + return Tick64ToTime64(tick); +} + +// Get the Tick value +UINT64 Tick64() +{ +#ifdef OS_WIN32 + return Win32FastTick64(); +#else // OS_WIN32 + UINT64 tick64; + if (tk64 == NULL) + { + return 0; + } + Lock(tk64->TickLock); + { + tick64 = tk64->Tick; + } + Unlock(tk64->TickLock); + return tick64; +#endif // OS_WIN32 +} + +// Real-time clock measuring thread +void Tick64Thread(THREAD *thread, void *param) +{ + UINT n = 0; + bool first = false; + bool create_first_entry = true; + UINT tick_span; + // Validate arguments + if (thread == NULL) + { + return; + } + +#ifdef OS_WIN32 + + // Raise the priority of the Win32 thread + MsSetThreadPriorityRealtime(); + + tick_span = TICK64_SPAN_WIN32; + +#else // OS_WIN32 + + // Raise the priority of a POSIX threads + UnixSetThreadPriorityRealtime(); + + tick_span = TICK64_SPAN; + +#endif // OS_WIN32 + + while (true) + { + UINT tick; + UINT64 tick64; + +#ifndef OS_WIN32 + tick = TickRealtime(); // Get the current system clock + + if (tk64->LastTick > tick) + { + if ((tk64->LastTick - tick) >= (UINT64)0x0fffffff) + { + // The Tick has gone lap around + tk64->RoundCount++; + } + else + { + // tick skewed (System administrator might change hardware clock) + // Normally, the clock skew appears as sub-seconds error + tick = tk64->LastTick; + } + } + tk64->LastTick = tick; + + tick64 = (UINT64)tk64->RoundCount * (UINT64)4294967296LL + (UINT64)tick; + + Lock(tk64->TickLock); + { + if (tk64->TickStart == 0) + { + tk64->TickStart = tick64; + } + tick64 = tk64->Tick = tick64 - tk64->TickStart + (UINT64)1; + } + Unlock(tk64->TickLock); +#else // OS_WIN32 + tick64 = Win32FastTick64(); + tick = (UINT)tick64; +#endif // OS_WIN32 + + if (create_first_entry) + { + ADJUST_TIME *t = ZeroMalloc(sizeof(ADJUST_TIME)); + t->Tick = tick64; + t->Time = SystemTime64(); + tk64->Tick64WithTime64 = tick64; + tk64->Time64 = t->Time; + Add(tk64->AdjustTime, t); + + // Notify the completion of the initialization + NoticeThreadInit(thread); + create_first_entry = false; + } + + // Time correction + n += tick_span; + if (n >= 1000 || first == false) + { + UINT64 now = SystemTime64(); + + if (now < tk64->Time64 || + Diff64((now - tk64->Time64) + tk64->Tick64WithTime64, tick64) >= tick_span) + { + ADJUST_TIME *t = ZeroMalloc(sizeof(ADJUST_TIME)); + LockList(tk64->AdjustTime); + { + t->Tick = tick64; + t->Time = now; + Add(tk64->AdjustTime, t); + Debug("Adjust Time: Tick = %I64u, Time = %I64u\n", + t->Tick, t->Time); + + // To prevent consuming memory infinite on a system that clock is skewd + if (LIST_NUM(tk64->AdjustTime) > MAX_ADJUST_TIME) + { + // Remove the second + ADJUST_TIME *t2 = LIST_DATA(tk64->AdjustTime, 1); + + Delete(tk64->AdjustTime, t2); + + Debug("NUM_ADJUST TIME: %u\n", LIST_NUM(tk64->AdjustTime)); + + Free(t2); + } + } + UnlockList(tk64->AdjustTime); + tk64->Time64 = now; + tk64->Tick64WithTime64 = tick64; + } + first = true; + n = 0; + } + + if (tk64->Halt) + { + break; + } + +#ifdef OS_WIN32 + Wait(halt_tick_event, tick_span); +#else // OS_WIN32 + SleepThread(tick_span); +#endif // OS_WIN32 + } +} + +// Get the absolute value of the difference between the two 64 bit integers +UINT64 Diff64(UINT64 a, UINT64 b) +{ + if (a > b) + { + return a - b; + } + else + { + return b - a; + } +} + +// Initialization of the Tick64 +void InitTick64() +{ + if (tk64 != NULL) + { + // Already initialized + return; + } + + halt_tick_event = NewEvent(); + + // Initialize the structure + tk64 = ZeroMalloc(sizeof(TICK64)); + tk64->TickLock = NewLock(); + tk64->AdjustTime = NewList(NULL); + + // Creating a thread + tk64->Thread = NewThread(Tick64Thread, NULL); + WaitThreadInit(tk64->Thread); +} + +// Release of the Tick64 +void FreeTick64() +{ + UINT i; + if (tk64 == NULL) + { + // Uninitialized + return; + } + + // Termination process + tk64->Halt = true; + Set(halt_tick_event); + WaitThread(tk64->Thread, INFINITE); + ReleaseThread(tk64->Thread); + + // Releasing process + for (i = 0;i < LIST_NUM(tk64->AdjustTime);i++) + { + ADJUST_TIME *t = LIST_DATA(tk64->AdjustTime, i); + Free(t); + } + ReleaseList(tk64->AdjustTime); + DeleteLock(tk64->TickLock); + Free(tk64); + tk64 = NULL; + + ReleaseEvent(halt_tick_event); + halt_tick_event = NULL; +} + diff --git a/src/Mayaqua/Tick64.h b/src/Mayaqua/Tick64.h index e212f8bf..a9072c95 100644 --- a/src/Mayaqua/Tick64.h +++ b/src/Mayaqua/Tick64.h @@ -1,54 +1,54 @@ -// SoftEther VPN Source Code - Developer Edition Master Branch -// Mayaqua Kernel - - -// Tick64.h -// Header of Tick64.c - -#ifndef TICK64_H -#define TICK64_H - -// Maximum number of correction list entries -#define MAX_ADJUST_TIME 1024 - -// Correction list entry -struct ADJUST_TIME -{ - UINT64 Tick; - UINT64 Time; -}; - -// TICK64 structure -struct TICK64 -{ - THREAD *Thread; - UINT64 Tick; - UINT64 TickStart; - UINT64 Time64; - UINT64 Tick64WithTime64; - UINT LastTick; - UINT RoundCount; - LOCK *TickLock; - volatile bool Halt; - LIST *AdjustTime; -}; - -// Constant -#define TICK64_SPAN 10 // Measurement interval (Usually less than 10ms) -#define TICK64_SPAN_WIN32 1000 // Interval of measurement on Win32 -#define TICK64_ADJUST_SPAN 5000 // Correct the clock if it shifts more than this value - -// Function prototype -void InitTick64(); -void FreeTick64(); -void Tick64Thread(THREAD *thread, void *param); -UINT64 Tick64(); -UINT64 Diff64(UINT64 a, UINT64 b); -UINT64 Tick64ToTime64(UINT64 tick); -UINT64 TickToTime(UINT64 tick); -UINT64 TickHighres64(); - -#endif // TICK64_H - - - +// SoftEther VPN Source Code - Developer Edition Master Branch +// Mayaqua Kernel + + +// Tick64.h +// Header of Tick64.c + +#ifndef TICK64_H +#define TICK64_H + +// Maximum number of correction list entries +#define MAX_ADJUST_TIME 1024 + +// Correction list entry +struct ADJUST_TIME +{ + UINT64 Tick; + UINT64 Time; +}; + +// TICK64 structure +struct TICK64 +{ + THREAD *Thread; + UINT64 Tick; + UINT64 TickStart; + UINT64 Time64; + UINT64 Tick64WithTime64; + UINT LastTick; + UINT RoundCount; + LOCK *TickLock; + volatile bool Halt; + LIST *AdjustTime; +}; + +// Constant +#define TICK64_SPAN 10 // Measurement interval (Usually less than 10ms) +#define TICK64_SPAN_WIN32 1000 // Interval of measurement on Win32 +#define TICK64_ADJUST_SPAN 5000 // Correct the clock if it shifts more than this value + +// Function prototype +void InitTick64(); +void FreeTick64(); +void Tick64Thread(THREAD *thread, void *param); +UINT64 Tick64(); +UINT64 Diff64(UINT64 a, UINT64 b); +UINT64 Tick64ToTime64(UINT64 tick); +UINT64 TickToTime(UINT64 tick); +UINT64 TickHighres64(); + +#endif // TICK64_H + + + diff --git a/src/Mayaqua/Tracking.c b/src/Mayaqua/Tracking.c index 884c10b2..6f48aa95 100644 --- a/src/Mayaqua/Tracking.c +++ b/src/Mayaqua/Tracking.c @@ -1,871 +1,871 @@ -// SoftEther VPN Source Code - Developer Edition Master Branch -// Mayaqua Kernel - - -// Tracking.c -// Object tracking module - -#include - -#include -#include -#include -#include -#include -#include -#include -#include - -// Global variables -static LOCK *obj_lock; -static LOCK *obj_id_lock; -static UINT obj_id; -static LOCK *cs_lock; -static TRACKING_LIST **hashlist; - -static bool do_not_get_callstack; - -// Get whether the tracking is enabled -bool IsTrackingEnabled() -{ - return (IsDebug() || IsMemCheck()) && kernel_status_inited; -} - -// Memory debug menu -void MemoryDebugMenu() -{ - char tmp[MAX_SIZE]; - TOKEN_LIST *t; - char *cmd; - Print("Mayaqua Kernel Memory Debug Tools\n" - "Copyright (c) SoftEther VPN Project. All Rights Reserved.\n\n"); - -#ifndef OS_WIN32 - Print("Unfortunately The call stack is not recorded on non-Windows systems\n"); - Print("since UnixGetCallStack() and UnixGetCallStackSymbolInfo() is not implemented.\n"); - Print("Therefore please use valgrind or other memory leak check tools\n"); - Print("to get the actual call stacks of memory leak causes.\n\n"); -#endif // OS_WIN32 - - g_memcheck = false; - while (true) - { - Print("debug>"); - GetLine(tmp, sizeof(tmp)); - t = ParseToken(tmp, " \t"); - if (t->NumTokens == 0) - { - FreeToken(t); - DebugPrintAllObjects(); - continue; - } - cmd = t->Token[0]; - if (!StrCmpi(cmd, "?")) - { - DebugPrintCommandList(); - } - else if (!StrCmpi(cmd, "a")) - { - DebugPrintAllObjects(); - } - else if (!StrCmpi(cmd, "i")) - { - if (t->NumTokens == 1) - { - Print("Usage: i \n\n"); - } - else - { - DebugPrintObjectInfo(ToInt(t->Token[1])); - } - } - else if (!StrCmpi(cmd, "q")) - { - break; - } - else if (ToInt(cmd) != 0) - { - DebugPrintObjectInfo(ToInt(t->Token[0])); - } - else - { - Print("Command Not Found,\n\n"); - } - FreeToken(t); - } - FreeToken(t); - g_memcheck = true; -} - -// Sort the objects by chronological order -int SortObjectView(void *p1, void *p2) -{ - TRACKING_OBJECT *o1, *o2; - if (p1 == NULL || p2 == NULL) - { - return 0; - } - o1 = *(TRACKING_OBJECT **)p1; - o2 = *(TRACKING_OBJECT **)p2; - if (o1 == NULL || o2 == NULL) - { - return 0; - } - - if (o1->Id > o2->Id) - { - return 1; - } - else if (o1->Id == o2->Id) - { - return 0; - } - return -1; -} - -// Display the information of the object -void PrintObjectInfo(TRACKING_OBJECT *o) -{ - SYSTEMTIME t; - char tmp[MAX_SIZE]; - // Validate arguments - if (o == NULL) - { - return; - } - - UINT64ToSystem(&t, o->CreatedDate); - GetDateTimeStrMilli(tmp, sizeof(tmp), &t); - - Print(" TRACKING_OBJECT ID: %u\n" - " TRACKING_OBJECT TYPE: %s\n" - " ADDRESS: 0x%p\n" - " TRACKING_OBJECT SIZE: %u bytes\n" - " CREATED DATE: %s\n", - o->Id, o->Name, UINT64_TO_POINTER(o->Address), o->Size, tmp); - - PrintCallStack(o->CallStack); -} - -// Display the object information -void DebugPrintObjectInfo(UINT id) -{ - UINT i; - TRACKING_OBJECT *o; - - // Search - o = NULL; - LockTrackingList(); - { - for (i = 0;i < TRACKING_NUM_ARRAY;i++) - { - if (hashlist[i] != NULL) - { - TRACKING_LIST *t = hashlist[i]; - - while (true) - { - if (t->Object->Id == id) - { - o = t->Object; - break; - } - - if (t->Next == NULL) - { - break; - } - - t = t->Next; - } - - if (o != NULL) - { - break; - } - } - } - } - UnlockTrackingList(); - - if (o == NULL) - { - // The ID could not be found - Print("obj_id %u Not Found.\n\n", id); - return; - } - - PrintObjectInfo(o); - Print("\n"); -} - -// Show a Summary of the object -void PrintObjectList(TRACKING_OBJECT *o) -{ - char tmp[MAX_SIZE]; - SYSTEMTIME t; - UINT64ToSystem(&t, o->CreatedDate); - GetTimeStrMilli(tmp, sizeof(tmp), &t); - TrackGetObjSymbolInfo(o); - Print("%-4u - [%-6s] %s 0x%p size=%-5u %11s %u\n", - o->Id, o->Name, tmp, UINT64_TO_POINTER(o->Address), o->Size, o->FileName, o->LineNumber); -} - -// Display all the objects -void DebugPrintAllObjects() -{ - UINT i; - LIST *view; - - // Creating a List - view = NewListFast(SortObjectView); - LockTrackingList(); - { - for (i = 0;i < TRACKING_NUM_ARRAY;i++) - { - if (hashlist[i] != NULL) - { - TRACKING_LIST *t = hashlist[i]; - - while (true) - { - Add(view, t->Object); - - if (t->Next == NULL) - { - break; - } - - t = t->Next; - } - } - } - } - UnlockTrackingList(); - - // Sort - Sort(view); - - // Drawing - for (i = 0;i < LIST_NUM(view);i++) - { - TRACKING_OBJECT *o = (TRACKING_OBJECT *)LIST_DATA(view, i); - PrintObjectList(o); - } - - // Release the list - ReleaseList(view); - - Print("\n"); -} - -// List of the commands -void DebugPrintCommandList() -{ - Print( - "a - All Objects\n" - "i - Object Information\n" - "? - Help\n" - "q - Quit\n\n" - ); -} - -// Display the usage of the memory -void PrintMemoryStatus() -{ - MEMORY_STATUS s; - GetMemoryStatus(&s); - Print("MEMORY STATUS:\n" - " NUM_OF_MEMORY_BLOCKS: %u\n" - " SIZE_OF_TOTAL_MEMORY: %u bytes\n", - s.MemoryBlocksNum, s.MemorySize); -} - -// Get the using state of the memory -void GetMemoryStatus(MEMORY_STATUS *status) -{ - UINT i, num, size; - // Validate arguments - if (status == NULL) - { - return; - } - - LockTrackingList(); - { - size = num = 0; - - for (i = 0;i < TRACKING_NUM_ARRAY;i++) - { - if (hashlist[i] != NULL) - { - TRACKING_LIST *t = hashlist[i]; - - while (true) - { - TRACKING_OBJECT *o = t->Object; - - if (StrCmpi(o->Name, "MEM") == 0) - { - num++; - size += o->Size; - } - - if (t->Next == NULL) - { - break; - } - - t = t->Next; - } - } - } - } - UnlockTrackingList(); - - status->MemoryBlocksNum = num; - status->MemorySize = size; -} - -// Get the symbol information by the object -void TrackGetObjSymbolInfo(TRACKING_OBJECT *o) -{ - // Validate arguments - if (o == NULL) - { - return; - } - - if (!(o->LineNumber == 0 && o->FileName[0] == 0)) - { - return; - } - - if (o->CallStack != NULL) - { - GetCallStackSymbolInfo(o->CallStack); - if (StrLen(o->CallStack->filename) != 0 && o->CallStack->line != 0) - { - StrCpy(o->FileName, sizeof(o->FileName), o->CallStack->filename); - o->LineNumber = o->CallStack->line; - } - } -} - -// Put a new object into the tracking list -void TrackNewObj(UINT64 addr, char *name, UINT size) -{ - TRACKING_OBJECT *o; - UINT new_id; - // Validate arguments - if (addr == 0 || name == NULL) - { - return; - } - - if ((IsTrackingEnabled() && IsMemCheck()) == false) - { - // Don't track in detail if the memory check option is not specified - return; - } - - // Generate a new ID - OSLock(obj_id_lock); - { - new_id = ++obj_id; - } - OSUnlock(obj_id_lock); - - o = OSMemoryAlloc(sizeof(TRACKING_OBJECT)); - o->Id = new_id; - o->Address = addr; - o->Name = name; - o->Size = size; - o->CreatedDate = LocalTime64(); - o->CallStack = WalkDownCallStack(GetCallStack(), 2); - - o->FileName[0] = 0; - o->LineNumber = 0; - - LockTrackingList(); - { - InsertTrackingList(o); - } - UnlockTrackingList(); -} - -// Remove the object from the tracking list -void TrackDeleteObj(UINT64 addr) -{ - TRACKING_OBJECT *o; - // Validate arguments - if (addr == 0) - { - return; - } - - if ((IsTrackingEnabled() && IsMemCheck()) == false) - { - // Don't track in detail if the memory check option is not specified - return; - } - - LockTrackingList(); - { - o = SearchTrackingList(addr); - if (o == NULL) - { - UnlockTrackingList(); - Debug("TrackDeleteObj(): 0x%x not found in tracking list!\n", addr); - return; - } - DeleteTrackingList(o, true); - } - UnlockTrackingList(); -} - -// Change the size of the object being tracked -void TrackChangeObjSize(UINT64 addr, UINT size, UINT64 new_addr) -{ - TRACKING_OBJECT *o; - // Validate arguments - if (addr == 0) - { - return; - } - - if ((IsTrackingEnabled() && IsMemCheck()) == false) - { - // Don't track in detail if the memory check option is not specified - return; - } - - LockTrackingList(); - { - o = SearchTrackingList(addr); - if (o == NULL) - { - UnlockTrackingList(); - return; - } - - DeleteTrackingList(o, false); - - o->Size = size; - o->Address = new_addr; - - InsertTrackingList(o); - } - UnlockTrackingList(); -} - -// Memory address comparison function -int CompareTrackingObject(const void *p1, const void *p2) -{ - TRACKING_OBJECT *o1, *o2; - // Validate arguments - if (p1 == NULL || p2 == NULL) - { - return 0; - } - o1 = *(TRACKING_OBJECT **)p1; - o2 = *(TRACKING_OBJECT **)p2; - if (o1 == NULL || o2 == NULL) - { - return 0; - } - - if (o1->Address > o2->Address) - { - return 1; - } - if (o1->Address == o2->Address) - { - return 0; - } - return -1; -} - -// Search an object in the tracking list -TRACKING_OBJECT *SearchTrackingList(UINT64 Address) -{ - UINT i; - // Validate arguments - if (Address == 0) - { - return NULL; - } - - i = TRACKING_HASH(Address); - - if (hashlist[i] != NULL) - { - TRACKING_LIST *tt = hashlist[i]; - - while (true) - { - if (tt->Object->Address == Address) - { - return tt->Object; - } - - tt = tt->Next; - - if (tt == NULL) - { - break; - } - } - } - - return NULL; -} - -// Remove an object from a tracking list -void DeleteTrackingList(TRACKING_OBJECT *o, bool free_object_memory) -{ - UINT i; - // Validate arguments - if (o == NULL) - { - return; - } - - i = TRACKING_HASH(o->Address); - - if (hashlist[i] != NULL) - { - TRACKING_LIST *ft = NULL; - - if (hashlist[i]->Object == o) - { - ft = hashlist[i]; - hashlist[i] = hashlist[i]->Next; - } - else - { - TRACKING_LIST *tt = hashlist[i]; - TRACKING_LIST *prev = NULL; - - while (true) - { - if (tt->Object == o) - { - prev->Next = tt->Next; - ft = tt; - break; - } - - if (tt->Next == NULL) - { - break; - } - - prev = tt; - tt = tt->Next; - } - } - - if (ft != NULL) - { - OSMemoryFree(ft); - - if (free_object_memory) - { - FreeCallStack(o->CallStack); - OSMemoryFree(o); - } - } - } -} - -// Insert an object into the tracking list -void InsertTrackingList(TRACKING_OBJECT *o) -{ - UINT i; - TRACKING_LIST *t; - // Validate arguments - if (o == NULL) - { - return; - } - - t = OSMemoryAlloc(sizeof(TRACKING_LIST)); - t->Object = o; - t->Next = NULL; - - i = TRACKING_HASH(o->Address); - - if (hashlist[i] == NULL) - { - hashlist[i] = t; - } - else - { - TRACKING_LIST *tt = hashlist[i]; - while (true) - { - if (tt->Next == NULL) - { - tt->Next = t; - break; - } - - tt = tt->Next; - } - } -} - -// Lock the tracking list -void LockTrackingList() -{ - OSLock(obj_lock); -} - -// Unlock the tracking list -void UnlockTrackingList() -{ - OSUnlock(obj_lock); -} - -// Initialize the tracking -void InitTracking() -{ - UINT i; - CALLSTACK_DATA *s; - - // Hash list initialization - hashlist = (TRACKING_LIST **)OSMemoryAlloc(sizeof(TRACKING_LIST *) * TRACKING_NUM_ARRAY); - - for (i = 0;i < TRACKING_NUM_ARRAY;i++) - { - hashlist[i] = NULL; - } - - obj_id = 0; - - // Create a lock - obj_lock = OSNewLock(); - obj_id_lock = OSNewLock(); - cs_lock = OSNewLock(); - - s = GetCallStack(); - if (s == NULL) - { - do_not_get_callstack = true; - } - else - { - do_not_get_callstack = false; - FreeCallStack(s); - } -} - -// Release the tracking -void FreeTracking() -{ - UINT i; - // Delete the lock - OSDeleteLock(obj_lock); - OSDeleteLock(obj_id_lock); - OSDeleteLock(cs_lock); - cs_lock = NULL; - obj_id_lock = NULL; - obj_lock = NULL; - - // Release all of the elements - for (i = 0;i < TRACKING_NUM_ARRAY;i++) - { - if (hashlist[i] != NULL) - { - TRACKING_LIST *t = hashlist[i]; - - while (true) - { - TRACKING_LIST *t2 = t; - TRACKING_OBJECT *o = t->Object; - - FreeCallStack(o->CallStack); - OSMemoryFree(o); - - t = t->Next; - - OSMemoryFree(t2); - - if (t == NULL) - { - break; - } - } - } - } - - // Release the list - OSMemoryFree(hashlist); -} - -// Show the call stack -void PrintCallStack(CALLSTACK_DATA *s) -{ - char tmp[MAX_SIZE * 2]; - - GetCallStackStr(tmp, sizeof(tmp), s); - Print("%s", tmp); -} - -// Convert the call stack to a string -void GetCallStackStr(char *str, UINT size, CALLSTACK_DATA *s) -{ - char tmp[MAX_SIZE]; - char tmp2[MAX_SIZE]; - char tmp3[MAX_SIZE]; - UINT num, i; - // Validate arguments - if (str == NULL) - { - return; - } - - if (s == NULL) - { - StrCpy(str, size, "(Unknown)\n"); - } - else - { - num = 0; - str[0] = 0; - while (true) - { - if (s == NULL) - { - break; - } - - GetCallStackSymbolInfo(s); - - if (s->name == NULL) - { - Format(tmp, sizeof(tmp), "0x%02x ---", UINT64_TO_POINTER(s->offset)); - } - else - { - Format(tmp, sizeof(tmp), "0x%p %s() + 0x%02x", - (void *)s->offset, s->name, UINT64_TO_POINTER(s->disp)); - } - for (i = 0;i < num;i++) - { - tmp2[i] = ' '; - } - tmp2[i] = '\0'; - StrCpy(tmp3, sizeof(tmp3), tmp2); - StrCat(tmp3, sizeof(tmp3), tmp); - Format(tmp, sizeof(tmp), "%-55s %11s %u\n", tmp3, s->filename, s->line); - StrCat(str, size, tmp); - num++; - s = s->next; - } - } -} - -// Get the current call stack -CALLSTACK_DATA *GetCallStack() -{ - CALLSTACK_DATA *s; - if (do_not_get_callstack) - { - // Not to get the call stack - return NULL; - } - - OSLock(cs_lock); - { - // Get the call stack - s = OSGetCallStack(); - } - OSUnlock(cs_lock); - if (s == NULL) - { - return NULL; - } - - // Descend in the call stack for 3 steps - s = WalkDownCallStack(s, 3); - - return s; -} - -// Get the symbol information of the call stack -bool GetCallStackSymbolInfo(CALLSTACK_DATA *s) -{ - bool ret; - // Validate arguments - if (s == NULL) - { - return false; - } - - OSLock(cs_lock); - { - ret = OSGetCallStackSymbolInfo(s); - } - OSUnlock(cs_lock); - - return ret; -} - -// Descend in the call stack by a specified number -CALLSTACK_DATA *WalkDownCallStack(CALLSTACK_DATA *s, UINT num) -{ - CALLSTACK_DATA *cs, *tmp; - UINT i; - // Validate arguments - if (s == NULL) - { - return NULL; - } - - cs = s; - i = 0; - - while (true) - { - if (i >= num) - { - return cs; - } - i++; - tmp = cs; - cs = tmp->next; - OSMemoryFree(tmp->name); - OSMemoryFree(tmp); - - if (cs == NULL) - { - return NULL; - } - } -} - -// Release the call stack -void FreeCallStack(CALLSTACK_DATA *s) -{ - // Validate arguments - if (s == NULL) - { - return; - } - - while (true) - { - CALLSTACK_DATA *next = s->next; - OSMemoryFree(s->name); - OSMemoryFree(s); - if (next == NULL) - { - break; - } - s = next; - } -} - - +// SoftEther VPN Source Code - Developer Edition Master Branch +// Mayaqua Kernel + + +// Tracking.c +// Object tracking module + +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +// Global variables +static LOCK *obj_lock; +static LOCK *obj_id_lock; +static UINT obj_id; +static LOCK *cs_lock; +static TRACKING_LIST **hashlist; + +static bool do_not_get_callstack; + +// Get whether the tracking is enabled +bool IsTrackingEnabled() +{ + return (IsDebug() || IsMemCheck()) && kernel_status_inited; +} + +// Memory debug menu +void MemoryDebugMenu() +{ + char tmp[MAX_SIZE]; + TOKEN_LIST *t; + char *cmd; + Print("Mayaqua Kernel Memory Debug Tools\n" + "Copyright (c) SoftEther VPN Project. All Rights Reserved.\n\n"); + +#ifndef OS_WIN32 + Print("Unfortunately The call stack is not recorded on non-Windows systems\n"); + Print("since UnixGetCallStack() and UnixGetCallStackSymbolInfo() is not implemented.\n"); + Print("Therefore please use valgrind or other memory leak check tools\n"); + Print("to get the actual call stacks of memory leak causes.\n\n"); +#endif // OS_WIN32 + + g_memcheck = false; + while (true) + { + Print("debug>"); + GetLine(tmp, sizeof(tmp)); + t = ParseToken(tmp, " \t"); + if (t->NumTokens == 0) + { + FreeToken(t); + DebugPrintAllObjects(); + continue; + } + cmd = t->Token[0]; + if (!StrCmpi(cmd, "?")) + { + DebugPrintCommandList(); + } + else if (!StrCmpi(cmd, "a")) + { + DebugPrintAllObjects(); + } + else if (!StrCmpi(cmd, "i")) + { + if (t->NumTokens == 1) + { + Print("Usage: i \n\n"); + } + else + { + DebugPrintObjectInfo(ToInt(t->Token[1])); + } + } + else if (!StrCmpi(cmd, "q")) + { + break; + } + else if (ToInt(cmd) != 0) + { + DebugPrintObjectInfo(ToInt(t->Token[0])); + } + else + { + Print("Command Not Found,\n\n"); + } + FreeToken(t); + } + FreeToken(t); + g_memcheck = true; +} + +// Sort the objects by chronological order +int SortObjectView(void *p1, void *p2) +{ + TRACKING_OBJECT *o1, *o2; + if (p1 == NULL || p2 == NULL) + { + return 0; + } + o1 = *(TRACKING_OBJECT **)p1; + o2 = *(TRACKING_OBJECT **)p2; + if (o1 == NULL || o2 == NULL) + { + return 0; + } + + if (o1->Id > o2->Id) + { + return 1; + } + else if (o1->Id == o2->Id) + { + return 0; + } + return -1; +} + +// Display the information of the object +void PrintObjectInfo(TRACKING_OBJECT *o) +{ + SYSTEMTIME t; + char tmp[MAX_SIZE]; + // Validate arguments + if (o == NULL) + { + return; + } + + UINT64ToSystem(&t, o->CreatedDate); + GetDateTimeStrMilli(tmp, sizeof(tmp), &t); + + Print(" TRACKING_OBJECT ID: %u\n" + " TRACKING_OBJECT TYPE: %s\n" + " ADDRESS: 0x%p\n" + " TRACKING_OBJECT SIZE: %u bytes\n" + " CREATED DATE: %s\n", + o->Id, o->Name, UINT64_TO_POINTER(o->Address), o->Size, tmp); + + PrintCallStack(o->CallStack); +} + +// Display the object information +void DebugPrintObjectInfo(UINT id) +{ + UINT i; + TRACKING_OBJECT *o; + + // Search + o = NULL; + LockTrackingList(); + { + for (i = 0;i < TRACKING_NUM_ARRAY;i++) + { + if (hashlist[i] != NULL) + { + TRACKING_LIST *t = hashlist[i]; + + while (true) + { + if (t->Object->Id == id) + { + o = t->Object; + break; + } + + if (t->Next == NULL) + { + break; + } + + t = t->Next; + } + + if (o != NULL) + { + break; + } + } + } + } + UnlockTrackingList(); + + if (o == NULL) + { + // The ID could not be found + Print("obj_id %u Not Found.\n\n", id); + return; + } + + PrintObjectInfo(o); + Print("\n"); +} + +// Show a Summary of the object +void PrintObjectList(TRACKING_OBJECT *o) +{ + char tmp[MAX_SIZE]; + SYSTEMTIME t; + UINT64ToSystem(&t, o->CreatedDate); + GetTimeStrMilli(tmp, sizeof(tmp), &t); + TrackGetObjSymbolInfo(o); + Print("%-4u - [%-6s] %s 0x%p size=%-5u %11s %u\n", + o->Id, o->Name, tmp, UINT64_TO_POINTER(o->Address), o->Size, o->FileName, o->LineNumber); +} + +// Display all the objects +void DebugPrintAllObjects() +{ + UINT i; + LIST *view; + + // Creating a List + view = NewListFast(SortObjectView); + LockTrackingList(); + { + for (i = 0;i < TRACKING_NUM_ARRAY;i++) + { + if (hashlist[i] != NULL) + { + TRACKING_LIST *t = hashlist[i]; + + while (true) + { + Add(view, t->Object); + + if (t->Next == NULL) + { + break; + } + + t = t->Next; + } + } + } + } + UnlockTrackingList(); + + // Sort + Sort(view); + + // Drawing + for (i = 0;i < LIST_NUM(view);i++) + { + TRACKING_OBJECT *o = (TRACKING_OBJECT *)LIST_DATA(view, i); + PrintObjectList(o); + } + + // Release the list + ReleaseList(view); + + Print("\n"); +} + +// List of the commands +void DebugPrintCommandList() +{ + Print( + "a - All Objects\n" + "i - Object Information\n" + "? - Help\n" + "q - Quit\n\n" + ); +} + +// Display the usage of the memory +void PrintMemoryStatus() +{ + MEMORY_STATUS s; + GetMemoryStatus(&s); + Print("MEMORY STATUS:\n" + " NUM_OF_MEMORY_BLOCKS: %u\n" + " SIZE_OF_TOTAL_MEMORY: %u bytes\n", + s.MemoryBlocksNum, s.MemorySize); +} + +// Get the using state of the memory +void GetMemoryStatus(MEMORY_STATUS *status) +{ + UINT i, num, size; + // Validate arguments + if (status == NULL) + { + return; + } + + LockTrackingList(); + { + size = num = 0; + + for (i = 0;i < TRACKING_NUM_ARRAY;i++) + { + if (hashlist[i] != NULL) + { + TRACKING_LIST *t = hashlist[i]; + + while (true) + { + TRACKING_OBJECT *o = t->Object; + + if (StrCmpi(o->Name, "MEM") == 0) + { + num++; + size += o->Size; + } + + if (t->Next == NULL) + { + break; + } + + t = t->Next; + } + } + } + } + UnlockTrackingList(); + + status->MemoryBlocksNum = num; + status->MemorySize = size; +} + +// Get the symbol information by the object +void TrackGetObjSymbolInfo(TRACKING_OBJECT *o) +{ + // Validate arguments + if (o == NULL) + { + return; + } + + if (!(o->LineNumber == 0 && o->FileName[0] == 0)) + { + return; + } + + if (o->CallStack != NULL) + { + GetCallStackSymbolInfo(o->CallStack); + if (StrLen(o->CallStack->filename) != 0 && o->CallStack->line != 0) + { + StrCpy(o->FileName, sizeof(o->FileName), o->CallStack->filename); + o->LineNumber = o->CallStack->line; + } + } +} + +// Put a new object into the tracking list +void TrackNewObj(UINT64 addr, char *name, UINT size) +{ + TRACKING_OBJECT *o; + UINT new_id; + // Validate arguments + if (addr == 0 || name == NULL) + { + return; + } + + if ((IsTrackingEnabled() && IsMemCheck()) == false) + { + // Don't track in detail if the memory check option is not specified + return; + } + + // Generate a new ID + OSLock(obj_id_lock); + { + new_id = ++obj_id; + } + OSUnlock(obj_id_lock); + + o = OSMemoryAlloc(sizeof(TRACKING_OBJECT)); + o->Id = new_id; + o->Address = addr; + o->Name = name; + o->Size = size; + o->CreatedDate = LocalTime64(); + o->CallStack = WalkDownCallStack(GetCallStack(), 2); + + o->FileName[0] = 0; + o->LineNumber = 0; + + LockTrackingList(); + { + InsertTrackingList(o); + } + UnlockTrackingList(); +} + +// Remove the object from the tracking list +void TrackDeleteObj(UINT64 addr) +{ + TRACKING_OBJECT *o; + // Validate arguments + if (addr == 0) + { + return; + } + + if ((IsTrackingEnabled() && IsMemCheck()) == false) + { + // Don't track in detail if the memory check option is not specified + return; + } + + LockTrackingList(); + { + o = SearchTrackingList(addr); + if (o == NULL) + { + UnlockTrackingList(); + Debug("TrackDeleteObj(): 0x%x not found in tracking list!\n", addr); + return; + } + DeleteTrackingList(o, true); + } + UnlockTrackingList(); +} + +// Change the size of the object being tracked +void TrackChangeObjSize(UINT64 addr, UINT size, UINT64 new_addr) +{ + TRACKING_OBJECT *o; + // Validate arguments + if (addr == 0) + { + return; + } + + if ((IsTrackingEnabled() && IsMemCheck()) == false) + { + // Don't track in detail if the memory check option is not specified + return; + } + + LockTrackingList(); + { + o = SearchTrackingList(addr); + if (o == NULL) + { + UnlockTrackingList(); + return; + } + + DeleteTrackingList(o, false); + + o->Size = size; + o->Address = new_addr; + + InsertTrackingList(o); + } + UnlockTrackingList(); +} + +// Memory address comparison function +int CompareTrackingObject(const void *p1, const void *p2) +{ + TRACKING_OBJECT *o1, *o2; + // Validate arguments + if (p1 == NULL || p2 == NULL) + { + return 0; + } + o1 = *(TRACKING_OBJECT **)p1; + o2 = *(TRACKING_OBJECT **)p2; + if (o1 == NULL || o2 == NULL) + { + return 0; + } + + if (o1->Address > o2->Address) + { + return 1; + } + if (o1->Address == o2->Address) + { + return 0; + } + return -1; +} + +// Search an object in the tracking list +TRACKING_OBJECT *SearchTrackingList(UINT64 Address) +{ + UINT i; + // Validate arguments + if (Address == 0) + { + return NULL; + } + + i = TRACKING_HASH(Address); + + if (hashlist[i] != NULL) + { + TRACKING_LIST *tt = hashlist[i]; + + while (true) + { + if (tt->Object->Address == Address) + { + return tt->Object; + } + + tt = tt->Next; + + if (tt == NULL) + { + break; + } + } + } + + return NULL; +} + +// Remove an object from a tracking list +void DeleteTrackingList(TRACKING_OBJECT *o, bool free_object_memory) +{ + UINT i; + // Validate arguments + if (o == NULL) + { + return; + } + + i = TRACKING_HASH(o->Address); + + if (hashlist[i] != NULL) + { + TRACKING_LIST *ft = NULL; + + if (hashlist[i]->Object == o) + { + ft = hashlist[i]; + hashlist[i] = hashlist[i]->Next; + } + else + { + TRACKING_LIST *tt = hashlist[i]; + TRACKING_LIST *prev = NULL; + + while (true) + { + if (tt->Object == o) + { + prev->Next = tt->Next; + ft = tt; + break; + } + + if (tt->Next == NULL) + { + break; + } + + prev = tt; + tt = tt->Next; + } + } + + if (ft != NULL) + { + OSMemoryFree(ft); + + if (free_object_memory) + { + FreeCallStack(o->CallStack); + OSMemoryFree(o); + } + } + } +} + +// Insert an object into the tracking list +void InsertTrackingList(TRACKING_OBJECT *o) +{ + UINT i; + TRACKING_LIST *t; + // Validate arguments + if (o == NULL) + { + return; + } + + t = OSMemoryAlloc(sizeof(TRACKING_LIST)); + t->Object = o; + t->Next = NULL; + + i = TRACKING_HASH(o->Address); + + if (hashlist[i] == NULL) + { + hashlist[i] = t; + } + else + { + TRACKING_LIST *tt = hashlist[i]; + while (true) + { + if (tt->Next == NULL) + { + tt->Next = t; + break; + } + + tt = tt->Next; + } + } +} + +// Lock the tracking list +void LockTrackingList() +{ + OSLock(obj_lock); +} + +// Unlock the tracking list +void UnlockTrackingList() +{ + OSUnlock(obj_lock); +} + +// Initialize the tracking +void InitTracking() +{ + UINT i; + CALLSTACK_DATA *s; + + // Hash list initialization + hashlist = (TRACKING_LIST **)OSMemoryAlloc(sizeof(TRACKING_LIST *) * TRACKING_NUM_ARRAY); + + for (i = 0;i < TRACKING_NUM_ARRAY;i++) + { + hashlist[i] = NULL; + } + + obj_id = 0; + + // Create a lock + obj_lock = OSNewLock(); + obj_id_lock = OSNewLock(); + cs_lock = OSNewLock(); + + s = GetCallStack(); + if (s == NULL) + { + do_not_get_callstack = true; + } + else + { + do_not_get_callstack = false; + FreeCallStack(s); + } +} + +// Release the tracking +void FreeTracking() +{ + UINT i; + // Delete the lock + OSDeleteLock(obj_lock); + OSDeleteLock(obj_id_lock); + OSDeleteLock(cs_lock); + cs_lock = NULL; + obj_id_lock = NULL; + obj_lock = NULL; + + // Release all of the elements + for (i = 0;i < TRACKING_NUM_ARRAY;i++) + { + if (hashlist[i] != NULL) + { + TRACKING_LIST *t = hashlist[i]; + + while (true) + { + TRACKING_LIST *t2 = t; + TRACKING_OBJECT *o = t->Object; + + FreeCallStack(o->CallStack); + OSMemoryFree(o); + + t = t->Next; + + OSMemoryFree(t2); + + if (t == NULL) + { + break; + } + } + } + } + + // Release the list + OSMemoryFree(hashlist); +} + +// Show the call stack +void PrintCallStack(CALLSTACK_DATA *s) +{ + char tmp[MAX_SIZE * 2]; + + GetCallStackStr(tmp, sizeof(tmp), s); + Print("%s", tmp); +} + +// Convert the call stack to a string +void GetCallStackStr(char *str, UINT size, CALLSTACK_DATA *s) +{ + char tmp[MAX_SIZE]; + char tmp2[MAX_SIZE]; + char tmp3[MAX_SIZE]; + UINT num, i; + // Validate arguments + if (str == NULL) + { + return; + } + + if (s == NULL) + { + StrCpy(str, size, "(Unknown)\n"); + } + else + { + num = 0; + str[0] = 0; + while (true) + { + if (s == NULL) + { + break; + } + + GetCallStackSymbolInfo(s); + + if (s->name == NULL) + { + Format(tmp, sizeof(tmp), "0x%02x ---", UINT64_TO_POINTER(s->offset)); + } + else + { + Format(tmp, sizeof(tmp), "0x%p %s() + 0x%02x", + (void *)s->offset, s->name, UINT64_TO_POINTER(s->disp)); + } + for (i = 0;i < num;i++) + { + tmp2[i] = ' '; + } + tmp2[i] = '\0'; + StrCpy(tmp3, sizeof(tmp3), tmp2); + StrCat(tmp3, sizeof(tmp3), tmp); + Format(tmp, sizeof(tmp), "%-55s %11s %u\n", tmp3, s->filename, s->line); + StrCat(str, size, tmp); + num++; + s = s->next; + } + } +} + +// Get the current call stack +CALLSTACK_DATA *GetCallStack() +{ + CALLSTACK_DATA *s; + if (do_not_get_callstack) + { + // Not to get the call stack + return NULL; + } + + OSLock(cs_lock); + { + // Get the call stack + s = OSGetCallStack(); + } + OSUnlock(cs_lock); + if (s == NULL) + { + return NULL; + } + + // Descend in the call stack for 3 steps + s = WalkDownCallStack(s, 3); + + return s; +} + +// Get the symbol information of the call stack +bool GetCallStackSymbolInfo(CALLSTACK_DATA *s) +{ + bool ret; + // Validate arguments + if (s == NULL) + { + return false; + } + + OSLock(cs_lock); + { + ret = OSGetCallStackSymbolInfo(s); + } + OSUnlock(cs_lock); + + return ret; +} + +// Descend in the call stack by a specified number +CALLSTACK_DATA *WalkDownCallStack(CALLSTACK_DATA *s, UINT num) +{ + CALLSTACK_DATA *cs, *tmp; + UINT i; + // Validate arguments + if (s == NULL) + { + return NULL; + } + + cs = s; + i = 0; + + while (true) + { + if (i >= num) + { + return cs; + } + i++; + tmp = cs; + cs = tmp->next; + OSMemoryFree(tmp->name); + OSMemoryFree(tmp); + + if (cs == NULL) + { + return NULL; + } + } +} + +// Release the call stack +void FreeCallStack(CALLSTACK_DATA *s) +{ + // Validate arguments + if (s == NULL) + { + return; + } + + while (true) + { + CALLSTACK_DATA *next = s->next; + OSMemoryFree(s->name); + OSMemoryFree(s); + if (next == NULL) + { + break; + } + s = next; + } +} + + diff --git a/src/Mayaqua/Tracking.h b/src/Mayaqua/Tracking.h index 75798164..a1557ec2 100644 --- a/src/Mayaqua/Tracking.h +++ b/src/Mayaqua/Tracking.h @@ -1,87 +1,87 @@ -// SoftEther VPN Source Code - Developer Edition Master Branch -// Mayaqua Kernel - - -// Tracking.h -// Header of Tracking.c - -#ifndef TRACKING_H -#define TRACKING_H - -// The number of array -#define TRACKING_NUM_ARRAY 1048576 - -// Hash from an pointer to an array index -#define TRACKING_HASH(p) (UINT)(((((UINT64)(p)) / (UINT64)(sizeof(void *))) % ((UINT64)TRACKING_NUM_ARRAY))) - -// Call stack -struct CALLSTACK_DATA -{ - bool symbol_cache; - UINT64 offset, disp; - char *name; - struct CALLSTACK_DATA *next; - char filename[MAX_PATH]; - UINT line; -}; - -// Object -struct TRACKING_OBJECT -{ - UINT Id; - char *Name; - UINT64 Address; - UINT Size; - UINT64 CreatedDate; - CALLSTACK_DATA *CallStack; - char FileName[MAX_PATH]; - UINT LineNumber; -}; - -// Usage of the memory -struct MEMORY_STATUS -{ - UINT MemoryBlocksNum; - UINT MemorySize; -}; - -// Tracking list -struct TRACKING_LIST -{ - struct TRACKING_LIST *Next; - struct TRACKING_OBJECT *Object; -}; - -CALLSTACK_DATA *GetCallStack(); -bool GetCallStackSymbolInfo(CALLSTACK_DATA *s); -void FreeCallStack(CALLSTACK_DATA *s); -CALLSTACK_DATA *WalkDownCallStack(CALLSTACK_DATA *s, UINT num); -void GetCallStackStr(char *str, UINT size, CALLSTACK_DATA *s); -void PrintCallStack(CALLSTACK_DATA *s); -void InitTracking(); -void FreeTracking(); -int CompareTrackingObject(const void *p1, const void *p2); -void LockTrackingList(); -void UnlockTrackingList(); -void InsertTrackingList(TRACKING_OBJECT *o); -void DeleteTrackingList(TRACKING_OBJECT *o, bool free_object_memory); -TRACKING_OBJECT *SearchTrackingList(UINT64 Address); - -void TrackNewObj(UINT64 addr, char *name, UINT size); -void TrackGetObjSymbolInfo(TRACKING_OBJECT *o); -void TrackDeleteObj(UINT64 addr); -void TrackChangeObjSize(UINT64 addr, UINT size, UINT64 new_addr); - -void GetMemoryStatus(MEMORY_STATUS *status); -void PrintMemoryStatus(); -void MemoryDebugMenu(); -int SortObjectView(void *p1, void *p2); -void DebugPrintAllObjects(); -void DebugPrintCommandList(); -void PrintObjectList(TRACKING_OBJECT *o); -void PrintObjectInfo(TRACKING_OBJECT *o); -void DebugPrintObjectInfo(UINT id); - -bool IsTrackingEnabled(); - -#endif // TRACKING_H +// SoftEther VPN Source Code - Developer Edition Master Branch +// Mayaqua Kernel + + +// Tracking.h +// Header of Tracking.c + +#ifndef TRACKING_H +#define TRACKING_H + +// The number of array +#define TRACKING_NUM_ARRAY 1048576 + +// Hash from an pointer to an array index +#define TRACKING_HASH(p) (UINT)(((((UINT64)(p)) / (UINT64)(sizeof(void *))) % ((UINT64)TRACKING_NUM_ARRAY))) + +// Call stack +struct CALLSTACK_DATA +{ + bool symbol_cache; + UINT64 offset, disp; + char *name; + struct CALLSTACK_DATA *next; + char filename[MAX_PATH]; + UINT line; +}; + +// Object +struct TRACKING_OBJECT +{ + UINT Id; + char *Name; + UINT64 Address; + UINT Size; + UINT64 CreatedDate; + CALLSTACK_DATA *CallStack; + char FileName[MAX_PATH]; + UINT LineNumber; +}; + +// Usage of the memory +struct MEMORY_STATUS +{ + UINT MemoryBlocksNum; + UINT MemorySize; +}; + +// Tracking list +struct TRACKING_LIST +{ + struct TRACKING_LIST *Next; + struct TRACKING_OBJECT *Object; +}; + +CALLSTACK_DATA *GetCallStack(); +bool GetCallStackSymbolInfo(CALLSTACK_DATA *s); +void FreeCallStack(CALLSTACK_DATA *s); +CALLSTACK_DATA *WalkDownCallStack(CALLSTACK_DATA *s, UINT num); +void GetCallStackStr(char *str, UINT size, CALLSTACK_DATA *s); +void PrintCallStack(CALLSTACK_DATA *s); +void InitTracking(); +void FreeTracking(); +int CompareTrackingObject(const void *p1, const void *p2); +void LockTrackingList(); +void UnlockTrackingList(); +void InsertTrackingList(TRACKING_OBJECT *o); +void DeleteTrackingList(TRACKING_OBJECT *o, bool free_object_memory); +TRACKING_OBJECT *SearchTrackingList(UINT64 Address); + +void TrackNewObj(UINT64 addr, char *name, UINT size); +void TrackGetObjSymbolInfo(TRACKING_OBJECT *o); +void TrackDeleteObj(UINT64 addr); +void TrackChangeObjSize(UINT64 addr, UINT size, UINT64 new_addr); + +void GetMemoryStatus(MEMORY_STATUS *status); +void PrintMemoryStatus(); +void MemoryDebugMenu(); +int SortObjectView(void *p1, void *p2); +void DebugPrintAllObjects(); +void DebugPrintCommandList(); +void PrintObjectList(TRACKING_OBJECT *o); +void PrintObjectInfo(TRACKING_OBJECT *o); +void DebugPrintObjectInfo(UINT id); + +bool IsTrackingEnabled(); + +#endif // TRACKING_H diff --git a/src/Mayaqua/TunTap.h b/src/Mayaqua/TunTap.h index 12f076c0..85883ce4 100644 --- a/src/Mayaqua/TunTap.h +++ b/src/Mayaqua/TunTap.h @@ -1,201 +1,201 @@ -// SoftEther VPN Source Code - Developer Edition Master Branch -// Mayaqua Kernel - - -#ifndef TUNTAP_H -#define TUNTAP_H - -#ifdef UNIX_LINUX - -// ----------------------------------------------------------------- -// Tap header for Linux -// This header definitions are from Universal TUN/TAP device driver -// written by Maxim Krasnyansky . -// This definitions includes only types and constants definitions, -// and it does not include any programs. -// ----------------------------------------------------------------- - -#ifndef __IF_TUN_H -#define __IF_TUN_H - -/* Uncomment to enable debugging */ -/* #define TUN_DEBUG 1 */ - - - -/* Read queue size */ -#define TUN_READQ_SIZE 10 - -/* TUN device flags */ -#define TUN_TUN_DEV 0x0001 -#define TUN_TAP_DEV 0x0002 -#define TUN_TYPE_MASK 0x000f - -#define TUN_FASYNC 0x0010 -#define TUN_NOCHECKSUM 0x0020 -#define TUN_NO_PI 0x0040 -#define TUN_ONE_QUEUE 0x0080 -#define TUN_PERSIST 0x0100 - -/* Ioctl defines */ -#define TUNSETNOCSUM _IOW('T', 200, int) -#define TUNSETDEBUG _IOW('T', 201, int) -#define TUNSETIFF _IOW('T', 202, int) -#define TUNSETPERSIST _IOW('T', 203, int) -#define TUNSETOWNER _IOW('T', 204, int) - -/* TUNSETIFF ifr flags */ -#define IFF_TUN 0x0001 -#define IFF_TAP 0x0002 -#define IFF_NO_PI 0x1000 -#define IFF_ONE_QUEUE 0x2000 - -struct tun_pi { - unsigned short flags; - unsigned short proto; -}; -#define TUN_PKT_STRIP 0x0001 - -#endif /* __IF_TUN_H */ -#else // UNIX_LINUX - -#ifdef UNIX_SOLARIS - -// ----------------------------------------------------------------- -// Tap header for Solaris -// This header definitions are from Multithreaded STREAMS tun pseudo device driver -// written by Maxim Krasnyansky . -// This definitions includes only types and constants definitions, -// and it does not include any programs. -// ----------------------------------------------------------------- - -#ifndef _SYS_IF_TUN_H -#define _SYS_IF_TUN_H - -#ifdef _KERNEL -/* Uncomment to enable debugging */ -/* #define TUN_DEBUG 1 */ - -#ifdef TUN_DEBUG -#define DBG cmn_err -#else -#define DBG( a... ) -#endif - -/* PPA structure, one per TUN iface */ -struct tunppa { - unsigned int id; /* Iface number */ - queue_t *rq; /* Control Stream RQ */ - struct tunstr * p_str; /* Protocol Streams */ -}; -#define TUNMAXPPA 20 - -/* Stream structure, one per Stream */ -struct tunstr { - struct tunstr *s_next; /* next in streams list */ - struct tunstr *p_next; /* next in ppa list */ - queue_t *rq; /* pointer to rq */ - - struct tunppa *ppa; /* assigned PPA */ - u_long flags; /* flags */ - u_long state; /* DL state */ - u_long sap; /* bound sap */ - u_long minor; /* minor device number */ -}; - -/* Flags */ -#define TUN_CONTROL 0x0001 - -#define TUN_RAW 0x0100 -#define TUN_FAST 0x0200 - -#define TUN_ALL_PHY 0x0010 -#define TUN_ALL_SAP 0x0020 -#define TUN_ALL_MUL 0x0040 - -#define SNIFFER(a) ( (a & TUN_ALL_SAP) || (a & TUN_ALL_PHY) ) - -struct tundladdr { - u_short sap; -}; -#define TUN_ADDR_LEN (sizeof(struct tundladdr)) - -#define TUN_QUEUE 0 -#define TUN_DROP 1 - -#endif /* _KERNEL */ - -/* IOCTL defines */ -#define TUNNEWPPA (('T'<<16) | 0x0001) -#define TUNSETPPA (('T'<<16) | 0x0002) - -#endif /* _SYS_IF_TUN_H */ - -#else // UNIX_SOLARIS - -#if defined(UNIX_BSD) || (!defined(NO_VLAN) && defined(UNIX_MACOS)) - -// ----------------------------------------------------------------- -// Tap header for FreeBSD -// ----------------------------------------------------------------- -// ----------------------------------------------------------------- -// Tap header For MacOS -// ----------------------------------------------------------------- -/* $NetBSD: if_tun.h,v 1.5 1994/06/29 06:36:27 cgd Exp $ */ - -/* - * Copyright (c) 1988, Julian Onions - * Nottingham University 1987. - * - * This source may be freely distributed, however I would be interested - * in any changes that are made. - * - * This driver takes packets off the IP i/f and hands them up to a - * user process to have its wicked way with. This driver has it's - * roots in a similar driver written by Phil Cockcroft (formerly) at - * UCL. This driver is based much more on read/write/select mode of - * operation though. - * - * $FreeBSD: src/sys/net/if_tun.h,v 1.17 2000/01/23 01:47:12 brian Exp $ - */ - -#ifndef _NET_IF_TUN_H_ -#define _NET_IF_TUN_H_ - -/* Refer to if_tunvar.h for the softc stuff */ - -/* Maximum transmit packet size (default) */ -#define TUNMTU 1500 - -/* Maximum receive packet size (hard limit) */ -#define TUNMRU 16384 - -struct tuninfo { - int baudrate; /* linespeed */ - short mtu; /* maximum transmission unit */ - u_char type; /* ethernet, tokenring, etc. */ - u_char dummy; /* place holder */ -}; - -/* ioctl's for get/set debug */ -#define TUNSDEBUG _IOW('t', 90, int) -#define TUNGDEBUG _IOR('t', 89, int) -#define TUNSIFINFO _IOW('t', 91, struct tuninfo) -#define TUNGIFINFO _IOR('t', 92, struct tuninfo) -#define TUNSLMODE _IOW('t', 93, int) -#define TUNSIFMODE _IOW('t', 94, int) -#define TUNSIFPID _IO('t', 95) -#define TUNSIFHEAD _IOW('t', 96, int) -#define TUNGIFHEAD _IOR('t', 97, int) - -#endif /* !_NET_IF_TUN_H_ */ - -#else // UNIX_BSD - -#endif // defined(UNIX_BSD) || (!defined(NO_VLAN) && defined(UNIX_MACOS)) - -#endif // UNIX_SOLARIS - -#endif // UNIX_LINUX - -#endif // TUNTAP_H +// SoftEther VPN Source Code - Developer Edition Master Branch +// Mayaqua Kernel + + +#ifndef TUNTAP_H +#define TUNTAP_H + +#ifdef UNIX_LINUX + +// ----------------------------------------------------------------- +// Tap header for Linux +// This header definitions are from Universal TUN/TAP device driver +// written by Maxim Krasnyansky . +// This definitions includes only types and constants definitions, +// and it does not include any programs. +// ----------------------------------------------------------------- + +#ifndef __IF_TUN_H +#define __IF_TUN_H + +/* Uncomment to enable debugging */ +/* #define TUN_DEBUG 1 */ + + + +/* Read queue size */ +#define TUN_READQ_SIZE 10 + +/* TUN device flags */ +#define TUN_TUN_DEV 0x0001 +#define TUN_TAP_DEV 0x0002 +#define TUN_TYPE_MASK 0x000f + +#define TUN_FASYNC 0x0010 +#define TUN_NOCHECKSUM 0x0020 +#define TUN_NO_PI 0x0040 +#define TUN_ONE_QUEUE 0x0080 +#define TUN_PERSIST 0x0100 + +/* Ioctl defines */ +#define TUNSETNOCSUM _IOW('T', 200, int) +#define TUNSETDEBUG _IOW('T', 201, int) +#define TUNSETIFF _IOW('T', 202, int) +#define TUNSETPERSIST _IOW('T', 203, int) +#define TUNSETOWNER _IOW('T', 204, int) + +/* TUNSETIFF ifr flags */ +#define IFF_TUN 0x0001 +#define IFF_TAP 0x0002 +#define IFF_NO_PI 0x1000 +#define IFF_ONE_QUEUE 0x2000 + +struct tun_pi { + unsigned short flags; + unsigned short proto; +}; +#define TUN_PKT_STRIP 0x0001 + +#endif /* __IF_TUN_H */ +#else // UNIX_LINUX + +#ifdef UNIX_SOLARIS + +// ----------------------------------------------------------------- +// Tap header for Solaris +// This header definitions are from Multithreaded STREAMS tun pseudo device driver +// written by Maxim Krasnyansky . +// This definitions includes only types and constants definitions, +// and it does not include any programs. +// ----------------------------------------------------------------- + +#ifndef _SYS_IF_TUN_H +#define _SYS_IF_TUN_H + +#ifdef _KERNEL +/* Uncomment to enable debugging */ +/* #define TUN_DEBUG 1 */ + +#ifdef TUN_DEBUG +#define DBG cmn_err +#else +#define DBG( a... ) +#endif + +/* PPA structure, one per TUN iface */ +struct tunppa { + unsigned int id; /* Iface number */ + queue_t *rq; /* Control Stream RQ */ + struct tunstr * p_str; /* Protocol Streams */ +}; +#define TUNMAXPPA 20 + +/* Stream structure, one per Stream */ +struct tunstr { + struct tunstr *s_next; /* next in streams list */ + struct tunstr *p_next; /* next in ppa list */ + queue_t *rq; /* pointer to rq */ + + struct tunppa *ppa; /* assigned PPA */ + u_long flags; /* flags */ + u_long state; /* DL state */ + u_long sap; /* bound sap */ + u_long minor; /* minor device number */ +}; + +/* Flags */ +#define TUN_CONTROL 0x0001 + +#define TUN_RAW 0x0100 +#define TUN_FAST 0x0200 + +#define TUN_ALL_PHY 0x0010 +#define TUN_ALL_SAP 0x0020 +#define TUN_ALL_MUL 0x0040 + +#define SNIFFER(a) ( (a & TUN_ALL_SAP) || (a & TUN_ALL_PHY) ) + +struct tundladdr { + u_short sap; +}; +#define TUN_ADDR_LEN (sizeof(struct tundladdr)) + +#define TUN_QUEUE 0 +#define TUN_DROP 1 + +#endif /* _KERNEL */ + +/* IOCTL defines */ +#define TUNNEWPPA (('T'<<16) | 0x0001) +#define TUNSETPPA (('T'<<16) | 0x0002) + +#endif /* _SYS_IF_TUN_H */ + +#else // UNIX_SOLARIS + +#if defined(UNIX_BSD) || (!defined(NO_VLAN) && defined(UNIX_MACOS)) + +// ----------------------------------------------------------------- +// Tap header for FreeBSD +// ----------------------------------------------------------------- +// ----------------------------------------------------------------- +// Tap header For MacOS +// ----------------------------------------------------------------- +/* $NetBSD: if_tun.h,v 1.5 1994/06/29 06:36:27 cgd Exp $ */ + +/* + * Copyright (c) 1988, Julian Onions + * Nottingham University 1987. + * + * This source may be freely distributed, however I would be interested + * in any changes that are made. + * + * This driver takes packets off the IP i/f and hands them up to a + * user process to have its wicked way with. This driver has it's + * roots in a similar driver written by Phil Cockcroft (formerly) at + * UCL. This driver is based much more on read/write/select mode of + * operation though. + * + * $FreeBSD: src/sys/net/if_tun.h,v 1.17 2000/01/23 01:47:12 brian Exp $ + */ + +#ifndef _NET_IF_TUN_H_ +#define _NET_IF_TUN_H_ + +/* Refer to if_tunvar.h for the softc stuff */ + +/* Maximum transmit packet size (default) */ +#define TUNMTU 1500 + +/* Maximum receive packet size (hard limit) */ +#define TUNMRU 16384 + +struct tuninfo { + int baudrate; /* linespeed */ + short mtu; /* maximum transmission unit */ + u_char type; /* ethernet, tokenring, etc. */ + u_char dummy; /* place holder */ +}; + +/* ioctl's for get/set debug */ +#define TUNSDEBUG _IOW('t', 90, int) +#define TUNGDEBUG _IOR('t', 89, int) +#define TUNSIFINFO _IOW('t', 91, struct tuninfo) +#define TUNGIFINFO _IOR('t', 92, struct tuninfo) +#define TUNSLMODE _IOW('t', 93, int) +#define TUNSIFMODE _IOW('t', 94, int) +#define TUNSIFPID _IO('t', 95) +#define TUNSIFHEAD _IOW('t', 96, int) +#define TUNGIFHEAD _IOR('t', 97, int) + +#endif /* !_NET_IF_TUN_H_ */ + +#else // UNIX_BSD + +#endif // defined(UNIX_BSD) || (!defined(NO_VLAN) && defined(UNIX_MACOS)) + +#endif // UNIX_SOLARIS + +#endif // UNIX_LINUX + +#endif // TUNTAP_H diff --git a/src/Mayaqua/Unix.c b/src/Mayaqua/Unix.c index 0f1428f3..fc3f7953 100755 --- a/src/Mayaqua/Unix.c +++ b/src/Mayaqua/Unix.c @@ -1,2742 +1,2742 @@ -// SoftEther VPN Source Code - Developer Edition Master Branch -// Mayaqua Kernel - - -// Unix.c -// UNIX dependent code - -#include - -#ifdef UNIX - -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#ifdef UNIX_MACOS -#ifdef NO_VLAN -// Struct statfs for MacOS X -typedef struct fsid { int32_t val[2]; } fsid_t; -struct statfs { - short f_otype; /* TEMPORARY SHADOW COPY OF f_type */ - short f_oflags; /* TEMPORARY SHADOW COPY OF f_flags */ - long f_bsize; /* fundamental file system block size */ - long f_iosize; /* optimal transfer block size */ - long f_blocks; /* total data blocks in file system */ - long f_bfree; /* free blocks in fs */ - long f_bavail; /* free blocks avail to non-superuser */ - long f_files; /* total file nodes in file system */ - long f_ffree; /* free file nodes in fs */ - fsid_t f_fsid; /* file system id */ - uid_t f_owner; /* user that mounted the filesystem */ - short f_reserved1; /* spare for later */ - short f_type; /* type of filesystem */ - long f_flags; /* copy of mount exported flags */ - long f_reserved2[2]; /* reserved for future use */ - char f_fstypename[15]; /* fs type name */ - char f_mntonname[90]; /* directory on which mounted */ - char f_mntfromname[90];/* mounted filesystem */ -}; -#else // NO_VLAN -#include -#endif // NO_VLAN -#endif // UNIX_MACOS - -// Scandir() function for Solaris -#ifdef UNIX_SOLARIS -#define scandir local_scandir -#define alphasort local_alphasort - -int local_scandir(const char *dir, struct dirent ***namelist, - int (*select)(const struct dirent *), - int (*compar)(const struct dirent **, const struct dirent **)) -{ - DIR *d; - struct dirent *entry; - register int i=0; - size_t entrysize; - - if ((d=opendir(dir)) == NULL) - return(-1); - - *namelist=NULL; - while ((entry=readdir(d)) != NULL) - { - if (select == NULL || (*select)(entry)) - { - *namelist=(struct dirent **)realloc((void *)(*namelist), - (size_t)((i+1)*sizeof(struct dirent *))); - if (*namelist == NULL) return(-1); - entrysize=sizeof(struct dirent)-sizeof(entry->d_name)+strlen(entry->d_name)+1; - (*namelist)[i]=(struct dirent *)malloc(entrysize); - if ((*namelist)[i] == NULL) return(-1); - memcpy((*namelist)[i], entry, entrysize); - i++; - } - } - if (closedir(d)) return(-1); - if (i == 0) return(-1); - if (compar != NULL) - qsort((void *)(*namelist), (size_t)i, sizeof(struct dirent *), compar); - - return(i); -} - -int local_alphasort(const struct dirent **a, const struct dirent **b) -{ - return(strcmp((*a)->d_name, (*b)->d_name)); -} - - -#endif // UNIX_SOLARIS - -// Thread data for UNIX -typedef struct UNIXTHREAD -{ - pthread_t thread; - bool finished; -} UNIXTHREAD; - -// Thread startup information for UNIX -typedef struct UNIXTHREADSTARTUPINFO -{ - THREAD_PROC *thread_proc; - void *param; - THREAD *thread; -} UNIXTHREADSTARTUPINFO; - -// Thread function prototype for UNIX -void *UnixDefaultThreadProc(void *param); - -// Current process ID -static pid_t current_process_id = 0; - -// File I/O data for UNIX -typedef struct UNIXIO -{ - int fd; - bool write_mode; -} UNIXIO; - -// Lock file data for UNIX -typedef struct UNIXLOCKFILE -{ - char FileName[MAX_SIZE]; - int fd; -} UNIXLOCKFILE; - -// Event data for UNIX -typedef struct UNIXEVENT -{ - pthread_mutex_t mutex; - pthread_cond_t cond; - bool signal; -} UNIXEVENT; - -static pthread_mutex_t get_time_lock; -static pthread_mutex_t malloc_lock; -static bool high_process = false; - -static bool unix_svc_terminate = false; -static int solaris_sleep_p1 = -1, solaris_sleep_p2 = -1; - -// Create a dispatch table -OS_DISPATCH_TABLE *UnixGetDispatchTable() -{ - static OS_DISPATCH_TABLE t = - { - UnixInit, - UnixFree, - UnixMemoryAlloc, - UnixMemoryReAlloc, - UnixMemoryFree, - UnixGetTick, - UnixGetSystemTime, - UnixInc32, - UnixDec32, - UnixSleep, - UnixNewLock, - UnixLock, - UnixUnlock, - UnixDeleteLock, - UnixInitEvent, - UnixSetEvent, - UnixResetEvent, - UnixWaitEvent, - UnixFreeEvent, - UnixWaitThread, - UnixFreeThread, - UnixInitThread, - UnixThreadId, - UnixFileOpen, - UnixFileOpenW, - UnixFileCreate, - UnixFileCreateW, - UnixFileWrite, - UnixFileRead, - UnixFileClose, - UnixFileFlush, - UnixFileSize, - UnixFileSeek, - UnixFileDelete, - UnixFileDeleteW, - UnixMakeDir, - UnixMakeDirW, - UnixDeleteDir, - UnixDeleteDirW, - UnixGetCallStack, - UnixGetCallStackSymbolInfo, - UnixFileRename, - UnixFileRenameW, - UnixRun, - UnixRunW, - UnixIsSupportedOs, - UnixGetOsInfo, - UnixAlert, - UnixAlertW, - UnixGetProductId, - UnixSetHighPriority, - UnixRestorePriority, - UnixNewSingleInstance, - UnixFreeSingleInstance, - UnixGetMemInfo, - UnixYield, - }; - - return &t; -} - -static void *signal_received_for_ignore(int sig, siginfo_t *info, void *ucontext) -{ - return NULL; -} - -// Ignore the signal flew to the thread -void UnixIgnoreSignalForThread(int sig) -{ - struct sigaction sa; - - Zero(&sa, sizeof(sa)); - sa.sa_handler = NULL; - sa.sa_sigaction = signal_received_for_ignore; - sa.sa_flags = SA_SIGINFO; - - sigemptyset(&sa.sa_mask); - - sigaction(SIGUSR1, &sa, NULL); -} - -// Disable the off-loading function of the specific Ethernet device -void UnixDisableInterfaceOffload(char *name) -{ -#ifdef UNIX_LINUX - char tmp[MAX_SIZE]; - TOKEN_LIST *t; - char *names = "rx tx sg tso ufo gso gro lro rxvlan txvlan ntuple rxhash"; - // Validate arguments - if (name == NULL) - { - return; - } - - t = ParseToken(names, " "); - - if (t != NULL) - { - UINT i; - for (i = 0;i < t->NumTokens;i++) - { - char *a = t->Token[i]; - - Format(tmp, sizeof(tmp), "ethtool -K %s %s off 2>/dev/null", name, a); - FreeToken(UnixExec(tmp)); - } - } - - FreeToken(t); -#endif // UNIX_LINUX -} - -// Validate whether the UNIX is running in a VM -bool UnixIsInVmMain() -{ - TOKEN_LIST *t = NULL; - bool ret = false; - char *vm_str_list = "Hypervisor detected,VMware Virtual Platform,VMware Virtual USB,qemu,xen,paravirtualized,virtual hd,virtualhd,virtual pc,virtualpc,kvm,oracle vm,oraclevm,parallels,xvm,bochs"; - -#ifdef UNIX_LINUX - t = UnixExec("/bin/dmesg"); - - if (t != NULL) - { - BUF *b = NewBuf(); - UINT i; - - for (i = 0;i < t->NumTokens;i++) - { - char *line = t->Token[i]; - - AddBufStr(b, line); - AddBufStr(b, " "); - } - - WriteBufInt(b, 0); - -// printf("%s\n", b->Buf); - - ret = InStrList(b->Buf, vm_str_list, ",", false); - - FreeBuf(b); - FreeToken(t); - } -#endif // UNIX_LINUX - - return ret; -} -bool UnixIsInVm() -{ - static bool is_in_vm_flag = false; - static bool is_in_vm_ret = false; - - if (is_in_vm_flag == false) - { - is_in_vm_ret = UnixIsInVmMain(); - is_in_vm_flag = true; - } - - return is_in_vm_ret; -} - -// Run quietly in the UNIX -void UnixExecSilent(char *cmd) -{ - char tmp[MAX_SIZE]; - // Validate arguments - if (cmd == NULL) - { - return; - } - - Format(tmp, sizeof(tmp), "%s 2>/dev/null", cmd); - - FreeToken(UnixExec(tmp)); -} - -// Enable / disable the ESP processing in the kernel -void UnixSetEnableKernelEspProcessing(bool b) -{ - if (GetOsInfo()->OsType == OSTYPE_MACOS_X) - { - // Mac OS X - if (b) - { - UnixExecSilent("/usr/sbin/sysctl -w net.inet.ipsec.esp_port=4500"); - } - else - { - UnixExecSilent("/usr/sbin/sysctl -w net.inet.ipsec.esp_port=4501"); - } - } -} - -// Run a command and return its result -TOKEN_LIST *UnixExec(char *cmd) -{ - FILE *fp; - char tmp[MAX_SIZE]; - char *ptr; - LIST *o; - UINT i; - TOKEN_LIST *ret; - // Validate arguments - if (cmd == NULL) - { - return NULL; - } - - fp = popen(cmd, "r"); - if (fp == NULL) - { - return NULL; - } - - o = NewList(NULL); - - while (true) - { - fgets(tmp, sizeof(tmp), fp); - if (feof(fp)) - { - break; - } - - ptr = strchr(tmp, '\n'); - if (ptr != NULL) - { - *ptr = 0; - } - - ptr = strchr(tmp, '\r'); - if (ptr != NULL) - { - *ptr = 0; - } - - Add(o, CopyStr(tmp)); - } - - pclose(fp); - - ret = ListToTokenList(o); - - FreeStrList(o); - - return ret; -} - -// Initialize the Sleep for Solaris -void UnixInitSolarisSleep() -{ - char tmp[MAX_SIZE]; - - UnixNewPipe(&solaris_sleep_p1, &solaris_sleep_p2); - (void)read(solaris_sleep_p1, tmp, sizeof(tmp)); -} - -// Release the Sleep for Solaris -void UnixFreeSolarisSleep() -{ - UnixDeletePipe(solaris_sleep_p1, solaris_sleep_p2); - solaris_sleep_p1 = -1; - solaris_sleep_p2 = -1; -} - -// Sleep for Solaris -void UnixSolarisSleep(UINT msec) -{ - struct pollfd p; - - memset(&p, 0, sizeof(p)); - p.fd = solaris_sleep_p1; - p.events = POLLIN; - - (void)poll(&p, 1, msec == INFINITE ? -1 : (int)msec); -} - -// Get the free space of the disk -bool UnixGetDiskFree(char *path, UINT64 *free_size, UINT64 *used_size, UINT64 *total_size) -{ - char tmp[MAX_PATH]; - bool ret = false; - // Validate arguments - if (path == NULL) - { - return false; - } - - NormalizePath(tmp, sizeof(tmp), path); - - while ((ret = UnixGetDiskFreeMain(tmp, free_size, used_size, total_size)) == false) - { - if (StrCmpi(tmp, "/") == 0) - { - break; - } - - GetDirNameFromFilePath(tmp, sizeof(tmp), tmp); - } - - return ret; -} -bool UnixGetDiskFreeMain(char *path, UINT64 *free_size, UINT64 *used_size, UINT64 *total_size) -{ -#ifndef USE_STATVFS - struct statfs st; - char tmp[MAX_PATH]; - UINT64 v1 = 0, v2 = 0; - bool ret = false; - // Validate arguments - if (path == NULL) - { - return false; - } - - NormalizePath(tmp, sizeof(tmp), path); - - Zero(&st, sizeof(st)); - if (statfs(tmp, &st) == 0) - { - v1 = (UINT64)st.f_bsize * (UINT64)st.f_bavail; - v2 = (UINT64)st.f_bsize * (UINT64)st.f_blocks; - ret = true; - } - - if (free_size != NULL) - { - *free_size = v1; - } - - if (total_size != NULL) - { - *total_size = v2; - } - - if (used_size != NULL) - { - *used_size = v2 - v1; - } - - return ret; -#else // USE_STATVFS - struct statvfs st; - char tmp[MAX_PATH]; - UINT64 v1 = 0, v2 = 0; - bool ret = false; - // Validate arguments - if (path == NULL) - { - return false; - } - - NormalizePath(tmp, sizeof(tmp), path); - - Zero(&st, sizeof(st)); - - if (statvfs(tmp, &st) == 0) - { - v1 = (UINT64)st.f_bsize * (UINT64)st.f_bavail; - v2 = (UINT64)st.f_bsize * (UINT64)st.f_blocks; - ret = true; - } - - if (free_size != NULL) - { - *free_size = v1; - } - - if (total_size != NULL) - { - *total_size = v2; - } - - if (used_size != NULL) - { - *used_size = v2 - v1; - } - - return ret; -#endif // USE_STATVFS -} - -// Directory enumeration -DIRLIST *UnixEnumDirEx(char *dirname, COMPARE *compare) -{ - char tmp[MAX_PATH]; - DIRLIST *d; - int n; - struct dirent **e; - LIST *o; - // Validate arguments - if (dirname == NULL) - { - return NULL; - } - - o = NewListFast(compare); - - NormalizePath(tmp, sizeof(tmp), dirname); - - if (StrLen(tmp) >= 1 && tmp[StrLen(tmp) - 1] != '/') - { - StrCat(tmp, sizeof(tmp), "/"); - } - - e = NULL; - n = scandir(tmp, &e, 0, alphasort); - - if (StrLen(tmp) >= 1 && tmp[StrLen(tmp) - 1] == '/') - { - tmp[StrLen(tmp) - 1] = 0; - } - - if (n >= 0 && e != NULL) - { - UINT i; - - for (i = 0;i < (UINT)n;i++) - { - char *filename = e[i]->d_name; - - if (filename != NULL) - { - if (StrCmpi(filename, "..") != 0 && StrCmpi(filename, ".") != 0) - { - char fullpath[MAX_PATH]; - struct stat st; - Format(fullpath, sizeof(fullpath), "%s/%s", tmp, filename); - - Zero(&st, sizeof(st)); - - if (stat(fullpath, &st) == 0) - { - DIRENT *f = ZeroMalloc(sizeof(DIRENT)); - SYSTEMTIME t; - - f->Folder = S_ISDIR(st.st_mode) ? true : false; - f->FileName = CopyStr(filename); - f->FileNameW = CopyUtfToUni(f->FileName); - - Zero(&t, sizeof(t)); - TimeToSystem(&t, st.st_ctime); - f->CreateDate = SystemToUINT64(&t); - - Zero(&t, sizeof(t)); - TimeToSystem(&t, st.st_mtime); - f->UpdateDate = SystemToUINT64(&t); - - if (f->Folder == false) - { - f->FileSize = st.st_size; - } - - Add(o, f); - } - } - } - - free(e[i]); - } - - free(e); - } - - Sort(o); - - d = ZeroMalloc(sizeof(DIRLIST)); - d->NumFiles = LIST_NUM(o); - d->File = ToArray(o); - - ReleaseList(o); - - return d; -} -DIRLIST *UnixEnumDirExW(wchar_t *dirname, COMPARE *compare) -{ - char *dirname_a = CopyUniToUtf(dirname); - DIRLIST *ret; - - ret = UnixEnumDirEx(dirname_a, compare); - - Free(dirname_a); - - return ret; -} - -// Check the execute permissions of the specified file -bool UnixCheckExecAccess(char *name) -{ - // Validate arguments - if (name == NULL) - { - return false; - } - - if (access(name, X_OK) == 0) - { - return true; - } - - return false; -} -bool UnixCheckExecAccessW(wchar_t *name) -{ - char *name_a; - bool ret; - // Validate arguments - if (name == NULL) - { - return false; - } - - name_a = CopyUniToUtf(name); - - ret = UnixCheckExecAccess(name_a); - - Free(name_a); - - return ret; -} - -// Raise the priority of the thread to highest -void UnixSetThreadPriorityRealtime() -{ - struct sched_param p; - Zero(&p, sizeof(p)); - p.sched_priority = 255; - pthread_setschedparam(pthread_self(), SCHED_RR, &p); -} - -// Get the current directory -void UnixGetCurrentDir(char *dir, UINT size) -{ - // Validate arguments - if (dir == NULL) - { - return; - } - - getcwd(dir, size); -} -void UnixGetCurrentDirW(wchar_t *dir, UINT size) -{ - char dir_a[MAX_PATH]; - - UnixGetCurrentDir(dir_a, sizeof(dir_a)); - - UtfToUni(dir, size, dir_a); -} - -// Yield -void UnixYield() -{ -#ifdef UNIX_SOLARIS - UnixSolarisSleep(1); -#else - usleep(1000); -#endif -} - -// Get the memory information -void UnixGetMemInfo(MEMINFO *info) -{ - // Validate arguments - if (info == NULL) - { - return; - } - - // I don't know!! - Zero(info, sizeof(MEMINFO)); -} - -// Release of the single instance -void UnixFreeSingleInstance(void *data) -{ - UNIXLOCKFILE *o; - struct flock lock; - // Validate arguments - if (data == NULL) - { - return; - } - - o = (UNIXLOCKFILE *)data; - - Zero(&lock, sizeof(lock)); - lock.l_type = F_UNLCK; - lock.l_whence = SEEK_SET; - - (void)fcntl(o->fd, F_SETLK, &lock); - close(o->fd); - - (void)remove(o->FileName); - - Free(data); -} - -// Creating a single instance -void *UnixNewSingleInstance(char *instance_name) -{ - UNIXLOCKFILE *ret; - char tmp[MAX_SIZE]; - char name[MAX_SIZE]; - char dir[MAX_PATH]; - int fd; - struct flock lock; - int mode = S_IRUSR | S_IWUSR; - // Validate arguments - if (instance_name == NULL) - { - GetExeName(tmp, sizeof(tmp)); - HashInstanceName(tmp, sizeof(tmp), tmp); - } - else - { - StrCpy(tmp, sizeof(tmp), instance_name); - } - - GetPidDir(dir, sizeof(dir)); - - // File name generation - Format(name, sizeof(name), "%s/.%s", dir, tmp); - - fd = open(name, O_WRONLY); - if (fd == -1) - { - fd = creat(name, mode); - } - if (fd == -1) - { - Format(tmp, sizeof(tmp), "Unable to create %s.", name); - Alert(tmp, NULL); - exit(0); - return NULL; - } - - fchmod(fd, mode); - (void)chmod(name, mode); - - Zero(&lock, sizeof(lock)); - lock.l_type = F_WRLCK; - lock.l_whence = SEEK_SET; - - if (fcntl(fd, F_SETLK, &lock) == -1) - { - close(fd); - return NULL; - } - else - { - ret = ZeroMalloc(sizeof(UNIXLOCKFILE)); - ret->fd = fd; - StrCpy(ret->FileName, sizeof(ret->FileName), name); - return (void *)ret; - } -} - -// Set the high oom score -void UnixSetHighOomScore() -{ - IO *o; - char tmp[256]; - - sprintf(tmp, "/proc/%u/oom_score_adj", getpid()); - - o = UnixFileCreate(tmp); - if (o != NULL) - { - char tmp[128]; - sprintf(tmp, "%u\n", 800); - UnixFileWrite(o, tmp, strlen(tmp)); - UnixFileClose(o, false); - } -} - -// Raise the priority of the process -void UnixSetHighPriority() -{ - if (high_process == false) - { - UINT pid = getpid(); - UINT pgid = getpgid(pid); - - high_process = true; - nice(-20); - - setpriority(PRIO_PROCESS, pid, -20); - setpriority(PRIO_PGRP, pgid, -20); - } -} - -// Restore the priority of the process -void UnixRestorePriority() -{ - if (high_process != false) - { - high_process = false; - nice(20); - } -} - -UINT UnixGetNumberOfCpuInner() -{ - BUF *b; - UINT ret = 0; - - b = ReadDump("/proc/cpuinfo"); - if (b != NULL) - { - while (true) - { - char *line = CfgReadNextLine(b); - - if (line == NULL) - { - break; - } - - if (IsEmptyStr(line) == false) - { - TOKEN_LIST *t = ParseToken(line, ":"); - if (t != NULL) - { - if (t->NumTokens >= 2) - { - char *key = t->Token[0]; - char *value = t->Token[1]; - - Trim(key); - Trim(value); - - if (StrCmpi(key, "processor") == 0) - { - if (IsNum(value)) - { - UINT i = ToInt(value) + 1; - - if (i >= 1 && i <= 128) - { - ret = MAX(ret, i); - } - } - } - } - - FreeToken(t); - } - } - - Free(line); - } - - FreeBuf(b); - } - - return ret; -} - -// Get the product ID -char *UnixGetProductId() -{ - return CopyStr("--"); -} - -// Display an alert -void UnixAlertW(wchar_t *msg, wchar_t *caption) -{ - char *msg8 = CopyUniToUtf(msg); - char *caption8 = CopyUniToUtf(caption); - - UnixAlert(msg8, caption8); - - Free(msg8); - Free(caption8); -} -void UnixAlert(char *msg, char *caption) -{ - char *tag = - "-- Alert: %s --\n%s\n"; - // Validate arguments - if (msg == NULL) - { - msg = "Alert"; - } - if (caption == NULL) - { - caption = CEDAR_PRODUCT_STR " VPN Kernel"; - } - - printf(tag, caption, msg); -} - -// Get the information of the current OS -void UnixGetOsInfo(OS_INFO *info) -{ - struct utsname unix_info; - - // Validate arguments - if (info == NULL) - { - return; - } - - Zero(info, sizeof(OS_INFO)); - -#ifdef UNIX_SOLARIS - info->OsType = OSTYPE_SOLARIS; -#elif UNIX_CYGWIN - info->OsType = OSTYPE_CYGWIN; -#elif UNIX_MACOS - info->OsType = OSTYPE_MACOS_X; -#elif UNIX_BSD - info->OsType = OSTYPE_BSD; -#elif UNIX_LINUX - info->OsType = OSTYPE_LINUX; -#else - info->OsType = OSTYPE_UNIX_UNKNOWN; -#endif - - info->OsSystemName = CopyStr(OsTypeToStr(info->OsType)); - info->KernelName = CopyStr("UNIX"); - - if (uname(&unix_info) > -1) - { - info->OsProductName = CopyStr(unix_info.sysname); - info->OsVersion = CopyStr(unix_info.release); - info->KernelVersion = CopyStr(unix_info.version); - } - else - { - Debug("UnixGetOsInfo(): uname() failed with error: %s\n", strerror(errno)); - - info->OsProductName = CopyStr(OsTypeToStr(info->OsType)); - info->OsVersion = CopyStr("Unknown"); - info->KernelVersion = CopyStr("Unknown"); - } -#ifdef UNIX_LINUX - { - BUF *buffer = ReadDump("/etc/os-release"); - if (buffer == NULL) - { - buffer = ReadDump("/usr/lib/os-release"); - } - - if (buffer != NULL) - { - LIST *values = NewEntryList(buffer->Buf, "\n", "="); - - FreeBuf(buffer); - - if (EntryListHasKey(values, "NAME")) - { - char *str = EntryListStrValue(values, "NAME"); - TrimQuotes(str); - Free(info->OsProductName); - info->OsProductName = CopyStr(str); - } - - if (EntryListHasKey(values, "HOME_URL")) - { - char *str = EntryListStrValue(values, "HOME_URL"); - TrimQuotes(str); - info->OsVendorName = CopyStr(str); - } - - if (EntryListHasKey(values, "VERSION")) - { - char *str = EntryListStrValue(values, "VERSION"); - TrimQuotes(str); - Free(info->OsVersion); - info->OsVersion = CopyStr(str); - } - else - { - // Debian testing/sid doesn't provide the version in /etc/os-release - buffer = ReadDump("/etc/debian_version"); - if (buffer != NULL) - { - Free(info->OsVersion); - info->OsVersion = CfgReadNextLine(buffer); - FreeBuf(buffer); - } - } - - FreeEntryList(values); - } - } -#endif -} - -// Examine whether the current OS is supported by the PacketiX VPN Kernel -bool UnixIsSupportedOs() -{ - // Support all UNIX OS which can run PacketiX VPN - return true; -} - -// Run a specified command -bool UnixRunW(wchar_t *filename, wchar_t *arg, bool hide, bool wait) -{ - char *filename8 = CopyUniToUtf(filename); - char *arg8 = CopyUniToUtf(arg); - bool ret = UnixRun(filename8, arg8, hide, wait); - - Free(filename8); - Free(arg8); - - return ret; -} -bool UnixRun(char *filename, char *arg, bool hide, bool wait) -{ - TOKEN_LIST *t; - char **args; - UINT ret; - - // Validate arguments - if (filename == NULL) - { - return false; - } - if (arg == NULL) - { - arg = ""; - } - - Print("", filename, arg); - t = ParseToken(arg, " "); - if (t == NULL) - { - return false; - } - else - { - UINT num_args; - UINT i; - num_args = t->NumTokens + 2; - args = ZeroMalloc(sizeof(char *) * num_args); - args[0] = filename; - for (i = 1;i < num_args - 1;i++) - { - args[i] = t->Token[i - 1]; - } - } - - // Create a child process - ret = fork(); - if (ret == -1) - { - // Child process creation failure - return false; - } - - if (ret == 0) - { - // Child process - if (hide) - { - // Close the standard I/O - UnixCloseIO(); - } - execvp(filename, args); - AbortExit(); - } - else - { - // Parent process - pid_t pid = (pid_t)ret; - Free(args); - FreeToken(t); - - if (wait) - { - int status = 0; - // Wait for the termination of the child process - if (waitpid(pid, &status, 0) == -1) - { - return false; - } - - if (WEXITSTATUS(status) == 0) - { - return true; - } - else - { - return false; - } - } - - return true; - } -} - -// Close the standard I/O -void UnixCloseIO() -{ - static bool close_io_first = false; - - // Execute only once - if (close_io_first) - { - return; - } - else - { - close(0); - close(1); - close(2); - (void)open("/dev/null", O_RDWR); - dup2(0, 1); - dup2(0, 2); - close_io_first = false; - } -} - -// Change the file name -bool UnixFileRenameW(wchar_t *old_name, wchar_t *new_name) -{ - char *old_name8 = CopyUniToUtf(old_name); - char *new_name8 = CopyUniToUtf(new_name); - bool ret = UnixFileRename(old_name8, new_name8); - - Free(old_name8); - Free(new_name8); - - return ret; -} -bool UnixFileRename(char *old_name, char *new_name) -{ - // Validate arguments - if (old_name == NULL || new_name == NULL) - { - return false; - } - - if (rename(old_name, new_name) != 0) - { - return false; - } - - return true; -} - -// Get the call stack -CALLSTACK_DATA *UnixGetCallStack() -{ - // This is not supported on non-Win32 - return NULL; -} - -// Get the symbol information from the call stack -bool UnixGetCallStackSymbolInfo(CALLSTACK_DATA *s) -{ - // This is not supported on non-Win32 - return false; -} - -// Delete the directory -bool UnixDeleteDirW(wchar_t *name) -{ - char *name8 = CopyUniToUtf(name); - bool ret = UnixDeleteDir(name8); - - Free(name8); - - return ret; -} -bool UnixDeleteDir(char *name) -{ - // Validate arguments - if (name == NULL) - { - return false; - } - - if (rmdir(name) != 0) - { - return false; - } - - return true; -} - -// Create a directory -bool UnixMakeDirW(wchar_t *name) -{ - char *name8 = CopyUniToUtf(name); - bool ret = UnixMakeDir(name8); - - Free(name8); - - return ret; -} -bool UnixMakeDir(char *name) -{ - // Validate arguments - if (name == NULL) - { - return false; - } - - if (mkdir(name, 0700) != 0) - { - return false; - } - - return true; -} - -// Delete the file -bool UnixFileDeleteW(wchar_t *name) -{ - bool ret; - char *name8 = CopyUniToUtf(name); - - ret = UnixFileDelete(name8); - - Free(name8); - - return ret; -} -bool UnixFileDelete(char *name) -{ - // Validate arguments - if (name == NULL) - { - return false; - } - - if (remove(name) != 0) - { - return false; - } - - return true; -} - -// Seek the file -bool UnixFileSeek(void *pData, UINT mode, int offset) -{ - UNIXIO *p; - UINT ret; - // Validate arguments - if (pData == NULL) - { - return 0; - } - if (mode != FILE_BEGIN && mode != FILE_END && mode != FILE_CURRENT) - { - return false; - } - - p = (UNIXIO *)pData; - - ret = lseek(p->fd, offset, mode); - - if (ret == -1) - { - return false; - } - - return true; -} - -// Get the file size -UINT64 UnixFileSize(void *pData) -{ - struct stat st; - UNIXIO *p; - int r; - // Validate arguments - if (pData == NULL) - { - return 0; - } - - p = (UNIXIO *)pData; - - Zero(&st, sizeof(st)); - r = fstat(p->fd, &st); - if (r != 0) - { - return 0; - } - - return (UINT64)st.st_size; -} - -// Write to the file -bool UnixFileWrite(void *pData, void *buf, UINT size) -{ - UNIXIO *p; - UINT ret; - // Validate arguments - if (pData == NULL || buf == NULL || size == 0) - { - return false; - } - - p = (UNIXIO *)pData; - - ret = write(p->fd, buf, size); - if (ret != size) - { - return false; - } - - return true; -} - -// Read from the file -bool UnixFileRead(void *pData, void *buf, UINT size) -{ - UNIXIO *p; - UINT ret; - // Validate arguments - if (pData == NULL || buf == NULL || size == 0) - { - return false; - } - - p = (UNIXIO *)pData; - - ret = read(p->fd, buf, size); - if (ret != size) - { - return false; - } - - return true; -} - -// Flush to the file -void UnixFileFlush(void *pData) -{ - UNIXIO *p; - bool write_mode; - // Validate arguments - if (pData == NULL) - { - return; - } - - p = (UNIXIO *)pData; - - write_mode = p->write_mode; - - if (write_mode) - { - fsync(p->fd); - } -} - -// Close the file -void UnixFileClose(void *pData, bool no_flush) -{ - UNIXIO *p; - bool write_mode; - // Validate arguments - if (pData == NULL) - { - return; - } - - p = (UNIXIO *)pData; - - write_mode = p->write_mode; - - if (write_mode && no_flush == false) - { - fsync(p->fd); - } - - close(p->fd); - - UnixMemoryFree(p); - - if (write_mode) - { - //sync(); - } -} - -// Create a file -void *UnixFileCreateW(wchar_t *name) -{ - void *ret; - char *name8 = CopyUniToUtf(name); - - ret = UnixFileCreate(name8); - - Free(name8); - - return ret; -} -void *UnixFileCreate(char *name) -{ - UNIXIO *p; - int fd; - // Validate arguments - if (name == NULL) - { - return NULL; - } - - fd = creat(name, 0600); - if (fd == -1) - { - return NULL; - } - - // Memory allocation - p = UnixMemoryAlloc(sizeof(UNIXIO)); - p->fd = fd; - p->write_mode = true; - - return (void *)p; -} - -// Open the file -void *UnixFileOpenW(wchar_t *name, bool write_mode, bool read_lock) -{ - char *name8 = CopyUniToUtf(name); - void *ret; - - ret = UnixFileOpen(name8, write_mode, read_lock); - - Free(name8); - - return ret; -} -void *UnixFileOpen(char *name, bool write_mode, bool read_lock) -{ - UNIXIO *p; - int fd; - int mode; - // Validate arguments - if (name == NULL) - { - return NULL; - } - - if (write_mode == false) - { - mode = O_RDONLY; - } - else - { - mode = O_RDWR; - } - - // Open the file - fd = open(name, mode); - if (fd == -1) - { - return NULL; - } - - // Memory allocation - p = UnixMemoryAlloc(sizeof(UNIXIO)); - p->fd = fd; - p->write_mode = write_mode; - - return (void *)p; -} - -// Get UNIXIO object for stdout -void* GetUnixio4Stdout() -{ - static UNIXIO unixio = - { - .fd = -1, - .write_mode = true - }; - - if (g_foreground) - { - unixio.fd = STDOUT_FILENO; - return &unixio; - } - return NULL; -} - -// Return the current thread ID -UINT UnixThreadId() -{ - UINT ret; - - ret = (UINT)pthread_self(); - - return ret; -} - -// Thread function -void *UnixDefaultThreadProc(void *param) -{ - UNIXTHREAD *ut; - UNIXTHREADSTARTUPINFO *info = (UNIXTHREADSTARTUPINFO *)param; - if (info == NULL) - { - return 0; - } - - ut = (UNIXTHREAD *)info->thread->pData; - - // Call the thread function - info->thread_proc(info->thread, info->param); - - // Set a termination flag - ut->finished = true; - - // Release of reference - ReleaseThread(info->thread); - - UnixMemoryFree(info); - - FreeOpenSSLThreadState(); - - return 0; -} - -// Release of thread -void UnixFreeThread(THREAD *t) -{ - // Validate arguments - if (t == NULL) - { - return; - } - - // Free memory - UnixMemoryFree(t->pData); -} - -// Wait for the termination of the thread -bool UnixWaitThread(THREAD *t) -{ - UNIXTHREAD *ut; - void *retcode = NULL; - // Validate arguments - if (t == NULL) - { - return false; - } - ut = (UNIXTHREAD *)t->pData; - if (ut == NULL) - { - return false; - } - - pthread_join(ut->thread, &retcode); - - return true; -} - -// Thread initialization -bool UnixInitThread(THREAD *t) -{ - UNIXTHREAD *ut; - UNIXTHREADSTARTUPINFO *info; - pthread_attr_t attr; - // Validate arguments - if (t == NULL || t->thread_proc == NULL) - { - return false; - } - - // Thread data creation - ut = UnixMemoryAlloc(sizeof(UNIXTHREAD)); - Zero(ut, sizeof(UNIXTHREAD)); - - // Creating the startup information - info = UnixMemoryAlloc(sizeof(UNIXTHREADSTARTUPINFO)); - Zero(info, sizeof(UNIXTHREADSTARTUPINFO)); - info->param = t->param; - info->thread_proc = t->thread_proc; - info->thread = t; - AddRef(t->ref); - - // Thread creation - pthread_attr_init(&attr); - pthread_attr_setstacksize(&attr, UNIX_THREAD_STACK_SIZE); - - t->pData = (void *)ut; - - if (pthread_create(&ut->thread, &attr, UnixDefaultThreadProc, info) != 0) - { - // An error has occured - t->pData = NULL; - (void)Release(t->ref); - UnixMemoryFree(ut); - UnixMemoryFree(info); - pthread_attr_destroy(&attr); - return false; - } - - pthread_attr_destroy(&attr); - - return true; -} - -// Release the event -void UnixFreeEvent(EVENT *event) -{ - UNIXEVENT *ue = (UNIXEVENT *)event->pData; - if (ue == NULL) - { - return; - } - - pthread_cond_destroy(&ue->cond); - pthread_mutex_destroy(&ue->mutex); - - UnixMemoryFree(ue); -} - -// Wait for a event -bool UnixWaitEvent(EVENT *event, UINT timeout) -{ - UNIXEVENT *ue = (UNIXEVENT *)event->pData; - struct timeval now; - struct timespec to; - bool ret; - if (ue == NULL) - { - return false; - } - - pthread_mutex_lock(&ue->mutex); - gettimeofday(&now, NULL); - to.tv_sec = now.tv_sec + timeout / 1000; - to.tv_nsec = now.tv_usec * 1000 + (timeout % 1000) * 1000 * 1000; - if ((to.tv_nsec / 1000000000) >= 1) - { - to.tv_sec += to.tv_nsec / 1000000000; - to.tv_nsec = to.tv_nsec % 1000000000; - } - - ret = true; - - while (ue->signal == false) - { - if (timeout != INFINITE) - { - if (pthread_cond_timedwait(&ue->cond, &ue->mutex, &to)) - { - ret = false; - break; - } - } - else - { - pthread_cond_wait(&ue->cond, &ue->mutex); - } - } - ue->signal = false; - - pthread_mutex_unlock(&ue->mutex); - - return ret; -} - -// Reset the event -void UnixResetEvent(EVENT *event) -{ - UNIXEVENT *ue = (UNIXEVENT *)event->pData; - if (ue == NULL) - { - return; - } - - pthread_mutex_lock(&ue->mutex); - ue->signal = false; - pthread_cond_signal(&ue->cond); - pthread_mutex_unlock(&ue->mutex); -} - -// Set the event -void UnixSetEvent(EVENT *event) -{ - UNIXEVENT *ue = (UNIXEVENT *)event->pData; - if (ue == NULL) - { - return; - } - - pthread_mutex_lock(&ue->mutex); - ue->signal = true; - pthread_cond_signal(&ue->cond); - pthread_mutex_unlock(&ue->mutex); -} - -// Initialize the event -void UnixInitEvent(EVENT *event) -{ - UNIXEVENT *ue = UnixMemoryAlloc(sizeof(UNIXEVENT)); - - Zero(ue, sizeof(UNIXEVENT)); - - pthread_cond_init(&ue->cond, NULL); - pthread_mutex_init(&ue->mutex, NULL); - ue->signal = false; - - event->pData = (void *)ue; -} - -// Delete the lock -void UnixDeleteLock(LOCK *lock) -{ - pthread_mutex_t *mutex; - // Reset Ready flag safely - UnixLock(lock); - lock->Ready = false; - UnixUnlockEx(lock, true); - - // Delete the mutex - mutex = (pthread_mutex_t *)lock->pData; - pthread_mutex_destroy(mutex); - - // Memory release - UnixMemoryFree(mutex); - UnixMemoryFree(lock); -} - -// Unlock -void UnixUnlock(LOCK *lock) -{ - UnixUnlockEx(lock, false); -} -void UnixUnlockEx(LOCK *lock, bool inner) -{ - pthread_mutex_t *mutex; - if (lock->Ready == false && inner == false) - { - // State is invalid - return; - } - mutex = (pthread_mutex_t *)lock->pData; - - if ((--lock->locked_count) > 0) - { - return; - } - - lock->thread_id = INFINITE; - - pthread_mutex_unlock(mutex); - - return; -} - -// Lock -bool UnixLock(LOCK *lock) -{ - pthread_mutex_t *mutex; - UINT thread_id = UnixThreadId(); - if (lock->Ready == false) - { - // State is invalid - return false; - } - - if (lock->thread_id == thread_id) - { - lock->locked_count++; - return true; - } - - mutex = (pthread_mutex_t *)lock->pData; - - pthread_mutex_lock(mutex); - - lock->thread_id = thread_id; - lock->locked_count++; - - return true; -} - -// Creating a new lock -LOCK *UnixNewLock() -{ - pthread_mutex_t *mutex; - // Memory allocation - LOCK *lock = UnixMemoryAlloc(sizeof(LOCK)); - - // Create a mutex - mutex = UnixMemoryAlloc(sizeof(pthread_mutex_t)); - if (mutex == NULL) - { - return NULL; - } - - // Initialization of the mutex - pthread_mutex_init(mutex, NULL); - - lock->pData = (void *)mutex; - lock->Ready = true; - - lock->thread_id = INFINITE; - lock->locked_count = 0; - - return lock; -} - -// Sleep -void UnixSleep(UINT time) -{ - UINT sec = 0, millisec = 0; - // Validate arguments - if (time == 0) - { - return; - } - - if (time == INFINITE) - { - // Wait forever - while (true) - { -#ifdef UNIX_SOLARIS - UnixSolarisSleep(time); -#else - sleep(1000000); -#endif - } - } - -#ifdef UNIX_SOLARIS - UnixSolarisSleep(time); -#else - - // Prevent overflow - sec = time / 1000; - millisec = time % 1000; - - if (sec != 0) - { - sleep(sec); - } - if (millisec != 0) - { - usleep(millisec * 1000); - } -#endif -} - -// Decrement -void UnixDec32(UINT *value) -{ - if (value != NULL) - { - (*value)--; - } -} - -// Increment -void UnixInc32(UINT *value) -{ - if (value != NULL) - { - (*value)++; - } -} - -// Get the System Time -void UnixGetSystemTime(SYSTEMTIME *system_time) -{ - time_t now = 0; - time_64t now2 = 0; - struct tm tm; - struct timeval tv; - struct timezone tz; - // Validate arguments - if (system_time == NULL) - { - return; - } - - pthread_mutex_lock(&get_time_lock); - - Zero(system_time, sizeof(SYSTEMTIME)); - Zero(&tv, sizeof(tv)); - Zero(&tz, sizeof(tz)); - - time(&now); - - if (sizeof(time_t) == 4) - { - now2 = (time_64t)((UINT64)((UINT)now)); - } - else - { - now2 = now; - } - - c_gmtime_r(&now2, &tm); - - TmToSystem(system_time, &tm); - - gettimeofday(&tv, &tz); - - system_time->wMilliseconds = tv.tv_usec / 1000; - - pthread_mutex_unlock(&get_time_lock); -} - -// Get the system timer (64bit) -UINT64 UnixGetTick64() -{ -#if defined(OS_WIN32) || defined(CLOCK_REALTIME) || defined(CLOCK_MONOTONIC) || defined(CLOCK_HIGHRES) - - struct timespec t; - UINT64 ret; - - Zero(&t, sizeof(t)); - - // Function to get the boot time of the system - // Be careful. The Implementation is depend on the system. -#ifdef CLOCK_HIGHRES - clock_gettime(CLOCK_HIGHRES, &t); -#elif CLOCK_MONOTONIC - clock_gettime(CLOCK_MONOTONIC, &t); -#else - clock_gettime(CLOCK_REALTIME, &t); -#endif - - ret = ((UINT64)((UINT)t.tv_sec)) * 1000LL + (UINT64)t.tv_nsec / 1000000LL; - - if (ret == 0) - { - ret = TickRealtimeManual(); - } - - return ret; -#else - return TickRealtimeManual(); -#endif -} - -// Get the system timer -UINT UnixGetTick() -{ - return (UINT)UnixGetTick64(); -} - -// Memory allocation -void *UnixMemoryAlloc(UINT size) -{ - void *r; - pthread_mutex_lock(&malloc_lock); - r = malloc(size); - pthread_mutex_unlock(&malloc_lock); - return r; -} - -// Reallocation of the memory -void *UnixMemoryReAlloc(void *addr, UINT size) -{ - void *r; - pthread_mutex_lock(&malloc_lock); - r = realloc(addr, size); - pthread_mutex_unlock(&malloc_lock); - return r; -} - -// Free the memory -void UnixMemoryFree(void *addr) -{ - pthread_mutex_lock(&malloc_lock); - free(addr); - pthread_mutex_unlock(&malloc_lock); -} - -// SIGCHLD handler -void UnixSigChldHandler(int sig) -{ - // Recall the zombie processes - while (waitpid(-1, NULL, WNOHANG) > 0); - signal(SIGCHLD, UnixSigChldHandler); -} - -// Disable core dump -void UnixDisableCoreDump() -{ -#ifdef RLIMIT_CORE - UnixSetResourceLimit(RLIMIT_CORE, 0); -#endif // RLIMIT_CORE -} - -// Initialize the library for UNIX -void UnixInit() -{ - UNIXIO *o; - UINT64 max_memory = UNIX_MAX_MEMORY; - - if (UnixIs64BitRlimSupported()) - { - max_memory = UNIX_MAX_MEMORY_64; - } - - UnixInitSolarisSleep(); - - // Global lock - pthread_mutex_init(&get_time_lock, NULL); - pthread_mutex_init(&malloc_lock, NULL); - - // Get the Process ID - current_process_id = getpid(); - -#ifdef RLIMIT_CORE - UnixSetResourceLimit(RLIMIT_CORE, max_memory); -#endif // RLIMIT_CORE - -#ifdef RLIMIT_DATA - UnixSetResourceLimit(RLIMIT_DATA, max_memory); -#endif // RLIMIT_DATA - -#ifdef RLIMIT_NOFILE -#ifndef UNIX_MACOS - UnixSetResourceLimit(RLIMIT_NOFILE, UNIX_MAX_FD); -#else // UNIX_MACOS - UnixSetResourceLimit(RLIMIT_NOFILE, UNIX_MAX_FD_MACOS); -#endif // UNIX_MACOS -#endif // RLIMIT_NOFILE - -#ifdef RLIMIT_STACK -// UnixSetResourceLimit(RLIMIT_STACK, max_memory); -#endif // RLIMIT_STACK - -#ifdef RLIMIT_RSS - UnixSetResourceLimit(RLIMIT_RSS, max_memory); -#endif // RLIMIT_RSS - -#ifdef RLIMIT_LOCKS - UnixSetResourceLimit(RLIMIT_LOCKS, UNIX_MAX_LOCKS); -#endif // RLIMIT_LOCKS - -#ifdef RLIMIT_MEMLOCK - UnixSetResourceLimit(RLIMIT_MEMLOCK, max_memory); -#endif // RLIMIT_MEMLOCK - -#ifdef RLIMIT_NPROC - UnixSetResourceLimit(RLIMIT_NPROC, UNIX_MAX_CHILD_PROCESSES); -#endif // RLIMIT_NPROC - - // Write a value to the threads-max of the proc file system - o = UnixFileCreate("/proc/sys/kernel/threads-max"); - if (o != NULL) - { - char tmp[128]; - sprintf(tmp, "%u\n", UNIX_LINUX_MAX_THREADS); - UnixFileWrite(o, tmp, strlen(tmp)); - UnixFileClose(o, false); - } - - // Set the signals that is to be ignored - signal(SIGPIPE, SIG_IGN); - signal(SIGALRM, SIG_IGN); - -#ifdef UNIX_BSD - signal(64, SIG_IGN); -#endif // UNIX_BSD - -#ifdef SIGXFSZ - signal(SIGXFSZ, SIG_IGN); -#endif // SIGXFSZ - - // Set a signal handler to salvage the child processes - signal(SIGCHLD, UnixSigChldHandler); -} - -// Release the library for UNIX -void UnixFree() -{ - UnixFreeSolarisSleep(); - - current_process_id = 0; - - pthread_mutex_destroy(&get_time_lock); -} - -// Adjust the upper limit of resources that may be occupied -void UnixSetResourceLimit(UINT id, UINT64 value) -{ - struct rlimit t; - UINT64 hard_limit; - - if (UnixIs64BitRlimSupported() == false) - { - if (value > (UINT64)4294967295ULL) - { - value = (UINT64)4294967295ULL; - } - } - - Zero(&t, sizeof(t)); - getrlimit(id, &t); - - hard_limit = (UINT64)t.rlim_max; - - Zero(&t, sizeof(t)); - t.rlim_cur = (rlim_t)MIN(value, hard_limit); - t.rlim_max = (rlim_t)hard_limit; - setrlimit(id, &t); - - Zero(&t, sizeof(t)); - t.rlim_cur = (rlim_t)value; - t.rlim_max = (rlim_t)value; - setrlimit(id, &t); -} - -// Is the rlim_t type 64-bit? -bool UnixIs64BitRlimSupported() -{ - if (sizeof(rlim_t) >= 8) - { - return true; - } - - return false; -} - -// Generate the PID file name -void UnixGenPidFileName(char *name, UINT size) -{ - char exe_name[MAX_PATH]; - UCHAR hash[MD5_SIZE]; - char tmp1[64]; - char dir[MAX_PATH]; - // Validate arguments - if (name == NULL) - { - return; - } - - GetPidDir(dir, sizeof(dir)); - - GetExeName(exe_name, sizeof(exe_name)); - StrCat(exe_name, sizeof(exe_name), ":pid_hash"); - StrUpper(exe_name); - - Md5(hash, exe_name, StrLen(exe_name)); - BinToStr(tmp1, sizeof(tmp1), hash, sizeof(hash)); - - Format(name, size, "%s/.pid_%s", dir, tmp1); -} - -// Delete the PID file -void UnixDeletePidFile() -{ - char tmp[MAX_PATH]; - - UnixGenPidFileName(tmp, sizeof(tmp)); - - UnixFileDelete(tmp); -} - -// Delete the CTL file -void UnixDeleteCtlFile() -{ - char tmp[MAX_PATH]; - - UnixGenCtlFileName(tmp, sizeof(tmp)); - - UnixFileDelete(tmp); -} - -// Generate the CTL file name -void UnixGenCtlFileName(char *name, UINT size) -{ - char exe_name[MAX_PATH]; - UCHAR hash[MD5_SIZE]; - char tmp1[64]; - char dir[MAX_PATH]; - // Validate arguments - if (name == NULL) - { - return; - } - - GetPidDir(dir, sizeof(dir)); - - GetExeName(exe_name, sizeof(exe_name)); - StrCat(exe_name, sizeof(exe_name), ":pid_hash"); - StrUpper(exe_name); - - Md5(hash, exe_name, StrLen(exe_name)); - BinToStr(tmp1, sizeof(tmp1), hash, sizeof(hash)); - - Format(name, size, "%s/.ctl_%s", dir, tmp1); -} - -// Write the CTL file -void UnixWriteCtlFile(UINT i) -{ - char tmp[MAX_PATH]; - char tmp2[64]; - IO *o; - - UnixGenCtlFileName(tmp, sizeof(tmp)); - Format(tmp2, sizeof(tmp2), "%u\n", i); - - o = FileCreate(tmp); - if (o != NULL) - { - FileWrite(o, tmp2, StrLen(tmp2)); - FileClose(o); - } -} - -// Write to the PID file -void UnixWritePidFile(UINT pid) -{ - char tmp[MAX_PATH]; - char tmp2[64]; - IO *o; - - UnixGenPidFileName(tmp, sizeof(tmp)); - Format(tmp2, sizeof(tmp2), "%u\n", pid); - - o = FileCreate(tmp); - if (o != NULL) - { - FileWrite(o, tmp2, StrLen(tmp2)); - FileClose(o); - } -} - -// Read the PID file -UINT UnixReadPidFile() -{ - char tmp[MAX_PATH]; - BUF *buf; - - UnixGenPidFileName(tmp, sizeof(tmp)); - - buf = ReadDump(tmp); - if (buf == NULL) - { - return 0; - } - - Zero(tmp, sizeof(tmp)); - Copy(tmp, buf->Buf, MIN(buf->Size, sizeof(tmp))); - FreeBuf(buf); - - return ToInt(tmp); -} - -// Read the CTL file -UINT UnixReadCtlFile() -{ - char tmp[MAX_PATH]; - BUF *buf; - - UnixGenCtlFileName(tmp, sizeof(tmp)); - - buf = ReadDump(tmp); - if (buf == NULL) - { - return 0; - } - - Zero(tmp, sizeof(tmp)); - Copy(tmp, buf->Buf, MIN(buf->Size, sizeof(tmp))); - FreeBuf(buf); - - return ToInt(tmp); -} - -// Get the UID -UINT UnixGetUID() -{ - return (UINT)getuid(); -} - -// Start the service -void UnixStartService(char *name) -{ - char *svc_name, *svc_title; - char tmp[128]; - INSTANCE *inst; - char exe[MAX_PATH]; - // Validate arguments - if (name == NULL) - { - return; - } - - GetExeName(exe, sizeof(exe)); - - Format(tmp, sizeof(tmp), SVC_NAME, name); - svc_name = _SS(tmp); - Format(tmp, sizeof(tmp), SVC_TITLE, name); - svc_title = _SS(tmp); - - // Examine whether the service has not been started already - inst = NewSingleInstance(NULL); - if (inst == NULL) - { - // Service is already running - UniPrint(_UU("UNIX_SVC_ALREADY_START"), svc_title, svc_name); - } - else - { - int pid; - // Begin to start the service - UniPrint(_UU("UNIX_SVC_STARTED"), svc_title); - - if (UnixGetUID() != 0) - { - // Non-root warning - UniPrint(_UU("UNIX_SVC_NONROOT")); - } - - FreeSingleInstance(inst); - - // Create a child process - pid = fork(); - if (pid == -1) - { - UniPrint(_UU("UNIX_SVC_ERROR_FORK"), svc_title); - } - else - { - if (pid == 0) - { - // Child process - char *param = UNIX_SVC_ARG_EXEC_SVC; - char **args; - - // Daemonize - setsid(); - UnixCloseIO(); - signal(SIGHUP, SIG_IGN); - - // Prepare arguments - args = ZeroMalloc(sizeof(char *) * 3); - args[0] = exe; - args[1] = param; - args[2] = NULL; - - execvp(exe, args); - AbortExit(); - } - else - { - // Don't write the child process number to the file -// UnixWritePidFile(pid); - } - } - } -} - -// Stop the Service -void UnixStopService(char *name) -{ - char *svc_name, *svc_title; - char tmp[128]; - INSTANCE *inst; - char exe[MAX_PATH]; - UINT pid; - // Validate arguments - if (name == NULL) - { - return; - } - - GetExeName(exe, sizeof(exe)); - - Format(tmp, sizeof(tmp), SVC_NAME, name); - svc_name = _SS(tmp); - Format(tmp, sizeof(tmp), SVC_TITLE, name); - svc_title = _SS(tmp); - - inst = NewSingleInstance(NULL); - pid = UnixReadPidFile(); - if (inst != NULL || pid == 0) - { - // Service is not running yet - UniPrint(_UU("UNIX_SVC_NOT_STARTED"), svc_title, svc_name); - } - else - { - // Stop the service - UniPrint(_UU("UNIX_SVC_STOPPING"), svc_title); - - // Terminate the process - kill(pid, SIGTERM); -#ifdef UNIX_BSD - UnixWriteCtlFile(Rand32()); -#endif // UNIX_BSD - if (UnixWaitProcessEx(pid, UNIX_SERVICE_STOP_TIMEOUT_2)) - { - UniPrint(_UU("UNIX_SVC_STOPPED"), svc_title); - } - else - { - // SIGKILL - char tmp[256]; - - Format(tmp, sizeof(tmp), "killall -KILL %s", name); - - UniPrint(_UU("UNIX_SVC_STOP_FAILED"), svc_title); - system(tmp); - } - } - - FreeSingleInstance(inst); -} - -// Handler of the stop signal to the process -void UnixSigTermHandler(int signum) -{ - if (signum == SIGTERM) - { - unix_svc_terminate = true; - } -} - -// The thread for stop service -void UnixStopThread(THREAD *t, void *param) -{ - SERVICE_FUNCTION *stop = (SERVICE_FUNCTION *)param; - // Validate arguments - if (t == NULL || param == NULL) - { - return; - } - - stop(); -} - -// Execute the main body of the service -void UnixExecService(char *name, SERVICE_FUNCTION *start, SERVICE_FUNCTION *stop) -{ - char *svc_name, *svc_title; - char tmp[128]; - INSTANCE *inst; - UINT yobi_size = 1024 * 128; - void *yobi1, *yobi2; - UINT saved_ctl; - // Validate arguments - if (start == NULL || stop == NULL || name == NULL) - { - return; - } - - Format(tmp, sizeof(tmp), SVC_NAME, name); - svc_name = _SS(tmp); - Format(tmp, sizeof(tmp), SVC_TITLE, name); - svc_title = _SS(tmp); - - UnixWriteCtlFile(Rand32()); - saved_ctl = UnixReadCtlFile(); - - inst = NewSingleInstance(NULL); - if (inst != NULL) - { - THREAD *t; - - yobi1 = ZeroMalloc(yobi_size); - yobi2 = ZeroMalloc(yobi_size); - - // Start - UnixWritePidFile(getpid()); - - start(); - - // Starting complete. wait for arriving SIGTERM from another process - signal(SIGTERM, &UnixSigTermHandler); - while (unix_svc_terminate == false) - { -#if !(defined(UNIX_BSD) || defined(UNIX_MACOS)) - pause(); -#else // defined(UNIX_BSD) || defined(UNIX_MACOS) - if (UnixReadCtlFile() != saved_ctl) - { - break; - } - - SleepThread(1394); -#endif // defined(UNIX_BSD) || defined(UNIX_MACOS) - } - - // Stop - Free(yobi1); - t = NewThread(UnixStopThread, stop); - if (t == NULL || (WaitThread(t, UNIX_SERVICE_STOP_TIMEOUT_1) == false)) - { - // Terminate forcibly if creation of a halting thread have - // failed or timed out - Free(yobi2); - FreeSingleInstance(inst); - UnixDeletePidFile(); - _exit(0); - } - ReleaseThread(t); - - // Delete the PID file - UnixDeletePidFile(); - - // Delete the CTL file - UnixDeleteCtlFile(); - - FreeSingleInstance(inst); - - Free(yobi2); - } -} - -// Get whether the process with the specified pid exists -bool UnixIsProcess(UINT pid) -{ - if (getsid((pid_t)pid) == -1) - { - return false; - } - - return true; -} - -// Wait for the termination of the specified process -bool UnixWaitProcessEx(UINT pid, UINT timeout) -{ - UINT64 start_tick = Tick64(); - UINT64 end_tick = start_tick + (UINT64)timeout; - if (timeout == INFINITE) - { - end_tick = 0; - } - while (UnixIsProcess(pid)) - { - if (end_tick != 0) - { - if (end_tick < Tick64()) - { - return false; - } - } - SleepThread(100); - } - return true; -} - -// Description of how to start -void UnixUsage(char *name) -{ - char *svc_name, *svc_title; - char tmp[128]; - // Validate arguments - if (name == NULL) - { - return; - } - - Format(tmp, sizeof(tmp), SVC_NAME, name); - svc_name = _SS(tmp); - Format(tmp, sizeof(tmp), SVC_TITLE, name); - svc_title = _SS(tmp); - - UniPrint(_UU("UNIX_SVC_HELP"), svc_title, svc_name, svc_name, svc_title, svc_name, svc_title); -} - -// Main function of the UNIX service -UINT UnixService(int argc, char *argv[], char *name, SERVICE_FUNCTION *start, SERVICE_FUNCTION *stop) -{ - // Validate arguments - if (name == NULL || start == NULL || stop == NULL) - { - return 0; - } - - if (argc >= 2 && StrCmpi(argv[1], UNIX_SVC_ARG_EXEC_SVC) == 0) - { - UINT pid; - // Start a child process - // Restart if the child process didn't exit properly - -RESTART_PROCESS: - pid = fork(); - if ((int)pid != -1) - { - if (pid == 0) - { - // Run the main process - UnixServiceMain(argc, argv, name, start, stop); - } - else - { - int status = 0, ret; - - // Wait for the termination of the child process - ret = waitpid(pid, &status, 0); - - if (WIFEXITED(status) == 0) - { - // Aborted - UnixSleep(100); - goto RESTART_PROCESS; - } - } - } - } - else if (argc >= 3 && StrCmpi(argv[1], UNIX_SVC_ARG_START) == 0 && StrCmpi(argv[2], UNIX_SVC_ARG_FOREGROUND) == 0) - { -#ifdef DEBUG - // If set memcheck = true, the program will be vitally slow since it will log all malloc() / realloc() / free() calls to find the cause of memory leak. - // For normal debug we set memcheck = false. - // Please set memcheck = true if you want to test the cause of memory leaks. - InitMayaqua(false, true, argc, argv); -#else - InitMayaqua(false, false, argc, argv); -#endif - UnixExecService(name, start, stop); - FreeMayaqua(); - } - else - { - // Start normally - UnixServiceMain(argc, argv, name, start, stop); - } - - return 0; -} -void UnixServiceMain(int argc, char *argv[], char *name, SERVICE_FUNCTION *start, SERVICE_FUNCTION *stop) -{ - UINT mode = 0; - // Start of the Mayaqua -#ifdef DEBUG - // If set memcheck = true, the program will be vitally slow since it will log all malloc() / realloc() / free() calls to find the cause of memory leak. - // For normal debug we set memcheck = false. - // Please set memcheck = true if you want to test the cause of memory leaks. - InitMayaqua(false, true, argc, argv); -#else - InitMayaqua(false, false, argc, argv); -#endif - - if (argc >= 2) - { - if (StrCmpi(argv[1], UNIX_SVC_ARG_START) == 0) - { - mode = UNIX_SVC_MODE_START; - } - if (StrCmpi(argv[1], UNIX_SVC_ARG_STOP) == 0) - { - mode = UNIX_SVC_MODE_STOP; - } - if (StrCmpi(argv[1], UNIX_SVC_ARG_EXEC_SVC) == 0) - { - mode = UNIX_SVC_MODE_EXEC_SVC; - } - if (StrCmpi(argv[1], UNIX_ARG_EXIT) == 0) - { - mode = UNIX_SVC_MODE_EXIT; - } - } - - switch (mode) - { - case UNIX_SVC_MODE_EXIT: - break; - - case UNIX_SVC_MODE_START: - UnixStartService(name); - break; - - case UNIX_SVC_MODE_STOP: - UnixStopService(name); - break; - - case UNIX_SVC_MODE_EXEC_SVC: - UnixExecService(name, start, stop); - break; - - default: - UnixUsage(name); - break; - } - - // End of the Mayaqua - FreeMayaqua(); - - return; -} - -#endif // UNIX +// SoftEther VPN Source Code - Developer Edition Master Branch +// Mayaqua Kernel + + +// Unix.c +// UNIX dependent code + +#include + +#ifdef UNIX + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#ifdef UNIX_MACOS +#ifdef NO_VLAN +// Struct statfs for MacOS X +typedef struct fsid { int32_t val[2]; } fsid_t; +struct statfs { + short f_otype; /* TEMPORARY SHADOW COPY OF f_type */ + short f_oflags; /* TEMPORARY SHADOW COPY OF f_flags */ + long f_bsize; /* fundamental file system block size */ + long f_iosize; /* optimal transfer block size */ + long f_blocks; /* total data blocks in file system */ + long f_bfree; /* free blocks in fs */ + long f_bavail; /* free blocks avail to non-superuser */ + long f_files; /* total file nodes in file system */ + long f_ffree; /* free file nodes in fs */ + fsid_t f_fsid; /* file system id */ + uid_t f_owner; /* user that mounted the filesystem */ + short f_reserved1; /* spare for later */ + short f_type; /* type of filesystem */ + long f_flags; /* copy of mount exported flags */ + long f_reserved2[2]; /* reserved for future use */ + char f_fstypename[15]; /* fs type name */ + char f_mntonname[90]; /* directory on which mounted */ + char f_mntfromname[90];/* mounted filesystem */ +}; +#else // NO_VLAN +#include +#endif // NO_VLAN +#endif // UNIX_MACOS + +// Scandir() function for Solaris +#ifdef UNIX_SOLARIS +#define scandir local_scandir +#define alphasort local_alphasort + +int local_scandir(const char *dir, struct dirent ***namelist, + int (*select)(const struct dirent *), + int (*compar)(const struct dirent **, const struct dirent **)) +{ + DIR *d; + struct dirent *entry; + register int i=0; + size_t entrysize; + + if ((d=opendir(dir)) == NULL) + return(-1); + + *namelist=NULL; + while ((entry=readdir(d)) != NULL) + { + if (select == NULL || (*select)(entry)) + { + *namelist=(struct dirent **)realloc((void *)(*namelist), + (size_t)((i+1)*sizeof(struct dirent *))); + if (*namelist == NULL) return(-1); + entrysize=sizeof(struct dirent)-sizeof(entry->d_name)+strlen(entry->d_name)+1; + (*namelist)[i]=(struct dirent *)malloc(entrysize); + if ((*namelist)[i] == NULL) return(-1); + memcpy((*namelist)[i], entry, entrysize); + i++; + } + } + if (closedir(d)) return(-1); + if (i == 0) return(-1); + if (compar != NULL) + qsort((void *)(*namelist), (size_t)i, sizeof(struct dirent *), compar); + + return(i); +} + +int local_alphasort(const struct dirent **a, const struct dirent **b) +{ + return(strcmp((*a)->d_name, (*b)->d_name)); +} + + +#endif // UNIX_SOLARIS + +// Thread data for UNIX +typedef struct UNIXTHREAD +{ + pthread_t thread; + bool finished; +} UNIXTHREAD; + +// Thread startup information for UNIX +typedef struct UNIXTHREADSTARTUPINFO +{ + THREAD_PROC *thread_proc; + void *param; + THREAD *thread; +} UNIXTHREADSTARTUPINFO; + +// Thread function prototype for UNIX +void *UnixDefaultThreadProc(void *param); + +// Current process ID +static pid_t current_process_id = 0; + +// File I/O data for UNIX +typedef struct UNIXIO +{ + int fd; + bool write_mode; +} UNIXIO; + +// Lock file data for UNIX +typedef struct UNIXLOCKFILE +{ + char FileName[MAX_SIZE]; + int fd; +} UNIXLOCKFILE; + +// Event data for UNIX +typedef struct UNIXEVENT +{ + pthread_mutex_t mutex; + pthread_cond_t cond; + bool signal; +} UNIXEVENT; + +static pthread_mutex_t get_time_lock; +static pthread_mutex_t malloc_lock; +static bool high_process = false; + +static bool unix_svc_terminate = false; +static int solaris_sleep_p1 = -1, solaris_sleep_p2 = -1; + +// Create a dispatch table +OS_DISPATCH_TABLE *UnixGetDispatchTable() +{ + static OS_DISPATCH_TABLE t = + { + UnixInit, + UnixFree, + UnixMemoryAlloc, + UnixMemoryReAlloc, + UnixMemoryFree, + UnixGetTick, + UnixGetSystemTime, + UnixInc32, + UnixDec32, + UnixSleep, + UnixNewLock, + UnixLock, + UnixUnlock, + UnixDeleteLock, + UnixInitEvent, + UnixSetEvent, + UnixResetEvent, + UnixWaitEvent, + UnixFreeEvent, + UnixWaitThread, + UnixFreeThread, + UnixInitThread, + UnixThreadId, + UnixFileOpen, + UnixFileOpenW, + UnixFileCreate, + UnixFileCreateW, + UnixFileWrite, + UnixFileRead, + UnixFileClose, + UnixFileFlush, + UnixFileSize, + UnixFileSeek, + UnixFileDelete, + UnixFileDeleteW, + UnixMakeDir, + UnixMakeDirW, + UnixDeleteDir, + UnixDeleteDirW, + UnixGetCallStack, + UnixGetCallStackSymbolInfo, + UnixFileRename, + UnixFileRenameW, + UnixRun, + UnixRunW, + UnixIsSupportedOs, + UnixGetOsInfo, + UnixAlert, + UnixAlertW, + UnixGetProductId, + UnixSetHighPriority, + UnixRestorePriority, + UnixNewSingleInstance, + UnixFreeSingleInstance, + UnixGetMemInfo, + UnixYield, + }; + + return &t; +} + +static void *signal_received_for_ignore(int sig, siginfo_t *info, void *ucontext) +{ + return NULL; +} + +// Ignore the signal flew to the thread +void UnixIgnoreSignalForThread(int sig) +{ + struct sigaction sa; + + Zero(&sa, sizeof(sa)); + sa.sa_handler = NULL; + sa.sa_sigaction = signal_received_for_ignore; + sa.sa_flags = SA_SIGINFO; + + sigemptyset(&sa.sa_mask); + + sigaction(SIGUSR1, &sa, NULL); +} + +// Disable the off-loading function of the specific Ethernet device +void UnixDisableInterfaceOffload(char *name) +{ +#ifdef UNIX_LINUX + char tmp[MAX_SIZE]; + TOKEN_LIST *t; + char *names = "rx tx sg tso ufo gso gro lro rxvlan txvlan ntuple rxhash"; + // Validate arguments + if (name == NULL) + { + return; + } + + t = ParseToken(names, " "); + + if (t != NULL) + { + UINT i; + for (i = 0;i < t->NumTokens;i++) + { + char *a = t->Token[i]; + + Format(tmp, sizeof(tmp), "ethtool -K %s %s off 2>/dev/null", name, a); + FreeToken(UnixExec(tmp)); + } + } + + FreeToken(t); +#endif // UNIX_LINUX +} + +// Validate whether the UNIX is running in a VM +bool UnixIsInVmMain() +{ + TOKEN_LIST *t = NULL; + bool ret = false; + char *vm_str_list = "Hypervisor detected,VMware Virtual Platform,VMware Virtual USB,qemu,xen,paravirtualized,virtual hd,virtualhd,virtual pc,virtualpc,kvm,oracle vm,oraclevm,parallels,xvm,bochs"; + +#ifdef UNIX_LINUX + t = UnixExec("/bin/dmesg"); + + if (t != NULL) + { + BUF *b = NewBuf(); + UINT i; + + for (i = 0;i < t->NumTokens;i++) + { + char *line = t->Token[i]; + + AddBufStr(b, line); + AddBufStr(b, " "); + } + + WriteBufInt(b, 0); + +// printf("%s\n", b->Buf); + + ret = InStrList(b->Buf, vm_str_list, ",", false); + + FreeBuf(b); + FreeToken(t); + } +#endif // UNIX_LINUX + + return ret; +} +bool UnixIsInVm() +{ + static bool is_in_vm_flag = false; + static bool is_in_vm_ret = false; + + if (is_in_vm_flag == false) + { + is_in_vm_ret = UnixIsInVmMain(); + is_in_vm_flag = true; + } + + return is_in_vm_ret; +} + +// Run quietly in the UNIX +void UnixExecSilent(char *cmd) +{ + char tmp[MAX_SIZE]; + // Validate arguments + if (cmd == NULL) + { + return; + } + + Format(tmp, sizeof(tmp), "%s 2>/dev/null", cmd); + + FreeToken(UnixExec(tmp)); +} + +// Enable / disable the ESP processing in the kernel +void UnixSetEnableKernelEspProcessing(bool b) +{ + if (GetOsInfo()->OsType == OSTYPE_MACOS_X) + { + // Mac OS X + if (b) + { + UnixExecSilent("/usr/sbin/sysctl -w net.inet.ipsec.esp_port=4500"); + } + else + { + UnixExecSilent("/usr/sbin/sysctl -w net.inet.ipsec.esp_port=4501"); + } + } +} + +// Run a command and return its result +TOKEN_LIST *UnixExec(char *cmd) +{ + FILE *fp; + char tmp[MAX_SIZE]; + char *ptr; + LIST *o; + UINT i; + TOKEN_LIST *ret; + // Validate arguments + if (cmd == NULL) + { + return NULL; + } + + fp = popen(cmd, "r"); + if (fp == NULL) + { + return NULL; + } + + o = NewList(NULL); + + while (true) + { + fgets(tmp, sizeof(tmp), fp); + if (feof(fp)) + { + break; + } + + ptr = strchr(tmp, '\n'); + if (ptr != NULL) + { + *ptr = 0; + } + + ptr = strchr(tmp, '\r'); + if (ptr != NULL) + { + *ptr = 0; + } + + Add(o, CopyStr(tmp)); + } + + pclose(fp); + + ret = ListToTokenList(o); + + FreeStrList(o); + + return ret; +} + +// Initialize the Sleep for Solaris +void UnixInitSolarisSleep() +{ + char tmp[MAX_SIZE]; + + UnixNewPipe(&solaris_sleep_p1, &solaris_sleep_p2); + (void)read(solaris_sleep_p1, tmp, sizeof(tmp)); +} + +// Release the Sleep for Solaris +void UnixFreeSolarisSleep() +{ + UnixDeletePipe(solaris_sleep_p1, solaris_sleep_p2); + solaris_sleep_p1 = -1; + solaris_sleep_p2 = -1; +} + +// Sleep for Solaris +void UnixSolarisSleep(UINT msec) +{ + struct pollfd p; + + memset(&p, 0, sizeof(p)); + p.fd = solaris_sleep_p1; + p.events = POLLIN; + + (void)poll(&p, 1, msec == INFINITE ? -1 : (int)msec); +} + +// Get the free space of the disk +bool UnixGetDiskFree(char *path, UINT64 *free_size, UINT64 *used_size, UINT64 *total_size) +{ + char tmp[MAX_PATH]; + bool ret = false; + // Validate arguments + if (path == NULL) + { + return false; + } + + NormalizePath(tmp, sizeof(tmp), path); + + while ((ret = UnixGetDiskFreeMain(tmp, free_size, used_size, total_size)) == false) + { + if (StrCmpi(tmp, "/") == 0) + { + break; + } + + GetDirNameFromFilePath(tmp, sizeof(tmp), tmp); + } + + return ret; +} +bool UnixGetDiskFreeMain(char *path, UINT64 *free_size, UINT64 *used_size, UINT64 *total_size) +{ +#ifndef USE_STATVFS + struct statfs st; + char tmp[MAX_PATH]; + UINT64 v1 = 0, v2 = 0; + bool ret = false; + // Validate arguments + if (path == NULL) + { + return false; + } + + NormalizePath(tmp, sizeof(tmp), path); + + Zero(&st, sizeof(st)); + if (statfs(tmp, &st) == 0) + { + v1 = (UINT64)st.f_bsize * (UINT64)st.f_bavail; + v2 = (UINT64)st.f_bsize * (UINT64)st.f_blocks; + ret = true; + } + + if (free_size != NULL) + { + *free_size = v1; + } + + if (total_size != NULL) + { + *total_size = v2; + } + + if (used_size != NULL) + { + *used_size = v2 - v1; + } + + return ret; +#else // USE_STATVFS + struct statvfs st; + char tmp[MAX_PATH]; + UINT64 v1 = 0, v2 = 0; + bool ret = false; + // Validate arguments + if (path == NULL) + { + return false; + } + + NormalizePath(tmp, sizeof(tmp), path); + + Zero(&st, sizeof(st)); + + if (statvfs(tmp, &st) == 0) + { + v1 = (UINT64)st.f_bsize * (UINT64)st.f_bavail; + v2 = (UINT64)st.f_bsize * (UINT64)st.f_blocks; + ret = true; + } + + if (free_size != NULL) + { + *free_size = v1; + } + + if (total_size != NULL) + { + *total_size = v2; + } + + if (used_size != NULL) + { + *used_size = v2 - v1; + } + + return ret; +#endif // USE_STATVFS +} + +// Directory enumeration +DIRLIST *UnixEnumDirEx(char *dirname, COMPARE *compare) +{ + char tmp[MAX_PATH]; + DIRLIST *d; + int n; + struct dirent **e; + LIST *o; + // Validate arguments + if (dirname == NULL) + { + return NULL; + } + + o = NewListFast(compare); + + NormalizePath(tmp, sizeof(tmp), dirname); + + if (StrLen(tmp) >= 1 && tmp[StrLen(tmp) - 1] != '/') + { + StrCat(tmp, sizeof(tmp), "/"); + } + + e = NULL; + n = scandir(tmp, &e, 0, alphasort); + + if (StrLen(tmp) >= 1 && tmp[StrLen(tmp) - 1] == '/') + { + tmp[StrLen(tmp) - 1] = 0; + } + + if (n >= 0 && e != NULL) + { + UINT i; + + for (i = 0;i < (UINT)n;i++) + { + char *filename = e[i]->d_name; + + if (filename != NULL) + { + if (StrCmpi(filename, "..") != 0 && StrCmpi(filename, ".") != 0) + { + char fullpath[MAX_PATH]; + struct stat st; + Format(fullpath, sizeof(fullpath), "%s/%s", tmp, filename); + + Zero(&st, sizeof(st)); + + if (stat(fullpath, &st) == 0) + { + DIRENT *f = ZeroMalloc(sizeof(DIRENT)); + SYSTEMTIME t; + + f->Folder = S_ISDIR(st.st_mode) ? true : false; + f->FileName = CopyStr(filename); + f->FileNameW = CopyUtfToUni(f->FileName); + + Zero(&t, sizeof(t)); + TimeToSystem(&t, st.st_ctime); + f->CreateDate = SystemToUINT64(&t); + + Zero(&t, sizeof(t)); + TimeToSystem(&t, st.st_mtime); + f->UpdateDate = SystemToUINT64(&t); + + if (f->Folder == false) + { + f->FileSize = st.st_size; + } + + Add(o, f); + } + } + } + + free(e[i]); + } + + free(e); + } + + Sort(o); + + d = ZeroMalloc(sizeof(DIRLIST)); + d->NumFiles = LIST_NUM(o); + d->File = ToArray(o); + + ReleaseList(o); + + return d; +} +DIRLIST *UnixEnumDirExW(wchar_t *dirname, COMPARE *compare) +{ + char *dirname_a = CopyUniToUtf(dirname); + DIRLIST *ret; + + ret = UnixEnumDirEx(dirname_a, compare); + + Free(dirname_a); + + return ret; +} + +// Check the execute permissions of the specified file +bool UnixCheckExecAccess(char *name) +{ + // Validate arguments + if (name == NULL) + { + return false; + } + + if (access(name, X_OK) == 0) + { + return true; + } + + return false; +} +bool UnixCheckExecAccessW(wchar_t *name) +{ + char *name_a; + bool ret; + // Validate arguments + if (name == NULL) + { + return false; + } + + name_a = CopyUniToUtf(name); + + ret = UnixCheckExecAccess(name_a); + + Free(name_a); + + return ret; +} + +// Raise the priority of the thread to highest +void UnixSetThreadPriorityRealtime() +{ + struct sched_param p; + Zero(&p, sizeof(p)); + p.sched_priority = 255; + pthread_setschedparam(pthread_self(), SCHED_RR, &p); +} + +// Get the current directory +void UnixGetCurrentDir(char *dir, UINT size) +{ + // Validate arguments + if (dir == NULL) + { + return; + } + + getcwd(dir, size); +} +void UnixGetCurrentDirW(wchar_t *dir, UINT size) +{ + char dir_a[MAX_PATH]; + + UnixGetCurrentDir(dir_a, sizeof(dir_a)); + + UtfToUni(dir, size, dir_a); +} + +// Yield +void UnixYield() +{ +#ifdef UNIX_SOLARIS + UnixSolarisSleep(1); +#else + usleep(1000); +#endif +} + +// Get the memory information +void UnixGetMemInfo(MEMINFO *info) +{ + // Validate arguments + if (info == NULL) + { + return; + } + + // I don't know!! + Zero(info, sizeof(MEMINFO)); +} + +// Release of the single instance +void UnixFreeSingleInstance(void *data) +{ + UNIXLOCKFILE *o; + struct flock lock; + // Validate arguments + if (data == NULL) + { + return; + } + + o = (UNIXLOCKFILE *)data; + + Zero(&lock, sizeof(lock)); + lock.l_type = F_UNLCK; + lock.l_whence = SEEK_SET; + + (void)fcntl(o->fd, F_SETLK, &lock); + close(o->fd); + + (void)remove(o->FileName); + + Free(data); +} + +// Creating a single instance +void *UnixNewSingleInstance(char *instance_name) +{ + UNIXLOCKFILE *ret; + char tmp[MAX_SIZE]; + char name[MAX_SIZE]; + char dir[MAX_PATH]; + int fd; + struct flock lock; + int mode = S_IRUSR | S_IWUSR; + // Validate arguments + if (instance_name == NULL) + { + GetExeName(tmp, sizeof(tmp)); + HashInstanceName(tmp, sizeof(tmp), tmp); + } + else + { + StrCpy(tmp, sizeof(tmp), instance_name); + } + + GetPidDir(dir, sizeof(dir)); + + // File name generation + Format(name, sizeof(name), "%s/.%s", dir, tmp); + + fd = open(name, O_WRONLY); + if (fd == -1) + { + fd = creat(name, mode); + } + if (fd == -1) + { + Format(tmp, sizeof(tmp), "Unable to create %s.", name); + Alert(tmp, NULL); + exit(0); + return NULL; + } + + fchmod(fd, mode); + (void)chmod(name, mode); + + Zero(&lock, sizeof(lock)); + lock.l_type = F_WRLCK; + lock.l_whence = SEEK_SET; + + if (fcntl(fd, F_SETLK, &lock) == -1) + { + close(fd); + return NULL; + } + else + { + ret = ZeroMalloc(sizeof(UNIXLOCKFILE)); + ret->fd = fd; + StrCpy(ret->FileName, sizeof(ret->FileName), name); + return (void *)ret; + } +} + +// Set the high oom score +void UnixSetHighOomScore() +{ + IO *o; + char tmp[256]; + + sprintf(tmp, "/proc/%u/oom_score_adj", getpid()); + + o = UnixFileCreate(tmp); + if (o != NULL) + { + char tmp[128]; + sprintf(tmp, "%u\n", 800); + UnixFileWrite(o, tmp, strlen(tmp)); + UnixFileClose(o, false); + } +} + +// Raise the priority of the process +void UnixSetHighPriority() +{ + if (high_process == false) + { + UINT pid = getpid(); + UINT pgid = getpgid(pid); + + high_process = true; + nice(-20); + + setpriority(PRIO_PROCESS, pid, -20); + setpriority(PRIO_PGRP, pgid, -20); + } +} + +// Restore the priority of the process +void UnixRestorePriority() +{ + if (high_process != false) + { + high_process = false; + nice(20); + } +} + +UINT UnixGetNumberOfCpuInner() +{ + BUF *b; + UINT ret = 0; + + b = ReadDump("/proc/cpuinfo"); + if (b != NULL) + { + while (true) + { + char *line = CfgReadNextLine(b); + + if (line == NULL) + { + break; + } + + if (IsEmptyStr(line) == false) + { + TOKEN_LIST *t = ParseToken(line, ":"); + if (t != NULL) + { + if (t->NumTokens >= 2) + { + char *key = t->Token[0]; + char *value = t->Token[1]; + + Trim(key); + Trim(value); + + if (StrCmpi(key, "processor") == 0) + { + if (IsNum(value)) + { + UINT i = ToInt(value) + 1; + + if (i >= 1 && i <= 128) + { + ret = MAX(ret, i); + } + } + } + } + + FreeToken(t); + } + } + + Free(line); + } + + FreeBuf(b); + } + + return ret; +} + +// Get the product ID +char *UnixGetProductId() +{ + return CopyStr("--"); +} + +// Display an alert +void UnixAlertW(wchar_t *msg, wchar_t *caption) +{ + char *msg8 = CopyUniToUtf(msg); + char *caption8 = CopyUniToUtf(caption); + + UnixAlert(msg8, caption8); + + Free(msg8); + Free(caption8); +} +void UnixAlert(char *msg, char *caption) +{ + char *tag = + "-- Alert: %s --\n%s\n"; + // Validate arguments + if (msg == NULL) + { + msg = "Alert"; + } + if (caption == NULL) + { + caption = CEDAR_PRODUCT_STR " VPN Kernel"; + } + + printf(tag, caption, msg); +} + +// Get the information of the current OS +void UnixGetOsInfo(OS_INFO *info) +{ + struct utsname unix_info; + + // Validate arguments + if (info == NULL) + { + return; + } + + Zero(info, sizeof(OS_INFO)); + +#ifdef UNIX_SOLARIS + info->OsType = OSTYPE_SOLARIS; +#elif UNIX_CYGWIN + info->OsType = OSTYPE_CYGWIN; +#elif UNIX_MACOS + info->OsType = OSTYPE_MACOS_X; +#elif UNIX_BSD + info->OsType = OSTYPE_BSD; +#elif UNIX_LINUX + info->OsType = OSTYPE_LINUX; +#else + info->OsType = OSTYPE_UNIX_UNKNOWN; +#endif + + info->OsSystemName = CopyStr(OsTypeToStr(info->OsType)); + info->KernelName = CopyStr("UNIX"); + + if (uname(&unix_info) > -1) + { + info->OsProductName = CopyStr(unix_info.sysname); + info->OsVersion = CopyStr(unix_info.release); + info->KernelVersion = CopyStr(unix_info.version); + } + else + { + Debug("UnixGetOsInfo(): uname() failed with error: %s\n", strerror(errno)); + + info->OsProductName = CopyStr(OsTypeToStr(info->OsType)); + info->OsVersion = CopyStr("Unknown"); + info->KernelVersion = CopyStr("Unknown"); + } +#ifdef UNIX_LINUX + { + BUF *buffer = ReadDump("/etc/os-release"); + if (buffer == NULL) + { + buffer = ReadDump("/usr/lib/os-release"); + } + + if (buffer != NULL) + { + LIST *values = NewEntryList(buffer->Buf, "\n", "="); + + FreeBuf(buffer); + + if (EntryListHasKey(values, "NAME")) + { + char *str = EntryListStrValue(values, "NAME"); + TrimQuotes(str); + Free(info->OsProductName); + info->OsProductName = CopyStr(str); + } + + if (EntryListHasKey(values, "HOME_URL")) + { + char *str = EntryListStrValue(values, "HOME_URL"); + TrimQuotes(str); + info->OsVendorName = CopyStr(str); + } + + if (EntryListHasKey(values, "VERSION")) + { + char *str = EntryListStrValue(values, "VERSION"); + TrimQuotes(str); + Free(info->OsVersion); + info->OsVersion = CopyStr(str); + } + else + { + // Debian testing/sid doesn't provide the version in /etc/os-release + buffer = ReadDump("/etc/debian_version"); + if (buffer != NULL) + { + Free(info->OsVersion); + info->OsVersion = CfgReadNextLine(buffer); + FreeBuf(buffer); + } + } + + FreeEntryList(values); + } + } +#endif +} + +// Examine whether the current OS is supported by the PacketiX VPN Kernel +bool UnixIsSupportedOs() +{ + // Support all UNIX OS which can run PacketiX VPN + return true; +} + +// Run a specified command +bool UnixRunW(wchar_t *filename, wchar_t *arg, bool hide, bool wait) +{ + char *filename8 = CopyUniToUtf(filename); + char *arg8 = CopyUniToUtf(arg); + bool ret = UnixRun(filename8, arg8, hide, wait); + + Free(filename8); + Free(arg8); + + return ret; +} +bool UnixRun(char *filename, char *arg, bool hide, bool wait) +{ + TOKEN_LIST *t; + char **args; + UINT ret; + + // Validate arguments + if (filename == NULL) + { + return false; + } + if (arg == NULL) + { + arg = ""; + } + + Print("", filename, arg); + t = ParseToken(arg, " "); + if (t == NULL) + { + return false; + } + else + { + UINT num_args; + UINT i; + num_args = t->NumTokens + 2; + args = ZeroMalloc(sizeof(char *) * num_args); + args[0] = filename; + for (i = 1;i < num_args - 1;i++) + { + args[i] = t->Token[i - 1]; + } + } + + // Create a child process + ret = fork(); + if (ret == -1) + { + // Child process creation failure + return false; + } + + if (ret == 0) + { + // Child process + if (hide) + { + // Close the standard I/O + UnixCloseIO(); + } + execvp(filename, args); + AbortExit(); + } + else + { + // Parent process + pid_t pid = (pid_t)ret; + Free(args); + FreeToken(t); + + if (wait) + { + int status = 0; + // Wait for the termination of the child process + if (waitpid(pid, &status, 0) == -1) + { + return false; + } + + if (WEXITSTATUS(status) == 0) + { + return true; + } + else + { + return false; + } + } + + return true; + } +} + +// Close the standard I/O +void UnixCloseIO() +{ + static bool close_io_first = false; + + // Execute only once + if (close_io_first) + { + return; + } + else + { + close(0); + close(1); + close(2); + (void)open("/dev/null", O_RDWR); + dup2(0, 1); + dup2(0, 2); + close_io_first = false; + } +} + +// Change the file name +bool UnixFileRenameW(wchar_t *old_name, wchar_t *new_name) +{ + char *old_name8 = CopyUniToUtf(old_name); + char *new_name8 = CopyUniToUtf(new_name); + bool ret = UnixFileRename(old_name8, new_name8); + + Free(old_name8); + Free(new_name8); + + return ret; +} +bool UnixFileRename(char *old_name, char *new_name) +{ + // Validate arguments + if (old_name == NULL || new_name == NULL) + { + return false; + } + + if (rename(old_name, new_name) != 0) + { + return false; + } + + return true; +} + +// Get the call stack +CALLSTACK_DATA *UnixGetCallStack() +{ + // This is not supported on non-Win32 + return NULL; +} + +// Get the symbol information from the call stack +bool UnixGetCallStackSymbolInfo(CALLSTACK_DATA *s) +{ + // This is not supported on non-Win32 + return false; +} + +// Delete the directory +bool UnixDeleteDirW(wchar_t *name) +{ + char *name8 = CopyUniToUtf(name); + bool ret = UnixDeleteDir(name8); + + Free(name8); + + return ret; +} +bool UnixDeleteDir(char *name) +{ + // Validate arguments + if (name == NULL) + { + return false; + } + + if (rmdir(name) != 0) + { + return false; + } + + return true; +} + +// Create a directory +bool UnixMakeDirW(wchar_t *name) +{ + char *name8 = CopyUniToUtf(name); + bool ret = UnixMakeDir(name8); + + Free(name8); + + return ret; +} +bool UnixMakeDir(char *name) +{ + // Validate arguments + if (name == NULL) + { + return false; + } + + if (mkdir(name, 0700) != 0) + { + return false; + } + + return true; +} + +// Delete the file +bool UnixFileDeleteW(wchar_t *name) +{ + bool ret; + char *name8 = CopyUniToUtf(name); + + ret = UnixFileDelete(name8); + + Free(name8); + + return ret; +} +bool UnixFileDelete(char *name) +{ + // Validate arguments + if (name == NULL) + { + return false; + } + + if (remove(name) != 0) + { + return false; + } + + return true; +} + +// Seek the file +bool UnixFileSeek(void *pData, UINT mode, int offset) +{ + UNIXIO *p; + UINT ret; + // Validate arguments + if (pData == NULL) + { + return 0; + } + if (mode != FILE_BEGIN && mode != FILE_END && mode != FILE_CURRENT) + { + return false; + } + + p = (UNIXIO *)pData; + + ret = lseek(p->fd, offset, mode); + + if (ret == -1) + { + return false; + } + + return true; +} + +// Get the file size +UINT64 UnixFileSize(void *pData) +{ + struct stat st; + UNIXIO *p; + int r; + // Validate arguments + if (pData == NULL) + { + return 0; + } + + p = (UNIXIO *)pData; + + Zero(&st, sizeof(st)); + r = fstat(p->fd, &st); + if (r != 0) + { + return 0; + } + + return (UINT64)st.st_size; +} + +// Write to the file +bool UnixFileWrite(void *pData, void *buf, UINT size) +{ + UNIXIO *p; + UINT ret; + // Validate arguments + if (pData == NULL || buf == NULL || size == 0) + { + return false; + } + + p = (UNIXIO *)pData; + + ret = write(p->fd, buf, size); + if (ret != size) + { + return false; + } + + return true; +} + +// Read from the file +bool UnixFileRead(void *pData, void *buf, UINT size) +{ + UNIXIO *p; + UINT ret; + // Validate arguments + if (pData == NULL || buf == NULL || size == 0) + { + return false; + } + + p = (UNIXIO *)pData; + + ret = read(p->fd, buf, size); + if (ret != size) + { + return false; + } + + return true; +} + +// Flush to the file +void UnixFileFlush(void *pData) +{ + UNIXIO *p; + bool write_mode; + // Validate arguments + if (pData == NULL) + { + return; + } + + p = (UNIXIO *)pData; + + write_mode = p->write_mode; + + if (write_mode) + { + fsync(p->fd); + } +} + +// Close the file +void UnixFileClose(void *pData, bool no_flush) +{ + UNIXIO *p; + bool write_mode; + // Validate arguments + if (pData == NULL) + { + return; + } + + p = (UNIXIO *)pData; + + write_mode = p->write_mode; + + if (write_mode && no_flush == false) + { + fsync(p->fd); + } + + close(p->fd); + + UnixMemoryFree(p); + + if (write_mode) + { + //sync(); + } +} + +// Create a file +void *UnixFileCreateW(wchar_t *name) +{ + void *ret; + char *name8 = CopyUniToUtf(name); + + ret = UnixFileCreate(name8); + + Free(name8); + + return ret; +} +void *UnixFileCreate(char *name) +{ + UNIXIO *p; + int fd; + // Validate arguments + if (name == NULL) + { + return NULL; + } + + fd = creat(name, 0600); + if (fd == -1) + { + return NULL; + } + + // Memory allocation + p = UnixMemoryAlloc(sizeof(UNIXIO)); + p->fd = fd; + p->write_mode = true; + + return (void *)p; +} + +// Open the file +void *UnixFileOpenW(wchar_t *name, bool write_mode, bool read_lock) +{ + char *name8 = CopyUniToUtf(name); + void *ret; + + ret = UnixFileOpen(name8, write_mode, read_lock); + + Free(name8); + + return ret; +} +void *UnixFileOpen(char *name, bool write_mode, bool read_lock) +{ + UNIXIO *p; + int fd; + int mode; + // Validate arguments + if (name == NULL) + { + return NULL; + } + + if (write_mode == false) + { + mode = O_RDONLY; + } + else + { + mode = O_RDWR; + } + + // Open the file + fd = open(name, mode); + if (fd == -1) + { + return NULL; + } + + // Memory allocation + p = UnixMemoryAlloc(sizeof(UNIXIO)); + p->fd = fd; + p->write_mode = write_mode; + + return (void *)p; +} + +// Get UNIXIO object for stdout +void* GetUnixio4Stdout() +{ + static UNIXIO unixio = + { + .fd = -1, + .write_mode = true + }; + + if (g_foreground) + { + unixio.fd = STDOUT_FILENO; + return &unixio; + } + return NULL; +} + +// Return the current thread ID +UINT UnixThreadId() +{ + UINT ret; + + ret = (UINT)pthread_self(); + + return ret; +} + +// Thread function +void *UnixDefaultThreadProc(void *param) +{ + UNIXTHREAD *ut; + UNIXTHREADSTARTUPINFO *info = (UNIXTHREADSTARTUPINFO *)param; + if (info == NULL) + { + return 0; + } + + ut = (UNIXTHREAD *)info->thread->pData; + + // Call the thread function + info->thread_proc(info->thread, info->param); + + // Set a termination flag + ut->finished = true; + + // Release of reference + ReleaseThread(info->thread); + + UnixMemoryFree(info); + + FreeOpenSSLThreadState(); + + return 0; +} + +// Release of thread +void UnixFreeThread(THREAD *t) +{ + // Validate arguments + if (t == NULL) + { + return; + } + + // Free memory + UnixMemoryFree(t->pData); +} + +// Wait for the termination of the thread +bool UnixWaitThread(THREAD *t) +{ + UNIXTHREAD *ut; + void *retcode = NULL; + // Validate arguments + if (t == NULL) + { + return false; + } + ut = (UNIXTHREAD *)t->pData; + if (ut == NULL) + { + return false; + } + + pthread_join(ut->thread, &retcode); + + return true; +} + +// Thread initialization +bool UnixInitThread(THREAD *t) +{ + UNIXTHREAD *ut; + UNIXTHREADSTARTUPINFO *info; + pthread_attr_t attr; + // Validate arguments + if (t == NULL || t->thread_proc == NULL) + { + return false; + } + + // Thread data creation + ut = UnixMemoryAlloc(sizeof(UNIXTHREAD)); + Zero(ut, sizeof(UNIXTHREAD)); + + // Creating the startup information + info = UnixMemoryAlloc(sizeof(UNIXTHREADSTARTUPINFO)); + Zero(info, sizeof(UNIXTHREADSTARTUPINFO)); + info->param = t->param; + info->thread_proc = t->thread_proc; + info->thread = t; + AddRef(t->ref); + + // Thread creation + pthread_attr_init(&attr); + pthread_attr_setstacksize(&attr, UNIX_THREAD_STACK_SIZE); + + t->pData = (void *)ut; + + if (pthread_create(&ut->thread, &attr, UnixDefaultThreadProc, info) != 0) + { + // An error has occured + t->pData = NULL; + (void)Release(t->ref); + UnixMemoryFree(ut); + UnixMemoryFree(info); + pthread_attr_destroy(&attr); + return false; + } + + pthread_attr_destroy(&attr); + + return true; +} + +// Release the event +void UnixFreeEvent(EVENT *event) +{ + UNIXEVENT *ue = (UNIXEVENT *)event->pData; + if (ue == NULL) + { + return; + } + + pthread_cond_destroy(&ue->cond); + pthread_mutex_destroy(&ue->mutex); + + UnixMemoryFree(ue); +} + +// Wait for a event +bool UnixWaitEvent(EVENT *event, UINT timeout) +{ + UNIXEVENT *ue = (UNIXEVENT *)event->pData; + struct timeval now; + struct timespec to; + bool ret; + if (ue == NULL) + { + return false; + } + + pthread_mutex_lock(&ue->mutex); + gettimeofday(&now, NULL); + to.tv_sec = now.tv_sec + timeout / 1000; + to.tv_nsec = now.tv_usec * 1000 + (timeout % 1000) * 1000 * 1000; + if ((to.tv_nsec / 1000000000) >= 1) + { + to.tv_sec += to.tv_nsec / 1000000000; + to.tv_nsec = to.tv_nsec % 1000000000; + } + + ret = true; + + while (ue->signal == false) + { + if (timeout != INFINITE) + { + if (pthread_cond_timedwait(&ue->cond, &ue->mutex, &to)) + { + ret = false; + break; + } + } + else + { + pthread_cond_wait(&ue->cond, &ue->mutex); + } + } + ue->signal = false; + + pthread_mutex_unlock(&ue->mutex); + + return ret; +} + +// Reset the event +void UnixResetEvent(EVENT *event) +{ + UNIXEVENT *ue = (UNIXEVENT *)event->pData; + if (ue == NULL) + { + return; + } + + pthread_mutex_lock(&ue->mutex); + ue->signal = false; + pthread_cond_signal(&ue->cond); + pthread_mutex_unlock(&ue->mutex); +} + +// Set the event +void UnixSetEvent(EVENT *event) +{ + UNIXEVENT *ue = (UNIXEVENT *)event->pData; + if (ue == NULL) + { + return; + } + + pthread_mutex_lock(&ue->mutex); + ue->signal = true; + pthread_cond_signal(&ue->cond); + pthread_mutex_unlock(&ue->mutex); +} + +// Initialize the event +void UnixInitEvent(EVENT *event) +{ + UNIXEVENT *ue = UnixMemoryAlloc(sizeof(UNIXEVENT)); + + Zero(ue, sizeof(UNIXEVENT)); + + pthread_cond_init(&ue->cond, NULL); + pthread_mutex_init(&ue->mutex, NULL); + ue->signal = false; + + event->pData = (void *)ue; +} + +// Delete the lock +void UnixDeleteLock(LOCK *lock) +{ + pthread_mutex_t *mutex; + // Reset Ready flag safely + UnixLock(lock); + lock->Ready = false; + UnixUnlockEx(lock, true); + + // Delete the mutex + mutex = (pthread_mutex_t *)lock->pData; + pthread_mutex_destroy(mutex); + + // Memory release + UnixMemoryFree(mutex); + UnixMemoryFree(lock); +} + +// Unlock +void UnixUnlock(LOCK *lock) +{ + UnixUnlockEx(lock, false); +} +void UnixUnlockEx(LOCK *lock, bool inner) +{ + pthread_mutex_t *mutex; + if (lock->Ready == false && inner == false) + { + // State is invalid + return; + } + mutex = (pthread_mutex_t *)lock->pData; + + if ((--lock->locked_count) > 0) + { + return; + } + + lock->thread_id = INFINITE; + + pthread_mutex_unlock(mutex); + + return; +} + +// Lock +bool UnixLock(LOCK *lock) +{ + pthread_mutex_t *mutex; + UINT thread_id = UnixThreadId(); + if (lock->Ready == false) + { + // State is invalid + return false; + } + + if (lock->thread_id == thread_id) + { + lock->locked_count++; + return true; + } + + mutex = (pthread_mutex_t *)lock->pData; + + pthread_mutex_lock(mutex); + + lock->thread_id = thread_id; + lock->locked_count++; + + return true; +} + +// Creating a new lock +LOCK *UnixNewLock() +{ + pthread_mutex_t *mutex; + // Memory allocation + LOCK *lock = UnixMemoryAlloc(sizeof(LOCK)); + + // Create a mutex + mutex = UnixMemoryAlloc(sizeof(pthread_mutex_t)); + if (mutex == NULL) + { + return NULL; + } + + // Initialization of the mutex + pthread_mutex_init(mutex, NULL); + + lock->pData = (void *)mutex; + lock->Ready = true; + + lock->thread_id = INFINITE; + lock->locked_count = 0; + + return lock; +} + +// Sleep +void UnixSleep(UINT time) +{ + UINT sec = 0, millisec = 0; + // Validate arguments + if (time == 0) + { + return; + } + + if (time == INFINITE) + { + // Wait forever + while (true) + { +#ifdef UNIX_SOLARIS + UnixSolarisSleep(time); +#else + sleep(1000000); +#endif + } + } + +#ifdef UNIX_SOLARIS + UnixSolarisSleep(time); +#else + + // Prevent overflow + sec = time / 1000; + millisec = time % 1000; + + if (sec != 0) + { + sleep(sec); + } + if (millisec != 0) + { + usleep(millisec * 1000); + } +#endif +} + +// Decrement +void UnixDec32(UINT *value) +{ + if (value != NULL) + { + (*value)--; + } +} + +// Increment +void UnixInc32(UINT *value) +{ + if (value != NULL) + { + (*value)++; + } +} + +// Get the System Time +void UnixGetSystemTime(SYSTEMTIME *system_time) +{ + time_t now = 0; + time_64t now2 = 0; + struct tm tm; + struct timeval tv; + struct timezone tz; + // Validate arguments + if (system_time == NULL) + { + return; + } + + pthread_mutex_lock(&get_time_lock); + + Zero(system_time, sizeof(SYSTEMTIME)); + Zero(&tv, sizeof(tv)); + Zero(&tz, sizeof(tz)); + + time(&now); + + if (sizeof(time_t) == 4) + { + now2 = (time_64t)((UINT64)((UINT)now)); + } + else + { + now2 = now; + } + + c_gmtime_r(&now2, &tm); + + TmToSystem(system_time, &tm); + + gettimeofday(&tv, &tz); + + system_time->wMilliseconds = tv.tv_usec / 1000; + + pthread_mutex_unlock(&get_time_lock); +} + +// Get the system timer (64bit) +UINT64 UnixGetTick64() +{ +#if defined(OS_WIN32) || defined(CLOCK_REALTIME) || defined(CLOCK_MONOTONIC) || defined(CLOCK_HIGHRES) + + struct timespec t; + UINT64 ret; + + Zero(&t, sizeof(t)); + + // Function to get the boot time of the system + // Be careful. The Implementation is depend on the system. +#ifdef CLOCK_HIGHRES + clock_gettime(CLOCK_HIGHRES, &t); +#elif CLOCK_MONOTONIC + clock_gettime(CLOCK_MONOTONIC, &t); +#else + clock_gettime(CLOCK_REALTIME, &t); +#endif + + ret = ((UINT64)((UINT)t.tv_sec)) * 1000LL + (UINT64)t.tv_nsec / 1000000LL; + + if (ret == 0) + { + ret = TickRealtimeManual(); + } + + return ret; +#else + return TickRealtimeManual(); +#endif +} + +// Get the system timer +UINT UnixGetTick() +{ + return (UINT)UnixGetTick64(); +} + +// Memory allocation +void *UnixMemoryAlloc(UINT size) +{ + void *r; + pthread_mutex_lock(&malloc_lock); + r = malloc(size); + pthread_mutex_unlock(&malloc_lock); + return r; +} + +// Reallocation of the memory +void *UnixMemoryReAlloc(void *addr, UINT size) +{ + void *r; + pthread_mutex_lock(&malloc_lock); + r = realloc(addr, size); + pthread_mutex_unlock(&malloc_lock); + return r; +} + +// Free the memory +void UnixMemoryFree(void *addr) +{ + pthread_mutex_lock(&malloc_lock); + free(addr); + pthread_mutex_unlock(&malloc_lock); +} + +// SIGCHLD handler +void UnixSigChldHandler(int sig) +{ + // Recall the zombie processes + while (waitpid(-1, NULL, WNOHANG) > 0); + signal(SIGCHLD, UnixSigChldHandler); +} + +// Disable core dump +void UnixDisableCoreDump() +{ +#ifdef RLIMIT_CORE + UnixSetResourceLimit(RLIMIT_CORE, 0); +#endif // RLIMIT_CORE +} + +// Initialize the library for UNIX +void UnixInit() +{ + UNIXIO *o; + UINT64 max_memory = UNIX_MAX_MEMORY; + + if (UnixIs64BitRlimSupported()) + { + max_memory = UNIX_MAX_MEMORY_64; + } + + UnixInitSolarisSleep(); + + // Global lock + pthread_mutex_init(&get_time_lock, NULL); + pthread_mutex_init(&malloc_lock, NULL); + + // Get the Process ID + current_process_id = getpid(); + +#ifdef RLIMIT_CORE + UnixSetResourceLimit(RLIMIT_CORE, max_memory); +#endif // RLIMIT_CORE + +#ifdef RLIMIT_DATA + UnixSetResourceLimit(RLIMIT_DATA, max_memory); +#endif // RLIMIT_DATA + +#ifdef RLIMIT_NOFILE +#ifndef UNIX_MACOS + UnixSetResourceLimit(RLIMIT_NOFILE, UNIX_MAX_FD); +#else // UNIX_MACOS + UnixSetResourceLimit(RLIMIT_NOFILE, UNIX_MAX_FD_MACOS); +#endif // UNIX_MACOS +#endif // RLIMIT_NOFILE + +#ifdef RLIMIT_STACK +// UnixSetResourceLimit(RLIMIT_STACK, max_memory); +#endif // RLIMIT_STACK + +#ifdef RLIMIT_RSS + UnixSetResourceLimit(RLIMIT_RSS, max_memory); +#endif // RLIMIT_RSS + +#ifdef RLIMIT_LOCKS + UnixSetResourceLimit(RLIMIT_LOCKS, UNIX_MAX_LOCKS); +#endif // RLIMIT_LOCKS + +#ifdef RLIMIT_MEMLOCK + UnixSetResourceLimit(RLIMIT_MEMLOCK, max_memory); +#endif // RLIMIT_MEMLOCK + +#ifdef RLIMIT_NPROC + UnixSetResourceLimit(RLIMIT_NPROC, UNIX_MAX_CHILD_PROCESSES); +#endif // RLIMIT_NPROC + + // Write a value to the threads-max of the proc file system + o = UnixFileCreate("/proc/sys/kernel/threads-max"); + if (o != NULL) + { + char tmp[128]; + sprintf(tmp, "%u\n", UNIX_LINUX_MAX_THREADS); + UnixFileWrite(o, tmp, strlen(tmp)); + UnixFileClose(o, false); + } + + // Set the signals that is to be ignored + signal(SIGPIPE, SIG_IGN); + signal(SIGALRM, SIG_IGN); + +#ifdef UNIX_BSD + signal(64, SIG_IGN); +#endif // UNIX_BSD + +#ifdef SIGXFSZ + signal(SIGXFSZ, SIG_IGN); +#endif // SIGXFSZ + + // Set a signal handler to salvage the child processes + signal(SIGCHLD, UnixSigChldHandler); +} + +// Release the library for UNIX +void UnixFree() +{ + UnixFreeSolarisSleep(); + + current_process_id = 0; + + pthread_mutex_destroy(&get_time_lock); +} + +// Adjust the upper limit of resources that may be occupied +void UnixSetResourceLimit(UINT id, UINT64 value) +{ + struct rlimit t; + UINT64 hard_limit; + + if (UnixIs64BitRlimSupported() == false) + { + if (value > (UINT64)4294967295ULL) + { + value = (UINT64)4294967295ULL; + } + } + + Zero(&t, sizeof(t)); + getrlimit(id, &t); + + hard_limit = (UINT64)t.rlim_max; + + Zero(&t, sizeof(t)); + t.rlim_cur = (rlim_t)MIN(value, hard_limit); + t.rlim_max = (rlim_t)hard_limit; + setrlimit(id, &t); + + Zero(&t, sizeof(t)); + t.rlim_cur = (rlim_t)value; + t.rlim_max = (rlim_t)value; + setrlimit(id, &t); +} + +// Is the rlim_t type 64-bit? +bool UnixIs64BitRlimSupported() +{ + if (sizeof(rlim_t) >= 8) + { + return true; + } + + return false; +} + +// Generate the PID file name +void UnixGenPidFileName(char *name, UINT size) +{ + char exe_name[MAX_PATH]; + UCHAR hash[MD5_SIZE]; + char tmp1[64]; + char dir[MAX_PATH]; + // Validate arguments + if (name == NULL) + { + return; + } + + GetPidDir(dir, sizeof(dir)); + + GetExeName(exe_name, sizeof(exe_name)); + StrCat(exe_name, sizeof(exe_name), ":pid_hash"); + StrUpper(exe_name); + + Md5(hash, exe_name, StrLen(exe_name)); + BinToStr(tmp1, sizeof(tmp1), hash, sizeof(hash)); + + Format(name, size, "%s/.pid_%s", dir, tmp1); +} + +// Delete the PID file +void UnixDeletePidFile() +{ + char tmp[MAX_PATH]; + + UnixGenPidFileName(tmp, sizeof(tmp)); + + UnixFileDelete(tmp); +} + +// Delete the CTL file +void UnixDeleteCtlFile() +{ + char tmp[MAX_PATH]; + + UnixGenCtlFileName(tmp, sizeof(tmp)); + + UnixFileDelete(tmp); +} + +// Generate the CTL file name +void UnixGenCtlFileName(char *name, UINT size) +{ + char exe_name[MAX_PATH]; + UCHAR hash[MD5_SIZE]; + char tmp1[64]; + char dir[MAX_PATH]; + // Validate arguments + if (name == NULL) + { + return; + } + + GetPidDir(dir, sizeof(dir)); + + GetExeName(exe_name, sizeof(exe_name)); + StrCat(exe_name, sizeof(exe_name), ":pid_hash"); + StrUpper(exe_name); + + Md5(hash, exe_name, StrLen(exe_name)); + BinToStr(tmp1, sizeof(tmp1), hash, sizeof(hash)); + + Format(name, size, "%s/.ctl_%s", dir, tmp1); +} + +// Write the CTL file +void UnixWriteCtlFile(UINT i) +{ + char tmp[MAX_PATH]; + char tmp2[64]; + IO *o; + + UnixGenCtlFileName(tmp, sizeof(tmp)); + Format(tmp2, sizeof(tmp2), "%u\n", i); + + o = FileCreate(tmp); + if (o != NULL) + { + FileWrite(o, tmp2, StrLen(tmp2)); + FileClose(o); + } +} + +// Write to the PID file +void UnixWritePidFile(UINT pid) +{ + char tmp[MAX_PATH]; + char tmp2[64]; + IO *o; + + UnixGenPidFileName(tmp, sizeof(tmp)); + Format(tmp2, sizeof(tmp2), "%u\n", pid); + + o = FileCreate(tmp); + if (o != NULL) + { + FileWrite(o, tmp2, StrLen(tmp2)); + FileClose(o); + } +} + +// Read the PID file +UINT UnixReadPidFile() +{ + char tmp[MAX_PATH]; + BUF *buf; + + UnixGenPidFileName(tmp, sizeof(tmp)); + + buf = ReadDump(tmp); + if (buf == NULL) + { + return 0; + } + + Zero(tmp, sizeof(tmp)); + Copy(tmp, buf->Buf, MIN(buf->Size, sizeof(tmp))); + FreeBuf(buf); + + return ToInt(tmp); +} + +// Read the CTL file +UINT UnixReadCtlFile() +{ + char tmp[MAX_PATH]; + BUF *buf; + + UnixGenCtlFileName(tmp, sizeof(tmp)); + + buf = ReadDump(tmp); + if (buf == NULL) + { + return 0; + } + + Zero(tmp, sizeof(tmp)); + Copy(tmp, buf->Buf, MIN(buf->Size, sizeof(tmp))); + FreeBuf(buf); + + return ToInt(tmp); +} + +// Get the UID +UINT UnixGetUID() +{ + return (UINT)getuid(); +} + +// Start the service +void UnixStartService(char *name) +{ + char *svc_name, *svc_title; + char tmp[128]; + INSTANCE *inst; + char exe[MAX_PATH]; + // Validate arguments + if (name == NULL) + { + return; + } + + GetExeName(exe, sizeof(exe)); + + Format(tmp, sizeof(tmp), SVC_NAME, name); + svc_name = _SS(tmp); + Format(tmp, sizeof(tmp), SVC_TITLE, name); + svc_title = _SS(tmp); + + // Examine whether the service has not been started already + inst = NewSingleInstance(NULL); + if (inst == NULL) + { + // Service is already running + UniPrint(_UU("UNIX_SVC_ALREADY_START"), svc_title, svc_name); + } + else + { + int pid; + // Begin to start the service + UniPrint(_UU("UNIX_SVC_STARTED"), svc_title); + + if (UnixGetUID() != 0) + { + // Non-root warning + UniPrint(_UU("UNIX_SVC_NONROOT")); + } + + FreeSingleInstance(inst); + + // Create a child process + pid = fork(); + if (pid == -1) + { + UniPrint(_UU("UNIX_SVC_ERROR_FORK"), svc_title); + } + else + { + if (pid == 0) + { + // Child process + char *param = UNIX_SVC_ARG_EXEC_SVC; + char **args; + + // Daemonize + setsid(); + UnixCloseIO(); + signal(SIGHUP, SIG_IGN); + + // Prepare arguments + args = ZeroMalloc(sizeof(char *) * 3); + args[0] = exe; + args[1] = param; + args[2] = NULL; + + execvp(exe, args); + AbortExit(); + } + else + { + // Don't write the child process number to the file +// UnixWritePidFile(pid); + } + } + } +} + +// Stop the Service +void UnixStopService(char *name) +{ + char *svc_name, *svc_title; + char tmp[128]; + INSTANCE *inst; + char exe[MAX_PATH]; + UINT pid; + // Validate arguments + if (name == NULL) + { + return; + } + + GetExeName(exe, sizeof(exe)); + + Format(tmp, sizeof(tmp), SVC_NAME, name); + svc_name = _SS(tmp); + Format(tmp, sizeof(tmp), SVC_TITLE, name); + svc_title = _SS(tmp); + + inst = NewSingleInstance(NULL); + pid = UnixReadPidFile(); + if (inst != NULL || pid == 0) + { + // Service is not running yet + UniPrint(_UU("UNIX_SVC_NOT_STARTED"), svc_title, svc_name); + } + else + { + // Stop the service + UniPrint(_UU("UNIX_SVC_STOPPING"), svc_title); + + // Terminate the process + kill(pid, SIGTERM); +#ifdef UNIX_BSD + UnixWriteCtlFile(Rand32()); +#endif // UNIX_BSD + if (UnixWaitProcessEx(pid, UNIX_SERVICE_STOP_TIMEOUT_2)) + { + UniPrint(_UU("UNIX_SVC_STOPPED"), svc_title); + } + else + { + // SIGKILL + char tmp[256]; + + Format(tmp, sizeof(tmp), "killall -KILL %s", name); + + UniPrint(_UU("UNIX_SVC_STOP_FAILED"), svc_title); + system(tmp); + } + } + + FreeSingleInstance(inst); +} + +// Handler of the stop signal to the process +void UnixSigTermHandler(int signum) +{ + if (signum == SIGTERM) + { + unix_svc_terminate = true; + } +} + +// The thread for stop service +void UnixStopThread(THREAD *t, void *param) +{ + SERVICE_FUNCTION *stop = (SERVICE_FUNCTION *)param; + // Validate arguments + if (t == NULL || param == NULL) + { + return; + } + + stop(); +} + +// Execute the main body of the service +void UnixExecService(char *name, SERVICE_FUNCTION *start, SERVICE_FUNCTION *stop) +{ + char *svc_name, *svc_title; + char tmp[128]; + INSTANCE *inst; + UINT yobi_size = 1024 * 128; + void *yobi1, *yobi2; + UINT saved_ctl; + // Validate arguments + if (start == NULL || stop == NULL || name == NULL) + { + return; + } + + Format(tmp, sizeof(tmp), SVC_NAME, name); + svc_name = _SS(tmp); + Format(tmp, sizeof(tmp), SVC_TITLE, name); + svc_title = _SS(tmp); + + UnixWriteCtlFile(Rand32()); + saved_ctl = UnixReadCtlFile(); + + inst = NewSingleInstance(NULL); + if (inst != NULL) + { + THREAD *t; + + yobi1 = ZeroMalloc(yobi_size); + yobi2 = ZeroMalloc(yobi_size); + + // Start + UnixWritePidFile(getpid()); + + start(); + + // Starting complete. wait for arriving SIGTERM from another process + signal(SIGTERM, &UnixSigTermHandler); + while (unix_svc_terminate == false) + { +#if !(defined(UNIX_BSD) || defined(UNIX_MACOS)) + pause(); +#else // defined(UNIX_BSD) || defined(UNIX_MACOS) + if (UnixReadCtlFile() != saved_ctl) + { + break; + } + + SleepThread(1394); +#endif // defined(UNIX_BSD) || defined(UNIX_MACOS) + } + + // Stop + Free(yobi1); + t = NewThread(UnixStopThread, stop); + if (t == NULL || (WaitThread(t, UNIX_SERVICE_STOP_TIMEOUT_1) == false)) + { + // Terminate forcibly if creation of a halting thread have + // failed or timed out + Free(yobi2); + FreeSingleInstance(inst); + UnixDeletePidFile(); + _exit(0); + } + ReleaseThread(t); + + // Delete the PID file + UnixDeletePidFile(); + + // Delete the CTL file + UnixDeleteCtlFile(); + + FreeSingleInstance(inst); + + Free(yobi2); + } +} + +// Get whether the process with the specified pid exists +bool UnixIsProcess(UINT pid) +{ + if (getsid((pid_t)pid) == -1) + { + return false; + } + + return true; +} + +// Wait for the termination of the specified process +bool UnixWaitProcessEx(UINT pid, UINT timeout) +{ + UINT64 start_tick = Tick64(); + UINT64 end_tick = start_tick + (UINT64)timeout; + if (timeout == INFINITE) + { + end_tick = 0; + } + while (UnixIsProcess(pid)) + { + if (end_tick != 0) + { + if (end_tick < Tick64()) + { + return false; + } + } + SleepThread(100); + } + return true; +} + +// Description of how to start +void UnixUsage(char *name) +{ + char *svc_name, *svc_title; + char tmp[128]; + // Validate arguments + if (name == NULL) + { + return; + } + + Format(tmp, sizeof(tmp), SVC_NAME, name); + svc_name = _SS(tmp); + Format(tmp, sizeof(tmp), SVC_TITLE, name); + svc_title = _SS(tmp); + + UniPrint(_UU("UNIX_SVC_HELP"), svc_title, svc_name, svc_name, svc_title, svc_name, svc_title); +} + +// Main function of the UNIX service +UINT UnixService(int argc, char *argv[], char *name, SERVICE_FUNCTION *start, SERVICE_FUNCTION *stop) +{ + // Validate arguments + if (name == NULL || start == NULL || stop == NULL) + { + return 0; + } + + if (argc >= 2 && StrCmpi(argv[1], UNIX_SVC_ARG_EXEC_SVC) == 0) + { + UINT pid; + // Start a child process + // Restart if the child process didn't exit properly + +RESTART_PROCESS: + pid = fork(); + if ((int)pid != -1) + { + if (pid == 0) + { + // Run the main process + UnixServiceMain(argc, argv, name, start, stop); + } + else + { + int status = 0, ret; + + // Wait for the termination of the child process + ret = waitpid(pid, &status, 0); + + if (WIFEXITED(status) == 0) + { + // Aborted + UnixSleep(100); + goto RESTART_PROCESS; + } + } + } + } + else if (argc >= 3 && StrCmpi(argv[1], UNIX_SVC_ARG_START) == 0 && StrCmpi(argv[2], UNIX_SVC_ARG_FOREGROUND) == 0) + { +#ifdef DEBUG + // If set memcheck = true, the program will be vitally slow since it will log all malloc() / realloc() / free() calls to find the cause of memory leak. + // For normal debug we set memcheck = false. + // Please set memcheck = true if you want to test the cause of memory leaks. + InitMayaqua(false, true, argc, argv); +#else + InitMayaqua(false, false, argc, argv); +#endif + UnixExecService(name, start, stop); + FreeMayaqua(); + } + else + { + // Start normally + UnixServiceMain(argc, argv, name, start, stop); + } + + return 0; +} +void UnixServiceMain(int argc, char *argv[], char *name, SERVICE_FUNCTION *start, SERVICE_FUNCTION *stop) +{ + UINT mode = 0; + // Start of the Mayaqua +#ifdef DEBUG + // If set memcheck = true, the program will be vitally slow since it will log all malloc() / realloc() / free() calls to find the cause of memory leak. + // For normal debug we set memcheck = false. + // Please set memcheck = true if you want to test the cause of memory leaks. + InitMayaqua(false, true, argc, argv); +#else + InitMayaqua(false, false, argc, argv); +#endif + + if (argc >= 2) + { + if (StrCmpi(argv[1], UNIX_SVC_ARG_START) == 0) + { + mode = UNIX_SVC_MODE_START; + } + if (StrCmpi(argv[1], UNIX_SVC_ARG_STOP) == 0) + { + mode = UNIX_SVC_MODE_STOP; + } + if (StrCmpi(argv[1], UNIX_SVC_ARG_EXEC_SVC) == 0) + { + mode = UNIX_SVC_MODE_EXEC_SVC; + } + if (StrCmpi(argv[1], UNIX_ARG_EXIT) == 0) + { + mode = UNIX_SVC_MODE_EXIT; + } + } + + switch (mode) + { + case UNIX_SVC_MODE_EXIT: + break; + + case UNIX_SVC_MODE_START: + UnixStartService(name); + break; + + case UNIX_SVC_MODE_STOP: + UnixStopService(name); + break; + + case UNIX_SVC_MODE_EXEC_SVC: + UnixExecService(name, start, stop); + break; + + default: + UnixUsage(name); + break; + } + + // End of the Mayaqua + FreeMayaqua(); + + return; +} + +#endif // UNIX diff --git a/src/Mayaqua/Unix.h b/src/Mayaqua/Unix.h index 63d1d334..2243a659 100644 --- a/src/Mayaqua/Unix.h +++ b/src/Mayaqua/Unix.h @@ -1,159 +1,159 @@ -// SoftEther VPN Source Code - Developer Edition Master Branch -// Mayaqua Kernel - - -// Unix.h -// Header of Unix.c - -#ifdef OS_UNIX - -#ifndef UNIX_H -#define UNIX_H - -// Constants -#define UNIX_THREAD_STACK_SIZE (200 * 1000) // Stack size -#define UNIX_MAX_CHILD_PROCESSES 2000000 // Maximum number of child processes -#define UNIX_LINUX_MAX_THREADS 200000000 // Maximum number of threads -#define UNIX_MAX_LOCKS 65536 // Maximum number of locks -#define UNIX_MAX_MEMORY (2147483648UL) // Maximum memory capacity -#define UNIX_MAX_MEMORY_64 ((UINT64)((UINT64)65536ULL * (UINT64)2147483647ULL)) // Maximum memory capacity (64-bit) -#define UNIX_MAX_FD (655360) // Maximum number of FDs -#define UNIX_MAX_FD_MACOS (10000) // Maximum number of FDs (Mac OS X) -#define MAXIMUM_WAIT_OBJECTS 64 // Maximum number of select - -#define UNIX_SERVICE_STOP_TIMEOUT_1 (60 * 1000) // Timeout to stop the service -#define UNIX_SERVICE_STOP_TIMEOUT_2 (90 * 1000) // Timeout to stop the service (parent process) - - -// Service related -typedef void (SERVICE_FUNCTION)(); - -#define SVC_NAME "SVC_%s_NAME" -#define SVC_TITLE "SVC_%s_TITLE" - -#define UNIX_SVC_ARG_START "start" -#define UNIX_SVC_ARG_STOP "stop" -#define UNIX_SVC_ARG_EXEC_SVC "execsvc" -#define UNIX_ARG_EXIT "exit" -#define UNIX_SVC_ARG_FOREGROUND "--foreground" - -#define UNIX_SVC_MODE_START 1 -#define UNIX_SVC_MODE_STOP 2 -#define UNIX_SVC_MODE_EXEC_SVC 3 -#define UNIX_SVC_MODE_EXIT 4 - - -// Function prototype -OS_DISPATCH_TABLE *UnixGetDispatchTable(); -void UnixInit(); -void UnixFree(); -void *UnixMemoryAlloc(UINT size); -void *UnixMemoryReAlloc(void *addr, UINT size); -void UnixMemoryFree(void *addr); -UINT UnixGetTick(); -void UnixGetSystemTime(SYSTEMTIME *system_time); -void UnixInc32(UINT *value); -void UnixDec32(UINT *value); -void UnixSleep(UINT time); -LOCK *UnixNewLock(); -bool UnixLock(LOCK *lock); -void UnixUnlock(LOCK *lock); -void UnixUnlockEx(LOCK *lock, bool inner); -void UnixDeleteLock(LOCK *lock); -void UnixInitEvent(EVENT *event); -void UnixSetEvent(EVENT *event); -void UnixResetEvent(EVENT *event); -bool UnixWaitEvent(EVENT *event, UINT timeout); -void UnixFreeEvent(EVENT *event); -bool UnixWaitThread(THREAD *t); -void UnixFreeThread(THREAD *t); -bool UnixInitThread(THREAD *t); -UINT UnixThreadId(); -void *UnixFileOpen(char *name, bool write_mode, bool read_lock); -void *UnixFileOpenW(wchar_t *name, bool write_mode, bool read_lock); -void *UnixFileCreate(char *name); -void *UnixFileCreateW(wchar_t *name); -void *GetUnixio4Stdout(); -bool UnixFileWrite(void *pData, void *buf, UINT size); -bool UnixFileRead(void *pData, void *buf, UINT size); -void UnixFileClose(void *pData, bool no_flush); -void UnixFileFlush(void *pData); -UINT64 UnixFileSize(void *pData); -bool UnixFileSeek(void *pData, UINT mode, int offset); -bool UnixFileDelete(char *name); -bool UnixFileDeleteW(wchar_t *name); -bool UnixMakeDir(char *name); -bool UnixMakeDirW(wchar_t *name); -bool UnixDeleteDir(char *name); -bool UnixDeleteDirW(wchar_t *name); -CALLSTACK_DATA *UnixGetCallStack(); -bool UnixGetCallStackSymbolInfo(CALLSTACK_DATA *s); -bool UnixFileRename(char *old_name, char *new_name); -bool UnixFileRenameW(wchar_t *old_name, wchar_t *new_name); -bool UnixRun(char *filename, char *arg, bool hide, bool wait); -bool UnixRunW(wchar_t *filename, wchar_t *arg, bool hide, bool wait); -bool UnixIsSupportedOs(); -void UnixGetOsInfo(OS_INFO *info); -void UnixAlert(char *msg, char *caption); -void UnixAlertW(wchar_t *msg, wchar_t *caption); -char *UnixGetProductId(); -void UnixSetHighPriority(); -void UnixSetHighOomScore(); -void UnixRestorePriority(); -UINT UnixGetNumberOfCpuInner(); -void *UnixNewSingleInstance(char *instance_name); -void UnixFreeSingleInstance(void *data); -void UnixGetMemInfo(MEMINFO *info); -void UnixYield(); -TOKEN_LIST *UnixExec(char *cmd); -void UnixExecSilent(char *cmd); -void UnixDisableInterfaceOffload(char *name); -void UnixSetEnableKernelEspProcessing(bool b); - -void UnixDisableCoreDump(); -void UnixSetThreadPriorityRealtime(); -void UnixSetResourceLimit(UINT id, UINT64 value); -bool UnixIs64BitRlimSupported(); -UINT64 UnixGetTick64(); -void UnixSigChldHandler(int sig); -void UnixCloseIO(); -void UnixGetCurrentDir(char *dir, UINT size); -void UnixGetCurrentDirW(wchar_t *dir, UINT size); -bool UnixCheckExecAccess(char *name); -bool UnixCheckExecAccessW(wchar_t *name); -DIRLIST *UnixEnumDirEx(char *dirname, COMPARE *compare); -DIRLIST *UnixEnumDirExW(wchar_t *dirname, COMPARE *compare); -bool UnixGetDiskFreeMain(char *path, UINT64 *free_size, UINT64 *used_size, UINT64 *total_size); -bool UnixGetDiskFree(char *path, UINT64 *free_size, UINT64 *used_size, UINT64 *total_size); -void UnixInitSolarisSleep(); -void UnixFreeSolarisSleep(); -void UnixSolarisSleep(UINT msec); - -UINT UnixService(int argc, char *argv[], char *name, SERVICE_FUNCTION *start, SERVICE_FUNCTION *stop); -void UnixServiceMain(int argc, char *argv[], char *name, SERVICE_FUNCTION *start, SERVICE_FUNCTION *stop); -void UnixGenPidFileName(char *name, UINT size); -void UnixGenCtlFileName(char *name, UINT size); -void UnixStartService(char *name); -void UnixStopService(char *name); -void UnixExecService(char *name, SERVICE_FUNCTION *start, SERVICE_FUNCTION *stop); -void UnixUsage(char *name); -void UnixWritePidFile(UINT pid); -void UnixWriteCtlFile(UINT i); -UINT UnixReadPidFile(); -UINT UnixReadCtlFile(); -bool UnixIsProcess(UINT pid); -bool UnixWaitProcessEx(UINT pid, UINT timeout); -void UnixDeletePidFile(); -void UnixDeleteCtlFile(); -void UnixStopThread(THREAD *t, void *param); -UINT UnixGetUID(); -void UnixIgnoreSignalForThread(int sig); - -bool UnixIsInVmMain(); -bool UnixIsInVm(); - - -#endif // UNIX_H - -#endif // OS_UNIX - +// SoftEther VPN Source Code - Developer Edition Master Branch +// Mayaqua Kernel + + +// Unix.h +// Header of Unix.c + +#ifdef OS_UNIX + +#ifndef UNIX_H +#define UNIX_H + +// Constants +#define UNIX_THREAD_STACK_SIZE (200 * 1000) // Stack size +#define UNIX_MAX_CHILD_PROCESSES 2000000 // Maximum number of child processes +#define UNIX_LINUX_MAX_THREADS 200000000 // Maximum number of threads +#define UNIX_MAX_LOCKS 65536 // Maximum number of locks +#define UNIX_MAX_MEMORY (2147483648UL) // Maximum memory capacity +#define UNIX_MAX_MEMORY_64 ((UINT64)((UINT64)65536ULL * (UINT64)2147483647ULL)) // Maximum memory capacity (64-bit) +#define UNIX_MAX_FD (655360) // Maximum number of FDs +#define UNIX_MAX_FD_MACOS (10000) // Maximum number of FDs (Mac OS X) +#define MAXIMUM_WAIT_OBJECTS 64 // Maximum number of select + +#define UNIX_SERVICE_STOP_TIMEOUT_1 (60 * 1000) // Timeout to stop the service +#define UNIX_SERVICE_STOP_TIMEOUT_2 (90 * 1000) // Timeout to stop the service (parent process) + + +// Service related +typedef void (SERVICE_FUNCTION)(); + +#define SVC_NAME "SVC_%s_NAME" +#define SVC_TITLE "SVC_%s_TITLE" + +#define UNIX_SVC_ARG_START "start" +#define UNIX_SVC_ARG_STOP "stop" +#define UNIX_SVC_ARG_EXEC_SVC "execsvc" +#define UNIX_ARG_EXIT "exit" +#define UNIX_SVC_ARG_FOREGROUND "--foreground" + +#define UNIX_SVC_MODE_START 1 +#define UNIX_SVC_MODE_STOP 2 +#define UNIX_SVC_MODE_EXEC_SVC 3 +#define UNIX_SVC_MODE_EXIT 4 + + +// Function prototype +OS_DISPATCH_TABLE *UnixGetDispatchTable(); +void UnixInit(); +void UnixFree(); +void *UnixMemoryAlloc(UINT size); +void *UnixMemoryReAlloc(void *addr, UINT size); +void UnixMemoryFree(void *addr); +UINT UnixGetTick(); +void UnixGetSystemTime(SYSTEMTIME *system_time); +void UnixInc32(UINT *value); +void UnixDec32(UINT *value); +void UnixSleep(UINT time); +LOCK *UnixNewLock(); +bool UnixLock(LOCK *lock); +void UnixUnlock(LOCK *lock); +void UnixUnlockEx(LOCK *lock, bool inner); +void UnixDeleteLock(LOCK *lock); +void UnixInitEvent(EVENT *event); +void UnixSetEvent(EVENT *event); +void UnixResetEvent(EVENT *event); +bool UnixWaitEvent(EVENT *event, UINT timeout); +void UnixFreeEvent(EVENT *event); +bool UnixWaitThread(THREAD *t); +void UnixFreeThread(THREAD *t); +bool UnixInitThread(THREAD *t); +UINT UnixThreadId(); +void *UnixFileOpen(char *name, bool write_mode, bool read_lock); +void *UnixFileOpenW(wchar_t *name, bool write_mode, bool read_lock); +void *UnixFileCreate(char *name); +void *UnixFileCreateW(wchar_t *name); +void *GetUnixio4Stdout(); +bool UnixFileWrite(void *pData, void *buf, UINT size); +bool UnixFileRead(void *pData, void *buf, UINT size); +void UnixFileClose(void *pData, bool no_flush); +void UnixFileFlush(void *pData); +UINT64 UnixFileSize(void *pData); +bool UnixFileSeek(void *pData, UINT mode, int offset); +bool UnixFileDelete(char *name); +bool UnixFileDeleteW(wchar_t *name); +bool UnixMakeDir(char *name); +bool UnixMakeDirW(wchar_t *name); +bool UnixDeleteDir(char *name); +bool UnixDeleteDirW(wchar_t *name); +CALLSTACK_DATA *UnixGetCallStack(); +bool UnixGetCallStackSymbolInfo(CALLSTACK_DATA *s); +bool UnixFileRename(char *old_name, char *new_name); +bool UnixFileRenameW(wchar_t *old_name, wchar_t *new_name); +bool UnixRun(char *filename, char *arg, bool hide, bool wait); +bool UnixRunW(wchar_t *filename, wchar_t *arg, bool hide, bool wait); +bool UnixIsSupportedOs(); +void UnixGetOsInfo(OS_INFO *info); +void UnixAlert(char *msg, char *caption); +void UnixAlertW(wchar_t *msg, wchar_t *caption); +char *UnixGetProductId(); +void UnixSetHighPriority(); +void UnixSetHighOomScore(); +void UnixRestorePriority(); +UINT UnixGetNumberOfCpuInner(); +void *UnixNewSingleInstance(char *instance_name); +void UnixFreeSingleInstance(void *data); +void UnixGetMemInfo(MEMINFO *info); +void UnixYield(); +TOKEN_LIST *UnixExec(char *cmd); +void UnixExecSilent(char *cmd); +void UnixDisableInterfaceOffload(char *name); +void UnixSetEnableKernelEspProcessing(bool b); + +void UnixDisableCoreDump(); +void UnixSetThreadPriorityRealtime(); +void UnixSetResourceLimit(UINT id, UINT64 value); +bool UnixIs64BitRlimSupported(); +UINT64 UnixGetTick64(); +void UnixSigChldHandler(int sig); +void UnixCloseIO(); +void UnixGetCurrentDir(char *dir, UINT size); +void UnixGetCurrentDirW(wchar_t *dir, UINT size); +bool UnixCheckExecAccess(char *name); +bool UnixCheckExecAccessW(wchar_t *name); +DIRLIST *UnixEnumDirEx(char *dirname, COMPARE *compare); +DIRLIST *UnixEnumDirExW(wchar_t *dirname, COMPARE *compare); +bool UnixGetDiskFreeMain(char *path, UINT64 *free_size, UINT64 *used_size, UINT64 *total_size); +bool UnixGetDiskFree(char *path, UINT64 *free_size, UINT64 *used_size, UINT64 *total_size); +void UnixInitSolarisSleep(); +void UnixFreeSolarisSleep(); +void UnixSolarisSleep(UINT msec); + +UINT UnixService(int argc, char *argv[], char *name, SERVICE_FUNCTION *start, SERVICE_FUNCTION *stop); +void UnixServiceMain(int argc, char *argv[], char *name, SERVICE_FUNCTION *start, SERVICE_FUNCTION *stop); +void UnixGenPidFileName(char *name, UINT size); +void UnixGenCtlFileName(char *name, UINT size); +void UnixStartService(char *name); +void UnixStopService(char *name); +void UnixExecService(char *name, SERVICE_FUNCTION *start, SERVICE_FUNCTION *stop); +void UnixUsage(char *name); +void UnixWritePidFile(UINT pid); +void UnixWriteCtlFile(UINT i); +UINT UnixReadPidFile(); +UINT UnixReadCtlFile(); +bool UnixIsProcess(UINT pid); +bool UnixWaitProcessEx(UINT pid, UINT timeout); +void UnixDeletePidFile(); +void UnixDeleteCtlFile(); +void UnixStopThread(THREAD *t, void *param); +UINT UnixGetUID(); +void UnixIgnoreSignalForThread(int sig); + +bool UnixIsInVmMain(); +bool UnixIsInVm(); + + +#endif // UNIX_H + +#endif // OS_UNIX + diff --git a/src/Mayaqua/Win32.c b/src/Mayaqua/Win32.c index f60d1b87..693fae9b 100644 --- a/src/Mayaqua/Win32.c +++ b/src/Mayaqua/Win32.c @@ -1,3436 +1,3436 @@ -// SoftEther VPN Source Code - Developer Edition Master Branch -// Mayaqua Kernel - - -// Win32.c -// Microsoft Windows dependent code - -#include - -#ifdef WIN32 - -#define _WIN32_WINNT 0x0502 -#define WINVER 0x0502 -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -static HANDLE heap_handle = NULL; -static HANDLE hstdout = INVALID_HANDLE_VALUE; -static HANDLE hstdin = INVALID_HANDLE_VALUE; - -// Thread data for Win32 -typedef struct WIN32THREAD -{ - HANDLE hThread; - DWORD thread_id; -} WIN32THREAD; - -// Thread startup information for Win32 -typedef struct WIN32THREADSTARTUPINFO -{ - THREAD_PROC *thread_proc; - void *param; - THREAD *thread; -} WIN32THREADSTARTUPINFO; - -// Function prototype for Win32 -DWORD CALLBACK Win32DefaultThreadProc(void *param); - -// Current process handle -static HANDLE hCurrentProcessHandle = NULL; -static CRITICAL_SECTION fasttick_lock; -static UINT64 start_tick = 0; -static bool use_heap_api = false; -static bool win32_is_nt = false; - -// File I/O data for Win32 -typedef struct WIN32IO -{ - HANDLE hFile; - bool WriteMode; -} WIN32IO; - -// Mutex data for Win32 -typedef struct WIN32MUTEX -{ - HANDLE hMutex; -} WIN32MUTEX; - -// Set the Thread name -#pragma pack(push,8) -typedef struct tagTHREADNAME_INFO -{ - DWORD dwType; // Must be 0x1000. - LPCSTR szName; // Pointer to name (in user addr space). - DWORD dwThreadID; // Thread ID (-1=caller thread). - DWORD dwFlags; // Reserved for future use, must be zero. -} THREADNAME_INFO; -#pragma pack(pop) - -// Create a dispatch table -OS_DISPATCH_TABLE *Win32GetDispatchTable() -{ - static OS_DISPATCH_TABLE t = - { - Win32Init, - Win32Free, - Win32MemoryAlloc, - Win32MemoryReAlloc, - Win32MemoryFree, - Win32GetTick, - Win32GetSystemTime, - Win32Inc32, - Win32Dec32, - Win32Sleep, - Win32NewLock, - Win32Lock, - Win32Unlock, - Win32DeleteLock, - Win32InitEvent, - Win32SetEvent, - Win32ResetEvent, - Win32WaitEvent, - Win32FreeEvent, - Win32WaitThread, - Win32FreeThread, - Win32InitThread, - Win32ThreadId, - Win32FileOpen, - Win32FileOpenW, - Win32FileCreate, - Win32FileCreateW, - Win32FileWrite, - Win32FileRead, - Win32FileClose, - Win32FileFlush, - Win32FileSize, - Win32FileSeek, - Win32FileDelete, - Win32FileDeleteW, - Win32MakeDir, - Win32MakeDirW, - Win32DeleteDir, - Win32DeleteDirW, - Win32GetCallStack, - Win32GetCallStackSymbolInfo, - Win32FileRename, - Win32FileRenameW, - Win32Run, - Win32RunW, - Win32IsSupportedOs, - Win32GetOsInfo, - Win32Alert, - Win32AlertW, - Win32GetProductId, - Win32SetHighPriority, - Win32RestorePriority, - Win32NewSingleInstance, - Win32FreeSingleInstance, - Win32GetMemInfo, - Win32Yield, - }; - - return &t; -} - -// Set the thread name -void Win32SetThreadName(UINT thread_id, char *name) -{ - DWORD ms_vc_exception = 0x406D1388; - THREADNAME_INFO t; - // Validate arguments - if (thread_id == 0 || name == NULL) - { - return; - } - - Zero(&t, sizeof(t)); - t.dwType = 0x1000; - t.szName = name; - t.dwThreadID = thread_id; - t.dwFlags = 0; - - __try - { - RaiseException(ms_vc_exception, 0, sizeof(t) / sizeof(ULONG_PTR), (ULONG_PTR *)&t); - } - __except (EXCEPTION_EXECUTE_HANDLER) - { - } -} - -// Initialization function of the new thread -void Win32InitNewThread() -{ - static HINSTANCE hDll = NULL; - static bool (WINAPI *_SetThreadLocale)(LCID) = NULL; - - if (hDll == NULL) - { - hDll = LoadLibrary("kernel32.dll"); - - _SetThreadLocale = - (bool (__stdcall *)(LCID)) - GetProcAddress(hDll, "SetThreadLocale"); - } - - if (_SetThreadLocale != NULL) - { - _SetThreadLocale(LOCALE_USER_DEFAULT); - } -} - -// Set the compression flag of the folder -bool Win32SetFolderCompressW(wchar_t *path, bool compressed) -{ - HANDLE h; - UINT retsize = 0; - USHORT flag; - wchar_t tmp[MAX_PATH]; - // Validate arguments - if (path == NULL) - { - return false; - } - - if (IsNt() == false) - { - char *path_a = CopyUniToStr(path); - bool ret = Win32SetFolderCompress(path_a, compressed); - - Free(path_a); - - return ret; - } - - InnerFilePathW(tmp, sizeof(tmp), path); - - // Open the folder - h = CreateFileW(tmp, GENERIC_READ | GENERIC_WRITE, FILE_SHARE_READ | FILE_SHARE_WRITE, NULL, OPEN_EXISTING, FILE_FLAG_BACKUP_SEMANTICS, NULL); - - if (h == INVALID_HANDLE_VALUE) - { - return false; - } - - flag = compressed ? COMPRESSION_FORMAT_DEFAULT : COMPRESSION_FORMAT_NONE; - - if (DeviceIoControl(h, FSCTL_SET_COMPRESSION, &flag, sizeof(USHORT), - NULL, 0, &retsize, NULL) == false) - { - return false; - } - - CloseHandle(h); - - return true; -} -bool Win32SetFolderCompress(char *path, bool compressed) -{ - HANDLE h; - UINT retsize = 0; - USHORT flag; - char tmp[MAX_PATH]; - // Validate arguments - if (path == NULL) - { - return false; - } - - InnerFilePath(tmp, sizeof(tmp), path); - - // Open the folder - h = CreateFile(tmp, GENERIC_READ | GENERIC_WRITE, FILE_SHARE_READ | FILE_SHARE_WRITE, NULL, OPEN_EXISTING, FILE_FLAG_BACKUP_SEMANTICS, NULL); - - if (h == INVALID_HANDLE_VALUE) - { - return false; - } - - flag = compressed ? COMPRESSION_FORMAT_DEFAULT : COMPRESSION_FORMAT_NONE; - - if (DeviceIoControl(h, FSCTL_SET_COMPRESSION, &flag, sizeof(USHORT), - NULL, 0, &retsize, NULL) == false) - { - return false; - } - - CloseHandle(h); - - return true; -} - -// Get the free space of the disk -bool Win32GetDiskFreeW(wchar_t *path, UINT64 *free_size, UINT64 *used_size, UINT64 *total_size) -{ - wchar_t tmp[MAX_SIZE]; - UINT count = 0; - UINT i, n, len; - ULARGE_INTEGER v1, v2, v3; - bool ret = false; - // Validate arguments - if (path == NULL) - { - return false; - } - - if (IsNt() == false) - { - bool ret; - char *path_a = CopyUniToStr(path); - - ret = Win32GetDiskFree(path_a, free_size, used_size, total_size); - - Free(path_a); - - return ret; - } - - Zero(&v1, sizeof(v1)); - Zero(&v2, sizeof(v2)); - Zero(&v3, sizeof(v3)); - - NormalizePathW(tmp, sizeof(tmp), path); - - // Get the directory name - if (UniStartWith(path, L"\\\\")) - { - count = 4; - } - else - { - count = 1; - } - - len = UniStrLen(tmp); - n = 0; - for (i = 0;i < len;i++) - { - if (tmp[i] == L'\\') - { - n++; - if (n >= count) - { - tmp[i + 1] = 0; - break; - } - } - } - - if (GetDiskFreeSpaceExW(tmp, &v1, &v2, &v3)) - { - ret = true; - } - - if (free_size != NULL) - { - *free_size = v1.QuadPart; - } - - if (total_size != NULL) - { - *total_size = v2.QuadPart; - } - - if (used_size != NULL) - { - *used_size = v2.QuadPart - v1.QuadPart; - } - - return ret; -} -bool Win32GetDiskFree(char *path, UINT64 *free_size, UINT64 *used_size, UINT64 *total_size) -{ - char tmp[MAX_SIZE]; - UINT count = 0; - UINT i, n, len; - ULARGE_INTEGER v1, v2, v3; - bool ret = false; - // Validate arguments - if (path == NULL) - { - return false; - } - - Zero(&v1, sizeof(v1)); - Zero(&v2, sizeof(v2)); - Zero(&v3, sizeof(v3)); - - NormalizePath(tmp, sizeof(tmp), path); - - // Get the directory name - if (StartWith(path, "\\\\")) - { - count = 4; - } - else - { - count = 1; - } - - len = StrLen(tmp); - n = 0; - for (i = 0;i < len;i++) - { - if (tmp[i] == '\\') - { - n++; - if (n >= count) - { - tmp[i + 1] = 0; - break; - } - } - } - - if (GetDiskFreeSpaceEx(tmp, &v1, &v2, &v3)) - { - ret = true; - } - - if (free_size != NULL) - { - *free_size = v1.QuadPart; - } - - if (total_size != NULL) - { - *total_size = v2.QuadPart; - } - - if (used_size != NULL) - { - *used_size = v2.QuadPart - v1.QuadPart; - } - - return ret; -} - -// Enumeration of directory -DIRLIST *Win32EnumDirEx(char *dirname, COMPARE *compare) -{ - DIRLIST *ret; - wchar_t *dirname_w = CopyStrToUni(dirname); - - ret = Win32EnumDirExW(dirname_w, compare); - - Free(dirname_w); - - return ret; -} -DIRLIST *Win32EnumDirExW(wchar_t *dirname, COMPARE *compare) -{ - WIN32_FIND_DATAA data_a; - WIN32_FIND_DATAW data_w; - HANDLE h; - wchar_t tmp[MAX_PATH]; - wchar_t tmp2[MAX_PATH]; - wchar_t dirname2[MAX_PATH]; - LIST *o; - DIRLIST *d; - - UniStrCpy(tmp2, sizeof(tmp2), dirname); - - if (UniStrLen(tmp2) >= 1 && tmp2[UniStrLen(tmp2) - 1] == L'\\') - { - tmp2[UniStrLen(tmp2) - 1] = 0; - } - - UniFormat(tmp, sizeof(tmp), L"%s\\*.*", tmp2); - NormalizePathW(tmp, sizeof(tmp), tmp); - NormalizePathW(dirname2, sizeof(dirname2), tmp2); - - o = NewListFast(compare); - - Zero(&data_a, sizeof(data_a)); - Zero(&data_w, sizeof(data_w)); - - if (IsNt()) - { - h = FindFirstFileW(tmp, &data_w); - } - else - { - char *tmp_a = CopyUniToStr(tmp); - - h = FindFirstFileA(tmp_a, &data_a); - - Free(tmp_a); - } - - if (h != INVALID_HANDLE_VALUE) - { - bool b = true; - - do - { - if (IsNt() == false) - { - Zero(&data_w, sizeof(data_w)); - StrToUni(data_w.cFileName, sizeof(data_w.cFileName), data_a.cFileName); - data_w.dwFileAttributes = data_a.dwFileAttributes; - data_w.ftCreationTime = data_a.ftCreationTime; - data_w.ftLastWriteTime = data_a.ftLastWriteTime; - data_w.nFileSizeHigh = data_a.nFileSizeHigh; - data_w.nFileSizeLow = data_a.nFileSizeLow; - } - - if (UniStrCmpi(data_w.cFileName, L"..") != 0 && - UniStrCmpi(data_w.cFileName, L".") != 0) - { - DIRENT *f = ZeroMalloc(sizeof(DIRENT)); - SYSTEMTIME t1, t2; - wchar_t fullpath[MAX_SIZE]; - bool ok = false; - - f->FileNameW = UniCopyStr(data_w.cFileName); - f->FileName = CopyUniToStr(f->FileNameW); - f->Folder = (data_w.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) ? true : false; - - CombinePathW(fullpath, sizeof(fullpath), dirname2, f->FileNameW); - - // Attempt to get the file information - if (MsIsNt()) - { - HANDLE h = CreateFileW(fullpath, 0, - FILE_SHARE_DELETE | FILE_SHARE_READ | FILE_SHARE_WRITE, - NULL, OPEN_EXISTING, 0, NULL); - - if (h != INVALID_HANDLE_VALUE) - { - BY_HANDLE_FILE_INFORMATION info; - - Zero(&info, sizeof(info)); - - if (MsGetFileInformation(h, &info)) - { - Zero(&t1, sizeof(t1)); - Zero(&t2, sizeof(t2)); - FileTimeToSystemTime(&info.ftCreationTime, &t1); - FileTimeToSystemTime(&info.ftLastWriteTime, &t2); - f->CreateDate = SystemToUINT64(&t1); - f->UpdateDate = SystemToUINT64(&t2); - - if (f->Folder == false) - { - f->FileSize = ((UINT64)info.nFileSizeHigh * (UINT64)((UINT64)MAXDWORD + (UINT64)1)) + (UINT64)info.nFileSizeLow; - } - - ok = true; - } - - CloseHandle(h); - } - } - - if (ok == false) - { - Zero(&t1, sizeof(t1)); - Zero(&t2, sizeof(t2)); - FileTimeToSystemTime(&data_w.ftCreationTime, &t1); - FileTimeToSystemTime(&data_w.ftLastWriteTime, &t2); - f->CreateDate = SystemToUINT64(&t1); - f->UpdateDate = SystemToUINT64(&t2); - - if (f->Folder == false) - { - f->FileSize = ((UINT64)data_w.nFileSizeHigh * (UINT64)((UINT64)MAXDWORD + (UINT64)1)) + (UINT64)data_w.nFileSizeLow; - } - } - - Add(o, f); - } - - Zero(&data_w, sizeof(data_w)); - Zero(&data_a, sizeof(data_a)); - - if (IsNt()) - { - b = FindNextFileW(h, &data_w); - } - else - { - b = FindNextFileA(h, &data_a); - } - } - while (b); - - FindClose(h); - } - - Sort(o); - - d = ZeroMalloc(sizeof(DIRLIST)); - d->NumFiles = LIST_NUM(o); - d->File = ToArray(o); - - ReleaseList(o); - - return d; -} - -// Get the EXE file name -void Win32GetExeNameW(wchar_t *name, UINT size) -{ - // Validate arguments - if (name == NULL) - { - return; - } - - if (IsNt() == false) - { - char name_a[MAX_PATH]; - - Win32GetExeName(name_a, sizeof(name_a)); - - StrToUni(name, size, name_a); - - return; - } - - UniStrCpy(name, size, L""); - - GetModuleFileNameW(NULL, name, size); -} -void Win32GetExeName(char *name, UINT size) -{ - // Validate arguments - if (name == NULL) - { - return; - } - - StrCpy(name, size, ""); - - GetModuleFileName(NULL, name, size); -} - -// Get the current directory -void Win32GetCurrentDirW(wchar_t *dir, UINT size) -{ - // Validate arguments - if (dir == NULL) - { - return; - } - - if (IsNt() == false) - { - char dir_a[MAX_PATH]; - - Win32GetCurrentDir(dir_a, sizeof(dir_a)); - - StrToUni(dir, size, dir_a); - - return; - } - - GetCurrentDirectoryW(size, dir); -} -void Win32GetCurrentDir(char *dir, UINT size) -{ - // Validate arguments - if (dir == NULL) - { - return; - } - - GetCurrentDirectory(size, dir); -} - -// Yield -void Win32Yield() -{ - Sleep(0); -} - -// Get the memory information -void Win32GetMemInfo(MEMINFO *info) -{ - static HINSTANCE hDll = NULL; - static bool (WINAPI *_GlobalMemoryStatusEx)(LPMEMORYSTATUSEX) = NULL; - // Validate arguments - if (info == NULL) - { - return; - } - - Zero(info, sizeof(MEMINFO)); - - if (hDll == NULL) - { - hDll = LoadLibrary("kernel32.dll"); - } - if (hDll != NULL) - { - if (_GlobalMemoryStatusEx == NULL) - { - _GlobalMemoryStatusEx = - (bool (__stdcall *)(LPMEMORYSTATUSEX))GetProcAddress(hDll, "GlobalMemoryStatusEx"); - } - } - - - if (_GlobalMemoryStatusEx == NULL) - { - // Old API - MEMORYSTATUS st; - Zero(&st, sizeof(st)); - st.dwLength = sizeof(st); - - GlobalMemoryStatus(&st); - - // Amount of the logical memory - info->TotalMemory = (UINT64)st.dwTotalPageFile; - info->FreeMemory = (UINT64)st.dwAvailPageFile; - info->UsedMemory = info->TotalMemory - info->FreeMemory; - - // Amount of the physical memory - info->TotalPhys = (UINT64)st.dwTotalPhys; - info->FreePhys = (UINT64)st.dwAvailPhys; - info->UsedPhys = info->TotalPhys - info->FreePhys; - } - else - { - // New API - MEMORYSTATUSEX st; - Zero(&st, sizeof(st)); - st.dwLength = sizeof(st); - - _GlobalMemoryStatusEx(&st); - - // Amount of the logical memory - info->TotalMemory = st.ullTotalPageFile; - info->FreeMemory = st.ullAvailPageFile; - info->UsedMemory = info->TotalMemory - info->FreeMemory; - - // Amount of the physical memory - info->TotalPhys = st.ullTotalPhys; - info->FreePhys = st.ullAvailPhys; - info->UsedPhys = info->TotalPhys - info->FreePhys; - } -} - -// Creating a single instance -void *Win32NewSingleInstance(char *instance_name) -{ - WIN32MUTEX *ret; - char tmp[MAX_SIZE]; - HANDLE hMutex; - // Validate arguments - if (instance_name == NULL) - { - char exe_path[MAX_PATH]; - GetModuleFileName(NULL, exe_path, sizeof(exe_path)); - HashInstanceName(tmp, sizeof(tmp), exe_path); - instance_name = tmp; - } - - hMutex = OpenMutex(MUTEX_ALL_ACCESS, FALSE, instance_name); - if (hMutex != NULL) - { - CloseHandle(hMutex); - return NULL; - } - - hMutex = CreateMutex(NULL, FALSE, instance_name); - if (hMutex == NULL) - { - CloseHandle(hMutex); - return NULL; - } - - ret = Win32MemoryAlloc(sizeof(WIN32MUTEX)); - ret->hMutex = hMutex; - - return (void *)ret; -} - -// Release the single instance -void Win32FreeSingleInstance(void *data) -{ - WIN32MUTEX *m; - // Validate arguments - if (data == NULL) - { - return; - } - - m = (WIN32MUTEX *)data; - ReleaseMutex(m->hMutex); - CloseHandle(m->hMutex); - - Win32MemoryFree(m); -} - -// Raise the priority -void Win32SetHighPriority() -{ - SetPriorityClass(GetCurrentProcess(), HIGH_PRIORITY_CLASS); -} - -// Restore the priority -void Win32RestorePriority() -{ - SetPriorityClass(GetCurrentProcess(), NORMAL_PRIORITY_CLASS); -} - -// Get the node information -char* Win32GetProductId() -{ - char *product_id; - - return CopyStr("--"); - - // Product ID - product_id = MsRegReadStr(REG_LOCAL_MACHINE, "SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion", "ProductId"); - if (product_id == NULL) - { - product_id = MsRegReadStr(REG_LOCAL_MACHINE, "SOFTWARE\\Microsoft\\Windows\\CurrentVersion", "ProductId"); - } - - return product_id; -} - -// Acquisition whether the OS is currently supported -bool Win32IsSupportedOs() -{ - if (Win32GetOsType() == 0) - { - Win32Alert( - CEDAR_PRODUCT_STR " VPN doesn't support this Windows Operating System.\n" - CEDAR_PRODUCT_STR " VPN requires " SUPPORTED_WINDOWS_LIST ".\n\n" - "Please contact your system administrator.", NULL); - return false; - } - - return true; -} - -// Show an alert -void Win32AlertW(wchar_t *msg, wchar_t *caption) -{ - char *s; - // Validate arguments - if (msg == NULL) - { - msg = L"Alert"; - } - if (caption == NULL) - { - caption = CEDAR_PRODUCT_STR_W L" VPN Kernel"; - } - - s = GetCommandLineStr(); - - if (SearchStr(s, "win9x_uninstall", 0) == INFINITE && SearchStr(s, "win9x_install", 0) == INFINITE) - { - // Hide during the uninstallation in Win9x service mode - MessageBoxW(NULL, msg, caption, MB_SETFOREGROUND | MB_TOPMOST | MB_SERVICE_NOTIFICATION | MB_OK | MB_ICONEXCLAMATION); - } - - Free(s); -} -void Win32Alert(char *msg, char *caption) -{ - char *s; - // Validate arguments - if (msg == NULL) - { - msg = "Alert"; - } - if (caption == NULL) - { - caption = CEDAR_PRODUCT_STR " VPN Kernel"; - } - - s = GetCommandLineStr(); - - if (SearchStr(s, "win9x_uninstall", 0) == INFINITE && SearchStr(s, "win9x_install", 0) == INFINITE) - { - // Hide during the uninstallation in Win9x service mode - MessageBox(NULL, msg, caption, MB_SETFOREGROUND | MB_TOPMOST | MB_SERVICE_NOTIFICATION | MB_OK | MB_ICONEXCLAMATION); - } - - Free(s); -} -void Win32DebugAlert(char *msg) -{ - // Validate arguments - if (msg == NULL) - { - msg = "Alert"; - } - - MessageBox(NULL, msg, "Debug", MB_SETFOREGROUND | MB_TOPMOST | MB_SERVICE_NOTIFICATION | MB_OK | MB_ICONEXCLAMATION); -} - -// Get the number of CPUs -UINT Win32GetNumberOfCpuInner() -{ - UINT ret = 0; - SYSTEM_INFO info; - - Zero(&info, sizeof(info)); - - GetSystemInfo(&info); - - if (info.dwNumberOfProcessors >= 1 && info.dwNumberOfProcessors <= 128) - { - ret = info.dwNumberOfProcessors; - } - - return ret; -} - -// Get the OS information -void Win32GetOsInfo(OS_INFO *info) -{ - UINT type = Win32GetOsType(); - OSVERSIONINFOEX os; - char tmp[MAX_SIZE]; - // Validate arguments - if (info == NULL) - { - return; - } - - Zero(&os, sizeof(os)); - os.dwOSVersionInfoSize = sizeof(os); - Win32GetVersionExInternal((LPOSVERSIONINFOA)&os); - - info->OsType = Win32GetOsType(); - info->OsServicePack = os.wServicePackMajor; - if (OS_IS_WINDOWS_NT(info->OsType)) - { - char *s; - char *keyname = "SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion"; - info->OsSystemName = CopyStr("Windows NT"); - Format(tmp, sizeof(tmp), "Build %u", os.dwBuildNumber); - if (s = MsRegReadStr(REG_LOCAL_MACHINE, keyname, "CurrentType")) - { - char str[MAX_SIZE]; - Format(str, sizeof(str), ", %s", s); - StrCat(tmp, sizeof(tmp), str); - Free(s); - } - if (os.wServicePackMajor != 0) - { - char str[MAX_SIZE]; - Format(str, sizeof(str), ", Service Pack %u", os.wServicePackMajor); - StrCat(tmp, sizeof(tmp), str); - } - if (s = MsRegReadStr(REG_LOCAL_MACHINE, keyname, "BuildLab")) - { - char str[MAX_SIZE]; - Format(str, sizeof(str), " (%s)", s); - StrCat(tmp, sizeof(tmp), str); - Free(s); - } - info->OsVersion = CopyStr(tmp); - info->KernelName = CopyStr("NTOS Kernel"); - Format(tmp, sizeof(tmp), "Build %u", os.dwBuildNumber); - if (s = MsRegReadStr(REG_LOCAL_MACHINE, keyname, "CurrentType")) - { - char str[MAX_SIZE]; - Format(str, sizeof(str), " %s", s); - StrCat(tmp, sizeof(tmp), str); - Free(s); - } - info->KernelVersion = CopyStr(tmp); - } - else - { - OSVERSIONINFO os; - Zero(&os, sizeof(os)); - os.dwOSVersionInfoSize = sizeof(os); - GetVersionEx(&os); - Format(tmp, sizeof(tmp), "Build %u %s", LOWORD(os.dwBuildNumber), os.szCSDVersion); - Trim(tmp); - info->OsVersion = CopyStr(tmp); - info->OsSystemName = CopyStr("Windows"); - info->KernelName = CopyStr("Windows 9x Kernel"); - info->KernelVersion = CopyStr(tmp); - } - - info->OsProductName = CopyStr(OsTypeToStr(info->OsType)); - info->OsVendorName = CopyStr("Microsoft Corporation"); -} - -// GetVersionEx API (Ignore the tricky features that have been added to the Windows 8.2 or later) -bool Win32GetVersionExInternal(void *info) -{ - OSVERSIONINFOA os; - // Validate arguments - if (info == NULL) - { - return false; - } - - Zero(&os, sizeof(os)); - os.dwOSVersionInfoSize = sizeof(os); - - if (GetVersionExA(&os)) - { - if (os.dwPlatformId == VER_PLATFORM_WIN32_NT) - { - if ((os.dwMajorVersion == 6 && os.dwMinorVersion >= 2) || - (os.dwMajorVersion >= 7)) - { - // Windows 8 later - return Win32GetVersionExInternalForWindows81orLater(info); - } - } - } - - return GetVersionExA(info); -} - -// GetVersionEx for Windows 8.1 and later -bool Win32GetVersionExInternalForWindows81orLater(void *info) -{ - OSVERSIONINFOEXA *ex = (OSVERSIONINFOEXA *)info; - char *str; - UINT major1 = 0, major2 = 0; - UINT minor1 = 0, minor2 = 0; - UINT major = 0, minor = 0; - // Validate arguments - if (info == NULL) - { - return false; - } - - if (ex->dwOSVersionInfoSize != sizeof(OSVERSIONINFOEXA) && - ex->dwOSVersionInfoSize != sizeof(OSVERSIONINFOA)) - { - return GetVersionExA(info); - } - - if (GetVersionExA(info) == false) - { - return false; - } - - str = MsRegReadStrEx2(REG_LOCAL_MACHINE, - "SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion", - "CurrentVersion", - false, true); - - if (IsEmptyStr(str) == false) - { - // Is the version string formed as x.y? - TOKEN_LIST *t = ParseToken(str, "."); - - if (t != NULL && t->NumTokens == 2) - { - major1 = ToInt(t->Token[0]); - minor1 = ToInt(t->Token[1]); - } - - FreeToken(t); - } - - Free(str); - - major2 = MsRegReadIntEx2(REG_LOCAL_MACHINE, - "SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion", - "CurrentMajorVersionNumber", false, true); - - minor2 = MsRegReadIntEx2(REG_LOCAL_MACHINE, - "SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion", - "CurrentMinorVersionNumber", false, true); - - if ((major1 * 10000 + minor1) > (major2 * 10000 + minor2)) - { - major = major1; - minor = minor1; - } - else - { - major = major2; - minor = minor2; - } - - if (major >= 6) - { - // Version number acquisition success - ex->dwMajorVersion = major; - ex->dwMinorVersion = minor; - } - - return true; -} - -// Acquisition whether it's a Windows NT -bool Win32IsNt() -{ - OSVERSIONINFO os; - Zero(&os, sizeof(os)); - os.dwOSVersionInfoSize = sizeof(os); - - if (GetVersionEx(&os) == FALSE) - { - // Failure? - return false; - } - - if (os.dwPlatformId == VER_PLATFORM_WIN32_NT) - { - // NT - return true; - } - - // 9x - return false; -} - -// Get the OS type -UINT Win32GetOsType() -{ - OSVERSIONINFO os; - Zero(&os, sizeof(os)); - os.dwOSVersionInfoSize = sizeof(os); - - if (Win32GetVersionExInternal(&os) == FALSE) - { - // Failure? - return 0; - } - - if (os.dwPlatformId == VER_PLATFORM_WIN32_WINDOWS) - { - // Windows 9x system - if (os.dwMajorVersion == 4) - { - if (os.dwMinorVersion == 0) - { - return OSTYPE_WINDOWS_95; - } - else if (os.dwMinorVersion == 10) - { - return OSTYPE_WINDOWS_98; - } - else if (os.dwMinorVersion == 90) - { - return OSTYPE_WINDOWS_ME; - } - else - { - return OSTYPE_WINDOWS_UNKNOWN; - } - } - else if (os.dwMajorVersion >= 5) - { - return OSTYPE_WINDOWS_UNKNOWN; - } - } - else if (os.dwPlatformId == VER_PLATFORM_WIN32_NT) - { - UINT sp = Win32GetSpVer(os.szCSDVersion); - if (os.dwMajorVersion == 4) - { - if (sp < 6) - { - // SP6 or earlier - return 0; - } - } - if (os.dwMajorVersion < 4) - { - // NT 3.51 or earlier - return 0; - } - else - { - OSVERSIONINFOEX os; - Zero(&os, sizeof(os)); - os.dwOSVersionInfoSize = sizeof(os); - Win32GetVersionExInternal((LPOSVERSIONINFOA)&os); - - if (os.dwMajorVersion == 4) - { - // Windows NT 4.0 - if (os.wProductType == VER_NT_DOMAIN_CONTROLLER || os.wProductType == VER_NT_SERVER) - { - if ((os.wSuiteMask & VER_SUITE_TERMINAL) || (os.wSuiteMask & VER_SUITE_SINGLEUSERTS)) - { - return OSTYPE_WINDOWS_NT_4_TERMINAL_SERVER; - } - if (os.wSuiteMask & VER_SUITE_ENTERPRISE) - { - return OSTYPE_WINDOWS_NT_4_SERVER_ENTERPRISE; - } - if (os.wSuiteMask & VER_SUITE_BACKOFFICE) - { - return OSTYPE_WINDOWS_NT_4_BACKOFFICE; - } - if ((os.wSuiteMask & VER_SUITE_SMALLBUSINESS) || (os.wSuiteMask & VER_SUITE_SMALLBUSINESS_RESTRICTED)) - { - return OSTYPE_WINDOWS_NT_4_SMS; - } - else - { - return OSTYPE_WINDOWS_NT_4_SERVER; - } - } - else - { - return OSTYPE_WINDOWS_NT_4_WORKSTATION; - } - } - else if (os.dwMajorVersion == 5) - { - // Windows 2000, XP, Server 2003 - if (os.dwMinorVersion == 0) - { - // Windows 2000 - if (os.wProductType == VER_NT_DOMAIN_CONTROLLER || os.wProductType == VER_NT_SERVER) - { - // Server - if (os.wSuiteMask & VER_SUITE_DATACENTER) - { - return OSTYPE_WINDOWS_2000_DATACENTER_SERVER; - } - else if ((os.wSuiteMask & VER_SUITE_SMALLBUSINESS) || (os.wSuiteMask & VER_SUITE_SMALLBUSINESS_RESTRICTED)) - { - return OSTYPE_WINDOWS_2000_SBS; - } - else if (os.wSuiteMask & VER_SUITE_BACKOFFICE) - { - return OSTYPE_WINDOWS_2000_BACKOFFICE; - } - else if (os.wSuiteMask & VER_SUITE_ENTERPRISE) - { - return OSTYPE_WINDOWS_2000_ADVANCED_SERVER; - } - else - { - return OSTYPE_WINDOWS_2000_SERVER; - } - } - else - { - // Client - return OSTYPE_WINDOWS_2000_PROFESSIONAL; - } - } - else if (os.dwMinorVersion == 1) - { - // Windows XP - if (os.wSuiteMask & VER_SUITE_PERSONAL) - { - return OSTYPE_WINDOWS_XP_HOME; - } - else - { - return OSTYPE_WINDOWS_XP_PROFESSIONAL; - } - } - else if (os.dwMinorVersion == 2) - { - // Windows Server 2003 - if (os.wProductType == VER_NT_DOMAIN_CONTROLLER || os.wProductType == VER_NT_SERVER) - { - // Server - if (os.wSuiteMask & VER_SUITE_DATACENTER) - { - return OSTYPE_WINDOWS_2003_DATACENTER; - } - else if ((os.wSuiteMask & VER_SUITE_SMALLBUSINESS) || (os.wSuiteMask & VER_SUITE_SMALLBUSINESS_RESTRICTED)) - { - return OSTYPE_WINDOWS_2003_SBS; - } - else if (os.wSuiteMask & VER_SUITE_BACKOFFICE) - { - return OSTYPE_WINDOWS_2003_BACKOFFICE; - } - else if (os.wSuiteMask & VER_SUITE_ENTERPRISE) - { - return OSTYPE_WINDOWS_2003_ENTERPRISE; - } - else if (os.wSuiteMask & VER_SUITE_BLADE) - { - return OSTYPE_WINDOWS_2003_WEB; - } - else - { - return OSTYPE_WINDOWS_2003_STANDARD; - } - } - else - { - // Client (Unknown XP?) - return OSTYPE_WINDOWS_XP_PROFESSIONAL; - } - } - else - { - // Windows Longhorn - if (os.wProductType == VER_NT_DOMAIN_CONTROLLER || os.wProductType == VER_NT_SERVER) - { - return OSTYPE_WINDOWS_LONGHORN_SERVER; - } - else - { - return OSTYPE_WINDOWS_LONGHORN_PROFESSIONAL; - } - } - } - else - { - if (os.dwMajorVersion == 6 && os.dwMinorVersion == 0) - { - // Windows Vista, Server 2008 - if (os.wProductType == VER_NT_DOMAIN_CONTROLLER || os.wProductType == VER_NT_SERVER) - { - return OSTYPE_WINDOWS_LONGHORN_SERVER; - } - else - { - return OSTYPE_WINDOWS_LONGHORN_PROFESSIONAL; - } - } - else if (os.dwMajorVersion == 6 && os.dwMinorVersion == 1) - { - if (os.wProductType == VER_NT_WORKSTATION) - { - // Windows 7 - return OSTYPE_WINDOWS_7; - } - else - { - // Windows Server 2008 R2 - return OSTYPE_WINDOWS_SERVER_2008_R2; - } - } - else if (os.dwMajorVersion == 6 && os.dwMinorVersion == 2) - { - if (os.wProductType == VER_NT_WORKSTATION) - { - // Windows 8 - return OSTYPE_WINDOWS_8; - } - else - { - // Windows Server 2012 - return OSTYPE_WINDOWS_SERVER_8; - } - } - else if (os.dwMajorVersion == 6 && os.dwMinorVersion == 3) - { - if (os.wProductType == VER_NT_WORKSTATION) - { - // Windows 8.1 - return OSTYPE_WINDOWS_81; - } - else - { - // Windows Server 2012 R2 - return OSTYPE_WINDOWS_SERVER_81; - } - } - else if ((os.dwMajorVersion == 6 && os.dwMinorVersion == 4) || (os.dwMajorVersion == 10 && os.dwMinorVersion == 0)) - { - if (os.wProductType == VER_NT_WORKSTATION) - { - // Windows 10 - return OSTYPE_WINDOWS_10; - } - else - { - // Windows Server 10 - return OSTYPE_WINDOWS_SERVER_10; - } - } - else - { - if (os.wProductType == VER_NT_WORKSTATION) - { - // Windows 11 or later - return OSTYPE_WINDOWS_11; - } - else - { - // Windows Server 11 or later - return OSTYPE_WINDOWS_SERVER_11; - } - } - } - } - } - - // Can not be determined - return 0; -} - -// Get the SP version from the string -UINT Win32GetSpVer(char *str) -{ - UINT ret, i; - TOKEN_LIST *t; - // Validate arguments - if (str == NULL) - { - return 0; - } - - t = ParseToken(str, NULL); - if (t == NULL) - { - return 0; - } - - ret = 0; - for (i = 0;i < t->NumTokens;i++) - { - ret = ToInt(t->Token[i]); - if (ret != 0) - { - break; - } - } - - FreeToken(t); - - return ret; -} - -// Kill the process -bool Win32TerminateProcess(void *handle) -{ - HANDLE h; - // Validate arguments - if (handle == NULL) - { - return false; - } - - h = (HANDLE)handle; - - TerminateProcess(h, 0); - - return true; -} - -// Close the process -void Win32CloseProcess(void *handle) -{ - // Validate arguments - if (handle == NULL) - { - return; - } - - CloseHandle((HANDLE)handle); -} - -// Check whether the specified process is alive -bool Win32IsProcessAlive(void *handle) -{ - HANDLE h; - // Validate arguments - if (handle == NULL) - { - return false; - } - - h = (HANDLE)handle; - - if (WaitForSingleObject(h, 0) == WAIT_OBJECT_0) - { - return false; - } - - return true; -} - -// Wait for the process termination -bool Win32WaitProcess(void *h, UINT timeout) -{ - // Validate arguments - if (h == NULL) - { - return false; - } - if (timeout == 0) - { - timeout = INFINITE; - } - - if (WaitForSingleObject((HANDLE)h, timeout) == WAIT_TIMEOUT) - { - return false; - } - - return true; -} - -// Run the process and wait for terminate it -bool Win32RunAndWaitProcess(wchar_t *filename, wchar_t *arg, bool hide, bool disableWow, UINT timeout) -{ - UINT process_id = 0; - void *p = Win32RunEx3W(filename, arg, hide, &process_id, disableWow); - - if (p == NULL) - { - return false; - } - - return Win32WaitProcess(p, timeout); -} - -// Run the process (return the handle) -void *Win32RunExW(wchar_t *filename, wchar_t *arg, bool hide) -{ - return Win32RunEx2W(filename, arg, hide, NULL); -} -void *Win32RunEx2W(wchar_t *filename, wchar_t *arg, bool hide, UINT *process_id) -{ - return Win32RunEx3W(filename, arg, hide, process_id, false); -} -void *Win32RunEx3W(wchar_t *filename, wchar_t *arg, bool hide, UINT *process_id, bool disableWow) -{ - STARTUPINFOW info; - PROCESS_INFORMATION ret; - wchar_t cmdline[MAX_SIZE]; - wchar_t name[MAX_PATH]; - void *p; - // Validate arguments - if (filename == NULL) - { - return NULL; - } - - if (IsNt() == false) - { - char *filename_a = CopyUniToStr(filename); - char *arg_a = CopyUniToStr(arg); - void *ret = Win32RunEx3(filename_a, arg_a, hide, process_id, disableWow); - - Free(filename_a); - Free(arg_a); - - return ret; - } - - UniStrCpy(name, sizeof(name), filename); - UniTrim(name); - - if (UniSearchStr(name, L"\"", 0) == INFINITE) - { - if (arg == NULL) - { - UniFormat(cmdline, sizeof(cmdline), L"%s", name); - } - else - { - UniFormat(cmdline, sizeof(cmdline), L"%s %s", name, arg); - } - } - else - { - if (arg == NULL) - { - UniFormat(cmdline, sizeof(cmdline), L"\"%s\"", name); - } - else - { - UniFormat(cmdline, sizeof(cmdline), L"\"%s\" %s", name, arg); - } - } - - Zero(&info, sizeof(info)); - Zero(&ret, sizeof(ret)); - info.cb = sizeof(info); - info.dwFlags = STARTF_USESHOWWINDOW; - info.wShowWindow = (hide == false ? SW_SHOWDEFAULT : SW_HIDE); - - UniTrim(cmdline); - - if (disableWow) - { - p = MsDisableWow64FileSystemRedirection(); - } - - if (CreateProcessW(NULL, cmdline, NULL, NULL, FALSE, - (hide == false ? CREATE_NEW_CONSOLE : CREATE_NO_WINDOW | CREATE_NEW_CONSOLE) | NORMAL_PRIORITY_CLASS, - NULL, NULL, &info, &ret) == FALSE) - { - if (disableWow) - { - MsRestoreWow64FileSystemRedirection(p); - } - return NULL; - } - - if (disableWow) - { - MsRestoreWow64FileSystemRedirection(p); - } - - if (process_id != NULL) - { - *process_id = ret.dwProcessId; - } - - CloseHandle(ret.hThread); - return ret.hProcess; -} -void *Win32RunEx(char *filename, char *arg, bool hide) -{ - return Win32RunEx2(filename, arg, hide, NULL); -} -void *Win32RunEx2(char *filename, char *arg, bool hide, UINT *process_id) -{ - return Win32RunEx3(filename, arg, hide, process_id, false); -} -void *Win32RunEx3(char *filename, char *arg, bool hide, UINT *process_id, bool disableWow) -{ - STARTUPINFO info; - PROCESS_INFORMATION ret; - char cmdline[MAX_SIZE]; - char name[MAX_PATH]; - void *p = NULL; - // Validate arguments - if (filename == NULL) - { - return NULL; - } - - StrCpy(name, sizeof(name), filename); - Trim(name); - - if (SearchStr(name, "\"", 0) == INFINITE) - { - if (arg == NULL) - { - Format(cmdline, sizeof(cmdline), "%s", name); - } - else - { - Format(cmdline, sizeof(cmdline), "%s %s", name, arg); - } - } - else - { - if (arg == NULL) - { - Format(cmdline, sizeof(cmdline), "\"%s\"", name); - } - else - { - Format(cmdline, sizeof(cmdline), "\"%s\" %s", name, arg); - } - } - - Zero(&info, sizeof(info)); - Zero(&ret, sizeof(ret)); - info.cb = sizeof(info); - info.dwFlags = STARTF_USESHOWWINDOW; - info.wShowWindow = (hide == false ? SW_SHOWDEFAULT : SW_HIDE); - - Trim(cmdline); - - if (disableWow) - { - p = MsDisableWow64FileSystemRedirection(); - } - - if (CreateProcess(NULL, cmdline, NULL, NULL, FALSE, - (hide == false ? CREATE_NEW_CONSOLE : CREATE_NO_WINDOW | CREATE_NEW_CONSOLE) | NORMAL_PRIORITY_CLASS, - NULL, NULL, &info, &ret) == FALSE) - { - if (disableWow) - { - MsRestoreWow64FileSystemRedirection(p); - } - return NULL; - } - if (disableWow) - { - MsRestoreWow64FileSystemRedirection(p); - } - - if (process_id != NULL) - { - *process_id = ret.dwProcessId; - } - - CloseHandle(ret.hThread); - return ret.hProcess; -} - -// Start the process -bool Win32RunW(wchar_t *filename, wchar_t *arg, bool hide, bool wait) -{ - STARTUPINFOW info; - PROCESS_INFORMATION ret; - wchar_t cmdline[MAX_SIZE]; - wchar_t name[MAX_PATH]; - // Validate arguments - if (filename == NULL) - { - return false; - } - - if (IsNt() == false) - { - char *filename_a = CopyUniToStr(filename); - char *arg_a = CopyUniToStr(arg); - bool ret; - - ret = Win32Run(filename_a, arg_a, hide, wait); - - Free(filename_a); - Free(arg_a); - - return ret; - } - - UniStrCpy(name, sizeof(name), filename); - UniTrim(name); - - if (UniSearchStr(name, L"\"", 0) == INFINITE) - { - if (arg == NULL) - { - UniFormat(cmdline, sizeof(cmdline), L"%s", name); - } - else - { - UniFormat(cmdline, sizeof(cmdline), L"%s %s", name, arg); - } - } - else - { - if (arg == NULL) - { - UniFormat(cmdline, sizeof(cmdline), L"\"%s\"", name); - } - else - { - UniFormat(cmdline, sizeof(cmdline), L"\"%s\" %s", name, arg); - } - } - - Zero(&info, sizeof(info)); - Zero(&ret, sizeof(ret)); - info.cb = sizeof(info); - info.dwFlags = STARTF_USESHOWWINDOW; - info.wShowWindow = (hide == false ? SW_SHOWDEFAULT : SW_HIDE); - - UniTrim(cmdline); - - if (CreateProcessW(NULL, cmdline, NULL, NULL, FALSE, - (hide == false ? CREATE_NEW_CONSOLE : CREATE_NO_WINDOW | CREATE_NEW_CONSOLE) | NORMAL_PRIORITY_CLASS, - NULL, NULL, &info, &ret) == FALSE) - { - return false; - } - - if (wait) - { - WaitForSingleObject(ret.hProcess, INFINITE); - } - - CloseHandle(ret.hThread); - CloseHandle(ret.hProcess); - - return true; -} -bool Win32Run(char *filename, char *arg, bool hide, bool wait) -{ - STARTUPINFO info; - PROCESS_INFORMATION ret; - char cmdline[MAX_SIZE]; - char name[MAX_PATH]; - // Validate arguments - if (filename == NULL) - { - return false; - } - - StrCpy(name, sizeof(name), filename); - Trim(name); - - if (SearchStr(name, "\"", 0) == INFINITE) - { - if (arg == NULL) - { - Format(cmdline, sizeof(cmdline), "%s", name); - } - else - { - Format(cmdline, sizeof(cmdline), "%s %s", name, arg); - } - } - else - { - if (arg == NULL) - { - Format(cmdline, sizeof(cmdline), "\"%s\"", name); - } - else - { - Format(cmdline, sizeof(cmdline), "\"%s\" %s", name, arg); - } - } - - Zero(&info, sizeof(info)); - Zero(&ret, sizeof(ret)); - info.cb = sizeof(info); - info.dwFlags = STARTF_USESHOWWINDOW; - info.wShowWindow = (hide == false ? SW_SHOWDEFAULT : SW_HIDE); - - Trim(cmdline); - - if (CreateProcess(NULL, cmdline, NULL, NULL, FALSE, - (hide == false ? CREATE_NEW_CONSOLE : CREATE_NO_WINDOW | CREATE_NEW_CONSOLE) | NORMAL_PRIORITY_CLASS, - NULL, NULL, &info, &ret) == FALSE) - { - return false; - } - - if (wait) - { - WaitForSingleObject(ret.hProcess, INFINITE); - } - - CloseHandle(ret.hThread); - CloseHandle(ret.hProcess); - - return true; -} - -// Get the Thread ID -UINT Win32ThreadId() -{ - return GetCurrentThreadId(); -} - -// Rename the file -bool Win32FileRenameW(wchar_t *old_name, wchar_t *new_name) -{ - // Validate arguments - if (old_name == NULL || new_name == NULL) - { - return false; - } - - if (IsNt() == false) - { - char *old_name_a = CopyUniToStr(old_name); - char *new_name_a = CopyUniToStr(new_name); - bool ret = Win32FileRename(old_name_a, new_name_a); - - Free(old_name_a); - Free(new_name_a); - - return ret; - } - - // Rename - if (MoveFileW(old_name, new_name) == FALSE) - { - return false; - } - - return true; -} -bool Win32FileRename(char *old_name, char *new_name) -{ - // Validate arguments - if (old_name == NULL || new_name == NULL) - { - return false; - } - - // Rename - if (MoveFile(old_name, new_name) == FALSE) - { - return false; - } - - return true; -} - -// Getting the name of the directory where the EXE file is in -void Win32GetExeDirW(wchar_t *name, UINT size) -{ - wchar_t exe_path[MAX_SIZE]; - wchar_t exe_dir[MAX_SIZE]; - // Validate arguments - if (name == NULL) - { - return; - } - - if (IsNt() == false) - { - char name_a[MAX_PATH]; - - Win32GetExeDir(name_a, sizeof(name_a)); - - StrToUni(name, size, name_a); - - return; - } - - // Get the EXE file name - GetModuleFileNameW(NULL, exe_path, sizeof(exe_path)); - - // Get the directory name - Win32GetDirFromPathW(exe_dir, sizeof(exe_dir), exe_path); - - UniStrCpy(name, size, exe_dir); -} -void Win32GetExeDir(char *name, UINT size) -{ - char exe_path[MAX_SIZE]; - char exe_dir[MAX_SIZE]; - // Validate arguments - if (name == NULL) - { - return; - } - - // Get the EXE file name - GetModuleFileName(NULL, exe_path, sizeof(exe_path)); - - // Get the directory name - Win32GetDirFromPath(exe_dir, sizeof(exe_dir), exe_path); - - StrCpy(name, size, exe_dir); -} - -// Remove the '\' at the end -void Win32NukuEnW(wchar_t *dst, UINT size, wchar_t *src) -{ - wchar_t str[MAX_SIZE]; - int i; - if (src) - { - UniStrCpy(str, sizeof(str), src); - } - else - { - UniStrCpy(str, sizeof(str), dst); - } - i = UniStrLen(str); - if (str[i - 1] == L'\\') - { - str[i - 1] = 0; - } - UniStrCpy(dst, size, str); -} -void Win32NukuEn(char *dst, UINT size, char *src) -{ - char str[MAX_SIZE]; - int i; - if (src) - { - StrCpy(str, sizeof(str), src); - } - else - { - StrCpy(str, sizeof(str), dst); - } - i = StrLen(str); - if (str[i - 1] == '\\') - { - str[i - 1] = 0; - } - StrCpy(dst, size, str); -} - -// Get the directory name from path -void Win32GetDirFromPathW(wchar_t *dst, UINT size, wchar_t *src) -{ - wchar_t str[MAX_SIZE]; - int i,len; - wchar_t c; - wchar_t tmp[MAX_SIZE]; - int wp; - if (src) - { - UniStrCpy(str, sizeof(str), src); - } - else - { - UniStrCpy(str, sizeof(str), dst); - } - Win32NukuEnW(str, sizeof(str), NULL); - wp = 0; - len = UniStrLen(str); - dst[0] = 0; - for (i = 0;i < len;i++) - { - c = str[i]; - switch (c) - { - case L'\\': - tmp[wp] = 0; - wp = 0; - UniStrCat(dst, size, tmp); - UniStrCat(dst, size, L"\\"); - break; - default: - tmp[wp] = c; - wp++; - break; - } - } - Win32NukuEnW(dst, size, NULL); -} -void Win32GetDirFromPath(char *dst, UINT size, char *src) -{ - char str[MAX_SIZE]; - int i,len; - char c; - char tmp[MAX_SIZE]; - int wp; - if (src) - { - StrCpy(str, sizeof(str), src); - } - else - { - StrCpy(str, sizeof(str), dst); - } - Win32NukuEn(str, sizeof(str), NULL); - wp = 0; - len = StrLen(str); - dst[0] = 0; - for (i = 0;i < len;i++) - { - c = str[i]; - switch (c) - { - case '\\': - tmp[wp] = 0; - wp = 0; - StrCat(dst, size, tmp); - StrCat(dst, size, "\\"); - break; - default: - tmp[wp] = c; - wp++; - break; - } - } - Win32NukuEn(dst, size, NULL); -} - -// Delete the directory -bool Win32DeleteDirW(wchar_t *name) -{ - // Validate arguments - if (name == NULL) - { - return false; - } - - if (IsNt() == false) - { - char *name_a = CopyUniToStr(name); - bool ret = Win32DeleteDir(name_a); - - Free(name_a); - - return ret; - } - - if (RemoveDirectoryW(name) == FALSE) - { - return false; - } - return true; -} -bool Win32DeleteDir(char *name) -{ - // Validate arguments - if (name == NULL) - { - return false; - } - - if (RemoveDirectory(name) == FALSE) - { - return false; - } - return true; -} - -// Create a directory -bool Win32MakeDirW(wchar_t *name) -{ - // Validate arguments - if (name == NULL) - { - return false; - } - - if (IsNt() == false) - { - char *name_a = CopyUniToStr(name); - bool ret = Win32MakeDir(name_a); - - Free(name_a); - - return ret; - } - - if (CreateDirectoryW(name, NULL) == FALSE) - { - return false; - } - - return true; -} -bool Win32MakeDir(char *name) -{ - // Validate arguments - if (name == NULL) - { - return false; - } - - if (CreateDirectory(name, NULL) == FALSE) - { - return false; - } - - return true; -} - -// Delete the file -bool Win32FileDeleteW(wchar_t *name) -{ - // Validate arguments - if (name == NULL) - { - return false; - } - - if (IsNt() == false) - { - bool ret; - char *name_a = CopyUniToStr(name); - - ret = Win32FileDelete(name_a); - - Free(name_a); - - return ret; - } - - if (DeleteFileW(name) == FALSE) - { - return false; - } - return true; -} -bool Win32FileDelete(char *name) -{ - // Validate arguments - if (name == NULL) - { - return false; - } - - if (DeleteFile(name) == FALSE) - { - return false; - } - return true; -} - -// Seek in the file -bool Win32FileSeek(void *pData, UINT mode, int offset) -{ - WIN32IO *p; - DWORD ret; - // Validate arguments - if (pData == NULL) - { - return false; - } - if (mode != FILE_BEGIN && mode != FILE_END && mode != FILE_CURRENT) - { - return false; - } - - p = (WIN32IO *)pData; - ret = SetFilePointer(p->hFile, (LONG)offset, NULL, mode); - if (ret == INVALID_SET_FILE_POINTER || ret == ERROR_NEGATIVE_SEEK) - { - return false; - } - return true; -} - -// Get the file size -UINT64 Win32FileSize(void *pData) -{ - WIN32IO *p; - UINT64 ret; - DWORD tmp; - // Validate arguments - if (pData == NULL) - { - return 0; - } - - p = (WIN32IO *)pData; - tmp = 0; - ret = GetFileSize(p->hFile, &tmp); - if (ret == (DWORD)-1) - { - return 0; - } - - if (tmp != 0) - { - ret += (UINT64)tmp * 4294967296ULL; - } - - return ret; -} - -// Write to the file -bool Win32FileWrite(void *pData, void *buf, UINT size) -{ - WIN32IO *p; - DWORD write_size; - // Validate arguments - if (pData == NULL || buf == NULL || size == 0) - { - return false; - } - - p = (WIN32IO *)pData; - if (WriteFile(p->hFile, buf, size, &write_size, NULL) == FALSE) - { - return false; - } - - if (write_size != size) - { - return false; - } - - return true; -} - -// Read from a file -bool Win32FileRead(void *pData, void *buf, UINT size) -{ - WIN32IO *p; - DWORD read_size; - // Validate arguments - if (pData == NULL || buf == NULL || size == 0) - { - return false; - } - - p = (WIN32IO *)pData; - if (ReadFile(p->hFile, buf, size, &read_size, NULL) == FALSE) - { - return false; - } - - if (read_size != size) - { - return false; - } - - return true;; -} - -// Close the file -void Win32FileClose(void *pData, bool no_flush) -{ - WIN32IO *p; - // Validate arguments - if (pData == NULL) - { - return; - } - - p = (WIN32IO *)pData; - if (p->WriteMode && no_flush == false) - { - FlushFileBuffers(p->hFile); - } - CloseHandle(p->hFile); - p->hFile = NULL; - - // Memory release - Win32MemoryFree(p); -} - -// Get the date of the file -bool Win32FileGetDate(void *pData, UINT64 *created_time, UINT64 *updated_time, UINT64 *accessed_date) -{ - WIN32IO *p; - BY_HANDLE_FILE_INFORMATION info; - SYSTEMTIME st_create, st_update, st_access; - // Validate arguments - if (pData == NULL) - { - return false; - } - - p = (WIN32IO *)pData; - - Zero(&info, sizeof(info)); - - if (GetFileInformationByHandle(p->hFile, &info) == false) - { - return false; - } - - Zero(&st_create, sizeof(st_create)); - Zero(&st_update, sizeof(st_update)); - Zero(&st_access, sizeof(st_access)); - - FileTimeToSystemTime(&info.ftCreationTime, &st_create); - FileTimeToSystemTime(&info.ftLastWriteTime, &st_update); - FileTimeToSystemTime(&info.ftLastAccessTime, &st_access); - - if (created_time != NULL) - { - *created_time = SystemToUINT64(&st_create); - } - - if (updated_time != NULL) - { - *updated_time = SystemToUINT64(&st_update); - } - - if (accessed_date != NULL) - { - *accessed_date = SystemToUINT64(&st_access); - } - - return true; -} - -// Set the date of the file -bool Win32FileSetDate(void *pData, UINT64 created_time, UINT64 updated_time) -{ - WIN32IO *p; - SYSTEMTIME st_created_time, st_updated_time; - FILETIME ft_created_time, ft_updated_time; - FILETIME *p_created_time = NULL, *p_updated_time = NULL; - // Validate arguments - if (pData == NULL || (created_time == 0 && updated_time == 0)) - { - return false; - } - - p = (WIN32IO *)pData; - - Zero(&st_created_time, sizeof(st_created_time)); - Zero(&st_updated_time, sizeof(st_updated_time)); - - if (created_time != 0) - { - UINT64ToSystem(&st_created_time, created_time); - - SystemTimeToFileTime(&st_created_time, &ft_created_time); - - p_created_time = &ft_created_time; - } - - if (updated_time != 0) - { - UINT64ToSystem(&st_updated_time, updated_time); - - SystemTimeToFileTime(&st_updated_time, &ft_updated_time); - - p_updated_time = &ft_updated_time; - } - - return SetFileTime(p->hFile, p_created_time, NULL, p_updated_time); -} - -// Flush to the file -void Win32FileFlush(void *pData) -{ - WIN32IO *p; - // Validate arguments - if (pData == NULL) - { - return; - } - - p = (WIN32IO *)pData; - if (p->WriteMode) - { - FlushFileBuffers(p->hFile); - } -} - -// Open the file -void *Win32FileOpenW(wchar_t *name, bool write_mode, bool read_lock) -{ - WIN32IO *p; - HANDLE h; - DWORD lock_mode; - // Validate arguments - if (name == NULL) - { - return NULL; - } - - if (IsNt() == false) - { - void *ret; - char *name_a = CopyUniToStr(name); - - ret = Win32FileOpen(name_a, write_mode, read_lock); - - Free(name_a); - - return ret; - } - - if (write_mode) - { - lock_mode = FILE_SHARE_READ; - } - else - { - if (read_lock == false) - { - lock_mode = FILE_SHARE_READ | FILE_SHARE_WRITE; - } - else - { - lock_mode = FILE_SHARE_READ; - } - } - - // Open the file - h = CreateFileW(name, - (write_mode ? GENERIC_READ | GENERIC_WRITE : GENERIC_READ), - lock_mode, - NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); - if (h == INVALID_HANDLE_VALUE) - { - UINT ret = GetLastError(); - // Failure - return NULL; - } - - // Memory allocation - p = Win32MemoryAlloc(sizeof(WIN32IO)); - // Store Handle - p->hFile = h; - - p->WriteMode = write_mode; - - return (void *)p; -} -void *Win32FileOpen(char *name, bool write_mode, bool read_lock) -{ - WIN32IO *p; - HANDLE h; - DWORD lock_mode; - // Validate arguments - if (name == NULL) - { - return NULL; - } - - if (write_mode) - { - lock_mode = FILE_SHARE_READ; - } - else - { - if (read_lock == false) - { - lock_mode = FILE_SHARE_READ | FILE_SHARE_WRITE; - } - else - { - lock_mode = FILE_SHARE_READ; - } - } - - // Open the file - h = CreateFile(name, - (write_mode ? GENERIC_READ | GENERIC_WRITE : GENERIC_READ), - lock_mode, - NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); - if (h == INVALID_HANDLE_VALUE) - { - UINT ret = GetLastError(); - // Failure - return NULL; - } - - // Memory allocation - p = Win32MemoryAlloc(sizeof(WIN32IO)); - // Store Handle - p->hFile = h; - - p->WriteMode = write_mode; - - return (void *)p; -} - -// Create a file -void *Win32FileCreateW(wchar_t *name) -{ - WIN32IO *p; - HANDLE h; - // Validate arguments - if (name == NULL) - { - return NULL; - } - - if (IsNt() == false) - { - void *ret; - char *name_a = CopyUniToStr(name); - - ret = Win32FileCreate(name_a); - - Free(name_a); - - return ret; - } - - // Create a file - h = CreateFileW(name, GENERIC_READ | GENERIC_WRITE, - FILE_SHARE_READ, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, - NULL); - if (h == INVALID_HANDLE_VALUE) - { - h = CreateFileW(name, GENERIC_READ | GENERIC_WRITE, - FILE_SHARE_READ, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_HIDDEN, - NULL); - if (h == INVALID_HANDLE_VALUE) - { - return NULL; - } - } - - // Memory allocation - p = Win32MemoryAlloc(sizeof(WIN32IO)); - // Store Handle - p->hFile = h; - - p->WriteMode = true; - - return (void *)p; -} -void *Win32FileCreate(char *name) -{ - WIN32IO *p; - HANDLE h; - // Validate arguments - if (name == NULL) - { - return NULL; - } - - // Create a file - h = CreateFile(name, GENERIC_READ | GENERIC_WRITE, - FILE_SHARE_READ, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, - NULL); - if (h == INVALID_HANDLE_VALUE) - { - h = CreateFile(name, GENERIC_READ | GENERIC_WRITE, - FILE_SHARE_READ, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_HIDDEN, - NULL); - if (h == INVALID_HANDLE_VALUE) - { - return NULL; - } - } - - // Memory allocation - p = Win32MemoryAlloc(sizeof(WIN32IO)); - // Store Handle - p->hFile = h; - - p->WriteMode = true; - - return (void *)p; -} - -#define SIZE_OF_CALLSTACK_SYM 10000 -#define CALLSTACK_DEPTH 12 - -// Get the call stack -CALLSTACK_DATA *Win32GetCallStack() -{ -#ifndef WIN32_NO_DEBUG_HELP_DLL - DWORD current_eip32 = 0, current_esp32 = 0, current_ebp32 = 0; - UINT64 current_eip = 0, current_esp = 0, current_ebp = 0; - STACKFRAME64 sf; - CALLSTACK_DATA *cs = NULL, *s; - -#ifdef CPU_64 - CONTEXT context; -#endif // CPU_64 - - bool ret; - UINT depth = 0; - -#ifndef CPU_64 - // Register acquisition (32 bit) - __asm - { - mov current_esp32, esp - mov current_ebp32, ebp - }; - - current_eip32 = (DWORD)Win32GetCallStack; - - current_eip = (UINT64)current_eip32; - current_esp = (UINT64)current_esp32; - current_ebp = (UINT64)current_ebp32; -#else // CPU_64 - // Register acquisition (64 bit) - Zero(&context, sizeof(context)); - context.ContextFlags = CONTEXT_FULL; - RtlCaptureContext(&context); -#endif // CPU_64 - - Zero(&sf, sizeof(sf)); - -#ifndef CPU_64 - sf.AddrPC.Offset = current_eip; - sf.AddrStack.Offset = current_esp; - sf.AddrFrame.Offset = current_ebp; -#else // CPU_64 - sf.AddrPC.Offset = context.Rip; - sf.AddrStack.Offset = context.Rsp; - sf.AddrFrame.Offset = context.Rsp; -#endif // CPU_64 - - sf.AddrPC.Mode = AddrModeFlat; - sf.AddrStack.Mode = AddrModeFlat; - sf.AddrFrame.Mode = AddrModeFlat; - - while (true) - { - DWORD type = IMAGE_FILE_MACHINE_I386; - -#ifdef CPU_64 - type = IMAGE_FILE_MACHINE_AMD64; -#endif // CPU_64 - - if ((depth++) >= CALLSTACK_DEPTH) - { - break; - } - -#ifndef CPU_64 - ret = StackWalk64(type, - hCurrentProcessHandle, - GetCurrentThread(), - &sf, - NULL, NULL, SymFunctionTableAccess64, SymGetModuleBase64, NULL); -#else // CPU_64 - ret = StackWalk64(type, - hCurrentProcessHandle, - GetCurrentThread(), - &sf, - &context, NULL, SymFunctionTableAccess64, SymGetModuleBase64, NULL); -#endif // CPU_64 - if (ret == false || sf.AddrFrame.Offset == 0) - { - break; - } - - if (cs == NULL) - { - cs = OSMemoryAlloc(sizeof(CALLSTACK_DATA)); - s = cs; - } - else - { - s->next = OSMemoryAlloc(sizeof(CALLSTACK_DATA)); - s = s->next; - } - s->symbol_cache = false; - s->next = NULL; - s->offset = sf.AddrPC.Offset; - s->disp = 0; - s->name = NULL; - s->line = 0; - s->filename[0] = 0; - } - - return cs; -#else // WIN32_NO_DEBUG_HELP_DLL - return NULL; -#endif // WIN32_NO_DEBUG_HELP_DLL -} - -// Get the symbol information from the call stack -bool Win32GetCallStackSymbolInfo(CALLSTACK_DATA *s) -{ -#ifdef WIN32_NO_DEBUG_HELP_DLL - return false; -#else // WIN32_NO_DEBUG_HELP_DLL - UINT64 disp; - UINT disp32, len; - IMAGEHLP_SYMBOL64 *sym; - IMAGEHLP_LINE64 line; - char tmp[MAX_PATH]; - // Validate arguments - if (s == NULL) - { - return false; - } - - if (s->symbol_cache) - { - return true; - } - - sym = OSMemoryAlloc(SIZE_OF_CALLSTACK_SYM); - sym->SizeOfStruct = SIZE_OF_CALLSTACK_SYM; - sym->MaxNameLength = SIZE_OF_CALLSTACK_SYM - sizeof(IMAGEHLP_SYMBOL64); - - if (SymGetSymFromAddr64(hCurrentProcessHandle, s->offset, &disp, sym)) - { - s->disp = disp; - s->name = OSMemoryAlloc((UINT)strlen(sym->Name) + 1); - lstrcpy(s->name, sym->Name); - } - else - { - s->disp = 0; - s->name = NULL; - } - - Zero(&line, sizeof(line)); - line.SizeOfStruct = sizeof(line); - if (SymGetLineFromAddr64(hCurrentProcessHandle, s->offset, &disp32, &line)) - { - disp = (UINT64)disp32; - s->line = line.LineNumber; - lstrcpy(s->filename, line.FileName); - Win32GetDirFromPath(tmp, sizeof(tmp), s->filename); - len = lstrlen(tmp); - lstrcpy(tmp, &s->filename[len + 1]); - lstrcpy(s->filename, tmp); - } - else - { - s->line = 0; - s->filename[0] = 0; - } - - OSMemoryFree(sym); - - s->symbol_cache = true; - - return true; -#endif // WIN32_NO_DEBUG_HELP_DLL -} - -// Default Win32 thread -DWORD CALLBACK Win32DefaultThreadProc(void *param) -{ - WIN32THREADSTARTUPINFO *info = (WIN32THREADSTARTUPINFO *)param; - // Validate arguments - if (info == NULL) - { - return 0; - } - - Win32InitNewThread(); - - CoInitialize(NULL); - - // Call the thread function - info->thread_proc(info->thread, info->param); - - // Release the reference - ReleaseThread(info->thread); - - Win32MemoryFree(info); - - FreeOpenSSLThreadState(); - - CoUninitialize(); - - _endthreadex(0); - return 0; -} - -// Wait for the termination of the thread -bool Win32WaitThread(THREAD *t) -{ - WIN32THREAD *w; - // Validate arguments - if (t == NULL) - { - return false; - } - w = (WIN32THREAD *)t->pData; - if (w == NULL) - { - return false; - } - - // Wait for the thread event - if (WaitForSingleObject(w->hThread, INFINITE) == WAIT_OBJECT_0) - { - // The thread was signaled - return true; - } - - // Wait failure (time-out, etc.) - return false; -} - -// Release the thread -void Win32FreeThread(THREAD *t) -{ - WIN32THREAD *w; - // Validate arguments - if (t == NULL) - { - return; - } - w = (WIN32THREAD *)t->pData; - if (w == NULL) - { - return; - } - - // Close the handle - CloseHandle(w->hThread); - - // Memory release - Win32MemoryFree(t->pData); - t->pData = NULL; -} - -// Thread initialization -bool Win32InitThread(THREAD *t) -{ - WIN32THREAD *w; - HANDLE hThread; - DWORD thread_id; - WIN32THREADSTARTUPINFO *info; - // Validate arguments - if (t == NULL) - { - return false; - } - if (t->thread_proc == NULL) - { - return false; - } - - // Thread data generation - w = Win32MemoryAlloc(sizeof(WIN32THREAD)); - - // Creating the startup information - info = Win32MemoryAlloc(sizeof(WIN32THREADSTARTUPINFO)); - info->param = t->param; - info->thread_proc = t->thread_proc; - info->thread = t; - AddRef(t->ref); - - // Thread creation - t->pData = w; - hThread = (HANDLE)_beginthreadex(NULL, 0, Win32DefaultThreadProc, info, 0, &thread_id); - if (hThread == NULL) - { - // Thread creation failure - t->pData = NULL; - Release(t->ref); - Win32MemoryFree(info); - Win32MemoryFree(w); - return false; - } - - // Save the thread information - w->hThread = hThread; - w->thread_id = thread_id; - - return true; -} - -// Initialize the library for Win32 -void Win32Init() -{ - INITCOMMONCONTROLSEX c; - OSVERSIONINFO os; - - // Get whether it's in a Windows NT - Zero(&os, sizeof(os)); - os.dwOSVersionInfoSize = sizeof(os); - GetVersionEx(&os); - - if (os.dwPlatformId == VER_PLATFORM_WIN32_NT) - { - // NT system - win32_is_nt = true; - } - else - { - // 9x system - win32_is_nt = false; - } - - // Open the stdout - if (hstdout == INVALID_HANDLE_VALUE) - { - hstdout = GetStdHandle(STD_OUTPUT_HANDLE); - } - - // Open the stdin - if (hstdin == INVALID_HANDLE_VALUE) - { - hstdin = GetStdHandle(STD_INPUT_HANDLE); - } - - Win32InitNewThread(); - - CoInitialize(NULL); - - InitializeCriticalSection(&fasttick_lock); - -#ifdef WIN32_USE_HEAP_API_FOR_MEMORY - use_heap_api = true; -#else // WIN32_USE_HEAP_API_FOR_MEMORY - use_heap_api = false; -#endif // WIN32_USE_HEAP_API_FOR_MEMORY - - if (MayaquaIsDotNetMode()) - { - // If an heap API is called from .NET API, it might crush - use_heap_api = false; - } - - if (IsNt() == false) - { - // Do not use the heap related API in Win9x - use_heap_api = false; - } - - if (use_heap_api) - { - heap_handle = HeapCreate(0, 0, 0); - } - - // Get the process pseudo handle - hCurrentProcessHandle = GetCurrentProcess(); - - // Initialization of the current directory - // Win32InitCurrentDir(); /* Don't do */ - - // Initialization of the symbol handler - if (IsMemCheck()) - { -#ifndef WIN32_NO_DEBUG_HELP_DLL - SymInitialize(hCurrentProcessHandle, NULL, TRUE); -#endif // WIN32_NO_DEBUG_HELP_DLL - } - - // Initialization of the Common Control - Zero(&c, sizeof(INITCOMMONCONTROLSEX)); - c.dwSize = sizeof(INITCOMMONCONTROLSEX); - c.dwICC = ICC_ANIMATE_CLASS | ICC_BAR_CLASSES | ICC_COOL_CLASSES | - ICC_DATE_CLASSES | ICC_HOTKEY_CLASS | ICC_INTERNET_CLASSES | - ICC_LISTVIEW_CLASSES | ICC_NATIVEFNTCTL_CLASS | - ICC_PAGESCROLLER_CLASS | ICC_PROGRESS_CLASS | - ICC_TAB_CLASSES | ICC_TREEVIEW_CLASSES | ICC_UPDOWN_CLASS | ICC_USEREX_CLASSES | - ICC_WIN95_CLASSES; - InitCommonControlsEx(&c); -} - -// Release the library for Win32 -void Win32Free() -{ - // Close the symbol handler - if (IsMemCheck()) - { -#ifndef WIN32_NO_DEBUG_HELP_DLL - SymCleanup(hCurrentProcessHandle); -#endif // WIN32_NO_DEBUG_HELP_DLL - } - - if (use_heap_api) - { - HeapDestroy(heap_handle); - heap_handle = NULL; - } - - CoUninitialize(); - - DeleteCriticalSection(&fasttick_lock); -} - -// Memory allocation -void *Win32MemoryAlloc(UINT size) -{ - if (use_heap_api) - { - return HeapAlloc(heap_handle, 0, size); - } - else - { - return malloc(size); - } -} - -// Memory reallocation -void *Win32MemoryReAlloc(void *addr, UINT size) -{ - if (use_heap_api) - { - return HeapReAlloc(heap_handle, 0, addr, size); - } - else - { - return realloc(addr, size); - } -} - -// Memory allocation -void Win32MemoryFree(void *addr) -{ - if (use_heap_api) - { - HeapFree(heap_handle, 0, addr); - } - else - { - free(addr); - } -} - -// Get the system timer -UINT Win32GetTick() -{ - return (UINT)timeGetTime(); -} - -// Get the System Time -void Win32GetSystemTime(SYSTEMTIME *system_time) -{ - // Get the System Time - GetSystemTime(system_time); -} - -// Increment of 32bit integer -void Win32Inc32(UINT *value) -{ - InterlockedIncrement(value); -} - -// Decrement of 32bit integer -void Win32Dec32(UINT *value) -{ - InterlockedDecrement(value); -} - -// Sleep the thread -void Win32Sleep(UINT time) -{ - Sleep(time); -} - -// Creating a lock -LOCK *Win32NewLock() -{ - // Memory allocation - LOCK *lock = Win32MemoryAlloc(sizeof(LOCK)); - - // Allocate a critical section - CRITICAL_SECTION *critical_section = Win32MemoryAlloc(sizeof(CRITICAL_SECTION)); - - if (lock == NULL || critical_section == NULL) - { - Win32MemoryFree(lock); - Win32MemoryFree(critical_section); - return NULL; - } - - // Initialize the critical section - InitializeCriticalSection(critical_section); - - lock->pData = (void *)critical_section; - lock->Ready = true; - - return lock; -} - -// Lock -bool Win32Lock(LOCK *lock) -{ - CRITICAL_SECTION *critical_section; - if (lock->Ready == false) - { - // State is invalid - return false; - } - - // Enter the critical section - critical_section = (CRITICAL_SECTION *)lock->pData; - EnterCriticalSection(critical_section); - - return true; -} - -// Unlock -void Win32Unlock(LOCK *lock) -{ - Win32UnlockEx(lock, false); -} -void Win32UnlockEx(LOCK *lock, bool inner) -{ - CRITICAL_SECTION *critical_section; - if (lock->Ready == false && inner == false) - { - // State is invalid - return; - } - - // Leave the critical section - critical_section = (CRITICAL_SECTION *)lock->pData; - LeaveCriticalSection(critical_section); -} - -// Delete the lock -void Win32DeleteLock(LOCK *lock) -{ - CRITICAL_SECTION *critical_section; - // Reset the Ready flag safely - Win32Lock(lock); - lock->Ready = false; - Win32UnlockEx(lock, true); - - // Delete the critical section - critical_section = (CRITICAL_SECTION *)lock->pData; - DeleteCriticalSection(critical_section); - - // Memory release - Win32MemoryFree(critical_section); - Win32MemoryFree(lock); -} - -// Initialization of the event -void Win32InitEvent(EVENT *event) -{ - // Creating an auto-reset event - HANDLE hEvent = CreateEvent(NULL, FALSE, FALSE, NULL); - - event->pData = hEvent; -} - -// Set the event -void Win32SetEvent(EVENT *event) -{ - HANDLE hEvent = (HANDLE)event->pData; - if (hEvent == NULL) - { - return; - } - - SetEvent(hEvent); -} - -// Reset the event -void Win32ResetEvent(EVENT *event) -{ - HANDLE hEvent = (HANDLE)event->pData; - if (hEvent == NULL) - { - return; - } - - ResetEvent(hEvent); -} - -// Wait for the event -bool Win32WaitEvent(EVENT *event, UINT timeout) -{ - HANDLE hEvent = (HANDLE)event->pData; - UINT ret; - if (hEvent == NULL) - { - return false; - } - - // Wait for an object - ret = WaitForSingleObject(hEvent, timeout); - if (ret == WAIT_TIMEOUT) - { - // Time-out - return false; - } - else - { - // Signaled state - return true; - } -} - -// Release of the event -void Win32FreeEvent(EVENT *event) -{ - HANDLE hEvent = (HANDLE)event->pData; - if (hEvent == NULL) - { - return; - } - - CloseHandle(hEvent); -} - -// Fast getting 64 bit Tick functions for only Win32 -UINT64 Win32FastTick64() -{ - static UINT last_tick = 0; - static UINT counter = 0; - UINT64 ret; - UINT tick; - - EnterCriticalSection(&fasttick_lock); - - // Get the current tick value - tick = Win32GetTick(); - - if (last_tick > tick) - { - // When the previously acquired tick value is larger than acquired this time, - // it can be considered that the counter have gone one around - - counter++; - } - - last_tick = tick; - - ret = (UINT64)tick + (UINT64)counter * 4294967296ULL; - - LeaveCriticalSection(&fasttick_lock); - - if (start_tick == 0) - { - start_tick = ret; - ret = 0; - } - else - { - ret -= start_tick; - } - - return ret + 1; -} - -// Read a string from the console -bool Win32InputW(wchar_t *str, UINT size) -{ - bool ret = false; - // Validate arguments - if (str == NULL) - { - return false; - } - if (size == 0) - { - size = 0x7fffffff; - } - - if (str == NULL || size <= sizeof(wchar_t)) - { - if (str != NULL) - { - Zero(str, size); - } - - return Win32InputFromFileW(NULL, 0); - } - - if (IsNt()) - { - DWORD read_size = 0; - - if (ReadConsoleW(hstdin, str, (size / sizeof(wchar_t)) - 1, &read_size, NULL)) - { - str[read_size] = 0; - - UniTrimCrlf(str); - - ret = true; - } - else - { - ret = Win32InputFromFileW(str, size); - } - } - else - { - DWORD read_size = 0; - UINT a_size = size / sizeof(wchar_t) + 16; - char *a; - - a = ZeroMalloc(a_size); - - if (ReadConsoleA(hstdin, a, a_size - 1, &read_size, NULL)) - { - a[read_size] = 0; - - StrToUni(str, size, a); - - UniTrimCrlf(str); - - ret = true; - } - else - { - ret = Win32InputFromFileW(str, size); - } - - Free(a); - } - - return ret; -} -// Get a line from standard input -bool Win32InputFromFileW(wchar_t *str, UINT size) -{ - char *a; - if (str == NULL) - { - wchar_t tmp[MAX_SIZE]; - Win32InputFromFileW(tmp, sizeof(tmp)); - return false; - } - - a = Win32InputFromFileLineA(); - if (a == NULL) - { - UniStrCpy(str, size, L""); - return false; - } - - UtfToUni(str, size, a); - - UniTrimCrlf(str); - - Free(a); - - return true; -} -char *Win32InputFromFileLineA() -{ - BUF *b = NewBuf(); - char zero = 0; - char *ret = NULL; - bool ok = true; - - while (true) - { - char c; - UINT read_size = 0; - - if (ReadFile(hstdin, &c, 1, &read_size, NULL) == false) - { - ok = false; - break; - } - if (read_size != 1) - { - ok = false; - break; - } - - WriteBuf(b, &c, 1); - - if (c == 10) - { - break; - } - } - - WriteBuf(b, &zero, 1); - - if (ok) - { - ret = CopyStr(b->Buf); - } - - FreeBuf(b); - - return ret; -} - -// Print the string to the console -void Win32PrintW(wchar_t *str) -{ - DWORD write_size = 0; - // Validate arguments - if (str == NULL) - { - return; - } - - if (IsNt()) - { - if (WriteConsoleW(hstdout, str, UniStrLen(str), &write_size, NULL) == false) - { - Win32PrintToFileW(str); - } - } - else - { - char *ansi_str = CopyUniToStr(str); - - if (WriteConsoleA(hstdout, ansi_str, StrLen(ansi_str), &write_size, NULL) == false) - { - Win32PrintToFileW(str); - } - - Free(ansi_str); - } -} -void Win32PrintToFileW(wchar_t *str) -{ - char *utf; - DWORD size = 0; - // Validate arguments - if (str == NULL) - { - return; - } - - utf = CopyUniToUtf(str); - - WriteFile(hstdout, utf, StrLen(utf), &size, NULL); - - Free(utf); -} - - -#endif // WIN32 - - +// SoftEther VPN Source Code - Developer Edition Master Branch +// Mayaqua Kernel + + +// Win32.c +// Microsoft Windows dependent code + +#include + +#ifdef WIN32 + +#define _WIN32_WINNT 0x0502 +#define WINVER 0x0502 +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +static HANDLE heap_handle = NULL; +static HANDLE hstdout = INVALID_HANDLE_VALUE; +static HANDLE hstdin = INVALID_HANDLE_VALUE; + +// Thread data for Win32 +typedef struct WIN32THREAD +{ + HANDLE hThread; + DWORD thread_id; +} WIN32THREAD; + +// Thread startup information for Win32 +typedef struct WIN32THREADSTARTUPINFO +{ + THREAD_PROC *thread_proc; + void *param; + THREAD *thread; +} WIN32THREADSTARTUPINFO; + +// Function prototype for Win32 +DWORD CALLBACK Win32DefaultThreadProc(void *param); + +// Current process handle +static HANDLE hCurrentProcessHandle = NULL; +static CRITICAL_SECTION fasttick_lock; +static UINT64 start_tick = 0; +static bool use_heap_api = false; +static bool win32_is_nt = false; + +// File I/O data for Win32 +typedef struct WIN32IO +{ + HANDLE hFile; + bool WriteMode; +} WIN32IO; + +// Mutex data for Win32 +typedef struct WIN32MUTEX +{ + HANDLE hMutex; +} WIN32MUTEX; + +// Set the Thread name +#pragma pack(push,8) +typedef struct tagTHREADNAME_INFO +{ + DWORD dwType; // Must be 0x1000. + LPCSTR szName; // Pointer to name (in user addr space). + DWORD dwThreadID; // Thread ID (-1=caller thread). + DWORD dwFlags; // Reserved for future use, must be zero. +} THREADNAME_INFO; +#pragma pack(pop) + +// Create a dispatch table +OS_DISPATCH_TABLE *Win32GetDispatchTable() +{ + static OS_DISPATCH_TABLE t = + { + Win32Init, + Win32Free, + Win32MemoryAlloc, + Win32MemoryReAlloc, + Win32MemoryFree, + Win32GetTick, + Win32GetSystemTime, + Win32Inc32, + Win32Dec32, + Win32Sleep, + Win32NewLock, + Win32Lock, + Win32Unlock, + Win32DeleteLock, + Win32InitEvent, + Win32SetEvent, + Win32ResetEvent, + Win32WaitEvent, + Win32FreeEvent, + Win32WaitThread, + Win32FreeThread, + Win32InitThread, + Win32ThreadId, + Win32FileOpen, + Win32FileOpenW, + Win32FileCreate, + Win32FileCreateW, + Win32FileWrite, + Win32FileRead, + Win32FileClose, + Win32FileFlush, + Win32FileSize, + Win32FileSeek, + Win32FileDelete, + Win32FileDeleteW, + Win32MakeDir, + Win32MakeDirW, + Win32DeleteDir, + Win32DeleteDirW, + Win32GetCallStack, + Win32GetCallStackSymbolInfo, + Win32FileRename, + Win32FileRenameW, + Win32Run, + Win32RunW, + Win32IsSupportedOs, + Win32GetOsInfo, + Win32Alert, + Win32AlertW, + Win32GetProductId, + Win32SetHighPriority, + Win32RestorePriority, + Win32NewSingleInstance, + Win32FreeSingleInstance, + Win32GetMemInfo, + Win32Yield, + }; + + return &t; +} + +// Set the thread name +void Win32SetThreadName(UINT thread_id, char *name) +{ + DWORD ms_vc_exception = 0x406D1388; + THREADNAME_INFO t; + // Validate arguments + if (thread_id == 0 || name == NULL) + { + return; + } + + Zero(&t, sizeof(t)); + t.dwType = 0x1000; + t.szName = name; + t.dwThreadID = thread_id; + t.dwFlags = 0; + + __try + { + RaiseException(ms_vc_exception, 0, sizeof(t) / sizeof(ULONG_PTR), (ULONG_PTR *)&t); + } + __except (EXCEPTION_EXECUTE_HANDLER) + { + } +} + +// Initialization function of the new thread +void Win32InitNewThread() +{ + static HINSTANCE hDll = NULL; + static bool (WINAPI *_SetThreadLocale)(LCID) = NULL; + + if (hDll == NULL) + { + hDll = LoadLibrary("kernel32.dll"); + + _SetThreadLocale = + (bool (__stdcall *)(LCID)) + GetProcAddress(hDll, "SetThreadLocale"); + } + + if (_SetThreadLocale != NULL) + { + _SetThreadLocale(LOCALE_USER_DEFAULT); + } +} + +// Set the compression flag of the folder +bool Win32SetFolderCompressW(wchar_t *path, bool compressed) +{ + HANDLE h; + UINT retsize = 0; + USHORT flag; + wchar_t tmp[MAX_PATH]; + // Validate arguments + if (path == NULL) + { + return false; + } + + if (IsNt() == false) + { + char *path_a = CopyUniToStr(path); + bool ret = Win32SetFolderCompress(path_a, compressed); + + Free(path_a); + + return ret; + } + + InnerFilePathW(tmp, sizeof(tmp), path); + + // Open the folder + h = CreateFileW(tmp, GENERIC_READ | GENERIC_WRITE, FILE_SHARE_READ | FILE_SHARE_WRITE, NULL, OPEN_EXISTING, FILE_FLAG_BACKUP_SEMANTICS, NULL); + + if (h == INVALID_HANDLE_VALUE) + { + return false; + } + + flag = compressed ? COMPRESSION_FORMAT_DEFAULT : COMPRESSION_FORMAT_NONE; + + if (DeviceIoControl(h, FSCTL_SET_COMPRESSION, &flag, sizeof(USHORT), + NULL, 0, &retsize, NULL) == false) + { + return false; + } + + CloseHandle(h); + + return true; +} +bool Win32SetFolderCompress(char *path, bool compressed) +{ + HANDLE h; + UINT retsize = 0; + USHORT flag; + char tmp[MAX_PATH]; + // Validate arguments + if (path == NULL) + { + return false; + } + + InnerFilePath(tmp, sizeof(tmp), path); + + // Open the folder + h = CreateFile(tmp, GENERIC_READ | GENERIC_WRITE, FILE_SHARE_READ | FILE_SHARE_WRITE, NULL, OPEN_EXISTING, FILE_FLAG_BACKUP_SEMANTICS, NULL); + + if (h == INVALID_HANDLE_VALUE) + { + return false; + } + + flag = compressed ? COMPRESSION_FORMAT_DEFAULT : COMPRESSION_FORMAT_NONE; + + if (DeviceIoControl(h, FSCTL_SET_COMPRESSION, &flag, sizeof(USHORT), + NULL, 0, &retsize, NULL) == false) + { + return false; + } + + CloseHandle(h); + + return true; +} + +// Get the free space of the disk +bool Win32GetDiskFreeW(wchar_t *path, UINT64 *free_size, UINT64 *used_size, UINT64 *total_size) +{ + wchar_t tmp[MAX_SIZE]; + UINT count = 0; + UINT i, n, len; + ULARGE_INTEGER v1, v2, v3; + bool ret = false; + // Validate arguments + if (path == NULL) + { + return false; + } + + if (IsNt() == false) + { + bool ret; + char *path_a = CopyUniToStr(path); + + ret = Win32GetDiskFree(path_a, free_size, used_size, total_size); + + Free(path_a); + + return ret; + } + + Zero(&v1, sizeof(v1)); + Zero(&v2, sizeof(v2)); + Zero(&v3, sizeof(v3)); + + NormalizePathW(tmp, sizeof(tmp), path); + + // Get the directory name + if (UniStartWith(path, L"\\\\")) + { + count = 4; + } + else + { + count = 1; + } + + len = UniStrLen(tmp); + n = 0; + for (i = 0;i < len;i++) + { + if (tmp[i] == L'\\') + { + n++; + if (n >= count) + { + tmp[i + 1] = 0; + break; + } + } + } + + if (GetDiskFreeSpaceExW(tmp, &v1, &v2, &v3)) + { + ret = true; + } + + if (free_size != NULL) + { + *free_size = v1.QuadPart; + } + + if (total_size != NULL) + { + *total_size = v2.QuadPart; + } + + if (used_size != NULL) + { + *used_size = v2.QuadPart - v1.QuadPart; + } + + return ret; +} +bool Win32GetDiskFree(char *path, UINT64 *free_size, UINT64 *used_size, UINT64 *total_size) +{ + char tmp[MAX_SIZE]; + UINT count = 0; + UINT i, n, len; + ULARGE_INTEGER v1, v2, v3; + bool ret = false; + // Validate arguments + if (path == NULL) + { + return false; + } + + Zero(&v1, sizeof(v1)); + Zero(&v2, sizeof(v2)); + Zero(&v3, sizeof(v3)); + + NormalizePath(tmp, sizeof(tmp), path); + + // Get the directory name + if (StartWith(path, "\\\\")) + { + count = 4; + } + else + { + count = 1; + } + + len = StrLen(tmp); + n = 0; + for (i = 0;i < len;i++) + { + if (tmp[i] == '\\') + { + n++; + if (n >= count) + { + tmp[i + 1] = 0; + break; + } + } + } + + if (GetDiskFreeSpaceEx(tmp, &v1, &v2, &v3)) + { + ret = true; + } + + if (free_size != NULL) + { + *free_size = v1.QuadPart; + } + + if (total_size != NULL) + { + *total_size = v2.QuadPart; + } + + if (used_size != NULL) + { + *used_size = v2.QuadPart - v1.QuadPart; + } + + return ret; +} + +// Enumeration of directory +DIRLIST *Win32EnumDirEx(char *dirname, COMPARE *compare) +{ + DIRLIST *ret; + wchar_t *dirname_w = CopyStrToUni(dirname); + + ret = Win32EnumDirExW(dirname_w, compare); + + Free(dirname_w); + + return ret; +} +DIRLIST *Win32EnumDirExW(wchar_t *dirname, COMPARE *compare) +{ + WIN32_FIND_DATAA data_a; + WIN32_FIND_DATAW data_w; + HANDLE h; + wchar_t tmp[MAX_PATH]; + wchar_t tmp2[MAX_PATH]; + wchar_t dirname2[MAX_PATH]; + LIST *o; + DIRLIST *d; + + UniStrCpy(tmp2, sizeof(tmp2), dirname); + + if (UniStrLen(tmp2) >= 1 && tmp2[UniStrLen(tmp2) - 1] == L'\\') + { + tmp2[UniStrLen(tmp2) - 1] = 0; + } + + UniFormat(tmp, sizeof(tmp), L"%s\\*.*", tmp2); + NormalizePathW(tmp, sizeof(tmp), tmp); + NormalizePathW(dirname2, sizeof(dirname2), tmp2); + + o = NewListFast(compare); + + Zero(&data_a, sizeof(data_a)); + Zero(&data_w, sizeof(data_w)); + + if (IsNt()) + { + h = FindFirstFileW(tmp, &data_w); + } + else + { + char *tmp_a = CopyUniToStr(tmp); + + h = FindFirstFileA(tmp_a, &data_a); + + Free(tmp_a); + } + + if (h != INVALID_HANDLE_VALUE) + { + bool b = true; + + do + { + if (IsNt() == false) + { + Zero(&data_w, sizeof(data_w)); + StrToUni(data_w.cFileName, sizeof(data_w.cFileName), data_a.cFileName); + data_w.dwFileAttributes = data_a.dwFileAttributes; + data_w.ftCreationTime = data_a.ftCreationTime; + data_w.ftLastWriteTime = data_a.ftLastWriteTime; + data_w.nFileSizeHigh = data_a.nFileSizeHigh; + data_w.nFileSizeLow = data_a.nFileSizeLow; + } + + if (UniStrCmpi(data_w.cFileName, L"..") != 0 && + UniStrCmpi(data_w.cFileName, L".") != 0) + { + DIRENT *f = ZeroMalloc(sizeof(DIRENT)); + SYSTEMTIME t1, t2; + wchar_t fullpath[MAX_SIZE]; + bool ok = false; + + f->FileNameW = UniCopyStr(data_w.cFileName); + f->FileName = CopyUniToStr(f->FileNameW); + f->Folder = (data_w.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) ? true : false; + + CombinePathW(fullpath, sizeof(fullpath), dirname2, f->FileNameW); + + // Attempt to get the file information + if (MsIsNt()) + { + HANDLE h = CreateFileW(fullpath, 0, + FILE_SHARE_DELETE | FILE_SHARE_READ | FILE_SHARE_WRITE, + NULL, OPEN_EXISTING, 0, NULL); + + if (h != INVALID_HANDLE_VALUE) + { + BY_HANDLE_FILE_INFORMATION info; + + Zero(&info, sizeof(info)); + + if (MsGetFileInformation(h, &info)) + { + Zero(&t1, sizeof(t1)); + Zero(&t2, sizeof(t2)); + FileTimeToSystemTime(&info.ftCreationTime, &t1); + FileTimeToSystemTime(&info.ftLastWriteTime, &t2); + f->CreateDate = SystemToUINT64(&t1); + f->UpdateDate = SystemToUINT64(&t2); + + if (f->Folder == false) + { + f->FileSize = ((UINT64)info.nFileSizeHigh * (UINT64)((UINT64)MAXDWORD + (UINT64)1)) + (UINT64)info.nFileSizeLow; + } + + ok = true; + } + + CloseHandle(h); + } + } + + if (ok == false) + { + Zero(&t1, sizeof(t1)); + Zero(&t2, sizeof(t2)); + FileTimeToSystemTime(&data_w.ftCreationTime, &t1); + FileTimeToSystemTime(&data_w.ftLastWriteTime, &t2); + f->CreateDate = SystemToUINT64(&t1); + f->UpdateDate = SystemToUINT64(&t2); + + if (f->Folder == false) + { + f->FileSize = ((UINT64)data_w.nFileSizeHigh * (UINT64)((UINT64)MAXDWORD + (UINT64)1)) + (UINT64)data_w.nFileSizeLow; + } + } + + Add(o, f); + } + + Zero(&data_w, sizeof(data_w)); + Zero(&data_a, sizeof(data_a)); + + if (IsNt()) + { + b = FindNextFileW(h, &data_w); + } + else + { + b = FindNextFileA(h, &data_a); + } + } + while (b); + + FindClose(h); + } + + Sort(o); + + d = ZeroMalloc(sizeof(DIRLIST)); + d->NumFiles = LIST_NUM(o); + d->File = ToArray(o); + + ReleaseList(o); + + return d; +} + +// Get the EXE file name +void Win32GetExeNameW(wchar_t *name, UINT size) +{ + // Validate arguments + if (name == NULL) + { + return; + } + + if (IsNt() == false) + { + char name_a[MAX_PATH]; + + Win32GetExeName(name_a, sizeof(name_a)); + + StrToUni(name, size, name_a); + + return; + } + + UniStrCpy(name, size, L""); + + GetModuleFileNameW(NULL, name, size); +} +void Win32GetExeName(char *name, UINT size) +{ + // Validate arguments + if (name == NULL) + { + return; + } + + StrCpy(name, size, ""); + + GetModuleFileName(NULL, name, size); +} + +// Get the current directory +void Win32GetCurrentDirW(wchar_t *dir, UINT size) +{ + // Validate arguments + if (dir == NULL) + { + return; + } + + if (IsNt() == false) + { + char dir_a[MAX_PATH]; + + Win32GetCurrentDir(dir_a, sizeof(dir_a)); + + StrToUni(dir, size, dir_a); + + return; + } + + GetCurrentDirectoryW(size, dir); +} +void Win32GetCurrentDir(char *dir, UINT size) +{ + // Validate arguments + if (dir == NULL) + { + return; + } + + GetCurrentDirectory(size, dir); +} + +// Yield +void Win32Yield() +{ + Sleep(0); +} + +// Get the memory information +void Win32GetMemInfo(MEMINFO *info) +{ + static HINSTANCE hDll = NULL; + static bool (WINAPI *_GlobalMemoryStatusEx)(LPMEMORYSTATUSEX) = NULL; + // Validate arguments + if (info == NULL) + { + return; + } + + Zero(info, sizeof(MEMINFO)); + + if (hDll == NULL) + { + hDll = LoadLibrary("kernel32.dll"); + } + if (hDll != NULL) + { + if (_GlobalMemoryStatusEx == NULL) + { + _GlobalMemoryStatusEx = + (bool (__stdcall *)(LPMEMORYSTATUSEX))GetProcAddress(hDll, "GlobalMemoryStatusEx"); + } + } + + + if (_GlobalMemoryStatusEx == NULL) + { + // Old API + MEMORYSTATUS st; + Zero(&st, sizeof(st)); + st.dwLength = sizeof(st); + + GlobalMemoryStatus(&st); + + // Amount of the logical memory + info->TotalMemory = (UINT64)st.dwTotalPageFile; + info->FreeMemory = (UINT64)st.dwAvailPageFile; + info->UsedMemory = info->TotalMemory - info->FreeMemory; + + // Amount of the physical memory + info->TotalPhys = (UINT64)st.dwTotalPhys; + info->FreePhys = (UINT64)st.dwAvailPhys; + info->UsedPhys = info->TotalPhys - info->FreePhys; + } + else + { + // New API + MEMORYSTATUSEX st; + Zero(&st, sizeof(st)); + st.dwLength = sizeof(st); + + _GlobalMemoryStatusEx(&st); + + // Amount of the logical memory + info->TotalMemory = st.ullTotalPageFile; + info->FreeMemory = st.ullAvailPageFile; + info->UsedMemory = info->TotalMemory - info->FreeMemory; + + // Amount of the physical memory + info->TotalPhys = st.ullTotalPhys; + info->FreePhys = st.ullAvailPhys; + info->UsedPhys = info->TotalPhys - info->FreePhys; + } +} + +// Creating a single instance +void *Win32NewSingleInstance(char *instance_name) +{ + WIN32MUTEX *ret; + char tmp[MAX_SIZE]; + HANDLE hMutex; + // Validate arguments + if (instance_name == NULL) + { + char exe_path[MAX_PATH]; + GetModuleFileName(NULL, exe_path, sizeof(exe_path)); + HashInstanceName(tmp, sizeof(tmp), exe_path); + instance_name = tmp; + } + + hMutex = OpenMutex(MUTEX_ALL_ACCESS, FALSE, instance_name); + if (hMutex != NULL) + { + CloseHandle(hMutex); + return NULL; + } + + hMutex = CreateMutex(NULL, FALSE, instance_name); + if (hMutex == NULL) + { + CloseHandle(hMutex); + return NULL; + } + + ret = Win32MemoryAlloc(sizeof(WIN32MUTEX)); + ret->hMutex = hMutex; + + return (void *)ret; +} + +// Release the single instance +void Win32FreeSingleInstance(void *data) +{ + WIN32MUTEX *m; + // Validate arguments + if (data == NULL) + { + return; + } + + m = (WIN32MUTEX *)data; + ReleaseMutex(m->hMutex); + CloseHandle(m->hMutex); + + Win32MemoryFree(m); +} + +// Raise the priority +void Win32SetHighPriority() +{ + SetPriorityClass(GetCurrentProcess(), HIGH_PRIORITY_CLASS); +} + +// Restore the priority +void Win32RestorePriority() +{ + SetPriorityClass(GetCurrentProcess(), NORMAL_PRIORITY_CLASS); +} + +// Get the node information +char* Win32GetProductId() +{ + char *product_id; + + return CopyStr("--"); + + // Product ID + product_id = MsRegReadStr(REG_LOCAL_MACHINE, "SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion", "ProductId"); + if (product_id == NULL) + { + product_id = MsRegReadStr(REG_LOCAL_MACHINE, "SOFTWARE\\Microsoft\\Windows\\CurrentVersion", "ProductId"); + } + + return product_id; +} + +// Acquisition whether the OS is currently supported +bool Win32IsSupportedOs() +{ + if (Win32GetOsType() == 0) + { + Win32Alert( + CEDAR_PRODUCT_STR " VPN doesn't support this Windows Operating System.\n" + CEDAR_PRODUCT_STR " VPN requires " SUPPORTED_WINDOWS_LIST ".\n\n" + "Please contact your system administrator.", NULL); + return false; + } + + return true; +} + +// Show an alert +void Win32AlertW(wchar_t *msg, wchar_t *caption) +{ + char *s; + // Validate arguments + if (msg == NULL) + { + msg = L"Alert"; + } + if (caption == NULL) + { + caption = CEDAR_PRODUCT_STR_W L" VPN Kernel"; + } + + s = GetCommandLineStr(); + + if (SearchStr(s, "win9x_uninstall", 0) == INFINITE && SearchStr(s, "win9x_install", 0) == INFINITE) + { + // Hide during the uninstallation in Win9x service mode + MessageBoxW(NULL, msg, caption, MB_SETFOREGROUND | MB_TOPMOST | MB_SERVICE_NOTIFICATION | MB_OK | MB_ICONEXCLAMATION); + } + + Free(s); +} +void Win32Alert(char *msg, char *caption) +{ + char *s; + // Validate arguments + if (msg == NULL) + { + msg = "Alert"; + } + if (caption == NULL) + { + caption = CEDAR_PRODUCT_STR " VPN Kernel"; + } + + s = GetCommandLineStr(); + + if (SearchStr(s, "win9x_uninstall", 0) == INFINITE && SearchStr(s, "win9x_install", 0) == INFINITE) + { + // Hide during the uninstallation in Win9x service mode + MessageBox(NULL, msg, caption, MB_SETFOREGROUND | MB_TOPMOST | MB_SERVICE_NOTIFICATION | MB_OK | MB_ICONEXCLAMATION); + } + + Free(s); +} +void Win32DebugAlert(char *msg) +{ + // Validate arguments + if (msg == NULL) + { + msg = "Alert"; + } + + MessageBox(NULL, msg, "Debug", MB_SETFOREGROUND | MB_TOPMOST | MB_SERVICE_NOTIFICATION | MB_OK | MB_ICONEXCLAMATION); +} + +// Get the number of CPUs +UINT Win32GetNumberOfCpuInner() +{ + UINT ret = 0; + SYSTEM_INFO info; + + Zero(&info, sizeof(info)); + + GetSystemInfo(&info); + + if (info.dwNumberOfProcessors >= 1 && info.dwNumberOfProcessors <= 128) + { + ret = info.dwNumberOfProcessors; + } + + return ret; +} + +// Get the OS information +void Win32GetOsInfo(OS_INFO *info) +{ + UINT type = Win32GetOsType(); + OSVERSIONINFOEX os; + char tmp[MAX_SIZE]; + // Validate arguments + if (info == NULL) + { + return; + } + + Zero(&os, sizeof(os)); + os.dwOSVersionInfoSize = sizeof(os); + Win32GetVersionExInternal((LPOSVERSIONINFOA)&os); + + info->OsType = Win32GetOsType(); + info->OsServicePack = os.wServicePackMajor; + if (OS_IS_WINDOWS_NT(info->OsType)) + { + char *s; + char *keyname = "SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion"; + info->OsSystemName = CopyStr("Windows NT"); + Format(tmp, sizeof(tmp), "Build %u", os.dwBuildNumber); + if (s = MsRegReadStr(REG_LOCAL_MACHINE, keyname, "CurrentType")) + { + char str[MAX_SIZE]; + Format(str, sizeof(str), ", %s", s); + StrCat(tmp, sizeof(tmp), str); + Free(s); + } + if (os.wServicePackMajor != 0) + { + char str[MAX_SIZE]; + Format(str, sizeof(str), ", Service Pack %u", os.wServicePackMajor); + StrCat(tmp, sizeof(tmp), str); + } + if (s = MsRegReadStr(REG_LOCAL_MACHINE, keyname, "BuildLab")) + { + char str[MAX_SIZE]; + Format(str, sizeof(str), " (%s)", s); + StrCat(tmp, sizeof(tmp), str); + Free(s); + } + info->OsVersion = CopyStr(tmp); + info->KernelName = CopyStr("NTOS Kernel"); + Format(tmp, sizeof(tmp), "Build %u", os.dwBuildNumber); + if (s = MsRegReadStr(REG_LOCAL_MACHINE, keyname, "CurrentType")) + { + char str[MAX_SIZE]; + Format(str, sizeof(str), " %s", s); + StrCat(tmp, sizeof(tmp), str); + Free(s); + } + info->KernelVersion = CopyStr(tmp); + } + else + { + OSVERSIONINFO os; + Zero(&os, sizeof(os)); + os.dwOSVersionInfoSize = sizeof(os); + GetVersionEx(&os); + Format(tmp, sizeof(tmp), "Build %u %s", LOWORD(os.dwBuildNumber), os.szCSDVersion); + Trim(tmp); + info->OsVersion = CopyStr(tmp); + info->OsSystemName = CopyStr("Windows"); + info->KernelName = CopyStr("Windows 9x Kernel"); + info->KernelVersion = CopyStr(tmp); + } + + info->OsProductName = CopyStr(OsTypeToStr(info->OsType)); + info->OsVendorName = CopyStr("Microsoft Corporation"); +} + +// GetVersionEx API (Ignore the tricky features that have been added to the Windows 8.2 or later) +bool Win32GetVersionExInternal(void *info) +{ + OSVERSIONINFOA os; + // Validate arguments + if (info == NULL) + { + return false; + } + + Zero(&os, sizeof(os)); + os.dwOSVersionInfoSize = sizeof(os); + + if (GetVersionExA(&os)) + { + if (os.dwPlatformId == VER_PLATFORM_WIN32_NT) + { + if ((os.dwMajorVersion == 6 && os.dwMinorVersion >= 2) || + (os.dwMajorVersion >= 7)) + { + // Windows 8 later + return Win32GetVersionExInternalForWindows81orLater(info); + } + } + } + + return GetVersionExA(info); +} + +// GetVersionEx for Windows 8.1 and later +bool Win32GetVersionExInternalForWindows81orLater(void *info) +{ + OSVERSIONINFOEXA *ex = (OSVERSIONINFOEXA *)info; + char *str; + UINT major1 = 0, major2 = 0; + UINT minor1 = 0, minor2 = 0; + UINT major = 0, minor = 0; + // Validate arguments + if (info == NULL) + { + return false; + } + + if (ex->dwOSVersionInfoSize != sizeof(OSVERSIONINFOEXA) && + ex->dwOSVersionInfoSize != sizeof(OSVERSIONINFOA)) + { + return GetVersionExA(info); + } + + if (GetVersionExA(info) == false) + { + return false; + } + + str = MsRegReadStrEx2(REG_LOCAL_MACHINE, + "SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion", + "CurrentVersion", + false, true); + + if (IsEmptyStr(str) == false) + { + // Is the version string formed as x.y? + TOKEN_LIST *t = ParseToken(str, "."); + + if (t != NULL && t->NumTokens == 2) + { + major1 = ToInt(t->Token[0]); + minor1 = ToInt(t->Token[1]); + } + + FreeToken(t); + } + + Free(str); + + major2 = MsRegReadIntEx2(REG_LOCAL_MACHINE, + "SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion", + "CurrentMajorVersionNumber", false, true); + + minor2 = MsRegReadIntEx2(REG_LOCAL_MACHINE, + "SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion", + "CurrentMinorVersionNumber", false, true); + + if ((major1 * 10000 + minor1) > (major2 * 10000 + minor2)) + { + major = major1; + minor = minor1; + } + else + { + major = major2; + minor = minor2; + } + + if (major >= 6) + { + // Version number acquisition success + ex->dwMajorVersion = major; + ex->dwMinorVersion = minor; + } + + return true; +} + +// Acquisition whether it's a Windows NT +bool Win32IsNt() +{ + OSVERSIONINFO os; + Zero(&os, sizeof(os)); + os.dwOSVersionInfoSize = sizeof(os); + + if (GetVersionEx(&os) == FALSE) + { + // Failure? + return false; + } + + if (os.dwPlatformId == VER_PLATFORM_WIN32_NT) + { + // NT + return true; + } + + // 9x + return false; +} + +// Get the OS type +UINT Win32GetOsType() +{ + OSVERSIONINFO os; + Zero(&os, sizeof(os)); + os.dwOSVersionInfoSize = sizeof(os); + + if (Win32GetVersionExInternal(&os) == FALSE) + { + // Failure? + return 0; + } + + if (os.dwPlatformId == VER_PLATFORM_WIN32_WINDOWS) + { + // Windows 9x system + if (os.dwMajorVersion == 4) + { + if (os.dwMinorVersion == 0) + { + return OSTYPE_WINDOWS_95; + } + else if (os.dwMinorVersion == 10) + { + return OSTYPE_WINDOWS_98; + } + else if (os.dwMinorVersion == 90) + { + return OSTYPE_WINDOWS_ME; + } + else + { + return OSTYPE_WINDOWS_UNKNOWN; + } + } + else if (os.dwMajorVersion >= 5) + { + return OSTYPE_WINDOWS_UNKNOWN; + } + } + else if (os.dwPlatformId == VER_PLATFORM_WIN32_NT) + { + UINT sp = Win32GetSpVer(os.szCSDVersion); + if (os.dwMajorVersion == 4) + { + if (sp < 6) + { + // SP6 or earlier + return 0; + } + } + if (os.dwMajorVersion < 4) + { + // NT 3.51 or earlier + return 0; + } + else + { + OSVERSIONINFOEX os; + Zero(&os, sizeof(os)); + os.dwOSVersionInfoSize = sizeof(os); + Win32GetVersionExInternal((LPOSVERSIONINFOA)&os); + + if (os.dwMajorVersion == 4) + { + // Windows NT 4.0 + if (os.wProductType == VER_NT_DOMAIN_CONTROLLER || os.wProductType == VER_NT_SERVER) + { + if ((os.wSuiteMask & VER_SUITE_TERMINAL) || (os.wSuiteMask & VER_SUITE_SINGLEUSERTS)) + { + return OSTYPE_WINDOWS_NT_4_TERMINAL_SERVER; + } + if (os.wSuiteMask & VER_SUITE_ENTERPRISE) + { + return OSTYPE_WINDOWS_NT_4_SERVER_ENTERPRISE; + } + if (os.wSuiteMask & VER_SUITE_BACKOFFICE) + { + return OSTYPE_WINDOWS_NT_4_BACKOFFICE; + } + if ((os.wSuiteMask & VER_SUITE_SMALLBUSINESS) || (os.wSuiteMask & VER_SUITE_SMALLBUSINESS_RESTRICTED)) + { + return OSTYPE_WINDOWS_NT_4_SMS; + } + else + { + return OSTYPE_WINDOWS_NT_4_SERVER; + } + } + else + { + return OSTYPE_WINDOWS_NT_4_WORKSTATION; + } + } + else if (os.dwMajorVersion == 5) + { + // Windows 2000, XP, Server 2003 + if (os.dwMinorVersion == 0) + { + // Windows 2000 + if (os.wProductType == VER_NT_DOMAIN_CONTROLLER || os.wProductType == VER_NT_SERVER) + { + // Server + if (os.wSuiteMask & VER_SUITE_DATACENTER) + { + return OSTYPE_WINDOWS_2000_DATACENTER_SERVER; + } + else if ((os.wSuiteMask & VER_SUITE_SMALLBUSINESS) || (os.wSuiteMask & VER_SUITE_SMALLBUSINESS_RESTRICTED)) + { + return OSTYPE_WINDOWS_2000_SBS; + } + else if (os.wSuiteMask & VER_SUITE_BACKOFFICE) + { + return OSTYPE_WINDOWS_2000_BACKOFFICE; + } + else if (os.wSuiteMask & VER_SUITE_ENTERPRISE) + { + return OSTYPE_WINDOWS_2000_ADVANCED_SERVER; + } + else + { + return OSTYPE_WINDOWS_2000_SERVER; + } + } + else + { + // Client + return OSTYPE_WINDOWS_2000_PROFESSIONAL; + } + } + else if (os.dwMinorVersion == 1) + { + // Windows XP + if (os.wSuiteMask & VER_SUITE_PERSONAL) + { + return OSTYPE_WINDOWS_XP_HOME; + } + else + { + return OSTYPE_WINDOWS_XP_PROFESSIONAL; + } + } + else if (os.dwMinorVersion == 2) + { + // Windows Server 2003 + if (os.wProductType == VER_NT_DOMAIN_CONTROLLER || os.wProductType == VER_NT_SERVER) + { + // Server + if (os.wSuiteMask & VER_SUITE_DATACENTER) + { + return OSTYPE_WINDOWS_2003_DATACENTER; + } + else if ((os.wSuiteMask & VER_SUITE_SMALLBUSINESS) || (os.wSuiteMask & VER_SUITE_SMALLBUSINESS_RESTRICTED)) + { + return OSTYPE_WINDOWS_2003_SBS; + } + else if (os.wSuiteMask & VER_SUITE_BACKOFFICE) + { + return OSTYPE_WINDOWS_2003_BACKOFFICE; + } + else if (os.wSuiteMask & VER_SUITE_ENTERPRISE) + { + return OSTYPE_WINDOWS_2003_ENTERPRISE; + } + else if (os.wSuiteMask & VER_SUITE_BLADE) + { + return OSTYPE_WINDOWS_2003_WEB; + } + else + { + return OSTYPE_WINDOWS_2003_STANDARD; + } + } + else + { + // Client (Unknown XP?) + return OSTYPE_WINDOWS_XP_PROFESSIONAL; + } + } + else + { + // Windows Longhorn + if (os.wProductType == VER_NT_DOMAIN_CONTROLLER || os.wProductType == VER_NT_SERVER) + { + return OSTYPE_WINDOWS_LONGHORN_SERVER; + } + else + { + return OSTYPE_WINDOWS_LONGHORN_PROFESSIONAL; + } + } + } + else + { + if (os.dwMajorVersion == 6 && os.dwMinorVersion == 0) + { + // Windows Vista, Server 2008 + if (os.wProductType == VER_NT_DOMAIN_CONTROLLER || os.wProductType == VER_NT_SERVER) + { + return OSTYPE_WINDOWS_LONGHORN_SERVER; + } + else + { + return OSTYPE_WINDOWS_LONGHORN_PROFESSIONAL; + } + } + else if (os.dwMajorVersion == 6 && os.dwMinorVersion == 1) + { + if (os.wProductType == VER_NT_WORKSTATION) + { + // Windows 7 + return OSTYPE_WINDOWS_7; + } + else + { + // Windows Server 2008 R2 + return OSTYPE_WINDOWS_SERVER_2008_R2; + } + } + else if (os.dwMajorVersion == 6 && os.dwMinorVersion == 2) + { + if (os.wProductType == VER_NT_WORKSTATION) + { + // Windows 8 + return OSTYPE_WINDOWS_8; + } + else + { + // Windows Server 2012 + return OSTYPE_WINDOWS_SERVER_8; + } + } + else if (os.dwMajorVersion == 6 && os.dwMinorVersion == 3) + { + if (os.wProductType == VER_NT_WORKSTATION) + { + // Windows 8.1 + return OSTYPE_WINDOWS_81; + } + else + { + // Windows Server 2012 R2 + return OSTYPE_WINDOWS_SERVER_81; + } + } + else if ((os.dwMajorVersion == 6 && os.dwMinorVersion == 4) || (os.dwMajorVersion == 10 && os.dwMinorVersion == 0)) + { + if (os.wProductType == VER_NT_WORKSTATION) + { + // Windows 10 + return OSTYPE_WINDOWS_10; + } + else + { + // Windows Server 10 + return OSTYPE_WINDOWS_SERVER_10; + } + } + else + { + if (os.wProductType == VER_NT_WORKSTATION) + { + // Windows 11 or later + return OSTYPE_WINDOWS_11; + } + else + { + // Windows Server 11 or later + return OSTYPE_WINDOWS_SERVER_11; + } + } + } + } + } + + // Can not be determined + return 0; +} + +// Get the SP version from the string +UINT Win32GetSpVer(char *str) +{ + UINT ret, i; + TOKEN_LIST *t; + // Validate arguments + if (str == NULL) + { + return 0; + } + + t = ParseToken(str, NULL); + if (t == NULL) + { + return 0; + } + + ret = 0; + for (i = 0;i < t->NumTokens;i++) + { + ret = ToInt(t->Token[i]); + if (ret != 0) + { + break; + } + } + + FreeToken(t); + + return ret; +} + +// Kill the process +bool Win32TerminateProcess(void *handle) +{ + HANDLE h; + // Validate arguments + if (handle == NULL) + { + return false; + } + + h = (HANDLE)handle; + + TerminateProcess(h, 0); + + return true; +} + +// Close the process +void Win32CloseProcess(void *handle) +{ + // Validate arguments + if (handle == NULL) + { + return; + } + + CloseHandle((HANDLE)handle); +} + +// Check whether the specified process is alive +bool Win32IsProcessAlive(void *handle) +{ + HANDLE h; + // Validate arguments + if (handle == NULL) + { + return false; + } + + h = (HANDLE)handle; + + if (WaitForSingleObject(h, 0) == WAIT_OBJECT_0) + { + return false; + } + + return true; +} + +// Wait for the process termination +bool Win32WaitProcess(void *h, UINT timeout) +{ + // Validate arguments + if (h == NULL) + { + return false; + } + if (timeout == 0) + { + timeout = INFINITE; + } + + if (WaitForSingleObject((HANDLE)h, timeout) == WAIT_TIMEOUT) + { + return false; + } + + return true; +} + +// Run the process and wait for terminate it +bool Win32RunAndWaitProcess(wchar_t *filename, wchar_t *arg, bool hide, bool disableWow, UINT timeout) +{ + UINT process_id = 0; + void *p = Win32RunEx3W(filename, arg, hide, &process_id, disableWow); + + if (p == NULL) + { + return false; + } + + return Win32WaitProcess(p, timeout); +} + +// Run the process (return the handle) +void *Win32RunExW(wchar_t *filename, wchar_t *arg, bool hide) +{ + return Win32RunEx2W(filename, arg, hide, NULL); +} +void *Win32RunEx2W(wchar_t *filename, wchar_t *arg, bool hide, UINT *process_id) +{ + return Win32RunEx3W(filename, arg, hide, process_id, false); +} +void *Win32RunEx3W(wchar_t *filename, wchar_t *arg, bool hide, UINT *process_id, bool disableWow) +{ + STARTUPINFOW info; + PROCESS_INFORMATION ret; + wchar_t cmdline[MAX_SIZE]; + wchar_t name[MAX_PATH]; + void *p; + // Validate arguments + if (filename == NULL) + { + return NULL; + } + + if (IsNt() == false) + { + char *filename_a = CopyUniToStr(filename); + char *arg_a = CopyUniToStr(arg); + void *ret = Win32RunEx3(filename_a, arg_a, hide, process_id, disableWow); + + Free(filename_a); + Free(arg_a); + + return ret; + } + + UniStrCpy(name, sizeof(name), filename); + UniTrim(name); + + if (UniSearchStr(name, L"\"", 0) == INFINITE) + { + if (arg == NULL) + { + UniFormat(cmdline, sizeof(cmdline), L"%s", name); + } + else + { + UniFormat(cmdline, sizeof(cmdline), L"%s %s", name, arg); + } + } + else + { + if (arg == NULL) + { + UniFormat(cmdline, sizeof(cmdline), L"\"%s\"", name); + } + else + { + UniFormat(cmdline, sizeof(cmdline), L"\"%s\" %s", name, arg); + } + } + + Zero(&info, sizeof(info)); + Zero(&ret, sizeof(ret)); + info.cb = sizeof(info); + info.dwFlags = STARTF_USESHOWWINDOW; + info.wShowWindow = (hide == false ? SW_SHOWDEFAULT : SW_HIDE); + + UniTrim(cmdline); + + if (disableWow) + { + p = MsDisableWow64FileSystemRedirection(); + } + + if (CreateProcessW(NULL, cmdline, NULL, NULL, FALSE, + (hide == false ? CREATE_NEW_CONSOLE : CREATE_NO_WINDOW | CREATE_NEW_CONSOLE) | NORMAL_PRIORITY_CLASS, + NULL, NULL, &info, &ret) == FALSE) + { + if (disableWow) + { + MsRestoreWow64FileSystemRedirection(p); + } + return NULL; + } + + if (disableWow) + { + MsRestoreWow64FileSystemRedirection(p); + } + + if (process_id != NULL) + { + *process_id = ret.dwProcessId; + } + + CloseHandle(ret.hThread); + return ret.hProcess; +} +void *Win32RunEx(char *filename, char *arg, bool hide) +{ + return Win32RunEx2(filename, arg, hide, NULL); +} +void *Win32RunEx2(char *filename, char *arg, bool hide, UINT *process_id) +{ + return Win32RunEx3(filename, arg, hide, process_id, false); +} +void *Win32RunEx3(char *filename, char *arg, bool hide, UINT *process_id, bool disableWow) +{ + STARTUPINFO info; + PROCESS_INFORMATION ret; + char cmdline[MAX_SIZE]; + char name[MAX_PATH]; + void *p = NULL; + // Validate arguments + if (filename == NULL) + { + return NULL; + } + + StrCpy(name, sizeof(name), filename); + Trim(name); + + if (SearchStr(name, "\"", 0) == INFINITE) + { + if (arg == NULL) + { + Format(cmdline, sizeof(cmdline), "%s", name); + } + else + { + Format(cmdline, sizeof(cmdline), "%s %s", name, arg); + } + } + else + { + if (arg == NULL) + { + Format(cmdline, sizeof(cmdline), "\"%s\"", name); + } + else + { + Format(cmdline, sizeof(cmdline), "\"%s\" %s", name, arg); + } + } + + Zero(&info, sizeof(info)); + Zero(&ret, sizeof(ret)); + info.cb = sizeof(info); + info.dwFlags = STARTF_USESHOWWINDOW; + info.wShowWindow = (hide == false ? SW_SHOWDEFAULT : SW_HIDE); + + Trim(cmdline); + + if (disableWow) + { + p = MsDisableWow64FileSystemRedirection(); + } + + if (CreateProcess(NULL, cmdline, NULL, NULL, FALSE, + (hide == false ? CREATE_NEW_CONSOLE : CREATE_NO_WINDOW | CREATE_NEW_CONSOLE) | NORMAL_PRIORITY_CLASS, + NULL, NULL, &info, &ret) == FALSE) + { + if (disableWow) + { + MsRestoreWow64FileSystemRedirection(p); + } + return NULL; + } + if (disableWow) + { + MsRestoreWow64FileSystemRedirection(p); + } + + if (process_id != NULL) + { + *process_id = ret.dwProcessId; + } + + CloseHandle(ret.hThread); + return ret.hProcess; +} + +// Start the process +bool Win32RunW(wchar_t *filename, wchar_t *arg, bool hide, bool wait) +{ + STARTUPINFOW info; + PROCESS_INFORMATION ret; + wchar_t cmdline[MAX_SIZE]; + wchar_t name[MAX_PATH]; + // Validate arguments + if (filename == NULL) + { + return false; + } + + if (IsNt() == false) + { + char *filename_a = CopyUniToStr(filename); + char *arg_a = CopyUniToStr(arg); + bool ret; + + ret = Win32Run(filename_a, arg_a, hide, wait); + + Free(filename_a); + Free(arg_a); + + return ret; + } + + UniStrCpy(name, sizeof(name), filename); + UniTrim(name); + + if (UniSearchStr(name, L"\"", 0) == INFINITE) + { + if (arg == NULL) + { + UniFormat(cmdline, sizeof(cmdline), L"%s", name); + } + else + { + UniFormat(cmdline, sizeof(cmdline), L"%s %s", name, arg); + } + } + else + { + if (arg == NULL) + { + UniFormat(cmdline, sizeof(cmdline), L"\"%s\"", name); + } + else + { + UniFormat(cmdline, sizeof(cmdline), L"\"%s\" %s", name, arg); + } + } + + Zero(&info, sizeof(info)); + Zero(&ret, sizeof(ret)); + info.cb = sizeof(info); + info.dwFlags = STARTF_USESHOWWINDOW; + info.wShowWindow = (hide == false ? SW_SHOWDEFAULT : SW_HIDE); + + UniTrim(cmdline); + + if (CreateProcessW(NULL, cmdline, NULL, NULL, FALSE, + (hide == false ? CREATE_NEW_CONSOLE : CREATE_NO_WINDOW | CREATE_NEW_CONSOLE) | NORMAL_PRIORITY_CLASS, + NULL, NULL, &info, &ret) == FALSE) + { + return false; + } + + if (wait) + { + WaitForSingleObject(ret.hProcess, INFINITE); + } + + CloseHandle(ret.hThread); + CloseHandle(ret.hProcess); + + return true; +} +bool Win32Run(char *filename, char *arg, bool hide, bool wait) +{ + STARTUPINFO info; + PROCESS_INFORMATION ret; + char cmdline[MAX_SIZE]; + char name[MAX_PATH]; + // Validate arguments + if (filename == NULL) + { + return false; + } + + StrCpy(name, sizeof(name), filename); + Trim(name); + + if (SearchStr(name, "\"", 0) == INFINITE) + { + if (arg == NULL) + { + Format(cmdline, sizeof(cmdline), "%s", name); + } + else + { + Format(cmdline, sizeof(cmdline), "%s %s", name, arg); + } + } + else + { + if (arg == NULL) + { + Format(cmdline, sizeof(cmdline), "\"%s\"", name); + } + else + { + Format(cmdline, sizeof(cmdline), "\"%s\" %s", name, arg); + } + } + + Zero(&info, sizeof(info)); + Zero(&ret, sizeof(ret)); + info.cb = sizeof(info); + info.dwFlags = STARTF_USESHOWWINDOW; + info.wShowWindow = (hide == false ? SW_SHOWDEFAULT : SW_HIDE); + + Trim(cmdline); + + if (CreateProcess(NULL, cmdline, NULL, NULL, FALSE, + (hide == false ? CREATE_NEW_CONSOLE : CREATE_NO_WINDOW | CREATE_NEW_CONSOLE) | NORMAL_PRIORITY_CLASS, + NULL, NULL, &info, &ret) == FALSE) + { + return false; + } + + if (wait) + { + WaitForSingleObject(ret.hProcess, INFINITE); + } + + CloseHandle(ret.hThread); + CloseHandle(ret.hProcess); + + return true; +} + +// Get the Thread ID +UINT Win32ThreadId() +{ + return GetCurrentThreadId(); +} + +// Rename the file +bool Win32FileRenameW(wchar_t *old_name, wchar_t *new_name) +{ + // Validate arguments + if (old_name == NULL || new_name == NULL) + { + return false; + } + + if (IsNt() == false) + { + char *old_name_a = CopyUniToStr(old_name); + char *new_name_a = CopyUniToStr(new_name); + bool ret = Win32FileRename(old_name_a, new_name_a); + + Free(old_name_a); + Free(new_name_a); + + return ret; + } + + // Rename + if (MoveFileW(old_name, new_name) == FALSE) + { + return false; + } + + return true; +} +bool Win32FileRename(char *old_name, char *new_name) +{ + // Validate arguments + if (old_name == NULL || new_name == NULL) + { + return false; + } + + // Rename + if (MoveFile(old_name, new_name) == FALSE) + { + return false; + } + + return true; +} + +// Getting the name of the directory where the EXE file is in +void Win32GetExeDirW(wchar_t *name, UINT size) +{ + wchar_t exe_path[MAX_SIZE]; + wchar_t exe_dir[MAX_SIZE]; + // Validate arguments + if (name == NULL) + { + return; + } + + if (IsNt() == false) + { + char name_a[MAX_PATH]; + + Win32GetExeDir(name_a, sizeof(name_a)); + + StrToUni(name, size, name_a); + + return; + } + + // Get the EXE file name + GetModuleFileNameW(NULL, exe_path, sizeof(exe_path)); + + // Get the directory name + Win32GetDirFromPathW(exe_dir, sizeof(exe_dir), exe_path); + + UniStrCpy(name, size, exe_dir); +} +void Win32GetExeDir(char *name, UINT size) +{ + char exe_path[MAX_SIZE]; + char exe_dir[MAX_SIZE]; + // Validate arguments + if (name == NULL) + { + return; + } + + // Get the EXE file name + GetModuleFileName(NULL, exe_path, sizeof(exe_path)); + + // Get the directory name + Win32GetDirFromPath(exe_dir, sizeof(exe_dir), exe_path); + + StrCpy(name, size, exe_dir); +} + +// Remove the '\' at the end +void Win32NukuEnW(wchar_t *dst, UINT size, wchar_t *src) +{ + wchar_t str[MAX_SIZE]; + int i; + if (src) + { + UniStrCpy(str, sizeof(str), src); + } + else + { + UniStrCpy(str, sizeof(str), dst); + } + i = UniStrLen(str); + if (str[i - 1] == L'\\') + { + str[i - 1] = 0; + } + UniStrCpy(dst, size, str); +} +void Win32NukuEn(char *dst, UINT size, char *src) +{ + char str[MAX_SIZE]; + int i; + if (src) + { + StrCpy(str, sizeof(str), src); + } + else + { + StrCpy(str, sizeof(str), dst); + } + i = StrLen(str); + if (str[i - 1] == '\\') + { + str[i - 1] = 0; + } + StrCpy(dst, size, str); +} + +// Get the directory name from path +void Win32GetDirFromPathW(wchar_t *dst, UINT size, wchar_t *src) +{ + wchar_t str[MAX_SIZE]; + int i,len; + wchar_t c; + wchar_t tmp[MAX_SIZE]; + int wp; + if (src) + { + UniStrCpy(str, sizeof(str), src); + } + else + { + UniStrCpy(str, sizeof(str), dst); + } + Win32NukuEnW(str, sizeof(str), NULL); + wp = 0; + len = UniStrLen(str); + dst[0] = 0; + for (i = 0;i < len;i++) + { + c = str[i]; + switch (c) + { + case L'\\': + tmp[wp] = 0; + wp = 0; + UniStrCat(dst, size, tmp); + UniStrCat(dst, size, L"\\"); + break; + default: + tmp[wp] = c; + wp++; + break; + } + } + Win32NukuEnW(dst, size, NULL); +} +void Win32GetDirFromPath(char *dst, UINT size, char *src) +{ + char str[MAX_SIZE]; + int i,len; + char c; + char tmp[MAX_SIZE]; + int wp; + if (src) + { + StrCpy(str, sizeof(str), src); + } + else + { + StrCpy(str, sizeof(str), dst); + } + Win32NukuEn(str, sizeof(str), NULL); + wp = 0; + len = StrLen(str); + dst[0] = 0; + for (i = 0;i < len;i++) + { + c = str[i]; + switch (c) + { + case '\\': + tmp[wp] = 0; + wp = 0; + StrCat(dst, size, tmp); + StrCat(dst, size, "\\"); + break; + default: + tmp[wp] = c; + wp++; + break; + } + } + Win32NukuEn(dst, size, NULL); +} + +// Delete the directory +bool Win32DeleteDirW(wchar_t *name) +{ + // Validate arguments + if (name == NULL) + { + return false; + } + + if (IsNt() == false) + { + char *name_a = CopyUniToStr(name); + bool ret = Win32DeleteDir(name_a); + + Free(name_a); + + return ret; + } + + if (RemoveDirectoryW(name) == FALSE) + { + return false; + } + return true; +} +bool Win32DeleteDir(char *name) +{ + // Validate arguments + if (name == NULL) + { + return false; + } + + if (RemoveDirectory(name) == FALSE) + { + return false; + } + return true; +} + +// Create a directory +bool Win32MakeDirW(wchar_t *name) +{ + // Validate arguments + if (name == NULL) + { + return false; + } + + if (IsNt() == false) + { + char *name_a = CopyUniToStr(name); + bool ret = Win32MakeDir(name_a); + + Free(name_a); + + return ret; + } + + if (CreateDirectoryW(name, NULL) == FALSE) + { + return false; + } + + return true; +} +bool Win32MakeDir(char *name) +{ + // Validate arguments + if (name == NULL) + { + return false; + } + + if (CreateDirectory(name, NULL) == FALSE) + { + return false; + } + + return true; +} + +// Delete the file +bool Win32FileDeleteW(wchar_t *name) +{ + // Validate arguments + if (name == NULL) + { + return false; + } + + if (IsNt() == false) + { + bool ret; + char *name_a = CopyUniToStr(name); + + ret = Win32FileDelete(name_a); + + Free(name_a); + + return ret; + } + + if (DeleteFileW(name) == FALSE) + { + return false; + } + return true; +} +bool Win32FileDelete(char *name) +{ + // Validate arguments + if (name == NULL) + { + return false; + } + + if (DeleteFile(name) == FALSE) + { + return false; + } + return true; +} + +// Seek in the file +bool Win32FileSeek(void *pData, UINT mode, int offset) +{ + WIN32IO *p; + DWORD ret; + // Validate arguments + if (pData == NULL) + { + return false; + } + if (mode != FILE_BEGIN && mode != FILE_END && mode != FILE_CURRENT) + { + return false; + } + + p = (WIN32IO *)pData; + ret = SetFilePointer(p->hFile, (LONG)offset, NULL, mode); + if (ret == INVALID_SET_FILE_POINTER || ret == ERROR_NEGATIVE_SEEK) + { + return false; + } + return true; +} + +// Get the file size +UINT64 Win32FileSize(void *pData) +{ + WIN32IO *p; + UINT64 ret; + DWORD tmp; + // Validate arguments + if (pData == NULL) + { + return 0; + } + + p = (WIN32IO *)pData; + tmp = 0; + ret = GetFileSize(p->hFile, &tmp); + if (ret == (DWORD)-1) + { + return 0; + } + + if (tmp != 0) + { + ret += (UINT64)tmp * 4294967296ULL; + } + + return ret; +} + +// Write to the file +bool Win32FileWrite(void *pData, void *buf, UINT size) +{ + WIN32IO *p; + DWORD write_size; + // Validate arguments + if (pData == NULL || buf == NULL || size == 0) + { + return false; + } + + p = (WIN32IO *)pData; + if (WriteFile(p->hFile, buf, size, &write_size, NULL) == FALSE) + { + return false; + } + + if (write_size != size) + { + return false; + } + + return true; +} + +// Read from a file +bool Win32FileRead(void *pData, void *buf, UINT size) +{ + WIN32IO *p; + DWORD read_size; + // Validate arguments + if (pData == NULL || buf == NULL || size == 0) + { + return false; + } + + p = (WIN32IO *)pData; + if (ReadFile(p->hFile, buf, size, &read_size, NULL) == FALSE) + { + return false; + } + + if (read_size != size) + { + return false; + } + + return true;; +} + +// Close the file +void Win32FileClose(void *pData, bool no_flush) +{ + WIN32IO *p; + // Validate arguments + if (pData == NULL) + { + return; + } + + p = (WIN32IO *)pData; + if (p->WriteMode && no_flush == false) + { + FlushFileBuffers(p->hFile); + } + CloseHandle(p->hFile); + p->hFile = NULL; + + // Memory release + Win32MemoryFree(p); +} + +// Get the date of the file +bool Win32FileGetDate(void *pData, UINT64 *created_time, UINT64 *updated_time, UINT64 *accessed_date) +{ + WIN32IO *p; + BY_HANDLE_FILE_INFORMATION info; + SYSTEMTIME st_create, st_update, st_access; + // Validate arguments + if (pData == NULL) + { + return false; + } + + p = (WIN32IO *)pData; + + Zero(&info, sizeof(info)); + + if (GetFileInformationByHandle(p->hFile, &info) == false) + { + return false; + } + + Zero(&st_create, sizeof(st_create)); + Zero(&st_update, sizeof(st_update)); + Zero(&st_access, sizeof(st_access)); + + FileTimeToSystemTime(&info.ftCreationTime, &st_create); + FileTimeToSystemTime(&info.ftLastWriteTime, &st_update); + FileTimeToSystemTime(&info.ftLastAccessTime, &st_access); + + if (created_time != NULL) + { + *created_time = SystemToUINT64(&st_create); + } + + if (updated_time != NULL) + { + *updated_time = SystemToUINT64(&st_update); + } + + if (accessed_date != NULL) + { + *accessed_date = SystemToUINT64(&st_access); + } + + return true; +} + +// Set the date of the file +bool Win32FileSetDate(void *pData, UINT64 created_time, UINT64 updated_time) +{ + WIN32IO *p; + SYSTEMTIME st_created_time, st_updated_time; + FILETIME ft_created_time, ft_updated_time; + FILETIME *p_created_time = NULL, *p_updated_time = NULL; + // Validate arguments + if (pData == NULL || (created_time == 0 && updated_time == 0)) + { + return false; + } + + p = (WIN32IO *)pData; + + Zero(&st_created_time, sizeof(st_created_time)); + Zero(&st_updated_time, sizeof(st_updated_time)); + + if (created_time != 0) + { + UINT64ToSystem(&st_created_time, created_time); + + SystemTimeToFileTime(&st_created_time, &ft_created_time); + + p_created_time = &ft_created_time; + } + + if (updated_time != 0) + { + UINT64ToSystem(&st_updated_time, updated_time); + + SystemTimeToFileTime(&st_updated_time, &ft_updated_time); + + p_updated_time = &ft_updated_time; + } + + return SetFileTime(p->hFile, p_created_time, NULL, p_updated_time); +} + +// Flush to the file +void Win32FileFlush(void *pData) +{ + WIN32IO *p; + // Validate arguments + if (pData == NULL) + { + return; + } + + p = (WIN32IO *)pData; + if (p->WriteMode) + { + FlushFileBuffers(p->hFile); + } +} + +// Open the file +void *Win32FileOpenW(wchar_t *name, bool write_mode, bool read_lock) +{ + WIN32IO *p; + HANDLE h; + DWORD lock_mode; + // Validate arguments + if (name == NULL) + { + return NULL; + } + + if (IsNt() == false) + { + void *ret; + char *name_a = CopyUniToStr(name); + + ret = Win32FileOpen(name_a, write_mode, read_lock); + + Free(name_a); + + return ret; + } + + if (write_mode) + { + lock_mode = FILE_SHARE_READ; + } + else + { + if (read_lock == false) + { + lock_mode = FILE_SHARE_READ | FILE_SHARE_WRITE; + } + else + { + lock_mode = FILE_SHARE_READ; + } + } + + // Open the file + h = CreateFileW(name, + (write_mode ? GENERIC_READ | GENERIC_WRITE : GENERIC_READ), + lock_mode, + NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); + if (h == INVALID_HANDLE_VALUE) + { + UINT ret = GetLastError(); + // Failure + return NULL; + } + + // Memory allocation + p = Win32MemoryAlloc(sizeof(WIN32IO)); + // Store Handle + p->hFile = h; + + p->WriteMode = write_mode; + + return (void *)p; +} +void *Win32FileOpen(char *name, bool write_mode, bool read_lock) +{ + WIN32IO *p; + HANDLE h; + DWORD lock_mode; + // Validate arguments + if (name == NULL) + { + return NULL; + } + + if (write_mode) + { + lock_mode = FILE_SHARE_READ; + } + else + { + if (read_lock == false) + { + lock_mode = FILE_SHARE_READ | FILE_SHARE_WRITE; + } + else + { + lock_mode = FILE_SHARE_READ; + } + } + + // Open the file + h = CreateFile(name, + (write_mode ? GENERIC_READ | GENERIC_WRITE : GENERIC_READ), + lock_mode, + NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); + if (h == INVALID_HANDLE_VALUE) + { + UINT ret = GetLastError(); + // Failure + return NULL; + } + + // Memory allocation + p = Win32MemoryAlloc(sizeof(WIN32IO)); + // Store Handle + p->hFile = h; + + p->WriteMode = write_mode; + + return (void *)p; +} + +// Create a file +void *Win32FileCreateW(wchar_t *name) +{ + WIN32IO *p; + HANDLE h; + // Validate arguments + if (name == NULL) + { + return NULL; + } + + if (IsNt() == false) + { + void *ret; + char *name_a = CopyUniToStr(name); + + ret = Win32FileCreate(name_a); + + Free(name_a); + + return ret; + } + + // Create a file + h = CreateFileW(name, GENERIC_READ | GENERIC_WRITE, + FILE_SHARE_READ, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, + NULL); + if (h == INVALID_HANDLE_VALUE) + { + h = CreateFileW(name, GENERIC_READ | GENERIC_WRITE, + FILE_SHARE_READ, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_HIDDEN, + NULL); + if (h == INVALID_HANDLE_VALUE) + { + return NULL; + } + } + + // Memory allocation + p = Win32MemoryAlloc(sizeof(WIN32IO)); + // Store Handle + p->hFile = h; + + p->WriteMode = true; + + return (void *)p; +} +void *Win32FileCreate(char *name) +{ + WIN32IO *p; + HANDLE h; + // Validate arguments + if (name == NULL) + { + return NULL; + } + + // Create a file + h = CreateFile(name, GENERIC_READ | GENERIC_WRITE, + FILE_SHARE_READ, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, + NULL); + if (h == INVALID_HANDLE_VALUE) + { + h = CreateFile(name, GENERIC_READ | GENERIC_WRITE, + FILE_SHARE_READ, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_HIDDEN, + NULL); + if (h == INVALID_HANDLE_VALUE) + { + return NULL; + } + } + + // Memory allocation + p = Win32MemoryAlloc(sizeof(WIN32IO)); + // Store Handle + p->hFile = h; + + p->WriteMode = true; + + return (void *)p; +} + +#define SIZE_OF_CALLSTACK_SYM 10000 +#define CALLSTACK_DEPTH 12 + +// Get the call stack +CALLSTACK_DATA *Win32GetCallStack() +{ +#ifndef WIN32_NO_DEBUG_HELP_DLL + DWORD current_eip32 = 0, current_esp32 = 0, current_ebp32 = 0; + UINT64 current_eip = 0, current_esp = 0, current_ebp = 0; + STACKFRAME64 sf; + CALLSTACK_DATA *cs = NULL, *s; + +#ifdef CPU_64 + CONTEXT context; +#endif // CPU_64 + + bool ret; + UINT depth = 0; + +#ifndef CPU_64 + // Register acquisition (32 bit) + __asm + { + mov current_esp32, esp + mov current_ebp32, ebp + }; + + current_eip32 = (DWORD)Win32GetCallStack; + + current_eip = (UINT64)current_eip32; + current_esp = (UINT64)current_esp32; + current_ebp = (UINT64)current_ebp32; +#else // CPU_64 + // Register acquisition (64 bit) + Zero(&context, sizeof(context)); + context.ContextFlags = CONTEXT_FULL; + RtlCaptureContext(&context); +#endif // CPU_64 + + Zero(&sf, sizeof(sf)); + +#ifndef CPU_64 + sf.AddrPC.Offset = current_eip; + sf.AddrStack.Offset = current_esp; + sf.AddrFrame.Offset = current_ebp; +#else // CPU_64 + sf.AddrPC.Offset = context.Rip; + sf.AddrStack.Offset = context.Rsp; + sf.AddrFrame.Offset = context.Rsp; +#endif // CPU_64 + + sf.AddrPC.Mode = AddrModeFlat; + sf.AddrStack.Mode = AddrModeFlat; + sf.AddrFrame.Mode = AddrModeFlat; + + while (true) + { + DWORD type = IMAGE_FILE_MACHINE_I386; + +#ifdef CPU_64 + type = IMAGE_FILE_MACHINE_AMD64; +#endif // CPU_64 + + if ((depth++) >= CALLSTACK_DEPTH) + { + break; + } + +#ifndef CPU_64 + ret = StackWalk64(type, + hCurrentProcessHandle, + GetCurrentThread(), + &sf, + NULL, NULL, SymFunctionTableAccess64, SymGetModuleBase64, NULL); +#else // CPU_64 + ret = StackWalk64(type, + hCurrentProcessHandle, + GetCurrentThread(), + &sf, + &context, NULL, SymFunctionTableAccess64, SymGetModuleBase64, NULL); +#endif // CPU_64 + if (ret == false || sf.AddrFrame.Offset == 0) + { + break; + } + + if (cs == NULL) + { + cs = OSMemoryAlloc(sizeof(CALLSTACK_DATA)); + s = cs; + } + else + { + s->next = OSMemoryAlloc(sizeof(CALLSTACK_DATA)); + s = s->next; + } + s->symbol_cache = false; + s->next = NULL; + s->offset = sf.AddrPC.Offset; + s->disp = 0; + s->name = NULL; + s->line = 0; + s->filename[0] = 0; + } + + return cs; +#else // WIN32_NO_DEBUG_HELP_DLL + return NULL; +#endif // WIN32_NO_DEBUG_HELP_DLL +} + +// Get the symbol information from the call stack +bool Win32GetCallStackSymbolInfo(CALLSTACK_DATA *s) +{ +#ifdef WIN32_NO_DEBUG_HELP_DLL + return false; +#else // WIN32_NO_DEBUG_HELP_DLL + UINT64 disp; + UINT disp32, len; + IMAGEHLP_SYMBOL64 *sym; + IMAGEHLP_LINE64 line; + char tmp[MAX_PATH]; + // Validate arguments + if (s == NULL) + { + return false; + } + + if (s->symbol_cache) + { + return true; + } + + sym = OSMemoryAlloc(SIZE_OF_CALLSTACK_SYM); + sym->SizeOfStruct = SIZE_OF_CALLSTACK_SYM; + sym->MaxNameLength = SIZE_OF_CALLSTACK_SYM - sizeof(IMAGEHLP_SYMBOL64); + + if (SymGetSymFromAddr64(hCurrentProcessHandle, s->offset, &disp, sym)) + { + s->disp = disp; + s->name = OSMemoryAlloc((UINT)strlen(sym->Name) + 1); + lstrcpy(s->name, sym->Name); + } + else + { + s->disp = 0; + s->name = NULL; + } + + Zero(&line, sizeof(line)); + line.SizeOfStruct = sizeof(line); + if (SymGetLineFromAddr64(hCurrentProcessHandle, s->offset, &disp32, &line)) + { + disp = (UINT64)disp32; + s->line = line.LineNumber; + lstrcpy(s->filename, line.FileName); + Win32GetDirFromPath(tmp, sizeof(tmp), s->filename); + len = lstrlen(tmp); + lstrcpy(tmp, &s->filename[len + 1]); + lstrcpy(s->filename, tmp); + } + else + { + s->line = 0; + s->filename[0] = 0; + } + + OSMemoryFree(sym); + + s->symbol_cache = true; + + return true; +#endif // WIN32_NO_DEBUG_HELP_DLL +} + +// Default Win32 thread +DWORD CALLBACK Win32DefaultThreadProc(void *param) +{ + WIN32THREADSTARTUPINFO *info = (WIN32THREADSTARTUPINFO *)param; + // Validate arguments + if (info == NULL) + { + return 0; + } + + Win32InitNewThread(); + + CoInitialize(NULL); + + // Call the thread function + info->thread_proc(info->thread, info->param); + + // Release the reference + ReleaseThread(info->thread); + + Win32MemoryFree(info); + + FreeOpenSSLThreadState(); + + CoUninitialize(); + + _endthreadex(0); + return 0; +} + +// Wait for the termination of the thread +bool Win32WaitThread(THREAD *t) +{ + WIN32THREAD *w; + // Validate arguments + if (t == NULL) + { + return false; + } + w = (WIN32THREAD *)t->pData; + if (w == NULL) + { + return false; + } + + // Wait for the thread event + if (WaitForSingleObject(w->hThread, INFINITE) == WAIT_OBJECT_0) + { + // The thread was signaled + return true; + } + + // Wait failure (time-out, etc.) + return false; +} + +// Release the thread +void Win32FreeThread(THREAD *t) +{ + WIN32THREAD *w; + // Validate arguments + if (t == NULL) + { + return; + } + w = (WIN32THREAD *)t->pData; + if (w == NULL) + { + return; + } + + // Close the handle + CloseHandle(w->hThread); + + // Memory release + Win32MemoryFree(t->pData); + t->pData = NULL; +} + +// Thread initialization +bool Win32InitThread(THREAD *t) +{ + WIN32THREAD *w; + HANDLE hThread; + DWORD thread_id; + WIN32THREADSTARTUPINFO *info; + // Validate arguments + if (t == NULL) + { + return false; + } + if (t->thread_proc == NULL) + { + return false; + } + + // Thread data generation + w = Win32MemoryAlloc(sizeof(WIN32THREAD)); + + // Creating the startup information + info = Win32MemoryAlloc(sizeof(WIN32THREADSTARTUPINFO)); + info->param = t->param; + info->thread_proc = t->thread_proc; + info->thread = t; + AddRef(t->ref); + + // Thread creation + t->pData = w; + hThread = (HANDLE)_beginthreadex(NULL, 0, Win32DefaultThreadProc, info, 0, &thread_id); + if (hThread == NULL) + { + // Thread creation failure + t->pData = NULL; + Release(t->ref); + Win32MemoryFree(info); + Win32MemoryFree(w); + return false; + } + + // Save the thread information + w->hThread = hThread; + w->thread_id = thread_id; + + return true; +} + +// Initialize the library for Win32 +void Win32Init() +{ + INITCOMMONCONTROLSEX c; + OSVERSIONINFO os; + + // Get whether it's in a Windows NT + Zero(&os, sizeof(os)); + os.dwOSVersionInfoSize = sizeof(os); + GetVersionEx(&os); + + if (os.dwPlatformId == VER_PLATFORM_WIN32_NT) + { + // NT system + win32_is_nt = true; + } + else + { + // 9x system + win32_is_nt = false; + } + + // Open the stdout + if (hstdout == INVALID_HANDLE_VALUE) + { + hstdout = GetStdHandle(STD_OUTPUT_HANDLE); + } + + // Open the stdin + if (hstdin == INVALID_HANDLE_VALUE) + { + hstdin = GetStdHandle(STD_INPUT_HANDLE); + } + + Win32InitNewThread(); + + CoInitialize(NULL); + + InitializeCriticalSection(&fasttick_lock); + +#ifdef WIN32_USE_HEAP_API_FOR_MEMORY + use_heap_api = true; +#else // WIN32_USE_HEAP_API_FOR_MEMORY + use_heap_api = false; +#endif // WIN32_USE_HEAP_API_FOR_MEMORY + + if (MayaquaIsDotNetMode()) + { + // If an heap API is called from .NET API, it might crush + use_heap_api = false; + } + + if (IsNt() == false) + { + // Do not use the heap related API in Win9x + use_heap_api = false; + } + + if (use_heap_api) + { + heap_handle = HeapCreate(0, 0, 0); + } + + // Get the process pseudo handle + hCurrentProcessHandle = GetCurrentProcess(); + + // Initialization of the current directory + // Win32InitCurrentDir(); /* Don't do */ + + // Initialization of the symbol handler + if (IsMemCheck()) + { +#ifndef WIN32_NO_DEBUG_HELP_DLL + SymInitialize(hCurrentProcessHandle, NULL, TRUE); +#endif // WIN32_NO_DEBUG_HELP_DLL + } + + // Initialization of the Common Control + Zero(&c, sizeof(INITCOMMONCONTROLSEX)); + c.dwSize = sizeof(INITCOMMONCONTROLSEX); + c.dwICC = ICC_ANIMATE_CLASS | ICC_BAR_CLASSES | ICC_COOL_CLASSES | + ICC_DATE_CLASSES | ICC_HOTKEY_CLASS | ICC_INTERNET_CLASSES | + ICC_LISTVIEW_CLASSES | ICC_NATIVEFNTCTL_CLASS | + ICC_PAGESCROLLER_CLASS | ICC_PROGRESS_CLASS | + ICC_TAB_CLASSES | ICC_TREEVIEW_CLASSES | ICC_UPDOWN_CLASS | ICC_USEREX_CLASSES | + ICC_WIN95_CLASSES; + InitCommonControlsEx(&c); +} + +// Release the library for Win32 +void Win32Free() +{ + // Close the symbol handler + if (IsMemCheck()) + { +#ifndef WIN32_NO_DEBUG_HELP_DLL + SymCleanup(hCurrentProcessHandle); +#endif // WIN32_NO_DEBUG_HELP_DLL + } + + if (use_heap_api) + { + HeapDestroy(heap_handle); + heap_handle = NULL; + } + + CoUninitialize(); + + DeleteCriticalSection(&fasttick_lock); +} + +// Memory allocation +void *Win32MemoryAlloc(UINT size) +{ + if (use_heap_api) + { + return HeapAlloc(heap_handle, 0, size); + } + else + { + return malloc(size); + } +} + +// Memory reallocation +void *Win32MemoryReAlloc(void *addr, UINT size) +{ + if (use_heap_api) + { + return HeapReAlloc(heap_handle, 0, addr, size); + } + else + { + return realloc(addr, size); + } +} + +// Memory allocation +void Win32MemoryFree(void *addr) +{ + if (use_heap_api) + { + HeapFree(heap_handle, 0, addr); + } + else + { + free(addr); + } +} + +// Get the system timer +UINT Win32GetTick() +{ + return (UINT)timeGetTime(); +} + +// Get the System Time +void Win32GetSystemTime(SYSTEMTIME *system_time) +{ + // Get the System Time + GetSystemTime(system_time); +} + +// Increment of 32bit integer +void Win32Inc32(UINT *value) +{ + InterlockedIncrement(value); +} + +// Decrement of 32bit integer +void Win32Dec32(UINT *value) +{ + InterlockedDecrement(value); +} + +// Sleep the thread +void Win32Sleep(UINT time) +{ + Sleep(time); +} + +// Creating a lock +LOCK *Win32NewLock() +{ + // Memory allocation + LOCK *lock = Win32MemoryAlloc(sizeof(LOCK)); + + // Allocate a critical section + CRITICAL_SECTION *critical_section = Win32MemoryAlloc(sizeof(CRITICAL_SECTION)); + + if (lock == NULL || critical_section == NULL) + { + Win32MemoryFree(lock); + Win32MemoryFree(critical_section); + return NULL; + } + + // Initialize the critical section + InitializeCriticalSection(critical_section); + + lock->pData = (void *)critical_section; + lock->Ready = true; + + return lock; +} + +// Lock +bool Win32Lock(LOCK *lock) +{ + CRITICAL_SECTION *critical_section; + if (lock->Ready == false) + { + // State is invalid + return false; + } + + // Enter the critical section + critical_section = (CRITICAL_SECTION *)lock->pData; + EnterCriticalSection(critical_section); + + return true; +} + +// Unlock +void Win32Unlock(LOCK *lock) +{ + Win32UnlockEx(lock, false); +} +void Win32UnlockEx(LOCK *lock, bool inner) +{ + CRITICAL_SECTION *critical_section; + if (lock->Ready == false && inner == false) + { + // State is invalid + return; + } + + // Leave the critical section + critical_section = (CRITICAL_SECTION *)lock->pData; + LeaveCriticalSection(critical_section); +} + +// Delete the lock +void Win32DeleteLock(LOCK *lock) +{ + CRITICAL_SECTION *critical_section; + // Reset the Ready flag safely + Win32Lock(lock); + lock->Ready = false; + Win32UnlockEx(lock, true); + + // Delete the critical section + critical_section = (CRITICAL_SECTION *)lock->pData; + DeleteCriticalSection(critical_section); + + // Memory release + Win32MemoryFree(critical_section); + Win32MemoryFree(lock); +} + +// Initialization of the event +void Win32InitEvent(EVENT *event) +{ + // Creating an auto-reset event + HANDLE hEvent = CreateEvent(NULL, FALSE, FALSE, NULL); + + event->pData = hEvent; +} + +// Set the event +void Win32SetEvent(EVENT *event) +{ + HANDLE hEvent = (HANDLE)event->pData; + if (hEvent == NULL) + { + return; + } + + SetEvent(hEvent); +} + +// Reset the event +void Win32ResetEvent(EVENT *event) +{ + HANDLE hEvent = (HANDLE)event->pData; + if (hEvent == NULL) + { + return; + } + + ResetEvent(hEvent); +} + +// Wait for the event +bool Win32WaitEvent(EVENT *event, UINT timeout) +{ + HANDLE hEvent = (HANDLE)event->pData; + UINT ret; + if (hEvent == NULL) + { + return false; + } + + // Wait for an object + ret = WaitForSingleObject(hEvent, timeout); + if (ret == WAIT_TIMEOUT) + { + // Time-out + return false; + } + else + { + // Signaled state + return true; + } +} + +// Release of the event +void Win32FreeEvent(EVENT *event) +{ + HANDLE hEvent = (HANDLE)event->pData; + if (hEvent == NULL) + { + return; + } + + CloseHandle(hEvent); +} + +// Fast getting 64 bit Tick functions for only Win32 +UINT64 Win32FastTick64() +{ + static UINT last_tick = 0; + static UINT counter = 0; + UINT64 ret; + UINT tick; + + EnterCriticalSection(&fasttick_lock); + + // Get the current tick value + tick = Win32GetTick(); + + if (last_tick > tick) + { + // When the previously acquired tick value is larger than acquired this time, + // it can be considered that the counter have gone one around + + counter++; + } + + last_tick = tick; + + ret = (UINT64)tick + (UINT64)counter * 4294967296ULL; + + LeaveCriticalSection(&fasttick_lock); + + if (start_tick == 0) + { + start_tick = ret; + ret = 0; + } + else + { + ret -= start_tick; + } + + return ret + 1; +} + +// Read a string from the console +bool Win32InputW(wchar_t *str, UINT size) +{ + bool ret = false; + // Validate arguments + if (str == NULL) + { + return false; + } + if (size == 0) + { + size = 0x7fffffff; + } + + if (str == NULL || size <= sizeof(wchar_t)) + { + if (str != NULL) + { + Zero(str, size); + } + + return Win32InputFromFileW(NULL, 0); + } + + if (IsNt()) + { + DWORD read_size = 0; + + if (ReadConsoleW(hstdin, str, (size / sizeof(wchar_t)) - 1, &read_size, NULL)) + { + str[read_size] = 0; + + UniTrimCrlf(str); + + ret = true; + } + else + { + ret = Win32InputFromFileW(str, size); + } + } + else + { + DWORD read_size = 0; + UINT a_size = size / sizeof(wchar_t) + 16; + char *a; + + a = ZeroMalloc(a_size); + + if (ReadConsoleA(hstdin, a, a_size - 1, &read_size, NULL)) + { + a[read_size] = 0; + + StrToUni(str, size, a); + + UniTrimCrlf(str); + + ret = true; + } + else + { + ret = Win32InputFromFileW(str, size); + } + + Free(a); + } + + return ret; +} +// Get a line from standard input +bool Win32InputFromFileW(wchar_t *str, UINT size) +{ + char *a; + if (str == NULL) + { + wchar_t tmp[MAX_SIZE]; + Win32InputFromFileW(tmp, sizeof(tmp)); + return false; + } + + a = Win32InputFromFileLineA(); + if (a == NULL) + { + UniStrCpy(str, size, L""); + return false; + } + + UtfToUni(str, size, a); + + UniTrimCrlf(str); + + Free(a); + + return true; +} +char *Win32InputFromFileLineA() +{ + BUF *b = NewBuf(); + char zero = 0; + char *ret = NULL; + bool ok = true; + + while (true) + { + char c; + UINT read_size = 0; + + if (ReadFile(hstdin, &c, 1, &read_size, NULL) == false) + { + ok = false; + break; + } + if (read_size != 1) + { + ok = false; + break; + } + + WriteBuf(b, &c, 1); + + if (c == 10) + { + break; + } + } + + WriteBuf(b, &zero, 1); + + if (ok) + { + ret = CopyStr(b->Buf); + } + + FreeBuf(b); + + return ret; +} + +// Print the string to the console +void Win32PrintW(wchar_t *str) +{ + DWORD write_size = 0; + // Validate arguments + if (str == NULL) + { + return; + } + + if (IsNt()) + { + if (WriteConsoleW(hstdout, str, UniStrLen(str), &write_size, NULL) == false) + { + Win32PrintToFileW(str); + } + } + else + { + char *ansi_str = CopyUniToStr(str); + + if (WriteConsoleA(hstdout, ansi_str, StrLen(ansi_str), &write_size, NULL) == false) + { + Win32PrintToFileW(str); + } + + Free(ansi_str); + } +} +void Win32PrintToFileW(wchar_t *str) +{ + char *utf; + DWORD size = 0; + // Validate arguments + if (str == NULL) + { + return; + } + + utf = CopyUniToUtf(str); + + WriteFile(hstdout, utf, StrLen(utf), &size, NULL); + + Free(utf); +} + + +#endif // WIN32 + + diff --git a/src/Mayaqua/Win32.h b/src/Mayaqua/Win32.h index f5655854..ee02f175 100644 --- a/src/Mayaqua/Win32.h +++ b/src/Mayaqua/Win32.h @@ -1,126 +1,126 @@ -// SoftEther VPN Source Code - Developer Edition Master Branch -// Mayaqua Kernel - - -// Win32.h -// Header of Win32.c - -#ifdef OS_WIN32 - -#ifndef WIN32_H -#define WIN32_H - -// Function prototype -OS_DISPATCH_TABLE *Win32GetDispatchTable(); - -void Win32Init(); -void Win32Free(); -void *Win32MemoryAlloc(UINT size); -void *Win32MemoryReAlloc(void *addr, UINT size); -void Win32MemoryFree(void *addr); -UINT Win32GetTick(); -void Win32GetSystemTime(SYSTEMTIME *system_time); -void Win32Inc32(UINT *value); -void Win32Dec32(UINT *value); -void Win32Sleep(UINT time); -LOCK *Win32NewLock(); -bool Win32Lock(LOCK *lock); -void Win32Unlock(LOCK *lock); -void Win32DeleteLock(LOCK *lock); -void Win32InitEvent(EVENT *event); -void Win32SetEvent(EVENT *event); -void Win32ResetEvent(EVENT *event); -bool Win32WaitEvent(EVENT *event, UINT timeout); -void Win32FreeEvent(EVENT *event); -bool Win32WaitThread(THREAD *t); -void Win32FreeThread(THREAD *t); -bool Win32InitThread(THREAD *t); -UINT Win32ThreadId(); -void *Win32FileOpen(char *name, bool write_mode, bool read_lock); -void *Win32FileOpenW(wchar_t *name, bool write_mode, bool read_lock); -void *Win32FileCreate(char *name); -void *Win32FileCreateW(wchar_t *name); -bool Win32FileWrite(void *pData, void *buf, UINT size); -bool Win32FileRead(void *pData, void *buf, UINT size); -bool Win32FileSetDate(void *pData, UINT64 created_time, UINT64 updated_time); -bool Win32FileGetDate(void *pData, UINT64 *created_time, UINT64 *updated_time, UINT64 *accessed_date); -void Win32FileClose(void *pData, bool no_flush); -void Win32FileFlush(void *pData); -UINT64 Win32FileSize(void *pData); -bool Win32FileSeek(void *pData, UINT mode, int offset); -bool Win32FileDelete(char *name); -bool Win32FileDeleteW(wchar_t *name); -bool Win32MakeDir(char *name); -bool Win32MakeDirW(wchar_t *name); -bool Win32DeleteDir(char *name); -bool Win32DeleteDirW(wchar_t *name); -CALLSTACK_DATA *Win32GetCallStack(); -bool Win32GetCallStackSymbolInfo(CALLSTACK_DATA *s); -bool Win32FileRename(char *old_name, char *new_name); -bool Win32FileRenameW(wchar_t *old_name, wchar_t *new_name); -bool Win32Run(char *filename, char *arg, bool hide, bool wait); -bool Win32RunW(wchar_t *filename, wchar_t *arg, bool hide, bool wait); -void *Win32RunEx(char *filename, char *arg, bool hide); -void *Win32RunEx2(char *filename, char *arg, bool hide, UINT *process_id); -void *Win32RunEx3(char *filename, char *arg, bool hide, UINT *process_id, bool disableWow); -void *Win32RunExW(wchar_t *filename, wchar_t *arg, bool hide); -void *Win32RunEx2W(wchar_t *filename, wchar_t *arg, bool hide, UINT *process_id); -void *Win32RunEx3W(wchar_t *filename, wchar_t *arg, bool hide, UINT *process_id, bool disableWow); -bool Win32WaitProcess(void *h, UINT timeout); -bool Win32RunAndWaitProcess(wchar_t *filename, wchar_t *arg, bool hide, bool disableWow, UINT timeout); -bool Win32IsProcessAlive(void *handle); -bool Win32TerminateProcess(void *handle); -void Win32CloseProcess(void *handle); -bool Win32IsSupportedOs(); -void Win32GetOsInfo(OS_INFO *info); -void Win32Alert(char *msg, char *caption); -void Win32AlertW(wchar_t *msg, wchar_t *caption); -void Win32DebugAlert(char *msg); -char* Win32GetProductId(); -void Win32SetHighPriority(); -void Win32RestorePriority(); -void *Win32NewSingleInstance(char *instance_name); -void Win32FreeSingleInstance(void *data); -void Win32GetMemInfo(MEMINFO *info); -void Win32Yield(); - -void Win32UnlockEx(LOCK *lock, bool inner); -UINT Win32GetOsType(); -UINT Win32GetSpVer(char *str); -UINT Win32GetOsSpVer(); -void Win32NukuEn(char *dst, UINT size, char *src); -void Win32NukuEnW(wchar_t *dst, UINT size, wchar_t *src); -void Win32GetDirFromPath(char *dst, UINT size, char *src); -void Win32GetDirFromPathW(wchar_t *dst, UINT size, wchar_t *src); -void Win32GetExeDir(char *name, UINT size); -void Win32GetExeDirW(wchar_t *name, UINT size); -void Win32GetCurrentDir(char *dir, UINT size); -void Win32GetCurrentDirW(wchar_t *dir, UINT size); -void Win32GetExeName(char *name, UINT size); -void Win32GetExeNameW(wchar_t *name, UINT size); -DIRLIST *Win32EnumDirEx(char *dirname, COMPARE *compare); -DIRLIST *Win32EnumDirExW(wchar_t *dirname, COMPARE *compare); -bool Win32GetDiskFreeW(wchar_t *path, UINT64 *free_size, UINT64 *used_size, UINT64 *total_size); -bool Win32GetDiskFree(char *path, UINT64 *free_size, UINT64 *used_size, UINT64 *total_size); -bool Win32SetFolderCompress(char *path, bool compressed); -bool Win32SetFolderCompressW(wchar_t *path, bool compressed); -UINT64 Win32FastTick64(); -void Win32InitNewThread(); -bool Win32IsNt(); -bool Win32InputW(wchar_t *str, UINT size); -bool Win32InputFromFileW(wchar_t *str, UINT size); -char *Win32InputFromFileLineA(); -void Win32PrintW(wchar_t *str); -void Win32PrintToFileW(wchar_t *str); -bool Win32GetVersionExInternal(void *info); -bool Win32GetVersionExInternalForWindows81orLater(void *info); -UINT Win32GetNumberOfCpuInner(); - - -void Win32SetThreadName(UINT thread_id, char *name); - -#endif // WIN32_H - -#endif // OS_WIN32 - - +// SoftEther VPN Source Code - Developer Edition Master Branch +// Mayaqua Kernel + + +// Win32.h +// Header of Win32.c + +#ifdef OS_WIN32 + +#ifndef WIN32_H +#define WIN32_H + +// Function prototype +OS_DISPATCH_TABLE *Win32GetDispatchTable(); + +void Win32Init(); +void Win32Free(); +void *Win32MemoryAlloc(UINT size); +void *Win32MemoryReAlloc(void *addr, UINT size); +void Win32MemoryFree(void *addr); +UINT Win32GetTick(); +void Win32GetSystemTime(SYSTEMTIME *system_time); +void Win32Inc32(UINT *value); +void Win32Dec32(UINT *value); +void Win32Sleep(UINT time); +LOCK *Win32NewLock(); +bool Win32Lock(LOCK *lock); +void Win32Unlock(LOCK *lock); +void Win32DeleteLock(LOCK *lock); +void Win32InitEvent(EVENT *event); +void Win32SetEvent(EVENT *event); +void Win32ResetEvent(EVENT *event); +bool Win32WaitEvent(EVENT *event, UINT timeout); +void Win32FreeEvent(EVENT *event); +bool Win32WaitThread(THREAD *t); +void Win32FreeThread(THREAD *t); +bool Win32InitThread(THREAD *t); +UINT Win32ThreadId(); +void *Win32FileOpen(char *name, bool write_mode, bool read_lock); +void *Win32FileOpenW(wchar_t *name, bool write_mode, bool read_lock); +void *Win32FileCreate(char *name); +void *Win32FileCreateW(wchar_t *name); +bool Win32FileWrite(void *pData, void *buf, UINT size); +bool Win32FileRead(void *pData, void *buf, UINT size); +bool Win32FileSetDate(void *pData, UINT64 created_time, UINT64 updated_time); +bool Win32FileGetDate(void *pData, UINT64 *created_time, UINT64 *updated_time, UINT64 *accessed_date); +void Win32FileClose(void *pData, bool no_flush); +void Win32FileFlush(void *pData); +UINT64 Win32FileSize(void *pData); +bool Win32FileSeek(void *pData, UINT mode, int offset); +bool Win32FileDelete(char *name); +bool Win32FileDeleteW(wchar_t *name); +bool Win32MakeDir(char *name); +bool Win32MakeDirW(wchar_t *name); +bool Win32DeleteDir(char *name); +bool Win32DeleteDirW(wchar_t *name); +CALLSTACK_DATA *Win32GetCallStack(); +bool Win32GetCallStackSymbolInfo(CALLSTACK_DATA *s); +bool Win32FileRename(char *old_name, char *new_name); +bool Win32FileRenameW(wchar_t *old_name, wchar_t *new_name); +bool Win32Run(char *filename, char *arg, bool hide, bool wait); +bool Win32RunW(wchar_t *filename, wchar_t *arg, bool hide, bool wait); +void *Win32RunEx(char *filename, char *arg, bool hide); +void *Win32RunEx2(char *filename, char *arg, bool hide, UINT *process_id); +void *Win32RunEx3(char *filename, char *arg, bool hide, UINT *process_id, bool disableWow); +void *Win32RunExW(wchar_t *filename, wchar_t *arg, bool hide); +void *Win32RunEx2W(wchar_t *filename, wchar_t *arg, bool hide, UINT *process_id); +void *Win32RunEx3W(wchar_t *filename, wchar_t *arg, bool hide, UINT *process_id, bool disableWow); +bool Win32WaitProcess(void *h, UINT timeout); +bool Win32RunAndWaitProcess(wchar_t *filename, wchar_t *arg, bool hide, bool disableWow, UINT timeout); +bool Win32IsProcessAlive(void *handle); +bool Win32TerminateProcess(void *handle); +void Win32CloseProcess(void *handle); +bool Win32IsSupportedOs(); +void Win32GetOsInfo(OS_INFO *info); +void Win32Alert(char *msg, char *caption); +void Win32AlertW(wchar_t *msg, wchar_t *caption); +void Win32DebugAlert(char *msg); +char* Win32GetProductId(); +void Win32SetHighPriority(); +void Win32RestorePriority(); +void *Win32NewSingleInstance(char *instance_name); +void Win32FreeSingleInstance(void *data); +void Win32GetMemInfo(MEMINFO *info); +void Win32Yield(); + +void Win32UnlockEx(LOCK *lock, bool inner); +UINT Win32GetOsType(); +UINT Win32GetSpVer(char *str); +UINT Win32GetOsSpVer(); +void Win32NukuEn(char *dst, UINT size, char *src); +void Win32NukuEnW(wchar_t *dst, UINT size, wchar_t *src); +void Win32GetDirFromPath(char *dst, UINT size, char *src); +void Win32GetDirFromPathW(wchar_t *dst, UINT size, wchar_t *src); +void Win32GetExeDir(char *name, UINT size); +void Win32GetExeDirW(wchar_t *name, UINT size); +void Win32GetCurrentDir(char *dir, UINT size); +void Win32GetCurrentDirW(wchar_t *dir, UINT size); +void Win32GetExeName(char *name, UINT size); +void Win32GetExeNameW(wchar_t *name, UINT size); +DIRLIST *Win32EnumDirEx(char *dirname, COMPARE *compare); +DIRLIST *Win32EnumDirExW(wchar_t *dirname, COMPARE *compare); +bool Win32GetDiskFreeW(wchar_t *path, UINT64 *free_size, UINT64 *used_size, UINT64 *total_size); +bool Win32GetDiskFree(char *path, UINT64 *free_size, UINT64 *used_size, UINT64 *total_size); +bool Win32SetFolderCompress(char *path, bool compressed); +bool Win32SetFolderCompressW(wchar_t *path, bool compressed); +UINT64 Win32FastTick64(); +void Win32InitNewThread(); +bool Win32IsNt(); +bool Win32InputW(wchar_t *str, UINT size); +bool Win32InputFromFileW(wchar_t *str, UINT size); +char *Win32InputFromFileLineA(); +void Win32PrintW(wchar_t *str); +void Win32PrintToFileW(wchar_t *str); +bool Win32GetVersionExInternal(void *info); +bool Win32GetVersionExInternalForWindows81orLater(void *info); +UINT Win32GetNumberOfCpuInner(); + + +void Win32SetThreadName(UINT thread_id, char *name); + +#endif // WIN32_H + +#endif // OS_WIN32 + + diff --git a/src/Mayaqua/cryptoki.h b/src/Mayaqua/cryptoki.h index 7d85ca80..f457b3e9 100644 --- a/src/Mayaqua/cryptoki.h +++ b/src/Mayaqua/cryptoki.h @@ -1,66 +1,66 @@ -/* cryptoki.h include file for PKCS #11. */ -/* $Revision: 1.4 $ */ - -/* License to copy and use this software is granted provided that it is - * identified as "RSA Security Inc. PKCS #11 Cryptographic Token Interface - * (Cryptoki)" in all material mentioning or referencing this software. - - * License is also granted to make and use derivative works provided that - * such works are identified as "derived from the RSA Security Inc. PKCS #11 - * Cryptographic Token Interface (Cryptoki)" in all material mentioning or - * referencing the derived work. - - * RSA Security Inc. makes no representations concerning either the - * merchantability of this software or the suitability of this software for - * any particular purpose. It is provided "as is" without express or implied - * warranty of any kind. - */ - -/* This is a sample file containing the top level include directives - * for building Win32 Cryptoki libraries and applications. - */ - -#ifndef ___CRYPTOKI_H_INC___ -#define ___CRYPTOKI_H_INC___ - -#pragma pack(push, cryptoki, 1) - -/* Specifies that the function is a DLL entry point. */ -#define CK_IMPORT_SPEC __declspec(dllimport) - -/* Define CRYPTOKI_EXPORTS during the build of cryptoki libraries. Do - * not define it in applications. - */ -#ifdef CRYPTOKI_EXPORTS -/* Specified that the function is an exported DLL entry point. */ -#define CK_EXPORT_SPEC __declspec(dllexport) -#else -#define CK_EXPORT_SPEC CK_IMPORT_SPEC -#endif - -/* Ensures the calling convention for Win32 builds */ -#define CK_CALL_SPEC __cdecl - -#define CK_PTR * - -#define CK_DEFINE_FUNCTION(returnType, name) \ - returnType CK_EXPORT_SPEC CK_CALL_SPEC name - -#define CK_DECLARE_FUNCTION(returnType, name) \ - returnType CK_EXPORT_SPEC CK_CALL_SPEC name - -#define CK_DECLARE_FUNCTION_POINTER(returnType, name) \ - returnType CK_IMPORT_SPEC (CK_CALL_SPEC CK_PTR name) - -#define CK_CALLBACK_FUNCTION(returnType, name) \ - returnType (CK_CALL_SPEC CK_PTR name) - -#ifndef NULL_PTR -#define NULL_PTR 0 -#endif - -#include "pkcs11.h" - -#pragma pack(pop, cryptoki) - -#endif /* ___CRYPTOKI_H_INC___ */ +/* cryptoki.h include file for PKCS #11. */ +/* $Revision: 1.4 $ */ + +/* License to copy and use this software is granted provided that it is + * identified as "RSA Security Inc. PKCS #11 Cryptographic Token Interface + * (Cryptoki)" in all material mentioning or referencing this software. + + * License is also granted to make and use derivative works provided that + * such works are identified as "derived from the RSA Security Inc. PKCS #11 + * Cryptographic Token Interface (Cryptoki)" in all material mentioning or + * referencing the derived work. + + * RSA Security Inc. makes no representations concerning either the + * merchantability of this software or the suitability of this software for + * any particular purpose. It is provided "as is" without express or implied + * warranty of any kind. + */ + +/* This is a sample file containing the top level include directives + * for building Win32 Cryptoki libraries and applications. + */ + +#ifndef ___CRYPTOKI_H_INC___ +#define ___CRYPTOKI_H_INC___ + +#pragma pack(push, cryptoki, 1) + +/* Specifies that the function is a DLL entry point. */ +#define CK_IMPORT_SPEC __declspec(dllimport) + +/* Define CRYPTOKI_EXPORTS during the build of cryptoki libraries. Do + * not define it in applications. + */ +#ifdef CRYPTOKI_EXPORTS +/* Specified that the function is an exported DLL entry point. */ +#define CK_EXPORT_SPEC __declspec(dllexport) +#else +#define CK_EXPORT_SPEC CK_IMPORT_SPEC +#endif + +/* Ensures the calling convention for Win32 builds */ +#define CK_CALL_SPEC __cdecl + +#define CK_PTR * + +#define CK_DEFINE_FUNCTION(returnType, name) \ + returnType CK_EXPORT_SPEC CK_CALL_SPEC name + +#define CK_DECLARE_FUNCTION(returnType, name) \ + returnType CK_EXPORT_SPEC CK_CALL_SPEC name + +#define CK_DECLARE_FUNCTION_POINTER(returnType, name) \ + returnType CK_IMPORT_SPEC (CK_CALL_SPEC CK_PTR name) + +#define CK_CALLBACK_FUNCTION(returnType, name) \ + returnType (CK_CALL_SPEC CK_PTR name) + +#ifndef NULL_PTR +#define NULL_PTR 0 +#endif + +#include "pkcs11.h" + +#pragma pack(pop, cryptoki) + +#endif /* ___CRYPTOKI_H_INC___ */ diff --git a/src/Mayaqua/pkcs11.h b/src/Mayaqua/pkcs11.h index 5afbb7ac..6c612204 100644 --- a/src/Mayaqua/pkcs11.h +++ b/src/Mayaqua/pkcs11.h @@ -1,299 +1,299 @@ -/* pkcs11.h include file for PKCS #11. */ -/* $Revision: 1.4 $ */ - -/* License to copy and use this software is granted provided that it is - * identified as "RSA Security Inc. PKCS #11 Cryptographic Token Interface - * (Cryptoki)" in all material mentioning or referencing this software. - - * License is also granted to make and use derivative works provided that - * such works are identified as "derived from the RSA Security Inc. PKCS #11 - * Cryptographic Token Interface (Cryptoki)" in all material mentioning or - * referencing the derived work. - - * RSA Security Inc. makes no representations concerning either the - * merchantability of this software or the suitability of this software for - * any particular purpose. It is provided "as is" without express or implied - * warranty of any kind. - */ - -#ifndef _PKCS11_H_ -#define _PKCS11_H_ 1 - -#ifdef __cplusplus -extern "C" { -#endif - -/* Before including this file (pkcs11.h) (or pkcs11t.h by - * itself), 6 platform-specific macros must be defined. These - * macros are described below, and typical definitions for them - * are also given. Be advised that these definitions can depend - * on both the platform and the compiler used (and possibly also - * on whether a Cryptoki library is linked statically or - * dynamically). - * - * In addition to defining these 6 macros, the packing convention - * for Cryptoki structures should be set. The Cryptoki - * convention on packing is that structures should be 1-byte - * aligned. - * - * If you're using Microsoft Developer Studio 5.0 to produce - * Win32 stuff, this might be done by using the following - * preprocessor directive before including pkcs11.h or pkcs11t.h: - * - * #pragma pack(push, cryptoki, 1) - * - * and using the following preprocessor directive after including - * pkcs11.h or pkcs11t.h: - * - * #pragma pack(pop, cryptoki) - * - * If you're using an earlier version of Microsoft Developer - * Studio to produce Win16 stuff, this might be done by using - * the following preprocessor directive before including - * pkcs11.h or pkcs11t.h: - * - * #pragma pack(1) - * - * In a UNIX environment, you're on your own for this. You might - * not need to do (or be able to do!) anything. - * - * - * Now for the macros: - * - * - * 1. CK_PTR: The indirection string for making a pointer to an - * object. It can be used like this: - * - * typedef CK_BYTE CK_PTR CK_BYTE_PTR; - * - * If you're using Microsoft Developer Studio 5.0 to produce - * Win32 stuff, it might be defined by: - * - * #define CK_PTR * - * - * If you're using an earlier version of Microsoft Developer - * Studio to produce Win16 stuff, it might be defined by: - * - * #define CK_PTR far * - * - * In a typical UNIX environment, it might be defined by: - * - * #define CK_PTR * - * - * - * 2. CK_DEFINE_FUNCTION(returnType, name): A macro which makes - * an exportable Cryptoki library function definition out of a - * return type and a function name. It should be used in the - * following fashion to define the exposed Cryptoki functions in - * a Cryptoki library: - * - * CK_DEFINE_FUNCTION(CK_RV, C_Initialize)( - * CK_VOID_PTR pReserved - * ) - * { - * ... - * } - * - * If you're using Microsoft Developer Studio 5.0 to define a - * function in a Win32 Cryptoki .dll, it might be defined by: - * - * #define CK_DEFINE_FUNCTION(returnType, name) \ - * returnType __declspec(dllexport) name - * - * If you're using an earlier version of Microsoft Developer - * Studio to define a function in a Win16 Cryptoki .dll, it - * might be defined by: - * - * #define CK_DEFINE_FUNCTION(returnType, name) \ - * returnType __export _far _pascal name - * - * In a UNIX environment, it might be defined by: - * - * #define CK_DEFINE_FUNCTION(returnType, name) \ - * returnType name - * - * - * 3. CK_DECLARE_FUNCTION(returnType, name): A macro which makes - * an importable Cryptoki library function declaration out of a - * return type and a function name. It should be used in the - * following fashion: - * - * extern CK_DECLARE_FUNCTION(CK_RV, C_Initialize)( - * CK_VOID_PTR pReserved - * ); - * - * If you're using Microsoft Developer Studio 5.0 to declare a - * function in a Win32 Cryptoki .dll, it might be defined by: - * - * #define CK_DECLARE_FUNCTION(returnType, name) \ - * returnType __declspec(dllimport) name - * - * If you're using an earlier version of Microsoft Developer - * Studio to declare a function in a Win16 Cryptoki .dll, it - * might be defined by: - * - * #define CK_DECLARE_FUNCTION(returnType, name) \ - * returnType __export _far _pascal name - * - * In a UNIX environment, it might be defined by: - * - * #define CK_DECLARE_FUNCTION(returnType, name) \ - * returnType name - * - * - * 4. CK_DECLARE_FUNCTION_POINTER(returnType, name): A macro - * which makes a Cryptoki API function pointer declaration or - * function pointer type declaration out of a return type and a - * function name. It should be used in the following fashion: - * - * // Define funcPtr to be a pointer to a Cryptoki API function - * // taking arguments args and returning CK_RV. - * CK_DECLARE_FUNCTION_POINTER(CK_RV, funcPtr)(args); - * - * or - * - * // Define funcPtrType to be the type of a pointer to a - * // Cryptoki API function taking arguments args and returning - * // CK_RV, and then define funcPtr to be a variable of type - * // funcPtrType. - * typedef CK_DECLARE_FUNCTION_POINTER(CK_RV, funcPtrType)(args); - * funcPtrType funcPtr; - * - * If you're using Microsoft Developer Studio 5.0 to access - * functions in a Win32 Cryptoki .dll, in might be defined by: - * - * #define CK_DECLARE_FUNCTION_POINTER(returnType, name) \ - * returnType __declspec(dllimport) (* name) - * - * If you're using an earlier version of Microsoft Developer - * Studio to access functions in a Win16 Cryptoki .dll, it might - * be defined by: - * - * #define CK_DECLARE_FUNCTION_POINTER(returnType, name) \ - * returnType __export _far _pascal (* name) - * - * In a UNIX environment, it might be defined by: - * - * #define CK_DECLARE_FUNCTION_POINTER(returnType, name) \ - * returnType (* name) - * - * - * 5. CK_CALLBACK_FUNCTION(returnType, name): A macro which makes - * a function pointer type for an application callback out of - * a return type for the callback and a name for the callback. - * It should be used in the following fashion: - * - * CK_CALLBACK_FUNCTION(CK_RV, myCallback)(args); - * - * to declare a function pointer, myCallback, to a callback - * which takes arguments args and returns a CK_RV. It can also - * be used like this: - * - * typedef CK_CALLBACK_FUNCTION(CK_RV, myCallbackType)(args); - * myCallbackType myCallback; - * - * If you're using Microsoft Developer Studio 5.0 to do Win32 - * Cryptoki development, it might be defined by: - * - * #define CK_CALLBACK_FUNCTION(returnType, name) \ - * returnType (* name) - * - * If you're using an earlier version of Microsoft Developer - * Studio to do Win16 development, it might be defined by: - * - * #define CK_CALLBACK_FUNCTION(returnType, name) \ - * returnType _far _pascal (* name) - * - * In a UNIX environment, it might be defined by: - * - * #define CK_CALLBACK_FUNCTION(returnType, name) \ - * returnType (* name) - * - * - * 6. NULL_PTR: This macro is the value of a NULL pointer. - * - * In any ANSI/ISO C environment (and in many others as well), - * this should best be defined by - * - * #ifndef NULL_PTR - * #define NULL_PTR 0 - * #endif - */ - - -/* All the various Cryptoki types and #define'd values are in the - * file pkcs11t.h. */ -#include "pkcs11t.h" - -#define __PASTE(x,y) x##y - - -/* ============================================================== - * Define the "extern" form of all the entry points. - * ============================================================== - */ - -#define CK_NEED_ARG_LIST 1 -#define CK_PKCS11_FUNCTION_INFO(name) \ - extern CK_DECLARE_FUNCTION(CK_RV, name) - -/* pkcs11f.h has all the information about the Cryptoki - * function prototypes. */ -#include "pkcs11f.h" - -#undef CK_NEED_ARG_LIST -#undef CK_PKCS11_FUNCTION_INFO - - -/* ============================================================== - * Define the typedef form of all the entry points. That is, for - * each Cryptoki function C_XXX, define a type CK_C_XXX which is - * a pointer to that kind of function. - * ============================================================== - */ - -#define CK_NEED_ARG_LIST 1 -#define CK_PKCS11_FUNCTION_INFO(name) \ - typedef CK_DECLARE_FUNCTION_POINTER(CK_RV, __PASTE(CK_,name)) - -/* pkcs11f.h has all the information about the Cryptoki - * function prototypes. */ -#include "pkcs11f.h" - -#undef CK_NEED_ARG_LIST -#undef CK_PKCS11_FUNCTION_INFO - - -/* ============================================================== - * Define structed vector of entry points. A CK_FUNCTION_LIST - * contains a CK_VERSION indicating a library's Cryptoki version - * and then a whole slew of function pointers to the routines in - * the library. This type was declared, but not defined, in - * pkcs11t.h. - * ============================================================== - */ - -#define CK_PKCS11_FUNCTION_INFO(name) \ - __PASTE(CK_,name) name; - -struct CK_FUNCTION_LIST { - - CK_VERSION version; /* Cryptoki version */ - -/* Pile all the function pointers into the CK_FUNCTION_LIST. */ -/* pkcs11f.h has all the information about the Cryptoki - * function prototypes. */ -#include "pkcs11f.h" - -}; - -#undef CK_PKCS11_FUNCTION_INFO - - -#undef __PASTE - -#ifdef __cplusplus -} -#endif - -#endif +/* pkcs11.h include file for PKCS #11. */ +/* $Revision: 1.4 $ */ + +/* License to copy and use this software is granted provided that it is + * identified as "RSA Security Inc. PKCS #11 Cryptographic Token Interface + * (Cryptoki)" in all material mentioning or referencing this software. + + * License is also granted to make and use derivative works provided that + * such works are identified as "derived from the RSA Security Inc. PKCS #11 + * Cryptographic Token Interface (Cryptoki)" in all material mentioning or + * referencing the derived work. + + * RSA Security Inc. makes no representations concerning either the + * merchantability of this software or the suitability of this software for + * any particular purpose. It is provided "as is" without express or implied + * warranty of any kind. + */ + +#ifndef _PKCS11_H_ +#define _PKCS11_H_ 1 + +#ifdef __cplusplus +extern "C" { +#endif + +/* Before including this file (pkcs11.h) (or pkcs11t.h by + * itself), 6 platform-specific macros must be defined. These + * macros are described below, and typical definitions for them + * are also given. Be advised that these definitions can depend + * on both the platform and the compiler used (and possibly also + * on whether a Cryptoki library is linked statically or + * dynamically). + * + * In addition to defining these 6 macros, the packing convention + * for Cryptoki structures should be set. The Cryptoki + * convention on packing is that structures should be 1-byte + * aligned. + * + * If you're using Microsoft Developer Studio 5.0 to produce + * Win32 stuff, this might be done by using the following + * preprocessor directive before including pkcs11.h or pkcs11t.h: + * + * #pragma pack(push, cryptoki, 1) + * + * and using the following preprocessor directive after including + * pkcs11.h or pkcs11t.h: + * + * #pragma pack(pop, cryptoki) + * + * If you're using an earlier version of Microsoft Developer + * Studio to produce Win16 stuff, this might be done by using + * the following preprocessor directive before including + * pkcs11.h or pkcs11t.h: + * + * #pragma pack(1) + * + * In a UNIX environment, you're on your own for this. You might + * not need to do (or be able to do!) anything. + * + * + * Now for the macros: + * + * + * 1. CK_PTR: The indirection string for making a pointer to an + * object. It can be used like this: + * + * typedef CK_BYTE CK_PTR CK_BYTE_PTR; + * + * If you're using Microsoft Developer Studio 5.0 to produce + * Win32 stuff, it might be defined by: + * + * #define CK_PTR * + * + * If you're using an earlier version of Microsoft Developer + * Studio to produce Win16 stuff, it might be defined by: + * + * #define CK_PTR far * + * + * In a typical UNIX environment, it might be defined by: + * + * #define CK_PTR * + * + * + * 2. CK_DEFINE_FUNCTION(returnType, name): A macro which makes + * an exportable Cryptoki library function definition out of a + * return type and a function name. It should be used in the + * following fashion to define the exposed Cryptoki functions in + * a Cryptoki library: + * + * CK_DEFINE_FUNCTION(CK_RV, C_Initialize)( + * CK_VOID_PTR pReserved + * ) + * { + * ... + * } + * + * If you're using Microsoft Developer Studio 5.0 to define a + * function in a Win32 Cryptoki .dll, it might be defined by: + * + * #define CK_DEFINE_FUNCTION(returnType, name) \ + * returnType __declspec(dllexport) name + * + * If you're using an earlier version of Microsoft Developer + * Studio to define a function in a Win16 Cryptoki .dll, it + * might be defined by: + * + * #define CK_DEFINE_FUNCTION(returnType, name) \ + * returnType __export _far _pascal name + * + * In a UNIX environment, it might be defined by: + * + * #define CK_DEFINE_FUNCTION(returnType, name) \ + * returnType name + * + * + * 3. CK_DECLARE_FUNCTION(returnType, name): A macro which makes + * an importable Cryptoki library function declaration out of a + * return type and a function name. It should be used in the + * following fashion: + * + * extern CK_DECLARE_FUNCTION(CK_RV, C_Initialize)( + * CK_VOID_PTR pReserved + * ); + * + * If you're using Microsoft Developer Studio 5.0 to declare a + * function in a Win32 Cryptoki .dll, it might be defined by: + * + * #define CK_DECLARE_FUNCTION(returnType, name) \ + * returnType __declspec(dllimport) name + * + * If you're using an earlier version of Microsoft Developer + * Studio to declare a function in a Win16 Cryptoki .dll, it + * might be defined by: + * + * #define CK_DECLARE_FUNCTION(returnType, name) \ + * returnType __export _far _pascal name + * + * In a UNIX environment, it might be defined by: + * + * #define CK_DECLARE_FUNCTION(returnType, name) \ + * returnType name + * + * + * 4. CK_DECLARE_FUNCTION_POINTER(returnType, name): A macro + * which makes a Cryptoki API function pointer declaration or + * function pointer type declaration out of a return type and a + * function name. It should be used in the following fashion: + * + * // Define funcPtr to be a pointer to a Cryptoki API function + * // taking arguments args and returning CK_RV. + * CK_DECLARE_FUNCTION_POINTER(CK_RV, funcPtr)(args); + * + * or + * + * // Define funcPtrType to be the type of a pointer to a + * // Cryptoki API function taking arguments args and returning + * // CK_RV, and then define funcPtr to be a variable of type + * // funcPtrType. + * typedef CK_DECLARE_FUNCTION_POINTER(CK_RV, funcPtrType)(args); + * funcPtrType funcPtr; + * + * If you're using Microsoft Developer Studio 5.0 to access + * functions in a Win32 Cryptoki .dll, in might be defined by: + * + * #define CK_DECLARE_FUNCTION_POINTER(returnType, name) \ + * returnType __declspec(dllimport) (* name) + * + * If you're using an earlier version of Microsoft Developer + * Studio to access functions in a Win16 Cryptoki .dll, it might + * be defined by: + * + * #define CK_DECLARE_FUNCTION_POINTER(returnType, name) \ + * returnType __export _far _pascal (* name) + * + * In a UNIX environment, it might be defined by: + * + * #define CK_DECLARE_FUNCTION_POINTER(returnType, name) \ + * returnType (* name) + * + * + * 5. CK_CALLBACK_FUNCTION(returnType, name): A macro which makes + * a function pointer type for an application callback out of + * a return type for the callback and a name for the callback. + * It should be used in the following fashion: + * + * CK_CALLBACK_FUNCTION(CK_RV, myCallback)(args); + * + * to declare a function pointer, myCallback, to a callback + * which takes arguments args and returns a CK_RV. It can also + * be used like this: + * + * typedef CK_CALLBACK_FUNCTION(CK_RV, myCallbackType)(args); + * myCallbackType myCallback; + * + * If you're using Microsoft Developer Studio 5.0 to do Win32 + * Cryptoki development, it might be defined by: + * + * #define CK_CALLBACK_FUNCTION(returnType, name) \ + * returnType (* name) + * + * If you're using an earlier version of Microsoft Developer + * Studio to do Win16 development, it might be defined by: + * + * #define CK_CALLBACK_FUNCTION(returnType, name) \ + * returnType _far _pascal (* name) + * + * In a UNIX environment, it might be defined by: + * + * #define CK_CALLBACK_FUNCTION(returnType, name) \ + * returnType (* name) + * + * + * 6. NULL_PTR: This macro is the value of a NULL pointer. + * + * In any ANSI/ISO C environment (and in many others as well), + * this should best be defined by + * + * #ifndef NULL_PTR + * #define NULL_PTR 0 + * #endif + */ + + +/* All the various Cryptoki types and #define'd values are in the + * file pkcs11t.h. */ +#include "pkcs11t.h" + +#define __PASTE(x,y) x##y + + +/* ============================================================== + * Define the "extern" form of all the entry points. + * ============================================================== + */ + +#define CK_NEED_ARG_LIST 1 +#define CK_PKCS11_FUNCTION_INFO(name) \ + extern CK_DECLARE_FUNCTION(CK_RV, name) + +/* pkcs11f.h has all the information about the Cryptoki + * function prototypes. */ +#include "pkcs11f.h" + +#undef CK_NEED_ARG_LIST +#undef CK_PKCS11_FUNCTION_INFO + + +/* ============================================================== + * Define the typedef form of all the entry points. That is, for + * each Cryptoki function C_XXX, define a type CK_C_XXX which is + * a pointer to that kind of function. + * ============================================================== + */ + +#define CK_NEED_ARG_LIST 1 +#define CK_PKCS11_FUNCTION_INFO(name) \ + typedef CK_DECLARE_FUNCTION_POINTER(CK_RV, __PASTE(CK_,name)) + +/* pkcs11f.h has all the information about the Cryptoki + * function prototypes. */ +#include "pkcs11f.h" + +#undef CK_NEED_ARG_LIST +#undef CK_PKCS11_FUNCTION_INFO + + +/* ============================================================== + * Define structed vector of entry points. A CK_FUNCTION_LIST + * contains a CK_VERSION indicating a library's Cryptoki version + * and then a whole slew of function pointers to the routines in + * the library. This type was declared, but not defined, in + * pkcs11t.h. + * ============================================================== + */ + +#define CK_PKCS11_FUNCTION_INFO(name) \ + __PASTE(CK_,name) name; + +struct CK_FUNCTION_LIST { + + CK_VERSION version; /* Cryptoki version */ + +/* Pile all the function pointers into the CK_FUNCTION_LIST. */ +/* pkcs11f.h has all the information about the Cryptoki + * function prototypes. */ +#include "pkcs11f.h" + +}; + +#undef CK_PKCS11_FUNCTION_INFO + + +#undef __PASTE + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/src/Mayaqua/pkcs11f.h b/src/Mayaqua/pkcs11f.h index 30097535..a479384e 100644 --- a/src/Mayaqua/pkcs11f.h +++ b/src/Mayaqua/pkcs11f.h @@ -1,912 +1,912 @@ -/* pkcs11f.h include file for PKCS #11. */ -/* $Revision: 1.4 $ */ - -/* License to copy and use this software is granted provided that it is - * identified as "RSA Security Inc. PKCS #11 Cryptographic Token Interface - * (Cryptoki)" in all material mentioning or referencing this software. - - * License is also granted to make and use derivative works provided that - * such works are identified as "derived from the RSA Security Inc. PKCS #11 - * Cryptographic Token Interface (Cryptoki)" in all material mentioning or - * referencing the derived work. - - * RSA Security Inc. makes no representations concerning either the - * merchantability of this software or the suitability of this software for - * any particular purpose. It is provided "as is" without express or implied - * warranty of any kind. - */ - -/* This header file contains pretty much everything about all the */ -/* Cryptoki function prototypes. Because this information is */ -/* used for more than just declaring function prototypes, the */ -/* order of the functions appearing herein is important, and */ -/* should not be altered. */ - -/* General-purpose */ - -/* C_Initialize initializes the Cryptoki library. */ -CK_PKCS11_FUNCTION_INFO(C_Initialize) -#ifdef CK_NEED_ARG_LIST -( - CK_VOID_PTR pInitArgs /* if this is not NULL_PTR, it gets - * cast to CK_C_INITIALIZE_ARGS_PTR - * and dereferenced */ -); -#endif - - -/* C_Finalize indicates that an application is done with the - * Cryptoki library. */ -CK_PKCS11_FUNCTION_INFO(C_Finalize) -#ifdef CK_NEED_ARG_LIST -( - CK_VOID_PTR pReserved /* reserved. Should be NULL_PTR */ -); -#endif - - -/* C_GetInfo returns general information about Cryptoki. */ -CK_PKCS11_FUNCTION_INFO(C_GetInfo) -#ifdef CK_NEED_ARG_LIST -( - CK_INFO_PTR pInfo /* location that receives information */ -); -#endif - - -/* C_GetFunctionList returns the function list. */ -CK_PKCS11_FUNCTION_INFO(C_GetFunctionList) -#ifdef CK_NEED_ARG_LIST -( - CK_FUNCTION_LIST_PTR_PTR ppFunctionList /* receives pointer to - * function list */ -); -#endif - - - -/* Slot and token management */ - -/* C_GetSlotList obtains a list of slots in the system. */ -CK_PKCS11_FUNCTION_INFO(C_GetSlotList) -#ifdef CK_NEED_ARG_LIST -( - CK_BBOOL tokenPresent, /* only slots with tokens? */ - CK_SLOT_ID_PTR pSlotList, /* receives array of slot IDs */ - CK_ULONG_PTR pulCount /* receives number of slots */ -); -#endif - - -/* C_GetSlotInfo obtains information about a particular slot in - * the system. */ -CK_PKCS11_FUNCTION_INFO(C_GetSlotInfo) -#ifdef CK_NEED_ARG_LIST -( - CK_SLOT_ID slotID, /* the ID of the slot */ - CK_SLOT_INFO_PTR pInfo /* receives the slot information */ -); -#endif - - -/* C_GetTokenInfo obtains information about a particular token - * in the system. */ -CK_PKCS11_FUNCTION_INFO(C_GetTokenInfo) -#ifdef CK_NEED_ARG_LIST -( - CK_SLOT_ID slotID, /* ID of the token's slot */ - CK_TOKEN_INFO_PTR pInfo /* receives the token information */ -); -#endif - - -/* C_GetMechanismList obtains a list of mechanism types - * supported by a token. */ -CK_PKCS11_FUNCTION_INFO(C_GetMechanismList) -#ifdef CK_NEED_ARG_LIST -( - CK_SLOT_ID slotID, /* ID of token's slot */ - CK_MECHANISM_TYPE_PTR pMechanismList, /* gets mech. array */ - CK_ULONG_PTR pulCount /* gets # of mechs. */ -); -#endif - - -/* C_GetMechanismInfo obtains information about a particular - * mechanism possibly supported by a token. */ -CK_PKCS11_FUNCTION_INFO(C_GetMechanismInfo) -#ifdef CK_NEED_ARG_LIST -( - CK_SLOT_ID slotID, /* ID of the token's slot */ - CK_MECHANISM_TYPE type, /* type of mechanism */ - CK_MECHANISM_INFO_PTR pInfo /* receives mechanism info */ -); -#endif - - -/* C_InitToken initializes a token. */ -CK_PKCS11_FUNCTION_INFO(C_InitToken) -#ifdef CK_NEED_ARG_LIST -/* pLabel changed from CK_CHAR_PTR to CK_UTF8CHAR_PTR for v2.10 */ -( - CK_SLOT_ID slotID, /* ID of the token's slot */ - CK_UTF8CHAR_PTR pPin, /* the SO's initial PIN */ - CK_ULONG ulPinLen, /* length in bytes of the PIN */ - CK_UTF8CHAR_PTR pLabel /* 32-byte token label (blank padded) */ -); -#endif - - -/* C_InitPIN initializes the normal user's PIN. */ -CK_PKCS11_FUNCTION_INFO(C_InitPIN) -#ifdef CK_NEED_ARG_LIST -( - CK_SESSION_HANDLE hSession, /* the session's handle */ - CK_UTF8CHAR_PTR pPin, /* the normal user's PIN */ - CK_ULONG ulPinLen /* length in bytes of the PIN */ -); -#endif - - -/* C_SetPIN modifies the PIN of the user who is logged in. */ -CK_PKCS11_FUNCTION_INFO(C_SetPIN) -#ifdef CK_NEED_ARG_LIST -( - CK_SESSION_HANDLE hSession, /* the session's handle */ - CK_UTF8CHAR_PTR pOldPin, /* the old PIN */ - CK_ULONG ulOldLen, /* length of the old PIN */ - CK_UTF8CHAR_PTR pNewPin, /* the new PIN */ - CK_ULONG ulNewLen /* length of the new PIN */ -); -#endif - - - -/* Session management */ - -/* C_OpenSession opens a session between an application and a - * token. */ -CK_PKCS11_FUNCTION_INFO(C_OpenSession) -#ifdef CK_NEED_ARG_LIST -( - CK_SLOT_ID slotID, /* the slot's ID */ - CK_FLAGS flags, /* from CK_SESSION_INFO */ - CK_VOID_PTR pApplication, /* passed to callback */ - CK_NOTIFY Notify, /* callback function */ - CK_SESSION_HANDLE_PTR phSession /* gets session handle */ -); -#endif - - -/* C_CloseSession closes a session between an application and a - * token. */ -CK_PKCS11_FUNCTION_INFO(C_CloseSession) -#ifdef CK_NEED_ARG_LIST -( - CK_SESSION_HANDLE hSession /* the session's handle */ -); -#endif - - -/* C_CloseAllSessions closes all sessions with a token. */ -CK_PKCS11_FUNCTION_INFO(C_CloseAllSessions) -#ifdef CK_NEED_ARG_LIST -( - CK_SLOT_ID slotID /* the token's slot */ -); -#endif - - -/* C_GetSessionInfo obtains information about the session. */ -CK_PKCS11_FUNCTION_INFO(C_GetSessionInfo) -#ifdef CK_NEED_ARG_LIST -( - CK_SESSION_HANDLE hSession, /* the session's handle */ - CK_SESSION_INFO_PTR pInfo /* receives session info */ -); -#endif - - -/* C_GetOperationState obtains the state of the cryptographic operation - * in a session. */ -CK_PKCS11_FUNCTION_INFO(C_GetOperationState) -#ifdef CK_NEED_ARG_LIST -( - CK_SESSION_HANDLE hSession, /* session's handle */ - CK_BYTE_PTR pOperationState, /* gets state */ - CK_ULONG_PTR pulOperationStateLen /* gets state length */ -); -#endif - - -/* C_SetOperationState restores the state of the cryptographic - * operation in a session. */ -CK_PKCS11_FUNCTION_INFO(C_SetOperationState) -#ifdef CK_NEED_ARG_LIST -( - CK_SESSION_HANDLE hSession, /* session's handle */ - CK_BYTE_PTR pOperationState, /* holds state */ - CK_ULONG ulOperationStateLen, /* holds state length */ - CK_OBJECT_HANDLE hEncryptionKey, /* en/decryption key */ - CK_OBJECT_HANDLE hAuthenticationKey /* sign/verify key */ -); -#endif - - -/* C_Login logs a user into a token. */ -CK_PKCS11_FUNCTION_INFO(C_Login) -#ifdef CK_NEED_ARG_LIST -( - CK_SESSION_HANDLE hSession, /* the session's handle */ - CK_USER_TYPE userType, /* the user type */ - CK_UTF8CHAR_PTR pPin, /* the user's PIN */ - CK_ULONG ulPinLen /* the length of the PIN */ -); -#endif - - -/* C_Logout logs a user out from a token. */ -CK_PKCS11_FUNCTION_INFO(C_Logout) -#ifdef CK_NEED_ARG_LIST -( - CK_SESSION_HANDLE hSession /* the session's handle */ -); -#endif - - - -/* Object management */ - -/* C_CreateObject creates a new object. */ -CK_PKCS11_FUNCTION_INFO(C_CreateObject) -#ifdef CK_NEED_ARG_LIST -( - CK_SESSION_HANDLE hSession, /* the session's handle */ - CK_ATTRIBUTE_PTR pTemplate, /* the object's template */ - CK_ULONG ulCount, /* attributes in template */ - CK_OBJECT_HANDLE_PTR phObject /* gets new object's handle. */ -); -#endif - - -/* C_CopyObject copies an object, creating a new object for the - * copy. */ -CK_PKCS11_FUNCTION_INFO(C_CopyObject) -#ifdef CK_NEED_ARG_LIST -( - CK_SESSION_HANDLE hSession, /* the session's handle */ - CK_OBJECT_HANDLE hObject, /* the object's handle */ - CK_ATTRIBUTE_PTR pTemplate, /* template for new object */ - CK_ULONG ulCount, /* attributes in template */ - CK_OBJECT_HANDLE_PTR phNewObject /* receives handle of copy */ -); -#endif - - -/* C_DestroyObject destroys an object. */ -CK_PKCS11_FUNCTION_INFO(C_DestroyObject) -#ifdef CK_NEED_ARG_LIST -( - CK_SESSION_HANDLE hSession, /* the session's handle */ - CK_OBJECT_HANDLE hObject /* the object's handle */ -); -#endif - - -/* C_GetObjectSize gets the size of an object in bytes. */ -CK_PKCS11_FUNCTION_INFO(C_GetObjectSize) -#ifdef CK_NEED_ARG_LIST -( - CK_SESSION_HANDLE hSession, /* the session's handle */ - CK_OBJECT_HANDLE hObject, /* the object's handle */ - CK_ULONG_PTR pulSize /* receives size of object */ -); -#endif - - -/* C_GetAttributeValue obtains the value of one or more object - * attributes. */ -CK_PKCS11_FUNCTION_INFO(C_GetAttributeValue) -#ifdef CK_NEED_ARG_LIST -( - CK_SESSION_HANDLE hSession, /* the session's handle */ - CK_OBJECT_HANDLE hObject, /* the object's handle */ - CK_ATTRIBUTE_PTR pTemplate, /* specifies attrs; gets vals */ - CK_ULONG ulCount /* attributes in template */ -); -#endif - - -/* C_SetAttributeValue modifies the value of one or more object - * attributes */ -CK_PKCS11_FUNCTION_INFO(C_SetAttributeValue) -#ifdef CK_NEED_ARG_LIST -( - CK_SESSION_HANDLE hSession, /* the session's handle */ - CK_OBJECT_HANDLE hObject, /* the object's handle */ - CK_ATTRIBUTE_PTR pTemplate, /* specifies attrs and values */ - CK_ULONG ulCount /* attributes in template */ -); -#endif - - -/* C_FindObjectsInit initializes a search for token and session - * objects that match a template. */ -CK_PKCS11_FUNCTION_INFO(C_FindObjectsInit) -#ifdef CK_NEED_ARG_LIST -( - CK_SESSION_HANDLE hSession, /* the session's handle */ - CK_ATTRIBUTE_PTR pTemplate, /* attribute values to match */ - CK_ULONG ulCount /* attrs in search template */ -); -#endif - - -/* C_FindObjects continues a search for token and session - * objects that match a template, obtaining additional object - * handles. */ -CK_PKCS11_FUNCTION_INFO(C_FindObjects) -#ifdef CK_NEED_ARG_LIST -( - CK_SESSION_HANDLE hSession, /* session's handle */ - CK_OBJECT_HANDLE_PTR phObject, /* gets obj. handles */ - CK_ULONG ulMaxObjectCount, /* max handles to get */ - CK_ULONG_PTR pulObjectCount /* actual # returned */ -); -#endif - - -/* C_FindObjectsFinal finishes a search for token and session - * objects. */ -CK_PKCS11_FUNCTION_INFO(C_FindObjectsFinal) -#ifdef CK_NEED_ARG_LIST -( - CK_SESSION_HANDLE hSession /* the session's handle */ -); -#endif - - - -/* Encryption and decryption */ - -/* C_EncryptInit initializes an encryption operation. */ -CK_PKCS11_FUNCTION_INFO(C_EncryptInit) -#ifdef CK_NEED_ARG_LIST -( - CK_SESSION_HANDLE hSession, /* the session's handle */ - CK_MECHANISM_PTR pMechanism, /* the encryption mechanism */ - CK_OBJECT_HANDLE hKey /* handle of encryption key */ -); -#endif - - -/* C_Encrypt encrypts single-part data. */ -CK_PKCS11_FUNCTION_INFO(C_Encrypt) -#ifdef CK_NEED_ARG_LIST -( - CK_SESSION_HANDLE hSession, /* session's handle */ - CK_BYTE_PTR pData, /* the plaintext data */ - CK_ULONG ulDataLen, /* bytes of plaintext */ - CK_BYTE_PTR pEncryptedData, /* gets ciphertext */ - CK_ULONG_PTR pulEncryptedDataLen /* gets c-text size */ -); -#endif - - -/* C_EncryptUpdate continues a multiple-part encryption - * operation. */ -CK_PKCS11_FUNCTION_INFO(C_EncryptUpdate) -#ifdef CK_NEED_ARG_LIST -( - CK_SESSION_HANDLE hSession, /* session's handle */ - CK_BYTE_PTR pPart, /* the plaintext data */ - CK_ULONG ulPartLen, /* plaintext data len */ - CK_BYTE_PTR pEncryptedPart, /* gets ciphertext */ - CK_ULONG_PTR pulEncryptedPartLen /* gets c-text size */ -); -#endif - - -/* C_EncryptFinal finishes a multiple-part encryption - * operation. */ -CK_PKCS11_FUNCTION_INFO(C_EncryptFinal) -#ifdef CK_NEED_ARG_LIST -( - CK_SESSION_HANDLE hSession, /* session handle */ - CK_BYTE_PTR pLastEncryptedPart, /* last c-text */ - CK_ULONG_PTR pulLastEncryptedPartLen /* gets last size */ -); -#endif - - -/* C_DecryptInit initializes a decryption operation. */ -CK_PKCS11_FUNCTION_INFO(C_DecryptInit) -#ifdef CK_NEED_ARG_LIST -( - CK_SESSION_HANDLE hSession, /* the session's handle */ - CK_MECHANISM_PTR pMechanism, /* the decryption mechanism */ - CK_OBJECT_HANDLE hKey /* handle of decryption key */ -); -#endif - - -/* C_Decrypt decrypts encrypted data in a single part. */ -CK_PKCS11_FUNCTION_INFO(C_Decrypt) -#ifdef CK_NEED_ARG_LIST -( - CK_SESSION_HANDLE hSession, /* session's handle */ - CK_BYTE_PTR pEncryptedData, /* ciphertext */ - CK_ULONG ulEncryptedDataLen, /* ciphertext length */ - CK_BYTE_PTR pData, /* gets plaintext */ - CK_ULONG_PTR pulDataLen /* gets p-text size */ -); -#endif - - -/* C_DecryptUpdate continues a multiple-part decryption - * operation. */ -CK_PKCS11_FUNCTION_INFO(C_DecryptUpdate) -#ifdef CK_NEED_ARG_LIST -( - CK_SESSION_HANDLE hSession, /* session's handle */ - CK_BYTE_PTR pEncryptedPart, /* encrypted data */ - CK_ULONG ulEncryptedPartLen, /* input length */ - CK_BYTE_PTR pPart, /* gets plaintext */ - CK_ULONG_PTR pulPartLen /* p-text size */ -); -#endif - - -/* C_DecryptFinal finishes a multiple-part decryption - * operation. */ -CK_PKCS11_FUNCTION_INFO(C_DecryptFinal) -#ifdef CK_NEED_ARG_LIST -( - CK_SESSION_HANDLE hSession, /* the session's handle */ - CK_BYTE_PTR pLastPart, /* gets plaintext */ - CK_ULONG_PTR pulLastPartLen /* p-text size */ -); -#endif - - - -/* Message digesting */ - -/* C_DigestInit initializes a message-digesting operation. */ -CK_PKCS11_FUNCTION_INFO(C_DigestInit) -#ifdef CK_NEED_ARG_LIST -( - CK_SESSION_HANDLE hSession, /* the session's handle */ - CK_MECHANISM_PTR pMechanism /* the digesting mechanism */ -); -#endif - - -/* C_Digest digests data in a single part. */ -CK_PKCS11_FUNCTION_INFO(C_Digest) -#ifdef CK_NEED_ARG_LIST -( - CK_SESSION_HANDLE hSession, /* the session's handle */ - CK_BYTE_PTR pData, /* data to be digested */ - CK_ULONG ulDataLen, /* bytes of data to digest */ - CK_BYTE_PTR pDigest, /* gets the message digest */ - CK_ULONG_PTR pulDigestLen /* gets digest length */ -); -#endif - - -/* C_DigestUpdate continues a multiple-part message-digesting - * operation. */ -CK_PKCS11_FUNCTION_INFO(C_DigestUpdate) -#ifdef CK_NEED_ARG_LIST -( - CK_SESSION_HANDLE hSession, /* the session's handle */ - CK_BYTE_PTR pPart, /* data to be digested */ - CK_ULONG ulPartLen /* bytes of data to be digested */ -); -#endif - - -/* C_DigestKey continues a multi-part message-digesting - * operation, by digesting the value of a secret key as part of - * the data already digested. */ -CK_PKCS11_FUNCTION_INFO(C_DigestKey) -#ifdef CK_NEED_ARG_LIST -( - CK_SESSION_HANDLE hSession, /* the session's handle */ - CK_OBJECT_HANDLE hKey /* secret key to digest */ -); -#endif - - -/* C_DigestFinal finishes a multiple-part message-digesting - * operation. */ -CK_PKCS11_FUNCTION_INFO(C_DigestFinal) -#ifdef CK_NEED_ARG_LIST -( - CK_SESSION_HANDLE hSession, /* the session's handle */ - CK_BYTE_PTR pDigest, /* gets the message digest */ - CK_ULONG_PTR pulDigestLen /* gets byte count of digest */ -); -#endif - - - -/* Signing and MACing */ - -/* C_SignInit initializes a signature (private key encryption) - * operation, where the signature is (will be) an appendix to - * the data, and plaintext cannot be recovered from the - *signature. */ -CK_PKCS11_FUNCTION_INFO(C_SignInit) -#ifdef CK_NEED_ARG_LIST -( - CK_SESSION_HANDLE hSession, /* the session's handle */ - CK_MECHANISM_PTR pMechanism, /* the signature mechanism */ - CK_OBJECT_HANDLE hKey /* handle of signature key */ -); -#endif - - -/* C_Sign signs (encrypts with private key) data in a single - * part, where the signature is (will be) an appendix to the - * data, and plaintext cannot be recovered from the signature. */ -CK_PKCS11_FUNCTION_INFO(C_Sign) -#ifdef CK_NEED_ARG_LIST -( - CK_SESSION_HANDLE hSession, /* the session's handle */ - CK_BYTE_PTR pData, /* the data to sign */ - CK_ULONG ulDataLen, /* count of bytes to sign */ - CK_BYTE_PTR pSignature, /* gets the signature */ - CK_ULONG_PTR pulSignatureLen /* gets signature length */ -); -#endif - - -/* C_SignUpdate continues a multiple-part signature operation, - * where the signature is (will be) an appendix to the data, - * and plaintext cannot be recovered from the signature. */ -CK_PKCS11_FUNCTION_INFO(C_SignUpdate) -#ifdef CK_NEED_ARG_LIST -( - CK_SESSION_HANDLE hSession, /* the session's handle */ - CK_BYTE_PTR pPart, /* the data to sign */ - CK_ULONG ulPartLen /* count of bytes to sign */ -); -#endif - - -/* C_SignFinal finishes a multiple-part signature operation, - * returning the signature. */ -CK_PKCS11_FUNCTION_INFO(C_SignFinal) -#ifdef CK_NEED_ARG_LIST -( - CK_SESSION_HANDLE hSession, /* the session's handle */ - CK_BYTE_PTR pSignature, /* gets the signature */ - CK_ULONG_PTR pulSignatureLen /* gets signature length */ -); -#endif - - -/* C_SignRecoverInit initializes a signature operation, where - * the data can be recovered from the signature. */ -CK_PKCS11_FUNCTION_INFO(C_SignRecoverInit) -#ifdef CK_NEED_ARG_LIST -( - CK_SESSION_HANDLE hSession, /* the session's handle */ - CK_MECHANISM_PTR pMechanism, /* the signature mechanism */ - CK_OBJECT_HANDLE hKey /* handle of the signature key */ -); -#endif - - -/* C_SignRecover signs data in a single operation, where the - * data can be recovered from the signature. */ -CK_PKCS11_FUNCTION_INFO(C_SignRecover) -#ifdef CK_NEED_ARG_LIST -( - CK_SESSION_HANDLE hSession, /* the session's handle */ - CK_BYTE_PTR pData, /* the data to sign */ - CK_ULONG ulDataLen, /* count of bytes to sign */ - CK_BYTE_PTR pSignature, /* gets the signature */ - CK_ULONG_PTR pulSignatureLen /* gets signature length */ -); -#endif - - - -/* Verifying signatures and MACs */ - -/* C_VerifyInit initializes a verification operation, where the - * signature is an appendix to the data, and plaintext cannot - * cannot be recovered from the signature (e.g. DSA). */ -CK_PKCS11_FUNCTION_INFO(C_VerifyInit) -#ifdef CK_NEED_ARG_LIST -( - CK_SESSION_HANDLE hSession, /* the session's handle */ - CK_MECHANISM_PTR pMechanism, /* the verification mechanism */ - CK_OBJECT_HANDLE hKey /* verification key */ -); -#endif - - -/* C_Verify verifies a signature in a single-part operation, - * where the signature is an appendix to the data, and plaintext - * cannot be recovered from the signature. */ -CK_PKCS11_FUNCTION_INFO(C_Verify) -#ifdef CK_NEED_ARG_LIST -( - CK_SESSION_HANDLE hSession, /* the session's handle */ - CK_BYTE_PTR pData, /* signed data */ - CK_ULONG ulDataLen, /* length of signed data */ - CK_BYTE_PTR pSignature, /* signature */ - CK_ULONG ulSignatureLen /* signature length*/ -); -#endif - - -/* C_VerifyUpdate continues a multiple-part verification - * operation, where the signature is an appendix to the data, - * and plaintext cannot be recovered from the signature. */ -CK_PKCS11_FUNCTION_INFO(C_VerifyUpdate) -#ifdef CK_NEED_ARG_LIST -( - CK_SESSION_HANDLE hSession, /* the session's handle */ - CK_BYTE_PTR pPart, /* signed data */ - CK_ULONG ulPartLen /* length of signed data */ -); -#endif - - -/* C_VerifyFinal finishes a multiple-part verification - * operation, checking the signature. */ -CK_PKCS11_FUNCTION_INFO(C_VerifyFinal) -#ifdef CK_NEED_ARG_LIST -( - CK_SESSION_HANDLE hSession, /* the session's handle */ - CK_BYTE_PTR pSignature, /* signature to verify */ - CK_ULONG ulSignatureLen /* signature length */ -); -#endif - - -/* C_VerifyRecoverInit initializes a signature verification - * operation, where the data is recovered from the signature. */ -CK_PKCS11_FUNCTION_INFO(C_VerifyRecoverInit) -#ifdef CK_NEED_ARG_LIST -( - CK_SESSION_HANDLE hSession, /* the session's handle */ - CK_MECHANISM_PTR pMechanism, /* the verification mechanism */ - CK_OBJECT_HANDLE hKey /* verification key */ -); -#endif - - -/* C_VerifyRecover verifies a signature in a single-part - * operation, where the data is recovered from the signature. */ -CK_PKCS11_FUNCTION_INFO(C_VerifyRecover) -#ifdef CK_NEED_ARG_LIST -( - CK_SESSION_HANDLE hSession, /* the session's handle */ - CK_BYTE_PTR pSignature, /* signature to verify */ - CK_ULONG ulSignatureLen, /* signature length */ - CK_BYTE_PTR pData, /* gets signed data */ - CK_ULONG_PTR pulDataLen /* gets signed data len */ -); -#endif - - - -/* Dual-function cryptographic operations */ - -/* C_DigestEncryptUpdate continues a multiple-part digesting - * and encryption operation. */ -CK_PKCS11_FUNCTION_INFO(C_DigestEncryptUpdate) -#ifdef CK_NEED_ARG_LIST -( - CK_SESSION_HANDLE hSession, /* session's handle */ - CK_BYTE_PTR pPart, /* the plaintext data */ - CK_ULONG ulPartLen, /* plaintext length */ - CK_BYTE_PTR pEncryptedPart, /* gets ciphertext */ - CK_ULONG_PTR pulEncryptedPartLen /* gets c-text length */ -); -#endif - - -/* C_DecryptDigestUpdate continues a multiple-part decryption and - * digesting operation. */ -CK_PKCS11_FUNCTION_INFO(C_DecryptDigestUpdate) -#ifdef CK_NEED_ARG_LIST -( - CK_SESSION_HANDLE hSession, /* session's handle */ - CK_BYTE_PTR pEncryptedPart, /* ciphertext */ - CK_ULONG ulEncryptedPartLen, /* ciphertext length */ - CK_BYTE_PTR pPart, /* gets plaintext */ - CK_ULONG_PTR pulPartLen /* gets plaintext len */ -); -#endif - - -/* C_SignEncryptUpdate continues a multiple-part signing and - * encryption operation. */ -CK_PKCS11_FUNCTION_INFO(C_SignEncryptUpdate) -#ifdef CK_NEED_ARG_LIST -( - CK_SESSION_HANDLE hSession, /* session's handle */ - CK_BYTE_PTR pPart, /* the plaintext data */ - CK_ULONG ulPartLen, /* plaintext length */ - CK_BYTE_PTR pEncryptedPart, /* gets ciphertext */ - CK_ULONG_PTR pulEncryptedPartLen /* gets c-text length */ -); -#endif - - -/* C_DecryptVerifyUpdate continues a multiple-part decryption and - * verify operation. */ -CK_PKCS11_FUNCTION_INFO(C_DecryptVerifyUpdate) -#ifdef CK_NEED_ARG_LIST -( - CK_SESSION_HANDLE hSession, /* session's handle */ - CK_BYTE_PTR pEncryptedPart, /* ciphertext */ - CK_ULONG ulEncryptedPartLen, /* ciphertext length */ - CK_BYTE_PTR pPart, /* gets plaintext */ - CK_ULONG_PTR pulPartLen /* gets p-text length */ -); -#endif - - - -/* Key management */ - -/* C_GenerateKey generates a secret key, creating a new key - * object. */ -CK_PKCS11_FUNCTION_INFO(C_GenerateKey) -#ifdef CK_NEED_ARG_LIST -( - CK_SESSION_HANDLE hSession, /* the session's handle */ - CK_MECHANISM_PTR pMechanism, /* key generation mech. */ - CK_ATTRIBUTE_PTR pTemplate, /* template for new key */ - CK_ULONG ulCount, /* # of attrs in template */ - CK_OBJECT_HANDLE_PTR phKey /* gets handle of new key */ -); -#endif - - -/* C_GenerateKeyPair generates a public-key/private-key pair, - * creating new key objects. */ -CK_PKCS11_FUNCTION_INFO(C_GenerateKeyPair) -#ifdef CK_NEED_ARG_LIST -( - CK_SESSION_HANDLE hSession, /* session - * handle */ - CK_MECHANISM_PTR pMechanism, /* key-gen - * mech. */ - CK_ATTRIBUTE_PTR pPublicKeyTemplate, /* template - * for pub. - * key */ - CK_ULONG ulPublicKeyAttributeCount, /* # pub. - * attrs. */ - CK_ATTRIBUTE_PTR pPrivateKeyTemplate, /* template - * for priv. - * key */ - CK_ULONG ulPrivateKeyAttributeCount, /* # priv. - * attrs. */ - CK_OBJECT_HANDLE_PTR phPublicKey, /* gets pub. - * key - * handle */ - CK_OBJECT_HANDLE_PTR phPrivateKey /* gets - * priv. key - * handle */ -); -#endif - - -/* C_WrapKey wraps (i.e., encrypts) a key. */ -CK_PKCS11_FUNCTION_INFO(C_WrapKey) -#ifdef CK_NEED_ARG_LIST -( - CK_SESSION_HANDLE hSession, /* the session's handle */ - CK_MECHANISM_PTR pMechanism, /* the wrapping mechanism */ - CK_OBJECT_HANDLE hWrappingKey, /* wrapping key */ - CK_OBJECT_HANDLE hKey, /* key to be wrapped */ - CK_BYTE_PTR pWrappedKey, /* gets wrapped key */ - CK_ULONG_PTR pulWrappedKeyLen /* gets wrapped key size */ -); -#endif - - -/* C_UnwrapKey unwraps (decrypts) a wrapped key, creating a new - * key object. */ -CK_PKCS11_FUNCTION_INFO(C_UnwrapKey) -#ifdef CK_NEED_ARG_LIST -( - CK_SESSION_HANDLE hSession, /* session's handle */ - CK_MECHANISM_PTR pMechanism, /* unwrapping mech. */ - CK_OBJECT_HANDLE hUnwrappingKey, /* unwrapping key */ - CK_BYTE_PTR pWrappedKey, /* the wrapped key */ - CK_ULONG ulWrappedKeyLen, /* wrapped key len */ - CK_ATTRIBUTE_PTR pTemplate, /* new key template */ - CK_ULONG ulAttributeCount, /* template length */ - CK_OBJECT_HANDLE_PTR phKey /* gets new handle */ -); -#endif - - -/* C_DeriveKey derives a key from a base key, creating a new key - * object. */ -CK_PKCS11_FUNCTION_INFO(C_DeriveKey) -#ifdef CK_NEED_ARG_LIST -( - CK_SESSION_HANDLE hSession, /* session's handle */ - CK_MECHANISM_PTR pMechanism, /* key deriv. mech. */ - CK_OBJECT_HANDLE hBaseKey, /* base key */ - CK_ATTRIBUTE_PTR pTemplate, /* new key template */ - CK_ULONG ulAttributeCount, /* template length */ - CK_OBJECT_HANDLE_PTR phKey /* gets new handle */ -); -#endif - - - -/* Random number generation */ - -/* C_SeedRandom mixes additional seed material into the token's - * random number generator. */ -CK_PKCS11_FUNCTION_INFO(C_SeedRandom) -#ifdef CK_NEED_ARG_LIST -( - CK_SESSION_HANDLE hSession, /* the session's handle */ - CK_BYTE_PTR pSeed, /* the seed material */ - CK_ULONG ulSeedLen /* length of seed material */ -); -#endif - - -/* C_GenerateRandom generates random data. */ -CK_PKCS11_FUNCTION_INFO(C_GenerateRandom) -#ifdef CK_NEED_ARG_LIST -( - CK_SESSION_HANDLE hSession, /* the session's handle */ - CK_BYTE_PTR RandomData, /* receives the random data */ - CK_ULONG ulRandomLen /* # of bytes to generate */ -); -#endif - - - -/* Parallel function management */ - -/* C_GetFunctionStatus is a legacy function; it obtains an - * updated status of a function running in parallel with an - * application. */ -CK_PKCS11_FUNCTION_INFO(C_GetFunctionStatus) -#ifdef CK_NEED_ARG_LIST -( - CK_SESSION_HANDLE hSession /* the session's handle */ -); -#endif - - -/* C_CancelFunction is a legacy function; it cancels a function - * running in parallel. */ -CK_PKCS11_FUNCTION_INFO(C_CancelFunction) -#ifdef CK_NEED_ARG_LIST -( - CK_SESSION_HANDLE hSession /* the session's handle */ -); -#endif - - - -/* Functions added in for Cryptoki Version 2.01 or later */ - -/* C_WaitForSlotEvent waits for a slot event (token insertion, - * removal, etc.) to occur. */ -CK_PKCS11_FUNCTION_INFO(C_WaitForSlotEvent) -#ifdef CK_NEED_ARG_LIST -( - CK_FLAGS flags, /* blocking/nonblocking flag */ - CK_SLOT_ID_PTR pSlot, /* location that receives the slot ID */ - CK_VOID_PTR pRserved /* reserved. Should be NULL_PTR */ -); -#endif +/* pkcs11f.h include file for PKCS #11. */ +/* $Revision: 1.4 $ */ + +/* License to copy and use this software is granted provided that it is + * identified as "RSA Security Inc. PKCS #11 Cryptographic Token Interface + * (Cryptoki)" in all material mentioning or referencing this software. + + * License is also granted to make and use derivative works provided that + * such works are identified as "derived from the RSA Security Inc. PKCS #11 + * Cryptographic Token Interface (Cryptoki)" in all material mentioning or + * referencing the derived work. + + * RSA Security Inc. makes no representations concerning either the + * merchantability of this software or the suitability of this software for + * any particular purpose. It is provided "as is" without express or implied + * warranty of any kind. + */ + +/* This header file contains pretty much everything about all the */ +/* Cryptoki function prototypes. Because this information is */ +/* used for more than just declaring function prototypes, the */ +/* order of the functions appearing herein is important, and */ +/* should not be altered. */ + +/* General-purpose */ + +/* C_Initialize initializes the Cryptoki library. */ +CK_PKCS11_FUNCTION_INFO(C_Initialize) +#ifdef CK_NEED_ARG_LIST +( + CK_VOID_PTR pInitArgs /* if this is not NULL_PTR, it gets + * cast to CK_C_INITIALIZE_ARGS_PTR + * and dereferenced */ +); +#endif + + +/* C_Finalize indicates that an application is done with the + * Cryptoki library. */ +CK_PKCS11_FUNCTION_INFO(C_Finalize) +#ifdef CK_NEED_ARG_LIST +( + CK_VOID_PTR pReserved /* reserved. Should be NULL_PTR */ +); +#endif + + +/* C_GetInfo returns general information about Cryptoki. */ +CK_PKCS11_FUNCTION_INFO(C_GetInfo) +#ifdef CK_NEED_ARG_LIST +( + CK_INFO_PTR pInfo /* location that receives information */ +); +#endif + + +/* C_GetFunctionList returns the function list. */ +CK_PKCS11_FUNCTION_INFO(C_GetFunctionList) +#ifdef CK_NEED_ARG_LIST +( + CK_FUNCTION_LIST_PTR_PTR ppFunctionList /* receives pointer to + * function list */ +); +#endif + + + +/* Slot and token management */ + +/* C_GetSlotList obtains a list of slots in the system. */ +CK_PKCS11_FUNCTION_INFO(C_GetSlotList) +#ifdef CK_NEED_ARG_LIST +( + CK_BBOOL tokenPresent, /* only slots with tokens? */ + CK_SLOT_ID_PTR pSlotList, /* receives array of slot IDs */ + CK_ULONG_PTR pulCount /* receives number of slots */ +); +#endif + + +/* C_GetSlotInfo obtains information about a particular slot in + * the system. */ +CK_PKCS11_FUNCTION_INFO(C_GetSlotInfo) +#ifdef CK_NEED_ARG_LIST +( + CK_SLOT_ID slotID, /* the ID of the slot */ + CK_SLOT_INFO_PTR pInfo /* receives the slot information */ +); +#endif + + +/* C_GetTokenInfo obtains information about a particular token + * in the system. */ +CK_PKCS11_FUNCTION_INFO(C_GetTokenInfo) +#ifdef CK_NEED_ARG_LIST +( + CK_SLOT_ID slotID, /* ID of the token's slot */ + CK_TOKEN_INFO_PTR pInfo /* receives the token information */ +); +#endif + + +/* C_GetMechanismList obtains a list of mechanism types + * supported by a token. */ +CK_PKCS11_FUNCTION_INFO(C_GetMechanismList) +#ifdef CK_NEED_ARG_LIST +( + CK_SLOT_ID slotID, /* ID of token's slot */ + CK_MECHANISM_TYPE_PTR pMechanismList, /* gets mech. array */ + CK_ULONG_PTR pulCount /* gets # of mechs. */ +); +#endif + + +/* C_GetMechanismInfo obtains information about a particular + * mechanism possibly supported by a token. */ +CK_PKCS11_FUNCTION_INFO(C_GetMechanismInfo) +#ifdef CK_NEED_ARG_LIST +( + CK_SLOT_ID slotID, /* ID of the token's slot */ + CK_MECHANISM_TYPE type, /* type of mechanism */ + CK_MECHANISM_INFO_PTR pInfo /* receives mechanism info */ +); +#endif + + +/* C_InitToken initializes a token. */ +CK_PKCS11_FUNCTION_INFO(C_InitToken) +#ifdef CK_NEED_ARG_LIST +/* pLabel changed from CK_CHAR_PTR to CK_UTF8CHAR_PTR for v2.10 */ +( + CK_SLOT_ID slotID, /* ID of the token's slot */ + CK_UTF8CHAR_PTR pPin, /* the SO's initial PIN */ + CK_ULONG ulPinLen, /* length in bytes of the PIN */ + CK_UTF8CHAR_PTR pLabel /* 32-byte token label (blank padded) */ +); +#endif + + +/* C_InitPIN initializes the normal user's PIN. */ +CK_PKCS11_FUNCTION_INFO(C_InitPIN) +#ifdef CK_NEED_ARG_LIST +( + CK_SESSION_HANDLE hSession, /* the session's handle */ + CK_UTF8CHAR_PTR pPin, /* the normal user's PIN */ + CK_ULONG ulPinLen /* length in bytes of the PIN */ +); +#endif + + +/* C_SetPIN modifies the PIN of the user who is logged in. */ +CK_PKCS11_FUNCTION_INFO(C_SetPIN) +#ifdef CK_NEED_ARG_LIST +( + CK_SESSION_HANDLE hSession, /* the session's handle */ + CK_UTF8CHAR_PTR pOldPin, /* the old PIN */ + CK_ULONG ulOldLen, /* length of the old PIN */ + CK_UTF8CHAR_PTR pNewPin, /* the new PIN */ + CK_ULONG ulNewLen /* length of the new PIN */ +); +#endif + + + +/* Session management */ + +/* C_OpenSession opens a session between an application and a + * token. */ +CK_PKCS11_FUNCTION_INFO(C_OpenSession) +#ifdef CK_NEED_ARG_LIST +( + CK_SLOT_ID slotID, /* the slot's ID */ + CK_FLAGS flags, /* from CK_SESSION_INFO */ + CK_VOID_PTR pApplication, /* passed to callback */ + CK_NOTIFY Notify, /* callback function */ + CK_SESSION_HANDLE_PTR phSession /* gets session handle */ +); +#endif + + +/* C_CloseSession closes a session between an application and a + * token. */ +CK_PKCS11_FUNCTION_INFO(C_CloseSession) +#ifdef CK_NEED_ARG_LIST +( + CK_SESSION_HANDLE hSession /* the session's handle */ +); +#endif + + +/* C_CloseAllSessions closes all sessions with a token. */ +CK_PKCS11_FUNCTION_INFO(C_CloseAllSessions) +#ifdef CK_NEED_ARG_LIST +( + CK_SLOT_ID slotID /* the token's slot */ +); +#endif + + +/* C_GetSessionInfo obtains information about the session. */ +CK_PKCS11_FUNCTION_INFO(C_GetSessionInfo) +#ifdef CK_NEED_ARG_LIST +( + CK_SESSION_HANDLE hSession, /* the session's handle */ + CK_SESSION_INFO_PTR pInfo /* receives session info */ +); +#endif + + +/* C_GetOperationState obtains the state of the cryptographic operation + * in a session. */ +CK_PKCS11_FUNCTION_INFO(C_GetOperationState) +#ifdef CK_NEED_ARG_LIST +( + CK_SESSION_HANDLE hSession, /* session's handle */ + CK_BYTE_PTR pOperationState, /* gets state */ + CK_ULONG_PTR pulOperationStateLen /* gets state length */ +); +#endif + + +/* C_SetOperationState restores the state of the cryptographic + * operation in a session. */ +CK_PKCS11_FUNCTION_INFO(C_SetOperationState) +#ifdef CK_NEED_ARG_LIST +( + CK_SESSION_HANDLE hSession, /* session's handle */ + CK_BYTE_PTR pOperationState, /* holds state */ + CK_ULONG ulOperationStateLen, /* holds state length */ + CK_OBJECT_HANDLE hEncryptionKey, /* en/decryption key */ + CK_OBJECT_HANDLE hAuthenticationKey /* sign/verify key */ +); +#endif + + +/* C_Login logs a user into a token. */ +CK_PKCS11_FUNCTION_INFO(C_Login) +#ifdef CK_NEED_ARG_LIST +( + CK_SESSION_HANDLE hSession, /* the session's handle */ + CK_USER_TYPE userType, /* the user type */ + CK_UTF8CHAR_PTR pPin, /* the user's PIN */ + CK_ULONG ulPinLen /* the length of the PIN */ +); +#endif + + +/* C_Logout logs a user out from a token. */ +CK_PKCS11_FUNCTION_INFO(C_Logout) +#ifdef CK_NEED_ARG_LIST +( + CK_SESSION_HANDLE hSession /* the session's handle */ +); +#endif + + + +/* Object management */ + +/* C_CreateObject creates a new object. */ +CK_PKCS11_FUNCTION_INFO(C_CreateObject) +#ifdef CK_NEED_ARG_LIST +( + CK_SESSION_HANDLE hSession, /* the session's handle */ + CK_ATTRIBUTE_PTR pTemplate, /* the object's template */ + CK_ULONG ulCount, /* attributes in template */ + CK_OBJECT_HANDLE_PTR phObject /* gets new object's handle. */ +); +#endif + + +/* C_CopyObject copies an object, creating a new object for the + * copy. */ +CK_PKCS11_FUNCTION_INFO(C_CopyObject) +#ifdef CK_NEED_ARG_LIST +( + CK_SESSION_HANDLE hSession, /* the session's handle */ + CK_OBJECT_HANDLE hObject, /* the object's handle */ + CK_ATTRIBUTE_PTR pTemplate, /* template for new object */ + CK_ULONG ulCount, /* attributes in template */ + CK_OBJECT_HANDLE_PTR phNewObject /* receives handle of copy */ +); +#endif + + +/* C_DestroyObject destroys an object. */ +CK_PKCS11_FUNCTION_INFO(C_DestroyObject) +#ifdef CK_NEED_ARG_LIST +( + CK_SESSION_HANDLE hSession, /* the session's handle */ + CK_OBJECT_HANDLE hObject /* the object's handle */ +); +#endif + + +/* C_GetObjectSize gets the size of an object in bytes. */ +CK_PKCS11_FUNCTION_INFO(C_GetObjectSize) +#ifdef CK_NEED_ARG_LIST +( + CK_SESSION_HANDLE hSession, /* the session's handle */ + CK_OBJECT_HANDLE hObject, /* the object's handle */ + CK_ULONG_PTR pulSize /* receives size of object */ +); +#endif + + +/* C_GetAttributeValue obtains the value of one or more object + * attributes. */ +CK_PKCS11_FUNCTION_INFO(C_GetAttributeValue) +#ifdef CK_NEED_ARG_LIST +( + CK_SESSION_HANDLE hSession, /* the session's handle */ + CK_OBJECT_HANDLE hObject, /* the object's handle */ + CK_ATTRIBUTE_PTR pTemplate, /* specifies attrs; gets vals */ + CK_ULONG ulCount /* attributes in template */ +); +#endif + + +/* C_SetAttributeValue modifies the value of one or more object + * attributes */ +CK_PKCS11_FUNCTION_INFO(C_SetAttributeValue) +#ifdef CK_NEED_ARG_LIST +( + CK_SESSION_HANDLE hSession, /* the session's handle */ + CK_OBJECT_HANDLE hObject, /* the object's handle */ + CK_ATTRIBUTE_PTR pTemplate, /* specifies attrs and values */ + CK_ULONG ulCount /* attributes in template */ +); +#endif + + +/* C_FindObjectsInit initializes a search for token and session + * objects that match a template. */ +CK_PKCS11_FUNCTION_INFO(C_FindObjectsInit) +#ifdef CK_NEED_ARG_LIST +( + CK_SESSION_HANDLE hSession, /* the session's handle */ + CK_ATTRIBUTE_PTR pTemplate, /* attribute values to match */ + CK_ULONG ulCount /* attrs in search template */ +); +#endif + + +/* C_FindObjects continues a search for token and session + * objects that match a template, obtaining additional object + * handles. */ +CK_PKCS11_FUNCTION_INFO(C_FindObjects) +#ifdef CK_NEED_ARG_LIST +( + CK_SESSION_HANDLE hSession, /* session's handle */ + CK_OBJECT_HANDLE_PTR phObject, /* gets obj. handles */ + CK_ULONG ulMaxObjectCount, /* max handles to get */ + CK_ULONG_PTR pulObjectCount /* actual # returned */ +); +#endif + + +/* C_FindObjectsFinal finishes a search for token and session + * objects. */ +CK_PKCS11_FUNCTION_INFO(C_FindObjectsFinal) +#ifdef CK_NEED_ARG_LIST +( + CK_SESSION_HANDLE hSession /* the session's handle */ +); +#endif + + + +/* Encryption and decryption */ + +/* C_EncryptInit initializes an encryption operation. */ +CK_PKCS11_FUNCTION_INFO(C_EncryptInit) +#ifdef CK_NEED_ARG_LIST +( + CK_SESSION_HANDLE hSession, /* the session's handle */ + CK_MECHANISM_PTR pMechanism, /* the encryption mechanism */ + CK_OBJECT_HANDLE hKey /* handle of encryption key */ +); +#endif + + +/* C_Encrypt encrypts single-part data. */ +CK_PKCS11_FUNCTION_INFO(C_Encrypt) +#ifdef CK_NEED_ARG_LIST +( + CK_SESSION_HANDLE hSession, /* session's handle */ + CK_BYTE_PTR pData, /* the plaintext data */ + CK_ULONG ulDataLen, /* bytes of plaintext */ + CK_BYTE_PTR pEncryptedData, /* gets ciphertext */ + CK_ULONG_PTR pulEncryptedDataLen /* gets c-text size */ +); +#endif + + +/* C_EncryptUpdate continues a multiple-part encryption + * operation. */ +CK_PKCS11_FUNCTION_INFO(C_EncryptUpdate) +#ifdef CK_NEED_ARG_LIST +( + CK_SESSION_HANDLE hSession, /* session's handle */ + CK_BYTE_PTR pPart, /* the plaintext data */ + CK_ULONG ulPartLen, /* plaintext data len */ + CK_BYTE_PTR pEncryptedPart, /* gets ciphertext */ + CK_ULONG_PTR pulEncryptedPartLen /* gets c-text size */ +); +#endif + + +/* C_EncryptFinal finishes a multiple-part encryption + * operation. */ +CK_PKCS11_FUNCTION_INFO(C_EncryptFinal) +#ifdef CK_NEED_ARG_LIST +( + CK_SESSION_HANDLE hSession, /* session handle */ + CK_BYTE_PTR pLastEncryptedPart, /* last c-text */ + CK_ULONG_PTR pulLastEncryptedPartLen /* gets last size */ +); +#endif + + +/* C_DecryptInit initializes a decryption operation. */ +CK_PKCS11_FUNCTION_INFO(C_DecryptInit) +#ifdef CK_NEED_ARG_LIST +( + CK_SESSION_HANDLE hSession, /* the session's handle */ + CK_MECHANISM_PTR pMechanism, /* the decryption mechanism */ + CK_OBJECT_HANDLE hKey /* handle of decryption key */ +); +#endif + + +/* C_Decrypt decrypts encrypted data in a single part. */ +CK_PKCS11_FUNCTION_INFO(C_Decrypt) +#ifdef CK_NEED_ARG_LIST +( + CK_SESSION_HANDLE hSession, /* session's handle */ + CK_BYTE_PTR pEncryptedData, /* ciphertext */ + CK_ULONG ulEncryptedDataLen, /* ciphertext length */ + CK_BYTE_PTR pData, /* gets plaintext */ + CK_ULONG_PTR pulDataLen /* gets p-text size */ +); +#endif + + +/* C_DecryptUpdate continues a multiple-part decryption + * operation. */ +CK_PKCS11_FUNCTION_INFO(C_DecryptUpdate) +#ifdef CK_NEED_ARG_LIST +( + CK_SESSION_HANDLE hSession, /* session's handle */ + CK_BYTE_PTR pEncryptedPart, /* encrypted data */ + CK_ULONG ulEncryptedPartLen, /* input length */ + CK_BYTE_PTR pPart, /* gets plaintext */ + CK_ULONG_PTR pulPartLen /* p-text size */ +); +#endif + + +/* C_DecryptFinal finishes a multiple-part decryption + * operation. */ +CK_PKCS11_FUNCTION_INFO(C_DecryptFinal) +#ifdef CK_NEED_ARG_LIST +( + CK_SESSION_HANDLE hSession, /* the session's handle */ + CK_BYTE_PTR pLastPart, /* gets plaintext */ + CK_ULONG_PTR pulLastPartLen /* p-text size */ +); +#endif + + + +/* Message digesting */ + +/* C_DigestInit initializes a message-digesting operation. */ +CK_PKCS11_FUNCTION_INFO(C_DigestInit) +#ifdef CK_NEED_ARG_LIST +( + CK_SESSION_HANDLE hSession, /* the session's handle */ + CK_MECHANISM_PTR pMechanism /* the digesting mechanism */ +); +#endif + + +/* C_Digest digests data in a single part. */ +CK_PKCS11_FUNCTION_INFO(C_Digest) +#ifdef CK_NEED_ARG_LIST +( + CK_SESSION_HANDLE hSession, /* the session's handle */ + CK_BYTE_PTR pData, /* data to be digested */ + CK_ULONG ulDataLen, /* bytes of data to digest */ + CK_BYTE_PTR pDigest, /* gets the message digest */ + CK_ULONG_PTR pulDigestLen /* gets digest length */ +); +#endif + + +/* C_DigestUpdate continues a multiple-part message-digesting + * operation. */ +CK_PKCS11_FUNCTION_INFO(C_DigestUpdate) +#ifdef CK_NEED_ARG_LIST +( + CK_SESSION_HANDLE hSession, /* the session's handle */ + CK_BYTE_PTR pPart, /* data to be digested */ + CK_ULONG ulPartLen /* bytes of data to be digested */ +); +#endif + + +/* C_DigestKey continues a multi-part message-digesting + * operation, by digesting the value of a secret key as part of + * the data already digested. */ +CK_PKCS11_FUNCTION_INFO(C_DigestKey) +#ifdef CK_NEED_ARG_LIST +( + CK_SESSION_HANDLE hSession, /* the session's handle */ + CK_OBJECT_HANDLE hKey /* secret key to digest */ +); +#endif + + +/* C_DigestFinal finishes a multiple-part message-digesting + * operation. */ +CK_PKCS11_FUNCTION_INFO(C_DigestFinal) +#ifdef CK_NEED_ARG_LIST +( + CK_SESSION_HANDLE hSession, /* the session's handle */ + CK_BYTE_PTR pDigest, /* gets the message digest */ + CK_ULONG_PTR pulDigestLen /* gets byte count of digest */ +); +#endif + + + +/* Signing and MACing */ + +/* C_SignInit initializes a signature (private key encryption) + * operation, where the signature is (will be) an appendix to + * the data, and plaintext cannot be recovered from the + *signature. */ +CK_PKCS11_FUNCTION_INFO(C_SignInit) +#ifdef CK_NEED_ARG_LIST +( + CK_SESSION_HANDLE hSession, /* the session's handle */ + CK_MECHANISM_PTR pMechanism, /* the signature mechanism */ + CK_OBJECT_HANDLE hKey /* handle of signature key */ +); +#endif + + +/* C_Sign signs (encrypts with private key) data in a single + * part, where the signature is (will be) an appendix to the + * data, and plaintext cannot be recovered from the signature. */ +CK_PKCS11_FUNCTION_INFO(C_Sign) +#ifdef CK_NEED_ARG_LIST +( + CK_SESSION_HANDLE hSession, /* the session's handle */ + CK_BYTE_PTR pData, /* the data to sign */ + CK_ULONG ulDataLen, /* count of bytes to sign */ + CK_BYTE_PTR pSignature, /* gets the signature */ + CK_ULONG_PTR pulSignatureLen /* gets signature length */ +); +#endif + + +/* C_SignUpdate continues a multiple-part signature operation, + * where the signature is (will be) an appendix to the data, + * and plaintext cannot be recovered from the signature. */ +CK_PKCS11_FUNCTION_INFO(C_SignUpdate) +#ifdef CK_NEED_ARG_LIST +( + CK_SESSION_HANDLE hSession, /* the session's handle */ + CK_BYTE_PTR pPart, /* the data to sign */ + CK_ULONG ulPartLen /* count of bytes to sign */ +); +#endif + + +/* C_SignFinal finishes a multiple-part signature operation, + * returning the signature. */ +CK_PKCS11_FUNCTION_INFO(C_SignFinal) +#ifdef CK_NEED_ARG_LIST +( + CK_SESSION_HANDLE hSession, /* the session's handle */ + CK_BYTE_PTR pSignature, /* gets the signature */ + CK_ULONG_PTR pulSignatureLen /* gets signature length */ +); +#endif + + +/* C_SignRecoverInit initializes a signature operation, where + * the data can be recovered from the signature. */ +CK_PKCS11_FUNCTION_INFO(C_SignRecoverInit) +#ifdef CK_NEED_ARG_LIST +( + CK_SESSION_HANDLE hSession, /* the session's handle */ + CK_MECHANISM_PTR pMechanism, /* the signature mechanism */ + CK_OBJECT_HANDLE hKey /* handle of the signature key */ +); +#endif + + +/* C_SignRecover signs data in a single operation, where the + * data can be recovered from the signature. */ +CK_PKCS11_FUNCTION_INFO(C_SignRecover) +#ifdef CK_NEED_ARG_LIST +( + CK_SESSION_HANDLE hSession, /* the session's handle */ + CK_BYTE_PTR pData, /* the data to sign */ + CK_ULONG ulDataLen, /* count of bytes to sign */ + CK_BYTE_PTR pSignature, /* gets the signature */ + CK_ULONG_PTR pulSignatureLen /* gets signature length */ +); +#endif + + + +/* Verifying signatures and MACs */ + +/* C_VerifyInit initializes a verification operation, where the + * signature is an appendix to the data, and plaintext cannot + * cannot be recovered from the signature (e.g. DSA). */ +CK_PKCS11_FUNCTION_INFO(C_VerifyInit) +#ifdef CK_NEED_ARG_LIST +( + CK_SESSION_HANDLE hSession, /* the session's handle */ + CK_MECHANISM_PTR pMechanism, /* the verification mechanism */ + CK_OBJECT_HANDLE hKey /* verification key */ +); +#endif + + +/* C_Verify verifies a signature in a single-part operation, + * where the signature is an appendix to the data, and plaintext + * cannot be recovered from the signature. */ +CK_PKCS11_FUNCTION_INFO(C_Verify) +#ifdef CK_NEED_ARG_LIST +( + CK_SESSION_HANDLE hSession, /* the session's handle */ + CK_BYTE_PTR pData, /* signed data */ + CK_ULONG ulDataLen, /* length of signed data */ + CK_BYTE_PTR pSignature, /* signature */ + CK_ULONG ulSignatureLen /* signature length*/ +); +#endif + + +/* C_VerifyUpdate continues a multiple-part verification + * operation, where the signature is an appendix to the data, + * and plaintext cannot be recovered from the signature. */ +CK_PKCS11_FUNCTION_INFO(C_VerifyUpdate) +#ifdef CK_NEED_ARG_LIST +( + CK_SESSION_HANDLE hSession, /* the session's handle */ + CK_BYTE_PTR pPart, /* signed data */ + CK_ULONG ulPartLen /* length of signed data */ +); +#endif + + +/* C_VerifyFinal finishes a multiple-part verification + * operation, checking the signature. */ +CK_PKCS11_FUNCTION_INFO(C_VerifyFinal) +#ifdef CK_NEED_ARG_LIST +( + CK_SESSION_HANDLE hSession, /* the session's handle */ + CK_BYTE_PTR pSignature, /* signature to verify */ + CK_ULONG ulSignatureLen /* signature length */ +); +#endif + + +/* C_VerifyRecoverInit initializes a signature verification + * operation, where the data is recovered from the signature. */ +CK_PKCS11_FUNCTION_INFO(C_VerifyRecoverInit) +#ifdef CK_NEED_ARG_LIST +( + CK_SESSION_HANDLE hSession, /* the session's handle */ + CK_MECHANISM_PTR pMechanism, /* the verification mechanism */ + CK_OBJECT_HANDLE hKey /* verification key */ +); +#endif + + +/* C_VerifyRecover verifies a signature in a single-part + * operation, where the data is recovered from the signature. */ +CK_PKCS11_FUNCTION_INFO(C_VerifyRecover) +#ifdef CK_NEED_ARG_LIST +( + CK_SESSION_HANDLE hSession, /* the session's handle */ + CK_BYTE_PTR pSignature, /* signature to verify */ + CK_ULONG ulSignatureLen, /* signature length */ + CK_BYTE_PTR pData, /* gets signed data */ + CK_ULONG_PTR pulDataLen /* gets signed data len */ +); +#endif + + + +/* Dual-function cryptographic operations */ + +/* C_DigestEncryptUpdate continues a multiple-part digesting + * and encryption operation. */ +CK_PKCS11_FUNCTION_INFO(C_DigestEncryptUpdate) +#ifdef CK_NEED_ARG_LIST +( + CK_SESSION_HANDLE hSession, /* session's handle */ + CK_BYTE_PTR pPart, /* the plaintext data */ + CK_ULONG ulPartLen, /* plaintext length */ + CK_BYTE_PTR pEncryptedPart, /* gets ciphertext */ + CK_ULONG_PTR pulEncryptedPartLen /* gets c-text length */ +); +#endif + + +/* C_DecryptDigestUpdate continues a multiple-part decryption and + * digesting operation. */ +CK_PKCS11_FUNCTION_INFO(C_DecryptDigestUpdate) +#ifdef CK_NEED_ARG_LIST +( + CK_SESSION_HANDLE hSession, /* session's handle */ + CK_BYTE_PTR pEncryptedPart, /* ciphertext */ + CK_ULONG ulEncryptedPartLen, /* ciphertext length */ + CK_BYTE_PTR pPart, /* gets plaintext */ + CK_ULONG_PTR pulPartLen /* gets plaintext len */ +); +#endif + + +/* C_SignEncryptUpdate continues a multiple-part signing and + * encryption operation. */ +CK_PKCS11_FUNCTION_INFO(C_SignEncryptUpdate) +#ifdef CK_NEED_ARG_LIST +( + CK_SESSION_HANDLE hSession, /* session's handle */ + CK_BYTE_PTR pPart, /* the plaintext data */ + CK_ULONG ulPartLen, /* plaintext length */ + CK_BYTE_PTR pEncryptedPart, /* gets ciphertext */ + CK_ULONG_PTR pulEncryptedPartLen /* gets c-text length */ +); +#endif + + +/* C_DecryptVerifyUpdate continues a multiple-part decryption and + * verify operation. */ +CK_PKCS11_FUNCTION_INFO(C_DecryptVerifyUpdate) +#ifdef CK_NEED_ARG_LIST +( + CK_SESSION_HANDLE hSession, /* session's handle */ + CK_BYTE_PTR pEncryptedPart, /* ciphertext */ + CK_ULONG ulEncryptedPartLen, /* ciphertext length */ + CK_BYTE_PTR pPart, /* gets plaintext */ + CK_ULONG_PTR pulPartLen /* gets p-text length */ +); +#endif + + + +/* Key management */ + +/* C_GenerateKey generates a secret key, creating a new key + * object. */ +CK_PKCS11_FUNCTION_INFO(C_GenerateKey) +#ifdef CK_NEED_ARG_LIST +( + CK_SESSION_HANDLE hSession, /* the session's handle */ + CK_MECHANISM_PTR pMechanism, /* key generation mech. */ + CK_ATTRIBUTE_PTR pTemplate, /* template for new key */ + CK_ULONG ulCount, /* # of attrs in template */ + CK_OBJECT_HANDLE_PTR phKey /* gets handle of new key */ +); +#endif + + +/* C_GenerateKeyPair generates a public-key/private-key pair, + * creating new key objects. */ +CK_PKCS11_FUNCTION_INFO(C_GenerateKeyPair) +#ifdef CK_NEED_ARG_LIST +( + CK_SESSION_HANDLE hSession, /* session + * handle */ + CK_MECHANISM_PTR pMechanism, /* key-gen + * mech. */ + CK_ATTRIBUTE_PTR pPublicKeyTemplate, /* template + * for pub. + * key */ + CK_ULONG ulPublicKeyAttributeCount, /* # pub. + * attrs. */ + CK_ATTRIBUTE_PTR pPrivateKeyTemplate, /* template + * for priv. + * key */ + CK_ULONG ulPrivateKeyAttributeCount, /* # priv. + * attrs. */ + CK_OBJECT_HANDLE_PTR phPublicKey, /* gets pub. + * key + * handle */ + CK_OBJECT_HANDLE_PTR phPrivateKey /* gets + * priv. key + * handle */ +); +#endif + + +/* C_WrapKey wraps (i.e., encrypts) a key. */ +CK_PKCS11_FUNCTION_INFO(C_WrapKey) +#ifdef CK_NEED_ARG_LIST +( + CK_SESSION_HANDLE hSession, /* the session's handle */ + CK_MECHANISM_PTR pMechanism, /* the wrapping mechanism */ + CK_OBJECT_HANDLE hWrappingKey, /* wrapping key */ + CK_OBJECT_HANDLE hKey, /* key to be wrapped */ + CK_BYTE_PTR pWrappedKey, /* gets wrapped key */ + CK_ULONG_PTR pulWrappedKeyLen /* gets wrapped key size */ +); +#endif + + +/* C_UnwrapKey unwraps (decrypts) a wrapped key, creating a new + * key object. */ +CK_PKCS11_FUNCTION_INFO(C_UnwrapKey) +#ifdef CK_NEED_ARG_LIST +( + CK_SESSION_HANDLE hSession, /* session's handle */ + CK_MECHANISM_PTR pMechanism, /* unwrapping mech. */ + CK_OBJECT_HANDLE hUnwrappingKey, /* unwrapping key */ + CK_BYTE_PTR pWrappedKey, /* the wrapped key */ + CK_ULONG ulWrappedKeyLen, /* wrapped key len */ + CK_ATTRIBUTE_PTR pTemplate, /* new key template */ + CK_ULONG ulAttributeCount, /* template length */ + CK_OBJECT_HANDLE_PTR phKey /* gets new handle */ +); +#endif + + +/* C_DeriveKey derives a key from a base key, creating a new key + * object. */ +CK_PKCS11_FUNCTION_INFO(C_DeriveKey) +#ifdef CK_NEED_ARG_LIST +( + CK_SESSION_HANDLE hSession, /* session's handle */ + CK_MECHANISM_PTR pMechanism, /* key deriv. mech. */ + CK_OBJECT_HANDLE hBaseKey, /* base key */ + CK_ATTRIBUTE_PTR pTemplate, /* new key template */ + CK_ULONG ulAttributeCount, /* template length */ + CK_OBJECT_HANDLE_PTR phKey /* gets new handle */ +); +#endif + + + +/* Random number generation */ + +/* C_SeedRandom mixes additional seed material into the token's + * random number generator. */ +CK_PKCS11_FUNCTION_INFO(C_SeedRandom) +#ifdef CK_NEED_ARG_LIST +( + CK_SESSION_HANDLE hSession, /* the session's handle */ + CK_BYTE_PTR pSeed, /* the seed material */ + CK_ULONG ulSeedLen /* length of seed material */ +); +#endif + + +/* C_GenerateRandom generates random data. */ +CK_PKCS11_FUNCTION_INFO(C_GenerateRandom) +#ifdef CK_NEED_ARG_LIST +( + CK_SESSION_HANDLE hSession, /* the session's handle */ + CK_BYTE_PTR RandomData, /* receives the random data */ + CK_ULONG ulRandomLen /* # of bytes to generate */ +); +#endif + + + +/* Parallel function management */ + +/* C_GetFunctionStatus is a legacy function; it obtains an + * updated status of a function running in parallel with an + * application. */ +CK_PKCS11_FUNCTION_INFO(C_GetFunctionStatus) +#ifdef CK_NEED_ARG_LIST +( + CK_SESSION_HANDLE hSession /* the session's handle */ +); +#endif + + +/* C_CancelFunction is a legacy function; it cancels a function + * running in parallel. */ +CK_PKCS11_FUNCTION_INFO(C_CancelFunction) +#ifdef CK_NEED_ARG_LIST +( + CK_SESSION_HANDLE hSession /* the session's handle */ +); +#endif + + + +/* Functions added in for Cryptoki Version 2.01 or later */ + +/* C_WaitForSlotEvent waits for a slot event (token insertion, + * removal, etc.) to occur. */ +CK_PKCS11_FUNCTION_INFO(C_WaitForSlotEvent) +#ifdef CK_NEED_ARG_LIST +( + CK_FLAGS flags, /* blocking/nonblocking flag */ + CK_SLOT_ID_PTR pSlot, /* location that receives the slot ID */ + CK_VOID_PTR pRserved /* reserved. Should be NULL_PTR */ +); +#endif diff --git a/src/Mayaqua/pkcs11t.h b/src/Mayaqua/pkcs11t.h index c04b5719..f456504b 100644 --- a/src/Mayaqua/pkcs11t.h +++ b/src/Mayaqua/pkcs11t.h @@ -1,1440 +1,1440 @@ -/* pkcs11t.h include file for PKCS #11. */ -/* $Revision: 1.4 $ */ - -/* License to copy and use this software is granted provided that it is - * identified as "RSA Security Inc. PKCS #11 Cryptographic Token Interface - * (Cryptoki)" in all material mentioning or referencing this software. - - * License is also granted to make and use derivative works provided that - * such works are identified as "derived from the RSA Security Inc. PKCS #11 - * Cryptographic Token Interface (Cryptoki)" in all material mentioning or - * referencing the derived work. - - * RSA Security Inc. makes no representations concerning either the - * merchantability of this software or the suitability of this software for - * any particular purpose. It is provided "as is" without express or implied - * warranty of any kind. - */ - -/* See top of pkcs11.h for information about the macros that - * must be defined and the structure-packing conventions that - * must be set before including this file. */ - -#ifndef _PKCS11T_H_ -#define _PKCS11T_H_ 1 - -#ifndef CK_DISABLE_TRUE_FALSE -#ifndef FALSE -#define FALSE 0 -#endif - -#ifndef TRUE -#define TRUE !(FALSE) -#endif -#endif - -#define CK_TRUE 1 -#define CK_FALSE 0 - -/* an unsigned 8-bit value */ -typedef unsigned char CK_BYTE; - -/* an unsigned 8-bit character */ -typedef CK_BYTE CK_CHAR; - -/* an 8-bit UTF-8 character */ -typedef CK_BYTE CK_UTF8CHAR; - -/* a BYTE-sized Boolean flag */ -typedef CK_BYTE CK_BBOOL; - -/* an unsigned value, at least 32 bits long */ -typedef unsigned long int CK_ULONG; - -/* a signed value, the same size as a CK_ULONG */ -/* CK_LONG is new for v2.0 */ -typedef long int CK_LONG; - -/* at least 32 bits; each bit is a Boolean flag */ -typedef CK_ULONG CK_FLAGS; - - -/* some special values for certain CK_ULONG variables */ -#define CK_UNAVAILABLE_INFORMATION (~0UL) -#define CK_EFFECTIVELY_INFINITE 0 - - -typedef CK_BYTE CK_PTR CK_BYTE_PTR; -typedef CK_CHAR CK_PTR CK_CHAR_PTR; -typedef CK_UTF8CHAR CK_PTR CK_UTF8CHAR_PTR; -typedef CK_ULONG CK_PTR CK_ULONG_PTR; -typedef void CK_PTR CK_VOID_PTR; - -/* Pointer to a CK_VOID_PTR-- i.e., pointer to pointer to void */ -typedef CK_VOID_PTR CK_PTR CK_VOID_PTR_PTR; - - -/* The following value is always invalid if used as a session */ -/* handle or object handle */ -#define CK_INVALID_HANDLE 0 - - -typedef struct CK_VERSION { - CK_BYTE major; /* integer portion of version number */ - CK_BYTE minor; /* 1/100ths portion of version number */ -} CK_VERSION; - -typedef CK_VERSION CK_PTR CK_VERSION_PTR; - - -typedef struct CK_INFO { - /* manufacturerID and libraryDescription have been changed from - * CK_CHAR to CK_UTF8CHAR for v2.10 */ - CK_VERSION cryptokiVersion; /* Cryptoki interface ver */ - CK_UTF8CHAR manufacturerID[32]; /* blank padded */ - CK_FLAGS flags; /* must be zero */ - - /* libraryDescription and libraryVersion are new for v2.0 */ - CK_UTF8CHAR libraryDescription[32]; /* blank padded */ - CK_VERSION libraryVersion; /* version of library */ -} CK_INFO; - -typedef CK_INFO CK_PTR CK_INFO_PTR; - - -/* CK_NOTIFICATION enumerates the types of notifications that - * Cryptoki provides to an application */ -/* CK_NOTIFICATION has been changed from an enum to a CK_ULONG - * for v2.0 */ -typedef CK_ULONG CK_NOTIFICATION; -#define CKN_SURRENDER 0 - - -typedef CK_ULONG CK_SLOT_ID; - -typedef CK_SLOT_ID CK_PTR CK_SLOT_ID_PTR; - - -/* CK_SLOT_INFO provides information about a slot */ -typedef struct CK_SLOT_INFO { - /* slotDescription and manufacturerID have been changed from - * CK_CHAR to CK_UTF8CHAR for v2.10 */ - CK_UTF8CHAR slotDescription[64]; /* blank padded */ - CK_UTF8CHAR manufacturerID[32]; /* blank padded */ - CK_FLAGS flags; - - /* hardwareVersion and firmwareVersion are new for v2.0 */ - CK_VERSION hardwareVersion; /* version of hardware */ - CK_VERSION firmwareVersion; /* version of firmware */ -} CK_SLOT_INFO; - -/* flags: bit flags that provide capabilities of the slot - * Bit Flag Mask Meaning - */ -#define CKF_TOKEN_PRESENT 0x00000001 /* a token is there */ -#define CKF_REMOVABLE_DEVICE 0x00000002 /* removable devices*/ -#define CKF_HW_SLOT 0x00000004 /* hardware slot */ - -typedef CK_SLOT_INFO CK_PTR CK_SLOT_INFO_PTR; - - -/* CK_TOKEN_INFO provides information about a token */ -typedef struct CK_TOKEN_INFO { - /* label, manufacturerID, and model have been changed from - * CK_CHAR to CK_UTF8CHAR for v2.10 */ - CK_UTF8CHAR label[32]; /* blank padded */ - CK_UTF8CHAR manufacturerID[32]; /* blank padded */ - CK_UTF8CHAR model[16]; /* blank padded */ - CK_CHAR serialNumber[16]; /* blank padded */ - CK_FLAGS flags; /* see below */ - - /* ulMaxSessionCount, ulSessionCount, ulMaxRwSessionCount, - * ulRwSessionCount, ulMaxPinLen, and ulMinPinLen have all been - * changed from CK_USHORT to CK_ULONG for v2.0 */ - CK_ULONG ulMaxSessionCount; /* max open sessions */ - CK_ULONG ulSessionCount; /* sess. now open */ - CK_ULONG ulMaxRwSessionCount; /* max R/W sessions */ - CK_ULONG ulRwSessionCount; /* R/W sess. now open */ - CK_ULONG ulMaxPinLen; /* in bytes */ - CK_ULONG ulMinPinLen; /* in bytes */ - CK_ULONG ulTotalPublicMemory; /* in bytes */ - CK_ULONG ulFreePublicMemory; /* in bytes */ - CK_ULONG ulTotalPrivateMemory; /* in bytes */ - CK_ULONG ulFreePrivateMemory; /* in bytes */ - - /* hardwareVersion, firmwareVersion, and time are new for - * v2.0 */ - CK_VERSION hardwareVersion; /* version of hardware */ - CK_VERSION firmwareVersion; /* version of firmware */ - CK_CHAR utcTime[16]; /* time */ -} CK_TOKEN_INFO; - -/* The flags parameter is defined as follows: - * Bit Flag Mask Meaning - */ -#define CKF_RNG 0x00000001 /* has random # - * generator */ -#define CKF_WRITE_PROTECTED 0x00000002 /* token is - * write- - * protected */ -#define CKF_LOGIN_REQUIRED 0x00000004 /* user must - * login */ -#define CKF_USER_PIN_INITIALIZED 0x00000008 /* normal user's - * PIN is set */ - -/* CKF_RESTORE_KEY_NOT_NEEDED is new for v2.0. If it is set, - * that means that *every* time the state of cryptographic - * operations of a session is successfully saved, all keys - * needed to continue those operations are stored in the state */ -#define CKF_RESTORE_KEY_NOT_NEEDED 0x00000020 - -/* CKF_CLOCK_ON_TOKEN is new for v2.0. If it is set, that means - * that the token has some sort of clock. The time on that - * clock is returned in the token info structure */ -#define CKF_CLOCK_ON_TOKEN 0x00000040 - -/* CKF_PROTECTED_AUTHENTICATION_PATH is new for v2.0. If it is - * set, that means that there is some way for the user to login - * without sending a PIN through the Cryptoki library itself */ -#define CKF_PROTECTED_AUTHENTICATION_PATH 0x00000100 - -/* CKF_DUAL_CRYPTO_OPERATIONS is new for v2.0. If it is true, - * that means that a single session with the token can perform - * dual simultaneous cryptographic operations (digest and - * encrypt; decrypt and digest; sign and encrypt; and decrypt - * and sign) */ -#define CKF_DUAL_CRYPTO_OPERATIONS 0x00000200 - -/* CKF_TOKEN_INITIALIZED if new for v2.10. If it is true, the - * token has been initialized using C_InitializeToken or an - * equivalent mechanism outside the scope of PKCS #11. - * Calling C_InitializeToken when this flag is set will cause - * the token to be reinitialized. */ -#define CKF_TOKEN_INITIALIZED 0x00000400 - -/* CKF_SECONDARY_AUTHENTICATION if new for v2.10. If it is - * true, the token supports secondary authentication for - * private key objects. */ -#define CKF_SECONDARY_AUTHENTICATION 0x00000800 - -/* CKF_USER_PIN_COUNT_LOW if new for v2.10. If it is true, an - * incorrect user login PIN has been entered at least once - * since the last successful authentication. */ -#define CKF_USER_PIN_COUNT_LOW 0x00010000 - -/* CKF_USER_PIN_FINAL_TRY if new for v2.10. If it is true, - * supplying an incorrect user PIN will it to become locked. */ -#define CKF_USER_PIN_FINAL_TRY 0x00020000 - -/* CKF_USER_PIN_LOCKED if new for v2.10. If it is true, the - * user PIN has been locked. User login to the token is not - * possible. */ -#define CKF_USER_PIN_LOCKED 0x00040000 - -/* CKF_USER_PIN_TO_BE_CHANGED if new for v2.10. If it is true, - * the user PIN value is the default value set by token - * initialization or manufacturing, or the PIN has been - * expired by the card. */ -#define CKF_USER_PIN_TO_BE_CHANGED 0x00080000 - -/* CKF_SO_PIN_COUNT_LOW if new for v2.10. If it is true, an - * incorrect SO login PIN has been entered at least once since - * the last successful authentication. */ -#define CKF_SO_PIN_COUNT_LOW 0x00100000 - -/* CKF_SO_PIN_FINAL_TRY if new for v2.10. If it is true, - * supplying an incorrect SO PIN will it to become locked. */ -#define CKF_SO_PIN_FINAL_TRY 0x00200000 - -/* CKF_SO_PIN_LOCKED if new for v2.10. If it is true, the SO - * PIN has been locked. SO login to the token is not possible. - */ -#define CKF_SO_PIN_LOCKED 0x00400000 - -/* CKF_SO_PIN_TO_BE_CHANGED if new for v2.10. If it is true, - * the SO PIN value is the default value set by token - * initialization or manufacturing, or the PIN has been - * expired by the card. */ -#define CKF_SO_PIN_TO_BE_CHANGED 0x00800000 - -typedef CK_TOKEN_INFO CK_PTR CK_TOKEN_INFO_PTR; - - -/* CK_SESSION_HANDLE is a Cryptoki-assigned value that - * identifies a session */ -typedef CK_ULONG CK_SESSION_HANDLE; - -typedef CK_SESSION_HANDLE CK_PTR CK_SESSION_HANDLE_PTR; - - -/* CK_USER_TYPE enumerates the types of Cryptoki users */ -/* CK_USER_TYPE has been changed from an enum to a CK_ULONG for - * v2.0 */ -typedef CK_ULONG CK_USER_TYPE; -/* Security Officer */ -#define CKU_SO 0 -/* Normal user */ -#define CKU_USER 1 - - -/* CK_STATE enumerates the session states */ -/* CK_STATE has been changed from an enum to a CK_ULONG for - * v2.0 */ -typedef CK_ULONG CK_STATE; -#define CKS_RO_PUBLIC_SESSION 0 -#define CKS_RO_USER_FUNCTIONS 1 -#define CKS_RW_PUBLIC_SESSION 2 -#define CKS_RW_USER_FUNCTIONS 3 -#define CKS_RW_SO_FUNCTIONS 4 - - -/* CK_SESSION_INFO provides information about a session */ -typedef struct CK_SESSION_INFO { - CK_SLOT_ID slotID; - CK_STATE state; - CK_FLAGS flags; /* see below */ - - /* ulDeviceError was changed from CK_USHORT to CK_ULONG for - * v2.0 */ - CK_ULONG ulDeviceError; /* device-dependent error code */ -} CK_SESSION_INFO; - -/* The flags are defined in the following table: - * Bit Flag Mask Meaning - */ -#define CKF_RW_SESSION 0x00000002 /* session is r/w */ -#define CKF_SERIAL_SESSION 0x00000004 /* no parallel */ - -typedef CK_SESSION_INFO CK_PTR CK_SESSION_INFO_PTR; - - -/* CK_OBJECT_HANDLE is a token-specific identifier for an - * object */ -typedef CK_ULONG CK_OBJECT_HANDLE; - -typedef CK_OBJECT_HANDLE CK_PTR CK_OBJECT_HANDLE_PTR; - - -/* CK_OBJECT_CLASS is a value that identifies the classes (or - * types) of objects that Cryptoki recognizes. It is defined - * as follows: */ -/* CK_OBJECT_CLASS was changed from CK_USHORT to CK_ULONG for - * v2.0 */ -typedef CK_ULONG CK_OBJECT_CLASS; - -/* The following classes of objects are defined: */ -/* CKO_HW_FEATURE is new for v2.10 */ -/* CKO_DOMAIN_PARAMETERS is new for v2.11 */ -#define CKO_DATA 0x00000000 -#define CKO_CERTIFICATE 0x00000001 -#define CKO_PUBLIC_KEY 0x00000002 -#define CKO_PRIVATE_KEY 0x00000003 -#define CKO_SECRET_KEY 0x00000004 -#define CKO_HW_FEATURE 0x00000005 -#define CKO_DOMAIN_PARAMETERS 0x00000006 -#define CKO_VENDOR_DEFINED 0x80000000 - -typedef CK_OBJECT_CLASS CK_PTR CK_OBJECT_CLASS_PTR; - -/* CK_HW_FEATURE_TYPE is new for v2.10. CK_HW_FEATURE_TYPE is a - * value that identifies the hardware feature type of an object - * with CK_OBJECT_CLASS equal to CKO_HW_FEATURE. */ -typedef CK_ULONG CK_HW_FEATURE_TYPE; - -/* The following hardware feature types are defined */ -#define CKH_MONOTONIC_COUNTER 0x00000001 -#define CKH_CLOCK 0x00000002 -#define CKH_VENDOR_DEFINED 0x80000000 - -/* CK_KEY_TYPE is a value that identifies a key type */ -/* CK_KEY_TYPE was changed from CK_USHORT to CK_ULONG for v2.0 */ -typedef CK_ULONG CK_KEY_TYPE; - -/* the following key types are defined: */ -#define CKK_RSA 0x00000000 -#define CKK_DSA 0x00000001 -#define CKK_DH 0x00000002 - -/* CKK_ECDSA and CKK_KEA are new for v2.0 */ -/* CKK_ECDSA is deprecated in v2.11, CKK_EC is preferred. */ -#define CKK_ECDSA 0x00000003 -#define CKK_EC 0x00000003 -#define CKK_X9_42_DH 0x00000004 -#define CKK_KEA 0x00000005 - -#define CKK_GENERIC_SECRET 0x00000010 -#define CKK_RC2 0x00000011 -#define CKK_RC4 0x00000012 -#define CKK_DES 0x00000013 -#define CKK_DES2 0x00000014 -#define CKK_DES3 0x00000015 - -/* all these key types are new for v2.0 */ -#define CKK_CAST 0x00000016 -#define CKK_CAST3 0x00000017 -/* CKK_CAST5 is deprecated in v2.11, CKK_CAST128 is preferred. */ -#define CKK_CAST5 0x00000018 -#define CKK_CAST128 0x00000018 -#define CKK_RC5 0x00000019 -#define CKK_IDEA 0x0000001A -#define CKK_SKIPJACK 0x0000001B -#define CKK_BATON 0x0000001C -#define CKK_JUNIPER 0x0000001D -#define CKK_CDMF 0x0000001E -#define CKK_AES 0x0000001F - -#define CKK_VENDOR_DEFINED 0x80000000 - - -/* CK_CERTIFICATE_TYPE is a value that identifies a certificate - * type */ -/* CK_CERTIFICATE_TYPE was changed from CK_USHORT to CK_ULONG - * for v2.0 */ -typedef CK_ULONG CK_CERTIFICATE_TYPE; - -/* The following certificate types are defined: */ -/* CKC_X_509_ATTR_CERT is new for v2.10 */ -#define CKC_X_509 0x00000000 -#define CKC_X_509_ATTR_CERT 0x00000001 -#define CKC_VENDOR_DEFINED 0x80000000 - - -/* CK_ATTRIBUTE_TYPE is a value that identifies an attribute - * type */ -/* CK_ATTRIBUTE_TYPE was changed from CK_USHORT to CK_ULONG for - * v2.0 */ -typedef CK_ULONG CK_ATTRIBUTE_TYPE; - -/* The following attribute types are defined: */ -#define CKA_CLASS 0x00000000 -#define CKA_TOKEN 0x00000001 -#define CKA_PRIVATE 0x00000002 -#define CKA_LABEL 0x00000003 -#define CKA_APPLICATION 0x00000010 -#define CKA_VALUE 0x00000011 - -/* CKA_OBJECT_ID is new for v2.10 */ -#define CKA_OBJECT_ID 0x00000012 - -#define CKA_CERTIFICATE_TYPE 0x00000080 -#define CKA_ISSUER 0x00000081 -#define CKA_SERIAL_NUMBER 0x00000082 - -/* CKA_AC_ISSUER, CKA_OWNER, and CKA_ATTR_TYPES are new - * for v2.10 */ -#define CKA_AC_ISSUER 0x00000083 -#define CKA_OWNER 0x00000084 -#define CKA_ATTR_TYPES 0x00000085 - -/* CKA_TRUSTED is new for v2.11 */ -#define CKA_TRUSTED 0x00000086 - -#define CKA_KEY_TYPE 0x00000100 -#define CKA_SUBJECT 0x00000101 -#define CKA_ID 0x00000102 -#define CKA_SENSITIVE 0x00000103 -#define CKA_ENCRYPT 0x00000104 -#define CKA_DECRYPT 0x00000105 -#define CKA_WRAP 0x00000106 -#define CKA_UNWRAP 0x00000107 -#define CKA_SIGN 0x00000108 -#define CKA_SIGN_RECOVER 0x00000109 -#define CKA_VERIFY 0x0000010A -#define CKA_VERIFY_RECOVER 0x0000010B -#define CKA_DERIVE 0x0000010C -#define CKA_START_DATE 0x00000110 -#define CKA_END_DATE 0x00000111 -#define CKA_MODULUS 0x00000120 -#define CKA_MODULUS_BITS 0x00000121 -#define CKA_PUBLIC_EXPONENT 0x00000122 -#define CKA_PRIVATE_EXPONENT 0x00000123 -#define CKA_PRIME_1 0x00000124 -#define CKA_PRIME_2 0x00000125 -#define CKA_EXPONENT_1 0x00000126 -#define CKA_EXPONENT_2 0x00000127 -#define CKA_COEFFICIENT 0x00000128 -#define CKA_PRIME 0x00000130 -#define CKA_SUBPRIME 0x00000131 -#define CKA_BASE 0x00000132 - -/* CKA_PRIME_BITS and CKA_SUB_PRIME_BITS are new for v2.11 */ -#define CKA_PRIME_BITS 0x00000133 -#define CKA_SUBPRIME_BITS 0x00000134 -#define CKA_SUB_PRIME_BITS CKA_SUBPRIME_BITS -/* (To retain backwards-compatibility) */ - -#define CKA_VALUE_BITS 0x00000160 -#define CKA_VALUE_LEN 0x00000161 - -/* CKA_EXTRACTABLE, CKA_LOCAL, CKA_NEVER_EXTRACTABLE, - * CKA_ALWAYS_SENSITIVE, CKA_MODIFIABLE, CKA_ECDSA_PARAMS, - * and CKA_EC_POINT are new for v2.0 */ -#define CKA_EXTRACTABLE 0x00000162 -#define CKA_LOCAL 0x00000163 -#define CKA_NEVER_EXTRACTABLE 0x00000164 -#define CKA_ALWAYS_SENSITIVE 0x00000165 - -/* CKA_KEY_GEN_MECHANISM is new for v2.11 */ -#define CKA_KEY_GEN_MECHANISM 0x00000166 - -#define CKA_MODIFIABLE 0x00000170 - -/* CKA_ECDSA_PARAMS is deprecated in v2.11, - * CKA_EC_PARAMS is preferred. */ -#define CKA_ECDSA_PARAMS 0x00000180 -#define CKA_EC_PARAMS 0x00000180 - -#define CKA_EC_POINT 0x00000181 - -/* CKA_SECONDARY_AUTH, CKA_AUTH_PIN_FLAGS, - * CKA_HW_FEATURE_TYPE, CKA_RESET_ON_INIT, and CKA_HAS_RESET - * are new for v2.10 */ -#define CKA_SECONDARY_AUTH 0x00000200 -#define CKA_AUTH_PIN_FLAGS 0x00000201 -#define CKA_HW_FEATURE_TYPE 0x00000300 -#define CKA_RESET_ON_INIT 0x00000301 -#define CKA_HAS_RESET 0x00000302 - -#define CKA_VENDOR_DEFINED 0x80000000 - - -/* CK_ATTRIBUTE is a structure that includes the type, length - * and value of an attribute */ -typedef struct CK_ATTRIBUTE { - CK_ATTRIBUTE_TYPE type; - CK_VOID_PTR pValue; - - /* ulValueLen went from CK_USHORT to CK_ULONG for v2.0 */ - CK_ULONG ulValueLen; /* in bytes */ -} CK_ATTRIBUTE; - -typedef CK_ATTRIBUTE CK_PTR CK_ATTRIBUTE_PTR; - - -/* CK_DATE is a structure that defines a date */ -typedef struct CK_DATE{ - CK_CHAR year[4]; /* the year ("1900" - "9999") */ - CK_CHAR month[2]; /* the month ("01" - "12") */ - CK_CHAR day[2]; /* the day ("01" - "31") */ -} CK_DATE; - - -/* CK_MECHANISM_TYPE is a value that identifies a mechanism - * type */ -/* CK_MECHANISM_TYPE was changed from CK_USHORT to CK_ULONG for - * v2.0 */ -typedef CK_ULONG CK_MECHANISM_TYPE; - -/* the following mechanism types are defined: */ -#define CKM_RSA_PKCS_KEY_PAIR_GEN 0x00000000 -#define CKM_RSA_PKCS 0x00000001 -#define CKM_RSA_9796 0x00000002 -#define CKM_RSA_X_509 0x00000003 - -/* CKM_MD2_RSA_PKCS, CKM_MD5_RSA_PKCS, and CKM_SHA1_RSA_PKCS - * are new for v2.0. They are mechanisms which hash and sign */ -#define CKM_MD2_RSA_PKCS 0x00000004 -#define CKM_MD5_RSA_PKCS 0x00000005 -#define CKM_SHA1_RSA_PKCS 0x00000006 - -/* CKM_RIPEMD128_RSA_PKCS, CKM_RIPEMD160_RSA_PKCS, and - * CKM_RSA_PKCS_OAEP are new for v2.10 */ -#define CKM_RIPEMD128_RSA_PKCS 0x00000007 -#define CKM_RIPEMD160_RSA_PKCS 0x00000008 -#define CKM_RSA_PKCS_OAEP 0x00000009 - -/* CKM_RSA_X9_31_KEY_PAIR_GEN, CKM_RSA_X9_31, CKM_SHA1_RSA_X9_31, - * CKM_RSA_PKCS_PSS, and CKM_SHA1_RSA_PKCS_PSS are new for v2.11 */ -#define CKM_RSA_X9_31_KEY_PAIR_GEN 0x0000000A -#define CKM_RSA_X9_31 0x0000000B -#define CKM_SHA1_RSA_X9_31 0x0000000C -#define CKM_RSA_PKCS_PSS 0x0000000D -#define CKM_SHA1_RSA_PKCS_PSS 0x0000000E - -#define CKM_DSA_KEY_PAIR_GEN 0x00000010 -#define CKM_DSA 0x00000011 -#define CKM_DSA_SHA1 0x00000012 -#define CKM_DH_PKCS_KEY_PAIR_GEN 0x00000020 -#define CKM_DH_PKCS_DERIVE 0x00000021 - -/* CKM_X9_42_DH_KEY_PAIR_GEN, CKM_X9_42_DH_DERIVE, - * CKM_X9_42_DH_HYBRID_DERIVE, and CKM_X9_42_MQV_DERIVE are new for - * v2.11 */ -#define CKM_X9_42_DH_KEY_PAIR_GEN 0x00000030 -#define CKM_X9_42_DH_DERIVE 0x00000031 -#define CKM_X9_42_DH_HYBRID_DERIVE 0x00000032 -#define CKM_X9_42_MQV_DERIVE 0x00000033 - -#define CKM_RC2_KEY_GEN 0x00000100 -#define CKM_RC2_ECB 0x00000101 -#define CKM_RC2_CBC 0x00000102 -#define CKM_RC2_MAC 0x00000103 - -/* CKM_RC2_MAC_GENERAL and CKM_RC2_CBC_PAD are new for v2.0 */ -#define CKM_RC2_MAC_GENERAL 0x00000104 -#define CKM_RC2_CBC_PAD 0x00000105 - -#define CKM_RC4_KEY_GEN 0x00000110 -#define CKM_RC4 0x00000111 -#define CKM_DES_KEY_GEN 0x00000120 -#define CKM_DES_ECB 0x00000121 -#define CKM_DES_CBC 0x00000122 -#define CKM_DES_MAC 0x00000123 - -/* CKM_DES_MAC_GENERAL and CKM_DES_CBC_PAD are new for v2.0 */ -#define CKM_DES_MAC_GENERAL 0x00000124 -#define CKM_DES_CBC_PAD 0x00000125 - -#define CKM_DES2_KEY_GEN 0x00000130 -#define CKM_DES3_KEY_GEN 0x00000131 -#define CKM_DES3_ECB 0x00000132 -#define CKM_DES3_CBC 0x00000133 -#define CKM_DES3_MAC 0x00000134 - -/* CKM_DES3_MAC_GENERAL, CKM_DES3_CBC_PAD, CKM_CDMF_KEY_GEN, - * CKM_CDMF_ECB, CKM_CDMF_CBC, CKM_CDMF_MAC, - * CKM_CDMF_MAC_GENERAL, and CKM_CDMF_CBC_PAD are new for v2.0 */ -#define CKM_DES3_MAC_GENERAL 0x00000135 -#define CKM_DES3_CBC_PAD 0x00000136 -#define CKM_CDMF_KEY_GEN 0x00000140 -#define CKM_CDMF_ECB 0x00000141 -#define CKM_CDMF_CBC 0x00000142 -#define CKM_CDMF_MAC 0x00000143 -#define CKM_CDMF_MAC_GENERAL 0x00000144 -#define CKM_CDMF_CBC_PAD 0x00000145 - -#define CKM_MD2 0x00000200 - -/* CKM_MD2_HMAC and CKM_MD2_HMAC_GENERAL are new for v2.0 */ -#define CKM_MD2_HMAC 0x00000201 -#define CKM_MD2_HMAC_GENERAL 0x00000202 - -#define CKM_MD5 0x00000210 - -/* CKM_MD5_HMAC and CKM_MD5_HMAC_GENERAL are new for v2.0 */ -#define CKM_MD5_HMAC 0x00000211 -#define CKM_MD5_HMAC_GENERAL 0x00000212 - -#define CKM_SHA_1 0x00000220 - -/* CKM_SHA_1_HMAC and CKM_SHA_1_HMAC_GENERAL are new for v2.0 */ -#define CKM_SHA_1_HMAC 0x00000221 -#define CKM_SHA_1_HMAC_GENERAL 0x00000222 - -/* CKM_RIPEMD128, CKM_RIPEMD128_HMAC, - * CKM_RIPEMD128_HMAC_GENERAL, CKM_RIPEMD160, CKM_RIPEMD160_HMAC, - * and CKM_RIPEMD160_HMAC_GENERAL are new for v2.10 */ -#define CKM_RIPEMD128 0x00000230 -#define CKM_RIPEMD128_HMAC 0x00000231 -#define CKM_RIPEMD128_HMAC_GENERAL 0x00000232 -#define CKM_RIPEMD160 0x00000240 -#define CKM_RIPEMD160_HMAC 0x00000241 -#define CKM_RIPEMD160_HMAC_GENERAL 0x00000242 - -/* All of the following mechanisms are new for v2.0 */ -/* Note that CAST128 and CAST5 are the same algorithm */ -#define CKM_CAST_KEY_GEN 0x00000300 -#define CKM_CAST_ECB 0x00000301 -#define CKM_CAST_CBC 0x00000302 -#define CKM_CAST_MAC 0x00000303 -#define CKM_CAST_MAC_GENERAL 0x00000304 -#define CKM_CAST_CBC_PAD 0x00000305 -#define CKM_CAST3_KEY_GEN 0x00000310 -#define CKM_CAST3_ECB 0x00000311 -#define CKM_CAST3_CBC 0x00000312 -#define CKM_CAST3_MAC 0x00000313 -#define CKM_CAST3_MAC_GENERAL 0x00000314 -#define CKM_CAST3_CBC_PAD 0x00000315 -#define CKM_CAST5_KEY_GEN 0x00000320 -#define CKM_CAST128_KEY_GEN 0x00000320 -#define CKM_CAST5_ECB 0x00000321 -#define CKM_CAST128_ECB 0x00000321 -#define CKM_CAST5_CBC 0x00000322 -#define CKM_CAST128_CBC 0x00000322 -#define CKM_CAST5_MAC 0x00000323 -#define CKM_CAST128_MAC 0x00000323 -#define CKM_CAST5_MAC_GENERAL 0x00000324 -#define CKM_CAST128_MAC_GENERAL 0x00000324 -#define CKM_CAST5_CBC_PAD 0x00000325 -#define CKM_CAST128_CBC_PAD 0x00000325 -#define CKM_RC5_KEY_GEN 0x00000330 -#define CKM_RC5_ECB 0x00000331 -#define CKM_RC5_CBC 0x00000332 -#define CKM_RC5_MAC 0x00000333 -#define CKM_RC5_MAC_GENERAL 0x00000334 -#define CKM_RC5_CBC_PAD 0x00000335 -#define CKM_IDEA_KEY_GEN 0x00000340 -#define CKM_IDEA_ECB 0x00000341 -#define CKM_IDEA_CBC 0x00000342 -#define CKM_IDEA_MAC 0x00000343 -#define CKM_IDEA_MAC_GENERAL 0x00000344 -#define CKM_IDEA_CBC_PAD 0x00000345 -#define CKM_GENERIC_SECRET_KEY_GEN 0x00000350 -#define CKM_CONCATENATE_BASE_AND_KEY 0x00000360 -#define CKM_CONCATENATE_BASE_AND_DATA 0x00000362 -#define CKM_CONCATENATE_DATA_AND_BASE 0x00000363 -#define CKM_XOR_BASE_AND_DATA 0x00000364 -#define CKM_EXTRACT_KEY_FROM_KEY 0x00000365 -#define CKM_SSL3_PRE_MASTER_KEY_GEN 0x00000370 -#define CKM_SSL3_MASTER_KEY_DERIVE 0x00000371 -#define CKM_SSL3_KEY_AND_MAC_DERIVE 0x00000372 - -/* CKM_SSL3_MASTER_KEY_DERIVE_DH, CKM_TLS_PRE_MASTER_KEY_GEN, - * CKM_TLS_MASTER_KEY_DERIVE, CKM_TLS_KEY_AND_MAC_DERIVE, and - * CKM_TLS_MASTER_KEY_DERIVE_DH are new for v2.11 */ -#define CKM_SSL3_MASTER_KEY_DERIVE_DH 0x00000373 -#define CKM_TLS_PRE_MASTER_KEY_GEN 0x00000374 -#define CKM_TLS_MASTER_KEY_DERIVE 0x00000375 -#define CKM_TLS_KEY_AND_MAC_DERIVE 0x00000376 -#define CKM_TLS_MASTER_KEY_DERIVE_DH 0x00000377 - -#define CKM_SSL3_MD5_MAC 0x00000380 -#define CKM_SSL3_SHA1_MAC 0x00000381 -#define CKM_MD5_KEY_DERIVATION 0x00000390 -#define CKM_MD2_KEY_DERIVATION 0x00000391 -#define CKM_SHA1_KEY_DERIVATION 0x00000392 -#define CKM_PBE_MD2_DES_CBC 0x000003A0 -#define CKM_PBE_MD5_DES_CBC 0x000003A1 -#define CKM_PBE_MD5_CAST_CBC 0x000003A2 -#define CKM_PBE_MD5_CAST3_CBC 0x000003A3 -#define CKM_PBE_MD5_CAST5_CBC 0x000003A4 -#define CKM_PBE_MD5_CAST128_CBC 0x000003A4 -#define CKM_PBE_SHA1_CAST5_CBC 0x000003A5 -#define CKM_PBE_SHA1_CAST128_CBC 0x000003A5 -#define CKM_PBE_SHA1_RC4_128 0x000003A6 -#define CKM_PBE_SHA1_RC4_40 0x000003A7 -#define CKM_PBE_SHA1_DES3_EDE_CBC 0x000003A8 -#define CKM_PBE_SHA1_DES2_EDE_CBC 0x000003A9 -#define CKM_PBE_SHA1_RC2_128_CBC 0x000003AA -#define CKM_PBE_SHA1_RC2_40_CBC 0x000003AB - -/* CKM_PKCS5_PBKD2 is new for v2.10 */ -#define CKM_PKCS5_PBKD2 0x000003B0 - -#define CKM_PBA_SHA1_WITH_SHA1_HMAC 0x000003C0 -#define CKM_KEY_WRAP_LYNKS 0x00000400 -#define CKM_KEY_WRAP_SET_OAEP 0x00000401 - -/* Fortezza mechanisms */ -#define CKM_SKIPJACK_KEY_GEN 0x00001000 -#define CKM_SKIPJACK_ECB64 0x00001001 -#define CKM_SKIPJACK_CBC64 0x00001002 -#define CKM_SKIPJACK_OFB64 0x00001003 -#define CKM_SKIPJACK_CFB64 0x00001004 -#define CKM_SKIPJACK_CFB32 0x00001005 -#define CKM_SKIPJACK_CFB16 0x00001006 -#define CKM_SKIPJACK_CFB8 0x00001007 -#define CKM_SKIPJACK_WRAP 0x00001008 -#define CKM_SKIPJACK_PRIVATE_WRAP 0x00001009 -#define CKM_SKIPJACK_RELAYX 0x0000100a -#define CKM_KEA_KEY_PAIR_GEN 0x00001010 -#define CKM_KEA_KEY_DERIVE 0x00001011 -#define CKM_FORTEZZA_TIMESTAMP 0x00001020 -#define CKM_BATON_KEY_GEN 0x00001030 -#define CKM_BATON_ECB128 0x00001031 -#define CKM_BATON_ECB96 0x00001032 -#define CKM_BATON_CBC128 0x00001033 -#define CKM_BATON_COUNTER 0x00001034 -#define CKM_BATON_SHUFFLE 0x00001035 -#define CKM_BATON_WRAP 0x00001036 - -/* CKM_ECDSA_KEY_PAIR_GEN is deprecated in v2.11, - * CKM_EC_KEY_PAIR_GEN is preferred */ -#define CKM_ECDSA_KEY_PAIR_GEN 0x00001040 -#define CKM_EC_KEY_PAIR_GEN 0x00001040 - -#define CKM_ECDSA 0x00001041 -#define CKM_ECDSA_SHA1 0x00001042 - -/* CKM_ECDH1_DERIVE, CKM_ECDH1_COFACTOR_DERIVE, and CKM_ECMQV_DERIVE - * are new for v2.11 */ -#define CKM_ECDH1_DERIVE 0x00001050 -#define CKM_ECDH1_COFACTOR_DERIVE 0x00001051 -#define CKM_ECMQV_DERIVE 0x00001052 - -#define CKM_JUNIPER_KEY_GEN 0x00001060 -#define CKM_JUNIPER_ECB128 0x00001061 -#define CKM_JUNIPER_CBC128 0x00001062 -#define CKM_JUNIPER_COUNTER 0x00001063 -#define CKM_JUNIPER_SHUFFLE 0x00001064 -#define CKM_JUNIPER_WRAP 0x00001065 -#define CKM_FASTHASH 0x00001070 - -/* CKM_AES_KEY_GEN, CKM_AES_ECB, CKM_AES_CBC, CKM_AES_MAC, - * CKM_AES_MAC_GENERAL, CKM_AES_CBC_PAD, CKM_DSA_PARAMETER_GEN, - * CKM_DH_PKCS_PARAMETER_GEN, and CKM_X9_42_DH_PARAMETER_GEN are - * new for v2.11 */ -#define CKM_AES_KEY_GEN 0x00001080 -#define CKM_AES_ECB 0x00001081 -#define CKM_AES_CBC 0x00001082 -#define CKM_AES_MAC 0x00001083 -#define CKM_AES_MAC_GENERAL 0x00001084 -#define CKM_AES_CBC_PAD 0x00001085 -#define CKM_DSA_PARAMETER_GEN 0x00002000 -#define CKM_DH_PKCS_PARAMETER_GEN 0x00002001 -#define CKM_X9_42_DH_PARAMETER_GEN 0x00002002 - -#define CKM_VENDOR_DEFINED 0x80000000 - -typedef CK_MECHANISM_TYPE CK_PTR CK_MECHANISM_TYPE_PTR; - - -/* CK_MECHANISM is a structure that specifies a particular - * mechanism */ -typedef struct CK_MECHANISM { - CK_MECHANISM_TYPE mechanism; - CK_VOID_PTR pParameter; - - /* ulParameterLen was changed from CK_USHORT to CK_ULONG for - * v2.0 */ - CK_ULONG ulParameterLen; /* in bytes */ -} CK_MECHANISM; - -typedef CK_MECHANISM CK_PTR CK_MECHANISM_PTR; - - -/* CK_MECHANISM_INFO provides information about a particular - * mechanism */ -typedef struct CK_MECHANISM_INFO { - CK_ULONG ulMinKeySize; - CK_ULONG ulMaxKeySize; - CK_FLAGS flags; -} CK_MECHANISM_INFO; - -/* The flags are defined as follows: - * Bit Flag Mask Meaning */ -#define CKF_HW 0x00000001 /* performed by HW */ - -/* The flags CKF_ENCRYPT, CKF_DECRYPT, CKF_DIGEST, CKF_SIGN, - * CKG_SIGN_RECOVER, CKF_VERIFY, CKF_VERIFY_RECOVER, - * CKF_GENERATE, CKF_GENERATE_KEY_PAIR, CKF_WRAP, CKF_UNWRAP, - * and CKF_DERIVE are new for v2.0. They specify whether or not - * a mechanism can be used for a particular task */ -#define CKF_ENCRYPT 0x00000100 -#define CKF_DECRYPT 0x00000200 -#define CKF_DIGEST 0x00000400 -#define CKF_SIGN 0x00000800 -#define CKF_SIGN_RECOVER 0x00001000 -#define CKF_VERIFY 0x00002000 -#define CKF_VERIFY_RECOVER 0x00004000 -#define CKF_GENERATE 0x00008000 -#define CKF_GENERATE_KEY_PAIR 0x00010000 -#define CKF_WRAP 0x00020000 -#define CKF_UNWRAP 0x00040000 -#define CKF_DERIVE 0x00080000 - -/* CKF_EC_F_P, CKF_EC_F_2M, CKF_EC_ECPARAMETERS, CKF_EC_NAMEDCURVE, - * CKF_EC_UNCOMPRESS, and CKF_EC_COMPRESS are new for v2.11. They - * describe a token's EC capabilities not available in mechanism - * information. */ -#define CKF_EC_F_P 0x00100000 -#define CKF_EC_F_2M 0x00200000 -#define CKF_EC_ECPARAMETERS 0x00400000 -#define CKF_EC_NAMEDCURVE 0x00800000 -#define CKF_EC_UNCOMPRESS 0x01000000 -#define CKF_EC_COMPRESS 0x02000000 - -#define CKF_EXTENSION 0x80000000 /* FALSE for 2.01 */ - -typedef CK_MECHANISM_INFO CK_PTR CK_MECHANISM_INFO_PTR; - - -/* CK_RV is a value that identifies the return value of a - * Cryptoki function */ -/* CK_RV was changed from CK_USHORT to CK_ULONG for v2.0 */ -typedef CK_ULONG CK_RV; - -#define CKR_OK 0x00000000 -#define CKR_CANCEL 0x00000001 -#define CKR_HOST_MEMORY 0x00000002 -#define CKR_SLOT_ID_INVALID 0x00000003 - -/* CKR_FLAGS_INVALID was removed for v2.0 */ - -/* CKR_GENERAL_ERROR and CKR_FUNCTION_FAILED are new for v2.0 */ -#define CKR_GENERAL_ERROR 0x00000005 -#define CKR_FUNCTION_FAILED 0x00000006 - -/* CKR_ARGUMENTS_BAD, CKR_NO_EVENT, CKR_NEED_TO_CREATE_THREADS, - * and CKR_CANT_LOCK are new for v2.01 */ -#define CKR_ARGUMENTS_BAD 0x00000007 -#define CKR_NO_EVENT 0x00000008 -#define CKR_NEED_TO_CREATE_THREADS 0x00000009 -#define CKR_CANT_LOCK 0x0000000A - -#define CKR_ATTRIBUTE_READ_ONLY 0x00000010 -#define CKR_ATTRIBUTE_SENSITIVE 0x00000011 -#define CKR_ATTRIBUTE_TYPE_INVALID 0x00000012 -#define CKR_ATTRIBUTE_VALUE_INVALID 0x00000013 -#define CKR_DATA_INVALID 0x00000020 -#define CKR_DATA_LEN_RANGE 0x00000021 -#define CKR_DEVICE_ERROR 0x00000030 -#define CKR_DEVICE_MEMORY 0x00000031 -#define CKR_DEVICE_REMOVED 0x00000032 -#define CKR_ENCRYPTED_DATA_INVALID 0x00000040 -#define CKR_ENCRYPTED_DATA_LEN_RANGE 0x00000041 -#define CKR_FUNCTION_CANCELED 0x00000050 -#define CKR_FUNCTION_NOT_PARALLEL 0x00000051 - -/* CKR_FUNCTION_NOT_SUPPORTED is new for v2.0 */ -#define CKR_FUNCTION_NOT_SUPPORTED 0x00000054 - -#define CKR_KEY_HANDLE_INVALID 0x00000060 - -/* CKR_KEY_SENSITIVE was removed for v2.0 */ - -#define CKR_KEY_SIZE_RANGE 0x00000062 -#define CKR_KEY_TYPE_INCONSISTENT 0x00000063 - -/* CKR_KEY_NOT_NEEDED, CKR_KEY_CHANGED, CKR_KEY_NEEDED, - * CKR_KEY_INDIGESTIBLE, CKR_KEY_FUNCTION_NOT_PERMITTED, - * CKR_KEY_NOT_WRAPPABLE, and CKR_KEY_UNEXTRACTABLE are new for - * v2.0 */ -#define CKR_KEY_NOT_NEEDED 0x00000064 -#define CKR_KEY_CHANGED 0x00000065 -#define CKR_KEY_NEEDED 0x00000066 -#define CKR_KEY_INDIGESTIBLE 0x00000067 -#define CKR_KEY_FUNCTION_NOT_PERMITTED 0x00000068 -#define CKR_KEY_NOT_WRAPPABLE 0x00000069 -#define CKR_KEY_UNEXTRACTABLE 0x0000006A - -#define CKR_MECHANISM_INVALID 0x00000070 -#define CKR_MECHANISM_PARAM_INVALID 0x00000071 - -/* CKR_OBJECT_CLASS_INCONSISTENT and CKR_OBJECT_CLASS_INVALID - * were removed for v2.0 */ -#define CKR_OBJECT_HANDLE_INVALID 0x00000082 -#define CKR_OPERATION_ACTIVE 0x00000090 -#define CKR_OPERATION_NOT_INITIALIZED 0x00000091 -#define CKR_PIN_INCORRECT 0x000000A0 -#define CKR_PIN_INVALID 0x000000A1 -#define CKR_PIN_LEN_RANGE 0x000000A2 - -/* CKR_PIN_EXPIRED and CKR_PIN_LOCKED are new for v2.0 */ -#define CKR_PIN_EXPIRED 0x000000A3 -#define CKR_PIN_LOCKED 0x000000A4 - -#define CKR_SESSION_CLOSED 0x000000B0 -#define CKR_SESSION_COUNT 0x000000B1 -#define CKR_SESSION_HANDLE_INVALID 0x000000B3 -#define CKR_SESSION_PARALLEL_NOT_SUPPORTED 0x000000B4 -#define CKR_SESSION_READ_ONLY 0x000000B5 -#define CKR_SESSION_EXISTS 0x000000B6 - -/* CKR_SESSION_READ_ONLY_EXISTS and - * CKR_SESSION_READ_WRITE_SO_EXISTS are new for v2.0 */ -#define CKR_SESSION_READ_ONLY_EXISTS 0x000000B7 -#define CKR_SESSION_READ_WRITE_SO_EXISTS 0x000000B8 - -#define CKR_SIGNATURE_INVALID 0x000000C0 -#define CKR_SIGNATURE_LEN_RANGE 0x000000C1 -#define CKR_TEMPLATE_INCOMPLETE 0x000000D0 -#define CKR_TEMPLATE_INCONSISTENT 0x000000D1 -#define CKR_TOKEN_NOT_PRESENT 0x000000E0 -#define CKR_TOKEN_NOT_RECOGNIZED 0x000000E1 -#define CKR_TOKEN_WRITE_PROTECTED 0x000000E2 -#define CKR_UNWRAPPING_KEY_HANDLE_INVALID 0x000000F0 -#define CKR_UNWRAPPING_KEY_SIZE_RANGE 0x000000F1 -#define CKR_UNWRAPPING_KEY_TYPE_INCONSISTENT 0x000000F2 -#define CKR_USER_ALREADY_LOGGED_IN 0x00000100 -#define CKR_USER_NOT_LOGGED_IN 0x00000101 -#define CKR_USER_PIN_NOT_INITIALIZED 0x00000102 -#define CKR_USER_TYPE_INVALID 0x00000103 - -/* CKR_USER_ANOTHER_ALREADY_LOGGED_IN and CKR_USER_TOO_MANY_TYPES - * are new to v2.01 */ -#define CKR_USER_ANOTHER_ALREADY_LOGGED_IN 0x00000104 -#define CKR_USER_TOO_MANY_TYPES 0x00000105 - -#define CKR_WRAPPED_KEY_INVALID 0x00000110 -#define CKR_WRAPPED_KEY_LEN_RANGE 0x00000112 -#define CKR_WRAPPING_KEY_HANDLE_INVALID 0x00000113 -#define CKR_WRAPPING_KEY_SIZE_RANGE 0x00000114 -#define CKR_WRAPPING_KEY_TYPE_INCONSISTENT 0x00000115 -#define CKR_RANDOM_SEED_NOT_SUPPORTED 0x00000120 - -/* These are new to v2.0 */ -#define CKR_RANDOM_NO_RNG 0x00000121 - -/* These are new to v2.11 */ -#define CKR_DOMAIN_PARAMS_INVALID 0x00000130 - -/* These are new to v2.0 */ -#define CKR_BUFFER_TOO_SMALL 0x00000150 -#define CKR_SAVED_STATE_INVALID 0x00000160 -#define CKR_INFORMATION_SENSITIVE 0x00000170 -#define CKR_STATE_UNSAVEABLE 0x00000180 - -/* These are new to v2.01 */ -#define CKR_CRYPTOKI_NOT_INITIALIZED 0x00000190 -#define CKR_CRYPTOKI_ALREADY_INITIALIZED 0x00000191 -#define CKR_MUTEX_BAD 0x000001A0 -#define CKR_MUTEX_NOT_LOCKED 0x000001A1 - -#define CKR_VENDOR_DEFINED 0x80000000 - - -/* CK_NOTIFY is an application callback that processes events */ -typedef CK_CALLBACK_FUNCTION(CK_RV, CK_NOTIFY)( - CK_SESSION_HANDLE hSession, /* the session's handle */ - CK_NOTIFICATION event, - CK_VOID_PTR pApplication /* passed to C_OpenSession */ -); - - -/* CK_FUNCTION_LIST is a structure holding a Cryptoki spec - * version and pointers of appropriate types to all the - * Cryptoki functions */ -/* CK_FUNCTION_LIST is new for v2.0 */ -typedef struct CK_FUNCTION_LIST CK_FUNCTION_LIST; - -typedef CK_FUNCTION_LIST CK_PTR CK_FUNCTION_LIST_PTR; - -typedef CK_FUNCTION_LIST_PTR CK_PTR CK_FUNCTION_LIST_PTR_PTR; - - -/* CK_CREATEMUTEX is an application callback for creating a - * mutex object */ -typedef CK_CALLBACK_FUNCTION(CK_RV, CK_CREATEMUTEX)( - CK_VOID_PTR_PTR ppMutex /* location to receive ptr to mutex */ -); - - -/* CK_DESTROYMUTEX is an application callback for destroying a - * mutex object */ -typedef CK_CALLBACK_FUNCTION(CK_RV, CK_DESTROYMUTEX)( - CK_VOID_PTR pMutex /* pointer to mutex */ -); - - -/* CK_LOCKMUTEX is an application callback for locking a mutex */ -typedef CK_CALLBACK_FUNCTION(CK_RV, CK_LOCKMUTEX)( - CK_VOID_PTR pMutex /* pointer to mutex */ -); - - -/* CK_UNLOCKMUTEX is an application callback for unlocking a - * mutex */ -typedef CK_CALLBACK_FUNCTION(CK_RV, CK_UNLOCKMUTEX)( - CK_VOID_PTR pMutex /* pointer to mutex */ -); - - -/* CK_C_INITIALIZE_ARGS provides the optional arguments to - * C_Initialize */ -typedef struct CK_C_INITIALIZE_ARGS { - CK_CREATEMUTEX CreateMutex; - CK_DESTROYMUTEX DestroyMutex; - CK_LOCKMUTEX LockMutex; - CK_UNLOCKMUTEX UnlockMutex; - CK_FLAGS flags; - CK_VOID_PTR pReserved; -} CK_C_INITIALIZE_ARGS; - -/* flags: bit flags that provide capabilities of the slot - * Bit Flag Mask Meaning - */ -#define CKF_LIBRARY_CANT_CREATE_OS_THREADS 0x00000001 -#define CKF_OS_LOCKING_OK 0x00000002 - -typedef CK_C_INITIALIZE_ARGS CK_PTR CK_C_INITIALIZE_ARGS_PTR; - - -/* additional flags for parameters to functions */ - -/* CKF_DONT_BLOCK is for the function C_WaitForSlotEvent */ -#define CKF_DONT_BLOCK 1 - -/* CK_RSA_PKCS_OAEP_MGF_TYPE is new for v2.10. - * CK_RSA_PKCS_OAEP_MGF_TYPE is used to indicate the Message - * Generation Function (MGF) applied to a message block when - * formatting a message block for the PKCS #1 OAEP encryption - * scheme. */ -typedef CK_ULONG CK_RSA_PKCS_MGF_TYPE; - -typedef CK_RSA_PKCS_MGF_TYPE CK_PTR CK_RSA_PKCS_MGF_TYPE_PTR; - -/* The following MGFs are defined */ -#define CKG_MGF1_SHA1 0x00000001 - -/* CK_RSA_PKCS_OAEP_SOURCE_TYPE is new for v2.10. - * CK_RSA_PKCS_OAEP_SOURCE_TYPE is used to indicate the source - * of the encoding parameter when formatting a message block - * for the PKCS #1 OAEP encryption scheme. */ -typedef CK_ULONG CK_RSA_PKCS_OAEP_SOURCE_TYPE; - -typedef CK_RSA_PKCS_OAEP_SOURCE_TYPE CK_PTR CK_RSA_PKCS_OAEP_SOURCE_TYPE_PTR; - -/* The following encoding parameter sources are defined */ -#define CKZ_DATA_SPECIFIED 0x00000001 - -/* CK_RSA_PKCS_OAEP_PARAMS is new for v2.10. - * CK_RSA_PKCS_OAEP_PARAMS provides the parameters to the - * CKM_RSA_PKCS_OAEP mechanism. */ -typedef struct CK_RSA_PKCS_OAEP_PARAMS { - CK_MECHANISM_TYPE hashAlg; - CK_RSA_PKCS_MGF_TYPE mgf; - CK_RSA_PKCS_OAEP_SOURCE_TYPE source; - CK_VOID_PTR pSourceData; - CK_ULONG ulSourceDataLen; -} CK_RSA_PKCS_OAEP_PARAMS; - -typedef CK_RSA_PKCS_OAEP_PARAMS CK_PTR CK_RSA_PKCS_OAEP_PARAMS_PTR; - -/* CK_RSA_PKCS_PSS_PARAMS is new for v2.11. - * CK_RSA_PKCS_PSS_PARAMS provides the parameters to the - * CKM_RSA_PKCS_PSS mechanism(s). */ -typedef struct CK_RSA_PKCS_PSS_PARAMS { - CK_MECHANISM_TYPE hashAlg; - CK_RSA_PKCS_MGF_TYPE mgf; - CK_ULONG sLen; -} CK_RSA_PKCS_PSS_PARAMS; - -typedef CK_RSA_PKCS_PSS_PARAMS CK_PTR CK_RSA_PKCS_PSS_PARAMS_PTR; - -/* CK_EC_KDF_TYPE is new for v2.11. */ -typedef CK_ULONG CK_EC_KDF_TYPE; - -/* The following EC Key Derivation Functions are defined */ -#define CKD_NULL 0x00000001 -#define CKD_SHA1_KDF 0x00000002 - -/* CK_ECDH1_DERIVE_PARAMS is new for v2.11. - * CK_ECDH1_DERIVE_PARAMS provides the parameters to the - * CKM_ECDH1_DERIVE and CKM_ECDH1_COFACTOR_DERIVE mechanisms, - * where each party contributes one key pair. - */ -typedef struct CK_ECDH1_DERIVE_PARAMS { - CK_EC_KDF_TYPE kdf; - CK_ULONG ulSharedDataLen; - CK_BYTE_PTR pSharedData; - CK_ULONG ulPublicDataLen; - CK_BYTE_PTR pPublicData; -} CK_ECDH1_DERIVE_PARAMS; - -typedef CK_ECDH1_DERIVE_PARAMS CK_PTR CK_ECDH1_DERIVE_PARAMS_PTR; - - -/* CK_ECDH2_DERIVE_PARAMS is new for v2.11. - * CK_ECDH2_DERIVE_PARAMS provides the parameters to the - * CKM_ECMQV_DERIVE mechanism, where each party contributes two key pairs. */ -typedef struct CK_ECDH2_DERIVE_PARAMS { - CK_EC_KDF_TYPE kdf; - CK_ULONG ulSharedDataLen; - CK_BYTE_PTR pSharedData; - CK_ULONG ulPublicDataLen; - CK_BYTE_PTR pPublicData; - CK_ULONG ulPrivateDataLen; - CK_OBJECT_HANDLE hPrivateData; - CK_ULONG ulPublicDataLen2; - CK_BYTE_PTR pPublicData2; -} CK_ECDH2_DERIVE_PARAMS; - -typedef CK_ECDH2_DERIVE_PARAMS CK_PTR CK_ECDH2_DERIVE_PARAMS_PTR; - -/* Typedefs and defines for the CKM_X9_42_DH_KEY_PAIR_GEN and the - * CKM_X9_42_DH_PARAMETER_GEN mechanisms (new for PKCS #11 v2.11) */ -typedef CK_ULONG CK_X9_42_DH_KDF_TYPE; -typedef CK_X9_42_DH_KDF_TYPE CK_PTR CK_X9_42_DH_KDF_TYPE_PTR; - -/* The following X9.42 DH key derivation functions are defined: */ -#define CKD_NULL 0x00000001 -#define CKD_SHA1_KDF_ASN1 0x00000003 -#define CKD_SHA1_KDF_CONCATENATE 0x00000004 - -/* CK_X9_42_DH1_DERIVE_PARAMS is new for v2.11. - * CK_X9_42_DH1_DERIVE_PARAMS provides the parameters to the - * CKM_X9_42_DH_DERIVE key derivation mechanism, where each party - * contributes one key pair */ -typedef struct CK_X9_42_DH1_DERIVE_PARAMS { - CK_X9_42_DH_KDF_TYPE kdf; - CK_ULONG ulOtherInfoLen; - CK_BYTE_PTR pOtherInfo; - CK_ULONG ulPublicDataLen; - CK_BYTE_PTR pPublicData; -} CK_X9_42_DH1_DERIVE_PARAMS; - -typedef struct CK_X9_42_DH1_DERIVE_PARAMS CK_PTR CK_X9_42_DH1_DERIVE_PARAMS_PTR; - -/* CK_X9_42_DH2_DERIVE_PARAMS is new for v2.11. - * CK_X9_42_DH2_DERIVE_PARAMS provides the parameters to the - * CKM_X9_42_DH_HYBRID_DERIVE and CKM_X9_42_MQV_DERIVE key derivation - * mechanisms, where each party contributes two key pairs */ -typedef struct CK_X9_42_DH2_DERIVE_PARAMS { - CK_X9_42_DH_KDF_TYPE kdf; - CK_ULONG ulOtherInfoLen; - CK_BYTE_PTR pOtherInfo; - CK_ULONG ulPublicDataLen; - CK_BYTE_PTR pPublicData; - CK_ULONG ulPrivateDataLen; - CK_OBJECT_HANDLE hPrivateData; - CK_ULONG ulPublicDataLen2; - CK_BYTE_PTR pPublicData2; -} CK_X9_42_DH2_DERIVE_PARAMS; - -typedef CK_X9_42_DH2_DERIVE_PARAMS CK_PTR CK_X9_42_DH2_DERIVE_PARAMS_PTR; - -/* CK_KEA_DERIVE_PARAMS provides the parameters to the - * CKM_KEA_DERIVE mechanism */ -/* CK_KEA_DERIVE_PARAMS is new for v2.0 */ -typedef struct CK_KEA_DERIVE_PARAMS { - CK_BBOOL isSender; - CK_ULONG ulRandomLen; - CK_BYTE_PTR pRandomA; - CK_BYTE_PTR pRandomB; - CK_ULONG ulPublicDataLen; - CK_BYTE_PTR pPublicData; -} CK_KEA_DERIVE_PARAMS; - -typedef CK_KEA_DERIVE_PARAMS CK_PTR CK_KEA_DERIVE_PARAMS_PTR; - - -/* CK_RC2_PARAMS provides the parameters to the CKM_RC2_ECB and - * CKM_RC2_MAC mechanisms. An instance of CK_RC2_PARAMS just - * holds the effective keysize */ -typedef CK_ULONG CK_RC2_PARAMS; - -typedef CK_RC2_PARAMS CK_PTR CK_RC2_PARAMS_PTR; - - -/* CK_RC2_CBC_PARAMS provides the parameters to the CKM_RC2_CBC - * mechanism */ -typedef struct CK_RC2_CBC_PARAMS { - /* ulEffectiveBits was changed from CK_USHORT to CK_ULONG for - * v2.0 */ - CK_ULONG ulEffectiveBits; /* effective bits (1-1024) */ - - CK_BYTE iv[8]; /* IV for CBC mode */ -} CK_RC2_CBC_PARAMS; - -typedef CK_RC2_CBC_PARAMS CK_PTR CK_RC2_CBC_PARAMS_PTR; - - -/* CK_RC2_MAC_GENERAL_PARAMS provides the parameters for the - * CKM_RC2_MAC_GENERAL mechanism */ -/* CK_RC2_MAC_GENERAL_PARAMS is new for v2.0 */ -typedef struct CK_RC2_MAC_GENERAL_PARAMS { - CK_ULONG ulEffectiveBits; /* effective bits (1-1024) */ - CK_ULONG ulMacLength; /* Length of MAC in bytes */ -} CK_RC2_MAC_GENERAL_PARAMS; - -typedef CK_RC2_MAC_GENERAL_PARAMS CK_PTR \ - CK_RC2_MAC_GENERAL_PARAMS_PTR; - - -/* CK_RC5_PARAMS provides the parameters to the CKM_RC5_ECB and - * CKM_RC5_MAC mechanisms */ -/* CK_RC5_PARAMS is new for v2.0 */ -typedef struct CK_RC5_PARAMS { - CK_ULONG ulWordsize; /* wordsize in bits */ - CK_ULONG ulRounds; /* number of rounds */ -} CK_RC5_PARAMS; - -typedef CK_RC5_PARAMS CK_PTR CK_RC5_PARAMS_PTR; - - -/* CK_RC5_CBC_PARAMS provides the parameters to the CKM_RC5_CBC - * mechanism */ -/* CK_RC5_CBC_PARAMS is new for v2.0 */ -typedef struct CK_RC5_CBC_PARAMS { - CK_ULONG ulWordsize; /* wordsize in bits */ - CK_ULONG ulRounds; /* number of rounds */ - CK_BYTE_PTR pIv; /* pointer to IV */ - CK_ULONG ulIvLen; /* length of IV in bytes */ -} CK_RC5_CBC_PARAMS; - -typedef CK_RC5_CBC_PARAMS CK_PTR CK_RC5_CBC_PARAMS_PTR; - - -/* CK_RC5_MAC_GENERAL_PARAMS provides the parameters for the - * CKM_RC5_MAC_GENERAL mechanism */ -/* CK_RC5_MAC_GENERAL_PARAMS is new for v2.0 */ -typedef struct CK_RC5_MAC_GENERAL_PARAMS { - CK_ULONG ulWordsize; /* wordsize in bits */ - CK_ULONG ulRounds; /* number of rounds */ - CK_ULONG ulMacLength; /* Length of MAC in bytes */ -} CK_RC5_MAC_GENERAL_PARAMS; - -typedef CK_RC5_MAC_GENERAL_PARAMS CK_PTR \ - CK_RC5_MAC_GENERAL_PARAMS_PTR; - - -/* CK_MAC_GENERAL_PARAMS provides the parameters to most block - * ciphers' MAC_GENERAL mechanisms. Its value is the length of - * the MAC */ -/* CK_MAC_GENERAL_PARAMS is new for v2.0 */ -typedef CK_ULONG CK_MAC_GENERAL_PARAMS; - -typedef CK_MAC_GENERAL_PARAMS CK_PTR CK_MAC_GENERAL_PARAMS_PTR; - - -/* CK_SKIPJACK_PRIVATE_WRAP_PARAMS provides the parameters to the - * CKM_SKIPJACK_PRIVATE_WRAP mechanism */ -/* CK_SKIPJACK_PRIVATE_WRAP_PARAMS is new for v2.0 */ -typedef struct CK_SKIPJACK_PRIVATE_WRAP_PARAMS { - CK_ULONG ulPasswordLen; - CK_BYTE_PTR pPassword; - CK_ULONG ulPublicDataLen; - CK_BYTE_PTR pPublicData; - CK_ULONG ulPAndGLen; - CK_ULONG ulQLen; - CK_ULONG ulRandomLen; - CK_BYTE_PTR pRandomA; - CK_BYTE_PTR pPrimeP; - CK_BYTE_PTR pBaseG; - CK_BYTE_PTR pSubprimeQ; -} CK_SKIPJACK_PRIVATE_WRAP_PARAMS; - -typedef CK_SKIPJACK_PRIVATE_WRAP_PARAMS CK_PTR \ - CK_SKIPJACK_PRIVATE_WRAP_PTR; - - -/* CK_SKIPJACK_RELAYX_PARAMS provides the parameters to the - * CKM_SKIPJACK_RELAYX mechanism */ -/* CK_SKIPJACK_RELAYX_PARAMS is new for v2.0 */ -typedef struct CK_SKIPJACK_RELAYX_PARAMS { - CK_ULONG ulOldWrappedXLen; - CK_BYTE_PTR pOldWrappedX; - CK_ULONG ulOldPasswordLen; - CK_BYTE_PTR pOldPassword; - CK_ULONG ulOldPublicDataLen; - CK_BYTE_PTR pOldPublicData; - CK_ULONG ulOldRandomLen; - CK_BYTE_PTR pOldRandomA; - CK_ULONG ulNewPasswordLen; - CK_BYTE_PTR pNewPassword; - CK_ULONG ulNewPublicDataLen; - CK_BYTE_PTR pNewPublicData; - CK_ULONG ulNewRandomLen; - CK_BYTE_PTR pNewRandomA; -} CK_SKIPJACK_RELAYX_PARAMS; - -typedef CK_SKIPJACK_RELAYX_PARAMS CK_PTR \ - CK_SKIPJACK_RELAYX_PARAMS_PTR; - - -typedef struct CK_PBE_PARAMS { - CK_BYTE_PTR pInitVector; - CK_UTF8CHAR_PTR pPassword; - CK_ULONG ulPasswordLen; - CK_BYTE_PTR pSalt; - CK_ULONG ulSaltLen; - CK_ULONG ulIteration; -} CK_PBE_PARAMS; - -typedef CK_PBE_PARAMS CK_PTR CK_PBE_PARAMS_PTR; - - -/* CK_KEY_WRAP_SET_OAEP_PARAMS provides the parameters to the - * CKM_KEY_WRAP_SET_OAEP mechanism */ -/* CK_KEY_WRAP_SET_OAEP_PARAMS is new for v2.0 */ -typedef struct CK_KEY_WRAP_SET_OAEP_PARAMS { - CK_BYTE bBC; /* block contents byte */ - CK_BYTE_PTR pX; /* extra data */ - CK_ULONG ulXLen; /* length of extra data in bytes */ -} CK_KEY_WRAP_SET_OAEP_PARAMS; - -typedef CK_KEY_WRAP_SET_OAEP_PARAMS CK_PTR \ - CK_KEY_WRAP_SET_OAEP_PARAMS_PTR; - - -typedef struct CK_SSL3_RANDOM_DATA { - CK_BYTE_PTR pClientRandom; - CK_ULONG ulClientRandomLen; - CK_BYTE_PTR pServerRandom; - CK_ULONG ulServerRandomLen; -} CK_SSL3_RANDOM_DATA; - - -typedef struct CK_SSL3_MASTER_KEY_DERIVE_PARAMS { - CK_SSL3_RANDOM_DATA RandomInfo; - CK_VERSION_PTR pVersion; -} CK_SSL3_MASTER_KEY_DERIVE_PARAMS; - -typedef struct CK_SSL3_MASTER_KEY_DERIVE_PARAMS CK_PTR \ - CK_SSL3_MASTER_KEY_DERIVE_PARAMS_PTR; - - -typedef struct CK_SSL3_KEY_MAT_OUT { - CK_OBJECT_HANDLE hClientMacSecret; - CK_OBJECT_HANDLE hServerMacSecret; - CK_OBJECT_HANDLE hClientKey; - CK_OBJECT_HANDLE hServerKey; - CK_BYTE_PTR pIVClient; - CK_BYTE_PTR pIVServer; -} CK_SSL3_KEY_MAT_OUT; - -typedef CK_SSL3_KEY_MAT_OUT CK_PTR CK_SSL3_KEY_MAT_OUT_PTR; - - -typedef struct CK_SSL3_KEY_MAT_PARAMS { - CK_ULONG ulMacSizeInBits; - CK_ULONG ulKeySizeInBits; - CK_ULONG ulIVSizeInBits; - CK_BBOOL bIsExport; - CK_SSL3_RANDOM_DATA RandomInfo; - CK_SSL3_KEY_MAT_OUT_PTR pReturnedKeyMaterial; -} CK_SSL3_KEY_MAT_PARAMS; - -typedef CK_SSL3_KEY_MAT_PARAMS CK_PTR CK_SSL3_KEY_MAT_PARAMS_PTR; - - -typedef struct CK_KEY_DERIVATION_STRING_DATA { - CK_BYTE_PTR pData; - CK_ULONG ulLen; -} CK_KEY_DERIVATION_STRING_DATA; - -typedef CK_KEY_DERIVATION_STRING_DATA CK_PTR \ - CK_KEY_DERIVATION_STRING_DATA_PTR; - - -/* The CK_EXTRACT_PARAMS is used for the - * CKM_EXTRACT_KEY_FROM_KEY mechanism. It specifies which bit - * of the base key should be used as the first bit of the - * derived key */ -/* CK_EXTRACT_PARAMS is new for v2.0 */ -typedef CK_ULONG CK_EXTRACT_PARAMS; - -typedef CK_EXTRACT_PARAMS CK_PTR CK_EXTRACT_PARAMS_PTR; - -/* CK_PKCS5_PBKD2_PSEUDO_RANDOM_FUNCTION_TYPE is new for v2.10. - * CK_PKCS5_PBKD2_PSEUDO_RANDOM_FUNCTION_TYPE is used to - * indicate the Pseudo-Random Function (PRF) used to generate - * key bits using PKCS #5 PBKDF2. */ -typedef CK_ULONG CK_PKCS5_PBKD2_PSEUDO_RANDOM_FUNCTION_TYPE; - -typedef CK_PKCS5_PBKD2_PSEUDO_RANDOM_FUNCTION_TYPE CK_PTR CK_PKCS5_PBKD2_PSEUDO_RANDOM_FUNCTION_TYPE_PTR; - -/* The following PRFs are defined in PKCS #5 v2.0. */ -#define CKP_PKCS5_PBKD2_HMAC_SHA1 0x00000001 - - -/* CK_PKCS5_PBKDF2_SALT_SOURCE_TYPE is new for v2.10. - * CK_PKCS5_PBKDF2_SALT_SOURCE_TYPE is used to indicate the - * source of the salt value when deriving a key using PKCS #5 - * PBKDF2. */ -typedef CK_ULONG CK_PKCS5_PBKDF2_SALT_SOURCE_TYPE; - -typedef CK_PKCS5_PBKDF2_SALT_SOURCE_TYPE CK_PTR CK_PKCS5_PBKDF2_SALT_SOURCE_TYPE_PTR; - -/* The following salt value sources are defined in PKCS #5 v2.0. */ -#define CKZ_SALT_SPECIFIED 0x00000001 - -/* CK_PKCS5_PBKD2_PARAMS is new for v2.10. - * CK_PKCS5_PBKD2_PARAMS is a structure that provides the - * parameters to the CKM_PKCS5_PBKD2 mechanism. */ -typedef struct CK_PKCS5_PBKD2_PARAMS { - CK_PKCS5_PBKDF2_SALT_SOURCE_TYPE saltSource; - CK_VOID_PTR pSaltSourceData; - CK_ULONG ulSaltSourceDataLen; - CK_ULONG iterations; - CK_PKCS5_PBKD2_PSEUDO_RANDOM_FUNCTION_TYPE prf; - CK_VOID_PTR pPrfData; - CK_ULONG ulPrfDataLen; - CK_UTF8CHAR_PTR pPassword; - CK_ULONG_PTR ulPasswordLen; -} CK_PKCS5_PBKD2_PARAMS; - -typedef CK_PKCS5_PBKD2_PARAMS CK_PTR CK_PKCS5_PBKD2_PARAMS_PTR; - -#endif +/* pkcs11t.h include file for PKCS #11. */ +/* $Revision: 1.4 $ */ + +/* License to copy and use this software is granted provided that it is + * identified as "RSA Security Inc. PKCS #11 Cryptographic Token Interface + * (Cryptoki)" in all material mentioning or referencing this software. + + * License is also granted to make and use derivative works provided that + * such works are identified as "derived from the RSA Security Inc. PKCS #11 + * Cryptographic Token Interface (Cryptoki)" in all material mentioning or + * referencing the derived work. + + * RSA Security Inc. makes no representations concerning either the + * merchantability of this software or the suitability of this software for + * any particular purpose. It is provided "as is" without express or implied + * warranty of any kind. + */ + +/* See top of pkcs11.h for information about the macros that + * must be defined and the structure-packing conventions that + * must be set before including this file. */ + +#ifndef _PKCS11T_H_ +#define _PKCS11T_H_ 1 + +#ifndef CK_DISABLE_TRUE_FALSE +#ifndef FALSE +#define FALSE 0 +#endif + +#ifndef TRUE +#define TRUE !(FALSE) +#endif +#endif + +#define CK_TRUE 1 +#define CK_FALSE 0 + +/* an unsigned 8-bit value */ +typedef unsigned char CK_BYTE; + +/* an unsigned 8-bit character */ +typedef CK_BYTE CK_CHAR; + +/* an 8-bit UTF-8 character */ +typedef CK_BYTE CK_UTF8CHAR; + +/* a BYTE-sized Boolean flag */ +typedef CK_BYTE CK_BBOOL; + +/* an unsigned value, at least 32 bits long */ +typedef unsigned long int CK_ULONG; + +/* a signed value, the same size as a CK_ULONG */ +/* CK_LONG is new for v2.0 */ +typedef long int CK_LONG; + +/* at least 32 bits; each bit is a Boolean flag */ +typedef CK_ULONG CK_FLAGS; + + +/* some special values for certain CK_ULONG variables */ +#define CK_UNAVAILABLE_INFORMATION (~0UL) +#define CK_EFFECTIVELY_INFINITE 0 + + +typedef CK_BYTE CK_PTR CK_BYTE_PTR; +typedef CK_CHAR CK_PTR CK_CHAR_PTR; +typedef CK_UTF8CHAR CK_PTR CK_UTF8CHAR_PTR; +typedef CK_ULONG CK_PTR CK_ULONG_PTR; +typedef void CK_PTR CK_VOID_PTR; + +/* Pointer to a CK_VOID_PTR-- i.e., pointer to pointer to void */ +typedef CK_VOID_PTR CK_PTR CK_VOID_PTR_PTR; + + +/* The following value is always invalid if used as a session */ +/* handle or object handle */ +#define CK_INVALID_HANDLE 0 + + +typedef struct CK_VERSION { + CK_BYTE major; /* integer portion of version number */ + CK_BYTE minor; /* 1/100ths portion of version number */ +} CK_VERSION; + +typedef CK_VERSION CK_PTR CK_VERSION_PTR; + + +typedef struct CK_INFO { + /* manufacturerID and libraryDescription have been changed from + * CK_CHAR to CK_UTF8CHAR for v2.10 */ + CK_VERSION cryptokiVersion; /* Cryptoki interface ver */ + CK_UTF8CHAR manufacturerID[32]; /* blank padded */ + CK_FLAGS flags; /* must be zero */ + + /* libraryDescription and libraryVersion are new for v2.0 */ + CK_UTF8CHAR libraryDescription[32]; /* blank padded */ + CK_VERSION libraryVersion; /* version of library */ +} CK_INFO; + +typedef CK_INFO CK_PTR CK_INFO_PTR; + + +/* CK_NOTIFICATION enumerates the types of notifications that + * Cryptoki provides to an application */ +/* CK_NOTIFICATION has been changed from an enum to a CK_ULONG + * for v2.0 */ +typedef CK_ULONG CK_NOTIFICATION; +#define CKN_SURRENDER 0 + + +typedef CK_ULONG CK_SLOT_ID; + +typedef CK_SLOT_ID CK_PTR CK_SLOT_ID_PTR; + + +/* CK_SLOT_INFO provides information about a slot */ +typedef struct CK_SLOT_INFO { + /* slotDescription and manufacturerID have been changed from + * CK_CHAR to CK_UTF8CHAR for v2.10 */ + CK_UTF8CHAR slotDescription[64]; /* blank padded */ + CK_UTF8CHAR manufacturerID[32]; /* blank padded */ + CK_FLAGS flags; + + /* hardwareVersion and firmwareVersion are new for v2.0 */ + CK_VERSION hardwareVersion; /* version of hardware */ + CK_VERSION firmwareVersion; /* version of firmware */ +} CK_SLOT_INFO; + +/* flags: bit flags that provide capabilities of the slot + * Bit Flag Mask Meaning + */ +#define CKF_TOKEN_PRESENT 0x00000001 /* a token is there */ +#define CKF_REMOVABLE_DEVICE 0x00000002 /* removable devices*/ +#define CKF_HW_SLOT 0x00000004 /* hardware slot */ + +typedef CK_SLOT_INFO CK_PTR CK_SLOT_INFO_PTR; + + +/* CK_TOKEN_INFO provides information about a token */ +typedef struct CK_TOKEN_INFO { + /* label, manufacturerID, and model have been changed from + * CK_CHAR to CK_UTF8CHAR for v2.10 */ + CK_UTF8CHAR label[32]; /* blank padded */ + CK_UTF8CHAR manufacturerID[32]; /* blank padded */ + CK_UTF8CHAR model[16]; /* blank padded */ + CK_CHAR serialNumber[16]; /* blank padded */ + CK_FLAGS flags; /* see below */ + + /* ulMaxSessionCount, ulSessionCount, ulMaxRwSessionCount, + * ulRwSessionCount, ulMaxPinLen, and ulMinPinLen have all been + * changed from CK_USHORT to CK_ULONG for v2.0 */ + CK_ULONG ulMaxSessionCount; /* max open sessions */ + CK_ULONG ulSessionCount; /* sess. now open */ + CK_ULONG ulMaxRwSessionCount; /* max R/W sessions */ + CK_ULONG ulRwSessionCount; /* R/W sess. now open */ + CK_ULONG ulMaxPinLen; /* in bytes */ + CK_ULONG ulMinPinLen; /* in bytes */ + CK_ULONG ulTotalPublicMemory; /* in bytes */ + CK_ULONG ulFreePublicMemory; /* in bytes */ + CK_ULONG ulTotalPrivateMemory; /* in bytes */ + CK_ULONG ulFreePrivateMemory; /* in bytes */ + + /* hardwareVersion, firmwareVersion, and time are new for + * v2.0 */ + CK_VERSION hardwareVersion; /* version of hardware */ + CK_VERSION firmwareVersion; /* version of firmware */ + CK_CHAR utcTime[16]; /* time */ +} CK_TOKEN_INFO; + +/* The flags parameter is defined as follows: + * Bit Flag Mask Meaning + */ +#define CKF_RNG 0x00000001 /* has random # + * generator */ +#define CKF_WRITE_PROTECTED 0x00000002 /* token is + * write- + * protected */ +#define CKF_LOGIN_REQUIRED 0x00000004 /* user must + * login */ +#define CKF_USER_PIN_INITIALIZED 0x00000008 /* normal user's + * PIN is set */ + +/* CKF_RESTORE_KEY_NOT_NEEDED is new for v2.0. If it is set, + * that means that *every* time the state of cryptographic + * operations of a session is successfully saved, all keys + * needed to continue those operations are stored in the state */ +#define CKF_RESTORE_KEY_NOT_NEEDED 0x00000020 + +/* CKF_CLOCK_ON_TOKEN is new for v2.0. If it is set, that means + * that the token has some sort of clock. The time on that + * clock is returned in the token info structure */ +#define CKF_CLOCK_ON_TOKEN 0x00000040 + +/* CKF_PROTECTED_AUTHENTICATION_PATH is new for v2.0. If it is + * set, that means that there is some way for the user to login + * without sending a PIN through the Cryptoki library itself */ +#define CKF_PROTECTED_AUTHENTICATION_PATH 0x00000100 + +/* CKF_DUAL_CRYPTO_OPERATIONS is new for v2.0. If it is true, + * that means that a single session with the token can perform + * dual simultaneous cryptographic operations (digest and + * encrypt; decrypt and digest; sign and encrypt; and decrypt + * and sign) */ +#define CKF_DUAL_CRYPTO_OPERATIONS 0x00000200 + +/* CKF_TOKEN_INITIALIZED if new for v2.10. If it is true, the + * token has been initialized using C_InitializeToken or an + * equivalent mechanism outside the scope of PKCS #11. + * Calling C_InitializeToken when this flag is set will cause + * the token to be reinitialized. */ +#define CKF_TOKEN_INITIALIZED 0x00000400 + +/* CKF_SECONDARY_AUTHENTICATION if new for v2.10. If it is + * true, the token supports secondary authentication for + * private key objects. */ +#define CKF_SECONDARY_AUTHENTICATION 0x00000800 + +/* CKF_USER_PIN_COUNT_LOW if new for v2.10. If it is true, an + * incorrect user login PIN has been entered at least once + * since the last successful authentication. */ +#define CKF_USER_PIN_COUNT_LOW 0x00010000 + +/* CKF_USER_PIN_FINAL_TRY if new for v2.10. If it is true, + * supplying an incorrect user PIN will it to become locked. */ +#define CKF_USER_PIN_FINAL_TRY 0x00020000 + +/* CKF_USER_PIN_LOCKED if new for v2.10. If it is true, the + * user PIN has been locked. User login to the token is not + * possible. */ +#define CKF_USER_PIN_LOCKED 0x00040000 + +/* CKF_USER_PIN_TO_BE_CHANGED if new for v2.10. If it is true, + * the user PIN value is the default value set by token + * initialization or manufacturing, or the PIN has been + * expired by the card. */ +#define CKF_USER_PIN_TO_BE_CHANGED 0x00080000 + +/* CKF_SO_PIN_COUNT_LOW if new for v2.10. If it is true, an + * incorrect SO login PIN has been entered at least once since + * the last successful authentication. */ +#define CKF_SO_PIN_COUNT_LOW 0x00100000 + +/* CKF_SO_PIN_FINAL_TRY if new for v2.10. If it is true, + * supplying an incorrect SO PIN will it to become locked. */ +#define CKF_SO_PIN_FINAL_TRY 0x00200000 + +/* CKF_SO_PIN_LOCKED if new for v2.10. If it is true, the SO + * PIN has been locked. SO login to the token is not possible. + */ +#define CKF_SO_PIN_LOCKED 0x00400000 + +/* CKF_SO_PIN_TO_BE_CHANGED if new for v2.10. If it is true, + * the SO PIN value is the default value set by token + * initialization or manufacturing, or the PIN has been + * expired by the card. */ +#define CKF_SO_PIN_TO_BE_CHANGED 0x00800000 + +typedef CK_TOKEN_INFO CK_PTR CK_TOKEN_INFO_PTR; + + +/* CK_SESSION_HANDLE is a Cryptoki-assigned value that + * identifies a session */ +typedef CK_ULONG CK_SESSION_HANDLE; + +typedef CK_SESSION_HANDLE CK_PTR CK_SESSION_HANDLE_PTR; + + +/* CK_USER_TYPE enumerates the types of Cryptoki users */ +/* CK_USER_TYPE has been changed from an enum to a CK_ULONG for + * v2.0 */ +typedef CK_ULONG CK_USER_TYPE; +/* Security Officer */ +#define CKU_SO 0 +/* Normal user */ +#define CKU_USER 1 + + +/* CK_STATE enumerates the session states */ +/* CK_STATE has been changed from an enum to a CK_ULONG for + * v2.0 */ +typedef CK_ULONG CK_STATE; +#define CKS_RO_PUBLIC_SESSION 0 +#define CKS_RO_USER_FUNCTIONS 1 +#define CKS_RW_PUBLIC_SESSION 2 +#define CKS_RW_USER_FUNCTIONS 3 +#define CKS_RW_SO_FUNCTIONS 4 + + +/* CK_SESSION_INFO provides information about a session */ +typedef struct CK_SESSION_INFO { + CK_SLOT_ID slotID; + CK_STATE state; + CK_FLAGS flags; /* see below */ + + /* ulDeviceError was changed from CK_USHORT to CK_ULONG for + * v2.0 */ + CK_ULONG ulDeviceError; /* device-dependent error code */ +} CK_SESSION_INFO; + +/* The flags are defined in the following table: + * Bit Flag Mask Meaning + */ +#define CKF_RW_SESSION 0x00000002 /* session is r/w */ +#define CKF_SERIAL_SESSION 0x00000004 /* no parallel */ + +typedef CK_SESSION_INFO CK_PTR CK_SESSION_INFO_PTR; + + +/* CK_OBJECT_HANDLE is a token-specific identifier for an + * object */ +typedef CK_ULONG CK_OBJECT_HANDLE; + +typedef CK_OBJECT_HANDLE CK_PTR CK_OBJECT_HANDLE_PTR; + + +/* CK_OBJECT_CLASS is a value that identifies the classes (or + * types) of objects that Cryptoki recognizes. It is defined + * as follows: */ +/* CK_OBJECT_CLASS was changed from CK_USHORT to CK_ULONG for + * v2.0 */ +typedef CK_ULONG CK_OBJECT_CLASS; + +/* The following classes of objects are defined: */ +/* CKO_HW_FEATURE is new for v2.10 */ +/* CKO_DOMAIN_PARAMETERS is new for v2.11 */ +#define CKO_DATA 0x00000000 +#define CKO_CERTIFICATE 0x00000001 +#define CKO_PUBLIC_KEY 0x00000002 +#define CKO_PRIVATE_KEY 0x00000003 +#define CKO_SECRET_KEY 0x00000004 +#define CKO_HW_FEATURE 0x00000005 +#define CKO_DOMAIN_PARAMETERS 0x00000006 +#define CKO_VENDOR_DEFINED 0x80000000 + +typedef CK_OBJECT_CLASS CK_PTR CK_OBJECT_CLASS_PTR; + +/* CK_HW_FEATURE_TYPE is new for v2.10. CK_HW_FEATURE_TYPE is a + * value that identifies the hardware feature type of an object + * with CK_OBJECT_CLASS equal to CKO_HW_FEATURE. */ +typedef CK_ULONG CK_HW_FEATURE_TYPE; + +/* The following hardware feature types are defined */ +#define CKH_MONOTONIC_COUNTER 0x00000001 +#define CKH_CLOCK 0x00000002 +#define CKH_VENDOR_DEFINED 0x80000000 + +/* CK_KEY_TYPE is a value that identifies a key type */ +/* CK_KEY_TYPE was changed from CK_USHORT to CK_ULONG for v2.0 */ +typedef CK_ULONG CK_KEY_TYPE; + +/* the following key types are defined: */ +#define CKK_RSA 0x00000000 +#define CKK_DSA 0x00000001 +#define CKK_DH 0x00000002 + +/* CKK_ECDSA and CKK_KEA are new for v2.0 */ +/* CKK_ECDSA is deprecated in v2.11, CKK_EC is preferred. */ +#define CKK_ECDSA 0x00000003 +#define CKK_EC 0x00000003 +#define CKK_X9_42_DH 0x00000004 +#define CKK_KEA 0x00000005 + +#define CKK_GENERIC_SECRET 0x00000010 +#define CKK_RC2 0x00000011 +#define CKK_RC4 0x00000012 +#define CKK_DES 0x00000013 +#define CKK_DES2 0x00000014 +#define CKK_DES3 0x00000015 + +/* all these key types are new for v2.0 */ +#define CKK_CAST 0x00000016 +#define CKK_CAST3 0x00000017 +/* CKK_CAST5 is deprecated in v2.11, CKK_CAST128 is preferred. */ +#define CKK_CAST5 0x00000018 +#define CKK_CAST128 0x00000018 +#define CKK_RC5 0x00000019 +#define CKK_IDEA 0x0000001A +#define CKK_SKIPJACK 0x0000001B +#define CKK_BATON 0x0000001C +#define CKK_JUNIPER 0x0000001D +#define CKK_CDMF 0x0000001E +#define CKK_AES 0x0000001F + +#define CKK_VENDOR_DEFINED 0x80000000 + + +/* CK_CERTIFICATE_TYPE is a value that identifies a certificate + * type */ +/* CK_CERTIFICATE_TYPE was changed from CK_USHORT to CK_ULONG + * for v2.0 */ +typedef CK_ULONG CK_CERTIFICATE_TYPE; + +/* The following certificate types are defined: */ +/* CKC_X_509_ATTR_CERT is new for v2.10 */ +#define CKC_X_509 0x00000000 +#define CKC_X_509_ATTR_CERT 0x00000001 +#define CKC_VENDOR_DEFINED 0x80000000 + + +/* CK_ATTRIBUTE_TYPE is a value that identifies an attribute + * type */ +/* CK_ATTRIBUTE_TYPE was changed from CK_USHORT to CK_ULONG for + * v2.0 */ +typedef CK_ULONG CK_ATTRIBUTE_TYPE; + +/* The following attribute types are defined: */ +#define CKA_CLASS 0x00000000 +#define CKA_TOKEN 0x00000001 +#define CKA_PRIVATE 0x00000002 +#define CKA_LABEL 0x00000003 +#define CKA_APPLICATION 0x00000010 +#define CKA_VALUE 0x00000011 + +/* CKA_OBJECT_ID is new for v2.10 */ +#define CKA_OBJECT_ID 0x00000012 + +#define CKA_CERTIFICATE_TYPE 0x00000080 +#define CKA_ISSUER 0x00000081 +#define CKA_SERIAL_NUMBER 0x00000082 + +/* CKA_AC_ISSUER, CKA_OWNER, and CKA_ATTR_TYPES are new + * for v2.10 */ +#define CKA_AC_ISSUER 0x00000083 +#define CKA_OWNER 0x00000084 +#define CKA_ATTR_TYPES 0x00000085 + +/* CKA_TRUSTED is new for v2.11 */ +#define CKA_TRUSTED 0x00000086 + +#define CKA_KEY_TYPE 0x00000100 +#define CKA_SUBJECT 0x00000101 +#define CKA_ID 0x00000102 +#define CKA_SENSITIVE 0x00000103 +#define CKA_ENCRYPT 0x00000104 +#define CKA_DECRYPT 0x00000105 +#define CKA_WRAP 0x00000106 +#define CKA_UNWRAP 0x00000107 +#define CKA_SIGN 0x00000108 +#define CKA_SIGN_RECOVER 0x00000109 +#define CKA_VERIFY 0x0000010A +#define CKA_VERIFY_RECOVER 0x0000010B +#define CKA_DERIVE 0x0000010C +#define CKA_START_DATE 0x00000110 +#define CKA_END_DATE 0x00000111 +#define CKA_MODULUS 0x00000120 +#define CKA_MODULUS_BITS 0x00000121 +#define CKA_PUBLIC_EXPONENT 0x00000122 +#define CKA_PRIVATE_EXPONENT 0x00000123 +#define CKA_PRIME_1 0x00000124 +#define CKA_PRIME_2 0x00000125 +#define CKA_EXPONENT_1 0x00000126 +#define CKA_EXPONENT_2 0x00000127 +#define CKA_COEFFICIENT 0x00000128 +#define CKA_PRIME 0x00000130 +#define CKA_SUBPRIME 0x00000131 +#define CKA_BASE 0x00000132 + +/* CKA_PRIME_BITS and CKA_SUB_PRIME_BITS are new for v2.11 */ +#define CKA_PRIME_BITS 0x00000133 +#define CKA_SUBPRIME_BITS 0x00000134 +#define CKA_SUB_PRIME_BITS CKA_SUBPRIME_BITS +/* (To retain backwards-compatibility) */ + +#define CKA_VALUE_BITS 0x00000160 +#define CKA_VALUE_LEN 0x00000161 + +/* CKA_EXTRACTABLE, CKA_LOCAL, CKA_NEVER_EXTRACTABLE, + * CKA_ALWAYS_SENSITIVE, CKA_MODIFIABLE, CKA_ECDSA_PARAMS, + * and CKA_EC_POINT are new for v2.0 */ +#define CKA_EXTRACTABLE 0x00000162 +#define CKA_LOCAL 0x00000163 +#define CKA_NEVER_EXTRACTABLE 0x00000164 +#define CKA_ALWAYS_SENSITIVE 0x00000165 + +/* CKA_KEY_GEN_MECHANISM is new for v2.11 */ +#define CKA_KEY_GEN_MECHANISM 0x00000166 + +#define CKA_MODIFIABLE 0x00000170 + +/* CKA_ECDSA_PARAMS is deprecated in v2.11, + * CKA_EC_PARAMS is preferred. */ +#define CKA_ECDSA_PARAMS 0x00000180 +#define CKA_EC_PARAMS 0x00000180 + +#define CKA_EC_POINT 0x00000181 + +/* CKA_SECONDARY_AUTH, CKA_AUTH_PIN_FLAGS, + * CKA_HW_FEATURE_TYPE, CKA_RESET_ON_INIT, and CKA_HAS_RESET + * are new for v2.10 */ +#define CKA_SECONDARY_AUTH 0x00000200 +#define CKA_AUTH_PIN_FLAGS 0x00000201 +#define CKA_HW_FEATURE_TYPE 0x00000300 +#define CKA_RESET_ON_INIT 0x00000301 +#define CKA_HAS_RESET 0x00000302 + +#define CKA_VENDOR_DEFINED 0x80000000 + + +/* CK_ATTRIBUTE is a structure that includes the type, length + * and value of an attribute */ +typedef struct CK_ATTRIBUTE { + CK_ATTRIBUTE_TYPE type; + CK_VOID_PTR pValue; + + /* ulValueLen went from CK_USHORT to CK_ULONG for v2.0 */ + CK_ULONG ulValueLen; /* in bytes */ +} CK_ATTRIBUTE; + +typedef CK_ATTRIBUTE CK_PTR CK_ATTRIBUTE_PTR; + + +/* CK_DATE is a structure that defines a date */ +typedef struct CK_DATE{ + CK_CHAR year[4]; /* the year ("1900" - "9999") */ + CK_CHAR month[2]; /* the month ("01" - "12") */ + CK_CHAR day[2]; /* the day ("01" - "31") */ +} CK_DATE; + + +/* CK_MECHANISM_TYPE is a value that identifies a mechanism + * type */ +/* CK_MECHANISM_TYPE was changed from CK_USHORT to CK_ULONG for + * v2.0 */ +typedef CK_ULONG CK_MECHANISM_TYPE; + +/* the following mechanism types are defined: */ +#define CKM_RSA_PKCS_KEY_PAIR_GEN 0x00000000 +#define CKM_RSA_PKCS 0x00000001 +#define CKM_RSA_9796 0x00000002 +#define CKM_RSA_X_509 0x00000003 + +/* CKM_MD2_RSA_PKCS, CKM_MD5_RSA_PKCS, and CKM_SHA1_RSA_PKCS + * are new for v2.0. They are mechanisms which hash and sign */ +#define CKM_MD2_RSA_PKCS 0x00000004 +#define CKM_MD5_RSA_PKCS 0x00000005 +#define CKM_SHA1_RSA_PKCS 0x00000006 + +/* CKM_RIPEMD128_RSA_PKCS, CKM_RIPEMD160_RSA_PKCS, and + * CKM_RSA_PKCS_OAEP are new for v2.10 */ +#define CKM_RIPEMD128_RSA_PKCS 0x00000007 +#define CKM_RIPEMD160_RSA_PKCS 0x00000008 +#define CKM_RSA_PKCS_OAEP 0x00000009 + +/* CKM_RSA_X9_31_KEY_PAIR_GEN, CKM_RSA_X9_31, CKM_SHA1_RSA_X9_31, + * CKM_RSA_PKCS_PSS, and CKM_SHA1_RSA_PKCS_PSS are new for v2.11 */ +#define CKM_RSA_X9_31_KEY_PAIR_GEN 0x0000000A +#define CKM_RSA_X9_31 0x0000000B +#define CKM_SHA1_RSA_X9_31 0x0000000C +#define CKM_RSA_PKCS_PSS 0x0000000D +#define CKM_SHA1_RSA_PKCS_PSS 0x0000000E + +#define CKM_DSA_KEY_PAIR_GEN 0x00000010 +#define CKM_DSA 0x00000011 +#define CKM_DSA_SHA1 0x00000012 +#define CKM_DH_PKCS_KEY_PAIR_GEN 0x00000020 +#define CKM_DH_PKCS_DERIVE 0x00000021 + +/* CKM_X9_42_DH_KEY_PAIR_GEN, CKM_X9_42_DH_DERIVE, + * CKM_X9_42_DH_HYBRID_DERIVE, and CKM_X9_42_MQV_DERIVE are new for + * v2.11 */ +#define CKM_X9_42_DH_KEY_PAIR_GEN 0x00000030 +#define CKM_X9_42_DH_DERIVE 0x00000031 +#define CKM_X9_42_DH_HYBRID_DERIVE 0x00000032 +#define CKM_X9_42_MQV_DERIVE 0x00000033 + +#define CKM_RC2_KEY_GEN 0x00000100 +#define CKM_RC2_ECB 0x00000101 +#define CKM_RC2_CBC 0x00000102 +#define CKM_RC2_MAC 0x00000103 + +/* CKM_RC2_MAC_GENERAL and CKM_RC2_CBC_PAD are new for v2.0 */ +#define CKM_RC2_MAC_GENERAL 0x00000104 +#define CKM_RC2_CBC_PAD 0x00000105 + +#define CKM_RC4_KEY_GEN 0x00000110 +#define CKM_RC4 0x00000111 +#define CKM_DES_KEY_GEN 0x00000120 +#define CKM_DES_ECB 0x00000121 +#define CKM_DES_CBC 0x00000122 +#define CKM_DES_MAC 0x00000123 + +/* CKM_DES_MAC_GENERAL and CKM_DES_CBC_PAD are new for v2.0 */ +#define CKM_DES_MAC_GENERAL 0x00000124 +#define CKM_DES_CBC_PAD 0x00000125 + +#define CKM_DES2_KEY_GEN 0x00000130 +#define CKM_DES3_KEY_GEN 0x00000131 +#define CKM_DES3_ECB 0x00000132 +#define CKM_DES3_CBC 0x00000133 +#define CKM_DES3_MAC 0x00000134 + +/* CKM_DES3_MAC_GENERAL, CKM_DES3_CBC_PAD, CKM_CDMF_KEY_GEN, + * CKM_CDMF_ECB, CKM_CDMF_CBC, CKM_CDMF_MAC, + * CKM_CDMF_MAC_GENERAL, and CKM_CDMF_CBC_PAD are new for v2.0 */ +#define CKM_DES3_MAC_GENERAL 0x00000135 +#define CKM_DES3_CBC_PAD 0x00000136 +#define CKM_CDMF_KEY_GEN 0x00000140 +#define CKM_CDMF_ECB 0x00000141 +#define CKM_CDMF_CBC 0x00000142 +#define CKM_CDMF_MAC 0x00000143 +#define CKM_CDMF_MAC_GENERAL 0x00000144 +#define CKM_CDMF_CBC_PAD 0x00000145 + +#define CKM_MD2 0x00000200 + +/* CKM_MD2_HMAC and CKM_MD2_HMAC_GENERAL are new for v2.0 */ +#define CKM_MD2_HMAC 0x00000201 +#define CKM_MD2_HMAC_GENERAL 0x00000202 + +#define CKM_MD5 0x00000210 + +/* CKM_MD5_HMAC and CKM_MD5_HMAC_GENERAL are new for v2.0 */ +#define CKM_MD5_HMAC 0x00000211 +#define CKM_MD5_HMAC_GENERAL 0x00000212 + +#define CKM_SHA_1 0x00000220 + +/* CKM_SHA_1_HMAC and CKM_SHA_1_HMAC_GENERAL are new for v2.0 */ +#define CKM_SHA_1_HMAC 0x00000221 +#define CKM_SHA_1_HMAC_GENERAL 0x00000222 + +/* CKM_RIPEMD128, CKM_RIPEMD128_HMAC, + * CKM_RIPEMD128_HMAC_GENERAL, CKM_RIPEMD160, CKM_RIPEMD160_HMAC, + * and CKM_RIPEMD160_HMAC_GENERAL are new for v2.10 */ +#define CKM_RIPEMD128 0x00000230 +#define CKM_RIPEMD128_HMAC 0x00000231 +#define CKM_RIPEMD128_HMAC_GENERAL 0x00000232 +#define CKM_RIPEMD160 0x00000240 +#define CKM_RIPEMD160_HMAC 0x00000241 +#define CKM_RIPEMD160_HMAC_GENERAL 0x00000242 + +/* All of the following mechanisms are new for v2.0 */ +/* Note that CAST128 and CAST5 are the same algorithm */ +#define CKM_CAST_KEY_GEN 0x00000300 +#define CKM_CAST_ECB 0x00000301 +#define CKM_CAST_CBC 0x00000302 +#define CKM_CAST_MAC 0x00000303 +#define CKM_CAST_MAC_GENERAL 0x00000304 +#define CKM_CAST_CBC_PAD 0x00000305 +#define CKM_CAST3_KEY_GEN 0x00000310 +#define CKM_CAST3_ECB 0x00000311 +#define CKM_CAST3_CBC 0x00000312 +#define CKM_CAST3_MAC 0x00000313 +#define CKM_CAST3_MAC_GENERAL 0x00000314 +#define CKM_CAST3_CBC_PAD 0x00000315 +#define CKM_CAST5_KEY_GEN 0x00000320 +#define CKM_CAST128_KEY_GEN 0x00000320 +#define CKM_CAST5_ECB 0x00000321 +#define CKM_CAST128_ECB 0x00000321 +#define CKM_CAST5_CBC 0x00000322 +#define CKM_CAST128_CBC 0x00000322 +#define CKM_CAST5_MAC 0x00000323 +#define CKM_CAST128_MAC 0x00000323 +#define CKM_CAST5_MAC_GENERAL 0x00000324 +#define CKM_CAST128_MAC_GENERAL 0x00000324 +#define CKM_CAST5_CBC_PAD 0x00000325 +#define CKM_CAST128_CBC_PAD 0x00000325 +#define CKM_RC5_KEY_GEN 0x00000330 +#define CKM_RC5_ECB 0x00000331 +#define CKM_RC5_CBC 0x00000332 +#define CKM_RC5_MAC 0x00000333 +#define CKM_RC5_MAC_GENERAL 0x00000334 +#define CKM_RC5_CBC_PAD 0x00000335 +#define CKM_IDEA_KEY_GEN 0x00000340 +#define CKM_IDEA_ECB 0x00000341 +#define CKM_IDEA_CBC 0x00000342 +#define CKM_IDEA_MAC 0x00000343 +#define CKM_IDEA_MAC_GENERAL 0x00000344 +#define CKM_IDEA_CBC_PAD 0x00000345 +#define CKM_GENERIC_SECRET_KEY_GEN 0x00000350 +#define CKM_CONCATENATE_BASE_AND_KEY 0x00000360 +#define CKM_CONCATENATE_BASE_AND_DATA 0x00000362 +#define CKM_CONCATENATE_DATA_AND_BASE 0x00000363 +#define CKM_XOR_BASE_AND_DATA 0x00000364 +#define CKM_EXTRACT_KEY_FROM_KEY 0x00000365 +#define CKM_SSL3_PRE_MASTER_KEY_GEN 0x00000370 +#define CKM_SSL3_MASTER_KEY_DERIVE 0x00000371 +#define CKM_SSL3_KEY_AND_MAC_DERIVE 0x00000372 + +/* CKM_SSL3_MASTER_KEY_DERIVE_DH, CKM_TLS_PRE_MASTER_KEY_GEN, + * CKM_TLS_MASTER_KEY_DERIVE, CKM_TLS_KEY_AND_MAC_DERIVE, and + * CKM_TLS_MASTER_KEY_DERIVE_DH are new for v2.11 */ +#define CKM_SSL3_MASTER_KEY_DERIVE_DH 0x00000373 +#define CKM_TLS_PRE_MASTER_KEY_GEN 0x00000374 +#define CKM_TLS_MASTER_KEY_DERIVE 0x00000375 +#define CKM_TLS_KEY_AND_MAC_DERIVE 0x00000376 +#define CKM_TLS_MASTER_KEY_DERIVE_DH 0x00000377 + +#define CKM_SSL3_MD5_MAC 0x00000380 +#define CKM_SSL3_SHA1_MAC 0x00000381 +#define CKM_MD5_KEY_DERIVATION 0x00000390 +#define CKM_MD2_KEY_DERIVATION 0x00000391 +#define CKM_SHA1_KEY_DERIVATION 0x00000392 +#define CKM_PBE_MD2_DES_CBC 0x000003A0 +#define CKM_PBE_MD5_DES_CBC 0x000003A1 +#define CKM_PBE_MD5_CAST_CBC 0x000003A2 +#define CKM_PBE_MD5_CAST3_CBC 0x000003A3 +#define CKM_PBE_MD5_CAST5_CBC 0x000003A4 +#define CKM_PBE_MD5_CAST128_CBC 0x000003A4 +#define CKM_PBE_SHA1_CAST5_CBC 0x000003A5 +#define CKM_PBE_SHA1_CAST128_CBC 0x000003A5 +#define CKM_PBE_SHA1_RC4_128 0x000003A6 +#define CKM_PBE_SHA1_RC4_40 0x000003A7 +#define CKM_PBE_SHA1_DES3_EDE_CBC 0x000003A8 +#define CKM_PBE_SHA1_DES2_EDE_CBC 0x000003A9 +#define CKM_PBE_SHA1_RC2_128_CBC 0x000003AA +#define CKM_PBE_SHA1_RC2_40_CBC 0x000003AB + +/* CKM_PKCS5_PBKD2 is new for v2.10 */ +#define CKM_PKCS5_PBKD2 0x000003B0 + +#define CKM_PBA_SHA1_WITH_SHA1_HMAC 0x000003C0 +#define CKM_KEY_WRAP_LYNKS 0x00000400 +#define CKM_KEY_WRAP_SET_OAEP 0x00000401 + +/* Fortezza mechanisms */ +#define CKM_SKIPJACK_KEY_GEN 0x00001000 +#define CKM_SKIPJACK_ECB64 0x00001001 +#define CKM_SKIPJACK_CBC64 0x00001002 +#define CKM_SKIPJACK_OFB64 0x00001003 +#define CKM_SKIPJACK_CFB64 0x00001004 +#define CKM_SKIPJACK_CFB32 0x00001005 +#define CKM_SKIPJACK_CFB16 0x00001006 +#define CKM_SKIPJACK_CFB8 0x00001007 +#define CKM_SKIPJACK_WRAP 0x00001008 +#define CKM_SKIPJACK_PRIVATE_WRAP 0x00001009 +#define CKM_SKIPJACK_RELAYX 0x0000100a +#define CKM_KEA_KEY_PAIR_GEN 0x00001010 +#define CKM_KEA_KEY_DERIVE 0x00001011 +#define CKM_FORTEZZA_TIMESTAMP 0x00001020 +#define CKM_BATON_KEY_GEN 0x00001030 +#define CKM_BATON_ECB128 0x00001031 +#define CKM_BATON_ECB96 0x00001032 +#define CKM_BATON_CBC128 0x00001033 +#define CKM_BATON_COUNTER 0x00001034 +#define CKM_BATON_SHUFFLE 0x00001035 +#define CKM_BATON_WRAP 0x00001036 + +/* CKM_ECDSA_KEY_PAIR_GEN is deprecated in v2.11, + * CKM_EC_KEY_PAIR_GEN is preferred */ +#define CKM_ECDSA_KEY_PAIR_GEN 0x00001040 +#define CKM_EC_KEY_PAIR_GEN 0x00001040 + +#define CKM_ECDSA 0x00001041 +#define CKM_ECDSA_SHA1 0x00001042 + +/* CKM_ECDH1_DERIVE, CKM_ECDH1_COFACTOR_DERIVE, and CKM_ECMQV_DERIVE + * are new for v2.11 */ +#define CKM_ECDH1_DERIVE 0x00001050 +#define CKM_ECDH1_COFACTOR_DERIVE 0x00001051 +#define CKM_ECMQV_DERIVE 0x00001052 + +#define CKM_JUNIPER_KEY_GEN 0x00001060 +#define CKM_JUNIPER_ECB128 0x00001061 +#define CKM_JUNIPER_CBC128 0x00001062 +#define CKM_JUNIPER_COUNTER 0x00001063 +#define CKM_JUNIPER_SHUFFLE 0x00001064 +#define CKM_JUNIPER_WRAP 0x00001065 +#define CKM_FASTHASH 0x00001070 + +/* CKM_AES_KEY_GEN, CKM_AES_ECB, CKM_AES_CBC, CKM_AES_MAC, + * CKM_AES_MAC_GENERAL, CKM_AES_CBC_PAD, CKM_DSA_PARAMETER_GEN, + * CKM_DH_PKCS_PARAMETER_GEN, and CKM_X9_42_DH_PARAMETER_GEN are + * new for v2.11 */ +#define CKM_AES_KEY_GEN 0x00001080 +#define CKM_AES_ECB 0x00001081 +#define CKM_AES_CBC 0x00001082 +#define CKM_AES_MAC 0x00001083 +#define CKM_AES_MAC_GENERAL 0x00001084 +#define CKM_AES_CBC_PAD 0x00001085 +#define CKM_DSA_PARAMETER_GEN 0x00002000 +#define CKM_DH_PKCS_PARAMETER_GEN 0x00002001 +#define CKM_X9_42_DH_PARAMETER_GEN 0x00002002 + +#define CKM_VENDOR_DEFINED 0x80000000 + +typedef CK_MECHANISM_TYPE CK_PTR CK_MECHANISM_TYPE_PTR; + + +/* CK_MECHANISM is a structure that specifies a particular + * mechanism */ +typedef struct CK_MECHANISM { + CK_MECHANISM_TYPE mechanism; + CK_VOID_PTR pParameter; + + /* ulParameterLen was changed from CK_USHORT to CK_ULONG for + * v2.0 */ + CK_ULONG ulParameterLen; /* in bytes */ +} CK_MECHANISM; + +typedef CK_MECHANISM CK_PTR CK_MECHANISM_PTR; + + +/* CK_MECHANISM_INFO provides information about a particular + * mechanism */ +typedef struct CK_MECHANISM_INFO { + CK_ULONG ulMinKeySize; + CK_ULONG ulMaxKeySize; + CK_FLAGS flags; +} CK_MECHANISM_INFO; + +/* The flags are defined as follows: + * Bit Flag Mask Meaning */ +#define CKF_HW 0x00000001 /* performed by HW */ + +/* The flags CKF_ENCRYPT, CKF_DECRYPT, CKF_DIGEST, CKF_SIGN, + * CKG_SIGN_RECOVER, CKF_VERIFY, CKF_VERIFY_RECOVER, + * CKF_GENERATE, CKF_GENERATE_KEY_PAIR, CKF_WRAP, CKF_UNWRAP, + * and CKF_DERIVE are new for v2.0. They specify whether or not + * a mechanism can be used for a particular task */ +#define CKF_ENCRYPT 0x00000100 +#define CKF_DECRYPT 0x00000200 +#define CKF_DIGEST 0x00000400 +#define CKF_SIGN 0x00000800 +#define CKF_SIGN_RECOVER 0x00001000 +#define CKF_VERIFY 0x00002000 +#define CKF_VERIFY_RECOVER 0x00004000 +#define CKF_GENERATE 0x00008000 +#define CKF_GENERATE_KEY_PAIR 0x00010000 +#define CKF_WRAP 0x00020000 +#define CKF_UNWRAP 0x00040000 +#define CKF_DERIVE 0x00080000 + +/* CKF_EC_F_P, CKF_EC_F_2M, CKF_EC_ECPARAMETERS, CKF_EC_NAMEDCURVE, + * CKF_EC_UNCOMPRESS, and CKF_EC_COMPRESS are new for v2.11. They + * describe a token's EC capabilities not available in mechanism + * information. */ +#define CKF_EC_F_P 0x00100000 +#define CKF_EC_F_2M 0x00200000 +#define CKF_EC_ECPARAMETERS 0x00400000 +#define CKF_EC_NAMEDCURVE 0x00800000 +#define CKF_EC_UNCOMPRESS 0x01000000 +#define CKF_EC_COMPRESS 0x02000000 + +#define CKF_EXTENSION 0x80000000 /* FALSE for 2.01 */ + +typedef CK_MECHANISM_INFO CK_PTR CK_MECHANISM_INFO_PTR; + + +/* CK_RV is a value that identifies the return value of a + * Cryptoki function */ +/* CK_RV was changed from CK_USHORT to CK_ULONG for v2.0 */ +typedef CK_ULONG CK_RV; + +#define CKR_OK 0x00000000 +#define CKR_CANCEL 0x00000001 +#define CKR_HOST_MEMORY 0x00000002 +#define CKR_SLOT_ID_INVALID 0x00000003 + +/* CKR_FLAGS_INVALID was removed for v2.0 */ + +/* CKR_GENERAL_ERROR and CKR_FUNCTION_FAILED are new for v2.0 */ +#define CKR_GENERAL_ERROR 0x00000005 +#define CKR_FUNCTION_FAILED 0x00000006 + +/* CKR_ARGUMENTS_BAD, CKR_NO_EVENT, CKR_NEED_TO_CREATE_THREADS, + * and CKR_CANT_LOCK are new for v2.01 */ +#define CKR_ARGUMENTS_BAD 0x00000007 +#define CKR_NO_EVENT 0x00000008 +#define CKR_NEED_TO_CREATE_THREADS 0x00000009 +#define CKR_CANT_LOCK 0x0000000A + +#define CKR_ATTRIBUTE_READ_ONLY 0x00000010 +#define CKR_ATTRIBUTE_SENSITIVE 0x00000011 +#define CKR_ATTRIBUTE_TYPE_INVALID 0x00000012 +#define CKR_ATTRIBUTE_VALUE_INVALID 0x00000013 +#define CKR_DATA_INVALID 0x00000020 +#define CKR_DATA_LEN_RANGE 0x00000021 +#define CKR_DEVICE_ERROR 0x00000030 +#define CKR_DEVICE_MEMORY 0x00000031 +#define CKR_DEVICE_REMOVED 0x00000032 +#define CKR_ENCRYPTED_DATA_INVALID 0x00000040 +#define CKR_ENCRYPTED_DATA_LEN_RANGE 0x00000041 +#define CKR_FUNCTION_CANCELED 0x00000050 +#define CKR_FUNCTION_NOT_PARALLEL 0x00000051 + +/* CKR_FUNCTION_NOT_SUPPORTED is new for v2.0 */ +#define CKR_FUNCTION_NOT_SUPPORTED 0x00000054 + +#define CKR_KEY_HANDLE_INVALID 0x00000060 + +/* CKR_KEY_SENSITIVE was removed for v2.0 */ + +#define CKR_KEY_SIZE_RANGE 0x00000062 +#define CKR_KEY_TYPE_INCONSISTENT 0x00000063 + +/* CKR_KEY_NOT_NEEDED, CKR_KEY_CHANGED, CKR_KEY_NEEDED, + * CKR_KEY_INDIGESTIBLE, CKR_KEY_FUNCTION_NOT_PERMITTED, + * CKR_KEY_NOT_WRAPPABLE, and CKR_KEY_UNEXTRACTABLE are new for + * v2.0 */ +#define CKR_KEY_NOT_NEEDED 0x00000064 +#define CKR_KEY_CHANGED 0x00000065 +#define CKR_KEY_NEEDED 0x00000066 +#define CKR_KEY_INDIGESTIBLE 0x00000067 +#define CKR_KEY_FUNCTION_NOT_PERMITTED 0x00000068 +#define CKR_KEY_NOT_WRAPPABLE 0x00000069 +#define CKR_KEY_UNEXTRACTABLE 0x0000006A + +#define CKR_MECHANISM_INVALID 0x00000070 +#define CKR_MECHANISM_PARAM_INVALID 0x00000071 + +/* CKR_OBJECT_CLASS_INCONSISTENT and CKR_OBJECT_CLASS_INVALID + * were removed for v2.0 */ +#define CKR_OBJECT_HANDLE_INVALID 0x00000082 +#define CKR_OPERATION_ACTIVE 0x00000090 +#define CKR_OPERATION_NOT_INITIALIZED 0x00000091 +#define CKR_PIN_INCORRECT 0x000000A0 +#define CKR_PIN_INVALID 0x000000A1 +#define CKR_PIN_LEN_RANGE 0x000000A2 + +/* CKR_PIN_EXPIRED and CKR_PIN_LOCKED are new for v2.0 */ +#define CKR_PIN_EXPIRED 0x000000A3 +#define CKR_PIN_LOCKED 0x000000A4 + +#define CKR_SESSION_CLOSED 0x000000B0 +#define CKR_SESSION_COUNT 0x000000B1 +#define CKR_SESSION_HANDLE_INVALID 0x000000B3 +#define CKR_SESSION_PARALLEL_NOT_SUPPORTED 0x000000B4 +#define CKR_SESSION_READ_ONLY 0x000000B5 +#define CKR_SESSION_EXISTS 0x000000B6 + +/* CKR_SESSION_READ_ONLY_EXISTS and + * CKR_SESSION_READ_WRITE_SO_EXISTS are new for v2.0 */ +#define CKR_SESSION_READ_ONLY_EXISTS 0x000000B7 +#define CKR_SESSION_READ_WRITE_SO_EXISTS 0x000000B8 + +#define CKR_SIGNATURE_INVALID 0x000000C0 +#define CKR_SIGNATURE_LEN_RANGE 0x000000C1 +#define CKR_TEMPLATE_INCOMPLETE 0x000000D0 +#define CKR_TEMPLATE_INCONSISTENT 0x000000D1 +#define CKR_TOKEN_NOT_PRESENT 0x000000E0 +#define CKR_TOKEN_NOT_RECOGNIZED 0x000000E1 +#define CKR_TOKEN_WRITE_PROTECTED 0x000000E2 +#define CKR_UNWRAPPING_KEY_HANDLE_INVALID 0x000000F0 +#define CKR_UNWRAPPING_KEY_SIZE_RANGE 0x000000F1 +#define CKR_UNWRAPPING_KEY_TYPE_INCONSISTENT 0x000000F2 +#define CKR_USER_ALREADY_LOGGED_IN 0x00000100 +#define CKR_USER_NOT_LOGGED_IN 0x00000101 +#define CKR_USER_PIN_NOT_INITIALIZED 0x00000102 +#define CKR_USER_TYPE_INVALID 0x00000103 + +/* CKR_USER_ANOTHER_ALREADY_LOGGED_IN and CKR_USER_TOO_MANY_TYPES + * are new to v2.01 */ +#define CKR_USER_ANOTHER_ALREADY_LOGGED_IN 0x00000104 +#define CKR_USER_TOO_MANY_TYPES 0x00000105 + +#define CKR_WRAPPED_KEY_INVALID 0x00000110 +#define CKR_WRAPPED_KEY_LEN_RANGE 0x00000112 +#define CKR_WRAPPING_KEY_HANDLE_INVALID 0x00000113 +#define CKR_WRAPPING_KEY_SIZE_RANGE 0x00000114 +#define CKR_WRAPPING_KEY_TYPE_INCONSISTENT 0x00000115 +#define CKR_RANDOM_SEED_NOT_SUPPORTED 0x00000120 + +/* These are new to v2.0 */ +#define CKR_RANDOM_NO_RNG 0x00000121 + +/* These are new to v2.11 */ +#define CKR_DOMAIN_PARAMS_INVALID 0x00000130 + +/* These are new to v2.0 */ +#define CKR_BUFFER_TOO_SMALL 0x00000150 +#define CKR_SAVED_STATE_INVALID 0x00000160 +#define CKR_INFORMATION_SENSITIVE 0x00000170 +#define CKR_STATE_UNSAVEABLE 0x00000180 + +/* These are new to v2.01 */ +#define CKR_CRYPTOKI_NOT_INITIALIZED 0x00000190 +#define CKR_CRYPTOKI_ALREADY_INITIALIZED 0x00000191 +#define CKR_MUTEX_BAD 0x000001A0 +#define CKR_MUTEX_NOT_LOCKED 0x000001A1 + +#define CKR_VENDOR_DEFINED 0x80000000 + + +/* CK_NOTIFY is an application callback that processes events */ +typedef CK_CALLBACK_FUNCTION(CK_RV, CK_NOTIFY)( + CK_SESSION_HANDLE hSession, /* the session's handle */ + CK_NOTIFICATION event, + CK_VOID_PTR pApplication /* passed to C_OpenSession */ +); + + +/* CK_FUNCTION_LIST is a structure holding a Cryptoki spec + * version and pointers of appropriate types to all the + * Cryptoki functions */ +/* CK_FUNCTION_LIST is new for v2.0 */ +typedef struct CK_FUNCTION_LIST CK_FUNCTION_LIST; + +typedef CK_FUNCTION_LIST CK_PTR CK_FUNCTION_LIST_PTR; + +typedef CK_FUNCTION_LIST_PTR CK_PTR CK_FUNCTION_LIST_PTR_PTR; + + +/* CK_CREATEMUTEX is an application callback for creating a + * mutex object */ +typedef CK_CALLBACK_FUNCTION(CK_RV, CK_CREATEMUTEX)( + CK_VOID_PTR_PTR ppMutex /* location to receive ptr to mutex */ +); + + +/* CK_DESTROYMUTEX is an application callback for destroying a + * mutex object */ +typedef CK_CALLBACK_FUNCTION(CK_RV, CK_DESTROYMUTEX)( + CK_VOID_PTR pMutex /* pointer to mutex */ +); + + +/* CK_LOCKMUTEX is an application callback for locking a mutex */ +typedef CK_CALLBACK_FUNCTION(CK_RV, CK_LOCKMUTEX)( + CK_VOID_PTR pMutex /* pointer to mutex */ +); + + +/* CK_UNLOCKMUTEX is an application callback for unlocking a + * mutex */ +typedef CK_CALLBACK_FUNCTION(CK_RV, CK_UNLOCKMUTEX)( + CK_VOID_PTR pMutex /* pointer to mutex */ +); + + +/* CK_C_INITIALIZE_ARGS provides the optional arguments to + * C_Initialize */ +typedef struct CK_C_INITIALIZE_ARGS { + CK_CREATEMUTEX CreateMutex; + CK_DESTROYMUTEX DestroyMutex; + CK_LOCKMUTEX LockMutex; + CK_UNLOCKMUTEX UnlockMutex; + CK_FLAGS flags; + CK_VOID_PTR pReserved; +} CK_C_INITIALIZE_ARGS; + +/* flags: bit flags that provide capabilities of the slot + * Bit Flag Mask Meaning + */ +#define CKF_LIBRARY_CANT_CREATE_OS_THREADS 0x00000001 +#define CKF_OS_LOCKING_OK 0x00000002 + +typedef CK_C_INITIALIZE_ARGS CK_PTR CK_C_INITIALIZE_ARGS_PTR; + + +/* additional flags for parameters to functions */ + +/* CKF_DONT_BLOCK is for the function C_WaitForSlotEvent */ +#define CKF_DONT_BLOCK 1 + +/* CK_RSA_PKCS_OAEP_MGF_TYPE is new for v2.10. + * CK_RSA_PKCS_OAEP_MGF_TYPE is used to indicate the Message + * Generation Function (MGF) applied to a message block when + * formatting a message block for the PKCS #1 OAEP encryption + * scheme. */ +typedef CK_ULONG CK_RSA_PKCS_MGF_TYPE; + +typedef CK_RSA_PKCS_MGF_TYPE CK_PTR CK_RSA_PKCS_MGF_TYPE_PTR; + +/* The following MGFs are defined */ +#define CKG_MGF1_SHA1 0x00000001 + +/* CK_RSA_PKCS_OAEP_SOURCE_TYPE is new for v2.10. + * CK_RSA_PKCS_OAEP_SOURCE_TYPE is used to indicate the source + * of the encoding parameter when formatting a message block + * for the PKCS #1 OAEP encryption scheme. */ +typedef CK_ULONG CK_RSA_PKCS_OAEP_SOURCE_TYPE; + +typedef CK_RSA_PKCS_OAEP_SOURCE_TYPE CK_PTR CK_RSA_PKCS_OAEP_SOURCE_TYPE_PTR; + +/* The following encoding parameter sources are defined */ +#define CKZ_DATA_SPECIFIED 0x00000001 + +/* CK_RSA_PKCS_OAEP_PARAMS is new for v2.10. + * CK_RSA_PKCS_OAEP_PARAMS provides the parameters to the + * CKM_RSA_PKCS_OAEP mechanism. */ +typedef struct CK_RSA_PKCS_OAEP_PARAMS { + CK_MECHANISM_TYPE hashAlg; + CK_RSA_PKCS_MGF_TYPE mgf; + CK_RSA_PKCS_OAEP_SOURCE_TYPE source; + CK_VOID_PTR pSourceData; + CK_ULONG ulSourceDataLen; +} CK_RSA_PKCS_OAEP_PARAMS; + +typedef CK_RSA_PKCS_OAEP_PARAMS CK_PTR CK_RSA_PKCS_OAEP_PARAMS_PTR; + +/* CK_RSA_PKCS_PSS_PARAMS is new for v2.11. + * CK_RSA_PKCS_PSS_PARAMS provides the parameters to the + * CKM_RSA_PKCS_PSS mechanism(s). */ +typedef struct CK_RSA_PKCS_PSS_PARAMS { + CK_MECHANISM_TYPE hashAlg; + CK_RSA_PKCS_MGF_TYPE mgf; + CK_ULONG sLen; +} CK_RSA_PKCS_PSS_PARAMS; + +typedef CK_RSA_PKCS_PSS_PARAMS CK_PTR CK_RSA_PKCS_PSS_PARAMS_PTR; + +/* CK_EC_KDF_TYPE is new for v2.11. */ +typedef CK_ULONG CK_EC_KDF_TYPE; + +/* The following EC Key Derivation Functions are defined */ +#define CKD_NULL 0x00000001 +#define CKD_SHA1_KDF 0x00000002 + +/* CK_ECDH1_DERIVE_PARAMS is new for v2.11. + * CK_ECDH1_DERIVE_PARAMS provides the parameters to the + * CKM_ECDH1_DERIVE and CKM_ECDH1_COFACTOR_DERIVE mechanisms, + * where each party contributes one key pair. + */ +typedef struct CK_ECDH1_DERIVE_PARAMS { + CK_EC_KDF_TYPE kdf; + CK_ULONG ulSharedDataLen; + CK_BYTE_PTR pSharedData; + CK_ULONG ulPublicDataLen; + CK_BYTE_PTR pPublicData; +} CK_ECDH1_DERIVE_PARAMS; + +typedef CK_ECDH1_DERIVE_PARAMS CK_PTR CK_ECDH1_DERIVE_PARAMS_PTR; + + +/* CK_ECDH2_DERIVE_PARAMS is new for v2.11. + * CK_ECDH2_DERIVE_PARAMS provides the parameters to the + * CKM_ECMQV_DERIVE mechanism, where each party contributes two key pairs. */ +typedef struct CK_ECDH2_DERIVE_PARAMS { + CK_EC_KDF_TYPE kdf; + CK_ULONG ulSharedDataLen; + CK_BYTE_PTR pSharedData; + CK_ULONG ulPublicDataLen; + CK_BYTE_PTR pPublicData; + CK_ULONG ulPrivateDataLen; + CK_OBJECT_HANDLE hPrivateData; + CK_ULONG ulPublicDataLen2; + CK_BYTE_PTR pPublicData2; +} CK_ECDH2_DERIVE_PARAMS; + +typedef CK_ECDH2_DERIVE_PARAMS CK_PTR CK_ECDH2_DERIVE_PARAMS_PTR; + +/* Typedefs and defines for the CKM_X9_42_DH_KEY_PAIR_GEN and the + * CKM_X9_42_DH_PARAMETER_GEN mechanisms (new for PKCS #11 v2.11) */ +typedef CK_ULONG CK_X9_42_DH_KDF_TYPE; +typedef CK_X9_42_DH_KDF_TYPE CK_PTR CK_X9_42_DH_KDF_TYPE_PTR; + +/* The following X9.42 DH key derivation functions are defined: */ +#define CKD_NULL 0x00000001 +#define CKD_SHA1_KDF_ASN1 0x00000003 +#define CKD_SHA1_KDF_CONCATENATE 0x00000004 + +/* CK_X9_42_DH1_DERIVE_PARAMS is new for v2.11. + * CK_X9_42_DH1_DERIVE_PARAMS provides the parameters to the + * CKM_X9_42_DH_DERIVE key derivation mechanism, where each party + * contributes one key pair */ +typedef struct CK_X9_42_DH1_DERIVE_PARAMS { + CK_X9_42_DH_KDF_TYPE kdf; + CK_ULONG ulOtherInfoLen; + CK_BYTE_PTR pOtherInfo; + CK_ULONG ulPublicDataLen; + CK_BYTE_PTR pPublicData; +} CK_X9_42_DH1_DERIVE_PARAMS; + +typedef struct CK_X9_42_DH1_DERIVE_PARAMS CK_PTR CK_X9_42_DH1_DERIVE_PARAMS_PTR; + +/* CK_X9_42_DH2_DERIVE_PARAMS is new for v2.11. + * CK_X9_42_DH2_DERIVE_PARAMS provides the parameters to the + * CKM_X9_42_DH_HYBRID_DERIVE and CKM_X9_42_MQV_DERIVE key derivation + * mechanisms, where each party contributes two key pairs */ +typedef struct CK_X9_42_DH2_DERIVE_PARAMS { + CK_X9_42_DH_KDF_TYPE kdf; + CK_ULONG ulOtherInfoLen; + CK_BYTE_PTR pOtherInfo; + CK_ULONG ulPublicDataLen; + CK_BYTE_PTR pPublicData; + CK_ULONG ulPrivateDataLen; + CK_OBJECT_HANDLE hPrivateData; + CK_ULONG ulPublicDataLen2; + CK_BYTE_PTR pPublicData2; +} CK_X9_42_DH2_DERIVE_PARAMS; + +typedef CK_X9_42_DH2_DERIVE_PARAMS CK_PTR CK_X9_42_DH2_DERIVE_PARAMS_PTR; + +/* CK_KEA_DERIVE_PARAMS provides the parameters to the + * CKM_KEA_DERIVE mechanism */ +/* CK_KEA_DERIVE_PARAMS is new for v2.0 */ +typedef struct CK_KEA_DERIVE_PARAMS { + CK_BBOOL isSender; + CK_ULONG ulRandomLen; + CK_BYTE_PTR pRandomA; + CK_BYTE_PTR pRandomB; + CK_ULONG ulPublicDataLen; + CK_BYTE_PTR pPublicData; +} CK_KEA_DERIVE_PARAMS; + +typedef CK_KEA_DERIVE_PARAMS CK_PTR CK_KEA_DERIVE_PARAMS_PTR; + + +/* CK_RC2_PARAMS provides the parameters to the CKM_RC2_ECB and + * CKM_RC2_MAC mechanisms. An instance of CK_RC2_PARAMS just + * holds the effective keysize */ +typedef CK_ULONG CK_RC2_PARAMS; + +typedef CK_RC2_PARAMS CK_PTR CK_RC2_PARAMS_PTR; + + +/* CK_RC2_CBC_PARAMS provides the parameters to the CKM_RC2_CBC + * mechanism */ +typedef struct CK_RC2_CBC_PARAMS { + /* ulEffectiveBits was changed from CK_USHORT to CK_ULONG for + * v2.0 */ + CK_ULONG ulEffectiveBits; /* effective bits (1-1024) */ + + CK_BYTE iv[8]; /* IV for CBC mode */ +} CK_RC2_CBC_PARAMS; + +typedef CK_RC2_CBC_PARAMS CK_PTR CK_RC2_CBC_PARAMS_PTR; + + +/* CK_RC2_MAC_GENERAL_PARAMS provides the parameters for the + * CKM_RC2_MAC_GENERAL mechanism */ +/* CK_RC2_MAC_GENERAL_PARAMS is new for v2.0 */ +typedef struct CK_RC2_MAC_GENERAL_PARAMS { + CK_ULONG ulEffectiveBits; /* effective bits (1-1024) */ + CK_ULONG ulMacLength; /* Length of MAC in bytes */ +} CK_RC2_MAC_GENERAL_PARAMS; + +typedef CK_RC2_MAC_GENERAL_PARAMS CK_PTR \ + CK_RC2_MAC_GENERAL_PARAMS_PTR; + + +/* CK_RC5_PARAMS provides the parameters to the CKM_RC5_ECB and + * CKM_RC5_MAC mechanisms */ +/* CK_RC5_PARAMS is new for v2.0 */ +typedef struct CK_RC5_PARAMS { + CK_ULONG ulWordsize; /* wordsize in bits */ + CK_ULONG ulRounds; /* number of rounds */ +} CK_RC5_PARAMS; + +typedef CK_RC5_PARAMS CK_PTR CK_RC5_PARAMS_PTR; + + +/* CK_RC5_CBC_PARAMS provides the parameters to the CKM_RC5_CBC + * mechanism */ +/* CK_RC5_CBC_PARAMS is new for v2.0 */ +typedef struct CK_RC5_CBC_PARAMS { + CK_ULONG ulWordsize; /* wordsize in bits */ + CK_ULONG ulRounds; /* number of rounds */ + CK_BYTE_PTR pIv; /* pointer to IV */ + CK_ULONG ulIvLen; /* length of IV in bytes */ +} CK_RC5_CBC_PARAMS; + +typedef CK_RC5_CBC_PARAMS CK_PTR CK_RC5_CBC_PARAMS_PTR; + + +/* CK_RC5_MAC_GENERAL_PARAMS provides the parameters for the + * CKM_RC5_MAC_GENERAL mechanism */ +/* CK_RC5_MAC_GENERAL_PARAMS is new for v2.0 */ +typedef struct CK_RC5_MAC_GENERAL_PARAMS { + CK_ULONG ulWordsize; /* wordsize in bits */ + CK_ULONG ulRounds; /* number of rounds */ + CK_ULONG ulMacLength; /* Length of MAC in bytes */ +} CK_RC5_MAC_GENERAL_PARAMS; + +typedef CK_RC5_MAC_GENERAL_PARAMS CK_PTR \ + CK_RC5_MAC_GENERAL_PARAMS_PTR; + + +/* CK_MAC_GENERAL_PARAMS provides the parameters to most block + * ciphers' MAC_GENERAL mechanisms. Its value is the length of + * the MAC */ +/* CK_MAC_GENERAL_PARAMS is new for v2.0 */ +typedef CK_ULONG CK_MAC_GENERAL_PARAMS; + +typedef CK_MAC_GENERAL_PARAMS CK_PTR CK_MAC_GENERAL_PARAMS_PTR; + + +/* CK_SKIPJACK_PRIVATE_WRAP_PARAMS provides the parameters to the + * CKM_SKIPJACK_PRIVATE_WRAP mechanism */ +/* CK_SKIPJACK_PRIVATE_WRAP_PARAMS is new for v2.0 */ +typedef struct CK_SKIPJACK_PRIVATE_WRAP_PARAMS { + CK_ULONG ulPasswordLen; + CK_BYTE_PTR pPassword; + CK_ULONG ulPublicDataLen; + CK_BYTE_PTR pPublicData; + CK_ULONG ulPAndGLen; + CK_ULONG ulQLen; + CK_ULONG ulRandomLen; + CK_BYTE_PTR pRandomA; + CK_BYTE_PTR pPrimeP; + CK_BYTE_PTR pBaseG; + CK_BYTE_PTR pSubprimeQ; +} CK_SKIPJACK_PRIVATE_WRAP_PARAMS; + +typedef CK_SKIPJACK_PRIVATE_WRAP_PARAMS CK_PTR \ + CK_SKIPJACK_PRIVATE_WRAP_PTR; + + +/* CK_SKIPJACK_RELAYX_PARAMS provides the parameters to the + * CKM_SKIPJACK_RELAYX mechanism */ +/* CK_SKIPJACK_RELAYX_PARAMS is new for v2.0 */ +typedef struct CK_SKIPJACK_RELAYX_PARAMS { + CK_ULONG ulOldWrappedXLen; + CK_BYTE_PTR pOldWrappedX; + CK_ULONG ulOldPasswordLen; + CK_BYTE_PTR pOldPassword; + CK_ULONG ulOldPublicDataLen; + CK_BYTE_PTR pOldPublicData; + CK_ULONG ulOldRandomLen; + CK_BYTE_PTR pOldRandomA; + CK_ULONG ulNewPasswordLen; + CK_BYTE_PTR pNewPassword; + CK_ULONG ulNewPublicDataLen; + CK_BYTE_PTR pNewPublicData; + CK_ULONG ulNewRandomLen; + CK_BYTE_PTR pNewRandomA; +} CK_SKIPJACK_RELAYX_PARAMS; + +typedef CK_SKIPJACK_RELAYX_PARAMS CK_PTR \ + CK_SKIPJACK_RELAYX_PARAMS_PTR; + + +typedef struct CK_PBE_PARAMS { + CK_BYTE_PTR pInitVector; + CK_UTF8CHAR_PTR pPassword; + CK_ULONG ulPasswordLen; + CK_BYTE_PTR pSalt; + CK_ULONG ulSaltLen; + CK_ULONG ulIteration; +} CK_PBE_PARAMS; + +typedef CK_PBE_PARAMS CK_PTR CK_PBE_PARAMS_PTR; + + +/* CK_KEY_WRAP_SET_OAEP_PARAMS provides the parameters to the + * CKM_KEY_WRAP_SET_OAEP mechanism */ +/* CK_KEY_WRAP_SET_OAEP_PARAMS is new for v2.0 */ +typedef struct CK_KEY_WRAP_SET_OAEP_PARAMS { + CK_BYTE bBC; /* block contents byte */ + CK_BYTE_PTR pX; /* extra data */ + CK_ULONG ulXLen; /* length of extra data in bytes */ +} CK_KEY_WRAP_SET_OAEP_PARAMS; + +typedef CK_KEY_WRAP_SET_OAEP_PARAMS CK_PTR \ + CK_KEY_WRAP_SET_OAEP_PARAMS_PTR; + + +typedef struct CK_SSL3_RANDOM_DATA { + CK_BYTE_PTR pClientRandom; + CK_ULONG ulClientRandomLen; + CK_BYTE_PTR pServerRandom; + CK_ULONG ulServerRandomLen; +} CK_SSL3_RANDOM_DATA; + + +typedef struct CK_SSL3_MASTER_KEY_DERIVE_PARAMS { + CK_SSL3_RANDOM_DATA RandomInfo; + CK_VERSION_PTR pVersion; +} CK_SSL3_MASTER_KEY_DERIVE_PARAMS; + +typedef struct CK_SSL3_MASTER_KEY_DERIVE_PARAMS CK_PTR \ + CK_SSL3_MASTER_KEY_DERIVE_PARAMS_PTR; + + +typedef struct CK_SSL3_KEY_MAT_OUT { + CK_OBJECT_HANDLE hClientMacSecret; + CK_OBJECT_HANDLE hServerMacSecret; + CK_OBJECT_HANDLE hClientKey; + CK_OBJECT_HANDLE hServerKey; + CK_BYTE_PTR pIVClient; + CK_BYTE_PTR pIVServer; +} CK_SSL3_KEY_MAT_OUT; + +typedef CK_SSL3_KEY_MAT_OUT CK_PTR CK_SSL3_KEY_MAT_OUT_PTR; + + +typedef struct CK_SSL3_KEY_MAT_PARAMS { + CK_ULONG ulMacSizeInBits; + CK_ULONG ulKeySizeInBits; + CK_ULONG ulIVSizeInBits; + CK_BBOOL bIsExport; + CK_SSL3_RANDOM_DATA RandomInfo; + CK_SSL3_KEY_MAT_OUT_PTR pReturnedKeyMaterial; +} CK_SSL3_KEY_MAT_PARAMS; + +typedef CK_SSL3_KEY_MAT_PARAMS CK_PTR CK_SSL3_KEY_MAT_PARAMS_PTR; + + +typedef struct CK_KEY_DERIVATION_STRING_DATA { + CK_BYTE_PTR pData; + CK_ULONG ulLen; +} CK_KEY_DERIVATION_STRING_DATA; + +typedef CK_KEY_DERIVATION_STRING_DATA CK_PTR \ + CK_KEY_DERIVATION_STRING_DATA_PTR; + + +/* The CK_EXTRACT_PARAMS is used for the + * CKM_EXTRACT_KEY_FROM_KEY mechanism. It specifies which bit + * of the base key should be used as the first bit of the + * derived key */ +/* CK_EXTRACT_PARAMS is new for v2.0 */ +typedef CK_ULONG CK_EXTRACT_PARAMS; + +typedef CK_EXTRACT_PARAMS CK_PTR CK_EXTRACT_PARAMS_PTR; + +/* CK_PKCS5_PBKD2_PSEUDO_RANDOM_FUNCTION_TYPE is new for v2.10. + * CK_PKCS5_PBKD2_PSEUDO_RANDOM_FUNCTION_TYPE is used to + * indicate the Pseudo-Random Function (PRF) used to generate + * key bits using PKCS #5 PBKDF2. */ +typedef CK_ULONG CK_PKCS5_PBKD2_PSEUDO_RANDOM_FUNCTION_TYPE; + +typedef CK_PKCS5_PBKD2_PSEUDO_RANDOM_FUNCTION_TYPE CK_PTR CK_PKCS5_PBKD2_PSEUDO_RANDOM_FUNCTION_TYPE_PTR; + +/* The following PRFs are defined in PKCS #5 v2.0. */ +#define CKP_PKCS5_PBKD2_HMAC_SHA1 0x00000001 + + +/* CK_PKCS5_PBKDF2_SALT_SOURCE_TYPE is new for v2.10. + * CK_PKCS5_PBKDF2_SALT_SOURCE_TYPE is used to indicate the + * source of the salt value when deriving a key using PKCS #5 + * PBKDF2. */ +typedef CK_ULONG CK_PKCS5_PBKDF2_SALT_SOURCE_TYPE; + +typedef CK_PKCS5_PBKDF2_SALT_SOURCE_TYPE CK_PTR CK_PKCS5_PBKDF2_SALT_SOURCE_TYPE_PTR; + +/* The following salt value sources are defined in PKCS #5 v2.0. */ +#define CKZ_SALT_SPECIFIED 0x00000001 + +/* CK_PKCS5_PBKD2_PARAMS is new for v2.10. + * CK_PKCS5_PBKD2_PARAMS is a structure that provides the + * parameters to the CKM_PKCS5_PBKD2 mechanism. */ +typedef struct CK_PKCS5_PBKD2_PARAMS { + CK_PKCS5_PBKDF2_SALT_SOURCE_TYPE saltSource; + CK_VOID_PTR pSaltSourceData; + CK_ULONG ulSaltSourceDataLen; + CK_ULONG iterations; + CK_PKCS5_PBKD2_PSEUDO_RANDOM_FUNCTION_TYPE prf; + CK_VOID_PTR pPrfData; + CK_ULONG ulPrfDataLen; + CK_UTF8CHAR_PTR pPassword; + CK_ULONG_PTR ulPasswordLen; +} CK_PKCS5_PBKD2_PARAMS; + +typedef CK_PKCS5_PBKD2_PARAMS CK_PTR CK_PKCS5_PBKD2_PARAMS_PTR; + +#endif diff --git a/src/Neo/NDIS5.c b/src/Neo/NDIS5.c index 4e99a6dc..f026bbef 100644 --- a/src/Neo/NDIS5.c +++ b/src/Neo/NDIS5.c @@ -1,1633 +1,1633 @@ -// SoftEther VPN Source Code - Developer Edition Master Branch -// Kernel Device Driver - - -// NDIS5.c -// Description: Windows NDIS 5.0 Routine - -#include - -#define NEO_DEVICE_DRIVER - -#include "Neo.h" - -static UINT max_speed = NEO_MAX_SPEED_DEFAULT; -static bool keep_link = false; - -BOOLEAN -PsGetVersion( - PULONG MajorVersion OPTIONAL, - PULONG MinorVersion OPTIONAL, - PULONG BuildNumber OPTIONAL, - PUNICODE_STRING CSDVersion OPTIONAL - ); - -// Memory related -static NDIS_PHYSICAL_ADDRESS HighestAcceptableMax = NDIS_PHYSICAL_ADDRESS_CONST(-1, -1); -NDIS_HANDLE ndis_wrapper_handle = NULL; - -// Whether Windows 8 -bool g_is_win8 = false; - -// Win32 driver entry point -NDIS_STATUS DriverEntry(DRIVER_OBJECT *DriverObject, UNICODE_STRING *RegistryPath) -{ - NDIS_MINIPORT_CHARACTERISTICS miniport; - ULONG os_major_ver = 0, os_minor_ver = 0; - - // Initialize the Neo library - if (NeoInit() == FALSE) - { - // Initialization Failed - return STATUS_UNSUCCESSFUL; - } - - g_is_win8 = false; - -#ifndef NDIS30_MINIPORT - // Get the OS version - PsGetVersion(&os_major_ver, &os_minor_ver, NULL, NULL); - - if (os_major_ver >= 7 || (os_major_ver == 6 && os_minor_ver >= 2)) - { - // Windows 8 - g_is_win8 = true; - } -#endif // NDIS30_MINIPORT - - // Initialize the NDIS wrapper - NdisMInitializeWrapper(&ctx->NdisWrapper, DriverObject, RegistryPath, NULL); - ndis_wrapper_handle = ctx->NdisWrapper; - - // Register a NDIS miniport driver - NeoZero(&miniport, sizeof(NDIS_MINIPORT_CHARACTERISTICS)); - miniport.MajorNdisVersion = NEO_NDIS_MAJOR_VERSION; - miniport.MinorNdisVersion = NEO_NDIS_MINOR_VERSION; - - // Register the handler - miniport.InitializeHandler = NeoNdisInit; - miniport.HaltHandler = NeoNdisHalt; - miniport.QueryInformationHandler = NeoNdisQuery; - miniport.ResetHandler = NeoNdisReset; - miniport.SetInformationHandler = NeoNdisSet; - -#ifndef NDIS30_MINIPORT - miniport.SendPacketsHandler = NeoNdisSendPackets; -#else // NDIS30_MINIPORT - miniport.SendHandler = NULL; -#endif // NDIS30_MINIPORT - - if (NG(NdisMRegisterMiniport(ctx->NdisWrapper, &miniport, sizeof(NDIS_MINIPORT_CHARACTERISTICS)))) - { - // Registration failure - return STATUS_UNSUCCESSFUL; - } - - // Initialization success - return STATUS_SUCCESS; -} - -// Initialization handler of adapter -NDIS_STATUS NeoNdisInit(NDIS_STATUS *OpenErrorStatus, - UINT *SelectedMediumIndex, - NDIS_MEDIUM *MediumArray, - UINT MediumArraySize, - NDIS_HANDLE MiniportAdapterHandle, - NDIS_HANDLE WrapperConfigurationContext) -{ - BOOL media_check; - UINT i; - - if (ctx == NULL) - { - return NDIS_STATUS_FAILURE; - } - - if (ctx->NdisWrapper == NULL) - { - ctx->NdisWrapper = ndis_wrapper_handle; - } - - // Prevention of multiple start - if (ctx->Initing != FALSE) - { - // Multiple started - return NDIS_STATUS_FAILURE; - } - ctx->Initing = TRUE; - - // Examine whether it has already been initialized - if (ctx->Inited != FALSE) - { - // Driver is started on another instance already. - // PacketiX VPN driver can start only one instance per one service. - // User can start multiple drivers with different instance ID - return NDIS_STATUS_FAILURE; - } - - // Current value of the packet filter - ctx->CurrentPacketFilter = NDIS_PACKET_TYPE_ALL_LOCAL | NDIS_PACKET_TYPE_BROADCAST | NDIS_PACKET_TYPE_DIRECTED | NDIS_PACKET_TYPE_ALL_FUNCTIONAL; - - // Examine whether the Ethernet is available - media_check = FALSE; - for (i = 0;i < MediumArraySize;i++) - { - if (MediumArray[i] == NEO_MEDIA) - { - media_check = TRUE; - break; - } - } - if (media_check == FALSE) - { - // Ethernet is unavailable - ctx->Initing = FALSE; - return NDIS_STATUS_FAILURE; - } - - // Media number to use - *SelectedMediumIndex = i; - - // Initialize the adapter information - ctx->NdisMiniport = MiniportAdapterHandle; - ctx->NdisConfig = WrapperConfigurationContext; - ctx->NdisContext = ctx; - ctx->HardwareStatus = NdisHardwareStatusReady; - ctx->Halting = FALSE; - ctx->Connected = ctx->ConnectedOld = FALSE; - - if (keep_link == false) - { - ctx->ConnectedForce = TRUE; - } - - // Read the information from the registry - if (NeoLoadRegistry() == FALSE) - { - // Failure - ctx->Initing = FALSE; - return NDIS_STATUS_FAILURE; - } - - // Register the device attributes - - if (g_is_win8 == false) - { - NdisMSetAttributes(ctx->NdisMiniport, ctx->NdisContext, FALSE, NdisInterfaceInternal); - } - else - { - NdisMSetAttributesEx(ctx->NdisMiniport, ctx->NdisContext, 16, - NDIS_ATTRIBUTE_DESERIALIZE | NDIS_ATTRIBUTE_IGNORE_PACKET_TIMEOUT | NDIS_ATTRIBUTE_IGNORE_REQUEST_TIMEOUT | NDIS_ATTRIBUTE_NO_HALT_ON_SUSPEND, - NdisInterfaceInternal); - } - - // Initialize the received packet array - NeoInitPacketArray(); - - // Initialize the control device - NeoInitControlDevice(); - - // Start the adapter - NeoStartAdapter(); - - // Flag setting - ctx->Initing = FALSE; - ctx->Inited = TRUE; - - // Notify the connection state - NeoSetConnectState(FALSE); - - return NDIS_STATUS_SUCCESS; -} - -// Open the device -BOOL NeoNdisOnOpen(IRP *irp, IO_STACK_LOCATION *stack) -{ - char name[MAX_SIZE]; - - if (ctx == NULL) - { - return FALSE; - } - - if (ctx->Opened != FALSE) - { - // Another client is connected already - return FALSE; - } - ctx->Opened = TRUE; - - // Initialize the event name - sprintf(name, NDIS_NEO_EVENT_NAME, ctx->HardwareID); - - // Register a Event -#ifndef WIN9X - ctx->Event = NeoNewEvent(name); - if (ctx->Event == NULL) - { - ctx->Opened = FALSE; - return FALSE; - } -#endif // WIN9X - - // Set the connection state - NeoSetConnectState(TRUE); - - return TRUE; -} - -// Close the device -BOOL NeoNdisOnClose(IRP *irp, IO_STACK_LOCATION *stack) -{ - if (ctx == NULL) - { - return FALSE; - } - - if (ctx->Opened == FALSE) - { - // Client is not connected - return FALSE; - } - ctx->Opened = FALSE; - - // Release the event - NeoFreeEvent(ctx->Event); - ctx->Event = NULL; - - // Release all packets - NeoClearPacketQueue(); - - NeoSetConnectState(FALSE); - - return TRUE; -} - -// Crash -void NeoNdisCrash() -{ - NEO_QUEUE *q; - q = (NEO_QUEUE *)0xACACACAC; - q->Size = 128; - NeoCopy(q->Buf, "ABCDEFG", 8); -} - -// Dispatch table for control -NTSTATUS NeoNdisDispatch(DEVICE_OBJECT *DeviceObject, IRP *Irp) -{ - NTSTATUS status; - IO_STACK_LOCATION *stack; - void *buf; - BOOL ok; - status = STATUS_SUCCESS; - - if (ctx == NULL) - { - return NDIS_STATUS_FAILURE; - } - - // Get the IRP stack - stack = IoGetCurrentIrpStackLocation(Irp); - - // Initialize the number of bytes - Irp->IoStatus.Information = 0; - Irp->IoStatus.Status = STATUS_SUCCESS; - - buf = Irp->UserBuffer; - - if (ctx->Halting != FALSE) - { - // Device driver is terminating - Irp->IoStatus.Information = STATUS_UNSUCCESSFUL; - IoCompleteRequest(Irp, IO_NO_INCREMENT); - return STATUS_UNSUCCESSFUL; - } - - // Branch to each operation - switch (stack->MajorFunction) - { - case IRP_MJ_CREATE: - // Device is opened - if (NeoNdisOnOpen(Irp, stack) == FALSE) - { - Irp->IoStatus.Status = STATUS_UNSUCCESSFUL; - status = STATUS_UNSUCCESSFUL; - } - break; - - case IRP_MJ_CLOSE: - // Device is closed - if (NeoNdisOnClose(Irp, stack) == FALSE) - { - Irp->IoStatus.Status = STATUS_UNSUCCESSFUL; - status = STATUS_UNSUCCESSFUL; - } - break; - - case IRP_MJ_READ: -#ifndef WIN9X - // Read (Reading of the received packet) - ok = false; - if (buf != NULL) - { - if (ctx->Opened && ctx->Inited) - { - if (stack->Parameters.Read.Length == NEO_EXCHANGE_BUFFER_SIZE) - { - // Address check - bool check_ok = true; - __try - { - ProbeForWrite(buf, NEO_EXCHANGE_BUFFER_SIZE, 1); - } - __except (EXCEPTION_EXECUTE_HANDLER) - { - check_ok = false; - } - - if (check_ok) - { - MDL *mdl = IoAllocateMdl(buf, NEO_EXCHANGE_BUFFER_SIZE, false, false, NULL); - - if (mdl != NULL) - { - MmProbeAndLockPages(mdl, KernelMode, IoWriteAccess); - } - - - // Read - NeoRead(buf); - Irp->IoStatus.Information = NEO_EXCHANGE_BUFFER_SIZE; - ok = true; - - if (mdl != NULL) - { - MmUnlockPages(mdl); - IoFreeMdl(mdl); - } - } - } - } - } - if (ok == FALSE) - { - // An error occurred - Irp->IoStatus.Status = STATUS_UNSUCCESSFUL; - status = STATUS_UNSUCCESSFUL; - } -#endif // WIN9X - break; - - case IRP_MJ_WRITE: -#ifndef WIN9X - // Write (Writing of a transmission packet) - ok = false; - if (buf != NULL) - { - if (ctx->Opened && ctx->Inited) - { - if (stack->Parameters.Write.Length == NEO_EXCHANGE_BUFFER_SIZE) - { - // Address check - bool check_ok = true; - __try - { - ProbeForRead(buf, NEO_EXCHANGE_BUFFER_SIZE, 1); - } - __except (EXCEPTION_EXECUTE_HANDLER) - { - check_ok = false; - } - - if (check_ok) - { - MDL *mdl = IoAllocateMdl(buf, NEO_EXCHANGE_BUFFER_SIZE, false, false, NULL); - - if (mdl != NULL) - { - MmProbeAndLockPages(mdl, KernelMode, IoReadAccess); - } - - ProbeForRead(buf, NEO_EXCHANGE_BUFFER_SIZE, 1); - - // Write - NeoWrite(buf); - Irp->IoStatus.Information = stack->Parameters.Write.Length; - ok = true; - - if (mdl != NULL) - { - MmUnlockPages(mdl); - IoFreeMdl(mdl); - } - } - } - } - } - if (ok == FALSE) - { - // An error occurred - Irp->IoStatus.Status = STATUS_UNSUCCESSFUL; - status = STATUS_UNSUCCESSFUL; - } - break; -#endif // WIN9X - case IRP_MJ_DEVICE_CONTROL: -#ifdef WIN9X - // IO Control - switch (stack->Parameters.DeviceIoControl.IoControlCode) - { - case NEO_IOCTL_SET_EVENT: - // Specify a event - if (Irp->AssociatedIrp.SystemBuffer == NULL || - stack->Parameters.DeviceIoControl.InputBufferLength != sizeof(DWORD)) - { - // An error occurred - Irp->IoStatus.Status = STATUS_UNSUCCESSFUL; - } - else - { - DWORD value = *((DWORD *)Irp->AssociatedIrp.SystemBuffer); - ctx->Event = NeoCreateWin9xEvent(value); - Irp->IoStatus.Information = sizeof(DWORD); - } - break; - - case NEO_IOCTL_PUT_PACKET: - // Write a packet - ok = false; - buf = Irp->AssociatedIrp.SystemBuffer; - if (buf != NULL) - { - if (stack->Parameters.DeviceIoControl.InputBufferLength == NEO_EXCHANGE_BUFFER_SIZE) - { - // Write - NeoWrite(buf); - Irp->IoStatus.Information = NEO_EXCHANGE_BUFFER_SIZE; - ok = true; - } - } - - if (ok == false) - { - // An error occurred - Irp->IoStatus.Status = STATUS_UNSUCCESSFUL; - status = STATUS_UNSUCCESSFUL; - } - break; - - case NEO_IOCTL_GET_PACKET: - // Get the packet - ok = false; - buf = Irp->AssociatedIrp.SystemBuffer; - if (buf != NULL) - { - if (stack->Parameters.DeviceIoControl.OutputBufferLength == NEO_EXCHANGE_BUFFER_SIZE) - { - // Read - NeoRead(buf); - Irp->IoStatus.Information = NEO_EXCHANGE_BUFFER_SIZE; - ok = true; - } - } - - if (ok == false) - { - // An error occurred - Irp->IoStatus.Status = STATUS_UNSUCCESSFUL; - status = STATUS_UNSUCCESSFUL; - } - break; - } -#endif // WIN9X - break; - } - - IoCompleteRequest(Irp, IO_NO_INCREMENT); - - return STATUS_SUCCESS; -} - -// Initialize the control device -void NeoInitControlDevice() -{ - char name_kernel[MAX_SIZE]; - char name_win32[MAX_SIZE]; - UNICODE *unicode_kernel, *unicode_win32; - DEVICE_OBJECT *control_device_object; - NDIS_HANDLE ndis_control_handle; - - if (ctx == NULL) - { - return; - } - - // Initialize the dispatch table - NeoZero(ctx->DispatchTable, sizeof(PDRIVER_DISPATCH) * IRP_MJ_MAXIMUM_FUNCTION); - - // Register the handler - ctx->DispatchTable[IRP_MJ_CREATE] = - ctx->DispatchTable[IRP_MJ_CLOSE] = - ctx->DispatchTable[IRP_MJ_READ] = - ctx->DispatchTable[IRP_MJ_WRITE] = - ctx->DispatchTable[IRP_MJ_DEVICE_CONTROL] = NeoNdisDispatch; - ctx->Opened = FALSE; - - // Generate the device name - sprintf(name_kernel, NDIS_NEO_DEVICE_NAME, ctx->HardwareID); - unicode_kernel = NewUnicode(name_kernel); - sprintf(name_win32, NDIS_NEO_DEVICE_NAME_WIN32, ctx->HardwareID); - unicode_win32 = NewUnicode(name_win32); - - // Register the Device - NdisMRegisterDevice(ctx->NdisWrapper, GetUnicode(unicode_kernel), - GetUnicode(unicode_win32), ctx->DispatchTable, - &control_device_object, - &ndis_control_handle); - - ctx->NdisControlDevice = control_device_object; - ctx->NdisControl = ndis_control_handle; - - // Initialize the display name - if (strlen(ctx->HardwareID) > 11) - { - sprintf(ctx->HardwarePrintableID, NDIS_NEO_HARDWARE_ID, ctx->HardwareID_Raw + 11); - } - else - { - sprintf(ctx->HardwarePrintableID, NDIS_NEO_HARDWARE_ID, ctx->HardwareID_Raw); - } -} - -// Release the control device -void NeoFreeControlDevice() -{ - if (ctx == NULL) - { - return; - } - - if (ctx->Opened != FALSE) - { - // Delete the event - NeoSet(ctx->Event); - NeoFreeEvent(ctx->Event); - ctx->Event = NULL; - ctx->Opened = FALSE; - } - // Delete the device - NdisMDeregisterDevice(ctx->NdisControl); -} - - -// Read the information from the registry -BOOL NeoLoadRegistry() -{ - void *buf; - NDIS_STATUS ret; - UINT size; - NDIS_HANDLE config; - NDIS_CONFIGURATION_PARAMETER *param; - UNICODE *name; - ANSI_STRING ansi; - UNICODE_STRING *unicode; - UINT speed; - BOOL keep; - - // Get the config handle - NdisOpenConfiguration(&ret, &config, ctx->NdisConfig); - if (NG(ret)) - { - // Failure - return FALSE; - } - - // Read the MAC address - NdisReadNetworkAddress(&ret, &buf, &size, config); - if (NG(ret)) - { - // Failure - NdisCloseConfiguration(config); - return FALSE; - } - - // Copy the MAC address - if (size != NEO_MAC_ADDRESS_SIZE) - { - // Invalid size - NdisCloseConfiguration(config); - return FALSE; - } - NeoCopy(ctx->MacAddress, buf, NEO_MAC_ADDRESS_SIZE); - - if (ctx->MacAddress[0] == 0x00 && - ctx->MacAddress[1] == 0x00 && - ctx->MacAddress[2] == 0x01 && - ctx->MacAddress[3] == 0x00 && - ctx->MacAddress[4] == 0x00 && - ctx->MacAddress[5] == 0x01) - { - // Special MAC address - UINT ptr32 = (UINT)((UINT64)ctx); - - ctx->MacAddress[0] = 0x00; - ctx->MacAddress[1] = 0xAD; - ctx->MacAddress[2] = ((UCHAR *)(&ptr32))[0]; - ctx->MacAddress[3] = ((UCHAR *)(&ptr32))[1]; - ctx->MacAddress[4] = ((UCHAR *)(&ptr32))[2]; - ctx->MacAddress[5] = ((UCHAR *)(&ptr32))[3]; - } - - // Initialize the key name of the device name - name = NewUnicode("MatchingDeviceId"); - - // Read the hardware ID - NdisReadConfiguration(&ret, ¶m, config, GetUnicode(name), NdisParameterString); - FreeUnicode(name); - if (NG(ret)) - { - // Failure - NdisCloseConfiguration(config); - return FALSE; - } - // Type checking - if (param->ParameterType != NdisParameterString) - { - // Failure - NdisCloseConfiguration(config); - return FALSE; - } - unicode = ¶m->ParameterData.StringData; - - // Prepare a buffer for ANSI string - NeoZero(&ansi, sizeof(ANSI_STRING)); - ansi.MaximumLength = MAX_SIZE - 1; - ansi.Buffer = NeoZeroMalloc(MAX_SIZE); - - // Convert to ANSI string - NdisUnicodeStringToAnsiString(&ansi, unicode); - // Copy - strcpy(ctx->HardwareID, ansi.Buffer); - strcpy(ctx->HardwareID_Raw, ctx->HardwareID); - // Convert to upper case - _strupr(ctx->HardwareID); - // Release the memory - NeoFree(ansi.Buffer); - - // Read the bit rate - name = NewUnicode("MaxSpeed"); - NdisReadConfiguration(&ret, ¶m, config, GetUnicode(name), NdisParameterInteger); - FreeUnicode(name); - - if (NG(ret) || param->ParameterType != NdisParameterInteger) - { - speed = NEO_MAX_SPEED_DEFAULT; - } - else - { - speed = param->ParameterData.IntegerData * 10000; - } - - max_speed = speed; - - // Read the link keeping flag - name = NewUnicode("KeepLink"); - NdisReadConfiguration(&ret, ¶m, config, GetUnicode(name), NdisParameterInteger); - FreeUnicode(name); - - if (NG(ret) || param->ParameterType != NdisParameterInteger) - { - keep = false; - } - else - { - keep = (param->ParameterData.IntegerData == 0 ? false : true); - } - - keep_link = keep; - - // Close the Config handle - NdisCloseConfiguration(config); - - return TRUE; -} - -// Stop handler of adapter -NDIS_STATUS NeoNdisHalt(NDIS_HANDLE MiniportAdapterContext) -{ - if (ctx == NULL) - { - return NDIS_STATUS_FAILURE; - } - - if (ctx->Halting != FALSE) - { - // That has already been stopped - return NDIS_STATUS_SUCCESS; - } - ctx->Halting = TRUE; - - // Stop the adapter - NeoStopAdapter(); - - // Release the packet array - NeoFreePacketArray(); - - // Delete the control device - NeoFreeControlDevice(); - - // Complete to stop - ctx->Initing = ctx->Inited = FALSE; - ctx->Connected = ctx->ConnectedForce = ctx->ConnectedOld = FALSE; - ctx->Halting = FALSE; - - // Shutdown of Neo - NeoShutdown(); - - return NDIS_STATUS_SUCCESS; -} - -// Reset handler of adapter -NDIS_STATUS NeoNdisReset(BOOLEAN *AddressingReset, NDIS_HANDLE MiniportAdapterContext) -{ - NdisMResetComplete(ctx->NdisMiniport, NDIS_STATUS_SUCCESS, FALSE); - return NDIS_STATUS_SUCCESS; -} - -// Information acquisition handler of adapter -NDIS_STATUS NeoNdisQuery(NDIS_HANDLE MiniportAdapterContext, - NDIS_OID Oid, - void *InformationBuffer, - ULONG InformationBufferLength, - ULONG *BytesWritten, - ULONG *BytesNeeded) -{ - NDIS_MEDIUM media; - void *buf; - UINT value32; - USHORT value16; - UINT size; - - if (ctx == NULL) - { - return NDIS_STATUS_FAILURE; - } - - // Initialization - size = sizeof(UINT); - value32 = value16 = 0; - buf = &value32; - - // Branch processing - switch (Oid) - { - case OID_GEN_SUPPORTED_LIST: - // Return a list of supported OID - buf = SupportedOids; - size = sizeof(SupportedOids); - break; - - case OID_GEN_MAC_OPTIONS: - // Ethernet option - value32 = NDIS_MAC_OPTION_TRANSFERS_NOT_PEND | NDIS_MAC_OPTION_RECEIVE_SERIALIZED | - NDIS_MAC_OPTION_COPY_LOOKAHEAD_DATA | NDIS_MAC_OPTION_NO_LOOPBACK; - break; - - case OID_GEN_HARDWARE_STATUS: - // Hardware state - buf = &ctx->HardwareStatus; - size = sizeof(NDIS_HARDWARE_STATUS); - break; - - case OID_GEN_MEDIA_SUPPORTED: - case OID_GEN_MEDIA_IN_USE: - // Type of media - media = NdisMedium802_3; - buf = &media; - size = sizeof(NDIS_MEDIUM); - break; - - case OID_GEN_CURRENT_LOOKAHEAD: - case OID_GEN_MAXIMUM_LOOKAHEAD: - // Available look-ahead size - value32 = NEO_MAX_PACKET_SIZE_ANNOUNCE - NEO_MIN_PACKET_SIZE; - break; - - case OID_GEN_MAXIMUM_FRAME_SIZE: - // Maximum frame size - value32 = NEO_MAX_PACKET_SIZE_ANNOUNCE - NEO_MIN_PACKET_SIZE; - break; - - case OID_GEN_MAXIMUM_TOTAL_SIZE: - case OID_GEN_TRANSMIT_BLOCK_SIZE: - case OID_GEN_RECEIVE_BLOCK_SIZE: - // Maximum packet size - value32 = NEO_MAX_PACKET_SIZE_ANNOUNCE; - break; - - case OID_GEN_TRANSMIT_BUFFER_SPACE: - case OID_GEN_RECEIVE_BUFFER_SPACE: - // Buffer size - value32 = NEO_MAX_PACKET_SIZE_ANNOUNCE * NEO_MAX_PACKET_EXCHANGE; - break; - - case OID_GEN_LINK_SPEED: - // Communication speed - value32 = max_speed; - break; - - case OID_GEN_VENDOR_ID: - // Vendor ID - NeoCopy(&value32, ctx->MacAddress, 3); - value32 &= 0xFFFFFF00; - value32 |= 0x01; - break; - - case OID_GEN_VENDOR_DESCRIPTION: - // Hardware ID - buf = ctx->HardwarePrintableID; - size = (UINT)strlen(ctx->HardwarePrintableID) + 1; - break; - - case OID_GEN_DRIVER_VERSION: - // Driver version - value16 = ((USHORT)NEO_NDIS_MAJOR_VERSION << 8) | NEO_NDIS_MINOR_VERSION; - buf = &value16; - size = sizeof(USHORT); - break; - - case OID_GEN_VENDOR_DRIVER_VERSION: - // Vendor driver version - value16 = ((USHORT)NEO_NDIS_MAJOR_VERSION << 8) | NEO_NDIS_MINOR_VERSION; - buf = &value16; - size = sizeof(USHORT); - break; - - case OID_802_3_PERMANENT_ADDRESS: - case OID_802_3_CURRENT_ADDRESS: - // MAC address - buf = ctx->MacAddress; - size = NEO_MAC_ADDRESS_SIZE; - break; - - case OID_802_3_MAXIMUM_LIST_SIZE: - // Number of multicast - value32 = NEO_MAX_MULTICASE; - break; - - case OID_GEN_MAXIMUM_SEND_PACKETS: - // Number of packets that can be sent at a time - value32 = NEO_MAX_PACKET_EXCHANGE; - break; - - case OID_GEN_XMIT_OK: - // Number of packets sent - value32 = ctx->Status.NumPacketSend; - break; - - case OID_GEN_RCV_OK: - // Number of received packets - value32 = ctx->Status.NumPacketRecv; - break; - - case OID_GEN_XMIT_ERROR: - // Number of transmission error packets - value32 = ctx->Status.NumPacketSendError; - break; - - case OID_GEN_RCV_ERROR: - // Number of error packets received - value32 = ctx->Status.NumPacketRecvError; - break; - - case OID_GEN_RCV_NO_BUFFER: - // Number of reception buffer shortage occurrences - value32 = ctx->Status.NumPacketRecvNoBuffer; - break; - - case OID_802_3_RCV_ERROR_ALIGNMENT: - // Number of errors - value32 = 0; - break; - - case OID_GEN_MEDIA_CONNECT_STATUS: - // Cable connection state - NeoCheckConnectState(); - if (keep_link == false) - { - value32 = ctx->Connected ? NdisMediaStateConnected : NdisMediaStateDisconnected; - } - else - { - value32 = NdisMediaStateConnected; - } - break; - - case OID_802_3_XMIT_ONE_COLLISION: - case OID_802_3_XMIT_MORE_COLLISIONS: - // Number of collisions - value32 = 0; - break; - - case OID_GEN_CURRENT_PACKET_FILTER: - // Current settings of the packet filter - value32 = ctx->CurrentPacketFilter; - break; - -/* case OID_GEN_PROTOCOL_OPTIONS: - // Current value of the protocol option - value32 = ctx->CurrentProtocolOptions; - break;*/ - - default: - // Unknown OID - *BytesWritten = 0; - return NDIS_STATUS_INVALID_OID; - } - - if (size > InformationBufferLength) - { - // Undersize - *BytesNeeded = size; - *BytesWritten = 0; - return NDIS_STATUS_INVALID_LENGTH; - } - - // Data copy - NeoCopy(InformationBuffer, buf, size); - *BytesWritten = size; - - return NDIS_STATUS_SUCCESS; -} - -// Set the cable connection state -void NeoSetConnectState(BOOL connected) -{ - if (ctx == NULL) - { - return; - } - ctx->Connected = connected; - NeoCheckConnectState(); -} - -// Check the cable connection state -void NeoCheckConnectState() -{ - if (ctx == NULL || ctx->NdisMiniport == NULL) - { - return; - } - - if (keep_link == false) - { - if (ctx->ConnectedOld != ctx->Connected || ctx->ConnectedForce) - { - ctx->ConnectedForce = FALSE; - ctx->ConnectedOld = ctx->Connected; - if (ctx->Halting == FALSE) - { - NdisMIndicateStatus(ctx->NdisMiniport, - ctx->Connected ? NDIS_STATUS_MEDIA_CONNECT : NDIS_STATUS_MEDIA_DISCONNECT, - 0, 0); - NdisMIndicateStatusComplete(ctx->NdisMiniport); - } - } - } - else - { - if (ctx->ConnectedForce) - { - ctx->ConnectedForce = false; - - if (ctx->Halting == FALSE) - { - NdisMIndicateStatus(ctx->NdisMiniport, - NDIS_STATUS_MEDIA_CONNECT, - 0, 0); - NdisMIndicateStatusComplete(ctx->NdisMiniport); - } - } - } -} - -// Information setting handler of adapter -NDIS_STATUS NeoNdisSet( - NDIS_HANDLE MiniportAdapterContext, - NDIS_OID Oid, - void *InformationBuffer, - ULONG InformationBufferLength, - ULONG *BytesRead, - ULONG *BytesNeeded) -{ - if (ctx == NULL) - { - return STATUS_UNSUCCESSFUL; - } - - // Initialization - *BytesRead = 0; - *BytesNeeded = 0; - - // Branch processing - switch (Oid) - { - case OID_GEN_CURRENT_PACKET_FILTER: - /* Packet filter */ - if (InformationBufferLength != 4) - { - *BytesNeeded = 4; - return NDIS_STATUS_INVALID_LENGTH; - } - *BytesRead = 4; - ctx->CurrentPacketFilter = *((UINT *)InformationBuffer); - return NDIS_STATUS_SUCCESS; - -// case OID_GEN_PROTOCOL_OPTIONS: - /* Current protocol option value */ -/* if (InformationBufferLength != 4) - { - *BytesNeeded = 4; - return NDIS_STATUS_INVALID_LENGTH; - } - *BytesRead = 4; - ctx->CurrentProtocolOptions = *((UINT *)InformationBuffer); - return NDIS_STATUS_SUCCESS;*/ - - case OID_GEN_CURRENT_LOOKAHEAD: - /* Look ahead */ - if (InformationBufferLength != 4) - { - *BytesNeeded = 4; - return NDIS_STATUS_INVALID_LENGTH; - } - *BytesRead = 4; - return NDIS_STATUS_SUCCESS; - - case OID_802_3_MULTICAST_LIST: - // Multicast list - *BytesRead = InformationBufferLength; - - return NDIS_STATUS_SUCCESS; - } - - return NDIS_STATUS_INVALID_OID; -} - -// NDIS 3.0 packet send handler -NDIS_STATUS NeoNdisSend(NDIS_HANDLE MiniportAdapterContext, - NDIS_PACKET *Packet, UINT Flags) -{ - NDIS_PACKET *PacketArray[1]; - PacketArray[0] = Packet; - NeoNdisSendPackets(MiniportAdapterContext, PacketArray, 1); - - return NDIS_STATUS_SUCCESS; -} - -// Packet send handler -void NeoNdisSendPackets(NDIS_HANDLE MiniportAdapterContext, - NDIS_PACKET **PacketArray, - UINT NumberOfPackets) -{ - UCHAR *Buf,*BufCopy; - PNDIS_BUFFER Buffer; - UCHAR *Tmp; - UINT PacketLength; - UINT CurrentLength; - UINT i; - - if (ctx == NULL) - { - return; - } - - // Update the connection state - NeoCheckConnectState(); - - if (NumberOfPackets == 0) - { - // The number of packets is 0 - return; - } - - if (NeoNdisSendPacketsHaltCheck(PacketArray, NumberOfPackets) == FALSE) - { - // Device is stopped - return; - } - - // Operation of the packet queue - NeoLockPacketQueue(); - { - if (NeoNdisSendPacketsHaltCheck(PacketArray, NumberOfPackets) == FALSE) - { - // Device is stopped - NeoUnlockPacketQueue(); - return; - } - - // Place the packet in the queue in order - for (i = 0;i < NumberOfPackets;i++) - { - // Get a packet - NdisQueryPacket(PacketArray[i], NULL, NULL, &Buffer, &PacketLength); - - // Extract the packet. - // Memory allocated here is used for the queue and is released at the time of releasing the queue. - Buf = NeoMalloc(PacketLength); - BufCopy = Buf; - while (Buffer) - { - NdisQueryBuffer(Buffer, &Tmp, &CurrentLength); - if (CurrentLength == 0) - { - // Complete - break; - } - NeoCopy(BufCopy, Tmp, CurrentLength); - BufCopy += CurrentLength; - NdisGetNextBuffer(Buffer, &Buffer); - } - // Process this packet - if (PacketLength > NEO_MIN_PACKET_SIZE) - { - if (PacketLength > NEO_MAX_PACKET_SIZE) - { - // Packet is too large - NDIS_SET_PACKET_STATUS(PacketArray[i], NDIS_STATUS_FAILURE); - - if (g_is_win8) - { - NdisMSendComplete(ctx->NdisMiniport, PacketArray[i], NDIS_STATUS_FAILURE); - } - - ctx->Status.NumPacketSendError++; - NeoFree(Buf); - } - else - { - // Insert the packet into the queue - NeoInsertQueue(Buf, PacketLength); - NDIS_SET_PACKET_STATUS(PacketArray[i], NDIS_STATUS_SUCCESS); - - if (g_is_win8) - { - NdisMSendComplete(ctx->NdisMiniport, PacketArray[i], NDIS_STATUS_SUCCESS); - } - - ctx->Status.NumPacketSend++; - } - } - else - { - // Release if the packet doesn't contain data - NDIS_SET_PACKET_STATUS(PacketArray[i], NDIS_STATUS_SUCCESS); - - if (g_is_win8) - { - NdisMSendComplete(ctx->NdisMiniport, PacketArray[i], NDIS_STATUS_SUCCESS); - } - - NeoFree(Buf); - } - } - } - NeoUnlockPacketQueue(); - - // Reception event - NeoSet(ctx->Event); -} - -// Stop check of packet transmission -BOOL NeoNdisSendPacketsHaltCheck(NDIS_PACKET **PacketArray, UINT NumberOfPackets) -{ - UINT i; - - if (ctx == NULL) - { - return FALSE; - } - - if (ctx->Halting != FALSE || ctx->Opened == FALSE) - { - // Finishing - for (i = 0;i < NumberOfPackets;i++) - { - NDIS_SET_PACKET_STATUS(PacketArray[i], NDIS_STATUS_FAILURE); - - if (g_is_win8) - { - NdisMSendComplete(ctx->NdisMiniport, PacketArray[i], NDIS_STATUS_SUCCESS); - } - - ctx->Status.NumPacketSendError++; - } - return FALSE; - } - return TRUE; -} - -// Initialize the packet array -void NeoInitPacketArray() -{ - UINT i; - // Create a packet buffer - for (i = 0;i < NEO_MAX_PACKET_EXCHANGE;i++) - { - ctx->PacketBuffer[i] = NeoNewPacketBuffer(); - // Store in the array - ctx->PacketBufferArray[i] = ctx->PacketBuffer[i]->NdisPacket; - } -} - -// Release the packet array -void NeoFreePacketArray() -{ - UINT i; - for (i = 0;i < NEO_MAX_PACKET_EXCHANGE;i++) - { - NeoFreePacketBuffer(ctx->PacketBuffer[i]); - ctx->PacketBuffer[i] = NULL; - ctx->PacketBufferArray[i] = NULL; - } -} - -// Release the packet buffer -void NeoFreePacketBuffer(PACKET_BUFFER *p) -{ - // Validate arguments - if (p == NULL) - { - return; - } - - // Detach the buffer from the packet - NdisUnchainBufferAtFront(p->NdisPacket, &p->NdisBuffer); - // Release the packet - NdisFreePacket(p->NdisPacket); - // Release the packet pool - NdisFreePacketPool(p->PacketPool); - // Release the buffer - NdisFreeBuffer(p->NdisBuffer); - // Release the memory - NeoFree(p->Buf); - // Release the buffer pool - NdisFreeBufferPool(p->BufferPool); - // Release the memory - NeoFree(p); -} - -// Create a packet buffer -PACKET_BUFFER *NeoNewPacketBuffer() -{ - PACKET_BUFFER *p; - NDIS_STATUS ret; - - // Memory allocation - p = NeoZeroMalloc(sizeof(PACKET_BUFFER)); - // Memory allocation for packet - p->Buf = NeoMalloc(NEO_MAX_PACKET_SIZE); - // Allocate the buffer pool - NdisAllocateBufferPool(&ret, &p->BufferPool, 1); - // Allocate the buffer - NdisAllocateBuffer(&ret, &p->NdisBuffer, p->BufferPool, p->Buf, NEO_MAX_PACKET_SIZE); - // Secure the packet pool - NdisAllocatePacketPool(&ret, &p->PacketPool, 1, PROTOCOL_RESERVED_SIZE_IN_PACKET); - // Secure the packet - NdisAllocatePacket(&ret, &p->NdisPacket, p->PacketPool); - NDIS_SET_PACKET_HEADER_SIZE(p->NdisPacket, NEO_PACKET_HEADER_SIZE); - // Attach the buffer to the packet - NdisChainBufferAtFront(p->NdisPacket, p->NdisBuffer); - - return p; -} - -// Reset the event -void NeoReset(NEO_EVENT *event) -{ - // Validate arguments - if (event == NULL) - { - return; - } - -#ifndef WIN9X - KeResetEvent(event->event); -#else // WIN9X - if (event->win32_event != 0) - { - DWORD h = event->win32_event; - _asm mov eax, h; - VxDCall(_VWIN32_ResetWin32Event); - } -#endif // WIN9X -} - -// Set the event -void NeoSet(NEO_EVENT *event) -{ - // Validate arguments - if (event == NULL) - { - return; - } - -#ifndef WIN9X - KeSetEvent(event->event, 0, FALSE); -#else // WIN9X - if (event->win32_event != 0) - { - DWORD h = event->win32_event; - _asm mov eax, h; - VxDCall(_VWIN32_SetWin32Event); - } -#endif // WIN9X -} - -// Release the event -void NeoFreeEvent(NEO_EVENT *event) -{ - // Validate arguments - if (event == NULL) - { - return; - } - -#ifdef WIN9X - if (0) - { - if (event->win32_event != 0) - { - DWORD h = event->win32_event; - _asm mov eax, h; - VxDCall(_VWIN32_CloseVxDHandle); - } - } -#endif WIN9X - - ZwClose(event->event_handle); - - // Release the memory - NeoFree(event); -} - -// Create a new event -#ifndef WIN9X -NEO_EVENT *NeoNewEvent(char *name) -{ - UNICODE *unicode_name; - NEO_EVENT *event; - // Validate arguments - if (name == NULL) - { - return NULL; - } - - // Convert the name to Unicode - unicode_name = NewUnicode(name); - if (unicode_name == NULL) - { - return NULL; - } - - // Memory allocation - event = NeoZeroMalloc(sizeof(NEO_EVENT)); - if (event == NULL) - { - FreeUnicode(unicode_name); - return NULL; - } - - // Create an Event - event->event = IoCreateNotificationEvent(GetUnicode(unicode_name), &event->event_handle); - if (event->event == NULL) - { - NeoFree(event); - FreeUnicode(unicode_name); - return NULL; - } - - // Initialize the event - KeInitializeEvent(event->event, NotificationEvent, FALSE); - KeClearEvent(event->event); - - // Release a string - FreeUnicode(unicode_name); - - return event; -} -#else // WIN9X -NEO_EVENT *NeoCreateWin9xEvent(DWORD h) -{ - NEO_EVENT *event; - // Validate arguments - if (h == NULL) - { - return NULL; - } - - // Memory allocation - event = NeoZeroMalloc(sizeof(NEO_EVENT)); - if (event == NULL) - { - return NULL; - } - - event->win32_event = h; - - return event; -} -#endif // WIN9X - -// Get the Unicode string -NDIS_STRING *GetUnicode(UNICODE *u) -{ - // Validate arguments - if (u == NULL) - { - return NULL; - } - - return &u->String; -} - -// Release the Unicode strings -void FreeUnicode(UNICODE *u) -{ - // Validate arguments - if (u == NULL) - { - return; - } - - // Release a string - NdisFreeString(u->String); - - // Release the memory - NeoFree(u); -} - -// Create a new Unicode string -UNICODE *NewUnicode(char *str) -{ - UNICODE *u; - // Validate arguments - if (str == NULL) - { - return NULL; - } - - // Memory allocation - u = NeoZeroMalloc(sizeof(UNICODE)); - if (u == NULL) - { - return NULL; - } - - // String initialization - _NdisInitializeString(&u->String, str); - - return u; -} - -// Release the lock -void NeoFreeLock(NEO_LOCK *lock) -{ - NDIS_SPIN_LOCK *spin_lock; - // Validate arguments - if (lock == NULL) - { - return; - } - - spin_lock = &lock->spin_lock; - NdisFreeSpinLock(spin_lock); - - // Release the memory - NeoFree(lock); -} - -// Unlock -void NeoUnlock(NEO_LOCK *lock) -{ - NDIS_SPIN_LOCK *spin_lock; - // Validate arguments - if (lock == NULL) - { - return; - } - - spin_lock = &lock->spin_lock; - NdisReleaseSpinLock(spin_lock); -} - -// Lock -void NeoLock(NEO_LOCK *lock) -{ - NDIS_SPIN_LOCK *spin_lock; - // Validate arguments - if (lock == NULL) - { - return; - } - - spin_lock = &lock->spin_lock; - NdisAcquireSpinLock(spin_lock); -} - -// Create a new lock -NEO_LOCK *NeoNewLock() -{ - NDIS_SPIN_LOCK *spin_lock; - - // Memory allocation - NEO_LOCK *lock = NeoZeroMalloc(sizeof(NEO_LOCK)); - if (lock == NULL) - { - return NULL; - } - - // Initialize spin lock - spin_lock = &lock->spin_lock; - - NdisAllocateSpinLock(spin_lock); - - return lock; -} - -// Memory copy -void NeoCopy(void *dst, void *src, UINT size) -{ - // Validate arguments - if (dst == NULL || src == NULL || size == 0) - { - return; - } - - // Copy - NdisMoveMemory(dst, src, size); -} - -// Memory clear -void NeoZero(void *dst, UINT size) -{ - // Validate arguments - if (dst == NULL || size == 0) - { - return; - } - - // Clear - NdisZeroMemory(dst, size); -} - -// Clear to zero by memory allocation -void *NeoZeroMalloc(UINT size) -{ - void *p = NeoMalloc(size); - if (p == NULL) - { - // Memory allocation failure - return NULL; - } - // Clear to zero - NeoZero(p, size); - return p; -} - -// Memory allocation -void *NeoMalloc(UINT size) -{ - NDIS_STATUS r; - void *p; - if (size == 0) - { - size = 1; - } - - // Allocate the non-paged memory - r = NdisAllocateMemoryWithTag(&p, size, 'SETH'); - - if (NG(r)) - { - return NULL; - } - return p; -} - -// Release the memory -void NeoFree(void *p) -{ - // Validate arguments - if (p == NULL) - { - return; - } - - // Release the memory - NdisFreeMemory(p, 0, 0); -} - - +// SoftEther VPN Source Code - Developer Edition Master Branch +// Kernel Device Driver + + +// NDIS5.c +// Description: Windows NDIS 5.0 Routine + +#include + +#define NEO_DEVICE_DRIVER + +#include "Neo.h" + +static UINT max_speed = NEO_MAX_SPEED_DEFAULT; +static bool keep_link = false; + +BOOLEAN +PsGetVersion( + PULONG MajorVersion OPTIONAL, + PULONG MinorVersion OPTIONAL, + PULONG BuildNumber OPTIONAL, + PUNICODE_STRING CSDVersion OPTIONAL + ); + +// Memory related +static NDIS_PHYSICAL_ADDRESS HighestAcceptableMax = NDIS_PHYSICAL_ADDRESS_CONST(-1, -1); +NDIS_HANDLE ndis_wrapper_handle = NULL; + +// Whether Windows 8 +bool g_is_win8 = false; + +// Win32 driver entry point +NDIS_STATUS DriverEntry(DRIVER_OBJECT *DriverObject, UNICODE_STRING *RegistryPath) +{ + NDIS_MINIPORT_CHARACTERISTICS miniport; + ULONG os_major_ver = 0, os_minor_ver = 0; + + // Initialize the Neo library + if (NeoInit() == FALSE) + { + // Initialization Failed + return STATUS_UNSUCCESSFUL; + } + + g_is_win8 = false; + +#ifndef NDIS30_MINIPORT + // Get the OS version + PsGetVersion(&os_major_ver, &os_minor_ver, NULL, NULL); + + if (os_major_ver >= 7 || (os_major_ver == 6 && os_minor_ver >= 2)) + { + // Windows 8 + g_is_win8 = true; + } +#endif // NDIS30_MINIPORT + + // Initialize the NDIS wrapper + NdisMInitializeWrapper(&ctx->NdisWrapper, DriverObject, RegistryPath, NULL); + ndis_wrapper_handle = ctx->NdisWrapper; + + // Register a NDIS miniport driver + NeoZero(&miniport, sizeof(NDIS_MINIPORT_CHARACTERISTICS)); + miniport.MajorNdisVersion = NEO_NDIS_MAJOR_VERSION; + miniport.MinorNdisVersion = NEO_NDIS_MINOR_VERSION; + + // Register the handler + miniport.InitializeHandler = NeoNdisInit; + miniport.HaltHandler = NeoNdisHalt; + miniport.QueryInformationHandler = NeoNdisQuery; + miniport.ResetHandler = NeoNdisReset; + miniport.SetInformationHandler = NeoNdisSet; + +#ifndef NDIS30_MINIPORT + miniport.SendPacketsHandler = NeoNdisSendPackets; +#else // NDIS30_MINIPORT + miniport.SendHandler = NULL; +#endif // NDIS30_MINIPORT + + if (NG(NdisMRegisterMiniport(ctx->NdisWrapper, &miniport, sizeof(NDIS_MINIPORT_CHARACTERISTICS)))) + { + // Registration failure + return STATUS_UNSUCCESSFUL; + } + + // Initialization success + return STATUS_SUCCESS; +} + +// Initialization handler of adapter +NDIS_STATUS NeoNdisInit(NDIS_STATUS *OpenErrorStatus, + UINT *SelectedMediumIndex, + NDIS_MEDIUM *MediumArray, + UINT MediumArraySize, + NDIS_HANDLE MiniportAdapterHandle, + NDIS_HANDLE WrapperConfigurationContext) +{ + BOOL media_check; + UINT i; + + if (ctx == NULL) + { + return NDIS_STATUS_FAILURE; + } + + if (ctx->NdisWrapper == NULL) + { + ctx->NdisWrapper = ndis_wrapper_handle; + } + + // Prevention of multiple start + if (ctx->Initing != FALSE) + { + // Multiple started + return NDIS_STATUS_FAILURE; + } + ctx->Initing = TRUE; + + // Examine whether it has already been initialized + if (ctx->Inited != FALSE) + { + // Driver is started on another instance already. + // PacketiX VPN driver can start only one instance per one service. + // User can start multiple drivers with different instance ID + return NDIS_STATUS_FAILURE; + } + + // Current value of the packet filter + ctx->CurrentPacketFilter = NDIS_PACKET_TYPE_ALL_LOCAL | NDIS_PACKET_TYPE_BROADCAST | NDIS_PACKET_TYPE_DIRECTED | NDIS_PACKET_TYPE_ALL_FUNCTIONAL; + + // Examine whether the Ethernet is available + media_check = FALSE; + for (i = 0;i < MediumArraySize;i++) + { + if (MediumArray[i] == NEO_MEDIA) + { + media_check = TRUE; + break; + } + } + if (media_check == FALSE) + { + // Ethernet is unavailable + ctx->Initing = FALSE; + return NDIS_STATUS_FAILURE; + } + + // Media number to use + *SelectedMediumIndex = i; + + // Initialize the adapter information + ctx->NdisMiniport = MiniportAdapterHandle; + ctx->NdisConfig = WrapperConfigurationContext; + ctx->NdisContext = ctx; + ctx->HardwareStatus = NdisHardwareStatusReady; + ctx->Halting = FALSE; + ctx->Connected = ctx->ConnectedOld = FALSE; + + if (keep_link == false) + { + ctx->ConnectedForce = TRUE; + } + + // Read the information from the registry + if (NeoLoadRegistry() == FALSE) + { + // Failure + ctx->Initing = FALSE; + return NDIS_STATUS_FAILURE; + } + + // Register the device attributes + + if (g_is_win8 == false) + { + NdisMSetAttributes(ctx->NdisMiniport, ctx->NdisContext, FALSE, NdisInterfaceInternal); + } + else + { + NdisMSetAttributesEx(ctx->NdisMiniport, ctx->NdisContext, 16, + NDIS_ATTRIBUTE_DESERIALIZE | NDIS_ATTRIBUTE_IGNORE_PACKET_TIMEOUT | NDIS_ATTRIBUTE_IGNORE_REQUEST_TIMEOUT | NDIS_ATTRIBUTE_NO_HALT_ON_SUSPEND, + NdisInterfaceInternal); + } + + // Initialize the received packet array + NeoInitPacketArray(); + + // Initialize the control device + NeoInitControlDevice(); + + // Start the adapter + NeoStartAdapter(); + + // Flag setting + ctx->Initing = FALSE; + ctx->Inited = TRUE; + + // Notify the connection state + NeoSetConnectState(FALSE); + + return NDIS_STATUS_SUCCESS; +} + +// Open the device +BOOL NeoNdisOnOpen(IRP *irp, IO_STACK_LOCATION *stack) +{ + char name[MAX_SIZE]; + + if (ctx == NULL) + { + return FALSE; + } + + if (ctx->Opened != FALSE) + { + // Another client is connected already + return FALSE; + } + ctx->Opened = TRUE; + + // Initialize the event name + sprintf(name, NDIS_NEO_EVENT_NAME, ctx->HardwareID); + + // Register a Event +#ifndef WIN9X + ctx->Event = NeoNewEvent(name); + if (ctx->Event == NULL) + { + ctx->Opened = FALSE; + return FALSE; + } +#endif // WIN9X + + // Set the connection state + NeoSetConnectState(TRUE); + + return TRUE; +} + +// Close the device +BOOL NeoNdisOnClose(IRP *irp, IO_STACK_LOCATION *stack) +{ + if (ctx == NULL) + { + return FALSE; + } + + if (ctx->Opened == FALSE) + { + // Client is not connected + return FALSE; + } + ctx->Opened = FALSE; + + // Release the event + NeoFreeEvent(ctx->Event); + ctx->Event = NULL; + + // Release all packets + NeoClearPacketQueue(); + + NeoSetConnectState(FALSE); + + return TRUE; +} + +// Crash +void NeoNdisCrash() +{ + NEO_QUEUE *q; + q = (NEO_QUEUE *)0xACACACAC; + q->Size = 128; + NeoCopy(q->Buf, "ABCDEFG", 8); +} + +// Dispatch table for control +NTSTATUS NeoNdisDispatch(DEVICE_OBJECT *DeviceObject, IRP *Irp) +{ + NTSTATUS status; + IO_STACK_LOCATION *stack; + void *buf; + BOOL ok; + status = STATUS_SUCCESS; + + if (ctx == NULL) + { + return NDIS_STATUS_FAILURE; + } + + // Get the IRP stack + stack = IoGetCurrentIrpStackLocation(Irp); + + // Initialize the number of bytes + Irp->IoStatus.Information = 0; + Irp->IoStatus.Status = STATUS_SUCCESS; + + buf = Irp->UserBuffer; + + if (ctx->Halting != FALSE) + { + // Device driver is terminating + Irp->IoStatus.Information = STATUS_UNSUCCESSFUL; + IoCompleteRequest(Irp, IO_NO_INCREMENT); + return STATUS_UNSUCCESSFUL; + } + + // Branch to each operation + switch (stack->MajorFunction) + { + case IRP_MJ_CREATE: + // Device is opened + if (NeoNdisOnOpen(Irp, stack) == FALSE) + { + Irp->IoStatus.Status = STATUS_UNSUCCESSFUL; + status = STATUS_UNSUCCESSFUL; + } + break; + + case IRP_MJ_CLOSE: + // Device is closed + if (NeoNdisOnClose(Irp, stack) == FALSE) + { + Irp->IoStatus.Status = STATUS_UNSUCCESSFUL; + status = STATUS_UNSUCCESSFUL; + } + break; + + case IRP_MJ_READ: +#ifndef WIN9X + // Read (Reading of the received packet) + ok = false; + if (buf != NULL) + { + if (ctx->Opened && ctx->Inited) + { + if (stack->Parameters.Read.Length == NEO_EXCHANGE_BUFFER_SIZE) + { + // Address check + bool check_ok = true; + __try + { + ProbeForWrite(buf, NEO_EXCHANGE_BUFFER_SIZE, 1); + } + __except (EXCEPTION_EXECUTE_HANDLER) + { + check_ok = false; + } + + if (check_ok) + { + MDL *mdl = IoAllocateMdl(buf, NEO_EXCHANGE_BUFFER_SIZE, false, false, NULL); + + if (mdl != NULL) + { + MmProbeAndLockPages(mdl, KernelMode, IoWriteAccess); + } + + + // Read + NeoRead(buf); + Irp->IoStatus.Information = NEO_EXCHANGE_BUFFER_SIZE; + ok = true; + + if (mdl != NULL) + { + MmUnlockPages(mdl); + IoFreeMdl(mdl); + } + } + } + } + } + if (ok == FALSE) + { + // An error occurred + Irp->IoStatus.Status = STATUS_UNSUCCESSFUL; + status = STATUS_UNSUCCESSFUL; + } +#endif // WIN9X + break; + + case IRP_MJ_WRITE: +#ifndef WIN9X + // Write (Writing of a transmission packet) + ok = false; + if (buf != NULL) + { + if (ctx->Opened && ctx->Inited) + { + if (stack->Parameters.Write.Length == NEO_EXCHANGE_BUFFER_SIZE) + { + // Address check + bool check_ok = true; + __try + { + ProbeForRead(buf, NEO_EXCHANGE_BUFFER_SIZE, 1); + } + __except (EXCEPTION_EXECUTE_HANDLER) + { + check_ok = false; + } + + if (check_ok) + { + MDL *mdl = IoAllocateMdl(buf, NEO_EXCHANGE_BUFFER_SIZE, false, false, NULL); + + if (mdl != NULL) + { + MmProbeAndLockPages(mdl, KernelMode, IoReadAccess); + } + + ProbeForRead(buf, NEO_EXCHANGE_BUFFER_SIZE, 1); + + // Write + NeoWrite(buf); + Irp->IoStatus.Information = stack->Parameters.Write.Length; + ok = true; + + if (mdl != NULL) + { + MmUnlockPages(mdl); + IoFreeMdl(mdl); + } + } + } + } + } + if (ok == FALSE) + { + // An error occurred + Irp->IoStatus.Status = STATUS_UNSUCCESSFUL; + status = STATUS_UNSUCCESSFUL; + } + break; +#endif // WIN9X + case IRP_MJ_DEVICE_CONTROL: +#ifdef WIN9X + // IO Control + switch (stack->Parameters.DeviceIoControl.IoControlCode) + { + case NEO_IOCTL_SET_EVENT: + // Specify a event + if (Irp->AssociatedIrp.SystemBuffer == NULL || + stack->Parameters.DeviceIoControl.InputBufferLength != sizeof(DWORD)) + { + // An error occurred + Irp->IoStatus.Status = STATUS_UNSUCCESSFUL; + } + else + { + DWORD value = *((DWORD *)Irp->AssociatedIrp.SystemBuffer); + ctx->Event = NeoCreateWin9xEvent(value); + Irp->IoStatus.Information = sizeof(DWORD); + } + break; + + case NEO_IOCTL_PUT_PACKET: + // Write a packet + ok = false; + buf = Irp->AssociatedIrp.SystemBuffer; + if (buf != NULL) + { + if (stack->Parameters.DeviceIoControl.InputBufferLength == NEO_EXCHANGE_BUFFER_SIZE) + { + // Write + NeoWrite(buf); + Irp->IoStatus.Information = NEO_EXCHANGE_BUFFER_SIZE; + ok = true; + } + } + + if (ok == false) + { + // An error occurred + Irp->IoStatus.Status = STATUS_UNSUCCESSFUL; + status = STATUS_UNSUCCESSFUL; + } + break; + + case NEO_IOCTL_GET_PACKET: + // Get the packet + ok = false; + buf = Irp->AssociatedIrp.SystemBuffer; + if (buf != NULL) + { + if (stack->Parameters.DeviceIoControl.OutputBufferLength == NEO_EXCHANGE_BUFFER_SIZE) + { + // Read + NeoRead(buf); + Irp->IoStatus.Information = NEO_EXCHANGE_BUFFER_SIZE; + ok = true; + } + } + + if (ok == false) + { + // An error occurred + Irp->IoStatus.Status = STATUS_UNSUCCESSFUL; + status = STATUS_UNSUCCESSFUL; + } + break; + } +#endif // WIN9X + break; + } + + IoCompleteRequest(Irp, IO_NO_INCREMENT); + + return STATUS_SUCCESS; +} + +// Initialize the control device +void NeoInitControlDevice() +{ + char name_kernel[MAX_SIZE]; + char name_win32[MAX_SIZE]; + UNICODE *unicode_kernel, *unicode_win32; + DEVICE_OBJECT *control_device_object; + NDIS_HANDLE ndis_control_handle; + + if (ctx == NULL) + { + return; + } + + // Initialize the dispatch table + NeoZero(ctx->DispatchTable, sizeof(PDRIVER_DISPATCH) * IRP_MJ_MAXIMUM_FUNCTION); + + // Register the handler + ctx->DispatchTable[IRP_MJ_CREATE] = + ctx->DispatchTable[IRP_MJ_CLOSE] = + ctx->DispatchTable[IRP_MJ_READ] = + ctx->DispatchTable[IRP_MJ_WRITE] = + ctx->DispatchTable[IRP_MJ_DEVICE_CONTROL] = NeoNdisDispatch; + ctx->Opened = FALSE; + + // Generate the device name + sprintf(name_kernel, NDIS_NEO_DEVICE_NAME, ctx->HardwareID); + unicode_kernel = NewUnicode(name_kernel); + sprintf(name_win32, NDIS_NEO_DEVICE_NAME_WIN32, ctx->HardwareID); + unicode_win32 = NewUnicode(name_win32); + + // Register the Device + NdisMRegisterDevice(ctx->NdisWrapper, GetUnicode(unicode_kernel), + GetUnicode(unicode_win32), ctx->DispatchTable, + &control_device_object, + &ndis_control_handle); + + ctx->NdisControlDevice = control_device_object; + ctx->NdisControl = ndis_control_handle; + + // Initialize the display name + if (strlen(ctx->HardwareID) > 11) + { + sprintf(ctx->HardwarePrintableID, NDIS_NEO_HARDWARE_ID, ctx->HardwareID_Raw + 11); + } + else + { + sprintf(ctx->HardwarePrintableID, NDIS_NEO_HARDWARE_ID, ctx->HardwareID_Raw); + } +} + +// Release the control device +void NeoFreeControlDevice() +{ + if (ctx == NULL) + { + return; + } + + if (ctx->Opened != FALSE) + { + // Delete the event + NeoSet(ctx->Event); + NeoFreeEvent(ctx->Event); + ctx->Event = NULL; + ctx->Opened = FALSE; + } + // Delete the device + NdisMDeregisterDevice(ctx->NdisControl); +} + + +// Read the information from the registry +BOOL NeoLoadRegistry() +{ + void *buf; + NDIS_STATUS ret; + UINT size; + NDIS_HANDLE config; + NDIS_CONFIGURATION_PARAMETER *param; + UNICODE *name; + ANSI_STRING ansi; + UNICODE_STRING *unicode; + UINT speed; + BOOL keep; + + // Get the config handle + NdisOpenConfiguration(&ret, &config, ctx->NdisConfig); + if (NG(ret)) + { + // Failure + return FALSE; + } + + // Read the MAC address + NdisReadNetworkAddress(&ret, &buf, &size, config); + if (NG(ret)) + { + // Failure + NdisCloseConfiguration(config); + return FALSE; + } + + // Copy the MAC address + if (size != NEO_MAC_ADDRESS_SIZE) + { + // Invalid size + NdisCloseConfiguration(config); + return FALSE; + } + NeoCopy(ctx->MacAddress, buf, NEO_MAC_ADDRESS_SIZE); + + if (ctx->MacAddress[0] == 0x00 && + ctx->MacAddress[1] == 0x00 && + ctx->MacAddress[2] == 0x01 && + ctx->MacAddress[3] == 0x00 && + ctx->MacAddress[4] == 0x00 && + ctx->MacAddress[5] == 0x01) + { + // Special MAC address + UINT ptr32 = (UINT)((UINT64)ctx); + + ctx->MacAddress[0] = 0x00; + ctx->MacAddress[1] = 0xAD; + ctx->MacAddress[2] = ((UCHAR *)(&ptr32))[0]; + ctx->MacAddress[3] = ((UCHAR *)(&ptr32))[1]; + ctx->MacAddress[4] = ((UCHAR *)(&ptr32))[2]; + ctx->MacAddress[5] = ((UCHAR *)(&ptr32))[3]; + } + + // Initialize the key name of the device name + name = NewUnicode("MatchingDeviceId"); + + // Read the hardware ID + NdisReadConfiguration(&ret, ¶m, config, GetUnicode(name), NdisParameterString); + FreeUnicode(name); + if (NG(ret)) + { + // Failure + NdisCloseConfiguration(config); + return FALSE; + } + // Type checking + if (param->ParameterType != NdisParameterString) + { + // Failure + NdisCloseConfiguration(config); + return FALSE; + } + unicode = ¶m->ParameterData.StringData; + + // Prepare a buffer for ANSI string + NeoZero(&ansi, sizeof(ANSI_STRING)); + ansi.MaximumLength = MAX_SIZE - 1; + ansi.Buffer = NeoZeroMalloc(MAX_SIZE); + + // Convert to ANSI string + NdisUnicodeStringToAnsiString(&ansi, unicode); + // Copy + strcpy(ctx->HardwareID, ansi.Buffer); + strcpy(ctx->HardwareID_Raw, ctx->HardwareID); + // Convert to upper case + _strupr(ctx->HardwareID); + // Release the memory + NeoFree(ansi.Buffer); + + // Read the bit rate + name = NewUnicode("MaxSpeed"); + NdisReadConfiguration(&ret, ¶m, config, GetUnicode(name), NdisParameterInteger); + FreeUnicode(name); + + if (NG(ret) || param->ParameterType != NdisParameterInteger) + { + speed = NEO_MAX_SPEED_DEFAULT; + } + else + { + speed = param->ParameterData.IntegerData * 10000; + } + + max_speed = speed; + + // Read the link keeping flag + name = NewUnicode("KeepLink"); + NdisReadConfiguration(&ret, ¶m, config, GetUnicode(name), NdisParameterInteger); + FreeUnicode(name); + + if (NG(ret) || param->ParameterType != NdisParameterInteger) + { + keep = false; + } + else + { + keep = (param->ParameterData.IntegerData == 0 ? false : true); + } + + keep_link = keep; + + // Close the Config handle + NdisCloseConfiguration(config); + + return TRUE; +} + +// Stop handler of adapter +NDIS_STATUS NeoNdisHalt(NDIS_HANDLE MiniportAdapterContext) +{ + if (ctx == NULL) + { + return NDIS_STATUS_FAILURE; + } + + if (ctx->Halting != FALSE) + { + // That has already been stopped + return NDIS_STATUS_SUCCESS; + } + ctx->Halting = TRUE; + + // Stop the adapter + NeoStopAdapter(); + + // Release the packet array + NeoFreePacketArray(); + + // Delete the control device + NeoFreeControlDevice(); + + // Complete to stop + ctx->Initing = ctx->Inited = FALSE; + ctx->Connected = ctx->ConnectedForce = ctx->ConnectedOld = FALSE; + ctx->Halting = FALSE; + + // Shutdown of Neo + NeoShutdown(); + + return NDIS_STATUS_SUCCESS; +} + +// Reset handler of adapter +NDIS_STATUS NeoNdisReset(BOOLEAN *AddressingReset, NDIS_HANDLE MiniportAdapterContext) +{ + NdisMResetComplete(ctx->NdisMiniport, NDIS_STATUS_SUCCESS, FALSE); + return NDIS_STATUS_SUCCESS; +} + +// Information acquisition handler of adapter +NDIS_STATUS NeoNdisQuery(NDIS_HANDLE MiniportAdapterContext, + NDIS_OID Oid, + void *InformationBuffer, + ULONG InformationBufferLength, + ULONG *BytesWritten, + ULONG *BytesNeeded) +{ + NDIS_MEDIUM media; + void *buf; + UINT value32; + USHORT value16; + UINT size; + + if (ctx == NULL) + { + return NDIS_STATUS_FAILURE; + } + + // Initialization + size = sizeof(UINT); + value32 = value16 = 0; + buf = &value32; + + // Branch processing + switch (Oid) + { + case OID_GEN_SUPPORTED_LIST: + // Return a list of supported OID + buf = SupportedOids; + size = sizeof(SupportedOids); + break; + + case OID_GEN_MAC_OPTIONS: + // Ethernet option + value32 = NDIS_MAC_OPTION_TRANSFERS_NOT_PEND | NDIS_MAC_OPTION_RECEIVE_SERIALIZED | + NDIS_MAC_OPTION_COPY_LOOKAHEAD_DATA | NDIS_MAC_OPTION_NO_LOOPBACK; + break; + + case OID_GEN_HARDWARE_STATUS: + // Hardware state + buf = &ctx->HardwareStatus; + size = sizeof(NDIS_HARDWARE_STATUS); + break; + + case OID_GEN_MEDIA_SUPPORTED: + case OID_GEN_MEDIA_IN_USE: + // Type of media + media = NdisMedium802_3; + buf = &media; + size = sizeof(NDIS_MEDIUM); + break; + + case OID_GEN_CURRENT_LOOKAHEAD: + case OID_GEN_MAXIMUM_LOOKAHEAD: + // Available look-ahead size + value32 = NEO_MAX_PACKET_SIZE_ANNOUNCE - NEO_MIN_PACKET_SIZE; + break; + + case OID_GEN_MAXIMUM_FRAME_SIZE: + // Maximum frame size + value32 = NEO_MAX_PACKET_SIZE_ANNOUNCE - NEO_MIN_PACKET_SIZE; + break; + + case OID_GEN_MAXIMUM_TOTAL_SIZE: + case OID_GEN_TRANSMIT_BLOCK_SIZE: + case OID_GEN_RECEIVE_BLOCK_SIZE: + // Maximum packet size + value32 = NEO_MAX_PACKET_SIZE_ANNOUNCE; + break; + + case OID_GEN_TRANSMIT_BUFFER_SPACE: + case OID_GEN_RECEIVE_BUFFER_SPACE: + // Buffer size + value32 = NEO_MAX_PACKET_SIZE_ANNOUNCE * NEO_MAX_PACKET_EXCHANGE; + break; + + case OID_GEN_LINK_SPEED: + // Communication speed + value32 = max_speed; + break; + + case OID_GEN_VENDOR_ID: + // Vendor ID + NeoCopy(&value32, ctx->MacAddress, 3); + value32 &= 0xFFFFFF00; + value32 |= 0x01; + break; + + case OID_GEN_VENDOR_DESCRIPTION: + // Hardware ID + buf = ctx->HardwarePrintableID; + size = (UINT)strlen(ctx->HardwarePrintableID) + 1; + break; + + case OID_GEN_DRIVER_VERSION: + // Driver version + value16 = ((USHORT)NEO_NDIS_MAJOR_VERSION << 8) | NEO_NDIS_MINOR_VERSION; + buf = &value16; + size = sizeof(USHORT); + break; + + case OID_GEN_VENDOR_DRIVER_VERSION: + // Vendor driver version + value16 = ((USHORT)NEO_NDIS_MAJOR_VERSION << 8) | NEO_NDIS_MINOR_VERSION; + buf = &value16; + size = sizeof(USHORT); + break; + + case OID_802_3_PERMANENT_ADDRESS: + case OID_802_3_CURRENT_ADDRESS: + // MAC address + buf = ctx->MacAddress; + size = NEO_MAC_ADDRESS_SIZE; + break; + + case OID_802_3_MAXIMUM_LIST_SIZE: + // Number of multicast + value32 = NEO_MAX_MULTICASE; + break; + + case OID_GEN_MAXIMUM_SEND_PACKETS: + // Number of packets that can be sent at a time + value32 = NEO_MAX_PACKET_EXCHANGE; + break; + + case OID_GEN_XMIT_OK: + // Number of packets sent + value32 = ctx->Status.NumPacketSend; + break; + + case OID_GEN_RCV_OK: + // Number of received packets + value32 = ctx->Status.NumPacketRecv; + break; + + case OID_GEN_XMIT_ERROR: + // Number of transmission error packets + value32 = ctx->Status.NumPacketSendError; + break; + + case OID_GEN_RCV_ERROR: + // Number of error packets received + value32 = ctx->Status.NumPacketRecvError; + break; + + case OID_GEN_RCV_NO_BUFFER: + // Number of reception buffer shortage occurrences + value32 = ctx->Status.NumPacketRecvNoBuffer; + break; + + case OID_802_3_RCV_ERROR_ALIGNMENT: + // Number of errors + value32 = 0; + break; + + case OID_GEN_MEDIA_CONNECT_STATUS: + // Cable connection state + NeoCheckConnectState(); + if (keep_link == false) + { + value32 = ctx->Connected ? NdisMediaStateConnected : NdisMediaStateDisconnected; + } + else + { + value32 = NdisMediaStateConnected; + } + break; + + case OID_802_3_XMIT_ONE_COLLISION: + case OID_802_3_XMIT_MORE_COLLISIONS: + // Number of collisions + value32 = 0; + break; + + case OID_GEN_CURRENT_PACKET_FILTER: + // Current settings of the packet filter + value32 = ctx->CurrentPacketFilter; + break; + +/* case OID_GEN_PROTOCOL_OPTIONS: + // Current value of the protocol option + value32 = ctx->CurrentProtocolOptions; + break;*/ + + default: + // Unknown OID + *BytesWritten = 0; + return NDIS_STATUS_INVALID_OID; + } + + if (size > InformationBufferLength) + { + // Undersize + *BytesNeeded = size; + *BytesWritten = 0; + return NDIS_STATUS_INVALID_LENGTH; + } + + // Data copy + NeoCopy(InformationBuffer, buf, size); + *BytesWritten = size; + + return NDIS_STATUS_SUCCESS; +} + +// Set the cable connection state +void NeoSetConnectState(BOOL connected) +{ + if (ctx == NULL) + { + return; + } + ctx->Connected = connected; + NeoCheckConnectState(); +} + +// Check the cable connection state +void NeoCheckConnectState() +{ + if (ctx == NULL || ctx->NdisMiniport == NULL) + { + return; + } + + if (keep_link == false) + { + if (ctx->ConnectedOld != ctx->Connected || ctx->ConnectedForce) + { + ctx->ConnectedForce = FALSE; + ctx->ConnectedOld = ctx->Connected; + if (ctx->Halting == FALSE) + { + NdisMIndicateStatus(ctx->NdisMiniport, + ctx->Connected ? NDIS_STATUS_MEDIA_CONNECT : NDIS_STATUS_MEDIA_DISCONNECT, + 0, 0); + NdisMIndicateStatusComplete(ctx->NdisMiniport); + } + } + } + else + { + if (ctx->ConnectedForce) + { + ctx->ConnectedForce = false; + + if (ctx->Halting == FALSE) + { + NdisMIndicateStatus(ctx->NdisMiniport, + NDIS_STATUS_MEDIA_CONNECT, + 0, 0); + NdisMIndicateStatusComplete(ctx->NdisMiniport); + } + } + } +} + +// Information setting handler of adapter +NDIS_STATUS NeoNdisSet( + NDIS_HANDLE MiniportAdapterContext, + NDIS_OID Oid, + void *InformationBuffer, + ULONG InformationBufferLength, + ULONG *BytesRead, + ULONG *BytesNeeded) +{ + if (ctx == NULL) + { + return STATUS_UNSUCCESSFUL; + } + + // Initialization + *BytesRead = 0; + *BytesNeeded = 0; + + // Branch processing + switch (Oid) + { + case OID_GEN_CURRENT_PACKET_FILTER: + /* Packet filter */ + if (InformationBufferLength != 4) + { + *BytesNeeded = 4; + return NDIS_STATUS_INVALID_LENGTH; + } + *BytesRead = 4; + ctx->CurrentPacketFilter = *((UINT *)InformationBuffer); + return NDIS_STATUS_SUCCESS; + +// case OID_GEN_PROTOCOL_OPTIONS: + /* Current protocol option value */ +/* if (InformationBufferLength != 4) + { + *BytesNeeded = 4; + return NDIS_STATUS_INVALID_LENGTH; + } + *BytesRead = 4; + ctx->CurrentProtocolOptions = *((UINT *)InformationBuffer); + return NDIS_STATUS_SUCCESS;*/ + + case OID_GEN_CURRENT_LOOKAHEAD: + /* Look ahead */ + if (InformationBufferLength != 4) + { + *BytesNeeded = 4; + return NDIS_STATUS_INVALID_LENGTH; + } + *BytesRead = 4; + return NDIS_STATUS_SUCCESS; + + case OID_802_3_MULTICAST_LIST: + // Multicast list + *BytesRead = InformationBufferLength; + + return NDIS_STATUS_SUCCESS; + } + + return NDIS_STATUS_INVALID_OID; +} + +// NDIS 3.0 packet send handler +NDIS_STATUS NeoNdisSend(NDIS_HANDLE MiniportAdapterContext, + NDIS_PACKET *Packet, UINT Flags) +{ + NDIS_PACKET *PacketArray[1]; + PacketArray[0] = Packet; + NeoNdisSendPackets(MiniportAdapterContext, PacketArray, 1); + + return NDIS_STATUS_SUCCESS; +} + +// Packet send handler +void NeoNdisSendPackets(NDIS_HANDLE MiniportAdapterContext, + NDIS_PACKET **PacketArray, + UINT NumberOfPackets) +{ + UCHAR *Buf,*BufCopy; + PNDIS_BUFFER Buffer; + UCHAR *Tmp; + UINT PacketLength; + UINT CurrentLength; + UINT i; + + if (ctx == NULL) + { + return; + } + + // Update the connection state + NeoCheckConnectState(); + + if (NumberOfPackets == 0) + { + // The number of packets is 0 + return; + } + + if (NeoNdisSendPacketsHaltCheck(PacketArray, NumberOfPackets) == FALSE) + { + // Device is stopped + return; + } + + // Operation of the packet queue + NeoLockPacketQueue(); + { + if (NeoNdisSendPacketsHaltCheck(PacketArray, NumberOfPackets) == FALSE) + { + // Device is stopped + NeoUnlockPacketQueue(); + return; + } + + // Place the packet in the queue in order + for (i = 0;i < NumberOfPackets;i++) + { + // Get a packet + NdisQueryPacket(PacketArray[i], NULL, NULL, &Buffer, &PacketLength); + + // Extract the packet. + // Memory allocated here is used for the queue and is released at the time of releasing the queue. + Buf = NeoMalloc(PacketLength); + BufCopy = Buf; + while (Buffer) + { + NdisQueryBuffer(Buffer, &Tmp, &CurrentLength); + if (CurrentLength == 0) + { + // Complete + break; + } + NeoCopy(BufCopy, Tmp, CurrentLength); + BufCopy += CurrentLength; + NdisGetNextBuffer(Buffer, &Buffer); + } + // Process this packet + if (PacketLength > NEO_MIN_PACKET_SIZE) + { + if (PacketLength > NEO_MAX_PACKET_SIZE) + { + // Packet is too large + NDIS_SET_PACKET_STATUS(PacketArray[i], NDIS_STATUS_FAILURE); + + if (g_is_win8) + { + NdisMSendComplete(ctx->NdisMiniport, PacketArray[i], NDIS_STATUS_FAILURE); + } + + ctx->Status.NumPacketSendError++; + NeoFree(Buf); + } + else + { + // Insert the packet into the queue + NeoInsertQueue(Buf, PacketLength); + NDIS_SET_PACKET_STATUS(PacketArray[i], NDIS_STATUS_SUCCESS); + + if (g_is_win8) + { + NdisMSendComplete(ctx->NdisMiniport, PacketArray[i], NDIS_STATUS_SUCCESS); + } + + ctx->Status.NumPacketSend++; + } + } + else + { + // Release if the packet doesn't contain data + NDIS_SET_PACKET_STATUS(PacketArray[i], NDIS_STATUS_SUCCESS); + + if (g_is_win8) + { + NdisMSendComplete(ctx->NdisMiniport, PacketArray[i], NDIS_STATUS_SUCCESS); + } + + NeoFree(Buf); + } + } + } + NeoUnlockPacketQueue(); + + // Reception event + NeoSet(ctx->Event); +} + +// Stop check of packet transmission +BOOL NeoNdisSendPacketsHaltCheck(NDIS_PACKET **PacketArray, UINT NumberOfPackets) +{ + UINT i; + + if (ctx == NULL) + { + return FALSE; + } + + if (ctx->Halting != FALSE || ctx->Opened == FALSE) + { + // Finishing + for (i = 0;i < NumberOfPackets;i++) + { + NDIS_SET_PACKET_STATUS(PacketArray[i], NDIS_STATUS_FAILURE); + + if (g_is_win8) + { + NdisMSendComplete(ctx->NdisMiniport, PacketArray[i], NDIS_STATUS_SUCCESS); + } + + ctx->Status.NumPacketSendError++; + } + return FALSE; + } + return TRUE; +} + +// Initialize the packet array +void NeoInitPacketArray() +{ + UINT i; + // Create a packet buffer + for (i = 0;i < NEO_MAX_PACKET_EXCHANGE;i++) + { + ctx->PacketBuffer[i] = NeoNewPacketBuffer(); + // Store in the array + ctx->PacketBufferArray[i] = ctx->PacketBuffer[i]->NdisPacket; + } +} + +// Release the packet array +void NeoFreePacketArray() +{ + UINT i; + for (i = 0;i < NEO_MAX_PACKET_EXCHANGE;i++) + { + NeoFreePacketBuffer(ctx->PacketBuffer[i]); + ctx->PacketBuffer[i] = NULL; + ctx->PacketBufferArray[i] = NULL; + } +} + +// Release the packet buffer +void NeoFreePacketBuffer(PACKET_BUFFER *p) +{ + // Validate arguments + if (p == NULL) + { + return; + } + + // Detach the buffer from the packet + NdisUnchainBufferAtFront(p->NdisPacket, &p->NdisBuffer); + // Release the packet + NdisFreePacket(p->NdisPacket); + // Release the packet pool + NdisFreePacketPool(p->PacketPool); + // Release the buffer + NdisFreeBuffer(p->NdisBuffer); + // Release the memory + NeoFree(p->Buf); + // Release the buffer pool + NdisFreeBufferPool(p->BufferPool); + // Release the memory + NeoFree(p); +} + +// Create a packet buffer +PACKET_BUFFER *NeoNewPacketBuffer() +{ + PACKET_BUFFER *p; + NDIS_STATUS ret; + + // Memory allocation + p = NeoZeroMalloc(sizeof(PACKET_BUFFER)); + // Memory allocation for packet + p->Buf = NeoMalloc(NEO_MAX_PACKET_SIZE); + // Allocate the buffer pool + NdisAllocateBufferPool(&ret, &p->BufferPool, 1); + // Allocate the buffer + NdisAllocateBuffer(&ret, &p->NdisBuffer, p->BufferPool, p->Buf, NEO_MAX_PACKET_SIZE); + // Secure the packet pool + NdisAllocatePacketPool(&ret, &p->PacketPool, 1, PROTOCOL_RESERVED_SIZE_IN_PACKET); + // Secure the packet + NdisAllocatePacket(&ret, &p->NdisPacket, p->PacketPool); + NDIS_SET_PACKET_HEADER_SIZE(p->NdisPacket, NEO_PACKET_HEADER_SIZE); + // Attach the buffer to the packet + NdisChainBufferAtFront(p->NdisPacket, p->NdisBuffer); + + return p; +} + +// Reset the event +void NeoReset(NEO_EVENT *event) +{ + // Validate arguments + if (event == NULL) + { + return; + } + +#ifndef WIN9X + KeResetEvent(event->event); +#else // WIN9X + if (event->win32_event != 0) + { + DWORD h = event->win32_event; + _asm mov eax, h; + VxDCall(_VWIN32_ResetWin32Event); + } +#endif // WIN9X +} + +// Set the event +void NeoSet(NEO_EVENT *event) +{ + // Validate arguments + if (event == NULL) + { + return; + } + +#ifndef WIN9X + KeSetEvent(event->event, 0, FALSE); +#else // WIN9X + if (event->win32_event != 0) + { + DWORD h = event->win32_event; + _asm mov eax, h; + VxDCall(_VWIN32_SetWin32Event); + } +#endif // WIN9X +} + +// Release the event +void NeoFreeEvent(NEO_EVENT *event) +{ + // Validate arguments + if (event == NULL) + { + return; + } + +#ifdef WIN9X + if (0) + { + if (event->win32_event != 0) + { + DWORD h = event->win32_event; + _asm mov eax, h; + VxDCall(_VWIN32_CloseVxDHandle); + } + } +#endif WIN9X + + ZwClose(event->event_handle); + + // Release the memory + NeoFree(event); +} + +// Create a new event +#ifndef WIN9X +NEO_EVENT *NeoNewEvent(char *name) +{ + UNICODE *unicode_name; + NEO_EVENT *event; + // Validate arguments + if (name == NULL) + { + return NULL; + } + + // Convert the name to Unicode + unicode_name = NewUnicode(name); + if (unicode_name == NULL) + { + return NULL; + } + + // Memory allocation + event = NeoZeroMalloc(sizeof(NEO_EVENT)); + if (event == NULL) + { + FreeUnicode(unicode_name); + return NULL; + } + + // Create an Event + event->event = IoCreateNotificationEvent(GetUnicode(unicode_name), &event->event_handle); + if (event->event == NULL) + { + NeoFree(event); + FreeUnicode(unicode_name); + return NULL; + } + + // Initialize the event + KeInitializeEvent(event->event, NotificationEvent, FALSE); + KeClearEvent(event->event); + + // Release a string + FreeUnicode(unicode_name); + + return event; +} +#else // WIN9X +NEO_EVENT *NeoCreateWin9xEvent(DWORD h) +{ + NEO_EVENT *event; + // Validate arguments + if (h == NULL) + { + return NULL; + } + + // Memory allocation + event = NeoZeroMalloc(sizeof(NEO_EVENT)); + if (event == NULL) + { + return NULL; + } + + event->win32_event = h; + + return event; +} +#endif // WIN9X + +// Get the Unicode string +NDIS_STRING *GetUnicode(UNICODE *u) +{ + // Validate arguments + if (u == NULL) + { + return NULL; + } + + return &u->String; +} + +// Release the Unicode strings +void FreeUnicode(UNICODE *u) +{ + // Validate arguments + if (u == NULL) + { + return; + } + + // Release a string + NdisFreeString(u->String); + + // Release the memory + NeoFree(u); +} + +// Create a new Unicode string +UNICODE *NewUnicode(char *str) +{ + UNICODE *u; + // Validate arguments + if (str == NULL) + { + return NULL; + } + + // Memory allocation + u = NeoZeroMalloc(sizeof(UNICODE)); + if (u == NULL) + { + return NULL; + } + + // String initialization + _NdisInitializeString(&u->String, str); + + return u; +} + +// Release the lock +void NeoFreeLock(NEO_LOCK *lock) +{ + NDIS_SPIN_LOCK *spin_lock; + // Validate arguments + if (lock == NULL) + { + return; + } + + spin_lock = &lock->spin_lock; + NdisFreeSpinLock(spin_lock); + + // Release the memory + NeoFree(lock); +} + +// Unlock +void NeoUnlock(NEO_LOCK *lock) +{ + NDIS_SPIN_LOCK *spin_lock; + // Validate arguments + if (lock == NULL) + { + return; + } + + spin_lock = &lock->spin_lock; + NdisReleaseSpinLock(spin_lock); +} + +// Lock +void NeoLock(NEO_LOCK *lock) +{ + NDIS_SPIN_LOCK *spin_lock; + // Validate arguments + if (lock == NULL) + { + return; + } + + spin_lock = &lock->spin_lock; + NdisAcquireSpinLock(spin_lock); +} + +// Create a new lock +NEO_LOCK *NeoNewLock() +{ + NDIS_SPIN_LOCK *spin_lock; + + // Memory allocation + NEO_LOCK *lock = NeoZeroMalloc(sizeof(NEO_LOCK)); + if (lock == NULL) + { + return NULL; + } + + // Initialize spin lock + spin_lock = &lock->spin_lock; + + NdisAllocateSpinLock(spin_lock); + + return lock; +} + +// Memory copy +void NeoCopy(void *dst, void *src, UINT size) +{ + // Validate arguments + if (dst == NULL || src == NULL || size == 0) + { + return; + } + + // Copy + NdisMoveMemory(dst, src, size); +} + +// Memory clear +void NeoZero(void *dst, UINT size) +{ + // Validate arguments + if (dst == NULL || size == 0) + { + return; + } + + // Clear + NdisZeroMemory(dst, size); +} + +// Clear to zero by memory allocation +void *NeoZeroMalloc(UINT size) +{ + void *p = NeoMalloc(size); + if (p == NULL) + { + // Memory allocation failure + return NULL; + } + // Clear to zero + NeoZero(p, size); + return p; +} + +// Memory allocation +void *NeoMalloc(UINT size) +{ + NDIS_STATUS r; + void *p; + if (size == 0) + { + size = 1; + } + + // Allocate the non-paged memory + r = NdisAllocateMemoryWithTag(&p, size, 'SETH'); + + if (NG(r)) + { + return NULL; + } + return p; +} + +// Release the memory +void NeoFree(void *p) +{ + // Validate arguments + if (p == NULL) + { + return; + } + + // Release the memory + NdisFreeMemory(p, 0, 0); +} + + diff --git a/src/Neo/NDIS5.h b/src/Neo/NDIS5.h index 2d2dfe6d..82b599c4 100644 --- a/src/Neo/NDIS5.h +++ b/src/Neo/NDIS5.h @@ -1,189 +1,189 @@ -// SoftEther VPN Source Code - Developer Edition Master Branch -// Kernel Device Driver - - -// NDIS5.h -// Header of NDIS5.c - -#ifndef NDIS5_H -#define NDIS5_H - -// Win32 DDK related -#ifndef CPU_64 -#define _X86_ -#else // CPU_64 -#ifndef NEO_IA64 -#define _AMD64_ -#define AMD64 -#else // NEO_IA64 -#define _IA64_ -#define IA64 -#endif // NEO_IA64 -#endif // CPU_64 -#define NDIS_MINIPORT_DRIVER -#ifndef WIN9X -// Windows 2000 or later: NDIS 5.0 -#define NDIS50_MINIPORT -#define NEO_NDIS_MAJOR_VERSION 5 -#define NEO_NDIS_MINOR_VERSION 0 -#else // WIN9X -// Windows 9x: NDIS 4.0 -#define NDIS40_MINIPORT -#define NEO_NDIS_MAJOR_VERSION 4 -#define NEO_NDIS_MINOR_VERSION 0 -#define BINARY_COMPATIBLE 1 -#endif // WIN9X -#define NDIS_WDM 1 - -#ifndef WIN9X -#include -#include -#include -#include -#else // WIN9X -#include -#define _LARGE_INTEGER DUMMY__LARGE_INTEGER -#define LARGE_INTEGER DUMMY_LARGE_INTEGER -#define PLARGE_INTEGER DUMMY_PLARGE_INTEGER -#define _ULARGE_INTEGER DUMMY__ULARGE_INTEGER -#define ULARGE_INTEGER DUMMY_ULARGE_INTEGER -#define PULARGE_INTEGER DUMMY_PULARGE_INTEGER -#define PSZ DUMMY_PSZ -#include -#include -#include -#include -#include -#undef _LARGE_INTEGER -#undef LARGE_INTEGER -#undef PLARGE_INTEGER -#undef _ULARGE_INTEGER -#undef ULARGE_INTEGER -#undef PULARGE_INTEGER -#undef PSZ -#endif // WIN9X - -// Error checking macro -#define OK(val) (val == STATUS_SUCCESS) -#define NG(val) (!OK(val)) - -// Constant -static UINT SupportedOids[] = -{ - OID_GEN_SUPPORTED_LIST, - OID_GEN_HARDWARE_STATUS, - OID_GEN_MEDIA_SUPPORTED, - OID_GEN_MEDIA_IN_USE, - OID_GEN_MAXIMUM_FRAME_SIZE, - OID_GEN_MAXIMUM_TOTAL_SIZE, - OID_GEN_MAC_OPTIONS, - OID_GEN_MAXIMUM_LOOKAHEAD, - OID_GEN_CURRENT_LOOKAHEAD, - OID_GEN_LINK_SPEED, - OID_GEN_MEDIA_CONNECT_STATUS, - OID_GEN_TRANSMIT_BUFFER_SPACE, - OID_GEN_RECEIVE_BUFFER_SPACE, - OID_GEN_TRANSMIT_BLOCK_SIZE, - OID_GEN_RECEIVE_BLOCK_SIZE, - OID_GEN_VENDOR_DESCRIPTION, - OID_GEN_VENDOR_ID, - OID_GEN_DRIVER_VERSION, - OID_GEN_VENDOR_DRIVER_VERSION, - OID_GEN_XMIT_OK, - OID_GEN_RCV_OK, - OID_GEN_XMIT_ERROR, - OID_GEN_RCV_ERROR, - OID_GEN_RCV_NO_BUFFER, - OID_GEN_CURRENT_PACKET_FILTER, - OID_802_3_PERMANENT_ADDRESS, - OID_802_3_CURRENT_ADDRESS, - OID_802_3_MAXIMUM_LIST_SIZE, - OID_802_3_RCV_ERROR_ALIGNMENT, - OID_802_3_XMIT_ONE_COLLISION, - OID_802_3_XMIT_MORE_COLLISIONS, - OID_802_3_MULTICAST_LIST, - //OID_GEN_PROTOCOL_OPTIONS, - OID_GEN_MAXIMUM_SEND_PACKETS - }; -#define NEO_MEDIA NdisMedium802_3 -#define MAX_MULTICAST 32 - -#define MAX_PATH 260 -#define MAX_SIZE 512 -#define STD_SIZE 512 - - -// Macro -#define _NdisInitializeString(Destination,Source) \ -{\ - PNDIS_STRING _D = (Destination);\ - UCHAR *_S = (Source);\ - WCHAR *_P;\ - _D->Length = (USHORT)((strlen(_S)) * sizeof(WCHAR));\ - _D->MaximumLength = _D->Length + sizeof(WCHAR);\ - NdisAllocateMemoryWithTag((PVOID *)&(_D->Buffer), _D->MaximumLength, 'SETH');\ - _P = _D->Buffer;\ - while(*_S != '\0'){\ - *_P = (WCHAR)(*_S);\ - _S++;\ - _P++;\ - }\ - *_P = UNICODE_NULL;\ -} - - -// Unicode string -typedef struct _UNICODE -{ - UNICODE_STRING String; -} UNICODE; - -typedef struct _PACKET_BUFFER PACKET_BUFFER; - -// Function prototype -UNICODE *NewUnicode(char *str); -void FreeUnicode(UNICODE *u); -NDIS_STRING *GetUnicode(UNICODE *u); -PACKET_BUFFER *NeoNewPacketBuffer(); -void NeoFreePacketBuffer(PACKET_BUFFER *p); -void NeoInitPacketArray(); -void NeoFreePacketArray(); -NDIS_STATUS DriverEntry(DRIVER_OBJECT *DriverObject, UNICODE_STRING *RegistryPath); -NDIS_STATUS NeoNdisInit(NDIS_STATUS *OpenErrorStatus, - UINT *SelectedMediumIndex, - NDIS_MEDIUM *MediumArray, - UINT MediumArraySize, - NDIS_HANDLE MiniportAdapterHandle, - NDIS_HANDLE WrapperConfigurationContext); -NDIS_STATUS NeoNdisHalt(NDIS_HANDLE MiniportAdapterContext); -NDIS_STATUS NeoNdisReset(BOOLEAN *AddressingReset, NDIS_HANDLE MiniportAdapterContext); -NDIS_STATUS NeoNdisQuery(NDIS_HANDLE MiniportAdapterContext, - NDIS_OID Oid, - void *InformationBuffer, - ULONG InformationBufferLength, - ULONG *BytesWritten, - ULONG *BytesNeeded); -NDIS_STATUS NeoNdisSet( - NDIS_HANDLE MiniportAdapterContext, - NDIS_OID Oid, - void *InformationBuffer, - ULONG InformationBufferLength, - ULONG *BytesRead, - ULONG *BytesNeeded); -void NeoNdisSendPackets(NDIS_HANDLE MiniportAdapterContext, - NDIS_PACKET **PacketArray, - UINT NumberOfPackets); -NDIS_STATUS NeoNdisSend(NDIS_HANDLE MiniportAdapterContext, - NDIS_PACKET *Packet, UINT Flags); -BOOL NeoNdisSendPacketsHaltCheck(NDIS_PACKET **PacketArray, UINT NumberOfPackets); -BOOL NeoLoadRegistry(); -void NeoInitControlDevice(); -void NeoFreeControlDevice(); -NTSTATUS NeoNdisDispatch(DEVICE_OBJECT *DeviceObject, IRP *Irp); -void NeoCheckConnectState(); -void NeoSetConnectState(BOOL connected); -BOOL NeoNdisOnOpen(IRP *irp, IO_STACK_LOCATION *stack); -BOOL NeoNdisOnClose(IRP *irp, IO_STACK_LOCATION *stack); - -#endif // NDIS5_H - +// SoftEther VPN Source Code - Developer Edition Master Branch +// Kernel Device Driver + + +// NDIS5.h +// Header of NDIS5.c + +#ifndef NDIS5_H +#define NDIS5_H + +// Win32 DDK related +#ifndef CPU_64 +#define _X86_ +#else // CPU_64 +#ifndef NEO_IA64 +#define _AMD64_ +#define AMD64 +#else // NEO_IA64 +#define _IA64_ +#define IA64 +#endif // NEO_IA64 +#endif // CPU_64 +#define NDIS_MINIPORT_DRIVER +#ifndef WIN9X +// Windows 2000 or later: NDIS 5.0 +#define NDIS50_MINIPORT +#define NEO_NDIS_MAJOR_VERSION 5 +#define NEO_NDIS_MINOR_VERSION 0 +#else // WIN9X +// Windows 9x: NDIS 4.0 +#define NDIS40_MINIPORT +#define NEO_NDIS_MAJOR_VERSION 4 +#define NEO_NDIS_MINOR_VERSION 0 +#define BINARY_COMPATIBLE 1 +#endif // WIN9X +#define NDIS_WDM 1 + +#ifndef WIN9X +#include +#include +#include +#include +#else // WIN9X +#include +#define _LARGE_INTEGER DUMMY__LARGE_INTEGER +#define LARGE_INTEGER DUMMY_LARGE_INTEGER +#define PLARGE_INTEGER DUMMY_PLARGE_INTEGER +#define _ULARGE_INTEGER DUMMY__ULARGE_INTEGER +#define ULARGE_INTEGER DUMMY_ULARGE_INTEGER +#define PULARGE_INTEGER DUMMY_PULARGE_INTEGER +#define PSZ DUMMY_PSZ +#include +#include +#include +#include +#include +#undef _LARGE_INTEGER +#undef LARGE_INTEGER +#undef PLARGE_INTEGER +#undef _ULARGE_INTEGER +#undef ULARGE_INTEGER +#undef PULARGE_INTEGER +#undef PSZ +#endif // WIN9X + +// Error checking macro +#define OK(val) (val == STATUS_SUCCESS) +#define NG(val) (!OK(val)) + +// Constant +static UINT SupportedOids[] = +{ + OID_GEN_SUPPORTED_LIST, + OID_GEN_HARDWARE_STATUS, + OID_GEN_MEDIA_SUPPORTED, + OID_GEN_MEDIA_IN_USE, + OID_GEN_MAXIMUM_FRAME_SIZE, + OID_GEN_MAXIMUM_TOTAL_SIZE, + OID_GEN_MAC_OPTIONS, + OID_GEN_MAXIMUM_LOOKAHEAD, + OID_GEN_CURRENT_LOOKAHEAD, + OID_GEN_LINK_SPEED, + OID_GEN_MEDIA_CONNECT_STATUS, + OID_GEN_TRANSMIT_BUFFER_SPACE, + OID_GEN_RECEIVE_BUFFER_SPACE, + OID_GEN_TRANSMIT_BLOCK_SIZE, + OID_GEN_RECEIVE_BLOCK_SIZE, + OID_GEN_VENDOR_DESCRIPTION, + OID_GEN_VENDOR_ID, + OID_GEN_DRIVER_VERSION, + OID_GEN_VENDOR_DRIVER_VERSION, + OID_GEN_XMIT_OK, + OID_GEN_RCV_OK, + OID_GEN_XMIT_ERROR, + OID_GEN_RCV_ERROR, + OID_GEN_RCV_NO_BUFFER, + OID_GEN_CURRENT_PACKET_FILTER, + OID_802_3_PERMANENT_ADDRESS, + OID_802_3_CURRENT_ADDRESS, + OID_802_3_MAXIMUM_LIST_SIZE, + OID_802_3_RCV_ERROR_ALIGNMENT, + OID_802_3_XMIT_ONE_COLLISION, + OID_802_3_XMIT_MORE_COLLISIONS, + OID_802_3_MULTICAST_LIST, + //OID_GEN_PROTOCOL_OPTIONS, + OID_GEN_MAXIMUM_SEND_PACKETS + }; +#define NEO_MEDIA NdisMedium802_3 +#define MAX_MULTICAST 32 + +#define MAX_PATH 260 +#define MAX_SIZE 512 +#define STD_SIZE 512 + + +// Macro +#define _NdisInitializeString(Destination,Source) \ +{\ + PNDIS_STRING _D = (Destination);\ + UCHAR *_S = (Source);\ + WCHAR *_P;\ + _D->Length = (USHORT)((strlen(_S)) * sizeof(WCHAR));\ + _D->MaximumLength = _D->Length + sizeof(WCHAR);\ + NdisAllocateMemoryWithTag((PVOID *)&(_D->Buffer), _D->MaximumLength, 'SETH');\ + _P = _D->Buffer;\ + while(*_S != '\0'){\ + *_P = (WCHAR)(*_S);\ + _S++;\ + _P++;\ + }\ + *_P = UNICODE_NULL;\ +} + + +// Unicode string +typedef struct _UNICODE +{ + UNICODE_STRING String; +} UNICODE; + +typedef struct _PACKET_BUFFER PACKET_BUFFER; + +// Function prototype +UNICODE *NewUnicode(char *str); +void FreeUnicode(UNICODE *u); +NDIS_STRING *GetUnicode(UNICODE *u); +PACKET_BUFFER *NeoNewPacketBuffer(); +void NeoFreePacketBuffer(PACKET_BUFFER *p); +void NeoInitPacketArray(); +void NeoFreePacketArray(); +NDIS_STATUS DriverEntry(DRIVER_OBJECT *DriverObject, UNICODE_STRING *RegistryPath); +NDIS_STATUS NeoNdisInit(NDIS_STATUS *OpenErrorStatus, + UINT *SelectedMediumIndex, + NDIS_MEDIUM *MediumArray, + UINT MediumArraySize, + NDIS_HANDLE MiniportAdapterHandle, + NDIS_HANDLE WrapperConfigurationContext); +NDIS_STATUS NeoNdisHalt(NDIS_HANDLE MiniportAdapterContext); +NDIS_STATUS NeoNdisReset(BOOLEAN *AddressingReset, NDIS_HANDLE MiniportAdapterContext); +NDIS_STATUS NeoNdisQuery(NDIS_HANDLE MiniportAdapterContext, + NDIS_OID Oid, + void *InformationBuffer, + ULONG InformationBufferLength, + ULONG *BytesWritten, + ULONG *BytesNeeded); +NDIS_STATUS NeoNdisSet( + NDIS_HANDLE MiniportAdapterContext, + NDIS_OID Oid, + void *InformationBuffer, + ULONG InformationBufferLength, + ULONG *BytesRead, + ULONG *BytesNeeded); +void NeoNdisSendPackets(NDIS_HANDLE MiniportAdapterContext, + NDIS_PACKET **PacketArray, + UINT NumberOfPackets); +NDIS_STATUS NeoNdisSend(NDIS_HANDLE MiniportAdapterContext, + NDIS_PACKET *Packet, UINT Flags); +BOOL NeoNdisSendPacketsHaltCheck(NDIS_PACKET **PacketArray, UINT NumberOfPackets); +BOOL NeoLoadRegistry(); +void NeoInitControlDevice(); +void NeoFreeControlDevice(); +NTSTATUS NeoNdisDispatch(DEVICE_OBJECT *DeviceObject, IRP *Irp); +void NeoCheckConnectState(); +void NeoSetConnectState(BOOL connected); +BOOL NeoNdisOnOpen(IRP *irp, IO_STACK_LOCATION *stack); +BOOL NeoNdisOnClose(IRP *irp, IO_STACK_LOCATION *stack); + +#endif // NDIS5_H + diff --git a/src/Neo/Neo.c b/src/Neo/Neo.c index 0621bb66..5ab629fc 100644 --- a/src/Neo/Neo.c +++ b/src/Neo/Neo.c @@ -1,362 +1,362 @@ -// SoftEther VPN Source Code - Developer Edition Master Branch -// Kernel Device Driver - - -// Neo.c -// Driver main program - -#include - -#define NEO_DEVICE_DRIVER - -#include "Neo.h" - -// Whether Win8 -extern bool g_is_win8; - -// Neo driver context -static NEO_CTX static_ctx; -NEO_CTX *ctx = &static_ctx; - -// Read the packet data from the transmit packet queue -void NeoRead(void *buf) -{ - NEO_QUEUE *q; - UINT num; - BOOL left; - // Validate arguments - if (buf == NULL) - { - return; - } - - // Copy the packets one by one from the queue - num = 0; - left = TRUE; - NeoLockPacketQueue(); - { - while (TRUE) - { - if (num >= NEO_MAX_PACKET_EXCHANGE) - { - if (ctx->PacketQueue == NULL) - { - left = FALSE; - } - break; - } - q = NeoGetNextQueue(); - if (q == NULL) - { - left = FALSE; - break; - } - NEO_SIZE_OF_PACKET(buf, num) = q->Size; - NeoCopy(NEO_ADDR_OF_PACKET(buf, num), q->Buf, q->Size); - num++; - NeoFreeQueue(q); - } - } - NeoUnlockPacketQueue(); - - NEO_NUM_PACKET(buf) = num; - NEO_LEFT_FLAG(buf) = left; - - if (left == FALSE) - { - NeoReset(ctx->Event); - } - else - { - NeoSet(ctx->Event); - } - - return; -} - -// Process the received packet -void NeoWrite(void *buf) -{ - UINT num, i, size; - void *packet_buf; - // Validate arguments - if (buf == NULL) - { - return; - } - - // Number of packets - num = NEO_NUM_PACKET(buf); - if (num > NEO_MAX_PACKET_EXCHANGE) - { - // Number of packets is too many - return; - } - if (num == 0) - { - // No packet - return; - } - - if (ctx->Halting != FALSE) - { - // Halting - return; - } - - if (ctx->Opened == FALSE) - { - // Not connected - return; - } - - for (i = 0;i < num;i++) - { - PACKET_BUFFER *p = ctx->PacketBuffer[i]; - - size = NEO_SIZE_OF_PACKET(buf, i); - if (size > NEO_MAX_PACKET_SIZE) - { - size = NEO_MAX_PACKET_SIZE; - } - if (size < NEO_PACKET_HEADER_SIZE) - { - size = NEO_PACKET_HEADER_SIZE; - } - - packet_buf = NEO_ADDR_OF_PACKET(buf, i); - - // Buffer copy - NeoCopy(p->Buf, packet_buf, size); - - if (g_is_win8 == false) - { - // Adjust the buffer size - NdisAdjustBufferLength(p->NdisBuffer, size); - // Set the packet information - NDIS_SET_PACKET_STATUS(p->NdisPacket, NDIS_STATUS_RESOURCES); - NDIS_SET_PACKET_HEADER_SIZE(p->NdisPacket, NEO_PACKET_HEADER_SIZE); - } - else - { - NdisMEthIndicateReceive(ctx->NdisMiniport, ctx, - p->Buf, NEO_PACKET_HEADER_SIZE, - ((UCHAR *)p->Buf) + NEO_PACKET_HEADER_SIZE, size - NEO_PACKET_HEADER_SIZE, - size - NEO_PACKET_HEADER_SIZE); - NdisMEthIndicateReceiveComplete(ctx->NdisMiniport); - } - } - - // Notify that packets have received - ctx->Status.NumPacketRecv += num; - - if (g_is_win8 == false) - { - NdisMIndicateReceivePacket(ctx->NdisMiniport, ctx->PacketBufferArray, num); - } -} - -// Get the number of queue items -UINT NeoGetNumQueue() -{ - return ctx->NumPacketQueue; -} - -// Insert the queue -void NeoInsertQueue(void *buf, UINT size) -{ - NEO_QUEUE *p; - // Validate arguments - if (buf == NULL || size == 0) - { - return; - } - - // Prevent the packet accumulation in large quantities in the queue - if (ctx->NumPacketQueue > NEO_MAX_PACKET_QUEUED) - { - NeoFree(buf); - return; - } - - // Create a queue - p = NeoMalloc(sizeof(NEO_QUEUE)); - p->Next = NULL; - p->Size = size; - p->Buf = buf; - - // Append to the queue - if (ctx->PacketQueue == NULL) - { - ctx->PacketQueue = p; - } - else - { - NEO_QUEUE *q = ctx->Tail; - q->Next = p; - } - - ctx->Tail = p; - - ctx->NumPacketQueue++; -} - -// Get the next queued item -NEO_QUEUE *NeoGetNextQueue() -{ - NEO_QUEUE *q; - if (ctx->PacketQueue == NULL) - { - // No item queued - return NULL; - } - - // Get the next queued item - q = ctx->PacketQueue; - ctx->PacketQueue = ctx->PacketQueue->Next; - q->Next = NULL; - ctx->NumPacketQueue--; - - if (ctx->PacketQueue == NULL) - { - ctx->Tail = NULL; - } - - return q; -} - -// Release the buffer queue -void NeoFreeQueue(NEO_QUEUE *q) -{ - // Validate arguments - if (q == NULL) - { - return; - } - NeoFree(q->Buf); - NeoFree(q); -} - -// Lock the packet queue -void NeoLockPacketQueue() -{ - NeoLock(ctx->PacketQueueLock); -} - -// Unlock the packet queue -void NeoUnlockPacketQueue() -{ - NeoUnlock(ctx->PacketQueueLock); -} - -// Initialize the packet queue -void NeoInitPacketQueue() -{ - // Create a lock - ctx->PacketQueueLock = NeoNewLock(); - // Initialize the packet queue - ctx->PacketQueue = NULL; - ctx->NumPacketQueue = 0; - ctx->Tail = NULL; -} - -// Delete all the packets from the packet queue -void NeoClearPacketQueue() -{ - // Release the memory of the packet queue - NeoLock(ctx->PacketQueueLock); - { - NEO_QUEUE *q = ctx->PacketQueue; - NEO_QUEUE *qn; - while (q != NULL) - { - qn = q->Next; - NeoFree(q->Buf); - NeoFree(q); - q = qn; - } - ctx->PacketQueue = NULL; - ctx->Tail = NULL; - ctx->NumPacketQueue = 0; - } - NeoUnlock(ctx->PacketQueueLock); -} - -// Release the packet queue -void NeoFreePacketQueue() -{ - // Delete all packets - NeoClearPacketQueue(); - - // Delete the lock - NeoFreeLock(ctx->PacketQueueLock); - ctx->PacketQueueLock = NULL; -} - -// Start the adapter -void NeoStartAdapter() -{ - // Initialize the packet queue - NeoInitPacketQueue(); -} - -// Stop the adapter -void NeoStopAdapter() -{ - // Delete the packet queue - NeoFreePacketQueue(); -} - -// Initialization -BOOL NeoInit() -{ - // Initialize the context - NeoZero(ctx, sizeof(NEO_CTX)); - - // Initialize the status information - NeoNewStatus(&ctx->Status); - - return TRUE; -} - -// Shutdown -void NeoShutdown() -{ - if (ctx == NULL) - { - // Uninitialized - return; - } - - // Release the status information - NeoFreeStatus(&ctx->Status); - - NeoZero(ctx, sizeof(NEO_CTX)); -} - -// Create a status information -void NeoNewStatus(NEO_STATUS *s) -{ - // Validate arguments - if (s == NULL) - { - return; - } - - // Memory initialization - NeoZero(s, sizeof(NEO_STATUS)); -} - -// Release the status information -void NeoFreeStatus(NEO_STATUS *s) -{ - // Validate arguments - if (s == NULL) - { - return; - } - - // Memory initialization - NeoZero(s, sizeof(NEO_STATUS)); -} - +// SoftEther VPN Source Code - Developer Edition Master Branch +// Kernel Device Driver + + +// Neo.c +// Driver main program + +#include + +#define NEO_DEVICE_DRIVER + +#include "Neo.h" + +// Whether Win8 +extern bool g_is_win8; + +// Neo driver context +static NEO_CTX static_ctx; +NEO_CTX *ctx = &static_ctx; + +// Read the packet data from the transmit packet queue +void NeoRead(void *buf) +{ + NEO_QUEUE *q; + UINT num; + BOOL left; + // Validate arguments + if (buf == NULL) + { + return; + } + + // Copy the packets one by one from the queue + num = 0; + left = TRUE; + NeoLockPacketQueue(); + { + while (TRUE) + { + if (num >= NEO_MAX_PACKET_EXCHANGE) + { + if (ctx->PacketQueue == NULL) + { + left = FALSE; + } + break; + } + q = NeoGetNextQueue(); + if (q == NULL) + { + left = FALSE; + break; + } + NEO_SIZE_OF_PACKET(buf, num) = q->Size; + NeoCopy(NEO_ADDR_OF_PACKET(buf, num), q->Buf, q->Size); + num++; + NeoFreeQueue(q); + } + } + NeoUnlockPacketQueue(); + + NEO_NUM_PACKET(buf) = num; + NEO_LEFT_FLAG(buf) = left; + + if (left == FALSE) + { + NeoReset(ctx->Event); + } + else + { + NeoSet(ctx->Event); + } + + return; +} + +// Process the received packet +void NeoWrite(void *buf) +{ + UINT num, i, size; + void *packet_buf; + // Validate arguments + if (buf == NULL) + { + return; + } + + // Number of packets + num = NEO_NUM_PACKET(buf); + if (num > NEO_MAX_PACKET_EXCHANGE) + { + // Number of packets is too many + return; + } + if (num == 0) + { + // No packet + return; + } + + if (ctx->Halting != FALSE) + { + // Halting + return; + } + + if (ctx->Opened == FALSE) + { + // Not connected + return; + } + + for (i = 0;i < num;i++) + { + PACKET_BUFFER *p = ctx->PacketBuffer[i]; + + size = NEO_SIZE_OF_PACKET(buf, i); + if (size > NEO_MAX_PACKET_SIZE) + { + size = NEO_MAX_PACKET_SIZE; + } + if (size < NEO_PACKET_HEADER_SIZE) + { + size = NEO_PACKET_HEADER_SIZE; + } + + packet_buf = NEO_ADDR_OF_PACKET(buf, i); + + // Buffer copy + NeoCopy(p->Buf, packet_buf, size); + + if (g_is_win8 == false) + { + // Adjust the buffer size + NdisAdjustBufferLength(p->NdisBuffer, size); + // Set the packet information + NDIS_SET_PACKET_STATUS(p->NdisPacket, NDIS_STATUS_RESOURCES); + NDIS_SET_PACKET_HEADER_SIZE(p->NdisPacket, NEO_PACKET_HEADER_SIZE); + } + else + { + NdisMEthIndicateReceive(ctx->NdisMiniport, ctx, + p->Buf, NEO_PACKET_HEADER_SIZE, + ((UCHAR *)p->Buf) + NEO_PACKET_HEADER_SIZE, size - NEO_PACKET_HEADER_SIZE, + size - NEO_PACKET_HEADER_SIZE); + NdisMEthIndicateReceiveComplete(ctx->NdisMiniport); + } + } + + // Notify that packets have received + ctx->Status.NumPacketRecv += num; + + if (g_is_win8 == false) + { + NdisMIndicateReceivePacket(ctx->NdisMiniport, ctx->PacketBufferArray, num); + } +} + +// Get the number of queue items +UINT NeoGetNumQueue() +{ + return ctx->NumPacketQueue; +} + +// Insert the queue +void NeoInsertQueue(void *buf, UINT size) +{ + NEO_QUEUE *p; + // Validate arguments + if (buf == NULL || size == 0) + { + return; + } + + // Prevent the packet accumulation in large quantities in the queue + if (ctx->NumPacketQueue > NEO_MAX_PACKET_QUEUED) + { + NeoFree(buf); + return; + } + + // Create a queue + p = NeoMalloc(sizeof(NEO_QUEUE)); + p->Next = NULL; + p->Size = size; + p->Buf = buf; + + // Append to the queue + if (ctx->PacketQueue == NULL) + { + ctx->PacketQueue = p; + } + else + { + NEO_QUEUE *q = ctx->Tail; + q->Next = p; + } + + ctx->Tail = p; + + ctx->NumPacketQueue++; +} + +// Get the next queued item +NEO_QUEUE *NeoGetNextQueue() +{ + NEO_QUEUE *q; + if (ctx->PacketQueue == NULL) + { + // No item queued + return NULL; + } + + // Get the next queued item + q = ctx->PacketQueue; + ctx->PacketQueue = ctx->PacketQueue->Next; + q->Next = NULL; + ctx->NumPacketQueue--; + + if (ctx->PacketQueue == NULL) + { + ctx->Tail = NULL; + } + + return q; +} + +// Release the buffer queue +void NeoFreeQueue(NEO_QUEUE *q) +{ + // Validate arguments + if (q == NULL) + { + return; + } + NeoFree(q->Buf); + NeoFree(q); +} + +// Lock the packet queue +void NeoLockPacketQueue() +{ + NeoLock(ctx->PacketQueueLock); +} + +// Unlock the packet queue +void NeoUnlockPacketQueue() +{ + NeoUnlock(ctx->PacketQueueLock); +} + +// Initialize the packet queue +void NeoInitPacketQueue() +{ + // Create a lock + ctx->PacketQueueLock = NeoNewLock(); + // Initialize the packet queue + ctx->PacketQueue = NULL; + ctx->NumPacketQueue = 0; + ctx->Tail = NULL; +} + +// Delete all the packets from the packet queue +void NeoClearPacketQueue() +{ + // Release the memory of the packet queue + NeoLock(ctx->PacketQueueLock); + { + NEO_QUEUE *q = ctx->PacketQueue; + NEO_QUEUE *qn; + while (q != NULL) + { + qn = q->Next; + NeoFree(q->Buf); + NeoFree(q); + q = qn; + } + ctx->PacketQueue = NULL; + ctx->Tail = NULL; + ctx->NumPacketQueue = 0; + } + NeoUnlock(ctx->PacketQueueLock); +} + +// Release the packet queue +void NeoFreePacketQueue() +{ + // Delete all packets + NeoClearPacketQueue(); + + // Delete the lock + NeoFreeLock(ctx->PacketQueueLock); + ctx->PacketQueueLock = NULL; +} + +// Start the adapter +void NeoStartAdapter() +{ + // Initialize the packet queue + NeoInitPacketQueue(); +} + +// Stop the adapter +void NeoStopAdapter() +{ + // Delete the packet queue + NeoFreePacketQueue(); +} + +// Initialization +BOOL NeoInit() +{ + // Initialize the context + NeoZero(ctx, sizeof(NEO_CTX)); + + // Initialize the status information + NeoNewStatus(&ctx->Status); + + return TRUE; +} + +// Shutdown +void NeoShutdown() +{ + if (ctx == NULL) + { + // Uninitialized + return; + } + + // Release the status information + NeoFreeStatus(&ctx->Status); + + NeoZero(ctx, sizeof(NEO_CTX)); +} + +// Create a status information +void NeoNewStatus(NEO_STATUS *s) +{ + // Validate arguments + if (s == NULL) + { + return; + } + + // Memory initialization + NeoZero(s, sizeof(NEO_STATUS)); +} + +// Release the status information +void NeoFreeStatus(NEO_STATUS *s) +{ + // Validate arguments + if (s == NULL) + { + return; + } + + // Memory initialization + NeoZero(s, sizeof(NEO_STATUS)); +} + diff --git a/src/Neo/Neo.h b/src/Neo/Neo.h index 1195d9ac..6f8b9f74 100644 --- a/src/Neo/Neo.h +++ b/src/Neo/Neo.h @@ -1,232 +1,232 @@ -// SoftEther VPN Source Code - Developer Edition Master Branch -// Kernel Device Driver - - -// Neo.h -// Header of Neo.c - -#ifndef NEO_H -#define NEO_H - - -// Identification string (NDIS) -#define NDIS_NEO_HARDWARE_ID "VPN Client Adapter - %s" -#define NDIS_NEO_DEVICE_NAME "\\Device\\NEO_%s_DEVICE" -#define NDIS_NEO_DEVICE_NAME_WIN32 "\\DosDevices\\NEO_%s_DEVICE" -#define NDIS_NEO_DEVICE_FILE_NAME "\\\\.\\NEO_NEOADAPTER_%s_DEVICE" -#define NDIS_NEO_EVENT_NAME "\\BaseNamedObjects\\NEO_EVENT_%s" -#define NDIS_NEO_EVENT_NAME_WIN32 "Global\\NEO_EVENT_NEOADAPTER_%s" - -// Constant -#define NEO_MAX_PACKET_SIZE 1600 -#define NEO_MAX_PACKET_SIZE_ANNOUNCE 1514 -#define NEO_MIN_PACKET_SIZE 14 -#define NEO_PACKET_HEADER_SIZE 14 -#define NEO_MAX_FRAME_SIZE (NEO_MAX_PACKET_SIZE - NEO_MIN_PACKET_SIZE) -#define NEO_MAX_SPEED_DEFAULT 1000000 -#define NEO_MAC_ADDRESS_SIZE 6 -#define NEO_MAX_MULTICASE 32 - - -// IOCTL constant -#define NEO_IOCTL_SET_EVENT CTL_CODE(0x8000, 0, METHOD_BUFFERED, FILE_ANY_ACCESS) -#define NEO_IOCTL_PUT_PACKET CTL_CODE(0x8000, 1, METHOD_BUFFERED, FILE_ANY_ACCESS) -#define NEO_IOCTL_GET_PACKET CTL_CODE(0x8000, 2, METHOD_BUFFERED, FILE_ANY_ACCESS) - - -// Packet data exchange related -#define NEO_MAX_PACKET_EXCHANGE 256 // Number of packets that can be exchanged at a time -#define NEO_MAX_PACKET_QUEUED 4096 // Maximum number of packets that can be queued -#define NEO_EX_SIZEOF_NUM_PACKET 4 // Packet count data (UINT) -#define NEO_EX_SIZEOF_LENGTH_PACKET 4 // Length data of the packet data (UINT) -#define NEO_EX_SIZEOF_LEFT_FLAG 4 // Flag to indicate that the packet is still -#define NEO_EX_SIZEOF_ONE_PACKET 1600 // Data area occupied by a packet data -#define NEO_EXCHANGE_BUFFER_SIZE (NEO_EX_SIZEOF_NUM_PACKET + NEO_EX_SIZEOF_LEFT_FLAG + \ - (NEO_EX_SIZEOF_LENGTH_PACKET + NEO_EX_SIZEOF_ONE_PACKET) * (NEO_MAX_PACKET_EXCHANGE + 1)) -#define NEO_NUM_PACKET(buf) (*((UINT *)((UCHAR *)buf + 0))) -#define NEO_SIZE_OF_PACKET(buf, i) (*((UINT *)((UCHAR *)buf + NEO_EX_SIZEOF_NUM_PACKET + \ - (i * (NEO_EX_SIZEOF_LENGTH_PACKET + NEO_EX_SIZEOF_ONE_PACKET))))) -#define NEO_ADDR_OF_PACKET(buf, i) (((UINT *)((UCHAR *)buf + NEO_EX_SIZEOF_NUM_PACKET + \ - NEO_EX_SIZEOF_LENGTH_PACKET + \ - (i * (NEO_EX_SIZEOF_LENGTH_PACKET + NEO_EX_SIZEOF_ONE_PACKET))))) -#define NEO_LEFT_FLAG(buf) NEO_SIZE_OF_PACKET(buf, NEO_MAX_PACKET_EXCHANGE) - - - -// Definitions needed to compile as a device driver -#ifdef NEO_DEVICE_DRIVER - -// OS determination -#ifdef WIN32 -#define OS_WIN32 // Microsoft Windows -#else -#define OS_UNIX // UNIX / Linux -#endif - - -// Type declaration -#ifndef WINDOWS_H_INCLUDED -#ifndef WIN9X -typedef unsigned long BOOL; -#endif // WIN9X -#define TRUE 1 -#define FALSE 0 -#endif -typedef unsigned long bool; -#define true 1 -#define false 0 -typedef unsigned long long UINT64; -typedef signed long long INT64; -typedef unsigned short WORD; -typedef unsigned short USHORT; -typedef signed short SHORT; -typedef unsigned char BYTE; -typedef unsigned char UCHAR; -typedef signed char CHAR; -typedef unsigned long DWORD; -#define INFINITE 0xFFFFFFFF - -#define LESS(a, max_value) ((a) < (max_value) ? (a) : (max_value)) -#define MORE(a, min_value) ((a) > (min_value) ? (a) : (min_value)) -#define INNER(a, b, c) (((b) <= (c) && (a) >= (b) && (a) <= (c)) || ((b) >= (c) && (a) >= (c) && (a) <= (b))) -#define OUTER(a, b, c) (!INNER((a), (b), (c))) -#define MAKESURE(a, b, c) (((b) <= (c)) ? (MORE(LESS((a), (c)), (b))) : (MORE(LESS((a), (b)), (c)))) -#define MIN(a, b) ((a) >= (b) ? (b) : (a)) -#define MAX(a, b) ((a) >= (b) ? (a) : (b)) -#define EQUAL_BOOL(a, b) (((a) && (b)) || ((!(a)) && (!(b)))) - -#ifdef OS_WIN32 -// NDIS 5.0 related -#include "NDIS5.h" -#endif // OS_WIN32 - -// Lock -typedef struct _NEO_LOCK -{ -#ifdef OS_WIN32 - NDIS_SPIN_LOCK spin_lock; -#endif -} NEO_LOCK; - -// Event -typedef struct _NEO_EVENT -{ -#ifdef OS_WIN32 -#ifndef WIN9X - KEVENT *event; - HANDLE event_handle; -#else // WIN9X - DWORD win32_event; -#endif // WIN9X -#endif -} NEO_EVENT; - -// Packet queue -typedef struct _NEO_QUEUE -{ - struct _NEO_QUEUE *Next; - UINT Size; - void *Buf; -} NEO_QUEUE; - -// Status -typedef struct _NEO_STATUS -{ - UINT NumPacketSend; - UINT NumPacketRecv; - UINT NumPacketSendError; - UINT NumPacketRecvError; - UINT NumPacketRecvNoBuffer; -} NEO_STATUS; - -// NDIS packet buffer -typedef struct _PACKET_BUFFER -{ - void *Buf; // Buffer - NDIS_PACKET *NdisPacket; // NDIS packet - NDIS_BUFFER *NdisBuffer; // NDIS packet buffer - NDIS_HANDLE PacketPool; // Packet pool - NDIS_HANDLE BufferPool; // Buffer pool -} PACKET_BUFFER; - -// Context -typedef struct _NEO_CTX -{ - NEO_EVENT *Event; // Packet reception notification event - BOOL Opened; // Flag of whether opened - BOOL Inited; // Initialization flag - BOOL Initing; // Starting-up flag - volatile BOOL Halting; // Halting flag - BYTE MacAddress[6]; // MAC address - BYTE padding[2]; // padding - NEO_QUEUE *PacketQueue; // Transmission packet queue - NEO_QUEUE *Tail; // Tail of the transmission packet queue - UINT NumPacketQueue; // Number of queued packet - NEO_LOCK *PacketQueueLock; // Transmission packet queue lock - NEO_STATUS Status; // Status - UINT CurrentPacketFilter; // Current packet filter value - UINT CurrentProtocolOptions; // Current protocol option value - BOOL Connected, ConnectedOld; // Cable connection state - BOOL ConnectedForce; // Connection state forcibly notification -#ifdef OS_WIN32 - NDIS_HANDLE NdisWrapper; // NDIS wrapper handle - NDIS_HANDLE NdisControl; // NDIS control handle - NDIS_HANDLE NdisMiniport; // NDIS miniport handle - NDIS_HANDLE NdisContext; // NDIS context handle - NDIS_HANDLE NdisConfig; // NDIS Config handle - DEVICE_OBJECT *NdisControlDevice; // NDIS control device - PDRIVER_DISPATCH DispatchTable[IRP_MJ_MAXIMUM_FUNCTION]; - PACKET_BUFFER *PacketBuffer[NEO_MAX_PACKET_EXCHANGE]; // NDIS packet buffer - NDIS_PACKET *PacketBufferArray[NEO_MAX_PACKET_EXCHANGE]; // NDIS packet buffer array - NDIS_HARDWARE_STATUS HardwareStatus; // Hardware state - char HardwareID[MAX_SIZE]; // Hardware ID - char HardwareID_Raw[MAX_SIZE]; // Original hardware ID - char HardwarePrintableID[MAX_SIZE]; // Hardware ID (for display) -#endif -} NEO_CTX; - -extern NEO_CTX *ctx; - - -// Neo.c routine -void NeoNewStatus(NEO_STATUS *s); -void NeoFreeStatus(NEO_STATUS *s); -BOOL NeoInit(); -void NeoShutdown(); -void NeoInitPacketQueue(); -void NeoFreePacketQueue(); -void NeoClearPacketQueue(); -void NeoLockPacketQueue(); -void NeoUnlockPacketQueue(); -NEO_QUEUE *NeoGetNextQueue(); -void NeoFreeQueue(NEO_QUEUE *q); -void NeoInsertQueue(void *buf, UINT size); -UINT NeoGetNumQueue(); -void NeoStartAdapter(); -void NeoStopAdapter(); -void NeoRead(void *buf); -void NeoWrite(void *buf); - -// Common routine (platform dependent) -void *NeoMalloc(UINT size); -void *NeoZeroMalloc(UINT size); -void NeoFree(void *p); -void NeoCopy(void *dst, void *src, UINT size); -void NeoZero(void *dst, UINT size); -NEO_LOCK *NeoNewLock(); -void NeoLock(NEO_LOCK *lock); -void NeoUnlock(NEO_LOCK *lock); -void NeoFreeLock(NEO_LOCK *lock); -NEO_EVENT *NeoNewEvent(char *name); -NEO_EVENT *NeoCreateWin9xEvent(DWORD h); -void NeoFreeEvent(NEO_EVENT *event); -void NeoSet(NEO_EVENT *event); -void NeoReset(NEO_EVENT *event); - -#endif // NEO_DEVICE_DRIVER - - -#endif // NEO_H - - - +// SoftEther VPN Source Code - Developer Edition Master Branch +// Kernel Device Driver + + +// Neo.h +// Header of Neo.c + +#ifndef NEO_H +#define NEO_H + + +// Identification string (NDIS) +#define NDIS_NEO_HARDWARE_ID "VPN Client Adapter - %s" +#define NDIS_NEO_DEVICE_NAME "\\Device\\NEO_%s_DEVICE" +#define NDIS_NEO_DEVICE_NAME_WIN32 "\\DosDevices\\NEO_%s_DEVICE" +#define NDIS_NEO_DEVICE_FILE_NAME "\\\\.\\NEO_NEOADAPTER_%s_DEVICE" +#define NDIS_NEO_EVENT_NAME "\\BaseNamedObjects\\NEO_EVENT_%s" +#define NDIS_NEO_EVENT_NAME_WIN32 "Global\\NEO_EVENT_NEOADAPTER_%s" + +// Constant +#define NEO_MAX_PACKET_SIZE 1600 +#define NEO_MAX_PACKET_SIZE_ANNOUNCE 1514 +#define NEO_MIN_PACKET_SIZE 14 +#define NEO_PACKET_HEADER_SIZE 14 +#define NEO_MAX_FRAME_SIZE (NEO_MAX_PACKET_SIZE - NEO_MIN_PACKET_SIZE) +#define NEO_MAX_SPEED_DEFAULT 1000000 +#define NEO_MAC_ADDRESS_SIZE 6 +#define NEO_MAX_MULTICASE 32 + + +// IOCTL constant +#define NEO_IOCTL_SET_EVENT CTL_CODE(0x8000, 0, METHOD_BUFFERED, FILE_ANY_ACCESS) +#define NEO_IOCTL_PUT_PACKET CTL_CODE(0x8000, 1, METHOD_BUFFERED, FILE_ANY_ACCESS) +#define NEO_IOCTL_GET_PACKET CTL_CODE(0x8000, 2, METHOD_BUFFERED, FILE_ANY_ACCESS) + + +// Packet data exchange related +#define NEO_MAX_PACKET_EXCHANGE 256 // Number of packets that can be exchanged at a time +#define NEO_MAX_PACKET_QUEUED 4096 // Maximum number of packets that can be queued +#define NEO_EX_SIZEOF_NUM_PACKET 4 // Packet count data (UINT) +#define NEO_EX_SIZEOF_LENGTH_PACKET 4 // Length data of the packet data (UINT) +#define NEO_EX_SIZEOF_LEFT_FLAG 4 // Flag to indicate that the packet is still +#define NEO_EX_SIZEOF_ONE_PACKET 1600 // Data area occupied by a packet data +#define NEO_EXCHANGE_BUFFER_SIZE (NEO_EX_SIZEOF_NUM_PACKET + NEO_EX_SIZEOF_LEFT_FLAG + \ + (NEO_EX_SIZEOF_LENGTH_PACKET + NEO_EX_SIZEOF_ONE_PACKET) * (NEO_MAX_PACKET_EXCHANGE + 1)) +#define NEO_NUM_PACKET(buf) (*((UINT *)((UCHAR *)buf + 0))) +#define NEO_SIZE_OF_PACKET(buf, i) (*((UINT *)((UCHAR *)buf + NEO_EX_SIZEOF_NUM_PACKET + \ + (i * (NEO_EX_SIZEOF_LENGTH_PACKET + NEO_EX_SIZEOF_ONE_PACKET))))) +#define NEO_ADDR_OF_PACKET(buf, i) (((UINT *)((UCHAR *)buf + NEO_EX_SIZEOF_NUM_PACKET + \ + NEO_EX_SIZEOF_LENGTH_PACKET + \ + (i * (NEO_EX_SIZEOF_LENGTH_PACKET + NEO_EX_SIZEOF_ONE_PACKET))))) +#define NEO_LEFT_FLAG(buf) NEO_SIZE_OF_PACKET(buf, NEO_MAX_PACKET_EXCHANGE) + + + +// Definitions needed to compile as a device driver +#ifdef NEO_DEVICE_DRIVER + +// OS determination +#ifdef WIN32 +#define OS_WIN32 // Microsoft Windows +#else +#define OS_UNIX // UNIX / Linux +#endif + + +// Type declaration +#ifndef WINDOWS_H_INCLUDED +#ifndef WIN9X +typedef unsigned long BOOL; +#endif // WIN9X +#define TRUE 1 +#define FALSE 0 +#endif +typedef unsigned long bool; +#define true 1 +#define false 0 +typedef unsigned long long UINT64; +typedef signed long long INT64; +typedef unsigned short WORD; +typedef unsigned short USHORT; +typedef signed short SHORT; +typedef unsigned char BYTE; +typedef unsigned char UCHAR; +typedef signed char CHAR; +typedef unsigned long DWORD; +#define INFINITE 0xFFFFFFFF + +#define LESS(a, max_value) ((a) < (max_value) ? (a) : (max_value)) +#define MORE(a, min_value) ((a) > (min_value) ? (a) : (min_value)) +#define INNER(a, b, c) (((b) <= (c) && (a) >= (b) && (a) <= (c)) || ((b) >= (c) && (a) >= (c) && (a) <= (b))) +#define OUTER(a, b, c) (!INNER((a), (b), (c))) +#define MAKESURE(a, b, c) (((b) <= (c)) ? (MORE(LESS((a), (c)), (b))) : (MORE(LESS((a), (b)), (c)))) +#define MIN(a, b) ((a) >= (b) ? (b) : (a)) +#define MAX(a, b) ((a) >= (b) ? (a) : (b)) +#define EQUAL_BOOL(a, b) (((a) && (b)) || ((!(a)) && (!(b)))) + +#ifdef OS_WIN32 +// NDIS 5.0 related +#include "NDIS5.h" +#endif // OS_WIN32 + +// Lock +typedef struct _NEO_LOCK +{ +#ifdef OS_WIN32 + NDIS_SPIN_LOCK spin_lock; +#endif +} NEO_LOCK; + +// Event +typedef struct _NEO_EVENT +{ +#ifdef OS_WIN32 +#ifndef WIN9X + KEVENT *event; + HANDLE event_handle; +#else // WIN9X + DWORD win32_event; +#endif // WIN9X +#endif +} NEO_EVENT; + +// Packet queue +typedef struct _NEO_QUEUE +{ + struct _NEO_QUEUE *Next; + UINT Size; + void *Buf; +} NEO_QUEUE; + +// Status +typedef struct _NEO_STATUS +{ + UINT NumPacketSend; + UINT NumPacketRecv; + UINT NumPacketSendError; + UINT NumPacketRecvError; + UINT NumPacketRecvNoBuffer; +} NEO_STATUS; + +// NDIS packet buffer +typedef struct _PACKET_BUFFER +{ + void *Buf; // Buffer + NDIS_PACKET *NdisPacket; // NDIS packet + NDIS_BUFFER *NdisBuffer; // NDIS packet buffer + NDIS_HANDLE PacketPool; // Packet pool + NDIS_HANDLE BufferPool; // Buffer pool +} PACKET_BUFFER; + +// Context +typedef struct _NEO_CTX +{ + NEO_EVENT *Event; // Packet reception notification event + BOOL Opened; // Flag of whether opened + BOOL Inited; // Initialization flag + BOOL Initing; // Starting-up flag + volatile BOOL Halting; // Halting flag + BYTE MacAddress[6]; // MAC address + BYTE padding[2]; // padding + NEO_QUEUE *PacketQueue; // Transmission packet queue + NEO_QUEUE *Tail; // Tail of the transmission packet queue + UINT NumPacketQueue; // Number of queued packet + NEO_LOCK *PacketQueueLock; // Transmission packet queue lock + NEO_STATUS Status; // Status + UINT CurrentPacketFilter; // Current packet filter value + UINT CurrentProtocolOptions; // Current protocol option value + BOOL Connected, ConnectedOld; // Cable connection state + BOOL ConnectedForce; // Connection state forcibly notification +#ifdef OS_WIN32 + NDIS_HANDLE NdisWrapper; // NDIS wrapper handle + NDIS_HANDLE NdisControl; // NDIS control handle + NDIS_HANDLE NdisMiniport; // NDIS miniport handle + NDIS_HANDLE NdisContext; // NDIS context handle + NDIS_HANDLE NdisConfig; // NDIS Config handle + DEVICE_OBJECT *NdisControlDevice; // NDIS control device + PDRIVER_DISPATCH DispatchTable[IRP_MJ_MAXIMUM_FUNCTION]; + PACKET_BUFFER *PacketBuffer[NEO_MAX_PACKET_EXCHANGE]; // NDIS packet buffer + NDIS_PACKET *PacketBufferArray[NEO_MAX_PACKET_EXCHANGE]; // NDIS packet buffer array + NDIS_HARDWARE_STATUS HardwareStatus; // Hardware state + char HardwareID[MAX_SIZE]; // Hardware ID + char HardwareID_Raw[MAX_SIZE]; // Original hardware ID + char HardwarePrintableID[MAX_SIZE]; // Hardware ID (for display) +#endif +} NEO_CTX; + +extern NEO_CTX *ctx; + + +// Neo.c routine +void NeoNewStatus(NEO_STATUS *s); +void NeoFreeStatus(NEO_STATUS *s); +BOOL NeoInit(); +void NeoShutdown(); +void NeoInitPacketQueue(); +void NeoFreePacketQueue(); +void NeoClearPacketQueue(); +void NeoLockPacketQueue(); +void NeoUnlockPacketQueue(); +NEO_QUEUE *NeoGetNextQueue(); +void NeoFreeQueue(NEO_QUEUE *q); +void NeoInsertQueue(void *buf, UINT size); +UINT NeoGetNumQueue(); +void NeoStartAdapter(); +void NeoStopAdapter(); +void NeoRead(void *buf); +void NeoWrite(void *buf); + +// Common routine (platform dependent) +void *NeoMalloc(UINT size); +void *NeoZeroMalloc(UINT size); +void NeoFree(void *p); +void NeoCopy(void *dst, void *src, UINT size); +void NeoZero(void *dst, UINT size); +NEO_LOCK *NeoNewLock(); +void NeoLock(NEO_LOCK *lock); +void NeoUnlock(NEO_LOCK *lock); +void NeoFreeLock(NEO_LOCK *lock); +NEO_EVENT *NeoNewEvent(char *name); +NEO_EVENT *NeoCreateWin9xEvent(DWORD h); +void NeoFreeEvent(NEO_EVENT *event); +void NeoSet(NEO_EVENT *event); +void NeoReset(NEO_EVENT *event); + +#endif // NEO_DEVICE_DRIVER + + +#endif // NEO_H + + + diff --git a/src/Neo/Neo.rc b/src/Neo/Neo.rc index c0238161..1dde551d 100644 --- a/src/Neo/Neo.rc +++ b/src/Neo/Neo.rc @@ -1,63 +1,63 @@ -// Microsoft Visual C++ generated resource script. -// -#include "resource.h" - -#define APSTUDIO_READONLY_SYMBOLS -///////////////////////////////////////////////////////////////////////////// -// -// Generated from the TEXTINCLUDE 2 resource. -// -#include "winres.h" - -///////////////////////////////////////////////////////////////////////////// -#undef APSTUDIO_READONLY_SYMBOLS - -///////////////////////////////////////////////////////////////////////////// -// Japanese resources - -#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_JPN) -#ifdef _WIN32 -LANGUAGE LANG_JAPANESE, SUBLANG_DEFAULT -#pragma code_page(932) -#endif //_WIN32 - -#ifdef APSTUDIO_INVOKED -///////////////////////////////////////////////////////////////////////////// -// -// TEXTINCLUDE -// - -1 TEXTINCLUDE -BEGIN - "resource.h\0" -END - -2 TEXTINCLUDE -BEGIN - "#include ""winres.h""\r\n" - "\0" -END - -3 TEXTINCLUDE -BEGIN - "\r\n" - "\0" -END - -#endif // APSTUDIO_INVOKED - -#endif // Japanese resources -///////////////////////////////////////////////////////////////////////////// - - - -#ifndef APSTUDIO_INVOKED -///////////////////////////////////////////////////////////////////////////// -// -// Generated from the TEXTINCLUDE 3 resource. -// - - -///////////////////////////////////////////////////////////////////////////// -#endif // not APSTUDIO_INVOKED - +// Microsoft Visual C++ generated resource script. +// +#include "resource.h" + +#define APSTUDIO_READONLY_SYMBOLS +///////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 2 resource. +// +#include "winres.h" + +///////////////////////////////////////////////////////////////////////////// +#undef APSTUDIO_READONLY_SYMBOLS + +///////////////////////////////////////////////////////////////////////////// +// Japanese resources + +#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_JPN) +#ifdef _WIN32 +LANGUAGE LANG_JAPANESE, SUBLANG_DEFAULT +#pragma code_page(932) +#endif //_WIN32 + +#ifdef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// TEXTINCLUDE +// + +1 TEXTINCLUDE +BEGIN + "resource.h\0" +END + +2 TEXTINCLUDE +BEGIN + "#include ""winres.h""\r\n" + "\0" +END + +3 TEXTINCLUDE +BEGIN + "\r\n" + "\0" +END + +#endif // APSTUDIO_INVOKED + +#endif // Japanese resources +///////////////////////////////////////////////////////////////////////////// + + + +#ifndef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 3 resource. +// + + +///////////////////////////////////////////////////////////////////////////// +#endif // not APSTUDIO_INVOKED + diff --git a/src/Neo/Neo.vcproj b/src/Neo/Neo.vcproj index ea1ae0cc..86e6ab53 100644 --- a/src/Neo/Neo.vcproj +++ b/src/Neo/Neo.vcproj @@ -1,280 +1,280 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/Neo/resource.h b/src/Neo/resource.h index 60389936..cf989203 100644 --- a/src/Neo/resource.h +++ b/src/Neo/resource.h @@ -1,15 +1,15 @@ -//{{NO_DEPENDENCIES}} -// Microsoft Visual C++ generated include file. -// Used by Neo.rc - - -// Next default values for new objects -// -#ifdef APSTUDIO_INVOKED -#ifndef APSTUDIO_READONLY_SYMBOLS -#define _APS_NEXT_RESOURCE_VALUE 101 -#define _APS_NEXT_COMMAND_VALUE 40001 -#define _APS_NEXT_CONTROL_VALUE 1001 -#define _APS_NEXT_SYMED_VALUE 101 -#endif -#endif +//{{NO_DEPENDENCIES}} +// Microsoft Visual C++ generated include file. +// Used by Neo.rc + + +// Next default values for new objects +// +#ifdef APSTUDIO_INVOKED +#ifndef APSTUDIO_READONLY_SYMBOLS +#define _APS_NEXT_RESOURCE_VALUE 101 +#define _APS_NEXT_COMMAND_VALUE 40001 +#define _APS_NEXT_CONTROL_VALUE 1001 +#define _APS_NEXT_SYMED_VALUE 101 +#endif +#endif diff --git a/src/Neo6/NDIS6.c b/src/Neo6/NDIS6.c index 9532f9fe..8f05ee64 100644 --- a/src/Neo6/NDIS6.c +++ b/src/Neo6/NDIS6.c @@ -1,1860 +1,1860 @@ -// SoftEther VPN Source Code - Developer Edition Master Branch -// Kernel Device Driver - - -// NDIS6.c -// Windows NDIS 6.2 Routine - -#include - -#define NEO_DEVICE_DRIVER - -#include "Neo6.h" - -static UINT64 max_speed = NEO_MAX_SPEED_DEFAULT; -static bool keep_link = false; -static UINT reg_if_type = IF_TYPE_ETHERNET_CSMACD; - -BOOLEAN -PsGetVersion( - PULONG MajorVersion OPTIONAL, - PULONG MinorVersion OPTIONAL, - PULONG BuildNumber OPTIONAL, - PUNICODE_STRING CSDVersion OPTIONAL - ); - -// Memory related -static NDIS_PHYSICAL_ADDRESS HighestAcceptableMax = NDIS_PHYSICAL_ADDRESS_CONST(-1, -1); -NDIS_HANDLE ndis_miniport_driver_handle = NULL; - -// Flag for whether Windows 8 -bool g_is_win8 = false; - -// Win32 driver entry point -NDIS_STATUS DriverEntry(DRIVER_OBJECT *DriverObject, UNICODE_STRING *RegistryPath) -{ - NDIS_MINIPORT_DRIVER_CHARACTERISTICS miniport; - ULONG os_major_ver = 0, os_minor_ver = 0; - NDIS_STATUS ret; - - // Initialize the Neo library - if (NeoInit() == FALSE) - { - // Initialization Failed - return STATUS_UNSUCCESSFUL; - } - - g_is_win8 = false; - - // Get the OS version - PsGetVersion(&os_major_ver, &os_minor_ver, NULL, NULL); - - if (os_major_ver >= 7 || (os_major_ver == 6 && os_minor_ver >= 2)) - { - // Windows 8 - g_is_win8 = true; - } - - // Register a NDIS miniport driver - NeoZero(&miniport, sizeof(NDIS_MINIPORT_DRIVER_CHARACTERISTICS)); - - miniport.Header.Type = NDIS_OBJECT_TYPE_MINIPORT_DRIVER_CHARACTERISTICS; - miniport.Header.Revision = NDIS_MINIPORT_DRIVER_CHARACTERISTICS_REVISION_2; - miniport.Header.Size = NDIS_SIZEOF_MINIPORT_DRIVER_CHARACTERISTICS_REVISION_2; - - miniport.MajorNdisVersion = NEO_NDIS_MAJOR_VERSION; - miniport.MinorNdisVersion = NEO_NDIS_MINOR_VERSION; - - // Register the handler - miniport.InitializeHandlerEx = NeoNdisInitEx; - miniport.HaltHandlerEx = NeoNdisHaltEx; - miniport.OidRequestHandler = NeoNdisOidRequest; - miniport.ResetHandlerEx = NeoNdisResetEx; - miniport.CheckForHangHandlerEx = NeoNdisCheckForHangEx; - miniport.UnloadHandler = NeoNdisDriverUnload; - miniport.SendNetBufferListsHandler = NeoNdisSendNetBufferLists; - - miniport.SetOptionsHandler = NeoNdisSetOptions; - miniport.PauseHandler = NeoNdisPause; - miniport.RestartHandler = NeoNdisRestart; - miniport.ReturnNetBufferListsHandler = NeoNdisReturnNetBufferLists; - miniport.CancelSendHandler = NeoNdisCancelSend; - miniport.DevicePnPEventNotifyHandler = NeoNdisDevicePnPEventNotify; - miniport.ShutdownHandlerEx = NeoNdisShutdownEx; - miniport.CancelOidRequestHandler = NeoNdisCancelOidRequest; - - ret = NdisMRegisterMiniportDriver(DriverObject, RegistryPath, - NULL, &miniport, &ndis_miniport_driver_handle); - - if (NG(ret)) - { - // Registration failure - return STATUS_UNSUCCESSFUL; - } - - // Initialization success - return STATUS_SUCCESS; -} - -NDIS_STATUS NeoNdisSetOptions(NDIS_HANDLE NdisDriverHandle, NDIS_HANDLE DriverContext) -{ - return NDIS_STATUS_SUCCESS; -} - -NDIS_STATUS NeoNdisPause(NDIS_HANDLE MiniportAdapterContext, PNDIS_MINIPORT_PAUSE_PARAMETERS MiniportPauseParameters) -{ - UINT counter_dbg = 0; - - ctx->Paused = true; - - NeoLockPacketQueue(); - NeoUnlockPacketQueue(); - - // Wait for complete all tasks - while (ctx->NumCurrentDispatch != 0) - { - NdisMSleep(10000); - counter_dbg++; - if (counter_dbg >= 1500) - { - break; - } - } - - return NDIS_STATUS_SUCCESS; -} - -NDIS_STATUS NeoNdisRestart(NDIS_HANDLE MiniportAdapterContext, PNDIS_MINIPORT_RESTART_PARAMETERS MiniportRestartParameters) -{ - ctx->Paused = false; - - return NDIS_STATUS_SUCCESS; -} - -void NeoNdisReturnNetBufferLists(NDIS_HANDLE MiniportAdapterContext, PNET_BUFFER_LIST NetBufferLists, ULONG ReturnFlags) -{ -} - -void NeoNdisCancelSend(NDIS_HANDLE MiniportAdapterContext, PVOID CancelId) -{ - //NeoNdisCrash2(__LINE__, __LINE__, __LINE__, __LINE__); -} - -void NeoNdisDevicePnPEventNotify(NDIS_HANDLE MiniportAdapterContext, PNET_DEVICE_PNP_EVENT NetDevicePnPEvent) -{ -} - -void NeoNdisShutdownEx(NDIS_HANDLE MiniportAdapterContext, NDIS_SHUTDOWN_ACTION ShutdownAction) -{ -} - -void NeoNdisCancelOidRequest(NDIS_HANDLE MiniportAdapterContext, PVOID RequestId) -{ - //NeoNdisCrash2(__LINE__, __LINE__, __LINE__, __LINE__); -} - -// Initialization handler of adapter -NDIS_STATUS NeoNdisInitEx(NDIS_HANDLE MiniportAdapterHandle, - NDIS_HANDLE MiniportDriverContext, - PNDIS_MINIPORT_INIT_PARAMETERS MiniportInitParameters) -{ - NDIS_MINIPORT_ADAPTER_REGISTRATION_ATTRIBUTES attr; - NDIS_MINIPORT_ADAPTER_GENERAL_ATTRIBUTES gen; - NDIS_PM_CAPABILITIES pnpcap; - - if (ctx == NULL) - { - return NDIS_STATUS_FAILURE; - } - - if (ctx->NdisMiniportDriverHandle == NULL) - { - ctx->NdisMiniportDriverHandle = ndis_miniport_driver_handle; - } - - // Prevention of multiple start - if (ctx->Initing != FALSE) - { - // Multiple started - return NDIS_STATUS_FAILURE; - } - ctx->Initing = TRUE; - - // Examine whether it has already been initialized - if (ctx->Inited != FALSE) - { - // Driver is started on another instance already. - // VPN driver can start only one instance per one service. - // User can start multiple drivers with different instance ID - return NDIS_STATUS_FAILURE; - } - - // Current value of the packet filter - ctx->CurrentPacketFilter = NDIS_PACKET_TYPE_ALL_LOCAL | NDIS_PACKET_TYPE_BROADCAST | NDIS_PACKET_TYPE_DIRECTED | NDIS_PACKET_TYPE_ALL_FUNCTIONAL; - - // Initialize the adapter information - ctx->NdisMiniport = MiniportAdapterHandle; - ctx->NdisContext = ctx; - ctx->HardwareStatus = NdisHardwareStatusReady; - ctx->Halting = FALSE; - ctx->Connected = ctx->ConnectedOld = FALSE; - - //if (keep_link == false) - { - ctx->ConnectedForce = TRUE; - } - - // Read the information from the registry - if (NeoLoadRegistry() == FALSE) - { - // Failure - ctx->Initing = FALSE; - return NDIS_STATUS_FAILURE; - } - - // Register the device attributes - NeoZero(&attr, sizeof(attr)); - attr.Header.Type = NDIS_OBJECT_TYPE_MINIPORT_ADAPTER_REGISTRATION_ATTRIBUTES; - attr.Header.Revision = NDIS_MINIPORT_ADAPTER_REGISTRATION_ATTRIBUTES_REVISION_1; - attr.Header.Size = sizeof(NDIS_MINIPORT_ADAPTER_REGISTRATION_ATTRIBUTES); - attr.AttributeFlags = NDIS_MINIPORT_ATTRIBUTES_NO_HALT_ON_SUSPEND; - attr.InterfaceType = NdisInterfaceInternal; - attr.MiniportAdapterContext = ctx->NdisContext; - - NdisMSetMiniportAttributes(ctx->NdisMiniport, (PNDIS_MINIPORT_ADAPTER_ATTRIBUTES)&attr); - - NeoZero(&pnpcap, sizeof(pnpcap)); - - NeoZero(&gen, sizeof(gen)); - gen.Header.Type = NDIS_OBJECT_TYPE_MINIPORT_ADAPTER_GENERAL_ATTRIBUTES; - gen.Header.Revision = NDIS_MINIPORT_ADAPTER_GENERAL_ATTRIBUTES_REVISION_2; - gen.Header.Size = NDIS_SIZEOF_MINIPORT_ADAPTER_GENERAL_ATTRIBUTES_REVISION_2; - gen.MediaType = NdisMedium802_3; - gen.PhysicalMediumType = NdisPhysicalMedium802_3; - gen.MtuSize = NEO_MAX_PACKET_SIZE_ANNOUNCE - NEO_MIN_PACKET_SIZE; - gen.MaxXmitLinkSpeed = gen.MaxRcvLinkSpeed = max_speed; - gen.RcvLinkSpeed = gen.XmitLinkSpeed = max_speed; - gen.MediaConnectState = MediaConnectStateDisconnected; - gen.LookaheadSize = NEO_MAX_PACKET_SIZE_ANNOUNCE - NEO_MIN_PACKET_SIZE; - gen.MacOptions = NDIS_MAC_OPTION_TRANSFERS_NOT_PEND | NDIS_MAC_OPTION_COPY_LOOKAHEAD_DATA | NDIS_MAC_OPTION_NO_LOOPBACK; - gen.SupportedPacketFilters = NDIS_PACKET_TYPE_ALL_LOCAL | NDIS_PACKET_TYPE_BROADCAST | NDIS_PACKET_TYPE_DIRECTED | NDIS_PACKET_TYPE_ALL_FUNCTIONAL; - gen.MaxMulticastListSize = NEO_MAX_MULTICASE; - gen.MacAddressLength = NEO_MAC_ADDRESS_SIZE; - NeoCopy(gen.PermanentMacAddress, ctx->MacAddress, NEO_MAC_ADDRESS_SIZE); - NeoCopy(gen.CurrentMacAddress, ctx->MacAddress, NEO_MAC_ADDRESS_SIZE); - gen.AccessType = NET_IF_ACCESS_BROADCAST; - gen.DirectionType = NET_IF_DIRECTION_SENDRECEIVE; - gen.ConnectionType = NET_IF_CONNECTION_DEDICATED; - gen.IfType = reg_if_type; - gen.IfConnectorPresent = FALSE; - gen.SupportedStatistics = - NDIS_STATISTICS_FLAGS_VALID_DIRECTED_FRAMES_RCV | - NDIS_STATISTICS_FLAGS_VALID_MULTICAST_FRAMES_RCV | - NDIS_STATISTICS_FLAGS_VALID_BROADCAST_FRAMES_RCV | - NDIS_STATISTICS_FLAGS_VALID_BYTES_RCV | - NDIS_STATISTICS_FLAGS_VALID_RCV_DISCARDS | - NDIS_STATISTICS_FLAGS_VALID_RCV_ERROR | - NDIS_STATISTICS_FLAGS_VALID_DIRECTED_FRAMES_XMIT | - NDIS_STATISTICS_FLAGS_VALID_MULTICAST_FRAMES_XMIT | - NDIS_STATISTICS_FLAGS_VALID_BROADCAST_FRAMES_XMIT | - NDIS_STATISTICS_FLAGS_VALID_BYTES_XMIT | - NDIS_STATISTICS_FLAGS_VALID_XMIT_ERROR | - NDIS_STATISTICS_FLAGS_VALID_XMIT_DISCARDS | - NDIS_STATISTICS_FLAGS_VALID_DIRECTED_BYTES_RCV | - NDIS_STATISTICS_FLAGS_VALID_MULTICAST_BYTES_RCV | - NDIS_STATISTICS_FLAGS_VALID_BROADCAST_BYTES_RCV | - NDIS_STATISTICS_FLAGS_VALID_DIRECTED_BYTES_XMIT | - NDIS_STATISTICS_FLAGS_VALID_MULTICAST_BYTES_XMIT | - NDIS_STATISTICS_FLAGS_VALID_BROADCAST_BYTES_XMIT; - gen.SupportedPauseFunctions = NdisPauseFunctionsUnsupported; - gen.AutoNegotiationFlags = NDIS_LINK_STATE_XMIT_LINK_SPEED_AUTO_NEGOTIATED | - NDIS_LINK_STATE_RCV_LINK_SPEED_AUTO_NEGOTIATED | - NDIS_LINK_STATE_DUPLEX_AUTO_NEGOTIATED | - NDIS_LINK_STATE_PAUSE_FUNCTIONS_AUTO_NEGOTIATED; - gen.SupportedOidList = SupportedOids; - gen.SupportedOidListLength = sizeof(SupportedOids); - - NeoZero(&pnpcap, sizeof(pnpcap)); - pnpcap.Header.Type = NDIS_OBJECT_TYPE_DEFAULT; - pnpcap.Header.Revision = NDIS_PM_CAPABILITIES_REVISION_1; - pnpcap.Header.Size = NDIS_SIZEOF_NDIS_PM_CAPABILITIES_REVISION_1; - pnpcap.MinMagicPacketWakeUp = NdisDeviceStateUnspecified; - pnpcap.MinPatternWakeUp = NdisDeviceStateUnspecified; - pnpcap.MinLinkChangeWakeUp = NdisDeviceStateUnspecified; - gen.PowerManagementCapabilitiesEx = &pnpcap; - - NdisMSetMiniportAttributes(ctx->NdisMiniport, (PNDIS_MINIPORT_ADAPTER_ATTRIBUTES)&gen); - - // Initialize the received packet array - NeoInitPacketArray(); - - // Initialize the control device - NeoInitControlDevice(); - - // Start the adapter - NeoStartAdapter(); - - // Flag setting - ctx->Initing = FALSE; - ctx->Inited = TRUE; - - // Notify the connection state - NeoSetConnectState(FALSE); - - return NDIS_STATUS_SUCCESS; -} - -// Open the device -BOOL NeoNdisOnOpen(IRP *irp, IO_STACK_LOCATION *stack) -{ - char name[MAX_SIZE]; - - if (ctx == NULL) - { - return FALSE; - } - - if (ctx->Opened) - { - // Another client is connected already - return FALSE; - } - ctx->Opened = TRUE; - - // Initialize the event name - sprintf(name, NDIS_NEO_EVENT_NAME, ctx->HardwareID); - - // Register a Event - ctx->Event = NeoNewEvent(name); - if (ctx->Event == NULL) - { - ctx->Opened = FALSE; - return FALSE; - } - - // Set the connection state - NeoSetConnectState(TRUE); - - return TRUE; -} - -// Close the device -BOOL NeoNdisOnClose(IRP *irp, IO_STACK_LOCATION *stack) -{ - NEO_EVENT *free_event = NULL; - if (ctx == NULL) - { - return FALSE; - } - - if (ctx->Opened == FALSE) - { - // Client is not connected - return FALSE; - } - ctx->Opened = FALSE; - - NeoLockPacketQueue(); - { - // Release the event - free_event = ctx->Event; - ctx->Event = NULL; - - // Release all packets - NeoClearPacketQueue(true); - } - NeoUnlockPacketQueue(); - - if (free_event != NULL) - { - NeoFreeEvent(free_event); - } - - NeoSetConnectState(FALSE); - - return TRUE; -} - -// Crash 2 -void NeoNdisCrash2(UINT a, UINT b, UINT c, UINT d) -{ - KeBugCheckEx(0x00000061, (ULONG_PTR)a, (ULONG_PTR)b, (ULONG_PTR)c, (ULONG_PTR)d); -} - -// Crash -void NeoNdisCrash() -{ - NEO_QUEUE *q; - q = (NEO_QUEUE *)0xACACACAC; - q->Size = 128; - NeoCopy(q->Buf, "ABCDEFG", 8); -} - -// Dispatch table for control -NTSTATUS NeoNdisDispatch(DEVICE_OBJECT *DeviceObject, IRP *Irp) -{ - NTSTATUS status; - IO_STACK_LOCATION *stack; - void *buf; - BOOL ok; - status = STATUS_SUCCESS; - - if (ctx == NULL) - { - return NDIS_STATUS_FAILURE; - } - - InterlockedIncrement(&ctx->NumCurrentDispatch); - - // Get the IRP stack - stack = IoGetCurrentIrpStackLocation(Irp); - - // Initialize the number of bytes - Irp->IoStatus.Information = 0; - Irp->IoStatus.Status = STATUS_SUCCESS; - - buf = Irp->UserBuffer; - - if (ctx->Halting != FALSE) - { - // Device driver is terminating - Irp->IoStatus.Information = STATUS_UNSUCCESSFUL; - InterlockedDecrement(&ctx->NumCurrentDispatch); - - IoCompleteRequest(Irp, IO_NO_INCREMENT); - - return STATUS_SUCCESS; - } - - // Branch to each operation - switch (stack->MajorFunction) - { - case IRP_MJ_CREATE: - // Device is opened - if (NeoNdisOnOpen(Irp, stack) == FALSE) - { - Irp->IoStatus.Status = STATUS_UNSUCCESSFUL; - status = STATUS_UNSUCCESSFUL; - } - break; - - case IRP_MJ_CLOSE: - // Device is closed - if (NeoNdisOnClose(Irp, stack) == FALSE) - { - Irp->IoStatus.Status = STATUS_UNSUCCESSFUL; - status = STATUS_UNSUCCESSFUL; - } - break; - - case IRP_MJ_READ: - // Read (Reading of the received packet) - ok = false; - if (buf != NULL) - { - if (ctx->Opened && ctx->Inited) - { - if (stack->Parameters.Read.Length == NEO_EXCHANGE_BUFFER_SIZE) - { - // Address check - bool check_ok = true; - __try - { - ProbeForWrite(buf, NEO_EXCHANGE_BUFFER_SIZE, 1); - } - __except (EXCEPTION_EXECUTE_HANDLER) - { - check_ok = false; - } - - if (check_ok) - { - // Address check - MDL *mdl = IoAllocateMdl(buf, NEO_EXCHANGE_BUFFER_SIZE, false, false, NULL); - - if (mdl != NULL) - { - MmProbeAndLockPages(mdl, KernelMode, IoWriteAccess); - } - - // Read - NeoRead(buf); - Irp->IoStatus.Information = NEO_EXCHANGE_BUFFER_SIZE; - ok = true; - - if (mdl != NULL) - { - MmUnlockPages(mdl); - IoFreeMdl(mdl); - } - } - } - } - } - if (ok == FALSE) - { - // An error occurred - Irp->IoStatus.Status = STATUS_UNSUCCESSFUL; - status = STATUS_UNSUCCESSFUL; - } - break; - - case IRP_MJ_WRITE: - // Write (Writing of a transmission packet) - ok = false; - if (buf != NULL) - { - if (ctx->Opened && ctx->Inited) - { - if (stack->Parameters.Write.Length == NEO_EXCHANGE_BUFFER_SIZE) - { - // Address check - bool check_ok = true; - __try - { - ProbeForRead(buf, NEO_EXCHANGE_BUFFER_SIZE, 1); - } - __except (EXCEPTION_EXECUTE_HANDLER) - { - check_ok = false; - } - - if (check_ok) - { - // Address check - MDL *mdl = IoAllocateMdl(buf, NEO_EXCHANGE_BUFFER_SIZE, false, false, NULL); - - if (mdl != NULL) - { - MmProbeAndLockPages(mdl, KernelMode, IoReadAccess); - } - __try - { - ProbeForRead(buf, NEO_EXCHANGE_BUFFER_SIZE, 1); - } - __except (EXCEPTION_EXECUTE_HANDLER) - { - check_ok = false; - } - if (check_ok) { - // Write - NeoWrite(buf); - Irp->IoStatus.Information = stack->Parameters.Write.Length; - ok = true; - - if (mdl != NULL) - { - MmUnlockPages(mdl); - IoFreeMdl(mdl); - } - } - } - } - } - } - if (ok == FALSE) - { - // An error occurred - Irp->IoStatus.Status = STATUS_UNSUCCESSFUL; - status = STATUS_UNSUCCESSFUL; - } - break; - } - - InterlockedDecrement(&ctx->NumCurrentDispatch); - - IoCompleteRequest(Irp, IO_NO_INCREMENT); - - return STATUS_SUCCESS; -} - -// Initialize the control device -void NeoInitControlDevice() -{ - char name_kernel[MAX_SIZE]; - char name_win32[MAX_SIZE]; - UNICODE *unicode_kernel, *unicode_win32; - DEVICE_OBJECT *control_device_object; - NDIS_HANDLE ndis_control_handle; - NDIS_DEVICE_OBJECT_ATTRIBUTES t; - - if (ctx == NULL) - { - return; - } - - // Initialize the dispatch table - NeoZero(ctx->DispatchTable, sizeof(PDRIVER_DISPATCH) * IRP_MJ_MAXIMUM_FUNCTION); - - // Register the handler - ctx->DispatchTable[IRP_MJ_CREATE] = - ctx->DispatchTable[IRP_MJ_CLOSE] = - ctx->DispatchTable[IRP_MJ_READ] = - ctx->DispatchTable[IRP_MJ_WRITE] = - ctx->DispatchTable[IRP_MJ_DEVICE_CONTROL] = NeoNdisDispatch; - ctx->Opened = FALSE; - ctx->Paused = FALSE; - - // Generate the device name - sprintf(name_kernel, NDIS_NEO_DEVICE_NAME, ctx->HardwareID); - unicode_kernel = NewUnicode(name_kernel); - sprintf(name_win32, NDIS_NEO_DEVICE_NAME_WIN32, ctx->HardwareID); - unicode_win32 = NewUnicode(name_win32); - - // Register the device - NeoZero(&t, sizeof(t)); - t.Header.Type = NDIS_OBJECT_TYPE_DEVICE_OBJECT_ATTRIBUTES; - t.Header.Revision = NDIS_DEVICE_OBJECT_ATTRIBUTES_REVISION_1; - t.Header.Size = NDIS_SIZEOF_DEVICE_OBJECT_ATTRIBUTES_REVISION_1; - t.DeviceName = GetUnicode(unicode_kernel); - t.SymbolicName = GetUnicode(unicode_win32); - t.MajorFunctions = ctx->DispatchTable; - - NdisRegisterDeviceEx(ndis_miniport_driver_handle, &t, - &control_device_object, - &ndis_control_handle); - - ctx->NdisControlDevice = control_device_object; - ctx->NdisControl = ndis_control_handle; - - // Initialize the display name - if (strlen(ctx->HardwareID) > 11) - { - sprintf(ctx->HardwarePrintableID, NDIS_NEO_HARDWARE_ID, ctx->HardwareID_Raw + 11); - } - else - { - sprintf(ctx->HardwarePrintableID, NDIS_NEO_HARDWARE_ID, ctx->HardwareID_Raw); - } -} - -// Release the control device -void NeoFreeControlDevice() -{ - if (ctx == NULL) - { - return; - } - - if (ctx->Opened != FALSE) - { - // Delete the event - NeoSet(ctx->Event); - NeoFreeEvent(ctx->Event); - ctx->Event = NULL; - ctx->Opened = FALSE; - } - - // Delete the device - NdisDeregisterDeviceEx(ctx->NdisControl); -} - - -// Read the information from the registry -BOOL NeoLoadRegistry() -{ - void *buf; - NDIS_STATUS ret; - UINT size; - NDIS_HANDLE config; - NDIS_CONFIGURATION_PARAMETER *param; - UNICODE *name; - ANSI_STRING ansi; - UNICODE_STRING *unicode; - UINT64 speed; - BOOL keep; - NDIS_CONFIGURATION_OBJECT config_obj; - - // Get the Config handle - NeoZero(&config_obj, sizeof(config_obj)); - config_obj.Header.Type = NDIS_OBJECT_TYPE_CONFIGURATION_OBJECT; - config_obj.Header.Revision = NDIS_CONFIGURATION_OBJECT_REVISION_1; - config_obj.Header.Size = NDIS_SIZEOF_CONFIGURATION_OBJECT_REVISION_1; - config_obj.NdisHandle = ctx->NdisMiniport; - - ret = NdisOpenConfigurationEx(&config_obj, &config); - if (NG(ret)) - { - // Failure - return FALSE; - } - - // Read the MAC address - NdisReadNetworkAddress(&ret, &buf, &size, config); - if (NG(ret)) - { - // Failure - NdisCloseConfiguration(config); - return FALSE; - } - - // Copy the MAC address - if (size != NEO_MAC_ADDRESS_SIZE) - { - // Invalid size - NdisCloseConfiguration(config); - return FALSE; - } - NeoCopy(ctx->MacAddress, buf, NEO_MAC_ADDRESS_SIZE); - - if (ctx->MacAddress[0] == 0x00 && - ctx->MacAddress[1] == 0x00 && - ctx->MacAddress[2] == 0x01 && - ctx->MacAddress[3] == 0x00 && - ctx->MacAddress[4] == 0x00 && - ctx->MacAddress[5] == 0x01) - { - // Special MAC address - UINT ptr32 = (UINT)((UINT64)ctx); - LARGE_INTEGER current_time; - UCHAR *current_time_bytes; - - KeQuerySystemTime(¤t_time); - - current_time_bytes = (UCHAR *)¤t_time; - - ctx->MacAddress[0] = 0x00; - ctx->MacAddress[1] = 0xAD; - ctx->MacAddress[2] = ((UCHAR *)(&ptr32))[0]; - ctx->MacAddress[3] = ((UCHAR *)(&ptr32))[1]; - ctx->MacAddress[4] = ((UCHAR *)(&ptr32))[2]; - ctx->MacAddress[5] = ((UCHAR *)(&ptr32))[3]; - - ctx->MacAddress[2] ^= current_time_bytes[0]; - ctx->MacAddress[3] ^= current_time_bytes[1]; - ctx->MacAddress[4] ^= current_time_bytes[2]; - ctx->MacAddress[5] ^= current_time_bytes[3]; - - ctx->MacAddress[2] ^= current_time_bytes[4]; - ctx->MacAddress[3] ^= current_time_bytes[5]; - ctx->MacAddress[4] ^= current_time_bytes[6]; - ctx->MacAddress[5] ^= current_time_bytes[7]; - } - - // Initialize the key name of the device name - name = NewUnicode("MatchingDeviceId"); - - // Read the hardware ID - NdisReadConfiguration(&ret, ¶m, config, GetUnicode(name), NdisParameterString); - FreeUnicode(name); - if (NG(ret)) - { - // Failure - NdisCloseConfiguration(config); - return FALSE; - } - // Type checking - if (param->ParameterType != NdisParameterString) - { - // Failure - NdisCloseConfiguration(config); - return FALSE; - } - unicode = ¶m->ParameterData.StringData; - - // Prepare a buffer for ANSI string - NeoZero(&ansi, sizeof(ANSI_STRING)); - ansi.MaximumLength = MAX_SIZE - 1; - ansi.Buffer = NeoZeroMalloc(MAX_SIZE); - - // Convert to ANSI string - NdisUnicodeStringToAnsiString(&ansi, unicode); - // Copy - strcpy(ctx->HardwareID, ansi.Buffer); - strcpy(ctx->HardwareID_Raw, ctx->HardwareID); - // Convert to upper case - _strupr(ctx->HardwareID); - // Release the memory - NeoFree(ansi.Buffer); - - // Read the bit rate - name = NewUnicode("MaxSpeed"); - NdisReadConfiguration(&ret, ¶m, config, GetUnicode(name), NdisParameterInteger); - FreeUnicode(name); - - if (NG(ret) || param->ParameterType != NdisParameterInteger) - { - speed = NEO_MAX_SPEED_DEFAULT; - } - else - { - speed = (UINT64)param->ParameterData.IntegerData * 1000000ULL; - } - - max_speed = speed; - - // Read the link keeping flag - name = NewUnicode("KeepLink"); - NdisReadConfiguration(&ret, ¶m, config, GetUnicode(name), NdisParameterInteger); - FreeUnicode(name); - - if (NG(ret) || param->ParameterType != NdisParameterInteger) - { - keep = false; - } - else - { - keep = (param->ParameterData.IntegerData == 0 ? false : true); - } - - keep_link = keep; - - // Read the *IfType value - name = NewUnicode("*IfType"); - NdisReadConfiguration(&ret, ¶m, config, GetUnicode(name), NdisParameterInteger); - FreeUnicode(name); - - if (NG(ret) || param->ParameterType != NdisParameterInteger) - { - reg_if_type = IF_TYPE_ETHERNET_CSMACD; - } - else - { - reg_if_type = param->ParameterData.IntegerData; - } - - // Close the config handle - NdisCloseConfiguration(config); - - return TRUE; -} - -// Unload the driver -VOID NeoNdisDriverUnload(PDRIVER_OBJECT DriverObject) -{ - NdisMDeregisterMiniportDriver(ndis_miniport_driver_handle); -} - -// Stop handler of adapter -void NeoNdisHaltEx(NDIS_HANDLE MiniportAdapterContext, NDIS_HALT_ACTION HaltAction) -{ - NEO_EVENT *free_event = NULL; - UINT counter_dbg = 0; - if (ctx == NULL) - { - return; - } - - if (ctx->Halting != FALSE) - { - // That has already been stopped - return; - } - ctx->Halting = TRUE; - - ctx->Opened = FALSE; - - NeoLockPacketQueue(); - { - // Release the event - free_event = ctx->Event; - ctx->Event = NULL; - - // Release all packets - NeoClearPacketQueue(true); - } - NeoUnlockPacketQueue(); - - if (free_event != NULL) - { - NeoSet(free_event); - } - - // Wait for complete all tasks - while (ctx->NumCurrentDispatch != 0) - { - NdisMSleep(10000); - counter_dbg++; - if (counter_dbg >= 1500) - { - break; - } - } - - if (free_event != NULL) - { - NeoFreeEvent(free_event); - } - - // Delete the control device - NeoFreeControlDevice(); - - // Stop the adapter - NeoStopAdapter(); - - // Release the packet array - NeoFreePacketArray(); - - // Complete to stop - ctx->Initing = ctx->Inited = FALSE; - ctx->Connected = ctx->ConnectedForce = ctx->ConnectedOld = FALSE; - ctx->Halting = FALSE; - - // Shutdown of Neo - NeoShutdown(); -} - -// Reset handler of adapter -NDIS_STATUS NeoNdisResetEx(NDIS_HANDLE MiniportAdapterContext, PBOOLEAN AddressingReset) -{ - return NDIS_STATUS_SUCCESS; -} - -// Hang-up check handler of adapter -BOOLEAN NeoNdisCheckForHangEx(NDIS_HANDLE MiniportAdapterContext) -{ - return FALSE; -} - -// OID request handler -NDIS_STATUS NeoNdisOidRequest(NDIS_HANDLE MiniportAdapterContext, - PNDIS_OID_REQUEST OidRequest) -{ - NDIS_STATUS ret = STATUS_UNSUCCESSFUL; - ULONG dummy = 0; - - switch (OidRequest->RequestType) - { - case NdisRequestQueryInformation: - case NdisRequestQueryStatistics: - ret = NeoNdisQuery(MiniportAdapterContext, - OidRequest->DATA.QUERY_INFORMATION.Oid, - OidRequest->DATA.QUERY_INFORMATION.InformationBuffer, - OidRequest->DATA.QUERY_INFORMATION.InformationBufferLength, - &OidRequest->DATA.QUERY_INFORMATION.BytesWritten, - &OidRequest->DATA.QUERY_INFORMATION.BytesNeeded); - break; - - case NdisRequestSetInformation: - ret = NeoNdisSet(MiniportAdapterContext, - OidRequest->DATA.SET_INFORMATION.Oid, - OidRequest->DATA.SET_INFORMATION.InformationBuffer, - OidRequest->DATA.SET_INFORMATION.InformationBufferLength, - &dummy, - &OidRequest->DATA.SET_INFORMATION.BytesNeeded); - break; - - default: - ret = NDIS_STATUS_NOT_SUPPORTED; - break; - } - - return ret; -} - - -// Information acquisition handler of adapter -NDIS_STATUS NeoNdisQuery(NDIS_HANDLE MiniportAdapterContext, - NDIS_OID Oid, - void *InformationBuffer, - ULONG InformationBufferLength, - ULONG *BytesWritten, - ULONG *BytesNeeded) -{ - NDIS_MEDIUM media; - void *buf; - UINT value32; - USHORT value16; - UINT size; - NDIS_STATISTICS_INFO stat; - NDIS_INTERRUPT_MODERATION_PARAMETERS intp; - - if (ctx == NULL) - { - return NDIS_STATUS_FAILURE; - } - - // Initialization - size = sizeof(UINT); - value32 = value16 = 0; - buf = &value32; - - // Branch processing - switch (Oid) - { - case OID_GEN_SUPPORTED_LIST: - // Return a list of supported OID - buf = SupportedOids; - size = sizeof(SupportedOids); - break; - - case OID_GEN_MAC_OPTIONS: - // Ethernet option - value32 = NDIS_MAC_OPTION_TRANSFERS_NOT_PEND | NDIS_MAC_OPTION_RECEIVE_SERIALIZED | - NDIS_MAC_OPTION_COPY_LOOKAHEAD_DATA | NDIS_MAC_OPTION_NO_LOOPBACK; - break; - - case OID_GEN_HARDWARE_STATUS: - // Hardware state - buf = &ctx->HardwareStatus; - size = sizeof(NDIS_HARDWARE_STATUS); - break; - - case OID_GEN_MEDIA_SUPPORTED: - case OID_GEN_MEDIA_IN_USE: - // Type of media - media = NdisMedium802_3; - buf = &media; - size = sizeof(NDIS_MEDIUM); - break; - - case OID_GEN_CURRENT_LOOKAHEAD: - case OID_GEN_MAXIMUM_LOOKAHEAD: - // Read-ahead available size - value32 = NEO_MAX_PACKET_SIZE_ANNOUNCE - NEO_MIN_PACKET_SIZE; - break; - - case OID_GEN_MAXIMUM_FRAME_SIZE: - // Maximum frame size - value32 = NEO_MAX_PACKET_SIZE_ANNOUNCE - NEO_MIN_PACKET_SIZE; - break; - - case OID_GEN_MAXIMUM_TOTAL_SIZE: - case OID_GEN_TRANSMIT_BLOCK_SIZE: - case OID_GEN_RECEIVE_BLOCK_SIZE: - // Maximum packet size - value32 = NEO_MAX_PACKET_SIZE_ANNOUNCE; - break; - - case OID_GEN_TRANSMIT_BUFFER_SPACE: - case OID_GEN_RECEIVE_BUFFER_SPACE: - // Buffer size - value32 = NEO_MAX_PACKET_SIZE_ANNOUNCE * NEO_MAX_PACKET_EXCHANGE; - break; - - case OID_GEN_LINK_SPEED: - // Communication speed - value32 = (UINT)(max_speed / 100); - break; - - case OID_GEN_VENDOR_ID: - // Vendor ID - NeoCopy(&value32, ctx->MacAddress, 3); - value32 &= 0xFFFFFF00; - value32 |= 0x01; - break; - - case OID_GEN_VENDOR_DESCRIPTION: - // Hardware ID - buf = ctx->HardwarePrintableID; - size = (UINT)strlen(ctx->HardwarePrintableID) + 1; - break; - - case OID_GEN_DRIVER_VERSION: - // Driver version - value16 = ((USHORT)NEO_NDIS_MAJOR_VERSION << 8) | NEO_NDIS_MINOR_VERSION; - buf = &value16; - size = sizeof(USHORT); - break; - - case OID_GEN_VENDOR_DRIVER_VERSION: - // Vendor driver version - value16 = ((USHORT)NEO_NDIS_MAJOR_VERSION << 8) | NEO_NDIS_MINOR_VERSION; - buf = &value16; - size = sizeof(USHORT); - break; - - case OID_802_3_PERMANENT_ADDRESS: - case OID_802_3_CURRENT_ADDRESS: - // MAC address - buf = ctx->MacAddress; - size = NEO_MAC_ADDRESS_SIZE; - break; - - case OID_802_3_MAXIMUM_LIST_SIZE: - // Number of multicast - value32 = NEO_MAX_MULTICASE; - break; - - case OID_GEN_MAXIMUM_SEND_PACKETS: - // Number of packets that can be sent at a time - value32 = NEO_MAX_PACKET_EXCHANGE; - break; - - case OID_GEN_XMIT_OK: - // Number of packets sent - value32 = ctx->Status.NumPacketSend; - break; - - case OID_GEN_RCV_OK: - // Number of received packets - value32 = ctx->Status.NumPacketRecv; - break; - - case OID_GEN_XMIT_ERROR: - // Number of transmission error packets - value32 = ctx->Status.NumPacketSendError; - break; - - case OID_GEN_RCV_ERROR: - // Number of error packets received - value32 = ctx->Status.NumPacketRecvError; - break; - - case OID_GEN_RCV_NO_BUFFER: - // Number of reception buffer shortage occurrences - value32 = ctx->Status.NumPacketRecvNoBuffer; - break; - - case OID_802_3_RCV_ERROR_ALIGNMENT: - // Number of errors - value32 = 0; - break; - - case OID_GEN_MEDIA_CONNECT_STATUS: - // Cable connection state - NeoCheckConnectState(); - if (keep_link == false) - { - value32 = ctx->Connected ? NdisMediaStateConnected : NdisMediaStateDisconnected; - } - else - { - value32 = NdisMediaStateConnected; - } - break; - - case OID_802_3_XMIT_ONE_COLLISION: - case OID_802_3_XMIT_MORE_COLLISIONS: - // Number of collisions - value32 = 0; - break; - - case OID_GEN_CURRENT_PACKET_FILTER: - // Current settings of the packet filter - value32 = ctx->CurrentPacketFilter; - break; - -/* case OID_GEN_PROTOCOL_OPTIONS: - // Current value of the protocol option - value32 = ctx->CurrentProtocolOptions; - break;*/ - - case OID_GEN_STATISTICS: - // Statistics (NDIS 6.0) - NeoZero(&stat, sizeof(stat)); - buf = &stat; - size = sizeof(stat); - - stat.Header.Type = NDIS_OBJECT_TYPE_DEFAULT; - stat.Header.Revision = NDIS_STATISTICS_INFO_REVISION_1; - stat.Header.Size = NDIS_SIZEOF_STATISTICS_INFO_REVISION_1; - stat.SupportedStatistics = - NDIS_STATISTICS_FLAGS_VALID_DIRECTED_FRAMES_RCV | - NDIS_STATISTICS_FLAGS_VALID_MULTICAST_FRAMES_RCV | - NDIS_STATISTICS_FLAGS_VALID_BROADCAST_FRAMES_RCV | - NDIS_STATISTICS_FLAGS_VALID_BYTES_RCV | - NDIS_STATISTICS_FLAGS_VALID_RCV_DISCARDS | - NDIS_STATISTICS_FLAGS_VALID_RCV_ERROR | - NDIS_STATISTICS_FLAGS_VALID_DIRECTED_FRAMES_XMIT | - NDIS_STATISTICS_FLAGS_VALID_MULTICAST_FRAMES_XMIT | - NDIS_STATISTICS_FLAGS_VALID_BROADCAST_FRAMES_XMIT | - NDIS_STATISTICS_FLAGS_VALID_BYTES_XMIT | - NDIS_STATISTICS_FLAGS_VALID_XMIT_ERROR | - NDIS_STATISTICS_FLAGS_VALID_XMIT_DISCARDS | - NDIS_STATISTICS_FLAGS_VALID_DIRECTED_BYTES_RCV | - NDIS_STATISTICS_FLAGS_VALID_MULTICAST_BYTES_RCV | - NDIS_STATISTICS_FLAGS_VALID_BROADCAST_BYTES_RCV | - NDIS_STATISTICS_FLAGS_VALID_DIRECTED_BYTES_XMIT | - NDIS_STATISTICS_FLAGS_VALID_MULTICAST_BYTES_XMIT | - NDIS_STATISTICS_FLAGS_VALID_BROADCAST_BYTES_XMIT; - - stat.ifInErrors = ctx->Status.Int64NumRecvError; - stat.ifHCInOctets = ctx->Status.Int64BytesRecvTotal; - stat.ifHCInUcastPkts = ctx->Status.Int64NumRecvUnicast; - stat.ifHCInBroadcastPkts = ctx->Status.Int64NumRecvBroadcast; - stat.ifHCOutOctets = ctx->Status.Int64BytesSendTotal; - stat.ifHCOutUcastPkts = ctx->Status.Int64NumSendUnicast; - stat.ifHCOutBroadcastPkts = ctx->Status.Int64NumSendBroadcast; - stat.ifOutErrors = ctx->Status.Int64NumSendError; - stat.ifHCInUcastOctets = ctx->Status.Int64BytesRecvUnicast; - stat.ifHCInBroadcastOctets = ctx->Status.Int64BytesRecvBroadcast; - stat.ifHCOutUcastOctets = ctx->Status.Int64BytesSendUnicast; - stat.ifHCOutBroadcastOctets = ctx->Status.Int64BytesSendBroadcast; - break; - - case OID_GEN_INTERRUPT_MODERATION: - // Interrupt Moderation (NDIS 6.0) - NeoZero(&intp, sizeof(intp)); - buf = &intp; - size = sizeof(intp); - - intp.Header.Type = NDIS_OBJECT_TYPE_DEFAULT; - intp.Header.Revision = NDIS_INTERRUPT_MODERATION_PARAMETERS_REVISION_1; - intp.Header.Size = NDIS_SIZEOF_INTERRUPT_MODERATION_PARAMETERS_REVISION_1; - intp.InterruptModeration = NdisInterruptModerationNotSupported; - break; - - default: - // Unknown OID - *BytesWritten = 0; - return NDIS_STATUS_INVALID_OID; - } - - if (size > InformationBufferLength) - { - // Undersize - *BytesNeeded = size; - *BytesWritten = 0; - return NDIS_STATUS_INVALID_LENGTH; - } - - // Data copy - NeoCopy(InformationBuffer, buf, size); - *BytesWritten = size; - - return NDIS_STATUS_SUCCESS; -} - -// Set the cable connection state -void NeoSetConnectState(BOOL connected) -{ - if (ctx == NULL) - { - return; - } - ctx->Connected = connected; - NeoCheckConnectState(); -} - -// Check the cable connection state -void NeoCheckConnectState() -{ - NDIS_STATUS_INDICATION t; - NDIS_LINK_STATE state; - if (ctx == NULL || ctx->NdisMiniport == NULL) - { - return; - } - - NeoZero(&t, sizeof(t)); - t.Header.Type = NDIS_OBJECT_TYPE_STATUS_INDICATION; - t.Header.Revision = NDIS_STATUS_INDICATION_REVISION_1; - t.Header.Size = NDIS_SIZEOF_STATUS_INDICATION_REVISION_1; - - t.SourceHandle = ctx->NdisMiniport; - - NeoZero(&state, sizeof(state)); - state.Header.Type = NDIS_OBJECT_TYPE_DEFAULT; - state.Header.Revision = NDIS_LINK_STATE_REVISION_1; - state.Header.Size = NDIS_SIZEOF_LINK_STATE_REVISION_1; - - state.MediaDuplexState = NdisPauseFunctionsSendAndReceive; - state.XmitLinkSpeed = state.RcvLinkSpeed = max_speed; - state.PauseFunctions = NdisPauseFunctionsUnsupported; - - t.StatusCode = NDIS_STATUS_LINK_STATE; - t.StatusBuffer = &state; - t.StatusBufferSize = sizeof(NDIS_LINK_STATE); - - if (keep_link == false) - { - if (ctx->ConnectedOld != ctx->Connected || ctx->ConnectedForce) - { - ctx->ConnectedForce = FALSE; - ctx->ConnectedOld = ctx->Connected; - if (ctx->Halting == FALSE) - { - state.MediaConnectState = ctx->Connected ? MediaConnectStateConnected : MediaConnectStateDisconnected; - NdisMIndicateStatusEx(ctx->NdisMiniport, &t); - } - } - } - else - { - if (ctx->ConnectedForce) - { - ctx->ConnectedForce = false; - - if (ctx->Halting == FALSE) - { - state.MediaConnectState = MediaConnectStateConnected; - NdisMIndicateStatusEx(ctx->NdisMiniport, &t); - } - } - } -} - -// Information setting handler of adapter -NDIS_STATUS NeoNdisSet( - NDIS_HANDLE MiniportAdapterContext, - NDIS_OID Oid, - void *InformationBuffer, - ULONG InformationBufferLength, - ULONG *BytesRead, - ULONG *BytesNeeded) -{ - if (ctx == NULL) - { - return STATUS_UNSUCCESSFUL; - } - - // Initialization - *BytesRead = 0; - *BytesNeeded = 0; - - // Branch processing - switch (Oid) - { - case OID_GEN_CURRENT_PACKET_FILTER: - /* Packet filter */ - if (InformationBufferLength != 4) - { - *BytesNeeded = 4; - return NDIS_STATUS_INVALID_LENGTH; - } - *BytesRead = 4; - ctx->CurrentPacketFilter = *((UINT *)InformationBuffer); - return NDIS_STATUS_SUCCESS; - -// case OID_GEN_PROTOCOL_OPTIONS: - /* Current protocol option value */ -/* if (InformationBufferLength != 4) - { - *BytesNeeded = 4; - return NDIS_STATUS_INVALID_LENGTH; - } - *BytesRead = 4; - ctx->CurrentProtocolOptions = *((UINT *)InformationBuffer); - return NDIS_STATUS_SUCCESS;*/ - - case OID_GEN_CURRENT_LOOKAHEAD: - /* Look ahead */ - if (InformationBufferLength != 4) - { - *BytesNeeded = 4; - return NDIS_STATUS_INVALID_LENGTH; - } - *BytesRead = 4; - return NDIS_STATUS_SUCCESS; - - case OID_GEN_LINK_PARAMETERS: - // NDIS 6.0 Link setting - *BytesRead = InformationBufferLength; - return NDIS_STATUS_SUCCESS; - - case OID_802_3_MULTICAST_LIST: - // Multicast list - *BytesRead = InformationBufferLength; - - return NDIS_STATUS_SUCCESS; - - case OID_PNP_SET_POWER: - case OID_PNP_QUERY_POWER: - // Power events - *BytesRead = InformationBufferLength; - - return NDIS_STATUS_SUCCESS; - } - - return NDIS_STATUS_INVALID_OID; -} - -// Set status values of NET_BUFFER_LISTs -void NeoNdisSetNetBufferListsStatus(NET_BUFFER_LIST *nbl, UINT status) -{ - if (nbl == NULL) - { - return; - } - - while (nbl != NULL) - { - NET_BUFFER_LIST_STATUS(nbl) = status; - - nbl = NET_BUFFER_LIST_NEXT_NBL(nbl); - } -} - -// Packet send handler -void NeoNdisSendNetBufferLists(NDIS_HANDLE MiniportAdapterContext, - NET_BUFFER_LIST *NetBufferLists, - NDIS_PORT_NUMBER PortNumber, - ULONG SendFlags) -{ - bool is_dispatch_level = SendFlags & NDIS_SEND_FLAGS_DISPATCH_LEVEL; - UINT send_complete_flags = 0; - if (ctx == NULL) - { - return; - } - - if (is_dispatch_level) - { - send_complete_flags |= NDIS_SEND_COMPLETE_FLAGS_DISPATCH_LEVEL; - } - - InterlockedIncrement(&ctx->NumCurrentDispatch); - - // Update the connection state - NeoCheckConnectState(); - - if (ctx->Halting != FALSE || ctx->Opened == FALSE || ctx->Paused) - { - UINT status = NDIS_STATUS_FAILURE; - - if (ctx->Paused) - { - status = NDIS_STATUS_PAUSED; - } - else if (ctx->Halting) - { - status = NDIS_STATUS_FAILURE; - } - else if (ctx->Opened == false && keep_link) - { - status = NDIS_STATUS_SUCCESS; - } - - NeoNdisSetNetBufferListsStatus(NetBufferLists, status); - - InterlockedDecrement(&ctx->NumCurrentDispatch); - - NdisMSendNetBufferListsComplete(ctx->NdisMiniport, NetBufferLists, send_complete_flags); - - return; - } - - // Operation of the packet queue - NeoLockPacketQueue(); - { - NET_BUFFER_LIST *nbl; - - if (ctx->Halting != FALSE || ctx->Opened == FALSE || ctx->Paused) - { - UINT status = NDIS_STATUS_FAILURE; - - if (ctx->Paused) - { - status = NDIS_STATUS_PAUSED; - } - else if (ctx->Halting) - { - status = NDIS_STATUS_FAILURE; - } - else if (ctx->Opened == false && keep_link) - { - status = NDIS_STATUS_SUCCESS; - } - - NeoUnlockPacketQueue(); - - NeoNdisSetNetBufferListsStatus(NetBufferLists, status); - - InterlockedDecrement(&ctx->NumCurrentDispatch); - - NdisMSendNetBufferListsComplete(ctx->NdisMiniport, NetBufferLists, send_complete_flags); - - return; - } - - nbl = NetBufferLists; - - while (nbl != NULL) - { - NET_BUFFER *nb = NET_BUFFER_LIST_FIRST_NB(nbl); - - NET_BUFFER_LIST_STATUS(nbl) = NDIS_STATUS_SUCCESS; - - while (nb != NULL) - { - UINT size = NET_BUFFER_DATA_LENGTH(nb); - - if (size >= NEO_MIN_PACKET_SIZE && size <= NEO_MAX_PACKET_SIZE) - { - UCHAR *buf = NeoMalloc(size); - void *ptr; - - ptr = NdisGetDataBuffer(nb, size, buf, 1, 0); - - if (ptr == NULL) - { - ctx->Status.NumPacketSendError++; - ctx->Status.Int64NumSendError++; - NeoFree(buf); - } - else - { - if (ptr != buf) - { - NeoCopy(buf, ptr, size); - } - - NeoInsertQueue(buf, size); - ctx->Status.NumPacketSend++; - - if (buf[0] & 0x40) - { - ctx->Status.Int64NumSendBroadcast++; - ctx->Status.Int64BytesSendBroadcast += (UINT64)size; - } - else - { - ctx->Status.Int64NumSendUnicast++; - ctx->Status.Int64BytesSendUnicast += (UINT64)size; - } - - ctx->Status.Int64BytesSendTotal += (UINT64)size; - } - } - else - { - ctx->Status.NumPacketSendError++; - ctx->Status.Int64NumSendError++; - } - - nb = NET_BUFFER_NEXT_NB(nb); - } - - nbl = NET_BUFFER_LIST_NEXT_NBL(nbl); - } - - // Reception event - NeoSet(ctx->Event); - } - NeoUnlockPacketQueue(); - - // Notify the transmission completion - InterlockedDecrement(&ctx->NumCurrentDispatch); - NdisMSendNetBufferListsComplete(ctx->NdisMiniport, NetBufferLists, send_complete_flags); -} - -// Initialize the packet array -void NeoInitPacketArray() -{ - UINT i; - // Create a packet buffer - for (i = 0;i < NEO_MAX_PACKET_EXCHANGE;i++) - { - ctx->PacketBuffer[i] = NeoNewPacketBuffer(); - } -} - -// Release the packet array -void NeoFreePacketArray() -{ - UINT i; - for (i = 0;i < NEO_MAX_PACKET_EXCHANGE;i++) - { - NeoFreePacketBuffer(ctx->PacketBuffer[i]); - ctx->PacketBuffer[i] = NULL; - } -} - -// Release the packet buffer -void NeoFreePacketBuffer(PACKET_BUFFER *p) -{ - // Validate arguments - if (p == NULL) - { - return; - } - - // Release the NET_BUFFER_LIST - NdisFreeNetBufferList(p->NetBufferList); - // Release the NET_BUFFER_LIST pool - NdisFreeNetBufferListPool(p->NetBufferListPool); - // Release the memory - NeoFree(p); -} - -// Create a packet buffer -PACKET_BUFFER *NeoNewPacketBuffer() -{ - PACKET_BUFFER *p; - NET_BUFFER_LIST_POOL_PARAMETERS p1; - - // Memory allocation - p = NeoZeroMalloc(sizeof(PACKET_BUFFER)); - - // Create a NET_BUFFER_LIST pool - NeoZero(&p1, sizeof(p1)); - p1.Header.Type = NDIS_OBJECT_TYPE_DEFAULT; - p1.Header.Revision = NET_BUFFER_LIST_POOL_PARAMETERS_REVISION_1; - p1.Header.Size = NDIS_SIZEOF_NET_BUFFER_LIST_POOL_PARAMETERS_REVISION_1; - p1.ProtocolId = NDIS_PROTOCOL_ID_DEFAULT; - p1.fAllocateNetBuffer = TRUE; - p1.DataSize = NEO_MAX_PACKET_SIZE; - p1.PoolTag = 'SETH'; - p->NetBufferListPool = NdisAllocateNetBufferListPool(NULL, &p1); - - // Create a NET_BUFFER_LIST - p->NetBufferList = NdisAllocateNetBufferList(p->NetBufferListPool, 0, 0); - - return p; -} - -// Reset the event -void NeoReset(NEO_EVENT *event) -{ - // Validate arguments - if (event == NULL) - { - return; - } - - KeResetEvent(event->event); -} - -// Set the event -void NeoSet(NEO_EVENT *event) -{ - // Validate arguments - if (event == NULL) - { - return; - } - - KeSetEvent(event->event, 0, FALSE); -} - -// Release the event -void NeoFreeEvent(NEO_EVENT *event) -{ - // Validate arguments - if (event == NULL) - { - return; - } - - ZwClose(event->event_handle); - - // Release the memory - NeoFree(event); -} - -// Create a new event -NEO_EVENT *NeoNewEvent(char *name) -{ - UNICODE *unicode_name; - NEO_EVENT *event; - // Validate arguments - if (name == NULL) - { - return NULL; - } - - // Convert the name to Unicode - unicode_name = NewUnicode(name); - if (unicode_name == NULL) - { - return NULL; - } - - // Memory allocation - event = NeoZeroMalloc(sizeof(NEO_EVENT)); - if (event == NULL) - { - FreeUnicode(unicode_name); - return NULL; - } - - // Create an Event - event->event = IoCreateNotificationEvent(GetUnicode(unicode_name), &event->event_handle); - if (event->event == NULL) - { - NeoFree(event); - FreeUnicode(unicode_name); - return NULL; - } - - // Initialize the event - KeInitializeEvent(event->event, NotificationEvent, FALSE); - KeClearEvent(event->event); - - // Release a string - FreeUnicode(unicode_name); - - return event; -} - -// Get the Unicode string -NDIS_STRING *GetUnicode(UNICODE *u) -{ - // Validate arguments - if (u == NULL) - { - return NULL; - } - - return &u->String; -} - -// Release the Unicode strings -void FreeUnicode(UNICODE *u) -{ - // Validate arguments - if (u == NULL) - { - return; - } - - // Release a string - NdisFreeString(u->String); - - // Release the memory - NeoFree(u); -} - -// Create a new Unicode string -UNICODE *NewUnicode(char *str) -{ - UNICODE *u; - // Validate arguments - if (str == NULL) - { - return NULL; - } - - // Memory allocation - u = NeoZeroMalloc(sizeof(UNICODE)); - if (u == NULL) - { - return NULL; - } - - // String initialization - NdisInitializeString(&u->String, str); - - return u; -} - -// Release the lock -void NeoFreeLock(NEO_LOCK *lock) -{ - NDIS_SPIN_LOCK *spin_lock; - // Validate arguments - if (lock == NULL) - { - return; - } - - spin_lock = &lock->spin_lock; - NdisFreeSpinLock(spin_lock); - - // Release the memory - NeoFree(lock); -} - -// Unlock -void NeoUnlock(NEO_LOCK *lock) -{ - NDIS_SPIN_LOCK *spin_lock; - // Validate arguments - if (lock == NULL) - { - return; - } - - spin_lock = &lock->spin_lock; - NdisReleaseSpinLock(spin_lock); -} - -// Lock -void NeoLock(NEO_LOCK *lock) -{ - NDIS_SPIN_LOCK *spin_lock; - // Validate arguments - if (lock == NULL) - { - return; - } - - spin_lock = &lock->spin_lock; - NdisAcquireSpinLock(spin_lock); -} - -// Creating a new lock -NEO_LOCK *NeoNewLock() -{ - NDIS_SPIN_LOCK *spin_lock; - - // Memory allocation - NEO_LOCK *lock = NeoZeroMalloc(sizeof(NEO_LOCK)); - if (lock == NULL) - { - return NULL; - } - - // Initialize spin lock - spin_lock = &lock->spin_lock; - - NdisAllocateSpinLock(spin_lock); - - return lock; -} - -// Memory copy -void NeoCopy(void *dst, void *src, UINT size) -{ - // Validate arguments - if (dst == NULL || src == NULL || size == 0) - { - return; - } - - // Copy - NdisMoveMemory(dst, src, size); -} - -// Memory clear -void NeoZero(void *dst, UINT size) -{ - // Validate arguments - if (dst == NULL || size == 0) - { - return; - } - - // Clear - NdisZeroMemory(dst, size); -} - -// Clear to zero by memory allocation -void *NeoZeroMalloc(UINT size) -{ - void *p = NeoMalloc(size); - if (p == NULL) - { - // Memory allocation failure - return NULL; - } - // Clear to zero - NeoZero(p, size); - return p; -} - -// Memory allocation -void *NeoMalloc(UINT size) -{ - NDIS_STATUS r; - void *p; - if (size == 0) - { - size = 1; - } - - // Allocate the non-paged memory - r = NdisAllocateMemoryWithTag(&p, size, 'SETH'); - - if (NG(r)) - { - return NULL; - } - return p; -} - -// Release the memory -void NeoFree(void *p) -{ - // Validate arguments - if (p == NULL) - { - return; - } - - // Release the memory - NdisFreeMemory(p, 0, 0); -} - - +// SoftEther VPN Source Code - Developer Edition Master Branch +// Kernel Device Driver + + +// NDIS6.c +// Windows NDIS 6.2 Routine + +#include + +#define NEO_DEVICE_DRIVER + +#include "Neo6.h" + +static UINT64 max_speed = NEO_MAX_SPEED_DEFAULT; +static bool keep_link = false; +static UINT reg_if_type = IF_TYPE_ETHERNET_CSMACD; + +BOOLEAN +PsGetVersion( + PULONG MajorVersion OPTIONAL, + PULONG MinorVersion OPTIONAL, + PULONG BuildNumber OPTIONAL, + PUNICODE_STRING CSDVersion OPTIONAL + ); + +// Memory related +static NDIS_PHYSICAL_ADDRESS HighestAcceptableMax = NDIS_PHYSICAL_ADDRESS_CONST(-1, -1); +NDIS_HANDLE ndis_miniport_driver_handle = NULL; + +// Flag for whether Windows 8 +bool g_is_win8 = false; + +// Win32 driver entry point +NDIS_STATUS DriverEntry(DRIVER_OBJECT *DriverObject, UNICODE_STRING *RegistryPath) +{ + NDIS_MINIPORT_DRIVER_CHARACTERISTICS miniport; + ULONG os_major_ver = 0, os_minor_ver = 0; + NDIS_STATUS ret; + + // Initialize the Neo library + if (NeoInit() == FALSE) + { + // Initialization Failed + return STATUS_UNSUCCESSFUL; + } + + g_is_win8 = false; + + // Get the OS version + PsGetVersion(&os_major_ver, &os_minor_ver, NULL, NULL); + + if (os_major_ver >= 7 || (os_major_ver == 6 && os_minor_ver >= 2)) + { + // Windows 8 + g_is_win8 = true; + } + + // Register a NDIS miniport driver + NeoZero(&miniport, sizeof(NDIS_MINIPORT_DRIVER_CHARACTERISTICS)); + + miniport.Header.Type = NDIS_OBJECT_TYPE_MINIPORT_DRIVER_CHARACTERISTICS; + miniport.Header.Revision = NDIS_MINIPORT_DRIVER_CHARACTERISTICS_REVISION_2; + miniport.Header.Size = NDIS_SIZEOF_MINIPORT_DRIVER_CHARACTERISTICS_REVISION_2; + + miniport.MajorNdisVersion = NEO_NDIS_MAJOR_VERSION; + miniport.MinorNdisVersion = NEO_NDIS_MINOR_VERSION; + + // Register the handler + miniport.InitializeHandlerEx = NeoNdisInitEx; + miniport.HaltHandlerEx = NeoNdisHaltEx; + miniport.OidRequestHandler = NeoNdisOidRequest; + miniport.ResetHandlerEx = NeoNdisResetEx; + miniport.CheckForHangHandlerEx = NeoNdisCheckForHangEx; + miniport.UnloadHandler = NeoNdisDriverUnload; + miniport.SendNetBufferListsHandler = NeoNdisSendNetBufferLists; + + miniport.SetOptionsHandler = NeoNdisSetOptions; + miniport.PauseHandler = NeoNdisPause; + miniport.RestartHandler = NeoNdisRestart; + miniport.ReturnNetBufferListsHandler = NeoNdisReturnNetBufferLists; + miniport.CancelSendHandler = NeoNdisCancelSend; + miniport.DevicePnPEventNotifyHandler = NeoNdisDevicePnPEventNotify; + miniport.ShutdownHandlerEx = NeoNdisShutdownEx; + miniport.CancelOidRequestHandler = NeoNdisCancelOidRequest; + + ret = NdisMRegisterMiniportDriver(DriverObject, RegistryPath, + NULL, &miniport, &ndis_miniport_driver_handle); + + if (NG(ret)) + { + // Registration failure + return STATUS_UNSUCCESSFUL; + } + + // Initialization success + return STATUS_SUCCESS; +} + +NDIS_STATUS NeoNdisSetOptions(NDIS_HANDLE NdisDriverHandle, NDIS_HANDLE DriverContext) +{ + return NDIS_STATUS_SUCCESS; +} + +NDIS_STATUS NeoNdisPause(NDIS_HANDLE MiniportAdapterContext, PNDIS_MINIPORT_PAUSE_PARAMETERS MiniportPauseParameters) +{ + UINT counter_dbg = 0; + + ctx->Paused = true; + + NeoLockPacketQueue(); + NeoUnlockPacketQueue(); + + // Wait for complete all tasks + while (ctx->NumCurrentDispatch != 0) + { + NdisMSleep(10000); + counter_dbg++; + if (counter_dbg >= 1500) + { + break; + } + } + + return NDIS_STATUS_SUCCESS; +} + +NDIS_STATUS NeoNdisRestart(NDIS_HANDLE MiniportAdapterContext, PNDIS_MINIPORT_RESTART_PARAMETERS MiniportRestartParameters) +{ + ctx->Paused = false; + + return NDIS_STATUS_SUCCESS; +} + +void NeoNdisReturnNetBufferLists(NDIS_HANDLE MiniportAdapterContext, PNET_BUFFER_LIST NetBufferLists, ULONG ReturnFlags) +{ +} + +void NeoNdisCancelSend(NDIS_HANDLE MiniportAdapterContext, PVOID CancelId) +{ + //NeoNdisCrash2(__LINE__, __LINE__, __LINE__, __LINE__); +} + +void NeoNdisDevicePnPEventNotify(NDIS_HANDLE MiniportAdapterContext, PNET_DEVICE_PNP_EVENT NetDevicePnPEvent) +{ +} + +void NeoNdisShutdownEx(NDIS_HANDLE MiniportAdapterContext, NDIS_SHUTDOWN_ACTION ShutdownAction) +{ +} + +void NeoNdisCancelOidRequest(NDIS_HANDLE MiniportAdapterContext, PVOID RequestId) +{ + //NeoNdisCrash2(__LINE__, __LINE__, __LINE__, __LINE__); +} + +// Initialization handler of adapter +NDIS_STATUS NeoNdisInitEx(NDIS_HANDLE MiniportAdapterHandle, + NDIS_HANDLE MiniportDriverContext, + PNDIS_MINIPORT_INIT_PARAMETERS MiniportInitParameters) +{ + NDIS_MINIPORT_ADAPTER_REGISTRATION_ATTRIBUTES attr; + NDIS_MINIPORT_ADAPTER_GENERAL_ATTRIBUTES gen; + NDIS_PM_CAPABILITIES pnpcap; + + if (ctx == NULL) + { + return NDIS_STATUS_FAILURE; + } + + if (ctx->NdisMiniportDriverHandle == NULL) + { + ctx->NdisMiniportDriverHandle = ndis_miniport_driver_handle; + } + + // Prevention of multiple start + if (ctx->Initing != FALSE) + { + // Multiple started + return NDIS_STATUS_FAILURE; + } + ctx->Initing = TRUE; + + // Examine whether it has already been initialized + if (ctx->Inited != FALSE) + { + // Driver is started on another instance already. + // VPN driver can start only one instance per one service. + // User can start multiple drivers with different instance ID + return NDIS_STATUS_FAILURE; + } + + // Current value of the packet filter + ctx->CurrentPacketFilter = NDIS_PACKET_TYPE_ALL_LOCAL | NDIS_PACKET_TYPE_BROADCAST | NDIS_PACKET_TYPE_DIRECTED | NDIS_PACKET_TYPE_ALL_FUNCTIONAL; + + // Initialize the adapter information + ctx->NdisMiniport = MiniportAdapterHandle; + ctx->NdisContext = ctx; + ctx->HardwareStatus = NdisHardwareStatusReady; + ctx->Halting = FALSE; + ctx->Connected = ctx->ConnectedOld = FALSE; + + //if (keep_link == false) + { + ctx->ConnectedForce = TRUE; + } + + // Read the information from the registry + if (NeoLoadRegistry() == FALSE) + { + // Failure + ctx->Initing = FALSE; + return NDIS_STATUS_FAILURE; + } + + // Register the device attributes + NeoZero(&attr, sizeof(attr)); + attr.Header.Type = NDIS_OBJECT_TYPE_MINIPORT_ADAPTER_REGISTRATION_ATTRIBUTES; + attr.Header.Revision = NDIS_MINIPORT_ADAPTER_REGISTRATION_ATTRIBUTES_REVISION_1; + attr.Header.Size = sizeof(NDIS_MINIPORT_ADAPTER_REGISTRATION_ATTRIBUTES); + attr.AttributeFlags = NDIS_MINIPORT_ATTRIBUTES_NO_HALT_ON_SUSPEND; + attr.InterfaceType = NdisInterfaceInternal; + attr.MiniportAdapterContext = ctx->NdisContext; + + NdisMSetMiniportAttributes(ctx->NdisMiniport, (PNDIS_MINIPORT_ADAPTER_ATTRIBUTES)&attr); + + NeoZero(&pnpcap, sizeof(pnpcap)); + + NeoZero(&gen, sizeof(gen)); + gen.Header.Type = NDIS_OBJECT_TYPE_MINIPORT_ADAPTER_GENERAL_ATTRIBUTES; + gen.Header.Revision = NDIS_MINIPORT_ADAPTER_GENERAL_ATTRIBUTES_REVISION_2; + gen.Header.Size = NDIS_SIZEOF_MINIPORT_ADAPTER_GENERAL_ATTRIBUTES_REVISION_2; + gen.MediaType = NdisMedium802_3; + gen.PhysicalMediumType = NdisPhysicalMedium802_3; + gen.MtuSize = NEO_MAX_PACKET_SIZE_ANNOUNCE - NEO_MIN_PACKET_SIZE; + gen.MaxXmitLinkSpeed = gen.MaxRcvLinkSpeed = max_speed; + gen.RcvLinkSpeed = gen.XmitLinkSpeed = max_speed; + gen.MediaConnectState = MediaConnectStateDisconnected; + gen.LookaheadSize = NEO_MAX_PACKET_SIZE_ANNOUNCE - NEO_MIN_PACKET_SIZE; + gen.MacOptions = NDIS_MAC_OPTION_TRANSFERS_NOT_PEND | NDIS_MAC_OPTION_COPY_LOOKAHEAD_DATA | NDIS_MAC_OPTION_NO_LOOPBACK; + gen.SupportedPacketFilters = NDIS_PACKET_TYPE_ALL_LOCAL | NDIS_PACKET_TYPE_BROADCAST | NDIS_PACKET_TYPE_DIRECTED | NDIS_PACKET_TYPE_ALL_FUNCTIONAL; + gen.MaxMulticastListSize = NEO_MAX_MULTICASE; + gen.MacAddressLength = NEO_MAC_ADDRESS_SIZE; + NeoCopy(gen.PermanentMacAddress, ctx->MacAddress, NEO_MAC_ADDRESS_SIZE); + NeoCopy(gen.CurrentMacAddress, ctx->MacAddress, NEO_MAC_ADDRESS_SIZE); + gen.AccessType = NET_IF_ACCESS_BROADCAST; + gen.DirectionType = NET_IF_DIRECTION_SENDRECEIVE; + gen.ConnectionType = NET_IF_CONNECTION_DEDICATED; + gen.IfType = reg_if_type; + gen.IfConnectorPresent = FALSE; + gen.SupportedStatistics = + NDIS_STATISTICS_FLAGS_VALID_DIRECTED_FRAMES_RCV | + NDIS_STATISTICS_FLAGS_VALID_MULTICAST_FRAMES_RCV | + NDIS_STATISTICS_FLAGS_VALID_BROADCAST_FRAMES_RCV | + NDIS_STATISTICS_FLAGS_VALID_BYTES_RCV | + NDIS_STATISTICS_FLAGS_VALID_RCV_DISCARDS | + NDIS_STATISTICS_FLAGS_VALID_RCV_ERROR | + NDIS_STATISTICS_FLAGS_VALID_DIRECTED_FRAMES_XMIT | + NDIS_STATISTICS_FLAGS_VALID_MULTICAST_FRAMES_XMIT | + NDIS_STATISTICS_FLAGS_VALID_BROADCAST_FRAMES_XMIT | + NDIS_STATISTICS_FLAGS_VALID_BYTES_XMIT | + NDIS_STATISTICS_FLAGS_VALID_XMIT_ERROR | + NDIS_STATISTICS_FLAGS_VALID_XMIT_DISCARDS | + NDIS_STATISTICS_FLAGS_VALID_DIRECTED_BYTES_RCV | + NDIS_STATISTICS_FLAGS_VALID_MULTICAST_BYTES_RCV | + NDIS_STATISTICS_FLAGS_VALID_BROADCAST_BYTES_RCV | + NDIS_STATISTICS_FLAGS_VALID_DIRECTED_BYTES_XMIT | + NDIS_STATISTICS_FLAGS_VALID_MULTICAST_BYTES_XMIT | + NDIS_STATISTICS_FLAGS_VALID_BROADCAST_BYTES_XMIT; + gen.SupportedPauseFunctions = NdisPauseFunctionsUnsupported; + gen.AutoNegotiationFlags = NDIS_LINK_STATE_XMIT_LINK_SPEED_AUTO_NEGOTIATED | + NDIS_LINK_STATE_RCV_LINK_SPEED_AUTO_NEGOTIATED | + NDIS_LINK_STATE_DUPLEX_AUTO_NEGOTIATED | + NDIS_LINK_STATE_PAUSE_FUNCTIONS_AUTO_NEGOTIATED; + gen.SupportedOidList = SupportedOids; + gen.SupportedOidListLength = sizeof(SupportedOids); + + NeoZero(&pnpcap, sizeof(pnpcap)); + pnpcap.Header.Type = NDIS_OBJECT_TYPE_DEFAULT; + pnpcap.Header.Revision = NDIS_PM_CAPABILITIES_REVISION_1; + pnpcap.Header.Size = NDIS_SIZEOF_NDIS_PM_CAPABILITIES_REVISION_1; + pnpcap.MinMagicPacketWakeUp = NdisDeviceStateUnspecified; + pnpcap.MinPatternWakeUp = NdisDeviceStateUnspecified; + pnpcap.MinLinkChangeWakeUp = NdisDeviceStateUnspecified; + gen.PowerManagementCapabilitiesEx = &pnpcap; + + NdisMSetMiniportAttributes(ctx->NdisMiniport, (PNDIS_MINIPORT_ADAPTER_ATTRIBUTES)&gen); + + // Initialize the received packet array + NeoInitPacketArray(); + + // Initialize the control device + NeoInitControlDevice(); + + // Start the adapter + NeoStartAdapter(); + + // Flag setting + ctx->Initing = FALSE; + ctx->Inited = TRUE; + + // Notify the connection state + NeoSetConnectState(FALSE); + + return NDIS_STATUS_SUCCESS; +} + +// Open the device +BOOL NeoNdisOnOpen(IRP *irp, IO_STACK_LOCATION *stack) +{ + char name[MAX_SIZE]; + + if (ctx == NULL) + { + return FALSE; + } + + if (ctx->Opened) + { + // Another client is connected already + return FALSE; + } + ctx->Opened = TRUE; + + // Initialize the event name + sprintf(name, NDIS_NEO_EVENT_NAME, ctx->HardwareID); + + // Register a Event + ctx->Event = NeoNewEvent(name); + if (ctx->Event == NULL) + { + ctx->Opened = FALSE; + return FALSE; + } + + // Set the connection state + NeoSetConnectState(TRUE); + + return TRUE; +} + +// Close the device +BOOL NeoNdisOnClose(IRP *irp, IO_STACK_LOCATION *stack) +{ + NEO_EVENT *free_event = NULL; + if (ctx == NULL) + { + return FALSE; + } + + if (ctx->Opened == FALSE) + { + // Client is not connected + return FALSE; + } + ctx->Opened = FALSE; + + NeoLockPacketQueue(); + { + // Release the event + free_event = ctx->Event; + ctx->Event = NULL; + + // Release all packets + NeoClearPacketQueue(true); + } + NeoUnlockPacketQueue(); + + if (free_event != NULL) + { + NeoFreeEvent(free_event); + } + + NeoSetConnectState(FALSE); + + return TRUE; +} + +// Crash 2 +void NeoNdisCrash2(UINT a, UINT b, UINT c, UINT d) +{ + KeBugCheckEx(0x00000061, (ULONG_PTR)a, (ULONG_PTR)b, (ULONG_PTR)c, (ULONG_PTR)d); +} + +// Crash +void NeoNdisCrash() +{ + NEO_QUEUE *q; + q = (NEO_QUEUE *)0xACACACAC; + q->Size = 128; + NeoCopy(q->Buf, "ABCDEFG", 8); +} + +// Dispatch table for control +NTSTATUS NeoNdisDispatch(DEVICE_OBJECT *DeviceObject, IRP *Irp) +{ + NTSTATUS status; + IO_STACK_LOCATION *stack; + void *buf; + BOOL ok; + status = STATUS_SUCCESS; + + if (ctx == NULL) + { + return NDIS_STATUS_FAILURE; + } + + InterlockedIncrement(&ctx->NumCurrentDispatch); + + // Get the IRP stack + stack = IoGetCurrentIrpStackLocation(Irp); + + // Initialize the number of bytes + Irp->IoStatus.Information = 0; + Irp->IoStatus.Status = STATUS_SUCCESS; + + buf = Irp->UserBuffer; + + if (ctx->Halting != FALSE) + { + // Device driver is terminating + Irp->IoStatus.Information = STATUS_UNSUCCESSFUL; + InterlockedDecrement(&ctx->NumCurrentDispatch); + + IoCompleteRequest(Irp, IO_NO_INCREMENT); + + return STATUS_SUCCESS; + } + + // Branch to each operation + switch (stack->MajorFunction) + { + case IRP_MJ_CREATE: + // Device is opened + if (NeoNdisOnOpen(Irp, stack) == FALSE) + { + Irp->IoStatus.Status = STATUS_UNSUCCESSFUL; + status = STATUS_UNSUCCESSFUL; + } + break; + + case IRP_MJ_CLOSE: + // Device is closed + if (NeoNdisOnClose(Irp, stack) == FALSE) + { + Irp->IoStatus.Status = STATUS_UNSUCCESSFUL; + status = STATUS_UNSUCCESSFUL; + } + break; + + case IRP_MJ_READ: + // Read (Reading of the received packet) + ok = false; + if (buf != NULL) + { + if (ctx->Opened && ctx->Inited) + { + if (stack->Parameters.Read.Length == NEO_EXCHANGE_BUFFER_SIZE) + { + // Address check + bool check_ok = true; + __try + { + ProbeForWrite(buf, NEO_EXCHANGE_BUFFER_SIZE, 1); + } + __except (EXCEPTION_EXECUTE_HANDLER) + { + check_ok = false; + } + + if (check_ok) + { + // Address check + MDL *mdl = IoAllocateMdl(buf, NEO_EXCHANGE_BUFFER_SIZE, false, false, NULL); + + if (mdl != NULL) + { + MmProbeAndLockPages(mdl, KernelMode, IoWriteAccess); + } + + // Read + NeoRead(buf); + Irp->IoStatus.Information = NEO_EXCHANGE_BUFFER_SIZE; + ok = true; + + if (mdl != NULL) + { + MmUnlockPages(mdl); + IoFreeMdl(mdl); + } + } + } + } + } + if (ok == FALSE) + { + // An error occurred + Irp->IoStatus.Status = STATUS_UNSUCCESSFUL; + status = STATUS_UNSUCCESSFUL; + } + break; + + case IRP_MJ_WRITE: + // Write (Writing of a transmission packet) + ok = false; + if (buf != NULL) + { + if (ctx->Opened && ctx->Inited) + { + if (stack->Parameters.Write.Length == NEO_EXCHANGE_BUFFER_SIZE) + { + // Address check + bool check_ok = true; + __try + { + ProbeForRead(buf, NEO_EXCHANGE_BUFFER_SIZE, 1); + } + __except (EXCEPTION_EXECUTE_HANDLER) + { + check_ok = false; + } + + if (check_ok) + { + // Address check + MDL *mdl = IoAllocateMdl(buf, NEO_EXCHANGE_BUFFER_SIZE, false, false, NULL); + + if (mdl != NULL) + { + MmProbeAndLockPages(mdl, KernelMode, IoReadAccess); + } + __try + { + ProbeForRead(buf, NEO_EXCHANGE_BUFFER_SIZE, 1); + } + __except (EXCEPTION_EXECUTE_HANDLER) + { + check_ok = false; + } + if (check_ok) { + // Write + NeoWrite(buf); + Irp->IoStatus.Information = stack->Parameters.Write.Length; + ok = true; + + if (mdl != NULL) + { + MmUnlockPages(mdl); + IoFreeMdl(mdl); + } + } + } + } + } + } + if (ok == FALSE) + { + // An error occurred + Irp->IoStatus.Status = STATUS_UNSUCCESSFUL; + status = STATUS_UNSUCCESSFUL; + } + break; + } + + InterlockedDecrement(&ctx->NumCurrentDispatch); + + IoCompleteRequest(Irp, IO_NO_INCREMENT); + + return STATUS_SUCCESS; +} + +// Initialize the control device +void NeoInitControlDevice() +{ + char name_kernel[MAX_SIZE]; + char name_win32[MAX_SIZE]; + UNICODE *unicode_kernel, *unicode_win32; + DEVICE_OBJECT *control_device_object; + NDIS_HANDLE ndis_control_handle; + NDIS_DEVICE_OBJECT_ATTRIBUTES t; + + if (ctx == NULL) + { + return; + } + + // Initialize the dispatch table + NeoZero(ctx->DispatchTable, sizeof(PDRIVER_DISPATCH) * IRP_MJ_MAXIMUM_FUNCTION); + + // Register the handler + ctx->DispatchTable[IRP_MJ_CREATE] = + ctx->DispatchTable[IRP_MJ_CLOSE] = + ctx->DispatchTable[IRP_MJ_READ] = + ctx->DispatchTable[IRP_MJ_WRITE] = + ctx->DispatchTable[IRP_MJ_DEVICE_CONTROL] = NeoNdisDispatch; + ctx->Opened = FALSE; + ctx->Paused = FALSE; + + // Generate the device name + sprintf(name_kernel, NDIS_NEO_DEVICE_NAME, ctx->HardwareID); + unicode_kernel = NewUnicode(name_kernel); + sprintf(name_win32, NDIS_NEO_DEVICE_NAME_WIN32, ctx->HardwareID); + unicode_win32 = NewUnicode(name_win32); + + // Register the device + NeoZero(&t, sizeof(t)); + t.Header.Type = NDIS_OBJECT_TYPE_DEVICE_OBJECT_ATTRIBUTES; + t.Header.Revision = NDIS_DEVICE_OBJECT_ATTRIBUTES_REVISION_1; + t.Header.Size = NDIS_SIZEOF_DEVICE_OBJECT_ATTRIBUTES_REVISION_1; + t.DeviceName = GetUnicode(unicode_kernel); + t.SymbolicName = GetUnicode(unicode_win32); + t.MajorFunctions = ctx->DispatchTable; + + NdisRegisterDeviceEx(ndis_miniport_driver_handle, &t, + &control_device_object, + &ndis_control_handle); + + ctx->NdisControlDevice = control_device_object; + ctx->NdisControl = ndis_control_handle; + + // Initialize the display name + if (strlen(ctx->HardwareID) > 11) + { + sprintf(ctx->HardwarePrintableID, NDIS_NEO_HARDWARE_ID, ctx->HardwareID_Raw + 11); + } + else + { + sprintf(ctx->HardwarePrintableID, NDIS_NEO_HARDWARE_ID, ctx->HardwareID_Raw); + } +} + +// Release the control device +void NeoFreeControlDevice() +{ + if (ctx == NULL) + { + return; + } + + if (ctx->Opened != FALSE) + { + // Delete the event + NeoSet(ctx->Event); + NeoFreeEvent(ctx->Event); + ctx->Event = NULL; + ctx->Opened = FALSE; + } + + // Delete the device + NdisDeregisterDeviceEx(ctx->NdisControl); +} + + +// Read the information from the registry +BOOL NeoLoadRegistry() +{ + void *buf; + NDIS_STATUS ret; + UINT size; + NDIS_HANDLE config; + NDIS_CONFIGURATION_PARAMETER *param; + UNICODE *name; + ANSI_STRING ansi; + UNICODE_STRING *unicode; + UINT64 speed; + BOOL keep; + NDIS_CONFIGURATION_OBJECT config_obj; + + // Get the Config handle + NeoZero(&config_obj, sizeof(config_obj)); + config_obj.Header.Type = NDIS_OBJECT_TYPE_CONFIGURATION_OBJECT; + config_obj.Header.Revision = NDIS_CONFIGURATION_OBJECT_REVISION_1; + config_obj.Header.Size = NDIS_SIZEOF_CONFIGURATION_OBJECT_REVISION_1; + config_obj.NdisHandle = ctx->NdisMiniport; + + ret = NdisOpenConfigurationEx(&config_obj, &config); + if (NG(ret)) + { + // Failure + return FALSE; + } + + // Read the MAC address + NdisReadNetworkAddress(&ret, &buf, &size, config); + if (NG(ret)) + { + // Failure + NdisCloseConfiguration(config); + return FALSE; + } + + // Copy the MAC address + if (size != NEO_MAC_ADDRESS_SIZE) + { + // Invalid size + NdisCloseConfiguration(config); + return FALSE; + } + NeoCopy(ctx->MacAddress, buf, NEO_MAC_ADDRESS_SIZE); + + if (ctx->MacAddress[0] == 0x00 && + ctx->MacAddress[1] == 0x00 && + ctx->MacAddress[2] == 0x01 && + ctx->MacAddress[3] == 0x00 && + ctx->MacAddress[4] == 0x00 && + ctx->MacAddress[5] == 0x01) + { + // Special MAC address + UINT ptr32 = (UINT)((UINT64)ctx); + LARGE_INTEGER current_time; + UCHAR *current_time_bytes; + + KeQuerySystemTime(¤t_time); + + current_time_bytes = (UCHAR *)¤t_time; + + ctx->MacAddress[0] = 0x00; + ctx->MacAddress[1] = 0xAD; + ctx->MacAddress[2] = ((UCHAR *)(&ptr32))[0]; + ctx->MacAddress[3] = ((UCHAR *)(&ptr32))[1]; + ctx->MacAddress[4] = ((UCHAR *)(&ptr32))[2]; + ctx->MacAddress[5] = ((UCHAR *)(&ptr32))[3]; + + ctx->MacAddress[2] ^= current_time_bytes[0]; + ctx->MacAddress[3] ^= current_time_bytes[1]; + ctx->MacAddress[4] ^= current_time_bytes[2]; + ctx->MacAddress[5] ^= current_time_bytes[3]; + + ctx->MacAddress[2] ^= current_time_bytes[4]; + ctx->MacAddress[3] ^= current_time_bytes[5]; + ctx->MacAddress[4] ^= current_time_bytes[6]; + ctx->MacAddress[5] ^= current_time_bytes[7]; + } + + // Initialize the key name of the device name + name = NewUnicode("MatchingDeviceId"); + + // Read the hardware ID + NdisReadConfiguration(&ret, ¶m, config, GetUnicode(name), NdisParameterString); + FreeUnicode(name); + if (NG(ret)) + { + // Failure + NdisCloseConfiguration(config); + return FALSE; + } + // Type checking + if (param->ParameterType != NdisParameterString) + { + // Failure + NdisCloseConfiguration(config); + return FALSE; + } + unicode = ¶m->ParameterData.StringData; + + // Prepare a buffer for ANSI string + NeoZero(&ansi, sizeof(ANSI_STRING)); + ansi.MaximumLength = MAX_SIZE - 1; + ansi.Buffer = NeoZeroMalloc(MAX_SIZE); + + // Convert to ANSI string + NdisUnicodeStringToAnsiString(&ansi, unicode); + // Copy + strcpy(ctx->HardwareID, ansi.Buffer); + strcpy(ctx->HardwareID_Raw, ctx->HardwareID); + // Convert to upper case + _strupr(ctx->HardwareID); + // Release the memory + NeoFree(ansi.Buffer); + + // Read the bit rate + name = NewUnicode("MaxSpeed"); + NdisReadConfiguration(&ret, ¶m, config, GetUnicode(name), NdisParameterInteger); + FreeUnicode(name); + + if (NG(ret) || param->ParameterType != NdisParameterInteger) + { + speed = NEO_MAX_SPEED_DEFAULT; + } + else + { + speed = (UINT64)param->ParameterData.IntegerData * 1000000ULL; + } + + max_speed = speed; + + // Read the link keeping flag + name = NewUnicode("KeepLink"); + NdisReadConfiguration(&ret, ¶m, config, GetUnicode(name), NdisParameterInteger); + FreeUnicode(name); + + if (NG(ret) || param->ParameterType != NdisParameterInteger) + { + keep = false; + } + else + { + keep = (param->ParameterData.IntegerData == 0 ? false : true); + } + + keep_link = keep; + + // Read the *IfType value + name = NewUnicode("*IfType"); + NdisReadConfiguration(&ret, ¶m, config, GetUnicode(name), NdisParameterInteger); + FreeUnicode(name); + + if (NG(ret) || param->ParameterType != NdisParameterInteger) + { + reg_if_type = IF_TYPE_ETHERNET_CSMACD; + } + else + { + reg_if_type = param->ParameterData.IntegerData; + } + + // Close the config handle + NdisCloseConfiguration(config); + + return TRUE; +} + +// Unload the driver +VOID NeoNdisDriverUnload(PDRIVER_OBJECT DriverObject) +{ + NdisMDeregisterMiniportDriver(ndis_miniport_driver_handle); +} + +// Stop handler of adapter +void NeoNdisHaltEx(NDIS_HANDLE MiniportAdapterContext, NDIS_HALT_ACTION HaltAction) +{ + NEO_EVENT *free_event = NULL; + UINT counter_dbg = 0; + if (ctx == NULL) + { + return; + } + + if (ctx->Halting != FALSE) + { + // That has already been stopped + return; + } + ctx->Halting = TRUE; + + ctx->Opened = FALSE; + + NeoLockPacketQueue(); + { + // Release the event + free_event = ctx->Event; + ctx->Event = NULL; + + // Release all packets + NeoClearPacketQueue(true); + } + NeoUnlockPacketQueue(); + + if (free_event != NULL) + { + NeoSet(free_event); + } + + // Wait for complete all tasks + while (ctx->NumCurrentDispatch != 0) + { + NdisMSleep(10000); + counter_dbg++; + if (counter_dbg >= 1500) + { + break; + } + } + + if (free_event != NULL) + { + NeoFreeEvent(free_event); + } + + // Delete the control device + NeoFreeControlDevice(); + + // Stop the adapter + NeoStopAdapter(); + + // Release the packet array + NeoFreePacketArray(); + + // Complete to stop + ctx->Initing = ctx->Inited = FALSE; + ctx->Connected = ctx->ConnectedForce = ctx->ConnectedOld = FALSE; + ctx->Halting = FALSE; + + // Shutdown of Neo + NeoShutdown(); +} + +// Reset handler of adapter +NDIS_STATUS NeoNdisResetEx(NDIS_HANDLE MiniportAdapterContext, PBOOLEAN AddressingReset) +{ + return NDIS_STATUS_SUCCESS; +} + +// Hang-up check handler of adapter +BOOLEAN NeoNdisCheckForHangEx(NDIS_HANDLE MiniportAdapterContext) +{ + return FALSE; +} + +// OID request handler +NDIS_STATUS NeoNdisOidRequest(NDIS_HANDLE MiniportAdapterContext, + PNDIS_OID_REQUEST OidRequest) +{ + NDIS_STATUS ret = STATUS_UNSUCCESSFUL; + ULONG dummy = 0; + + switch (OidRequest->RequestType) + { + case NdisRequestQueryInformation: + case NdisRequestQueryStatistics: + ret = NeoNdisQuery(MiniportAdapterContext, + OidRequest->DATA.QUERY_INFORMATION.Oid, + OidRequest->DATA.QUERY_INFORMATION.InformationBuffer, + OidRequest->DATA.QUERY_INFORMATION.InformationBufferLength, + &OidRequest->DATA.QUERY_INFORMATION.BytesWritten, + &OidRequest->DATA.QUERY_INFORMATION.BytesNeeded); + break; + + case NdisRequestSetInformation: + ret = NeoNdisSet(MiniportAdapterContext, + OidRequest->DATA.SET_INFORMATION.Oid, + OidRequest->DATA.SET_INFORMATION.InformationBuffer, + OidRequest->DATA.SET_INFORMATION.InformationBufferLength, + &dummy, + &OidRequest->DATA.SET_INFORMATION.BytesNeeded); + break; + + default: + ret = NDIS_STATUS_NOT_SUPPORTED; + break; + } + + return ret; +} + + +// Information acquisition handler of adapter +NDIS_STATUS NeoNdisQuery(NDIS_HANDLE MiniportAdapterContext, + NDIS_OID Oid, + void *InformationBuffer, + ULONG InformationBufferLength, + ULONG *BytesWritten, + ULONG *BytesNeeded) +{ + NDIS_MEDIUM media; + void *buf; + UINT value32; + USHORT value16; + UINT size; + NDIS_STATISTICS_INFO stat; + NDIS_INTERRUPT_MODERATION_PARAMETERS intp; + + if (ctx == NULL) + { + return NDIS_STATUS_FAILURE; + } + + // Initialization + size = sizeof(UINT); + value32 = value16 = 0; + buf = &value32; + + // Branch processing + switch (Oid) + { + case OID_GEN_SUPPORTED_LIST: + // Return a list of supported OID + buf = SupportedOids; + size = sizeof(SupportedOids); + break; + + case OID_GEN_MAC_OPTIONS: + // Ethernet option + value32 = NDIS_MAC_OPTION_TRANSFERS_NOT_PEND | NDIS_MAC_OPTION_RECEIVE_SERIALIZED | + NDIS_MAC_OPTION_COPY_LOOKAHEAD_DATA | NDIS_MAC_OPTION_NO_LOOPBACK; + break; + + case OID_GEN_HARDWARE_STATUS: + // Hardware state + buf = &ctx->HardwareStatus; + size = sizeof(NDIS_HARDWARE_STATUS); + break; + + case OID_GEN_MEDIA_SUPPORTED: + case OID_GEN_MEDIA_IN_USE: + // Type of media + media = NdisMedium802_3; + buf = &media; + size = sizeof(NDIS_MEDIUM); + break; + + case OID_GEN_CURRENT_LOOKAHEAD: + case OID_GEN_MAXIMUM_LOOKAHEAD: + // Read-ahead available size + value32 = NEO_MAX_PACKET_SIZE_ANNOUNCE - NEO_MIN_PACKET_SIZE; + break; + + case OID_GEN_MAXIMUM_FRAME_SIZE: + // Maximum frame size + value32 = NEO_MAX_PACKET_SIZE_ANNOUNCE - NEO_MIN_PACKET_SIZE; + break; + + case OID_GEN_MAXIMUM_TOTAL_SIZE: + case OID_GEN_TRANSMIT_BLOCK_SIZE: + case OID_GEN_RECEIVE_BLOCK_SIZE: + // Maximum packet size + value32 = NEO_MAX_PACKET_SIZE_ANNOUNCE; + break; + + case OID_GEN_TRANSMIT_BUFFER_SPACE: + case OID_GEN_RECEIVE_BUFFER_SPACE: + // Buffer size + value32 = NEO_MAX_PACKET_SIZE_ANNOUNCE * NEO_MAX_PACKET_EXCHANGE; + break; + + case OID_GEN_LINK_SPEED: + // Communication speed + value32 = (UINT)(max_speed / 100); + break; + + case OID_GEN_VENDOR_ID: + // Vendor ID + NeoCopy(&value32, ctx->MacAddress, 3); + value32 &= 0xFFFFFF00; + value32 |= 0x01; + break; + + case OID_GEN_VENDOR_DESCRIPTION: + // Hardware ID + buf = ctx->HardwarePrintableID; + size = (UINT)strlen(ctx->HardwarePrintableID) + 1; + break; + + case OID_GEN_DRIVER_VERSION: + // Driver version + value16 = ((USHORT)NEO_NDIS_MAJOR_VERSION << 8) | NEO_NDIS_MINOR_VERSION; + buf = &value16; + size = sizeof(USHORT); + break; + + case OID_GEN_VENDOR_DRIVER_VERSION: + // Vendor driver version + value16 = ((USHORT)NEO_NDIS_MAJOR_VERSION << 8) | NEO_NDIS_MINOR_VERSION; + buf = &value16; + size = sizeof(USHORT); + break; + + case OID_802_3_PERMANENT_ADDRESS: + case OID_802_3_CURRENT_ADDRESS: + // MAC address + buf = ctx->MacAddress; + size = NEO_MAC_ADDRESS_SIZE; + break; + + case OID_802_3_MAXIMUM_LIST_SIZE: + // Number of multicast + value32 = NEO_MAX_MULTICASE; + break; + + case OID_GEN_MAXIMUM_SEND_PACKETS: + // Number of packets that can be sent at a time + value32 = NEO_MAX_PACKET_EXCHANGE; + break; + + case OID_GEN_XMIT_OK: + // Number of packets sent + value32 = ctx->Status.NumPacketSend; + break; + + case OID_GEN_RCV_OK: + // Number of received packets + value32 = ctx->Status.NumPacketRecv; + break; + + case OID_GEN_XMIT_ERROR: + // Number of transmission error packets + value32 = ctx->Status.NumPacketSendError; + break; + + case OID_GEN_RCV_ERROR: + // Number of error packets received + value32 = ctx->Status.NumPacketRecvError; + break; + + case OID_GEN_RCV_NO_BUFFER: + // Number of reception buffer shortage occurrences + value32 = ctx->Status.NumPacketRecvNoBuffer; + break; + + case OID_802_3_RCV_ERROR_ALIGNMENT: + // Number of errors + value32 = 0; + break; + + case OID_GEN_MEDIA_CONNECT_STATUS: + // Cable connection state + NeoCheckConnectState(); + if (keep_link == false) + { + value32 = ctx->Connected ? NdisMediaStateConnected : NdisMediaStateDisconnected; + } + else + { + value32 = NdisMediaStateConnected; + } + break; + + case OID_802_3_XMIT_ONE_COLLISION: + case OID_802_3_XMIT_MORE_COLLISIONS: + // Number of collisions + value32 = 0; + break; + + case OID_GEN_CURRENT_PACKET_FILTER: + // Current settings of the packet filter + value32 = ctx->CurrentPacketFilter; + break; + +/* case OID_GEN_PROTOCOL_OPTIONS: + // Current value of the protocol option + value32 = ctx->CurrentProtocolOptions; + break;*/ + + case OID_GEN_STATISTICS: + // Statistics (NDIS 6.0) + NeoZero(&stat, sizeof(stat)); + buf = &stat; + size = sizeof(stat); + + stat.Header.Type = NDIS_OBJECT_TYPE_DEFAULT; + stat.Header.Revision = NDIS_STATISTICS_INFO_REVISION_1; + stat.Header.Size = NDIS_SIZEOF_STATISTICS_INFO_REVISION_1; + stat.SupportedStatistics = + NDIS_STATISTICS_FLAGS_VALID_DIRECTED_FRAMES_RCV | + NDIS_STATISTICS_FLAGS_VALID_MULTICAST_FRAMES_RCV | + NDIS_STATISTICS_FLAGS_VALID_BROADCAST_FRAMES_RCV | + NDIS_STATISTICS_FLAGS_VALID_BYTES_RCV | + NDIS_STATISTICS_FLAGS_VALID_RCV_DISCARDS | + NDIS_STATISTICS_FLAGS_VALID_RCV_ERROR | + NDIS_STATISTICS_FLAGS_VALID_DIRECTED_FRAMES_XMIT | + NDIS_STATISTICS_FLAGS_VALID_MULTICAST_FRAMES_XMIT | + NDIS_STATISTICS_FLAGS_VALID_BROADCAST_FRAMES_XMIT | + NDIS_STATISTICS_FLAGS_VALID_BYTES_XMIT | + NDIS_STATISTICS_FLAGS_VALID_XMIT_ERROR | + NDIS_STATISTICS_FLAGS_VALID_XMIT_DISCARDS | + NDIS_STATISTICS_FLAGS_VALID_DIRECTED_BYTES_RCV | + NDIS_STATISTICS_FLAGS_VALID_MULTICAST_BYTES_RCV | + NDIS_STATISTICS_FLAGS_VALID_BROADCAST_BYTES_RCV | + NDIS_STATISTICS_FLAGS_VALID_DIRECTED_BYTES_XMIT | + NDIS_STATISTICS_FLAGS_VALID_MULTICAST_BYTES_XMIT | + NDIS_STATISTICS_FLAGS_VALID_BROADCAST_BYTES_XMIT; + + stat.ifInErrors = ctx->Status.Int64NumRecvError; + stat.ifHCInOctets = ctx->Status.Int64BytesRecvTotal; + stat.ifHCInUcastPkts = ctx->Status.Int64NumRecvUnicast; + stat.ifHCInBroadcastPkts = ctx->Status.Int64NumRecvBroadcast; + stat.ifHCOutOctets = ctx->Status.Int64BytesSendTotal; + stat.ifHCOutUcastPkts = ctx->Status.Int64NumSendUnicast; + stat.ifHCOutBroadcastPkts = ctx->Status.Int64NumSendBroadcast; + stat.ifOutErrors = ctx->Status.Int64NumSendError; + stat.ifHCInUcastOctets = ctx->Status.Int64BytesRecvUnicast; + stat.ifHCInBroadcastOctets = ctx->Status.Int64BytesRecvBroadcast; + stat.ifHCOutUcastOctets = ctx->Status.Int64BytesSendUnicast; + stat.ifHCOutBroadcastOctets = ctx->Status.Int64BytesSendBroadcast; + break; + + case OID_GEN_INTERRUPT_MODERATION: + // Interrupt Moderation (NDIS 6.0) + NeoZero(&intp, sizeof(intp)); + buf = &intp; + size = sizeof(intp); + + intp.Header.Type = NDIS_OBJECT_TYPE_DEFAULT; + intp.Header.Revision = NDIS_INTERRUPT_MODERATION_PARAMETERS_REVISION_1; + intp.Header.Size = NDIS_SIZEOF_INTERRUPT_MODERATION_PARAMETERS_REVISION_1; + intp.InterruptModeration = NdisInterruptModerationNotSupported; + break; + + default: + // Unknown OID + *BytesWritten = 0; + return NDIS_STATUS_INVALID_OID; + } + + if (size > InformationBufferLength) + { + // Undersize + *BytesNeeded = size; + *BytesWritten = 0; + return NDIS_STATUS_INVALID_LENGTH; + } + + // Data copy + NeoCopy(InformationBuffer, buf, size); + *BytesWritten = size; + + return NDIS_STATUS_SUCCESS; +} + +// Set the cable connection state +void NeoSetConnectState(BOOL connected) +{ + if (ctx == NULL) + { + return; + } + ctx->Connected = connected; + NeoCheckConnectState(); +} + +// Check the cable connection state +void NeoCheckConnectState() +{ + NDIS_STATUS_INDICATION t; + NDIS_LINK_STATE state; + if (ctx == NULL || ctx->NdisMiniport == NULL) + { + return; + } + + NeoZero(&t, sizeof(t)); + t.Header.Type = NDIS_OBJECT_TYPE_STATUS_INDICATION; + t.Header.Revision = NDIS_STATUS_INDICATION_REVISION_1; + t.Header.Size = NDIS_SIZEOF_STATUS_INDICATION_REVISION_1; + + t.SourceHandle = ctx->NdisMiniport; + + NeoZero(&state, sizeof(state)); + state.Header.Type = NDIS_OBJECT_TYPE_DEFAULT; + state.Header.Revision = NDIS_LINK_STATE_REVISION_1; + state.Header.Size = NDIS_SIZEOF_LINK_STATE_REVISION_1; + + state.MediaDuplexState = NdisPauseFunctionsSendAndReceive; + state.XmitLinkSpeed = state.RcvLinkSpeed = max_speed; + state.PauseFunctions = NdisPauseFunctionsUnsupported; + + t.StatusCode = NDIS_STATUS_LINK_STATE; + t.StatusBuffer = &state; + t.StatusBufferSize = sizeof(NDIS_LINK_STATE); + + if (keep_link == false) + { + if (ctx->ConnectedOld != ctx->Connected || ctx->ConnectedForce) + { + ctx->ConnectedForce = FALSE; + ctx->ConnectedOld = ctx->Connected; + if (ctx->Halting == FALSE) + { + state.MediaConnectState = ctx->Connected ? MediaConnectStateConnected : MediaConnectStateDisconnected; + NdisMIndicateStatusEx(ctx->NdisMiniport, &t); + } + } + } + else + { + if (ctx->ConnectedForce) + { + ctx->ConnectedForce = false; + + if (ctx->Halting == FALSE) + { + state.MediaConnectState = MediaConnectStateConnected; + NdisMIndicateStatusEx(ctx->NdisMiniport, &t); + } + } + } +} + +// Information setting handler of adapter +NDIS_STATUS NeoNdisSet( + NDIS_HANDLE MiniportAdapterContext, + NDIS_OID Oid, + void *InformationBuffer, + ULONG InformationBufferLength, + ULONG *BytesRead, + ULONG *BytesNeeded) +{ + if (ctx == NULL) + { + return STATUS_UNSUCCESSFUL; + } + + // Initialization + *BytesRead = 0; + *BytesNeeded = 0; + + // Branch processing + switch (Oid) + { + case OID_GEN_CURRENT_PACKET_FILTER: + /* Packet filter */ + if (InformationBufferLength != 4) + { + *BytesNeeded = 4; + return NDIS_STATUS_INVALID_LENGTH; + } + *BytesRead = 4; + ctx->CurrentPacketFilter = *((UINT *)InformationBuffer); + return NDIS_STATUS_SUCCESS; + +// case OID_GEN_PROTOCOL_OPTIONS: + /* Current protocol option value */ +/* if (InformationBufferLength != 4) + { + *BytesNeeded = 4; + return NDIS_STATUS_INVALID_LENGTH; + } + *BytesRead = 4; + ctx->CurrentProtocolOptions = *((UINT *)InformationBuffer); + return NDIS_STATUS_SUCCESS;*/ + + case OID_GEN_CURRENT_LOOKAHEAD: + /* Look ahead */ + if (InformationBufferLength != 4) + { + *BytesNeeded = 4; + return NDIS_STATUS_INVALID_LENGTH; + } + *BytesRead = 4; + return NDIS_STATUS_SUCCESS; + + case OID_GEN_LINK_PARAMETERS: + // NDIS 6.0 Link setting + *BytesRead = InformationBufferLength; + return NDIS_STATUS_SUCCESS; + + case OID_802_3_MULTICAST_LIST: + // Multicast list + *BytesRead = InformationBufferLength; + + return NDIS_STATUS_SUCCESS; + + case OID_PNP_SET_POWER: + case OID_PNP_QUERY_POWER: + // Power events + *BytesRead = InformationBufferLength; + + return NDIS_STATUS_SUCCESS; + } + + return NDIS_STATUS_INVALID_OID; +} + +// Set status values of NET_BUFFER_LISTs +void NeoNdisSetNetBufferListsStatus(NET_BUFFER_LIST *nbl, UINT status) +{ + if (nbl == NULL) + { + return; + } + + while (nbl != NULL) + { + NET_BUFFER_LIST_STATUS(nbl) = status; + + nbl = NET_BUFFER_LIST_NEXT_NBL(nbl); + } +} + +// Packet send handler +void NeoNdisSendNetBufferLists(NDIS_HANDLE MiniportAdapterContext, + NET_BUFFER_LIST *NetBufferLists, + NDIS_PORT_NUMBER PortNumber, + ULONG SendFlags) +{ + bool is_dispatch_level = SendFlags & NDIS_SEND_FLAGS_DISPATCH_LEVEL; + UINT send_complete_flags = 0; + if (ctx == NULL) + { + return; + } + + if (is_dispatch_level) + { + send_complete_flags |= NDIS_SEND_COMPLETE_FLAGS_DISPATCH_LEVEL; + } + + InterlockedIncrement(&ctx->NumCurrentDispatch); + + // Update the connection state + NeoCheckConnectState(); + + if (ctx->Halting != FALSE || ctx->Opened == FALSE || ctx->Paused) + { + UINT status = NDIS_STATUS_FAILURE; + + if (ctx->Paused) + { + status = NDIS_STATUS_PAUSED; + } + else if (ctx->Halting) + { + status = NDIS_STATUS_FAILURE; + } + else if (ctx->Opened == false && keep_link) + { + status = NDIS_STATUS_SUCCESS; + } + + NeoNdisSetNetBufferListsStatus(NetBufferLists, status); + + InterlockedDecrement(&ctx->NumCurrentDispatch); + + NdisMSendNetBufferListsComplete(ctx->NdisMiniport, NetBufferLists, send_complete_flags); + + return; + } + + // Operation of the packet queue + NeoLockPacketQueue(); + { + NET_BUFFER_LIST *nbl; + + if (ctx->Halting != FALSE || ctx->Opened == FALSE || ctx->Paused) + { + UINT status = NDIS_STATUS_FAILURE; + + if (ctx->Paused) + { + status = NDIS_STATUS_PAUSED; + } + else if (ctx->Halting) + { + status = NDIS_STATUS_FAILURE; + } + else if (ctx->Opened == false && keep_link) + { + status = NDIS_STATUS_SUCCESS; + } + + NeoUnlockPacketQueue(); + + NeoNdisSetNetBufferListsStatus(NetBufferLists, status); + + InterlockedDecrement(&ctx->NumCurrentDispatch); + + NdisMSendNetBufferListsComplete(ctx->NdisMiniport, NetBufferLists, send_complete_flags); + + return; + } + + nbl = NetBufferLists; + + while (nbl != NULL) + { + NET_BUFFER *nb = NET_BUFFER_LIST_FIRST_NB(nbl); + + NET_BUFFER_LIST_STATUS(nbl) = NDIS_STATUS_SUCCESS; + + while (nb != NULL) + { + UINT size = NET_BUFFER_DATA_LENGTH(nb); + + if (size >= NEO_MIN_PACKET_SIZE && size <= NEO_MAX_PACKET_SIZE) + { + UCHAR *buf = NeoMalloc(size); + void *ptr; + + ptr = NdisGetDataBuffer(nb, size, buf, 1, 0); + + if (ptr == NULL) + { + ctx->Status.NumPacketSendError++; + ctx->Status.Int64NumSendError++; + NeoFree(buf); + } + else + { + if (ptr != buf) + { + NeoCopy(buf, ptr, size); + } + + NeoInsertQueue(buf, size); + ctx->Status.NumPacketSend++; + + if (buf[0] & 0x40) + { + ctx->Status.Int64NumSendBroadcast++; + ctx->Status.Int64BytesSendBroadcast += (UINT64)size; + } + else + { + ctx->Status.Int64NumSendUnicast++; + ctx->Status.Int64BytesSendUnicast += (UINT64)size; + } + + ctx->Status.Int64BytesSendTotal += (UINT64)size; + } + } + else + { + ctx->Status.NumPacketSendError++; + ctx->Status.Int64NumSendError++; + } + + nb = NET_BUFFER_NEXT_NB(nb); + } + + nbl = NET_BUFFER_LIST_NEXT_NBL(nbl); + } + + // Reception event + NeoSet(ctx->Event); + } + NeoUnlockPacketQueue(); + + // Notify the transmission completion + InterlockedDecrement(&ctx->NumCurrentDispatch); + NdisMSendNetBufferListsComplete(ctx->NdisMiniport, NetBufferLists, send_complete_flags); +} + +// Initialize the packet array +void NeoInitPacketArray() +{ + UINT i; + // Create a packet buffer + for (i = 0;i < NEO_MAX_PACKET_EXCHANGE;i++) + { + ctx->PacketBuffer[i] = NeoNewPacketBuffer(); + } +} + +// Release the packet array +void NeoFreePacketArray() +{ + UINT i; + for (i = 0;i < NEO_MAX_PACKET_EXCHANGE;i++) + { + NeoFreePacketBuffer(ctx->PacketBuffer[i]); + ctx->PacketBuffer[i] = NULL; + } +} + +// Release the packet buffer +void NeoFreePacketBuffer(PACKET_BUFFER *p) +{ + // Validate arguments + if (p == NULL) + { + return; + } + + // Release the NET_BUFFER_LIST + NdisFreeNetBufferList(p->NetBufferList); + // Release the NET_BUFFER_LIST pool + NdisFreeNetBufferListPool(p->NetBufferListPool); + // Release the memory + NeoFree(p); +} + +// Create a packet buffer +PACKET_BUFFER *NeoNewPacketBuffer() +{ + PACKET_BUFFER *p; + NET_BUFFER_LIST_POOL_PARAMETERS p1; + + // Memory allocation + p = NeoZeroMalloc(sizeof(PACKET_BUFFER)); + + // Create a NET_BUFFER_LIST pool + NeoZero(&p1, sizeof(p1)); + p1.Header.Type = NDIS_OBJECT_TYPE_DEFAULT; + p1.Header.Revision = NET_BUFFER_LIST_POOL_PARAMETERS_REVISION_1; + p1.Header.Size = NDIS_SIZEOF_NET_BUFFER_LIST_POOL_PARAMETERS_REVISION_1; + p1.ProtocolId = NDIS_PROTOCOL_ID_DEFAULT; + p1.fAllocateNetBuffer = TRUE; + p1.DataSize = NEO_MAX_PACKET_SIZE; + p1.PoolTag = 'SETH'; + p->NetBufferListPool = NdisAllocateNetBufferListPool(NULL, &p1); + + // Create a NET_BUFFER_LIST + p->NetBufferList = NdisAllocateNetBufferList(p->NetBufferListPool, 0, 0); + + return p; +} + +// Reset the event +void NeoReset(NEO_EVENT *event) +{ + // Validate arguments + if (event == NULL) + { + return; + } + + KeResetEvent(event->event); +} + +// Set the event +void NeoSet(NEO_EVENT *event) +{ + // Validate arguments + if (event == NULL) + { + return; + } + + KeSetEvent(event->event, 0, FALSE); +} + +// Release the event +void NeoFreeEvent(NEO_EVENT *event) +{ + // Validate arguments + if (event == NULL) + { + return; + } + + ZwClose(event->event_handle); + + // Release the memory + NeoFree(event); +} + +// Create a new event +NEO_EVENT *NeoNewEvent(char *name) +{ + UNICODE *unicode_name; + NEO_EVENT *event; + // Validate arguments + if (name == NULL) + { + return NULL; + } + + // Convert the name to Unicode + unicode_name = NewUnicode(name); + if (unicode_name == NULL) + { + return NULL; + } + + // Memory allocation + event = NeoZeroMalloc(sizeof(NEO_EVENT)); + if (event == NULL) + { + FreeUnicode(unicode_name); + return NULL; + } + + // Create an Event + event->event = IoCreateNotificationEvent(GetUnicode(unicode_name), &event->event_handle); + if (event->event == NULL) + { + NeoFree(event); + FreeUnicode(unicode_name); + return NULL; + } + + // Initialize the event + KeInitializeEvent(event->event, NotificationEvent, FALSE); + KeClearEvent(event->event); + + // Release a string + FreeUnicode(unicode_name); + + return event; +} + +// Get the Unicode string +NDIS_STRING *GetUnicode(UNICODE *u) +{ + // Validate arguments + if (u == NULL) + { + return NULL; + } + + return &u->String; +} + +// Release the Unicode strings +void FreeUnicode(UNICODE *u) +{ + // Validate arguments + if (u == NULL) + { + return; + } + + // Release a string + NdisFreeString(u->String); + + // Release the memory + NeoFree(u); +} + +// Create a new Unicode string +UNICODE *NewUnicode(char *str) +{ + UNICODE *u; + // Validate arguments + if (str == NULL) + { + return NULL; + } + + // Memory allocation + u = NeoZeroMalloc(sizeof(UNICODE)); + if (u == NULL) + { + return NULL; + } + + // String initialization + NdisInitializeString(&u->String, str); + + return u; +} + +// Release the lock +void NeoFreeLock(NEO_LOCK *lock) +{ + NDIS_SPIN_LOCK *spin_lock; + // Validate arguments + if (lock == NULL) + { + return; + } + + spin_lock = &lock->spin_lock; + NdisFreeSpinLock(spin_lock); + + // Release the memory + NeoFree(lock); +} + +// Unlock +void NeoUnlock(NEO_LOCK *lock) +{ + NDIS_SPIN_LOCK *spin_lock; + // Validate arguments + if (lock == NULL) + { + return; + } + + spin_lock = &lock->spin_lock; + NdisReleaseSpinLock(spin_lock); +} + +// Lock +void NeoLock(NEO_LOCK *lock) +{ + NDIS_SPIN_LOCK *spin_lock; + // Validate arguments + if (lock == NULL) + { + return; + } + + spin_lock = &lock->spin_lock; + NdisAcquireSpinLock(spin_lock); +} + +// Creating a new lock +NEO_LOCK *NeoNewLock() +{ + NDIS_SPIN_LOCK *spin_lock; + + // Memory allocation + NEO_LOCK *lock = NeoZeroMalloc(sizeof(NEO_LOCK)); + if (lock == NULL) + { + return NULL; + } + + // Initialize spin lock + spin_lock = &lock->spin_lock; + + NdisAllocateSpinLock(spin_lock); + + return lock; +} + +// Memory copy +void NeoCopy(void *dst, void *src, UINT size) +{ + // Validate arguments + if (dst == NULL || src == NULL || size == 0) + { + return; + } + + // Copy + NdisMoveMemory(dst, src, size); +} + +// Memory clear +void NeoZero(void *dst, UINT size) +{ + // Validate arguments + if (dst == NULL || size == 0) + { + return; + } + + // Clear + NdisZeroMemory(dst, size); +} + +// Clear to zero by memory allocation +void *NeoZeroMalloc(UINT size) +{ + void *p = NeoMalloc(size); + if (p == NULL) + { + // Memory allocation failure + return NULL; + } + // Clear to zero + NeoZero(p, size); + return p; +} + +// Memory allocation +void *NeoMalloc(UINT size) +{ + NDIS_STATUS r; + void *p; + if (size == 0) + { + size = 1; + } + + // Allocate the non-paged memory + r = NdisAllocateMemoryWithTag(&p, size, 'SETH'); + + if (NG(r)) + { + return NULL; + } + return p; +} + +// Release the memory +void NeoFree(void *p) +{ + // Validate arguments + if (p == NULL) + { + return; + } + + // Release the memory + NdisFreeMemory(p, 0, 0); +} + + diff --git a/src/Neo6/NDIS6.h b/src/Neo6/NDIS6.h index 2c33bb5f..16d2ee6c 100644 --- a/src/Neo6/NDIS6.h +++ b/src/Neo6/NDIS6.h @@ -1,161 +1,161 @@ -// SoftEther VPN Source Code - Developer Edition Master Branch -// Kernel Device Driver - - -// NDIS6.h -// Header of NDIS6.c - -#ifndef NDIS5_H -#define NDIS5_H - -// Win32 DDK related -#ifndef CPU_64 -#define _X86_ -#else // CPU_64 -#ifndef NEO_IA64 -#define _AMD64_ -#define AMD64 -#else // NEO_IA64 -#define _IA64_ -#define IA64 -#endif // NEO_IA64 -#endif // CPU_64 -#define NDIS_MINIPORT_DRIVER -// NDIS 6.2 -#define NDIS620_MINIPORT -#define NDIS_SUPPORT_NDIS61 1 -#define NDIS_SUPPORT_NDIS620 1 -#define NEO_NDIS_MAJOR_VERSION 6 -#define NEO_NDIS_MINOR_VERSION 20 -#define NDIS_WDM 1 - -#include -#include -#include -#include - -// Error checking macro -#define OK(val) ((val) == STATUS_SUCCESS) -#define NG(val) (!OK(val)) - -// Constant -static UINT SupportedOids[] = -{ - OID_GEN_SUPPORTED_LIST, - OID_GEN_HARDWARE_STATUS, - OID_GEN_MEDIA_SUPPORTED, - OID_GEN_MEDIA_IN_USE, - OID_GEN_MAXIMUM_FRAME_SIZE, - OID_GEN_MAXIMUM_TOTAL_SIZE, - OID_GEN_MAC_OPTIONS, - OID_GEN_MAXIMUM_LOOKAHEAD, - OID_GEN_CURRENT_LOOKAHEAD, - OID_GEN_LINK_SPEED, - OID_GEN_MEDIA_CONNECT_STATUS, - OID_GEN_TRANSMIT_BUFFER_SPACE, - OID_GEN_RECEIVE_BUFFER_SPACE, - OID_GEN_TRANSMIT_BLOCK_SIZE, - OID_GEN_RECEIVE_BLOCK_SIZE, - OID_GEN_VENDOR_DESCRIPTION, - OID_GEN_VENDOR_ID, - OID_GEN_DRIVER_VERSION, - OID_GEN_VENDOR_DRIVER_VERSION, - OID_GEN_XMIT_OK, - OID_GEN_RCV_OK, - OID_GEN_XMIT_ERROR, - OID_GEN_RCV_ERROR, - OID_GEN_RCV_NO_BUFFER, - OID_GEN_CURRENT_PACKET_FILTER, - OID_802_3_PERMANENT_ADDRESS, - OID_802_3_CURRENT_ADDRESS, - OID_802_3_MAXIMUM_LIST_SIZE, - OID_802_3_RCV_ERROR_ALIGNMENT, - OID_802_3_XMIT_ONE_COLLISION, - OID_802_3_XMIT_MORE_COLLISIONS, - OID_802_3_MULTICAST_LIST, - //OID_GEN_PROTOCOL_OPTIONS, - OID_GEN_MAXIMUM_SEND_PACKETS, - OID_GEN_STATISTICS, - OID_GEN_INTERRUPT_MODERATION, - OID_GEN_LINK_PARAMETERS, - OID_PNP_SET_POWER, - OID_PNP_QUERY_POWER, - }; -#define NEO_MEDIA NdisMedium802_3 -#define MAX_MULTICAST 32 - -#define MAX_PATH 260 -#define MAX_SIZE 512 -#define STD_SIZE 512 - - - -// Unicode string -typedef struct _UNICODE -{ - UNICODE_STRING String; -} UNICODE; - -typedef struct _PACKET_BUFFER PACKET_BUFFER; - -// Function prototype -UNICODE *NewUnicode(char *str); -void FreeUnicode(UNICODE *u); -NDIS_STRING *GetUnicode(UNICODE *u); -PACKET_BUFFER *NeoNewPacketBuffer(); -void NeoFreePacketBuffer(PACKET_BUFFER *p); -void NeoInitPacketArray(); -void NeoFreePacketArray(); -NDIS_STATUS DriverEntry(DRIVER_OBJECT *DriverObject, UNICODE_STRING *RegistryPath); -NDIS_STATUS NeoNdisInitEx(NDIS_HANDLE MiniportAdapterHandle, - NDIS_HANDLE MiniportDriverContext, - PNDIS_MINIPORT_INIT_PARAMETERS MiniportInitParameters); -void NeoNdisHaltEx(NDIS_HANDLE MiniportAdapterContext, NDIS_HALT_ACTION HaltAction); -VOID NeoNdisDriverUnload(PDRIVER_OBJECT DriverObject); -NDIS_STATUS NeoNdisResetEx(NDIS_HANDLE MiniportAdapterContext, PBOOLEAN AddressingReset); -BOOLEAN NeoNdisCheckForHangEx(NDIS_HANDLE MiniportAdapterContext); -NDIS_STATUS NeoNdisQuery(NDIS_HANDLE MiniportAdapterContext, - NDIS_OID Oid, - void *InformationBuffer, - ULONG InformationBufferLength, - ULONG *BytesWritten, - ULONG *BytesNeeded); -NDIS_STATUS NeoNdisSet( - NDIS_HANDLE MiniportAdapterContext, - NDIS_OID Oid, - void *InformationBuffer, - ULONG InformationBufferLength, - ULONG *BytesRead, - ULONG *BytesNeeded); -NDIS_STATUS NeoNdisOidRequest(NDIS_HANDLE MiniportAdapterContext, - PNDIS_OID_REQUEST OidRequest); -void NeoNdisSendNetBufferLists(NDIS_HANDLE MiniportAdapterContext, - NET_BUFFER_LIST *NetBufferLists, - NDIS_PORT_NUMBER PortNumber, - ULONG SendFlags); -void NeoNdisSetNetBufferListsStatus(NET_BUFFER_LIST *nbl, UINT status); -BOOL NeoLoadRegistry(); -void NeoInitControlDevice(); -void NeoFreeControlDevice(); -NTSTATUS NeoNdisDispatch(DEVICE_OBJECT *DeviceObject, IRP *Irp); -void NeoCheckConnectState(); -void NeoSetConnectState(BOOL connected); -BOOL NeoNdisOnOpen(IRP *irp, IO_STACK_LOCATION *stack); -BOOL NeoNdisOnClose(IRP *irp, IO_STACK_LOCATION *stack); -void NeoNdisCrash(); -void NeoNdisCrash2(); - -NDIS_STATUS NeoNdisSetOptions(NDIS_HANDLE NdisDriverHandle, NDIS_HANDLE DriverContext); -NDIS_STATUS NeoNdisPause(NDIS_HANDLE MiniportAdapterContext, PNDIS_MINIPORT_PAUSE_PARAMETERS MiniportPauseParameters); -NDIS_STATUS NeoNdisRestart(NDIS_HANDLE MiniportAdapterContext, PNDIS_MINIPORT_RESTART_PARAMETERS MiniportRestartParameters); -void NeoNdisReturnNetBufferLists(NDIS_HANDLE MiniportAdapterContext, PNET_BUFFER_LIST NetBufferLists, ULONG ReturnFlags); -void NeoNdisCancelSend(NDIS_HANDLE MiniportAdapterContext, PVOID CancelId); -void NeoNdisDevicePnPEventNotify(NDIS_HANDLE MiniportAdapterContext, PNET_DEVICE_PNP_EVENT NetDevicePnPEvent); -void NeoNdisShutdownEx(NDIS_HANDLE MiniportAdapterContext, NDIS_SHUTDOWN_ACTION ShutdownAction); -void NeoNdisCancelOidRequest(NDIS_HANDLE MiniportAdapterContext, PVOID RequestId); - -// NeoNdisCrash2(__LINE__, __LINE__, __LINE__, __LINE__); - - -#endif // NDIS5_H - +// SoftEther VPN Source Code - Developer Edition Master Branch +// Kernel Device Driver + + +// NDIS6.h +// Header of NDIS6.c + +#ifndef NDIS5_H +#define NDIS5_H + +// Win32 DDK related +#ifndef CPU_64 +#define _X86_ +#else // CPU_64 +#ifndef NEO_IA64 +#define _AMD64_ +#define AMD64 +#else // NEO_IA64 +#define _IA64_ +#define IA64 +#endif // NEO_IA64 +#endif // CPU_64 +#define NDIS_MINIPORT_DRIVER +// NDIS 6.2 +#define NDIS620_MINIPORT +#define NDIS_SUPPORT_NDIS61 1 +#define NDIS_SUPPORT_NDIS620 1 +#define NEO_NDIS_MAJOR_VERSION 6 +#define NEO_NDIS_MINOR_VERSION 20 +#define NDIS_WDM 1 + +#include +#include +#include +#include + +// Error checking macro +#define OK(val) ((val) == STATUS_SUCCESS) +#define NG(val) (!OK(val)) + +// Constant +static UINT SupportedOids[] = +{ + OID_GEN_SUPPORTED_LIST, + OID_GEN_HARDWARE_STATUS, + OID_GEN_MEDIA_SUPPORTED, + OID_GEN_MEDIA_IN_USE, + OID_GEN_MAXIMUM_FRAME_SIZE, + OID_GEN_MAXIMUM_TOTAL_SIZE, + OID_GEN_MAC_OPTIONS, + OID_GEN_MAXIMUM_LOOKAHEAD, + OID_GEN_CURRENT_LOOKAHEAD, + OID_GEN_LINK_SPEED, + OID_GEN_MEDIA_CONNECT_STATUS, + OID_GEN_TRANSMIT_BUFFER_SPACE, + OID_GEN_RECEIVE_BUFFER_SPACE, + OID_GEN_TRANSMIT_BLOCK_SIZE, + OID_GEN_RECEIVE_BLOCK_SIZE, + OID_GEN_VENDOR_DESCRIPTION, + OID_GEN_VENDOR_ID, + OID_GEN_DRIVER_VERSION, + OID_GEN_VENDOR_DRIVER_VERSION, + OID_GEN_XMIT_OK, + OID_GEN_RCV_OK, + OID_GEN_XMIT_ERROR, + OID_GEN_RCV_ERROR, + OID_GEN_RCV_NO_BUFFER, + OID_GEN_CURRENT_PACKET_FILTER, + OID_802_3_PERMANENT_ADDRESS, + OID_802_3_CURRENT_ADDRESS, + OID_802_3_MAXIMUM_LIST_SIZE, + OID_802_3_RCV_ERROR_ALIGNMENT, + OID_802_3_XMIT_ONE_COLLISION, + OID_802_3_XMIT_MORE_COLLISIONS, + OID_802_3_MULTICAST_LIST, + //OID_GEN_PROTOCOL_OPTIONS, + OID_GEN_MAXIMUM_SEND_PACKETS, + OID_GEN_STATISTICS, + OID_GEN_INTERRUPT_MODERATION, + OID_GEN_LINK_PARAMETERS, + OID_PNP_SET_POWER, + OID_PNP_QUERY_POWER, + }; +#define NEO_MEDIA NdisMedium802_3 +#define MAX_MULTICAST 32 + +#define MAX_PATH 260 +#define MAX_SIZE 512 +#define STD_SIZE 512 + + + +// Unicode string +typedef struct _UNICODE +{ + UNICODE_STRING String; +} UNICODE; + +typedef struct _PACKET_BUFFER PACKET_BUFFER; + +// Function prototype +UNICODE *NewUnicode(char *str); +void FreeUnicode(UNICODE *u); +NDIS_STRING *GetUnicode(UNICODE *u); +PACKET_BUFFER *NeoNewPacketBuffer(); +void NeoFreePacketBuffer(PACKET_BUFFER *p); +void NeoInitPacketArray(); +void NeoFreePacketArray(); +NDIS_STATUS DriverEntry(DRIVER_OBJECT *DriverObject, UNICODE_STRING *RegistryPath); +NDIS_STATUS NeoNdisInitEx(NDIS_HANDLE MiniportAdapterHandle, + NDIS_HANDLE MiniportDriverContext, + PNDIS_MINIPORT_INIT_PARAMETERS MiniportInitParameters); +void NeoNdisHaltEx(NDIS_HANDLE MiniportAdapterContext, NDIS_HALT_ACTION HaltAction); +VOID NeoNdisDriverUnload(PDRIVER_OBJECT DriverObject); +NDIS_STATUS NeoNdisResetEx(NDIS_HANDLE MiniportAdapterContext, PBOOLEAN AddressingReset); +BOOLEAN NeoNdisCheckForHangEx(NDIS_HANDLE MiniportAdapterContext); +NDIS_STATUS NeoNdisQuery(NDIS_HANDLE MiniportAdapterContext, + NDIS_OID Oid, + void *InformationBuffer, + ULONG InformationBufferLength, + ULONG *BytesWritten, + ULONG *BytesNeeded); +NDIS_STATUS NeoNdisSet( + NDIS_HANDLE MiniportAdapterContext, + NDIS_OID Oid, + void *InformationBuffer, + ULONG InformationBufferLength, + ULONG *BytesRead, + ULONG *BytesNeeded); +NDIS_STATUS NeoNdisOidRequest(NDIS_HANDLE MiniportAdapterContext, + PNDIS_OID_REQUEST OidRequest); +void NeoNdisSendNetBufferLists(NDIS_HANDLE MiniportAdapterContext, + NET_BUFFER_LIST *NetBufferLists, + NDIS_PORT_NUMBER PortNumber, + ULONG SendFlags); +void NeoNdisSetNetBufferListsStatus(NET_BUFFER_LIST *nbl, UINT status); +BOOL NeoLoadRegistry(); +void NeoInitControlDevice(); +void NeoFreeControlDevice(); +NTSTATUS NeoNdisDispatch(DEVICE_OBJECT *DeviceObject, IRP *Irp); +void NeoCheckConnectState(); +void NeoSetConnectState(BOOL connected); +BOOL NeoNdisOnOpen(IRP *irp, IO_STACK_LOCATION *stack); +BOOL NeoNdisOnClose(IRP *irp, IO_STACK_LOCATION *stack); +void NeoNdisCrash(); +void NeoNdisCrash2(); + +NDIS_STATUS NeoNdisSetOptions(NDIS_HANDLE NdisDriverHandle, NDIS_HANDLE DriverContext); +NDIS_STATUS NeoNdisPause(NDIS_HANDLE MiniportAdapterContext, PNDIS_MINIPORT_PAUSE_PARAMETERS MiniportPauseParameters); +NDIS_STATUS NeoNdisRestart(NDIS_HANDLE MiniportAdapterContext, PNDIS_MINIPORT_RESTART_PARAMETERS MiniportRestartParameters); +void NeoNdisReturnNetBufferLists(NDIS_HANDLE MiniportAdapterContext, PNET_BUFFER_LIST NetBufferLists, ULONG ReturnFlags); +void NeoNdisCancelSend(NDIS_HANDLE MiniportAdapterContext, PVOID CancelId); +void NeoNdisDevicePnPEventNotify(NDIS_HANDLE MiniportAdapterContext, PNET_DEVICE_PNP_EVENT NetDevicePnPEvent); +void NeoNdisShutdownEx(NDIS_HANDLE MiniportAdapterContext, NDIS_SHUTDOWN_ACTION ShutdownAction); +void NeoNdisCancelOidRequest(NDIS_HANDLE MiniportAdapterContext, PVOID RequestId); + +// NeoNdisCrash2(__LINE__, __LINE__, __LINE__, __LINE__); + + +#endif // NDIS5_H + diff --git a/src/Neo6/Neo6.c b/src/Neo6/Neo6.c index 57e188b2..63663897 100644 --- a/src/Neo6/Neo6.c +++ b/src/Neo6/Neo6.c @@ -1,432 +1,432 @@ -// SoftEther VPN Source Code - Developer Edition Master Branch -// Kernel Device Driver - - -// Neo6.c -// Driver Main Program - -#include - -#define NEO_DEVICE_DRIVER - -#include "Neo6.h" - -// Whether Win8 -extern bool g_is_win8; - -// Neo driver context -static NEO_CTX static_ctx; -NEO_CTX *ctx = &static_ctx; - -// Read the packet data from the transmit packet queue -void NeoRead(void *buf) -{ - NEO_QUEUE *q; - UINT num; - BOOL left; - // Validate arguments - if (buf == NULL) - { - return; - } - - // Copy the packets one by one from the queue - num = 0; - left = TRUE; - NeoLockPacketQueue(); - { - while (TRUE) - { - if (num >= NEO_MAX_PACKET_EXCHANGE) - { - if (ctx->PacketQueue == NULL) - { - left = FALSE; - } - break; - } - q = NeoGetNextQueue(); - if (q == NULL) - { - left = FALSE; - break; - } - NEO_SIZE_OF_PACKET(buf, num) = q->Size; - NeoCopy(NEO_ADDR_OF_PACKET(buf, num), q->Buf, q->Size); - num++; - NeoFreeQueue(q); - } - } - NeoUnlockPacketQueue(); - - NEO_NUM_PACKET(buf) = num; - NEO_LEFT_FLAG(buf) = left; - - if (left == FALSE) - { - NeoReset(ctx->Event); - } - else - { - NeoSet(ctx->Event); - } - - return; -} - -// Process the received packet -void NeoWrite(void *buf) -{ - UINT num, i, size; - UCHAR *packet_buf; - NET_BUFFER_LIST *nbl_chain = NULL; - NET_BUFFER_LIST *nbl_tail = NULL; - UINT num_nbl_chain = 0; - // Validate arguments - if (buf == NULL) - { - return; - } - - // Number of packets - num = NEO_NUM_PACKET(buf); - if (num > NEO_MAX_PACKET_EXCHANGE) - { - // Number of packets is too many - return; - } - if (num == 0) - { - // No packet - return; - } - - if (ctx->Halting != FALSE) - { - // Stopping - return; - } - - if (ctx->Paused) - { - // Paused - return; - } - - if (ctx->Opened == FALSE) - { - // Not connected - return; - } - - for (i = 0;i < num;i++) - { - PACKET_BUFFER *p = ctx->PacketBuffer[i]; - void *dst; - NET_BUFFER_LIST *nbl = ctx->PacketBuffer[i]->NetBufferList; - NET_BUFFER *nb = NET_BUFFER_LIST_FIRST_NB(nbl); - - nbl->SourceHandle = ctx->NdisMiniport; - - NET_BUFFER_LIST_NEXT_NBL(nbl) = NULL; - - size = NEO_SIZE_OF_PACKET(buf, i); - if (size > NEO_MAX_PACKET_SIZE) - { - size = NEO_MAX_PACKET_SIZE; - } - if (size < NEO_PACKET_HEADER_SIZE) - { - size = NEO_PACKET_HEADER_SIZE; - } - - packet_buf = (UCHAR *)(NEO_ADDR_OF_PACKET(buf, i)); - - if (OK(NdisRetreatNetBufferDataStart(nb, size, 0, NULL))) - { - // Buffer copy - dst = NdisGetDataBuffer(nb, - size, - NULL, - 1, - 0); - - if (dst != NULL) - { - NeoCopy(dst, packet_buf, size); - - if (nbl_chain == NULL) - { - nbl_chain = nbl; - } - - if (nbl_tail != NULL) - { - NET_BUFFER_LIST_NEXT_NBL(nbl_tail) = nbl; - } - - nbl_tail = nbl; - - num_nbl_chain++; - } - } - - nbl->Status = NDIS_STATUS_RESOURCES; - - ctx->Status.Int64BytesRecvTotal += (UINT64)size; - - if (packet_buf[0] & 0x40) - { - ctx->Status.Int64NumRecvBroadcast++; - ctx->Status.Int64BytesRecvBroadcast += (UINT64)size; - } - else - { - ctx->Status.Int64NumRecvUnicast++; - ctx->Status.Int64BytesRecvUnicast += (UINT64)size; - } - } - - if (nbl_chain == NULL) - { - return; - } - - // Notify that it has received - ctx->Status.NumPacketRecv += num_nbl_chain; - - NdisMIndicateReceiveNetBufferLists(ctx->NdisMiniport, - nbl_chain, 0, num_nbl_chain, NDIS_RECEIVE_FLAGS_RESOURCES); - - if (true) - { - // Restore the packet buffer - NET_BUFFER_LIST *nbl = nbl_chain; - - while (nbl != NULL) - { - NET_BUFFER *nb = NET_BUFFER_LIST_FIRST_NB(nbl); - - if (nb != NULL) - { - UINT size = NET_BUFFER_DATA_LENGTH(nb); - - NdisAdvanceNetBufferDataStart(nb, size, false, NULL); - } - - nbl = NET_BUFFER_LIST_NEXT_NBL(nbl); - } - } -} - -// Get the number of queue items -UINT NeoGetNumQueue() -{ - return ctx->NumPacketQueue; -} - -// Insert the queue -void NeoInsertQueue(void *buf, UINT size) -{ - NEO_QUEUE *p; - // Validate arguments - if (buf == NULL || size == 0) - { - return; - } - - // Prevent the packet accumulation in large quantities in the queue - if (ctx->NumPacketQueue > NEO_MAX_PACKET_QUEUED) - { - NeoFree(buf); - return; - } - - // Create a queue - p = NeoMalloc(sizeof(NEO_QUEUE)); - p->Next = NULL; - p->Size = size; - p->Buf = buf; - - // Append to the queue - if (ctx->PacketQueue == NULL) - { - ctx->PacketQueue = p; - } - else - { - NEO_QUEUE *q = ctx->Tail; - q->Next = p; - } - - ctx->Tail = p; - - ctx->NumPacketQueue++; -} - -// Get the next queued item -NEO_QUEUE *NeoGetNextQueue() -{ - NEO_QUEUE *q; - if (ctx->PacketQueue == NULL) - { - // Empty queue - return NULL; - } - - // Get the next queued item - q = ctx->PacketQueue; - ctx->PacketQueue = ctx->PacketQueue->Next; - q->Next = NULL; - ctx->NumPacketQueue--; - - if (ctx->PacketQueue == NULL) - { - ctx->Tail = NULL; - } - - return q; -} - -// Release the buffer of the queue -void NeoFreeQueue(NEO_QUEUE *q) -{ - // Validate arguments - if (q == NULL) - { - return; - } - NeoFree(q->Buf); - NeoFree(q); -} - -// Lock the packet queue -void NeoLockPacketQueue() -{ - NeoLock(ctx->PacketQueueLock); -} - -// Unlock the packet queue -void NeoUnlockPacketQueue() -{ - NeoUnlock(ctx->PacketQueueLock); -} - -// Initialize the packet queue -void NeoInitPacketQueue() -{ - // Create a lock - ctx->PacketQueueLock = NeoNewLock(); - // Initialize the packet queue - ctx->PacketQueue = NULL; - ctx->NumPacketQueue = 0; - ctx->Tail = NULL; -} - -// Delete all the packets from the packet queue -void NeoClearPacketQueue(bool no_lock) -{ - // Release the memory of the packet queue - if (no_lock == false) - { - NeoLock(ctx->PacketQueueLock); - } - if (true) - { - NEO_QUEUE *q = ctx->PacketQueue; - NEO_QUEUE *qn; - while (q != NULL) - { - qn = q->Next; - NeoFree(q->Buf); - NeoFree(q); - q = qn; - } - ctx->PacketQueue = NULL; - ctx->Tail = NULL; - ctx->NumPacketQueue = 0; - } - if (no_lock == false) - { - NeoUnlock(ctx->PacketQueueLock); - } -} - -// Release the packet queue -void NeoFreePacketQueue() -{ - // Delete all packets - NeoClearPacketQueue(false); - - // Delete the lock - NeoFreeLock(ctx->PacketQueueLock); - ctx->PacketQueueLock = NULL; -} - -// Start the adapter -void NeoStartAdapter() -{ - // Initialize the packet queue - NeoInitPacketQueue(); -} - -// Stop the adapter -void NeoStopAdapter() -{ - // Delete the packet queue - NeoFreePacketQueue(); -} - -// Initialization -BOOL NeoInit() -{ - // Initialize the context - NeoZero(ctx, sizeof(NEO_CTX)); - - // Initialize the status information - NeoNewStatus(&ctx->Status); - - return TRUE; -} - -// Shutdown -void NeoShutdown() -{ - if (ctx == NULL) - { - // Uninitialized - return; - } - - // Release the status information - NeoFreeStatus(&ctx->Status); - - NeoZero(ctx, sizeof(NEO_CTX)); -} - -// Create a status information -void NeoNewStatus(NEO_STATUS *s) -{ - // Validate arguments - if (s == NULL) - { - return; - } - - // Memory initialization - NeoZero(s, sizeof(NEO_STATUS)); -} - -// Release the status information -void NeoFreeStatus(NEO_STATUS *s) -{ - // Validate arguments - if (s == NULL) - { - return; - } - - // Memory initialization - NeoZero(s, sizeof(NEO_STATUS)); -} - +// SoftEther VPN Source Code - Developer Edition Master Branch +// Kernel Device Driver + + +// Neo6.c +// Driver Main Program + +#include + +#define NEO_DEVICE_DRIVER + +#include "Neo6.h" + +// Whether Win8 +extern bool g_is_win8; + +// Neo driver context +static NEO_CTX static_ctx; +NEO_CTX *ctx = &static_ctx; + +// Read the packet data from the transmit packet queue +void NeoRead(void *buf) +{ + NEO_QUEUE *q; + UINT num; + BOOL left; + // Validate arguments + if (buf == NULL) + { + return; + } + + // Copy the packets one by one from the queue + num = 0; + left = TRUE; + NeoLockPacketQueue(); + { + while (TRUE) + { + if (num >= NEO_MAX_PACKET_EXCHANGE) + { + if (ctx->PacketQueue == NULL) + { + left = FALSE; + } + break; + } + q = NeoGetNextQueue(); + if (q == NULL) + { + left = FALSE; + break; + } + NEO_SIZE_OF_PACKET(buf, num) = q->Size; + NeoCopy(NEO_ADDR_OF_PACKET(buf, num), q->Buf, q->Size); + num++; + NeoFreeQueue(q); + } + } + NeoUnlockPacketQueue(); + + NEO_NUM_PACKET(buf) = num; + NEO_LEFT_FLAG(buf) = left; + + if (left == FALSE) + { + NeoReset(ctx->Event); + } + else + { + NeoSet(ctx->Event); + } + + return; +} + +// Process the received packet +void NeoWrite(void *buf) +{ + UINT num, i, size; + UCHAR *packet_buf; + NET_BUFFER_LIST *nbl_chain = NULL; + NET_BUFFER_LIST *nbl_tail = NULL; + UINT num_nbl_chain = 0; + // Validate arguments + if (buf == NULL) + { + return; + } + + // Number of packets + num = NEO_NUM_PACKET(buf); + if (num > NEO_MAX_PACKET_EXCHANGE) + { + // Number of packets is too many + return; + } + if (num == 0) + { + // No packet + return; + } + + if (ctx->Halting != FALSE) + { + // Stopping + return; + } + + if (ctx->Paused) + { + // Paused + return; + } + + if (ctx->Opened == FALSE) + { + // Not connected + return; + } + + for (i = 0;i < num;i++) + { + PACKET_BUFFER *p = ctx->PacketBuffer[i]; + void *dst; + NET_BUFFER_LIST *nbl = ctx->PacketBuffer[i]->NetBufferList; + NET_BUFFER *nb = NET_BUFFER_LIST_FIRST_NB(nbl); + + nbl->SourceHandle = ctx->NdisMiniport; + + NET_BUFFER_LIST_NEXT_NBL(nbl) = NULL; + + size = NEO_SIZE_OF_PACKET(buf, i); + if (size > NEO_MAX_PACKET_SIZE) + { + size = NEO_MAX_PACKET_SIZE; + } + if (size < NEO_PACKET_HEADER_SIZE) + { + size = NEO_PACKET_HEADER_SIZE; + } + + packet_buf = (UCHAR *)(NEO_ADDR_OF_PACKET(buf, i)); + + if (OK(NdisRetreatNetBufferDataStart(nb, size, 0, NULL))) + { + // Buffer copy + dst = NdisGetDataBuffer(nb, + size, + NULL, + 1, + 0); + + if (dst != NULL) + { + NeoCopy(dst, packet_buf, size); + + if (nbl_chain == NULL) + { + nbl_chain = nbl; + } + + if (nbl_tail != NULL) + { + NET_BUFFER_LIST_NEXT_NBL(nbl_tail) = nbl; + } + + nbl_tail = nbl; + + num_nbl_chain++; + } + } + + nbl->Status = NDIS_STATUS_RESOURCES; + + ctx->Status.Int64BytesRecvTotal += (UINT64)size; + + if (packet_buf[0] & 0x40) + { + ctx->Status.Int64NumRecvBroadcast++; + ctx->Status.Int64BytesRecvBroadcast += (UINT64)size; + } + else + { + ctx->Status.Int64NumRecvUnicast++; + ctx->Status.Int64BytesRecvUnicast += (UINT64)size; + } + } + + if (nbl_chain == NULL) + { + return; + } + + // Notify that it has received + ctx->Status.NumPacketRecv += num_nbl_chain; + + NdisMIndicateReceiveNetBufferLists(ctx->NdisMiniport, + nbl_chain, 0, num_nbl_chain, NDIS_RECEIVE_FLAGS_RESOURCES); + + if (true) + { + // Restore the packet buffer + NET_BUFFER_LIST *nbl = nbl_chain; + + while (nbl != NULL) + { + NET_BUFFER *nb = NET_BUFFER_LIST_FIRST_NB(nbl); + + if (nb != NULL) + { + UINT size = NET_BUFFER_DATA_LENGTH(nb); + + NdisAdvanceNetBufferDataStart(nb, size, false, NULL); + } + + nbl = NET_BUFFER_LIST_NEXT_NBL(nbl); + } + } +} + +// Get the number of queue items +UINT NeoGetNumQueue() +{ + return ctx->NumPacketQueue; +} + +// Insert the queue +void NeoInsertQueue(void *buf, UINT size) +{ + NEO_QUEUE *p; + // Validate arguments + if (buf == NULL || size == 0) + { + return; + } + + // Prevent the packet accumulation in large quantities in the queue + if (ctx->NumPacketQueue > NEO_MAX_PACKET_QUEUED) + { + NeoFree(buf); + return; + } + + // Create a queue + p = NeoMalloc(sizeof(NEO_QUEUE)); + p->Next = NULL; + p->Size = size; + p->Buf = buf; + + // Append to the queue + if (ctx->PacketQueue == NULL) + { + ctx->PacketQueue = p; + } + else + { + NEO_QUEUE *q = ctx->Tail; + q->Next = p; + } + + ctx->Tail = p; + + ctx->NumPacketQueue++; +} + +// Get the next queued item +NEO_QUEUE *NeoGetNextQueue() +{ + NEO_QUEUE *q; + if (ctx->PacketQueue == NULL) + { + // Empty queue + return NULL; + } + + // Get the next queued item + q = ctx->PacketQueue; + ctx->PacketQueue = ctx->PacketQueue->Next; + q->Next = NULL; + ctx->NumPacketQueue--; + + if (ctx->PacketQueue == NULL) + { + ctx->Tail = NULL; + } + + return q; +} + +// Release the buffer of the queue +void NeoFreeQueue(NEO_QUEUE *q) +{ + // Validate arguments + if (q == NULL) + { + return; + } + NeoFree(q->Buf); + NeoFree(q); +} + +// Lock the packet queue +void NeoLockPacketQueue() +{ + NeoLock(ctx->PacketQueueLock); +} + +// Unlock the packet queue +void NeoUnlockPacketQueue() +{ + NeoUnlock(ctx->PacketQueueLock); +} + +// Initialize the packet queue +void NeoInitPacketQueue() +{ + // Create a lock + ctx->PacketQueueLock = NeoNewLock(); + // Initialize the packet queue + ctx->PacketQueue = NULL; + ctx->NumPacketQueue = 0; + ctx->Tail = NULL; +} + +// Delete all the packets from the packet queue +void NeoClearPacketQueue(bool no_lock) +{ + // Release the memory of the packet queue + if (no_lock == false) + { + NeoLock(ctx->PacketQueueLock); + } + if (true) + { + NEO_QUEUE *q = ctx->PacketQueue; + NEO_QUEUE *qn; + while (q != NULL) + { + qn = q->Next; + NeoFree(q->Buf); + NeoFree(q); + q = qn; + } + ctx->PacketQueue = NULL; + ctx->Tail = NULL; + ctx->NumPacketQueue = 0; + } + if (no_lock == false) + { + NeoUnlock(ctx->PacketQueueLock); + } +} + +// Release the packet queue +void NeoFreePacketQueue() +{ + // Delete all packets + NeoClearPacketQueue(false); + + // Delete the lock + NeoFreeLock(ctx->PacketQueueLock); + ctx->PacketQueueLock = NULL; +} + +// Start the adapter +void NeoStartAdapter() +{ + // Initialize the packet queue + NeoInitPacketQueue(); +} + +// Stop the adapter +void NeoStopAdapter() +{ + // Delete the packet queue + NeoFreePacketQueue(); +} + +// Initialization +BOOL NeoInit() +{ + // Initialize the context + NeoZero(ctx, sizeof(NEO_CTX)); + + // Initialize the status information + NeoNewStatus(&ctx->Status); + + return TRUE; +} + +// Shutdown +void NeoShutdown() +{ + if (ctx == NULL) + { + // Uninitialized + return; + } + + // Release the status information + NeoFreeStatus(&ctx->Status); + + NeoZero(ctx, sizeof(NEO_CTX)); +} + +// Create a status information +void NeoNewStatus(NEO_STATUS *s) +{ + // Validate arguments + if (s == NULL) + { + return; + } + + // Memory initialization + NeoZero(s, sizeof(NEO_STATUS)); +} + +// Release the status information +void NeoFreeStatus(NEO_STATUS *s) +{ + // Validate arguments + if (s == NULL) + { + return; + } + + // Memory initialization + NeoZero(s, sizeof(NEO_STATUS)); +} + diff --git a/src/Neo6/Neo6.h b/src/Neo6/Neo6.h index eb9f075f..447cf993 100644 --- a/src/Neo6/Neo6.h +++ b/src/Neo6/Neo6.h @@ -1,241 +1,241 @@ -// SoftEther VPN Source Code - Developer Edition Master Branch -// Kernel Device Driver - - -// Neo6.h -// Header of Neo6.c - -#ifndef NEO_H -#define NEO_H - - -// Identification string (NDIS) -#define NDIS_NEO_HARDWARE_ID "VPN Client Adapter - %s" -#define NDIS_NEO_DEVICE_NAME "\\Device\\NEO_%s_DEVICE" -#define NDIS_NEO_DEVICE_NAME_WIN32 "\\DosDevices\\NEO_%s_DEVICE" -#define NDIS_NEO_DEVICE_FILE_NAME "\\\\.\\NEO_NEOADAPTER_%s_DEVICE" -#define NDIS_NEO_EVENT_NAME "\\BaseNamedObjects\\NEO_EVENT_%s" -#define NDIS_NEO_EVENT_NAME_WIN32 "Global\\NEO_EVENT_NEOADAPTER_%s" - -// Constant -#define NEO_MAX_PACKET_SIZE 1600 -#define NEO_MAX_PACKET_SIZE_ANNOUNCE 1514 -#define NEO_MIN_PACKET_SIZE 14 -#define NEO_PACKET_HEADER_SIZE 14 -#define NEO_MAX_FRAME_SIZE (NEO_MAX_PACKET_SIZE - NEO_MIN_PACKET_SIZE) -#define NEO_MAX_SPEED_DEFAULT 100000000ULL -#define NEO_MAC_ADDRESS_SIZE 6 -#define NEO_MAX_MULTICASE 32 - - -// IOCTL constant -#define NEO_IOCTL_SET_EVENT CTL_CODE(0x8000, 0, METHOD_BUFFERED, FILE_ANY_ACCESS) -#define NEO_IOCTL_PUT_PACKET CTL_CODE(0x8000, 1, METHOD_BUFFERED, FILE_ANY_ACCESS) -#define NEO_IOCTL_GET_PACKET CTL_CODE(0x8000, 2, METHOD_BUFFERED, FILE_ANY_ACCESS) - - -// Packet data exchange related -#define NEO_MAX_PACKET_EXCHANGE 256 // Number of packets that can be exchanged at a time -#define NEO_MAX_PACKET_QUEUED 4096 // Maximum number of packets that can be queued -#define NEO_EX_SIZEOF_NUM_PACKET 4 // Packet count data (UINT) -#define NEO_EX_SIZEOF_LENGTH_PACKET 4 // Length data of the packet data (UINT) -#define NEO_EX_SIZEOF_LEFT_FLAG 4 // Flag to indicate that the packet is still -#define NEO_EX_SIZEOF_ONE_PACKET 1600 // Data area occupied by a packet data -#define NEO_EXCHANGE_BUFFER_SIZE (NEO_EX_SIZEOF_NUM_PACKET + NEO_EX_SIZEOF_LEFT_FLAG + \ - (NEO_EX_SIZEOF_LENGTH_PACKET + NEO_EX_SIZEOF_ONE_PACKET) * (NEO_MAX_PACKET_EXCHANGE + 1)) -#define NEO_NUM_PACKET(buf) (*((UINT *)((UCHAR *)buf + 0))) -#define NEO_SIZE_OF_PACKET(buf, i) (*((UINT *)((UCHAR *)buf + NEO_EX_SIZEOF_NUM_PACKET + \ - (i * (NEO_EX_SIZEOF_LENGTH_PACKET + NEO_EX_SIZEOF_ONE_PACKET))))) -#define NEO_ADDR_OF_PACKET(buf, i) (((UINT *)((UCHAR *)buf + NEO_EX_SIZEOF_NUM_PACKET + \ - NEO_EX_SIZEOF_LENGTH_PACKET + \ - (i * (NEO_EX_SIZEOF_LENGTH_PACKET + NEO_EX_SIZEOF_ONE_PACKET))))) -#define NEO_LEFT_FLAG(buf) NEO_SIZE_OF_PACKET(buf, NEO_MAX_PACKET_EXCHANGE) - - - -// Definitions needed to compile as a device driver -#ifdef NEO_DEVICE_DRIVER - -// OS decision -#ifdef WIN32 -#define OS_WIN32 // Microsoft Windows -#else -#define OS_UNIX // UNIX / Linux -#endif - - -// Type declaration -#ifndef WINDOWS_H_INCLUDED -#ifndef WIN9X -typedef unsigned long BOOL; -#endif // WIN9X -#define TRUE 1 -#define FALSE 0 -#endif -typedef unsigned long bool; -#define true 1 -#define false 0 -typedef unsigned long long UINT64; -typedef signed long long INT64; -typedef unsigned short WORD; -typedef unsigned short USHORT; -typedef signed short SHORT; -typedef unsigned char BYTE; -typedef unsigned char UCHAR; -typedef signed char CHAR; -typedef unsigned long DWORD; -#define INFINITE 0xFFFFFFFF - -#define LESS(a, max_value) ((a) < (max_value) ? (a) : (max_value)) -#define MORE(a, min_value) ((a) > (min_value) ? (a) : (min_value)) -#define INNER(a, b, c) (((b) <= (c) && (a) >= (b) && (a) <= (c)) || ((b) >= (c) && (a) >= (c) && (a) <= (b))) -#define OUTER(a, b, c) (!INNER((a), (b), (c))) -#define MAKESURE(a, b, c) (((b) <= (c)) ? (MORE(LESS((a), (c)), (b))) : (MORE(LESS((a), (b)), (c)))) -#define MIN(a, b) ((a) >= (b) ? (b) : (a)) -#define MAX(a, b) ((a) >= (b) ? (a) : (b)) -#define EQUAL_BOOL(a, b) (((a) && (b)) || ((!(a)) && (!(b)))) - -#ifdef OS_WIN32 -// NDIS 5.0 related -#include "NDIS6.h" -#endif // OS_WIN32 - -// Lock -typedef struct _NEO_LOCK -{ -#ifdef OS_WIN32 - NDIS_SPIN_LOCK spin_lock; -#endif -} NEO_LOCK; - -// Event -typedef struct _NEO_EVENT -{ -#ifdef OS_WIN32 -#ifndef WIN9X - KEVENT *event; - HANDLE event_handle; -#else // WIN9X - DWORD win32_event; -#endif // WIN9X -#endif -} NEO_EVENT; - -// Packet queue -typedef struct _NEO_QUEUE -{ - struct _NEO_QUEUE *Next; - UINT Size; - void *Buf; -} NEO_QUEUE; - -// Status -typedef struct _NEO_STATUS -{ - UINT NumPacketSend; - UINT NumPacketRecv; - UINT NumPacketSendError; - UINT NumPacketRecvError; - UINT NumPacketRecvNoBuffer; - UINT64 Int64NumRecvError; // ifInErrors, OID_GEN_RCV_ERROR - UINT64 Int64BytesRecvTotal; // ifHCInOctets, OID_GEN_BYTES_RCV - UINT64 Int64NumRecvUnicast; // ifHCInUcastPkts, OID_GEN_DIRECTED_FRAMES_RCV - UINT64 Int64NumRecvBroadcast; // ifHCInBroadcastPkts, OID_GEN_BROADCAST_FRAMES_RCV - UINT64 Int64BytesSendTotal; // ifHCOutOctets, OID_GEN_BYTES_XMIT - UINT64 Int64NumSendUnicast; // ifHCOutUcastPkts, OID_GEN_DIRECTED_FRAMES_XMIT - UINT64 Int64NumSendBroadcast; // ifHCOutBroadcastPkts, OID_GEN_BROADCAST_FRAMES_XMIT - UINT64 Int64NumSendError; // ifOutErrors, OID_GEN_XMIT_ERROR - UINT64 Int64BytesRecvUnicast; // ifHCInUcastOctets, OID_GEN_DIRECTED_BYTES_RCV - UINT64 Int64BytesRecvBroadcast; // ifHCInBroadcastOctets, OID_GEN_BROADCAST_BYTES_RCV - UINT64 Int64BytesSendUnicast; // ifHCOutUcastOctets, OID_GEN_DIRECTED_BYTES_XMIT - UINT64 Int64BytesSendBroadcast; // ifHCOutBroadcastOctets, OID_GEN_BROADCAST_BYTES_XMIT -} NEO_STATUS; - -// NDIS packet buffer -typedef struct _PACKET_BUFFER -{ - NDIS_HANDLE NetBufferListPool; // NET_BUFFER_LIST Pool - NET_BUFFER_LIST *NetBufferList; // NET_BUFFER_LIST -} PACKET_BUFFER; - -// Context -typedef struct _NEO_CTX -{ - NEO_EVENT *Event; // Packet reception notification event - volatile BOOL Opened; // Flag of whether opened - volatile BOOL Paused; // Flag of whether paused - volatile BOOL Inited; // Initialization flag - volatile BOOL Initing; // Starting-up flag - volatile BOOL Halting; // Stopping flag - volatile UINT NumCurrentDispatch; // Number of current dispatch requests - BYTE MacAddress[6]; // MAC address - BYTE padding[2]; // padding - NEO_QUEUE *PacketQueue; // Transmit packet queue - NEO_QUEUE *Tail; // Tail of the transmission packet queue - UINT NumPacketQueue; // Number of queued packet - NEO_LOCK *PacketQueueLock; // Transmit packet queue lock - NEO_STATUS Status; // Status - UINT CurrentPacketFilter; // Current packet filter value - UINT CurrentProtocolOptions; // Current protocol option value - BOOL Connected, ConnectedOld; // Cable connection state - BOOL ConnectedForce; // Connection state forcibly notification -#ifdef OS_WIN32 - NDIS_HANDLE NdisMiniportDriverHandle; // NDIS miniport driver handle - NDIS_HANDLE NdisControl; // NDIS control handle - NDIS_HANDLE NdisMiniport; // NDIS miniport handle - NDIS_HANDLE NdisContext; // NDIS context handle - DEVICE_OBJECT *NdisControlDevice; // NDIS control device - PDRIVER_DISPATCH DispatchTable[IRP_MJ_MAXIMUM_FUNCTION]; - PACKET_BUFFER *PacketBuffer[NEO_MAX_PACKET_EXCHANGE]; // NDIS packet buffer - NDIS_HARDWARE_STATUS HardwareStatus; // Hardware state - char HardwareID[MAX_SIZE]; // Hardware ID - char HardwareID_Raw[MAX_SIZE]; // Original hardware ID - char HardwarePrintableID[MAX_SIZE]; // Hardware ID (for display) -#endif -} NEO_CTX; - -extern NEO_CTX *ctx; - - -// Neo.c routine -void NeoNewStatus(NEO_STATUS *s); -void NeoFreeStatus(NEO_STATUS *s); -BOOL NeoInit(); -void NeoShutdown(); -void NeoInitPacketQueue(); -void NeoFreePacketQueue(); -void NeoClearPacketQueue(bool no_lock); -void NeoLockPacketQueue(); -void NeoUnlockPacketQueue(); -NEO_QUEUE *NeoGetNextQueue(); -void NeoFreeQueue(NEO_QUEUE *q); -void NeoInsertQueue(void *buf, UINT size); -UINT NeoGetNumQueue(); -void NeoStartAdapter(); -void NeoStopAdapter(); -void NeoRead(void *buf); -void NeoWrite(void *buf); - -// Common routine (platform dependent) -void *NeoMalloc(UINT size); -void *NeoZeroMalloc(UINT size); -void NeoFree(void *p); -void NeoCopy(void *dst, void *src, UINT size); -void NeoZero(void *dst, UINT size); -NEO_LOCK *NeoNewLock(); -void NeoLock(NEO_LOCK *lock); -void NeoUnlock(NEO_LOCK *lock); -void NeoFreeLock(NEO_LOCK *lock); -NEO_EVENT *NeoNewEvent(char *name); -NEO_EVENT *NeoCreateWin9xEvent(DWORD h); -void NeoFreeEvent(NEO_EVENT *event); -void NeoSet(NEO_EVENT *event); -void NeoReset(NEO_EVENT *event); - -#endif // NEO_DEVICE_DRIVER - - -#endif // NEO_H - - - +// SoftEther VPN Source Code - Developer Edition Master Branch +// Kernel Device Driver + + +// Neo6.h +// Header of Neo6.c + +#ifndef NEO_H +#define NEO_H + + +// Identification string (NDIS) +#define NDIS_NEO_HARDWARE_ID "VPN Client Adapter - %s" +#define NDIS_NEO_DEVICE_NAME "\\Device\\NEO_%s_DEVICE" +#define NDIS_NEO_DEVICE_NAME_WIN32 "\\DosDevices\\NEO_%s_DEVICE" +#define NDIS_NEO_DEVICE_FILE_NAME "\\\\.\\NEO_NEOADAPTER_%s_DEVICE" +#define NDIS_NEO_EVENT_NAME "\\BaseNamedObjects\\NEO_EVENT_%s" +#define NDIS_NEO_EVENT_NAME_WIN32 "Global\\NEO_EVENT_NEOADAPTER_%s" + +// Constant +#define NEO_MAX_PACKET_SIZE 1600 +#define NEO_MAX_PACKET_SIZE_ANNOUNCE 1514 +#define NEO_MIN_PACKET_SIZE 14 +#define NEO_PACKET_HEADER_SIZE 14 +#define NEO_MAX_FRAME_SIZE (NEO_MAX_PACKET_SIZE - NEO_MIN_PACKET_SIZE) +#define NEO_MAX_SPEED_DEFAULT 100000000ULL +#define NEO_MAC_ADDRESS_SIZE 6 +#define NEO_MAX_MULTICASE 32 + + +// IOCTL constant +#define NEO_IOCTL_SET_EVENT CTL_CODE(0x8000, 0, METHOD_BUFFERED, FILE_ANY_ACCESS) +#define NEO_IOCTL_PUT_PACKET CTL_CODE(0x8000, 1, METHOD_BUFFERED, FILE_ANY_ACCESS) +#define NEO_IOCTL_GET_PACKET CTL_CODE(0x8000, 2, METHOD_BUFFERED, FILE_ANY_ACCESS) + + +// Packet data exchange related +#define NEO_MAX_PACKET_EXCHANGE 256 // Number of packets that can be exchanged at a time +#define NEO_MAX_PACKET_QUEUED 4096 // Maximum number of packets that can be queued +#define NEO_EX_SIZEOF_NUM_PACKET 4 // Packet count data (UINT) +#define NEO_EX_SIZEOF_LENGTH_PACKET 4 // Length data of the packet data (UINT) +#define NEO_EX_SIZEOF_LEFT_FLAG 4 // Flag to indicate that the packet is still +#define NEO_EX_SIZEOF_ONE_PACKET 1600 // Data area occupied by a packet data +#define NEO_EXCHANGE_BUFFER_SIZE (NEO_EX_SIZEOF_NUM_PACKET + NEO_EX_SIZEOF_LEFT_FLAG + \ + (NEO_EX_SIZEOF_LENGTH_PACKET + NEO_EX_SIZEOF_ONE_PACKET) * (NEO_MAX_PACKET_EXCHANGE + 1)) +#define NEO_NUM_PACKET(buf) (*((UINT *)((UCHAR *)buf + 0))) +#define NEO_SIZE_OF_PACKET(buf, i) (*((UINT *)((UCHAR *)buf + NEO_EX_SIZEOF_NUM_PACKET + \ + (i * (NEO_EX_SIZEOF_LENGTH_PACKET + NEO_EX_SIZEOF_ONE_PACKET))))) +#define NEO_ADDR_OF_PACKET(buf, i) (((UINT *)((UCHAR *)buf + NEO_EX_SIZEOF_NUM_PACKET + \ + NEO_EX_SIZEOF_LENGTH_PACKET + \ + (i * (NEO_EX_SIZEOF_LENGTH_PACKET + NEO_EX_SIZEOF_ONE_PACKET))))) +#define NEO_LEFT_FLAG(buf) NEO_SIZE_OF_PACKET(buf, NEO_MAX_PACKET_EXCHANGE) + + + +// Definitions needed to compile as a device driver +#ifdef NEO_DEVICE_DRIVER + +// OS decision +#ifdef WIN32 +#define OS_WIN32 // Microsoft Windows +#else +#define OS_UNIX // UNIX / Linux +#endif + + +// Type declaration +#ifndef WINDOWS_H_INCLUDED +#ifndef WIN9X +typedef unsigned long BOOL; +#endif // WIN9X +#define TRUE 1 +#define FALSE 0 +#endif +typedef unsigned long bool; +#define true 1 +#define false 0 +typedef unsigned long long UINT64; +typedef signed long long INT64; +typedef unsigned short WORD; +typedef unsigned short USHORT; +typedef signed short SHORT; +typedef unsigned char BYTE; +typedef unsigned char UCHAR; +typedef signed char CHAR; +typedef unsigned long DWORD; +#define INFINITE 0xFFFFFFFF + +#define LESS(a, max_value) ((a) < (max_value) ? (a) : (max_value)) +#define MORE(a, min_value) ((a) > (min_value) ? (a) : (min_value)) +#define INNER(a, b, c) (((b) <= (c) && (a) >= (b) && (a) <= (c)) || ((b) >= (c) && (a) >= (c) && (a) <= (b))) +#define OUTER(a, b, c) (!INNER((a), (b), (c))) +#define MAKESURE(a, b, c) (((b) <= (c)) ? (MORE(LESS((a), (c)), (b))) : (MORE(LESS((a), (b)), (c)))) +#define MIN(a, b) ((a) >= (b) ? (b) : (a)) +#define MAX(a, b) ((a) >= (b) ? (a) : (b)) +#define EQUAL_BOOL(a, b) (((a) && (b)) || ((!(a)) && (!(b)))) + +#ifdef OS_WIN32 +// NDIS 5.0 related +#include "NDIS6.h" +#endif // OS_WIN32 + +// Lock +typedef struct _NEO_LOCK +{ +#ifdef OS_WIN32 + NDIS_SPIN_LOCK spin_lock; +#endif +} NEO_LOCK; + +// Event +typedef struct _NEO_EVENT +{ +#ifdef OS_WIN32 +#ifndef WIN9X + KEVENT *event; + HANDLE event_handle; +#else // WIN9X + DWORD win32_event; +#endif // WIN9X +#endif +} NEO_EVENT; + +// Packet queue +typedef struct _NEO_QUEUE +{ + struct _NEO_QUEUE *Next; + UINT Size; + void *Buf; +} NEO_QUEUE; + +// Status +typedef struct _NEO_STATUS +{ + UINT NumPacketSend; + UINT NumPacketRecv; + UINT NumPacketSendError; + UINT NumPacketRecvError; + UINT NumPacketRecvNoBuffer; + UINT64 Int64NumRecvError; // ifInErrors, OID_GEN_RCV_ERROR + UINT64 Int64BytesRecvTotal; // ifHCInOctets, OID_GEN_BYTES_RCV + UINT64 Int64NumRecvUnicast; // ifHCInUcastPkts, OID_GEN_DIRECTED_FRAMES_RCV + UINT64 Int64NumRecvBroadcast; // ifHCInBroadcastPkts, OID_GEN_BROADCAST_FRAMES_RCV + UINT64 Int64BytesSendTotal; // ifHCOutOctets, OID_GEN_BYTES_XMIT + UINT64 Int64NumSendUnicast; // ifHCOutUcastPkts, OID_GEN_DIRECTED_FRAMES_XMIT + UINT64 Int64NumSendBroadcast; // ifHCOutBroadcastPkts, OID_GEN_BROADCAST_FRAMES_XMIT + UINT64 Int64NumSendError; // ifOutErrors, OID_GEN_XMIT_ERROR + UINT64 Int64BytesRecvUnicast; // ifHCInUcastOctets, OID_GEN_DIRECTED_BYTES_RCV + UINT64 Int64BytesRecvBroadcast; // ifHCInBroadcastOctets, OID_GEN_BROADCAST_BYTES_RCV + UINT64 Int64BytesSendUnicast; // ifHCOutUcastOctets, OID_GEN_DIRECTED_BYTES_XMIT + UINT64 Int64BytesSendBroadcast; // ifHCOutBroadcastOctets, OID_GEN_BROADCAST_BYTES_XMIT +} NEO_STATUS; + +// NDIS packet buffer +typedef struct _PACKET_BUFFER +{ + NDIS_HANDLE NetBufferListPool; // NET_BUFFER_LIST Pool + NET_BUFFER_LIST *NetBufferList; // NET_BUFFER_LIST +} PACKET_BUFFER; + +// Context +typedef struct _NEO_CTX +{ + NEO_EVENT *Event; // Packet reception notification event + volatile BOOL Opened; // Flag of whether opened + volatile BOOL Paused; // Flag of whether paused + volatile BOOL Inited; // Initialization flag + volatile BOOL Initing; // Starting-up flag + volatile BOOL Halting; // Stopping flag + volatile UINT NumCurrentDispatch; // Number of current dispatch requests + BYTE MacAddress[6]; // MAC address + BYTE padding[2]; // padding + NEO_QUEUE *PacketQueue; // Transmit packet queue + NEO_QUEUE *Tail; // Tail of the transmission packet queue + UINT NumPacketQueue; // Number of queued packet + NEO_LOCK *PacketQueueLock; // Transmit packet queue lock + NEO_STATUS Status; // Status + UINT CurrentPacketFilter; // Current packet filter value + UINT CurrentProtocolOptions; // Current protocol option value + BOOL Connected, ConnectedOld; // Cable connection state + BOOL ConnectedForce; // Connection state forcibly notification +#ifdef OS_WIN32 + NDIS_HANDLE NdisMiniportDriverHandle; // NDIS miniport driver handle + NDIS_HANDLE NdisControl; // NDIS control handle + NDIS_HANDLE NdisMiniport; // NDIS miniport handle + NDIS_HANDLE NdisContext; // NDIS context handle + DEVICE_OBJECT *NdisControlDevice; // NDIS control device + PDRIVER_DISPATCH DispatchTable[IRP_MJ_MAXIMUM_FUNCTION]; + PACKET_BUFFER *PacketBuffer[NEO_MAX_PACKET_EXCHANGE]; // NDIS packet buffer + NDIS_HARDWARE_STATUS HardwareStatus; // Hardware state + char HardwareID[MAX_SIZE]; // Hardware ID + char HardwareID_Raw[MAX_SIZE]; // Original hardware ID + char HardwarePrintableID[MAX_SIZE]; // Hardware ID (for display) +#endif +} NEO_CTX; + +extern NEO_CTX *ctx; + + +// Neo.c routine +void NeoNewStatus(NEO_STATUS *s); +void NeoFreeStatus(NEO_STATUS *s); +BOOL NeoInit(); +void NeoShutdown(); +void NeoInitPacketQueue(); +void NeoFreePacketQueue(); +void NeoClearPacketQueue(bool no_lock); +void NeoLockPacketQueue(); +void NeoUnlockPacketQueue(); +NEO_QUEUE *NeoGetNextQueue(); +void NeoFreeQueue(NEO_QUEUE *q); +void NeoInsertQueue(void *buf, UINT size); +UINT NeoGetNumQueue(); +void NeoStartAdapter(); +void NeoStopAdapter(); +void NeoRead(void *buf); +void NeoWrite(void *buf); + +// Common routine (platform dependent) +void *NeoMalloc(UINT size); +void *NeoZeroMalloc(UINT size); +void NeoFree(void *p); +void NeoCopy(void *dst, void *src, UINT size); +void NeoZero(void *dst, UINT size); +NEO_LOCK *NeoNewLock(); +void NeoLock(NEO_LOCK *lock); +void NeoUnlock(NEO_LOCK *lock); +void NeoFreeLock(NEO_LOCK *lock); +NEO_EVENT *NeoNewEvent(char *name); +NEO_EVENT *NeoCreateWin9xEvent(DWORD h); +void NeoFreeEvent(NEO_EVENT *event); +void NeoSet(NEO_EVENT *event); +void NeoReset(NEO_EVENT *event); + +#endif // NEO_DEVICE_DRIVER + + +#endif // NEO_H + + + diff --git a/src/Neo6/Neo6.rc b/src/Neo6/Neo6.rc index c0238161..1dde551d 100644 --- a/src/Neo6/Neo6.rc +++ b/src/Neo6/Neo6.rc @@ -1,63 +1,63 @@ -// Microsoft Visual C++ generated resource script. -// -#include "resource.h" - -#define APSTUDIO_READONLY_SYMBOLS -///////////////////////////////////////////////////////////////////////////// -// -// Generated from the TEXTINCLUDE 2 resource. -// -#include "winres.h" - -///////////////////////////////////////////////////////////////////////////// -#undef APSTUDIO_READONLY_SYMBOLS - -///////////////////////////////////////////////////////////////////////////// -// Japanese resources - -#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_JPN) -#ifdef _WIN32 -LANGUAGE LANG_JAPANESE, SUBLANG_DEFAULT -#pragma code_page(932) -#endif //_WIN32 - -#ifdef APSTUDIO_INVOKED -///////////////////////////////////////////////////////////////////////////// -// -// TEXTINCLUDE -// - -1 TEXTINCLUDE -BEGIN - "resource.h\0" -END - -2 TEXTINCLUDE -BEGIN - "#include ""winres.h""\r\n" - "\0" -END - -3 TEXTINCLUDE -BEGIN - "\r\n" - "\0" -END - -#endif // APSTUDIO_INVOKED - -#endif // Japanese resources -///////////////////////////////////////////////////////////////////////////// - - - -#ifndef APSTUDIO_INVOKED -///////////////////////////////////////////////////////////////////////////// -// -// Generated from the TEXTINCLUDE 3 resource. -// - - -///////////////////////////////////////////////////////////////////////////// -#endif // not APSTUDIO_INVOKED - +// Microsoft Visual C++ generated resource script. +// +#include "resource.h" + +#define APSTUDIO_READONLY_SYMBOLS +///////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 2 resource. +// +#include "winres.h" + +///////////////////////////////////////////////////////////////////////////// +#undef APSTUDIO_READONLY_SYMBOLS + +///////////////////////////////////////////////////////////////////////////// +// Japanese resources + +#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_JPN) +#ifdef _WIN32 +LANGUAGE LANG_JAPANESE, SUBLANG_DEFAULT +#pragma code_page(932) +#endif //_WIN32 + +#ifdef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// TEXTINCLUDE +// + +1 TEXTINCLUDE +BEGIN + "resource.h\0" +END + +2 TEXTINCLUDE +BEGIN + "#include ""winres.h""\r\n" + "\0" +END + +3 TEXTINCLUDE +BEGIN + "\r\n" + "\0" +END + +#endif // APSTUDIO_INVOKED + +#endif // Japanese resources +///////////////////////////////////////////////////////////////////////////// + + + +#ifndef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 3 resource. +// + + +///////////////////////////////////////////////////////////////////////////// +#endif // not APSTUDIO_INVOKED + diff --git a/src/Neo6/Neo6.vcproj b/src/Neo6/Neo6.vcproj index fed00b07..76d21cab 100644 --- a/src/Neo6/Neo6.vcproj +++ b/src/Neo6/Neo6.vcproj @@ -1,282 +1,282 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/Neo6/resource.h b/src/Neo6/resource.h index f6fe60e7..b3199c03 100644 --- a/src/Neo6/resource.h +++ b/src/Neo6/resource.h @@ -1,16 +1,16 @@ -//{{NO_DEPENDENCIES}} -// Microsoft Visual C++ generated include file. -// Used by Neo.rc - - - -// Next default values for new objects -// -#ifdef APSTUDIO_INVOKED -#ifndef APSTUDIO_READONLY_SYMBOLS -#define _APS_NEXT_RESOURCE_VALUE 101 -#define _APS_NEXT_COMMAND_VALUE 40001 -#define _APS_NEXT_CONTROL_VALUE 1001 -#define _APS_NEXT_SYMED_VALUE 101 -#endif -#endif +//{{NO_DEPENDENCIES}} +// Microsoft Visual C++ generated include file. +// Used by Neo.rc + + + +// Next default values for new objects +// +#ifdef APSTUDIO_INVOKED +#ifndef APSTUDIO_READONLY_SYMBOLS +#define _APS_NEXT_RESOURCE_VALUE 101 +#define _APS_NEXT_COMMAND_VALUE 40001 +#define _APS_NEXT_CONTROL_VALUE 1001 +#define _APS_NEXT_SYMED_VALUE 101 +#endif +#endif diff --git a/src/PenCore/Dummy.bin b/src/PenCore/Dummy.bin index 9ed54232..9812a4b2 100644 --- a/src/PenCore/Dummy.bin +++ b/src/PenCore/Dummy.bin @@ -1 +1 @@ -ABCDE +ABCDE diff --git a/src/PenCore/PenCore.c b/src/PenCore/PenCore.c index d500df75..4685278b 100644 --- a/src/PenCore/PenCore.c +++ b/src/PenCore/PenCore.c @@ -1,8 +1,8 @@ -void DllMainCRTStartup() -{ -} - -void PenKawaKuwaKuwa() -{ -} - +void DllMainCRTStartup() +{ +} + +void PenKawaKuwaKuwa() +{ +} + diff --git a/src/PenCore/PenCore.def b/src/PenCore/PenCore.def index f2db98e4..d89de6d6 100644 --- a/src/PenCore/PenCore.def +++ b/src/PenCore/PenCore.def @@ -1,2 +1,2 @@ -EXPORTS +EXPORTS PenKawaKuwaKuwa \ No newline at end of file diff --git a/src/PenCore/PenCore.rc b/src/PenCore/PenCore.rc index 6023da7f..ef43d482 100644 --- a/src/PenCore/PenCore.rc +++ b/src/PenCore/PenCore.rc @@ -1,4968 +1,4968 @@ -// Microsoft Visual C++ generated resource script. -// -#include "resource.h" - -#define APSTUDIO_READONLY_SYMBOLS -///////////////////////////////////////////////////////////////////////////// -// -// Generated from the TEXTINCLUDE 2 resource. -// -#include "winres.h" - -///////////////////////////////////////////////////////////////////////////// -#undef APSTUDIO_READONLY_SYMBOLS - -///////////////////////////////////////////////////////////////////////////// -// resources - -#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_JPN) -#ifdef _WIN32 -LANGUAGE LANG_JAPANESE, SUBLANG_DEFAULT -#pragma code_page(932) -#endif //_WIN32 - -#ifdef APSTUDIO_INVOKED -///////////////////////////////////////////////////////////////////////////// -// -// TEXTINCLUDE -// - -1 TEXTINCLUDE -BEGIN - "resource.h\0" -END - -2 TEXTINCLUDE -BEGIN - "#include ""winres.h""\r\n" - "\0" -END - -3 TEXTINCLUDE -BEGIN - "\r\n" - "\0" -END - -#endif // APSTUDIO_INVOKED - - -///////////////////////////////////////////////////////////////////////////// -// -// DESIGNINFO -// - -#ifdef APSTUDIO_INVOKED -GUIDELINES DESIGNINFO -BEGIN - D_SECURE, DIALOG - BEGIN - LEFTMARGIN, 7 - RIGHTMARGIN, 299 - TOPMARGIN, 5 - BOTTOMMARGIN, 166 - END - - D_PKCSUTIL, DIALOG - BEGIN - LEFTMARGIN, 7 - RIGHTMARGIN, 292 - TOPMARGIN, 5 - BOTTOMMARGIN, 246 - END - - D_PASSPHRASE, DIALOG - BEGIN - LEFTMARGIN, 7 - RIGHTMARGIN, 232 - TOPMARGIN, 5 - BOTTOMMARGIN, 72 - END - - D_NM_CONNECT, DIALOG - BEGIN - LEFTMARGIN, 7 - RIGHTMARGIN, 264 - TOPMARGIN, 5 - BOTTOMMARGIN, 44 - END - - D_PASSWORD, DIALOG - BEGIN - LEFTMARGIN, 7 - RIGHTMARGIN, 252 - TOPMARGIN, 5 - BOTTOMMARGIN, 178 - END - - D_STATUS, DIALOG - BEGIN - LEFTMARGIN, 7 - RIGHTMARGIN, 208 - TOPMARGIN, 5 - BOTTOMMARGIN, 51 - END - - D_CERT, DIALOG - BEGIN - LEFTMARGIN, 6 - RIGHTMARGIN, 264 - TOPMARGIN, 5 - BOTTOMMARGIN, 330 - END - - D_CHECKCERT, DIALOG - BEGIN - LEFTMARGIN, 7 - RIGHTMARGIN, 244 - TOPMARGIN, 5 - BOTTOMMARGIN, 252 - END - - D_CONNECTERROR, DIALOG - BEGIN - LEFTMARGIN, 7 - RIGHTMARGIN, 244 - TOPMARGIN, 5 - BOTTOMMARGIN, 177 - END - - D_CM_LOGIN, DIALOG - BEGIN - LEFTMARGIN, 7 - RIGHTMARGIN, 268 - TOPMARGIN, 5 - BOTTOMMARGIN, 109 - END - - D_CM_MAIN, DIALOG - BEGIN - LEFTMARGIN, 7 - RIGHTMARGIN, 251 - TOPMARGIN, 5 - BOTTOMMARGIN, 206 - END - - D_CONNECTION_STATUS, DIALOG - BEGIN - LEFTMARGIN, 7 - RIGHTMARGIN, 284 - TOPMARGIN, 5 - BOTTOMMARGIN, 224 - END - - D_CM_POLICY, DIALOG - BEGIN - LEFTMARGIN, 7 - RIGHTMARGIN, 296 - TOPMARGIN, 5 - BOTTOMMARGIN, 254 - END - - D_CM_ACCOUNT, DIALOG - BEGIN - LEFTMARGIN, 7 - RIGHTMARGIN, 444 - TOPMARGIN, 5 - BOTTOMMARGIN, 318 - END - - D_CM_PROXY, DIALOG - BEGIN - LEFTMARGIN, 7 - RIGHTMARGIN, 248 - TOPMARGIN, 5 - BOTTOMMARGIN, 126 - END - - D_CM_PROXY_HTTP_HEADER, DIALOG - BEGIN - LEFTMARGIN, 7 - RIGHTMARGIN, 248 - TOPMARGIN, 5 - BOTTOMMARGIN, 126 - END - - D_CM_DETAIL, DIALOG - BEGIN - LEFTMARGIN, 7 - RIGHTMARGIN, 427 - TOPMARGIN, 5 - BOTTOMMARGIN, 306 - END - - D_CM_NEW_VLAN, DIALOG - BEGIN - LEFTMARGIN, 7 - RIGHTMARGIN, 244 - TOPMARGIN, 5 - BOTTOMMARGIN, 93 - END - - D_CM_TRUST, DIALOG - BEGIN - LEFTMARGIN, 7 - RIGHTMARGIN, 328 - TOPMARGIN, 5 - BOTTOMMARGIN, 190 - END - - D_CM_PASSWORD, DIALOG - BEGIN - LEFTMARGIN, 7 - RIGHTMARGIN, 270 - TOPMARGIN, 5 - BOTTOMMARGIN, 154 - END - - D_CM_CONFIG, DIALOG - BEGIN - LEFTMARGIN, 7 - RIGHTMARGIN, 295 - TOPMARGIN, 5 - BOTTOMMARGIN, 336 - END - - D_ABOUT, DIALOG - BEGIN - LEFTMARGIN, 7 - RIGHTMARGIN, 326 - BOTTOMMARGIN, 304 - END - - D_REMOTE, DIALOG - BEGIN - LEFTMARGIN, 7 - RIGHTMARGIN, 268 - TOPMARGIN, 5 - BOTTOMMARGIN, 144 - END - - D_CM_DESKTOP, DIALOG - BEGIN - LEFTMARGIN, 7 - RIGHTMARGIN, 363 - VERTGUIDE, 31 - TOPMARGIN, 5 - BOTTOMMARGIN, 186 - END - - D_CM_CHANGE_PASSWORD, DIALOG - BEGIN - LEFTMARGIN, 7 - RIGHTMARGIN, 252 - TOPMARGIN, 5 - BOTTOMMARGIN, 207 - END - - D_SM_MAIN, DIALOG - BEGIN - RIGHTMARGIN, 274 - END - - D_SM_EDIT_SETTING, DIALOG - BEGIN - LEFTMARGIN, 7 - RIGHTMARGIN, 428 - TOPMARGIN, 5 - BOTTOMMARGIN, 258 - END - - D_SM_SERVER, DIALOG - BEGIN - LEFTMARGIN, 7 - RIGHTMARGIN, 432 - TOPMARGIN, 5 - END - - D_SM_STATUS, DIALOG - BEGIN - LEFTMARGIN, 7 - RIGHTMARGIN, 328 - TOPMARGIN, 5 - BOTTOMMARGIN, 245 - END - - D_SM_EDIT_HUB, DIALOG - BEGIN - LEFTMARGIN, 7 - RIGHTMARGIN, 424 - TOPMARGIN, 5 - BOTTOMMARGIN, 279 - END - - D_SM_CREATE_LISTENER, DIALOG - BEGIN - LEFTMARGIN, 7 - RIGHTMARGIN, 263 - TOPMARGIN, 5 - BOTTOMMARGIN, 132 - END - - D_SM_SSL, DIALOG - BEGIN - LEFTMARGIN, 7 - RIGHTMARGIN, 456 - TOPMARGIN, 5 - BOTTOMMARGIN, 307 - END - - D_SM_SAVE_KEY_PAIR, DIALOG - BEGIN - LEFTMARGIN, 7 - RIGHTMARGIN, 288 - TOPMARGIN, 5 - BOTTOMMARGIN, 293 - END - - D_SM_CONNECTION, DIALOG - BEGIN - LEFTMARGIN, 7 - RIGHTMARGIN, 311 - TOPMARGIN, 5 - BOTTOMMARGIN, 228 - END - - D_SM_FARM, DIALOG - BEGIN - LEFTMARGIN, 7 - RIGHTMARGIN, 252 - TOPMARGIN, 5 - BOTTOMMARGIN, 327 - END - - D_SM_FARM_MEMBER, DIALOG - BEGIN - LEFTMARGIN, 7 - RIGHTMARGIN, 408 - TOPMARGIN, 5 - BOTTOMMARGIN, 222 - END - - D_SM_CHANGE_PASSWORD, DIALOG - BEGIN - LEFTMARGIN, 7 - RIGHTMARGIN, 243 - TOPMARGIN, 5 - BOTTOMMARGIN, 90 - END - - D_SM_HUB, DIALOG - BEGIN - LEFTMARGIN, 7 - RIGHTMARGIN, 396 - TOPMARGIN, 5 - BOTTOMMARGIN, 301 - END - - D_SM_USER, DIALOG - BEGIN - LEFTMARGIN, 7 - RIGHTMARGIN, 447 - TOPMARGIN, 5 - BOTTOMMARGIN, 235 - END - - D_SM_EDIT_USER, DIALOG - BEGIN - LEFTMARGIN, 7 - RIGHTMARGIN, 448 - TOPMARGIN, 5 - BOTTOMMARGIN, 296 - END - - D_SM_POLICY, DIALOG - BEGIN - LEFTMARGIN, 7 - RIGHTMARGIN, 443 - TOPMARGIN, 5 - BOTTOMMARGIN, 287 - END - - D_SM_GROUP, DIALOG - BEGIN - LEFTMARGIN, 7 - RIGHTMARGIN, 327 - TOPMARGIN, 5 - BOTTOMMARGIN, 236 - END - - D_SM_EDIT_GROUP, DIALOG - BEGIN - LEFTMARGIN, 7 - RIGHTMARGIN, 236 - TOPMARGIN, 5 - BOTTOMMARGIN, 250 - END - - D_SM_ACCESS_LIST, DIALOG - BEGIN - LEFTMARGIN, 7 - RIGHTMARGIN, 444 - TOPMARGIN, 5 - BOTTOMMARGIN, 270 - END - - D_SM_EDIT_ACCESS, DIALOG - BEGIN - LEFTMARGIN, 7 - RIGHTMARGIN, 452 - TOPMARGIN, 5 - BOTTOMMARGIN, 347 - HORZGUIDE, 7 - END - - D_SM_RADIUS, DIALOG - BEGIN - LEFTMARGIN, 7 - RIGHTMARGIN, 276 - TOPMARGIN, 5 - BOTTOMMARGIN, 272 - END - - D_SM_LINK, DIALOG - BEGIN - LEFTMARGIN, 7 - RIGHTMARGIN, 416 - TOPMARGIN, 5 - BOTTOMMARGIN, 263 - END - - D_SM_LOG, DIALOG - BEGIN - LEFTMARGIN, 7 - RIGHTMARGIN, 272 - TOPMARGIN, 5 - BOTTOMMARGIN, 328 - END - - D_SM_CA, DIALOG - BEGIN - LEFTMARGIN, 7 - RIGHTMARGIN, 328 - TOPMARGIN, 5 - BOTTOMMARGIN, 189 - END - - D_SM_SESSION, DIALOG - BEGIN - LEFTMARGIN, 7 - RIGHTMARGIN, 446 - TOPMARGIN, 5 - BOTTOMMARGIN, 305 - END - - D_SM_MAC, DIALOG - BEGIN - LEFTMARGIN, 7 - RIGHTMARGIN, 444 - TOPMARGIN, 5 - BOTTOMMARGIN, 283 - END - - D_SM_IP, DIALOG - BEGIN - LEFTMARGIN, 7 - RIGHTMARGIN, 444 - TOPMARGIN, 5 - BOTTOMMARGIN, 283 - END - - D_SM_CREATE_CERT, DIALOG - BEGIN - LEFTMARGIN, 7 - RIGHTMARGIN, 294 - TOPMARGIN, 5 - BOTTOMMARGIN, 312 - END - - D_NM_LOGIN, DIALOG - BEGIN - LEFTMARGIN, 7 - RIGHTMARGIN, 268 - TOPMARGIN, 5 - BOTTOMMARGIN, 109 - END - - D_SPEEDMETER, DIALOG - BEGIN - LEFTMARGIN, 7 - RIGHTMARGIN, 312 - TOPMARGIN, 5 - BOTTOMMARGIN, 247 - END - - D_NM_MAIN, DIALOG - BEGIN - LEFTMARGIN, 7 - RIGHTMARGIN, 344 - TOPMARGIN, 5 - BOTTOMMARGIN, 320 - END - - D_NM_OPTION, DIALOG - BEGIN - LEFTMARGIN, 7 - RIGHTMARGIN, 412 - TOPMARGIN, 5 - BOTTOMMARGIN, 273 - END - - D_NM_NAT, DIALOG - BEGIN - LEFTMARGIN, 7 - RIGHTMARGIN, 444 - TOPMARGIN, 5 - BOTTOMMARGIN, 283 - END - - D_NM_DHCP, DIALOG - BEGIN - LEFTMARGIN, 7 - RIGHTMARGIN, 444 - TOPMARGIN, 5 - BOTTOMMARGIN, 283 - END - - D_NM_CHANGE_PASSWORD, DIALOG - BEGIN - LEFTMARGIN, 7 - RIGHTMARGIN, 243 - TOPMARGIN, 5 - BOTTOMMARGIN, 90 - END - - D_SM_SNAT, DIALOG - BEGIN - LEFTMARGIN, 7 - RIGHTMARGIN, 348 - TOPMARGIN, 5 - BOTTOMMARGIN, 267 - END - - D_SM_BRIDGE, DIALOG - BEGIN - LEFTMARGIN, 7 - RIGHTMARGIN, 360 - TOPMARGIN, 5 - BOTTOMMARGIN, 320 - END - - D_WIN9X_REBOOT, DIALOG - BEGIN - LEFTMARGIN, 7 - RIGHTMARGIN, 232 - TOPMARGIN, 5 - BOTTOMMARGIN, 84 - END - - D_DEFAULT1, DIALOG - BEGIN - LEFTMARGIN, 7 - RIGHTMARGIN, 179 - TOPMARGIN, 5 - BOTTOMMARGIN, 72 - END - - D_EM_MAIN, DIALOG - BEGIN - LEFTMARGIN, 7 - RIGHTMARGIN, 328 - TOPMARGIN, 5 - BOTTOMMARGIN, 175 - END - - D_EM_ADD, DIALOG - BEGIN - LEFTMARGIN, 7 - RIGHTMARGIN, 272 - TOPMARGIN, 5 - BOTTOMMARGIN, 292 - END - - D_EM_PASSWORD, DIALOG - BEGIN - LEFTMARGIN, 7 - RIGHTMARGIN, 243 - TOPMARGIN, 5 - BOTTOMMARGIN, 90 - END - - D_SM_CONFIG, DIALOG - BEGIN - LEFTMARGIN, 7 - RIGHTMARGIN, 376 - TOPMARGIN, 5 - BOTTOMMARGIN, 310 - END - - D_SM_ADMIN_OPTION, DIALOG - BEGIN - LEFTMARGIN, 7 - RIGHTMARGIN, 303 - TOPMARGIN, 5 - BOTTOMMARGIN, 302 - END - - D_SM_AO_VALUE, DIALOG - BEGIN - LEFTMARGIN, 7 - RIGHTMARGIN, 199 - TOPMARGIN, 5 - BOTTOMMARGIN, 63 - END - - D_SM_L3, DIALOG - BEGIN - LEFTMARGIN, 7 - RIGHTMARGIN, 284 - TOPMARGIN, 5 - BOTTOMMARGIN, 250 - END - - D_SM_L3_ADD, DIALOG - BEGIN - LEFTMARGIN, 7 - RIGHTMARGIN, 227 - TOPMARGIN, 5 - BOTTOMMARGIN, 84 - END - - D_SM_L3_SW, DIALOG - BEGIN - LEFTMARGIN, 7 - RIGHTMARGIN, 291 - TOPMARGIN, 5 - BOTTOMMARGIN, 315 - END - - D_SM_L3_SW_IF, DIALOG - BEGIN - LEFTMARGIN, 7 - RIGHTMARGIN, 252 - TOPMARGIN, 5 - BOTTOMMARGIN, 242 - END - - D_SM_L3_SW_TABLE, DIALOG - BEGIN - LEFTMARGIN, 7 - RIGHTMARGIN, 252 - TOPMARGIN, 5 - BOTTOMMARGIN, 219 - END - - D_CM_SELECT_SECURE, DIALOG - BEGIN - LEFTMARGIN, 7 - RIGHTMARGIN, 288 - TOPMARGIN, 5 - BOTTOMMARGIN, 209 - END - - D_CM_SECURE_MANAGER, DIALOG - BEGIN - LEFTMARGIN, 7 - RIGHTMARGIN, 288 - TOPMARGIN, 5 - BOTTOMMARGIN, 223 - END - - D_CM_SECURE_TYPE, DIALOG - BEGIN - LEFTMARGIN, 7 - RIGHTMARGIN, 188 - TOPMARGIN, 5 - BOTTOMMARGIN, 102 - END - - D_STRING, DIALOG - BEGIN - LEFTMARGIN, 7 - RIGHTMARGIN, 259 - TOPMARGIN, 5 - BOTTOMMARGIN, 99 - END - - D_SM_SELECT_KEYPAIR, DIALOG - BEGIN - LEFTMARGIN, 7 - RIGHTMARGIN, 194 - TOPMARGIN, 5 - BOTTOMMARGIN, 237 - END - - D_CM_LOAD_X, DIALOG - BEGIN - LEFTMARGIN, 7 - RIGHTMARGIN, 232 - TOPMARGIN, 5 - BOTTOMMARGIN, 174 - END - - D_CM_SECURE_PIN, DIALOG - BEGIN - LEFTMARGIN, 7 - RIGHTMARGIN, 256 - TOPMARGIN, 5 - BOTTOMMARGIN, 184 - END - - D_SM_CRL, DIALOG - BEGIN - LEFTMARGIN, 7 - RIGHTMARGIN, 328 - TOPMARGIN, 5 - BOTTOMMARGIN, 189 - END - - D_SM_EDIT_CRL, DIALOG - BEGIN - LEFTMARGIN, 7 - RIGHTMARGIN, 344 - TOPMARGIN, 5 - BOTTOMMARGIN, 307 - END - - D_SM_AC_LIST, DIALOG - BEGIN - LEFTMARGIN, 7 - RIGHTMARGIN, 302 - TOPMARGIN, 5 - BOTTOMMARGIN, 192 - END - - D_SM_AC, DIALOG - BEGIN - LEFTMARGIN, 7 - RIGHTMARGIN, 303 - TOPMARGIN, 5 - BOTTOMMARGIN, 261 - END - - D_SM_LOG_FILE, DIALOG - BEGIN - LEFTMARGIN, 7 - RIGHTMARGIN, 391 - TOPMARGIN, 5 - BOTTOMMARGIN, 286 - END - - D_SM_READ_LOG_FILE, DIALOG - BEGIN - LEFTMARGIN, 7 - RIGHTMARGIN, 280 - TOPMARGIN, 5 - BOTTOMMARGIN, 90 - END - - D_SM_SAVE_LOG, DIALOG - BEGIN - LEFTMARGIN, 7 - RIGHTMARGIN, 264 - TOPMARGIN, 5 - BOTTOMMARGIN, 65 - END - - D_TCP, DIALOG - BEGIN - LEFTMARGIN, 7 - RIGHTMARGIN, 324 - TOPMARGIN, 5 - BOTTOMMARGIN, 265 - END - - D_TCP_MSG, DIALOG - BEGIN - LEFTMARGIN, 7 - RIGHTMARGIN, 240 - TOPMARGIN, 5 - BOTTOMMARGIN, 172 - END - - D_CM_PKCSEULA, DIALOG - BEGIN - LEFTMARGIN, 7 - RIGHTMARGIN, 260 - TOPMARGIN, 5 - BOTTOMMARGIN, 130 - END - - D_CM_KAKUSHI, DIALOG - BEGIN - LEFTMARGIN, 7 - RIGHTMARGIN, 358 - TOPMARGIN, 5 - BOTTOMMARGIN, 228 - END - - D_CM_TRAFFIC, DIALOG - BEGIN - LEFTMARGIN, 7 - RIGHTMARGIN, 388 - TOPMARGIN, 5 - BOTTOMMARGIN, 303 - END - - D_CM_TRAFFIC_RUN, DIALOG - BEGIN - LEFTMARGIN, 7 - RIGHTMARGIN, 352 - TOPMARGIN, 5 - BOTTOMMARGIN, 253 - END - - D_CM_TRAFFIC_RESULT, DIALOG - BEGIN - LEFTMARGIN, 7 - RIGHTMARGIN, 323 - TOPMARGIN, 5 - BOTTOMMARGIN, 190 - END - - D_SM_LICENSE, DIALOG - BEGIN - LEFTMARGIN, 7 - RIGHTMARGIN, 420 - TOPMARGIN, 5 - BOTTOMMARGIN, 309 - END - - D_SM_LICENSE_ADD, DIALOG - BEGIN - LEFTMARGIN, 7 - RIGHTMARGIN, 352 - TOPMARGIN, 5 - BOTTOMMARGIN, 223 - END - - D_FREEINFO, DIALOG - BEGIN - LEFTMARGIN, 7 - RIGHTMARGIN, 316 - TOPMARGIN, 5 - BOTTOMMARGIN, 202 - END - - D_EM_LICENSE_ADD, DIALOG - BEGIN - LEFTMARGIN, 7 - RIGHTMARGIN, 352 - TOPMARGIN, 5 - BOTTOMMARGIN, 223 - END - - D_EM_LICENSE, DIALOG - BEGIN - LEFTMARGIN, 7 - RIGHTMARGIN, 420 - TOPMARGIN, 5 - BOTTOMMARGIN, 305 - END - - D_EM_REMOTE, DIALOG - BEGIN - LEFTMARGIN, 7 - RIGHTMARGIN, 268 - TOPMARGIN, 5 - BOTTOMMARGIN, 144 - END - - D_CM_SETTING, DIALOG - BEGIN - LEFTMARGIN, 7 - RIGHTMARGIN, 276 - TOPMARGIN, 5 - BOTTOMMARGIN, 285 - END - - D_SM_SETUP, DIALOG - BEGIN - LEFTMARGIN, 7 - RIGHTMARGIN, 440 - TOPMARGIN, 5 - BOTTOMMARGIN, 306 - END - - D_SM_SETUP_HUB, DIALOG - BEGIN - LEFTMARGIN, 7 - RIGHTMARGIN, 222 - TOPMARGIN, 5 - BOTTOMMARGIN, 81 - END - - D_SM_SETUP_STEP, DIALOG - BEGIN - LEFTMARGIN, 7 - RIGHTMARGIN, 322 - TOPMARGIN, 5 - BOTTOMMARGIN, 295 - END - - D_CPU64_WARNING, DIALOG - BEGIN - LEFTMARGIN, 7 - RIGHTMARGIN, 292 - TOPMARGIN, 5 - BOTTOMMARGIN, 148 - END - - D_ONCEMSG, DIALOG - BEGIN - LEFTMARGIN, 7 - RIGHTMARGIN, 244 - TOPMARGIN, 5 - BOTTOMMARGIN, 156 - END - - D_CONNECT, DIALOG - BEGIN - LEFTMARGIN, 7 - RIGHTMARGIN, 182 - TOPMARGIN, 5 - BOTTOMMARGIN, 62 - END - - D_SM_SIMULATION, DIALOG - BEGIN - LEFTMARGIN, 7 - RIGHTMARGIN, 274 - TOPMARGIN, 5 - BOTTOMMARGIN, 216 - END - - D_SM_EDIT_ACCESS_V6, DIALOG - BEGIN - LEFTMARGIN, 7 - RIGHTMARGIN, 452 - TOPMARGIN, 5 - BOTTOMMARGIN, 347 - HORZGUIDE, 7 - END - - D_SM_VLAN, DIALOG - BEGIN - LEFTMARGIN, 7 - RIGHTMARGIN, 308 - TOPMARGIN, 5 - BOTTOMMARGIN, 275 - END - - D_SM_MSG, DIALOG - BEGIN - LEFTMARGIN, 7 - RIGHTMARGIN, 268 - TOPMARGIN, 5 - BOTTOMMARGIN, 271 - END - - D_NICINFO, DIALOG - BEGIN - LEFTMARGIN, 7 - RIGHTMARGIN, 214 - TOPMARGIN, 5 - BOTTOMMARGIN, 86 - END - - D_SM_IPSEC, DIALOG - BEGIN - LEFTMARGIN, 7 - RIGHTMARGIN, 416 - TOPMARGIN, 5 - BOTTOMMARGIN, 302 - END - - D_SM_ETHERIP, DIALOG - BEGIN - LEFTMARGIN, 7 - RIGHTMARGIN, 404 - VERTGUIDE, 326 - TOPMARGIN, 5 - BOTTOMMARGIN, 239 - END - - D_SM_ETHERIP_ID, DIALOG - BEGIN - LEFTMARGIN, 7 - RIGHTMARGIN, 260 - TOPMARGIN, 5 - BOTTOMMARGIN, 222 - END - - D_SM_OPENVPN, DIALOG - BEGIN - LEFTMARGIN, 7 - RIGHTMARGIN, 420 - TOPMARGIN, 5 - BOTTOMMARGIN, 303 - END - - D_SM_DDNS, DIALOG - BEGIN - LEFTMARGIN, 7 - RIGHTMARGIN, 408 - TOPMARGIN, 5 - BOTTOMMARGIN, 282 - END - - D_SM_SPECIALLISTENER, DIALOG - BEGIN - LEFTMARGIN, 7 - RIGHTMARGIN, 350 - TOPMARGIN, 5 - BOTTOMMARGIN, 314 - END - - D_SM_REDIRECT, DIALOG - BEGIN - LEFTMARGIN, 7 - RIGHTMARGIN, 351 - TOPMARGIN, 5 - BOTTOMMARGIN, 306 - END - - D_SW_TEST1, DIALOG - BEGIN - LEFTMARGIN, 7 - RIGHTMARGIN, 316 - TOPMARGIN, 5 - BOTTOMMARGIN, 150 - END - - D_DUMMY, DIALOG - BEGIN - LEFTMARGIN, 7 - RIGHTMARGIN, 179 - TOPMARGIN, 5 - BOTTOMMARGIN, 72 - END - - D_SW_TEST2, DIALOG - BEGIN - LEFTMARGIN, 7 - RIGHTMARGIN, 168 - TOPMARGIN, 5 - BOTTOMMARGIN, 79 - END - - D_SW_DEFAULT, DIALOG - BEGIN - LEFTMARGIN, 7 - RIGHTMARGIN, 316 - TOPMARGIN, 5 - BOTTOMMARGIN, 150 - END - - D_SW_WELCOME, DIALOG - BEGIN - LEFTMARGIN, 7 - RIGHTMARGIN, 316 - TOPMARGIN, 5 - BOTTOMMARGIN, 150 - END - - D_SW_MODE, DIALOG - BEGIN - LEFTMARGIN, 7 - RIGHTMARGIN, 316 - TOPMARGIN, 5 - END - - D_SW_NOT_ADMIN, DIALOG - BEGIN - LEFTMARGIN, 7 - RIGHTMARGIN, 316 - TOPMARGIN, 5 - BOTTOMMARGIN, 150 - END - - D_SW_COMPONENTS, DIALOG - BEGIN - LEFTMARGIN, 7 - RIGHTMARGIN, 316 - TOPMARGIN, 5 - BOTTOMMARGIN, 150 - END - - D_SW_EULA, DIALOG - BEGIN - LEFTMARGIN, 7 - RIGHTMARGIN, 316 - TOPMARGIN, 5 - BOTTOMMARGIN, 150 - END - - D_SW_WARNING, DIALOG - BEGIN - LEFTMARGIN, 7 - RIGHTMARGIN, 316 - TOPMARGIN, 5 - BOTTOMMARGIN, 150 - END - - D_SW_DIR, DIALOG - BEGIN - LEFTMARGIN, 7 - RIGHTMARGIN, 316 - TOPMARGIN, 5 - BOTTOMMARGIN, 150 - END - - D_SW_READY, DIALOG - BEGIN - LEFTMARGIN, 7 - RIGHTMARGIN, 316 - TOPMARGIN, 5 - BOTTOMMARGIN, 150 - END - - D_SW_PERFORM, DIALOG - BEGIN - LEFTMARGIN, 7 - RIGHTMARGIN, 316 - TOPMARGIN, 5 - BOTTOMMARGIN, 150 - END - - D_SW_ERROR, DIALOG - BEGIN - LEFTMARGIN, 7 - RIGHTMARGIN, 316 - TOPMARGIN, 5 - BOTTOMMARGIN, 150 - END - - D_SW_FINISH, DIALOG - BEGIN - LEFTMARGIN, 7 - RIGHTMARGIN, 316 - TOPMARGIN, 5 - BOTTOMMARGIN, 150 - END - - D_SW_UNINST1, DIALOG - BEGIN - LEFTMARGIN, 7 - RIGHTMARGIN, 316 - TOPMARGIN, 5 - BOTTOMMARGIN, 150 - END - - D_SW_LANG1, DIALOG - BEGIN - LEFTMARGIN, 7 - RIGHTMARGIN, 316 - TOPMARGIN, 5 - BOTTOMMARGIN, 150 - END - - D_SW_EASY1, DIALOG - BEGIN - LEFTMARGIN, 7 - RIGHTMARGIN, 316 - TOPMARGIN, 5 - BOTTOMMARGIN, 150 - END - - D_SW_EASY2, DIALOG - BEGIN - LEFTMARGIN, 7 - RIGHTMARGIN, 316 - TOPMARGIN, 5 - BOTTOMMARGIN, 150 - END - - D_SW_WEB1, DIALOG - BEGIN - LEFTMARGIN, 7 - RIGHTMARGIN, 316 - TOPMARGIN, 5 - BOTTOMMARGIN, 150 - END - - D_SW_WEB2, DIALOG - BEGIN - LEFTMARGIN, 7 - RIGHTMARGIN, 316 - TOPMARGIN, 5 - BOTTOMMARGIN, 150 - END - - D_UPDATE_NOTICE, DIALOG - BEGIN - LEFTMARGIN, 7 - RIGHTMARGIN, 252 - TOPMARGIN, 5 - BOTTOMMARGIN, 199 - END - - D_UPDATE_CONFIG, DIALOG - BEGIN - LEFTMARGIN, 7 - RIGHTMARGIN, 300 - TOPMARGIN, 5 - BOTTOMMARGIN, 127 - END - - D_SM_VMBRIDGE, DIALOG - BEGIN - LEFTMARGIN, 7 - RIGHTMARGIN, 304 - TOPMARGIN, 5 - BOTTOMMARGIN, 264 - END - - D_SM_AZURE, DIALOG - BEGIN - LEFTMARGIN, 7 - RIGHTMARGIN, 404 - TOPMARGIN, 5 - BOTTOMMARGIN, 312 - END - - D_SM_PROXY, DIALOG - BEGIN - LEFTMARGIN, 7 - RIGHTMARGIN, 220 - TOPMARGIN, 5 - BOTTOMMARGIN, 138 - END - - D_VGC_LIST, DIALOG - BEGIN - LEFTMARGIN, 7 - RIGHTMARGIN, 439 - TOPMARGIN, 5 - BOTTOMMARGIN, 298 - END - - D_VGC_PROTOCOL, DIALOG - BEGIN - LEFTMARGIN, 7 - RIGHTMARGIN, 274 - TOPMARGIN, 5 - BOTTOMMARGIN, 143 - END - - D_VGS_CONFIG, DIALOG - BEGIN - LEFTMARGIN, 7 - RIGHTMARGIN, 363 - TOPMARGIN, 5 - BOTTOMMARGIN, 306 - END - - D_VGS_OPTION, DIALOG - BEGIN - LEFTMARGIN, 7 - RIGHTMARGIN, 348 - TOPMARGIN, 5 - BOTTOMMARGIN, 290 - END - - D_VGS_WARNING, DIALOG - BEGIN - LEFTMARGIN, 7 - RIGHTMARGIN, 342 - TOPMARGIN, 5 - BOTTOMMARGIN, 244 - END - - D_NM_PUSH, DIALOG - BEGIN - LEFTMARGIN, 7 - RIGHTMARGIN, 360 - TOPMARGIN, 5 - BOTTOMMARGIN, 246 - END -END -#endif // APSTUDIO_INVOKED - - -///////////////////////////////////////////////////////////////////////////// -// -// Dialog -// - -D_SECURE DIALOGEX 0, 0, 307, 172 -STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION -EXSTYLE WS_EX_APPWINDOW -CAPTION "@D_SECURE" -FONT 9, "MS Shell Dlg", 400, 0, 0x80 -BEGIN - CONTROL 107,S_IMAGE,"Static",SS_BITMAP,7,5,81,54 - LTEXT "@S_TITLE",S_TITLE,99,5,166,17 - LTEXT "%s",S_INSERT_SECURE,99,25,200,17 - CONTROL "@S_DEVICE_INFO",S_DEVICE_INFO,"Static",SS_LEFTNOWORDWRAP | WS_GROUP,106,59,173,23 - GROUPBOX "@IDS_STATIC1",IDS_STATIC1,99,47,189,39 - EDITTEXT E_PIN,106,101,180,12,ES_PASSWORD | ES_AUTOHSCROLL - LTEXT "@S_WARNING",S_WARNING,106,117,176,24 - DEFPUSHBUTTON "@IDOK",IDOK,186,149,54,16 - PUSHBUTTON "@IDCANCEL",IDCANCEL,245,149,54,16 - CONTROL "",A_PROGRESS,"SysAnimate32",ACS_TRANSPARENT | WS_TABSTOP,110,99,120,16,WS_EX_TRANSPARENT - LTEXT "S_STATUS",S_STATUS,106,116,193,18,NOT WS_VISIBLE - RTEXT "@S_PIN_CODE",S_PIN_CODE,40,101,64,11 - LTEXT "-- SOFTWARE TITLE --",S_SOFTWARE_TITLE,7,154,177,12 - CONTROL ICO_SESSION_BRIDGE,S_IMAGE2,"Static",SS_BITMAP,7,5,81,54 - CONTROL ICO_TRAY4,S_IMAGE_TSUKUBA,"Static",SS_BITMAP,7,5,81,54 -END - -D_PKCSUTIL DIALOGEX 0, 0, 299, 251 -STYLE DS_SETFONT | DS_FIXEDSYS | DS_CENTER | WS_POPUP | WS_CAPTION | WS_SYSMENU -CAPTION "@D_PKCSUTIL" -FONT 9, "MS Shell Dlg", 400, 0, 0x80 -BEGIN - ICON ICO_CERT,IDC_STATIC,7,5,18,18 - LTEXT "@S_TITLE",S_TITLE,30,5,263,18 - LTEXT "@STATIC1",IDC_STATIC,31,33,245,34 - GROUPBOX "@STATIC2",IDC_STATIC,31,76,241,74 - LTEXT "@STATIC3",IDC_STATIC,38,86,227,31 - PUSHBUTTON "@B_WRITE",B_WRITE,199,125,65,17 - GROUPBOX "@STATIC4",IDC_STATIC,31,156,241,55 - LTEXT "@STATIC5",IDC_STATIC,38,167,227,17 - PUSHBUTTON "@B_ERASE",B_ERASE,199,187,65,17 - PUSHBUTTON "@IDCANCEL",IDCANCEL,212,230,80,16 - LTEXT "@S_COPYRIGHT",S_COPYRIGHT,7,219,195,27 -END - -D_PASSPHRASE DIALOGEX 0, 0, 239, 77 -STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU -CAPTION "@D_PASSPHRASE" -FONT 9, "MS Shell Dlg", 400, 0, 0x80 -BEGIN - ICON ICO_KEY,IDC_STATIC,7,5,20,18 - LTEXT "@STATIC1",IDC_STATIC,28,5,194,25 - RTEXT "@STATIC2",IDC_STATIC,7,37,55,10 - EDITTEXT E_PASSPHRASE,67,35,156,11,ES_PASSWORD | ES_AUTOHSCROLL - DEFPUSHBUTTON "@IDOK",IDOK,126,56,50,16 - PUSHBUTTON "@IDCANCEL",IDCANCEL,182,56,50,16 -END - -D_NM_CONNECT DIALOGEX 0, 0, 271, 49 -STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION -CAPTION "@D_NM_CONNECT" -FONT 9, "MS Shell Dlg", 400, 0, 0x80 -BEGIN - ICON ICO_ROUTER,IDC_STATIC,7,13,20,18 - LTEXT "@S_TITLE",S_TITLE,33,19,231,24 -END - -D_PASSWORD DIALOGEX 0, 0, 259, 183 -STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU -EXSTYLE WS_EX_APPWINDOW -CAPTION "@D_PASSWORD" -FONT 9, "MS Shell Dlg", 400, 0, 0x80 -BEGIN - ICON ICO_KEY,IDC_STATIC,7,5,20,18 - LTEXT "@S_TITLE",S_TITLE,31,11,221,25 - GROUPBOX "@STATIC1",IDC_STATIC,21,39,209,88 - RTEXT "@STATIC2",IDC_STATIC,32,55,60,11 - COMBOBOX C_TYPE,99,53,108,48,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP - RTEXT "@STATIC3",IDC_STATIC,32,74,60,10 - EDITTEXT E_USERNAME,99,72,108,11,ES_AUTOHSCROLL - RTEXT "@STATIC4",IDC_STATIC,32,93,60,10 - EDITTEXT E_PASSWORD,99,91,108,11,ES_PASSWORD | ES_AUTOHSCROLL - CONTROL "@R_NO_SAVE_PASSWORD",R_NO_SAVE_PASSWORD,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,99,108,120,9 - LTEXT "@S_COUNTDOWN",S_COUNTDOWN,21,130,207,13 - CONTROL "",P_PROGRESS,"msctls_progress32",WS_BORDER,21,145,209,8 - DEFPUSHBUTTON "@IDOK",IDOK,133,162,50,15 - PUSHBUTTON "@IDCANCEL",IDCANCEL,189,162,63,15 -END - -D_STATUS DIALOGEX 0, 0, 215, 56 -STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | DS_CENTER | WS_POPUP | WS_CAPTION | WS_SYSMENU -EXSTYLE WS_EX_APPWINDOW -CAPTION "@D_STATUS" -FONT 9, "MS Shell Dlg", 400, 0, 0x80 -BEGIN - ICON ICO_SERVER_ONLINE,IDC_STATIC,7,5,20,18 - LTEXT "@S_STATUS",S_STATUS,31,5,177,28 - DEFPUSHBUTTON "@IDCANCEL",IDCANCEL,81,36,50,14 -END - -D_CERT DIALOGEX 0, 0, 271, 335 -STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU -CAPTION "@D_CERT" -FONT 9, "MS Shell Dlg", 400, 0, 0x80 -BEGIN - ICON ICO_CERT,IDC_STATIC,6,5,20,18 - LTEXT "@S_TITLE",S_TITLE,32,5,232,15 - GROUPBOX "@STATIC1",IDC_STATIC,6,28,258,59 - RTEXT "@STATIC2",IDC_STATIC,41,41,39,9 - EDITTEXT E_SUBJECT,85,41,164,11,ES_AUTOHSCROLL | ES_READONLY | NOT WS_BORDER - RTEXT "@STATIC3",IDC_STATIC,41,54,39,10 - EDITTEXT E_ISSUER,85,54,164,11,ES_AUTOHSCROLL | ES_READONLY | NOT WS_BORDER - RTEXT "@STATIC4",IDC_STATIC,41,67,39,9 - EDITTEXT E_EXPIRES,85,67,128,11,ES_AUTOHSCROLL | ES_READONLY | NOT WS_BORDER - GROUPBOX "@STATIC5",IDC_STATIC,6,93,258,155 - CONTROL "",L_CERTINFO,"SysListView32",LVS_REPORT | LVS_SHOWSELALWAYS | LVS_SHAREIMAGELISTS | LVS_EDITLABELS | LVS_ALIGNLEFT | WS_BORDER | WS_TABSTOP,21,110,229,84 - GROUPBOX "@STATIC6",IDC_STATIC1,6,252,258,55 - ICON ICO_CERT,S_CERT_ICON,22,268,20,18 - LTEXT "@S_PARENT",S_PARENT,46,270,150,18 - PUSHBUTTON "",B_PARENT,220,264,29,23,BS_ICON - CTEXT "@S_PARENT_BUTTON_STR",S_PARENT_BUTTON_STR,205,292,55,9 - DEFPUSHBUTTON "@IDCANCEL",IDCANCEL,214,314,50,15 - ICON ICO_WARNING,S_WARNING_ICON,22,269,20,18 - EDITTEXT E_DETAIL,21,197,228,42,ES_MULTILINE | ES_NOHIDESEL | ES_READONLY | WS_VSCROLL - PUSHBUTTON "@B_SAVE",B_SAVE,128,314,76,15 -END - -D_CHECKCERT DIALOGEX 0, 0, 251, 257 -STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU -EXSTYLE WS_EX_APPWINDOW -CAPTION "@D_CHECKCERT" -FONT 9, "MS Shell Dlg", 400, 0, 0x80 -BEGIN - ICON ICO_WARNING,IDC_STATIC,7,5,20,18 - LTEXT "@S_TITLE",S_TITLE,33,5,211,30 - GROUPBOX "@STATIC1",IDC_STATIC,7,41,237,170 - LTEXT "@STATIC2",IDC_STATIC,14,52,222,23 - ICON ICO_SERVER_ONLINE,IDC_STATIC,17,83,20,18 - LTEXT "@S_MSG1",S_MSG1,42,83,193,23 - RTEXT "@STATIC3",IDC_STATIC,14,106,69,11 - EDITTEXT E_SUBJECT,88,106,149,11,ES_AUTOHSCROLL | ES_READONLY | NOT WS_BORDER - RTEXT "@STATIC4",IDC_STATIC,15,119,68,10 - EDITTEXT E_ISSUER,88,119,149,11,ES_AUTOHSCROLL | ES_READONLY | NOT WS_BORDER - RTEXT "@STATIC5",IDC_STATIC,15,131,68,10 - EDITTEXT E_EXPIRES,88,131,149,11,ES_AUTOHSCROLL | ES_READONLY | NOT WS_BORDER - PUSHBUTTON "@B_SHOW",B_SHOW,158,172,76,15 - LTEXT "@STATIC9",IDC_STATIC,7,211,237,25 - RTEXT "@STATIC6",IDC_STATIC,16,144,67,9 - EDITTEXT E_MD5,88,144,148,11,ES_AUTOHSCROLL | ES_READONLY | NOT WS_BORDER - RTEXT "@STATIC7",IDC_STATIC,14,158,69,11 - EDITTEXT E_SHA1,88,158,148,11,ES_AUTOHSCROLL | ES_READONLY | NOT WS_BORDER - DEFPUSHBUTTON "@IDOK",IDOK,38,237,80,15 - PUSHBUTTON "@IDCANCEL",IDCANCEL,127,237,80,15 - LTEXT "@STATIC8",IDC_STATIC,15,191,221,17 -END - -D_CONNECTERROR DIALOGEX 0, 0, 251, 182 -STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU -EXSTYLE WS_EX_APPWINDOW -CAPTION "@D_CONNECTERROR" -FONT 9, "MS Shell Dlg", 400, 0, 0x80 -BEGIN - ICON ICO_SERVER_OFFLINE,IDC_STATIC,7,5,20,18 - LTEXT "@S_TITLE",S_TITLE,31,5,213,21 - EDITTEXT E_ERROR,31,27,197,64,ES_MULTILINE | ES_READONLY | ES_WANTRETURN | NOT WS_BORDER - LTEXT "@S_COUNTDOWN",S_COUNTDOWN,23,106,207,20 - CONTROL "",P_PROGRESS,"msctls_progress32",WS_BORDER,23,128,209,8 - DEFPUSHBUTTON "@IDOK",IDOK,125,161,50,15 - PUSHBUTTON "@IDCANCEL",IDCANCEL,181,161,63,15 - LTEXT "---",S_RETRYINFO,23,94,207,12 - CONTROL "@R_HIDE",R_HIDE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,23,140,214,17 -END - -D_CM_LOGIN DIALOGEX 0, 0, 275, 114 -STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU -CAPTION "@D_CM_LOGIN" -FONT 9, "MS Shell Dlg", 400, 0, 0x80 -BEGIN - ICON ICO_KEY,IDC_STATIC,7,5,20,18 - LTEXT "@S_TITLE",S_TITLE,31,5,237,30 - RTEXT "@STATIC1",IDC_STATIC,33,59,49,11 - EDITTEXT E_PASSWORD,87,58,141,11,ES_PASSWORD | ES_AUTOHSCROLL - GROUPBOX "@STATIC2",IDC_STATIC,26,40,222,43 - DEFPUSHBUTTON "@IDOK",IDOK,158,95,52,14 - PUSHBUTTON "@IDCANCEL",IDCANCEL,216,95,52,14 -END - -D_CM_MAIN DIALOGEX 0, 0, 258, 211 -STYLE DS_SETFONT | DS_FIXEDSYS | WS_MINIMIZEBOX | WS_MAXIMIZEBOX | WS_CAPTION | WS_SYSMENU | WS_THICKFRAME -EXSTYLE WS_EX_APPWINDOW -CAPTION "PacketiX VPN Main Window" -MENU M_MAIN -FONT 9, "MS Shell Dlg", 400, 0, 0x80 -BEGIN - CONTROL "",L_ACCOUNT,"SysListView32",LVS_REPORT | LVS_SHOWSELALWAYS | LVS_SHAREIMAGELISTS | LVS_AUTOARRANGE | LVS_EDITLABELS | WS_BORDER | WS_TABSTOP,7,5,244,123 - CONTROL "",L_VLAN,"SysListView32",LVS_REPORT | LVS_SHOWSELALWAYS | LVS_SHAREIMAGELISTS | LVS_AUTOARRANGE | WS_BORDER | WS_TABSTOP,7,131,244,74 -END - -D_CONNECTION_STATUS DIALOGEX 0, 0, 291, 229 -STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU -CAPTION "@D_CONNECTION_STATUS" -FONT 9, "MS Shell Dlg", 400, 0, 0x80 -BEGIN - ICON ICO_TOWER,IDC_STATIC,7,5,20,18 - LTEXT "@S_TITLE",S_TITLE,28,5,256,23 - CONTROL "",L_STATUS,"SysListView32",LVS_REPORT | LVS_SHAREIMAGELISTS | LVS_AUTOARRANGE | WS_BORDER | WS_TABSTOP,7,33,277,171 - PUSHBUTTON "@B_POLICY",B_POLICY,7,209,73,15 - PUSHBUTTON "@B_SERVER_CERT",B_SERVER_CERT,88,209,65,15 - PUSHBUTTON "@B_CLIENT_CERT",B_CLIENT_CERT,161,209,65,15 - DEFPUSHBUTTON "@IDCANCEL",IDCANCEL,234,209,50,15 -END - -D_CM_POLICY DIALOGEX 0, 0, 303, 259 -STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU -CAPTION "@D_CM_POLICY" -FONT 9, "MS Shell Dlg", 400, 0, 0x80 -BEGIN - ICON ICO_MACHINE,IDC_STATIC,7,5,18,18 - LTEXT "@S_TITLE",S_TITLE,34,11,262,17 - CONTROL "",L_POLICY,"SysListView32",LVS_REPORT | LVS_SINGLESEL | LVS_SHOWSELALWAYS | LVS_SHAREIMAGELISTS | LVS_AUTOARRANGE | WS_BORDER | WS_TABSTOP,7,33,289,155 - DEFPUSHBUTTON "@IDCANCEL",IDCANCEL,246,239,50,15 - EDITTEXT S_DESCRIPTION,7,191,289,45,ES_MULTILINE | ES_AUTOVSCROLL | ES_READONLY | ES_WANTRETURN | WS_VSCROLL -END - -D_CM_ACCOUNT DIALOGEX 0, 0, 451, 333 -STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU -CAPTION "@D_CM_ACCOUNT" -FONT 9, "MS Shell Dlg", 400, 0, 0x80 -BEGIN - ICON ICO_SERVER_ONLINE,IDC_STATIC,7,5,20,18 - LTEXT "@STATIC1",S_STATIC1,29,5,186,24 - RTEXT "@S_ACCOUNT_NAME",S_ACCOUNT_NAME,7,32,61,11 - EDITTEXT E_ACCOUNT_NAME,72,30,126,11,ES_AUTOHSCROLL - GROUPBOX "@STATIC2",S_STATIC2,7,43,206,90 - ICON ICO_VPNSERVER,IDC_STATIC,14,55,20,18 - LTEXT "@STATIC3",S_STATIC3,40,55,166,25 - RTEXT "@STATIC4",S_STATIC4,14,86,54,9 - EDITTEXT E_HOSTNAME,72,84,126,11,ES_AUTOHSCROLL - RTEXT "@STATIC5",S_STATIC5,14,101,54,9 - COMBOBOX C_PORT,72,98,77,42,CBS_DROPDOWN | WS_VSCROLL | WS_TABSTOP - CONTROL "@R_DISABLE_NATT",R_DISABLE_NATT,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,152,100,57,9 - LTEXT "@STATIC6",S_STATIC66,172,136,46,10,NOT WS_VISIBLE - RTEXT "@STATIC7",S_STATIC7,14,117,54,9 - COMBOBOX C_HUBNAME,72,113,126,62,CBS_DROPDOWN | CBS_SORT | WS_VSCROLL | WS_TABSTOP - GROUPBOX "@STATIC8",IDC_STATIC,7,137,206,103 - ICON ICO_TOWER,IDC_STATIC,14,149,20,18 - LTEXT "@STATIC9",IDC_STATIC,40,149,163,17 - PUSHBUTTON "@B_IE",B_IE,74,158,114,15 - RTEXT "@STATIC10",IDC_STATIC,14,175,54,9 - CONTROL "@R_DIRECT_TCP",R_DIRECT_TCP,"Button",BS_AUTORADIOBUTTON | WS_TABSTOP,72,173,135,10 - CONTROL "@R_HTTPS",R_HTTPS,"Button",BS_AUTORADIOBUTTON,72,184,135,10 - CONTROL "@R_SOCKS",R_SOCKS,"Button",BS_AUTORADIOBUTTON,72,194,135,10 - CONTROL "@R_SOCKS5",R_SOCKS5,"Button",BS_AUTORADIOBUTTON,72,204,135,10 - PUSHBUTTON "@B_PROXY_CONFIG",B_PROXY_CONFIG,74,218,114,15 - GROUPBOX "@STATIC11",S_STATIC11,7,245,206,69 - ICON ICO_CERT,IDC_STATIC,14,255,20,18 - CONTROL "@R_CHECK_CERT",R_CHECK_CERT,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,41,259,133,9 - PUSHBUTTON "@B_TRUST",B_TRUST,41,273,157,15 - PUSHBUTTON "@B_SERVER_CERT",B_SERVER_CERT,41,291,77,15 - PUSHBUTTON "@B_VIEW_SERVER_CERT",B_VIEW_SERVER_CERT,123,291,75,15 - CONTROL "@R_HIDE",R_HIDE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,7,318,148,9 - CONTROL "@R_HIDE2",R_HIDE2,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,158,318,132,9 - CONTROL "",L_VLAN,"SysListView32",LVS_REPORT | LVS_SINGLESEL | LVS_SHOWSELALWAYS | LVS_SHAREIMAGELISTS | LVS_NOCOLUMNHEADER | LVS_NOSORTHEADER | WS_BORDER | WS_TABSTOP,233,17,200,66 - GROUPBOX "@S_VLAN_GROUP",S_VLAN_GROUP,224,5,220,88 - LTEXT "@S_POLICY_1",S_POLICY_1,258,17,163,24,NOT WS_VISIBLE - PUSHBUTTON "@B_POLICY",B_POLICY,343,45,77,15,NOT WS_VISIBLE - ICON ICO_CASCADE,S_POLICY_2,233,17,20,18,NOT WS_VISIBLE - GROUPBOX "@STATIC12",IDC_STATIC,223,98,221,108 - ICON ICO_KEY,IDC_STATIC,230,108,20,18 - LTEXT "@STATIC15",IDC_STATIC,251,108,185,18 - RTEXT "@STATIC13",IDC_STATIC,237,131,48,9 - COMBOBOX C_TYPE,289,129,126,65,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP - RTEXT "@S_USERNAME",S_USERNAME,230,147,54,9 - EDITTEXT E_USERNAME,289,145,126,11,ES_AUTOHSCROLL - RTEXT "@S_PASSWORD",S_PASSWORD,230,161,54,9,NOT WS_VISIBLE - ICON ICO_CERT,S_CERT,248,158,20,18 - LTEXT "@S_CERT_INFO",S_CERT_INFO,272,160,160,24 - EDITTEXT E_PASSWORD,289,160,126,11,ES_PASSWORD | ES_AUTOHSCROLL | NOT WS_VISIBLE - CTEXT "@S_CHANGE_PASSWORD",S_CHANGE_PASSWORD,244,173,187,10 - PUSHBUTTON "VIEW_CLIENT_CERT",B_VIEW_CLIENT_CERT,246,184,90,15 - PUSHBUTTON "@B_REGIST_CLIENT_CERT",B_REGIST_CLIENT_CERT,341,184,90,15 - PUSHBUTTON "@B_CHANGE_PASSWORD",B_CHANGE_PASSWORD,341,184,90,15 - GROUPBOX "@STATIC14",IDC_STATIC,223,212,221,86 - ICON ICO_MACHINE,IDC_STATIC,230,224,20,18 - CONTROL "@R_RETRY",R_RETRY,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,253,225,184,9 - RTEXT "@S_RETRY_NUM_1",S_RETRY_NUM_1,253,239,61,9 - EDITTEXT E_RETRY_NUM,318,237,41,11,ES_RIGHT | ES_AUTOHSCROLL | ES_NUMBER - LTEXT "@S_RETRY_NUM_2",S_RETRY_NUM_2,364,239,73,8 - RTEXT "@S_RETRY_SPAN_1",S_RETRY_SPAN_1,228,252,86,9 - EDITTEXT E_RETRY_SPAN,318,251,41,11,ES_RIGHT | ES_AUTOHSCROLL | ES_NUMBER - LTEXT "@S_RETRY_SPAN_2",S_RETRY_SPAN_2,364,252,72,9 - CONTROL "@R_INFINITE",R_INFINITE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,266,265,171,9 - PUSHBUTTON "@B_DETAIL",B_DETAIL,344,277,87,15 - DEFPUSHBUTTON "@IDOK",IDOK,308,310,64,17 - PUSHBUTTON "@IDCANCEL",IDCANCEL,380,310,64,17 - CONTROL 178,S_ROUTER_LOGO,"Static",SS_BITMAP | NOT WS_VISIBLE,358,5,86,89 -END - -D_CM_PROXY DIALOGEX 0, 0, 255, 131 -STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU -CAPTION "@D_CM_PROXY" -FONT 9, "MS Shell Dlg", 400, 0, 0x80 -BEGIN - ICON ICO_TOWER,IDC_STATIC,7,5,20,18 - LTEXT "@STATIC1",IDC_STATIC,26,5,222,25 - RTEXT "@STATIC2",IDC_STATIC,7,38,74,9 - EDITTEXT E_HOSTNAME,85,36,126,11,ES_AUTOHSCROLL - RTEXT "@STATIC3",IDC_STATIC,7,53,74,8 - COMBOBOX C_PORT,85,50,48,42,CBS_DROPDOWN | WS_VSCROLL | WS_TABSTOP - RTEXT "@STATIC4",IDC_STATIC,7,70,74,10 - EDITTEXT E_USERNAME,85,68,99,11,ES_AUTOHSCROLL - RTEXT "@STATIC5",IDC_STATIC,7,86,74,9 - EDITTEXT E_PASSWORD,85,84,99,11,ES_PASSWORD | ES_AUTOHSCROLL - PUSHBUTTON "@B_HTTP_HEADER", B_HTTP_HEADER, 7, 110, 100, 15, 0, WS_EX_LEFT - DEFPUSHBUTTON "@IDOK",IDOK,115,110,64,15 - PUSHBUTTON "@IDCANCEL",IDCANCEL,184,110,64,15 - LTEXT "@STATIC6",IDC_STATIC,191,70,57,12 - LTEXT "@STATIC7",IDC_STATIC,191,86,57,11 -END - -D_CM_PROXY_HTTP_HEADER DIALOGEX 0, 0, 255, 131 -STYLE DS_MODALFRAME | DS_SHELLFONT | WS_CAPTION | WS_POPUP | WS_SYSMENU -CAPTION "@D_CM_PROXY_HTTP_HEADER" -FONT 9, "MS Shell Dlg", 400, 0, 0x80 -{ - DEFPUSHBUTTON "@IDOK", IDOK, 115, 110, 64, 15, 0, WS_EX_LEFT - PUSHBUTTON "@IDCANCEL", IDCANCEL, 184, 110, 64, 15, 0, WS_EX_LEFT - CONTROL "", L_VALUES_LIST, "SysListView32", LVS_REPORT | LVS_SINGLESEL | LVS_SHOWSELALWAYS | LVS_NOSORTHEADER | WS_BORDER | WS_TABSTOP, 7, 5, 186, 100, WS_EX_LEFT - PUSHBUTTON "@B_NEW", B_NEW, 198, 5, 50, 15, 0, WS_EX_LEFT - PUSHBUTTON "@B_DELETE", B_DELETE, 198, 25, 50, 15, 0, WS_EX_LEFT - PUSHBUTTON "@B_CLEAR", B_CLEAR, 198, 60, 50, 15, 0, WS_EX_LEFT -} - -D_CM_DETAIL DIALOGEX 0, 0, 435, 312 -STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU -CAPTION "@D_CM_DETAIL" -FONT 9, "MS Shell Dlg", 400, 0, 0x80 -BEGIN - ICON ICO_MACHINE,IDC_STATIC,7,5,18,18 - LTEXT "@STATIC1",IDC_STATIC,33,5,394,20 - GROUPBOX "@STATIC2",S_STATIC2,7,32,205,274 - ICON ICO_NIC_ONLINE,IDC_STATIC,15,44,18,18 - LTEXT "@STATIC3",S_STATIC3,39,44,167,24 - LTEXT "@STATIC4",S_STATIC4,15,71,130,9 - COMBOBOX C_NUM_TCP,39,83,33,95,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP - LTEXT "@STATIC5",S_STATIC5,78,85,125,9 - LTEXT "@STATIC6",S_STATIC6,39,98,165,16 - LTEXT "@STATIC7",S_STATIC7,15,118,130,9 - RTEXT "@STATIC8",S_STATIC8,15,131,106,9 - EDITTEXT E_INTERVAL,125,129,40,11,ES_RIGHT | ES_AUTOHSCROLL | ES_NUMBER - LTEXT "@STATIC9",S_STATIC9,169,131,38,8 - CONTROL "@R_USE_DISCONNECT",R_USE_DISCONNECT,"Button",BS_AUTOCHECKBOX | BS_MULTILINE | WS_TABSTOP,39,146,160,16 - RTEXT "@STATIC10",S_STATIC10,15,166,105,8 - EDITTEXT E_DISCONNECT_SPAN,125,164,40,11,ES_RIGHT | ES_AUTOHSCROLL | ES_NUMBER - LTEXT "@STATIC11",S_STATIC11,169,166,40,9 - LTEXT "@STATIC12",S_STATIC12,15,182,190,67 - CONTROL "@R_USE_HALF_CONNECTION",R_USE_HALF_CONNECTION,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,39,251,160,9 - CONTROL "",IDC_STATIC,"Static",SS_ETCHEDHORZ,14,266,190,30 - LTEXT "@STATIC19",S_STATIC19,18,271,184,17 - CONTROL "@R_DISABLE_QOS",R_DISABLE_QOS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,39,290,161,10 - GROUPBOX "@STATIC13",S_STATIC133,222,32,205,122 - ICON ICO_KEY,IDC_STATIC,230,40,18,18 - LTEXT "@STATIC14",IDC_STATIC,254,40,167,32 - CONTROL "@R_USE_ENCRYPT",R_USE_ENCRYPT,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,254,74,160,9 - ICON ICO_VPN,IDC_STATIC,230,89,18,18 - LTEXT "@S_UDPACCEL",IDC_STATIC,254,89,167,30 - CONTROL "@R_USE_COMPRESS",R_USE_COMPRESS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,254,120,160,9 - CONTROL "@R_DISABLE_UDP",R_DISABLE_UDP,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,254,137,160,9 - GROUPBOX "@STATIC16",IDC_STATIC,222,158,205,63 - LTEXT "@S_MODE",S_MODE,254,169,166,17 - CONTROL "@R_BRIDGE",R_BRIDGE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,254,191,166,9 - CONTROL "@R_MONITOR",R_MONITOR,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,254,205,166,9 - GROUPBOX "@STATIC17",IDC_STATIC,222,225,205,30 - CONTROL "@R_NO_ROUTING",R_NO_ROUTING,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,233,238,181,9 - ICON ICO_WARNING,S_WARNING_ICON,223,261,18,18 - LTEXT "@STATIC18",IDC_STATIC,247,261,180,26 - DEFPUSHBUTTON "@IDOK",IDOK,294,291,64,15 - PUSHBUTTON "@IDCANCEL",IDCANCEL,363,291,64,15 - ICON ICO_SWITCH,IDC_STATIC,230,169,18,18 -END - -D_CM_NEW_VLAN DIALOGEX 0, 0, 251, 98 -STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU -CAPTION "@D_CM_NEW_VLAN" -FONT 9, "MS Shell Dlg", 400, 0, 0x80 -BEGIN - ICON ICO_NIC_ONLINE,IDC_STATIC,7,5,18,18 - LTEXT "@S_INFO",S_INFO,32,8,212,24 - RTEXT "@STATIC1",IDC_STATIC,7,38,93,9 - EDITTEXT E_NAME,105,36,120,11,ES_AUTOHSCROLL - DEFPUSHBUTTON "@IDOK",IDOK,112,77,64,15 - PUSHBUTTON "@IDCANCEL",IDCANCEL,180,77,64,15 - LTEXT "@S_WIN8",S_WIN8,7,55,237,21,NOT WS_VISIBLE -END - -D_CM_TRUST DIALOGEX 0, 0, 335, 195 -STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU -CAPTION "@D_CM_TRUST" -FONT 9, "MS Shell Dlg", 400, 0, 0x80 -BEGIN - ICON ICO_CERT,IDC_STATIC,7,5,20,18 - LTEXT "@STATIC1",IDC_STATIC,33,5,295,38 - CONTROL "",L_CERT,"SysListView32",LVS_REPORT | LVS_SHOWSELALWAYS | LVS_SHAREIMAGELISTS | WS_BORDER | WS_TABSTOP,7,44,321,122 - PUSHBUTTON "@B_IMPORT",B_IMPORT,7,174,55,15 - PUSHBUTTON "@B_EXPORT",B_EXPORT,66,174,54,15 - DEFPUSHBUTTON "@IDOK",IDOK,187,174,62,15 - PUSHBUTTON "@IDCANCEL",IDCANCEL,255,174,73,15 - PUSHBUTTON "@B_DELETE",B_DELETE,126,174,54,15 -END - -D_CM_PASSWORD DIALOGEX 0, 0, 277, 159 -STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU -CAPTION "@D_CM_PASSWORD" -FONT 9, "MS Shell Dlg", 400, 0, 0x80 -BEGIN - ICON ICO_KEY,IDC_STATIC,7,5,20,18 - LTEXT "@S_TITLE",S_TITLE,29,5,241,32 - GROUPBOX "@STATIC1",IDC_STATIC,26,40,222,89 - CONTROL "@R_USE_PASSWORD",R_USE_PASSWORD,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,36,54,190,9 - CONTROL "@R_REMOTE_ONLY",R_REMOTE_ONLY,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,36,69,190,9 - RTEXT "@IDC_STATIC1",IDC_STATIC1,33,89,49,9 - EDITTEXT E_PASSWORD,87,87,141,11,ES_PASSWORD | ES_AUTOHSCROLL - RTEXT "@IDC_STATIC2",IDC_STATIC2,33,106,49,9 - EDITTEXT E_PASSWORD2,87,104,141,11,ES_PASSWORD | ES_AUTOHSCROLL - DEFPUSHBUTTON "@IDOK",IDOK,158,139,52,14 - PUSHBUTTON "@IDCANCEL",IDCANCEL,218,139,52,14 -END - -D_CM_CONFIG DIALOGEX 0, 0, 303, 341 -STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU -CAPTION "@D_CM_CONFIG" -FONT 9, "MS Shell Dlg", 400, 0, 0x80 -BEGIN - ICON ICO_MACHINE,IDC_STATIC,7,5,20,18 - LTEXT "@STATIC1",IDC_STATIC,32,5,263,17 - GROUPBOX "@STATIC2",IDC_STATIC,7,34,288,81 - ICON ICO_VPN,IDC_STATIC,14,46,20,18 - LTEXT "@STATIC3",IDC_STATIC,41,47,246,15 - CONTROL "@R_ALLOW_REMOTE_CONFIG",R_ALLOW_REMOTE_CONFIG,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,41,69,232,11 - LTEXT "@S_WARNING",S_WARNING,41,80,246,33 - GROUPBOX "@STATIC7",IDC_STATIC,7,120,288,139 - ICON ICO_INTERNET,IDC_STATIC,14,132,20,18 - LTEXT "@STATIC4",IDC_STATIC,41,133,246,25 - CONTROL "@R_USE_KEEP_CONNECT",R_USE_KEEP_CONNECT,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,41,160,232,11 - RTEXT "@S_HOSTNAME",S_HOSTNAME,16,177,63,9 - EDITTEXT E_HOSTNAME,82,175,139,11,ES_AUTOHSCROLL - RTEXT "@S_PORT",S_PORT,16,194,63,9 - EDITTEXT E_PORT,82,192,36,11,ES_AUTOHSCROLL | ES_NUMBER - RTEXT "@S_INTERVAL",S_INTERVAL,131,194,63,10 - EDITTEXT E_INTERVAL,197,192,36,11,ES_AUTOHSCROLL | ES_NUMBER - LTEXT "@S_INTERVAL2",S_INTERVAL2,239,194,47,9 - RTEXT "@S_PROTOCOL",S_PROTOCOL,16,211,63,9 - CONTROL "@R_TCP",R_TCP,"Button",BS_AUTORADIOBUTTON,85,211,74,9 - CONTROL "@R_UDP",R_UDP,"Button",BS_AUTORADIOBUTTON,171,211,75,9 - LTEXT "@S_INFO",S_INFO,41,227,246,31 - ICON ICO_INFORMATION,S_INFO2,14,222,20,18 - DEFPUSHBUTTON "@IDOK",IDOK,162,320,64,15 - PUSHBUTTON "@IDCANCEL",IDCANCEL,231,320,64,15 - GROUPBOX "@STATIC5",IDC_STATIC,7,266,288,47 - CONTROL "@R_ALPHA",R_ALPHA,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,41,284,105,11 - EDITTEXT E_ALPHA_VALUE,150,283,27,11,ES_AUTOHSCROLL | ES_NUMBER - LTEXT "%",IDC_STATIC,185,285,8,10 - LTEXT "@STATIC6",IDC_STATIC,43,299,243,8 - ICON ICO_SETUP,S_INFO3,14,281,20,18 -END - -D_ABOUT DIALOGEX 0, 0, 333, 309 -STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU -CAPTION "@D_ABOUT" -FONT 9, "MS Shell Dlg", 400, 0, 0x80 -BEGIN - DEFPUSHBUTTON "@IDCANCEL",IDCANCEL,250,290,76,16 - CONTROL 224,S_LOGO,"Static",SS_BITMAP,7,5,319,66 - LTEXT "@S_INFO1",S_INFO1,7,71,240,15 - PUSHBUTTON "@B_AUTHORS",B_AUTHORS,251,71,75,16 - LTEXT "@S_INFO2",S_INFO2,7,86,319,34 - LTEXT "@S_INFO4",S_INFO4,7,122,319,53 - CONTROL "",IDC_STATIC,"Static",SS_ETCHEDHORZ,7,180,319,1 - LTEXT "@S_INFO3",S_INFO3,7,185,319,84 - PUSHBUTTON "@B_EULA",B_EULA,7,269,74,16 - PUSHBUTTON "@B_IMPORTANT",B_IMPORTANT,88,269,74,16 - PUSHBUTTON "@B_LEGAL",B_LEGAL,169,269,74,16 - PUSHBUTTON "Lan&guage Settings",B_LANGUAGE,250,269,75,16 - PUSHBUTTON "@B_WEB",B_WEB,7,290,130,16 - PUSHBUTTON "@B_UPDATE_CONFIG",B_UPDATE_CONFIG,142,290,96,16 -END - -D_REMOTE DIALOGEX 0, 0, 275, 149 -STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU -CAPTION "@D_REMOTE" -FONT 9, "MS Shell Dlg", 400, 0, 0x80 -BEGIN - ICON ICO_TEST,S_ICON,7,5,20,18 - LTEXT "S_TITLE",S_TITLE,31,5,237,55 - GROUPBOX "@STATIC1",-1,26,66,222,53 - CONTROL "@R_LOCAL",R_LOCAL,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,40,78,200,15 - RTEXT "@S_HOSTNAME",S_HOSTNAME,28,98,54,11 - DEFPUSHBUTTON "@IDOK",IDOK,158,130,52,14 - PUSHBUTTON "@IDCANCEL",IDCANCEL,216,130,52,14 - COMBOBOX C_HOSTNAME,86,96,150,91,CBS_DROPDOWN | WS_VSCROLL | WS_TABSTOP -END - -D_CM_DESKTOP DIALOGEX 0, 0, 370, 191 -STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU -CAPTION "@D_CM_DESKTOP" -FONT 9, "MS Shell Dlg", 400, 0, 0x80 -BEGIN - ICON ICO_DISPLAY,IDC_STATIC,7,5,18,18 - LTEXT "@S_TITLE",S_TITLE,31,11,332,23 - LTEXT "@S_WARNING",S_WARNING,31,35,332,20 - LTEXT "",S_MSG_1,31,55,332,27 - LTEXT "",S_MSG_2,31,84,332,28 - LTEXT "",S_MSG_3,31,115,332,38 - LTEXT "@S_INFO",S_INFO,31,156,332,14 - DEFPUSHBUTTON "@IDOK",IDOK,253,172,52,14 - PUSHBUTTON "@IDCANCEL",IDCANCEL,311,172,52,14 -END - -D_CM_CHANGE_PASSWORD DIALOGEX 0, 0, 259, 212 -STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU -EXSTYLE WS_EX_APPWINDOW -CAPTION "@D_CM_CHANGE_PASSWORD" -FONT 9, "MS Shell Dlg", 400, 0, 0x80 -BEGIN - ICON ICO_KEY,IDC_STATIC,7,5,20,18 - LTEXT "@S_TITLE",S_TITLE,31,11,221,25 - GROUPBOX "@STATIC1",IDC_STATIC,21,39,209,127 - RTEXT "@STATIC2",IDC_STATIC,32,55,60,10 - EDITTEXT E_HUBNAME,99,53,108,11,ES_AUTOHSCROLL | WS_DISABLED - RTEXT "@STATIC3",IDC_STATIC,32,74,60,10 - EDITTEXT E_USERNAME,99,72,108,11,ES_AUTOHSCROLL - RTEXT "@STATIC4",IDC_STATIC,32,93,60,10 - EDITTEXT E_OLD_PASSWORD,99,91,108,11,ES_PASSWORD | ES_AUTOHSCROLL - RTEXT "@STATIC5",IDC_STATIC,31,112,60,8 - EDITTEXT E_NEW_PASSWORD1,99,110,108,11,ES_PASSWORD | ES_AUTOHSCROLL - RTEXT "@STATIC6",IDC_STATIC,31,129,60,17 - EDITTEXT E_NEW_PASSWORD2,99,129,108,11,ES_PASSWORD | ES_AUTOHSCROLL - DEFPUSHBUTTON "@IDOK",IDOK,120,191,63,15 - PUSHBUTTON "@IDCANCEL",IDCANCEL,189,191,63,15 - LTEXT "@S_STATIC",S_STATIC,21,170,231,16 -END - -D_SM_MAIN DIALOGEX 0, 0, 275, 309 -STYLE DS_SETFONT | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU -EXSTYLE WS_EX_APPWINDOW -CAPTION "@D_SM_MAIN" -FONT 9, "MS Shell Dlg", 400, 0, 0x80 -BEGIN - CONTROL 141,IDC_STATIC,"Static",SS_BITMAP,0,0,275,46 - GROUPBOX "@STATIC1",IDC_STATIC,6,53,261,187 - ICON ICO_VPNSERVER,IDC_STATIC,14,67,20,20 - LTEXT "@STATIC2",IDC_STATIC,41,67,218,29 - CONTROL "",L_SETTING,"SysListView32",LVS_REPORT | LVS_SHOWSELALWAYS | LVS_SHAREIMAGELISTS | LVS_AUTOARRANGE | LVS_EDITLABELS | WS_BORDER | WS_TABSTOP,15,96,242,96 - PUSHBUTTON "@B_NEW_SETTING",B_NEW_SETTING,15,197,76,14 - PUSHBUTTON "@B_EDIT_SETTING",B_EDIT_SETTING,98,197,76,14 - PUSHBUTTON "@B_DELETE",B_DELETE,181,197,76,14 - PUSHBUTTON "@IDOK",IDOK,181,217,76,17 - ICON ICO_CERT,IDC_STATIC,147,246,20,20 - PUSHBUTTON "@B_CERT_TOOL",B_CERT_TOOL,171,248,86,14 - ICON ICO_SECURE,S_SMARTCARD_ICON,45,266,18,18 - PUSHBUTTON "@B_SECURE_MANAGER",B_SECURE_MANAGER,67,269,96,14 - PUSHBUTTON "@B_SELECT_SECURE",B_SELECT_SECURE,171,269,86,14 - PUSHBUTTON "@B_ABOUT",B_ABOUT,14,288,76,14 - PUSHBUTTON "@IDCANCEL",IDCANCEL,98,288,159,14 -END - -D_SM_EDIT_SETTING DIALOGEX 0, 0, 435, 273 -STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU -CAPTION "@D_SM_EDIT_SETTING" -FONT 9, "MS Shell Dlg", 400, 0, 0x80 -BEGIN - ICON ICO_SERVER_ONLINE,IDC_STATIC,7,5,20,18 - LTEXT "@STATIC1",IDC_STATIC,32,12,396,11 - RTEXT "@STATIC2",IDC_STATIC,7,28,61,10 - EDITTEXT E_ACCOUNT_NAME,72,26,126,11,ES_AUTOHSCROLL - GROUPBOX "@STATIC3",IDC_STATIC,7,43,206,87 - ICON ICO_VPNSERVER,IDC_STATIC,14,55,20,18 - LTEXT "@STATIC4",IDC_STATIC,40,55,166,25 - RTEXT "@STATIC5",IDC_STATIC,14,86,54,11 - EDITTEXT E_HOSTNAME,72,84,126,11,ES_AUTOHSCROLL - CONTROL "@R_LOCALHOST",R_LOCALHOST,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,72,98,122,9 - RTEXT "@STATIC6",IDC_STATIC,14,113,54,11 - COMBOBOX C_PORT,72,110,81,42,CBS_DROPDOWN | WS_VSCROLL | WS_TABSTOP - LTEXT "@STATIC7",IDC_STATIC,159,113,46,10 - GROUPBOX "@STATIC8",IDC_STATIC,7,144,206,103 - ICON ICO_TOWER,IDC_STATIC,14,156,20,18 - LTEXT "@STATIC9",IDC_STATIC,40,156,163,17 - RTEXT "@STATIC10",IDC_STATIC,14,182,54,10 - CONTROL "@R_DIRECT_TCP",R_DIRECT_TCP,"Button",BS_AUTORADIOBUTTON | WS_TABSTOP,72,180,135,10 - CONTROL "@R_HTTPS",R_HTTPS,"Button",BS_AUTORADIOBUTTON,72,191,135,10 - CONTROL "@R_SOCKS",R_SOCKS,"Button",BS_AUTORADIOBUTTON,72,201,135,10 - CONTROL "@R_SOCKS5",R_SOCKS5,"Button",BS_AUTORADIOBUTTON,72,211,135,10 - PUSHBUTTON "@B_PROXY_CONFIG",B_PROXY_CONFIG,74,225,114,15 - GROUPBOX "@STATIC11",IDC_STATIC,222,43,206,193 - ICON ICO_USER_ADMIN,IDC_STATIC,229,55,20,18 - LTEXT "@STATIC12",IDC_STATIC,255,55,165,81 - CONTROL "@R_SERVER_ADMIN",R_SERVER_ADMIN,"Button",BS_AUTORADIOBUTTON,239,138,82,12 - CONTROL "@R_HUB_ADMIN",R_HUB_ADMIN,"Button",BS_AUTORADIOBUTTON,324,138,85,12 - RTEXT "@S_HUBNAME",S_HUBNAME,224,161,61,12 - COMBOBOX C_HUBNAME,288,158,126,78,CBS_DROPDOWN | CBS_SORT | WS_VSCROLL | WS_TABSTOP - ICON ICO_KEY,IDC_STATIC,230,185,20,18 - LTEXT "@STATIC13",IDC_STATIC,251,188,177,16 - RTEXT "@S_PASSWORD",S_PASSWORD,227,208,60,9 - EDITTEXT E_PASSWORD,289,206,126,11,ES_PASSWORD | ES_AUTOHSCROLL - CONTROL "@R_NO_SAVE",R_NO_SAVE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,290,223,127,9 - DEFPUSHBUTTON "@IDOK",IDOK,291,250,64,17 - PUSHBUTTON "@IDCANCEL",IDCANCEL,364,250,64,17 - CONTROL "",IDC_STATIC,"Static",SS_ETCHEDHORZ,233,179,183,1 -END - -D_SM_SERVER DIALOGEX 0, 0, 439, 314 -STYLE DS_SETFONT | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU -CAPTION "@D_SM_SERVER" -FONT 9, "MS Shell Dlg", 400, 0, 0x80 -BEGIN - ICON ICO_VPNSERVER,IDC_STATIC,7,5,20,18 - LTEXT "@S_TITLE",S_TITLE,31,5,322,22 - CONTROL "",L_HUB,"SysListView32",LVS_REPORT | LVS_SHOWSELALWAYS | LVS_SHAREIMAGELISTS | LVS_AUTOARRANGE | WS_BORDER | WS_TABSTOP,14,28,410,96 - DEFPUSHBUTTON "@IDOK",IDOK,14,129,84,16 - PUSHBUTTON "@B_ONLINE",B_ONLINE,101,129,48,16 - PUSHBUTTON "@B_OFFLINE",B_OFFLINE,153,129,47,16 - PUSHBUTTON "@B_HUB_STATUS",B_HUB_STATUS,203,129,54,16 - PUSHBUTTON "@B_CREATE",B_CREATE,261,129,70,16 - PUSHBUTTON "@B_EDIT",B_EDIT,334,129,48,16 - PUSHBUTTON "@B_DELETE",B_DELETE,385,129,39,16 - GROUPBOX "@STATIC1",IDC_STATIC,7,149,176,106 - LTEXT "@STATIC2",IDC_STATIC,14,160,108,9 - CONTROL "",L_LISTENER,"SysListView32",LVS_REPORT | LVS_SHOWSELALWAYS | LVS_SHAREIMAGELISTS | LVS_AUTOARRANGE | WS_BORDER | WS_TABSTOP,14,172,109,48 - PUSHBUTTON "@B_CREATE_LISTENER",B_CREATE_LISTENER,128,172,48,12 - PUSHBUTTON "@B_DELETE_LISTENER",B_DELETE_LISTENER,128,184,48,12 - PUSHBUTTON "@B_START",B_START,128,196,48,12 - PUSHBUTTON "@B_STOP",B_STOP,128,208,48,12 - GROUPBOX "@STATIC3",IDC_STATIC,187,149,245,106 - ICON ICO_KEY,IDC_STATIC,194,161,20,18 - PUSHBUTTON "@B_SSL",B_SSL,218,163,100,16 - ICON ICO_TOWER,IDC_STATIC,194,183,20,18 - PUSHBUTTON "@B_STATUS",B_STATUS,218,185,100,16 - ICON ICO_VPNSERVER,IDC_STATIC,194,205,20,18 - PUSHBUTTON "@B_INFO",B_INFO,218,206,100,21,BS_MULTILINE - ICON ICO_CERT,S_LICENSE,194,231,20,18 - PUSHBUTTON "@B_LICENSE",B_LICENSE,218,233,100,16 - ICON ICO_FARM,IDC_STATIC,323,162,20,18 - PUSHBUTTON "@B_FARM",B_FARM,344,162,81,16,BS_MULTILINE - ICON ICO_INTERNET,IDC_STATIC,323,185,20,18 - PUSHBUTTON "@B_FARM_STATUS",B_FARM_STATUS,344,185,81,16,BS_MULTILINE - ICON ICO_PROTOCOL,IDC_STATIC,323,205,20,18 - PUSHBUTTON "@B_CONNECTION",B_CONNECTION,344,206,81,21,BS_MULTILINE - ICON ICO_MACHINE,IDC_STATIC,323,231,20,18 - PUSHBUTTON "@B_CONFIG",B_CONFIG,344,233,81,16 - ICON ICO_BRIDGE,IDC_STATIC,7,257,20,18 - PUSHBUTTON "@B_BRIDGE",B_BRIDGE,28,260,71,16 - ICON ICO_SWITCH,IDC_STATIC,108,257,20,18 - PUSHBUTTON "@B_L3",B_L3,129,260,74,16 - ICON ICO_IPSEC,IDC_STATIC,206,257,20,18 - PUSHBUTTON "@B_IPSEC",B_IPSEC,227,260,77,16 - ICON ICO_OPENVPN,IDC_STATIC,310,258,20,18 - PUSHBUTTON "@B_OPENVPN",B_OPENVPN,334,260,97,16 - ICON ICO_DISPLAY,IDC_STATIC,7,280,20,18 - PUSHBUTTON "@B_DDNS",B_DDNS,28,281,71,16 - RTEXT "@S_DDNS",S_DDNS,0,303,75,9 - EDITTEXT E_DDNS_HOST,78,301,114,13,ES_AUTOHSCROLL | ES_READONLY | NOT WS_BORDER - CTEXT "@S_BETA",S_BETA,193,234,126,15 - PUSHBUTTON "@B_AZURE",B_AZURE,129,281,74,16 - RTEXT "@S_AZURE",S_AZURE,196,303,65,9 - EDITTEXT E_AZURE_HOST,266,301,126,13,ES_AUTOHSCROLL | ES_READONLY | NOT WS_BORDER - ICON ICO_RESEARCH,S_ICO_VPNGATE,206,280,20,18 - PUSHBUTTON "@B_VPNGATE",B_VPNGATE,227,281,77,16 - PUSHBUTTON "@B_REFRESH",B_REFRESH,307,281,71,16 - PUSHBUTTON "@IDCANCEL",IDCANCEL,381,281,50,16 - ICON ICO_AZURE,IDC_STATIC,108,281,20,18 - EDITTEXT E_UDP,14,224,109,12,ES_AUTOHSCROLL - LTEXT "@S_UDP",S_UDP,14,238,162,16 - PUSHBUTTON "@B_APPLY",B_APPLY,128,224,48,12 -END - -D_SM_STATUS DIALOGEX 0, 0, 335, 250 -STYLE DS_SETFONT | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU -CAPTION "@D_SM_STATUS" -FONT 9, "MS Shell Dlg", 400, 0, 0x80 -BEGIN - ICON ICO_INFORMATION,S_ICON,7,5,18,18 - LTEXT "S_TITLE",S_TITLE,30,5,298,25 - CONTROL "",L_STATUS,"SysListView32",LVS_REPORT | LVS_SHOWSELALWAYS | LVS_SHAREIMAGELISTS | LVS_AUTOARRANGE | WS_BORDER | WS_TABSTOP,7,33,321,188 - DEFPUSHBUTTON "@IDOK",IDOK,177,228,80,16 - PUSHBUTTON "@IDCANCEL",IDCANCEL,265,228,63,16 -END - -D_SM_EDIT_HUB DIALOGEX 0, 0, 431, 285 -STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU -CAPTION "@D_SM_EDIT_HUB" -FONT 9, "MS Shell Dlg", 400, 0, 0x80 -BEGIN - ICON ICO_HUB,IDC_STATIC,7,5,18,18 - RTEXT "@STATIC1",IDC_STATIC,31,15,54,12 - EDITTEXT E_HUBNAME,90,13,115,11,ES_AUTOHSCROLL - GROUPBOX "@STATIC2",IDC_STATIC,7,29,205,75 - ICON ICO_KEY,IDC_STATIC,16,39,18,18 - LTEXT "@S_BOLD",S_BOLD,42,41,151,9 - RTEXT "@STATIC3",IDC_STATIC,38,53,46,10 - EDITTEXT E_PASSWORD1,90,52,114,11,ES_PASSWORD | ES_AUTOHSCROLL - RTEXT "@STATIC4",IDC_STATIC,29,68,56,11 - EDITTEXT E_PASSWORD2,90,66,114,11,ES_PASSWORD | ES_AUTOHSCROLL - CONTROL "@R_NO_ENUM",R_NO_ENUM,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,45,82,161,20 - GROUPBOX "@STATIC7",IDC_STATIC,7,107,205,42 - ICON ICO_HUB_OFFLINE,IDC_STATIC,15,119,18,18 - LTEXT "@STATIC8",IDC_STATIC,42,119,140,12 - CONTROL "@R_ONLINE",R_ONLINE,"Button",BS_AUTORADIOBUTTON | WS_TABSTOP,46,131,56,9 - CONTROL "@R_OFFLINE",R_OFFLINE,"Button",BS_AUTORADIOBUTTON,118,131,62,9 - GROUPBOX "@STATIC5",IDC_STATIC,7,155,205,124 - ICON ICO_MACHINE,IDC_STATIC,16,163,18,18 - CONTROL "@R_LIMIT_MAX_SESSION",R_LIMIT_MAX_SESSION,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,45,163,159,12 - RTEXT "@S_MAX_SESSION_1",S_MAX_SESSION_1,42,177,86,10 - EDITTEXT E_MAX_SESSION,135,175,32,11,ES_RIGHT | ES_AUTOHSCROLL | ES_NUMBER - LTEXT "@S_MAX_SESSION_2",S_MAX_SESSION_2,174,177,29,10 - LTEXT "@STATIC6",IDC_STATIC,42,187,160,23 - CONTROL "",IDC_STATIC,"Static",SS_ETCHEDHORZ,15,220,190,1 - ICON ICO_LINK2,S_AO_4,16,227,18,18 - LTEXT "@STATIC10",S_STATIC,42,228,160,23 - PUSHBUTTON "@B_EXTOPTION",B_EXTOPTION,76,252,128,17 - GROUPBOX "@STATIC9",IDC_STATIC,219,29,205,58 - ICON ICO_FARM,IDC_STATIC,227,41,18,18 - LTEXT "@S_FARM_INFO",S_FARM_INFO,253,41,163,23 - CONTROL "@R_STATIC",R_STATIC,"Button",BS_AUTORADIOBUTTON | WS_TABSTOP,254,66,81,9 - CONTROL "@R_DYNAMIC",R_DYNAMIC,"Button",BS_AUTORADIOBUTTON,337,66,83,9 - GROUPBOX "@S_AO_1",S_AO_1,219,89,205,53 - ICON ICO_USER_ADMIN,S_AO_2,227,100,18,18 - LTEXT "@S_AO_3",S_AO_3,252,100,164,17 - PUSHBUTTON "@B_ADMINOPTION",B_ADMINOPTION,313,119,102,17 - GROUPBOX "@S_ACL_3",S_ACL_3,219,145,205,54 - ICON ICO_INTERNET,S_ACL_2,227,157,18,18 - LTEXT "@S_ACL",S_ACL,252,157,164,16 - PUSHBUTTON "@B_ACL",B_ACL,313,175,102,17 - GROUPBOX "@S_MSG_1",S_MSG_1,219,203,205,54 - ICON ICO_LOG2,S_MSG_4,227,215,18,18 - LTEXT "@S_MSG_2",S_MSG_2,252,215,164,16 - PUSHBUTTON "@B_MSG",B_MSG,313,233,102,17 - DEFPUSHBUTTON "@IDOK",IDOK,291,262,64,17 - PUSHBUTTON "@IDCANCEL",IDCANCEL,360,262,64,17 -END - -D_SM_CREATE_LISTENER DIALOGEX 0, 0, 270, 137 -STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU -CAPTION "@D_SM_CREATE_LISTENER" -FONT 9, "MS Shell Dlg", 400, 0, 0x80 -BEGIN - ICON ICO_PROTOCOL,IDC_STATIC,7,5,20,18 - LTEXT "@STATIC1",IDC_STATIC,33,11,230,31 - LTEXT "@STATIC2",IDC_STATIC,33,72,230,42 - ICON ICO_INFORMATION,IDC_STATIC,7,73,20,18 - RTEXT "@STATIC3",IDC_STATIC,39,51,55,9 - EDITTEXT E_PORT,98,49,35,11,ES_CENTER | ES_AUTOHSCROLL | ES_NUMBER - DEFPUSHBUTTON "@IDOK",IDOK,126,115,64,17 - PUSHBUTTON "@IDCANCEL",IDCANCEL,199,115,64,17 - LTEXT "@STATIC4",IDC_STATIC,137,51,107,8 -END - -D_SM_SSL DIALOGEX 0, 0, 463, 312 -STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU -CAPTION "@D_SM_SSL" -FONT 9, "MS Shell Dlg", 400, 0, 0x80 -BEGIN - LTEXT "@STATIC1",IDC_STATIC,7,5,449,18 - GROUPBOX "@STATIC2",IDC_STATIC,7,23,218,66 - ICON ICO_KEY,IDC_STATIC,14,35,20,18 - LTEXT "@STATIC3",IDC_STATIC,39,36,179,33 - RTEXT "@STATIC4",IDC_STATIC,15,74,84,12 - COMBOBOX C_CIPHER,106,71,110,80,CBS_DROPDOWN | CBS_AUTOHSCROLL | WS_VSCROLL | WS_TABSTOP - GROUPBOX "@STATIC6",IDC_STATIC,7,93,218,107 - ICON ICO_SERVER_CERT,IDC_STATIC,14,106,20,18 - LTEXT "@STATIC7",IDC_STATIC,39,107,178,15 - GROUPBOX "@STATIC10",IDC_STATIC,38,125,179,46 - LTEXT "CERT_INFO",S_CERT_INFO,50,136,162,29 - PUSHBUTTON "@B_REGENERATE",B_REGENERATE,12,175,47,16 - PUSHBUTTON "@B_IMPORT",B_IMPORT,61,175,47,16 - PUSHBUTTON "@B_EXPORT",B_EXPORT,110,175,47,16 - PUSHBUTTON "@B_VIEW",B_VIEW,159,175,56,16 - GROUPBOX "@STATIC12",IDC_STATIC,7,203,218,87 - ICON ICO_LOG2,IDC_STATIC,14,213,20,18 - LTEXT "@STATIC13",IDC_STATIC,35,213,184,24 - COMBOBOX C_SYSLOG,16,240,199,50,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP - RTEXT "@STATIC14",S_01,15,260,84,10 - EDITTEXT E_SYSLOG_HOSTNAME,102,258,113,11,ES_AUTOHSCROLL - RTEXT "@STATIC15",S_02,15,275,84,12 - EDITTEXT E_SYSLOG_PORT,102,274,32,11,ES_CENTER | ES_AUTOHSCROLL | ES_NUMBER - GROUPBOX "@STATIC8",IDC_STATIC,230,23,223,145 - ICON ICO_INTERNET,IDC_STATIC,233,35,20,18 - LTEXT "@STATIC9",IDC_STATIC,256,32,179,42 - CONTROL "@R_USE_KEEP_CONNECT",R_USE_KEEP_CONNECT,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,255,74,172,11 - RTEXT "@S_HOSTNAME",S_HOSTNAME,244,91,50,10 - EDITTEXT E_HOSTNAME,297,89,139,11,ES_AUTOHSCROLL - RTEXT "@S_PORT",S_PORT,246,108,48,10 - EDITTEXT E_PORT,297,107,27,11,ES_AUTOHSCROLL | ES_NUMBER - RTEXT "@S_INTERVAL",S_INTERVAL,326,108,59,10 - EDITTEXT E_INTERVAL,387,107,36,11,ES_AUTOHSCROLL | ES_NUMBER - LTEXT "@S_INTERVAL2",S_INTERVAL2,426,108,21,10 - RTEXT "@S_PROTOCOL",S_PROTOCOL,238,125,48,10 - CONTROL "@R_TCP",R_TCP,"Button",BS_AUTORADIOBUTTON,292,125,72,9 - CONTROL "@R_UDP",R_UDP,"Button",BS_AUTORADIOBUTTON,369,125,76,9 - ICON ICO_INFORMATION,S_INFO2,233,137,20,18 - LTEXT "@S_INFO",S_INFO,256,141,194,23 - GROUPBOX "@STATIC11",IDC_STATIC,230,173,226,53 - LTEXT "@S_INFO4",S_INFO4,237,182,210,17 - ICON ICO_USER_ADMIN,IDC_STATIC,322,201,20,18 - PUSHBUTTON "@B_PASSWORD",B_PASSWORD,347,203,98,16 - GROUPBOX "@S_OVER_FUNCS",IDC_STATIC,230,229,226,55 - LTEXT "@S_INFO5",S_INFO5,236,241,210,23 - ICON ICO_SPECIALLISTENER,IDC_STATIC,322,262,20,18 - PUSHBUTTON "@B_SPECIALLISTENER",B_SPECIALLISTENER,346,263,98,16 - PUSHBUTTON "@B_UPDATE_CONFIG",B_UPDATE_CONFIG,230,290,85,17 - DEFPUSHBUTTON "@IDOK",IDOK,321,290,64,17 - PUSHBUTTON "@IDCANCEL",IDCANCEL,392,290,64,17 -END - -D_SM_SAVE_KEY_PAIR DIALOGEX 0, 0, 295, 298 -STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU -CAPTION "@D_SM_SAVE_KEY_PAIR" -FONT 9, "MS Shell Dlg", 400, 0, 0x80 -BEGIN - LTEXT "@STATIC1",IDC_STATIC,7,5,281,15 - GROUPBOX "@STATIC2",IDC_STATIC,7,23,281,168 - CONTROL "@R_X509_AND_KEY",R_X509_AND_KEY,"Button",BS_AUTORADIOBUTTON,14,33,249,9 - CONTROL "@R_PKCS12",R_PKCS12,"Button",BS_AUTORADIOBUTTON,14,69,249,9 - CONTROL "@R_SECURE",R_SECURE,"Button",BS_AUTORADIOBUTTON,14,108,249,9 - ICON ICO_CERT,IDC_STATIC,26,42,20,18 - LTEXT "@STATIC3",IDC_STATIC,51,43,218,24 - ICON ICO_PKCS12,IDC_STATIC,26,83,20,18 - LTEXT "@STATIC4",IDC_STATIC,51,83,224,24 - ICON ICO_SECURE,IDC_STATIC,26,120,20,18 - LTEXT "@STATIC5",IDC_STATIC,51,123,224,17 - PUSHBUTTON "@B_SELECT",B_SELECT,50,143,110,18 - GROUPBOX "@S_PASS3",S_PASS3,7,194,281,78 - ICON ICO_KEY,IDC_STATIC,14,206,20,18 - LTEXT "@S_PASS4",S_PASS4,39,207,242,18 - CONTROL "@R_USE_PASS",R_USE_PASS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,38,227,144,9 - RTEXT "@S_PASS1",S_PASS1,31,239,56,11 - EDITTEXT E_PASS1,94,239,158,11,ES_PASSWORD | ES_AUTOHSCROLL - RTEXT "@S_PASS2",S_PASS2,31,256,56,11 - EDITTEXT E_PASS2,94,254,158,11,ES_PASSWORD | ES_AUTOHSCROLL - DEFPUSHBUTTON "@IDOK",IDOK,150,275,64,17 - PUSHBUTTON "@IDCANCEL",IDCANCEL,224,275,64,17 - LTEXT "",S_INFO,52,162,227,23 - PUSHBUTTON "@B_SECURE_MANAGER",B_SECURE_MANAGER,169,143,110,18,NOT WS_VISIBLE -END - -D_SM_CONNECTION DIALOGEX 0, 0, 318, 233 -STYLE DS_SETFONT | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU -CAPTION "@D_SM_CONNECTION" -FONT 9, "MS Shell Dlg", 400, 0, 0x80 -BEGIN - ICON ICO_PROTOCOL,IDC_STATIC,7,5,18,18 - LTEXT "@S_TITLE",S_TITLE,32,5,279,18 - CONTROL "",L_LIST,"SysListView32",LVS_REPORT | LVS_SHOWSELALWAYS | LVS_SHAREIMAGELISTS | LVS_AUTOARRANGE | WS_BORDER | WS_TABSTOP,7,31,304,173 - DEFPUSHBUTTON "@IDOK",IDOK,7,211,99,16 - PUSHBUTTON "@B_DISCONNECT",B_DISCONNECT,113,211,49,16 - PUSHBUTTON "@B_REFRESH",B_REFRESH,169,211,82,16 - PUSHBUTTON "@IDCANCEL",IDCANCEL,258,211,51,16 -END - -D_SM_FARM DIALOGEX 0, 0, 259, 332 -STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU -CAPTION "@D_SM_FARM" -FONT 9, "MS Shell Dlg", 400, 0, 0x80 -BEGIN - ICON ICO_FARM,IDC_STATIC,7,5,18,18 - LTEXT "@S_TITLE",S_TITLE,33,5,219,16 - LTEXT "@STATIC1",IDC_STATIC,7,30,245,19 - RTEXT "@STATIC2",IDC_STATIC,7,51,69,9 - LTEXT "--",S_CURRENT,82,49,154,14 - GROUPBOX "@STATIC3",IDC_STATIC,7,65,245,208 - CONTROL "@R_STANDALONE",R_STANDALONE,"Button",BS_AUTORADIOBUTTON,14,73,180,9 - CONTROL "@R_CONTROLLER",R_CONTROLLER,"Button",BS_AUTORADIOBUTTON,14,86,119,9 - CONTROL "@R_MEMBER",R_MEMBER,"Button",BS_AUTORADIOBUTTON,14,100,117,9 - GROUPBOX "@STATIC4",IDC_STATIC,25,131,220,135 - ICON ICO_PROTOCOL,IDC_STATIC,32,143,18,18 - RTEXT "@S_IP_1",S_IP_1,59,144,59,9 - CONTROL "",E_IP,"SysIPAddress32",WS_TABSTOP,122,142,75,12 - LTEXT "@S_IP_2",S_IP_2,74,156,164,25 - RTEXT "@S_PORT_1",S_PORT_1,59,186,59,10 - EDITTEXT E_PORT,122,185,117,11,ES_AUTOHSCROLL - RTEXT "@S_PORT_2",S_PORT_2,62,198,179,10 - RTEXT "@S_CONTROLLER",S_CONTROLLER,55,209,63,18 - EDITTEXT E_CONTROLLER,122,212,85,11,ES_AUTOHSCROLL - RTEXT "@S_CONTROLLER_PORT",S_CONTROLLER_PORT,59,227,59,16 - EDITTEXT E_CONTROLLER_PORT,122,229,39,11,ES_CENTER | ES_AUTOHSCROLL | ES_NUMBER - LTEXT "@S_PORT_3",S_PORT_3,165,232,59,9 - RTEXT "@S_PASSWORD",S_PASSWORD,27,251,92,11 - EDITTEXT E_PASSWORD,122,248,117,11,ES_PASSWORD | ES_AUTOHSCROLL - ICON ICO_WARNING,IDC_STATIC,7,275,18,18 - LTEXT "@STATIC5",IDC_STATIC,32,275,220,32 - DEFPUSHBUTTON "@IDOK",IDOK,115,310,64,17 - PUSHBUTTON "@IDCANCEL",IDCANCEL,188,310,64,17 - RTEXT "@S_1",S_1,14,118,104,9 - EDITTEXT E_WEIGHT,122,116,34,11,ES_CENTER | ES_AUTOHSCROLL | ES_NUMBER - LTEXT "@S_2",S_2,161,118,71,11 - CONTROL "@R_CONTROLLER_ONLY",R_CONTROLLER_ONLY,"Button",BS_AUTOCHECKBOX | BS_MULTILINE | WS_TABSTOP,146,85,98,30 -END - -D_SM_FARM_MEMBER DIALOGEX 0, 0, 415, 227 -STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU -CAPTION "@D_SM_FARM_MEMBER" -FONT 9, "MS Shell Dlg", 400, 0, 0x80 -BEGIN - ICON ICO_FARM,IDC_STATIC,7,5,20,18 - LTEXT "@S_TITLE",S_TITLE,32,5,376,19 - CONTROL "",L_FARM_MEMBER,"SysListView32",LVS_REPORT | LVS_SHOWSELALWAYS | LVS_SHAREIMAGELISTS | LVS_AUTOARRANGE | WS_BORDER | WS_TABSTOP,7,29,401,170 - DEFPUSHBUTTON "@IDOK",IDOK,7,205,122,16 - PUSHBUTTON "@B_REFRESH",B_REFRESH,268,205,82,16 - PUSHBUTTON "@IDCANCEL",IDCANCEL,357,205,51,16 - PUSHBUTTON "@B_CERT",B_CERT,132,205,93,16 -END - -D_SM_CHANGE_PASSWORD DIALOGEX 0, 0, 250, 95 -STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU -CAPTION "@D_SM_CHANGE_PASSWORD" -FONT 9, "MS Shell Dlg", 400, 0, 0x80 -BEGIN - ICON ICO_USER_ADMIN,IDC_STATIC,7,5,20,18 - LTEXT "@S_TITLE",S_TITLE,31,5,212,18 - RTEXT "@STATIC1",IDC_STATIC,7,35,65,10 - EDITTEXT E_PASSWORD1,78,33,130,11,ES_PASSWORD | ES_AUTOHSCROLL - RTEXT "@STATIC2",IDC_STATIC,7,51,65,10 - EDITTEXT E_PASSWORD2,78,49,130,11,ES_PASSWORD | ES_AUTOHSCROLL - DEFPUSHBUTTON "@IDOK",IDOK,106,73,64,17 - PUSHBUTTON "@IDCANCEL",IDCANCEL,179,73,64,17 -END - -D_SM_HUB DIALOGEX 0, 0, 403, 307 -STYLE DS_SETFONT | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU -CAPTION "@D_SM_HUB" -FONT 9, "MS Shell Dlg", 400, 0, 0x80 -BEGIN - LTEXT "@S_TITLE",S_TITLE,7,5,176,17,SS_WORDELLIPSIS - GROUPBOX "@STATIC1",IDC_STATIC,7,24,173,125 - ICON ICO_USER,IDC_STATIC,14,32,20,18 - PUSHBUTTON "@B_USER",B_USER,38,34,104,15 - LTEXT "@S_USER",S_USER,38,52,132,9 - CONTROL "",IDC_STATIC,"Static",SS_ETCHEDHORZ,14,64,156,1 - ICON ICO_GROUP,IDC_STATIC,14,70,20,18 - PUSHBUTTON "@B_GROUP",B_GROUP,38,71,104,15 - LTEXT "@S_GROUP",S_GROUP,38,90,132,11 - CONTROL "",IDC_STATIC,"Static",SS_ETCHEDHORZ,14,102,156,1 - ICON ICO_PASS,IDC_STATIC,14,108,20,18 - PUSHBUTTON "@B_ACCESS",B_ACCESS,38,110,104,15 - LTEXT "@S_ACCESS",S_ACCESS,38,129,132,18 - GROUPBOX "@STATIC2",IDC_STATIC,7,155,173,146 - ICON ICO_HUB,IDC_STATIC,14,165,20,18 - PUSHBUTTON "@B_PROPERTY",B_PROPERTY,38,165,104,15 - LTEXT "@S_PROPERTY",S_PROPERTY,40,182,137,15 - CONTROL "",IDC_STATIC,"Static",SS_ETCHEDHORZ,14,197,156,1 - ICON ICO_TOWER,IDC_STATIC,14,203,20,18 - PUSHBUTTON "@B_RADIUS",B_RADIUS,38,204,104,15 - LTEXT "@S_RADIUS",S_RADIUS,38,222,132,24 - CONTROL "",IDC_STATIC,"Static",SS_ETCHEDHORZ,14,246,156,1 - ICON ICO_CASCADE,IDC_STATIC,14,254,20,18 - PUSHBUTTON "@B_LINK",B_LINK,38,256,104,15 - LTEXT "@S_LINK",S_LINK,38,274,132,23 - GROUPBOX "@STATIC3",IDC_STATIC,188,5,208,144 - CONTROL "",L_STATUS,"SysListView32",LVS_REPORT | LVS_SHOWSELALWAYS | LVS_SHAREIMAGELISTS | LVS_AUTOARRANGE | WS_BORDER | WS_TABSTOP,194,17,191,108 - PUSHBUTTON "@B_REFRESH",B_REFRESH,303,128,82,16 - GROUPBOX "@STATIC4",IDC_STATIC,187,152,209,112 - ICON ICO_LOG2,IDC_STATIC,192,161,20,18 - PUSHBUTTON "@B_LOG",B_LOG,216,161,100,15 - PUSHBUTTON "@B_LOG_FILE",B_LOG_FILE,321,161,63,15 - LTEXT "@S_LOG",S_LOG,216,179,173,10 - CONTROL "",IDC_STATIC,"Static",SS_ETCHEDHORZ,192,189,193,1 - ICON ICO_SERVER_CERT,IDC_STATIC,192,191,20,18 - PUSHBUTTON "@B_CA",B_CA,216,193,100,15 - PUSHBUTTON "@B_CRL",B_CRL,321,193,63,15 - LTEXT "@S_CA",S_CA,216,209,170,15 - CONTROL "",IDC_STATIC,"Static",SS_ETCHEDHORZ,193,223,193,1 - ICON ICO_ROUTER,IDC_STATIC,192,225,20,18 - PUSHBUTTON "@B_SNAT",B_SNAT,215,227,169,15 - LTEXT "@S_SNAT",S_SNAT,215,245,170,16 - GROUPBOX "@STATIC5",IDC_STATIC,187,266,140,35 - ICON ICO_VPN,IDC_STATIC,194,276,20,18 - PUSHBUTTON "@B_SESSION",B_SESSION,221,280,100,15,BS_MULTILINE - PUSHBUTTON "@IDCANCEL",IDCANCEL,336,285,60,16 -END - -D_SM_USER DIALOGEX 0, 0, 454, 240 -STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU -CAPTION "@D_SM_USER" -FONT 9, "MS Shell Dlg", 400, 0, 0x80 -BEGIN - ICON ICO_USER,IDC_STATIC,7,5,20,18 - LTEXT "@S_TITLE",S_TITLE,31,5,416,13 - CONTROL "",L_USER,"SysListView32",LVS_REPORT | LVS_SHOWSELALWAYS | LVS_SHAREIMAGELISTS | LVS_AUTOARRANGE | WS_BORDER | WS_TABSTOP,7,27,440,187 - DEFPUSHBUTTON "@IDOK",IDOK,83,220,65,15 - PUSHBUTTON "@B_CREATE",B_CREATE,13,220,65,15 - PUSHBUTTON "@B_DELETE",B_DELETE,226,220,65,15 - PUSHBUTTON "@B_REFRESH",B_REFRESH,297,220,81,15 - PUSHBUTTON "@IDCANCEL",IDCANCEL,382,220,65,15 - PUSHBUTTON "@B_STATUS",B_STATUS,153,220,68,15 -END - -D_SM_EDIT_USER DIALOGEX 0, 0, 455, 301 -STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU -CAPTION "@D_SM_EDIT_USER" -FONT 9, "MS Shell Dlg", 400, 0, 0x80 -BEGIN - ICON ICO_USER,IDC_STATIC,7,5,20,18 - RTEXT "@IDC_STATIC1",IDC_STATIC1,31,13,44,9 - EDITTEXT E_USERNAME,80,11,154,11,ES_AUTOHSCROLL - RTEXT "@IDC_STATIC3",IDC_STATIC3,7,29,68,9 - EDITTEXT E_REALNAME,80,28,154,11,ES_AUTOHSCROLL - RTEXT "@IDC_STATIC4",IDC_STATIC4,7,47,68,8 - EDITTEXT E_NOTE,80,45,154,11,ES_AUTOHSCROLL - CONTROL "",IDC_STATIC,"Static",SS_ETCHEDHORZ,7,60,226,1 - ICON ICO_GROUP,IDC_STATIC,7,67,20,18 - RTEXT "@IDC_STATIC5",IDC_STATIC5,31,70,44,21 - EDITTEXT E_GROUP,80,71,80,11,ES_AUTOHSCROLL - PUSHBUTTON "@B_GROUP",B_GROUP,164,68,70,16 - ICON ICO_DATETIME,IDC_STATIC,7,89,20,18 - CONTROL "@R_EXPIRES",R_EXPIRES,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,37,90,161,9 - CONTROL "",E_EXPIRES_DATE,"SysDateTimePick32",DTS_RIGHTALIGN | WS_TABSTOP,48,103,75,13 - CONTROL "",E_EXPIRES_TIME,"SysDateTimePick32",DTS_RIGHTALIGN | DTS_UPDOWN | WS_TABSTOP,131,103,67,13 - CONTROL "",IDC_STATIC,"Static",SS_ETCHEDHORZ,7,122,227,1 - RTEXT "@IDC_STATIC6",IDC_STATIC6,7,129,68,10 - CONTROL "",L_AUTH,"SysListView32",LVS_REPORT | LVS_SINGLESEL | LVS_SHOWSELALWAYS | LVS_SHAREIMAGELISTS | LVS_AUTOARRANGE | LVS_NOCOLUMNHEADER | LVS_NOSORTHEADER | WS_BORDER | WS_TABSTOP,80,128,120,66 - GROUPBOX "@S_RADIUS_3",S_RADIUS_3,7,198,229,75 - ICON ICO_TOWER,IDC_STATIC,14,209,20,18 - LTEXT "@S_RADIUS_1",S_RADIUS_1,35,210,195,24 - CONTROL "@R_SET_RADIUS_USERNAME",R_SET_RADIUS_USERNAME,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,26,236,184,9 - RTEXT "@S_RADIUS_2",S_RADIUS_2,11,250,113,12 - EDITTEXT E_RADIUS_USERNAME,127,248,101,11,ES_AUTOHSCROLL - GROUPBOX "@S_POLICY_1",S_POLICY_1,242,5,206,35 - ICON ICO_MACHINE,IDC_STATIC,249,16,20,18 - CONTROL "@R_POLICY",R_POLICY,"Button",BS_AUTOCHECKBOX | BS_MULTILINE | WS_TABSTOP,281,16,83,18 - PUSHBUTTON "@B_POLICY",B_POLICY,367,17,73,16 - GROUPBOX "@S_PASSWORD_1",S_PASSWORD_1,242,47,206,46 - ICON ICO_KEY,IDC_STATIC,249,59,20,18 - RTEXT "@S_PASSWORD_2",S_PASSWORD_2,275,63,70,9 - EDITTEXT E_PASSWORD1,348,61,92,11,ES_PASSWORD | ES_AUTOHSCROLL - RTEXT "@S_PASSWORD_3",S_PASSWORD_3,270,78,75,9 - EDITTEXT E_PASSWORD2,348,77,92,11,ES_PASSWORD | ES_AUTOHSCROLL - GROUPBOX "@S_USER_CERT_1",S_USER_CERT_1,242,97,206,71 - ICON ICO_CERT,IDC_STATIC,249,107,20,18 - LTEXT "S_CERT_INFO\r\nS_CERT_INFO\r\nS_CERT_INFO\r\nS_CERT_INFO",S_CERT_INFO,272,109,176,35 - PUSHBUTTON "@B_LOAD_CERT",B_LOAD_CERT,248,145,57,16 - PUSHBUTTON "@B_VIEW_CERT",B_VIEW_CERT,308,145,58,16 - PUSHBUTTON "@B_CREATE",B_CREATE,369,145,75,16 - GROUPBOX "@S_ROOT_CERT_1",S_ROOT_CERT_1,242,168,206,105 - ICON ICO_SERVER_CERT,IDC_STATIC,249,183,20,18 - LTEXT "@S_ROOT_CERT_2",S_ROOT_CERT_2,272,179,168,27 - CONTROL "@R_CN",R_CN,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,257,205,184,9 - EDITTEXT E_CN,267,217,174,11,ES_AUTOHSCROLL - CONTROL "@R_SERIAL",R_SERIAL,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,257,233,184,9 - EDITTEXT E_SERIAL,267,245,174,11,ES_AUTOHSCROLL - RTEXT "@S_ROOT_CERT_3",S_ROOT_CERT_3,267,259,170,10 - DEFPUSHBUTTON "@IDOK",IDOK,311,279,64,17 - PUSHBUTTON "@IDCANCEL",IDCANCEL,384,279,64,17 - LTEXT "@S_HINT",S_HINT,7,275,299,26 -END - -D_SM_POLICY DIALOGEX 0, 0, 450, 292 -STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU -CAPTION "@D_SM_POLICY" -FONT 9, "MS Shell Dlg", 400, 0, 0x80 -BEGIN - ICON ICO_MACHINE,IDC_STATIC,7,5,20,18 - LTEXT "S_TITLE",S_TITLE,30,5,281,17 - CONTROL "",L_POLICY,"SysListView32",LVS_REPORT | LVS_SINGLESEL | LVS_SHOWSELALWAYS | LVS_SHAREIMAGELISTS | LVS_AUTOARRANGE | LVS_NOSORTHEADER | WS_BORDER | WS_TABSTOP,7,28,257,231 - GROUPBOX "@STATIC1",IDC_STATIC,270,25,173,235 - LTEXT "S_POLICY_TITLE S_POLICY_TITLE S_POLICY_TITLE S_POLICY_TITLE ",S_POLICY_TITLE,278,38,158,26 - CONTROL "",IDC_STATIC,"Static",SS_ETCHEDHORZ,277,68,159,1 - EDITTEXT E_POLICY_DESCRIPTION,277,84,157,48,ES_MULTILINE | ES_AUTOVSCROLL | ES_READONLY | ES_WANTRETURN | WS_VSCROLL - LTEXT "@S_BOLD",S_BOLD,277,73,114,10 - CONTROL "",IDC_STATIC,"Static",SS_ETCHEDHORZ,277,141,158,1 - LTEXT "@S_BOLD2",S_BOLD2,277,148,114,10 - CONTROL "@R_ENABLE",R_ENABLE,"Button",BS_AUTORADIOBUTTON,284,161,149,12 - CONTROL "@R_DISABLE",R_DISABLE,"Button",BS_AUTORADIOBUTTON,284,178,149,12 - CONTROL "@R_DEFINE",R_DEFINE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,284,163,151,10 - EDITTEXT E_VALUE,293,177,74,11,ES_RIGHT | ES_AUTOHSCROLL | ES_NUMBER - LTEXT "S_TANI",S_TANI,371,179,64,11 - LTEXT "S_LIMIT",S_LIMIT,294,194,142,30 - DEFPUSHBUTTON "@IDOK",IDOK,306,269,64,17 - PUSHBUTTON "@IDCANCEL",IDCANCEL,379,269,64,17 -END - -D_SM_GROUP DIALOGEX 0, 0, 334, 241 -STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU -CAPTION "@D_SM_GROUP" -FONT 9, "MS Shell Dlg", 400, 0, 0x80 -BEGIN - ICON ICO_GROUP,IDC_STATIC,7,5,18,18 - LTEXT "@S_TITLE",S_TITLE,31,5,252,16 - CONTROL "",L_GROUP,"SysListView32",LVS_REPORT | LVS_SHOWSELALWAYS | LVS_SHAREIMAGELISTS | LVS_AUTOARRANGE | WS_BORDER | WS_TABSTOP,7,27,320,187 - PUSHBUTTON "@B_CREATE",B_CREATE,8,221,51,15 - DEFPUSHBUTTON "@IDOK",IDOK,64,221,36,15 - PUSHBUTTON "@B_DELETE",B_DELETE,105,221,40,15 - PUSHBUTTON "@B_REFRESH",B_REFRESH,150,221,69,15 - PUSHBUTTON "@B_USER",B_USER,224,221,51,15 - PUSHBUTTON "@IDCANCEL",IDCANCEL,280,221,47,15 -END - -D_SM_EDIT_GROUP DIALOGEX 0, 0, 243, 255 -STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU -CAPTION "@D_SM_EDIT_GROUP" -FONT 9, "MS Shell Dlg", 400, 0, 0x80 -BEGIN - ICON ICO_GROUP,IDC_STATIC,7,5,20,18 - RTEXT "@IDC_STATIC1",IDC_STATIC1,31,13,44,11 - EDITTEXT E_GROUPNAME,80,11,154,11,ES_AUTOHSCROLL - RTEXT "@IDC_STATIC3",IDC_STATIC3,7,29,68,11 - EDITTEXT E_REALNAME,80,28,154,11,ES_AUTOHSCROLL - RTEXT "@IDC_STATIC4",IDC_STATIC4,7,47,68,11 - EDITTEXT E_NOTE,80,45,154,11,ES_AUTOHSCROLL - GROUPBOX "@S_POLICY_1",S_POLICY_1,7,65,229,35 - ICON ICO_MACHINE,IDC_STATIC,14,75,20,18 - CONTROL "@R_POLICY",R_POLICY,"Button",BS_AUTOCHECKBOX | BS_MULTILINE | WS_TABSTOP,40,74,104,18 - PUSHBUTTON "@B_POLICY",B_POLICY,154,77,73,16 - GROUPBOX "@S_POLICY_2",S_POLICY_2,7,105,229,124 - CONTROL "",L_STATUS,"SysListView32",LVS_REPORT | LVS_SHOWSELALWAYS | LVS_SHAREIMAGELISTS | LVS_AUTOARRANGE | LVS_NOSORTHEADER | WS_BORDER | WS_TABSTOP,14,118,213,102 - DEFPUSHBUTTON "@IDOK",IDOK,98,233,64,17 - PUSHBUTTON "@IDCANCEL",IDCANCEL,172,233,64,17 -END - -D_SM_ACCESS_LIST DIALOGEX 0, 0, 451, 275 -STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU -CAPTION "@D_SM_ACCESS_LIST" -FONT 9, "MS Shell Dlg", 400, 0, 0x80 -BEGIN - ICON ICO_PASS,IDC_STATIC,7,5,20,18 - LTEXT "@S_TITLE",S_TITLE,33,5,411,20 - CONTROL "",L_ACCESS_LIST,"SysListView32",LVS_REPORT | LVS_SHOWSELALWAYS | LVS_SHAREIMAGELISTS | LVS_AUTOARRANGE | LVS_NOSORTHEADER | WS_BORDER | WS_TABSTOP,7,29,364,221 - PUSHBUTTON "@B_ADD",B_ADD,376,28,68,16 - PUSHBUTTON "@B_ADD_V6",B_ADD_V6,376,47,68,16 - DEFPUSHBUTTON "@IDOK",IDOK,376,65,68,16 - PUSHBUTTON "@B_DELETE",B_DELETE,376,84,68,16 - PUSHBUTTON "@B_CLONE",B_CLONE,376,118,68,16 - PUSHBUTTON "@B_ENABLE",B_ENABLE,376,152,68,16 - PUSHBUTTON "@B_DISABLE",B_DISABLE,376,171,68,16 - LTEXT "@STATIC1",IDC_STATIC,377,203,67,24 - PUSHBUTTON "@B_SAVE",B_SAVE,376,233,68,16 - PUSHBUTTON "@IDCANCEL",IDCANCEL,376,254,68,16 - ICON ICO_INFORMATION,IDC_STATIC,7,251,20,18 - LTEXT "@STATIC2",IDC_STATIC,28,252,340,18 -END - -D_SM_EDIT_ACCESS DIALOGEX 0, 0, 459, 352 -STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU -CAPTION "@D_SM_EDIT_ACCESS" -FONT 9, "MS Shell Dlg", 400, 0, 0x80 -BEGIN - ICON ICO_PASS,S_ICON,7,5,20,18 - LTEXT "@STATIC1",IDC_STATIC,31,5,421,17 - GROUPBOX "@STATIC2",IDC_STATIC,7,29,217,61 - RTEXT "@STATIC3",IDC_STATIC,14,43,71,10 - EDITTEXT E_NOTE,91,41,115,11,ES_AUTOHSCROLL - RTEXT "@STATIC4",IDC_STATIC,14,59,71,8 - CONTROL "@R_PASS",R_PASS,"Button",BS_AUTORADIOBUTTON,91,54,47,16 - CONTROL "@R_DISCARD",R_DISCARD,"Button",BS_AUTORADIOBUTTON,142,54,51,16 - RTEXT "@STATIC5",IDC_STATIC,14,75,71,9 - EDITTEXT E_PRIORITY,91,73,38,11,ES_CENTER | ES_AUTOHSCROLL | ES_NUMBER - LTEXT "@STATIC6",IDC_STATIC,134,72,73,16 - GROUPBOX "@STATIC11",S_STATIC11,7,92,217,96 - ICON ICO_USER,IDC_STATIC,11,101,20,18 - LTEXT "@STATIC12",S_STATIC12,34,103,177,24 - RTEXT "@STATIC13",S_STATIC13,12,132,73,11 - EDITTEXT E_USERNAME1,89,131,84,11,ES_AUTOHSCROLL - PUSHBUTTON "@B_USER1",B_USER1,179,129,41,16 - RTEXT "@STATIC14",S_STATIC14,13,152,72,11 - EDITTEXT E_USERNAME2,89,150,84,11,ES_AUTOHSCROLL - PUSHBUTTON "@B_USER2",B_USER2,179,149,41,16 - LTEXT "@STATIC15",S_STATIC15,56,167,156,19 - GROUPBOX "@STATIC16",IDC_STATIC,7,191,217,131 - RTEXT "@S_CHECK_SRC_MAC",S_CHECK_SRC_MAC,14,201,71,9 - CONTROL "@R_CHECK_SRC_MAC",R_CHECK_SRC_MAC,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,89,199,121,9 - RTEXT "@S_SRC_MAC",S_SRC_MAC,14,214,108,9 - EDITTEXT E_SRC_MAC,128,212,78,11,ES_AUTOHSCROLL - RTEXT "@S_SRC_MAC_MASK",S_SRC_MAC_MASK,14,228,108,9 - EDITTEXT E_SRC_MAC_MASK,128,227,78,11,ES_AUTOHSCROLL - CONTROL "",IDC_STATIC,"Static",SS_ETCHEDHORZ,18,242,193,1 - RTEXT "@S_CHECK_DST_MAC",S_CHECK_DST_MAC,13,247,71,9 - CONTROL "@R_CHECK_DST_MAC",R_CHECK_DST_MAC,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,89,245,121,9 - RTEXT "@S_DST_MAC",S_DST_MAC,14,260,108,9 - EDITTEXT E_DST_MAC,128,258,78,11,ES_AUTOHSCROLL - RTEXT "@S_DST_MAC_MASK",S_DST_MAC_MASK,14,275,108,9 - EDITTEXT E_DST_MAC_MASK,128,274,78,11,ES_AUTOHSCROLL - LTEXT "@S_MAC_NOTE",S_MAC_NOTE,18,288,197,26 - GROUPBOX "@STATIC7",IDC_STATIC,232,29,220,181 - RTEXT "@S_ACCESS_SRC_ALL",S_ACCESS_SRC_ALL,237,42,71,9 - CONTROL "@R_SRC_ALL",R_SRC_ALL,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,311,41,121,9 - RTEXT "@S_SRC_IP_1",S_SRC_IP_1,237,54,108,9 - CONTROL "",E_SRC_IP,"SysIPAddress32",WS_TABSTOP,349,53,75,12 - RTEXT "@S_SRC_IP_2",S_SRC_IP_2,237,70,108,8 - CONTROL "",E_SRC_MASK,"SysIPAddress32",WS_TABSTOP,349,68,75,12 - RTEXT "@S_SRC_IP_3",S_SRC_IP_3,237,87,195,9 - CONTROL "",IDC_STATIC,"Static",SS_ETCHEDHORZ,238,101,208,1 - RTEXT "@S_ACCESS_DST_ALL",S_ACCESS_DST_ALL,237,109,71,9 - CONTROL "@R_DST_ALL",R_DST_ALL,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,311,107,121,9 - RTEXT "@S_IP_DST_1",S_IP_DST_1,237,121,108,9 - CONTROL "",E_DST_IP,"SysIPAddress32",WS_TABSTOP,349,119,75,12 - RTEXT "@S_IP_DST_2",S_IP_DST_2,237,137,108,9 - CONTROL "",E_DST_MASK,"SysIPAddress32",WS_TABSTOP,349,135,75,12 - RTEXT "@S_IP_DST_3",S_IP_DST_3,237,152,197,10 - CONTROL "",IDC_STATIC,"Static",SS_ETCHEDHORZ,238,167,208,1 - RTEXT "@STATIC9",IDC_STATIC,237,176,71,11 - COMBOBOX C_PROTOCOL,313,174,110,75,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP - RTEXT "@S_PROTOID",S_PROTOID,237,193,71,9 - EDITTEXT E_IP_PROTO,313,191,37,11,ES_CENTER | ES_AUTOHSCROLL | ES_NUMBER - GROUPBOX "@STATIC10",IDC_STATIC,232,211,220,111 - LTEXT "@S_TCP_1",S_TCP_1,318,221,31,9 - LTEXT "@S_TCP_2",S_TCP_2,370,221,31,9 - RTEXT "@S_TCP_3",S_TCP_3,234,233,71,9 - EDITTEXT E_SRC_PORT_1,311,232,38,11,ES_CENTER | ES_AUTOHSCROLL | ES_NUMBER - LTEXT "-",S_TCP_4,356,233,8,7 - EDITTEXT E_SRC_PORT_2,365,232,38,11,ES_CENTER | ES_AUTOHSCROLL | ES_NUMBER - RTEXT "@S_TCP_5",S_TCP_5,234,249,71,9 - EDITTEXT E_DST_PORT_1,311,247,38,11,ES_CENTER | ES_AUTOHSCROLL | ES_NUMBER - LTEXT "-",S_TCP_6,356,249,8,7 - EDITTEXT E_DST_PORT_2,365,247,38,11,ES_CENTER | ES_AUTOHSCROLL | ES_NUMBER - LTEXT "@S_TCP_7",S_TCP_7,240,263,204,22 - CONTROL "",IDC_STATIC,"Static",SS_ETCHEDHORZ,238,291,208,1 - CONTROL "@R_CHECK_TCP_STATE",R_CHECK_TCP_STATE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,254,296,158,9 - CONTROL "@R_ESTABLISHED",R_ESTABLISHED,"Button",BS_AUTORADIOBUTTON | WS_TABSTOP,268,308,71,9 - CONTROL "@R_UNESTABLISHED",R_UNESTABLISHED,"Button",BS_AUTORADIOBUTTON,351,308,80,9 - CONTROL "@R_REDIRECT",R_REDIRECT,"Button",BS_AUTOCHECKBOX | BS_MULTILINE | WS_TABSTOP,7,328,113,18 - PUSHBUTTON "@B_REDIRECT",B_REDIRECT,122,329,78,17 - PUSHBUTTON "@B_SIMULATION",B_SIMULATION,207,329,103,17 - DEFPUSHBUTTON "@IDOK",IDOK,320,329,64,17 - PUSHBUTTON "@IDCANCEL",IDCANCEL,388,329,64,17 -END - -D_SM_RADIUS DIALOGEX 0, 0, 283, 277 -STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU -CAPTION "@D_SM_RADIUS" -FONT 9, "MS Shell Dlg", 400, 0, 0x80 -BEGIN - ICON ICO_TOWER,IDC_STATIC,7,5,18,18 - LTEXT "@S_TITLE",S_TITLE,30,5,236,25 - GROUPBOX "@STATIC1",IDC_STATIC,7,39,269,172 - CONTROL "@R_USE_RADIUS",R_USE_RADIUS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,14,52,255,12 - RTEXT "@S_RADIUS_1",S_RADIUS_1,14,69,95,16 - EDITTEXT E_HOSTNAME,115,71,154,11,ES_AUTOHSCROLL - RTEXT "@S_RADIUS_2",S_RADIUS_2,14,101,95,12 - EDITTEXT E_PORT,115,100,41,11,ES_CENTER | ES_AUTOHSCROLL | ES_NUMBER - LTEXT "@S_RADIUS3",S_RADIUS3,162,101,106,12 - RTEXT "@S_RADIUS_4",S_RADIUS_4,14,119,95,10 - EDITTEXT E_SECRET1,115,117,154,11,ES_PASSWORD | ES_AUTOHSCROLL - RTEXT "@S_RADIUS_5",S_RADIUS_5,14,135,95,10 - EDITTEXT E_SECRET2,115,133,154,11,ES_PASSWORD | ES_AUTOHSCROLL - RTEXT "@S_RADIUS_8",S_RADIUS_8,14,150,95,10 - EDITTEXT E_RADIUS_RETRY_INTERVAL,115,149,41,11,ES_CENTER | ES_AUTOHSCROLL | ES_NUMBER - LTEXT "@S_RADIUS_7",S_RADIUS_7,163,151,106,16 - CONTROL "",IDC_STATIC,"Static",SS_ETCHEDHORZ,14,170,255,1 - ICON ICO_INFORMATION,IDC_STATIC,14,175,18,18 - LTEXT "@S_RADIUS_6",S_RADIUS_6,38,175,231,27 - ICON ICO_LINK,IDC_STATIC,14,211,18,18 - LTEXT "@STATIC2",IDC_STATIC,38,215,230,32 - DEFPUSHBUTTON "@IDOK",IDOK,139,255,64,17 - PUSHBUTTON "@IDCANCEL",IDCANCEL,212,255,64,17 - LTEXT "@S_RADIUS_9",S_RADIUS_9,116,84,152,10 -END - -D_SM_LINK DIALOGEX 0, 0, 423, 268 -STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU -CAPTION "@D_SM_LINK" -FONT 9, "MS Shell Dlg", 400, 0, 0x80 -BEGIN - ICON ICO_CASCADE,IDC_STATIC,7,5,20,18 - LTEXT "@STATIC1",IDC_STATIC,29,5,387,17 - GROUPBOX "@STATIC2",IDC_STATIC,26,24,357,42 - ICON ICO_WARNING,IDC_STATIC,31,35,20,18 - LTEXT "@STATIC3",IDC_STATIC,54,34,324,24 - CONTROL "",L_LINK,"SysListView32",LVS_REPORT | LVS_SHOWSELALWAYS | LVS_SHAREIMAGELISTS | LVS_AUTOARRANGE | LVS_EDITLABELS | WS_BORDER | WS_TABSTOP,7,74,409,165 - PUSHBUTTON "@B_CREATE",B_CREATE,12,247,52,15 - PUSHBUTTON "@B_EDIT",B_EDIT,68,247,40,15 - PUSHBUTTON "@B_ONLINE",B_ONLINE,112,247,44,15 - PUSHBUTTON "@B_OFFLINE",B_OFFLINE,160,247,44,15 - DEFPUSHBUTTON "@IDOK",IDOK,208,247,41,15 - PUSHBUTTON "@B_DELETE",B_DELETE,253,247,41,15 - PUSHBUTTON "@B_RENAME",B_RENAME,298,247,60,15 - PUSHBUTTON "@B_REFRESH",B_REFRESH,398,41,18,15,NOT WS_VISIBLE - PUSHBUTTON "@IDCANCEL",IDCANCEL,373,247,43,15 -END - -D_SM_LOG DIALOGEX 0, 0, 279, 333 -STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU -CAPTION "@D_SM_LOG" -FONT 9, "MS Shell Dlg", 400, 0, 0x80 -BEGIN - ICON ICO_LOG2,IDC_STATIC,7,5,20,18 - LTEXT "@S_TITLE",S_TITLE,30,5,242,24 - GROUPBOX "@STATIC1",IDC_STATIC,7,39,265,50 - ICON ICO_MACHINE,IDC_STATIC,14,50,20,18 - CONTROL "@B_SEC",B_SEC,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,39,51,225,9 - RTEXT "@S_SEC",S_SEC,39,65,98,10 - COMBOBOX C_SEC_SWITCH,142,62,121,76,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP - GROUPBOX "@STATIC2",IDC_STATIC,7,95,265,180 - ICON ICO_NIC_ONLINE,IDC_STATIC,14,107,20,18 - CONTROL "@B_PACKET",B_PACKET,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,39,107,225,9 - RTEXT "@S_PACKET",S_PACKET,39,120,98,10 - COMBOBOX C_PACKET_SWITCH,142,119,121,76,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP - RTEXT "@S_PACKET_0",S_PACKET_0,19,144,58,10 - CONTROL "@B_PACKET_0_0",B_PACKET_0_0,"Button",BS_AUTORADIOBUTTON,82,143,45,9 - CONTROL "@B_PACKET_0_1",B_PACKET_0_1,"Button",BS_AUTORADIOBUTTON,128,143,52,9 - CONTROL "@B_PACKET_0_2",B_PACKET_0_2,"Button",BS_AUTORADIOBUTTON,181,143,78,9 - RTEXT "@S_PACKET_1",S_PACKET_1,19,158,58,10 - CONTROL "@B_PACKET_1_0",B_PACKET_1_0,"Button",BS_AUTORADIOBUTTON,82,157,45,9 - CONTROL "@B_PACKET_1_1",B_PACKET_1_1,"Button",BS_AUTORADIOBUTTON,128,157,52,9 - CONTROL "@B_PACKET_1_2",B_PACKET_1_2,"Button",BS_AUTORADIOBUTTON,181,157,78,9 - RTEXT "@S_PACKET_2",S_PACKET_2,19,173,58,11 - CONTROL "@B_PACKET_2_0",B_PACKET_2_0,"Button",BS_AUTORADIOBUTTON,82,172,45,9 - CONTROL "@B_PACKET_2_1",B_PACKET_2_1,"Button",BS_AUTORADIOBUTTON,128,172,52,9 - CONTROL "@B_PACKET_2_2",B_PACKET_2_2,"Button",BS_AUTORADIOBUTTON,181,172,78,9 - RTEXT "@S_PACKET_3",S_PACKET_3,19,187,58,9 - CONTROL "@B_PACKET_3_0",B_PACKET_3_0,"Button",BS_AUTORADIOBUTTON,82,186,44,9 - CONTROL "@B_PACKET_3_1",B_PACKET_3_1,"Button",BS_AUTORADIOBUTTON,128,186,52,9 - CONTROL "@B_PACKET_3_2",B_PACKET_3_2,"Button",BS_AUTORADIOBUTTON,181,186,78,9 - RTEXT "@S_PACKET_4",S_PACKET_4,19,201,58,10 - CONTROL "@B_PACKET_4_0",B_PACKET_4_0,"Button",BS_AUTORADIOBUTTON,82,201,45,9 - CONTROL "@B_PACKET_4_1",B_PACKET_4_1,"Button",BS_AUTORADIOBUTTON,128,201,52,9 - CONTROL "@B_PACKET_4_2",B_PACKET_4_2,"Button",BS_AUTORADIOBUTTON,181,201,78,9 - RTEXT "@S_PACKET_5",S_PACKET_5,19,215,58,10 - CONTROL "@B_PACKET_5_0",B_PACKET_5_0,"Button",BS_AUTORADIOBUTTON,82,215,45,9 - CONTROL "@B_PACKET_5_1",B_PACKET_5_1,"Button",BS_AUTORADIOBUTTON,128,215,52,9 - CONTROL "@B_PACKET_5_2",B_PACKET_5_2,"Button",BS_AUTORADIOBUTTON,181,215,78,9 - RTEXT "@S_PACKET_6",S_PACKET_6,19,230,58,9 - CONTROL "@B_PACKET_6_0",B_PACKET_6_0,"Button",BS_AUTORADIOBUTTON,82,230,45,9 - CONTROL "@B_PACKET_6_1",B_PACKET_6_1,"Button",BS_AUTORADIOBUTTON,128,230,52,9 - CONTROL "@B_PACKET_6_2",B_PACKET_6_2,"Button",BS_AUTORADIOBUTTON,181,230,78,9 - RTEXT "@S_PACKET_7",S_PACKET_7,19,243,58,17 - CONTROL "@B_PACKET_7_0",B_PACKET_7_0,"Button",BS_AUTORADIOBUTTON,82,244,45,9 - CONTROL "@B_PACKET_7_1",B_PACKET_7_1,"Button",BS_AUTORADIOBUTTON,128,245,53,9 - CONTROL "@B_PACKET_7_2",B_PACKET_7_2,"Button",BS_AUTORADIOBUTTON,181,245,78,9 - DEFPUSHBUTTON "@IDOK",IDOK,135,311,64,17 - PUSHBUTTON "@IDCANCEL",IDCANCEL,208,311,64,17 - ICON ICO_WARNING,IDC_STATIC,7,281,20,18 - LTEXT "@STATIC3",IDC_STATIC,29,280,243,30 -END - -D_SM_CA DIALOGEX 0, 0, 335, 195 -STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU -CAPTION "@D_SM_CA" -FONT 9, "MS Shell Dlg", 400, 0, 0x80 -BEGIN - ICON ICO_SERVER_CERT,IDC_STATIC,7,5,20,18 - LTEXT "@STATIC1",IDC_STATIC,33,5,295,30 - CONTROL "",L_CERT,"SysListView32",LVS_REPORT | LVS_SHOWSELALWAYS | LVS_SHAREIMAGELISTS | WS_BORDER | WS_TABSTOP,7,42,321,124 - PUSHBUTTON "@B_IMPORT",B_IMPORT,81,173,55,15 - DEFPUSHBUTTON "@IDOK",IDOK,203,173,62,15 - PUSHBUTTON "@IDCANCEL",IDCANCEL,273,173,55,15 - PUSHBUTTON "@B_DELETE",B_DELETE,142,173,54,15 -END - -D_SM_SESSION DIALOGEX 0, 0, 453, 310 -STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU -CAPTION "@D_SM_SESSION" -FONT 9, "MS Shell Dlg", 400, 0, 0x80 -BEGIN - ICON ICO_VPN,IDC_STATIC,7,5,18,18 - LTEXT "@S_TITLE",S_TITLE,35,5,411,17 - CONTROL "",L_LIST,"SysListView32",LVS_REPORT | LVS_SHOWSELALWAYS | LVS_SHAREIMAGELISTS | LVS_AUTOARRANGE | WS_BORDER | WS_TABSTOP,7,31,439,191 - GROUPBOX "@STATIC1",IDC_STATIC,7,225,434,37 - DEFPUSHBUTTON "@IDOK",IDOK,13,237,81,16 - PUSHBUTTON "@B_DISCONNECT",B_DISCONNECT,100,237,47,16 - PUSHBUTTON "@B_REFRESH",B_REFRESH,152,237,71,16 - PUSHBUTTON "@B_SESSION_MAC_TABLE",B_SESSION_MAC_TABLE,231,237,99,16 - PUSHBUTTON "@B_SESSION_IP_TABLE",B_SESSION_IP_TABLE,337,237,90,16 - GROUPBOX "@STATIC2",IDC_STATIC,7,267,245,37 - ICON ICO_NIC_ONLINE,IDC_STATIC,14,277,18,18 - PUSHBUTTON "@B_MAC_TABLE",B_MAC_TABLE,39,279,92,16 - ICON ICO_PROTOCOL,IDC_STATIC,133,276,18,18 - PUSHBUTTON "@B_IP_TABLE",B_IP_TABLE,160,279,85,16 - PUSHBUTTON "@IDCANCEL",IDCANCEL,387,288,59,16 - ICON ICO_FARM,S_FARM_INFO_1,260,265,18,18,NOT WS_VISIBLE - LTEXT "@S_FARM_INFO_2",S_FARM_INFO_2,281,264,165,21,NOT WS_VISIBLE -END - -D_SM_MAC DIALOGEX 0, 0, 451, 288 -STYLE DS_SETFONT | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU -CAPTION "@D_SM_MAC" -FONT 9, "MS Shell Dlg", 400, 0, 0x80 -BEGIN - ICON ICO_NIC_ONLINE,IDC_STATIC,7,5,18,18 - LTEXT "@S_TITLE",S_TITLE,35,5,409,18 - CONTROL "",L_TABLE,"SysListView32",LVS_REPORT | LVS_SHOWSELALWAYS | LVS_SHAREIMAGELISTS | LVS_AUTOARRANGE | WS_BORDER | WS_TABSTOP,7,31,437,228 - PUSHBUTTON "@B_DELETE",B_DELETE,201,267,93,16 - PUSHBUTTON "@B_REFRESH",B_REFRESH,301,267,82,16 - PUSHBUTTON "@IDCANCEL",IDCANCEL,393,267,51,16 -END - -D_SM_IP DIALOGEX 0, 0, 451, 288 -STYLE DS_SETFONT | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU -CAPTION "@D_SM_IP" -FONT 9, "MS Shell Dlg", 400, 0, 0x80 -BEGIN - ICON ICO_PROTOCOL,IDC_STATIC,7,5,20,18 - LTEXT "@S_TITLE",S_TITLE,35,5,409,18 - CONTROL "",L_TABLE,"SysListView32",LVS_REPORT | LVS_SHOWSELALWAYS | LVS_SHAREIMAGELISTS | LVS_AUTOARRANGE | WS_BORDER | WS_TABSTOP,7,31,437,228 - PUSHBUTTON "@B_DELETE",B_DELETE,201,267,93,16 - PUSHBUTTON "@B_REFRESH",B_REFRESH,301,267,82,16 - PUSHBUTTON "@IDCANCEL",IDCANCEL,393,267,51,16 -END - -D_SM_CREATE_CERT DIALOGEX 0, 0, 301, 317 -STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU -CAPTION "@D_SM_CREATE_CERT" -FONT 9, "MS Shell Dlg", 400, 0, 0x80 -BEGIN - ICON ICO_CERT,IDC_STATIC,7,5,20,18 - LTEXT "@STATIC1",IDC_STATIC,31,5,263,18 - RTEXT "@STATIC2",IDC_STATIC,7,33,69,12 - CONTROL "@R_ROOT_CERT",R_ROOT_CERT,"Button",BS_AUTORADIOBUTTON,81,31,187,9 - CONTROL "@R_SIGNED_CERT",R_SIGNED_CERT,"Button",BS_AUTORADIOBUTTON,81,45,189,9 - RTEXT "@S_LOAD_1",S_LOAD_1,7,64,69,17 - PUSHBUTTON "@B_LOAD",B_LOAD,81,64,102,16 - LTEXT "@S_LOAD_2",S_LOAD_2,81,83,206,31 - CONTROL "",IDC_STATIC,"Static",SS_ETCHEDHORZ,7,117,287,18 - RTEXT "@S_LOAD_3",S_LOAD_3,7,125,69,11 - EDITTEXT E_CN,81,123,205,11,ES_AUTOHSCROLL - RTEXT "@S_LOAD_4",S_LOAD_4,7,139,69,10 - EDITTEXT E_O,81,137,205,11,ES_AUTOHSCROLL - RTEXT "@S_LOAD_5",S_LOAD_5,7,155,69,11 - EDITTEXT E_OU,81,153,205,11,ES_AUTOHSCROLL - RTEXT "@S_LOAD_6",S_LOAD_6,7,171,69,10 - EDITTEXT E_C,81,169,205,11,ES_AUTOHSCROLL - RTEXT "@S_LOAD_7",S_LOAD_7,7,185,69,10 - EDITTEXT E_ST,81,184,205,11,ES_AUTOHSCROLL - RTEXT "@S_LOAD_8",S_LOAD_8,7,201,69,9 - EDITTEXT E_L,81,199,205,11,ES_AUTOHSCROLL - RTEXT "@S_LOAD_11",S_LOAD_11,7,216,69,17 - EDITTEXT E_SERIAL,81,215,205,11,ES_AUTOHSCROLL - CONTROL "",IDC_STATIC,"Static",SS_ETCHEDHORZ,7,233,286,1 - RTEXT "@S_LOAD_9",S_LOAD_9,7,245,69,10 - EDITTEXT E_EXPIRE,81,243,36,11,ES_CENTER | ES_AUTOHSCROLL | ES_NUMBER - LTEXT "@S_LOAD_10",S_LOAD_10,121,245,28,10 - RTEXT "@S_LOAD_12",S_LOAD_12,157,245,51,10 - COMBOBOX C_BITS,210,240,48,113,CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL | WS_TABSTOP - LTEXT "bits",S_LOAD_13,263,245,28,10 - CONTROL "",IDC_STATIC,"Static",SS_ETCHEDHORZ,7,260,285,1 - ICON ICO_INFORMATION,IDC_STATIC,7,268,20,18 - LTEXT "@STATIC3",IDC_STATIC,30,269,264,25 - DEFPUSHBUTTON "@IDOK",IDOK,157,295,64,17 - PUSHBUTTON "@IDCANCEL",IDCANCEL,230,295,64,17 -END - -D_NM_LOGIN DIALOGEX 0, 0, 275, 114 -STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU -CAPTION "@D_NM_LOGIN" -FONT 9, "MS Shell Dlg", 400, 0, 0x80 -BEGIN - ICON ICO_KEY,IDC_STATIC,7,5,20,18 - LTEXT "@S_TITLE",S_TITLE,31,5,237,30 - RTEXT "@STATIC1",IDC_STATIC,33,59,49,11 - EDITTEXT E_PASSWORD,87,58,141,11,ES_PASSWORD | ES_AUTOHSCROLL - GROUPBOX "@STATIC2",IDC_STATIC,26,40,222,43 - DEFPUSHBUTTON "@IDOK",IDOK,158,95,52,14 - PUSHBUTTON "@IDCANCEL",IDCANCEL,216,95,52,14 -END - -D_SPEEDMETER DIALOGEX 0, 0, 319, 252 -STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU -CAPTION "@D_SPEEDMETER" -FONT 9, "MS Shell Dlg", 400, 0, 0x80 -BEGIN - ICON ICO_NIC_ONLINE,IDC_STATIC,7,5,20,18 - LTEXT "@STATIC1",IDC_STATIC,31,11,281,11 - COMBOBOX E_LIST,32,25,215,121,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP - GROUPBOX "@STATIC2",IDC_STATIC,7,47,305,199 - CONTROL "",L_STATUS,"SysListView32",LVS_REPORT | LVS_SHOWSELALWAYS | LVS_SHAREIMAGELISTS | LVS_AUTOARRANGE | LVS_NOSORTHEADER | WS_BORDER | WS_TABSTOP,19,62,276,174 - PUSHBUTTON "@STATIC3",B_REFRESH,254,24,50,14 -END - -D_NM_MAIN DIALOGEX 0, 0, 351, 325 -STYLE DS_SETFONT | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU -CAPTION "@D_NM_MAIN" -FONT 9, "MS Shell Dlg", 400, 0, 0x80 -BEGIN - CONTROL 176,IDC_STATIC,"Static",SS_BITMAP,7,5,338,89 - GROUPBOX "@STATIC1",IDC_STATIC,7,95,337,73 - ICON ICO_VPNSERVER,IDC_STATIC,14,105,20,18 - LTEXT "@STATIC2",IDC_STATIC,38,107,297,18 - PUSHBUTTON "@B_SETTING",B_SETTING,44,126,111,15 - PUSHBUTTON "@B_CONNECT",B_CONNECT,164,126,61,15 - PUSHBUTTON "@B_DISCONNECT",B_DISCONNECT,234,126,61,15 - ICON ICO_INTERNET,IDC_STATIC,15,144,20,18 - LTEXT "",S_STATUS,39,150,298,13,SS_WORDELLIPSIS - GROUPBOX "@STATIC3",IDC_STATIC,7,173,337,54 - ICON ICO_ROUTER,IDC_STATIC,15,184,20,18 - LTEXT "@STATIC4",IDC_STATIC,38,186,297,12 - PUSHBUTTON "@B_OPTION",B_OPTION,113,203,120,15 - GROUPBOX "@STATIC5",IDC_STATIC,7,228,337,72 - ICON ICO_MACHINE,IDC_STATIC,14,238,20,18 - LTEXT "@STATIC6",IDC_STATIC,38,239,297,12 - PUSHBUTTON "@B_NAT",B_NAT,75,255,97,15 - PUSHBUTTON "@B_DHCP",B_DHCP,186,255,97,15 - PUSHBUTTON "@B_STATUS",B_STATUS,75,275,97,15 - PUSHBUTTON "@B_INFO",B_INFO,186,275,97,15 - PUSHBUTTON "@B_PASSWORD",B_PASSWORD,7,305,97,15 - PUSHBUTTON "@B_REFRESH",B_REFRESH,109,305,71,15 - PUSHBUTTON "@B_ABOUT",B_ABOUT,192,305,71,15 - PUSHBUTTON "@IDCANCEL",IDCANCEL,279,305,65,15 -END - -D_NM_OPTION DIALOGEX 0, 0, 419, 278 -STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU -CAPTION "@D_NM_OPTION" -FONT 9, "MS Shell Dlg", 400, 0, 0x80 -BEGIN - ICON ICO_ROUTER,IDC_STATIC,7,5,18,18 - LTEXT "@S_TITLE",S_TITLE,29,9,357,17 - GROUPBOX "@STATIC1",IDC_STATIC,7,34,199,72 - ICON ICO_NIC_ONLINE,IDC_STATIC,14,47,18,18 - RTEXT "@STATIC2",IDC_STATIC,39,51,59,11 - EDITTEXT E_MAC,102,50,81,11,ES_AUTOHSCROLL - RTEXT "@STATIC3",IDC_STATIC,39,69,59,10 - CONTROL "",E_IP,"SysIPAddress32",WS_TABSTOP,102,67,75,12 - RTEXT "@STATIC4",IDC_STATIC,39,87,59,9 - CONTROL "",E_MASK,"SysIPAddress32",WS_TABSTOP,102,85,75,12 - GROUPBOX "@STATIC5",IDC_STATIC,7,111,199,77 - CONTROL "@R_USE_NAT",R_USE_NAT,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,14,125,157,9 - RTEXT "@STATIC6",IDC_STATIC,39,138,59,10 - EDITTEXT E_MTU,102,137,39,11,ES_CENTER | ES_AUTOHSCROLL | ES_NUMBER - LTEXT "@STATIC7",IDC_STATIC,145,138,52,9 - RTEXT "@STATIC8",IDC_STATIC,10,154,88,9 - EDITTEXT E_TCP,102,152,39,11,ES_CENTER | ES_AUTOHSCROLL | ES_NUMBER - LTEXT "@STATIC9",IDC_STATIC,145,154,47,9 - RTEXT "@STATIC10",IDC_STATIC,10,169,88,10 - EDITTEXT E_UDP,102,167,39,11,ES_CENTER | ES_AUTOHSCROLL | ES_NUMBER - LTEXT "@STATIC11",IDC_STATIC,145,169,51,9 - GROUPBOX "@S_1",S_1,7,194,199,62 - ICON ICO_PROTOCOL,IDC_STATIC,14,204,18,18 - LTEXT "@S_2",S_2,40,208,159,18 - PUSHBUTTON "@B_PUSH",B_PUSH,55,230,143,17 - CONTROL "@R_SAVE_LOG",R_SAVE_LOG,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,14,263,190,9 - GROUPBOX "@STATIC12",IDC_STATIC,211,34,201,196 - CONTROL "@R_USE_DHCP",R_USE_DHCP,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,218,47,161,9 - RTEXT "@STATIC13",IDC_STATIC,218,63,84,10 - CONTROL "",E_DHCP_START,"SysIPAddress32",WS_TABSTOP,306,61,75,12 - LTEXT "@STATIC14",IDC_STATIC,384,63,24,10 - CONTROL "",E_DHCP_END,"SysIPAddress32",WS_TABSTOP,306,78,75,12 - LTEXT "@STATIC15",IDC_STATIC,384,80,26,9 - RTEXT "@STATIC16",IDC_STATIC,218,97,84,10 - CONTROL "",E_DHCP_MASK,"SysIPAddress32",WS_TABSTOP,306,95,75,12 - RTEXT "@STATIC17",IDC_STATIC,218,116,84,9 - EDITTEXT E_EXPIRES,306,114,39,11,ES_CENTER | ES_AUTOHSCROLL | ES_NUMBER - LTEXT "@STATIC18",IDC_STATIC,349,116,54,9 - CONTROL "",IDC_STATIC,"Static",SS_ETCHEDHORZ,218,131,185,1 - LTEXT "@STATIC19",IDC_STATIC,218,139,184,12 - RTEXT "@STATIC20",IDC_STATIC,218,155,84,18 - CONTROL "",E_GATEWAY,"SysIPAddress32",WS_TABSTOP,306,156,75,12 - RTEXT "@STATIC21",IDC_STATIC,213,177,89,12 - CONTROL "",E_DNS,"SysIPAddress32",WS_TABSTOP,306,175,75,12 - RTEXT "@STATIC23",IDC_STATIC,213,195,89,12 - CONTROL "",E_DNS2,"SysIPAddress32",WS_TABSTOP,306,193,75,12 - RTEXT "@STATIC22",IDC_STATIC,218,213,84,11 - EDITTEXT E_DOMAIN,306,211,98,11,ES_AUTOHSCROLL - DEFPUSHBUTTON "@IDOK",IDOK,274,256,64,17 - PUSHBUTTON "@IDCANCEL",IDCANCEL,348,256,64,17 -END - -D_NM_NAT DIALOGEX 0, 0, 451, 288 -STYLE DS_SETFONT | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU -CAPTION "@D_NM_NAT" -FONT 9, "MS Shell Dlg", 400, 0, 0x80 -BEGIN - ICON ICO_PROTOCOL,IDC_STATIC,7,5,20,18 - LTEXT "@S_TITLE",S_TITLE,35,5,409,18 - CONTROL "",L_TABLE,"SysListView32",LVS_REPORT | LVS_SHOWSELALWAYS | LVS_SHAREIMAGELISTS | LVS_AUTOARRANGE | WS_BORDER | WS_TABSTOP,7,31,437,228 - PUSHBUTTON "@B_REFRESH",B_REFRESH,301,267,82,16 - PUSHBUTTON "@IDCANCEL",IDCANCEL,393,267,51,16 -END - -D_NM_DHCP DIALOGEX 0, 0, 451, 288 -STYLE DS_SETFONT | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU -CAPTION "@D_NM_DHCP" -FONT 9, "MS Shell Dlg", 400, 0, 0x80 -BEGIN - ICON ICO_INTERNET,IDC_STATIC,7,5,18,18 - LTEXT "@S_TITLE",S_TITLE,35,5,409,18 - CONTROL "",L_TABLE,"SysListView32",LVS_REPORT | LVS_SHOWSELALWAYS | LVS_SHAREIMAGELISTS | LVS_AUTOARRANGE | WS_BORDER | WS_TABSTOP,7,31,437,228 - PUSHBUTTON "@B_REFRESH",B_REFRESH,301,267,82,16 - PUSHBUTTON "@IDCANCEL",IDCANCEL,393,267,51,16 -END - -D_NM_CHANGE_PASSWORD DIALOGEX 0, 0, 250, 95 -STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU -CAPTION "@D_NM_CHANGE_PASSWORD" -FONT 9, "MS Shell Dlg", 400, 0, 0x80 -BEGIN - ICON ICO_USER_ADMIN,IDC_STATIC,7,5,20,18 - LTEXT "@S_TITLE",S_TITLE,31,5,212,25 - RTEXT "@STATIC1",IDC_STATIC,7,35,65,9 - EDITTEXT E_PASSWORD1,78,33,130,11,ES_PASSWORD | ES_AUTOHSCROLL - RTEXT "@STATIC2",IDC_STATIC,7,51,65,9 - EDITTEXT E_PASSWORD2,78,49,130,11,ES_PASSWORD | ES_AUTOHSCROLL - DEFPUSHBUTTON "@IDOK",IDOK,106,73,64,17 - PUSHBUTTON "@IDCANCEL",IDCANCEL,179,73,64,17 -END - -D_SM_SNAT DIALOGEX 0, 0, 355, 272 -STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU -CAPTION "@D_SM_SNAT" -FONT 9, "MS Shell Dlg", 400, 0, 0x80 -BEGIN - ICON ICO_ROUTER,IDC_STATIC,7,5,18,18 - LTEXT "@S_TITLE",S_TITLE,31,5,317,23 - GROUPBOX "@STATIC1",IDC_STATIC,7,31,341,83 - ICON ICO_WARNING,IDC_STATIC,14,45,20,20 - LTEXT "@S_WARNING",S_WARNING,39,45,301,19 - LTEXT "@S_WARNING2",S_WARNING2,39,69,301,39 - GROUPBOX "@STATIC2",IDC_STATIC,7,117,341,66 - LTEXT "@STATIC3",IDC_STATIC,15,129,325,11 - PUSHBUTTON "@B_ENABLE",B_ENABLE,19,143,102,16 - PUSHBUTTON "@B_DISABLE",B_DISABLE,125,143,102,16 - PUSHBUTTON "@B_CONFIG",B_CONFIG,232,143,102,16 - LTEXT "@STATIC4",IDC_STATIC,15,163,325,16 - GROUPBOX "@STATIC5",IDC_STATIC,7,185,341,56 - ICON ICO_INFORMATION,IDC_STATIC,14,197,20,20 - LTEXT "@STATIC6",IDC_STATIC,43,201,230,12 - PUSHBUTTON "@B_NAT",B_NAT,17,218,100,16 - PUSHBUTTON "@B_DHCP",B_DHCP,122,218,100,16 - PUSHBUTTON "@B_STATUS",B_STATUS,226,218,112,16 - CONTROL 179,S_TSUKUBA1,"Static",SS_BITMAP | NOT WS_VISIBLE,644,-7,68,23 - LTEXT "@S_TSUKUBA2",S_TSUKUBA2,78,251,204,16,NOT WS_VISIBLE - PUSHBUTTON "@IDCANCEL",IDCANCEL,288,251,60,16 -END - -D_SM_BRIDGE DIALOGEX 0, 0, 367, 325 -STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU -CAPTION "@D_SM_BRIDGE" -FONT 9, "MS Shell Dlg", 400, 0, 0x80 -BEGIN - ICON ICO_BRIDGE,IDC_STATIC,7,5,20,18 - LTEXT "@STATIC1",IDC_STATIC,33,5,327,37 - CONTROL "",L_LIST,"SysListView32",LVS_REPORT | LVS_SHOWSELALWAYS | LVS_SHAREIMAGELISTS | LVS_AUTOARRANGE | LVS_NOSORTHEADER | WS_BORDER | WS_TABSTOP,7,47,353,85 - PUSHBUTTON "@B_VLAN",B_VLAN,7,136,130,15 - PUSHBUTTON "@B_DELETE",B_DELETE,267,136,93,15 - GROUPBOX "@STATIC2",IDC_STATIC,7,155,353,136 - ICON ICO_HUB,IDC_STATIC,16,167,20,18 - LTEXT "@STATIC3",IDC_STATIC,40,168,310,9 - RTEXT "@STATIC4",IDC_STATIC,40,182,53,9 - COMBOBOX E_HUBNAME,100,180,250,83,CBS_DROPDOWN | CBS_SORT | WS_VSCROLL | WS_TABSTOP - CONTROL "",IDC_STATIC,"Static",SS_ETCHEDHORZ,22,196,328,1 - LTEXT "@STATIC5",S_STATIC5,14,202,54,11 - CONTROL "@R_BRIDGE",R_BRIDGE,"Button",BS_AUTORADIOBUTTON,73,201,274,9 - CONTROL "@R_TAP",R_TAP,"Button",BS_AUTORADIOBUTTON,73,213,275,9 - ICON ICO_NIC_ONLINE,S_ICON,14,225,20,18 - LTEXT "--INFO--",S_INFO,38,224,311,11 - RTEXT "@S_ETH_1",S_ETH_1,38,239,53,10 - COMBOBOX E_NICNAME,100,236,251,83,CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL | WS_TABSTOP - RTEXT "@S_TAP_1",S_TAP_1,14,252,77,9 - EDITTEXT E_TAPNAME,99,251,81,11,ES_AUTOHSCROLL - LTEXT "@S_TAP_2",S_TAP_2,183,253,80,9 - LTEXT "@STATIC6",IDC_STATIC,14,263,236,25 - DEFPUSHBUTTON "@IDOK",IDOK,258,269,91,15 - PUSHBUTTON "@IDCANCEL",IDCANCEL,301,295,59,16 - LTEXT "@STATIC7",IDC_STATIC,7,295,286,24 -END - -D_WIN9X_REBOOT DIALOGEX 0, 0, 239, 89 -STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION -EXSTYLE WS_EX_TOPMOST -CAPTION "@D_WIN9X_REBOOT" -FONT 9, "MS Shell Dlg", 400, 0, 0x80 -BEGIN - ICON ICO_NIC_ONLINE,IDC_STATIC,7,5,20,18 - LTEXT "@STATIC1",IDC_STATIC,32,5,200,45 - CONTROL "",P_PROGRESS,"msctls_progress32",WS_BORDER,7,55,225,11 - CTEXT "-- COUNTER --",S_INFO,7,70,225,13 -END - -D_DEFAULT1 DIALOGEX 0, 0, 186, 77 -STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU -CAPTION "PacketiX VPN" -FONT 9, "MS Shell Dlg", 400, 0, 0x80 -BEGIN -END - -D_EM_MAIN DIALOGEX 0, 0, 335, 180 -STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_MINIMIZEBOX | WS_POPUP | WS_CAPTION | WS_SYSMENU -CAPTION "@D_EM_MAIN" -FONT 9, "MS Shell Dlg", 400, 0, 0x80 -BEGIN - ICON ICO_NIC_ONLINE,-1,7,5,20,18 - LTEXT "@STATIC1",-1,31,5,297,37 - CONTROL "",L_LIST,"SysListView32",LVS_REPORT | LVS_SHOWSELALWAYS | LVS_SHAREIMAGELISTS | LVS_AUTOARRANGE | LVS_NOSORTHEADER | WS_BORDER | WS_TABSTOP,7,47,321,103 - PUSHBUTTON "@B_PASSWORD",B_PASSWORD,7,159,60,16 - PUSHBUTTON "@B_LICENSE",B_LICENSE,72,159,50,16 - PUSHBUTTON "@B_ADD",B_ADD,127,159,47,16 - DEFPUSHBUTTON "@IDOK",IDOK,178,159,47,16 - PUSHBUTTON "@B_DELETE",B_DELETE,229,159,47,16 - PUSHBUTTON "@IDCANCEL",IDCANCEL,281,159,47,16 -END - -D_EM_ADD DIALOGEX 0, 0, 279, 297 -STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU -CAPTION "@D_EM_ADD" -FONT 9, "MS Shell Dlg", 400, 0, 0x80 -BEGIN - GROUPBOX "@STATIC1",-1,7,5,265,51 - ICON ICO_NIC_ONLINE,-1,14,17,20,18 - COMBOBOX C_DEVICE,37,22,226,76,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP - CONTROL "@R_PROMISCUOUS",R_PROMISCUOUS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,38,37,223,11 - GROUPBOX "@STATIC2",-1,7,69,265,172 - ICON ICO_USER_ADMIN,-1,14,80,20,18 - RTEXT "@S_PACKET",S_PACKET,39,86,98,9 - COMBOBOX C_PACKET_SWITCH,142,84,121,76,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP - RTEXT "@S_PACKET_0",S_PACKET_0,14,110,58,11 - CONTROL "@B_PACKET_0_0",B_PACKET_0_0,"Button",BS_AUTORADIOBUTTON,79,108,42,9 - CONTROL "@B_PACKET_0_1",B_PACKET_0_1,"Button",BS_AUTORADIOBUTTON,125,108,57,9 - CONTROL "@B_PACKET_0_2",B_PACKET_0_2,"Button",BS_AUTORADIOBUTTON,187,108,66,9 - RTEXT "@S_PACKET_1",S_PACKET_1,14,125,58,10 - CONTROL "@B_PACKET_1_0",B_PACKET_1_0,"Button",BS_AUTORADIOBUTTON,79,124,42,9 - CONTROL "@B_PACKET_1_1",B_PACKET_1_1,"Button",BS_AUTORADIOBUTTON,125,124,57,9 - CONTROL "@B_PACKET_1_2",B_PACKET_1_2,"Button",BS_AUTORADIOBUTTON,187,124,66,9 - RTEXT "@S_PACKET_2",S_PACKET_2,14,141,58,11 - CONTROL "@B_PACKET_2_0",B_PACKET_2_0,"Button",BS_AUTORADIOBUTTON,79,139,42,9 - CONTROL "@B_PACKET_2_1",B_PACKET_2_1,"Button",BS_AUTORADIOBUTTON,125,139,57,9 - CONTROL "@B_PACKET_2_2",B_PACKET_2_2,"Button",BS_AUTORADIOBUTTON,187,139,66,9 - RTEXT "@S_PACKET_3",S_PACKET_3,14,155,58,10 - CONTROL "@B_PACKET_3_0",B_PACKET_3_0,"Button",BS_AUTORADIOBUTTON,79,153,42,9 - CONTROL "@B_PACKET_3_1",B_PACKET_3_1,"Button",BS_AUTORADIOBUTTON,125,153,57,9 - CONTROL "@B_PACKET_3_2",B_PACKET_3_2,"Button",BS_AUTORADIOBUTTON,187,153,66,9 - RTEXT "@S_PACKET_4",S_PACKET_4,14,170,58,9 - CONTROL "@B_PACKET_4_0",B_PACKET_4_0,"Button",BS_AUTORADIOBUTTON,79,168,42,9 - CONTROL "@B_PACKET_4_1",B_PACKET_4_1,"Button",BS_AUTORADIOBUTTON,125,168,57,9 - CONTROL "@B_PACKET_4_2",B_PACKET_4_2,"Button",BS_AUTORADIOBUTTON,187,168,66,9 - RTEXT "@S_PACKET_5",S_PACKET_5,14,185,58,11 - CONTROL "@B_PACKET_5_0",B_PACKET_5_0,"Button",BS_AUTORADIOBUTTON,79,184,42,9 - CONTROL "@B_PACKET_5_1",B_PACKET_5_1,"Button",BS_AUTORADIOBUTTON,125,184,57,9 - CONTROL "@B_PACKET_5_2",B_PACKET_5_2,"Button",BS_AUTORADIOBUTTON,187,184,66,9 - RTEXT "@S_PACKET_6",S_PACKET_6,14,197,58,9 - CONTROL "@B_PACKET_6_0",B_PACKET_6_0,"Button",BS_AUTORADIOBUTTON,79,197,42,9 - CONTROL "@B_PACKET_6_1",B_PACKET_6_1,"Button",BS_AUTORADIOBUTTON,125,197,57,9 - CONTROL "@B_PACKET_6_2",B_PACKET_6_2,"Button",BS_AUTORADIOBUTTON,187,197,66,9 - RTEXT "@S_PACKET_7",S_PACKET_7,14,211,58,17 - CONTROL "@B_PACKET_7_0",B_PACKET_7_0,"Button",BS_AUTORADIOBUTTON,79,213,42,9 - CONTROL "@B_PACKET_7_1",B_PACKET_7_1,"Button",BS_AUTORADIOBUTTON,125,213,57,9 - CONTROL "@B_PACKET_7_2",B_PACKET_7_2,"Button",BS_AUTORADIOBUTTON,187,213,66,9 - DEFPUSHBUTTON "@IDOK",IDOK,135,275,64,17 - PUSHBUTTON "@IDCANCEL",IDCANCEL,208,275,64,17 - ICON ICO_WARNING,-1,7,246,20,18 - LTEXT "@STATIC3",-1,29,245,243,24 -END - -D_EM_PASSWORD DIALOGEX 0, 0, 250, 95 -STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU -CAPTION "@D_EM_PASSWORD" -FONT 9, "MS Shell Dlg", 400, 0, 0x80 -BEGIN - ICON ICO_KEY,IDC_STATIC,7,5,20,18 - LTEXT "@S_TITLE",S_TITLE,31,5,212,18 - RTEXT "@STATIC1",IDC_STATIC,7,35,65,10 - EDITTEXT E_PASSWORD1,78,33,130,11,ES_PASSWORD | ES_AUTOHSCROLL - RTEXT "@STATIC2",IDC_STATIC,7,51,65,10 - EDITTEXT E_PASSWORD2,78,49,130,11,ES_PASSWORD | ES_AUTOHSCROLL - DEFPUSHBUTTON "@IDOK",IDOK,106,73,64,17 - PUSHBUTTON "@IDCANCEL",IDCANCEL,179,73,64,17 -END - -D_SM_CONFIG DIALOGEX 0, 0, 383, 315 -STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU -CAPTION "@D_SM_CONFIG" -FONT 9, "MS Shell Dlg", 400, 0, 0x80 -BEGIN - ICON ICO_MACHINE,IDC_STATIC,7,5,20,18 - LTEXT "@IDC_INFO",IDC_INFO,36,10,340,21 - EDITTEXT E_CONFIG,7,37,369,221,ES_MULTILINE | ES_READONLY | ES_WANTRETURN | WS_VSCROLL - PUSHBUTTON "@B_FACTORY",B_FACTORY,7,293,112,17 - PUSHBUTTON "@B_EXPORT",B_EXPORT,127,293,74,17 - PUSHBUTTON "@B_IMPORT",B_IMPORT,206,293,112,17 - PUSHBUTTON "@IDCANCEL",IDCANCEL,323,293,53,17 - ICON ICO_WARNING,IDC_STATIC,7,263,20,18 - LTEXT "@STATIC1",IDC_STATIC,30,259,346,33 -END - -D_SM_ADMIN_OPTION DIALOGEX 0, 0, 310, 307 -STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU -CAPTION "@D_SM_ADMIN_OPTION" -FONT 9, "MS Shell Dlg", 400, 0, 0x80 -BEGIN - ICON ICO_USER_ADMIN,S_ICON,7,5,20,18 - LTEXT "@S_INFO",S_INFO,31,12,272,15 - CONTROL "",L_LIST,"SysListView32",LVS_REPORT | LVS_SHOWSELALWAYS | LVS_SHAREIMAGELISTS | LVS_AUTOARRANGE | LVS_NOSORTHEADER | WS_BORDER | WS_TABSTOP,7,31,224,136 - PUSHBUTTON "@B_EDIT",B_EDIT,239,31,64,15 - PUSHBUTTON "@B_ADD",B_ADD,239,95,64,15,NOT WS_VISIBLE - PUSHBUTTON "@B_DELETE",B_DELETE,239,119,64,15,NOT WS_VISIBLE - LTEXT "@S_BOLD",S_BOLD,7,169,223,7 - EDITTEXT E_HELP,7,179,296,38,ES_MULTILINE | ES_AUTOVSCROLL | ES_READONLY | ES_WANTRETURN | WS_VSCROLL - ICON ICO_INFORMATION,IDC_STATIC,7,220,20,18 - LTEXT "@STATIC1",S_STATIC1,31,221,272,16 - LTEXT "@STATIC2",S_STATIC2,31,237,272,48 - DEFPUSHBUTTON "@IDOK",IDOK,182,287,56,15 - PUSHBUTTON "@IDCANCEL",IDCANCEL,247,287,56,15 -END - -D_SM_AO_VALUE DIALOGEX 0, 0, 206, 68 -STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU -CAPTION "@D_SM_AO_VALUE" -FONT 9, "MS Shell Dlg", 400, 0, 0x80 -BEGIN - RTEXT "@STATIC1",IDC_STATIC,7,14,37,10 - COMBOBOX C_NAME,47,12,145,144,CBS_DROPDOWN | CBS_SORT | WS_VSCROLL | WS_TABSTOP - RTEXT "@STATIC2",IDC_STATIC,7,31,37,9 - EDITTEXT E_VALUE,47,29,67,11,ES_AUTOHSCROLL | ES_NUMBER - LTEXT "@STATIC3",IDC_STATIC,118,31,37,12 - DEFPUSHBUTTON "@IDOK",IDOK,80,48,56,14 - PUSHBUTTON "@IDCANCEL",IDCANCEL,143,48,56,14 -END - -D_SM_L3 DIALOGEX 0, 0, 291, 255 -STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU -CAPTION "@D_SM_L3" -FONT 9, "MS Shell Dlg", 400, 0, 0x80 -BEGIN - ICON ICO_SWITCH,IDC_STATIC,7,5,20,18 - LTEXT "@STATIC1",IDC_STATIC,31,5,253,19 - ICON ICO_WARNING,IDC_STATIC,11,41,20,18 - LTEXT "@STATIC2",IDC_STATIC,35,38,244,50 - GROUPBOX "@STATIC3",IDC_STATIC,7,29,277,61 - LTEXT "@S_BOLD",S_BOLD,7,97,183,11 - CONTROL "",L_LIST,"SysListView32",LVS_REPORT | LVS_SHOWSELALWAYS | LVS_SHAREIMAGELISTS | LVS_AUTOARRANGE | LVS_NOSORTHEADER | WS_BORDER | WS_TABSTOP,7,110,277,97 - PUSHBUTTON "@B_ADD",B_ADD,7,212,48,16 - PUSHBUTTON "@B_START",B_START,64,212,48,16 - PUSHBUTTON "@B_STOP",B_STOP,121,212,48,16 - DEFPUSHBUTTON "@IDOK",IDOK,178,212,48,16 - PUSHBUTTON "@B_DELETE",B_DELETE,235,212,48,16 - PUSHBUTTON "@IDCANCEL",IDCANCEL,226,233,58,16 -END - -D_SM_L3_ADD DIALOGEX 0, 0, 234, 89 -STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU -CAPTION "@D_SM_L3_ADD" -FONT 9, "MS Shell Dlg", 400, 0, 0x80 -BEGIN - ICON ICO_SWITCH,IDC_STATIC,7,5,20,18 - LTEXT "@STATIC1",IDC_STATIC,32,5,195,43 - RTEXT "@STATIC2",IDC_STATIC,7,51,35,11 - EDITTEXT E_NAME,46,49,173,11,ES_AUTOHSCROLL - DEFPUSHBUTTON "@IDOK",IDOK,99,69,61,15 - PUSHBUTTON "@IDCANCEL",IDCANCEL,166,69,61,15 -END - -D_SM_L3_SW DIALOGEX 0, 0, 298, 320 -STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU -CAPTION "@D_SM_L3_SW" -FONT 9, "MS Shell Dlg", 400, 0, 0x80 -BEGIN - ICON ICO_SWITCH_OFFLINE,IDC_STATIC,7,5,20,18 - LTEXT "@STATIC1",IDC_STATIC,31,5,260,18 - LTEXT "@STATIC2",IDC_STATIC,31,23,260,48 - LTEXT "@S_BOLD1",S_BOLD1,7,70,183,11 - CONTROL "",L_IF,"SysListView32",LVS_REPORT | LVS_SHOWSELALWAYS | LVS_SHAREIMAGELISTS | LVS_AUTOARRANGE | LVS_NOSORTHEADER | WS_BORDER | WS_TABSTOP,7,81,284,81 - PUSHBUTTON "@B_ADD_IF",B_ADD_IF,46,167,119,16 - PUSHBUTTON "@B_DEL_IF",B_DEL_IF,170,167,121,16 - LTEXT "@S_BOLD2",S_BOLD2,7,186,183,11 - CONTROL "",L_TABLE,"SysListView32",LVS_REPORT | LVS_SHOWSELALWAYS | LVS_SHAREIMAGELISTS | LVS_AUTOARRANGE | LVS_NOSORTHEADER | WS_BORDER | WS_TABSTOP,7,198,284,76 - PUSHBUTTON "@B_ADD_TABLE",B_ADD_TABLE,46,276,119,16 - PUSHBUTTON "@B_DEL_TABLE",B_DEL_TABLE,170,276,121,16 - PUSHBUTTON "@B_START",B_START,7,299,58,16 - PUSHBUTTON "@B_STOP",B_STOP,72,299,58,16 - PUSHBUTTON "@IDCANCEL",IDCANCEL,233,299,58,16 -END - -D_SM_L3_SW_IF DIALOGEX 0, 0, 259, 247 -STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU -CAPTION "@D_SM_L3_SW_IF" -FONT 9, "MS Shell Dlg", 400, 0, 0x80 -BEGIN - ICON ICO_NIC_ONLINE,IDC_STATIC,7,5,20,18 - LTEXT "@STATIC1",IDC_STATIC,33,5,219,48 - GROUPBOX "@STATIC2",IDC_STATIC,7,58,245,54 - ICON ICO_HUB,IDC_STATIC,12,70,20,18 - LTEXT "@STATIC3",IDC_STATIC,35,71,210,16 - RTEXT "@STATIC4",IDC_STATIC,26,91,53,10 - COMBOBOX E_HUBNAME,86,89,159,129,CBS_DROPDOWN | CBS_SORT | WS_VSCROLL | WS_TABSTOP - GROUPBOX "@STATIC5",IDC_STATIC,7,115,245,102 - ICON ICO_PROTOCOL,IDC_STATIC,12,130,20,18 - LTEXT "@STATIC6",IDC_STATIC,35,125,210,51 - RTEXT "@S_SRC_IP_1",S_SRC_IP_1,31,181,51,10 - CONTROL "",E_IP,"SysIPAddress32",WS_TABSTOP,86,179,75,12 - RTEXT "@S_SRC_IP_2",S_SRC_IP_2,15,197,67,10 - CONTROL "",E_MASK,"SysIPAddress32",WS_TABSTOP,86,195,75,12 - DEFPUSHBUTTON "@IDOK",IDOK,115,225,64,17 - PUSHBUTTON "@IDCANCEL",IDCANCEL,188,225,64,17 -END - -D_SM_L3_SW_TABLE DIALOGEX 0, 0, 259, 224 -STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU -CAPTION "@D_SM_L3_SW_TABLE" -FONT 9, "MS Shell Dlg", 400, 0, 0x80 -BEGIN - ICON ICO_MACHINE,IDC_STATIC,7,5,20,18 - LTEXT "@STATIC1",IDC_STATIC,33,5,219,49 - GROUPBOX "@STATIC2",IDC_STATIC,7,55,245,136 - ICON ICO_PROTOCOL,IDC_STATIC,12,70,20,18 - LTEXT "@STATIC3",IDC_STATIC,35,66,210,52 - RTEXT "@S_SRC_IP_1",S_SRC_IP_1,15,121,67,10 - CONTROL "",E_NETWORK,"SysIPAddress32",WS_TABSTOP,86,119,75,12 - RTEXT "@S_SRC_IP_2",S_SRC_IP_2,15,137,67,9 - CONTROL "",E_MASK,"SysIPAddress32",WS_TABSTOP,86,135,75,12 - RTEXT "@S_SRC_IP_3",S_SRC_IP_3,15,152,67,10 - CONTROL "",E_GATEWAY,"SysIPAddress32",WS_TABSTOP,86,150,75,12 - RTEXT "@S_SRC_IP_4",S_SRC_IP_4,15,167,67,10 - EDITTEXT E_METRIC,86,166,40,12,ES_CENTER | ES_AUTOHSCROLL | ES_NUMBER - LTEXT "@STATIC4",IDC_STATIC,166,141,79,47 - DEFPUSHBUTTON "@IDOK",IDOK,115,202,64,17 - PUSHBUTTON "@IDCANCEL",IDCANCEL,188,202,64,17 -END - -D_CM_SELECT_SECURE DIALOGEX 0, 0, 295, 214 -STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU -CAPTION "@D_CM_SELECT_SECURE" -FONT 9, "MS Shell Dlg", 400, 0, 0x80 -BEGIN - ICON ICO_SECURE,IDC_STATIC,7,5,20,18 - LTEXT "@STATIC1",IDC_STATIC,31,5,257,67 - CONTROL "",L_LIST,"SysListView32",LVS_REPORT | LVS_SHOWSELALWAYS | LVS_SHAREIMAGELISTS | LVS_AUTOARRANGE | LVS_NOSORTHEADER | WS_BORDER | WS_TABSTOP,7,77,281,108 - DEFPUSHBUTTON "@IDOK",IDOK,154,193,64,15 - PUSHBUTTON "@IDCANCEL",IDCANCEL,224,193,64,15 -END - -D_CM_SECURE_MANAGER DIALOGEX 0, 0, 295, 228 -STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU -CAPTION "@D_CM_SECURE_MANAGER" -FONT 9, "MS Shell Dlg", 400, 0, 0x80 -BEGIN - ICON ICO_SECURE,IDC_STATIC,7,5,20,18 - LTEXT "@S_INFO",S_INFO,31,5,257,24 - LTEXT "@B_BOLD",B_BOLD,7,36,141,12 - CONTROL "",L_LIST,"SysListView32",LVS_REPORT | LVS_SHOWSELALWAYS | LVS_SHAREIMAGELISTS | LVS_AUTOARRANGE | LVS_NOSORTHEADER | WS_BORDER | WS_TABSTOP,7,49,187,174 - PUSHBUTTON "@B_REFRESH",B_REFRESH,198,48,90,15 - PUSHBUTTON "@B_IMPORT",B_IMPORT,198,68,90,15 - PUSHBUTTON "@B_EXPORT",B_EXPORT,198,88,90,15 - PUSHBUTTON "@B_DELETE",B_DELETE,198,107,90,15 - PUSHBUTTON "@B_NEW_CERT",B_NEW_CERT,198,127,90,25,BS_MULTILINE - ICON ICO_KEY,IDC_STATIC,199,183,20,18 - PUSHBUTTON "@B_PIN",B_PIN,220,184,68,16 - PUSHBUTTON "@IDCANCEL",IDCANCEL,198,208,90,15 -END - -D_CM_SECURE_TYPE DIALOGEX 0, 0, 195, 107 -STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU -CAPTION "@D_CM_SECURE_TYPE" -FONT 9, "MS Shell Dlg", 400, 0, 0x80 -BEGIN - LTEXT "@STATIC",IDC_STATIC,7,5,149,18 - CONTROL "@R_CERT",R_CERT,"Button",BS_AUTORADIOBUTTON,28,29,46,9 - CONTROL "@R_KEY",R_KEY,"Button",BS_AUTORADIOBUTTON,28,48,45,9 - CONTROL "@R_DATA",R_DATA,"Button",BS_AUTORADIOBUTTON,28,67,61,9 - DEFPUSHBUTTON "@IDOK",IDOK,51,87,64,15 - PUSHBUTTON "@IDCANCEL",IDCANCEL,124,87,64,15 -END - -D_STRING DIALOGEX 0, 0, 266, 104 -STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU -CAPTION "@D_STRING" -FONT 9, "MS Shell Dlg", 400, 0, 0x80 -BEGIN - ICON "",S_ICON,7,5,18,18 - LTEXT "[INFO]",S_INFO,30,5,229,53 - EDITTEXT E_STRING,30,59,221,11,ES_AUTOHSCROLL - DEFPUSHBUTTON "@IDOK",IDOK,144,83,55,15 - PUSHBUTTON "@IDCANCEL",IDCANCEL,204,83,55,15 -END - -D_SM_SELECT_KEYPAIR DIALOGEX 0, 0, 201, 242 -STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU -CAPTION "@D_SM_SELECT_KEYPAIR" -FONT 9, "MS Shell Dlg", 400, 0, 0x80 -BEGIN - ICON ICO_SECURE,-1,7,5,18,18 - LTEXT "@S_INFO",S_INFO,31,5,163,29 - CONTROL "",L_CERT,"SysListView32",LVS_REPORT | LVS_SINGLESEL | LVS_SHOWSELALWAYS | LVS_SHAREIMAGELISTS | LVS_AUTOARRANGE | LVS_NOSORTHEADER | WS_BORDER | WS_TABSTOP,7,47,187,72 - LTEXT "@B_BOLD1",B_BOLD1,7,36,187,10 - DEFPUSHBUTTON "@IDOK",IDOK,61,220,64,17 - PUSHBUTTON "@IDCANCEL",IDCANCEL,130,220,64,17 - CONTROL "",L_KEY,"SysListView32",LVS_REPORT | LVS_SINGLESEL | LVS_SHOWSELALWAYS | LVS_SHAREIMAGELISTS | LVS_AUTOARRANGE | LVS_NOSORTHEADER | WS_BORDER | WS_TABSTOP,7,138,187,72 - LTEXT "@B_BOLD2",B_BOLD2,7,127,187,10 -END - -D_CM_LOAD_X DIALOGEX 0, 0, 239, 179 -STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU -CAPTION "@D_CM_LOAD_X" -FONT 9, "MS Shell Dlg", 400, 0, 0x80 -BEGIN - LTEXT "@STATIC1",IDC_STATIC,7,5,225,13 - CONTROL "@R_FROM_FILE",R_FROM_FILE,"Button",BS_AUTORADIOBUTTON,14,23,133,9 - CONTROL "@R_FROM_SECURE",R_FROM_SECURE,"Button",BS_AUTORADIOBUTTON,14,72,138,9 - ICON ICO_CERT,IDC_STATIC,25,38,20,18 - LTEXT "@S_FILE",S_FILE,50,41,182,23 - ICON ICO_SECURE,IDC_STATIC,25,89,20,18 - LTEXT "@S_CERT",S_CERT,50,90,182,23 - PUSHBUTTON "@B_SELECT",B_SELECT,50,112,110,18 - LTEXT "",S_INFO,45,132,187,23 - DEFPUSHBUTTON "@IDOK",IDOK,122,157,52,16 - PUSHBUTTON "@IDCANCEL",IDCANCEL,180,157,52,16 -END - -D_CM_SECURE_PIN DIALOGEX 0, 0, 263, 189 -STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU -CAPTION "@D_CM_SECURE_PIN" -FONT 9, "MS Shell Dlg", 400, 0, 0x80 -BEGIN - ICON ICO_KEY,IDC_STATIC,7,5,20,18 - LTEXT "@STATIC1",IDC_STATIC,30,5,227,35 - RTEXT "@STATIC2",IDC_STATIC,7,47,70,9 - EDITTEXT E_PIN1,81,45,144,11,ES_PASSWORD | ES_AUTOHSCROLL - RTEXT "@STATIC3",IDC_STATIC,7,64,70,9 - EDITTEXT E_PIN2,81,62,144,11,ES_PASSWORD | ES_AUTOHSCROLL - RTEXT "@STATIC4",IDC_STATIC,7,81,70,9 - EDITTEXT E_PIN3,81,79,144,11,ES_PASSWORD | ES_AUTOHSCROLL - GROUPBOX "@STATIC5",IDC_STATIC,7,101,249,42 - ICON ICO_WARNING,IDC_STATIC,14,113,20,18 - LTEXT "@STATIC6",IDC_STATIC,40,113,208,17 - LTEXT "@STATIC7",IDC_STATIC,7,151,249,9 - DEFPUSHBUTTON "@IDOK",IDOK,123,168,64,15 - PUSHBUTTON "@IDCANCEL",IDCANCEL,192,168,64,15 -END - -D_SM_CRL DIALOGEX 0, 0, 335, 195 -STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU -CAPTION "@D_SM_CRL" -FONT 9, "MS Shell Dlg", 400, 0, 0x80 -BEGIN - ICON ICO_CERT_X,IDC_STATIC,7,5,20,18 - LTEXT "@STATIC1",IDC_STATIC,33,5,295,30 - CONTROL "",L_LIST,"SysListView32",LVS_REPORT | LVS_SHOWSELALWAYS | LVS_SHAREIMAGELISTS | WS_BORDER | WS_TABSTOP,7,42,321,124 - PUSHBUTTON "@B_ADD",B_ADD,85,173,55,15 - DEFPUSHBUTTON "@IDOK",IDOK,209,173,58,15 - PUSHBUTTON "@IDCANCEL",IDCANCEL,273,173,55,15 - PUSHBUTTON "@B_DELETE",B_DELETE,147,173,54,15 -END - -D_SM_EDIT_CRL DIALOGEX 0, 0, 351, 312 -STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU -CAPTION "@D_SM_EDIT_CRL" -FONT 9, "MS Shell Dlg", 400, 0, 0x80 -BEGIN - ICON ICO_CERT_X,IDC_STATIC,7,5,20,18 - LTEXT "@STATIC1",IDC_STATIC,31,5,313,30 - LTEXT "@S_BOLD",S_BOLD,7,37,337,12 - GROUPBOX "@STATIC2",IDC_STATIC,7,49,337,104 - CONTROL "@R_CN",R_CN,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,10,59,76,9 - EDITTEXT E_CN,96,59,241,11,ES_AUTOHSCROLL - CONTROL "@R_O",R_O,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,10,74,60,9 - EDITTEXT E_O,96,73,241,11,ES_AUTOHSCROLL - CONTROL "@R_OU",R_OU,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,10,88,80,9 - EDITTEXT E_OU,96,89,241,11,ES_AUTOHSCROLL - CONTROL "@R_C",R_C,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,10,105,53,9 - EDITTEXT E_C,96,104,241,11,ES_AUTOHSCROLL - CONTROL "@R_ST",R_ST,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,10,120,62,9 - EDITTEXT E_ST,96,119,241,11,ES_AUTOHSCROLL - CONTROL "@R_L",R_L,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,10,137,51,9 - EDITTEXT E_L,96,135,241,11,ES_AUTOHSCROLL - GROUPBOX "@STATIC3",IDC_STATIC,7,156,337,82 - CONTROL "@R_SERI",R_SERI,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,10,168,85,9 - EDITTEXT E_SERI,96,167,241,11,ES_AUTOHSCROLL - CONTROL "@R_MD5_HASH",R_MD5_HASH,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,10,183,125,9 - EDITTEXT E_MD5_HASH,142,180,195,11,ES_AUTOHSCROLL - CONTROL "@R_SHA1_HASH",R_SHA1_HASH,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,10,197,124,9 - EDITTEXT E_SHA1_HASH,142,196,195,11,ES_AUTOHSCROLL - ICON ICO_INFORMATION,IDC_STATIC,15,210,20,18 - LTEXT "@STATIC4",IDC_STATIC,39,212,298,24 - GROUPBOX "@STATIC5",IDC_STATIC,7,242,337,45 - LTEXT "@STATIC6",IDC_STATIC,39,252,216,30 - ICON ICO_CERT,IDC_STATIC,14,252,20,18 - PUSHBUTTON "@B_LOAD",B_LOAD,257,254,79,16 - DEFPUSHBUTTON "@IDOK",IDOK,225,293,56,14 - PUSHBUTTON "@IDCANCEL",IDCANCEL,288,293,56,14 -END - -D_SM_AC_LIST DIALOGEX 0, 0, 309, 197 -STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU -CAPTION "@D_SM_AC_LIST" -FONT 9, "MS Shell Dlg", 400, 0, 0x80 -BEGIN - ICON ICO_INTERNET,IDC_STATIC,7,5,20,18 - LTEXT "@S_TITLE",S_TITLE,33,5,269,23 - CONTROL "",L_LIST,"SysListView32",LVS_REPORT | LVS_SHOWSELALWAYS | LVS_SHAREIMAGELISTS | LVS_AUTOARRANGE | LVS_NOSORTHEADER | WS_BORDER | WS_TABSTOP,7,32,222,136 - PUSHBUTTON "@B_ADD",B_ADD,234,33,68,16 - DEFPUSHBUTTON "@IDOK",IDOK,234,52,68,16 - PUSHBUTTON "@B_DELETE",B_DELETE,234,71,68,16 - PUSHBUTTON "@B_SAVE",B_SAVE,234,152,68,16 - PUSHBUTTON "@IDCANCEL",IDCANCEL,234,175,68,16 - LTEXT "@STATIC1",IDC_STATIC,235,94,67,24 - ICON ICO_INFORMATION,IDC_STATIC,7,173,20,18 - LTEXT "@STATIC2",IDC_STATIC,28,173,205,18 -END - -D_SM_AC DIALOGEX 0, 0, 310, 266 -STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU -CAPTION "@D_SM_AC" -FONT 9, "MS Shell Dlg", 400, 0, 0x80 -BEGIN - ICON ICO_INTERNET,S_ICON,7,5,18,18 - LTEXT "@STATIC1",IDC_STATIC,33,5,270,25 - GROUPBOX "@STATIC2",IDC_STATIC,7,32,296,112 - LTEXT "@STATIC3",IDC_STATIC,14,44,281,11 - CONTROL "IPv&4",R_IPV4,"Button",BS_AUTORADIOBUTTON | WS_TABSTOP,110,58,38,9 - CONTROL "IPv&6",R_IPV6,"Button",BS_AUTORADIOBUTTON,155,58,91,9 - RTEXT "@STATIC9",IDC_STATIC,14,59,87,11 - CONTROL "@R_SINGLE",R_SINGLE,"Button",BS_AUTORADIOBUTTON | WS_TABSTOP,21,74,274,12 - CONTROL "@R_MASKED",R_MASKED,"Button",BS_AUTORADIOBUTTON,21,89,275,12 - RTEXT "@STATIC4",IDC_STATIC,21,107,80,10 - CONTROL "",E_IP,"SysIPAddress32",WS_TABSTOP,110,105,81,12 - RTEXT "@S_MASK",S_MASK,21,125,80,10 - CONTROL "",E_MASK,"SysIPAddress32",WS_TABSTOP,110,123,81,12 - GROUPBOX "@STATIC5",IDC_STATIC,7,155,296,32 - CONTROL "@R_PASS",R_PASS,"Button",BS_AUTORADIOBUTTON | WS_TABSTOP,21,169,87,9 - CONTROL "@R_DENY",R_DENY,"Button",BS_AUTORADIOBUTTON,112,169,91,9 - GROUPBOX "@STATIC6",IDC_STATIC,7,194,296,46 - RTEXT "@STATIC7",IDC_STATIC,16,213,47,10 - EDITTEXT E_PRIORITY,69,211,38,11,ES_CENTER | ES_AUTOHSCROLL | ES_NUMBER - LTEXT "@STATIC8",IDC_STATIC,112,213,181,12 - DEFPUSHBUTTON "@IDOK",IDOK,168,244,64,17 - PUSHBUTTON "@IDCANCEL",IDCANCEL,239,244,64,17 - EDITTEXT E_IPV6,110,105,186,12,ES_AUTOHSCROLL - EDITTEXT E_MASKV6,110,122,186,12,ES_AUTOHSCROLL -END - -D_SM_LOG_FILE DIALOGEX 0, 0, 398, 291 -STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU -CAPTION "@D_SM_LOG_FILE" -FONT 9, "MS Shell Dlg", 400, 0, 0x80 -BEGIN - ICON ICO_LOG2,IDC_STATIC,7,5,18,18 - LTEXT "@STATIC1",IDC_STATIC,26,5,365,32 - CONTROL "",L_LIST,"SysListView32",LVS_REPORT | LVS_SHOWSELALWAYS | LVS_SHAREIMAGELISTS | WS_BORDER | WS_TABSTOP,7,41,384,221 - DEFPUSHBUTTON "@IDOK",IDOK,7,269,80,17 - PUSHBUTTON "@B_REFRESH",B_REFRESH,99,269,80,17 - PUSHBUTTON "@IDCANCEL",IDCANCEL,311,269,80,17 -END - -D_SM_READ_LOG_FILE DIALOGEX 0, 0, 287, 95 -STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU -CAPTION "@D_SM_READ_LOG_FILE" -FONT 9, "MS Shell Dlg", 400, 0, 0x80 -BEGIN - LTEXT "@S_INFO2",S_INFO2,7,5,273,27 - CONTROL "",P_PROGRESS,"msctls_progress32",WS_BORDER | WS_TABSTOP,7,34,273,12 - CTEXT "--",S_INFO,7,52,273,17 - PUSHBUTTON "@IDCANCEL",IDCANCEL,102,73,83,16 -END - -D_SM_SAVE_LOG DIALOGEX 0, 0, 271, 70 -STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU -CAPTION "@D_SM_SAVE_LOG" -FONT 9, "MS Shell Dlg", 400, 0, 0x80 -BEGIN - ICON ICO_LOG2,IDC_STATIC,7,5,18,18 - LTEXT "@S_INFO",S_INFO,27,5,237,31 - DEFPUSHBUTTON "@IDOK",IDOK,58,49,65,15 - PUSHBUTTON "@B_SAVE",B_SAVE,129,49,65,15 - PUSHBUTTON "@IDCANCEL",IDCANCEL,199,49,65,15 -END - -D_TCP DIALOGEX 0, 0, 331, 270 -STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU -CAPTION "@D_TCP" -FONT 9, "MS Shell Dlg", 400, 0, 0x80 -BEGIN - ICON ICO_SETUP,IDC_STATIC,7,5,20,18 - LTEXT "@STATIC1",IDC_STATIC,33,5,269,46 - LTEXT "@STATIC2",IDC_STATIC,33,54,269,30 - GROUPBOX "@STATIC3",IDC_STATIC,33,86,269,130 - ICON ICO_PROTOCOL,IDC_STATIC,40,94,20,18 - LTEXT "@STATIC4",IDC_STATIC,65,95,174,10 - CONTROL "@R_RECV_DISABLE",R_RECV_DISABLE,"Button",BS_AUTORADIOBUTTON,73,105,175,9 - CONTROL "@R_RECV_ENABLE",R_RECV_ENABLE,"Button",BS_AUTORADIOBUTTON,73,118,183,9 - EDITTEXT E_RECV,84,131,48,11,ES_RIGHT | ES_AUTOHSCROLL | ES_NUMBER - LTEXT "@S_RECV",S_RECV,137,132,33,10 - PUSHBUTTON "@B_RECV",B_RECV,177,127,67,15 - CONTROL "",IDC_STATIC,"Static",SS_ETCHEDHORZ,54,151,194,1 - LTEXT "@STATIC5",IDC_STATIC,65,157,115,7 - CONTROL "@R_SEND_DISABLE",R_SEND_DISABLE,"Button",BS_AUTORADIOBUTTON,73,169,166,9 - CONTROL "@R_SEND_ENABLE",R_SEND_ENABLE,"Button",BS_AUTORADIOBUTTON,73,182,172,9 - EDITTEXT E_SEND,84,196,48,11,ES_RIGHT | ES_AUTOHSCROLL | ES_NUMBER - LTEXT "@S_SEND",S_SEND,137,197,33,10 - PUSHBUTTON "@B_SEND",B_SEND,177,192,66,15 - ICON ICO_WARNING,IDC_STATIC,16,221,20,18 - LTEXT "@STATIC6",IDC_STATIC,42,221,270,25 - PUSHBUTTON "@B_DELETE",B_DELETE,7,248,170,17 - DEFPUSHBUTTON "@IDOK",IDOK,188,248,64,17 - PUSHBUTTON "@IDCANCEL",IDCANCEL,260,248,64,17 -END - -D_TCP_MSG DIALOGEX 0, 0, 247, 177 -STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION -CAPTION "@D_TCP_MSG" -FONT 9, "MS Shell Dlg", 400, 0, 0x80 -BEGIN - ICON ICO_SETUP,IDC_STATIC,7,5,18,18 - LTEXT "@STATIC1",IDC_STATIC,31,5,209,43 - ICON ICO_WARNING,IDC_STATIC,7,146,18,18 - LTEXT "@STATIC2",IDC_STATIC,32,146,208,32 - CONTROL "",IDC_STATIC,"Static",SS_ETCHEDHORZ,7,138,233,1 - CONTROL "@R_OPTIMIZE",R_OPTIMIZE,"Button",BS_AUTORADIOBUTTON,31,53,209,14 - CONTROL "@R_MANUAL",R_MANUAL,"Button",BS_AUTORADIOBUTTON,31,72,209,13 - CONTROL "@R_NO",R_NO,"Button",BS_AUTORADIOBUTTON,31,91,209,14 - DEFPUSHBUTTON "@IDOK",IDOK,174,114,66,16 - PUSHBUTTON "@IDOK3",IDOK3,105,114,66,16,WS_DISABLED -END - -D_CM_PKCSEULA DIALOGEX 0, 0, 267, 135 -STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU -CAPTION "@D_CM_PKCSEULA" -FONT 9, "MS Shell Dlg", 400, 0, 0x80 -BEGIN - ICON ICO_INFORMATION,IDC_STATIC,7,5,20,18 - LTEXT "@S_INFO_1",S_INFO_1,32,5,228,24 - LTEXT "@S_INFO_2",S_INFO_2,32,35,228,50 - CONTROL "",IDC_STATIC,"Static",SS_ETCHEDHORZ,31,88,229,1 - LTEXT "@S_INFO_3",S_INFO_3,32,94,228,16 - DEFPUSHBUTTON "@IDOK",IDOK,146,114,55,15 - PUSHBUTTON "@IDCANCEL",IDCANCEL,205,114,55,15 -END - -D_CM_KAKUSHI DIALOGEX 0, 0, 365, 233 -STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_SYSMENU -EXSTYLE WS_EX_TOPMOST | WS_EX_TOOLWINDOW -FONT 9, "MS Shell Dlg", 400, 0, 0x80 -BEGIN - ICON ICO_NIC_ONLINE,IDC_STATIC,19,48,18,18 - LTEXT "STRING HERE !!",S_INFO,56,52,302,114 - CONTROL "",P_PROGRESS,"msctls_progress32",WS_BORDER,7,172,351,14 -END - -D_CM_TRAFFIC DIALOGEX 0, 0, 395, 308 -STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU -CAPTION "@D_CM_TRAFFIC" -FONT 9, "MS Shell Dlg", 400, 0, 0x80 -BEGIN - ICON ICO_SWITCH,IDC_STATIC,7,5,20,18 - LTEXT "@STATIC1",IDC_STATIC,30,5,342,34 - LTEXT "@STATIC2",IDC_STATIC,30,39,342,28 - GROUPBOX "@S_1",S_1,30,63,342,218 - LTEXT "@S_3",S_3,61,73,301,12 - CONTROL "@R_SERVER",R_SERVER,"Button",BS_AUTORADIOBUTTON,109,84,72,9 - CONTROL "@R_CLIENT",R_CLIENT,"Button",BS_AUTORADIOBUTTON,196,84,72,9 - ICON ICO_TOWER,IDC_STATIC,38,72,20,18 - CONTROL "",IDC_STATIC,"Static",SS_ETCHEDHORZ,41,97,319,1 - ICON ICO_PROTOCOL,IDC_STATIC,38,101,20,18 - LTEXT "@S_4",S_4,61,102,301,25 - RTEXT "@S_5",S_5,34,130,117,9 - COMBOBOX C_HOST,157,127,147,104,CBS_DROPDOWN | WS_VSCROLL | WS_TABSTOP - RTEXT "@S_6",S_6,35,145,116,10 - COMBOBOX C_PORT,157,143,40,104,CBS_DROPDOWN | WS_VSCROLL | WS_TABSTOP - LTEXT "@S_7",S_7,202,145,51,9 - LTEXT "@S_8",S_8,61,157,301,12 - GROUPBOX "@S_9",S_9,68,170,287,48 - CONTROL "@R_DOWNLOAD",R_DOWNLOAD,"Button",BS_AUTORADIOBUTTON,75,179,256,9 - CONTROL "@R_UPLOAD",R_UPLOAD,"Button",BS_AUTORADIOBUTTON,75,192,256,9 - CONTROL "@R_FULL",R_FULL,"Button",BS_AUTORADIOBUTTON,75,205,256,9 - GROUPBOX "@S_10",S_10,68,221,287,54 - RTEXT "@S_11",S_11,75,233,168,8 - COMBOBOX C_NUM,246,230,40,95,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP - RTEXT "@S_12",S_12,75,247,168,9 - EDITTEXT E_SPAN,246,245,40,11,ES_AUTOHSCROLL | ES_NUMBER - LTEXT "@S_13",S_13,289,246,58,9 - CONTROL "@R_ETHERNET",R_ETHERNET,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,75,260,165,9 - CONTROL "@R_DOUBLE",R_DOUBLE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,247,260,105,9 - LTEXT "@S_14",S_14,289,232,54,9 - DEFPUSHBUTTON "@IDOK",IDOK,255,287,64,15 - PUSHBUTTON "@IDCANCEL",IDCANCEL,323,287,64,15 - LTEXT "@S_15",S_15,7,281,244,21 -END - -D_CM_TRAFFIC_RUN DIALOGEX 0, 0, 359, 258 -STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU -CAPTION "@D_CM_TRAFFIC_RUN" -FONT 9, "MS Shell Dlg", 400, 0, 0x80 -BEGIN - ICON ICO_SWITCH,IDC_STATIC,7,5,20,18 - LTEXT "@S_INFO",S_INFO,30,5,322,22 - EDITTEXT E_EDIT,7,29,345,178,ES_MULTILINE | ES_AUTOVSCROLL | ES_READONLY | ES_WANTRETURN | WS_VSCROLL - LTEXT "@STATIC1",IDC_STATIC,7,234,274,18 - DEFPUSHBUTTON "@IDCANCEL",IDCANCEL,288,238,64,15 -END - -D_CM_TRAFFIC_RESULT DIALOGEX 0, 0, 330, 195 -STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU -CAPTION "@D_CM_TRAFFIC_RESULT" -FONT 9, "MS Shell Dlg", 400, 0, 0x80 -BEGIN - ICON ICO_SWITCH,IDC_STATIC,7,5,18,18 - LTEXT "@STATIC1",IDC_STATIC,29,5,220,18 - CONTROL "",L_STATUS,"SysListView32",LVS_REPORT | LVS_SHOWSELALWAYS | LVS_SHAREIMAGELISTS | LVS_AUTOARRANGE | WS_BORDER | WS_TABSTOP,7,29,316,141 - DEFPUSHBUTTON "@IDCANCEL",IDCANCEL,259,174,64,15 -END - -D_SM_LICENSE DIALOGEX 0, 0, 427, 314 -STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU -CAPTION "@D_SM_LICENSE" -FONT 9, "MS Shell Dlg", 400, 0, 0x80 -BEGIN - ICON ICO_CERT,IDC_STATIC,7,5,20,18 - LTEXT "@STATIC1",IDC_STATIC,31,5,389,25 - LTEXT "@S_BOLD",S_BOLD,7,33,159,11 - CONTROL "",L_LIST,"SysListView32",LVS_REPORT | LVS_SHOWSELALWAYS | LVS_SHAREIMAGELISTS | LVS_NOSORTHEADER | WS_BORDER | WS_TABSTOP,7,46,413,69 - PUSHBUTTON "@B_OBTAIN",B_OBTAIN,7,120,109,17 - LTEXT "@STATIC2",IDC_STATIC,7,143,141,24 - PUSHBUTTON "@B_ADD",B_ADD,162,120,105,17 - PUSHBUTTON "@B_DEL",B_DEL,273,120,48,17 - DEFPUSHBUTTON "@IDOK",IDOK,327,120,93,17 - LTEXT "@STATIC3",IDC_STATIC,163,143,257,25 - CONTROL "",IDC_STATIC,"Static",SS_ETCHEDHORZ,7,168,411,1 - LTEXT "@S_BOLD2",S_BOLD2,7,173,198,11 - CONTROL "",L_STATUS,"SysListView32",LVS_REPORT | LVS_SHOWSELALWAYS | LVS_SHAREIMAGELISTS | LVS_NOCOLUMNHEADER | WS_BORDER | WS_TABSTOP,7,187,346,121 - PUSHBUTTON "@IDCANCEL",IDCANCEL,360,293,60,16 -END - -D_SM_LICENSE_ADD DIALOGEX 0, 0, 359, 229 -STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU -CAPTION "@D_SM_LICENSE_ADD" -FONT 9, "MS Shell Dlg", 400, 0, 0x80 -BEGIN - ICON ICO_KEY,IDC_STATIC,7,5,20,18 - LTEXT "@S_INFO",S_INFO,33,5,319,23 - LTEXT "@STATIC1",IDC_STATIC,33,23,319,63 - GROUPBOX "@STATIC2",IDC_STATIC,21,86,320,70 - LTEXT "@STATIC3",IDC_STATIC,31,102,301,18 - EDITTEXT B_KEY1,30,124,43,15,ES_UPPERCASE | ES_AUTOHSCROLL - EDITTEXT B_KEY2,83,124,43,15,ES_UPPERCASE | ES_AUTOHSCROLL - EDITTEXT B_KEY3,135,124,43,15,ES_UPPERCASE | ES_AUTOHSCROLL - EDITTEXT B_KEY4,187,124,43,15,ES_UPPERCASE | ES_AUTOHSCROLL - EDITTEXT B_KEY5,239,124,43,15,ES_UPPERCASE | ES_AUTOHSCROLL - EDITTEXT B_KEY6,291,124,43,15,ES_UPPERCASE | ES_AUTOHSCROLL - CTEXT "-",IDC_STATIC,74,128,8,7 - CTEXT "-",IDC_STATIC,126,128,8,7 - CTEXT "-",IDC_STATIC,178,128,8,7 - CTEXT "-",IDC_STATIC,230,128,8,7 - CTEXT "-",IDC_STATIC,282,128,8,7 - LTEXT "@B_INFO2",B_INFO2,35,167,317,36 - ICON ICO_WARNING,IDC_STATIC,13,167,20,18 - DEFPUSHBUTTON "@IDOK",IDOK,229,207,58,16 - PUSHBUTTON "@IDCANCEL",IDCANCEL,294,207,58,16 -END - -D_FREEINFO DIALOGEX 0, 0, 323, 207 -STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU -CAPTION "@D_FREEINFO" -FONT 9, "MS Shell Dlg", 400, 0, 0x80 -BEGIN - ICON ICO_INFORMATION,IDC_STATIC,7,5,18,18 - LTEXT "@S_INFO_1",S_INFO_1,32,5,284,30 - LTEXT "@S_INFO_2",S_INFO_2,7,38,309,30 - LTEXT "@S_INFO_3",S_INFO_3,14,72,302,25 - LTEXT "@S_INFO_4",S_INFO_4,7,101,309,84 - CONTROL "@B_HIDE",B_HIDE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,102,186,148,15 - DEFPUSHBUTTON "@IDCANCEL",IDCANCEL,257,186,59,15 -END - -D_EM_LICENSE_ADD DIALOGEX 0, 0, 359, 229 -STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU -CAPTION "@D_EM_LICENSE_ADD" -FONT 9, "MS Shell Dlg", 400, 0, 0x80 -BEGIN - ICON ICO_KEY,IDC_STATIC,7,5,20,18 - LTEXT "@S_INFO",S_INFO,33,5,319,23 - LTEXT "@STATIC1",IDC_STATIC,33,30,319,49 - GROUPBOX "@STATIC2",IDC_STATIC,21,86,320,70 - LTEXT "@STATIC3",IDC_STATIC,31,102,301,18 - EDITTEXT B_KEY1,30,124,43,15,ES_UPPERCASE | ES_AUTOHSCROLL - EDITTEXT B_KEY2,83,124,43,15,ES_UPPERCASE | ES_AUTOHSCROLL - EDITTEXT B_KEY3,135,124,43,15,ES_UPPERCASE | ES_AUTOHSCROLL - EDITTEXT B_KEY4,187,124,43,15,ES_UPPERCASE | ES_AUTOHSCROLL - EDITTEXT B_KEY5,239,124,43,15,ES_UPPERCASE | ES_AUTOHSCROLL - EDITTEXT B_KEY6,291,124,43,15,ES_UPPERCASE | ES_AUTOHSCROLL - CTEXT "-",IDC_STATIC,74,128,8,7 - CTEXT "-",IDC_STATIC,126,128,8,7 - CTEXT "-",IDC_STATIC,178,128,8,7 - CTEXT "-",IDC_STATIC,230,128,8,7 - CTEXT "-",IDC_STATIC,282,128,8,7 - LTEXT "@B_INFO2",B_INFO2,35,167,317,36 - ICON ICO_WARNING,IDC_STATIC,13,167,20,18 - DEFPUSHBUTTON "@IDOK",IDOK,229,207,58,16 - PUSHBUTTON "@IDCANCEL",IDCANCEL,294,207,58,16 -END - -D_EM_LICENSE DIALOGEX 0, 0, 427, 310 -STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU -CAPTION "@D_EM_LICENSE" -FONT 9, "MS Shell Dlg", 400, 0, 0x80 -BEGIN - ICON ICO_CERT,IDC_STATIC,7,5,20,18 - LTEXT "@STATIC1",IDC_STATIC,31,5,389,25 - LTEXT "@S_BOLD",S_BOLD,7,33,159,11 - CONTROL "",L_LIST,"SysListView32",LVS_REPORT | LVS_SHOWSELALWAYS | LVS_SHAREIMAGELISTS | LVS_NOSORTHEADER | WS_BORDER | WS_TABSTOP,7,46,413,136 - PUSHBUTTON "@B_OBTAIN",B_OBTAIN,7,186,82,17 - LTEXT "@STATIC2",IDC_STATIC,7,208,141,24 - PUSHBUTTON "@B_ADD",B_ADD,162,186,105,17 - PUSHBUTTON "@B_DEL",B_DEL,273,186,48,17 - DEFPUSHBUTTON "@IDOK",IDOK,327,186,93,17 - LTEXT "@STATIC3",IDC_STATIC,163,208,257,18 - CONTROL "",IDC_STATIC,"Static",SS_ETCHEDHORZ,7,234,413,1 - LTEXT "@S_BOLD2",S_BOLD2,7,239,198,11 - CONTROL "",L_STATUS,"SysListView32",LVS_REPORT | LVS_SHOWSELALWAYS | LVS_SHAREIMAGELISTS | LVS_NOCOLUMNHEADER | WS_BORDER | WS_TABSTOP,7,249,306,55 - PUSHBUTTON "@IDCANCEL",IDCANCEL,356,288,64,16 -END - -D_EM_REMOTE DIALOGEX 0, 0, 275, 149 -STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU -CAPTION "@D_EM_REMOTE" -FONT 9, "MS Shell Dlg", 400, 0, 0x80 -BEGIN - ICON ICO_TEST,S_ICON,7,5,20,18 - LTEXT "S_TITLE",S_TITLE,31,5,237,55 - GROUPBOX "@STATIC1",-1,26,66,222,53 - CONTROL "@R_LOCAL",R_LOCAL,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,40,78,200,15 - RTEXT "@S_HOSTNAME",S_HOSTNAME,33,98,49,10 - COMBOBOX C_HOSTNAME,86,96,150,91,CBS_DROPDOWN | WS_VSCROLL | WS_TABSTOP - PUSHBUTTON "@B_ABOUT",B_ABOUT,14,130,50,14 - DEFPUSHBUTTON "@IDOK",IDOK,158,130,52,14 - PUSHBUTTON "@IDCANCEL",IDCANCEL,216,130,52,14 -END - -D_CM_SETTING DIALOGEX 0, 0, 283, 290 -STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU -CAPTION "@D_CM_SETTING" -FONT 9, "MS Shell Dlg", 400, 0, 0x80 -BEGIN - ICON ICO_VPN,IDC_STATIC,7,5,18,18 - LTEXT "@STATIC1",IDC_STATIC,33,5,243,20 - CONTROL "@R_NORMAL",R_NORMAL,"Button",BS_AUTORADIOBUTTON | WS_TABSTOP,15,33,201,9 - CONTROL "@R_EASY",R_EASY,"Button",BS_AUTORADIOBUTTON,15,73,201,9 - LTEXT "@STATIC2",IDC_STATIC,25,47,250,24 - LTEXT "@STATIC3",IDC_STATIC,25,86,250,26 - CONTROL "",IDC_STATIC,"Static",SS_ETCHEDHORZ,7,116,269,1 - LTEXT "@STATIC4",IDC_STATIC,26,125,250,30 - CONTROL "@R_LOCK",R_LOCK,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,35,158,135,9 - LTEXT "@S_PASSWORD1",S_PASSWORD1,26,171,250,17 - RTEXT "@S_PASSWORD2",S_PASSWORD2,26,194,50,11 - EDITTEXT E_PASSWORD1,81,192,140,11,ES_PASSWORD | ES_AUTOHSCROLL - RTEXT "@S_PASSWORD3",S_PASSWORD3,26,209,50,10 - EDITTEXT E_PASSWORD2,81,208,140,11,ES_PASSWORD | ES_AUTOHSCROLL - CONTROL "",S_VGS1,"Static",SS_ETCHEDHORZ,7,228,268,1 - ICON ICO_RESEARCH,S_VGS3,7,235,18,18 - LTEXT "@S_VGS2",S_VGS2,33,237,186,10 - PUSHBUTTON "@B_VGS",B_VGS,32,249,97,15 - DEFPUSHBUTTON "@IDOK",IDOK,143,269,64,15 - PUSHBUTTON "@IDCANCEL",IDCANCEL,212,269,64,15 -END - -D_CM_EASY DIALOGEX 0, 0, 307, 223 -STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_MINIMIZEBOX | WS_POPUP | WS_CAPTION | WS_SYSMENU -CAPTION "@D_CM_EASY" -FONT 9, "MS Shell Dlg", 400, 0, 0x80 -BEGIN - CONTROL ICO_TRAY1,IDC_STATIC,"Static",SS_BITMAP,0,0,308,46 - LTEXT "@S_TITLE",S_TITLE,32,52,267,17 - ICON ICO_VPN,IDC_STATIC,7,51,20,18 - CONTROL "",L_ACCOUNT,"SysListView32",LVS_REPORT | LVS_SHOWSELALWAYS | LVS_SHAREIMAGELISTS | LVS_AUTOARRANGE | LVS_EDITLABELS | LVS_NOCOLUMNHEADER | WS_BORDER | WS_TABSTOP,7,88,293,82 - PUSHBUTTON "--BUTTON--",IDOK,92,173,123,21 - LTEXT "--INFO--",S_INFO,12,72,288,14 - CONTROL "",IDC_STATIC,"Static",SS_ETCHEDHORZ,7,198,294,1 - PUSHBUTTON "@B_MODE",B_MODE,7,203,84,16 - PUSHBUTTON "@IDCANCEL",IDCANCEL,247,203,53,16 - PUSHBUTTON "@B_STATUS",B_STATUS,216,176,84,16 - PUSHBUTTON "@B_VGC",B_VGC,112,203,84,16 -END - -D_SM_SETUP DIALOGEX 0, 0, 447, 311 -STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU -EXSTYLE WS_EX_CLIENTEDGE -CAPTION "@D_SM_SETUP" -FONT 9, "MS Shell Dlg", 400, 0, 0x80 -BEGIN - ICON ICO_SETUP,IDC_STATIC,7,5,18,18 - LTEXT "@S_TITLE",S_TITLE,31,5,409,17 - LTEXT "@IDC_STATIC_1",IDC_STATIC,7,26,433,24 - LTEXT "@S_BOLD",S_BOLD,7,51,433,21 - CONTROL "@C_REMOTE",C_REMOTE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,14,71,226,12 - CONTROL ICO_TRAY3,IDC_STATIC,"Static",SS_BITMAP,291,73,70,62 - LTEXT "@S_REMOTE_1",S_REMOTE_1,22,86,262,44 - CONTROL ICO_TRAY2,IDC_STATIC,"Static",SS_BITMAP,291,150,149,78 - CONTROL "@C_SITE",C_SITE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,14,145,244,12 - LTEXT "@S_SITE_1",S_SITE_1,22,161,262,40 - LTEXT "@S_SITE_2",S_SITE_2,22,203,228,10 - CONTROL "@C_CENTER",C_CENTER,"Button",BS_AUTORADIOBUTTON | WS_TABSTOP,29,215,255,11 - CONTROL "@C_EDGE",C_EDGE,"Button",BS_AUTORADIOBUTTON,29,228,252,11 - CONTROL "",IDC_STATIC,"Static",SS_ETCHEDHORZ,14,139,426,1 - CONTROL "",IDC_STATIC,"Static",SS_ETCHEDHORZ,14,243,426,1 - CONTROL "@C_OTHER",C_OTHER,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,14,249,244,12 - LTEXT "@S_OTHER",S_OTHER,22,264,418,22 - DEFPUSHBUTTON "@IDOK",IDOK,322,291,57,15 - PUSHBUTTON "@IDCANCEL",IDCANCEL,383,291,57,15 - LTEXT "--INFO--",S_INFO,7,287,310,18 -END - -D_SM_SETUP_HUB DIALOGEX 0, 0, 229, 86 -STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU -CAPTION "@D_SM_SETUP_HUB" -FONT 9, "MS Shell Dlg", 400, 0, 0x80 -BEGIN - ICON ICO_HUB,IDC_STATIC,7,5,20,18 - LTEXT "@IDC_STATIC_1",IDC_STATIC,31,5,191,25 - RTEXT "@IDC_STATIC_2",IDC_STATIC,7,40,62,12 - EDITTEXT E_HUBNAME,74,38,140,11,ES_AUTOHSCROLL - DEFPUSHBUTTON "@IDOK",IDOK,89,64,64,17 - PUSHBUTTON "@IDCANCEL",IDCANCEL,157,64,64,17 -END - -D_SM_SETUP_STEP DIALOGEX 0, 0, 329, 300 -STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU -EXSTYLE WS_EX_CLIENTEDGE -CAPTION "@D_SM_SETUP_STEP" -FONT 9, "MS Shell Dlg", 400, 0, 0x80 -BEGIN - ICON ICO_SERVER_ONLINE,IDC_STATIC,7,5,20,18,WS_TABSTOP - LTEXT "@IDC_STATIC_1",IDC_STATIC,29,5,293,20 - LTEXT "@S_1_1",S_1_1,7,38,315,12 - ICON ICO_USER,IDC_STATIC,14,53,20,18 - LTEXT "@S_1_2",S_1_2,37,53,285,29 - PUSHBUTTON "@B_USER",B_USER,37,84,87,15 - CONTROL "",IDC_STATIC,"Static",SS_ETCHEDHORZ,7,32,315,1 - CONTROL "",IDC_STATIC,"Static",SS_ETCHEDHORZ,7,107,315,1 - LTEXT "@S_2_1",S_2_1,7,117,315,12 - ICON ICO_CASCADE,IDC_STATIC,14,129,20,18 - LTEXT "@S_2_2",S_2_2,37,130,285,29 - PUSHBUTTON "@B_CASCADE",B_CASCADE,37,161,155,15 - CONTROL "",IDC_STATIC,"Static",SS_ETCHEDHORZ,7,184,315,1 - LTEXT "@S_3_1",S_3_1,7,194,315,12 - ICON ICO_NIC_ONLINE,S_ICON,14,207,20,18 - LTEXT "@S_3_2",S_3_2,37,208,285,33 - COMBOBOX C_DEVICE,37,242,285,140,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP - CONTROL "",IDC_STATIC,"Static",SS_ETCHEDHORZ,7,263,314,1 - PUSHBUTTON "@IDCANCEL",IDCANCEL,263,279,59,16 - LTEXT "@IDC_STATIC_8",IDC_STATIC,14,272,245,23 - PUSHBUTTON "@B_SECURENAT",B_SECURENAT,37,241,155,15 -END - -D_CPU64_WARNING DIALOGEX 0, 0, 299, 154 -STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU -EXSTYLE WS_EX_TOPMOST -CAPTION "@D_CPU64_WARNING" -FONT 9, "MS Shell Dlg", 400, 0, 0x80 -BEGIN - ICON ICO_WARNING,IDC_STATIC,7,5,18,18 - LTEXT "@S_BOLD",S_BOLD,29,5,263,25 - LTEXT "@S_INFO",S_INFO,29,35,263,92 - DEFPUSHBUTTON "@IDOK",IDOK,119,132,61,15 -END - -D_ONCEMSG DIALOGEX 0, 0, 251, 161 -STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | DS_CENTER | WS_POPUP | WS_CAPTION | WS_SYSMENU -CAPTION "@D_ONCEMSG" -FONT 9, "MS Shell Dlg", 400, 0, 0x80 -BEGIN - EDITTEXT E_TEXT,7,5,237,120,ES_MULTILINE | ES_READONLY | WS_VSCROLL - CONTROL "@C_DONTSHOWAGAIN",C_DONTSHOWAGAIN,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,7,127,237,11 - DEFPUSHBUTTON "@IDCANCEL",IDCANCEL,94,140,64,15 -END - -D_CONNECT DIALOGEX 0, 0, 189, 67 -STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU -CAPTION "@D_CONNECT" -FONT 9, "MS Shell Dlg", 400, 0, 0x80 -BEGIN - LTEXT "String",S_INFO,30,7,152,24 - ICON ICO_TEST,S_ICON,7,5,20,18 - DEFPUSHBUTTON "@IDCANCEL",IDCANCEL,69,47,50,14 - CONTROL "",IDC_PROGRESS1,"msctls_progress32",0x0,7,35,175,9 -END - -D_SM_SIMULATION DIALOGEX 0, 0, 281, 221 -STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU -CAPTION "@D_SM_SIMULATION" -FONT 9, "MS Shell Dlg", 400, 0, 0x80 -BEGIN - ICON ICO_FARM,IDC_STATIC,7,5,20,18 - LTEXT "@STATIC1",IDC_STATIC,30,5,244,52 - GROUPBOX "@STATIC2",IDC_STATIC,7,62,267,127 - CONTROL "@C_DELAY",C_DELAY,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,14,75,248,10 - RTEXT "@S_DELAY",S_DELAY,14,92,122,13 - EDITTEXT E_DELAY,139,90,51,11,ES_CENTER | ES_AUTOHSCROLL | ES_NUMBER - LTEXT "@S_DELAY2",S_DELAY2,194,92,73,14 - CONTROL "@C_JITTER",C_JITTER,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,14,112,248,10 - RTEXT "@S_JITTER",S_JITTER,14,129,122,14 - EDITTEXT E_JITTER,139,127,51,11,ES_CENTER | ES_AUTOHSCROLL | ES_NUMBER - LTEXT "@S_JITTER2",S_JITTER2,194,129,73,14 - CONTROL "@C_LOSS",C_LOSS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,14,149,248,10 - RTEXT "@S_LOSS",S_LOSS,14,167,122,13 - EDITTEXT E_LOSS,139,165,51,11,ES_CENTER | ES_AUTOHSCROLL | ES_NUMBER - LTEXT "@S_LOSS2",S_LOSS2,194,167,73,14 - DEFPUSHBUTTON "@IDOK",IDOK,142,199,64,17 - PUSHBUTTON "@IDCANCEL",IDCANCEL,210,199,64,17 -END - -D_SM_EDIT_ACCESS_V6 DIALOGEX 0, 0, 459, 352 -STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU -CAPTION "@D_SM_EDIT_ACCESS" -FONT 9, "MS Shell Dlg", 400, 0, 0x80 -BEGIN - ICON ICO_PASS,S_ICON,7,5,20,18 - LTEXT "@STATIC1",IDC_STATIC,31,5,421,17 - GROUPBOX "@STATIC2",IDC_STATIC,7,29,217,61 - RTEXT "@STATIC3",IDC_STATIC,14,43,71,10 - EDITTEXT E_NOTE,91,41,115,11,ES_AUTOHSCROLL - RTEXT "@STATIC4",IDC_STATIC,14,59,71,8 - CONTROL "@R_PASS",R_PASS,"Button",BS_AUTORADIOBUTTON,91,54,47,16 - CONTROL "@R_DISCARD",R_DISCARD,"Button",BS_AUTORADIOBUTTON,142,54,51,16 - RTEXT "@STATIC5",IDC_STATIC,14,75,71,9 - EDITTEXT E_PRIORITY,91,73,38,11,ES_CENTER | ES_AUTOHSCROLL | ES_NUMBER - LTEXT "@STATIC6",IDC_STATIC,134,72,73,16 - GROUPBOX "@STATIC11",S_STATIC11,7,92,217,96 - ICON ICO_USER,IDC_STATIC,11,101,20,18 - LTEXT "@STATIC12",S_STATIC12,34,103,177,24 - RTEXT "@STATIC13",S_STATIC13,12,132,73,11 - EDITTEXT E_USERNAME1,89,131,84,11,ES_AUTOHSCROLL - PUSHBUTTON "@B_USER1",B_USER1,179,129,41,16 - RTEXT "@STATIC14",S_STATIC14,13,152,72,11 - EDITTEXT E_USERNAME2,89,150,84,11,ES_AUTOHSCROLL - PUSHBUTTON "@B_USER2",B_USER2,179,149,41,16 - LTEXT "@STATIC15",S_STATIC15,56,167,156,18 - GROUPBOX "@STATIC16",IDC_STATIC,7,191,217,131 - RTEXT "@S_CHECK_SRC_MAC",S_CHECK_SRC_MAC,14,201,71,9 - CONTROL "@R_CHECK_SRC_MAC",R_CHECK_SRC_MAC,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,89,199,121,9 - RTEXT "@S_SRC_MAC",S_SRC_MAC,14,214,108,9 - EDITTEXT E_SRC_MAC,128,212,78,11,ES_AUTOHSCROLL - RTEXT "@S_SRC_MAC_MASK",S_SRC_MAC_MASK,14,228,108,9 - EDITTEXT E_SRC_MAC_MASK,128,227,78,11,ES_AUTOHSCROLL - CONTROL "",IDC_STATIC,"Static",SS_ETCHEDHORZ,18,242,193,1 - RTEXT "@S_CHECK_DST_MAC",S_CHECK_DST_MAC,13,247,71,9 - CONTROL "@R_CHECK_DST_MAC",R_CHECK_DST_MAC,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,89,245,121,9 - RTEXT "@S_DST_MAC",S_DST_MAC,14,260,108,9 - EDITTEXT E_DST_MAC,128,258,78,11,ES_AUTOHSCROLL - RTEXT "@S_DST_MAC_MASK",S_DST_MAC_MASK,14,275,108,9 - EDITTEXT E_DST_MAC_MASK,128,274,78,11,ES_AUTOHSCROLL - LTEXT "@S_MAC_NOTE",S_MAC_NOTE,18,288,197,26 - GROUPBOX "@STATIC7",IDC_STATIC,232,29,220,181 - RTEXT "@S_ACCESS_SRC_ALL",S_ACCESS_SRC_ALL,237,42,71,9 - CONTROL "@R_SRC_ALL",R_SRC_ALL,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,311,41,121,9 - RTEXT "@S_SRC_IP_1_V6",S_SRC_IP_1,237,54,54,9 - EDITTEXT E_SRC_IP_V6,298,53,147,11,ES_AUTOHSCROLL - RTEXT "@S_SRC_IP_2",S_SRC_IP_2,237,70,54,8 - EDITTEXT E_SRC_MASK_V6,298,68,147,11,ES_AUTOHSCROLL - RTEXT "@S_SRC_IP_3_V6",S_SRC_IP_3,237,87,208,9 - CONTROL "",IDC_STATIC,"Static",SS_ETCHEDHORZ,238,101,208,1 - RTEXT "@S_ACCESS_DST_ALL",S_ACCESS_DST_ALL,237,109,71,9 - CONTROL "@R_DST_ALL",R_DST_ALL,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,311,107,121,9 - RTEXT "@S_IP_DST_1_V6",S_IP_DST_1,237,121,54,9 - EDITTEXT E_DST_IP_V6,298,119,147,11,ES_AUTOHSCROLL - RTEXT "@S_IP_DST_2",S_IP_DST_2,237,137,54,9 - EDITTEXT E_DST_MASK_V6,298,135,146,11,ES_AUTOHSCROLL - RTEXT "@S_IP_DST_3_V6",S_IP_DST_3,237,152,207,10 - CONTROL "",IDC_STATIC,"Static",SS_ETCHEDHORZ,238,167,208,1 - RTEXT "@STATIC9",IDC_STATIC,237,176,71,11 - COMBOBOX C_PROTOCOL,313,174,110,75,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP - RTEXT "@S_PROTOID",S_PROTOID,237,193,71,9 - EDITTEXT E_IP_PROTO,313,191,37,11,ES_CENTER | ES_AUTOHSCROLL | ES_NUMBER - GROUPBOX "@STATIC10",IDC_STATIC,232,211,220,111 - LTEXT "@S_TCP_1",S_TCP_1,318,221,31,9 - LTEXT "@S_TCP_2",S_TCP_2,370,221,31,9 - RTEXT "@S_TCP_3",S_TCP_3,234,233,71,9 - EDITTEXT E_SRC_PORT_1,311,232,38,11,ES_CENTER | ES_AUTOHSCROLL | ES_NUMBER - LTEXT "-",S_TCP_4,356,233,8,7 - EDITTEXT E_SRC_PORT_2,365,232,38,11,ES_CENTER | ES_AUTOHSCROLL | ES_NUMBER - RTEXT "@S_TCP_5",S_TCP_5,234,249,71,9 - EDITTEXT E_DST_PORT_1,311,247,38,11,ES_CENTER | ES_AUTOHSCROLL | ES_NUMBER - LTEXT "-",S_TCP_6,356,249,8,7 - EDITTEXT E_DST_PORT_2,365,247,38,11,ES_CENTER | ES_AUTOHSCROLL | ES_NUMBER - LTEXT "@S_TCP_7",S_TCP_7,240,263,204,22 - CONTROL "",IDC_STATIC,"Static",SS_ETCHEDHORZ,238,291,208,1 - CONTROL "@R_CHECK_TCP_STATE",R_CHECK_TCP_STATE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,254,296,158,9 - CONTROL "@R_ESTABLISHED",R_ESTABLISHED,"Button",BS_AUTORADIOBUTTON | WS_TABSTOP,268,308,71,9 - CONTROL "@R_UNESTABLISHED",R_UNESTABLISHED,"Button",BS_AUTORADIOBUTTON,351,308,80,9 - CONTROL "@R_REDIRECT",R_REDIRECT,"Button",BS_AUTOCHECKBOX | BS_MULTILINE | WS_TABSTOP,7,328,113,18 - PUSHBUTTON "@B_REDIRECT",B_REDIRECT,122,329,78,17 - PUSHBUTTON "@B_SIMULATION",B_SIMULATION,207,329,103,17 - DEFPUSHBUTTON "@IDOK",IDOK,320,329,64,17 - PUSHBUTTON "@IDCANCEL",IDCANCEL,388,329,64,17 -END - -D_SM_VLAN DIALOGEX 0, 0, 315, 280 -STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU -CAPTION "@D_SM_VLAN" -FONT 9, "MS Shell Dlg", 400, 0, 0x80 -BEGIN - ICON ICO_NIC_ONLINE,IDC_STATIC,7,5,20,18 - LTEXT "@STATIC1",IDC_STATIC,29,5,279,53 - CONTROL "",L_LIST,"SysListView32",LVS_REPORT | LVS_SHOWSELALWAYS | LVS_SHAREIMAGELISTS | LVS_AUTOARRANGE | LVS_NOSORTHEADER | WS_BORDER | WS_TABSTOP,7,59,301,72 - PUSHBUTTON "@B_ENABLE",B_ENABLE,7,137,209,16 - PUSHBUTTON "@B_DISABLE",B_DISABLE,223,137,85,16 - GROUPBOX "@STATIC2",IDC_STATIC,7,160,301,94 - ICON ICO_INFORMATION,IDC_STATIC,14,171,20,18 - LTEXT "@S_WARNING",S_WARNING,38,171,262,24 - LTEXT "@S_WARNING2",S_WARNING2,38,197,262,52 - DEFPUSHBUTTON "@IDCANCEL",IDCANCEL,249,258,59,16 -END - -D_SM_MSG DIALOGEX 0, 0, 275, 276 -STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU -CAPTION "@D_SM_MSG" -FONT 9, "MS Shell Dlg", 400, 0, 0x80 -BEGIN - ICON ICO_LOG2,S_ACL_5,7,5,20,18 - LTEXT "@S_MSG_2",S_MSG_2,31,5,237,31 - CONTROL "@C_USEMSG",C_USEMSG,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,7,43,253,13 - EDITTEXT E_TEXT,20,61,237,120,ES_MULTILINE | ES_WANTRETURN | WS_VSCROLL - GROUPBOX "@STATIC1",IDC_STATIC,7,185,261,61 - ICON ICO_INFORMATION,IDC_STATIC,14,197,20,18 - LTEXT "@S_INFO",S_INFO,39,198,222,45 - DEFPUSHBUTTON "@IDOK",IDOK,131,254,64,17 - PUSHBUTTON "@IDCANCEL",IDCANCEL,203,254,64,17 -END - -D_NICINFO DIALOGEX 0, 0, 221, 91 -STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | DS_CENTER | WS_POPUP | WS_CAPTION | WS_SYSMENU -EXSTYLE WS_EX_APPWINDOW -CAPTION "@D_NICINFO" -FONT 9, "MS Shell Dlg", 400, 0, 0x80 -BEGIN - ICON ICO_NIC_OFFLINE,S_ICON,7,5,18,18 - LTEXT "Status1",S_STATUS1,31,10,183,15 - DEFPUSHBUTTON "@IDCANCEL",IDCANCEL,84,71,50,14 - LTEXT "Status2",S_STATUS2,31,27,183,32 - CONTROL "",P_BAR,"msctls_progress32",0x0,7,60,207,7 -END - -D_SM_IPSEC DIALOGEX 0, 0, 423, 307 -STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU -CAPTION "@D_SM_IPSEC" -FONT 9, "MS Shell Dlg", 400, 0, 0x80 -BEGIN - LTEXT "@S_TITLE",S_TITLE,31,5,385,16 - LTEXT "@S_3",S_3,31,22,385,23 - ICON ICO_IPSEC,IDC_STATIC,7,5,20,18 - GROUPBOX "@S01",IDC_STATIC,7,47,409,142 - LTEXT "@S02",IDC_STATIC,14,58,267,23 - CONTROL 197,IDC_STATIC,"Static",SS_BITMAP,288,56,121,33 - CONTROL "@R_L2TP_OVER_IPSEC",R_L2TP_OVER_IPSEC,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,16,82,269,9 - LTEXT "@S03",IDC_STATIC,31,95,286,13 - CONTROL "@R_L2TP_RAW",R_L2TP_RAW,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,16,111,269,9 - LTEXT "@S04",IDC_STATIC,31,125,378,12 - RTEXT "@S_1",S_1,16,171,270,12 - COMBOBOX L_HUBNAME,291,168,114,127,CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL | WS_TABSTOP - LTEXT "@S_2",S_2,48,143,361,23 - GROUPBOX "@S05",IDC_STATIC,7,194,409,48 - LTEXT "@S06",IDC_STATIC,16,203,294,17 - CONTROL 195,IDC_STATIC,"Static",SS_BITMAP,314,202,94,37,WS_EX_STATICEDGE - CONTROL "@R_ETHERIP",R_ETHERIP,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,16,224,184,9 - PUSHBUTTON "@B_DETAIL",B_DETAIL,204,221,103,15 - GROUPBOX "@S07",IDC_STATIC,7,249,261,51 - RTEXT "@S_PSK",S_PSK,14,262,78,12 - EDITTEXT E_SECRET,98,258,159,13,ES_AUTOHSCROLL - LTEXT "@S_PSK2",S_PSK2,14,279,248,17 - DEFPUSHBUTTON "@IDOK",IDOK,307,287,52,14 - PUSHBUTTON "@IDCANCEL",IDCANCEL,364,287,52,14 - CONTROL "",IDC_STATIC,"Static",SS_ETCHEDHORZ,14,137,395,1 - ICON ICO_INFORMATION,IDC_STATIC,24,140,20,18 - CONTROL 227,IDC_STATIC,"Static",SS_BITMAP,318,89,90,33 -END - -D_SM_ETHERIP DIALOGEX 0, 0, 411, 244 -STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU -CAPTION "@D_SM_ETHERIP" -FONT 9, "MS Shell Dlg", 400, 0, 0x80 -BEGIN - ICON ICO_MACHINE,IDC_STATIC,7,5,20,18 - LTEXT "@S_TITLE",S_TITLE,31,5,198,16 - LTEXT "@S01",IDC_STATIC,7,32,221,41 - LTEXT "@S02",IDC_STATIC,7,74,222,29 - LTEXT "@S_BOLD",S_BOLD,7,107,222,10 - CONTROL "",L_LIST,"SysListView32",LVS_REPORT | LVS_SHOWSELALWAYS | LVS_SHAREIMAGELISTS | LVS_AUTOARRANGE | LVS_NOSORTHEADER | WS_BORDER | WS_TABSTOP,7,119,311,119 - CONTROL 202,IDC_STATIC,"Static",SS_BITMAP,233,5,171,108,WS_EX_DLGMODALFRAME - PUSHBUTTON "@B_ADD",B_ADD,326,132,78,16 - DEFPUSHBUTTON "@IDOK",IDOK,326,150,78,16 - PUSHBUTTON "@B_DELETE",B_DELETE,326,169,78,16 - PUSHBUTTON "@IDCANCEL",IDCANCEL,326,222,78,16 - RTEXT "@S03",IDC_STATIC,320,115,84,9,NOT WS_VISIBLE -END - -D_SM_ETHERIP_ID DIALOGEX 0, 0, 267, 227 -STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU -CAPTION "@D_SM_ETHERIP_ID" -FONT 9, "MS Shell Dlg", 400, 0, 0x80 -BEGIN - ICON ICO_KEY,IDC_STATIC,7,5,20,18 - LTEXT "@S01",IDC_STATIC,29,5,231,30 - RTEXT "@S02",IDC_STATIC,7,40,76,12 - EDITTEXT E_ID,88,38,153,11,ES_AUTOHSCROLL - RTEXT "@S03",IDC_STATIC,7,109,76,11 - COMBOBOX L_HUBNAME,88,107,153,127,CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL | WS_TABSTOP - RTEXT "@S04",IDC_STATIC,7,128,76,12 - EDITTEXT E_USERNAME,88,126,153,11,ES_AUTOHSCROLL - RTEXT "@S05",IDC_STATIC,7,147,76,14 - EDITTEXT E_PASSWORD,88,145,153,11,ES_PASSWORD | ES_AUTOHSCROLL - ICON ICO_INFORMATION,IDC_STATIC,7,168,20,18 - LTEXT "@S06",IDC_STATIC,30,169,230,33 - DEFPUSHBUTTON "@IDOK",IDOK,151,207,52,14 - PUSHBUTTON "@IDCANCEL",IDCANCEL,208,207,52,14 - LTEXT "@S07",IDC_STATIC,88,51,154,55 -END - -D_SM_OPENVPN DIALOGEX 0, 0, 427, 308 -STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU -CAPTION "@D_SM_OPENVPN" -FONT 9, "MS Shell Dlg", 400, 0, 0x80 -BEGIN - ICON ICO_OPENVPN,IDC_STATIC,7,5,20,18 - LTEXT "@S_TITLE",S_TITLE,32,6,385,16 - GROUPBOX "@S_13",IDC_STATIC,7,26,409,142 - LTEXT "@S_1",IDC_STATIC,15,36,195,37 - CONTROL 205,IDC_STATIC,"Static",SS_BITMAP,217,35,194,75 - CONTROL "@R_OPENVPN",R_OPENVPN,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,17,75,194,9 - CONTROL "",IDC_STATIC,"Static",SS_ETCHEDHORZ,14,107,395,1 - LTEXT "@S_TOOL",S_TOOL,15,112,392,12 - LTEXT "@S_TOOL2",S_TOOL2,24,126,385,22 - PUSHBUTTON "@B_CONFIG",B_CONFIG,120,146,189,15 - GROUPBOX "@S_2",IDC_STATIC,7,175,409,98 - LTEXT "@S_3",IDC_STATIC,14,185,195,37 - CONTROL 206,IDC_STATIC,"Static",SS_BITMAP,215,182,194,85 - CONTROL "@R_SSTP",R_SSTP,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,14,225,194,9 - LTEXT "@S_SSTP",S_SSTP,21,238,188,33 - LTEXT "@S_4",IDC_STATIC,7,279,186,24 - PUSHBUTTON "@B_IPSEC",B_IPSEC,195,288,93,15 - DEFPUSHBUTTON "@IDOK",IDOK,311,288,52,14 - PUSHBUTTON "@IDCANCEL",IDCANCEL,368,288,52,14 -END - -D_SM_DDNS DIALOGEX 0, 0, 415, 287 -STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU -CAPTION "@D_SM_DDNS" -FONT 9, "MS Shell Dlg", 400, 0, 0x80 -BEGIN - ICON ICO_DISPLAY,IDC_STATIC,7,5,20,18 - LTEXT "@S_TITLE",S_TITLE,31,5,377,16 - LTEXT "@S_BOLD",S_BOLD,7,31,401,12 - LTEXT "@S_1",IDC_STATIC,7,47,401,28 - LTEXT "@S_22",IDC_STATIC,7,76,401,30 - LTEXT "@S_3",IDC_STATIC,7,107,401,22 - GROUPBOX "@S_4",IDC_STATIC,7,131,194,106 - LTEXT "@S_STATUS3",S_STATUS3,14,141,182,10 - EDITTEXT E_HOST,17,152,155,13,ES_AUTOHSCROLL | ES_READONLY | NOT WS_BORDER - PUSHBUTTON "@B_HINT",B_HINT,174,150,24,15 - LTEXT "@S_STATUS4",S_STATUS4,14,168,171,10 - EDITTEXT E_IPV4,17,179,172,13,ES_AUTOHSCROLL | ES_READONLY | NOT WS_BORDER - LTEXT "@S_STATUS5",S_STATUS5,14,195,171,9 - EDITTEXT E_IPV6,17,205,172,13,ES_AUTOHSCROLL | ES_READONLY | NOT WS_BORDER - LTEXT "@S_STATUS8",S_STATUS8,14,221,31,10 - EDITTEXT E_KEY,41,221,131,13,ES_AUTOHSCROLL | ES_READONLY | NOT WS_BORDER - PUSHBUTTON "@B_HINT2",B_HINT2,174,218,24,15 - GROUPBOX "@S_5",IDC_STATIC,206,131,202,106 - LTEXT "@S_STATUS6",S_STATUS6,212,145,189,10 - EDITTEXT E_NEWHOST,215,157,86,13,ES_AUTOHSCROLL - LTEXT "",S_SUFFIX,303,159,98,11 - LTEXT "@S_STATUS7",S_STATUS7,219,172,182,30 - DEFPUSHBUTTON "@IDOK",IDOK,218,205,119,16 - PUSHBUTTON "@B_RESTORE",B_RESTORE,341,205,60,16 - ICON ICO_INFORMATION,IDC_STATIC,7,241,20,18 - LTEXT "@S_2",S_2,30,240,378,22 - PUSHBUTTON "@B_DISABLE",B_DISABLE,7,265,145,16 - PUSHBUTTON "@B_PROXY",B_PROXY,218,265,110,16 - PUSHBUTTON "@IDCANCEL",IDCANCEL,335,265,73,16 -END - -D_SM_SPECIALLISTENER DIALOGEX 0, 0, 357, 319 -STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU -CAPTION "@D_SM_SPECIALLISTENER" -FONT 9, "MS Shell Dlg", 400, 0, 0x80 -BEGIN - ICON ICO_SPECIALLISTENER,IDC_STATIC,7,5,20,18 - LTEXT "@S_TITLE",S_TITLE,32,6,260,16 - CONTROL 208,IDC_STATIC,"Static",SS_BITMAP,36,112,286,159 - GROUPBOX "@S_1",S_1,7,30,343,79 - LTEXT "@S_2",IDC_STATIC,14,42,329,31 - CONTROL "@R_OVER_ICMP",R_OVER_ICMP,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,29,73,272,12 - CONTROL "@R_OVER_DNS",R_OVER_DNS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,29,90,272,12 - DEFPUSHBUTTON "@IDOK",IDOK,241,299,52,14 - PUSHBUTTON "@IDCANCEL",IDCANCEL,298,299,52,14 - LTEXT "@S_3",IDC_STATIC,7,301,224,18 - LTEXT "@S_4",IDC_STATIC,7,275,343,24 -END - -D_SM_REDIRECT DIALOGEX 0, 0, 358, 311 -STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU -CAPTION "@D_SM_REDIRECT" -FONT 9, "MS Shell Dlg", 400, 0, 0x80 -BEGIN - ICON ICO_INTERNET,IDC_STATIC,7,5,20,18 - LTEXT "@S_1",IDC_STATIC,31,5,320,46 - GROUPBOX "@S_2",IDC_STATIC,7,53,344,96 - RTEXT "@S_BOLD2",S_BOLD2,10,70,71,10 - EDITTEXT E_URL,86,66,257,15,ES_AUTOHSCROLL - RTEXT "@S_3",IDC_STATIC,14,88,52,11 - RTEXT "@S_4",IDC_STATIC,23,101,102,12 - EDITTEXT E_SAMPLE1,128,100,215,12,ES_AUTOHSCROLL | ES_READONLY | NOT WS_BORDER - RTEXT "@S_5",IDC_STATIC,23,116,102,12 - EDITTEXT E_SAMPLE2,128,115,215,12,ES_AUTOHSCROLL | ES_READONLY | NOT WS_BORDER - PUSHBUTTON "@B_HINT",B_HINT,197,128,146,17 - GROUPBOX "@S_6",IDC_STATIC,7,155,344,127 - ICON ICO_WARNING,IDC_STATIC,11,167,20,18 - LTEXT "@S_BOLD",S_BOLD,35,168,308,18 - LTEXT "@S_7",IDC_STATIC,35,191,308,18 - LTEXT "@S_8",IDC_STATIC,35,213,308,11 - LTEXT "@S_9",IDC_STATIC,35,228,308,23 - LTEXT "@S_10",IDC_STATIC,35,251,308,29 - DEFPUSHBUTTON "@IDOK",IDOK,219,288,64,17 - PUSHBUTTON "@IDCANCEL",IDCANCEL,287,288,64,17 - LTEXT "@S_11",IDC_STATIC,15,129,175,18 -END - -D_SW_TEST1 DIALOGEX 0, 0, 323, 155 -STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU -CAPTION "AAA" -FONT 9, "MS Shell Dlg", 400, 0, 0x80 -BEGIN - PUSHBUTTON "Button1",IDC_BUTTON1,266,109,50,12 - LTEXT "HAMNEKO",IDC_STATIC,36,5,50,11 - PUSHBUTTON "Button2",IDC_BUTTON2,266,124,50,12 - PUSHBUTTON "Button3",IDC_BUTTON3,266,92,50,12 - PUSHBUTTON "Button4",IDC_BUTTON4,266,137,50,12 - ICON ICO_INSTALLER,IDC_STATIC,7,5,18,18 -END - -D_DUMMY DIALOGEX 0, 0, 186, 77 -STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU -CAPTION "Dummy" -FONT 9, "MS Shell Dlg", 400, 0, 0x80 -BEGIN - PUSHBUTTON "B_WIZ_NEXT",B_WIZ_NEXT,7,5,50,12 - PUSHBUTTON "B_WIZ_PREV",B_WIZ_PREV,7,19,50,12 -END - -D_SW_TEST2 DIALOGEX 0, 0, 175, 84 -STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU -CAPTION "Testkko" -FONT 9, "MS Shell Dlg", 400, 0, 0x80 -BEGIN - PUSHBUTTON "Button1",IDC_BUTTON1,7,5,50,12 - LTEXT "Hanyu",IDC_STATIC,26,37,50,11 - PUSHBUTTON "Button2",IDC_BUTTON2,118,5,50,12 - PUSHBUTTON "Button3",IDC_BUTTON3,7,66,50,12 - PUSHBUTTON "Button4",IDC_BUTTON4,118,66,50,12 -END - -D_SW_DEFAULT DIALOGEX 0, 0, 323, 155 -STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU -CAPTION "@D_SW_DEFAULT" -FONT 9, "MS Shell Dlg", 400, 0, 0x80 -BEGIN -END - -D_SW_WELCOME DIALOGEX 0, 0, 323, 155 -STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU -CAPTION "@D_SW_WELCOME" -FONT 9, "MS Shell Dlg", 400, 0, 0x80 -BEGIN - ICON ICO_INSTALLER,IDC_STATIC,7,5,20,18,WS_TABSTOP - LTEXT "@S_WELCOME",S_WELCOME,39,18,277,43 - LTEXT "@S_TITLE",S_TITLE,39,5,277,10 - CONTROL 223,IDC_STATIC,"Static",SS_BITMAP,54,63,245,92 -END - -D_SW_MODE DIALOGEX 0, 0, 323, 155 -STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU -CAPTION "@D_SW_MODE" -FONT 9, "MS Shell Dlg", 400, 0, 0x80 -BEGIN - CONTROL "@R_SYSTEM",R_SYSTEM,"Button",BS_AUTORADIOBUTTON | WS_TABSTOP,56,64,242,11 - CONTROL "@R_USER",R_USER,"Button",BS_AUTORADIOBUTTON,56,104,242,11 - LTEXT "@S_1",IDC_STATIC,68,77,241,24 - LTEXT "@S_USER",S_USER,68,117,241,24 - ICON ICO_TOWER,IDC_STATIC,20,64,20,18 - ICON ICO_USER,IDC_STATIC,20,104,20,18 - LTEXT "@S_2",IDC_STATIC,7,5,309,54 - ICON ICO_TEST,S_UAC,42,64,20,18 -END - -D_SW_NOT_ADMIN DIALOGEX 0, 0, 323, 155 -STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU -CAPTION "@D_SW_NOT_ADMIN" -FONT 9, "MS Shell Dlg", 400, 0, 0x80 -BEGIN - ICON ICO_INFORMATION,IDC_STATIC,7,5,20,18,WS_TABSTOP - LTEXT "@S_INFO",S_INFO,39,5,277,48 - LTEXT "@S_INFO6",S_INFO6,39,138,277,12 - LTEXT "@S_INFO2",S_INFO2,39,61,277,28 -END - -D_SW_COMPONENTS DIALOGEX 0, 0, 323, 155 -STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU -CAPTION "@D_SW_DEFAULT" -FONT 9, "MS Shell Dlg", 400, 0, 0x80 -BEGIN - CONTROL "",L_LIST,"SysListView32",LVS_REPORT | LVS_SINGLESEL | LVS_SHOWSELALWAYS | LVS_SHAREIMAGELISTS | LVS_AUTOARRANGE | LVS_NOCOLUMNHEADER | LVS_NOSORTHEADER | WS_BORDER | WS_TABSTOP,7,3,309,84 - LTEXT "INFO",S_TITLE,7,97,309,14 - LTEXT "Static",S_DESCRIPTION,44,115,272,38 - ICON ICO_TEST,S_ICON,19,114,18,18 -END - -D_SW_EULA DIALOGEX 0, 0, 323, 155 -STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU -CAPTION "@D_SW_EULA" -FONT 9, "MS Shell Dlg", 400, 0, 0x80 -BEGIN - LTEXT "@S_1",IDC_STATIC,7,1,309,11,WS_TABSTOP - EDITTEXT E_TEXT,7,16,309,96,ES_MULTILINE | ES_READONLY | WS_VSCROLL - CONTROL "@B_AGREE",B_AGREE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,12,118,297,11 -END - -D_SW_WARNING DIALOGEX 0, 0, 323, 155 -STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU -CAPTION "@D_SW_WARNING" -FONT 9, "MS Shell Dlg", 400, 0, 0x80 -BEGIN - LTEXT "@S_1",IDC_STATIC,22,1,294,17,WS_TABSTOP - EDITTEXT E_TEXT,7,23,309,99,ES_MULTILINE | ES_READONLY | WS_VSCROLL - ICON ICO_INFORMATION,IDC_STATIC,0,0,20,18 -END - -D_SW_DIR DIALOGEX 0, 0, 323, 155 -STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU -CAPTION "@D_SW_DIR" -FONT 9, "MS Shell Dlg", 400, 0, 0x80 -BEGIN - ICON ICO_TEST,S_ICON,2,0,20,18,WS_TABSTOP - LTEXT "@S_INFO",S_INFO,29,5,287,18 - CONTROL "dest_dir",R_DEFAULT,"Button",BS_AUTORADIOBUTTON | WS_TABSTOP,33,25,283,11 - CONTROL "@R_CUSTOM",R_CUSTOM,"Button",BS_AUTORADIOBUTTON,33,40,283,11 - RTEXT "@S_DEST",S_DEST,7,59,72,11 - EDITTEXT E_DIR,82,57,179,11,ES_AUTOHSCROLL - PUSHBUTTON "@B_BROWSE",B_BROWSE,269,55,46,13 - CONTROL "@R_SHOWCUSTOM",R_SHOWCUSTOM,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,33,89,283,9 - CONTROL "@R_FOR_SYSTEM",R_FOR_SYSTEM,"Button",BS_AUTORADIOBUTTON | WS_TABSTOP,46,104,263,9 - CONTROL "@R_FOR_USER",R_FOR_USER,"Button",BS_AUTORADIOBUTTON,46,117,263,9 - ICON ICO_WARNING,S_WARNING2,36,131,20,18 - LTEXT "@S_WARNING",S_WARNING,60,132,256,23 -END - -D_SW_READY DIALOGEX 0, 0, 323, 155 -STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU -CAPTION "@D_SW_READY" -FONT 9, "MS Shell Dlg", 400, 0, 0x80 -BEGIN - ICON ICO_INSTALLER,S_ICON,2,0,20,18,WS_TABSTOP - LTEXT "@S_INFO",S_INFO,29,5,287,18 - LTEXT "@S_INFO7",S_INFO7,29,24,287,18 -END - -D_SW_PERFORM DIALOGEX 0, 0, 323, 155 -STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU -CAPTION "@D_SW_PERFORM" -FONT 9, "MS Shell Dlg", 400, 0, 0x80 -BEGIN - ICON ICO_TEST,S_ICON,0,65,20,18 - CONTROL "",IDC_PROGRESS1,"msctls_progress32",0x0,7,121,309,13 - LTEXT "@S_INFO",S_INFO,32,65,284,19 - LTEXT "STATUS",S_STATUS,7,99,309,21 - CONTROL 224,IDC_STATIC,"Static",SS_BITMAP,3,0,319,66 -END - -D_SW_ERROR DIALOGEX 0, 0, 323, 155 -STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU -CAPTION "@D_SW_ERROR" -FONT 9, "MS Shell Dlg", 400, 0, 0x80 -BEGIN - ICON ICO_STOP,S_ICON,7,5,20,18,WS_TABSTOP - LTEXT "@S_INFO",S_INFO,38,5,278,90 -END - -D_SW_FINISH DIALOGEX 0, 0, 323, 155 -STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU -CAPTION "@D_SW_FINISH" -FONT 9, "MS Shell Dlg", 400, 0, 0x80 -BEGIN - ICON ICO_TEST,S_ICON,7,5,20,18,WS_TABSTOP - LTEXT "@S_INFO",S_INFO,38,5,278,65 - CONTROL "RUN_TEXT",B_RUN,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,45,73,271,12 - LTEXT "@S_INFO8",S_INFO8,65,113,251,42 - ICON ICO_GROUP,S_ICON2,43,111,18,18,WS_TABSTOP -END - -D_SW_UNINST1 DIALOGEX 0, 0, 323, 155 -STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU -CAPTION "@D_SW_UNINST1" -FONT 9, "MS Shell Dlg", 400, 0, 0x80 -BEGIN - ICON ICO_INSTALLER,-1,7,5,20,18,WS_TABSTOP - LTEXT "@S_WELCOME",S_WELCOME,39,22,277,48 - LTEXT "@S_TITLE",S_TITLE,39,5,277,10 -END - -D_SW_LANG1 DIALOGEX 0, 0, 323, 155 -STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU -CAPTION "D_SW_LANG1" -FONT 9, "MS Shell Dlg", 400, 0, 0x80 -BEGIN - CONTROL "",L_LIST,"SysListView32",LVS_REPORT | LVS_SINGLESEL | LVS_SHOWSELALWAYS | LVS_SHAREIMAGELISTS | LVS_AUTOARRANGE | LVS_NOCOLUMNHEADER | LVS_NOSORTHEADER | WS_BORDER | WS_TABSTOP,7,55,309,60 - ICON ICO_LANGUAGE,IDC_STATIC,7,0,20,18 - CONTROL 218,IDC_STATIC,"Static",SS_BITMAP,57,0,113,21 - CONTROL 216,IDC_STATIC,"Static",SS_BITMAP,7,23,307,30 - CONTROL 217,IDC_STATIC,"Static",SS_BITMAP,7,116,307,30 - EDITTEXT E_CURRENT,173,3,143,15,ES_CENTER | ES_AUTOHSCROLL | ES_READONLY -END - -D_SW_EASY1 DIALOGEX 0, 0, 323, 155 -STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU -CAPTION "@D_SW_EASY1" -FONT 9, "MS Shell Dlg", 400, 0, 0x80 -BEGIN - ICON ICO_EASYINSTALLER,IDC_STATIC,7,5,20,18,WS_TABSTOP - LTEXT "@S_WELCOME",S_WELCOME,39,26,277,31 - LTEXT "@S_TITLE",S_TITLE,39,5,277,10 - LTEXT "@S_WELCOME2",S_WELCOME2,39,61,277,31 - LTEXT "@S_WELCOME3",S_WELCOME3,39,97,277,31 -END - -D_SW_EASY2 DIALOGEX 0, 0, 323, 155 -STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU -CAPTION "@D_SW_EASY2" -FONT 9, "MS Shell Dlg", 400, 0, 0x80 -BEGIN - ICON ICO_SETUP,IDC_STATIC,7,5,18,18,WS_TABSTOP - LTEXT "@S_BOLD1",S_BOLD1,35,5,281,12 - LTEXT "@S_1",S_1,44,22,272,28 - RTEXT "@S_18",S_18,7,52,79,12 - EDITTEXT E_SETTING,88,50,177,11,ES_AUTOHSCROLL | ES_READONLY - PUSHBUTTON "@B_BROWSE_SETTING",B_BROWSE_SETTING,270,48,46,13 - CONTROL "@B_DELETE_SENSITIVE",B_DELETE_SENSITIVE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,89,65,227,11 - LTEXT "@S_BOLD2",S_BOLD2,35,81,281,12 - LTEXT "@S_3",S_3,44,98,272,22 - RTEXT "@S_19",S_19,7,126,79,12 - EDITTEXT E_OUT,88,125,177,11,ES_AUTOHSCROLL | ES_READONLY - PUSHBUTTON "@B_BROWSE_OUT",B_BROWSE_OUT,270,123,46,13 - CONTROL "@B_EASYMODE",B_EASYMODE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,89,139,227,11 -END - -D_SW_WEB1 DIALOGEX 0, 0, 323, 155 -STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU -CAPTION "@D_SW_WEB1" -FONT 9, "MS Shell Dlg", 400, 0, 0x80 -BEGIN - ICON ICO_INTERNET,IDC_STATIC,7,5,20,18,WS_TABSTOP - LTEXT "@S_WELCOME",S_WELCOME,39,26,277,31 - LTEXT "@S_TITLE",S_TITLE,39,5,277,10 - LTEXT "@S_WELCOME2",S_WELCOME2,39,61,277,31 - LTEXT "@S_WELCOME3",S_WELCOME3,39,97,277,31 -END - -D_SW_WEB2 DIALOGEX 0, 0, 323, 155 -STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU -CAPTION "@D_SW_WEB2" -FONT 9, "MS Shell Dlg", 400, 0, 0x80 -BEGIN - ICON ICO_SETUP,IDC_STATIC,7,5,20,18,WS_TABSTOP - LTEXT "@S_BOLD1",S_BOLD1,35,5,281,12 - LTEXT "@S_1",S_1,44,22,272,28 - RTEXT "@S_18",S_18,7,52,79,12 - EDITTEXT E_SETTING,88,50,177,11,ES_AUTOHSCROLL | ES_READONLY - PUSHBUTTON "@B_BROWSE_SETTING",B_BROWSE_SETTING,270,48,46,13 - CONTROL "@B_DELETE_SENSITIVE",B_DELETE_SENSITIVE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,89,65,227,11 - LTEXT "@S_BOLD2",S_BOLD2,35,81,281,12 - LTEXT "@S_3",S_3,44,98,272,22 - RTEXT "@S_19",S_19,7,126,79,12 - EDITTEXT E_OUT,88,125,177,11,ES_AUTOHSCROLL | ES_READONLY - PUSHBUTTON "@B_BROWSE_OUT",B_BROWSE_OUT,270,123,46,13 - CONTROL "@B_EASYMODE",B_EASYMODE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,89,139,227,11 -END - -D_UPDATE_NOTICE DIALOGEX 0, 0, 259, 204 -STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU -EXSTYLE WS_EX_TOPMOST -CAPTION "@D_UPDATE_NOTICE" -FONT 9, "MS Shell Dlg", 400, 0, 0x80 -BEGIN - CONTROL 225,IDC_STATIC,"Static",SS_BITMAP | WS_TABSTOP,2,1,254,68 - DEFPUSHBUTTON "@IDOK",IDOK,7,182,117,17 - PUSHBUTTON "@B_CONFIG",B_CONFIG,162,95,90,15 - PUSHBUTTON "@IDCANCEL",IDCANCEL,135,182,117,17 - LTEXT "@S_INFO",S_INFO,7,70,245,24 - RTEXT "@S_PRODUCT",S_PRODUCT,7,120,77,15 - LTEXT "TITLE",S_PRODUCT_STR,90,119,162,16 - RTEXT "@S_CURRENT",S_CURRENT,7,140,77,16 - LTEXT "@S_CURRENT_STR",S_CURRENT_STR,90,138,162,16 - RTEXT "@S_LATEST",S_LATEST,7,161,77,16 - LTEXT "@S_LATEST_STR",S_LATEST_STR,90,159,162,17 -END - -D_UPDATE_CONFIG DIALOGEX 0, 0, 307, 132 -STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU -EXSTYLE WS_EX_TOPMOST -CAPTION "@D_UPDATE_CONFIG" -FONT 9, "MS Shell Dlg", 400, 0, 0x80 -BEGIN - LTEXT "@S_INFO",S_INFO,7,27,293,47 - LTEXT "@S_TITLE",S_TITLE,7,5,293,21 - CONTROL "@S_ENABLE",S_ENABLE,"Button",BS_AUTORADIOBUTTON | WS_TABSTOP,48,80,157,12 - CONTROL "@S_DISABLE",S_DISABLE,"Button",BS_AUTORADIOBUTTON,48,96,157,12 - ICON ICO_MACHINE,IDC_STATIC,16,79,20,18 - DEFPUSHBUTTON "@IDCANCEL",IDCANCEL,236,112,64,15 -END - -D_SM_VMBRIDGE DIALOGEX 0, 0, 311, 269 -STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU -CAPTION "@D_SM_VMBRIDGE" -FONT 9, "MS Shell Dlg", 400, 0, 0x80 -BEGIN - CONTROL 228,IDC_STATIC,"Static",SS_BITMAP,12,65,286,73 - ICON ICO_NIC_ONLINE,IDC_STATIC,6,4,18,18 - LTEXT "@S_TITLE",S_TITLE,32,5,272,19 - LTEXT "@S_1",IDC_STATIC,7,26,297,24 - LTEXT "@S_2",IDC_STATIC,14,143,282,90 - GROUPBOX "@S_BOLD",S_BOLD,7,52,297,188 - DEFPUSHBUTTON "@IDCANCEL",IDCANCEL,248,248,56,16 -END - -D_SM_AZURE DIALOGEX 0, 0, 411, 317 -STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU -CAPTION "@D_SM_AZURE" -FONT 9, "MS Shell Dlg", 400, 0, 0x80 -BEGIN - CONTROL 229,S_BMP_EN,"Static",SS_BITMAP,7,0,397,173 - LTEXT "@S_TITLE",S_TITLE,7,177,397,16 - LTEXT "@S_1",IDC_STATIC,7,194,397,24 - LTEXT "@S_2",IDC_STATIC,7,217,397,24 - LTEXT "@S_3",IDC_STATIC,30,240,374,21 - GROUPBOX "@B_BOLD",B_BOLD,7,264,112,48 - CONTROL "@R_ENABLE",R_ENABLE,"Button",BS_AUTORADIOBUTTON | WS_TABSTOP,13,273,102,12 - CONTROL "@R_DISABLE",R_DISABLE,"Button",BS_AUTORADIOBUTTON,13,297,101,12 - GROUPBOX "@S_HOSTNAME_BORDER",S_HOSTNAME_BORDER,123,264,204,48 - LTEXT "@S_HOSTNAME_INFO",S_HOSTNAME_INFO,129,275,191,19 - EDITTEXT E_HOST,129,295,118,13,ES_AUTOHSCROLL | ES_READONLY | NOT WS_BORDER - PUSHBUTTON "@B_CHANGE",B_CHANGE,252,293,67,15 - PUSHBUTTON "@B_WEB",B_WEB,332,261,72,30,BS_MULTILINE - DEFPUSHBUTTON "@IDCANCEL",IDCANCEL,331,296,73,16 - CONTROL 230,S_BMP_JA,"Static",SS_BITMAP,7,0,397,173 - ICON ICO_AZURE,IDC_STATIC,7,239,20,18 - LTEXT "STATUS_STRING",S_STATUS,22,287,95,9 - CONTROL "",IDC_STATIC,"Static",SS_ETCHEDHORZ,0,174,415,1 - CONTROL 232,S_BMP_CN,"Static",SS_BITMAP,7,0,397,173 -END - -D_SM_PROXY DIALOGEX 0, 0, 227, 153 -STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU -CAPTION "@D_SM_PROXY" -FONT 9, "MS Shell Dlg", 400, 0, 0x80 -BEGIN - ICON ICO_TOWER,IDC_STATIC,7,5,20,18 - LTEXT "@STATIC9",IDC_STATIC,33,5,187,17 - RTEXT "@STATIC10",IDC_STATIC,7,39,54,10 - CONTROL "@R_DIRECT_TCP",R_DIRECT_TCP,"Button",BS_AUTORADIOBUTTON | WS_TABSTOP,65,37,135,10 - CONTROL "@R_HTTPS",R_HTTPS,"Button",BS_AUTORADIOBUTTON,65,48,135,10 - CONTROL "@R_SOCKS",R_SOCKS,"Button",BS_AUTORADIOBUTTON,65,58,135,10 - CONTROL "@R_SOCKS5",R_SOCKS5,"Button",BS_AUTORADIOBUTTON,65,68,135,10 - PUSHBUTTON "@B_PROXY_CONFIG",B_PROXY_CONFIG,67,88,114,15 - DEFPUSHBUTTON "@IDOK",IDOK,87,132,64,15 - PUSHBUTTON "@IDCANCEL",IDCANCEL,156,132,64,15 -END - -D_VGC_LIST DIALOGEX 0, 0, 446, 303 -STYLE DS_SETFONT | DS_FIXEDSYS | WS_MAXIMIZEBOX | WS_POPUP | WS_CAPTION | WS_SYSMENU | WS_THICKFRAME -CAPTION "@D_VGC_LIST" -FONT 9, "MS Shell Dlg", 400, 0, 0x80 -BEGIN - ICON ICO_RESEARCH,IDC_STATIC,7,7,20,18 - LTEXT "@S_TITLE",S_TITLE,30,5,186,15 - LTEXT "@S_INFO1",S_INFO1,30,23,331,22 - LTEXT "STATIC",S_BOLD,8,55,352,10 - CONTROL "",L_LIST,"SysListView32",LVS_REPORT | LVS_SHOWSELALWAYS | LVS_SHAREIMAGELISTS | LVS_AUTOARRANGE | WS_BORDER | WS_TABSTOP,7,68,432,181 - DEFPUSHBUTTON "@IDOK",IDOK,276,275,163,22 - PUSHBUTTON "@B_PROXY",B_PROXY,7,274,62,16 - RTEXT "@S_VLAN",S_VLAN,69,277,81,13 - COMBOBOX C_VLAN,153,275,87,87,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP - PUSHBUTTON "@B_WEB",B_WEB,369,18,70,23,BS_MULTILINE - PUSHBUTTON "@B_REFRESH",B_REFRESH,369,47,70,16 - CONTROL "",IDC_PROGRESS1,"msctls_progress32",NOT WS_VISIBLE,372,53,63,9 - LTEXT "@S_REFRESH",S_REFRESH,375,43,71,8,NOT WS_VISIBLE - LTEXT "Implemented as a plug-in for SoftEther VPN. (c) VPN Gate Project at University of Tsukuba, Japan.",S_COPYRIGHT,7,293,268,7 - CONTROL 240,S_TSUKUBA,"Static",SS_BITMAP,397,2,44,13 - RTEXT "@S_RESEARCH",S_RESEARCH,219,5,174,11 - LTEXT "@S_INFO9",S_INFO9,7,251,432,23 -END - -D_VGC_PROTOCOL DIALOGEX 0, 0, 283, 148 -STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU -CAPTION "@D_VGC_PROTOCOL" -FONT 9, "MS Shell Dlg", 400, 0, 0x80 -BEGIN - LTEXT "@S_TITLE",S_TITLE,34,5,240,29 - LTEXT "@S_INFO",S_INFO,34,38,240,37 - CONTROL "@R_TCP",R_TCP,"Button",BS_AUTORADIOBUTTON | WS_TABSTOP,50,79,198,15 - CONTROL "@R_UDP",R_UDP,"Button",BS_AUTORADIOBUTTON,50,96,198,15 - DEFPUSHBUTTON "@IDOK",IDOK,136,125,64,17 - PUSHBUTTON "@IDCANCEL",IDCANCEL,204,125,64,17 - ICON ICO_SERVER_ONLINE,IDC_STATIC,7,5,20,18 -END - -D_VGS_CONFIG DIALOGEX 0, 0, 370, 311 -STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU -CAPTION "@D_VGS_CONFIG" -FONT 9, "MS Shell Dlg", 400, 0, 0x80 -BEGIN - CONTROL "@R_ENABLE",R_ENABLE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,33,227,330,13 - CONTROL 238,S_VPNGATEJA,"Static",SS_BITMAP,0,0,370,136 - ICON ICO_RESEARCH,IDC_STATIC,7,143,20,18 - LTEXT "@S_TITLE",S_TITLE,33,145,195,15 - LTEXT "@S_INFO1",S_INFO1,33,163,330,31 - LTEXT "@S_INFO9",S_INFO9,33,195,330,31 - ICON ICO_INFORMATION,IDC_STATIC,42,245,20,18 - LTEXT "@S_WARNING",S_WARNING,66,245,297,45 - PUSHBUTTON "@B_OPTION",B_OPTION,7,290,137,15 - DEFPUSHBUTTON "@IDOK",IDOK,230,290,64,15 - PUSHBUTTON "@IDCANCEL",IDCANCEL,299,290,64,15 - PUSHBUTTON "@B_WEB",B_WEB,228,143,135,15 - CONTROL 237,S_VPNGATEEN,"Static",SS_BITMAP,0,0,370,136 -END - -D_VGS_OPTION DIALOGEX 0, 0, 355, 295 -STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU -CAPTION "@D_VGS_OPTION" -FONT 9, "MS Shell Dlg", 400, 0, 0x80 -BEGIN - ICON ICO_RESEARCH,IDC_STATIC,7,5,20,18 - LTEXT "@S_TITLE",S_TITLE,33,5,315,19 - GROUPBOX "@S_2",S_2,7,29,341,128 - LTEXT "@S_1",S_1,41,41,293,30 - RTEXT "@S_3",S_3,14,74,114,10 - EDITTEXT E_OWNER,132,72,150,11,ES_AUTOHSCROLL - LTEXT "@S_19",S_19,287,74,56,11 - RTEXT "@S_20",S_20,14,89,114,16 - EDITTEXT E_ABUSE,132,93,150,11,ES_AUTOHSCROLL - LTEXT "@S_21",S_21,287,95,59,13 - ICON ICO_GROUP,IDC_STATIC,14,40,20,18 - RTEXT "@S_22",S_22,14,110,114,27 - EDITTEXT E_MSG,132,109,207,27,ES_MULTILINE | ES_AUTOVSCROLL | WS_VSCROLL - LTEXT "@S_23",S_23,132,139,208,16 - GROUPBOX "@S_24",S_24,7,160,341,112 - ICON ICO_MACHINE,IDC_STATIC,14,172,20,18 - CONTROL "@R_LOG",R_LOG,"Button",BS_AUTOCHECKBOX | WS_DISABLED | WS_TABSTOP,46,173,293,9 - CONTROL "@R_2WEEKS",R_2WEEKS,"Button",BS_AUTORADIOBUTTON | WS_TABSTOP,56,187,284,9 - CONTROL "@R_PERMANENT",R_PERMANENT,"Button",BS_AUTORADIOBUTTON,56,200,284,9 - CONTROL "@R_L2TP",R_L2TP,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,46,216,293,9 - LTEXT "@S_25",S_25,55,230,285,11 - PUSHBUTTON "@B_MESSAGE",B_MESSAGE,45,245,268,15 - DEFPUSHBUTTON "@IDOK",IDOK,215,275,64,15 - PUSHBUTTON "@IDCANCEL",IDCANCEL,284,275,64,15 -END - -D_VGS_WARNING DIALOGEX 0, 0, 349, 249 -STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU -CAPTION "@D_VGS_WARNING" -FONT 9, "MS Shell Dlg", 400, 0, 0x80 -BEGIN - ICON ICO_POLICE,IDC_STATIC,7,5,20,18 - LTEXT "@S1",S1,32,35,310,28 - LTEXT "@S2",S2,32,64,310,40 - LTEXT "@S3",S3,32,103,310,30 - LTEXT "@S4",S4,32,133,310,24 - LTEXT "@S5",S5,32,158,310,48 - CONTROL "@R_NEVER",R_NEVER,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,45,210,297,12 - PUSHBUTTON "@B_WEB",B_WEB,7,228,123,15 - DEFPUSHBUTTON "@IDOK",IDOK,209,228,64,15 - PUSHBUTTON "@IDCANCEL",IDCANCEL,278,228,64,15 - LTEXT "@S_BOLD",S_BOLD,32,5,310,27 - ICON ICO_RESEARCH,IDC_STATIC,7,158,20,18 -END - -D_NM_PUSH DIALOGEX 0, 0, 367, 251 -STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU -CAPTION "@D_NM_PUSH" -FONT 9, "MS Shell Dlg", 400, 0, 0x80 -BEGIN - ICON ICO_PROTOCOL,IDC_STATIC,7,5,18,18 - LTEXT "@S1",S1,35,9,325,24,WS_TABSTOP - LTEXT "@S2",S2,35,33,325,30 - LTEXT "@S3",S3,35,64,325,30 - LTEXT "@S4",S4,35,95,325,30 - GROUPBOX "@S5",S5,23,124,337,96 - EDITTEXT E_TEXT,35,173,315,36,ES_MULTILINE | WS_VSCROLL - LTEXT "@S6",IDC_STATIC,35,136,315,36 - DEFPUSHBUTTON "@IDOK",IDOK,222,228,64,17 - PUSHBUTTON "@IDCANCEL",IDCANCEL,296,228,64,17 - LTEXT "@S7",IDC_STATIC,35,233,185,12 -END - - -///////////////////////////////////////////////////////////////////////////// -// -// Icon -// - -// Icon with lowest ID value placed first to ensure application icon -// remains consistent on all systems. -ICO_TEST ICON "Test.ico" -ICO_KEY ICON "Key.ico" -ICO_CERT ICON "Cert.ico" -ICO_SERVER_ONLINE ICON "Server.ico" -ICO_WARNING ICON "Warning.ico" -ICO_NULL ICON "Null.ico" -ICO_TOWER ICON "Tower.ico" -ICO_VPN ICON "VPN.ico" -ICO_VPNSERVER ICON "VPNSvr.ico" -ICO_NIC_ONLINE ICON "NIC.ico" -ICO_SETUP ICON "Setup.ico" -ICO_MACHINE ICON "Machine.ico" -ICO_HUB ICON "Hub.ico" -ICO_VLAN ICON "VLan.ico" -ICO_SERVER_OFFLINE ICON "Server_Offline.ico" -ICO_NIC_OFFLINE ICON "NIC_Offline.ico" -ICO_INFORMATION ICON "Information.ico" -ICO_STOP ICON "Stop.ico" -ICO_SERVER_DELETE ICON "Server_Delete.ico" -ICO_SERVER_ONLINE_EX ICON "Server_Online_Ex.ico" -ICO_SERVER_OFFLINE_EX ICON "Server_Offline_Ex.ico" -ICO_INTERNET ICON "Internet.ico" -ICO_DISPLAY ICON "Display.ico" -ICO_GROUP ICON "Group.ico" -ICO_USER ICON "User.ico" -ICO_USER_ADMIN ICON "UserAdmin.ico" -ICO_HUB_OFFLINE ICON "Hub_Offline.ico" -ICO_FARM ICON "Farm.ico" -ICO_X ICON "X.ico" -ICO_PROTOCOL ICON "Protocol.ico" -ICO_PROTOCOL_X ICON "Protocol2.ico" -ICO_DISCARD ICON "Discard.ico" -ICO_PASS ICON "Pass.ico" -ICO_PROTOCOL_OFFLINE ICON "ProtocolOffline.ico" -ICO_MEMORY ICON "Memory.ico" -ICO_PKCS12 ICON "PKCS12.ico" -ICO_SERVER_CERT ICON "ServerCert.ico" -ICO_LINK ICON "Link.ico" -ICO_PENGUIN ICON "Penguin.ico" -ICO_LINK2 ICON "Link2.ico" -ICO_CASCADE ICON "Cascade.ico" -ICO_USER_DENY ICON "UserDeny.ico" -ICO_GROUP_DENY ICON "GroupDeny.ico" -ICO_LOG ICON "Log.ico" -ICO_LOG2 ICON "Log2.ico" -ICO_DATETIME ICON "DateTime.ico" -ICO_NEW ICON "New.ico" -ICO_PASS_DISABLE ICON "PassDisable.ico" -ICO_DISCARD_DISABLE ICON "DiscardDisable.ico" -ICO_CASCADE_ERROR ICON "CascadeOffline.ico" -ICO_CASCADE_OFFLINE ICON "CascadeOffline2.ico" -ICO_PROTOCOL_DHCP ICON "ProtocolDhcp.ico" -ICO_ROUTER ICON "Router.ico" -ICO_BRIDGE ICON "Bridge.ico" -ICO_SWITCH ICON "Switch.ico" -ICO_SWITCH_OFFLINE ICON "SwitchOffline.ico" -ICO_SECURE ICON "Secure.ico" -ICO_CERT_X ICON "CertX.ico" -ICO_INTERNET_X ICON "InternetX.ico" -ICO_LICENSE ICON "License.ico" -ICO_SESSION_BRIDGE ICON "SessionBridge.ico" -ICO_SESSION_MONITOR ICON "SessionMonitor.ico" -ICO_TRAY1 ICON "Tray1.ico" -ICO_TRAY2 ICON "Tray2.ico" -ICO_TRAY3 ICON "Tray3.ico" -ICO_TRAY4 ICON "Tray4.ico" -ICO_TRAY0 ICON "Tray0.ico" - -///////////////////////////////////////////////////////////////////////////// -// -// Bitmap -// - -BMP_TEST BITMAP "Test.bmp" -BMP_SECURE BITMAP "Secure.bmp" -BMP_SECURE2 BITMAP "Secure2.bmp" -BMP_MANAGER_LOGO BITMAP "ManagerLogo.bmp" -BMP_ROUTER_BANNER BITMAP "RouterBanner.bmp" -BMP_ROUTER_LOGO BITMAP "RouterLogo.bmp" -BMP_COINS BITMAP "Coins.bmp" -BMP_SECURE3 BITMAP "Secure3.bmp" -BMP_CLIENT_BANNER BITMAP "ClientBanner.bmp" -BMP_SETUP_2 BITMAP "setup_2.bmp" -BMP_SETUP_1 BITMAP "setup_1.bmp" -BMP_TSUKUBA BITMAP "Tsukuba.bmp" - -///////////////////////////////////////////////////////////////////////////// -// -// AVI -// - -AVI_PROGRESS AVI "Progress.avi" - -///////////////////////////////////////////////////////////////////////////// -// -// Menu -// - -M_MAIN MENU -BEGIN - POPUP "@CMD_TOP_CONNECT" - BEGIN - MENUITEM "@CMD_CONNECT", CMD_CONNECT - MENUITEM "@CMD_STATUS", CMD_STATUS - MENUITEM "@CMD_DISCONNECT", CMD_DISCONNECT - MENUITEM "@CMD_DISCONNECT_ALL", CMD_DISCONNECT_ALL - MENUITEM SEPARATOR - MENUITEM "@CMD_RECENT", CMD_RECENT - MENUITEM SEPARATOR - MENUITEM "@CMD_NEW", CMD_NEW - MENUITEM "@CMD_CLONE", CMD_CLONE - MENUITEM SEPARATOR - MENUITEM "@CMD_SHORTCUT", CMD_SHORTCUT - MENUITEM SEPARATOR - MENUITEM "@CMD_EXPORT_ACCOUNT", CMD_EXPORT_ACCOUNT - MENUITEM "@CMD_IMPORT_ACCOUNT", CMD_IMPORT_ACCOUNT - MENUITEM SEPARATOR - MENUITEM "@CMD_STARTUP", CMD_STARTUP - MENUITEM "@CMD_NOSTARTUP", CMD_NOSTARTUP - MENUITEM SEPARATOR - MENUITEM "@CMD_RENAME", CMD_RENAME - MENUITEM "@CMD_DELETE", CMD_DELETE - MENUITEM "@CMD_PROPERTY", CMD_PROPERTY - MENUITEM SEPARATOR - MENUITEM "@CMD_TRAYICON", CMD_TRAYICON - MENUITEM "@CMD_EXIT", CMD_EXIT - MENUITEM "@CMD_QUIT", CMD_QUIT - END - POPUP "@CMD_TOP_EDIT" - BEGIN - MENUITEM "@CMD_SELECT_ALL", CMD_SELECT_ALL - MENUITEM "@CMD_SWITCH_SELECT", CMD_SWITCH_SELECT - END - POPUP "@CMD_TOP_VIEW" - BEGIN - MENUITEM "@CMD_STATUSBAR", CMD_STATUSBAR - MENUITEM "@CMD_TRAYICON", CMD_TRAYICON - MENUITEM SEPARATOR - MENUITEM "@CMD_SHOWPORT", CMD_SHOWPORT - MENUITEM "@CMD_VISTASTYLE", CMD_VISTASTYLE - MENUITEM SEPARATOR - MENUITEM "@CMD_ICON", CMD_ICON - MENUITEM "@CMD_DETAIL", CMD_DETAIL - MENUITEM SEPARATOR - MENUITEM "@CMD_GRID", CMD_GRID - MENUITEM SEPARATOR - MENUITEM "@CMD_REFRESH", CMD_REFRESH - END - POPUP "@CMD_TOP_VLAN" - BEGIN - MENUITEM "@CMD_NEW_VLAN", CMD_NEW_VLAN - MENUITEM SEPARATOR - MENUITEM "@CMD_ENABLE_VLAN", CMD_ENABLE_VLAN - MENUITEM "@CMD_DISABLE_VLAN", CMD_DISABLE_VLAN - MENUITEM "@CMD_DELETE_VLAN", CMD_DELETE_VLAN - MENUITEM SEPARATOR - MENUITEM "@CMD_REINSTALL", CMD_REINSTALL - MENUITEM SEPARATOR - MENUITEM "@CMD_WINNET", CMD_WINNET - END - POPUP "@CMD_TOP_SECURE" - BEGIN - MENUITEM "@CMD_SECURE_MANAGER", CMD_SECURE_MANAGER - MENUITEM SEPARATOR - MENUITEM "@CMD_SECURE_SELECT", CMD_SECURE_SELECT - END - POPUP "@CMD_TOP_TOOL" - BEGIN - MENUITEM "@CMD_PASSWORD", CMD_PASSWORD - MENUITEM SEPARATOR - MENUITEM "@CMD_TRUST", CMD_TRUST - MENUITEM SEPARATOR - MENUITEM "@CMD_NETIF", CMD_NETIF - MENUITEM "@CMD_MMCSS", CMD_MMCSS - MENUITEM SEPARATOR - MENUITEM "@CMD_TRAFFIC", CMD_TRAFFIC - MENUITEM SEPARATOR - MENUITEM "@CMD_CM_SETTING", CMD_CM_SETTING - MENUITEM "@CMD_LANGUAGE", CMD_LANGUAGE - MENUITEM "@CMD_OPTION", CMD_OPTION - END - POPUP "@CMD_TOP_HELP" - BEGIN - MENUITEM "@CMD_ABOUT", CMD_ABOUT - END -END - -M_VOICE_BACKUP MENU -BEGIN - POPUP "@CMD_TOP_VOICE" - BEGIN - MENUITEM "@CMD_VOIDE_NONE", CMD_VOIDE_NONE - MENUITEM SEPARATOR - MENUITEM "@CMD_VOICE_NORMAL", CMD_VOICE_NORMAL - MENUITEM "@CMD_VOICE_ODD", CMD_VOICE_ODD - END -END - - -///////////////////////////////////////////////////////////////////////////// -// -// BIN -// - -BIN_WINPCAP BIN "Dummy.bin" -#endif // resources -///////////////////////////////////////////////////////////////////////////// - - -///////////////////////////////////////////////////////////////////////////// -// (xW) resources - -#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_CHT) -#ifdef _WIN32 -LANGUAGE LANG_CHINESE, SUBLANG_CHINESE_TRADITIONAL -#pragma code_page(950) -#endif //_WIN32 - -///////////////////////////////////////////////////////////////////////////// -// -// Icon -// - -// Icon with lowest ID value placed first to ensure application icon -// remains consistent on all systems. -ICO_LANG_TRADITIONAL_CHINESE ICON "LANG_TRADITIONAL_CHINESE.ico" -#endif // (xW) resources -///////////////////////////////////////////////////////////////////////////// - - -///////////////////////////////////////////////////////////////////////////// -// ^ () resources - -#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) -#ifdef _WIN32 -LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US -#pragma code_page(1252) -#endif //_WIN32 - -///////////////////////////////////////////////////////////////////////////// -// -// Icon -// - -// Icon with lowest ID value placed first to ensure application icon -// remains consistent on all systems. -ICO_IPSEC ICON "IPsec.ico" -ICO_DDNS ICON "DDNS.ico" -ICO_OPENVPN ICON "OpenVPN.ico" -ICO_SPECIALLISTENER ICON "SpecialListener.ico" -ICO_INSTALLER ICON "Installer.ico" -ICO_LANGUAGE ICON "Language.ico" -ICO_LANG_CHINESE ICON "LANG_CHINESE.ico" -ICO_LANG_ENGLISH ICON "LANG_ENGLISH.ico" -ICO_LANG_JAPANESE ICON "LANG_JAPANESE.ico" -ICO_EASYINSTALLER ICON "EasyInstaller.ico" -ICO_AZURE ICON "Azure.ico" -ICO_ZURUHAM ICON "ZuruHam.ico" -ICO_ZURUKKO ICON "Zurukko.ico" -ICO_RESEARCH ICON "Research.ico" -ICO_POLICE ICON "Police.ico" - -///////////////////////////////////////////////////////////////////////////// -// -// Bitmap -// - -BMP_ETHERIP BITMAP "EtherIP.bmp" -BMP_L2TP BITMAP "L2TP.bmp" -BMP_IX2015 BITMAP "IX2015.bmp" -BMP_OPENVPN BITMAP "OpenVPN.bmp" -BMP_SSTP BITMAP "SSTP.bmp" -BMP_SPECIALLISTENER BITMAP "SpecialListener.bmp" -BMP_SELOGO49x49 BITMAP "SELOGO49x49.bmp" -BMP_UT BITMAP "BMP_UT.bmp" -BMP_SW_LANG_1 BITMAP "SW_LANG_1.bmp" -BMP_SW_LANG_2 BITMAP "SW_LANG_2.bmp" -BMP_SW_LANG_3 BITMAP "SW_LANG_3.bmp" -BMP_VPNSERVER_FIGURE BITMAP "VPNServerFigure.bmp" -BMP_ABOUTBOX BITMAP "AboutBox.bmp" -BMP_UPDATE BITMAP "Update.bmp" -BMP_IBARAKI BITMAP "Ibaraki.bmp" -BMP_WINPC BITMAP "WinPC.bmp" -BMP_VMBRIDGE BITMAP "VMBridge.bmp" -BMP_AZURE BITMAP "Azure.bmp" -BMP_AZURE_JA BITMAP "AzureJa.bmp" -BMP_AZURE_CN BITMAP "AzureCn.bmp" -BMP_VPNGATEBANNER BITMAP "VPNGateBanner.bmp" -BMP_ZURUKKO BITMAP "Zurukko.bmp" -BMP_VPNGATEEN BITMAP "VPNGateEN.bmp" -BMP_VPNGATEJA BITMAP "VPNGateJA.bmp" -BMP_UNIVTSUKUBA BITMAP "UnivTsukuba.bmp" -#endif // ^ () resources -///////////////////////////////////////////////////////////////////////////// - - - -#ifndef APSTUDIO_INVOKED -///////////////////////////////////////////////////////////////////////////// -// -// Generated from the TEXTINCLUDE 3 resource. -// - - -///////////////////////////////////////////////////////////////////////////// -#endif // not APSTUDIO_INVOKED - +// Microsoft Visual C++ generated resource script. +// +#include "resource.h" + +#define APSTUDIO_READONLY_SYMBOLS +///////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 2 resource. +// +#include "winres.h" + +///////////////////////////////////////////////////////////////////////////// +#undef APSTUDIO_READONLY_SYMBOLS + +///////////////////////////////////////////////////////////////////////////// +// resources + +#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_JPN) +#ifdef _WIN32 +LANGUAGE LANG_JAPANESE, SUBLANG_DEFAULT +#pragma code_page(932) +#endif //_WIN32 + +#ifdef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// TEXTINCLUDE +// + +1 TEXTINCLUDE +BEGIN + "resource.h\0" +END + +2 TEXTINCLUDE +BEGIN + "#include ""winres.h""\r\n" + "\0" +END + +3 TEXTINCLUDE +BEGIN + "\r\n" + "\0" +END + +#endif // APSTUDIO_INVOKED + + +///////////////////////////////////////////////////////////////////////////// +// +// DESIGNINFO +// + +#ifdef APSTUDIO_INVOKED +GUIDELINES DESIGNINFO +BEGIN + D_SECURE, DIALOG + BEGIN + LEFTMARGIN, 7 + RIGHTMARGIN, 299 + TOPMARGIN, 5 + BOTTOMMARGIN, 166 + END + + D_PKCSUTIL, DIALOG + BEGIN + LEFTMARGIN, 7 + RIGHTMARGIN, 292 + TOPMARGIN, 5 + BOTTOMMARGIN, 246 + END + + D_PASSPHRASE, DIALOG + BEGIN + LEFTMARGIN, 7 + RIGHTMARGIN, 232 + TOPMARGIN, 5 + BOTTOMMARGIN, 72 + END + + D_NM_CONNECT, DIALOG + BEGIN + LEFTMARGIN, 7 + RIGHTMARGIN, 264 + TOPMARGIN, 5 + BOTTOMMARGIN, 44 + END + + D_PASSWORD, DIALOG + BEGIN + LEFTMARGIN, 7 + RIGHTMARGIN, 252 + TOPMARGIN, 5 + BOTTOMMARGIN, 178 + END + + D_STATUS, DIALOG + BEGIN + LEFTMARGIN, 7 + RIGHTMARGIN, 208 + TOPMARGIN, 5 + BOTTOMMARGIN, 51 + END + + D_CERT, DIALOG + BEGIN + LEFTMARGIN, 6 + RIGHTMARGIN, 264 + TOPMARGIN, 5 + BOTTOMMARGIN, 330 + END + + D_CHECKCERT, DIALOG + BEGIN + LEFTMARGIN, 7 + RIGHTMARGIN, 244 + TOPMARGIN, 5 + BOTTOMMARGIN, 252 + END + + D_CONNECTERROR, DIALOG + BEGIN + LEFTMARGIN, 7 + RIGHTMARGIN, 244 + TOPMARGIN, 5 + BOTTOMMARGIN, 177 + END + + D_CM_LOGIN, DIALOG + BEGIN + LEFTMARGIN, 7 + RIGHTMARGIN, 268 + TOPMARGIN, 5 + BOTTOMMARGIN, 109 + END + + D_CM_MAIN, DIALOG + BEGIN + LEFTMARGIN, 7 + RIGHTMARGIN, 251 + TOPMARGIN, 5 + BOTTOMMARGIN, 206 + END + + D_CONNECTION_STATUS, DIALOG + BEGIN + LEFTMARGIN, 7 + RIGHTMARGIN, 284 + TOPMARGIN, 5 + BOTTOMMARGIN, 224 + END + + D_CM_POLICY, DIALOG + BEGIN + LEFTMARGIN, 7 + RIGHTMARGIN, 296 + TOPMARGIN, 5 + BOTTOMMARGIN, 254 + END + + D_CM_ACCOUNT, DIALOG + BEGIN + LEFTMARGIN, 7 + RIGHTMARGIN, 444 + TOPMARGIN, 5 + BOTTOMMARGIN, 318 + END + + D_CM_PROXY, DIALOG + BEGIN + LEFTMARGIN, 7 + RIGHTMARGIN, 248 + TOPMARGIN, 5 + BOTTOMMARGIN, 126 + END + + D_CM_PROXY_HTTP_HEADER, DIALOG + BEGIN + LEFTMARGIN, 7 + RIGHTMARGIN, 248 + TOPMARGIN, 5 + BOTTOMMARGIN, 126 + END + + D_CM_DETAIL, DIALOG + BEGIN + LEFTMARGIN, 7 + RIGHTMARGIN, 427 + TOPMARGIN, 5 + BOTTOMMARGIN, 306 + END + + D_CM_NEW_VLAN, DIALOG + BEGIN + LEFTMARGIN, 7 + RIGHTMARGIN, 244 + TOPMARGIN, 5 + BOTTOMMARGIN, 93 + END + + D_CM_TRUST, DIALOG + BEGIN + LEFTMARGIN, 7 + RIGHTMARGIN, 328 + TOPMARGIN, 5 + BOTTOMMARGIN, 190 + END + + D_CM_PASSWORD, DIALOG + BEGIN + LEFTMARGIN, 7 + RIGHTMARGIN, 270 + TOPMARGIN, 5 + BOTTOMMARGIN, 154 + END + + D_CM_CONFIG, DIALOG + BEGIN + LEFTMARGIN, 7 + RIGHTMARGIN, 295 + TOPMARGIN, 5 + BOTTOMMARGIN, 336 + END + + D_ABOUT, DIALOG + BEGIN + LEFTMARGIN, 7 + RIGHTMARGIN, 326 + BOTTOMMARGIN, 304 + END + + D_REMOTE, DIALOG + BEGIN + LEFTMARGIN, 7 + RIGHTMARGIN, 268 + TOPMARGIN, 5 + BOTTOMMARGIN, 144 + END + + D_CM_DESKTOP, DIALOG + BEGIN + LEFTMARGIN, 7 + RIGHTMARGIN, 363 + VERTGUIDE, 31 + TOPMARGIN, 5 + BOTTOMMARGIN, 186 + END + + D_CM_CHANGE_PASSWORD, DIALOG + BEGIN + LEFTMARGIN, 7 + RIGHTMARGIN, 252 + TOPMARGIN, 5 + BOTTOMMARGIN, 207 + END + + D_SM_MAIN, DIALOG + BEGIN + RIGHTMARGIN, 274 + END + + D_SM_EDIT_SETTING, DIALOG + BEGIN + LEFTMARGIN, 7 + RIGHTMARGIN, 428 + TOPMARGIN, 5 + BOTTOMMARGIN, 258 + END + + D_SM_SERVER, DIALOG + BEGIN + LEFTMARGIN, 7 + RIGHTMARGIN, 432 + TOPMARGIN, 5 + END + + D_SM_STATUS, DIALOG + BEGIN + LEFTMARGIN, 7 + RIGHTMARGIN, 328 + TOPMARGIN, 5 + BOTTOMMARGIN, 245 + END + + D_SM_EDIT_HUB, DIALOG + BEGIN + LEFTMARGIN, 7 + RIGHTMARGIN, 424 + TOPMARGIN, 5 + BOTTOMMARGIN, 279 + END + + D_SM_CREATE_LISTENER, DIALOG + BEGIN + LEFTMARGIN, 7 + RIGHTMARGIN, 263 + TOPMARGIN, 5 + BOTTOMMARGIN, 132 + END + + D_SM_SSL, DIALOG + BEGIN + LEFTMARGIN, 7 + RIGHTMARGIN, 456 + TOPMARGIN, 5 + BOTTOMMARGIN, 307 + END + + D_SM_SAVE_KEY_PAIR, DIALOG + BEGIN + LEFTMARGIN, 7 + RIGHTMARGIN, 288 + TOPMARGIN, 5 + BOTTOMMARGIN, 293 + END + + D_SM_CONNECTION, DIALOG + BEGIN + LEFTMARGIN, 7 + RIGHTMARGIN, 311 + TOPMARGIN, 5 + BOTTOMMARGIN, 228 + END + + D_SM_FARM, DIALOG + BEGIN + LEFTMARGIN, 7 + RIGHTMARGIN, 252 + TOPMARGIN, 5 + BOTTOMMARGIN, 327 + END + + D_SM_FARM_MEMBER, DIALOG + BEGIN + LEFTMARGIN, 7 + RIGHTMARGIN, 408 + TOPMARGIN, 5 + BOTTOMMARGIN, 222 + END + + D_SM_CHANGE_PASSWORD, DIALOG + BEGIN + LEFTMARGIN, 7 + RIGHTMARGIN, 243 + TOPMARGIN, 5 + BOTTOMMARGIN, 90 + END + + D_SM_HUB, DIALOG + BEGIN + LEFTMARGIN, 7 + RIGHTMARGIN, 396 + TOPMARGIN, 5 + BOTTOMMARGIN, 301 + END + + D_SM_USER, DIALOG + BEGIN + LEFTMARGIN, 7 + RIGHTMARGIN, 447 + TOPMARGIN, 5 + BOTTOMMARGIN, 235 + END + + D_SM_EDIT_USER, DIALOG + BEGIN + LEFTMARGIN, 7 + RIGHTMARGIN, 448 + TOPMARGIN, 5 + BOTTOMMARGIN, 296 + END + + D_SM_POLICY, DIALOG + BEGIN + LEFTMARGIN, 7 + RIGHTMARGIN, 443 + TOPMARGIN, 5 + BOTTOMMARGIN, 287 + END + + D_SM_GROUP, DIALOG + BEGIN + LEFTMARGIN, 7 + RIGHTMARGIN, 327 + TOPMARGIN, 5 + BOTTOMMARGIN, 236 + END + + D_SM_EDIT_GROUP, DIALOG + BEGIN + LEFTMARGIN, 7 + RIGHTMARGIN, 236 + TOPMARGIN, 5 + BOTTOMMARGIN, 250 + END + + D_SM_ACCESS_LIST, DIALOG + BEGIN + LEFTMARGIN, 7 + RIGHTMARGIN, 444 + TOPMARGIN, 5 + BOTTOMMARGIN, 270 + END + + D_SM_EDIT_ACCESS, DIALOG + BEGIN + LEFTMARGIN, 7 + RIGHTMARGIN, 452 + TOPMARGIN, 5 + BOTTOMMARGIN, 347 + HORZGUIDE, 7 + END + + D_SM_RADIUS, DIALOG + BEGIN + LEFTMARGIN, 7 + RIGHTMARGIN, 276 + TOPMARGIN, 5 + BOTTOMMARGIN, 272 + END + + D_SM_LINK, DIALOG + BEGIN + LEFTMARGIN, 7 + RIGHTMARGIN, 416 + TOPMARGIN, 5 + BOTTOMMARGIN, 263 + END + + D_SM_LOG, DIALOG + BEGIN + LEFTMARGIN, 7 + RIGHTMARGIN, 272 + TOPMARGIN, 5 + BOTTOMMARGIN, 328 + END + + D_SM_CA, DIALOG + BEGIN + LEFTMARGIN, 7 + RIGHTMARGIN, 328 + TOPMARGIN, 5 + BOTTOMMARGIN, 189 + END + + D_SM_SESSION, DIALOG + BEGIN + LEFTMARGIN, 7 + RIGHTMARGIN, 446 + TOPMARGIN, 5 + BOTTOMMARGIN, 305 + END + + D_SM_MAC, DIALOG + BEGIN + LEFTMARGIN, 7 + RIGHTMARGIN, 444 + TOPMARGIN, 5 + BOTTOMMARGIN, 283 + END + + D_SM_IP, DIALOG + BEGIN + LEFTMARGIN, 7 + RIGHTMARGIN, 444 + TOPMARGIN, 5 + BOTTOMMARGIN, 283 + END + + D_SM_CREATE_CERT, DIALOG + BEGIN + LEFTMARGIN, 7 + RIGHTMARGIN, 294 + TOPMARGIN, 5 + BOTTOMMARGIN, 312 + END + + D_NM_LOGIN, DIALOG + BEGIN + LEFTMARGIN, 7 + RIGHTMARGIN, 268 + TOPMARGIN, 5 + BOTTOMMARGIN, 109 + END + + D_SPEEDMETER, DIALOG + BEGIN + LEFTMARGIN, 7 + RIGHTMARGIN, 312 + TOPMARGIN, 5 + BOTTOMMARGIN, 247 + END + + D_NM_MAIN, DIALOG + BEGIN + LEFTMARGIN, 7 + RIGHTMARGIN, 344 + TOPMARGIN, 5 + BOTTOMMARGIN, 320 + END + + D_NM_OPTION, DIALOG + BEGIN + LEFTMARGIN, 7 + RIGHTMARGIN, 412 + TOPMARGIN, 5 + BOTTOMMARGIN, 273 + END + + D_NM_NAT, DIALOG + BEGIN + LEFTMARGIN, 7 + RIGHTMARGIN, 444 + TOPMARGIN, 5 + BOTTOMMARGIN, 283 + END + + D_NM_DHCP, DIALOG + BEGIN + LEFTMARGIN, 7 + RIGHTMARGIN, 444 + TOPMARGIN, 5 + BOTTOMMARGIN, 283 + END + + D_NM_CHANGE_PASSWORD, DIALOG + BEGIN + LEFTMARGIN, 7 + RIGHTMARGIN, 243 + TOPMARGIN, 5 + BOTTOMMARGIN, 90 + END + + D_SM_SNAT, DIALOG + BEGIN + LEFTMARGIN, 7 + RIGHTMARGIN, 348 + TOPMARGIN, 5 + BOTTOMMARGIN, 267 + END + + D_SM_BRIDGE, DIALOG + BEGIN + LEFTMARGIN, 7 + RIGHTMARGIN, 360 + TOPMARGIN, 5 + BOTTOMMARGIN, 320 + END + + D_WIN9X_REBOOT, DIALOG + BEGIN + LEFTMARGIN, 7 + RIGHTMARGIN, 232 + TOPMARGIN, 5 + BOTTOMMARGIN, 84 + END + + D_DEFAULT1, DIALOG + BEGIN + LEFTMARGIN, 7 + RIGHTMARGIN, 179 + TOPMARGIN, 5 + BOTTOMMARGIN, 72 + END + + D_EM_MAIN, DIALOG + BEGIN + LEFTMARGIN, 7 + RIGHTMARGIN, 328 + TOPMARGIN, 5 + BOTTOMMARGIN, 175 + END + + D_EM_ADD, DIALOG + BEGIN + LEFTMARGIN, 7 + RIGHTMARGIN, 272 + TOPMARGIN, 5 + BOTTOMMARGIN, 292 + END + + D_EM_PASSWORD, DIALOG + BEGIN + LEFTMARGIN, 7 + RIGHTMARGIN, 243 + TOPMARGIN, 5 + BOTTOMMARGIN, 90 + END + + D_SM_CONFIG, DIALOG + BEGIN + LEFTMARGIN, 7 + RIGHTMARGIN, 376 + TOPMARGIN, 5 + BOTTOMMARGIN, 310 + END + + D_SM_ADMIN_OPTION, DIALOG + BEGIN + LEFTMARGIN, 7 + RIGHTMARGIN, 303 + TOPMARGIN, 5 + BOTTOMMARGIN, 302 + END + + D_SM_AO_VALUE, DIALOG + BEGIN + LEFTMARGIN, 7 + RIGHTMARGIN, 199 + TOPMARGIN, 5 + BOTTOMMARGIN, 63 + END + + D_SM_L3, DIALOG + BEGIN + LEFTMARGIN, 7 + RIGHTMARGIN, 284 + TOPMARGIN, 5 + BOTTOMMARGIN, 250 + END + + D_SM_L3_ADD, DIALOG + BEGIN + LEFTMARGIN, 7 + RIGHTMARGIN, 227 + TOPMARGIN, 5 + BOTTOMMARGIN, 84 + END + + D_SM_L3_SW, DIALOG + BEGIN + LEFTMARGIN, 7 + RIGHTMARGIN, 291 + TOPMARGIN, 5 + BOTTOMMARGIN, 315 + END + + D_SM_L3_SW_IF, DIALOG + BEGIN + LEFTMARGIN, 7 + RIGHTMARGIN, 252 + TOPMARGIN, 5 + BOTTOMMARGIN, 242 + END + + D_SM_L3_SW_TABLE, DIALOG + BEGIN + LEFTMARGIN, 7 + RIGHTMARGIN, 252 + TOPMARGIN, 5 + BOTTOMMARGIN, 219 + END + + D_CM_SELECT_SECURE, DIALOG + BEGIN + LEFTMARGIN, 7 + RIGHTMARGIN, 288 + TOPMARGIN, 5 + BOTTOMMARGIN, 209 + END + + D_CM_SECURE_MANAGER, DIALOG + BEGIN + LEFTMARGIN, 7 + RIGHTMARGIN, 288 + TOPMARGIN, 5 + BOTTOMMARGIN, 223 + END + + D_CM_SECURE_TYPE, DIALOG + BEGIN + LEFTMARGIN, 7 + RIGHTMARGIN, 188 + TOPMARGIN, 5 + BOTTOMMARGIN, 102 + END + + D_STRING, DIALOG + BEGIN + LEFTMARGIN, 7 + RIGHTMARGIN, 259 + TOPMARGIN, 5 + BOTTOMMARGIN, 99 + END + + D_SM_SELECT_KEYPAIR, DIALOG + BEGIN + LEFTMARGIN, 7 + RIGHTMARGIN, 194 + TOPMARGIN, 5 + BOTTOMMARGIN, 237 + END + + D_CM_LOAD_X, DIALOG + BEGIN + LEFTMARGIN, 7 + RIGHTMARGIN, 232 + TOPMARGIN, 5 + BOTTOMMARGIN, 174 + END + + D_CM_SECURE_PIN, DIALOG + BEGIN + LEFTMARGIN, 7 + RIGHTMARGIN, 256 + TOPMARGIN, 5 + BOTTOMMARGIN, 184 + END + + D_SM_CRL, DIALOG + BEGIN + LEFTMARGIN, 7 + RIGHTMARGIN, 328 + TOPMARGIN, 5 + BOTTOMMARGIN, 189 + END + + D_SM_EDIT_CRL, DIALOG + BEGIN + LEFTMARGIN, 7 + RIGHTMARGIN, 344 + TOPMARGIN, 5 + BOTTOMMARGIN, 307 + END + + D_SM_AC_LIST, DIALOG + BEGIN + LEFTMARGIN, 7 + RIGHTMARGIN, 302 + TOPMARGIN, 5 + BOTTOMMARGIN, 192 + END + + D_SM_AC, DIALOG + BEGIN + LEFTMARGIN, 7 + RIGHTMARGIN, 303 + TOPMARGIN, 5 + BOTTOMMARGIN, 261 + END + + D_SM_LOG_FILE, DIALOG + BEGIN + LEFTMARGIN, 7 + RIGHTMARGIN, 391 + TOPMARGIN, 5 + BOTTOMMARGIN, 286 + END + + D_SM_READ_LOG_FILE, DIALOG + BEGIN + LEFTMARGIN, 7 + RIGHTMARGIN, 280 + TOPMARGIN, 5 + BOTTOMMARGIN, 90 + END + + D_SM_SAVE_LOG, DIALOG + BEGIN + LEFTMARGIN, 7 + RIGHTMARGIN, 264 + TOPMARGIN, 5 + BOTTOMMARGIN, 65 + END + + D_TCP, DIALOG + BEGIN + LEFTMARGIN, 7 + RIGHTMARGIN, 324 + TOPMARGIN, 5 + BOTTOMMARGIN, 265 + END + + D_TCP_MSG, DIALOG + BEGIN + LEFTMARGIN, 7 + RIGHTMARGIN, 240 + TOPMARGIN, 5 + BOTTOMMARGIN, 172 + END + + D_CM_PKCSEULA, DIALOG + BEGIN + LEFTMARGIN, 7 + RIGHTMARGIN, 260 + TOPMARGIN, 5 + BOTTOMMARGIN, 130 + END + + D_CM_KAKUSHI, DIALOG + BEGIN + LEFTMARGIN, 7 + RIGHTMARGIN, 358 + TOPMARGIN, 5 + BOTTOMMARGIN, 228 + END + + D_CM_TRAFFIC, DIALOG + BEGIN + LEFTMARGIN, 7 + RIGHTMARGIN, 388 + TOPMARGIN, 5 + BOTTOMMARGIN, 303 + END + + D_CM_TRAFFIC_RUN, DIALOG + BEGIN + LEFTMARGIN, 7 + RIGHTMARGIN, 352 + TOPMARGIN, 5 + BOTTOMMARGIN, 253 + END + + D_CM_TRAFFIC_RESULT, DIALOG + BEGIN + LEFTMARGIN, 7 + RIGHTMARGIN, 323 + TOPMARGIN, 5 + BOTTOMMARGIN, 190 + END + + D_SM_LICENSE, DIALOG + BEGIN + LEFTMARGIN, 7 + RIGHTMARGIN, 420 + TOPMARGIN, 5 + BOTTOMMARGIN, 309 + END + + D_SM_LICENSE_ADD, DIALOG + BEGIN + LEFTMARGIN, 7 + RIGHTMARGIN, 352 + TOPMARGIN, 5 + BOTTOMMARGIN, 223 + END + + D_FREEINFO, DIALOG + BEGIN + LEFTMARGIN, 7 + RIGHTMARGIN, 316 + TOPMARGIN, 5 + BOTTOMMARGIN, 202 + END + + D_EM_LICENSE_ADD, DIALOG + BEGIN + LEFTMARGIN, 7 + RIGHTMARGIN, 352 + TOPMARGIN, 5 + BOTTOMMARGIN, 223 + END + + D_EM_LICENSE, DIALOG + BEGIN + LEFTMARGIN, 7 + RIGHTMARGIN, 420 + TOPMARGIN, 5 + BOTTOMMARGIN, 305 + END + + D_EM_REMOTE, DIALOG + BEGIN + LEFTMARGIN, 7 + RIGHTMARGIN, 268 + TOPMARGIN, 5 + BOTTOMMARGIN, 144 + END + + D_CM_SETTING, DIALOG + BEGIN + LEFTMARGIN, 7 + RIGHTMARGIN, 276 + TOPMARGIN, 5 + BOTTOMMARGIN, 285 + END + + D_SM_SETUP, DIALOG + BEGIN + LEFTMARGIN, 7 + RIGHTMARGIN, 440 + TOPMARGIN, 5 + BOTTOMMARGIN, 306 + END + + D_SM_SETUP_HUB, DIALOG + BEGIN + LEFTMARGIN, 7 + RIGHTMARGIN, 222 + TOPMARGIN, 5 + BOTTOMMARGIN, 81 + END + + D_SM_SETUP_STEP, DIALOG + BEGIN + LEFTMARGIN, 7 + RIGHTMARGIN, 322 + TOPMARGIN, 5 + BOTTOMMARGIN, 295 + END + + D_CPU64_WARNING, DIALOG + BEGIN + LEFTMARGIN, 7 + RIGHTMARGIN, 292 + TOPMARGIN, 5 + BOTTOMMARGIN, 148 + END + + D_ONCEMSG, DIALOG + BEGIN + LEFTMARGIN, 7 + RIGHTMARGIN, 244 + TOPMARGIN, 5 + BOTTOMMARGIN, 156 + END + + D_CONNECT, DIALOG + BEGIN + LEFTMARGIN, 7 + RIGHTMARGIN, 182 + TOPMARGIN, 5 + BOTTOMMARGIN, 62 + END + + D_SM_SIMULATION, DIALOG + BEGIN + LEFTMARGIN, 7 + RIGHTMARGIN, 274 + TOPMARGIN, 5 + BOTTOMMARGIN, 216 + END + + D_SM_EDIT_ACCESS_V6, DIALOG + BEGIN + LEFTMARGIN, 7 + RIGHTMARGIN, 452 + TOPMARGIN, 5 + BOTTOMMARGIN, 347 + HORZGUIDE, 7 + END + + D_SM_VLAN, DIALOG + BEGIN + LEFTMARGIN, 7 + RIGHTMARGIN, 308 + TOPMARGIN, 5 + BOTTOMMARGIN, 275 + END + + D_SM_MSG, DIALOG + BEGIN + LEFTMARGIN, 7 + RIGHTMARGIN, 268 + TOPMARGIN, 5 + BOTTOMMARGIN, 271 + END + + D_NICINFO, DIALOG + BEGIN + LEFTMARGIN, 7 + RIGHTMARGIN, 214 + TOPMARGIN, 5 + BOTTOMMARGIN, 86 + END + + D_SM_IPSEC, DIALOG + BEGIN + LEFTMARGIN, 7 + RIGHTMARGIN, 416 + TOPMARGIN, 5 + BOTTOMMARGIN, 302 + END + + D_SM_ETHERIP, DIALOG + BEGIN + LEFTMARGIN, 7 + RIGHTMARGIN, 404 + VERTGUIDE, 326 + TOPMARGIN, 5 + BOTTOMMARGIN, 239 + END + + D_SM_ETHERIP_ID, DIALOG + BEGIN + LEFTMARGIN, 7 + RIGHTMARGIN, 260 + TOPMARGIN, 5 + BOTTOMMARGIN, 222 + END + + D_SM_OPENVPN, DIALOG + BEGIN + LEFTMARGIN, 7 + RIGHTMARGIN, 420 + TOPMARGIN, 5 + BOTTOMMARGIN, 303 + END + + D_SM_DDNS, DIALOG + BEGIN + LEFTMARGIN, 7 + RIGHTMARGIN, 408 + TOPMARGIN, 5 + BOTTOMMARGIN, 282 + END + + D_SM_SPECIALLISTENER, DIALOG + BEGIN + LEFTMARGIN, 7 + RIGHTMARGIN, 350 + TOPMARGIN, 5 + BOTTOMMARGIN, 314 + END + + D_SM_REDIRECT, DIALOG + BEGIN + LEFTMARGIN, 7 + RIGHTMARGIN, 351 + TOPMARGIN, 5 + BOTTOMMARGIN, 306 + END + + D_SW_TEST1, DIALOG + BEGIN + LEFTMARGIN, 7 + RIGHTMARGIN, 316 + TOPMARGIN, 5 + BOTTOMMARGIN, 150 + END + + D_DUMMY, DIALOG + BEGIN + LEFTMARGIN, 7 + RIGHTMARGIN, 179 + TOPMARGIN, 5 + BOTTOMMARGIN, 72 + END + + D_SW_TEST2, DIALOG + BEGIN + LEFTMARGIN, 7 + RIGHTMARGIN, 168 + TOPMARGIN, 5 + BOTTOMMARGIN, 79 + END + + D_SW_DEFAULT, DIALOG + BEGIN + LEFTMARGIN, 7 + RIGHTMARGIN, 316 + TOPMARGIN, 5 + BOTTOMMARGIN, 150 + END + + D_SW_WELCOME, DIALOG + BEGIN + LEFTMARGIN, 7 + RIGHTMARGIN, 316 + TOPMARGIN, 5 + BOTTOMMARGIN, 150 + END + + D_SW_MODE, DIALOG + BEGIN + LEFTMARGIN, 7 + RIGHTMARGIN, 316 + TOPMARGIN, 5 + END + + D_SW_NOT_ADMIN, DIALOG + BEGIN + LEFTMARGIN, 7 + RIGHTMARGIN, 316 + TOPMARGIN, 5 + BOTTOMMARGIN, 150 + END + + D_SW_COMPONENTS, DIALOG + BEGIN + LEFTMARGIN, 7 + RIGHTMARGIN, 316 + TOPMARGIN, 5 + BOTTOMMARGIN, 150 + END + + D_SW_EULA, DIALOG + BEGIN + LEFTMARGIN, 7 + RIGHTMARGIN, 316 + TOPMARGIN, 5 + BOTTOMMARGIN, 150 + END + + D_SW_WARNING, DIALOG + BEGIN + LEFTMARGIN, 7 + RIGHTMARGIN, 316 + TOPMARGIN, 5 + BOTTOMMARGIN, 150 + END + + D_SW_DIR, DIALOG + BEGIN + LEFTMARGIN, 7 + RIGHTMARGIN, 316 + TOPMARGIN, 5 + BOTTOMMARGIN, 150 + END + + D_SW_READY, DIALOG + BEGIN + LEFTMARGIN, 7 + RIGHTMARGIN, 316 + TOPMARGIN, 5 + BOTTOMMARGIN, 150 + END + + D_SW_PERFORM, DIALOG + BEGIN + LEFTMARGIN, 7 + RIGHTMARGIN, 316 + TOPMARGIN, 5 + BOTTOMMARGIN, 150 + END + + D_SW_ERROR, DIALOG + BEGIN + LEFTMARGIN, 7 + RIGHTMARGIN, 316 + TOPMARGIN, 5 + BOTTOMMARGIN, 150 + END + + D_SW_FINISH, DIALOG + BEGIN + LEFTMARGIN, 7 + RIGHTMARGIN, 316 + TOPMARGIN, 5 + BOTTOMMARGIN, 150 + END + + D_SW_UNINST1, DIALOG + BEGIN + LEFTMARGIN, 7 + RIGHTMARGIN, 316 + TOPMARGIN, 5 + BOTTOMMARGIN, 150 + END + + D_SW_LANG1, DIALOG + BEGIN + LEFTMARGIN, 7 + RIGHTMARGIN, 316 + TOPMARGIN, 5 + BOTTOMMARGIN, 150 + END + + D_SW_EASY1, DIALOG + BEGIN + LEFTMARGIN, 7 + RIGHTMARGIN, 316 + TOPMARGIN, 5 + BOTTOMMARGIN, 150 + END + + D_SW_EASY2, DIALOG + BEGIN + LEFTMARGIN, 7 + RIGHTMARGIN, 316 + TOPMARGIN, 5 + BOTTOMMARGIN, 150 + END + + D_SW_WEB1, DIALOG + BEGIN + LEFTMARGIN, 7 + RIGHTMARGIN, 316 + TOPMARGIN, 5 + BOTTOMMARGIN, 150 + END + + D_SW_WEB2, DIALOG + BEGIN + LEFTMARGIN, 7 + RIGHTMARGIN, 316 + TOPMARGIN, 5 + BOTTOMMARGIN, 150 + END + + D_UPDATE_NOTICE, DIALOG + BEGIN + LEFTMARGIN, 7 + RIGHTMARGIN, 252 + TOPMARGIN, 5 + BOTTOMMARGIN, 199 + END + + D_UPDATE_CONFIG, DIALOG + BEGIN + LEFTMARGIN, 7 + RIGHTMARGIN, 300 + TOPMARGIN, 5 + BOTTOMMARGIN, 127 + END + + D_SM_VMBRIDGE, DIALOG + BEGIN + LEFTMARGIN, 7 + RIGHTMARGIN, 304 + TOPMARGIN, 5 + BOTTOMMARGIN, 264 + END + + D_SM_AZURE, DIALOG + BEGIN + LEFTMARGIN, 7 + RIGHTMARGIN, 404 + TOPMARGIN, 5 + BOTTOMMARGIN, 312 + END + + D_SM_PROXY, DIALOG + BEGIN + LEFTMARGIN, 7 + RIGHTMARGIN, 220 + TOPMARGIN, 5 + BOTTOMMARGIN, 138 + END + + D_VGC_LIST, DIALOG + BEGIN + LEFTMARGIN, 7 + RIGHTMARGIN, 439 + TOPMARGIN, 5 + BOTTOMMARGIN, 298 + END + + D_VGC_PROTOCOL, DIALOG + BEGIN + LEFTMARGIN, 7 + RIGHTMARGIN, 274 + TOPMARGIN, 5 + BOTTOMMARGIN, 143 + END + + D_VGS_CONFIG, DIALOG + BEGIN + LEFTMARGIN, 7 + RIGHTMARGIN, 363 + TOPMARGIN, 5 + BOTTOMMARGIN, 306 + END + + D_VGS_OPTION, DIALOG + BEGIN + LEFTMARGIN, 7 + RIGHTMARGIN, 348 + TOPMARGIN, 5 + BOTTOMMARGIN, 290 + END + + D_VGS_WARNING, DIALOG + BEGIN + LEFTMARGIN, 7 + RIGHTMARGIN, 342 + TOPMARGIN, 5 + BOTTOMMARGIN, 244 + END + + D_NM_PUSH, DIALOG + BEGIN + LEFTMARGIN, 7 + RIGHTMARGIN, 360 + TOPMARGIN, 5 + BOTTOMMARGIN, 246 + END +END +#endif // APSTUDIO_INVOKED + + +///////////////////////////////////////////////////////////////////////////// +// +// Dialog +// + +D_SECURE DIALOGEX 0, 0, 307, 172 +STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION +EXSTYLE WS_EX_APPWINDOW +CAPTION "@D_SECURE" +FONT 9, "MS Shell Dlg", 400, 0, 0x80 +BEGIN + CONTROL 107,S_IMAGE,"Static",SS_BITMAP,7,5,81,54 + LTEXT "@S_TITLE",S_TITLE,99,5,166,17 + LTEXT "%s",S_INSERT_SECURE,99,25,200,17 + CONTROL "@S_DEVICE_INFO",S_DEVICE_INFO,"Static",SS_LEFTNOWORDWRAP | WS_GROUP,106,59,173,23 + GROUPBOX "@IDS_STATIC1",IDS_STATIC1,99,47,189,39 + EDITTEXT E_PIN,106,101,180,12,ES_PASSWORD | ES_AUTOHSCROLL + LTEXT "@S_WARNING",S_WARNING,106,117,176,24 + DEFPUSHBUTTON "@IDOK",IDOK,186,149,54,16 + PUSHBUTTON "@IDCANCEL",IDCANCEL,245,149,54,16 + CONTROL "",A_PROGRESS,"SysAnimate32",ACS_TRANSPARENT | WS_TABSTOP,110,99,120,16,WS_EX_TRANSPARENT + LTEXT "S_STATUS",S_STATUS,106,116,193,18,NOT WS_VISIBLE + RTEXT "@S_PIN_CODE",S_PIN_CODE,40,101,64,11 + LTEXT "-- SOFTWARE TITLE --",S_SOFTWARE_TITLE,7,154,177,12 + CONTROL ICO_SESSION_BRIDGE,S_IMAGE2,"Static",SS_BITMAP,7,5,81,54 + CONTROL ICO_TRAY4,S_IMAGE_TSUKUBA,"Static",SS_BITMAP,7,5,81,54 +END + +D_PKCSUTIL DIALOGEX 0, 0, 299, 251 +STYLE DS_SETFONT | DS_FIXEDSYS | DS_CENTER | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "@D_PKCSUTIL" +FONT 9, "MS Shell Dlg", 400, 0, 0x80 +BEGIN + ICON ICO_CERT,IDC_STATIC,7,5,18,18 + LTEXT "@S_TITLE",S_TITLE,30,5,263,18 + LTEXT "@STATIC1",IDC_STATIC,31,33,245,34 + GROUPBOX "@STATIC2",IDC_STATIC,31,76,241,74 + LTEXT "@STATIC3",IDC_STATIC,38,86,227,31 + PUSHBUTTON "@B_WRITE",B_WRITE,199,125,65,17 + GROUPBOX "@STATIC4",IDC_STATIC,31,156,241,55 + LTEXT "@STATIC5",IDC_STATIC,38,167,227,17 + PUSHBUTTON "@B_ERASE",B_ERASE,199,187,65,17 + PUSHBUTTON "@IDCANCEL",IDCANCEL,212,230,80,16 + LTEXT "@S_COPYRIGHT",S_COPYRIGHT,7,219,195,27 +END + +D_PASSPHRASE DIALOGEX 0, 0, 239, 77 +STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "@D_PASSPHRASE" +FONT 9, "MS Shell Dlg", 400, 0, 0x80 +BEGIN + ICON ICO_KEY,IDC_STATIC,7,5,20,18 + LTEXT "@STATIC1",IDC_STATIC,28,5,194,25 + RTEXT "@STATIC2",IDC_STATIC,7,37,55,10 + EDITTEXT E_PASSPHRASE,67,35,156,11,ES_PASSWORD | ES_AUTOHSCROLL + DEFPUSHBUTTON "@IDOK",IDOK,126,56,50,16 + PUSHBUTTON "@IDCANCEL",IDCANCEL,182,56,50,16 +END + +D_NM_CONNECT DIALOGEX 0, 0, 271, 49 +STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION +CAPTION "@D_NM_CONNECT" +FONT 9, "MS Shell Dlg", 400, 0, 0x80 +BEGIN + ICON ICO_ROUTER,IDC_STATIC,7,13,20,18 + LTEXT "@S_TITLE",S_TITLE,33,19,231,24 +END + +D_PASSWORD DIALOGEX 0, 0, 259, 183 +STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU +EXSTYLE WS_EX_APPWINDOW +CAPTION "@D_PASSWORD" +FONT 9, "MS Shell Dlg", 400, 0, 0x80 +BEGIN + ICON ICO_KEY,IDC_STATIC,7,5,20,18 + LTEXT "@S_TITLE",S_TITLE,31,11,221,25 + GROUPBOX "@STATIC1",IDC_STATIC,21,39,209,88 + RTEXT "@STATIC2",IDC_STATIC,32,55,60,11 + COMBOBOX C_TYPE,99,53,108,48,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP + RTEXT "@STATIC3",IDC_STATIC,32,74,60,10 + EDITTEXT E_USERNAME,99,72,108,11,ES_AUTOHSCROLL + RTEXT "@STATIC4",IDC_STATIC,32,93,60,10 + EDITTEXT E_PASSWORD,99,91,108,11,ES_PASSWORD | ES_AUTOHSCROLL + CONTROL "@R_NO_SAVE_PASSWORD",R_NO_SAVE_PASSWORD,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,99,108,120,9 + LTEXT "@S_COUNTDOWN",S_COUNTDOWN,21,130,207,13 + CONTROL "",P_PROGRESS,"msctls_progress32",WS_BORDER,21,145,209,8 + DEFPUSHBUTTON "@IDOK",IDOK,133,162,50,15 + PUSHBUTTON "@IDCANCEL",IDCANCEL,189,162,63,15 +END + +D_STATUS DIALOGEX 0, 0, 215, 56 +STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | DS_CENTER | WS_POPUP | WS_CAPTION | WS_SYSMENU +EXSTYLE WS_EX_APPWINDOW +CAPTION "@D_STATUS" +FONT 9, "MS Shell Dlg", 400, 0, 0x80 +BEGIN + ICON ICO_SERVER_ONLINE,IDC_STATIC,7,5,20,18 + LTEXT "@S_STATUS",S_STATUS,31,5,177,28 + DEFPUSHBUTTON "@IDCANCEL",IDCANCEL,81,36,50,14 +END + +D_CERT DIALOGEX 0, 0, 271, 335 +STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "@D_CERT" +FONT 9, "MS Shell Dlg", 400, 0, 0x80 +BEGIN + ICON ICO_CERT,IDC_STATIC,6,5,20,18 + LTEXT "@S_TITLE",S_TITLE,32,5,232,15 + GROUPBOX "@STATIC1",IDC_STATIC,6,28,258,59 + RTEXT "@STATIC2",IDC_STATIC,41,41,39,9 + EDITTEXT E_SUBJECT,85,41,164,11,ES_AUTOHSCROLL | ES_READONLY | NOT WS_BORDER + RTEXT "@STATIC3",IDC_STATIC,41,54,39,10 + EDITTEXT E_ISSUER,85,54,164,11,ES_AUTOHSCROLL | ES_READONLY | NOT WS_BORDER + RTEXT "@STATIC4",IDC_STATIC,41,67,39,9 + EDITTEXT E_EXPIRES,85,67,128,11,ES_AUTOHSCROLL | ES_READONLY | NOT WS_BORDER + GROUPBOX "@STATIC5",IDC_STATIC,6,93,258,155 + CONTROL "",L_CERTINFO,"SysListView32",LVS_REPORT | LVS_SHOWSELALWAYS | LVS_SHAREIMAGELISTS | LVS_EDITLABELS | LVS_ALIGNLEFT | WS_BORDER | WS_TABSTOP,21,110,229,84 + GROUPBOX "@STATIC6",IDC_STATIC1,6,252,258,55 + ICON ICO_CERT,S_CERT_ICON,22,268,20,18 + LTEXT "@S_PARENT",S_PARENT,46,270,150,18 + PUSHBUTTON "",B_PARENT,220,264,29,23,BS_ICON + CTEXT "@S_PARENT_BUTTON_STR",S_PARENT_BUTTON_STR,205,292,55,9 + DEFPUSHBUTTON "@IDCANCEL",IDCANCEL,214,314,50,15 + ICON ICO_WARNING,S_WARNING_ICON,22,269,20,18 + EDITTEXT E_DETAIL,21,197,228,42,ES_MULTILINE | ES_NOHIDESEL | ES_READONLY | WS_VSCROLL + PUSHBUTTON "@B_SAVE",B_SAVE,128,314,76,15 +END + +D_CHECKCERT DIALOGEX 0, 0, 251, 257 +STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU +EXSTYLE WS_EX_APPWINDOW +CAPTION "@D_CHECKCERT" +FONT 9, "MS Shell Dlg", 400, 0, 0x80 +BEGIN + ICON ICO_WARNING,IDC_STATIC,7,5,20,18 + LTEXT "@S_TITLE",S_TITLE,33,5,211,30 + GROUPBOX "@STATIC1",IDC_STATIC,7,41,237,170 + LTEXT "@STATIC2",IDC_STATIC,14,52,222,23 + ICON ICO_SERVER_ONLINE,IDC_STATIC,17,83,20,18 + LTEXT "@S_MSG1",S_MSG1,42,83,193,23 + RTEXT "@STATIC3",IDC_STATIC,14,106,69,11 + EDITTEXT E_SUBJECT,88,106,149,11,ES_AUTOHSCROLL | ES_READONLY | NOT WS_BORDER + RTEXT "@STATIC4",IDC_STATIC,15,119,68,10 + EDITTEXT E_ISSUER,88,119,149,11,ES_AUTOHSCROLL | ES_READONLY | NOT WS_BORDER + RTEXT "@STATIC5",IDC_STATIC,15,131,68,10 + EDITTEXT E_EXPIRES,88,131,149,11,ES_AUTOHSCROLL | ES_READONLY | NOT WS_BORDER + PUSHBUTTON "@B_SHOW",B_SHOW,158,172,76,15 + LTEXT "@STATIC9",IDC_STATIC,7,211,237,25 + RTEXT "@STATIC6",IDC_STATIC,16,144,67,9 + EDITTEXT E_MD5,88,144,148,11,ES_AUTOHSCROLL | ES_READONLY | NOT WS_BORDER + RTEXT "@STATIC7",IDC_STATIC,14,158,69,11 + EDITTEXT E_SHA1,88,158,148,11,ES_AUTOHSCROLL | ES_READONLY | NOT WS_BORDER + DEFPUSHBUTTON "@IDOK",IDOK,38,237,80,15 + PUSHBUTTON "@IDCANCEL",IDCANCEL,127,237,80,15 + LTEXT "@STATIC8",IDC_STATIC,15,191,221,17 +END + +D_CONNECTERROR DIALOGEX 0, 0, 251, 182 +STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU +EXSTYLE WS_EX_APPWINDOW +CAPTION "@D_CONNECTERROR" +FONT 9, "MS Shell Dlg", 400, 0, 0x80 +BEGIN + ICON ICO_SERVER_OFFLINE,IDC_STATIC,7,5,20,18 + LTEXT "@S_TITLE",S_TITLE,31,5,213,21 + EDITTEXT E_ERROR,31,27,197,64,ES_MULTILINE | ES_READONLY | ES_WANTRETURN | NOT WS_BORDER + LTEXT "@S_COUNTDOWN",S_COUNTDOWN,23,106,207,20 + CONTROL "",P_PROGRESS,"msctls_progress32",WS_BORDER,23,128,209,8 + DEFPUSHBUTTON "@IDOK",IDOK,125,161,50,15 + PUSHBUTTON "@IDCANCEL",IDCANCEL,181,161,63,15 + LTEXT "---",S_RETRYINFO,23,94,207,12 + CONTROL "@R_HIDE",R_HIDE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,23,140,214,17 +END + +D_CM_LOGIN DIALOGEX 0, 0, 275, 114 +STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "@D_CM_LOGIN" +FONT 9, "MS Shell Dlg", 400, 0, 0x80 +BEGIN + ICON ICO_KEY,IDC_STATIC,7,5,20,18 + LTEXT "@S_TITLE",S_TITLE,31,5,237,30 + RTEXT "@STATIC1",IDC_STATIC,33,59,49,11 + EDITTEXT E_PASSWORD,87,58,141,11,ES_PASSWORD | ES_AUTOHSCROLL + GROUPBOX "@STATIC2",IDC_STATIC,26,40,222,43 + DEFPUSHBUTTON "@IDOK",IDOK,158,95,52,14 + PUSHBUTTON "@IDCANCEL",IDCANCEL,216,95,52,14 +END + +D_CM_MAIN DIALOGEX 0, 0, 258, 211 +STYLE DS_SETFONT | DS_FIXEDSYS | WS_MINIMIZEBOX | WS_MAXIMIZEBOX | WS_CAPTION | WS_SYSMENU | WS_THICKFRAME +EXSTYLE WS_EX_APPWINDOW +CAPTION "PacketiX VPN Main Window" +MENU M_MAIN +FONT 9, "MS Shell Dlg", 400, 0, 0x80 +BEGIN + CONTROL "",L_ACCOUNT,"SysListView32",LVS_REPORT | LVS_SHOWSELALWAYS | LVS_SHAREIMAGELISTS | LVS_AUTOARRANGE | LVS_EDITLABELS | WS_BORDER | WS_TABSTOP,7,5,244,123 + CONTROL "",L_VLAN,"SysListView32",LVS_REPORT | LVS_SHOWSELALWAYS | LVS_SHAREIMAGELISTS | LVS_AUTOARRANGE | WS_BORDER | WS_TABSTOP,7,131,244,74 +END + +D_CONNECTION_STATUS DIALOGEX 0, 0, 291, 229 +STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "@D_CONNECTION_STATUS" +FONT 9, "MS Shell Dlg", 400, 0, 0x80 +BEGIN + ICON ICO_TOWER,IDC_STATIC,7,5,20,18 + LTEXT "@S_TITLE",S_TITLE,28,5,256,23 + CONTROL "",L_STATUS,"SysListView32",LVS_REPORT | LVS_SHAREIMAGELISTS | LVS_AUTOARRANGE | WS_BORDER | WS_TABSTOP,7,33,277,171 + PUSHBUTTON "@B_POLICY",B_POLICY,7,209,73,15 + PUSHBUTTON "@B_SERVER_CERT",B_SERVER_CERT,88,209,65,15 + PUSHBUTTON "@B_CLIENT_CERT",B_CLIENT_CERT,161,209,65,15 + DEFPUSHBUTTON "@IDCANCEL",IDCANCEL,234,209,50,15 +END + +D_CM_POLICY DIALOGEX 0, 0, 303, 259 +STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "@D_CM_POLICY" +FONT 9, "MS Shell Dlg", 400, 0, 0x80 +BEGIN + ICON ICO_MACHINE,IDC_STATIC,7,5,18,18 + LTEXT "@S_TITLE",S_TITLE,34,11,262,17 + CONTROL "",L_POLICY,"SysListView32",LVS_REPORT | LVS_SINGLESEL | LVS_SHOWSELALWAYS | LVS_SHAREIMAGELISTS | LVS_AUTOARRANGE | WS_BORDER | WS_TABSTOP,7,33,289,155 + DEFPUSHBUTTON "@IDCANCEL",IDCANCEL,246,239,50,15 + EDITTEXT S_DESCRIPTION,7,191,289,45,ES_MULTILINE | ES_AUTOVSCROLL | ES_READONLY | ES_WANTRETURN | WS_VSCROLL +END + +D_CM_ACCOUNT DIALOGEX 0, 0, 451, 333 +STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "@D_CM_ACCOUNT" +FONT 9, "MS Shell Dlg", 400, 0, 0x80 +BEGIN + ICON ICO_SERVER_ONLINE,IDC_STATIC,7,5,20,18 + LTEXT "@STATIC1",S_STATIC1,29,5,186,24 + RTEXT "@S_ACCOUNT_NAME",S_ACCOUNT_NAME,7,32,61,11 + EDITTEXT E_ACCOUNT_NAME,72,30,126,11,ES_AUTOHSCROLL + GROUPBOX "@STATIC2",S_STATIC2,7,43,206,90 + ICON ICO_VPNSERVER,IDC_STATIC,14,55,20,18 + LTEXT "@STATIC3",S_STATIC3,40,55,166,25 + RTEXT "@STATIC4",S_STATIC4,14,86,54,9 + EDITTEXT E_HOSTNAME,72,84,126,11,ES_AUTOHSCROLL + RTEXT "@STATIC5",S_STATIC5,14,101,54,9 + COMBOBOX C_PORT,72,98,77,42,CBS_DROPDOWN | WS_VSCROLL | WS_TABSTOP + CONTROL "@R_DISABLE_NATT",R_DISABLE_NATT,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,152,100,57,9 + LTEXT "@STATIC6",S_STATIC66,172,136,46,10,NOT WS_VISIBLE + RTEXT "@STATIC7",S_STATIC7,14,117,54,9 + COMBOBOX C_HUBNAME,72,113,126,62,CBS_DROPDOWN | CBS_SORT | WS_VSCROLL | WS_TABSTOP + GROUPBOX "@STATIC8",IDC_STATIC,7,137,206,103 + ICON ICO_TOWER,IDC_STATIC,14,149,20,18 + LTEXT "@STATIC9",IDC_STATIC,40,149,163,17 + PUSHBUTTON "@B_IE",B_IE,74,158,114,15 + RTEXT "@STATIC10",IDC_STATIC,14,175,54,9 + CONTROL "@R_DIRECT_TCP",R_DIRECT_TCP,"Button",BS_AUTORADIOBUTTON | WS_TABSTOP,72,173,135,10 + CONTROL "@R_HTTPS",R_HTTPS,"Button",BS_AUTORADIOBUTTON,72,184,135,10 + CONTROL "@R_SOCKS",R_SOCKS,"Button",BS_AUTORADIOBUTTON,72,194,135,10 + CONTROL "@R_SOCKS5",R_SOCKS5,"Button",BS_AUTORADIOBUTTON,72,204,135,10 + PUSHBUTTON "@B_PROXY_CONFIG",B_PROXY_CONFIG,74,218,114,15 + GROUPBOX "@STATIC11",S_STATIC11,7,245,206,69 + ICON ICO_CERT,IDC_STATIC,14,255,20,18 + CONTROL "@R_CHECK_CERT",R_CHECK_CERT,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,41,259,133,9 + PUSHBUTTON "@B_TRUST",B_TRUST,41,273,157,15 + PUSHBUTTON "@B_SERVER_CERT",B_SERVER_CERT,41,291,77,15 + PUSHBUTTON "@B_VIEW_SERVER_CERT",B_VIEW_SERVER_CERT,123,291,75,15 + CONTROL "@R_HIDE",R_HIDE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,7,318,148,9 + CONTROL "@R_HIDE2",R_HIDE2,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,158,318,132,9 + CONTROL "",L_VLAN,"SysListView32",LVS_REPORT | LVS_SINGLESEL | LVS_SHOWSELALWAYS | LVS_SHAREIMAGELISTS | LVS_NOCOLUMNHEADER | LVS_NOSORTHEADER | WS_BORDER | WS_TABSTOP,233,17,200,66 + GROUPBOX "@S_VLAN_GROUP",S_VLAN_GROUP,224,5,220,88 + LTEXT "@S_POLICY_1",S_POLICY_1,258,17,163,24,NOT WS_VISIBLE + PUSHBUTTON "@B_POLICY",B_POLICY,343,45,77,15,NOT WS_VISIBLE + ICON ICO_CASCADE,S_POLICY_2,233,17,20,18,NOT WS_VISIBLE + GROUPBOX "@STATIC12",IDC_STATIC,223,98,221,108 + ICON ICO_KEY,IDC_STATIC,230,108,20,18 + LTEXT "@STATIC15",IDC_STATIC,251,108,185,18 + RTEXT "@STATIC13",IDC_STATIC,237,131,48,9 + COMBOBOX C_TYPE,289,129,126,65,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP + RTEXT "@S_USERNAME",S_USERNAME,230,147,54,9 + EDITTEXT E_USERNAME,289,145,126,11,ES_AUTOHSCROLL + RTEXT "@S_PASSWORD",S_PASSWORD,230,161,54,9,NOT WS_VISIBLE + ICON ICO_CERT,S_CERT,248,158,20,18 + LTEXT "@S_CERT_INFO",S_CERT_INFO,272,160,160,24 + EDITTEXT E_PASSWORD,289,160,126,11,ES_PASSWORD | ES_AUTOHSCROLL | NOT WS_VISIBLE + CTEXT "@S_CHANGE_PASSWORD",S_CHANGE_PASSWORD,244,173,187,10 + PUSHBUTTON "VIEW_CLIENT_CERT",B_VIEW_CLIENT_CERT,246,184,90,15 + PUSHBUTTON "@B_REGIST_CLIENT_CERT",B_REGIST_CLIENT_CERT,341,184,90,15 + PUSHBUTTON "@B_CHANGE_PASSWORD",B_CHANGE_PASSWORD,341,184,90,15 + GROUPBOX "@STATIC14",IDC_STATIC,223,212,221,86 + ICON ICO_MACHINE,IDC_STATIC,230,224,20,18 + CONTROL "@R_RETRY",R_RETRY,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,253,225,184,9 + RTEXT "@S_RETRY_NUM_1",S_RETRY_NUM_1,253,239,61,9 + EDITTEXT E_RETRY_NUM,318,237,41,11,ES_RIGHT | ES_AUTOHSCROLL | ES_NUMBER + LTEXT "@S_RETRY_NUM_2",S_RETRY_NUM_2,364,239,73,8 + RTEXT "@S_RETRY_SPAN_1",S_RETRY_SPAN_1,228,252,86,9 + EDITTEXT E_RETRY_SPAN,318,251,41,11,ES_RIGHT | ES_AUTOHSCROLL | ES_NUMBER + LTEXT "@S_RETRY_SPAN_2",S_RETRY_SPAN_2,364,252,72,9 + CONTROL "@R_INFINITE",R_INFINITE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,266,265,171,9 + PUSHBUTTON "@B_DETAIL",B_DETAIL,344,277,87,15 + DEFPUSHBUTTON "@IDOK",IDOK,308,310,64,17 + PUSHBUTTON "@IDCANCEL",IDCANCEL,380,310,64,17 + CONTROL 178,S_ROUTER_LOGO,"Static",SS_BITMAP | NOT WS_VISIBLE,358,5,86,89 +END + +D_CM_PROXY DIALOGEX 0, 0, 255, 131 +STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "@D_CM_PROXY" +FONT 9, "MS Shell Dlg", 400, 0, 0x80 +BEGIN + ICON ICO_TOWER,IDC_STATIC,7,5,20,18 + LTEXT "@STATIC1",IDC_STATIC,26,5,222,25 + RTEXT "@STATIC2",IDC_STATIC,7,38,74,9 + EDITTEXT E_HOSTNAME,85,36,126,11,ES_AUTOHSCROLL + RTEXT "@STATIC3",IDC_STATIC,7,53,74,8 + COMBOBOX C_PORT,85,50,48,42,CBS_DROPDOWN | WS_VSCROLL | WS_TABSTOP + RTEXT "@STATIC4",IDC_STATIC,7,70,74,10 + EDITTEXT E_USERNAME,85,68,99,11,ES_AUTOHSCROLL + RTEXT "@STATIC5",IDC_STATIC,7,86,74,9 + EDITTEXT E_PASSWORD,85,84,99,11,ES_PASSWORD | ES_AUTOHSCROLL + PUSHBUTTON "@B_HTTP_HEADER", B_HTTP_HEADER, 7, 110, 100, 15, 0, WS_EX_LEFT + DEFPUSHBUTTON "@IDOK",IDOK,115,110,64,15 + PUSHBUTTON "@IDCANCEL",IDCANCEL,184,110,64,15 + LTEXT "@STATIC6",IDC_STATIC,191,70,57,12 + LTEXT "@STATIC7",IDC_STATIC,191,86,57,11 +END + +D_CM_PROXY_HTTP_HEADER DIALOGEX 0, 0, 255, 131 +STYLE DS_MODALFRAME | DS_SHELLFONT | WS_CAPTION | WS_POPUP | WS_SYSMENU +CAPTION "@D_CM_PROXY_HTTP_HEADER" +FONT 9, "MS Shell Dlg", 400, 0, 0x80 +{ + DEFPUSHBUTTON "@IDOK", IDOK, 115, 110, 64, 15, 0, WS_EX_LEFT + PUSHBUTTON "@IDCANCEL", IDCANCEL, 184, 110, 64, 15, 0, WS_EX_LEFT + CONTROL "", L_VALUES_LIST, "SysListView32", LVS_REPORT | LVS_SINGLESEL | LVS_SHOWSELALWAYS | LVS_NOSORTHEADER | WS_BORDER | WS_TABSTOP, 7, 5, 186, 100, WS_EX_LEFT + PUSHBUTTON "@B_NEW", B_NEW, 198, 5, 50, 15, 0, WS_EX_LEFT + PUSHBUTTON "@B_DELETE", B_DELETE, 198, 25, 50, 15, 0, WS_EX_LEFT + PUSHBUTTON "@B_CLEAR", B_CLEAR, 198, 60, 50, 15, 0, WS_EX_LEFT +} + +D_CM_DETAIL DIALOGEX 0, 0, 435, 312 +STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "@D_CM_DETAIL" +FONT 9, "MS Shell Dlg", 400, 0, 0x80 +BEGIN + ICON ICO_MACHINE,IDC_STATIC,7,5,18,18 + LTEXT "@STATIC1",IDC_STATIC,33,5,394,20 + GROUPBOX "@STATIC2",S_STATIC2,7,32,205,274 + ICON ICO_NIC_ONLINE,IDC_STATIC,15,44,18,18 + LTEXT "@STATIC3",S_STATIC3,39,44,167,24 + LTEXT "@STATIC4",S_STATIC4,15,71,130,9 + COMBOBOX C_NUM_TCP,39,83,33,95,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP + LTEXT "@STATIC5",S_STATIC5,78,85,125,9 + LTEXT "@STATIC6",S_STATIC6,39,98,165,16 + LTEXT "@STATIC7",S_STATIC7,15,118,130,9 + RTEXT "@STATIC8",S_STATIC8,15,131,106,9 + EDITTEXT E_INTERVAL,125,129,40,11,ES_RIGHT | ES_AUTOHSCROLL | ES_NUMBER + LTEXT "@STATIC9",S_STATIC9,169,131,38,8 + CONTROL "@R_USE_DISCONNECT",R_USE_DISCONNECT,"Button",BS_AUTOCHECKBOX | BS_MULTILINE | WS_TABSTOP,39,146,160,16 + RTEXT "@STATIC10",S_STATIC10,15,166,105,8 + EDITTEXT E_DISCONNECT_SPAN,125,164,40,11,ES_RIGHT | ES_AUTOHSCROLL | ES_NUMBER + LTEXT "@STATIC11",S_STATIC11,169,166,40,9 + LTEXT "@STATIC12",S_STATIC12,15,182,190,67 + CONTROL "@R_USE_HALF_CONNECTION",R_USE_HALF_CONNECTION,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,39,251,160,9 + CONTROL "",IDC_STATIC,"Static",SS_ETCHEDHORZ,14,266,190,30 + LTEXT "@STATIC19",S_STATIC19,18,271,184,17 + CONTROL "@R_DISABLE_QOS",R_DISABLE_QOS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,39,290,161,10 + GROUPBOX "@STATIC13",S_STATIC133,222,32,205,122 + ICON ICO_KEY,IDC_STATIC,230,40,18,18 + LTEXT "@STATIC14",IDC_STATIC,254,40,167,32 + CONTROL "@R_USE_ENCRYPT",R_USE_ENCRYPT,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,254,74,160,9 + ICON ICO_VPN,IDC_STATIC,230,89,18,18 + LTEXT "@S_UDPACCEL",IDC_STATIC,254,89,167,30 + CONTROL "@R_USE_COMPRESS",R_USE_COMPRESS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,254,120,160,9 + CONTROL "@R_DISABLE_UDP",R_DISABLE_UDP,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,254,137,160,9 + GROUPBOX "@STATIC16",IDC_STATIC,222,158,205,63 + LTEXT "@S_MODE",S_MODE,254,169,166,17 + CONTROL "@R_BRIDGE",R_BRIDGE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,254,191,166,9 + CONTROL "@R_MONITOR",R_MONITOR,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,254,205,166,9 + GROUPBOX "@STATIC17",IDC_STATIC,222,225,205,30 + CONTROL "@R_NO_ROUTING",R_NO_ROUTING,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,233,238,181,9 + ICON ICO_WARNING,S_WARNING_ICON,223,261,18,18 + LTEXT "@STATIC18",IDC_STATIC,247,261,180,26 + DEFPUSHBUTTON "@IDOK",IDOK,294,291,64,15 + PUSHBUTTON "@IDCANCEL",IDCANCEL,363,291,64,15 + ICON ICO_SWITCH,IDC_STATIC,230,169,18,18 +END + +D_CM_NEW_VLAN DIALOGEX 0, 0, 251, 98 +STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "@D_CM_NEW_VLAN" +FONT 9, "MS Shell Dlg", 400, 0, 0x80 +BEGIN + ICON ICO_NIC_ONLINE,IDC_STATIC,7,5,18,18 + LTEXT "@S_INFO",S_INFO,32,8,212,24 + RTEXT "@STATIC1",IDC_STATIC,7,38,93,9 + EDITTEXT E_NAME,105,36,120,11,ES_AUTOHSCROLL + DEFPUSHBUTTON "@IDOK",IDOK,112,77,64,15 + PUSHBUTTON "@IDCANCEL",IDCANCEL,180,77,64,15 + LTEXT "@S_WIN8",S_WIN8,7,55,237,21,NOT WS_VISIBLE +END + +D_CM_TRUST DIALOGEX 0, 0, 335, 195 +STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "@D_CM_TRUST" +FONT 9, "MS Shell Dlg", 400, 0, 0x80 +BEGIN + ICON ICO_CERT,IDC_STATIC,7,5,20,18 + LTEXT "@STATIC1",IDC_STATIC,33,5,295,38 + CONTROL "",L_CERT,"SysListView32",LVS_REPORT | LVS_SHOWSELALWAYS | LVS_SHAREIMAGELISTS | WS_BORDER | WS_TABSTOP,7,44,321,122 + PUSHBUTTON "@B_IMPORT",B_IMPORT,7,174,55,15 + PUSHBUTTON "@B_EXPORT",B_EXPORT,66,174,54,15 + DEFPUSHBUTTON "@IDOK",IDOK,187,174,62,15 + PUSHBUTTON "@IDCANCEL",IDCANCEL,255,174,73,15 + PUSHBUTTON "@B_DELETE",B_DELETE,126,174,54,15 +END + +D_CM_PASSWORD DIALOGEX 0, 0, 277, 159 +STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "@D_CM_PASSWORD" +FONT 9, "MS Shell Dlg", 400, 0, 0x80 +BEGIN + ICON ICO_KEY,IDC_STATIC,7,5,20,18 + LTEXT "@S_TITLE",S_TITLE,29,5,241,32 + GROUPBOX "@STATIC1",IDC_STATIC,26,40,222,89 + CONTROL "@R_USE_PASSWORD",R_USE_PASSWORD,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,36,54,190,9 + CONTROL "@R_REMOTE_ONLY",R_REMOTE_ONLY,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,36,69,190,9 + RTEXT "@IDC_STATIC1",IDC_STATIC1,33,89,49,9 + EDITTEXT E_PASSWORD,87,87,141,11,ES_PASSWORD | ES_AUTOHSCROLL + RTEXT "@IDC_STATIC2",IDC_STATIC2,33,106,49,9 + EDITTEXT E_PASSWORD2,87,104,141,11,ES_PASSWORD | ES_AUTOHSCROLL + DEFPUSHBUTTON "@IDOK",IDOK,158,139,52,14 + PUSHBUTTON "@IDCANCEL",IDCANCEL,218,139,52,14 +END + +D_CM_CONFIG DIALOGEX 0, 0, 303, 341 +STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "@D_CM_CONFIG" +FONT 9, "MS Shell Dlg", 400, 0, 0x80 +BEGIN + ICON ICO_MACHINE,IDC_STATIC,7,5,20,18 + LTEXT "@STATIC1",IDC_STATIC,32,5,263,17 + GROUPBOX "@STATIC2",IDC_STATIC,7,34,288,81 + ICON ICO_VPN,IDC_STATIC,14,46,20,18 + LTEXT "@STATIC3",IDC_STATIC,41,47,246,15 + CONTROL "@R_ALLOW_REMOTE_CONFIG",R_ALLOW_REMOTE_CONFIG,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,41,69,232,11 + LTEXT "@S_WARNING",S_WARNING,41,80,246,33 + GROUPBOX "@STATIC7",IDC_STATIC,7,120,288,139 + ICON ICO_INTERNET,IDC_STATIC,14,132,20,18 + LTEXT "@STATIC4",IDC_STATIC,41,133,246,25 + CONTROL "@R_USE_KEEP_CONNECT",R_USE_KEEP_CONNECT,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,41,160,232,11 + RTEXT "@S_HOSTNAME",S_HOSTNAME,16,177,63,9 + EDITTEXT E_HOSTNAME,82,175,139,11,ES_AUTOHSCROLL + RTEXT "@S_PORT",S_PORT,16,194,63,9 + EDITTEXT E_PORT,82,192,36,11,ES_AUTOHSCROLL | ES_NUMBER + RTEXT "@S_INTERVAL",S_INTERVAL,131,194,63,10 + EDITTEXT E_INTERVAL,197,192,36,11,ES_AUTOHSCROLL | ES_NUMBER + LTEXT "@S_INTERVAL2",S_INTERVAL2,239,194,47,9 + RTEXT "@S_PROTOCOL",S_PROTOCOL,16,211,63,9 + CONTROL "@R_TCP",R_TCP,"Button",BS_AUTORADIOBUTTON,85,211,74,9 + CONTROL "@R_UDP",R_UDP,"Button",BS_AUTORADIOBUTTON,171,211,75,9 + LTEXT "@S_INFO",S_INFO,41,227,246,31 + ICON ICO_INFORMATION,S_INFO2,14,222,20,18 + DEFPUSHBUTTON "@IDOK",IDOK,162,320,64,15 + PUSHBUTTON "@IDCANCEL",IDCANCEL,231,320,64,15 + GROUPBOX "@STATIC5",IDC_STATIC,7,266,288,47 + CONTROL "@R_ALPHA",R_ALPHA,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,41,284,105,11 + EDITTEXT E_ALPHA_VALUE,150,283,27,11,ES_AUTOHSCROLL | ES_NUMBER + LTEXT "%",IDC_STATIC,185,285,8,10 + LTEXT "@STATIC6",IDC_STATIC,43,299,243,8 + ICON ICO_SETUP,S_INFO3,14,281,20,18 +END + +D_ABOUT DIALOGEX 0, 0, 333, 309 +STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "@D_ABOUT" +FONT 9, "MS Shell Dlg", 400, 0, 0x80 +BEGIN + DEFPUSHBUTTON "@IDCANCEL",IDCANCEL,250,290,76,16 + CONTROL 224,S_LOGO,"Static",SS_BITMAP,7,5,319,66 + LTEXT "@S_INFO1",S_INFO1,7,71,240,15 + PUSHBUTTON "@B_AUTHORS",B_AUTHORS,251,71,75,16 + LTEXT "@S_INFO2",S_INFO2,7,86,319,34 + LTEXT "@S_INFO4",S_INFO4,7,122,319,53 + CONTROL "",IDC_STATIC,"Static",SS_ETCHEDHORZ,7,180,319,1 + LTEXT "@S_INFO3",S_INFO3,7,185,319,84 + PUSHBUTTON "@B_EULA",B_EULA,7,269,74,16 + PUSHBUTTON "@B_IMPORTANT",B_IMPORTANT,88,269,74,16 + PUSHBUTTON "@B_LEGAL",B_LEGAL,169,269,74,16 + PUSHBUTTON "Lan&guage Settings",B_LANGUAGE,250,269,75,16 + PUSHBUTTON "@B_WEB",B_WEB,7,290,130,16 + PUSHBUTTON "@B_UPDATE_CONFIG",B_UPDATE_CONFIG,142,290,96,16 +END + +D_REMOTE DIALOGEX 0, 0, 275, 149 +STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "@D_REMOTE" +FONT 9, "MS Shell Dlg", 400, 0, 0x80 +BEGIN + ICON ICO_TEST,S_ICON,7,5,20,18 + LTEXT "S_TITLE",S_TITLE,31,5,237,55 + GROUPBOX "@STATIC1",-1,26,66,222,53 + CONTROL "@R_LOCAL",R_LOCAL,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,40,78,200,15 + RTEXT "@S_HOSTNAME",S_HOSTNAME,28,98,54,11 + DEFPUSHBUTTON "@IDOK",IDOK,158,130,52,14 + PUSHBUTTON "@IDCANCEL",IDCANCEL,216,130,52,14 + COMBOBOX C_HOSTNAME,86,96,150,91,CBS_DROPDOWN | WS_VSCROLL | WS_TABSTOP +END + +D_CM_DESKTOP DIALOGEX 0, 0, 370, 191 +STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "@D_CM_DESKTOP" +FONT 9, "MS Shell Dlg", 400, 0, 0x80 +BEGIN + ICON ICO_DISPLAY,IDC_STATIC,7,5,18,18 + LTEXT "@S_TITLE",S_TITLE,31,11,332,23 + LTEXT "@S_WARNING",S_WARNING,31,35,332,20 + LTEXT "",S_MSG_1,31,55,332,27 + LTEXT "",S_MSG_2,31,84,332,28 + LTEXT "",S_MSG_3,31,115,332,38 + LTEXT "@S_INFO",S_INFO,31,156,332,14 + DEFPUSHBUTTON "@IDOK",IDOK,253,172,52,14 + PUSHBUTTON "@IDCANCEL",IDCANCEL,311,172,52,14 +END + +D_CM_CHANGE_PASSWORD DIALOGEX 0, 0, 259, 212 +STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU +EXSTYLE WS_EX_APPWINDOW +CAPTION "@D_CM_CHANGE_PASSWORD" +FONT 9, "MS Shell Dlg", 400, 0, 0x80 +BEGIN + ICON ICO_KEY,IDC_STATIC,7,5,20,18 + LTEXT "@S_TITLE",S_TITLE,31,11,221,25 + GROUPBOX "@STATIC1",IDC_STATIC,21,39,209,127 + RTEXT "@STATIC2",IDC_STATIC,32,55,60,10 + EDITTEXT E_HUBNAME,99,53,108,11,ES_AUTOHSCROLL | WS_DISABLED + RTEXT "@STATIC3",IDC_STATIC,32,74,60,10 + EDITTEXT E_USERNAME,99,72,108,11,ES_AUTOHSCROLL + RTEXT "@STATIC4",IDC_STATIC,32,93,60,10 + EDITTEXT E_OLD_PASSWORD,99,91,108,11,ES_PASSWORD | ES_AUTOHSCROLL + RTEXT "@STATIC5",IDC_STATIC,31,112,60,8 + EDITTEXT E_NEW_PASSWORD1,99,110,108,11,ES_PASSWORD | ES_AUTOHSCROLL + RTEXT "@STATIC6",IDC_STATIC,31,129,60,17 + EDITTEXT E_NEW_PASSWORD2,99,129,108,11,ES_PASSWORD | ES_AUTOHSCROLL + DEFPUSHBUTTON "@IDOK",IDOK,120,191,63,15 + PUSHBUTTON "@IDCANCEL",IDCANCEL,189,191,63,15 + LTEXT "@S_STATIC",S_STATIC,21,170,231,16 +END + +D_SM_MAIN DIALOGEX 0, 0, 275, 309 +STYLE DS_SETFONT | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU +EXSTYLE WS_EX_APPWINDOW +CAPTION "@D_SM_MAIN" +FONT 9, "MS Shell Dlg", 400, 0, 0x80 +BEGIN + CONTROL 141,IDC_STATIC,"Static",SS_BITMAP,0,0,275,46 + GROUPBOX "@STATIC1",IDC_STATIC,6,53,261,187 + ICON ICO_VPNSERVER,IDC_STATIC,14,67,20,20 + LTEXT "@STATIC2",IDC_STATIC,41,67,218,29 + CONTROL "",L_SETTING,"SysListView32",LVS_REPORT | LVS_SHOWSELALWAYS | LVS_SHAREIMAGELISTS | LVS_AUTOARRANGE | LVS_EDITLABELS | WS_BORDER | WS_TABSTOP,15,96,242,96 + PUSHBUTTON "@B_NEW_SETTING",B_NEW_SETTING,15,197,76,14 + PUSHBUTTON "@B_EDIT_SETTING",B_EDIT_SETTING,98,197,76,14 + PUSHBUTTON "@B_DELETE",B_DELETE,181,197,76,14 + PUSHBUTTON "@IDOK",IDOK,181,217,76,17 + ICON ICO_CERT,IDC_STATIC,147,246,20,20 + PUSHBUTTON "@B_CERT_TOOL",B_CERT_TOOL,171,248,86,14 + ICON ICO_SECURE,S_SMARTCARD_ICON,45,266,18,18 + PUSHBUTTON "@B_SECURE_MANAGER",B_SECURE_MANAGER,67,269,96,14 + PUSHBUTTON "@B_SELECT_SECURE",B_SELECT_SECURE,171,269,86,14 + PUSHBUTTON "@B_ABOUT",B_ABOUT,14,288,76,14 + PUSHBUTTON "@IDCANCEL",IDCANCEL,98,288,159,14 +END + +D_SM_EDIT_SETTING DIALOGEX 0, 0, 435, 273 +STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "@D_SM_EDIT_SETTING" +FONT 9, "MS Shell Dlg", 400, 0, 0x80 +BEGIN + ICON ICO_SERVER_ONLINE,IDC_STATIC,7,5,20,18 + LTEXT "@STATIC1",IDC_STATIC,32,12,396,11 + RTEXT "@STATIC2",IDC_STATIC,7,28,61,10 + EDITTEXT E_ACCOUNT_NAME,72,26,126,11,ES_AUTOHSCROLL + GROUPBOX "@STATIC3",IDC_STATIC,7,43,206,87 + ICON ICO_VPNSERVER,IDC_STATIC,14,55,20,18 + LTEXT "@STATIC4",IDC_STATIC,40,55,166,25 + RTEXT "@STATIC5",IDC_STATIC,14,86,54,11 + EDITTEXT E_HOSTNAME,72,84,126,11,ES_AUTOHSCROLL + CONTROL "@R_LOCALHOST",R_LOCALHOST,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,72,98,122,9 + RTEXT "@STATIC6",IDC_STATIC,14,113,54,11 + COMBOBOX C_PORT,72,110,81,42,CBS_DROPDOWN | WS_VSCROLL | WS_TABSTOP + LTEXT "@STATIC7",IDC_STATIC,159,113,46,10 + GROUPBOX "@STATIC8",IDC_STATIC,7,144,206,103 + ICON ICO_TOWER,IDC_STATIC,14,156,20,18 + LTEXT "@STATIC9",IDC_STATIC,40,156,163,17 + RTEXT "@STATIC10",IDC_STATIC,14,182,54,10 + CONTROL "@R_DIRECT_TCP",R_DIRECT_TCP,"Button",BS_AUTORADIOBUTTON | WS_TABSTOP,72,180,135,10 + CONTROL "@R_HTTPS",R_HTTPS,"Button",BS_AUTORADIOBUTTON,72,191,135,10 + CONTROL "@R_SOCKS",R_SOCKS,"Button",BS_AUTORADIOBUTTON,72,201,135,10 + CONTROL "@R_SOCKS5",R_SOCKS5,"Button",BS_AUTORADIOBUTTON,72,211,135,10 + PUSHBUTTON "@B_PROXY_CONFIG",B_PROXY_CONFIG,74,225,114,15 + GROUPBOX "@STATIC11",IDC_STATIC,222,43,206,193 + ICON ICO_USER_ADMIN,IDC_STATIC,229,55,20,18 + LTEXT "@STATIC12",IDC_STATIC,255,55,165,81 + CONTROL "@R_SERVER_ADMIN",R_SERVER_ADMIN,"Button",BS_AUTORADIOBUTTON,239,138,82,12 + CONTROL "@R_HUB_ADMIN",R_HUB_ADMIN,"Button",BS_AUTORADIOBUTTON,324,138,85,12 + RTEXT "@S_HUBNAME",S_HUBNAME,224,161,61,12 + COMBOBOX C_HUBNAME,288,158,126,78,CBS_DROPDOWN | CBS_SORT | WS_VSCROLL | WS_TABSTOP + ICON ICO_KEY,IDC_STATIC,230,185,20,18 + LTEXT "@STATIC13",IDC_STATIC,251,188,177,16 + RTEXT "@S_PASSWORD",S_PASSWORD,227,208,60,9 + EDITTEXT E_PASSWORD,289,206,126,11,ES_PASSWORD | ES_AUTOHSCROLL + CONTROL "@R_NO_SAVE",R_NO_SAVE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,290,223,127,9 + DEFPUSHBUTTON "@IDOK",IDOK,291,250,64,17 + PUSHBUTTON "@IDCANCEL",IDCANCEL,364,250,64,17 + CONTROL "",IDC_STATIC,"Static",SS_ETCHEDHORZ,233,179,183,1 +END + +D_SM_SERVER DIALOGEX 0, 0, 439, 314 +STYLE DS_SETFONT | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "@D_SM_SERVER" +FONT 9, "MS Shell Dlg", 400, 0, 0x80 +BEGIN + ICON ICO_VPNSERVER,IDC_STATIC,7,5,20,18 + LTEXT "@S_TITLE",S_TITLE,31,5,322,22 + CONTROL "",L_HUB,"SysListView32",LVS_REPORT | LVS_SHOWSELALWAYS | LVS_SHAREIMAGELISTS | LVS_AUTOARRANGE | WS_BORDER | WS_TABSTOP,14,28,410,96 + DEFPUSHBUTTON "@IDOK",IDOK,14,129,84,16 + PUSHBUTTON "@B_ONLINE",B_ONLINE,101,129,48,16 + PUSHBUTTON "@B_OFFLINE",B_OFFLINE,153,129,47,16 + PUSHBUTTON "@B_HUB_STATUS",B_HUB_STATUS,203,129,54,16 + PUSHBUTTON "@B_CREATE",B_CREATE,261,129,70,16 + PUSHBUTTON "@B_EDIT",B_EDIT,334,129,48,16 + PUSHBUTTON "@B_DELETE",B_DELETE,385,129,39,16 + GROUPBOX "@STATIC1",IDC_STATIC,7,149,176,106 + LTEXT "@STATIC2",IDC_STATIC,14,160,108,9 + CONTROL "",L_LISTENER,"SysListView32",LVS_REPORT | LVS_SHOWSELALWAYS | LVS_SHAREIMAGELISTS | LVS_AUTOARRANGE | WS_BORDER | WS_TABSTOP,14,172,109,48 + PUSHBUTTON "@B_CREATE_LISTENER",B_CREATE_LISTENER,128,172,48,12 + PUSHBUTTON "@B_DELETE_LISTENER",B_DELETE_LISTENER,128,184,48,12 + PUSHBUTTON "@B_START",B_START,128,196,48,12 + PUSHBUTTON "@B_STOP",B_STOP,128,208,48,12 + GROUPBOX "@STATIC3",IDC_STATIC,187,149,245,106 + ICON ICO_KEY,IDC_STATIC,194,161,20,18 + PUSHBUTTON "@B_SSL",B_SSL,218,163,100,16 + ICON ICO_TOWER,IDC_STATIC,194,183,20,18 + PUSHBUTTON "@B_STATUS",B_STATUS,218,185,100,16 + ICON ICO_VPNSERVER,IDC_STATIC,194,205,20,18 + PUSHBUTTON "@B_INFO",B_INFO,218,206,100,21,BS_MULTILINE + ICON ICO_CERT,S_LICENSE,194,231,20,18 + PUSHBUTTON "@B_LICENSE",B_LICENSE,218,233,100,16 + ICON ICO_FARM,IDC_STATIC,323,162,20,18 + PUSHBUTTON "@B_FARM",B_FARM,344,162,81,16,BS_MULTILINE + ICON ICO_INTERNET,IDC_STATIC,323,185,20,18 + PUSHBUTTON "@B_FARM_STATUS",B_FARM_STATUS,344,185,81,16,BS_MULTILINE + ICON ICO_PROTOCOL,IDC_STATIC,323,205,20,18 + PUSHBUTTON "@B_CONNECTION",B_CONNECTION,344,206,81,21,BS_MULTILINE + ICON ICO_MACHINE,IDC_STATIC,323,231,20,18 + PUSHBUTTON "@B_CONFIG",B_CONFIG,344,233,81,16 + ICON ICO_BRIDGE,IDC_STATIC,7,257,20,18 + PUSHBUTTON "@B_BRIDGE",B_BRIDGE,28,260,71,16 + ICON ICO_SWITCH,IDC_STATIC,108,257,20,18 + PUSHBUTTON "@B_L3",B_L3,129,260,74,16 + ICON ICO_IPSEC,IDC_STATIC,206,257,20,18 + PUSHBUTTON "@B_IPSEC",B_IPSEC,227,260,77,16 + ICON ICO_OPENVPN,IDC_STATIC,310,258,20,18 + PUSHBUTTON "@B_OPENVPN",B_OPENVPN,334,260,97,16 + ICON ICO_DISPLAY,IDC_STATIC,7,280,20,18 + PUSHBUTTON "@B_DDNS",B_DDNS,28,281,71,16 + RTEXT "@S_DDNS",S_DDNS,0,303,75,9 + EDITTEXT E_DDNS_HOST,78,301,114,13,ES_AUTOHSCROLL | ES_READONLY | NOT WS_BORDER + CTEXT "@S_BETA",S_BETA,193,234,126,15 + PUSHBUTTON "@B_AZURE",B_AZURE,129,281,74,16 + RTEXT "@S_AZURE",S_AZURE,196,303,65,9 + EDITTEXT E_AZURE_HOST,266,301,126,13,ES_AUTOHSCROLL | ES_READONLY | NOT WS_BORDER + ICON ICO_RESEARCH,S_ICO_VPNGATE,206,280,20,18 + PUSHBUTTON "@B_VPNGATE",B_VPNGATE,227,281,77,16 + PUSHBUTTON "@B_REFRESH",B_REFRESH,307,281,71,16 + PUSHBUTTON "@IDCANCEL",IDCANCEL,381,281,50,16 + ICON ICO_AZURE,IDC_STATIC,108,281,20,18 + EDITTEXT E_UDP,14,224,109,12,ES_AUTOHSCROLL + LTEXT "@S_UDP",S_UDP,14,238,162,16 + PUSHBUTTON "@B_APPLY",B_APPLY,128,224,48,12 +END + +D_SM_STATUS DIALOGEX 0, 0, 335, 250 +STYLE DS_SETFONT | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "@D_SM_STATUS" +FONT 9, "MS Shell Dlg", 400, 0, 0x80 +BEGIN + ICON ICO_INFORMATION,S_ICON,7,5,18,18 + LTEXT "S_TITLE",S_TITLE,30,5,298,25 + CONTROL "",L_STATUS,"SysListView32",LVS_REPORT | LVS_SHOWSELALWAYS | LVS_SHAREIMAGELISTS | LVS_AUTOARRANGE | WS_BORDER | WS_TABSTOP,7,33,321,188 + DEFPUSHBUTTON "@IDOK",IDOK,177,228,80,16 + PUSHBUTTON "@IDCANCEL",IDCANCEL,265,228,63,16 +END + +D_SM_EDIT_HUB DIALOGEX 0, 0, 431, 285 +STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "@D_SM_EDIT_HUB" +FONT 9, "MS Shell Dlg", 400, 0, 0x80 +BEGIN + ICON ICO_HUB,IDC_STATIC,7,5,18,18 + RTEXT "@STATIC1",IDC_STATIC,31,15,54,12 + EDITTEXT E_HUBNAME,90,13,115,11,ES_AUTOHSCROLL + GROUPBOX "@STATIC2",IDC_STATIC,7,29,205,75 + ICON ICO_KEY,IDC_STATIC,16,39,18,18 + LTEXT "@S_BOLD",S_BOLD,42,41,151,9 + RTEXT "@STATIC3",IDC_STATIC,38,53,46,10 + EDITTEXT E_PASSWORD1,90,52,114,11,ES_PASSWORD | ES_AUTOHSCROLL + RTEXT "@STATIC4",IDC_STATIC,29,68,56,11 + EDITTEXT E_PASSWORD2,90,66,114,11,ES_PASSWORD | ES_AUTOHSCROLL + CONTROL "@R_NO_ENUM",R_NO_ENUM,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,45,82,161,20 + GROUPBOX "@STATIC7",IDC_STATIC,7,107,205,42 + ICON ICO_HUB_OFFLINE,IDC_STATIC,15,119,18,18 + LTEXT "@STATIC8",IDC_STATIC,42,119,140,12 + CONTROL "@R_ONLINE",R_ONLINE,"Button",BS_AUTORADIOBUTTON | WS_TABSTOP,46,131,56,9 + CONTROL "@R_OFFLINE",R_OFFLINE,"Button",BS_AUTORADIOBUTTON,118,131,62,9 + GROUPBOX "@STATIC5",IDC_STATIC,7,155,205,124 + ICON ICO_MACHINE,IDC_STATIC,16,163,18,18 + CONTROL "@R_LIMIT_MAX_SESSION",R_LIMIT_MAX_SESSION,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,45,163,159,12 + RTEXT "@S_MAX_SESSION_1",S_MAX_SESSION_1,42,177,86,10 + EDITTEXT E_MAX_SESSION,135,175,32,11,ES_RIGHT | ES_AUTOHSCROLL | ES_NUMBER + LTEXT "@S_MAX_SESSION_2",S_MAX_SESSION_2,174,177,29,10 + LTEXT "@STATIC6",IDC_STATIC,42,187,160,23 + CONTROL "",IDC_STATIC,"Static",SS_ETCHEDHORZ,15,220,190,1 + ICON ICO_LINK2,S_AO_4,16,227,18,18 + LTEXT "@STATIC10",S_STATIC,42,228,160,23 + PUSHBUTTON "@B_EXTOPTION",B_EXTOPTION,76,252,128,17 + GROUPBOX "@STATIC9",IDC_STATIC,219,29,205,58 + ICON ICO_FARM,IDC_STATIC,227,41,18,18 + LTEXT "@S_FARM_INFO",S_FARM_INFO,253,41,163,23 + CONTROL "@R_STATIC",R_STATIC,"Button",BS_AUTORADIOBUTTON | WS_TABSTOP,254,66,81,9 + CONTROL "@R_DYNAMIC",R_DYNAMIC,"Button",BS_AUTORADIOBUTTON,337,66,83,9 + GROUPBOX "@S_AO_1",S_AO_1,219,89,205,53 + ICON ICO_USER_ADMIN,S_AO_2,227,100,18,18 + LTEXT "@S_AO_3",S_AO_3,252,100,164,17 + PUSHBUTTON "@B_ADMINOPTION",B_ADMINOPTION,313,119,102,17 + GROUPBOX "@S_ACL_3",S_ACL_3,219,145,205,54 + ICON ICO_INTERNET,S_ACL_2,227,157,18,18 + LTEXT "@S_ACL",S_ACL,252,157,164,16 + PUSHBUTTON "@B_ACL",B_ACL,313,175,102,17 + GROUPBOX "@S_MSG_1",S_MSG_1,219,203,205,54 + ICON ICO_LOG2,S_MSG_4,227,215,18,18 + LTEXT "@S_MSG_2",S_MSG_2,252,215,164,16 + PUSHBUTTON "@B_MSG",B_MSG,313,233,102,17 + DEFPUSHBUTTON "@IDOK",IDOK,291,262,64,17 + PUSHBUTTON "@IDCANCEL",IDCANCEL,360,262,64,17 +END + +D_SM_CREATE_LISTENER DIALOGEX 0, 0, 270, 137 +STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "@D_SM_CREATE_LISTENER" +FONT 9, "MS Shell Dlg", 400, 0, 0x80 +BEGIN + ICON ICO_PROTOCOL,IDC_STATIC,7,5,20,18 + LTEXT "@STATIC1",IDC_STATIC,33,11,230,31 + LTEXT "@STATIC2",IDC_STATIC,33,72,230,42 + ICON ICO_INFORMATION,IDC_STATIC,7,73,20,18 + RTEXT "@STATIC3",IDC_STATIC,39,51,55,9 + EDITTEXT E_PORT,98,49,35,11,ES_CENTER | ES_AUTOHSCROLL | ES_NUMBER + DEFPUSHBUTTON "@IDOK",IDOK,126,115,64,17 + PUSHBUTTON "@IDCANCEL",IDCANCEL,199,115,64,17 + LTEXT "@STATIC4",IDC_STATIC,137,51,107,8 +END + +D_SM_SSL DIALOGEX 0, 0, 463, 312 +STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "@D_SM_SSL" +FONT 9, "MS Shell Dlg", 400, 0, 0x80 +BEGIN + LTEXT "@STATIC1",IDC_STATIC,7,5,449,18 + GROUPBOX "@STATIC2",IDC_STATIC,7,23,218,66 + ICON ICO_KEY,IDC_STATIC,14,35,20,18 + LTEXT "@STATIC3",IDC_STATIC,39,36,179,33 + RTEXT "@STATIC4",IDC_STATIC,15,74,84,12 + COMBOBOX C_CIPHER,106,71,110,80,CBS_DROPDOWN | CBS_AUTOHSCROLL | WS_VSCROLL | WS_TABSTOP + GROUPBOX "@STATIC6",IDC_STATIC,7,93,218,107 + ICON ICO_SERVER_CERT,IDC_STATIC,14,106,20,18 + LTEXT "@STATIC7",IDC_STATIC,39,107,178,15 + GROUPBOX "@STATIC10",IDC_STATIC,38,125,179,46 + LTEXT "CERT_INFO",S_CERT_INFO,50,136,162,29 + PUSHBUTTON "@B_REGENERATE",B_REGENERATE,12,175,47,16 + PUSHBUTTON "@B_IMPORT",B_IMPORT,61,175,47,16 + PUSHBUTTON "@B_EXPORT",B_EXPORT,110,175,47,16 + PUSHBUTTON "@B_VIEW",B_VIEW,159,175,56,16 + GROUPBOX "@STATIC12",IDC_STATIC,7,203,218,87 + ICON ICO_LOG2,IDC_STATIC,14,213,20,18 + LTEXT "@STATIC13",IDC_STATIC,35,213,184,24 + COMBOBOX C_SYSLOG,16,240,199,50,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP + RTEXT "@STATIC14",S_01,15,260,84,10 + EDITTEXT E_SYSLOG_HOSTNAME,102,258,113,11,ES_AUTOHSCROLL + RTEXT "@STATIC15",S_02,15,275,84,12 + EDITTEXT E_SYSLOG_PORT,102,274,32,11,ES_CENTER | ES_AUTOHSCROLL | ES_NUMBER + GROUPBOX "@STATIC8",IDC_STATIC,230,23,223,145 + ICON ICO_INTERNET,IDC_STATIC,233,35,20,18 + LTEXT "@STATIC9",IDC_STATIC,256,32,179,42 + CONTROL "@R_USE_KEEP_CONNECT",R_USE_KEEP_CONNECT,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,255,74,172,11 + RTEXT "@S_HOSTNAME",S_HOSTNAME,244,91,50,10 + EDITTEXT E_HOSTNAME,297,89,139,11,ES_AUTOHSCROLL + RTEXT "@S_PORT",S_PORT,246,108,48,10 + EDITTEXT E_PORT,297,107,27,11,ES_AUTOHSCROLL | ES_NUMBER + RTEXT "@S_INTERVAL",S_INTERVAL,326,108,59,10 + EDITTEXT E_INTERVAL,387,107,36,11,ES_AUTOHSCROLL | ES_NUMBER + LTEXT "@S_INTERVAL2",S_INTERVAL2,426,108,21,10 + RTEXT "@S_PROTOCOL",S_PROTOCOL,238,125,48,10 + CONTROL "@R_TCP",R_TCP,"Button",BS_AUTORADIOBUTTON,292,125,72,9 + CONTROL "@R_UDP",R_UDP,"Button",BS_AUTORADIOBUTTON,369,125,76,9 + ICON ICO_INFORMATION,S_INFO2,233,137,20,18 + LTEXT "@S_INFO",S_INFO,256,141,194,23 + GROUPBOX "@STATIC11",IDC_STATIC,230,173,226,53 + LTEXT "@S_INFO4",S_INFO4,237,182,210,17 + ICON ICO_USER_ADMIN,IDC_STATIC,322,201,20,18 + PUSHBUTTON "@B_PASSWORD",B_PASSWORD,347,203,98,16 + GROUPBOX "@S_OVER_FUNCS",IDC_STATIC,230,229,226,55 + LTEXT "@S_INFO5",S_INFO5,236,241,210,23 + ICON ICO_SPECIALLISTENER,IDC_STATIC,322,262,20,18 + PUSHBUTTON "@B_SPECIALLISTENER",B_SPECIALLISTENER,346,263,98,16 + PUSHBUTTON "@B_UPDATE_CONFIG",B_UPDATE_CONFIG,230,290,85,17 + DEFPUSHBUTTON "@IDOK",IDOK,321,290,64,17 + PUSHBUTTON "@IDCANCEL",IDCANCEL,392,290,64,17 +END + +D_SM_SAVE_KEY_PAIR DIALOGEX 0, 0, 295, 298 +STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "@D_SM_SAVE_KEY_PAIR" +FONT 9, "MS Shell Dlg", 400, 0, 0x80 +BEGIN + LTEXT "@STATIC1",IDC_STATIC,7,5,281,15 + GROUPBOX "@STATIC2",IDC_STATIC,7,23,281,168 + CONTROL "@R_X509_AND_KEY",R_X509_AND_KEY,"Button",BS_AUTORADIOBUTTON,14,33,249,9 + CONTROL "@R_PKCS12",R_PKCS12,"Button",BS_AUTORADIOBUTTON,14,69,249,9 + CONTROL "@R_SECURE",R_SECURE,"Button",BS_AUTORADIOBUTTON,14,108,249,9 + ICON ICO_CERT,IDC_STATIC,26,42,20,18 + LTEXT "@STATIC3",IDC_STATIC,51,43,218,24 + ICON ICO_PKCS12,IDC_STATIC,26,83,20,18 + LTEXT "@STATIC4",IDC_STATIC,51,83,224,24 + ICON ICO_SECURE,IDC_STATIC,26,120,20,18 + LTEXT "@STATIC5",IDC_STATIC,51,123,224,17 + PUSHBUTTON "@B_SELECT",B_SELECT,50,143,110,18 + GROUPBOX "@S_PASS3",S_PASS3,7,194,281,78 + ICON ICO_KEY,IDC_STATIC,14,206,20,18 + LTEXT "@S_PASS4",S_PASS4,39,207,242,18 + CONTROL "@R_USE_PASS",R_USE_PASS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,38,227,144,9 + RTEXT "@S_PASS1",S_PASS1,31,239,56,11 + EDITTEXT E_PASS1,94,239,158,11,ES_PASSWORD | ES_AUTOHSCROLL + RTEXT "@S_PASS2",S_PASS2,31,256,56,11 + EDITTEXT E_PASS2,94,254,158,11,ES_PASSWORD | ES_AUTOHSCROLL + DEFPUSHBUTTON "@IDOK",IDOK,150,275,64,17 + PUSHBUTTON "@IDCANCEL",IDCANCEL,224,275,64,17 + LTEXT "",S_INFO,52,162,227,23 + PUSHBUTTON "@B_SECURE_MANAGER",B_SECURE_MANAGER,169,143,110,18,NOT WS_VISIBLE +END + +D_SM_CONNECTION DIALOGEX 0, 0, 318, 233 +STYLE DS_SETFONT | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "@D_SM_CONNECTION" +FONT 9, "MS Shell Dlg", 400, 0, 0x80 +BEGIN + ICON ICO_PROTOCOL,IDC_STATIC,7,5,18,18 + LTEXT "@S_TITLE",S_TITLE,32,5,279,18 + CONTROL "",L_LIST,"SysListView32",LVS_REPORT | LVS_SHOWSELALWAYS | LVS_SHAREIMAGELISTS | LVS_AUTOARRANGE | WS_BORDER | WS_TABSTOP,7,31,304,173 + DEFPUSHBUTTON "@IDOK",IDOK,7,211,99,16 + PUSHBUTTON "@B_DISCONNECT",B_DISCONNECT,113,211,49,16 + PUSHBUTTON "@B_REFRESH",B_REFRESH,169,211,82,16 + PUSHBUTTON "@IDCANCEL",IDCANCEL,258,211,51,16 +END + +D_SM_FARM DIALOGEX 0, 0, 259, 332 +STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "@D_SM_FARM" +FONT 9, "MS Shell Dlg", 400, 0, 0x80 +BEGIN + ICON ICO_FARM,IDC_STATIC,7,5,18,18 + LTEXT "@S_TITLE",S_TITLE,33,5,219,16 + LTEXT "@STATIC1",IDC_STATIC,7,30,245,19 + RTEXT "@STATIC2",IDC_STATIC,7,51,69,9 + LTEXT "--",S_CURRENT,82,49,154,14 + GROUPBOX "@STATIC3",IDC_STATIC,7,65,245,208 + CONTROL "@R_STANDALONE",R_STANDALONE,"Button",BS_AUTORADIOBUTTON,14,73,180,9 + CONTROL "@R_CONTROLLER",R_CONTROLLER,"Button",BS_AUTORADIOBUTTON,14,86,119,9 + CONTROL "@R_MEMBER",R_MEMBER,"Button",BS_AUTORADIOBUTTON,14,100,117,9 + GROUPBOX "@STATIC4",IDC_STATIC,25,131,220,135 + ICON ICO_PROTOCOL,IDC_STATIC,32,143,18,18 + RTEXT "@S_IP_1",S_IP_1,59,144,59,9 + CONTROL "",E_IP,"SysIPAddress32",WS_TABSTOP,122,142,75,12 + LTEXT "@S_IP_2",S_IP_2,74,156,164,25 + RTEXT "@S_PORT_1",S_PORT_1,59,186,59,10 + EDITTEXT E_PORT,122,185,117,11,ES_AUTOHSCROLL + RTEXT "@S_PORT_2",S_PORT_2,62,198,179,10 + RTEXT "@S_CONTROLLER",S_CONTROLLER,55,209,63,18 + EDITTEXT E_CONTROLLER,122,212,85,11,ES_AUTOHSCROLL + RTEXT "@S_CONTROLLER_PORT",S_CONTROLLER_PORT,59,227,59,16 + EDITTEXT E_CONTROLLER_PORT,122,229,39,11,ES_CENTER | ES_AUTOHSCROLL | ES_NUMBER + LTEXT "@S_PORT_3",S_PORT_3,165,232,59,9 + RTEXT "@S_PASSWORD",S_PASSWORD,27,251,92,11 + EDITTEXT E_PASSWORD,122,248,117,11,ES_PASSWORD | ES_AUTOHSCROLL + ICON ICO_WARNING,IDC_STATIC,7,275,18,18 + LTEXT "@STATIC5",IDC_STATIC,32,275,220,32 + DEFPUSHBUTTON "@IDOK",IDOK,115,310,64,17 + PUSHBUTTON "@IDCANCEL",IDCANCEL,188,310,64,17 + RTEXT "@S_1",S_1,14,118,104,9 + EDITTEXT E_WEIGHT,122,116,34,11,ES_CENTER | ES_AUTOHSCROLL | ES_NUMBER + LTEXT "@S_2",S_2,161,118,71,11 + CONTROL "@R_CONTROLLER_ONLY",R_CONTROLLER_ONLY,"Button",BS_AUTOCHECKBOX | BS_MULTILINE | WS_TABSTOP,146,85,98,30 +END + +D_SM_FARM_MEMBER DIALOGEX 0, 0, 415, 227 +STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "@D_SM_FARM_MEMBER" +FONT 9, "MS Shell Dlg", 400, 0, 0x80 +BEGIN + ICON ICO_FARM,IDC_STATIC,7,5,20,18 + LTEXT "@S_TITLE",S_TITLE,32,5,376,19 + CONTROL "",L_FARM_MEMBER,"SysListView32",LVS_REPORT | LVS_SHOWSELALWAYS | LVS_SHAREIMAGELISTS | LVS_AUTOARRANGE | WS_BORDER | WS_TABSTOP,7,29,401,170 + DEFPUSHBUTTON "@IDOK",IDOK,7,205,122,16 + PUSHBUTTON "@B_REFRESH",B_REFRESH,268,205,82,16 + PUSHBUTTON "@IDCANCEL",IDCANCEL,357,205,51,16 + PUSHBUTTON "@B_CERT",B_CERT,132,205,93,16 +END + +D_SM_CHANGE_PASSWORD DIALOGEX 0, 0, 250, 95 +STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "@D_SM_CHANGE_PASSWORD" +FONT 9, "MS Shell Dlg", 400, 0, 0x80 +BEGIN + ICON ICO_USER_ADMIN,IDC_STATIC,7,5,20,18 + LTEXT "@S_TITLE",S_TITLE,31,5,212,18 + RTEXT "@STATIC1",IDC_STATIC,7,35,65,10 + EDITTEXT E_PASSWORD1,78,33,130,11,ES_PASSWORD | ES_AUTOHSCROLL + RTEXT "@STATIC2",IDC_STATIC,7,51,65,10 + EDITTEXT E_PASSWORD2,78,49,130,11,ES_PASSWORD | ES_AUTOHSCROLL + DEFPUSHBUTTON "@IDOK",IDOK,106,73,64,17 + PUSHBUTTON "@IDCANCEL",IDCANCEL,179,73,64,17 +END + +D_SM_HUB DIALOGEX 0, 0, 403, 307 +STYLE DS_SETFONT | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "@D_SM_HUB" +FONT 9, "MS Shell Dlg", 400, 0, 0x80 +BEGIN + LTEXT "@S_TITLE",S_TITLE,7,5,176,17,SS_WORDELLIPSIS + GROUPBOX "@STATIC1",IDC_STATIC,7,24,173,125 + ICON ICO_USER,IDC_STATIC,14,32,20,18 + PUSHBUTTON "@B_USER",B_USER,38,34,104,15 + LTEXT "@S_USER",S_USER,38,52,132,9 + CONTROL "",IDC_STATIC,"Static",SS_ETCHEDHORZ,14,64,156,1 + ICON ICO_GROUP,IDC_STATIC,14,70,20,18 + PUSHBUTTON "@B_GROUP",B_GROUP,38,71,104,15 + LTEXT "@S_GROUP",S_GROUP,38,90,132,11 + CONTROL "",IDC_STATIC,"Static",SS_ETCHEDHORZ,14,102,156,1 + ICON ICO_PASS,IDC_STATIC,14,108,20,18 + PUSHBUTTON "@B_ACCESS",B_ACCESS,38,110,104,15 + LTEXT "@S_ACCESS",S_ACCESS,38,129,132,18 + GROUPBOX "@STATIC2",IDC_STATIC,7,155,173,146 + ICON ICO_HUB,IDC_STATIC,14,165,20,18 + PUSHBUTTON "@B_PROPERTY",B_PROPERTY,38,165,104,15 + LTEXT "@S_PROPERTY",S_PROPERTY,40,182,137,15 + CONTROL "",IDC_STATIC,"Static",SS_ETCHEDHORZ,14,197,156,1 + ICON ICO_TOWER,IDC_STATIC,14,203,20,18 + PUSHBUTTON "@B_RADIUS",B_RADIUS,38,204,104,15 + LTEXT "@S_RADIUS",S_RADIUS,38,222,132,24 + CONTROL "",IDC_STATIC,"Static",SS_ETCHEDHORZ,14,246,156,1 + ICON ICO_CASCADE,IDC_STATIC,14,254,20,18 + PUSHBUTTON "@B_LINK",B_LINK,38,256,104,15 + LTEXT "@S_LINK",S_LINK,38,274,132,23 + GROUPBOX "@STATIC3",IDC_STATIC,188,5,208,144 + CONTROL "",L_STATUS,"SysListView32",LVS_REPORT | LVS_SHOWSELALWAYS | LVS_SHAREIMAGELISTS | LVS_AUTOARRANGE | WS_BORDER | WS_TABSTOP,194,17,191,108 + PUSHBUTTON "@B_REFRESH",B_REFRESH,303,128,82,16 + GROUPBOX "@STATIC4",IDC_STATIC,187,152,209,112 + ICON ICO_LOG2,IDC_STATIC,192,161,20,18 + PUSHBUTTON "@B_LOG",B_LOG,216,161,100,15 + PUSHBUTTON "@B_LOG_FILE",B_LOG_FILE,321,161,63,15 + LTEXT "@S_LOG",S_LOG,216,179,173,10 + CONTROL "",IDC_STATIC,"Static",SS_ETCHEDHORZ,192,189,193,1 + ICON ICO_SERVER_CERT,IDC_STATIC,192,191,20,18 + PUSHBUTTON "@B_CA",B_CA,216,193,100,15 + PUSHBUTTON "@B_CRL",B_CRL,321,193,63,15 + LTEXT "@S_CA",S_CA,216,209,170,15 + CONTROL "",IDC_STATIC,"Static",SS_ETCHEDHORZ,193,223,193,1 + ICON ICO_ROUTER,IDC_STATIC,192,225,20,18 + PUSHBUTTON "@B_SNAT",B_SNAT,215,227,169,15 + LTEXT "@S_SNAT",S_SNAT,215,245,170,16 + GROUPBOX "@STATIC5",IDC_STATIC,187,266,140,35 + ICON ICO_VPN,IDC_STATIC,194,276,20,18 + PUSHBUTTON "@B_SESSION",B_SESSION,221,280,100,15,BS_MULTILINE + PUSHBUTTON "@IDCANCEL",IDCANCEL,336,285,60,16 +END + +D_SM_USER DIALOGEX 0, 0, 454, 240 +STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "@D_SM_USER" +FONT 9, "MS Shell Dlg", 400, 0, 0x80 +BEGIN + ICON ICO_USER,IDC_STATIC,7,5,20,18 + LTEXT "@S_TITLE",S_TITLE,31,5,416,13 + CONTROL "",L_USER,"SysListView32",LVS_REPORT | LVS_SHOWSELALWAYS | LVS_SHAREIMAGELISTS | LVS_AUTOARRANGE | WS_BORDER | WS_TABSTOP,7,27,440,187 + DEFPUSHBUTTON "@IDOK",IDOK,83,220,65,15 + PUSHBUTTON "@B_CREATE",B_CREATE,13,220,65,15 + PUSHBUTTON "@B_DELETE",B_DELETE,226,220,65,15 + PUSHBUTTON "@B_REFRESH",B_REFRESH,297,220,81,15 + PUSHBUTTON "@IDCANCEL",IDCANCEL,382,220,65,15 + PUSHBUTTON "@B_STATUS",B_STATUS,153,220,68,15 +END + +D_SM_EDIT_USER DIALOGEX 0, 0, 455, 301 +STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "@D_SM_EDIT_USER" +FONT 9, "MS Shell Dlg", 400, 0, 0x80 +BEGIN + ICON ICO_USER,IDC_STATIC,7,5,20,18 + RTEXT "@IDC_STATIC1",IDC_STATIC1,31,13,44,9 + EDITTEXT E_USERNAME,80,11,154,11,ES_AUTOHSCROLL + RTEXT "@IDC_STATIC3",IDC_STATIC3,7,29,68,9 + EDITTEXT E_REALNAME,80,28,154,11,ES_AUTOHSCROLL + RTEXT "@IDC_STATIC4",IDC_STATIC4,7,47,68,8 + EDITTEXT E_NOTE,80,45,154,11,ES_AUTOHSCROLL + CONTROL "",IDC_STATIC,"Static",SS_ETCHEDHORZ,7,60,226,1 + ICON ICO_GROUP,IDC_STATIC,7,67,20,18 + RTEXT "@IDC_STATIC5",IDC_STATIC5,31,70,44,21 + EDITTEXT E_GROUP,80,71,80,11,ES_AUTOHSCROLL + PUSHBUTTON "@B_GROUP",B_GROUP,164,68,70,16 + ICON ICO_DATETIME,IDC_STATIC,7,89,20,18 + CONTROL "@R_EXPIRES",R_EXPIRES,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,37,90,161,9 + CONTROL "",E_EXPIRES_DATE,"SysDateTimePick32",DTS_RIGHTALIGN | WS_TABSTOP,48,103,75,13 + CONTROL "",E_EXPIRES_TIME,"SysDateTimePick32",DTS_RIGHTALIGN | DTS_UPDOWN | WS_TABSTOP,131,103,67,13 + CONTROL "",IDC_STATIC,"Static",SS_ETCHEDHORZ,7,122,227,1 + RTEXT "@IDC_STATIC6",IDC_STATIC6,7,129,68,10 + CONTROL "",L_AUTH,"SysListView32",LVS_REPORT | LVS_SINGLESEL | LVS_SHOWSELALWAYS | LVS_SHAREIMAGELISTS | LVS_AUTOARRANGE | LVS_NOCOLUMNHEADER | LVS_NOSORTHEADER | WS_BORDER | WS_TABSTOP,80,128,120,66 + GROUPBOX "@S_RADIUS_3",S_RADIUS_3,7,198,229,75 + ICON ICO_TOWER,IDC_STATIC,14,209,20,18 + LTEXT "@S_RADIUS_1",S_RADIUS_1,35,210,195,24 + CONTROL "@R_SET_RADIUS_USERNAME",R_SET_RADIUS_USERNAME,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,26,236,184,9 + RTEXT "@S_RADIUS_2",S_RADIUS_2,11,250,113,12 + EDITTEXT E_RADIUS_USERNAME,127,248,101,11,ES_AUTOHSCROLL + GROUPBOX "@S_POLICY_1",S_POLICY_1,242,5,206,35 + ICON ICO_MACHINE,IDC_STATIC,249,16,20,18 + CONTROL "@R_POLICY",R_POLICY,"Button",BS_AUTOCHECKBOX | BS_MULTILINE | WS_TABSTOP,281,16,83,18 + PUSHBUTTON "@B_POLICY",B_POLICY,367,17,73,16 + GROUPBOX "@S_PASSWORD_1",S_PASSWORD_1,242,47,206,46 + ICON ICO_KEY,IDC_STATIC,249,59,20,18 + RTEXT "@S_PASSWORD_2",S_PASSWORD_2,275,63,70,9 + EDITTEXT E_PASSWORD1,348,61,92,11,ES_PASSWORD | ES_AUTOHSCROLL + RTEXT "@S_PASSWORD_3",S_PASSWORD_3,270,78,75,9 + EDITTEXT E_PASSWORD2,348,77,92,11,ES_PASSWORD | ES_AUTOHSCROLL + GROUPBOX "@S_USER_CERT_1",S_USER_CERT_1,242,97,206,71 + ICON ICO_CERT,IDC_STATIC,249,107,20,18 + LTEXT "S_CERT_INFO\r\nS_CERT_INFO\r\nS_CERT_INFO\r\nS_CERT_INFO",S_CERT_INFO,272,109,176,35 + PUSHBUTTON "@B_LOAD_CERT",B_LOAD_CERT,248,145,57,16 + PUSHBUTTON "@B_VIEW_CERT",B_VIEW_CERT,308,145,58,16 + PUSHBUTTON "@B_CREATE",B_CREATE,369,145,75,16 + GROUPBOX "@S_ROOT_CERT_1",S_ROOT_CERT_1,242,168,206,105 + ICON ICO_SERVER_CERT,IDC_STATIC,249,183,20,18 + LTEXT "@S_ROOT_CERT_2",S_ROOT_CERT_2,272,179,168,27 + CONTROL "@R_CN",R_CN,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,257,205,184,9 + EDITTEXT E_CN,267,217,174,11,ES_AUTOHSCROLL + CONTROL "@R_SERIAL",R_SERIAL,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,257,233,184,9 + EDITTEXT E_SERIAL,267,245,174,11,ES_AUTOHSCROLL + RTEXT "@S_ROOT_CERT_3",S_ROOT_CERT_3,267,259,170,10 + DEFPUSHBUTTON "@IDOK",IDOK,311,279,64,17 + PUSHBUTTON "@IDCANCEL",IDCANCEL,384,279,64,17 + LTEXT "@S_HINT",S_HINT,7,275,299,26 +END + +D_SM_POLICY DIALOGEX 0, 0, 450, 292 +STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "@D_SM_POLICY" +FONT 9, "MS Shell Dlg", 400, 0, 0x80 +BEGIN + ICON ICO_MACHINE,IDC_STATIC,7,5,20,18 + LTEXT "S_TITLE",S_TITLE,30,5,281,17 + CONTROL "",L_POLICY,"SysListView32",LVS_REPORT | LVS_SINGLESEL | LVS_SHOWSELALWAYS | LVS_SHAREIMAGELISTS | LVS_AUTOARRANGE | LVS_NOSORTHEADER | WS_BORDER | WS_TABSTOP,7,28,257,231 + GROUPBOX "@STATIC1",IDC_STATIC,270,25,173,235 + LTEXT "S_POLICY_TITLE S_POLICY_TITLE S_POLICY_TITLE S_POLICY_TITLE ",S_POLICY_TITLE,278,38,158,26 + CONTROL "",IDC_STATIC,"Static",SS_ETCHEDHORZ,277,68,159,1 + EDITTEXT E_POLICY_DESCRIPTION,277,84,157,48,ES_MULTILINE | ES_AUTOVSCROLL | ES_READONLY | ES_WANTRETURN | WS_VSCROLL + LTEXT "@S_BOLD",S_BOLD,277,73,114,10 + CONTROL "",IDC_STATIC,"Static",SS_ETCHEDHORZ,277,141,158,1 + LTEXT "@S_BOLD2",S_BOLD2,277,148,114,10 + CONTROL "@R_ENABLE",R_ENABLE,"Button",BS_AUTORADIOBUTTON,284,161,149,12 + CONTROL "@R_DISABLE",R_DISABLE,"Button",BS_AUTORADIOBUTTON,284,178,149,12 + CONTROL "@R_DEFINE",R_DEFINE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,284,163,151,10 + EDITTEXT E_VALUE,293,177,74,11,ES_RIGHT | ES_AUTOHSCROLL | ES_NUMBER + LTEXT "S_TANI",S_TANI,371,179,64,11 + LTEXT "S_LIMIT",S_LIMIT,294,194,142,30 + DEFPUSHBUTTON "@IDOK",IDOK,306,269,64,17 + PUSHBUTTON "@IDCANCEL",IDCANCEL,379,269,64,17 +END + +D_SM_GROUP DIALOGEX 0, 0, 334, 241 +STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "@D_SM_GROUP" +FONT 9, "MS Shell Dlg", 400, 0, 0x80 +BEGIN + ICON ICO_GROUP,IDC_STATIC,7,5,18,18 + LTEXT "@S_TITLE",S_TITLE,31,5,252,16 + CONTROL "",L_GROUP,"SysListView32",LVS_REPORT | LVS_SHOWSELALWAYS | LVS_SHAREIMAGELISTS | LVS_AUTOARRANGE | WS_BORDER | WS_TABSTOP,7,27,320,187 + PUSHBUTTON "@B_CREATE",B_CREATE,8,221,51,15 + DEFPUSHBUTTON "@IDOK",IDOK,64,221,36,15 + PUSHBUTTON "@B_DELETE",B_DELETE,105,221,40,15 + PUSHBUTTON "@B_REFRESH",B_REFRESH,150,221,69,15 + PUSHBUTTON "@B_USER",B_USER,224,221,51,15 + PUSHBUTTON "@IDCANCEL",IDCANCEL,280,221,47,15 +END + +D_SM_EDIT_GROUP DIALOGEX 0, 0, 243, 255 +STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "@D_SM_EDIT_GROUP" +FONT 9, "MS Shell Dlg", 400, 0, 0x80 +BEGIN + ICON ICO_GROUP,IDC_STATIC,7,5,20,18 + RTEXT "@IDC_STATIC1",IDC_STATIC1,31,13,44,11 + EDITTEXT E_GROUPNAME,80,11,154,11,ES_AUTOHSCROLL + RTEXT "@IDC_STATIC3",IDC_STATIC3,7,29,68,11 + EDITTEXT E_REALNAME,80,28,154,11,ES_AUTOHSCROLL + RTEXT "@IDC_STATIC4",IDC_STATIC4,7,47,68,11 + EDITTEXT E_NOTE,80,45,154,11,ES_AUTOHSCROLL + GROUPBOX "@S_POLICY_1",S_POLICY_1,7,65,229,35 + ICON ICO_MACHINE,IDC_STATIC,14,75,20,18 + CONTROL "@R_POLICY",R_POLICY,"Button",BS_AUTOCHECKBOX | BS_MULTILINE | WS_TABSTOP,40,74,104,18 + PUSHBUTTON "@B_POLICY",B_POLICY,154,77,73,16 + GROUPBOX "@S_POLICY_2",S_POLICY_2,7,105,229,124 + CONTROL "",L_STATUS,"SysListView32",LVS_REPORT | LVS_SHOWSELALWAYS | LVS_SHAREIMAGELISTS | LVS_AUTOARRANGE | LVS_NOSORTHEADER | WS_BORDER | WS_TABSTOP,14,118,213,102 + DEFPUSHBUTTON "@IDOK",IDOK,98,233,64,17 + PUSHBUTTON "@IDCANCEL",IDCANCEL,172,233,64,17 +END + +D_SM_ACCESS_LIST DIALOGEX 0, 0, 451, 275 +STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "@D_SM_ACCESS_LIST" +FONT 9, "MS Shell Dlg", 400, 0, 0x80 +BEGIN + ICON ICO_PASS,IDC_STATIC,7,5,20,18 + LTEXT "@S_TITLE",S_TITLE,33,5,411,20 + CONTROL "",L_ACCESS_LIST,"SysListView32",LVS_REPORT | LVS_SHOWSELALWAYS | LVS_SHAREIMAGELISTS | LVS_AUTOARRANGE | LVS_NOSORTHEADER | WS_BORDER | WS_TABSTOP,7,29,364,221 + PUSHBUTTON "@B_ADD",B_ADD,376,28,68,16 + PUSHBUTTON "@B_ADD_V6",B_ADD_V6,376,47,68,16 + DEFPUSHBUTTON "@IDOK",IDOK,376,65,68,16 + PUSHBUTTON "@B_DELETE",B_DELETE,376,84,68,16 + PUSHBUTTON "@B_CLONE",B_CLONE,376,118,68,16 + PUSHBUTTON "@B_ENABLE",B_ENABLE,376,152,68,16 + PUSHBUTTON "@B_DISABLE",B_DISABLE,376,171,68,16 + LTEXT "@STATIC1",IDC_STATIC,377,203,67,24 + PUSHBUTTON "@B_SAVE",B_SAVE,376,233,68,16 + PUSHBUTTON "@IDCANCEL",IDCANCEL,376,254,68,16 + ICON ICO_INFORMATION,IDC_STATIC,7,251,20,18 + LTEXT "@STATIC2",IDC_STATIC,28,252,340,18 +END + +D_SM_EDIT_ACCESS DIALOGEX 0, 0, 459, 352 +STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "@D_SM_EDIT_ACCESS" +FONT 9, "MS Shell Dlg", 400, 0, 0x80 +BEGIN + ICON ICO_PASS,S_ICON,7,5,20,18 + LTEXT "@STATIC1",IDC_STATIC,31,5,421,17 + GROUPBOX "@STATIC2",IDC_STATIC,7,29,217,61 + RTEXT "@STATIC3",IDC_STATIC,14,43,71,10 + EDITTEXT E_NOTE,91,41,115,11,ES_AUTOHSCROLL + RTEXT "@STATIC4",IDC_STATIC,14,59,71,8 + CONTROL "@R_PASS",R_PASS,"Button",BS_AUTORADIOBUTTON,91,54,47,16 + CONTROL "@R_DISCARD",R_DISCARD,"Button",BS_AUTORADIOBUTTON,142,54,51,16 + RTEXT "@STATIC5",IDC_STATIC,14,75,71,9 + EDITTEXT E_PRIORITY,91,73,38,11,ES_CENTER | ES_AUTOHSCROLL | ES_NUMBER + LTEXT "@STATIC6",IDC_STATIC,134,72,73,16 + GROUPBOX "@STATIC11",S_STATIC11,7,92,217,96 + ICON ICO_USER,IDC_STATIC,11,101,20,18 + LTEXT "@STATIC12",S_STATIC12,34,103,177,24 + RTEXT "@STATIC13",S_STATIC13,12,132,73,11 + EDITTEXT E_USERNAME1,89,131,84,11,ES_AUTOHSCROLL + PUSHBUTTON "@B_USER1",B_USER1,179,129,41,16 + RTEXT "@STATIC14",S_STATIC14,13,152,72,11 + EDITTEXT E_USERNAME2,89,150,84,11,ES_AUTOHSCROLL + PUSHBUTTON "@B_USER2",B_USER2,179,149,41,16 + LTEXT "@STATIC15",S_STATIC15,56,167,156,19 + GROUPBOX "@STATIC16",IDC_STATIC,7,191,217,131 + RTEXT "@S_CHECK_SRC_MAC",S_CHECK_SRC_MAC,14,201,71,9 + CONTROL "@R_CHECK_SRC_MAC",R_CHECK_SRC_MAC,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,89,199,121,9 + RTEXT "@S_SRC_MAC",S_SRC_MAC,14,214,108,9 + EDITTEXT E_SRC_MAC,128,212,78,11,ES_AUTOHSCROLL + RTEXT "@S_SRC_MAC_MASK",S_SRC_MAC_MASK,14,228,108,9 + EDITTEXT E_SRC_MAC_MASK,128,227,78,11,ES_AUTOHSCROLL + CONTROL "",IDC_STATIC,"Static",SS_ETCHEDHORZ,18,242,193,1 + RTEXT "@S_CHECK_DST_MAC",S_CHECK_DST_MAC,13,247,71,9 + CONTROL "@R_CHECK_DST_MAC",R_CHECK_DST_MAC,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,89,245,121,9 + RTEXT "@S_DST_MAC",S_DST_MAC,14,260,108,9 + EDITTEXT E_DST_MAC,128,258,78,11,ES_AUTOHSCROLL + RTEXT "@S_DST_MAC_MASK",S_DST_MAC_MASK,14,275,108,9 + EDITTEXT E_DST_MAC_MASK,128,274,78,11,ES_AUTOHSCROLL + LTEXT "@S_MAC_NOTE",S_MAC_NOTE,18,288,197,26 + GROUPBOX "@STATIC7",IDC_STATIC,232,29,220,181 + RTEXT "@S_ACCESS_SRC_ALL",S_ACCESS_SRC_ALL,237,42,71,9 + CONTROL "@R_SRC_ALL",R_SRC_ALL,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,311,41,121,9 + RTEXT "@S_SRC_IP_1",S_SRC_IP_1,237,54,108,9 + CONTROL "",E_SRC_IP,"SysIPAddress32",WS_TABSTOP,349,53,75,12 + RTEXT "@S_SRC_IP_2",S_SRC_IP_2,237,70,108,8 + CONTROL "",E_SRC_MASK,"SysIPAddress32",WS_TABSTOP,349,68,75,12 + RTEXT "@S_SRC_IP_3",S_SRC_IP_3,237,87,195,9 + CONTROL "",IDC_STATIC,"Static",SS_ETCHEDHORZ,238,101,208,1 + RTEXT "@S_ACCESS_DST_ALL",S_ACCESS_DST_ALL,237,109,71,9 + CONTROL "@R_DST_ALL",R_DST_ALL,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,311,107,121,9 + RTEXT "@S_IP_DST_1",S_IP_DST_1,237,121,108,9 + CONTROL "",E_DST_IP,"SysIPAddress32",WS_TABSTOP,349,119,75,12 + RTEXT "@S_IP_DST_2",S_IP_DST_2,237,137,108,9 + CONTROL "",E_DST_MASK,"SysIPAddress32",WS_TABSTOP,349,135,75,12 + RTEXT "@S_IP_DST_3",S_IP_DST_3,237,152,197,10 + CONTROL "",IDC_STATIC,"Static",SS_ETCHEDHORZ,238,167,208,1 + RTEXT "@STATIC9",IDC_STATIC,237,176,71,11 + COMBOBOX C_PROTOCOL,313,174,110,75,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP + RTEXT "@S_PROTOID",S_PROTOID,237,193,71,9 + EDITTEXT E_IP_PROTO,313,191,37,11,ES_CENTER | ES_AUTOHSCROLL | ES_NUMBER + GROUPBOX "@STATIC10",IDC_STATIC,232,211,220,111 + LTEXT "@S_TCP_1",S_TCP_1,318,221,31,9 + LTEXT "@S_TCP_2",S_TCP_2,370,221,31,9 + RTEXT "@S_TCP_3",S_TCP_3,234,233,71,9 + EDITTEXT E_SRC_PORT_1,311,232,38,11,ES_CENTER | ES_AUTOHSCROLL | ES_NUMBER + LTEXT "-",S_TCP_4,356,233,8,7 + EDITTEXT E_SRC_PORT_2,365,232,38,11,ES_CENTER | ES_AUTOHSCROLL | ES_NUMBER + RTEXT "@S_TCP_5",S_TCP_5,234,249,71,9 + EDITTEXT E_DST_PORT_1,311,247,38,11,ES_CENTER | ES_AUTOHSCROLL | ES_NUMBER + LTEXT "-",S_TCP_6,356,249,8,7 + EDITTEXT E_DST_PORT_2,365,247,38,11,ES_CENTER | ES_AUTOHSCROLL | ES_NUMBER + LTEXT "@S_TCP_7",S_TCP_7,240,263,204,22 + CONTROL "",IDC_STATIC,"Static",SS_ETCHEDHORZ,238,291,208,1 + CONTROL "@R_CHECK_TCP_STATE",R_CHECK_TCP_STATE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,254,296,158,9 + CONTROL "@R_ESTABLISHED",R_ESTABLISHED,"Button",BS_AUTORADIOBUTTON | WS_TABSTOP,268,308,71,9 + CONTROL "@R_UNESTABLISHED",R_UNESTABLISHED,"Button",BS_AUTORADIOBUTTON,351,308,80,9 + CONTROL "@R_REDIRECT",R_REDIRECT,"Button",BS_AUTOCHECKBOX | BS_MULTILINE | WS_TABSTOP,7,328,113,18 + PUSHBUTTON "@B_REDIRECT",B_REDIRECT,122,329,78,17 + PUSHBUTTON "@B_SIMULATION",B_SIMULATION,207,329,103,17 + DEFPUSHBUTTON "@IDOK",IDOK,320,329,64,17 + PUSHBUTTON "@IDCANCEL",IDCANCEL,388,329,64,17 +END + +D_SM_RADIUS DIALOGEX 0, 0, 283, 277 +STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "@D_SM_RADIUS" +FONT 9, "MS Shell Dlg", 400, 0, 0x80 +BEGIN + ICON ICO_TOWER,IDC_STATIC,7,5,18,18 + LTEXT "@S_TITLE",S_TITLE,30,5,236,25 + GROUPBOX "@STATIC1",IDC_STATIC,7,39,269,172 + CONTROL "@R_USE_RADIUS",R_USE_RADIUS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,14,52,255,12 + RTEXT "@S_RADIUS_1",S_RADIUS_1,14,69,95,16 + EDITTEXT E_HOSTNAME,115,71,154,11,ES_AUTOHSCROLL + RTEXT "@S_RADIUS_2",S_RADIUS_2,14,101,95,12 + EDITTEXT E_PORT,115,100,41,11,ES_CENTER | ES_AUTOHSCROLL | ES_NUMBER + LTEXT "@S_RADIUS3",S_RADIUS3,162,101,106,12 + RTEXT "@S_RADIUS_4",S_RADIUS_4,14,119,95,10 + EDITTEXT E_SECRET1,115,117,154,11,ES_PASSWORD | ES_AUTOHSCROLL + RTEXT "@S_RADIUS_5",S_RADIUS_5,14,135,95,10 + EDITTEXT E_SECRET2,115,133,154,11,ES_PASSWORD | ES_AUTOHSCROLL + RTEXT "@S_RADIUS_8",S_RADIUS_8,14,150,95,10 + EDITTEXT E_RADIUS_RETRY_INTERVAL,115,149,41,11,ES_CENTER | ES_AUTOHSCROLL | ES_NUMBER + LTEXT "@S_RADIUS_7",S_RADIUS_7,163,151,106,16 + CONTROL "",IDC_STATIC,"Static",SS_ETCHEDHORZ,14,170,255,1 + ICON ICO_INFORMATION,IDC_STATIC,14,175,18,18 + LTEXT "@S_RADIUS_6",S_RADIUS_6,38,175,231,27 + ICON ICO_LINK,IDC_STATIC,14,211,18,18 + LTEXT "@STATIC2",IDC_STATIC,38,215,230,32 + DEFPUSHBUTTON "@IDOK",IDOK,139,255,64,17 + PUSHBUTTON "@IDCANCEL",IDCANCEL,212,255,64,17 + LTEXT "@S_RADIUS_9",S_RADIUS_9,116,84,152,10 +END + +D_SM_LINK DIALOGEX 0, 0, 423, 268 +STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "@D_SM_LINK" +FONT 9, "MS Shell Dlg", 400, 0, 0x80 +BEGIN + ICON ICO_CASCADE,IDC_STATIC,7,5,20,18 + LTEXT "@STATIC1",IDC_STATIC,29,5,387,17 + GROUPBOX "@STATIC2",IDC_STATIC,26,24,357,42 + ICON ICO_WARNING,IDC_STATIC,31,35,20,18 + LTEXT "@STATIC3",IDC_STATIC,54,34,324,24 + CONTROL "",L_LINK,"SysListView32",LVS_REPORT | LVS_SHOWSELALWAYS | LVS_SHAREIMAGELISTS | LVS_AUTOARRANGE | LVS_EDITLABELS | WS_BORDER | WS_TABSTOP,7,74,409,165 + PUSHBUTTON "@B_CREATE",B_CREATE,12,247,52,15 + PUSHBUTTON "@B_EDIT",B_EDIT,68,247,40,15 + PUSHBUTTON "@B_ONLINE",B_ONLINE,112,247,44,15 + PUSHBUTTON "@B_OFFLINE",B_OFFLINE,160,247,44,15 + DEFPUSHBUTTON "@IDOK",IDOK,208,247,41,15 + PUSHBUTTON "@B_DELETE",B_DELETE,253,247,41,15 + PUSHBUTTON "@B_RENAME",B_RENAME,298,247,60,15 + PUSHBUTTON "@B_REFRESH",B_REFRESH,398,41,18,15,NOT WS_VISIBLE + PUSHBUTTON "@IDCANCEL",IDCANCEL,373,247,43,15 +END + +D_SM_LOG DIALOGEX 0, 0, 279, 333 +STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "@D_SM_LOG" +FONT 9, "MS Shell Dlg", 400, 0, 0x80 +BEGIN + ICON ICO_LOG2,IDC_STATIC,7,5,20,18 + LTEXT "@S_TITLE",S_TITLE,30,5,242,24 + GROUPBOX "@STATIC1",IDC_STATIC,7,39,265,50 + ICON ICO_MACHINE,IDC_STATIC,14,50,20,18 + CONTROL "@B_SEC",B_SEC,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,39,51,225,9 + RTEXT "@S_SEC",S_SEC,39,65,98,10 + COMBOBOX C_SEC_SWITCH,142,62,121,76,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP + GROUPBOX "@STATIC2",IDC_STATIC,7,95,265,180 + ICON ICO_NIC_ONLINE,IDC_STATIC,14,107,20,18 + CONTROL "@B_PACKET",B_PACKET,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,39,107,225,9 + RTEXT "@S_PACKET",S_PACKET,39,120,98,10 + COMBOBOX C_PACKET_SWITCH,142,119,121,76,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP + RTEXT "@S_PACKET_0",S_PACKET_0,19,144,58,10 + CONTROL "@B_PACKET_0_0",B_PACKET_0_0,"Button",BS_AUTORADIOBUTTON,82,143,45,9 + CONTROL "@B_PACKET_0_1",B_PACKET_0_1,"Button",BS_AUTORADIOBUTTON,128,143,52,9 + CONTROL "@B_PACKET_0_2",B_PACKET_0_2,"Button",BS_AUTORADIOBUTTON,181,143,78,9 + RTEXT "@S_PACKET_1",S_PACKET_1,19,158,58,10 + CONTROL "@B_PACKET_1_0",B_PACKET_1_0,"Button",BS_AUTORADIOBUTTON,82,157,45,9 + CONTROL "@B_PACKET_1_1",B_PACKET_1_1,"Button",BS_AUTORADIOBUTTON,128,157,52,9 + CONTROL "@B_PACKET_1_2",B_PACKET_1_2,"Button",BS_AUTORADIOBUTTON,181,157,78,9 + RTEXT "@S_PACKET_2",S_PACKET_2,19,173,58,11 + CONTROL "@B_PACKET_2_0",B_PACKET_2_0,"Button",BS_AUTORADIOBUTTON,82,172,45,9 + CONTROL "@B_PACKET_2_1",B_PACKET_2_1,"Button",BS_AUTORADIOBUTTON,128,172,52,9 + CONTROL "@B_PACKET_2_2",B_PACKET_2_2,"Button",BS_AUTORADIOBUTTON,181,172,78,9 + RTEXT "@S_PACKET_3",S_PACKET_3,19,187,58,9 + CONTROL "@B_PACKET_3_0",B_PACKET_3_0,"Button",BS_AUTORADIOBUTTON,82,186,44,9 + CONTROL "@B_PACKET_3_1",B_PACKET_3_1,"Button",BS_AUTORADIOBUTTON,128,186,52,9 + CONTROL "@B_PACKET_3_2",B_PACKET_3_2,"Button",BS_AUTORADIOBUTTON,181,186,78,9 + RTEXT "@S_PACKET_4",S_PACKET_4,19,201,58,10 + CONTROL "@B_PACKET_4_0",B_PACKET_4_0,"Button",BS_AUTORADIOBUTTON,82,201,45,9 + CONTROL "@B_PACKET_4_1",B_PACKET_4_1,"Button",BS_AUTORADIOBUTTON,128,201,52,9 + CONTROL "@B_PACKET_4_2",B_PACKET_4_2,"Button",BS_AUTORADIOBUTTON,181,201,78,9 + RTEXT "@S_PACKET_5",S_PACKET_5,19,215,58,10 + CONTROL "@B_PACKET_5_0",B_PACKET_5_0,"Button",BS_AUTORADIOBUTTON,82,215,45,9 + CONTROL "@B_PACKET_5_1",B_PACKET_5_1,"Button",BS_AUTORADIOBUTTON,128,215,52,9 + CONTROL "@B_PACKET_5_2",B_PACKET_5_2,"Button",BS_AUTORADIOBUTTON,181,215,78,9 + RTEXT "@S_PACKET_6",S_PACKET_6,19,230,58,9 + CONTROL "@B_PACKET_6_0",B_PACKET_6_0,"Button",BS_AUTORADIOBUTTON,82,230,45,9 + CONTROL "@B_PACKET_6_1",B_PACKET_6_1,"Button",BS_AUTORADIOBUTTON,128,230,52,9 + CONTROL "@B_PACKET_6_2",B_PACKET_6_2,"Button",BS_AUTORADIOBUTTON,181,230,78,9 + RTEXT "@S_PACKET_7",S_PACKET_7,19,243,58,17 + CONTROL "@B_PACKET_7_0",B_PACKET_7_0,"Button",BS_AUTORADIOBUTTON,82,244,45,9 + CONTROL "@B_PACKET_7_1",B_PACKET_7_1,"Button",BS_AUTORADIOBUTTON,128,245,53,9 + CONTROL "@B_PACKET_7_2",B_PACKET_7_2,"Button",BS_AUTORADIOBUTTON,181,245,78,9 + DEFPUSHBUTTON "@IDOK",IDOK,135,311,64,17 + PUSHBUTTON "@IDCANCEL",IDCANCEL,208,311,64,17 + ICON ICO_WARNING,IDC_STATIC,7,281,20,18 + LTEXT "@STATIC3",IDC_STATIC,29,280,243,30 +END + +D_SM_CA DIALOGEX 0, 0, 335, 195 +STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "@D_SM_CA" +FONT 9, "MS Shell Dlg", 400, 0, 0x80 +BEGIN + ICON ICO_SERVER_CERT,IDC_STATIC,7,5,20,18 + LTEXT "@STATIC1",IDC_STATIC,33,5,295,30 + CONTROL "",L_CERT,"SysListView32",LVS_REPORT | LVS_SHOWSELALWAYS | LVS_SHAREIMAGELISTS | WS_BORDER | WS_TABSTOP,7,42,321,124 + PUSHBUTTON "@B_IMPORT",B_IMPORT,81,173,55,15 + DEFPUSHBUTTON "@IDOK",IDOK,203,173,62,15 + PUSHBUTTON "@IDCANCEL",IDCANCEL,273,173,55,15 + PUSHBUTTON "@B_DELETE",B_DELETE,142,173,54,15 +END + +D_SM_SESSION DIALOGEX 0, 0, 453, 310 +STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "@D_SM_SESSION" +FONT 9, "MS Shell Dlg", 400, 0, 0x80 +BEGIN + ICON ICO_VPN,IDC_STATIC,7,5,18,18 + LTEXT "@S_TITLE",S_TITLE,35,5,411,17 + CONTROL "",L_LIST,"SysListView32",LVS_REPORT | LVS_SHOWSELALWAYS | LVS_SHAREIMAGELISTS | LVS_AUTOARRANGE | WS_BORDER | WS_TABSTOP,7,31,439,191 + GROUPBOX "@STATIC1",IDC_STATIC,7,225,434,37 + DEFPUSHBUTTON "@IDOK",IDOK,13,237,81,16 + PUSHBUTTON "@B_DISCONNECT",B_DISCONNECT,100,237,47,16 + PUSHBUTTON "@B_REFRESH",B_REFRESH,152,237,71,16 + PUSHBUTTON "@B_SESSION_MAC_TABLE",B_SESSION_MAC_TABLE,231,237,99,16 + PUSHBUTTON "@B_SESSION_IP_TABLE",B_SESSION_IP_TABLE,337,237,90,16 + GROUPBOX "@STATIC2",IDC_STATIC,7,267,245,37 + ICON ICO_NIC_ONLINE,IDC_STATIC,14,277,18,18 + PUSHBUTTON "@B_MAC_TABLE",B_MAC_TABLE,39,279,92,16 + ICON ICO_PROTOCOL,IDC_STATIC,133,276,18,18 + PUSHBUTTON "@B_IP_TABLE",B_IP_TABLE,160,279,85,16 + PUSHBUTTON "@IDCANCEL",IDCANCEL,387,288,59,16 + ICON ICO_FARM,S_FARM_INFO_1,260,265,18,18,NOT WS_VISIBLE + LTEXT "@S_FARM_INFO_2",S_FARM_INFO_2,281,264,165,21,NOT WS_VISIBLE +END + +D_SM_MAC DIALOGEX 0, 0, 451, 288 +STYLE DS_SETFONT | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "@D_SM_MAC" +FONT 9, "MS Shell Dlg", 400, 0, 0x80 +BEGIN + ICON ICO_NIC_ONLINE,IDC_STATIC,7,5,18,18 + LTEXT "@S_TITLE",S_TITLE,35,5,409,18 + CONTROL "",L_TABLE,"SysListView32",LVS_REPORT | LVS_SHOWSELALWAYS | LVS_SHAREIMAGELISTS | LVS_AUTOARRANGE | WS_BORDER | WS_TABSTOP,7,31,437,228 + PUSHBUTTON "@B_DELETE",B_DELETE,201,267,93,16 + PUSHBUTTON "@B_REFRESH",B_REFRESH,301,267,82,16 + PUSHBUTTON "@IDCANCEL",IDCANCEL,393,267,51,16 +END + +D_SM_IP DIALOGEX 0, 0, 451, 288 +STYLE DS_SETFONT | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "@D_SM_IP" +FONT 9, "MS Shell Dlg", 400, 0, 0x80 +BEGIN + ICON ICO_PROTOCOL,IDC_STATIC,7,5,20,18 + LTEXT "@S_TITLE",S_TITLE,35,5,409,18 + CONTROL "",L_TABLE,"SysListView32",LVS_REPORT | LVS_SHOWSELALWAYS | LVS_SHAREIMAGELISTS | LVS_AUTOARRANGE | WS_BORDER | WS_TABSTOP,7,31,437,228 + PUSHBUTTON "@B_DELETE",B_DELETE,201,267,93,16 + PUSHBUTTON "@B_REFRESH",B_REFRESH,301,267,82,16 + PUSHBUTTON "@IDCANCEL",IDCANCEL,393,267,51,16 +END + +D_SM_CREATE_CERT DIALOGEX 0, 0, 301, 317 +STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "@D_SM_CREATE_CERT" +FONT 9, "MS Shell Dlg", 400, 0, 0x80 +BEGIN + ICON ICO_CERT,IDC_STATIC,7,5,20,18 + LTEXT "@STATIC1",IDC_STATIC,31,5,263,18 + RTEXT "@STATIC2",IDC_STATIC,7,33,69,12 + CONTROL "@R_ROOT_CERT",R_ROOT_CERT,"Button",BS_AUTORADIOBUTTON,81,31,187,9 + CONTROL "@R_SIGNED_CERT",R_SIGNED_CERT,"Button",BS_AUTORADIOBUTTON,81,45,189,9 + RTEXT "@S_LOAD_1",S_LOAD_1,7,64,69,17 + PUSHBUTTON "@B_LOAD",B_LOAD,81,64,102,16 + LTEXT "@S_LOAD_2",S_LOAD_2,81,83,206,31 + CONTROL "",IDC_STATIC,"Static",SS_ETCHEDHORZ,7,117,287,18 + RTEXT "@S_LOAD_3",S_LOAD_3,7,125,69,11 + EDITTEXT E_CN,81,123,205,11,ES_AUTOHSCROLL + RTEXT "@S_LOAD_4",S_LOAD_4,7,139,69,10 + EDITTEXT E_O,81,137,205,11,ES_AUTOHSCROLL + RTEXT "@S_LOAD_5",S_LOAD_5,7,155,69,11 + EDITTEXT E_OU,81,153,205,11,ES_AUTOHSCROLL + RTEXT "@S_LOAD_6",S_LOAD_6,7,171,69,10 + EDITTEXT E_C,81,169,205,11,ES_AUTOHSCROLL + RTEXT "@S_LOAD_7",S_LOAD_7,7,185,69,10 + EDITTEXT E_ST,81,184,205,11,ES_AUTOHSCROLL + RTEXT "@S_LOAD_8",S_LOAD_8,7,201,69,9 + EDITTEXT E_L,81,199,205,11,ES_AUTOHSCROLL + RTEXT "@S_LOAD_11",S_LOAD_11,7,216,69,17 + EDITTEXT E_SERIAL,81,215,205,11,ES_AUTOHSCROLL + CONTROL "",IDC_STATIC,"Static",SS_ETCHEDHORZ,7,233,286,1 + RTEXT "@S_LOAD_9",S_LOAD_9,7,245,69,10 + EDITTEXT E_EXPIRE,81,243,36,11,ES_CENTER | ES_AUTOHSCROLL | ES_NUMBER + LTEXT "@S_LOAD_10",S_LOAD_10,121,245,28,10 + RTEXT "@S_LOAD_12",S_LOAD_12,157,245,51,10 + COMBOBOX C_BITS,210,240,48,113,CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL | WS_TABSTOP + LTEXT "bits",S_LOAD_13,263,245,28,10 + CONTROL "",IDC_STATIC,"Static",SS_ETCHEDHORZ,7,260,285,1 + ICON ICO_INFORMATION,IDC_STATIC,7,268,20,18 + LTEXT "@STATIC3",IDC_STATIC,30,269,264,25 + DEFPUSHBUTTON "@IDOK",IDOK,157,295,64,17 + PUSHBUTTON "@IDCANCEL",IDCANCEL,230,295,64,17 +END + +D_NM_LOGIN DIALOGEX 0, 0, 275, 114 +STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "@D_NM_LOGIN" +FONT 9, "MS Shell Dlg", 400, 0, 0x80 +BEGIN + ICON ICO_KEY,IDC_STATIC,7,5,20,18 + LTEXT "@S_TITLE",S_TITLE,31,5,237,30 + RTEXT "@STATIC1",IDC_STATIC,33,59,49,11 + EDITTEXT E_PASSWORD,87,58,141,11,ES_PASSWORD | ES_AUTOHSCROLL + GROUPBOX "@STATIC2",IDC_STATIC,26,40,222,43 + DEFPUSHBUTTON "@IDOK",IDOK,158,95,52,14 + PUSHBUTTON "@IDCANCEL",IDCANCEL,216,95,52,14 +END + +D_SPEEDMETER DIALOGEX 0, 0, 319, 252 +STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "@D_SPEEDMETER" +FONT 9, "MS Shell Dlg", 400, 0, 0x80 +BEGIN + ICON ICO_NIC_ONLINE,IDC_STATIC,7,5,20,18 + LTEXT "@STATIC1",IDC_STATIC,31,11,281,11 + COMBOBOX E_LIST,32,25,215,121,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP + GROUPBOX "@STATIC2",IDC_STATIC,7,47,305,199 + CONTROL "",L_STATUS,"SysListView32",LVS_REPORT | LVS_SHOWSELALWAYS | LVS_SHAREIMAGELISTS | LVS_AUTOARRANGE | LVS_NOSORTHEADER | WS_BORDER | WS_TABSTOP,19,62,276,174 + PUSHBUTTON "@STATIC3",B_REFRESH,254,24,50,14 +END + +D_NM_MAIN DIALOGEX 0, 0, 351, 325 +STYLE DS_SETFONT | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "@D_NM_MAIN" +FONT 9, "MS Shell Dlg", 400, 0, 0x80 +BEGIN + CONTROL 176,IDC_STATIC,"Static",SS_BITMAP,7,5,338,89 + GROUPBOX "@STATIC1",IDC_STATIC,7,95,337,73 + ICON ICO_VPNSERVER,IDC_STATIC,14,105,20,18 + LTEXT "@STATIC2",IDC_STATIC,38,107,297,18 + PUSHBUTTON "@B_SETTING",B_SETTING,44,126,111,15 + PUSHBUTTON "@B_CONNECT",B_CONNECT,164,126,61,15 + PUSHBUTTON "@B_DISCONNECT",B_DISCONNECT,234,126,61,15 + ICON ICO_INTERNET,IDC_STATIC,15,144,20,18 + LTEXT "",S_STATUS,39,150,298,13,SS_WORDELLIPSIS + GROUPBOX "@STATIC3",IDC_STATIC,7,173,337,54 + ICON ICO_ROUTER,IDC_STATIC,15,184,20,18 + LTEXT "@STATIC4",IDC_STATIC,38,186,297,12 + PUSHBUTTON "@B_OPTION",B_OPTION,113,203,120,15 + GROUPBOX "@STATIC5",IDC_STATIC,7,228,337,72 + ICON ICO_MACHINE,IDC_STATIC,14,238,20,18 + LTEXT "@STATIC6",IDC_STATIC,38,239,297,12 + PUSHBUTTON "@B_NAT",B_NAT,75,255,97,15 + PUSHBUTTON "@B_DHCP",B_DHCP,186,255,97,15 + PUSHBUTTON "@B_STATUS",B_STATUS,75,275,97,15 + PUSHBUTTON "@B_INFO",B_INFO,186,275,97,15 + PUSHBUTTON "@B_PASSWORD",B_PASSWORD,7,305,97,15 + PUSHBUTTON "@B_REFRESH",B_REFRESH,109,305,71,15 + PUSHBUTTON "@B_ABOUT",B_ABOUT,192,305,71,15 + PUSHBUTTON "@IDCANCEL",IDCANCEL,279,305,65,15 +END + +D_NM_OPTION DIALOGEX 0, 0, 419, 278 +STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "@D_NM_OPTION" +FONT 9, "MS Shell Dlg", 400, 0, 0x80 +BEGIN + ICON ICO_ROUTER,IDC_STATIC,7,5,18,18 + LTEXT "@S_TITLE",S_TITLE,29,9,357,17 + GROUPBOX "@STATIC1",IDC_STATIC,7,34,199,72 + ICON ICO_NIC_ONLINE,IDC_STATIC,14,47,18,18 + RTEXT "@STATIC2",IDC_STATIC,39,51,59,11 + EDITTEXT E_MAC,102,50,81,11,ES_AUTOHSCROLL + RTEXT "@STATIC3",IDC_STATIC,39,69,59,10 + CONTROL "",E_IP,"SysIPAddress32",WS_TABSTOP,102,67,75,12 + RTEXT "@STATIC4",IDC_STATIC,39,87,59,9 + CONTROL "",E_MASK,"SysIPAddress32",WS_TABSTOP,102,85,75,12 + GROUPBOX "@STATIC5",IDC_STATIC,7,111,199,77 + CONTROL "@R_USE_NAT",R_USE_NAT,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,14,125,157,9 + RTEXT "@STATIC6",IDC_STATIC,39,138,59,10 + EDITTEXT E_MTU,102,137,39,11,ES_CENTER | ES_AUTOHSCROLL | ES_NUMBER + LTEXT "@STATIC7",IDC_STATIC,145,138,52,9 + RTEXT "@STATIC8",IDC_STATIC,10,154,88,9 + EDITTEXT E_TCP,102,152,39,11,ES_CENTER | ES_AUTOHSCROLL | ES_NUMBER + LTEXT "@STATIC9",IDC_STATIC,145,154,47,9 + RTEXT "@STATIC10",IDC_STATIC,10,169,88,10 + EDITTEXT E_UDP,102,167,39,11,ES_CENTER | ES_AUTOHSCROLL | ES_NUMBER + LTEXT "@STATIC11",IDC_STATIC,145,169,51,9 + GROUPBOX "@S_1",S_1,7,194,199,62 + ICON ICO_PROTOCOL,IDC_STATIC,14,204,18,18 + LTEXT "@S_2",S_2,40,208,159,18 + PUSHBUTTON "@B_PUSH",B_PUSH,55,230,143,17 + CONTROL "@R_SAVE_LOG",R_SAVE_LOG,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,14,263,190,9 + GROUPBOX "@STATIC12",IDC_STATIC,211,34,201,196 + CONTROL "@R_USE_DHCP",R_USE_DHCP,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,218,47,161,9 + RTEXT "@STATIC13",IDC_STATIC,218,63,84,10 + CONTROL "",E_DHCP_START,"SysIPAddress32",WS_TABSTOP,306,61,75,12 + LTEXT "@STATIC14",IDC_STATIC,384,63,24,10 + CONTROL "",E_DHCP_END,"SysIPAddress32",WS_TABSTOP,306,78,75,12 + LTEXT "@STATIC15",IDC_STATIC,384,80,26,9 + RTEXT "@STATIC16",IDC_STATIC,218,97,84,10 + CONTROL "",E_DHCP_MASK,"SysIPAddress32",WS_TABSTOP,306,95,75,12 + RTEXT "@STATIC17",IDC_STATIC,218,116,84,9 + EDITTEXT E_EXPIRES,306,114,39,11,ES_CENTER | ES_AUTOHSCROLL | ES_NUMBER + LTEXT "@STATIC18",IDC_STATIC,349,116,54,9 + CONTROL "",IDC_STATIC,"Static",SS_ETCHEDHORZ,218,131,185,1 + LTEXT "@STATIC19",IDC_STATIC,218,139,184,12 + RTEXT "@STATIC20",IDC_STATIC,218,155,84,18 + CONTROL "",E_GATEWAY,"SysIPAddress32",WS_TABSTOP,306,156,75,12 + RTEXT "@STATIC21",IDC_STATIC,213,177,89,12 + CONTROL "",E_DNS,"SysIPAddress32",WS_TABSTOP,306,175,75,12 + RTEXT "@STATIC23",IDC_STATIC,213,195,89,12 + CONTROL "",E_DNS2,"SysIPAddress32",WS_TABSTOP,306,193,75,12 + RTEXT "@STATIC22",IDC_STATIC,218,213,84,11 + EDITTEXT E_DOMAIN,306,211,98,11,ES_AUTOHSCROLL + DEFPUSHBUTTON "@IDOK",IDOK,274,256,64,17 + PUSHBUTTON "@IDCANCEL",IDCANCEL,348,256,64,17 +END + +D_NM_NAT DIALOGEX 0, 0, 451, 288 +STYLE DS_SETFONT | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "@D_NM_NAT" +FONT 9, "MS Shell Dlg", 400, 0, 0x80 +BEGIN + ICON ICO_PROTOCOL,IDC_STATIC,7,5,20,18 + LTEXT "@S_TITLE",S_TITLE,35,5,409,18 + CONTROL "",L_TABLE,"SysListView32",LVS_REPORT | LVS_SHOWSELALWAYS | LVS_SHAREIMAGELISTS | LVS_AUTOARRANGE | WS_BORDER | WS_TABSTOP,7,31,437,228 + PUSHBUTTON "@B_REFRESH",B_REFRESH,301,267,82,16 + PUSHBUTTON "@IDCANCEL",IDCANCEL,393,267,51,16 +END + +D_NM_DHCP DIALOGEX 0, 0, 451, 288 +STYLE DS_SETFONT | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "@D_NM_DHCP" +FONT 9, "MS Shell Dlg", 400, 0, 0x80 +BEGIN + ICON ICO_INTERNET,IDC_STATIC,7,5,18,18 + LTEXT "@S_TITLE",S_TITLE,35,5,409,18 + CONTROL "",L_TABLE,"SysListView32",LVS_REPORT | LVS_SHOWSELALWAYS | LVS_SHAREIMAGELISTS | LVS_AUTOARRANGE | WS_BORDER | WS_TABSTOP,7,31,437,228 + PUSHBUTTON "@B_REFRESH",B_REFRESH,301,267,82,16 + PUSHBUTTON "@IDCANCEL",IDCANCEL,393,267,51,16 +END + +D_NM_CHANGE_PASSWORD DIALOGEX 0, 0, 250, 95 +STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "@D_NM_CHANGE_PASSWORD" +FONT 9, "MS Shell Dlg", 400, 0, 0x80 +BEGIN + ICON ICO_USER_ADMIN,IDC_STATIC,7,5,20,18 + LTEXT "@S_TITLE",S_TITLE,31,5,212,25 + RTEXT "@STATIC1",IDC_STATIC,7,35,65,9 + EDITTEXT E_PASSWORD1,78,33,130,11,ES_PASSWORD | ES_AUTOHSCROLL + RTEXT "@STATIC2",IDC_STATIC,7,51,65,9 + EDITTEXT E_PASSWORD2,78,49,130,11,ES_PASSWORD | ES_AUTOHSCROLL + DEFPUSHBUTTON "@IDOK",IDOK,106,73,64,17 + PUSHBUTTON "@IDCANCEL",IDCANCEL,179,73,64,17 +END + +D_SM_SNAT DIALOGEX 0, 0, 355, 272 +STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "@D_SM_SNAT" +FONT 9, "MS Shell Dlg", 400, 0, 0x80 +BEGIN + ICON ICO_ROUTER,IDC_STATIC,7,5,18,18 + LTEXT "@S_TITLE",S_TITLE,31,5,317,23 + GROUPBOX "@STATIC1",IDC_STATIC,7,31,341,83 + ICON ICO_WARNING,IDC_STATIC,14,45,20,20 + LTEXT "@S_WARNING",S_WARNING,39,45,301,19 + LTEXT "@S_WARNING2",S_WARNING2,39,69,301,39 + GROUPBOX "@STATIC2",IDC_STATIC,7,117,341,66 + LTEXT "@STATIC3",IDC_STATIC,15,129,325,11 + PUSHBUTTON "@B_ENABLE",B_ENABLE,19,143,102,16 + PUSHBUTTON "@B_DISABLE",B_DISABLE,125,143,102,16 + PUSHBUTTON "@B_CONFIG",B_CONFIG,232,143,102,16 + LTEXT "@STATIC4",IDC_STATIC,15,163,325,16 + GROUPBOX "@STATIC5",IDC_STATIC,7,185,341,56 + ICON ICO_INFORMATION,IDC_STATIC,14,197,20,20 + LTEXT "@STATIC6",IDC_STATIC,43,201,230,12 + PUSHBUTTON "@B_NAT",B_NAT,17,218,100,16 + PUSHBUTTON "@B_DHCP",B_DHCP,122,218,100,16 + PUSHBUTTON "@B_STATUS",B_STATUS,226,218,112,16 + CONTROL 179,S_TSUKUBA1,"Static",SS_BITMAP | NOT WS_VISIBLE,644,-7,68,23 + LTEXT "@S_TSUKUBA2",S_TSUKUBA2,78,251,204,16,NOT WS_VISIBLE + PUSHBUTTON "@IDCANCEL",IDCANCEL,288,251,60,16 +END + +D_SM_BRIDGE DIALOGEX 0, 0, 367, 325 +STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "@D_SM_BRIDGE" +FONT 9, "MS Shell Dlg", 400, 0, 0x80 +BEGIN + ICON ICO_BRIDGE,IDC_STATIC,7,5,20,18 + LTEXT "@STATIC1",IDC_STATIC,33,5,327,37 + CONTROL "",L_LIST,"SysListView32",LVS_REPORT | LVS_SHOWSELALWAYS | LVS_SHAREIMAGELISTS | LVS_AUTOARRANGE | LVS_NOSORTHEADER | WS_BORDER | WS_TABSTOP,7,47,353,85 + PUSHBUTTON "@B_VLAN",B_VLAN,7,136,130,15 + PUSHBUTTON "@B_DELETE",B_DELETE,267,136,93,15 + GROUPBOX "@STATIC2",IDC_STATIC,7,155,353,136 + ICON ICO_HUB,IDC_STATIC,16,167,20,18 + LTEXT "@STATIC3",IDC_STATIC,40,168,310,9 + RTEXT "@STATIC4",IDC_STATIC,40,182,53,9 + COMBOBOX E_HUBNAME,100,180,250,83,CBS_DROPDOWN | CBS_SORT | WS_VSCROLL | WS_TABSTOP + CONTROL "",IDC_STATIC,"Static",SS_ETCHEDHORZ,22,196,328,1 + LTEXT "@STATIC5",S_STATIC5,14,202,54,11 + CONTROL "@R_BRIDGE",R_BRIDGE,"Button",BS_AUTORADIOBUTTON,73,201,274,9 + CONTROL "@R_TAP",R_TAP,"Button",BS_AUTORADIOBUTTON,73,213,275,9 + ICON ICO_NIC_ONLINE,S_ICON,14,225,20,18 + LTEXT "--INFO--",S_INFO,38,224,311,11 + RTEXT "@S_ETH_1",S_ETH_1,38,239,53,10 + COMBOBOX E_NICNAME,100,236,251,83,CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL | WS_TABSTOP + RTEXT "@S_TAP_1",S_TAP_1,14,252,77,9 + EDITTEXT E_TAPNAME,99,251,81,11,ES_AUTOHSCROLL + LTEXT "@S_TAP_2",S_TAP_2,183,253,80,9 + LTEXT "@STATIC6",IDC_STATIC,14,263,236,25 + DEFPUSHBUTTON "@IDOK",IDOK,258,269,91,15 + PUSHBUTTON "@IDCANCEL",IDCANCEL,301,295,59,16 + LTEXT "@STATIC7",IDC_STATIC,7,295,286,24 +END + +D_WIN9X_REBOOT DIALOGEX 0, 0, 239, 89 +STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION +EXSTYLE WS_EX_TOPMOST +CAPTION "@D_WIN9X_REBOOT" +FONT 9, "MS Shell Dlg", 400, 0, 0x80 +BEGIN + ICON ICO_NIC_ONLINE,IDC_STATIC,7,5,20,18 + LTEXT "@STATIC1",IDC_STATIC,32,5,200,45 + CONTROL "",P_PROGRESS,"msctls_progress32",WS_BORDER,7,55,225,11 + CTEXT "-- COUNTER --",S_INFO,7,70,225,13 +END + +D_DEFAULT1 DIALOGEX 0, 0, 186, 77 +STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "PacketiX VPN" +FONT 9, "MS Shell Dlg", 400, 0, 0x80 +BEGIN +END + +D_EM_MAIN DIALOGEX 0, 0, 335, 180 +STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_MINIMIZEBOX | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "@D_EM_MAIN" +FONT 9, "MS Shell Dlg", 400, 0, 0x80 +BEGIN + ICON ICO_NIC_ONLINE,-1,7,5,20,18 + LTEXT "@STATIC1",-1,31,5,297,37 + CONTROL "",L_LIST,"SysListView32",LVS_REPORT | LVS_SHOWSELALWAYS | LVS_SHAREIMAGELISTS | LVS_AUTOARRANGE | LVS_NOSORTHEADER | WS_BORDER | WS_TABSTOP,7,47,321,103 + PUSHBUTTON "@B_PASSWORD",B_PASSWORD,7,159,60,16 + PUSHBUTTON "@B_LICENSE",B_LICENSE,72,159,50,16 + PUSHBUTTON "@B_ADD",B_ADD,127,159,47,16 + DEFPUSHBUTTON "@IDOK",IDOK,178,159,47,16 + PUSHBUTTON "@B_DELETE",B_DELETE,229,159,47,16 + PUSHBUTTON "@IDCANCEL",IDCANCEL,281,159,47,16 +END + +D_EM_ADD DIALOGEX 0, 0, 279, 297 +STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "@D_EM_ADD" +FONT 9, "MS Shell Dlg", 400, 0, 0x80 +BEGIN + GROUPBOX "@STATIC1",-1,7,5,265,51 + ICON ICO_NIC_ONLINE,-1,14,17,20,18 + COMBOBOX C_DEVICE,37,22,226,76,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP + CONTROL "@R_PROMISCUOUS",R_PROMISCUOUS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,38,37,223,11 + GROUPBOX "@STATIC2",-1,7,69,265,172 + ICON ICO_USER_ADMIN,-1,14,80,20,18 + RTEXT "@S_PACKET",S_PACKET,39,86,98,9 + COMBOBOX C_PACKET_SWITCH,142,84,121,76,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP + RTEXT "@S_PACKET_0",S_PACKET_0,14,110,58,11 + CONTROL "@B_PACKET_0_0",B_PACKET_0_0,"Button",BS_AUTORADIOBUTTON,79,108,42,9 + CONTROL "@B_PACKET_0_1",B_PACKET_0_1,"Button",BS_AUTORADIOBUTTON,125,108,57,9 + CONTROL "@B_PACKET_0_2",B_PACKET_0_2,"Button",BS_AUTORADIOBUTTON,187,108,66,9 + RTEXT "@S_PACKET_1",S_PACKET_1,14,125,58,10 + CONTROL "@B_PACKET_1_0",B_PACKET_1_0,"Button",BS_AUTORADIOBUTTON,79,124,42,9 + CONTROL "@B_PACKET_1_1",B_PACKET_1_1,"Button",BS_AUTORADIOBUTTON,125,124,57,9 + CONTROL "@B_PACKET_1_2",B_PACKET_1_2,"Button",BS_AUTORADIOBUTTON,187,124,66,9 + RTEXT "@S_PACKET_2",S_PACKET_2,14,141,58,11 + CONTROL "@B_PACKET_2_0",B_PACKET_2_0,"Button",BS_AUTORADIOBUTTON,79,139,42,9 + CONTROL "@B_PACKET_2_1",B_PACKET_2_1,"Button",BS_AUTORADIOBUTTON,125,139,57,9 + CONTROL "@B_PACKET_2_2",B_PACKET_2_2,"Button",BS_AUTORADIOBUTTON,187,139,66,9 + RTEXT "@S_PACKET_3",S_PACKET_3,14,155,58,10 + CONTROL "@B_PACKET_3_0",B_PACKET_3_0,"Button",BS_AUTORADIOBUTTON,79,153,42,9 + CONTROL "@B_PACKET_3_1",B_PACKET_3_1,"Button",BS_AUTORADIOBUTTON,125,153,57,9 + CONTROL "@B_PACKET_3_2",B_PACKET_3_2,"Button",BS_AUTORADIOBUTTON,187,153,66,9 + RTEXT "@S_PACKET_4",S_PACKET_4,14,170,58,9 + CONTROL "@B_PACKET_4_0",B_PACKET_4_0,"Button",BS_AUTORADIOBUTTON,79,168,42,9 + CONTROL "@B_PACKET_4_1",B_PACKET_4_1,"Button",BS_AUTORADIOBUTTON,125,168,57,9 + CONTROL "@B_PACKET_4_2",B_PACKET_4_2,"Button",BS_AUTORADIOBUTTON,187,168,66,9 + RTEXT "@S_PACKET_5",S_PACKET_5,14,185,58,11 + CONTROL "@B_PACKET_5_0",B_PACKET_5_0,"Button",BS_AUTORADIOBUTTON,79,184,42,9 + CONTROL "@B_PACKET_5_1",B_PACKET_5_1,"Button",BS_AUTORADIOBUTTON,125,184,57,9 + CONTROL "@B_PACKET_5_2",B_PACKET_5_2,"Button",BS_AUTORADIOBUTTON,187,184,66,9 + RTEXT "@S_PACKET_6",S_PACKET_6,14,197,58,9 + CONTROL "@B_PACKET_6_0",B_PACKET_6_0,"Button",BS_AUTORADIOBUTTON,79,197,42,9 + CONTROL "@B_PACKET_6_1",B_PACKET_6_1,"Button",BS_AUTORADIOBUTTON,125,197,57,9 + CONTROL "@B_PACKET_6_2",B_PACKET_6_2,"Button",BS_AUTORADIOBUTTON,187,197,66,9 + RTEXT "@S_PACKET_7",S_PACKET_7,14,211,58,17 + CONTROL "@B_PACKET_7_0",B_PACKET_7_0,"Button",BS_AUTORADIOBUTTON,79,213,42,9 + CONTROL "@B_PACKET_7_1",B_PACKET_7_1,"Button",BS_AUTORADIOBUTTON,125,213,57,9 + CONTROL "@B_PACKET_7_2",B_PACKET_7_2,"Button",BS_AUTORADIOBUTTON,187,213,66,9 + DEFPUSHBUTTON "@IDOK",IDOK,135,275,64,17 + PUSHBUTTON "@IDCANCEL",IDCANCEL,208,275,64,17 + ICON ICO_WARNING,-1,7,246,20,18 + LTEXT "@STATIC3",-1,29,245,243,24 +END + +D_EM_PASSWORD DIALOGEX 0, 0, 250, 95 +STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "@D_EM_PASSWORD" +FONT 9, "MS Shell Dlg", 400, 0, 0x80 +BEGIN + ICON ICO_KEY,IDC_STATIC,7,5,20,18 + LTEXT "@S_TITLE",S_TITLE,31,5,212,18 + RTEXT "@STATIC1",IDC_STATIC,7,35,65,10 + EDITTEXT E_PASSWORD1,78,33,130,11,ES_PASSWORD | ES_AUTOHSCROLL + RTEXT "@STATIC2",IDC_STATIC,7,51,65,10 + EDITTEXT E_PASSWORD2,78,49,130,11,ES_PASSWORD | ES_AUTOHSCROLL + DEFPUSHBUTTON "@IDOK",IDOK,106,73,64,17 + PUSHBUTTON "@IDCANCEL",IDCANCEL,179,73,64,17 +END + +D_SM_CONFIG DIALOGEX 0, 0, 383, 315 +STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "@D_SM_CONFIG" +FONT 9, "MS Shell Dlg", 400, 0, 0x80 +BEGIN + ICON ICO_MACHINE,IDC_STATIC,7,5,20,18 + LTEXT "@IDC_INFO",IDC_INFO,36,10,340,21 + EDITTEXT E_CONFIG,7,37,369,221,ES_MULTILINE | ES_READONLY | ES_WANTRETURN | WS_VSCROLL + PUSHBUTTON "@B_FACTORY",B_FACTORY,7,293,112,17 + PUSHBUTTON "@B_EXPORT",B_EXPORT,127,293,74,17 + PUSHBUTTON "@B_IMPORT",B_IMPORT,206,293,112,17 + PUSHBUTTON "@IDCANCEL",IDCANCEL,323,293,53,17 + ICON ICO_WARNING,IDC_STATIC,7,263,20,18 + LTEXT "@STATIC1",IDC_STATIC,30,259,346,33 +END + +D_SM_ADMIN_OPTION DIALOGEX 0, 0, 310, 307 +STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "@D_SM_ADMIN_OPTION" +FONT 9, "MS Shell Dlg", 400, 0, 0x80 +BEGIN + ICON ICO_USER_ADMIN,S_ICON,7,5,20,18 + LTEXT "@S_INFO",S_INFO,31,12,272,15 + CONTROL "",L_LIST,"SysListView32",LVS_REPORT | LVS_SHOWSELALWAYS | LVS_SHAREIMAGELISTS | LVS_AUTOARRANGE | LVS_NOSORTHEADER | WS_BORDER | WS_TABSTOP,7,31,224,136 + PUSHBUTTON "@B_EDIT",B_EDIT,239,31,64,15 + PUSHBUTTON "@B_ADD",B_ADD,239,95,64,15,NOT WS_VISIBLE + PUSHBUTTON "@B_DELETE",B_DELETE,239,119,64,15,NOT WS_VISIBLE + LTEXT "@S_BOLD",S_BOLD,7,169,223,7 + EDITTEXT E_HELP,7,179,296,38,ES_MULTILINE | ES_AUTOVSCROLL | ES_READONLY | ES_WANTRETURN | WS_VSCROLL + ICON ICO_INFORMATION,IDC_STATIC,7,220,20,18 + LTEXT "@STATIC1",S_STATIC1,31,221,272,16 + LTEXT "@STATIC2",S_STATIC2,31,237,272,48 + DEFPUSHBUTTON "@IDOK",IDOK,182,287,56,15 + PUSHBUTTON "@IDCANCEL",IDCANCEL,247,287,56,15 +END + +D_SM_AO_VALUE DIALOGEX 0, 0, 206, 68 +STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "@D_SM_AO_VALUE" +FONT 9, "MS Shell Dlg", 400, 0, 0x80 +BEGIN + RTEXT "@STATIC1",IDC_STATIC,7,14,37,10 + COMBOBOX C_NAME,47,12,145,144,CBS_DROPDOWN | CBS_SORT | WS_VSCROLL | WS_TABSTOP + RTEXT "@STATIC2",IDC_STATIC,7,31,37,9 + EDITTEXT E_VALUE,47,29,67,11,ES_AUTOHSCROLL | ES_NUMBER + LTEXT "@STATIC3",IDC_STATIC,118,31,37,12 + DEFPUSHBUTTON "@IDOK",IDOK,80,48,56,14 + PUSHBUTTON "@IDCANCEL",IDCANCEL,143,48,56,14 +END + +D_SM_L3 DIALOGEX 0, 0, 291, 255 +STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "@D_SM_L3" +FONT 9, "MS Shell Dlg", 400, 0, 0x80 +BEGIN + ICON ICO_SWITCH,IDC_STATIC,7,5,20,18 + LTEXT "@STATIC1",IDC_STATIC,31,5,253,19 + ICON ICO_WARNING,IDC_STATIC,11,41,20,18 + LTEXT "@STATIC2",IDC_STATIC,35,38,244,50 + GROUPBOX "@STATIC3",IDC_STATIC,7,29,277,61 + LTEXT "@S_BOLD",S_BOLD,7,97,183,11 + CONTROL "",L_LIST,"SysListView32",LVS_REPORT | LVS_SHOWSELALWAYS | LVS_SHAREIMAGELISTS | LVS_AUTOARRANGE | LVS_NOSORTHEADER | WS_BORDER | WS_TABSTOP,7,110,277,97 + PUSHBUTTON "@B_ADD",B_ADD,7,212,48,16 + PUSHBUTTON "@B_START",B_START,64,212,48,16 + PUSHBUTTON "@B_STOP",B_STOP,121,212,48,16 + DEFPUSHBUTTON "@IDOK",IDOK,178,212,48,16 + PUSHBUTTON "@B_DELETE",B_DELETE,235,212,48,16 + PUSHBUTTON "@IDCANCEL",IDCANCEL,226,233,58,16 +END + +D_SM_L3_ADD DIALOGEX 0, 0, 234, 89 +STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "@D_SM_L3_ADD" +FONT 9, "MS Shell Dlg", 400, 0, 0x80 +BEGIN + ICON ICO_SWITCH,IDC_STATIC,7,5,20,18 + LTEXT "@STATIC1",IDC_STATIC,32,5,195,43 + RTEXT "@STATIC2",IDC_STATIC,7,51,35,11 + EDITTEXT E_NAME,46,49,173,11,ES_AUTOHSCROLL + DEFPUSHBUTTON "@IDOK",IDOK,99,69,61,15 + PUSHBUTTON "@IDCANCEL",IDCANCEL,166,69,61,15 +END + +D_SM_L3_SW DIALOGEX 0, 0, 298, 320 +STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "@D_SM_L3_SW" +FONT 9, "MS Shell Dlg", 400, 0, 0x80 +BEGIN + ICON ICO_SWITCH_OFFLINE,IDC_STATIC,7,5,20,18 + LTEXT "@STATIC1",IDC_STATIC,31,5,260,18 + LTEXT "@STATIC2",IDC_STATIC,31,23,260,48 + LTEXT "@S_BOLD1",S_BOLD1,7,70,183,11 + CONTROL "",L_IF,"SysListView32",LVS_REPORT | LVS_SHOWSELALWAYS | LVS_SHAREIMAGELISTS | LVS_AUTOARRANGE | LVS_NOSORTHEADER | WS_BORDER | WS_TABSTOP,7,81,284,81 + PUSHBUTTON "@B_ADD_IF",B_ADD_IF,46,167,119,16 + PUSHBUTTON "@B_DEL_IF",B_DEL_IF,170,167,121,16 + LTEXT "@S_BOLD2",S_BOLD2,7,186,183,11 + CONTROL "",L_TABLE,"SysListView32",LVS_REPORT | LVS_SHOWSELALWAYS | LVS_SHAREIMAGELISTS | LVS_AUTOARRANGE | LVS_NOSORTHEADER | WS_BORDER | WS_TABSTOP,7,198,284,76 + PUSHBUTTON "@B_ADD_TABLE",B_ADD_TABLE,46,276,119,16 + PUSHBUTTON "@B_DEL_TABLE",B_DEL_TABLE,170,276,121,16 + PUSHBUTTON "@B_START",B_START,7,299,58,16 + PUSHBUTTON "@B_STOP",B_STOP,72,299,58,16 + PUSHBUTTON "@IDCANCEL",IDCANCEL,233,299,58,16 +END + +D_SM_L3_SW_IF DIALOGEX 0, 0, 259, 247 +STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "@D_SM_L3_SW_IF" +FONT 9, "MS Shell Dlg", 400, 0, 0x80 +BEGIN + ICON ICO_NIC_ONLINE,IDC_STATIC,7,5,20,18 + LTEXT "@STATIC1",IDC_STATIC,33,5,219,48 + GROUPBOX "@STATIC2",IDC_STATIC,7,58,245,54 + ICON ICO_HUB,IDC_STATIC,12,70,20,18 + LTEXT "@STATIC3",IDC_STATIC,35,71,210,16 + RTEXT "@STATIC4",IDC_STATIC,26,91,53,10 + COMBOBOX E_HUBNAME,86,89,159,129,CBS_DROPDOWN | CBS_SORT | WS_VSCROLL | WS_TABSTOP + GROUPBOX "@STATIC5",IDC_STATIC,7,115,245,102 + ICON ICO_PROTOCOL,IDC_STATIC,12,130,20,18 + LTEXT "@STATIC6",IDC_STATIC,35,125,210,51 + RTEXT "@S_SRC_IP_1",S_SRC_IP_1,31,181,51,10 + CONTROL "",E_IP,"SysIPAddress32",WS_TABSTOP,86,179,75,12 + RTEXT "@S_SRC_IP_2",S_SRC_IP_2,15,197,67,10 + CONTROL "",E_MASK,"SysIPAddress32",WS_TABSTOP,86,195,75,12 + DEFPUSHBUTTON "@IDOK",IDOK,115,225,64,17 + PUSHBUTTON "@IDCANCEL",IDCANCEL,188,225,64,17 +END + +D_SM_L3_SW_TABLE DIALOGEX 0, 0, 259, 224 +STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "@D_SM_L3_SW_TABLE" +FONT 9, "MS Shell Dlg", 400, 0, 0x80 +BEGIN + ICON ICO_MACHINE,IDC_STATIC,7,5,20,18 + LTEXT "@STATIC1",IDC_STATIC,33,5,219,49 + GROUPBOX "@STATIC2",IDC_STATIC,7,55,245,136 + ICON ICO_PROTOCOL,IDC_STATIC,12,70,20,18 + LTEXT "@STATIC3",IDC_STATIC,35,66,210,52 + RTEXT "@S_SRC_IP_1",S_SRC_IP_1,15,121,67,10 + CONTROL "",E_NETWORK,"SysIPAddress32",WS_TABSTOP,86,119,75,12 + RTEXT "@S_SRC_IP_2",S_SRC_IP_2,15,137,67,9 + CONTROL "",E_MASK,"SysIPAddress32",WS_TABSTOP,86,135,75,12 + RTEXT "@S_SRC_IP_3",S_SRC_IP_3,15,152,67,10 + CONTROL "",E_GATEWAY,"SysIPAddress32",WS_TABSTOP,86,150,75,12 + RTEXT "@S_SRC_IP_4",S_SRC_IP_4,15,167,67,10 + EDITTEXT E_METRIC,86,166,40,12,ES_CENTER | ES_AUTOHSCROLL | ES_NUMBER + LTEXT "@STATIC4",IDC_STATIC,166,141,79,47 + DEFPUSHBUTTON "@IDOK",IDOK,115,202,64,17 + PUSHBUTTON "@IDCANCEL",IDCANCEL,188,202,64,17 +END + +D_CM_SELECT_SECURE DIALOGEX 0, 0, 295, 214 +STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "@D_CM_SELECT_SECURE" +FONT 9, "MS Shell Dlg", 400, 0, 0x80 +BEGIN + ICON ICO_SECURE,IDC_STATIC,7,5,20,18 + LTEXT "@STATIC1",IDC_STATIC,31,5,257,67 + CONTROL "",L_LIST,"SysListView32",LVS_REPORT | LVS_SHOWSELALWAYS | LVS_SHAREIMAGELISTS | LVS_AUTOARRANGE | LVS_NOSORTHEADER | WS_BORDER | WS_TABSTOP,7,77,281,108 + DEFPUSHBUTTON "@IDOK",IDOK,154,193,64,15 + PUSHBUTTON "@IDCANCEL",IDCANCEL,224,193,64,15 +END + +D_CM_SECURE_MANAGER DIALOGEX 0, 0, 295, 228 +STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "@D_CM_SECURE_MANAGER" +FONT 9, "MS Shell Dlg", 400, 0, 0x80 +BEGIN + ICON ICO_SECURE,IDC_STATIC,7,5,20,18 + LTEXT "@S_INFO",S_INFO,31,5,257,24 + LTEXT "@B_BOLD",B_BOLD,7,36,141,12 + CONTROL "",L_LIST,"SysListView32",LVS_REPORT | LVS_SHOWSELALWAYS | LVS_SHAREIMAGELISTS | LVS_AUTOARRANGE | LVS_NOSORTHEADER | WS_BORDER | WS_TABSTOP,7,49,187,174 + PUSHBUTTON "@B_REFRESH",B_REFRESH,198,48,90,15 + PUSHBUTTON "@B_IMPORT",B_IMPORT,198,68,90,15 + PUSHBUTTON "@B_EXPORT",B_EXPORT,198,88,90,15 + PUSHBUTTON "@B_DELETE",B_DELETE,198,107,90,15 + PUSHBUTTON "@B_NEW_CERT",B_NEW_CERT,198,127,90,25,BS_MULTILINE + ICON ICO_KEY,IDC_STATIC,199,183,20,18 + PUSHBUTTON "@B_PIN",B_PIN,220,184,68,16 + PUSHBUTTON "@IDCANCEL",IDCANCEL,198,208,90,15 +END + +D_CM_SECURE_TYPE DIALOGEX 0, 0, 195, 107 +STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "@D_CM_SECURE_TYPE" +FONT 9, "MS Shell Dlg", 400, 0, 0x80 +BEGIN + LTEXT "@STATIC",IDC_STATIC,7,5,149,18 + CONTROL "@R_CERT",R_CERT,"Button",BS_AUTORADIOBUTTON,28,29,46,9 + CONTROL "@R_KEY",R_KEY,"Button",BS_AUTORADIOBUTTON,28,48,45,9 + CONTROL "@R_DATA",R_DATA,"Button",BS_AUTORADIOBUTTON,28,67,61,9 + DEFPUSHBUTTON "@IDOK",IDOK,51,87,64,15 + PUSHBUTTON "@IDCANCEL",IDCANCEL,124,87,64,15 +END + +D_STRING DIALOGEX 0, 0, 266, 104 +STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "@D_STRING" +FONT 9, "MS Shell Dlg", 400, 0, 0x80 +BEGIN + ICON "",S_ICON,7,5,18,18 + LTEXT "[INFO]",S_INFO,30,5,229,53 + EDITTEXT E_STRING,30,59,221,11,ES_AUTOHSCROLL + DEFPUSHBUTTON "@IDOK",IDOK,144,83,55,15 + PUSHBUTTON "@IDCANCEL",IDCANCEL,204,83,55,15 +END + +D_SM_SELECT_KEYPAIR DIALOGEX 0, 0, 201, 242 +STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "@D_SM_SELECT_KEYPAIR" +FONT 9, "MS Shell Dlg", 400, 0, 0x80 +BEGIN + ICON ICO_SECURE,-1,7,5,18,18 + LTEXT "@S_INFO",S_INFO,31,5,163,29 + CONTROL "",L_CERT,"SysListView32",LVS_REPORT | LVS_SINGLESEL | LVS_SHOWSELALWAYS | LVS_SHAREIMAGELISTS | LVS_AUTOARRANGE | LVS_NOSORTHEADER | WS_BORDER | WS_TABSTOP,7,47,187,72 + LTEXT "@B_BOLD1",B_BOLD1,7,36,187,10 + DEFPUSHBUTTON "@IDOK",IDOK,61,220,64,17 + PUSHBUTTON "@IDCANCEL",IDCANCEL,130,220,64,17 + CONTROL "",L_KEY,"SysListView32",LVS_REPORT | LVS_SINGLESEL | LVS_SHOWSELALWAYS | LVS_SHAREIMAGELISTS | LVS_AUTOARRANGE | LVS_NOSORTHEADER | WS_BORDER | WS_TABSTOP,7,138,187,72 + LTEXT "@B_BOLD2",B_BOLD2,7,127,187,10 +END + +D_CM_LOAD_X DIALOGEX 0, 0, 239, 179 +STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "@D_CM_LOAD_X" +FONT 9, "MS Shell Dlg", 400, 0, 0x80 +BEGIN + LTEXT "@STATIC1",IDC_STATIC,7,5,225,13 + CONTROL "@R_FROM_FILE",R_FROM_FILE,"Button",BS_AUTORADIOBUTTON,14,23,133,9 + CONTROL "@R_FROM_SECURE",R_FROM_SECURE,"Button",BS_AUTORADIOBUTTON,14,72,138,9 + ICON ICO_CERT,IDC_STATIC,25,38,20,18 + LTEXT "@S_FILE",S_FILE,50,41,182,23 + ICON ICO_SECURE,IDC_STATIC,25,89,20,18 + LTEXT "@S_CERT",S_CERT,50,90,182,23 + PUSHBUTTON "@B_SELECT",B_SELECT,50,112,110,18 + LTEXT "",S_INFO,45,132,187,23 + DEFPUSHBUTTON "@IDOK",IDOK,122,157,52,16 + PUSHBUTTON "@IDCANCEL",IDCANCEL,180,157,52,16 +END + +D_CM_SECURE_PIN DIALOGEX 0, 0, 263, 189 +STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "@D_CM_SECURE_PIN" +FONT 9, "MS Shell Dlg", 400, 0, 0x80 +BEGIN + ICON ICO_KEY,IDC_STATIC,7,5,20,18 + LTEXT "@STATIC1",IDC_STATIC,30,5,227,35 + RTEXT "@STATIC2",IDC_STATIC,7,47,70,9 + EDITTEXT E_PIN1,81,45,144,11,ES_PASSWORD | ES_AUTOHSCROLL + RTEXT "@STATIC3",IDC_STATIC,7,64,70,9 + EDITTEXT E_PIN2,81,62,144,11,ES_PASSWORD | ES_AUTOHSCROLL + RTEXT "@STATIC4",IDC_STATIC,7,81,70,9 + EDITTEXT E_PIN3,81,79,144,11,ES_PASSWORD | ES_AUTOHSCROLL + GROUPBOX "@STATIC5",IDC_STATIC,7,101,249,42 + ICON ICO_WARNING,IDC_STATIC,14,113,20,18 + LTEXT "@STATIC6",IDC_STATIC,40,113,208,17 + LTEXT "@STATIC7",IDC_STATIC,7,151,249,9 + DEFPUSHBUTTON "@IDOK",IDOK,123,168,64,15 + PUSHBUTTON "@IDCANCEL",IDCANCEL,192,168,64,15 +END + +D_SM_CRL DIALOGEX 0, 0, 335, 195 +STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "@D_SM_CRL" +FONT 9, "MS Shell Dlg", 400, 0, 0x80 +BEGIN + ICON ICO_CERT_X,IDC_STATIC,7,5,20,18 + LTEXT "@STATIC1",IDC_STATIC,33,5,295,30 + CONTROL "",L_LIST,"SysListView32",LVS_REPORT | LVS_SHOWSELALWAYS | LVS_SHAREIMAGELISTS | WS_BORDER | WS_TABSTOP,7,42,321,124 + PUSHBUTTON "@B_ADD",B_ADD,85,173,55,15 + DEFPUSHBUTTON "@IDOK",IDOK,209,173,58,15 + PUSHBUTTON "@IDCANCEL",IDCANCEL,273,173,55,15 + PUSHBUTTON "@B_DELETE",B_DELETE,147,173,54,15 +END + +D_SM_EDIT_CRL DIALOGEX 0, 0, 351, 312 +STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "@D_SM_EDIT_CRL" +FONT 9, "MS Shell Dlg", 400, 0, 0x80 +BEGIN + ICON ICO_CERT_X,IDC_STATIC,7,5,20,18 + LTEXT "@STATIC1",IDC_STATIC,31,5,313,30 + LTEXT "@S_BOLD",S_BOLD,7,37,337,12 + GROUPBOX "@STATIC2",IDC_STATIC,7,49,337,104 + CONTROL "@R_CN",R_CN,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,10,59,76,9 + EDITTEXT E_CN,96,59,241,11,ES_AUTOHSCROLL + CONTROL "@R_O",R_O,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,10,74,60,9 + EDITTEXT E_O,96,73,241,11,ES_AUTOHSCROLL + CONTROL "@R_OU",R_OU,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,10,88,80,9 + EDITTEXT E_OU,96,89,241,11,ES_AUTOHSCROLL + CONTROL "@R_C",R_C,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,10,105,53,9 + EDITTEXT E_C,96,104,241,11,ES_AUTOHSCROLL + CONTROL "@R_ST",R_ST,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,10,120,62,9 + EDITTEXT E_ST,96,119,241,11,ES_AUTOHSCROLL + CONTROL "@R_L",R_L,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,10,137,51,9 + EDITTEXT E_L,96,135,241,11,ES_AUTOHSCROLL + GROUPBOX "@STATIC3",IDC_STATIC,7,156,337,82 + CONTROL "@R_SERI",R_SERI,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,10,168,85,9 + EDITTEXT E_SERI,96,167,241,11,ES_AUTOHSCROLL + CONTROL "@R_MD5_HASH",R_MD5_HASH,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,10,183,125,9 + EDITTEXT E_MD5_HASH,142,180,195,11,ES_AUTOHSCROLL + CONTROL "@R_SHA1_HASH",R_SHA1_HASH,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,10,197,124,9 + EDITTEXT E_SHA1_HASH,142,196,195,11,ES_AUTOHSCROLL + ICON ICO_INFORMATION,IDC_STATIC,15,210,20,18 + LTEXT "@STATIC4",IDC_STATIC,39,212,298,24 + GROUPBOX "@STATIC5",IDC_STATIC,7,242,337,45 + LTEXT "@STATIC6",IDC_STATIC,39,252,216,30 + ICON ICO_CERT,IDC_STATIC,14,252,20,18 + PUSHBUTTON "@B_LOAD",B_LOAD,257,254,79,16 + DEFPUSHBUTTON "@IDOK",IDOK,225,293,56,14 + PUSHBUTTON "@IDCANCEL",IDCANCEL,288,293,56,14 +END + +D_SM_AC_LIST DIALOGEX 0, 0, 309, 197 +STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "@D_SM_AC_LIST" +FONT 9, "MS Shell Dlg", 400, 0, 0x80 +BEGIN + ICON ICO_INTERNET,IDC_STATIC,7,5,20,18 + LTEXT "@S_TITLE",S_TITLE,33,5,269,23 + CONTROL "",L_LIST,"SysListView32",LVS_REPORT | LVS_SHOWSELALWAYS | LVS_SHAREIMAGELISTS | LVS_AUTOARRANGE | LVS_NOSORTHEADER | WS_BORDER | WS_TABSTOP,7,32,222,136 + PUSHBUTTON "@B_ADD",B_ADD,234,33,68,16 + DEFPUSHBUTTON "@IDOK",IDOK,234,52,68,16 + PUSHBUTTON "@B_DELETE",B_DELETE,234,71,68,16 + PUSHBUTTON "@B_SAVE",B_SAVE,234,152,68,16 + PUSHBUTTON "@IDCANCEL",IDCANCEL,234,175,68,16 + LTEXT "@STATIC1",IDC_STATIC,235,94,67,24 + ICON ICO_INFORMATION,IDC_STATIC,7,173,20,18 + LTEXT "@STATIC2",IDC_STATIC,28,173,205,18 +END + +D_SM_AC DIALOGEX 0, 0, 310, 266 +STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "@D_SM_AC" +FONT 9, "MS Shell Dlg", 400, 0, 0x80 +BEGIN + ICON ICO_INTERNET,S_ICON,7,5,18,18 + LTEXT "@STATIC1",IDC_STATIC,33,5,270,25 + GROUPBOX "@STATIC2",IDC_STATIC,7,32,296,112 + LTEXT "@STATIC3",IDC_STATIC,14,44,281,11 + CONTROL "IPv&4",R_IPV4,"Button",BS_AUTORADIOBUTTON | WS_TABSTOP,110,58,38,9 + CONTROL "IPv&6",R_IPV6,"Button",BS_AUTORADIOBUTTON,155,58,91,9 + RTEXT "@STATIC9",IDC_STATIC,14,59,87,11 + CONTROL "@R_SINGLE",R_SINGLE,"Button",BS_AUTORADIOBUTTON | WS_TABSTOP,21,74,274,12 + CONTROL "@R_MASKED",R_MASKED,"Button",BS_AUTORADIOBUTTON,21,89,275,12 + RTEXT "@STATIC4",IDC_STATIC,21,107,80,10 + CONTROL "",E_IP,"SysIPAddress32",WS_TABSTOP,110,105,81,12 + RTEXT "@S_MASK",S_MASK,21,125,80,10 + CONTROL "",E_MASK,"SysIPAddress32",WS_TABSTOP,110,123,81,12 + GROUPBOX "@STATIC5",IDC_STATIC,7,155,296,32 + CONTROL "@R_PASS",R_PASS,"Button",BS_AUTORADIOBUTTON | WS_TABSTOP,21,169,87,9 + CONTROL "@R_DENY",R_DENY,"Button",BS_AUTORADIOBUTTON,112,169,91,9 + GROUPBOX "@STATIC6",IDC_STATIC,7,194,296,46 + RTEXT "@STATIC7",IDC_STATIC,16,213,47,10 + EDITTEXT E_PRIORITY,69,211,38,11,ES_CENTER | ES_AUTOHSCROLL | ES_NUMBER + LTEXT "@STATIC8",IDC_STATIC,112,213,181,12 + DEFPUSHBUTTON "@IDOK",IDOK,168,244,64,17 + PUSHBUTTON "@IDCANCEL",IDCANCEL,239,244,64,17 + EDITTEXT E_IPV6,110,105,186,12,ES_AUTOHSCROLL + EDITTEXT E_MASKV6,110,122,186,12,ES_AUTOHSCROLL +END + +D_SM_LOG_FILE DIALOGEX 0, 0, 398, 291 +STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "@D_SM_LOG_FILE" +FONT 9, "MS Shell Dlg", 400, 0, 0x80 +BEGIN + ICON ICO_LOG2,IDC_STATIC,7,5,18,18 + LTEXT "@STATIC1",IDC_STATIC,26,5,365,32 + CONTROL "",L_LIST,"SysListView32",LVS_REPORT | LVS_SHOWSELALWAYS | LVS_SHAREIMAGELISTS | WS_BORDER | WS_TABSTOP,7,41,384,221 + DEFPUSHBUTTON "@IDOK",IDOK,7,269,80,17 + PUSHBUTTON "@B_REFRESH",B_REFRESH,99,269,80,17 + PUSHBUTTON "@IDCANCEL",IDCANCEL,311,269,80,17 +END + +D_SM_READ_LOG_FILE DIALOGEX 0, 0, 287, 95 +STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "@D_SM_READ_LOG_FILE" +FONT 9, "MS Shell Dlg", 400, 0, 0x80 +BEGIN + LTEXT "@S_INFO2",S_INFO2,7,5,273,27 + CONTROL "",P_PROGRESS,"msctls_progress32",WS_BORDER | WS_TABSTOP,7,34,273,12 + CTEXT "--",S_INFO,7,52,273,17 + PUSHBUTTON "@IDCANCEL",IDCANCEL,102,73,83,16 +END + +D_SM_SAVE_LOG DIALOGEX 0, 0, 271, 70 +STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "@D_SM_SAVE_LOG" +FONT 9, "MS Shell Dlg", 400, 0, 0x80 +BEGIN + ICON ICO_LOG2,IDC_STATIC,7,5,18,18 + LTEXT "@S_INFO",S_INFO,27,5,237,31 + DEFPUSHBUTTON "@IDOK",IDOK,58,49,65,15 + PUSHBUTTON "@B_SAVE",B_SAVE,129,49,65,15 + PUSHBUTTON "@IDCANCEL",IDCANCEL,199,49,65,15 +END + +D_TCP DIALOGEX 0, 0, 331, 270 +STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "@D_TCP" +FONT 9, "MS Shell Dlg", 400, 0, 0x80 +BEGIN + ICON ICO_SETUP,IDC_STATIC,7,5,20,18 + LTEXT "@STATIC1",IDC_STATIC,33,5,269,46 + LTEXT "@STATIC2",IDC_STATIC,33,54,269,30 + GROUPBOX "@STATIC3",IDC_STATIC,33,86,269,130 + ICON ICO_PROTOCOL,IDC_STATIC,40,94,20,18 + LTEXT "@STATIC4",IDC_STATIC,65,95,174,10 + CONTROL "@R_RECV_DISABLE",R_RECV_DISABLE,"Button",BS_AUTORADIOBUTTON,73,105,175,9 + CONTROL "@R_RECV_ENABLE",R_RECV_ENABLE,"Button",BS_AUTORADIOBUTTON,73,118,183,9 + EDITTEXT E_RECV,84,131,48,11,ES_RIGHT | ES_AUTOHSCROLL | ES_NUMBER + LTEXT "@S_RECV",S_RECV,137,132,33,10 + PUSHBUTTON "@B_RECV",B_RECV,177,127,67,15 + CONTROL "",IDC_STATIC,"Static",SS_ETCHEDHORZ,54,151,194,1 + LTEXT "@STATIC5",IDC_STATIC,65,157,115,7 + CONTROL "@R_SEND_DISABLE",R_SEND_DISABLE,"Button",BS_AUTORADIOBUTTON,73,169,166,9 + CONTROL "@R_SEND_ENABLE",R_SEND_ENABLE,"Button",BS_AUTORADIOBUTTON,73,182,172,9 + EDITTEXT E_SEND,84,196,48,11,ES_RIGHT | ES_AUTOHSCROLL | ES_NUMBER + LTEXT "@S_SEND",S_SEND,137,197,33,10 + PUSHBUTTON "@B_SEND",B_SEND,177,192,66,15 + ICON ICO_WARNING,IDC_STATIC,16,221,20,18 + LTEXT "@STATIC6",IDC_STATIC,42,221,270,25 + PUSHBUTTON "@B_DELETE",B_DELETE,7,248,170,17 + DEFPUSHBUTTON "@IDOK",IDOK,188,248,64,17 + PUSHBUTTON "@IDCANCEL",IDCANCEL,260,248,64,17 +END + +D_TCP_MSG DIALOGEX 0, 0, 247, 177 +STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION +CAPTION "@D_TCP_MSG" +FONT 9, "MS Shell Dlg", 400, 0, 0x80 +BEGIN + ICON ICO_SETUP,IDC_STATIC,7,5,18,18 + LTEXT "@STATIC1",IDC_STATIC,31,5,209,43 + ICON ICO_WARNING,IDC_STATIC,7,146,18,18 + LTEXT "@STATIC2",IDC_STATIC,32,146,208,32 + CONTROL "",IDC_STATIC,"Static",SS_ETCHEDHORZ,7,138,233,1 + CONTROL "@R_OPTIMIZE",R_OPTIMIZE,"Button",BS_AUTORADIOBUTTON,31,53,209,14 + CONTROL "@R_MANUAL",R_MANUAL,"Button",BS_AUTORADIOBUTTON,31,72,209,13 + CONTROL "@R_NO",R_NO,"Button",BS_AUTORADIOBUTTON,31,91,209,14 + DEFPUSHBUTTON "@IDOK",IDOK,174,114,66,16 + PUSHBUTTON "@IDOK3",IDOK3,105,114,66,16,WS_DISABLED +END + +D_CM_PKCSEULA DIALOGEX 0, 0, 267, 135 +STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "@D_CM_PKCSEULA" +FONT 9, "MS Shell Dlg", 400, 0, 0x80 +BEGIN + ICON ICO_INFORMATION,IDC_STATIC,7,5,20,18 + LTEXT "@S_INFO_1",S_INFO_1,32,5,228,24 + LTEXT "@S_INFO_2",S_INFO_2,32,35,228,50 + CONTROL "",IDC_STATIC,"Static",SS_ETCHEDHORZ,31,88,229,1 + LTEXT "@S_INFO_3",S_INFO_3,32,94,228,16 + DEFPUSHBUTTON "@IDOK",IDOK,146,114,55,15 + PUSHBUTTON "@IDCANCEL",IDCANCEL,205,114,55,15 +END + +D_CM_KAKUSHI DIALOGEX 0, 0, 365, 233 +STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_SYSMENU +EXSTYLE WS_EX_TOPMOST | WS_EX_TOOLWINDOW +FONT 9, "MS Shell Dlg", 400, 0, 0x80 +BEGIN + ICON ICO_NIC_ONLINE,IDC_STATIC,19,48,18,18 + LTEXT "STRING HERE !!",S_INFO,56,52,302,114 + CONTROL "",P_PROGRESS,"msctls_progress32",WS_BORDER,7,172,351,14 +END + +D_CM_TRAFFIC DIALOGEX 0, 0, 395, 308 +STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "@D_CM_TRAFFIC" +FONT 9, "MS Shell Dlg", 400, 0, 0x80 +BEGIN + ICON ICO_SWITCH,IDC_STATIC,7,5,20,18 + LTEXT "@STATIC1",IDC_STATIC,30,5,342,34 + LTEXT "@STATIC2",IDC_STATIC,30,39,342,28 + GROUPBOX "@S_1",S_1,30,63,342,218 + LTEXT "@S_3",S_3,61,73,301,12 + CONTROL "@R_SERVER",R_SERVER,"Button",BS_AUTORADIOBUTTON,109,84,72,9 + CONTROL "@R_CLIENT",R_CLIENT,"Button",BS_AUTORADIOBUTTON,196,84,72,9 + ICON ICO_TOWER,IDC_STATIC,38,72,20,18 + CONTROL "",IDC_STATIC,"Static",SS_ETCHEDHORZ,41,97,319,1 + ICON ICO_PROTOCOL,IDC_STATIC,38,101,20,18 + LTEXT "@S_4",S_4,61,102,301,25 + RTEXT "@S_5",S_5,34,130,117,9 + COMBOBOX C_HOST,157,127,147,104,CBS_DROPDOWN | WS_VSCROLL | WS_TABSTOP + RTEXT "@S_6",S_6,35,145,116,10 + COMBOBOX C_PORT,157,143,40,104,CBS_DROPDOWN | WS_VSCROLL | WS_TABSTOP + LTEXT "@S_7",S_7,202,145,51,9 + LTEXT "@S_8",S_8,61,157,301,12 + GROUPBOX "@S_9",S_9,68,170,287,48 + CONTROL "@R_DOWNLOAD",R_DOWNLOAD,"Button",BS_AUTORADIOBUTTON,75,179,256,9 + CONTROL "@R_UPLOAD",R_UPLOAD,"Button",BS_AUTORADIOBUTTON,75,192,256,9 + CONTROL "@R_FULL",R_FULL,"Button",BS_AUTORADIOBUTTON,75,205,256,9 + GROUPBOX "@S_10",S_10,68,221,287,54 + RTEXT "@S_11",S_11,75,233,168,8 + COMBOBOX C_NUM,246,230,40,95,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP + RTEXT "@S_12",S_12,75,247,168,9 + EDITTEXT E_SPAN,246,245,40,11,ES_AUTOHSCROLL | ES_NUMBER + LTEXT "@S_13",S_13,289,246,58,9 + CONTROL "@R_ETHERNET",R_ETHERNET,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,75,260,165,9 + CONTROL "@R_DOUBLE",R_DOUBLE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,247,260,105,9 + LTEXT "@S_14",S_14,289,232,54,9 + DEFPUSHBUTTON "@IDOK",IDOK,255,287,64,15 + PUSHBUTTON "@IDCANCEL",IDCANCEL,323,287,64,15 + LTEXT "@S_15",S_15,7,281,244,21 +END + +D_CM_TRAFFIC_RUN DIALOGEX 0, 0, 359, 258 +STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "@D_CM_TRAFFIC_RUN" +FONT 9, "MS Shell Dlg", 400, 0, 0x80 +BEGIN + ICON ICO_SWITCH,IDC_STATIC,7,5,20,18 + LTEXT "@S_INFO",S_INFO,30,5,322,22 + EDITTEXT E_EDIT,7,29,345,178,ES_MULTILINE | ES_AUTOVSCROLL | ES_READONLY | ES_WANTRETURN | WS_VSCROLL + LTEXT "@STATIC1",IDC_STATIC,7,234,274,18 + DEFPUSHBUTTON "@IDCANCEL",IDCANCEL,288,238,64,15 +END + +D_CM_TRAFFIC_RESULT DIALOGEX 0, 0, 330, 195 +STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "@D_CM_TRAFFIC_RESULT" +FONT 9, "MS Shell Dlg", 400, 0, 0x80 +BEGIN + ICON ICO_SWITCH,IDC_STATIC,7,5,18,18 + LTEXT "@STATIC1",IDC_STATIC,29,5,220,18 + CONTROL "",L_STATUS,"SysListView32",LVS_REPORT | LVS_SHOWSELALWAYS | LVS_SHAREIMAGELISTS | LVS_AUTOARRANGE | WS_BORDER | WS_TABSTOP,7,29,316,141 + DEFPUSHBUTTON "@IDCANCEL",IDCANCEL,259,174,64,15 +END + +D_SM_LICENSE DIALOGEX 0, 0, 427, 314 +STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "@D_SM_LICENSE" +FONT 9, "MS Shell Dlg", 400, 0, 0x80 +BEGIN + ICON ICO_CERT,IDC_STATIC,7,5,20,18 + LTEXT "@STATIC1",IDC_STATIC,31,5,389,25 + LTEXT "@S_BOLD",S_BOLD,7,33,159,11 + CONTROL "",L_LIST,"SysListView32",LVS_REPORT | LVS_SHOWSELALWAYS | LVS_SHAREIMAGELISTS | LVS_NOSORTHEADER | WS_BORDER | WS_TABSTOP,7,46,413,69 + PUSHBUTTON "@B_OBTAIN",B_OBTAIN,7,120,109,17 + LTEXT "@STATIC2",IDC_STATIC,7,143,141,24 + PUSHBUTTON "@B_ADD",B_ADD,162,120,105,17 + PUSHBUTTON "@B_DEL",B_DEL,273,120,48,17 + DEFPUSHBUTTON "@IDOK",IDOK,327,120,93,17 + LTEXT "@STATIC3",IDC_STATIC,163,143,257,25 + CONTROL "",IDC_STATIC,"Static",SS_ETCHEDHORZ,7,168,411,1 + LTEXT "@S_BOLD2",S_BOLD2,7,173,198,11 + CONTROL "",L_STATUS,"SysListView32",LVS_REPORT | LVS_SHOWSELALWAYS | LVS_SHAREIMAGELISTS | LVS_NOCOLUMNHEADER | WS_BORDER | WS_TABSTOP,7,187,346,121 + PUSHBUTTON "@IDCANCEL",IDCANCEL,360,293,60,16 +END + +D_SM_LICENSE_ADD DIALOGEX 0, 0, 359, 229 +STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "@D_SM_LICENSE_ADD" +FONT 9, "MS Shell Dlg", 400, 0, 0x80 +BEGIN + ICON ICO_KEY,IDC_STATIC,7,5,20,18 + LTEXT "@S_INFO",S_INFO,33,5,319,23 + LTEXT "@STATIC1",IDC_STATIC,33,23,319,63 + GROUPBOX "@STATIC2",IDC_STATIC,21,86,320,70 + LTEXT "@STATIC3",IDC_STATIC,31,102,301,18 + EDITTEXT B_KEY1,30,124,43,15,ES_UPPERCASE | ES_AUTOHSCROLL + EDITTEXT B_KEY2,83,124,43,15,ES_UPPERCASE | ES_AUTOHSCROLL + EDITTEXT B_KEY3,135,124,43,15,ES_UPPERCASE | ES_AUTOHSCROLL + EDITTEXT B_KEY4,187,124,43,15,ES_UPPERCASE | ES_AUTOHSCROLL + EDITTEXT B_KEY5,239,124,43,15,ES_UPPERCASE | ES_AUTOHSCROLL + EDITTEXT B_KEY6,291,124,43,15,ES_UPPERCASE | ES_AUTOHSCROLL + CTEXT "-",IDC_STATIC,74,128,8,7 + CTEXT "-",IDC_STATIC,126,128,8,7 + CTEXT "-",IDC_STATIC,178,128,8,7 + CTEXT "-",IDC_STATIC,230,128,8,7 + CTEXT "-",IDC_STATIC,282,128,8,7 + LTEXT "@B_INFO2",B_INFO2,35,167,317,36 + ICON ICO_WARNING,IDC_STATIC,13,167,20,18 + DEFPUSHBUTTON "@IDOK",IDOK,229,207,58,16 + PUSHBUTTON "@IDCANCEL",IDCANCEL,294,207,58,16 +END + +D_FREEINFO DIALOGEX 0, 0, 323, 207 +STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "@D_FREEINFO" +FONT 9, "MS Shell Dlg", 400, 0, 0x80 +BEGIN + ICON ICO_INFORMATION,IDC_STATIC,7,5,18,18 + LTEXT "@S_INFO_1",S_INFO_1,32,5,284,30 + LTEXT "@S_INFO_2",S_INFO_2,7,38,309,30 + LTEXT "@S_INFO_3",S_INFO_3,14,72,302,25 + LTEXT "@S_INFO_4",S_INFO_4,7,101,309,84 + CONTROL "@B_HIDE",B_HIDE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,102,186,148,15 + DEFPUSHBUTTON "@IDCANCEL",IDCANCEL,257,186,59,15 +END + +D_EM_LICENSE_ADD DIALOGEX 0, 0, 359, 229 +STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "@D_EM_LICENSE_ADD" +FONT 9, "MS Shell Dlg", 400, 0, 0x80 +BEGIN + ICON ICO_KEY,IDC_STATIC,7,5,20,18 + LTEXT "@S_INFO",S_INFO,33,5,319,23 + LTEXT "@STATIC1",IDC_STATIC,33,30,319,49 + GROUPBOX "@STATIC2",IDC_STATIC,21,86,320,70 + LTEXT "@STATIC3",IDC_STATIC,31,102,301,18 + EDITTEXT B_KEY1,30,124,43,15,ES_UPPERCASE | ES_AUTOHSCROLL + EDITTEXT B_KEY2,83,124,43,15,ES_UPPERCASE | ES_AUTOHSCROLL + EDITTEXT B_KEY3,135,124,43,15,ES_UPPERCASE | ES_AUTOHSCROLL + EDITTEXT B_KEY4,187,124,43,15,ES_UPPERCASE | ES_AUTOHSCROLL + EDITTEXT B_KEY5,239,124,43,15,ES_UPPERCASE | ES_AUTOHSCROLL + EDITTEXT B_KEY6,291,124,43,15,ES_UPPERCASE | ES_AUTOHSCROLL + CTEXT "-",IDC_STATIC,74,128,8,7 + CTEXT "-",IDC_STATIC,126,128,8,7 + CTEXT "-",IDC_STATIC,178,128,8,7 + CTEXT "-",IDC_STATIC,230,128,8,7 + CTEXT "-",IDC_STATIC,282,128,8,7 + LTEXT "@B_INFO2",B_INFO2,35,167,317,36 + ICON ICO_WARNING,IDC_STATIC,13,167,20,18 + DEFPUSHBUTTON "@IDOK",IDOK,229,207,58,16 + PUSHBUTTON "@IDCANCEL",IDCANCEL,294,207,58,16 +END + +D_EM_LICENSE DIALOGEX 0, 0, 427, 310 +STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "@D_EM_LICENSE" +FONT 9, "MS Shell Dlg", 400, 0, 0x80 +BEGIN + ICON ICO_CERT,IDC_STATIC,7,5,20,18 + LTEXT "@STATIC1",IDC_STATIC,31,5,389,25 + LTEXT "@S_BOLD",S_BOLD,7,33,159,11 + CONTROL "",L_LIST,"SysListView32",LVS_REPORT | LVS_SHOWSELALWAYS | LVS_SHAREIMAGELISTS | LVS_NOSORTHEADER | WS_BORDER | WS_TABSTOP,7,46,413,136 + PUSHBUTTON "@B_OBTAIN",B_OBTAIN,7,186,82,17 + LTEXT "@STATIC2",IDC_STATIC,7,208,141,24 + PUSHBUTTON "@B_ADD",B_ADD,162,186,105,17 + PUSHBUTTON "@B_DEL",B_DEL,273,186,48,17 + DEFPUSHBUTTON "@IDOK",IDOK,327,186,93,17 + LTEXT "@STATIC3",IDC_STATIC,163,208,257,18 + CONTROL "",IDC_STATIC,"Static",SS_ETCHEDHORZ,7,234,413,1 + LTEXT "@S_BOLD2",S_BOLD2,7,239,198,11 + CONTROL "",L_STATUS,"SysListView32",LVS_REPORT | LVS_SHOWSELALWAYS | LVS_SHAREIMAGELISTS | LVS_NOCOLUMNHEADER | WS_BORDER | WS_TABSTOP,7,249,306,55 + PUSHBUTTON "@IDCANCEL",IDCANCEL,356,288,64,16 +END + +D_EM_REMOTE DIALOGEX 0, 0, 275, 149 +STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "@D_EM_REMOTE" +FONT 9, "MS Shell Dlg", 400, 0, 0x80 +BEGIN + ICON ICO_TEST,S_ICON,7,5,20,18 + LTEXT "S_TITLE",S_TITLE,31,5,237,55 + GROUPBOX "@STATIC1",-1,26,66,222,53 + CONTROL "@R_LOCAL",R_LOCAL,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,40,78,200,15 + RTEXT "@S_HOSTNAME",S_HOSTNAME,33,98,49,10 + COMBOBOX C_HOSTNAME,86,96,150,91,CBS_DROPDOWN | WS_VSCROLL | WS_TABSTOP + PUSHBUTTON "@B_ABOUT",B_ABOUT,14,130,50,14 + DEFPUSHBUTTON "@IDOK",IDOK,158,130,52,14 + PUSHBUTTON "@IDCANCEL",IDCANCEL,216,130,52,14 +END + +D_CM_SETTING DIALOGEX 0, 0, 283, 290 +STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "@D_CM_SETTING" +FONT 9, "MS Shell Dlg", 400, 0, 0x80 +BEGIN + ICON ICO_VPN,IDC_STATIC,7,5,18,18 + LTEXT "@STATIC1",IDC_STATIC,33,5,243,20 + CONTROL "@R_NORMAL",R_NORMAL,"Button",BS_AUTORADIOBUTTON | WS_TABSTOP,15,33,201,9 + CONTROL "@R_EASY",R_EASY,"Button",BS_AUTORADIOBUTTON,15,73,201,9 + LTEXT "@STATIC2",IDC_STATIC,25,47,250,24 + LTEXT "@STATIC3",IDC_STATIC,25,86,250,26 + CONTROL "",IDC_STATIC,"Static",SS_ETCHEDHORZ,7,116,269,1 + LTEXT "@STATIC4",IDC_STATIC,26,125,250,30 + CONTROL "@R_LOCK",R_LOCK,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,35,158,135,9 + LTEXT "@S_PASSWORD1",S_PASSWORD1,26,171,250,17 + RTEXT "@S_PASSWORD2",S_PASSWORD2,26,194,50,11 + EDITTEXT E_PASSWORD1,81,192,140,11,ES_PASSWORD | ES_AUTOHSCROLL + RTEXT "@S_PASSWORD3",S_PASSWORD3,26,209,50,10 + EDITTEXT E_PASSWORD2,81,208,140,11,ES_PASSWORD | ES_AUTOHSCROLL + CONTROL "",S_VGS1,"Static",SS_ETCHEDHORZ,7,228,268,1 + ICON ICO_RESEARCH,S_VGS3,7,235,18,18 + LTEXT "@S_VGS2",S_VGS2,33,237,186,10 + PUSHBUTTON "@B_VGS",B_VGS,32,249,97,15 + DEFPUSHBUTTON "@IDOK",IDOK,143,269,64,15 + PUSHBUTTON "@IDCANCEL",IDCANCEL,212,269,64,15 +END + +D_CM_EASY DIALOGEX 0, 0, 307, 223 +STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_MINIMIZEBOX | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "@D_CM_EASY" +FONT 9, "MS Shell Dlg", 400, 0, 0x80 +BEGIN + CONTROL ICO_TRAY1,IDC_STATIC,"Static",SS_BITMAP,0,0,308,46 + LTEXT "@S_TITLE",S_TITLE,32,52,267,17 + ICON ICO_VPN,IDC_STATIC,7,51,20,18 + CONTROL "",L_ACCOUNT,"SysListView32",LVS_REPORT | LVS_SHOWSELALWAYS | LVS_SHAREIMAGELISTS | LVS_AUTOARRANGE | LVS_EDITLABELS | LVS_NOCOLUMNHEADER | WS_BORDER | WS_TABSTOP,7,88,293,82 + PUSHBUTTON "--BUTTON--",IDOK,92,173,123,21 + LTEXT "--INFO--",S_INFO,12,72,288,14 + CONTROL "",IDC_STATIC,"Static",SS_ETCHEDHORZ,7,198,294,1 + PUSHBUTTON "@B_MODE",B_MODE,7,203,84,16 + PUSHBUTTON "@IDCANCEL",IDCANCEL,247,203,53,16 + PUSHBUTTON "@B_STATUS",B_STATUS,216,176,84,16 + PUSHBUTTON "@B_VGC",B_VGC,112,203,84,16 +END + +D_SM_SETUP DIALOGEX 0, 0, 447, 311 +STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU +EXSTYLE WS_EX_CLIENTEDGE +CAPTION "@D_SM_SETUP" +FONT 9, "MS Shell Dlg", 400, 0, 0x80 +BEGIN + ICON ICO_SETUP,IDC_STATIC,7,5,18,18 + LTEXT "@S_TITLE",S_TITLE,31,5,409,17 + LTEXT "@IDC_STATIC_1",IDC_STATIC,7,26,433,24 + LTEXT "@S_BOLD",S_BOLD,7,51,433,21 + CONTROL "@C_REMOTE",C_REMOTE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,14,71,226,12 + CONTROL ICO_TRAY3,IDC_STATIC,"Static",SS_BITMAP,291,73,70,62 + LTEXT "@S_REMOTE_1",S_REMOTE_1,22,86,262,44 + CONTROL ICO_TRAY2,IDC_STATIC,"Static",SS_BITMAP,291,150,149,78 + CONTROL "@C_SITE",C_SITE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,14,145,244,12 + LTEXT "@S_SITE_1",S_SITE_1,22,161,262,40 + LTEXT "@S_SITE_2",S_SITE_2,22,203,228,10 + CONTROL "@C_CENTER",C_CENTER,"Button",BS_AUTORADIOBUTTON | WS_TABSTOP,29,215,255,11 + CONTROL "@C_EDGE",C_EDGE,"Button",BS_AUTORADIOBUTTON,29,228,252,11 + CONTROL "",IDC_STATIC,"Static",SS_ETCHEDHORZ,14,139,426,1 + CONTROL "",IDC_STATIC,"Static",SS_ETCHEDHORZ,14,243,426,1 + CONTROL "@C_OTHER",C_OTHER,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,14,249,244,12 + LTEXT "@S_OTHER",S_OTHER,22,264,418,22 + DEFPUSHBUTTON "@IDOK",IDOK,322,291,57,15 + PUSHBUTTON "@IDCANCEL",IDCANCEL,383,291,57,15 + LTEXT "--INFO--",S_INFO,7,287,310,18 +END + +D_SM_SETUP_HUB DIALOGEX 0, 0, 229, 86 +STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "@D_SM_SETUP_HUB" +FONT 9, "MS Shell Dlg", 400, 0, 0x80 +BEGIN + ICON ICO_HUB,IDC_STATIC,7,5,20,18 + LTEXT "@IDC_STATIC_1",IDC_STATIC,31,5,191,25 + RTEXT "@IDC_STATIC_2",IDC_STATIC,7,40,62,12 + EDITTEXT E_HUBNAME,74,38,140,11,ES_AUTOHSCROLL + DEFPUSHBUTTON "@IDOK",IDOK,89,64,64,17 + PUSHBUTTON "@IDCANCEL",IDCANCEL,157,64,64,17 +END + +D_SM_SETUP_STEP DIALOGEX 0, 0, 329, 300 +STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU +EXSTYLE WS_EX_CLIENTEDGE +CAPTION "@D_SM_SETUP_STEP" +FONT 9, "MS Shell Dlg", 400, 0, 0x80 +BEGIN + ICON ICO_SERVER_ONLINE,IDC_STATIC,7,5,20,18,WS_TABSTOP + LTEXT "@IDC_STATIC_1",IDC_STATIC,29,5,293,20 + LTEXT "@S_1_1",S_1_1,7,38,315,12 + ICON ICO_USER,IDC_STATIC,14,53,20,18 + LTEXT "@S_1_2",S_1_2,37,53,285,29 + PUSHBUTTON "@B_USER",B_USER,37,84,87,15 + CONTROL "",IDC_STATIC,"Static",SS_ETCHEDHORZ,7,32,315,1 + CONTROL "",IDC_STATIC,"Static",SS_ETCHEDHORZ,7,107,315,1 + LTEXT "@S_2_1",S_2_1,7,117,315,12 + ICON ICO_CASCADE,IDC_STATIC,14,129,20,18 + LTEXT "@S_2_2",S_2_2,37,130,285,29 + PUSHBUTTON "@B_CASCADE",B_CASCADE,37,161,155,15 + CONTROL "",IDC_STATIC,"Static",SS_ETCHEDHORZ,7,184,315,1 + LTEXT "@S_3_1",S_3_1,7,194,315,12 + ICON ICO_NIC_ONLINE,S_ICON,14,207,20,18 + LTEXT "@S_3_2",S_3_2,37,208,285,33 + COMBOBOX C_DEVICE,37,242,285,140,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP + CONTROL "",IDC_STATIC,"Static",SS_ETCHEDHORZ,7,263,314,1 + PUSHBUTTON "@IDCANCEL",IDCANCEL,263,279,59,16 + LTEXT "@IDC_STATIC_8",IDC_STATIC,14,272,245,23 + PUSHBUTTON "@B_SECURENAT",B_SECURENAT,37,241,155,15 +END + +D_CPU64_WARNING DIALOGEX 0, 0, 299, 154 +STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU +EXSTYLE WS_EX_TOPMOST +CAPTION "@D_CPU64_WARNING" +FONT 9, "MS Shell Dlg", 400, 0, 0x80 +BEGIN + ICON ICO_WARNING,IDC_STATIC,7,5,18,18 + LTEXT "@S_BOLD",S_BOLD,29,5,263,25 + LTEXT "@S_INFO",S_INFO,29,35,263,92 + DEFPUSHBUTTON "@IDOK",IDOK,119,132,61,15 +END + +D_ONCEMSG DIALOGEX 0, 0, 251, 161 +STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | DS_CENTER | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "@D_ONCEMSG" +FONT 9, "MS Shell Dlg", 400, 0, 0x80 +BEGIN + EDITTEXT E_TEXT,7,5,237,120,ES_MULTILINE | ES_READONLY | WS_VSCROLL + CONTROL "@C_DONTSHOWAGAIN",C_DONTSHOWAGAIN,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,7,127,237,11 + DEFPUSHBUTTON "@IDCANCEL",IDCANCEL,94,140,64,15 +END + +D_CONNECT DIALOGEX 0, 0, 189, 67 +STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "@D_CONNECT" +FONT 9, "MS Shell Dlg", 400, 0, 0x80 +BEGIN + LTEXT "String",S_INFO,30,7,152,24 + ICON ICO_TEST,S_ICON,7,5,20,18 + DEFPUSHBUTTON "@IDCANCEL",IDCANCEL,69,47,50,14 + CONTROL "",IDC_PROGRESS1,"msctls_progress32",0x0,7,35,175,9 +END + +D_SM_SIMULATION DIALOGEX 0, 0, 281, 221 +STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "@D_SM_SIMULATION" +FONT 9, "MS Shell Dlg", 400, 0, 0x80 +BEGIN + ICON ICO_FARM,IDC_STATIC,7,5,20,18 + LTEXT "@STATIC1",IDC_STATIC,30,5,244,52 + GROUPBOX "@STATIC2",IDC_STATIC,7,62,267,127 + CONTROL "@C_DELAY",C_DELAY,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,14,75,248,10 + RTEXT "@S_DELAY",S_DELAY,14,92,122,13 + EDITTEXT E_DELAY,139,90,51,11,ES_CENTER | ES_AUTOHSCROLL | ES_NUMBER + LTEXT "@S_DELAY2",S_DELAY2,194,92,73,14 + CONTROL "@C_JITTER",C_JITTER,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,14,112,248,10 + RTEXT "@S_JITTER",S_JITTER,14,129,122,14 + EDITTEXT E_JITTER,139,127,51,11,ES_CENTER | ES_AUTOHSCROLL | ES_NUMBER + LTEXT "@S_JITTER2",S_JITTER2,194,129,73,14 + CONTROL "@C_LOSS",C_LOSS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,14,149,248,10 + RTEXT "@S_LOSS",S_LOSS,14,167,122,13 + EDITTEXT E_LOSS,139,165,51,11,ES_CENTER | ES_AUTOHSCROLL | ES_NUMBER + LTEXT "@S_LOSS2",S_LOSS2,194,167,73,14 + DEFPUSHBUTTON "@IDOK",IDOK,142,199,64,17 + PUSHBUTTON "@IDCANCEL",IDCANCEL,210,199,64,17 +END + +D_SM_EDIT_ACCESS_V6 DIALOGEX 0, 0, 459, 352 +STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "@D_SM_EDIT_ACCESS" +FONT 9, "MS Shell Dlg", 400, 0, 0x80 +BEGIN + ICON ICO_PASS,S_ICON,7,5,20,18 + LTEXT "@STATIC1",IDC_STATIC,31,5,421,17 + GROUPBOX "@STATIC2",IDC_STATIC,7,29,217,61 + RTEXT "@STATIC3",IDC_STATIC,14,43,71,10 + EDITTEXT E_NOTE,91,41,115,11,ES_AUTOHSCROLL + RTEXT "@STATIC4",IDC_STATIC,14,59,71,8 + CONTROL "@R_PASS",R_PASS,"Button",BS_AUTORADIOBUTTON,91,54,47,16 + CONTROL "@R_DISCARD",R_DISCARD,"Button",BS_AUTORADIOBUTTON,142,54,51,16 + RTEXT "@STATIC5",IDC_STATIC,14,75,71,9 + EDITTEXT E_PRIORITY,91,73,38,11,ES_CENTER | ES_AUTOHSCROLL | ES_NUMBER + LTEXT "@STATIC6",IDC_STATIC,134,72,73,16 + GROUPBOX "@STATIC11",S_STATIC11,7,92,217,96 + ICON ICO_USER,IDC_STATIC,11,101,20,18 + LTEXT "@STATIC12",S_STATIC12,34,103,177,24 + RTEXT "@STATIC13",S_STATIC13,12,132,73,11 + EDITTEXT E_USERNAME1,89,131,84,11,ES_AUTOHSCROLL + PUSHBUTTON "@B_USER1",B_USER1,179,129,41,16 + RTEXT "@STATIC14",S_STATIC14,13,152,72,11 + EDITTEXT E_USERNAME2,89,150,84,11,ES_AUTOHSCROLL + PUSHBUTTON "@B_USER2",B_USER2,179,149,41,16 + LTEXT "@STATIC15",S_STATIC15,56,167,156,18 + GROUPBOX "@STATIC16",IDC_STATIC,7,191,217,131 + RTEXT "@S_CHECK_SRC_MAC",S_CHECK_SRC_MAC,14,201,71,9 + CONTROL "@R_CHECK_SRC_MAC",R_CHECK_SRC_MAC,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,89,199,121,9 + RTEXT "@S_SRC_MAC",S_SRC_MAC,14,214,108,9 + EDITTEXT E_SRC_MAC,128,212,78,11,ES_AUTOHSCROLL + RTEXT "@S_SRC_MAC_MASK",S_SRC_MAC_MASK,14,228,108,9 + EDITTEXT E_SRC_MAC_MASK,128,227,78,11,ES_AUTOHSCROLL + CONTROL "",IDC_STATIC,"Static",SS_ETCHEDHORZ,18,242,193,1 + RTEXT "@S_CHECK_DST_MAC",S_CHECK_DST_MAC,13,247,71,9 + CONTROL "@R_CHECK_DST_MAC",R_CHECK_DST_MAC,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,89,245,121,9 + RTEXT "@S_DST_MAC",S_DST_MAC,14,260,108,9 + EDITTEXT E_DST_MAC,128,258,78,11,ES_AUTOHSCROLL + RTEXT "@S_DST_MAC_MASK",S_DST_MAC_MASK,14,275,108,9 + EDITTEXT E_DST_MAC_MASK,128,274,78,11,ES_AUTOHSCROLL + LTEXT "@S_MAC_NOTE",S_MAC_NOTE,18,288,197,26 + GROUPBOX "@STATIC7",IDC_STATIC,232,29,220,181 + RTEXT "@S_ACCESS_SRC_ALL",S_ACCESS_SRC_ALL,237,42,71,9 + CONTROL "@R_SRC_ALL",R_SRC_ALL,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,311,41,121,9 + RTEXT "@S_SRC_IP_1_V6",S_SRC_IP_1,237,54,54,9 + EDITTEXT E_SRC_IP_V6,298,53,147,11,ES_AUTOHSCROLL + RTEXT "@S_SRC_IP_2",S_SRC_IP_2,237,70,54,8 + EDITTEXT E_SRC_MASK_V6,298,68,147,11,ES_AUTOHSCROLL + RTEXT "@S_SRC_IP_3_V6",S_SRC_IP_3,237,87,208,9 + CONTROL "",IDC_STATIC,"Static",SS_ETCHEDHORZ,238,101,208,1 + RTEXT "@S_ACCESS_DST_ALL",S_ACCESS_DST_ALL,237,109,71,9 + CONTROL "@R_DST_ALL",R_DST_ALL,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,311,107,121,9 + RTEXT "@S_IP_DST_1_V6",S_IP_DST_1,237,121,54,9 + EDITTEXT E_DST_IP_V6,298,119,147,11,ES_AUTOHSCROLL + RTEXT "@S_IP_DST_2",S_IP_DST_2,237,137,54,9 + EDITTEXT E_DST_MASK_V6,298,135,146,11,ES_AUTOHSCROLL + RTEXT "@S_IP_DST_3_V6",S_IP_DST_3,237,152,207,10 + CONTROL "",IDC_STATIC,"Static",SS_ETCHEDHORZ,238,167,208,1 + RTEXT "@STATIC9",IDC_STATIC,237,176,71,11 + COMBOBOX C_PROTOCOL,313,174,110,75,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP + RTEXT "@S_PROTOID",S_PROTOID,237,193,71,9 + EDITTEXT E_IP_PROTO,313,191,37,11,ES_CENTER | ES_AUTOHSCROLL | ES_NUMBER + GROUPBOX "@STATIC10",IDC_STATIC,232,211,220,111 + LTEXT "@S_TCP_1",S_TCP_1,318,221,31,9 + LTEXT "@S_TCP_2",S_TCP_2,370,221,31,9 + RTEXT "@S_TCP_3",S_TCP_3,234,233,71,9 + EDITTEXT E_SRC_PORT_1,311,232,38,11,ES_CENTER | ES_AUTOHSCROLL | ES_NUMBER + LTEXT "-",S_TCP_4,356,233,8,7 + EDITTEXT E_SRC_PORT_2,365,232,38,11,ES_CENTER | ES_AUTOHSCROLL | ES_NUMBER + RTEXT "@S_TCP_5",S_TCP_5,234,249,71,9 + EDITTEXT E_DST_PORT_1,311,247,38,11,ES_CENTER | ES_AUTOHSCROLL | ES_NUMBER + LTEXT "-",S_TCP_6,356,249,8,7 + EDITTEXT E_DST_PORT_2,365,247,38,11,ES_CENTER | ES_AUTOHSCROLL | ES_NUMBER + LTEXT "@S_TCP_7",S_TCP_7,240,263,204,22 + CONTROL "",IDC_STATIC,"Static",SS_ETCHEDHORZ,238,291,208,1 + CONTROL "@R_CHECK_TCP_STATE",R_CHECK_TCP_STATE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,254,296,158,9 + CONTROL "@R_ESTABLISHED",R_ESTABLISHED,"Button",BS_AUTORADIOBUTTON | WS_TABSTOP,268,308,71,9 + CONTROL "@R_UNESTABLISHED",R_UNESTABLISHED,"Button",BS_AUTORADIOBUTTON,351,308,80,9 + CONTROL "@R_REDIRECT",R_REDIRECT,"Button",BS_AUTOCHECKBOX | BS_MULTILINE | WS_TABSTOP,7,328,113,18 + PUSHBUTTON "@B_REDIRECT",B_REDIRECT,122,329,78,17 + PUSHBUTTON "@B_SIMULATION",B_SIMULATION,207,329,103,17 + DEFPUSHBUTTON "@IDOK",IDOK,320,329,64,17 + PUSHBUTTON "@IDCANCEL",IDCANCEL,388,329,64,17 +END + +D_SM_VLAN DIALOGEX 0, 0, 315, 280 +STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "@D_SM_VLAN" +FONT 9, "MS Shell Dlg", 400, 0, 0x80 +BEGIN + ICON ICO_NIC_ONLINE,IDC_STATIC,7,5,20,18 + LTEXT "@STATIC1",IDC_STATIC,29,5,279,53 + CONTROL "",L_LIST,"SysListView32",LVS_REPORT | LVS_SHOWSELALWAYS | LVS_SHAREIMAGELISTS | LVS_AUTOARRANGE | LVS_NOSORTHEADER | WS_BORDER | WS_TABSTOP,7,59,301,72 + PUSHBUTTON "@B_ENABLE",B_ENABLE,7,137,209,16 + PUSHBUTTON "@B_DISABLE",B_DISABLE,223,137,85,16 + GROUPBOX "@STATIC2",IDC_STATIC,7,160,301,94 + ICON ICO_INFORMATION,IDC_STATIC,14,171,20,18 + LTEXT "@S_WARNING",S_WARNING,38,171,262,24 + LTEXT "@S_WARNING2",S_WARNING2,38,197,262,52 + DEFPUSHBUTTON "@IDCANCEL",IDCANCEL,249,258,59,16 +END + +D_SM_MSG DIALOGEX 0, 0, 275, 276 +STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "@D_SM_MSG" +FONT 9, "MS Shell Dlg", 400, 0, 0x80 +BEGIN + ICON ICO_LOG2,S_ACL_5,7,5,20,18 + LTEXT "@S_MSG_2",S_MSG_2,31,5,237,31 + CONTROL "@C_USEMSG",C_USEMSG,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,7,43,253,13 + EDITTEXT E_TEXT,20,61,237,120,ES_MULTILINE | ES_WANTRETURN | WS_VSCROLL + GROUPBOX "@STATIC1",IDC_STATIC,7,185,261,61 + ICON ICO_INFORMATION,IDC_STATIC,14,197,20,18 + LTEXT "@S_INFO",S_INFO,39,198,222,45 + DEFPUSHBUTTON "@IDOK",IDOK,131,254,64,17 + PUSHBUTTON "@IDCANCEL",IDCANCEL,203,254,64,17 +END + +D_NICINFO DIALOGEX 0, 0, 221, 91 +STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | DS_CENTER | WS_POPUP | WS_CAPTION | WS_SYSMENU +EXSTYLE WS_EX_APPWINDOW +CAPTION "@D_NICINFO" +FONT 9, "MS Shell Dlg", 400, 0, 0x80 +BEGIN + ICON ICO_NIC_OFFLINE,S_ICON,7,5,18,18 + LTEXT "Status1",S_STATUS1,31,10,183,15 + DEFPUSHBUTTON "@IDCANCEL",IDCANCEL,84,71,50,14 + LTEXT "Status2",S_STATUS2,31,27,183,32 + CONTROL "",P_BAR,"msctls_progress32",0x0,7,60,207,7 +END + +D_SM_IPSEC DIALOGEX 0, 0, 423, 307 +STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "@D_SM_IPSEC" +FONT 9, "MS Shell Dlg", 400, 0, 0x80 +BEGIN + LTEXT "@S_TITLE",S_TITLE,31,5,385,16 + LTEXT "@S_3",S_3,31,22,385,23 + ICON ICO_IPSEC,IDC_STATIC,7,5,20,18 + GROUPBOX "@S01",IDC_STATIC,7,47,409,142 + LTEXT "@S02",IDC_STATIC,14,58,267,23 + CONTROL 197,IDC_STATIC,"Static",SS_BITMAP,288,56,121,33 + CONTROL "@R_L2TP_OVER_IPSEC",R_L2TP_OVER_IPSEC,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,16,82,269,9 + LTEXT "@S03",IDC_STATIC,31,95,286,13 + CONTROL "@R_L2TP_RAW",R_L2TP_RAW,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,16,111,269,9 + LTEXT "@S04",IDC_STATIC,31,125,378,12 + RTEXT "@S_1",S_1,16,171,270,12 + COMBOBOX L_HUBNAME,291,168,114,127,CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL | WS_TABSTOP + LTEXT "@S_2",S_2,48,143,361,23 + GROUPBOX "@S05",IDC_STATIC,7,194,409,48 + LTEXT "@S06",IDC_STATIC,16,203,294,17 + CONTROL 195,IDC_STATIC,"Static",SS_BITMAP,314,202,94,37,WS_EX_STATICEDGE + CONTROL "@R_ETHERIP",R_ETHERIP,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,16,224,184,9 + PUSHBUTTON "@B_DETAIL",B_DETAIL,204,221,103,15 + GROUPBOX "@S07",IDC_STATIC,7,249,261,51 + RTEXT "@S_PSK",S_PSK,14,262,78,12 + EDITTEXT E_SECRET,98,258,159,13,ES_AUTOHSCROLL + LTEXT "@S_PSK2",S_PSK2,14,279,248,17 + DEFPUSHBUTTON "@IDOK",IDOK,307,287,52,14 + PUSHBUTTON "@IDCANCEL",IDCANCEL,364,287,52,14 + CONTROL "",IDC_STATIC,"Static",SS_ETCHEDHORZ,14,137,395,1 + ICON ICO_INFORMATION,IDC_STATIC,24,140,20,18 + CONTROL 227,IDC_STATIC,"Static",SS_BITMAP,318,89,90,33 +END + +D_SM_ETHERIP DIALOGEX 0, 0, 411, 244 +STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "@D_SM_ETHERIP" +FONT 9, "MS Shell Dlg", 400, 0, 0x80 +BEGIN + ICON ICO_MACHINE,IDC_STATIC,7,5,20,18 + LTEXT "@S_TITLE",S_TITLE,31,5,198,16 + LTEXT "@S01",IDC_STATIC,7,32,221,41 + LTEXT "@S02",IDC_STATIC,7,74,222,29 + LTEXT "@S_BOLD",S_BOLD,7,107,222,10 + CONTROL "",L_LIST,"SysListView32",LVS_REPORT | LVS_SHOWSELALWAYS | LVS_SHAREIMAGELISTS | LVS_AUTOARRANGE | LVS_NOSORTHEADER | WS_BORDER | WS_TABSTOP,7,119,311,119 + CONTROL 202,IDC_STATIC,"Static",SS_BITMAP,233,5,171,108,WS_EX_DLGMODALFRAME + PUSHBUTTON "@B_ADD",B_ADD,326,132,78,16 + DEFPUSHBUTTON "@IDOK",IDOK,326,150,78,16 + PUSHBUTTON "@B_DELETE",B_DELETE,326,169,78,16 + PUSHBUTTON "@IDCANCEL",IDCANCEL,326,222,78,16 + RTEXT "@S03",IDC_STATIC,320,115,84,9,NOT WS_VISIBLE +END + +D_SM_ETHERIP_ID DIALOGEX 0, 0, 267, 227 +STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "@D_SM_ETHERIP_ID" +FONT 9, "MS Shell Dlg", 400, 0, 0x80 +BEGIN + ICON ICO_KEY,IDC_STATIC,7,5,20,18 + LTEXT "@S01",IDC_STATIC,29,5,231,30 + RTEXT "@S02",IDC_STATIC,7,40,76,12 + EDITTEXT E_ID,88,38,153,11,ES_AUTOHSCROLL + RTEXT "@S03",IDC_STATIC,7,109,76,11 + COMBOBOX L_HUBNAME,88,107,153,127,CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL | WS_TABSTOP + RTEXT "@S04",IDC_STATIC,7,128,76,12 + EDITTEXT E_USERNAME,88,126,153,11,ES_AUTOHSCROLL + RTEXT "@S05",IDC_STATIC,7,147,76,14 + EDITTEXT E_PASSWORD,88,145,153,11,ES_PASSWORD | ES_AUTOHSCROLL + ICON ICO_INFORMATION,IDC_STATIC,7,168,20,18 + LTEXT "@S06",IDC_STATIC,30,169,230,33 + DEFPUSHBUTTON "@IDOK",IDOK,151,207,52,14 + PUSHBUTTON "@IDCANCEL",IDCANCEL,208,207,52,14 + LTEXT "@S07",IDC_STATIC,88,51,154,55 +END + +D_SM_OPENVPN DIALOGEX 0, 0, 427, 308 +STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "@D_SM_OPENVPN" +FONT 9, "MS Shell Dlg", 400, 0, 0x80 +BEGIN + ICON ICO_OPENVPN,IDC_STATIC,7,5,20,18 + LTEXT "@S_TITLE",S_TITLE,32,6,385,16 + GROUPBOX "@S_13",IDC_STATIC,7,26,409,142 + LTEXT "@S_1",IDC_STATIC,15,36,195,37 + CONTROL 205,IDC_STATIC,"Static",SS_BITMAP,217,35,194,75 + CONTROL "@R_OPENVPN",R_OPENVPN,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,17,75,194,9 + CONTROL "",IDC_STATIC,"Static",SS_ETCHEDHORZ,14,107,395,1 + LTEXT "@S_TOOL",S_TOOL,15,112,392,12 + LTEXT "@S_TOOL2",S_TOOL2,24,126,385,22 + PUSHBUTTON "@B_CONFIG",B_CONFIG,120,146,189,15 + GROUPBOX "@S_2",IDC_STATIC,7,175,409,98 + LTEXT "@S_3",IDC_STATIC,14,185,195,37 + CONTROL 206,IDC_STATIC,"Static",SS_BITMAP,215,182,194,85 + CONTROL "@R_SSTP",R_SSTP,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,14,225,194,9 + LTEXT "@S_SSTP",S_SSTP,21,238,188,33 + LTEXT "@S_4",IDC_STATIC,7,279,186,24 + PUSHBUTTON "@B_IPSEC",B_IPSEC,195,288,93,15 + DEFPUSHBUTTON "@IDOK",IDOK,311,288,52,14 + PUSHBUTTON "@IDCANCEL",IDCANCEL,368,288,52,14 +END + +D_SM_DDNS DIALOGEX 0, 0, 415, 287 +STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "@D_SM_DDNS" +FONT 9, "MS Shell Dlg", 400, 0, 0x80 +BEGIN + ICON ICO_DISPLAY,IDC_STATIC,7,5,20,18 + LTEXT "@S_TITLE",S_TITLE,31,5,377,16 + LTEXT "@S_BOLD",S_BOLD,7,31,401,12 + LTEXT "@S_1",IDC_STATIC,7,47,401,28 + LTEXT "@S_22",IDC_STATIC,7,76,401,30 + LTEXT "@S_3",IDC_STATIC,7,107,401,22 + GROUPBOX "@S_4",IDC_STATIC,7,131,194,106 + LTEXT "@S_STATUS3",S_STATUS3,14,141,182,10 + EDITTEXT E_HOST,17,152,155,13,ES_AUTOHSCROLL | ES_READONLY | NOT WS_BORDER + PUSHBUTTON "@B_HINT",B_HINT,174,150,24,15 + LTEXT "@S_STATUS4",S_STATUS4,14,168,171,10 + EDITTEXT E_IPV4,17,179,172,13,ES_AUTOHSCROLL | ES_READONLY | NOT WS_BORDER + LTEXT "@S_STATUS5",S_STATUS5,14,195,171,9 + EDITTEXT E_IPV6,17,205,172,13,ES_AUTOHSCROLL | ES_READONLY | NOT WS_BORDER + LTEXT "@S_STATUS8",S_STATUS8,14,221,31,10 + EDITTEXT E_KEY,41,221,131,13,ES_AUTOHSCROLL | ES_READONLY | NOT WS_BORDER + PUSHBUTTON "@B_HINT2",B_HINT2,174,218,24,15 + GROUPBOX "@S_5",IDC_STATIC,206,131,202,106 + LTEXT "@S_STATUS6",S_STATUS6,212,145,189,10 + EDITTEXT E_NEWHOST,215,157,86,13,ES_AUTOHSCROLL + LTEXT "",S_SUFFIX,303,159,98,11 + LTEXT "@S_STATUS7",S_STATUS7,219,172,182,30 + DEFPUSHBUTTON "@IDOK",IDOK,218,205,119,16 + PUSHBUTTON "@B_RESTORE",B_RESTORE,341,205,60,16 + ICON ICO_INFORMATION,IDC_STATIC,7,241,20,18 + LTEXT "@S_2",S_2,30,240,378,22 + PUSHBUTTON "@B_DISABLE",B_DISABLE,7,265,145,16 + PUSHBUTTON "@B_PROXY",B_PROXY,218,265,110,16 + PUSHBUTTON "@IDCANCEL",IDCANCEL,335,265,73,16 +END + +D_SM_SPECIALLISTENER DIALOGEX 0, 0, 357, 319 +STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "@D_SM_SPECIALLISTENER" +FONT 9, "MS Shell Dlg", 400, 0, 0x80 +BEGIN + ICON ICO_SPECIALLISTENER,IDC_STATIC,7,5,20,18 + LTEXT "@S_TITLE",S_TITLE,32,6,260,16 + CONTROL 208,IDC_STATIC,"Static",SS_BITMAP,36,112,286,159 + GROUPBOX "@S_1",S_1,7,30,343,79 + LTEXT "@S_2",IDC_STATIC,14,42,329,31 + CONTROL "@R_OVER_ICMP",R_OVER_ICMP,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,29,73,272,12 + CONTROL "@R_OVER_DNS",R_OVER_DNS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,29,90,272,12 + DEFPUSHBUTTON "@IDOK",IDOK,241,299,52,14 + PUSHBUTTON "@IDCANCEL",IDCANCEL,298,299,52,14 + LTEXT "@S_3",IDC_STATIC,7,301,224,18 + LTEXT "@S_4",IDC_STATIC,7,275,343,24 +END + +D_SM_REDIRECT DIALOGEX 0, 0, 358, 311 +STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "@D_SM_REDIRECT" +FONT 9, "MS Shell Dlg", 400, 0, 0x80 +BEGIN + ICON ICO_INTERNET,IDC_STATIC,7,5,20,18 + LTEXT "@S_1",IDC_STATIC,31,5,320,46 + GROUPBOX "@S_2",IDC_STATIC,7,53,344,96 + RTEXT "@S_BOLD2",S_BOLD2,10,70,71,10 + EDITTEXT E_URL,86,66,257,15,ES_AUTOHSCROLL + RTEXT "@S_3",IDC_STATIC,14,88,52,11 + RTEXT "@S_4",IDC_STATIC,23,101,102,12 + EDITTEXT E_SAMPLE1,128,100,215,12,ES_AUTOHSCROLL | ES_READONLY | NOT WS_BORDER + RTEXT "@S_5",IDC_STATIC,23,116,102,12 + EDITTEXT E_SAMPLE2,128,115,215,12,ES_AUTOHSCROLL | ES_READONLY | NOT WS_BORDER + PUSHBUTTON "@B_HINT",B_HINT,197,128,146,17 + GROUPBOX "@S_6",IDC_STATIC,7,155,344,127 + ICON ICO_WARNING,IDC_STATIC,11,167,20,18 + LTEXT "@S_BOLD",S_BOLD,35,168,308,18 + LTEXT "@S_7",IDC_STATIC,35,191,308,18 + LTEXT "@S_8",IDC_STATIC,35,213,308,11 + LTEXT "@S_9",IDC_STATIC,35,228,308,23 + LTEXT "@S_10",IDC_STATIC,35,251,308,29 + DEFPUSHBUTTON "@IDOK",IDOK,219,288,64,17 + PUSHBUTTON "@IDCANCEL",IDCANCEL,287,288,64,17 + LTEXT "@S_11",IDC_STATIC,15,129,175,18 +END + +D_SW_TEST1 DIALOGEX 0, 0, 323, 155 +STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "AAA" +FONT 9, "MS Shell Dlg", 400, 0, 0x80 +BEGIN + PUSHBUTTON "Button1",IDC_BUTTON1,266,109,50,12 + LTEXT "HAMNEKO",IDC_STATIC,36,5,50,11 + PUSHBUTTON "Button2",IDC_BUTTON2,266,124,50,12 + PUSHBUTTON "Button3",IDC_BUTTON3,266,92,50,12 + PUSHBUTTON "Button4",IDC_BUTTON4,266,137,50,12 + ICON ICO_INSTALLER,IDC_STATIC,7,5,18,18 +END + +D_DUMMY DIALOGEX 0, 0, 186, 77 +STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "Dummy" +FONT 9, "MS Shell Dlg", 400, 0, 0x80 +BEGIN + PUSHBUTTON "B_WIZ_NEXT",B_WIZ_NEXT,7,5,50,12 + PUSHBUTTON "B_WIZ_PREV",B_WIZ_PREV,7,19,50,12 +END + +D_SW_TEST2 DIALOGEX 0, 0, 175, 84 +STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "Testkko" +FONT 9, "MS Shell Dlg", 400, 0, 0x80 +BEGIN + PUSHBUTTON "Button1",IDC_BUTTON1,7,5,50,12 + LTEXT "Hanyu",IDC_STATIC,26,37,50,11 + PUSHBUTTON "Button2",IDC_BUTTON2,118,5,50,12 + PUSHBUTTON "Button3",IDC_BUTTON3,7,66,50,12 + PUSHBUTTON "Button4",IDC_BUTTON4,118,66,50,12 +END + +D_SW_DEFAULT DIALOGEX 0, 0, 323, 155 +STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "@D_SW_DEFAULT" +FONT 9, "MS Shell Dlg", 400, 0, 0x80 +BEGIN +END + +D_SW_WELCOME DIALOGEX 0, 0, 323, 155 +STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "@D_SW_WELCOME" +FONT 9, "MS Shell Dlg", 400, 0, 0x80 +BEGIN + ICON ICO_INSTALLER,IDC_STATIC,7,5,20,18,WS_TABSTOP + LTEXT "@S_WELCOME",S_WELCOME,39,18,277,43 + LTEXT "@S_TITLE",S_TITLE,39,5,277,10 + CONTROL 223,IDC_STATIC,"Static",SS_BITMAP,54,63,245,92 +END + +D_SW_MODE DIALOGEX 0, 0, 323, 155 +STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "@D_SW_MODE" +FONT 9, "MS Shell Dlg", 400, 0, 0x80 +BEGIN + CONTROL "@R_SYSTEM",R_SYSTEM,"Button",BS_AUTORADIOBUTTON | WS_TABSTOP,56,64,242,11 + CONTROL "@R_USER",R_USER,"Button",BS_AUTORADIOBUTTON,56,104,242,11 + LTEXT "@S_1",IDC_STATIC,68,77,241,24 + LTEXT "@S_USER",S_USER,68,117,241,24 + ICON ICO_TOWER,IDC_STATIC,20,64,20,18 + ICON ICO_USER,IDC_STATIC,20,104,20,18 + LTEXT "@S_2",IDC_STATIC,7,5,309,54 + ICON ICO_TEST,S_UAC,42,64,20,18 +END + +D_SW_NOT_ADMIN DIALOGEX 0, 0, 323, 155 +STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "@D_SW_NOT_ADMIN" +FONT 9, "MS Shell Dlg", 400, 0, 0x80 +BEGIN + ICON ICO_INFORMATION,IDC_STATIC,7,5,20,18,WS_TABSTOP + LTEXT "@S_INFO",S_INFO,39,5,277,48 + LTEXT "@S_INFO6",S_INFO6,39,138,277,12 + LTEXT "@S_INFO2",S_INFO2,39,61,277,28 +END + +D_SW_COMPONENTS DIALOGEX 0, 0, 323, 155 +STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "@D_SW_DEFAULT" +FONT 9, "MS Shell Dlg", 400, 0, 0x80 +BEGIN + CONTROL "",L_LIST,"SysListView32",LVS_REPORT | LVS_SINGLESEL | LVS_SHOWSELALWAYS | LVS_SHAREIMAGELISTS | LVS_AUTOARRANGE | LVS_NOCOLUMNHEADER | LVS_NOSORTHEADER | WS_BORDER | WS_TABSTOP,7,3,309,84 + LTEXT "INFO",S_TITLE,7,97,309,14 + LTEXT "Static",S_DESCRIPTION,44,115,272,38 + ICON ICO_TEST,S_ICON,19,114,18,18 +END + +D_SW_EULA DIALOGEX 0, 0, 323, 155 +STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "@D_SW_EULA" +FONT 9, "MS Shell Dlg", 400, 0, 0x80 +BEGIN + LTEXT "@S_1",IDC_STATIC,7,1,309,11,WS_TABSTOP + EDITTEXT E_TEXT,7,16,309,96,ES_MULTILINE | ES_READONLY | WS_VSCROLL + CONTROL "@B_AGREE",B_AGREE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,12,118,297,11 +END + +D_SW_WARNING DIALOGEX 0, 0, 323, 155 +STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "@D_SW_WARNING" +FONT 9, "MS Shell Dlg", 400, 0, 0x80 +BEGIN + LTEXT "@S_1",IDC_STATIC,22,1,294,17,WS_TABSTOP + EDITTEXT E_TEXT,7,23,309,99,ES_MULTILINE | ES_READONLY | WS_VSCROLL + ICON ICO_INFORMATION,IDC_STATIC,0,0,20,18 +END + +D_SW_DIR DIALOGEX 0, 0, 323, 155 +STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "@D_SW_DIR" +FONT 9, "MS Shell Dlg", 400, 0, 0x80 +BEGIN + ICON ICO_TEST,S_ICON,2,0,20,18,WS_TABSTOP + LTEXT "@S_INFO",S_INFO,29,5,287,18 + CONTROL "dest_dir",R_DEFAULT,"Button",BS_AUTORADIOBUTTON | WS_TABSTOP,33,25,283,11 + CONTROL "@R_CUSTOM",R_CUSTOM,"Button",BS_AUTORADIOBUTTON,33,40,283,11 + RTEXT "@S_DEST",S_DEST,7,59,72,11 + EDITTEXT E_DIR,82,57,179,11,ES_AUTOHSCROLL + PUSHBUTTON "@B_BROWSE",B_BROWSE,269,55,46,13 + CONTROL "@R_SHOWCUSTOM",R_SHOWCUSTOM,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,33,89,283,9 + CONTROL "@R_FOR_SYSTEM",R_FOR_SYSTEM,"Button",BS_AUTORADIOBUTTON | WS_TABSTOP,46,104,263,9 + CONTROL "@R_FOR_USER",R_FOR_USER,"Button",BS_AUTORADIOBUTTON,46,117,263,9 + ICON ICO_WARNING,S_WARNING2,36,131,20,18 + LTEXT "@S_WARNING",S_WARNING,60,132,256,23 +END + +D_SW_READY DIALOGEX 0, 0, 323, 155 +STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "@D_SW_READY" +FONT 9, "MS Shell Dlg", 400, 0, 0x80 +BEGIN + ICON ICO_INSTALLER,S_ICON,2,0,20,18,WS_TABSTOP + LTEXT "@S_INFO",S_INFO,29,5,287,18 + LTEXT "@S_INFO7",S_INFO7,29,24,287,18 +END + +D_SW_PERFORM DIALOGEX 0, 0, 323, 155 +STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "@D_SW_PERFORM" +FONT 9, "MS Shell Dlg", 400, 0, 0x80 +BEGIN + ICON ICO_TEST,S_ICON,0,65,20,18 + CONTROL "",IDC_PROGRESS1,"msctls_progress32",0x0,7,121,309,13 + LTEXT "@S_INFO",S_INFO,32,65,284,19 + LTEXT "STATUS",S_STATUS,7,99,309,21 + CONTROL 224,IDC_STATIC,"Static",SS_BITMAP,3,0,319,66 +END + +D_SW_ERROR DIALOGEX 0, 0, 323, 155 +STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "@D_SW_ERROR" +FONT 9, "MS Shell Dlg", 400, 0, 0x80 +BEGIN + ICON ICO_STOP,S_ICON,7,5,20,18,WS_TABSTOP + LTEXT "@S_INFO",S_INFO,38,5,278,90 +END + +D_SW_FINISH DIALOGEX 0, 0, 323, 155 +STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "@D_SW_FINISH" +FONT 9, "MS Shell Dlg", 400, 0, 0x80 +BEGIN + ICON ICO_TEST,S_ICON,7,5,20,18,WS_TABSTOP + LTEXT "@S_INFO",S_INFO,38,5,278,65 + CONTROL "RUN_TEXT",B_RUN,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,45,73,271,12 + LTEXT "@S_INFO8",S_INFO8,65,113,251,42 + ICON ICO_GROUP,S_ICON2,43,111,18,18,WS_TABSTOP +END + +D_SW_UNINST1 DIALOGEX 0, 0, 323, 155 +STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "@D_SW_UNINST1" +FONT 9, "MS Shell Dlg", 400, 0, 0x80 +BEGIN + ICON ICO_INSTALLER,-1,7,5,20,18,WS_TABSTOP + LTEXT "@S_WELCOME",S_WELCOME,39,22,277,48 + LTEXT "@S_TITLE",S_TITLE,39,5,277,10 +END + +D_SW_LANG1 DIALOGEX 0, 0, 323, 155 +STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "D_SW_LANG1" +FONT 9, "MS Shell Dlg", 400, 0, 0x80 +BEGIN + CONTROL "",L_LIST,"SysListView32",LVS_REPORT | LVS_SINGLESEL | LVS_SHOWSELALWAYS | LVS_SHAREIMAGELISTS | LVS_AUTOARRANGE | LVS_NOCOLUMNHEADER | LVS_NOSORTHEADER | WS_BORDER | WS_TABSTOP,7,55,309,60 + ICON ICO_LANGUAGE,IDC_STATIC,7,0,20,18 + CONTROL 218,IDC_STATIC,"Static",SS_BITMAP,57,0,113,21 + CONTROL 216,IDC_STATIC,"Static",SS_BITMAP,7,23,307,30 + CONTROL 217,IDC_STATIC,"Static",SS_BITMAP,7,116,307,30 + EDITTEXT E_CURRENT,173,3,143,15,ES_CENTER | ES_AUTOHSCROLL | ES_READONLY +END + +D_SW_EASY1 DIALOGEX 0, 0, 323, 155 +STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "@D_SW_EASY1" +FONT 9, "MS Shell Dlg", 400, 0, 0x80 +BEGIN + ICON ICO_EASYINSTALLER,IDC_STATIC,7,5,20,18,WS_TABSTOP + LTEXT "@S_WELCOME",S_WELCOME,39,26,277,31 + LTEXT "@S_TITLE",S_TITLE,39,5,277,10 + LTEXT "@S_WELCOME2",S_WELCOME2,39,61,277,31 + LTEXT "@S_WELCOME3",S_WELCOME3,39,97,277,31 +END + +D_SW_EASY2 DIALOGEX 0, 0, 323, 155 +STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "@D_SW_EASY2" +FONT 9, "MS Shell Dlg", 400, 0, 0x80 +BEGIN + ICON ICO_SETUP,IDC_STATIC,7,5,18,18,WS_TABSTOP + LTEXT "@S_BOLD1",S_BOLD1,35,5,281,12 + LTEXT "@S_1",S_1,44,22,272,28 + RTEXT "@S_18",S_18,7,52,79,12 + EDITTEXT E_SETTING,88,50,177,11,ES_AUTOHSCROLL | ES_READONLY + PUSHBUTTON "@B_BROWSE_SETTING",B_BROWSE_SETTING,270,48,46,13 + CONTROL "@B_DELETE_SENSITIVE",B_DELETE_SENSITIVE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,89,65,227,11 + LTEXT "@S_BOLD2",S_BOLD2,35,81,281,12 + LTEXT "@S_3",S_3,44,98,272,22 + RTEXT "@S_19",S_19,7,126,79,12 + EDITTEXT E_OUT,88,125,177,11,ES_AUTOHSCROLL | ES_READONLY + PUSHBUTTON "@B_BROWSE_OUT",B_BROWSE_OUT,270,123,46,13 + CONTROL "@B_EASYMODE",B_EASYMODE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,89,139,227,11 +END + +D_SW_WEB1 DIALOGEX 0, 0, 323, 155 +STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "@D_SW_WEB1" +FONT 9, "MS Shell Dlg", 400, 0, 0x80 +BEGIN + ICON ICO_INTERNET,IDC_STATIC,7,5,20,18,WS_TABSTOP + LTEXT "@S_WELCOME",S_WELCOME,39,26,277,31 + LTEXT "@S_TITLE",S_TITLE,39,5,277,10 + LTEXT "@S_WELCOME2",S_WELCOME2,39,61,277,31 + LTEXT "@S_WELCOME3",S_WELCOME3,39,97,277,31 +END + +D_SW_WEB2 DIALOGEX 0, 0, 323, 155 +STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "@D_SW_WEB2" +FONT 9, "MS Shell Dlg", 400, 0, 0x80 +BEGIN + ICON ICO_SETUP,IDC_STATIC,7,5,20,18,WS_TABSTOP + LTEXT "@S_BOLD1",S_BOLD1,35,5,281,12 + LTEXT "@S_1",S_1,44,22,272,28 + RTEXT "@S_18",S_18,7,52,79,12 + EDITTEXT E_SETTING,88,50,177,11,ES_AUTOHSCROLL | ES_READONLY + PUSHBUTTON "@B_BROWSE_SETTING",B_BROWSE_SETTING,270,48,46,13 + CONTROL "@B_DELETE_SENSITIVE",B_DELETE_SENSITIVE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,89,65,227,11 + LTEXT "@S_BOLD2",S_BOLD2,35,81,281,12 + LTEXT "@S_3",S_3,44,98,272,22 + RTEXT "@S_19",S_19,7,126,79,12 + EDITTEXT E_OUT,88,125,177,11,ES_AUTOHSCROLL | ES_READONLY + PUSHBUTTON "@B_BROWSE_OUT",B_BROWSE_OUT,270,123,46,13 + CONTROL "@B_EASYMODE",B_EASYMODE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,89,139,227,11 +END + +D_UPDATE_NOTICE DIALOGEX 0, 0, 259, 204 +STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU +EXSTYLE WS_EX_TOPMOST +CAPTION "@D_UPDATE_NOTICE" +FONT 9, "MS Shell Dlg", 400, 0, 0x80 +BEGIN + CONTROL 225,IDC_STATIC,"Static",SS_BITMAP | WS_TABSTOP,2,1,254,68 + DEFPUSHBUTTON "@IDOK",IDOK,7,182,117,17 + PUSHBUTTON "@B_CONFIG",B_CONFIG,162,95,90,15 + PUSHBUTTON "@IDCANCEL",IDCANCEL,135,182,117,17 + LTEXT "@S_INFO",S_INFO,7,70,245,24 + RTEXT "@S_PRODUCT",S_PRODUCT,7,120,77,15 + LTEXT "TITLE",S_PRODUCT_STR,90,119,162,16 + RTEXT "@S_CURRENT",S_CURRENT,7,140,77,16 + LTEXT "@S_CURRENT_STR",S_CURRENT_STR,90,138,162,16 + RTEXT "@S_LATEST",S_LATEST,7,161,77,16 + LTEXT "@S_LATEST_STR",S_LATEST_STR,90,159,162,17 +END + +D_UPDATE_CONFIG DIALOGEX 0, 0, 307, 132 +STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU +EXSTYLE WS_EX_TOPMOST +CAPTION "@D_UPDATE_CONFIG" +FONT 9, "MS Shell Dlg", 400, 0, 0x80 +BEGIN + LTEXT "@S_INFO",S_INFO,7,27,293,47 + LTEXT "@S_TITLE",S_TITLE,7,5,293,21 + CONTROL "@S_ENABLE",S_ENABLE,"Button",BS_AUTORADIOBUTTON | WS_TABSTOP,48,80,157,12 + CONTROL "@S_DISABLE",S_DISABLE,"Button",BS_AUTORADIOBUTTON,48,96,157,12 + ICON ICO_MACHINE,IDC_STATIC,16,79,20,18 + DEFPUSHBUTTON "@IDCANCEL",IDCANCEL,236,112,64,15 +END + +D_SM_VMBRIDGE DIALOGEX 0, 0, 311, 269 +STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "@D_SM_VMBRIDGE" +FONT 9, "MS Shell Dlg", 400, 0, 0x80 +BEGIN + CONTROL 228,IDC_STATIC,"Static",SS_BITMAP,12,65,286,73 + ICON ICO_NIC_ONLINE,IDC_STATIC,6,4,18,18 + LTEXT "@S_TITLE",S_TITLE,32,5,272,19 + LTEXT "@S_1",IDC_STATIC,7,26,297,24 + LTEXT "@S_2",IDC_STATIC,14,143,282,90 + GROUPBOX "@S_BOLD",S_BOLD,7,52,297,188 + DEFPUSHBUTTON "@IDCANCEL",IDCANCEL,248,248,56,16 +END + +D_SM_AZURE DIALOGEX 0, 0, 411, 317 +STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "@D_SM_AZURE" +FONT 9, "MS Shell Dlg", 400, 0, 0x80 +BEGIN + CONTROL 229,S_BMP_EN,"Static",SS_BITMAP,7,0,397,173 + LTEXT "@S_TITLE",S_TITLE,7,177,397,16 + LTEXT "@S_1",IDC_STATIC,7,194,397,24 + LTEXT "@S_2",IDC_STATIC,7,217,397,24 + LTEXT "@S_3",IDC_STATIC,30,240,374,21 + GROUPBOX "@B_BOLD",B_BOLD,7,264,112,48 + CONTROL "@R_ENABLE",R_ENABLE,"Button",BS_AUTORADIOBUTTON | WS_TABSTOP,13,273,102,12 + CONTROL "@R_DISABLE",R_DISABLE,"Button",BS_AUTORADIOBUTTON,13,297,101,12 + GROUPBOX "@S_HOSTNAME_BORDER",S_HOSTNAME_BORDER,123,264,204,48 + LTEXT "@S_HOSTNAME_INFO",S_HOSTNAME_INFO,129,275,191,19 + EDITTEXT E_HOST,129,295,118,13,ES_AUTOHSCROLL | ES_READONLY | NOT WS_BORDER + PUSHBUTTON "@B_CHANGE",B_CHANGE,252,293,67,15 + PUSHBUTTON "@B_WEB",B_WEB,332,261,72,30,BS_MULTILINE + DEFPUSHBUTTON "@IDCANCEL",IDCANCEL,331,296,73,16 + CONTROL 230,S_BMP_JA,"Static",SS_BITMAP,7,0,397,173 + ICON ICO_AZURE,IDC_STATIC,7,239,20,18 + LTEXT "STATUS_STRING",S_STATUS,22,287,95,9 + CONTROL "",IDC_STATIC,"Static",SS_ETCHEDHORZ,0,174,415,1 + CONTROL 232,S_BMP_CN,"Static",SS_BITMAP,7,0,397,173 +END + +D_SM_PROXY DIALOGEX 0, 0, 227, 153 +STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "@D_SM_PROXY" +FONT 9, "MS Shell Dlg", 400, 0, 0x80 +BEGIN + ICON ICO_TOWER,IDC_STATIC,7,5,20,18 + LTEXT "@STATIC9",IDC_STATIC,33,5,187,17 + RTEXT "@STATIC10",IDC_STATIC,7,39,54,10 + CONTROL "@R_DIRECT_TCP",R_DIRECT_TCP,"Button",BS_AUTORADIOBUTTON | WS_TABSTOP,65,37,135,10 + CONTROL "@R_HTTPS",R_HTTPS,"Button",BS_AUTORADIOBUTTON,65,48,135,10 + CONTROL "@R_SOCKS",R_SOCKS,"Button",BS_AUTORADIOBUTTON,65,58,135,10 + CONTROL "@R_SOCKS5",R_SOCKS5,"Button",BS_AUTORADIOBUTTON,65,68,135,10 + PUSHBUTTON "@B_PROXY_CONFIG",B_PROXY_CONFIG,67,88,114,15 + DEFPUSHBUTTON "@IDOK",IDOK,87,132,64,15 + PUSHBUTTON "@IDCANCEL",IDCANCEL,156,132,64,15 +END + +D_VGC_LIST DIALOGEX 0, 0, 446, 303 +STYLE DS_SETFONT | DS_FIXEDSYS | WS_MAXIMIZEBOX | WS_POPUP | WS_CAPTION | WS_SYSMENU | WS_THICKFRAME +CAPTION "@D_VGC_LIST" +FONT 9, "MS Shell Dlg", 400, 0, 0x80 +BEGIN + ICON ICO_RESEARCH,IDC_STATIC,7,7,20,18 + LTEXT "@S_TITLE",S_TITLE,30,5,186,15 + LTEXT "@S_INFO1",S_INFO1,30,23,331,22 + LTEXT "STATIC",S_BOLD,8,55,352,10 + CONTROL "",L_LIST,"SysListView32",LVS_REPORT | LVS_SHOWSELALWAYS | LVS_SHAREIMAGELISTS | LVS_AUTOARRANGE | WS_BORDER | WS_TABSTOP,7,68,432,181 + DEFPUSHBUTTON "@IDOK",IDOK,276,275,163,22 + PUSHBUTTON "@B_PROXY",B_PROXY,7,274,62,16 + RTEXT "@S_VLAN",S_VLAN,69,277,81,13 + COMBOBOX C_VLAN,153,275,87,87,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP + PUSHBUTTON "@B_WEB",B_WEB,369,18,70,23,BS_MULTILINE + PUSHBUTTON "@B_REFRESH",B_REFRESH,369,47,70,16 + CONTROL "",IDC_PROGRESS1,"msctls_progress32",NOT WS_VISIBLE,372,53,63,9 + LTEXT "@S_REFRESH",S_REFRESH,375,43,71,8,NOT WS_VISIBLE + LTEXT "Implemented as a plug-in for SoftEther VPN. (c) VPN Gate Project at University of Tsukuba, Japan.",S_COPYRIGHT,7,293,268,7 + CONTROL 240,S_TSUKUBA,"Static",SS_BITMAP,397,2,44,13 + RTEXT "@S_RESEARCH",S_RESEARCH,219,5,174,11 + LTEXT "@S_INFO9",S_INFO9,7,251,432,23 +END + +D_VGC_PROTOCOL DIALOGEX 0, 0, 283, 148 +STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "@D_VGC_PROTOCOL" +FONT 9, "MS Shell Dlg", 400, 0, 0x80 +BEGIN + LTEXT "@S_TITLE",S_TITLE,34,5,240,29 + LTEXT "@S_INFO",S_INFO,34,38,240,37 + CONTROL "@R_TCP",R_TCP,"Button",BS_AUTORADIOBUTTON | WS_TABSTOP,50,79,198,15 + CONTROL "@R_UDP",R_UDP,"Button",BS_AUTORADIOBUTTON,50,96,198,15 + DEFPUSHBUTTON "@IDOK",IDOK,136,125,64,17 + PUSHBUTTON "@IDCANCEL",IDCANCEL,204,125,64,17 + ICON ICO_SERVER_ONLINE,IDC_STATIC,7,5,20,18 +END + +D_VGS_CONFIG DIALOGEX 0, 0, 370, 311 +STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "@D_VGS_CONFIG" +FONT 9, "MS Shell Dlg", 400, 0, 0x80 +BEGIN + CONTROL "@R_ENABLE",R_ENABLE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,33,227,330,13 + CONTROL 238,S_VPNGATEJA,"Static",SS_BITMAP,0,0,370,136 + ICON ICO_RESEARCH,IDC_STATIC,7,143,20,18 + LTEXT "@S_TITLE",S_TITLE,33,145,195,15 + LTEXT "@S_INFO1",S_INFO1,33,163,330,31 + LTEXT "@S_INFO9",S_INFO9,33,195,330,31 + ICON ICO_INFORMATION,IDC_STATIC,42,245,20,18 + LTEXT "@S_WARNING",S_WARNING,66,245,297,45 + PUSHBUTTON "@B_OPTION",B_OPTION,7,290,137,15 + DEFPUSHBUTTON "@IDOK",IDOK,230,290,64,15 + PUSHBUTTON "@IDCANCEL",IDCANCEL,299,290,64,15 + PUSHBUTTON "@B_WEB",B_WEB,228,143,135,15 + CONTROL 237,S_VPNGATEEN,"Static",SS_BITMAP,0,0,370,136 +END + +D_VGS_OPTION DIALOGEX 0, 0, 355, 295 +STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "@D_VGS_OPTION" +FONT 9, "MS Shell Dlg", 400, 0, 0x80 +BEGIN + ICON ICO_RESEARCH,IDC_STATIC,7,5,20,18 + LTEXT "@S_TITLE",S_TITLE,33,5,315,19 + GROUPBOX "@S_2",S_2,7,29,341,128 + LTEXT "@S_1",S_1,41,41,293,30 + RTEXT "@S_3",S_3,14,74,114,10 + EDITTEXT E_OWNER,132,72,150,11,ES_AUTOHSCROLL + LTEXT "@S_19",S_19,287,74,56,11 + RTEXT "@S_20",S_20,14,89,114,16 + EDITTEXT E_ABUSE,132,93,150,11,ES_AUTOHSCROLL + LTEXT "@S_21",S_21,287,95,59,13 + ICON ICO_GROUP,IDC_STATIC,14,40,20,18 + RTEXT "@S_22",S_22,14,110,114,27 + EDITTEXT E_MSG,132,109,207,27,ES_MULTILINE | ES_AUTOVSCROLL | WS_VSCROLL + LTEXT "@S_23",S_23,132,139,208,16 + GROUPBOX "@S_24",S_24,7,160,341,112 + ICON ICO_MACHINE,IDC_STATIC,14,172,20,18 + CONTROL "@R_LOG",R_LOG,"Button",BS_AUTOCHECKBOX | WS_DISABLED | WS_TABSTOP,46,173,293,9 + CONTROL "@R_2WEEKS",R_2WEEKS,"Button",BS_AUTORADIOBUTTON | WS_TABSTOP,56,187,284,9 + CONTROL "@R_PERMANENT",R_PERMANENT,"Button",BS_AUTORADIOBUTTON,56,200,284,9 + CONTROL "@R_L2TP",R_L2TP,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,46,216,293,9 + LTEXT "@S_25",S_25,55,230,285,11 + PUSHBUTTON "@B_MESSAGE",B_MESSAGE,45,245,268,15 + DEFPUSHBUTTON "@IDOK",IDOK,215,275,64,15 + PUSHBUTTON "@IDCANCEL",IDCANCEL,284,275,64,15 +END + +D_VGS_WARNING DIALOGEX 0, 0, 349, 249 +STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "@D_VGS_WARNING" +FONT 9, "MS Shell Dlg", 400, 0, 0x80 +BEGIN + ICON ICO_POLICE,IDC_STATIC,7,5,20,18 + LTEXT "@S1",S1,32,35,310,28 + LTEXT "@S2",S2,32,64,310,40 + LTEXT "@S3",S3,32,103,310,30 + LTEXT "@S4",S4,32,133,310,24 + LTEXT "@S5",S5,32,158,310,48 + CONTROL "@R_NEVER",R_NEVER,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,45,210,297,12 + PUSHBUTTON "@B_WEB",B_WEB,7,228,123,15 + DEFPUSHBUTTON "@IDOK",IDOK,209,228,64,15 + PUSHBUTTON "@IDCANCEL",IDCANCEL,278,228,64,15 + LTEXT "@S_BOLD",S_BOLD,32,5,310,27 + ICON ICO_RESEARCH,IDC_STATIC,7,158,20,18 +END + +D_NM_PUSH DIALOGEX 0, 0, 367, 251 +STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "@D_NM_PUSH" +FONT 9, "MS Shell Dlg", 400, 0, 0x80 +BEGIN + ICON ICO_PROTOCOL,IDC_STATIC,7,5,18,18 + LTEXT "@S1",S1,35,9,325,24,WS_TABSTOP + LTEXT "@S2",S2,35,33,325,30 + LTEXT "@S3",S3,35,64,325,30 + LTEXT "@S4",S4,35,95,325,30 + GROUPBOX "@S5",S5,23,124,337,96 + EDITTEXT E_TEXT,35,173,315,36,ES_MULTILINE | WS_VSCROLL + LTEXT "@S6",IDC_STATIC,35,136,315,36 + DEFPUSHBUTTON "@IDOK",IDOK,222,228,64,17 + PUSHBUTTON "@IDCANCEL",IDCANCEL,296,228,64,17 + LTEXT "@S7",IDC_STATIC,35,233,185,12 +END + + +///////////////////////////////////////////////////////////////////////////// +// +// Icon +// + +// Icon with lowest ID value placed first to ensure application icon +// remains consistent on all systems. +ICO_TEST ICON "Test.ico" +ICO_KEY ICON "Key.ico" +ICO_CERT ICON "Cert.ico" +ICO_SERVER_ONLINE ICON "Server.ico" +ICO_WARNING ICON "Warning.ico" +ICO_NULL ICON "Null.ico" +ICO_TOWER ICON "Tower.ico" +ICO_VPN ICON "VPN.ico" +ICO_VPNSERVER ICON "VPNSvr.ico" +ICO_NIC_ONLINE ICON "NIC.ico" +ICO_SETUP ICON "Setup.ico" +ICO_MACHINE ICON "Machine.ico" +ICO_HUB ICON "Hub.ico" +ICO_VLAN ICON "VLan.ico" +ICO_SERVER_OFFLINE ICON "Server_Offline.ico" +ICO_NIC_OFFLINE ICON "NIC_Offline.ico" +ICO_INFORMATION ICON "Information.ico" +ICO_STOP ICON "Stop.ico" +ICO_SERVER_DELETE ICON "Server_Delete.ico" +ICO_SERVER_ONLINE_EX ICON "Server_Online_Ex.ico" +ICO_SERVER_OFFLINE_EX ICON "Server_Offline_Ex.ico" +ICO_INTERNET ICON "Internet.ico" +ICO_DISPLAY ICON "Display.ico" +ICO_GROUP ICON "Group.ico" +ICO_USER ICON "User.ico" +ICO_USER_ADMIN ICON "UserAdmin.ico" +ICO_HUB_OFFLINE ICON "Hub_Offline.ico" +ICO_FARM ICON "Farm.ico" +ICO_X ICON "X.ico" +ICO_PROTOCOL ICON "Protocol.ico" +ICO_PROTOCOL_X ICON "Protocol2.ico" +ICO_DISCARD ICON "Discard.ico" +ICO_PASS ICON "Pass.ico" +ICO_PROTOCOL_OFFLINE ICON "ProtocolOffline.ico" +ICO_MEMORY ICON "Memory.ico" +ICO_PKCS12 ICON "PKCS12.ico" +ICO_SERVER_CERT ICON "ServerCert.ico" +ICO_LINK ICON "Link.ico" +ICO_PENGUIN ICON "Penguin.ico" +ICO_LINK2 ICON "Link2.ico" +ICO_CASCADE ICON "Cascade.ico" +ICO_USER_DENY ICON "UserDeny.ico" +ICO_GROUP_DENY ICON "GroupDeny.ico" +ICO_LOG ICON "Log.ico" +ICO_LOG2 ICON "Log2.ico" +ICO_DATETIME ICON "DateTime.ico" +ICO_NEW ICON "New.ico" +ICO_PASS_DISABLE ICON "PassDisable.ico" +ICO_DISCARD_DISABLE ICON "DiscardDisable.ico" +ICO_CASCADE_ERROR ICON "CascadeOffline.ico" +ICO_CASCADE_OFFLINE ICON "CascadeOffline2.ico" +ICO_PROTOCOL_DHCP ICON "ProtocolDhcp.ico" +ICO_ROUTER ICON "Router.ico" +ICO_BRIDGE ICON "Bridge.ico" +ICO_SWITCH ICON "Switch.ico" +ICO_SWITCH_OFFLINE ICON "SwitchOffline.ico" +ICO_SECURE ICON "Secure.ico" +ICO_CERT_X ICON "CertX.ico" +ICO_INTERNET_X ICON "InternetX.ico" +ICO_LICENSE ICON "License.ico" +ICO_SESSION_BRIDGE ICON "SessionBridge.ico" +ICO_SESSION_MONITOR ICON "SessionMonitor.ico" +ICO_TRAY1 ICON "Tray1.ico" +ICO_TRAY2 ICON "Tray2.ico" +ICO_TRAY3 ICON "Tray3.ico" +ICO_TRAY4 ICON "Tray4.ico" +ICO_TRAY0 ICON "Tray0.ico" + +///////////////////////////////////////////////////////////////////////////// +// +// Bitmap +// + +BMP_TEST BITMAP "Test.bmp" +BMP_SECURE BITMAP "Secure.bmp" +BMP_SECURE2 BITMAP "Secure2.bmp" +BMP_MANAGER_LOGO BITMAP "ManagerLogo.bmp" +BMP_ROUTER_BANNER BITMAP "RouterBanner.bmp" +BMP_ROUTER_LOGO BITMAP "RouterLogo.bmp" +BMP_COINS BITMAP "Coins.bmp" +BMP_SECURE3 BITMAP "Secure3.bmp" +BMP_CLIENT_BANNER BITMAP "ClientBanner.bmp" +BMP_SETUP_2 BITMAP "setup_2.bmp" +BMP_SETUP_1 BITMAP "setup_1.bmp" +BMP_TSUKUBA BITMAP "Tsukuba.bmp" + +///////////////////////////////////////////////////////////////////////////// +// +// AVI +// + +AVI_PROGRESS AVI "Progress.avi" + +///////////////////////////////////////////////////////////////////////////// +// +// Menu +// + +M_MAIN MENU +BEGIN + POPUP "@CMD_TOP_CONNECT" + BEGIN + MENUITEM "@CMD_CONNECT", CMD_CONNECT + MENUITEM "@CMD_STATUS", CMD_STATUS + MENUITEM "@CMD_DISCONNECT", CMD_DISCONNECT + MENUITEM "@CMD_DISCONNECT_ALL", CMD_DISCONNECT_ALL + MENUITEM SEPARATOR + MENUITEM "@CMD_RECENT", CMD_RECENT + MENUITEM SEPARATOR + MENUITEM "@CMD_NEW", CMD_NEW + MENUITEM "@CMD_CLONE", CMD_CLONE + MENUITEM SEPARATOR + MENUITEM "@CMD_SHORTCUT", CMD_SHORTCUT + MENUITEM SEPARATOR + MENUITEM "@CMD_EXPORT_ACCOUNT", CMD_EXPORT_ACCOUNT + MENUITEM "@CMD_IMPORT_ACCOUNT", CMD_IMPORT_ACCOUNT + MENUITEM SEPARATOR + MENUITEM "@CMD_STARTUP", CMD_STARTUP + MENUITEM "@CMD_NOSTARTUP", CMD_NOSTARTUP + MENUITEM SEPARATOR + MENUITEM "@CMD_RENAME", CMD_RENAME + MENUITEM "@CMD_DELETE", CMD_DELETE + MENUITEM "@CMD_PROPERTY", CMD_PROPERTY + MENUITEM SEPARATOR + MENUITEM "@CMD_TRAYICON", CMD_TRAYICON + MENUITEM "@CMD_EXIT", CMD_EXIT + MENUITEM "@CMD_QUIT", CMD_QUIT + END + POPUP "@CMD_TOP_EDIT" + BEGIN + MENUITEM "@CMD_SELECT_ALL", CMD_SELECT_ALL + MENUITEM "@CMD_SWITCH_SELECT", CMD_SWITCH_SELECT + END + POPUP "@CMD_TOP_VIEW" + BEGIN + MENUITEM "@CMD_STATUSBAR", CMD_STATUSBAR + MENUITEM "@CMD_TRAYICON", CMD_TRAYICON + MENUITEM SEPARATOR + MENUITEM "@CMD_SHOWPORT", CMD_SHOWPORT + MENUITEM "@CMD_VISTASTYLE", CMD_VISTASTYLE + MENUITEM SEPARATOR + MENUITEM "@CMD_ICON", CMD_ICON + MENUITEM "@CMD_DETAIL", CMD_DETAIL + MENUITEM SEPARATOR + MENUITEM "@CMD_GRID", CMD_GRID + MENUITEM SEPARATOR + MENUITEM "@CMD_REFRESH", CMD_REFRESH + END + POPUP "@CMD_TOP_VLAN" + BEGIN + MENUITEM "@CMD_NEW_VLAN", CMD_NEW_VLAN + MENUITEM SEPARATOR + MENUITEM "@CMD_ENABLE_VLAN", CMD_ENABLE_VLAN + MENUITEM "@CMD_DISABLE_VLAN", CMD_DISABLE_VLAN + MENUITEM "@CMD_DELETE_VLAN", CMD_DELETE_VLAN + MENUITEM SEPARATOR + MENUITEM "@CMD_REINSTALL", CMD_REINSTALL + MENUITEM SEPARATOR + MENUITEM "@CMD_WINNET", CMD_WINNET + END + POPUP "@CMD_TOP_SECURE" + BEGIN + MENUITEM "@CMD_SECURE_MANAGER", CMD_SECURE_MANAGER + MENUITEM SEPARATOR + MENUITEM "@CMD_SECURE_SELECT", CMD_SECURE_SELECT + END + POPUP "@CMD_TOP_TOOL" + BEGIN + MENUITEM "@CMD_PASSWORD", CMD_PASSWORD + MENUITEM SEPARATOR + MENUITEM "@CMD_TRUST", CMD_TRUST + MENUITEM SEPARATOR + MENUITEM "@CMD_NETIF", CMD_NETIF + MENUITEM "@CMD_MMCSS", CMD_MMCSS + MENUITEM SEPARATOR + MENUITEM "@CMD_TRAFFIC", CMD_TRAFFIC + MENUITEM SEPARATOR + MENUITEM "@CMD_CM_SETTING", CMD_CM_SETTING + MENUITEM "@CMD_LANGUAGE", CMD_LANGUAGE + MENUITEM "@CMD_OPTION", CMD_OPTION + END + POPUP "@CMD_TOP_HELP" + BEGIN + MENUITEM "@CMD_ABOUT", CMD_ABOUT + END +END + +M_VOICE_BACKUP MENU +BEGIN + POPUP "@CMD_TOP_VOICE" + BEGIN + MENUITEM "@CMD_VOIDE_NONE", CMD_VOIDE_NONE + MENUITEM SEPARATOR + MENUITEM "@CMD_VOICE_NORMAL", CMD_VOICE_NORMAL + MENUITEM "@CMD_VOICE_ODD", CMD_VOICE_ODD + END +END + + +///////////////////////////////////////////////////////////////////////////// +// +// BIN +// + +BIN_WINPCAP BIN "Dummy.bin" +#endif // resources +///////////////////////////////////////////////////////////////////////////// + + +///////////////////////////////////////////////////////////////////////////// +// (xW) resources + +#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_CHT) +#ifdef _WIN32 +LANGUAGE LANG_CHINESE, SUBLANG_CHINESE_TRADITIONAL +#pragma code_page(950) +#endif //_WIN32 + +///////////////////////////////////////////////////////////////////////////// +// +// Icon +// + +// Icon with lowest ID value placed first to ensure application icon +// remains consistent on all systems. +ICO_LANG_TRADITIONAL_CHINESE ICON "LANG_TRADITIONAL_CHINESE.ico" +#endif // (xW) resources +///////////////////////////////////////////////////////////////////////////// + + +///////////////////////////////////////////////////////////////////////////// +// ^ () resources + +#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) +#ifdef _WIN32 +LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US +#pragma code_page(1252) +#endif //_WIN32 + +///////////////////////////////////////////////////////////////////////////// +// +// Icon +// + +// Icon with lowest ID value placed first to ensure application icon +// remains consistent on all systems. +ICO_IPSEC ICON "IPsec.ico" +ICO_DDNS ICON "DDNS.ico" +ICO_OPENVPN ICON "OpenVPN.ico" +ICO_SPECIALLISTENER ICON "SpecialListener.ico" +ICO_INSTALLER ICON "Installer.ico" +ICO_LANGUAGE ICON "Language.ico" +ICO_LANG_CHINESE ICON "LANG_CHINESE.ico" +ICO_LANG_ENGLISH ICON "LANG_ENGLISH.ico" +ICO_LANG_JAPANESE ICON "LANG_JAPANESE.ico" +ICO_EASYINSTALLER ICON "EasyInstaller.ico" +ICO_AZURE ICON "Azure.ico" +ICO_ZURUHAM ICON "ZuruHam.ico" +ICO_ZURUKKO ICON "Zurukko.ico" +ICO_RESEARCH ICON "Research.ico" +ICO_POLICE ICON "Police.ico" + +///////////////////////////////////////////////////////////////////////////// +// +// Bitmap +// + +BMP_ETHERIP BITMAP "EtherIP.bmp" +BMP_L2TP BITMAP "L2TP.bmp" +BMP_IX2015 BITMAP "IX2015.bmp" +BMP_OPENVPN BITMAP "OpenVPN.bmp" +BMP_SSTP BITMAP "SSTP.bmp" +BMP_SPECIALLISTENER BITMAP "SpecialListener.bmp" +BMP_SELOGO49x49 BITMAP "SELOGO49x49.bmp" +BMP_UT BITMAP "BMP_UT.bmp" +BMP_SW_LANG_1 BITMAP "SW_LANG_1.bmp" +BMP_SW_LANG_2 BITMAP "SW_LANG_2.bmp" +BMP_SW_LANG_3 BITMAP "SW_LANG_3.bmp" +BMP_VPNSERVER_FIGURE BITMAP "VPNServerFigure.bmp" +BMP_ABOUTBOX BITMAP "AboutBox.bmp" +BMP_UPDATE BITMAP "Update.bmp" +BMP_IBARAKI BITMAP "Ibaraki.bmp" +BMP_WINPC BITMAP "WinPC.bmp" +BMP_VMBRIDGE BITMAP "VMBridge.bmp" +BMP_AZURE BITMAP "Azure.bmp" +BMP_AZURE_JA BITMAP "AzureJa.bmp" +BMP_AZURE_CN BITMAP "AzureCn.bmp" +BMP_VPNGATEBANNER BITMAP "VPNGateBanner.bmp" +BMP_ZURUKKO BITMAP "Zurukko.bmp" +BMP_VPNGATEEN BITMAP "VPNGateEN.bmp" +BMP_VPNGATEJA BITMAP "VPNGateJA.bmp" +BMP_UNIVTSUKUBA BITMAP "UnivTsukuba.bmp" +#endif // ^ () resources +///////////////////////////////////////////////////////////////////////////// + + + +#ifndef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 3 resource. +// + + +///////////////////////////////////////////////////////////////////////////// +#endif // not APSTUDIO_INVOKED + diff --git a/src/PenCore/resource.h b/src/PenCore/resource.h index 2f50d0e6..3a9b9984 100644 --- a/src/PenCore/resource.h +++ b/src/PenCore/resource.h @@ -1,1218 +1,1218 @@ -//{{NO_DEPENDENCIES}} -// Microsoft Visual C++ generated include file. -// Used by PenCore.rc -// -#define IDOK3 2 -#define B_POLICY 3 -#define B_SAVE 3 -#define B_ABOUT 3 -#define B_OFFLINE 3 -#define IDOK2 3 -#define IDCANCEL3 3 -#define B_WEB 3 -#define B_SIMULATION 3 -#define B_RESTORE 3 -#define B_MESSAGE 3 -#define B_PUSH 3 -#define B_HUB_STATUS 4 -#define IDCANCEL2 4 -#define B_SECURE_MANAGER 4 -#define B_REDIRECT 4 -#define B_EULA 4 -#define DLG_SECURE 5 -#define D_SECURE 5 -#define B_CLIENT_CERT 5 -#define B_CREATE 5 -#define B_SELECT_SECURE 5 -#define B_IMPORTANT 5 -#define B_CREATE_LISTENER 6 -#define B_CERT_TOOL 6 -#define B_LEGAL 6 -#define B_DELETE_LISTENER 7 -#define B_LEGAL2 7 -#define B_UPDATE_CONFIG 7 -#define B_START 8 -#define B_LEGAL3 8 -#define B_LANGUAGE 8 -#define B_STOP 9 -#define B_AUTHORS 9 -#define B_EDIT 10 -#define S_STATUSBAR 101 -#define ICO_TEST 103 -#define BMP_TEST 104 -#define ICO_KEY 105 -#define BMP_SECURE 106 -#define BMP_SECURE2 107 -#define AVI_PROGRESS 108 -#define ICO_CERT 109 -#define D_PKCSUTIL 110 -#define D_PASSPHRASE 111 -#define D_DEFAULT 112 -#define D_SPEEDMETER 112 -#define D_PASSWORD 113 -#define ICO_SERVER_ONLINE 113 -#define D_STATUS 114 -#define D_CERT 115 -#define D_CHECKCERT 116 -#define ICO_WARNING 117 -#define D_CONNECTERROR 117 -#define ICO_NULL 118 -#define D_CM_LOGIN 118 -#define D_CM_MAIN 119 -#define ICO_TOWER 119 -#define ICO_VPN 120 -#define D_CONNECTION_STATUS 120 -#define ICO_VPNSERVER 121 -#define D_CM_POLICY 121 -#define D_CM_ACCOUNT 122 -#define ICO_NIC_ONLINE 123 -#define D_CM_PROXY 123 -#define ICO_SETUP 124 -#define D_CM_DETAIL 124 -#define ICO_MACHINE 125 -#define D_CM_NEW_VLAN 125 -#define D_CM_TRUST 126 -#define D_CM_PASSWORD 127 -#define ICO_HUB 128 -#define D_CM_CONFIG 128 -#define ICO_VLAN 129 -#define D_ABOUT 129 -#define ICO_SERVER_OFFLINE 130 -#define M_MAIN 130 -#define D_REMOTE 130 -#define ICO_NIC_OFFLINE 131 -#define D_CM_DESKTOP 131 -#define D_CM_CHANGE_PASSWORD 132 -#define ICO_INFORMATION 133 -#define D_SM_MAIN 133 -#define ICO_STOP 134 -#define D_SM_EDIT_SETTING 134 -#define ICO_SERVER_DELETE 135 -#define D_SM_SERVER 135 -#define ICO_SERVER_ONLINE_EX 136 -#define D_SM_STATUS 136 -#define ICO_SERVER_OFFLINE_EX 137 -#define D_SM_EDIT_HUB 137 -#define ICO_INTERNET 138 -#define D_SM_CREATE_LISTENER 138 -#define ICO_DISPLAY 139 -#define D_SM_SSL 139 -#define D_SM_SAVE_KEY_PAIR 140 -#define BMP_MANAGER_LOGO 141 -#define D_SM_CONNECTION 141 -#define D_SM_FARM 142 -#define ICO_GROUP 143 -#define D_SM_FARM_MEMBER 143 -#define ICO_USER 144 -#define D_SM_CHANGE_PASSWORD 144 -#define ICO_USER_ADMIN 145 -#define D_SM_HUB 145 -#define ICO_HUB_OFFLINE 146 -#define D_SM_USER 146 -#define ICO_FARM 147 -#define D_SM_EDIT_USER 147 -#define D_SM_POLICY 148 -#define D_SM_GROUP 149 -#define ICO_X 150 -#define D_SM_EDIT_GROUP 150 -#define ICO_PROTOCOL 151 -#define D_SM_ACCESS_LIST 151 -#define ICO_PROTOCOL_X 152 -#define D_SM_EDIT_ACCESS 152 -#define ICO_DISCARD 153 -#define D_SM_RADIUS 153 -#define ICO_PASS 154 -#define D_SM_LINK 154 -#define ICO_PROTOCOL_OFFLINE 155 -#define D_SM_LOG 155 -#define ICO_MEMORY 156 -#define D_SM_CA 156 -#define ICO_PKCS12 157 -#define D_SM_SESSION 157 -#define ICO_SERVER_CERT 158 -#define D_SM_MAC 158 -#define D_SM_IP 159 -#define ICO_LINK 160 -#define D_SM_CREATE_CERT 160 -#define ICO_PENGUIN 161 -#define D_NM_LOGIN 161 -#define ICO_LINK2 162 -#define ICO_CASCADE 163 -#define ICO_USER1 164 -#define ICO_USER_DENY 164 -#define ICO_GROUP_DENY 165 -#define ICO_LOG 166 -#define ICO_LOG2 167 -#define ICO_DATETIME 168 -#define ICO_NEW 169 -#define ICO_PASS_DISABLE 170 -#define ICO_DISCARD_DISABLE 171 -#define ICO_CASCADE_ERROR 172 -#define ICO_CASCADE_OFFLINE 173 -#define ICO_PROTOCOL_DHCP 174 -#define ICO_ROUTER 175 -#define BMP_ROUTER_BANNER 176 -#define BMP_ROUTER_LOGO 178 -#define BMP_COINS 179 -#define ICO_BRIDGE 180 -#define BIN_WINPCAP 181 -#define ICO_SWITCH 182 -#define ICO_SWITCH_OFFLINE 183 -#define ICO_SECURE 184 -#define ICO_CERT_X 185 -#define ICO_INTERNET_X 186 -#define ICO_LICENSE 187 -#define ICO_SESSION_BRIDGE 188 -#define BMP_SECURE3 188 -#define ICO_VPN1 189 -#define ICO_SESSION_MONITOR 189 -#define ICO_TRAY1 190 -#define BMP_CLIENT_BANNER 190 -#define ICO_TRAY2 191 -#define BMP_SETUP_2 191 -#define ICO_TRAY3 192 -#define BMP_SETUP_1 192 -#define ICO_TRAY4 193 -#define BMP_TSUKUBA 193 -#define ICO_VPN2 194 -#define ICO_TRAY0 194 -#define IDR_MENU1 194 -#define M_VOICE_BACKUP 194 -#define BMP_ETHERIP 195 -#define BMP_L2TP 197 -#define ICO_IPSEC 201 -#define BMP_IX2015 202 -#define ICO_DDNS 203 -#define ICO_OPENVPN 204 -#define BMP_OPENVPN 205 -#define BMP_SSTP 206 -#define ICO_SPECIALLISTENER 207 -#define BMP_SPECIALLISTENER 208 -#define ICO_INSTALLER 209 -#define BMP_SELOGO49x49 211 -#define ICO_LANGUAGE 215 -#define BMP_SW_LANG_1 216 -#define BMP_SW_LANG_2 217 -#define BMP_SW_LANG_3 218 -#define ICO_LANG_CHINESE 219 -#define ICO_LANG_ENGLISH 220 -#define ICO_LANG_JAPANESE 221 -#define ICO_EASYINSTALLER 222 -#define BMP_VPNSERVER_FIGURE 223 -#define BMP_ABOUTBOX 224 -#define BMP_UPDATE 225 -#define BMP_IBARAKI 226 -#define IDB_BITMAP1 227 -#define BMP_WINPC 227 -#define BMP_VMBRIDGE 228 -#define BMP_AZURE 229 -#define BMP_AZURE_JA 230 -#define ICO_AZURE 231 -#define IDB_BITMAP2 232 -#define BMP_AZURE_CN 232 -#define ICO_ZURUHAM 233 -#define IDI_ICON2 234 -#define ICO_ZURUKKO 234 -#define BMP_VPNGATEBANNER 235 -#define BMP_ZURUKKO 236 -#define BMP_VPNGATEEN 237 -#define BMP_VPNGATEJA 238 -#define ICO_RESEARCH 239 -#define BMP_UNIVTSUKUBA 240 -#define ICO_POLICE 241 -#define ICO_LANG_TRADITIONAL_CHINESE 243 -#define S_TITLE 1007 -#define S_INSERT_SECURE 1008 -#define S_TITLE2 1008 -#define S_STATIC 1008 -#define S_RESEARCH 1008 -#define S_DEVICE_INFO 1009 -#define E_PIN 1010 -#define IDS_STATIC1 1012 -#define S_WARNING 1013 -#define A_PROGRESS 1014 -#define S_MSG_1 1014 -#define S_WARNING2 1014 -#define S_STATUS 1015 -#define S_MSG_2 1015 -#define S_PIN_CODE 1016 -#define S_MSG_3 1016 -#define S_STATUS3 1016 -#define S_SOFTWARE_TITLE 1017 -#define S_STATUS4 1017 -#define B_WRITE 1018 -#define S_STATUS6 1018 -#define B_ERASE 1019 -#define S_STATUS5 1019 -#define S_COPYRIGHT 1020 -#define S_SUFFIX 1020 -#define E_PASSPHRASE 1021 -#define S_STATUS7 1021 -#define S_STATUS8 1022 -#define E_USERNAME 1023 -#define C_TYPE 1024 -#define E_HUBNAME 1024 -#define E_REALNAME 1024 -#define P_PROGRESS 1025 -#define E_NOTE 1025 -#define E_NICNAME 1025 -#define E_GROUP 1026 -#define E_PRIORITY 1026 -#define E_PASSWORD 1027 -#define E_CN 1027 -#define E_SRC_IP_V6 1027 -#define S_COUNTDOWN 1028 -#define E_PASSWORD2 1028 -#define E_SRC_PORT_1 1028 -#define E_O 1028 -#define S_RETRYINFO 1029 -#define E_RADIUS_USERNAME 1029 -#define E_SRC_PORT_2 1029 -#define E_OU 1029 -#define E_SUBJECT 1030 -#define E_DST_PORT_1 1030 -#define E_C 1030 -#define E_ISSUER 1031 -#define E_DST_PORT_2 1031 -#define E_ST 1031 -#define E_EXPIRES 1032 -#define E_L 1032 -#define E_SRC_PORT_3 1032 -#define E_IP_PROTO 1032 -#define L_CERTINFO 1033 -#define E_MD5 1033 -#define E_EXPIRES_TIME 1033 -#define E_EXPIRE 1033 -#define E_SERI 1033 -#define E_DST_MAC 1033 -#define S_PARENT 1034 -#define E_DOMAIN 1034 -#define E_MD5_HASH 1034 -#define E_SRC_MAC 1034 -#define B_PARENT 1035 -#define E_SHA1 1035 -#define E_SHA1_HASH 1035 -#define E_SRC_MAC_MASK 1035 -#define E_DST_MAC_MASK 1036 -#define S_WARNING_ICON 1037 -#define E_SRC_MASK_V6 1037 -#define S_CERT_ICON 1038 -#define E_DST_IP_V6 1038 -#define S_PARENT_BUTTON_STR 1039 -#define E_DST_MASK_V6 1039 -#define E_DETAIL 1040 -#define B_SHOW 1041 -#define S_MSG1 1043 -#define E_ERROR 1044 -#define L_ACCOUNT 1047 -#define L_VLAN 1048 -#define L_STATUS 1048 -#define S_DESCRIPTION 1051 -#define L_POLICY 1052 -#define E_ACCOUNT_NAME 1053 -#define E_HOSTNAME 1054 -#define E_RETRY_NUM 1055 -#define E_SECRET1 1055 -#define E_SECRET2 1056 -#define R_DIRECT_TCP 1057 -#define R_HTTPS 1059 -#define R_SOCKS 1060 -#define R_SOCKS5 1061 -#define S_USERNAME 1062 -#define E_RETRY_SPAN 1065 -#define C_HUBNAME 1066 -#define S_PASSWORD 1067 -#define S_CERT 1068 -#define S_CONTROLLER_PORT 1068 -#define B_REGIST_CLIENT_CERT 1069 -#define S_CERT_INFO 1070 -#define R_RETRY 1071 -#define R_INFINITE 1072 -#define R_USE_ENCRYPT 1072 -#define B_DETAIL 1073 -#define R_USE_COMPRESS 1073 -#define R_CHECK_CERT 1074 -#define R_USE_COMPRESS2 1074 -#define R_DISABLE_UDP 1074 -#define B_CONFIG_L2 1074 -#define B_VIEW_CLIENT_CERT 1075 -#define C_NUM_TCP 1075 -#define B_TRUST 1076 -#define E_INTERVAL 1076 -#define B_PROXY_CONFIG 1077 -#define B_SERVER_CERT 1078 -#define B_VIEW_SERVER_CERT 1079 -#define R_USE_HALF_CONNECTION 1080 -#define C_PORT 1080 -#define S_STATIC13 1080 -#define R_USE_DISCONNECT 1081 -#define S_RETRY_NUM_1 1081 -#define S_RETRY_NUM_2 1082 -#define S_RETRY_SPAN_1 1083 -#define E_DISCONNECT_SPAN 1083 -#define S_RETRY_SPAN_2 1084 -#define R_NO_ROUTING 1084 -#define E_NAME 1085 -#define B_CHANGE_PASSWORD 1085 -#define L_CERT 1086 -#define S_CHANGE_PASSWORD 1086 -#define B_IMPORT 1087 -#define B_PROXY_CONFIG2 1087 -#define B_IE 1087 -#define B_EXPORT 1088 -#define IDC_STATIC1 1088 -#define R_USE_PASSWORD 1089 -#define IDC_STATIC3 1089 -#define B_IMPORT2 1089 -#define B_REGENERATE 1089 -#define B_FACTORY 1089 -#define R_RETRY2 1089 -#define R_REMOTE_ONLY 1090 -#define IDC_STATIC4 1090 -#define B_DELETE 1091 -#define IDC_STATIC2 1091 -#define R_ALLOW_REMOTE_CONFIG 1092 -#define B_REFRESH 1092 -#define IDC_STATIC5 1092 -#define B_DELETE2 1092 -#define B_ETH_VLAN 1092 -#define B_VLAN 1092 -#define R_USE_KEEP_CONNECT 1093 -#define B_CERT 1093 -#define IDC_STATIC6 1093 -#define B_SESSION_IP_TABLE 1093 -#define B_NEW_CERT 1093 -#define B_RENAME 1093 -#define S_HOSTNAME 1094 -#define B_REFRESH2 1094 -#define B_BRIDGE 1094 -#define B_PIN 1094 -#define R_ALPHA 1095 -#define B_SESSION_MAC_TABLE 1095 -#define B_PASSWORD2 1095 -#define B_L3 1095 -#define R_TCP 1096 -#define B_MAC_TABLE 1096 -#define B_IPSEC 1096 -#define S_INFO 1097 -#define B_OPENVPN 1097 -#define S_PORT 1098 -#define B_BRIDGE2 1098 -#define B_DDNS 1098 -#define S_INFO7 1098 -#define E_PORT 1099 -#define B_AZURE 1099 -#define S_INFO8 1099 -#define S_INTERVAL 1100 -#define E_CONTROLLER 1100 -#define B_IP_TABLE 1100 -#define E_PORT2 1100 -#define E_RADIUS_RETRY_INTERVAL 1100 -#define S_INFO6 1100 -#define B_VPNGATE 1100 -#define S_INFO2 1101 -#define S_INTERVAL2 1102 -#define R_LOCAL 1102 -#define S_PROTOCOL 1103 -#define C_HOSTNAME 1103 -#define R_UDP 1104 -#define S_ICON 1104 -#define E_ALPHA_VALUE 1105 -#define S_INFO4 1105 -#define S_ICON2 1105 -#define S_INFO3 1106 -#define E_OLD_PASSWORD 1106 -#define E_NEW_PASSWORD1 1107 -#define S_INFO5 1107 -#define E_NEW_PASSWORD2 1108 -#define L_SETTING 1109 -#define B_NEW_SETTING 1110 -#define B_EDIT_SETTING 1111 -#define R_SERVER_ADMIN 1111 -#define B_DELETE_SETTING 1112 -#define R_NO_SAVE 1112 -#define B_MODE 1112 -#define R_HUB_ADMIN 1113 -#define B_MODE2 1113 -#define B_VGC 1113 -#define S_HUBNAME 1114 -#define E_MAX_SESSION 1115 -#define R_LOCALHOST 1116 -#define L_HUB 1118 -#define L_LISTENER 1120 -#define B_SSL 1121 -#define B_STATUS 1123 -#define E_PASSWORD1 1123 -#define B_INFO 1124 -#define R_LIMIT_MAX_SESSION 1124 -#define B_FARM 1125 -#define S_MAX_SESSION_1 1125 -#define B_INFO2 1125 -#define S_MAX_SESSION_2 1126 -#define B_CONNECTION 1126 -#define R_ONLINE 1127 -#define B_FARM_STATUS 1127 -#define R_OFFLINE 1128 -#define S_BOLD 1129 -#define S_FARM_INFO 1130 -#define S_BOLD2 1130 -#define R_STATIC 1131 -#define R_DYNAMIC 1132 -#define C_CIPHER 1132 -#define S_AO_3 1133 -#define S_ACL 1134 -#define B_VIEW 1136 -#define R_PKCS12 1136 -#define R_USE_PASS 1137 -#define E_PASS1 1138 -#define E_PASS2 1139 -#define R_X509_AND_KEY 1140 -#define S_PASS1 1141 -#define S_PASS2 1142 -#define B_DISCONNECT 1143 -#define R_SECURE 1143 -#define L_LIST 1144 -#define S_CURRENT 1145 -#define L_KEY 1145 -#define R_STANDALONE 1146 -#define R_CONTROLLER 1147 -#define R_MEMBER 1148 -#define S_PORT_2 1151 -#define S_PORT_1 1152 -#define S_IP_1 1153 -#define E_IP 1154 -#define S_SRC_MAC_ALL 1154 -#define S_CHECK_SRC_MAC 1154 -#define S_IP_2 1155 -#define E_SRC_MASK 1155 -#define E_MASK 1155 -#define S_CONTROLLER 1156 -#define E_DST_IP 1156 -#define E_DHCP_START 1156 -#define E_CONTROLLER_PORT 1157 -#define E_DST_MASK 1157 -#define E_DHCP_END 1157 -#define S_PORT_3 1158 -#define E_DHCP_MASK 1158 -#define L_FARM_MEMBER 1159 -#define E_GATEWAY 1159 -#define B_USER 1160 -#define E_DNS 1160 -#define B_GROUP 1161 -#define B_CASCADE 1161 -#define E_DNS2 1161 -#define S_USER 1162 -#define B_USER2 1162 -#define S_GROUP 1163 -#define B_SECURENAT 1163 -#define B_ACCESS 1164 -#define S_LINK 1165 -#define S_RADIUS 1166 -#define L_USER 1167 -#define S_RADIUS2 1167 -#define S_CA 1167 -#define B_PROPERTY 1168 -#define B_RADIUS 1169 -#define B_LINK 1170 -#define S_PASSWORD_2 1170 -#define B_SESSION 1171 -#define S_PASSWORD_3 1171 -#define B_LOG 1172 -#define B_LOAD_CERT 1172 -#define B_RADIUS2 1173 -#define B_VIEW_CERT 1173 -#define B_CA 1173 -#define R_CN 1174 -#define B_SNAT 1174 -#define R_SERIAL 1175 -#define S_SNAT 1175 -#define R_O 1175 -#define R_SET_RADIUS_USERNAME 1176 -#define B_CRL 1176 -#define R_OU 1176 -#define S_RADIUS_2 1177 -#define R_C 1177 -#define B_LOG_FILE 1177 -#define R_POLICY 1178 -#define S_RADIUS_4 1178 -#define R_ST 1178 -#define S_RADIUS_5 1179 -#define R_L 1179 -#define R_EXPIRES 1180 -#define R_SERI 1180 -#define S_RADIUS_7 1180 -#define R_MD5_HASH 1181 -#define S_RADIUS_9 1181 -#define R_SHA1_HASH 1182 -#define L_AUTH 1183 -#define S_RADIUS_8 1183 -#define S_RADIUS_1 1184 -#define S_RADIUS_3 1185 -#define S_POLICY_1 1186 -#define S_PASSWORD_1 1187 -#define S_POLICY_2 1187 -#define S_ROOT_CERT_1 1188 -#define S_ROOT_CERT_2 1189 -#define S_ROOT_CERT_3 1190 -#define S_USER_CERT_1 1191 -#define S_RADIUS_10 1192 -#define S_HINT 1192 -#define E_EXPIRES_DATE 1193 -#define S_POLICY_TITLE 1194 -#define E_POLICY_DESCRIPTION 1195 -#define R_ENABLE 1196 -#define R_DISABLE 1197 -#define R_DEFINE 1198 -#define E_VALUE 1199 -#define S_TANI 1200 -#define S_LIMIT 1201 -#define L_GROUP 1202 -#define E_GROUPNAME 1203 -#define B_ADD 1205 -#define L_ACCESS_LIST 1206 -#define B_DEL_IF 1206 -#define B_ADD_TABLE 1207 -#define B_ADD_V6 1207 -#define R_PASS 1208 -#define B_DEL_TABLE 1208 -#define B_DEL 1208 -#define R_DISCARD 1209 -#define R_DENY 1209 -#define R_SRC_ALL 1210 -#define B_OBTAIN 1210 -#define R_IPV4 1210 -#define R_DST_ALL 1211 -#define R_IPV6 1211 -#define C_PROTOCOL 1212 -#define E_USERNAME1 1213 -#define E_USERNAME2 1214 -#define S_SRC_IP_1 1215 -#define S_SRC_IP_2 1216 -#define S_SRC_IP_3 1217 -#define E_SRC_IP 1218 -#define S_SRC_IP_4 1218 -#define S_IP_DST_1 1219 -#define S_IP_DST_2 1220 -#define S_IP_DST_3 1221 -#define S_TCP_1 1222 -#define S_TCP_2 1223 -#define S_TCP_3 1224 -#define S_TCP_4 1225 -#define S_TCP_5 1226 -#define S_TCP_6 1227 -#define S_TCP_7 1228 -#define B_USER1 1229 -#define S_SRC_MAC 1230 -#define R_USE_RADIUS 1231 -#define R_SRC_MAC_ALL 1231 -#define R_CHECK_SRC_MAC 1231 -#define S_DST_MAC 1232 -#define S_RADIUS3 1233 -#define R_DST_MAC_ALL 1233 -#define R_CHECK_DST_MAC 1233 -#define S_RADIUS_6 1234 -#define S_SRC_MAC_MASK 1234 -#define S_LOG 1235 -#define S_DST_MAC_MASK 1235 -#define S_MAC_NOTE 1236 -#define L_LINK 1237 -#define E_SERIAL 1238 -#define S_VLAN_GROUP 1238 -#define B_SEC 1240 -#define S_SEC 1241 -#define C_SEC_SWITCH 1242 -#define B_PACKET 1243 -#define S_PACKET 1244 -#define C_PACKET_SWITCH 1245 -#define S_PACKET_0 1246 -#define S_PACKET_1 1247 -#define B_PACKET_0_0 1248 -#define B_PACKET_1_0 1249 -#define S_FARM_INFO_1 1249 -#define B_PACKET_0_1 1250 -#define S_FARM_INFO_2 1250 -#define B_PACKET_1_1 1251 -#define L_TABLE 1251 -#define B_PACKET_0_2 1252 -#define R_ROOT_CERT 1252 -#define B_PACKET_1_2 1253 -#define R_SIGNED_CERT 1253 -#define S_PACKET_2 1254 -#define B_LOAD 1254 -#define B_PACKET_2_0 1255 -#define S_LOAD_1 1255 -#define B_PACKET_2_1 1256 -#define S_LOAD_2 1256 -#define B_PACKET_2_2 1257 -#define S_LOAD_3 1257 -#define S_LOAD_4 1258 -#define S_LOAD_5 1259 -#define S_STATIC_S 1259 -#define S_ACCESS 1259 -#define S_LOAD_6 1260 -#define S_VERSION 1260 -#define S_LOAD_7 1261 -#define S_LOGO 1261 -#define S_PACKET_3 1262 -#define S_LOAD_8 1262 -#define S_VERSION2 1262 -#define B_PACKET_3_0 1263 -#define S_LOAD_9 1263 -#define S_BUILD 1263 -#define B_PACKET_3_1 1264 -#define S_LOAD_10 1264 -#define B_PACKET_3_2 1265 -#define S_LOAD_11 1265 -#define B_SETTING 1265 -#define S_PACKET_4 1266 -#define B_CONNECT 1266 -#define S_ACCOUNT_NAME 1266 -#define S_LOAD_12 1266 -#define B_PACKET_4_0 1267 -#define S_ROUTER_LOGO 1267 -#define S_LOAD_13 1267 -#define B_PACKET_4_1 1268 -#define B_OPTION 1268 -#define E_MAC 1268 -#define B_PACKET_4_2 1269 -#define B_NAT 1269 -#define R_USE_NAT 1269 -#define S_PACKET_5 1270 -#define E_MTU 1270 -#define B_PACKET_5_0 1271 -#define B_DHCP 1271 -#define E_TCP 1271 -#define B_PACKET_5_1 1272 -#define E_UDP 1272 -#define B_PACKET_5_2 1273 -#define R_USE_DHCP 1273 -#define S_PACKET_6 1274 -#define R_SAVE_LOG 1274 -#define B_PACKET_6_0 1275 -#define R_HIDE 1275 -#define B_PACKET_6_1 1276 -#define S_PROPERTY 1276 -#define R_HIDE2 1276 -#define B_PACKET_6_2 1277 -#define B_ENABLE 1277 -#define S_PACKET_7 1278 -#define B_DISABLE 1278 -#define B_PACKET_7_0 1279 -#define B_CONFIG 1279 -#define B_CLONE 1279 -#define B_DISABLE2 1279 -#define B_PROXY 1279 -#define B_PACKET_7_1 1280 -#define S_TSUKUBA1 1280 -#define B_LICENSE 1280 -#define B_PACKET_7_2 1281 -#define S_TSUKUBA2 1281 -#define IDC_CHECK1 1285 -#define R_NO_SAVE_PASSWORD 1285 -#define R_PROMISCUOUS 1285 -#define R_NO_ENUM 1285 -#define R_ETHERNET 1285 -#define R_CONTROLLER_ONLY 1285 -#define B_HIDE 1285 -#define R_DISABLE_QOS 1285 -#define R_LOCK 1285 -#define C_REMOTE 1285 -#define C_DONTSHOWAGAIN 1285 -#define R_CHECK_TCP_STATE 1285 -#define C_DELAY 1285 -#define C_USEMSG 1285 -#define R_L2TP_OVER_IPSEC 1285 -#define B_AGREE 1285 -#define R_SHOWCUSTOM 1285 -#define B_RUN 1285 -#define B_DELETE_SENSITIVE 1285 -#define R_LOG 1285 -#define R_DOUBLE 1286 -#define C_SITE 1286 -#define C_JITTER 1286 -#define R_REDIRECT 1286 -#define R_L2TP 1286 -#define E_LIST 1287 -#define C_OTHER 1287 -#define C_LOSS 1287 -#define R_L2TP_RAW 1287 -#define B_EASYMODE 1287 -#define R_ETHERIP 1288 -#define R_BRIDGE 1289 -#define R_TAP 1290 -#define R_MONITOR 1290 -#define E_TAPNAME 1291 -#define S_ETH_1 1292 -#define S_TAP_1 1293 -#define S_TAP_2 1294 -#define S_VHUB_BRIDGE 1295 -#define C_DEVICE 1296 -#define IDC_INFO 1297 -#define E_CONFIG 1298 -#define B_ADMINOPTION 1300 -#define S_AO_1 1301 -#define S_AO_2 1302 -#define S_ACL_3 1303 -#define S_ACL_2 1304 -#define B_ACL 1305 -#define B_ACL2 1306 -#define B_EXTOPTION 1306 -#define S_AO_4 1307 -#define B_MSG 1308 -#define C_NAME 1309 -#define S_ACL_5 1310 -#define L_IF 1311 -#define S_BOLD1 1313 -#define B_ADD_IF 1314 -#define E_NETWORK 1315 -#define E_METRIC 1316 -#define B_BOLD 1317 -#define R_CERT 1319 -#define R_KEY 1320 -#define E_STRING 1320 -#define R_DATA 1321 -#define B_BOLD1 1321 -#define B_BOLD2 1322 -#define R_FROM_FILE 1322 -#define R_FROM_SECURE 1323 -#define B_SELECT 1324 -#define S_FILE 1325 -#define S_PASS3 1326 -#define S_PASS4 1327 -#define E_PIN1 1328 -#define E_PIN2 1329 -#define E_PIN3 1330 -#define R_SINGLE 1331 -#define R_MASKED 1332 -#define S_MASK 1333 -#define S_MODE 1336 -#define B_PASSWORD 1339 -#define R_RECV_DISABLE 1340 -#define B_PASSWORD3 1340 -#define B_SPECIALLISTENER 1340 -#define R_RECV_ENABLE 1341 -#define E_RECV 1342 -#define S_RECV 1343 -#define B_RECV 1344 -#define R_SEND_DISABLE 1345 -#define R_SEND_ENABLE 1346 -#define E_SEND 1347 -#define R_OPTIMIZE 1347 -#define S_SEND 1348 -#define R_MANUAL 1348 -#define B_SEND 1349 -#define R_NO 1349 -#define S_IMAGE 1351 -#define S_IMAGE2 1352 -#define S_INFO_1 1352 -#define S_INFO_2 1353 -#define S_IMAGE3 1353 -#define S_IMAGE_TSUKUBA 1353 -#define S_INFO_3 1354 -#define S_INFO_4 1355 -#define S_PROTOID 1356 -#define S_1 1359 -#define S_18 1360 -#define S_3 1361 -#define R_SERVER 1362 -#define S_19 1362 -#define R_CLIENT 1363 -#define S_20 1363 -#define S_4 1364 -#define S_21 1364 -#define S_5 1365 -#define S_23 1365 -#define C_HOST 1366 -#define S_22 1366 -#define S_6 1367 -#define S_25 1367 -#define S_8 1368 -#define S_9 1369 -#define S_7 1370 -#define R_DOWNLOAD 1371 -#define R_UPLOAD 1372 -#define R_FULL 1373 -#define S_10 1374 -#define S_11 1375 -#define C_NUM 1376 -#define S_12 1377 -#define E_SPAN 1378 -#define S_13 1379 -#define E_EDIT 1379 -#define S_14 1380 -#define IDC_EDIT1 1380 -#define E_WEIGHT 1380 -#define B_KEY1 1380 -#define E_SYSLOG_HOSTNAME 1380 -#define E_TEXT 1380 -#define E_DELAY 1380 -#define E_IPV6 1380 -#define E_SECRET 1380 -#define E_ID 1380 -#define E_DDNS_HOST 1380 -#define E_SAMPLE1 1380 -#define E_CURRENT 1380 -#define E_OWNER 1380 -#define S_15 1381 -#define S_2 1381 -#define E_SYSLOG_PORT 1381 -#define E_JITTER 1381 -#define E_IPV7 1381 -#define E_MASKV6 1381 -#define E_SAMPLE2 1381 -#define E_DDNS_HOST2 1381 -#define E_AZURE_HOST 1381 -#define E_LOSS 1382 -#define S_16 1382 -#define E_URL 1382 -#define E_ABUSE 1382 -#define S_17 1383 -#define E_MSG 1383 -#define S_24 1384 -#define ABOUT 1387 -#define C_SYSLOG 1388 -#define B_KEY2 1389 -#define S_01 1389 -#define B_KEY3 1390 -#define S_02 1390 -#define B_KEY4 1391 -#define R_EASY 1391 -#define B_KEY5 1392 -#define R_NORMAL 1392 -#define B_KEY6 1393 -#define S_PASSWORD1 1393 -#define S_PASSWORD2 1394 -#define S_PASSWORD3 1395 -#define S_STATIC3 1397 -#define S_STATIC4 1398 -#define S_STATIC5 1399 -#define S_STATIC7 1400 -#define S_STATIC66 1401 -#define S_STATIC2 1402 -#define S_STATIC11 1403 -#define S_STATIC1 1404 -#define S_STATIC6 1405 -#define S_STATIC8 1406 -#define S_STATIC9 1407 -#define S_STATIC10 1408 -#define S_STATIC12 1409 -#define S_STATIC19 1410 -#define S_STATIC133 1411 -#define S_REMOTE_1 1413 -#define S_SITE_1 1414 -#define S_SITE_2 1415 -#define C_CENTER 1416 -#define C_EDGE 1417 -#define S_OTHER 1418 -#define S_1_1 1421 -#define S_1_2 1422 -#define S_2_1 1423 -#define S_2_2 1424 -#define S_3_1 1425 -#define S_3_2 1426 -#define IDC_COMBO1 1427 -#define C_BITS 1427 -#define R_NEVER 1427 -#define IDC_BUTTON1 1428 -#define BMP_UT 1428 -#define S_LICENSE 1429 -#define IDC_BUTTON2 1429 -#define S_BETA 1430 -#define IDC_BUTTON3 1430 -#define S_DST_MAC_ALL 1431 -#define S_CHECK_DST_MAC 1431 -#define IDC_BUTTON4 1431 -#define S_ACCESS_DST_ALL 1432 -#define S_ACCESS_SRC_ALL 1433 -#define IDC_RADIO1 1434 -#define R_ESTABLISHED 1434 -#define R_SYSTEM 1434 -#define R_DEFAULT 1434 -#define S_ENABLE 1434 -#define R_2WEEKS 1434 -#define IDC_RADIO2 1435 -#define R_UNESTABLISHED 1435 -#define R_USER 1435 -#define R_CUSTOM 1435 -#define S_DISABLE 1435 -#define R_PERMANENT 1435 -#define R_FOR_SYSTEM 1436 -#define IDC_NETADDRESS1 1437 -#define R_FOR_USER 1437 -#define IDC_PROGRESS1 1438 -#define E_HELP 1440 -#define S_DELAY 1441 -#define S_DELAY2 1442 -#define S_JITTER 1443 -#define S_JITTER2 1444 -#define S_LOSS 1445 -#define S_LOSS2 1446 -#define S_STATIC14 1448 -#define S_STATIC15 1449 -#define S_MSG_4 1450 -#define S_STATUS1 1451 -#define S_STATUS2 1452 -#define P_BAR 1453 -#define L_HUBNAME 1454 -#define S_PSK 1455 -#define S_PSK2 1456 -#define S_WIN8 1457 -#define R_OPENVPN 1458 -#define S_UDP 1459 -#define B_APPLY 1460 -#define S_TOOL 1461 -#define S_TOOL2 1462 -#define R_SSTP 1463 -#define B_CONFIG_L3 1464 -#define S_SSTP 1465 -#define E_HOST 1466 -#define E_IPV4 1467 -#define E_NEWHOST 1468 -#define B_NSLOOKUP 1469 -#define E_KEY 1469 -#define B_HINT 1470 -#define S_DDNS 1470 -#define R_OVER_ICMP 1471 -#define S_AZURE 1471 -#define B_HINT2 1471 -#define R_OVER_ICMP2 1472 -#define R_OVER_DNS 1472 -#define B_WIZ_NEXT 1472 -#define B_WIZ_NEXT2 1473 -#define B_WIZ_PREV 1473 -#define S_ACK 1473 -#define S_WELCOME 1474 -#define S_ACK2 1475 -#define S_WELCOME2 1475 -#define S_WELCOME3 1476 -#define E_DIR 1479 -#define B_BROWSE 1480 -#define S_DEST 1481 -#define B_BROWSE_OUT 1481 -#define S_UAC 1482 -#define E_SETTING 1483 -#define E_OUT 1484 -#define B_BROWSE_SETTING 1485 -#define S_INFO1 1486 -#define S_PRODUCT 1487 -#define S_INFO9 1487 -#define S_PRODUCT_STR 1488 -#define S_CURRENT_STR 1490 -#define S_LATEST 1491 -#define S_LATEST_STR 1492 -#define S_BMP_EN 1494 -#define S_BMP_JA 1495 -#define B_CHANGE 1496 -#define S_HOSTNAME_BORDER 1497 -#define S_HOSTNAME_INFO 1498 -#define S_BMP_CN 1499 -#define S_REFRESH 1499 -#define S_VLAN 1500 -#define C_VLAN 1502 -#define S_VPNGATEJA 1504 -#define S_ICO_VPNGATE 1505 -#define S_VPNGATEJA2 1505 -#define S_VPNGATEEN 1505 -#define S1 1506 -#define S2 1507 -#define S3 1508 -#define S4 1509 -#define S5 1510 -#define S_VGS1 1511 -#define S_VGS2 1512 -#define B_VGS 1513 -#define S_VGS3 1514 -#define S_TSUKUBA 1515 -#define R_DISABLE_NATT 1516 -#define S_SMARTCARD_ICON 1517 -#define L_VALUES_LIST 1519 -#define B_HTTP_HEADER 1520 -#define B_NEW 1521 -#define B_CLEAR 1522 -#define B_ONLINE 1655 -#define D_NM_CONNECT 1998 -#define D_NM_MAIN 1999 -#define D_NM_OPTION 2000 -#define D_NM_NAT 2001 -#define D_NM_DHCP 2002 -#define D_NM_CHANGE_PASSWORD 2003 -#define D_SM_SNAT 2004 -#define D_SM_BRIDGE 2005 -#define D_WIN9X_REBOOT 2006 -#define D_DEFAULT1 2007 -#define D_EM_MAIN 2008 -#define D_EM_ADD 2009 -#define D_EM_PASSWORD 2010 -#define D_SM_CONFIG 2011 -#define D_SM_ADMIN_OPTION 2012 -#define D_SM_AO_VALUE 2013 -#define D_SM_L3 2014 -#define D_SM_L3_ADD 2015 -#define D_SM_L3_SW 2016 -#define D_SM_L3_SW_IF 2017 -#define D_SM_L3_SW_TABLE 2018 -#define D_CM_SELECT_SECURE 2019 -#define D_CM_SECURE_MANAGER 2020 -#define D_CM_SECURE_TYPE 2021 -#define D_STRING 2022 -#define D_SM_SELECT_KEYPAIR 2023 -#define D_CM_LOAD_X 2024 -#define D_CM_SECURE_PIN 2025 -#define D_SM_CRL 2026 -#define D_SM_EDIT_CRL 2027 -#define D_SM_AC_LIST 2028 -#define D_SM_AC 2029 -#define D_SM_LOG_FILE 2030 -#define D_SM_READ_LOG_FILE 2031 -#define D_SM_SAVE_LOG 2032 -#define D_TCP 2033 -#define D_TCP_MSG 2034 -#define D_CM_PKCSEULA 2035 -#define D_CM_KAKUSHI 2036 -#define D_CM_TRAFFIC 2037 -#define D_CM_TRAFFIC_RUN 2038 -#define D_CM_TRAFFIC_RESULT 2039 -#define D_SM_LICENSE 2040 -#define D_SM_LICENSE_ADD 2041 -#define D_FREEEDITION 2042 -#define D_FREEINFO 2042 -#define D_EM_LICENSE_ADD 2043 -#define D_EM_LICENSE 2044 -#define D_EM_REMOTE 2045 -#define D_CM_SETTING 2046 -#define D_CM_EASY 2047 -#define D_SM_SETUP 2048 -#define D_SM_SETUP_HUB 2049 -#define D_SM_SETUP_STEP 2050 -#define D_DEFAULT2 2051 -#define D_CPU64_WARNING 2051 -#define D_ONCEMSG 2052 -#define D_CONNECT 2053 -#define D_SM_SIMULATION 2054 -#define D_SM_EDIT_ACCESS1 2055 -#define D_SM_EDIT_ACCESS_V6 2055 -#define D_SM_VLAN 2056 -#define D_SM_MSG 2057 -#define D_NICSTATUS 2058 -#define D_NICINFO 2058 -#define D_SM_IPSEC 2059 -#define D_SM_ETHERIP 2060 -#define D_SM_ETHERIP_ID 2061 -#define D_SM_OPENVPN 2062 -#define D_DDNS 2063 -#define D_SM_DDNS 2063 -#define D_SM_SPECIALLISTENER 2064 -#define D_SM_REDIRECT 2065 -#define D_SW_TEST1 2066 -#define D_DUMMY 2067 -#define D_SW_TEST2 2068 -#define D_SW_DEFAULT 2069 -#define D_SW_WELCOME 2070 -#define D_SW_MODE 2071 -#define D_SW_NOT_ADMIN 2072 -#define D_SW_COMPONENTS 2073 -#define D_SW_EULA 2074 -#define D_SW_WARNING 2075 -#define D_SW_DIR 2076 -#define D_SW_READY 2077 -#define D_SW_PERFORM 2078 -#define D_SW_ERROR 2079 -#define D_SW_ERROR1 2080 -#define D_SW_FINISH 2080 -#define D_SW_WELCOME1 2081 -#define D_SW_UNINST1 2081 -#define D_SW_LANG1 2082 -#define D_SW_EASY1 2083 -#define D_SW_EASY2 2084 -#define D_SW_WEB1 2085 -#define D_SW_EASY4 2086 -#define D_SW_WEB2 2086 -#define D_UPDATE_NOTICE 2087 -#define D_UPDATE_CONFIG 2088 -#define D_SM_VMBRIDGE 2089 -#define D_SM_AZURE 2090 -#define D_SM_PROXY 2091 -#define D_VGC_LIST 2092 -#define D_VGC_PROTOCOL 2093 -#define D_VGS_CONFIG 2094 -#define D_VGS_OPTION 2095 -#define D_VGS_WARNING 2096 -#define D_DEFAULT3 2097 -#define D_NM_PUSH 2097 -#define D_CM_PROXY_HTTP_HEADER 2098 -#define ID_Menu40011 40011 -#define CMD_CONNECT 40020 -#define CMD_STATUS 40021 -#define CMD_DISCONNECT 40022 -#define CMD_NEW 40023 -#define CMD_CLONE 40024 -#define CMD_STARTUP 40025 -#define CMD_NOSTARTUP 40026 -#define CMD_PROPERTY 40028 -#define CMD_EXIT 40029 -#define CMD_SWITCH_SELECT 40031 -#define CMD_SELECT_ALL 40032 -#define CMD_TOOLBAR 40033 -#define CMD_STATUSBAR 40034 -#define CMD_ICON 40035 -#define CMD_DETAIL 40036 -#define CMD_REFRESH 40037 -#define CMD_PASSWORD 40038 -#define CMD_ABOUT 40040 -#define CMD_DELETE_VLAN 40045 -#define CMD_NEW_VLAN 40046 -#define CMD_REINSTALL 40050 -#define CMD_PROPERTY_VLAN 40052 -#define CMD_DISABLE_VLAN 40054 -#define CMD_ENABLE_VLAN 40056 -#define CMD_RENAME 40059 -#define CMD_DELETE 40061 -#define CMD_GRID 40062 -#define CMD_ 40063 -#define CMD_TRUST 40065 -#define CMD_DISCONNECT_ALL 40067 -#define CMD_VOICE_NORMAL 40072 -#define CMD_VOIDE_NONE 40073 -#define CMD_VOICE_ODD 40074 -#define CMD_EXPORT_ACCOUNT 40075 -#define CMD_IMPORT_ACCOUNT 40078 -#define CMD_SHORTCUT 40079 -#define ID_40080 40080 -#define ID_40082 40082 -#define CMD_SECURE_MANAGER 40083 -#define CMD_SECURE_SELECT 40084 -#define CMD_QUIT 40086 -#define CMD_NETIF 40088 -#define CMD_TCPIP 40089 -#define CMD_TRAFFIC 40090 -#define CMD_OPTION 40092 -#define ID__40093 40093 -#define CMD_CM_SETTING 40094 -#define CMD_MMCSS 40095 -#define CMD_TRAYICON 40096 -#define ID__ 40097 -#define CMD_WINNET 40098 -#define ID__40099 40099 -#define CMD_VISTASTYLE 40100 -#define ID__40101 40101 -#define CMD_SHOWPORT 40102 -#define ID__40103 40103 -#define CMD_RECENT 40104 -#define ID__40105 40105 -#define ID__40106 40106 -#define CMD_LANGUAGE 40107 -#define ID_VPNGATE40108 40108 -#define ID__40109 40109 -#define CMD_VGS 40110 - -// Next default values for new objects -// -#ifdef APSTUDIO_INVOKED -#ifndef APSTUDIO_READONLY_SYMBOLS -#define _APS_NO_MFC 1 -#define _APS_NEXT_RESOURCE_VALUE 244 -#define _APS_NEXT_COMMAND_VALUE 40111 -#define _APS_NEXT_CONTROL_VALUE 1521 -#define _APS_NEXT_SYMED_VALUE 102 -#endif -#endif +//{{NO_DEPENDENCIES}} +// Microsoft Visual C++ generated include file. +// Used by PenCore.rc +// +#define IDOK3 2 +#define B_POLICY 3 +#define B_SAVE 3 +#define B_ABOUT 3 +#define B_OFFLINE 3 +#define IDOK2 3 +#define IDCANCEL3 3 +#define B_WEB 3 +#define B_SIMULATION 3 +#define B_RESTORE 3 +#define B_MESSAGE 3 +#define B_PUSH 3 +#define B_HUB_STATUS 4 +#define IDCANCEL2 4 +#define B_SECURE_MANAGER 4 +#define B_REDIRECT 4 +#define B_EULA 4 +#define DLG_SECURE 5 +#define D_SECURE 5 +#define B_CLIENT_CERT 5 +#define B_CREATE 5 +#define B_SELECT_SECURE 5 +#define B_IMPORTANT 5 +#define B_CREATE_LISTENER 6 +#define B_CERT_TOOL 6 +#define B_LEGAL 6 +#define B_DELETE_LISTENER 7 +#define B_LEGAL2 7 +#define B_UPDATE_CONFIG 7 +#define B_START 8 +#define B_LEGAL3 8 +#define B_LANGUAGE 8 +#define B_STOP 9 +#define B_AUTHORS 9 +#define B_EDIT 10 +#define S_STATUSBAR 101 +#define ICO_TEST 103 +#define BMP_TEST 104 +#define ICO_KEY 105 +#define BMP_SECURE 106 +#define BMP_SECURE2 107 +#define AVI_PROGRESS 108 +#define ICO_CERT 109 +#define D_PKCSUTIL 110 +#define D_PASSPHRASE 111 +#define D_DEFAULT 112 +#define D_SPEEDMETER 112 +#define D_PASSWORD 113 +#define ICO_SERVER_ONLINE 113 +#define D_STATUS 114 +#define D_CERT 115 +#define D_CHECKCERT 116 +#define ICO_WARNING 117 +#define D_CONNECTERROR 117 +#define ICO_NULL 118 +#define D_CM_LOGIN 118 +#define D_CM_MAIN 119 +#define ICO_TOWER 119 +#define ICO_VPN 120 +#define D_CONNECTION_STATUS 120 +#define ICO_VPNSERVER 121 +#define D_CM_POLICY 121 +#define D_CM_ACCOUNT 122 +#define ICO_NIC_ONLINE 123 +#define D_CM_PROXY 123 +#define ICO_SETUP 124 +#define D_CM_DETAIL 124 +#define ICO_MACHINE 125 +#define D_CM_NEW_VLAN 125 +#define D_CM_TRUST 126 +#define D_CM_PASSWORD 127 +#define ICO_HUB 128 +#define D_CM_CONFIG 128 +#define ICO_VLAN 129 +#define D_ABOUT 129 +#define ICO_SERVER_OFFLINE 130 +#define M_MAIN 130 +#define D_REMOTE 130 +#define ICO_NIC_OFFLINE 131 +#define D_CM_DESKTOP 131 +#define D_CM_CHANGE_PASSWORD 132 +#define ICO_INFORMATION 133 +#define D_SM_MAIN 133 +#define ICO_STOP 134 +#define D_SM_EDIT_SETTING 134 +#define ICO_SERVER_DELETE 135 +#define D_SM_SERVER 135 +#define ICO_SERVER_ONLINE_EX 136 +#define D_SM_STATUS 136 +#define ICO_SERVER_OFFLINE_EX 137 +#define D_SM_EDIT_HUB 137 +#define ICO_INTERNET 138 +#define D_SM_CREATE_LISTENER 138 +#define ICO_DISPLAY 139 +#define D_SM_SSL 139 +#define D_SM_SAVE_KEY_PAIR 140 +#define BMP_MANAGER_LOGO 141 +#define D_SM_CONNECTION 141 +#define D_SM_FARM 142 +#define ICO_GROUP 143 +#define D_SM_FARM_MEMBER 143 +#define ICO_USER 144 +#define D_SM_CHANGE_PASSWORD 144 +#define ICO_USER_ADMIN 145 +#define D_SM_HUB 145 +#define ICO_HUB_OFFLINE 146 +#define D_SM_USER 146 +#define ICO_FARM 147 +#define D_SM_EDIT_USER 147 +#define D_SM_POLICY 148 +#define D_SM_GROUP 149 +#define ICO_X 150 +#define D_SM_EDIT_GROUP 150 +#define ICO_PROTOCOL 151 +#define D_SM_ACCESS_LIST 151 +#define ICO_PROTOCOL_X 152 +#define D_SM_EDIT_ACCESS 152 +#define ICO_DISCARD 153 +#define D_SM_RADIUS 153 +#define ICO_PASS 154 +#define D_SM_LINK 154 +#define ICO_PROTOCOL_OFFLINE 155 +#define D_SM_LOG 155 +#define ICO_MEMORY 156 +#define D_SM_CA 156 +#define ICO_PKCS12 157 +#define D_SM_SESSION 157 +#define ICO_SERVER_CERT 158 +#define D_SM_MAC 158 +#define D_SM_IP 159 +#define ICO_LINK 160 +#define D_SM_CREATE_CERT 160 +#define ICO_PENGUIN 161 +#define D_NM_LOGIN 161 +#define ICO_LINK2 162 +#define ICO_CASCADE 163 +#define ICO_USER1 164 +#define ICO_USER_DENY 164 +#define ICO_GROUP_DENY 165 +#define ICO_LOG 166 +#define ICO_LOG2 167 +#define ICO_DATETIME 168 +#define ICO_NEW 169 +#define ICO_PASS_DISABLE 170 +#define ICO_DISCARD_DISABLE 171 +#define ICO_CASCADE_ERROR 172 +#define ICO_CASCADE_OFFLINE 173 +#define ICO_PROTOCOL_DHCP 174 +#define ICO_ROUTER 175 +#define BMP_ROUTER_BANNER 176 +#define BMP_ROUTER_LOGO 178 +#define BMP_COINS 179 +#define ICO_BRIDGE 180 +#define BIN_WINPCAP 181 +#define ICO_SWITCH 182 +#define ICO_SWITCH_OFFLINE 183 +#define ICO_SECURE 184 +#define ICO_CERT_X 185 +#define ICO_INTERNET_X 186 +#define ICO_LICENSE 187 +#define ICO_SESSION_BRIDGE 188 +#define BMP_SECURE3 188 +#define ICO_VPN1 189 +#define ICO_SESSION_MONITOR 189 +#define ICO_TRAY1 190 +#define BMP_CLIENT_BANNER 190 +#define ICO_TRAY2 191 +#define BMP_SETUP_2 191 +#define ICO_TRAY3 192 +#define BMP_SETUP_1 192 +#define ICO_TRAY4 193 +#define BMP_TSUKUBA 193 +#define ICO_VPN2 194 +#define ICO_TRAY0 194 +#define IDR_MENU1 194 +#define M_VOICE_BACKUP 194 +#define BMP_ETHERIP 195 +#define BMP_L2TP 197 +#define ICO_IPSEC 201 +#define BMP_IX2015 202 +#define ICO_DDNS 203 +#define ICO_OPENVPN 204 +#define BMP_OPENVPN 205 +#define BMP_SSTP 206 +#define ICO_SPECIALLISTENER 207 +#define BMP_SPECIALLISTENER 208 +#define ICO_INSTALLER 209 +#define BMP_SELOGO49x49 211 +#define ICO_LANGUAGE 215 +#define BMP_SW_LANG_1 216 +#define BMP_SW_LANG_2 217 +#define BMP_SW_LANG_3 218 +#define ICO_LANG_CHINESE 219 +#define ICO_LANG_ENGLISH 220 +#define ICO_LANG_JAPANESE 221 +#define ICO_EASYINSTALLER 222 +#define BMP_VPNSERVER_FIGURE 223 +#define BMP_ABOUTBOX 224 +#define BMP_UPDATE 225 +#define BMP_IBARAKI 226 +#define IDB_BITMAP1 227 +#define BMP_WINPC 227 +#define BMP_VMBRIDGE 228 +#define BMP_AZURE 229 +#define BMP_AZURE_JA 230 +#define ICO_AZURE 231 +#define IDB_BITMAP2 232 +#define BMP_AZURE_CN 232 +#define ICO_ZURUHAM 233 +#define IDI_ICON2 234 +#define ICO_ZURUKKO 234 +#define BMP_VPNGATEBANNER 235 +#define BMP_ZURUKKO 236 +#define BMP_VPNGATEEN 237 +#define BMP_VPNGATEJA 238 +#define ICO_RESEARCH 239 +#define BMP_UNIVTSUKUBA 240 +#define ICO_POLICE 241 +#define ICO_LANG_TRADITIONAL_CHINESE 243 +#define S_TITLE 1007 +#define S_INSERT_SECURE 1008 +#define S_TITLE2 1008 +#define S_STATIC 1008 +#define S_RESEARCH 1008 +#define S_DEVICE_INFO 1009 +#define E_PIN 1010 +#define IDS_STATIC1 1012 +#define S_WARNING 1013 +#define A_PROGRESS 1014 +#define S_MSG_1 1014 +#define S_WARNING2 1014 +#define S_STATUS 1015 +#define S_MSG_2 1015 +#define S_PIN_CODE 1016 +#define S_MSG_3 1016 +#define S_STATUS3 1016 +#define S_SOFTWARE_TITLE 1017 +#define S_STATUS4 1017 +#define B_WRITE 1018 +#define S_STATUS6 1018 +#define B_ERASE 1019 +#define S_STATUS5 1019 +#define S_COPYRIGHT 1020 +#define S_SUFFIX 1020 +#define E_PASSPHRASE 1021 +#define S_STATUS7 1021 +#define S_STATUS8 1022 +#define E_USERNAME 1023 +#define C_TYPE 1024 +#define E_HUBNAME 1024 +#define E_REALNAME 1024 +#define P_PROGRESS 1025 +#define E_NOTE 1025 +#define E_NICNAME 1025 +#define E_GROUP 1026 +#define E_PRIORITY 1026 +#define E_PASSWORD 1027 +#define E_CN 1027 +#define E_SRC_IP_V6 1027 +#define S_COUNTDOWN 1028 +#define E_PASSWORD2 1028 +#define E_SRC_PORT_1 1028 +#define E_O 1028 +#define S_RETRYINFO 1029 +#define E_RADIUS_USERNAME 1029 +#define E_SRC_PORT_2 1029 +#define E_OU 1029 +#define E_SUBJECT 1030 +#define E_DST_PORT_1 1030 +#define E_C 1030 +#define E_ISSUER 1031 +#define E_DST_PORT_2 1031 +#define E_ST 1031 +#define E_EXPIRES 1032 +#define E_L 1032 +#define E_SRC_PORT_3 1032 +#define E_IP_PROTO 1032 +#define L_CERTINFO 1033 +#define E_MD5 1033 +#define E_EXPIRES_TIME 1033 +#define E_EXPIRE 1033 +#define E_SERI 1033 +#define E_DST_MAC 1033 +#define S_PARENT 1034 +#define E_DOMAIN 1034 +#define E_MD5_HASH 1034 +#define E_SRC_MAC 1034 +#define B_PARENT 1035 +#define E_SHA1 1035 +#define E_SHA1_HASH 1035 +#define E_SRC_MAC_MASK 1035 +#define E_DST_MAC_MASK 1036 +#define S_WARNING_ICON 1037 +#define E_SRC_MASK_V6 1037 +#define S_CERT_ICON 1038 +#define E_DST_IP_V6 1038 +#define S_PARENT_BUTTON_STR 1039 +#define E_DST_MASK_V6 1039 +#define E_DETAIL 1040 +#define B_SHOW 1041 +#define S_MSG1 1043 +#define E_ERROR 1044 +#define L_ACCOUNT 1047 +#define L_VLAN 1048 +#define L_STATUS 1048 +#define S_DESCRIPTION 1051 +#define L_POLICY 1052 +#define E_ACCOUNT_NAME 1053 +#define E_HOSTNAME 1054 +#define E_RETRY_NUM 1055 +#define E_SECRET1 1055 +#define E_SECRET2 1056 +#define R_DIRECT_TCP 1057 +#define R_HTTPS 1059 +#define R_SOCKS 1060 +#define R_SOCKS5 1061 +#define S_USERNAME 1062 +#define E_RETRY_SPAN 1065 +#define C_HUBNAME 1066 +#define S_PASSWORD 1067 +#define S_CERT 1068 +#define S_CONTROLLER_PORT 1068 +#define B_REGIST_CLIENT_CERT 1069 +#define S_CERT_INFO 1070 +#define R_RETRY 1071 +#define R_INFINITE 1072 +#define R_USE_ENCRYPT 1072 +#define B_DETAIL 1073 +#define R_USE_COMPRESS 1073 +#define R_CHECK_CERT 1074 +#define R_USE_COMPRESS2 1074 +#define R_DISABLE_UDP 1074 +#define B_CONFIG_L2 1074 +#define B_VIEW_CLIENT_CERT 1075 +#define C_NUM_TCP 1075 +#define B_TRUST 1076 +#define E_INTERVAL 1076 +#define B_PROXY_CONFIG 1077 +#define B_SERVER_CERT 1078 +#define B_VIEW_SERVER_CERT 1079 +#define R_USE_HALF_CONNECTION 1080 +#define C_PORT 1080 +#define S_STATIC13 1080 +#define R_USE_DISCONNECT 1081 +#define S_RETRY_NUM_1 1081 +#define S_RETRY_NUM_2 1082 +#define S_RETRY_SPAN_1 1083 +#define E_DISCONNECT_SPAN 1083 +#define S_RETRY_SPAN_2 1084 +#define R_NO_ROUTING 1084 +#define E_NAME 1085 +#define B_CHANGE_PASSWORD 1085 +#define L_CERT 1086 +#define S_CHANGE_PASSWORD 1086 +#define B_IMPORT 1087 +#define B_PROXY_CONFIG2 1087 +#define B_IE 1087 +#define B_EXPORT 1088 +#define IDC_STATIC1 1088 +#define R_USE_PASSWORD 1089 +#define IDC_STATIC3 1089 +#define B_IMPORT2 1089 +#define B_REGENERATE 1089 +#define B_FACTORY 1089 +#define R_RETRY2 1089 +#define R_REMOTE_ONLY 1090 +#define IDC_STATIC4 1090 +#define B_DELETE 1091 +#define IDC_STATIC2 1091 +#define R_ALLOW_REMOTE_CONFIG 1092 +#define B_REFRESH 1092 +#define IDC_STATIC5 1092 +#define B_DELETE2 1092 +#define B_ETH_VLAN 1092 +#define B_VLAN 1092 +#define R_USE_KEEP_CONNECT 1093 +#define B_CERT 1093 +#define IDC_STATIC6 1093 +#define B_SESSION_IP_TABLE 1093 +#define B_NEW_CERT 1093 +#define B_RENAME 1093 +#define S_HOSTNAME 1094 +#define B_REFRESH2 1094 +#define B_BRIDGE 1094 +#define B_PIN 1094 +#define R_ALPHA 1095 +#define B_SESSION_MAC_TABLE 1095 +#define B_PASSWORD2 1095 +#define B_L3 1095 +#define R_TCP 1096 +#define B_MAC_TABLE 1096 +#define B_IPSEC 1096 +#define S_INFO 1097 +#define B_OPENVPN 1097 +#define S_PORT 1098 +#define B_BRIDGE2 1098 +#define B_DDNS 1098 +#define S_INFO7 1098 +#define E_PORT 1099 +#define B_AZURE 1099 +#define S_INFO8 1099 +#define S_INTERVAL 1100 +#define E_CONTROLLER 1100 +#define B_IP_TABLE 1100 +#define E_PORT2 1100 +#define E_RADIUS_RETRY_INTERVAL 1100 +#define S_INFO6 1100 +#define B_VPNGATE 1100 +#define S_INFO2 1101 +#define S_INTERVAL2 1102 +#define R_LOCAL 1102 +#define S_PROTOCOL 1103 +#define C_HOSTNAME 1103 +#define R_UDP 1104 +#define S_ICON 1104 +#define E_ALPHA_VALUE 1105 +#define S_INFO4 1105 +#define S_ICON2 1105 +#define S_INFO3 1106 +#define E_OLD_PASSWORD 1106 +#define E_NEW_PASSWORD1 1107 +#define S_INFO5 1107 +#define E_NEW_PASSWORD2 1108 +#define L_SETTING 1109 +#define B_NEW_SETTING 1110 +#define B_EDIT_SETTING 1111 +#define R_SERVER_ADMIN 1111 +#define B_DELETE_SETTING 1112 +#define R_NO_SAVE 1112 +#define B_MODE 1112 +#define R_HUB_ADMIN 1113 +#define B_MODE2 1113 +#define B_VGC 1113 +#define S_HUBNAME 1114 +#define E_MAX_SESSION 1115 +#define R_LOCALHOST 1116 +#define L_HUB 1118 +#define L_LISTENER 1120 +#define B_SSL 1121 +#define B_STATUS 1123 +#define E_PASSWORD1 1123 +#define B_INFO 1124 +#define R_LIMIT_MAX_SESSION 1124 +#define B_FARM 1125 +#define S_MAX_SESSION_1 1125 +#define B_INFO2 1125 +#define S_MAX_SESSION_2 1126 +#define B_CONNECTION 1126 +#define R_ONLINE 1127 +#define B_FARM_STATUS 1127 +#define R_OFFLINE 1128 +#define S_BOLD 1129 +#define S_FARM_INFO 1130 +#define S_BOLD2 1130 +#define R_STATIC 1131 +#define R_DYNAMIC 1132 +#define C_CIPHER 1132 +#define S_AO_3 1133 +#define S_ACL 1134 +#define B_VIEW 1136 +#define R_PKCS12 1136 +#define R_USE_PASS 1137 +#define E_PASS1 1138 +#define E_PASS2 1139 +#define R_X509_AND_KEY 1140 +#define S_PASS1 1141 +#define S_PASS2 1142 +#define B_DISCONNECT 1143 +#define R_SECURE 1143 +#define L_LIST 1144 +#define S_CURRENT 1145 +#define L_KEY 1145 +#define R_STANDALONE 1146 +#define R_CONTROLLER 1147 +#define R_MEMBER 1148 +#define S_PORT_2 1151 +#define S_PORT_1 1152 +#define S_IP_1 1153 +#define E_IP 1154 +#define S_SRC_MAC_ALL 1154 +#define S_CHECK_SRC_MAC 1154 +#define S_IP_2 1155 +#define E_SRC_MASK 1155 +#define E_MASK 1155 +#define S_CONTROLLER 1156 +#define E_DST_IP 1156 +#define E_DHCP_START 1156 +#define E_CONTROLLER_PORT 1157 +#define E_DST_MASK 1157 +#define E_DHCP_END 1157 +#define S_PORT_3 1158 +#define E_DHCP_MASK 1158 +#define L_FARM_MEMBER 1159 +#define E_GATEWAY 1159 +#define B_USER 1160 +#define E_DNS 1160 +#define B_GROUP 1161 +#define B_CASCADE 1161 +#define E_DNS2 1161 +#define S_USER 1162 +#define B_USER2 1162 +#define S_GROUP 1163 +#define B_SECURENAT 1163 +#define B_ACCESS 1164 +#define S_LINK 1165 +#define S_RADIUS 1166 +#define L_USER 1167 +#define S_RADIUS2 1167 +#define S_CA 1167 +#define B_PROPERTY 1168 +#define B_RADIUS 1169 +#define B_LINK 1170 +#define S_PASSWORD_2 1170 +#define B_SESSION 1171 +#define S_PASSWORD_3 1171 +#define B_LOG 1172 +#define B_LOAD_CERT 1172 +#define B_RADIUS2 1173 +#define B_VIEW_CERT 1173 +#define B_CA 1173 +#define R_CN 1174 +#define B_SNAT 1174 +#define R_SERIAL 1175 +#define S_SNAT 1175 +#define R_O 1175 +#define R_SET_RADIUS_USERNAME 1176 +#define B_CRL 1176 +#define R_OU 1176 +#define S_RADIUS_2 1177 +#define R_C 1177 +#define B_LOG_FILE 1177 +#define R_POLICY 1178 +#define S_RADIUS_4 1178 +#define R_ST 1178 +#define S_RADIUS_5 1179 +#define R_L 1179 +#define R_EXPIRES 1180 +#define R_SERI 1180 +#define S_RADIUS_7 1180 +#define R_MD5_HASH 1181 +#define S_RADIUS_9 1181 +#define R_SHA1_HASH 1182 +#define L_AUTH 1183 +#define S_RADIUS_8 1183 +#define S_RADIUS_1 1184 +#define S_RADIUS_3 1185 +#define S_POLICY_1 1186 +#define S_PASSWORD_1 1187 +#define S_POLICY_2 1187 +#define S_ROOT_CERT_1 1188 +#define S_ROOT_CERT_2 1189 +#define S_ROOT_CERT_3 1190 +#define S_USER_CERT_1 1191 +#define S_RADIUS_10 1192 +#define S_HINT 1192 +#define E_EXPIRES_DATE 1193 +#define S_POLICY_TITLE 1194 +#define E_POLICY_DESCRIPTION 1195 +#define R_ENABLE 1196 +#define R_DISABLE 1197 +#define R_DEFINE 1198 +#define E_VALUE 1199 +#define S_TANI 1200 +#define S_LIMIT 1201 +#define L_GROUP 1202 +#define E_GROUPNAME 1203 +#define B_ADD 1205 +#define L_ACCESS_LIST 1206 +#define B_DEL_IF 1206 +#define B_ADD_TABLE 1207 +#define B_ADD_V6 1207 +#define R_PASS 1208 +#define B_DEL_TABLE 1208 +#define B_DEL 1208 +#define R_DISCARD 1209 +#define R_DENY 1209 +#define R_SRC_ALL 1210 +#define B_OBTAIN 1210 +#define R_IPV4 1210 +#define R_DST_ALL 1211 +#define R_IPV6 1211 +#define C_PROTOCOL 1212 +#define E_USERNAME1 1213 +#define E_USERNAME2 1214 +#define S_SRC_IP_1 1215 +#define S_SRC_IP_2 1216 +#define S_SRC_IP_3 1217 +#define E_SRC_IP 1218 +#define S_SRC_IP_4 1218 +#define S_IP_DST_1 1219 +#define S_IP_DST_2 1220 +#define S_IP_DST_3 1221 +#define S_TCP_1 1222 +#define S_TCP_2 1223 +#define S_TCP_3 1224 +#define S_TCP_4 1225 +#define S_TCP_5 1226 +#define S_TCP_6 1227 +#define S_TCP_7 1228 +#define B_USER1 1229 +#define S_SRC_MAC 1230 +#define R_USE_RADIUS 1231 +#define R_SRC_MAC_ALL 1231 +#define R_CHECK_SRC_MAC 1231 +#define S_DST_MAC 1232 +#define S_RADIUS3 1233 +#define R_DST_MAC_ALL 1233 +#define R_CHECK_DST_MAC 1233 +#define S_RADIUS_6 1234 +#define S_SRC_MAC_MASK 1234 +#define S_LOG 1235 +#define S_DST_MAC_MASK 1235 +#define S_MAC_NOTE 1236 +#define L_LINK 1237 +#define E_SERIAL 1238 +#define S_VLAN_GROUP 1238 +#define B_SEC 1240 +#define S_SEC 1241 +#define C_SEC_SWITCH 1242 +#define B_PACKET 1243 +#define S_PACKET 1244 +#define C_PACKET_SWITCH 1245 +#define S_PACKET_0 1246 +#define S_PACKET_1 1247 +#define B_PACKET_0_0 1248 +#define B_PACKET_1_0 1249 +#define S_FARM_INFO_1 1249 +#define B_PACKET_0_1 1250 +#define S_FARM_INFO_2 1250 +#define B_PACKET_1_1 1251 +#define L_TABLE 1251 +#define B_PACKET_0_2 1252 +#define R_ROOT_CERT 1252 +#define B_PACKET_1_2 1253 +#define R_SIGNED_CERT 1253 +#define S_PACKET_2 1254 +#define B_LOAD 1254 +#define B_PACKET_2_0 1255 +#define S_LOAD_1 1255 +#define B_PACKET_2_1 1256 +#define S_LOAD_2 1256 +#define B_PACKET_2_2 1257 +#define S_LOAD_3 1257 +#define S_LOAD_4 1258 +#define S_LOAD_5 1259 +#define S_STATIC_S 1259 +#define S_ACCESS 1259 +#define S_LOAD_6 1260 +#define S_VERSION 1260 +#define S_LOAD_7 1261 +#define S_LOGO 1261 +#define S_PACKET_3 1262 +#define S_LOAD_8 1262 +#define S_VERSION2 1262 +#define B_PACKET_3_0 1263 +#define S_LOAD_9 1263 +#define S_BUILD 1263 +#define B_PACKET_3_1 1264 +#define S_LOAD_10 1264 +#define B_PACKET_3_2 1265 +#define S_LOAD_11 1265 +#define B_SETTING 1265 +#define S_PACKET_4 1266 +#define B_CONNECT 1266 +#define S_ACCOUNT_NAME 1266 +#define S_LOAD_12 1266 +#define B_PACKET_4_0 1267 +#define S_ROUTER_LOGO 1267 +#define S_LOAD_13 1267 +#define B_PACKET_4_1 1268 +#define B_OPTION 1268 +#define E_MAC 1268 +#define B_PACKET_4_2 1269 +#define B_NAT 1269 +#define R_USE_NAT 1269 +#define S_PACKET_5 1270 +#define E_MTU 1270 +#define B_PACKET_5_0 1271 +#define B_DHCP 1271 +#define E_TCP 1271 +#define B_PACKET_5_1 1272 +#define E_UDP 1272 +#define B_PACKET_5_2 1273 +#define R_USE_DHCP 1273 +#define S_PACKET_6 1274 +#define R_SAVE_LOG 1274 +#define B_PACKET_6_0 1275 +#define R_HIDE 1275 +#define B_PACKET_6_1 1276 +#define S_PROPERTY 1276 +#define R_HIDE2 1276 +#define B_PACKET_6_2 1277 +#define B_ENABLE 1277 +#define S_PACKET_7 1278 +#define B_DISABLE 1278 +#define B_PACKET_7_0 1279 +#define B_CONFIG 1279 +#define B_CLONE 1279 +#define B_DISABLE2 1279 +#define B_PROXY 1279 +#define B_PACKET_7_1 1280 +#define S_TSUKUBA1 1280 +#define B_LICENSE 1280 +#define B_PACKET_7_2 1281 +#define S_TSUKUBA2 1281 +#define IDC_CHECK1 1285 +#define R_NO_SAVE_PASSWORD 1285 +#define R_PROMISCUOUS 1285 +#define R_NO_ENUM 1285 +#define R_ETHERNET 1285 +#define R_CONTROLLER_ONLY 1285 +#define B_HIDE 1285 +#define R_DISABLE_QOS 1285 +#define R_LOCK 1285 +#define C_REMOTE 1285 +#define C_DONTSHOWAGAIN 1285 +#define R_CHECK_TCP_STATE 1285 +#define C_DELAY 1285 +#define C_USEMSG 1285 +#define R_L2TP_OVER_IPSEC 1285 +#define B_AGREE 1285 +#define R_SHOWCUSTOM 1285 +#define B_RUN 1285 +#define B_DELETE_SENSITIVE 1285 +#define R_LOG 1285 +#define R_DOUBLE 1286 +#define C_SITE 1286 +#define C_JITTER 1286 +#define R_REDIRECT 1286 +#define R_L2TP 1286 +#define E_LIST 1287 +#define C_OTHER 1287 +#define C_LOSS 1287 +#define R_L2TP_RAW 1287 +#define B_EASYMODE 1287 +#define R_ETHERIP 1288 +#define R_BRIDGE 1289 +#define R_TAP 1290 +#define R_MONITOR 1290 +#define E_TAPNAME 1291 +#define S_ETH_1 1292 +#define S_TAP_1 1293 +#define S_TAP_2 1294 +#define S_VHUB_BRIDGE 1295 +#define C_DEVICE 1296 +#define IDC_INFO 1297 +#define E_CONFIG 1298 +#define B_ADMINOPTION 1300 +#define S_AO_1 1301 +#define S_AO_2 1302 +#define S_ACL_3 1303 +#define S_ACL_2 1304 +#define B_ACL 1305 +#define B_ACL2 1306 +#define B_EXTOPTION 1306 +#define S_AO_4 1307 +#define B_MSG 1308 +#define C_NAME 1309 +#define S_ACL_5 1310 +#define L_IF 1311 +#define S_BOLD1 1313 +#define B_ADD_IF 1314 +#define E_NETWORK 1315 +#define E_METRIC 1316 +#define B_BOLD 1317 +#define R_CERT 1319 +#define R_KEY 1320 +#define E_STRING 1320 +#define R_DATA 1321 +#define B_BOLD1 1321 +#define B_BOLD2 1322 +#define R_FROM_FILE 1322 +#define R_FROM_SECURE 1323 +#define B_SELECT 1324 +#define S_FILE 1325 +#define S_PASS3 1326 +#define S_PASS4 1327 +#define E_PIN1 1328 +#define E_PIN2 1329 +#define E_PIN3 1330 +#define R_SINGLE 1331 +#define R_MASKED 1332 +#define S_MASK 1333 +#define S_MODE 1336 +#define B_PASSWORD 1339 +#define R_RECV_DISABLE 1340 +#define B_PASSWORD3 1340 +#define B_SPECIALLISTENER 1340 +#define R_RECV_ENABLE 1341 +#define E_RECV 1342 +#define S_RECV 1343 +#define B_RECV 1344 +#define R_SEND_DISABLE 1345 +#define R_SEND_ENABLE 1346 +#define E_SEND 1347 +#define R_OPTIMIZE 1347 +#define S_SEND 1348 +#define R_MANUAL 1348 +#define B_SEND 1349 +#define R_NO 1349 +#define S_IMAGE 1351 +#define S_IMAGE2 1352 +#define S_INFO_1 1352 +#define S_INFO_2 1353 +#define S_IMAGE3 1353 +#define S_IMAGE_TSUKUBA 1353 +#define S_INFO_3 1354 +#define S_INFO_4 1355 +#define S_PROTOID 1356 +#define S_1 1359 +#define S_18 1360 +#define S_3 1361 +#define R_SERVER 1362 +#define S_19 1362 +#define R_CLIENT 1363 +#define S_20 1363 +#define S_4 1364 +#define S_21 1364 +#define S_5 1365 +#define S_23 1365 +#define C_HOST 1366 +#define S_22 1366 +#define S_6 1367 +#define S_25 1367 +#define S_8 1368 +#define S_9 1369 +#define S_7 1370 +#define R_DOWNLOAD 1371 +#define R_UPLOAD 1372 +#define R_FULL 1373 +#define S_10 1374 +#define S_11 1375 +#define C_NUM 1376 +#define S_12 1377 +#define E_SPAN 1378 +#define S_13 1379 +#define E_EDIT 1379 +#define S_14 1380 +#define IDC_EDIT1 1380 +#define E_WEIGHT 1380 +#define B_KEY1 1380 +#define E_SYSLOG_HOSTNAME 1380 +#define E_TEXT 1380 +#define E_DELAY 1380 +#define E_IPV6 1380 +#define E_SECRET 1380 +#define E_ID 1380 +#define E_DDNS_HOST 1380 +#define E_SAMPLE1 1380 +#define E_CURRENT 1380 +#define E_OWNER 1380 +#define S_15 1381 +#define S_2 1381 +#define E_SYSLOG_PORT 1381 +#define E_JITTER 1381 +#define E_IPV7 1381 +#define E_MASKV6 1381 +#define E_SAMPLE2 1381 +#define E_DDNS_HOST2 1381 +#define E_AZURE_HOST 1381 +#define E_LOSS 1382 +#define S_16 1382 +#define E_URL 1382 +#define E_ABUSE 1382 +#define S_17 1383 +#define E_MSG 1383 +#define S_24 1384 +#define ABOUT 1387 +#define C_SYSLOG 1388 +#define B_KEY2 1389 +#define S_01 1389 +#define B_KEY3 1390 +#define S_02 1390 +#define B_KEY4 1391 +#define R_EASY 1391 +#define B_KEY5 1392 +#define R_NORMAL 1392 +#define B_KEY6 1393 +#define S_PASSWORD1 1393 +#define S_PASSWORD2 1394 +#define S_PASSWORD3 1395 +#define S_STATIC3 1397 +#define S_STATIC4 1398 +#define S_STATIC5 1399 +#define S_STATIC7 1400 +#define S_STATIC66 1401 +#define S_STATIC2 1402 +#define S_STATIC11 1403 +#define S_STATIC1 1404 +#define S_STATIC6 1405 +#define S_STATIC8 1406 +#define S_STATIC9 1407 +#define S_STATIC10 1408 +#define S_STATIC12 1409 +#define S_STATIC19 1410 +#define S_STATIC133 1411 +#define S_REMOTE_1 1413 +#define S_SITE_1 1414 +#define S_SITE_2 1415 +#define C_CENTER 1416 +#define C_EDGE 1417 +#define S_OTHER 1418 +#define S_1_1 1421 +#define S_1_2 1422 +#define S_2_1 1423 +#define S_2_2 1424 +#define S_3_1 1425 +#define S_3_2 1426 +#define IDC_COMBO1 1427 +#define C_BITS 1427 +#define R_NEVER 1427 +#define IDC_BUTTON1 1428 +#define BMP_UT 1428 +#define S_LICENSE 1429 +#define IDC_BUTTON2 1429 +#define S_BETA 1430 +#define IDC_BUTTON3 1430 +#define S_DST_MAC_ALL 1431 +#define S_CHECK_DST_MAC 1431 +#define IDC_BUTTON4 1431 +#define S_ACCESS_DST_ALL 1432 +#define S_ACCESS_SRC_ALL 1433 +#define IDC_RADIO1 1434 +#define R_ESTABLISHED 1434 +#define R_SYSTEM 1434 +#define R_DEFAULT 1434 +#define S_ENABLE 1434 +#define R_2WEEKS 1434 +#define IDC_RADIO2 1435 +#define R_UNESTABLISHED 1435 +#define R_USER 1435 +#define R_CUSTOM 1435 +#define S_DISABLE 1435 +#define R_PERMANENT 1435 +#define R_FOR_SYSTEM 1436 +#define IDC_NETADDRESS1 1437 +#define R_FOR_USER 1437 +#define IDC_PROGRESS1 1438 +#define E_HELP 1440 +#define S_DELAY 1441 +#define S_DELAY2 1442 +#define S_JITTER 1443 +#define S_JITTER2 1444 +#define S_LOSS 1445 +#define S_LOSS2 1446 +#define S_STATIC14 1448 +#define S_STATIC15 1449 +#define S_MSG_4 1450 +#define S_STATUS1 1451 +#define S_STATUS2 1452 +#define P_BAR 1453 +#define L_HUBNAME 1454 +#define S_PSK 1455 +#define S_PSK2 1456 +#define S_WIN8 1457 +#define R_OPENVPN 1458 +#define S_UDP 1459 +#define B_APPLY 1460 +#define S_TOOL 1461 +#define S_TOOL2 1462 +#define R_SSTP 1463 +#define B_CONFIG_L3 1464 +#define S_SSTP 1465 +#define E_HOST 1466 +#define E_IPV4 1467 +#define E_NEWHOST 1468 +#define B_NSLOOKUP 1469 +#define E_KEY 1469 +#define B_HINT 1470 +#define S_DDNS 1470 +#define R_OVER_ICMP 1471 +#define S_AZURE 1471 +#define B_HINT2 1471 +#define R_OVER_ICMP2 1472 +#define R_OVER_DNS 1472 +#define B_WIZ_NEXT 1472 +#define B_WIZ_NEXT2 1473 +#define B_WIZ_PREV 1473 +#define S_ACK 1473 +#define S_WELCOME 1474 +#define S_ACK2 1475 +#define S_WELCOME2 1475 +#define S_WELCOME3 1476 +#define E_DIR 1479 +#define B_BROWSE 1480 +#define S_DEST 1481 +#define B_BROWSE_OUT 1481 +#define S_UAC 1482 +#define E_SETTING 1483 +#define E_OUT 1484 +#define B_BROWSE_SETTING 1485 +#define S_INFO1 1486 +#define S_PRODUCT 1487 +#define S_INFO9 1487 +#define S_PRODUCT_STR 1488 +#define S_CURRENT_STR 1490 +#define S_LATEST 1491 +#define S_LATEST_STR 1492 +#define S_BMP_EN 1494 +#define S_BMP_JA 1495 +#define B_CHANGE 1496 +#define S_HOSTNAME_BORDER 1497 +#define S_HOSTNAME_INFO 1498 +#define S_BMP_CN 1499 +#define S_REFRESH 1499 +#define S_VLAN 1500 +#define C_VLAN 1502 +#define S_VPNGATEJA 1504 +#define S_ICO_VPNGATE 1505 +#define S_VPNGATEJA2 1505 +#define S_VPNGATEEN 1505 +#define S1 1506 +#define S2 1507 +#define S3 1508 +#define S4 1509 +#define S5 1510 +#define S_VGS1 1511 +#define S_VGS2 1512 +#define B_VGS 1513 +#define S_VGS3 1514 +#define S_TSUKUBA 1515 +#define R_DISABLE_NATT 1516 +#define S_SMARTCARD_ICON 1517 +#define L_VALUES_LIST 1519 +#define B_HTTP_HEADER 1520 +#define B_NEW 1521 +#define B_CLEAR 1522 +#define B_ONLINE 1655 +#define D_NM_CONNECT 1998 +#define D_NM_MAIN 1999 +#define D_NM_OPTION 2000 +#define D_NM_NAT 2001 +#define D_NM_DHCP 2002 +#define D_NM_CHANGE_PASSWORD 2003 +#define D_SM_SNAT 2004 +#define D_SM_BRIDGE 2005 +#define D_WIN9X_REBOOT 2006 +#define D_DEFAULT1 2007 +#define D_EM_MAIN 2008 +#define D_EM_ADD 2009 +#define D_EM_PASSWORD 2010 +#define D_SM_CONFIG 2011 +#define D_SM_ADMIN_OPTION 2012 +#define D_SM_AO_VALUE 2013 +#define D_SM_L3 2014 +#define D_SM_L3_ADD 2015 +#define D_SM_L3_SW 2016 +#define D_SM_L3_SW_IF 2017 +#define D_SM_L3_SW_TABLE 2018 +#define D_CM_SELECT_SECURE 2019 +#define D_CM_SECURE_MANAGER 2020 +#define D_CM_SECURE_TYPE 2021 +#define D_STRING 2022 +#define D_SM_SELECT_KEYPAIR 2023 +#define D_CM_LOAD_X 2024 +#define D_CM_SECURE_PIN 2025 +#define D_SM_CRL 2026 +#define D_SM_EDIT_CRL 2027 +#define D_SM_AC_LIST 2028 +#define D_SM_AC 2029 +#define D_SM_LOG_FILE 2030 +#define D_SM_READ_LOG_FILE 2031 +#define D_SM_SAVE_LOG 2032 +#define D_TCP 2033 +#define D_TCP_MSG 2034 +#define D_CM_PKCSEULA 2035 +#define D_CM_KAKUSHI 2036 +#define D_CM_TRAFFIC 2037 +#define D_CM_TRAFFIC_RUN 2038 +#define D_CM_TRAFFIC_RESULT 2039 +#define D_SM_LICENSE 2040 +#define D_SM_LICENSE_ADD 2041 +#define D_FREEEDITION 2042 +#define D_FREEINFO 2042 +#define D_EM_LICENSE_ADD 2043 +#define D_EM_LICENSE 2044 +#define D_EM_REMOTE 2045 +#define D_CM_SETTING 2046 +#define D_CM_EASY 2047 +#define D_SM_SETUP 2048 +#define D_SM_SETUP_HUB 2049 +#define D_SM_SETUP_STEP 2050 +#define D_DEFAULT2 2051 +#define D_CPU64_WARNING 2051 +#define D_ONCEMSG 2052 +#define D_CONNECT 2053 +#define D_SM_SIMULATION 2054 +#define D_SM_EDIT_ACCESS1 2055 +#define D_SM_EDIT_ACCESS_V6 2055 +#define D_SM_VLAN 2056 +#define D_SM_MSG 2057 +#define D_NICSTATUS 2058 +#define D_NICINFO 2058 +#define D_SM_IPSEC 2059 +#define D_SM_ETHERIP 2060 +#define D_SM_ETHERIP_ID 2061 +#define D_SM_OPENVPN 2062 +#define D_DDNS 2063 +#define D_SM_DDNS 2063 +#define D_SM_SPECIALLISTENER 2064 +#define D_SM_REDIRECT 2065 +#define D_SW_TEST1 2066 +#define D_DUMMY 2067 +#define D_SW_TEST2 2068 +#define D_SW_DEFAULT 2069 +#define D_SW_WELCOME 2070 +#define D_SW_MODE 2071 +#define D_SW_NOT_ADMIN 2072 +#define D_SW_COMPONENTS 2073 +#define D_SW_EULA 2074 +#define D_SW_WARNING 2075 +#define D_SW_DIR 2076 +#define D_SW_READY 2077 +#define D_SW_PERFORM 2078 +#define D_SW_ERROR 2079 +#define D_SW_ERROR1 2080 +#define D_SW_FINISH 2080 +#define D_SW_WELCOME1 2081 +#define D_SW_UNINST1 2081 +#define D_SW_LANG1 2082 +#define D_SW_EASY1 2083 +#define D_SW_EASY2 2084 +#define D_SW_WEB1 2085 +#define D_SW_EASY4 2086 +#define D_SW_WEB2 2086 +#define D_UPDATE_NOTICE 2087 +#define D_UPDATE_CONFIG 2088 +#define D_SM_VMBRIDGE 2089 +#define D_SM_AZURE 2090 +#define D_SM_PROXY 2091 +#define D_VGC_LIST 2092 +#define D_VGC_PROTOCOL 2093 +#define D_VGS_CONFIG 2094 +#define D_VGS_OPTION 2095 +#define D_VGS_WARNING 2096 +#define D_DEFAULT3 2097 +#define D_NM_PUSH 2097 +#define D_CM_PROXY_HTTP_HEADER 2098 +#define ID_Menu40011 40011 +#define CMD_CONNECT 40020 +#define CMD_STATUS 40021 +#define CMD_DISCONNECT 40022 +#define CMD_NEW 40023 +#define CMD_CLONE 40024 +#define CMD_STARTUP 40025 +#define CMD_NOSTARTUP 40026 +#define CMD_PROPERTY 40028 +#define CMD_EXIT 40029 +#define CMD_SWITCH_SELECT 40031 +#define CMD_SELECT_ALL 40032 +#define CMD_TOOLBAR 40033 +#define CMD_STATUSBAR 40034 +#define CMD_ICON 40035 +#define CMD_DETAIL 40036 +#define CMD_REFRESH 40037 +#define CMD_PASSWORD 40038 +#define CMD_ABOUT 40040 +#define CMD_DELETE_VLAN 40045 +#define CMD_NEW_VLAN 40046 +#define CMD_REINSTALL 40050 +#define CMD_PROPERTY_VLAN 40052 +#define CMD_DISABLE_VLAN 40054 +#define CMD_ENABLE_VLAN 40056 +#define CMD_RENAME 40059 +#define CMD_DELETE 40061 +#define CMD_GRID 40062 +#define CMD_ 40063 +#define CMD_TRUST 40065 +#define CMD_DISCONNECT_ALL 40067 +#define CMD_VOICE_NORMAL 40072 +#define CMD_VOIDE_NONE 40073 +#define CMD_VOICE_ODD 40074 +#define CMD_EXPORT_ACCOUNT 40075 +#define CMD_IMPORT_ACCOUNT 40078 +#define CMD_SHORTCUT 40079 +#define ID_40080 40080 +#define ID_40082 40082 +#define CMD_SECURE_MANAGER 40083 +#define CMD_SECURE_SELECT 40084 +#define CMD_QUIT 40086 +#define CMD_NETIF 40088 +#define CMD_TCPIP 40089 +#define CMD_TRAFFIC 40090 +#define CMD_OPTION 40092 +#define ID__40093 40093 +#define CMD_CM_SETTING 40094 +#define CMD_MMCSS 40095 +#define CMD_TRAYICON 40096 +#define ID__ 40097 +#define CMD_WINNET 40098 +#define ID__40099 40099 +#define CMD_VISTASTYLE 40100 +#define ID__40101 40101 +#define CMD_SHOWPORT 40102 +#define ID__40103 40103 +#define CMD_RECENT 40104 +#define ID__40105 40105 +#define ID__40106 40106 +#define CMD_LANGUAGE 40107 +#define ID_VPNGATE40108 40108 +#define ID__40109 40109 +#define CMD_VGS 40110 + +// Next default values for new objects +// +#ifdef APSTUDIO_INVOKED +#ifndef APSTUDIO_READONLY_SYMBOLS +#define _APS_NO_MFC 1 +#define _APS_NEXT_RESOURCE_VALUE 244 +#define _APS_NEXT_COMMAND_VALUE 40111 +#define _APS_NEXT_CONTROL_VALUE 1521 +#define _APS_NEXT_SYMED_VALUE 102 +#endif +#endif diff --git a/src/SeLow/SeLow.c b/src/SeLow/SeLow.c index f90a1b07..cd57d7c6 100644 --- a/src/SeLow/SeLow.c +++ b/src/SeLow/SeLow.c @@ -1,2111 +1,2111 @@ -// SoftEther VPN Source Code - Developer Edition Master Branch -// SeLow: SoftEther Lightweight Network Protocol - - -// SeLow.c -// SeLow Device Driver - -#include - -#define SELOW_DEVICE_DRIVER - -#include "SeLow.h" - -static SL_CTX sl_ctx = {0}; -static SL_CTX *sl = &sl_ctx; - -// Win32 driver entry point -NDIS_STATUS DriverEntry(DRIVER_OBJECT *driver_object, UNICODE_STRING *registry_path) -{ - NDIS_PROTOCOL_DRIVER_CHARACTERISTICS t; - NDIS_STATUS ret = NDIS_STATUS_FAILURE; - SL_UNICODE *protocol_name = NULL; - NDIS_HANDLE protocol_handle = NULL; - SL_CTX *sl_ctx = NULL; - DEVICE_OBJECT *device_object = NULL; - - SlZero(sl, sizeof(SL_CTX)); - - // Register the NDIS protocol - protocol_name = SlNewUnicode(SL_PROTOCOL_NAME); - if (protocol_name == NULL) - { - goto LABEL_CLEANUP; - } - - SlZero(&t, sizeof(t)); - t.Header.Type = NDIS_OBJECT_TYPE_PROTOCOL_DRIVER_CHARACTERISTICS; - t.Header.Revision = NDIS_PROTOCOL_DRIVER_CHARACTERISTICS_REVISION_2; - t.Header.Size = NDIS_SIZEOF_PROTOCOL_DRIVER_CHARACTERISTICS_REVISION_2; - t.MajorNdisVersion = 6; - t.MinorNdisVersion = 20; - t.Name = protocol_name->String; - - t.BindAdapterHandlerEx = SlNdisBindAdapterExProc; - t.UnbindAdapterHandlerEx = SlNdisUnbindAdapterExProc; - t.OpenAdapterCompleteHandlerEx = SlNdisOpenAdapterCompleteExProc; - t.CloseAdapterCompleteHandlerEx = SlNdisCloseAdapterCompleteExProc; - t.NetPnPEventHandler = SlNdisNetPnPEventProc; - t.UninstallHandler = SlNdisUninstallProc; - t.OidRequestCompleteHandler = SlNdisOidRequestCompleteProc; - t.StatusHandlerEx = SlNdisStatusExProc; - t.ReceiveNetBufferListsHandler = SlNdisReceiveNetBufferListsProc; - t.SendNetBufferListsCompleteHandler = SlNdisSendNetBufferListsCompleteProc; - - // Create an adapters list - sl->DriverObject = driver_object; - sl->AdapterList = SlNewList(); - - ret = NdisRegisterProtocolDriver(NULL, &t, &protocol_handle); - - if (NG(ret)) - { - protocol_handle = NULL; - goto LABEL_CLEANUP; - } - - SlZero(driver_object->MajorFunction, sizeof(driver_object->MajorFunction)); - driver_object->MajorFunction[IRP_MJ_CREATE] = SlDeviceOpenProc; - driver_object->MajorFunction[IRP_MJ_CLOSE] = SlDeviceCloseProc; - driver_object->MajorFunction[IRP_MJ_READ] = SlDeviceReadProc; - driver_object->MajorFunction[IRP_MJ_WRITE] = SlDeviceWriteProc; - driver_object->MajorFunction[IRP_MJ_DEVICE_CONTROL] = SlDeviceIoControlProc; - driver_object->DriverUnload = SlUnloadProc; - - // Initialize the SL context - sl->ProtocolHandle = protocol_handle; - - // Create a basic device - sl->BasicDevice = SlNewDevice(SL_BASIC_DEVICE_NAME, SL_BASIC_DEVICE_NAME_SYMBOLIC); - if (sl->BasicDevice == NULL) - { - ret = NDIS_STATUS_FAILURE; - goto LABEL_CLEANUP; - } - sl->BasicDevice->IsBasicDevice = true; - -LABEL_CLEANUP: - - SlFreeUnicode(protocol_name); - - if (NG(ret)) - { - SlUnloadProc(driver_object); - } - - return ret; -} - -// Unloading procedure of the device driver -void SlUnloadProc(DRIVER_OBJECT *driver_object) -{ - // Release the protocol - if (sl->ProtocolHandle != NULL) - { - NdisDeregisterProtocolDriver(sl->ProtocolHandle); - sl->ProtocolHandle = NULL; - } - - // Release the basic device - SlFreeDevice(sl->BasicDevice); - - // Release the adapter list - SlFreeList(sl->AdapterList); - - // Initialize the SL context - SlZero(sl, sizeof(SL_CTX)); -} - -// Delete a device -void SlFreeDevice(SL_DEVICE *dev) -{ - NTSTATUS r; - // Validate arguments - if (dev == NULL) - { - return; - } - - r = IoDeleteSymbolicLink(&dev->SymbolicLinkName->String); - if (NG(r)) - { - // May fail due to a bug in Windows Kernel - } - - IoDeleteDevice(dev->DeviceObject); - - SlFreeUnicode(dev->DeviceName); - SlFreeUnicode(dev->SymbolicLinkName); - - SlFreeLock(dev->OpenCloseLock); - - SlFree(dev); -} - -// Create a new device -SL_DEVICE *SlNewDevice(char *device_name, char *symbolic_link_name) -{ - SL_UNICODE *u_device_name = SlNewUnicode(device_name); - SL_UNICODE *u_sym_name = SlNewUnicode(symbolic_link_name); - - SL_DEVICE *ret = SlNewDeviceUnicode(u_device_name, u_sym_name); - - if (ret == NULL) - { - SlFreeUnicode(u_device_name); - SlFreeUnicode(u_sym_name); - } - - return ret; -} -SL_DEVICE *SlNewDeviceUnicode(SL_UNICODE *u_device_name, SL_UNICODE *u_sym_name) -{ - SL_DEVICE *ret = NULL; - DEVICE_OBJECT *dev_obj = NULL; - NTSTATUS r; - SL_UNICODE *sddl; - - sddl = SlNewUnicode("D:P(A;;GA;;;SY)(A;;GA;;;BA)"); - - /*r = IoCreateDevice(sl->DriverObject, sizeof(SL_DEVICE *), - &u_device_name->String, FILE_DEVICE_TRANSPORT, 0, false, &dev_obj);*/ - - r = IoCreateDeviceSecure(sl->DriverObject, sizeof(SL_DEVICE *), - &u_device_name->String, FILE_DEVICE_TRANSPORT, 0, false, SlGetUnicode(sddl), - NULL, &dev_obj); - - SlFreeUnicode(sddl); - - if (NG(r)) - { - dev_obj = NULL; - goto LABEL_CLEANUP; - } - - r = IoCreateSymbolicLink(&u_sym_name->String, &u_device_name->String); - if (NG(r)) - { - // May fail due to a bug in Windows Kernel - } - - ret = SlZeroMalloc(sizeof(SL_DEVICE)); - if (ret == NULL) - { - goto LABEL_CLEANUP; - } - - ret->DeviceObject = dev_obj; - ret->DeviceName = u_device_name; - ret->SymbolicLinkName = u_sym_name; - *((SL_DEVICE **)dev_obj->DeviceExtension) = ret; - - dev_obj->Flags &= ~DO_DEVICE_INITIALIZING; - - ret->OpenCloseLock = SlNewLock(); - -LABEL_CLEANUP: - if (ret == NULL) - { - if (dev_obj != NULL) - { - IoDeleteDevice(dev_obj); - } - } - - return ret; -} - -// Device is opened -NTSTATUS SlDeviceOpenProc(DEVICE_OBJECT *device_object, IRP *irp) -{ - SL_DEVICE *dev = *((SL_DEVICE **)device_object->DeviceExtension); - NTSTATUS ret = STATUS_UNSUCCESSFUL; - IO_STACK_LOCATION *irp_stack = IoGetCurrentIrpStackLocation(irp); - - if (dev->IsBasicDevice) - { - // Basic device - ret = STATUS_SUCCESS; - } - else - { - bool set_promisc = false; - volatile UINT *num_pending_oid_requests = NULL; - UINT64 v; - char event_name[SL_EVENT_NAME_SIZE]; - char event_name_win32[SL_EVENT_NAME_SIZE]; - SL_EVENT *event_object = NULL; - LARGE_INTEGER count; - LARGE_INTEGER freq; - - count = KeQueryPerformanceCounter(&freq); - - InterlockedIncrement(&sl->IntCounter1); - - // Create a new event object - v = (UINT64)device_object + (UINT64)(++sl->IntCounter1) + *((UINT64 *)(&count)); - sprintf(event_name, SL_EVENT_NAME, (UINT)v, (UINT)(v >> 32) + sl->IntCounter1); - sprintf(event_name_win32, SL_EVENT_NAME_WIN32, (UINT)v, (UINT)(v >> 32) + sl->IntCounter1); - event_object = SlNewEvent(event_name); - - SlLock(dev->OpenCloseLock); - { - // Add to the opened file list - SlLockList(dev->FileList); - { - if (dev->Halting == false && dev->Adapter != NULL && dev->Adapter->Ready && dev->Adapter->Halt == false) - { - // Adapter device - SL_FILE *f = SlZeroMalloc(sizeof(SL_FILE)); - NET_BUFFER_LIST_POOL_PARAMETERS p; - - f->Device = dev; - f->Adapter = dev->Adapter; - f->FileObject = irp_stack->FileObject; - - irp_stack->FileObject->FsContext = f; - - SlAdd(dev->FileList, f); - - ret = STATUS_SUCCESS; - set_promisc = true; - - // Event - f->Event = event_object; - event_object = NULL; - strcpy(f->EventNameWin32, event_name_win32); - - // Create a lock - f->RecvLock = SlNewLock(); - - // Create a NET_BUFFER_LIST pool - SlZero(&p, sizeof(p)); - p.Header.Type = NDIS_OBJECT_TYPE_DEFAULT; - p.Header.Revision = NET_BUFFER_LIST_POOL_PARAMETERS_REVISION_1; - p.Header.Size = NDIS_SIZEOF_NET_BUFFER_LIST_POOL_PARAMETERS_REVISION_1; - p.ProtocolId = NDIS_PROTOCOL_ID_DEFAULT; - p.fAllocateNetBuffer = true; - p.ContextSize = 32 + sizeof(UINT32) * 12; - p.DataSize = SL_MAX_PACKET_SIZE; - p.PoolTag = 'SETH'; - - f->NetBufferListPool = NdisAllocateNetBufferListPool(NULL, &p); - - num_pending_oid_requests = &dev->Adapter->NumPendingOidRequests; - } - } - SlUnlockList(dev->FileList); - } - SlUnlock(dev->OpenCloseLock); - - if (event_object != NULL) - { - SlFreeEvent(event_object); - } - - if (set_promisc) - { - // Enable promiscuous mode - UINT filter = NDIS_PACKET_TYPE_PROMISCUOUS; - SlSendOidRequest(dev->Adapter, true, OID_GEN_CURRENT_PACKET_FILTER, &filter, sizeof(filter)); - - // Wait until the number of OID requests being processed becomes 0 - while ((*num_pending_oid_requests) != 0) - { - SlSleep(50); - } - } - } - - irp->IoStatus.Status = ret; - IoCompleteRequest(irp, IO_NO_INCREMENT); - - return ret; -} - -// Send an OID request to the device -void SlSendOidRequest(SL_ADAPTER *a, bool set, NDIS_OID oid, void *data, UINT size) -{ - NDIS_OID_REQUEST *t; - NDIS_STATUS ret; - // Validate arguments - if (a == NULL || data == NULL || size == 0) - { - return; - } - - if (a->Halt == false) - { - bool ok = false; - - t = SlZeroMalloc(sizeof(NDIS_OID_REQUEST)); - - t->Header.Type = NDIS_OBJECT_TYPE_OID_REQUEST; - t->Header.Revision = NDIS_OID_REQUEST_REVISION_1; - t->Header.Size = NDIS_SIZEOF_OID_REQUEST_REVISION_1; - - if (set == false) - { - t->RequestType = NdisRequestQueryInformation; - t->DATA.QUERY_INFORMATION.Oid = oid; - t->DATA.QUERY_INFORMATION.InformationBuffer = data; - t->DATA.QUERY_INFORMATION.InformationBufferLength = size; - } - else - { - t->RequestType = NdisRequestSetInformation; - t->DATA.SET_INFORMATION.Oid = oid; - t->DATA.SET_INFORMATION.InformationBuffer = SlClone(data, size); - t->DATA.SET_INFORMATION.InformationBufferLength = size; - } - - SlLock(a->Lock); - { - if (a->AdapterHandle != NULL && a->Halt == false) - { - InterlockedIncrement(&a->NumPendingOidRequests); - ok = true; - } - } - SlUnlock(a->Lock); - - if (ok) - { - ret = NdisOidRequest(a->AdapterHandle, t); - - if (ret != NDIS_STATUS_PENDING) - { - InterlockedDecrement(&a->NumPendingOidRequests); - if (set) - { - SlFree(t->DATA.SET_INFORMATION.InformationBuffer); - } - SlFree(t); - } - } - else - { - if (set) - { - SlFree(t->DATA.SET_INFORMATION.InformationBuffer); - } - SlFree(t); - } - } -} - -// Device is closed -NTSTATUS SlDeviceCloseProc(DEVICE_OBJECT *device_object, IRP *irp) -{ - SL_DEVICE *dev = *((SL_DEVICE **)device_object->DeviceExtension); - NTSTATUS ret = STATUS_UNSUCCESSFUL; - IO_STACK_LOCATION *irp_stack = IoGetCurrentIrpStackLocation(irp); - - if (dev->IsBasicDevice) - { - // Basic device - ret = STATUS_SUCCESS; - } - else - { - // Adapter device - SL_FILE *f = irp_stack->FileObject->FsContext; - - if (f != NULL) - { - bool clear_filter = false; - - // Wait until the number of packet being sent becomes the zero - while (true) - { - if (f->NumSendingPackets == 0) - { - break; - } - - SlSleep(50); - } - - SlLock(dev->OpenCloseLock); - { - // Delete the file from the list - SlLockList(dev->FileList); - { - SlDelete(dev->FileList, f); - - if (SL_LIST_NUM(dev->FileList) == 0) - { - // Clear the filter when all files are closed - clear_filter = true; - } - } - SlUnlockList(dev->FileList); - - if (dev->Adapter->Halt) - { - clear_filter = false; - } - - if (clear_filter) - { - InterlockedIncrement(&dev->Adapter->NumPendingOidRequests); - } - } - SlUnlock(dev->OpenCloseLock); - - if (clear_filter) - { - // Clear the filter when all files are closed - UINT filter = 0; - SlSendOidRequest(dev->Adapter, true, OID_GEN_CURRENT_PACKET_FILTER, &filter, sizeof(filter)); - InterlockedDecrement(&dev->Adapter->NumPendingOidRequests); - } - - // Release the event - SlFreeEvent(f->Event); - - // Release the receive queue - if (true) - { - SL_PACKET *p = f->RecvPacketHead; - - while (p != NULL) - { - SL_PACKET *p_next = p->Next; - - SlFree(p); - - p = p_next; - } - } - - // Release the NET_BUFFER_LIST pool - NdisFreeNetBufferListPool(f->NetBufferListPool); - - // Release the lock - SlFreeLock(f->RecvLock); - - SlFree(f); - - ret = STATUS_SUCCESS; - } - } - - irp->IoStatus.Status = ret; - IoCompleteRequest(irp, IO_NO_INCREMENT); - - return ret; -} - -// Read procedure of the device -NTSTATUS SlDeviceReadProc(DEVICE_OBJECT *device_object, IRP *irp) -{ - SL_DEVICE *dev = *((SL_DEVICE **)device_object->DeviceExtension); - NTSTATUS ret = STATUS_UNSUCCESSFUL; - UINT ret_size = 0; - IO_STACK_LOCATION *irp_stack = IoGetCurrentIrpStackLocation(irp); - - if (dev->IsBasicDevice) - { - // Return the adapter list in the case of basic device - if (irp_stack->Parameters.Read.Length >= sizeof(SL_ADAPTER_INFO_LIST)) - { - SL_ADAPTER_INFO_LIST *dst = irp->UserBuffer; - - if (dst != NULL) - { - // Address check - bool check_ok = true; - __try - { - ProbeForWrite(irp->UserBuffer, sizeof(SL_ADAPTER_INFO_LIST), 1); - } - __except (EXCEPTION_EXECUTE_HANDLER) - { - check_ok = false; - } - - if (check_ok) - { - MDL *mdl; - - mdl = IoAllocateMdl(dst, irp_stack->Parameters.Read.Length, false, false, NULL); - if (mdl != NULL) - { - MmProbeAndLockPages(mdl, KernelMode, IoWriteAccess); - } - - SlZero(dst, sizeof(SL_ADAPTER_INFO_LIST)); - - dst->Signature = SL_SIGNATURE; - dst->SeLowVersion = SL_VER; - dst->EnumCompleted = sl->IsEnumCompleted ? 8 : 1; - - SlLockList(sl->AdapterList); - { - UINT i; - - dst->NumAdapters = MIN(SL_LIST_NUM(sl->AdapterList), SL_MAX_ADAPTER_INFO_LIST_ENTRY); - - for (i = 0;i < dst->NumAdapters;i++) - { - SL_ADAPTER *a = SL_LIST_DATA(sl->AdapterList, i); - SL_ADAPTER_INFO *d = &dst->Adapters[i]; - - d->MtuSize = a->MtuSize; - SlCopy(d->MacAddress, a->MacAddress, 6); - SlCopy(d->AdapterId, a->AdapterId, sizeof(a->AdapterId)); - strcpy(d->FriendlyName, a->FriendlyName); - d->SupportsVLanHw = a->SupportVLan; - } - } - SlUnlockList(sl->AdapterList); - - ret_size = sizeof(SL_ADAPTER_INFO); - ret = STATUS_SUCCESS; - - if (mdl != NULL) - { - MmUnlockPages(mdl); - IoFreeMdl(mdl); - } - } - } - } - } - else - { - // Adapter device - SL_FILE *f = irp_stack->FileObject->FsContext; - - if (irp_stack->Parameters.Read.Length == SL_EXCHANGE_BUFFER_SIZE) - { - UCHAR *buf = irp->UserBuffer; - - if (dev->Halting || f->Adapter->Halt || buf == NULL) - { - // Halting - } - else - { - // Address check - bool check_ok = true; - __try - { - ProbeForWrite(irp->UserBuffer, SL_EXCHANGE_BUFFER_SIZE, 1); - } - __except (EXCEPTION_EXECUTE_HANDLER) - { - check_ok = false; - } - - if (check_ok) - { - UINT num = 0; - bool left = true; - MDL *mdl; - - mdl = IoAllocateMdl(buf, SL_EXCHANGE_BUFFER_SIZE, false, false, NULL); - if (mdl != NULL) - { - MmProbeAndLockPages(mdl, KernelMode, IoWriteAccess); - } - - // Lock the receive queue - SlLock(f->RecvLock); - { - while (true) - { - SL_PACKET *q; - if (num >= SL_MAX_PACKET_EXCHANGE) - { - if (f->RecvPacketHead == NULL) - { - left = false; - } - break; - } - q = f->RecvPacketHead; - if (q != NULL) - { - f->RecvPacketHead = f->RecvPacketHead->Next; - q->Next = NULL; - f->NumRecvPackets--; - - if (f->RecvPacketHead == NULL) - { - f->RecvPacketTail = NULL; - } - } - else - { - left = false; - break; - } - SL_SIZE_OF_PACKET(buf, num) = q->Size; - SlCopy(SL_ADDR_OF_PACKET(buf, num), q->Data, q->Size); - num++; - SlFree(q); - } - } - SlUnlock(f->RecvLock); - - if (mdl != NULL) - { - MmUnlockPages(mdl); - IoFreeMdl(mdl); - } - - SL_NUM_PACKET(buf) = num; - SL_LEFT_FLAG(buf) = left; - - if (left == false) - { - SlReset(f->Event); - } - else - { - SlSet(f->Event); - } - - ret = STATUS_SUCCESS; - ret_size = SL_EXCHANGE_BUFFER_SIZE; - } - } - } - } - - irp->IoStatus.Status = ret; - irp->IoStatus.Information = ret_size; - IoCompleteRequest(irp, IO_NO_INCREMENT); - - return ret; -} - -// Write procedure of the device -NTSTATUS SlDeviceWriteProc(DEVICE_OBJECT *device_object, IRP *irp) -{ - SL_DEVICE *dev = *((SL_DEVICE **)device_object->DeviceExtension); - NTSTATUS ret = STATUS_UNSUCCESSFUL; - IO_STACK_LOCATION *irp_stack = IoGetCurrentIrpStackLocation(irp); - UINT ret_size = 0; - - if (dev->IsBasicDevice == false) - { - // Adapter device - SL_FILE *f = irp_stack->FileObject->FsContext; - - if (irp_stack->Parameters.Write.Length == SL_EXCHANGE_BUFFER_SIZE) - { - UCHAR *buf = irp->UserBuffer; - - if (dev->Halting || dev->Adapter->Halt || buf == NULL) - { - // Halting - } - else - { - // Address check - bool check_ok = true; - __try - { - ProbeForRead(irp->UserBuffer, SL_EXCHANGE_BUFFER_SIZE, 1); - } - __except (EXCEPTION_EXECUTE_HANDLER) - { - check_ok = false; - } - - if (check_ok) - { - // Write the packet - MDL *mdl; - UINT num = SL_NUM_PACKET(buf); - - - mdl = IoAllocateMdl(buf, SL_EXCHANGE_BUFFER_SIZE, false, false, NULL); - if (mdl != NULL) - { - MmProbeAndLockPages(mdl, KernelMode, IoReadAccess); - } - - ret = true; - ret_size = SL_EXCHANGE_BUFFER_SIZE; - - if (num >= 1 && num <= SL_MAX_PACKET_EXCHANGE) - { - UINT i, j; - NET_BUFFER_LIST *nbl_head = NULL; - NET_BUFFER_LIST *nbl_tail = NULL; - UINT num_packets = 0; - NDIS_HANDLE adapter_handle = NULL; - - SlLock(f->Adapter->Lock); - - if (f->Adapter->NumPendingSendPackets <= SL_MAX_PACKET_QUEUED) - { - // Admit to send only if the number of packets being transmitted does not exceed the specified limit - adapter_handle = f->Adapter->AdapterHandle; - } - - if (adapter_handle != NULL) - { - // Lock the file list which opens the same adapter - SlLockList(dev->FileList); - for (j = 0;j < SL_LIST_NUM(dev->FileList);j++) - { - SL_FILE *other = SL_LIST_DATA(dev->FileList, j); - - if (other != f) - { - // Lock the receive queue of other file lists - SlLock(other->RecvLock); - - other->SetEventFlag = false; - } - } - - for (i = 0;i < num;i++) - { - UINT packet_size = SL_SIZE_OF_PACKET(buf, i); - UCHAR *packet_buf; - NET_BUFFER_LIST *nbl = NULL; - bool ok = false; - bool is_vlan = false; - UINT vlan_id = 0; - UINT vlan_user_priority = 0, vlan_can_format_id = 0; - - if (packet_size > SL_MAX_PACKET_SIZE) - { - packet_size = SL_MAX_PACKET_SIZE; - } - else if (packet_size < SL_PACKET_HEADER_SIZE) - { - packet_size = SL_PACKET_HEADER_SIZE; - } - - packet_buf = (UCHAR *)SL_ADDR_OF_PACKET(buf, i); - - for (j = 0;j < SL_LIST_NUM(dev->FileList);j++) - { - SL_FILE *other = SL_LIST_DATA(dev->FileList, j); - - if (other != f) - { - // Insert into the receive queue of the other file lists - if (other->NumRecvPackets < SL_MAX_PACKET_QUEUED) - { - SL_PACKET *q = SlMalloc(sizeof(SL_PACKET)); - - SlCopy(q->Data, packet_buf, packet_size); - q->Size = packet_size; - q->Next = NULL; - - if (other->RecvPacketHead == NULL) - { - other->RecvPacketHead = q; - } - else - { - other->RecvPacketTail->Next = q; - } - - other->RecvPacketTail = q; - - other->NumRecvPackets++; - - other->SetEventFlag = true; - } - } - } - - // Allocate a new NET_BUFFER_LIST - if (f->NetBufferListPool != NULL) - { - nbl = NdisAllocateNetBufferList(f->NetBufferListPool, 16, 0); - - if (nbl != NULL) - { - nbl->SourceHandle = adapter_handle; - } - } - - if (nbl != NULL) - { - // Get the NET_BUFFER from the NET_BUFFER_LIST - NET_BUFFER *nb = NET_BUFFER_LIST_FIRST_NB(nbl); - - NET_BUFFER_LIST_NEXT_NBL(nbl) = NULL; - - // Determine if the packet is IEEE802.1Q tagged packet - if (dev->Adapter->SupportVLan && packet_size >= 18) - { - if (packet_buf[12] == 0x81 && packet_buf[13] == 0x00) - { - USHORT tag_us = 0; - - ((UCHAR *)(&tag_us))[0] = packet_buf[15]; - ((UCHAR *)(&tag_us))[1] = packet_buf[14]; - - vlan_id = tag_us & 0x0FFF; - vlan_user_priority = (tag_us >> 13) & 0x07; - vlan_can_format_id = (tag_us >> 12) & 0x01; - - if (vlan_id != 0) - { - is_vlan = true; - } - } - } - - if (is_vlan) - { - packet_size -= 4; - } - - if (nb != NULL && OK(NdisRetreatNetBufferDataStart(nb, packet_size, 0, NULL))) - { - // Buffer copy - UCHAR *dst = NdisGetDataBuffer(nb, packet_size, NULL, 1, 0); - - if (dst != NULL) - { - if (is_vlan == false) - { - SlCopy(dst, packet_buf, packet_size); - } - else - { - SlCopy(dst, packet_buf, 12); - SlCopy(dst + 12, packet_buf + 16, packet_size + 4 - 16); - } - - ok = true; - } - else - { - NdisAdvanceNetBufferDataStart(nb, packet_size, false, NULL); - } - } - } - - if (ok == false) - { - if (nbl != NULL) - { - NdisFreeNetBufferList(nbl); - } - } - else - { - if (nbl_head == NULL) - { - nbl_head = nbl; - } - - if (nbl_tail != NULL) - { - NET_BUFFER_LIST_NEXT_NBL(nbl_tail) = nbl; - } - - nbl_tail = nbl; - - ((void **)NET_BUFFER_LIST_CONTEXT_DATA_START(nbl))[0] = f; - - if (is_vlan == false) - { - NET_BUFFER_LIST_INFO(nbl, Ieee8021QNetBufferListInfo) = NULL; - } - else - { - NDIS_NET_BUFFER_LIST_8021Q_INFO qinfo; - - qinfo.Value = &(((void **)NET_BUFFER_LIST_CONTEXT_DATA_START(nbl))[1]); - SlZero(qinfo.Value, sizeof(UINT32) * 12); - - qinfo.TagHeader.VlanId = vlan_id; - qinfo.TagHeader.UserPriority = vlan_user_priority; - qinfo.TagHeader.CanonicalFormatId = vlan_can_format_id; - - NET_BUFFER_LIST_INFO(nbl, Ieee8021QNetBufferListInfo) = qinfo.Value; - } - - num_packets++; - } - } - - for (j = 0;j < SL_LIST_NUM(dev->FileList);j++) - { - SL_FILE *other = SL_LIST_DATA(dev->FileList, j); - - if (other != f) - { - // Release the receive queue of other file lists - SlUnlock(other->RecvLock); - - // Set an event - if (other->SetEventFlag) - { - SlSet(other->Event); - } - } - } - SlUnlockList(dev->FileList); - - if (nbl_head != NULL) - { - InterlockedExchangeAdd(&f->NumSendingPackets, num_packets); - InterlockedExchangeAdd(&f->Adapter->NumPendingSendPackets, num_packets); - - SlUnlock(f->Adapter->Lock); - - NdisSendNetBufferLists(adapter_handle, nbl_head, 0, 0); - } - else - { - SlUnlock(f->Adapter->Lock); - } - } - else - { - SlUnlock(f->Adapter->Lock); - } - } - - if (mdl != NULL) - { - MmUnlockPages(mdl); - IoFreeMdl(mdl); - } - } - } - } - } - - irp->IoStatus.Information = ret_size; - irp->IoStatus.Status = ret; - IoCompleteRequest(irp, IO_NO_INCREMENT); - - return ret; -} - -// IOCTL procedure of the device -NTSTATUS SlDeviceIoControlProc(DEVICE_OBJECT *device_object, IRP *irp) -{ - SL_DEVICE *dev = *((SL_DEVICE **)device_object->DeviceExtension); - NTSTATUS ret = STATUS_UNSUCCESSFUL; - IO_STACK_LOCATION *irp_stack = IoGetCurrentIrpStackLocation(irp); - UINT ret_size = 0; - - if (dev->IsBasicDevice == false) - { - // Adapter device - SL_FILE *f = irp_stack->FileObject->FsContext; - - switch (irp_stack->Parameters.DeviceIoControl.IoControlCode) - { - case SL_IOCTL_GET_EVENT_NAME: - if (irp_stack->Parameters.DeviceIoControl.OutputBufferLength >= sizeof(SL_IOCTL_EVENT_NAME)) - { - SL_IOCTL_EVENT_NAME *t = irp->UserBuffer; - - if (t != NULL) - { - // Address check - bool check_ok = true; - __try - { - ProbeForWrite(t, sizeof(SL_IOCTL_EVENT_NAME), 1); - } - __except (EXCEPTION_EXECUTE_HANDLER) - { - check_ok = false; - } - - if (check_ok) - { - strcpy(t->EventNameWin32, f->EventNameWin32); - - ret_size = sizeof(SL_IOCTL_EVENT_NAME); - - ret = STATUS_SUCCESS; - } - } - } - break; - } - } - - irp->IoStatus.Status = ret; - irp->IoStatus.Information = ret_size; - IoCompleteRequest(irp, IO_NO_INCREMENT); - - return ret; -} - -// NDIS bind notification procedure -NDIS_STATUS SlNdisBindAdapterExProc(NDIS_HANDLE protocol_driver_context, NDIS_HANDLE bind_context, NDIS_BIND_PARAMETERS *bind_parameters) -{ - NDIS_STATUS ret = NDIS_STATUS_FAILURE; - - InterlockedIncrement(&sl->NumBoundAdapters); - - // Check the attributes of the adapter, and process only adapter which should be bound to - if (bind_parameters->MediaType == NdisMedium802_3 && - bind_parameters->MacAddressLength == 6 && -// (bind_parameters->PhysicalMediumType == NdisPhysicalMedium802_3 || bind_parameters->PhysicalMediumType == 0) && - bind_parameters->AccessType == NET_IF_ACCESS_BROADCAST && - bind_parameters->DirectionType == NET_IF_DIRECTION_SENDRECEIVE && - bind_parameters->ConnectionType == NET_IF_CONNECTION_DEDICATED) - { - // Open the adapter - NDIS_OPEN_PARAMETERS t; - NDIS_MEDIUM medium_array = {NdisMedium802_3}; - SL_ADAPTER *a; - wchar_t adapter_id_tag[] = SL_ADAPTER_ID_PREFIX_W; - - SlZero(&t, sizeof(t)); - t.Header.Type = NDIS_OBJECT_TYPE_OPEN_PARAMETERS; - t.Header.Revision = NDIS_OPEN_PARAMETERS_REVISION_1; - t.Header.Size = NDIS_SIZEOF_OPEN_PARAMETERS_REVSION_1; - - t.AdapterName = bind_parameters->AdapterName; - t.MediumArray = &medium_array; - t.MediumArraySize = 1; - t.SelectedMediumIndex = &sl->DummyInt; - t.FrameTypeArray = NULL; - t.FrameTypeArraySize = 0; - - a = SlZeroMalloc(sizeof(SL_ADAPTER)); - - a->Lock = SlNewLock(); - a->AdapterName = SlNewUnicodeFromUnicodeString(bind_parameters->AdapterName); - -/* - if (bind_parameters->MacOptions & NDIS_MAC_OPTION_8021Q_VLAN) - { - a->SupportVLan = true; - } - - if (bind_parameters->TcpConnectionOffloadCapabilities != NULL) - { - if (bind_parameters->TcpConnectionOffloadCapabilities->Encapsulation & NDIS_ENCAPSULATION_IEEE_802_3_P_AND_Q || - bind_parameters->TcpConnectionOffloadCapabilities->Encapsulation & NDIS_ENCAPSULATION_IEEE_802_3_P_AND_Q_IN_OOB) - { - a->SupportVLan = true; - } - } -*/ - - SlCopy(a->AdapterId, a->AdapterName->String.Buffer, MIN(sizeof(a->AdapterId) - sizeof(wchar_t), a->AdapterName->String.Length)); - SlCopy(a->AdapterId, adapter_id_tag, sizeof(adapter_id_tag) - sizeof(wchar_t)); - - SlCopy(a->MacAddress, bind_parameters->CurrentMacAddress, 6); - SlCopy(&a->BindParamCopy, bind_parameters, sizeof(NDIS_BIND_PARAMETERS)); - a->BindingContext = bind_context; - a->MtuSize = bind_parameters->MtuSize; - - a->IsOpenPending = true; - - ret = NdisOpenAdapterEx(sl->ProtocolHandle, a, &t, bind_context, &a->AdapterHandle); - a->AdapterHandle2 = a->AdapterHandle; - - if (ret != NDIS_STATUS_PENDING) - { - a->IsOpenPending = false; - SlNdisOpenAdapterCompleteExProc(a, ret); - } - } - - if (ret != NDIS_STATUS_PENDING) - { - if (ret != NDIS_STATUS_SUCCESS) - { - InterlockedDecrement(&sl->NumBoundAdapters); - } - } - - return ret; -} - -// Open success notification procedure of NDIS adapter -void SlNdisOpenAdapterCompleteExProc(NDIS_HANDLE protocol_binding_context, NDIS_STATUS status) -{ - SL_ADAPTER *a = (SL_ADAPTER *)protocol_binding_context; - bool is_pending = a->IsOpenPending; - NDIS_HANDLE binding_context = a->BindingContext; - - if (OK(status)) - { - // Create an adapter device - SL_UNICODE *device_name = SlNewUnicode(SL_ADAPTER_DEVICE_NAME); - SL_UNICODE *symbolic_name = SlNewUnicode(SL_ADAPTER_DEVICE_NAME_SYMBOLIC); - SL_DEVICE *dev; - - // Create a device name - SlCopy(device_name->String.Buffer + 8, a->AdapterId, sizeof(wchar_t) * 46); - SlCopy(symbolic_name->String.Buffer + 19, a->AdapterId, sizeof(wchar_t) * 46); - - dev = SlNewDeviceUnicode(device_name, symbolic_name); - - if (dev == NULL) - { - // Device creation failed - SlFreeUnicode(device_name); - SlFreeUnicode(symbolic_name); - } - else - { - // Create a file list - dev->FileList = SlNewList(); - } - if (dev != NULL) - { - // Get the display name - SlSendOidRequest(a, false, OID_GEN_VENDOR_DESCRIPTION, a->FriendlyName, - sizeof(a->FriendlyName) - 1); - - dev->Adapter = a; - a->Device = dev; - - // Add this adapter to the adapter list - SlLockList(sl->AdapterList); - { - SlAdd(sl->AdapterList, a); - } - SlUnlockList(sl->AdapterList); - } - } - else - { - // Discard the adapter handle - a->AdapterHandle = NULL; - - // Release the SL_ADAPTER - SlFreeAdapter(a); - - a = NULL; - } - - if (is_pending) - { - NdisCompleteBindAdapterEx(binding_context, status); - } - - if (a != NULL) - { - a->Ready = true; - } - - if (is_pending) - { - if (NG(status)) - { - InterlockedDecrement(&sl->NumBoundAdapters); - } - } -} - -// Release the SL_ADAPTER -void SlFreeAdapter(SL_ADAPTER *a) -{ - // Validate arguments - if (a == NULL) - { - return; - } - - SlFreeUnicode(a->AdapterName); - - SlFreeLock(a->Lock); - - SlFree(a); -} - -// NDIS unbind notification procedure -NDIS_STATUS SlNdisUnbindAdapterExProc(NDIS_HANDLE unbind_context, NDIS_HANDLE protocol_binding_context) -{ - NDIS_STATUS ret; - SL_ADAPTER *a = (SL_ADAPTER *)protocol_binding_context; - UINT j; - NDIS_HANDLE adapter_handle = NULL; - - if (a->Halt) - { - //SL_WHERE; - } - - adapter_handle = a->AdapterHandle; - a->Halt = true; - if (a->Device != NULL) - { - a->Device->Halting = true; - } - a->AdapterHandle = NULL; - - SlLock(a->Lock); - { - } - SlUnlock(a->Lock); - - a->UnbindContext = unbind_context; - a->IsClosePending = true; - - // Delete the adapter from the adapter list - SlLockList(sl->AdapterList); - { - SlDelete(sl->AdapterList, a); - } - SlUnlockList(sl->AdapterList); - - for (j = 0;j < 32;j++) - { - // Wait until the number of OID requests of being processed by this adapter becomes zero - while (true) - { - UINT num; - - num = a->NumPendingOidRequests; - - if (num == 0) - { - break; - } - else - { - j = 0; - } - - //SlSleep(50); - } - - // Wait until the number of packets this adapter is transmitting becomes zero - while (true) - { - UINT num; - - num = a->NumPendingSendPackets; - - if (num == 0) - { - break; - } - else - { - j = 0; - } - - //SlSleep(50); - } - - } - - ret = NdisCloseAdapterEx(adapter_handle); - - if (ret != NDIS_STATUS_PENDING) - { - a->IsClosePending = false; - SlNdisCloseAdapterCompleteExProc(a); - - ret = NDIS_STATUS_SUCCESS; - - InterlockedDecrement(&sl->NumBoundAdapters); - } - - return ret; -} - -// Close success notification procedure of NDIS adapter -void SlNdisCloseAdapterCompleteExProc(NDIS_HANDLE protocol_binding_context) -{ - SL_ADAPTER *a = (SL_ADAPTER *)protocol_binding_context; - NDIS_HANDLE unbind_context = a->UnbindContext; - bool is_pending = a->IsClosePending; - UINT j; - - if (is_pending) - { - NdisCompleteUnbindAdapterEx(unbind_context); - } - - for (j = 0;j < 32;j++) - { - if (a->Device != NULL) - { - a->Device->Halting = true; - - // Wait until the number of file handles that are associated with this device becomes zero - while (true) - { - UINT num_files = 0; - - SlLock(a->Device->OpenCloseLock); - { - SlLockList(a->Device->FileList); - { - UINT i; - num_files = SL_LIST_NUM(a->Device->FileList); - - for (i = 0;i < num_files;i++) - { - // Hit the associated event - SL_FILE *f = SL_LIST_DATA(a->Device->FileList, i); - - if (f->FinalWakeUp == false) - { - SlSet(f->Event); - f->FinalWakeUp = true; - } - } - } - SlUnlockList(a->Device->FileList); - } - SlUnlock(a->Device->OpenCloseLock); - - if (num_files == 0) - { - break; - } - - SlSleep(50); - } - } - } - - // Release the device - if (a->Device != NULL) - { - // Delete the file list - SlFreeList(a->Device->FileList); - - SlFreeDevice(a->Device); - a->Device = NULL; - } - - // Release the SL_ADAPTER - SlFreeAdapter(a); - - if (is_pending) - { - InterlockedDecrement(&sl->NumBoundAdapters); - } -} - -// NDIS PnP notification procedure -NDIS_STATUS SlNdisNetPnPEventProc(NDIS_HANDLE protocol_binding_context, NET_PNP_EVENT_NOTIFICATION *net_pnp_event) -{ - SL_ADAPTER *a = (SL_ADAPTER *)protocol_binding_context; - - if (net_pnp_event != NULL) - { - if (net_pnp_event->NetPnPEvent.NetEvent == NetEventBindsComplete) - { - sl->IsEnumCompleted = true; - } - } - - return NDIS_STATUS_SUCCESS; -} - -// NDIS uninstall procedure -void SlNdisUninstallProc(void) -{ -} - -// NDIS OID request completion notification procedure -void SlNdisOidRequestCompleteProc(NDIS_HANDLE protocol_binding_context, NDIS_OID_REQUEST *oid_request, NDIS_STATUS status) -{ - SL_ADAPTER *a = (SL_ADAPTER *)protocol_binding_context; - bool no_not_free = false; - - // Check the results - if (oid_request->RequestType == NdisRequestQueryInformation) - { - if (oid_request->DATA.QUERY_INFORMATION.Oid == OID_GEN_VENDOR_DESCRIPTION) - { - no_not_free = true; - } - } - - // Release the memory - if (no_not_free == false) - { - SlFree(oid_request->DATA.SET_INFORMATION.InformationBuffer); - } - - SlFree(oid_request); - - // Counter subtraction - InterlockedDecrement(&a->NumPendingOidRequests); -} - -// NDIS status notification procedure -void SlNdisStatusExProc(NDIS_HANDLE protocol_binding_context, NDIS_STATUS_INDICATION *status_indication) -{ - SL_ADAPTER *a = (SL_ADAPTER *)protocol_binding_context; -} - -// NDIS packet reception notification procedure -void SlNdisReceiveNetBufferListsProc(NDIS_HANDLE protocol_binding_context, NET_BUFFER_LIST *net_buffer_lists, - NDIS_PORT_NUMBER port_number, ULONG NumberOfNetBufferLists, - ULONG receive_flags) -{ - SL_ADAPTER *a = (SL_ADAPTER *)protocol_binding_context; - UINT i; - UINT return_flags = 0; - NET_BUFFER_LIST *nbl; - UCHAR *tmp_buffer; - UINT tmp_size; - - if (net_buffer_lists == NULL || NumberOfNetBufferLists == 0) - { - return; - } - - if (a->AdapterHandle2 == NULL) - { - a->AdapterHandle2 = a->AdapterHandle; - } - - if (NDIS_TEST_RECEIVE_AT_DISPATCH_LEVEL(receive_flags)) - { - NDIS_SET_RETURN_FLAG(return_flags, NDIS_RETURN_FLAGS_DISPATCH_LEVEL); - } - - if (a->Halt || a->Device == NULL || a->Device->Halting || a->Ready == false || a->AdapterHandle == NULL) - { - goto LABEL_CLEANUP; - } - - tmp_buffer = a->TmpBuffer; - tmp_size = sizeof(a->TmpBuffer); - - nbl = net_buffer_lists; - - SlLockList(a->Device->FileList); - { - if (a->Halt == false) - { - for (i = 0;i < SL_LIST_NUM(a->Device->FileList);i++) - { - // Lock the receive queue - SL_FILE *f = SL_LIST_DATA(a->Device->FileList, i); - - SlLock(f->RecvLock); - } - - while (nbl != NULL) - { - NET_BUFFER *nb = NET_BUFFER_LIST_FIRST_NB(nbl); - bool is_vlan = false; - UCHAR vlan_tag[2]; - - if (NET_BUFFER_LIST_INFO(nbl, Ieee8021QNetBufferListInfo) != 0) - { - NDIS_NET_BUFFER_LIST_8021Q_INFO qinfo; - qinfo.Value = NET_BUFFER_LIST_INFO(nbl, Ieee8021QNetBufferListInfo); - if (qinfo.TagHeader.VlanId != 0) - { - USHORT tag_us; - is_vlan = true; - - a->SupportVLan = true; - - tag_us = (qinfo.TagHeader.UserPriority & 0x07 << 13) | - (qinfo.TagHeader.CanonicalFormatId & 0x01 << 12) | - (qinfo.TagHeader.VlanId & 0x0FFF); - - vlan_tag[0] = ((UCHAR *)(&tag_us))[1]; - vlan_tag[1] = ((UCHAR *)(&tag_us))[0]; - } - } - - while (nb != NULL) - { - UINT size = NET_BUFFER_DATA_LENGTH(nb); - - if (size >= 14 && size <= tmp_size && size <= (UINT)((is_vlan == false) ? SL_MAX_PACKET_SIZE : (SL_MAX_PACKET_SIZE - 4))) - { - UCHAR *ptr = NdisGetDataBuffer(nb, size, tmp_buffer, 1, 0); - - if (ptr != NULL) - { - // Insert the queue to all waiting files - for (i = 0;i < SL_LIST_NUM(a->Device->FileList);i++) - { - SL_FILE *f = SL_LIST_DATA(a->Device->FileList, i); - - if (f->NumRecvPackets < SL_MAX_PACKET_QUEUED) - { - SL_PACKET *q = SlMalloc(sizeof(SL_PACKET)); - - if (is_vlan == false) - { - // Normal packet - SlCopy(q->Data, ptr, size); - q->Size = size; - } - else - { - // Insert a tag in the case of IEEE802.1Q packet - SlCopy(q->Data, ptr, 12); - q->Data[12] = 0x81; - q->Data[13] = 0x00; - SlCopy(&q->Data[14], vlan_tag, 2); - SlCopy(&q->Data[16], &ptr[12], size - 12); - - q->Size = size + 4; - } - - q->Next = NULL; - - if (f->RecvPacketHead == NULL) - { - f->RecvPacketHead = q; - } - else - { - f->RecvPacketTail->Next = q; - } - - f->RecvPacketTail = q; - - f->NumRecvPackets++; - } - } - } - } - - nb = NET_BUFFER_NEXT_NB(nb); - } - - nbl = NET_BUFFER_LIST_NEXT_NBL(nbl); - } - - // Hit the event - for (i = 0;i < SL_LIST_NUM(a->Device->FileList);i++) - { - SL_FILE *f = SL_LIST_DATA(a->Device->FileList, i); - - // Unlock the receive queue - SlUnlock(f->RecvLock); - - SlSet(f->Event); - } - } - } - SlUnlockList(a->Device->FileList); - -LABEL_CLEANUP: - - if (NDIS_TEST_RECEIVE_CAN_PEND(receive_flags)) - { - NdisReturnNetBufferLists(a->AdapterHandle2, net_buffer_lists, return_flags); - } -} - -// NDIS packet transmission completion notification procedure -void SlNdisSendNetBufferListsCompleteProc(NDIS_HANDLE protocol_binding_context, NET_BUFFER_LIST *net_buffer_lists, - ULONG send_complete_flags) -{ - NET_BUFFER_LIST *nbl; - - nbl = net_buffer_lists; - - while (nbl != NULL) - { - NET_BUFFER_LIST *current_nbl = nbl; - SL_FILE *f; - NET_BUFFER *nb = NET_BUFFER_LIST_FIRST_NB(nbl); - - if (nb != NULL) - { - UINT size = NET_BUFFER_DATA_LENGTH(nb); - - NdisAdvanceNetBufferDataStart(nb, size, false, NULL); - } - - // Get a file context - f = ((void **)NET_BUFFER_LIST_CONTEXT_DATA_START(nbl))[0]; - - nbl = NET_BUFFER_LIST_NEXT_NBL(nbl); - NET_BUFFER_LIST_NEXT_NBL(current_nbl) = NULL; - - // Release the NET_BUFFER_LIST - NdisFreeNetBufferList(current_nbl); - - // Reduce the number of packets being sent by 1 - InterlockedExchangeAdd(&f->NumSendingPackets, (LONG)-1); - InterlockedExchangeAdd(&f->Adapter->NumPendingSendPackets, (LONG)-1); - } -} - -// Crash -void SlCrash(UINT a, UINT b, UINT c, UINT d) -{ - KeBugCheckEx(0x00000061, (ULONG_PTR)a, (ULONG_PTR)b, (ULONG_PTR)c, (ULONG_PTR)d); -} - -// Memory allocation -void *SlMalloc(UINT size) -{ - NDIS_STATUS r; - void *p; - if (size == 0) - { - size = 1; - } - - // Allocate the non-paged memory - r = NdisAllocateMemoryWithTag(&p, size, 'SETH'); - - if (NG(r)) - { - return NULL; - } - - return p; -} - -// Clear to zero by allocating the memory -void *SlZeroMalloc(UINT size) -{ - void *p = SlMalloc(size); - if (p == NULL) - { - // Memory allocation failure - return NULL; - } - - // Clear to zero - SlZero(p, size); - - return p; -} - -// Release the memory -void SlFree(void *p) -{ - // Validate arguments - if (p == NULL) - { - return; - } - - // Release the memory - NdisFreeMemory(p, 0, 0); -} - -// Memory zero clear -void SlZero(void *dst, UINT size) -{ - // Validate arguments - if (dst == NULL || size == 0) - { - return; - } - - // Clear - NdisZeroMemory(dst, size); -} - -// Copy memory -void SlCopy(void *dst, void *src, UINT size) -{ - // Validate arguments - if (dst == NULL || src == NULL || size == 0) - { - return; - } - - // Copy - NdisMoveMemory(dst, src, size); -} - -// Create a lock -SL_LOCK *SlNewLock() -{ - NDIS_SPIN_LOCK *spin_lock; - - // Memory allocation - SL_LOCK *lock = SlZeroMalloc(sizeof(SL_LOCK)); - if (lock == NULL) - { - return NULL; - } - - // Initialize spin lock - spin_lock = &lock->spin_lock; - - NdisAllocateSpinLock(spin_lock); - - return lock; -} - -// Lock -void SlLock(SL_LOCK *lock) -{ - NDIS_SPIN_LOCK *spin_lock; - // Validate arguments - if (lock == NULL) - { - return; - } - - spin_lock = &lock->spin_lock; - NdisAcquireSpinLock(spin_lock); -} - -// Unlock -void SlUnlock(SL_LOCK *lock) -{ - NDIS_SPIN_LOCK *spin_lock; - // Validate arguments - if (lock == NULL) - { - return; - } - - spin_lock = &lock->spin_lock; - NdisReleaseSpinLock(spin_lock); -} - -// Release the lock -void SlFreeLock(SL_LOCK *lock) -{ - NDIS_SPIN_LOCK *spin_lock; - // Validate arguments - if (lock == NULL) - { - return; - } - - spin_lock = &lock->spin_lock; - NdisFreeSpinLock(spin_lock); - - // Release the memory - SlFree(lock); -} - -// Create an event -SL_EVENT *SlNewEvent(char *name) -{ - SL_UNICODE *unicode_name; - SL_EVENT *event; - // Validate arguments - if (name == NULL) - { - return NULL; - } - - // Convert to Unicode name - unicode_name = SlNewUnicode(name); - if (unicode_name == NULL) - { - return NULL; - } - - // Memory allocation - event = SlZeroMalloc(sizeof(SL_EVENT)); - if (event == NULL) - { - SlFreeUnicode(unicode_name); - return NULL; - } - - // Create an event - event->event = IoCreateNotificationEvent(SlGetUnicode(unicode_name), &event->event_handle); - if (event->event == NULL) - { - SlFree(event); - SlFreeUnicode(unicode_name); - return NULL; - } - - // Initialize the event - KeInitializeEvent(event->event, NotificationEvent, FALSE); - KeClearEvent(event->event); - - // Release the string - SlFreeUnicode(unicode_name); - - return event; -} - -// Release the event -void SlFreeEvent(SL_EVENT *event) -{ - // Validate arguments - if (event == NULL) - { - return; - } - - ZwClose(event->event_handle); - - // Release the memory - SlFree(event); -} - -// Set the event -void SlSet(SL_EVENT *event) -{ - // Validate arguments - if (event == NULL) - { - return; - } - - KeSetEvent(event->event, 0, FALSE); -} - -// Reset the event -void SlReset(SL_EVENT *event) -{ - // Validate arguments - if (event == NULL) - { - return; - } - - KeResetEvent(event->event); -} - -// Create by copying the Unicode -SL_UNICODE *SlNewUnicodeFromUnicodeString(UNICODE_STRING *src) -{ - SL_UNICODE *u; - // Validate arguments - if (src == NULL) - { - return NULL; - } - - // Memory allocation - u = SlZeroMalloc(sizeof(SL_UNICODE)); - if (u == NULL) - { - return NULL; - } - - u->String.Length = u->String.MaximumLength = src->Length; - - u->String.Buffer = SlZeroMalloc(src->Length); - SlCopy(u->String.Buffer, src->Buffer, src->Length); - - return u; -} - -// Create a Unicode -SL_UNICODE *SlNewUnicode(char *str) -{ - SL_UNICODE *u; - // Validate arguments - if (str == NULL) - { - return NULL; - } - - // Memory allocation - u = SlZeroMalloc(sizeof(SL_UNICODE)); - if (u == NULL) - { - return NULL; - } - - // String initialization - NdisInitializeString(&u->String, str); - - return u; -} - -// Release the Unicode -void SlFreeUnicode(SL_UNICODE *u) -{ - // Validate arguments - if (u == NULL) - { - return; - } - - // Release the string - NdisFreeString(u->String); - - // Release the memory - SlFree(u); -} - -// Get an Unicode -NDIS_STRING *SlGetUnicode(SL_UNICODE *u) -{ - // Validate arguments - if (u == NULL) - { - return NULL; - } - - return &u->String; -} - -// Create a list -SL_LIST *SlNewList() -{ - SL_LIST *o; - - o = (SL_LIST *)SlZeroMalloc(sizeof(SL_LIST)); - - o->lock = SlNewLock(); - - o->num_item = 0; - o->num_reserved = SL_INIT_NUM_RESERVED; - - o->p = (void **)SlZeroMalloc(sizeof(void *) * o->num_reserved); - - return o; -} - -// Add an element to the list -void SlAdd(SL_LIST *o, void *p) -{ - UINT i; - // Validate arguments - if (o == NULL || p == NULL) - { - return; - } - - i = o->num_item; - o->num_item++; - - if (o->num_item > o->num_reserved) - { - UINT old_num_reserved = o->num_reserved; - void *p_old = o->p; - - o->num_reserved = o->num_reserved * 2; - - o->p = SlZeroMalloc(sizeof(void *) * o->num_reserved); - SlCopy(o->p, p_old, sizeof(void *) * old_num_reserved); - SlFree(p_old); - } - - o->p[i] = p; -} - -// Delete the element from the list -bool SlDelete(SL_LIST *o, void *p) -{ - UINT i, n; - // Validate arguments - if (o == NULL || p == NULL) - { - return false; - } - - for (i = 0;i < o->num_item;i++) - { - if (o->p[i] == p) - { - break; - } - } - if (i == o->num_item) - { - return false; - } - - n = i; - for (i = n;i < (o->num_item - 1);i++) - { - o->p[i] = o->p[i + 1]; - } - o->num_item--; - - return true; -} - -// Delete all elements from the list -void SlDeleteAll(SL_LIST *o) -{ - // Validate arguments - if (o == NULL) - { - return; - } - - o->num_item = 0; -} - -// Lock the list -void SlLockList(SL_LIST *o) -{ - // Validate arguments - if (o == NULL) - { - return; - } - - SlLock(o->lock); -} - -// Unlock the list -void SlUnlockList(SL_LIST *o) -{ - // Validate arguments - if (o == NULL) - { - return; - } - - SlUnlock(o->lock); -} - -// Release the list -void SlFreeList(SL_LIST *o) -{ - // Validate arguments - if (o == NULL) - { - return; - } - - SlFree(o->p); - SlFreeLock(o->lock); - - SlFree(o); -} - -// Clone the memory -void *SlClone(void *p, UINT size) -{ - void *ret; - // Validate arguments - if (p == NULL) - { - return NULL; - } - - ret = SlMalloc(size); - SlCopy(ret, p, size); - - return ret; -} - - -// Sleep -void SlSleep(int milliSeconds) -{ - PKTIMER timer = SlMalloc(sizeof(KTIMER)); - LARGE_INTEGER duetime; - - duetime.QuadPart = (__int64)milliSeconds * -10000; - KeInitializeTimerEx(timer, NotificationTimer); - KeSetTimerEx(timer, duetime, 0, NULL); - - KeWaitForSingleObject(timer, Executive, KernelMode, FALSE, NULL); - - SlFree(timer); -} - - - +// SoftEther VPN Source Code - Developer Edition Master Branch +// SeLow: SoftEther Lightweight Network Protocol + + +// SeLow.c +// SeLow Device Driver + +#include + +#define SELOW_DEVICE_DRIVER + +#include "SeLow.h" + +static SL_CTX sl_ctx = {0}; +static SL_CTX *sl = &sl_ctx; + +// Win32 driver entry point +NDIS_STATUS DriverEntry(DRIVER_OBJECT *driver_object, UNICODE_STRING *registry_path) +{ + NDIS_PROTOCOL_DRIVER_CHARACTERISTICS t; + NDIS_STATUS ret = NDIS_STATUS_FAILURE; + SL_UNICODE *protocol_name = NULL; + NDIS_HANDLE protocol_handle = NULL; + SL_CTX *sl_ctx = NULL; + DEVICE_OBJECT *device_object = NULL; + + SlZero(sl, sizeof(SL_CTX)); + + // Register the NDIS protocol + protocol_name = SlNewUnicode(SL_PROTOCOL_NAME); + if (protocol_name == NULL) + { + goto LABEL_CLEANUP; + } + + SlZero(&t, sizeof(t)); + t.Header.Type = NDIS_OBJECT_TYPE_PROTOCOL_DRIVER_CHARACTERISTICS; + t.Header.Revision = NDIS_PROTOCOL_DRIVER_CHARACTERISTICS_REVISION_2; + t.Header.Size = NDIS_SIZEOF_PROTOCOL_DRIVER_CHARACTERISTICS_REVISION_2; + t.MajorNdisVersion = 6; + t.MinorNdisVersion = 20; + t.Name = protocol_name->String; + + t.BindAdapterHandlerEx = SlNdisBindAdapterExProc; + t.UnbindAdapterHandlerEx = SlNdisUnbindAdapterExProc; + t.OpenAdapterCompleteHandlerEx = SlNdisOpenAdapterCompleteExProc; + t.CloseAdapterCompleteHandlerEx = SlNdisCloseAdapterCompleteExProc; + t.NetPnPEventHandler = SlNdisNetPnPEventProc; + t.UninstallHandler = SlNdisUninstallProc; + t.OidRequestCompleteHandler = SlNdisOidRequestCompleteProc; + t.StatusHandlerEx = SlNdisStatusExProc; + t.ReceiveNetBufferListsHandler = SlNdisReceiveNetBufferListsProc; + t.SendNetBufferListsCompleteHandler = SlNdisSendNetBufferListsCompleteProc; + + // Create an adapters list + sl->DriverObject = driver_object; + sl->AdapterList = SlNewList(); + + ret = NdisRegisterProtocolDriver(NULL, &t, &protocol_handle); + + if (NG(ret)) + { + protocol_handle = NULL; + goto LABEL_CLEANUP; + } + + SlZero(driver_object->MajorFunction, sizeof(driver_object->MajorFunction)); + driver_object->MajorFunction[IRP_MJ_CREATE] = SlDeviceOpenProc; + driver_object->MajorFunction[IRP_MJ_CLOSE] = SlDeviceCloseProc; + driver_object->MajorFunction[IRP_MJ_READ] = SlDeviceReadProc; + driver_object->MajorFunction[IRP_MJ_WRITE] = SlDeviceWriteProc; + driver_object->MajorFunction[IRP_MJ_DEVICE_CONTROL] = SlDeviceIoControlProc; + driver_object->DriverUnload = SlUnloadProc; + + // Initialize the SL context + sl->ProtocolHandle = protocol_handle; + + // Create a basic device + sl->BasicDevice = SlNewDevice(SL_BASIC_DEVICE_NAME, SL_BASIC_DEVICE_NAME_SYMBOLIC); + if (sl->BasicDevice == NULL) + { + ret = NDIS_STATUS_FAILURE; + goto LABEL_CLEANUP; + } + sl->BasicDevice->IsBasicDevice = true; + +LABEL_CLEANUP: + + SlFreeUnicode(protocol_name); + + if (NG(ret)) + { + SlUnloadProc(driver_object); + } + + return ret; +} + +// Unloading procedure of the device driver +void SlUnloadProc(DRIVER_OBJECT *driver_object) +{ + // Release the protocol + if (sl->ProtocolHandle != NULL) + { + NdisDeregisterProtocolDriver(sl->ProtocolHandle); + sl->ProtocolHandle = NULL; + } + + // Release the basic device + SlFreeDevice(sl->BasicDevice); + + // Release the adapter list + SlFreeList(sl->AdapterList); + + // Initialize the SL context + SlZero(sl, sizeof(SL_CTX)); +} + +// Delete a device +void SlFreeDevice(SL_DEVICE *dev) +{ + NTSTATUS r; + // Validate arguments + if (dev == NULL) + { + return; + } + + r = IoDeleteSymbolicLink(&dev->SymbolicLinkName->String); + if (NG(r)) + { + // May fail due to a bug in Windows Kernel + } + + IoDeleteDevice(dev->DeviceObject); + + SlFreeUnicode(dev->DeviceName); + SlFreeUnicode(dev->SymbolicLinkName); + + SlFreeLock(dev->OpenCloseLock); + + SlFree(dev); +} + +// Create a new device +SL_DEVICE *SlNewDevice(char *device_name, char *symbolic_link_name) +{ + SL_UNICODE *u_device_name = SlNewUnicode(device_name); + SL_UNICODE *u_sym_name = SlNewUnicode(symbolic_link_name); + + SL_DEVICE *ret = SlNewDeviceUnicode(u_device_name, u_sym_name); + + if (ret == NULL) + { + SlFreeUnicode(u_device_name); + SlFreeUnicode(u_sym_name); + } + + return ret; +} +SL_DEVICE *SlNewDeviceUnicode(SL_UNICODE *u_device_name, SL_UNICODE *u_sym_name) +{ + SL_DEVICE *ret = NULL; + DEVICE_OBJECT *dev_obj = NULL; + NTSTATUS r; + SL_UNICODE *sddl; + + sddl = SlNewUnicode("D:P(A;;GA;;;SY)(A;;GA;;;BA)"); + + /*r = IoCreateDevice(sl->DriverObject, sizeof(SL_DEVICE *), + &u_device_name->String, FILE_DEVICE_TRANSPORT, 0, false, &dev_obj);*/ + + r = IoCreateDeviceSecure(sl->DriverObject, sizeof(SL_DEVICE *), + &u_device_name->String, FILE_DEVICE_TRANSPORT, 0, false, SlGetUnicode(sddl), + NULL, &dev_obj); + + SlFreeUnicode(sddl); + + if (NG(r)) + { + dev_obj = NULL; + goto LABEL_CLEANUP; + } + + r = IoCreateSymbolicLink(&u_sym_name->String, &u_device_name->String); + if (NG(r)) + { + // May fail due to a bug in Windows Kernel + } + + ret = SlZeroMalloc(sizeof(SL_DEVICE)); + if (ret == NULL) + { + goto LABEL_CLEANUP; + } + + ret->DeviceObject = dev_obj; + ret->DeviceName = u_device_name; + ret->SymbolicLinkName = u_sym_name; + *((SL_DEVICE **)dev_obj->DeviceExtension) = ret; + + dev_obj->Flags &= ~DO_DEVICE_INITIALIZING; + + ret->OpenCloseLock = SlNewLock(); + +LABEL_CLEANUP: + if (ret == NULL) + { + if (dev_obj != NULL) + { + IoDeleteDevice(dev_obj); + } + } + + return ret; +} + +// Device is opened +NTSTATUS SlDeviceOpenProc(DEVICE_OBJECT *device_object, IRP *irp) +{ + SL_DEVICE *dev = *((SL_DEVICE **)device_object->DeviceExtension); + NTSTATUS ret = STATUS_UNSUCCESSFUL; + IO_STACK_LOCATION *irp_stack = IoGetCurrentIrpStackLocation(irp); + + if (dev->IsBasicDevice) + { + // Basic device + ret = STATUS_SUCCESS; + } + else + { + bool set_promisc = false; + volatile UINT *num_pending_oid_requests = NULL; + UINT64 v; + char event_name[SL_EVENT_NAME_SIZE]; + char event_name_win32[SL_EVENT_NAME_SIZE]; + SL_EVENT *event_object = NULL; + LARGE_INTEGER count; + LARGE_INTEGER freq; + + count = KeQueryPerformanceCounter(&freq); + + InterlockedIncrement(&sl->IntCounter1); + + // Create a new event object + v = (UINT64)device_object + (UINT64)(++sl->IntCounter1) + *((UINT64 *)(&count)); + sprintf(event_name, SL_EVENT_NAME, (UINT)v, (UINT)(v >> 32) + sl->IntCounter1); + sprintf(event_name_win32, SL_EVENT_NAME_WIN32, (UINT)v, (UINT)(v >> 32) + sl->IntCounter1); + event_object = SlNewEvent(event_name); + + SlLock(dev->OpenCloseLock); + { + // Add to the opened file list + SlLockList(dev->FileList); + { + if (dev->Halting == false && dev->Adapter != NULL && dev->Adapter->Ready && dev->Adapter->Halt == false) + { + // Adapter device + SL_FILE *f = SlZeroMalloc(sizeof(SL_FILE)); + NET_BUFFER_LIST_POOL_PARAMETERS p; + + f->Device = dev; + f->Adapter = dev->Adapter; + f->FileObject = irp_stack->FileObject; + + irp_stack->FileObject->FsContext = f; + + SlAdd(dev->FileList, f); + + ret = STATUS_SUCCESS; + set_promisc = true; + + // Event + f->Event = event_object; + event_object = NULL; + strcpy(f->EventNameWin32, event_name_win32); + + // Create a lock + f->RecvLock = SlNewLock(); + + // Create a NET_BUFFER_LIST pool + SlZero(&p, sizeof(p)); + p.Header.Type = NDIS_OBJECT_TYPE_DEFAULT; + p.Header.Revision = NET_BUFFER_LIST_POOL_PARAMETERS_REVISION_1; + p.Header.Size = NDIS_SIZEOF_NET_BUFFER_LIST_POOL_PARAMETERS_REVISION_1; + p.ProtocolId = NDIS_PROTOCOL_ID_DEFAULT; + p.fAllocateNetBuffer = true; + p.ContextSize = 32 + sizeof(UINT32) * 12; + p.DataSize = SL_MAX_PACKET_SIZE; + p.PoolTag = 'SETH'; + + f->NetBufferListPool = NdisAllocateNetBufferListPool(NULL, &p); + + num_pending_oid_requests = &dev->Adapter->NumPendingOidRequests; + } + } + SlUnlockList(dev->FileList); + } + SlUnlock(dev->OpenCloseLock); + + if (event_object != NULL) + { + SlFreeEvent(event_object); + } + + if (set_promisc) + { + // Enable promiscuous mode + UINT filter = NDIS_PACKET_TYPE_PROMISCUOUS; + SlSendOidRequest(dev->Adapter, true, OID_GEN_CURRENT_PACKET_FILTER, &filter, sizeof(filter)); + + // Wait until the number of OID requests being processed becomes 0 + while ((*num_pending_oid_requests) != 0) + { + SlSleep(50); + } + } + } + + irp->IoStatus.Status = ret; + IoCompleteRequest(irp, IO_NO_INCREMENT); + + return ret; +} + +// Send an OID request to the device +void SlSendOidRequest(SL_ADAPTER *a, bool set, NDIS_OID oid, void *data, UINT size) +{ + NDIS_OID_REQUEST *t; + NDIS_STATUS ret; + // Validate arguments + if (a == NULL || data == NULL || size == 0) + { + return; + } + + if (a->Halt == false) + { + bool ok = false; + + t = SlZeroMalloc(sizeof(NDIS_OID_REQUEST)); + + t->Header.Type = NDIS_OBJECT_TYPE_OID_REQUEST; + t->Header.Revision = NDIS_OID_REQUEST_REVISION_1; + t->Header.Size = NDIS_SIZEOF_OID_REQUEST_REVISION_1; + + if (set == false) + { + t->RequestType = NdisRequestQueryInformation; + t->DATA.QUERY_INFORMATION.Oid = oid; + t->DATA.QUERY_INFORMATION.InformationBuffer = data; + t->DATA.QUERY_INFORMATION.InformationBufferLength = size; + } + else + { + t->RequestType = NdisRequestSetInformation; + t->DATA.SET_INFORMATION.Oid = oid; + t->DATA.SET_INFORMATION.InformationBuffer = SlClone(data, size); + t->DATA.SET_INFORMATION.InformationBufferLength = size; + } + + SlLock(a->Lock); + { + if (a->AdapterHandle != NULL && a->Halt == false) + { + InterlockedIncrement(&a->NumPendingOidRequests); + ok = true; + } + } + SlUnlock(a->Lock); + + if (ok) + { + ret = NdisOidRequest(a->AdapterHandle, t); + + if (ret != NDIS_STATUS_PENDING) + { + InterlockedDecrement(&a->NumPendingOidRequests); + if (set) + { + SlFree(t->DATA.SET_INFORMATION.InformationBuffer); + } + SlFree(t); + } + } + else + { + if (set) + { + SlFree(t->DATA.SET_INFORMATION.InformationBuffer); + } + SlFree(t); + } + } +} + +// Device is closed +NTSTATUS SlDeviceCloseProc(DEVICE_OBJECT *device_object, IRP *irp) +{ + SL_DEVICE *dev = *((SL_DEVICE **)device_object->DeviceExtension); + NTSTATUS ret = STATUS_UNSUCCESSFUL; + IO_STACK_LOCATION *irp_stack = IoGetCurrentIrpStackLocation(irp); + + if (dev->IsBasicDevice) + { + // Basic device + ret = STATUS_SUCCESS; + } + else + { + // Adapter device + SL_FILE *f = irp_stack->FileObject->FsContext; + + if (f != NULL) + { + bool clear_filter = false; + + // Wait until the number of packet being sent becomes the zero + while (true) + { + if (f->NumSendingPackets == 0) + { + break; + } + + SlSleep(50); + } + + SlLock(dev->OpenCloseLock); + { + // Delete the file from the list + SlLockList(dev->FileList); + { + SlDelete(dev->FileList, f); + + if (SL_LIST_NUM(dev->FileList) == 0) + { + // Clear the filter when all files are closed + clear_filter = true; + } + } + SlUnlockList(dev->FileList); + + if (dev->Adapter->Halt) + { + clear_filter = false; + } + + if (clear_filter) + { + InterlockedIncrement(&dev->Adapter->NumPendingOidRequests); + } + } + SlUnlock(dev->OpenCloseLock); + + if (clear_filter) + { + // Clear the filter when all files are closed + UINT filter = 0; + SlSendOidRequest(dev->Adapter, true, OID_GEN_CURRENT_PACKET_FILTER, &filter, sizeof(filter)); + InterlockedDecrement(&dev->Adapter->NumPendingOidRequests); + } + + // Release the event + SlFreeEvent(f->Event); + + // Release the receive queue + if (true) + { + SL_PACKET *p = f->RecvPacketHead; + + while (p != NULL) + { + SL_PACKET *p_next = p->Next; + + SlFree(p); + + p = p_next; + } + } + + // Release the NET_BUFFER_LIST pool + NdisFreeNetBufferListPool(f->NetBufferListPool); + + // Release the lock + SlFreeLock(f->RecvLock); + + SlFree(f); + + ret = STATUS_SUCCESS; + } + } + + irp->IoStatus.Status = ret; + IoCompleteRequest(irp, IO_NO_INCREMENT); + + return ret; +} + +// Read procedure of the device +NTSTATUS SlDeviceReadProc(DEVICE_OBJECT *device_object, IRP *irp) +{ + SL_DEVICE *dev = *((SL_DEVICE **)device_object->DeviceExtension); + NTSTATUS ret = STATUS_UNSUCCESSFUL; + UINT ret_size = 0; + IO_STACK_LOCATION *irp_stack = IoGetCurrentIrpStackLocation(irp); + + if (dev->IsBasicDevice) + { + // Return the adapter list in the case of basic device + if (irp_stack->Parameters.Read.Length >= sizeof(SL_ADAPTER_INFO_LIST)) + { + SL_ADAPTER_INFO_LIST *dst = irp->UserBuffer; + + if (dst != NULL) + { + // Address check + bool check_ok = true; + __try + { + ProbeForWrite(irp->UserBuffer, sizeof(SL_ADAPTER_INFO_LIST), 1); + } + __except (EXCEPTION_EXECUTE_HANDLER) + { + check_ok = false; + } + + if (check_ok) + { + MDL *mdl; + + mdl = IoAllocateMdl(dst, irp_stack->Parameters.Read.Length, false, false, NULL); + if (mdl != NULL) + { + MmProbeAndLockPages(mdl, KernelMode, IoWriteAccess); + } + + SlZero(dst, sizeof(SL_ADAPTER_INFO_LIST)); + + dst->Signature = SL_SIGNATURE; + dst->SeLowVersion = SL_VER; + dst->EnumCompleted = sl->IsEnumCompleted ? 8 : 1; + + SlLockList(sl->AdapterList); + { + UINT i; + + dst->NumAdapters = MIN(SL_LIST_NUM(sl->AdapterList), SL_MAX_ADAPTER_INFO_LIST_ENTRY); + + for (i = 0;i < dst->NumAdapters;i++) + { + SL_ADAPTER *a = SL_LIST_DATA(sl->AdapterList, i); + SL_ADAPTER_INFO *d = &dst->Adapters[i]; + + d->MtuSize = a->MtuSize; + SlCopy(d->MacAddress, a->MacAddress, 6); + SlCopy(d->AdapterId, a->AdapterId, sizeof(a->AdapterId)); + strcpy(d->FriendlyName, a->FriendlyName); + d->SupportsVLanHw = a->SupportVLan; + } + } + SlUnlockList(sl->AdapterList); + + ret_size = sizeof(SL_ADAPTER_INFO); + ret = STATUS_SUCCESS; + + if (mdl != NULL) + { + MmUnlockPages(mdl); + IoFreeMdl(mdl); + } + } + } + } + } + else + { + // Adapter device + SL_FILE *f = irp_stack->FileObject->FsContext; + + if (irp_stack->Parameters.Read.Length == SL_EXCHANGE_BUFFER_SIZE) + { + UCHAR *buf = irp->UserBuffer; + + if (dev->Halting || f->Adapter->Halt || buf == NULL) + { + // Halting + } + else + { + // Address check + bool check_ok = true; + __try + { + ProbeForWrite(irp->UserBuffer, SL_EXCHANGE_BUFFER_SIZE, 1); + } + __except (EXCEPTION_EXECUTE_HANDLER) + { + check_ok = false; + } + + if (check_ok) + { + UINT num = 0; + bool left = true; + MDL *mdl; + + mdl = IoAllocateMdl(buf, SL_EXCHANGE_BUFFER_SIZE, false, false, NULL); + if (mdl != NULL) + { + MmProbeAndLockPages(mdl, KernelMode, IoWriteAccess); + } + + // Lock the receive queue + SlLock(f->RecvLock); + { + while (true) + { + SL_PACKET *q; + if (num >= SL_MAX_PACKET_EXCHANGE) + { + if (f->RecvPacketHead == NULL) + { + left = false; + } + break; + } + q = f->RecvPacketHead; + if (q != NULL) + { + f->RecvPacketHead = f->RecvPacketHead->Next; + q->Next = NULL; + f->NumRecvPackets--; + + if (f->RecvPacketHead == NULL) + { + f->RecvPacketTail = NULL; + } + } + else + { + left = false; + break; + } + SL_SIZE_OF_PACKET(buf, num) = q->Size; + SlCopy(SL_ADDR_OF_PACKET(buf, num), q->Data, q->Size); + num++; + SlFree(q); + } + } + SlUnlock(f->RecvLock); + + if (mdl != NULL) + { + MmUnlockPages(mdl); + IoFreeMdl(mdl); + } + + SL_NUM_PACKET(buf) = num; + SL_LEFT_FLAG(buf) = left; + + if (left == false) + { + SlReset(f->Event); + } + else + { + SlSet(f->Event); + } + + ret = STATUS_SUCCESS; + ret_size = SL_EXCHANGE_BUFFER_SIZE; + } + } + } + } + + irp->IoStatus.Status = ret; + irp->IoStatus.Information = ret_size; + IoCompleteRequest(irp, IO_NO_INCREMENT); + + return ret; +} + +// Write procedure of the device +NTSTATUS SlDeviceWriteProc(DEVICE_OBJECT *device_object, IRP *irp) +{ + SL_DEVICE *dev = *((SL_DEVICE **)device_object->DeviceExtension); + NTSTATUS ret = STATUS_UNSUCCESSFUL; + IO_STACK_LOCATION *irp_stack = IoGetCurrentIrpStackLocation(irp); + UINT ret_size = 0; + + if (dev->IsBasicDevice == false) + { + // Adapter device + SL_FILE *f = irp_stack->FileObject->FsContext; + + if (irp_stack->Parameters.Write.Length == SL_EXCHANGE_BUFFER_SIZE) + { + UCHAR *buf = irp->UserBuffer; + + if (dev->Halting || dev->Adapter->Halt || buf == NULL) + { + // Halting + } + else + { + // Address check + bool check_ok = true; + __try + { + ProbeForRead(irp->UserBuffer, SL_EXCHANGE_BUFFER_SIZE, 1); + } + __except (EXCEPTION_EXECUTE_HANDLER) + { + check_ok = false; + } + + if (check_ok) + { + // Write the packet + MDL *mdl; + UINT num = SL_NUM_PACKET(buf); + + + mdl = IoAllocateMdl(buf, SL_EXCHANGE_BUFFER_SIZE, false, false, NULL); + if (mdl != NULL) + { + MmProbeAndLockPages(mdl, KernelMode, IoReadAccess); + } + + ret = true; + ret_size = SL_EXCHANGE_BUFFER_SIZE; + + if (num >= 1 && num <= SL_MAX_PACKET_EXCHANGE) + { + UINT i, j; + NET_BUFFER_LIST *nbl_head = NULL; + NET_BUFFER_LIST *nbl_tail = NULL; + UINT num_packets = 0; + NDIS_HANDLE adapter_handle = NULL; + + SlLock(f->Adapter->Lock); + + if (f->Adapter->NumPendingSendPackets <= SL_MAX_PACKET_QUEUED) + { + // Admit to send only if the number of packets being transmitted does not exceed the specified limit + adapter_handle = f->Adapter->AdapterHandle; + } + + if (adapter_handle != NULL) + { + // Lock the file list which opens the same adapter + SlLockList(dev->FileList); + for (j = 0;j < SL_LIST_NUM(dev->FileList);j++) + { + SL_FILE *other = SL_LIST_DATA(dev->FileList, j); + + if (other != f) + { + // Lock the receive queue of other file lists + SlLock(other->RecvLock); + + other->SetEventFlag = false; + } + } + + for (i = 0;i < num;i++) + { + UINT packet_size = SL_SIZE_OF_PACKET(buf, i); + UCHAR *packet_buf; + NET_BUFFER_LIST *nbl = NULL; + bool ok = false; + bool is_vlan = false; + UINT vlan_id = 0; + UINT vlan_user_priority = 0, vlan_can_format_id = 0; + + if (packet_size > SL_MAX_PACKET_SIZE) + { + packet_size = SL_MAX_PACKET_SIZE; + } + else if (packet_size < SL_PACKET_HEADER_SIZE) + { + packet_size = SL_PACKET_HEADER_SIZE; + } + + packet_buf = (UCHAR *)SL_ADDR_OF_PACKET(buf, i); + + for (j = 0;j < SL_LIST_NUM(dev->FileList);j++) + { + SL_FILE *other = SL_LIST_DATA(dev->FileList, j); + + if (other != f) + { + // Insert into the receive queue of the other file lists + if (other->NumRecvPackets < SL_MAX_PACKET_QUEUED) + { + SL_PACKET *q = SlMalloc(sizeof(SL_PACKET)); + + SlCopy(q->Data, packet_buf, packet_size); + q->Size = packet_size; + q->Next = NULL; + + if (other->RecvPacketHead == NULL) + { + other->RecvPacketHead = q; + } + else + { + other->RecvPacketTail->Next = q; + } + + other->RecvPacketTail = q; + + other->NumRecvPackets++; + + other->SetEventFlag = true; + } + } + } + + // Allocate a new NET_BUFFER_LIST + if (f->NetBufferListPool != NULL) + { + nbl = NdisAllocateNetBufferList(f->NetBufferListPool, 16, 0); + + if (nbl != NULL) + { + nbl->SourceHandle = adapter_handle; + } + } + + if (nbl != NULL) + { + // Get the NET_BUFFER from the NET_BUFFER_LIST + NET_BUFFER *nb = NET_BUFFER_LIST_FIRST_NB(nbl); + + NET_BUFFER_LIST_NEXT_NBL(nbl) = NULL; + + // Determine if the packet is IEEE802.1Q tagged packet + if (dev->Adapter->SupportVLan && packet_size >= 18) + { + if (packet_buf[12] == 0x81 && packet_buf[13] == 0x00) + { + USHORT tag_us = 0; + + ((UCHAR *)(&tag_us))[0] = packet_buf[15]; + ((UCHAR *)(&tag_us))[1] = packet_buf[14]; + + vlan_id = tag_us & 0x0FFF; + vlan_user_priority = (tag_us >> 13) & 0x07; + vlan_can_format_id = (tag_us >> 12) & 0x01; + + if (vlan_id != 0) + { + is_vlan = true; + } + } + } + + if (is_vlan) + { + packet_size -= 4; + } + + if (nb != NULL && OK(NdisRetreatNetBufferDataStart(nb, packet_size, 0, NULL))) + { + // Buffer copy + UCHAR *dst = NdisGetDataBuffer(nb, packet_size, NULL, 1, 0); + + if (dst != NULL) + { + if (is_vlan == false) + { + SlCopy(dst, packet_buf, packet_size); + } + else + { + SlCopy(dst, packet_buf, 12); + SlCopy(dst + 12, packet_buf + 16, packet_size + 4 - 16); + } + + ok = true; + } + else + { + NdisAdvanceNetBufferDataStart(nb, packet_size, false, NULL); + } + } + } + + if (ok == false) + { + if (nbl != NULL) + { + NdisFreeNetBufferList(nbl); + } + } + else + { + if (nbl_head == NULL) + { + nbl_head = nbl; + } + + if (nbl_tail != NULL) + { + NET_BUFFER_LIST_NEXT_NBL(nbl_tail) = nbl; + } + + nbl_tail = nbl; + + ((void **)NET_BUFFER_LIST_CONTEXT_DATA_START(nbl))[0] = f; + + if (is_vlan == false) + { + NET_BUFFER_LIST_INFO(nbl, Ieee8021QNetBufferListInfo) = NULL; + } + else + { + NDIS_NET_BUFFER_LIST_8021Q_INFO qinfo; + + qinfo.Value = &(((void **)NET_BUFFER_LIST_CONTEXT_DATA_START(nbl))[1]); + SlZero(qinfo.Value, sizeof(UINT32) * 12); + + qinfo.TagHeader.VlanId = vlan_id; + qinfo.TagHeader.UserPriority = vlan_user_priority; + qinfo.TagHeader.CanonicalFormatId = vlan_can_format_id; + + NET_BUFFER_LIST_INFO(nbl, Ieee8021QNetBufferListInfo) = qinfo.Value; + } + + num_packets++; + } + } + + for (j = 0;j < SL_LIST_NUM(dev->FileList);j++) + { + SL_FILE *other = SL_LIST_DATA(dev->FileList, j); + + if (other != f) + { + // Release the receive queue of other file lists + SlUnlock(other->RecvLock); + + // Set an event + if (other->SetEventFlag) + { + SlSet(other->Event); + } + } + } + SlUnlockList(dev->FileList); + + if (nbl_head != NULL) + { + InterlockedExchangeAdd(&f->NumSendingPackets, num_packets); + InterlockedExchangeAdd(&f->Adapter->NumPendingSendPackets, num_packets); + + SlUnlock(f->Adapter->Lock); + + NdisSendNetBufferLists(adapter_handle, nbl_head, 0, 0); + } + else + { + SlUnlock(f->Adapter->Lock); + } + } + else + { + SlUnlock(f->Adapter->Lock); + } + } + + if (mdl != NULL) + { + MmUnlockPages(mdl); + IoFreeMdl(mdl); + } + } + } + } + } + + irp->IoStatus.Information = ret_size; + irp->IoStatus.Status = ret; + IoCompleteRequest(irp, IO_NO_INCREMENT); + + return ret; +} + +// IOCTL procedure of the device +NTSTATUS SlDeviceIoControlProc(DEVICE_OBJECT *device_object, IRP *irp) +{ + SL_DEVICE *dev = *((SL_DEVICE **)device_object->DeviceExtension); + NTSTATUS ret = STATUS_UNSUCCESSFUL; + IO_STACK_LOCATION *irp_stack = IoGetCurrentIrpStackLocation(irp); + UINT ret_size = 0; + + if (dev->IsBasicDevice == false) + { + // Adapter device + SL_FILE *f = irp_stack->FileObject->FsContext; + + switch (irp_stack->Parameters.DeviceIoControl.IoControlCode) + { + case SL_IOCTL_GET_EVENT_NAME: + if (irp_stack->Parameters.DeviceIoControl.OutputBufferLength >= sizeof(SL_IOCTL_EVENT_NAME)) + { + SL_IOCTL_EVENT_NAME *t = irp->UserBuffer; + + if (t != NULL) + { + // Address check + bool check_ok = true; + __try + { + ProbeForWrite(t, sizeof(SL_IOCTL_EVENT_NAME), 1); + } + __except (EXCEPTION_EXECUTE_HANDLER) + { + check_ok = false; + } + + if (check_ok) + { + strcpy(t->EventNameWin32, f->EventNameWin32); + + ret_size = sizeof(SL_IOCTL_EVENT_NAME); + + ret = STATUS_SUCCESS; + } + } + } + break; + } + } + + irp->IoStatus.Status = ret; + irp->IoStatus.Information = ret_size; + IoCompleteRequest(irp, IO_NO_INCREMENT); + + return ret; +} + +// NDIS bind notification procedure +NDIS_STATUS SlNdisBindAdapterExProc(NDIS_HANDLE protocol_driver_context, NDIS_HANDLE bind_context, NDIS_BIND_PARAMETERS *bind_parameters) +{ + NDIS_STATUS ret = NDIS_STATUS_FAILURE; + + InterlockedIncrement(&sl->NumBoundAdapters); + + // Check the attributes of the adapter, and process only adapter which should be bound to + if (bind_parameters->MediaType == NdisMedium802_3 && + bind_parameters->MacAddressLength == 6 && +// (bind_parameters->PhysicalMediumType == NdisPhysicalMedium802_3 || bind_parameters->PhysicalMediumType == 0) && + bind_parameters->AccessType == NET_IF_ACCESS_BROADCAST && + bind_parameters->DirectionType == NET_IF_DIRECTION_SENDRECEIVE && + bind_parameters->ConnectionType == NET_IF_CONNECTION_DEDICATED) + { + // Open the adapter + NDIS_OPEN_PARAMETERS t; + NDIS_MEDIUM medium_array = {NdisMedium802_3}; + SL_ADAPTER *a; + wchar_t adapter_id_tag[] = SL_ADAPTER_ID_PREFIX_W; + + SlZero(&t, sizeof(t)); + t.Header.Type = NDIS_OBJECT_TYPE_OPEN_PARAMETERS; + t.Header.Revision = NDIS_OPEN_PARAMETERS_REVISION_1; + t.Header.Size = NDIS_SIZEOF_OPEN_PARAMETERS_REVSION_1; + + t.AdapterName = bind_parameters->AdapterName; + t.MediumArray = &medium_array; + t.MediumArraySize = 1; + t.SelectedMediumIndex = &sl->DummyInt; + t.FrameTypeArray = NULL; + t.FrameTypeArraySize = 0; + + a = SlZeroMalloc(sizeof(SL_ADAPTER)); + + a->Lock = SlNewLock(); + a->AdapterName = SlNewUnicodeFromUnicodeString(bind_parameters->AdapterName); + +/* + if (bind_parameters->MacOptions & NDIS_MAC_OPTION_8021Q_VLAN) + { + a->SupportVLan = true; + } + + if (bind_parameters->TcpConnectionOffloadCapabilities != NULL) + { + if (bind_parameters->TcpConnectionOffloadCapabilities->Encapsulation & NDIS_ENCAPSULATION_IEEE_802_3_P_AND_Q || + bind_parameters->TcpConnectionOffloadCapabilities->Encapsulation & NDIS_ENCAPSULATION_IEEE_802_3_P_AND_Q_IN_OOB) + { + a->SupportVLan = true; + } + } +*/ + + SlCopy(a->AdapterId, a->AdapterName->String.Buffer, MIN(sizeof(a->AdapterId) - sizeof(wchar_t), a->AdapterName->String.Length)); + SlCopy(a->AdapterId, adapter_id_tag, sizeof(adapter_id_tag) - sizeof(wchar_t)); + + SlCopy(a->MacAddress, bind_parameters->CurrentMacAddress, 6); + SlCopy(&a->BindParamCopy, bind_parameters, sizeof(NDIS_BIND_PARAMETERS)); + a->BindingContext = bind_context; + a->MtuSize = bind_parameters->MtuSize; + + a->IsOpenPending = true; + + ret = NdisOpenAdapterEx(sl->ProtocolHandle, a, &t, bind_context, &a->AdapterHandle); + a->AdapterHandle2 = a->AdapterHandle; + + if (ret != NDIS_STATUS_PENDING) + { + a->IsOpenPending = false; + SlNdisOpenAdapterCompleteExProc(a, ret); + } + } + + if (ret != NDIS_STATUS_PENDING) + { + if (ret != NDIS_STATUS_SUCCESS) + { + InterlockedDecrement(&sl->NumBoundAdapters); + } + } + + return ret; +} + +// Open success notification procedure of NDIS adapter +void SlNdisOpenAdapterCompleteExProc(NDIS_HANDLE protocol_binding_context, NDIS_STATUS status) +{ + SL_ADAPTER *a = (SL_ADAPTER *)protocol_binding_context; + bool is_pending = a->IsOpenPending; + NDIS_HANDLE binding_context = a->BindingContext; + + if (OK(status)) + { + // Create an adapter device + SL_UNICODE *device_name = SlNewUnicode(SL_ADAPTER_DEVICE_NAME); + SL_UNICODE *symbolic_name = SlNewUnicode(SL_ADAPTER_DEVICE_NAME_SYMBOLIC); + SL_DEVICE *dev; + + // Create a device name + SlCopy(device_name->String.Buffer + 8, a->AdapterId, sizeof(wchar_t) * 46); + SlCopy(symbolic_name->String.Buffer + 19, a->AdapterId, sizeof(wchar_t) * 46); + + dev = SlNewDeviceUnicode(device_name, symbolic_name); + + if (dev == NULL) + { + // Device creation failed + SlFreeUnicode(device_name); + SlFreeUnicode(symbolic_name); + } + else + { + // Create a file list + dev->FileList = SlNewList(); + } + if (dev != NULL) + { + // Get the display name + SlSendOidRequest(a, false, OID_GEN_VENDOR_DESCRIPTION, a->FriendlyName, + sizeof(a->FriendlyName) - 1); + + dev->Adapter = a; + a->Device = dev; + + // Add this adapter to the adapter list + SlLockList(sl->AdapterList); + { + SlAdd(sl->AdapterList, a); + } + SlUnlockList(sl->AdapterList); + } + } + else + { + // Discard the adapter handle + a->AdapterHandle = NULL; + + // Release the SL_ADAPTER + SlFreeAdapter(a); + + a = NULL; + } + + if (is_pending) + { + NdisCompleteBindAdapterEx(binding_context, status); + } + + if (a != NULL) + { + a->Ready = true; + } + + if (is_pending) + { + if (NG(status)) + { + InterlockedDecrement(&sl->NumBoundAdapters); + } + } +} + +// Release the SL_ADAPTER +void SlFreeAdapter(SL_ADAPTER *a) +{ + // Validate arguments + if (a == NULL) + { + return; + } + + SlFreeUnicode(a->AdapterName); + + SlFreeLock(a->Lock); + + SlFree(a); +} + +// NDIS unbind notification procedure +NDIS_STATUS SlNdisUnbindAdapterExProc(NDIS_HANDLE unbind_context, NDIS_HANDLE protocol_binding_context) +{ + NDIS_STATUS ret; + SL_ADAPTER *a = (SL_ADAPTER *)protocol_binding_context; + UINT j; + NDIS_HANDLE adapter_handle = NULL; + + if (a->Halt) + { + //SL_WHERE; + } + + adapter_handle = a->AdapterHandle; + a->Halt = true; + if (a->Device != NULL) + { + a->Device->Halting = true; + } + a->AdapterHandle = NULL; + + SlLock(a->Lock); + { + } + SlUnlock(a->Lock); + + a->UnbindContext = unbind_context; + a->IsClosePending = true; + + // Delete the adapter from the adapter list + SlLockList(sl->AdapterList); + { + SlDelete(sl->AdapterList, a); + } + SlUnlockList(sl->AdapterList); + + for (j = 0;j < 32;j++) + { + // Wait until the number of OID requests of being processed by this adapter becomes zero + while (true) + { + UINT num; + + num = a->NumPendingOidRequests; + + if (num == 0) + { + break; + } + else + { + j = 0; + } + + //SlSleep(50); + } + + // Wait until the number of packets this adapter is transmitting becomes zero + while (true) + { + UINT num; + + num = a->NumPendingSendPackets; + + if (num == 0) + { + break; + } + else + { + j = 0; + } + + //SlSleep(50); + } + + } + + ret = NdisCloseAdapterEx(adapter_handle); + + if (ret != NDIS_STATUS_PENDING) + { + a->IsClosePending = false; + SlNdisCloseAdapterCompleteExProc(a); + + ret = NDIS_STATUS_SUCCESS; + + InterlockedDecrement(&sl->NumBoundAdapters); + } + + return ret; +} + +// Close success notification procedure of NDIS adapter +void SlNdisCloseAdapterCompleteExProc(NDIS_HANDLE protocol_binding_context) +{ + SL_ADAPTER *a = (SL_ADAPTER *)protocol_binding_context; + NDIS_HANDLE unbind_context = a->UnbindContext; + bool is_pending = a->IsClosePending; + UINT j; + + if (is_pending) + { + NdisCompleteUnbindAdapterEx(unbind_context); + } + + for (j = 0;j < 32;j++) + { + if (a->Device != NULL) + { + a->Device->Halting = true; + + // Wait until the number of file handles that are associated with this device becomes zero + while (true) + { + UINT num_files = 0; + + SlLock(a->Device->OpenCloseLock); + { + SlLockList(a->Device->FileList); + { + UINT i; + num_files = SL_LIST_NUM(a->Device->FileList); + + for (i = 0;i < num_files;i++) + { + // Hit the associated event + SL_FILE *f = SL_LIST_DATA(a->Device->FileList, i); + + if (f->FinalWakeUp == false) + { + SlSet(f->Event); + f->FinalWakeUp = true; + } + } + } + SlUnlockList(a->Device->FileList); + } + SlUnlock(a->Device->OpenCloseLock); + + if (num_files == 0) + { + break; + } + + SlSleep(50); + } + } + } + + // Release the device + if (a->Device != NULL) + { + // Delete the file list + SlFreeList(a->Device->FileList); + + SlFreeDevice(a->Device); + a->Device = NULL; + } + + // Release the SL_ADAPTER + SlFreeAdapter(a); + + if (is_pending) + { + InterlockedDecrement(&sl->NumBoundAdapters); + } +} + +// NDIS PnP notification procedure +NDIS_STATUS SlNdisNetPnPEventProc(NDIS_HANDLE protocol_binding_context, NET_PNP_EVENT_NOTIFICATION *net_pnp_event) +{ + SL_ADAPTER *a = (SL_ADAPTER *)protocol_binding_context; + + if (net_pnp_event != NULL) + { + if (net_pnp_event->NetPnPEvent.NetEvent == NetEventBindsComplete) + { + sl->IsEnumCompleted = true; + } + } + + return NDIS_STATUS_SUCCESS; +} + +// NDIS uninstall procedure +void SlNdisUninstallProc(void) +{ +} + +// NDIS OID request completion notification procedure +void SlNdisOidRequestCompleteProc(NDIS_HANDLE protocol_binding_context, NDIS_OID_REQUEST *oid_request, NDIS_STATUS status) +{ + SL_ADAPTER *a = (SL_ADAPTER *)protocol_binding_context; + bool no_not_free = false; + + // Check the results + if (oid_request->RequestType == NdisRequestQueryInformation) + { + if (oid_request->DATA.QUERY_INFORMATION.Oid == OID_GEN_VENDOR_DESCRIPTION) + { + no_not_free = true; + } + } + + // Release the memory + if (no_not_free == false) + { + SlFree(oid_request->DATA.SET_INFORMATION.InformationBuffer); + } + + SlFree(oid_request); + + // Counter subtraction + InterlockedDecrement(&a->NumPendingOidRequests); +} + +// NDIS status notification procedure +void SlNdisStatusExProc(NDIS_HANDLE protocol_binding_context, NDIS_STATUS_INDICATION *status_indication) +{ + SL_ADAPTER *a = (SL_ADAPTER *)protocol_binding_context; +} + +// NDIS packet reception notification procedure +void SlNdisReceiveNetBufferListsProc(NDIS_HANDLE protocol_binding_context, NET_BUFFER_LIST *net_buffer_lists, + NDIS_PORT_NUMBER port_number, ULONG NumberOfNetBufferLists, + ULONG receive_flags) +{ + SL_ADAPTER *a = (SL_ADAPTER *)protocol_binding_context; + UINT i; + UINT return_flags = 0; + NET_BUFFER_LIST *nbl; + UCHAR *tmp_buffer; + UINT tmp_size; + + if (net_buffer_lists == NULL || NumberOfNetBufferLists == 0) + { + return; + } + + if (a->AdapterHandle2 == NULL) + { + a->AdapterHandle2 = a->AdapterHandle; + } + + if (NDIS_TEST_RECEIVE_AT_DISPATCH_LEVEL(receive_flags)) + { + NDIS_SET_RETURN_FLAG(return_flags, NDIS_RETURN_FLAGS_DISPATCH_LEVEL); + } + + if (a->Halt || a->Device == NULL || a->Device->Halting || a->Ready == false || a->AdapterHandle == NULL) + { + goto LABEL_CLEANUP; + } + + tmp_buffer = a->TmpBuffer; + tmp_size = sizeof(a->TmpBuffer); + + nbl = net_buffer_lists; + + SlLockList(a->Device->FileList); + { + if (a->Halt == false) + { + for (i = 0;i < SL_LIST_NUM(a->Device->FileList);i++) + { + // Lock the receive queue + SL_FILE *f = SL_LIST_DATA(a->Device->FileList, i); + + SlLock(f->RecvLock); + } + + while (nbl != NULL) + { + NET_BUFFER *nb = NET_BUFFER_LIST_FIRST_NB(nbl); + bool is_vlan = false; + UCHAR vlan_tag[2]; + + if (NET_BUFFER_LIST_INFO(nbl, Ieee8021QNetBufferListInfo) != 0) + { + NDIS_NET_BUFFER_LIST_8021Q_INFO qinfo; + qinfo.Value = NET_BUFFER_LIST_INFO(nbl, Ieee8021QNetBufferListInfo); + if (qinfo.TagHeader.VlanId != 0) + { + USHORT tag_us; + is_vlan = true; + + a->SupportVLan = true; + + tag_us = (qinfo.TagHeader.UserPriority & 0x07 << 13) | + (qinfo.TagHeader.CanonicalFormatId & 0x01 << 12) | + (qinfo.TagHeader.VlanId & 0x0FFF); + + vlan_tag[0] = ((UCHAR *)(&tag_us))[1]; + vlan_tag[1] = ((UCHAR *)(&tag_us))[0]; + } + } + + while (nb != NULL) + { + UINT size = NET_BUFFER_DATA_LENGTH(nb); + + if (size >= 14 && size <= tmp_size && size <= (UINT)((is_vlan == false) ? SL_MAX_PACKET_SIZE : (SL_MAX_PACKET_SIZE - 4))) + { + UCHAR *ptr = NdisGetDataBuffer(nb, size, tmp_buffer, 1, 0); + + if (ptr != NULL) + { + // Insert the queue to all waiting files + for (i = 0;i < SL_LIST_NUM(a->Device->FileList);i++) + { + SL_FILE *f = SL_LIST_DATA(a->Device->FileList, i); + + if (f->NumRecvPackets < SL_MAX_PACKET_QUEUED) + { + SL_PACKET *q = SlMalloc(sizeof(SL_PACKET)); + + if (is_vlan == false) + { + // Normal packet + SlCopy(q->Data, ptr, size); + q->Size = size; + } + else + { + // Insert a tag in the case of IEEE802.1Q packet + SlCopy(q->Data, ptr, 12); + q->Data[12] = 0x81; + q->Data[13] = 0x00; + SlCopy(&q->Data[14], vlan_tag, 2); + SlCopy(&q->Data[16], &ptr[12], size - 12); + + q->Size = size + 4; + } + + q->Next = NULL; + + if (f->RecvPacketHead == NULL) + { + f->RecvPacketHead = q; + } + else + { + f->RecvPacketTail->Next = q; + } + + f->RecvPacketTail = q; + + f->NumRecvPackets++; + } + } + } + } + + nb = NET_BUFFER_NEXT_NB(nb); + } + + nbl = NET_BUFFER_LIST_NEXT_NBL(nbl); + } + + // Hit the event + for (i = 0;i < SL_LIST_NUM(a->Device->FileList);i++) + { + SL_FILE *f = SL_LIST_DATA(a->Device->FileList, i); + + // Unlock the receive queue + SlUnlock(f->RecvLock); + + SlSet(f->Event); + } + } + } + SlUnlockList(a->Device->FileList); + +LABEL_CLEANUP: + + if (NDIS_TEST_RECEIVE_CAN_PEND(receive_flags)) + { + NdisReturnNetBufferLists(a->AdapterHandle2, net_buffer_lists, return_flags); + } +} + +// NDIS packet transmission completion notification procedure +void SlNdisSendNetBufferListsCompleteProc(NDIS_HANDLE protocol_binding_context, NET_BUFFER_LIST *net_buffer_lists, + ULONG send_complete_flags) +{ + NET_BUFFER_LIST *nbl; + + nbl = net_buffer_lists; + + while (nbl != NULL) + { + NET_BUFFER_LIST *current_nbl = nbl; + SL_FILE *f; + NET_BUFFER *nb = NET_BUFFER_LIST_FIRST_NB(nbl); + + if (nb != NULL) + { + UINT size = NET_BUFFER_DATA_LENGTH(nb); + + NdisAdvanceNetBufferDataStart(nb, size, false, NULL); + } + + // Get a file context + f = ((void **)NET_BUFFER_LIST_CONTEXT_DATA_START(nbl))[0]; + + nbl = NET_BUFFER_LIST_NEXT_NBL(nbl); + NET_BUFFER_LIST_NEXT_NBL(current_nbl) = NULL; + + // Release the NET_BUFFER_LIST + NdisFreeNetBufferList(current_nbl); + + // Reduce the number of packets being sent by 1 + InterlockedExchangeAdd(&f->NumSendingPackets, (LONG)-1); + InterlockedExchangeAdd(&f->Adapter->NumPendingSendPackets, (LONG)-1); + } +} + +// Crash +void SlCrash(UINT a, UINT b, UINT c, UINT d) +{ + KeBugCheckEx(0x00000061, (ULONG_PTR)a, (ULONG_PTR)b, (ULONG_PTR)c, (ULONG_PTR)d); +} + +// Memory allocation +void *SlMalloc(UINT size) +{ + NDIS_STATUS r; + void *p; + if (size == 0) + { + size = 1; + } + + // Allocate the non-paged memory + r = NdisAllocateMemoryWithTag(&p, size, 'SETH'); + + if (NG(r)) + { + return NULL; + } + + return p; +} + +// Clear to zero by allocating the memory +void *SlZeroMalloc(UINT size) +{ + void *p = SlMalloc(size); + if (p == NULL) + { + // Memory allocation failure + return NULL; + } + + // Clear to zero + SlZero(p, size); + + return p; +} + +// Release the memory +void SlFree(void *p) +{ + // Validate arguments + if (p == NULL) + { + return; + } + + // Release the memory + NdisFreeMemory(p, 0, 0); +} + +// Memory zero clear +void SlZero(void *dst, UINT size) +{ + // Validate arguments + if (dst == NULL || size == 0) + { + return; + } + + // Clear + NdisZeroMemory(dst, size); +} + +// Copy memory +void SlCopy(void *dst, void *src, UINT size) +{ + // Validate arguments + if (dst == NULL || src == NULL || size == 0) + { + return; + } + + // Copy + NdisMoveMemory(dst, src, size); +} + +// Create a lock +SL_LOCK *SlNewLock() +{ + NDIS_SPIN_LOCK *spin_lock; + + // Memory allocation + SL_LOCK *lock = SlZeroMalloc(sizeof(SL_LOCK)); + if (lock == NULL) + { + return NULL; + } + + // Initialize spin lock + spin_lock = &lock->spin_lock; + + NdisAllocateSpinLock(spin_lock); + + return lock; +} + +// Lock +void SlLock(SL_LOCK *lock) +{ + NDIS_SPIN_LOCK *spin_lock; + // Validate arguments + if (lock == NULL) + { + return; + } + + spin_lock = &lock->spin_lock; + NdisAcquireSpinLock(spin_lock); +} + +// Unlock +void SlUnlock(SL_LOCK *lock) +{ + NDIS_SPIN_LOCK *spin_lock; + // Validate arguments + if (lock == NULL) + { + return; + } + + spin_lock = &lock->spin_lock; + NdisReleaseSpinLock(spin_lock); +} + +// Release the lock +void SlFreeLock(SL_LOCK *lock) +{ + NDIS_SPIN_LOCK *spin_lock; + // Validate arguments + if (lock == NULL) + { + return; + } + + spin_lock = &lock->spin_lock; + NdisFreeSpinLock(spin_lock); + + // Release the memory + SlFree(lock); +} + +// Create an event +SL_EVENT *SlNewEvent(char *name) +{ + SL_UNICODE *unicode_name; + SL_EVENT *event; + // Validate arguments + if (name == NULL) + { + return NULL; + } + + // Convert to Unicode name + unicode_name = SlNewUnicode(name); + if (unicode_name == NULL) + { + return NULL; + } + + // Memory allocation + event = SlZeroMalloc(sizeof(SL_EVENT)); + if (event == NULL) + { + SlFreeUnicode(unicode_name); + return NULL; + } + + // Create an event + event->event = IoCreateNotificationEvent(SlGetUnicode(unicode_name), &event->event_handle); + if (event->event == NULL) + { + SlFree(event); + SlFreeUnicode(unicode_name); + return NULL; + } + + // Initialize the event + KeInitializeEvent(event->event, NotificationEvent, FALSE); + KeClearEvent(event->event); + + // Release the string + SlFreeUnicode(unicode_name); + + return event; +} + +// Release the event +void SlFreeEvent(SL_EVENT *event) +{ + // Validate arguments + if (event == NULL) + { + return; + } + + ZwClose(event->event_handle); + + // Release the memory + SlFree(event); +} + +// Set the event +void SlSet(SL_EVENT *event) +{ + // Validate arguments + if (event == NULL) + { + return; + } + + KeSetEvent(event->event, 0, FALSE); +} + +// Reset the event +void SlReset(SL_EVENT *event) +{ + // Validate arguments + if (event == NULL) + { + return; + } + + KeResetEvent(event->event); +} + +// Create by copying the Unicode +SL_UNICODE *SlNewUnicodeFromUnicodeString(UNICODE_STRING *src) +{ + SL_UNICODE *u; + // Validate arguments + if (src == NULL) + { + return NULL; + } + + // Memory allocation + u = SlZeroMalloc(sizeof(SL_UNICODE)); + if (u == NULL) + { + return NULL; + } + + u->String.Length = u->String.MaximumLength = src->Length; + + u->String.Buffer = SlZeroMalloc(src->Length); + SlCopy(u->String.Buffer, src->Buffer, src->Length); + + return u; +} + +// Create a Unicode +SL_UNICODE *SlNewUnicode(char *str) +{ + SL_UNICODE *u; + // Validate arguments + if (str == NULL) + { + return NULL; + } + + // Memory allocation + u = SlZeroMalloc(sizeof(SL_UNICODE)); + if (u == NULL) + { + return NULL; + } + + // String initialization + NdisInitializeString(&u->String, str); + + return u; +} + +// Release the Unicode +void SlFreeUnicode(SL_UNICODE *u) +{ + // Validate arguments + if (u == NULL) + { + return; + } + + // Release the string + NdisFreeString(u->String); + + // Release the memory + SlFree(u); +} + +// Get an Unicode +NDIS_STRING *SlGetUnicode(SL_UNICODE *u) +{ + // Validate arguments + if (u == NULL) + { + return NULL; + } + + return &u->String; +} + +// Create a list +SL_LIST *SlNewList() +{ + SL_LIST *o; + + o = (SL_LIST *)SlZeroMalloc(sizeof(SL_LIST)); + + o->lock = SlNewLock(); + + o->num_item = 0; + o->num_reserved = SL_INIT_NUM_RESERVED; + + o->p = (void **)SlZeroMalloc(sizeof(void *) * o->num_reserved); + + return o; +} + +// Add an element to the list +void SlAdd(SL_LIST *o, void *p) +{ + UINT i; + // Validate arguments + if (o == NULL || p == NULL) + { + return; + } + + i = o->num_item; + o->num_item++; + + if (o->num_item > o->num_reserved) + { + UINT old_num_reserved = o->num_reserved; + void *p_old = o->p; + + o->num_reserved = o->num_reserved * 2; + + o->p = SlZeroMalloc(sizeof(void *) * o->num_reserved); + SlCopy(o->p, p_old, sizeof(void *) * old_num_reserved); + SlFree(p_old); + } + + o->p[i] = p; +} + +// Delete the element from the list +bool SlDelete(SL_LIST *o, void *p) +{ + UINT i, n; + // Validate arguments + if (o == NULL || p == NULL) + { + return false; + } + + for (i = 0;i < o->num_item;i++) + { + if (o->p[i] == p) + { + break; + } + } + if (i == o->num_item) + { + return false; + } + + n = i; + for (i = n;i < (o->num_item - 1);i++) + { + o->p[i] = o->p[i + 1]; + } + o->num_item--; + + return true; +} + +// Delete all elements from the list +void SlDeleteAll(SL_LIST *o) +{ + // Validate arguments + if (o == NULL) + { + return; + } + + o->num_item = 0; +} + +// Lock the list +void SlLockList(SL_LIST *o) +{ + // Validate arguments + if (o == NULL) + { + return; + } + + SlLock(o->lock); +} + +// Unlock the list +void SlUnlockList(SL_LIST *o) +{ + // Validate arguments + if (o == NULL) + { + return; + } + + SlUnlock(o->lock); +} + +// Release the list +void SlFreeList(SL_LIST *o) +{ + // Validate arguments + if (o == NULL) + { + return; + } + + SlFree(o->p); + SlFreeLock(o->lock); + + SlFree(o); +} + +// Clone the memory +void *SlClone(void *p, UINT size) +{ + void *ret; + // Validate arguments + if (p == NULL) + { + return NULL; + } + + ret = SlMalloc(size); + SlCopy(ret, p, size); + + return ret; +} + + +// Sleep +void SlSleep(int milliSeconds) +{ + PKTIMER timer = SlMalloc(sizeof(KTIMER)); + LARGE_INTEGER duetime; + + duetime.QuadPart = (__int64)milliSeconds * -10000; + KeInitializeTimerEx(timer, NotificationTimer); + KeSetTimerEx(timer, duetime, 0, NULL); + + KeWaitForSingleObject(timer, Executive, KernelMode, FALSE, NULL); + + SlFree(timer); +} + + + diff --git a/src/SeLow/SeLow.h b/src/SeLow/SeLow.h index db8c5587..5e55fa90 100644 --- a/src/SeLow/SeLow.h +++ b/src/SeLow/SeLow.h @@ -1,280 +1,280 @@ -// SoftEther VPN Source Code - Developer Edition Master Branch -// SeLow - SoftEther Lightweight Network Protocol - - -// SeLow.h -// Header of SeLow.c - -#ifndef SELOW_H -#define SELOW_H - -// Win32 DDK related -#ifndef CPU_64 -#define _X86_ -#else // CPU_64 -#ifndef NEO_IA64 -#define _AMD64_ -#define AMD64 -#else // NEO_IA64 -#define _IA64_ -#define IA64 -#endif // NEO_IA64 -#endif // CPU_64 -#define NDIS_MINIPORT_DRIVER -// NDIS 6.2 -#define NDIS620_MINIPORT -#define NDIS_SUPPORT_NDIS61 1 -#define NDIS_SUPPORT_NDIS620 1 -#define NEO_NDIS_MAJOR_VERSION 6 -#define NEO_NDIS_MINOR_VERSION 20 -#define NDIS_WDM 1 - -#include -#include -#include -#include -#include - -// OS determination -#ifdef WIN32 -#define OS_WIN32 // Microsoft Windows -#else -#define OS_UNIX // UNIX / Linux -#endif - - -// Type declaration -#ifndef WINDOWS_H_INCLUDED -#ifndef WIN9X -typedef unsigned long BOOL; -#endif // WIN9X -#define TRUE 1 -#define FALSE 0 -#endif -typedef unsigned long bool; -#define true 1 -#define false 0 -typedef unsigned long long UINT64; -typedef signed long long INT64; -typedef unsigned short WORD; -typedef unsigned short USHORT; -typedef signed short SHORT; -typedef unsigned char BYTE; -typedef unsigned char UCHAR; -typedef signed char CHAR; -typedef unsigned long DWORD; -#define INFINITE 0xFFFFFFFF - -#define LESS(a, max_value) ((a) < (max_value) ? (a) : (max_value)) -#define MORE(a, min_value) ((a) > (min_value) ? (a) : (min_value)) -#define INNER(a, b, c) (((b) <= (c) && (a) >= (b) && (a) <= (c)) || ((b) >= (c) && (a) >= (c) && (a) <= (b))) -#define OUTER(a, b, c) (!INNER((a), (b), (c))) -#define MAKESURE(a, b, c) (((b) <= (c)) ? (MORE(LESS((a), (c)), (b))) : (MORE(LESS((a), (b)), (c)))) -#define MIN(a, b) ((a) >= (b) ? (b) : (a)) -#define MAX(a, b) ((a) >= (b) ? (a) : (b)) -#define EQUAL_BOOL(a, b) (((a) && (b)) || ((!(a)) && (!(b)))) - -// Error checking macro -#define OK(val) ((val) == STATUS_SUCCESS) -#define NG(val) (!OK(val)) - -#define MAX_PATH 260 -#define MAX_SIZE 512 -#define STD_SIZE 512 - -#define SL_WHERE SlCrash(__LINE__, __LINE__, __LINE__, __LINE__) -#define SL_CRUSH(x) SlCrash(__LINE__, (UINT)(x), (UINT)(x), (UINT)(x)) - -// Common header -#include "SeLowCommon.h" - - -//// Utility data structure - -// Lock -typedef struct SL_LOCK -{ - NDIS_SPIN_LOCK spin_lock; -} SL_LOCK; - -// Event -typedef struct SL_EVENT -{ - KEVENT *event; - HANDLE event_handle; -} SL_EVENT; - -// Unicode string -typedef struct SL_UNICODE -{ - UNICODE_STRING String; -} SL_UNICODE; - -// NDIS packet buffer -typedef struct SL_PACKET_BUFFER -{ - NDIS_HANDLE NetBufferListPool; // NET_BUFFER_LIST Pool - NET_BUFFER_LIST *NetBufferList; // NET_BUFFER_LIST -} SL_PACKET_BUFFER; - -// List -typedef struct SL_LIST -{ - UINT num_item, num_reserved; - void **p; - SL_LOCK *lock; -} SL_LIST; - -#define SL_LIST_DATA(o, i) (((o) != NULL) ? ((o)->p[(i)]) : NULL) -#define SL_LIST_NUM(o) (((o) != NULL) ? (o)->num_item : 0) -#define SL_INIT_NUM_RESERVED 32 - -//// SL data structure - -// Packet queue -typedef struct SL_PACKET -{ - UCHAR Data[SL_MAX_PACKET_SIZE]; // Data - UINT Size; // Size - - struct SL_PACKET *Next; // Next packet -} SL_PACKET; - -// File context -typedef struct SL_FILE -{ - struct SL_DEVICE *Device; // Device - struct SL_ADAPTER *Adapter; // Adapter - FILE_OBJECT *FileObject; // File object - SL_EVENT *Event; // Event - char EventNameWin32[SL_EVENT_NAME_SIZE]; // Win32 event name - - SL_LOCK *RecvLock; // Receive lock - SL_PACKET *RecvPacketHead; // Head of the received packet - SL_PACKET *RecvPacketTail; // Tail of the received packet - UINT NumRecvPackets; // Number of items of the received packet queue - NDIS_HANDLE NetBufferListPool; // NET_BUFFER_LIST Pool - volatile UINT NumSendingPackets; // Number of packets being transmitted - bool SetEventFlag; // Flag to set an event - bool FinalWakeUp; -} SL_FILE; - -// Device context -typedef struct SL_DEVICE -{ - DEVICE_OBJECT *DeviceObject; // Device object - SL_UNICODE *DeviceName; // Device name - SL_UNICODE *SymbolicLinkName; // Symbolic link name - volatile bool Halting; // Halting - - bool IsBasicDevice; // Whether basic device - struct SL_ADAPTER *Adapter; // Adapter - - SL_LIST *FileList; // File List - SL_LOCK *OpenCloseLock; // Open / Close lock of the device -} SL_DEVICE; - -// Adapter context -typedef struct SL_ADAPTER -{ - volatile bool Halt; // Halt flag - volatile bool Ready; // Ready flag - SL_UNICODE *AdapterName; // Adapter name - NDIS_BIND_PARAMETERS BindParamCopy; // Copy of the bind parameters - UCHAR MacAddress[6]; // MAC address - UINT MtuSize; // MTU size - wchar_t AdapterId[SL_ADAPTER_ID_LEN]; // Adapter ID - volatile bool IsOpenPending; // Whether Open is Pending - volatile bool IsClosePending; // Whether Close is Pending - NDIS_HANDLE BindingContext; // Binding context - NDIS_HANDLE AdapterHandle; // Handle of the adapter - NDIS_HANDLE AdapterHandle2; // Handle of the adapter (receive-only) - NDIS_HANDLE UnbindContext; // Unbind context - SL_LOCK *Lock; // Lock object - volatile UINT NumPendingOidRequests; // Number of running OID requests - volatile UINT NumPendingSendPackets; // Number of packets being transmitted - UCHAR TmpBuffer[SL_MAX_PACKET_SIZE]; // Temporally buffer size - char FriendlyName[256]; // Adapter name - bool SupportVLan; // Supporting VLAN by hardware - - SL_DEVICE *Device; // Handle of the device -} SL_ADAPTER; - -// SL context -typedef struct SL_CTX -{ - DRIVER_OBJECT *DriverObject; // Driver object - NDIS_HANDLE ProtocolHandle; // NDIS protocol handle - SL_DEVICE *BasicDevice; // Basic device - SL_LIST *AdapterList; // Adapter list - - volatile UINT IntCounter1; - UINT DummyInt; - volatile bool IsEnumCompleted; // Enumeration completion flag - volatile UINT NumBoundAdapters; -} SL_CTX; - - -//// SL function -NDIS_STATUS DriverEntry(DRIVER_OBJECT *driver_object, UNICODE_STRING *registry_path); - -NTSTATUS SlDeviceOpenProc(DEVICE_OBJECT *device_object, IRP *irp); -NTSTATUS SlDeviceCloseProc(DEVICE_OBJECT *device_object, IRP *irp); -NTSTATUS SlDeviceReadProc(DEVICE_OBJECT *device_object, IRP *irp); -NTSTATUS SlDeviceWriteProc(DEVICE_OBJECT *device_object, IRP *irp); -NTSTATUS SlDeviceIoControlProc(DEVICE_OBJECT *device_object, IRP *irp); - -void SlUnloadProc(DRIVER_OBJECT *driver_object); - -NDIS_STATUS SlNdisBindAdapterExProc(NDIS_HANDLE protocol_driver_context, NDIS_HANDLE bind_context, NDIS_BIND_PARAMETERS *bind_parameters); -NDIS_STATUS SlNdisUnbindAdapterExProc(NDIS_HANDLE unbind_context, NDIS_HANDLE protocol_binding_context); -void SlNdisOpenAdapterCompleteExProc(NDIS_HANDLE protocol_binding_context, NDIS_STATUS status); -void SlNdisCloseAdapterCompleteExProc(NDIS_HANDLE protocol_binding_context); -NDIS_STATUS SlNdisNetPnPEventProc(NDIS_HANDLE protocol_binding_context, NET_PNP_EVENT_NOTIFICATION *net_pnp_event); -void SlNdisUninstallProc(void); -void SlNdisOidRequestCompleteProc(NDIS_HANDLE protocol_binding_context, NDIS_OID_REQUEST *oid_request, NDIS_STATUS status); -void SlNdisStatusExProc(NDIS_HANDLE protocol_binding_context, NDIS_STATUS_INDICATION *status_indication); -void SlNdisReceiveNetBufferListsProc(NDIS_HANDLE protocol_binding_context, NET_BUFFER_LIST *net_buffer_lists, NDIS_PORT_NUMBER port_number, ULONG NumberOfNetBufferLists, ULONG receive_flags); -void SlNdisSendNetBufferListsCompleteProc(NDIS_HANDLE protocol_binding_context, NET_BUFFER_LIST *net_buffer_lists, ULONG send_complete_flags); - -SL_DEVICE *SlNewDevice(char *device_name, char *symbolic_link_name); -SL_DEVICE *SlNewDeviceUnicode(SL_UNICODE *u_device_name, SL_UNICODE *u_sym_name); -void SlFreeDevice(SL_DEVICE *dev); -void SlFreeAdapter(SL_ADAPTER *a); - -void SlSendOidRequest(SL_ADAPTER *a, bool set, NDIS_OID oid, void *data, UINT size); - -//// Utility function -void *SlMalloc(UINT size); -void *SlZeroMalloc(UINT size); -void SlFree(void *p); -void SlCopy(void *dst, void *src, UINT size); -void SlZero(void *dst, UINT size); -SL_LOCK *SlNewLock(); -void SlLock(SL_LOCK *lock); -void SlUnlock(SL_LOCK *lock); -void SlFreeLock(SL_LOCK *lock); -SL_EVENT *SlNewEvent(char *name); -void SlFreeEvent(SL_EVENT *event); -void SlSet(SL_EVENT *event); -void SlReset(SL_EVENT *event); -SL_UNICODE *SlNewUnicode(char *str); -SL_UNICODE *SlNewUnicodeFromUnicodeString(UNICODE_STRING *src); -void SlFreeUnicode(SL_UNICODE *u); -NDIS_STRING *SlGetUnicode(SL_UNICODE *u); -void SlCrash(UINT a, UINT b, UINT c, UINT d); -SL_LIST *SlNewList(); -void SlAdd(SL_LIST *o, void *p); -bool SlDelete(SL_LIST *o, void *p); -void SlDeleteAll(SL_LIST *o); -void SlLockList(SL_LIST *o); -void SlUnlockList(SL_LIST *o); -void SlFreeList(SL_LIST *o); -void *SlClone(void *p, UINT size); -void SlSleep(int milliSeconds); - - - - -#endif // SELOW_H - +// SoftEther VPN Source Code - Developer Edition Master Branch +// SeLow - SoftEther Lightweight Network Protocol + + +// SeLow.h +// Header of SeLow.c + +#ifndef SELOW_H +#define SELOW_H + +// Win32 DDK related +#ifndef CPU_64 +#define _X86_ +#else // CPU_64 +#ifndef NEO_IA64 +#define _AMD64_ +#define AMD64 +#else // NEO_IA64 +#define _IA64_ +#define IA64 +#endif // NEO_IA64 +#endif // CPU_64 +#define NDIS_MINIPORT_DRIVER +// NDIS 6.2 +#define NDIS620_MINIPORT +#define NDIS_SUPPORT_NDIS61 1 +#define NDIS_SUPPORT_NDIS620 1 +#define NEO_NDIS_MAJOR_VERSION 6 +#define NEO_NDIS_MINOR_VERSION 20 +#define NDIS_WDM 1 + +#include +#include +#include +#include +#include + +// OS determination +#ifdef WIN32 +#define OS_WIN32 // Microsoft Windows +#else +#define OS_UNIX // UNIX / Linux +#endif + + +// Type declaration +#ifndef WINDOWS_H_INCLUDED +#ifndef WIN9X +typedef unsigned long BOOL; +#endif // WIN9X +#define TRUE 1 +#define FALSE 0 +#endif +typedef unsigned long bool; +#define true 1 +#define false 0 +typedef unsigned long long UINT64; +typedef signed long long INT64; +typedef unsigned short WORD; +typedef unsigned short USHORT; +typedef signed short SHORT; +typedef unsigned char BYTE; +typedef unsigned char UCHAR; +typedef signed char CHAR; +typedef unsigned long DWORD; +#define INFINITE 0xFFFFFFFF + +#define LESS(a, max_value) ((a) < (max_value) ? (a) : (max_value)) +#define MORE(a, min_value) ((a) > (min_value) ? (a) : (min_value)) +#define INNER(a, b, c) (((b) <= (c) && (a) >= (b) && (a) <= (c)) || ((b) >= (c) && (a) >= (c) && (a) <= (b))) +#define OUTER(a, b, c) (!INNER((a), (b), (c))) +#define MAKESURE(a, b, c) (((b) <= (c)) ? (MORE(LESS((a), (c)), (b))) : (MORE(LESS((a), (b)), (c)))) +#define MIN(a, b) ((a) >= (b) ? (b) : (a)) +#define MAX(a, b) ((a) >= (b) ? (a) : (b)) +#define EQUAL_BOOL(a, b) (((a) && (b)) || ((!(a)) && (!(b)))) + +// Error checking macro +#define OK(val) ((val) == STATUS_SUCCESS) +#define NG(val) (!OK(val)) + +#define MAX_PATH 260 +#define MAX_SIZE 512 +#define STD_SIZE 512 + +#define SL_WHERE SlCrash(__LINE__, __LINE__, __LINE__, __LINE__) +#define SL_CRUSH(x) SlCrash(__LINE__, (UINT)(x), (UINT)(x), (UINT)(x)) + +// Common header +#include "SeLowCommon.h" + + +//// Utility data structure + +// Lock +typedef struct SL_LOCK +{ + NDIS_SPIN_LOCK spin_lock; +} SL_LOCK; + +// Event +typedef struct SL_EVENT +{ + KEVENT *event; + HANDLE event_handle; +} SL_EVENT; + +// Unicode string +typedef struct SL_UNICODE +{ + UNICODE_STRING String; +} SL_UNICODE; + +// NDIS packet buffer +typedef struct SL_PACKET_BUFFER +{ + NDIS_HANDLE NetBufferListPool; // NET_BUFFER_LIST Pool + NET_BUFFER_LIST *NetBufferList; // NET_BUFFER_LIST +} SL_PACKET_BUFFER; + +// List +typedef struct SL_LIST +{ + UINT num_item, num_reserved; + void **p; + SL_LOCK *lock; +} SL_LIST; + +#define SL_LIST_DATA(o, i) (((o) != NULL) ? ((o)->p[(i)]) : NULL) +#define SL_LIST_NUM(o) (((o) != NULL) ? (o)->num_item : 0) +#define SL_INIT_NUM_RESERVED 32 + +//// SL data structure + +// Packet queue +typedef struct SL_PACKET +{ + UCHAR Data[SL_MAX_PACKET_SIZE]; // Data + UINT Size; // Size + + struct SL_PACKET *Next; // Next packet +} SL_PACKET; + +// File context +typedef struct SL_FILE +{ + struct SL_DEVICE *Device; // Device + struct SL_ADAPTER *Adapter; // Adapter + FILE_OBJECT *FileObject; // File object + SL_EVENT *Event; // Event + char EventNameWin32[SL_EVENT_NAME_SIZE]; // Win32 event name + + SL_LOCK *RecvLock; // Receive lock + SL_PACKET *RecvPacketHead; // Head of the received packet + SL_PACKET *RecvPacketTail; // Tail of the received packet + UINT NumRecvPackets; // Number of items of the received packet queue + NDIS_HANDLE NetBufferListPool; // NET_BUFFER_LIST Pool + volatile UINT NumSendingPackets; // Number of packets being transmitted + bool SetEventFlag; // Flag to set an event + bool FinalWakeUp; +} SL_FILE; + +// Device context +typedef struct SL_DEVICE +{ + DEVICE_OBJECT *DeviceObject; // Device object + SL_UNICODE *DeviceName; // Device name + SL_UNICODE *SymbolicLinkName; // Symbolic link name + volatile bool Halting; // Halting + + bool IsBasicDevice; // Whether basic device + struct SL_ADAPTER *Adapter; // Adapter + + SL_LIST *FileList; // File List + SL_LOCK *OpenCloseLock; // Open / Close lock of the device +} SL_DEVICE; + +// Adapter context +typedef struct SL_ADAPTER +{ + volatile bool Halt; // Halt flag + volatile bool Ready; // Ready flag + SL_UNICODE *AdapterName; // Adapter name + NDIS_BIND_PARAMETERS BindParamCopy; // Copy of the bind parameters + UCHAR MacAddress[6]; // MAC address + UINT MtuSize; // MTU size + wchar_t AdapterId[SL_ADAPTER_ID_LEN]; // Adapter ID + volatile bool IsOpenPending; // Whether Open is Pending + volatile bool IsClosePending; // Whether Close is Pending + NDIS_HANDLE BindingContext; // Binding context + NDIS_HANDLE AdapterHandle; // Handle of the adapter + NDIS_HANDLE AdapterHandle2; // Handle of the adapter (receive-only) + NDIS_HANDLE UnbindContext; // Unbind context + SL_LOCK *Lock; // Lock object + volatile UINT NumPendingOidRequests; // Number of running OID requests + volatile UINT NumPendingSendPackets; // Number of packets being transmitted + UCHAR TmpBuffer[SL_MAX_PACKET_SIZE]; // Temporally buffer size + char FriendlyName[256]; // Adapter name + bool SupportVLan; // Supporting VLAN by hardware + + SL_DEVICE *Device; // Handle of the device +} SL_ADAPTER; + +// SL context +typedef struct SL_CTX +{ + DRIVER_OBJECT *DriverObject; // Driver object + NDIS_HANDLE ProtocolHandle; // NDIS protocol handle + SL_DEVICE *BasicDevice; // Basic device + SL_LIST *AdapterList; // Adapter list + + volatile UINT IntCounter1; + UINT DummyInt; + volatile bool IsEnumCompleted; // Enumeration completion flag + volatile UINT NumBoundAdapters; +} SL_CTX; + + +//// SL function +NDIS_STATUS DriverEntry(DRIVER_OBJECT *driver_object, UNICODE_STRING *registry_path); + +NTSTATUS SlDeviceOpenProc(DEVICE_OBJECT *device_object, IRP *irp); +NTSTATUS SlDeviceCloseProc(DEVICE_OBJECT *device_object, IRP *irp); +NTSTATUS SlDeviceReadProc(DEVICE_OBJECT *device_object, IRP *irp); +NTSTATUS SlDeviceWriteProc(DEVICE_OBJECT *device_object, IRP *irp); +NTSTATUS SlDeviceIoControlProc(DEVICE_OBJECT *device_object, IRP *irp); + +void SlUnloadProc(DRIVER_OBJECT *driver_object); + +NDIS_STATUS SlNdisBindAdapterExProc(NDIS_HANDLE protocol_driver_context, NDIS_HANDLE bind_context, NDIS_BIND_PARAMETERS *bind_parameters); +NDIS_STATUS SlNdisUnbindAdapterExProc(NDIS_HANDLE unbind_context, NDIS_HANDLE protocol_binding_context); +void SlNdisOpenAdapterCompleteExProc(NDIS_HANDLE protocol_binding_context, NDIS_STATUS status); +void SlNdisCloseAdapterCompleteExProc(NDIS_HANDLE protocol_binding_context); +NDIS_STATUS SlNdisNetPnPEventProc(NDIS_HANDLE protocol_binding_context, NET_PNP_EVENT_NOTIFICATION *net_pnp_event); +void SlNdisUninstallProc(void); +void SlNdisOidRequestCompleteProc(NDIS_HANDLE protocol_binding_context, NDIS_OID_REQUEST *oid_request, NDIS_STATUS status); +void SlNdisStatusExProc(NDIS_HANDLE protocol_binding_context, NDIS_STATUS_INDICATION *status_indication); +void SlNdisReceiveNetBufferListsProc(NDIS_HANDLE protocol_binding_context, NET_BUFFER_LIST *net_buffer_lists, NDIS_PORT_NUMBER port_number, ULONG NumberOfNetBufferLists, ULONG receive_flags); +void SlNdisSendNetBufferListsCompleteProc(NDIS_HANDLE protocol_binding_context, NET_BUFFER_LIST *net_buffer_lists, ULONG send_complete_flags); + +SL_DEVICE *SlNewDevice(char *device_name, char *symbolic_link_name); +SL_DEVICE *SlNewDeviceUnicode(SL_UNICODE *u_device_name, SL_UNICODE *u_sym_name); +void SlFreeDevice(SL_DEVICE *dev); +void SlFreeAdapter(SL_ADAPTER *a); + +void SlSendOidRequest(SL_ADAPTER *a, bool set, NDIS_OID oid, void *data, UINT size); + +//// Utility function +void *SlMalloc(UINT size); +void *SlZeroMalloc(UINT size); +void SlFree(void *p); +void SlCopy(void *dst, void *src, UINT size); +void SlZero(void *dst, UINT size); +SL_LOCK *SlNewLock(); +void SlLock(SL_LOCK *lock); +void SlUnlock(SL_LOCK *lock); +void SlFreeLock(SL_LOCK *lock); +SL_EVENT *SlNewEvent(char *name); +void SlFreeEvent(SL_EVENT *event); +void SlSet(SL_EVENT *event); +void SlReset(SL_EVENT *event); +SL_UNICODE *SlNewUnicode(char *str); +SL_UNICODE *SlNewUnicodeFromUnicodeString(UNICODE_STRING *src); +void SlFreeUnicode(SL_UNICODE *u); +NDIS_STRING *SlGetUnicode(SL_UNICODE *u); +void SlCrash(UINT a, UINT b, UINT c, UINT d); +SL_LIST *SlNewList(); +void SlAdd(SL_LIST *o, void *p); +bool SlDelete(SL_LIST *o, void *p); +void SlDeleteAll(SL_LIST *o); +void SlLockList(SL_LIST *o); +void SlUnlockList(SL_LIST *o); +void SlFreeList(SL_LIST *o); +void *SlClone(void *p, UINT size); +void SlSleep(int milliSeconds); + + + + +#endif // SELOW_H + diff --git a/src/SeLow/SeLow.rc b/src/SeLow/SeLow.rc index 2e72f111..0a6896d5 100644 --- a/src/SeLow/SeLow.rc +++ b/src/SeLow/SeLow.rc @@ -1,63 +1,63 @@ -// 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 - -///////////////////////////////////////////////////////////////////////////// -// Japanese resources - -#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_JPN) -#ifdef _WIN32 -LANGUAGE LANG_JAPANESE, SUBLANG_DEFAULT -#pragma code_page(932) -#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 - -#endif // Japanese resources -///////////////////////////////////////////////////////////////////////////// - - - -#ifndef APSTUDIO_INVOKED -///////////////////////////////////////////////////////////////////////////// -// -// Generated from the TEXTINCLUDE 3 resource. -// - - -///////////////////////////////////////////////////////////////////////////// -#endif // not APSTUDIO_INVOKED - +// 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 + +///////////////////////////////////////////////////////////////////////////// +// Japanese resources + +#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_JPN) +#ifdef _WIN32 +LANGUAGE LANG_JAPANESE, SUBLANG_DEFAULT +#pragma code_page(932) +#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 + +#endif // Japanese resources +///////////////////////////////////////////////////////////////////////////// + + + +#ifndef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 3 resource. +// + + +///////////////////////////////////////////////////////////////////////////// +#endif // not APSTUDIO_INVOKED + diff --git a/src/SeLow/SeLow.vcproj b/src/SeLow/SeLow.vcproj index 6af61bb6..3249e408 100644 --- a/src/SeLow/SeLow.vcproj +++ b/src/SeLow/SeLow.vcproj @@ -1,278 +1,278 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/SeLow/SeLowCommon.h b/src/SeLow/SeLowCommon.h index ac0a51cf..37efccf8 100644 --- a/src/SeLow/SeLowCommon.h +++ b/src/SeLow/SeLowCommon.h @@ -1,97 +1,97 @@ -// SoftEther VPN Source Code - Developer Edition Master Branch -// SeLow - SoftEther Lightweight Network Protocol - - -// SeLowCommon.h -// Common Header for Kernel Mode / User Mode - -//// Version number -// Change this number every time functions are added or modified on the driver. -// As long as this number does not change, installation of SeLow during the update -// installation of the VPN Server / VPN Client / VPN Bridge is skipped. -#define SL_VER 48 - -// Constants -#define SL_MAX_PACKET_SIZE 1600 -#define SL_MAX_PACKET_SIZE_ANNOUNCE 1514 -#define SL_MIN_PACKET_SIZE 14 -#define SL_PACKET_HEADER_SIZE 14 -#define SL_MAX_FRAME_SIZE (SL_MAX_PACKET_SIZE - SL_MIN_PACKET_SIZE) - -#define SL_PROTOCOL_NAME "SeLow" -#define SL_EVENT_NAME_SIZE 128 - -#define SL_ENUM_COMPLETE_GIVEUP_TICK (15 * 1000) - -// IOCTL -#define SL_IOCTL_GET_EVENT_NAME CTL_CODE(0x8000, 1, METHOD_NEITHER, FILE_ANY_ACCESS) - -// IOCTL data structure -typedef struct SL_IOCTL_EVENT_NAME -{ - char EventNameWin32[SL_EVENT_NAME_SIZE]; // Event name -} SL_IOCTL_EVENT_NAME; - -// Device ID -#define SL_BASIC_DEVICE_NAME "\\Device\\SELOW_BASIC_DEVICE" -#define SL_BASIC_DEVICE_NAME_SYMBOLIC "\\DosDevices\\Global\\SELOW_BASIC_DEVICE" -#define SL_BASIC_DEVICE_FILENAME_WIN32 "\\\\.\\SELOW_BASIC_DEVICE" -#define SL_ADAPTER_ID_PREFIX "SELOW_A_" -#define SL_ADAPTER_ID_PREFIX_W L"SELOW_A_" -#define SL_ADAPTER_DEVICE_NAME "\\Device\\SELOW_A_{00000000-0000-0000-0000-000000000000}" -#define SL_ADAPTER_DEVICE_NAME_SYMBOLIC "\\DosDevices\\Global\\SELOW_A_{00000000-0000-0000-0000-000000000000}" -#define SL_ADAPTER_DEVICE_FILENAME_WIN32 "\\\\.\\%s" - -// Event name -#define SL_EVENT_NAME "\\BaseNamedObjects\\SELOW_EVENT_%u_%u" -#define SL_EVENT_NAME_WIN32 "Global\\SELOW_EVENT_%u_%u" - -// Registry key -#define SL_REG_KEY_NAME "SYSTEM\\CurrentControlSet\\services\\SeLow" -#define SL_REG_VER_VALUE "SlVersion" -#define SL_REG_VER_VALUE_WIN10 "SlVersion_Win10" - -// Adapter data -#define SL_ADAPTER_ID_LEN 64 -typedef struct SL_ADAPTER_INFO -{ - wchar_t AdapterId[SL_ADAPTER_ID_LEN]; // Adapter ID - UCHAR MacAddress[6]; // MAC address - UCHAR Padding1[2]; - UINT MtuSize; // MTU size - char FriendlyName[256]; // Display name - UINT SupportsVLanHw; // Supports VLAN by HW - UCHAR Reserved[256 - sizeof(UINT)]; // Reserved area -} SL_ADAPTER_INFO; - -#define SL_MAX_ADAPTER_INFO_LIST_ENTRY 256 -#define SL_SIGNATURE 0xDEADBEEF - -typedef struct SL_ADAPTER_INFO_LIST -{ - UINT Signature; // Signature - UINT SeLowVersion; // Version of SeLow - UINT EnumCompleted; // Enumeration completion flag - UINT NumAdapters; // The total number of adapter - SL_ADAPTER_INFO Adapters[SL_MAX_ADAPTER_INFO_LIST_ENTRY]; // Array of adapter -} SL_ADAPTER_INFO_LIST; - - -// Packet data exchange related -#define SL_MAX_PACKET_EXCHANGE 256 // Number of packets that can be exchanged at a time -#define SL_MAX_PACKET_QUEUED 4096 // Maximum number of packets that can be queued -#define SL_EX_SIZEOF_NUM_PACKET 4 // Packet count data (UINT) -#define SL_EX_SIZEOF_LENGTH_PACKET 4 // Length data of the packet data (UINT) -#define SL_EX_SIZEOF_LEFT_FLAG 4 // Flag to indicate that the packet is left -#define SL_EX_SIZEOF_ONE_PACKET 1600 // Data area occupied by a packet data -#define SL_EXCHANGE_BUFFER_SIZE (SL_EX_SIZEOF_NUM_PACKET + SL_EX_SIZEOF_LEFT_FLAG + \ - (SL_EX_SIZEOF_LENGTH_PACKET + SL_EX_SIZEOF_ONE_PACKET) * (SL_MAX_PACKET_EXCHANGE + 1)) -#define SL_NUM_PACKET(buf) (*((UINT *)((UCHAR *)buf + 0))) -#define SL_SIZE_OF_PACKET(buf, i) (*((UINT *)((UCHAR *)buf + SL_EX_SIZEOF_NUM_PACKET + \ - (i * (SL_EX_SIZEOF_LENGTH_PACKET + SL_EX_SIZEOF_ONE_PACKET))))) -#define SL_ADDR_OF_PACKET(buf, i) (((UINT *)((UCHAR *)buf + SL_EX_SIZEOF_NUM_PACKET + \ - SL_EX_SIZEOF_LENGTH_PACKET + \ - (i * (SL_EX_SIZEOF_LENGTH_PACKET + SL_EX_SIZEOF_ONE_PACKET))))) -#define SL_LEFT_FLAG(buf) SL_SIZE_OF_PACKET(buf, SL_MAX_PACKET_EXCHANGE) - - +// SoftEther VPN Source Code - Developer Edition Master Branch +// SeLow - SoftEther Lightweight Network Protocol + + +// SeLowCommon.h +// Common Header for Kernel Mode / User Mode + +//// Version number +// Change this number every time functions are added or modified on the driver. +// As long as this number does not change, installation of SeLow during the update +// installation of the VPN Server / VPN Client / VPN Bridge is skipped. +#define SL_VER 48 + +// Constants +#define SL_MAX_PACKET_SIZE 1600 +#define SL_MAX_PACKET_SIZE_ANNOUNCE 1514 +#define SL_MIN_PACKET_SIZE 14 +#define SL_PACKET_HEADER_SIZE 14 +#define SL_MAX_FRAME_SIZE (SL_MAX_PACKET_SIZE - SL_MIN_PACKET_SIZE) + +#define SL_PROTOCOL_NAME "SeLow" +#define SL_EVENT_NAME_SIZE 128 + +#define SL_ENUM_COMPLETE_GIVEUP_TICK (15 * 1000) + +// IOCTL +#define SL_IOCTL_GET_EVENT_NAME CTL_CODE(0x8000, 1, METHOD_NEITHER, FILE_ANY_ACCESS) + +// IOCTL data structure +typedef struct SL_IOCTL_EVENT_NAME +{ + char EventNameWin32[SL_EVENT_NAME_SIZE]; // Event name +} SL_IOCTL_EVENT_NAME; + +// Device ID +#define SL_BASIC_DEVICE_NAME "\\Device\\SELOW_BASIC_DEVICE" +#define SL_BASIC_DEVICE_NAME_SYMBOLIC "\\DosDevices\\Global\\SELOW_BASIC_DEVICE" +#define SL_BASIC_DEVICE_FILENAME_WIN32 "\\\\.\\SELOW_BASIC_DEVICE" +#define SL_ADAPTER_ID_PREFIX "SELOW_A_" +#define SL_ADAPTER_ID_PREFIX_W L"SELOW_A_" +#define SL_ADAPTER_DEVICE_NAME "\\Device\\SELOW_A_{00000000-0000-0000-0000-000000000000}" +#define SL_ADAPTER_DEVICE_NAME_SYMBOLIC "\\DosDevices\\Global\\SELOW_A_{00000000-0000-0000-0000-000000000000}" +#define SL_ADAPTER_DEVICE_FILENAME_WIN32 "\\\\.\\%s" + +// Event name +#define SL_EVENT_NAME "\\BaseNamedObjects\\SELOW_EVENT_%u_%u" +#define SL_EVENT_NAME_WIN32 "Global\\SELOW_EVENT_%u_%u" + +// Registry key +#define SL_REG_KEY_NAME "SYSTEM\\CurrentControlSet\\services\\SeLow" +#define SL_REG_VER_VALUE "SlVersion" +#define SL_REG_VER_VALUE_WIN10 "SlVersion_Win10" + +// Adapter data +#define SL_ADAPTER_ID_LEN 64 +typedef struct SL_ADAPTER_INFO +{ + wchar_t AdapterId[SL_ADAPTER_ID_LEN]; // Adapter ID + UCHAR MacAddress[6]; // MAC address + UCHAR Padding1[2]; + UINT MtuSize; // MTU size + char FriendlyName[256]; // Display name + UINT SupportsVLanHw; // Supports VLAN by HW + UCHAR Reserved[256 - sizeof(UINT)]; // Reserved area +} SL_ADAPTER_INFO; + +#define SL_MAX_ADAPTER_INFO_LIST_ENTRY 256 +#define SL_SIGNATURE 0xDEADBEEF + +typedef struct SL_ADAPTER_INFO_LIST +{ + UINT Signature; // Signature + UINT SeLowVersion; // Version of SeLow + UINT EnumCompleted; // Enumeration completion flag + UINT NumAdapters; // The total number of adapter + SL_ADAPTER_INFO Adapters[SL_MAX_ADAPTER_INFO_LIST_ENTRY]; // Array of adapter +} SL_ADAPTER_INFO_LIST; + + +// Packet data exchange related +#define SL_MAX_PACKET_EXCHANGE 256 // Number of packets that can be exchanged at a time +#define SL_MAX_PACKET_QUEUED 4096 // Maximum number of packets that can be queued +#define SL_EX_SIZEOF_NUM_PACKET 4 // Packet count data (UINT) +#define SL_EX_SIZEOF_LENGTH_PACKET 4 // Length data of the packet data (UINT) +#define SL_EX_SIZEOF_LEFT_FLAG 4 // Flag to indicate that the packet is left +#define SL_EX_SIZEOF_ONE_PACKET 1600 // Data area occupied by a packet data +#define SL_EXCHANGE_BUFFER_SIZE (SL_EX_SIZEOF_NUM_PACKET + SL_EX_SIZEOF_LEFT_FLAG + \ + (SL_EX_SIZEOF_LENGTH_PACKET + SL_EX_SIZEOF_ONE_PACKET) * (SL_MAX_PACKET_EXCHANGE + 1)) +#define SL_NUM_PACKET(buf) (*((UINT *)((UCHAR *)buf + 0))) +#define SL_SIZE_OF_PACKET(buf, i) (*((UINT *)((UCHAR *)buf + SL_EX_SIZEOF_NUM_PACKET + \ + (i * (SL_EX_SIZEOF_LENGTH_PACKET + SL_EX_SIZEOF_ONE_PACKET))))) +#define SL_ADDR_OF_PACKET(buf, i) (((UINT *)((UCHAR *)buf + SL_EX_SIZEOF_NUM_PACKET + \ + SL_EX_SIZEOF_LENGTH_PACKET + \ + (i * (SL_EX_SIZEOF_LENGTH_PACKET + SL_EX_SIZEOF_ONE_PACKET))))) +#define SL_LEFT_FLAG(buf) SL_SIZE_OF_PACKET(buf, SL_MAX_PACKET_EXCHANGE) + + diff --git a/src/SeLow/resource.h b/src/SeLow/resource.h index 60389936..cf989203 100644 --- a/src/SeLow/resource.h +++ b/src/SeLow/resource.h @@ -1,15 +1,15 @@ -//{{NO_DEPENDENCIES}} -// Microsoft Visual C++ generated include file. -// Used by Neo.rc - - -// Next default values for new objects -// -#ifdef APSTUDIO_INVOKED -#ifndef APSTUDIO_READONLY_SYMBOLS -#define _APS_NEXT_RESOURCE_VALUE 101 -#define _APS_NEXT_COMMAND_VALUE 40001 -#define _APS_NEXT_CONTROL_VALUE 1001 -#define _APS_NEXT_SYMED_VALUE 101 -#endif -#endif +//{{NO_DEPENDENCIES}} +// Microsoft Visual C++ generated include file. +// Used by Neo.rc + + +// Next default values for new objects +// +#ifdef APSTUDIO_INVOKED +#ifndef APSTUDIO_READONLY_SYMBOLS +#define _APS_NEXT_RESOURCE_VALUE 101 +#define _APS_NEXT_COMMAND_VALUE 40001 +#define _APS_NEXT_CONTROL_VALUE 1001 +#define _APS_NEXT_SYMED_VALUE 101 +#endif +#endif diff --git a/src/See/DEBUG.H b/src/See/DEBUG.H index ef8174d4..ae550e4e 100644 --- a/src/See/DEBUG.H +++ b/src/See/DEBUG.H @@ -1,63 +1,63 @@ -/* - * Copyright (c) 1999 - 2003 - * NetGroup, Politecnico di Torino (Italy) - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the Politecnico di Torino nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - */ - -#ifndef __DEBUG_INCLUDE -#define __DEBUG_INCLUDE - - -#if DBG - -#define IF_PACKETDEBUG(f) if (PacketDebugFlag & (f)) -extern ULONG PacketDebugFlag; - -#define PACKET_DEBUG_LOUD 0x00000001 // debugging info -#define PACKET_DEBUG_VERY_LOUD 0x00000002 // excessive debugging info - -#define PACKET_DEBUG_INIT 0x00000100 // init debugging info - -// -// Macro for deciding whether to dump lots of debugging information. -// - -#define IF_LOUD(A) IF_PACKETDEBUG( PACKET_DEBUG_LOUD ) { A } -#define IF_VERY_LOUD(A) IF_PACKETDEBUG( PACKET_DEBUG_VERY_LOUD ) { A } -#define IF_INIT_LOUD(A) IF_PACKETDEBUG( PACKET_DEBUG_INIT ) { A } - -#else - -#define IF_LOUD(A) -#define IF_VERY_LOUD(A) -#define IF_INIT_LOUD(A) - -#endif - -#endif /*#define __DEBUG_INCLUDE*/ +/* + * Copyright (c) 1999 - 2003 + * NetGroup, Politecnico di Torino (Italy) + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the Politecnico di Torino nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#ifndef __DEBUG_INCLUDE +#define __DEBUG_INCLUDE + + +#if DBG + +#define IF_PACKETDEBUG(f) if (PacketDebugFlag & (f)) +extern ULONG PacketDebugFlag; + +#define PACKET_DEBUG_LOUD 0x00000001 // debugging info +#define PACKET_DEBUG_VERY_LOUD 0x00000002 // excessive debugging info + +#define PACKET_DEBUG_INIT 0x00000100 // init debugging info + +// +// Macro for deciding whether to dump lots of debugging information. +// + +#define IF_LOUD(A) IF_PACKETDEBUG( PACKET_DEBUG_LOUD ) { A } +#define IF_VERY_LOUD(A) IF_PACKETDEBUG( PACKET_DEBUG_VERY_LOUD ) { A } +#define IF_INIT_LOUD(A) IF_PACKETDEBUG( PACKET_DEBUG_INIT ) { A } + +#else + +#define IF_LOUD(A) +#define IF_VERY_LOUD(A) +#define IF_INIT_LOUD(A) + +#endif + +#endif /*#define __DEBUG_INCLUDE*/ diff --git a/src/See/Devioctl.h b/src/See/Devioctl.h index af8784bf..661fda02 100644 --- a/src/See/Devioctl.h +++ b/src/See/Devioctl.h @@ -1,90 +1,90 @@ -/*++ BUILD Version: 0004 // Increment this if a change has global effects - Copyright (c) 1992-1993 Microsoft Corporation - Module Name: - devioctl.h - Revision History: - -- */ -// begin_winioctl -#ifndef _DEVIOCTL_ -#define _DEVIOCTL_ -// begin_ntddk begin_nthal begin_ntifs -// -// Define the various device type values. Note that values used by Microsoft -// Corporation are in the range 0-32767, and 32768-65535 are reserved for use -// by customers. -// -#define DEVICE_TYPE ULONG -#define FILE_DEVICE_BEEP 0x00000001 -#define FILE_DEVICE_CD_ROM 0x00000002 -#define FILE_DEVICE_CD_ROM_FILE_SYSTEM 0x00000003 -#define FILE_DEVICE_CONTROLLER 0x00000004 -#define FILE_DEVICE_DATALINK 0x00000005 -#define FILE_DEVICE_DFS 0x00000006 -#define FILE_DEVICE_DISK 0x00000007 -#define FILE_DEVICE_DISK_FILE_SYSTEM 0x00000008 -#define FILE_DEVICE_FILE_SYSTEM 0x00000009 -#define FILE_DEVICE_INPORT_PORT 0x0000000a -#define FILE_DEVICE_KEYBOARD 0x0000000b -#define FILE_DEVICE_MAILSLOT 0x0000000c -#define FILE_DEVICE_MIDI_IN 0x0000000d -#define FILE_DEVICE_MIDI_OUT 0x0000000e -#define FILE_DEVICE_MOUSE 0x0000000f -#define FILE_DEVICE_MULTI_UNC_PROVIDER 0x00000010 -#define FILE_DEVICE_NAMED_PIPE 0x00000011 -#define FILE_DEVICE_NETWORK 0x00000012 -#define FILE_DEVICE_NETWORK_BROWSER 0x00000013 -#define FILE_DEVICE_NETWORK_FILE_SYSTEM 0x00000014 -#define FILE_DEVICE_NULL 0x00000015 -#define FILE_DEVICE_PARALLEL_PORT 0x00000016 -#define FILE_DEVICE_PHYSICAL_NETCARD 0x00000017 -#define FILE_DEVICE_PRINTER 0x00000018 -#define FILE_DEVICE_SCANNER 0x00000019 -#define FILE_DEVICE_SERIAL_MOUSE_PORT 0x0000001a -#define FILE_DEVICE_SERIAL_PORT 0x0000001b -#define FILE_DEVICE_SCREEN 0x0000001c -#define FILE_DEVICE_SOUND 0x0000001d -#define FILE_DEVICE_STREAMS 0x0000001e -#define FILE_DEVICE_TAPE 0x0000001f -#define FILE_DEVICE_TAPE_FILE_SYSTEM 0x00000020 -#define FILE_DEVICE_TRANSPORT 0x00000021 -#define FILE_DEVICE_UNKNOWN 0x00000022 -#define FILE_DEVICE_VIDEO 0x00000023 -#define FILE_DEVICE_VIRTUAL_DISK 0x00000024 -#define FILE_DEVICE_WAVE_IN 0x00000025 -#define FILE_DEVICE_WAVE_OUT 0x00000026 -#define FILE_DEVICE_8042_PORT 0x00000027 -#define FILE_DEVICE_NETWORK_REDIRECTOR 0x00000028 -#define FILE_DEVICE_BATTERY 0x00000029 -#define FILE_DEVICE_BUS_EXTENDER 0x0000002a -#define FILE_DEVICE_MODEM 0x0000002b -#define FILE_DEVICE_VDM 0x0000002c -#define FILE_DEVICE_MASS_STORAGE 0x0000002d -// -// Macro definition for defining IOCTL and FSCTL function control codes. Note -// that function codes 0-2047 are reserved for Microsoft Corporation, and -// 2048-4095 are reserved for customers. -// -#define CTL_CODE( DeviceType, Function, Method, Access ) ( \ - ((DeviceType) << 16) | ((Access) << 14) | ((Function) << 2) | (Method) \ -) -// -// Define the method codes for how buffers are passed for I/O and FS controls -// -#define METHOD_BUFFERED 0 -#define METHOD_IN_DIRECT 1 -#define METHOD_OUT_DIRECT 2 -#define METHOD_NEITHER 3 -// -// Define the access check value for any access -// -// -// The FILE_READ_ACCESS and FILE_WRITE_ACCESS constants are also defined in -// ntioapi.h as FILE_READ_DATA and FILE_WRITE_DATA. The values for these -// constants *MUST* always be in sync. -// -#define FILE_ANY_ACCESS 0 -#define FILE_READ_ACCESS ( 0x0001 ) // file & pipe -#define FILE_WRITE_ACCESS ( 0x0002 ) // file & pipe -// end_ntddk end_nthal end_ntifs -#endif // _DEVIOCTL_ -// end_winioctl +/*++ BUILD Version: 0004 // Increment this if a change has global effects + Copyright (c) 1992-1993 Microsoft Corporation + Module Name: + devioctl.h + Revision History: + -- */ +// begin_winioctl +#ifndef _DEVIOCTL_ +#define _DEVIOCTL_ +// begin_ntddk begin_nthal begin_ntifs +// +// Define the various device type values. Note that values used by Microsoft +// Corporation are in the range 0-32767, and 32768-65535 are reserved for use +// by customers. +// +#define DEVICE_TYPE ULONG +#define FILE_DEVICE_BEEP 0x00000001 +#define FILE_DEVICE_CD_ROM 0x00000002 +#define FILE_DEVICE_CD_ROM_FILE_SYSTEM 0x00000003 +#define FILE_DEVICE_CONTROLLER 0x00000004 +#define FILE_DEVICE_DATALINK 0x00000005 +#define FILE_DEVICE_DFS 0x00000006 +#define FILE_DEVICE_DISK 0x00000007 +#define FILE_DEVICE_DISK_FILE_SYSTEM 0x00000008 +#define FILE_DEVICE_FILE_SYSTEM 0x00000009 +#define FILE_DEVICE_INPORT_PORT 0x0000000a +#define FILE_DEVICE_KEYBOARD 0x0000000b +#define FILE_DEVICE_MAILSLOT 0x0000000c +#define FILE_DEVICE_MIDI_IN 0x0000000d +#define FILE_DEVICE_MIDI_OUT 0x0000000e +#define FILE_DEVICE_MOUSE 0x0000000f +#define FILE_DEVICE_MULTI_UNC_PROVIDER 0x00000010 +#define FILE_DEVICE_NAMED_PIPE 0x00000011 +#define FILE_DEVICE_NETWORK 0x00000012 +#define FILE_DEVICE_NETWORK_BROWSER 0x00000013 +#define FILE_DEVICE_NETWORK_FILE_SYSTEM 0x00000014 +#define FILE_DEVICE_NULL 0x00000015 +#define FILE_DEVICE_PARALLEL_PORT 0x00000016 +#define FILE_DEVICE_PHYSICAL_NETCARD 0x00000017 +#define FILE_DEVICE_PRINTER 0x00000018 +#define FILE_DEVICE_SCANNER 0x00000019 +#define FILE_DEVICE_SERIAL_MOUSE_PORT 0x0000001a +#define FILE_DEVICE_SERIAL_PORT 0x0000001b +#define FILE_DEVICE_SCREEN 0x0000001c +#define FILE_DEVICE_SOUND 0x0000001d +#define FILE_DEVICE_STREAMS 0x0000001e +#define FILE_DEVICE_TAPE 0x0000001f +#define FILE_DEVICE_TAPE_FILE_SYSTEM 0x00000020 +#define FILE_DEVICE_TRANSPORT 0x00000021 +#define FILE_DEVICE_UNKNOWN 0x00000022 +#define FILE_DEVICE_VIDEO 0x00000023 +#define FILE_DEVICE_VIRTUAL_DISK 0x00000024 +#define FILE_DEVICE_WAVE_IN 0x00000025 +#define FILE_DEVICE_WAVE_OUT 0x00000026 +#define FILE_DEVICE_8042_PORT 0x00000027 +#define FILE_DEVICE_NETWORK_REDIRECTOR 0x00000028 +#define FILE_DEVICE_BATTERY 0x00000029 +#define FILE_DEVICE_BUS_EXTENDER 0x0000002a +#define FILE_DEVICE_MODEM 0x0000002b +#define FILE_DEVICE_VDM 0x0000002c +#define FILE_DEVICE_MASS_STORAGE 0x0000002d +// +// Macro definition for defining IOCTL and FSCTL function control codes. Note +// that function codes 0-2047 are reserved for Microsoft Corporation, and +// 2048-4095 are reserved for customers. +// +#define CTL_CODE( DeviceType, Function, Method, Access ) ( \ + ((DeviceType) << 16) | ((Access) << 14) | ((Function) << 2) | (Method) \ +) +// +// Define the method codes for how buffers are passed for I/O and FS controls +// +#define METHOD_BUFFERED 0 +#define METHOD_IN_DIRECT 1 +#define METHOD_OUT_DIRECT 2 +#define METHOD_NEITHER 3 +// +// Define the access check value for any access +// +// +// The FILE_READ_ACCESS and FILE_WRITE_ACCESS constants are also defined in +// ntioapi.h as FILE_READ_DATA and FILE_WRITE_DATA. The values for these +// constants *MUST* always be in sync. +// +#define FILE_ANY_ACCESS 0 +#define FILE_READ_ACCESS ( 0x0001 ) // file & pipe +#define FILE_WRITE_ACCESS ( 0x0002 ) // file & pipe +// end_ntddk end_nthal end_ntifs +#endif // _DEVIOCTL_ +// end_winioctl diff --git a/src/See/Ntddndis.h b/src/See/Ntddndis.h index 0b629806..77a53d7a 100644 --- a/src/See/Ntddndis.h +++ b/src/See/Ntddndis.h @@ -1,1400 +1,1400 @@ -/*++ BUILD Version: 0001 // Increment this if a change has global effects - Copyright (c) 1990-1993 Microsoft Corporation - Module Name: - ntddndis.h - Abstract: - This is the include file that defines all constants and types for - accessing the Network driver interface device. - Author: - Steve Wood (stevewo) 27-May-1990 - Revision History: - Adam Barr (adamba) 04-Nov-1992 added the correct values for NDIS 3.0. - Jameel Hyder (jameelh) 01-Aug-95 added Pnp IoCTLs and structures - Kyle Brandon (kyleb) 09/24/96 added general co ndis oids. - -- */ -#ifndef _NTDDNDIS_ -#define _NTDDNDIS_ -// -// Device Name - this string is the name of the device. It is the name -// that should be passed to NtOpenFile when accessing the device. -// -// Note: For devices that support multiple units, it should be suffixed -// with the Ascii representation of the unit number. -// -#define DD_NDIS_DEVICE_NAME "\\Device\\UNKNOWN" -// -// NtDeviceIoControlFile IoControlCode values for this device. -// -// Warning: Remember that the low two bits of the code specify how the -// buffers are passed to the driver! -// -#define _NDIS_CONTROL_CODE(request,method) \ - CTL_CODE(FILE_DEVICE_PHYSICAL_NETCARD, request, method, FILE_ANY_ACCESS) -#define IOCTL_NDIS_QUERY_GLOBAL_STATS _NDIS_CONTROL_CODE( 0, METHOD_OUT_DIRECT ) -#define IOCTL_NDIS_QUERY_ALL_STATS _NDIS_CONTROL_CODE( 1, METHOD_OUT_DIRECT ) -#define IOCTL_NDIS_ADD_DEVICE _NDIS_CONTROL_CODE( 2, METHOD_BUFFERED ) -#define IOCTL_NDIS_DELETE_DEVICE _NDIS_CONTROL_CODE( 3, METHOD_BUFFERED ) -#define IOCTL_NDIS_TRANSLATE_NAME _NDIS_CONTROL_CODE( 4, METHOD_BUFFERED ) -#define IOCTL_NDIS_ADD_TDI_DEVICE _NDIS_CONTROL_CODE( 5, METHOD_BUFFERED ) -#define IOCTL_NDIS_NOTIFY_PROTOCOL _NDIS_CONTROL_CODE( 6, METHOD_BUFFERED ) -#define IOCTL_NDIS_GET_LOG_DATA _NDIS_CONTROL_CODE( 7, METHOD_OUT_DIRECT ) -// -// NtDeviceIoControlFile InputBuffer/OutputBuffer record structures for -// this device. -// -// -// This is the type of an NDIS OID value. -// -typedef ULONG NDIS_OID, *PNDIS_OID; -// -// IOCTL_NDIS_QUERY_ALL_STATS returns a sequence of these, packed -// together (no padding is required since statistics all have -// four or eight bytes of data). -// -typedef struct _NDIS_STATISTICS_VALUE { - NDIS_OID Oid; - ULONG DataLength; - UCHAR Data[1]; // variable length - -} NDIS_STATISTICS_VALUE, *PNDIS_STATISTICS_VALUE; - -// -// Structure used by TRANSLATE_NAME IOCTL -// -typedef struct _NET_PNP_ID { - ULONG ClassId; - ULONG Token; -} NET_PNP_ID, *PNET_PNP_ID; - -typedef struct _NET_PNP_TRANSLATE_LIST { - ULONG BytesNeeded; - NET_PNP_ID IdArray[ANYSIZE_ARRAY]; -} NET_PNP_TRANSLATE_LIST, *PNET_PNP_TRANSLATE_LIST; - -// -// Structure used to define a self-contained variable data structure -// -typedef struct _NDIS_VAR_DATA_DESC { - USHORT Length; // # of octects of data - - USHORT MaximumLength; // # of octects available - - LONG Offset; // Offset of data relative to the descriptor - -} NDIS_VAR_DATA_DESC, *PNDIS_VAR_DATA_DESC; - -// -// Object Identifiers used by NdisRequest Query/Set Information -// -// -// General Objects -// -#define OID_GEN_SUPPORTED_LIST 0x00010101 -#define OID_GEN_HARDWARE_STATUS 0x00010102 -#define OID_GEN_MEDIA_SUPPORTED 0x00010103 -#define OID_GEN_MEDIA_IN_USE 0x00010104 -#define OID_GEN_MAXIMUM_LOOKAHEAD 0x00010105 -#define OID_GEN_MAXIMUM_FRAME_SIZE 0x00010106 -#define OID_GEN_LINK_SPEED 0x00010107 -#define OID_GEN_TRANSMIT_BUFFER_SPACE 0x00010108 -#define OID_GEN_RECEIVE_BUFFER_SPACE 0x00010109 -#define OID_GEN_TRANSMIT_BLOCK_SIZE 0x0001010A -#define OID_GEN_RECEIVE_BLOCK_SIZE 0x0001010B -#define OID_GEN_VENDOR_ID 0x0001010C -#define OID_GEN_VENDOR_DESCRIPTION 0x0001010D -#define OID_GEN_CURRENT_PACKET_FILTER 0x0001010E -#define OID_GEN_CURRENT_LOOKAHEAD 0x0001010F -#define OID_GEN_DRIVER_VERSION 0x00010110 -#define OID_GEN_MAXIMUM_TOTAL_SIZE 0x00010111 -#define OID_GEN_PROTOCOL_OPTIONS 0x00010112 -#define OID_GEN_MAC_OPTIONS 0x00010113 -#define OID_GEN_MEDIA_CONNECT_STATUS 0x00010114 -#define OID_GEN_MAXIMUM_SEND_PACKETS 0x00010115 -#define OID_GEN_VENDOR_DRIVER_VERSION 0x00010116 -#define OID_GEN_XMIT_OK 0x00020101 -#define OID_GEN_RCV_OK 0x00020102 -#define OID_GEN_XMIT_ERROR 0x00020103 -#define OID_GEN_RCV_ERROR 0x00020104 -#define OID_GEN_RCV_NO_BUFFER 0x00020105 -#define OID_GEN_DIRECTED_BYTES_XMIT 0x00020201 -#define OID_GEN_DIRECTED_FRAMES_XMIT 0x00020202 -#define OID_GEN_MULTICAST_BYTES_XMIT 0x00020203 -#define OID_GEN_MULTICAST_FRAMES_XMIT 0x00020204 -#define OID_GEN_BROADCAST_BYTES_XMIT 0x00020205 -#define OID_GEN_BROADCAST_FRAMES_XMIT 0x00020206 -#define OID_GEN_DIRECTED_BYTES_RCV 0x00020207 -#define OID_GEN_DIRECTED_FRAMES_RCV 0x00020208 -#define OID_GEN_MULTICAST_BYTES_RCV 0x00020209 -#define OID_GEN_MULTICAST_FRAMES_RCV 0x0002020A -#define OID_GEN_BROADCAST_BYTES_RCV 0x0002020B -#define OID_GEN_BROADCAST_FRAMES_RCV 0x0002020C -#define OID_GEN_RCV_CRC_ERROR 0x0002020D -#define OID_GEN_TRANSMIT_QUEUE_LENGTH 0x0002020E -#define OID_GEN_GET_TIME_CAPS 0x0002020F -#define OID_GEN_GET_NETCARD_TIME 0x00020210 -// -// These are connection-oriented general OIDs. -// These replace the above OIDs for connection-oriented media. -// -#define OID_GEN_CO_SUPPORTED_LIST 0x00010101 -#define OID_GEN_CO_HARDWARE_STATUS 0x00010102 -#define OID_GEN_CO_MEDIA_SUPPORTED 0x00010103 -#define OID_GEN_CO_MEDIA_IN_USE 0x00010104 -#define OID_GEN_CO_LINK_SPEED 0x00010105 -#define OID_GEN_CO_VENDOR_ID 0x00010106 -#define OID_GEN_CO_VENDOR_DESCRIPTION 0x00010107 -#define OID_GEN_CO_DRIVER_VERSION 0x00010108 -#define OID_GEN_CO_PROTOCOL_OPTIONS 0x00010109 -#define OID_GEN_CO_MAC_OPTIONS 0x0001010A -#define OID_GEN_CO_MEDIA_CONNECT_STATUS 0x0001010B -#define OID_GEN_CO_VENDOR_DRIVER_VERSION 0x0001010C -#define OID_GEN_CO_MINIMUM_LINK_SPEED 0x0001010D -#define OID_GEN_CO_GET_TIME_CAPS 0x00010201 -#define OID_GEN_CO_GET_NETCARD_TIME 0x00010202 -// -// These are connection-oriented statistics OIDs. -// -#define OID_GEN_CO_XMIT_PDUS_OK 0x00020101 -#define OID_GEN_CO_RCV_PDUS_OK 0x00020102 -#define OID_GEN_CO_XMIT_PDUS_ERROR 0x00020103 -#define OID_GEN_CO_RCV_PDUS_ERROR 0x00020104 -#define OID_GEN_CO_RCV_PDUS_NO_BUFFER 0x00020105 -#define OID_GEN_CO_RCV_CRC_ERROR 0x00020201 -#define OID_GEN_CO_TRANSMIT_QUEUE_LENGTH 0x00020202 -#define OID_GEN_CO_BYTES_XMIT 0x00020203 -#define OID_GEN_CO_BYTES_RCV 0x00020204 -#define OID_GEN_CO_BYTES_XMIT_OUTSTANDING 0x00020205 -#define OID_GEN_CO_NETCARD_LOAD 0x00020206 -// -// These are objects for Connection-oriented media call-managers and are not -// valid for ndis drivers. Under construction. -// -#define OID_CO_ADD_PVC 0xFF000001 -#define OID_CO_DELETE_PVC 0xFF000002 -#define OID_CO_GET_CALL_INFORMATION 0xFF000003 -#define OID_CO_ADD_ADDRESS 0xFF000004 -#define OID_CO_DELETE_ADDRESS 0xFF000005 -#define OID_CO_GET_ADDRESSES 0xFF000006 -#define OID_CO_ADDRESS_CHANGE 0xFF000007 -#define OID_CO_SIGNALING_ENABLED 0xFF000008 -#define OID_CO_SIGNALING_DISABLED 0xFF000009 -// -// 802.3 Objects (Ethernet) -// -#define OID_802_3_PERMANENT_ADDRESS 0x01010101 -#define OID_802_3_CURRENT_ADDRESS 0x01010102 -#define OID_802_3_MULTICAST_LIST 0x01010103 -#define OID_802_3_MAXIMUM_LIST_SIZE 0x01010104 -#define OID_802_3_MAC_OPTIONS 0x01010105 -// -// -#define NDIS_802_3_MAC_OPTION_PRIORITY 0x00000001 -#define OID_802_3_RCV_ERROR_ALIGNMENT 0x01020101 -#define OID_802_3_XMIT_ONE_COLLISION 0x01020102 -#define OID_802_3_XMIT_MORE_COLLISIONS 0x01020103 -#define OID_802_3_XMIT_DEFERRED 0x01020201 -#define OID_802_3_XMIT_MAX_COLLISIONS 0x01020202 -#define OID_802_3_RCV_OVERRUN 0x01020203 -#define OID_802_3_XMIT_UNDERRUN 0x01020204 -#define OID_802_3_XMIT_HEARTBEAT_FAILURE 0x01020205 -#define OID_802_3_XMIT_TIMES_CRS_LOST 0x01020206 -#define OID_802_3_XMIT_LATE_COLLISIONS 0x01020207 -// -// 802.5 Objects (Token-Ring) -// -#define OID_802_5_PERMANENT_ADDRESS 0x02010101 -#define OID_802_5_CURRENT_ADDRESS 0x02010102 -#define OID_802_5_CURRENT_FUNCTIONAL 0x02010103 -#define OID_802_5_CURRENT_GROUP 0x02010104 -#define OID_802_5_LAST_OPEN_STATUS 0x02010105 -#define OID_802_5_CURRENT_RING_STATUS 0x02010106 -#define OID_802_5_CURRENT_RING_STATE 0x02010107 -#define OID_802_5_LINE_ERRORS 0x02020101 -#define OID_802_5_LOST_FRAMES 0x02020102 -#define OID_802_5_BURST_ERRORS 0x02020201 -#define OID_802_5_AC_ERRORS 0x02020202 -#define OID_802_5_ABORT_DELIMETERS 0x02020203 -#define OID_802_5_FRAME_COPIED_ERRORS 0x02020204 -#define OID_802_5_FREQUENCY_ERRORS 0x02020205 -#define OID_802_5_TOKEN_ERRORS 0x02020206 -#define OID_802_5_INTERNAL_ERRORS 0x02020207 -// -// FDDI Objects -// -#define OID_FDDI_LONG_PERMANENT_ADDR 0x03010101 -#define OID_FDDI_LONG_CURRENT_ADDR 0x03010102 -#define OID_FDDI_LONG_MULTICAST_LIST 0x03010103 -#define OID_FDDI_LONG_MAX_LIST_SIZE 0x03010104 -#define OID_FDDI_SHORT_PERMANENT_ADDR 0x03010105 -#define OID_FDDI_SHORT_CURRENT_ADDR 0x03010106 -#define OID_FDDI_SHORT_MULTICAST_LIST 0x03010107 -#define OID_FDDI_SHORT_MAX_LIST_SIZE 0x03010108 -#define OID_FDDI_ATTACHMENT_TYPE 0x03020101 -#define OID_FDDI_UPSTREAM_NODE_LONG 0x03020102 -#define OID_FDDI_DOWNSTREAM_NODE_LONG 0x03020103 -#define OID_FDDI_FRAME_ERRORS 0x03020104 -#define OID_FDDI_FRAMES_LOST 0x03020105 -#define OID_FDDI_RING_MGT_STATE 0x03020106 -#define OID_FDDI_LCT_FAILURES 0x03020107 -#define OID_FDDI_LEM_REJECTS 0x03020108 -#define OID_FDDI_LCONNECTION_STATE 0x03020109 -#define OID_FDDI_SMT_STATION_ID 0x03030201 -#define OID_FDDI_SMT_OP_VERSION_ID 0x03030202 -#define OID_FDDI_SMT_HI_VERSION_ID 0x03030203 -#define OID_FDDI_SMT_LO_VERSION_ID 0x03030204 -#define OID_FDDI_SMT_MANUFACTURER_DATA 0x03030205 -#define OID_FDDI_SMT_USER_DATA 0x03030206 -#define OID_FDDI_SMT_MIB_VERSION_ID 0x03030207 -#define OID_FDDI_SMT_MAC_CT 0x03030208 -#define OID_FDDI_SMT_NON_MASTER_CT 0x03030209 -#define OID_FDDI_SMT_MASTER_CT 0x0303020A -#define OID_FDDI_SMT_AVAILABLE_PATHS 0x0303020B -#define OID_FDDI_SMT_CONFIG_CAPABILITIES 0x0303020C -#define OID_FDDI_SMT_CONFIG_POLICY 0x0303020D -#define OID_FDDI_SMT_CONNECTION_POLICY 0x0303020E -#define OID_FDDI_SMT_T_NOTIFY 0x0303020F -#define OID_FDDI_SMT_STAT_RPT_POLICY 0x03030210 -#define OID_FDDI_SMT_TRACE_MAX_EXPIRATION 0x03030211 -#define OID_FDDI_SMT_PORT_INDEXES 0x03030212 -#define OID_FDDI_SMT_MAC_INDEXES 0x03030213 -#define OID_FDDI_SMT_BYPASS_PRESENT 0x03030214 -#define OID_FDDI_SMT_ECM_STATE 0x03030215 -#define OID_FDDI_SMT_CF_STATE 0x03030216 -#define OID_FDDI_SMT_HOLD_STATE 0x03030217 -#define OID_FDDI_SMT_REMOTE_DISCONNECT_FLAG 0x03030218 -#define OID_FDDI_SMT_STATION_STATUS 0x03030219 -#define OID_FDDI_SMT_PEER_WRAP_FLAG 0x0303021A -#define OID_FDDI_SMT_MSG_TIME_STAMP 0x0303021B -#define OID_FDDI_SMT_TRANSITION_TIME_STAMP 0x0303021C -#define OID_FDDI_SMT_SET_COUNT 0x0303021D -#define OID_FDDI_SMT_LAST_SET_STATION_ID 0x0303021E -#define OID_FDDI_MAC_FRAME_STATUS_FUNCTIONS 0x0303021F -#define OID_FDDI_MAC_BRIDGE_FUNCTIONS 0x03030220 -#define OID_FDDI_MAC_T_MAX_CAPABILITY 0x03030221 -#define OID_FDDI_MAC_TVX_CAPABILITY 0x03030222 -#define OID_FDDI_MAC_AVAILABLE_PATHS 0x03030223 -#define OID_FDDI_MAC_CURRENT_PATH 0x03030224 -#define OID_FDDI_MAC_UPSTREAM_NBR 0x03030225 -#define OID_FDDI_MAC_DOWNSTREAM_NBR 0x03030226 -#define OID_FDDI_MAC_OLD_UPSTREAM_NBR 0x03030227 -#define OID_FDDI_MAC_OLD_DOWNSTREAM_NBR 0x03030228 -#define OID_FDDI_MAC_DUP_ADDRESS_TEST 0x03030229 -#define OID_FDDI_MAC_REQUESTED_PATHS 0x0303022A -#define OID_FDDI_MAC_DOWNSTREAM_PORT_TYPE 0x0303022B -#define OID_FDDI_MAC_INDEX 0x0303022C -#define OID_FDDI_MAC_SMT_ADDRESS 0x0303022D -#define OID_FDDI_MAC_LONG_GRP_ADDRESS 0x0303022E -#define OID_FDDI_MAC_SHORT_GRP_ADDRESS 0x0303022F -#define OID_FDDI_MAC_T_REQ 0x03030230 -#define OID_FDDI_MAC_T_NEG 0x03030231 -#define OID_FDDI_MAC_T_MAX 0x03030232 -#define OID_FDDI_MAC_TVX_VALUE 0x03030233 -#define OID_FDDI_MAC_T_PRI0 0x03030234 -#define OID_FDDI_MAC_T_PRI1 0x03030235 -#define OID_FDDI_MAC_T_PRI2 0x03030236 -#define OID_FDDI_MAC_T_PRI3 0x03030237 -#define OID_FDDI_MAC_T_PRI4 0x03030238 -#define OID_FDDI_MAC_T_PRI5 0x03030239 -#define OID_FDDI_MAC_T_PRI6 0x0303023A -#define OID_FDDI_MAC_FRAME_CT 0x0303023B -#define OID_FDDI_MAC_COPIED_CT 0x0303023C -#define OID_FDDI_MAC_TRANSMIT_CT 0x0303023D -#define OID_FDDI_MAC_TOKEN_CT 0x0303023E -#define OID_FDDI_MAC_ERROR_CT 0x0303023F -#define OID_FDDI_MAC_LOST_CT 0x03030240 -#define OID_FDDI_MAC_TVX_EXPIRED_CT 0x03030241 -#define OID_FDDI_MAC_NOT_COPIED_CT 0x03030242 -#define OID_FDDI_MAC_LATE_CT 0x03030243 -#define OID_FDDI_MAC_RING_OP_CT 0x03030244 -#define OID_FDDI_MAC_FRAME_ERROR_THRESHOLD 0x03030245 -#define OID_FDDI_MAC_FRAME_ERROR_RATIO 0x03030246 -#define OID_FDDI_MAC_NOT_COPIED_THRESHOLD 0x03030247 -#define OID_FDDI_MAC_NOT_COPIED_RATIO 0x03030248 -#define OID_FDDI_MAC_RMT_STATE 0x03030249 -#define OID_FDDI_MAC_DA_FLAG 0x0303024A -#define OID_FDDI_MAC_UNDA_FLAG 0x0303024B -#define OID_FDDI_MAC_FRAME_ERROR_FLAG 0x0303024C -#define OID_FDDI_MAC_NOT_COPIED_FLAG 0x0303024D -#define OID_FDDI_MAC_MA_UNITDATA_AVAILABLE 0x0303024E -#define OID_FDDI_MAC_HARDWARE_PRESENT 0x0303024F -#define OID_FDDI_MAC_MA_UNITDATA_ENABLE 0x03030250 -#define OID_FDDI_PATH_INDEX 0x03030251 -#define OID_FDDI_PATH_RING_LATENCY 0x03030252 -#define OID_FDDI_PATH_TRACE_STATUS 0x03030253 -#define OID_FDDI_PATH_SBA_PAYLOAD 0x03030254 -#define OID_FDDI_PATH_SBA_OVERHEAD 0x03030255 -#define OID_FDDI_PATH_CONFIGURATION 0x03030256 -#define OID_FDDI_PATH_T_R_MODE 0x03030257 -#define OID_FDDI_PATH_SBA_AVAILABLE 0x03030258 -#define OID_FDDI_PATH_TVX_LOWER_BOUND 0x03030259 -#define OID_FDDI_PATH_T_MAX_LOWER_BOUND 0x0303025A -#define OID_FDDI_PATH_MAX_T_REQ 0x0303025B -#define OID_FDDI_PORT_MY_TYPE 0x0303025C -#define OID_FDDI_PORT_NEIGHBOR_TYPE 0x0303025D -#define OID_FDDI_PORT_CONNECTION_POLICIES 0x0303025E -#define OID_FDDI_PORT_MAC_INDICATED 0x0303025F -#define OID_FDDI_PORT_CURRENT_PATH 0x03030260 -#define OID_FDDI_PORT_REQUESTED_PATHS 0x03030261 -#define OID_FDDI_PORT_MAC_PLACEMENT 0x03030262 -#define OID_FDDI_PORT_AVAILABLE_PATHS 0x03030263 -#define OID_FDDI_PORT_MAC_LOOP_TIME 0x03030264 -#define OID_FDDI_PORT_PMD_CLASS 0x03030265 -#define OID_FDDI_PORT_CONNECTION_CAPABILITIES 0x03030266 -#define OID_FDDI_PORT_INDEX 0x03030267 -#define OID_FDDI_PORT_MAINT_LS 0x03030268 -#define OID_FDDI_PORT_BS_FLAG 0x03030269 -#define OID_FDDI_PORT_PC_LS 0x0303026A -#define OID_FDDI_PORT_EB_ERROR_CT 0x0303026B -#define OID_FDDI_PORT_LCT_FAIL_CT 0x0303026C -#define OID_FDDI_PORT_LER_ESTIMATE 0x0303026D -#define OID_FDDI_PORT_LEM_REJECT_CT 0x0303026E -#define OID_FDDI_PORT_LEM_CT 0x0303026F -#define OID_FDDI_PORT_LER_CUTOFF 0x03030270 -#define OID_FDDI_PORT_LER_ALARM 0x03030271 -#define OID_FDDI_PORT_CONNNECT_STATE 0x03030272 -#define OID_FDDI_PORT_PCM_STATE 0x03030273 -#define OID_FDDI_PORT_PC_WITHHOLD 0x03030274 -#define OID_FDDI_PORT_LER_FLAG 0x03030275 -#define OID_FDDI_PORT_HARDWARE_PRESENT 0x03030276 -#define OID_FDDI_SMT_STATION_ACTION 0x03030277 -#define OID_FDDI_PORT_ACTION 0x03030278 -#define OID_FDDI_IF_DESCR 0x03030279 -#define OID_FDDI_IF_TYPE 0x0303027A -#define OID_FDDI_IF_MTU 0x0303027B -#define OID_FDDI_IF_SPEED 0x0303027C -#define OID_FDDI_IF_PHYS_ADDRESS 0x0303027D -#define OID_FDDI_IF_ADMIN_STATUS 0x0303027E -#define OID_FDDI_IF_OPER_STATUS 0x0303027F -#define OID_FDDI_IF_LAST_CHANGE 0x03030280 -#define OID_FDDI_IF_IN_OCTETS 0x03030281 -#define OID_FDDI_IF_IN_UCAST_PKTS 0x03030282 -#define OID_FDDI_IF_IN_NUCAST_PKTS 0x03030283 -#define OID_FDDI_IF_IN_DISCARDS 0x03030284 -#define OID_FDDI_IF_IN_ERRORS 0x03030285 -#define OID_FDDI_IF_IN_UNKNOWN_PROTOS 0x03030286 -#define OID_FDDI_IF_OUT_OCTETS 0x03030287 -#define OID_FDDI_IF_OUT_UCAST_PKTS 0x03030288 -#define OID_FDDI_IF_OUT_NUCAST_PKTS 0x03030289 -#define OID_FDDI_IF_OUT_DISCARDS 0x0303028A -#define OID_FDDI_IF_OUT_ERRORS 0x0303028B -#define OID_FDDI_IF_OUT_QLEN 0x0303028C -#define OID_FDDI_IF_SPECIFIC 0x0303028D -// -// WAN objects -// -#define OID_WAN_PERMANENT_ADDRESS 0x04010101 -#define OID_WAN_CURRENT_ADDRESS 0x04010102 -#define OID_WAN_QUALITY_OF_SERVICE 0x04010103 -#define OID_WAN_PROTOCOL_TYPE 0x04010104 -#define OID_WAN_MEDIUM_SUBTYPE 0x04010105 -#define OID_WAN_HEADER_FORMAT 0x04010106 -#define OID_WAN_GET_INFO 0x04010107 -#define OID_WAN_SET_LINK_INFO 0x04010108 -#define OID_WAN_GET_LINK_INFO 0x04010109 -#define OID_WAN_LINE_COUNT 0x0401010A -#define OID_WAN_GET_BRIDGE_INFO 0x0401020A -#define OID_WAN_SET_BRIDGE_INFO 0x0401020B -#define OID_WAN_GET_COMP_INFO 0x0401020C -#define OID_WAN_SET_COMP_INFO 0x0401020D -#define OID_WAN_GET_STATS_INFO 0x0401020E -// -// LocalTalk objects -// -#define OID_LTALK_CURRENT_NODE_ID 0x05010102 -#define OID_LTALK_IN_BROADCASTS 0x05020101 -#define OID_LTALK_IN_LENGTH_ERRORS 0x05020102 -#define OID_LTALK_OUT_NO_HANDLERS 0x05020201 -#define OID_LTALK_COLLISIONS 0x05020202 -#define OID_LTALK_DEFERS 0x05020203 -#define OID_LTALK_NO_DATA_ERRORS 0x05020204 -#define OID_LTALK_RANDOM_CTS_ERRORS 0x05020205 -#define OID_LTALK_FCS_ERRORS 0x05020206 -// -// Arcnet objects -// -#define OID_ARCNET_PERMANENT_ADDRESS 0x06010101 -#define OID_ARCNET_CURRENT_ADDRESS 0x06010102 -#define OID_ARCNET_RECONFIGURATIONS 0x06020201 -// -// TAPI objects -// -#define OID_TAPI_ACCEPT 0x07030101 -#define OID_TAPI_ANSWER 0x07030102 -#define OID_TAPI_CLOSE 0x07030103 -#define OID_TAPI_CLOSE_CALL 0x07030104 -#define OID_TAPI_CONDITIONAL_MEDIA_DETECTION 0x07030105 -#define OID_TAPI_CONFIG_DIALOG 0x07030106 -#define OID_TAPI_DEV_SPECIFIC 0x07030107 -#define OID_TAPI_DIAL 0x07030108 -#define OID_TAPI_DROP 0x07030109 -#define OID_TAPI_GET_ADDRESS_CAPS 0x0703010A -#define OID_TAPI_GET_ADDRESS_ID 0x0703010B -#define OID_TAPI_GET_ADDRESS_STATUS 0x0703010C -#define OID_TAPI_GET_CALL_ADDRESS_ID 0x0703010D -#define OID_TAPI_GET_CALL_INFO 0x0703010E -#define OID_TAPI_GET_CALL_STATUS 0x0703010F -#define OID_TAPI_GET_DEV_CAPS 0x07030110 -#define OID_TAPI_GET_DEV_CONFIG 0x07030111 -#define OID_TAPI_GET_EXTENSION_ID 0x07030112 -#define OID_TAPI_GET_ID 0x07030113 -#define OID_TAPI_GET_LINE_DEV_STATUS 0x07030114 -#define OID_TAPI_MAKE_CALL 0x07030115 -#define OID_TAPI_NEGOTIATE_EXT_VERSION 0x07030116 -#define OID_TAPI_OPEN 0x07030117 -#define OID_TAPI_PROVIDER_INITIALIZE 0x07030118 -#define OID_TAPI_PROVIDER_SHUTDOWN 0x07030119 -#define OID_TAPI_SECURE_CALL 0x0703011A -#define OID_TAPI_SELECT_EXT_VERSION 0x0703011B -#define OID_TAPI_SEND_USER_USER_INFO 0x0703011C -#define OID_TAPI_SET_APP_SPECIFIC 0x0703011D -#define OID_TAPI_SET_CALL_PARAMS 0x0703011E -#define OID_TAPI_SET_DEFAULT_MEDIA_DETECTION 0x0703011F -#define OID_TAPI_SET_DEV_CONFIG 0x07030120 -#define OID_TAPI_SET_MEDIA_MODE 0x07030121 -#define OID_TAPI_SET_STATUS_MESSAGES 0x07030122 -// -// ATM Connection Oriented Ndis -// -#define OID_ATM_SUPPORTED_VC_RATES 0x08010101 -#define OID_ATM_SUPPORTED_SERVICE_CATEGORY 0x08010102 -#define OID_ATM_SUPPORTED_AAL_TYPES 0x08010103 -#define OID_ATM_HW_CURRENT_ADDRESS 0x08010104 -#define OID_ATM_MAX_ACTIVE_VCS 0x08010105 -#define OID_ATM_MAX_ACTIVE_VCI_BITS 0x08010106 -#define OID_ATM_MAX_ACTIVE_VPI_BITS 0x08010107 -#define OID_ATM_MAX_AAL0_PACKET_SIZE 0x08010108 -#define OID_ATM_MAX_AAL1_PACKET_SIZE 0x08010109 -#define OID_ATM_MAX_AAL34_PACKET_SIZE 0x0801010A -#define OID_ATM_MAX_AAL5_PACKET_SIZE 0x0801010B -#define OID_ATM_SIGNALING_VPIVCI 0x08010201 -#define OID_ATM_ASSIGNED_VPI 0x08010202 -#define OID_ATM_ACQUIRE_ACCESS_NET_RESOURCES 0x08010203 -#define OID_ATM_RELEASE_ACCESS_NET_RESOURCES 0x08010204 -#define OID_ATM_ILMI_VPIVCI 0x08010205 -#define OID_ATM_DIGITAL_BROADCAST_VPIVCI 0x08010206 -#define OID_ATM_GET_NEAREST_FLOW 0x08010207 -#define OID_ATM_ALIGNMENT_REQUIRED 0x08010208 -// -// ATM specific statistics OIDs. -// -#define OID_ATM_RCV_CELLS_OK 0x08020101 -#define OID_ATM_XMIT_CELLS_OK 0x08020102 -#define OID_ATM_RCV_CELLS_DROPPED 0x08020103 -#define OID_ATM_RCV_INVALID_VPI_VCI 0x08020201 -#define OID_ATM_CELLS_HEC_ERROR 0x08020202 -#define OID_ATM_RCV_REASSEMBLY_ERROR 0x08020203 -// -// PCCA (Wireless) object -// -// -// All WirelessWAN devices must support the following OIDs -// -#define OID_WW_GEN_NETWORK_TYPES_SUPPORTED 0x09010101 -#define OID_WW_GEN_NETWORK_TYPE_IN_USE 0x09010102 -#define OID_WW_GEN_HEADER_FORMATS_SUPPORTED 0x09010103 -#define OID_WW_GEN_HEADER_FORMAT_IN_USE 0x09010104 -#define OID_WW_GEN_INDICATION_REQUEST 0x09010105 -#define OID_WW_GEN_DEVICE_INFO 0x09010106 -#define OID_WW_GEN_OPERATION_MODE 0x09010107 -#define OID_WW_GEN_LOCK_STATUS 0x09010108 -#define OID_WW_GEN_DISABLE_TRANSMITTER 0x09010109 -#define OID_WW_GEN_NETWORK_ID 0x0901010A -#define OID_WW_GEN_PERMANENT_ADDRESS 0x0901010B -#define OID_WW_GEN_CURRENT_ADDRESS 0x0901010C -#define OID_WW_GEN_SUSPEND_DRIVER 0x0901010D -#define OID_WW_GEN_BASESTATION_ID 0x0901010E -#define OID_WW_GEN_CHANNEL_ID 0x0901010F -#define OID_WW_GEN_ENCRYPTION_SUPPORTED 0x09010110 -#define OID_WW_GEN_ENCRYPTION_IN_USE 0x09010111 -#define OID_WW_GEN_ENCRYPTION_STATE 0x09010112 -#define OID_WW_GEN_CHANNEL_QUALITY 0x09010113 -#define OID_WW_GEN_REGISTRATION_STATUS 0x09010114 -#define OID_WW_GEN_RADIO_LINK_SPEED 0x09010115 -#define OID_WW_GEN_LATENCY 0x09010116 -#define OID_WW_GEN_BATTERY_LEVEL 0x09010117 -#define OID_WW_GEN_EXTERNAL_POWER 0x09010118 -// -// Network Dependent OIDs - Mobitex: -// -#define OID_WW_MBX_SUBADDR 0x09050101 -// OID 0x09050102 is reserved and may not be used -#define OID_WW_MBX_FLEXLIST 0x09050103 -#define OID_WW_MBX_GROUPLIST 0x09050104 -#define OID_WW_MBX_TRAFFIC_AREA 0x09050105 -#define OID_WW_MBX_LIVE_DIE 0x09050106 -#define OID_WW_MBX_TEMP_DEFAULTLIST 0x09050107 -// -// Network Dependent OIDs - Pinpoint: -// -#define OID_WW_PIN_LOC_AUTHORIZE 0x09090101 -#define OID_WW_PIN_LAST_LOCATION 0x09090102 -#define OID_WW_PIN_LOC_FIX 0x09090103 -// -// Network Dependent - CDPD: -// -#define OID_WW_CDPD_SPNI 0x090D0101 -#define OID_WW_CDPD_WASI 0x090D0102 -#define OID_WW_CDPD_AREA_COLOR 0x090D0103 -#define OID_WW_CDPD_TX_POWER_LEVEL 0x090D0104 -#define OID_WW_CDPD_EID 0x090D0105 -#define OID_WW_CDPD_HEADER_COMPRESSION 0x090D0106 -#define OID_WW_CDPD_DATA_COMPRESSION 0x090D0107 -#define OID_WW_CDPD_CHANNEL_SELECT 0x090D0108 -#define OID_WW_CDPD_CHANNEL_STATE 0x090D0109 -#define OID_WW_CDPD_NEI 0x090D010A -#define OID_WW_CDPD_NEI_STATE 0x090D010B -#define OID_WW_CDPD_SERVICE_PROVIDER_IDENTIFIER 0x090D010C -#define OID_WW_CDPD_SLEEP_MODE 0x090D010D -#define OID_WW_CDPD_CIRCUIT_SWITCHED 0x090D010E -#define OID_WW_CDPD_TEI 0x090D010F -#define OID_WW_CDPD_RSSI 0x090D0110 -// -// Network Dependent - Ardis: -// -#define OID_WW_ARD_SNDCP 0x09110101 -#define OID_WW_ARD_TMLY_MSG 0x09110102 -#define OID_WW_ARD_DATAGRAM 0x09110103 -// -// Network Dependent - DataTac: -// -#define OID_WW_TAC_COMPRESSION 0x09150101 -#define OID_WW_TAC_SET_CONFIG 0x09150102 -#define OID_WW_TAC_GET_STATUS 0x09150103 -#define OID_WW_TAC_USER_HEADER 0x09150104 -// -// Network Dependent - Metricom: -// -#define OID_WW_MET_FUNCTION 0x09190101 -// -// IRDA objects -// -#define OID_IRDA_RECEIVING 0x0A010100 -#define OID_IRDA_TURNAROUND_TIME 0x0A010101 -#define OID_IRDA_SUPPORTED_SPEEDS 0x0A010102 -#define OID_IRDA_LINK_SPEED 0x0A010103 -#define OID_IRDA_MEDIA_BUSY 0x0A010104 -#define OID_IRDA_EXTRA_RCV_BOFS 0x0A010200 -#define OID_IRDA_RATE_SNIFF 0x0A010201 -#define OID_IRDA_UNICAST_LIST 0x0A010202 -#define OID_IRDA_MAX_UNICAST_LIST_SIZE 0x0A010203 -#define OID_IRDA_MAX_RECEIVE_WINDOW_SIZE 0x0A010204 -#define OID_IRDA_MAX_SEND_WINDOW_SIZE 0x0A010205 -// -// Medium the Ndis Driver is running on (OID_GEN_MEDIA_SUPPORTED/ -// OID_GEN_MEDIA_IN_USE). -// -typedef enum _NDIS_MEDIUM { - NdisMedium802_3, - NdisMedium802_5, - NdisMediumFddi, - NdisMediumWan, - NdisMediumLocalTalk, - NdisMediumDix, // defined for convenience, not a real medium - NdisMediumArcnetRaw, - NdisMediumArcnet878_2, - NdisMediumAtm, - NdisMediumWirelessWan, - NdisMediumIrda, - NdisMediumMax // Not a real medium, defined as an upper-bound -} NDIS_MEDIUM, *PNDIS_MEDIUM; - -// -// Hardware status codes (OID_GEN_HARDWARE_STATUS). -// -typedef enum _NDIS_HARDWARE_STATUS { - NdisHardwareStatusReady, - NdisHardwareStatusInitializing, - NdisHardwareStatusReset, - NdisHardwareStatusClosing, - NdisHardwareStatusNotReady -} NDIS_HARDWARE_STATUS, *PNDIS_HARDWARE_STATUS; - -// -// this is the type passed in the OID_GEN_GET_TIME_CAPS request -// -typedef struct _GEN_GET_TIME_CAPS { - ULONG Flags; // Bits defined below - - ULONG ClockPrecision; -} GEN_GET_TIME_CAPS, *PGEN_GET_TIME_CAPS; - -#define READABLE_LOCAL_CLOCK 0x000000001 -#define CLOCK_NETWORK_DERIVED 0x000000002 -#define CLOCK_PRECISION 0x000000004 -#define RECEIVE_TIME_INDICATION_CAPABLE 0x000000008 -#define TIMED_SEND_CAPABLE 0x000000010 -#define TIME_STAMP_CAPABLE 0x000000020 -// -// -// this is the type passed in the OID_GEN_GET_NETCARD_TIME request -// -typedef struct _GEN_GET_NETCARD_TIME { - ULONG ReadTime; -} GEN_GET_NETCARD_TIME, *PGEN_GET_NETCARD_TIME; - -// -// Defines the attachment types for FDDI (OID_FDDI_ATTACHMENT_TYPE). -// -typedef enum _NDIS_FDDI_ATTACHMENT_TYPE { - NdisFddiTypeIsolated = 1, - NdisFddiTypeLocalA, - NdisFddiTypeLocalB, - NdisFddiTypeLocalAB, - NdisFddiTypeLocalS, - NdisFddiTypeWrapA, - NdisFddiTypeWrapB, - NdisFddiTypeWrapAB, - NdisFddiTypeWrapS, - NdisFddiTypeCWrapA, - NdisFddiTypeCWrapB, - NdisFddiTypeCWrapS, - NdisFddiTypeThrough -} NDIS_FDDI_ATTACHMENT_TYPE, *PNDIS_FDDI_ATTACHMENT_TYPE; - -// -// Defines the ring management states for FDDI (OID_FDDI_RING_MGT_STATE). -// -typedef enum _NDIS_FDDI_RING_MGT_STATE { - NdisFddiRingIsolated = 1, - NdisFddiRingNonOperational, - NdisFddiRingOperational, - NdisFddiRingDetect, - NdisFddiRingNonOperationalDup, - NdisFddiRingOperationalDup, - NdisFddiRingDirected, - NdisFddiRingTrace -} NDIS_FDDI_RING_MGT_STATE, *PNDIS_FDDI_RING_MGT_STATE; - -// -// Defines the Lconnection state for FDDI (OID_FDDI_LCONNECTION_STATE). -// -typedef enum _NDIS_FDDI_LCONNECTION_STATE { - NdisFddiStateOff = 1, - NdisFddiStateBreak, - NdisFddiStateTrace, - NdisFddiStateConnect, - NdisFddiStateNext, - NdisFddiStateSignal, - NdisFddiStateJoin, - NdisFddiStateVerify, - NdisFddiStateActive, - NdisFddiStateMaintenance -} NDIS_FDDI_LCONNECTION_STATE, *PNDIS_FDDI_LCONNECTION_STATE; - -// -// Defines the medium subtypes for WAN medium (OID_WAN_MEDIUM_SUBTYPE). -// -typedef enum _NDIS_WAN_MEDIUM_SUBTYPE { - NdisWanMediumHub, - NdisWanMediumX_25, - NdisWanMediumIsdn, - NdisWanMediumSerial, - NdisWanMediumFrameRelay, - NdisWanMediumAtm, - NdisWanMediumSonet, - NdisWanMediumSW56K -} NDIS_WAN_MEDIUM_SUBTYPE, *PNDIS_WAN_MEDIUM_SUBTYPE; - -// -// Defines the header format for WAN medium (OID_WAN_HEADER_FORMAT). -// -typedef enum _NDIS_WAN_HEADER_FORMAT { - NdisWanHeaderNative, // src/dest based on subtype, followed by NLPID - NdisWanHeaderEthernet // emulation of ethernet header -} NDIS_WAN_HEADER_FORMAT, *PNDIS_WAN_HEADER_FORMAT; - -// -// Defines the line quality on a WAN line (OID_WAN_QUALITY_OF_SERVICE). -// -typedef enum _NDIS_WAN_QUALITY { - NdisWanRaw, - NdisWanErrorControl, - NdisWanReliable -} NDIS_WAN_QUALITY, *PNDIS_WAN_QUALITY; - -// -// Defines the state of a token-ring adapter (OID_802_5_CURRENT_RING_STATE). -// -typedef enum _NDIS_802_5_RING_STATE { - NdisRingStateOpened = 1, - NdisRingStateClosed, - NdisRingStateOpening, - NdisRingStateClosing, - NdisRingStateOpenFailure, - NdisRingStateRingFailure -} NDIS_802_5_RING_STATE, *PNDIS_802_5_RING_STATE; - -// -// Defines the state of the LAN media -// -typedef enum _NDIS_MEDIA_STATE { - NdisMediaStateConnected, - NdisMediaStateDisconnected -} NDIS_MEDIA_STATE, *PNDIS_MEDIA_STATE; - -// -// The following is set on a per-packet basis as OOB data with NdisClass802_3Priority -// -typedef ULONG Priority_802_3; // 0-7 priority levels -// -// The following structure is used to query OID_GEN_CO_LINK_SPEED and -// OID_GEN_CO_MINIMUM_LINK_SPEED. The first OID will return the current -// link speed of the adapter. The second will return the minimum link speed -// the adapter is capable of. -// - -typedef struct _NDIS_CO_LINK_SPEED { - ULONG Outbound; - ULONG Inbound; -} NDIS_CO_LINK_SPEED, - -*PNDIS_CO_LINK_SPEED; -// -// Ndis Packet Filter Bits (OID_GEN_CURRENT_PACKET_FILTER). -// -#define NDIS_PACKET_TYPE_DIRECTED 0x0001 -#define NDIS_PACKET_TYPE_MULTICAST 0x0002 -#define NDIS_PACKET_TYPE_ALL_MULTICAST 0x0004 -#define NDIS_PACKET_TYPE_BROADCAST 0x0008 -#define NDIS_PACKET_TYPE_SOURCE_ROUTING 0x0010 -#define NDIS_PACKET_TYPE_PROMISCUOUS 0x0020 -#define NDIS_PACKET_TYPE_SMT 0x0040 -#define NDIS_PACKET_TYPE_ALL_LOCAL 0x0080 -#define NDIS_PACKET_TYPE_MAC_FRAME 0x8000 -#define NDIS_PACKET_TYPE_FUNCTIONAL 0x4000 -#define NDIS_PACKET_TYPE_ALL_FUNCTIONAL 0x2000 -#define NDIS_PACKET_TYPE_GROUP 0x1000 -// -// Ndis Token-Ring Ring Status Codes (OID_802_5_CURRENT_RING_STATUS). -// -#define NDIS_RING_SIGNAL_LOSS 0x00008000 -#define NDIS_RING_HARD_ERROR 0x00004000 -#define NDIS_RING_SOFT_ERROR 0x00002000 -#define NDIS_RING_TRANSMIT_BEACON 0x00001000 -#define NDIS_RING_LOBE_WIRE_FAULT 0x00000800 -#define NDIS_RING_AUTO_REMOVAL_ERROR 0x00000400 -#define NDIS_RING_REMOVE_RECEIVED 0x00000200 -#define NDIS_RING_COUNTER_OVERFLOW 0x00000100 -#define NDIS_RING_SINGLE_STATION 0x00000080 -#define NDIS_RING_RING_RECOVERY 0x00000040 -// -// Ndis protocol option bits (OID_GEN_PROTOCOL_OPTIONS). -// -#define NDIS_PROT_OPTION_ESTIMATED_LENGTH 0x00000001 -#define NDIS_PROT_OPTION_NO_LOOPBACK 0x00000002 -#define NDIS_PROT_OPTION_NO_RSVD_ON_RCVPKT 0x00000004 -// -// Ndis MAC option bits (OID_GEN_MAC_OPTIONS). -// -#define NDIS_MAC_OPTION_COPY_LOOKAHEAD_DATA 0x00000001 -#define NDIS_MAC_OPTION_RECEIVE_SERIALIZED 0x00000002 -#define NDIS_MAC_OPTION_TRANSFERS_NOT_PEND 0x00000004 -#define NDIS_MAC_OPTION_NO_LOOPBACK 0x00000008 -#define NDIS_MAC_OPTION_FULL_DUPLEX 0x00000010 -#define NDIS_MAC_OPTION_EOTX_INDICATION 0x00000020 -#define NDIS_MAC_OPTION_RESERVED 0x80000000 -// -// NDIS MAC option bits for OID_GEN_CO_MAC_OPTIONS. -// -#define NDIS_CO_MAC_OPTION_DYNAMIC_LINK_SPEED 0x00000001 -#ifdef IRDA -// -// The following is set on a per-packet basis as OOB data with NdisClassIrdaPacketInfo -// This is the per-packet info specified on a per-packet basis -// -typedef struct _NDIS_IRDA_PACKET_INFO { - UINT ExtraBOFs; - UINT MinTurnAroundTime; -} NDIS_IRDA_PACKET_INFO, *PNDIS_IRDA_PACKET_INFO; - -#endif -#ifdef WIRELESS_WAN -// -// Wireless WAN structure definitions -// -// -// currently defined Wireless network subtypes -// -typedef enum _NDIS_WW_NETWORK_TYPE { - NdisWWGeneric, - NdisWWMobitex, - NdisWWPinpoint, - NdisWWCDPD, - NdisWWArdis, - NdisWWDataTAC, - NdisWWMetricom, - NdisWWGSM, - NdisWWCDMA, - NdisWWTDMA, - NdisWWAMPS, - NdisWWInmarsat, - NdisWWpACT -} NDIS_WW_NETWORK_TYPE; - -// -// currently defined header formats -// -typedef enum _NDIS_WW_HEADER_FORMAT { - NdisWWDIXEthernetFrames, - NdisWWMPAKFrames, - NdisWWRDLAPFrames, - NdisWWMDC4800Frames -} NDIS_WW_HEADER_FORMAT; - -// -// currently defined encryption types -// -typedef enum _NDIS_WW_ENCRYPTION_TYPE { - NdisWWUnknownEncryption = -1, - NdisWWNoEncryption, - NdisWWDefaultEncryption -} NDIS_WW_ENCRYPTION_TYPE, *PNDIS_WW_ENCRYPTION_TYPE; - -// -// OID_WW_GEN_INDICATION_REQUEST -// -typedef struct _NDIS_WW_INDICATION_REQUEST { - NDIS_OID Oid; // IN - - UINT uIndicationFlag; // IN - - UINT uApplicationToken; // IN OUT - - HANDLE hIndicationHandle; // IN OUT - - INT iPollingInterval; // IN OUT - - NDIS_VAR_DATA_DESC InitialValue; // IN OUT - - NDIS_VAR_DATA_DESC OIDIndicationValue; // OUT - only valid after indication - - NDIS_VAR_DATA_DESC TriggerValue; // IN - -} NDIS_WW_INDICATION_REQUEST, *PNDIS_WW_INDICATION_REQUEST; - -#define OID_INDICATION_REQUEST_ENABLE 0x0000 -#define OID_INDICATION_REQUEST_CANCEL 0x0001 -// -// OID_WW_GEN_DEVICE_INFO -// -typedef struct _WW_DEVICE_INFO { - NDIS_VAR_DATA_DESC Manufacturer; - NDIS_VAR_DATA_DESC ModelNum; - NDIS_VAR_DATA_DESC SWVersionNum; - NDIS_VAR_DATA_DESC SerialNum; -} WW_DEVICE_INFO, *PWW_DEVICE_INFO; - -// -// OID_WW_GEN_OPERATION_MODE -// -typedef INT WW_OPERATION_MODE; // 0 = Normal mode - // 1 = Power saving mode - // -1 = mode unknown -// -// OID_WW_GEN_LOCK_STATUS -// - -typedef INT WW_LOCK_STATUS; // 0 = unlocked - // 1 = locked - // -1 = unknown lock status -// -// OID_WW_GEN_DISABLE_TRANSMITTER -// - -typedef INT WW_DISABLE_TRANSMITTER; // 0 = transmitter enabled - // 1 = transmitter disabled - // -1 = unknown value -// -// OID_WW_GEN_NETWORK_ID -// - -typedef NDIS_VAR_DATA_DESC WW_NETWORK_ID; -// -// OID_WW_GEN_PERMANENT_ADDRESS -// -typedef NDIS_VAR_DATA_DESC WW_PERMANENT_ADDRESS; -// -// OID_WW_GEN_CURRENT_ADDRESS -// -typedef struct _WW_CURRENT_ADDRESS { - NDIS_WW_HEADER_FORMAT Format; - NDIS_VAR_DATA_DESC Address; -} WW_CURRENT_ADDRESS, *PWW_CURRENT_ADDRESS; - -// -// OID_WW_GEN_SUSPEND_DRIVER -// -typedef BOOLEAN WW_SUSPEND_DRIVER; // 0 = driver operational - // 1 = driver suspended -// -// OID_WW_GEN_BASESTATION_ID -// - -typedef NDIS_VAR_DATA_DESC WW_BASESTATION_ID; -// -// OID_WW_GEN_CHANNEL_ID -// -typedef NDIS_VAR_DATA_DESC WW_CHANNEL_ID; -// -// OID_WW_GEN_ENCRYPTION_STATE -// -typedef BOOLEAN WW_ENCRYPTION_STATE; // 0 = if encryption is disabled - // 1 = if encryption is enabled -// -// OID_WW_GEN_CHANNEL_QUALITY -// - -typedef INT WW_CHANNEL_QUALITY; // 0 = Not in network contact, - // 1-100 = Quality of Channel (100 is highest quality). - // -1 = channel quality is unknown -// -// OID_WW_GEN_REGISTRATION_STATUS -// - -typedef INT WW_REGISTRATION_STATUS; // 0 = Registration denied - // 1 = Registration pending - // 2 = Registered - // -1 = unknown registration status -// -// OID_WW_GEN_RADIO_LINK_SPEED -// - -typedef UINT WW_RADIO_LINK_SPEED; // Bits per second. -// -// OID_WW_GEN_LATENCY -// - -typedef UINT WW_LATENCY; // milliseconds -// -// OID_WW_GEN_BATTERY_LEVEL -// - -typedef INT WW_BATTERY_LEVEL; // 0-100 = battery level in percentage - // (100=fully charged) - // -1 = unknown battery level. -// -// OID_WW_GEN_EXTERNAL_POWER -// - -typedef INT WW_EXTERNAL_POWER; // 0 = no external power connected - // 1 = external power connected - // -1 = unknown -// -// OID_WW_MET_FUNCTION -// - -typedef NDIS_VAR_DATA_DESC WW_MET_FUNCTION; -// -// OID_WW_TAC_COMPRESSION -// -typedef BOOLEAN WW_TAC_COMPRESSION; // Determines whether or not network level compression - // is being used. -// -// OID_WW_TAC_SET_CONFIG -// - -typedef struct _WW_TAC_SETCONFIG { - NDIS_VAR_DATA_DESC RCV_MODE; - NDIS_VAR_DATA_DESC TX_CONTROL; - NDIS_VAR_DATA_DESC RX_CONTROL; - NDIS_VAR_DATA_DESC FLOW_CONTROL; - NDIS_VAR_DATA_DESC RESET_CNF; - NDIS_VAR_DATA_DESC READ_CNF; -} WW_TAC_SETCONFIG, *PWW_TAC_SETCONFIG; - -// -// OID_WW_TAC_GET_STATUS -// -typedef struct _WW_TAC_GETSTATUS { - BOOLEAN Action; // Set = Execute command. - - NDIS_VAR_DATA_DESC Command; - NDIS_VAR_DATA_DESC Option; - NDIS_VAR_DATA_DESC Response; // The response to the requested command - // - max. length of string is 256 octets. - -} WW_TAC_GETSTATUS, *PWW_TAC_GETSTATUS; - -// -// OID_WW_TAC_USER_HEADER -// -typedef NDIS_VAR_DATA_DESC WW_TAC_USERHEADER; // This will hold the user header - Max. 64 octets. -// -// OID_WW_ARD_SNDCP -// - -typedef struct _WW_ARD_SNDCP { - NDIS_VAR_DATA_DESC Version; // The version of SNDCP protocol supported. - - INT BlockSize; // The block size used for SNDCP - - INT Window; // The window size used in SNDCP - -} WW_ARD_SNDCP, *PWW_ARD_SNDCP; - -// -// OID_WW_ARD_TMLY_MSG -// -typedef BOOLEAN WW_ARD_CHANNEL_STATUS; // The current status of the inbound RF Channel. -// -// OID_WW_ARD_DATAGRAM -// - -typedef struct _WW_ARD_DATAGRAM { - BOOLEAN LoadLevel; // Byte that contains the load level info. - - INT SessionTime; // Datagram session time remaining. - - NDIS_VAR_DATA_DESC HostAddr; // Host address. - - NDIS_VAR_DATA_DESC THostAddr; // Test host address. - -} WW_ARD_DATAGRAM, *PWW_ARD_DATAGRAM; - -// -// OID_WW_CDPD_SPNI -// -typedef struct _WW_CDPD_SPNI { - UINT SPNI[10]; //10 16-bit service provider network IDs - - INT OperatingMode; // 0 = ignore SPNI, - // 1 = require SPNI from list, - // 2 = prefer SPNI from list. - // 3 = exclude SPNI from list. - -} WW_CDPD_SPNI, *PWW_CDPD_SPNI; - -// -// OID_WW_CDPD_WASI -// -typedef struct _WW_CDPD_WIDE_AREA_SERVICE_ID { - UINT WASI[10]; //10 16-bit wide area service IDs - - INT OperatingMode; // 0 = ignore WASI, - // 1 = Require WASI from list, - // 2 = prefer WASI from list - // 3 = exclude WASI from list. - -} WW_CDPD_WIDE_AREA_SERVICE_ID, *PWW_CDPD_WIDE_AREA_SERVICE_ID; - -// -// OID_WW_CDPD_AREA_COLOR -// -typedef INT WW_CDPD_AREA_COLOR; -// -// OID_WW_CDPD_TX_POWER_LEVEL -// -typedef UINT WW_CDPD_TX_POWER_LEVEL; -// -// OID_WW_CDPD_EID -// -typedef NDIS_VAR_DATA_DESC WW_CDPD_EID; -// -// OID_WW_CDPD_HEADER_COMPRESSION -// -typedef INT WW_CDPD_HEADER_COMPRESSION; // 0 = no header compression, - // 1 = always compress headers, - // 2 = compress headers if MD-IS does - // -1 = unknown -// -// OID_WW_CDPD_DATA_COMPRESSION -// - -typedef INT WW_CDPD_DATA_COMPRESSION; // 0 = no data compression, - // 1 = data compression enabled - // -1 = unknown -// -// OID_WW_CDPD_CHANNEL_SELECT -// - -typedef struct _WW_CDPD_CHANNEL_SELECT { - UINT ChannelID; // channel number - - UINT fixedDuration; // duration in seconds - -} WW_CDPD_CHANNEL_SELECT, *PWW_CDPD_CHANNEL_SELECT; - -// -// OID_WW_CDPD_CHANNEL_STATE -// -typedef enum _WW_CDPD_CHANNEL_STATE { - CDPDChannelNotAvail, - CDPDChannelScanning, - CDPDChannelInitAcquired, - CDPDChannelAcquired, - CDPDChannelSleeping, - CDPDChannelWaking, - CDPDChannelCSDialing, - CDPDChannelCSRedial, - CDPDChannelCSAnswering, - CDPDChannelCSConnected, - CDPDChannelCSSuspended -} WW_CDPD_CHANNEL_STATE, *PWW_CDPD_CHANNEL_STATE; - -// -// OID_WW_CDPD_NEI -// -typedef enum _WW_CDPD_NEI_FORMAT { - CDPDNeiIPv4, - CDPDNeiCLNP, - CDPDNeiIPv6 -} WW_CDPD_NEI_FORMAT, *PWW_CDPD_NEI_FORMAT; -typedef enum _WW_CDPD_NEI_TYPE { - CDPDNeiIndividual, - CDPDNeiMulticast, - CDPDNeiBroadcast -} WW_CDPD_NEI_TYPE; -typedef struct _WW_CDPD_NEI { - UINT uNeiIndex; - WW_CDPD_NEI_FORMAT NeiFormat; - WW_CDPD_NEI_TYPE NeiType; - WORD NeiGmid; // group member identifier, only - // meaningful if NeiType == - // CDPDNeiMulticast - - NDIS_VAR_DATA_DESC NeiAddress; -} WW_CDPD_NEI; - -// -// OID_WW_CDPD_NEI_STATE -// -typedef enum _WW_CDPD_NEI_STATE { - CDPDUnknown, - CDPDRegistered, - CDPDDeregistered -} WW_CDPD_NEI_STATE, *PWW_CDPD_NEI_STATE; -typedef enum _WW_CDPD_NEI_SUB_STATE { - CDPDPending, // Registration pending - CDPDNoReason, // Registration denied - no reason given - CDPDMDISNotCapable, // Registration denied - MD-IS not capable of - // handling M-ES at this time - CDPDNEINotAuthorized, // Registration denied - NEI is not authorized to - // use this subnetwork - CDPDInsufficientAuth, // Registration denied - M-ES gave insufficient - // authentication credentials - CDPDUnsupportedAuth, // Registration denied - M-ES gave unsupported - // authentication credentials - CDPDUsageExceeded, // Registration denied - NEI has exceeded usage - // limitations - CDPDDeniedThisNetwork // Registration denied on this network, service - // may be obtained on alternate Service Provider - // network -} WW_CDPD_NEI_SUB_STATE; -typedef struct _WW_CDPD_NEI_REG_STATE { - UINT uNeiIndex; - WW_CDPD_NEI_STATE NeiState; - WW_CDPD_NEI_SUB_STATE NeiSubState; -} WW_CDPD_NEI_REG_STATE, *PWW_CDPD_NEI_REG_STATE; - -// -// OID_WW_CDPD_SERVICE_PROVIDER_IDENTIFIER -// -typedef struct _WW_CDPD_SERVICE_PROVIDER_ID { - UINT SPI[10]; //10 16-bit service provider IDs - - INT OperatingMode; // 0 = ignore SPI, - // 1 = require SPI from list, - // 2 = prefer SPI from list. - // 3 = exclude SPI from list. - -} WW_CDPD_SERVICE_PROVIDER_ID, *PWW_CDPD_SERVICE_PROVIDER_ID; - -// -// OID_WW_CDPD_SLEEP_MODE -// -typedef INT WW_CDPD_SLEEP_MODE; -// -// OID_WW_CDPD_TEI -// -typedef ULONG WW_CDPD_TEI; -// -// OID_WW_CDPD_CIRCUIT_SWITCHED -// -typedef struct _WW_CDPD_CIRCUIT_SWITCHED { - INT service_preference; // -1 = unknown, - // 0 = always use packet switched CDPD, - // 1 = always use CS CDPD via AMPS, - // 2 = always use CS CDPD via PSTN, - // 3 = use circuit switched via AMPS only - // when packet switched is not available. - // 4 = use packet switched only when circuit - // switched via AMPS is not available. - // 5 = device manuf. defined service - // preference. - // 6 = device manuf. defined service - // preference. - - INT service_status; // -1 = unknown, - // 0 = packet switched CDPD, - // 1 = circuit switched CDPD via AMPS, - // 2 = circuit switched CDPD via PSTN. - - INT connect_rate; // CS connection bit rate (bits per second). - // 0 = no active connection, - // -1 = unknown - // Dial code last used to dial. - - NDIS_VAR_DATA_DESC dial_code[20]; - - UINT sid; // Current AMPS system ID - - INT a_b_side_selection; // -1 = unknown, - // 0 = no AMPS service - // 1 = AMPS "A" side channels selected - // 2 = AMPS "B" side channels selected - - INT AMPS_channel; // -1= unknown - // 0 = no AMPS service. - // 1-1023 = AMPS channel number in use - - UINT action; // 0 = no action - // 1 = suspend (hangup) - // 2 = dial - - // Default dial code for CS CDPD service - // encoded as specified in the CS CDPD - // implementor guidelines. - NDIS_VAR_DATA_DESC default_dial[20]; - - // Number for the CS CDPD network to call - // back the mobile, encoded as specified in - // the CS CDPD implementor guidelines. - NDIS_VAR_DATA_DESC call_back[20]; - - UINT sid_list[10]; // List of 10 16-bit preferred AMPS - // system IDs for CS CDPD. - - UINT inactivity_timer; // Wait time after last data before dropping - // call. - // 0-65535 = inactivity time limit (seconds). - - UINT receive_timer; // secs. per CS-CDPD Implementor Guidelines. - - UINT conn_resp_timer; // secs. per CS-CDPD Implementor Guidelines. - - UINT reconn_resp_timer; // secs. per CS-CDPD Implementor Guidelines. - - UINT disconn_timer; // secs. per CS-CDPD Implementor Guidelines. - - UINT NEI_reg_timer; // secs. per CS-CDPD Implementor Guidelines. - - UINT reconn_retry_timer; // secs. per CS-CDPD Implementor Guidelines. - - UINT link_reset_timer; // secs. per CS-CDPD Implementor Guidelines. - - UINT link_reset_ack_timer; // secs. per CS-CDPD Implementor Guidelines. - - UINT n401_retry_limit; // per CS-CDPD Implementor Guidelines. - - UINT n402_retry_limit; // per CS-CDPD Implementor Guidelines. - - UINT n404_retry_limit; // per CS-CDPD Implementor Guidelines. - - UINT n405_retry_limit; // per CS-CDPD Implementor Guidelines. - -} WW_CDPD_CIRCUIT_SWITCHED, *WW_PCDPD_CIRCUIT_SWITCHED; -typedef UINT WW_CDPD_RSSI; -// -// OID_WW_PIN_LOC_AUTHORIZE -// -typedef INT WW_PIN_AUTHORIZED; // 0 = unauthorized - // 1 = authorized - // -1 = unknown -// -// OID_WW_PIN_LAST_LOCATION -// OID_WW_PIN_LOC_FIX -// - -typedef struct _WW_PIN_LOCATION { - INT Latitude; // Latitude in hundredths of a second - - INT Longitude; // Longitude in hundredths of a second - - INT Altitude; // Altitude in feet - - INT FixTime; // Time of the location fix, since midnight, local time (of the - // current day), in tenths of a second - - INT NetTime; // Current local network time of the current day, since midnight, - // in tenths of a second - - INT LocQuality; // 0-100 = location quality - - INT LatReg; // Latitude registration offset, in hundredths of a second - - INT LongReg; // Longitude registration offset, in hundredths of a second - - INT GMTOffset; // Offset in minutes of the local time zone from GMT - -} WW_PIN_LOCATION, *PWW_PIN_LOCATION; - -// -// The following is set on a per-packet basis as OOB data with NdisClassWirelessWanMbxMailbox -// -typedef ULONG WW_MBX_MAILBOX_FLAG; // 1 = set mailbox flag, 0 = do not set mailbox flag -// -// OID_WW_MBX_SUBADDR -// - -typedef struct _WW_MBX_PMAN { - BOOLEAN ACTION; // 0 = Login PMAN, 1 = Logout PMAN - - UINT MAN; - UCHAR PASSWORD[8]; // Password should be null for Logout and indications. - // Maximum length of password is 8 chars. - -} WW_MBX_PMAN, *PWW_MBX_PMAN; - -// -// OID_WW_MBX_FLEXLIST -// -typedef struct _WW_MBX_FLEXLIST { - INT count; // Number of MAN entries used. - // -1=unknown. - - UINT MAN[7]; // List of MANs. - -} WW_MBX_FLEXLIST; - -// -// OID_WW_MBX_GROUPLIST -// -typedef struct _WW_MBX_GROUPLIST { - INT count; // Number of MAN entries used. - // -1=unknown. - - UINT MAN[15]; // List of MANs. - -} WW_MBX_GROUPLIST; - -// -// OID_WW_MBX_TRAFFIC_AREA -// -typedef enum _WW_MBX_TRAFFIC_AREA { - unknown_traffic_area, // The driver has no information about the current traffic area. - in_traffic_area, // Mobile unit has entered a subscribed traffic area. - in_auth_traffic_area, // Mobile unit is outside traffic area but is authorized. - unauth_traffic_area // Mobile unit is outside traffic area but is un-authorized. -} WW_MBX_TRAFFIC_AREA; - -// -// OID_WW_MBX_LIVE_DIE -// -typedef INT WW_MBX_LIVE_DIE; // 0 = DIE last received - // 1 = LIVE last received - // -1 = unknown -// -// OID_WW_MBX_TEMP_DEFAULTLIST -// - -typedef struct _WW_MBX_CHANNEL_PAIR { - UINT Mobile_Tx; - UINT Mobile_Rx; -} WW_MBX_CHANNEL_PAIR, *PWW_MBX_CHANNEL_PAIR; -typedef struct _WW_MBX_TEMPDEFAULTLIST { - UINT Length; - WW_MBX_CHANNEL_PAIR ChannelPair[1]; -} WW_MBX_TEMPDEFAULTLIST, *WW_PMBX_TEMPDEFAULTLIST; - -#endif // WIRELESS_WAN -#endif // _NTDDNDIS_ +/*++ BUILD Version: 0001 // Increment this if a change has global effects + Copyright (c) 1990-1993 Microsoft Corporation + Module Name: + ntddndis.h + Abstract: + This is the include file that defines all constants and types for + accessing the Network driver interface device. + Author: + Steve Wood (stevewo) 27-May-1990 + Revision History: + Adam Barr (adamba) 04-Nov-1992 added the correct values for NDIS 3.0. + Jameel Hyder (jameelh) 01-Aug-95 added Pnp IoCTLs and structures + Kyle Brandon (kyleb) 09/24/96 added general co ndis oids. + -- */ +#ifndef _NTDDNDIS_ +#define _NTDDNDIS_ +// +// Device Name - this string is the name of the device. It is the name +// that should be passed to NtOpenFile when accessing the device. +// +// Note: For devices that support multiple units, it should be suffixed +// with the Ascii representation of the unit number. +// +#define DD_NDIS_DEVICE_NAME "\\Device\\UNKNOWN" +// +// NtDeviceIoControlFile IoControlCode values for this device. +// +// Warning: Remember that the low two bits of the code specify how the +// buffers are passed to the driver! +// +#define _NDIS_CONTROL_CODE(request,method) \ + CTL_CODE(FILE_DEVICE_PHYSICAL_NETCARD, request, method, FILE_ANY_ACCESS) +#define IOCTL_NDIS_QUERY_GLOBAL_STATS _NDIS_CONTROL_CODE( 0, METHOD_OUT_DIRECT ) +#define IOCTL_NDIS_QUERY_ALL_STATS _NDIS_CONTROL_CODE( 1, METHOD_OUT_DIRECT ) +#define IOCTL_NDIS_ADD_DEVICE _NDIS_CONTROL_CODE( 2, METHOD_BUFFERED ) +#define IOCTL_NDIS_DELETE_DEVICE _NDIS_CONTROL_CODE( 3, METHOD_BUFFERED ) +#define IOCTL_NDIS_TRANSLATE_NAME _NDIS_CONTROL_CODE( 4, METHOD_BUFFERED ) +#define IOCTL_NDIS_ADD_TDI_DEVICE _NDIS_CONTROL_CODE( 5, METHOD_BUFFERED ) +#define IOCTL_NDIS_NOTIFY_PROTOCOL _NDIS_CONTROL_CODE( 6, METHOD_BUFFERED ) +#define IOCTL_NDIS_GET_LOG_DATA _NDIS_CONTROL_CODE( 7, METHOD_OUT_DIRECT ) +// +// NtDeviceIoControlFile InputBuffer/OutputBuffer record structures for +// this device. +// +// +// This is the type of an NDIS OID value. +// +typedef ULONG NDIS_OID, *PNDIS_OID; +// +// IOCTL_NDIS_QUERY_ALL_STATS returns a sequence of these, packed +// together (no padding is required since statistics all have +// four or eight bytes of data). +// +typedef struct _NDIS_STATISTICS_VALUE { + NDIS_OID Oid; + ULONG DataLength; + UCHAR Data[1]; // variable length + +} NDIS_STATISTICS_VALUE, *PNDIS_STATISTICS_VALUE; + +// +// Structure used by TRANSLATE_NAME IOCTL +// +typedef struct _NET_PNP_ID { + ULONG ClassId; + ULONG Token; +} NET_PNP_ID, *PNET_PNP_ID; + +typedef struct _NET_PNP_TRANSLATE_LIST { + ULONG BytesNeeded; + NET_PNP_ID IdArray[ANYSIZE_ARRAY]; +} NET_PNP_TRANSLATE_LIST, *PNET_PNP_TRANSLATE_LIST; + +// +// Structure used to define a self-contained variable data structure +// +typedef struct _NDIS_VAR_DATA_DESC { + USHORT Length; // # of octects of data + + USHORT MaximumLength; // # of octects available + + LONG Offset; // Offset of data relative to the descriptor + +} NDIS_VAR_DATA_DESC, *PNDIS_VAR_DATA_DESC; + +// +// Object Identifiers used by NdisRequest Query/Set Information +// +// +// General Objects +// +#define OID_GEN_SUPPORTED_LIST 0x00010101 +#define OID_GEN_HARDWARE_STATUS 0x00010102 +#define OID_GEN_MEDIA_SUPPORTED 0x00010103 +#define OID_GEN_MEDIA_IN_USE 0x00010104 +#define OID_GEN_MAXIMUM_LOOKAHEAD 0x00010105 +#define OID_GEN_MAXIMUM_FRAME_SIZE 0x00010106 +#define OID_GEN_LINK_SPEED 0x00010107 +#define OID_GEN_TRANSMIT_BUFFER_SPACE 0x00010108 +#define OID_GEN_RECEIVE_BUFFER_SPACE 0x00010109 +#define OID_GEN_TRANSMIT_BLOCK_SIZE 0x0001010A +#define OID_GEN_RECEIVE_BLOCK_SIZE 0x0001010B +#define OID_GEN_VENDOR_ID 0x0001010C +#define OID_GEN_VENDOR_DESCRIPTION 0x0001010D +#define OID_GEN_CURRENT_PACKET_FILTER 0x0001010E +#define OID_GEN_CURRENT_LOOKAHEAD 0x0001010F +#define OID_GEN_DRIVER_VERSION 0x00010110 +#define OID_GEN_MAXIMUM_TOTAL_SIZE 0x00010111 +#define OID_GEN_PROTOCOL_OPTIONS 0x00010112 +#define OID_GEN_MAC_OPTIONS 0x00010113 +#define OID_GEN_MEDIA_CONNECT_STATUS 0x00010114 +#define OID_GEN_MAXIMUM_SEND_PACKETS 0x00010115 +#define OID_GEN_VENDOR_DRIVER_VERSION 0x00010116 +#define OID_GEN_XMIT_OK 0x00020101 +#define OID_GEN_RCV_OK 0x00020102 +#define OID_GEN_XMIT_ERROR 0x00020103 +#define OID_GEN_RCV_ERROR 0x00020104 +#define OID_GEN_RCV_NO_BUFFER 0x00020105 +#define OID_GEN_DIRECTED_BYTES_XMIT 0x00020201 +#define OID_GEN_DIRECTED_FRAMES_XMIT 0x00020202 +#define OID_GEN_MULTICAST_BYTES_XMIT 0x00020203 +#define OID_GEN_MULTICAST_FRAMES_XMIT 0x00020204 +#define OID_GEN_BROADCAST_BYTES_XMIT 0x00020205 +#define OID_GEN_BROADCAST_FRAMES_XMIT 0x00020206 +#define OID_GEN_DIRECTED_BYTES_RCV 0x00020207 +#define OID_GEN_DIRECTED_FRAMES_RCV 0x00020208 +#define OID_GEN_MULTICAST_BYTES_RCV 0x00020209 +#define OID_GEN_MULTICAST_FRAMES_RCV 0x0002020A +#define OID_GEN_BROADCAST_BYTES_RCV 0x0002020B +#define OID_GEN_BROADCAST_FRAMES_RCV 0x0002020C +#define OID_GEN_RCV_CRC_ERROR 0x0002020D +#define OID_GEN_TRANSMIT_QUEUE_LENGTH 0x0002020E +#define OID_GEN_GET_TIME_CAPS 0x0002020F +#define OID_GEN_GET_NETCARD_TIME 0x00020210 +// +// These are connection-oriented general OIDs. +// These replace the above OIDs for connection-oriented media. +// +#define OID_GEN_CO_SUPPORTED_LIST 0x00010101 +#define OID_GEN_CO_HARDWARE_STATUS 0x00010102 +#define OID_GEN_CO_MEDIA_SUPPORTED 0x00010103 +#define OID_GEN_CO_MEDIA_IN_USE 0x00010104 +#define OID_GEN_CO_LINK_SPEED 0x00010105 +#define OID_GEN_CO_VENDOR_ID 0x00010106 +#define OID_GEN_CO_VENDOR_DESCRIPTION 0x00010107 +#define OID_GEN_CO_DRIVER_VERSION 0x00010108 +#define OID_GEN_CO_PROTOCOL_OPTIONS 0x00010109 +#define OID_GEN_CO_MAC_OPTIONS 0x0001010A +#define OID_GEN_CO_MEDIA_CONNECT_STATUS 0x0001010B +#define OID_GEN_CO_VENDOR_DRIVER_VERSION 0x0001010C +#define OID_GEN_CO_MINIMUM_LINK_SPEED 0x0001010D +#define OID_GEN_CO_GET_TIME_CAPS 0x00010201 +#define OID_GEN_CO_GET_NETCARD_TIME 0x00010202 +// +// These are connection-oriented statistics OIDs. +// +#define OID_GEN_CO_XMIT_PDUS_OK 0x00020101 +#define OID_GEN_CO_RCV_PDUS_OK 0x00020102 +#define OID_GEN_CO_XMIT_PDUS_ERROR 0x00020103 +#define OID_GEN_CO_RCV_PDUS_ERROR 0x00020104 +#define OID_GEN_CO_RCV_PDUS_NO_BUFFER 0x00020105 +#define OID_GEN_CO_RCV_CRC_ERROR 0x00020201 +#define OID_GEN_CO_TRANSMIT_QUEUE_LENGTH 0x00020202 +#define OID_GEN_CO_BYTES_XMIT 0x00020203 +#define OID_GEN_CO_BYTES_RCV 0x00020204 +#define OID_GEN_CO_BYTES_XMIT_OUTSTANDING 0x00020205 +#define OID_GEN_CO_NETCARD_LOAD 0x00020206 +// +// These are objects for Connection-oriented media call-managers and are not +// valid for ndis drivers. Under construction. +// +#define OID_CO_ADD_PVC 0xFF000001 +#define OID_CO_DELETE_PVC 0xFF000002 +#define OID_CO_GET_CALL_INFORMATION 0xFF000003 +#define OID_CO_ADD_ADDRESS 0xFF000004 +#define OID_CO_DELETE_ADDRESS 0xFF000005 +#define OID_CO_GET_ADDRESSES 0xFF000006 +#define OID_CO_ADDRESS_CHANGE 0xFF000007 +#define OID_CO_SIGNALING_ENABLED 0xFF000008 +#define OID_CO_SIGNALING_DISABLED 0xFF000009 +// +// 802.3 Objects (Ethernet) +// +#define OID_802_3_PERMANENT_ADDRESS 0x01010101 +#define OID_802_3_CURRENT_ADDRESS 0x01010102 +#define OID_802_3_MULTICAST_LIST 0x01010103 +#define OID_802_3_MAXIMUM_LIST_SIZE 0x01010104 +#define OID_802_3_MAC_OPTIONS 0x01010105 +// +// +#define NDIS_802_3_MAC_OPTION_PRIORITY 0x00000001 +#define OID_802_3_RCV_ERROR_ALIGNMENT 0x01020101 +#define OID_802_3_XMIT_ONE_COLLISION 0x01020102 +#define OID_802_3_XMIT_MORE_COLLISIONS 0x01020103 +#define OID_802_3_XMIT_DEFERRED 0x01020201 +#define OID_802_3_XMIT_MAX_COLLISIONS 0x01020202 +#define OID_802_3_RCV_OVERRUN 0x01020203 +#define OID_802_3_XMIT_UNDERRUN 0x01020204 +#define OID_802_3_XMIT_HEARTBEAT_FAILURE 0x01020205 +#define OID_802_3_XMIT_TIMES_CRS_LOST 0x01020206 +#define OID_802_3_XMIT_LATE_COLLISIONS 0x01020207 +// +// 802.5 Objects (Token-Ring) +// +#define OID_802_5_PERMANENT_ADDRESS 0x02010101 +#define OID_802_5_CURRENT_ADDRESS 0x02010102 +#define OID_802_5_CURRENT_FUNCTIONAL 0x02010103 +#define OID_802_5_CURRENT_GROUP 0x02010104 +#define OID_802_5_LAST_OPEN_STATUS 0x02010105 +#define OID_802_5_CURRENT_RING_STATUS 0x02010106 +#define OID_802_5_CURRENT_RING_STATE 0x02010107 +#define OID_802_5_LINE_ERRORS 0x02020101 +#define OID_802_5_LOST_FRAMES 0x02020102 +#define OID_802_5_BURST_ERRORS 0x02020201 +#define OID_802_5_AC_ERRORS 0x02020202 +#define OID_802_5_ABORT_DELIMETERS 0x02020203 +#define OID_802_5_FRAME_COPIED_ERRORS 0x02020204 +#define OID_802_5_FREQUENCY_ERRORS 0x02020205 +#define OID_802_5_TOKEN_ERRORS 0x02020206 +#define OID_802_5_INTERNAL_ERRORS 0x02020207 +// +// FDDI Objects +// +#define OID_FDDI_LONG_PERMANENT_ADDR 0x03010101 +#define OID_FDDI_LONG_CURRENT_ADDR 0x03010102 +#define OID_FDDI_LONG_MULTICAST_LIST 0x03010103 +#define OID_FDDI_LONG_MAX_LIST_SIZE 0x03010104 +#define OID_FDDI_SHORT_PERMANENT_ADDR 0x03010105 +#define OID_FDDI_SHORT_CURRENT_ADDR 0x03010106 +#define OID_FDDI_SHORT_MULTICAST_LIST 0x03010107 +#define OID_FDDI_SHORT_MAX_LIST_SIZE 0x03010108 +#define OID_FDDI_ATTACHMENT_TYPE 0x03020101 +#define OID_FDDI_UPSTREAM_NODE_LONG 0x03020102 +#define OID_FDDI_DOWNSTREAM_NODE_LONG 0x03020103 +#define OID_FDDI_FRAME_ERRORS 0x03020104 +#define OID_FDDI_FRAMES_LOST 0x03020105 +#define OID_FDDI_RING_MGT_STATE 0x03020106 +#define OID_FDDI_LCT_FAILURES 0x03020107 +#define OID_FDDI_LEM_REJECTS 0x03020108 +#define OID_FDDI_LCONNECTION_STATE 0x03020109 +#define OID_FDDI_SMT_STATION_ID 0x03030201 +#define OID_FDDI_SMT_OP_VERSION_ID 0x03030202 +#define OID_FDDI_SMT_HI_VERSION_ID 0x03030203 +#define OID_FDDI_SMT_LO_VERSION_ID 0x03030204 +#define OID_FDDI_SMT_MANUFACTURER_DATA 0x03030205 +#define OID_FDDI_SMT_USER_DATA 0x03030206 +#define OID_FDDI_SMT_MIB_VERSION_ID 0x03030207 +#define OID_FDDI_SMT_MAC_CT 0x03030208 +#define OID_FDDI_SMT_NON_MASTER_CT 0x03030209 +#define OID_FDDI_SMT_MASTER_CT 0x0303020A +#define OID_FDDI_SMT_AVAILABLE_PATHS 0x0303020B +#define OID_FDDI_SMT_CONFIG_CAPABILITIES 0x0303020C +#define OID_FDDI_SMT_CONFIG_POLICY 0x0303020D +#define OID_FDDI_SMT_CONNECTION_POLICY 0x0303020E +#define OID_FDDI_SMT_T_NOTIFY 0x0303020F +#define OID_FDDI_SMT_STAT_RPT_POLICY 0x03030210 +#define OID_FDDI_SMT_TRACE_MAX_EXPIRATION 0x03030211 +#define OID_FDDI_SMT_PORT_INDEXES 0x03030212 +#define OID_FDDI_SMT_MAC_INDEXES 0x03030213 +#define OID_FDDI_SMT_BYPASS_PRESENT 0x03030214 +#define OID_FDDI_SMT_ECM_STATE 0x03030215 +#define OID_FDDI_SMT_CF_STATE 0x03030216 +#define OID_FDDI_SMT_HOLD_STATE 0x03030217 +#define OID_FDDI_SMT_REMOTE_DISCONNECT_FLAG 0x03030218 +#define OID_FDDI_SMT_STATION_STATUS 0x03030219 +#define OID_FDDI_SMT_PEER_WRAP_FLAG 0x0303021A +#define OID_FDDI_SMT_MSG_TIME_STAMP 0x0303021B +#define OID_FDDI_SMT_TRANSITION_TIME_STAMP 0x0303021C +#define OID_FDDI_SMT_SET_COUNT 0x0303021D +#define OID_FDDI_SMT_LAST_SET_STATION_ID 0x0303021E +#define OID_FDDI_MAC_FRAME_STATUS_FUNCTIONS 0x0303021F +#define OID_FDDI_MAC_BRIDGE_FUNCTIONS 0x03030220 +#define OID_FDDI_MAC_T_MAX_CAPABILITY 0x03030221 +#define OID_FDDI_MAC_TVX_CAPABILITY 0x03030222 +#define OID_FDDI_MAC_AVAILABLE_PATHS 0x03030223 +#define OID_FDDI_MAC_CURRENT_PATH 0x03030224 +#define OID_FDDI_MAC_UPSTREAM_NBR 0x03030225 +#define OID_FDDI_MAC_DOWNSTREAM_NBR 0x03030226 +#define OID_FDDI_MAC_OLD_UPSTREAM_NBR 0x03030227 +#define OID_FDDI_MAC_OLD_DOWNSTREAM_NBR 0x03030228 +#define OID_FDDI_MAC_DUP_ADDRESS_TEST 0x03030229 +#define OID_FDDI_MAC_REQUESTED_PATHS 0x0303022A +#define OID_FDDI_MAC_DOWNSTREAM_PORT_TYPE 0x0303022B +#define OID_FDDI_MAC_INDEX 0x0303022C +#define OID_FDDI_MAC_SMT_ADDRESS 0x0303022D +#define OID_FDDI_MAC_LONG_GRP_ADDRESS 0x0303022E +#define OID_FDDI_MAC_SHORT_GRP_ADDRESS 0x0303022F +#define OID_FDDI_MAC_T_REQ 0x03030230 +#define OID_FDDI_MAC_T_NEG 0x03030231 +#define OID_FDDI_MAC_T_MAX 0x03030232 +#define OID_FDDI_MAC_TVX_VALUE 0x03030233 +#define OID_FDDI_MAC_T_PRI0 0x03030234 +#define OID_FDDI_MAC_T_PRI1 0x03030235 +#define OID_FDDI_MAC_T_PRI2 0x03030236 +#define OID_FDDI_MAC_T_PRI3 0x03030237 +#define OID_FDDI_MAC_T_PRI4 0x03030238 +#define OID_FDDI_MAC_T_PRI5 0x03030239 +#define OID_FDDI_MAC_T_PRI6 0x0303023A +#define OID_FDDI_MAC_FRAME_CT 0x0303023B +#define OID_FDDI_MAC_COPIED_CT 0x0303023C +#define OID_FDDI_MAC_TRANSMIT_CT 0x0303023D +#define OID_FDDI_MAC_TOKEN_CT 0x0303023E +#define OID_FDDI_MAC_ERROR_CT 0x0303023F +#define OID_FDDI_MAC_LOST_CT 0x03030240 +#define OID_FDDI_MAC_TVX_EXPIRED_CT 0x03030241 +#define OID_FDDI_MAC_NOT_COPIED_CT 0x03030242 +#define OID_FDDI_MAC_LATE_CT 0x03030243 +#define OID_FDDI_MAC_RING_OP_CT 0x03030244 +#define OID_FDDI_MAC_FRAME_ERROR_THRESHOLD 0x03030245 +#define OID_FDDI_MAC_FRAME_ERROR_RATIO 0x03030246 +#define OID_FDDI_MAC_NOT_COPIED_THRESHOLD 0x03030247 +#define OID_FDDI_MAC_NOT_COPIED_RATIO 0x03030248 +#define OID_FDDI_MAC_RMT_STATE 0x03030249 +#define OID_FDDI_MAC_DA_FLAG 0x0303024A +#define OID_FDDI_MAC_UNDA_FLAG 0x0303024B +#define OID_FDDI_MAC_FRAME_ERROR_FLAG 0x0303024C +#define OID_FDDI_MAC_NOT_COPIED_FLAG 0x0303024D +#define OID_FDDI_MAC_MA_UNITDATA_AVAILABLE 0x0303024E +#define OID_FDDI_MAC_HARDWARE_PRESENT 0x0303024F +#define OID_FDDI_MAC_MA_UNITDATA_ENABLE 0x03030250 +#define OID_FDDI_PATH_INDEX 0x03030251 +#define OID_FDDI_PATH_RING_LATENCY 0x03030252 +#define OID_FDDI_PATH_TRACE_STATUS 0x03030253 +#define OID_FDDI_PATH_SBA_PAYLOAD 0x03030254 +#define OID_FDDI_PATH_SBA_OVERHEAD 0x03030255 +#define OID_FDDI_PATH_CONFIGURATION 0x03030256 +#define OID_FDDI_PATH_T_R_MODE 0x03030257 +#define OID_FDDI_PATH_SBA_AVAILABLE 0x03030258 +#define OID_FDDI_PATH_TVX_LOWER_BOUND 0x03030259 +#define OID_FDDI_PATH_T_MAX_LOWER_BOUND 0x0303025A +#define OID_FDDI_PATH_MAX_T_REQ 0x0303025B +#define OID_FDDI_PORT_MY_TYPE 0x0303025C +#define OID_FDDI_PORT_NEIGHBOR_TYPE 0x0303025D +#define OID_FDDI_PORT_CONNECTION_POLICIES 0x0303025E +#define OID_FDDI_PORT_MAC_INDICATED 0x0303025F +#define OID_FDDI_PORT_CURRENT_PATH 0x03030260 +#define OID_FDDI_PORT_REQUESTED_PATHS 0x03030261 +#define OID_FDDI_PORT_MAC_PLACEMENT 0x03030262 +#define OID_FDDI_PORT_AVAILABLE_PATHS 0x03030263 +#define OID_FDDI_PORT_MAC_LOOP_TIME 0x03030264 +#define OID_FDDI_PORT_PMD_CLASS 0x03030265 +#define OID_FDDI_PORT_CONNECTION_CAPABILITIES 0x03030266 +#define OID_FDDI_PORT_INDEX 0x03030267 +#define OID_FDDI_PORT_MAINT_LS 0x03030268 +#define OID_FDDI_PORT_BS_FLAG 0x03030269 +#define OID_FDDI_PORT_PC_LS 0x0303026A +#define OID_FDDI_PORT_EB_ERROR_CT 0x0303026B +#define OID_FDDI_PORT_LCT_FAIL_CT 0x0303026C +#define OID_FDDI_PORT_LER_ESTIMATE 0x0303026D +#define OID_FDDI_PORT_LEM_REJECT_CT 0x0303026E +#define OID_FDDI_PORT_LEM_CT 0x0303026F +#define OID_FDDI_PORT_LER_CUTOFF 0x03030270 +#define OID_FDDI_PORT_LER_ALARM 0x03030271 +#define OID_FDDI_PORT_CONNNECT_STATE 0x03030272 +#define OID_FDDI_PORT_PCM_STATE 0x03030273 +#define OID_FDDI_PORT_PC_WITHHOLD 0x03030274 +#define OID_FDDI_PORT_LER_FLAG 0x03030275 +#define OID_FDDI_PORT_HARDWARE_PRESENT 0x03030276 +#define OID_FDDI_SMT_STATION_ACTION 0x03030277 +#define OID_FDDI_PORT_ACTION 0x03030278 +#define OID_FDDI_IF_DESCR 0x03030279 +#define OID_FDDI_IF_TYPE 0x0303027A +#define OID_FDDI_IF_MTU 0x0303027B +#define OID_FDDI_IF_SPEED 0x0303027C +#define OID_FDDI_IF_PHYS_ADDRESS 0x0303027D +#define OID_FDDI_IF_ADMIN_STATUS 0x0303027E +#define OID_FDDI_IF_OPER_STATUS 0x0303027F +#define OID_FDDI_IF_LAST_CHANGE 0x03030280 +#define OID_FDDI_IF_IN_OCTETS 0x03030281 +#define OID_FDDI_IF_IN_UCAST_PKTS 0x03030282 +#define OID_FDDI_IF_IN_NUCAST_PKTS 0x03030283 +#define OID_FDDI_IF_IN_DISCARDS 0x03030284 +#define OID_FDDI_IF_IN_ERRORS 0x03030285 +#define OID_FDDI_IF_IN_UNKNOWN_PROTOS 0x03030286 +#define OID_FDDI_IF_OUT_OCTETS 0x03030287 +#define OID_FDDI_IF_OUT_UCAST_PKTS 0x03030288 +#define OID_FDDI_IF_OUT_NUCAST_PKTS 0x03030289 +#define OID_FDDI_IF_OUT_DISCARDS 0x0303028A +#define OID_FDDI_IF_OUT_ERRORS 0x0303028B +#define OID_FDDI_IF_OUT_QLEN 0x0303028C +#define OID_FDDI_IF_SPECIFIC 0x0303028D +// +// WAN objects +// +#define OID_WAN_PERMANENT_ADDRESS 0x04010101 +#define OID_WAN_CURRENT_ADDRESS 0x04010102 +#define OID_WAN_QUALITY_OF_SERVICE 0x04010103 +#define OID_WAN_PROTOCOL_TYPE 0x04010104 +#define OID_WAN_MEDIUM_SUBTYPE 0x04010105 +#define OID_WAN_HEADER_FORMAT 0x04010106 +#define OID_WAN_GET_INFO 0x04010107 +#define OID_WAN_SET_LINK_INFO 0x04010108 +#define OID_WAN_GET_LINK_INFO 0x04010109 +#define OID_WAN_LINE_COUNT 0x0401010A +#define OID_WAN_GET_BRIDGE_INFO 0x0401020A +#define OID_WAN_SET_BRIDGE_INFO 0x0401020B +#define OID_WAN_GET_COMP_INFO 0x0401020C +#define OID_WAN_SET_COMP_INFO 0x0401020D +#define OID_WAN_GET_STATS_INFO 0x0401020E +// +// LocalTalk objects +// +#define OID_LTALK_CURRENT_NODE_ID 0x05010102 +#define OID_LTALK_IN_BROADCASTS 0x05020101 +#define OID_LTALK_IN_LENGTH_ERRORS 0x05020102 +#define OID_LTALK_OUT_NO_HANDLERS 0x05020201 +#define OID_LTALK_COLLISIONS 0x05020202 +#define OID_LTALK_DEFERS 0x05020203 +#define OID_LTALK_NO_DATA_ERRORS 0x05020204 +#define OID_LTALK_RANDOM_CTS_ERRORS 0x05020205 +#define OID_LTALK_FCS_ERRORS 0x05020206 +// +// Arcnet objects +// +#define OID_ARCNET_PERMANENT_ADDRESS 0x06010101 +#define OID_ARCNET_CURRENT_ADDRESS 0x06010102 +#define OID_ARCNET_RECONFIGURATIONS 0x06020201 +// +// TAPI objects +// +#define OID_TAPI_ACCEPT 0x07030101 +#define OID_TAPI_ANSWER 0x07030102 +#define OID_TAPI_CLOSE 0x07030103 +#define OID_TAPI_CLOSE_CALL 0x07030104 +#define OID_TAPI_CONDITIONAL_MEDIA_DETECTION 0x07030105 +#define OID_TAPI_CONFIG_DIALOG 0x07030106 +#define OID_TAPI_DEV_SPECIFIC 0x07030107 +#define OID_TAPI_DIAL 0x07030108 +#define OID_TAPI_DROP 0x07030109 +#define OID_TAPI_GET_ADDRESS_CAPS 0x0703010A +#define OID_TAPI_GET_ADDRESS_ID 0x0703010B +#define OID_TAPI_GET_ADDRESS_STATUS 0x0703010C +#define OID_TAPI_GET_CALL_ADDRESS_ID 0x0703010D +#define OID_TAPI_GET_CALL_INFO 0x0703010E +#define OID_TAPI_GET_CALL_STATUS 0x0703010F +#define OID_TAPI_GET_DEV_CAPS 0x07030110 +#define OID_TAPI_GET_DEV_CONFIG 0x07030111 +#define OID_TAPI_GET_EXTENSION_ID 0x07030112 +#define OID_TAPI_GET_ID 0x07030113 +#define OID_TAPI_GET_LINE_DEV_STATUS 0x07030114 +#define OID_TAPI_MAKE_CALL 0x07030115 +#define OID_TAPI_NEGOTIATE_EXT_VERSION 0x07030116 +#define OID_TAPI_OPEN 0x07030117 +#define OID_TAPI_PROVIDER_INITIALIZE 0x07030118 +#define OID_TAPI_PROVIDER_SHUTDOWN 0x07030119 +#define OID_TAPI_SECURE_CALL 0x0703011A +#define OID_TAPI_SELECT_EXT_VERSION 0x0703011B +#define OID_TAPI_SEND_USER_USER_INFO 0x0703011C +#define OID_TAPI_SET_APP_SPECIFIC 0x0703011D +#define OID_TAPI_SET_CALL_PARAMS 0x0703011E +#define OID_TAPI_SET_DEFAULT_MEDIA_DETECTION 0x0703011F +#define OID_TAPI_SET_DEV_CONFIG 0x07030120 +#define OID_TAPI_SET_MEDIA_MODE 0x07030121 +#define OID_TAPI_SET_STATUS_MESSAGES 0x07030122 +// +// ATM Connection Oriented Ndis +// +#define OID_ATM_SUPPORTED_VC_RATES 0x08010101 +#define OID_ATM_SUPPORTED_SERVICE_CATEGORY 0x08010102 +#define OID_ATM_SUPPORTED_AAL_TYPES 0x08010103 +#define OID_ATM_HW_CURRENT_ADDRESS 0x08010104 +#define OID_ATM_MAX_ACTIVE_VCS 0x08010105 +#define OID_ATM_MAX_ACTIVE_VCI_BITS 0x08010106 +#define OID_ATM_MAX_ACTIVE_VPI_BITS 0x08010107 +#define OID_ATM_MAX_AAL0_PACKET_SIZE 0x08010108 +#define OID_ATM_MAX_AAL1_PACKET_SIZE 0x08010109 +#define OID_ATM_MAX_AAL34_PACKET_SIZE 0x0801010A +#define OID_ATM_MAX_AAL5_PACKET_SIZE 0x0801010B +#define OID_ATM_SIGNALING_VPIVCI 0x08010201 +#define OID_ATM_ASSIGNED_VPI 0x08010202 +#define OID_ATM_ACQUIRE_ACCESS_NET_RESOURCES 0x08010203 +#define OID_ATM_RELEASE_ACCESS_NET_RESOURCES 0x08010204 +#define OID_ATM_ILMI_VPIVCI 0x08010205 +#define OID_ATM_DIGITAL_BROADCAST_VPIVCI 0x08010206 +#define OID_ATM_GET_NEAREST_FLOW 0x08010207 +#define OID_ATM_ALIGNMENT_REQUIRED 0x08010208 +// +// ATM specific statistics OIDs. +// +#define OID_ATM_RCV_CELLS_OK 0x08020101 +#define OID_ATM_XMIT_CELLS_OK 0x08020102 +#define OID_ATM_RCV_CELLS_DROPPED 0x08020103 +#define OID_ATM_RCV_INVALID_VPI_VCI 0x08020201 +#define OID_ATM_CELLS_HEC_ERROR 0x08020202 +#define OID_ATM_RCV_REASSEMBLY_ERROR 0x08020203 +// +// PCCA (Wireless) object +// +// +// All WirelessWAN devices must support the following OIDs +// +#define OID_WW_GEN_NETWORK_TYPES_SUPPORTED 0x09010101 +#define OID_WW_GEN_NETWORK_TYPE_IN_USE 0x09010102 +#define OID_WW_GEN_HEADER_FORMATS_SUPPORTED 0x09010103 +#define OID_WW_GEN_HEADER_FORMAT_IN_USE 0x09010104 +#define OID_WW_GEN_INDICATION_REQUEST 0x09010105 +#define OID_WW_GEN_DEVICE_INFO 0x09010106 +#define OID_WW_GEN_OPERATION_MODE 0x09010107 +#define OID_WW_GEN_LOCK_STATUS 0x09010108 +#define OID_WW_GEN_DISABLE_TRANSMITTER 0x09010109 +#define OID_WW_GEN_NETWORK_ID 0x0901010A +#define OID_WW_GEN_PERMANENT_ADDRESS 0x0901010B +#define OID_WW_GEN_CURRENT_ADDRESS 0x0901010C +#define OID_WW_GEN_SUSPEND_DRIVER 0x0901010D +#define OID_WW_GEN_BASESTATION_ID 0x0901010E +#define OID_WW_GEN_CHANNEL_ID 0x0901010F +#define OID_WW_GEN_ENCRYPTION_SUPPORTED 0x09010110 +#define OID_WW_GEN_ENCRYPTION_IN_USE 0x09010111 +#define OID_WW_GEN_ENCRYPTION_STATE 0x09010112 +#define OID_WW_GEN_CHANNEL_QUALITY 0x09010113 +#define OID_WW_GEN_REGISTRATION_STATUS 0x09010114 +#define OID_WW_GEN_RADIO_LINK_SPEED 0x09010115 +#define OID_WW_GEN_LATENCY 0x09010116 +#define OID_WW_GEN_BATTERY_LEVEL 0x09010117 +#define OID_WW_GEN_EXTERNAL_POWER 0x09010118 +// +// Network Dependent OIDs - Mobitex: +// +#define OID_WW_MBX_SUBADDR 0x09050101 +// OID 0x09050102 is reserved and may not be used +#define OID_WW_MBX_FLEXLIST 0x09050103 +#define OID_WW_MBX_GROUPLIST 0x09050104 +#define OID_WW_MBX_TRAFFIC_AREA 0x09050105 +#define OID_WW_MBX_LIVE_DIE 0x09050106 +#define OID_WW_MBX_TEMP_DEFAULTLIST 0x09050107 +// +// Network Dependent OIDs - Pinpoint: +// +#define OID_WW_PIN_LOC_AUTHORIZE 0x09090101 +#define OID_WW_PIN_LAST_LOCATION 0x09090102 +#define OID_WW_PIN_LOC_FIX 0x09090103 +// +// Network Dependent - CDPD: +// +#define OID_WW_CDPD_SPNI 0x090D0101 +#define OID_WW_CDPD_WASI 0x090D0102 +#define OID_WW_CDPD_AREA_COLOR 0x090D0103 +#define OID_WW_CDPD_TX_POWER_LEVEL 0x090D0104 +#define OID_WW_CDPD_EID 0x090D0105 +#define OID_WW_CDPD_HEADER_COMPRESSION 0x090D0106 +#define OID_WW_CDPD_DATA_COMPRESSION 0x090D0107 +#define OID_WW_CDPD_CHANNEL_SELECT 0x090D0108 +#define OID_WW_CDPD_CHANNEL_STATE 0x090D0109 +#define OID_WW_CDPD_NEI 0x090D010A +#define OID_WW_CDPD_NEI_STATE 0x090D010B +#define OID_WW_CDPD_SERVICE_PROVIDER_IDENTIFIER 0x090D010C +#define OID_WW_CDPD_SLEEP_MODE 0x090D010D +#define OID_WW_CDPD_CIRCUIT_SWITCHED 0x090D010E +#define OID_WW_CDPD_TEI 0x090D010F +#define OID_WW_CDPD_RSSI 0x090D0110 +// +// Network Dependent - Ardis: +// +#define OID_WW_ARD_SNDCP 0x09110101 +#define OID_WW_ARD_TMLY_MSG 0x09110102 +#define OID_WW_ARD_DATAGRAM 0x09110103 +// +// Network Dependent - DataTac: +// +#define OID_WW_TAC_COMPRESSION 0x09150101 +#define OID_WW_TAC_SET_CONFIG 0x09150102 +#define OID_WW_TAC_GET_STATUS 0x09150103 +#define OID_WW_TAC_USER_HEADER 0x09150104 +// +// Network Dependent - Metricom: +// +#define OID_WW_MET_FUNCTION 0x09190101 +// +// IRDA objects +// +#define OID_IRDA_RECEIVING 0x0A010100 +#define OID_IRDA_TURNAROUND_TIME 0x0A010101 +#define OID_IRDA_SUPPORTED_SPEEDS 0x0A010102 +#define OID_IRDA_LINK_SPEED 0x0A010103 +#define OID_IRDA_MEDIA_BUSY 0x0A010104 +#define OID_IRDA_EXTRA_RCV_BOFS 0x0A010200 +#define OID_IRDA_RATE_SNIFF 0x0A010201 +#define OID_IRDA_UNICAST_LIST 0x0A010202 +#define OID_IRDA_MAX_UNICAST_LIST_SIZE 0x0A010203 +#define OID_IRDA_MAX_RECEIVE_WINDOW_SIZE 0x0A010204 +#define OID_IRDA_MAX_SEND_WINDOW_SIZE 0x0A010205 +// +// Medium the Ndis Driver is running on (OID_GEN_MEDIA_SUPPORTED/ +// OID_GEN_MEDIA_IN_USE). +// +typedef enum _NDIS_MEDIUM { + NdisMedium802_3, + NdisMedium802_5, + NdisMediumFddi, + NdisMediumWan, + NdisMediumLocalTalk, + NdisMediumDix, // defined for convenience, not a real medium + NdisMediumArcnetRaw, + NdisMediumArcnet878_2, + NdisMediumAtm, + NdisMediumWirelessWan, + NdisMediumIrda, + NdisMediumMax // Not a real medium, defined as an upper-bound +} NDIS_MEDIUM, *PNDIS_MEDIUM; + +// +// Hardware status codes (OID_GEN_HARDWARE_STATUS). +// +typedef enum _NDIS_HARDWARE_STATUS { + NdisHardwareStatusReady, + NdisHardwareStatusInitializing, + NdisHardwareStatusReset, + NdisHardwareStatusClosing, + NdisHardwareStatusNotReady +} NDIS_HARDWARE_STATUS, *PNDIS_HARDWARE_STATUS; + +// +// this is the type passed in the OID_GEN_GET_TIME_CAPS request +// +typedef struct _GEN_GET_TIME_CAPS { + ULONG Flags; // Bits defined below + + ULONG ClockPrecision; +} GEN_GET_TIME_CAPS, *PGEN_GET_TIME_CAPS; + +#define READABLE_LOCAL_CLOCK 0x000000001 +#define CLOCK_NETWORK_DERIVED 0x000000002 +#define CLOCK_PRECISION 0x000000004 +#define RECEIVE_TIME_INDICATION_CAPABLE 0x000000008 +#define TIMED_SEND_CAPABLE 0x000000010 +#define TIME_STAMP_CAPABLE 0x000000020 +// +// +// this is the type passed in the OID_GEN_GET_NETCARD_TIME request +// +typedef struct _GEN_GET_NETCARD_TIME { + ULONG ReadTime; +} GEN_GET_NETCARD_TIME, *PGEN_GET_NETCARD_TIME; + +// +// Defines the attachment types for FDDI (OID_FDDI_ATTACHMENT_TYPE). +// +typedef enum _NDIS_FDDI_ATTACHMENT_TYPE { + NdisFddiTypeIsolated = 1, + NdisFddiTypeLocalA, + NdisFddiTypeLocalB, + NdisFddiTypeLocalAB, + NdisFddiTypeLocalS, + NdisFddiTypeWrapA, + NdisFddiTypeWrapB, + NdisFddiTypeWrapAB, + NdisFddiTypeWrapS, + NdisFddiTypeCWrapA, + NdisFddiTypeCWrapB, + NdisFddiTypeCWrapS, + NdisFddiTypeThrough +} NDIS_FDDI_ATTACHMENT_TYPE, *PNDIS_FDDI_ATTACHMENT_TYPE; + +// +// Defines the ring management states for FDDI (OID_FDDI_RING_MGT_STATE). +// +typedef enum _NDIS_FDDI_RING_MGT_STATE { + NdisFddiRingIsolated = 1, + NdisFddiRingNonOperational, + NdisFddiRingOperational, + NdisFddiRingDetect, + NdisFddiRingNonOperationalDup, + NdisFddiRingOperationalDup, + NdisFddiRingDirected, + NdisFddiRingTrace +} NDIS_FDDI_RING_MGT_STATE, *PNDIS_FDDI_RING_MGT_STATE; + +// +// Defines the Lconnection state for FDDI (OID_FDDI_LCONNECTION_STATE). +// +typedef enum _NDIS_FDDI_LCONNECTION_STATE { + NdisFddiStateOff = 1, + NdisFddiStateBreak, + NdisFddiStateTrace, + NdisFddiStateConnect, + NdisFddiStateNext, + NdisFddiStateSignal, + NdisFddiStateJoin, + NdisFddiStateVerify, + NdisFddiStateActive, + NdisFddiStateMaintenance +} NDIS_FDDI_LCONNECTION_STATE, *PNDIS_FDDI_LCONNECTION_STATE; + +// +// Defines the medium subtypes for WAN medium (OID_WAN_MEDIUM_SUBTYPE). +// +typedef enum _NDIS_WAN_MEDIUM_SUBTYPE { + NdisWanMediumHub, + NdisWanMediumX_25, + NdisWanMediumIsdn, + NdisWanMediumSerial, + NdisWanMediumFrameRelay, + NdisWanMediumAtm, + NdisWanMediumSonet, + NdisWanMediumSW56K +} NDIS_WAN_MEDIUM_SUBTYPE, *PNDIS_WAN_MEDIUM_SUBTYPE; + +// +// Defines the header format for WAN medium (OID_WAN_HEADER_FORMAT). +// +typedef enum _NDIS_WAN_HEADER_FORMAT { + NdisWanHeaderNative, // src/dest based on subtype, followed by NLPID + NdisWanHeaderEthernet // emulation of ethernet header +} NDIS_WAN_HEADER_FORMAT, *PNDIS_WAN_HEADER_FORMAT; + +// +// Defines the line quality on a WAN line (OID_WAN_QUALITY_OF_SERVICE). +// +typedef enum _NDIS_WAN_QUALITY { + NdisWanRaw, + NdisWanErrorControl, + NdisWanReliable +} NDIS_WAN_QUALITY, *PNDIS_WAN_QUALITY; + +// +// Defines the state of a token-ring adapter (OID_802_5_CURRENT_RING_STATE). +// +typedef enum _NDIS_802_5_RING_STATE { + NdisRingStateOpened = 1, + NdisRingStateClosed, + NdisRingStateOpening, + NdisRingStateClosing, + NdisRingStateOpenFailure, + NdisRingStateRingFailure +} NDIS_802_5_RING_STATE, *PNDIS_802_5_RING_STATE; + +// +// Defines the state of the LAN media +// +typedef enum _NDIS_MEDIA_STATE { + NdisMediaStateConnected, + NdisMediaStateDisconnected +} NDIS_MEDIA_STATE, *PNDIS_MEDIA_STATE; + +// +// The following is set on a per-packet basis as OOB data with NdisClass802_3Priority +// +typedef ULONG Priority_802_3; // 0-7 priority levels +// +// The following structure is used to query OID_GEN_CO_LINK_SPEED and +// OID_GEN_CO_MINIMUM_LINK_SPEED. The first OID will return the current +// link speed of the adapter. The second will return the minimum link speed +// the adapter is capable of. +// + +typedef struct _NDIS_CO_LINK_SPEED { + ULONG Outbound; + ULONG Inbound; +} NDIS_CO_LINK_SPEED, + +*PNDIS_CO_LINK_SPEED; +// +// Ndis Packet Filter Bits (OID_GEN_CURRENT_PACKET_FILTER). +// +#define NDIS_PACKET_TYPE_DIRECTED 0x0001 +#define NDIS_PACKET_TYPE_MULTICAST 0x0002 +#define NDIS_PACKET_TYPE_ALL_MULTICAST 0x0004 +#define NDIS_PACKET_TYPE_BROADCAST 0x0008 +#define NDIS_PACKET_TYPE_SOURCE_ROUTING 0x0010 +#define NDIS_PACKET_TYPE_PROMISCUOUS 0x0020 +#define NDIS_PACKET_TYPE_SMT 0x0040 +#define NDIS_PACKET_TYPE_ALL_LOCAL 0x0080 +#define NDIS_PACKET_TYPE_MAC_FRAME 0x8000 +#define NDIS_PACKET_TYPE_FUNCTIONAL 0x4000 +#define NDIS_PACKET_TYPE_ALL_FUNCTIONAL 0x2000 +#define NDIS_PACKET_TYPE_GROUP 0x1000 +// +// Ndis Token-Ring Ring Status Codes (OID_802_5_CURRENT_RING_STATUS). +// +#define NDIS_RING_SIGNAL_LOSS 0x00008000 +#define NDIS_RING_HARD_ERROR 0x00004000 +#define NDIS_RING_SOFT_ERROR 0x00002000 +#define NDIS_RING_TRANSMIT_BEACON 0x00001000 +#define NDIS_RING_LOBE_WIRE_FAULT 0x00000800 +#define NDIS_RING_AUTO_REMOVAL_ERROR 0x00000400 +#define NDIS_RING_REMOVE_RECEIVED 0x00000200 +#define NDIS_RING_COUNTER_OVERFLOW 0x00000100 +#define NDIS_RING_SINGLE_STATION 0x00000080 +#define NDIS_RING_RING_RECOVERY 0x00000040 +// +// Ndis protocol option bits (OID_GEN_PROTOCOL_OPTIONS). +// +#define NDIS_PROT_OPTION_ESTIMATED_LENGTH 0x00000001 +#define NDIS_PROT_OPTION_NO_LOOPBACK 0x00000002 +#define NDIS_PROT_OPTION_NO_RSVD_ON_RCVPKT 0x00000004 +// +// Ndis MAC option bits (OID_GEN_MAC_OPTIONS). +// +#define NDIS_MAC_OPTION_COPY_LOOKAHEAD_DATA 0x00000001 +#define NDIS_MAC_OPTION_RECEIVE_SERIALIZED 0x00000002 +#define NDIS_MAC_OPTION_TRANSFERS_NOT_PEND 0x00000004 +#define NDIS_MAC_OPTION_NO_LOOPBACK 0x00000008 +#define NDIS_MAC_OPTION_FULL_DUPLEX 0x00000010 +#define NDIS_MAC_OPTION_EOTX_INDICATION 0x00000020 +#define NDIS_MAC_OPTION_RESERVED 0x80000000 +// +// NDIS MAC option bits for OID_GEN_CO_MAC_OPTIONS. +// +#define NDIS_CO_MAC_OPTION_DYNAMIC_LINK_SPEED 0x00000001 +#ifdef IRDA +// +// The following is set on a per-packet basis as OOB data with NdisClassIrdaPacketInfo +// This is the per-packet info specified on a per-packet basis +// +typedef struct _NDIS_IRDA_PACKET_INFO { + UINT ExtraBOFs; + UINT MinTurnAroundTime; +} NDIS_IRDA_PACKET_INFO, *PNDIS_IRDA_PACKET_INFO; + +#endif +#ifdef WIRELESS_WAN +// +// Wireless WAN structure definitions +// +// +// currently defined Wireless network subtypes +// +typedef enum _NDIS_WW_NETWORK_TYPE { + NdisWWGeneric, + NdisWWMobitex, + NdisWWPinpoint, + NdisWWCDPD, + NdisWWArdis, + NdisWWDataTAC, + NdisWWMetricom, + NdisWWGSM, + NdisWWCDMA, + NdisWWTDMA, + NdisWWAMPS, + NdisWWInmarsat, + NdisWWpACT +} NDIS_WW_NETWORK_TYPE; + +// +// currently defined header formats +// +typedef enum _NDIS_WW_HEADER_FORMAT { + NdisWWDIXEthernetFrames, + NdisWWMPAKFrames, + NdisWWRDLAPFrames, + NdisWWMDC4800Frames +} NDIS_WW_HEADER_FORMAT; + +// +// currently defined encryption types +// +typedef enum _NDIS_WW_ENCRYPTION_TYPE { + NdisWWUnknownEncryption = -1, + NdisWWNoEncryption, + NdisWWDefaultEncryption +} NDIS_WW_ENCRYPTION_TYPE, *PNDIS_WW_ENCRYPTION_TYPE; + +// +// OID_WW_GEN_INDICATION_REQUEST +// +typedef struct _NDIS_WW_INDICATION_REQUEST { + NDIS_OID Oid; // IN + + UINT uIndicationFlag; // IN + + UINT uApplicationToken; // IN OUT + + HANDLE hIndicationHandle; // IN OUT + + INT iPollingInterval; // IN OUT + + NDIS_VAR_DATA_DESC InitialValue; // IN OUT + + NDIS_VAR_DATA_DESC OIDIndicationValue; // OUT - only valid after indication + + NDIS_VAR_DATA_DESC TriggerValue; // IN + +} NDIS_WW_INDICATION_REQUEST, *PNDIS_WW_INDICATION_REQUEST; + +#define OID_INDICATION_REQUEST_ENABLE 0x0000 +#define OID_INDICATION_REQUEST_CANCEL 0x0001 +// +// OID_WW_GEN_DEVICE_INFO +// +typedef struct _WW_DEVICE_INFO { + NDIS_VAR_DATA_DESC Manufacturer; + NDIS_VAR_DATA_DESC ModelNum; + NDIS_VAR_DATA_DESC SWVersionNum; + NDIS_VAR_DATA_DESC SerialNum; +} WW_DEVICE_INFO, *PWW_DEVICE_INFO; + +// +// OID_WW_GEN_OPERATION_MODE +// +typedef INT WW_OPERATION_MODE; // 0 = Normal mode + // 1 = Power saving mode + // -1 = mode unknown +// +// OID_WW_GEN_LOCK_STATUS +// + +typedef INT WW_LOCK_STATUS; // 0 = unlocked + // 1 = locked + // -1 = unknown lock status +// +// OID_WW_GEN_DISABLE_TRANSMITTER +// + +typedef INT WW_DISABLE_TRANSMITTER; // 0 = transmitter enabled + // 1 = transmitter disabled + // -1 = unknown value +// +// OID_WW_GEN_NETWORK_ID +// + +typedef NDIS_VAR_DATA_DESC WW_NETWORK_ID; +// +// OID_WW_GEN_PERMANENT_ADDRESS +// +typedef NDIS_VAR_DATA_DESC WW_PERMANENT_ADDRESS; +// +// OID_WW_GEN_CURRENT_ADDRESS +// +typedef struct _WW_CURRENT_ADDRESS { + NDIS_WW_HEADER_FORMAT Format; + NDIS_VAR_DATA_DESC Address; +} WW_CURRENT_ADDRESS, *PWW_CURRENT_ADDRESS; + +// +// OID_WW_GEN_SUSPEND_DRIVER +// +typedef BOOLEAN WW_SUSPEND_DRIVER; // 0 = driver operational + // 1 = driver suspended +// +// OID_WW_GEN_BASESTATION_ID +// + +typedef NDIS_VAR_DATA_DESC WW_BASESTATION_ID; +// +// OID_WW_GEN_CHANNEL_ID +// +typedef NDIS_VAR_DATA_DESC WW_CHANNEL_ID; +// +// OID_WW_GEN_ENCRYPTION_STATE +// +typedef BOOLEAN WW_ENCRYPTION_STATE; // 0 = if encryption is disabled + // 1 = if encryption is enabled +// +// OID_WW_GEN_CHANNEL_QUALITY +// + +typedef INT WW_CHANNEL_QUALITY; // 0 = Not in network contact, + // 1-100 = Quality of Channel (100 is highest quality). + // -1 = channel quality is unknown +// +// OID_WW_GEN_REGISTRATION_STATUS +// + +typedef INT WW_REGISTRATION_STATUS; // 0 = Registration denied + // 1 = Registration pending + // 2 = Registered + // -1 = unknown registration status +// +// OID_WW_GEN_RADIO_LINK_SPEED +// + +typedef UINT WW_RADIO_LINK_SPEED; // Bits per second. +// +// OID_WW_GEN_LATENCY +// + +typedef UINT WW_LATENCY; // milliseconds +// +// OID_WW_GEN_BATTERY_LEVEL +// + +typedef INT WW_BATTERY_LEVEL; // 0-100 = battery level in percentage + // (100=fully charged) + // -1 = unknown battery level. +// +// OID_WW_GEN_EXTERNAL_POWER +// + +typedef INT WW_EXTERNAL_POWER; // 0 = no external power connected + // 1 = external power connected + // -1 = unknown +// +// OID_WW_MET_FUNCTION +// + +typedef NDIS_VAR_DATA_DESC WW_MET_FUNCTION; +// +// OID_WW_TAC_COMPRESSION +// +typedef BOOLEAN WW_TAC_COMPRESSION; // Determines whether or not network level compression + // is being used. +// +// OID_WW_TAC_SET_CONFIG +// + +typedef struct _WW_TAC_SETCONFIG { + NDIS_VAR_DATA_DESC RCV_MODE; + NDIS_VAR_DATA_DESC TX_CONTROL; + NDIS_VAR_DATA_DESC RX_CONTROL; + NDIS_VAR_DATA_DESC FLOW_CONTROL; + NDIS_VAR_DATA_DESC RESET_CNF; + NDIS_VAR_DATA_DESC READ_CNF; +} WW_TAC_SETCONFIG, *PWW_TAC_SETCONFIG; + +// +// OID_WW_TAC_GET_STATUS +// +typedef struct _WW_TAC_GETSTATUS { + BOOLEAN Action; // Set = Execute command. + + NDIS_VAR_DATA_DESC Command; + NDIS_VAR_DATA_DESC Option; + NDIS_VAR_DATA_DESC Response; // The response to the requested command + // - max. length of string is 256 octets. + +} WW_TAC_GETSTATUS, *PWW_TAC_GETSTATUS; + +// +// OID_WW_TAC_USER_HEADER +// +typedef NDIS_VAR_DATA_DESC WW_TAC_USERHEADER; // This will hold the user header - Max. 64 octets. +// +// OID_WW_ARD_SNDCP +// + +typedef struct _WW_ARD_SNDCP { + NDIS_VAR_DATA_DESC Version; // The version of SNDCP protocol supported. + + INT BlockSize; // The block size used for SNDCP + + INT Window; // The window size used in SNDCP + +} WW_ARD_SNDCP, *PWW_ARD_SNDCP; + +// +// OID_WW_ARD_TMLY_MSG +// +typedef BOOLEAN WW_ARD_CHANNEL_STATUS; // The current status of the inbound RF Channel. +// +// OID_WW_ARD_DATAGRAM +// + +typedef struct _WW_ARD_DATAGRAM { + BOOLEAN LoadLevel; // Byte that contains the load level info. + + INT SessionTime; // Datagram session time remaining. + + NDIS_VAR_DATA_DESC HostAddr; // Host address. + + NDIS_VAR_DATA_DESC THostAddr; // Test host address. + +} WW_ARD_DATAGRAM, *PWW_ARD_DATAGRAM; + +// +// OID_WW_CDPD_SPNI +// +typedef struct _WW_CDPD_SPNI { + UINT SPNI[10]; //10 16-bit service provider network IDs + + INT OperatingMode; // 0 = ignore SPNI, + // 1 = require SPNI from list, + // 2 = prefer SPNI from list. + // 3 = exclude SPNI from list. + +} WW_CDPD_SPNI, *PWW_CDPD_SPNI; + +// +// OID_WW_CDPD_WASI +// +typedef struct _WW_CDPD_WIDE_AREA_SERVICE_ID { + UINT WASI[10]; //10 16-bit wide area service IDs + + INT OperatingMode; // 0 = ignore WASI, + // 1 = Require WASI from list, + // 2 = prefer WASI from list + // 3 = exclude WASI from list. + +} WW_CDPD_WIDE_AREA_SERVICE_ID, *PWW_CDPD_WIDE_AREA_SERVICE_ID; + +// +// OID_WW_CDPD_AREA_COLOR +// +typedef INT WW_CDPD_AREA_COLOR; +// +// OID_WW_CDPD_TX_POWER_LEVEL +// +typedef UINT WW_CDPD_TX_POWER_LEVEL; +// +// OID_WW_CDPD_EID +// +typedef NDIS_VAR_DATA_DESC WW_CDPD_EID; +// +// OID_WW_CDPD_HEADER_COMPRESSION +// +typedef INT WW_CDPD_HEADER_COMPRESSION; // 0 = no header compression, + // 1 = always compress headers, + // 2 = compress headers if MD-IS does + // -1 = unknown +// +// OID_WW_CDPD_DATA_COMPRESSION +// + +typedef INT WW_CDPD_DATA_COMPRESSION; // 0 = no data compression, + // 1 = data compression enabled + // -1 = unknown +// +// OID_WW_CDPD_CHANNEL_SELECT +// + +typedef struct _WW_CDPD_CHANNEL_SELECT { + UINT ChannelID; // channel number + + UINT fixedDuration; // duration in seconds + +} WW_CDPD_CHANNEL_SELECT, *PWW_CDPD_CHANNEL_SELECT; + +// +// OID_WW_CDPD_CHANNEL_STATE +// +typedef enum _WW_CDPD_CHANNEL_STATE { + CDPDChannelNotAvail, + CDPDChannelScanning, + CDPDChannelInitAcquired, + CDPDChannelAcquired, + CDPDChannelSleeping, + CDPDChannelWaking, + CDPDChannelCSDialing, + CDPDChannelCSRedial, + CDPDChannelCSAnswering, + CDPDChannelCSConnected, + CDPDChannelCSSuspended +} WW_CDPD_CHANNEL_STATE, *PWW_CDPD_CHANNEL_STATE; + +// +// OID_WW_CDPD_NEI +// +typedef enum _WW_CDPD_NEI_FORMAT { + CDPDNeiIPv4, + CDPDNeiCLNP, + CDPDNeiIPv6 +} WW_CDPD_NEI_FORMAT, *PWW_CDPD_NEI_FORMAT; +typedef enum _WW_CDPD_NEI_TYPE { + CDPDNeiIndividual, + CDPDNeiMulticast, + CDPDNeiBroadcast +} WW_CDPD_NEI_TYPE; +typedef struct _WW_CDPD_NEI { + UINT uNeiIndex; + WW_CDPD_NEI_FORMAT NeiFormat; + WW_CDPD_NEI_TYPE NeiType; + WORD NeiGmid; // group member identifier, only + // meaningful if NeiType == + // CDPDNeiMulticast + + NDIS_VAR_DATA_DESC NeiAddress; +} WW_CDPD_NEI; + +// +// OID_WW_CDPD_NEI_STATE +// +typedef enum _WW_CDPD_NEI_STATE { + CDPDUnknown, + CDPDRegistered, + CDPDDeregistered +} WW_CDPD_NEI_STATE, *PWW_CDPD_NEI_STATE; +typedef enum _WW_CDPD_NEI_SUB_STATE { + CDPDPending, // Registration pending + CDPDNoReason, // Registration denied - no reason given + CDPDMDISNotCapable, // Registration denied - MD-IS not capable of + // handling M-ES at this time + CDPDNEINotAuthorized, // Registration denied - NEI is not authorized to + // use this subnetwork + CDPDInsufficientAuth, // Registration denied - M-ES gave insufficient + // authentication credentials + CDPDUnsupportedAuth, // Registration denied - M-ES gave unsupported + // authentication credentials + CDPDUsageExceeded, // Registration denied - NEI has exceeded usage + // limitations + CDPDDeniedThisNetwork // Registration denied on this network, service + // may be obtained on alternate Service Provider + // network +} WW_CDPD_NEI_SUB_STATE; +typedef struct _WW_CDPD_NEI_REG_STATE { + UINT uNeiIndex; + WW_CDPD_NEI_STATE NeiState; + WW_CDPD_NEI_SUB_STATE NeiSubState; +} WW_CDPD_NEI_REG_STATE, *PWW_CDPD_NEI_REG_STATE; + +// +// OID_WW_CDPD_SERVICE_PROVIDER_IDENTIFIER +// +typedef struct _WW_CDPD_SERVICE_PROVIDER_ID { + UINT SPI[10]; //10 16-bit service provider IDs + + INT OperatingMode; // 0 = ignore SPI, + // 1 = require SPI from list, + // 2 = prefer SPI from list. + // 3 = exclude SPI from list. + +} WW_CDPD_SERVICE_PROVIDER_ID, *PWW_CDPD_SERVICE_PROVIDER_ID; + +// +// OID_WW_CDPD_SLEEP_MODE +// +typedef INT WW_CDPD_SLEEP_MODE; +// +// OID_WW_CDPD_TEI +// +typedef ULONG WW_CDPD_TEI; +// +// OID_WW_CDPD_CIRCUIT_SWITCHED +// +typedef struct _WW_CDPD_CIRCUIT_SWITCHED { + INT service_preference; // -1 = unknown, + // 0 = always use packet switched CDPD, + // 1 = always use CS CDPD via AMPS, + // 2 = always use CS CDPD via PSTN, + // 3 = use circuit switched via AMPS only + // when packet switched is not available. + // 4 = use packet switched only when circuit + // switched via AMPS is not available. + // 5 = device manuf. defined service + // preference. + // 6 = device manuf. defined service + // preference. + + INT service_status; // -1 = unknown, + // 0 = packet switched CDPD, + // 1 = circuit switched CDPD via AMPS, + // 2 = circuit switched CDPD via PSTN. + + INT connect_rate; // CS connection bit rate (bits per second). + // 0 = no active connection, + // -1 = unknown + // Dial code last used to dial. + + NDIS_VAR_DATA_DESC dial_code[20]; + + UINT sid; // Current AMPS system ID + + INT a_b_side_selection; // -1 = unknown, + // 0 = no AMPS service + // 1 = AMPS "A" side channels selected + // 2 = AMPS "B" side channels selected + + INT AMPS_channel; // -1= unknown + // 0 = no AMPS service. + // 1-1023 = AMPS channel number in use + + UINT action; // 0 = no action + // 1 = suspend (hangup) + // 2 = dial + + // Default dial code for CS CDPD service + // encoded as specified in the CS CDPD + // implementor guidelines. + NDIS_VAR_DATA_DESC default_dial[20]; + + // Number for the CS CDPD network to call + // back the mobile, encoded as specified in + // the CS CDPD implementor guidelines. + NDIS_VAR_DATA_DESC call_back[20]; + + UINT sid_list[10]; // List of 10 16-bit preferred AMPS + // system IDs for CS CDPD. + + UINT inactivity_timer; // Wait time after last data before dropping + // call. + // 0-65535 = inactivity time limit (seconds). + + UINT receive_timer; // secs. per CS-CDPD Implementor Guidelines. + + UINT conn_resp_timer; // secs. per CS-CDPD Implementor Guidelines. + + UINT reconn_resp_timer; // secs. per CS-CDPD Implementor Guidelines. + + UINT disconn_timer; // secs. per CS-CDPD Implementor Guidelines. + + UINT NEI_reg_timer; // secs. per CS-CDPD Implementor Guidelines. + + UINT reconn_retry_timer; // secs. per CS-CDPD Implementor Guidelines. + + UINT link_reset_timer; // secs. per CS-CDPD Implementor Guidelines. + + UINT link_reset_ack_timer; // secs. per CS-CDPD Implementor Guidelines. + + UINT n401_retry_limit; // per CS-CDPD Implementor Guidelines. + + UINT n402_retry_limit; // per CS-CDPD Implementor Guidelines. + + UINT n404_retry_limit; // per CS-CDPD Implementor Guidelines. + + UINT n405_retry_limit; // per CS-CDPD Implementor Guidelines. + +} WW_CDPD_CIRCUIT_SWITCHED, *WW_PCDPD_CIRCUIT_SWITCHED; +typedef UINT WW_CDPD_RSSI; +// +// OID_WW_PIN_LOC_AUTHORIZE +// +typedef INT WW_PIN_AUTHORIZED; // 0 = unauthorized + // 1 = authorized + // -1 = unknown +// +// OID_WW_PIN_LAST_LOCATION +// OID_WW_PIN_LOC_FIX +// + +typedef struct _WW_PIN_LOCATION { + INT Latitude; // Latitude in hundredths of a second + + INT Longitude; // Longitude in hundredths of a second + + INT Altitude; // Altitude in feet + + INT FixTime; // Time of the location fix, since midnight, local time (of the + // current day), in tenths of a second + + INT NetTime; // Current local network time of the current day, since midnight, + // in tenths of a second + + INT LocQuality; // 0-100 = location quality + + INT LatReg; // Latitude registration offset, in hundredths of a second + + INT LongReg; // Longitude registration offset, in hundredths of a second + + INT GMTOffset; // Offset in minutes of the local time zone from GMT + +} WW_PIN_LOCATION, *PWW_PIN_LOCATION; + +// +// The following is set on a per-packet basis as OOB data with NdisClassWirelessWanMbxMailbox +// +typedef ULONG WW_MBX_MAILBOX_FLAG; // 1 = set mailbox flag, 0 = do not set mailbox flag +// +// OID_WW_MBX_SUBADDR +// + +typedef struct _WW_MBX_PMAN { + BOOLEAN ACTION; // 0 = Login PMAN, 1 = Logout PMAN + + UINT MAN; + UCHAR PASSWORD[8]; // Password should be null for Logout and indications. + // Maximum length of password is 8 chars. + +} WW_MBX_PMAN, *PWW_MBX_PMAN; + +// +// OID_WW_MBX_FLEXLIST +// +typedef struct _WW_MBX_FLEXLIST { + INT count; // Number of MAN entries used. + // -1=unknown. + + UINT MAN[7]; // List of MANs. + +} WW_MBX_FLEXLIST; + +// +// OID_WW_MBX_GROUPLIST +// +typedef struct _WW_MBX_GROUPLIST { + INT count; // Number of MAN entries used. + // -1=unknown. + + UINT MAN[15]; // List of MANs. + +} WW_MBX_GROUPLIST; + +// +// OID_WW_MBX_TRAFFIC_AREA +// +typedef enum _WW_MBX_TRAFFIC_AREA { + unknown_traffic_area, // The driver has no information about the current traffic area. + in_traffic_area, // Mobile unit has entered a subscribed traffic area. + in_auth_traffic_area, // Mobile unit is outside traffic area but is authorized. + unauth_traffic_area // Mobile unit is outside traffic area but is un-authorized. +} WW_MBX_TRAFFIC_AREA; + +// +// OID_WW_MBX_LIVE_DIE +// +typedef INT WW_MBX_LIVE_DIE; // 0 = DIE last received + // 1 = LIVE last received + // -1 = unknown +// +// OID_WW_MBX_TEMP_DEFAULTLIST +// + +typedef struct _WW_MBX_CHANNEL_PAIR { + UINT Mobile_Tx; + UINT Mobile_Rx; +} WW_MBX_CHANNEL_PAIR, *PWW_MBX_CHANNEL_PAIR; +typedef struct _WW_MBX_TEMPDEFAULTLIST { + UINT Length; + WW_MBX_CHANNEL_PAIR ChannelPair[1]; +} WW_MBX_TEMPDEFAULTLIST, *WW_PMBX_TEMPDEFAULTLIST; + +#endif // WIRELESS_WAN +#endif // _NTDDNDIS_ diff --git a/src/See/Ntddpack.h b/src/See/Ntddpack.h index 30945c1e..87eac60e 100644 --- a/src/See/Ntddpack.h +++ b/src/See/Ntddpack.h @@ -1,26 +1,26 @@ - -#ifndef __NTDDPACKET -#define __NTDDPACKET 1 -#include "devioctl.h" -/*#include */ -struct _PACKET_OID_DATA { - ULONG Oid; - ULONG Length; - UCHAR Data[1]; -}; - -typedef struct _PACKET_OID_DATA PACKET_OID_DATA, *PPACKET_OID_DATA; - -/*#include */ -#define FILE_DEVICE_PROTOCOL 0x8000 -#define IOCTL_PROTOCOL_QUERY_OID CTL_CODE(FILE_DEVICE_PROTOCOL, 0 , METHOD_BUFFERED, FILE_ANY_ACCESS) -#define IOCTL_PROTOCOL_SET_OID CTL_CODE(FILE_DEVICE_PROTOCOL, 1 , METHOD_BUFFERED, FILE_ANY_ACCESS) -#define IOCTL_PROTOCOL_STATISTICS CTL_CODE(FILE_DEVICE_PROTOCOL, 2 , METHOD_BUFFERED, FILE_ANY_ACCESS) -#define IOCTL_PROTOCOL_RESET CTL_CODE(FILE_DEVICE_PROTOCOL, 3 , METHOD_BUFFERED, FILE_ANY_ACCESS) -#define IOCTL_PROTOCOL_READ CTL_CODE(FILE_DEVICE_PROTOCOL, 4 , METHOD_BUFFERED, FILE_ANY_ACCESS) -#define IOCTL_PROTOCOL_WRITE CTL_CODE(FILE_DEVICE_PROTOCOL, 5 , METHOD_BUFFERED, FILE_ANY_ACCESS) -#define IOCTL_PROTOCOL_MACNAME CTL_CODE(FILE_DEVICE_PROTOCOL, 6 , METHOD_BUFFERED, FILE_ANY_ACCESS) -#define IOCTL_OPEN CTL_CODE(FILE_DEVICE_PROTOCOL, 7 , METHOD_BUFFERED, FILE_ANY_ACCESS) -#define IOCTL_CLOSE CTL_CODE(FILE_DEVICE_PROTOCOL, 8 , METHOD_BUFFERED, FILE_ANY_ACCESS) - -#endif + +#ifndef __NTDDPACKET +#define __NTDDPACKET 1 +#include "devioctl.h" +/*#include */ +struct _PACKET_OID_DATA { + ULONG Oid; + ULONG Length; + UCHAR Data[1]; +}; + +typedef struct _PACKET_OID_DATA PACKET_OID_DATA, *PPACKET_OID_DATA; + +/*#include */ +#define FILE_DEVICE_PROTOCOL 0x8000 +#define IOCTL_PROTOCOL_QUERY_OID CTL_CODE(FILE_DEVICE_PROTOCOL, 0 , METHOD_BUFFERED, FILE_ANY_ACCESS) +#define IOCTL_PROTOCOL_SET_OID CTL_CODE(FILE_DEVICE_PROTOCOL, 1 , METHOD_BUFFERED, FILE_ANY_ACCESS) +#define IOCTL_PROTOCOL_STATISTICS CTL_CODE(FILE_DEVICE_PROTOCOL, 2 , METHOD_BUFFERED, FILE_ANY_ACCESS) +#define IOCTL_PROTOCOL_RESET CTL_CODE(FILE_DEVICE_PROTOCOL, 3 , METHOD_BUFFERED, FILE_ANY_ACCESS) +#define IOCTL_PROTOCOL_READ CTL_CODE(FILE_DEVICE_PROTOCOL, 4 , METHOD_BUFFERED, FILE_ANY_ACCESS) +#define IOCTL_PROTOCOL_WRITE CTL_CODE(FILE_DEVICE_PROTOCOL, 5 , METHOD_BUFFERED, FILE_ANY_ACCESS) +#define IOCTL_PROTOCOL_MACNAME CTL_CODE(FILE_DEVICE_PROTOCOL, 6 , METHOD_BUFFERED, FILE_ANY_ACCESS) +#define IOCTL_OPEN CTL_CODE(FILE_DEVICE_PROTOCOL, 7 , METHOD_BUFFERED, FILE_ANY_ACCESS) +#define IOCTL_CLOSE CTL_CODE(FILE_DEVICE_PROTOCOL, 8 , METHOD_BUFFERED, FILE_ANY_ACCESS) + +#endif diff --git a/src/See/Openclos.c b/src/See/Openclos.c index 8a5a9330..32d5e6b9 100644 --- a/src/See/Openclos.c +++ b/src/See/Openclos.c @@ -1,707 +1,707 @@ -/* - * Copyright (c) 1999 - 2005 NetGroup, Politecnico di Torino (Italy) - * Copyright (c) 2005 CACE Technologies, Davis (California) - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the Politecnico di Torino, CACE Technologies - * nor the names of its contributors may be used to endorse or promote - * products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - */ - -#include - -#include "ntddk.h" -#include "ntiologc.h" -#include "ndis.h" - -#include "debug.h" -#include "packet.h" - -static NDIS_MEDIUM MediumArray[] = { - NdisMedium802_3, -// NdisMediumWan, - NdisMediumFddi, - NdisMediumArcnet878_2, - NdisMediumAtm, - NdisMedium802_5 -}; - -#define NUM_NDIS_MEDIA (sizeof MediumArray / sizeof MediumArray[0]) - -ULONG NamedEventsCounter=0; - -//Itoa. Replaces the buggy RtlIntegerToUnicodeString -void PacketItoa(UINT n,PUCHAR buf){ -int i; - - for(i=0;i<20;i+=2){ - buf[18-i]=(n%10)+48; - buf[19-i]=0; - n/=10; - } - -} - -/// Global start time. Used as an absolute reference for timestamp conversion. -struct time_conv G_Start_Time = { - 0, - {0, 0}, -}; - -UINT n_Opened_Instances = 0; - -NDIS_SPIN_LOCK Opened_Instances_Lock; - -//------------------------------------------------------------------- - -NTSTATUS NPF_Open(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp) -{ - - PDEVICE_EXTENSION DeviceExtension; - - POPEN_INSTANCE Open; - - PIO_STACK_LOCATION IrpSp; - - NDIS_STATUS Status; - NDIS_STATUS ErrorStatus; - UINT i; - PCHAR EvName; - - IF_LOUD(DbgPrint("NPF: OpenAdapter\n");) - - DeviceExtension = DeviceObject->DeviceExtension; - - IrpSp = IoGetCurrentIrpStackLocation(Irp); - - // allocate some memory for the open structure - Open=ExAllocatePoolWithTag(NonPagedPool, sizeof(OPEN_INSTANCE), '0OWA'); - - if (Open==NULL) { - // no memory - Irp->IoStatus.Status = STATUS_INSUFFICIENT_RESOURCES; - IoCompleteRequest(Irp, IO_NO_INCREMENT); - return STATUS_INSUFFICIENT_RESOURCES; - } - - RtlZeroMemory( - Open, - sizeof(OPEN_INSTANCE) - ); - - - EvName=ExAllocatePoolWithTag(NonPagedPool, sizeof(L"\\BaseNamedObjects\\SEE0000000000"), '1OWA'); - - if (EvName==NULL) { - // no memory - ExFreePool(Open); - Irp->IoStatus.Status = STATUS_INSUFFICIENT_RESOURCES; - IoCompleteRequest(Irp, IO_NO_INCREMENT); - return STATUS_INSUFFICIENT_RESOURCES; - } - - // Save or open here - IrpSp->FileObject->FsContext=Open; - - Open->DeviceExtension=DeviceExtension; - - - // Save the Irp here for the completion routine to retrieve - Open->OpenCloseIrp=Irp; - - // Allocate a packet pool for our xmit and receive packets - NdisAllocatePacketPool( - &Status, - &Open->PacketPool, - TRANSMIT_PACKETS, - sizeof(PACKET_RESERVED)); - - - if (Status != NDIS_STATUS_SUCCESS) { - - IF_LOUD(DbgPrint("NPF: Failed to allocate packet pool\n");) - - ExFreePool(Open); - ExFreePool(EvName); - Irp->IoStatus.Status = STATUS_INSUFFICIENT_RESOURCES; - IoCompleteRequest(Irp, IO_NO_INCREMENT); - return STATUS_INSUFFICIENT_RESOURCES; - } - - - RtlCopyBytes(EvName,L"\\BaseNamedObjects\\SEE0000000000",sizeof(L"\\BaseNamedObjects\\SEE0000000000")); - - //Create the string containing the name of the read event - RtlInitUnicodeString(&Open->ReadEventName,(PCWSTR) EvName); - - PacketItoa(NamedEventsCounter,(PUCHAR)(Open->ReadEventName.Buffer+21)); - - InterlockedIncrement(&NamedEventsCounter); - - IF_LOUD(DbgPrint("\nCreated the named event for the read; name=%ws, counter=%d\n", Open->ReadEventName.Buffer,NamedEventsCounter-1);) - - //allocate the event objects - Open->ReadEvent=IoCreateNotificationEvent(&Open->ReadEventName,&Open->ReadEventHandle); - if(Open->ReadEvent==NULL){ - ExFreePool(Open); - ExFreePool(EvName); - Irp->IoStatus.Status = STATUS_INSUFFICIENT_RESOURCES; - IoCompleteRequest(Irp, IO_NO_INCREMENT); - return STATUS_INSUFFICIENT_RESOURCES; - } - - KeInitializeEvent(Open->ReadEvent, NotificationEvent, FALSE); - KeClearEvent(Open->ReadEvent); - NdisInitializeEvent(&Open->WriteEvent); - NdisInitializeEvent(&Open->IOEvent); - NdisInitializeEvent(&Open->DumpEvent); - NdisAllocateSpinLock(&Open->MachineLock); - NdisAllocateSpinLock(&Open->WriteLock); - Open->WriteInProgress = FALSE; - - // list to hold irp's want to reset the adapter - InitializeListHead(&Open->ResetIrpList); - - - // Initialize the request list - KeInitializeSpinLock(&Open->RequestSpinLock); - InitializeListHead(&Open->RequestList); - - // Initializes the extended memory of the NPF machine - Open->mem_ex.buffer = ExAllocatePoolWithTag(NonPagedPool, DEFAULT_MEM_EX_SIZE, '2OWA'); - if((Open->mem_ex.buffer) == NULL) - { - // no memory - ExFreePool(Open); - ExFreePool(EvName); - Irp->IoStatus.Status = STATUS_INSUFFICIENT_RESOURCES; - IoCompleteRequest(Irp, IO_NO_INCREMENT); - return STATUS_INSUFFICIENT_RESOURCES; - } - - Open->mem_ex.size = DEFAULT_MEM_EX_SIZE; - RtlZeroMemory(Open->mem_ex.buffer, DEFAULT_MEM_EX_SIZE); - - // - // Initialize the open instance - // -// Open->BufSize = 0; -// Open->Buffer = NULL; -// Open->Bhead = 0; -// Open->Btail = 0; -// (INT)Open->BLastByte = -1; -// Open->Dropped = 0; //reset the dropped packets counter -// Open->Received = 0; //reset the received packets counter -// Open->Accepted = 0; //reset the accepted packets counter - Open->bpfprogram = NULL; //reset the filter - Open->mode = MODE_CAPT; - Open->Nbytes.QuadPart = 0; - Open->Npackets.QuadPart = 0; - Open->Nwrites = 1; - Open->Multiple_Write_Counter = 0; - Open->MinToCopy = 0; - Open->TimeOut.QuadPart = (LONGLONG)1; - Open->Bound = TRUE; - Open->DumpFileName.Buffer = NULL; - Open->DumpFileHandle = NULL; - Open->tme.active = TME_NONE_ACTIVE; - Open->DumpLimitReached = FALSE; - Open->MaxFrameSize = 0; - Open->WriterSN=0; - Open->ReaderSN=0; - Open->Size=0; - - - - //allocate the spinlock for the statistic counters - NdisAllocateSpinLock(&Open->CountersLock); - - //allocate the spinlock for the buffer pointers - // NdisAllocateSpinLock(&Open->BufLock); - - // - // link up the request stored in our open block - // - for (i=0;iRequestList, - &Open->Requests[i].ListElement, - &Open->RequestSpinLock); - - } - - - IoMarkIrpPending(Irp); - - // - // Try to open the MAC - // - IF_LOUD(DbgPrint("NPF: Opening the device %ws, BindingContext=%d\n",DeviceExtension->AdapterName.Buffer, Open);) - - NdisOpenAdapter( - &Status, - &ErrorStatus, - &Open->AdapterHandle, - &Open->Medium, - MediumArray, - NUM_NDIS_MEDIA, - DeviceExtension->NdisProtocolHandle, - Open, - &DeviceExtension->AdapterName, - 0, - NULL); - - IF_LOUD(DbgPrint("NPF: Opened the device, Status=%x\n",Status);) - - if (Status != NDIS_STATUS_PENDING) - { - NPF_OpenAdapterComplete(Open,Status,NDIS_STATUS_SUCCESS); - } - - return(STATUS_PENDING); -} - -//------------------------------------------------------------------- - -VOID NPF_OpenAdapterComplete( - IN NDIS_HANDLE ProtocolBindingContext, - IN NDIS_STATUS Status, - IN NDIS_STATUS OpenErrorStatus) -{ - - PIRP Irp; - POPEN_INSTANCE Open; - PLIST_ENTRY RequestListEntry; - PINTERNAL_REQUEST MaxSizeReq; - NDIS_STATUS ReqStatus; - - - IF_LOUD(DbgPrint("NPF: OpenAdapterComplete\n");) - - Open= (POPEN_INSTANCE)ProtocolBindingContext; - - // - // get the open irp - // - Irp=Open->OpenCloseIrp; - - if (Status != NDIS_STATUS_SUCCESS) { - - IF_LOUD(DbgPrint("NPF: OpenAdapterComplete-FAILURE\n");) - - NdisFreePacketPool(Open->PacketPool); - - //free mem_ex - Open->mem_ex.size = 0; - if(Open->mem_ex.buffer != NULL)ExFreePool(Open->mem_ex.buffer); - - ExFreePool(Open->ReadEventName.Buffer); - - ZwClose(Open->ReadEventHandle); - - - ExFreePool(Open); - } - else { - NdisAcquireSpinLock(&Opened_Instances_Lock); - n_Opened_Instances++; - NdisReleaseSpinLock(&Opened_Instances_Lock); - - IF_LOUD(DbgPrint("Opened Instances:%d", n_Opened_Instances);) - - // Get the absolute value of the system boot time. - // This is used for timestamp conversion. - TIME_SYNCHRONIZE(&G_Start_Time); - - // Extract a request from the list of free ones - RequestListEntry=ExInterlockedRemoveHeadList(&Open->RequestList, &Open->RequestSpinLock); - - if (RequestListEntry == NULL) - { - - Open->MaxFrameSize = 1600; // Assume Ethernet - - Irp->IoStatus.Status = Status; - Irp->IoStatus.Information = 0; - IoCompleteRequest(Irp, IO_NO_INCREMENT); - - return; - } - - MaxSizeReq = CONTAINING_RECORD(RequestListEntry, INTERNAL_REQUEST, ListElement); - MaxSizeReq->Irp = Irp; - MaxSizeReq->Internal = TRUE; - - - MaxSizeReq->Request.RequestType = NdisRequestQueryInformation; - MaxSizeReq->Request.DATA.QUERY_INFORMATION.Oid = OID_GEN_MAXIMUM_TOTAL_SIZE; - - - MaxSizeReq->Request.DATA.QUERY_INFORMATION.InformationBuffer = &Open->MaxFrameSize; - MaxSizeReq->Request.DATA.QUERY_INFORMATION.InformationBufferLength = 4; - - // submit the request - NdisRequest( - &ReqStatus, - Open->AdapterHandle, - &MaxSizeReq->Request); - - - if (ReqStatus != NDIS_STATUS_PENDING) { - NPF_RequestComplete(Open, &MaxSizeReq->Request, ReqStatus); - } - - return; - - } - - Irp->IoStatus.Status = Status; - Irp->IoStatus.Information = 0; - IoCompleteRequest(Irp, IO_NO_INCREMENT); - - return; - -} - -//------------------------------------------------------------------- - -NTSTATUS -NPF_Close(IN PDEVICE_OBJECT DeviceObject,IN PIRP Irp) -{ - - POPEN_INSTANCE Open; - NDIS_STATUS Status; - PIO_STACK_LOCATION IrpSp; - LARGE_INTEGER ThreadDelay; - - IF_LOUD(DbgPrint("NPF: CloseAdapter\n");) - - IrpSp = IoGetCurrentIrpStackLocation(Irp); - - Open=IrpSp->FileObject->FsContext; - - // Reset the buffer size. This tells the dump thread to stop. -// Open->BufSize = 0; - - if( Open->Bound == FALSE){ - - NdisWaitEvent(&Open->IOEvent,10000); - - // Free the filter if it's present - if(Open->bpfprogram != NULL) - ExFreePool(Open->bpfprogram); - -// -// Jitted filters are supported on x86 (32bit) only -// -#ifdef __NPF_x86__ - // Free the jitted filter if it's present - if(Open->Filter != NULL) - BPF_Destroy_JIT_Filter(Open->Filter); -#endif - - //free the buffer -// Open->BufSize=0; -// if(Open->Buffer != NULL)ExFreePool(Open->Buffer); - - if (Open->Size > 0) - ExFreePool(Open->CpuData[0].Buffer); - - //free mem_ex - Open->mem_ex.size = 0; - if(Open->mem_ex.buffer != NULL)ExFreePool(Open->mem_ex.buffer); - - NdisFreePacketPool(Open->PacketPool); - - // Free the string with the name of the dump file - if(Open->DumpFileName.Buffer!=NULL) - ExFreePool(Open->DumpFileName.Buffer); - - ExFreePool(Open->ReadEventName.Buffer); - ExFreePool(Open); - - Irp->IoStatus.Information = 0; - Irp->IoStatus.Status = STATUS_SUCCESS; - IoCompleteRequest(Irp, IO_NO_INCREMENT); - - return(STATUS_SUCCESS); - } - - // Unfreeze the consumer - if(Open->mode & MODE_DUMP) - NdisSetEvent(&Open->DumpEvent); - else - KeSetEvent(Open->ReadEvent,0,FALSE); - - // Save the IRP - Open->OpenCloseIrp = Irp; - - IoMarkIrpPending(Irp); - - // If this instance is in dump mode, complete the dump and close the file - if((Open->mode & MODE_DUMP) && Open->DumpFileHandle != NULL){ - - NTSTATUS wres; - - ThreadDelay.QuadPart = -50000000; - // Wait the completion of the thread - wres = KeWaitForSingleObject(Open->DumpThreadObject, - UserRequest, - KernelMode, - TRUE, - &ThreadDelay); - - ObDereferenceObject(Open->DumpThreadObject); - - - // Flush and close the dump file - NPF_CloseDumpFile(Open); - } - - // Destroy the read Event - ZwClose(Open->ReadEventHandle); - - // Close the adapter - NdisCloseAdapter( - &Status, - Open->AdapterHandle - ); - - if (Status != NDIS_STATUS_PENDING) { - - NPF_CloseAdapterComplete( - Open, - Status - ); - return STATUS_SUCCESS; - - } - - return(STATUS_PENDING); -} - -//------------------------------------------------------------------- - -VOID -NPF_CloseAdapterComplete(IN NDIS_HANDLE ProtocolBindingContext,IN NDIS_STATUS Status) -{ - POPEN_INSTANCE Open; - PIRP Irp; - - IF_LOUD(DbgPrint("NPF: CloseAdapterComplete\n");) - - Open= (POPEN_INSTANCE)ProtocolBindingContext; - - // free the allocated structures only if the instance is still bound to the adapter - if(Open->Bound == TRUE){ - - // Free the filter if it's present - if(Open->bpfprogram != NULL) - ExFreePool(Open->bpfprogram); - -// -// Jitted filters are supported on x86 (32bit) only -// -#ifdef __NPF_x86__ - // Free the jitted filter if it's present - if(Open->Filter != NULL) - BPF_Destroy_JIT_Filter(Open->Filter); -#endif // __NPF_x86__ - - //free the buffer -// Open->BufSize = 0; -// if(Open->Buffer!=NULL)ExFreePool(Open->Buffer); - - if (Open->Size > 0) - ExFreePool(Open->CpuData[0].Buffer); - - //free mem_ex - Open->mem_ex.size = 0; - if(Open->mem_ex.buffer != NULL)ExFreePool(Open->mem_ex.buffer); - - NdisFreePacketPool(Open->PacketPool); - - Irp=Open->OpenCloseIrp; - - // Free the string with the name of the dump file - if(Open->DumpFileName.Buffer!=NULL) - ExFreePool(Open->DumpFileName.Buffer); - - ExFreePool(Open->ReadEventName.Buffer); - ExFreePool(Open); - - // Complete the request only if the instance is still bound to the adapter - Irp->IoStatus.Status = STATUS_SUCCESS; - Irp->IoStatus.Information = 0; - IoCompleteRequest(Irp, IO_NO_INCREMENT); - } - else - NdisSetEvent(&Open->IOEvent); - - // Decrease the counter of open instances - NdisAcquireSpinLock(&Opened_Instances_Lock); - n_Opened_Instances--; - NdisReleaseSpinLock(&Opened_Instances_Lock); - - IF_LOUD(DbgPrint("Opened Instances:%d", n_Opened_Instances);) - - if(n_Opened_Instances == 0){ - // Force a synchronization at the next NPF_Open(). - // This hopefully avoids the synchronization issues caused by hibernation or standby. - TIME_DESYNCHRONIZE(&G_Start_Time); - } - - return; - -} -//------------------------------------------------------------------- - -#ifdef NDIS50 -NDIS_STATUS -NPF_PowerChange(IN NDIS_HANDLE ProtocolBindingContext, IN PNET_PNP_EVENT pNetPnPEvent) -{ - IF_LOUD(DbgPrint("NPF: PowerChange\n");) - - TIME_DESYNCHRONIZE(&G_Start_Time); - - TIME_SYNCHRONIZE(&G_Start_Time); - - return STATUS_SUCCESS; -} -#endif - -//------------------------------------------------------------------- - -VOID -NPF_BindAdapter( - OUT PNDIS_STATUS Status, - IN NDIS_HANDLE BindContext, - IN PNDIS_STRING DeviceName, - IN PVOID SystemSpecific1, - IN PVOID SystemSpecific2 - ) -{ - IF_LOUD(DbgPrint("NPF: NPF_BindAdapter\n");) -} - -//------------------------------------------------------------------- - -VOID -NPF_UnbindAdapter( - OUT PNDIS_STATUS Status, - IN NDIS_HANDLE ProtocolBindingContext, - IN NDIS_HANDLE UnbindContext - ) -{ - POPEN_INSTANCE Open =(POPEN_INSTANCE)ProtocolBindingContext; - NDIS_STATUS lStatus; - - IF_LOUD(DbgPrint("NPF: NPF_UnbindAdapter\n");) - - // Reset the buffer size. This tells the dump thread to stop. -// Open->BufSize=0; - - NdisResetEvent(&Open->IOEvent); - - // This open instance is no more bound to the adapter, set Bound to False - InterlockedExchange( (PLONG) &Open->Bound, FALSE ); - - // Awake a possible pending read on this instance - if(Open->mode & MODE_DUMP) - NdisSetEvent(&Open->DumpEvent); - else - KeSetEvent(Open->ReadEvent,0,FALSE); - - // If this instance is in dump mode, complete the dump and close the file - if((Open->mode & MODE_DUMP) && Open->DumpFileHandle != NULL) - NPF_CloseDumpFile(Open); - - // Destroy the read Event - ZwClose(Open->ReadEventHandle); - - // close the adapter - NdisCloseAdapter( - &lStatus, - Open->AdapterHandle - ); - - if (lStatus != NDIS_STATUS_PENDING) { - - NPF_CloseAdapterComplete( - Open, - lStatus - ); - - *Status = NDIS_STATUS_SUCCESS; - return; - - } - - *Status = NDIS_STATUS_SUCCESS; - return; -} - -//------------------------------------------------------------------- - -VOID -NPF_ResetComplete(IN NDIS_HANDLE ProtocolBindingContext,IN NDIS_STATUS Status) - -{ - POPEN_INSTANCE Open; - PIRP Irp; - - PLIST_ENTRY ResetListEntry; - - IF_LOUD(DbgPrint("NPF: PacketResetComplete\n");) - - Open= (POPEN_INSTANCE)ProtocolBindingContext; - - - // - // remove the reset IRP from the list - // - ResetListEntry=ExInterlockedRemoveHeadList( - &Open->ResetIrpList, - &Open->RequestSpinLock - ); - -#if DBG - if (ResetListEntry == NULL) { - DbgBreakPoint(); - return; - } -#endif - - Irp=CONTAINING_RECORD(ResetListEntry,IRP,Tail.Overlay.ListEntry); - - Irp->IoStatus.Status = STATUS_SUCCESS; - IoCompleteRequest(Irp, IO_NO_INCREMENT); - - IF_LOUD(DbgPrint("NPF: PacketResetComplete exit\n");) - - return; - -} +/* + * Copyright (c) 1999 - 2005 NetGroup, Politecnico di Torino (Italy) + * Copyright (c) 2005 CACE Technologies, Davis (California) + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the Politecnico di Torino, CACE Technologies + * nor the names of its contributors may be used to endorse or promote + * products derived from this software without specific prior written + * permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#include + +#include "ntddk.h" +#include "ntiologc.h" +#include "ndis.h" + +#include "debug.h" +#include "packet.h" + +static NDIS_MEDIUM MediumArray[] = { + NdisMedium802_3, +// NdisMediumWan, + NdisMediumFddi, + NdisMediumArcnet878_2, + NdisMediumAtm, + NdisMedium802_5 +}; + +#define NUM_NDIS_MEDIA (sizeof MediumArray / sizeof MediumArray[0]) + +ULONG NamedEventsCounter=0; + +//Itoa. Replaces the buggy RtlIntegerToUnicodeString +void PacketItoa(UINT n,PUCHAR buf){ +int i; + + for(i=0;i<20;i+=2){ + buf[18-i]=(n%10)+48; + buf[19-i]=0; + n/=10; + } + +} + +/// Global start time. Used as an absolute reference for timestamp conversion. +struct time_conv G_Start_Time = { + 0, + {0, 0}, +}; + +UINT n_Opened_Instances = 0; + +NDIS_SPIN_LOCK Opened_Instances_Lock; + +//------------------------------------------------------------------- + +NTSTATUS NPF_Open(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp) +{ + + PDEVICE_EXTENSION DeviceExtension; + + POPEN_INSTANCE Open; + + PIO_STACK_LOCATION IrpSp; + + NDIS_STATUS Status; + NDIS_STATUS ErrorStatus; + UINT i; + PCHAR EvName; + + IF_LOUD(DbgPrint("NPF: OpenAdapter\n");) + + DeviceExtension = DeviceObject->DeviceExtension; + + IrpSp = IoGetCurrentIrpStackLocation(Irp); + + // allocate some memory for the open structure + Open=ExAllocatePoolWithTag(NonPagedPool, sizeof(OPEN_INSTANCE), '0OWA'); + + if (Open==NULL) { + // no memory + Irp->IoStatus.Status = STATUS_INSUFFICIENT_RESOURCES; + IoCompleteRequest(Irp, IO_NO_INCREMENT); + return STATUS_INSUFFICIENT_RESOURCES; + } + + RtlZeroMemory( + Open, + sizeof(OPEN_INSTANCE) + ); + + + EvName=ExAllocatePoolWithTag(NonPagedPool, sizeof(L"\\BaseNamedObjects\\SEE0000000000"), '1OWA'); + + if (EvName==NULL) { + // no memory + ExFreePool(Open); + Irp->IoStatus.Status = STATUS_INSUFFICIENT_RESOURCES; + IoCompleteRequest(Irp, IO_NO_INCREMENT); + return STATUS_INSUFFICIENT_RESOURCES; + } + + // Save or open here + IrpSp->FileObject->FsContext=Open; + + Open->DeviceExtension=DeviceExtension; + + + // Save the Irp here for the completion routine to retrieve + Open->OpenCloseIrp=Irp; + + // Allocate a packet pool for our xmit and receive packets + NdisAllocatePacketPool( + &Status, + &Open->PacketPool, + TRANSMIT_PACKETS, + sizeof(PACKET_RESERVED)); + + + if (Status != NDIS_STATUS_SUCCESS) { + + IF_LOUD(DbgPrint("NPF: Failed to allocate packet pool\n");) + + ExFreePool(Open); + ExFreePool(EvName); + Irp->IoStatus.Status = STATUS_INSUFFICIENT_RESOURCES; + IoCompleteRequest(Irp, IO_NO_INCREMENT); + return STATUS_INSUFFICIENT_RESOURCES; + } + + + RtlCopyBytes(EvName,L"\\BaseNamedObjects\\SEE0000000000",sizeof(L"\\BaseNamedObjects\\SEE0000000000")); + + //Create the string containing the name of the read event + RtlInitUnicodeString(&Open->ReadEventName,(PCWSTR) EvName); + + PacketItoa(NamedEventsCounter,(PUCHAR)(Open->ReadEventName.Buffer+21)); + + InterlockedIncrement(&NamedEventsCounter); + + IF_LOUD(DbgPrint("\nCreated the named event for the read; name=%ws, counter=%d\n", Open->ReadEventName.Buffer,NamedEventsCounter-1);) + + //allocate the event objects + Open->ReadEvent=IoCreateNotificationEvent(&Open->ReadEventName,&Open->ReadEventHandle); + if(Open->ReadEvent==NULL){ + ExFreePool(Open); + ExFreePool(EvName); + Irp->IoStatus.Status = STATUS_INSUFFICIENT_RESOURCES; + IoCompleteRequest(Irp, IO_NO_INCREMENT); + return STATUS_INSUFFICIENT_RESOURCES; + } + + KeInitializeEvent(Open->ReadEvent, NotificationEvent, FALSE); + KeClearEvent(Open->ReadEvent); + NdisInitializeEvent(&Open->WriteEvent); + NdisInitializeEvent(&Open->IOEvent); + NdisInitializeEvent(&Open->DumpEvent); + NdisAllocateSpinLock(&Open->MachineLock); + NdisAllocateSpinLock(&Open->WriteLock); + Open->WriteInProgress = FALSE; + + // list to hold irp's want to reset the adapter + InitializeListHead(&Open->ResetIrpList); + + + // Initialize the request list + KeInitializeSpinLock(&Open->RequestSpinLock); + InitializeListHead(&Open->RequestList); + + // Initializes the extended memory of the NPF machine + Open->mem_ex.buffer = ExAllocatePoolWithTag(NonPagedPool, DEFAULT_MEM_EX_SIZE, '2OWA'); + if((Open->mem_ex.buffer) == NULL) + { + // no memory + ExFreePool(Open); + ExFreePool(EvName); + Irp->IoStatus.Status = STATUS_INSUFFICIENT_RESOURCES; + IoCompleteRequest(Irp, IO_NO_INCREMENT); + return STATUS_INSUFFICIENT_RESOURCES; + } + + Open->mem_ex.size = DEFAULT_MEM_EX_SIZE; + RtlZeroMemory(Open->mem_ex.buffer, DEFAULT_MEM_EX_SIZE); + + // + // Initialize the open instance + // +// Open->BufSize = 0; +// Open->Buffer = NULL; +// Open->Bhead = 0; +// Open->Btail = 0; +// (INT)Open->BLastByte = -1; +// Open->Dropped = 0; //reset the dropped packets counter +// Open->Received = 0; //reset the received packets counter +// Open->Accepted = 0; //reset the accepted packets counter + Open->bpfprogram = NULL; //reset the filter + Open->mode = MODE_CAPT; + Open->Nbytes.QuadPart = 0; + Open->Npackets.QuadPart = 0; + Open->Nwrites = 1; + Open->Multiple_Write_Counter = 0; + Open->MinToCopy = 0; + Open->TimeOut.QuadPart = (LONGLONG)1; + Open->Bound = TRUE; + Open->DumpFileName.Buffer = NULL; + Open->DumpFileHandle = NULL; + Open->tme.active = TME_NONE_ACTIVE; + Open->DumpLimitReached = FALSE; + Open->MaxFrameSize = 0; + Open->WriterSN=0; + Open->ReaderSN=0; + Open->Size=0; + + + + //allocate the spinlock for the statistic counters + NdisAllocateSpinLock(&Open->CountersLock); + + //allocate the spinlock for the buffer pointers + // NdisAllocateSpinLock(&Open->BufLock); + + // + // link up the request stored in our open block + // + for (i=0;iRequestList, + &Open->Requests[i].ListElement, + &Open->RequestSpinLock); + + } + + + IoMarkIrpPending(Irp); + + // + // Try to open the MAC + // + IF_LOUD(DbgPrint("NPF: Opening the device %ws, BindingContext=%d\n",DeviceExtension->AdapterName.Buffer, Open);) + + NdisOpenAdapter( + &Status, + &ErrorStatus, + &Open->AdapterHandle, + &Open->Medium, + MediumArray, + NUM_NDIS_MEDIA, + DeviceExtension->NdisProtocolHandle, + Open, + &DeviceExtension->AdapterName, + 0, + NULL); + + IF_LOUD(DbgPrint("NPF: Opened the device, Status=%x\n",Status);) + + if (Status != NDIS_STATUS_PENDING) + { + NPF_OpenAdapterComplete(Open,Status,NDIS_STATUS_SUCCESS); + } + + return(STATUS_PENDING); +} + +//------------------------------------------------------------------- + +VOID NPF_OpenAdapterComplete( + IN NDIS_HANDLE ProtocolBindingContext, + IN NDIS_STATUS Status, + IN NDIS_STATUS OpenErrorStatus) +{ + + PIRP Irp; + POPEN_INSTANCE Open; + PLIST_ENTRY RequestListEntry; + PINTERNAL_REQUEST MaxSizeReq; + NDIS_STATUS ReqStatus; + + + IF_LOUD(DbgPrint("NPF: OpenAdapterComplete\n");) + + Open= (POPEN_INSTANCE)ProtocolBindingContext; + + // + // get the open irp + // + Irp=Open->OpenCloseIrp; + + if (Status != NDIS_STATUS_SUCCESS) { + + IF_LOUD(DbgPrint("NPF: OpenAdapterComplete-FAILURE\n");) + + NdisFreePacketPool(Open->PacketPool); + + //free mem_ex + Open->mem_ex.size = 0; + if(Open->mem_ex.buffer != NULL)ExFreePool(Open->mem_ex.buffer); + + ExFreePool(Open->ReadEventName.Buffer); + + ZwClose(Open->ReadEventHandle); + + + ExFreePool(Open); + } + else { + NdisAcquireSpinLock(&Opened_Instances_Lock); + n_Opened_Instances++; + NdisReleaseSpinLock(&Opened_Instances_Lock); + + IF_LOUD(DbgPrint("Opened Instances:%d", n_Opened_Instances);) + + // Get the absolute value of the system boot time. + // This is used for timestamp conversion. + TIME_SYNCHRONIZE(&G_Start_Time); + + // Extract a request from the list of free ones + RequestListEntry=ExInterlockedRemoveHeadList(&Open->RequestList, &Open->RequestSpinLock); + + if (RequestListEntry == NULL) + { + + Open->MaxFrameSize = 1600; // Assume Ethernet + + Irp->IoStatus.Status = Status; + Irp->IoStatus.Information = 0; + IoCompleteRequest(Irp, IO_NO_INCREMENT); + + return; + } + + MaxSizeReq = CONTAINING_RECORD(RequestListEntry, INTERNAL_REQUEST, ListElement); + MaxSizeReq->Irp = Irp; + MaxSizeReq->Internal = TRUE; + + + MaxSizeReq->Request.RequestType = NdisRequestQueryInformation; + MaxSizeReq->Request.DATA.QUERY_INFORMATION.Oid = OID_GEN_MAXIMUM_TOTAL_SIZE; + + + MaxSizeReq->Request.DATA.QUERY_INFORMATION.InformationBuffer = &Open->MaxFrameSize; + MaxSizeReq->Request.DATA.QUERY_INFORMATION.InformationBufferLength = 4; + + // submit the request + NdisRequest( + &ReqStatus, + Open->AdapterHandle, + &MaxSizeReq->Request); + + + if (ReqStatus != NDIS_STATUS_PENDING) { + NPF_RequestComplete(Open, &MaxSizeReq->Request, ReqStatus); + } + + return; + + } + + Irp->IoStatus.Status = Status; + Irp->IoStatus.Information = 0; + IoCompleteRequest(Irp, IO_NO_INCREMENT); + + return; + +} + +//------------------------------------------------------------------- + +NTSTATUS +NPF_Close(IN PDEVICE_OBJECT DeviceObject,IN PIRP Irp) +{ + + POPEN_INSTANCE Open; + NDIS_STATUS Status; + PIO_STACK_LOCATION IrpSp; + LARGE_INTEGER ThreadDelay; + + IF_LOUD(DbgPrint("NPF: CloseAdapter\n");) + + IrpSp = IoGetCurrentIrpStackLocation(Irp); + + Open=IrpSp->FileObject->FsContext; + + // Reset the buffer size. This tells the dump thread to stop. +// Open->BufSize = 0; + + if( Open->Bound == FALSE){ + + NdisWaitEvent(&Open->IOEvent,10000); + + // Free the filter if it's present + if(Open->bpfprogram != NULL) + ExFreePool(Open->bpfprogram); + +// +// Jitted filters are supported on x86 (32bit) only +// +#ifdef __NPF_x86__ + // Free the jitted filter if it's present + if(Open->Filter != NULL) + BPF_Destroy_JIT_Filter(Open->Filter); +#endif + + //free the buffer +// Open->BufSize=0; +// if(Open->Buffer != NULL)ExFreePool(Open->Buffer); + + if (Open->Size > 0) + ExFreePool(Open->CpuData[0].Buffer); + + //free mem_ex + Open->mem_ex.size = 0; + if(Open->mem_ex.buffer != NULL)ExFreePool(Open->mem_ex.buffer); + + NdisFreePacketPool(Open->PacketPool); + + // Free the string with the name of the dump file + if(Open->DumpFileName.Buffer!=NULL) + ExFreePool(Open->DumpFileName.Buffer); + + ExFreePool(Open->ReadEventName.Buffer); + ExFreePool(Open); + + Irp->IoStatus.Information = 0; + Irp->IoStatus.Status = STATUS_SUCCESS; + IoCompleteRequest(Irp, IO_NO_INCREMENT); + + return(STATUS_SUCCESS); + } + + // Unfreeze the consumer + if(Open->mode & MODE_DUMP) + NdisSetEvent(&Open->DumpEvent); + else + KeSetEvent(Open->ReadEvent,0,FALSE); + + // Save the IRP + Open->OpenCloseIrp = Irp; + + IoMarkIrpPending(Irp); + + // If this instance is in dump mode, complete the dump and close the file + if((Open->mode & MODE_DUMP) && Open->DumpFileHandle != NULL){ + + NTSTATUS wres; + + ThreadDelay.QuadPart = -50000000; + // Wait the completion of the thread + wres = KeWaitForSingleObject(Open->DumpThreadObject, + UserRequest, + KernelMode, + TRUE, + &ThreadDelay); + + ObDereferenceObject(Open->DumpThreadObject); + + + // Flush and close the dump file + NPF_CloseDumpFile(Open); + } + + // Destroy the read Event + ZwClose(Open->ReadEventHandle); + + // Close the adapter + NdisCloseAdapter( + &Status, + Open->AdapterHandle + ); + + if (Status != NDIS_STATUS_PENDING) { + + NPF_CloseAdapterComplete( + Open, + Status + ); + return STATUS_SUCCESS; + + } + + return(STATUS_PENDING); +} + +//------------------------------------------------------------------- + +VOID +NPF_CloseAdapterComplete(IN NDIS_HANDLE ProtocolBindingContext,IN NDIS_STATUS Status) +{ + POPEN_INSTANCE Open; + PIRP Irp; + + IF_LOUD(DbgPrint("NPF: CloseAdapterComplete\n");) + + Open= (POPEN_INSTANCE)ProtocolBindingContext; + + // free the allocated structures only if the instance is still bound to the adapter + if(Open->Bound == TRUE){ + + // Free the filter if it's present + if(Open->bpfprogram != NULL) + ExFreePool(Open->bpfprogram); + +// +// Jitted filters are supported on x86 (32bit) only +// +#ifdef __NPF_x86__ + // Free the jitted filter if it's present + if(Open->Filter != NULL) + BPF_Destroy_JIT_Filter(Open->Filter); +#endif // __NPF_x86__ + + //free the buffer +// Open->BufSize = 0; +// if(Open->Buffer!=NULL)ExFreePool(Open->Buffer); + + if (Open->Size > 0) + ExFreePool(Open->CpuData[0].Buffer); + + //free mem_ex + Open->mem_ex.size = 0; + if(Open->mem_ex.buffer != NULL)ExFreePool(Open->mem_ex.buffer); + + NdisFreePacketPool(Open->PacketPool); + + Irp=Open->OpenCloseIrp; + + // Free the string with the name of the dump file + if(Open->DumpFileName.Buffer!=NULL) + ExFreePool(Open->DumpFileName.Buffer); + + ExFreePool(Open->ReadEventName.Buffer); + ExFreePool(Open); + + // Complete the request only if the instance is still bound to the adapter + Irp->IoStatus.Status = STATUS_SUCCESS; + Irp->IoStatus.Information = 0; + IoCompleteRequest(Irp, IO_NO_INCREMENT); + } + else + NdisSetEvent(&Open->IOEvent); + + // Decrease the counter of open instances + NdisAcquireSpinLock(&Opened_Instances_Lock); + n_Opened_Instances--; + NdisReleaseSpinLock(&Opened_Instances_Lock); + + IF_LOUD(DbgPrint("Opened Instances:%d", n_Opened_Instances);) + + if(n_Opened_Instances == 0){ + // Force a synchronization at the next NPF_Open(). + // This hopefully avoids the synchronization issues caused by hibernation or standby. + TIME_DESYNCHRONIZE(&G_Start_Time); + } + + return; + +} +//------------------------------------------------------------------- + +#ifdef NDIS50 +NDIS_STATUS +NPF_PowerChange(IN NDIS_HANDLE ProtocolBindingContext, IN PNET_PNP_EVENT pNetPnPEvent) +{ + IF_LOUD(DbgPrint("NPF: PowerChange\n");) + + TIME_DESYNCHRONIZE(&G_Start_Time); + + TIME_SYNCHRONIZE(&G_Start_Time); + + return STATUS_SUCCESS; +} +#endif + +//------------------------------------------------------------------- + +VOID +NPF_BindAdapter( + OUT PNDIS_STATUS Status, + IN NDIS_HANDLE BindContext, + IN PNDIS_STRING DeviceName, + IN PVOID SystemSpecific1, + IN PVOID SystemSpecific2 + ) +{ + IF_LOUD(DbgPrint("NPF: NPF_BindAdapter\n");) +} + +//------------------------------------------------------------------- + +VOID +NPF_UnbindAdapter( + OUT PNDIS_STATUS Status, + IN NDIS_HANDLE ProtocolBindingContext, + IN NDIS_HANDLE UnbindContext + ) +{ + POPEN_INSTANCE Open =(POPEN_INSTANCE)ProtocolBindingContext; + NDIS_STATUS lStatus; + + IF_LOUD(DbgPrint("NPF: NPF_UnbindAdapter\n");) + + // Reset the buffer size. This tells the dump thread to stop. +// Open->BufSize=0; + + NdisResetEvent(&Open->IOEvent); + + // This open instance is no more bound to the adapter, set Bound to False + InterlockedExchange( (PLONG) &Open->Bound, FALSE ); + + // Awake a possible pending read on this instance + if(Open->mode & MODE_DUMP) + NdisSetEvent(&Open->DumpEvent); + else + KeSetEvent(Open->ReadEvent,0,FALSE); + + // If this instance is in dump mode, complete the dump and close the file + if((Open->mode & MODE_DUMP) && Open->DumpFileHandle != NULL) + NPF_CloseDumpFile(Open); + + // Destroy the read Event + ZwClose(Open->ReadEventHandle); + + // close the adapter + NdisCloseAdapter( + &lStatus, + Open->AdapterHandle + ); + + if (lStatus != NDIS_STATUS_PENDING) { + + NPF_CloseAdapterComplete( + Open, + lStatus + ); + + *Status = NDIS_STATUS_SUCCESS; + return; + + } + + *Status = NDIS_STATUS_SUCCESS; + return; +} + +//------------------------------------------------------------------- + +VOID +NPF_ResetComplete(IN NDIS_HANDLE ProtocolBindingContext,IN NDIS_STATUS Status) + +{ + POPEN_INSTANCE Open; + PIRP Irp; + + PLIST_ENTRY ResetListEntry; + + IF_LOUD(DbgPrint("NPF: PacketResetComplete\n");) + + Open= (POPEN_INSTANCE)ProtocolBindingContext; + + + // + // remove the reset IRP from the list + // + ResetListEntry=ExInterlockedRemoveHeadList( + &Open->ResetIrpList, + &Open->RequestSpinLock + ); + +#if DBG + if (ResetListEntry == NULL) { + DbgBreakPoint(); + return; + } +#endif + + Irp=CONTAINING_RECORD(ResetListEntry,IRP,Tail.Overlay.ListEntry); + + Irp->IoStatus.Status = STATUS_SUCCESS; + IoCompleteRequest(Irp, IO_NO_INCREMENT); + + IF_LOUD(DbgPrint("NPF: PacketResetComplete exit\n");) + + return; + +} diff --git a/src/See/Packet.c b/src/See/Packet.c index a82c51c9..66c0adb3 100644 --- a/src/See/Packet.c +++ b/src/See/Packet.c @@ -1,1643 +1,1643 @@ -/* - * Copyright (c) 1999 - 2005 NetGroup, Politecnico di Torino (Italy) - * Copyright (c) 2005 CACE Technologies, Davis (California) - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the Politecnico di Torino, CACE Technologies - * nor the names of its contributors may be used to endorse or promote - * products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - */ - -#include - -#include "stdarg.h" -#include "ntddk.h" -#include "ntiologc.h" -#include "ndis.h" - -#include "ntddpack.h" - -#include "debug.h" -#include "packet.h" -#include "win_bpf.h" -#include "win_bpf_filter_init.h" - -#if DBG -// Declare the global debug flag for this driver. -ULONG PacketDebugFlag = PACKET_DEBUG_LOUD; - -#endif - -PDEVICE_EXTENSION GlobalDeviceExtension; - -// -// Global strings -// -NDIS_STRING NPF_Prefix = NDIS_STRING_CONST("SEE_"); -NDIS_STRING devicePrefix = NDIS_STRING_CONST("\\Device\\"); -NDIS_STRING symbolicLinkPrefix = NDIS_STRING_CONST("\\DosDevices\\"); -NDIS_STRING tcpLinkageKeyName = NDIS_STRING_CONST("\\Registry\\Machine\\System" - L"\\CurrentControlSet\\Services\\Tcpip\\Linkage"); -NDIS_STRING AdapterListKey = NDIS_STRING_CONST("\\Registry\\Machine\\System" - L"\\CurrentControlSet\\Control\\Class\\{4D36E972-E325-11CE-BFC1-08002BE10318}"); -NDIS_STRING bindValueName = NDIS_STRING_CONST("Bind"); - -/// Global variable that points to the names of the bound adapters -WCHAR* bindP = NULL; - -extern struct time_conv G_Start_Time; // from openclos.c - -extern NDIS_SPIN_LOCK Opened_Instances_Lock; - -ULONG NCpu = 1; - -ULONG TimestampMode; -UINT g_SendPacketFlags = 0; - - -// Crush now -void Crush(UINT a, UINT b, UINT c, UINT d) -{ - KeBugCheckEx(0x3f000000 + a, (ULONG_PTR)a, (ULONG_PTR)b, (ULONG_PTR)c, (ULONG_PTR)d); -} - -// -// Packet Driver's entry routine. -// -NTSTATUS -DriverEntry( - IN PDRIVER_OBJECT DriverObject, - IN PUNICODE_STRING RegistryPath - ) -{ - - NDIS_PROTOCOL_CHARACTERISTICS ProtocolChar; - PDEVICE_OBJECT DeviceObject = NULL; - PDEVICE_EXTENSION DeviceExtension = NULL; - NTSTATUS Status = STATUS_SUCCESS; - NTSTATUS ErrorCode = STATUS_SUCCESS; - NDIS_STRING ProtoName = NDIS_STRING_CONST("PacketDriver"); - ULONG DevicesCreated=0; - NDIS_HANDLE NdisProtocolHandle; - WCHAR* bindT; - PKEY_VALUE_PARTIAL_INFORMATION tcpBindingsP; - UNICODE_STRING macName; - ULONG OsMajorVersion, OsMinorVersion; - - PsGetVersion(&OsMajorVersion, &OsMinorVersion, NULL, NULL); - // - // Define the correct flag to skip the loopback packets, according to the OS - // - if((OsMajorVersion == 5) && (OsMinorVersion == 0)) - { - // Windows 2000 wants both NDIS_FLAGS_DONT_LOOPBACK and NDIS_FLAGS_SKIP_LOOPBACK - g_SendPacketFlags = NDIS_FLAGS_DONT_LOOPBACK | NDIS_FLAGS_SKIP_LOOPBACK_W2K; - } - else - { - // Windows XP, 2003 and following want only NDIS_FLAGS_DONT_LOOPBACK - g_SendPacketFlags = NDIS_FLAGS_DONT_LOOPBACK; - } - - if (((OsMajorVersion == 6) && (OsMinorVersion >= 1)) || (OsMajorVersion >= 7)) - { - // Use KeQueryActiveProcessors to get the number of CPUs in Windows 7 or later - KAFFINITY cpus = KeQueryActiveProcessors(); - NCpu = 0; - - while (cpus) - { - if (cpus % 2) - { - NCpu++; - } - - cpus = cpus / 2; - } - } - else - { - // Use NdisSystemProcessorCount in Windows Vista or earlier - NCpu = NdisSystemProcessorCount(); - } - - - ReadTimeStampModeFromRegistry(RegistryPath); - - IF_LOUD(DbgPrint("%ws",RegistryPath->Buffer);) - - IF_LOUD(DbgPrint("\n\nPacket: DriverEntry\n");) - - RtlZeroMemory(&ProtocolChar,sizeof(NDIS_PROTOCOL_CHARACTERISTICS)); - -#ifdef NDIS50 - ProtocolChar.MajorNdisVersion = 5; -#else - ProtocolChar.MajorNdisVersion = 3; -#endif - ProtocolChar.MinorNdisVersion = 0; - ProtocolChar.Reserved = 0; - ProtocolChar.OpenAdapterCompleteHandler = NPF_OpenAdapterComplete; - ProtocolChar.CloseAdapterCompleteHandler = NPF_CloseAdapterComplete; - ProtocolChar.SendCompleteHandler = NPF_SendComplete; - ProtocolChar.TransferDataCompleteHandler = NPF_TransferDataComplete; - ProtocolChar.ResetCompleteHandler = NPF_ResetComplete; - ProtocolChar.RequestCompleteHandler = NPF_RequestComplete; - ProtocolChar.ReceiveHandler = NPF_tap; - ProtocolChar.ReceiveCompleteHandler = NPF_ReceiveComplete; - ProtocolChar.StatusHandler = NPF_Status; - ProtocolChar.StatusCompleteHandler = NPF_StatusComplete; -#ifdef NDIS50 - ProtocolChar.BindAdapterHandler = NPF_BindAdapter; - ProtocolChar.UnbindAdapterHandler = NPF_UnbindAdapter; - ProtocolChar.PnPEventHandler = NPF_PowerChange; - ProtocolChar.ReceivePacketHandler = NULL; -#endif - ProtocolChar.Name = ProtoName; - - NdisRegisterProtocol( - &Status, - &NdisProtocolHandle, - &ProtocolChar, - sizeof(NDIS_PROTOCOL_CHARACTERISTICS)); - - if (Status != NDIS_STATUS_SUCCESS) { - - IF_LOUD(DbgPrint("NPF: Failed to register protocol with NDIS\n");) - - return Status; - - } - - NdisAllocateSpinLock(&Opened_Instances_Lock); - - // Set up the device driver entry points. - DriverObject->MajorFunction[IRP_MJ_CREATE] = NPF_Open; - DriverObject->MajorFunction[IRP_MJ_CLOSE] = NPF_Close; - DriverObject->MajorFunction[IRP_MJ_READ] = NPF_Read; - DriverObject->MajorFunction[IRP_MJ_WRITE] = NPF_Write; - DriverObject->MajorFunction[IRP_MJ_DEVICE_CONTROL] = NPF_IoControl; - DriverObject->DriverUnload = NPF_Unload; - - bindP = getAdaptersList(); - - if (bindP == NULL) - { - IF_LOUD(DbgPrint("Adapters not found in the registry, try to copy the bindings of TCP-IP.\n");) - - tcpBindingsP = getTcpBindings(); - - if (tcpBindingsP == NULL) - { - IF_LOUD(DbgPrint("TCP-IP not found, quitting.\n");) - goto RegistryError; - } - - bindP = (WCHAR*)tcpBindingsP; - bindT = (WCHAR*)(tcpBindingsP->Data); - - } - else - { - bindT = bindP; - } - - for (; *bindT != UNICODE_NULL; bindT += (macName.Length + sizeof(UNICODE_NULL)) / sizeof(WCHAR)) - { - RtlInitUnicodeString(&macName, bindT); - createDevice(DriverObject, &macName, NdisProtocolHandle); - } - - return STATUS_SUCCESS; - -RegistryError: - - NdisDeregisterProtocol( - &Status, - NdisProtocolHandle - ); - - Status=STATUS_UNSUCCESSFUL; - - return(Status); - -} - -//------------------------------------------------------------------- - -PWCHAR getAdaptersList(void) -{ - PKEY_VALUE_PARTIAL_INFORMATION result = NULL; - OBJECT_ATTRIBUTES objAttrs; - NTSTATUS status; - HANDLE keyHandle; - UINT BufPos=0; - UINT BufLen=4096; - - - PWCHAR DeviceNames = (PWCHAR) ExAllocatePoolWithTag(PagedPool, BufLen, '0PWA'); - - if (DeviceNames == NULL) { - IF_LOUD(DbgPrint("Unable the allocate the buffer for the list of the network adapters\n");) - return NULL; - } - - InitializeObjectAttributes(&objAttrs, &AdapterListKey, - OBJ_CASE_INSENSITIVE, NULL, NULL); - status = ZwOpenKey(&keyHandle, KEY_READ, &objAttrs); - if (!NT_SUCCESS(status)) { - IF_LOUD(DbgPrint("\n\nStatus of %x opening %ws\n", status, tcpLinkageKeyName.Buffer);) - } - else { //OK - - ULONG resultLength; - CHAR AdapInfo[1024]; - UINT i=0; - KEY_VALUE_PARTIAL_INFORMATION valueInfo; - - IF_LOUD(DbgPrint("getAdaptersList: scanning the list of the adapters in the registry, DeviceNames=%x\n",DeviceNames);) - - // Scan the list of the devices - while((status=ZwEnumerateKey(keyHandle,i,KeyBasicInformation,AdapInfo,sizeof(AdapInfo),&resultLength))==STATUS_SUCCESS) - { - WCHAR ExportKeyName [512]; - PWCHAR ExportKeyPrefix = L"\\Registry\\Machine\\System\\CurrentControlSet\\Control\\Class\\{4D36E972-E325-11CE-BFC1-08002BE10318}\\"; - UINT ExportKeyPrefixSize = sizeof(L"\\Registry\\Machine\\System\\CurrentControlSet\\Control\\Class\\{4D36E972-E325-11CE-BFC1-08002BE10318}"); - PWCHAR LinkageKeyPrefix = L"\\Linkage"; - UINT LinkageKeyPrefixSize = sizeof(L"\\Linkage"); - NDIS_STRING FinalExportKey = NDIS_STRING_CONST("Export"); - PKEY_BASIC_INFORMATION tInfo= (PKEY_BASIC_INFORMATION)AdapInfo; - UNICODE_STRING AdapterKeyName; - HANDLE ExportKeyHandle; - - RtlCopyMemory(ExportKeyName, - ExportKeyPrefix, - ExportKeyPrefixSize); - - RtlCopyMemory((PCHAR)ExportKeyName+ExportKeyPrefixSize, - tInfo->Name, - tInfo->NameLength+2); - - RtlCopyMemory((PCHAR)ExportKeyName+ExportKeyPrefixSize+tInfo->NameLength, - LinkageKeyPrefix, - LinkageKeyPrefixSize); - - IF_LOUD(DbgPrint("Key name=%ws\n", ExportKeyName);) - - RtlInitUnicodeString(&AdapterKeyName, ExportKeyName); - - InitializeObjectAttributes(&objAttrs, &AdapterKeyName, - OBJ_CASE_INSENSITIVE, NULL, NULL); - - status=ZwOpenKey(&ExportKeyHandle,KEY_READ,&objAttrs); - - if (!NT_SUCCESS(status)) { - IF_LOUD(DbgPrint("OpenKey Failed, %d!\n",status);) - i++; - continue; - } - - status = ZwQueryValueKey(ExportKeyHandle, &FinalExportKey, - KeyValuePartialInformation, &valueInfo, - sizeof(valueInfo), &resultLength); - - if (!NT_SUCCESS(status) && (status != STATUS_BUFFER_OVERFLOW)) { - IF_LOUD(DbgPrint("\n\nStatus of %x querying key value for size\n", status);) - } - else { // We know how big it needs to be. - ULONG valueInfoLength = valueInfo.DataLength + FIELD_OFFSET(KEY_VALUE_PARTIAL_INFORMATION, Data[0]); - PKEY_VALUE_PARTIAL_INFORMATION valueInfoP = (PKEY_VALUE_PARTIAL_INFORMATION) ExAllocatePoolWithTag(PagedPool, valueInfoLength, '1PWA'); - if (valueInfoP != NULL) { - status = ZwQueryValueKey(ExportKeyHandle, &FinalExportKey, - KeyValuePartialInformation, - valueInfoP, - valueInfoLength, &resultLength); - if (!NT_SUCCESS(status)) { - IF_LOUD(DbgPrint("Status of %x querying key value\n", status);) - } - else{ - IF_LOUD(DbgPrint("Device %d = %ws\n", i, valueInfoP->Data);) - if( BufPos + valueInfoP->DataLength > BufLen ) { - // double the buffer size - PWCHAR DeviceNames2 = (PWCHAR) ExAllocatePoolWithTag(PagedPool, BufLen - << 1, '0PWA'); - if( DeviceNames2 ) { - RtlCopyMemory((PCHAR)DeviceNames2, (PCHAR)DeviceNames, BufLen); - BufLen <<= 1; - ExFreePool(DeviceNames); - DeviceNames = DeviceNames2; - } - } - if( BufPos + valueInfoP->DataLength < BufLen ) { - RtlCopyMemory((PCHAR)DeviceNames+BufPos, - valueInfoP->Data, - valueInfoP->DataLength); - BufPos+=valueInfoP->DataLength-2; - } - } - - ExFreePool(valueInfoP); - } - else { - IF_LOUD(DbgPrint("Error Allocating the buffer for the device name\n");) - } - - } - - // terminate the buffer - DeviceNames[BufPos/2]=0; - DeviceNames[BufPos/2+1]=0; - - ZwClose (ExportKeyHandle); - i++; - - } - - ZwClose (keyHandle); - - } - if(BufPos==0){ - ExFreePool(DeviceNames); - return NULL; - } - return DeviceNames; -} - -//------------------------------------------------------------------- - -PKEY_VALUE_PARTIAL_INFORMATION getTcpBindings(void) -{ - PKEY_VALUE_PARTIAL_INFORMATION result = NULL; - OBJECT_ATTRIBUTES objAttrs; - NTSTATUS status; - HANDLE keyHandle; - - InitializeObjectAttributes(&objAttrs, &tcpLinkageKeyName, - OBJ_CASE_INSENSITIVE, NULL, NULL); - status = ZwOpenKey(&keyHandle, KEY_READ, &objAttrs); - if (!NT_SUCCESS(status)) { - IF_LOUD(DbgPrint("\n\nStatus of %x opening %ws\n", status, tcpLinkageKeyName.Buffer);) - } - else { - ULONG resultLength; - KEY_VALUE_PARTIAL_INFORMATION valueInfo; - - IF_LOUD(DbgPrint("\n\nOpened %ws\n", tcpLinkageKeyName.Buffer);) - - status = ZwQueryValueKey(keyHandle, &bindValueName, - KeyValuePartialInformation, &valueInfo, - sizeof(valueInfo), &resultLength); - if (!NT_SUCCESS(status) && (status != STATUS_BUFFER_OVERFLOW)) { - IF_LOUD(DbgPrint("\n\nStatus of %x querying key value for size\n", status);) - } - else { // We know how big it needs to be. - ULONG valueInfoLength = valueInfo.DataLength + FIELD_OFFSET(KEY_VALUE_PARTIAL_INFORMATION, Data[0]); - PKEY_VALUE_PARTIAL_INFORMATION valueInfoP = - (PKEY_VALUE_PARTIAL_INFORMATION)ExAllocatePoolWithTag(PagedPool, valueInfoLength, '2PWA'); - - if (valueInfoP != NULL) { - status = ZwQueryValueKey(keyHandle, &bindValueName, - KeyValuePartialInformation, - valueInfoP, - valueInfoLength, &resultLength); - - if (!NT_SUCCESS(status)) { - IF_LOUD(DbgPrint("\n\nStatus of %x querying key value\n", status);) - } - else if (valueInfoLength != resultLength) { - IF_LOUD(DbgPrint("\n\nQuerying key value result len = %u " - "but previous len = %u\n", - resultLength, valueInfoLength);) - } - else if (valueInfoP->Type != REG_MULTI_SZ) { - IF_LOUD(DbgPrint("\n\nTcpip bind value not REG_MULTI_SZ but %u\n", - valueInfoP->Type);) - } - else { // It's OK -#if DBG - ULONG i; - WCHAR* dataP = (WCHAR*)(&valueInfoP->Data[0]); - IF_LOUD(DbgPrint("\n\nBind value:\n");) - for (i = 0; *dataP != UNICODE_NULL; i++) { - UNICODE_STRING macName; - RtlInitUnicodeString(&macName, dataP); - IF_LOUD(DbgPrint("\n\nMac %u = %ws\n", i, macName.Buffer);) - dataP += - (macName.Length + sizeof(UNICODE_NULL)) / sizeof(WCHAR); - } -#endif // DBG - result = valueInfoP; - } - } - } - ZwClose(keyHandle); - } - return result; -} - -//------------------------------------------------------------------- - -BOOLEAN createDevice(IN OUT PDRIVER_OBJECT adriverObjectP, - IN PUNICODE_STRING amacNameP, NDIS_HANDLE aProtoHandle) -{ - NTSTATUS status; - PDEVICE_OBJECT devObjP; - UNICODE_STRING deviceName; - UNICODE_STRING deviceSymLink; - - IF_LOUD(DbgPrint("\n\ncreateDevice for MAC %ws\n", amacNameP->Buffer);); - if (RtlCompareMemory(amacNameP->Buffer, devicePrefix.Buffer, - devicePrefix.Length) < devicePrefix.Length) - { - return FALSE; - } - - deviceName.Length = 0; - deviceName.MaximumLength = (USHORT)(amacNameP->Length + NPF_Prefix.Length + sizeof(UNICODE_NULL)); - deviceName.Buffer = ExAllocatePoolWithTag(PagedPool, deviceName.MaximumLength, '3PWA'); - - if (deviceName.Buffer == NULL) - return FALSE; - - deviceSymLink.Length = 0; - deviceSymLink.MaximumLength =(USHORT)(amacNameP->Length-devicePrefix.Length - + symbolicLinkPrefix.Length - + NPF_Prefix.Length - + sizeof(UNICODE_NULL)); - - deviceSymLink.Buffer = ExAllocatePoolWithTag(NonPagedPool, deviceSymLink.MaximumLength, '3PWA'); - - if (deviceSymLink.Buffer == NULL) - { - ExFreePool(deviceName.Buffer); - return FALSE; - } - - RtlAppendUnicodeStringToString(&deviceName, &devicePrefix); - RtlAppendUnicodeStringToString(&deviceName, &NPF_Prefix); - RtlAppendUnicodeToString(&deviceName, amacNameP->Buffer + - devicePrefix.Length / sizeof(WCHAR)); - - RtlAppendUnicodeStringToString(&deviceSymLink, &symbolicLinkPrefix); - RtlAppendUnicodeStringToString(&deviceSymLink, &NPF_Prefix); - RtlAppendUnicodeToString(&deviceSymLink, amacNameP->Buffer + - devicePrefix.Length / sizeof(WCHAR)); - - IF_LOUD(DbgPrint("Creating device name: %ws\n", deviceName.Buffer);) - - status = IoCreateDevice(adriverObjectP, - sizeof(DEVICE_EXTENSION), - &deviceName, - FILE_DEVICE_TRANSPORT, - 0, - FALSE, - &devObjP); - - if (NT_SUCCESS(status)) - { - PDEVICE_EXTENSION devExtP = (PDEVICE_EXTENSION)devObjP->DeviceExtension; - - IF_LOUD(DbgPrint("Device created successfully\n");); - - devObjP->Flags |= DO_DIRECT_IO; - RtlInitUnicodeString(&devExtP->AdapterName,amacNameP->Buffer); - devExtP->NdisProtocolHandle=aProtoHandle; - - IF_LOUD(DbgPrint("Trying to create SymLink %ws\n",deviceSymLink.Buffer);); - - if (IoCreateSymbolicLink(&deviceSymLink,&deviceName) != STATUS_SUCCESS) - { - IF_LOUD(DbgPrint("\n\nError creating SymLink %ws\nn", deviceSymLink.Buffer);); - - ExFreePool(deviceName.Buffer); - ExFreePool(deviceSymLink.Buffer); - - devExtP->ExportString = NULL; - - return FALSE; - } - - IF_LOUD(DbgPrint("SymLink %ws successfully created.\n\n", deviceSymLink.Buffer);); - - devExtP->ExportString = deviceSymLink.Buffer; - - ExFreePool(deviceName.Buffer); - - return TRUE; - } - - else - { - IF_LOUD(DbgPrint("\n\nIoCreateDevice status = %x\n", status);); - - ExFreePool(deviceName.Buffer); - ExFreePool(deviceSymLink.Buffer); - - return FALSE; - } -} -//------------------------------------------------------------------- - -VOID NPF_Unload(IN PDRIVER_OBJECT DriverObject) -{ - PDEVICE_OBJECT DeviceObject; - PDEVICE_OBJECT OldDeviceObject; - PDEVICE_EXTENSION DeviceExtension; - - NDIS_HANDLE NdisProtocolHandle = NULL; - NDIS_STATUS Status; - - NDIS_STRING SymLink; - - IF_LOUD(DbgPrint("NPF: Unload\n");); - - DeviceObject = DriverObject->DeviceObject; - - while (DeviceObject != NULL) { - OldDeviceObject = DeviceObject; - - DeviceObject = DeviceObject->NextDevice; - - DeviceExtension = OldDeviceObject->DeviceExtension; - - NdisProtocolHandle=DeviceExtension->NdisProtocolHandle; - - IF_LOUD(DbgPrint("Deleting Adapter %ws, Protocol Handle=%x, Device Obj=%x (%x)\n", - DeviceExtension->AdapterName.Buffer, - NdisProtocolHandle, - DeviceObject, - OldDeviceObject);); - - if (DeviceExtension->ExportString) - { - RtlInitUnicodeString(&SymLink , DeviceExtension->ExportString); - - IF_LOUD(DbgPrint("Deleting SymLink at %p\n", SymLink.Buffer);); - - IoDeleteSymbolicLink(&SymLink); - ExFreePool(DeviceExtension->ExportString); - } - - IoDeleteDevice(OldDeviceObject); - } - - NdisDeregisterProtocol( - &Status, - NdisProtocolHandle - ); - - // Free the adapters names - ExFreePool( bindP ); -} - -#define SET_FAILURE_BUFFER_SMALL() do{\ - Information = 0; \ - Status = STATUS_BUFFER_TOO_SMALL; \ -} while(FALSE) - -#define SET_RESULT_SUCCESS(__a__) do{\ - Information = __a__; \ - Status = STATUS_SUCCESS; \ -} while(FALSE) - -#define SET_FAILURE_INVALID_REQUEST() do{\ - Information = 0; \ - Status = STATUS_INVALID_DEVICE_REQUEST; \ -} while(FALSE) - -#define SET_FAILURE_UNSUCCESSFUL() do{\ - Information = 0; \ - Status = STATUS_UNSUCCESSFUL; \ -} while(FALSE) - -#define SET_FAILURE_NOMEM() do{\ - Information = 0; \ - Status = STATUS_INSUFFICIENT_RESOURCES; \ -} while(FALSE) - - -//------------------------------------------------------------------- - -NTSTATUS NPF_IoControl(IN PDEVICE_OBJECT DeviceObject,IN PIRP Irp) -{ - POPEN_INSTANCE Open; - PIO_STACK_LOCATION IrpSp; - PLIST_ENTRY RequestListEntry; - PINTERNAL_REQUEST pRequest; - ULONG FunctionCode; - NDIS_STATUS Status; - UINT i; - PUCHAR tpointer; - ULONG dim,timeout; - PUCHAR prog; - PPACKET_OID_DATA OidData; - ULONG mode; -// PWSTR DumpNameBuff; - PUCHAR TmpBPFProgram; - INT WriteRes; - BOOLEAN SyncWrite = FALSE; -// struct bpf_insn *initprogram; - ULONG insns; - ULONG cnt; - BOOLEAN IsExtendedFilter=FALSE; - - BOOLEAN Flag; - PUINT pStats; - ULONG Information = 0; - - BOOLEAN check_ok; - - IF_LOUD(DbgPrint("NPF: IoControl\n");) - - IrpSp = IoGetCurrentIrpStackLocation(Irp); - FunctionCode=IrpSp->Parameters.DeviceIoControl.IoControlCode; - Open=IrpSp->FileObject->FsContext; - - Irp->IoStatus.Status = STATUS_SUCCESS; - - IF_LOUD(DbgPrint("NPF: Function code is %08lx buff size=%08lx %08lx\n",FunctionCode,IrpSp->Parameters.DeviceIoControl.InputBufferLength,IrpSp->Parameters.DeviceIoControl.OutputBufferLength);) - - switch (FunctionCode){ - - case BIOCGSTATS: //function to get the capture stats - - if(IrpSp->Parameters.DeviceIoControl.OutputBufferLength < 4*sizeof(UINT)){ - EXIT_FAILURE(0); - } - - check_ok = TRUE; - __try - { - ProbeForWrite(Irp->UserBuffer, IrpSp->Parameters.DeviceIoControl.OutputBufferLength, 1); - } - __except (EXCEPTION_EXECUTE_HANDLER) - { - check_ok = FALSE; - } - - if (check_ok == FALSE) - { - EXIT_FAILURE(0); - } - else - { - pStats = (PUINT)(Irp->UserBuffer); - - pStats[3] = 0; - pStats[0] = 0; - pStats[1] = 0; - pStats[2] = 0; // Not yet supported - - for(i = 0 ; i < NCpu ; i++) - { - - pStats[3] += Open->CpuData[i].Accepted; - pStats[0] += Open->CpuData[i].Received; - pStats[1] += Open->CpuData[i].Dropped; - pStats[2] += 0; // Not yet supported - } - EXIT_SUCCESS(4*sizeof(UINT)); - } - - break; - - case BIOCGEVNAME: //function to get the name of the event associated with the current instance - - if(IrpSp->Parameters.DeviceIoControl.OutputBufferLength<26){ - EXIT_FAILURE(0); - } - - check_ok = TRUE; - __try - { - ProbeForWrite(Irp->UserBuffer, IrpSp->Parameters.DeviceIoControl.OutputBufferLength, 1); - } - __except (EXCEPTION_EXECUTE_HANDLER) - { - check_ok = FALSE; - } - - if (check_ok == FALSE) - { - EXIT_FAILURE(0); - } - else - { - RtlCopyMemory(Irp->UserBuffer,(Open->ReadEventName.Buffer)+18,26); - - EXIT_SUCCESS(26); - } - - break; - - case BIOCSENDPACKETSSYNC: - - SyncWrite = TRUE; - - case BIOCSENDPACKETSNOSYNC: - - NdisAcquireSpinLock(&Open->WriteLock); - if(Open->WriteInProgress) - { - // Another write operation is currently in progress - EXIT_FAILURE(0); - } - else - { - Open->WriteInProgress = TRUE; - } - NdisReleaseSpinLock(&Open->WriteLock); - - WriteRes = NPF_BufferedWrite(Irp, - (PUCHAR)Irp->AssociatedIrp.SystemBuffer, - IrpSp->Parameters.DeviceIoControl.InputBufferLength, - SyncWrite); - - NdisAcquireSpinLock(&Open->WriteLock); - Open->WriteInProgress = FALSE; - NdisReleaseSpinLock(&Open->WriteLock); - - if( WriteRes != -1) - { - EXIT_SUCCESS(WriteRes); - } - - EXIT_FAILURE(WriteRes); - - break; - - case BIOCSETF: - - Open->SkipProcessing = 1; - - do - { - Flag = FALSE; - for(i = 0; i < NCpu ; i++) - if (Open->CpuData[i].Processing == 1) - Flag = TRUE; - } - while(Flag); //BUSY FORM WAITING... - - - // Free the previous buffer if it was present - if(Open->bpfprogram != NULL){ - TmpBPFProgram = Open->bpfprogram; - Open->bpfprogram = NULL; - ExFreePool(TmpBPFProgram); - } - -// -// Jitted filters are supported on x86 (32bit) only -// -#ifdef __NPF_x86__ - if (Open->Filter != NULL) - { - JIT_BPF_Filter *OldFilter=Open->Filter; - Open->Filter=NULL; - BPF_Destroy_JIT_Filter(OldFilter); - } -#endif // __NPF_x86__ - - // Get the pointer to the new program - prog=(PUCHAR)Irp->AssociatedIrp.SystemBuffer; - - if(prog==NULL) - { - Open->SkipProcessing = 0; - EXIT_FAILURE(0); - } - - insns = (IrpSp->Parameters.DeviceIoControl.InputBufferLength)/sizeof(struct bpf_insn); - - //count the number of operative instructions - for (cnt=0;(cntmem_ex),&(Open->tme), &G_Start_Time)!=INIT_OK) - { - - IF_LOUD(DbgPrint("Error initializing NPF machine (bpf_filter_init)\n");) - - Open->SkipProcessing = 0; - EXIT_FAILURE(0); - } - } -#else //x86-64 and IA64 - if ( cnt != insns) - { - IF_LOUD(DbgPrint("Error installing the BPF filter. The filter contains TME extensions," - " not supported on 64bit platforms.\n");) - - Open->SkipProcessing = 0; - EXIT_FAILURE(0); - } - - -#endif - - //the NPF processor has been initialized, we have to validate the operative instructions - insns = cnt; - - //NOTE: the validation code checks for TME instructions, and fails if a TME instruction is - //encountered on 64 bit machines - if(bpf_validate((struct bpf_insn*)prog,cnt,Open->mem_ex.size)==0) - { - IF_LOUD(DbgPrint("Error validating program");) - //FIXME: the machine has been initialized(?), but the operative code is wrong. - //we have to reset the machine! - //something like: reallocate the mem_ex, and reset the tme_core - Open->SkipProcessing = 0; - EXIT_FAILURE(0); - } - - // Allocate the memory to contain the new filter program - // We could need the original BPF binary if we are forced to use bpf_filter_with_2_buffers() - TmpBPFProgram = (PUCHAR)ExAllocatePoolWithTag(NonPagedPool, cnt*sizeof(struct bpf_insn), '4PWA'); - if (TmpBPFProgram == NULL) - { - IF_LOUD(DbgPrint("Error - No memory for filter");) - // no memory - Open->SkipProcessing = 0; - EXIT_FAILURE(0); - } - - //copy the program in the new buffer - RtlCopyMemory(TmpBPFProgram,prog,cnt*sizeof(struct bpf_insn)); - Open->bpfprogram=TmpBPFProgram; - - // - // At the moment the JIT compiler works on x86 (32 bit) only - // -#ifdef __NPF_x86__ - // Create the new JIT filter function - if(!IsExtendedFilter) - if((Open->Filter=BPF_jitter((struct bpf_insn*)Open->bpfprogram,cnt)) == NULL) - { - IF_LOUD(DbgPrint("Error jittering filter");) - Open->SkipProcessing = 0; - EXIT_FAILURE(0); - } -#endif - - //return - for (i = 0 ; i < NCpu ; i++) - { - Open->CpuData[i].C=0; - Open->CpuData[i].P=0; - Open->CpuData[i].Free = Open->Size; - Open->CpuData[i].Accepted=0; - Open->CpuData[i].Dropped=0; - Open->CpuData[i].Received = 0; - } - - Open->ReaderSN=0; - Open->WriterSN=0; - - Open->SkipProcessing = 0; - EXIT_SUCCESS(IrpSp->Parameters.DeviceIoControl.InputBufferLength); - - break; - - case BIOCSMODE: //set the capture mode - - if(IrpSp->Parameters.DeviceIoControl.InputBufferLength < sizeof(ULONG)) - { - EXIT_FAILURE(0); - } - - mode=*((PULONG)Irp->AssociatedIrp.SystemBuffer); - -///////kernel dump does not work at the moment////////////////////////////////////////// - if (mode & MODE_DUMP) - { - EXIT_FAILURE(0); - } -///////kernel dump does not work at the moment////////////////////////////////////////// - - if(mode == MODE_CAPT) - { - Open->mode = MODE_CAPT; - - EXIT_SUCCESS(0); - } - else if (mode == MODE_MON) - { -// -// The MONITOR_MODE (aka TME extensions) is not supported on -// 64 bit architectures -// -#ifdef __NPF_x86__ - Open->mode = MODE_MON; - EXIT_SUCCESS(0); -#else // _NPF_x86__ - EXIT_FAILURE(0); -#endif // __NPF_x86__ - - } - else{ - if(mode & MODE_STAT){ - Open->mode = MODE_STAT; - NdisAcquireSpinLock(&Open->CountersLock); - Open->Nbytes.QuadPart = 0; - Open->Npackets.QuadPart = 0; - NdisReleaseSpinLock(&Open->CountersLock); - - if(Open->TimeOut.QuadPart==0)Open->TimeOut.QuadPart = -10000000; - - } - - if(mode & MODE_DUMP){ - - Open->mode |= MODE_DUMP; -// Open->MinToCopy=(Open->BufSize<2000000)?Open->BufSize/2:1000000; - - } - EXIT_SUCCESS(0); - } - - EXIT_FAILURE(0); - - break; - - case BIOCSETDUMPFILENAME: - -///////kernel dump does not work at the moment////////////////////////////////////////// - EXIT_FAILURE(0); -///////kernel dump does not work at the moment////////////////////////////////////////// - -// -// Remove the following #if 0 to enable the kernel dump again -// -#if 0 - if(Open->mode & MODE_DUMP) - { - - // Close current dump file - if(Open->DumpFileHandle != NULL) - { - NPF_CloseDumpFile(Open); - Open->DumpFileHandle = NULL; - } - - if(IrpSp->Parameters.DeviceIoControl.InputBufferLength == 0){ - EXIT_FAILURE(0); - } - - // Allocate the buffer that will contain the string - DumpNameBuff=ExAllocatePoolWithTag(NonPagedPool, IrpSp->Parameters.DeviceIoControl.InputBufferLength, '5PWA'); - if(DumpNameBuff==NULL || Open->DumpFileName.Buffer!=NULL){ - IF_LOUD(DbgPrint("NPF: unable to allocate the dump filename: not enough memory or name already set\n");) - EXIT_FAILURE(0); - } - - // Copy the buffer - RtlCopyBytes((PVOID)DumpNameBuff, - Irp->AssociatedIrp.SystemBuffer, - IrpSp->Parameters.DeviceIoControl.InputBufferLength); - - // Force a \0 at the end of the filename to avoid that malformed strings cause RtlInitUnicodeString to crash the system - ((PSHORT)DumpNameBuff)[IrpSp->Parameters.DeviceIoControl.InputBufferLength/2-1]=0; - - // Create the unicode string - RtlInitUnicodeString(&Open->DumpFileName, DumpNameBuff); - - IF_LOUD(DbgPrint("NPF: dump file name set to %ws, len=%d\n", - Open->DumpFileName.Buffer, - IrpSp->Parameters.DeviceIoControl.InputBufferLength);) - - // Try to create the file - if ( NT_SUCCESS( NPF_OpenDumpFile(Open,&Open->DumpFileName,FALSE)) && - NT_SUCCESS( NPF_StartDump(Open))) - { - EXIT_SUCCESS(0); - } - } - - EXIT_FAILURE(0); - - break; -#endif // #if 0 - case BIOCSETDUMPLIMITS: - -///////kernel dump does not work at the moment////////////////////////////////////////// - EXIT_FAILURE(0); -///////kernel dump does not work at the moment////////////////////////////////////////// - -// -// Remove the following #if 0 to enable the kernel dump again -// -#if 0 - if (IrpSp->Parameters.DeviceIoControl.InputBufferLength < 2*sizeof(ULONG)) - { - EXIT_FAILURE(0); - } - - Open->MaxDumpBytes = *(PULONG)Irp->AssociatedIrp.SystemBuffer; - Open->MaxDumpPacks = *((PULONG)Irp->AssociatedIrp.SystemBuffer + 1); - - IF_LOUD(DbgPrint("NPF: Set dump limits to %u bytes, %u packs\n", Open->MaxDumpBytes, Open->MaxDumpPacks);) - - EXIT_SUCCESS(0); - - break; - -#endif // #if 0 - - case BIOCISDUMPENDED: - -///////kernel dump does not work at the moment////////////////////////////////////////// - EXIT_FAILURE(0); -///////kernel dump does not work at the moment////////////////////////////////////////// - -// -// Remove the following #if 0 to enable the kernel dump again -// -#if 0 - if(IrpSp->Parameters.DeviceIoControl.OutputBufferLength < sizeof(UINT)) - { - EXIT_FAILURE(0); - } - - *((UINT*)Irp->UserBuffer) = (Open->DumpLimitReached)?1:0; - - EXIT_SUCCESS(4); - - break; - -#endif // #if 0 - - case BIOCSETBUFFERSIZE: - - - if(IrpSp->Parameters.DeviceIoControl.InputBufferLength < sizeof(ULONG)) - { - EXIT_FAILURE(0); - } - - // Get the number of bytes to allocate - dim = *((PULONG)Irp->AssociatedIrp.SystemBuffer); - - Open->SkipProcessing = 1; - - do - { - Flag = FALSE; - for(i=0;iCpuData[i].Processing == 1) - Flag = TRUE; - } - while(Flag); //BUSY FORM WAITING... - - if (dim / NCpu < sizeof(struct PacketHeader)) - dim = 0; - else - { - tpointer = ExAllocatePoolWithTag(NonPagedPool, dim, '6PWA'); - if (tpointer==NULL) - { - // no memory - Open->SkipProcessing = 0; - EXIT_FAILURE(0); - } - } - - if (Open->CpuData[0].Buffer != NULL) - ExFreePool(Open->CpuData[0].Buffer); - - for (i = 0 ; i < NCpu ; i++) - { - if (dim > 0) - Open->CpuData[i].Buffer=(PUCHAR)tpointer + (dim/NCpu)*i; - else - Open->CpuData[i].Buffer = NULL; - Open->CpuData[i].Free = dim/NCpu; - Open->CpuData[i].P = 0; - Open->CpuData[i].C = 0; - Open->CpuData[i].Accepted = 0; - Open->CpuData[i].Dropped = 0; - Open->CpuData[i].Received = 0; - } - - Open->ReaderSN=0; - Open->WriterSN=0; - - Open->Size = dim/NCpu; - - Open->SkipProcessing = 0; - EXIT_SUCCESS(dim); - - break; - - case BIOCSRTIMEOUT: //set the timeout on the read calls - - - if(IrpSp->Parameters.DeviceIoControl.InputBufferLength < sizeof(ULONG)) - { - EXIT_FAILURE(0); - } - - timeout = *((PULONG)Irp->AssociatedIrp.SystemBuffer); - if(timeout == (ULONG)-1) - Open->TimeOut.QuadPart=(LONGLONG)IMMEDIATE; - else - { - Open->TimeOut.QuadPart = (LONGLONG)timeout; - Open->TimeOut.QuadPart *= 10000; - Open->TimeOut.QuadPart = -Open->TimeOut.QuadPart; - } - - IF_LOUD(DbgPrint("NPF: read timeout set to %d:%d\n",Open->TimeOut.HighPart,Open->TimeOut.LowPart);) - EXIT_SUCCESS(timeout); - - break; - - case BIOCSWRITEREP: //set the writes repetition number - - if(IrpSp->Parameters.DeviceIoControl.InputBufferLength < sizeof(ULONG)) - { - EXIT_FAILURE(0); - } - - Open->Nwrites = *((PULONG)Irp->AssociatedIrp.SystemBuffer); - - EXIT_SUCCESS(Open->Nwrites); - - break; - - case BIOCSMINTOCOPY: //set the minimum buffer's size to copy to the application - - if(IrpSp->Parameters.DeviceIoControl.InputBufferLength < sizeof(ULONG)) - { - EXIT_FAILURE(0); - } - - Open->MinToCopy = (*((PULONG)Irp->AssociatedIrp.SystemBuffer))/NCpu; //An hack to make the NCPU-buffers behave like a larger one - - EXIT_SUCCESS(Open->MinToCopy); - - break; - - case IOCTL_PROTOCOL_RESET: - - IF_LOUD(DbgPrint("NPF: IoControl - Reset request\n");) - - IoMarkIrpPending(Irp); - Irp->IoStatus.Status = STATUS_SUCCESS; - - ExInterlockedInsertTailList(&Open->ResetIrpList,&Irp->Tail.Overlay.ListEntry,&Open->RequestSpinLock); - NdisReset(&Status,Open->AdapterHandle); - if (Status != NDIS_STATUS_PENDING) - { - IF_LOUD(DbgPrint("NPF: IoControl - ResetComplete being called\n");) - NPF_ResetComplete(Open,Status); - } - - break; - - - case BIOCSETOID: - case BIOCQUERYOID: - - // Extract a request from the list of free ones - RequestListEntry=ExInterlockedRemoveHeadList(&Open->RequestList,&Open->RequestSpinLock); - if (RequestListEntry == NULL) - { - EXIT_FAILURE(0); - } - - pRequest=CONTAINING_RECORD(RequestListEntry,INTERNAL_REQUEST,ListElement); - pRequest->Irp = Irp; - pRequest->Internal = FALSE; - - - // - // See if it is an Ndis request - // - OidData=Irp->AssociatedIrp.SystemBuffer; - - if (((FunctionCode == BIOCSETOID) || (FunctionCode == BIOCQUERYOID)) - && - (IrpSp->Parameters.DeviceIoControl.InputBufferLength == IrpSp->Parameters.DeviceIoControl.OutputBufferLength) - && - (IrpSp->Parameters.DeviceIoControl.InputBufferLength >= sizeof(PACKET_OID_DATA)) - && - (IrpSp->Parameters.DeviceIoControl.InputBufferLength >= sizeof(PACKET_OID_DATA)-1+OidData->Length)) { - - IF_LOUD(DbgPrint("NPF: IoControl: Request: Oid=%08lx, Length=%08lx\n",OidData->Oid,OidData->Length);) - - // - // The buffer is valid - // - if (FunctionCode == BIOCSETOID){ - - pRequest->Request.RequestType=NdisRequestSetInformation; - pRequest->Request.DATA.SET_INFORMATION.Oid=OidData->Oid; - - pRequest->Request.DATA.SET_INFORMATION.InformationBuffer=OidData->Data; - pRequest->Request.DATA.SET_INFORMATION.InformationBufferLength=OidData->Length; - - - } - else{ - - pRequest->Request.RequestType=NdisRequestQueryInformation; - pRequest->Request.DATA.QUERY_INFORMATION.Oid=OidData->Oid; - - pRequest->Request.DATA.QUERY_INFORMATION.InformationBuffer=OidData->Data; - pRequest->Request.DATA.QUERY_INFORMATION.InformationBufferLength=OidData->Length; - - } - - NdisResetEvent(&Open->IOEvent); - // - // submit the request - // - NdisRequest( - &Status, - Open->AdapterHandle, - &pRequest->Request - ); - - } else { - // - // buffer too small - // - Status=NDIS_STATUS_FAILURE; - pRequest->Request.DATA.SET_INFORMATION.BytesRead=0; - pRequest->Request.DATA.QUERY_INFORMATION.BytesWritten=0; - - } - - if (Status != NDIS_STATUS_PENDING) { - IF_LOUD(DbgPrint("NPF: Calling RequestCompleteHandler\n");) - - NPF_RequestComplete(Open, &pRequest->Request, Status); - return Status; - - } - - NdisWaitEvent(&Open->IOEvent, 5000); - - return(Open->IOStatus); - - break; - - case BIOCISETLOBBEH: - - if (IrpSp->Parameters.DeviceIoControl.InputBufferLength < sizeof(INT)) - { - SET_FAILURE_BUFFER_SMALL(); - break; - } - -#ifdef __NPF_NT4__ - - // NT4 doesn't support loopback inhibition / activation - SET_FAILURE_INVALID_REQUEST(); - break; - -#else //not __NPF_NT4__ - // - // win2000/xp/2003/vista - // - if(*(PINT)Irp->AssociatedIrp.SystemBuffer == 1) - { - Open->SkipSentPackets = TRUE; - - // - // Reset the capture buffers, since they could contain loopbacked packets - // - -// NPF_ResetBufferContents(Open); - - SET_RESULT_SUCCESS(0); - break; - - } - else - if(*(PINT)Irp->AssociatedIrp.SystemBuffer == 2) - { - Open->SkipSentPackets = FALSE; - - SET_RESULT_SUCCESS(0); - break; - } - else - { - // Unknown operation - SET_FAILURE_INVALID_REQUEST(); - break; - } - -#endif // !__NPF_NT4__ - break; - - - - default: - - EXIT_FAILURE(0); - } - - if (FunctionCode == BIOCISETLOBBEH) - { - Irp->IoStatus.Information = Information; - Irp->IoStatus.Status = Status; - IoCompleteRequest(Irp, IO_NO_INCREMENT); - } - - return Status; -} - -//------------------------------------------------------------------- - -VOID -NPF_RequestComplete( - IN NDIS_HANDLE ProtocolBindingContext, - IN PNDIS_REQUEST NdisRequest, - IN NDIS_STATUS Status - ) - -{ - POPEN_INSTANCE Open; - PIO_STACK_LOCATION IrpSp; - PIRP Irp; - PINTERNAL_REQUEST pRequest; - UINT FunctionCode; -// KIRQL OldIrq; - - PPACKET_OID_DATA OidData; - - IF_LOUD(DbgPrint("NPF: RequestComplete\n");) - - Open= (POPEN_INSTANCE)ProtocolBindingContext; - - pRequest=CONTAINING_RECORD(NdisRequest,INTERNAL_REQUEST,Request); - Irp=pRequest->Irp; - - if(pRequest->Internal == TRUE){ - - // Put the request in the list of the free ones - ExInterlockedInsertTailList(&Open->RequestList, &pRequest->ListElement, &Open->RequestSpinLock); - - if(Status != NDIS_STATUS_SUCCESS) - Open->MaxFrameSize = 1600; // Assume Ethernet - - // We always return success, because the adapter has been already opened - Irp->IoStatus.Status = NDIS_STATUS_SUCCESS; - Irp->IoStatus.Information = 0; - IoCompleteRequest(Irp, IO_NO_INCREMENT); - return; - } - - IrpSp = IoGetCurrentIrpStackLocation(Irp); - - FunctionCode=IrpSp->Parameters.DeviceIoControl.IoControlCode; - - OidData=Irp->AssociatedIrp.SystemBuffer; - - if (FunctionCode == BIOCSETOID) { - - OidData->Length=pRequest->Request.DATA.SET_INFORMATION.BytesRead; - - } else { - - if (FunctionCode == BIOCQUERYOID) { - - OidData->Length=pRequest->Request.DATA.QUERY_INFORMATION.BytesWritten; - - IF_LOUD(DbgPrint("RequestComplete: BytesWritten=%d\n",pRequest->Request.DATA.QUERY_INFORMATION.BytesWritten);) - } - - } - - Irp->IoStatus.Information=IrpSp->Parameters.DeviceIoControl.InputBufferLength; - - IF_LOUD(DbgPrint("RequestComplete: BytesReturned=%d\n",IrpSp->Parameters.DeviceIoControl.InputBufferLength);) - - ExInterlockedInsertTailList( - &Open->RequestList, - &pRequest->ListElement, - &Open->RequestSpinLock); - - Irp->IoStatus.Status = Status; - - Open->IOStatus = Status; - - IoCompleteRequest(Irp, IO_NO_INCREMENT); - - // Unlock the caller - NdisSetEvent(&Open->IOEvent); - - return; - - -} - -//------------------------------------------------------------------- - -VOID -NPF_Status( - IN NDIS_HANDLE ProtocolBindingContext, - IN NDIS_STATUS Status, - IN PVOID StatusBuffer, - IN UINT StatusBufferSize - ) - -{ - - IF_LOUD(DbgPrint("NPF: Status Indication\n");) - - return; - -} - -//------------------------------------------------------------------- - -VOID -NPF_StatusComplete( - IN NDIS_HANDLE ProtocolBindingContext - ) - -{ - - IF_LOUD(DbgPrint("NPF: StatusIndicationComplete\n");) - - return; - -} - -//------------------------------------------------------------------- - -NTSTATUS -NPF_ReadRegistry( - IN PWSTR *MacDriverName, - IN PWSTR *PacketDriverName, - IN PUNICODE_STRING RegistryPath - ) - -{ - NTSTATUS Status; - - RTL_QUERY_REGISTRY_TABLE ParamTable[4]; - - PWSTR Bind = L"Bind"; - PWSTR Export = L"Export"; - PWSTR Parameters = L"Parameters"; - PWSTR Linkage = L"Linkage"; - - PWCHAR Path; - - - - Path=ExAllocatePoolWithTag(PagedPool, RegistryPath->Length+sizeof(WCHAR), '7PWA'); - - if (Path == NULL) { - return STATUS_INSUFFICIENT_RESOURCES; - } - - RtlZeroMemory( - Path, - RegistryPath->Length+sizeof(WCHAR) - ); - - RtlCopyMemory( - Path, - RegistryPath->Buffer, - RegistryPath->Length - ); - - IF_LOUD(DbgPrint("NPF: Reg path is %ws\n",RegistryPath->Buffer);) - - RtlZeroMemory( - ParamTable, - sizeof(ParamTable) - ); - - - - // - // change to the linkage key - // - - ParamTable[0].QueryRoutine = NULL; - ParamTable[0].Flags = RTL_QUERY_REGISTRY_SUBKEY; - ParamTable[0].Name = Linkage; - - - // - // Get the name of the mac driver we should bind to - // - - ParamTable[1].QueryRoutine = NPF_QueryRegistryRoutine; - ParamTable[1].Flags = RTL_QUERY_REGISTRY_REQUIRED | - RTL_QUERY_REGISTRY_NOEXPAND; - - ParamTable[1].Name = Bind; - ParamTable[1].EntryContext = (PVOID)MacDriverName; - ParamTable[1].DefaultType = REG_MULTI_SZ; - - // - // Get the name that we should use for the driver object - // - - ParamTable[2].QueryRoutine = NPF_QueryRegistryRoutine; - ParamTable[2].Flags = RTL_QUERY_REGISTRY_REQUIRED | - RTL_QUERY_REGISTRY_NOEXPAND; - - ParamTable[2].Name = Export; - ParamTable[2].EntryContext = (PVOID)PacketDriverName; - ParamTable[2].DefaultType = REG_MULTI_SZ; - - - Status=RtlQueryRegistryValues( - RTL_REGISTRY_ABSOLUTE, - Path, - ParamTable, - NULL, - NULL - ); - - - ExFreePool(Path); - - return Status; -} - -//------------------------------------------------------------------- - -NTSTATUS -NPF_QueryRegistryRoutine( - IN PWSTR ValueName, - IN ULONG ValueType, - IN PVOID ValueData, - IN ULONG ValueLength, - IN PVOID Context, - IN PVOID EntryContext - ) - -{ - - PUCHAR Buffer; - - IF_LOUD(DbgPrint("Perf: QueryRegistryRoutine\n");) - - if (ValueType != REG_MULTI_SZ) { - - return STATUS_OBJECT_NAME_NOT_FOUND; - - } - - Buffer=ExAllocatePoolWithTag(NonPagedPool, ValueLength, '8PWA'); - - if (Buffer==NULL) { - - return STATUS_INSUFFICIENT_RESOURCES; - - } - - RtlCopyMemory( - Buffer, - ValueData, - ValueLength - ); - - *((PUCHAR *)EntryContext)=Buffer; - - return STATUS_SUCCESS; - -} +/* + * Copyright (c) 1999 - 2005 NetGroup, Politecnico di Torino (Italy) + * Copyright (c) 2005 CACE Technologies, Davis (California) + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the Politecnico di Torino, CACE Technologies + * nor the names of its contributors may be used to endorse or promote + * products derived from this software without specific prior written + * permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#include + +#include "stdarg.h" +#include "ntddk.h" +#include "ntiologc.h" +#include "ndis.h" + +#include "ntddpack.h" + +#include "debug.h" +#include "packet.h" +#include "win_bpf.h" +#include "win_bpf_filter_init.h" + +#if DBG +// Declare the global debug flag for this driver. +ULONG PacketDebugFlag = PACKET_DEBUG_LOUD; + +#endif + +PDEVICE_EXTENSION GlobalDeviceExtension; + +// +// Global strings +// +NDIS_STRING NPF_Prefix = NDIS_STRING_CONST("SEE_"); +NDIS_STRING devicePrefix = NDIS_STRING_CONST("\\Device\\"); +NDIS_STRING symbolicLinkPrefix = NDIS_STRING_CONST("\\DosDevices\\"); +NDIS_STRING tcpLinkageKeyName = NDIS_STRING_CONST("\\Registry\\Machine\\System" + L"\\CurrentControlSet\\Services\\Tcpip\\Linkage"); +NDIS_STRING AdapterListKey = NDIS_STRING_CONST("\\Registry\\Machine\\System" + L"\\CurrentControlSet\\Control\\Class\\{4D36E972-E325-11CE-BFC1-08002BE10318}"); +NDIS_STRING bindValueName = NDIS_STRING_CONST("Bind"); + +/// Global variable that points to the names of the bound adapters +WCHAR* bindP = NULL; + +extern struct time_conv G_Start_Time; // from openclos.c + +extern NDIS_SPIN_LOCK Opened_Instances_Lock; + +ULONG NCpu = 1; + +ULONG TimestampMode; +UINT g_SendPacketFlags = 0; + + +// Crush now +void Crush(UINT a, UINT b, UINT c, UINT d) +{ + KeBugCheckEx(0x3f000000 + a, (ULONG_PTR)a, (ULONG_PTR)b, (ULONG_PTR)c, (ULONG_PTR)d); +} + +// +// Packet Driver's entry routine. +// +NTSTATUS +DriverEntry( + IN PDRIVER_OBJECT DriverObject, + IN PUNICODE_STRING RegistryPath + ) +{ + + NDIS_PROTOCOL_CHARACTERISTICS ProtocolChar; + PDEVICE_OBJECT DeviceObject = NULL; + PDEVICE_EXTENSION DeviceExtension = NULL; + NTSTATUS Status = STATUS_SUCCESS; + NTSTATUS ErrorCode = STATUS_SUCCESS; + NDIS_STRING ProtoName = NDIS_STRING_CONST("PacketDriver"); + ULONG DevicesCreated=0; + NDIS_HANDLE NdisProtocolHandle; + WCHAR* bindT; + PKEY_VALUE_PARTIAL_INFORMATION tcpBindingsP; + UNICODE_STRING macName; + ULONG OsMajorVersion, OsMinorVersion; + + PsGetVersion(&OsMajorVersion, &OsMinorVersion, NULL, NULL); + // + // Define the correct flag to skip the loopback packets, according to the OS + // + if((OsMajorVersion == 5) && (OsMinorVersion == 0)) + { + // Windows 2000 wants both NDIS_FLAGS_DONT_LOOPBACK and NDIS_FLAGS_SKIP_LOOPBACK + g_SendPacketFlags = NDIS_FLAGS_DONT_LOOPBACK | NDIS_FLAGS_SKIP_LOOPBACK_W2K; + } + else + { + // Windows XP, 2003 and following want only NDIS_FLAGS_DONT_LOOPBACK + g_SendPacketFlags = NDIS_FLAGS_DONT_LOOPBACK; + } + + if (((OsMajorVersion == 6) && (OsMinorVersion >= 1)) || (OsMajorVersion >= 7)) + { + // Use KeQueryActiveProcessors to get the number of CPUs in Windows 7 or later + KAFFINITY cpus = KeQueryActiveProcessors(); + NCpu = 0; + + while (cpus) + { + if (cpus % 2) + { + NCpu++; + } + + cpus = cpus / 2; + } + } + else + { + // Use NdisSystemProcessorCount in Windows Vista or earlier + NCpu = NdisSystemProcessorCount(); + } + + + ReadTimeStampModeFromRegistry(RegistryPath); + + IF_LOUD(DbgPrint("%ws",RegistryPath->Buffer);) + + IF_LOUD(DbgPrint("\n\nPacket: DriverEntry\n");) + + RtlZeroMemory(&ProtocolChar,sizeof(NDIS_PROTOCOL_CHARACTERISTICS)); + +#ifdef NDIS50 + ProtocolChar.MajorNdisVersion = 5; +#else + ProtocolChar.MajorNdisVersion = 3; +#endif + ProtocolChar.MinorNdisVersion = 0; + ProtocolChar.Reserved = 0; + ProtocolChar.OpenAdapterCompleteHandler = NPF_OpenAdapterComplete; + ProtocolChar.CloseAdapterCompleteHandler = NPF_CloseAdapterComplete; + ProtocolChar.SendCompleteHandler = NPF_SendComplete; + ProtocolChar.TransferDataCompleteHandler = NPF_TransferDataComplete; + ProtocolChar.ResetCompleteHandler = NPF_ResetComplete; + ProtocolChar.RequestCompleteHandler = NPF_RequestComplete; + ProtocolChar.ReceiveHandler = NPF_tap; + ProtocolChar.ReceiveCompleteHandler = NPF_ReceiveComplete; + ProtocolChar.StatusHandler = NPF_Status; + ProtocolChar.StatusCompleteHandler = NPF_StatusComplete; +#ifdef NDIS50 + ProtocolChar.BindAdapterHandler = NPF_BindAdapter; + ProtocolChar.UnbindAdapterHandler = NPF_UnbindAdapter; + ProtocolChar.PnPEventHandler = NPF_PowerChange; + ProtocolChar.ReceivePacketHandler = NULL; +#endif + ProtocolChar.Name = ProtoName; + + NdisRegisterProtocol( + &Status, + &NdisProtocolHandle, + &ProtocolChar, + sizeof(NDIS_PROTOCOL_CHARACTERISTICS)); + + if (Status != NDIS_STATUS_SUCCESS) { + + IF_LOUD(DbgPrint("NPF: Failed to register protocol with NDIS\n");) + + return Status; + + } + + NdisAllocateSpinLock(&Opened_Instances_Lock); + + // Set up the device driver entry points. + DriverObject->MajorFunction[IRP_MJ_CREATE] = NPF_Open; + DriverObject->MajorFunction[IRP_MJ_CLOSE] = NPF_Close; + DriverObject->MajorFunction[IRP_MJ_READ] = NPF_Read; + DriverObject->MajorFunction[IRP_MJ_WRITE] = NPF_Write; + DriverObject->MajorFunction[IRP_MJ_DEVICE_CONTROL] = NPF_IoControl; + DriverObject->DriverUnload = NPF_Unload; + + bindP = getAdaptersList(); + + if (bindP == NULL) + { + IF_LOUD(DbgPrint("Adapters not found in the registry, try to copy the bindings of TCP-IP.\n");) + + tcpBindingsP = getTcpBindings(); + + if (tcpBindingsP == NULL) + { + IF_LOUD(DbgPrint("TCP-IP not found, quitting.\n");) + goto RegistryError; + } + + bindP = (WCHAR*)tcpBindingsP; + bindT = (WCHAR*)(tcpBindingsP->Data); + + } + else + { + bindT = bindP; + } + + for (; *bindT != UNICODE_NULL; bindT += (macName.Length + sizeof(UNICODE_NULL)) / sizeof(WCHAR)) + { + RtlInitUnicodeString(&macName, bindT); + createDevice(DriverObject, &macName, NdisProtocolHandle); + } + + return STATUS_SUCCESS; + +RegistryError: + + NdisDeregisterProtocol( + &Status, + NdisProtocolHandle + ); + + Status=STATUS_UNSUCCESSFUL; + + return(Status); + +} + +//------------------------------------------------------------------- + +PWCHAR getAdaptersList(void) +{ + PKEY_VALUE_PARTIAL_INFORMATION result = NULL; + OBJECT_ATTRIBUTES objAttrs; + NTSTATUS status; + HANDLE keyHandle; + UINT BufPos=0; + UINT BufLen=4096; + + + PWCHAR DeviceNames = (PWCHAR) ExAllocatePoolWithTag(PagedPool, BufLen, '0PWA'); + + if (DeviceNames == NULL) { + IF_LOUD(DbgPrint("Unable the allocate the buffer for the list of the network adapters\n");) + return NULL; + } + + InitializeObjectAttributes(&objAttrs, &AdapterListKey, + OBJ_CASE_INSENSITIVE, NULL, NULL); + status = ZwOpenKey(&keyHandle, KEY_READ, &objAttrs); + if (!NT_SUCCESS(status)) { + IF_LOUD(DbgPrint("\n\nStatus of %x opening %ws\n", status, tcpLinkageKeyName.Buffer);) + } + else { //OK + + ULONG resultLength; + CHAR AdapInfo[1024]; + UINT i=0; + KEY_VALUE_PARTIAL_INFORMATION valueInfo; + + IF_LOUD(DbgPrint("getAdaptersList: scanning the list of the adapters in the registry, DeviceNames=%x\n",DeviceNames);) + + // Scan the list of the devices + while((status=ZwEnumerateKey(keyHandle,i,KeyBasicInformation,AdapInfo,sizeof(AdapInfo),&resultLength))==STATUS_SUCCESS) + { + WCHAR ExportKeyName [512]; + PWCHAR ExportKeyPrefix = L"\\Registry\\Machine\\System\\CurrentControlSet\\Control\\Class\\{4D36E972-E325-11CE-BFC1-08002BE10318}\\"; + UINT ExportKeyPrefixSize = sizeof(L"\\Registry\\Machine\\System\\CurrentControlSet\\Control\\Class\\{4D36E972-E325-11CE-BFC1-08002BE10318}"); + PWCHAR LinkageKeyPrefix = L"\\Linkage"; + UINT LinkageKeyPrefixSize = sizeof(L"\\Linkage"); + NDIS_STRING FinalExportKey = NDIS_STRING_CONST("Export"); + PKEY_BASIC_INFORMATION tInfo= (PKEY_BASIC_INFORMATION)AdapInfo; + UNICODE_STRING AdapterKeyName; + HANDLE ExportKeyHandle; + + RtlCopyMemory(ExportKeyName, + ExportKeyPrefix, + ExportKeyPrefixSize); + + RtlCopyMemory((PCHAR)ExportKeyName+ExportKeyPrefixSize, + tInfo->Name, + tInfo->NameLength+2); + + RtlCopyMemory((PCHAR)ExportKeyName+ExportKeyPrefixSize+tInfo->NameLength, + LinkageKeyPrefix, + LinkageKeyPrefixSize); + + IF_LOUD(DbgPrint("Key name=%ws\n", ExportKeyName);) + + RtlInitUnicodeString(&AdapterKeyName, ExportKeyName); + + InitializeObjectAttributes(&objAttrs, &AdapterKeyName, + OBJ_CASE_INSENSITIVE, NULL, NULL); + + status=ZwOpenKey(&ExportKeyHandle,KEY_READ,&objAttrs); + + if (!NT_SUCCESS(status)) { + IF_LOUD(DbgPrint("OpenKey Failed, %d!\n",status);) + i++; + continue; + } + + status = ZwQueryValueKey(ExportKeyHandle, &FinalExportKey, + KeyValuePartialInformation, &valueInfo, + sizeof(valueInfo), &resultLength); + + if (!NT_SUCCESS(status) && (status != STATUS_BUFFER_OVERFLOW)) { + IF_LOUD(DbgPrint("\n\nStatus of %x querying key value for size\n", status);) + } + else { // We know how big it needs to be. + ULONG valueInfoLength = valueInfo.DataLength + FIELD_OFFSET(KEY_VALUE_PARTIAL_INFORMATION, Data[0]); + PKEY_VALUE_PARTIAL_INFORMATION valueInfoP = (PKEY_VALUE_PARTIAL_INFORMATION) ExAllocatePoolWithTag(PagedPool, valueInfoLength, '1PWA'); + if (valueInfoP != NULL) { + status = ZwQueryValueKey(ExportKeyHandle, &FinalExportKey, + KeyValuePartialInformation, + valueInfoP, + valueInfoLength, &resultLength); + if (!NT_SUCCESS(status)) { + IF_LOUD(DbgPrint("Status of %x querying key value\n", status);) + } + else{ + IF_LOUD(DbgPrint("Device %d = %ws\n", i, valueInfoP->Data);) + if( BufPos + valueInfoP->DataLength > BufLen ) { + // double the buffer size + PWCHAR DeviceNames2 = (PWCHAR) ExAllocatePoolWithTag(PagedPool, BufLen + << 1, '0PWA'); + if( DeviceNames2 ) { + RtlCopyMemory((PCHAR)DeviceNames2, (PCHAR)DeviceNames, BufLen); + BufLen <<= 1; + ExFreePool(DeviceNames); + DeviceNames = DeviceNames2; + } + } + if( BufPos + valueInfoP->DataLength < BufLen ) { + RtlCopyMemory((PCHAR)DeviceNames+BufPos, + valueInfoP->Data, + valueInfoP->DataLength); + BufPos+=valueInfoP->DataLength-2; + } + } + + ExFreePool(valueInfoP); + } + else { + IF_LOUD(DbgPrint("Error Allocating the buffer for the device name\n");) + } + + } + + // terminate the buffer + DeviceNames[BufPos/2]=0; + DeviceNames[BufPos/2+1]=0; + + ZwClose (ExportKeyHandle); + i++; + + } + + ZwClose (keyHandle); + + } + if(BufPos==0){ + ExFreePool(DeviceNames); + return NULL; + } + return DeviceNames; +} + +//------------------------------------------------------------------- + +PKEY_VALUE_PARTIAL_INFORMATION getTcpBindings(void) +{ + PKEY_VALUE_PARTIAL_INFORMATION result = NULL; + OBJECT_ATTRIBUTES objAttrs; + NTSTATUS status; + HANDLE keyHandle; + + InitializeObjectAttributes(&objAttrs, &tcpLinkageKeyName, + OBJ_CASE_INSENSITIVE, NULL, NULL); + status = ZwOpenKey(&keyHandle, KEY_READ, &objAttrs); + if (!NT_SUCCESS(status)) { + IF_LOUD(DbgPrint("\n\nStatus of %x opening %ws\n", status, tcpLinkageKeyName.Buffer);) + } + else { + ULONG resultLength; + KEY_VALUE_PARTIAL_INFORMATION valueInfo; + + IF_LOUD(DbgPrint("\n\nOpened %ws\n", tcpLinkageKeyName.Buffer);) + + status = ZwQueryValueKey(keyHandle, &bindValueName, + KeyValuePartialInformation, &valueInfo, + sizeof(valueInfo), &resultLength); + if (!NT_SUCCESS(status) && (status != STATUS_BUFFER_OVERFLOW)) { + IF_LOUD(DbgPrint("\n\nStatus of %x querying key value for size\n", status);) + } + else { // We know how big it needs to be. + ULONG valueInfoLength = valueInfo.DataLength + FIELD_OFFSET(KEY_VALUE_PARTIAL_INFORMATION, Data[0]); + PKEY_VALUE_PARTIAL_INFORMATION valueInfoP = + (PKEY_VALUE_PARTIAL_INFORMATION)ExAllocatePoolWithTag(PagedPool, valueInfoLength, '2PWA'); + + if (valueInfoP != NULL) { + status = ZwQueryValueKey(keyHandle, &bindValueName, + KeyValuePartialInformation, + valueInfoP, + valueInfoLength, &resultLength); + + if (!NT_SUCCESS(status)) { + IF_LOUD(DbgPrint("\n\nStatus of %x querying key value\n", status);) + } + else if (valueInfoLength != resultLength) { + IF_LOUD(DbgPrint("\n\nQuerying key value result len = %u " + "but previous len = %u\n", + resultLength, valueInfoLength);) + } + else if (valueInfoP->Type != REG_MULTI_SZ) { + IF_LOUD(DbgPrint("\n\nTcpip bind value not REG_MULTI_SZ but %u\n", + valueInfoP->Type);) + } + else { // It's OK +#if DBG + ULONG i; + WCHAR* dataP = (WCHAR*)(&valueInfoP->Data[0]); + IF_LOUD(DbgPrint("\n\nBind value:\n");) + for (i = 0; *dataP != UNICODE_NULL; i++) { + UNICODE_STRING macName; + RtlInitUnicodeString(&macName, dataP); + IF_LOUD(DbgPrint("\n\nMac %u = %ws\n", i, macName.Buffer);) + dataP += + (macName.Length + sizeof(UNICODE_NULL)) / sizeof(WCHAR); + } +#endif // DBG + result = valueInfoP; + } + } + } + ZwClose(keyHandle); + } + return result; +} + +//------------------------------------------------------------------- + +BOOLEAN createDevice(IN OUT PDRIVER_OBJECT adriverObjectP, + IN PUNICODE_STRING amacNameP, NDIS_HANDLE aProtoHandle) +{ + NTSTATUS status; + PDEVICE_OBJECT devObjP; + UNICODE_STRING deviceName; + UNICODE_STRING deviceSymLink; + + IF_LOUD(DbgPrint("\n\ncreateDevice for MAC %ws\n", amacNameP->Buffer);); + if (RtlCompareMemory(amacNameP->Buffer, devicePrefix.Buffer, + devicePrefix.Length) < devicePrefix.Length) + { + return FALSE; + } + + deviceName.Length = 0; + deviceName.MaximumLength = (USHORT)(amacNameP->Length + NPF_Prefix.Length + sizeof(UNICODE_NULL)); + deviceName.Buffer = ExAllocatePoolWithTag(PagedPool, deviceName.MaximumLength, '3PWA'); + + if (deviceName.Buffer == NULL) + return FALSE; + + deviceSymLink.Length = 0; + deviceSymLink.MaximumLength =(USHORT)(amacNameP->Length-devicePrefix.Length + + symbolicLinkPrefix.Length + + NPF_Prefix.Length + + sizeof(UNICODE_NULL)); + + deviceSymLink.Buffer = ExAllocatePoolWithTag(NonPagedPool, deviceSymLink.MaximumLength, '3PWA'); + + if (deviceSymLink.Buffer == NULL) + { + ExFreePool(deviceName.Buffer); + return FALSE; + } + + RtlAppendUnicodeStringToString(&deviceName, &devicePrefix); + RtlAppendUnicodeStringToString(&deviceName, &NPF_Prefix); + RtlAppendUnicodeToString(&deviceName, amacNameP->Buffer + + devicePrefix.Length / sizeof(WCHAR)); + + RtlAppendUnicodeStringToString(&deviceSymLink, &symbolicLinkPrefix); + RtlAppendUnicodeStringToString(&deviceSymLink, &NPF_Prefix); + RtlAppendUnicodeToString(&deviceSymLink, amacNameP->Buffer + + devicePrefix.Length / sizeof(WCHAR)); + + IF_LOUD(DbgPrint("Creating device name: %ws\n", deviceName.Buffer);) + + status = IoCreateDevice(adriverObjectP, + sizeof(DEVICE_EXTENSION), + &deviceName, + FILE_DEVICE_TRANSPORT, + 0, + FALSE, + &devObjP); + + if (NT_SUCCESS(status)) + { + PDEVICE_EXTENSION devExtP = (PDEVICE_EXTENSION)devObjP->DeviceExtension; + + IF_LOUD(DbgPrint("Device created successfully\n");); + + devObjP->Flags |= DO_DIRECT_IO; + RtlInitUnicodeString(&devExtP->AdapterName,amacNameP->Buffer); + devExtP->NdisProtocolHandle=aProtoHandle; + + IF_LOUD(DbgPrint("Trying to create SymLink %ws\n",deviceSymLink.Buffer);); + + if (IoCreateSymbolicLink(&deviceSymLink,&deviceName) != STATUS_SUCCESS) + { + IF_LOUD(DbgPrint("\n\nError creating SymLink %ws\nn", deviceSymLink.Buffer);); + + ExFreePool(deviceName.Buffer); + ExFreePool(deviceSymLink.Buffer); + + devExtP->ExportString = NULL; + + return FALSE; + } + + IF_LOUD(DbgPrint("SymLink %ws successfully created.\n\n", deviceSymLink.Buffer);); + + devExtP->ExportString = deviceSymLink.Buffer; + + ExFreePool(deviceName.Buffer); + + return TRUE; + } + + else + { + IF_LOUD(DbgPrint("\n\nIoCreateDevice status = %x\n", status);); + + ExFreePool(deviceName.Buffer); + ExFreePool(deviceSymLink.Buffer); + + return FALSE; + } +} +//------------------------------------------------------------------- + +VOID NPF_Unload(IN PDRIVER_OBJECT DriverObject) +{ + PDEVICE_OBJECT DeviceObject; + PDEVICE_OBJECT OldDeviceObject; + PDEVICE_EXTENSION DeviceExtension; + + NDIS_HANDLE NdisProtocolHandle = NULL; + NDIS_STATUS Status; + + NDIS_STRING SymLink; + + IF_LOUD(DbgPrint("NPF: Unload\n");); + + DeviceObject = DriverObject->DeviceObject; + + while (DeviceObject != NULL) { + OldDeviceObject = DeviceObject; + + DeviceObject = DeviceObject->NextDevice; + + DeviceExtension = OldDeviceObject->DeviceExtension; + + NdisProtocolHandle=DeviceExtension->NdisProtocolHandle; + + IF_LOUD(DbgPrint("Deleting Adapter %ws, Protocol Handle=%x, Device Obj=%x (%x)\n", + DeviceExtension->AdapterName.Buffer, + NdisProtocolHandle, + DeviceObject, + OldDeviceObject);); + + if (DeviceExtension->ExportString) + { + RtlInitUnicodeString(&SymLink , DeviceExtension->ExportString); + + IF_LOUD(DbgPrint("Deleting SymLink at %p\n", SymLink.Buffer);); + + IoDeleteSymbolicLink(&SymLink); + ExFreePool(DeviceExtension->ExportString); + } + + IoDeleteDevice(OldDeviceObject); + } + + NdisDeregisterProtocol( + &Status, + NdisProtocolHandle + ); + + // Free the adapters names + ExFreePool( bindP ); +} + +#define SET_FAILURE_BUFFER_SMALL() do{\ + Information = 0; \ + Status = STATUS_BUFFER_TOO_SMALL; \ +} while(FALSE) + +#define SET_RESULT_SUCCESS(__a__) do{\ + Information = __a__; \ + Status = STATUS_SUCCESS; \ +} while(FALSE) + +#define SET_FAILURE_INVALID_REQUEST() do{\ + Information = 0; \ + Status = STATUS_INVALID_DEVICE_REQUEST; \ +} while(FALSE) + +#define SET_FAILURE_UNSUCCESSFUL() do{\ + Information = 0; \ + Status = STATUS_UNSUCCESSFUL; \ +} while(FALSE) + +#define SET_FAILURE_NOMEM() do{\ + Information = 0; \ + Status = STATUS_INSUFFICIENT_RESOURCES; \ +} while(FALSE) + + +//------------------------------------------------------------------- + +NTSTATUS NPF_IoControl(IN PDEVICE_OBJECT DeviceObject,IN PIRP Irp) +{ + POPEN_INSTANCE Open; + PIO_STACK_LOCATION IrpSp; + PLIST_ENTRY RequestListEntry; + PINTERNAL_REQUEST pRequest; + ULONG FunctionCode; + NDIS_STATUS Status; + UINT i; + PUCHAR tpointer; + ULONG dim,timeout; + PUCHAR prog; + PPACKET_OID_DATA OidData; + ULONG mode; +// PWSTR DumpNameBuff; + PUCHAR TmpBPFProgram; + INT WriteRes; + BOOLEAN SyncWrite = FALSE; +// struct bpf_insn *initprogram; + ULONG insns; + ULONG cnt; + BOOLEAN IsExtendedFilter=FALSE; + + BOOLEAN Flag; + PUINT pStats; + ULONG Information = 0; + + BOOLEAN check_ok; + + IF_LOUD(DbgPrint("NPF: IoControl\n");) + + IrpSp = IoGetCurrentIrpStackLocation(Irp); + FunctionCode=IrpSp->Parameters.DeviceIoControl.IoControlCode; + Open=IrpSp->FileObject->FsContext; + + Irp->IoStatus.Status = STATUS_SUCCESS; + + IF_LOUD(DbgPrint("NPF: Function code is %08lx buff size=%08lx %08lx\n",FunctionCode,IrpSp->Parameters.DeviceIoControl.InputBufferLength,IrpSp->Parameters.DeviceIoControl.OutputBufferLength);) + + switch (FunctionCode){ + + case BIOCGSTATS: //function to get the capture stats + + if(IrpSp->Parameters.DeviceIoControl.OutputBufferLength < 4*sizeof(UINT)){ + EXIT_FAILURE(0); + } + + check_ok = TRUE; + __try + { + ProbeForWrite(Irp->UserBuffer, IrpSp->Parameters.DeviceIoControl.OutputBufferLength, 1); + } + __except (EXCEPTION_EXECUTE_HANDLER) + { + check_ok = FALSE; + } + + if (check_ok == FALSE) + { + EXIT_FAILURE(0); + } + else + { + pStats = (PUINT)(Irp->UserBuffer); + + pStats[3] = 0; + pStats[0] = 0; + pStats[1] = 0; + pStats[2] = 0; // Not yet supported + + for(i = 0 ; i < NCpu ; i++) + { + + pStats[3] += Open->CpuData[i].Accepted; + pStats[0] += Open->CpuData[i].Received; + pStats[1] += Open->CpuData[i].Dropped; + pStats[2] += 0; // Not yet supported + } + EXIT_SUCCESS(4*sizeof(UINT)); + } + + break; + + case BIOCGEVNAME: //function to get the name of the event associated with the current instance + + if(IrpSp->Parameters.DeviceIoControl.OutputBufferLength<26){ + EXIT_FAILURE(0); + } + + check_ok = TRUE; + __try + { + ProbeForWrite(Irp->UserBuffer, IrpSp->Parameters.DeviceIoControl.OutputBufferLength, 1); + } + __except (EXCEPTION_EXECUTE_HANDLER) + { + check_ok = FALSE; + } + + if (check_ok == FALSE) + { + EXIT_FAILURE(0); + } + else + { + RtlCopyMemory(Irp->UserBuffer,(Open->ReadEventName.Buffer)+18,26); + + EXIT_SUCCESS(26); + } + + break; + + case BIOCSENDPACKETSSYNC: + + SyncWrite = TRUE; + + case BIOCSENDPACKETSNOSYNC: + + NdisAcquireSpinLock(&Open->WriteLock); + if(Open->WriteInProgress) + { + // Another write operation is currently in progress + EXIT_FAILURE(0); + } + else + { + Open->WriteInProgress = TRUE; + } + NdisReleaseSpinLock(&Open->WriteLock); + + WriteRes = NPF_BufferedWrite(Irp, + (PUCHAR)Irp->AssociatedIrp.SystemBuffer, + IrpSp->Parameters.DeviceIoControl.InputBufferLength, + SyncWrite); + + NdisAcquireSpinLock(&Open->WriteLock); + Open->WriteInProgress = FALSE; + NdisReleaseSpinLock(&Open->WriteLock); + + if( WriteRes != -1) + { + EXIT_SUCCESS(WriteRes); + } + + EXIT_FAILURE(WriteRes); + + break; + + case BIOCSETF: + + Open->SkipProcessing = 1; + + do + { + Flag = FALSE; + for(i = 0; i < NCpu ; i++) + if (Open->CpuData[i].Processing == 1) + Flag = TRUE; + } + while(Flag); //BUSY FORM WAITING... + + + // Free the previous buffer if it was present + if(Open->bpfprogram != NULL){ + TmpBPFProgram = Open->bpfprogram; + Open->bpfprogram = NULL; + ExFreePool(TmpBPFProgram); + } + +// +// Jitted filters are supported on x86 (32bit) only +// +#ifdef __NPF_x86__ + if (Open->Filter != NULL) + { + JIT_BPF_Filter *OldFilter=Open->Filter; + Open->Filter=NULL; + BPF_Destroy_JIT_Filter(OldFilter); + } +#endif // __NPF_x86__ + + // Get the pointer to the new program + prog=(PUCHAR)Irp->AssociatedIrp.SystemBuffer; + + if(prog==NULL) + { + Open->SkipProcessing = 0; + EXIT_FAILURE(0); + } + + insns = (IrpSp->Parameters.DeviceIoControl.InputBufferLength)/sizeof(struct bpf_insn); + + //count the number of operative instructions + for (cnt=0;(cntmem_ex),&(Open->tme), &G_Start_Time)!=INIT_OK) + { + + IF_LOUD(DbgPrint("Error initializing NPF machine (bpf_filter_init)\n");) + + Open->SkipProcessing = 0; + EXIT_FAILURE(0); + } + } +#else //x86-64 and IA64 + if ( cnt != insns) + { + IF_LOUD(DbgPrint("Error installing the BPF filter. The filter contains TME extensions," + " not supported on 64bit platforms.\n");) + + Open->SkipProcessing = 0; + EXIT_FAILURE(0); + } + + +#endif + + //the NPF processor has been initialized, we have to validate the operative instructions + insns = cnt; + + //NOTE: the validation code checks for TME instructions, and fails if a TME instruction is + //encountered on 64 bit machines + if(bpf_validate((struct bpf_insn*)prog,cnt,Open->mem_ex.size)==0) + { + IF_LOUD(DbgPrint("Error validating program");) + //FIXME: the machine has been initialized(?), but the operative code is wrong. + //we have to reset the machine! + //something like: reallocate the mem_ex, and reset the tme_core + Open->SkipProcessing = 0; + EXIT_FAILURE(0); + } + + // Allocate the memory to contain the new filter program + // We could need the original BPF binary if we are forced to use bpf_filter_with_2_buffers() + TmpBPFProgram = (PUCHAR)ExAllocatePoolWithTag(NonPagedPool, cnt*sizeof(struct bpf_insn), '4PWA'); + if (TmpBPFProgram == NULL) + { + IF_LOUD(DbgPrint("Error - No memory for filter");) + // no memory + Open->SkipProcessing = 0; + EXIT_FAILURE(0); + } + + //copy the program in the new buffer + RtlCopyMemory(TmpBPFProgram,prog,cnt*sizeof(struct bpf_insn)); + Open->bpfprogram=TmpBPFProgram; + + // + // At the moment the JIT compiler works on x86 (32 bit) only + // +#ifdef __NPF_x86__ + // Create the new JIT filter function + if(!IsExtendedFilter) + if((Open->Filter=BPF_jitter((struct bpf_insn*)Open->bpfprogram,cnt)) == NULL) + { + IF_LOUD(DbgPrint("Error jittering filter");) + Open->SkipProcessing = 0; + EXIT_FAILURE(0); + } +#endif + + //return + for (i = 0 ; i < NCpu ; i++) + { + Open->CpuData[i].C=0; + Open->CpuData[i].P=0; + Open->CpuData[i].Free = Open->Size; + Open->CpuData[i].Accepted=0; + Open->CpuData[i].Dropped=0; + Open->CpuData[i].Received = 0; + } + + Open->ReaderSN=0; + Open->WriterSN=0; + + Open->SkipProcessing = 0; + EXIT_SUCCESS(IrpSp->Parameters.DeviceIoControl.InputBufferLength); + + break; + + case BIOCSMODE: //set the capture mode + + if(IrpSp->Parameters.DeviceIoControl.InputBufferLength < sizeof(ULONG)) + { + EXIT_FAILURE(0); + } + + mode=*((PULONG)Irp->AssociatedIrp.SystemBuffer); + +///////kernel dump does not work at the moment////////////////////////////////////////// + if (mode & MODE_DUMP) + { + EXIT_FAILURE(0); + } +///////kernel dump does not work at the moment////////////////////////////////////////// + + if(mode == MODE_CAPT) + { + Open->mode = MODE_CAPT; + + EXIT_SUCCESS(0); + } + else if (mode == MODE_MON) + { +// +// The MONITOR_MODE (aka TME extensions) is not supported on +// 64 bit architectures +// +#ifdef __NPF_x86__ + Open->mode = MODE_MON; + EXIT_SUCCESS(0); +#else // _NPF_x86__ + EXIT_FAILURE(0); +#endif // __NPF_x86__ + + } + else{ + if(mode & MODE_STAT){ + Open->mode = MODE_STAT; + NdisAcquireSpinLock(&Open->CountersLock); + Open->Nbytes.QuadPart = 0; + Open->Npackets.QuadPart = 0; + NdisReleaseSpinLock(&Open->CountersLock); + + if(Open->TimeOut.QuadPart==0)Open->TimeOut.QuadPart = -10000000; + + } + + if(mode & MODE_DUMP){ + + Open->mode |= MODE_DUMP; +// Open->MinToCopy=(Open->BufSize<2000000)?Open->BufSize/2:1000000; + + } + EXIT_SUCCESS(0); + } + + EXIT_FAILURE(0); + + break; + + case BIOCSETDUMPFILENAME: + +///////kernel dump does not work at the moment////////////////////////////////////////// + EXIT_FAILURE(0); +///////kernel dump does not work at the moment////////////////////////////////////////// + +// +// Remove the following #if 0 to enable the kernel dump again +// +#if 0 + if(Open->mode & MODE_DUMP) + { + + // Close current dump file + if(Open->DumpFileHandle != NULL) + { + NPF_CloseDumpFile(Open); + Open->DumpFileHandle = NULL; + } + + if(IrpSp->Parameters.DeviceIoControl.InputBufferLength == 0){ + EXIT_FAILURE(0); + } + + // Allocate the buffer that will contain the string + DumpNameBuff=ExAllocatePoolWithTag(NonPagedPool, IrpSp->Parameters.DeviceIoControl.InputBufferLength, '5PWA'); + if(DumpNameBuff==NULL || Open->DumpFileName.Buffer!=NULL){ + IF_LOUD(DbgPrint("NPF: unable to allocate the dump filename: not enough memory or name already set\n");) + EXIT_FAILURE(0); + } + + // Copy the buffer + RtlCopyBytes((PVOID)DumpNameBuff, + Irp->AssociatedIrp.SystemBuffer, + IrpSp->Parameters.DeviceIoControl.InputBufferLength); + + // Force a \0 at the end of the filename to avoid that malformed strings cause RtlInitUnicodeString to crash the system + ((PSHORT)DumpNameBuff)[IrpSp->Parameters.DeviceIoControl.InputBufferLength/2-1]=0; + + // Create the unicode string + RtlInitUnicodeString(&Open->DumpFileName, DumpNameBuff); + + IF_LOUD(DbgPrint("NPF: dump file name set to %ws, len=%d\n", + Open->DumpFileName.Buffer, + IrpSp->Parameters.DeviceIoControl.InputBufferLength);) + + // Try to create the file + if ( NT_SUCCESS( NPF_OpenDumpFile(Open,&Open->DumpFileName,FALSE)) && + NT_SUCCESS( NPF_StartDump(Open))) + { + EXIT_SUCCESS(0); + } + } + + EXIT_FAILURE(0); + + break; +#endif // #if 0 + case BIOCSETDUMPLIMITS: + +///////kernel dump does not work at the moment////////////////////////////////////////// + EXIT_FAILURE(0); +///////kernel dump does not work at the moment////////////////////////////////////////// + +// +// Remove the following #if 0 to enable the kernel dump again +// +#if 0 + if (IrpSp->Parameters.DeviceIoControl.InputBufferLength < 2*sizeof(ULONG)) + { + EXIT_FAILURE(0); + } + + Open->MaxDumpBytes = *(PULONG)Irp->AssociatedIrp.SystemBuffer; + Open->MaxDumpPacks = *((PULONG)Irp->AssociatedIrp.SystemBuffer + 1); + + IF_LOUD(DbgPrint("NPF: Set dump limits to %u bytes, %u packs\n", Open->MaxDumpBytes, Open->MaxDumpPacks);) + + EXIT_SUCCESS(0); + + break; + +#endif // #if 0 + + case BIOCISDUMPENDED: + +///////kernel dump does not work at the moment////////////////////////////////////////// + EXIT_FAILURE(0); +///////kernel dump does not work at the moment////////////////////////////////////////// + +// +// Remove the following #if 0 to enable the kernel dump again +// +#if 0 + if(IrpSp->Parameters.DeviceIoControl.OutputBufferLength < sizeof(UINT)) + { + EXIT_FAILURE(0); + } + + *((UINT*)Irp->UserBuffer) = (Open->DumpLimitReached)?1:0; + + EXIT_SUCCESS(4); + + break; + +#endif // #if 0 + + case BIOCSETBUFFERSIZE: + + + if(IrpSp->Parameters.DeviceIoControl.InputBufferLength < sizeof(ULONG)) + { + EXIT_FAILURE(0); + } + + // Get the number of bytes to allocate + dim = *((PULONG)Irp->AssociatedIrp.SystemBuffer); + + Open->SkipProcessing = 1; + + do + { + Flag = FALSE; + for(i=0;iCpuData[i].Processing == 1) + Flag = TRUE; + } + while(Flag); //BUSY FORM WAITING... + + if (dim / NCpu < sizeof(struct PacketHeader)) + dim = 0; + else + { + tpointer = ExAllocatePoolWithTag(NonPagedPool, dim, '6PWA'); + if (tpointer==NULL) + { + // no memory + Open->SkipProcessing = 0; + EXIT_FAILURE(0); + } + } + + if (Open->CpuData[0].Buffer != NULL) + ExFreePool(Open->CpuData[0].Buffer); + + for (i = 0 ; i < NCpu ; i++) + { + if (dim > 0) + Open->CpuData[i].Buffer=(PUCHAR)tpointer + (dim/NCpu)*i; + else + Open->CpuData[i].Buffer = NULL; + Open->CpuData[i].Free = dim/NCpu; + Open->CpuData[i].P = 0; + Open->CpuData[i].C = 0; + Open->CpuData[i].Accepted = 0; + Open->CpuData[i].Dropped = 0; + Open->CpuData[i].Received = 0; + } + + Open->ReaderSN=0; + Open->WriterSN=0; + + Open->Size = dim/NCpu; + + Open->SkipProcessing = 0; + EXIT_SUCCESS(dim); + + break; + + case BIOCSRTIMEOUT: //set the timeout on the read calls + + + if(IrpSp->Parameters.DeviceIoControl.InputBufferLength < sizeof(ULONG)) + { + EXIT_FAILURE(0); + } + + timeout = *((PULONG)Irp->AssociatedIrp.SystemBuffer); + if(timeout == (ULONG)-1) + Open->TimeOut.QuadPart=(LONGLONG)IMMEDIATE; + else + { + Open->TimeOut.QuadPart = (LONGLONG)timeout; + Open->TimeOut.QuadPart *= 10000; + Open->TimeOut.QuadPart = -Open->TimeOut.QuadPart; + } + + IF_LOUD(DbgPrint("NPF: read timeout set to %d:%d\n",Open->TimeOut.HighPart,Open->TimeOut.LowPart);) + EXIT_SUCCESS(timeout); + + break; + + case BIOCSWRITEREP: //set the writes repetition number + + if(IrpSp->Parameters.DeviceIoControl.InputBufferLength < sizeof(ULONG)) + { + EXIT_FAILURE(0); + } + + Open->Nwrites = *((PULONG)Irp->AssociatedIrp.SystemBuffer); + + EXIT_SUCCESS(Open->Nwrites); + + break; + + case BIOCSMINTOCOPY: //set the minimum buffer's size to copy to the application + + if(IrpSp->Parameters.DeviceIoControl.InputBufferLength < sizeof(ULONG)) + { + EXIT_FAILURE(0); + } + + Open->MinToCopy = (*((PULONG)Irp->AssociatedIrp.SystemBuffer))/NCpu; //An hack to make the NCPU-buffers behave like a larger one + + EXIT_SUCCESS(Open->MinToCopy); + + break; + + case IOCTL_PROTOCOL_RESET: + + IF_LOUD(DbgPrint("NPF: IoControl - Reset request\n");) + + IoMarkIrpPending(Irp); + Irp->IoStatus.Status = STATUS_SUCCESS; + + ExInterlockedInsertTailList(&Open->ResetIrpList,&Irp->Tail.Overlay.ListEntry,&Open->RequestSpinLock); + NdisReset(&Status,Open->AdapterHandle); + if (Status != NDIS_STATUS_PENDING) + { + IF_LOUD(DbgPrint("NPF: IoControl - ResetComplete being called\n");) + NPF_ResetComplete(Open,Status); + } + + break; + + + case BIOCSETOID: + case BIOCQUERYOID: + + // Extract a request from the list of free ones + RequestListEntry=ExInterlockedRemoveHeadList(&Open->RequestList,&Open->RequestSpinLock); + if (RequestListEntry == NULL) + { + EXIT_FAILURE(0); + } + + pRequest=CONTAINING_RECORD(RequestListEntry,INTERNAL_REQUEST,ListElement); + pRequest->Irp = Irp; + pRequest->Internal = FALSE; + + + // + // See if it is an Ndis request + // + OidData=Irp->AssociatedIrp.SystemBuffer; + + if (((FunctionCode == BIOCSETOID) || (FunctionCode == BIOCQUERYOID)) + && + (IrpSp->Parameters.DeviceIoControl.InputBufferLength == IrpSp->Parameters.DeviceIoControl.OutputBufferLength) + && + (IrpSp->Parameters.DeviceIoControl.InputBufferLength >= sizeof(PACKET_OID_DATA)) + && + (IrpSp->Parameters.DeviceIoControl.InputBufferLength >= sizeof(PACKET_OID_DATA)-1+OidData->Length)) { + + IF_LOUD(DbgPrint("NPF: IoControl: Request: Oid=%08lx, Length=%08lx\n",OidData->Oid,OidData->Length);) + + // + // The buffer is valid + // + if (FunctionCode == BIOCSETOID){ + + pRequest->Request.RequestType=NdisRequestSetInformation; + pRequest->Request.DATA.SET_INFORMATION.Oid=OidData->Oid; + + pRequest->Request.DATA.SET_INFORMATION.InformationBuffer=OidData->Data; + pRequest->Request.DATA.SET_INFORMATION.InformationBufferLength=OidData->Length; + + + } + else{ + + pRequest->Request.RequestType=NdisRequestQueryInformation; + pRequest->Request.DATA.QUERY_INFORMATION.Oid=OidData->Oid; + + pRequest->Request.DATA.QUERY_INFORMATION.InformationBuffer=OidData->Data; + pRequest->Request.DATA.QUERY_INFORMATION.InformationBufferLength=OidData->Length; + + } + + NdisResetEvent(&Open->IOEvent); + // + // submit the request + // + NdisRequest( + &Status, + Open->AdapterHandle, + &pRequest->Request + ); + + } else { + // + // buffer too small + // + Status=NDIS_STATUS_FAILURE; + pRequest->Request.DATA.SET_INFORMATION.BytesRead=0; + pRequest->Request.DATA.QUERY_INFORMATION.BytesWritten=0; + + } + + if (Status != NDIS_STATUS_PENDING) { + IF_LOUD(DbgPrint("NPF: Calling RequestCompleteHandler\n");) + + NPF_RequestComplete(Open, &pRequest->Request, Status); + return Status; + + } + + NdisWaitEvent(&Open->IOEvent, 5000); + + return(Open->IOStatus); + + break; + + case BIOCISETLOBBEH: + + if (IrpSp->Parameters.DeviceIoControl.InputBufferLength < sizeof(INT)) + { + SET_FAILURE_BUFFER_SMALL(); + break; + } + +#ifdef __NPF_NT4__ + + // NT4 doesn't support loopback inhibition / activation + SET_FAILURE_INVALID_REQUEST(); + break; + +#else //not __NPF_NT4__ + // + // win2000/xp/2003/vista + // + if(*(PINT)Irp->AssociatedIrp.SystemBuffer == 1) + { + Open->SkipSentPackets = TRUE; + + // + // Reset the capture buffers, since they could contain loopbacked packets + // + +// NPF_ResetBufferContents(Open); + + SET_RESULT_SUCCESS(0); + break; + + } + else + if(*(PINT)Irp->AssociatedIrp.SystemBuffer == 2) + { + Open->SkipSentPackets = FALSE; + + SET_RESULT_SUCCESS(0); + break; + } + else + { + // Unknown operation + SET_FAILURE_INVALID_REQUEST(); + break; + } + +#endif // !__NPF_NT4__ + break; + + + + default: + + EXIT_FAILURE(0); + } + + if (FunctionCode == BIOCISETLOBBEH) + { + Irp->IoStatus.Information = Information; + Irp->IoStatus.Status = Status; + IoCompleteRequest(Irp, IO_NO_INCREMENT); + } + + return Status; +} + +//------------------------------------------------------------------- + +VOID +NPF_RequestComplete( + IN NDIS_HANDLE ProtocolBindingContext, + IN PNDIS_REQUEST NdisRequest, + IN NDIS_STATUS Status + ) + +{ + POPEN_INSTANCE Open; + PIO_STACK_LOCATION IrpSp; + PIRP Irp; + PINTERNAL_REQUEST pRequest; + UINT FunctionCode; +// KIRQL OldIrq; + + PPACKET_OID_DATA OidData; + + IF_LOUD(DbgPrint("NPF: RequestComplete\n");) + + Open= (POPEN_INSTANCE)ProtocolBindingContext; + + pRequest=CONTAINING_RECORD(NdisRequest,INTERNAL_REQUEST,Request); + Irp=pRequest->Irp; + + if(pRequest->Internal == TRUE){ + + // Put the request in the list of the free ones + ExInterlockedInsertTailList(&Open->RequestList, &pRequest->ListElement, &Open->RequestSpinLock); + + if(Status != NDIS_STATUS_SUCCESS) + Open->MaxFrameSize = 1600; // Assume Ethernet + + // We always return success, because the adapter has been already opened + Irp->IoStatus.Status = NDIS_STATUS_SUCCESS; + Irp->IoStatus.Information = 0; + IoCompleteRequest(Irp, IO_NO_INCREMENT); + return; + } + + IrpSp = IoGetCurrentIrpStackLocation(Irp); + + FunctionCode=IrpSp->Parameters.DeviceIoControl.IoControlCode; + + OidData=Irp->AssociatedIrp.SystemBuffer; + + if (FunctionCode == BIOCSETOID) { + + OidData->Length=pRequest->Request.DATA.SET_INFORMATION.BytesRead; + + } else { + + if (FunctionCode == BIOCQUERYOID) { + + OidData->Length=pRequest->Request.DATA.QUERY_INFORMATION.BytesWritten; + + IF_LOUD(DbgPrint("RequestComplete: BytesWritten=%d\n",pRequest->Request.DATA.QUERY_INFORMATION.BytesWritten);) + } + + } + + Irp->IoStatus.Information=IrpSp->Parameters.DeviceIoControl.InputBufferLength; + + IF_LOUD(DbgPrint("RequestComplete: BytesReturned=%d\n",IrpSp->Parameters.DeviceIoControl.InputBufferLength);) + + ExInterlockedInsertTailList( + &Open->RequestList, + &pRequest->ListElement, + &Open->RequestSpinLock); + + Irp->IoStatus.Status = Status; + + Open->IOStatus = Status; + + IoCompleteRequest(Irp, IO_NO_INCREMENT); + + // Unlock the caller + NdisSetEvent(&Open->IOEvent); + + return; + + +} + +//------------------------------------------------------------------- + +VOID +NPF_Status( + IN NDIS_HANDLE ProtocolBindingContext, + IN NDIS_STATUS Status, + IN PVOID StatusBuffer, + IN UINT StatusBufferSize + ) + +{ + + IF_LOUD(DbgPrint("NPF: Status Indication\n");) + + return; + +} + +//------------------------------------------------------------------- + +VOID +NPF_StatusComplete( + IN NDIS_HANDLE ProtocolBindingContext + ) + +{ + + IF_LOUD(DbgPrint("NPF: StatusIndicationComplete\n");) + + return; + +} + +//------------------------------------------------------------------- + +NTSTATUS +NPF_ReadRegistry( + IN PWSTR *MacDriverName, + IN PWSTR *PacketDriverName, + IN PUNICODE_STRING RegistryPath + ) + +{ + NTSTATUS Status; + + RTL_QUERY_REGISTRY_TABLE ParamTable[4]; + + PWSTR Bind = L"Bind"; + PWSTR Export = L"Export"; + PWSTR Parameters = L"Parameters"; + PWSTR Linkage = L"Linkage"; + + PWCHAR Path; + + + + Path=ExAllocatePoolWithTag(PagedPool, RegistryPath->Length+sizeof(WCHAR), '7PWA'); + + if (Path == NULL) { + return STATUS_INSUFFICIENT_RESOURCES; + } + + RtlZeroMemory( + Path, + RegistryPath->Length+sizeof(WCHAR) + ); + + RtlCopyMemory( + Path, + RegistryPath->Buffer, + RegistryPath->Length + ); + + IF_LOUD(DbgPrint("NPF: Reg path is %ws\n",RegistryPath->Buffer);) + + RtlZeroMemory( + ParamTable, + sizeof(ParamTable) + ); + + + + // + // change to the linkage key + // + + ParamTable[0].QueryRoutine = NULL; + ParamTable[0].Flags = RTL_QUERY_REGISTRY_SUBKEY; + ParamTable[0].Name = Linkage; + + + // + // Get the name of the mac driver we should bind to + // + + ParamTable[1].QueryRoutine = NPF_QueryRegistryRoutine; + ParamTable[1].Flags = RTL_QUERY_REGISTRY_REQUIRED | + RTL_QUERY_REGISTRY_NOEXPAND; + + ParamTable[1].Name = Bind; + ParamTable[1].EntryContext = (PVOID)MacDriverName; + ParamTable[1].DefaultType = REG_MULTI_SZ; + + // + // Get the name that we should use for the driver object + // + + ParamTable[2].QueryRoutine = NPF_QueryRegistryRoutine; + ParamTable[2].Flags = RTL_QUERY_REGISTRY_REQUIRED | + RTL_QUERY_REGISTRY_NOEXPAND; + + ParamTable[2].Name = Export; + ParamTable[2].EntryContext = (PVOID)PacketDriverName; + ParamTable[2].DefaultType = REG_MULTI_SZ; + + + Status=RtlQueryRegistryValues( + RTL_REGISTRY_ABSOLUTE, + Path, + ParamTable, + NULL, + NULL + ); + + + ExFreePool(Path); + + return Status; +} + +//------------------------------------------------------------------- + +NTSTATUS +NPF_QueryRegistryRoutine( + IN PWSTR ValueName, + IN ULONG ValueType, + IN PVOID ValueData, + IN ULONG ValueLength, + IN PVOID Context, + IN PVOID EntryContext + ) + +{ + + PUCHAR Buffer; + + IF_LOUD(DbgPrint("Perf: QueryRegistryRoutine\n");) + + if (ValueType != REG_MULTI_SZ) { + + return STATUS_OBJECT_NAME_NOT_FOUND; + + } + + Buffer=ExAllocatePoolWithTag(NonPagedPool, ValueLength, '8PWA'); + + if (Buffer==NULL) { + + return STATUS_INSUFFICIENT_RESOURCES; + + } + + RtlCopyMemory( + Buffer, + ValueData, + ValueLength + ); + + *((PUCHAR *)EntryContext)=Buffer; + + return STATUS_SUCCESS; + +} diff --git a/src/See/Packet.h b/src/See/Packet.h index 920f431a..306c21a3 100644 --- a/src/See/Packet.h +++ b/src/See/Packet.h @@ -1,954 +1,954 @@ -/* - * Copyright (c) 1999 - 2005 NetGroup, Politecnico di Torino (Italy) - * Copyright (c) 2005 CACE Technologies, Davis (California) - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the Politecnico di Torino, CACE Technologies - * nor the names of its contributors may be used to endorse or promote - * products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - */ - -/** @ingroup NPF - * @{ - */ - -/** @defgroup NPF_include NPF structures and definitions - * @{ - */ - -#ifndef __PACKET_INCLUDE______ -#define __PACKET_INCLUDE______ - -#ifdef __NPF_x86__ -#define NTKERNEL ///< Forces the compilation of the jitter with kernel calls -#include "jitter.h" -#endif - - -#include "win_bpf.h" - -#define MAX_REQUESTS 256 ///< Maximum number of simultaneous IOCTL requests. - -#define Packet_ALIGNMENT sizeof(int) ///< Alignment macro. Defines the alignment size. -#define Packet_WORDALIGN(x) (((x)+(Packet_ALIGNMENT-1))&~(Packet_ALIGNMENT-1)) ///< Alignment macro. Rounds up to the next - ///< even multiple of Packet_ALIGNMENT. -/***************************/ -/* IOCTLs */ -/***************************/ - -/*! - \brief IOCTL code: set kernel buffer size. - - This IOCTL is used to set a new size of the circular buffer associated with an instance of NPF. - When a BIOCSETBUFFERSIZE command is received, the driver frees the old buffer, allocates the new one - and resets all the parameters associated with the buffer in the OPEN_INSTANCE structure. The currently - buffered packets are lost. -*/ -#define BIOCSETBUFFERSIZE 9592 - -/*! - \brief IOCTL code: set packet filtering program. - - This IOCTL sets a new packet filter in the driver. Before allocating any memory for the new filter, the - bpf_validate() function is called to check the correctness of the filter. If this function returns TRUE, - the filter is copied to the driver's memory, its address is stored in the bpfprogram field of the - OPEN_INSTANCE structure associated with current instance of the driver, and the filter will be applied to - every incoming packet. This command also empties the circular buffer used by current instance - to store packets. This is done to avoid the presence in the buffer of packets that do not match the filter. -*/ -#define BIOCSETF 9030 - -/*! - \brief IOCTL code: get the capture stats - - This command returns to the application the number of packets received and the number of packets dropped by - an instance of the driver. -*/ -#define BIOCGSTATS 9031 - -/*! - \brief IOCTL code: set the read timeout - - This command sets the maximum timeout after which a read is released, also if no data packets were received. -*/ -#define BIOCSRTIMEOUT 7416 - -/*! - \brief IOCTL code: set working mode - - This IOCTL can be used to set the working mode of a NPF instance. The new mode, received by the driver in the - buffer associated with the IOCTL command, can be #MODE_CAPT for capture mode (the default), #MODE_STAT for - statistical mode or #MODE_DUMP for dump mode. -*/ -#define BIOCSMODE 7412 - -/*! - \brief IOCTL code: set number of physical repetions of every packet written by the app - - Sets the number of times a single write call must be repeated. This command sets the OPEN_INSTANCE::Nwrites - member, and is used to implement the 'multiple write' feature of the driver. -*/ -#define BIOCSWRITEREP 7413 - -/*! - \brief IOCTL code: set minimum amount of data in the kernel buffer that unlocks a read call - - This command sets the OPEN_INSTANCE::MinToCopy member. -*/ -#define BIOCSMINTOCOPY 7414 - -/*! - \brief IOCTL code: set an OID value - - This IOCTL is used to perform an OID set operation on the NIC driver. -*/ -#define BIOCSETOID 2147483648 - -/*! - \brief IOCTL code: get an OID value - - This IOCTL is used to perform an OID get operation on the NIC driver. -*/ -#define BIOCQUERYOID 2147483652 -#define BIOCISETLOBBEH 7410 -/*! - \brief IOCTL code: set the name of a the file used by kernel dump mode - - This command opens a file whose name is contained in the IOCTL buffer and associates it with current NPf instance. - The dump thread uses it to copy the content of the circular buffer to file. - If a file was already opened, the driver closes it before opening the new one. -*/ -#define BIOCSETDUMPFILENAME 9029 - -/*! - \brief IOCTL code: get the name of the event that the driver signals when some data is present in the buffer - - Command used by the application to retrieve the name of the global event associated with a NPF instance. - The event is signaled by the driver when the kernel buffer contains enough data for a transfer. -*/ -#define BIOCGEVNAME 7415 - -/*! - \brief IOCTL code: Send a buffer containing multiple packets to the network, ignoring the timestamps. - - Command used to send a buffer of packets in a single system call. Every packet in the buffer is preceded by - a sf_pkthdr structure. The timestamps of the packets are ignored, i.e. the packets are sent as fast as - possible. The NPF_BufferedWrite() function is invoked to send the packets. -*/ -#define BIOCSENDPACKETSNOSYNC 9032 - -/*! - \brief IOCTL code: Send a buffer containing multiple packets to the network, considering the timestamps. - - Command used to send a buffer of packets in a single system call. Every packet in the buffer is preceded by - a sf_pkthdr structure. The timestamps of the packets are used to synchronize the write, i.e. the packets - are sent to the network respecting the intervals specified in the sf_pkthdr structure associated with each - packet. NPF_BufferedWrite() function is invoked to send the packets. -*/ -#define BIOCSENDPACKETSSYNC 9033 - -/*! - \brief IOCTL code: Set the dump file limits. - - This IOCTL sets the limits (maximum size and maximum number of packets) of the dump file created when the - driver works in dump mode. -*/ -#define BIOCSETDUMPLIMITS 9034 - -/*! - \brief IOCTL code: Get the status of the kernel dump process. - - This command returns TRUE if the kernel dump is ended, i.e if one of the limits set with BIOCSETDUMPLIMITS - (amount of bytes or number of packets) has been reached. -*/ -#define BIOCISDUMPENDED 7411 - -// Working modes -#define MODE_CAPT 0x0 ///< Capture working mode -#define MODE_STAT 0x1 ///< Statistical working mode -#define MODE_MON 0x2 ///< Kernel monitoring mode -#define MODE_DUMP 0x10 ///< Kernel dump working mode - - -#define IMMEDIATE 1 ///< Immediate timeout. Forces a read call to return immediately. - - -// The following definitions are used to provide compatibility -// of the dump files with the ones of libpcap -#define TCPDUMP_MAGIC 0xa1b2c3d4 ///< Libpcap magic number. Used by programs like tcpdump to recognize a driver's generated dump file. -#define PCAP_VERSION_MAJOR 2 ///< Major libpcap version of the dump file. Used by programs like tcpdump to recognize a driver's generated dump file. -#define PCAP_VERSION_MINOR 4 ///< Minor libpcap version of the dump file. Used by programs like tcpdump to recognize a driver's generated dump file. - -/*! - \brief Header of a libpcap dump file. - - Used when a driver instance is set in dump mode to create a libpcap-compatible file. -*/ -struct packet_file_header -{ - UINT magic; ///< Libpcap magic number - USHORT version_major; ///< Libpcap major version - USHORT version_minor; ///< Libpcap minor version - UINT thiszone; ///< Gmt to local correction - UINT sigfigs; ///< Accuracy of timestamps - UINT snaplen; ///< Length of the max saved portion of each packet - UINT linktype; ///< Data link type (DLT_*). See win_bpf.h for details. -}; - -/*! - \brief Header associated to a packet in the driver's buffer when the driver is in dump mode. - Similar to the bpf_hdr structure, but simpler. -*/ -struct sf_pkthdr { - struct timeval ts; ///< time stamp - UINT caplen; ///< Length of captured portion. The captured portion can be different from - ///< the original packet, because it is possible (with a proper filter) to - ///< instruct the driver to capture only a portion of the packets. - UINT len; ///< Length of the original packet (off wire). -}; - -/*! - \brief Stores an OID request. - - This structure is used by the driver to perform OID query or set operations on the underlying NIC driver. - The OID operations be performed usually only by network drivers, but NPF exports this mechanism to user-level - applications through an IOCTL interface. The driver uses this structure to wrap a NDIS_REQUEST structure. - This allows to handle correctly the callback structure of NdisRequest(), handling multiple requests and - maintaining information about the IRPs to complete. -*/ -typedef struct _INTERNAL_REQUEST { - LIST_ENTRY ListElement; ///< Used to handle lists of requests. - PIRP Irp; ///< Irp that performed the request - BOOLEAN Internal; ///< True if the request is for internal use of npf.sys. False if the request is performed by the user through an IOCTL. - NDIS_REQUEST Request; ///< The structure with the actual request, that will be passed to NdisRequest(). -} INTERNAL_REQUEST, *PINTERNAL_REQUEST; - -/*! - \brief Contains a NDIS packet. - - The driver uses this structure to wrap a NDIS_PACKET structure. - This allows to handle correctly the callback structure of NdisTransferData(), handling multiple requests and - maintaining information about the IRPs to complete. -*/ -typedef struct _PACKET_RESERVED { - LIST_ENTRY ListElement; ///< Used to handle lists of packets. - PIRP Irp; ///< Irp that performed the request - PMDL pMdl; ///< MDL mapping the buffer of the packet. - BOOLEAN FreeBufAfterWrite; ///< True if the memory buffer associated with the packet must be freed - ///< after a call to NdisSend(). - ULONG Cpu; ///< The CPU on which the packet was pulled out of the linked list of free packets -} PACKET_RESERVED, *PPACKET_RESERVED; - -#define RESERVED(_p) ((PPACKET_RESERVED)((_p)->ProtocolReserved)) ///< Macro to obtain a NDIS_PACKET from a PACKET_RESERVED - -/*! - \brief Port device extension. - - Structure containing some data relative to every adapter on which NPF is bound. -*/ -typedef struct _DEVICE_EXTENSION { - NDIS_HANDLE NdisProtocolHandle; ///< NDIS handle of NPF. - NDIS_STRING AdapterName; ///< Name of the adapter. - PWSTR ExportString; ///< Name of the exported device, i.e. name that the applications will use - ///< to open this adapter through WinPcap. -} DEVICE_EXTENSION, *PDEVICE_EXTENSION; - -/*! - \brief Kernel buffer of each CPU. - - Structure containing the kernel buffer (and other CPU related fields) used to capture packets. -*/ -typedef struct __CPU_Private_Data -{ - ULONG P; ///< Zero-based index of the producer in the buffer. It indicates the first free byte to be written. - ULONG C; ///< Zero-based index of the consumer in the buffer. It indicates the first free byte to be read. - ULONG Free; ///< Number of the free bytes in the buffer - PUCHAR Buffer; ///< Pointer to the kernel buffer used to capture packets. - ULONG Accepted; ///< Number of packet that current capture instance accepted, from its opening. A packet - ///< is accepted if it passes the filter and fits in the buffer. Accepted packets are the - ///< ones that reach the application. - ///< This number is related to the particular CPU this structure is referring to. - ULONG Received; ///< Number of packets received by current instance from its opening, i.e. number of - ///< packet received by the network adapter since the beginning of the - ///< capture/monitoring/dump session. - ///< This number is related to the particular CPU this structure is referring to. - ULONG Dropped; ///< Number of packet that current instance had to drop, from its opening. A packet - ///< is dropped if there is no more space to store it in the circular buffer that the - ///< driver associates to current instance. - ///< This number is related to the particular CPU this structure is referring to. - ULONG Processing; ///< Flag. If set to 1, it indicates that the tap is processing a packet on the CPU this structure is referring to. - PMDL TransferMdl1; ///< MDL used to map the portion of the buffer that will contain an incoming packet. - PMDL TransferMdl2; ///< Second MDL used to map the portion of the buffer that will contain an incoming packet. - ULONG NewP; ///< Used by NdisTransferData() (when we call NdisTransferData, p index must be updated only in the TransferDataComplete. -} - CpuPrivateData; - - -/*! - \brief Contains the state of a running instance of the NPF driver. - - This is the most important structure of NPF: it is used by almost all the functions of the driver. An - _OPEN_INSTANCE structure is associated with every user-level session, allowing concurrent access - to the driver. -*/ -typedef struct _OPEN_INSTANCE -{ - PDEVICE_EXTENSION DeviceExtension; ///< Pointer to the _DEVICE_EXTENSION structure of the device on which - ///< the instance is bound. - NDIS_HANDLE AdapterHandle; ///< NDIS Identifier of the adapter used by this instance. - UINT Medium; ///< Type of physical medium the underlying NDIS driver uses. See the - ///< documentation of NdisOpenAdapter in the MS DDK for details. - NDIS_HANDLE PacketPool; ///< Pool of NDIS_PACKET structures used to transfer the packets from and to the NIC driver. - PIRP OpenCloseIrp; ///< Pointer used to store the open/close IRP requests and provide them to the - ///< callbacks of NDIS. - KSPIN_LOCK RequestSpinLock; ///< SpinLock used to synchronize the OID requests. - LIST_ENTRY RequestList; ///< List of pending OID requests. - LIST_ENTRY ResetIrpList; ///< List of pending adapter reset requests. - INTERNAL_REQUEST Requests[MAX_REQUESTS]; ///< Array of structures that wrap every single OID request. - PMDL BufferMdl; ///< Pointer to a Memory descriptor list (MDL) that maps the circular buffer's memory. - PKEVENT ReadEvent; ///< Pointer to the event on which the read calls on this instance must wait. - HANDLE ReadEventHandle; ///< Handle of the event on which the read calls on this instance must wait. - UNICODE_STRING ReadEventName; ///< Name of the event on which the read calls on this instance must wait. - ///< The event is created with a name, so it can be used at user level to know when it - ///< is possible to access the driver without being blocked. This field stores the name - ///< that and is used by the BIOCGEVNAME IOCTL call. - PUCHAR bpfprogram; ///< Pointer to the filtering pseudo-code associated with current instance of the driver. - ///< This code is used only in particular situations (for example when the packet received - ///< from the NIC driver is stored in two non-consecutive buffers. In normal situations - ///< the filtering routine created by the JIT compiler and pointed by the next field - ///< is used. See \ref NPF for details on the filtering process. -#ifdef __NPF_x86__ - JIT_BPF_Filter *Filter; ///< Pointer to the native filtering function created by the jitter. - ///< See BPF_jitter() for details. -#endif - UINT MinToCopy; ///< Minimum amount of data in the circular buffer that unlocks a read. Set with the - ///< BIOCSMINTOCOPY IOCTL. - LARGE_INTEGER TimeOut; ///< Timeout after which a read is released, also if the amount of data in the buffer is - ///< less than MinToCopy. Set with the BIOCSRTIMEOUT IOCTL. - - int mode; ///< Working mode of the driver. See PacketSetMode() for details. - LARGE_INTEGER Nbytes; ///< Amount of bytes accepted by the filter when this instance is in statistical mode. - LARGE_INTEGER Npackets; ///< Number of packets accepted by the filter when this instance is in statistical mode. - NDIS_SPIN_LOCK CountersLock; ///< SpinLock that protects the statistical mode counters. - UINT Nwrites; ///< Number of times a single write must be physically repeated. See \ref NPF for an - ///< explanation - ULONG Multiple_Write_Counter; ///< Counts the number of times a single write has already physically repeated. - NDIS_EVENT WriteEvent; ///< Event used to synchronize the multiple write process. - BOOLEAN WriteInProgress; ///< True if a write is currently in progress. NPF currently allows a single wite on - ///< the same open instance. - NDIS_SPIN_LOCK WriteLock; ///< SpinLock that protects the WriteInProgress variable. - NDIS_EVENT IOEvent; ///< Event used to synchronize I/O requests with the callback structure of NDIS. - NDIS_STATUS IOStatus; ///< Maintains the status of and OID request call, that will be passed to the application. - BOOLEAN Bound; ///< Specifies if NPF is still bound to the adapter used by this instance. Bound can be - ///< FALSE if a Plug and Play adapter has been removed or disabled by the user. - HANDLE DumpFileHandle; ///< Handle of the file used in dump mode. - PFILE_OBJECT DumpFileObject; ///< Pointer to the object of the file used in dump mode. - PKTHREAD DumpThreadObject; ///< Pointer to the object of the thread used in dump mode. - HANDLE DumpThreadHandle; ///< Handle of the thread created by dump mode to asynchronously move the buffer to disk. - NDIS_EVENT DumpEvent; ///< Event used to synchronize the dump thread with the tap when the instance is in dump mode. - LARGE_INTEGER DumpOffset; ///< Current offset in the dump file. - UNICODE_STRING DumpFileName; ///< String containing the name of the dump file. - UINT MaxDumpBytes; ///< Maximum dimension in bytes of the dump file. If the dump file reaches this size it - ///< will be closed. A value of 0 means unlimited size. - UINT MaxDumpPacks; ///< Maximum number of packets that will be saved in the dump file. If this number of - ///< packets is reached the dump will be closed. A value of 0 means unlimited number of - ///< packets. - BOOLEAN DumpLimitReached; ///< TRUE if the maximum dimension of the dump file (MaxDumpBytes or MaxDumpPacks) is - ///< reached. - MEM_TYPE mem_ex; ///< Memory used by the TME virtual co-processor - TME_CORE tme; ///< Data structure containing the virtualization of the TME co-processor - NDIS_SPIN_LOCK MachineLock; ///< SpinLock that protects the mem_ex buffer - UINT MaxFrameSize; ///< Maximum frame size that the underlying MAC accepts. Used to perform a check on the - ///< size of the frames sent with NPF_Write() or NPF_BufferedWrite(). - CpuPrivateData CpuData[1024]; ///< Pool of kernel buffer structures, one for each CPU. - ULONG ReaderSN; ///< Sequence number of the next packet to be read from the pool of kernel buffers. - ULONG WriterSN; ///< Sequence number of the next packet to be written in the pool of kernel buffers. - ///< These two sequence numbers are unique for each capture instance. - ULONG Size; ///< Size of each kernel buffer contained in the CpuData field. - ULONG SkipProcessing; ///< Flag. When set to 1, the tap discards each packet. It is set to 1 by the IOCTLs that modify - ///< some "sensible" fields of the Open structure (e.g. they reallocate the pool of kernel buffers, - ///< or change the filter program - BOOLEAN SkipSentPackets; - -} -OPEN_INSTANCE, *POPEN_INSTANCE; - -/*! - \brief Structure prepended to each packet in the kernel buffer pool. - - Each packet in one of the kernel buffers is prepended by this header. It encapsulates the bpf_header, - which will be passed to user level programs, as well as the sequence number of the packet, set by the producer (the tap function), - and used by the consumer (the read function) to "reorder" the packets contained in the various kernel buffers. -*/ -struct PacketHeader -{ - ULONG SN; ///< Sequence number of the packet. - struct bpf_hdr header; ///< bpf header, created by the tap, and copied unmodified to user level programs. -}; - -extern UINT g_SendPacketFlags; -#define NDIS_FLAGS_SKIP_LOOPBACK_W2K 0x400 ///< This is an undocumented flag for NdisSetPacketFlags() that allows to disable loopback reception. - -#define TRANSMIT_PACKETS 2048 ///< Maximum number of packets in the transmit packet pool. This value is an upper bound to the number - ///< of packets that can be transmitted at the same time or with a single call to NdisSendPackets. - - -/// Macro used in the I/O routines to return the control to user-mode with a success status. -#define EXIT_SUCCESS(quantity) Irp->IoStatus.Information=quantity;\ - Irp->IoStatus.Status = STATUS_SUCCESS;\ - IoCompleteRequest(Irp, IO_NO_INCREMENT);\ - return STATUS_SUCCESS;\ - -/// Macro used in the I/O routines to return the control to user-mode with a failure status. -#define EXIT_FAILURE(quantity) Irp->IoStatus.Information=quantity;\ - Irp->IoStatus.Status = STATUS_UNSUCCESSFUL;\ - IoCompleteRequest(Irp, IO_NO_INCREMENT);\ - return STATUS_UNSUCCESSFUL;\ - -/** - * @} - */ - - -/***************************/ -/* Prototypes */ -/***************************/ - -/** @defgroup NPF_code NPF functions - * @{ - */ - - -/*! - \brief The initialization routine of the driver. - \param DriverObject The driver object of NPF created by the system. - \param RegistryPath The registry path containing the keys related to the driver. - \return A string containing a list of network adapters. - - DriverEntry is a mandatory function in a device driver. Like the main() of a user level program, it is called - by the system when the driver is loaded in memory and started. Its purpose is to initialize the driver, - performing all the allocations and the setup. In particular, DriverEntry registers all the driver's I/O - callbacks, creates the devices, defines NPF as a protocol inside NDIS. -*/ -NTSTATUS -DriverEntry( - IN PDRIVER_OBJECT DriverObject, - IN PUNICODE_STRING RegistryPath - ); - -/*! - \brief Returns the list of the MACs available on the system. - \return A string containing a list of network adapters. - - The list of adapters is retrieved from the - SYSTEM\CurrentControlSet\Control\Class\{4D36E972-E325-11CE-BFC1-08002BE10318} registry key. - NPF tries to create its bindings from this list. In this way it is possible to be loaded - and unloaded dynamically without passing from the control panel. -*/ -PWCHAR getAdaptersList(VOID); - -/*! - \brief Returns the MACs that bind to TCP/IP. - \return Pointer to the registry key containing the list of adapters on which TCP/IP is bound. - - If getAdaptersList() fails, NPF tries to obtain the TCP/IP bindings through this function. -*/ -PKEY_VALUE_PARTIAL_INFORMATION getTcpBindings(VOID); - -/*! - \brief Creates a device for a given MAC. - \param adriverObjectP The driver object that will be associated with the device, i.e. the one of NPF. - \param amacNameP The name of the network interface that the device will point. - \param aProtoHandle NDIS protocol handle of NPF. - \return If the function succeeds, the return value is nonzero. - - NPF creates a device for every valid network adapter. The new device points to the NPF driver, but contains - information about the original device. In this way, when the user opens the new device, NPF will be able to - determine the correct adapter to use. -*/ -BOOLEAN createDevice( - IN OUT PDRIVER_OBJECT adriverObjectP, - IN PUNICODE_STRING amacNameP, - NDIS_HANDLE aProtoHandle); - -/*! - \brief Opens a new instance of the driver. - \param DeviceObject Pointer to the device object utilized by the user. - \param Irp Pointer to the IRP containing the user request. - \return The status of the operation. See ntstatus.h in the DDK. - - This function is called by the OS when a new instance of the driver is opened, i.e. when a user application - performs a CreateFile on a device created by NPF. NPF_Open allocates and initializes variables, objects - and buffers needed by the new instance, fills the OPEN_INSTANCE structure associated with it and opens the - adapter with a call to NdisOpenAdapter. -*/ -NTSTATUS -NPF_Open( - IN PDEVICE_OBJECT DeviceObject, - IN PIRP Irp - ); - -/*! - \brief Ends the opening of an adapter. - \param ProtocolBindingContext Context of the function. Contains a pointer to the OPEN_INSTANCE structure associated with the current instance. - \param Status Status of the opening operation performed by NDIS. - \param OpenErrorStatus not used by NPF. - - Callback function associated with the NdisOpenAdapter() NDIS function. It is invoked by NDIS when the NIC - driver has finished an open operation that was previously started by NPF_Open(). -*/ -VOID -NPF_OpenAdapterComplete( - IN NDIS_HANDLE ProtocolBindingContext, - IN NDIS_STATUS Status, - IN NDIS_STATUS OpenErrorStatus - ); - -/*! - \brief Closes an instance of the driver. - \param DeviceObject Pointer to the device object utilized by the user. - \param Irp Pointer to the IRP containing the user request. - \return The status of the operation. See ntstatus.h in the DDK. - - This function is called when a running instance of the driver is closed by the user with a CloseHandle(). - It stops the capture/monitoring/dump process, deallocates the memory and the objects associated with the - instance and closing the files. The network adapter is then closed with a call to NdisCloseAdapter. -*/ -NTSTATUS -NPF_Close( - IN PDEVICE_OBJECT DeviceObject, - IN PIRP Irp - ); - -/*! - \brief Ends the closing of an adapter. - \param ProtocolBindingContext Context of the function. Contains a pointer to the OPEN_INSTANCE structure associated with the current instance. - \param Status Status of the close operation performed by NDIS. - - Callback function associated with the NdisCloseAdapter() NDIS function. It is invoked by NDIS when the NIC - driver has finished a close operation that was previously started by NPF_Close(). -*/ -VOID -NPF_CloseAdapterComplete( - IN NDIS_HANDLE ProtocolBindingContext, - IN NDIS_STATUS Status - ); - -/*! - \brief Callback invoked by NDIS when a packet arrives from the network. - \param ProtocolBindingContext Context of the function. Points to a OPEN_INSTANCE structure that identifies - the NPF instance to which the packets are destined. - \param MacReceiveContext Handle that identifies the underlying NIC driver that generated the request. - This value must be used when the packet is transferred from the NIC driver with NdisTransferData(). - \param HeaderBuffer Pointer to the buffer in the NIC driver memory that contains the header of the packet. - \param HeaderBufferSize Size in bytes of the header. - \param LookAheadBuffer Pointer to the buffer in the NIC driver's memory that contains the incoming packet's - data available to NPF. This value does not necessarily coincide with the actual size of the packet, - since only a portion can be available at this time. The remaining portion can be obtained with the - NdisTransferData() NDIS function. - \param LookaheadBufferSize Size in bytes of the lookahead buffer. - \param PacketSize Total size of the incoming packet, excluded the header. - \return The status of the operation. See ntstatus.h in the DDK. - - NPF_tap() is called by the underlying NIC for every incoming packet. It is the most important and one of - the most complex functions of NPF: it executes the filter, runs the statistical engine (if the instance is in - statistical mode), gathers the timestamp, moves the packet in the buffer. NPF_tap() is the only function, - along with the filtering ones, that is executed for every incoming packet, therefore it is carefully - optimized. -*/ -NDIS_STATUS -NPF_tap( - IN NDIS_HANDLE ProtocolBindingContext, - IN NDIS_HANDLE MacReceiveContext, - IN PVOID HeaderBuffer, - IN UINT HeaderBufferSize, - IN PVOID LookAheadBuffer, - IN UINT LookaheadBufferSize, - IN UINT PacketSize - ); - -/*! - \brief Ends the transfer of a packet. - \param ProtocolBindingContext Context of the function. Contains a pointer to the OPEN_INSTANCE structure associated with the current instance. - \param Packet Pointer to the NDIS_PACKET structure that received the packet data. - \param Status Status of the transfer operation. - \param BytesTransferred Amount of bytes transferred. - - Callback function associated with the NdisTransferData() NDIS function. It is invoked by NDIS when the NIC - driver has finished the transfer of a packet from the NIC driver memory to the NPF circular buffer. -*/ -VOID -NPF_TransferDataComplete( - IN NDIS_HANDLE ProtocolBindingContext, - IN PNDIS_PACKET Packet, - IN NDIS_STATUS Status, - IN UINT BytesTransferred - ); - -/*! - \brief Callback function that signals the end of a packet reception. - \param ProtocolBindingContext Context of the function. Contains a pointer to the OPEN_INSTANCE structure associated with the current instance. - - does nothing in NPF -*/ -VOID -NPF_ReceiveComplete(IN NDIS_HANDLE ProtocolBindingContext); - -/*! - \brief Handles the IOCTL calls. - \param DeviceObject Pointer to the device object utilized by the user. - \param Irp Pointer to the IRP containing the user request. - \return The status of the operation. See ntstatus.h in the DDK. - - Once the packet capture driver is opened it can be configured from user-level applications with IOCTL commands - using the DeviceIoControl() system call. NPF_IoControl receives and serves all the IOCTL calls directed to NPF. - The following commands are recognized: - - #BIOCSETBUFFERSIZE - - #BIOCSETF - - #BIOCGSTATS - - #BIOCSRTIMEOUT - - #BIOCSMODE - - #BIOCSWRITEREP - - #BIOCSMINTOCOPY - - #BIOCSETOID - - #BIOCQUERYOID - - #BIOCSETDUMPFILENAME - - #BIOCGEVNAME - - #BIOCSENDPACKETSSYNC - - #BIOCSENDPACKETSNOSYNC -*/ -NTSTATUS -NPF_IoControl( - IN PDEVICE_OBJECT DeviceObject, - IN PIRP Irp - ); - -VOID - -/*! - \brief Ends an OID request. - \param ProtocolBindingContext Context of the function. Contains a pointer to the OPEN_INSTANCE structure associated with the current instance. - \param pRequest Pointer to the completed OID request. - \param Status Status of the operation. - - Callback function associated with the NdisRequest() NDIS function. It is invoked by NDIS when the NIC - driver has finished an OID request operation that was previously started by NPF_IoControl(). -*/ -NPF_RequestComplete( - IN NDIS_HANDLE ProtocolBindingContext, - IN PNDIS_REQUEST pRequest, - IN NDIS_STATUS Status - ); - -/*! - \brief Writes a raw packet to the network. - \param DeviceObject Pointer to the device object on which the user wrote the packet. - \param Irp Pointer to the IRP containing the user request. - \return The status of the operation. See ntstatus.h in the DDK. - - This function is called by the OS in consequence of user WriteFile() call, with the data of the packet that must - be sent on the net. The data is contained in the buffer associated with Irp, NPF_Write takes it and - delivers it to the NIC driver via the NdisSend() function. The Nwrites field of the OPEN_INSTANCE structure - associated with Irp indicates the number of copies of the packet that will be sent: more than one copy of the - packet can be sent for performance reasons. -*/ -NTSTATUS -NPF_Write( - IN PDEVICE_OBJECT DeviceObject, - IN PIRP Irp - ); - - -/*! - \brief Writes a buffer of raw packets to the network. - \param Irp Pointer to the IRP containing the user request. - \param UserBuff Pointer to the buffer containing the packets to send. - \param UserBuffSize Size of the buffer with the packets. - \return The amount of bytes actually sent. If the return value is smaller than the Size parameter, an - error occurred during the send. The error can be caused by an adapter problem or by an - inconsistent/bogus user buffer. - - This function is called by the OS in consequence of a BIOCSENDPACKETSNOSYNC or a BIOCSENDPACKETSSYNC IOCTL. - The buffer received as input parameter contains an arbitrary number of packets, each of which preceded by a - sf_pkthdr structure. NPF_BufferedWrite() scans the buffer and sends every packet via the NdisSend() function. - When Sync is set to TRUE, the packets are synchronized with the KeQueryPerformanceCounter() function. - This requires a remarkable amount of CPU, but allows to respect the timestamps associated with packets with a precision - of some microseconds (depending on the precision of the performance counter of the machine). - If Sync is false, the timestamps are ignored and the packets are sent as fat as possible. -*/ - -INT NPF_BufferedWrite(IN PIRP Irp, - IN PCHAR UserBuff, - IN ULONG UserBuffSize, - BOOLEAN sync); - -/*! - \brief Waits the completion of all the sends performed by NPF_BufferedWrite. - - \param Open Pointer to open context structure - - Used by NPF_BufferedWrite to wait the completion of all the sends before returning the control to the user. -*/ -VOID NPF_WaitEndOfBufferedWrite(POPEN_INSTANCE Open); - -/*! - \brief Ends a send operation. - \param ProtocolBindingContext Context of the function. Contains a pointer to the OPEN_INSTANCE structure associated with the current instance. - \param pRequest Pointer to the NDIS PACKET structure used by NPF_Write() to send the packet. - \param Status Status of the operation. - - Callback function associated with the NdisSend() NDIS function. It is invoked by NDIS when the NIC - driver has finished an OID request operation that was previously started by NPF_Write(). -*/ -VOID -NPF_SendComplete( - IN NDIS_HANDLE ProtocolBindingContext, - IN PNDIS_PACKET pPacket, - IN NDIS_STATUS Status - ); - -/*! - \brief Ends a reset of the adapter. - \param ProtocolBindingContext Context of the function. Contains a pointer to the OPEN_INSTANCE structure associated with the current instance. - \param Status Status of the operation. - - Callback function associated with the NdisReset() NDIS function. It is invoked by NDIS when the NIC - driver has finished an OID request operation that was previously started by NPF_IoControl(), in an IOCTL_PROTOCOL_RESET - command. -*/ -VOID -NPF_ResetComplete( - IN NDIS_HANDLE ProtocolBindingContext, - IN NDIS_STATUS Status - ); - -/*! - \brief Callback for NDIS StatusHandler. Not used by NPF -*/ -VOID -NPF_Status( - IN NDIS_HANDLE ProtocolBindingContext, - IN NDIS_STATUS Status, - IN PVOID StatusBuffer, - IN UINT StatusBufferSize - ); - - -/*! - \brief Callback for NDIS StatusCompleteHandler. Not used by NPF -*/ -VOID -NPF_StatusComplete(IN NDIS_HANDLE ProtocolBindingContext); - -/*! - \brief Function called by the OS when NPF is unloaded. - \param DriverObject The driver object of NPF created by the system. - - This is the last function executed when the driver is unloaded from the system. It frees global resources, - delete the devices and deregisters the protocol. The driver can be unloaded by the user stopping the NPF - service (from control panel or with a console 'net stop npf'). -*/ -VOID -NPF_Unload(IN PDRIVER_OBJECT DriverObject); - - -/*! - \brief Function that serves the user's reads. - \param DeviceObject Pointer to the device used by the user. - \param Irp Pointer to the IRP containing the user request. - \return The status of the operation. See ntstatus.h in the DDK. - - This function is called by the OS in consequence of user ReadFile() call. It moves the data present in the - kernel buffer to the user buffer associated with Irp. - First of all, NPF_Read checks the amount of data in kernel buffer associated with current NPF instance. - - If the instance is in capture mode and the buffer contains more than OPEN_INSTANCE::MinToCopy bytes, - NPF_Read moves the data in the user buffer and returns immediatly. In this way, the read performed by the - user is not blocking. - - If the buffer contains less than MinToCopy bytes, the application's request isn't - satisfied immediately, but it's blocked until at least MinToCopy bytes arrive from the net - or the timeout on this read expires. The timeout is kept in the OPEN_INSTANCE::TimeOut field. - - If the instance is in statistical mode or in dump mode, the application's request is blocked until the - timeout kept in OPEN_INSTANCE::TimeOut expires. -*/ -NTSTATUS -NPF_Read( - IN PDEVICE_OBJECT DeviceObject, - IN PIRP Irp - ); - -/*! - \brief Reads the registry keys associated woth NPF if the driver is manually installed via the control panel. - - Normally not used in recent versions of NPF. -*/ -NTSTATUS -NPF_ReadRegistry( - IN PWSTR *MacDriverName, - IN PWSTR *PacketDriverName, - IN PUNICODE_STRING RegistryPath - ); - -/*! - \brief Function used by NPF_ReadRegistry() to query the registry keys associated woth NPF if the driver - is manually installed via the control panel. - - Normally not used in recent versions of NPF. -*/ -NTSTATUS -NPF_QueryRegistryRoutine( - IN PWSTR ValueName, - IN ULONG ValueType, - IN PVOID ValueData, - IN ULONG ValueLength, - IN PVOID Context, - IN PVOID EntryContext - ); - -/*! - \brief Callback for NDIS BindAdapterHandler. Not used by NPF. - - Function called by NDIS when a new adapter is installed on the machine With Plug and Play. -*/ -VOID NPF_BindAdapter( - OUT PNDIS_STATUS Status, - IN NDIS_HANDLE BindContext, - IN PNDIS_STRING DeviceName, - IN PVOID SystemSpecific1, - IN PVOID SystemSpecific2 - ); - -/*! - \brief Callback for NDIS UnbindAdapterHandler. - \param Status out variable filled by NPF_UnbindAdapter with the status of the unbind operation. - \param ProtocolBindingContext Context of the function. Contains a pointer to the OPEN_INSTANCE structure associated with current instance. - \param UnbindContext Specifies a handle, supplied by NDIS, that NPF can use to complete the operation. - - Function called by NDIS when a new adapter is removed from the machine without shutting it down. - NPF_UnbindAdapter closes the adapter calling NdisCloseAdapter() and frees the memory and the structures - associated with it. It also releases the waiting user-level app and closes the dump thread if the instance - is in dump mode. -*/ -VOID -NPF_UnbindAdapter( - OUT PNDIS_STATUS Status, - IN NDIS_HANDLE ProtocolBindingContext, - IN NDIS_HANDLE UnbindContext - ); - - -/*! - \brief Creates the file that will receive the packets when the driver is in dump mode. - \param Open The NPF instance that opens the file. - \param fileName Pointer to a UNICODE string containing the name of the file. - \param append Boolean value that specifies if the data must be appended to the file. - \return The status of the operation. See ntstatus.h in the DDK. -*/ -NTSTATUS NPF_OpenDumpFile(POPEN_INSTANCE Open , PUNICODE_STRING fileName, BOOLEAN append); - -/*! - \brief Starts dump to file. - \param Open The NPF instance that opens the file. - \return The status of the operation. See ntstatus.h in the DDK. - - This function performs two operations. First, it writes the libpcap header at the beginning of the file. - Second, it starts the thread that asynchronously dumps the network data to the file. -*/ -NTSTATUS NPF_StartDump(POPEN_INSTANCE Open); - -/*! - \brief The dump thread. - \param Open The NPF instance that creates the thread. - - This function moves the content of the NPF kernel buffer to file. It runs in the user context, so at lower - priority than the TAP. -*/ -VOID NPF_DumpThread(PVOID Open); - -/*! - \brief Saves the content of the packet buffer to the file associated with current instance. - \param Open The NPF instance that creates the thread. - - Used by NPF_DumpThread() and NPF_CloseDumpFile(). -*/ -NTSTATUS NPF_SaveCurrentBuffer(POPEN_INSTANCE Open); - -/*! - \brief Writes a block of packets on the dump file. - \param FileObject The file object that will receive the packets. - \param Offset The offset in the file where the packets will be put. - \param Length The amount of bytes to write. - \param Mdl MDL mapping the memory buffer that will be written to disk. - \param IoStatusBlock Used by the function to return the status of the operation. - \return The status of the operation. See ntstatus.h in the DDK. - - NPF_WriteDumpFile addresses directly the file system, creating a custom IRP and using it to send a portion - of the NPF circular buffer to disk. This function is used by NPF_DumpThread(). -*/ -VOID NPF_WriteDumpFile(PFILE_OBJECT FileObject, - PLARGE_INTEGER Offset, - ULONG Length, - PMDL Mdl, - PIO_STATUS_BLOCK IoStatusBlock); - - - -/*! - \brief Closes the dump file associated with an instance of the driver. - \param Open The NPF instance that closes the file. - \return The status of the operation. See ntstatus.h in the DDK. -*/ -NTSTATUS NPF_CloseDumpFile(POPEN_INSTANCE Open); - -/*! - \brief Returns the amount of bytes present in the packet buffer. - \param Open The NPF instance that closes the file. -*/ -UINT GetBuffOccupation(POPEN_INSTANCE Open); - -/*! - \brief Called by NDIS to notify us of a PNP event. The most significant one for us is power state change. - - \param ProtocolBindingContext Pointer to open context structure. This is NULL for global reconfig - events. - \param pNetPnPEvent Pointer to the PnP event - - If there is a power state change, the driver is forced to resynchronize the global timer. - This hopefully avoids the synchronization issues caused by hibernation or standby. - This function is excluded from the NT4 driver, where PnP is not supported -*/ -#ifdef NDIS50 -NDIS_STATUS NPF_PowerChange(IN NDIS_HANDLE ProtocolBindingContext, IN PNET_PNP_EVENT pNetPnPEvent); -#endif - -/** - * @} - */ - -/** - * @} - */ - -#endif /*main ifndef/define*/ +/* + * Copyright (c) 1999 - 2005 NetGroup, Politecnico di Torino (Italy) + * Copyright (c) 2005 CACE Technologies, Davis (California) + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the Politecnico di Torino, CACE Technologies + * nor the names of its contributors may be used to endorse or promote + * products derived from this software without specific prior written + * permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +/** @ingroup NPF + * @{ + */ + +/** @defgroup NPF_include NPF structures and definitions + * @{ + */ + +#ifndef __PACKET_INCLUDE______ +#define __PACKET_INCLUDE______ + +#ifdef __NPF_x86__ +#define NTKERNEL ///< Forces the compilation of the jitter with kernel calls +#include "jitter.h" +#endif + + +#include "win_bpf.h" + +#define MAX_REQUESTS 256 ///< Maximum number of simultaneous IOCTL requests. + +#define Packet_ALIGNMENT sizeof(int) ///< Alignment macro. Defines the alignment size. +#define Packet_WORDALIGN(x) (((x)+(Packet_ALIGNMENT-1))&~(Packet_ALIGNMENT-1)) ///< Alignment macro. Rounds up to the next + ///< even multiple of Packet_ALIGNMENT. +/***************************/ +/* IOCTLs */ +/***************************/ + +/*! + \brief IOCTL code: set kernel buffer size. + + This IOCTL is used to set a new size of the circular buffer associated with an instance of NPF. + When a BIOCSETBUFFERSIZE command is received, the driver frees the old buffer, allocates the new one + and resets all the parameters associated with the buffer in the OPEN_INSTANCE structure. The currently + buffered packets are lost. +*/ +#define BIOCSETBUFFERSIZE 9592 + +/*! + \brief IOCTL code: set packet filtering program. + + This IOCTL sets a new packet filter in the driver. Before allocating any memory for the new filter, the + bpf_validate() function is called to check the correctness of the filter. If this function returns TRUE, + the filter is copied to the driver's memory, its address is stored in the bpfprogram field of the + OPEN_INSTANCE structure associated with current instance of the driver, and the filter will be applied to + every incoming packet. This command also empties the circular buffer used by current instance + to store packets. This is done to avoid the presence in the buffer of packets that do not match the filter. +*/ +#define BIOCSETF 9030 + +/*! + \brief IOCTL code: get the capture stats + + This command returns to the application the number of packets received and the number of packets dropped by + an instance of the driver. +*/ +#define BIOCGSTATS 9031 + +/*! + \brief IOCTL code: set the read timeout + + This command sets the maximum timeout after which a read is released, also if no data packets were received. +*/ +#define BIOCSRTIMEOUT 7416 + +/*! + \brief IOCTL code: set working mode + + This IOCTL can be used to set the working mode of a NPF instance. The new mode, received by the driver in the + buffer associated with the IOCTL command, can be #MODE_CAPT for capture mode (the default), #MODE_STAT for + statistical mode or #MODE_DUMP for dump mode. +*/ +#define BIOCSMODE 7412 + +/*! + \brief IOCTL code: set number of physical repetions of every packet written by the app + + Sets the number of times a single write call must be repeated. This command sets the OPEN_INSTANCE::Nwrites + member, and is used to implement the 'multiple write' feature of the driver. +*/ +#define BIOCSWRITEREP 7413 + +/*! + \brief IOCTL code: set minimum amount of data in the kernel buffer that unlocks a read call + + This command sets the OPEN_INSTANCE::MinToCopy member. +*/ +#define BIOCSMINTOCOPY 7414 + +/*! + \brief IOCTL code: set an OID value + + This IOCTL is used to perform an OID set operation on the NIC driver. +*/ +#define BIOCSETOID 2147483648 + +/*! + \brief IOCTL code: get an OID value + + This IOCTL is used to perform an OID get operation on the NIC driver. +*/ +#define BIOCQUERYOID 2147483652 +#define BIOCISETLOBBEH 7410 +/*! + \brief IOCTL code: set the name of a the file used by kernel dump mode + + This command opens a file whose name is contained in the IOCTL buffer and associates it with current NPf instance. + The dump thread uses it to copy the content of the circular buffer to file. + If a file was already opened, the driver closes it before opening the new one. +*/ +#define BIOCSETDUMPFILENAME 9029 + +/*! + \brief IOCTL code: get the name of the event that the driver signals when some data is present in the buffer + + Command used by the application to retrieve the name of the global event associated with a NPF instance. + The event is signaled by the driver when the kernel buffer contains enough data for a transfer. +*/ +#define BIOCGEVNAME 7415 + +/*! + \brief IOCTL code: Send a buffer containing multiple packets to the network, ignoring the timestamps. + + Command used to send a buffer of packets in a single system call. Every packet in the buffer is preceded by + a sf_pkthdr structure. The timestamps of the packets are ignored, i.e. the packets are sent as fast as + possible. The NPF_BufferedWrite() function is invoked to send the packets. +*/ +#define BIOCSENDPACKETSNOSYNC 9032 + +/*! + \brief IOCTL code: Send a buffer containing multiple packets to the network, considering the timestamps. + + Command used to send a buffer of packets in a single system call. Every packet in the buffer is preceded by + a sf_pkthdr structure. The timestamps of the packets are used to synchronize the write, i.e. the packets + are sent to the network respecting the intervals specified in the sf_pkthdr structure associated with each + packet. NPF_BufferedWrite() function is invoked to send the packets. +*/ +#define BIOCSENDPACKETSSYNC 9033 + +/*! + \brief IOCTL code: Set the dump file limits. + + This IOCTL sets the limits (maximum size and maximum number of packets) of the dump file created when the + driver works in dump mode. +*/ +#define BIOCSETDUMPLIMITS 9034 + +/*! + \brief IOCTL code: Get the status of the kernel dump process. + + This command returns TRUE if the kernel dump is ended, i.e if one of the limits set with BIOCSETDUMPLIMITS + (amount of bytes or number of packets) has been reached. +*/ +#define BIOCISDUMPENDED 7411 + +// Working modes +#define MODE_CAPT 0x0 ///< Capture working mode +#define MODE_STAT 0x1 ///< Statistical working mode +#define MODE_MON 0x2 ///< Kernel monitoring mode +#define MODE_DUMP 0x10 ///< Kernel dump working mode + + +#define IMMEDIATE 1 ///< Immediate timeout. Forces a read call to return immediately. + + +// The following definitions are used to provide compatibility +// of the dump files with the ones of libpcap +#define TCPDUMP_MAGIC 0xa1b2c3d4 ///< Libpcap magic number. Used by programs like tcpdump to recognize a driver's generated dump file. +#define PCAP_VERSION_MAJOR 2 ///< Major libpcap version of the dump file. Used by programs like tcpdump to recognize a driver's generated dump file. +#define PCAP_VERSION_MINOR 4 ///< Minor libpcap version of the dump file. Used by programs like tcpdump to recognize a driver's generated dump file. + +/*! + \brief Header of a libpcap dump file. + + Used when a driver instance is set in dump mode to create a libpcap-compatible file. +*/ +struct packet_file_header +{ + UINT magic; ///< Libpcap magic number + USHORT version_major; ///< Libpcap major version + USHORT version_minor; ///< Libpcap minor version + UINT thiszone; ///< Gmt to local correction + UINT sigfigs; ///< Accuracy of timestamps + UINT snaplen; ///< Length of the max saved portion of each packet + UINT linktype; ///< Data link type (DLT_*). See win_bpf.h for details. +}; + +/*! + \brief Header associated to a packet in the driver's buffer when the driver is in dump mode. + Similar to the bpf_hdr structure, but simpler. +*/ +struct sf_pkthdr { + struct timeval ts; ///< time stamp + UINT caplen; ///< Length of captured portion. The captured portion can be different from + ///< the original packet, because it is possible (with a proper filter) to + ///< instruct the driver to capture only a portion of the packets. + UINT len; ///< Length of the original packet (off wire). +}; + +/*! + \brief Stores an OID request. + + This structure is used by the driver to perform OID query or set operations on the underlying NIC driver. + The OID operations be performed usually only by network drivers, but NPF exports this mechanism to user-level + applications through an IOCTL interface. The driver uses this structure to wrap a NDIS_REQUEST structure. + This allows to handle correctly the callback structure of NdisRequest(), handling multiple requests and + maintaining information about the IRPs to complete. +*/ +typedef struct _INTERNAL_REQUEST { + LIST_ENTRY ListElement; ///< Used to handle lists of requests. + PIRP Irp; ///< Irp that performed the request + BOOLEAN Internal; ///< True if the request is for internal use of npf.sys. False if the request is performed by the user through an IOCTL. + NDIS_REQUEST Request; ///< The structure with the actual request, that will be passed to NdisRequest(). +} INTERNAL_REQUEST, *PINTERNAL_REQUEST; + +/*! + \brief Contains a NDIS packet. + + The driver uses this structure to wrap a NDIS_PACKET structure. + This allows to handle correctly the callback structure of NdisTransferData(), handling multiple requests and + maintaining information about the IRPs to complete. +*/ +typedef struct _PACKET_RESERVED { + LIST_ENTRY ListElement; ///< Used to handle lists of packets. + PIRP Irp; ///< Irp that performed the request + PMDL pMdl; ///< MDL mapping the buffer of the packet. + BOOLEAN FreeBufAfterWrite; ///< True if the memory buffer associated with the packet must be freed + ///< after a call to NdisSend(). + ULONG Cpu; ///< The CPU on which the packet was pulled out of the linked list of free packets +} PACKET_RESERVED, *PPACKET_RESERVED; + +#define RESERVED(_p) ((PPACKET_RESERVED)((_p)->ProtocolReserved)) ///< Macro to obtain a NDIS_PACKET from a PACKET_RESERVED + +/*! + \brief Port device extension. + + Structure containing some data relative to every adapter on which NPF is bound. +*/ +typedef struct _DEVICE_EXTENSION { + NDIS_HANDLE NdisProtocolHandle; ///< NDIS handle of NPF. + NDIS_STRING AdapterName; ///< Name of the adapter. + PWSTR ExportString; ///< Name of the exported device, i.e. name that the applications will use + ///< to open this adapter through WinPcap. +} DEVICE_EXTENSION, *PDEVICE_EXTENSION; + +/*! + \brief Kernel buffer of each CPU. + + Structure containing the kernel buffer (and other CPU related fields) used to capture packets. +*/ +typedef struct __CPU_Private_Data +{ + ULONG P; ///< Zero-based index of the producer in the buffer. It indicates the first free byte to be written. + ULONG C; ///< Zero-based index of the consumer in the buffer. It indicates the first free byte to be read. + ULONG Free; ///< Number of the free bytes in the buffer + PUCHAR Buffer; ///< Pointer to the kernel buffer used to capture packets. + ULONG Accepted; ///< Number of packet that current capture instance accepted, from its opening. A packet + ///< is accepted if it passes the filter and fits in the buffer. Accepted packets are the + ///< ones that reach the application. + ///< This number is related to the particular CPU this structure is referring to. + ULONG Received; ///< Number of packets received by current instance from its opening, i.e. number of + ///< packet received by the network adapter since the beginning of the + ///< capture/monitoring/dump session. + ///< This number is related to the particular CPU this structure is referring to. + ULONG Dropped; ///< Number of packet that current instance had to drop, from its opening. A packet + ///< is dropped if there is no more space to store it in the circular buffer that the + ///< driver associates to current instance. + ///< This number is related to the particular CPU this structure is referring to. + ULONG Processing; ///< Flag. If set to 1, it indicates that the tap is processing a packet on the CPU this structure is referring to. + PMDL TransferMdl1; ///< MDL used to map the portion of the buffer that will contain an incoming packet. + PMDL TransferMdl2; ///< Second MDL used to map the portion of the buffer that will contain an incoming packet. + ULONG NewP; ///< Used by NdisTransferData() (when we call NdisTransferData, p index must be updated only in the TransferDataComplete. +} + CpuPrivateData; + + +/*! + \brief Contains the state of a running instance of the NPF driver. + + This is the most important structure of NPF: it is used by almost all the functions of the driver. An + _OPEN_INSTANCE structure is associated with every user-level session, allowing concurrent access + to the driver. +*/ +typedef struct _OPEN_INSTANCE +{ + PDEVICE_EXTENSION DeviceExtension; ///< Pointer to the _DEVICE_EXTENSION structure of the device on which + ///< the instance is bound. + NDIS_HANDLE AdapterHandle; ///< NDIS Identifier of the adapter used by this instance. + UINT Medium; ///< Type of physical medium the underlying NDIS driver uses. See the + ///< documentation of NdisOpenAdapter in the MS DDK for details. + NDIS_HANDLE PacketPool; ///< Pool of NDIS_PACKET structures used to transfer the packets from and to the NIC driver. + PIRP OpenCloseIrp; ///< Pointer used to store the open/close IRP requests and provide them to the + ///< callbacks of NDIS. + KSPIN_LOCK RequestSpinLock; ///< SpinLock used to synchronize the OID requests. + LIST_ENTRY RequestList; ///< List of pending OID requests. + LIST_ENTRY ResetIrpList; ///< List of pending adapter reset requests. + INTERNAL_REQUEST Requests[MAX_REQUESTS]; ///< Array of structures that wrap every single OID request. + PMDL BufferMdl; ///< Pointer to a Memory descriptor list (MDL) that maps the circular buffer's memory. + PKEVENT ReadEvent; ///< Pointer to the event on which the read calls on this instance must wait. + HANDLE ReadEventHandle; ///< Handle of the event on which the read calls on this instance must wait. + UNICODE_STRING ReadEventName; ///< Name of the event on which the read calls on this instance must wait. + ///< The event is created with a name, so it can be used at user level to know when it + ///< is possible to access the driver without being blocked. This field stores the name + ///< that and is used by the BIOCGEVNAME IOCTL call. + PUCHAR bpfprogram; ///< Pointer to the filtering pseudo-code associated with current instance of the driver. + ///< This code is used only in particular situations (for example when the packet received + ///< from the NIC driver is stored in two non-consecutive buffers. In normal situations + ///< the filtering routine created by the JIT compiler and pointed by the next field + ///< is used. See \ref NPF for details on the filtering process. +#ifdef __NPF_x86__ + JIT_BPF_Filter *Filter; ///< Pointer to the native filtering function created by the jitter. + ///< See BPF_jitter() for details. +#endif + UINT MinToCopy; ///< Minimum amount of data in the circular buffer that unlocks a read. Set with the + ///< BIOCSMINTOCOPY IOCTL. + LARGE_INTEGER TimeOut; ///< Timeout after which a read is released, also if the amount of data in the buffer is + ///< less than MinToCopy. Set with the BIOCSRTIMEOUT IOCTL. + + int mode; ///< Working mode of the driver. See PacketSetMode() for details. + LARGE_INTEGER Nbytes; ///< Amount of bytes accepted by the filter when this instance is in statistical mode. + LARGE_INTEGER Npackets; ///< Number of packets accepted by the filter when this instance is in statistical mode. + NDIS_SPIN_LOCK CountersLock; ///< SpinLock that protects the statistical mode counters. + UINT Nwrites; ///< Number of times a single write must be physically repeated. See \ref NPF for an + ///< explanation + ULONG Multiple_Write_Counter; ///< Counts the number of times a single write has already physically repeated. + NDIS_EVENT WriteEvent; ///< Event used to synchronize the multiple write process. + BOOLEAN WriteInProgress; ///< True if a write is currently in progress. NPF currently allows a single wite on + ///< the same open instance. + NDIS_SPIN_LOCK WriteLock; ///< SpinLock that protects the WriteInProgress variable. + NDIS_EVENT IOEvent; ///< Event used to synchronize I/O requests with the callback structure of NDIS. + NDIS_STATUS IOStatus; ///< Maintains the status of and OID request call, that will be passed to the application. + BOOLEAN Bound; ///< Specifies if NPF is still bound to the adapter used by this instance. Bound can be + ///< FALSE if a Plug and Play adapter has been removed or disabled by the user. + HANDLE DumpFileHandle; ///< Handle of the file used in dump mode. + PFILE_OBJECT DumpFileObject; ///< Pointer to the object of the file used in dump mode. + PKTHREAD DumpThreadObject; ///< Pointer to the object of the thread used in dump mode. + HANDLE DumpThreadHandle; ///< Handle of the thread created by dump mode to asynchronously move the buffer to disk. + NDIS_EVENT DumpEvent; ///< Event used to synchronize the dump thread with the tap when the instance is in dump mode. + LARGE_INTEGER DumpOffset; ///< Current offset in the dump file. + UNICODE_STRING DumpFileName; ///< String containing the name of the dump file. + UINT MaxDumpBytes; ///< Maximum dimension in bytes of the dump file. If the dump file reaches this size it + ///< will be closed. A value of 0 means unlimited size. + UINT MaxDumpPacks; ///< Maximum number of packets that will be saved in the dump file. If this number of + ///< packets is reached the dump will be closed. A value of 0 means unlimited number of + ///< packets. + BOOLEAN DumpLimitReached; ///< TRUE if the maximum dimension of the dump file (MaxDumpBytes or MaxDumpPacks) is + ///< reached. + MEM_TYPE mem_ex; ///< Memory used by the TME virtual co-processor + TME_CORE tme; ///< Data structure containing the virtualization of the TME co-processor + NDIS_SPIN_LOCK MachineLock; ///< SpinLock that protects the mem_ex buffer + UINT MaxFrameSize; ///< Maximum frame size that the underlying MAC accepts. Used to perform a check on the + ///< size of the frames sent with NPF_Write() or NPF_BufferedWrite(). + CpuPrivateData CpuData[1024]; ///< Pool of kernel buffer structures, one for each CPU. + ULONG ReaderSN; ///< Sequence number of the next packet to be read from the pool of kernel buffers. + ULONG WriterSN; ///< Sequence number of the next packet to be written in the pool of kernel buffers. + ///< These two sequence numbers are unique for each capture instance. + ULONG Size; ///< Size of each kernel buffer contained in the CpuData field. + ULONG SkipProcessing; ///< Flag. When set to 1, the tap discards each packet. It is set to 1 by the IOCTLs that modify + ///< some "sensible" fields of the Open structure (e.g. they reallocate the pool of kernel buffers, + ///< or change the filter program + BOOLEAN SkipSentPackets; + +} +OPEN_INSTANCE, *POPEN_INSTANCE; + +/*! + \brief Structure prepended to each packet in the kernel buffer pool. + + Each packet in one of the kernel buffers is prepended by this header. It encapsulates the bpf_header, + which will be passed to user level programs, as well as the sequence number of the packet, set by the producer (the tap function), + and used by the consumer (the read function) to "reorder" the packets contained in the various kernel buffers. +*/ +struct PacketHeader +{ + ULONG SN; ///< Sequence number of the packet. + struct bpf_hdr header; ///< bpf header, created by the tap, and copied unmodified to user level programs. +}; + +extern UINT g_SendPacketFlags; +#define NDIS_FLAGS_SKIP_LOOPBACK_W2K 0x400 ///< This is an undocumented flag for NdisSetPacketFlags() that allows to disable loopback reception. + +#define TRANSMIT_PACKETS 2048 ///< Maximum number of packets in the transmit packet pool. This value is an upper bound to the number + ///< of packets that can be transmitted at the same time or with a single call to NdisSendPackets. + + +/// Macro used in the I/O routines to return the control to user-mode with a success status. +#define EXIT_SUCCESS(quantity) Irp->IoStatus.Information=quantity;\ + Irp->IoStatus.Status = STATUS_SUCCESS;\ + IoCompleteRequest(Irp, IO_NO_INCREMENT);\ + return STATUS_SUCCESS;\ + +/// Macro used in the I/O routines to return the control to user-mode with a failure status. +#define EXIT_FAILURE(quantity) Irp->IoStatus.Information=quantity;\ + Irp->IoStatus.Status = STATUS_UNSUCCESSFUL;\ + IoCompleteRequest(Irp, IO_NO_INCREMENT);\ + return STATUS_UNSUCCESSFUL;\ + +/** + * @} + */ + + +/***************************/ +/* Prototypes */ +/***************************/ + +/** @defgroup NPF_code NPF functions + * @{ + */ + + +/*! + \brief The initialization routine of the driver. + \param DriverObject The driver object of NPF created by the system. + \param RegistryPath The registry path containing the keys related to the driver. + \return A string containing a list of network adapters. + + DriverEntry is a mandatory function in a device driver. Like the main() of a user level program, it is called + by the system when the driver is loaded in memory and started. Its purpose is to initialize the driver, + performing all the allocations and the setup. In particular, DriverEntry registers all the driver's I/O + callbacks, creates the devices, defines NPF as a protocol inside NDIS. +*/ +NTSTATUS +DriverEntry( + IN PDRIVER_OBJECT DriverObject, + IN PUNICODE_STRING RegistryPath + ); + +/*! + \brief Returns the list of the MACs available on the system. + \return A string containing a list of network adapters. + + The list of adapters is retrieved from the + SYSTEM\CurrentControlSet\Control\Class\{4D36E972-E325-11CE-BFC1-08002BE10318} registry key. + NPF tries to create its bindings from this list. In this way it is possible to be loaded + and unloaded dynamically without passing from the control panel. +*/ +PWCHAR getAdaptersList(VOID); + +/*! + \brief Returns the MACs that bind to TCP/IP. + \return Pointer to the registry key containing the list of adapters on which TCP/IP is bound. + + If getAdaptersList() fails, NPF tries to obtain the TCP/IP bindings through this function. +*/ +PKEY_VALUE_PARTIAL_INFORMATION getTcpBindings(VOID); + +/*! + \brief Creates a device for a given MAC. + \param adriverObjectP The driver object that will be associated with the device, i.e. the one of NPF. + \param amacNameP The name of the network interface that the device will point. + \param aProtoHandle NDIS protocol handle of NPF. + \return If the function succeeds, the return value is nonzero. + + NPF creates a device for every valid network adapter. The new device points to the NPF driver, but contains + information about the original device. In this way, when the user opens the new device, NPF will be able to + determine the correct adapter to use. +*/ +BOOLEAN createDevice( + IN OUT PDRIVER_OBJECT adriverObjectP, + IN PUNICODE_STRING amacNameP, + NDIS_HANDLE aProtoHandle); + +/*! + \brief Opens a new instance of the driver. + \param DeviceObject Pointer to the device object utilized by the user. + \param Irp Pointer to the IRP containing the user request. + \return The status of the operation. See ntstatus.h in the DDK. + + This function is called by the OS when a new instance of the driver is opened, i.e. when a user application + performs a CreateFile on a device created by NPF. NPF_Open allocates and initializes variables, objects + and buffers needed by the new instance, fills the OPEN_INSTANCE structure associated with it and opens the + adapter with a call to NdisOpenAdapter. +*/ +NTSTATUS +NPF_Open( + IN PDEVICE_OBJECT DeviceObject, + IN PIRP Irp + ); + +/*! + \brief Ends the opening of an adapter. + \param ProtocolBindingContext Context of the function. Contains a pointer to the OPEN_INSTANCE structure associated with the current instance. + \param Status Status of the opening operation performed by NDIS. + \param OpenErrorStatus not used by NPF. + + Callback function associated with the NdisOpenAdapter() NDIS function. It is invoked by NDIS when the NIC + driver has finished an open operation that was previously started by NPF_Open(). +*/ +VOID +NPF_OpenAdapterComplete( + IN NDIS_HANDLE ProtocolBindingContext, + IN NDIS_STATUS Status, + IN NDIS_STATUS OpenErrorStatus + ); + +/*! + \brief Closes an instance of the driver. + \param DeviceObject Pointer to the device object utilized by the user. + \param Irp Pointer to the IRP containing the user request. + \return The status of the operation. See ntstatus.h in the DDK. + + This function is called when a running instance of the driver is closed by the user with a CloseHandle(). + It stops the capture/monitoring/dump process, deallocates the memory and the objects associated with the + instance and closing the files. The network adapter is then closed with a call to NdisCloseAdapter. +*/ +NTSTATUS +NPF_Close( + IN PDEVICE_OBJECT DeviceObject, + IN PIRP Irp + ); + +/*! + \brief Ends the closing of an adapter. + \param ProtocolBindingContext Context of the function. Contains a pointer to the OPEN_INSTANCE structure associated with the current instance. + \param Status Status of the close operation performed by NDIS. + + Callback function associated with the NdisCloseAdapter() NDIS function. It is invoked by NDIS when the NIC + driver has finished a close operation that was previously started by NPF_Close(). +*/ +VOID +NPF_CloseAdapterComplete( + IN NDIS_HANDLE ProtocolBindingContext, + IN NDIS_STATUS Status + ); + +/*! + \brief Callback invoked by NDIS when a packet arrives from the network. + \param ProtocolBindingContext Context of the function. Points to a OPEN_INSTANCE structure that identifies + the NPF instance to which the packets are destined. + \param MacReceiveContext Handle that identifies the underlying NIC driver that generated the request. + This value must be used when the packet is transferred from the NIC driver with NdisTransferData(). + \param HeaderBuffer Pointer to the buffer in the NIC driver memory that contains the header of the packet. + \param HeaderBufferSize Size in bytes of the header. + \param LookAheadBuffer Pointer to the buffer in the NIC driver's memory that contains the incoming packet's + data available to NPF. This value does not necessarily coincide with the actual size of the packet, + since only a portion can be available at this time. The remaining portion can be obtained with the + NdisTransferData() NDIS function. + \param LookaheadBufferSize Size in bytes of the lookahead buffer. + \param PacketSize Total size of the incoming packet, excluded the header. + \return The status of the operation. See ntstatus.h in the DDK. + + NPF_tap() is called by the underlying NIC for every incoming packet. It is the most important and one of + the most complex functions of NPF: it executes the filter, runs the statistical engine (if the instance is in + statistical mode), gathers the timestamp, moves the packet in the buffer. NPF_tap() is the only function, + along with the filtering ones, that is executed for every incoming packet, therefore it is carefully + optimized. +*/ +NDIS_STATUS +NPF_tap( + IN NDIS_HANDLE ProtocolBindingContext, + IN NDIS_HANDLE MacReceiveContext, + IN PVOID HeaderBuffer, + IN UINT HeaderBufferSize, + IN PVOID LookAheadBuffer, + IN UINT LookaheadBufferSize, + IN UINT PacketSize + ); + +/*! + \brief Ends the transfer of a packet. + \param ProtocolBindingContext Context of the function. Contains a pointer to the OPEN_INSTANCE structure associated with the current instance. + \param Packet Pointer to the NDIS_PACKET structure that received the packet data. + \param Status Status of the transfer operation. + \param BytesTransferred Amount of bytes transferred. + + Callback function associated with the NdisTransferData() NDIS function. It is invoked by NDIS when the NIC + driver has finished the transfer of a packet from the NIC driver memory to the NPF circular buffer. +*/ +VOID +NPF_TransferDataComplete( + IN NDIS_HANDLE ProtocolBindingContext, + IN PNDIS_PACKET Packet, + IN NDIS_STATUS Status, + IN UINT BytesTransferred + ); + +/*! + \brief Callback function that signals the end of a packet reception. + \param ProtocolBindingContext Context of the function. Contains a pointer to the OPEN_INSTANCE structure associated with the current instance. + + does nothing in NPF +*/ +VOID +NPF_ReceiveComplete(IN NDIS_HANDLE ProtocolBindingContext); + +/*! + \brief Handles the IOCTL calls. + \param DeviceObject Pointer to the device object utilized by the user. + \param Irp Pointer to the IRP containing the user request. + \return The status of the operation. See ntstatus.h in the DDK. + + Once the packet capture driver is opened it can be configured from user-level applications with IOCTL commands + using the DeviceIoControl() system call. NPF_IoControl receives and serves all the IOCTL calls directed to NPF. + The following commands are recognized: + - #BIOCSETBUFFERSIZE + - #BIOCSETF + - #BIOCGSTATS + - #BIOCSRTIMEOUT + - #BIOCSMODE + - #BIOCSWRITEREP + - #BIOCSMINTOCOPY + - #BIOCSETOID + - #BIOCQUERYOID + - #BIOCSETDUMPFILENAME + - #BIOCGEVNAME + - #BIOCSENDPACKETSSYNC + - #BIOCSENDPACKETSNOSYNC +*/ +NTSTATUS +NPF_IoControl( + IN PDEVICE_OBJECT DeviceObject, + IN PIRP Irp + ); + +VOID + +/*! + \brief Ends an OID request. + \param ProtocolBindingContext Context of the function. Contains a pointer to the OPEN_INSTANCE structure associated with the current instance. + \param pRequest Pointer to the completed OID request. + \param Status Status of the operation. + + Callback function associated with the NdisRequest() NDIS function. It is invoked by NDIS when the NIC + driver has finished an OID request operation that was previously started by NPF_IoControl(). +*/ +NPF_RequestComplete( + IN NDIS_HANDLE ProtocolBindingContext, + IN PNDIS_REQUEST pRequest, + IN NDIS_STATUS Status + ); + +/*! + \brief Writes a raw packet to the network. + \param DeviceObject Pointer to the device object on which the user wrote the packet. + \param Irp Pointer to the IRP containing the user request. + \return The status of the operation. See ntstatus.h in the DDK. + + This function is called by the OS in consequence of user WriteFile() call, with the data of the packet that must + be sent on the net. The data is contained in the buffer associated with Irp, NPF_Write takes it and + delivers it to the NIC driver via the NdisSend() function. The Nwrites field of the OPEN_INSTANCE structure + associated with Irp indicates the number of copies of the packet that will be sent: more than one copy of the + packet can be sent for performance reasons. +*/ +NTSTATUS +NPF_Write( + IN PDEVICE_OBJECT DeviceObject, + IN PIRP Irp + ); + + +/*! + \brief Writes a buffer of raw packets to the network. + \param Irp Pointer to the IRP containing the user request. + \param UserBuff Pointer to the buffer containing the packets to send. + \param UserBuffSize Size of the buffer with the packets. + \return The amount of bytes actually sent. If the return value is smaller than the Size parameter, an + error occurred during the send. The error can be caused by an adapter problem or by an + inconsistent/bogus user buffer. + + This function is called by the OS in consequence of a BIOCSENDPACKETSNOSYNC or a BIOCSENDPACKETSSYNC IOCTL. + The buffer received as input parameter contains an arbitrary number of packets, each of which preceded by a + sf_pkthdr structure. NPF_BufferedWrite() scans the buffer and sends every packet via the NdisSend() function. + When Sync is set to TRUE, the packets are synchronized with the KeQueryPerformanceCounter() function. + This requires a remarkable amount of CPU, but allows to respect the timestamps associated with packets with a precision + of some microseconds (depending on the precision of the performance counter of the machine). + If Sync is false, the timestamps are ignored and the packets are sent as fat as possible. +*/ + +INT NPF_BufferedWrite(IN PIRP Irp, + IN PCHAR UserBuff, + IN ULONG UserBuffSize, + BOOLEAN sync); + +/*! + \brief Waits the completion of all the sends performed by NPF_BufferedWrite. + + \param Open Pointer to open context structure + + Used by NPF_BufferedWrite to wait the completion of all the sends before returning the control to the user. +*/ +VOID NPF_WaitEndOfBufferedWrite(POPEN_INSTANCE Open); + +/*! + \brief Ends a send operation. + \param ProtocolBindingContext Context of the function. Contains a pointer to the OPEN_INSTANCE structure associated with the current instance. + \param pRequest Pointer to the NDIS PACKET structure used by NPF_Write() to send the packet. + \param Status Status of the operation. + + Callback function associated with the NdisSend() NDIS function. It is invoked by NDIS when the NIC + driver has finished an OID request operation that was previously started by NPF_Write(). +*/ +VOID +NPF_SendComplete( + IN NDIS_HANDLE ProtocolBindingContext, + IN PNDIS_PACKET pPacket, + IN NDIS_STATUS Status + ); + +/*! + \brief Ends a reset of the adapter. + \param ProtocolBindingContext Context of the function. Contains a pointer to the OPEN_INSTANCE structure associated with the current instance. + \param Status Status of the operation. + + Callback function associated with the NdisReset() NDIS function. It is invoked by NDIS when the NIC + driver has finished an OID request operation that was previously started by NPF_IoControl(), in an IOCTL_PROTOCOL_RESET + command. +*/ +VOID +NPF_ResetComplete( + IN NDIS_HANDLE ProtocolBindingContext, + IN NDIS_STATUS Status + ); + +/*! + \brief Callback for NDIS StatusHandler. Not used by NPF +*/ +VOID +NPF_Status( + IN NDIS_HANDLE ProtocolBindingContext, + IN NDIS_STATUS Status, + IN PVOID StatusBuffer, + IN UINT StatusBufferSize + ); + + +/*! + \brief Callback for NDIS StatusCompleteHandler. Not used by NPF +*/ +VOID +NPF_StatusComplete(IN NDIS_HANDLE ProtocolBindingContext); + +/*! + \brief Function called by the OS when NPF is unloaded. + \param DriverObject The driver object of NPF created by the system. + + This is the last function executed when the driver is unloaded from the system. It frees global resources, + delete the devices and deregisters the protocol. The driver can be unloaded by the user stopping the NPF + service (from control panel or with a console 'net stop npf'). +*/ +VOID +NPF_Unload(IN PDRIVER_OBJECT DriverObject); + + +/*! + \brief Function that serves the user's reads. + \param DeviceObject Pointer to the device used by the user. + \param Irp Pointer to the IRP containing the user request. + \return The status of the operation. See ntstatus.h in the DDK. + + This function is called by the OS in consequence of user ReadFile() call. It moves the data present in the + kernel buffer to the user buffer associated with Irp. + First of all, NPF_Read checks the amount of data in kernel buffer associated with current NPF instance. + - If the instance is in capture mode and the buffer contains more than OPEN_INSTANCE::MinToCopy bytes, + NPF_Read moves the data in the user buffer and returns immediatly. In this way, the read performed by the + user is not blocking. + - If the buffer contains less than MinToCopy bytes, the application's request isn't + satisfied immediately, but it's blocked until at least MinToCopy bytes arrive from the net + or the timeout on this read expires. The timeout is kept in the OPEN_INSTANCE::TimeOut field. + - If the instance is in statistical mode or in dump mode, the application's request is blocked until the + timeout kept in OPEN_INSTANCE::TimeOut expires. +*/ +NTSTATUS +NPF_Read( + IN PDEVICE_OBJECT DeviceObject, + IN PIRP Irp + ); + +/*! + \brief Reads the registry keys associated woth NPF if the driver is manually installed via the control panel. + + Normally not used in recent versions of NPF. +*/ +NTSTATUS +NPF_ReadRegistry( + IN PWSTR *MacDriverName, + IN PWSTR *PacketDriverName, + IN PUNICODE_STRING RegistryPath + ); + +/*! + \brief Function used by NPF_ReadRegistry() to query the registry keys associated woth NPF if the driver + is manually installed via the control panel. + + Normally not used in recent versions of NPF. +*/ +NTSTATUS +NPF_QueryRegistryRoutine( + IN PWSTR ValueName, + IN ULONG ValueType, + IN PVOID ValueData, + IN ULONG ValueLength, + IN PVOID Context, + IN PVOID EntryContext + ); + +/*! + \brief Callback for NDIS BindAdapterHandler. Not used by NPF. + + Function called by NDIS when a new adapter is installed on the machine With Plug and Play. +*/ +VOID NPF_BindAdapter( + OUT PNDIS_STATUS Status, + IN NDIS_HANDLE BindContext, + IN PNDIS_STRING DeviceName, + IN PVOID SystemSpecific1, + IN PVOID SystemSpecific2 + ); + +/*! + \brief Callback for NDIS UnbindAdapterHandler. + \param Status out variable filled by NPF_UnbindAdapter with the status of the unbind operation. + \param ProtocolBindingContext Context of the function. Contains a pointer to the OPEN_INSTANCE structure associated with current instance. + \param UnbindContext Specifies a handle, supplied by NDIS, that NPF can use to complete the operation. + + Function called by NDIS when a new adapter is removed from the machine without shutting it down. + NPF_UnbindAdapter closes the adapter calling NdisCloseAdapter() and frees the memory and the structures + associated with it. It also releases the waiting user-level app and closes the dump thread if the instance + is in dump mode. +*/ +VOID +NPF_UnbindAdapter( + OUT PNDIS_STATUS Status, + IN NDIS_HANDLE ProtocolBindingContext, + IN NDIS_HANDLE UnbindContext + ); + + +/*! + \brief Creates the file that will receive the packets when the driver is in dump mode. + \param Open The NPF instance that opens the file. + \param fileName Pointer to a UNICODE string containing the name of the file. + \param append Boolean value that specifies if the data must be appended to the file. + \return The status of the operation. See ntstatus.h in the DDK. +*/ +NTSTATUS NPF_OpenDumpFile(POPEN_INSTANCE Open , PUNICODE_STRING fileName, BOOLEAN append); + +/*! + \brief Starts dump to file. + \param Open The NPF instance that opens the file. + \return The status of the operation. See ntstatus.h in the DDK. + + This function performs two operations. First, it writes the libpcap header at the beginning of the file. + Second, it starts the thread that asynchronously dumps the network data to the file. +*/ +NTSTATUS NPF_StartDump(POPEN_INSTANCE Open); + +/*! + \brief The dump thread. + \param Open The NPF instance that creates the thread. + + This function moves the content of the NPF kernel buffer to file. It runs in the user context, so at lower + priority than the TAP. +*/ +VOID NPF_DumpThread(PVOID Open); + +/*! + \brief Saves the content of the packet buffer to the file associated with current instance. + \param Open The NPF instance that creates the thread. + + Used by NPF_DumpThread() and NPF_CloseDumpFile(). +*/ +NTSTATUS NPF_SaveCurrentBuffer(POPEN_INSTANCE Open); + +/*! + \brief Writes a block of packets on the dump file. + \param FileObject The file object that will receive the packets. + \param Offset The offset in the file where the packets will be put. + \param Length The amount of bytes to write. + \param Mdl MDL mapping the memory buffer that will be written to disk. + \param IoStatusBlock Used by the function to return the status of the operation. + \return The status of the operation. See ntstatus.h in the DDK. + + NPF_WriteDumpFile addresses directly the file system, creating a custom IRP and using it to send a portion + of the NPF circular buffer to disk. This function is used by NPF_DumpThread(). +*/ +VOID NPF_WriteDumpFile(PFILE_OBJECT FileObject, + PLARGE_INTEGER Offset, + ULONG Length, + PMDL Mdl, + PIO_STATUS_BLOCK IoStatusBlock); + + + +/*! + \brief Closes the dump file associated with an instance of the driver. + \param Open The NPF instance that closes the file. + \return The status of the operation. See ntstatus.h in the DDK. +*/ +NTSTATUS NPF_CloseDumpFile(POPEN_INSTANCE Open); + +/*! + \brief Returns the amount of bytes present in the packet buffer. + \param Open The NPF instance that closes the file. +*/ +UINT GetBuffOccupation(POPEN_INSTANCE Open); + +/*! + \brief Called by NDIS to notify us of a PNP event. The most significant one for us is power state change. + + \param ProtocolBindingContext Pointer to open context structure. This is NULL for global reconfig + events. + \param pNetPnPEvent Pointer to the PnP event + + If there is a power state change, the driver is forced to resynchronize the global timer. + This hopefully avoids the synchronization issues caused by hibernation or standby. + This function is excluded from the NT4 driver, where PnP is not supported +*/ +#ifdef NDIS50 +NDIS_STATUS NPF_PowerChange(IN NDIS_HANDLE ProtocolBindingContext, IN PNET_PNP_EVENT pNetPnPEvent); +#endif + +/** + * @} + */ + +/** + * @} + */ + +#endif /*main ifndef/define*/ diff --git a/src/See/Packet32.h b/src/See/Packet32.h index 9ec26d97..f2e0ea27 100644 --- a/src/See/Packet32.h +++ b/src/See/Packet32.h @@ -1,423 +1,423 @@ -/* - * Copyright (c) 1999 - 2003 - * NetGroup, Politecnico di Torino (Italy) - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the Politecnico di Torino nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - */ - -/** @ingroup packetapi - * @{ - */ - -/** @defgroup packet32h Packet.dll definitions and data structures - * Packet32.h contains the data structures and the definitions used by packet.dll. - * The file is used both by the Win9x and the WinNTx versions of packet.dll, and can be included - * by the applications that use the functions of this library - * @{ - */ - -#ifndef __PACKET32 -#define __PACKET32 - -#include -#include "devioctl.h" -#ifdef HAVE_DAG_API -#include -#endif /* HAVE_DAG_API */ - -// Working modes -#define PACKET_MODE_CAPT 0x0 ///< Capture mode -#define PACKET_MODE_STAT 0x1 ///< Statistical mode -#define PACKET_MODE_MON 0x2 ///< Monitoring mode -#define PACKET_MODE_DUMP 0x10 ///< Dump mode -#define PACKET_MODE_STAT_DUMP MODE_DUMP | MODE_STAT ///< Statistical dump Mode - -// ioctls -#define FILE_DEVICE_PROTOCOL 0x8000 - -#define IOCTL_PROTOCOL_STATISTICS CTL_CODE(FILE_DEVICE_PROTOCOL, 2 , METHOD_BUFFERED, FILE_ANY_ACCESS) -#define IOCTL_PROTOCOL_RESET CTL_CODE(FILE_DEVICE_PROTOCOL, 3 , METHOD_BUFFERED, FILE_ANY_ACCESS) -#define IOCTL_PROTOCOL_READ CTL_CODE(FILE_DEVICE_PROTOCOL, 4 , METHOD_BUFFERED, FILE_ANY_ACCESS) -#define IOCTL_PROTOCOL_WRITE CTL_CODE(FILE_DEVICE_PROTOCOL, 5 , METHOD_BUFFERED, FILE_ANY_ACCESS) -#define IOCTL_PROTOCOL_MACNAME CTL_CODE(FILE_DEVICE_PROTOCOL, 6 , METHOD_BUFFERED, FILE_ANY_ACCESS) -#define IOCTL_OPEN CTL_CODE(FILE_DEVICE_PROTOCOL, 7 , METHOD_BUFFERED, FILE_ANY_ACCESS) -#define IOCTL_CLOSE CTL_CODE(FILE_DEVICE_PROTOCOL, 8 , METHOD_BUFFERED, FILE_ANY_ACCESS) - -#define pBIOCSETBUFFERSIZE 9592 ///< IOCTL code: set kernel buffer size. -#define pBIOCSETF 9030 ///< IOCTL code: set packet filtering program. -#define pBIOCGSTATS 9031 ///< IOCTL code: get the capture stats. -#define pBIOCSRTIMEOUT 7416 ///< IOCTL code: set the read timeout. -#define pBIOCSMODE 7412 ///< IOCTL code: set working mode. -#define pBIOCSWRITEREP 7413 ///< IOCTL code: set number of physical repetions of every packet written by the app. -#define pBIOCSMINTOCOPY 7414 ///< IOCTL code: set minimum amount of data in the kernel buffer that unlocks a read call. -#define pBIOCSETOID 2147483648 ///< IOCTL code: set an OID value. -#define pBIOCQUERYOID 2147483652 ///< IOCTL code: get an OID value. -#define pATTACHPROCESS 7117 ///< IOCTL code: attach a process to the driver. Used in Win9x only. -#define pDETACHPROCESS 7118 ///< IOCTL code: detach a process from the driver. Used in Win9x only. -#define pBIOCSETDUMPFILENAME 9029 ///< IOCTL code: set the name of a the file used by kernel dump mode. -#define pBIOCEVNAME 7415 ///< IOCTL code: get the name of the event that the driver signals when some data is present in the buffer. -#define pBIOCSENDPACKETSNOSYNC 9032 ///< IOCTL code: Send a buffer containing multiple packets to the network, ignoring the timestamps associated with the packets. -#define pBIOCSENDPACKETSSYNC 9033 ///< IOCTL code: Send a buffer containing multiple packets to the network, respecting the timestamps associated with the packets. -#define pBIOCSETDUMPLIMITS 9034 ///< IOCTL code: Set the dump file limits. See the PacketSetDumpLimits() function. -#define pBIOCISDUMPENDED 7411 ///< IOCTL code: Get the status of the kernel dump process. See the PacketIsDumpEnded() function. - -#define pBIOCSTIMEZONE 7471 ///< IOCTL code: set time zone. Used in Win9x only. - - -/// Alignment macro. Defines the alignment size. -#define Packet_ALIGNMENT sizeof(int) -/// Alignment macro. Rounds up to the next even multiple of Packet_ALIGNMENT. -#define Packet_WORDALIGN(x) (((x)+(Packet_ALIGNMENT-1))&~(Packet_ALIGNMENT-1)) - - -#define NdisMediumNull -1 // Custom linktype: NDIS doesn't provide an equivalent -#define NdisMediumCHDLC -2 // Custom linktype: NDIS doesn't provide an equivalent -#define NdisMediumPPPSerial -3 // Custom linktype: NDIS doesn't provide an equivalent - -/*! - \brief Network type structure. - - This structure is used by the PacketGetNetType() function to return information on the current adapter's type and speed. -*/ -typedef struct NetType -{ - UINT LinkType; ///< The MAC of the current network adapter (see function PacketGetNetType() for more information) - ULONGLONG LinkSpeed; ///< The speed of the network in bits per second -}NetType; - - -//some definitions stolen from libpcap - -#ifndef BPF_MAJOR_VERSION - -/*! - \brief A BPF pseudo-assembly program. - - The program will be injected in the kernel by the PacketSetBPF() function and applied to every incoming packet. -*/ -struct bpf_program -{ - UINT bf_len; ///< Indicates the number of instructions of the program, i.e. the number of struct bpf_insn that will follow. - struct bpf_insn *bf_insns; ///< A pointer to the first instruction of the program. -}; - -/*! - \brief A single BPF pseudo-instruction. - - bpf_insn contains a single instruction for the BPF register-machine. It is used to send a filter program to the driver. -*/ -struct bpf_insn -{ - USHORT code; ///< Instruction type and addressing mode. - UCHAR jt; ///< Jump if true - UCHAR jf; ///< Jump if false - int k; ///< Generic field used for various purposes. -}; - -/*! - \brief Structure that contains a couple of statistics values on the current capture. - - It is used by packet.dll to return statistics about a capture session. -*/ -struct bpf_stat -{ - UINT bs_recv; ///< Number of packets that the driver received from the network adapter - ///< from the beginning of the current capture. This value includes the packets - ///< lost by the driver. - UINT bs_drop; ///< number of packets that the driver lost from the beginning of a capture. - ///< Basically, a packet is lost when the the buffer of the driver is full. - ///< In this situation the packet cannot be stored and the driver rejects it. - UINT ps_ifdrop; ///< drops by interface. XXX not yet supported - UINT bs_capt; ///< number of packets that pass the filter, find place in the kernel buffer and - ///< thus reach the application. -}; - -/*! - \brief Packet header. - - This structure defines the header associated with every packet delivered to the application. -*/ -struct bpf_hdr -{ - struct timeval bh_tstamp; ///< The timestamp associated with the captured packet. - ///< It is stored in a TimeVal structure. - UINT bh_caplen; ///< Length of captured portion. The captured portion can be different - ///< from the original packet, because it is possible (with a proper filter) - ///< to instruct the driver to capture only a portion of the packets. - UINT bh_datalen; ///< Original length of packet - USHORT bh_hdrlen; ///< Length of bpf header (this struct plus alignment padding). In some cases, - ///< a padding could be added between the end of this structure and the packet - ///< data for performance reasons. This filed can be used to retrieve the actual data - ///< of the packet. -}; - -/*! - \brief Dump packet header. - - This structure defines the header associated with the packets in a buffer to be used with PacketSendPackets(). - It is simpler than the bpf_hdr, because it corresponds to the header associated by WinPcap and libpcap to a - packet in a dump file. This makes straightforward sending WinPcap dump files to the network. -*/ -struct dump_bpf_hdr{ - struct timeval ts; ///< Time stamp of the packet - UINT caplen; ///< Length of captured portion. The captured portion can smaller than the - ///< the original packet, because it is possible (with a proper filter) to - ///< instruct the driver to capture only a portion of the packets. - UINT len; ///< Length of the original packet (off wire). -}; - - -#endif - -#define DOSNAMEPREFIX TEXT("Packet_") ///< Prefix added to the adapters device names to create the WinPcap devices -#define MAX_LINK_NAME_LENGTH 64 //< Maximum length of the devices symbolic links -#define NMAX_PACKET 65535 - -/*! - \brief Addresses of a network adapter. - - This structure is used by the PacketGetNetInfoEx() function to return the IP addresses associated with - an adapter. -*/ -typedef struct npf_if_addr { - struct sockaddr_storage IPAddress; ///< IP address. - struct sockaddr_storage SubnetMask; ///< Netmask for that address. - struct sockaddr_storage Broadcast; ///< Broadcast address. -}npf_if_addr; - - -#define ADAPTER_NAME_LENGTH 256 + 12 ///< Maximum length for the name of an adapter. The value is the same used by the IP Helper API. -#define ADAPTER_DESC_LENGTH 128 ///< Maximum length for the description of an adapter. The value is the same used by the IP Helper API. -#define MAX_MAC_ADDR_LENGTH 8 ///< Maximum length for the link layer address of an adapter. The value is the same used by the IP Helper API. -#define MAX_NETWORK_ADDRESSES 16 ///< Maximum length for the link layer address of an adapter. The value is the same used by the IP Helper API. - - -typedef struct WAN_ADAPTER_INT WAN_ADAPTER; ///< Describes an opened wan (dialup, VPN...) network adapter using the NetMon API -typedef WAN_ADAPTER *PWAN_ADAPTER; ///< Describes an opened wan (dialup, VPN...) network adapter using the NetMon API - -#define INFO_FLAG_NDIS_ADAPTER 0 ///< Flag for ADAPTER_INFO: this is a traditional ndis adapter -#define INFO_FLAG_NDISWAN_ADAPTER 1 ///< Flag for ADAPTER_INFO: this is a NdisWan adapter -#define INFO_FLAG_DAG_CARD 2 ///< Flag for ADAPTER_INFO: this is a DAG card -#define INFO_FLAG_DAG_FILE 6 ///< Flag for ADAPTER_INFO: this is a DAG file -#define INFO_FLAG_DONT_EXPORT 8 ///< Flag for ADAPTER_INFO: when this flag is set, the adapter will not be listed or openend by winpcap. This allows to prevent exporting broken network adapters, like for example FireWire ones. - -/*! - \brief Contains comprehensive information about a network adapter. - - This structure is filled with all the accessory information that the user can need about an adapter installed - on his system. -*/ -typedef struct _ADAPTER_INFO -{ - struct _ADAPTER_INFO *Next; ///< Pointer to the next adapter in the list. - CHAR Name[ADAPTER_NAME_LENGTH + 1]; ///< Name of the device representing the adapter. - CHAR Description[ADAPTER_DESC_LENGTH + 1]; ///< Human understandable description of the adapter - UINT MacAddressLen; ///< Length of the link layer address. - UCHAR MacAddress[MAX_MAC_ADDR_LENGTH]; ///< Link layer address. - NetType LinkLayer; ///< Physical characteristics of this adapter. This NetType structure contains the link type and the speed of the adapter. - INT NNetworkAddresses; ///< Number of network layer addresses of this adapter. - npf_if_addr *NetworkAddresses; ///< Pointer to an array of npf_if_addr, each of which specifies a network address of this adapter. - UINT Flags; ///< Adapter's flags. Tell if this adapter must be treated in a different way, using the Netmon API or the dagc API. -} -ADAPTER_INFO, *PADAPTER_INFO; - -/*! - \brief Describes an opened network adapter. - - This structure is the most important for the functioning of packet.dll, but the great part of its fields - should be ignored by the user, since the library offers functions that avoid to cope with low-level parameters -*/ -typedef struct _ADAPTER { - HANDLE hFile; ///< \internal Handle to an open instance of the NPF driver. - CHAR SymbolicLink[MAX_LINK_NAME_LENGTH]; ///< \internal A string containing the name of the network adapter currently opened. - int NumWrites; ///< \internal Number of times a packets written on this adapter will be repeated - ///< on the wire. - HANDLE ReadEvent; ///< A notification event associated with the read calls on the adapter. - ///< It can be passed to standard Win32 functions (like WaitForSingleObject - ///< or WaitForMultipleObjects) to wait until the driver's buffer contains some - ///< data. It is particularly useful in GUI applications that need to wait - ///< concurrently on several events. In Windows NT/2000 the PacketSetMinToCopy() - ///< function can be used to define the minimum amount of data in the kernel buffer - ///< that will cause the event to be signalled. - - UINT ReadTimeOut; ///< \internal The amount of time after which a read on the driver will be released and - ///< ReadEvent will be signaled, also if no packets were captured - CHAR Name[ADAPTER_NAME_LENGTH]; - PWAN_ADAPTER pWanAdapter; - UINT Flags; ///< Adapter's flags. Tell if this adapter must be treated in a different way, using the Netmon API or the dagc API. -#ifdef HAVE_DAG_API - dagc_t *pDagCard; ///< Pointer to the dagc API adapter descriptor for this adapter - PCHAR DagBuffer; ///< Pointer to the buffer with the packets that is received from the DAG card - struct timeval DagReadTimeout; ///< Read timeout. The dagc API requires a timeval structure - unsigned DagFcsLen; ///< Length of the frame check sequence attached to any packet by the card. Obtained from the registry - DWORD DagFastProcess; ///< True if the user requests fast capture processing on this card. Higher level applications can use this value to provide a faster but possibly unprecise capture (for example, libpcap doesn't convert the timestamps). -#endif // HAVE_DAG_API -} ADAPTER, *LPADAPTER; - -/*! - \brief Structure that contains a group of packets coming from the driver. - - This structure defines the header associated with every packet delivered to the application. -*/ -typedef struct _PACKET { - HANDLE hEvent; ///< \deprecated Still present for compatibility with old applications. - OVERLAPPED OverLapped; ///< \deprecated Still present for compatibility with old applications. - PVOID Buffer; ///< Buffer with containing the packets. See the PacketReceivePacket() for - ///< details about the organization of the data in this buffer - UINT Length; ///< Length of the buffer - DWORD ulBytesReceived; ///< Number of valid bytes present in the buffer, i.e. amount of data - ///< received by the last call to PacketReceivePacket() - BOOLEAN bIoComplete; ///< \deprecated Still present for compatibility with old applications. -} PACKET, *LPPACKET; - -/*! - \brief Structure containing an OID request. - - It is used by the PacketRequest() function to send an OID to the interface card driver. - It can be used, for example, to retrieve the status of the error counters on the adapter, its MAC address, - the list of the multicast groups defined on it, and so on. -*/ -struct _PACKET_OID_DATA { - ULONG Oid; ///< OID code. See the Microsoft DDK documentation or the file ntddndis.h - ///< for a complete list of valid codes. - ULONG Length; ///< Length of the data field - UCHAR Data[1]; ///< variable-length field that contains the information passed to or received - ///< from the adapter. -}; -typedef struct _PACKET_OID_DATA PACKET_OID_DATA, *PPACKET_OID_DATA; - - -#if _DBG -#define ODS(_x) OutputDebugString(TEXT(_x)) -#define ODSEx(_x, _y) -#else -#ifdef _DEBUG_TO_FILE -/*! - \brief Macro to print a debug string. The behavior differs depending on the debug level -*/ -#define ODS(_x) { \ - FILE *f; \ - f = fopen("winpcap_debug.txt", "a"); \ - fprintf(f, "%s", _x); \ - fclose(f); \ -} -/*! - \brief Macro to print debug data with the printf convention. The behavior differs depending on - the debug level -*/ -#define ODSEx(_x, _y) { \ - FILE *f; \ - f = fopen("winpcap_debug.txt", "a"); \ - fprintf(f, _x, _y); \ - fclose(f); \ -} - - - -LONG PacketDumpRegistryKey(PCHAR KeyName, PCHAR FileName); -#else -#define ODS(_x) -#define ODSEx(_x, _y) -#endif -#endif - -/* We load dynamically the dag library in order link it only when it's present on the system */ -#ifdef HAVE_DAG_API -typedef dagc_t* (*dagc_open_handler)(const char *source, unsigned flags, char *ebuf); ///< prototype used to dynamically load the dag dll -typedef void (*dagc_close_handler)(dagc_t *dagcfd); ///< prototype used to dynamically load the dag dll -typedef int (*dagc_getlinktype_handler)(dagc_t *dagcfd); ///< prototype used to dynamically load the dag dll -typedef int (*dagc_getlinkspeed_handler)(dagc_t *dagcfd); ///< prototype used to dynamically load the dag dll -typedef int (*dagc_setsnaplen_handler)(dagc_t *dagcfd, unsigned snaplen); ///< prototype used to dynamically load the dag dll -typedef unsigned (*dagc_getfcslen_handler)(dagc_t *dagcfd); ///< prototype used to dynamically load the dag dll -typedef int (*dagc_receive_handler)(dagc_t *dagcfd, u_char **buffer, u_int *bufsize); ///< prototype used to dynamically load the dag dll -typedef int (*dagc_stats_handler)(dagc_t *dagcfd, dagc_stats_t *ps); ///< prototype used to dynamically load the dag dll -typedef int (*dagc_wait_handler)(dagc_t *dagcfd, struct timeval *timeout); ///< prototype used to dynamically load the dag dll -typedef int (*dagc_finddevs_handler)(dagc_if_t **alldevsp, char *ebuf); ///< prototype used to dynamically load the dag dll -typedef int (*dagc_freedevs_handler)(dagc_if_t *alldevsp); ///< prototype used to dynamically load the dag dll -#endif // HAVE_DAG_API - -#ifdef __cplusplus -extern "C" { -#endif - -/** - * @} - */ - -// The following is used to check the adapter name in PacketOpenAdapterNPF and prevent -// opening of firewire adapters -#define FIREWIRE_SUBSTR L"1394" - -void PacketPopulateAdaptersInfoList(); -PWCHAR SChar2WChar(PCHAR string); -PCHAR WChar2SChar(PWCHAR string); -BOOL PacketGetFileVersion(LPTSTR FileName, PCHAR VersionBuff, UINT VersionBuffLen); -PADAPTER_INFO PacketFindAdInfo(PCHAR AdapterName); -BOOLEAN PacketUpdateAdInfo(PCHAR AdapterName); -BOOLEAN IsFireWire(TCHAR *AdapterDesc); - - -//--------------------------------------------------------------------------- -// EXPORTED FUNCTIONS -//--------------------------------------------------------------------------- - -PCHAR PacketGetVersion(); -PCHAR PacketGetDriverVersion(); -BOOLEAN PacketSetMinToCopy(LPADAPTER AdapterObject,int nbytes); -BOOLEAN PacketSetNumWrites(LPADAPTER AdapterObject,int nwrites); -BOOLEAN PacketSetMode(LPADAPTER AdapterObject,int mode); -BOOLEAN PacketSetReadTimeout(LPADAPTER AdapterObject,int timeout); -BOOLEAN PacketSetBpf(LPADAPTER AdapterObject,struct bpf_program *fp); -INT PacketSetSnapLen(LPADAPTER AdapterObject,int snaplen); -BOOLEAN PacketGetStats(LPADAPTER AdapterObject,struct bpf_stat *s); -BOOLEAN PacketGetStatsEx(LPADAPTER AdapterObject,struct bpf_stat *s); -BOOLEAN PacketSetBuff(LPADAPTER AdapterObject,int dim); -BOOLEAN PacketGetNetType (LPADAPTER AdapterObject,NetType *type); -LPADAPTER PacketOpenAdapter(PCHAR AdapterName); -BOOLEAN PacketSendPacket(LPADAPTER AdapterObject,LPPACKET pPacket,BOOLEAN Sync); -INT PacketSendPackets(LPADAPTER AdapterObject,PVOID PacketBuff,ULONG Size, BOOLEAN Sync); -LPPACKET PacketAllocatePacket(void); -VOID PacketInitPacket(LPPACKET lpPacket,PVOID Buffer,UINT Length); -VOID PacketFreePacket(LPPACKET lpPacket); -BOOLEAN PacketReceivePacket(LPADAPTER AdapterObject,LPPACKET lpPacket,BOOLEAN Sync); -BOOLEAN PacketSetHwFilter(LPADAPTER AdapterObject,ULONG Filter); -BOOLEAN PacketGetAdapterNames(PTSTR pStr,PULONG BufferSize); -BOOLEAN PacketGetNetInfoEx(PCHAR AdapterName, npf_if_addr* buffer, PLONG NEntries); -BOOLEAN PacketRequest(LPADAPTER AdapterObject,BOOLEAN Set,PPACKET_OID_DATA OidData); -HANDLE PacketGetReadEvent(LPADAPTER AdapterObject); -BOOLEAN PacketSetDumpName(LPADAPTER AdapterObject, void *name, int len); -BOOLEAN PacketSetDumpLimits(LPADAPTER AdapterObject, UINT maxfilesize, UINT maxnpacks); -BOOLEAN PacketIsDumpEnded(LPADAPTER AdapterObject, BOOLEAN sync); -BOOL PacketStopDriver(); -VOID PacketCloseAdapter(LPADAPTER lpAdapter); - -#ifdef __cplusplus -} -#endif - -#endif //__PACKET32 +/* + * Copyright (c) 1999 - 2003 + * NetGroup, Politecnico di Torino (Italy) + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the Politecnico di Torino nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +/** @ingroup packetapi + * @{ + */ + +/** @defgroup packet32h Packet.dll definitions and data structures + * Packet32.h contains the data structures and the definitions used by packet.dll. + * The file is used both by the Win9x and the WinNTx versions of packet.dll, and can be included + * by the applications that use the functions of this library + * @{ + */ + +#ifndef __PACKET32 +#define __PACKET32 + +#include +#include "devioctl.h" +#ifdef HAVE_DAG_API +#include +#endif /* HAVE_DAG_API */ + +// Working modes +#define PACKET_MODE_CAPT 0x0 ///< Capture mode +#define PACKET_MODE_STAT 0x1 ///< Statistical mode +#define PACKET_MODE_MON 0x2 ///< Monitoring mode +#define PACKET_MODE_DUMP 0x10 ///< Dump mode +#define PACKET_MODE_STAT_DUMP MODE_DUMP | MODE_STAT ///< Statistical dump Mode + +// ioctls +#define FILE_DEVICE_PROTOCOL 0x8000 + +#define IOCTL_PROTOCOL_STATISTICS CTL_CODE(FILE_DEVICE_PROTOCOL, 2 , METHOD_BUFFERED, FILE_ANY_ACCESS) +#define IOCTL_PROTOCOL_RESET CTL_CODE(FILE_DEVICE_PROTOCOL, 3 , METHOD_BUFFERED, FILE_ANY_ACCESS) +#define IOCTL_PROTOCOL_READ CTL_CODE(FILE_DEVICE_PROTOCOL, 4 , METHOD_BUFFERED, FILE_ANY_ACCESS) +#define IOCTL_PROTOCOL_WRITE CTL_CODE(FILE_DEVICE_PROTOCOL, 5 , METHOD_BUFFERED, FILE_ANY_ACCESS) +#define IOCTL_PROTOCOL_MACNAME CTL_CODE(FILE_DEVICE_PROTOCOL, 6 , METHOD_BUFFERED, FILE_ANY_ACCESS) +#define IOCTL_OPEN CTL_CODE(FILE_DEVICE_PROTOCOL, 7 , METHOD_BUFFERED, FILE_ANY_ACCESS) +#define IOCTL_CLOSE CTL_CODE(FILE_DEVICE_PROTOCOL, 8 , METHOD_BUFFERED, FILE_ANY_ACCESS) + +#define pBIOCSETBUFFERSIZE 9592 ///< IOCTL code: set kernel buffer size. +#define pBIOCSETF 9030 ///< IOCTL code: set packet filtering program. +#define pBIOCGSTATS 9031 ///< IOCTL code: get the capture stats. +#define pBIOCSRTIMEOUT 7416 ///< IOCTL code: set the read timeout. +#define pBIOCSMODE 7412 ///< IOCTL code: set working mode. +#define pBIOCSWRITEREP 7413 ///< IOCTL code: set number of physical repetions of every packet written by the app. +#define pBIOCSMINTOCOPY 7414 ///< IOCTL code: set minimum amount of data in the kernel buffer that unlocks a read call. +#define pBIOCSETOID 2147483648 ///< IOCTL code: set an OID value. +#define pBIOCQUERYOID 2147483652 ///< IOCTL code: get an OID value. +#define pATTACHPROCESS 7117 ///< IOCTL code: attach a process to the driver. Used in Win9x only. +#define pDETACHPROCESS 7118 ///< IOCTL code: detach a process from the driver. Used in Win9x only. +#define pBIOCSETDUMPFILENAME 9029 ///< IOCTL code: set the name of a the file used by kernel dump mode. +#define pBIOCEVNAME 7415 ///< IOCTL code: get the name of the event that the driver signals when some data is present in the buffer. +#define pBIOCSENDPACKETSNOSYNC 9032 ///< IOCTL code: Send a buffer containing multiple packets to the network, ignoring the timestamps associated with the packets. +#define pBIOCSENDPACKETSSYNC 9033 ///< IOCTL code: Send a buffer containing multiple packets to the network, respecting the timestamps associated with the packets. +#define pBIOCSETDUMPLIMITS 9034 ///< IOCTL code: Set the dump file limits. See the PacketSetDumpLimits() function. +#define pBIOCISDUMPENDED 7411 ///< IOCTL code: Get the status of the kernel dump process. See the PacketIsDumpEnded() function. + +#define pBIOCSTIMEZONE 7471 ///< IOCTL code: set time zone. Used in Win9x only. + + +/// Alignment macro. Defines the alignment size. +#define Packet_ALIGNMENT sizeof(int) +/// Alignment macro. Rounds up to the next even multiple of Packet_ALIGNMENT. +#define Packet_WORDALIGN(x) (((x)+(Packet_ALIGNMENT-1))&~(Packet_ALIGNMENT-1)) + + +#define NdisMediumNull -1 // Custom linktype: NDIS doesn't provide an equivalent +#define NdisMediumCHDLC -2 // Custom linktype: NDIS doesn't provide an equivalent +#define NdisMediumPPPSerial -3 // Custom linktype: NDIS doesn't provide an equivalent + +/*! + \brief Network type structure. + + This structure is used by the PacketGetNetType() function to return information on the current adapter's type and speed. +*/ +typedef struct NetType +{ + UINT LinkType; ///< The MAC of the current network adapter (see function PacketGetNetType() for more information) + ULONGLONG LinkSpeed; ///< The speed of the network in bits per second +}NetType; + + +//some definitions stolen from libpcap + +#ifndef BPF_MAJOR_VERSION + +/*! + \brief A BPF pseudo-assembly program. + + The program will be injected in the kernel by the PacketSetBPF() function and applied to every incoming packet. +*/ +struct bpf_program +{ + UINT bf_len; ///< Indicates the number of instructions of the program, i.e. the number of struct bpf_insn that will follow. + struct bpf_insn *bf_insns; ///< A pointer to the first instruction of the program. +}; + +/*! + \brief A single BPF pseudo-instruction. + + bpf_insn contains a single instruction for the BPF register-machine. It is used to send a filter program to the driver. +*/ +struct bpf_insn +{ + USHORT code; ///< Instruction type and addressing mode. + UCHAR jt; ///< Jump if true + UCHAR jf; ///< Jump if false + int k; ///< Generic field used for various purposes. +}; + +/*! + \brief Structure that contains a couple of statistics values on the current capture. + + It is used by packet.dll to return statistics about a capture session. +*/ +struct bpf_stat +{ + UINT bs_recv; ///< Number of packets that the driver received from the network adapter + ///< from the beginning of the current capture. This value includes the packets + ///< lost by the driver. + UINT bs_drop; ///< number of packets that the driver lost from the beginning of a capture. + ///< Basically, a packet is lost when the the buffer of the driver is full. + ///< In this situation the packet cannot be stored and the driver rejects it. + UINT ps_ifdrop; ///< drops by interface. XXX not yet supported + UINT bs_capt; ///< number of packets that pass the filter, find place in the kernel buffer and + ///< thus reach the application. +}; + +/*! + \brief Packet header. + + This structure defines the header associated with every packet delivered to the application. +*/ +struct bpf_hdr +{ + struct timeval bh_tstamp; ///< The timestamp associated with the captured packet. + ///< It is stored in a TimeVal structure. + UINT bh_caplen; ///< Length of captured portion. The captured portion can be different + ///< from the original packet, because it is possible (with a proper filter) + ///< to instruct the driver to capture only a portion of the packets. + UINT bh_datalen; ///< Original length of packet + USHORT bh_hdrlen; ///< Length of bpf header (this struct plus alignment padding). In some cases, + ///< a padding could be added between the end of this structure and the packet + ///< data for performance reasons. This filed can be used to retrieve the actual data + ///< of the packet. +}; + +/*! + \brief Dump packet header. + + This structure defines the header associated with the packets in a buffer to be used with PacketSendPackets(). + It is simpler than the bpf_hdr, because it corresponds to the header associated by WinPcap and libpcap to a + packet in a dump file. This makes straightforward sending WinPcap dump files to the network. +*/ +struct dump_bpf_hdr{ + struct timeval ts; ///< Time stamp of the packet + UINT caplen; ///< Length of captured portion. The captured portion can smaller than the + ///< the original packet, because it is possible (with a proper filter) to + ///< instruct the driver to capture only a portion of the packets. + UINT len; ///< Length of the original packet (off wire). +}; + + +#endif + +#define DOSNAMEPREFIX TEXT("Packet_") ///< Prefix added to the adapters device names to create the WinPcap devices +#define MAX_LINK_NAME_LENGTH 64 //< Maximum length of the devices symbolic links +#define NMAX_PACKET 65535 + +/*! + \brief Addresses of a network adapter. + + This structure is used by the PacketGetNetInfoEx() function to return the IP addresses associated with + an adapter. +*/ +typedef struct npf_if_addr { + struct sockaddr_storage IPAddress; ///< IP address. + struct sockaddr_storage SubnetMask; ///< Netmask for that address. + struct sockaddr_storage Broadcast; ///< Broadcast address. +}npf_if_addr; + + +#define ADAPTER_NAME_LENGTH 256 + 12 ///< Maximum length for the name of an adapter. The value is the same used by the IP Helper API. +#define ADAPTER_DESC_LENGTH 128 ///< Maximum length for the description of an adapter. The value is the same used by the IP Helper API. +#define MAX_MAC_ADDR_LENGTH 8 ///< Maximum length for the link layer address of an adapter. The value is the same used by the IP Helper API. +#define MAX_NETWORK_ADDRESSES 16 ///< Maximum length for the link layer address of an adapter. The value is the same used by the IP Helper API. + + +typedef struct WAN_ADAPTER_INT WAN_ADAPTER; ///< Describes an opened wan (dialup, VPN...) network adapter using the NetMon API +typedef WAN_ADAPTER *PWAN_ADAPTER; ///< Describes an opened wan (dialup, VPN...) network adapter using the NetMon API + +#define INFO_FLAG_NDIS_ADAPTER 0 ///< Flag for ADAPTER_INFO: this is a traditional ndis adapter +#define INFO_FLAG_NDISWAN_ADAPTER 1 ///< Flag for ADAPTER_INFO: this is a NdisWan adapter +#define INFO_FLAG_DAG_CARD 2 ///< Flag for ADAPTER_INFO: this is a DAG card +#define INFO_FLAG_DAG_FILE 6 ///< Flag for ADAPTER_INFO: this is a DAG file +#define INFO_FLAG_DONT_EXPORT 8 ///< Flag for ADAPTER_INFO: when this flag is set, the adapter will not be listed or openend by winpcap. This allows to prevent exporting broken network adapters, like for example FireWire ones. + +/*! + \brief Contains comprehensive information about a network adapter. + + This structure is filled with all the accessory information that the user can need about an adapter installed + on his system. +*/ +typedef struct _ADAPTER_INFO +{ + struct _ADAPTER_INFO *Next; ///< Pointer to the next adapter in the list. + CHAR Name[ADAPTER_NAME_LENGTH + 1]; ///< Name of the device representing the adapter. + CHAR Description[ADAPTER_DESC_LENGTH + 1]; ///< Human understandable description of the adapter + UINT MacAddressLen; ///< Length of the link layer address. + UCHAR MacAddress[MAX_MAC_ADDR_LENGTH]; ///< Link layer address. + NetType LinkLayer; ///< Physical characteristics of this adapter. This NetType structure contains the link type and the speed of the adapter. + INT NNetworkAddresses; ///< Number of network layer addresses of this adapter. + npf_if_addr *NetworkAddresses; ///< Pointer to an array of npf_if_addr, each of which specifies a network address of this adapter. + UINT Flags; ///< Adapter's flags. Tell if this adapter must be treated in a different way, using the Netmon API or the dagc API. +} +ADAPTER_INFO, *PADAPTER_INFO; + +/*! + \brief Describes an opened network adapter. + + This structure is the most important for the functioning of packet.dll, but the great part of its fields + should be ignored by the user, since the library offers functions that avoid to cope with low-level parameters +*/ +typedef struct _ADAPTER { + HANDLE hFile; ///< \internal Handle to an open instance of the NPF driver. + CHAR SymbolicLink[MAX_LINK_NAME_LENGTH]; ///< \internal A string containing the name of the network adapter currently opened. + int NumWrites; ///< \internal Number of times a packets written on this adapter will be repeated + ///< on the wire. + HANDLE ReadEvent; ///< A notification event associated with the read calls on the adapter. + ///< It can be passed to standard Win32 functions (like WaitForSingleObject + ///< or WaitForMultipleObjects) to wait until the driver's buffer contains some + ///< data. It is particularly useful in GUI applications that need to wait + ///< concurrently on several events. In Windows NT/2000 the PacketSetMinToCopy() + ///< function can be used to define the minimum amount of data in the kernel buffer + ///< that will cause the event to be signalled. + + UINT ReadTimeOut; ///< \internal The amount of time after which a read on the driver will be released and + ///< ReadEvent will be signaled, also if no packets were captured + CHAR Name[ADAPTER_NAME_LENGTH]; + PWAN_ADAPTER pWanAdapter; + UINT Flags; ///< Adapter's flags. Tell if this adapter must be treated in a different way, using the Netmon API or the dagc API. +#ifdef HAVE_DAG_API + dagc_t *pDagCard; ///< Pointer to the dagc API adapter descriptor for this adapter + PCHAR DagBuffer; ///< Pointer to the buffer with the packets that is received from the DAG card + struct timeval DagReadTimeout; ///< Read timeout. The dagc API requires a timeval structure + unsigned DagFcsLen; ///< Length of the frame check sequence attached to any packet by the card. Obtained from the registry + DWORD DagFastProcess; ///< True if the user requests fast capture processing on this card. Higher level applications can use this value to provide a faster but possibly unprecise capture (for example, libpcap doesn't convert the timestamps). +#endif // HAVE_DAG_API +} ADAPTER, *LPADAPTER; + +/*! + \brief Structure that contains a group of packets coming from the driver. + + This structure defines the header associated with every packet delivered to the application. +*/ +typedef struct _PACKET { + HANDLE hEvent; ///< \deprecated Still present for compatibility with old applications. + OVERLAPPED OverLapped; ///< \deprecated Still present for compatibility with old applications. + PVOID Buffer; ///< Buffer with containing the packets. See the PacketReceivePacket() for + ///< details about the organization of the data in this buffer + UINT Length; ///< Length of the buffer + DWORD ulBytesReceived; ///< Number of valid bytes present in the buffer, i.e. amount of data + ///< received by the last call to PacketReceivePacket() + BOOLEAN bIoComplete; ///< \deprecated Still present for compatibility with old applications. +} PACKET, *LPPACKET; + +/*! + \brief Structure containing an OID request. + + It is used by the PacketRequest() function to send an OID to the interface card driver. + It can be used, for example, to retrieve the status of the error counters on the adapter, its MAC address, + the list of the multicast groups defined on it, and so on. +*/ +struct _PACKET_OID_DATA { + ULONG Oid; ///< OID code. See the Microsoft DDK documentation or the file ntddndis.h + ///< for a complete list of valid codes. + ULONG Length; ///< Length of the data field + UCHAR Data[1]; ///< variable-length field that contains the information passed to or received + ///< from the adapter. +}; +typedef struct _PACKET_OID_DATA PACKET_OID_DATA, *PPACKET_OID_DATA; + + +#if _DBG +#define ODS(_x) OutputDebugString(TEXT(_x)) +#define ODSEx(_x, _y) +#else +#ifdef _DEBUG_TO_FILE +/*! + \brief Macro to print a debug string. The behavior differs depending on the debug level +*/ +#define ODS(_x) { \ + FILE *f; \ + f = fopen("winpcap_debug.txt", "a"); \ + fprintf(f, "%s", _x); \ + fclose(f); \ +} +/*! + \brief Macro to print debug data with the printf convention. The behavior differs depending on + the debug level +*/ +#define ODSEx(_x, _y) { \ + FILE *f; \ + f = fopen("winpcap_debug.txt", "a"); \ + fprintf(f, _x, _y); \ + fclose(f); \ +} + + + +LONG PacketDumpRegistryKey(PCHAR KeyName, PCHAR FileName); +#else +#define ODS(_x) +#define ODSEx(_x, _y) +#endif +#endif + +/* We load dynamically the dag library in order link it only when it's present on the system */ +#ifdef HAVE_DAG_API +typedef dagc_t* (*dagc_open_handler)(const char *source, unsigned flags, char *ebuf); ///< prototype used to dynamically load the dag dll +typedef void (*dagc_close_handler)(dagc_t *dagcfd); ///< prototype used to dynamically load the dag dll +typedef int (*dagc_getlinktype_handler)(dagc_t *dagcfd); ///< prototype used to dynamically load the dag dll +typedef int (*dagc_getlinkspeed_handler)(dagc_t *dagcfd); ///< prototype used to dynamically load the dag dll +typedef int (*dagc_setsnaplen_handler)(dagc_t *dagcfd, unsigned snaplen); ///< prototype used to dynamically load the dag dll +typedef unsigned (*dagc_getfcslen_handler)(dagc_t *dagcfd); ///< prototype used to dynamically load the dag dll +typedef int (*dagc_receive_handler)(dagc_t *dagcfd, u_char **buffer, u_int *bufsize); ///< prototype used to dynamically load the dag dll +typedef int (*dagc_stats_handler)(dagc_t *dagcfd, dagc_stats_t *ps); ///< prototype used to dynamically load the dag dll +typedef int (*dagc_wait_handler)(dagc_t *dagcfd, struct timeval *timeout); ///< prototype used to dynamically load the dag dll +typedef int (*dagc_finddevs_handler)(dagc_if_t **alldevsp, char *ebuf); ///< prototype used to dynamically load the dag dll +typedef int (*dagc_freedevs_handler)(dagc_if_t *alldevsp); ///< prototype used to dynamically load the dag dll +#endif // HAVE_DAG_API + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * @} + */ + +// The following is used to check the adapter name in PacketOpenAdapterNPF and prevent +// opening of firewire adapters +#define FIREWIRE_SUBSTR L"1394" + +void PacketPopulateAdaptersInfoList(); +PWCHAR SChar2WChar(PCHAR string); +PCHAR WChar2SChar(PWCHAR string); +BOOL PacketGetFileVersion(LPTSTR FileName, PCHAR VersionBuff, UINT VersionBuffLen); +PADAPTER_INFO PacketFindAdInfo(PCHAR AdapterName); +BOOLEAN PacketUpdateAdInfo(PCHAR AdapterName); +BOOLEAN IsFireWire(TCHAR *AdapterDesc); + + +//--------------------------------------------------------------------------- +// EXPORTED FUNCTIONS +//--------------------------------------------------------------------------- + +PCHAR PacketGetVersion(); +PCHAR PacketGetDriverVersion(); +BOOLEAN PacketSetMinToCopy(LPADAPTER AdapterObject,int nbytes); +BOOLEAN PacketSetNumWrites(LPADAPTER AdapterObject,int nwrites); +BOOLEAN PacketSetMode(LPADAPTER AdapterObject,int mode); +BOOLEAN PacketSetReadTimeout(LPADAPTER AdapterObject,int timeout); +BOOLEAN PacketSetBpf(LPADAPTER AdapterObject,struct bpf_program *fp); +INT PacketSetSnapLen(LPADAPTER AdapterObject,int snaplen); +BOOLEAN PacketGetStats(LPADAPTER AdapterObject,struct bpf_stat *s); +BOOLEAN PacketGetStatsEx(LPADAPTER AdapterObject,struct bpf_stat *s); +BOOLEAN PacketSetBuff(LPADAPTER AdapterObject,int dim); +BOOLEAN PacketGetNetType (LPADAPTER AdapterObject,NetType *type); +LPADAPTER PacketOpenAdapter(PCHAR AdapterName); +BOOLEAN PacketSendPacket(LPADAPTER AdapterObject,LPPACKET pPacket,BOOLEAN Sync); +INT PacketSendPackets(LPADAPTER AdapterObject,PVOID PacketBuff,ULONG Size, BOOLEAN Sync); +LPPACKET PacketAllocatePacket(void); +VOID PacketInitPacket(LPPACKET lpPacket,PVOID Buffer,UINT Length); +VOID PacketFreePacket(LPPACKET lpPacket); +BOOLEAN PacketReceivePacket(LPADAPTER AdapterObject,LPPACKET lpPacket,BOOLEAN Sync); +BOOLEAN PacketSetHwFilter(LPADAPTER AdapterObject,ULONG Filter); +BOOLEAN PacketGetAdapterNames(PTSTR pStr,PULONG BufferSize); +BOOLEAN PacketGetNetInfoEx(PCHAR AdapterName, npf_if_addr* buffer, PLONG NEntries); +BOOLEAN PacketRequest(LPADAPTER AdapterObject,BOOLEAN Set,PPACKET_OID_DATA OidData); +HANDLE PacketGetReadEvent(LPADAPTER AdapterObject); +BOOLEAN PacketSetDumpName(LPADAPTER AdapterObject, void *name, int len); +BOOLEAN PacketSetDumpLimits(LPADAPTER AdapterObject, UINT maxfilesize, UINT maxnpacks); +BOOLEAN PacketIsDumpEnded(LPADAPTER AdapterObject, BOOLEAN sync); +BOOL PacketStopDriver(); +VOID PacketCloseAdapter(LPADAPTER lpAdapter); + +#ifdef __cplusplus +} +#endif + +#endif //__PACKET32 diff --git a/src/See/Read.c b/src/See/Read.c index 3bc47323..e53a5f90 100644 --- a/src/See/Read.c +++ b/src/See/Read.c @@ -1,938 +1,938 @@ -/* - * Copyright (c) 1999 - 2005 NetGroup, Politecnico di Torino (Italy) - * Copyright (c) 2005 CACE Technologies, Davis (California) - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the Politecnico di Torino, CACE Technologies - * nor the names of its contributors may be used to endorse or promote - * products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - */ - -#include - -#include -#include "ntddk.h" -#include -#include -#include "debug.h" -#include "packet.h" -#include "win_bpf.h" - -#include "tme.h" -#include "time_calls.h" - -extern struct time_conv G_Start_Time; // from openclos.c - -extern ULONG NCpu; //from packet.c - -NTSTATUS NPF_Read(IN PDEVICE_OBJECT DeviceObject,IN PIRP Irp) -{ - POPEN_INSTANCE Open; - PIO_STACK_LOCATION IrpSp; - PUCHAR packp; - PUCHAR CurrBuff; - struct bpf_hdr *header; -// PUCHAR UserPointer; -// ULONG bytecopy; - ULONG copied,count,current_cpu,plen,increment,ToCopy,available; - CpuPrivateData *LocalData; - ULONG i; - ULONG Occupation; - - IF_LOUD(DbgPrint("NPF: Read\n");) - - - IrpSp = IoGetCurrentIrpStackLocation(Irp); - Open=IrpSp->FileObject->FsContext; - - if( Open->Bound == FALSE ) - { - // The Network adapter has been removed or disabled - EXIT_FAILURE(0); - } - - if (Open->Size == 0) - { - EXIT_FAILURE(0); - } - - if( Open->mode & MODE_DUMP && Open->DumpFileHandle == NULL ){ - // this instance is in dump mode, but the dump file has still not been opened - EXIT_FAILURE(0); - } - - Occupation=0; - - for(i=0;iSize - Open->CpuData[i].Free); - - //See if the buffer is full enough to be copied - if( Occupation <= Open->MinToCopy*NCpu || Open->mode & MODE_DUMP ) - { - //wait until some packets arrive or the timeout expires - if(Open->TimeOut.QuadPart != (LONGLONG)IMMEDIATE) - KeWaitForSingleObject(Open->ReadEvent, - UserRequest, - KernelMode, - TRUE, - (Open->TimeOut.QuadPart == (LONGLONG)0)? NULL: &(Open->TimeOut)); - - KeClearEvent(Open->ReadEvent); - - if(Open->mode & MODE_STAT) - { //this capture instance is in statistics mode -#ifdef NDIS50 - CurrBuff=(PUCHAR)MmGetSystemAddressForMdlSafe(Irp->MdlAddress, NormalPagePriority); -#else - CurrBuff=(PUCHAR)MmGetSystemAddressForMdl(Irp->MdlAddress); -#endif - - //fill the bpf header for this packet - header=(struct bpf_hdr*)CurrBuff; - GET_TIME(&header->bh_tstamp,&G_Start_Time); - - if(Open->mode & MODE_DUMP){ - *(LONGLONG*)(CurrBuff+sizeof(struct bpf_hdr)+16)=Open->DumpOffset.QuadPart; - header->bh_caplen=24; - header->bh_datalen=24; - Irp->IoStatus.Information = 24 + sizeof(struct bpf_hdr); - } - else{ - header->bh_caplen=16; - header->bh_datalen=16; - header->bh_hdrlen=sizeof(struct bpf_hdr); - Irp->IoStatus.Information = 16 + sizeof(struct bpf_hdr); - } - - *(LONGLONG*)(CurrBuff+sizeof(struct bpf_hdr))=Open->Npackets.QuadPart; - *(LONGLONG*)(CurrBuff+sizeof(struct bpf_hdr)+8)=Open->Nbytes.QuadPart; - - //reset the counters - NdisAcquireSpinLock( &Open->CountersLock ); - Open->Npackets.QuadPart=0; - Open->Nbytes.QuadPart=0; - NdisReleaseSpinLock( &Open->CountersLock ); - - Irp->IoStatus.Status = STATUS_SUCCESS; - IoCompleteRequest(Irp, IO_NO_INCREMENT); - - return STATUS_SUCCESS; - } - -// -// The MONITOR_MODE (aka TME extensions) is not supported on -// 64 bit architectures -// -#ifdef __NPF_x86__ - - if(Open->mode==MODE_MON) //this capture instance is in monitor mode - { - PTME_DATA data; - ULONG cnt; - ULONG block_size; - PUCHAR tmp; - -#ifdef NDIS50 - UserPointer=MmGetSystemAddressForMdlSafe(Irp->MdlAddress, NormalPagePriority); -#else - UserPointer=MmGetSystemAddressForMdl(Irp->MdlAddress); -#endif - - if ((!IS_VALIDATED(Open->tme.validated_blocks,Open->tme.active_read))||(IrpSp->Parameters.Read.Lengthbh_tstamp,&G_Start_Time); - - - header->bh_hdrlen=sizeof(struct bpf_hdr); - - - //moves user memory pointer - UserPointer+=sizeof(struct bpf_hdr); - - //calculus of data to be copied - //if the user buffer is smaller than data to be copied, - //only some data will be copied - data=&Open->tme.block_data[Open->tme.active_read]; - - if (data->last_read.tv_sec!=0) - data->last_read=header->bh_tstamp; - - - bytecopy=data->block_size*data->filled_blocks; - - if ((IrpSp->Parameters.Read.Length-sizeof(struct bpf_hdr))Parameters.Read.Length-sizeof(struct bpf_hdr))/ data->block_size; - else - bytecopy=data->filled_blocks; - - tmp=data->shared_memory_base_address; - block_size=data->block_size; - - for (cnt=0;cntMachineLock); - RtlCopyMemory(UserPointer,tmp,block_size); - NdisReleaseSpinLock(&Open->MachineLock); - tmp+=block_size; - UserPointer+=block_size; - } - - bytecopy*=block_size; - - header->bh_caplen=bytecopy; - header->bh_datalen=header->bh_caplen; - - EXIT_SUCCESS(bytecopy+sizeof(struct bpf_hdr)); - } - - Occupation=0; - - for(i=0;iSize - Open->CpuData[i].Free); - - - if ( Occupation == 0 || Open->mode & MODE_DUMP) - // The timeout has expired, but the buffer is still empty (or the packets must be written to file). - // We must awake the application, returning an empty buffer. - { - EXIT_SUCCESS(0); - } - - #else // not __NPF_x86__ , so x86-64 or IA64 - if(Open->mode==MODE_MON) //this capture instance is in monitor mode - { - EXIT_FAILURE(0); - } - #endif // __NPF_x86__ - - } - - - -//------------------------------------------------------------------------------ - copied=0; - count=0; - current_cpu=0; - available = IrpSp->Parameters.Read.Length; -#ifdef NDIS50 - packp=(PUCHAR)MmGetSystemAddressForMdlSafe(Irp->MdlAddress, NormalPagePriority); -#else - packp=(PUCHAR)MmGetSystemAddressForMdl(Irp->MdlAddress); -#endif - - - KeClearEvent(Open->ReadEvent); - - while (count < NCpu) //round robin on the CPUs, if count = NCpu there are no packets left to be copied - { - if (available == copied) - { - EXIT_SUCCESS(copied); - } - - LocalData = &Open->CpuData[current_cpu]; - - if (LocalData->Free < Open->Size) - { //there are some packets in the selected (aka LocalData) buffer - struct PacketHeader *Header = (struct PacketHeader*)(LocalData->Buffer + LocalData->C); - - if ( Header->SN == Open->ReaderSN) - { //check if it the next one to be copied - plen = Header->header.bh_caplen; - if (plen + sizeof (struct bpf_hdr) > available - copied) - { //if the packet does not fit into the user buffer, we've ended copying packets - EXIT_SUCCESS(copied); - } - -// FIX_TIMESTAMPS(&Header->header.bh_tstamp); - - *((struct bpf_hdr*)(&packp[copied]))=Header->header; - - copied += sizeof(struct bpf_hdr); - LocalData->C += sizeof(struct PacketHeader); - - if (LocalData->C == Open->Size) - LocalData->C = 0; - - if (Open->Size - LocalData->C < plen) - { - //the packet is fragmented in the buffer (i.e. it skips the buffer boundary) - ToCopy = Open->Size - LocalData->C; - RtlCopyMemory(packp + copied,LocalData->Buffer + LocalData->C,ToCopy); - RtlCopyMemory(packp + copied + ToCopy,LocalData->Buffer,plen-ToCopy); - LocalData->C = plen-ToCopy; - } - else - { - //the packet is not fragmented - RtlCopyMemory(packp + copied ,LocalData->Buffer + LocalData->C ,plen); - LocalData->C += plen; - // if (c==size) inutile, contemplato nell "header atomico" - // c=0; - } - - Open->ReaderSN++; - copied+=Packet_WORDALIGN(plen); - - increment = plen + sizeof(struct PacketHeader); - if ( Open->Size - LocalData->C < sizeof(struct PacketHeader)) - { //the next packet would be saved at the end of the buffer, but the NewHeader struct would be fragmented - //so the producer (--> the consumer) skips to the beginning of the buffer - increment += Open->Size-LocalData->C; - LocalData->C=0; - } - InterlockedExchangeAdd(&Open->CpuData[current_cpu].Free,increment); - count=0; - } - else - { - current_cpu=(current_cpu+1)%NCpu; - count++; - } - - } - else - { - current_cpu=(current_cpu+1)%NCpu; - count++; - } - } - - {EXIT_SUCCESS(copied);} - -//------------------------------------------------------------------------------ - -} - -extern void *test_addr; - -NDIS_STATUS NPF_tap (IN NDIS_HANDLE ProtocolBindingContext,IN NDIS_HANDLE MacReceiveContext, - IN PVOID HeaderBuffer,IN UINT HeaderBufferSize,IN PVOID LookaheadBuffer, - IN UINT LookaheadBufferSize,IN UINT PacketSize) -{ - POPEN_INSTANCE Open; - PNDIS_PACKET pPacket; - NDIS_STATUS Status; - UINT BytesTransfered; - PMDL pMdl1,pMdl2; - UINT fres; - - CpuPrivateData *LocalData; - ULONG Cpu; - struct PacketHeader *Header; - ULONG ToCopy; - ULONG increment; - ULONG i; -// BOOLEAN ShouldReleaseMachineLock; - - IF_VERY_LOUD(DbgPrint("NPF: tap\n");) - IF_VERY_LOUD(DbgPrint("HeaderBufferSize=%d, LookAheadBuffer=%d, LookaheadBufferSize=%d, PacketSize=%d\n", - HeaderBufferSize, - LookaheadBuffer, - LookaheadBufferSize, - PacketSize);) - - Open= (POPEN_INSTANCE)ProtocolBindingContext; - - if (Open->SkipProcessing == 1) //some IoCtl is modifying some shared structure, we must drop the packet. - return NDIS_STATUS_NOT_ACCEPTED; - - Cpu = KeGetCurrentProcessorNumber(); - LocalData = &Open->CpuData[Cpu]; - - LocalData->Processing = 1; //this tells the Ioctls that we are processing a packet, they cannot modify anything - //until ALL the Cpu have terminated their processing (aka, set their LocalData->processing to 0) - LocalData->Received++; - IF_LOUD(DbgPrint("Received on CPU %d \t%d\n",Cpu,LocalData->Received);) -// Open->Received++; // Number of packets received by filter ++ - -// -// The MONITOR_MODE (aka TME extensions) is not supported on -// 64 bit architectures -// -#ifdef __NPF_x86__ - if (Open->mode == MODE_MON) - { - ShouldReleaseMachineLock = TRUE; - NdisAcquireSpinLock(&Open->MachineLock); - } - else - ShouldReleaseMachineLock = FALSE; -#endif - - // - //Check if the lookahead buffer follows the mac header. - //If the data follow the header (i.e. there is only a buffer) a normal bpf_filter() is - //executed on the packet. - //Otherwise if there are 2 separate buffers (this could be the case of LAN emulation or - //things like this) bpf_filter_with_2_buffers() is executed. - // - if((UINT)((PUCHAR)LookaheadBuffer-(PUCHAR)HeaderBuffer) != HeaderBufferSize) - fres=bpf_filter_with_2_buffers((struct bpf_insn*)(Open->bpfprogram), - HeaderBuffer, - LookaheadBuffer, - HeaderBufferSize, - PacketSize+HeaderBufferSize, - LookaheadBufferSize+HeaderBufferSize, - &Open->mem_ex, - &Open->tme, - &G_Start_Time); - - - else -// -// the jit filter is available on x86 (32 bit) only -// -#ifdef __NPF_x86__ - - if(Open->Filter != NULL) - { - if (Open->bpfprogram != NULL) - { - fres=Open->Filter->Function(HeaderBuffer, - PacketSize+HeaderBufferSize, - LookaheadBufferSize+HeaderBufferSize); - } - else - fres = -1; - } - else -#endif //__NPF_x86__ - fres=bpf_filter((struct bpf_insn*)(Open->bpfprogram), - HeaderBuffer, - PacketSize+HeaderBufferSize, - LookaheadBufferSize+HeaderBufferSize, - &Open->mem_ex, - &Open->tme, - &G_Start_Time); - -// -// The MONITOR_MODE (aka TME extensions) is not supported on -// 64 bit architectures -// -#ifdef __NPF_x86__ - if (ShouldReleaseMachineLock) - NdisReleaseSpinLock(&Open->MachineLock); -#endif - -// -// The MONITOR_MODE (aka TME extensions) is not supported on -// 64 bit architectures -// -#ifdef __NPF_x86__ - if(Open->mode==MODE_MON) - // we are in monitor mode - { - if (fres==1) - KeSetEvent(Open->ReadEvent,0,FALSE); - LocalData->Processing = 0; - return NDIS_STATUS_NOT_ACCEPTED; - - } -#endif - - if(fres==0) - { - // Packet not accepted by the filter, ignore it. - LocalData->Processing = 0; - return NDIS_STATUS_NOT_ACCEPTED; - } - - //if the filter returns -1 the whole packet must be accepted - if(fres==-1 || fres > PacketSize+HeaderBufferSize) - fres = PacketSize+HeaderBufferSize; - - if(Open->mode & MODE_STAT) - { - // we are in statistics mode - NdisAcquireSpinLock( &Open->CountersLock ); - - Open->Npackets.QuadPart++; - - if(PacketSize+HeaderBufferSize<60) - Open->Nbytes.QuadPart+=60; - else - Open->Nbytes.QuadPart+=PacketSize+HeaderBufferSize; - // add preamble+SFD+FCS to the packet - // these values must be considered because are not part of the packet received from NDIS - Open->Nbytes.QuadPart+=12; - - NdisReleaseSpinLock( &Open->CountersLock ); - - if(!(Open->mode & MODE_DUMP)) - { - LocalData->Processing = 0; - return NDIS_STATUS_NOT_ACCEPTED; - } - } - - if(Open->Size == 0) - { - LocalData->Dropped++; - LocalData->Processing = 0; - return NDIS_STATUS_NOT_ACCEPTED; - } - - if(Open->mode & MODE_DUMP && Open->MaxDumpPacks) - { - ULONG Accepted=0; - for(i=0;iCpuData[i].Accepted; - - if( Accepted > Open->MaxDumpPacks) - { - // Reached the max number of packets to save in the dump file. Discard the packet and stop the dump thread. - Open->DumpLimitReached = TRUE; // This stops the thread - // Awake the dump thread - NdisSetEvent(&Open->DumpEvent); - - // Awake the application - KeSetEvent(Open->ReadEvent,0,FALSE); - - LocalData->Processing = 0; - return NDIS_STATUS_NOT_ACCEPTED; - } - } - - //////////////////////////////COPIA.C//////////////////////////////////////////77 - - if (fres + sizeof(struct PacketHeader) > LocalData->Free) - { - LocalData->Dropped++; - LocalData->Processing = 0; - return NDIS_STATUS_NOT_ACCEPTED; - } - - if (LocalData->TransferMdl1 != NULL) - { - //if TransferMdl is not NULL, there is some TransferData pending (i.e. not having called TransferDataComplete, yet) - //in order to avoid buffer corruption, we drop the packet - LocalData->Dropped++; - LocalData->Processing = 0; - return NDIS_STATUS_NOT_ACCEPTED; - } - - - if (LookaheadBufferSize + HeaderBufferSize >= fres) - { - //we do not need to call NdisTransferData, either because we need only the HeaderBuffer, or because the LookaheadBuffer - //contains what we need - - - - Header = (struct PacketHeader*)(LocalData->Buffer + LocalData->P); - LocalData->Accepted++; - GET_TIME(&Header->header.bh_tstamp,&G_Start_Time); - Header->SN = InterlockedIncrement(&Open->WriterSN) - 1; - - Header->header.bh_caplen = fres; - Header->header.bh_datalen = PacketSize + HeaderBufferSize; - Header->header.bh_hdrlen=sizeof(struct bpf_hdr); - - LocalData->P +=sizeof(struct PacketHeader); - if (LocalData->P == Open->Size) - LocalData->P = 0; - - if ( fres <= HeaderBufferSize || (UINT)( (PUCHAR)LookaheadBuffer - (PUCHAR)HeaderBuffer ) == HeaderBufferSize ) - { - //we can consider the buffer contiguous, either because we use only the data - //present in the HeaderBuffer, or because HeaderBuffer and LookaheadBuffer are contiguous - // ;-)))))) - - if (Open->Size - LocalData->P < fres) - { - //the packet will be fragmented in the buffer (aka, it will skip the buffer boundary) - //two copies!! - ToCopy = Open->Size - LocalData->P; - NdisMoveMappedMemory(LocalData->Buffer + LocalData->P,HeaderBuffer, ToCopy); - NdisMoveMappedMemory(LocalData->Buffer + 0 , (PUCHAR)HeaderBuffer + ToCopy, fres - ToCopy); - LocalData->P = fres-ToCopy; - } - else - { - //the packet does not need to be fragmented in the buffer (aka, it doesn't skip the buffer boundary) - // ;-)))))) only ONE copy - NdisMoveMappedMemory(LocalData->Buffer + LocalData->P, HeaderBuffer, fres); - LocalData->P += fres; - } - } - else - { - //HeaderBuffer and LookAhead buffer are NOT contiguous, - //AND, we need some bytes from the LookaheadBuffer, too - if (Open->Size - LocalData->P < fres) - { - //the packet will be fragmented in the buffer (aka, it will skip the buffer boundary) - if (Open->Size - LocalData->P >= HeaderBufferSize) - { - //HeaderBuffer is NOT fragmented - NdisMoveMappedMemory(LocalData->Buffer + LocalData->P, HeaderBuffer, HeaderBufferSize); - LocalData->P += HeaderBufferSize; - - if (LocalData->P == Open->Size) - { - //the fragmentation of the packet in the buffer is the same fragmentation - //in HeaderBuffer+LookaheadBuffer - LocalData->P=0; - NdisMoveMappedMemory(LocalData->Buffer + 0, LookaheadBuffer, fres - HeaderBufferSize); - LocalData->P += (fres - HeaderBufferSize); - } - else - { - //LookAheadBuffer is fragmented, two copies - ToCopy = Open->Size - LocalData->P; - NdisMoveMappedMemory(LocalData->Buffer + LocalData->P, LookaheadBuffer, ToCopy); - LocalData->P=0; - NdisMoveMappedMemory(LocalData->Buffer + 0, (PUCHAR)LookaheadBuffer+ ToCopy, fres - HeaderBufferSize - ToCopy); - LocalData->P = fres - HeaderBufferSize - ToCopy; - } - } - else - { - //HeaderBuffer is fragmented in the buffer (aka, it will skip the buffer boundary) - //two copies to copy the HeaderBuffer - ToCopy = Open->Size - LocalData->P; - NdisMoveMappedMemory(LocalData->Buffer + LocalData->P, HeaderBuffer, ToCopy); - LocalData->P = 0; - NdisMoveMappedMemory(LocalData->Buffer + 0, (PUCHAR)HeaderBuffer + ToCopy, HeaderBufferSize - ToCopy); - LocalData->P = HeaderBufferSize - ToCopy; - - //only one copy to copy the LookaheadBuffer - NdisMoveMappedMemory(LocalData->Buffer + LocalData->P, LookaheadBuffer, fres- HeaderBufferSize); - LocalData->P += (fres - HeaderBufferSize); - } - } - else - { - //the packet won't be fragmented in the destination buffer (aka, it won't skip the buffer boundary) - //two copies, the former to copy the HeaderBuffer, the latter to copy the LookaheadBuffer - NdisMoveMappedMemory(LocalData->Buffer + LocalData->P, HeaderBuffer, HeaderBufferSize); - LocalData->P += HeaderBufferSize; - NdisMoveMappedMemory(LocalData->Buffer + LocalData->P, LookaheadBuffer, fres - HeaderBufferSize); - LocalData->P += (fres - HeaderBufferSize); - } - } - - increment = fres + sizeof(struct PacketHeader); - if (Open->Size - LocalData->P < sizeof(struct PacketHeader)) //we check that the available, AND contiguous, space in the buffer will fit - { //the NewHeader structure, at least, otherwise we skip the producer - increment += Open->Size-LocalData->P; //at the beginning of the buffer (p = 0), and decrement the free bytes appropriately - LocalData->P = 0; - } - - InterlockedExchangeAdd(&LocalData->Free, (ULONG)(-(LONG)increment)); - if(Open->Size - LocalData->Free >= Open->MinToCopy) - { - if(Open->mode & MODE_DUMP) - NdisSetEvent(&Open->DumpEvent); - else - KeSetEvent(Open->ReadEvent,0,FALSE); - } - - LocalData->Processing = 0; - return NDIS_STATUS_NOT_ACCEPTED; - } - else - { - IF_LOUD(DbgPrint("TransferData!!\n");) - //ndisTransferData required - LocalData->NewP = LocalData->P; - - LocalData->NewP +=sizeof(struct PacketHeader); - if (LocalData->NewP == Open->Size) - LocalData->NewP = 0; - - //first of all, surely the header must be copied - if (Open->Size-LocalData->NewP >= HeaderBufferSize) - { - //1 copy! - NdisMoveMappedMemory(LocalData->Buffer + LocalData->NewP, HeaderBuffer, HeaderBufferSize); - LocalData->NewP += HeaderBufferSize; - if (LocalData->NewP == Open->Size) - LocalData->NewP = 0; - } - else - { - ToCopy = Open->Size - LocalData->NewP; - NdisMoveMappedMemory(LocalData->Buffer + LocalData->NewP, HeaderBuffer, ToCopy); - NdisMoveMappedMemory(LocalData->Buffer + 0, (PUCHAR)HeaderBuffer + ToCopy, HeaderBufferSize - ToCopy); - LocalData->NewP = HeaderBufferSize - ToCopy; - } - - //then we copy the Lookahead buffer - - if (Open->Size-LocalData->NewP >= LookaheadBufferSize) - { - //1 copy! - NdisMoveMappedMemory(LocalData->Buffer + LocalData->NewP, LookaheadBuffer, LookaheadBufferSize); - LocalData->NewP += LookaheadBufferSize; - if (LocalData->NewP == Open->Size) - LocalData->NewP = 0; - } - else - { - ToCopy = Open->Size - LocalData->NewP; - NdisMoveMappedMemory(LocalData->Buffer + LocalData->NewP, LookaheadBuffer, ToCopy); - NdisMoveMappedMemory(LocalData->Buffer + 0, (PUCHAR)LookaheadBuffer + ToCopy, LookaheadBufferSize - ToCopy); - LocalData->NewP = LookaheadBufferSize - ToCopy; - } - - //Now we must prepare the buffer(s) for the NdisTransferData - if ((Open->Size - LocalData->NewP) >= (fres - HeaderBufferSize - LookaheadBufferSize)) - { - //only 1 buffer - pMdl1 = IoAllocateMdl( - LocalData->Buffer + LocalData->NewP, - fres - HeaderBufferSize - LookaheadBufferSize, - FALSE, - FALSE, - NULL); - - if (pMdl1 == NULL) - { - IF_LOUD(DbgPrint("Error allocating Mdl1\n");) - LocalData->Dropped++; - LocalData->Processing = 0; - return NDIS_STATUS_NOT_ACCEPTED; - } - - MmBuildMdlForNonPagedPool(pMdl1); - pMdl2=NULL; - LocalData->NewP += fres - HeaderBufferSize - LookaheadBufferSize; - - - } - else - { - //2 buffers - pMdl1 = IoAllocateMdl( - LocalData->Buffer + LocalData->NewP, - Open->Size - LocalData->NewP, - FALSE, - FALSE, - NULL); - - if (pMdl1 == NULL) - { - IF_LOUD(DbgPrint("Error allocating Mdl1\n");) - LocalData->Dropped++; - LocalData->Processing = 0; - return NDIS_STATUS_NOT_ACCEPTED; - } - - pMdl2 = IoAllocateMdl( - LocalData->Buffer + 0, - fres - HeaderBufferSize - LookaheadBufferSize - (Open->Size - LocalData->NewP), - FALSE, - FALSE, - NULL); - - if (pMdl2 == NULL) - { - IF_LOUD(DbgPrint("Error allocating Mdl2\n");) - IoFreeMdl(pMdl1); - LocalData->Dropped++; - LocalData->Processing = 0; - return NDIS_STATUS_NOT_ACCEPTED; - } - - LocalData->NewP = fres - HeaderBufferSize - LookaheadBufferSize - (Open->Size - LocalData->NewP); - - MmBuildMdlForNonPagedPool(pMdl1); - MmBuildMdlForNonPagedPool(pMdl2); - } - - - NdisAllocatePacket(&Status, &pPacket, Open->PacketPool); - - if (Status != NDIS_STATUS_SUCCESS) - { - IF_LOUD(DbgPrint("NPF: Tap - No free packets\n");) - IoFreeMdl(pMdl1); - if (pMdl2 != NULL) - IoFreeMdl(pMdl2); - LocalData->Dropped++; - LocalData->Processing = 0; - return NDIS_STATUS_NOT_ACCEPTED; - } - - if (pMdl2 != NULL) - NdisChainBufferAtFront(pPacket,pMdl2); - - NdisChainBufferAtFront(pPacket,pMdl1); - - RESERVED(pPacket)->Cpu = Cpu; - - LocalData->TransferMdl1 = pMdl1; - LocalData->TransferMdl2 = pMdl2; - - - Header = (struct PacketHeader*)(LocalData->Buffer + LocalData->P); - Header->header.bh_caplen = fres; - Header->header.bh_datalen = PacketSize + HeaderBufferSize; - Header->header.bh_hdrlen=sizeof(struct bpf_hdr); - - NdisTransferData( - &Status, - Open->AdapterHandle, - MacReceiveContext, - LookaheadBufferSize, - fres - HeaderBufferSize - LookaheadBufferSize, - pPacket, - &BytesTransfered); - - if (Status != NDIS_STATUS_PENDING) - { - IF_LOUD(DbgPrint("NdisTransferData, not pending!\n");) - LocalData->TransferMdl1 = NULL; - LocalData->TransferMdl2 = NULL; - - IoFreeMdl(pMdl1); - if ( pMdl2 != NULL ) - IoFreeMdl(pMdl2); - - NdisReinitializePacket(pPacket); - // Put the packet on the free queue - NdisFreePacket(pPacket); - - LocalData->P = LocalData->NewP; - - LocalData->Accepted++; - GET_TIME(&Header->header.bh_tstamp,&G_Start_Time); - Header->SN = InterlockedIncrement(&Open->WriterSN) - 1; - - increment = fres + sizeof(struct PacketHeader); - if (Open->Size - LocalData->P < sizeof(struct PacketHeader)) - { - increment += Open->Size-LocalData->P; - LocalData->P = 0; - } - - InterlockedExchangeAdd(&LocalData->Free, (ULONG)(-(LONG)increment)); - - if(Open->Size - LocalData->Free >= Open->MinToCopy) - { - if(Open->mode & MODE_DUMP) - NdisSetEvent(&Open->DumpEvent); - else - KeSetEvent(Open->ReadEvent,0,FALSE); - } - - LocalData->Processing = 0; - return NDIS_STATUS_NOT_ACCEPTED; - } - else - { - DbgPrint("NdisTransferData, pending!\n"); - return NDIS_STATUS_NOT_ACCEPTED; - } - } - - return NDIS_STATUS_SUCCESS; - -} - -//------------------------------------------------------------------- - -VOID NPF_TransferDataComplete (IN NDIS_HANDLE ProtocolBindingContext,IN PNDIS_PACKET pPacket, - IN NDIS_STATUS Status,IN UINT BytesTransfered) -{ - POPEN_INSTANCE Open; - ULONG Cpu; - CpuPrivateData *LocalData; - struct PacketHeader* Header; - ULONG increment; - - IF_LOUD(DbgPrint("NPF: TransferDataComplete\n");) - - Open = (POPEN_INSTANCE)ProtocolBindingContext; - - Cpu = RESERVED(pPacket)->Cpu; - - LocalData = &Open->CpuData[Cpu]; - - IoFreeMdl(LocalData->TransferMdl1); - if ( LocalData->TransferMdl2 != NULL ) - IoFreeMdl(LocalData->TransferMdl2); - - NdisReinitializePacket(pPacket); - // Put the packet on the free queue - NdisFreePacket(pPacket); - - //the packet has been successfully copied to the kernel buffer, we can prepend it with the PacketHeader, - //and obtain the sequence number and the timestamp - - LocalData->Accepted++; - Header = (struct PacketHeader*)(LocalData->Buffer + LocalData->P); - GET_TIME(&Header->header.bh_tstamp,&G_Start_Time); - Header->SN = InterlockedIncrement(&Open->WriterSN) - 1; - - LocalData->P = LocalData->NewP; - - increment = Header->header.bh_caplen + sizeof(struct PacketHeader); - if (Open->Size - LocalData->P < sizeof(struct PacketHeader)) - { - increment += Open->Size-LocalData->P; - LocalData->P = 0; - } - - InterlockedExchangeAdd(&LocalData->Free, (ULONG)(-(LONG)increment)); - - if(Open->Size - LocalData->Free >= Open->MinToCopy) - { - if(Open->mode & MODE_DUMP) - NdisSetEvent(&Open->DumpEvent); - else - KeSetEvent(Open->ReadEvent,0,FALSE); - } - - LocalData->TransferMdl1 = NULL; - LocalData->TransferMdl2 = NULL; - LocalData->Processing = 0; - -// Unfreeze the consumer - if(Open->Size - LocalData->Free > Open->MinToCopy) - { - if(Open->mode & MODE_DUMP) - NdisSetEvent(&Open->DumpEvent); - else - KeSetEvent(Open->ReadEvent,0,FALSE); - } - return; -} - -//------------------------------------------------------------------- - -VOID NPF_ReceiveComplete(IN NDIS_HANDLE ProtocolBindingContext) -{ - IF_VERY_LOUD(DbgPrint("NPF: NPF_ReceiveComplete\n");) - return; -} +/* + * Copyright (c) 1999 - 2005 NetGroup, Politecnico di Torino (Italy) + * Copyright (c) 2005 CACE Technologies, Davis (California) + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the Politecnico di Torino, CACE Technologies + * nor the names of its contributors may be used to endorse or promote + * products derived from this software without specific prior written + * permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#include + +#include +#include "ntddk.h" +#include +#include +#include "debug.h" +#include "packet.h" +#include "win_bpf.h" + +#include "tme.h" +#include "time_calls.h" + +extern struct time_conv G_Start_Time; // from openclos.c + +extern ULONG NCpu; //from packet.c + +NTSTATUS NPF_Read(IN PDEVICE_OBJECT DeviceObject,IN PIRP Irp) +{ + POPEN_INSTANCE Open; + PIO_STACK_LOCATION IrpSp; + PUCHAR packp; + PUCHAR CurrBuff; + struct bpf_hdr *header; +// PUCHAR UserPointer; +// ULONG bytecopy; + ULONG copied,count,current_cpu,plen,increment,ToCopy,available; + CpuPrivateData *LocalData; + ULONG i; + ULONG Occupation; + + IF_LOUD(DbgPrint("NPF: Read\n");) + + + IrpSp = IoGetCurrentIrpStackLocation(Irp); + Open=IrpSp->FileObject->FsContext; + + if( Open->Bound == FALSE ) + { + // The Network adapter has been removed or disabled + EXIT_FAILURE(0); + } + + if (Open->Size == 0) + { + EXIT_FAILURE(0); + } + + if( Open->mode & MODE_DUMP && Open->DumpFileHandle == NULL ){ + // this instance is in dump mode, but the dump file has still not been opened + EXIT_FAILURE(0); + } + + Occupation=0; + + for(i=0;iSize - Open->CpuData[i].Free); + + //See if the buffer is full enough to be copied + if( Occupation <= Open->MinToCopy*NCpu || Open->mode & MODE_DUMP ) + { + //wait until some packets arrive or the timeout expires + if(Open->TimeOut.QuadPart != (LONGLONG)IMMEDIATE) + KeWaitForSingleObject(Open->ReadEvent, + UserRequest, + KernelMode, + TRUE, + (Open->TimeOut.QuadPart == (LONGLONG)0)? NULL: &(Open->TimeOut)); + + KeClearEvent(Open->ReadEvent); + + if(Open->mode & MODE_STAT) + { //this capture instance is in statistics mode +#ifdef NDIS50 + CurrBuff=(PUCHAR)MmGetSystemAddressForMdlSafe(Irp->MdlAddress, NormalPagePriority); +#else + CurrBuff=(PUCHAR)MmGetSystemAddressForMdl(Irp->MdlAddress); +#endif + + //fill the bpf header for this packet + header=(struct bpf_hdr*)CurrBuff; + GET_TIME(&header->bh_tstamp,&G_Start_Time); + + if(Open->mode & MODE_DUMP){ + *(LONGLONG*)(CurrBuff+sizeof(struct bpf_hdr)+16)=Open->DumpOffset.QuadPart; + header->bh_caplen=24; + header->bh_datalen=24; + Irp->IoStatus.Information = 24 + sizeof(struct bpf_hdr); + } + else{ + header->bh_caplen=16; + header->bh_datalen=16; + header->bh_hdrlen=sizeof(struct bpf_hdr); + Irp->IoStatus.Information = 16 + sizeof(struct bpf_hdr); + } + + *(LONGLONG*)(CurrBuff+sizeof(struct bpf_hdr))=Open->Npackets.QuadPart; + *(LONGLONG*)(CurrBuff+sizeof(struct bpf_hdr)+8)=Open->Nbytes.QuadPart; + + //reset the counters + NdisAcquireSpinLock( &Open->CountersLock ); + Open->Npackets.QuadPart=0; + Open->Nbytes.QuadPart=0; + NdisReleaseSpinLock( &Open->CountersLock ); + + Irp->IoStatus.Status = STATUS_SUCCESS; + IoCompleteRequest(Irp, IO_NO_INCREMENT); + + return STATUS_SUCCESS; + } + +// +// The MONITOR_MODE (aka TME extensions) is not supported on +// 64 bit architectures +// +#ifdef __NPF_x86__ + + if(Open->mode==MODE_MON) //this capture instance is in monitor mode + { + PTME_DATA data; + ULONG cnt; + ULONG block_size; + PUCHAR tmp; + +#ifdef NDIS50 + UserPointer=MmGetSystemAddressForMdlSafe(Irp->MdlAddress, NormalPagePriority); +#else + UserPointer=MmGetSystemAddressForMdl(Irp->MdlAddress); +#endif + + if ((!IS_VALIDATED(Open->tme.validated_blocks,Open->tme.active_read))||(IrpSp->Parameters.Read.Lengthbh_tstamp,&G_Start_Time); + + + header->bh_hdrlen=sizeof(struct bpf_hdr); + + + //moves user memory pointer + UserPointer+=sizeof(struct bpf_hdr); + + //calculus of data to be copied + //if the user buffer is smaller than data to be copied, + //only some data will be copied + data=&Open->tme.block_data[Open->tme.active_read]; + + if (data->last_read.tv_sec!=0) + data->last_read=header->bh_tstamp; + + + bytecopy=data->block_size*data->filled_blocks; + + if ((IrpSp->Parameters.Read.Length-sizeof(struct bpf_hdr))Parameters.Read.Length-sizeof(struct bpf_hdr))/ data->block_size; + else + bytecopy=data->filled_blocks; + + tmp=data->shared_memory_base_address; + block_size=data->block_size; + + for (cnt=0;cntMachineLock); + RtlCopyMemory(UserPointer,tmp,block_size); + NdisReleaseSpinLock(&Open->MachineLock); + tmp+=block_size; + UserPointer+=block_size; + } + + bytecopy*=block_size; + + header->bh_caplen=bytecopy; + header->bh_datalen=header->bh_caplen; + + EXIT_SUCCESS(bytecopy+sizeof(struct bpf_hdr)); + } + + Occupation=0; + + for(i=0;iSize - Open->CpuData[i].Free); + + + if ( Occupation == 0 || Open->mode & MODE_DUMP) + // The timeout has expired, but the buffer is still empty (or the packets must be written to file). + // We must awake the application, returning an empty buffer. + { + EXIT_SUCCESS(0); + } + + #else // not __NPF_x86__ , so x86-64 or IA64 + if(Open->mode==MODE_MON) //this capture instance is in monitor mode + { + EXIT_FAILURE(0); + } + #endif // __NPF_x86__ + + } + + + +//------------------------------------------------------------------------------ + copied=0; + count=0; + current_cpu=0; + available = IrpSp->Parameters.Read.Length; +#ifdef NDIS50 + packp=(PUCHAR)MmGetSystemAddressForMdlSafe(Irp->MdlAddress, NormalPagePriority); +#else + packp=(PUCHAR)MmGetSystemAddressForMdl(Irp->MdlAddress); +#endif + + + KeClearEvent(Open->ReadEvent); + + while (count < NCpu) //round robin on the CPUs, if count = NCpu there are no packets left to be copied + { + if (available == copied) + { + EXIT_SUCCESS(copied); + } + + LocalData = &Open->CpuData[current_cpu]; + + if (LocalData->Free < Open->Size) + { //there are some packets in the selected (aka LocalData) buffer + struct PacketHeader *Header = (struct PacketHeader*)(LocalData->Buffer + LocalData->C); + + if ( Header->SN == Open->ReaderSN) + { //check if it the next one to be copied + plen = Header->header.bh_caplen; + if (plen + sizeof (struct bpf_hdr) > available - copied) + { //if the packet does not fit into the user buffer, we've ended copying packets + EXIT_SUCCESS(copied); + } + +// FIX_TIMESTAMPS(&Header->header.bh_tstamp); + + *((struct bpf_hdr*)(&packp[copied]))=Header->header; + + copied += sizeof(struct bpf_hdr); + LocalData->C += sizeof(struct PacketHeader); + + if (LocalData->C == Open->Size) + LocalData->C = 0; + + if (Open->Size - LocalData->C < plen) + { + //the packet is fragmented in the buffer (i.e. it skips the buffer boundary) + ToCopy = Open->Size - LocalData->C; + RtlCopyMemory(packp + copied,LocalData->Buffer + LocalData->C,ToCopy); + RtlCopyMemory(packp + copied + ToCopy,LocalData->Buffer,plen-ToCopy); + LocalData->C = plen-ToCopy; + } + else + { + //the packet is not fragmented + RtlCopyMemory(packp + copied ,LocalData->Buffer + LocalData->C ,plen); + LocalData->C += plen; + // if (c==size) inutile, contemplato nell "header atomico" + // c=0; + } + + Open->ReaderSN++; + copied+=Packet_WORDALIGN(plen); + + increment = plen + sizeof(struct PacketHeader); + if ( Open->Size - LocalData->C < sizeof(struct PacketHeader)) + { //the next packet would be saved at the end of the buffer, but the NewHeader struct would be fragmented + //so the producer (--> the consumer) skips to the beginning of the buffer + increment += Open->Size-LocalData->C; + LocalData->C=0; + } + InterlockedExchangeAdd(&Open->CpuData[current_cpu].Free,increment); + count=0; + } + else + { + current_cpu=(current_cpu+1)%NCpu; + count++; + } + + } + else + { + current_cpu=(current_cpu+1)%NCpu; + count++; + } + } + + {EXIT_SUCCESS(copied);} + +//------------------------------------------------------------------------------ + +} + +extern void *test_addr; + +NDIS_STATUS NPF_tap (IN NDIS_HANDLE ProtocolBindingContext,IN NDIS_HANDLE MacReceiveContext, + IN PVOID HeaderBuffer,IN UINT HeaderBufferSize,IN PVOID LookaheadBuffer, + IN UINT LookaheadBufferSize,IN UINT PacketSize) +{ + POPEN_INSTANCE Open; + PNDIS_PACKET pPacket; + NDIS_STATUS Status; + UINT BytesTransfered; + PMDL pMdl1,pMdl2; + UINT fres; + + CpuPrivateData *LocalData; + ULONG Cpu; + struct PacketHeader *Header; + ULONG ToCopy; + ULONG increment; + ULONG i; +// BOOLEAN ShouldReleaseMachineLock; + + IF_VERY_LOUD(DbgPrint("NPF: tap\n");) + IF_VERY_LOUD(DbgPrint("HeaderBufferSize=%d, LookAheadBuffer=%d, LookaheadBufferSize=%d, PacketSize=%d\n", + HeaderBufferSize, + LookaheadBuffer, + LookaheadBufferSize, + PacketSize);) + + Open= (POPEN_INSTANCE)ProtocolBindingContext; + + if (Open->SkipProcessing == 1) //some IoCtl is modifying some shared structure, we must drop the packet. + return NDIS_STATUS_NOT_ACCEPTED; + + Cpu = KeGetCurrentProcessorNumber(); + LocalData = &Open->CpuData[Cpu]; + + LocalData->Processing = 1; //this tells the Ioctls that we are processing a packet, they cannot modify anything + //until ALL the Cpu have terminated their processing (aka, set their LocalData->processing to 0) + LocalData->Received++; + IF_LOUD(DbgPrint("Received on CPU %d \t%d\n",Cpu,LocalData->Received);) +// Open->Received++; // Number of packets received by filter ++ + +// +// The MONITOR_MODE (aka TME extensions) is not supported on +// 64 bit architectures +// +#ifdef __NPF_x86__ + if (Open->mode == MODE_MON) + { + ShouldReleaseMachineLock = TRUE; + NdisAcquireSpinLock(&Open->MachineLock); + } + else + ShouldReleaseMachineLock = FALSE; +#endif + + // + //Check if the lookahead buffer follows the mac header. + //If the data follow the header (i.e. there is only a buffer) a normal bpf_filter() is + //executed on the packet. + //Otherwise if there are 2 separate buffers (this could be the case of LAN emulation or + //things like this) bpf_filter_with_2_buffers() is executed. + // + if((UINT)((PUCHAR)LookaheadBuffer-(PUCHAR)HeaderBuffer) != HeaderBufferSize) + fres=bpf_filter_with_2_buffers((struct bpf_insn*)(Open->bpfprogram), + HeaderBuffer, + LookaheadBuffer, + HeaderBufferSize, + PacketSize+HeaderBufferSize, + LookaheadBufferSize+HeaderBufferSize, + &Open->mem_ex, + &Open->tme, + &G_Start_Time); + + + else +// +// the jit filter is available on x86 (32 bit) only +// +#ifdef __NPF_x86__ + + if(Open->Filter != NULL) + { + if (Open->bpfprogram != NULL) + { + fres=Open->Filter->Function(HeaderBuffer, + PacketSize+HeaderBufferSize, + LookaheadBufferSize+HeaderBufferSize); + } + else + fres = -1; + } + else +#endif //__NPF_x86__ + fres=bpf_filter((struct bpf_insn*)(Open->bpfprogram), + HeaderBuffer, + PacketSize+HeaderBufferSize, + LookaheadBufferSize+HeaderBufferSize, + &Open->mem_ex, + &Open->tme, + &G_Start_Time); + +// +// The MONITOR_MODE (aka TME extensions) is not supported on +// 64 bit architectures +// +#ifdef __NPF_x86__ + if (ShouldReleaseMachineLock) + NdisReleaseSpinLock(&Open->MachineLock); +#endif + +// +// The MONITOR_MODE (aka TME extensions) is not supported on +// 64 bit architectures +// +#ifdef __NPF_x86__ + if(Open->mode==MODE_MON) + // we are in monitor mode + { + if (fres==1) + KeSetEvent(Open->ReadEvent,0,FALSE); + LocalData->Processing = 0; + return NDIS_STATUS_NOT_ACCEPTED; + + } +#endif + + if(fres==0) + { + // Packet not accepted by the filter, ignore it. + LocalData->Processing = 0; + return NDIS_STATUS_NOT_ACCEPTED; + } + + //if the filter returns -1 the whole packet must be accepted + if(fres==-1 || fres > PacketSize+HeaderBufferSize) + fres = PacketSize+HeaderBufferSize; + + if(Open->mode & MODE_STAT) + { + // we are in statistics mode + NdisAcquireSpinLock( &Open->CountersLock ); + + Open->Npackets.QuadPart++; + + if(PacketSize+HeaderBufferSize<60) + Open->Nbytes.QuadPart+=60; + else + Open->Nbytes.QuadPart+=PacketSize+HeaderBufferSize; + // add preamble+SFD+FCS to the packet + // these values must be considered because are not part of the packet received from NDIS + Open->Nbytes.QuadPart+=12; + + NdisReleaseSpinLock( &Open->CountersLock ); + + if(!(Open->mode & MODE_DUMP)) + { + LocalData->Processing = 0; + return NDIS_STATUS_NOT_ACCEPTED; + } + } + + if(Open->Size == 0) + { + LocalData->Dropped++; + LocalData->Processing = 0; + return NDIS_STATUS_NOT_ACCEPTED; + } + + if(Open->mode & MODE_DUMP && Open->MaxDumpPacks) + { + ULONG Accepted=0; + for(i=0;iCpuData[i].Accepted; + + if( Accepted > Open->MaxDumpPacks) + { + // Reached the max number of packets to save in the dump file. Discard the packet and stop the dump thread. + Open->DumpLimitReached = TRUE; // This stops the thread + // Awake the dump thread + NdisSetEvent(&Open->DumpEvent); + + // Awake the application + KeSetEvent(Open->ReadEvent,0,FALSE); + + LocalData->Processing = 0; + return NDIS_STATUS_NOT_ACCEPTED; + } + } + + //////////////////////////////COPIA.C//////////////////////////////////////////77 + + if (fres + sizeof(struct PacketHeader) > LocalData->Free) + { + LocalData->Dropped++; + LocalData->Processing = 0; + return NDIS_STATUS_NOT_ACCEPTED; + } + + if (LocalData->TransferMdl1 != NULL) + { + //if TransferMdl is not NULL, there is some TransferData pending (i.e. not having called TransferDataComplete, yet) + //in order to avoid buffer corruption, we drop the packet + LocalData->Dropped++; + LocalData->Processing = 0; + return NDIS_STATUS_NOT_ACCEPTED; + } + + + if (LookaheadBufferSize + HeaderBufferSize >= fres) + { + //we do not need to call NdisTransferData, either because we need only the HeaderBuffer, or because the LookaheadBuffer + //contains what we need + + + + Header = (struct PacketHeader*)(LocalData->Buffer + LocalData->P); + LocalData->Accepted++; + GET_TIME(&Header->header.bh_tstamp,&G_Start_Time); + Header->SN = InterlockedIncrement(&Open->WriterSN) - 1; + + Header->header.bh_caplen = fres; + Header->header.bh_datalen = PacketSize + HeaderBufferSize; + Header->header.bh_hdrlen=sizeof(struct bpf_hdr); + + LocalData->P +=sizeof(struct PacketHeader); + if (LocalData->P == Open->Size) + LocalData->P = 0; + + if ( fres <= HeaderBufferSize || (UINT)( (PUCHAR)LookaheadBuffer - (PUCHAR)HeaderBuffer ) == HeaderBufferSize ) + { + //we can consider the buffer contiguous, either because we use only the data + //present in the HeaderBuffer, or because HeaderBuffer and LookaheadBuffer are contiguous + // ;-)))))) + + if (Open->Size - LocalData->P < fres) + { + //the packet will be fragmented in the buffer (aka, it will skip the buffer boundary) + //two copies!! + ToCopy = Open->Size - LocalData->P; + NdisMoveMappedMemory(LocalData->Buffer + LocalData->P,HeaderBuffer, ToCopy); + NdisMoveMappedMemory(LocalData->Buffer + 0 , (PUCHAR)HeaderBuffer + ToCopy, fres - ToCopy); + LocalData->P = fres-ToCopy; + } + else + { + //the packet does not need to be fragmented in the buffer (aka, it doesn't skip the buffer boundary) + // ;-)))))) only ONE copy + NdisMoveMappedMemory(LocalData->Buffer + LocalData->P, HeaderBuffer, fres); + LocalData->P += fres; + } + } + else + { + //HeaderBuffer and LookAhead buffer are NOT contiguous, + //AND, we need some bytes from the LookaheadBuffer, too + if (Open->Size - LocalData->P < fres) + { + //the packet will be fragmented in the buffer (aka, it will skip the buffer boundary) + if (Open->Size - LocalData->P >= HeaderBufferSize) + { + //HeaderBuffer is NOT fragmented + NdisMoveMappedMemory(LocalData->Buffer + LocalData->P, HeaderBuffer, HeaderBufferSize); + LocalData->P += HeaderBufferSize; + + if (LocalData->P == Open->Size) + { + //the fragmentation of the packet in the buffer is the same fragmentation + //in HeaderBuffer+LookaheadBuffer + LocalData->P=0; + NdisMoveMappedMemory(LocalData->Buffer + 0, LookaheadBuffer, fres - HeaderBufferSize); + LocalData->P += (fres - HeaderBufferSize); + } + else + { + //LookAheadBuffer is fragmented, two copies + ToCopy = Open->Size - LocalData->P; + NdisMoveMappedMemory(LocalData->Buffer + LocalData->P, LookaheadBuffer, ToCopy); + LocalData->P=0; + NdisMoveMappedMemory(LocalData->Buffer + 0, (PUCHAR)LookaheadBuffer+ ToCopy, fres - HeaderBufferSize - ToCopy); + LocalData->P = fres - HeaderBufferSize - ToCopy; + } + } + else + { + //HeaderBuffer is fragmented in the buffer (aka, it will skip the buffer boundary) + //two copies to copy the HeaderBuffer + ToCopy = Open->Size - LocalData->P; + NdisMoveMappedMemory(LocalData->Buffer + LocalData->P, HeaderBuffer, ToCopy); + LocalData->P = 0; + NdisMoveMappedMemory(LocalData->Buffer + 0, (PUCHAR)HeaderBuffer + ToCopy, HeaderBufferSize - ToCopy); + LocalData->P = HeaderBufferSize - ToCopy; + + //only one copy to copy the LookaheadBuffer + NdisMoveMappedMemory(LocalData->Buffer + LocalData->P, LookaheadBuffer, fres- HeaderBufferSize); + LocalData->P += (fres - HeaderBufferSize); + } + } + else + { + //the packet won't be fragmented in the destination buffer (aka, it won't skip the buffer boundary) + //two copies, the former to copy the HeaderBuffer, the latter to copy the LookaheadBuffer + NdisMoveMappedMemory(LocalData->Buffer + LocalData->P, HeaderBuffer, HeaderBufferSize); + LocalData->P += HeaderBufferSize; + NdisMoveMappedMemory(LocalData->Buffer + LocalData->P, LookaheadBuffer, fres - HeaderBufferSize); + LocalData->P += (fres - HeaderBufferSize); + } + } + + increment = fres + sizeof(struct PacketHeader); + if (Open->Size - LocalData->P < sizeof(struct PacketHeader)) //we check that the available, AND contiguous, space in the buffer will fit + { //the NewHeader structure, at least, otherwise we skip the producer + increment += Open->Size-LocalData->P; //at the beginning of the buffer (p = 0), and decrement the free bytes appropriately + LocalData->P = 0; + } + + InterlockedExchangeAdd(&LocalData->Free, (ULONG)(-(LONG)increment)); + if(Open->Size - LocalData->Free >= Open->MinToCopy) + { + if(Open->mode & MODE_DUMP) + NdisSetEvent(&Open->DumpEvent); + else + KeSetEvent(Open->ReadEvent,0,FALSE); + } + + LocalData->Processing = 0; + return NDIS_STATUS_NOT_ACCEPTED; + } + else + { + IF_LOUD(DbgPrint("TransferData!!\n");) + //ndisTransferData required + LocalData->NewP = LocalData->P; + + LocalData->NewP +=sizeof(struct PacketHeader); + if (LocalData->NewP == Open->Size) + LocalData->NewP = 0; + + //first of all, surely the header must be copied + if (Open->Size-LocalData->NewP >= HeaderBufferSize) + { + //1 copy! + NdisMoveMappedMemory(LocalData->Buffer + LocalData->NewP, HeaderBuffer, HeaderBufferSize); + LocalData->NewP += HeaderBufferSize; + if (LocalData->NewP == Open->Size) + LocalData->NewP = 0; + } + else + { + ToCopy = Open->Size - LocalData->NewP; + NdisMoveMappedMemory(LocalData->Buffer + LocalData->NewP, HeaderBuffer, ToCopy); + NdisMoveMappedMemory(LocalData->Buffer + 0, (PUCHAR)HeaderBuffer + ToCopy, HeaderBufferSize - ToCopy); + LocalData->NewP = HeaderBufferSize - ToCopy; + } + + //then we copy the Lookahead buffer + + if (Open->Size-LocalData->NewP >= LookaheadBufferSize) + { + //1 copy! + NdisMoveMappedMemory(LocalData->Buffer + LocalData->NewP, LookaheadBuffer, LookaheadBufferSize); + LocalData->NewP += LookaheadBufferSize; + if (LocalData->NewP == Open->Size) + LocalData->NewP = 0; + } + else + { + ToCopy = Open->Size - LocalData->NewP; + NdisMoveMappedMemory(LocalData->Buffer + LocalData->NewP, LookaheadBuffer, ToCopy); + NdisMoveMappedMemory(LocalData->Buffer + 0, (PUCHAR)LookaheadBuffer + ToCopy, LookaheadBufferSize - ToCopy); + LocalData->NewP = LookaheadBufferSize - ToCopy; + } + + //Now we must prepare the buffer(s) for the NdisTransferData + if ((Open->Size - LocalData->NewP) >= (fres - HeaderBufferSize - LookaheadBufferSize)) + { + //only 1 buffer + pMdl1 = IoAllocateMdl( + LocalData->Buffer + LocalData->NewP, + fres - HeaderBufferSize - LookaheadBufferSize, + FALSE, + FALSE, + NULL); + + if (pMdl1 == NULL) + { + IF_LOUD(DbgPrint("Error allocating Mdl1\n");) + LocalData->Dropped++; + LocalData->Processing = 0; + return NDIS_STATUS_NOT_ACCEPTED; + } + + MmBuildMdlForNonPagedPool(pMdl1); + pMdl2=NULL; + LocalData->NewP += fres - HeaderBufferSize - LookaheadBufferSize; + + + } + else + { + //2 buffers + pMdl1 = IoAllocateMdl( + LocalData->Buffer + LocalData->NewP, + Open->Size - LocalData->NewP, + FALSE, + FALSE, + NULL); + + if (pMdl1 == NULL) + { + IF_LOUD(DbgPrint("Error allocating Mdl1\n");) + LocalData->Dropped++; + LocalData->Processing = 0; + return NDIS_STATUS_NOT_ACCEPTED; + } + + pMdl2 = IoAllocateMdl( + LocalData->Buffer + 0, + fres - HeaderBufferSize - LookaheadBufferSize - (Open->Size - LocalData->NewP), + FALSE, + FALSE, + NULL); + + if (pMdl2 == NULL) + { + IF_LOUD(DbgPrint("Error allocating Mdl2\n");) + IoFreeMdl(pMdl1); + LocalData->Dropped++; + LocalData->Processing = 0; + return NDIS_STATUS_NOT_ACCEPTED; + } + + LocalData->NewP = fres - HeaderBufferSize - LookaheadBufferSize - (Open->Size - LocalData->NewP); + + MmBuildMdlForNonPagedPool(pMdl1); + MmBuildMdlForNonPagedPool(pMdl2); + } + + + NdisAllocatePacket(&Status, &pPacket, Open->PacketPool); + + if (Status != NDIS_STATUS_SUCCESS) + { + IF_LOUD(DbgPrint("NPF: Tap - No free packets\n");) + IoFreeMdl(pMdl1); + if (pMdl2 != NULL) + IoFreeMdl(pMdl2); + LocalData->Dropped++; + LocalData->Processing = 0; + return NDIS_STATUS_NOT_ACCEPTED; + } + + if (pMdl2 != NULL) + NdisChainBufferAtFront(pPacket,pMdl2); + + NdisChainBufferAtFront(pPacket,pMdl1); + + RESERVED(pPacket)->Cpu = Cpu; + + LocalData->TransferMdl1 = pMdl1; + LocalData->TransferMdl2 = pMdl2; + + + Header = (struct PacketHeader*)(LocalData->Buffer + LocalData->P); + Header->header.bh_caplen = fres; + Header->header.bh_datalen = PacketSize + HeaderBufferSize; + Header->header.bh_hdrlen=sizeof(struct bpf_hdr); + + NdisTransferData( + &Status, + Open->AdapterHandle, + MacReceiveContext, + LookaheadBufferSize, + fres - HeaderBufferSize - LookaheadBufferSize, + pPacket, + &BytesTransfered); + + if (Status != NDIS_STATUS_PENDING) + { + IF_LOUD(DbgPrint("NdisTransferData, not pending!\n");) + LocalData->TransferMdl1 = NULL; + LocalData->TransferMdl2 = NULL; + + IoFreeMdl(pMdl1); + if ( pMdl2 != NULL ) + IoFreeMdl(pMdl2); + + NdisReinitializePacket(pPacket); + // Put the packet on the free queue + NdisFreePacket(pPacket); + + LocalData->P = LocalData->NewP; + + LocalData->Accepted++; + GET_TIME(&Header->header.bh_tstamp,&G_Start_Time); + Header->SN = InterlockedIncrement(&Open->WriterSN) - 1; + + increment = fres + sizeof(struct PacketHeader); + if (Open->Size - LocalData->P < sizeof(struct PacketHeader)) + { + increment += Open->Size-LocalData->P; + LocalData->P = 0; + } + + InterlockedExchangeAdd(&LocalData->Free, (ULONG)(-(LONG)increment)); + + if(Open->Size - LocalData->Free >= Open->MinToCopy) + { + if(Open->mode & MODE_DUMP) + NdisSetEvent(&Open->DumpEvent); + else + KeSetEvent(Open->ReadEvent,0,FALSE); + } + + LocalData->Processing = 0; + return NDIS_STATUS_NOT_ACCEPTED; + } + else + { + DbgPrint("NdisTransferData, pending!\n"); + return NDIS_STATUS_NOT_ACCEPTED; + } + } + + return NDIS_STATUS_SUCCESS; + +} + +//------------------------------------------------------------------- + +VOID NPF_TransferDataComplete (IN NDIS_HANDLE ProtocolBindingContext,IN PNDIS_PACKET pPacket, + IN NDIS_STATUS Status,IN UINT BytesTransfered) +{ + POPEN_INSTANCE Open; + ULONG Cpu; + CpuPrivateData *LocalData; + struct PacketHeader* Header; + ULONG increment; + + IF_LOUD(DbgPrint("NPF: TransferDataComplete\n");) + + Open = (POPEN_INSTANCE)ProtocolBindingContext; + + Cpu = RESERVED(pPacket)->Cpu; + + LocalData = &Open->CpuData[Cpu]; + + IoFreeMdl(LocalData->TransferMdl1); + if ( LocalData->TransferMdl2 != NULL ) + IoFreeMdl(LocalData->TransferMdl2); + + NdisReinitializePacket(pPacket); + // Put the packet on the free queue + NdisFreePacket(pPacket); + + //the packet has been successfully copied to the kernel buffer, we can prepend it with the PacketHeader, + //and obtain the sequence number and the timestamp + + LocalData->Accepted++; + Header = (struct PacketHeader*)(LocalData->Buffer + LocalData->P); + GET_TIME(&Header->header.bh_tstamp,&G_Start_Time); + Header->SN = InterlockedIncrement(&Open->WriterSN) - 1; + + LocalData->P = LocalData->NewP; + + increment = Header->header.bh_caplen + sizeof(struct PacketHeader); + if (Open->Size - LocalData->P < sizeof(struct PacketHeader)) + { + increment += Open->Size-LocalData->P; + LocalData->P = 0; + } + + InterlockedExchangeAdd(&LocalData->Free, (ULONG)(-(LONG)increment)); + + if(Open->Size - LocalData->Free >= Open->MinToCopy) + { + if(Open->mode & MODE_DUMP) + NdisSetEvent(&Open->DumpEvent); + else + KeSetEvent(Open->ReadEvent,0,FALSE); + } + + LocalData->TransferMdl1 = NULL; + LocalData->TransferMdl2 = NULL; + LocalData->Processing = 0; + +// Unfreeze the consumer + if(Open->Size - LocalData->Free > Open->MinToCopy) + { + if(Open->mode & MODE_DUMP) + NdisSetEvent(&Open->DumpEvent); + else + KeSetEvent(Open->ReadEvent,0,FALSE); + } + return; +} + +//------------------------------------------------------------------- + +VOID NPF_ReceiveComplete(IN NDIS_HANDLE ProtocolBindingContext) +{ + IF_VERY_LOUD(DbgPrint("NPF: NPF_ReceiveComplete\n");) + return; +} diff --git a/src/See/See.rc b/src/See/See.rc index 8c739aa0..0c21525c 100644 --- a/src/See/See.rc +++ b/src/See/See.rc @@ -1,63 +1,63 @@ -// Microsoft Visual C++ generated resource script. -// -#include "resource1.h" - -#define APSTUDIO_READONLY_SYMBOLS -///////////////////////////////////////////////////////////////////////////// -// -// Generated from the TEXTINCLUDE 2 resource. -// -#include "winres.h" - -///////////////////////////////////////////////////////////////////////////// -#undef APSTUDIO_READONLY_SYMBOLS - -///////////////////////////////////////////////////////////////////////////// -// Japanese resources - -#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_JPN) -#ifdef _WIN32 -LANGUAGE LANG_JAPANESE, SUBLANG_DEFAULT -#pragma code_page(932) -#endif //_WIN32 - -#ifdef APSTUDIO_INVOKED -///////////////////////////////////////////////////////////////////////////// -// -// TEXTINCLUDE -// - -1 TEXTINCLUDE -BEGIN - "resource1.h\0" -END - -2 TEXTINCLUDE -BEGIN - "#include ""winres.h""\r\n" - "\0" -END - -3 TEXTINCLUDE -BEGIN - "\r\n" - "\0" -END - -#endif // APSTUDIO_INVOKED - -#endif // Japanese resources -///////////////////////////////////////////////////////////////////////////// - - - -#ifndef APSTUDIO_INVOKED -///////////////////////////////////////////////////////////////////////////// -// -// Generated from the TEXTINCLUDE 3 resource. -// - - -///////////////////////////////////////////////////////////////////////////// -#endif // not APSTUDIO_INVOKED - +// Microsoft Visual C++ generated resource script. +// +#include "resource1.h" + +#define APSTUDIO_READONLY_SYMBOLS +///////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 2 resource. +// +#include "winres.h" + +///////////////////////////////////////////////////////////////////////////// +#undef APSTUDIO_READONLY_SYMBOLS + +///////////////////////////////////////////////////////////////////////////// +// Japanese resources + +#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_JPN) +#ifdef _WIN32 +LANGUAGE LANG_JAPANESE, SUBLANG_DEFAULT +#pragma code_page(932) +#endif //_WIN32 + +#ifdef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// TEXTINCLUDE +// + +1 TEXTINCLUDE +BEGIN + "resource1.h\0" +END + +2 TEXTINCLUDE +BEGIN + "#include ""winres.h""\r\n" + "\0" +END + +3 TEXTINCLUDE +BEGIN + "\r\n" + "\0" +END + +#endif // APSTUDIO_INVOKED + +#endif // Japanese resources +///////////////////////////////////////////////////////////////////////////// + + + +#ifndef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 3 resource. +// + + +///////////////////////////////////////////////////////////////////////////// +#endif // not APSTUDIO_INVOKED + diff --git a/src/See/See.vcproj b/src/See/See.vcproj index 8366bf72..64c075a6 100644 --- a/src/See/See.vcproj +++ b/src/See/See.vcproj @@ -1,462 +1,462 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/See/Write.c b/src/See/Write.c index 50d28696..52440d74 100644 --- a/src/See/Write.c +++ b/src/See/Write.c @@ -1,426 +1,426 @@ -/* - * Copyright (c) 1999 - 2005 NetGroup, Politecnico di Torino (Italy) - * Copyright (c) 2005 CACE Technologies, Davis (California) - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the Politecnico di Torino, CACE Technologies - * nor the names of its contributors may be used to endorse or promote - * products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - */ - -#include - -#include "stdarg.h" -#include "ntddk.h" -#include "ntiologc.h" -#include "ndis.h" - -#include "debug.h" -#include "packet.h" - - -void *test_addr = NULL; - -//------------------------------------------------------------------- - -NTSTATUS -NPF_Write( - IN PDEVICE_OBJECT DeviceObject, - IN PIRP Irp - ) - -{ - POPEN_INSTANCE Open; - PIO_STACK_LOCATION IrpSp; - PNDIS_PACKET pPacket; - UINT i; - NDIS_STATUS Status; - - IF_LOUD(DbgPrint("NPF_Write\n");) - - IrpSp = IoGetCurrentIrpStackLocation(Irp); - - - Open=IrpSp->FileObject->FsContext; - - if( Open->Bound == FALSE ) - { - // The Network adapter was removed. - EXIT_FAILURE(0); - } - - NdisAcquireSpinLock(&Open->WriteLock); - if(Open->WriteInProgress) - { - // Another write operation is currently in progress - NdisReleaseSpinLock(&Open->WriteLock); - EXIT_FAILURE(0); - } - else - { - Open->WriteInProgress = TRUE; - } - - NdisReleaseSpinLock(&Open->WriteLock); - - IF_LOUD(DbgPrint("Max frame size = %d, packet size = %d\n", Open->MaxFrameSize, IrpSp->Parameters.Write.Length);) - - - if(IrpSp->Parameters.Write.Length == 0 || // Check that the buffer provided by the user is not empty - Open->MaxFrameSize == 0/* || // Check that the MaxFrameSize is correctly initialized - IrpSp->Parameters.Write.Length > Open->MaxFrameSize*/) // Check that the fame size is smaller that the MTU - { - IF_LOUD(DbgPrint("frame size out of range, send aborted\n");) - - EXIT_FAILURE(0); - } - - - IoMarkIrpPending(Irp); - - Open->Multiple_Write_Counter=Open->Nwrites; - - NdisResetEvent(&Open->WriteEvent); - - - for(i=0;iNwrites;i++){ - - // Try to get a packet from our list of free ones - NdisAllocatePacket( - &Status, - &pPacket, - Open->PacketPool - ); - - if (Status != NDIS_STATUS_SUCCESS) { - - // No free packets - Irp->IoStatus.Status = STATUS_INSUFFICIENT_RESOURCES; - IoCompleteRequest (Irp, IO_NO_INCREMENT); - return STATUS_INSUFFICIENT_RESOURCES; - } - - if(Open->SkipSentPackets) - { - NdisSetPacketFlags( - pPacket, - g_SendPacketFlags); - } - - // The packet hasn't a buffer that needs not to be freed after every single write - RESERVED(pPacket)->FreeBufAfterWrite = FALSE; - - // Save the IRP associated with the packet - RESERVED(pPacket)->Irp=Irp; - - // Attach the writes buffer to the packet - NdisChainBufferAtFront(pPacket,Irp->MdlAddress); - - test_addr = MmGetMdlVirtualAddress(Irp->MdlAddress); - - // Call the MAC - NdisSend( - &Status, - Open->AdapterHandle, - pPacket); - - if (Status != NDIS_STATUS_PENDING) { - // The send didn't pend so call the completion handler now - NPF_SendComplete( - Open, - pPacket, - Status - ); - - } - - if(i%100==99){ - NdisWaitEvent(&Open->WriteEvent,1000); - NdisResetEvent(&Open->WriteEvent); - } - } - - return(STATUS_PENDING); -} - -//------------------------------------------------------------------- - -INT -NPF_BufferedWrite( - IN PIRP Irp, - IN PCHAR UserBuff, - IN ULONG UserBuffSize, - BOOLEAN Sync) -{ - POPEN_INSTANCE Open; - PIO_STACK_LOCATION IrpSp; - PNDIS_PACKET pPacket; - NDIS_STATUS Status; - struct sf_pkthdr *winpcap_hdr; - PMDL TmpMdl; - PCHAR EndOfUserBuff = UserBuff + UserBuffSize; - - IF_LOUD(DbgPrint("NPF: BufferedWrite, UserBuff=%x, Size=%u\n", UserBuff, UserBuffSize);) - - IrpSp = IoGetCurrentIrpStackLocation(Irp); - - Open=IrpSp->FileObject->FsContext; - - if( Open->Bound == FALSE ){ - // The Network adapter was removed. - return 0; - } - - // Sanity check on the user buffer - if(UserBuff == NULL) - { - return 0; - } - - // Check that the MaxFrameSize is correctly initialized - if(Open->MaxFrameSize == 0) - { - IF_LOUD(DbgPrint("BufferedWrite: Open->MaxFrameSize not initialized, probably because of a problem in the OID query\n");) - - return 0; - } - - // Reset the event used to synchronize packet allocation - NdisResetEvent(&Open->WriteEvent); - - // Reset the pending packets counter - Open->Multiple_Write_Counter = 0; - - // Start from the first packet - winpcap_hdr = (struct sf_pkthdr*)UserBuff; - - // Check the consistency of the user buffer - if( (PCHAR)winpcap_hdr + winpcap_hdr->caplen + sizeof(struct sf_pkthdr) > EndOfUserBuff ) - { - IF_LOUD(DbgPrint("Buffered Write: bogus packet buffer\n");) - - return -1; - } - - // - // Main loop: send the buffer to the wire - // - while(TRUE) - { - - if(winpcap_hdr->caplen ==0/* || winpcap_hdr->caplen > Open->MaxFrameSize*/) - { - // Malformed header - IF_LOUD(DbgPrint("NPF_BufferedWrite: malformed or bogus user buffer, aborting write.\n");) - - return -1; - } - - // Allocate an MDL to map the packet data - TmpMdl = IoAllocateMdl((PCHAR)winpcap_hdr + sizeof(struct sf_pkthdr), - winpcap_hdr->caplen, - FALSE, - FALSE, - NULL); - - if (TmpMdl == NULL) - { - // Unable to map the memory: packet lost - IF_LOUD(DbgPrint("NPF_BufferedWrite: unable to allocate the MDL.\n");) - - return -1; - } - - MmBuildMdlForNonPagedPool(TmpMdl); // XXX can this line be removed? - - // Allocate a packet from our free list - NdisAllocatePacket( &Status, &pPacket, Open->PacketPool); - - if (Status != NDIS_STATUS_SUCCESS) { - // No more free packets - IF_LOUD(DbgPrint("NPF_BufferedWrite: no more free packets, returning.\n");) - - NdisResetEvent(&Open->WriteEvent); - - NdisWaitEvent(&Open->WriteEvent, 1000); - - // Try again to allocate a packet - NdisAllocatePacket( &Status, &pPacket, Open->PacketPool); - - if (Status != NDIS_STATUS_SUCCESS) { - // Second failure, report an error - IoFreeMdl(TmpMdl); - return -1; - } - -// IoFreeMdl(TmpMdl); -// return (PCHAR)winpcap_hdr - UserBuff; - } - - if(Open->SkipSentPackets) - { - NdisSetPacketFlags( - pPacket, - g_SendPacketFlags); - } - - // The packet has a buffer that needs to be freed after every single write - RESERVED(pPacket)->FreeBufAfterWrite = TRUE; - - TmpMdl->Next = NULL; - - // Attach the MDL to the packet - NdisChainBufferAtFront(pPacket, TmpMdl); - - // Increment the number of pending sends - InterlockedIncrement(&Open->Multiple_Write_Counter); - - // Call the MAC - NdisSend( &Status, Open->AdapterHandle, pPacket); - - if (Status != NDIS_STATUS_PENDING) { - // The send didn't pend so call the completion handler now - NPF_SendComplete( - Open, - pPacket, - Status - ); - } - - // Step to the next packet in the buffer - (PCHAR)winpcap_hdr += winpcap_hdr->caplen + sizeof(struct sf_pkthdr); - - // Check if the end of the user buffer has been reached - if( (PCHAR)winpcap_hdr >= EndOfUserBuff ) - { - IF_LOUD(DbgPrint("NPF_BufferedWrite: End of buffer.\n");) - - // Wait the completion of pending sends - NPF_WaitEndOfBufferedWrite(Open); - - return (INT)((PCHAR)winpcap_hdr - UserBuff); - } - - } - - return (INT)((PCHAR)winpcap_hdr - UserBuff); -} - -//------------------------------------------------------------------- - -VOID NPF_WaitEndOfBufferedWrite(POPEN_INSTANCE Open) -{ - UINT i; - - NdisResetEvent(&Open->WriteEvent); - - for(i=0; Open->Multiple_Write_Counter > 0 && i < TRANSMIT_PACKETS; i++) - { - NdisWaitEvent(&Open->WriteEvent, 100); - NdisResetEvent(&Open->WriteEvent); - } - - return; -} - -//------------------------------------------------------------------- - -VOID -NPF_SendComplete( - IN NDIS_HANDLE ProtocolBindingContext, - IN PNDIS_PACKET pPacket, - IN NDIS_STATUS Status - ) - -{ - PIRP Irp; - PIO_STACK_LOCATION irpSp; - POPEN_INSTANCE Open; - PMDL TmpMdl; - - IF_LOUD(DbgPrint("NPF: SendComplete, BindingContext=%d\n",ProtocolBindingContext);) - - Open= (POPEN_INSTANCE)ProtocolBindingContext; - - if( RESERVED(pPacket)->FreeBufAfterWrite ) - { - // - // Packet sent by NPF_BufferedWrite() - // - - - // Free the MDL associated with the packet - NdisUnchainBufferAtFront(pPacket, &TmpMdl); - - IoFreeMdl(TmpMdl); - - // recyle the packet - // NdisReinitializePacket(pPacket); - - NdisFreePacket(pPacket); - - // Increment the number of pending sends - InterlockedDecrement(&Open->Multiple_Write_Counter); - - NdisSetEvent(&Open->WriteEvent); - - return; - } - else - { - // - // Packet sent by NPF_Write() - // - - if((Open->Nwrites - Open->Multiple_Write_Counter) %100 == 99) - NdisSetEvent(&Open->WriteEvent); - - Open->Multiple_Write_Counter--; - - if(Open->Multiple_Write_Counter == 0){ - // Release the buffer and awake the application - NdisUnchainBufferAtFront(pPacket, &TmpMdl); - - // Complete the request - Irp=RESERVED(pPacket)->Irp; - irpSp = IoGetCurrentIrpStackLocation(Irp); - - Irp->IoStatus.Status = Status; - Irp->IoStatus.Information = irpSp->Parameters.Write.Length; - IoCompleteRequest(Irp, IO_NO_INCREMENT); - - NdisAcquireSpinLock(&Open->WriteLock); - Open->WriteInProgress = FALSE; - NdisReleaseSpinLock(&Open->WriteLock); - } - - // Put the packet back on the free list - NdisFreePacket(pPacket); - - return; - } - -} +/* + * Copyright (c) 1999 - 2005 NetGroup, Politecnico di Torino (Italy) + * Copyright (c) 2005 CACE Technologies, Davis (California) + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the Politecnico di Torino, CACE Technologies + * nor the names of its contributors may be used to endorse or promote + * products derived from this software without specific prior written + * permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#include + +#include "stdarg.h" +#include "ntddk.h" +#include "ntiologc.h" +#include "ndis.h" + +#include "debug.h" +#include "packet.h" + + +void *test_addr = NULL; + +//------------------------------------------------------------------- + +NTSTATUS +NPF_Write( + IN PDEVICE_OBJECT DeviceObject, + IN PIRP Irp + ) + +{ + POPEN_INSTANCE Open; + PIO_STACK_LOCATION IrpSp; + PNDIS_PACKET pPacket; + UINT i; + NDIS_STATUS Status; + + IF_LOUD(DbgPrint("NPF_Write\n");) + + IrpSp = IoGetCurrentIrpStackLocation(Irp); + + + Open=IrpSp->FileObject->FsContext; + + if( Open->Bound == FALSE ) + { + // The Network adapter was removed. + EXIT_FAILURE(0); + } + + NdisAcquireSpinLock(&Open->WriteLock); + if(Open->WriteInProgress) + { + // Another write operation is currently in progress + NdisReleaseSpinLock(&Open->WriteLock); + EXIT_FAILURE(0); + } + else + { + Open->WriteInProgress = TRUE; + } + + NdisReleaseSpinLock(&Open->WriteLock); + + IF_LOUD(DbgPrint("Max frame size = %d, packet size = %d\n", Open->MaxFrameSize, IrpSp->Parameters.Write.Length);) + + + if(IrpSp->Parameters.Write.Length == 0 || // Check that the buffer provided by the user is not empty + Open->MaxFrameSize == 0/* || // Check that the MaxFrameSize is correctly initialized + IrpSp->Parameters.Write.Length > Open->MaxFrameSize*/) // Check that the fame size is smaller that the MTU + { + IF_LOUD(DbgPrint("frame size out of range, send aborted\n");) + + EXIT_FAILURE(0); + } + + + IoMarkIrpPending(Irp); + + Open->Multiple_Write_Counter=Open->Nwrites; + + NdisResetEvent(&Open->WriteEvent); + + + for(i=0;iNwrites;i++){ + + // Try to get a packet from our list of free ones + NdisAllocatePacket( + &Status, + &pPacket, + Open->PacketPool + ); + + if (Status != NDIS_STATUS_SUCCESS) { + + // No free packets + Irp->IoStatus.Status = STATUS_INSUFFICIENT_RESOURCES; + IoCompleteRequest (Irp, IO_NO_INCREMENT); + return STATUS_INSUFFICIENT_RESOURCES; + } + + if(Open->SkipSentPackets) + { + NdisSetPacketFlags( + pPacket, + g_SendPacketFlags); + } + + // The packet hasn't a buffer that needs not to be freed after every single write + RESERVED(pPacket)->FreeBufAfterWrite = FALSE; + + // Save the IRP associated with the packet + RESERVED(pPacket)->Irp=Irp; + + // Attach the writes buffer to the packet + NdisChainBufferAtFront(pPacket,Irp->MdlAddress); + + test_addr = MmGetMdlVirtualAddress(Irp->MdlAddress); + + // Call the MAC + NdisSend( + &Status, + Open->AdapterHandle, + pPacket); + + if (Status != NDIS_STATUS_PENDING) { + // The send didn't pend so call the completion handler now + NPF_SendComplete( + Open, + pPacket, + Status + ); + + } + + if(i%100==99){ + NdisWaitEvent(&Open->WriteEvent,1000); + NdisResetEvent(&Open->WriteEvent); + } + } + + return(STATUS_PENDING); +} + +//------------------------------------------------------------------- + +INT +NPF_BufferedWrite( + IN PIRP Irp, + IN PCHAR UserBuff, + IN ULONG UserBuffSize, + BOOLEAN Sync) +{ + POPEN_INSTANCE Open; + PIO_STACK_LOCATION IrpSp; + PNDIS_PACKET pPacket; + NDIS_STATUS Status; + struct sf_pkthdr *winpcap_hdr; + PMDL TmpMdl; + PCHAR EndOfUserBuff = UserBuff + UserBuffSize; + + IF_LOUD(DbgPrint("NPF: BufferedWrite, UserBuff=%x, Size=%u\n", UserBuff, UserBuffSize);) + + IrpSp = IoGetCurrentIrpStackLocation(Irp); + + Open=IrpSp->FileObject->FsContext; + + if( Open->Bound == FALSE ){ + // The Network adapter was removed. + return 0; + } + + // Sanity check on the user buffer + if(UserBuff == NULL) + { + return 0; + } + + // Check that the MaxFrameSize is correctly initialized + if(Open->MaxFrameSize == 0) + { + IF_LOUD(DbgPrint("BufferedWrite: Open->MaxFrameSize not initialized, probably because of a problem in the OID query\n");) + + return 0; + } + + // Reset the event used to synchronize packet allocation + NdisResetEvent(&Open->WriteEvent); + + // Reset the pending packets counter + Open->Multiple_Write_Counter = 0; + + // Start from the first packet + winpcap_hdr = (struct sf_pkthdr*)UserBuff; + + // Check the consistency of the user buffer + if( (PCHAR)winpcap_hdr + winpcap_hdr->caplen + sizeof(struct sf_pkthdr) > EndOfUserBuff ) + { + IF_LOUD(DbgPrint("Buffered Write: bogus packet buffer\n");) + + return -1; + } + + // + // Main loop: send the buffer to the wire + // + while(TRUE) + { + + if(winpcap_hdr->caplen ==0/* || winpcap_hdr->caplen > Open->MaxFrameSize*/) + { + // Malformed header + IF_LOUD(DbgPrint("NPF_BufferedWrite: malformed or bogus user buffer, aborting write.\n");) + + return -1; + } + + // Allocate an MDL to map the packet data + TmpMdl = IoAllocateMdl((PCHAR)winpcap_hdr + sizeof(struct sf_pkthdr), + winpcap_hdr->caplen, + FALSE, + FALSE, + NULL); + + if (TmpMdl == NULL) + { + // Unable to map the memory: packet lost + IF_LOUD(DbgPrint("NPF_BufferedWrite: unable to allocate the MDL.\n");) + + return -1; + } + + MmBuildMdlForNonPagedPool(TmpMdl); // XXX can this line be removed? + + // Allocate a packet from our free list + NdisAllocatePacket( &Status, &pPacket, Open->PacketPool); + + if (Status != NDIS_STATUS_SUCCESS) { + // No more free packets + IF_LOUD(DbgPrint("NPF_BufferedWrite: no more free packets, returning.\n");) + + NdisResetEvent(&Open->WriteEvent); + + NdisWaitEvent(&Open->WriteEvent, 1000); + + // Try again to allocate a packet + NdisAllocatePacket( &Status, &pPacket, Open->PacketPool); + + if (Status != NDIS_STATUS_SUCCESS) { + // Second failure, report an error + IoFreeMdl(TmpMdl); + return -1; + } + +// IoFreeMdl(TmpMdl); +// return (PCHAR)winpcap_hdr - UserBuff; + } + + if(Open->SkipSentPackets) + { + NdisSetPacketFlags( + pPacket, + g_SendPacketFlags); + } + + // The packet has a buffer that needs to be freed after every single write + RESERVED(pPacket)->FreeBufAfterWrite = TRUE; + + TmpMdl->Next = NULL; + + // Attach the MDL to the packet + NdisChainBufferAtFront(pPacket, TmpMdl); + + // Increment the number of pending sends + InterlockedIncrement(&Open->Multiple_Write_Counter); + + // Call the MAC + NdisSend( &Status, Open->AdapterHandle, pPacket); + + if (Status != NDIS_STATUS_PENDING) { + // The send didn't pend so call the completion handler now + NPF_SendComplete( + Open, + pPacket, + Status + ); + } + + // Step to the next packet in the buffer + (PCHAR)winpcap_hdr += winpcap_hdr->caplen + sizeof(struct sf_pkthdr); + + // Check if the end of the user buffer has been reached + if( (PCHAR)winpcap_hdr >= EndOfUserBuff ) + { + IF_LOUD(DbgPrint("NPF_BufferedWrite: End of buffer.\n");) + + // Wait the completion of pending sends + NPF_WaitEndOfBufferedWrite(Open); + + return (INT)((PCHAR)winpcap_hdr - UserBuff); + } + + } + + return (INT)((PCHAR)winpcap_hdr - UserBuff); +} + +//------------------------------------------------------------------- + +VOID NPF_WaitEndOfBufferedWrite(POPEN_INSTANCE Open) +{ + UINT i; + + NdisResetEvent(&Open->WriteEvent); + + for(i=0; Open->Multiple_Write_Counter > 0 && i < TRANSMIT_PACKETS; i++) + { + NdisWaitEvent(&Open->WriteEvent, 100); + NdisResetEvent(&Open->WriteEvent); + } + + return; +} + +//------------------------------------------------------------------- + +VOID +NPF_SendComplete( + IN NDIS_HANDLE ProtocolBindingContext, + IN PNDIS_PACKET pPacket, + IN NDIS_STATUS Status + ) + +{ + PIRP Irp; + PIO_STACK_LOCATION irpSp; + POPEN_INSTANCE Open; + PMDL TmpMdl; + + IF_LOUD(DbgPrint("NPF: SendComplete, BindingContext=%d\n",ProtocolBindingContext);) + + Open= (POPEN_INSTANCE)ProtocolBindingContext; + + if( RESERVED(pPacket)->FreeBufAfterWrite ) + { + // + // Packet sent by NPF_BufferedWrite() + // + + + // Free the MDL associated with the packet + NdisUnchainBufferAtFront(pPacket, &TmpMdl); + + IoFreeMdl(TmpMdl); + + // recyle the packet + // NdisReinitializePacket(pPacket); + + NdisFreePacket(pPacket); + + // Increment the number of pending sends + InterlockedDecrement(&Open->Multiple_Write_Counter); + + NdisSetEvent(&Open->WriteEvent); + + return; + } + else + { + // + // Packet sent by NPF_Write() + // + + if((Open->Nwrites - Open->Multiple_Write_Counter) %100 == 99) + NdisSetEvent(&Open->WriteEvent); + + Open->Multiple_Write_Counter--; + + if(Open->Multiple_Write_Counter == 0){ + // Release the buffer and awake the application + NdisUnchainBufferAtFront(pPacket, &TmpMdl); + + // Complete the request + Irp=RESERVED(pPacket)->Irp; + irpSp = IoGetCurrentIrpStackLocation(Irp); + + Irp->IoStatus.Status = Status; + Irp->IoStatus.Information = irpSp->Parameters.Write.Length; + IoCompleteRequest(Irp, IO_NO_INCREMENT); + + NdisAcquireSpinLock(&Open->WriteLock); + Open->WriteInProgress = FALSE; + NdisReleaseSpinLock(&Open->WriteLock); + } + + // Put the packet back on the free list + NdisFreePacket(pPacket); + + return; + } + +} diff --git a/src/See/bucket_lookup.c b/src/See/bucket_lookup.c index 569ce163..a4a7b22f 100644 --- a/src/See/bucket_lookup.c +++ b/src/See/bucket_lookup.c @@ -1,264 +1,264 @@ -/* - * Copyright (c) 2001 - 2003 - * NetGroup, Politecnico di Torino (Italy) - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the Politecnico di Torino nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - */ - -#include - -#ifdef WIN32 -#include "tme.h" -#include "bucket_lookup.h" -#endif - -#ifdef __FreeBSD__ - -#ifdef _KERNEL -#include -#include -#else -#include -#include -#endif - -#endif - - - -/* the key is represented by the initial and final value */ -/* of the bucket. At the moment bucket_lookup is able to */ -/* manage values of 16, 32 bits. */ -uint32 bucket_lookup(uint8 *key, TME_DATA *data, MEM_TYPE *mem_ex, struct time_conv *time_ref) -{ - uint32 value; - uint32 i,j; - int found=-1; - uint32 blocks; - uint32 block_size; - uint8 *temp; - if ((data->key_len!=1)&& /*16 bit value*/ - (data->key_len!=2)) /*32 bit value*/ - return TME_ERROR; - - /*32 bit values*/ - blocks=data->filled_blocks-1; - block_size=data->block_size; - i=blocks/2; /*relative shift*/ - j=i; - temp=data->shared_memory_base_address+block_size; - - if (data->key_len==2) - { - value=SW_ULONG_AT(key,0); - - if((valueSW_ULONG_AT(temp+block_size*(blocks-1),4))) - { - uint32 *key32=(uint32*) key; - key32[0]=key32[1]=0; - - GET_TIME((struct timeval *)(data->shared_memory_base_address+8),time_ref); - - data->last_found=NULL; - return TME_FALSE; - } - - while(found==-1) /* search routine */ - { - i=(i==1)? 1:i>>1; - if (SW_ULONG_AT(temp+block_size*j,0)>value) - if (SW_ULONG_AT(temp+block_size*(j-1),4)value) - found=-2; - else - j+=i; - else found=j; - } - if (found<0) - { - uint32 *key32=(uint32*) key; - key32[0]=key32[1]=0; - - GET_TIME((struct timeval *)(data->shared_memory_base_address+8),time_ref); - - data->last_found=NULL; - return TME_FALSE; - } - - data->last_found=data->lut_base_address+found*sizeof(RECORD); - - COPY_MEMORY(key,temp+block_size*found,8); - - GET_TIME((struct timeval *)(temp+block_size*found+8),time_ref); - - return TME_TRUE; - } - else - { - value=SW_USHORT_AT(key,0); - - if((valueSW_USHORT_AT(temp+block_size*(blocks-1),2))) - { - uint16 *key16=(uint16*) key; - key16[0]=key16[1]=0; - - GET_TIME((struct timeval *)(data->shared_memory_base_address+4),time_ref); - - data->last_found=NULL; - return TME_FALSE; - } - - while(found==-1) /* search routine */ - { - i=(i==1)? 1:i>>1; - if (SW_USHORT_AT(temp+block_size*j,0)>value) - if (SW_USHORT_AT(temp+block_size*(j-1),2)value) - found=-2; - else - j+=i; - else found=j; - } - - if (found<0) - { - uint16 *key16=(uint16*) key; - key16[0]=key16[1]=0; - - GET_TIME((struct timeval *)(data->shared_memory_base_address+4),time_ref); - - data->last_found=NULL; - return TME_FALSE; - } - - data->last_found=data->lut_base_address+found*sizeof(RECORD); - - GET_TIME((struct timeval *)(temp+block_size*found+4),time_ref); - - COPY_MEMORY(key,temp+block_size*found,4); - - return TME_TRUE; - } - -} - -uint32 bucket_lookup_insert(uint8 *key, TME_DATA *data, MEM_TYPE *mem_ex, struct time_conv *time_ref) -{ - RECORD *records=(RECORD*)data->lut_base_address; - - if ((data->key_len!=1)&& /*16 bit value*/ - (data->key_len!=2)) /*32 bit value*/ - return TME_ERROR; - - if(data->key_len==2) - { - uint32 start,stop; - uint8 *tmp; - - start=SW_ULONG_AT(key,0); - stop=SW_ULONG_AT(key,4); - - if (start>stop) - return TME_ERROR; - if (data->filled_entries>0) - { - tmp=mem_ex->buffer+SW_ULONG_AT(&records[data->filled_entries-1].block,0); - /*check if it is coherent with the previous block*/ - if (SW_ULONG_AT(tmp,4)>=start) - return TME_ERROR; - } - - if (data->filled_blocks==data->shared_memory_blocks) - return TME_ERROR; - - if (data->filled_entries==data->lut_entries) - return TME_ERROR; - - tmp=data->shared_memory_base_address+data->block_size*data->filled_blocks; - - COPY_MEMORY(tmp,key,8); - - SW_ULONG_ASSIGN(&records[data->filled_entries].block,tmp-mem_ex->buffer); - SW_ULONG_ASSIGN(&records[data->filled_entries].exec_fcn,data->default_exec); - - GET_TIME((struct timeval *)(tmp+8),time_ref); - - data->filled_blocks++; - data->filled_entries++; - - return TME_TRUE; - } - else - { - uint16 start,stop; - uint8 *tmp; - - start=SW_USHORT_AT(key,0); - stop=SW_USHORT_AT(key,2); - - if (start>stop) - return TME_ERROR; - if (data->filled_entries>0) - { - tmp=mem_ex->buffer+SW_ULONG_AT(&records[data->filled_entries-1].block,0); - /*check if it is coherent with the previous block*/ - if (SW_USHORT_AT(tmp,2)>=start) - return TME_ERROR; - } - - if (data->filled_blocks==data->shared_memory_blocks) - return TME_ERROR; - - if (data->filled_entries==data->lut_entries) - return TME_ERROR; - - tmp=mem_ex->buffer+SW_ULONG_AT(&records[data->filled_entries].block,0); - - COPY_MEMORY(tmp,key,4); - - SW_ULONG_ASSIGN(&records[data->filled_entries].block,tmp-mem_ex->buffer); - SW_ULONG_ASSIGN(&records[data->filled_entries].exec_fcn,data->default_exec); - - GET_TIME((struct timeval *)(tmp+4),time_ref); - - data->filled_blocks++; - data->filled_entries++; - - return TME_TRUE; - } -} +/* + * Copyright (c) 2001 - 2003 + * NetGroup, Politecnico di Torino (Italy) + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the Politecnico di Torino nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#include + +#ifdef WIN32 +#include "tme.h" +#include "bucket_lookup.h" +#endif + +#ifdef __FreeBSD__ + +#ifdef _KERNEL +#include +#include +#else +#include +#include +#endif + +#endif + + + +/* the key is represented by the initial and final value */ +/* of the bucket. At the moment bucket_lookup is able to */ +/* manage values of 16, 32 bits. */ +uint32 bucket_lookup(uint8 *key, TME_DATA *data, MEM_TYPE *mem_ex, struct time_conv *time_ref) +{ + uint32 value; + uint32 i,j; + int found=-1; + uint32 blocks; + uint32 block_size; + uint8 *temp; + if ((data->key_len!=1)&& /*16 bit value*/ + (data->key_len!=2)) /*32 bit value*/ + return TME_ERROR; + + /*32 bit values*/ + blocks=data->filled_blocks-1; + block_size=data->block_size; + i=blocks/2; /*relative shift*/ + j=i; + temp=data->shared_memory_base_address+block_size; + + if (data->key_len==2) + { + value=SW_ULONG_AT(key,0); + + if((valueSW_ULONG_AT(temp+block_size*(blocks-1),4))) + { + uint32 *key32=(uint32*) key; + key32[0]=key32[1]=0; + + GET_TIME((struct timeval *)(data->shared_memory_base_address+8),time_ref); + + data->last_found=NULL; + return TME_FALSE; + } + + while(found==-1) /* search routine */ + { + i=(i==1)? 1:i>>1; + if (SW_ULONG_AT(temp+block_size*j,0)>value) + if (SW_ULONG_AT(temp+block_size*(j-1),4)value) + found=-2; + else + j+=i; + else found=j; + } + if (found<0) + { + uint32 *key32=(uint32*) key; + key32[0]=key32[1]=0; + + GET_TIME((struct timeval *)(data->shared_memory_base_address+8),time_ref); + + data->last_found=NULL; + return TME_FALSE; + } + + data->last_found=data->lut_base_address+found*sizeof(RECORD); + + COPY_MEMORY(key,temp+block_size*found,8); + + GET_TIME((struct timeval *)(temp+block_size*found+8),time_ref); + + return TME_TRUE; + } + else + { + value=SW_USHORT_AT(key,0); + + if((valueSW_USHORT_AT(temp+block_size*(blocks-1),2))) + { + uint16 *key16=(uint16*) key; + key16[0]=key16[1]=0; + + GET_TIME((struct timeval *)(data->shared_memory_base_address+4),time_ref); + + data->last_found=NULL; + return TME_FALSE; + } + + while(found==-1) /* search routine */ + { + i=(i==1)? 1:i>>1; + if (SW_USHORT_AT(temp+block_size*j,0)>value) + if (SW_USHORT_AT(temp+block_size*(j-1),2)value) + found=-2; + else + j+=i; + else found=j; + } + + if (found<0) + { + uint16 *key16=(uint16*) key; + key16[0]=key16[1]=0; + + GET_TIME((struct timeval *)(data->shared_memory_base_address+4),time_ref); + + data->last_found=NULL; + return TME_FALSE; + } + + data->last_found=data->lut_base_address+found*sizeof(RECORD); + + GET_TIME((struct timeval *)(temp+block_size*found+4),time_ref); + + COPY_MEMORY(key,temp+block_size*found,4); + + return TME_TRUE; + } + +} + +uint32 bucket_lookup_insert(uint8 *key, TME_DATA *data, MEM_TYPE *mem_ex, struct time_conv *time_ref) +{ + RECORD *records=(RECORD*)data->lut_base_address; + + if ((data->key_len!=1)&& /*16 bit value*/ + (data->key_len!=2)) /*32 bit value*/ + return TME_ERROR; + + if(data->key_len==2) + { + uint32 start,stop; + uint8 *tmp; + + start=SW_ULONG_AT(key,0); + stop=SW_ULONG_AT(key,4); + + if (start>stop) + return TME_ERROR; + if (data->filled_entries>0) + { + tmp=mem_ex->buffer+SW_ULONG_AT(&records[data->filled_entries-1].block,0); + /*check if it is coherent with the previous block*/ + if (SW_ULONG_AT(tmp,4)>=start) + return TME_ERROR; + } + + if (data->filled_blocks==data->shared_memory_blocks) + return TME_ERROR; + + if (data->filled_entries==data->lut_entries) + return TME_ERROR; + + tmp=data->shared_memory_base_address+data->block_size*data->filled_blocks; + + COPY_MEMORY(tmp,key,8); + + SW_ULONG_ASSIGN(&records[data->filled_entries].block,tmp-mem_ex->buffer); + SW_ULONG_ASSIGN(&records[data->filled_entries].exec_fcn,data->default_exec); + + GET_TIME((struct timeval *)(tmp+8),time_ref); + + data->filled_blocks++; + data->filled_entries++; + + return TME_TRUE; + } + else + { + uint16 start,stop; + uint8 *tmp; + + start=SW_USHORT_AT(key,0); + stop=SW_USHORT_AT(key,2); + + if (start>stop) + return TME_ERROR; + if (data->filled_entries>0) + { + tmp=mem_ex->buffer+SW_ULONG_AT(&records[data->filled_entries-1].block,0); + /*check if it is coherent with the previous block*/ + if (SW_USHORT_AT(tmp,2)>=start) + return TME_ERROR; + } + + if (data->filled_blocks==data->shared_memory_blocks) + return TME_ERROR; + + if (data->filled_entries==data->lut_entries) + return TME_ERROR; + + tmp=mem_ex->buffer+SW_ULONG_AT(&records[data->filled_entries].block,0); + + COPY_MEMORY(tmp,key,4); + + SW_ULONG_ASSIGN(&records[data->filled_entries].block,tmp-mem_ex->buffer); + SW_ULONG_ASSIGN(&records[data->filled_entries].exec_fcn,data->default_exec); + + GET_TIME((struct timeval *)(tmp+4),time_ref); + + data->filled_blocks++; + data->filled_entries++; + + return TME_TRUE; + } +} diff --git a/src/See/bucket_lookup.h b/src/See/bucket_lookup.h index d8700b54..fbd1ef0b 100644 --- a/src/See/bucket_lookup.h +++ b/src/See/bucket_lookup.h @@ -1,54 +1,54 @@ -/* - * Copyright (c) 2001 - 2003 - * NetGroup, Politecnico di Torino (Italy) - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the Politecnico di Torino nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - */ - -#ifndef __bucket_lookup -#define __bucket_lookup -#ifdef WIN32 -#include "tme.h" -#endif - -#ifdef __FreeBSD__ - -#ifdef _KERNEL -#include -#else -#include -#endif - -#endif - -#define BUCKET_LOOKUP_INSERT 0x00000011 -uint32 bucket_lookup_insert(uint8 *key, TME_DATA *data, MEM_TYPE *mem_ex, struct time_conv *time_ref); -#define BUCKET_LOOKUP 0x00000010 -uint32 bucket_lookup(uint8 *key, TME_DATA *data, MEM_TYPE *mem_ex, struct time_conv *time_ref); - -#endif +/* + * Copyright (c) 2001 - 2003 + * NetGroup, Politecnico di Torino (Italy) + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the Politecnico di Torino nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#ifndef __bucket_lookup +#define __bucket_lookup +#ifdef WIN32 +#include "tme.h" +#endif + +#ifdef __FreeBSD__ + +#ifdef _KERNEL +#include +#else +#include +#endif + +#endif + +#define BUCKET_LOOKUP_INSERT 0x00000011 +uint32 bucket_lookup_insert(uint8 *key, TME_DATA *data, MEM_TYPE *mem_ex, struct time_conv *time_ref); +#define BUCKET_LOOKUP 0x00000010 +uint32 bucket_lookup(uint8 *key, TME_DATA *data, MEM_TYPE *mem_ex, struct time_conv *time_ref); + +#endif diff --git a/src/See/count_packets.c b/src/See/count_packets.c index 9e69241d..681023c6 100644 --- a/src/See/count_packets.c +++ b/src/See/count_packets.c @@ -1,64 +1,64 @@ -/* - * Copyright (c) 2001 - 2003 - * NetGroup, Politecnico di Torino (Italy) - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the Politecnico di Torino nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - */ - -#include - -#ifdef WIN32 -#include "tme.h" -#include "count_packets.h" -#endif - -#ifdef __FreeBSD__ - -#ifdef _KERNEL -#include -#include -#else -#include -#include -#endif - -#endif - - - -uint32 count_packets(uint8 *block, uint32 pkt_size, TME_DATA *data, MEM_TYPE *mem_ex, uint8 *mem_data) -{ - - c_p_data *counters=(c_p_data*)(block+data->key_len*4); - - counters->bytes+=pkt_size; - counters->packets++; - - return TME_SUCCESS; - -} +/* + * Copyright (c) 2001 - 2003 + * NetGroup, Politecnico di Torino (Italy) + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the Politecnico di Torino nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#include + +#ifdef WIN32 +#include "tme.h" +#include "count_packets.h" +#endif + +#ifdef __FreeBSD__ + +#ifdef _KERNEL +#include +#include +#else +#include +#include +#endif + +#endif + + + +uint32 count_packets(uint8 *block, uint32 pkt_size, TME_DATA *data, MEM_TYPE *mem_ex, uint8 *mem_data) +{ + + c_p_data *counters=(c_p_data*)(block+data->key_len*4); + + counters->bytes+=pkt_size; + counters->packets++; + + return TME_SUCCESS; + +} diff --git a/src/See/count_packets.h b/src/See/count_packets.h index 9853bda3..2cd1af59 100644 --- a/src/See/count_packets.h +++ b/src/See/count_packets.h @@ -1,62 +1,62 @@ -/* - * Copyright (c) 2001 - 2003 - * NetGroup, Politecnico di Torino (Italy) - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the Politecnico di Torino nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - */ - -#ifndef __count_packets -#define __count_packets - -#ifdef WIN32 -#include "tme.h" -#endif - -#ifdef __FreeBSD__ - -#ifdef _KERNEL -#include -#else -#include -#endif - -#endif - -typedef struct __c_p_data -{ - struct timeval timestamp; - uint64 packets; - uint64 bytes; -} - c_p_data; - -#define COUNT_PACKETS 0x00000000 -uint32 count_packets(uint8 *block, uint32 pkt_size, TME_DATA *data, MEM_TYPE *mem_ex, uint8 *mem_data); - -#endif - +/* + * Copyright (c) 2001 - 2003 + * NetGroup, Politecnico di Torino (Italy) + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the Politecnico di Torino nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#ifndef __count_packets +#define __count_packets + +#ifdef WIN32 +#include "tme.h" +#endif + +#ifdef __FreeBSD__ + +#ifdef _KERNEL +#include +#else +#include +#endif + +#endif + +typedef struct __c_p_data +{ + struct timeval timestamp; + uint64 packets; + uint64 bytes; +} + c_p_data; + +#define COUNT_PACKETS 0x00000000 +uint32 count_packets(uint8 *block, uint32 pkt_size, TME_DATA *data, MEM_TYPE *mem_ex, uint8 *mem_data); + +#endif + diff --git a/src/See/dagc.h b/src/See/dagc.h index e676e40c..e3d3d512 100644 --- a/src/See/dagc.h +++ b/src/See/dagc.h @@ -1,225 +1,225 @@ -/* - * Copyright (c) 2003 - * NetGroup, Politecnico di Torino (Italy) - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the Politecnico di Torino nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - */ - -#define DAGC_ERRBUF_SIZE 512 -#define FILEBUFSIZE 65536 -#define MAXDAGCARDS 32 - -#ifndef _WIN32 - -typedef long long long_long; -typedef long long ull_t; -#define TRUE 1 -#define devicestring "/dev/dag%d" -#define dagc_sleepms(_MS) usleep(_MS * 1000) -#else /* _WIN32 */ - -typedef LONGLONG long_long; -typedef ULONGLONG ull_t; -#define dagc_sleepms(_MS) Sleep(_MS) -#define devicestring "\\\\.\\dag%d" - -#endif /* _WIN32 */ - -#define MIN_DAG_SNAPLEN 12 -#define MAX_DAG_SNAPLEN 2040 - -#define erffilestring "erffile://" - - -#define ATM_SNAPLEN 48 -/* Size of ATM payload */ -#define ATM_WLEN(h) ATM_SNAPLEN -#define ATM_SLEN(h) ATM_SNAPLEN - -/* Size Ethernet payload */ -#define ETHERNET_WLEN(h, b) ((u_int)ntohs((h)->wlen) - ((b) >> 3)) -#define ETHERNET_SLEN(h, b) min(ETHERNET_WLEN(h, b), \ - (u_int)ntohs((h)->rlen) - dag_record_size - 2) - -/* Size of HDLC payload */ -#define HDLC_WLEN(h, b) ((u_int)ntohs((h)->wlen) - ((b) >> 3)) -#define HDLC_SLEN(h, b) min(HDLC_WLEN(h, b), \ - (u_int)ntohs((h)->rlen) - dag_record_size) - -/* Flags for dagc_open */ -#define DAGC_OPEN_SHARED 1 -#define DAGC_OPEN_EXCLUSIVE 2 - -#define TYPE_LEGACY 0 -#define TYPE_HDLC_POS 1 -#define TYPE_ETH 2 -#define TYPE_ATM 3 -#define TYPE_AAL5 4 - -/* - * Card statistics. - */ -typedef struct dagc_stats_t -{ - ull_t received; /* (NOT IMPLEMENTED) total number of frames received by the DAG */ - ull_t dropped; /* number of frames dropped for buffer full */ - ull_t captured; /* (NOT IMPLEMENTED) number of frames that actually reach the - application, i.e that are not filtered or dropped */ -} dagc_stats_t; - -/* - * Descriptor of an open session. - * Note: the dagc_t descriptor is completely opaque to the application. It can be compared - * to a file descriptor. - */ -typedef struct dagc dagc_t; - -/* - * Card description. - */ -typedef struct dagc_if_t -{ - struct dagc_if_t *next; - char *name; /* pointer to a string to pass to dagc_open*/ - char *description; /* human-understandable description (e.g. Endace 3.5e Fast - Ethernet Card) */ -} dagc_if_t; - - - -/* - * returns a string with last dagc lib error - */ -#define dagc_getlasterror(dagcfd) dagcfd->errbuf - -/* - * returns a linked list with the cards available on the systems. For every card, it scans the - * card type and converts it to a human-understandable string, in order to provide a description - * useful for example when a system has more than one card - */ -int dagc_finddevs (dagc_if_t **alldevsp, char *ebuf); - - -/* - * frees the card list. - */ -void dagc_freedevs (dagc_if_t *alldevsp); - - -/* - * Opens a card (or a file) for capture. Snaplen is the portion of packet delivered to the - * application, flags can contain specific settings (for example promisc mode??), minbufsize - * is the smallest buffer that the API can provide to the application (to limit CPU waste - * with several small buffers under moderated network throughputs) - */ -dagc_t* dagc_open(const char *source, unsigned flags, char *ebuf); - -/* - * Sets the snaplen of a card - * Returns -1 on failure. On success, the actual snaplen is returned (snap len has to be a multiple of 4 - * with DAG cards). - */ -int dagc_setsnaplen(dagc_t *dagcfd, unsigned snaplen); - -/* - * closes a capture instance - */ -void dagc_close(dagc_t *dagcfd); - - -/* - * returns the linktype of a card - */ -int dagc_getlinktype(dagc_t *dagcfd); - - -/* - * returns the link speed of the adapter, in MB/s. - * If the link speed of the card is unknown, -1 is returned. - * XXX NOTE: Currently, there is no consistent way to get linkspeed querying the card. - * As a consequence, we determine this value statically from the card model. For cards that can run at - * different speeds, we report only the *maximum* speed. - */ -int dagc_getlinkspeed(dagc_t *dagcfd); - - -/* - * Returns the length of the CRC checksum that the card associates with any packet in the hole. This - * information will be used to understand the actual length of the packet on the wire. - * Note: this information is not provided consistently by DAG cards, so we gather it from an environment - * variable in Unix and from a registry key in Windows. - */ -unsigned dagc_getfcslen(dagc_t *dagcfd); - -/* - * provides a buffer with the new packets (from the board or from the file) and its size. - * On success, the return value is 0. If an error has occurred, the return value is -1. - * If EOF has reached, the return value is -2. Note that this function always returns - * immediately, eventually with an empty buffer, so it is possible to have a success (0) - * return value and bufsize = 0. - */ -int dagc_receive(dagc_t *dagcfd, u_char **buffer, u_int *bufsize); - - -/* - * returns nonzero if any data is available from dagcfd, -1 if an error occurred. Waits until almost the time - * specified by timeout has past or any data is available. If timeout=0, returns immediately. - * If timeout=NULL, blocks until a packet arrives. - */ -int dagc_wait(dagc_t *dagcfd, struct timeval *timeout); - - -/* - * returns statistics about current capture session - */ -int dagc_stats(dagc_t *dagcfd, dagc_stats_t *ps); - - -/* - * Opens a dump file to store the data of this capture. - * Returns 0 on success. - * NOTE: currently, dagc_dumpfile_open, dagc_dumpfile_close and dagc_dump are simply wrappers - * for open, close and write. However, if the programmer uses these functions, he is more protected - * against file format changes (for example if the file format will have an header in the future). - * Moreover, assuming that the user knows the file format is a bad practice: providing - * simple simple save functionality is more intuitive and user-friendly. - */ -int dagc_dumpfile_open(dagc_t *dagcfd, char* name); - - -/* - * Closes a dump file - */ -int dagc_dumpfile_close(dagc_t *dagcfd); - - -/* - * Writes a buffer of packets to a dump file - * Returns 0 on success. - */ -int dagc_dump(dagc_t *dagcfd, u_char *buffer, u_int bufsize); +/* + * Copyright (c) 2003 + * NetGroup, Politecnico di Torino (Italy) + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the Politecnico di Torino nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#define DAGC_ERRBUF_SIZE 512 +#define FILEBUFSIZE 65536 +#define MAXDAGCARDS 32 + +#ifndef _WIN32 + +typedef long long long_long; +typedef long long ull_t; +#define TRUE 1 +#define devicestring "/dev/dag%d" +#define dagc_sleepms(_MS) usleep(_MS * 1000) +#else /* _WIN32 */ + +typedef LONGLONG long_long; +typedef ULONGLONG ull_t; +#define dagc_sleepms(_MS) Sleep(_MS) +#define devicestring "\\\\.\\dag%d" + +#endif /* _WIN32 */ + +#define MIN_DAG_SNAPLEN 12 +#define MAX_DAG_SNAPLEN 2040 + +#define erffilestring "erffile://" + + +#define ATM_SNAPLEN 48 +/* Size of ATM payload */ +#define ATM_WLEN(h) ATM_SNAPLEN +#define ATM_SLEN(h) ATM_SNAPLEN + +/* Size Ethernet payload */ +#define ETHERNET_WLEN(h, b) ((u_int)ntohs((h)->wlen) - ((b) >> 3)) +#define ETHERNET_SLEN(h, b) min(ETHERNET_WLEN(h, b), \ + (u_int)ntohs((h)->rlen) - dag_record_size - 2) + +/* Size of HDLC payload */ +#define HDLC_WLEN(h, b) ((u_int)ntohs((h)->wlen) - ((b) >> 3)) +#define HDLC_SLEN(h, b) min(HDLC_WLEN(h, b), \ + (u_int)ntohs((h)->rlen) - dag_record_size) + +/* Flags for dagc_open */ +#define DAGC_OPEN_SHARED 1 +#define DAGC_OPEN_EXCLUSIVE 2 + +#define TYPE_LEGACY 0 +#define TYPE_HDLC_POS 1 +#define TYPE_ETH 2 +#define TYPE_ATM 3 +#define TYPE_AAL5 4 + +/* + * Card statistics. + */ +typedef struct dagc_stats_t +{ + ull_t received; /* (NOT IMPLEMENTED) total number of frames received by the DAG */ + ull_t dropped; /* number of frames dropped for buffer full */ + ull_t captured; /* (NOT IMPLEMENTED) number of frames that actually reach the + application, i.e that are not filtered or dropped */ +} dagc_stats_t; + +/* + * Descriptor of an open session. + * Note: the dagc_t descriptor is completely opaque to the application. It can be compared + * to a file descriptor. + */ +typedef struct dagc dagc_t; + +/* + * Card description. + */ +typedef struct dagc_if_t +{ + struct dagc_if_t *next; + char *name; /* pointer to a string to pass to dagc_open*/ + char *description; /* human-understandable description (e.g. Endace 3.5e Fast + Ethernet Card) */ +} dagc_if_t; + + + +/* + * returns a string with last dagc lib error + */ +#define dagc_getlasterror(dagcfd) dagcfd->errbuf + +/* + * returns a linked list with the cards available on the systems. For every card, it scans the + * card type and converts it to a human-understandable string, in order to provide a description + * useful for example when a system has more than one card + */ +int dagc_finddevs (dagc_if_t **alldevsp, char *ebuf); + + +/* + * frees the card list. + */ +void dagc_freedevs (dagc_if_t *alldevsp); + + +/* + * Opens a card (or a file) for capture. Snaplen is the portion of packet delivered to the + * application, flags can contain specific settings (for example promisc mode??), minbufsize + * is the smallest buffer that the API can provide to the application (to limit CPU waste + * with several small buffers under moderated network throughputs) + */ +dagc_t* dagc_open(const char *source, unsigned flags, char *ebuf); + +/* + * Sets the snaplen of a card + * Returns -1 on failure. On success, the actual snaplen is returned (snap len has to be a multiple of 4 + * with DAG cards). + */ +int dagc_setsnaplen(dagc_t *dagcfd, unsigned snaplen); + +/* + * closes a capture instance + */ +void dagc_close(dagc_t *dagcfd); + + +/* + * returns the linktype of a card + */ +int dagc_getlinktype(dagc_t *dagcfd); + + +/* + * returns the link speed of the adapter, in MB/s. + * If the link speed of the card is unknown, -1 is returned. + * XXX NOTE: Currently, there is no consistent way to get linkspeed querying the card. + * As a consequence, we determine this value statically from the card model. For cards that can run at + * different speeds, we report only the *maximum* speed. + */ +int dagc_getlinkspeed(dagc_t *dagcfd); + + +/* + * Returns the length of the CRC checksum that the card associates with any packet in the hole. This + * information will be used to understand the actual length of the packet on the wire. + * Note: this information is not provided consistently by DAG cards, so we gather it from an environment + * variable in Unix and from a registry key in Windows. + */ +unsigned dagc_getfcslen(dagc_t *dagcfd); + +/* + * provides a buffer with the new packets (from the board or from the file) and its size. + * On success, the return value is 0. If an error has occurred, the return value is -1. + * If EOF has reached, the return value is -2. Note that this function always returns + * immediately, eventually with an empty buffer, so it is possible to have a success (0) + * return value and bufsize = 0. + */ +int dagc_receive(dagc_t *dagcfd, u_char **buffer, u_int *bufsize); + + +/* + * returns nonzero if any data is available from dagcfd, -1 if an error occurred. Waits until almost the time + * specified by timeout has past or any data is available. If timeout=0, returns immediately. + * If timeout=NULL, blocks until a packet arrives. + */ +int dagc_wait(dagc_t *dagcfd, struct timeval *timeout); + + +/* + * returns statistics about current capture session + */ +int dagc_stats(dagc_t *dagcfd, dagc_stats_t *ps); + + +/* + * Opens a dump file to store the data of this capture. + * Returns 0 on success. + * NOTE: currently, dagc_dumpfile_open, dagc_dumpfile_close and dagc_dump are simply wrappers + * for open, close and write. However, if the programmer uses these functions, he is more protected + * against file format changes (for example if the file format will have an header in the future). + * Moreover, assuming that the user knows the file format is a bad practice: providing + * simple simple save functionality is more intuitive and user-friendly. + */ +int dagc_dumpfile_open(dagc_t *dagcfd, char* name); + + +/* + * Closes a dump file + */ +int dagc_dumpfile_close(dagc_t *dagcfd); + + +/* + * Writes a buffer of packets to a dump file + * Returns 0 on success. + */ +int dagc_dump(dagc_t *dagcfd, u_char *buffer, u_int bufsize); diff --git a/src/See/dump.c b/src/See/dump.c index e60aa6cb..ba1abdc4 100644 --- a/src/See/dump.c +++ b/src/See/dump.c @@ -1,570 +1,570 @@ -/* - * Copyright (c) 1999 - 2003 - * NetGroup, Politecnico di Torino (Italy) - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the Politecnico di Torino nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - */ - -#include - -#include -#include -#include -#include -#include "debug.h" -#include "packet.h" - -#include "win_bpf.h" - -//------------------------------------------------------------------- - -NTSTATUS -NPF_OpenDumpFile(POPEN_INSTANCE Open , PUNICODE_STRING fileName, BOOLEAN Append) -{ - NTSTATUS ntStatus; - IO_STATUS_BLOCK IoStatus; - OBJECT_ATTRIBUTES ObjectAttributes; - PWCHAR PathPrefix; - USHORT PathLen; - UNICODE_STRING FullFileName; - ULONG FullFileNameLength; - PDEVICE_OBJECT fsdDevice; - - IF_LOUD(DbgPrint("NPF: OpenDumpFile.\n");) - - if(fileName->Buffer[0] == L'\\' && - fileName->Buffer[1] == L'?' && - fileName->Buffer[2] == L'?' && - fileName->Buffer[3] == L'\\' - ){ - PathLen = 0; - } - else{ - PathPrefix = L"\\??\\"; - PathLen = 8; - } - - // Insert the correct path prefix. - FullFileNameLength = PathLen + fileName->MaximumLength; - - FullFileName.Buffer = ExAllocatePoolWithTag(NonPagedPool, - FullFileNameLength, - '0DWA'); - - if (FullFileName.Buffer == NULL) { - ntStatus = STATUS_INSUFFICIENT_RESOURCES; - return ntStatus; - } - - FullFileName.Length = PathLen; - FullFileName.MaximumLength = (USHORT)FullFileNameLength; - - if(PathLen) - RtlMoveMemory (FullFileName.Buffer, PathPrefix, PathLen); - - RtlAppendUnicodeStringToString (&FullFileName, fileName); - - IF_LOUD(DbgPrint( "Packet: Attempting to open %wZ\n", &FullFileName);) - - InitializeObjectAttributes ( &ObjectAttributes, - &FullFileName, - OBJ_CASE_INSENSITIVE, - NULL, - NULL ); - - // Create the dump file - ntStatus = ZwCreateFile( &Open->DumpFileHandle, - SYNCHRONIZE | FILE_WRITE_DATA, - &ObjectAttributes, - &IoStatus, - NULL, - FILE_ATTRIBUTE_NORMAL, - FILE_SHARE_READ, - (Append)?FILE_OPEN_IF:FILE_SUPERSEDE, - FILE_SYNCHRONOUS_IO_NONALERT, - NULL, - 0 ); - - if ( !NT_SUCCESS( ntStatus ) ) - { - IF_LOUD(DbgPrint("NPF: Error opening file %x\n", ntStatus);) - - ExFreePool(FullFileName.Buffer); - Open->DumpFileHandle=NULL; - ntStatus = STATUS_NO_SUCH_FILE; - return ntStatus; - } - - ExFreePool(FullFileName.Buffer); - - ntStatus = ObReferenceObjectByHandle(Open->DumpFileHandle, - FILE_WRITE_ACCESS, - *IoFileObjectType, - KernelMode, - &Open->DumpFileObject, - 0); - - if ( !NT_SUCCESS( ntStatus ) ) - { - IF_LOUD(DbgPrint("NPF: Error creating file, status=%x\n", ntStatus);) - - ZwClose( Open->DumpFileHandle ); - Open->DumpFileHandle=NULL; - - ntStatus = STATUS_NO_SUCH_FILE; - return ntStatus; - } - - fsdDevice = IoGetRelatedDeviceObject(Open->DumpFileObject); - - IF_LOUD(DbgPrint("NPF: Dump: write file created succesfully, status=%d \n",ntStatus);) - - return ntStatus; -} - -//------------------------------------------------------------------- - -NTSTATUS -NPF_StartDump(POPEN_INSTANCE Open) -{ - NTSTATUS ntStatus; - struct packet_file_header hdr; - IO_STATUS_BLOCK IoStatus; - - IF_LOUD(DbgPrint("NPF: StartDump.\n");) - - // Init the file header - hdr.magic = TCPDUMP_MAGIC; - hdr.version_major = PCAP_VERSION_MAJOR; - hdr.version_minor = PCAP_VERSION_MINOR; - hdr.thiszone = 0; /*Currently not set*/ - hdr.snaplen = 1514; - hdr.sigfigs = 0; - - // Detect the medium type - switch (Open->Medium){ - - case NdisMediumWan: - hdr.linktype = DLT_EN10MB; - break; - - case NdisMedium802_3: - hdr.linktype = DLT_EN10MB; - break; - - case NdisMediumFddi: - hdr.linktype = DLT_FDDI; - break; - - case NdisMedium802_5: - hdr.linktype = DLT_IEEE802; - break; - - case NdisMediumArcnet878_2: - hdr.linktype = DLT_ARCNET; - break; - - case NdisMediumAtm: - hdr.linktype = DLT_ATM_RFC1483; - break; - - default: - hdr.linktype = DLT_EN10MB; - } - - // Write the header. - // We can use ZwWriteFile because we are in the context of the application - ntStatus = ZwWriteFile(Open->DumpFileHandle, - NULL, - NULL, - NULL, - &IoStatus, - &hdr, - sizeof(hdr), - NULL, - NULL ); - - - if ( !NT_SUCCESS( ntStatus ) ) - { - IF_LOUD(DbgPrint("NPF: Error dumping file %x\n", ntStatus);) - - ZwClose( Open->DumpFileHandle ); - Open->DumpFileHandle=NULL; - - ntStatus = STATUS_NO_SUCH_FILE; - return ntStatus; - } - - Open->DumpOffset.QuadPart=24; - - ntStatus = PsCreateSystemThread(&Open->DumpThreadHandle, - THREAD_ALL_ACCESS, - (ACCESS_MASK)0L, - 0, - 0, - NPF_DumpThread, - Open); - - if ( !NT_SUCCESS( ntStatus ) ) - { - IF_LOUD(DbgPrint("NPF: Error creating dump thread, status=%x\n", ntStatus);) - - ZwClose( Open->DumpFileHandle ); - Open->DumpFileHandle=NULL; - - return ntStatus; - } - - ntStatus = ObReferenceObjectByHandle(Open->DumpThreadHandle, - THREAD_ALL_ACCESS, - NULL, - KernelMode, - &Open->DumpThreadObject, - 0); - - if ( !NT_SUCCESS( ntStatus ) ) - { - IF_LOUD(DbgPrint("NPF: Error creating dump thread, status=%x\n", ntStatus);) - - ObDereferenceObject(Open->DumpFileObject); - ZwClose( Open->DumpFileHandle ); - Open->DumpFileHandle=NULL; - - return ntStatus; - } - - - return ntStatus; - -} - -//------------------------------------------------------------------- -// Dump Thread -//------------------------------------------------------------------- - -VOID NPF_DumpThread(POPEN_INSTANCE Open) -{ -// ULONG FrozenNic; - - IF_LOUD(DbgPrint("NPF: In the work routine. Parameter = 0x%0x\n",Open);) - - while(TRUE){ - - // Wait until some packets arrive or the timeout expires - NdisWaitEvent(&Open->DumpEvent, 5000); - - IF_LOUD(DbgPrint("NPF: Worker Thread - event signalled\n");) - - if(Open->DumpLimitReached || - Open->Size==0){ // BufSize=0 means that this instance was closed, or that the buffer is too - // small for any capture. In both cases it is better to end the dump - - IF_LOUD(DbgPrint("NPF: Worker Thread - Exiting happily\n");) - IF_LOUD(DbgPrint("Thread: Dumpoffset=%I64d\n",Open->DumpOffset.QuadPart);) - - PsTerminateSystemThread(STATUS_SUCCESS); - return; - } - - NdisResetEvent(&Open->DumpEvent); - - // Write the content of the buffer to the file - if(NPF_SaveCurrentBuffer(Open) != STATUS_SUCCESS){ - PsTerminateSystemThread(STATUS_SUCCESS); - return; - } - - } - -} - -//------------------------------------------------------------------- - -NTSTATUS NPF_SaveCurrentBuffer(POPEN_INSTANCE Open) -{ -#if 0 - - Thead=Open->Bhead; - Ttail=Open->Btail; - TLastByte=Open->BLastByte; - - IF_LOUD(DbgPrint("NPF: NPF_SaveCurrentBuffer.\n");) - - // Get the address of the buffer - CurrBuff=Open->Buffer; - // - // Fill the application buffer - // - if( Ttail < Thead ) - { - if(Open->MaxDumpBytes && - (UINT)Open->DumpOffset.QuadPart /*+ GetBuffOccupation(Open)*/ > Open->MaxDumpBytes) - { - // Size limit reached - UINT PktLen; - - SizeToDump = 0; - - // Scan the buffer to detect the exact amount of data to save - while(TRUE){ - PktLen = ((struct sf_pkthdr*)(CurrBuff + Thead + SizeToDump))->caplen + sizeof(struct sf_pkthdr); - - if((UINT)Open->DumpOffset.QuadPart + SizeToDump + PktLen > Open->MaxDumpBytes) - break; - - SizeToDump += PktLen; - } - - } - else - SizeToDump = TLastByte-Thead; - - lMdl=IoAllocateMdl(CurrBuff+Thead, SizeToDump, FALSE, FALSE, NULL); - if (lMdl == NULL) - { - // No memory: stop dump - IF_LOUD(DbgPrint("NPF: dump thread: Failed to allocate Mdl\n");) - return STATUS_UNSUCCESSFUL; - } - - MmBuildMdlForNonPagedPool(lMdl); - - // Write to disk - NPF_WriteDumpFile(Open->DumpFileObject, - &Open->DumpOffset, - SizeToDump, - lMdl, - &IoStatus); - - IoFreeMdl(lMdl); - - if(!NT_SUCCESS(IoStatus.Status)){ - // Error - return STATUS_UNSUCCESSFUL; - } - - if(SizeToDump != TLastByte-Thead){ - // Size limit reached. - Open->DumpLimitReached = TRUE; - - // Awake the application - KeSetEvent(Open->ReadEvent,0,FALSE); - - return STATUS_UNSUCCESSFUL; - } - - // Update the packet buffer - Open->DumpOffset.QuadPart+=(TLastByte-Thead); - Open->BLastByte=Ttail; - Open->Bhead=0; - } - - if( Ttail > Thead ){ - - if(Open->MaxDumpBytes && - (UINT)Open->DumpOffset.QuadPart /* +GetBuffOccupation(Open)*/ > Open->MaxDumpBytes) - { - // Size limit reached - UINT PktLen; - - SizeToDump = 0; - - // Scan the buffer to detect the exact amount of data to save - while(Thead + SizeToDump < Ttail){ - - PktLen = ((struct sf_pkthdr*)(CurrBuff + Thead + SizeToDump))->caplen + sizeof(struct sf_pkthdr); - - if((UINT)Open->DumpOffset.QuadPart + SizeToDump + PktLen > Open->MaxDumpBytes) - break; - - SizeToDump += PktLen; - } - - } - else - SizeToDump = Ttail-Thead; - - lMdl=IoAllocateMdl(CurrBuff+Thead, SizeToDump, FALSE, FALSE, NULL); - if (lMdl == NULL) - { - // No memory: stop dump - IF_LOUD(DbgPrint("NPF: dump thread: Failed to allocate Mdl\n");) - return STATUS_UNSUCCESSFUL; - } - - MmBuildMdlForNonPagedPool(lMdl); - - // Write to disk - NPF_WriteDumpFile(Open->DumpFileObject, - &Open->DumpOffset, - SizeToDump, - lMdl, - &IoStatus); - - IoFreeMdl(lMdl); - - if(!NT_SUCCESS(IoStatus.Status)){ - // Error - return STATUS_UNSUCCESSFUL; - } - - if(SizeToDump != Ttail-Thead){ - // Size limit reached. - Open->DumpLimitReached = TRUE; - - // Awake the application - KeSetEvent(Open->ReadEvent,0,FALSE); - - return STATUS_UNSUCCESSFUL; - } - - // Update the packet buffer - Open->DumpOffset.QuadPart+=(Ttail-Thead); - Open->Bhead=Ttail; - - } -#endif - return STATUS_SUCCESS; -} - -//------------------------------------------------------------------- - -NTSTATUS NPF_CloseDumpFile(POPEN_INSTANCE Open){ -#if 0 - IF_LOUD(DbgPrint("NPF: NPF_CloseDumpFile.\n");) - IF_LOUD(DbgPrint("Dumpoffset=%d\n",Open->DumpOffset.QuadPart);) - -DbgPrint("1\n"); - // Consistency check - if(Open->DumpFileHandle == NULL) - return STATUS_UNSUCCESSFUL; - -DbgPrint("2\n"); - ZwClose( Open->DumpFileHandle ); - - ObDereferenceObject(Open->DumpFileObject); -/* - if(Open->DumpLimitReached == TRUE) - // Limit already reached: don't save the rest of the buffer. - return STATUS_SUCCESS; -*/ -DbgPrint("3\n"); - - NPF_OpenDumpFile(Open,&Open->DumpFileName, TRUE); - - // Flush the buffer to file - NPF_SaveCurrentBuffer(Open); - - // Close The file - ObDereferenceObject(Open->DumpFileObject); - ZwClose( Open->DumpFileHandle ); - - Open->DumpFileHandle = NULL; - - ObDereferenceObject(Open->DumpFileObject); -#endif - return STATUS_SUCCESS; -} - -//------------------------------------------------------------------- - -static NTSTATUS PacketDumpCompletion(PDEVICE_OBJECT DeviceObject, - PIRP Irp, - PVOID Context) -{ - - // Copy the status information back into the "user" IOSB - *Irp->UserIosb = Irp->IoStatus; - - // Wake up the mainline code - KeSetEvent(Irp->UserEvent, 0, FALSE); - - return STATUS_MORE_PROCESSING_REQUIRED; -} - -//------------------------------------------------------------------- - -VOID NPF_WriteDumpFile(PFILE_OBJECT FileObject, - PLARGE_INTEGER Offset, - ULONG Length, - PMDL Mdl, - PIO_STATUS_BLOCK IoStatusBlock) -{ - PIRP irp; - KEVENT event; - PIO_STACK_LOCATION ioStackLocation; - PDEVICE_OBJECT fsdDevice = IoGetRelatedDeviceObject(FileObject); - - // Set up the event we'll use - KeInitializeEvent(&event, SynchronizationEvent, FALSE); - - // Allocate and build the IRP we'll be sending to the FSD - irp = IoAllocateIrp(fsdDevice->StackSize, FALSE); - - if (!irp) { - // Allocation failed, presumably due to memory allocation failure - IoStatusBlock->Status = STATUS_INSUFFICIENT_RESOURCES; - IoStatusBlock->Information = 0; - - return; - } - - irp->MdlAddress = Mdl; - irp->UserEvent = &event; - irp->UserIosb = IoStatusBlock; - irp->Tail.Overlay.Thread = PsGetCurrentThread(); - irp->Tail.Overlay.OriginalFileObject= FileObject; - irp->RequestorMode = KernelMode; - - // Indicate that this is a WRITE operation - irp->Flags = IRP_WRITE_OPERATION; - - // Set up the next I/O stack location - ioStackLocation = IoGetNextIrpStackLocation(irp); - ioStackLocation->MajorFunction = IRP_MJ_WRITE; - ioStackLocation->MinorFunction = 0; - ioStackLocation->DeviceObject = fsdDevice; - ioStackLocation->FileObject = FileObject; - IoSetCompletionRoutine(irp, PacketDumpCompletion, 0, TRUE, TRUE, TRUE); - ioStackLocation->Parameters.Write.Length = Length; - ioStackLocation->Parameters.Write.ByteOffset = *Offset; - - - // Send it on. Ignore the return code - (void) IoCallDriver(fsdDevice, irp); - - // Wait for the I/O to complete. - KeWaitForSingleObject(&event, Executive, KernelMode, TRUE, 0); - - // Free the IRP now that we are done with it - IoFreeIrp(irp); - - return; - -} +/* + * Copyright (c) 1999 - 2003 + * NetGroup, Politecnico di Torino (Italy) + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the Politecnico di Torino nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#include + +#include +#include +#include +#include +#include "debug.h" +#include "packet.h" + +#include "win_bpf.h" + +//------------------------------------------------------------------- + +NTSTATUS +NPF_OpenDumpFile(POPEN_INSTANCE Open , PUNICODE_STRING fileName, BOOLEAN Append) +{ + NTSTATUS ntStatus; + IO_STATUS_BLOCK IoStatus; + OBJECT_ATTRIBUTES ObjectAttributes; + PWCHAR PathPrefix; + USHORT PathLen; + UNICODE_STRING FullFileName; + ULONG FullFileNameLength; + PDEVICE_OBJECT fsdDevice; + + IF_LOUD(DbgPrint("NPF: OpenDumpFile.\n");) + + if(fileName->Buffer[0] == L'\\' && + fileName->Buffer[1] == L'?' && + fileName->Buffer[2] == L'?' && + fileName->Buffer[3] == L'\\' + ){ + PathLen = 0; + } + else{ + PathPrefix = L"\\??\\"; + PathLen = 8; + } + + // Insert the correct path prefix. + FullFileNameLength = PathLen + fileName->MaximumLength; + + FullFileName.Buffer = ExAllocatePoolWithTag(NonPagedPool, + FullFileNameLength, + '0DWA'); + + if (FullFileName.Buffer == NULL) { + ntStatus = STATUS_INSUFFICIENT_RESOURCES; + return ntStatus; + } + + FullFileName.Length = PathLen; + FullFileName.MaximumLength = (USHORT)FullFileNameLength; + + if(PathLen) + RtlMoveMemory (FullFileName.Buffer, PathPrefix, PathLen); + + RtlAppendUnicodeStringToString (&FullFileName, fileName); + + IF_LOUD(DbgPrint( "Packet: Attempting to open %wZ\n", &FullFileName);) + + InitializeObjectAttributes ( &ObjectAttributes, + &FullFileName, + OBJ_CASE_INSENSITIVE, + NULL, + NULL ); + + // Create the dump file + ntStatus = ZwCreateFile( &Open->DumpFileHandle, + SYNCHRONIZE | FILE_WRITE_DATA, + &ObjectAttributes, + &IoStatus, + NULL, + FILE_ATTRIBUTE_NORMAL, + FILE_SHARE_READ, + (Append)?FILE_OPEN_IF:FILE_SUPERSEDE, + FILE_SYNCHRONOUS_IO_NONALERT, + NULL, + 0 ); + + if ( !NT_SUCCESS( ntStatus ) ) + { + IF_LOUD(DbgPrint("NPF: Error opening file %x\n", ntStatus);) + + ExFreePool(FullFileName.Buffer); + Open->DumpFileHandle=NULL; + ntStatus = STATUS_NO_SUCH_FILE; + return ntStatus; + } + + ExFreePool(FullFileName.Buffer); + + ntStatus = ObReferenceObjectByHandle(Open->DumpFileHandle, + FILE_WRITE_ACCESS, + *IoFileObjectType, + KernelMode, + &Open->DumpFileObject, + 0); + + if ( !NT_SUCCESS( ntStatus ) ) + { + IF_LOUD(DbgPrint("NPF: Error creating file, status=%x\n", ntStatus);) + + ZwClose( Open->DumpFileHandle ); + Open->DumpFileHandle=NULL; + + ntStatus = STATUS_NO_SUCH_FILE; + return ntStatus; + } + + fsdDevice = IoGetRelatedDeviceObject(Open->DumpFileObject); + + IF_LOUD(DbgPrint("NPF: Dump: write file created succesfully, status=%d \n",ntStatus);) + + return ntStatus; +} + +//------------------------------------------------------------------- + +NTSTATUS +NPF_StartDump(POPEN_INSTANCE Open) +{ + NTSTATUS ntStatus; + struct packet_file_header hdr; + IO_STATUS_BLOCK IoStatus; + + IF_LOUD(DbgPrint("NPF: StartDump.\n");) + + // Init the file header + hdr.magic = TCPDUMP_MAGIC; + hdr.version_major = PCAP_VERSION_MAJOR; + hdr.version_minor = PCAP_VERSION_MINOR; + hdr.thiszone = 0; /*Currently not set*/ + hdr.snaplen = 1514; + hdr.sigfigs = 0; + + // Detect the medium type + switch (Open->Medium){ + + case NdisMediumWan: + hdr.linktype = DLT_EN10MB; + break; + + case NdisMedium802_3: + hdr.linktype = DLT_EN10MB; + break; + + case NdisMediumFddi: + hdr.linktype = DLT_FDDI; + break; + + case NdisMedium802_5: + hdr.linktype = DLT_IEEE802; + break; + + case NdisMediumArcnet878_2: + hdr.linktype = DLT_ARCNET; + break; + + case NdisMediumAtm: + hdr.linktype = DLT_ATM_RFC1483; + break; + + default: + hdr.linktype = DLT_EN10MB; + } + + // Write the header. + // We can use ZwWriteFile because we are in the context of the application + ntStatus = ZwWriteFile(Open->DumpFileHandle, + NULL, + NULL, + NULL, + &IoStatus, + &hdr, + sizeof(hdr), + NULL, + NULL ); + + + if ( !NT_SUCCESS( ntStatus ) ) + { + IF_LOUD(DbgPrint("NPF: Error dumping file %x\n", ntStatus);) + + ZwClose( Open->DumpFileHandle ); + Open->DumpFileHandle=NULL; + + ntStatus = STATUS_NO_SUCH_FILE; + return ntStatus; + } + + Open->DumpOffset.QuadPart=24; + + ntStatus = PsCreateSystemThread(&Open->DumpThreadHandle, + THREAD_ALL_ACCESS, + (ACCESS_MASK)0L, + 0, + 0, + NPF_DumpThread, + Open); + + if ( !NT_SUCCESS( ntStatus ) ) + { + IF_LOUD(DbgPrint("NPF: Error creating dump thread, status=%x\n", ntStatus);) + + ZwClose( Open->DumpFileHandle ); + Open->DumpFileHandle=NULL; + + return ntStatus; + } + + ntStatus = ObReferenceObjectByHandle(Open->DumpThreadHandle, + THREAD_ALL_ACCESS, + NULL, + KernelMode, + &Open->DumpThreadObject, + 0); + + if ( !NT_SUCCESS( ntStatus ) ) + { + IF_LOUD(DbgPrint("NPF: Error creating dump thread, status=%x\n", ntStatus);) + + ObDereferenceObject(Open->DumpFileObject); + ZwClose( Open->DumpFileHandle ); + Open->DumpFileHandle=NULL; + + return ntStatus; + } + + + return ntStatus; + +} + +//------------------------------------------------------------------- +// Dump Thread +//------------------------------------------------------------------- + +VOID NPF_DumpThread(POPEN_INSTANCE Open) +{ +// ULONG FrozenNic; + + IF_LOUD(DbgPrint("NPF: In the work routine. Parameter = 0x%0x\n",Open);) + + while(TRUE){ + + // Wait until some packets arrive or the timeout expires + NdisWaitEvent(&Open->DumpEvent, 5000); + + IF_LOUD(DbgPrint("NPF: Worker Thread - event signalled\n");) + + if(Open->DumpLimitReached || + Open->Size==0){ // BufSize=0 means that this instance was closed, or that the buffer is too + // small for any capture. In both cases it is better to end the dump + + IF_LOUD(DbgPrint("NPF: Worker Thread - Exiting happily\n");) + IF_LOUD(DbgPrint("Thread: Dumpoffset=%I64d\n",Open->DumpOffset.QuadPart);) + + PsTerminateSystemThread(STATUS_SUCCESS); + return; + } + + NdisResetEvent(&Open->DumpEvent); + + // Write the content of the buffer to the file + if(NPF_SaveCurrentBuffer(Open) != STATUS_SUCCESS){ + PsTerminateSystemThread(STATUS_SUCCESS); + return; + } + + } + +} + +//------------------------------------------------------------------- + +NTSTATUS NPF_SaveCurrentBuffer(POPEN_INSTANCE Open) +{ +#if 0 + + Thead=Open->Bhead; + Ttail=Open->Btail; + TLastByte=Open->BLastByte; + + IF_LOUD(DbgPrint("NPF: NPF_SaveCurrentBuffer.\n");) + + // Get the address of the buffer + CurrBuff=Open->Buffer; + // + // Fill the application buffer + // + if( Ttail < Thead ) + { + if(Open->MaxDumpBytes && + (UINT)Open->DumpOffset.QuadPart /*+ GetBuffOccupation(Open)*/ > Open->MaxDumpBytes) + { + // Size limit reached + UINT PktLen; + + SizeToDump = 0; + + // Scan the buffer to detect the exact amount of data to save + while(TRUE){ + PktLen = ((struct sf_pkthdr*)(CurrBuff + Thead + SizeToDump))->caplen + sizeof(struct sf_pkthdr); + + if((UINT)Open->DumpOffset.QuadPart + SizeToDump + PktLen > Open->MaxDumpBytes) + break; + + SizeToDump += PktLen; + } + + } + else + SizeToDump = TLastByte-Thead; + + lMdl=IoAllocateMdl(CurrBuff+Thead, SizeToDump, FALSE, FALSE, NULL); + if (lMdl == NULL) + { + // No memory: stop dump + IF_LOUD(DbgPrint("NPF: dump thread: Failed to allocate Mdl\n");) + return STATUS_UNSUCCESSFUL; + } + + MmBuildMdlForNonPagedPool(lMdl); + + // Write to disk + NPF_WriteDumpFile(Open->DumpFileObject, + &Open->DumpOffset, + SizeToDump, + lMdl, + &IoStatus); + + IoFreeMdl(lMdl); + + if(!NT_SUCCESS(IoStatus.Status)){ + // Error + return STATUS_UNSUCCESSFUL; + } + + if(SizeToDump != TLastByte-Thead){ + // Size limit reached. + Open->DumpLimitReached = TRUE; + + // Awake the application + KeSetEvent(Open->ReadEvent,0,FALSE); + + return STATUS_UNSUCCESSFUL; + } + + // Update the packet buffer + Open->DumpOffset.QuadPart+=(TLastByte-Thead); + Open->BLastByte=Ttail; + Open->Bhead=0; + } + + if( Ttail > Thead ){ + + if(Open->MaxDumpBytes && + (UINT)Open->DumpOffset.QuadPart /* +GetBuffOccupation(Open)*/ > Open->MaxDumpBytes) + { + // Size limit reached + UINT PktLen; + + SizeToDump = 0; + + // Scan the buffer to detect the exact amount of data to save + while(Thead + SizeToDump < Ttail){ + + PktLen = ((struct sf_pkthdr*)(CurrBuff + Thead + SizeToDump))->caplen + sizeof(struct sf_pkthdr); + + if((UINT)Open->DumpOffset.QuadPart + SizeToDump + PktLen > Open->MaxDumpBytes) + break; + + SizeToDump += PktLen; + } + + } + else + SizeToDump = Ttail-Thead; + + lMdl=IoAllocateMdl(CurrBuff+Thead, SizeToDump, FALSE, FALSE, NULL); + if (lMdl == NULL) + { + // No memory: stop dump + IF_LOUD(DbgPrint("NPF: dump thread: Failed to allocate Mdl\n");) + return STATUS_UNSUCCESSFUL; + } + + MmBuildMdlForNonPagedPool(lMdl); + + // Write to disk + NPF_WriteDumpFile(Open->DumpFileObject, + &Open->DumpOffset, + SizeToDump, + lMdl, + &IoStatus); + + IoFreeMdl(lMdl); + + if(!NT_SUCCESS(IoStatus.Status)){ + // Error + return STATUS_UNSUCCESSFUL; + } + + if(SizeToDump != Ttail-Thead){ + // Size limit reached. + Open->DumpLimitReached = TRUE; + + // Awake the application + KeSetEvent(Open->ReadEvent,0,FALSE); + + return STATUS_UNSUCCESSFUL; + } + + // Update the packet buffer + Open->DumpOffset.QuadPart+=(Ttail-Thead); + Open->Bhead=Ttail; + + } +#endif + return STATUS_SUCCESS; +} + +//------------------------------------------------------------------- + +NTSTATUS NPF_CloseDumpFile(POPEN_INSTANCE Open){ +#if 0 + IF_LOUD(DbgPrint("NPF: NPF_CloseDumpFile.\n");) + IF_LOUD(DbgPrint("Dumpoffset=%d\n",Open->DumpOffset.QuadPart);) + +DbgPrint("1\n"); + // Consistency check + if(Open->DumpFileHandle == NULL) + return STATUS_UNSUCCESSFUL; + +DbgPrint("2\n"); + ZwClose( Open->DumpFileHandle ); + + ObDereferenceObject(Open->DumpFileObject); +/* + if(Open->DumpLimitReached == TRUE) + // Limit already reached: don't save the rest of the buffer. + return STATUS_SUCCESS; +*/ +DbgPrint("3\n"); + + NPF_OpenDumpFile(Open,&Open->DumpFileName, TRUE); + + // Flush the buffer to file + NPF_SaveCurrentBuffer(Open); + + // Close The file + ObDereferenceObject(Open->DumpFileObject); + ZwClose( Open->DumpFileHandle ); + + Open->DumpFileHandle = NULL; + + ObDereferenceObject(Open->DumpFileObject); +#endif + return STATUS_SUCCESS; +} + +//------------------------------------------------------------------- + +static NTSTATUS PacketDumpCompletion(PDEVICE_OBJECT DeviceObject, + PIRP Irp, + PVOID Context) +{ + + // Copy the status information back into the "user" IOSB + *Irp->UserIosb = Irp->IoStatus; + + // Wake up the mainline code + KeSetEvent(Irp->UserEvent, 0, FALSE); + + return STATUS_MORE_PROCESSING_REQUIRED; +} + +//------------------------------------------------------------------- + +VOID NPF_WriteDumpFile(PFILE_OBJECT FileObject, + PLARGE_INTEGER Offset, + ULONG Length, + PMDL Mdl, + PIO_STATUS_BLOCK IoStatusBlock) +{ + PIRP irp; + KEVENT event; + PIO_STACK_LOCATION ioStackLocation; + PDEVICE_OBJECT fsdDevice = IoGetRelatedDeviceObject(FileObject); + + // Set up the event we'll use + KeInitializeEvent(&event, SynchronizationEvent, FALSE); + + // Allocate and build the IRP we'll be sending to the FSD + irp = IoAllocateIrp(fsdDevice->StackSize, FALSE); + + if (!irp) { + // Allocation failed, presumably due to memory allocation failure + IoStatusBlock->Status = STATUS_INSUFFICIENT_RESOURCES; + IoStatusBlock->Information = 0; + + return; + } + + irp->MdlAddress = Mdl; + irp->UserEvent = &event; + irp->UserIosb = IoStatusBlock; + irp->Tail.Overlay.Thread = PsGetCurrentThread(); + irp->Tail.Overlay.OriginalFileObject= FileObject; + irp->RequestorMode = KernelMode; + + // Indicate that this is a WRITE operation + irp->Flags = IRP_WRITE_OPERATION; + + // Set up the next I/O stack location + ioStackLocation = IoGetNextIrpStackLocation(irp); + ioStackLocation->MajorFunction = IRP_MJ_WRITE; + ioStackLocation->MinorFunction = 0; + ioStackLocation->DeviceObject = fsdDevice; + ioStackLocation->FileObject = FileObject; + IoSetCompletionRoutine(irp, PacketDumpCompletion, 0, TRUE, TRUE, TRUE); + ioStackLocation->Parameters.Write.Length = Length; + ioStackLocation->Parameters.Write.ByteOffset = *Offset; + + + // Send it on. Ignore the return code + (void) IoCallDriver(fsdDevice, irp); + + // Wait for the I/O to complete. + KeWaitForSingleObject(&event, Executive, KernelMode, TRUE, 0); + + // Free the IRP now that we are done with it + IoFreeIrp(irp); + + return; + +} diff --git a/src/See/functions.c b/src/See/functions.c index e6817343..f21ed83b 100644 --- a/src/See/functions.c +++ b/src/See/functions.c @@ -1,95 +1,95 @@ -/* - * Copyright (c) 1999 - 2003 - * NetGroup, Politecnico di Torino (Italy) - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the Politecnico di Torino nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - */ - -#include - -#ifdef WIN32 -#include "tme.h" -#include "functions.h" -#endif - -#ifdef __FreeBSD__ - -#ifdef _KERNEL -#include -#include -#include -#else -#include -#include -#include -#endif - -#endif - - - -lut_fcn lut_fcn_mapper(uint32 index) -{ - - switch (index) - { - case NORMAL_LUT_W_INSERT: - return (lut_fcn) normal_lut_w_insert; - - case NORMAL_LUT_WO_INSERT: - return (lut_fcn) normal_lut_wo_insert; - - case BUCKET_LOOKUP: - return (lut_fcn) bucket_lookup; - - case BUCKET_LOOKUP_INSERT: - return (lut_fcn) bucket_lookup_insert; - - default: - return NULL; - } - - return NULL; - -} - -exec_fcn exec_fcn_mapper(uint32 index) -{ - switch (index) - { - case COUNT_PACKETS: - return (exec_fcn) count_packets; - - case TCP_SESSION: - return (exec_fcn) tcp_session; - default: - return NULL; - } - - return NULL; -} +/* + * Copyright (c) 1999 - 2003 + * NetGroup, Politecnico di Torino (Italy) + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the Politecnico di Torino nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#include + +#ifdef WIN32 +#include "tme.h" +#include "functions.h" +#endif + +#ifdef __FreeBSD__ + +#ifdef _KERNEL +#include +#include +#include +#else +#include +#include +#include +#endif + +#endif + + + +lut_fcn lut_fcn_mapper(uint32 index) +{ + + switch (index) + { + case NORMAL_LUT_W_INSERT: + return (lut_fcn) normal_lut_w_insert; + + case NORMAL_LUT_WO_INSERT: + return (lut_fcn) normal_lut_wo_insert; + + case BUCKET_LOOKUP: + return (lut_fcn) bucket_lookup; + + case BUCKET_LOOKUP_INSERT: + return (lut_fcn) bucket_lookup_insert; + + default: + return NULL; + } + + return NULL; + +} + +exec_fcn exec_fcn_mapper(uint32 index) +{ + switch (index) + { + case COUNT_PACKETS: + return (exec_fcn) count_packets; + + case TCP_SESSION: + return (exec_fcn) tcp_session; + default: + return NULL; + } + + return NULL; +} diff --git a/src/See/functions.h b/src/See/functions.h index 9715ce10..62366000 100644 --- a/src/See/functions.h +++ b/src/See/functions.h @@ -1,78 +1,78 @@ -/* - * Copyright (c) 1999 - 2003 - * NetGroup, Politecnico di Torino (Italy) - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the Politecnico di Torino nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - */ - -#ifndef __FUNCTIONS -#define __FUNCTIONS - -#ifdef WIN32 -#include "tme.h" -#endif - -#ifdef __FreeBSD__ - -#ifdef _KERNEL -#include -#else -#include -#endif - -#endif -/*function mappers */ - -lut_fcn lut_fcn_mapper(uint32 index); -exec_fcn exec_fcn_mapper(uint32 index); - -/* lookup functions */ - -#ifdef WIN32 -#include "bucket_lookup.h" -#include "normal_lookup.h" -#endif - -#ifdef __FreeBSD__ -#include -#include -#endif - -/* execution functions */ - -#ifdef WIN32 -#include "count_packets.h" -#include "tcp_session.h" -#endif - -#ifdef __FreeBSD__ -#include -#include -#endif - -#endif +/* + * Copyright (c) 1999 - 2003 + * NetGroup, Politecnico di Torino (Italy) + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the Politecnico di Torino nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#ifndef __FUNCTIONS +#define __FUNCTIONS + +#ifdef WIN32 +#include "tme.h" +#endif + +#ifdef __FreeBSD__ + +#ifdef _KERNEL +#include +#else +#include +#endif + +#endif +/*function mappers */ + +lut_fcn lut_fcn_mapper(uint32 index); +exec_fcn exec_fcn_mapper(uint32 index); + +/* lookup functions */ + +#ifdef WIN32 +#include "bucket_lookup.h" +#include "normal_lookup.h" +#endif + +#ifdef __FreeBSD__ +#include +#include +#endif + +/* execution functions */ + +#ifdef WIN32 +#include "count_packets.h" +#include "tcp_session.h" +#endif + +#ifdef __FreeBSD__ +#include +#include +#endif + +#endif diff --git a/src/See/jitter.c b/src/See/jitter.c index 1b0a0ae5..72c83166 100644 --- a/src/See/jitter.c +++ b/src/See/jitter.c @@ -1,687 +1,687 @@ -/* - * Copyright (c) 2002 - 2005 NetGroup, Politecnico di Torino (Italy) - * Copyright (c) 2005 CACE Technologies, Davis (California) - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the Politecnico di Torino, CACE Technologies - * nor the names of its contributors may be used to endorse or promote - * products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - */ - -#include - -#include "stdarg.h" -#include "ntddk.h" -#include "ntiologc.h" -#include "ndis.h" - -#include "packet.h" -#include "win_bpf.h" -#include "jitter.h" - -// -// emit routine to update the jump table -// -void emit_length(binary_stream *stream, ULONG value, UINT len) -{ - (stream->refs)[stream->bpf_pc]+=len; - stream->cur_ip+=len; -} - -// -// emit routine to output the actual binary code -// -void emit_code(binary_stream *stream, ULONG value, UINT len) -{ - - switch (len){ - - case 1: - stream->ibuf[stream->cur_ip]=(UCHAR)value; - stream->cur_ip++; - break; - - case 2: - *((USHORT*)(stream->ibuf+stream->cur_ip))=(USHORT)value; - stream->cur_ip+=2; - break; - - case 4: - *((ULONG*)(stream->ibuf+stream->cur_ip))=value; - stream->cur_ip+=4; - break; - - default:; - - } - - return; - -} - -// -// Function that does the real stuff -// -BPF_filter_function BPFtoX86(struct bpf_insn *prog, UINT nins, INT *mem) -{ - struct bpf_insn *ins; - UINT i, pass; - binary_stream stream; - - //NOTE: do not modify the name of this variable, as it's used by the macros to emit code. - emit_func emitm; - - - // Allocate the reference table for the jumps -#ifdef NTKERNEL - stream.refs=(UINT *)ExAllocatePoolWithTag(NonPagedPool, (nins + 1)*sizeof(UINT), '0JWA'); -#else - stream.refs=(UINT *)malloc((nins + 1)*sizeof(UINT)); -#endif - if(stream.refs==NULL) - { - return NULL; - } - - // Reset the reference table - for(i=0; i< nins + 1; i++) - stream.refs[i]=0; - - stream.cur_ip=0; - stream.bpf_pc=0; - - // the first pass will emit the lengths of the instructions - // to create the reference table - emitm=emit_length; - - for(pass=0;;){ - - ins = prog; - - /* create the procedure header */ - PUSH(EBP) - MOVrd(EBP,ESP) - PUSH(EBX) - PUSH(ECX) - PUSH(EDX) - PUSH(ESI) - PUSH(EDI) - MOVodd(EBX, EBP, 8) - - for(i=0;icode) { - - default: - - return NULL; - - case BPF_RET|BPF_K: - - MOVid(EAX,ins->k) - POP(EDI) - POP(ESI) - POP(EDX) - POP(ECX) - POP(EBX) - POP(EBP) - RET() - - break; - - - case BPF_RET|BPF_A: - - POP(EDI) - POP(ESI) - POP(EDX) - POP(ECX) - POP(EBX) - POP(EBP) - RET() - - break; - - - case BPF_LD|BPF_W|BPF_ABS: - - MOVid(ECX,ins->k) - MOVrd(ESI,ECX) - ADDib(ECX,sizeof(INT)) - CMPodd(ECX, EBP, 0x10) - JLEb(12) - POP(EDI) - POP(ESI) - POP(EDX) - POP(ECX) - POP(EBX) - POP(EBP) - MOVid(EAX,0) //this can be optimized with xor eax,eax - RET() - MOVobd(EAX, EBX, ESI) - BSWAP(EAX) - - break; - - case BPF_LD|BPF_H|BPF_ABS: - - MOVid(ECX,ins->k) - MOVrd(ESI,ECX) - ADDib(ECX,sizeof(SHORT)) - CMPodd(ECX, EBP, 0x10) - JLEb(12) - POP(EDI) - POP(ESI) - POP(EDX) - POP(ECX) - POP(EBX) - POP(EBP) - MOVid(EAX,0) - RET() - MOVid(EAX,0) - MOVobw(AX, EBX, ESI) - SWAP_AX() - - break; - - case BPF_LD|BPF_B|BPF_ABS: - - MOVid(ECX,ins->k) - CMPodd(ECX, EBP, 0x10) - JLEb(12) - POP(EDI) - POP(ESI) - POP(EDX) - POP(ECX) - POP(EBX) - POP(EBP) - MOVid(EAX,0) - RET() - MOVid(EAX,0) - MOVobb(AL,EBX,ECX) - - break; - - case BPF_LD|BPF_W|BPF_LEN: - - MOVodd(EAX, EBP, 0xc) - - break; - - case BPF_LDX|BPF_W|BPF_LEN: - - MOVodd(EDX, EBP, 0xc) - - break; - - case BPF_LD|BPF_W|BPF_IND: - - MOVid(ECX,ins->k) - ADDrd(ECX,EDX) - MOVrd(ESI,ECX) - ADDib(ECX,sizeof(INT)) - CMPodd(ECX, EBP, 0x10) - JLEb(12) - POP(EDI) - POP(ESI) - POP(EDX) - POP(ECX) - POP(EBX) - POP(EBP) - MOVid(EAX,0) - RET() - MOVobd(EAX, EBX, ESI) - BSWAP(EAX) - - break; - - case BPF_LD|BPF_H|BPF_IND: - - MOVid(ECX,ins->k) - ADDrd(ECX,EDX) - MOVrd(ESI,ECX) - ADDib(ECX,sizeof(SHORT)) - CMPodd(ECX, EBP, 0x10) - JLEb(12) - POP(EDI) - POP(ESI) - POP(EDX) - POP(ECX) - POP(EBX) - POP(EBP) - MOVid(EAX,0) - RET() - MOVid(EAX,0) - MOVobw(AX, EBX, ESI) - SWAP_AX() - - break; - - case BPF_LD|BPF_B|BPF_IND: - - MOVid(ECX,ins->k) - ADDrd(ECX,EDX) - CMPodd(ECX, EBP, 0x10) - JLEb(12) - POP(EDI) - POP(ESI) - POP(EDX) - POP(ECX) - POP(EBX) - POP(EBP) - MOVid(EAX,0) - RET() - MOVid(EAX,0) - MOVobb(AL,EBX,ECX) - - break; - - case BPF_LDX|BPF_MSH|BPF_B: - - MOVid(ECX,ins->k) - CMPodd(ECX, EBP, 0x10) - JLEb(12) - POP(EDI) - POP(ESI) - POP(EDX) - POP(ECX) - POP(EBX) - POP(EBP) - MOVid(EAX,0) - RET() - MOVid(EDX,0) - MOVobb(DL,EBX,ECX) - ANDib(DL, 0xf) - SHLib(EDX, 2) - - break; - - case BPF_LD|BPF_IMM: - - MOVid(EAX,ins->k) - - break; - - case BPF_LDX|BPF_IMM: - - MOVid(EDX,ins->k) - - break; - - case BPF_LD|BPF_MEM: - - MOVid(ECX,(INT)mem) - MOVid(ESI,ins->k*4) - MOVobd(EAX, ECX, ESI) - - break; - - case BPF_LDX|BPF_MEM: - - MOVid(ECX,(INT)mem) - MOVid(ESI,ins->k*4) - MOVobd(EDX, ECX, ESI) - - break; - - case BPF_ST: - - // XXX: this command and the following could be optimized if the previous - // instruction was already of this type - MOVid(ECX,(INT)mem) - MOVid(ESI,ins->k*4) - MOVomd(ECX, ESI, EAX) - - break; - - case BPF_STX: - - MOVid(ECX,(INT)mem) - MOVid(ESI,ins->k*4) - MOVomd(ECX, ESI, EDX) - break; - - case BPF_JMP|BPF_JA: - - JMP(stream.refs[stream.bpf_pc+ins->k]-stream.refs[stream.bpf_pc]) - - break; - - case BPF_JMP|BPF_JGT|BPF_K: - - CMPid(EAX, ins->k) - JG(stream.refs[stream.bpf_pc+ins->jt]-stream.refs[stream.bpf_pc]+5) // 5 is the size of the following JMP - JMP(stream.refs[stream.bpf_pc+ins->jf]-stream.refs[stream.bpf_pc]) - break; - - case BPF_JMP|BPF_JGE|BPF_K: - - CMPid(EAX, ins->k) - JGE(stream.refs[stream.bpf_pc+ins->jt]-stream.refs[stream.bpf_pc]+5) - JMP(stream.refs[stream.bpf_pc+ins->jf]-stream.refs[stream.bpf_pc]) - - break; - - case BPF_JMP|BPF_JEQ|BPF_K: - - CMPid(EAX, ins->k) - JE(stream.refs[stream.bpf_pc+ins->jt]-stream.refs[stream.bpf_pc]+5) - JMP(stream.refs[stream.bpf_pc+ins->jf]-stream.refs[stream.bpf_pc]) - - break; - - case BPF_JMP|BPF_JSET|BPF_K: - - MOVrd(ECX,EAX) - ANDid(ECX,ins->k) - JE(stream.refs[stream.bpf_pc+ins->jf]-stream.refs[stream.bpf_pc]+5) - JMP(stream.refs[stream.bpf_pc+ins->jt]-stream.refs[stream.bpf_pc]) - - break; - - case BPF_JMP|BPF_JGT|BPF_X: - - CMPrd(EAX, EDX) - JA(stream.refs[stream.bpf_pc+ins->jt]-stream.refs[stream.bpf_pc]+5) - JMP(stream.refs[stream.bpf_pc+ins->jf]-stream.refs[stream.bpf_pc]) - break; - - case BPF_JMP|BPF_JGE|BPF_X: - - CMPrd(EAX, EDX) - JAE(stream.refs[stream.bpf_pc+ins->jt]-stream.refs[stream.bpf_pc]+5) - JMP(stream.refs[stream.bpf_pc+ins->jf]-stream.refs[stream.bpf_pc]) - - break; - - case BPF_JMP|BPF_JEQ|BPF_X: - - CMPrd(EAX, EDX) - JE(stream.refs[stream.bpf_pc+ins->jt]-stream.refs[stream.bpf_pc]+5) - JMP(stream.refs[stream.bpf_pc+ins->jf]-stream.refs[stream.bpf_pc]) - - break; - - case BPF_JMP|BPF_JSET|BPF_X: - - MOVrd(ECX,EAX) - ANDrd(ECX,EDX) - JE(stream.refs[stream.bpf_pc+ins->jf]-stream.refs[stream.bpf_pc]+5) - JMP(stream.refs[stream.bpf_pc+ins->jt]-stream.refs[stream.bpf_pc]) - - break; - - case BPF_ALU|BPF_ADD|BPF_X: - - ADDrd(EAX,EDX) - - break; - - case BPF_ALU|BPF_SUB|BPF_X: - - SUBrd(EAX,EDX) - - break; - - case BPF_ALU|BPF_MUL|BPF_X: - - MOVrd(ECX,EDX) - MULrd(EDX) - MOVrd(EDX,ECX) - break; - - case BPF_ALU|BPF_DIV|BPF_X: - - CMPid(EDX, 0) - JNEb(12) - POP(EDI) - POP(ESI) - POP(EDX) - POP(ECX) - POP(EBX) - POP(EBP) - MOVid(EAX,0) - RET() - MOVrd(ECX,EDX) - MOVid(EDX,0) - DIVrd(ECX) - MOVrd(EDX,ECX) - - break; - - case BPF_ALU|BPF_AND|BPF_X: - - ANDrd(EAX,EDX) - - break; - - case BPF_ALU|BPF_OR|BPF_X: - - ORrd(EAX,EDX) - - break; - - case BPF_ALU|BPF_LSH|BPF_X: - - MOVrd(ECX,EDX) - SHL_CLrb(EAX) - - break; - - case BPF_ALU|BPF_RSH|BPF_X: - - MOVrd(ECX,EDX) - SHR_CLrb(EAX) - - break; - - case BPF_ALU|BPF_ADD|BPF_K: - - ADD_EAXi(ins->k) - - break; - - case BPF_ALU|BPF_SUB|BPF_K: - - SUB_EAXi(ins->k) - - break; - - case BPF_ALU|BPF_MUL|BPF_K: - - MOVrd(ECX,EDX) - MOVid(EDX,ins->k) - MULrd(EDX) - MOVrd(EDX,ECX) - - break; - - case BPF_ALU|BPF_DIV|BPF_K: - - MOVrd(ECX,EDX) - MOVid(EDX,0) - MOVid(ESI,ins->k) - DIVrd(ESI) - MOVrd(EDX,ECX) - - break; - - case BPF_ALU|BPF_AND|BPF_K: - - ANDid(EAX, ins->k) - - break; - - case BPF_ALU|BPF_OR|BPF_K: - - ORid(EAX, ins->k) - - break; - - case BPF_ALU|BPF_LSH|BPF_K: - - SHLib(EAX, (ins->k) & 255) - - break; - - case BPF_ALU|BPF_RSH|BPF_K: - - SHRib(EAX, (ins->k) & 255) - - break; - - case BPF_ALU|BPF_NEG: - - NEGd(EAX) - - break; - - case BPF_MISC|BPF_TAX: - - MOVrd(EDX,EAX) - - break; - - case BPF_MISC|BPF_TXA: - - MOVrd(EAX,EDX) - - break; - - - - } - - ins++; - } - - pass++; - if(pass == 2) break; - -#ifdef NTKERNEL - stream.ibuf=(CHAR*)ExAllocatePoolWithTag(NonPagedPool, stream.cur_ip, '1JWA'); -#else - stream.ibuf=(CHAR*)malloc(stream.cur_ip); -#endif - if(stream.ibuf==NULL) - { -#ifdef NTKERNEL - ExFreePool(stream.refs); -#else - free(stream.refs); -#endif - return NULL; - } - - // modify the reference table to contain the offsets and not the lengths of the instructions - for(i=1; i< nins + 1; i++) - stream.refs[i]+=stream.refs[i-1]; - - // Reset the counters - stream.cur_ip=0; - stream.bpf_pc=0; - // the second pass creates the actual code - emitm=emit_code; - - } - - // the reference table is needed only during compilation, now we can free it -#ifdef NTKERNEL - ExFreePool(stream.refs); -#else - free(stream.refs); -#endif - return (BPF_filter_function)stream.ibuf; - -} - - -JIT_BPF_Filter* BPF_jitter(struct bpf_insn *fp, INT nins) -{ - JIT_BPF_Filter *Filter; - - - // Allocate the filter structure -#ifdef NTKERNEL - Filter=(struct JIT_BPF_Filter*)ExAllocatePoolWithTag(NonPagedPool, sizeof(struct JIT_BPF_Filter), '2JWA'); -#else - Filter=(struct JIT_BPF_Filter*)malloc(sizeof(struct JIT_BPF_Filter)); -#endif - if(Filter==NULL) - { - return NULL; - } - - // Allocate the filter's memory -#ifdef NTKERNEL - Filter->mem=(INT*)ExAllocatePoolWithTag(NonPagedPool, BPF_MEMWORDS*sizeof(INT), '3JWA'); -#else - Filter->mem=(INT*)malloc(BPF_MEMWORDS*sizeof(INT)); -#endif - if(Filter->mem==NULL) - { -#ifdef NTKERNEL - ExFreePool(Filter); -#else - free(Filter); -#endif - return NULL; - } - - // Create the binary - if((Filter->Function = BPFtoX86(fp, nins, Filter->mem))==NULL) - { -#ifdef NTKERNEL - ExFreePool(Filter->mem); - ExFreePool(Filter); -#else - free(Filter->mem); - free(Filter); -#endif - return NULL; - } - - return Filter; - -} - -////////////////////////////////////////////////////////////// - -void BPF_Destroy_JIT_Filter(JIT_BPF_Filter *Filter){ - -#ifdef NTKERNEL - ExFreePool(Filter->mem); - ExFreePool(Filter->Function); - ExFreePool(Filter); -#else - free(Filter->mem); - free(Filter->Function); - free(Filter); -#endif - -} +/* + * Copyright (c) 2002 - 2005 NetGroup, Politecnico di Torino (Italy) + * Copyright (c) 2005 CACE Technologies, Davis (California) + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the Politecnico di Torino, CACE Technologies + * nor the names of its contributors may be used to endorse or promote + * products derived from this software without specific prior written + * permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#include + +#include "stdarg.h" +#include "ntddk.h" +#include "ntiologc.h" +#include "ndis.h" + +#include "packet.h" +#include "win_bpf.h" +#include "jitter.h" + +// +// emit routine to update the jump table +// +void emit_length(binary_stream *stream, ULONG value, UINT len) +{ + (stream->refs)[stream->bpf_pc]+=len; + stream->cur_ip+=len; +} + +// +// emit routine to output the actual binary code +// +void emit_code(binary_stream *stream, ULONG value, UINT len) +{ + + switch (len){ + + case 1: + stream->ibuf[stream->cur_ip]=(UCHAR)value; + stream->cur_ip++; + break; + + case 2: + *((USHORT*)(stream->ibuf+stream->cur_ip))=(USHORT)value; + stream->cur_ip+=2; + break; + + case 4: + *((ULONG*)(stream->ibuf+stream->cur_ip))=value; + stream->cur_ip+=4; + break; + + default:; + + } + + return; + +} + +// +// Function that does the real stuff +// +BPF_filter_function BPFtoX86(struct bpf_insn *prog, UINT nins, INT *mem) +{ + struct bpf_insn *ins; + UINT i, pass; + binary_stream stream; + + //NOTE: do not modify the name of this variable, as it's used by the macros to emit code. + emit_func emitm; + + + // Allocate the reference table for the jumps +#ifdef NTKERNEL + stream.refs=(UINT *)ExAllocatePoolWithTag(NonPagedPool, (nins + 1)*sizeof(UINT), '0JWA'); +#else + stream.refs=(UINT *)malloc((nins + 1)*sizeof(UINT)); +#endif + if(stream.refs==NULL) + { + return NULL; + } + + // Reset the reference table + for(i=0; i< nins + 1; i++) + stream.refs[i]=0; + + stream.cur_ip=0; + stream.bpf_pc=0; + + // the first pass will emit the lengths of the instructions + // to create the reference table + emitm=emit_length; + + for(pass=0;;){ + + ins = prog; + + /* create the procedure header */ + PUSH(EBP) + MOVrd(EBP,ESP) + PUSH(EBX) + PUSH(ECX) + PUSH(EDX) + PUSH(ESI) + PUSH(EDI) + MOVodd(EBX, EBP, 8) + + for(i=0;icode) { + + default: + + return NULL; + + case BPF_RET|BPF_K: + + MOVid(EAX,ins->k) + POP(EDI) + POP(ESI) + POP(EDX) + POP(ECX) + POP(EBX) + POP(EBP) + RET() + + break; + + + case BPF_RET|BPF_A: + + POP(EDI) + POP(ESI) + POP(EDX) + POP(ECX) + POP(EBX) + POP(EBP) + RET() + + break; + + + case BPF_LD|BPF_W|BPF_ABS: + + MOVid(ECX,ins->k) + MOVrd(ESI,ECX) + ADDib(ECX,sizeof(INT)) + CMPodd(ECX, EBP, 0x10) + JLEb(12) + POP(EDI) + POP(ESI) + POP(EDX) + POP(ECX) + POP(EBX) + POP(EBP) + MOVid(EAX,0) //this can be optimized with xor eax,eax + RET() + MOVobd(EAX, EBX, ESI) + BSWAP(EAX) + + break; + + case BPF_LD|BPF_H|BPF_ABS: + + MOVid(ECX,ins->k) + MOVrd(ESI,ECX) + ADDib(ECX,sizeof(SHORT)) + CMPodd(ECX, EBP, 0x10) + JLEb(12) + POP(EDI) + POP(ESI) + POP(EDX) + POP(ECX) + POP(EBX) + POP(EBP) + MOVid(EAX,0) + RET() + MOVid(EAX,0) + MOVobw(AX, EBX, ESI) + SWAP_AX() + + break; + + case BPF_LD|BPF_B|BPF_ABS: + + MOVid(ECX,ins->k) + CMPodd(ECX, EBP, 0x10) + JLEb(12) + POP(EDI) + POP(ESI) + POP(EDX) + POP(ECX) + POP(EBX) + POP(EBP) + MOVid(EAX,0) + RET() + MOVid(EAX,0) + MOVobb(AL,EBX,ECX) + + break; + + case BPF_LD|BPF_W|BPF_LEN: + + MOVodd(EAX, EBP, 0xc) + + break; + + case BPF_LDX|BPF_W|BPF_LEN: + + MOVodd(EDX, EBP, 0xc) + + break; + + case BPF_LD|BPF_W|BPF_IND: + + MOVid(ECX,ins->k) + ADDrd(ECX,EDX) + MOVrd(ESI,ECX) + ADDib(ECX,sizeof(INT)) + CMPodd(ECX, EBP, 0x10) + JLEb(12) + POP(EDI) + POP(ESI) + POP(EDX) + POP(ECX) + POP(EBX) + POP(EBP) + MOVid(EAX,0) + RET() + MOVobd(EAX, EBX, ESI) + BSWAP(EAX) + + break; + + case BPF_LD|BPF_H|BPF_IND: + + MOVid(ECX,ins->k) + ADDrd(ECX,EDX) + MOVrd(ESI,ECX) + ADDib(ECX,sizeof(SHORT)) + CMPodd(ECX, EBP, 0x10) + JLEb(12) + POP(EDI) + POP(ESI) + POP(EDX) + POP(ECX) + POP(EBX) + POP(EBP) + MOVid(EAX,0) + RET() + MOVid(EAX,0) + MOVobw(AX, EBX, ESI) + SWAP_AX() + + break; + + case BPF_LD|BPF_B|BPF_IND: + + MOVid(ECX,ins->k) + ADDrd(ECX,EDX) + CMPodd(ECX, EBP, 0x10) + JLEb(12) + POP(EDI) + POP(ESI) + POP(EDX) + POP(ECX) + POP(EBX) + POP(EBP) + MOVid(EAX,0) + RET() + MOVid(EAX,0) + MOVobb(AL,EBX,ECX) + + break; + + case BPF_LDX|BPF_MSH|BPF_B: + + MOVid(ECX,ins->k) + CMPodd(ECX, EBP, 0x10) + JLEb(12) + POP(EDI) + POP(ESI) + POP(EDX) + POP(ECX) + POP(EBX) + POP(EBP) + MOVid(EAX,0) + RET() + MOVid(EDX,0) + MOVobb(DL,EBX,ECX) + ANDib(DL, 0xf) + SHLib(EDX, 2) + + break; + + case BPF_LD|BPF_IMM: + + MOVid(EAX,ins->k) + + break; + + case BPF_LDX|BPF_IMM: + + MOVid(EDX,ins->k) + + break; + + case BPF_LD|BPF_MEM: + + MOVid(ECX,(INT)mem) + MOVid(ESI,ins->k*4) + MOVobd(EAX, ECX, ESI) + + break; + + case BPF_LDX|BPF_MEM: + + MOVid(ECX,(INT)mem) + MOVid(ESI,ins->k*4) + MOVobd(EDX, ECX, ESI) + + break; + + case BPF_ST: + + // XXX: this command and the following could be optimized if the previous + // instruction was already of this type + MOVid(ECX,(INT)mem) + MOVid(ESI,ins->k*4) + MOVomd(ECX, ESI, EAX) + + break; + + case BPF_STX: + + MOVid(ECX,(INT)mem) + MOVid(ESI,ins->k*4) + MOVomd(ECX, ESI, EDX) + break; + + case BPF_JMP|BPF_JA: + + JMP(stream.refs[stream.bpf_pc+ins->k]-stream.refs[stream.bpf_pc]) + + break; + + case BPF_JMP|BPF_JGT|BPF_K: + + CMPid(EAX, ins->k) + JG(stream.refs[stream.bpf_pc+ins->jt]-stream.refs[stream.bpf_pc]+5) // 5 is the size of the following JMP + JMP(stream.refs[stream.bpf_pc+ins->jf]-stream.refs[stream.bpf_pc]) + break; + + case BPF_JMP|BPF_JGE|BPF_K: + + CMPid(EAX, ins->k) + JGE(stream.refs[stream.bpf_pc+ins->jt]-stream.refs[stream.bpf_pc]+5) + JMP(stream.refs[stream.bpf_pc+ins->jf]-stream.refs[stream.bpf_pc]) + + break; + + case BPF_JMP|BPF_JEQ|BPF_K: + + CMPid(EAX, ins->k) + JE(stream.refs[stream.bpf_pc+ins->jt]-stream.refs[stream.bpf_pc]+5) + JMP(stream.refs[stream.bpf_pc+ins->jf]-stream.refs[stream.bpf_pc]) + + break; + + case BPF_JMP|BPF_JSET|BPF_K: + + MOVrd(ECX,EAX) + ANDid(ECX,ins->k) + JE(stream.refs[stream.bpf_pc+ins->jf]-stream.refs[stream.bpf_pc]+5) + JMP(stream.refs[stream.bpf_pc+ins->jt]-stream.refs[stream.bpf_pc]) + + break; + + case BPF_JMP|BPF_JGT|BPF_X: + + CMPrd(EAX, EDX) + JA(stream.refs[stream.bpf_pc+ins->jt]-stream.refs[stream.bpf_pc]+5) + JMP(stream.refs[stream.bpf_pc+ins->jf]-stream.refs[stream.bpf_pc]) + break; + + case BPF_JMP|BPF_JGE|BPF_X: + + CMPrd(EAX, EDX) + JAE(stream.refs[stream.bpf_pc+ins->jt]-stream.refs[stream.bpf_pc]+5) + JMP(stream.refs[stream.bpf_pc+ins->jf]-stream.refs[stream.bpf_pc]) + + break; + + case BPF_JMP|BPF_JEQ|BPF_X: + + CMPrd(EAX, EDX) + JE(stream.refs[stream.bpf_pc+ins->jt]-stream.refs[stream.bpf_pc]+5) + JMP(stream.refs[stream.bpf_pc+ins->jf]-stream.refs[stream.bpf_pc]) + + break; + + case BPF_JMP|BPF_JSET|BPF_X: + + MOVrd(ECX,EAX) + ANDrd(ECX,EDX) + JE(stream.refs[stream.bpf_pc+ins->jf]-stream.refs[stream.bpf_pc]+5) + JMP(stream.refs[stream.bpf_pc+ins->jt]-stream.refs[stream.bpf_pc]) + + break; + + case BPF_ALU|BPF_ADD|BPF_X: + + ADDrd(EAX,EDX) + + break; + + case BPF_ALU|BPF_SUB|BPF_X: + + SUBrd(EAX,EDX) + + break; + + case BPF_ALU|BPF_MUL|BPF_X: + + MOVrd(ECX,EDX) + MULrd(EDX) + MOVrd(EDX,ECX) + break; + + case BPF_ALU|BPF_DIV|BPF_X: + + CMPid(EDX, 0) + JNEb(12) + POP(EDI) + POP(ESI) + POP(EDX) + POP(ECX) + POP(EBX) + POP(EBP) + MOVid(EAX,0) + RET() + MOVrd(ECX,EDX) + MOVid(EDX,0) + DIVrd(ECX) + MOVrd(EDX,ECX) + + break; + + case BPF_ALU|BPF_AND|BPF_X: + + ANDrd(EAX,EDX) + + break; + + case BPF_ALU|BPF_OR|BPF_X: + + ORrd(EAX,EDX) + + break; + + case BPF_ALU|BPF_LSH|BPF_X: + + MOVrd(ECX,EDX) + SHL_CLrb(EAX) + + break; + + case BPF_ALU|BPF_RSH|BPF_X: + + MOVrd(ECX,EDX) + SHR_CLrb(EAX) + + break; + + case BPF_ALU|BPF_ADD|BPF_K: + + ADD_EAXi(ins->k) + + break; + + case BPF_ALU|BPF_SUB|BPF_K: + + SUB_EAXi(ins->k) + + break; + + case BPF_ALU|BPF_MUL|BPF_K: + + MOVrd(ECX,EDX) + MOVid(EDX,ins->k) + MULrd(EDX) + MOVrd(EDX,ECX) + + break; + + case BPF_ALU|BPF_DIV|BPF_K: + + MOVrd(ECX,EDX) + MOVid(EDX,0) + MOVid(ESI,ins->k) + DIVrd(ESI) + MOVrd(EDX,ECX) + + break; + + case BPF_ALU|BPF_AND|BPF_K: + + ANDid(EAX, ins->k) + + break; + + case BPF_ALU|BPF_OR|BPF_K: + + ORid(EAX, ins->k) + + break; + + case BPF_ALU|BPF_LSH|BPF_K: + + SHLib(EAX, (ins->k) & 255) + + break; + + case BPF_ALU|BPF_RSH|BPF_K: + + SHRib(EAX, (ins->k) & 255) + + break; + + case BPF_ALU|BPF_NEG: + + NEGd(EAX) + + break; + + case BPF_MISC|BPF_TAX: + + MOVrd(EDX,EAX) + + break; + + case BPF_MISC|BPF_TXA: + + MOVrd(EAX,EDX) + + break; + + + + } + + ins++; + } + + pass++; + if(pass == 2) break; + +#ifdef NTKERNEL + stream.ibuf=(CHAR*)ExAllocatePoolWithTag(NonPagedPool, stream.cur_ip, '1JWA'); +#else + stream.ibuf=(CHAR*)malloc(stream.cur_ip); +#endif + if(stream.ibuf==NULL) + { +#ifdef NTKERNEL + ExFreePool(stream.refs); +#else + free(stream.refs); +#endif + return NULL; + } + + // modify the reference table to contain the offsets and not the lengths of the instructions + for(i=1; i< nins + 1; i++) + stream.refs[i]+=stream.refs[i-1]; + + // Reset the counters + stream.cur_ip=0; + stream.bpf_pc=0; + // the second pass creates the actual code + emitm=emit_code; + + } + + // the reference table is needed only during compilation, now we can free it +#ifdef NTKERNEL + ExFreePool(stream.refs); +#else + free(stream.refs); +#endif + return (BPF_filter_function)stream.ibuf; + +} + + +JIT_BPF_Filter* BPF_jitter(struct bpf_insn *fp, INT nins) +{ + JIT_BPF_Filter *Filter; + + + // Allocate the filter structure +#ifdef NTKERNEL + Filter=(struct JIT_BPF_Filter*)ExAllocatePoolWithTag(NonPagedPool, sizeof(struct JIT_BPF_Filter), '2JWA'); +#else + Filter=(struct JIT_BPF_Filter*)malloc(sizeof(struct JIT_BPF_Filter)); +#endif + if(Filter==NULL) + { + return NULL; + } + + // Allocate the filter's memory +#ifdef NTKERNEL + Filter->mem=(INT*)ExAllocatePoolWithTag(NonPagedPool, BPF_MEMWORDS*sizeof(INT), '3JWA'); +#else + Filter->mem=(INT*)malloc(BPF_MEMWORDS*sizeof(INT)); +#endif + if(Filter->mem==NULL) + { +#ifdef NTKERNEL + ExFreePool(Filter); +#else + free(Filter); +#endif + return NULL; + } + + // Create the binary + if((Filter->Function = BPFtoX86(fp, nins, Filter->mem))==NULL) + { +#ifdef NTKERNEL + ExFreePool(Filter->mem); + ExFreePool(Filter); +#else + free(Filter->mem); + free(Filter); +#endif + return NULL; + } + + return Filter; + +} + +////////////////////////////////////////////////////////////// + +void BPF_Destroy_JIT_Filter(JIT_BPF_Filter *Filter){ + +#ifdef NTKERNEL + ExFreePool(Filter->mem); + ExFreePool(Filter->Function); + ExFreePool(Filter); +#else + free(Filter->mem); + free(Filter->Function); + free(Filter); +#endif + +} diff --git a/src/See/jitter.h b/src/See/jitter.h index 82edea74..bd28fc95 100644 --- a/src/See/jitter.h +++ b/src/See/jitter.h @@ -1,404 +1,404 @@ -/* - * Copyright (c) 2002 - 2005 NetGroup, Politecnico di Torino (Italy) - * Copyright (c) 2005 CACE Technologies, Davis (California) - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the Politecnico di Torino, CACE Technologies - * nor the names of its contributors may be used to endorse or promote - * products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - */ - - -/** @ingroup NPF - * @{ - */ - -/** @defgroup NPF_include NPF structures and definitions - * @{ - */ - -// -// Registers -// -#define EAX 0 -#define ECX 1 -#define EDX 2 -#define EBX 3 -#define ESP 4 -#define EBP 5 -#define ESI 6 -#define EDI 7 - -#define AX 0 -#define CX 1 -#define DX 2 -#define BX 3 -#define SP 4 -#define BP 5 -#define SI 6 -#define DI 7 - -#define AL 0 -#define CL 1 -#define DL 2 -#define BL 3 - -/*! \brief A stream of X86 binary code.*/ -typedef struct binary_stream{ - INT cur_ip; ///< Current X86 instruction pointer. - INT bpf_pc; ///< Current BPF instruction pointer, i.e. position in the BPF program reached by the jitter. - PCHAR ibuf; ///< Instruction buffer, contains the X86 generated code. - PUINT refs; ///< Jumps reference table. -}binary_stream; - - -/*! \brief Prototype of a filtering function created by the jitter. - - The syntax and the meaning of the parameters is analogous to the one of bpf_filter(). Notice that the filter - is not among the parameters, because it is hardwired in the function. -*/ -typedef UINT (__cdecl *BPF_filter_function)( PVOID *, ULONG, UINT); - -/*! \brief Prototype of the emit functions. - - Different emit functions are used to create the reference table and to generate the actual filtering code. - This allows to have simpler instruction macros. - The first parameter is the stream that will receive the data. The secon one is a variable containing - the data, the third one is the length, that can be 1,2 or 4 since it is possible to emit a byte, a short - or a work at a time. -*/ -typedef void (*emit_func)(binary_stream *stream, ULONG value, UINT n); - -/*! \brief Structure describing a x86 filtering program created by the jitter.*/ -typedef struct JIT_BPF_Filter{ - BPF_filter_function Function; ///< The x86 filtering binary, in the form of a BPF_filter_function. - PINT mem; -} -JIT_BPF_Filter; - - - - -/**************************/ -/* X86 INSTRUCTION MACROS */ -/**************************/ - -/// mov r32,i32 -#define MOVid(r32, i32) \ - emitm(&stream, 11 << 4 | 1 << 3 | r32 & 0x7, 1); emitm(&stream, i32, 4); - -/// mov dr32,sr32 -#define MOVrd(dr32, sr32) \ - emitm(&stream, 8 << 4 | 3 | 1 << 3, 1); emitm(&stream, 3 << 6 | (dr32 & 0x7) << 3 | sr32 & 0x7, 1); - -/// mov dr32,sr32[off] -#define MOVodd(dr32, sr32, off) \ - emitm(&stream, 8 << 4 | 3 | 1 << 3, 1); \ - emitm(&stream, 1 << 6 | (dr32 & 0x7) << 3 | sr32 & 0x7, 1);\ - emitm(&stream, off, 1); - -/// mov dr32,sr32[or32] -#define MOVobd(dr32, sr32, or32) \ - emitm(&stream, 8 << 4 | 3 | 1 << 3, 1); \ - emitm(&stream, (dr32 & 0x7) << 3 | 4 , 1);\ - emitm(&stream, (or32 & 0x7) << 3 | (sr32 & 0x7) , 1); - -/// mov dr16,sr32[or32] -#define MOVobw(dr32, sr32, or32) \ - emitm(&stream, 0x66, 1); \ - emitm(&stream, 8 << 4 | 3 | 1 << 3, 1); \ - emitm(&stream, (dr32 & 0x7) << 3 | 4 , 1);\ - emitm(&stream, (or32 & 0x7) << 3 | (sr32 & 0x7) , 1); - -/// mov dr8,sr32[or32] -#define MOVobb(dr8, sr32, or32) \ - emitm(&stream, 0x8a, 1); \ - emitm(&stream, (dr8 & 0x7) << 3 | 4 , 1);\ - emitm(&stream, (or32 & 0x7) << 3 | (sr32 & 0x7) , 1); - -/// mov [dr32][or32],sr32 -#define MOVomd(dr32, or32, sr32) \ - emitm(&stream, 0x89, 1); \ - emitm(&stream, (sr32 & 0x7) << 3 | 4 , 1);\ - emitm(&stream, (or32 & 0x7) << 3 | (dr32 & 0x7) , 1); - -/// bswap dr32 -#define BSWAP(dr32) \ - emitm(&stream, 0xf, 1); \ - emitm(&stream, 0x19 << 3 | dr32 , 1); - -/// xchg al,ah -#define SWAP_AX() \ - emitm(&stream, 0x86, 1); \ - emitm(&stream, 0xc4 , 1); - -/// push r32 -#define PUSH(r32) \ - emitm(&stream, 5 << 4 | 0 << 3 | r32 & 0x7, 1); - -/// pop r32 -#define POP(r32) \ - emitm(&stream, 5 << 4 | 1 << 3 | r32 & 0x7, 1); - -/// ret -#define RET() \ - emitm(&stream, 12 << 4 | 0 << 3 | 3, 1); - -/// add dr32,sr32 -#define ADDrd(dr32, sr32) \ - emitm(&stream, 0x03, 1);\ - emitm(&stream, 3 << 6 | (dr32 & 0x7) << 3 | (sr32 & 0x7), 1); - -/// add eax,i32 -#define ADD_EAXi(i32) \ - emitm(&stream, 0x05, 1);\ - emitm(&stream, i32, 4); - -/// add r32,i32 -#define ADDid(r32, i32) \ - emitm(&stream, 0x81, 1);\ - emitm(&stream, 24 << 3 | r32, 1);\ - emitm(&stream, i32, 4); - -/// add r32,i8 -#define ADDib(r32, i8) \ - emitm(&stream, 0x83, 1);\ - emitm(&stream, 24 << 3 | r32, 1);\ - emitm(&stream, i8, 1); - -/// sub dr32,sr32 -#define SUBrd(dr32, sr32) \ - emitm(&stream, 0x2b, 1);\ - emitm(&stream, 3 << 6 | (dr32 & 0x7) << 3 | (sr32 & 0x7), 1); - -/// sub eax,i32 -#define SUB_EAXi(i32) \ - emitm(&stream, 0x2d, 1);\ - emitm(&stream, i32, 4); - -/// mul r32 -#define MULrd(r32) \ - emitm(&stream, 0xf7, 1);\ - emitm(&stream, 7 << 5 | (r32 & 0x7), 1); - -/// div r32 -#define DIVrd(r32) \ - emitm(&stream, 0xf7, 1);\ - emitm(&stream, 15 << 4 | (r32 & 0x7), 1); - -/// and r8,i8 -#define ANDib(r8, i8) \ - emitm(&stream, 0x80, 1);\ - emitm(&stream, 7 << 5 | r8, 1);\ - emitm(&stream, i8, 1); - -/// and r32,i32 -#define ANDid(r32, i32) \ - if (r32 == EAX){ \ - emitm(&stream, 0x25, 1);\ - emitm(&stream, i32, 4);}\ - else{ \ - emitm(&stream, 0x81, 1);\ - emitm(&stream, 7 << 5 | r32, 1);\ - emitm(&stream, i32, 4);} - -/// and dr32,sr32 -#define ANDrd(dr32, sr32) \ - emitm(&stream, 0x23, 1);\ - emitm(&stream, 3 << 6 | (dr32 & 0x7) << 3 | sr32 & 0x7, 1); - -/// or dr32,sr32 -#define ORrd(dr32, sr32) \ - emitm(&stream, 0x0b, 1);\ - emitm(&stream, 3 << 6 | (dr32 & 0x7) << 3 | sr32 & 0x7, 1); - -/// or r32,i32 -#define ORid(r32, i32) \ - if (r32 == EAX){ \ - emitm(&stream, 0x0d, 1);\ - emitm(&stream, i32, 4);}\ - else{ \ - emitm(&stream, 0x81, 1);\ - emitm(&stream, 25 << 3 | r32, 1);\ - emitm(&stream, i32, 4);} - -/// shl r32,i8 -#define SHLib(r32, i8) \ - emitm(&stream, 0xc1, 1);\ - emitm(&stream, 7 << 5 | r32 & 0x7, 1);\ - emitm(&stream, i8, 1); - -/// shl dr32,cl -#define SHL_CLrb(dr32) \ - emitm(&stream, 0xd3, 1);\ - emitm(&stream, 7 << 5 | dr32 & 0x7, 1); - -/// shr r32,i8 -#define SHRib(r32, i8) \ - emitm(&stream, 0xc1, 1);\ - emitm(&stream, 29 << 3 | r32 & 0x7, 1);\ - emitm(&stream, i8, 1); - -/// shr dr32,cl -#define SHR_CLrb(dr32) \ - emitm(&stream, 0xd3, 1);\ - emitm(&stream, 29 << 3 | dr32 & 0x7, 1); - -/// neg r32 -#define NEGd(r32) \ - emitm(&stream, 0xf7, 1);\ - emitm(&stream, 27 << 3 | r32 & 0x7, 1); - -/// cmp dr32,sr32[off] -#define CMPodd(dr32, sr32, off) \ - emitm(&stream, 3 << 4 | 3 | 1 << 3, 1); \ - emitm(&stream, 1 << 6 | (dr32 & 0x7) << 3 | sr32 & 0x7, 1);\ - emitm(&stream, off, 1); - -/// cmp dr32,sr32 -#define CMPrd(dr32, sr32) \ - emitm(&stream, 0x3b, 1); \ - emitm(&stream, 3 << 6 | (dr32 & 0x7) << 3 | sr32 & 0x7, 1); - -/// cmp dr32,i32 -#define CMPid(dr32, i32) \ - if (dr32 == EAX){ \ - emitm(&stream, 0x3d, 1); \ - emitm(&stream, i32, 4);} \ - else{ \ - emitm(&stream, 0x81, 1); \ - emitm(&stream, 0x1f << 3 | (dr32 & 0x7), 1);\ - emitm(&stream, i32, 4);} - -/// jne off32 -#define JNEb(off8) \ - emitm(&stream, 0x75, 1);\ - emitm(&stream, off8, 1); - -/// je off32 -#define JE(off32) \ - emitm(&stream, 0x0f, 1);\ - emitm(&stream, 0x84, 1);\ - emitm(&stream, off32, 4); - -/// jle off32 -#define JLE(off32) \ - emitm(&stream, 0x0f, 1);\ - emitm(&stream, 0x8e, 1);\ - emitm(&stream, off32, 4); - -/// jle off8 -#define JLEb(off8) \ - emitm(&stream, 0x7e, 1);\ - emitm(&stream, off8, 1); - -/// ja off32 -#define JA(off32) \ - emitm(&stream, 0x0f, 1);\ - emitm(&stream, 0x87, 1);\ - emitm(&stream, off32, 4); - -/// jae off32 -#define JAE(off32) \ - emitm(&stream, 0x0f, 1);\ - emitm(&stream, 0x83, 1);\ - emitm(&stream, off32, 4); - -/// jg off32 -#define JG(off32) \ - emitm(&stream, 0x0f, 1);\ - emitm(&stream, 0x8f, 1);\ - emitm(&stream, off32, 4); - -/// jge off32 -#define JGE(off32) \ - emitm(&stream, 0x0f, 1);\ - emitm(&stream, 0x8d, 1);\ - emitm(&stream, off32, 4); - -/// jmp off32 -#define JMP(off32) \ - emitm(&stream, 0xe9, 1);\ - emitm(&stream, off32, 4); - -/** - * @} - */ - -/** - * @} - */ - -/**************************/ -/* Prototypes */ -/**************************/ - -/** @ingroup NPF - * @{ - */ - -/** @defgroup NPF_code NPF functions - * @{ - */ - -/*! - \brief BPF jitter, builds an x86 function from a BPF program. - \param fp The BPF pseudo-assembly filter that will be translated into x86 code. - \param nins Number of instructions of the input filter. - \return The JIT_BPF_Filter structure containing the x86 filtering binary. - - BPF_jitter allocates the buffers for the new native filter and then translates the program pointed by fp - calling BPFtoX86(). -*/ -JIT_BPF_Filter* BPF_jitter(struct bpf_insn *fp, INT nins); - -/*! - \brief Translates a set of BPF instructions in a set of x86 ones. - \param ins Pointer to the BPF instructions that will be translated into x86 code. - \param nins Number of instructions to translate. - \param mem Memory used by the x86 function to emulate the RAM of the BPF pseudo processor. - \return The x86 filtering function. - - This function does the hard work for the JIT compilation. It takes a group of BPF pseudo instructions and - through the instruction macros defined in jitter.h it is able to create an function directly executable - by NPF. -*/ -BPF_filter_function BPFtoX86(struct bpf_insn *ins, UINT nins, INT *mem); -/*! - \brief Deletes a filtering function that was previously created by BPF_jitter(). - \param Filter The filter to destroy. - - This function frees the variuos buffers (code, memory, etc.) associated with a filtering function. -*/ -void BPF_Destroy_JIT_Filter(JIT_BPF_Filter *Filter); - -/** - * @} - */ - -/** - * @} - */ +/* + * Copyright (c) 2002 - 2005 NetGroup, Politecnico di Torino (Italy) + * Copyright (c) 2005 CACE Technologies, Davis (California) + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the Politecnico di Torino, CACE Technologies + * nor the names of its contributors may be used to endorse or promote + * products derived from this software without specific prior written + * permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + + +/** @ingroup NPF + * @{ + */ + +/** @defgroup NPF_include NPF structures and definitions + * @{ + */ + +// +// Registers +// +#define EAX 0 +#define ECX 1 +#define EDX 2 +#define EBX 3 +#define ESP 4 +#define EBP 5 +#define ESI 6 +#define EDI 7 + +#define AX 0 +#define CX 1 +#define DX 2 +#define BX 3 +#define SP 4 +#define BP 5 +#define SI 6 +#define DI 7 + +#define AL 0 +#define CL 1 +#define DL 2 +#define BL 3 + +/*! \brief A stream of X86 binary code.*/ +typedef struct binary_stream{ + INT cur_ip; ///< Current X86 instruction pointer. + INT bpf_pc; ///< Current BPF instruction pointer, i.e. position in the BPF program reached by the jitter. + PCHAR ibuf; ///< Instruction buffer, contains the X86 generated code. + PUINT refs; ///< Jumps reference table. +}binary_stream; + + +/*! \brief Prototype of a filtering function created by the jitter. + + The syntax and the meaning of the parameters is analogous to the one of bpf_filter(). Notice that the filter + is not among the parameters, because it is hardwired in the function. +*/ +typedef UINT (__cdecl *BPF_filter_function)( PVOID *, ULONG, UINT); + +/*! \brief Prototype of the emit functions. + + Different emit functions are used to create the reference table and to generate the actual filtering code. + This allows to have simpler instruction macros. + The first parameter is the stream that will receive the data. The secon one is a variable containing + the data, the third one is the length, that can be 1,2 or 4 since it is possible to emit a byte, a short + or a work at a time. +*/ +typedef void (*emit_func)(binary_stream *stream, ULONG value, UINT n); + +/*! \brief Structure describing a x86 filtering program created by the jitter.*/ +typedef struct JIT_BPF_Filter{ + BPF_filter_function Function; ///< The x86 filtering binary, in the form of a BPF_filter_function. + PINT mem; +} +JIT_BPF_Filter; + + + + +/**************************/ +/* X86 INSTRUCTION MACROS */ +/**************************/ + +/// mov r32,i32 +#define MOVid(r32, i32) \ + emitm(&stream, 11 << 4 | 1 << 3 | r32 & 0x7, 1); emitm(&stream, i32, 4); + +/// mov dr32,sr32 +#define MOVrd(dr32, sr32) \ + emitm(&stream, 8 << 4 | 3 | 1 << 3, 1); emitm(&stream, 3 << 6 | (dr32 & 0x7) << 3 | sr32 & 0x7, 1); + +/// mov dr32,sr32[off] +#define MOVodd(dr32, sr32, off) \ + emitm(&stream, 8 << 4 | 3 | 1 << 3, 1); \ + emitm(&stream, 1 << 6 | (dr32 & 0x7) << 3 | sr32 & 0x7, 1);\ + emitm(&stream, off, 1); + +/// mov dr32,sr32[or32] +#define MOVobd(dr32, sr32, or32) \ + emitm(&stream, 8 << 4 | 3 | 1 << 3, 1); \ + emitm(&stream, (dr32 & 0x7) << 3 | 4 , 1);\ + emitm(&stream, (or32 & 0x7) << 3 | (sr32 & 0x7) , 1); + +/// mov dr16,sr32[or32] +#define MOVobw(dr32, sr32, or32) \ + emitm(&stream, 0x66, 1); \ + emitm(&stream, 8 << 4 | 3 | 1 << 3, 1); \ + emitm(&stream, (dr32 & 0x7) << 3 | 4 , 1);\ + emitm(&stream, (or32 & 0x7) << 3 | (sr32 & 0x7) , 1); + +/// mov dr8,sr32[or32] +#define MOVobb(dr8, sr32, or32) \ + emitm(&stream, 0x8a, 1); \ + emitm(&stream, (dr8 & 0x7) << 3 | 4 , 1);\ + emitm(&stream, (or32 & 0x7) << 3 | (sr32 & 0x7) , 1); + +/// mov [dr32][or32],sr32 +#define MOVomd(dr32, or32, sr32) \ + emitm(&stream, 0x89, 1); \ + emitm(&stream, (sr32 & 0x7) << 3 | 4 , 1);\ + emitm(&stream, (or32 & 0x7) << 3 | (dr32 & 0x7) , 1); + +/// bswap dr32 +#define BSWAP(dr32) \ + emitm(&stream, 0xf, 1); \ + emitm(&stream, 0x19 << 3 | dr32 , 1); + +/// xchg al,ah +#define SWAP_AX() \ + emitm(&stream, 0x86, 1); \ + emitm(&stream, 0xc4 , 1); + +/// push r32 +#define PUSH(r32) \ + emitm(&stream, 5 << 4 | 0 << 3 | r32 & 0x7, 1); + +/// pop r32 +#define POP(r32) \ + emitm(&stream, 5 << 4 | 1 << 3 | r32 & 0x7, 1); + +/// ret +#define RET() \ + emitm(&stream, 12 << 4 | 0 << 3 | 3, 1); + +/// add dr32,sr32 +#define ADDrd(dr32, sr32) \ + emitm(&stream, 0x03, 1);\ + emitm(&stream, 3 << 6 | (dr32 & 0x7) << 3 | (sr32 & 0x7), 1); + +/// add eax,i32 +#define ADD_EAXi(i32) \ + emitm(&stream, 0x05, 1);\ + emitm(&stream, i32, 4); + +/// add r32,i32 +#define ADDid(r32, i32) \ + emitm(&stream, 0x81, 1);\ + emitm(&stream, 24 << 3 | r32, 1);\ + emitm(&stream, i32, 4); + +/// add r32,i8 +#define ADDib(r32, i8) \ + emitm(&stream, 0x83, 1);\ + emitm(&stream, 24 << 3 | r32, 1);\ + emitm(&stream, i8, 1); + +/// sub dr32,sr32 +#define SUBrd(dr32, sr32) \ + emitm(&stream, 0x2b, 1);\ + emitm(&stream, 3 << 6 | (dr32 & 0x7) << 3 | (sr32 & 0x7), 1); + +/// sub eax,i32 +#define SUB_EAXi(i32) \ + emitm(&stream, 0x2d, 1);\ + emitm(&stream, i32, 4); + +/// mul r32 +#define MULrd(r32) \ + emitm(&stream, 0xf7, 1);\ + emitm(&stream, 7 << 5 | (r32 & 0x7), 1); + +/// div r32 +#define DIVrd(r32) \ + emitm(&stream, 0xf7, 1);\ + emitm(&stream, 15 << 4 | (r32 & 0x7), 1); + +/// and r8,i8 +#define ANDib(r8, i8) \ + emitm(&stream, 0x80, 1);\ + emitm(&stream, 7 << 5 | r8, 1);\ + emitm(&stream, i8, 1); + +/// and r32,i32 +#define ANDid(r32, i32) \ + if (r32 == EAX){ \ + emitm(&stream, 0x25, 1);\ + emitm(&stream, i32, 4);}\ + else{ \ + emitm(&stream, 0x81, 1);\ + emitm(&stream, 7 << 5 | r32, 1);\ + emitm(&stream, i32, 4);} + +/// and dr32,sr32 +#define ANDrd(dr32, sr32) \ + emitm(&stream, 0x23, 1);\ + emitm(&stream, 3 << 6 | (dr32 & 0x7) << 3 | sr32 & 0x7, 1); + +/// or dr32,sr32 +#define ORrd(dr32, sr32) \ + emitm(&stream, 0x0b, 1);\ + emitm(&stream, 3 << 6 | (dr32 & 0x7) << 3 | sr32 & 0x7, 1); + +/// or r32,i32 +#define ORid(r32, i32) \ + if (r32 == EAX){ \ + emitm(&stream, 0x0d, 1);\ + emitm(&stream, i32, 4);}\ + else{ \ + emitm(&stream, 0x81, 1);\ + emitm(&stream, 25 << 3 | r32, 1);\ + emitm(&stream, i32, 4);} + +/// shl r32,i8 +#define SHLib(r32, i8) \ + emitm(&stream, 0xc1, 1);\ + emitm(&stream, 7 << 5 | r32 & 0x7, 1);\ + emitm(&stream, i8, 1); + +/// shl dr32,cl +#define SHL_CLrb(dr32) \ + emitm(&stream, 0xd3, 1);\ + emitm(&stream, 7 << 5 | dr32 & 0x7, 1); + +/// shr r32,i8 +#define SHRib(r32, i8) \ + emitm(&stream, 0xc1, 1);\ + emitm(&stream, 29 << 3 | r32 & 0x7, 1);\ + emitm(&stream, i8, 1); + +/// shr dr32,cl +#define SHR_CLrb(dr32) \ + emitm(&stream, 0xd3, 1);\ + emitm(&stream, 29 << 3 | dr32 & 0x7, 1); + +/// neg r32 +#define NEGd(r32) \ + emitm(&stream, 0xf7, 1);\ + emitm(&stream, 27 << 3 | r32 & 0x7, 1); + +/// cmp dr32,sr32[off] +#define CMPodd(dr32, sr32, off) \ + emitm(&stream, 3 << 4 | 3 | 1 << 3, 1); \ + emitm(&stream, 1 << 6 | (dr32 & 0x7) << 3 | sr32 & 0x7, 1);\ + emitm(&stream, off, 1); + +/// cmp dr32,sr32 +#define CMPrd(dr32, sr32) \ + emitm(&stream, 0x3b, 1); \ + emitm(&stream, 3 << 6 | (dr32 & 0x7) << 3 | sr32 & 0x7, 1); + +/// cmp dr32,i32 +#define CMPid(dr32, i32) \ + if (dr32 == EAX){ \ + emitm(&stream, 0x3d, 1); \ + emitm(&stream, i32, 4);} \ + else{ \ + emitm(&stream, 0x81, 1); \ + emitm(&stream, 0x1f << 3 | (dr32 & 0x7), 1);\ + emitm(&stream, i32, 4);} + +/// jne off32 +#define JNEb(off8) \ + emitm(&stream, 0x75, 1);\ + emitm(&stream, off8, 1); + +/// je off32 +#define JE(off32) \ + emitm(&stream, 0x0f, 1);\ + emitm(&stream, 0x84, 1);\ + emitm(&stream, off32, 4); + +/// jle off32 +#define JLE(off32) \ + emitm(&stream, 0x0f, 1);\ + emitm(&stream, 0x8e, 1);\ + emitm(&stream, off32, 4); + +/// jle off8 +#define JLEb(off8) \ + emitm(&stream, 0x7e, 1);\ + emitm(&stream, off8, 1); + +/// ja off32 +#define JA(off32) \ + emitm(&stream, 0x0f, 1);\ + emitm(&stream, 0x87, 1);\ + emitm(&stream, off32, 4); + +/// jae off32 +#define JAE(off32) \ + emitm(&stream, 0x0f, 1);\ + emitm(&stream, 0x83, 1);\ + emitm(&stream, off32, 4); + +/// jg off32 +#define JG(off32) \ + emitm(&stream, 0x0f, 1);\ + emitm(&stream, 0x8f, 1);\ + emitm(&stream, off32, 4); + +/// jge off32 +#define JGE(off32) \ + emitm(&stream, 0x0f, 1);\ + emitm(&stream, 0x8d, 1);\ + emitm(&stream, off32, 4); + +/// jmp off32 +#define JMP(off32) \ + emitm(&stream, 0xe9, 1);\ + emitm(&stream, off32, 4); + +/** + * @} + */ + +/** + * @} + */ + +/**************************/ +/* Prototypes */ +/**************************/ + +/** @ingroup NPF + * @{ + */ + +/** @defgroup NPF_code NPF functions + * @{ + */ + +/*! + \brief BPF jitter, builds an x86 function from a BPF program. + \param fp The BPF pseudo-assembly filter that will be translated into x86 code. + \param nins Number of instructions of the input filter. + \return The JIT_BPF_Filter structure containing the x86 filtering binary. + + BPF_jitter allocates the buffers for the new native filter and then translates the program pointed by fp + calling BPFtoX86(). +*/ +JIT_BPF_Filter* BPF_jitter(struct bpf_insn *fp, INT nins); + +/*! + \brief Translates a set of BPF instructions in a set of x86 ones. + \param ins Pointer to the BPF instructions that will be translated into x86 code. + \param nins Number of instructions to translate. + \param mem Memory used by the x86 function to emulate the RAM of the BPF pseudo processor. + \return The x86 filtering function. + + This function does the hard work for the JIT compilation. It takes a group of BPF pseudo instructions and + through the instruction macros defined in jitter.h it is able to create an function directly executable + by NPF. +*/ +BPF_filter_function BPFtoX86(struct bpf_insn *ins, UINT nins, INT *mem); +/*! + \brief Deletes a filtering function that was previously created by BPF_jitter(). + \param Filter The filter to destroy. + + This function frees the variuos buffers (code, memory, etc.) associated with a filtering function. +*/ +void BPF_Destroy_JIT_Filter(JIT_BPF_Filter *Filter); + +/** + * @} + */ + +/** + * @} + */ diff --git a/src/See/memory_t.h b/src/See/memory_t.h index ab3c85db..8836743f 100644 --- a/src/See/memory_t.h +++ b/src/See/memory_t.h @@ -1,132 +1,132 @@ -/* - * Copyright (c) 2001 - 2003 - * NetGroup, Politecnico di Torino (Italy) - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the Politecnico di Torino nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - */ - -#ifndef __memory_t -#define __memory_t - -#define uint8 UCHAR -#define int8 CHAR -#define uint16 USHORT -#define int16 SHORT -#define uint32 ULONG -#define int32 LONG -#define uint64 ULONGLONG -#define int64 LONGLONG - -/*memory type*/ -typedef struct __MEM_TYPE -{ - uint8 *buffer; - uint32 size; -} MEM_TYPE, *PMEM_TYPE; - -#define LONG_AT(base,offset) (*(int32*)((uint8*)base+(uint32)offset)) - -#define ULONG_AT(base,offset) (*(uint32*)((uint8*)base+(uint32)offset)) - -#define SHORT_AT(base,offset) (*(int16*)((uint8*)base+(uint32)offset)) - -#define USHORT_AT(base,offset) (*(uint16*)((uint8*)base+(uint32)offset)) - -__inline int32 SW_LONG_AT(void *b, uint32 c) -{ - return ((int32)*((uint8 *)b+c)<<24| - (int32)*((uint8 *)b+c+1)<<16| - (int32)*((uint8 *)b+c+2)<<8| - (int32)*((uint8 *)b+c+3)<<0); -} - - -__inline uint32 SW_ULONG_AT(void *b, uint32 c) -{ - return ((uint32)*((uint8 *)b+c)<<24| - (uint32)*((uint8 *)b+c+1)<<16| - (uint32)*((uint8 *)b+c+2)<<8| - (uint32)*((uint8 *)b+c+3)<<0); -} - -__inline int16 SW_SHORT_AT(void *b, uint32 os) -{ - return ((int16) - ((int16)*((uint8 *)b+os+0)<<8| - (int16)*((uint8 *)b+os+1)<<0)); -} - -__inline uint16 SW_USHORT_AT(void *b, uint32 os) -{ - return ((uint16) - ((uint16)*((uint8 *)b+os+0)<<8| - (uint16)*((uint8 *)b+os+1)<<0)); -} - -__inline VOID SW_ULONG_ASSIGN(void *dst, uint32 src) -{ - *((uint8*)dst+0)=*((uint8*)&src+3); - *((uint8*)dst+1)=*((uint8*)&src+2); - *((uint8*)dst+2)=*((uint8*)&src+1); - *((uint8*)dst+3)=*((uint8*)&src+0); - -} - -#ifdef WIN_NT_DRIVER - -#define ALLOCATE_MEMORY(dest,type,amount) \ - (dest)=ExAllocatePool(NonPagedPool,sizeof(type)*(amount)); -#define ALLOCATE_ZERO_MEMORY(dest,type,amount) \ - { \ - (dest)=ExAllocatePool(NonPagedPool,sizeof(type)*(amount)); \ - if ((dest)!=NULL) \ - RtlZeroMemory((dest),sizeof(type)*(amount)); \ - } - -#define FREE_MEMORY(dest) ExFreePool(dest); -#define ZERO_MEMORY(dest,amount) RtlZeroMemory(dest,amount); -#define COPY_MEMORY(dest,src,amount) RtlCopyMemory(dest,src,amount); - -#else - -#define ALLOCATE_MEMORY(dest,type,amount) \ - (dest)=(type*)GlobalAlloc(GPTR, sizeof(type)*(amount)); -#define ALLOCATE_ZERO_MEMORY(dest,type,amount) \ - (dest)=(type*)GlobalAlloc(GPTR, sizeof(type)*(amount)); - -#define FREE_MEMORY(dest) GlobalFree(dest); -#define ZERO_MEMORY(dest,amount) RtlZeroMemory(dest,amount); -#define COPY_MEMORY(dest,src,amount) RtlCopyMemory(dest,src,amount); - - -#endif /*WIN_NT_DRIVER*/ - - - -#endif - +/* + * Copyright (c) 2001 - 2003 + * NetGroup, Politecnico di Torino (Italy) + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the Politecnico di Torino nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#ifndef __memory_t +#define __memory_t + +#define uint8 UCHAR +#define int8 CHAR +#define uint16 USHORT +#define int16 SHORT +#define uint32 ULONG +#define int32 LONG +#define uint64 ULONGLONG +#define int64 LONGLONG + +/*memory type*/ +typedef struct __MEM_TYPE +{ + uint8 *buffer; + uint32 size; +} MEM_TYPE, *PMEM_TYPE; + +#define LONG_AT(base,offset) (*(int32*)((uint8*)base+(uint32)offset)) + +#define ULONG_AT(base,offset) (*(uint32*)((uint8*)base+(uint32)offset)) + +#define SHORT_AT(base,offset) (*(int16*)((uint8*)base+(uint32)offset)) + +#define USHORT_AT(base,offset) (*(uint16*)((uint8*)base+(uint32)offset)) + +__inline int32 SW_LONG_AT(void *b, uint32 c) +{ + return ((int32)*((uint8 *)b+c)<<24| + (int32)*((uint8 *)b+c+1)<<16| + (int32)*((uint8 *)b+c+2)<<8| + (int32)*((uint8 *)b+c+3)<<0); +} + + +__inline uint32 SW_ULONG_AT(void *b, uint32 c) +{ + return ((uint32)*((uint8 *)b+c)<<24| + (uint32)*((uint8 *)b+c+1)<<16| + (uint32)*((uint8 *)b+c+2)<<8| + (uint32)*((uint8 *)b+c+3)<<0); +} + +__inline int16 SW_SHORT_AT(void *b, uint32 os) +{ + return ((int16) + ((int16)*((uint8 *)b+os+0)<<8| + (int16)*((uint8 *)b+os+1)<<0)); +} + +__inline uint16 SW_USHORT_AT(void *b, uint32 os) +{ + return ((uint16) + ((uint16)*((uint8 *)b+os+0)<<8| + (uint16)*((uint8 *)b+os+1)<<0)); +} + +__inline VOID SW_ULONG_ASSIGN(void *dst, uint32 src) +{ + *((uint8*)dst+0)=*((uint8*)&src+3); + *((uint8*)dst+1)=*((uint8*)&src+2); + *((uint8*)dst+2)=*((uint8*)&src+1); + *((uint8*)dst+3)=*((uint8*)&src+0); + +} + +#ifdef WIN_NT_DRIVER + +#define ALLOCATE_MEMORY(dest,type,amount) \ + (dest)=ExAllocatePool(NonPagedPool,sizeof(type)*(amount)); +#define ALLOCATE_ZERO_MEMORY(dest,type,amount) \ + { \ + (dest)=ExAllocatePool(NonPagedPool,sizeof(type)*(amount)); \ + if ((dest)!=NULL) \ + RtlZeroMemory((dest),sizeof(type)*(amount)); \ + } + +#define FREE_MEMORY(dest) ExFreePool(dest); +#define ZERO_MEMORY(dest,amount) RtlZeroMemory(dest,amount); +#define COPY_MEMORY(dest,src,amount) RtlCopyMemory(dest,src,amount); + +#else + +#define ALLOCATE_MEMORY(dest,type,amount) \ + (dest)=(type*)GlobalAlloc(GPTR, sizeof(type)*(amount)); +#define ALLOCATE_ZERO_MEMORY(dest,type,amount) \ + (dest)=(type*)GlobalAlloc(GPTR, sizeof(type)*(amount)); + +#define FREE_MEMORY(dest) GlobalFree(dest); +#define ZERO_MEMORY(dest,amount) RtlZeroMemory(dest,amount); +#define COPY_MEMORY(dest,src,amount) RtlCopyMemory(dest,src,amount); + + +#endif /*WIN_NT_DRIVER*/ + + + +#endif + diff --git a/src/See/normal_lookup.c b/src/See/normal_lookup.c index 24adb62e..6f1d6405 100644 --- a/src/See/normal_lookup.c +++ b/src/See/normal_lookup.c @@ -1,204 +1,204 @@ -/* - * Copyright (c) 2001 - 2003 - * NetGroup, Politecnico di Torino (Italy) - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the Politecnico di Torino nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - */ - -#include - -#ifdef WIN32 -#include "tme.h" -#include "normal_lookup.h" -#endif - -#ifdef __FreeBSD__ - -#ifdef _KERNEL -#include -#include -#else -#include -#include -#endif - -#endif - - -/* lookup in the table, seen as an hash */ -/* if not found, inserts an element */ -/* returns TME_TRUE if the entry is found or created, */ -/* returns TME_FALSE if no more blocks are available */ -uint32 normal_lut_w_insert(uint8 *key, TME_DATA *data, MEM_TYPE *mem_ex, struct time_conv *time_ref) -{ - uint32 i; - uint32 tocs=0; - uint32 *key32=(uint32*) key; - uint32 shrinked_key=0; - uint32 index; - RECORD *records=(RECORD*)data->lut_base_address; - uint8 *offset; - uint32 key_len=data->key_len; - /*the key is shrinked into a 32-bit value */ - for (i=0; ilut_entries; - - while (tocs<=data->filled_entries) - { - - if (records[index].block==0) - { /*creation of a new entry*/ - - if (data->filled_blocks==data->shared_memory_blocks) - { - /*no more free blocks*/ - GET_TIME((struct timeval *)(data->shared_memory_base_address+4*key_len),time_ref); - data->last_found=NULL; - return TME_FALSE; - } - - /*offset=absolute pointer to the block associated*/ - /*with the newly created entry*/ - offset=data->shared_memory_base_address+ - data->block_size*data->filled_blocks; - - /*copy the key in the block*/ - COPY_MEMORY(offset,key32,key_len*4); - GET_TIME((struct timeval *)(offset+4*key_len),time_ref); - /*assign the block relative offset to the entry, in NBO*/ - SW_ULONG_ASSIGN(&records[index].block,offset-mem_ex->buffer); - - data->filled_blocks++; - - /*assign the exec function ID to the entry, in NBO*/ - SW_ULONG_ASSIGN(&records[index].exec_fcn,data->default_exec); - data->filled_entries++; - - data->last_found=(uint8*)&records[index]; - - return TME_TRUE; - } - /*offset contains the absolute pointer to the block*/ - /*associated with the current entry */ - offset=mem_ex->buffer+SW_ULONG_AT(&records[index].block,0); - - for (i=0; (ilast_found=(uint8*)&records[index]; - return TME_TRUE; - } - else - { - /* wrong entry, rehashing */ - if (IS_DELETABLE(offset+key_len*4,data)) - { - ZERO_MEMORY(offset,data->block_size); - COPY_MEMORY(offset,key32,key_len*4); - SW_ULONG_ASSIGN(&records[index].exec_fcn,data->default_exec); - GET_TIME((struct timeval*)(offset+key_len*4),time_ref); - data->last_found=(uint8*)&records[index]; - return TME_TRUE; - } - else - { - index=(index+data->rehashing_value) % data->lut_entries; - tocs++; - } - } - } - - /* nothing found, last found= out of lut */ - GET_TIME((struct timeval *)(data->shared_memory_base_address+4*key_len),time_ref); - data->last_found=NULL; - return TME_FALSE; - -} - -/* lookup in the table, seen as an hash */ -/* if not found, returns out of count entry index */ -/* returns TME_TRUE if the entry is found */ -/* returns TME_FALSE if the entry is not found */ -uint32 normal_lut_wo_insert(uint8 *key, TME_DATA *data, MEM_TYPE *mem_ex, struct time_conv *time_ref) -{ - uint32 i; - uint32 tocs=0; - uint32 *key32=(uint32*) key; - uint32 shrinked_key=0; - uint32 index; - RECORD *records=(RECORD*)data->lut_base_address; - uint8 *offset; - uint32 key_len=data->key_len; - /*the key is shrinked into a 32-bit value */ - for (i=0; ilut_entries; - - while (tocs<=data->filled_entries) - { - - if (records[index].block==0) - { /*out of table, insertion is not allowed*/ - GET_TIME((struct timeval *)(data->shared_memory_base_address+4*key_len),time_ref); - data->last_found=NULL; - return TME_FALSE; - } - /*offset contains the absolute pointer to the block*/ - /*associated with the current entry */ - - offset=mem_ex->buffer+SW_ULONG_AT(&records[index].block,0); - - for (i=0; (ilast_found=(uint8*)&records[index]; - return TME_TRUE; - } - else - { - /*wrong entry, rehashing*/ - index=(index+data->rehashing_value) % data->lut_entries; - tocs++; - } - } - - /*nothing found, last found= out of lut*/ - GET_TIME((struct timeval *)(data->shared_memory_base_address+4*key_len),time_ref); - data->last_found=NULL; - return TME_FALSE; - -} +/* + * Copyright (c) 2001 - 2003 + * NetGroup, Politecnico di Torino (Italy) + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the Politecnico di Torino nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#include + +#ifdef WIN32 +#include "tme.h" +#include "normal_lookup.h" +#endif + +#ifdef __FreeBSD__ + +#ifdef _KERNEL +#include +#include +#else +#include +#include +#endif + +#endif + + +/* lookup in the table, seen as an hash */ +/* if not found, inserts an element */ +/* returns TME_TRUE if the entry is found or created, */ +/* returns TME_FALSE if no more blocks are available */ +uint32 normal_lut_w_insert(uint8 *key, TME_DATA *data, MEM_TYPE *mem_ex, struct time_conv *time_ref) +{ + uint32 i; + uint32 tocs=0; + uint32 *key32=(uint32*) key; + uint32 shrinked_key=0; + uint32 index; + RECORD *records=(RECORD*)data->lut_base_address; + uint8 *offset; + uint32 key_len=data->key_len; + /*the key is shrinked into a 32-bit value */ + for (i=0; ilut_entries; + + while (tocs<=data->filled_entries) + { + + if (records[index].block==0) + { /*creation of a new entry*/ + + if (data->filled_blocks==data->shared_memory_blocks) + { + /*no more free blocks*/ + GET_TIME((struct timeval *)(data->shared_memory_base_address+4*key_len),time_ref); + data->last_found=NULL; + return TME_FALSE; + } + + /*offset=absolute pointer to the block associated*/ + /*with the newly created entry*/ + offset=data->shared_memory_base_address+ + data->block_size*data->filled_blocks; + + /*copy the key in the block*/ + COPY_MEMORY(offset,key32,key_len*4); + GET_TIME((struct timeval *)(offset+4*key_len),time_ref); + /*assign the block relative offset to the entry, in NBO*/ + SW_ULONG_ASSIGN(&records[index].block,offset-mem_ex->buffer); + + data->filled_blocks++; + + /*assign the exec function ID to the entry, in NBO*/ + SW_ULONG_ASSIGN(&records[index].exec_fcn,data->default_exec); + data->filled_entries++; + + data->last_found=(uint8*)&records[index]; + + return TME_TRUE; + } + /*offset contains the absolute pointer to the block*/ + /*associated with the current entry */ + offset=mem_ex->buffer+SW_ULONG_AT(&records[index].block,0); + + for (i=0; (ilast_found=(uint8*)&records[index]; + return TME_TRUE; + } + else + { + /* wrong entry, rehashing */ + if (IS_DELETABLE(offset+key_len*4,data)) + { + ZERO_MEMORY(offset,data->block_size); + COPY_MEMORY(offset,key32,key_len*4); + SW_ULONG_ASSIGN(&records[index].exec_fcn,data->default_exec); + GET_TIME((struct timeval*)(offset+key_len*4),time_ref); + data->last_found=(uint8*)&records[index]; + return TME_TRUE; + } + else + { + index=(index+data->rehashing_value) % data->lut_entries; + tocs++; + } + } + } + + /* nothing found, last found= out of lut */ + GET_TIME((struct timeval *)(data->shared_memory_base_address+4*key_len),time_ref); + data->last_found=NULL; + return TME_FALSE; + +} + +/* lookup in the table, seen as an hash */ +/* if not found, returns out of count entry index */ +/* returns TME_TRUE if the entry is found */ +/* returns TME_FALSE if the entry is not found */ +uint32 normal_lut_wo_insert(uint8 *key, TME_DATA *data, MEM_TYPE *mem_ex, struct time_conv *time_ref) +{ + uint32 i; + uint32 tocs=0; + uint32 *key32=(uint32*) key; + uint32 shrinked_key=0; + uint32 index; + RECORD *records=(RECORD*)data->lut_base_address; + uint8 *offset; + uint32 key_len=data->key_len; + /*the key is shrinked into a 32-bit value */ + for (i=0; ilut_entries; + + while (tocs<=data->filled_entries) + { + + if (records[index].block==0) + { /*out of table, insertion is not allowed*/ + GET_TIME((struct timeval *)(data->shared_memory_base_address+4*key_len),time_ref); + data->last_found=NULL; + return TME_FALSE; + } + /*offset contains the absolute pointer to the block*/ + /*associated with the current entry */ + + offset=mem_ex->buffer+SW_ULONG_AT(&records[index].block,0); + + for (i=0; (ilast_found=(uint8*)&records[index]; + return TME_TRUE; + } + else + { + /*wrong entry, rehashing*/ + index=(index+data->rehashing_value) % data->lut_entries; + tocs++; + } + } + + /*nothing found, last found= out of lut*/ + GET_TIME((struct timeval *)(data->shared_memory_base_address+4*key_len),time_ref); + data->last_found=NULL; + return TME_FALSE; + +} diff --git a/src/See/normal_lookup.h b/src/See/normal_lookup.h index 45ac4fd1..987f9055 100644 --- a/src/See/normal_lookup.h +++ b/src/See/normal_lookup.h @@ -1,56 +1,56 @@ -/* - * Copyright (c) 2001 - 2003 - * NetGroup, Politecnico di Torino (Italy) - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the Politecnico di Torino nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - */ - -#ifndef __normal_lookup -#define __normal_lookup - -#ifdef WIN32 -#include "tme.h" -#endif - -#ifdef __FreeBSD__ - -#ifdef _KERNEL -#include -#else -#include -#endif - -#endif - -#define NORMAL_LUT_W_INSERT 0x00000000 -uint32 normal_lut_w_insert(uint8 *key, TME_DATA *data, MEM_TYPE *mem_ex, struct time_conv *time_ref); -#define NORMAL_LUT_WO_INSERT 0x00000001 -uint32 normal_lut_wo_insert(uint8 *key, TME_DATA *data, MEM_TYPE *mem_ex, struct time_conv *time_ref); -#define DUMMY_INSERT 1234 - -#endif +/* + * Copyright (c) 2001 - 2003 + * NetGroup, Politecnico di Torino (Italy) + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the Politecnico di Torino nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#ifndef __normal_lookup +#define __normal_lookup + +#ifdef WIN32 +#include "tme.h" +#endif + +#ifdef __FreeBSD__ + +#ifdef _KERNEL +#include +#else +#include +#endif + +#endif + +#define NORMAL_LUT_W_INSERT 0x00000000 +uint32 normal_lut_w_insert(uint8 *key, TME_DATA *data, MEM_TYPE *mem_ex, struct time_conv *time_ref); +#define NORMAL_LUT_WO_INSERT 0x00000001 +uint32 normal_lut_wo_insert(uint8 *key, TME_DATA *data, MEM_TYPE *mem_ex, struct time_conv *time_ref); +#define DUMMY_INSERT 1234 + +#endif diff --git a/src/See/resource.h b/src/See/resource.h index d363c018..85cfce54 100644 --- a/src/See/resource.h +++ b/src/See/resource.h @@ -1,16 +1,16 @@ -//{{NO_DEPENDENCIES}} -// Microsoft Developer Studio generated include file. -// Used by NPF.RC - - - -// Next default values for new objects -// -#ifdef APSTUDIO_INVOKED -#ifndef APSTUDIO_READONLY_SYMBOLS -#define _APS_NEXT_RESOURCE_VALUE 101 -#define _APS_NEXT_COMMAND_VALUE 40001 -#define _APS_NEXT_CONTROL_VALUE 1000 -#define _APS_NEXT_SYMED_VALUE 101 -#endif -#endif +//{{NO_DEPENDENCIES}} +// Microsoft Developer Studio generated include file. +// Used by NPF.RC + + + +// Next default values for new objects +// +#ifdef APSTUDIO_INVOKED +#ifndef APSTUDIO_READONLY_SYMBOLS +#define _APS_NEXT_RESOURCE_VALUE 101 +#define _APS_NEXT_COMMAND_VALUE 40001 +#define _APS_NEXT_CONTROL_VALUE 1000 +#define _APS_NEXT_SYMED_VALUE 101 +#endif +#endif diff --git a/src/See/resource1.h b/src/See/resource1.h index de35a2f9..937500d2 100644 --- a/src/See/resource1.h +++ b/src/See/resource1.h @@ -1,15 +1,15 @@ -//{{NO_DEPENDENCIES}} -// Microsoft Visual C++ generated include file. -// Used by See.rc - - -// Next default values for new objects -// -#ifdef APSTUDIO_INVOKED -#ifndef APSTUDIO_READONLY_SYMBOLS -#define _APS_NEXT_RESOURCE_VALUE 101 -#define _APS_NEXT_COMMAND_VALUE 40001 -#define _APS_NEXT_CONTROL_VALUE 1000 -#define _APS_NEXT_SYMED_VALUE 101 -#endif -#endif +//{{NO_DEPENDENCIES}} +// Microsoft Visual C++ generated include file. +// Used by See.rc + + +// Next default values for new objects +// +#ifdef APSTUDIO_INVOKED +#ifndef APSTUDIO_READONLY_SYMBOLS +#define _APS_NEXT_RESOURCE_VALUE 101 +#define _APS_NEXT_COMMAND_VALUE 40001 +#define _APS_NEXT_CONTROL_VALUE 1000 +#define _APS_NEXT_SYMED_VALUE 101 +#endif +#endif diff --git a/src/See/tcp_session.c b/src/See/tcp_session.c index cce97465..a1dbf5ce 100644 --- a/src/See/tcp_session.c +++ b/src/See/tcp_session.c @@ -1,296 +1,296 @@ -/* - * Copyright (c) 2001 - 2003 - * NetGroup, Politecnico di Torino (Italy) - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the Politecnico di Torino nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - */ - -#include - -#ifdef WIN32 -#include "tme.h" -#include "tcp_session.h" -#endif - -#ifdef __FreeBSD - -#ifdef _KERNEL -#include -#include -#else -#include -#include -#endif - -#endif - -uint32 tcp_session(uint8 *block, uint32 pkt_size, TME_DATA *data, MEM_TYPE *mem_ex, uint8 *mem_data) - -{ - - uint32 next_status; - uint32 direction=ULONG_AT(mem_data,12); - uint8 flags=mem_ex->buffer[25]; - tcp_data *session=(tcp_data*)(block+data->key_len*4); - - session->last_timestamp=session->timestamp_block; - session->timestamp_block.tv_sec=0x7fffffff; - - if (direction==session->direction) - { - session->pkts_cln_to_srv++; - session->bytes_cln_to_srv+=pkt_size; - } - else - { - session->pkts_srv_to_cln++; - session->bytes_srv_to_cln+=pkt_size; - } - /* we use only thes four flags, we don't need PSH or URG */ - flags&=(ACK|FIN|SYN|RST); - - switch (session->status) - { - case ERROR_TCP: - next_status=ERROR_TCP; - break; - - case UNKNOWN: - if (flags==SYN) - { - if (SW_ULONG_AT(mem_ex->buffer,20)!=0) - { - - next_status=ERROR_TCP; - break; - } - next_status=SYN_RCV; - session->syn_timestamp=session->last_timestamp; - - session->direction=direction; - session->seq_n_0_cln=SW_ULONG_AT(mem_ex->buffer,16); - } - else - next_status=UNKNOWN; - break; - - case SYN_RCV: - if ((flags&RST)&&(direction!=session->direction)) - { - next_status=CLOSED_RST; - break; - } - if ((flags==SYN)&&(direction==session->direction)) - { /* two syns... */ - next_status=SYN_RCV; - session->seq_n_0_cln=SW_ULONG_AT(mem_ex->buffer,16); - break; - } - - if ((flags==(SYN|ACK))&&(direction!=session->direction)) - { - if (SW_ULONG_AT(mem_ex->buffer,20)!=session->seq_n_0_cln+1) - { - next_status=ERROR_TCP; - break; - } - next_status=SYN_ACK_RCV; - - session->syn_ack_timestamp=session->last_timestamp; - - session->seq_n_0_srv=SW_ULONG_AT(mem_ex->buffer,16); - session->ack_cln=session->seq_n_0_cln+1; - } - else - { - next_status=ERROR_TCP; - } - break; - - case SYN_ACK_RCV: - if ((flags&ACK)&&(flags&RST)&&(direction==session->direction)) - { - next_status=CLOSED_RST; - session->ack_srv=SW_ULONG_AT(mem_ex->buffer,20); - break; - } - - if ((flags==ACK)&&(!(flags&(SYN|FIN|RST)))&&(direction==session->direction)) - { - if (SW_ULONG_AT(mem_ex->buffer,20)!=session->seq_n_0_srv+1) - { - next_status=ERROR_TCP; - break; - } - next_status=ESTABLISHED; - session->ack_srv=session->seq_n_0_srv+1; - break; - } - if ((flags&ACK)&&(flags&SYN)&&(direction!=session->direction)) - { - next_status=SYN_ACK_RCV; - break; - } - - next_status=ERROR_TCP; - break; - - case ESTABLISHED: - if (flags&SYN) - { - if ((flags&ACK)&& - (direction!=session->direction)&& - ((session->ack_cln-SW_ULONG_AT(mem_ex->buffer,20))direction)&& - (SW_ULONG_AT(mem_ex->buffer,16)==session->seq_n_0_cln)&& - (ULONG_AT(mem_ex->buffer,20)==0) - ) - { /* syn duplicato */ - next_status=ESTABLISHED; - break; - } - - next_status=ERROR_TCP; - break; - } - if (flags&ACK) - if (direction==session->direction) - { - uint32 new_ack=SW_ULONG_AT(mem_ex->buffer,20); - if (new_ack-session->ack_srvack_srv=new_ack; - } - else - { - uint32 new_ack=SW_ULONG_AT(mem_ex->buffer,20); - if (new_ack-session->ack_clnack_cln=new_ack; - } - if (flags&RST) - { - next_status=CLOSED_RST; - break; - } - if (flags&FIN) - if (direction==session->direction) - { /* an hack to make all things work */ - session->ack_cln=SW_ULONG_AT(mem_ex->buffer,16); - next_status=FIN_CLN_RCV; - break; - } - else - { - session->ack_srv=SW_ULONG_AT(mem_ex->buffer,16); - next_status=FIN_SRV_RCV; - break; - } - next_status=ESTABLISHED; - break; - - case CLOSED_RST: - next_status=CLOSED_RST; - break; - - case FIN_SRV_RCV: - if (flags&SYN) - { - next_status=ERROR_TCP; - break; - } - - next_status=FIN_SRV_RCV; - - if (flags&ACK) - { - uint32 new_ack=SW_ULONG_AT(mem_ex->buffer,20); - if (direction!=session->direction) - if ((new_ack-session->ack_cln)ack_cln=new_ack; - } - - if (flags&RST) - next_status=CLOSED_RST; - else - if ((flags&FIN)&&(direction==session->direction)) - { - session->ack_cln=SW_ULONG_AT(mem_ex->buffer,16); - next_status=CLOSED_FIN; - } - - break; - - case FIN_CLN_RCV: - if (flags&SYN) - { - next_status=ERROR_TCP; - break; - } - - next_status=FIN_CLN_RCV; - - if (flags&ACK) - { - uint32 new_ack=SW_ULONG_AT(mem_ex->buffer,20); - if (direction==session->direction) - if (new_ack-session->ack_srvack_srv=new_ack; - } - - if (flags&RST) - next_status=CLOSED_RST; - else - if ((flags&FIN)&&(direction!=session->direction)) - { - session->ack_srv=SW_ULONG_AT(mem_ex->buffer,16); - next_status=CLOSED_FIN; - } - - break; - - case CLOSED_FIN: - next_status=CLOSED_FIN; - break; - default: - next_status=ERROR_TCP; - - } - - session->status=next_status; - - if ((next_status==CLOSED_FIN)||(next_status==UNKNOWN)||(next_status==CLOSED_RST)||(next_status==ERROR_TCP)) - session->timestamp_block=session->last_timestamp; - - return TME_SUCCESS; -} +/* + * Copyright (c) 2001 - 2003 + * NetGroup, Politecnico di Torino (Italy) + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the Politecnico di Torino nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#include + +#ifdef WIN32 +#include "tme.h" +#include "tcp_session.h" +#endif + +#ifdef __FreeBSD + +#ifdef _KERNEL +#include +#include +#else +#include +#include +#endif + +#endif + +uint32 tcp_session(uint8 *block, uint32 pkt_size, TME_DATA *data, MEM_TYPE *mem_ex, uint8 *mem_data) + +{ + + uint32 next_status; + uint32 direction=ULONG_AT(mem_data,12); + uint8 flags=mem_ex->buffer[25]; + tcp_data *session=(tcp_data*)(block+data->key_len*4); + + session->last_timestamp=session->timestamp_block; + session->timestamp_block.tv_sec=0x7fffffff; + + if (direction==session->direction) + { + session->pkts_cln_to_srv++; + session->bytes_cln_to_srv+=pkt_size; + } + else + { + session->pkts_srv_to_cln++; + session->bytes_srv_to_cln+=pkt_size; + } + /* we use only thes four flags, we don't need PSH or URG */ + flags&=(ACK|FIN|SYN|RST); + + switch (session->status) + { + case ERROR_TCP: + next_status=ERROR_TCP; + break; + + case UNKNOWN: + if (flags==SYN) + { + if (SW_ULONG_AT(mem_ex->buffer,20)!=0) + { + + next_status=ERROR_TCP; + break; + } + next_status=SYN_RCV; + session->syn_timestamp=session->last_timestamp; + + session->direction=direction; + session->seq_n_0_cln=SW_ULONG_AT(mem_ex->buffer,16); + } + else + next_status=UNKNOWN; + break; + + case SYN_RCV: + if ((flags&RST)&&(direction!=session->direction)) + { + next_status=CLOSED_RST; + break; + } + if ((flags==SYN)&&(direction==session->direction)) + { /* two syns... */ + next_status=SYN_RCV; + session->seq_n_0_cln=SW_ULONG_AT(mem_ex->buffer,16); + break; + } + + if ((flags==(SYN|ACK))&&(direction!=session->direction)) + { + if (SW_ULONG_AT(mem_ex->buffer,20)!=session->seq_n_0_cln+1) + { + next_status=ERROR_TCP; + break; + } + next_status=SYN_ACK_RCV; + + session->syn_ack_timestamp=session->last_timestamp; + + session->seq_n_0_srv=SW_ULONG_AT(mem_ex->buffer,16); + session->ack_cln=session->seq_n_0_cln+1; + } + else + { + next_status=ERROR_TCP; + } + break; + + case SYN_ACK_RCV: + if ((flags&ACK)&&(flags&RST)&&(direction==session->direction)) + { + next_status=CLOSED_RST; + session->ack_srv=SW_ULONG_AT(mem_ex->buffer,20); + break; + } + + if ((flags==ACK)&&(!(flags&(SYN|FIN|RST)))&&(direction==session->direction)) + { + if (SW_ULONG_AT(mem_ex->buffer,20)!=session->seq_n_0_srv+1) + { + next_status=ERROR_TCP; + break; + } + next_status=ESTABLISHED; + session->ack_srv=session->seq_n_0_srv+1; + break; + } + if ((flags&ACK)&&(flags&SYN)&&(direction!=session->direction)) + { + next_status=SYN_ACK_RCV; + break; + } + + next_status=ERROR_TCP; + break; + + case ESTABLISHED: + if (flags&SYN) + { + if ((flags&ACK)&& + (direction!=session->direction)&& + ((session->ack_cln-SW_ULONG_AT(mem_ex->buffer,20))direction)&& + (SW_ULONG_AT(mem_ex->buffer,16)==session->seq_n_0_cln)&& + (ULONG_AT(mem_ex->buffer,20)==0) + ) + { /* syn duplicato */ + next_status=ESTABLISHED; + break; + } + + next_status=ERROR_TCP; + break; + } + if (flags&ACK) + if (direction==session->direction) + { + uint32 new_ack=SW_ULONG_AT(mem_ex->buffer,20); + if (new_ack-session->ack_srvack_srv=new_ack; + } + else + { + uint32 new_ack=SW_ULONG_AT(mem_ex->buffer,20); + if (new_ack-session->ack_clnack_cln=new_ack; + } + if (flags&RST) + { + next_status=CLOSED_RST; + break; + } + if (flags&FIN) + if (direction==session->direction) + { /* an hack to make all things work */ + session->ack_cln=SW_ULONG_AT(mem_ex->buffer,16); + next_status=FIN_CLN_RCV; + break; + } + else + { + session->ack_srv=SW_ULONG_AT(mem_ex->buffer,16); + next_status=FIN_SRV_RCV; + break; + } + next_status=ESTABLISHED; + break; + + case CLOSED_RST: + next_status=CLOSED_RST; + break; + + case FIN_SRV_RCV: + if (flags&SYN) + { + next_status=ERROR_TCP; + break; + } + + next_status=FIN_SRV_RCV; + + if (flags&ACK) + { + uint32 new_ack=SW_ULONG_AT(mem_ex->buffer,20); + if (direction!=session->direction) + if ((new_ack-session->ack_cln)ack_cln=new_ack; + } + + if (flags&RST) + next_status=CLOSED_RST; + else + if ((flags&FIN)&&(direction==session->direction)) + { + session->ack_cln=SW_ULONG_AT(mem_ex->buffer,16); + next_status=CLOSED_FIN; + } + + break; + + case FIN_CLN_RCV: + if (flags&SYN) + { + next_status=ERROR_TCP; + break; + } + + next_status=FIN_CLN_RCV; + + if (flags&ACK) + { + uint32 new_ack=SW_ULONG_AT(mem_ex->buffer,20); + if (direction==session->direction) + if (new_ack-session->ack_srvack_srv=new_ack; + } + + if (flags&RST) + next_status=CLOSED_RST; + else + if ((flags&FIN)&&(direction!=session->direction)) + { + session->ack_srv=SW_ULONG_AT(mem_ex->buffer,16); + next_status=CLOSED_FIN; + } + + break; + + case CLOSED_FIN: + next_status=CLOSED_FIN; + break; + default: + next_status=ERROR_TCP; + + } + + session->status=next_status; + + if ((next_status==CLOSED_FIN)||(next_status==UNKNOWN)||(next_status==CLOSED_RST)||(next_status==ERROR_TCP)) + session->timestamp_block=session->last_timestamp; + + return TME_SUCCESS; +} diff --git a/src/See/tcp_session.h b/src/See/tcp_session.h index 33aa99e1..ccd87eba 100644 --- a/src/See/tcp_session.h +++ b/src/See/tcp_session.h @@ -1,96 +1,96 @@ -/* - * Copyright (c) 2001 - 2003 - * NetGroup, Politecnico di Torino (Italy) - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the Politecnico di Torino nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - */ - -#ifndef __tcp_session -#define __tcp_session - -#ifdef WIN32 -#include "tme.h" -#endif - -#ifdef __FreeBSD__ - -#ifdef _KERNEL -#include -#else -#include -#endif - -#endif - -#define UNKNOWN 0 -#define SYN_RCV 1 -#define SYN_ACK_RCV 2 -#define ESTABLISHED 3 -#define CLOSED_RST 4 -#define FIN_CLN_RCV 5 -#define FIN_SRV_RCV 6 -#define CLOSED_FIN 7 -#define ERROR_TCP 8 -#define FIRST_IS_CLN 0 -#define FIRST_IS_SRV 0xffffffff -#define FIN_CLN 1 -#define FIN_SRV 2 - -#define MAX_WINDOW 65536 - -typedef struct __tcp_data -{ - struct timeval timestamp_block; /*DO NOT MOVE THIS VALUE*/ - struct timeval syn_timestamp; - struct timeval last_timestamp; - struct timeval syn_ack_timestamp; - uint32 direction; - uint32 seq_n_0_srv; - uint32 seq_n_0_cln; - uint32 ack_srv; /* acknowledge of (data sent by server) */ - uint32 ack_cln; /* acknowledge of (data sent by client) */ - uint32 status; - uint32 pkts_cln_to_srv; - uint32 pkts_srv_to_cln; - uint32 bytes_srv_to_cln; - uint32 bytes_cln_to_srv; - uint32 close_state; -} - tcp_data; - -#define FIN 1 -#define SYN 2 -#define RST 4 -#define PSH 8 -#define ACK 16 -#define URG 32 - -#define TCP_SESSION 0x00000800 -uint32 tcp_session(uint8 *block, uint32 pkt_size, TME_DATA *data, MEM_TYPE *mem_ex, uint8 *mem_data); - -#endif +/* + * Copyright (c) 2001 - 2003 + * NetGroup, Politecnico di Torino (Italy) + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the Politecnico di Torino nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#ifndef __tcp_session +#define __tcp_session + +#ifdef WIN32 +#include "tme.h" +#endif + +#ifdef __FreeBSD__ + +#ifdef _KERNEL +#include +#else +#include +#endif + +#endif + +#define UNKNOWN 0 +#define SYN_RCV 1 +#define SYN_ACK_RCV 2 +#define ESTABLISHED 3 +#define CLOSED_RST 4 +#define FIN_CLN_RCV 5 +#define FIN_SRV_RCV 6 +#define CLOSED_FIN 7 +#define ERROR_TCP 8 +#define FIRST_IS_CLN 0 +#define FIRST_IS_SRV 0xffffffff +#define FIN_CLN 1 +#define FIN_SRV 2 + +#define MAX_WINDOW 65536 + +typedef struct __tcp_data +{ + struct timeval timestamp_block; /*DO NOT MOVE THIS VALUE*/ + struct timeval syn_timestamp; + struct timeval last_timestamp; + struct timeval syn_ack_timestamp; + uint32 direction; + uint32 seq_n_0_srv; + uint32 seq_n_0_cln; + uint32 ack_srv; /* acknowledge of (data sent by server) */ + uint32 ack_cln; /* acknowledge of (data sent by client) */ + uint32 status; + uint32 pkts_cln_to_srv; + uint32 pkts_srv_to_cln; + uint32 bytes_srv_to_cln; + uint32 bytes_cln_to_srv; + uint32 close_state; +} + tcp_data; + +#define FIN 1 +#define SYN 2 +#define RST 4 +#define PSH 8 +#define ACK 16 +#define URG 32 + +#define TCP_SESSION 0x00000800 +uint32 tcp_session(uint8 *block, uint32 pkt_size, TME_DATA *data, MEM_TYPE *mem_ex, uint8 *mem_data); + +#endif diff --git a/src/See/time_calls.h b/src/See/time_calls.h index 8f02f48f..9141624f 100644 --- a/src/See/time_calls.h +++ b/src/See/time_calls.h @@ -1,486 +1,486 @@ -/* - * Copyright (c) 2001 - 2005 NetGroup, Politecnico di Torino (Italy) - * Copyright (c) 2005 CACE Technologies, Davis (California) - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the Politecnico di Torino, CACE Technologies - * nor the names of its contributors may be used to endorse or promote - * products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - */ - -#ifndef _time_calls -#define _time_calls - -#ifdef WIN_NT_DRIVER - -#include "debug.h" -#include "ndis.h" - -#define DEFAULT_TIMESTAMPMODE 0 - -#define TIMESTAMPMODE_SINGLE_SYNCHRONIZATION 0 -#define TIMESTAMPMODE_SYNCHRONIZATION_ON_CPU_WITH_FIXUP 1 -#define TIMESTAMPMODE_QUERYSYSTEMTIME 2 -#define TIMESTAMPMODE_RDTSC 3 - -#define TIMESTAMPMODE_SYNCHRONIZATION_ON_CPU_NO_FIXUP 99 - -#define TIMESTAMPMODE_REGKEY L"TimestampMode" - -extern ULONG TimestampMode; -extern ULONG NCpu; - -/*! - \brief A microsecond precise timestamp. - - included in the sf_pkthdr or the bpf_hdr that NPF associates with every packet. -*/ - -struct timeval { - long tv_sec; ///< seconds - long tv_usec; ///< microseconds -}; - -#endif /*WIN_NT_DRIVER*/ - -struct time_conv -{ - ULONGLONG reference; - struct timeval start[32]; -}; - -#ifdef WIN_NT_DRIVER - -__inline void TIME_DESYNCHRONIZE(struct time_conv *data) -{ - data->reference = 0; -// data->start.tv_sec = 0; -// data->start.tv_usec = 0; -} - - -__inline void ReadTimeStampModeFromRegistry(PUNICODE_STRING RegistryPath) -{ - ULONG NewLength; - PWSTR NullTerminatedString; - RTL_QUERY_REGISTRY_TABLE Queries[2]; - ULONG DefaultTimestampMode = DEFAULT_TIMESTAMPMODE; - - NewLength = RegistryPath->Length/2; - - NullTerminatedString = ExAllocatePool(PagedPool, (NewLength+1) *sizeof(WCHAR)); - - if (NullTerminatedString != NULL) - { - RtlCopyMemory(NullTerminatedString, RegistryPath->Buffer, RegistryPath->Length); - - NullTerminatedString[NewLength]=0; - - RtlZeroMemory(Queries, sizeof(Queries)); - - Queries[0].Flags = RTL_QUERY_REGISTRY_DIRECT; - Queries[0].Name = TIMESTAMPMODE_REGKEY; - Queries[0].EntryContext = &TimestampMode; - Queries[0].DefaultType = REG_DWORD; - Queries[0].DefaultData = &DefaultTimestampMode; - Queries[0].DefaultLength = sizeof(ULONG); - - if (RtlQueryRegistryValues(RTL_REGISTRY_ABSOLUTE, NullTerminatedString, Queries, NULL, NULL) != STATUS_SUCCESS) - { - TimestampMode = DEFAULT_TIMESTAMPMODE; - } - - RtlWriteRegistryValue( RTL_REGISTRY_ABSOLUTE, NullTerminatedString, TIMESTAMPMODE_REGKEY, REG_DWORD, &TimestampMode,sizeof(ULONG)); - ExFreePool(NullTerminatedString); - } - else - TimestampMode = DEFAULT_TIMESTAMPMODE; -} - -#pragma optimize ("g",off) //Due to some weird behaviour of the optimizer of DDK build 2600 - -/* KeQueryPerformanceCounter TimeStamps */ -__inline void SynchronizeOnCpu(struct timeval *start) -{ -// struct timeval *start = (struct timeval*)Data; - - LARGE_INTEGER SystemTime; - LARGE_INTEGER TimeFreq,PTime; - - // get the absolute value of the system boot time. - - PTime = KeQueryPerformanceCounter(&TimeFreq); - KeQuerySystemTime(&SystemTime); - - start->tv_sec = (LONG)(SystemTime.QuadPart/10000000-11644473600); - - start->tv_usec = (LONG)((SystemTime.QuadPart%10000000)/10); - - start->tv_sec -= (ULONG)(PTime.QuadPart/TimeFreq.QuadPart); - - start->tv_usec -= (LONG)((PTime.QuadPart%TimeFreq.QuadPart)*1000000/TimeFreq.QuadPart); - - if (start->tv_usec < 0) - { - start->tv_sec --; - start->tv_usec += 1000000; - } -} - -// -// inline assembler is not supported with the current AMD64 compilers -// At the moment we simply disable this timestamping mode on AMD64. -// A solution would be to allocate a small memory from the non-paged -// pool, dump the instructions on that buffer, and then execute them. -// The non paged pool is needed since it's the only area of kernel -// data memory that is not subject to the NX protection. -// Or use some lower level trick, like using an assembler to assemble -// a small function for this. -// - -#ifdef __NPF_x86__ -/*RDTSC timestamps */ -/* callers must be at IRQL=PASSIVE_LEVEL*/ -__inline VOID TimeSynchronizeRDTSC(struct time_conv *data) -{ - struct timeval tmp; - LARGE_INTEGER system_time; - ULONGLONG curr_ticks; - KIRQL old; - LARGE_INTEGER start_kqpc,stop_kqpc,start_freq,stop_freq; - ULONGLONG start_ticks,stop_ticks; - ULONGLONG delta,delta2; - KEVENT event; - LARGE_INTEGER i; - ULONGLONG reference; - - if (data->reference!=0) - return; - - KeInitializeEvent(&event,NotificationEvent,FALSE); - - i.QuadPart=-3500000; - - KeRaiseIrql(HIGH_LEVEL,&old); - start_kqpc=KeQueryPerformanceCounter(&start_freq); - __asm - { - push eax - push edx - push ecx - rdtsc - lea ecx, start_ticks - mov [ecx+4], edx - mov [ecx], eax - pop ecx - pop edx - pop eax - } - - KeLowerIrql(old); - - KeWaitForSingleObject(&event,UserRequest,KernelMode,TRUE ,&i); - - KeRaiseIrql(HIGH_LEVEL,&old); - stop_kqpc=KeQueryPerformanceCounter(&stop_freq); - __asm - { - push eax - push edx - push ecx - rdtsc - lea ecx, stop_ticks - mov [ecx+4], edx - mov [ecx], eax - pop ecx - pop edx - pop eax - } - KeLowerIrql(old); - - delta=stop_ticks-start_ticks; - delta2=stop_kqpc.QuadPart-start_kqpc.QuadPart; - if (delta>10000000000) - { - delta/=16; - delta2/=16; - } - - reference=delta*(start_freq.QuadPart)/delta2; - - data->reference=reference/1000; - - if (reference%1000>500) - data->reference++; - - data->reference*=1000; - - reference=data->reference; - - KeQuerySystemTime(&system_time); - - __asm - { - push eax - push edx - push ecx - rdtsc - lea ecx, curr_ticks - mov [ecx+4], edx - mov [ecx], eax - pop ecx - pop edx - pop eax - } - - tmp.tv_sec=-(LONG)(curr_ticks/reference); - - tmp.tv_usec=-(LONG)((curr_ticks%reference)*1000000/reference); - - system_time.QuadPart-=116444736000000000; - - tmp.tv_sec+=(LONG)(system_time.QuadPart/10000000); - tmp.tv_usec+=(LONG)((system_time.QuadPart%10000000)/10); - - if (tmp.tv_usec<0) - { - tmp.tv_sec--; - tmp.tv_usec+=1000000; - } - - data->start[0] = tmp; - - IF_LOUD(DbgPrint("Frequency %I64u MHz\n",data->reference);) -} -#endif //__NPF_x86__ - -#pragma optimize ("g",on) //Due to some weird behaviour of the optimizer of DDK build 2600 - -__inline VOID TIME_SYNCHRONIZE(struct time_conv *data) -{ - ULONG NumberOfCpus, i; - KAFFINITY AffinityMask; - - if (data->reference != 0) - return; - - NumberOfCpus = NCpu; - - if ( TimestampMode == TIMESTAMPMODE_SYNCHRONIZATION_ON_CPU_WITH_FIXUP || TimestampMode == TIMESTAMPMODE_SYNCHRONIZATION_ON_CPU_NO_FIXUP) - { - for (i = 0 ; i < NumberOfCpus ; i++ ) - { - AffinityMask = (1 << i); - ZwSetInformationThread(NtCurrentThread(), ThreadAffinityMask, &AffinityMask, sizeof(KAFFINITY)); - SynchronizeOnCpu(&(data->start[i])); - } - AffinityMask = 0xFFFFFFFF; - ZwSetInformationThread(NtCurrentThread(), ThreadAffinityMask, &AffinityMask, sizeof(KAFFINITY)); - data->reference = 1; - } - else - if ( TimestampMode == TIMESTAMPMODE_QUERYSYSTEMTIME ) - { - //do nothing - data->reference = 1; - } - else -// -// This timestamp mode is supported on x86 (32 bit) only -// -#ifdef __NPF_x86__ - if ( TimestampMode == TIMESTAMPMODE_RDTSC ) - { - TimeSynchronizeRDTSC(data); - } - else -#endif // __NPF_x86__ - { //it should be only the normal case i.e. TIMESTAMPMODE_SINGLESYNCHRONIZATION - SynchronizeOnCpu(data->start); - data->reference = 1; - } - return; -} - - -#pragma optimize ("g",off) //Due to some weird behaviour of the optimizer of DDK build 2600 - -__inline void GetTimeKQPC(struct timeval *dst, struct time_conv *data) -{ - LARGE_INTEGER PTime, TimeFreq; - LONG tmp; - ULONG CurrentCpu; - static struct timeval old_ts={0,0}; - - - PTime = KeQueryPerformanceCounter(&TimeFreq); - tmp = (LONG)(PTime.QuadPart/TimeFreq.QuadPart); - - if (TimestampMode == TIMESTAMPMODE_SYNCHRONIZATION_ON_CPU_WITH_FIXUP || TimestampMode == TIMESTAMPMODE_SYNCHRONIZATION_ON_CPU_NO_FIXUP) - { - //actually this code is ok only if we are guaranteed that no thread scheduling will take place. - CurrentCpu = KeGetCurrentProcessorNumber(); - - dst->tv_sec = data->start[CurrentCpu].tv_sec + tmp; - dst->tv_usec = data->start[CurrentCpu].tv_usec + (LONG)((PTime.QuadPart%TimeFreq.QuadPart)*1000000/TimeFreq.QuadPart); - - if (dst->tv_usec >= 1000000) - { - dst->tv_sec ++; - dst->tv_usec -= 1000000; - } - - if (TimestampMode == TIMESTAMPMODE_SYNCHRONIZATION_ON_CPU_WITH_FIXUP) - { - if (old_ts.tv_sec > dst->tv_sec || (old_ts.tv_sec == dst->tv_sec && old_ts.tv_usec > dst->tv_usec) ) - *dst = old_ts; - - else - old_ts = *dst; - } - } - else - { //it should be only the normal case i.e. TIMESTAMPMODE_SINGLESYNCHRONIZATION - dst->tv_sec = data->start[0].tv_sec + tmp; - dst->tv_usec = data->start[0].tv_usec + (LONG)((PTime.QuadPart%TimeFreq.QuadPart)*1000000/TimeFreq.QuadPart); - - if (dst->tv_usec >= 1000000) - { - dst->tv_sec ++; - dst->tv_usec -= 1000000; - } - } -} - -// -// inline assembler is not supported with the current AMD64 compilers -// At the moment we simply disable this timestamping mode on AMD64. -// A solution would be to allocate a small memory from the non-paged -// pool, dump the instructions on that buffer, and then execute them. -// The non paged pool is needed since it's the only area of kernel -// data memory that is not subject to the NX protection. -// Or use some lower level trick, like using an assembler to assemble -// a small function for this. -// - -#ifdef __NPF_x86__ -__inline void GetTimeRDTSC(struct timeval *dst, struct time_conv *data) -{ - - ULONGLONG tmp; - __asm - { - push eax - push edx - push ecx - rdtsc - lea ecx, tmp - mov [ecx+4], edx - mov [ecx], eax - pop ecx - pop edx - pop eax - } - - if (data->reference==0) - { - return; - } - dst->tv_sec=(LONG)(tmp/data->reference); - - dst->tv_usec=(LONG)((tmp-dst->tv_sec*data->reference)*1000000/data->reference); - - dst->tv_sec+=data->start[0].tv_sec; - - dst->tv_usec+=data->start[0].tv_usec; - - if (dst->tv_usec>=1000000) - { - dst->tv_sec++; - dst->tv_usec-=1000000; - } - - -} -#endif //__NPF_x86__ - -__inline void GetTimeQST(struct timeval *dst, struct time_conv *data) -{ - LARGE_INTEGER SystemTime; - - KeQuerySystemTime(&SystemTime); - - dst->tv_sec = (LONG)(SystemTime.QuadPart/10000000-11644473600); - dst->tv_usec = (LONG)((SystemTime.QuadPart%10000000)/10); - -} - -#pragma optimize ("g",on) //Due to some weird behaviour of the optimizer of DDK build 2600 - -__inline void GET_TIME(struct timeval *dst, struct time_conv *data) -{ - return; - -#if 0 -// -// This timestamp mode is supported on x86 (32 bit) only -// -#ifdef __NPF_x86__ - if ( TimestampMode == TIMESTAMPMODE_RDTSC ) - { - GetTimeRDTSC(dst,data); - } - else -#endif - if ( TimestampMode == TIMESTAMPMODE_QUERYSYSTEMTIME ) - { - GetTimeQST(dst,data); - } - else - { - GetTimeKQPC(dst,data); - } -#endif -} - - -#else /*WIN_NT_DRIVER*/ - -__inline void FORCE_TIME(struct timeval *src, struct time_conv *dest) -{ - dest->start[0]=*src; -} - -__inline void GET_TIME(struct timeval *dst, struct time_conv *data) -{ - return; - *dst=data->start[0]; -} - -#endif /*WIN_NT_DRIVER*/ - - -#endif /*_time_calls*/ +/* + * Copyright (c) 2001 - 2005 NetGroup, Politecnico di Torino (Italy) + * Copyright (c) 2005 CACE Technologies, Davis (California) + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the Politecnico di Torino, CACE Technologies + * nor the names of its contributors may be used to endorse or promote + * products derived from this software without specific prior written + * permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#ifndef _time_calls +#define _time_calls + +#ifdef WIN_NT_DRIVER + +#include "debug.h" +#include "ndis.h" + +#define DEFAULT_TIMESTAMPMODE 0 + +#define TIMESTAMPMODE_SINGLE_SYNCHRONIZATION 0 +#define TIMESTAMPMODE_SYNCHRONIZATION_ON_CPU_WITH_FIXUP 1 +#define TIMESTAMPMODE_QUERYSYSTEMTIME 2 +#define TIMESTAMPMODE_RDTSC 3 + +#define TIMESTAMPMODE_SYNCHRONIZATION_ON_CPU_NO_FIXUP 99 + +#define TIMESTAMPMODE_REGKEY L"TimestampMode" + +extern ULONG TimestampMode; +extern ULONG NCpu; + +/*! + \brief A microsecond precise timestamp. + + included in the sf_pkthdr or the bpf_hdr that NPF associates with every packet. +*/ + +struct timeval { + long tv_sec; ///< seconds + long tv_usec; ///< microseconds +}; + +#endif /*WIN_NT_DRIVER*/ + +struct time_conv +{ + ULONGLONG reference; + struct timeval start[32]; +}; + +#ifdef WIN_NT_DRIVER + +__inline void TIME_DESYNCHRONIZE(struct time_conv *data) +{ + data->reference = 0; +// data->start.tv_sec = 0; +// data->start.tv_usec = 0; +} + + +__inline void ReadTimeStampModeFromRegistry(PUNICODE_STRING RegistryPath) +{ + ULONG NewLength; + PWSTR NullTerminatedString; + RTL_QUERY_REGISTRY_TABLE Queries[2]; + ULONG DefaultTimestampMode = DEFAULT_TIMESTAMPMODE; + + NewLength = RegistryPath->Length/2; + + NullTerminatedString = ExAllocatePool(PagedPool, (NewLength+1) *sizeof(WCHAR)); + + if (NullTerminatedString != NULL) + { + RtlCopyMemory(NullTerminatedString, RegistryPath->Buffer, RegistryPath->Length); + + NullTerminatedString[NewLength]=0; + + RtlZeroMemory(Queries, sizeof(Queries)); + + Queries[0].Flags = RTL_QUERY_REGISTRY_DIRECT; + Queries[0].Name = TIMESTAMPMODE_REGKEY; + Queries[0].EntryContext = &TimestampMode; + Queries[0].DefaultType = REG_DWORD; + Queries[0].DefaultData = &DefaultTimestampMode; + Queries[0].DefaultLength = sizeof(ULONG); + + if (RtlQueryRegistryValues(RTL_REGISTRY_ABSOLUTE, NullTerminatedString, Queries, NULL, NULL) != STATUS_SUCCESS) + { + TimestampMode = DEFAULT_TIMESTAMPMODE; + } + + RtlWriteRegistryValue( RTL_REGISTRY_ABSOLUTE, NullTerminatedString, TIMESTAMPMODE_REGKEY, REG_DWORD, &TimestampMode,sizeof(ULONG)); + ExFreePool(NullTerminatedString); + } + else + TimestampMode = DEFAULT_TIMESTAMPMODE; +} + +#pragma optimize ("g",off) //Due to some weird behaviour of the optimizer of DDK build 2600 + +/* KeQueryPerformanceCounter TimeStamps */ +__inline void SynchronizeOnCpu(struct timeval *start) +{ +// struct timeval *start = (struct timeval*)Data; + + LARGE_INTEGER SystemTime; + LARGE_INTEGER TimeFreq,PTime; + + // get the absolute value of the system boot time. + + PTime = KeQueryPerformanceCounter(&TimeFreq); + KeQuerySystemTime(&SystemTime); + + start->tv_sec = (LONG)(SystemTime.QuadPart/10000000-11644473600); + + start->tv_usec = (LONG)((SystemTime.QuadPart%10000000)/10); + + start->tv_sec -= (ULONG)(PTime.QuadPart/TimeFreq.QuadPart); + + start->tv_usec -= (LONG)((PTime.QuadPart%TimeFreq.QuadPart)*1000000/TimeFreq.QuadPart); + + if (start->tv_usec < 0) + { + start->tv_sec --; + start->tv_usec += 1000000; + } +} + +// +// inline assembler is not supported with the current AMD64 compilers +// At the moment we simply disable this timestamping mode on AMD64. +// A solution would be to allocate a small memory from the non-paged +// pool, dump the instructions on that buffer, and then execute them. +// The non paged pool is needed since it's the only area of kernel +// data memory that is not subject to the NX protection. +// Or use some lower level trick, like using an assembler to assemble +// a small function for this. +// + +#ifdef __NPF_x86__ +/*RDTSC timestamps */ +/* callers must be at IRQL=PASSIVE_LEVEL*/ +__inline VOID TimeSynchronizeRDTSC(struct time_conv *data) +{ + struct timeval tmp; + LARGE_INTEGER system_time; + ULONGLONG curr_ticks; + KIRQL old; + LARGE_INTEGER start_kqpc,stop_kqpc,start_freq,stop_freq; + ULONGLONG start_ticks,stop_ticks; + ULONGLONG delta,delta2; + KEVENT event; + LARGE_INTEGER i; + ULONGLONG reference; + + if (data->reference!=0) + return; + + KeInitializeEvent(&event,NotificationEvent,FALSE); + + i.QuadPart=-3500000; + + KeRaiseIrql(HIGH_LEVEL,&old); + start_kqpc=KeQueryPerformanceCounter(&start_freq); + __asm + { + push eax + push edx + push ecx + rdtsc + lea ecx, start_ticks + mov [ecx+4], edx + mov [ecx], eax + pop ecx + pop edx + pop eax + } + + KeLowerIrql(old); + + KeWaitForSingleObject(&event,UserRequest,KernelMode,TRUE ,&i); + + KeRaiseIrql(HIGH_LEVEL,&old); + stop_kqpc=KeQueryPerformanceCounter(&stop_freq); + __asm + { + push eax + push edx + push ecx + rdtsc + lea ecx, stop_ticks + mov [ecx+4], edx + mov [ecx], eax + pop ecx + pop edx + pop eax + } + KeLowerIrql(old); + + delta=stop_ticks-start_ticks; + delta2=stop_kqpc.QuadPart-start_kqpc.QuadPart; + if (delta>10000000000) + { + delta/=16; + delta2/=16; + } + + reference=delta*(start_freq.QuadPart)/delta2; + + data->reference=reference/1000; + + if (reference%1000>500) + data->reference++; + + data->reference*=1000; + + reference=data->reference; + + KeQuerySystemTime(&system_time); + + __asm + { + push eax + push edx + push ecx + rdtsc + lea ecx, curr_ticks + mov [ecx+4], edx + mov [ecx], eax + pop ecx + pop edx + pop eax + } + + tmp.tv_sec=-(LONG)(curr_ticks/reference); + + tmp.tv_usec=-(LONG)((curr_ticks%reference)*1000000/reference); + + system_time.QuadPart-=116444736000000000; + + tmp.tv_sec+=(LONG)(system_time.QuadPart/10000000); + tmp.tv_usec+=(LONG)((system_time.QuadPart%10000000)/10); + + if (tmp.tv_usec<0) + { + tmp.tv_sec--; + tmp.tv_usec+=1000000; + } + + data->start[0] = tmp; + + IF_LOUD(DbgPrint("Frequency %I64u MHz\n",data->reference);) +} +#endif //__NPF_x86__ + +#pragma optimize ("g",on) //Due to some weird behaviour of the optimizer of DDK build 2600 + +__inline VOID TIME_SYNCHRONIZE(struct time_conv *data) +{ + ULONG NumberOfCpus, i; + KAFFINITY AffinityMask; + + if (data->reference != 0) + return; + + NumberOfCpus = NCpu; + + if ( TimestampMode == TIMESTAMPMODE_SYNCHRONIZATION_ON_CPU_WITH_FIXUP || TimestampMode == TIMESTAMPMODE_SYNCHRONIZATION_ON_CPU_NO_FIXUP) + { + for (i = 0 ; i < NumberOfCpus ; i++ ) + { + AffinityMask = (1 << i); + ZwSetInformationThread(NtCurrentThread(), ThreadAffinityMask, &AffinityMask, sizeof(KAFFINITY)); + SynchronizeOnCpu(&(data->start[i])); + } + AffinityMask = 0xFFFFFFFF; + ZwSetInformationThread(NtCurrentThread(), ThreadAffinityMask, &AffinityMask, sizeof(KAFFINITY)); + data->reference = 1; + } + else + if ( TimestampMode == TIMESTAMPMODE_QUERYSYSTEMTIME ) + { + //do nothing + data->reference = 1; + } + else +// +// This timestamp mode is supported on x86 (32 bit) only +// +#ifdef __NPF_x86__ + if ( TimestampMode == TIMESTAMPMODE_RDTSC ) + { + TimeSynchronizeRDTSC(data); + } + else +#endif // __NPF_x86__ + { //it should be only the normal case i.e. TIMESTAMPMODE_SINGLESYNCHRONIZATION + SynchronizeOnCpu(data->start); + data->reference = 1; + } + return; +} + + +#pragma optimize ("g",off) //Due to some weird behaviour of the optimizer of DDK build 2600 + +__inline void GetTimeKQPC(struct timeval *dst, struct time_conv *data) +{ + LARGE_INTEGER PTime, TimeFreq; + LONG tmp; + ULONG CurrentCpu; + static struct timeval old_ts={0,0}; + + + PTime = KeQueryPerformanceCounter(&TimeFreq); + tmp = (LONG)(PTime.QuadPart/TimeFreq.QuadPart); + + if (TimestampMode == TIMESTAMPMODE_SYNCHRONIZATION_ON_CPU_WITH_FIXUP || TimestampMode == TIMESTAMPMODE_SYNCHRONIZATION_ON_CPU_NO_FIXUP) + { + //actually this code is ok only if we are guaranteed that no thread scheduling will take place. + CurrentCpu = KeGetCurrentProcessorNumber(); + + dst->tv_sec = data->start[CurrentCpu].tv_sec + tmp; + dst->tv_usec = data->start[CurrentCpu].tv_usec + (LONG)((PTime.QuadPart%TimeFreq.QuadPart)*1000000/TimeFreq.QuadPart); + + if (dst->tv_usec >= 1000000) + { + dst->tv_sec ++; + dst->tv_usec -= 1000000; + } + + if (TimestampMode == TIMESTAMPMODE_SYNCHRONIZATION_ON_CPU_WITH_FIXUP) + { + if (old_ts.tv_sec > dst->tv_sec || (old_ts.tv_sec == dst->tv_sec && old_ts.tv_usec > dst->tv_usec) ) + *dst = old_ts; + + else + old_ts = *dst; + } + } + else + { //it should be only the normal case i.e. TIMESTAMPMODE_SINGLESYNCHRONIZATION + dst->tv_sec = data->start[0].tv_sec + tmp; + dst->tv_usec = data->start[0].tv_usec + (LONG)((PTime.QuadPart%TimeFreq.QuadPart)*1000000/TimeFreq.QuadPart); + + if (dst->tv_usec >= 1000000) + { + dst->tv_sec ++; + dst->tv_usec -= 1000000; + } + } +} + +// +// inline assembler is not supported with the current AMD64 compilers +// At the moment we simply disable this timestamping mode on AMD64. +// A solution would be to allocate a small memory from the non-paged +// pool, dump the instructions on that buffer, and then execute them. +// The non paged pool is needed since it's the only area of kernel +// data memory that is not subject to the NX protection. +// Or use some lower level trick, like using an assembler to assemble +// a small function for this. +// + +#ifdef __NPF_x86__ +__inline void GetTimeRDTSC(struct timeval *dst, struct time_conv *data) +{ + + ULONGLONG tmp; + __asm + { + push eax + push edx + push ecx + rdtsc + lea ecx, tmp + mov [ecx+4], edx + mov [ecx], eax + pop ecx + pop edx + pop eax + } + + if (data->reference==0) + { + return; + } + dst->tv_sec=(LONG)(tmp/data->reference); + + dst->tv_usec=(LONG)((tmp-dst->tv_sec*data->reference)*1000000/data->reference); + + dst->tv_sec+=data->start[0].tv_sec; + + dst->tv_usec+=data->start[0].tv_usec; + + if (dst->tv_usec>=1000000) + { + dst->tv_sec++; + dst->tv_usec-=1000000; + } + + +} +#endif //__NPF_x86__ + +__inline void GetTimeQST(struct timeval *dst, struct time_conv *data) +{ + LARGE_INTEGER SystemTime; + + KeQuerySystemTime(&SystemTime); + + dst->tv_sec = (LONG)(SystemTime.QuadPart/10000000-11644473600); + dst->tv_usec = (LONG)((SystemTime.QuadPart%10000000)/10); + +} + +#pragma optimize ("g",on) //Due to some weird behaviour of the optimizer of DDK build 2600 + +__inline void GET_TIME(struct timeval *dst, struct time_conv *data) +{ + return; + +#if 0 +// +// This timestamp mode is supported on x86 (32 bit) only +// +#ifdef __NPF_x86__ + if ( TimestampMode == TIMESTAMPMODE_RDTSC ) + { + GetTimeRDTSC(dst,data); + } + else +#endif + if ( TimestampMode == TIMESTAMPMODE_QUERYSYSTEMTIME ) + { + GetTimeQST(dst,data); + } + else + { + GetTimeKQPC(dst,data); + } +#endif +} + + +#else /*WIN_NT_DRIVER*/ + +__inline void FORCE_TIME(struct timeval *src, struct time_conv *dest) +{ + dest->start[0]=*src; +} + +__inline void GET_TIME(struct timeval *dst, struct time_conv *data) +{ + return; + *dst=data->start[0]; +} + +#endif /*WIN_NT_DRIVER*/ + + +#endif /*_time_calls*/ diff --git a/src/See/tme.c b/src/See/tme.c index 1e1a6d87..4cb47b1d 100644 --- a/src/See/tme.c +++ b/src/See/tme.c @@ -1,385 +1,385 @@ -/* - * Copyright (c) 2001 - 2003 - * NetGroup, Politecnico di Torino (Italy) - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the Politecnico di Torino nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - */ - -#include - -#include "tme.h" - -/* resizes extended memory */ -uint32 init_extended_memory(uint32 size, MEM_TYPE *mem_ex) -{ - uint8 *tmp; - - if ((mem_ex==NULL)||(mem_ex->buffer==NULL)||(size==0)) - return TME_ERROR; /* awfully never reached!!!! */ - - tmp=mem_ex->buffer; - mem_ex->buffer=NULL; - FREE_MEMORY(tmp); - - ALLOCATE_MEMORY(tmp,uint8,size); - if (tmp==NULL) - return TME_ERROR; /* no memory */ - - mem_ex->size=size; - mem_ex->buffer=tmp; - return TME_SUCCESS; - -} - -/* activates a block of the TME */ -uint32 set_active_tme_block(TME_CORE *tme, uint32 block) -{ - - if ((block>=MAX_TME_DATA_BLOCKS)||(!IS_VALIDATED(tme->validated_blocks,block))) - return TME_ERROR; - tme->active=block; - tme->working=block; - return TME_SUCCESS; - -} - -/* simply inserts default values in a TME block */ -/* it DOESN'T initialize the block in the core!! */ -/* FIXME default values are defined at compile time, */ -/* it will be useful to store them in the registry */ -uint32 init_tme_block(TME_CORE *tme, uint32 block) -{ - - TME_DATA *data; - if (block>=MAX_TME_DATA_BLOCKS) - return TME_ERROR; - data=&(tme->block_data[block]); - tme->working=block; - - ZERO_MEMORY(data,sizeof(TME_DATA)); - - /* entries in LUT */ - data->lut_entries=TME_LUT_ENTRIES_DEFAULT; - /* blocks */ - data->shared_memory_blocks=TME_SHARED_MEMORY_BLOCKS_DEFAULT; - /* block size */ - data->block_size=TME_BLOCK_SIZE_DEFAULT; - /* lookup function */ - data->lookup_code=lut_fcn_mapper(TME_LOOKUP_CODE_DEFAULT); - /* rehashing value */ - data->rehashing_value=TME_REHASHING_VALUE_DEFAULT; - /* out lut function */ - data->out_lut_exec=TME_OUT_LUT_EXEC_DEFAULT; - /* default function */ - data->default_exec=TME_DEFAULT_EXEC_DEFAULT; - /* extra segment size */ - data->extra_segment_size=TME_EXTRA_SEGMENT_SIZE_DEFAULT; - - - data->enable_deletion=FALSE; - data->last_read.tv_sec=0; - data->last_read.tv_usec=0; - return TME_SUCCESS; - -} -/* it validates a TME block and */ -/* (on OK) inserts the block in the core */ -uint32 validate_tme_block(MEM_TYPE *mem_ex, TME_CORE *tme, uint32 block, uint32 mem_ex_offset) -{ - uint32 required_memory; - uint8 *base=mem_ex_offset+mem_ex->buffer; - TME_DATA *data; - - /* FIXME soluzione un po' posticcia... */ - if (mem_ex_offset==0) - return TME_ERROR; - - if (block>=MAX_TME_DATA_BLOCKS) - return TME_ERROR; - data=&tme->block_data[block]; - - if (data->lut_entries==0) - return TME_ERROR; - - if (data->key_len==0) - return TME_ERROR; - - if (data->shared_memory_blocks==0) - return TME_ERROR; - - if (data->block_size==0) - return TME_ERROR; - - /* checks if the lookup function is valid */ - if (data->lookup_code==NULL) - return TME_ERROR; - - /* checks if the out lut exec function is valid */ - if (exec_fcn_mapper(data->out_lut_exec)==NULL) - return TME_ERROR; - - /* checks if the default exec function is valid */ - if (exec_fcn_mapper(data->default_exec)==NULL) - return TME_ERROR; - - /* let's calculate memory needed */ - required_memory=data->lut_entries*sizeof(RECORD); /*LUT*/ - required_memory+=data->block_size*data->shared_memory_blocks; /*shared segment*/ - required_memory+=data->extra_segment_size; /*extra segment*/ - - if (required_memory>(mem_ex->size-mem_ex_offset)) - return TME_ERROR; /*not enough memory*/ - - /* the TME block can be initialized */ - ZERO_MEMORY(base,required_memory); - - data->lut_base_address=base; - - data->shared_memory_base_address= - data->lut_base_address+ - data->lut_entries*sizeof(RECORD); - - data->extra_segment_base_address= - data->shared_memory_base_address+ - data->block_size*data->shared_memory_blocks; - data->filled_blocks=1; - VALIDATE(tme->validated_blocks,block); - tme->active=block; - tme->working=block; - return TME_SUCCESS; -} - -/* I/F between the bpf machine and the callbacks, just some checks */ -uint32 lookup_frontend(MEM_TYPE *mem_ex, TME_CORE *tme,uint32 mem_ex_offset, struct time_conv *time_ref) -{ - if (tme->active==TME_NONE_ACTIVE) - return TME_FALSE; - - return (tme->block_data[tme->active].lookup_code)(mem_ex_offset+mem_ex->buffer,&tme->block_data[tme->active],mem_ex, time_ref); -} - -/* I/F between the bpf machine and the callbacks, just some checks */ -uint32 execute_frontend(MEM_TYPE *mem_ex, TME_CORE *tme, uint32 pkt_size, uint32 offset) -{ - - exec_fcn tmp; - TME_DATA *data; - uint8 *block; - uint8 *mem_data; - - if (tme->active==TME_NONE_ACTIVE) - return TME_ERROR; - - data=&tme->block_data[tme->active]; - - if (data->last_found==NULL) - { /*out lut exec */ - tmp=exec_fcn_mapper(data->out_lut_exec); - block=data->shared_memory_base_address; - } - else - { /*checks if last_found is valid */ - if ((data->last_foundlut_base_address)||(data->last_found>=data->shared_memory_base_address)) - return TME_ERROR; - else - { - tmp=exec_fcn_mapper(SW_ULONG_AT(&((RECORD*)data->last_found)->exec_fcn,0)); - if (tmp==NULL) - return TME_ERROR; - block=SW_ULONG_AT(&((RECORD*)data->last_found)->block,0)+mem_ex->buffer; - if ((blockshared_memory_base_address)||(block>=data->extra_segment_base_address)) - return TME_ERROR; - } - } - - if (offset>=mem_ex->size) - return TME_ERROR; - - mem_data=mem_ex->buffer+offset; - - return tmp(block,pkt_size,data,mem_ex,mem_data); -} - -/*resets all the TME core*/ -uint32 reset_tme(TME_CORE *tme) -{ - if (tme==NULL) - return TME_ERROR; - ZERO_MEMORY(tme, sizeof(TME_CORE)); - return TME_SUCCESS; -} - -/* returns a register value of the active TME block */ -/* FIXME last found in maniera elegante e veloce ?!?! */ -uint32 get_tme_block_register(TME_DATA *data,MEM_TYPE *mem_ex,uint32 rgstr,uint32 *rval) -{ - switch(rgstr) - { - case TME_LUT_ENTRIES: - *rval=data->lut_entries; - return TME_SUCCESS; - case TME_MAX_FILL_STATE: - *rval=data->max_fill_state; - return TME_SUCCESS; - case TME_REHASHING_VALUE: - *rval=data->rehashing_value; - return TME_SUCCESS; - case TME_KEY_LEN: - *rval=data->key_len; - return TME_SUCCESS; - case TME_SHARED_MEMORY_BLOCKS: - *rval=data->shared_memory_blocks; - return TME_SUCCESS; - case TME_FILLED_ENTRIES: - *rval=data->filled_entries; - return TME_SUCCESS; - case TME_BLOCK_SIZE: - *rval=data->block_size; - return TME_SUCCESS; - case TME_EXTRA_SEGMENT_SIZE: - *rval=data->extra_segment_size; - return TME_SUCCESS; - case TME_FILLED_BLOCKS: - *rval=data->filled_blocks; - return TME_SUCCESS; - case TME_DEFAULT_EXEC: - *rval=data->default_exec; - return TME_SUCCESS; - case TME_OUT_LUT_EXEC: - *rval=data->out_lut_exec; - return TME_SUCCESS; - case TME_SHARED_MEMORY_BASE_ADDRESS: - *rval=data->shared_memory_base_address-mem_ex->buffer; - return TME_SUCCESS; - case TME_LUT_BASE_ADDRESS: - *rval=data->lut_base_address-mem_ex->buffer; - return TME_SUCCESS; - case TME_EXTRA_SEGMENT_BASE_ADDRESS: - *rval=data->extra_segment_base_address-mem_ex->buffer; - return TME_SUCCESS; - case TME_LAST_FOUND_BLOCK: - if (data->last_found==NULL) - *rval=0; - else - *rval=data->last_found-mem_ex->buffer; - return TME_SUCCESS; - - default: - return TME_ERROR; - } -} - -/* sets a register value in the active block */ -/* FIXME last found in maniera elegante e veloce ?!?! */ -uint32 set_tme_block_register(TME_DATA *data,MEM_TYPE *mem_ex,uint32 rgstr,uint32 value, int32 init) -{ /* very very very dangerous!!!!!!!!!!! */ - lut_fcn tmp; - switch(rgstr) - { - case TME_MAX_FILL_STATE: - data->max_fill_state=value; - return TME_SUCCESS; - case TME_REHASHING_VALUE: - data->rehashing_value=value; - return TME_SUCCESS; - case TME_FILLED_ENTRIES: - data->filled_entries=value; - return TME_SUCCESS; - case TME_FILLED_BLOCKS: - if (value<=data->shared_memory_blocks) - { - data->filled_blocks=value; - return TME_SUCCESS; - } - else - return TME_ERROR; - case TME_DEFAULT_EXEC: - data->default_exec=value; - return TME_SUCCESS; - case TME_OUT_LUT_EXEC: - data->out_lut_exec=value; - return TME_SUCCESS; - case TME_LOOKUP_CODE: - tmp=lut_fcn_mapper(value); - if (tmp==NULL) - return TME_ERROR; - else - data->lookup_code=tmp; - return TME_SUCCESS; - default: - break; - } - - if (init) - switch (rgstr) - { - - case TME_LUT_ENTRIES: - data->lut_entries=value; - return TME_SUCCESS; - case TME_KEY_LEN: - data->key_len=value; - return TME_SUCCESS; - case TME_SHARED_MEMORY_BLOCKS: - data->shared_memory_blocks=value; - return TME_SUCCESS; - case TME_BLOCK_SIZE: - data->block_size=value; - return TME_SUCCESS; - case TME_EXTRA_SEGMENT_SIZE: - data->extra_segment_size=value; - return TME_SUCCESS; - default: - return TME_ERROR; - } - else - return TME_ERROR; - -} - -/* chooses the TME block for read */ -uint32 set_active_read_tme_block(TME_CORE *tme, uint32 block) -{ - - if ((block>=MAX_TME_DATA_BLOCKS)||(!IS_VALIDATED(tme->validated_blocks,block))) - return TME_ERROR; - tme->active_read=block; - return TME_SUCCESS; - -} - -/* chooses if the autodeletion must be used */ -uint32 set_autodeletion(TME_DATA *data, uint32 value) -{ - if (value==0) /* no autodeletion */ - data->enable_deletion=FALSE; - else - data->enable_deletion=TRUE; - - return TME_SUCCESS; -} +/* + * Copyright (c) 2001 - 2003 + * NetGroup, Politecnico di Torino (Italy) + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the Politecnico di Torino nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#include + +#include "tme.h" + +/* resizes extended memory */ +uint32 init_extended_memory(uint32 size, MEM_TYPE *mem_ex) +{ + uint8 *tmp; + + if ((mem_ex==NULL)||(mem_ex->buffer==NULL)||(size==0)) + return TME_ERROR; /* awfully never reached!!!! */ + + tmp=mem_ex->buffer; + mem_ex->buffer=NULL; + FREE_MEMORY(tmp); + + ALLOCATE_MEMORY(tmp,uint8,size); + if (tmp==NULL) + return TME_ERROR; /* no memory */ + + mem_ex->size=size; + mem_ex->buffer=tmp; + return TME_SUCCESS; + +} + +/* activates a block of the TME */ +uint32 set_active_tme_block(TME_CORE *tme, uint32 block) +{ + + if ((block>=MAX_TME_DATA_BLOCKS)||(!IS_VALIDATED(tme->validated_blocks,block))) + return TME_ERROR; + tme->active=block; + tme->working=block; + return TME_SUCCESS; + +} + +/* simply inserts default values in a TME block */ +/* it DOESN'T initialize the block in the core!! */ +/* FIXME default values are defined at compile time, */ +/* it will be useful to store them in the registry */ +uint32 init_tme_block(TME_CORE *tme, uint32 block) +{ + + TME_DATA *data; + if (block>=MAX_TME_DATA_BLOCKS) + return TME_ERROR; + data=&(tme->block_data[block]); + tme->working=block; + + ZERO_MEMORY(data,sizeof(TME_DATA)); + + /* entries in LUT */ + data->lut_entries=TME_LUT_ENTRIES_DEFAULT; + /* blocks */ + data->shared_memory_blocks=TME_SHARED_MEMORY_BLOCKS_DEFAULT; + /* block size */ + data->block_size=TME_BLOCK_SIZE_DEFAULT; + /* lookup function */ + data->lookup_code=lut_fcn_mapper(TME_LOOKUP_CODE_DEFAULT); + /* rehashing value */ + data->rehashing_value=TME_REHASHING_VALUE_DEFAULT; + /* out lut function */ + data->out_lut_exec=TME_OUT_LUT_EXEC_DEFAULT; + /* default function */ + data->default_exec=TME_DEFAULT_EXEC_DEFAULT; + /* extra segment size */ + data->extra_segment_size=TME_EXTRA_SEGMENT_SIZE_DEFAULT; + + + data->enable_deletion=FALSE; + data->last_read.tv_sec=0; + data->last_read.tv_usec=0; + return TME_SUCCESS; + +} +/* it validates a TME block and */ +/* (on OK) inserts the block in the core */ +uint32 validate_tme_block(MEM_TYPE *mem_ex, TME_CORE *tme, uint32 block, uint32 mem_ex_offset) +{ + uint32 required_memory; + uint8 *base=mem_ex_offset+mem_ex->buffer; + TME_DATA *data; + + /* FIXME soluzione un po' posticcia... */ + if (mem_ex_offset==0) + return TME_ERROR; + + if (block>=MAX_TME_DATA_BLOCKS) + return TME_ERROR; + data=&tme->block_data[block]; + + if (data->lut_entries==0) + return TME_ERROR; + + if (data->key_len==0) + return TME_ERROR; + + if (data->shared_memory_blocks==0) + return TME_ERROR; + + if (data->block_size==0) + return TME_ERROR; + + /* checks if the lookup function is valid */ + if (data->lookup_code==NULL) + return TME_ERROR; + + /* checks if the out lut exec function is valid */ + if (exec_fcn_mapper(data->out_lut_exec)==NULL) + return TME_ERROR; + + /* checks if the default exec function is valid */ + if (exec_fcn_mapper(data->default_exec)==NULL) + return TME_ERROR; + + /* let's calculate memory needed */ + required_memory=data->lut_entries*sizeof(RECORD); /*LUT*/ + required_memory+=data->block_size*data->shared_memory_blocks; /*shared segment*/ + required_memory+=data->extra_segment_size; /*extra segment*/ + + if (required_memory>(mem_ex->size-mem_ex_offset)) + return TME_ERROR; /*not enough memory*/ + + /* the TME block can be initialized */ + ZERO_MEMORY(base,required_memory); + + data->lut_base_address=base; + + data->shared_memory_base_address= + data->lut_base_address+ + data->lut_entries*sizeof(RECORD); + + data->extra_segment_base_address= + data->shared_memory_base_address+ + data->block_size*data->shared_memory_blocks; + data->filled_blocks=1; + VALIDATE(tme->validated_blocks,block); + tme->active=block; + tme->working=block; + return TME_SUCCESS; +} + +/* I/F between the bpf machine and the callbacks, just some checks */ +uint32 lookup_frontend(MEM_TYPE *mem_ex, TME_CORE *tme,uint32 mem_ex_offset, struct time_conv *time_ref) +{ + if (tme->active==TME_NONE_ACTIVE) + return TME_FALSE; + + return (tme->block_data[tme->active].lookup_code)(mem_ex_offset+mem_ex->buffer,&tme->block_data[tme->active],mem_ex, time_ref); +} + +/* I/F between the bpf machine and the callbacks, just some checks */ +uint32 execute_frontend(MEM_TYPE *mem_ex, TME_CORE *tme, uint32 pkt_size, uint32 offset) +{ + + exec_fcn tmp; + TME_DATA *data; + uint8 *block; + uint8 *mem_data; + + if (tme->active==TME_NONE_ACTIVE) + return TME_ERROR; + + data=&tme->block_data[tme->active]; + + if (data->last_found==NULL) + { /*out lut exec */ + tmp=exec_fcn_mapper(data->out_lut_exec); + block=data->shared_memory_base_address; + } + else + { /*checks if last_found is valid */ + if ((data->last_foundlut_base_address)||(data->last_found>=data->shared_memory_base_address)) + return TME_ERROR; + else + { + tmp=exec_fcn_mapper(SW_ULONG_AT(&((RECORD*)data->last_found)->exec_fcn,0)); + if (tmp==NULL) + return TME_ERROR; + block=SW_ULONG_AT(&((RECORD*)data->last_found)->block,0)+mem_ex->buffer; + if ((blockshared_memory_base_address)||(block>=data->extra_segment_base_address)) + return TME_ERROR; + } + } + + if (offset>=mem_ex->size) + return TME_ERROR; + + mem_data=mem_ex->buffer+offset; + + return tmp(block,pkt_size,data,mem_ex,mem_data); +} + +/*resets all the TME core*/ +uint32 reset_tme(TME_CORE *tme) +{ + if (tme==NULL) + return TME_ERROR; + ZERO_MEMORY(tme, sizeof(TME_CORE)); + return TME_SUCCESS; +} + +/* returns a register value of the active TME block */ +/* FIXME last found in maniera elegante e veloce ?!?! */ +uint32 get_tme_block_register(TME_DATA *data,MEM_TYPE *mem_ex,uint32 rgstr,uint32 *rval) +{ + switch(rgstr) + { + case TME_LUT_ENTRIES: + *rval=data->lut_entries; + return TME_SUCCESS; + case TME_MAX_FILL_STATE: + *rval=data->max_fill_state; + return TME_SUCCESS; + case TME_REHASHING_VALUE: + *rval=data->rehashing_value; + return TME_SUCCESS; + case TME_KEY_LEN: + *rval=data->key_len; + return TME_SUCCESS; + case TME_SHARED_MEMORY_BLOCKS: + *rval=data->shared_memory_blocks; + return TME_SUCCESS; + case TME_FILLED_ENTRIES: + *rval=data->filled_entries; + return TME_SUCCESS; + case TME_BLOCK_SIZE: + *rval=data->block_size; + return TME_SUCCESS; + case TME_EXTRA_SEGMENT_SIZE: + *rval=data->extra_segment_size; + return TME_SUCCESS; + case TME_FILLED_BLOCKS: + *rval=data->filled_blocks; + return TME_SUCCESS; + case TME_DEFAULT_EXEC: + *rval=data->default_exec; + return TME_SUCCESS; + case TME_OUT_LUT_EXEC: + *rval=data->out_lut_exec; + return TME_SUCCESS; + case TME_SHARED_MEMORY_BASE_ADDRESS: + *rval=data->shared_memory_base_address-mem_ex->buffer; + return TME_SUCCESS; + case TME_LUT_BASE_ADDRESS: + *rval=data->lut_base_address-mem_ex->buffer; + return TME_SUCCESS; + case TME_EXTRA_SEGMENT_BASE_ADDRESS: + *rval=data->extra_segment_base_address-mem_ex->buffer; + return TME_SUCCESS; + case TME_LAST_FOUND_BLOCK: + if (data->last_found==NULL) + *rval=0; + else + *rval=data->last_found-mem_ex->buffer; + return TME_SUCCESS; + + default: + return TME_ERROR; + } +} + +/* sets a register value in the active block */ +/* FIXME last found in maniera elegante e veloce ?!?! */ +uint32 set_tme_block_register(TME_DATA *data,MEM_TYPE *mem_ex,uint32 rgstr,uint32 value, int32 init) +{ /* very very very dangerous!!!!!!!!!!! */ + lut_fcn tmp; + switch(rgstr) + { + case TME_MAX_FILL_STATE: + data->max_fill_state=value; + return TME_SUCCESS; + case TME_REHASHING_VALUE: + data->rehashing_value=value; + return TME_SUCCESS; + case TME_FILLED_ENTRIES: + data->filled_entries=value; + return TME_SUCCESS; + case TME_FILLED_BLOCKS: + if (value<=data->shared_memory_blocks) + { + data->filled_blocks=value; + return TME_SUCCESS; + } + else + return TME_ERROR; + case TME_DEFAULT_EXEC: + data->default_exec=value; + return TME_SUCCESS; + case TME_OUT_LUT_EXEC: + data->out_lut_exec=value; + return TME_SUCCESS; + case TME_LOOKUP_CODE: + tmp=lut_fcn_mapper(value); + if (tmp==NULL) + return TME_ERROR; + else + data->lookup_code=tmp; + return TME_SUCCESS; + default: + break; + } + + if (init) + switch (rgstr) + { + + case TME_LUT_ENTRIES: + data->lut_entries=value; + return TME_SUCCESS; + case TME_KEY_LEN: + data->key_len=value; + return TME_SUCCESS; + case TME_SHARED_MEMORY_BLOCKS: + data->shared_memory_blocks=value; + return TME_SUCCESS; + case TME_BLOCK_SIZE: + data->block_size=value; + return TME_SUCCESS; + case TME_EXTRA_SEGMENT_SIZE: + data->extra_segment_size=value; + return TME_SUCCESS; + default: + return TME_ERROR; + } + else + return TME_ERROR; + +} + +/* chooses the TME block for read */ +uint32 set_active_read_tme_block(TME_CORE *tme, uint32 block) +{ + + if ((block>=MAX_TME_DATA_BLOCKS)||(!IS_VALIDATED(tme->validated_blocks,block))) + return TME_ERROR; + tme->active_read=block; + return TME_SUCCESS; + +} + +/* chooses if the autodeletion must be used */ +uint32 set_autodeletion(TME_DATA *data, uint32 value) +{ + if (value==0) /* no autodeletion */ + data->enable_deletion=FALSE; + else + data->enable_deletion=TRUE; + + return TME_SUCCESS; +} diff --git a/src/See/tme.h b/src/See/tme.h index eb8d4b12..6b3b6734 100644 --- a/src/See/tme.h +++ b/src/See/tme.h @@ -1,174 +1,174 @@ -/* - * Copyright (c) 2001 - 2003 - * NetGroup, Politecnico di Torino (Italy) - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the Politecnico di Torino nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - */ - -#ifndef __tme_include_ -#define __tme_include_ - -#ifdef WIN_NT_DRIVER -#include "ndis.h" -#else -#include -#endif /*WIN_NT_DRIVER*/ - -#include "memory_t.h" -#include "time_calls.h" - - -/* error codes */ -#define TME_ERROR 0 -#define TME_SUCCESS 1 -#define TME_TRUE 2 -#define TME_FALSE 3 - -/* some constants */ -#define DEFAULT_MEM_EX_SIZE 65536 -#define MAX_TME_DATA_BLOCKS 4 -#define TME_NONE_ACTIVE 0xffffffff -#define DELTA_READ 2 /* secs */ - -#define TME_LUT_ENTRIES 0x00000000 -#define TME_MAX_FILL_STATE 0x00000001 /*potrebbe servire per un thread a passive level!?!?! */ -#define TME_REHASHING_VALUE 0x00000002 -#define TME_KEY_LEN 0x00000003 -#define TME_SHARED_MEMORY_BLOCKS 0x00000004 -#define TME_FILLED_ENTRIES 0x00000005 -#define TME_BLOCK_SIZE 0x00000006 -#define TME_EXTRA_SEGMENT_SIZE 0x00000007 -#define TME_LOOKUP_CODE 0x00000008 -#define TME_OUT_LUT_EXEC 0x00000009 -#define TME_FILLED_BLOCKS 0x0000000a -#define TME_DEFAULT_EXEC 0x0000000b -#define TME_LUT_BASE_ADDRESS 0x0000000c -#define TME_SHARED_MEMORY_BASE_ADDRESS 0x0000000d -#define TME_EXTRA_SEGMENT_BASE_ADDRESS 0x0000000e -#define TME_LAST_FOUND 0x0000000f /* contains the offset of the last found entry */ -#define TME_LAST_FOUND_BLOCK 0x00000010 -/* TME default values */ -#define TME_LUT_ENTRIES_DEFAULT 32007 -#define TME_REHASHING_VALUE_DEFAULT 1 -#define TME_SHARED_MEMORY_BLOCKS_DEFAULT 16000 -#define TME_BLOCK_SIZE_DEFAULT 64 -#define TME_EXTRA_SEGMENT_SIZE_DEFAULT 0 -#define TME_LOOKUP_CODE_DEFAULT 0 -#define TME_OUT_LUT_EXEC_DEFAULT 0 -#define TME_DEFAULT_EXEC_DEFAULT 0 -#define TME_MAX_FILL_STATE_DEFAULT 15000 - -#define IS_VALIDATED(src,index) (src&(1<tv_sec=0x7fffffff; - -/* TME callback prototypes */ -typedef uint32 (*lut_fcn)(uint8 *key, struct __TME_DATA *data,MEM_TYPE *mem_ex, struct time_conv *time_ref ); -typedef uint32 (*exec_fcn)(uint8 *block, uint32 pkt_size, struct __TME_DATA *data, MEM_TYPE *mem_ex, uint8 *mem_data); - -/* DO NOT MODIFY THIS STRUCTURE!!!! GV */ -typedef struct __RECORD - -{ - uint32 block; - uint32 exec_fcn; -} - RECORD, *PRECORD; - -/* TME data registers */ -struct __TME_DATA -{ - uint32 lut_entries; - uint32 max_fill_state; - uint32 rehashing_value; - uint32 key_len; - uint32 shared_memory_blocks; - uint32 filled_entries; - uint32 block_size; - uint32 extra_segment_size; - uint32 filled_blocks; - lut_fcn lookup_code; - uint32 default_exec; - uint32 out_lut_exec; - uint8 *lut_base_address; - uint8 *shared_memory_base_address; - uint8 *extra_segment_base_address; - struct timeval last_read; - uint32 enable_deletion; - uint8 *last_found; -}; - -typedef struct __TME_DATA TME_DATA,*PTME_DATA; - - - -/* TME core */ -typedef struct __TME_CORE -{ - uint32 working; - uint32 active; - uint32 validated_blocks; - TME_DATA block_data[MAX_TME_DATA_BLOCKS]; - uint32 active_read; - -} TME_CORE, *PTME_CORE; - -static __inline int32 IS_DELETABLE(void *timestamp, TME_DATA *data) -{ - struct timeval *ts=(struct timeval*)timestamp; - - if (data->enable_deletion==FALSE) - return FALSE; - if (data->filled_entriesmax_fill_state) - return FALSE; - if ((ts->tv_sec+DELTA_READ)last_read.tv_sec) - return TRUE; - return FALSE; -} - -/* functions to manage TME */ -uint32 init_tme_block(TME_CORE *tme, uint32 block); -uint32 validate_tme_block(MEM_TYPE *mem_ex, TME_CORE *tme, uint32 block, uint32 mem_ex_offset); -uint32 lookup_frontend(MEM_TYPE *mem_ex, TME_CORE *tme,uint32 mem_ex_offset, struct time_conv *time_ref); -uint32 execute_frontend(MEM_TYPE *mem_ex, TME_CORE *tme, uint32 pkt_size,uint32 offset); -uint32 set_active_tme_block(TME_CORE *tme, uint32 block); -uint32 init_extended_memory(uint32 size, MEM_TYPE *mem_ex); -uint32 reset_tme(TME_CORE *tme); -uint32 get_tme_block_register(TME_DATA *data,MEM_TYPE *mem_ex,uint32 rgstr,uint32 *rval); -uint32 set_tme_block_register(TME_DATA *data,MEM_TYPE *mem_ex,uint32 rgstr,uint32 value, int32 init); -uint32 set_active_read_tme_block(TME_CORE *tme, uint32 block); -uint32 set_autodeletion(TME_DATA *data, uint32 value); - -/* function mappers */ -lut_fcn lut_fcn_mapper(uint32 index); -exec_fcn exec_fcn_mapper(uint32 index); - -#endif +/* + * Copyright (c) 2001 - 2003 + * NetGroup, Politecnico di Torino (Italy) + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the Politecnico di Torino nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#ifndef __tme_include_ +#define __tme_include_ + +#ifdef WIN_NT_DRIVER +#include "ndis.h" +#else +#include +#endif /*WIN_NT_DRIVER*/ + +#include "memory_t.h" +#include "time_calls.h" + + +/* error codes */ +#define TME_ERROR 0 +#define TME_SUCCESS 1 +#define TME_TRUE 2 +#define TME_FALSE 3 + +/* some constants */ +#define DEFAULT_MEM_EX_SIZE 65536 +#define MAX_TME_DATA_BLOCKS 4 +#define TME_NONE_ACTIVE 0xffffffff +#define DELTA_READ 2 /* secs */ + +#define TME_LUT_ENTRIES 0x00000000 +#define TME_MAX_FILL_STATE 0x00000001 /*potrebbe servire per un thread a passive level!?!?! */ +#define TME_REHASHING_VALUE 0x00000002 +#define TME_KEY_LEN 0x00000003 +#define TME_SHARED_MEMORY_BLOCKS 0x00000004 +#define TME_FILLED_ENTRIES 0x00000005 +#define TME_BLOCK_SIZE 0x00000006 +#define TME_EXTRA_SEGMENT_SIZE 0x00000007 +#define TME_LOOKUP_CODE 0x00000008 +#define TME_OUT_LUT_EXEC 0x00000009 +#define TME_FILLED_BLOCKS 0x0000000a +#define TME_DEFAULT_EXEC 0x0000000b +#define TME_LUT_BASE_ADDRESS 0x0000000c +#define TME_SHARED_MEMORY_BASE_ADDRESS 0x0000000d +#define TME_EXTRA_SEGMENT_BASE_ADDRESS 0x0000000e +#define TME_LAST_FOUND 0x0000000f /* contains the offset of the last found entry */ +#define TME_LAST_FOUND_BLOCK 0x00000010 +/* TME default values */ +#define TME_LUT_ENTRIES_DEFAULT 32007 +#define TME_REHASHING_VALUE_DEFAULT 1 +#define TME_SHARED_MEMORY_BLOCKS_DEFAULT 16000 +#define TME_BLOCK_SIZE_DEFAULT 64 +#define TME_EXTRA_SEGMENT_SIZE_DEFAULT 0 +#define TME_LOOKUP_CODE_DEFAULT 0 +#define TME_OUT_LUT_EXEC_DEFAULT 0 +#define TME_DEFAULT_EXEC_DEFAULT 0 +#define TME_MAX_FILL_STATE_DEFAULT 15000 + +#define IS_VALIDATED(src,index) (src&(1<tv_sec=0x7fffffff; + +/* TME callback prototypes */ +typedef uint32 (*lut_fcn)(uint8 *key, struct __TME_DATA *data,MEM_TYPE *mem_ex, struct time_conv *time_ref ); +typedef uint32 (*exec_fcn)(uint8 *block, uint32 pkt_size, struct __TME_DATA *data, MEM_TYPE *mem_ex, uint8 *mem_data); + +/* DO NOT MODIFY THIS STRUCTURE!!!! GV */ +typedef struct __RECORD + +{ + uint32 block; + uint32 exec_fcn; +} + RECORD, *PRECORD; + +/* TME data registers */ +struct __TME_DATA +{ + uint32 lut_entries; + uint32 max_fill_state; + uint32 rehashing_value; + uint32 key_len; + uint32 shared_memory_blocks; + uint32 filled_entries; + uint32 block_size; + uint32 extra_segment_size; + uint32 filled_blocks; + lut_fcn lookup_code; + uint32 default_exec; + uint32 out_lut_exec; + uint8 *lut_base_address; + uint8 *shared_memory_base_address; + uint8 *extra_segment_base_address; + struct timeval last_read; + uint32 enable_deletion; + uint8 *last_found; +}; + +typedef struct __TME_DATA TME_DATA,*PTME_DATA; + + + +/* TME core */ +typedef struct __TME_CORE +{ + uint32 working; + uint32 active; + uint32 validated_blocks; + TME_DATA block_data[MAX_TME_DATA_BLOCKS]; + uint32 active_read; + +} TME_CORE, *PTME_CORE; + +static __inline int32 IS_DELETABLE(void *timestamp, TME_DATA *data) +{ + struct timeval *ts=(struct timeval*)timestamp; + + if (data->enable_deletion==FALSE) + return FALSE; + if (data->filled_entriesmax_fill_state) + return FALSE; + if ((ts->tv_sec+DELTA_READ)last_read.tv_sec) + return TRUE; + return FALSE; +} + +/* functions to manage TME */ +uint32 init_tme_block(TME_CORE *tme, uint32 block); +uint32 validate_tme_block(MEM_TYPE *mem_ex, TME_CORE *tme, uint32 block, uint32 mem_ex_offset); +uint32 lookup_frontend(MEM_TYPE *mem_ex, TME_CORE *tme,uint32 mem_ex_offset, struct time_conv *time_ref); +uint32 execute_frontend(MEM_TYPE *mem_ex, TME_CORE *tme, uint32 pkt_size,uint32 offset); +uint32 set_active_tme_block(TME_CORE *tme, uint32 block); +uint32 init_extended_memory(uint32 size, MEM_TYPE *mem_ex); +uint32 reset_tme(TME_CORE *tme); +uint32 get_tme_block_register(TME_DATA *data,MEM_TYPE *mem_ex,uint32 rgstr,uint32 *rval); +uint32 set_tme_block_register(TME_DATA *data,MEM_TYPE *mem_ex,uint32 rgstr,uint32 value, int32 init); +uint32 set_active_read_tme_block(TME_CORE *tme, uint32 block); +uint32 set_autodeletion(TME_DATA *data, uint32 value); + +/* function mappers */ +lut_fcn lut_fcn_mapper(uint32 index); +exec_fcn exec_fcn_mapper(uint32 index); + +#endif diff --git a/src/See/valid_insns.h b/src/See/valid_insns.h index f0361021..0092faa9 100644 --- a/src/See/valid_insns.h +++ b/src/See/valid_insns.h @@ -1,117 +1,117 @@ -/* - * Copyright (c) 2001 - 2005 NetGroup, Politecnico di Torino (Italy) - * Copyright (c) 2005 CACE Technologies, Davis (California) - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the Politecnico di Torino, CACE Technologies - * nor the names of its contributors may be used to endorse or promote - * products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - */ - -u_short valid_instructions[]= - { - BPF_RET|BPF_K, - BPF_RET|BPF_A, - BPF_LD|BPF_IMM, - BPF_LDX|BPF_IMM, - BPF_LD|BPF_MEM, - BPF_LDX|BPF_MEM, - -#ifdef __NPF_x86__ - BPF_LD|BPF_MEM_EX_IMM|BPF_B, - BPF_LD|BPF_MEM_EX_IMM|BPF_H, - BPF_LD|BPF_MEM_EX_IMM|BPF_W, - BPF_LD|BPF_MEM_EX_IND|BPF_B, - BPF_LD|BPF_MEM_EX_IND|BPF_H, - BPF_LD|BPF_MEM_EX_IND|BPF_W, -#endif - BPF_LD|BPF_W|BPF_ABS, - BPF_LD|BPF_H|BPF_ABS, - BPF_LD|BPF_B|BPF_ABS, - BPF_LDX|BPF_W|BPF_ABS, - BPF_LDX|BPF_H|BPF_ABS, - BPF_LDX|BPF_B|BPF_ABS, - BPF_LD|BPF_W|BPF_LEN, - BPF_LDX|BPF_W|BPF_LEN, - BPF_LD|BPF_W|BPF_IND, - BPF_LD|BPF_H|BPF_IND, - BPF_LD|BPF_B|BPF_IND, - BPF_LDX|BPF_MSH|BPF_B, - BPF_ST, - BPF_STX, - -#ifdef __NPF_x86__ - BPF_ST|BPF_MEM_EX_IMM|BPF_B, - BPF_STX|BPF_MEM_EX_IMM|BPF_B, - BPF_ST|BPF_MEM_EX_IMM|BPF_W, - BPF_STX|BPF_MEM_EX_IMM|BPF_W, - BPF_ST|BPF_MEM_EX_IMM|BPF_H, - BPF_STX|BPF_MEM_EX_IMM|BPF_H, - BPF_ST|BPF_MEM_EX_IND|BPF_B, - BPF_ST|BPF_MEM_EX_IND|BPF_W, - BPF_ST|BPF_MEM_EX_IND|BPF_H, -#endif - - BPF_JMP|BPF_JA, - BPF_JMP|BPF_JGT|BPF_K, - BPF_JMP|BPF_JGE|BPF_K, - BPF_JMP|BPF_JEQ|BPF_K, - BPF_JMP|BPF_JSET|BPF_K, - BPF_JMP|BPF_JGT|BPF_X, - BPF_JMP|BPF_JGE|BPF_X, - BPF_JMP|BPF_JEQ|BPF_X, - BPF_JMP|BPF_JSET|BPF_X, - BPF_ALU|BPF_ADD|BPF_X, - BPF_ALU|BPF_SUB|BPF_X, - BPF_ALU|BPF_MUL|BPF_X, - BPF_ALU|BPF_DIV|BPF_X, - BPF_ALU|BPF_AND|BPF_X, - BPF_ALU|BPF_OR|BPF_X, - BPF_ALU|BPF_LSH|BPF_X, - BPF_ALU|BPF_RSH|BPF_X, - BPF_ALU|BPF_ADD|BPF_K, - BPF_ALU|BPF_SUB|BPF_K, - BPF_ALU|BPF_MUL|BPF_K, - BPF_ALU|BPF_DIV|BPF_K, - BPF_ALU|BPF_AND|BPF_K, - BPF_ALU|BPF_OR|BPF_K, - BPF_ALU|BPF_LSH|BPF_K, - BPF_ALU|BPF_RSH|BPF_K, - BPF_ALU|BPF_NEG, - BPF_MISC|BPF_TAX, - BPF_MISC|BPF_TXA, - -#ifdef __NPF_x86__ - BPF_MISC|BPF_TME|BPF_LOOKUP, - BPF_MISC|BPF_TME|BPF_EXECUTE, - BPF_MISC|BPF_TME|BPF_SET_ACTIVE, - BPF_MISC|BPF_TME|BPF_GET_REGISTER_VALUE, - BPF_MISC|BPF_TME|BPF_SET_REGISTER_VALUE -#endif - - }; - -#define VALID_INSTRUCTIONS_LEN (sizeof(valid_instructions)/sizeof(u_short)) +/* + * Copyright (c) 2001 - 2005 NetGroup, Politecnico di Torino (Italy) + * Copyright (c) 2005 CACE Technologies, Davis (California) + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the Politecnico di Torino, CACE Technologies + * nor the names of its contributors may be used to endorse or promote + * products derived from this software without specific prior written + * permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +u_short valid_instructions[]= + { + BPF_RET|BPF_K, + BPF_RET|BPF_A, + BPF_LD|BPF_IMM, + BPF_LDX|BPF_IMM, + BPF_LD|BPF_MEM, + BPF_LDX|BPF_MEM, + +#ifdef __NPF_x86__ + BPF_LD|BPF_MEM_EX_IMM|BPF_B, + BPF_LD|BPF_MEM_EX_IMM|BPF_H, + BPF_LD|BPF_MEM_EX_IMM|BPF_W, + BPF_LD|BPF_MEM_EX_IND|BPF_B, + BPF_LD|BPF_MEM_EX_IND|BPF_H, + BPF_LD|BPF_MEM_EX_IND|BPF_W, +#endif + BPF_LD|BPF_W|BPF_ABS, + BPF_LD|BPF_H|BPF_ABS, + BPF_LD|BPF_B|BPF_ABS, + BPF_LDX|BPF_W|BPF_ABS, + BPF_LDX|BPF_H|BPF_ABS, + BPF_LDX|BPF_B|BPF_ABS, + BPF_LD|BPF_W|BPF_LEN, + BPF_LDX|BPF_W|BPF_LEN, + BPF_LD|BPF_W|BPF_IND, + BPF_LD|BPF_H|BPF_IND, + BPF_LD|BPF_B|BPF_IND, + BPF_LDX|BPF_MSH|BPF_B, + BPF_ST, + BPF_STX, + +#ifdef __NPF_x86__ + BPF_ST|BPF_MEM_EX_IMM|BPF_B, + BPF_STX|BPF_MEM_EX_IMM|BPF_B, + BPF_ST|BPF_MEM_EX_IMM|BPF_W, + BPF_STX|BPF_MEM_EX_IMM|BPF_W, + BPF_ST|BPF_MEM_EX_IMM|BPF_H, + BPF_STX|BPF_MEM_EX_IMM|BPF_H, + BPF_ST|BPF_MEM_EX_IND|BPF_B, + BPF_ST|BPF_MEM_EX_IND|BPF_W, + BPF_ST|BPF_MEM_EX_IND|BPF_H, +#endif + + BPF_JMP|BPF_JA, + BPF_JMP|BPF_JGT|BPF_K, + BPF_JMP|BPF_JGE|BPF_K, + BPF_JMP|BPF_JEQ|BPF_K, + BPF_JMP|BPF_JSET|BPF_K, + BPF_JMP|BPF_JGT|BPF_X, + BPF_JMP|BPF_JGE|BPF_X, + BPF_JMP|BPF_JEQ|BPF_X, + BPF_JMP|BPF_JSET|BPF_X, + BPF_ALU|BPF_ADD|BPF_X, + BPF_ALU|BPF_SUB|BPF_X, + BPF_ALU|BPF_MUL|BPF_X, + BPF_ALU|BPF_DIV|BPF_X, + BPF_ALU|BPF_AND|BPF_X, + BPF_ALU|BPF_OR|BPF_X, + BPF_ALU|BPF_LSH|BPF_X, + BPF_ALU|BPF_RSH|BPF_X, + BPF_ALU|BPF_ADD|BPF_K, + BPF_ALU|BPF_SUB|BPF_K, + BPF_ALU|BPF_MUL|BPF_K, + BPF_ALU|BPF_DIV|BPF_K, + BPF_ALU|BPF_AND|BPF_K, + BPF_ALU|BPF_OR|BPF_K, + BPF_ALU|BPF_LSH|BPF_K, + BPF_ALU|BPF_RSH|BPF_K, + BPF_ALU|BPF_NEG, + BPF_MISC|BPF_TAX, + BPF_MISC|BPF_TXA, + +#ifdef __NPF_x86__ + BPF_MISC|BPF_TME|BPF_LOOKUP, + BPF_MISC|BPF_TME|BPF_EXECUTE, + BPF_MISC|BPF_TME|BPF_SET_ACTIVE, + BPF_MISC|BPF_TME|BPF_GET_REGISTER_VALUE, + BPF_MISC|BPF_TME|BPF_SET_REGISTER_VALUE +#endif + + }; + +#define VALID_INSTRUCTIONS_LEN (sizeof(valid_instructions)/sizeof(u_short)) diff --git a/src/See/win_bpf.h b/src/See/win_bpf.h index dc5d561c..f80b5cd2 100644 --- a/src/See/win_bpf.h +++ b/src/See/win_bpf.h @@ -1,417 +1,417 @@ -/*- - * Copyright (c) 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997 - * The Regents of the University of California. All rights reserved. - * - * This code is derived from the Stanford/CMU enet packet filter, - * (net/enet.c) distributed as part of 4.3BSD, and code contributed - * to Berkeley by Steven McCanne and Van Jacobson both of Lawrence - * Berkeley Laboratory. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the University of - * California, Berkeley and its contributors. - * 4. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @(#)bpf.h 7.1 (Berkeley) 5/7/91 - * - * @(#) $Header: /usr/cvsroot_private/winpcap/packetNtx/driver/win_bpf.h,v 1.2.2.1 2005/12/02 22:12:58 gianlucav Exp $ (LBL) - */ - -#ifndef BPF_MAJOR_VERSION - -/* BSD style release date */ -#define BPF_RELEASE 199606 - -#ifdef WIN_NT_DRIVER -#include -#endif - - -#include "tme.h" -#include "time_calls.h" - -typedef UCHAR u_char; -typedef USHORT u_short; - -#ifdef WIN_NT_DRIVER -typedef ULONG u_int; -#endif - -typedef LONG bpf_int32; -typedef ULONG bpf_u_int32; -typedef ULONG u_int32; - -#define BPF_MAXINSNS 512 -#define BPF_MAXBUFSIZE 0x8000 -#define BPF_MINBUFSIZE 32 - -/* - * The instruction data structure. - */ -struct bpf_insn { - u_short code; - u_char jt; - u_char jf; - bpf_u_int32 k; -}; - -/* - * Structure for BIOCSETF. - */ -struct bpf_program { - u_int bf_len; - struct bpf_insn *bf_insns; -}; - -/* - * Struct returned by BIOCGSTATS. - */ -struct bpf_stat { - UINT bs_recv; ///< Number of packets that the driver received from the network adapter - ///< from the beginning of the current capture. This value includes the packets - ///< lost by the driver. - UINT bs_drop; ///< number of packets that the driver lost from the beginning of a capture. - ///< Basically, a packet is lost when the the buffer of the driver is full. - ///< In this situation the packet cannot be stored and the driver rejects it. - UINT ps_ifdrop; ///< drops by interface. XXX not yet supported - UINT bs_capt; ///< number of packets that pass the filter, find place in the kernel buffer and - ///< thus reach the application. -}; - -/* - * Struct return by BIOCVERSION. This represents the version number of - * the filter language described by the instruction encodings below. - * bpf understands a program iff kernel_major == filter_major && - * kernel_minor >= filter_minor, that is, if the value returned by the - * running kernel has the same major number and a minor number equal - * equal to or less than the filter being downloaded. Otherwise, the - * results are undefined, meaning an error may be returned or packets - * may be accepted haphazardly. - * It has nothing to do with the source code version. - */ -struct bpf_version { - u_short bv_major; - u_short bv_minor; -}; -/* Current version number of filter architecture. */ -#define BPF_MAJOR_VERSION 1 -#define BPF_MINOR_VERSION 1 - - -/* - * Structure prepended to each packet. - */ -struct bpf_hdr { - struct timeval bh_tstamp; /* time stamp */ - bpf_u_int32 bh_caplen; /* length of captured portion */ - bpf_u_int32 bh_datalen; /* original length of packet */ - u_short bh_hdrlen; /* length of bpf header (this struct - plus alignment padding) */ -}; - -/* - * Data-link level type codes. - */ - -/* - * These are the types that are the same on all platforms; on other - * platforms, a should be supplied that defines the additional - * DLT_* codes appropriately for that platform (the BSDs, for example, - * should not just pick up this version of "bpf.h"; they should also define - * the additional DLT_* codes used by their kernels, as well as the values - * defined here - and, if the values they use for particular DLT_ types - * differ from those here, they should use their values, not the ones - * here). - */ -#define DLT_NULL 0 /* no link-layer encapsulation */ -#define DLT_EN10MB 1 /* Ethernet (10Mb) */ -#define DLT_EN3MB 2 /* Experimental Ethernet (3Mb) */ -#define DLT_AX25 3 /* Amateur Radio AX.25 */ -#define DLT_PRONET 4 /* Proteon ProNET Token Ring */ -#define DLT_CHAOS 5 /* Chaos */ -#define DLT_IEEE802 6 /* IEEE 802 Networks */ -#define DLT_ARCNET 7 /* ARCNET */ -#define DLT_SLIP 8 /* Serial Line IP */ -#define DLT_PPP 9 /* Point-to-point Protocol */ -#define DLT_FDDI 10 /* FDDI */ - -/* - * These are values from the traditional libpcap "bpf.h". - * Ports of this to particular platforms should replace these definitions - * with the ones appropriate to that platform, if the values are - * different on that platform. - */ -#define DLT_ATM_RFC1483 11 /* LLC/SNAP encapsulated atm */ -#define DLT_RAW 12 /* raw IP */ - -/* - * These are values from BSD/OS's "bpf.h". - * These are not the same as the values from the traditional libpcap - * "bpf.h"; however, these values shouldn't be generated by any - * OS other than BSD/OS, so the correct values to use here are the - * BSD/OS values. - * - * Platforms that have already assigned these values to other - * DLT_ codes, however, should give these codes the values - * from that platform, so that programs that use these codes will - * continue to compile - even though they won't correctly read - * files of these types. - */ -#define DLT_SLIP_BSDOS 15 /* BSD/OS Serial Line IP */ -#define DLT_PPP_BSDOS 16 /* BSD/OS Point-to-point Protocol */ - -#define DLT_ATM_CLIP 19 /* Linux Classical-IP over ATM */ - -/* - * This value is defined by NetBSD; other platforms should refrain from - * using it for other purposes, so that NetBSD savefiles with a link - * type of 50 can be read as this type on all platforms. - */ -#define DLT_PPP_SERIAL 50 /* PPP over serial with HDLC encapsulation */ - -/* - * This value was defined by libpcap 0.5; platforms that have defined - * it with a different value should define it here with that value - - * a link type of 104 in a save file will be mapped to DLT_C_HDLC, - * whatever value that happens to be, so programs will correctly - * handle files with that link type regardless of the value of - * DLT_C_HDLC. - * - * The name DLT_C_HDLC was used by BSD/OS; we use that name for source - * compatibility with programs written for BSD/OS. - * - * libpcap 0.5 defined it as DLT_CHDLC; we define DLT_CHDLC as well, - * for source compatibility with programs written for libpcap 0.5. - */ -#define DLT_C_HDLC 104 /* Cisco HDLC */ -#define DLT_CHDLC DLT_C_HDLC - -/* - * Reserved for future use. - * Do not pick other numerical value for these unless you have also - * picked up the tcpdump.org top-of-CVS-tree version of "savefile.c", - * which will arrange that capture files for these DLT_ types have - * the same "network" value on all platforms, regardless of what - * value is chosen for their DLT_ type (thus allowing captures made - * on one platform to be read on other platforms, even if the two - * platforms don't use the same numerical values for all DLT_ types). - */ -#define DLT_IEEE802_11 105 /* IEEE 802.11 wireless */ - -/* - * Values between 106 and 107 are used in capture file headers as - * link-layer types corresponding to DLT_ types that might differ - * between platforms; don't use those values for new DLT_ new types. - */ - -/* - * OpenBSD DLT_LOOP, for loopback devices; it's like DLT_NULL, except - * that the AF_ type in the link-layer header is in network byte order. - * - * OpenBSD defines it as 12, but that collides with DLT_RAW, so we - * define it as 108 here. If OpenBSD picks up this file, it should - * define DLT_LOOP as 12 in its version, as per the comment above - - * and should not use 108 for any purpose. - */ -#define DLT_LOOP 108 - -/* - * Values between 109 and 112 are used in capture file headers as - * link-layer types corresponding to DLT_ types that might differ - * between platforms; don't use those values for new DLT_ new types. - */ - -/* - * This is for Linux cooked sockets. - */ -#define DLT_LINUX_SLL 113 - -/* - * The instruction encodings. - */ -/* instruction classes */ -#define BPF_CLASS(code) ((code) & 0x07) -#define BPF_LD 0x00 -#define BPF_LDX 0x01 -#define BPF_ST 0x02 -#define BPF_STX 0x03 -#define BPF_ALU 0x04 -#define BPF_JMP 0x05 -#define BPF_RET 0x06 -#define BPF_MISC 0x07 - -/* ld/ldx fields */ -#define BPF_SIZE(code) ((code) & 0x18) -#define BPF_W 0x00 -#define BPF_H 0x08 -#define BPF_B 0x10 -#define BPF_MODE(code) ((code) & 0xe0) -#define BPF_IMM 0x00 -#define BPF_ABS 0x20 -#define BPF_IND 0x40 -#define BPF_MEM 0x60 -#define BPF_LEN 0x80 -#define BPF_MSH 0xa0 - -/* alu/jmp fields */ -#define BPF_OP(code) ((code) & 0xf0) -#define BPF_ADD 0x00 -#define BPF_SUB 0x10 -#define BPF_MUL 0x20 -#define BPF_DIV 0x30 -#define BPF_OR 0x40 -#define BPF_AND 0x50 -#define BPF_LSH 0x60 -#define BPF_RSH 0x70 -#define BPF_NEG 0x80 -#define BPF_JA 0x00 -#define BPF_JEQ 0x10 -#define BPF_JGT 0x20 -#define BPF_JGE 0x30 -#define BPF_JSET 0x40 -#define BPF_SRC(code) ((code) & 0x08) -#define BPF_K 0x00 -#define BPF_X 0x08 - -/* ret - BPF_K and BPF_X also apply */ -#define BPF_RVAL(code) ((code) & 0x18) -#define BPF_A 0x10 - -/* misc */ -#define BPF_MISCOP(code) ((code) & 0xf8) -#define BPF_TAX 0x00 -#define BPF_TXA 0x80 - -/* TME instructions */ -#define BPF_TME 0x08 - -#define BPF_LOOKUP 0x90 -#define BPF_EXECUTE 0xa0 -#define BPF_INIT 0xb0 -#define BPF_VALIDATE 0xc0 -#define BPF_SET_ACTIVE 0xd0 -#define BPF_RESET 0xe0 -#define BPF_SET_MEMORY 0x80 -#define BPF_GET_REGISTER_VALUE 0x70 -#define BPF_SET_REGISTER_VALUE 0x60 -#define BPF_SET_WORKING 0x50 -#define BPF_SET_ACTIVE_READ 0x40 -#define BPF_SET_AUTODELETION 0x30 -#define BPF_SEPARATION 0xff - -#define BPF_MEM_EX_IMM 0xc0 -#define BPF_MEM_EX_IND 0xe0 -/*used for ST */ -#define BPF_MEM_EX 0xc0 - - -/* - * Macros for insn array initializers. - */ -#define BPF_STMT(code, k) { (u_short)(code), 0, 0, k } -#define BPF_JUMP(code, k, jt, jf) { (u_short)(code), jt, jf, k } - -/* - * Number of scratch memory words (for BPF_LD|BPF_MEM and BPF_ST). - */ -#define BPF_MEMWORDS 16 - -#ifdef __cplusplus -extern "C" -{ -#endif - -/*! - \brief Validates a filtering program arriving from the user-level app. - \param f The filter. - \param len Its length, in pseudo instructions. - \param mem_ex_size The length of the extended memory, used to validate LD/ST to that memory - \return true if f is a valid filter program.. - - The kernel needs to be able to verify an application's filter code. Otherwise, a bogus program could easily - crash the system. - This function returns true if f is a valid filter program. The constraints are that each jump be forward and - to a valid code. The code must terminate with either an accept or reject. -*/ -int32 bpf_validate(struct bpf_insn *f,int32 len, uint32 mem_ex_size); - -/*! - \brief The filtering pseudo-machine interpreter. - \param pc The filter. - \param p Pointer to a memory buffer containing the packet on which the filter will be executed. - \param wirelen Original length of the packet. - \param buflen Current length of the packet. In some cases (for example when the transfer of the packet to the RAM - has not yet finished), bpf_filter can be executed on a portion of the packet. - \param mem_ex The extended memory. - \param tme The virtualization of the TME co-processor - \param time_ref Data structure needed by the TME co-processor to timestamp data - \return The portion of the packet to keep, in bytes. 0 means that the packet must be rejected, -1 means that - the whole packet must be kept. - - \note this function is not used in normal situations, because the jitter creates a native filtering function - that is faster than the interpreter. -*/ -u_int bpf_filter(register struct bpf_insn *pc, - register UCHAR *p, - u_int wirelen, - register u_int buflen , - PMEM_TYPE mem_ex, - PTME_CORE tme , - struct time_conv *time_ref); - -/*! - \brief The filtering pseudo-machine interpreter with two buffers. This function is slower than bpf_filter(), - but works correctly also if the MAC header and the data of the packet are in two different buffers. - \param pc The filter. - \param p Pointer to a memory buffer containing the MAC header of the packet. - \param pd Pointer to a memory buffer containing the data of the packet. - \param wirelen Original length of the packet. - \param buflen Current length of the packet. In some cases (for example when the transfer of the packet to the RAM - has not yet finished), bpf_filter can be executed on a portion of the packet. - \param mem_ex The extended memory. - \param tme The virtualization of the TME co-processor - \param time_ref Data structure needed by the TME co-processor to timestamp data - \return The portion of the packet to keep, in bytes. 0 means that the packet must be rejected, -1 means that - the whole packet must be kept. - - This function is used when NDIS passes the packet to NPF_tap() in two buffers instead than in a single one. -*/ -u_int bpf_filter_with_2_buffers(register struct bpf_insn *pc, - register u_char *p, - register u_char *pd, - register int headersize, - u_int wirelen, - register u_int buflen, - PMEM_TYPE mem_ex, - PTME_CORE tme, - struct time_conv *time_ref); - -#ifdef __cplusplus -} -#endif - - -#endif +/*- + * Copyright (c) 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997 + * The Regents of the University of California. All rights reserved. + * + * This code is derived from the Stanford/CMU enet packet filter, + * (net/enet.c) distributed as part of 4.3BSD, and code contributed + * to Berkeley by Steven McCanne and Van Jacobson both of Lawrence + * Berkeley Laboratory. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)bpf.h 7.1 (Berkeley) 5/7/91 + * + * @(#) $Header: /usr/cvsroot_private/winpcap/packetNtx/driver/win_bpf.h,v 1.2.2.1 2005/12/02 22:12:58 gianlucav Exp $ (LBL) + */ + +#ifndef BPF_MAJOR_VERSION + +/* BSD style release date */ +#define BPF_RELEASE 199606 + +#ifdef WIN_NT_DRIVER +#include +#endif + + +#include "tme.h" +#include "time_calls.h" + +typedef UCHAR u_char; +typedef USHORT u_short; + +#ifdef WIN_NT_DRIVER +typedef ULONG u_int; +#endif + +typedef LONG bpf_int32; +typedef ULONG bpf_u_int32; +typedef ULONG u_int32; + +#define BPF_MAXINSNS 512 +#define BPF_MAXBUFSIZE 0x8000 +#define BPF_MINBUFSIZE 32 + +/* + * The instruction data structure. + */ +struct bpf_insn { + u_short code; + u_char jt; + u_char jf; + bpf_u_int32 k; +}; + +/* + * Structure for BIOCSETF. + */ +struct bpf_program { + u_int bf_len; + struct bpf_insn *bf_insns; +}; + +/* + * Struct returned by BIOCGSTATS. + */ +struct bpf_stat { + UINT bs_recv; ///< Number of packets that the driver received from the network adapter + ///< from the beginning of the current capture. This value includes the packets + ///< lost by the driver. + UINT bs_drop; ///< number of packets that the driver lost from the beginning of a capture. + ///< Basically, a packet is lost when the the buffer of the driver is full. + ///< In this situation the packet cannot be stored and the driver rejects it. + UINT ps_ifdrop; ///< drops by interface. XXX not yet supported + UINT bs_capt; ///< number of packets that pass the filter, find place in the kernel buffer and + ///< thus reach the application. +}; + +/* + * Struct return by BIOCVERSION. This represents the version number of + * the filter language described by the instruction encodings below. + * bpf understands a program iff kernel_major == filter_major && + * kernel_minor >= filter_minor, that is, if the value returned by the + * running kernel has the same major number and a minor number equal + * equal to or less than the filter being downloaded. Otherwise, the + * results are undefined, meaning an error may be returned or packets + * may be accepted haphazardly. + * It has nothing to do with the source code version. + */ +struct bpf_version { + u_short bv_major; + u_short bv_minor; +}; +/* Current version number of filter architecture. */ +#define BPF_MAJOR_VERSION 1 +#define BPF_MINOR_VERSION 1 + + +/* + * Structure prepended to each packet. + */ +struct bpf_hdr { + struct timeval bh_tstamp; /* time stamp */ + bpf_u_int32 bh_caplen; /* length of captured portion */ + bpf_u_int32 bh_datalen; /* original length of packet */ + u_short bh_hdrlen; /* length of bpf header (this struct + plus alignment padding) */ +}; + +/* + * Data-link level type codes. + */ + +/* + * These are the types that are the same on all platforms; on other + * platforms, a should be supplied that defines the additional + * DLT_* codes appropriately for that platform (the BSDs, for example, + * should not just pick up this version of "bpf.h"; they should also define + * the additional DLT_* codes used by their kernels, as well as the values + * defined here - and, if the values they use for particular DLT_ types + * differ from those here, they should use their values, not the ones + * here). + */ +#define DLT_NULL 0 /* no link-layer encapsulation */ +#define DLT_EN10MB 1 /* Ethernet (10Mb) */ +#define DLT_EN3MB 2 /* Experimental Ethernet (3Mb) */ +#define DLT_AX25 3 /* Amateur Radio AX.25 */ +#define DLT_PRONET 4 /* Proteon ProNET Token Ring */ +#define DLT_CHAOS 5 /* Chaos */ +#define DLT_IEEE802 6 /* IEEE 802 Networks */ +#define DLT_ARCNET 7 /* ARCNET */ +#define DLT_SLIP 8 /* Serial Line IP */ +#define DLT_PPP 9 /* Point-to-point Protocol */ +#define DLT_FDDI 10 /* FDDI */ + +/* + * These are values from the traditional libpcap "bpf.h". + * Ports of this to particular platforms should replace these definitions + * with the ones appropriate to that platform, if the values are + * different on that platform. + */ +#define DLT_ATM_RFC1483 11 /* LLC/SNAP encapsulated atm */ +#define DLT_RAW 12 /* raw IP */ + +/* + * These are values from BSD/OS's "bpf.h". + * These are not the same as the values from the traditional libpcap + * "bpf.h"; however, these values shouldn't be generated by any + * OS other than BSD/OS, so the correct values to use here are the + * BSD/OS values. + * + * Platforms that have already assigned these values to other + * DLT_ codes, however, should give these codes the values + * from that platform, so that programs that use these codes will + * continue to compile - even though they won't correctly read + * files of these types. + */ +#define DLT_SLIP_BSDOS 15 /* BSD/OS Serial Line IP */ +#define DLT_PPP_BSDOS 16 /* BSD/OS Point-to-point Protocol */ + +#define DLT_ATM_CLIP 19 /* Linux Classical-IP over ATM */ + +/* + * This value is defined by NetBSD; other platforms should refrain from + * using it for other purposes, so that NetBSD savefiles with a link + * type of 50 can be read as this type on all platforms. + */ +#define DLT_PPP_SERIAL 50 /* PPP over serial with HDLC encapsulation */ + +/* + * This value was defined by libpcap 0.5; platforms that have defined + * it with a different value should define it here with that value - + * a link type of 104 in a save file will be mapped to DLT_C_HDLC, + * whatever value that happens to be, so programs will correctly + * handle files with that link type regardless of the value of + * DLT_C_HDLC. + * + * The name DLT_C_HDLC was used by BSD/OS; we use that name for source + * compatibility with programs written for BSD/OS. + * + * libpcap 0.5 defined it as DLT_CHDLC; we define DLT_CHDLC as well, + * for source compatibility with programs written for libpcap 0.5. + */ +#define DLT_C_HDLC 104 /* Cisco HDLC */ +#define DLT_CHDLC DLT_C_HDLC + +/* + * Reserved for future use. + * Do not pick other numerical value for these unless you have also + * picked up the tcpdump.org top-of-CVS-tree version of "savefile.c", + * which will arrange that capture files for these DLT_ types have + * the same "network" value on all platforms, regardless of what + * value is chosen for their DLT_ type (thus allowing captures made + * on one platform to be read on other platforms, even if the two + * platforms don't use the same numerical values for all DLT_ types). + */ +#define DLT_IEEE802_11 105 /* IEEE 802.11 wireless */ + +/* + * Values between 106 and 107 are used in capture file headers as + * link-layer types corresponding to DLT_ types that might differ + * between platforms; don't use those values for new DLT_ new types. + */ + +/* + * OpenBSD DLT_LOOP, for loopback devices; it's like DLT_NULL, except + * that the AF_ type in the link-layer header is in network byte order. + * + * OpenBSD defines it as 12, but that collides with DLT_RAW, so we + * define it as 108 here. If OpenBSD picks up this file, it should + * define DLT_LOOP as 12 in its version, as per the comment above - + * and should not use 108 for any purpose. + */ +#define DLT_LOOP 108 + +/* + * Values between 109 and 112 are used in capture file headers as + * link-layer types corresponding to DLT_ types that might differ + * between platforms; don't use those values for new DLT_ new types. + */ + +/* + * This is for Linux cooked sockets. + */ +#define DLT_LINUX_SLL 113 + +/* + * The instruction encodings. + */ +/* instruction classes */ +#define BPF_CLASS(code) ((code) & 0x07) +#define BPF_LD 0x00 +#define BPF_LDX 0x01 +#define BPF_ST 0x02 +#define BPF_STX 0x03 +#define BPF_ALU 0x04 +#define BPF_JMP 0x05 +#define BPF_RET 0x06 +#define BPF_MISC 0x07 + +/* ld/ldx fields */ +#define BPF_SIZE(code) ((code) & 0x18) +#define BPF_W 0x00 +#define BPF_H 0x08 +#define BPF_B 0x10 +#define BPF_MODE(code) ((code) & 0xe0) +#define BPF_IMM 0x00 +#define BPF_ABS 0x20 +#define BPF_IND 0x40 +#define BPF_MEM 0x60 +#define BPF_LEN 0x80 +#define BPF_MSH 0xa0 + +/* alu/jmp fields */ +#define BPF_OP(code) ((code) & 0xf0) +#define BPF_ADD 0x00 +#define BPF_SUB 0x10 +#define BPF_MUL 0x20 +#define BPF_DIV 0x30 +#define BPF_OR 0x40 +#define BPF_AND 0x50 +#define BPF_LSH 0x60 +#define BPF_RSH 0x70 +#define BPF_NEG 0x80 +#define BPF_JA 0x00 +#define BPF_JEQ 0x10 +#define BPF_JGT 0x20 +#define BPF_JGE 0x30 +#define BPF_JSET 0x40 +#define BPF_SRC(code) ((code) & 0x08) +#define BPF_K 0x00 +#define BPF_X 0x08 + +/* ret - BPF_K and BPF_X also apply */ +#define BPF_RVAL(code) ((code) & 0x18) +#define BPF_A 0x10 + +/* misc */ +#define BPF_MISCOP(code) ((code) & 0xf8) +#define BPF_TAX 0x00 +#define BPF_TXA 0x80 + +/* TME instructions */ +#define BPF_TME 0x08 + +#define BPF_LOOKUP 0x90 +#define BPF_EXECUTE 0xa0 +#define BPF_INIT 0xb0 +#define BPF_VALIDATE 0xc0 +#define BPF_SET_ACTIVE 0xd0 +#define BPF_RESET 0xe0 +#define BPF_SET_MEMORY 0x80 +#define BPF_GET_REGISTER_VALUE 0x70 +#define BPF_SET_REGISTER_VALUE 0x60 +#define BPF_SET_WORKING 0x50 +#define BPF_SET_ACTIVE_READ 0x40 +#define BPF_SET_AUTODELETION 0x30 +#define BPF_SEPARATION 0xff + +#define BPF_MEM_EX_IMM 0xc0 +#define BPF_MEM_EX_IND 0xe0 +/*used for ST */ +#define BPF_MEM_EX 0xc0 + + +/* + * Macros for insn array initializers. + */ +#define BPF_STMT(code, k) { (u_short)(code), 0, 0, k } +#define BPF_JUMP(code, k, jt, jf) { (u_short)(code), jt, jf, k } + +/* + * Number of scratch memory words (for BPF_LD|BPF_MEM and BPF_ST). + */ +#define BPF_MEMWORDS 16 + +#ifdef __cplusplus +extern "C" +{ +#endif + +/*! + \brief Validates a filtering program arriving from the user-level app. + \param f The filter. + \param len Its length, in pseudo instructions. + \param mem_ex_size The length of the extended memory, used to validate LD/ST to that memory + \return true if f is a valid filter program.. + + The kernel needs to be able to verify an application's filter code. Otherwise, a bogus program could easily + crash the system. + This function returns true if f is a valid filter program. The constraints are that each jump be forward and + to a valid code. The code must terminate with either an accept or reject. +*/ +int32 bpf_validate(struct bpf_insn *f,int32 len, uint32 mem_ex_size); + +/*! + \brief The filtering pseudo-machine interpreter. + \param pc The filter. + \param p Pointer to a memory buffer containing the packet on which the filter will be executed. + \param wirelen Original length of the packet. + \param buflen Current length of the packet. In some cases (for example when the transfer of the packet to the RAM + has not yet finished), bpf_filter can be executed on a portion of the packet. + \param mem_ex The extended memory. + \param tme The virtualization of the TME co-processor + \param time_ref Data structure needed by the TME co-processor to timestamp data + \return The portion of the packet to keep, in bytes. 0 means that the packet must be rejected, -1 means that + the whole packet must be kept. + + \note this function is not used in normal situations, because the jitter creates a native filtering function + that is faster than the interpreter. +*/ +u_int bpf_filter(register struct bpf_insn *pc, + register UCHAR *p, + u_int wirelen, + register u_int buflen , + PMEM_TYPE mem_ex, + PTME_CORE tme , + struct time_conv *time_ref); + +/*! + \brief The filtering pseudo-machine interpreter with two buffers. This function is slower than bpf_filter(), + but works correctly also if the MAC header and the data of the packet are in two different buffers. + \param pc The filter. + \param p Pointer to a memory buffer containing the MAC header of the packet. + \param pd Pointer to a memory buffer containing the data of the packet. + \param wirelen Original length of the packet. + \param buflen Current length of the packet. In some cases (for example when the transfer of the packet to the RAM + has not yet finished), bpf_filter can be executed on a portion of the packet. + \param mem_ex The extended memory. + \param tme The virtualization of the TME co-processor + \param time_ref Data structure needed by the TME co-processor to timestamp data + \return The portion of the packet to keep, in bytes. 0 means that the packet must be rejected, -1 means that + the whole packet must be kept. + + This function is used when NDIS passes the packet to NPF_tap() in two buffers instead than in a single one. +*/ +u_int bpf_filter_with_2_buffers(register struct bpf_insn *pc, + register u_char *p, + register u_char *pd, + register int headersize, + u_int wirelen, + register u_int buflen, + PMEM_TYPE mem_ex, + PTME_CORE tme, + struct time_conv *time_ref); + +#ifdef __cplusplus +} +#endif + + +#endif diff --git a/src/See/win_bpf_filter.c b/src/See/win_bpf_filter.c index 8ebb82f5..900f82d2 100644 --- a/src/See/win_bpf_filter.c +++ b/src/See/win_bpf_filter.c @@ -1,1086 +1,1086 @@ -/* - * Copyright (c) 1999 - 2005 NetGroup, Politecnico di Torino (Italy) - * Copyright (c) 2005 CACE Technologies, Davis (California) - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the Politecnico di Torino, CACE Technologies - * nor the names of its contributors may be used to endorse or promote - * products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - */ - -#include - -#ifndef WIN_NT_DRIVER -#include -#else -#include -#endif - -#include "win_bpf.h" - -#include "debug.h" - -#include "valid_insns.h" - -#define EXTRACT_SHORT(p)\ - ((u_short)\ - ((u_short)*((u_char *)p+0)<<8|\ - (u_short)*((u_char *)p+1)<<0)) -#define EXTRACT_LONG(p)\ - ((u_int32)*((u_char *)p+0)<<24|\ - (u_int32)*((u_char *)p+1)<<16|\ - (u_int32)*((u_char *)p+2)<<8|\ - (u_int32)*((u_char *)p+3)<<0) - - -u_int bpf_filter(pc, p, wirelen, buflen,mem_ex,tme,time_ref) - register struct bpf_insn *pc; - register u_char *p; - u_int wirelen; - register u_int buflen; - PMEM_TYPE mem_ex; - PTME_CORE tme; - struct time_conv *time_ref; - -{ - register u_int32 A, X; - register int k; - //u_int32 j,tmp; - //u_short tmp2; - - int32 mem[BPF_MEMWORDS]; - - if (pc == 0) - /* - * No filter means accept all. - */ - return (u_int)-1; - A = 0; - X = 0; - --pc; - while (1) { - ++pc; - switch (pc->code) { - - default: - - return 0; - - case BPF_RET|BPF_K: - return (u_int)pc->k; - - case BPF_RET|BPF_A: - return (u_int)A; - - case BPF_LD|BPF_W|BPF_ABS: - k = pc->k; - if (k + sizeof(int32) > buflen) { - return 0; - } - A = EXTRACT_LONG(&p[k]); - continue; - - case BPF_LD|BPF_H|BPF_ABS: - k = pc->k; - if (k + sizeof(short) > buflen) { - return 0; - } - A = EXTRACT_SHORT(&p[k]); - continue; - - case BPF_LD|BPF_B|BPF_ABS: - k = pc->k; - if ((int)k >= (int)buflen) { - return 0; - } - A = p[k]; - continue; - - case BPF_LD|BPF_W|BPF_LEN: - A = wirelen; - continue; - - case BPF_LDX|BPF_W|BPF_LEN: - X = wirelen; - continue; - - case BPF_LD|BPF_W|BPF_IND: - k = X + pc->k; - if (k + sizeof(int32) > buflen) { - return 0; - } - A = EXTRACT_LONG(&p[k]); - continue; - - case BPF_LD|BPF_H|BPF_IND: - k = X + pc->k; - if (k + sizeof(short) > buflen) { - return 0; - } - A = EXTRACT_SHORT(&p[k]); - continue; - - case BPF_LD|BPF_B|BPF_IND: - k = X + pc->k; - if ((int)k >= (int)buflen) { - return 0; - } - A = p[k]; - continue; - - case BPF_LDX|BPF_MSH|BPF_B: - k = pc->k; - if ((int)k >= (int)buflen) { - return 0; - } - X = (p[pc->k] & 0xf) << 2; - continue; - - case BPF_LD|BPF_IMM: - A = pc->k; - continue; - - case BPF_LDX|BPF_IMM: - X = pc->k; - continue; - - case BPF_LD|BPF_MEM: - A = mem[pc->k]; - continue; - - case BPF_LDX|BPF_MEM: - X = mem[pc->k]; - continue; - -#ifdef __NPF_x86__ - // - // these instructions use the TME extensions, - // not supported on x86-64 and IA64 architectures. - // - - /* LD NO PACKET INSTRUCTIONS */ - - case BPF_LD|BPF_MEM_EX_IMM|BPF_B: - A= mem_ex->buffer[pc->k]; - continue; - - case BPF_LDX|BPF_MEM_EX_IMM|BPF_B: - X= mem_ex->buffer[pc->k]; - continue; - - case BPF_LD|BPF_MEM_EX_IMM|BPF_H: - A = EXTRACT_SHORT(&mem_ex->buffer[pc->k]); - continue; - - case BPF_LDX|BPF_MEM_EX_IMM|BPF_H: - X = EXTRACT_SHORT(&mem_ex->buffer[pc->k]); - continue; - - case BPF_LD|BPF_MEM_EX_IMM|BPF_W: - A = EXTRACT_LONG(&mem_ex->buffer[pc->k]); - continue; - - case BPF_LDX|BPF_MEM_EX_IMM|BPF_W: - X = EXTRACT_LONG(&mem_ex->buffer[pc->k]); - continue; - - case BPF_LD|BPF_MEM_EX_IND|BPF_B: - k = X + pc->k; - if ((int32)k>= (int32)mem_ex->size) { - return 0; - } - A= mem_ex->buffer[k]; - continue; - - case BPF_LD|BPF_MEM_EX_IND|BPF_H: - k = X + pc->k; - if ((int32)(k+1)>= (int32)mem_ex->size) { - return 0; - } - A=EXTRACT_SHORT((uint32*)&mem_ex->buffer[k]); - continue; - - case BPF_LD|BPF_MEM_EX_IND|BPF_W: - k = X + pc->k; - if ((int32)(k+3)>= (int32)mem_ex->size) { - return 0; - } - A=EXTRACT_LONG((uint32*)&mem_ex->buffer[k]); - continue; -/* END LD NO PACKET INSTRUCTIONS */ -#endif //__NPF_x86__ - - case BPF_ST: - mem[pc->k] = A; - continue; - - case BPF_STX: - mem[pc->k] = X; - continue; - -#ifdef __NPF_x86__ - // - // these instructions use the TME extensions, - // not supported on x86-64 and IA64 architectures. - // - - /* STORE INSTRUCTIONS */ - case BPF_ST|BPF_MEM_EX_IMM|BPF_B: - mem_ex->buffer[pc->k]=(uint8)A; - continue; - - case BPF_STX|BPF_MEM_EX_IMM|BPF_B: - mem_ex->buffer[pc->k]=(uint8)X; - continue; - - case BPF_ST|BPF_MEM_EX_IMM|BPF_W: - tmp=A; - *(uint32*)&(mem_ex->buffer[pc->k])=EXTRACT_LONG(&tmp); - continue; - - case BPF_STX|BPF_MEM_EX_IMM|BPF_W: - tmp=X; - *(uint32*)&(mem_ex->buffer[pc->k])=EXTRACT_LONG(&tmp); - continue; - - case BPF_ST|BPF_MEM_EX_IMM|BPF_H: - tmp2=(uint16)A; - *(uint16*)&mem_ex->buffer[pc->k]=EXTRACT_SHORT(&tmp2); - continue; - - case BPF_STX|BPF_MEM_EX_IMM|BPF_H: - tmp2=(uint16)X; - *(uint16*)&mem_ex->buffer[pc->k]=EXTRACT_SHORT(&tmp2); - continue; - - case BPF_ST|BPF_MEM_EX_IND|BPF_B: - mem_ex->buffer[pc->k+X]=(uint8)A; - - case BPF_ST|BPF_MEM_EX_IND|BPF_W: - tmp=A; - *(uint32*)&mem_ex->buffer[pc->k+X]=EXTRACT_LONG(&tmp); - continue; - - case BPF_ST|BPF_MEM_EX_IND|BPF_H: - tmp2=(uint16)A; - *(uint16*)&mem_ex->buffer[pc->k+X]=EXTRACT_SHORT(&tmp2); - continue; -/* END STORE INSTRUCTIONS */ - -#endif //__NPF_x86__ - - case BPF_JMP|BPF_JA: - pc += pc->k; - continue; - - case BPF_JMP|BPF_JGT|BPF_K: - pc += ((int)A > (int)pc->k) ? pc->jt : pc->jf; - continue; - - case BPF_JMP|BPF_JGE|BPF_K: - pc += ((int)A >= (int)pc->k) ? pc->jt : pc->jf; - continue; - - case BPF_JMP|BPF_JEQ|BPF_K: - pc += ((int)A == (int)pc->k) ? pc->jt : pc->jf; - continue; - - case BPF_JMP|BPF_JSET|BPF_K: - pc += (A & pc->k) ? pc->jt : pc->jf; - continue; - - case BPF_JMP|BPF_JGT|BPF_X: - pc += (A > X) ? pc->jt : pc->jf; - continue; - - case BPF_JMP|BPF_JGE|BPF_X: - pc += (A >= X) ? pc->jt : pc->jf; - continue; - - case BPF_JMP|BPF_JEQ|BPF_X: - pc += (A == X) ? pc->jt : pc->jf; - continue; - - case BPF_JMP|BPF_JSET|BPF_X: - pc += (A & X) ? pc->jt : pc->jf; - continue; - - case BPF_ALU|BPF_ADD|BPF_X: - A += X; - continue; - - case BPF_ALU|BPF_SUB|BPF_X: - A -= X; - continue; - - case BPF_ALU|BPF_MUL|BPF_X: - A *= X; - continue; - - case BPF_ALU|BPF_DIV|BPF_X: - if (X == 0) - return 0; - A /= X; - continue; - - case BPF_ALU|BPF_AND|BPF_X: - A &= X; - continue; - - case BPF_ALU|BPF_OR|BPF_X: - A |= X; - continue; - - case BPF_ALU|BPF_LSH|BPF_X: - A <<= X; - continue; - - case BPF_ALU|BPF_RSH|BPF_X: - A >>= X; - continue; - - case BPF_ALU|BPF_ADD|BPF_K: - A += pc->k; - continue; - - case BPF_ALU|BPF_SUB|BPF_K: - A -= pc->k; - continue; - - case BPF_ALU|BPF_MUL|BPF_K: - A *= pc->k; - continue; - - case BPF_ALU|BPF_DIV|BPF_K: - A /= pc->k; - continue; - - case BPF_ALU|BPF_AND|BPF_K: - A &= pc->k; - continue; - - case BPF_ALU|BPF_OR|BPF_K: - A |= pc->k; - continue; - - case BPF_ALU|BPF_LSH|BPF_K: - A <<= pc->k; - continue; - - case BPF_ALU|BPF_RSH|BPF_K: - A >>= pc->k; - continue; - - case BPF_ALU|BPF_NEG: - (int)A = -((int)A); - continue; - - case BPF_MISC|BPF_TAX: - X = A; - continue; - - case BPF_MISC|BPF_TXA: - A = X; - continue; - -#ifdef __NPF_x86__ - // - // these instructions use the TME extensions, - // not supported on x86-64 and IA64 architectures. - // - - /* TME INSTRUCTIONS */ - case BPF_MISC|BPF_TME|BPF_LOOKUP: - j=lookup_frontend(mem_ex,tme,pc->k,time_ref); - if (j==TME_ERROR) - return 0; - pc += (j == TME_TRUE) ? pc->jt : pc->jf; - continue; - - case BPF_MISC|BPF_TME|BPF_EXECUTE: - if (execute_frontend(mem_ex,tme,wirelen,pc->k)==TME_ERROR) - return 0; - continue; - - case BPF_MISC|BPF_TME|BPF_SET_ACTIVE: - if (set_active_tme_block(tme,pc->k)==TME_ERROR) - return 0; - continue; - - case BPF_MISC|BPF_TME|BPF_GET_REGISTER_VALUE: - if (get_tme_block_register(&tme->block_data[tme->working],mem_ex,pc->k,&j)==TME_ERROR) - return 0; - A=j; - continue; - - case BPF_MISC|BPF_TME|BPF_SET_REGISTER_VALUE: - if (set_tme_block_register(&tme->block_data[tme->working],mem_ex,pc->k,A,FALSE)==TME_ERROR) - return 0; - continue; - /* END TME INSTRUCTIONS */ - -#endif //__NPF_x86__ - - } - } -} - -//------------------------------------------------------------------- - -u_int bpf_filter_with_2_buffers(pc, p, pd, headersize, wirelen, buflen, mem_ex,tme,time_ref) - register struct bpf_insn *pc; - register u_char *p; - register u_char *pd; - register int headersize; - u_int wirelen; - register u_int buflen; - PMEM_TYPE mem_ex; - PTME_CORE tme; - struct time_conv *time_ref; -{ - register u_int32 A, X; - register int k; - int32 mem[BPF_MEMWORDS]; -// u_int32 j,tmp; -// u_short tmp2; - - if (pc == 0) - /* - * No filter means accept all. - */ - return (u_int)-1; - A = 0; - X = 0; - --pc; - while (1) { - ++pc; - switch (pc->code) { - - default: - - return 0; - - case BPF_RET|BPF_K: - return (u_int)pc->k; - - case BPF_RET|BPF_A: - return (u_int)A; - - case BPF_LD|BPF_W|BPF_ABS: - k = pc->k; - if (k + 4 > (int)buflen) { - return 0; - } - - if(k + 4 <= headersize) - A = EXTRACT_LONG(&p[k]); - else if(k + 3 == headersize) - { - A= (u_int32)*((u_char *)p+k)<<24| - (u_int32)*((u_char *)p+k+1)<<16| - (u_int32)*((u_char *)p+k+2)<<8| - (u_int32)*((u_char *)pd+k-headersize); - } - else if(k + 2 == headersize) - { - A= (u_int32)*((u_char *)p+k)<<24| - (u_int32)*((u_char *)p+k+1)<<16| - (u_int32)*((u_char *)pd+k-headersize)<<8| - (u_int32)*((u_char *)pd+k-headersize+1); - } - else if(k + 1 == headersize){ - A= (u_int32)*((u_char *)p+k)<<24| - (u_int32)*((u_char *)pd+k-headersize+1)<<16| - (u_int32)*((u_char *)pd+k-headersize+2)<<8| - (u_int32)*((u_char *)pd+k-headersize+3); - } - else - A = EXTRACT_LONG(&pd[k-headersize]); - - continue; - - case BPF_LD|BPF_H|BPF_ABS: - k = pc->k; - if (k + sizeof(short) > buflen) - { - return 0; - } - - if(k + 2 <= headersize) - A = EXTRACT_SHORT(&p[k]); - else if(k + 1 == headersize) - { - A= (u_short)*((u_char *)p+k)<<8| - (u_short)*((u_char *)pd+k-headersize); - } - else - A = EXTRACT_SHORT(&pd[k-headersize]); - - continue; - - case BPF_LD|BPF_B|BPF_ABS: - k = pc->k; - if ((int)k >= (int)buflen) { - return 0; - } - - if(k +(int) sizeof(char) <= headersize) - A = p[k]; - else - A = pd[k-headersize]; - - continue; - - case BPF_LD|BPF_W|BPF_LEN: - A = wirelen; - continue; - - case BPF_LDX|BPF_W|BPF_LEN: - X = wirelen; - continue; - - case BPF_LD|BPF_W|BPF_IND: - k = X + pc->k; - if (k + sizeof(int32) > buflen) { - return 0; - } - - if(k + 4 <= headersize) - A = EXTRACT_LONG(&p[k]); - else if(k + 3 == headersize) - { - A= (u_int32)*((u_char *)p+k)<<24| - (u_int32)*((u_char *)p+k+1)<<16| - (u_int32)*((u_char *)p+k+2)<<8| - (u_int32)*((u_char *)pd+k-headersize); - } - else if(k + 2 == headersize) - { - A= (u_int32)*((u_char *)p+k)<<24| - (u_int32)*((u_char *)p+k+1)<<16| - (u_int32)*((u_char *)pd+k-headersize)<<8| - (u_int32)*((u_char *)pd+k-headersize+1); - } - else if(k + 1 == headersize) - { - A= (u_int32)*((u_char *)p+k)<<24| - (u_int32)*((u_char *)pd+k-headersize+1)<<16| - (u_int32)*((u_char *)pd+k-headersize+2)<<8| - (u_int32)*((u_char *)pd+k-headersize+3); - } - else - A = EXTRACT_LONG(&pd[k-headersize]); - - continue; - - case BPF_LD|BPF_H|BPF_IND: - k = X + pc->k; - if (k + 2 > (int)buflen) { - return 0; - } - - if(k + 2 <= headersize) - A = EXTRACT_SHORT(&p[k]); - else if(k +1 == headersize) - { - A= (u_short)*((u_char *)p+k)<<8| - (u_short)*((u_char *)pd+k-headersize); - } - else - A = EXTRACT_SHORT(&pd[k-headersize]); - - continue; - - case BPF_LD|BPF_B|BPF_IND: - k = X + pc->k; - if ((int)k >= (int)buflen) { - return 0; - } - - if(k <= headersize) - A = p[k]; - else - A = pd[k-headersize]; - - continue; - - case BPF_LDX|BPF_MSH|BPF_B: - k = pc->k; - if ((int)k >= (int)buflen) { - return 0; - } - - if((int)(pc->k) <= headersize) - X = (p[pc->k] & 0xf) << 2; - else - X = (pd[(pc->k)-headersize] & 0xf) << 2; - - continue; - - case BPF_LD|BPF_IMM: - A = pc->k; - continue; - - case BPF_LDX|BPF_IMM: - X = pc->k; - continue; - - case BPF_LD|BPF_MEM: - A = mem[pc->k]; - continue; - - case BPF_LDX|BPF_MEM: - X = mem[pc->k]; - continue; - -#ifdef __NPF_x86__ - // - // these instructions use the TME extensions, - // not supported on x86-64 and IA64 architectures. - // - - /* LD NO PACKET INSTRUCTIONS */ - - case BPF_LD|BPF_MEM_EX_IMM|BPF_B: - A= mem_ex->buffer[pc->k]; - continue; - - case BPF_LDX|BPF_MEM_EX_IMM|BPF_B: - X= mem_ex->buffer[pc->k]; - continue; - - case BPF_LD|BPF_MEM_EX_IMM|BPF_H: - A = EXTRACT_SHORT(&mem_ex->buffer[pc->k]); - continue; - - case BPF_LDX|BPF_MEM_EX_IMM|BPF_H: - X = EXTRACT_SHORT(&mem_ex->buffer[pc->k]); - continue; - - case BPF_LD|BPF_MEM_EX_IMM|BPF_W: - A = EXTRACT_LONG(&mem_ex->buffer[pc->k]); - continue; - - case BPF_LDX|BPF_MEM_EX_IMM|BPF_W: - X = EXTRACT_LONG(&mem_ex->buffer[pc->k]); - continue; - - case BPF_LD|BPF_MEM_EX_IND|BPF_B: - k = X + pc->k; - if ((int32)k>= (int32)mem_ex->size) { - return 0; - } - A= mem_ex->buffer[k]; - continue; - - case BPF_LD|BPF_MEM_EX_IND|BPF_H: - k = X + pc->k; - if ((int32)(k+1)>= (int32)mem_ex->size) { - return 0; - } - A=EXTRACT_SHORT((uint32*)&mem_ex->buffer[k]); - continue; - - case BPF_LD|BPF_MEM_EX_IND|BPF_W: - k = X + pc->k; - if ((int32)(k+3)>= (int32)mem_ex->size) { - return 0; - } - A=EXTRACT_LONG((uint32*)&mem_ex->buffer[k]); - continue; - /* END LD NO PACKET INSTRUCTIONS */ - -#endif //__NPF_x86__ - - case BPF_ST: - mem[pc->k] = A; - continue; - - case BPF_STX: - mem[pc->k] = X; - continue; - -#ifdef __NPF_x86__ - // - // these instructions use the TME extensions, - // not supported on x86-64 and IA64 architectures. - // - - /* STORE INSTRUCTIONS */ - case BPF_ST|BPF_MEM_EX_IMM|BPF_B: - mem_ex->buffer[pc->k]=(uint8)A; - continue; - - case BPF_STX|BPF_MEM_EX_IMM|BPF_B: - mem_ex->buffer[pc->k]=(uint8)X; - continue; - - case BPF_ST|BPF_MEM_EX_IMM|BPF_W: - tmp=A; - *(uint32*)&(mem_ex->buffer[pc->k])=EXTRACT_LONG(&tmp); - continue; - - case BPF_STX|BPF_MEM_EX_IMM|BPF_W: - tmp=X; - *(uint32*)&(mem_ex->buffer[pc->k])=EXTRACT_LONG(&tmp); - continue; - - case BPF_ST|BPF_MEM_EX_IMM|BPF_H: - tmp2=(uint16)A; - *(uint16*)&mem_ex->buffer[pc->k]=EXTRACT_SHORT(&tmp2); - continue; - - case BPF_STX|BPF_MEM_EX_IMM|BPF_H: - tmp2=(uint16)X; - *(uint16*)&mem_ex->buffer[pc->k]=EXTRACT_SHORT(&tmp2); - continue; - - case BPF_ST|BPF_MEM_EX_IND|BPF_B: - mem_ex->buffer[pc->k+X]=(uint8)A; - - case BPF_ST|BPF_MEM_EX_IND|BPF_W: - tmp=A; - *(uint32*)&mem_ex->buffer[pc->k+X]=EXTRACT_LONG(&tmp); - continue; - - case BPF_ST|BPF_MEM_EX_IND|BPF_H: - tmp2=(uint16)A; - *(uint16*)&mem_ex->buffer[pc->k+X]=EXTRACT_SHORT(&tmp2); - continue; - /* END STORE INSTRUCTIONS */ - -#endif //__NPF_x86__ - - case BPF_JMP|BPF_JA: - pc += pc->k; - continue; - - case BPF_JMP|BPF_JGT|BPF_K: - pc += ((int)A > (int)pc->k) ? pc->jt : pc->jf; - continue; - - case BPF_JMP|BPF_JGE|BPF_K: - pc += ((int)A >= (int)pc->k) ? pc->jt : pc->jf; - continue; - - case BPF_JMP|BPF_JEQ|BPF_K: - pc += ((int)A == (int)pc->k) ? pc->jt : pc->jf; - continue; - - case BPF_JMP|BPF_JSET|BPF_K: - pc += (A & pc->k) ? pc->jt : pc->jf; - continue; - - case BPF_JMP|BPF_JGT|BPF_X: - pc += (A > X) ? pc->jt : pc->jf; - continue; - - case BPF_JMP|BPF_JGE|BPF_X: - pc += (A >= X) ? pc->jt : pc->jf; - continue; - - case BPF_JMP|BPF_JEQ|BPF_X: - pc += (A == X) ? pc->jt : pc->jf; - continue; - - case BPF_JMP|BPF_JSET|BPF_X: - pc += (A & X) ? pc->jt : pc->jf; - continue; - - case BPF_ALU|BPF_ADD|BPF_X: - A += X; - continue; - - case BPF_ALU|BPF_SUB|BPF_X: - A -= X; - continue; - - case BPF_ALU|BPF_MUL|BPF_X: - A *= X; - continue; - - case BPF_ALU|BPF_DIV|BPF_X: - if (X == 0) - return 0; - A /= X; - continue; - - case BPF_ALU|BPF_AND|BPF_X: - A &= X; - continue; - - case BPF_ALU|BPF_OR|BPF_X: - A |= X; - continue; - - case BPF_ALU|BPF_LSH|BPF_X: - A <<= X; - continue; - - case BPF_ALU|BPF_RSH|BPF_X: - A >>= X; - continue; - - case BPF_ALU|BPF_ADD|BPF_K: - A += pc->k; - continue; - - case BPF_ALU|BPF_SUB|BPF_K: - A -= pc->k; - continue; - - case BPF_ALU|BPF_MUL|BPF_K: - A *= pc->k; - continue; - - case BPF_ALU|BPF_DIV|BPF_K: - A /= pc->k; - continue; - - case BPF_ALU|BPF_AND|BPF_K: - A &= pc->k; - continue; - - case BPF_ALU|BPF_OR|BPF_K: - A |= pc->k; - continue; - - case BPF_ALU|BPF_LSH|BPF_K: - A <<= pc->k; - continue; - - case BPF_ALU|BPF_RSH|BPF_K: - A >>= pc->k; - continue; - - case BPF_ALU|BPF_NEG: - (int)A = -((int)A); - continue; - - case BPF_MISC|BPF_TAX: - X = A; - continue; - - case BPF_MISC|BPF_TXA: - A = X; - continue; - -#ifdef __NPF_x86__ - // - // these instructions use the TME extensions, - // not supported on x86-64 and IA64 architectures. - // - - /* TME INSTRUCTIONS */ - case BPF_MISC|BPF_TME|BPF_LOOKUP: - j=lookup_frontend(mem_ex,tme,pc->k,time_ref); - if (j==TME_ERROR) - return 0; - pc += (j == TME_TRUE) ? pc->jt : pc->jf; - continue; - - case BPF_MISC|BPF_TME|BPF_EXECUTE: - if (execute_frontend(mem_ex,tme,wirelen,pc->k)==TME_ERROR) - return 0; - continue; - - case BPF_MISC|BPF_TME|BPF_SET_ACTIVE: - if (set_active_tme_block(tme,pc->k)==TME_ERROR) - return 0; - continue; - - case BPF_MISC|BPF_TME|BPF_GET_REGISTER_VALUE: - if (get_tme_block_register(&tme->block_data[tme->working],mem_ex,pc->k,&j)==TME_ERROR) - return 0; - A=j; - continue; - - case BPF_MISC|BPF_TME|BPF_SET_REGISTER_VALUE: - if (set_tme_block_register(&tme->block_data[tme->working],mem_ex,pc->k,A,FALSE)==TME_ERROR) - return 0; - continue; - /* END TME INSTRUCTIONS */ - -#endif //__NPF_x86__ - - } - } -} - -int32 -bpf_validate(f, len,mem_ex_size) - struct bpf_insn *f; - int32 len; - uint32 mem_ex_size; -{ - register uint32 i, from; - register int32 j; - register struct bpf_insn *p; - int32 flag; - - if (len < 1) - return 0; - - for (i = 0; i < (uint32)len; ++i) { - p = &f[i]; - - IF_LOUD(DbgPrint("Validating program");) - - flag=0; - for(j=0;jcode==valid_instructions[j]) - flag=1; - if (flag==0) - return 0; - - IF_LOUD(DbgPrint("Validating program: no unknown instructions");) - - switch (BPF_CLASS(p->code)) { - /* - * Check that memory operations use valid addresses. - */ - case BPF_LD: - case BPF_LDX: - switch (BPF_MODE(p->code)) { - case BPF_IMM: - break; - case BPF_ABS: - case BPF_IND: - case BPF_MSH: - break; - case BPF_MEM: - if (p->k >= BPF_MEMWORDS) - return 0; - break; - case BPF_LEN: - break; - default: - return 0; - } - IF_LOUD(DbgPrint("Validating program: no wrong LD memory locations");) - break; - case BPF_ST: - case BPF_STX: -#ifdef __NPF_x86__ - if ((p->code &BPF_MEM_EX_IMM) == BPF_MEM_EX_IMM) - { - /* - * Check if key stores use valid addresses - */ - switch (BPF_SIZE(p->code)) { - - case BPF_W: - if (p->k+3 >= mem_ex_size) - return 0; - break; - - case BPF_H: - if (p->k+1 >= mem_ex_size) - return 0; - break; - - case BPF_B: - if (p->k >= mem_ex_size) - return 0; - break; - } - } - else -#endif //__NPF_x86__ - { - if ((p->code & BPF_MEM_EX_IND) != BPF_MEM_EX_IND) - { - if (p->k >= BPF_MEMWORDS) - return 0; - } - } - IF_LOUD(DbgPrint("Validating program: no wrong ST memory locations");) - break; - case BPF_ALU: - switch (BPF_OP(p->code)) { - case BPF_ADD: - case BPF_SUB: - case BPF_OR: - case BPF_AND: - case BPF_LSH: - case BPF_RSH: - case BPF_NEG: - break; - case BPF_DIV: - /* - * Check for constant division by 0. - */ - if (BPF_RVAL(p->code) == BPF_K && p->k == 0) - return 0; - default: - return 0; - } - break; - case BPF_JMP: - /* - * Check that jumps are within the code block, - * and that unconditional branches don't go - * backwards as a result of an overflow. - * Unconditional branches have a 32-bit offset, - * so they could overflow; we check to make - * sure they don't. Conditional branches have - * an 8-bit offset, and the from address is <= - * BPF_MAXINSNS, and we assume that BPF_MAXINSNS - * is sufficiently small that adding 255 to it - * won't overflow. - * - * We know that len is <= BPF_MAXINSNS, and we - * assume that BPF_MAXINSNS is < the maximum size - * of a u_int, so that i + 1 doesn't overflow. - */ - from = i + 1; - switch (BPF_OP(p->code)) { - case BPF_JA: - if (from + p->k < from || from + p->k >= (uint32)len) - return 0; - break; - case BPF_JEQ: - case BPF_JGT: - case BPF_JGE: - case BPF_JSET: - if (from + p->jt >= (uint32)len || from + p->jf >= (uint32)len) - return 0; - break; - default: - return 0; - } - IF_LOUD(DbgPrint("Validating program: no wrong JUMPS");) - break; - case BPF_RET: - break; - case BPF_MISC: - break; - default: - return 0; - } - } - return BPF_CLASS(f[len - 1].code) == BPF_RET; -} +/* + * Copyright (c) 1999 - 2005 NetGroup, Politecnico di Torino (Italy) + * Copyright (c) 2005 CACE Technologies, Davis (California) + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the Politecnico di Torino, CACE Technologies + * nor the names of its contributors may be used to endorse or promote + * products derived from this software without specific prior written + * permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#include + +#ifndef WIN_NT_DRIVER +#include +#else +#include +#endif + +#include "win_bpf.h" + +#include "debug.h" + +#include "valid_insns.h" + +#define EXTRACT_SHORT(p)\ + ((u_short)\ + ((u_short)*((u_char *)p+0)<<8|\ + (u_short)*((u_char *)p+1)<<0)) +#define EXTRACT_LONG(p)\ + ((u_int32)*((u_char *)p+0)<<24|\ + (u_int32)*((u_char *)p+1)<<16|\ + (u_int32)*((u_char *)p+2)<<8|\ + (u_int32)*((u_char *)p+3)<<0) + + +u_int bpf_filter(pc, p, wirelen, buflen,mem_ex,tme,time_ref) + register struct bpf_insn *pc; + register u_char *p; + u_int wirelen; + register u_int buflen; + PMEM_TYPE mem_ex; + PTME_CORE tme; + struct time_conv *time_ref; + +{ + register u_int32 A, X; + register int k; + //u_int32 j,tmp; + //u_short tmp2; + + int32 mem[BPF_MEMWORDS]; + + if (pc == 0) + /* + * No filter means accept all. + */ + return (u_int)-1; + A = 0; + X = 0; + --pc; + while (1) { + ++pc; + switch (pc->code) { + + default: + + return 0; + + case BPF_RET|BPF_K: + return (u_int)pc->k; + + case BPF_RET|BPF_A: + return (u_int)A; + + case BPF_LD|BPF_W|BPF_ABS: + k = pc->k; + if (k + sizeof(int32) > buflen) { + return 0; + } + A = EXTRACT_LONG(&p[k]); + continue; + + case BPF_LD|BPF_H|BPF_ABS: + k = pc->k; + if (k + sizeof(short) > buflen) { + return 0; + } + A = EXTRACT_SHORT(&p[k]); + continue; + + case BPF_LD|BPF_B|BPF_ABS: + k = pc->k; + if ((int)k >= (int)buflen) { + return 0; + } + A = p[k]; + continue; + + case BPF_LD|BPF_W|BPF_LEN: + A = wirelen; + continue; + + case BPF_LDX|BPF_W|BPF_LEN: + X = wirelen; + continue; + + case BPF_LD|BPF_W|BPF_IND: + k = X + pc->k; + if (k + sizeof(int32) > buflen) { + return 0; + } + A = EXTRACT_LONG(&p[k]); + continue; + + case BPF_LD|BPF_H|BPF_IND: + k = X + pc->k; + if (k + sizeof(short) > buflen) { + return 0; + } + A = EXTRACT_SHORT(&p[k]); + continue; + + case BPF_LD|BPF_B|BPF_IND: + k = X + pc->k; + if ((int)k >= (int)buflen) { + return 0; + } + A = p[k]; + continue; + + case BPF_LDX|BPF_MSH|BPF_B: + k = pc->k; + if ((int)k >= (int)buflen) { + return 0; + } + X = (p[pc->k] & 0xf) << 2; + continue; + + case BPF_LD|BPF_IMM: + A = pc->k; + continue; + + case BPF_LDX|BPF_IMM: + X = pc->k; + continue; + + case BPF_LD|BPF_MEM: + A = mem[pc->k]; + continue; + + case BPF_LDX|BPF_MEM: + X = mem[pc->k]; + continue; + +#ifdef __NPF_x86__ + // + // these instructions use the TME extensions, + // not supported on x86-64 and IA64 architectures. + // + + /* LD NO PACKET INSTRUCTIONS */ + + case BPF_LD|BPF_MEM_EX_IMM|BPF_B: + A= mem_ex->buffer[pc->k]; + continue; + + case BPF_LDX|BPF_MEM_EX_IMM|BPF_B: + X= mem_ex->buffer[pc->k]; + continue; + + case BPF_LD|BPF_MEM_EX_IMM|BPF_H: + A = EXTRACT_SHORT(&mem_ex->buffer[pc->k]); + continue; + + case BPF_LDX|BPF_MEM_EX_IMM|BPF_H: + X = EXTRACT_SHORT(&mem_ex->buffer[pc->k]); + continue; + + case BPF_LD|BPF_MEM_EX_IMM|BPF_W: + A = EXTRACT_LONG(&mem_ex->buffer[pc->k]); + continue; + + case BPF_LDX|BPF_MEM_EX_IMM|BPF_W: + X = EXTRACT_LONG(&mem_ex->buffer[pc->k]); + continue; + + case BPF_LD|BPF_MEM_EX_IND|BPF_B: + k = X + pc->k; + if ((int32)k>= (int32)mem_ex->size) { + return 0; + } + A= mem_ex->buffer[k]; + continue; + + case BPF_LD|BPF_MEM_EX_IND|BPF_H: + k = X + pc->k; + if ((int32)(k+1)>= (int32)mem_ex->size) { + return 0; + } + A=EXTRACT_SHORT((uint32*)&mem_ex->buffer[k]); + continue; + + case BPF_LD|BPF_MEM_EX_IND|BPF_W: + k = X + pc->k; + if ((int32)(k+3)>= (int32)mem_ex->size) { + return 0; + } + A=EXTRACT_LONG((uint32*)&mem_ex->buffer[k]); + continue; +/* END LD NO PACKET INSTRUCTIONS */ +#endif //__NPF_x86__ + + case BPF_ST: + mem[pc->k] = A; + continue; + + case BPF_STX: + mem[pc->k] = X; + continue; + +#ifdef __NPF_x86__ + // + // these instructions use the TME extensions, + // not supported on x86-64 and IA64 architectures. + // + + /* STORE INSTRUCTIONS */ + case BPF_ST|BPF_MEM_EX_IMM|BPF_B: + mem_ex->buffer[pc->k]=(uint8)A; + continue; + + case BPF_STX|BPF_MEM_EX_IMM|BPF_B: + mem_ex->buffer[pc->k]=(uint8)X; + continue; + + case BPF_ST|BPF_MEM_EX_IMM|BPF_W: + tmp=A; + *(uint32*)&(mem_ex->buffer[pc->k])=EXTRACT_LONG(&tmp); + continue; + + case BPF_STX|BPF_MEM_EX_IMM|BPF_W: + tmp=X; + *(uint32*)&(mem_ex->buffer[pc->k])=EXTRACT_LONG(&tmp); + continue; + + case BPF_ST|BPF_MEM_EX_IMM|BPF_H: + tmp2=(uint16)A; + *(uint16*)&mem_ex->buffer[pc->k]=EXTRACT_SHORT(&tmp2); + continue; + + case BPF_STX|BPF_MEM_EX_IMM|BPF_H: + tmp2=(uint16)X; + *(uint16*)&mem_ex->buffer[pc->k]=EXTRACT_SHORT(&tmp2); + continue; + + case BPF_ST|BPF_MEM_EX_IND|BPF_B: + mem_ex->buffer[pc->k+X]=(uint8)A; + + case BPF_ST|BPF_MEM_EX_IND|BPF_W: + tmp=A; + *(uint32*)&mem_ex->buffer[pc->k+X]=EXTRACT_LONG(&tmp); + continue; + + case BPF_ST|BPF_MEM_EX_IND|BPF_H: + tmp2=(uint16)A; + *(uint16*)&mem_ex->buffer[pc->k+X]=EXTRACT_SHORT(&tmp2); + continue; +/* END STORE INSTRUCTIONS */ + +#endif //__NPF_x86__ + + case BPF_JMP|BPF_JA: + pc += pc->k; + continue; + + case BPF_JMP|BPF_JGT|BPF_K: + pc += ((int)A > (int)pc->k) ? pc->jt : pc->jf; + continue; + + case BPF_JMP|BPF_JGE|BPF_K: + pc += ((int)A >= (int)pc->k) ? pc->jt : pc->jf; + continue; + + case BPF_JMP|BPF_JEQ|BPF_K: + pc += ((int)A == (int)pc->k) ? pc->jt : pc->jf; + continue; + + case BPF_JMP|BPF_JSET|BPF_K: + pc += (A & pc->k) ? pc->jt : pc->jf; + continue; + + case BPF_JMP|BPF_JGT|BPF_X: + pc += (A > X) ? pc->jt : pc->jf; + continue; + + case BPF_JMP|BPF_JGE|BPF_X: + pc += (A >= X) ? pc->jt : pc->jf; + continue; + + case BPF_JMP|BPF_JEQ|BPF_X: + pc += (A == X) ? pc->jt : pc->jf; + continue; + + case BPF_JMP|BPF_JSET|BPF_X: + pc += (A & X) ? pc->jt : pc->jf; + continue; + + case BPF_ALU|BPF_ADD|BPF_X: + A += X; + continue; + + case BPF_ALU|BPF_SUB|BPF_X: + A -= X; + continue; + + case BPF_ALU|BPF_MUL|BPF_X: + A *= X; + continue; + + case BPF_ALU|BPF_DIV|BPF_X: + if (X == 0) + return 0; + A /= X; + continue; + + case BPF_ALU|BPF_AND|BPF_X: + A &= X; + continue; + + case BPF_ALU|BPF_OR|BPF_X: + A |= X; + continue; + + case BPF_ALU|BPF_LSH|BPF_X: + A <<= X; + continue; + + case BPF_ALU|BPF_RSH|BPF_X: + A >>= X; + continue; + + case BPF_ALU|BPF_ADD|BPF_K: + A += pc->k; + continue; + + case BPF_ALU|BPF_SUB|BPF_K: + A -= pc->k; + continue; + + case BPF_ALU|BPF_MUL|BPF_K: + A *= pc->k; + continue; + + case BPF_ALU|BPF_DIV|BPF_K: + A /= pc->k; + continue; + + case BPF_ALU|BPF_AND|BPF_K: + A &= pc->k; + continue; + + case BPF_ALU|BPF_OR|BPF_K: + A |= pc->k; + continue; + + case BPF_ALU|BPF_LSH|BPF_K: + A <<= pc->k; + continue; + + case BPF_ALU|BPF_RSH|BPF_K: + A >>= pc->k; + continue; + + case BPF_ALU|BPF_NEG: + (int)A = -((int)A); + continue; + + case BPF_MISC|BPF_TAX: + X = A; + continue; + + case BPF_MISC|BPF_TXA: + A = X; + continue; + +#ifdef __NPF_x86__ + // + // these instructions use the TME extensions, + // not supported on x86-64 and IA64 architectures. + // + + /* TME INSTRUCTIONS */ + case BPF_MISC|BPF_TME|BPF_LOOKUP: + j=lookup_frontend(mem_ex,tme,pc->k,time_ref); + if (j==TME_ERROR) + return 0; + pc += (j == TME_TRUE) ? pc->jt : pc->jf; + continue; + + case BPF_MISC|BPF_TME|BPF_EXECUTE: + if (execute_frontend(mem_ex,tme,wirelen,pc->k)==TME_ERROR) + return 0; + continue; + + case BPF_MISC|BPF_TME|BPF_SET_ACTIVE: + if (set_active_tme_block(tme,pc->k)==TME_ERROR) + return 0; + continue; + + case BPF_MISC|BPF_TME|BPF_GET_REGISTER_VALUE: + if (get_tme_block_register(&tme->block_data[tme->working],mem_ex,pc->k,&j)==TME_ERROR) + return 0; + A=j; + continue; + + case BPF_MISC|BPF_TME|BPF_SET_REGISTER_VALUE: + if (set_tme_block_register(&tme->block_data[tme->working],mem_ex,pc->k,A,FALSE)==TME_ERROR) + return 0; + continue; + /* END TME INSTRUCTIONS */ + +#endif //__NPF_x86__ + + } + } +} + +//------------------------------------------------------------------- + +u_int bpf_filter_with_2_buffers(pc, p, pd, headersize, wirelen, buflen, mem_ex,tme,time_ref) + register struct bpf_insn *pc; + register u_char *p; + register u_char *pd; + register int headersize; + u_int wirelen; + register u_int buflen; + PMEM_TYPE mem_ex; + PTME_CORE tme; + struct time_conv *time_ref; +{ + register u_int32 A, X; + register int k; + int32 mem[BPF_MEMWORDS]; +// u_int32 j,tmp; +// u_short tmp2; + + if (pc == 0) + /* + * No filter means accept all. + */ + return (u_int)-1; + A = 0; + X = 0; + --pc; + while (1) { + ++pc; + switch (pc->code) { + + default: + + return 0; + + case BPF_RET|BPF_K: + return (u_int)pc->k; + + case BPF_RET|BPF_A: + return (u_int)A; + + case BPF_LD|BPF_W|BPF_ABS: + k = pc->k; + if (k + 4 > (int)buflen) { + return 0; + } + + if(k + 4 <= headersize) + A = EXTRACT_LONG(&p[k]); + else if(k + 3 == headersize) + { + A= (u_int32)*((u_char *)p+k)<<24| + (u_int32)*((u_char *)p+k+1)<<16| + (u_int32)*((u_char *)p+k+2)<<8| + (u_int32)*((u_char *)pd+k-headersize); + } + else if(k + 2 == headersize) + { + A= (u_int32)*((u_char *)p+k)<<24| + (u_int32)*((u_char *)p+k+1)<<16| + (u_int32)*((u_char *)pd+k-headersize)<<8| + (u_int32)*((u_char *)pd+k-headersize+1); + } + else if(k + 1 == headersize){ + A= (u_int32)*((u_char *)p+k)<<24| + (u_int32)*((u_char *)pd+k-headersize+1)<<16| + (u_int32)*((u_char *)pd+k-headersize+2)<<8| + (u_int32)*((u_char *)pd+k-headersize+3); + } + else + A = EXTRACT_LONG(&pd[k-headersize]); + + continue; + + case BPF_LD|BPF_H|BPF_ABS: + k = pc->k; + if (k + sizeof(short) > buflen) + { + return 0; + } + + if(k + 2 <= headersize) + A = EXTRACT_SHORT(&p[k]); + else if(k + 1 == headersize) + { + A= (u_short)*((u_char *)p+k)<<8| + (u_short)*((u_char *)pd+k-headersize); + } + else + A = EXTRACT_SHORT(&pd[k-headersize]); + + continue; + + case BPF_LD|BPF_B|BPF_ABS: + k = pc->k; + if ((int)k >= (int)buflen) { + return 0; + } + + if(k +(int) sizeof(char) <= headersize) + A = p[k]; + else + A = pd[k-headersize]; + + continue; + + case BPF_LD|BPF_W|BPF_LEN: + A = wirelen; + continue; + + case BPF_LDX|BPF_W|BPF_LEN: + X = wirelen; + continue; + + case BPF_LD|BPF_W|BPF_IND: + k = X + pc->k; + if (k + sizeof(int32) > buflen) { + return 0; + } + + if(k + 4 <= headersize) + A = EXTRACT_LONG(&p[k]); + else if(k + 3 == headersize) + { + A= (u_int32)*((u_char *)p+k)<<24| + (u_int32)*((u_char *)p+k+1)<<16| + (u_int32)*((u_char *)p+k+2)<<8| + (u_int32)*((u_char *)pd+k-headersize); + } + else if(k + 2 == headersize) + { + A= (u_int32)*((u_char *)p+k)<<24| + (u_int32)*((u_char *)p+k+1)<<16| + (u_int32)*((u_char *)pd+k-headersize)<<8| + (u_int32)*((u_char *)pd+k-headersize+1); + } + else if(k + 1 == headersize) + { + A= (u_int32)*((u_char *)p+k)<<24| + (u_int32)*((u_char *)pd+k-headersize+1)<<16| + (u_int32)*((u_char *)pd+k-headersize+2)<<8| + (u_int32)*((u_char *)pd+k-headersize+3); + } + else + A = EXTRACT_LONG(&pd[k-headersize]); + + continue; + + case BPF_LD|BPF_H|BPF_IND: + k = X + pc->k; + if (k + 2 > (int)buflen) { + return 0; + } + + if(k + 2 <= headersize) + A = EXTRACT_SHORT(&p[k]); + else if(k +1 == headersize) + { + A= (u_short)*((u_char *)p+k)<<8| + (u_short)*((u_char *)pd+k-headersize); + } + else + A = EXTRACT_SHORT(&pd[k-headersize]); + + continue; + + case BPF_LD|BPF_B|BPF_IND: + k = X + pc->k; + if ((int)k >= (int)buflen) { + return 0; + } + + if(k <= headersize) + A = p[k]; + else + A = pd[k-headersize]; + + continue; + + case BPF_LDX|BPF_MSH|BPF_B: + k = pc->k; + if ((int)k >= (int)buflen) { + return 0; + } + + if((int)(pc->k) <= headersize) + X = (p[pc->k] & 0xf) << 2; + else + X = (pd[(pc->k)-headersize] & 0xf) << 2; + + continue; + + case BPF_LD|BPF_IMM: + A = pc->k; + continue; + + case BPF_LDX|BPF_IMM: + X = pc->k; + continue; + + case BPF_LD|BPF_MEM: + A = mem[pc->k]; + continue; + + case BPF_LDX|BPF_MEM: + X = mem[pc->k]; + continue; + +#ifdef __NPF_x86__ + // + // these instructions use the TME extensions, + // not supported on x86-64 and IA64 architectures. + // + + /* LD NO PACKET INSTRUCTIONS */ + + case BPF_LD|BPF_MEM_EX_IMM|BPF_B: + A= mem_ex->buffer[pc->k]; + continue; + + case BPF_LDX|BPF_MEM_EX_IMM|BPF_B: + X= mem_ex->buffer[pc->k]; + continue; + + case BPF_LD|BPF_MEM_EX_IMM|BPF_H: + A = EXTRACT_SHORT(&mem_ex->buffer[pc->k]); + continue; + + case BPF_LDX|BPF_MEM_EX_IMM|BPF_H: + X = EXTRACT_SHORT(&mem_ex->buffer[pc->k]); + continue; + + case BPF_LD|BPF_MEM_EX_IMM|BPF_W: + A = EXTRACT_LONG(&mem_ex->buffer[pc->k]); + continue; + + case BPF_LDX|BPF_MEM_EX_IMM|BPF_W: + X = EXTRACT_LONG(&mem_ex->buffer[pc->k]); + continue; + + case BPF_LD|BPF_MEM_EX_IND|BPF_B: + k = X + pc->k; + if ((int32)k>= (int32)mem_ex->size) { + return 0; + } + A= mem_ex->buffer[k]; + continue; + + case BPF_LD|BPF_MEM_EX_IND|BPF_H: + k = X + pc->k; + if ((int32)(k+1)>= (int32)mem_ex->size) { + return 0; + } + A=EXTRACT_SHORT((uint32*)&mem_ex->buffer[k]); + continue; + + case BPF_LD|BPF_MEM_EX_IND|BPF_W: + k = X + pc->k; + if ((int32)(k+3)>= (int32)mem_ex->size) { + return 0; + } + A=EXTRACT_LONG((uint32*)&mem_ex->buffer[k]); + continue; + /* END LD NO PACKET INSTRUCTIONS */ + +#endif //__NPF_x86__ + + case BPF_ST: + mem[pc->k] = A; + continue; + + case BPF_STX: + mem[pc->k] = X; + continue; + +#ifdef __NPF_x86__ + // + // these instructions use the TME extensions, + // not supported on x86-64 and IA64 architectures. + // + + /* STORE INSTRUCTIONS */ + case BPF_ST|BPF_MEM_EX_IMM|BPF_B: + mem_ex->buffer[pc->k]=(uint8)A; + continue; + + case BPF_STX|BPF_MEM_EX_IMM|BPF_B: + mem_ex->buffer[pc->k]=(uint8)X; + continue; + + case BPF_ST|BPF_MEM_EX_IMM|BPF_W: + tmp=A; + *(uint32*)&(mem_ex->buffer[pc->k])=EXTRACT_LONG(&tmp); + continue; + + case BPF_STX|BPF_MEM_EX_IMM|BPF_W: + tmp=X; + *(uint32*)&(mem_ex->buffer[pc->k])=EXTRACT_LONG(&tmp); + continue; + + case BPF_ST|BPF_MEM_EX_IMM|BPF_H: + tmp2=(uint16)A; + *(uint16*)&mem_ex->buffer[pc->k]=EXTRACT_SHORT(&tmp2); + continue; + + case BPF_STX|BPF_MEM_EX_IMM|BPF_H: + tmp2=(uint16)X; + *(uint16*)&mem_ex->buffer[pc->k]=EXTRACT_SHORT(&tmp2); + continue; + + case BPF_ST|BPF_MEM_EX_IND|BPF_B: + mem_ex->buffer[pc->k+X]=(uint8)A; + + case BPF_ST|BPF_MEM_EX_IND|BPF_W: + tmp=A; + *(uint32*)&mem_ex->buffer[pc->k+X]=EXTRACT_LONG(&tmp); + continue; + + case BPF_ST|BPF_MEM_EX_IND|BPF_H: + tmp2=(uint16)A; + *(uint16*)&mem_ex->buffer[pc->k+X]=EXTRACT_SHORT(&tmp2); + continue; + /* END STORE INSTRUCTIONS */ + +#endif //__NPF_x86__ + + case BPF_JMP|BPF_JA: + pc += pc->k; + continue; + + case BPF_JMP|BPF_JGT|BPF_K: + pc += ((int)A > (int)pc->k) ? pc->jt : pc->jf; + continue; + + case BPF_JMP|BPF_JGE|BPF_K: + pc += ((int)A >= (int)pc->k) ? pc->jt : pc->jf; + continue; + + case BPF_JMP|BPF_JEQ|BPF_K: + pc += ((int)A == (int)pc->k) ? pc->jt : pc->jf; + continue; + + case BPF_JMP|BPF_JSET|BPF_K: + pc += (A & pc->k) ? pc->jt : pc->jf; + continue; + + case BPF_JMP|BPF_JGT|BPF_X: + pc += (A > X) ? pc->jt : pc->jf; + continue; + + case BPF_JMP|BPF_JGE|BPF_X: + pc += (A >= X) ? pc->jt : pc->jf; + continue; + + case BPF_JMP|BPF_JEQ|BPF_X: + pc += (A == X) ? pc->jt : pc->jf; + continue; + + case BPF_JMP|BPF_JSET|BPF_X: + pc += (A & X) ? pc->jt : pc->jf; + continue; + + case BPF_ALU|BPF_ADD|BPF_X: + A += X; + continue; + + case BPF_ALU|BPF_SUB|BPF_X: + A -= X; + continue; + + case BPF_ALU|BPF_MUL|BPF_X: + A *= X; + continue; + + case BPF_ALU|BPF_DIV|BPF_X: + if (X == 0) + return 0; + A /= X; + continue; + + case BPF_ALU|BPF_AND|BPF_X: + A &= X; + continue; + + case BPF_ALU|BPF_OR|BPF_X: + A |= X; + continue; + + case BPF_ALU|BPF_LSH|BPF_X: + A <<= X; + continue; + + case BPF_ALU|BPF_RSH|BPF_X: + A >>= X; + continue; + + case BPF_ALU|BPF_ADD|BPF_K: + A += pc->k; + continue; + + case BPF_ALU|BPF_SUB|BPF_K: + A -= pc->k; + continue; + + case BPF_ALU|BPF_MUL|BPF_K: + A *= pc->k; + continue; + + case BPF_ALU|BPF_DIV|BPF_K: + A /= pc->k; + continue; + + case BPF_ALU|BPF_AND|BPF_K: + A &= pc->k; + continue; + + case BPF_ALU|BPF_OR|BPF_K: + A |= pc->k; + continue; + + case BPF_ALU|BPF_LSH|BPF_K: + A <<= pc->k; + continue; + + case BPF_ALU|BPF_RSH|BPF_K: + A >>= pc->k; + continue; + + case BPF_ALU|BPF_NEG: + (int)A = -((int)A); + continue; + + case BPF_MISC|BPF_TAX: + X = A; + continue; + + case BPF_MISC|BPF_TXA: + A = X; + continue; + +#ifdef __NPF_x86__ + // + // these instructions use the TME extensions, + // not supported on x86-64 and IA64 architectures. + // + + /* TME INSTRUCTIONS */ + case BPF_MISC|BPF_TME|BPF_LOOKUP: + j=lookup_frontend(mem_ex,tme,pc->k,time_ref); + if (j==TME_ERROR) + return 0; + pc += (j == TME_TRUE) ? pc->jt : pc->jf; + continue; + + case BPF_MISC|BPF_TME|BPF_EXECUTE: + if (execute_frontend(mem_ex,tme,wirelen,pc->k)==TME_ERROR) + return 0; + continue; + + case BPF_MISC|BPF_TME|BPF_SET_ACTIVE: + if (set_active_tme_block(tme,pc->k)==TME_ERROR) + return 0; + continue; + + case BPF_MISC|BPF_TME|BPF_GET_REGISTER_VALUE: + if (get_tme_block_register(&tme->block_data[tme->working],mem_ex,pc->k,&j)==TME_ERROR) + return 0; + A=j; + continue; + + case BPF_MISC|BPF_TME|BPF_SET_REGISTER_VALUE: + if (set_tme_block_register(&tme->block_data[tme->working],mem_ex,pc->k,A,FALSE)==TME_ERROR) + return 0; + continue; + /* END TME INSTRUCTIONS */ + +#endif //__NPF_x86__ + + } + } +} + +int32 +bpf_validate(f, len,mem_ex_size) + struct bpf_insn *f; + int32 len; + uint32 mem_ex_size; +{ + register uint32 i, from; + register int32 j; + register struct bpf_insn *p; + int32 flag; + + if (len < 1) + return 0; + + for (i = 0; i < (uint32)len; ++i) { + p = &f[i]; + + IF_LOUD(DbgPrint("Validating program");) + + flag=0; + for(j=0;jcode==valid_instructions[j]) + flag=1; + if (flag==0) + return 0; + + IF_LOUD(DbgPrint("Validating program: no unknown instructions");) + + switch (BPF_CLASS(p->code)) { + /* + * Check that memory operations use valid addresses. + */ + case BPF_LD: + case BPF_LDX: + switch (BPF_MODE(p->code)) { + case BPF_IMM: + break; + case BPF_ABS: + case BPF_IND: + case BPF_MSH: + break; + case BPF_MEM: + if (p->k >= BPF_MEMWORDS) + return 0; + break; + case BPF_LEN: + break; + default: + return 0; + } + IF_LOUD(DbgPrint("Validating program: no wrong LD memory locations");) + break; + case BPF_ST: + case BPF_STX: +#ifdef __NPF_x86__ + if ((p->code &BPF_MEM_EX_IMM) == BPF_MEM_EX_IMM) + { + /* + * Check if key stores use valid addresses + */ + switch (BPF_SIZE(p->code)) { + + case BPF_W: + if (p->k+3 >= mem_ex_size) + return 0; + break; + + case BPF_H: + if (p->k+1 >= mem_ex_size) + return 0; + break; + + case BPF_B: + if (p->k >= mem_ex_size) + return 0; + break; + } + } + else +#endif //__NPF_x86__ + { + if ((p->code & BPF_MEM_EX_IND) != BPF_MEM_EX_IND) + { + if (p->k >= BPF_MEMWORDS) + return 0; + } + } + IF_LOUD(DbgPrint("Validating program: no wrong ST memory locations");) + break; + case BPF_ALU: + switch (BPF_OP(p->code)) { + case BPF_ADD: + case BPF_SUB: + case BPF_OR: + case BPF_AND: + case BPF_LSH: + case BPF_RSH: + case BPF_NEG: + break; + case BPF_DIV: + /* + * Check for constant division by 0. + */ + if (BPF_RVAL(p->code) == BPF_K && p->k == 0) + return 0; + default: + return 0; + } + break; + case BPF_JMP: + /* + * Check that jumps are within the code block, + * and that unconditional branches don't go + * backwards as a result of an overflow. + * Unconditional branches have a 32-bit offset, + * so they could overflow; we check to make + * sure they don't. Conditional branches have + * an 8-bit offset, and the from address is <= + * BPF_MAXINSNS, and we assume that BPF_MAXINSNS + * is sufficiently small that adding 255 to it + * won't overflow. + * + * We know that len is <= BPF_MAXINSNS, and we + * assume that BPF_MAXINSNS is < the maximum size + * of a u_int, so that i + 1 doesn't overflow. + */ + from = i + 1; + switch (BPF_OP(p->code)) { + case BPF_JA: + if (from + p->k < from || from + p->k >= (uint32)len) + return 0; + break; + case BPF_JEQ: + case BPF_JGT: + case BPF_JGE: + case BPF_JSET: + if (from + p->jt >= (uint32)len || from + p->jf >= (uint32)len) + return 0; + break; + default: + return 0; + } + IF_LOUD(DbgPrint("Validating program: no wrong JUMPS");) + break; + case BPF_RET: + break; + case BPF_MISC: + break; + default: + return 0; + } + } + return BPF_CLASS(f[len - 1].code) == BPF_RET; +} diff --git a/src/See/win_bpf_filter_init.c b/src/See/win_bpf_filter_init.c index 7703a106..471310c0 100644 --- a/src/See/win_bpf_filter_init.c +++ b/src/See/win_bpf_filter_init.c @@ -1,509 +1,509 @@ -/* - * Copyright (c) 2001 - 2003 - * NetGroup, Politecnico di Torino (Italy) - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the Politecnico di Torino nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - */ - -#include - -#include "tme.h" -#include "win_bpf.h" - -/* - * Initialize the filter machine - */ -uint32 bpf_filter_init(register struct bpf_insn *pc, MEM_TYPE *mem_ex, TME_CORE *tme, struct time_conv *time_ref) -{ - register uint32 A, X; - int32 mem[BPF_MEMWORDS]; - register int32 k; - uint32 *tmp; - uint16 *tmp2; - uint32 j; - if (pc == 0) - /* - * No filter means accept all. - */ - return (uint32)-1; - A = 0; - X = 0; - --pc; - while (1) { - ++pc; - switch (pc->code) { - - default: - return 0; - -/* RET INSTRUCTIONS */ - case BPF_RET|BPF_K: - return (uint32)pc->k; - - case BPF_RET|BPF_A: - return (uint32)A; -/* END RET INSTRUCTIONS */ - -/* LD NO PACKET INSTRUCTIONS */ - case BPF_LD|BPF_IMM: - A = pc->k; - continue; - - case BPF_LDX|BPF_IMM: - X = pc->k; - continue; - - case BPF_LD|BPF_MEM: - A = mem[pc->k]; - continue; - - case BPF_LDX|BPF_MEM: - X = mem[pc->k]; - continue; - - case BPF_LD|BPF_MEM_EX_IMM|BPF_B: - A= mem_ex->buffer[pc->k]; - continue; - - case BPF_LDX|BPF_MEM_EX_IMM|BPF_B: - X= mem_ex->buffer[pc->k]; - continue; - - case BPF_LD|BPF_MEM_EX_IMM|BPF_H: - tmp2=(uint16*)&mem_ex->buffer[pc->k]; - __asm - { - push eax - push ebx - mov ebx,tmp2 - xor eax, eax - mov ax, [ebx] - bswap eax - mov A, eax - pop ebx - pop eax - } - continue; - - case BPF_LDX|BPF_MEM_EX_IMM|BPF_H: - tmp2=(uint16*)&mem_ex->buffer[pc->k]; - __asm - { - push eax - push ebx - mov ebx,tmp2 - xor eax, eax - mov ax, [ebx] - bswap eax - mov X, eax - pop ebx - pop eax - } - continue; - - case BPF_LD|BPF_MEM_EX_IMM|BPF_W: - tmp=(uint32*)&mem_ex->buffer[pc->k]; - __asm - { - push eax - push ebx - mov ebx,tmp - mov eax, [ebx] - bswap eax - mov A, eax - pop ebx - pop eax - } - continue; - - case BPF_LDX|BPF_MEM_EX_IMM|BPF_W: - tmp=(uint32*)&mem_ex->buffer[pc->k]; - __asm - { - push eax - push ebx - mov ebx,tmp - mov eax, [ebx] - bswap eax - mov X, eax - pop ebx - pop eax - } - continue; - - case BPF_LD|BPF_MEM_EX_IND|BPF_B: - k = X + pc->k; - if ((int32)k>= (int32)mem_ex->size) { - return 0; - } - A= mem_ex->buffer[k]; - continue; - - case BPF_LD|BPF_MEM_EX_IND|BPF_H: - k = X + pc->k; - if ((int32)(k+1)>= (int32)mem_ex->size) { - return 0; - } - tmp2=(uint16*)&mem_ex->buffer[k]; - __asm - { - push eax - push ebx - mov ebx,tmp2 - xor eax, eax - mov ax, [ebx] - bswap eax - mov A, eax - pop ebx - pop eax - } - continue; - - case BPF_LD|BPF_MEM_EX_IND|BPF_W: - k = X + pc->k; - if ((int32)(k+3)>= (int32)mem_ex->size) { - return 0; - } - tmp=(uint32*)&mem_ex->buffer[k]; - __asm - { - push eax - push ebx - mov ebx,tmp - mov eax, [ebx] - bswap eax - mov A, eax - pop ebx - pop eax - } - continue; -/* END LD NO PACKET INSTRUCTIONS */ - -/* STORE INSTRUCTIONS */ - case BPF_ST: - mem[pc->k] = A; - continue; - - case BPF_STX: - mem[pc->k] = X; - continue; - - case BPF_ST|BPF_MEM_EX_IMM|BPF_B: - mem_ex->buffer[pc->k]=(uint8)A; - continue; - - case BPF_STX|BPF_MEM_EX_IMM|BPF_B: - mem_ex->buffer[pc->k]=(uint8)X; - continue; - - case BPF_ST|BPF_MEM_EX_IMM|BPF_W: - tmp=(uint32*)&mem_ex->buffer[pc->k]; - __asm - { - push eax - push ebx - mov ebx, tmp - mov eax, A - bswap eax - mov [ebx], eax - pop ebx - pop eax - } - continue; - - case BPF_STX|BPF_MEM_EX_IMM|BPF_W: - tmp=(uint32*)&mem_ex->buffer[pc->k]; - __asm - { - push eax - push ebx - mov ebx, tmp - mov eax, X - bswap eax - mov [ebx], eax - pop ebx - pop eax - } - continue; - - case BPF_ST|BPF_MEM_EX_IMM|BPF_H: - tmp2=(uint16*)&mem_ex->buffer[pc->k]; - __asm - { - push eax - push ebx - mov ebx, tmp2 - mov eax, A - xchg ah, al - mov [ebx], ax - pop ebx - pop eax - } - continue; - - case BPF_STX|BPF_MEM_EX_IMM|BPF_H: - tmp2=(uint16*)&mem_ex->buffer[pc->k]; - __asm - { - push eax - push ebx - mov ebx, tmp2 - mov eax, X - xchg ah, al - mov [ebx], ax - pop ebx - pop eax - } - continue; - - case BPF_ST|BPF_MEM_EX_IND|BPF_B: - mem_ex->buffer[pc->k+X]=(uint8)A; - - case BPF_ST|BPF_MEM_EX_IND|BPF_W: - tmp=(uint32*)&mem_ex->buffer[pc->k+X]; - __asm - { - push eax - push ebx - mov ebx, tmp - mov eax, A - bswap eax - mov [ebx], eax - pop ebx - pop eax - } - - continue; - - case BPF_ST|BPF_MEM_EX_IND|BPF_H: - tmp2=(uint16*)&mem_ex->buffer[pc->k+X]; - __asm - { - push eax - push ebx - mov ebx, tmp2 - mov eax, A - xchg ah, al - mov [ebx], ax - pop ebx - pop eax - } - continue; -/* END STORE INSTRUCTIONS */ - -/* JUMP INSTRUCTIONS */ - case BPF_JMP|BPF_JA: - pc += pc->k; - continue; - - case BPF_JMP|BPF_JGT|BPF_K: - pc += ((int32)A > (int32)pc->k) ? pc->jt : pc->jf; - continue; - - case BPF_JMP|BPF_JGE|BPF_K: - pc += ((int32)A >= (int32)pc->k) ? pc->jt : pc->jf; - continue; - - case BPF_JMP|BPF_JEQ|BPF_K: - pc += ((int32)A == (int32)pc->k) ? pc->jt : pc->jf; - continue; - - case BPF_JMP|BPF_JSET|BPF_K: - pc += (A & pc->k) ? pc->jt : pc->jf; - continue; - - case BPF_JMP|BPF_JGT|BPF_X: - pc += (A > X) ? pc->jt : pc->jf; - continue; - - case BPF_JMP|BPF_JGE|BPF_X: - pc += (A >= X) ? pc->jt : pc->jf; - continue; - - case BPF_JMP|BPF_JEQ|BPF_X: - pc += (A == X) ? pc->jt : pc->jf; - continue; - - case BPF_JMP|BPF_JSET|BPF_X: - pc += (A & X) ? pc->jt : pc->jf; - continue; -/* END JUMP INSTRUCTIONS */ - -/* ARITHMETIC INSTRUCTIONS */ - case BPF_ALU|BPF_ADD|BPF_X: - A += X; - continue; - - case BPF_ALU|BPF_SUB|BPF_X: - A -= X; - continue; - - case BPF_ALU|BPF_MUL|BPF_X: - A *= X; - continue; - - case BPF_ALU|BPF_DIV|BPF_X: - if (X == 0) - return 0; - A /= X; - continue; - - case BPF_ALU|BPF_AND|BPF_X: - A &= X; - continue; - - case BPF_ALU|BPF_OR|BPF_X: - A |= X; - continue; - - case BPF_ALU|BPF_LSH|BPF_X: - A <<= X; - continue; - - case BPF_ALU|BPF_RSH|BPF_X: - A >>= X; - continue; - - case BPF_ALU|BPF_ADD|BPF_K: - A += pc->k; - continue; - - case BPF_ALU|BPF_SUB|BPF_K: - A -= pc->k; - continue; - - case BPF_ALU|BPF_MUL|BPF_K: - A *= pc->k; - continue; - - case BPF_ALU|BPF_DIV|BPF_K: - A /= pc->k; - continue; - - case BPF_ALU|BPF_AND|BPF_K: - A &= pc->k; - continue; - - case BPF_ALU|BPF_OR|BPF_K: - A |= pc->k; - continue; - - case BPF_ALU|BPF_LSH|BPF_K: - A <<= pc->k; - continue; - - case BPF_ALU|BPF_RSH|BPF_K: - A >>= pc->k; - continue; - - case BPF_ALU|BPF_NEG: - (int32)A = -((int32)A); - continue; -/* ARITHMETIC INSTRUCTIONS */ - -/* MISC INSTRUCTIONS */ - case BPF_MISC|BPF_TAX: - X = A; - continue; - - case BPF_MISC|BPF_TXA: - A = X; - continue; -/* END MISC INSTRUCTIONS */ - -/* TME INSTRUCTIONS */ - case BPF_MISC|BPF_TME|BPF_LOOKUP: - j=lookup_frontend(mem_ex,tme,pc->k,time_ref); - if (j==TME_ERROR) - return 0; - pc += (j == TME_TRUE) ? pc->jt : pc->jf; - continue; - - case BPF_MISC|BPF_TME|BPF_EXECUTE: - if (execute_frontend(mem_ex,tme,0,pc->k)==TME_ERROR) - return 0; - continue; - - case BPF_MISC|BPF_TME|BPF_INIT: - if (init_tme_block(tme,pc->k)==TME_ERROR) - return 0; - continue; - - case BPF_MISC|BPF_TME|BPF_VALIDATE: - if (validate_tme_block(mem_ex,tme,A,pc->k)==TME_ERROR) - return 0; - continue; - - case BPF_MISC|BPF_TME|BPF_SET_MEMORY: - if (init_extended_memory(pc->k,mem_ex)==TME_ERROR) - return 0; - continue; - - case BPF_MISC|BPF_TME|BPF_SET_ACTIVE: - if (set_active_tme_block(tme,pc->k)==TME_ERROR) - return 0; - continue; - - case BPF_MISC|BPF_TME|BPF_SET_ACTIVE_READ: - if (set_active_tme_block(tme,pc->k)==TME_ERROR) - return 0; - continue; - case BPF_MISC|BPF_TME|BPF_SET_WORKING: - if (pc->k>=MAX_TME_DATA_BLOCKS) - return 0; - tme->working=pc->k; - continue; - - - - case BPF_MISC|BPF_TME|BPF_RESET: - if (reset_tme(tme)==TME_ERROR) - return 0; - continue; - - case BPF_MISC|BPF_TME|BPF_GET_REGISTER_VALUE: - if (get_tme_block_register(&tme->block_data[tme->working],mem_ex,pc->k,&j)==TME_ERROR) - return 0; - A=j; - continue; - - case BPF_MISC|BPF_TME|BPF_SET_REGISTER_VALUE: - if (set_tme_block_register(&tme->block_data[tme->working],mem_ex,pc->k,A,TRUE)==TME_ERROR) - return 0; - continue; - - case BPF_MISC|BPF_TME|BPF_SET_AUTODELETION: - set_autodeletion(&tme->block_data[tme->working],pc->k); - continue; - -/* END TME INSTRUCTIONS */ - - } - } -} - +/* + * Copyright (c) 2001 - 2003 + * NetGroup, Politecnico di Torino (Italy) + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the Politecnico di Torino nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#include + +#include "tme.h" +#include "win_bpf.h" + +/* + * Initialize the filter machine + */ +uint32 bpf_filter_init(register struct bpf_insn *pc, MEM_TYPE *mem_ex, TME_CORE *tme, struct time_conv *time_ref) +{ + register uint32 A, X; + int32 mem[BPF_MEMWORDS]; + register int32 k; + uint32 *tmp; + uint16 *tmp2; + uint32 j; + if (pc == 0) + /* + * No filter means accept all. + */ + return (uint32)-1; + A = 0; + X = 0; + --pc; + while (1) { + ++pc; + switch (pc->code) { + + default: + return 0; + +/* RET INSTRUCTIONS */ + case BPF_RET|BPF_K: + return (uint32)pc->k; + + case BPF_RET|BPF_A: + return (uint32)A; +/* END RET INSTRUCTIONS */ + +/* LD NO PACKET INSTRUCTIONS */ + case BPF_LD|BPF_IMM: + A = pc->k; + continue; + + case BPF_LDX|BPF_IMM: + X = pc->k; + continue; + + case BPF_LD|BPF_MEM: + A = mem[pc->k]; + continue; + + case BPF_LDX|BPF_MEM: + X = mem[pc->k]; + continue; + + case BPF_LD|BPF_MEM_EX_IMM|BPF_B: + A= mem_ex->buffer[pc->k]; + continue; + + case BPF_LDX|BPF_MEM_EX_IMM|BPF_B: + X= mem_ex->buffer[pc->k]; + continue; + + case BPF_LD|BPF_MEM_EX_IMM|BPF_H: + tmp2=(uint16*)&mem_ex->buffer[pc->k]; + __asm + { + push eax + push ebx + mov ebx,tmp2 + xor eax, eax + mov ax, [ebx] + bswap eax + mov A, eax + pop ebx + pop eax + } + continue; + + case BPF_LDX|BPF_MEM_EX_IMM|BPF_H: + tmp2=(uint16*)&mem_ex->buffer[pc->k]; + __asm + { + push eax + push ebx + mov ebx,tmp2 + xor eax, eax + mov ax, [ebx] + bswap eax + mov X, eax + pop ebx + pop eax + } + continue; + + case BPF_LD|BPF_MEM_EX_IMM|BPF_W: + tmp=(uint32*)&mem_ex->buffer[pc->k]; + __asm + { + push eax + push ebx + mov ebx,tmp + mov eax, [ebx] + bswap eax + mov A, eax + pop ebx + pop eax + } + continue; + + case BPF_LDX|BPF_MEM_EX_IMM|BPF_W: + tmp=(uint32*)&mem_ex->buffer[pc->k]; + __asm + { + push eax + push ebx + mov ebx,tmp + mov eax, [ebx] + bswap eax + mov X, eax + pop ebx + pop eax + } + continue; + + case BPF_LD|BPF_MEM_EX_IND|BPF_B: + k = X + pc->k; + if ((int32)k>= (int32)mem_ex->size) { + return 0; + } + A= mem_ex->buffer[k]; + continue; + + case BPF_LD|BPF_MEM_EX_IND|BPF_H: + k = X + pc->k; + if ((int32)(k+1)>= (int32)mem_ex->size) { + return 0; + } + tmp2=(uint16*)&mem_ex->buffer[k]; + __asm + { + push eax + push ebx + mov ebx,tmp2 + xor eax, eax + mov ax, [ebx] + bswap eax + mov A, eax + pop ebx + pop eax + } + continue; + + case BPF_LD|BPF_MEM_EX_IND|BPF_W: + k = X + pc->k; + if ((int32)(k+3)>= (int32)mem_ex->size) { + return 0; + } + tmp=(uint32*)&mem_ex->buffer[k]; + __asm + { + push eax + push ebx + mov ebx,tmp + mov eax, [ebx] + bswap eax + mov A, eax + pop ebx + pop eax + } + continue; +/* END LD NO PACKET INSTRUCTIONS */ + +/* STORE INSTRUCTIONS */ + case BPF_ST: + mem[pc->k] = A; + continue; + + case BPF_STX: + mem[pc->k] = X; + continue; + + case BPF_ST|BPF_MEM_EX_IMM|BPF_B: + mem_ex->buffer[pc->k]=(uint8)A; + continue; + + case BPF_STX|BPF_MEM_EX_IMM|BPF_B: + mem_ex->buffer[pc->k]=(uint8)X; + continue; + + case BPF_ST|BPF_MEM_EX_IMM|BPF_W: + tmp=(uint32*)&mem_ex->buffer[pc->k]; + __asm + { + push eax + push ebx + mov ebx, tmp + mov eax, A + bswap eax + mov [ebx], eax + pop ebx + pop eax + } + continue; + + case BPF_STX|BPF_MEM_EX_IMM|BPF_W: + tmp=(uint32*)&mem_ex->buffer[pc->k]; + __asm + { + push eax + push ebx + mov ebx, tmp + mov eax, X + bswap eax + mov [ebx], eax + pop ebx + pop eax + } + continue; + + case BPF_ST|BPF_MEM_EX_IMM|BPF_H: + tmp2=(uint16*)&mem_ex->buffer[pc->k]; + __asm + { + push eax + push ebx + mov ebx, tmp2 + mov eax, A + xchg ah, al + mov [ebx], ax + pop ebx + pop eax + } + continue; + + case BPF_STX|BPF_MEM_EX_IMM|BPF_H: + tmp2=(uint16*)&mem_ex->buffer[pc->k]; + __asm + { + push eax + push ebx + mov ebx, tmp2 + mov eax, X + xchg ah, al + mov [ebx], ax + pop ebx + pop eax + } + continue; + + case BPF_ST|BPF_MEM_EX_IND|BPF_B: + mem_ex->buffer[pc->k+X]=(uint8)A; + + case BPF_ST|BPF_MEM_EX_IND|BPF_W: + tmp=(uint32*)&mem_ex->buffer[pc->k+X]; + __asm + { + push eax + push ebx + mov ebx, tmp + mov eax, A + bswap eax + mov [ebx], eax + pop ebx + pop eax + } + + continue; + + case BPF_ST|BPF_MEM_EX_IND|BPF_H: + tmp2=(uint16*)&mem_ex->buffer[pc->k+X]; + __asm + { + push eax + push ebx + mov ebx, tmp2 + mov eax, A + xchg ah, al + mov [ebx], ax + pop ebx + pop eax + } + continue; +/* END STORE INSTRUCTIONS */ + +/* JUMP INSTRUCTIONS */ + case BPF_JMP|BPF_JA: + pc += pc->k; + continue; + + case BPF_JMP|BPF_JGT|BPF_K: + pc += ((int32)A > (int32)pc->k) ? pc->jt : pc->jf; + continue; + + case BPF_JMP|BPF_JGE|BPF_K: + pc += ((int32)A >= (int32)pc->k) ? pc->jt : pc->jf; + continue; + + case BPF_JMP|BPF_JEQ|BPF_K: + pc += ((int32)A == (int32)pc->k) ? pc->jt : pc->jf; + continue; + + case BPF_JMP|BPF_JSET|BPF_K: + pc += (A & pc->k) ? pc->jt : pc->jf; + continue; + + case BPF_JMP|BPF_JGT|BPF_X: + pc += (A > X) ? pc->jt : pc->jf; + continue; + + case BPF_JMP|BPF_JGE|BPF_X: + pc += (A >= X) ? pc->jt : pc->jf; + continue; + + case BPF_JMP|BPF_JEQ|BPF_X: + pc += (A == X) ? pc->jt : pc->jf; + continue; + + case BPF_JMP|BPF_JSET|BPF_X: + pc += (A & X) ? pc->jt : pc->jf; + continue; +/* END JUMP INSTRUCTIONS */ + +/* ARITHMETIC INSTRUCTIONS */ + case BPF_ALU|BPF_ADD|BPF_X: + A += X; + continue; + + case BPF_ALU|BPF_SUB|BPF_X: + A -= X; + continue; + + case BPF_ALU|BPF_MUL|BPF_X: + A *= X; + continue; + + case BPF_ALU|BPF_DIV|BPF_X: + if (X == 0) + return 0; + A /= X; + continue; + + case BPF_ALU|BPF_AND|BPF_X: + A &= X; + continue; + + case BPF_ALU|BPF_OR|BPF_X: + A |= X; + continue; + + case BPF_ALU|BPF_LSH|BPF_X: + A <<= X; + continue; + + case BPF_ALU|BPF_RSH|BPF_X: + A >>= X; + continue; + + case BPF_ALU|BPF_ADD|BPF_K: + A += pc->k; + continue; + + case BPF_ALU|BPF_SUB|BPF_K: + A -= pc->k; + continue; + + case BPF_ALU|BPF_MUL|BPF_K: + A *= pc->k; + continue; + + case BPF_ALU|BPF_DIV|BPF_K: + A /= pc->k; + continue; + + case BPF_ALU|BPF_AND|BPF_K: + A &= pc->k; + continue; + + case BPF_ALU|BPF_OR|BPF_K: + A |= pc->k; + continue; + + case BPF_ALU|BPF_LSH|BPF_K: + A <<= pc->k; + continue; + + case BPF_ALU|BPF_RSH|BPF_K: + A >>= pc->k; + continue; + + case BPF_ALU|BPF_NEG: + (int32)A = -((int32)A); + continue; +/* ARITHMETIC INSTRUCTIONS */ + +/* MISC INSTRUCTIONS */ + case BPF_MISC|BPF_TAX: + X = A; + continue; + + case BPF_MISC|BPF_TXA: + A = X; + continue; +/* END MISC INSTRUCTIONS */ + +/* TME INSTRUCTIONS */ + case BPF_MISC|BPF_TME|BPF_LOOKUP: + j=lookup_frontend(mem_ex,tme,pc->k,time_ref); + if (j==TME_ERROR) + return 0; + pc += (j == TME_TRUE) ? pc->jt : pc->jf; + continue; + + case BPF_MISC|BPF_TME|BPF_EXECUTE: + if (execute_frontend(mem_ex,tme,0,pc->k)==TME_ERROR) + return 0; + continue; + + case BPF_MISC|BPF_TME|BPF_INIT: + if (init_tme_block(tme,pc->k)==TME_ERROR) + return 0; + continue; + + case BPF_MISC|BPF_TME|BPF_VALIDATE: + if (validate_tme_block(mem_ex,tme,A,pc->k)==TME_ERROR) + return 0; + continue; + + case BPF_MISC|BPF_TME|BPF_SET_MEMORY: + if (init_extended_memory(pc->k,mem_ex)==TME_ERROR) + return 0; + continue; + + case BPF_MISC|BPF_TME|BPF_SET_ACTIVE: + if (set_active_tme_block(tme,pc->k)==TME_ERROR) + return 0; + continue; + + case BPF_MISC|BPF_TME|BPF_SET_ACTIVE_READ: + if (set_active_tme_block(tme,pc->k)==TME_ERROR) + return 0; + continue; + case BPF_MISC|BPF_TME|BPF_SET_WORKING: + if (pc->k>=MAX_TME_DATA_BLOCKS) + return 0; + tme->working=pc->k; + continue; + + + + case BPF_MISC|BPF_TME|BPF_RESET: + if (reset_tme(tme)==TME_ERROR) + return 0; + continue; + + case BPF_MISC|BPF_TME|BPF_GET_REGISTER_VALUE: + if (get_tme_block_register(&tme->block_data[tme->working],mem_ex,pc->k,&j)==TME_ERROR) + return 0; + A=j; + continue; + + case BPF_MISC|BPF_TME|BPF_SET_REGISTER_VALUE: + if (set_tme_block_register(&tme->block_data[tme->working],mem_ex,pc->k,A,TRUE)==TME_ERROR) + return 0; + continue; + + case BPF_MISC|BPF_TME|BPF_SET_AUTODELETION: + set_autodeletion(&tme->block_data[tme->working],pc->k); + continue; + +/* END TME INSTRUCTIONS */ + + } + } +} + diff --git a/src/See/win_bpf_filter_init.h b/src/See/win_bpf_filter_init.h index c1ad028b..03be5739 100644 --- a/src/See/win_bpf_filter_init.h +++ b/src/See/win_bpf_filter_init.h @@ -1,50 +1,50 @@ -/* - * Copyright (c) 2001 - 2003 - * NetGroup, Politecnico di Torino (Italy) - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the Politecnico di Torino nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - */ - -#ifndef __FILTER_INIT -#define __FILTER_INIT - -#include "tme.h" - -#define INIT_OK 1 -#define INIT_ERROR 0 - -#ifdef __cplusplus -extern "C" -{ -#endif -uint32 bpf_filter_init(register struct bpf_insn *pc,MEM_TYPE *mem_ex, TME_CORE *tme, struct time_conv *time_ref); -#ifdef __cplusplus -} -#endif - -#endif +/* + * Copyright (c) 2001 - 2003 + * NetGroup, Politecnico di Torino (Italy) + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the Politecnico di Torino nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#ifndef __FILTER_INIT +#define __FILTER_INIT + +#include "tme.h" + +#define INIT_OK 1 +#define INIT_ERROR 0 + +#ifdef __cplusplus +extern "C" +{ +#endif +uint32 bpf_filter_init(register struct bpf_insn *pc,MEM_TYPE *mem_ex, TME_CORE *tme, struct time_conv *time_ref); +#ifdef __cplusplus +} +#endif + +#endif diff --git a/src/SeeDll/AdInfo.c b/src/SeeDll/AdInfo.c index 628ce613..998f04d3 100644 --- a/src/SeeDll/AdInfo.c +++ b/src/SeeDll/AdInfo.c @@ -1,1410 +1,1410 @@ -/* - * Copyright (c) 1999 - 2003 - * Politecnico di Torino. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that: (1) source code distributions - * retain the above copyright notice and this paragraph in its entirety, (2) - * distributions including binary code include the above copyright notice and - * this paragraph in its entirety in the documentation or other materials - * provided with the distribution, and (3) all advertising materials mentioning - * features or use of this software display the following acknowledgement: - * ``This product includes software developed by the Politecnico - * di Torino, and its contributors.'' Neither the name of - * the University nor the names of its contributors may be used to endorse - * or promote products derived from this software without specific prior - * written permission. - * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. - */ - -#include - -/* - This file contains the support functions used by packet.dll to retrieve information about installed - adapters, like - - - the adapter list - - the device associated to any adapter and the description of the adapter - - physical parameters like the linkspeed or the link layer type - - the IP and link layer addresses */ - -#define UNICODE 1 - -#include -#include - -#if 0 -#include "WanPacket/WanPacket.h" -#endif - -#define _WINNT4 - -#include -#include -#include -#include -#include - -#include - - -LPADAPTER PacketOpenAdapterNPF(PCHAR AdapterName); -BOOL PacketAddFakeNdisWanAdapter(); - -PADAPTER_INFO AdaptersInfoList = NULL; ///< Head of the adapter information list. This list is populated when packet.dll is linked by the application. -HANDLE AdaptersInfoMutex; ///< Mutex that protects the adapter information list. NOTE: every API that takes an ADAPTER_INFO as parameter assumes that it has been called with the mutex acquired. - -#define FAKE_NDISWAN_ADAPTER_NAME "\\Device\\SEE_GenericDialupAdapter" ///< Name of a fake ndiswan adapter that is always available on 2000/XP/2003, used to capture NCP/LCP packets -#define FAKE_NDISWAN_ADAPTER_DESCRIPTION "Generic dialup adapter" ///< Description of a fake ndiswan adapter that is always available on 2000/XP/2003, used to capture NCP/LCP packets - -extern FARPROC GetAdaptersAddressesPointer; - -#ifdef HAVE_DAG_API -extern dagc_open_handler p_dagc_open; -extern dagc_close_handler p_dagc_close; -extern dagc_getlinktype_handler p_dagc_getlinktype; -extern dagc_getlinkspeed_handler p_dagc_getlinkspeed; -extern dagc_finddevs_handler p_dagc_finddevs; -extern dagc_freedevs_handler p_dagc_freedevs; -#endif /* HAVE_DAG_API */ - -/// Title of error windows -TCHAR szWindowTitle[] = TEXT("PACKET.DLL"); - -ULONG inet_addrU(const WCHAR *cp); - -/*! - \brief Gets the link layer of an adapter, querying the registry. - \param AdapterObject Handle to an open adapter. - \param type Pointer to a NetType structure that will be filled by the function. - \return If the function succeeds, the return value is nonzero, otherwise the return value is zero. - - This function retrieves from the registry the link layer and the speed (in bps) of an opened adapter. - These values are copied in the NetType structure provided by the user. - The LinkType field of the type parameter can have one of the following values: - - - NdisMedium802_3: Ethernet (802.3) - - NdisMediumWan: WAN - - NdisMedium802_5: Token Ring (802.5) - - NdisMediumFddi: FDDI - - NdisMediumAtm: ATM - - NdisMediumArcnet878_2: ARCNET (878.2) -*/ -BOOLEAN PacketGetLinkLayerFromRegistry(LPADAPTER AdapterObject, NetType *type) -{ - BOOLEAN Status; - ULONG IoCtlBufferLength=(sizeof(PACKET_OID_DATA)+sizeof(ULONG)-1); - PPACKET_OID_DATA OidData; - - OidData=GlobalAllocPtr(GMEM_MOVEABLE | GMEM_ZEROINIT,IoCtlBufferLength); - if (OidData == NULL) { - ODS("PacketGetLinkLayerFromRegistry failed\n"); - return FALSE; - } - //get the link-layer type - OidData->Oid = OID_GEN_MEDIA_IN_USE; - OidData->Length = sizeof (ULONG); - Status = PacketRequest(AdapterObject,FALSE,OidData); - type->LinkType=*((UINT*)OidData->Data); - - //get the link-layer speed - OidData->Oid = OID_GEN_LINK_SPEED; - OidData->Length = sizeof (ULONG); - Status = PacketRequest(AdapterObject,FALSE,OidData); - type->LinkSpeed=*((UINT*)OidData->Data)*100; - GlobalFreePtr (OidData); - - ODSEx("Media:%d\n",type->LinkType); - ODSEx("Speed=%d\n",type->LinkSpeed); - - return Status; -} - - -/*! - \brief Scan the registry to retrieve the IP addresses of an adapter. - \param AdapterName String that contains the name of the adapter. - \param buffer A user allocated array of npf_if_addr that will be filled by the function. - \param NEntries Size of the array (in npf_if_addr). - \return If the function succeeds, the return value is nonzero. - - This function grabs from the registry information like the IP addresses, the netmasks - and the broadcast addresses of an interface. The buffer passed by the user is filled with - npf_if_addr structures, each of which contains the data for a single address. If the buffer - is full, the reaming addresses are dropped, therefore set its dimension to sizeof(npf_if_addr) - if you want only the first address. -*/ -BOOLEAN PacketGetAddressesFromRegistry(LPTSTR AdapterName, npf_if_addr* buffer, PLONG NEntries) -{ - char *AdapterNameA; - WCHAR *AdapterNameU; - WCHAR *ifname; - HKEY SystemKey; - HKEY InterfaceKey; - HKEY ParametersKey; - HKEY TcpIpKey; - HKEY UnderTcpKey; - LONG status; - WCHAR String[1024+1]; - DWORD RegType; - ULONG BufLen; - DWORD DHCPEnabled; - struct sockaddr_in *TmpAddr, *TmpBroad; - LONG naddrs,nmasks,StringPos; - DWORD ZeroBroadcast; - - AdapterNameA = (char*)AdapterName; - if(AdapterNameA[1] != 0) { //ASCII - AdapterNameU = SChar2WChar(AdapterNameA); - AdapterName = AdapterNameU; - } else { //Unicode - AdapterNameU = NULL; - } - ifname = wcsrchr(AdapterName, '\\'); - if (ifname == NULL) - ifname = AdapterName; - else - ifname++; - if (wcsncmp(ifname, L"SEE_", 4) == 0) - ifname += 4; - - if( RegOpenKeyEx(HKEY_LOCAL_MACHINE, TEXT("SYSTEM\\CurrentControlSet\\Services\\Tcpip\\Parameters\\Interfaces"), 0, KEY_READ, &UnderTcpKey) == ERROR_SUCCESS) - { - status = RegOpenKeyEx(UnderTcpKey,ifname,0,KEY_READ,&TcpIpKey); - if (status != ERROR_SUCCESS) { - RegCloseKey(UnderTcpKey); - goto fail; - } - } - else - { - - // Query the registry key with the interface's addresses - status = RegOpenKeyEx(HKEY_LOCAL_MACHINE,TEXT("SYSTEM\\CurrentControlSet\\Services"),0,KEY_READ,&SystemKey); - if (status != ERROR_SUCCESS) - goto fail; - status = RegOpenKeyEx(SystemKey,ifname,0,KEY_READ,&InterfaceKey); - if (status != ERROR_SUCCESS) { - RegCloseKey(SystemKey); - RegCloseKey(UnderTcpKey); - goto fail; - } - RegCloseKey(SystemKey); - status = RegOpenKeyEx(InterfaceKey,TEXT("Parameters"),0,KEY_READ,&ParametersKey); - if (status != ERROR_SUCCESS) { - RegCloseKey(InterfaceKey); - RegCloseKey(UnderTcpKey); - goto fail; - } - RegCloseKey(InterfaceKey); - status = RegOpenKeyEx(ParametersKey,TEXT("TcpIp"),0,KEY_READ,&TcpIpKey); - if (status != ERROR_SUCCESS) { - RegCloseKey(ParametersKey); - RegCloseKey(UnderTcpKey); - goto fail; - } - RegCloseKey(ParametersKey); - BufLen = sizeof String; - } - - BufLen = 4; - /* Try to detect if the interface has a zero broadcast addr */ - status=RegQueryValueEx(TcpIpKey,TEXT("UseZeroBroadcast"),NULL,&RegType,(LPBYTE)&ZeroBroadcast,&BufLen); - if (status != ERROR_SUCCESS) - ZeroBroadcast=0; - - BufLen = 4; - /* See if DHCP is used by this system */ - status=RegQueryValueEx(TcpIpKey,TEXT("EnableDHCP"),NULL,&RegType,(LPBYTE)&DHCPEnabled,&BufLen); - if (status != ERROR_SUCCESS) - DHCPEnabled=0; - - - /* Retrieve the addresses */ - if(DHCPEnabled){ - - BufLen = sizeof String; - // Open the key with the addresses - status = RegQueryValueEx(TcpIpKey,TEXT("DhcpIPAddress"),NULL,&RegType,(LPBYTE)String,&BufLen); - if (status != ERROR_SUCCESS) { - RegCloseKey(TcpIpKey); - RegCloseKey(UnderTcpKey); - goto fail; - } - - // scan the key to obtain the addresses - StringPos = 0; - for(naddrs = 0;naddrs <* NEntries;naddrs++){ - TmpAddr = (struct sockaddr_in *) &(buffer[naddrs].IPAddress); - - if((TmpAddr->sin_addr.S_un.S_addr = inet_addrU(String + StringPos))!= -1){ - TmpAddr->sin_family = AF_INET; - - TmpBroad = (struct sockaddr_in *) &(buffer[naddrs].Broadcast); - TmpBroad->sin_family = AF_INET; - if(ZeroBroadcast==0) - TmpBroad->sin_addr.S_un.S_addr = 0xffffffff; // 255.255.255.255 - else - TmpBroad->sin_addr.S_un.S_addr = 0; // 0.0.0.0 - - while(*(String + StringPos) != 0)StringPos++; - StringPos++; - - if(*(String + StringPos) == 0 || (StringPos * sizeof (WCHAR)) >= BufLen) - break; - } - else break; - } - - BufLen = sizeof String; - // Open the key with the netmasks - status = RegQueryValueEx(TcpIpKey,TEXT("DhcpSubnetMask"),NULL,&RegType,(LPBYTE)String,&BufLen); - if (status != ERROR_SUCCESS) { - RegCloseKey(TcpIpKey); - RegCloseKey(UnderTcpKey); - goto fail; - } - - // scan the key to obtain the masks - StringPos = 0; - for(nmasks = 0;nmasks < *NEntries;nmasks++){ - TmpAddr = (struct sockaddr_in *) &(buffer[nmasks].SubnetMask); - - if((TmpAddr->sin_addr.S_un.S_addr = inet_addrU(String + StringPos))!= -1){ - TmpAddr->sin_family = AF_INET; - - while(*(String + StringPos) != 0)StringPos++; - StringPos++; - - if(*(String + StringPos) == 0 || (StringPos * sizeof (WCHAR)) >= BufLen) - break; - } - else break; - } - - // The number of masks MUST be equal to the number of addresses - if(nmasks != naddrs){ - RegCloseKey(TcpIpKey); - RegCloseKey(UnderTcpKey); - goto fail; - } - - } - else{ - - BufLen = sizeof String; - // Open the key with the addresses - status = RegQueryValueEx(TcpIpKey,TEXT("IPAddress"),NULL,&RegType,(LPBYTE)String,&BufLen); - if (status != ERROR_SUCCESS) { - RegCloseKey(TcpIpKey); - RegCloseKey(UnderTcpKey); - goto fail; - } - - // scan the key to obtain the addresses - StringPos = 0; - for(naddrs = 0;naddrs < *NEntries;naddrs++){ - TmpAddr = (struct sockaddr_in *) &(buffer[naddrs].IPAddress); - - if((TmpAddr->sin_addr.S_un.S_addr = inet_addrU(String + StringPos))!= -1){ - TmpAddr->sin_family = AF_INET; - - TmpBroad = (struct sockaddr_in *) &(buffer[naddrs].Broadcast); - TmpBroad->sin_family = AF_INET; - if(ZeroBroadcast==0) - TmpBroad->sin_addr.S_un.S_addr = 0xffffffff; // 255.255.255.255 - else - TmpBroad->sin_addr.S_un.S_addr = 0; // 0.0.0.0 - - while(*(String + StringPos) != 0)StringPos++; - StringPos++; - - if(*(String + StringPos) == 0 || (StringPos * sizeof (WCHAR)) >= BufLen) - break; - } - else break; - } - - BufLen = sizeof String; - // Open the key with the netmasks - status = RegQueryValueEx(TcpIpKey,TEXT("SubnetMask"),NULL,&RegType,(LPBYTE)String,&BufLen); - if (status != ERROR_SUCCESS) { - RegCloseKey(TcpIpKey); - RegCloseKey(UnderTcpKey); - goto fail; - } - - // scan the key to obtain the masks - StringPos = 0; - for(nmasks = 0;nmasks <* NEntries;nmasks++){ - TmpAddr = (struct sockaddr_in *) &(buffer[nmasks].SubnetMask); - - if((TmpAddr->sin_addr.S_un.S_addr = inet_addrU(String + StringPos))!= -1){ - TmpAddr->sin_family = AF_INET; - - while(*(String + StringPos) != 0)StringPos++; - StringPos++; - - if(*(String + StringPos) == 0 || (StringPos * sizeof (WCHAR)) >= BufLen) - break; - } - else break; - } - - // The number of masks MUST be equal to the number of addresses - if(nmasks != naddrs){ - RegCloseKey(TcpIpKey); - RegCloseKey(UnderTcpKey); - goto fail; - } - - } - - *NEntries = naddrs + 1; - - RegCloseKey(TcpIpKey); - RegCloseKey(UnderTcpKey); - - if (status != ERROR_SUCCESS) { - goto fail; - } - - - if (AdapterNameU != NULL) - GlobalFreePtr(AdapterNameU); - return TRUE; - -fail: - if (AdapterNameU != NULL) - GlobalFreePtr(AdapterNameU); - return FALSE; -} - -/*! - \brief Adds the IPv6 addresses of an adapter to the ADAPTER_INFO structure that describes it. - \param AdInfo Pointer to the ADAPTER_INFO structure that keeps the information about the adapter. - \return If the function succeeds, the function returns TRUE. - - \note the structure pointed by AdInfo must be initialized the an properly filled. In particular, AdInfo->Name - must be a valid capture device name. - \note uses the GetAdaptersAddresses() Ip Helper API function, so it works only on systems where IP Helper API - provides it (WinXP and successive). - \note we suppose that we are called after having acquired the AdaptersInfoMutex mutex -*/ -#ifndef _WINNT4 -BOOLEAN PacketAddIP6Addresses(PADAPTER_INFO AdInfo) -{ - ULONG BufLen; - PIP_ADAPTER_ADDRESSES AdBuffer, TmpAddr; - PCHAR OrName; - PIP_ADAPTER_UNICAST_ADDRESS UnicastAddr; - struct sockaddr_storage *Addr; - INT AddrLen; - - ODS("PacketAddIP6Addresses\n"); - - if(GetAdaptersAddressesPointer == NULL) return TRUE; // GetAdaptersAddresses() not present on this system, - // return immediately. - - if(GetAdaptersAddressesPointer(AF_UNSPEC, GAA_FLAG_SKIP_ANYCAST| GAA_FLAG_SKIP_MULTICAST | GAA_FLAG_SKIP_FRIENDLY_NAME, NULL, NULL, &BufLen) != ERROR_BUFFER_OVERFLOW) - { - ODS("PacketAddIP6Addresses: GetAdaptersAddresses Failed\n"); - return FALSE; - } - - ODS("PacketAddIP6Addresses, retrieved needed storage for the call\n"); - - AdBuffer = GlobalAllocPtr(GMEM_MOVEABLE, BufLen); - if (AdBuffer == NULL) { - ODS("PacketAddIP6Addresses: GlobalAlloc Failed\n"); - return FALSE; - } - - if(GetAdaptersAddressesPointer(AF_UNSPEC, GAA_FLAG_SKIP_ANYCAST| GAA_FLAG_SKIP_MULTICAST | GAA_FLAG_SKIP_FRIENDLY_NAME, NULL, AdBuffer, &BufLen) != ERROR_SUCCESS) - { - ODS("PacketGetIP6AddressesIPH: GetAdaptersAddresses Failed\n"); - GlobalFreePtr(AdBuffer); - return FALSE; - } - - ODS("PacketAddIP6Addresses, retrieved addresses\n"); - - // - // Scan the list of addresses obtained from the IP helper API - // - for(TmpAddr = AdBuffer; TmpAddr != NULL; TmpAddr = TmpAddr->Next) - { - OrName = AdInfo->Name + sizeof("\\device\\see_") - 1; - - ODS("PacketAddIP6Addresses, external loop\n"); - if(strcmp(TmpAddr->AdapterName, OrName) == 0) - { - // Found a corresponding adapter, scan its address list - for(UnicastAddr = TmpAddr->FirstUnicastAddress; UnicastAddr != NULL; UnicastAddr = UnicastAddr->Next) - { - ODS("PacketAddIP6Addresses, internal loop\n"); - - AddrLen = UnicastAddr->Address.iSockaddrLength; - Addr = (struct sockaddr_storage *)UnicastAddr->Address.lpSockaddr; - if(Addr->ss_family == AF_INET6) - { - // Be sure not to overflow the addresses buffer of this adapter - if(AdInfo->NNetworkAddresses >= MAX_NETWORK_ADDRESSES) - { - GlobalFreePtr(AdBuffer); - return FALSE; - } - - memcpy(&(AdInfo->NetworkAddresses[AdInfo->NNetworkAddresses].IPAddress), Addr, AddrLen); - memset(&(AdInfo->NetworkAddresses[AdInfo->NNetworkAddresses].SubnetMask), 0, sizeof(struct sockaddr_storage)); - memset(&(AdInfo->NetworkAddresses[AdInfo->NNetworkAddresses].Broadcast), 0, sizeof(struct sockaddr_storage)); - AdInfo->NNetworkAddresses ++; - } - } - } - } - - ODS("PacketAddIP6Addresses, finished parsing the addresses\n"); - - GlobalFreePtr(AdBuffer); - - return TRUE; -} -#endif // _WINNT4 - -/*! - \brief Check if a string contains the "1394" substring - - We prevent opening of firewire adapters since they have non standard behaviors that can cause - problems with winpcap - - \param AdapterDesc NULL-terminated ASCII string with the adapter's description - \return TRUE if the input string contains "1394" -*/ -BOOLEAN IsFireWire(TCHAR *AdapterDesc) -{ - if(wcsstr(AdapterDesc, FIREWIRE_SUBSTR) != NULL) - { - return TRUE; - } - - return FALSE; -} - -/*! - \brief Adds an entry to the adapter description list, gathering its values from the IP Helper API. - \param IphAd PIP_ADAPTER_INFO IP Helper API structure containing the parameters of the adapter that must be added to the list. - \return If the function succeeds, the return value is TRUE. - \note we suppose that we are called after having acquired the AdaptersInfoMutex mutex -*/ -#ifndef _WINNT4 -BOOLEAN AddAdapterIPH(PIP_ADAPTER_INFO IphAd) -{ - PIP_ADAPTER_INFO AdList = NULL; - ULONG OutBufLen=0; - PADAPTER_INFO TmpAdInfo, SAdInfo; - PIP_ADDR_STRING TmpAddrStr; - UINT i; - struct sockaddr_in *TmpAddr; - CHAR TName[256]; - LPADAPTER adapter; - PWCHAR UAdName; - - - // Create the NPF device name from the original device name - strcpy(TName, "\\Device\\SEE_"); - _snprintf(TName + 12, ADAPTER_NAME_LENGTH - 12, "%s", IphAd->AdapterName); - - // Scan the adapters list to see if this one is already present - for(SAdInfo = AdaptersInfoList; SAdInfo != NULL; SAdInfo = SAdInfo->Next) - { - if(strcmp(TName, SAdInfo->Name) == 0) - { - ODS("PacketGetAdaptersIPH: Adapter already present in the list\n"); - goto SkipAd; - } - } - - if(IphAd->Type == IF_TYPE_PPP || IphAd->Type == IF_TYPE_SLIP) - { - if (!WanPacketTestAdapter()) - goto SkipAd; - } - else - { - //convert the string to unicode, as OpenAdapterNPF accepts unicode strings, only. - UAdName = SChar2WChar(TName); - if (UAdName == NULL) - { - ODS("AddAdapterIPH: unable to convert an ASCII string to UNICODE\n"); - goto SkipAd; - } - - adapter = PacketOpenAdapterNPF((PCHAR)UAdName); - GlobalFreePtr(UAdName); - - if(adapter == NULL) - { - // We are not able to open this adapter. Skip to the next one. - ODS("PacketGetAdaptersIPH: unable to open the adapter\n"); - goto SkipAd; - } - else - { - PacketCloseAdapter(adapter); - } - } - - // - // Adapter valid and not yet present in the list. Allocate the ADAPTER_INFO structure - // - TmpAdInfo = GlobalAllocPtr(GMEM_MOVEABLE | GMEM_ZEROINIT, sizeof(ADAPTER_INFO)); - if (TmpAdInfo == NULL) { - ODS("PacketGetAdaptersIPH: GlobalAlloc Failed\n"); - return FALSE; - } - - // Copy the device name - strcpy(TmpAdInfo->Name, TName); - - // Copy the description - _snprintf(TmpAdInfo->Description, ADAPTER_DESC_LENGTH, "%s", IphAd->Description); - - // Copy the MAC address - TmpAdInfo->MacAddressLen = IphAd->AddressLength; - - memcpy(TmpAdInfo->MacAddress, - IphAd->Address, - (MAX_MAC_ADDR_LENGTHIpAddressList, i = 0; TmpAddrStr != NULL; TmpAddrStr = TmpAddrStr->Next, i++) - { - - } - - TmpAdInfo->NetworkAddresses = GlobalAllocPtr(GMEM_MOVEABLE | GMEM_ZEROINIT, MAX_NETWORK_ADDRESSES * sizeof(npf_if_addr)); - if (TmpAdInfo->NetworkAddresses == NULL) { - ODS("PacketGetAdaptersIPH: GlobalAlloc Failed\n"); - GlobalFreePtr(TmpAdInfo); - return FALSE; - } - - // Scan the addresses, convert them to addrinfo structures and put each of them in the list - for(TmpAddrStr = &IphAd->IpAddressList, i = 0; TmpAddrStr != NULL; TmpAddrStr = TmpAddrStr->Next) - { - TmpAddr = (struct sockaddr_in *)&(TmpAdInfo->NetworkAddresses[i].IPAddress); - if((TmpAddr->sin_addr.S_un.S_addr = inet_addr(TmpAddrStr->IpAddress.String))!= INADDR_NONE) - { - TmpAddr->sin_family = AF_INET; - TmpAddr = (struct sockaddr_in *)&(TmpAdInfo->NetworkAddresses[i].SubnetMask); - TmpAddr->sin_addr.S_un.S_addr = inet_addr(TmpAddrStr->IpMask.String); - TmpAddr->sin_family = AF_INET; - TmpAddr = (struct sockaddr_in *)&(TmpAdInfo->NetworkAddresses[i].Broadcast); - TmpAddr->sin_addr.S_un.S_addr = 0xffffffff; // Consider 255.255.255.255 as broadcast address since IP Helper API doesn't provide information about it - TmpAddr->sin_family = AF_INET; - i++; - } - } - - TmpAdInfo->NNetworkAddresses = i; - - // Now Add IPv6 Addresses - PacketAddIP6Addresses(TmpAdInfo); - - if(IphAd->Type == IF_TYPE_PPP || IphAd->Type == IF_TYPE_SLIP) - { - // NdisWan adapter - TmpAdInfo->Flags = INFO_FLAG_NDISWAN_ADAPTER; - } - - // Update the AdaptersInfo list - TmpAdInfo->Next = AdaptersInfoList; - AdaptersInfoList = TmpAdInfo; - -SkipAd: - - return TRUE; -} -#endif // _WINNT4 - - -/*! - \brief Updates the list of the adapters querying the IP Helper API. - \return If the function succeeds, the return value is nonzero. - - This function populates the list of adapter descriptions, retrieving the information from a query to - the IP Helper API. The IP Helper API is used as a support of the standard registry query method to obtain - adapter information, so PacketGetAdaptersIPH() add only information about the adapters that were not - found by PacketGetAdapters(). -*/ -#ifndef _WINNT4 -BOOLEAN PacketGetAdaptersIPH() -{ - PIP_ADAPTER_INFO AdList = NULL; - PIP_ADAPTER_INFO TmpAd; - ULONG OutBufLen=0; - - ODS("PacketGetAdaptersIPH\n"); - - // Find the size of the buffer filled by GetAdaptersInfo - if(GetAdaptersInfo(AdList, &OutBufLen) == ERROR_NOT_SUPPORTED) - { - ODS("IP Helper API not supported on this system!\n"); - return FALSE; - } - - ODS("PacketGetAdaptersIPH: retrieved needed bytes for IPH\n"); - - // Allocate the buffer - AdList = GlobalAllocPtr(GMEM_MOVEABLE, OutBufLen); - if (AdList == NULL) { - ODS("PacketGetAdaptersIPH: GlobalAlloc Failed\n"); - return FALSE; - } - - // Retrieve the adapters information using the IP helper API - GetAdaptersInfo(AdList, &OutBufLen); - - ODS("PacketGetAdaptersIPH: retrieved list from IPH\n"); - - // Scan the list of adapters obtained from the IP helper API, create a new ADAPTER_INFO - // structure for every new adapter and put it in our global list - for(TmpAd = AdList; TmpAd != NULL; TmpAd = TmpAd->Next) - { - AddAdapterIPH(TmpAd); - } - - GlobalFreePtr(AdList); - - return TRUE; -} -#endif // _WINNT4 - - -/*! - \brief Adds an entry to the adapter description list. - \param AdName Name of the adapter to add - \return If the function succeeds, the return value is nonzero. - - Used by PacketGetAdapters(). Queries the registry to fill the PADAPTER_INFO describing the new adapter. -*/ -BOOLEAN AddAdapter(PCHAR AdName, UINT flags) -{ - //this function should acquire the AdaptersInfoMutex, since it's NOT called with an ADAPTER_INFO as parameter - DWORD RegKeySize=0; - LONG Status; - LPADAPTER adapter; - PPACKET_OID_DATA OidData; - int i=0; - PADAPTER_INFO TmpAdInfo; - PADAPTER_INFO TAdInfo; - PWCHAR UAdName; - - ODS("AddAdapter\n"); - - WaitForSingleObject(AdaptersInfoMutex, INFINITE); - - for(TAdInfo = AdaptersInfoList; TAdInfo != NULL; TAdInfo = TAdInfo->Next) - { - if(strcmp(AdName, TAdInfo->Name) == 0) - { - ODS("AddAdapter: Adapter already present in the list\n"); - ReleaseMutex(AdaptersInfoMutex); - return TRUE; - } - } - - UAdName = SChar2WChar(AdName); - - //here we could have released the mutex, but what happens if two threads try to add the same adapter? - //The adapter would be duplicated on the linked list - - if(flags != INFO_FLAG_DONT_EXPORT) - { - - // Try to Open the adapter - adapter = PacketOpenAdapterNPF((PCHAR)UAdName); - - GlobalFreePtr(UAdName); - - if(adapter == NULL) - { - // We are not able to open this adapter. Skip to the next one. - ReleaseMutex(AdaptersInfoMutex); - return FALSE; - } - - // Allocate a buffer to get the vendor description from the driver - OidData = GlobalAllocPtr(GMEM_MOVEABLE | GMEM_ZEROINIT,512); - if (OidData == NULL) - { - ODS("AddAdapter: GlobalAlloc Failed\n"); - PacketCloseAdapter(adapter); - ReleaseMutex(AdaptersInfoMutex); - return FALSE; - } - } - - // - // PacketOpenAdapter was succesful. Consider this a valid adapter and allocate an entry for it - // In the adapter list - // - - TmpAdInfo = GlobalAllocPtr(GMEM_MOVEABLE | GMEM_ZEROINIT, sizeof(ADAPTER_INFO)); - if (TmpAdInfo == NULL) - { - ODS("AddAdapter: GlobalAlloc Failed\n"); - GlobalFreePtr(OidData); - PacketCloseAdapter(adapter); - ReleaseMutex(AdaptersInfoMutex); - return FALSE; - } - - // Copy the device name - strcpy(TmpAdInfo->Name, AdName); - - if(flags != INFO_FLAG_DONT_EXPORT) - { - // Retrieve the adapter description querying the NIC driver - OidData->Oid = OID_GEN_VENDOR_DESCRIPTION; - OidData->Length = 256; - ZeroMemory(OidData->Data, 256); - - Status = PacketRequest(adapter, FALSE, OidData); - - if(Status==0 || ((char*)OidData->Data)[0]==0) - { - ODS("AddAdapter: unable to get a valid adapter description from the NIC driver\n"); - } - - ODSEx("Adapter Description=%s\n\n",OidData->Data); - - // Copy the description - strcpy(TmpAdInfo->Description, OidData->Data); - - PacketGetLinkLayerFromRegistry(adapter, &(TmpAdInfo->LinkLayer)); - - // Retrieve the adapter MAC address querying the NIC driver - OidData->Oid = OID_802_3_CURRENT_ADDRESS; // XXX At the moment only Ethernet is supported. - // Waiting a patch to support other Link Layers - OidData->Length = 256; - ZeroMemory(OidData->Data, 256); - - Status = PacketRequest(adapter, FALSE, OidData); - if(Status) - { - memcpy(TmpAdInfo->MacAddress, OidData->Data, 6); - TmpAdInfo->MacAddressLen = 6; - } - else - { - memset(TmpAdInfo->MacAddress, 0, 6); - TmpAdInfo->MacAddressLen = 0; - } - - // Retrieve IP addresses - TmpAdInfo->NetworkAddresses = GlobalAllocPtr(GMEM_MOVEABLE | GMEM_ZEROINIT, MAX_NETWORK_ADDRESSES * sizeof(npf_if_addr)); - if (TmpAdInfo->NetworkAddresses == NULL) { - ODS("AddAdapter: GlobalAlloc Failed\n"); - PacketCloseAdapter(adapter); - GlobalFreePtr(OidData); - GlobalFreePtr(TmpAdInfo); - ReleaseMutex(AdaptersInfoMutex); - return FALSE; - } - - TmpAdInfo->NNetworkAddresses = MAX_NETWORK_ADDRESSES; - if(!PacketGetAddressesFromRegistry((LPTSTR)TmpAdInfo->Name, TmpAdInfo->NetworkAddresses, &TmpAdInfo->NNetworkAddresses)) - { -#ifndef _WINNT4 - // Try to see if the interface has some IPv6 addresses - TmpAdInfo->NNetworkAddresses = 0; // We have no addresses because PacketGetAddressesFromRegistry() failed - - if(!PacketAddIP6Addresses(TmpAdInfo)) - { -#endif // _WINNT4 - GlobalFreePtr(TmpAdInfo->NetworkAddresses); - TmpAdInfo->NetworkAddresses = NULL; - TmpAdInfo->NNetworkAddresses = 0; -#ifndef _WINNT4 - } -#endif // _WINNT4 - } - -#ifndef _WINNT4 - // Now Add IPv6 Addresses - PacketAddIP6Addresses(TmpAdInfo); -#endif // _WINNT4 - - TmpAdInfo->Flags = INFO_FLAG_NDIS_ADAPTER; // NdisWan adapters are not exported by the NPF driver, - // therefore it's impossible to see them here - - // Free storage - PacketCloseAdapter(adapter); - GlobalFreePtr(OidData); - } - else - { - // Write in the flags that this adapter is firewire - // This will block it in all successive calls - TmpAdInfo->Flags = INFO_FLAG_DONT_EXPORT; - } - - // Update the AdaptersInfo list - TmpAdInfo->Next = AdaptersInfoList; - AdaptersInfoList = TmpAdInfo; - - ReleaseMutex(AdaptersInfoMutex); - return TRUE; -} - - -/*! - \brief Updates the list of the adapters querying the registry. - \return If the function succeeds, the return value is nonzero. - - This function populates the list of adapter descriptions, retrieving the information from the registry. -*/ -BOOLEAN PacketGetAdapters() -{ - HKEY LinkageKey,AdapKey, OneAdapKey; - DWORD RegKeySize=0; - LONG Status; - ULONG Result; - INT i=0,k; - DWORD dim; - DWORD RegType; - WCHAR TName[256]; - CHAR TAName[256]; - TCHAR AdapName[256]; - PTSTR BpStr; - UINT FireWireFlag; - - ODS("PacketGetAdapters\n"); - - Status=RegOpenKeyEx(HKEY_LOCAL_MACHINE, - TEXT("SYSTEM\\CurrentControlSet\\Control\\Class\\{4D36E972-E325-11CE-BFC1-08002BE10318}"), - 0, - KEY_READ, - &AdapKey); - - if ( Status != ERROR_SUCCESS ){ - ODS("PacketGetAdapters: RegOpenKeyEx ( Class\\{networkclassguid} ) Failed\n"); - goto nt4; - } - - i=0; - - ODS("PacketGetAdapters: Cycling through the adapters:\n"); - - // - // Cycle through the entries inside the {4D36E972-E325-11CE-BFC1-08002BE10318} key - // To get the names of the adapters - // - while((Result = RegEnumKey(AdapKey, i, AdapName, sizeof(AdapName)/2)) == ERROR_SUCCESS) - { - i++; - ODSEx(" %d) ", i); - FireWireFlag = 0; - - // - // Get the adapter name from the registry key - // - Status=RegOpenKeyEx(AdapKey, AdapName, 0, KEY_READ, &OneAdapKey); - if ( Status != ERROR_SUCCESS ) - { - ODS("PacketGetAdapters: RegOpenKeyEx ( OneAdapKey ) Failed\n"); - continue; - } - - // - // - // Check if this is a FireWire adapter, looking for "1394" in its ComponentId string. - // We prevent listing FireWire adapters because winpcap can open them, but their interface - // with the OS is broken and they can cause blue screens. - // - dim = sizeof(TName); - Status = RegQueryValueEx(OneAdapKey, - L"ComponentId", - NULL, - NULL, - (PBYTE)TName, - &dim); - - if(Status == ERROR_SUCCESS) - { - if(IsFireWire(TName)) - { - FireWireFlag = INFO_FLAG_DONT_EXPORT; - } - } - - Status=RegOpenKeyEx(OneAdapKey, L"Linkage", 0, KEY_READ, &LinkageKey); - if (Status != ERROR_SUCCESS) - { - RegCloseKey(OneAdapKey); - ODS("PacketGetAdapters: RegOpenKeyEx ( LinkageKey ) Failed\n"); - continue; - } - - dim = sizeof(TName); - Status=RegQueryValueEx(LinkageKey, - L"Export", - NULL, - NULL, - (PBYTE)TName, - &dim); - - if(Status != ERROR_SUCCESS) - { - RegCloseKey(OneAdapKey); - RegCloseKey(LinkageKey); - ODS("Name = SKIPPED (error reading the key)\n"); - continue; - } - - // Convert to ASCII - WideCharToMultiByte( - CP_ACP, - 0, - TName, // wide-character string - -1, // number of chars in string - TAName + sizeof("\\Device\\SEE_") - sizeof("\\Device\\"), // buffer for new string - sizeof(TAName) - sizeof("\\Device\\SEE_") + sizeof("\\Device\\"), // size of buffer - NULL, - NULL); - - // Put the \Device\NPF_ string at the beginning of the name - memcpy(TAName, "\\Device\\SEE_", sizeof("\\Device\\SEE_") - 1); - - // If the adapter is valid, add it to the list. - AddAdapter(TAName, FireWireFlag); - - RegCloseKey(OneAdapKey); - RegCloseKey(LinkageKey); - - } // while enum reg keys - - RegCloseKey(AdapKey); - -nt4: - // - // no adapters were found under {4D36E972-E325-11CE-BFC1-08002BE10318}. This means with great probability - // that we are under Windows NT 4, so we try to look under the tcpip bindings. - // - - ODS("Adapters not found under SYSTEM\\CurrentControlSet\\Control\\Class. Using the TCP/IP bindings.\n"); - - Status = RegOpenKeyEx(HKEY_LOCAL_MACHINE, - TEXT("SYSTEM\\CurrentControlSet\\Services\\Tcpip\\Linkage"), - 0, - KEY_READ, - &LinkageKey); - - if (Status == ERROR_SUCCESS) - { - // Retrieve the length of th binde key - Status=RegQueryValueEx(LinkageKey, - TEXT("bind"), - NULL, - &RegType, - NULL, - &RegKeySize); - - // Allocate the buffer - BpStr = GlobalAllocPtr(GMEM_MOVEABLE | GMEM_ZEROINIT, RegKeySize+2); - - if (BpStr == NULL) - { - return FALSE; - } - - // Query the key again to get its content - Status = RegQueryValueEx(LinkageKey, - TEXT("bind"), - NULL, - &RegType, - (LPBYTE)BpStr, - &RegKeySize); - - RegCloseKey(LinkageKey); - - // Scan the buffer with the device names - for(i = 0;;) - { - if((k = _snprintf(TAName + sizeof("\\Device\\SEE_") - sizeof("\\Device\\"), sizeof(TAName), "%S", BpStr + i)) == 0) - break; - - // Put the \Device\NPF_ string at the beginning of the name - memcpy(TAName, "\\Device\\SEE_", sizeof("\\Device\\SEE_") - 1); - - // If the adapter is valid, add it to the list. - AddAdapter(TAName, 0); - - i += k + 1; - } - - GlobalFreePtr(BpStr); - } - - else{ -#ifdef _WINNT4 - return FALSE; -#endif - } - - return TRUE; -} - -#ifdef HAVE_DAG_API -/*! - \brief Add a dag adapter to the adapters info list, gathering information from the dagc API - \param name Name of the adapter. - \param description description of the adapter. - \return If the function succeeds, the return value is nonzero. -*/ -BOOLEAN PacketAddAdapterDag(PCHAR name, PCHAR description, BOOLEAN IsAFile) -{ - //this function should acquire the AdaptersInfoMutex, since it's NOT called with an ADAPTER_INFO as parameter - CHAR ebuf[DAGC_ERRBUF_SIZE]; - PADAPTER_INFO TmpAdInfo; - dagc_t *dagfd; - - //XXX what about checking if the adapter already exists??? - - // - // Allocate a descriptor for this adapter - // - //here we do not acquire the mutex, since we are not touching the list, yet. - TmpAdInfo = GlobalAllocPtr(GMEM_MOVEABLE | GMEM_ZEROINIT, sizeof(ADAPTER_INFO)); - if (TmpAdInfo == NULL) - { - ODS("PacketAddAdapterDag: GlobalAlloc Failed\n"); - return FALSE; - } - - // Copy the device name and description - _snprintf(TmpAdInfo->Name, - sizeof(TmpAdInfo->Name), - "%s", - name); - - _snprintf(TmpAdInfo->Description, - sizeof(TmpAdInfo->Description), - "%s", - description); - - if(IsAFile) - TmpAdInfo->Flags = INFO_FLAG_DAG_FILE; - else - TmpAdInfo->Flags = INFO_FLAG_DAG_CARD; - - if(p_dagc_open) - dagfd = p_dagc_open(name, 0, ebuf); - else - dagfd = NULL; - - if(!dagfd) - { - GlobalFreePtr(TmpAdInfo); - return FALSE; - } - - TmpAdInfo->LinkLayer.LinkType = p_dagc_getlinktype(dagfd); - - switch(p_dagc_getlinktype(dagfd)) - { - case TYPE_HDLC_POS: - TmpAdInfo->LinkLayer.LinkType = NdisMediumCHDLC; // Note: custom linktype, NDIS doesn't provide an equivalent - break; - case -TYPE_HDLC_POS: - TmpAdInfo->LinkLayer.LinkType = NdisMediumPPPSerial; // Note: custom linktype, NDIS doesn't provide an equivalent - break; - case TYPE_ETH: - TmpAdInfo->LinkLayer.LinkType = NdisMedium802_3; - break; - case TYPE_ATM: - TmpAdInfo->LinkLayer.LinkType = NdisMediumAtm; - break; - default: - TmpAdInfo->LinkLayer.LinkType = NdisMediumNull; // Note: custom linktype, NDIS doesn't provide an equivalent - break; - } - - TmpAdInfo->LinkLayer.LinkSpeed = (p_dagc_getlinkspeed(dagfd) == -1)? - 100000000: // Unknown speed, default to 100Mbit - p_dagc_getlinkspeed(dagfd) * 1000000; - - p_dagc_close(dagfd); - - WaitForSingleObject(AdaptersInfoMutex, INFINITE); - - // Update the AdaptersInfo list - TmpAdInfo->Next = AdaptersInfoList; - AdaptersInfoList = TmpAdInfo; - - ReleaseMutex(AdaptersInfoMutex); - - return TRUE; -} - -/*! - \brief Updates the list of the adapters using the DAGC API. - \return If the function succeeds, the return value is nonzero. - - This function populates the list of adapter descriptions, looking for DAG cards on the system. -*/ -BOOLEAN PacketGetAdaptersDag() -{ - CHAR ebuf[DAGC_ERRBUF_SIZE]; - dagc_if_t *devs = NULL, *tmpdevs; - UINT i; - - if(p_dagc_finddevs(&devs, ebuf)) - // No dag cards found on this system - return FALSE; - else - { - for(tmpdevs = devs, i=0; tmpdevs != NULL; tmpdevs = tmpdevs->next) - { - PacketAddAdapterDag(tmpdevs->name, tmpdevs->description, FALSE); - } - } - - p_dagc_freedevs(devs); - - return TRUE; -} -#endif // HAVE_DAG_API - -/*! -\brief Find the information about an adapter scanning the global ADAPTER_INFO list. - \param AdapterName Name of the adapter whose information has to be retrieved. - \return If the function succeeds, the return value is non-null. -*/ -PADAPTER_INFO PacketFindAdInfo(PCHAR AdapterName) -{ - //this function should NOT acquire the AdaptersInfoMutex, since it does return an ADAPTER_INFO structure - PADAPTER_INFO TAdInfo; - - if (AdaptersInfoList == NULL) - PacketPopulateAdaptersInfoList(); - - TAdInfo = AdaptersInfoList; - - while(TAdInfo != NULL) - { - if(strcmp(TAdInfo->Name, AdapterName) == 0) break; - - TAdInfo = TAdInfo->Next; - } - - return TAdInfo; -} - - - -/*! - \brief Updates information about an adapter in the global ADAPTER_INFO list. - \param AdapterName Name of the adapter whose information has to be retrieved. - \return If the function succeeds, the return value is TRUE. A false value means that the adapter is no - more valid or that it is disconnected. -*/ -BOOLEAN PacketUpdateAdInfo(PCHAR AdapterName) -{ - //this function should acquire the AdaptersInfoMutex, since it's NOT called with an ADAPTER_INFO as parameter - PADAPTER_INFO TAdInfo, PrevAdInfo; - - WaitForSingleObject(AdaptersInfoMutex, INFINITE); - - PrevAdInfo = TAdInfo = AdaptersInfoList; - - // - // If an entry for this adapter is present in the list, we destroy it - // - while(TAdInfo != NULL) - { - if(strcmp(TAdInfo->Name, AdapterName) == 0) - { - if (strcmp(AdapterName, FAKE_NDISWAN_ADAPTER_NAME) == 0) - { - ReleaseMutex(AdaptersInfoMutex); - return TRUE; - } - - if(TAdInfo == AdaptersInfoList) - { - AdaptersInfoList = TAdInfo->Next; - } - else - { - PrevAdInfo->Next = TAdInfo->Next; - } - - if (TAdInfo->NetworkAddresses != NULL) - GlobalFreePtr(TAdInfo->NetworkAddresses); - GlobalFreePtr(TAdInfo); - - break; - } - - PrevAdInfo = TAdInfo; - - TAdInfo = TAdInfo->Next; - } - - ReleaseMutex(AdaptersInfoMutex); - - // - // Now obtain the information about this adapter - // - if(AddAdapter(AdapterName, 0) == TRUE) - return TRUE; -#ifndef _WINNT4 - // - // Not a tradiditonal adapter, but possibly a Wan or DAG interface - // Gather all the available adapters from IPH API and dagc API - // - PacketGetAdaptersIPH(); - PacketAddFakeNdisWanAdapter(); -#ifdef HAVE_DAG_API - if(p_dagc_open == NULL) - return TRUE; // dagc.dll not present on this system. - else - PacketGetAdaptersDag(); -#endif // HAVE_DAG_API - -#endif // _WINNT4 - - // Adapter not found - return TRUE; -} - -/*! - \brief Populates the list of the adapters. - - This function populates the list of adapter descriptions, invoking first PacketGetAdapters() and then - PacketGetAdaptersIPH(). -*/ -void PacketPopulateAdaptersInfoList() -{ - //this function should acquire the AdaptersInfoMutex, since it's NOT called with an ADAPTER_INFO as parameter - PADAPTER_INFO TAdInfo; - PVOID Mem1, Mem2; - - WaitForSingleObject(AdaptersInfoMutex, INFINITE); - - if(AdaptersInfoList) - { - // Free the old list - TAdInfo = AdaptersInfoList; - while(TAdInfo != NULL) - { - Mem1 = TAdInfo->NetworkAddresses; - Mem2 = TAdInfo; - - TAdInfo = TAdInfo->Next; - - if (Mem1 != NULL) - GlobalFreePtr(Mem1); - GlobalFreePtr(Mem2); - } - - AdaptersInfoList = NULL; - } - - // - // Fill the new list - // - if(!PacketGetAdapters()) - { - // No info about adapters in the registry. - ODS("PacketPopulateAdaptersInfoList: registry scan for adapters failed!\n"); - } -#ifndef _WINNT4 - if(!PacketGetAdaptersIPH()) - { - // IP Helper API not present. We are under WinNT 4 or TCP/IP is not installed - ODS("PacketPopulateAdaptersInfoList: failed to get adapters from the IP Helper API!\n"); - } - - if (!PacketAddFakeNdisWanAdapter()) - { - ODS("PacketPopulateAdaptersInfoList: adding fake NdisWan adapter failed.\n"); - } - -#ifdef HAVE_DAG_API - if(p_dagc_open == NULL) - {} // dagc.dll not present on this system. - else - { - if(!PacketGetAdaptersDag()) - { - // No info about adapters in the registry. - ODS("PacketPopulateAdaptersInfoList: lookup of dag cards failed!\n"); - } - } -#endif // HAVE_DAG_API - -#endif // _WINNT4 - - ReleaseMutex(AdaptersInfoMutex); -} - -#ifndef _WINNT4 - -BOOL PacketAddFakeNdisWanAdapter() -{ - //this function should acquire the AdaptersInfoMutex, since it's NOT called with an ADAPTER_INFO as parameter - PADAPTER_INFO TmpAdInfo, SAdInfo; - - // Scan the adapters list to see if this one is already present - - if (!WanPacketTestAdapter()) - { - ODS("Cannot add the adapter, since it cannot be opened."); - //the adapter cannot be opened, we do not list it, but we return t - return FALSE; - } - - WaitForSingleObject(AdaptersInfoMutex, INFINITE); - - for(SAdInfo = AdaptersInfoList; SAdInfo != NULL; SAdInfo = SAdInfo->Next) - { - if(strcmp(FAKE_NDISWAN_ADAPTER_NAME, SAdInfo->Name) == 0) - { - ODS("PacketAddFakeNdisWanAdapter: Adapter already present in the list\n"); - ReleaseMutex(AdaptersInfoMutex); - return TRUE; - } - } - - TmpAdInfo = GlobalAllocPtr(GMEM_MOVEABLE | GMEM_ZEROINIT, sizeof(ADAPTER_INFO)); - if (TmpAdInfo == NULL) - { - ODS("PacketAddFakeNdisWanAdapter: GlobalAlloc Failed\n"); - ReleaseMutex(AdaptersInfoMutex); - return FALSE; - } - - strcpy(TmpAdInfo->Name, FAKE_NDISWAN_ADAPTER_NAME); - strcpy(TmpAdInfo->Description, FAKE_NDISWAN_ADAPTER_DESCRIPTION); - TmpAdInfo->LinkLayer.LinkType = NdisMedium802_3; - TmpAdInfo->LinkLayer.LinkSpeed = 10 * 1000 * 1000; //we emulate a fake 10MBit Ethernet - TmpAdInfo->Flags = INFO_FLAG_NDISWAN_ADAPTER; - memset(TmpAdInfo->MacAddress,'0',6); - TmpAdInfo->MacAddressLen = 6; - TmpAdInfo->NetworkAddresses = NULL; - TmpAdInfo->NNetworkAddresses = 0; - - TmpAdInfo->Next = AdaptersInfoList; - AdaptersInfoList = TmpAdInfo; - ReleaseMutex(AdaptersInfoMutex); - - return TRUE; -} - -#endif +/* + * Copyright (c) 1999 - 2003 + * Politecnico di Torino. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that: (1) source code distributions + * retain the above copyright notice and this paragraph in its entirety, (2) + * distributions including binary code include the above copyright notice and + * this paragraph in its entirety in the documentation or other materials + * provided with the distribution, and (3) all advertising materials mentioning + * features or use of this software display the following acknowledgement: + * ``This product includes software developed by the Politecnico + * di Torino, and its contributors.'' Neither the name of + * the University nor the names of its contributors may be used to endorse + * or promote products derived from this software without specific prior + * written permission. + * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + */ + +#include + +/* + This file contains the support functions used by packet.dll to retrieve information about installed + adapters, like + + - the adapter list + - the device associated to any adapter and the description of the adapter + - physical parameters like the linkspeed or the link layer type + - the IP and link layer addresses */ + +#define UNICODE 1 + +#include +#include + +#if 0 +#include "WanPacket/WanPacket.h" +#endif + +#define _WINNT4 + +#include +#include +#include +#include +#include + +#include + + +LPADAPTER PacketOpenAdapterNPF(PCHAR AdapterName); +BOOL PacketAddFakeNdisWanAdapter(); + +PADAPTER_INFO AdaptersInfoList = NULL; ///< Head of the adapter information list. This list is populated when packet.dll is linked by the application. +HANDLE AdaptersInfoMutex; ///< Mutex that protects the adapter information list. NOTE: every API that takes an ADAPTER_INFO as parameter assumes that it has been called with the mutex acquired. + +#define FAKE_NDISWAN_ADAPTER_NAME "\\Device\\SEE_GenericDialupAdapter" ///< Name of a fake ndiswan adapter that is always available on 2000/XP/2003, used to capture NCP/LCP packets +#define FAKE_NDISWAN_ADAPTER_DESCRIPTION "Generic dialup adapter" ///< Description of a fake ndiswan adapter that is always available on 2000/XP/2003, used to capture NCP/LCP packets + +extern FARPROC GetAdaptersAddressesPointer; + +#ifdef HAVE_DAG_API +extern dagc_open_handler p_dagc_open; +extern dagc_close_handler p_dagc_close; +extern dagc_getlinktype_handler p_dagc_getlinktype; +extern dagc_getlinkspeed_handler p_dagc_getlinkspeed; +extern dagc_finddevs_handler p_dagc_finddevs; +extern dagc_freedevs_handler p_dagc_freedevs; +#endif /* HAVE_DAG_API */ + +/// Title of error windows +TCHAR szWindowTitle[] = TEXT("PACKET.DLL"); + +ULONG inet_addrU(const WCHAR *cp); + +/*! + \brief Gets the link layer of an adapter, querying the registry. + \param AdapterObject Handle to an open adapter. + \param type Pointer to a NetType structure that will be filled by the function. + \return If the function succeeds, the return value is nonzero, otherwise the return value is zero. + + This function retrieves from the registry the link layer and the speed (in bps) of an opened adapter. + These values are copied in the NetType structure provided by the user. + The LinkType field of the type parameter can have one of the following values: + + - NdisMedium802_3: Ethernet (802.3) + - NdisMediumWan: WAN + - NdisMedium802_5: Token Ring (802.5) + - NdisMediumFddi: FDDI + - NdisMediumAtm: ATM + - NdisMediumArcnet878_2: ARCNET (878.2) +*/ +BOOLEAN PacketGetLinkLayerFromRegistry(LPADAPTER AdapterObject, NetType *type) +{ + BOOLEAN Status; + ULONG IoCtlBufferLength=(sizeof(PACKET_OID_DATA)+sizeof(ULONG)-1); + PPACKET_OID_DATA OidData; + + OidData=GlobalAllocPtr(GMEM_MOVEABLE | GMEM_ZEROINIT,IoCtlBufferLength); + if (OidData == NULL) { + ODS("PacketGetLinkLayerFromRegistry failed\n"); + return FALSE; + } + //get the link-layer type + OidData->Oid = OID_GEN_MEDIA_IN_USE; + OidData->Length = sizeof (ULONG); + Status = PacketRequest(AdapterObject,FALSE,OidData); + type->LinkType=*((UINT*)OidData->Data); + + //get the link-layer speed + OidData->Oid = OID_GEN_LINK_SPEED; + OidData->Length = sizeof (ULONG); + Status = PacketRequest(AdapterObject,FALSE,OidData); + type->LinkSpeed=*((UINT*)OidData->Data)*100; + GlobalFreePtr (OidData); + + ODSEx("Media:%d\n",type->LinkType); + ODSEx("Speed=%d\n",type->LinkSpeed); + + return Status; +} + + +/*! + \brief Scan the registry to retrieve the IP addresses of an adapter. + \param AdapterName String that contains the name of the adapter. + \param buffer A user allocated array of npf_if_addr that will be filled by the function. + \param NEntries Size of the array (in npf_if_addr). + \return If the function succeeds, the return value is nonzero. + + This function grabs from the registry information like the IP addresses, the netmasks + and the broadcast addresses of an interface. The buffer passed by the user is filled with + npf_if_addr structures, each of which contains the data for a single address. If the buffer + is full, the reaming addresses are dropped, therefore set its dimension to sizeof(npf_if_addr) + if you want only the first address. +*/ +BOOLEAN PacketGetAddressesFromRegistry(LPTSTR AdapterName, npf_if_addr* buffer, PLONG NEntries) +{ + char *AdapterNameA; + WCHAR *AdapterNameU; + WCHAR *ifname; + HKEY SystemKey; + HKEY InterfaceKey; + HKEY ParametersKey; + HKEY TcpIpKey; + HKEY UnderTcpKey; + LONG status; + WCHAR String[1024+1]; + DWORD RegType; + ULONG BufLen; + DWORD DHCPEnabled; + struct sockaddr_in *TmpAddr, *TmpBroad; + LONG naddrs,nmasks,StringPos; + DWORD ZeroBroadcast; + + AdapterNameA = (char*)AdapterName; + if(AdapterNameA[1] != 0) { //ASCII + AdapterNameU = SChar2WChar(AdapterNameA); + AdapterName = AdapterNameU; + } else { //Unicode + AdapterNameU = NULL; + } + ifname = wcsrchr(AdapterName, '\\'); + if (ifname == NULL) + ifname = AdapterName; + else + ifname++; + if (wcsncmp(ifname, L"SEE_", 4) == 0) + ifname += 4; + + if( RegOpenKeyEx(HKEY_LOCAL_MACHINE, TEXT("SYSTEM\\CurrentControlSet\\Services\\Tcpip\\Parameters\\Interfaces"), 0, KEY_READ, &UnderTcpKey) == ERROR_SUCCESS) + { + status = RegOpenKeyEx(UnderTcpKey,ifname,0,KEY_READ,&TcpIpKey); + if (status != ERROR_SUCCESS) { + RegCloseKey(UnderTcpKey); + goto fail; + } + } + else + { + + // Query the registry key with the interface's addresses + status = RegOpenKeyEx(HKEY_LOCAL_MACHINE,TEXT("SYSTEM\\CurrentControlSet\\Services"),0,KEY_READ,&SystemKey); + if (status != ERROR_SUCCESS) + goto fail; + status = RegOpenKeyEx(SystemKey,ifname,0,KEY_READ,&InterfaceKey); + if (status != ERROR_SUCCESS) { + RegCloseKey(SystemKey); + RegCloseKey(UnderTcpKey); + goto fail; + } + RegCloseKey(SystemKey); + status = RegOpenKeyEx(InterfaceKey,TEXT("Parameters"),0,KEY_READ,&ParametersKey); + if (status != ERROR_SUCCESS) { + RegCloseKey(InterfaceKey); + RegCloseKey(UnderTcpKey); + goto fail; + } + RegCloseKey(InterfaceKey); + status = RegOpenKeyEx(ParametersKey,TEXT("TcpIp"),0,KEY_READ,&TcpIpKey); + if (status != ERROR_SUCCESS) { + RegCloseKey(ParametersKey); + RegCloseKey(UnderTcpKey); + goto fail; + } + RegCloseKey(ParametersKey); + BufLen = sizeof String; + } + + BufLen = 4; + /* Try to detect if the interface has a zero broadcast addr */ + status=RegQueryValueEx(TcpIpKey,TEXT("UseZeroBroadcast"),NULL,&RegType,(LPBYTE)&ZeroBroadcast,&BufLen); + if (status != ERROR_SUCCESS) + ZeroBroadcast=0; + + BufLen = 4; + /* See if DHCP is used by this system */ + status=RegQueryValueEx(TcpIpKey,TEXT("EnableDHCP"),NULL,&RegType,(LPBYTE)&DHCPEnabled,&BufLen); + if (status != ERROR_SUCCESS) + DHCPEnabled=0; + + + /* Retrieve the addresses */ + if(DHCPEnabled){ + + BufLen = sizeof String; + // Open the key with the addresses + status = RegQueryValueEx(TcpIpKey,TEXT("DhcpIPAddress"),NULL,&RegType,(LPBYTE)String,&BufLen); + if (status != ERROR_SUCCESS) { + RegCloseKey(TcpIpKey); + RegCloseKey(UnderTcpKey); + goto fail; + } + + // scan the key to obtain the addresses + StringPos = 0; + for(naddrs = 0;naddrs <* NEntries;naddrs++){ + TmpAddr = (struct sockaddr_in *) &(buffer[naddrs].IPAddress); + + if((TmpAddr->sin_addr.S_un.S_addr = inet_addrU(String + StringPos))!= -1){ + TmpAddr->sin_family = AF_INET; + + TmpBroad = (struct sockaddr_in *) &(buffer[naddrs].Broadcast); + TmpBroad->sin_family = AF_INET; + if(ZeroBroadcast==0) + TmpBroad->sin_addr.S_un.S_addr = 0xffffffff; // 255.255.255.255 + else + TmpBroad->sin_addr.S_un.S_addr = 0; // 0.0.0.0 + + while(*(String + StringPos) != 0)StringPos++; + StringPos++; + + if(*(String + StringPos) == 0 || (StringPos * sizeof (WCHAR)) >= BufLen) + break; + } + else break; + } + + BufLen = sizeof String; + // Open the key with the netmasks + status = RegQueryValueEx(TcpIpKey,TEXT("DhcpSubnetMask"),NULL,&RegType,(LPBYTE)String,&BufLen); + if (status != ERROR_SUCCESS) { + RegCloseKey(TcpIpKey); + RegCloseKey(UnderTcpKey); + goto fail; + } + + // scan the key to obtain the masks + StringPos = 0; + for(nmasks = 0;nmasks < *NEntries;nmasks++){ + TmpAddr = (struct sockaddr_in *) &(buffer[nmasks].SubnetMask); + + if((TmpAddr->sin_addr.S_un.S_addr = inet_addrU(String + StringPos))!= -1){ + TmpAddr->sin_family = AF_INET; + + while(*(String + StringPos) != 0)StringPos++; + StringPos++; + + if(*(String + StringPos) == 0 || (StringPos * sizeof (WCHAR)) >= BufLen) + break; + } + else break; + } + + // The number of masks MUST be equal to the number of addresses + if(nmasks != naddrs){ + RegCloseKey(TcpIpKey); + RegCloseKey(UnderTcpKey); + goto fail; + } + + } + else{ + + BufLen = sizeof String; + // Open the key with the addresses + status = RegQueryValueEx(TcpIpKey,TEXT("IPAddress"),NULL,&RegType,(LPBYTE)String,&BufLen); + if (status != ERROR_SUCCESS) { + RegCloseKey(TcpIpKey); + RegCloseKey(UnderTcpKey); + goto fail; + } + + // scan the key to obtain the addresses + StringPos = 0; + for(naddrs = 0;naddrs < *NEntries;naddrs++){ + TmpAddr = (struct sockaddr_in *) &(buffer[naddrs].IPAddress); + + if((TmpAddr->sin_addr.S_un.S_addr = inet_addrU(String + StringPos))!= -1){ + TmpAddr->sin_family = AF_INET; + + TmpBroad = (struct sockaddr_in *) &(buffer[naddrs].Broadcast); + TmpBroad->sin_family = AF_INET; + if(ZeroBroadcast==0) + TmpBroad->sin_addr.S_un.S_addr = 0xffffffff; // 255.255.255.255 + else + TmpBroad->sin_addr.S_un.S_addr = 0; // 0.0.0.0 + + while(*(String + StringPos) != 0)StringPos++; + StringPos++; + + if(*(String + StringPos) == 0 || (StringPos * sizeof (WCHAR)) >= BufLen) + break; + } + else break; + } + + BufLen = sizeof String; + // Open the key with the netmasks + status = RegQueryValueEx(TcpIpKey,TEXT("SubnetMask"),NULL,&RegType,(LPBYTE)String,&BufLen); + if (status != ERROR_SUCCESS) { + RegCloseKey(TcpIpKey); + RegCloseKey(UnderTcpKey); + goto fail; + } + + // scan the key to obtain the masks + StringPos = 0; + for(nmasks = 0;nmasks <* NEntries;nmasks++){ + TmpAddr = (struct sockaddr_in *) &(buffer[nmasks].SubnetMask); + + if((TmpAddr->sin_addr.S_un.S_addr = inet_addrU(String + StringPos))!= -1){ + TmpAddr->sin_family = AF_INET; + + while(*(String + StringPos) != 0)StringPos++; + StringPos++; + + if(*(String + StringPos) == 0 || (StringPos * sizeof (WCHAR)) >= BufLen) + break; + } + else break; + } + + // The number of masks MUST be equal to the number of addresses + if(nmasks != naddrs){ + RegCloseKey(TcpIpKey); + RegCloseKey(UnderTcpKey); + goto fail; + } + + } + + *NEntries = naddrs + 1; + + RegCloseKey(TcpIpKey); + RegCloseKey(UnderTcpKey); + + if (status != ERROR_SUCCESS) { + goto fail; + } + + + if (AdapterNameU != NULL) + GlobalFreePtr(AdapterNameU); + return TRUE; + +fail: + if (AdapterNameU != NULL) + GlobalFreePtr(AdapterNameU); + return FALSE; +} + +/*! + \brief Adds the IPv6 addresses of an adapter to the ADAPTER_INFO structure that describes it. + \param AdInfo Pointer to the ADAPTER_INFO structure that keeps the information about the adapter. + \return If the function succeeds, the function returns TRUE. + + \note the structure pointed by AdInfo must be initialized the an properly filled. In particular, AdInfo->Name + must be a valid capture device name. + \note uses the GetAdaptersAddresses() Ip Helper API function, so it works only on systems where IP Helper API + provides it (WinXP and successive). + \note we suppose that we are called after having acquired the AdaptersInfoMutex mutex +*/ +#ifndef _WINNT4 +BOOLEAN PacketAddIP6Addresses(PADAPTER_INFO AdInfo) +{ + ULONG BufLen; + PIP_ADAPTER_ADDRESSES AdBuffer, TmpAddr; + PCHAR OrName; + PIP_ADAPTER_UNICAST_ADDRESS UnicastAddr; + struct sockaddr_storage *Addr; + INT AddrLen; + + ODS("PacketAddIP6Addresses\n"); + + if(GetAdaptersAddressesPointer == NULL) return TRUE; // GetAdaptersAddresses() not present on this system, + // return immediately. + + if(GetAdaptersAddressesPointer(AF_UNSPEC, GAA_FLAG_SKIP_ANYCAST| GAA_FLAG_SKIP_MULTICAST | GAA_FLAG_SKIP_FRIENDLY_NAME, NULL, NULL, &BufLen) != ERROR_BUFFER_OVERFLOW) + { + ODS("PacketAddIP6Addresses: GetAdaptersAddresses Failed\n"); + return FALSE; + } + + ODS("PacketAddIP6Addresses, retrieved needed storage for the call\n"); + + AdBuffer = GlobalAllocPtr(GMEM_MOVEABLE, BufLen); + if (AdBuffer == NULL) { + ODS("PacketAddIP6Addresses: GlobalAlloc Failed\n"); + return FALSE; + } + + if(GetAdaptersAddressesPointer(AF_UNSPEC, GAA_FLAG_SKIP_ANYCAST| GAA_FLAG_SKIP_MULTICAST | GAA_FLAG_SKIP_FRIENDLY_NAME, NULL, AdBuffer, &BufLen) != ERROR_SUCCESS) + { + ODS("PacketGetIP6AddressesIPH: GetAdaptersAddresses Failed\n"); + GlobalFreePtr(AdBuffer); + return FALSE; + } + + ODS("PacketAddIP6Addresses, retrieved addresses\n"); + + // + // Scan the list of addresses obtained from the IP helper API + // + for(TmpAddr = AdBuffer; TmpAddr != NULL; TmpAddr = TmpAddr->Next) + { + OrName = AdInfo->Name + sizeof("\\device\\see_") - 1; + + ODS("PacketAddIP6Addresses, external loop\n"); + if(strcmp(TmpAddr->AdapterName, OrName) == 0) + { + // Found a corresponding adapter, scan its address list + for(UnicastAddr = TmpAddr->FirstUnicastAddress; UnicastAddr != NULL; UnicastAddr = UnicastAddr->Next) + { + ODS("PacketAddIP6Addresses, internal loop\n"); + + AddrLen = UnicastAddr->Address.iSockaddrLength; + Addr = (struct sockaddr_storage *)UnicastAddr->Address.lpSockaddr; + if(Addr->ss_family == AF_INET6) + { + // Be sure not to overflow the addresses buffer of this adapter + if(AdInfo->NNetworkAddresses >= MAX_NETWORK_ADDRESSES) + { + GlobalFreePtr(AdBuffer); + return FALSE; + } + + memcpy(&(AdInfo->NetworkAddresses[AdInfo->NNetworkAddresses].IPAddress), Addr, AddrLen); + memset(&(AdInfo->NetworkAddresses[AdInfo->NNetworkAddresses].SubnetMask), 0, sizeof(struct sockaddr_storage)); + memset(&(AdInfo->NetworkAddresses[AdInfo->NNetworkAddresses].Broadcast), 0, sizeof(struct sockaddr_storage)); + AdInfo->NNetworkAddresses ++; + } + } + } + } + + ODS("PacketAddIP6Addresses, finished parsing the addresses\n"); + + GlobalFreePtr(AdBuffer); + + return TRUE; +} +#endif // _WINNT4 + +/*! + \brief Check if a string contains the "1394" substring + + We prevent opening of firewire adapters since they have non standard behaviors that can cause + problems with winpcap + + \param AdapterDesc NULL-terminated ASCII string with the adapter's description + \return TRUE if the input string contains "1394" +*/ +BOOLEAN IsFireWire(TCHAR *AdapterDesc) +{ + if(wcsstr(AdapterDesc, FIREWIRE_SUBSTR) != NULL) + { + return TRUE; + } + + return FALSE; +} + +/*! + \brief Adds an entry to the adapter description list, gathering its values from the IP Helper API. + \param IphAd PIP_ADAPTER_INFO IP Helper API structure containing the parameters of the adapter that must be added to the list. + \return If the function succeeds, the return value is TRUE. + \note we suppose that we are called after having acquired the AdaptersInfoMutex mutex +*/ +#ifndef _WINNT4 +BOOLEAN AddAdapterIPH(PIP_ADAPTER_INFO IphAd) +{ + PIP_ADAPTER_INFO AdList = NULL; + ULONG OutBufLen=0; + PADAPTER_INFO TmpAdInfo, SAdInfo; + PIP_ADDR_STRING TmpAddrStr; + UINT i; + struct sockaddr_in *TmpAddr; + CHAR TName[256]; + LPADAPTER adapter; + PWCHAR UAdName; + + + // Create the NPF device name from the original device name + strcpy(TName, "\\Device\\SEE_"); + _snprintf(TName + 12, ADAPTER_NAME_LENGTH - 12, "%s", IphAd->AdapterName); + + // Scan the adapters list to see if this one is already present + for(SAdInfo = AdaptersInfoList; SAdInfo != NULL; SAdInfo = SAdInfo->Next) + { + if(strcmp(TName, SAdInfo->Name) == 0) + { + ODS("PacketGetAdaptersIPH: Adapter already present in the list\n"); + goto SkipAd; + } + } + + if(IphAd->Type == IF_TYPE_PPP || IphAd->Type == IF_TYPE_SLIP) + { + if (!WanPacketTestAdapter()) + goto SkipAd; + } + else + { + //convert the string to unicode, as OpenAdapterNPF accepts unicode strings, only. + UAdName = SChar2WChar(TName); + if (UAdName == NULL) + { + ODS("AddAdapterIPH: unable to convert an ASCII string to UNICODE\n"); + goto SkipAd; + } + + adapter = PacketOpenAdapterNPF((PCHAR)UAdName); + GlobalFreePtr(UAdName); + + if(adapter == NULL) + { + // We are not able to open this adapter. Skip to the next one. + ODS("PacketGetAdaptersIPH: unable to open the adapter\n"); + goto SkipAd; + } + else + { + PacketCloseAdapter(adapter); + } + } + + // + // Adapter valid and not yet present in the list. Allocate the ADAPTER_INFO structure + // + TmpAdInfo = GlobalAllocPtr(GMEM_MOVEABLE | GMEM_ZEROINIT, sizeof(ADAPTER_INFO)); + if (TmpAdInfo == NULL) { + ODS("PacketGetAdaptersIPH: GlobalAlloc Failed\n"); + return FALSE; + } + + // Copy the device name + strcpy(TmpAdInfo->Name, TName); + + // Copy the description + _snprintf(TmpAdInfo->Description, ADAPTER_DESC_LENGTH, "%s", IphAd->Description); + + // Copy the MAC address + TmpAdInfo->MacAddressLen = IphAd->AddressLength; + + memcpy(TmpAdInfo->MacAddress, + IphAd->Address, + (MAX_MAC_ADDR_LENGTHIpAddressList, i = 0; TmpAddrStr != NULL; TmpAddrStr = TmpAddrStr->Next, i++) + { + + } + + TmpAdInfo->NetworkAddresses = GlobalAllocPtr(GMEM_MOVEABLE | GMEM_ZEROINIT, MAX_NETWORK_ADDRESSES * sizeof(npf_if_addr)); + if (TmpAdInfo->NetworkAddresses == NULL) { + ODS("PacketGetAdaptersIPH: GlobalAlloc Failed\n"); + GlobalFreePtr(TmpAdInfo); + return FALSE; + } + + // Scan the addresses, convert them to addrinfo structures and put each of them in the list + for(TmpAddrStr = &IphAd->IpAddressList, i = 0; TmpAddrStr != NULL; TmpAddrStr = TmpAddrStr->Next) + { + TmpAddr = (struct sockaddr_in *)&(TmpAdInfo->NetworkAddresses[i].IPAddress); + if((TmpAddr->sin_addr.S_un.S_addr = inet_addr(TmpAddrStr->IpAddress.String))!= INADDR_NONE) + { + TmpAddr->sin_family = AF_INET; + TmpAddr = (struct sockaddr_in *)&(TmpAdInfo->NetworkAddresses[i].SubnetMask); + TmpAddr->sin_addr.S_un.S_addr = inet_addr(TmpAddrStr->IpMask.String); + TmpAddr->sin_family = AF_INET; + TmpAddr = (struct sockaddr_in *)&(TmpAdInfo->NetworkAddresses[i].Broadcast); + TmpAddr->sin_addr.S_un.S_addr = 0xffffffff; // Consider 255.255.255.255 as broadcast address since IP Helper API doesn't provide information about it + TmpAddr->sin_family = AF_INET; + i++; + } + } + + TmpAdInfo->NNetworkAddresses = i; + + // Now Add IPv6 Addresses + PacketAddIP6Addresses(TmpAdInfo); + + if(IphAd->Type == IF_TYPE_PPP || IphAd->Type == IF_TYPE_SLIP) + { + // NdisWan adapter + TmpAdInfo->Flags = INFO_FLAG_NDISWAN_ADAPTER; + } + + // Update the AdaptersInfo list + TmpAdInfo->Next = AdaptersInfoList; + AdaptersInfoList = TmpAdInfo; + +SkipAd: + + return TRUE; +} +#endif // _WINNT4 + + +/*! + \brief Updates the list of the adapters querying the IP Helper API. + \return If the function succeeds, the return value is nonzero. + + This function populates the list of adapter descriptions, retrieving the information from a query to + the IP Helper API. The IP Helper API is used as a support of the standard registry query method to obtain + adapter information, so PacketGetAdaptersIPH() add only information about the adapters that were not + found by PacketGetAdapters(). +*/ +#ifndef _WINNT4 +BOOLEAN PacketGetAdaptersIPH() +{ + PIP_ADAPTER_INFO AdList = NULL; + PIP_ADAPTER_INFO TmpAd; + ULONG OutBufLen=0; + + ODS("PacketGetAdaptersIPH\n"); + + // Find the size of the buffer filled by GetAdaptersInfo + if(GetAdaptersInfo(AdList, &OutBufLen) == ERROR_NOT_SUPPORTED) + { + ODS("IP Helper API not supported on this system!\n"); + return FALSE; + } + + ODS("PacketGetAdaptersIPH: retrieved needed bytes for IPH\n"); + + // Allocate the buffer + AdList = GlobalAllocPtr(GMEM_MOVEABLE, OutBufLen); + if (AdList == NULL) { + ODS("PacketGetAdaptersIPH: GlobalAlloc Failed\n"); + return FALSE; + } + + // Retrieve the adapters information using the IP helper API + GetAdaptersInfo(AdList, &OutBufLen); + + ODS("PacketGetAdaptersIPH: retrieved list from IPH\n"); + + // Scan the list of adapters obtained from the IP helper API, create a new ADAPTER_INFO + // structure for every new adapter and put it in our global list + for(TmpAd = AdList; TmpAd != NULL; TmpAd = TmpAd->Next) + { + AddAdapterIPH(TmpAd); + } + + GlobalFreePtr(AdList); + + return TRUE; +} +#endif // _WINNT4 + + +/*! + \brief Adds an entry to the adapter description list. + \param AdName Name of the adapter to add + \return If the function succeeds, the return value is nonzero. + + Used by PacketGetAdapters(). Queries the registry to fill the PADAPTER_INFO describing the new adapter. +*/ +BOOLEAN AddAdapter(PCHAR AdName, UINT flags) +{ + //this function should acquire the AdaptersInfoMutex, since it's NOT called with an ADAPTER_INFO as parameter + DWORD RegKeySize=0; + LONG Status; + LPADAPTER adapter; + PPACKET_OID_DATA OidData; + int i=0; + PADAPTER_INFO TmpAdInfo; + PADAPTER_INFO TAdInfo; + PWCHAR UAdName; + + ODS("AddAdapter\n"); + + WaitForSingleObject(AdaptersInfoMutex, INFINITE); + + for(TAdInfo = AdaptersInfoList; TAdInfo != NULL; TAdInfo = TAdInfo->Next) + { + if(strcmp(AdName, TAdInfo->Name) == 0) + { + ODS("AddAdapter: Adapter already present in the list\n"); + ReleaseMutex(AdaptersInfoMutex); + return TRUE; + } + } + + UAdName = SChar2WChar(AdName); + + //here we could have released the mutex, but what happens if two threads try to add the same adapter? + //The adapter would be duplicated on the linked list + + if(flags != INFO_FLAG_DONT_EXPORT) + { + + // Try to Open the adapter + adapter = PacketOpenAdapterNPF((PCHAR)UAdName); + + GlobalFreePtr(UAdName); + + if(adapter == NULL) + { + // We are not able to open this adapter. Skip to the next one. + ReleaseMutex(AdaptersInfoMutex); + return FALSE; + } + + // Allocate a buffer to get the vendor description from the driver + OidData = GlobalAllocPtr(GMEM_MOVEABLE | GMEM_ZEROINIT,512); + if (OidData == NULL) + { + ODS("AddAdapter: GlobalAlloc Failed\n"); + PacketCloseAdapter(adapter); + ReleaseMutex(AdaptersInfoMutex); + return FALSE; + } + } + + // + // PacketOpenAdapter was succesful. Consider this a valid adapter and allocate an entry for it + // In the adapter list + // + + TmpAdInfo = GlobalAllocPtr(GMEM_MOVEABLE | GMEM_ZEROINIT, sizeof(ADAPTER_INFO)); + if (TmpAdInfo == NULL) + { + ODS("AddAdapter: GlobalAlloc Failed\n"); + GlobalFreePtr(OidData); + PacketCloseAdapter(adapter); + ReleaseMutex(AdaptersInfoMutex); + return FALSE; + } + + // Copy the device name + strcpy(TmpAdInfo->Name, AdName); + + if(flags != INFO_FLAG_DONT_EXPORT) + { + // Retrieve the adapter description querying the NIC driver + OidData->Oid = OID_GEN_VENDOR_DESCRIPTION; + OidData->Length = 256; + ZeroMemory(OidData->Data, 256); + + Status = PacketRequest(adapter, FALSE, OidData); + + if(Status==0 || ((char*)OidData->Data)[0]==0) + { + ODS("AddAdapter: unable to get a valid adapter description from the NIC driver\n"); + } + + ODSEx("Adapter Description=%s\n\n",OidData->Data); + + // Copy the description + strcpy(TmpAdInfo->Description, OidData->Data); + + PacketGetLinkLayerFromRegistry(adapter, &(TmpAdInfo->LinkLayer)); + + // Retrieve the adapter MAC address querying the NIC driver + OidData->Oid = OID_802_3_CURRENT_ADDRESS; // XXX At the moment only Ethernet is supported. + // Waiting a patch to support other Link Layers + OidData->Length = 256; + ZeroMemory(OidData->Data, 256); + + Status = PacketRequest(adapter, FALSE, OidData); + if(Status) + { + memcpy(TmpAdInfo->MacAddress, OidData->Data, 6); + TmpAdInfo->MacAddressLen = 6; + } + else + { + memset(TmpAdInfo->MacAddress, 0, 6); + TmpAdInfo->MacAddressLen = 0; + } + + // Retrieve IP addresses + TmpAdInfo->NetworkAddresses = GlobalAllocPtr(GMEM_MOVEABLE | GMEM_ZEROINIT, MAX_NETWORK_ADDRESSES * sizeof(npf_if_addr)); + if (TmpAdInfo->NetworkAddresses == NULL) { + ODS("AddAdapter: GlobalAlloc Failed\n"); + PacketCloseAdapter(adapter); + GlobalFreePtr(OidData); + GlobalFreePtr(TmpAdInfo); + ReleaseMutex(AdaptersInfoMutex); + return FALSE; + } + + TmpAdInfo->NNetworkAddresses = MAX_NETWORK_ADDRESSES; + if(!PacketGetAddressesFromRegistry((LPTSTR)TmpAdInfo->Name, TmpAdInfo->NetworkAddresses, &TmpAdInfo->NNetworkAddresses)) + { +#ifndef _WINNT4 + // Try to see if the interface has some IPv6 addresses + TmpAdInfo->NNetworkAddresses = 0; // We have no addresses because PacketGetAddressesFromRegistry() failed + + if(!PacketAddIP6Addresses(TmpAdInfo)) + { +#endif // _WINNT4 + GlobalFreePtr(TmpAdInfo->NetworkAddresses); + TmpAdInfo->NetworkAddresses = NULL; + TmpAdInfo->NNetworkAddresses = 0; +#ifndef _WINNT4 + } +#endif // _WINNT4 + } + +#ifndef _WINNT4 + // Now Add IPv6 Addresses + PacketAddIP6Addresses(TmpAdInfo); +#endif // _WINNT4 + + TmpAdInfo->Flags = INFO_FLAG_NDIS_ADAPTER; // NdisWan adapters are not exported by the NPF driver, + // therefore it's impossible to see them here + + // Free storage + PacketCloseAdapter(adapter); + GlobalFreePtr(OidData); + } + else + { + // Write in the flags that this adapter is firewire + // This will block it in all successive calls + TmpAdInfo->Flags = INFO_FLAG_DONT_EXPORT; + } + + // Update the AdaptersInfo list + TmpAdInfo->Next = AdaptersInfoList; + AdaptersInfoList = TmpAdInfo; + + ReleaseMutex(AdaptersInfoMutex); + return TRUE; +} + + +/*! + \brief Updates the list of the adapters querying the registry. + \return If the function succeeds, the return value is nonzero. + + This function populates the list of adapter descriptions, retrieving the information from the registry. +*/ +BOOLEAN PacketGetAdapters() +{ + HKEY LinkageKey,AdapKey, OneAdapKey; + DWORD RegKeySize=0; + LONG Status; + ULONG Result; + INT i=0,k; + DWORD dim; + DWORD RegType; + WCHAR TName[256]; + CHAR TAName[256]; + TCHAR AdapName[256]; + PTSTR BpStr; + UINT FireWireFlag; + + ODS("PacketGetAdapters\n"); + + Status=RegOpenKeyEx(HKEY_LOCAL_MACHINE, + TEXT("SYSTEM\\CurrentControlSet\\Control\\Class\\{4D36E972-E325-11CE-BFC1-08002BE10318}"), + 0, + KEY_READ, + &AdapKey); + + if ( Status != ERROR_SUCCESS ){ + ODS("PacketGetAdapters: RegOpenKeyEx ( Class\\{networkclassguid} ) Failed\n"); + goto nt4; + } + + i=0; + + ODS("PacketGetAdapters: Cycling through the adapters:\n"); + + // + // Cycle through the entries inside the {4D36E972-E325-11CE-BFC1-08002BE10318} key + // To get the names of the adapters + // + while((Result = RegEnumKey(AdapKey, i, AdapName, sizeof(AdapName)/2)) == ERROR_SUCCESS) + { + i++; + ODSEx(" %d) ", i); + FireWireFlag = 0; + + // + // Get the adapter name from the registry key + // + Status=RegOpenKeyEx(AdapKey, AdapName, 0, KEY_READ, &OneAdapKey); + if ( Status != ERROR_SUCCESS ) + { + ODS("PacketGetAdapters: RegOpenKeyEx ( OneAdapKey ) Failed\n"); + continue; + } + + // + // + // Check if this is a FireWire adapter, looking for "1394" in its ComponentId string. + // We prevent listing FireWire adapters because winpcap can open them, but their interface + // with the OS is broken and they can cause blue screens. + // + dim = sizeof(TName); + Status = RegQueryValueEx(OneAdapKey, + L"ComponentId", + NULL, + NULL, + (PBYTE)TName, + &dim); + + if(Status == ERROR_SUCCESS) + { + if(IsFireWire(TName)) + { + FireWireFlag = INFO_FLAG_DONT_EXPORT; + } + } + + Status=RegOpenKeyEx(OneAdapKey, L"Linkage", 0, KEY_READ, &LinkageKey); + if (Status != ERROR_SUCCESS) + { + RegCloseKey(OneAdapKey); + ODS("PacketGetAdapters: RegOpenKeyEx ( LinkageKey ) Failed\n"); + continue; + } + + dim = sizeof(TName); + Status=RegQueryValueEx(LinkageKey, + L"Export", + NULL, + NULL, + (PBYTE)TName, + &dim); + + if(Status != ERROR_SUCCESS) + { + RegCloseKey(OneAdapKey); + RegCloseKey(LinkageKey); + ODS("Name = SKIPPED (error reading the key)\n"); + continue; + } + + // Convert to ASCII + WideCharToMultiByte( + CP_ACP, + 0, + TName, // wide-character string + -1, // number of chars in string + TAName + sizeof("\\Device\\SEE_") - sizeof("\\Device\\"), // buffer for new string + sizeof(TAName) - sizeof("\\Device\\SEE_") + sizeof("\\Device\\"), // size of buffer + NULL, + NULL); + + // Put the \Device\NPF_ string at the beginning of the name + memcpy(TAName, "\\Device\\SEE_", sizeof("\\Device\\SEE_") - 1); + + // If the adapter is valid, add it to the list. + AddAdapter(TAName, FireWireFlag); + + RegCloseKey(OneAdapKey); + RegCloseKey(LinkageKey); + + } // while enum reg keys + + RegCloseKey(AdapKey); + +nt4: + // + // no adapters were found under {4D36E972-E325-11CE-BFC1-08002BE10318}. This means with great probability + // that we are under Windows NT 4, so we try to look under the tcpip bindings. + // + + ODS("Adapters not found under SYSTEM\\CurrentControlSet\\Control\\Class. Using the TCP/IP bindings.\n"); + + Status = RegOpenKeyEx(HKEY_LOCAL_MACHINE, + TEXT("SYSTEM\\CurrentControlSet\\Services\\Tcpip\\Linkage"), + 0, + KEY_READ, + &LinkageKey); + + if (Status == ERROR_SUCCESS) + { + // Retrieve the length of th binde key + Status=RegQueryValueEx(LinkageKey, + TEXT("bind"), + NULL, + &RegType, + NULL, + &RegKeySize); + + // Allocate the buffer + BpStr = GlobalAllocPtr(GMEM_MOVEABLE | GMEM_ZEROINIT, RegKeySize+2); + + if (BpStr == NULL) + { + return FALSE; + } + + // Query the key again to get its content + Status = RegQueryValueEx(LinkageKey, + TEXT("bind"), + NULL, + &RegType, + (LPBYTE)BpStr, + &RegKeySize); + + RegCloseKey(LinkageKey); + + // Scan the buffer with the device names + for(i = 0;;) + { + if((k = _snprintf(TAName + sizeof("\\Device\\SEE_") - sizeof("\\Device\\"), sizeof(TAName), "%S", BpStr + i)) == 0) + break; + + // Put the \Device\NPF_ string at the beginning of the name + memcpy(TAName, "\\Device\\SEE_", sizeof("\\Device\\SEE_") - 1); + + // If the adapter is valid, add it to the list. + AddAdapter(TAName, 0); + + i += k + 1; + } + + GlobalFreePtr(BpStr); + } + + else{ +#ifdef _WINNT4 + return FALSE; +#endif + } + + return TRUE; +} + +#ifdef HAVE_DAG_API +/*! + \brief Add a dag adapter to the adapters info list, gathering information from the dagc API + \param name Name of the adapter. + \param description description of the adapter. + \return If the function succeeds, the return value is nonzero. +*/ +BOOLEAN PacketAddAdapterDag(PCHAR name, PCHAR description, BOOLEAN IsAFile) +{ + //this function should acquire the AdaptersInfoMutex, since it's NOT called with an ADAPTER_INFO as parameter + CHAR ebuf[DAGC_ERRBUF_SIZE]; + PADAPTER_INFO TmpAdInfo; + dagc_t *dagfd; + + //XXX what about checking if the adapter already exists??? + + // + // Allocate a descriptor for this adapter + // + //here we do not acquire the mutex, since we are not touching the list, yet. + TmpAdInfo = GlobalAllocPtr(GMEM_MOVEABLE | GMEM_ZEROINIT, sizeof(ADAPTER_INFO)); + if (TmpAdInfo == NULL) + { + ODS("PacketAddAdapterDag: GlobalAlloc Failed\n"); + return FALSE; + } + + // Copy the device name and description + _snprintf(TmpAdInfo->Name, + sizeof(TmpAdInfo->Name), + "%s", + name); + + _snprintf(TmpAdInfo->Description, + sizeof(TmpAdInfo->Description), + "%s", + description); + + if(IsAFile) + TmpAdInfo->Flags = INFO_FLAG_DAG_FILE; + else + TmpAdInfo->Flags = INFO_FLAG_DAG_CARD; + + if(p_dagc_open) + dagfd = p_dagc_open(name, 0, ebuf); + else + dagfd = NULL; + + if(!dagfd) + { + GlobalFreePtr(TmpAdInfo); + return FALSE; + } + + TmpAdInfo->LinkLayer.LinkType = p_dagc_getlinktype(dagfd); + + switch(p_dagc_getlinktype(dagfd)) + { + case TYPE_HDLC_POS: + TmpAdInfo->LinkLayer.LinkType = NdisMediumCHDLC; // Note: custom linktype, NDIS doesn't provide an equivalent + break; + case -TYPE_HDLC_POS: + TmpAdInfo->LinkLayer.LinkType = NdisMediumPPPSerial; // Note: custom linktype, NDIS doesn't provide an equivalent + break; + case TYPE_ETH: + TmpAdInfo->LinkLayer.LinkType = NdisMedium802_3; + break; + case TYPE_ATM: + TmpAdInfo->LinkLayer.LinkType = NdisMediumAtm; + break; + default: + TmpAdInfo->LinkLayer.LinkType = NdisMediumNull; // Note: custom linktype, NDIS doesn't provide an equivalent + break; + } + + TmpAdInfo->LinkLayer.LinkSpeed = (p_dagc_getlinkspeed(dagfd) == -1)? + 100000000: // Unknown speed, default to 100Mbit + p_dagc_getlinkspeed(dagfd) * 1000000; + + p_dagc_close(dagfd); + + WaitForSingleObject(AdaptersInfoMutex, INFINITE); + + // Update the AdaptersInfo list + TmpAdInfo->Next = AdaptersInfoList; + AdaptersInfoList = TmpAdInfo; + + ReleaseMutex(AdaptersInfoMutex); + + return TRUE; +} + +/*! + \brief Updates the list of the adapters using the DAGC API. + \return If the function succeeds, the return value is nonzero. + + This function populates the list of adapter descriptions, looking for DAG cards on the system. +*/ +BOOLEAN PacketGetAdaptersDag() +{ + CHAR ebuf[DAGC_ERRBUF_SIZE]; + dagc_if_t *devs = NULL, *tmpdevs; + UINT i; + + if(p_dagc_finddevs(&devs, ebuf)) + // No dag cards found on this system + return FALSE; + else + { + for(tmpdevs = devs, i=0; tmpdevs != NULL; tmpdevs = tmpdevs->next) + { + PacketAddAdapterDag(tmpdevs->name, tmpdevs->description, FALSE); + } + } + + p_dagc_freedevs(devs); + + return TRUE; +} +#endif // HAVE_DAG_API + +/*! +\brief Find the information about an adapter scanning the global ADAPTER_INFO list. + \param AdapterName Name of the adapter whose information has to be retrieved. + \return If the function succeeds, the return value is non-null. +*/ +PADAPTER_INFO PacketFindAdInfo(PCHAR AdapterName) +{ + //this function should NOT acquire the AdaptersInfoMutex, since it does return an ADAPTER_INFO structure + PADAPTER_INFO TAdInfo; + + if (AdaptersInfoList == NULL) + PacketPopulateAdaptersInfoList(); + + TAdInfo = AdaptersInfoList; + + while(TAdInfo != NULL) + { + if(strcmp(TAdInfo->Name, AdapterName) == 0) break; + + TAdInfo = TAdInfo->Next; + } + + return TAdInfo; +} + + + +/*! + \brief Updates information about an adapter in the global ADAPTER_INFO list. + \param AdapterName Name of the adapter whose information has to be retrieved. + \return If the function succeeds, the return value is TRUE. A false value means that the adapter is no + more valid or that it is disconnected. +*/ +BOOLEAN PacketUpdateAdInfo(PCHAR AdapterName) +{ + //this function should acquire the AdaptersInfoMutex, since it's NOT called with an ADAPTER_INFO as parameter + PADAPTER_INFO TAdInfo, PrevAdInfo; + + WaitForSingleObject(AdaptersInfoMutex, INFINITE); + + PrevAdInfo = TAdInfo = AdaptersInfoList; + + // + // If an entry for this adapter is present in the list, we destroy it + // + while(TAdInfo != NULL) + { + if(strcmp(TAdInfo->Name, AdapterName) == 0) + { + if (strcmp(AdapterName, FAKE_NDISWAN_ADAPTER_NAME) == 0) + { + ReleaseMutex(AdaptersInfoMutex); + return TRUE; + } + + if(TAdInfo == AdaptersInfoList) + { + AdaptersInfoList = TAdInfo->Next; + } + else + { + PrevAdInfo->Next = TAdInfo->Next; + } + + if (TAdInfo->NetworkAddresses != NULL) + GlobalFreePtr(TAdInfo->NetworkAddresses); + GlobalFreePtr(TAdInfo); + + break; + } + + PrevAdInfo = TAdInfo; + + TAdInfo = TAdInfo->Next; + } + + ReleaseMutex(AdaptersInfoMutex); + + // + // Now obtain the information about this adapter + // + if(AddAdapter(AdapterName, 0) == TRUE) + return TRUE; +#ifndef _WINNT4 + // + // Not a tradiditonal adapter, but possibly a Wan or DAG interface + // Gather all the available adapters from IPH API and dagc API + // + PacketGetAdaptersIPH(); + PacketAddFakeNdisWanAdapter(); +#ifdef HAVE_DAG_API + if(p_dagc_open == NULL) + return TRUE; // dagc.dll not present on this system. + else + PacketGetAdaptersDag(); +#endif // HAVE_DAG_API + +#endif // _WINNT4 + + // Adapter not found + return TRUE; +} + +/*! + \brief Populates the list of the adapters. + + This function populates the list of adapter descriptions, invoking first PacketGetAdapters() and then + PacketGetAdaptersIPH(). +*/ +void PacketPopulateAdaptersInfoList() +{ + //this function should acquire the AdaptersInfoMutex, since it's NOT called with an ADAPTER_INFO as parameter + PADAPTER_INFO TAdInfo; + PVOID Mem1, Mem2; + + WaitForSingleObject(AdaptersInfoMutex, INFINITE); + + if(AdaptersInfoList) + { + // Free the old list + TAdInfo = AdaptersInfoList; + while(TAdInfo != NULL) + { + Mem1 = TAdInfo->NetworkAddresses; + Mem2 = TAdInfo; + + TAdInfo = TAdInfo->Next; + + if (Mem1 != NULL) + GlobalFreePtr(Mem1); + GlobalFreePtr(Mem2); + } + + AdaptersInfoList = NULL; + } + + // + // Fill the new list + // + if(!PacketGetAdapters()) + { + // No info about adapters in the registry. + ODS("PacketPopulateAdaptersInfoList: registry scan for adapters failed!\n"); + } +#ifndef _WINNT4 + if(!PacketGetAdaptersIPH()) + { + // IP Helper API not present. We are under WinNT 4 or TCP/IP is not installed + ODS("PacketPopulateAdaptersInfoList: failed to get adapters from the IP Helper API!\n"); + } + + if (!PacketAddFakeNdisWanAdapter()) + { + ODS("PacketPopulateAdaptersInfoList: adding fake NdisWan adapter failed.\n"); + } + +#ifdef HAVE_DAG_API + if(p_dagc_open == NULL) + {} // dagc.dll not present on this system. + else + { + if(!PacketGetAdaptersDag()) + { + // No info about adapters in the registry. + ODS("PacketPopulateAdaptersInfoList: lookup of dag cards failed!\n"); + } + } +#endif // HAVE_DAG_API + +#endif // _WINNT4 + + ReleaseMutex(AdaptersInfoMutex); +} + +#ifndef _WINNT4 + +BOOL PacketAddFakeNdisWanAdapter() +{ + //this function should acquire the AdaptersInfoMutex, since it's NOT called with an ADAPTER_INFO as parameter + PADAPTER_INFO TmpAdInfo, SAdInfo; + + // Scan the adapters list to see if this one is already present + + if (!WanPacketTestAdapter()) + { + ODS("Cannot add the adapter, since it cannot be opened."); + //the adapter cannot be opened, we do not list it, but we return t + return FALSE; + } + + WaitForSingleObject(AdaptersInfoMutex, INFINITE); + + for(SAdInfo = AdaptersInfoList; SAdInfo != NULL; SAdInfo = SAdInfo->Next) + { + if(strcmp(FAKE_NDISWAN_ADAPTER_NAME, SAdInfo->Name) == 0) + { + ODS("PacketAddFakeNdisWanAdapter: Adapter already present in the list\n"); + ReleaseMutex(AdaptersInfoMutex); + return TRUE; + } + } + + TmpAdInfo = GlobalAllocPtr(GMEM_MOVEABLE | GMEM_ZEROINIT, sizeof(ADAPTER_INFO)); + if (TmpAdInfo == NULL) + { + ODS("PacketAddFakeNdisWanAdapter: GlobalAlloc Failed\n"); + ReleaseMutex(AdaptersInfoMutex); + return FALSE; + } + + strcpy(TmpAdInfo->Name, FAKE_NDISWAN_ADAPTER_NAME); + strcpy(TmpAdInfo->Description, FAKE_NDISWAN_ADAPTER_DESCRIPTION); + TmpAdInfo->LinkLayer.LinkType = NdisMedium802_3; + TmpAdInfo->LinkLayer.LinkSpeed = 10 * 1000 * 1000; //we emulate a fake 10MBit Ethernet + TmpAdInfo->Flags = INFO_FLAG_NDISWAN_ADAPTER; + memset(TmpAdInfo->MacAddress,'0',6); + TmpAdInfo->MacAddressLen = 6; + TmpAdInfo->NetworkAddresses = NULL; + TmpAdInfo->NNetworkAddresses = 0; + + TmpAdInfo->Next = AdaptersInfoList; + AdaptersInfoList = TmpAdInfo; + ReleaseMutex(AdaptersInfoMutex); + + return TRUE; +} + +#endif diff --git a/src/SeeDll/Devioctl.h b/src/SeeDll/Devioctl.h index af8784bf..661fda02 100644 --- a/src/SeeDll/Devioctl.h +++ b/src/SeeDll/Devioctl.h @@ -1,90 +1,90 @@ -/*++ BUILD Version: 0004 // Increment this if a change has global effects - Copyright (c) 1992-1993 Microsoft Corporation - Module Name: - devioctl.h - Revision History: - -- */ -// begin_winioctl -#ifndef _DEVIOCTL_ -#define _DEVIOCTL_ -// begin_ntddk begin_nthal begin_ntifs -// -// Define the various device type values. Note that values used by Microsoft -// Corporation are in the range 0-32767, and 32768-65535 are reserved for use -// by customers. -// -#define DEVICE_TYPE ULONG -#define FILE_DEVICE_BEEP 0x00000001 -#define FILE_DEVICE_CD_ROM 0x00000002 -#define FILE_DEVICE_CD_ROM_FILE_SYSTEM 0x00000003 -#define FILE_DEVICE_CONTROLLER 0x00000004 -#define FILE_DEVICE_DATALINK 0x00000005 -#define FILE_DEVICE_DFS 0x00000006 -#define FILE_DEVICE_DISK 0x00000007 -#define FILE_DEVICE_DISK_FILE_SYSTEM 0x00000008 -#define FILE_DEVICE_FILE_SYSTEM 0x00000009 -#define FILE_DEVICE_INPORT_PORT 0x0000000a -#define FILE_DEVICE_KEYBOARD 0x0000000b -#define FILE_DEVICE_MAILSLOT 0x0000000c -#define FILE_DEVICE_MIDI_IN 0x0000000d -#define FILE_DEVICE_MIDI_OUT 0x0000000e -#define FILE_DEVICE_MOUSE 0x0000000f -#define FILE_DEVICE_MULTI_UNC_PROVIDER 0x00000010 -#define FILE_DEVICE_NAMED_PIPE 0x00000011 -#define FILE_DEVICE_NETWORK 0x00000012 -#define FILE_DEVICE_NETWORK_BROWSER 0x00000013 -#define FILE_DEVICE_NETWORK_FILE_SYSTEM 0x00000014 -#define FILE_DEVICE_NULL 0x00000015 -#define FILE_DEVICE_PARALLEL_PORT 0x00000016 -#define FILE_DEVICE_PHYSICAL_NETCARD 0x00000017 -#define FILE_DEVICE_PRINTER 0x00000018 -#define FILE_DEVICE_SCANNER 0x00000019 -#define FILE_DEVICE_SERIAL_MOUSE_PORT 0x0000001a -#define FILE_DEVICE_SERIAL_PORT 0x0000001b -#define FILE_DEVICE_SCREEN 0x0000001c -#define FILE_DEVICE_SOUND 0x0000001d -#define FILE_DEVICE_STREAMS 0x0000001e -#define FILE_DEVICE_TAPE 0x0000001f -#define FILE_DEVICE_TAPE_FILE_SYSTEM 0x00000020 -#define FILE_DEVICE_TRANSPORT 0x00000021 -#define FILE_DEVICE_UNKNOWN 0x00000022 -#define FILE_DEVICE_VIDEO 0x00000023 -#define FILE_DEVICE_VIRTUAL_DISK 0x00000024 -#define FILE_DEVICE_WAVE_IN 0x00000025 -#define FILE_DEVICE_WAVE_OUT 0x00000026 -#define FILE_DEVICE_8042_PORT 0x00000027 -#define FILE_DEVICE_NETWORK_REDIRECTOR 0x00000028 -#define FILE_DEVICE_BATTERY 0x00000029 -#define FILE_DEVICE_BUS_EXTENDER 0x0000002a -#define FILE_DEVICE_MODEM 0x0000002b -#define FILE_DEVICE_VDM 0x0000002c -#define FILE_DEVICE_MASS_STORAGE 0x0000002d -// -// Macro definition for defining IOCTL and FSCTL function control codes. Note -// that function codes 0-2047 are reserved for Microsoft Corporation, and -// 2048-4095 are reserved for customers. -// -#define CTL_CODE( DeviceType, Function, Method, Access ) ( \ - ((DeviceType) << 16) | ((Access) << 14) | ((Function) << 2) | (Method) \ -) -// -// Define the method codes for how buffers are passed for I/O and FS controls -// -#define METHOD_BUFFERED 0 -#define METHOD_IN_DIRECT 1 -#define METHOD_OUT_DIRECT 2 -#define METHOD_NEITHER 3 -// -// Define the access check value for any access -// -// -// The FILE_READ_ACCESS and FILE_WRITE_ACCESS constants are also defined in -// ntioapi.h as FILE_READ_DATA and FILE_WRITE_DATA. The values for these -// constants *MUST* always be in sync. -// -#define FILE_ANY_ACCESS 0 -#define FILE_READ_ACCESS ( 0x0001 ) // file & pipe -#define FILE_WRITE_ACCESS ( 0x0002 ) // file & pipe -// end_ntddk end_nthal end_ntifs -#endif // _DEVIOCTL_ -// end_winioctl +/*++ BUILD Version: 0004 // Increment this if a change has global effects + Copyright (c) 1992-1993 Microsoft Corporation + Module Name: + devioctl.h + Revision History: + -- */ +// begin_winioctl +#ifndef _DEVIOCTL_ +#define _DEVIOCTL_ +// begin_ntddk begin_nthal begin_ntifs +// +// Define the various device type values. Note that values used by Microsoft +// Corporation are in the range 0-32767, and 32768-65535 are reserved for use +// by customers. +// +#define DEVICE_TYPE ULONG +#define FILE_DEVICE_BEEP 0x00000001 +#define FILE_DEVICE_CD_ROM 0x00000002 +#define FILE_DEVICE_CD_ROM_FILE_SYSTEM 0x00000003 +#define FILE_DEVICE_CONTROLLER 0x00000004 +#define FILE_DEVICE_DATALINK 0x00000005 +#define FILE_DEVICE_DFS 0x00000006 +#define FILE_DEVICE_DISK 0x00000007 +#define FILE_DEVICE_DISK_FILE_SYSTEM 0x00000008 +#define FILE_DEVICE_FILE_SYSTEM 0x00000009 +#define FILE_DEVICE_INPORT_PORT 0x0000000a +#define FILE_DEVICE_KEYBOARD 0x0000000b +#define FILE_DEVICE_MAILSLOT 0x0000000c +#define FILE_DEVICE_MIDI_IN 0x0000000d +#define FILE_DEVICE_MIDI_OUT 0x0000000e +#define FILE_DEVICE_MOUSE 0x0000000f +#define FILE_DEVICE_MULTI_UNC_PROVIDER 0x00000010 +#define FILE_DEVICE_NAMED_PIPE 0x00000011 +#define FILE_DEVICE_NETWORK 0x00000012 +#define FILE_DEVICE_NETWORK_BROWSER 0x00000013 +#define FILE_DEVICE_NETWORK_FILE_SYSTEM 0x00000014 +#define FILE_DEVICE_NULL 0x00000015 +#define FILE_DEVICE_PARALLEL_PORT 0x00000016 +#define FILE_DEVICE_PHYSICAL_NETCARD 0x00000017 +#define FILE_DEVICE_PRINTER 0x00000018 +#define FILE_DEVICE_SCANNER 0x00000019 +#define FILE_DEVICE_SERIAL_MOUSE_PORT 0x0000001a +#define FILE_DEVICE_SERIAL_PORT 0x0000001b +#define FILE_DEVICE_SCREEN 0x0000001c +#define FILE_DEVICE_SOUND 0x0000001d +#define FILE_DEVICE_STREAMS 0x0000001e +#define FILE_DEVICE_TAPE 0x0000001f +#define FILE_DEVICE_TAPE_FILE_SYSTEM 0x00000020 +#define FILE_DEVICE_TRANSPORT 0x00000021 +#define FILE_DEVICE_UNKNOWN 0x00000022 +#define FILE_DEVICE_VIDEO 0x00000023 +#define FILE_DEVICE_VIRTUAL_DISK 0x00000024 +#define FILE_DEVICE_WAVE_IN 0x00000025 +#define FILE_DEVICE_WAVE_OUT 0x00000026 +#define FILE_DEVICE_8042_PORT 0x00000027 +#define FILE_DEVICE_NETWORK_REDIRECTOR 0x00000028 +#define FILE_DEVICE_BATTERY 0x00000029 +#define FILE_DEVICE_BUS_EXTENDER 0x0000002a +#define FILE_DEVICE_MODEM 0x0000002b +#define FILE_DEVICE_VDM 0x0000002c +#define FILE_DEVICE_MASS_STORAGE 0x0000002d +// +// Macro definition for defining IOCTL and FSCTL function control codes. Note +// that function codes 0-2047 are reserved for Microsoft Corporation, and +// 2048-4095 are reserved for customers. +// +#define CTL_CODE( DeviceType, Function, Method, Access ) ( \ + ((DeviceType) << 16) | ((Access) << 14) | ((Function) << 2) | (Method) \ +) +// +// Define the method codes for how buffers are passed for I/O and FS controls +// +#define METHOD_BUFFERED 0 +#define METHOD_IN_DIRECT 1 +#define METHOD_OUT_DIRECT 2 +#define METHOD_NEITHER 3 +// +// Define the access check value for any access +// +// +// The FILE_READ_ACCESS and FILE_WRITE_ACCESS constants are also defined in +// ntioapi.h as FILE_READ_DATA and FILE_WRITE_DATA. The values for these +// constants *MUST* always be in sync. +// +#define FILE_ANY_ACCESS 0 +#define FILE_READ_ACCESS ( 0x0001 ) // file & pipe +#define FILE_WRITE_ACCESS ( 0x0002 ) // file & pipe +// end_ntddk end_nthal end_ntifs +#endif // _DEVIOCTL_ +// end_winioctl diff --git a/src/SeeDll/Ntddndis.h b/src/SeeDll/Ntddndis.h index 0b629806..77a53d7a 100644 --- a/src/SeeDll/Ntddndis.h +++ b/src/SeeDll/Ntddndis.h @@ -1,1400 +1,1400 @@ -/*++ BUILD Version: 0001 // Increment this if a change has global effects - Copyright (c) 1990-1993 Microsoft Corporation - Module Name: - ntddndis.h - Abstract: - This is the include file that defines all constants and types for - accessing the Network driver interface device. - Author: - Steve Wood (stevewo) 27-May-1990 - Revision History: - Adam Barr (adamba) 04-Nov-1992 added the correct values for NDIS 3.0. - Jameel Hyder (jameelh) 01-Aug-95 added Pnp IoCTLs and structures - Kyle Brandon (kyleb) 09/24/96 added general co ndis oids. - -- */ -#ifndef _NTDDNDIS_ -#define _NTDDNDIS_ -// -// Device Name - this string is the name of the device. It is the name -// that should be passed to NtOpenFile when accessing the device. -// -// Note: For devices that support multiple units, it should be suffixed -// with the Ascii representation of the unit number. -// -#define DD_NDIS_DEVICE_NAME "\\Device\\UNKNOWN" -// -// NtDeviceIoControlFile IoControlCode values for this device. -// -// Warning: Remember that the low two bits of the code specify how the -// buffers are passed to the driver! -// -#define _NDIS_CONTROL_CODE(request,method) \ - CTL_CODE(FILE_DEVICE_PHYSICAL_NETCARD, request, method, FILE_ANY_ACCESS) -#define IOCTL_NDIS_QUERY_GLOBAL_STATS _NDIS_CONTROL_CODE( 0, METHOD_OUT_DIRECT ) -#define IOCTL_NDIS_QUERY_ALL_STATS _NDIS_CONTROL_CODE( 1, METHOD_OUT_DIRECT ) -#define IOCTL_NDIS_ADD_DEVICE _NDIS_CONTROL_CODE( 2, METHOD_BUFFERED ) -#define IOCTL_NDIS_DELETE_DEVICE _NDIS_CONTROL_CODE( 3, METHOD_BUFFERED ) -#define IOCTL_NDIS_TRANSLATE_NAME _NDIS_CONTROL_CODE( 4, METHOD_BUFFERED ) -#define IOCTL_NDIS_ADD_TDI_DEVICE _NDIS_CONTROL_CODE( 5, METHOD_BUFFERED ) -#define IOCTL_NDIS_NOTIFY_PROTOCOL _NDIS_CONTROL_CODE( 6, METHOD_BUFFERED ) -#define IOCTL_NDIS_GET_LOG_DATA _NDIS_CONTROL_CODE( 7, METHOD_OUT_DIRECT ) -// -// NtDeviceIoControlFile InputBuffer/OutputBuffer record structures for -// this device. -// -// -// This is the type of an NDIS OID value. -// -typedef ULONG NDIS_OID, *PNDIS_OID; -// -// IOCTL_NDIS_QUERY_ALL_STATS returns a sequence of these, packed -// together (no padding is required since statistics all have -// four or eight bytes of data). -// -typedef struct _NDIS_STATISTICS_VALUE { - NDIS_OID Oid; - ULONG DataLength; - UCHAR Data[1]; // variable length - -} NDIS_STATISTICS_VALUE, *PNDIS_STATISTICS_VALUE; - -// -// Structure used by TRANSLATE_NAME IOCTL -// -typedef struct _NET_PNP_ID { - ULONG ClassId; - ULONG Token; -} NET_PNP_ID, *PNET_PNP_ID; - -typedef struct _NET_PNP_TRANSLATE_LIST { - ULONG BytesNeeded; - NET_PNP_ID IdArray[ANYSIZE_ARRAY]; -} NET_PNP_TRANSLATE_LIST, *PNET_PNP_TRANSLATE_LIST; - -// -// Structure used to define a self-contained variable data structure -// -typedef struct _NDIS_VAR_DATA_DESC { - USHORT Length; // # of octects of data - - USHORT MaximumLength; // # of octects available - - LONG Offset; // Offset of data relative to the descriptor - -} NDIS_VAR_DATA_DESC, *PNDIS_VAR_DATA_DESC; - -// -// Object Identifiers used by NdisRequest Query/Set Information -// -// -// General Objects -// -#define OID_GEN_SUPPORTED_LIST 0x00010101 -#define OID_GEN_HARDWARE_STATUS 0x00010102 -#define OID_GEN_MEDIA_SUPPORTED 0x00010103 -#define OID_GEN_MEDIA_IN_USE 0x00010104 -#define OID_GEN_MAXIMUM_LOOKAHEAD 0x00010105 -#define OID_GEN_MAXIMUM_FRAME_SIZE 0x00010106 -#define OID_GEN_LINK_SPEED 0x00010107 -#define OID_GEN_TRANSMIT_BUFFER_SPACE 0x00010108 -#define OID_GEN_RECEIVE_BUFFER_SPACE 0x00010109 -#define OID_GEN_TRANSMIT_BLOCK_SIZE 0x0001010A -#define OID_GEN_RECEIVE_BLOCK_SIZE 0x0001010B -#define OID_GEN_VENDOR_ID 0x0001010C -#define OID_GEN_VENDOR_DESCRIPTION 0x0001010D -#define OID_GEN_CURRENT_PACKET_FILTER 0x0001010E -#define OID_GEN_CURRENT_LOOKAHEAD 0x0001010F -#define OID_GEN_DRIVER_VERSION 0x00010110 -#define OID_GEN_MAXIMUM_TOTAL_SIZE 0x00010111 -#define OID_GEN_PROTOCOL_OPTIONS 0x00010112 -#define OID_GEN_MAC_OPTIONS 0x00010113 -#define OID_GEN_MEDIA_CONNECT_STATUS 0x00010114 -#define OID_GEN_MAXIMUM_SEND_PACKETS 0x00010115 -#define OID_GEN_VENDOR_DRIVER_VERSION 0x00010116 -#define OID_GEN_XMIT_OK 0x00020101 -#define OID_GEN_RCV_OK 0x00020102 -#define OID_GEN_XMIT_ERROR 0x00020103 -#define OID_GEN_RCV_ERROR 0x00020104 -#define OID_GEN_RCV_NO_BUFFER 0x00020105 -#define OID_GEN_DIRECTED_BYTES_XMIT 0x00020201 -#define OID_GEN_DIRECTED_FRAMES_XMIT 0x00020202 -#define OID_GEN_MULTICAST_BYTES_XMIT 0x00020203 -#define OID_GEN_MULTICAST_FRAMES_XMIT 0x00020204 -#define OID_GEN_BROADCAST_BYTES_XMIT 0x00020205 -#define OID_GEN_BROADCAST_FRAMES_XMIT 0x00020206 -#define OID_GEN_DIRECTED_BYTES_RCV 0x00020207 -#define OID_GEN_DIRECTED_FRAMES_RCV 0x00020208 -#define OID_GEN_MULTICAST_BYTES_RCV 0x00020209 -#define OID_GEN_MULTICAST_FRAMES_RCV 0x0002020A -#define OID_GEN_BROADCAST_BYTES_RCV 0x0002020B -#define OID_GEN_BROADCAST_FRAMES_RCV 0x0002020C -#define OID_GEN_RCV_CRC_ERROR 0x0002020D -#define OID_GEN_TRANSMIT_QUEUE_LENGTH 0x0002020E -#define OID_GEN_GET_TIME_CAPS 0x0002020F -#define OID_GEN_GET_NETCARD_TIME 0x00020210 -// -// These are connection-oriented general OIDs. -// These replace the above OIDs for connection-oriented media. -// -#define OID_GEN_CO_SUPPORTED_LIST 0x00010101 -#define OID_GEN_CO_HARDWARE_STATUS 0x00010102 -#define OID_GEN_CO_MEDIA_SUPPORTED 0x00010103 -#define OID_GEN_CO_MEDIA_IN_USE 0x00010104 -#define OID_GEN_CO_LINK_SPEED 0x00010105 -#define OID_GEN_CO_VENDOR_ID 0x00010106 -#define OID_GEN_CO_VENDOR_DESCRIPTION 0x00010107 -#define OID_GEN_CO_DRIVER_VERSION 0x00010108 -#define OID_GEN_CO_PROTOCOL_OPTIONS 0x00010109 -#define OID_GEN_CO_MAC_OPTIONS 0x0001010A -#define OID_GEN_CO_MEDIA_CONNECT_STATUS 0x0001010B -#define OID_GEN_CO_VENDOR_DRIVER_VERSION 0x0001010C -#define OID_GEN_CO_MINIMUM_LINK_SPEED 0x0001010D -#define OID_GEN_CO_GET_TIME_CAPS 0x00010201 -#define OID_GEN_CO_GET_NETCARD_TIME 0x00010202 -// -// These are connection-oriented statistics OIDs. -// -#define OID_GEN_CO_XMIT_PDUS_OK 0x00020101 -#define OID_GEN_CO_RCV_PDUS_OK 0x00020102 -#define OID_GEN_CO_XMIT_PDUS_ERROR 0x00020103 -#define OID_GEN_CO_RCV_PDUS_ERROR 0x00020104 -#define OID_GEN_CO_RCV_PDUS_NO_BUFFER 0x00020105 -#define OID_GEN_CO_RCV_CRC_ERROR 0x00020201 -#define OID_GEN_CO_TRANSMIT_QUEUE_LENGTH 0x00020202 -#define OID_GEN_CO_BYTES_XMIT 0x00020203 -#define OID_GEN_CO_BYTES_RCV 0x00020204 -#define OID_GEN_CO_BYTES_XMIT_OUTSTANDING 0x00020205 -#define OID_GEN_CO_NETCARD_LOAD 0x00020206 -// -// These are objects for Connection-oriented media call-managers and are not -// valid for ndis drivers. Under construction. -// -#define OID_CO_ADD_PVC 0xFF000001 -#define OID_CO_DELETE_PVC 0xFF000002 -#define OID_CO_GET_CALL_INFORMATION 0xFF000003 -#define OID_CO_ADD_ADDRESS 0xFF000004 -#define OID_CO_DELETE_ADDRESS 0xFF000005 -#define OID_CO_GET_ADDRESSES 0xFF000006 -#define OID_CO_ADDRESS_CHANGE 0xFF000007 -#define OID_CO_SIGNALING_ENABLED 0xFF000008 -#define OID_CO_SIGNALING_DISABLED 0xFF000009 -// -// 802.3 Objects (Ethernet) -// -#define OID_802_3_PERMANENT_ADDRESS 0x01010101 -#define OID_802_3_CURRENT_ADDRESS 0x01010102 -#define OID_802_3_MULTICAST_LIST 0x01010103 -#define OID_802_3_MAXIMUM_LIST_SIZE 0x01010104 -#define OID_802_3_MAC_OPTIONS 0x01010105 -// -// -#define NDIS_802_3_MAC_OPTION_PRIORITY 0x00000001 -#define OID_802_3_RCV_ERROR_ALIGNMENT 0x01020101 -#define OID_802_3_XMIT_ONE_COLLISION 0x01020102 -#define OID_802_3_XMIT_MORE_COLLISIONS 0x01020103 -#define OID_802_3_XMIT_DEFERRED 0x01020201 -#define OID_802_3_XMIT_MAX_COLLISIONS 0x01020202 -#define OID_802_3_RCV_OVERRUN 0x01020203 -#define OID_802_3_XMIT_UNDERRUN 0x01020204 -#define OID_802_3_XMIT_HEARTBEAT_FAILURE 0x01020205 -#define OID_802_3_XMIT_TIMES_CRS_LOST 0x01020206 -#define OID_802_3_XMIT_LATE_COLLISIONS 0x01020207 -// -// 802.5 Objects (Token-Ring) -// -#define OID_802_5_PERMANENT_ADDRESS 0x02010101 -#define OID_802_5_CURRENT_ADDRESS 0x02010102 -#define OID_802_5_CURRENT_FUNCTIONAL 0x02010103 -#define OID_802_5_CURRENT_GROUP 0x02010104 -#define OID_802_5_LAST_OPEN_STATUS 0x02010105 -#define OID_802_5_CURRENT_RING_STATUS 0x02010106 -#define OID_802_5_CURRENT_RING_STATE 0x02010107 -#define OID_802_5_LINE_ERRORS 0x02020101 -#define OID_802_5_LOST_FRAMES 0x02020102 -#define OID_802_5_BURST_ERRORS 0x02020201 -#define OID_802_5_AC_ERRORS 0x02020202 -#define OID_802_5_ABORT_DELIMETERS 0x02020203 -#define OID_802_5_FRAME_COPIED_ERRORS 0x02020204 -#define OID_802_5_FREQUENCY_ERRORS 0x02020205 -#define OID_802_5_TOKEN_ERRORS 0x02020206 -#define OID_802_5_INTERNAL_ERRORS 0x02020207 -// -// FDDI Objects -// -#define OID_FDDI_LONG_PERMANENT_ADDR 0x03010101 -#define OID_FDDI_LONG_CURRENT_ADDR 0x03010102 -#define OID_FDDI_LONG_MULTICAST_LIST 0x03010103 -#define OID_FDDI_LONG_MAX_LIST_SIZE 0x03010104 -#define OID_FDDI_SHORT_PERMANENT_ADDR 0x03010105 -#define OID_FDDI_SHORT_CURRENT_ADDR 0x03010106 -#define OID_FDDI_SHORT_MULTICAST_LIST 0x03010107 -#define OID_FDDI_SHORT_MAX_LIST_SIZE 0x03010108 -#define OID_FDDI_ATTACHMENT_TYPE 0x03020101 -#define OID_FDDI_UPSTREAM_NODE_LONG 0x03020102 -#define OID_FDDI_DOWNSTREAM_NODE_LONG 0x03020103 -#define OID_FDDI_FRAME_ERRORS 0x03020104 -#define OID_FDDI_FRAMES_LOST 0x03020105 -#define OID_FDDI_RING_MGT_STATE 0x03020106 -#define OID_FDDI_LCT_FAILURES 0x03020107 -#define OID_FDDI_LEM_REJECTS 0x03020108 -#define OID_FDDI_LCONNECTION_STATE 0x03020109 -#define OID_FDDI_SMT_STATION_ID 0x03030201 -#define OID_FDDI_SMT_OP_VERSION_ID 0x03030202 -#define OID_FDDI_SMT_HI_VERSION_ID 0x03030203 -#define OID_FDDI_SMT_LO_VERSION_ID 0x03030204 -#define OID_FDDI_SMT_MANUFACTURER_DATA 0x03030205 -#define OID_FDDI_SMT_USER_DATA 0x03030206 -#define OID_FDDI_SMT_MIB_VERSION_ID 0x03030207 -#define OID_FDDI_SMT_MAC_CT 0x03030208 -#define OID_FDDI_SMT_NON_MASTER_CT 0x03030209 -#define OID_FDDI_SMT_MASTER_CT 0x0303020A -#define OID_FDDI_SMT_AVAILABLE_PATHS 0x0303020B -#define OID_FDDI_SMT_CONFIG_CAPABILITIES 0x0303020C -#define OID_FDDI_SMT_CONFIG_POLICY 0x0303020D -#define OID_FDDI_SMT_CONNECTION_POLICY 0x0303020E -#define OID_FDDI_SMT_T_NOTIFY 0x0303020F -#define OID_FDDI_SMT_STAT_RPT_POLICY 0x03030210 -#define OID_FDDI_SMT_TRACE_MAX_EXPIRATION 0x03030211 -#define OID_FDDI_SMT_PORT_INDEXES 0x03030212 -#define OID_FDDI_SMT_MAC_INDEXES 0x03030213 -#define OID_FDDI_SMT_BYPASS_PRESENT 0x03030214 -#define OID_FDDI_SMT_ECM_STATE 0x03030215 -#define OID_FDDI_SMT_CF_STATE 0x03030216 -#define OID_FDDI_SMT_HOLD_STATE 0x03030217 -#define OID_FDDI_SMT_REMOTE_DISCONNECT_FLAG 0x03030218 -#define OID_FDDI_SMT_STATION_STATUS 0x03030219 -#define OID_FDDI_SMT_PEER_WRAP_FLAG 0x0303021A -#define OID_FDDI_SMT_MSG_TIME_STAMP 0x0303021B -#define OID_FDDI_SMT_TRANSITION_TIME_STAMP 0x0303021C -#define OID_FDDI_SMT_SET_COUNT 0x0303021D -#define OID_FDDI_SMT_LAST_SET_STATION_ID 0x0303021E -#define OID_FDDI_MAC_FRAME_STATUS_FUNCTIONS 0x0303021F -#define OID_FDDI_MAC_BRIDGE_FUNCTIONS 0x03030220 -#define OID_FDDI_MAC_T_MAX_CAPABILITY 0x03030221 -#define OID_FDDI_MAC_TVX_CAPABILITY 0x03030222 -#define OID_FDDI_MAC_AVAILABLE_PATHS 0x03030223 -#define OID_FDDI_MAC_CURRENT_PATH 0x03030224 -#define OID_FDDI_MAC_UPSTREAM_NBR 0x03030225 -#define OID_FDDI_MAC_DOWNSTREAM_NBR 0x03030226 -#define OID_FDDI_MAC_OLD_UPSTREAM_NBR 0x03030227 -#define OID_FDDI_MAC_OLD_DOWNSTREAM_NBR 0x03030228 -#define OID_FDDI_MAC_DUP_ADDRESS_TEST 0x03030229 -#define OID_FDDI_MAC_REQUESTED_PATHS 0x0303022A -#define OID_FDDI_MAC_DOWNSTREAM_PORT_TYPE 0x0303022B -#define OID_FDDI_MAC_INDEX 0x0303022C -#define OID_FDDI_MAC_SMT_ADDRESS 0x0303022D -#define OID_FDDI_MAC_LONG_GRP_ADDRESS 0x0303022E -#define OID_FDDI_MAC_SHORT_GRP_ADDRESS 0x0303022F -#define OID_FDDI_MAC_T_REQ 0x03030230 -#define OID_FDDI_MAC_T_NEG 0x03030231 -#define OID_FDDI_MAC_T_MAX 0x03030232 -#define OID_FDDI_MAC_TVX_VALUE 0x03030233 -#define OID_FDDI_MAC_T_PRI0 0x03030234 -#define OID_FDDI_MAC_T_PRI1 0x03030235 -#define OID_FDDI_MAC_T_PRI2 0x03030236 -#define OID_FDDI_MAC_T_PRI3 0x03030237 -#define OID_FDDI_MAC_T_PRI4 0x03030238 -#define OID_FDDI_MAC_T_PRI5 0x03030239 -#define OID_FDDI_MAC_T_PRI6 0x0303023A -#define OID_FDDI_MAC_FRAME_CT 0x0303023B -#define OID_FDDI_MAC_COPIED_CT 0x0303023C -#define OID_FDDI_MAC_TRANSMIT_CT 0x0303023D -#define OID_FDDI_MAC_TOKEN_CT 0x0303023E -#define OID_FDDI_MAC_ERROR_CT 0x0303023F -#define OID_FDDI_MAC_LOST_CT 0x03030240 -#define OID_FDDI_MAC_TVX_EXPIRED_CT 0x03030241 -#define OID_FDDI_MAC_NOT_COPIED_CT 0x03030242 -#define OID_FDDI_MAC_LATE_CT 0x03030243 -#define OID_FDDI_MAC_RING_OP_CT 0x03030244 -#define OID_FDDI_MAC_FRAME_ERROR_THRESHOLD 0x03030245 -#define OID_FDDI_MAC_FRAME_ERROR_RATIO 0x03030246 -#define OID_FDDI_MAC_NOT_COPIED_THRESHOLD 0x03030247 -#define OID_FDDI_MAC_NOT_COPIED_RATIO 0x03030248 -#define OID_FDDI_MAC_RMT_STATE 0x03030249 -#define OID_FDDI_MAC_DA_FLAG 0x0303024A -#define OID_FDDI_MAC_UNDA_FLAG 0x0303024B -#define OID_FDDI_MAC_FRAME_ERROR_FLAG 0x0303024C -#define OID_FDDI_MAC_NOT_COPIED_FLAG 0x0303024D -#define OID_FDDI_MAC_MA_UNITDATA_AVAILABLE 0x0303024E -#define OID_FDDI_MAC_HARDWARE_PRESENT 0x0303024F -#define OID_FDDI_MAC_MA_UNITDATA_ENABLE 0x03030250 -#define OID_FDDI_PATH_INDEX 0x03030251 -#define OID_FDDI_PATH_RING_LATENCY 0x03030252 -#define OID_FDDI_PATH_TRACE_STATUS 0x03030253 -#define OID_FDDI_PATH_SBA_PAYLOAD 0x03030254 -#define OID_FDDI_PATH_SBA_OVERHEAD 0x03030255 -#define OID_FDDI_PATH_CONFIGURATION 0x03030256 -#define OID_FDDI_PATH_T_R_MODE 0x03030257 -#define OID_FDDI_PATH_SBA_AVAILABLE 0x03030258 -#define OID_FDDI_PATH_TVX_LOWER_BOUND 0x03030259 -#define OID_FDDI_PATH_T_MAX_LOWER_BOUND 0x0303025A -#define OID_FDDI_PATH_MAX_T_REQ 0x0303025B -#define OID_FDDI_PORT_MY_TYPE 0x0303025C -#define OID_FDDI_PORT_NEIGHBOR_TYPE 0x0303025D -#define OID_FDDI_PORT_CONNECTION_POLICIES 0x0303025E -#define OID_FDDI_PORT_MAC_INDICATED 0x0303025F -#define OID_FDDI_PORT_CURRENT_PATH 0x03030260 -#define OID_FDDI_PORT_REQUESTED_PATHS 0x03030261 -#define OID_FDDI_PORT_MAC_PLACEMENT 0x03030262 -#define OID_FDDI_PORT_AVAILABLE_PATHS 0x03030263 -#define OID_FDDI_PORT_MAC_LOOP_TIME 0x03030264 -#define OID_FDDI_PORT_PMD_CLASS 0x03030265 -#define OID_FDDI_PORT_CONNECTION_CAPABILITIES 0x03030266 -#define OID_FDDI_PORT_INDEX 0x03030267 -#define OID_FDDI_PORT_MAINT_LS 0x03030268 -#define OID_FDDI_PORT_BS_FLAG 0x03030269 -#define OID_FDDI_PORT_PC_LS 0x0303026A -#define OID_FDDI_PORT_EB_ERROR_CT 0x0303026B -#define OID_FDDI_PORT_LCT_FAIL_CT 0x0303026C -#define OID_FDDI_PORT_LER_ESTIMATE 0x0303026D -#define OID_FDDI_PORT_LEM_REJECT_CT 0x0303026E -#define OID_FDDI_PORT_LEM_CT 0x0303026F -#define OID_FDDI_PORT_LER_CUTOFF 0x03030270 -#define OID_FDDI_PORT_LER_ALARM 0x03030271 -#define OID_FDDI_PORT_CONNNECT_STATE 0x03030272 -#define OID_FDDI_PORT_PCM_STATE 0x03030273 -#define OID_FDDI_PORT_PC_WITHHOLD 0x03030274 -#define OID_FDDI_PORT_LER_FLAG 0x03030275 -#define OID_FDDI_PORT_HARDWARE_PRESENT 0x03030276 -#define OID_FDDI_SMT_STATION_ACTION 0x03030277 -#define OID_FDDI_PORT_ACTION 0x03030278 -#define OID_FDDI_IF_DESCR 0x03030279 -#define OID_FDDI_IF_TYPE 0x0303027A -#define OID_FDDI_IF_MTU 0x0303027B -#define OID_FDDI_IF_SPEED 0x0303027C -#define OID_FDDI_IF_PHYS_ADDRESS 0x0303027D -#define OID_FDDI_IF_ADMIN_STATUS 0x0303027E -#define OID_FDDI_IF_OPER_STATUS 0x0303027F -#define OID_FDDI_IF_LAST_CHANGE 0x03030280 -#define OID_FDDI_IF_IN_OCTETS 0x03030281 -#define OID_FDDI_IF_IN_UCAST_PKTS 0x03030282 -#define OID_FDDI_IF_IN_NUCAST_PKTS 0x03030283 -#define OID_FDDI_IF_IN_DISCARDS 0x03030284 -#define OID_FDDI_IF_IN_ERRORS 0x03030285 -#define OID_FDDI_IF_IN_UNKNOWN_PROTOS 0x03030286 -#define OID_FDDI_IF_OUT_OCTETS 0x03030287 -#define OID_FDDI_IF_OUT_UCAST_PKTS 0x03030288 -#define OID_FDDI_IF_OUT_NUCAST_PKTS 0x03030289 -#define OID_FDDI_IF_OUT_DISCARDS 0x0303028A -#define OID_FDDI_IF_OUT_ERRORS 0x0303028B -#define OID_FDDI_IF_OUT_QLEN 0x0303028C -#define OID_FDDI_IF_SPECIFIC 0x0303028D -// -// WAN objects -// -#define OID_WAN_PERMANENT_ADDRESS 0x04010101 -#define OID_WAN_CURRENT_ADDRESS 0x04010102 -#define OID_WAN_QUALITY_OF_SERVICE 0x04010103 -#define OID_WAN_PROTOCOL_TYPE 0x04010104 -#define OID_WAN_MEDIUM_SUBTYPE 0x04010105 -#define OID_WAN_HEADER_FORMAT 0x04010106 -#define OID_WAN_GET_INFO 0x04010107 -#define OID_WAN_SET_LINK_INFO 0x04010108 -#define OID_WAN_GET_LINK_INFO 0x04010109 -#define OID_WAN_LINE_COUNT 0x0401010A -#define OID_WAN_GET_BRIDGE_INFO 0x0401020A -#define OID_WAN_SET_BRIDGE_INFO 0x0401020B -#define OID_WAN_GET_COMP_INFO 0x0401020C -#define OID_WAN_SET_COMP_INFO 0x0401020D -#define OID_WAN_GET_STATS_INFO 0x0401020E -// -// LocalTalk objects -// -#define OID_LTALK_CURRENT_NODE_ID 0x05010102 -#define OID_LTALK_IN_BROADCASTS 0x05020101 -#define OID_LTALK_IN_LENGTH_ERRORS 0x05020102 -#define OID_LTALK_OUT_NO_HANDLERS 0x05020201 -#define OID_LTALK_COLLISIONS 0x05020202 -#define OID_LTALK_DEFERS 0x05020203 -#define OID_LTALK_NO_DATA_ERRORS 0x05020204 -#define OID_LTALK_RANDOM_CTS_ERRORS 0x05020205 -#define OID_LTALK_FCS_ERRORS 0x05020206 -// -// Arcnet objects -// -#define OID_ARCNET_PERMANENT_ADDRESS 0x06010101 -#define OID_ARCNET_CURRENT_ADDRESS 0x06010102 -#define OID_ARCNET_RECONFIGURATIONS 0x06020201 -// -// TAPI objects -// -#define OID_TAPI_ACCEPT 0x07030101 -#define OID_TAPI_ANSWER 0x07030102 -#define OID_TAPI_CLOSE 0x07030103 -#define OID_TAPI_CLOSE_CALL 0x07030104 -#define OID_TAPI_CONDITIONAL_MEDIA_DETECTION 0x07030105 -#define OID_TAPI_CONFIG_DIALOG 0x07030106 -#define OID_TAPI_DEV_SPECIFIC 0x07030107 -#define OID_TAPI_DIAL 0x07030108 -#define OID_TAPI_DROP 0x07030109 -#define OID_TAPI_GET_ADDRESS_CAPS 0x0703010A -#define OID_TAPI_GET_ADDRESS_ID 0x0703010B -#define OID_TAPI_GET_ADDRESS_STATUS 0x0703010C -#define OID_TAPI_GET_CALL_ADDRESS_ID 0x0703010D -#define OID_TAPI_GET_CALL_INFO 0x0703010E -#define OID_TAPI_GET_CALL_STATUS 0x0703010F -#define OID_TAPI_GET_DEV_CAPS 0x07030110 -#define OID_TAPI_GET_DEV_CONFIG 0x07030111 -#define OID_TAPI_GET_EXTENSION_ID 0x07030112 -#define OID_TAPI_GET_ID 0x07030113 -#define OID_TAPI_GET_LINE_DEV_STATUS 0x07030114 -#define OID_TAPI_MAKE_CALL 0x07030115 -#define OID_TAPI_NEGOTIATE_EXT_VERSION 0x07030116 -#define OID_TAPI_OPEN 0x07030117 -#define OID_TAPI_PROVIDER_INITIALIZE 0x07030118 -#define OID_TAPI_PROVIDER_SHUTDOWN 0x07030119 -#define OID_TAPI_SECURE_CALL 0x0703011A -#define OID_TAPI_SELECT_EXT_VERSION 0x0703011B -#define OID_TAPI_SEND_USER_USER_INFO 0x0703011C -#define OID_TAPI_SET_APP_SPECIFIC 0x0703011D -#define OID_TAPI_SET_CALL_PARAMS 0x0703011E -#define OID_TAPI_SET_DEFAULT_MEDIA_DETECTION 0x0703011F -#define OID_TAPI_SET_DEV_CONFIG 0x07030120 -#define OID_TAPI_SET_MEDIA_MODE 0x07030121 -#define OID_TAPI_SET_STATUS_MESSAGES 0x07030122 -// -// ATM Connection Oriented Ndis -// -#define OID_ATM_SUPPORTED_VC_RATES 0x08010101 -#define OID_ATM_SUPPORTED_SERVICE_CATEGORY 0x08010102 -#define OID_ATM_SUPPORTED_AAL_TYPES 0x08010103 -#define OID_ATM_HW_CURRENT_ADDRESS 0x08010104 -#define OID_ATM_MAX_ACTIVE_VCS 0x08010105 -#define OID_ATM_MAX_ACTIVE_VCI_BITS 0x08010106 -#define OID_ATM_MAX_ACTIVE_VPI_BITS 0x08010107 -#define OID_ATM_MAX_AAL0_PACKET_SIZE 0x08010108 -#define OID_ATM_MAX_AAL1_PACKET_SIZE 0x08010109 -#define OID_ATM_MAX_AAL34_PACKET_SIZE 0x0801010A -#define OID_ATM_MAX_AAL5_PACKET_SIZE 0x0801010B -#define OID_ATM_SIGNALING_VPIVCI 0x08010201 -#define OID_ATM_ASSIGNED_VPI 0x08010202 -#define OID_ATM_ACQUIRE_ACCESS_NET_RESOURCES 0x08010203 -#define OID_ATM_RELEASE_ACCESS_NET_RESOURCES 0x08010204 -#define OID_ATM_ILMI_VPIVCI 0x08010205 -#define OID_ATM_DIGITAL_BROADCAST_VPIVCI 0x08010206 -#define OID_ATM_GET_NEAREST_FLOW 0x08010207 -#define OID_ATM_ALIGNMENT_REQUIRED 0x08010208 -// -// ATM specific statistics OIDs. -// -#define OID_ATM_RCV_CELLS_OK 0x08020101 -#define OID_ATM_XMIT_CELLS_OK 0x08020102 -#define OID_ATM_RCV_CELLS_DROPPED 0x08020103 -#define OID_ATM_RCV_INVALID_VPI_VCI 0x08020201 -#define OID_ATM_CELLS_HEC_ERROR 0x08020202 -#define OID_ATM_RCV_REASSEMBLY_ERROR 0x08020203 -// -// PCCA (Wireless) object -// -// -// All WirelessWAN devices must support the following OIDs -// -#define OID_WW_GEN_NETWORK_TYPES_SUPPORTED 0x09010101 -#define OID_WW_GEN_NETWORK_TYPE_IN_USE 0x09010102 -#define OID_WW_GEN_HEADER_FORMATS_SUPPORTED 0x09010103 -#define OID_WW_GEN_HEADER_FORMAT_IN_USE 0x09010104 -#define OID_WW_GEN_INDICATION_REQUEST 0x09010105 -#define OID_WW_GEN_DEVICE_INFO 0x09010106 -#define OID_WW_GEN_OPERATION_MODE 0x09010107 -#define OID_WW_GEN_LOCK_STATUS 0x09010108 -#define OID_WW_GEN_DISABLE_TRANSMITTER 0x09010109 -#define OID_WW_GEN_NETWORK_ID 0x0901010A -#define OID_WW_GEN_PERMANENT_ADDRESS 0x0901010B -#define OID_WW_GEN_CURRENT_ADDRESS 0x0901010C -#define OID_WW_GEN_SUSPEND_DRIVER 0x0901010D -#define OID_WW_GEN_BASESTATION_ID 0x0901010E -#define OID_WW_GEN_CHANNEL_ID 0x0901010F -#define OID_WW_GEN_ENCRYPTION_SUPPORTED 0x09010110 -#define OID_WW_GEN_ENCRYPTION_IN_USE 0x09010111 -#define OID_WW_GEN_ENCRYPTION_STATE 0x09010112 -#define OID_WW_GEN_CHANNEL_QUALITY 0x09010113 -#define OID_WW_GEN_REGISTRATION_STATUS 0x09010114 -#define OID_WW_GEN_RADIO_LINK_SPEED 0x09010115 -#define OID_WW_GEN_LATENCY 0x09010116 -#define OID_WW_GEN_BATTERY_LEVEL 0x09010117 -#define OID_WW_GEN_EXTERNAL_POWER 0x09010118 -// -// Network Dependent OIDs - Mobitex: -// -#define OID_WW_MBX_SUBADDR 0x09050101 -// OID 0x09050102 is reserved and may not be used -#define OID_WW_MBX_FLEXLIST 0x09050103 -#define OID_WW_MBX_GROUPLIST 0x09050104 -#define OID_WW_MBX_TRAFFIC_AREA 0x09050105 -#define OID_WW_MBX_LIVE_DIE 0x09050106 -#define OID_WW_MBX_TEMP_DEFAULTLIST 0x09050107 -// -// Network Dependent OIDs - Pinpoint: -// -#define OID_WW_PIN_LOC_AUTHORIZE 0x09090101 -#define OID_WW_PIN_LAST_LOCATION 0x09090102 -#define OID_WW_PIN_LOC_FIX 0x09090103 -// -// Network Dependent - CDPD: -// -#define OID_WW_CDPD_SPNI 0x090D0101 -#define OID_WW_CDPD_WASI 0x090D0102 -#define OID_WW_CDPD_AREA_COLOR 0x090D0103 -#define OID_WW_CDPD_TX_POWER_LEVEL 0x090D0104 -#define OID_WW_CDPD_EID 0x090D0105 -#define OID_WW_CDPD_HEADER_COMPRESSION 0x090D0106 -#define OID_WW_CDPD_DATA_COMPRESSION 0x090D0107 -#define OID_WW_CDPD_CHANNEL_SELECT 0x090D0108 -#define OID_WW_CDPD_CHANNEL_STATE 0x090D0109 -#define OID_WW_CDPD_NEI 0x090D010A -#define OID_WW_CDPD_NEI_STATE 0x090D010B -#define OID_WW_CDPD_SERVICE_PROVIDER_IDENTIFIER 0x090D010C -#define OID_WW_CDPD_SLEEP_MODE 0x090D010D -#define OID_WW_CDPD_CIRCUIT_SWITCHED 0x090D010E -#define OID_WW_CDPD_TEI 0x090D010F -#define OID_WW_CDPD_RSSI 0x090D0110 -// -// Network Dependent - Ardis: -// -#define OID_WW_ARD_SNDCP 0x09110101 -#define OID_WW_ARD_TMLY_MSG 0x09110102 -#define OID_WW_ARD_DATAGRAM 0x09110103 -// -// Network Dependent - DataTac: -// -#define OID_WW_TAC_COMPRESSION 0x09150101 -#define OID_WW_TAC_SET_CONFIG 0x09150102 -#define OID_WW_TAC_GET_STATUS 0x09150103 -#define OID_WW_TAC_USER_HEADER 0x09150104 -// -// Network Dependent - Metricom: -// -#define OID_WW_MET_FUNCTION 0x09190101 -// -// IRDA objects -// -#define OID_IRDA_RECEIVING 0x0A010100 -#define OID_IRDA_TURNAROUND_TIME 0x0A010101 -#define OID_IRDA_SUPPORTED_SPEEDS 0x0A010102 -#define OID_IRDA_LINK_SPEED 0x0A010103 -#define OID_IRDA_MEDIA_BUSY 0x0A010104 -#define OID_IRDA_EXTRA_RCV_BOFS 0x0A010200 -#define OID_IRDA_RATE_SNIFF 0x0A010201 -#define OID_IRDA_UNICAST_LIST 0x0A010202 -#define OID_IRDA_MAX_UNICAST_LIST_SIZE 0x0A010203 -#define OID_IRDA_MAX_RECEIVE_WINDOW_SIZE 0x0A010204 -#define OID_IRDA_MAX_SEND_WINDOW_SIZE 0x0A010205 -// -// Medium the Ndis Driver is running on (OID_GEN_MEDIA_SUPPORTED/ -// OID_GEN_MEDIA_IN_USE). -// -typedef enum _NDIS_MEDIUM { - NdisMedium802_3, - NdisMedium802_5, - NdisMediumFddi, - NdisMediumWan, - NdisMediumLocalTalk, - NdisMediumDix, // defined for convenience, not a real medium - NdisMediumArcnetRaw, - NdisMediumArcnet878_2, - NdisMediumAtm, - NdisMediumWirelessWan, - NdisMediumIrda, - NdisMediumMax // Not a real medium, defined as an upper-bound -} NDIS_MEDIUM, *PNDIS_MEDIUM; - -// -// Hardware status codes (OID_GEN_HARDWARE_STATUS). -// -typedef enum _NDIS_HARDWARE_STATUS { - NdisHardwareStatusReady, - NdisHardwareStatusInitializing, - NdisHardwareStatusReset, - NdisHardwareStatusClosing, - NdisHardwareStatusNotReady -} NDIS_HARDWARE_STATUS, *PNDIS_HARDWARE_STATUS; - -// -// this is the type passed in the OID_GEN_GET_TIME_CAPS request -// -typedef struct _GEN_GET_TIME_CAPS { - ULONG Flags; // Bits defined below - - ULONG ClockPrecision; -} GEN_GET_TIME_CAPS, *PGEN_GET_TIME_CAPS; - -#define READABLE_LOCAL_CLOCK 0x000000001 -#define CLOCK_NETWORK_DERIVED 0x000000002 -#define CLOCK_PRECISION 0x000000004 -#define RECEIVE_TIME_INDICATION_CAPABLE 0x000000008 -#define TIMED_SEND_CAPABLE 0x000000010 -#define TIME_STAMP_CAPABLE 0x000000020 -// -// -// this is the type passed in the OID_GEN_GET_NETCARD_TIME request -// -typedef struct _GEN_GET_NETCARD_TIME { - ULONG ReadTime; -} GEN_GET_NETCARD_TIME, *PGEN_GET_NETCARD_TIME; - -// -// Defines the attachment types for FDDI (OID_FDDI_ATTACHMENT_TYPE). -// -typedef enum _NDIS_FDDI_ATTACHMENT_TYPE { - NdisFddiTypeIsolated = 1, - NdisFddiTypeLocalA, - NdisFddiTypeLocalB, - NdisFddiTypeLocalAB, - NdisFddiTypeLocalS, - NdisFddiTypeWrapA, - NdisFddiTypeWrapB, - NdisFddiTypeWrapAB, - NdisFddiTypeWrapS, - NdisFddiTypeCWrapA, - NdisFddiTypeCWrapB, - NdisFddiTypeCWrapS, - NdisFddiTypeThrough -} NDIS_FDDI_ATTACHMENT_TYPE, *PNDIS_FDDI_ATTACHMENT_TYPE; - -// -// Defines the ring management states for FDDI (OID_FDDI_RING_MGT_STATE). -// -typedef enum _NDIS_FDDI_RING_MGT_STATE { - NdisFddiRingIsolated = 1, - NdisFddiRingNonOperational, - NdisFddiRingOperational, - NdisFddiRingDetect, - NdisFddiRingNonOperationalDup, - NdisFddiRingOperationalDup, - NdisFddiRingDirected, - NdisFddiRingTrace -} NDIS_FDDI_RING_MGT_STATE, *PNDIS_FDDI_RING_MGT_STATE; - -// -// Defines the Lconnection state for FDDI (OID_FDDI_LCONNECTION_STATE). -// -typedef enum _NDIS_FDDI_LCONNECTION_STATE { - NdisFddiStateOff = 1, - NdisFddiStateBreak, - NdisFddiStateTrace, - NdisFddiStateConnect, - NdisFddiStateNext, - NdisFddiStateSignal, - NdisFddiStateJoin, - NdisFddiStateVerify, - NdisFddiStateActive, - NdisFddiStateMaintenance -} NDIS_FDDI_LCONNECTION_STATE, *PNDIS_FDDI_LCONNECTION_STATE; - -// -// Defines the medium subtypes for WAN medium (OID_WAN_MEDIUM_SUBTYPE). -// -typedef enum _NDIS_WAN_MEDIUM_SUBTYPE { - NdisWanMediumHub, - NdisWanMediumX_25, - NdisWanMediumIsdn, - NdisWanMediumSerial, - NdisWanMediumFrameRelay, - NdisWanMediumAtm, - NdisWanMediumSonet, - NdisWanMediumSW56K -} NDIS_WAN_MEDIUM_SUBTYPE, *PNDIS_WAN_MEDIUM_SUBTYPE; - -// -// Defines the header format for WAN medium (OID_WAN_HEADER_FORMAT). -// -typedef enum _NDIS_WAN_HEADER_FORMAT { - NdisWanHeaderNative, // src/dest based on subtype, followed by NLPID - NdisWanHeaderEthernet // emulation of ethernet header -} NDIS_WAN_HEADER_FORMAT, *PNDIS_WAN_HEADER_FORMAT; - -// -// Defines the line quality on a WAN line (OID_WAN_QUALITY_OF_SERVICE). -// -typedef enum _NDIS_WAN_QUALITY { - NdisWanRaw, - NdisWanErrorControl, - NdisWanReliable -} NDIS_WAN_QUALITY, *PNDIS_WAN_QUALITY; - -// -// Defines the state of a token-ring adapter (OID_802_5_CURRENT_RING_STATE). -// -typedef enum _NDIS_802_5_RING_STATE { - NdisRingStateOpened = 1, - NdisRingStateClosed, - NdisRingStateOpening, - NdisRingStateClosing, - NdisRingStateOpenFailure, - NdisRingStateRingFailure -} NDIS_802_5_RING_STATE, *PNDIS_802_5_RING_STATE; - -// -// Defines the state of the LAN media -// -typedef enum _NDIS_MEDIA_STATE { - NdisMediaStateConnected, - NdisMediaStateDisconnected -} NDIS_MEDIA_STATE, *PNDIS_MEDIA_STATE; - -// -// The following is set on a per-packet basis as OOB data with NdisClass802_3Priority -// -typedef ULONG Priority_802_3; // 0-7 priority levels -// -// The following structure is used to query OID_GEN_CO_LINK_SPEED and -// OID_GEN_CO_MINIMUM_LINK_SPEED. The first OID will return the current -// link speed of the adapter. The second will return the minimum link speed -// the adapter is capable of. -// - -typedef struct _NDIS_CO_LINK_SPEED { - ULONG Outbound; - ULONG Inbound; -} NDIS_CO_LINK_SPEED, - -*PNDIS_CO_LINK_SPEED; -// -// Ndis Packet Filter Bits (OID_GEN_CURRENT_PACKET_FILTER). -// -#define NDIS_PACKET_TYPE_DIRECTED 0x0001 -#define NDIS_PACKET_TYPE_MULTICAST 0x0002 -#define NDIS_PACKET_TYPE_ALL_MULTICAST 0x0004 -#define NDIS_PACKET_TYPE_BROADCAST 0x0008 -#define NDIS_PACKET_TYPE_SOURCE_ROUTING 0x0010 -#define NDIS_PACKET_TYPE_PROMISCUOUS 0x0020 -#define NDIS_PACKET_TYPE_SMT 0x0040 -#define NDIS_PACKET_TYPE_ALL_LOCAL 0x0080 -#define NDIS_PACKET_TYPE_MAC_FRAME 0x8000 -#define NDIS_PACKET_TYPE_FUNCTIONAL 0x4000 -#define NDIS_PACKET_TYPE_ALL_FUNCTIONAL 0x2000 -#define NDIS_PACKET_TYPE_GROUP 0x1000 -// -// Ndis Token-Ring Ring Status Codes (OID_802_5_CURRENT_RING_STATUS). -// -#define NDIS_RING_SIGNAL_LOSS 0x00008000 -#define NDIS_RING_HARD_ERROR 0x00004000 -#define NDIS_RING_SOFT_ERROR 0x00002000 -#define NDIS_RING_TRANSMIT_BEACON 0x00001000 -#define NDIS_RING_LOBE_WIRE_FAULT 0x00000800 -#define NDIS_RING_AUTO_REMOVAL_ERROR 0x00000400 -#define NDIS_RING_REMOVE_RECEIVED 0x00000200 -#define NDIS_RING_COUNTER_OVERFLOW 0x00000100 -#define NDIS_RING_SINGLE_STATION 0x00000080 -#define NDIS_RING_RING_RECOVERY 0x00000040 -// -// Ndis protocol option bits (OID_GEN_PROTOCOL_OPTIONS). -// -#define NDIS_PROT_OPTION_ESTIMATED_LENGTH 0x00000001 -#define NDIS_PROT_OPTION_NO_LOOPBACK 0x00000002 -#define NDIS_PROT_OPTION_NO_RSVD_ON_RCVPKT 0x00000004 -// -// Ndis MAC option bits (OID_GEN_MAC_OPTIONS). -// -#define NDIS_MAC_OPTION_COPY_LOOKAHEAD_DATA 0x00000001 -#define NDIS_MAC_OPTION_RECEIVE_SERIALIZED 0x00000002 -#define NDIS_MAC_OPTION_TRANSFERS_NOT_PEND 0x00000004 -#define NDIS_MAC_OPTION_NO_LOOPBACK 0x00000008 -#define NDIS_MAC_OPTION_FULL_DUPLEX 0x00000010 -#define NDIS_MAC_OPTION_EOTX_INDICATION 0x00000020 -#define NDIS_MAC_OPTION_RESERVED 0x80000000 -// -// NDIS MAC option bits for OID_GEN_CO_MAC_OPTIONS. -// -#define NDIS_CO_MAC_OPTION_DYNAMIC_LINK_SPEED 0x00000001 -#ifdef IRDA -// -// The following is set on a per-packet basis as OOB data with NdisClassIrdaPacketInfo -// This is the per-packet info specified on a per-packet basis -// -typedef struct _NDIS_IRDA_PACKET_INFO { - UINT ExtraBOFs; - UINT MinTurnAroundTime; -} NDIS_IRDA_PACKET_INFO, *PNDIS_IRDA_PACKET_INFO; - -#endif -#ifdef WIRELESS_WAN -// -// Wireless WAN structure definitions -// -// -// currently defined Wireless network subtypes -// -typedef enum _NDIS_WW_NETWORK_TYPE { - NdisWWGeneric, - NdisWWMobitex, - NdisWWPinpoint, - NdisWWCDPD, - NdisWWArdis, - NdisWWDataTAC, - NdisWWMetricom, - NdisWWGSM, - NdisWWCDMA, - NdisWWTDMA, - NdisWWAMPS, - NdisWWInmarsat, - NdisWWpACT -} NDIS_WW_NETWORK_TYPE; - -// -// currently defined header formats -// -typedef enum _NDIS_WW_HEADER_FORMAT { - NdisWWDIXEthernetFrames, - NdisWWMPAKFrames, - NdisWWRDLAPFrames, - NdisWWMDC4800Frames -} NDIS_WW_HEADER_FORMAT; - -// -// currently defined encryption types -// -typedef enum _NDIS_WW_ENCRYPTION_TYPE { - NdisWWUnknownEncryption = -1, - NdisWWNoEncryption, - NdisWWDefaultEncryption -} NDIS_WW_ENCRYPTION_TYPE, *PNDIS_WW_ENCRYPTION_TYPE; - -// -// OID_WW_GEN_INDICATION_REQUEST -// -typedef struct _NDIS_WW_INDICATION_REQUEST { - NDIS_OID Oid; // IN - - UINT uIndicationFlag; // IN - - UINT uApplicationToken; // IN OUT - - HANDLE hIndicationHandle; // IN OUT - - INT iPollingInterval; // IN OUT - - NDIS_VAR_DATA_DESC InitialValue; // IN OUT - - NDIS_VAR_DATA_DESC OIDIndicationValue; // OUT - only valid after indication - - NDIS_VAR_DATA_DESC TriggerValue; // IN - -} NDIS_WW_INDICATION_REQUEST, *PNDIS_WW_INDICATION_REQUEST; - -#define OID_INDICATION_REQUEST_ENABLE 0x0000 -#define OID_INDICATION_REQUEST_CANCEL 0x0001 -// -// OID_WW_GEN_DEVICE_INFO -// -typedef struct _WW_DEVICE_INFO { - NDIS_VAR_DATA_DESC Manufacturer; - NDIS_VAR_DATA_DESC ModelNum; - NDIS_VAR_DATA_DESC SWVersionNum; - NDIS_VAR_DATA_DESC SerialNum; -} WW_DEVICE_INFO, *PWW_DEVICE_INFO; - -// -// OID_WW_GEN_OPERATION_MODE -// -typedef INT WW_OPERATION_MODE; // 0 = Normal mode - // 1 = Power saving mode - // -1 = mode unknown -// -// OID_WW_GEN_LOCK_STATUS -// - -typedef INT WW_LOCK_STATUS; // 0 = unlocked - // 1 = locked - // -1 = unknown lock status -// -// OID_WW_GEN_DISABLE_TRANSMITTER -// - -typedef INT WW_DISABLE_TRANSMITTER; // 0 = transmitter enabled - // 1 = transmitter disabled - // -1 = unknown value -// -// OID_WW_GEN_NETWORK_ID -// - -typedef NDIS_VAR_DATA_DESC WW_NETWORK_ID; -// -// OID_WW_GEN_PERMANENT_ADDRESS -// -typedef NDIS_VAR_DATA_DESC WW_PERMANENT_ADDRESS; -// -// OID_WW_GEN_CURRENT_ADDRESS -// -typedef struct _WW_CURRENT_ADDRESS { - NDIS_WW_HEADER_FORMAT Format; - NDIS_VAR_DATA_DESC Address; -} WW_CURRENT_ADDRESS, *PWW_CURRENT_ADDRESS; - -// -// OID_WW_GEN_SUSPEND_DRIVER -// -typedef BOOLEAN WW_SUSPEND_DRIVER; // 0 = driver operational - // 1 = driver suspended -// -// OID_WW_GEN_BASESTATION_ID -// - -typedef NDIS_VAR_DATA_DESC WW_BASESTATION_ID; -// -// OID_WW_GEN_CHANNEL_ID -// -typedef NDIS_VAR_DATA_DESC WW_CHANNEL_ID; -// -// OID_WW_GEN_ENCRYPTION_STATE -// -typedef BOOLEAN WW_ENCRYPTION_STATE; // 0 = if encryption is disabled - // 1 = if encryption is enabled -// -// OID_WW_GEN_CHANNEL_QUALITY -// - -typedef INT WW_CHANNEL_QUALITY; // 0 = Not in network contact, - // 1-100 = Quality of Channel (100 is highest quality). - // -1 = channel quality is unknown -// -// OID_WW_GEN_REGISTRATION_STATUS -// - -typedef INT WW_REGISTRATION_STATUS; // 0 = Registration denied - // 1 = Registration pending - // 2 = Registered - // -1 = unknown registration status -// -// OID_WW_GEN_RADIO_LINK_SPEED -// - -typedef UINT WW_RADIO_LINK_SPEED; // Bits per second. -// -// OID_WW_GEN_LATENCY -// - -typedef UINT WW_LATENCY; // milliseconds -// -// OID_WW_GEN_BATTERY_LEVEL -// - -typedef INT WW_BATTERY_LEVEL; // 0-100 = battery level in percentage - // (100=fully charged) - // -1 = unknown battery level. -// -// OID_WW_GEN_EXTERNAL_POWER -// - -typedef INT WW_EXTERNAL_POWER; // 0 = no external power connected - // 1 = external power connected - // -1 = unknown -// -// OID_WW_MET_FUNCTION -// - -typedef NDIS_VAR_DATA_DESC WW_MET_FUNCTION; -// -// OID_WW_TAC_COMPRESSION -// -typedef BOOLEAN WW_TAC_COMPRESSION; // Determines whether or not network level compression - // is being used. -// -// OID_WW_TAC_SET_CONFIG -// - -typedef struct _WW_TAC_SETCONFIG { - NDIS_VAR_DATA_DESC RCV_MODE; - NDIS_VAR_DATA_DESC TX_CONTROL; - NDIS_VAR_DATA_DESC RX_CONTROL; - NDIS_VAR_DATA_DESC FLOW_CONTROL; - NDIS_VAR_DATA_DESC RESET_CNF; - NDIS_VAR_DATA_DESC READ_CNF; -} WW_TAC_SETCONFIG, *PWW_TAC_SETCONFIG; - -// -// OID_WW_TAC_GET_STATUS -// -typedef struct _WW_TAC_GETSTATUS { - BOOLEAN Action; // Set = Execute command. - - NDIS_VAR_DATA_DESC Command; - NDIS_VAR_DATA_DESC Option; - NDIS_VAR_DATA_DESC Response; // The response to the requested command - // - max. length of string is 256 octets. - -} WW_TAC_GETSTATUS, *PWW_TAC_GETSTATUS; - -// -// OID_WW_TAC_USER_HEADER -// -typedef NDIS_VAR_DATA_DESC WW_TAC_USERHEADER; // This will hold the user header - Max. 64 octets. -// -// OID_WW_ARD_SNDCP -// - -typedef struct _WW_ARD_SNDCP { - NDIS_VAR_DATA_DESC Version; // The version of SNDCP protocol supported. - - INT BlockSize; // The block size used for SNDCP - - INT Window; // The window size used in SNDCP - -} WW_ARD_SNDCP, *PWW_ARD_SNDCP; - -// -// OID_WW_ARD_TMLY_MSG -// -typedef BOOLEAN WW_ARD_CHANNEL_STATUS; // The current status of the inbound RF Channel. -// -// OID_WW_ARD_DATAGRAM -// - -typedef struct _WW_ARD_DATAGRAM { - BOOLEAN LoadLevel; // Byte that contains the load level info. - - INT SessionTime; // Datagram session time remaining. - - NDIS_VAR_DATA_DESC HostAddr; // Host address. - - NDIS_VAR_DATA_DESC THostAddr; // Test host address. - -} WW_ARD_DATAGRAM, *PWW_ARD_DATAGRAM; - -// -// OID_WW_CDPD_SPNI -// -typedef struct _WW_CDPD_SPNI { - UINT SPNI[10]; //10 16-bit service provider network IDs - - INT OperatingMode; // 0 = ignore SPNI, - // 1 = require SPNI from list, - // 2 = prefer SPNI from list. - // 3 = exclude SPNI from list. - -} WW_CDPD_SPNI, *PWW_CDPD_SPNI; - -// -// OID_WW_CDPD_WASI -// -typedef struct _WW_CDPD_WIDE_AREA_SERVICE_ID { - UINT WASI[10]; //10 16-bit wide area service IDs - - INT OperatingMode; // 0 = ignore WASI, - // 1 = Require WASI from list, - // 2 = prefer WASI from list - // 3 = exclude WASI from list. - -} WW_CDPD_WIDE_AREA_SERVICE_ID, *PWW_CDPD_WIDE_AREA_SERVICE_ID; - -// -// OID_WW_CDPD_AREA_COLOR -// -typedef INT WW_CDPD_AREA_COLOR; -// -// OID_WW_CDPD_TX_POWER_LEVEL -// -typedef UINT WW_CDPD_TX_POWER_LEVEL; -// -// OID_WW_CDPD_EID -// -typedef NDIS_VAR_DATA_DESC WW_CDPD_EID; -// -// OID_WW_CDPD_HEADER_COMPRESSION -// -typedef INT WW_CDPD_HEADER_COMPRESSION; // 0 = no header compression, - // 1 = always compress headers, - // 2 = compress headers if MD-IS does - // -1 = unknown -// -// OID_WW_CDPD_DATA_COMPRESSION -// - -typedef INT WW_CDPD_DATA_COMPRESSION; // 0 = no data compression, - // 1 = data compression enabled - // -1 = unknown -// -// OID_WW_CDPD_CHANNEL_SELECT -// - -typedef struct _WW_CDPD_CHANNEL_SELECT { - UINT ChannelID; // channel number - - UINT fixedDuration; // duration in seconds - -} WW_CDPD_CHANNEL_SELECT, *PWW_CDPD_CHANNEL_SELECT; - -// -// OID_WW_CDPD_CHANNEL_STATE -// -typedef enum _WW_CDPD_CHANNEL_STATE { - CDPDChannelNotAvail, - CDPDChannelScanning, - CDPDChannelInitAcquired, - CDPDChannelAcquired, - CDPDChannelSleeping, - CDPDChannelWaking, - CDPDChannelCSDialing, - CDPDChannelCSRedial, - CDPDChannelCSAnswering, - CDPDChannelCSConnected, - CDPDChannelCSSuspended -} WW_CDPD_CHANNEL_STATE, *PWW_CDPD_CHANNEL_STATE; - -// -// OID_WW_CDPD_NEI -// -typedef enum _WW_CDPD_NEI_FORMAT { - CDPDNeiIPv4, - CDPDNeiCLNP, - CDPDNeiIPv6 -} WW_CDPD_NEI_FORMAT, *PWW_CDPD_NEI_FORMAT; -typedef enum _WW_CDPD_NEI_TYPE { - CDPDNeiIndividual, - CDPDNeiMulticast, - CDPDNeiBroadcast -} WW_CDPD_NEI_TYPE; -typedef struct _WW_CDPD_NEI { - UINT uNeiIndex; - WW_CDPD_NEI_FORMAT NeiFormat; - WW_CDPD_NEI_TYPE NeiType; - WORD NeiGmid; // group member identifier, only - // meaningful if NeiType == - // CDPDNeiMulticast - - NDIS_VAR_DATA_DESC NeiAddress; -} WW_CDPD_NEI; - -// -// OID_WW_CDPD_NEI_STATE -// -typedef enum _WW_CDPD_NEI_STATE { - CDPDUnknown, - CDPDRegistered, - CDPDDeregistered -} WW_CDPD_NEI_STATE, *PWW_CDPD_NEI_STATE; -typedef enum _WW_CDPD_NEI_SUB_STATE { - CDPDPending, // Registration pending - CDPDNoReason, // Registration denied - no reason given - CDPDMDISNotCapable, // Registration denied - MD-IS not capable of - // handling M-ES at this time - CDPDNEINotAuthorized, // Registration denied - NEI is not authorized to - // use this subnetwork - CDPDInsufficientAuth, // Registration denied - M-ES gave insufficient - // authentication credentials - CDPDUnsupportedAuth, // Registration denied - M-ES gave unsupported - // authentication credentials - CDPDUsageExceeded, // Registration denied - NEI has exceeded usage - // limitations - CDPDDeniedThisNetwork // Registration denied on this network, service - // may be obtained on alternate Service Provider - // network -} WW_CDPD_NEI_SUB_STATE; -typedef struct _WW_CDPD_NEI_REG_STATE { - UINT uNeiIndex; - WW_CDPD_NEI_STATE NeiState; - WW_CDPD_NEI_SUB_STATE NeiSubState; -} WW_CDPD_NEI_REG_STATE, *PWW_CDPD_NEI_REG_STATE; - -// -// OID_WW_CDPD_SERVICE_PROVIDER_IDENTIFIER -// -typedef struct _WW_CDPD_SERVICE_PROVIDER_ID { - UINT SPI[10]; //10 16-bit service provider IDs - - INT OperatingMode; // 0 = ignore SPI, - // 1 = require SPI from list, - // 2 = prefer SPI from list. - // 3 = exclude SPI from list. - -} WW_CDPD_SERVICE_PROVIDER_ID, *PWW_CDPD_SERVICE_PROVIDER_ID; - -// -// OID_WW_CDPD_SLEEP_MODE -// -typedef INT WW_CDPD_SLEEP_MODE; -// -// OID_WW_CDPD_TEI -// -typedef ULONG WW_CDPD_TEI; -// -// OID_WW_CDPD_CIRCUIT_SWITCHED -// -typedef struct _WW_CDPD_CIRCUIT_SWITCHED { - INT service_preference; // -1 = unknown, - // 0 = always use packet switched CDPD, - // 1 = always use CS CDPD via AMPS, - // 2 = always use CS CDPD via PSTN, - // 3 = use circuit switched via AMPS only - // when packet switched is not available. - // 4 = use packet switched only when circuit - // switched via AMPS is not available. - // 5 = device manuf. defined service - // preference. - // 6 = device manuf. defined service - // preference. - - INT service_status; // -1 = unknown, - // 0 = packet switched CDPD, - // 1 = circuit switched CDPD via AMPS, - // 2 = circuit switched CDPD via PSTN. - - INT connect_rate; // CS connection bit rate (bits per second). - // 0 = no active connection, - // -1 = unknown - // Dial code last used to dial. - - NDIS_VAR_DATA_DESC dial_code[20]; - - UINT sid; // Current AMPS system ID - - INT a_b_side_selection; // -1 = unknown, - // 0 = no AMPS service - // 1 = AMPS "A" side channels selected - // 2 = AMPS "B" side channels selected - - INT AMPS_channel; // -1= unknown - // 0 = no AMPS service. - // 1-1023 = AMPS channel number in use - - UINT action; // 0 = no action - // 1 = suspend (hangup) - // 2 = dial - - // Default dial code for CS CDPD service - // encoded as specified in the CS CDPD - // implementor guidelines. - NDIS_VAR_DATA_DESC default_dial[20]; - - // Number for the CS CDPD network to call - // back the mobile, encoded as specified in - // the CS CDPD implementor guidelines. - NDIS_VAR_DATA_DESC call_back[20]; - - UINT sid_list[10]; // List of 10 16-bit preferred AMPS - // system IDs for CS CDPD. - - UINT inactivity_timer; // Wait time after last data before dropping - // call. - // 0-65535 = inactivity time limit (seconds). - - UINT receive_timer; // secs. per CS-CDPD Implementor Guidelines. - - UINT conn_resp_timer; // secs. per CS-CDPD Implementor Guidelines. - - UINT reconn_resp_timer; // secs. per CS-CDPD Implementor Guidelines. - - UINT disconn_timer; // secs. per CS-CDPD Implementor Guidelines. - - UINT NEI_reg_timer; // secs. per CS-CDPD Implementor Guidelines. - - UINT reconn_retry_timer; // secs. per CS-CDPD Implementor Guidelines. - - UINT link_reset_timer; // secs. per CS-CDPD Implementor Guidelines. - - UINT link_reset_ack_timer; // secs. per CS-CDPD Implementor Guidelines. - - UINT n401_retry_limit; // per CS-CDPD Implementor Guidelines. - - UINT n402_retry_limit; // per CS-CDPD Implementor Guidelines. - - UINT n404_retry_limit; // per CS-CDPD Implementor Guidelines. - - UINT n405_retry_limit; // per CS-CDPD Implementor Guidelines. - -} WW_CDPD_CIRCUIT_SWITCHED, *WW_PCDPD_CIRCUIT_SWITCHED; -typedef UINT WW_CDPD_RSSI; -// -// OID_WW_PIN_LOC_AUTHORIZE -// -typedef INT WW_PIN_AUTHORIZED; // 0 = unauthorized - // 1 = authorized - // -1 = unknown -// -// OID_WW_PIN_LAST_LOCATION -// OID_WW_PIN_LOC_FIX -// - -typedef struct _WW_PIN_LOCATION { - INT Latitude; // Latitude in hundredths of a second - - INT Longitude; // Longitude in hundredths of a second - - INT Altitude; // Altitude in feet - - INT FixTime; // Time of the location fix, since midnight, local time (of the - // current day), in tenths of a second - - INT NetTime; // Current local network time of the current day, since midnight, - // in tenths of a second - - INT LocQuality; // 0-100 = location quality - - INT LatReg; // Latitude registration offset, in hundredths of a second - - INT LongReg; // Longitude registration offset, in hundredths of a second - - INT GMTOffset; // Offset in minutes of the local time zone from GMT - -} WW_PIN_LOCATION, *PWW_PIN_LOCATION; - -// -// The following is set on a per-packet basis as OOB data with NdisClassWirelessWanMbxMailbox -// -typedef ULONG WW_MBX_MAILBOX_FLAG; // 1 = set mailbox flag, 0 = do not set mailbox flag -// -// OID_WW_MBX_SUBADDR -// - -typedef struct _WW_MBX_PMAN { - BOOLEAN ACTION; // 0 = Login PMAN, 1 = Logout PMAN - - UINT MAN; - UCHAR PASSWORD[8]; // Password should be null for Logout and indications. - // Maximum length of password is 8 chars. - -} WW_MBX_PMAN, *PWW_MBX_PMAN; - -// -// OID_WW_MBX_FLEXLIST -// -typedef struct _WW_MBX_FLEXLIST { - INT count; // Number of MAN entries used. - // -1=unknown. - - UINT MAN[7]; // List of MANs. - -} WW_MBX_FLEXLIST; - -// -// OID_WW_MBX_GROUPLIST -// -typedef struct _WW_MBX_GROUPLIST { - INT count; // Number of MAN entries used. - // -1=unknown. - - UINT MAN[15]; // List of MANs. - -} WW_MBX_GROUPLIST; - -// -// OID_WW_MBX_TRAFFIC_AREA -// -typedef enum _WW_MBX_TRAFFIC_AREA { - unknown_traffic_area, // The driver has no information about the current traffic area. - in_traffic_area, // Mobile unit has entered a subscribed traffic area. - in_auth_traffic_area, // Mobile unit is outside traffic area but is authorized. - unauth_traffic_area // Mobile unit is outside traffic area but is un-authorized. -} WW_MBX_TRAFFIC_AREA; - -// -// OID_WW_MBX_LIVE_DIE -// -typedef INT WW_MBX_LIVE_DIE; // 0 = DIE last received - // 1 = LIVE last received - // -1 = unknown -// -// OID_WW_MBX_TEMP_DEFAULTLIST -// - -typedef struct _WW_MBX_CHANNEL_PAIR { - UINT Mobile_Tx; - UINT Mobile_Rx; -} WW_MBX_CHANNEL_PAIR, *PWW_MBX_CHANNEL_PAIR; -typedef struct _WW_MBX_TEMPDEFAULTLIST { - UINT Length; - WW_MBX_CHANNEL_PAIR ChannelPair[1]; -} WW_MBX_TEMPDEFAULTLIST, *WW_PMBX_TEMPDEFAULTLIST; - -#endif // WIRELESS_WAN -#endif // _NTDDNDIS_ +/*++ BUILD Version: 0001 // Increment this if a change has global effects + Copyright (c) 1990-1993 Microsoft Corporation + Module Name: + ntddndis.h + Abstract: + This is the include file that defines all constants and types for + accessing the Network driver interface device. + Author: + Steve Wood (stevewo) 27-May-1990 + Revision History: + Adam Barr (adamba) 04-Nov-1992 added the correct values for NDIS 3.0. + Jameel Hyder (jameelh) 01-Aug-95 added Pnp IoCTLs and structures + Kyle Brandon (kyleb) 09/24/96 added general co ndis oids. + -- */ +#ifndef _NTDDNDIS_ +#define _NTDDNDIS_ +// +// Device Name - this string is the name of the device. It is the name +// that should be passed to NtOpenFile when accessing the device. +// +// Note: For devices that support multiple units, it should be suffixed +// with the Ascii representation of the unit number. +// +#define DD_NDIS_DEVICE_NAME "\\Device\\UNKNOWN" +// +// NtDeviceIoControlFile IoControlCode values for this device. +// +// Warning: Remember that the low two bits of the code specify how the +// buffers are passed to the driver! +// +#define _NDIS_CONTROL_CODE(request,method) \ + CTL_CODE(FILE_DEVICE_PHYSICAL_NETCARD, request, method, FILE_ANY_ACCESS) +#define IOCTL_NDIS_QUERY_GLOBAL_STATS _NDIS_CONTROL_CODE( 0, METHOD_OUT_DIRECT ) +#define IOCTL_NDIS_QUERY_ALL_STATS _NDIS_CONTROL_CODE( 1, METHOD_OUT_DIRECT ) +#define IOCTL_NDIS_ADD_DEVICE _NDIS_CONTROL_CODE( 2, METHOD_BUFFERED ) +#define IOCTL_NDIS_DELETE_DEVICE _NDIS_CONTROL_CODE( 3, METHOD_BUFFERED ) +#define IOCTL_NDIS_TRANSLATE_NAME _NDIS_CONTROL_CODE( 4, METHOD_BUFFERED ) +#define IOCTL_NDIS_ADD_TDI_DEVICE _NDIS_CONTROL_CODE( 5, METHOD_BUFFERED ) +#define IOCTL_NDIS_NOTIFY_PROTOCOL _NDIS_CONTROL_CODE( 6, METHOD_BUFFERED ) +#define IOCTL_NDIS_GET_LOG_DATA _NDIS_CONTROL_CODE( 7, METHOD_OUT_DIRECT ) +// +// NtDeviceIoControlFile InputBuffer/OutputBuffer record structures for +// this device. +// +// +// This is the type of an NDIS OID value. +// +typedef ULONG NDIS_OID, *PNDIS_OID; +// +// IOCTL_NDIS_QUERY_ALL_STATS returns a sequence of these, packed +// together (no padding is required since statistics all have +// four or eight bytes of data). +// +typedef struct _NDIS_STATISTICS_VALUE { + NDIS_OID Oid; + ULONG DataLength; + UCHAR Data[1]; // variable length + +} NDIS_STATISTICS_VALUE, *PNDIS_STATISTICS_VALUE; + +// +// Structure used by TRANSLATE_NAME IOCTL +// +typedef struct _NET_PNP_ID { + ULONG ClassId; + ULONG Token; +} NET_PNP_ID, *PNET_PNP_ID; + +typedef struct _NET_PNP_TRANSLATE_LIST { + ULONG BytesNeeded; + NET_PNP_ID IdArray[ANYSIZE_ARRAY]; +} NET_PNP_TRANSLATE_LIST, *PNET_PNP_TRANSLATE_LIST; + +// +// Structure used to define a self-contained variable data structure +// +typedef struct _NDIS_VAR_DATA_DESC { + USHORT Length; // # of octects of data + + USHORT MaximumLength; // # of octects available + + LONG Offset; // Offset of data relative to the descriptor + +} NDIS_VAR_DATA_DESC, *PNDIS_VAR_DATA_DESC; + +// +// Object Identifiers used by NdisRequest Query/Set Information +// +// +// General Objects +// +#define OID_GEN_SUPPORTED_LIST 0x00010101 +#define OID_GEN_HARDWARE_STATUS 0x00010102 +#define OID_GEN_MEDIA_SUPPORTED 0x00010103 +#define OID_GEN_MEDIA_IN_USE 0x00010104 +#define OID_GEN_MAXIMUM_LOOKAHEAD 0x00010105 +#define OID_GEN_MAXIMUM_FRAME_SIZE 0x00010106 +#define OID_GEN_LINK_SPEED 0x00010107 +#define OID_GEN_TRANSMIT_BUFFER_SPACE 0x00010108 +#define OID_GEN_RECEIVE_BUFFER_SPACE 0x00010109 +#define OID_GEN_TRANSMIT_BLOCK_SIZE 0x0001010A +#define OID_GEN_RECEIVE_BLOCK_SIZE 0x0001010B +#define OID_GEN_VENDOR_ID 0x0001010C +#define OID_GEN_VENDOR_DESCRIPTION 0x0001010D +#define OID_GEN_CURRENT_PACKET_FILTER 0x0001010E +#define OID_GEN_CURRENT_LOOKAHEAD 0x0001010F +#define OID_GEN_DRIVER_VERSION 0x00010110 +#define OID_GEN_MAXIMUM_TOTAL_SIZE 0x00010111 +#define OID_GEN_PROTOCOL_OPTIONS 0x00010112 +#define OID_GEN_MAC_OPTIONS 0x00010113 +#define OID_GEN_MEDIA_CONNECT_STATUS 0x00010114 +#define OID_GEN_MAXIMUM_SEND_PACKETS 0x00010115 +#define OID_GEN_VENDOR_DRIVER_VERSION 0x00010116 +#define OID_GEN_XMIT_OK 0x00020101 +#define OID_GEN_RCV_OK 0x00020102 +#define OID_GEN_XMIT_ERROR 0x00020103 +#define OID_GEN_RCV_ERROR 0x00020104 +#define OID_GEN_RCV_NO_BUFFER 0x00020105 +#define OID_GEN_DIRECTED_BYTES_XMIT 0x00020201 +#define OID_GEN_DIRECTED_FRAMES_XMIT 0x00020202 +#define OID_GEN_MULTICAST_BYTES_XMIT 0x00020203 +#define OID_GEN_MULTICAST_FRAMES_XMIT 0x00020204 +#define OID_GEN_BROADCAST_BYTES_XMIT 0x00020205 +#define OID_GEN_BROADCAST_FRAMES_XMIT 0x00020206 +#define OID_GEN_DIRECTED_BYTES_RCV 0x00020207 +#define OID_GEN_DIRECTED_FRAMES_RCV 0x00020208 +#define OID_GEN_MULTICAST_BYTES_RCV 0x00020209 +#define OID_GEN_MULTICAST_FRAMES_RCV 0x0002020A +#define OID_GEN_BROADCAST_BYTES_RCV 0x0002020B +#define OID_GEN_BROADCAST_FRAMES_RCV 0x0002020C +#define OID_GEN_RCV_CRC_ERROR 0x0002020D +#define OID_GEN_TRANSMIT_QUEUE_LENGTH 0x0002020E +#define OID_GEN_GET_TIME_CAPS 0x0002020F +#define OID_GEN_GET_NETCARD_TIME 0x00020210 +// +// These are connection-oriented general OIDs. +// These replace the above OIDs for connection-oriented media. +// +#define OID_GEN_CO_SUPPORTED_LIST 0x00010101 +#define OID_GEN_CO_HARDWARE_STATUS 0x00010102 +#define OID_GEN_CO_MEDIA_SUPPORTED 0x00010103 +#define OID_GEN_CO_MEDIA_IN_USE 0x00010104 +#define OID_GEN_CO_LINK_SPEED 0x00010105 +#define OID_GEN_CO_VENDOR_ID 0x00010106 +#define OID_GEN_CO_VENDOR_DESCRIPTION 0x00010107 +#define OID_GEN_CO_DRIVER_VERSION 0x00010108 +#define OID_GEN_CO_PROTOCOL_OPTIONS 0x00010109 +#define OID_GEN_CO_MAC_OPTIONS 0x0001010A +#define OID_GEN_CO_MEDIA_CONNECT_STATUS 0x0001010B +#define OID_GEN_CO_VENDOR_DRIVER_VERSION 0x0001010C +#define OID_GEN_CO_MINIMUM_LINK_SPEED 0x0001010D +#define OID_GEN_CO_GET_TIME_CAPS 0x00010201 +#define OID_GEN_CO_GET_NETCARD_TIME 0x00010202 +// +// These are connection-oriented statistics OIDs. +// +#define OID_GEN_CO_XMIT_PDUS_OK 0x00020101 +#define OID_GEN_CO_RCV_PDUS_OK 0x00020102 +#define OID_GEN_CO_XMIT_PDUS_ERROR 0x00020103 +#define OID_GEN_CO_RCV_PDUS_ERROR 0x00020104 +#define OID_GEN_CO_RCV_PDUS_NO_BUFFER 0x00020105 +#define OID_GEN_CO_RCV_CRC_ERROR 0x00020201 +#define OID_GEN_CO_TRANSMIT_QUEUE_LENGTH 0x00020202 +#define OID_GEN_CO_BYTES_XMIT 0x00020203 +#define OID_GEN_CO_BYTES_RCV 0x00020204 +#define OID_GEN_CO_BYTES_XMIT_OUTSTANDING 0x00020205 +#define OID_GEN_CO_NETCARD_LOAD 0x00020206 +// +// These are objects for Connection-oriented media call-managers and are not +// valid for ndis drivers. Under construction. +// +#define OID_CO_ADD_PVC 0xFF000001 +#define OID_CO_DELETE_PVC 0xFF000002 +#define OID_CO_GET_CALL_INFORMATION 0xFF000003 +#define OID_CO_ADD_ADDRESS 0xFF000004 +#define OID_CO_DELETE_ADDRESS 0xFF000005 +#define OID_CO_GET_ADDRESSES 0xFF000006 +#define OID_CO_ADDRESS_CHANGE 0xFF000007 +#define OID_CO_SIGNALING_ENABLED 0xFF000008 +#define OID_CO_SIGNALING_DISABLED 0xFF000009 +// +// 802.3 Objects (Ethernet) +// +#define OID_802_3_PERMANENT_ADDRESS 0x01010101 +#define OID_802_3_CURRENT_ADDRESS 0x01010102 +#define OID_802_3_MULTICAST_LIST 0x01010103 +#define OID_802_3_MAXIMUM_LIST_SIZE 0x01010104 +#define OID_802_3_MAC_OPTIONS 0x01010105 +// +// +#define NDIS_802_3_MAC_OPTION_PRIORITY 0x00000001 +#define OID_802_3_RCV_ERROR_ALIGNMENT 0x01020101 +#define OID_802_3_XMIT_ONE_COLLISION 0x01020102 +#define OID_802_3_XMIT_MORE_COLLISIONS 0x01020103 +#define OID_802_3_XMIT_DEFERRED 0x01020201 +#define OID_802_3_XMIT_MAX_COLLISIONS 0x01020202 +#define OID_802_3_RCV_OVERRUN 0x01020203 +#define OID_802_3_XMIT_UNDERRUN 0x01020204 +#define OID_802_3_XMIT_HEARTBEAT_FAILURE 0x01020205 +#define OID_802_3_XMIT_TIMES_CRS_LOST 0x01020206 +#define OID_802_3_XMIT_LATE_COLLISIONS 0x01020207 +// +// 802.5 Objects (Token-Ring) +// +#define OID_802_5_PERMANENT_ADDRESS 0x02010101 +#define OID_802_5_CURRENT_ADDRESS 0x02010102 +#define OID_802_5_CURRENT_FUNCTIONAL 0x02010103 +#define OID_802_5_CURRENT_GROUP 0x02010104 +#define OID_802_5_LAST_OPEN_STATUS 0x02010105 +#define OID_802_5_CURRENT_RING_STATUS 0x02010106 +#define OID_802_5_CURRENT_RING_STATE 0x02010107 +#define OID_802_5_LINE_ERRORS 0x02020101 +#define OID_802_5_LOST_FRAMES 0x02020102 +#define OID_802_5_BURST_ERRORS 0x02020201 +#define OID_802_5_AC_ERRORS 0x02020202 +#define OID_802_5_ABORT_DELIMETERS 0x02020203 +#define OID_802_5_FRAME_COPIED_ERRORS 0x02020204 +#define OID_802_5_FREQUENCY_ERRORS 0x02020205 +#define OID_802_5_TOKEN_ERRORS 0x02020206 +#define OID_802_5_INTERNAL_ERRORS 0x02020207 +// +// FDDI Objects +// +#define OID_FDDI_LONG_PERMANENT_ADDR 0x03010101 +#define OID_FDDI_LONG_CURRENT_ADDR 0x03010102 +#define OID_FDDI_LONG_MULTICAST_LIST 0x03010103 +#define OID_FDDI_LONG_MAX_LIST_SIZE 0x03010104 +#define OID_FDDI_SHORT_PERMANENT_ADDR 0x03010105 +#define OID_FDDI_SHORT_CURRENT_ADDR 0x03010106 +#define OID_FDDI_SHORT_MULTICAST_LIST 0x03010107 +#define OID_FDDI_SHORT_MAX_LIST_SIZE 0x03010108 +#define OID_FDDI_ATTACHMENT_TYPE 0x03020101 +#define OID_FDDI_UPSTREAM_NODE_LONG 0x03020102 +#define OID_FDDI_DOWNSTREAM_NODE_LONG 0x03020103 +#define OID_FDDI_FRAME_ERRORS 0x03020104 +#define OID_FDDI_FRAMES_LOST 0x03020105 +#define OID_FDDI_RING_MGT_STATE 0x03020106 +#define OID_FDDI_LCT_FAILURES 0x03020107 +#define OID_FDDI_LEM_REJECTS 0x03020108 +#define OID_FDDI_LCONNECTION_STATE 0x03020109 +#define OID_FDDI_SMT_STATION_ID 0x03030201 +#define OID_FDDI_SMT_OP_VERSION_ID 0x03030202 +#define OID_FDDI_SMT_HI_VERSION_ID 0x03030203 +#define OID_FDDI_SMT_LO_VERSION_ID 0x03030204 +#define OID_FDDI_SMT_MANUFACTURER_DATA 0x03030205 +#define OID_FDDI_SMT_USER_DATA 0x03030206 +#define OID_FDDI_SMT_MIB_VERSION_ID 0x03030207 +#define OID_FDDI_SMT_MAC_CT 0x03030208 +#define OID_FDDI_SMT_NON_MASTER_CT 0x03030209 +#define OID_FDDI_SMT_MASTER_CT 0x0303020A +#define OID_FDDI_SMT_AVAILABLE_PATHS 0x0303020B +#define OID_FDDI_SMT_CONFIG_CAPABILITIES 0x0303020C +#define OID_FDDI_SMT_CONFIG_POLICY 0x0303020D +#define OID_FDDI_SMT_CONNECTION_POLICY 0x0303020E +#define OID_FDDI_SMT_T_NOTIFY 0x0303020F +#define OID_FDDI_SMT_STAT_RPT_POLICY 0x03030210 +#define OID_FDDI_SMT_TRACE_MAX_EXPIRATION 0x03030211 +#define OID_FDDI_SMT_PORT_INDEXES 0x03030212 +#define OID_FDDI_SMT_MAC_INDEXES 0x03030213 +#define OID_FDDI_SMT_BYPASS_PRESENT 0x03030214 +#define OID_FDDI_SMT_ECM_STATE 0x03030215 +#define OID_FDDI_SMT_CF_STATE 0x03030216 +#define OID_FDDI_SMT_HOLD_STATE 0x03030217 +#define OID_FDDI_SMT_REMOTE_DISCONNECT_FLAG 0x03030218 +#define OID_FDDI_SMT_STATION_STATUS 0x03030219 +#define OID_FDDI_SMT_PEER_WRAP_FLAG 0x0303021A +#define OID_FDDI_SMT_MSG_TIME_STAMP 0x0303021B +#define OID_FDDI_SMT_TRANSITION_TIME_STAMP 0x0303021C +#define OID_FDDI_SMT_SET_COUNT 0x0303021D +#define OID_FDDI_SMT_LAST_SET_STATION_ID 0x0303021E +#define OID_FDDI_MAC_FRAME_STATUS_FUNCTIONS 0x0303021F +#define OID_FDDI_MAC_BRIDGE_FUNCTIONS 0x03030220 +#define OID_FDDI_MAC_T_MAX_CAPABILITY 0x03030221 +#define OID_FDDI_MAC_TVX_CAPABILITY 0x03030222 +#define OID_FDDI_MAC_AVAILABLE_PATHS 0x03030223 +#define OID_FDDI_MAC_CURRENT_PATH 0x03030224 +#define OID_FDDI_MAC_UPSTREAM_NBR 0x03030225 +#define OID_FDDI_MAC_DOWNSTREAM_NBR 0x03030226 +#define OID_FDDI_MAC_OLD_UPSTREAM_NBR 0x03030227 +#define OID_FDDI_MAC_OLD_DOWNSTREAM_NBR 0x03030228 +#define OID_FDDI_MAC_DUP_ADDRESS_TEST 0x03030229 +#define OID_FDDI_MAC_REQUESTED_PATHS 0x0303022A +#define OID_FDDI_MAC_DOWNSTREAM_PORT_TYPE 0x0303022B +#define OID_FDDI_MAC_INDEX 0x0303022C +#define OID_FDDI_MAC_SMT_ADDRESS 0x0303022D +#define OID_FDDI_MAC_LONG_GRP_ADDRESS 0x0303022E +#define OID_FDDI_MAC_SHORT_GRP_ADDRESS 0x0303022F +#define OID_FDDI_MAC_T_REQ 0x03030230 +#define OID_FDDI_MAC_T_NEG 0x03030231 +#define OID_FDDI_MAC_T_MAX 0x03030232 +#define OID_FDDI_MAC_TVX_VALUE 0x03030233 +#define OID_FDDI_MAC_T_PRI0 0x03030234 +#define OID_FDDI_MAC_T_PRI1 0x03030235 +#define OID_FDDI_MAC_T_PRI2 0x03030236 +#define OID_FDDI_MAC_T_PRI3 0x03030237 +#define OID_FDDI_MAC_T_PRI4 0x03030238 +#define OID_FDDI_MAC_T_PRI5 0x03030239 +#define OID_FDDI_MAC_T_PRI6 0x0303023A +#define OID_FDDI_MAC_FRAME_CT 0x0303023B +#define OID_FDDI_MAC_COPIED_CT 0x0303023C +#define OID_FDDI_MAC_TRANSMIT_CT 0x0303023D +#define OID_FDDI_MAC_TOKEN_CT 0x0303023E +#define OID_FDDI_MAC_ERROR_CT 0x0303023F +#define OID_FDDI_MAC_LOST_CT 0x03030240 +#define OID_FDDI_MAC_TVX_EXPIRED_CT 0x03030241 +#define OID_FDDI_MAC_NOT_COPIED_CT 0x03030242 +#define OID_FDDI_MAC_LATE_CT 0x03030243 +#define OID_FDDI_MAC_RING_OP_CT 0x03030244 +#define OID_FDDI_MAC_FRAME_ERROR_THRESHOLD 0x03030245 +#define OID_FDDI_MAC_FRAME_ERROR_RATIO 0x03030246 +#define OID_FDDI_MAC_NOT_COPIED_THRESHOLD 0x03030247 +#define OID_FDDI_MAC_NOT_COPIED_RATIO 0x03030248 +#define OID_FDDI_MAC_RMT_STATE 0x03030249 +#define OID_FDDI_MAC_DA_FLAG 0x0303024A +#define OID_FDDI_MAC_UNDA_FLAG 0x0303024B +#define OID_FDDI_MAC_FRAME_ERROR_FLAG 0x0303024C +#define OID_FDDI_MAC_NOT_COPIED_FLAG 0x0303024D +#define OID_FDDI_MAC_MA_UNITDATA_AVAILABLE 0x0303024E +#define OID_FDDI_MAC_HARDWARE_PRESENT 0x0303024F +#define OID_FDDI_MAC_MA_UNITDATA_ENABLE 0x03030250 +#define OID_FDDI_PATH_INDEX 0x03030251 +#define OID_FDDI_PATH_RING_LATENCY 0x03030252 +#define OID_FDDI_PATH_TRACE_STATUS 0x03030253 +#define OID_FDDI_PATH_SBA_PAYLOAD 0x03030254 +#define OID_FDDI_PATH_SBA_OVERHEAD 0x03030255 +#define OID_FDDI_PATH_CONFIGURATION 0x03030256 +#define OID_FDDI_PATH_T_R_MODE 0x03030257 +#define OID_FDDI_PATH_SBA_AVAILABLE 0x03030258 +#define OID_FDDI_PATH_TVX_LOWER_BOUND 0x03030259 +#define OID_FDDI_PATH_T_MAX_LOWER_BOUND 0x0303025A +#define OID_FDDI_PATH_MAX_T_REQ 0x0303025B +#define OID_FDDI_PORT_MY_TYPE 0x0303025C +#define OID_FDDI_PORT_NEIGHBOR_TYPE 0x0303025D +#define OID_FDDI_PORT_CONNECTION_POLICIES 0x0303025E +#define OID_FDDI_PORT_MAC_INDICATED 0x0303025F +#define OID_FDDI_PORT_CURRENT_PATH 0x03030260 +#define OID_FDDI_PORT_REQUESTED_PATHS 0x03030261 +#define OID_FDDI_PORT_MAC_PLACEMENT 0x03030262 +#define OID_FDDI_PORT_AVAILABLE_PATHS 0x03030263 +#define OID_FDDI_PORT_MAC_LOOP_TIME 0x03030264 +#define OID_FDDI_PORT_PMD_CLASS 0x03030265 +#define OID_FDDI_PORT_CONNECTION_CAPABILITIES 0x03030266 +#define OID_FDDI_PORT_INDEX 0x03030267 +#define OID_FDDI_PORT_MAINT_LS 0x03030268 +#define OID_FDDI_PORT_BS_FLAG 0x03030269 +#define OID_FDDI_PORT_PC_LS 0x0303026A +#define OID_FDDI_PORT_EB_ERROR_CT 0x0303026B +#define OID_FDDI_PORT_LCT_FAIL_CT 0x0303026C +#define OID_FDDI_PORT_LER_ESTIMATE 0x0303026D +#define OID_FDDI_PORT_LEM_REJECT_CT 0x0303026E +#define OID_FDDI_PORT_LEM_CT 0x0303026F +#define OID_FDDI_PORT_LER_CUTOFF 0x03030270 +#define OID_FDDI_PORT_LER_ALARM 0x03030271 +#define OID_FDDI_PORT_CONNNECT_STATE 0x03030272 +#define OID_FDDI_PORT_PCM_STATE 0x03030273 +#define OID_FDDI_PORT_PC_WITHHOLD 0x03030274 +#define OID_FDDI_PORT_LER_FLAG 0x03030275 +#define OID_FDDI_PORT_HARDWARE_PRESENT 0x03030276 +#define OID_FDDI_SMT_STATION_ACTION 0x03030277 +#define OID_FDDI_PORT_ACTION 0x03030278 +#define OID_FDDI_IF_DESCR 0x03030279 +#define OID_FDDI_IF_TYPE 0x0303027A +#define OID_FDDI_IF_MTU 0x0303027B +#define OID_FDDI_IF_SPEED 0x0303027C +#define OID_FDDI_IF_PHYS_ADDRESS 0x0303027D +#define OID_FDDI_IF_ADMIN_STATUS 0x0303027E +#define OID_FDDI_IF_OPER_STATUS 0x0303027F +#define OID_FDDI_IF_LAST_CHANGE 0x03030280 +#define OID_FDDI_IF_IN_OCTETS 0x03030281 +#define OID_FDDI_IF_IN_UCAST_PKTS 0x03030282 +#define OID_FDDI_IF_IN_NUCAST_PKTS 0x03030283 +#define OID_FDDI_IF_IN_DISCARDS 0x03030284 +#define OID_FDDI_IF_IN_ERRORS 0x03030285 +#define OID_FDDI_IF_IN_UNKNOWN_PROTOS 0x03030286 +#define OID_FDDI_IF_OUT_OCTETS 0x03030287 +#define OID_FDDI_IF_OUT_UCAST_PKTS 0x03030288 +#define OID_FDDI_IF_OUT_NUCAST_PKTS 0x03030289 +#define OID_FDDI_IF_OUT_DISCARDS 0x0303028A +#define OID_FDDI_IF_OUT_ERRORS 0x0303028B +#define OID_FDDI_IF_OUT_QLEN 0x0303028C +#define OID_FDDI_IF_SPECIFIC 0x0303028D +// +// WAN objects +// +#define OID_WAN_PERMANENT_ADDRESS 0x04010101 +#define OID_WAN_CURRENT_ADDRESS 0x04010102 +#define OID_WAN_QUALITY_OF_SERVICE 0x04010103 +#define OID_WAN_PROTOCOL_TYPE 0x04010104 +#define OID_WAN_MEDIUM_SUBTYPE 0x04010105 +#define OID_WAN_HEADER_FORMAT 0x04010106 +#define OID_WAN_GET_INFO 0x04010107 +#define OID_WAN_SET_LINK_INFO 0x04010108 +#define OID_WAN_GET_LINK_INFO 0x04010109 +#define OID_WAN_LINE_COUNT 0x0401010A +#define OID_WAN_GET_BRIDGE_INFO 0x0401020A +#define OID_WAN_SET_BRIDGE_INFO 0x0401020B +#define OID_WAN_GET_COMP_INFO 0x0401020C +#define OID_WAN_SET_COMP_INFO 0x0401020D +#define OID_WAN_GET_STATS_INFO 0x0401020E +// +// LocalTalk objects +// +#define OID_LTALK_CURRENT_NODE_ID 0x05010102 +#define OID_LTALK_IN_BROADCASTS 0x05020101 +#define OID_LTALK_IN_LENGTH_ERRORS 0x05020102 +#define OID_LTALK_OUT_NO_HANDLERS 0x05020201 +#define OID_LTALK_COLLISIONS 0x05020202 +#define OID_LTALK_DEFERS 0x05020203 +#define OID_LTALK_NO_DATA_ERRORS 0x05020204 +#define OID_LTALK_RANDOM_CTS_ERRORS 0x05020205 +#define OID_LTALK_FCS_ERRORS 0x05020206 +// +// Arcnet objects +// +#define OID_ARCNET_PERMANENT_ADDRESS 0x06010101 +#define OID_ARCNET_CURRENT_ADDRESS 0x06010102 +#define OID_ARCNET_RECONFIGURATIONS 0x06020201 +// +// TAPI objects +// +#define OID_TAPI_ACCEPT 0x07030101 +#define OID_TAPI_ANSWER 0x07030102 +#define OID_TAPI_CLOSE 0x07030103 +#define OID_TAPI_CLOSE_CALL 0x07030104 +#define OID_TAPI_CONDITIONAL_MEDIA_DETECTION 0x07030105 +#define OID_TAPI_CONFIG_DIALOG 0x07030106 +#define OID_TAPI_DEV_SPECIFIC 0x07030107 +#define OID_TAPI_DIAL 0x07030108 +#define OID_TAPI_DROP 0x07030109 +#define OID_TAPI_GET_ADDRESS_CAPS 0x0703010A +#define OID_TAPI_GET_ADDRESS_ID 0x0703010B +#define OID_TAPI_GET_ADDRESS_STATUS 0x0703010C +#define OID_TAPI_GET_CALL_ADDRESS_ID 0x0703010D +#define OID_TAPI_GET_CALL_INFO 0x0703010E +#define OID_TAPI_GET_CALL_STATUS 0x0703010F +#define OID_TAPI_GET_DEV_CAPS 0x07030110 +#define OID_TAPI_GET_DEV_CONFIG 0x07030111 +#define OID_TAPI_GET_EXTENSION_ID 0x07030112 +#define OID_TAPI_GET_ID 0x07030113 +#define OID_TAPI_GET_LINE_DEV_STATUS 0x07030114 +#define OID_TAPI_MAKE_CALL 0x07030115 +#define OID_TAPI_NEGOTIATE_EXT_VERSION 0x07030116 +#define OID_TAPI_OPEN 0x07030117 +#define OID_TAPI_PROVIDER_INITIALIZE 0x07030118 +#define OID_TAPI_PROVIDER_SHUTDOWN 0x07030119 +#define OID_TAPI_SECURE_CALL 0x0703011A +#define OID_TAPI_SELECT_EXT_VERSION 0x0703011B +#define OID_TAPI_SEND_USER_USER_INFO 0x0703011C +#define OID_TAPI_SET_APP_SPECIFIC 0x0703011D +#define OID_TAPI_SET_CALL_PARAMS 0x0703011E +#define OID_TAPI_SET_DEFAULT_MEDIA_DETECTION 0x0703011F +#define OID_TAPI_SET_DEV_CONFIG 0x07030120 +#define OID_TAPI_SET_MEDIA_MODE 0x07030121 +#define OID_TAPI_SET_STATUS_MESSAGES 0x07030122 +// +// ATM Connection Oriented Ndis +// +#define OID_ATM_SUPPORTED_VC_RATES 0x08010101 +#define OID_ATM_SUPPORTED_SERVICE_CATEGORY 0x08010102 +#define OID_ATM_SUPPORTED_AAL_TYPES 0x08010103 +#define OID_ATM_HW_CURRENT_ADDRESS 0x08010104 +#define OID_ATM_MAX_ACTIVE_VCS 0x08010105 +#define OID_ATM_MAX_ACTIVE_VCI_BITS 0x08010106 +#define OID_ATM_MAX_ACTIVE_VPI_BITS 0x08010107 +#define OID_ATM_MAX_AAL0_PACKET_SIZE 0x08010108 +#define OID_ATM_MAX_AAL1_PACKET_SIZE 0x08010109 +#define OID_ATM_MAX_AAL34_PACKET_SIZE 0x0801010A +#define OID_ATM_MAX_AAL5_PACKET_SIZE 0x0801010B +#define OID_ATM_SIGNALING_VPIVCI 0x08010201 +#define OID_ATM_ASSIGNED_VPI 0x08010202 +#define OID_ATM_ACQUIRE_ACCESS_NET_RESOURCES 0x08010203 +#define OID_ATM_RELEASE_ACCESS_NET_RESOURCES 0x08010204 +#define OID_ATM_ILMI_VPIVCI 0x08010205 +#define OID_ATM_DIGITAL_BROADCAST_VPIVCI 0x08010206 +#define OID_ATM_GET_NEAREST_FLOW 0x08010207 +#define OID_ATM_ALIGNMENT_REQUIRED 0x08010208 +// +// ATM specific statistics OIDs. +// +#define OID_ATM_RCV_CELLS_OK 0x08020101 +#define OID_ATM_XMIT_CELLS_OK 0x08020102 +#define OID_ATM_RCV_CELLS_DROPPED 0x08020103 +#define OID_ATM_RCV_INVALID_VPI_VCI 0x08020201 +#define OID_ATM_CELLS_HEC_ERROR 0x08020202 +#define OID_ATM_RCV_REASSEMBLY_ERROR 0x08020203 +// +// PCCA (Wireless) object +// +// +// All WirelessWAN devices must support the following OIDs +// +#define OID_WW_GEN_NETWORK_TYPES_SUPPORTED 0x09010101 +#define OID_WW_GEN_NETWORK_TYPE_IN_USE 0x09010102 +#define OID_WW_GEN_HEADER_FORMATS_SUPPORTED 0x09010103 +#define OID_WW_GEN_HEADER_FORMAT_IN_USE 0x09010104 +#define OID_WW_GEN_INDICATION_REQUEST 0x09010105 +#define OID_WW_GEN_DEVICE_INFO 0x09010106 +#define OID_WW_GEN_OPERATION_MODE 0x09010107 +#define OID_WW_GEN_LOCK_STATUS 0x09010108 +#define OID_WW_GEN_DISABLE_TRANSMITTER 0x09010109 +#define OID_WW_GEN_NETWORK_ID 0x0901010A +#define OID_WW_GEN_PERMANENT_ADDRESS 0x0901010B +#define OID_WW_GEN_CURRENT_ADDRESS 0x0901010C +#define OID_WW_GEN_SUSPEND_DRIVER 0x0901010D +#define OID_WW_GEN_BASESTATION_ID 0x0901010E +#define OID_WW_GEN_CHANNEL_ID 0x0901010F +#define OID_WW_GEN_ENCRYPTION_SUPPORTED 0x09010110 +#define OID_WW_GEN_ENCRYPTION_IN_USE 0x09010111 +#define OID_WW_GEN_ENCRYPTION_STATE 0x09010112 +#define OID_WW_GEN_CHANNEL_QUALITY 0x09010113 +#define OID_WW_GEN_REGISTRATION_STATUS 0x09010114 +#define OID_WW_GEN_RADIO_LINK_SPEED 0x09010115 +#define OID_WW_GEN_LATENCY 0x09010116 +#define OID_WW_GEN_BATTERY_LEVEL 0x09010117 +#define OID_WW_GEN_EXTERNAL_POWER 0x09010118 +// +// Network Dependent OIDs - Mobitex: +// +#define OID_WW_MBX_SUBADDR 0x09050101 +// OID 0x09050102 is reserved and may not be used +#define OID_WW_MBX_FLEXLIST 0x09050103 +#define OID_WW_MBX_GROUPLIST 0x09050104 +#define OID_WW_MBX_TRAFFIC_AREA 0x09050105 +#define OID_WW_MBX_LIVE_DIE 0x09050106 +#define OID_WW_MBX_TEMP_DEFAULTLIST 0x09050107 +// +// Network Dependent OIDs - Pinpoint: +// +#define OID_WW_PIN_LOC_AUTHORIZE 0x09090101 +#define OID_WW_PIN_LAST_LOCATION 0x09090102 +#define OID_WW_PIN_LOC_FIX 0x09090103 +// +// Network Dependent - CDPD: +// +#define OID_WW_CDPD_SPNI 0x090D0101 +#define OID_WW_CDPD_WASI 0x090D0102 +#define OID_WW_CDPD_AREA_COLOR 0x090D0103 +#define OID_WW_CDPD_TX_POWER_LEVEL 0x090D0104 +#define OID_WW_CDPD_EID 0x090D0105 +#define OID_WW_CDPD_HEADER_COMPRESSION 0x090D0106 +#define OID_WW_CDPD_DATA_COMPRESSION 0x090D0107 +#define OID_WW_CDPD_CHANNEL_SELECT 0x090D0108 +#define OID_WW_CDPD_CHANNEL_STATE 0x090D0109 +#define OID_WW_CDPD_NEI 0x090D010A +#define OID_WW_CDPD_NEI_STATE 0x090D010B +#define OID_WW_CDPD_SERVICE_PROVIDER_IDENTIFIER 0x090D010C +#define OID_WW_CDPD_SLEEP_MODE 0x090D010D +#define OID_WW_CDPD_CIRCUIT_SWITCHED 0x090D010E +#define OID_WW_CDPD_TEI 0x090D010F +#define OID_WW_CDPD_RSSI 0x090D0110 +// +// Network Dependent - Ardis: +// +#define OID_WW_ARD_SNDCP 0x09110101 +#define OID_WW_ARD_TMLY_MSG 0x09110102 +#define OID_WW_ARD_DATAGRAM 0x09110103 +// +// Network Dependent - DataTac: +// +#define OID_WW_TAC_COMPRESSION 0x09150101 +#define OID_WW_TAC_SET_CONFIG 0x09150102 +#define OID_WW_TAC_GET_STATUS 0x09150103 +#define OID_WW_TAC_USER_HEADER 0x09150104 +// +// Network Dependent - Metricom: +// +#define OID_WW_MET_FUNCTION 0x09190101 +// +// IRDA objects +// +#define OID_IRDA_RECEIVING 0x0A010100 +#define OID_IRDA_TURNAROUND_TIME 0x0A010101 +#define OID_IRDA_SUPPORTED_SPEEDS 0x0A010102 +#define OID_IRDA_LINK_SPEED 0x0A010103 +#define OID_IRDA_MEDIA_BUSY 0x0A010104 +#define OID_IRDA_EXTRA_RCV_BOFS 0x0A010200 +#define OID_IRDA_RATE_SNIFF 0x0A010201 +#define OID_IRDA_UNICAST_LIST 0x0A010202 +#define OID_IRDA_MAX_UNICAST_LIST_SIZE 0x0A010203 +#define OID_IRDA_MAX_RECEIVE_WINDOW_SIZE 0x0A010204 +#define OID_IRDA_MAX_SEND_WINDOW_SIZE 0x0A010205 +// +// Medium the Ndis Driver is running on (OID_GEN_MEDIA_SUPPORTED/ +// OID_GEN_MEDIA_IN_USE). +// +typedef enum _NDIS_MEDIUM { + NdisMedium802_3, + NdisMedium802_5, + NdisMediumFddi, + NdisMediumWan, + NdisMediumLocalTalk, + NdisMediumDix, // defined for convenience, not a real medium + NdisMediumArcnetRaw, + NdisMediumArcnet878_2, + NdisMediumAtm, + NdisMediumWirelessWan, + NdisMediumIrda, + NdisMediumMax // Not a real medium, defined as an upper-bound +} NDIS_MEDIUM, *PNDIS_MEDIUM; + +// +// Hardware status codes (OID_GEN_HARDWARE_STATUS). +// +typedef enum _NDIS_HARDWARE_STATUS { + NdisHardwareStatusReady, + NdisHardwareStatusInitializing, + NdisHardwareStatusReset, + NdisHardwareStatusClosing, + NdisHardwareStatusNotReady +} NDIS_HARDWARE_STATUS, *PNDIS_HARDWARE_STATUS; + +// +// this is the type passed in the OID_GEN_GET_TIME_CAPS request +// +typedef struct _GEN_GET_TIME_CAPS { + ULONG Flags; // Bits defined below + + ULONG ClockPrecision; +} GEN_GET_TIME_CAPS, *PGEN_GET_TIME_CAPS; + +#define READABLE_LOCAL_CLOCK 0x000000001 +#define CLOCK_NETWORK_DERIVED 0x000000002 +#define CLOCK_PRECISION 0x000000004 +#define RECEIVE_TIME_INDICATION_CAPABLE 0x000000008 +#define TIMED_SEND_CAPABLE 0x000000010 +#define TIME_STAMP_CAPABLE 0x000000020 +// +// +// this is the type passed in the OID_GEN_GET_NETCARD_TIME request +// +typedef struct _GEN_GET_NETCARD_TIME { + ULONG ReadTime; +} GEN_GET_NETCARD_TIME, *PGEN_GET_NETCARD_TIME; + +// +// Defines the attachment types for FDDI (OID_FDDI_ATTACHMENT_TYPE). +// +typedef enum _NDIS_FDDI_ATTACHMENT_TYPE { + NdisFddiTypeIsolated = 1, + NdisFddiTypeLocalA, + NdisFddiTypeLocalB, + NdisFddiTypeLocalAB, + NdisFddiTypeLocalS, + NdisFddiTypeWrapA, + NdisFddiTypeWrapB, + NdisFddiTypeWrapAB, + NdisFddiTypeWrapS, + NdisFddiTypeCWrapA, + NdisFddiTypeCWrapB, + NdisFddiTypeCWrapS, + NdisFddiTypeThrough +} NDIS_FDDI_ATTACHMENT_TYPE, *PNDIS_FDDI_ATTACHMENT_TYPE; + +// +// Defines the ring management states for FDDI (OID_FDDI_RING_MGT_STATE). +// +typedef enum _NDIS_FDDI_RING_MGT_STATE { + NdisFddiRingIsolated = 1, + NdisFddiRingNonOperational, + NdisFddiRingOperational, + NdisFddiRingDetect, + NdisFddiRingNonOperationalDup, + NdisFddiRingOperationalDup, + NdisFddiRingDirected, + NdisFddiRingTrace +} NDIS_FDDI_RING_MGT_STATE, *PNDIS_FDDI_RING_MGT_STATE; + +// +// Defines the Lconnection state for FDDI (OID_FDDI_LCONNECTION_STATE). +// +typedef enum _NDIS_FDDI_LCONNECTION_STATE { + NdisFddiStateOff = 1, + NdisFddiStateBreak, + NdisFddiStateTrace, + NdisFddiStateConnect, + NdisFddiStateNext, + NdisFddiStateSignal, + NdisFddiStateJoin, + NdisFddiStateVerify, + NdisFddiStateActive, + NdisFddiStateMaintenance +} NDIS_FDDI_LCONNECTION_STATE, *PNDIS_FDDI_LCONNECTION_STATE; + +// +// Defines the medium subtypes for WAN medium (OID_WAN_MEDIUM_SUBTYPE). +// +typedef enum _NDIS_WAN_MEDIUM_SUBTYPE { + NdisWanMediumHub, + NdisWanMediumX_25, + NdisWanMediumIsdn, + NdisWanMediumSerial, + NdisWanMediumFrameRelay, + NdisWanMediumAtm, + NdisWanMediumSonet, + NdisWanMediumSW56K +} NDIS_WAN_MEDIUM_SUBTYPE, *PNDIS_WAN_MEDIUM_SUBTYPE; + +// +// Defines the header format for WAN medium (OID_WAN_HEADER_FORMAT). +// +typedef enum _NDIS_WAN_HEADER_FORMAT { + NdisWanHeaderNative, // src/dest based on subtype, followed by NLPID + NdisWanHeaderEthernet // emulation of ethernet header +} NDIS_WAN_HEADER_FORMAT, *PNDIS_WAN_HEADER_FORMAT; + +// +// Defines the line quality on a WAN line (OID_WAN_QUALITY_OF_SERVICE). +// +typedef enum _NDIS_WAN_QUALITY { + NdisWanRaw, + NdisWanErrorControl, + NdisWanReliable +} NDIS_WAN_QUALITY, *PNDIS_WAN_QUALITY; + +// +// Defines the state of a token-ring adapter (OID_802_5_CURRENT_RING_STATE). +// +typedef enum _NDIS_802_5_RING_STATE { + NdisRingStateOpened = 1, + NdisRingStateClosed, + NdisRingStateOpening, + NdisRingStateClosing, + NdisRingStateOpenFailure, + NdisRingStateRingFailure +} NDIS_802_5_RING_STATE, *PNDIS_802_5_RING_STATE; + +// +// Defines the state of the LAN media +// +typedef enum _NDIS_MEDIA_STATE { + NdisMediaStateConnected, + NdisMediaStateDisconnected +} NDIS_MEDIA_STATE, *PNDIS_MEDIA_STATE; + +// +// The following is set on a per-packet basis as OOB data with NdisClass802_3Priority +// +typedef ULONG Priority_802_3; // 0-7 priority levels +// +// The following structure is used to query OID_GEN_CO_LINK_SPEED and +// OID_GEN_CO_MINIMUM_LINK_SPEED. The first OID will return the current +// link speed of the adapter. The second will return the minimum link speed +// the adapter is capable of. +// + +typedef struct _NDIS_CO_LINK_SPEED { + ULONG Outbound; + ULONG Inbound; +} NDIS_CO_LINK_SPEED, + +*PNDIS_CO_LINK_SPEED; +// +// Ndis Packet Filter Bits (OID_GEN_CURRENT_PACKET_FILTER). +// +#define NDIS_PACKET_TYPE_DIRECTED 0x0001 +#define NDIS_PACKET_TYPE_MULTICAST 0x0002 +#define NDIS_PACKET_TYPE_ALL_MULTICAST 0x0004 +#define NDIS_PACKET_TYPE_BROADCAST 0x0008 +#define NDIS_PACKET_TYPE_SOURCE_ROUTING 0x0010 +#define NDIS_PACKET_TYPE_PROMISCUOUS 0x0020 +#define NDIS_PACKET_TYPE_SMT 0x0040 +#define NDIS_PACKET_TYPE_ALL_LOCAL 0x0080 +#define NDIS_PACKET_TYPE_MAC_FRAME 0x8000 +#define NDIS_PACKET_TYPE_FUNCTIONAL 0x4000 +#define NDIS_PACKET_TYPE_ALL_FUNCTIONAL 0x2000 +#define NDIS_PACKET_TYPE_GROUP 0x1000 +// +// Ndis Token-Ring Ring Status Codes (OID_802_5_CURRENT_RING_STATUS). +// +#define NDIS_RING_SIGNAL_LOSS 0x00008000 +#define NDIS_RING_HARD_ERROR 0x00004000 +#define NDIS_RING_SOFT_ERROR 0x00002000 +#define NDIS_RING_TRANSMIT_BEACON 0x00001000 +#define NDIS_RING_LOBE_WIRE_FAULT 0x00000800 +#define NDIS_RING_AUTO_REMOVAL_ERROR 0x00000400 +#define NDIS_RING_REMOVE_RECEIVED 0x00000200 +#define NDIS_RING_COUNTER_OVERFLOW 0x00000100 +#define NDIS_RING_SINGLE_STATION 0x00000080 +#define NDIS_RING_RING_RECOVERY 0x00000040 +// +// Ndis protocol option bits (OID_GEN_PROTOCOL_OPTIONS). +// +#define NDIS_PROT_OPTION_ESTIMATED_LENGTH 0x00000001 +#define NDIS_PROT_OPTION_NO_LOOPBACK 0x00000002 +#define NDIS_PROT_OPTION_NO_RSVD_ON_RCVPKT 0x00000004 +// +// Ndis MAC option bits (OID_GEN_MAC_OPTIONS). +// +#define NDIS_MAC_OPTION_COPY_LOOKAHEAD_DATA 0x00000001 +#define NDIS_MAC_OPTION_RECEIVE_SERIALIZED 0x00000002 +#define NDIS_MAC_OPTION_TRANSFERS_NOT_PEND 0x00000004 +#define NDIS_MAC_OPTION_NO_LOOPBACK 0x00000008 +#define NDIS_MAC_OPTION_FULL_DUPLEX 0x00000010 +#define NDIS_MAC_OPTION_EOTX_INDICATION 0x00000020 +#define NDIS_MAC_OPTION_RESERVED 0x80000000 +// +// NDIS MAC option bits for OID_GEN_CO_MAC_OPTIONS. +// +#define NDIS_CO_MAC_OPTION_DYNAMIC_LINK_SPEED 0x00000001 +#ifdef IRDA +// +// The following is set on a per-packet basis as OOB data with NdisClassIrdaPacketInfo +// This is the per-packet info specified on a per-packet basis +// +typedef struct _NDIS_IRDA_PACKET_INFO { + UINT ExtraBOFs; + UINT MinTurnAroundTime; +} NDIS_IRDA_PACKET_INFO, *PNDIS_IRDA_PACKET_INFO; + +#endif +#ifdef WIRELESS_WAN +// +// Wireless WAN structure definitions +// +// +// currently defined Wireless network subtypes +// +typedef enum _NDIS_WW_NETWORK_TYPE { + NdisWWGeneric, + NdisWWMobitex, + NdisWWPinpoint, + NdisWWCDPD, + NdisWWArdis, + NdisWWDataTAC, + NdisWWMetricom, + NdisWWGSM, + NdisWWCDMA, + NdisWWTDMA, + NdisWWAMPS, + NdisWWInmarsat, + NdisWWpACT +} NDIS_WW_NETWORK_TYPE; + +// +// currently defined header formats +// +typedef enum _NDIS_WW_HEADER_FORMAT { + NdisWWDIXEthernetFrames, + NdisWWMPAKFrames, + NdisWWRDLAPFrames, + NdisWWMDC4800Frames +} NDIS_WW_HEADER_FORMAT; + +// +// currently defined encryption types +// +typedef enum _NDIS_WW_ENCRYPTION_TYPE { + NdisWWUnknownEncryption = -1, + NdisWWNoEncryption, + NdisWWDefaultEncryption +} NDIS_WW_ENCRYPTION_TYPE, *PNDIS_WW_ENCRYPTION_TYPE; + +// +// OID_WW_GEN_INDICATION_REQUEST +// +typedef struct _NDIS_WW_INDICATION_REQUEST { + NDIS_OID Oid; // IN + + UINT uIndicationFlag; // IN + + UINT uApplicationToken; // IN OUT + + HANDLE hIndicationHandle; // IN OUT + + INT iPollingInterval; // IN OUT + + NDIS_VAR_DATA_DESC InitialValue; // IN OUT + + NDIS_VAR_DATA_DESC OIDIndicationValue; // OUT - only valid after indication + + NDIS_VAR_DATA_DESC TriggerValue; // IN + +} NDIS_WW_INDICATION_REQUEST, *PNDIS_WW_INDICATION_REQUEST; + +#define OID_INDICATION_REQUEST_ENABLE 0x0000 +#define OID_INDICATION_REQUEST_CANCEL 0x0001 +// +// OID_WW_GEN_DEVICE_INFO +// +typedef struct _WW_DEVICE_INFO { + NDIS_VAR_DATA_DESC Manufacturer; + NDIS_VAR_DATA_DESC ModelNum; + NDIS_VAR_DATA_DESC SWVersionNum; + NDIS_VAR_DATA_DESC SerialNum; +} WW_DEVICE_INFO, *PWW_DEVICE_INFO; + +// +// OID_WW_GEN_OPERATION_MODE +// +typedef INT WW_OPERATION_MODE; // 0 = Normal mode + // 1 = Power saving mode + // -1 = mode unknown +// +// OID_WW_GEN_LOCK_STATUS +// + +typedef INT WW_LOCK_STATUS; // 0 = unlocked + // 1 = locked + // -1 = unknown lock status +// +// OID_WW_GEN_DISABLE_TRANSMITTER +// + +typedef INT WW_DISABLE_TRANSMITTER; // 0 = transmitter enabled + // 1 = transmitter disabled + // -1 = unknown value +// +// OID_WW_GEN_NETWORK_ID +// + +typedef NDIS_VAR_DATA_DESC WW_NETWORK_ID; +// +// OID_WW_GEN_PERMANENT_ADDRESS +// +typedef NDIS_VAR_DATA_DESC WW_PERMANENT_ADDRESS; +// +// OID_WW_GEN_CURRENT_ADDRESS +// +typedef struct _WW_CURRENT_ADDRESS { + NDIS_WW_HEADER_FORMAT Format; + NDIS_VAR_DATA_DESC Address; +} WW_CURRENT_ADDRESS, *PWW_CURRENT_ADDRESS; + +// +// OID_WW_GEN_SUSPEND_DRIVER +// +typedef BOOLEAN WW_SUSPEND_DRIVER; // 0 = driver operational + // 1 = driver suspended +// +// OID_WW_GEN_BASESTATION_ID +// + +typedef NDIS_VAR_DATA_DESC WW_BASESTATION_ID; +// +// OID_WW_GEN_CHANNEL_ID +// +typedef NDIS_VAR_DATA_DESC WW_CHANNEL_ID; +// +// OID_WW_GEN_ENCRYPTION_STATE +// +typedef BOOLEAN WW_ENCRYPTION_STATE; // 0 = if encryption is disabled + // 1 = if encryption is enabled +// +// OID_WW_GEN_CHANNEL_QUALITY +// + +typedef INT WW_CHANNEL_QUALITY; // 0 = Not in network contact, + // 1-100 = Quality of Channel (100 is highest quality). + // -1 = channel quality is unknown +// +// OID_WW_GEN_REGISTRATION_STATUS +// + +typedef INT WW_REGISTRATION_STATUS; // 0 = Registration denied + // 1 = Registration pending + // 2 = Registered + // -1 = unknown registration status +// +// OID_WW_GEN_RADIO_LINK_SPEED +// + +typedef UINT WW_RADIO_LINK_SPEED; // Bits per second. +// +// OID_WW_GEN_LATENCY +// + +typedef UINT WW_LATENCY; // milliseconds +// +// OID_WW_GEN_BATTERY_LEVEL +// + +typedef INT WW_BATTERY_LEVEL; // 0-100 = battery level in percentage + // (100=fully charged) + // -1 = unknown battery level. +// +// OID_WW_GEN_EXTERNAL_POWER +// + +typedef INT WW_EXTERNAL_POWER; // 0 = no external power connected + // 1 = external power connected + // -1 = unknown +// +// OID_WW_MET_FUNCTION +// + +typedef NDIS_VAR_DATA_DESC WW_MET_FUNCTION; +// +// OID_WW_TAC_COMPRESSION +// +typedef BOOLEAN WW_TAC_COMPRESSION; // Determines whether or not network level compression + // is being used. +// +// OID_WW_TAC_SET_CONFIG +// + +typedef struct _WW_TAC_SETCONFIG { + NDIS_VAR_DATA_DESC RCV_MODE; + NDIS_VAR_DATA_DESC TX_CONTROL; + NDIS_VAR_DATA_DESC RX_CONTROL; + NDIS_VAR_DATA_DESC FLOW_CONTROL; + NDIS_VAR_DATA_DESC RESET_CNF; + NDIS_VAR_DATA_DESC READ_CNF; +} WW_TAC_SETCONFIG, *PWW_TAC_SETCONFIG; + +// +// OID_WW_TAC_GET_STATUS +// +typedef struct _WW_TAC_GETSTATUS { + BOOLEAN Action; // Set = Execute command. + + NDIS_VAR_DATA_DESC Command; + NDIS_VAR_DATA_DESC Option; + NDIS_VAR_DATA_DESC Response; // The response to the requested command + // - max. length of string is 256 octets. + +} WW_TAC_GETSTATUS, *PWW_TAC_GETSTATUS; + +// +// OID_WW_TAC_USER_HEADER +// +typedef NDIS_VAR_DATA_DESC WW_TAC_USERHEADER; // This will hold the user header - Max. 64 octets. +// +// OID_WW_ARD_SNDCP +// + +typedef struct _WW_ARD_SNDCP { + NDIS_VAR_DATA_DESC Version; // The version of SNDCP protocol supported. + + INT BlockSize; // The block size used for SNDCP + + INT Window; // The window size used in SNDCP + +} WW_ARD_SNDCP, *PWW_ARD_SNDCP; + +// +// OID_WW_ARD_TMLY_MSG +// +typedef BOOLEAN WW_ARD_CHANNEL_STATUS; // The current status of the inbound RF Channel. +// +// OID_WW_ARD_DATAGRAM +// + +typedef struct _WW_ARD_DATAGRAM { + BOOLEAN LoadLevel; // Byte that contains the load level info. + + INT SessionTime; // Datagram session time remaining. + + NDIS_VAR_DATA_DESC HostAddr; // Host address. + + NDIS_VAR_DATA_DESC THostAddr; // Test host address. + +} WW_ARD_DATAGRAM, *PWW_ARD_DATAGRAM; + +// +// OID_WW_CDPD_SPNI +// +typedef struct _WW_CDPD_SPNI { + UINT SPNI[10]; //10 16-bit service provider network IDs + + INT OperatingMode; // 0 = ignore SPNI, + // 1 = require SPNI from list, + // 2 = prefer SPNI from list. + // 3 = exclude SPNI from list. + +} WW_CDPD_SPNI, *PWW_CDPD_SPNI; + +// +// OID_WW_CDPD_WASI +// +typedef struct _WW_CDPD_WIDE_AREA_SERVICE_ID { + UINT WASI[10]; //10 16-bit wide area service IDs + + INT OperatingMode; // 0 = ignore WASI, + // 1 = Require WASI from list, + // 2 = prefer WASI from list + // 3 = exclude WASI from list. + +} WW_CDPD_WIDE_AREA_SERVICE_ID, *PWW_CDPD_WIDE_AREA_SERVICE_ID; + +// +// OID_WW_CDPD_AREA_COLOR +// +typedef INT WW_CDPD_AREA_COLOR; +// +// OID_WW_CDPD_TX_POWER_LEVEL +// +typedef UINT WW_CDPD_TX_POWER_LEVEL; +// +// OID_WW_CDPD_EID +// +typedef NDIS_VAR_DATA_DESC WW_CDPD_EID; +// +// OID_WW_CDPD_HEADER_COMPRESSION +// +typedef INT WW_CDPD_HEADER_COMPRESSION; // 0 = no header compression, + // 1 = always compress headers, + // 2 = compress headers if MD-IS does + // -1 = unknown +// +// OID_WW_CDPD_DATA_COMPRESSION +// + +typedef INT WW_CDPD_DATA_COMPRESSION; // 0 = no data compression, + // 1 = data compression enabled + // -1 = unknown +// +// OID_WW_CDPD_CHANNEL_SELECT +// + +typedef struct _WW_CDPD_CHANNEL_SELECT { + UINT ChannelID; // channel number + + UINT fixedDuration; // duration in seconds + +} WW_CDPD_CHANNEL_SELECT, *PWW_CDPD_CHANNEL_SELECT; + +// +// OID_WW_CDPD_CHANNEL_STATE +// +typedef enum _WW_CDPD_CHANNEL_STATE { + CDPDChannelNotAvail, + CDPDChannelScanning, + CDPDChannelInitAcquired, + CDPDChannelAcquired, + CDPDChannelSleeping, + CDPDChannelWaking, + CDPDChannelCSDialing, + CDPDChannelCSRedial, + CDPDChannelCSAnswering, + CDPDChannelCSConnected, + CDPDChannelCSSuspended +} WW_CDPD_CHANNEL_STATE, *PWW_CDPD_CHANNEL_STATE; + +// +// OID_WW_CDPD_NEI +// +typedef enum _WW_CDPD_NEI_FORMAT { + CDPDNeiIPv4, + CDPDNeiCLNP, + CDPDNeiIPv6 +} WW_CDPD_NEI_FORMAT, *PWW_CDPD_NEI_FORMAT; +typedef enum _WW_CDPD_NEI_TYPE { + CDPDNeiIndividual, + CDPDNeiMulticast, + CDPDNeiBroadcast +} WW_CDPD_NEI_TYPE; +typedef struct _WW_CDPD_NEI { + UINT uNeiIndex; + WW_CDPD_NEI_FORMAT NeiFormat; + WW_CDPD_NEI_TYPE NeiType; + WORD NeiGmid; // group member identifier, only + // meaningful if NeiType == + // CDPDNeiMulticast + + NDIS_VAR_DATA_DESC NeiAddress; +} WW_CDPD_NEI; + +// +// OID_WW_CDPD_NEI_STATE +// +typedef enum _WW_CDPD_NEI_STATE { + CDPDUnknown, + CDPDRegistered, + CDPDDeregistered +} WW_CDPD_NEI_STATE, *PWW_CDPD_NEI_STATE; +typedef enum _WW_CDPD_NEI_SUB_STATE { + CDPDPending, // Registration pending + CDPDNoReason, // Registration denied - no reason given + CDPDMDISNotCapable, // Registration denied - MD-IS not capable of + // handling M-ES at this time + CDPDNEINotAuthorized, // Registration denied - NEI is not authorized to + // use this subnetwork + CDPDInsufficientAuth, // Registration denied - M-ES gave insufficient + // authentication credentials + CDPDUnsupportedAuth, // Registration denied - M-ES gave unsupported + // authentication credentials + CDPDUsageExceeded, // Registration denied - NEI has exceeded usage + // limitations + CDPDDeniedThisNetwork // Registration denied on this network, service + // may be obtained on alternate Service Provider + // network +} WW_CDPD_NEI_SUB_STATE; +typedef struct _WW_CDPD_NEI_REG_STATE { + UINT uNeiIndex; + WW_CDPD_NEI_STATE NeiState; + WW_CDPD_NEI_SUB_STATE NeiSubState; +} WW_CDPD_NEI_REG_STATE, *PWW_CDPD_NEI_REG_STATE; + +// +// OID_WW_CDPD_SERVICE_PROVIDER_IDENTIFIER +// +typedef struct _WW_CDPD_SERVICE_PROVIDER_ID { + UINT SPI[10]; //10 16-bit service provider IDs + + INT OperatingMode; // 0 = ignore SPI, + // 1 = require SPI from list, + // 2 = prefer SPI from list. + // 3 = exclude SPI from list. + +} WW_CDPD_SERVICE_PROVIDER_ID, *PWW_CDPD_SERVICE_PROVIDER_ID; + +// +// OID_WW_CDPD_SLEEP_MODE +// +typedef INT WW_CDPD_SLEEP_MODE; +// +// OID_WW_CDPD_TEI +// +typedef ULONG WW_CDPD_TEI; +// +// OID_WW_CDPD_CIRCUIT_SWITCHED +// +typedef struct _WW_CDPD_CIRCUIT_SWITCHED { + INT service_preference; // -1 = unknown, + // 0 = always use packet switched CDPD, + // 1 = always use CS CDPD via AMPS, + // 2 = always use CS CDPD via PSTN, + // 3 = use circuit switched via AMPS only + // when packet switched is not available. + // 4 = use packet switched only when circuit + // switched via AMPS is not available. + // 5 = device manuf. defined service + // preference. + // 6 = device manuf. defined service + // preference. + + INT service_status; // -1 = unknown, + // 0 = packet switched CDPD, + // 1 = circuit switched CDPD via AMPS, + // 2 = circuit switched CDPD via PSTN. + + INT connect_rate; // CS connection bit rate (bits per second). + // 0 = no active connection, + // -1 = unknown + // Dial code last used to dial. + + NDIS_VAR_DATA_DESC dial_code[20]; + + UINT sid; // Current AMPS system ID + + INT a_b_side_selection; // -1 = unknown, + // 0 = no AMPS service + // 1 = AMPS "A" side channels selected + // 2 = AMPS "B" side channels selected + + INT AMPS_channel; // -1= unknown + // 0 = no AMPS service. + // 1-1023 = AMPS channel number in use + + UINT action; // 0 = no action + // 1 = suspend (hangup) + // 2 = dial + + // Default dial code for CS CDPD service + // encoded as specified in the CS CDPD + // implementor guidelines. + NDIS_VAR_DATA_DESC default_dial[20]; + + // Number for the CS CDPD network to call + // back the mobile, encoded as specified in + // the CS CDPD implementor guidelines. + NDIS_VAR_DATA_DESC call_back[20]; + + UINT sid_list[10]; // List of 10 16-bit preferred AMPS + // system IDs for CS CDPD. + + UINT inactivity_timer; // Wait time after last data before dropping + // call. + // 0-65535 = inactivity time limit (seconds). + + UINT receive_timer; // secs. per CS-CDPD Implementor Guidelines. + + UINT conn_resp_timer; // secs. per CS-CDPD Implementor Guidelines. + + UINT reconn_resp_timer; // secs. per CS-CDPD Implementor Guidelines. + + UINT disconn_timer; // secs. per CS-CDPD Implementor Guidelines. + + UINT NEI_reg_timer; // secs. per CS-CDPD Implementor Guidelines. + + UINT reconn_retry_timer; // secs. per CS-CDPD Implementor Guidelines. + + UINT link_reset_timer; // secs. per CS-CDPD Implementor Guidelines. + + UINT link_reset_ack_timer; // secs. per CS-CDPD Implementor Guidelines. + + UINT n401_retry_limit; // per CS-CDPD Implementor Guidelines. + + UINT n402_retry_limit; // per CS-CDPD Implementor Guidelines. + + UINT n404_retry_limit; // per CS-CDPD Implementor Guidelines. + + UINT n405_retry_limit; // per CS-CDPD Implementor Guidelines. + +} WW_CDPD_CIRCUIT_SWITCHED, *WW_PCDPD_CIRCUIT_SWITCHED; +typedef UINT WW_CDPD_RSSI; +// +// OID_WW_PIN_LOC_AUTHORIZE +// +typedef INT WW_PIN_AUTHORIZED; // 0 = unauthorized + // 1 = authorized + // -1 = unknown +// +// OID_WW_PIN_LAST_LOCATION +// OID_WW_PIN_LOC_FIX +// + +typedef struct _WW_PIN_LOCATION { + INT Latitude; // Latitude in hundredths of a second + + INT Longitude; // Longitude in hundredths of a second + + INT Altitude; // Altitude in feet + + INT FixTime; // Time of the location fix, since midnight, local time (of the + // current day), in tenths of a second + + INT NetTime; // Current local network time of the current day, since midnight, + // in tenths of a second + + INT LocQuality; // 0-100 = location quality + + INT LatReg; // Latitude registration offset, in hundredths of a second + + INT LongReg; // Longitude registration offset, in hundredths of a second + + INT GMTOffset; // Offset in minutes of the local time zone from GMT + +} WW_PIN_LOCATION, *PWW_PIN_LOCATION; + +// +// The following is set on a per-packet basis as OOB data with NdisClassWirelessWanMbxMailbox +// +typedef ULONG WW_MBX_MAILBOX_FLAG; // 1 = set mailbox flag, 0 = do not set mailbox flag +// +// OID_WW_MBX_SUBADDR +// + +typedef struct _WW_MBX_PMAN { + BOOLEAN ACTION; // 0 = Login PMAN, 1 = Logout PMAN + + UINT MAN; + UCHAR PASSWORD[8]; // Password should be null for Logout and indications. + // Maximum length of password is 8 chars. + +} WW_MBX_PMAN, *PWW_MBX_PMAN; + +// +// OID_WW_MBX_FLEXLIST +// +typedef struct _WW_MBX_FLEXLIST { + INT count; // Number of MAN entries used. + // -1=unknown. + + UINT MAN[7]; // List of MANs. + +} WW_MBX_FLEXLIST; + +// +// OID_WW_MBX_GROUPLIST +// +typedef struct _WW_MBX_GROUPLIST { + INT count; // Number of MAN entries used. + // -1=unknown. + + UINT MAN[15]; // List of MANs. + +} WW_MBX_GROUPLIST; + +// +// OID_WW_MBX_TRAFFIC_AREA +// +typedef enum _WW_MBX_TRAFFIC_AREA { + unknown_traffic_area, // The driver has no information about the current traffic area. + in_traffic_area, // Mobile unit has entered a subscribed traffic area. + in_auth_traffic_area, // Mobile unit is outside traffic area but is authorized. + unauth_traffic_area // Mobile unit is outside traffic area but is un-authorized. +} WW_MBX_TRAFFIC_AREA; + +// +// OID_WW_MBX_LIVE_DIE +// +typedef INT WW_MBX_LIVE_DIE; // 0 = DIE last received + // 1 = LIVE last received + // -1 = unknown +// +// OID_WW_MBX_TEMP_DEFAULTLIST +// + +typedef struct _WW_MBX_CHANNEL_PAIR { + UINT Mobile_Tx; + UINT Mobile_Rx; +} WW_MBX_CHANNEL_PAIR, *PWW_MBX_CHANNEL_PAIR; +typedef struct _WW_MBX_TEMPDEFAULTLIST { + UINT Length; + WW_MBX_CHANNEL_PAIR ChannelPair[1]; +} WW_MBX_TEMPDEFAULTLIST, *WW_PMBX_TEMPDEFAULTLIST; + +#endif // WIRELESS_WAN +#endif // _NTDDNDIS_ diff --git a/src/SeeDll/Ntddpack.h b/src/SeeDll/Ntddpack.h index 30945c1e..87eac60e 100644 --- a/src/SeeDll/Ntddpack.h +++ b/src/SeeDll/Ntddpack.h @@ -1,26 +1,26 @@ - -#ifndef __NTDDPACKET -#define __NTDDPACKET 1 -#include "devioctl.h" -/*#include */ -struct _PACKET_OID_DATA { - ULONG Oid; - ULONG Length; - UCHAR Data[1]; -}; - -typedef struct _PACKET_OID_DATA PACKET_OID_DATA, *PPACKET_OID_DATA; - -/*#include */ -#define FILE_DEVICE_PROTOCOL 0x8000 -#define IOCTL_PROTOCOL_QUERY_OID CTL_CODE(FILE_DEVICE_PROTOCOL, 0 , METHOD_BUFFERED, FILE_ANY_ACCESS) -#define IOCTL_PROTOCOL_SET_OID CTL_CODE(FILE_DEVICE_PROTOCOL, 1 , METHOD_BUFFERED, FILE_ANY_ACCESS) -#define IOCTL_PROTOCOL_STATISTICS CTL_CODE(FILE_DEVICE_PROTOCOL, 2 , METHOD_BUFFERED, FILE_ANY_ACCESS) -#define IOCTL_PROTOCOL_RESET CTL_CODE(FILE_DEVICE_PROTOCOL, 3 , METHOD_BUFFERED, FILE_ANY_ACCESS) -#define IOCTL_PROTOCOL_READ CTL_CODE(FILE_DEVICE_PROTOCOL, 4 , METHOD_BUFFERED, FILE_ANY_ACCESS) -#define IOCTL_PROTOCOL_WRITE CTL_CODE(FILE_DEVICE_PROTOCOL, 5 , METHOD_BUFFERED, FILE_ANY_ACCESS) -#define IOCTL_PROTOCOL_MACNAME CTL_CODE(FILE_DEVICE_PROTOCOL, 6 , METHOD_BUFFERED, FILE_ANY_ACCESS) -#define IOCTL_OPEN CTL_CODE(FILE_DEVICE_PROTOCOL, 7 , METHOD_BUFFERED, FILE_ANY_ACCESS) -#define IOCTL_CLOSE CTL_CODE(FILE_DEVICE_PROTOCOL, 8 , METHOD_BUFFERED, FILE_ANY_ACCESS) - -#endif + +#ifndef __NTDDPACKET +#define __NTDDPACKET 1 +#include "devioctl.h" +/*#include */ +struct _PACKET_OID_DATA { + ULONG Oid; + ULONG Length; + UCHAR Data[1]; +}; + +typedef struct _PACKET_OID_DATA PACKET_OID_DATA, *PPACKET_OID_DATA; + +/*#include */ +#define FILE_DEVICE_PROTOCOL 0x8000 +#define IOCTL_PROTOCOL_QUERY_OID CTL_CODE(FILE_DEVICE_PROTOCOL, 0 , METHOD_BUFFERED, FILE_ANY_ACCESS) +#define IOCTL_PROTOCOL_SET_OID CTL_CODE(FILE_DEVICE_PROTOCOL, 1 , METHOD_BUFFERED, FILE_ANY_ACCESS) +#define IOCTL_PROTOCOL_STATISTICS CTL_CODE(FILE_DEVICE_PROTOCOL, 2 , METHOD_BUFFERED, FILE_ANY_ACCESS) +#define IOCTL_PROTOCOL_RESET CTL_CODE(FILE_DEVICE_PROTOCOL, 3 , METHOD_BUFFERED, FILE_ANY_ACCESS) +#define IOCTL_PROTOCOL_READ CTL_CODE(FILE_DEVICE_PROTOCOL, 4 , METHOD_BUFFERED, FILE_ANY_ACCESS) +#define IOCTL_PROTOCOL_WRITE CTL_CODE(FILE_DEVICE_PROTOCOL, 5 , METHOD_BUFFERED, FILE_ANY_ACCESS) +#define IOCTL_PROTOCOL_MACNAME CTL_CODE(FILE_DEVICE_PROTOCOL, 6 , METHOD_BUFFERED, FILE_ANY_ACCESS) +#define IOCTL_OPEN CTL_CODE(FILE_DEVICE_PROTOCOL, 7 , METHOD_BUFFERED, FILE_ANY_ACCESS) +#define IOCTL_CLOSE CTL_CODE(FILE_DEVICE_PROTOCOL, 8 , METHOD_BUFFERED, FILE_ANY_ACCESS) + +#endif diff --git a/src/SeeDll/Packet32.c b/src/SeeDll/Packet32.c index f9eb46b0..2481ae96 100644 --- a/src/SeeDll/Packet32.c +++ b/src/SeeDll/Packet32.c @@ -1,2302 +1,2302 @@ -/* - * Copyright (c) 1999 - 2003 - * Politecnico di Torino. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that: (1) source code distributions - * retain the above copyright notice and this paragraph in its entirety, (2) - * distributions including binary code include the above copyright notice and - * this paragraph in its entirety in the documentation or other materials - * provided with the distribution, and (3) all advertising materials mentioning - * features or use of this software display the following acknowledgement: - * ``This product includes software developed by the Politecnico - * di Torino, and its contributors.'' Neither the name of - * the University nor the names of its contributors may be used to endorse - * or promote products derived from this software without specific prior - * written permission. - * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. - */ - -#include - -#define UNICODE 1 - -#include -#include - -#if 0 -#include "WanPacket/WanPacket.h" -#endif - -#define _WINNT4 - - -#include -#include -#include -#include - -#include - - -/// Current packet.dll Version. It can be retrieved directly or through the PacketGetVersion() function. -char PacketLibraryVersion[64]; -/// Current NPF.sys Version. It can be retrieved directly or through the PacketGetVersion() function. -char PacketDriverVersion[64]; - -LPCTSTR NPFServiceName = TEXT("SEE"); -LPCTSTR NPFServiceDesc = TEXT("SoftEther Ethernet Layer Driver"); -LPCTSTR NPFRegistryLocation = TEXT("SYSTEM\\CurrentControlSet\\Services\\SEE"); -LPCTSTR NPFDriverPath = TEXT("system32\\drivers\\see.sys"); - -extern PADAPTER_INFO AdaptersInfoList; -extern HANDLE AdaptersInfoMutex; -#ifndef _WINNT4 -typedef VOID (*GAAHandler)( - ULONG, - DWORD, - PVOID, - PIP_ADAPTER_ADDRESSES, - PULONG); -GAAHandler GetAdaptersAddressesPointer = NULL; -#endif // _WINNT4 - -#ifdef HAVE_DAG_API -/* We load dynamically the dag library in order link it only when it's present on the system */ -dagc_open_handler p_dagc_open = NULL; -dagc_close_handler p_dagc_close = NULL; -dagc_getlinktype_handler p_dagc_getlinktype = NULL; -dagc_getlinkspeed_handler p_dagc_getlinkspeed = NULL; -dagc_getfcslen_handler p_dagc_getfcslen = NULL; -dagc_receive_handler p_dagc_receive = NULL; -dagc_wait_handler p_dagc_wait = NULL; -dagc_stats_handler p_dagc_stats = NULL; -dagc_setsnaplen_handler p_dagc_setsnaplen = NULL; -dagc_finddevs_handler p_dagc_finddevs = NULL; -dagc_freedevs_handler p_dagc_freedevs = NULL; -#endif /* HAVE_DAG_API */ - -BOOLEAN PacketAddAdapterDag(PCHAR name, PCHAR description, BOOLEAN IsAFile); - -//--------------------------------------------------------------------------- - -/*! - \brief The main dll function. -*/ - -BOOL APIENTRY DllMain (HANDLE DllHandle,DWORD Reason,LPVOID lpReserved) -{ - BOOLEAN Status=TRUE; - HMODULE IPHMod; - PADAPTER_INFO NewAdInfo; -#ifdef HAVE_DAG_API - HMODULE DagcLib; -#endif // HAVE_DAG_API - - switch(Reason) - { - case DLL_PROCESS_ATTACH: - - ODS("************Packet32: DllMain************\n"); - -#ifdef _DEBUG_TO_FILE - // dump a bunch of registry keys useful for debug to file - PacketDumpRegistryKey("HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Control\\Class\\{4D36E972-E325-11CE-BFC1-08002BE10318}", - "adapters.reg"); - PacketDumpRegistryKey("HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Services\\Tcpip", - "tcpip.reg"); - PacketDumpRegistryKey("HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Services\\SEE", - "npf.reg"); - PacketDumpRegistryKey("HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Services", - "services.reg"); -#endif - - // Create the mutex that will protect the adapter information list - AdaptersInfoMutex = CreateMutex(NULL, FALSE, NULL); - - // - // Retrieve packet.dll version information from the file - // - PacketGetFileVersion(TEXT("see.dll"), PacketLibraryVersion, sizeof(PacketLibraryVersion)); - - // - // Retrieve NPF.sys version information from the file - // - PacketGetFileVersion(TEXT("drivers\\see.sys"), PacketDriverVersion, sizeof(PacketDriverVersion)); - - // - // Locate GetAdaptersAddresses dynamically since it is not present in Win2k - // - IPHMod = GetModuleHandle(TEXT("Iphlpapi")); - -#ifndef _WINNT4 - GetAdaptersAddressesPointer = (GAAHandler) GetProcAddress(IPHMod ,"GetAdaptersAddresses"); -#endif // _WINNT4 - -#ifdef HAVE_DAG_API - /* We load dynamically the dag library in order link it only when it's present on the system */ - if((DagcLib = LoadLibrary(TEXT("dagc.dll"))) == NULL) - { - // Report the error but go on - ODS("dag capture library not found on this system\n"); - break; - } - - p_dagc_open = (dagc_open_handler) GetProcAddress(DagcLib, "dagc_open"); - p_dagc_close = (dagc_close_handler) GetProcAddress(DagcLib, "dagc_close"); - p_dagc_setsnaplen = (dagc_setsnaplen_handler) GetProcAddress(DagcLib, "dagc_setsnaplen"); - p_dagc_getlinktype = (dagc_getlinktype_handler) GetProcAddress(DagcLib, "dagc_getlinktype"); - p_dagc_getlinkspeed = (dagc_getlinkspeed_handler) GetProcAddress(DagcLib, "dagc_getlinkspeed"); - p_dagc_getfcslen = (dagc_getfcslen_handler) GetProcAddress(DagcLib, "dagc_getfcslen"); - p_dagc_receive = (dagc_receive_handler) GetProcAddress(DagcLib, "dagc_receive"); - p_dagc_wait = (dagc_wait_handler) GetProcAddress(DagcLib, "dagc_wait"); - p_dagc_stats = (dagc_stats_handler) GetProcAddress(DagcLib, "dagc_stats"); - p_dagc_finddevs = (dagc_finddevs_handler) GetProcAddress(DagcLib, "dagc_finddevs"); - p_dagc_freedevs = (dagc_freedevs_handler) GetProcAddress(DagcLib, "dagc_freedevs"); - -#endif /* HAVE_DAG_API */ - - break; - - case DLL_PROCESS_DETACH: - - CloseHandle(AdaptersInfoMutex); - - AdaptersInfoList; - - while(AdaptersInfoList != NULL) - { - - NewAdInfo = AdaptersInfoList->Next; - if (AdaptersInfoList->NetworkAddresses != NULL) - GlobalFreePtr(AdaptersInfoList->NetworkAddresses); - GlobalFreePtr(AdaptersInfoList); - - AdaptersInfoList = NewAdInfo; - } - - - break; - - default: - break; - } - - return Status; -} - -/*! - \brief Convert a Unicode dotted-quad to a 32-bit IP address. - \param cp A string containing the address. - \return the converted 32-bit numeric address. - - Doesn't check to make sure the address is valid. -*/ - -ULONG inet_addrU(const WCHAR *cp) -{ - ULONG val, part; - WCHAR c; - int i; - - val = 0; - for (i = 0; i < 4; i++) { - part = 0; - while ((c = *cp++) != '\0' && c != '.') { - if (c < '0' || c > '9') - return -1; - part = part*10 + (c - '0'); - } - if (part > 255) - return -1; - val = val | (part << i*8); - if (i == 3) { - if (c != '\0') - return -1; // extra gunk at end of string - } else { - if (c == '\0') - return -1; // string ends early - } - } - return val; -} - -/*! - \brief Converts an ASCII string to UNICODE. Uses the MultiByteToWideChar() system function. - \param string The string to convert. - \return The converted string. -*/ - -PWCHAR SChar2WChar(PCHAR string) -{ - PWCHAR TmpStr; - TmpStr = (WCHAR*) GlobalAllocPtr(GMEM_MOVEABLE | GMEM_ZEROINIT, (strlen(string)+2)*sizeof(WCHAR)); - - MultiByteToWideChar(CP_ACP, 0, string, -1, TmpStr, ((int)strlen(string)+2)); - - return TmpStr; -} - -/*! - \brief Converts an UNICODE string to ASCII. Uses the WideCharToMultiByte() system function. - \param string The string to convert. - \return The converted string. -*/ - -PCHAR WChar2SChar(PWCHAR string) -{ - PCHAR TmpStr; - TmpStr = (CHAR*) GlobalAllocPtr(GMEM_MOVEABLE | GMEM_ZEROINIT, (wcslen(string)+2)); - - // Convert to ASCII - WideCharToMultiByte( - CP_ACP, - 0, - string, - -1, - TmpStr, - ((int)wcslen(string)+2), // size of buffer - NULL, - NULL); - - return TmpStr; -} - -/*! - \brief Sets the maximum possible lookahead buffer for the driver's Packet_tap() function. - \param AdapterObject Handle to the service control manager. - \return If the function succeeds, the return value is nonzero. - - The lookahead buffer is the portion of packet that Packet_tap() can access from the NIC driver's memory - without performing a copy. This function tries to increase the size of that buffer. -*/ - -BOOLEAN PacketSetMaxLookaheadsize (LPADAPTER AdapterObject) -{ - BOOLEAN Status; - ULONG IoCtlBufferLength=(sizeof(PACKET_OID_DATA)+sizeof(ULONG)-1); - PPACKET_OID_DATA OidData; - - OidData = GlobalAllocPtr(GMEM_MOVEABLE | GMEM_ZEROINIT,IoCtlBufferLength); - if (OidData == NULL) { - ODS("PacketSetMaxLookaheadsize failed\n"); - return FALSE; - } - - //set the size of the lookahead buffer to the maximum available by the the NIC driver - OidData->Oid=OID_GEN_MAXIMUM_LOOKAHEAD; - OidData->Length=sizeof(ULONG); - Status=PacketRequest(AdapterObject,FALSE,OidData); - OidData->Oid=OID_GEN_CURRENT_LOOKAHEAD; - Status=PacketRequest(AdapterObject,TRUE,OidData); - GlobalFreePtr(OidData); - return Status; -} - -/*! - \brief Retrieves the event associated in the driver with a capture instance and stores it in an - _ADAPTER structure. - \param AdapterObject Handle to the service control manager. - \return If the function succeeds, the return value is nonzero. - - This function is used by PacketOpenAdapter() to retrieve the read event from the driver by means of an ioctl - call and set it in the _ADAPTER structure pointed by AdapterObject. -*/ - -BOOLEAN PacketSetReadEvt(LPADAPTER AdapterObject) -{ - DWORD BytesReturned; - TCHAR EventName[39]; - - if (LOWORD(GetVersion()) == 4) - { - // retrieve the name of the shared event from the driver without the "Global\\" prefix - if(DeviceIoControl(AdapterObject->hFile,pBIOCEVNAME,NULL,0,EventName,13*sizeof(TCHAR),&BytesReturned,NULL)==FALSE) - return FALSE; - - EventName[BytesReturned/sizeof(TCHAR)]=0; // terminate the string - } - else - { - // this tells the terminal service to retrieve the event from the global namespace - wcsncpy(EventName,L"Global\\",sizeof(L"Global\\")); - // retrieve the name of the shared event from the driver with the "Global\\" prefix - if(DeviceIoControl(AdapterObject->hFile,pBIOCEVNAME,NULL,0,EventName + 7,13*sizeof(TCHAR),&BytesReturned,NULL)==FALSE) - return FALSE; - - EventName[BytesReturned/sizeof(TCHAR) + 7]=0; // terminate the string - } - - // open the shared event - AdapterObject->ReadEvent=CreateEvent(NULL, - TRUE, - FALSE, - EventName); - - if(AdapterObject->ReadEvent==NULL || GetLastError()!=ERROR_ALREADY_EXISTS){ - ODS("PacketSetReadEvt: error retrieving the event from the kernel\n"); - return FALSE; - } - - AdapterObject->ReadTimeOut=0; - - return TRUE; -} - -/*! - \brief Installs the NPF device driver. - \return If the function succeeds, the return value is nonzero. - - This function installs the driver's service in the system using the CreateService function. -*/ - -BOOL PacketInstallDriver() -{ - BOOL result = FALSE; - ULONG err = 0; - SC_HANDLE svcHandle; - SC_HANDLE scmHandle; - ODS("PacketInstallDriver\n"); - - scmHandle = OpenSCManager(NULL, NULL, SC_MANAGER_ALL_ACCESS); - - if(scmHandle == NULL) - return FALSE; - - svcHandle = CreateService(scmHandle, - NPFServiceName, - NPFServiceDesc, - SERVICE_ALL_ACCESS, - SERVICE_KERNEL_DRIVER, - SERVICE_DEMAND_START, - SERVICE_ERROR_NORMAL, - NPFDriverPath, - NULL, NULL, NULL, NULL, NULL); - if (svcHandle == NULL) - { - err = GetLastError(); - if (err == ERROR_SERVICE_EXISTS) - { - //npf.sys already existed - err = 0; - result = TRUE; - } - } - else - { - //Created service for npf.sys - result = TRUE; - } - - if (svcHandle != NULL) - CloseServiceHandle(svcHandle); - - if(result == FALSE) - { - ODSEx("PacketInstallDriver failed, Error=%d\n",err); - } - - CloseServiceHandle(scmHandle); - SetLastError(err); - return result; - -} - -/*! - \brief Dumps a registry key to disk in text format. Uses regedit. - \param KeyName Name of the ket to dump. All its subkeys will be saved recursively. - \param FileName Name of the file that will contain the dump. - \return If the function succeeds, the return value is nonzero. - - For debugging purposes, we use this function to obtain some registry keys from the user's machine. -*/ - -#ifdef _DEBUG_TO_FILE - -LONG PacketDumpRegistryKey(PCHAR KeyName, PCHAR FileName) -{ - CHAR Command[256]; - - strcpy(Command, "regedit /e "); - strcat(Command, FileName); - strcat(Command, " "); - strcat(Command, KeyName); - - /// Let regedit do the dirt work for us - system(Command); - - return TRUE; -} -#endif - -/*! - \brief Returns the version of a dll or exe file - \param FileName Name of the file whose version has to be retrieved. - \param VersionBuff Buffer that will contain the string with the file version. - \param VersionBuffLen Length of the buffer pointed by VersionBuff. - \return If the function succeeds, the return value is TRUE. - - \note uses the GetFileVersionInfoSize() and GetFileVersionInfo() WIN32 API functions -*/ -BOOL PacketGetFileVersion(LPTSTR FileName, PCHAR VersionBuff, UINT VersionBuffLen) -{ - DWORD dwVerInfoSize; // Size of version information block - DWORD dwVerHnd=0; // An 'ignored' parameter, always '0' - LPSTR lpstrVffInfo; - UINT cbTranslate, dwBytes; - TCHAR SubBlock[64]; - PVOID lpBuffer; - PCHAR TmpStr; - - // Structure used to store enumerated languages and code pages. - struct LANGANDCODEPAGE { - WORD wLanguage; - WORD wCodePage; - } *lpTranslate; - - ODS("PacketGetFileVersion\n"); - - // Now lets dive in and pull out the version information: - dwVerInfoSize = GetFileVersionInfoSize(FileName, &dwVerHnd); - if (dwVerInfoSize) - { - lpstrVffInfo = GlobalAllocPtr(GMEM_MOVEABLE, dwVerInfoSize); - if (lpstrVffInfo == NULL) - { - ODS("PacketGetFileVersion: failed to allocate memory\n"); - return FALSE; - } - - if(!GetFileVersionInfo(FileName, dwVerHnd, dwVerInfoSize, lpstrVffInfo)) - { - ODS("PacketGetFileVersion: failed to call GetFileVersionInfo\n"); - GlobalFreePtr(lpstrVffInfo); - return FALSE; - } - - // Read the list of languages and code pages. - if(!VerQueryValue(lpstrVffInfo, TEXT("\\VarFileInfo\\Translation"), (LPVOID*)&lpTranslate, &cbTranslate)) - { - ODS("PacketGetFileVersion: failed to call VerQueryValue\n"); - GlobalFreePtr(lpstrVffInfo); - return FALSE; - } - - // Create the file version string for the first (i.e. the only one) language. - wsprintf( SubBlock, - TEXT("\\StringFileInfo\\%04x%04x\\FileVersion"), - (*lpTranslate).wLanguage, - (*lpTranslate).wCodePage); - - // Retrieve the file version string for the language. - if(!VerQueryValue(lpstrVffInfo, SubBlock, &lpBuffer, &dwBytes)) - { - ODS("PacketGetFileVersion: failed to call VerQueryValue\n"); - GlobalFreePtr(lpstrVffInfo); - return FALSE; - } - - // Convert to ASCII - TmpStr = WChar2SChar(lpBuffer); - - if(strlen(TmpStr) >= VersionBuffLen) - { - ODS("PacketGetFileVersion: Input buffer too small\n"); - GlobalFreePtr(lpstrVffInfo); - GlobalFreePtr(TmpStr); - return FALSE; - } - - strcpy(VersionBuff, TmpStr); - - GlobalFreePtr(lpstrVffInfo); - GlobalFreePtr(TmpStr); - - } - else - { - ODSEx("PacketGetFileVersion: failed to call GetFileVersionInfoSize, LastError = %d\n", GetLastError()); - return FALSE; - - } - - return TRUE; -} - -/*! - \brief Opens an adapter using the NPF device driver. - \param AdapterName A string containing the name of the device to open. - \return If the function succeeds, the return value is the pointer to a properly initialized ADAPTER object, - otherwise the return value is NULL. - - \note internal function used by PacketOpenAdapter() and AddAdapter() -*/ -LPADAPTER PacketOpenAdapterNPF(PCHAR AdapterName) -{ - LPADAPTER lpAdapter; - BOOLEAN Result; - DWORD error; - SC_HANDLE svcHandle = NULL; - SC_HANDLE scmHandle = NULL; - LONG KeyRes; - HKEY PathKey; - SERVICE_STATUS SStat; - BOOLEAN QuerySStat; - WCHAR SymbolicLink[128]; - - ODS("PacketOpenAdapterNPF\n"); - - scmHandle = OpenSCManager(NULL, NULL, GENERIC_READ); - - if(scmHandle == NULL) - { - error = GetLastError(); - ODSEx("OpenSCManager failed! LastError=%d\n", error); - } - else - { - // check if the NPF registry key is already present - // this means that the driver is already installed and that we don't need to call PacketInstallDriver - KeyRes=RegOpenKeyEx(HKEY_LOCAL_MACHINE, - NPFRegistryLocation, - 0, - KEY_READ, - &PathKey); - - if(KeyRes != ERROR_SUCCESS) - { - Result = PacketInstallDriver(); - } - else - { - Result = TRUE; - RegCloseKey(PathKey); - } - - Result = FALSE; - svcHandle = OpenService(scmHandle, NPFServiceName, GENERIC_READ); - if (svcHandle != NULL) - { - Result = TRUE; - - CloseServiceHandle(svcHandle); - } - - if (Result) - { - - svcHandle = OpenService(scmHandle, NPFServiceName, SERVICE_START | SERVICE_QUERY_STATUS ); - if (svcHandle != NULL) - { - QuerySStat = QueryServiceStatus(svcHandle, &SStat); - -#if defined(_DBG) || defined(_DEBUG_TO_FILE) - switch (SStat.dwCurrentState) - { - case SERVICE_CONTINUE_PENDING: - ODS("The status of the driver is: SERVICE_CONTINUE_PENDING\n"); - break; - case SERVICE_PAUSE_PENDING: - ODS("The status of the driver is: SERVICE_PAUSE_PENDING\n"); - break; - case SERVICE_PAUSED: - ODS("The status of the driver is: SERVICE_PAUSED\n"); - break; - case SERVICE_RUNNING: - ODS("The status of the driver is: SERVICE_RUNNING\n"); - break; - case SERVICE_START_PENDING: - ODS("The status of the driver is: SERVICE_START_PENDING\n"); - break; - case SERVICE_STOP_PENDING: - ODS("The status of the driver is: SERVICE_STOP_PENDING\n"); - break; - case SERVICE_STOPPED: - ODS("The status of the driver is: SERVICE_STOPPED\n"); - break; - - default: - ODS("The status of the driver is: unknown\n"); - break; - } -#endif - - if(!QuerySStat || SStat.dwCurrentState != SERVICE_RUNNING) - { - ODS("Calling startservice\n"); - if (StartService(svcHandle, 0, NULL)==0) - { - error = GetLastError(); - if(error!=ERROR_SERVICE_ALREADY_RUNNING && error!=ERROR_ALREADY_EXISTS) - { - SetLastError(error); - if (scmHandle != NULL) - CloseServiceHandle(scmHandle); - error = GetLastError(); - ODSEx("PacketOpenAdapterNPF: StartService failed, LastError=%d\n",error); - SetLastError(error); - return NULL; - } - } - } - - CloseServiceHandle( svcHandle ); - svcHandle = NULL; - - } - else - { - error = GetLastError(); - ODSEx("OpenService failed! Error=%d", error); - SetLastError(error); - } - } - else - { - if (KeyRes == FALSE) - Result = PacketInstallDriver(); - else - Result = TRUE; - - if (Result) { - - svcHandle = OpenService(scmHandle,NPFServiceName,SERVICE_START); - if (svcHandle != NULL) - { - - QuerySStat = QueryServiceStatus(svcHandle, &SStat); - -#if defined(_DBG) || defined(_DEBUG_TO_FILE) - switch (SStat.dwCurrentState) - { - case SERVICE_CONTINUE_PENDING: - ODS("The status of the driver is: SERVICE_CONTINUE_PENDING\n"); - break; - case SERVICE_PAUSE_PENDING: - ODS("The status of the driver is: SERVICE_PAUSE_PENDING\n"); - break; - case SERVICE_PAUSED: - ODS("The status of the driver is: SERVICE_PAUSED\n"); - break; - case SERVICE_RUNNING: - ODS("The status of the driver is: SERVICE_RUNNING\n"); - break; - case SERVICE_START_PENDING: - ODS("The status of the driver is: SERVICE_START_PENDING\n"); - break; - case SERVICE_STOP_PENDING: - ODS("The status of the driver is: SERVICE_STOP_PENDING\n"); - break; - case SERVICE_STOPPED: - ODS("The status of the driver is: SERVICE_STOPPED\n"); - break; - - default: - ODS("The status of the driver is: unknown\n"); - break; - } -#endif - - if(!QuerySStat || SStat.dwCurrentState != SERVICE_RUNNING){ - - ODS("Calling startservice\n"); - - if (StartService(svcHandle, 0, NULL)==0){ - error = GetLastError(); - if(error!=ERROR_SERVICE_ALREADY_RUNNING && error!=ERROR_ALREADY_EXISTS){ - if (scmHandle != NULL) CloseServiceHandle(scmHandle); - ODSEx("PacketOpenAdapterNPF: StartService failed, LastError=%d\n",error); - SetLastError(error); - return NULL; - } - } - } - - CloseServiceHandle( svcHandle ); - svcHandle = NULL; - - } - else{ - error = GetLastError(); - ODSEx("OpenService failed! LastError=%d", error); - SetLastError(error); - } - } - } - } - - if (scmHandle != NULL) CloseServiceHandle(scmHandle); - - lpAdapter=(LPADAPTER)GlobalAllocPtr(GMEM_MOVEABLE | GMEM_ZEROINIT, sizeof(ADAPTER)); - if (lpAdapter==NULL) - { - ODS("PacketOpenAdapterNPF: GlobalAlloc Failed\n"); - error=GetLastError(); - //set the error to the one on which we failed - SetLastError(error); - ODS("PacketOpenAdapterNPF: Failed to allocate the adapter structure\n"); - return NULL; - } - lpAdapter->NumWrites=1; - - if (LOWORD(GetVersion()) == 4) - wsprintf(SymbolicLink,TEXT("\\\\.\\%s"),&AdapterName[16]); - else - wsprintf(SymbolicLink,TEXT("\\\\.\\Global\\%s"),&AdapterName[16]); - - // Copy only the bytes that fit in the adapter structure. - // Note that lpAdapter->SymbolicLink is present for backward compatibility but will - // never be used by the apps - memcpy(lpAdapter->SymbolicLink, (PCHAR)SymbolicLink, MAX_LINK_NAME_LENGTH); - - //try if it is possible to open the adapter immediately - lpAdapter->hFile=CreateFile(SymbolicLink,GENERIC_WRITE | GENERIC_READ, - 0,NULL,OPEN_EXISTING,0,0); - - if (lpAdapter->hFile != INVALID_HANDLE_VALUE) - { - - if(PacketSetReadEvt(lpAdapter)==FALSE){ - error=GetLastError(); - ODS("PacketOpenAdapterNPF: Unable to open the read event\n"); - GlobalFreePtr(lpAdapter); - //set the error to the one on which we failed - SetLastError(error); - ODSEx("PacketOpenAdapterNPF: PacketSetReadEvt failed, LastError=%d\n",error); - return NULL; - } - - PacketSetMaxLookaheadsize(lpAdapter); - - _snprintf(lpAdapter->Name, ADAPTER_NAME_LENGTH, "%S", AdapterName); - - return lpAdapter; - } - - - error=GetLastError(); - GlobalFreePtr(lpAdapter); - //set the error to the one on which we failed - ODSEx("PacketOpenAdapterNPF: CreateFile failed, LastError= %d\n",error); - SetLastError(error); - return NULL; -} - -/*! - \brief Opens an adapter using the DAG capture API. - \param AdapterName A string containing the name of the device to open. - \return If the function succeeds, the return value is the pointer to a properly initialized ADAPTER object, - otherwise the return value is NULL. - - \note internal function used by PacketOpenAdapter() -*/ -#ifdef HAVE_DAG_API -LPADAPTER PacketOpenAdapterDAG(PCHAR AdapterName, BOOLEAN IsAFile) -{ - CHAR DagEbuf[DAGC_ERRBUF_SIZE]; - LPADAPTER lpAdapter; - LONG status; - HKEY dagkey; - DWORD lptype; - DWORD fpc; - DWORD lpcbdata = sizeof(fpc); - WCHAR keyname[512]; - PWCHAR tsn; - - - lpAdapter = (LPADAPTER) GlobalAllocPtr(GMEM_MOVEABLE | GMEM_ZEROINIT, - sizeof(ADAPTER)); - if (lpAdapter == NULL) - { - return NULL; - } - - if(IsAFile) - { - // We must add an entry to the adapter description list, otherwise many function will not - // be able to work - if(!PacketAddAdapterDag(AdapterName, "DAG file", IsAFile)) - { - GlobalFreePtr(lpAdapter); - return NULL; - } - - // Flag that this is a DAG file - lpAdapter->Flags = INFO_FLAG_DAG_FILE; - } - else - { - // Flag that this is a DAG card - lpAdapter->Flags = INFO_FLAG_DAG_CARD; - } - - // - // See if the user is asking for fast capture with this device - // - - lpAdapter->DagFastProcess = FALSE; - - tsn = (strstr(strlwr((char*)AdapterName), "dag") != NULL)? - SChar2WChar(strstr(strlwr((char*)AdapterName), "dag")): - L""; - - _snwprintf(keyname, sizeof(keyname), L"%s\\CardParams\\%ws", - L"SYSTEM\\CurrentControlSet\\Services\\DAG", - tsn); - - GlobalFreePtr(tsn); - - do - { - status = RegOpenKeyEx(HKEY_LOCAL_MACHINE, keyname, 0 , KEY_READ, &dagkey); - if(status != ERROR_SUCCESS) - break; - - status = RegQueryValueEx(dagkey, - L"FastCap", - NULL, - &lptype, - (char*)&fpc, - &lpcbdata); - - if(status == ERROR_SUCCESS) - lpAdapter->DagFastProcess = fpc; - - RegCloseKey(dagkey); - } - while(FALSE); - - // - // Open the card - // - lpAdapter->pDagCard = p_dagc_open(AdapterName, - 0, - DagEbuf); - - if(lpAdapter->pDagCard == NULL) - { - GlobalFreePtr(lpAdapter); - return NULL; - } - - lpAdapter->DagFcsLen = p_dagc_getfcslen(lpAdapter->pDagCard); - - _snprintf(lpAdapter->Name, ADAPTER_NAME_LENGTH, "%s", AdapterName); - - // XXX we could create the read event here - - return lpAdapter; -} -#endif // HAVE_DAG_API - -//--------------------------------------------------------------------------- -// PUBLIC API -//--------------------------------------------------------------------------- - -/** @ingroup packetapi - * @{ - */ - -/** @defgroup packet32 Packet.dll exported functions and variables - * @{ - */ - -/*! - \brief Return a string with the dll version. - \return A char pointer to the version of the library. -*/ -PCHAR PacketGetVersion() -{ - return PacketLibraryVersion; -} - -/*! - \brief Return a string with the version of the NPF.sys device driver. - \return A char pointer to the version of the driver. -*/ -PCHAR PacketGetDriverVersion() -{ - return PacketDriverVersion; -} - -/*! - \brief Stops and unloads the WinPcap device driver. - \return If the function succeeds, the return value is nonzero, otherwise it is zero. - - This function can be used to unload the driver from memory when the application no more needs it. - Note that the driver is physically stopped and unloaded only when all the files on its devices - are closed, i.e. when all the applications that use WinPcap close all their adapters. -*/ -BOOL PacketStopDriver() -{ - SC_HANDLE scmHandle; - SC_HANDLE schService; - BOOL ret; - SERVICE_STATUS serviceStatus; - - scmHandle = OpenSCManager(NULL, NULL, SC_MANAGER_ALL_ACCESS); - - if(scmHandle != NULL){ - - schService = OpenService (scmHandle, - NPFServiceName, - SERVICE_ALL_ACCESS - ); - - if (schService != NULL) - { - - ret = ControlService (schService, - SERVICE_CONTROL_STOP, - &serviceStatus - ); - if (!ret) - { - } - - CloseServiceHandle (schService); - - CloseServiceHandle(scmHandle); - - return ret; - } - } - - return FALSE; -} - -/*! - \brief Opens an adapter. - \param AdapterName A string containing the name of the device to open. - Use the PacketGetAdapterNames() function to retrieve the list of available devices. - \return If the function succeeds, the return value is the pointer to a properly initialized ADAPTER object, - otherwise the return value is NULL. -*/ -LPADAPTER PacketOpenAdapter(PCHAR AdapterName) -{ - LPADAPTER lpAdapter; - WCHAR *AdapterNameU; - SC_HANDLE svcHandle = NULL; - PCHAR AdapterNameA = NULL; -#ifndef _WINNT4 - PADAPTER_INFO TAdInfo; -#endif // _WINNT4 - ODSEx("PacketOpenAdapter: trying to open the adapter=%s\n",AdapterName) - - if(AdapterName[1]!=0) - { - // - // ASCII - // - - AdapterNameU = SChar2WChar(AdapterName); - AdapterNameA = AdapterName; - AdapterName = (PCHAR)AdapterNameU; - } - else - { - // - // Unicode - // - AdapterNameU = NULL; - AdapterNameA = WChar2SChar((PWCHAR)AdapterName); - } - -#ifndef _WINNT4 - - WaitForSingleObject(AdaptersInfoMutex, INFINITE); - // Find the PADAPTER_INFO structure associated with this adapter - TAdInfo = PacketFindAdInfo(AdapterNameA); - if(TAdInfo == NULL) - { - PacketUpdateAdInfo(AdapterNameA); - TAdInfo = PacketFindAdInfo(AdapterNameA); - if(TAdInfo == NULL) - { - - //can be an ERF file? - lpAdapter = PacketOpenAdapterDAG(AdapterNameA, TRUE); - - if (AdapterNameU != NULL) - GlobalFreePtr(AdapterNameU); - else - GlobalFreePtr(AdapterNameA); - - ReleaseMutex(AdaptersInfoMutex); - if (lpAdapter == NULL) - SetLastError(ERROR_BAD_UNIT); //this is the best we can do.... - return lpAdapter; - } - } - - // - // Check adapter type - // - if(TAdInfo->Flags != INFO_FLAG_NDIS_ADAPTER) - { - // - // Not a standard NDIS adapter, we must have specific handling - // - - if(TAdInfo->Flags & INFO_FLAG_NDISWAN_ADAPTER) - { - // - // This is a wan adapter. Open it using the netmon API - // - lpAdapter = (LPADAPTER) GlobalAllocPtr(GMEM_MOVEABLE | GMEM_ZEROINIT, - sizeof(ADAPTER)); - if (lpAdapter == NULL) - { - if (AdapterNameU != NULL) GlobalFreePtr(AdapterNameU); - else GlobalFreePtr(AdapterNameA); - ReleaseMutex(AdaptersInfoMutex); - SetLastError(ERROR_BAD_UNIT); - return NULL; - } - - // Backup flags for future usage - lpAdapter->Flags = TAdInfo->Flags; - - // Open the adapter - lpAdapter->pWanAdapter = WanPacketOpenAdapter(); - if (lpAdapter->pWanAdapter == NULL) - { - if (AdapterNameU != NULL) GlobalFreePtr(AdapterNameU); - else GlobalFreePtr(AdapterNameA); - - GlobalFreePtr(lpAdapter); - ReleaseMutex(AdaptersInfoMutex); - SetLastError(ERROR_BAD_UNIT); - return NULL; - } - - _snprintf(lpAdapter->Name, ADAPTER_NAME_LENGTH, "%s", AdapterNameA); - - lpAdapter->ReadEvent = WanPacketGetReadEvent(lpAdapter->pWanAdapter); - - if (AdapterNameU != NULL) - GlobalFreePtr(AdapterNameU); - else - GlobalFreePtr(AdapterNameA); - - ReleaseMutex(AdaptersInfoMutex); - return lpAdapter; - } - else - if(TAdInfo->Flags & INFO_FLAG_DAG_CARD) - { - // - // This is a Dag card. Open it using the dagc API - // - lpAdapter = PacketOpenAdapterDAG(AdapterNameA, FALSE); - - if (AdapterNameU != NULL) - GlobalFreePtr(AdapterNameU); - else - GlobalFreePtr(AdapterNameA); - - ReleaseMutex(AdaptersInfoMutex); - if (lpAdapter == NULL) - SetLastError(ERROR_BAD_UNIT); - return lpAdapter; - } - else - if(TAdInfo->Flags == INFO_FLAG_DONT_EXPORT) - { - // - // The adapter is flagged as not exported, probably because it's broken - // or incompatible with WinPcap. We end here with an error. - // - ODSEx("The user openend the adapter %s which is flagged as not exported", AdapterNameA); - if (AdapterNameU != NULL) GlobalFreePtr(AdapterNameU); - else GlobalFreePtr(AdapterNameA); - ReleaseMutex(AdaptersInfoMutex); - SetLastError(ERROR_BAD_UNIT); - return NULL; - } - } - - ReleaseMutex(AdaptersInfoMutex); - -#endif // _WINNT4 - - lpAdapter = PacketOpenAdapterNPF(AdapterName); - - if (AdapterNameU != NULL) - GlobalFreePtr(AdapterNameU); - else - GlobalFreePtr(AdapterNameA); - - return lpAdapter; -} - -/*! - \brief Closes an adapter. - \param lpAdapter the pointer to the adapter to close. - - PacketCloseAdapter closes the given adapter and frees the associated ADAPTER structure -*/ -VOID PacketCloseAdapter(LPADAPTER lpAdapter) -{ - if(!lpAdapter) - { - ODS("PacketCloseAdapter: attempt to close a NULL adapter\n"); - return; - } - -#ifndef _WINNT4 - if(lpAdapter->pWanAdapter != NULL) - { - WanPacketCloseAdapter(lpAdapter->pWanAdapter); - GlobalFreePtr(lpAdapter); - return; - } -#ifdef HAVE_DAG_API - else - if(lpAdapter->pDagCard != NULL) - { - if(lpAdapter->Flags & INFO_FLAG_DAG_FILE & ~INFO_FLAG_DAG_CARD) - { - // This is a file. We must remove the entry in the adapter description list - PacketUpdateAdInfo(lpAdapter->Name); - } - p_dagc_close(lpAdapter->pDagCard); - } -#endif // HAVE_DAG_API -#endif // _WINNT4 - - CloseHandle(lpAdapter->hFile); - SetEvent(lpAdapter->ReadEvent); - CloseHandle(lpAdapter->ReadEvent); - GlobalFreePtr(lpAdapter); -} - -/*! - \brief Allocates a _PACKET structure. - \return On succeess, the return value is the pointer to a _PACKET structure otherwise the - return value is NULL. - - The structure returned will be passed to the PacketReceivePacket() function to receive the - packets from the driver. - - \warning The Buffer field of the _PACKET structure is not set by this function. - The buffer \b must be allocated by the application, and associated to the PACKET structure - with a call to PacketInitPacket. -*/ -LPPACKET PacketAllocatePacket(void) -{ - - LPPACKET lpPacket; - lpPacket=(LPPACKET)GlobalAllocPtr(GMEM_MOVEABLE | GMEM_ZEROINIT,sizeof(PACKET)); - if (lpPacket==NULL) - { - ODS("PacketAllocatePacket: GlobalAlloc Failed\n"); - return NULL; - } - return lpPacket; -} - -/*! - \brief Frees a _PACKET structure. - \param lpPacket The structure to free. - - \warning the user-allocated buffer associated with the _PACKET structure is not deallocated - by this function and \b must be explicitly deallocated by the programmer. - -*/ -VOID PacketFreePacket(LPPACKET lpPacket) - -{ - GlobalFreePtr(lpPacket); -} - -/*! - \brief Initializes a _PACKET structure. - \param lpPacket The structure to initialize. - \param Buffer A pointer to a user-allocated buffer that will contain the captured data. - \param Length the length of the buffer. This is the maximum buffer size that will be - transferred from the driver to the application using a single read. - - \note the size of the buffer associated with the PACKET structure is a parameter that can sensibly - influence the performance of the capture process, since this buffer will contain the packets received - from the the driver. The driver is able to return several packets using a single read call - (see the PacketReceivePacket() function for details), and the number of packets transferable to the - application in a call is limited only by the size of the buffer associated with the PACKET structure - passed to PacketReceivePacket(). Therefore setting a big buffer with PacketInitPacket can noticeably - decrease the number of system calls, reducing the impcat of the capture process on the processor. -*/ - -VOID PacketInitPacket(LPPACKET lpPacket,PVOID Buffer,UINT Length) - -{ - lpPacket->Buffer = Buffer; - lpPacket->Length = Length; - lpPacket->ulBytesReceived = 0; - lpPacket->bIoComplete = FALSE; -} - -/*! - \brief Read data (packets or statistics) from the NPF driver. - \param AdapterObject Pointer to an _ADAPTER structure identifying the network adapter from which - the data is received. - \param lpPacket Pointer to a PACKET structure that will contain the data. - \param Sync This parameter is deprecated and will be ignored. It is present for compatibility with - older applications. - \return If the function succeeds, the return value is nonzero. - - The data received with this function can be a group of packets or a static on the network traffic, - depending on the working mode of the driver. The working mode can be set with the PacketSetMode() - function. Give a look at that function if you are interested in the format used to return statistics - values, here only the normal capture mode will be described. - - The number of packets received with this function is variable. It depends on the number of packets - currently stored in the driver buffer, on the size of these packets and on the size of the buffer - associated to the lpPacket parameter. The following figure shows the format used by the driver to pass - packets to the application. - - \image html encoding.gif "method used to encode the packets" - - Packets are stored in the buffer associated with the lpPacket _PACKET structure. The Length field of - that structure is updated with the amount of data copied in the buffer. Each packet has a header - consisting in a bpf_hdr structure that defines its length and contains its timestamp. A padding field - is used to word-align the data in the buffer (to speed up the access to the packets). The bh_datalen - and bh_hdrlen fields of the bpf_hdr structures should be used to extract the packets from the buffer. - - Examples can be seen either in the TestApp sample application (see the \ref packetsamps page) provided - in the developer's pack, or in the pcap_read() function of wpcap. -*/ -BOOLEAN PacketReceivePacket(LPADAPTER AdapterObject,LPPACKET lpPacket,BOOLEAN Sync) -{ - BOOLEAN res; - -#ifndef _WINNT4 - - if (AdapterObject->pWanAdapter != NULL) - { - lpPacket->ulBytesReceived = WanPacketReceivePacket(AdapterObject->pWanAdapter, lpPacket->Buffer, lpPacket->Length); - return TRUE; - } -#ifdef HAVE_DAG_API - else - if(AdapterObject->pDagCard != NULL) - { - - p_dagc_wait(AdapterObject->pDagCard, &AdapterObject->DagReadTimeout); - - if(p_dagc_receive(AdapterObject->pDagCard, &AdapterObject->DagBuffer, &lpPacket->ulBytesReceived) == 0) - return TRUE; - else - return FALSE; - } -#endif // HAVE_DAG_API -#endif // _WINNT4 - - if((int)AdapterObject->ReadTimeOut != -1) - WaitForSingleObject(AdapterObject->ReadEvent, (AdapterObject->ReadTimeOut==0)?INFINITE:AdapterObject->ReadTimeOut); - - res = ReadFile(AdapterObject->hFile, lpPacket->Buffer, lpPacket->Length, &lpPacket->ulBytesReceived,NULL); - - return res; -} - -/*! - \brief Sends one (or more) copies of a packet to the network. - \param AdapterObject Pointer to an _ADAPTER structure identifying the network adapter that will - send the packets. - \param lpPacket Pointer to a PACKET structure with the packet to send. - \param Sync This parameter is deprecated and will be ignored. It is present for compatibility with - older applications. - \return If the function succeeds, the return value is nonzero. - - This function is used to send a raw packet to the network. 'Raw packet' means that the programmer - will have to include the protocol headers, since the packet is sent to the network 'as is'. - The CRC needs not to be calculated and put at the end of the packet, because it will be transparently - added by the network interface. - - The behavior of this function is influenced by the PacketSetNumWrites() function. With PacketSetNumWrites(), - it is possible to change the number of times a single write must be repeated. The default is 1, - i.e. every call to PacketSendPacket() will correspond to one packet sent to the network. If this number is - greater than 1, for example 1000, every raw packet written by the application will be sent 1000 times on - the network. This feature mitigates the overhead of the context switches and therefore can be used to generate - high speed traffic. It is particularly useful for tools that test networks, routers, and servers and need - to obtain high network loads. - The optimized sending process is still limited to one packet at a time: for the moment it cannot be used - to send a buffer with multiple packets. - - \note The ability to write multiple packets is currently present only in the Windows NTx version of the - packet driver. In Windows 95/98/ME it is emulated at user level in packet.dll. This means that an application - that uses the multiple write method will run in Windows 9x as well, but its performance will be very low - compared to the one of WindowsNTx. -*/ -BOOLEAN PacketSendPacket(LPADAPTER AdapterObject,LPPACKET lpPacket,BOOLEAN Sync) -{ - DWORD BytesTransfered; - - -#ifndef _WINNT4 - if(AdapterObject->Flags != INFO_FLAG_NDIS_ADAPTER) - { - ODS("PacketSendPacket: packet sending not allowed on wan adapters\n"); - return FALSE; - } -#endif // _WINNT4 - - return WriteFile(AdapterObject->hFile,lpPacket->Buffer,lpPacket->Length,&BytesTransfered,NULL); -} - - -/*! - \brief Sends a buffer of packets to the network. - \param AdapterObject Pointer to an _ADAPTER structure identifying the network adapter that will - send the packets. - \param PacketBuff Pointer to buffer with the packets to send. - \param Size Size of the buffer pointed by the PacketBuff argument. - \param Sync if TRUE, the packets are sent respecting the timestamps. If FALSE, the packets are sent as - fast as possible - \return The amount of bytes actually sent. If the return value is smaller than the Size parameter, an - error occurred during the send. The error can be caused by a driver/adapter problem or by an - inconsistent/bogus packet buffer. - - This function is used to send a buffer of raw packets to the network. The buffer can contain an arbitrary - number of raw packets, each of which preceded by a dump_bpf_hdr structure. The dump_bpf_hdr is the same used - by WinPcap and libpcap to store the packets in a file, therefore sending a capture file is straightforward. - 'Raw packets' means that the sending application will have to include the protocol headers, since every packet - is sent to the network 'as is'. The CRC of the packets needs not to be calculated, because it will be - transparently added by the network interface. - - \note Using this function if more efficient than issuing a series of PacketSendPacket(), because the packets are - buffered in the kernel driver, so the number of context switches is reduced. - - \note When Sync is set to TRUE, the packets are synchronized in the kerenl with a high precision timestamp. - This requires a remarkable amount of CPU, but allows to send the packets with a precision of some microseconds - (depending on the precision of the performance counter of the machine). Such a precision cannot be reached - sending the packets separately with PacketSendPacket(). -*/ -INT PacketSendPackets(LPADAPTER AdapterObject, PVOID PacketBuff, ULONG Size, BOOLEAN Sync) -{ - BOOLEAN Res; - DWORD BytesTransfered, TotBytesTransfered=0; - DWORD last_total = 0; - struct timeval BufStartTime; - //LARGE_INTEGER StartTicks, CurTicks, TargetTicks, TimeFreq; - UINT num_count = 0; - - - ODS("PacketSendPackets"); - -#ifndef _WINNT4 - if(AdapterObject->Flags != INFO_FLAG_NDIS_ADAPTER) - { - ODS("PacketSendPackets: packet sending not allowed on wan adapters\n"); - return FALSE; - } -#endif // _WINNT4 - - // Obtain starting timestamp of the buffer - BufStartTime.tv_sec = ((struct timeval*)(PacketBuff))->tv_sec; - BufStartTime.tv_usec = ((struct timeval*)(PacketBuff))->tv_usec; - - // Retrieve the reference time counters -// QueryPerformanceCounter(&StartTicks); -// QueryPerformanceFrequency(&TimeFreq); - -// CurTicks.QuadPart = StartTicks.QuadPart; - - do{ - // Send the data to the driver - Res = DeviceIoControl(AdapterObject->hFile, - (Sync)?pBIOCSENDPACKETSSYNC:pBIOCSENDPACKETSNOSYNC, - (PCHAR)PacketBuff + TotBytesTransfered, - Size - TotBytesTransfered, - NULL, - 0, - &BytesTransfered, - NULL); - - TotBytesTransfered += BytesTransfered; - - // Exit from the loop on termination or error - if(TotBytesTransfered >= Size || Res != TRUE) - break; - - if (last_total != TotBytesTransfered) - { - num_count = 0; - last_total = TotBytesTransfered; - } - - num_count++; - - if (num_count >= 100000) - { - // Fatal Error: Infinite Loop - return 0x7FFFFFFF; - } - - // calculate the time interval to wait before sending the next packet - /*TargetTicks.QuadPart = StartTicks.QuadPart + - (LONGLONG) - ((((struct timeval*)((PCHAR)PacketBuff + TotBytesTransfered))->tv_sec - BufStartTime.tv_sec) * 1000000 + - (((struct timeval*)((PCHAR)PacketBuff + TotBytesTransfered))->tv_usec - BufStartTime.tv_usec)) * - (TimeFreq.QuadPart) / 1000000; - - // Wait until the time interval has elapsed - while( CurTicks.QuadPart <= TargetTicks.QuadPart ) - QueryPerformanceCounter(&CurTicks);*/ - - } - while(TRUE); - - return TotBytesTransfered; -} - -/*! - \brief Defines the minimum amount of data that will be received in a read. - \param AdapterObject Pointer to an _ADAPTER structure - \param nbytes the minimum amount of data in the kernel buffer that will cause the driver to - release a read on this adapter. - \return If the function succeeds, the return value is nonzero. - - In presence of a large value for nbytes, the kernel waits for the arrival of several packets before - copying the data to the user. This guarantees a low number of system calls, i.e. lower processor usage, - i.e. better performance, which is a good setting for applications like sniffers. Vice versa, a small value - means that the kernel will copy the packets as soon as the application is ready to receive them. This is - suggested for real time applications (like, for example, a bridge) that need the better responsiveness from - the kernel. - - \b note: this function has effect only in Windows NTx. The driver for Windows 9x doesn't offer - this possibility, therefore PacketSetMinToCopy is implemented under these systems only for compatibility. -*/ - -BOOLEAN PacketSetMinToCopy(LPADAPTER AdapterObject,int nbytes) -{ - DWORD BytesReturned; - -#ifndef _WINNT4 - if (AdapterObject->Flags == INFO_FLAG_NDISWAN_ADAPTER) - return WanPacketSetMinToCopy(AdapterObject->pWanAdapter, nbytes); -#ifdef HAVE_DAG_API - else - if(AdapterObject->Flags & INFO_FLAG_DAG_CARD) - // No mintocopy with DAGs - return TRUE; -#endif // HAVE_DAG_API -#endif // _WINNT4 - - return DeviceIoControl(AdapterObject->hFile,pBIOCSMINTOCOPY,&nbytes,4,NULL,0,&BytesReturned,NULL); -} - -/*! - \brief Sets the working mode of an adapter. - \param AdapterObject Pointer to an _ADAPTER structure. - \param mode The new working mode of the adapter. - \return If the function succeeds, the return value is nonzero. - - The device driver of WinPcap has 4 working modes: - - Capture mode (mode = PACKET_MODE_CAPT): normal capture mode. The packets transiting on the wire are copied - to the application when PacketReceivePacket() is called. This is the default working mode of an adapter. - - Statistical mode (mode = PACKET_MODE_STAT): programmable statistical mode. PacketReceivePacket() returns, at - precise intervals, statics values on the network traffic. The interval between the statistic samples is - by default 1 second but it can be set to any other value (with a 1 ms precision) with the - PacketSetReadTimeout() function. The data returned by PacketReceivePacket() when the adapter is in statistical - mode is shown in the following figure:

- \image html stats.gif "data structure returned by statistical mode" - Two 64-bit counters are provided: the number of packets and the amount of bytes that satisfy a filter - previously set with PacketSetBPF(). If no filter has been set, all the packets are counted. The counters are - encapsulated in a bpf_hdr structure, so that they will be parsed correctly by wpcap. Statistical mode has a - very low impact on system performance compared to capture mode. - - Dump mode (mode = PACKET_MODE_DUMP): the packets are dumped to disk by the driver, in libpcap format. This - method is much faster than saving the packets after having captured them. No data is returned - by PacketReceivePacket(). If the application sets a filter with PacketSetBPF(), only the packets that satisfy - this filter are dumped to disk. - - Statitical Dump mode (mode = PACKET_MODE_STAT_DUMP): the packets are dumped to disk by the driver, in libpcap - format, like in dump mode. PacketReceivePacket() returns, at precise intervals, statics values on the - network traffic and on the amount of data saved to file, in a way similar to statistical mode. - The data returned by PacketReceivePacket() when the adapter is in statistical dump mode is shown in - the following figure:

- \image html dump.gif "data structure returned by statistical dump mode" - Three 64-bit counters are provided: the number of packets accepted, the amount of bytes accepted and the - effective amount of data (including headers) dumped to file. If no filter has been set, all the packets are - dumped to disk. The counters are encapsulated in a bpf_hdr structure, so that they will be parsed correctly - by wpcap. - Look at the NetMeter example in the - WinPcap developer's pack to see how to use statistics mode. -*/ -BOOLEAN PacketSetMode(LPADAPTER AdapterObject,int mode) -{ - DWORD BytesReturned; - -#ifndef _WINNT4 - if (AdapterObject->pWanAdapter != NULL) - return WanPacketSetMode(AdapterObject->pWanAdapter, mode); -#endif // _WINNT4 - - return DeviceIoControl(AdapterObject->hFile,pBIOCSMODE,&mode,4,NULL,0,&BytesReturned,NULL); -} - -/*! - \brief Sets the name of the file that will receive the packet when the adapter is in dump mode. - \param AdapterObject Pointer to an _ADAPTER structure. - \param name the file name, in ASCII or UNICODE. - \param len the length of the buffer containing the name, in bytes. - \return If the function succeeds, the return value is nonzero. - - This function defines the file name that the driver will open to store the packets on disk when - it works in dump mode. The adapter must be in dump mode, i.e. PacketSetMode() should have been - called previously with mode = PACKET_MODE_DUMP. otherwise this function will fail. - If PacketSetDumpName was already invoked on the adapter pointed by AdapterObject, the driver - closes the old file and opens the new one. -*/ - -BOOLEAN PacketSetDumpName(LPADAPTER AdapterObject, void *name, int len) -{ - DWORD BytesReturned; - WCHAR *FileName; - BOOLEAN res; - WCHAR NameWithPath[1024]; - int TStrLen; - WCHAR *NamePos; - -#ifndef _WINNT4 - if (AdapterObject->Flags != INFO_FLAG_NDIS_ADAPTER) - { - ODS("PacketSetDumpName: not allowed on wan adapters\n"); - return FALSE; - } -#endif // _WINNT4 - - if(((PUCHAR)name)[1]!=0 && len>1){ //ASCII - FileName=SChar2WChar(name); - len*=2; - } - else { //Unicode - FileName=name; - } - - TStrLen=GetFullPathName(FileName,1024,NameWithPath,&NamePos); - - len=TStrLen*2+2; //add the terminating null character - - // Try to catch malformed strings - if(len>2048){ - if(((PUCHAR)name)[1]!=0 && len>1) free(FileName); - return FALSE; - } - - res = DeviceIoControl(AdapterObject->hFile,pBIOCSETDUMPFILENAME,NameWithPath,len,NULL,0,&BytesReturned,NULL); - free(FileName); - return res; -} - -/*! - \brief Set the dump mode limits. - \param AdapterObject Pointer to an _ADAPTER structure. - \param maxfilesize The maximum dimension of the dump file, in bytes. 0 means no limit. - \param maxnpacks The maximum number of packets contained in the dump file. 0 means no limit. - \return If the function succeeds, the return value is nonzero. - - This function sets the limits after which the NPF driver stops to save the packets to file when an adapter - is in dump mode. This allows to limit the dump file to a precise number of bytes or packets, avoiding that - very long dumps fill the disk space. If both maxfilesize and maxnpacks are set, the dump is stopped when - the first of the two is reached. - - \note When a limit is reached, the dump is stopped, but the file remains opened. In order to flush - correctly the data and access the file consistently, you need to close the adapter with PacketCloseAdapter(). -*/ -BOOLEAN PacketSetDumpLimits(LPADAPTER AdapterObject, UINT maxfilesize, UINT maxnpacks) -{ - DWORD BytesReturned; - UINT valbuff[2]; - -#ifndef _WINNT4 - if (AdapterObject->Flags != INFO_FLAG_NDIS_ADAPTER) - { - ODS("PacketSetDumpLimits: not allowed on wan adapters\n"); - return FALSE; - } -#endif // _WINNT4 - - valbuff[0] = maxfilesize; - valbuff[1] = maxnpacks; - - return DeviceIoControl(AdapterObject->hFile, - pBIOCSETDUMPLIMITS, - valbuff, - sizeof valbuff, - NULL, - 0, - &BytesReturned, - NULL); -} - -/*! - \brief Returns the status of the kernel dump process, i.e. tells if one of the limits defined with PacketSetDumpLimits() was reached. - \param AdapterObject Pointer to an _ADAPTER structure. - \param sync if TRUE, the function blocks until the dump is finished, otherwise it returns immediately. - \return TRUE if the dump is ended, FALSE otherwise. - - PacketIsDumpEnded() informs the user about the limits that were set with a previous call to - PacketSetDumpLimits(). - - \warning If no calls to PacketSetDumpLimits() were performed or if the dump process has no limits - (i.e. if the arguments of the last call to PacketSetDumpLimits() were both 0), setting sync to TRUE will - block the application on this call forever. -*/ -BOOLEAN PacketIsDumpEnded(LPADAPTER AdapterObject, BOOLEAN sync) -{ - DWORD BytesReturned; - int IsDumpEnded; - BOOLEAN res; - -#ifndef _WINNT4 - if(AdapterObject->Flags != INFO_FLAG_NDIS_ADAPTER) - { - ODS("PacketIsDumpEnded: not allowed on wan adapters\n"); - return FALSE; - } -#endif // _WINNT4 - - if(sync) - WaitForSingleObject(AdapterObject->ReadEvent, INFINITE); - - res = DeviceIoControl(AdapterObject->hFile, - pBIOCISDUMPENDED, - NULL, - 0, - &IsDumpEnded, - 4, - &BytesReturned, - NULL); - - if(res == FALSE) return TRUE; // If the IOCTL returns an error we consider the dump finished - - return (BOOLEAN)IsDumpEnded; -} - -/*! - \brief Returns the notification event associated with the read calls on an adapter. - \param AdapterObject Pointer to an _ADAPTER structure. - \return The handle of the event that the driver signals when some data is available in the kernel buffer. - - The event returned by this function is signaled by the driver if: - - The adapter pointed by AdapterObject is in capture mode and an amount of data greater or equal - than the one set with the PacketSetMinToCopy() function is received from the network. - - the adapter pointed by AdapterObject is in capture mode, no data has been received from the network - but the the timeout set with the PacketSetReadTimeout() function has elapsed. - - the adapter pointed by AdapterObject is in statics mode and the the timeout set with the - PacketSetReadTimeout() function has elapsed. This means that a new statistic sample is available. - - In every case, a call to PacketReceivePacket() will return immediately. - The event can be passed to standard Win32 functions (like WaitForSingleObject or WaitForMultipleObjects) - to wait until the driver's buffer contains some data. It is particularly useful in GUI applications that - need to wait concurrently on several events. - -*/ -HANDLE PacketGetReadEvent(LPADAPTER AdapterObject) -{ - return AdapterObject->ReadEvent; -} - -/*! - \brief Sets the number of times a single packet written with PacketSendPacket() will be repeated on the network. - \param AdapterObject Pointer to an _ADAPTER structure. - \param nwrites Number of copies of a packet that will be physically sent by the interface. - \return If the function succeeds, the return value is nonzero. - - See PacketSendPacket() for details. -*/ -BOOLEAN PacketSetNumWrites(LPADAPTER AdapterObject,int nwrites) -{ - DWORD BytesReturned; - -#ifndef _WINNT4 - if(AdapterObject->Flags != INFO_FLAG_NDIS_ADAPTER) - { - ODS("PacketSetNumWrites: not allowed on wan adapters\n"); - return FALSE; - } -#endif // _WINNT4 - - return DeviceIoControl(AdapterObject->hFile,pBIOCSWRITEREP,&nwrites,4,NULL,0,&BytesReturned,NULL); -} - -/*! - \brief Sets the timeout after which a read on an adapter returns. - \param AdapterObject Pointer to an _ADAPTER structure. - \param timeout indicates the timeout, in milliseconds, after which a call to PacketReceivePacket() on - the adapter pointed by AdapterObject will be released, also if no packets have been captured by the driver. - Setting timeout to 0 means no timeout, i.e. PacketReceivePacket() never returns if no packet arrives. - A timeout of -1 causes PacketReceivePacket() to always return immediately. - \return If the function succeeds, the return value is nonzero. - - \note This function works also if the adapter is working in statistics mode, and can be used to set the - time interval between two statistic reports. -*/ -BOOLEAN PacketSetReadTimeout(LPADAPTER AdapterObject,int timeout) -{ - DWORD BytesReturned; - int DriverTimeOut=-1; - -#ifndef _WINNT4 - if (AdapterObject->pWanAdapter != NULL) - return WanPacketSetReadTimeout(AdapterObject->pWanAdapter,timeout); -#endif // _WINNT4 - - AdapterObject->ReadTimeOut=timeout; - -#ifdef HAVE_DAG_API - // Under DAG, we simply store the timeout value and then - if(AdapterObject->Flags & INFO_FLAG_DAG_CARD) - { - if(timeout == 1) - { - // tell DAG card to return immediately - AdapterObject->DagReadTimeout.tv_sec = 0; - AdapterObject->DagReadTimeout.tv_usec = 0; - } - else - if(timeout == 1) - { - // tell the DAG card to wait forever - AdapterObject->DagReadTimeout.tv_sec = -1; - AdapterObject->DagReadTimeout.tv_usec = -1; - } - else - { - // Set the timeout for the DAG card - AdapterObject->DagReadTimeout.tv_sec = timeout / 1000; - AdapterObject->DagReadTimeout.tv_usec = (timeout * 1000) % 1000000; - } - - return TRUE; - } -#endif // HAVE_DAG_API - - return DeviceIoControl(AdapterObject->hFile,pBIOCSRTIMEOUT,&DriverTimeOut,4,NULL,0,&BytesReturned,NULL); -} - -/*! - \brief Sets the size of the kernel-level buffer associated with a capture. - \param AdapterObject Pointer to an _ADAPTER structure. - \param dim New size of the buffer, in \b kilobytes. - \return The function returns TRUE if successfully completed, FALSE if there is not enough memory to - allocate the new buffer. - - When a new dimension is set, the data in the old buffer is discarded and the packets stored in it are - lost. - - Note: the dimension of the kernel buffer affects heavily the performances of the capture process. - An adequate buffer in the driver is able to keep the packets while the application is busy, compensating - the delays of the application and avoiding the loss of packets during bursts or high network activity. - The buffer size is set to 0 when an instance of the driver is opened: the programmer should remember to - set it to a proper value. As an example, wpcap sets the buffer size to 1MB at the beginning of a capture. -*/ -BOOLEAN PacketSetBuff(LPADAPTER AdapterObject,int dim) -{ - DWORD BytesReturned; - -#ifndef _WINNT4 - if (AdapterObject->pWanAdapter != NULL) - return WanPacketSetBufferSize(AdapterObject->pWanAdapter, dim); -#ifdef HAVE_DAG_API - else - if(AdapterObject->Flags & INFO_FLAG_DAG_CARD) - // We can't change DAG buffers - return TRUE; -#endif // HAVE_DAG_API - -#endif // _WINNT4 - return DeviceIoControl(AdapterObject->hFile,pBIOCSETBUFFERSIZE,&dim,4,NULL,0,&BytesReturned,NULL); -} - -/*! - \brief Sets a kernel-level packet filter. - \param AdapterObject Pointer to an _ADAPTER structure. - \param fp Pointer to a filtering program that will be associated with this capture or monitoring - instance and that will be executed on every incoming packet. - \return This function returns TRUE if the filter is set successfully, FALSE if an error occurs - or if the filter program is not accepted after a safeness check by the driver. The driver performs - the check in order to avoid system crashes due to buggy or malicious filters, and it rejects non - conformant filters. - - This function associates a new BPF filter to the adapter AdapterObject. The filter, pointed by fp, is a - set of bpf_insn instructions. - - A filter can be automatically created by using the pcap_compile() function of wpcap. This function - converts a human readable text expression with the syntax of WinDump (see the manual of WinDump at - http://netgroup.polito.it/windump for details) into a BPF program. If your program doesn't link wpcap, but - you need to know the code of a particular filter, you can launch WinDump with the -d or -dd or -ddd - flags to obtain the pseudocode. - -*/ -BOOLEAN PacketSetBpf(LPADAPTER AdapterObject, struct bpf_program *fp) -{ - DWORD BytesReturned; - -#ifndef _WINNT4 - if (AdapterObject->pWanAdapter != NULL) - return WanPacketSetBpfFilter(AdapterObject->pWanAdapter, (PUCHAR)fp->bf_insns, fp->bf_len * sizeof(struct bpf_insn)); -#ifdef HAVE_DAG_API - else - if(AdapterObject->Flags & INFO_FLAG_DAG_CARD) - // Delegate the filtering to higher layers since it's too expensive here - return TRUE; -#endif // HAVE_DAG_API -#endif // _WINNT4 - - return DeviceIoControl(AdapterObject->hFile,pBIOCSETF,(char*)fp->bf_insns,fp->bf_len*sizeof(struct bpf_insn),NULL,0,&BytesReturned,NULL); -} - -/*! - \brief Sets the snap len on the adapters that allow it. - \param AdapterObject Pointer to an _ADAPTER structure. - \param snaplen Desired snap len for this capture. - \return If the function succeeds, the return value is nonzero and specifies the actual snaplen that - the card is using. If the function fails or if the card doesn't allow to set sna length, the return - value is 0. - - The snap len is the amount of packet that is actually captured by the interface and received by the - application. Some interfaces allow to capture only a portion of any packet for performance reasons. - - \note: the return value can be different from the snaplen parameter, for example some boards round the - snaplen to 4 bytes. -*/ -INT PacketSetSnapLen(LPADAPTER AdapterObject, int snaplen) -{ - -#ifdef HAVE_DAG_API - if(AdapterObject->Flags & INFO_FLAG_DAG_CARD) - return p_dagc_setsnaplen(AdapterObject->pDagCard, snaplen); - else -#endif // HAVE_DAG_API - return 0; -} - -/*! - \brief Returns a couple of statistic values about the current capture session. - \param AdapterObject Pointer to an _ADAPTER structure. - \param s Pointer to a user provided bpf_stat structure that will be filled by the function. - \return If the function succeeds, the return value is nonzero. - - With this function, the programmer can know the value of two internal variables of the driver: - - - the number of packets that have been received by the adapter AdapterObject, starting at the - time in which it was opened with PacketOpenAdapter. - - the number of packets that have been dropped by the driver. A packet is dropped when the kernel - buffer associated with the adapter is full. -*/ -BOOLEAN PacketGetStats(LPADAPTER AdapterObject,struct bpf_stat *s) -{ - BOOLEAN Res; - DWORD BytesReturned; - struct bpf_stat tmpstat; // We use a support structure to avoid kernel-level inconsistencies with old or malicious applications - -#ifndef _WINNT4 -#ifdef HAVE_DAG_API - if(AdapterObject->Flags & INFO_FLAG_DAG_CARD) - { - dagc_stats_t DagStats; - - // Note: DAG cards are currently very limited from the statistics reporting point of view, - // so most of the values returned by dagc_stats() are zero at the moment - if(p_dagc_stats(AdapterObject->pDagCard, &DagStats) == 0) - { - // XXX: Only copy the dropped packets for now, since the received counter is not supported by - // DAGS at the moment - - s->bs_recv = (ULONG)DagStats.received; - s->bs_drop = (ULONG)DagStats.dropped; - return TRUE; - } - else - return FALSE; - } - else -#endif // HAVE_DAG_API - if ( AdapterObject->pWanAdapter != NULL) - Res = WanPacketGetStats(AdapterObject->pWanAdapter, (PVOID)&tmpstat); - else -#endif // _WINNT4 - - Res = DeviceIoControl(AdapterObject->hFile, - pBIOCGSTATS, - NULL, - 0, - &tmpstat, - sizeof(struct bpf_stat), - &BytesReturned, - NULL); - - - // Copy only the first two values retrieved from the driver - s->bs_recv = tmpstat.bs_recv; - s->bs_drop = tmpstat.bs_drop; - - return Res; -} - -/*! - \brief Returns statistic values about the current capture session. Enhanced version of PacketGetStats(). - \param AdapterObject Pointer to an _ADAPTER structure. - \param s Pointer to a user provided bpf_stat structure that will be filled by the function. - \return If the function succeeds, the return value is nonzero. - - With this function, the programmer can retrieve the sname values provided by PacketGetStats(), plus: - - - the number of drops by interface (not yet supported, always 0). - - the number of packets that reached the application, i.e that were accepted by the kernel filter and - that fitted in the kernel buffer. -*/ -BOOLEAN PacketGetStatsEx(LPADAPTER AdapterObject,struct bpf_stat *s) -{ - BOOLEAN Res; - DWORD BytesReturned; - struct bpf_stat tmpstat; // We use a support structure to avoid kernel-level inconsistencies with old or malicious applications - -#ifndef _WINNT4 -#ifdef HAVE_DAG_API - if(AdapterObject->Flags & INFO_FLAG_DAG_CARD) - { - dagc_stats_t DagStats; - - // Note: DAG cards are currently very limited from the statistics reporting point of view, - // so most of the values returned by dagc_stats() are zero at the moment - p_dagc_stats(AdapterObject->pDagCard, &DagStats); - s->bs_recv = (ULONG)DagStats.received; - s->bs_drop = (ULONG)DagStats.dropped; - s->ps_ifdrop = 0; - s->bs_capt = (ULONG)DagStats.captured; - } -#endif // HAVE_DAG_API - if(AdapterObject->pWanAdapter != NULL) - Res = WanPacketGetStats(AdapterObject->pWanAdapter, (PVOID)&tmpstat); - else -#endif // _WINNT4 - - Res = DeviceIoControl(AdapterObject->hFile, - pBIOCGSTATS, - NULL, - 0, - &tmpstat, - sizeof(struct bpf_stat), - &BytesReturned, - NULL); - - s->bs_recv = tmpstat.bs_recv; - s->bs_drop = tmpstat.bs_drop; - s->ps_ifdrop = tmpstat.ps_ifdrop; - s->bs_capt = tmpstat.bs_capt; - - return Res; -} - -/*! - \brief Performs a query/set operation on an internal variable of the network card driver. - \param AdapterObject Pointer to an _ADAPTER structure. - \param Set Determines if the operation is a set (Set=TRUE) or a query (Set=FALSE). - \param OidData A pointer to a _PACKET_OID_DATA structure that contains or receives the data. - \return If the function succeeds, the return value is nonzero. - - \note not all the network adapters implement all the query/set functions. There is a set of mandatory - OID functions that is granted to be present on all the adapters, and a set of facultative functions, not - provided by all the cards (see the Microsoft DDKs to see which functions are mandatory). If you use a - facultative function, be careful to enclose it in an if statement to check the result. -*/ -BOOLEAN PacketRequest(LPADAPTER AdapterObject,BOOLEAN Set,PPACKET_OID_DATA OidData) -{ - DWORD BytesReturned; - BOOLEAN Result; - -#ifndef _WINNT4 - if(AdapterObject->Flags != INFO_FLAG_NDIS_ADAPTER) - return FALSE; -#endif // _WINNT4 - - Result=DeviceIoControl(AdapterObject->hFile,(DWORD) Set ? (DWORD)pBIOCSETOID : (DWORD)pBIOCQUERYOID, - OidData,sizeof(PACKET_OID_DATA)-1+OidData->Length,OidData, - sizeof(PACKET_OID_DATA)-1+OidData->Length,&BytesReturned,NULL); - - // output some debug info - ODSEx("PacketRequest, OID=%d ", OidData->Oid); - ODSEx("Length=%d ", OidData->Length); - ODSEx("Set=%d ", Set); - ODSEx("Res=%d\n", Result); - - return Result; -} - -/*! - \brief Sets a hardware filter on the incoming packets. - \param AdapterObject Pointer to an _ADAPTER structure. - \param Filter The identifier of the filter. - \return If the function succeeds, the return value is nonzero. - - The filter defined with this filter is evaluated by the network card, at a level that is under the NPF - device driver. Here is a list of the most useful hardware filters (A complete list can be found in ntddndis.h): - - - NDIS_PACKET_TYPE_PROMISCUOUS: sets promiscuous mode. Every incoming packet is accepted by the adapter. - - NDIS_PACKET_TYPE_DIRECTED: only packets directed to the workstation's adapter are accepted. - - NDIS_PACKET_TYPE_BROADCAST: only broadcast packets are accepted. - - NDIS_PACKET_TYPE_MULTICAST: only multicast packets belonging to groups of which this adapter is a member are accepted. - - NDIS_PACKET_TYPE_ALL_MULTICAST: every multicast packet is accepted. - - NDIS_PACKET_TYPE_ALL_LOCAL: all local packets, i.e. NDIS_PACKET_TYPE_DIRECTED + NDIS_PACKET_TYPE_BROADCAST + NDIS_PACKET_TYPE_MULTICAST -*/ -BOOLEAN PacketSetHwFilter(LPADAPTER AdapterObject,ULONG Filter) -{ - BOOLEAN Status; - ULONG IoCtlBufferLength=(sizeof(PACKET_OID_DATA)+sizeof(ULONG)-1); - PPACKET_OID_DATA OidData; - -#ifndef _WINNT4 - if(AdapterObject->Flags != INFO_FLAG_NDIS_ADAPTER) - return TRUE; -#endif // _WINNT4 - - OidData=GlobalAllocPtr(GMEM_MOVEABLE | GMEM_ZEROINIT,IoCtlBufferLength); - if (OidData == NULL) { - ODS("PacketSetHwFilter: GlobalAlloc Failed\n"); - return FALSE; - } - OidData->Oid=OID_GEN_CURRENT_PACKET_FILTER; - OidData->Length=sizeof(ULONG); - *((PULONG)OidData->Data)=Filter; - Status=PacketRequest(AdapterObject,TRUE,OidData); - GlobalFreePtr(OidData); - return Status; -} - -/*! - \brief Retrieve the list of available network adapters and their description. - \param pStr User allocated string that will be filled with the names of the adapters. - \param BufferSize Length of the buffer pointed by pStr. If the function fails, this variable contains the - number of bytes that are needed to contain the adapter list. - \return If the function succeeds, the return value is nonzero. If the return value is zero, BufferSize contains - the number of bytes that are needed to contain the adapter list. - - Usually, this is the first function that should be used to communicate with the driver. - It returns the names of the adapters installed on the system and supported by WinPcap. - After the names of the adapters, pStr contains a string that describes each of them. - - After a call to PacketGetAdapterNames pStr contains, in succession: - - a variable number of ASCII strings, each with the names of an adapter, separated by a "\0" - - a double "\0" - - a number of ASCII strings, each with the description of an adapter, separated by a "\0". The number - of descriptions is the same of the one of names. The first description corresponds to the first name, and - so on. - - a double "\0". -*/ - -BOOLEAN PacketGetAdapterNames(PTSTR pStr,PULONG BufferSize) -{ - PADAPTER_INFO TAdInfo; - ULONG SizeNeeded = 1; - ULONG SizeNames = 1; - ULONG SizeDesc; - ULONG OffDescriptions; - - ODSEx("PacketGetAdapterNames: BufferSize=%d\n", *BufferSize); - - // - // Create the adapter information list - // - PacketPopulateAdaptersInfoList(); - - WaitForSingleObject(AdaptersInfoMutex, INFINITE); - if(!AdaptersInfoList) - { - ReleaseMutex(AdaptersInfoMutex); - *BufferSize = 0; - return FALSE; // No adapters to return - } - - // - // First scan of the list to calculate the offsets and check the sizes - // - for(TAdInfo = AdaptersInfoList; TAdInfo != NULL; TAdInfo = TAdInfo->Next) - { - if(TAdInfo->Flags != INFO_FLAG_DONT_EXPORT) - { - // Update the size variables - SizeNeeded += (int)strlen(TAdInfo->Name) + (int)strlen(TAdInfo->Description) + 2; - SizeNames += (int)strlen(TAdInfo->Name) + 1; - } - } - - // Check that we don't overflow the buffer. - // Note: 2 is the number of additional separators needed inside the list - if(SizeNeeded + 2 >= *BufferSize || pStr == NULL) - { - ReleaseMutex(AdaptersInfoMutex); - - ODS("PacketGetAdapterNames: input buffer too small\n"); - *BufferSize = SizeNeeded + 4; // Report the required size - return FALSE; - } - - OffDescriptions = SizeNames; - - // - // Second scan of the list to copy the information - // - for(TAdInfo = AdaptersInfoList, SizeNames = 0, SizeDesc = 0; TAdInfo != NULL; TAdInfo = TAdInfo->Next) - { - if(TAdInfo->Flags != INFO_FLAG_DONT_EXPORT) - { - // Copy the data - strcpy(((PCHAR)pStr) + SizeNames, TAdInfo->Name); - strcpy(((PCHAR)pStr) + OffDescriptions + SizeDesc, TAdInfo->Description); - - // Update the size variables - SizeNames += (int)strlen(TAdInfo->Name) + 1; - SizeDesc += (int)strlen(TAdInfo->Description) + 1; - } - } - - // Separate the two lists - ((PCHAR)pStr)[SizeNames] = 0; - - // End the list with a further \0 - ((PCHAR)pStr)[SizeNeeded] = 0; - - - ReleaseMutex(AdaptersInfoMutex); - return TRUE; -} - -/*! - \brief Returns comprehensive information the addresses of an adapter. - \param AdapterName String that contains the name of the adapter. - \param buffer A user allocated array of npf_if_addr that will be filled by the function. - \param NEntries Size of the array (in npf_if_addr). - \return If the function succeeds, the return value is nonzero. - - This function grabs from the registry information like the IP addresses, the netmasks - and the broadcast addresses of an interface. The buffer passed by the user is filled with - npf_if_addr structures, each of which contains the data for a single address. If the buffer - is full, the reaming addresses are dropped, therefore set its dimension to sizeof(npf_if_addr) - if you want only the first address. -*/ -BOOLEAN PacketGetNetInfoEx(PCHAR AdapterName, npf_if_addr* buffer, PLONG NEntries) -{ - PADAPTER_INFO TAdInfo; - PCHAR Tname; - BOOLEAN Res, FreeBuff; - - ODS("PacketGetNetInfo\n"); - - // Provide conversion for backward compatibility - if(AdapterName[1] != 0) - { //ASCII - Tname = AdapterName; - FreeBuff = FALSE; - } - else - { - Tname = WChar2SChar((PWCHAR)AdapterName); - FreeBuff = TRUE; - } - - // - // Update the information about this adapter - // - if(!PacketUpdateAdInfo(Tname)) - { - ODS("PacketGetNetInfo: Adapter not found\n"); - if(FreeBuff)GlobalFreePtr(Tname); - return FALSE; - } - - WaitForSingleObject(AdaptersInfoMutex, INFINITE); - // Find the PADAPTER_INFO structure associated with this adapter - TAdInfo = PacketFindAdInfo(Tname); - - if(TAdInfo != NULL) - { - *NEntries = (TAdInfo->NNetworkAddresses < *NEntries)? TAdInfo->NNetworkAddresses: *NEntries; - //TODO what if nentries = 0? - if (*NEntries > 0) - memcpy(buffer, TAdInfo->NetworkAddresses, *NEntries * sizeof(npf_if_addr)); - Res = TRUE; - } - else - { - ODS("PacketGetNetInfo: Adapter not found\n"); - Res = FALSE; - } - - ReleaseMutex(AdaptersInfoMutex); - - if(FreeBuff)GlobalFreePtr(Tname); - - return Res; -} - -/*! - \brief Returns information about the MAC type of an adapter. - \param AdapterObject The adapter on which information is needed. - \param type Pointer to a NetType structure that will be filled by the function. - \return If the function succeeds, the return value is nonzero, otherwise the return value is zero. - - This function return the link layer and the speed (in bps) of an opened adapter. - The LinkType field of the type parameter can have one of the following values: - - - NdisMedium802_3: Ethernet (802.3) - - NdisMediumWan: WAN - - NdisMedium802_5: Token Ring (802.5) - - NdisMediumFddi: FDDI - - NdisMediumAtm: ATM - - NdisMediumArcnet878_2: ARCNET (878.2) -*/ -BOOLEAN PacketGetNetType(LPADAPTER AdapterObject, NetType *type) -{ - PADAPTER_INFO TAdInfo; - BOOLEAN ret; - ODS("PacketGetNetType\n"); - - WaitForSingleObject(AdaptersInfoMutex, INFINITE); - // Find the PADAPTER_INFO structure associated with this adapter - TAdInfo = PacketFindAdInfo(AdapterObject->Name); - - if(TAdInfo != NULL) - { - // Copy the data - memcpy(type, &(TAdInfo->LinkLayer), sizeof(struct NetType)); - ret = TRUE; - } - else - { - ODS("PacketGetNetType: Adapter not found\n"); - ret = FALSE; - } - - ReleaseMutex(AdaptersInfoMutex); - - return ret; -} - -/* @} */ -BOOLEAN PacketSetLoopbackBehavior(LPADAPTER AdapterObject, UINT LoopbackBehavior) -{ - DWORD BytesReturned; - BOOLEAN result; - - if (AdapterObject->Flags != INFO_FLAG_NDIS_ADAPTER) - { - return FALSE; - } - - - result = (BOOLEAN)DeviceIoControl(AdapterObject->hFile, - pBIOCISETLOBBEH, - &LoopbackBehavior, - sizeof(UINT), - NULL, - 0, - &BytesReturned, - NULL); - - return result; -} - +/* + * Copyright (c) 1999 - 2003 + * Politecnico di Torino. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that: (1) source code distributions + * retain the above copyright notice and this paragraph in its entirety, (2) + * distributions including binary code include the above copyright notice and + * this paragraph in its entirety in the documentation or other materials + * provided with the distribution, and (3) all advertising materials mentioning + * features or use of this software display the following acknowledgement: + * ``This product includes software developed by the Politecnico + * di Torino, and its contributors.'' Neither the name of + * the University nor the names of its contributors may be used to endorse + * or promote products derived from this software without specific prior + * written permission. + * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + */ + +#include + +#define UNICODE 1 + +#include +#include + +#if 0 +#include "WanPacket/WanPacket.h" +#endif + +#define _WINNT4 + + +#include +#include +#include +#include + +#include + + +/// Current packet.dll Version. It can be retrieved directly or through the PacketGetVersion() function. +char PacketLibraryVersion[64]; +/// Current NPF.sys Version. It can be retrieved directly or through the PacketGetVersion() function. +char PacketDriverVersion[64]; + +LPCTSTR NPFServiceName = TEXT("SEE"); +LPCTSTR NPFServiceDesc = TEXT("SoftEther Ethernet Layer Driver"); +LPCTSTR NPFRegistryLocation = TEXT("SYSTEM\\CurrentControlSet\\Services\\SEE"); +LPCTSTR NPFDriverPath = TEXT("system32\\drivers\\see.sys"); + +extern PADAPTER_INFO AdaptersInfoList; +extern HANDLE AdaptersInfoMutex; +#ifndef _WINNT4 +typedef VOID (*GAAHandler)( + ULONG, + DWORD, + PVOID, + PIP_ADAPTER_ADDRESSES, + PULONG); +GAAHandler GetAdaptersAddressesPointer = NULL; +#endif // _WINNT4 + +#ifdef HAVE_DAG_API +/* We load dynamically the dag library in order link it only when it's present on the system */ +dagc_open_handler p_dagc_open = NULL; +dagc_close_handler p_dagc_close = NULL; +dagc_getlinktype_handler p_dagc_getlinktype = NULL; +dagc_getlinkspeed_handler p_dagc_getlinkspeed = NULL; +dagc_getfcslen_handler p_dagc_getfcslen = NULL; +dagc_receive_handler p_dagc_receive = NULL; +dagc_wait_handler p_dagc_wait = NULL; +dagc_stats_handler p_dagc_stats = NULL; +dagc_setsnaplen_handler p_dagc_setsnaplen = NULL; +dagc_finddevs_handler p_dagc_finddevs = NULL; +dagc_freedevs_handler p_dagc_freedevs = NULL; +#endif /* HAVE_DAG_API */ + +BOOLEAN PacketAddAdapterDag(PCHAR name, PCHAR description, BOOLEAN IsAFile); + +//--------------------------------------------------------------------------- + +/*! + \brief The main dll function. +*/ + +BOOL APIENTRY DllMain (HANDLE DllHandle,DWORD Reason,LPVOID lpReserved) +{ + BOOLEAN Status=TRUE; + HMODULE IPHMod; + PADAPTER_INFO NewAdInfo; +#ifdef HAVE_DAG_API + HMODULE DagcLib; +#endif // HAVE_DAG_API + + switch(Reason) + { + case DLL_PROCESS_ATTACH: + + ODS("************Packet32: DllMain************\n"); + +#ifdef _DEBUG_TO_FILE + // dump a bunch of registry keys useful for debug to file + PacketDumpRegistryKey("HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Control\\Class\\{4D36E972-E325-11CE-BFC1-08002BE10318}", + "adapters.reg"); + PacketDumpRegistryKey("HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Services\\Tcpip", + "tcpip.reg"); + PacketDumpRegistryKey("HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Services\\SEE", + "npf.reg"); + PacketDumpRegistryKey("HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Services", + "services.reg"); +#endif + + // Create the mutex that will protect the adapter information list + AdaptersInfoMutex = CreateMutex(NULL, FALSE, NULL); + + // + // Retrieve packet.dll version information from the file + // + PacketGetFileVersion(TEXT("see.dll"), PacketLibraryVersion, sizeof(PacketLibraryVersion)); + + // + // Retrieve NPF.sys version information from the file + // + PacketGetFileVersion(TEXT("drivers\\see.sys"), PacketDriverVersion, sizeof(PacketDriverVersion)); + + // + // Locate GetAdaptersAddresses dynamically since it is not present in Win2k + // + IPHMod = GetModuleHandle(TEXT("Iphlpapi")); + +#ifndef _WINNT4 + GetAdaptersAddressesPointer = (GAAHandler) GetProcAddress(IPHMod ,"GetAdaptersAddresses"); +#endif // _WINNT4 + +#ifdef HAVE_DAG_API + /* We load dynamically the dag library in order link it only when it's present on the system */ + if((DagcLib = LoadLibrary(TEXT("dagc.dll"))) == NULL) + { + // Report the error but go on + ODS("dag capture library not found on this system\n"); + break; + } + + p_dagc_open = (dagc_open_handler) GetProcAddress(DagcLib, "dagc_open"); + p_dagc_close = (dagc_close_handler) GetProcAddress(DagcLib, "dagc_close"); + p_dagc_setsnaplen = (dagc_setsnaplen_handler) GetProcAddress(DagcLib, "dagc_setsnaplen"); + p_dagc_getlinktype = (dagc_getlinktype_handler) GetProcAddress(DagcLib, "dagc_getlinktype"); + p_dagc_getlinkspeed = (dagc_getlinkspeed_handler) GetProcAddress(DagcLib, "dagc_getlinkspeed"); + p_dagc_getfcslen = (dagc_getfcslen_handler) GetProcAddress(DagcLib, "dagc_getfcslen"); + p_dagc_receive = (dagc_receive_handler) GetProcAddress(DagcLib, "dagc_receive"); + p_dagc_wait = (dagc_wait_handler) GetProcAddress(DagcLib, "dagc_wait"); + p_dagc_stats = (dagc_stats_handler) GetProcAddress(DagcLib, "dagc_stats"); + p_dagc_finddevs = (dagc_finddevs_handler) GetProcAddress(DagcLib, "dagc_finddevs"); + p_dagc_freedevs = (dagc_freedevs_handler) GetProcAddress(DagcLib, "dagc_freedevs"); + +#endif /* HAVE_DAG_API */ + + break; + + case DLL_PROCESS_DETACH: + + CloseHandle(AdaptersInfoMutex); + + AdaptersInfoList; + + while(AdaptersInfoList != NULL) + { + + NewAdInfo = AdaptersInfoList->Next; + if (AdaptersInfoList->NetworkAddresses != NULL) + GlobalFreePtr(AdaptersInfoList->NetworkAddresses); + GlobalFreePtr(AdaptersInfoList); + + AdaptersInfoList = NewAdInfo; + } + + + break; + + default: + break; + } + + return Status; +} + +/*! + \brief Convert a Unicode dotted-quad to a 32-bit IP address. + \param cp A string containing the address. + \return the converted 32-bit numeric address. + + Doesn't check to make sure the address is valid. +*/ + +ULONG inet_addrU(const WCHAR *cp) +{ + ULONG val, part; + WCHAR c; + int i; + + val = 0; + for (i = 0; i < 4; i++) { + part = 0; + while ((c = *cp++) != '\0' && c != '.') { + if (c < '0' || c > '9') + return -1; + part = part*10 + (c - '0'); + } + if (part > 255) + return -1; + val = val | (part << i*8); + if (i == 3) { + if (c != '\0') + return -1; // extra gunk at end of string + } else { + if (c == '\0') + return -1; // string ends early + } + } + return val; +} + +/*! + \brief Converts an ASCII string to UNICODE. Uses the MultiByteToWideChar() system function. + \param string The string to convert. + \return The converted string. +*/ + +PWCHAR SChar2WChar(PCHAR string) +{ + PWCHAR TmpStr; + TmpStr = (WCHAR*) GlobalAllocPtr(GMEM_MOVEABLE | GMEM_ZEROINIT, (strlen(string)+2)*sizeof(WCHAR)); + + MultiByteToWideChar(CP_ACP, 0, string, -1, TmpStr, ((int)strlen(string)+2)); + + return TmpStr; +} + +/*! + \brief Converts an UNICODE string to ASCII. Uses the WideCharToMultiByte() system function. + \param string The string to convert. + \return The converted string. +*/ + +PCHAR WChar2SChar(PWCHAR string) +{ + PCHAR TmpStr; + TmpStr = (CHAR*) GlobalAllocPtr(GMEM_MOVEABLE | GMEM_ZEROINIT, (wcslen(string)+2)); + + // Convert to ASCII + WideCharToMultiByte( + CP_ACP, + 0, + string, + -1, + TmpStr, + ((int)wcslen(string)+2), // size of buffer + NULL, + NULL); + + return TmpStr; +} + +/*! + \brief Sets the maximum possible lookahead buffer for the driver's Packet_tap() function. + \param AdapterObject Handle to the service control manager. + \return If the function succeeds, the return value is nonzero. + + The lookahead buffer is the portion of packet that Packet_tap() can access from the NIC driver's memory + without performing a copy. This function tries to increase the size of that buffer. +*/ + +BOOLEAN PacketSetMaxLookaheadsize (LPADAPTER AdapterObject) +{ + BOOLEAN Status; + ULONG IoCtlBufferLength=(sizeof(PACKET_OID_DATA)+sizeof(ULONG)-1); + PPACKET_OID_DATA OidData; + + OidData = GlobalAllocPtr(GMEM_MOVEABLE | GMEM_ZEROINIT,IoCtlBufferLength); + if (OidData == NULL) { + ODS("PacketSetMaxLookaheadsize failed\n"); + return FALSE; + } + + //set the size of the lookahead buffer to the maximum available by the the NIC driver + OidData->Oid=OID_GEN_MAXIMUM_LOOKAHEAD; + OidData->Length=sizeof(ULONG); + Status=PacketRequest(AdapterObject,FALSE,OidData); + OidData->Oid=OID_GEN_CURRENT_LOOKAHEAD; + Status=PacketRequest(AdapterObject,TRUE,OidData); + GlobalFreePtr(OidData); + return Status; +} + +/*! + \brief Retrieves the event associated in the driver with a capture instance and stores it in an + _ADAPTER structure. + \param AdapterObject Handle to the service control manager. + \return If the function succeeds, the return value is nonzero. + + This function is used by PacketOpenAdapter() to retrieve the read event from the driver by means of an ioctl + call and set it in the _ADAPTER structure pointed by AdapterObject. +*/ + +BOOLEAN PacketSetReadEvt(LPADAPTER AdapterObject) +{ + DWORD BytesReturned; + TCHAR EventName[39]; + + if (LOWORD(GetVersion()) == 4) + { + // retrieve the name of the shared event from the driver without the "Global\\" prefix + if(DeviceIoControl(AdapterObject->hFile,pBIOCEVNAME,NULL,0,EventName,13*sizeof(TCHAR),&BytesReturned,NULL)==FALSE) + return FALSE; + + EventName[BytesReturned/sizeof(TCHAR)]=0; // terminate the string + } + else + { + // this tells the terminal service to retrieve the event from the global namespace + wcsncpy(EventName,L"Global\\",sizeof(L"Global\\")); + // retrieve the name of the shared event from the driver with the "Global\\" prefix + if(DeviceIoControl(AdapterObject->hFile,pBIOCEVNAME,NULL,0,EventName + 7,13*sizeof(TCHAR),&BytesReturned,NULL)==FALSE) + return FALSE; + + EventName[BytesReturned/sizeof(TCHAR) + 7]=0; // terminate the string + } + + // open the shared event + AdapterObject->ReadEvent=CreateEvent(NULL, + TRUE, + FALSE, + EventName); + + if(AdapterObject->ReadEvent==NULL || GetLastError()!=ERROR_ALREADY_EXISTS){ + ODS("PacketSetReadEvt: error retrieving the event from the kernel\n"); + return FALSE; + } + + AdapterObject->ReadTimeOut=0; + + return TRUE; +} + +/*! + \brief Installs the NPF device driver. + \return If the function succeeds, the return value is nonzero. + + This function installs the driver's service in the system using the CreateService function. +*/ + +BOOL PacketInstallDriver() +{ + BOOL result = FALSE; + ULONG err = 0; + SC_HANDLE svcHandle; + SC_HANDLE scmHandle; + ODS("PacketInstallDriver\n"); + + scmHandle = OpenSCManager(NULL, NULL, SC_MANAGER_ALL_ACCESS); + + if(scmHandle == NULL) + return FALSE; + + svcHandle = CreateService(scmHandle, + NPFServiceName, + NPFServiceDesc, + SERVICE_ALL_ACCESS, + SERVICE_KERNEL_DRIVER, + SERVICE_DEMAND_START, + SERVICE_ERROR_NORMAL, + NPFDriverPath, + NULL, NULL, NULL, NULL, NULL); + if (svcHandle == NULL) + { + err = GetLastError(); + if (err == ERROR_SERVICE_EXISTS) + { + //npf.sys already existed + err = 0; + result = TRUE; + } + } + else + { + //Created service for npf.sys + result = TRUE; + } + + if (svcHandle != NULL) + CloseServiceHandle(svcHandle); + + if(result == FALSE) + { + ODSEx("PacketInstallDriver failed, Error=%d\n",err); + } + + CloseServiceHandle(scmHandle); + SetLastError(err); + return result; + +} + +/*! + \brief Dumps a registry key to disk in text format. Uses regedit. + \param KeyName Name of the ket to dump. All its subkeys will be saved recursively. + \param FileName Name of the file that will contain the dump. + \return If the function succeeds, the return value is nonzero. + + For debugging purposes, we use this function to obtain some registry keys from the user's machine. +*/ + +#ifdef _DEBUG_TO_FILE + +LONG PacketDumpRegistryKey(PCHAR KeyName, PCHAR FileName) +{ + CHAR Command[256]; + + strcpy(Command, "regedit /e "); + strcat(Command, FileName); + strcat(Command, " "); + strcat(Command, KeyName); + + /// Let regedit do the dirt work for us + system(Command); + + return TRUE; +} +#endif + +/*! + \brief Returns the version of a dll or exe file + \param FileName Name of the file whose version has to be retrieved. + \param VersionBuff Buffer that will contain the string with the file version. + \param VersionBuffLen Length of the buffer pointed by VersionBuff. + \return If the function succeeds, the return value is TRUE. + + \note uses the GetFileVersionInfoSize() and GetFileVersionInfo() WIN32 API functions +*/ +BOOL PacketGetFileVersion(LPTSTR FileName, PCHAR VersionBuff, UINT VersionBuffLen) +{ + DWORD dwVerInfoSize; // Size of version information block + DWORD dwVerHnd=0; // An 'ignored' parameter, always '0' + LPSTR lpstrVffInfo; + UINT cbTranslate, dwBytes; + TCHAR SubBlock[64]; + PVOID lpBuffer; + PCHAR TmpStr; + + // Structure used to store enumerated languages and code pages. + struct LANGANDCODEPAGE { + WORD wLanguage; + WORD wCodePage; + } *lpTranslate; + + ODS("PacketGetFileVersion\n"); + + // Now lets dive in and pull out the version information: + dwVerInfoSize = GetFileVersionInfoSize(FileName, &dwVerHnd); + if (dwVerInfoSize) + { + lpstrVffInfo = GlobalAllocPtr(GMEM_MOVEABLE, dwVerInfoSize); + if (lpstrVffInfo == NULL) + { + ODS("PacketGetFileVersion: failed to allocate memory\n"); + return FALSE; + } + + if(!GetFileVersionInfo(FileName, dwVerHnd, dwVerInfoSize, lpstrVffInfo)) + { + ODS("PacketGetFileVersion: failed to call GetFileVersionInfo\n"); + GlobalFreePtr(lpstrVffInfo); + return FALSE; + } + + // Read the list of languages and code pages. + if(!VerQueryValue(lpstrVffInfo, TEXT("\\VarFileInfo\\Translation"), (LPVOID*)&lpTranslate, &cbTranslate)) + { + ODS("PacketGetFileVersion: failed to call VerQueryValue\n"); + GlobalFreePtr(lpstrVffInfo); + return FALSE; + } + + // Create the file version string for the first (i.e. the only one) language. + wsprintf( SubBlock, + TEXT("\\StringFileInfo\\%04x%04x\\FileVersion"), + (*lpTranslate).wLanguage, + (*lpTranslate).wCodePage); + + // Retrieve the file version string for the language. + if(!VerQueryValue(lpstrVffInfo, SubBlock, &lpBuffer, &dwBytes)) + { + ODS("PacketGetFileVersion: failed to call VerQueryValue\n"); + GlobalFreePtr(lpstrVffInfo); + return FALSE; + } + + // Convert to ASCII + TmpStr = WChar2SChar(lpBuffer); + + if(strlen(TmpStr) >= VersionBuffLen) + { + ODS("PacketGetFileVersion: Input buffer too small\n"); + GlobalFreePtr(lpstrVffInfo); + GlobalFreePtr(TmpStr); + return FALSE; + } + + strcpy(VersionBuff, TmpStr); + + GlobalFreePtr(lpstrVffInfo); + GlobalFreePtr(TmpStr); + + } + else + { + ODSEx("PacketGetFileVersion: failed to call GetFileVersionInfoSize, LastError = %d\n", GetLastError()); + return FALSE; + + } + + return TRUE; +} + +/*! + \brief Opens an adapter using the NPF device driver. + \param AdapterName A string containing the name of the device to open. + \return If the function succeeds, the return value is the pointer to a properly initialized ADAPTER object, + otherwise the return value is NULL. + + \note internal function used by PacketOpenAdapter() and AddAdapter() +*/ +LPADAPTER PacketOpenAdapterNPF(PCHAR AdapterName) +{ + LPADAPTER lpAdapter; + BOOLEAN Result; + DWORD error; + SC_HANDLE svcHandle = NULL; + SC_HANDLE scmHandle = NULL; + LONG KeyRes; + HKEY PathKey; + SERVICE_STATUS SStat; + BOOLEAN QuerySStat; + WCHAR SymbolicLink[128]; + + ODS("PacketOpenAdapterNPF\n"); + + scmHandle = OpenSCManager(NULL, NULL, GENERIC_READ); + + if(scmHandle == NULL) + { + error = GetLastError(); + ODSEx("OpenSCManager failed! LastError=%d\n", error); + } + else + { + // check if the NPF registry key is already present + // this means that the driver is already installed and that we don't need to call PacketInstallDriver + KeyRes=RegOpenKeyEx(HKEY_LOCAL_MACHINE, + NPFRegistryLocation, + 0, + KEY_READ, + &PathKey); + + if(KeyRes != ERROR_SUCCESS) + { + Result = PacketInstallDriver(); + } + else + { + Result = TRUE; + RegCloseKey(PathKey); + } + + Result = FALSE; + svcHandle = OpenService(scmHandle, NPFServiceName, GENERIC_READ); + if (svcHandle != NULL) + { + Result = TRUE; + + CloseServiceHandle(svcHandle); + } + + if (Result) + { + + svcHandle = OpenService(scmHandle, NPFServiceName, SERVICE_START | SERVICE_QUERY_STATUS ); + if (svcHandle != NULL) + { + QuerySStat = QueryServiceStatus(svcHandle, &SStat); + +#if defined(_DBG) || defined(_DEBUG_TO_FILE) + switch (SStat.dwCurrentState) + { + case SERVICE_CONTINUE_PENDING: + ODS("The status of the driver is: SERVICE_CONTINUE_PENDING\n"); + break; + case SERVICE_PAUSE_PENDING: + ODS("The status of the driver is: SERVICE_PAUSE_PENDING\n"); + break; + case SERVICE_PAUSED: + ODS("The status of the driver is: SERVICE_PAUSED\n"); + break; + case SERVICE_RUNNING: + ODS("The status of the driver is: SERVICE_RUNNING\n"); + break; + case SERVICE_START_PENDING: + ODS("The status of the driver is: SERVICE_START_PENDING\n"); + break; + case SERVICE_STOP_PENDING: + ODS("The status of the driver is: SERVICE_STOP_PENDING\n"); + break; + case SERVICE_STOPPED: + ODS("The status of the driver is: SERVICE_STOPPED\n"); + break; + + default: + ODS("The status of the driver is: unknown\n"); + break; + } +#endif + + if(!QuerySStat || SStat.dwCurrentState != SERVICE_RUNNING) + { + ODS("Calling startservice\n"); + if (StartService(svcHandle, 0, NULL)==0) + { + error = GetLastError(); + if(error!=ERROR_SERVICE_ALREADY_RUNNING && error!=ERROR_ALREADY_EXISTS) + { + SetLastError(error); + if (scmHandle != NULL) + CloseServiceHandle(scmHandle); + error = GetLastError(); + ODSEx("PacketOpenAdapterNPF: StartService failed, LastError=%d\n",error); + SetLastError(error); + return NULL; + } + } + } + + CloseServiceHandle( svcHandle ); + svcHandle = NULL; + + } + else + { + error = GetLastError(); + ODSEx("OpenService failed! Error=%d", error); + SetLastError(error); + } + } + else + { + if (KeyRes == FALSE) + Result = PacketInstallDriver(); + else + Result = TRUE; + + if (Result) { + + svcHandle = OpenService(scmHandle,NPFServiceName,SERVICE_START); + if (svcHandle != NULL) + { + + QuerySStat = QueryServiceStatus(svcHandle, &SStat); + +#if defined(_DBG) || defined(_DEBUG_TO_FILE) + switch (SStat.dwCurrentState) + { + case SERVICE_CONTINUE_PENDING: + ODS("The status of the driver is: SERVICE_CONTINUE_PENDING\n"); + break; + case SERVICE_PAUSE_PENDING: + ODS("The status of the driver is: SERVICE_PAUSE_PENDING\n"); + break; + case SERVICE_PAUSED: + ODS("The status of the driver is: SERVICE_PAUSED\n"); + break; + case SERVICE_RUNNING: + ODS("The status of the driver is: SERVICE_RUNNING\n"); + break; + case SERVICE_START_PENDING: + ODS("The status of the driver is: SERVICE_START_PENDING\n"); + break; + case SERVICE_STOP_PENDING: + ODS("The status of the driver is: SERVICE_STOP_PENDING\n"); + break; + case SERVICE_STOPPED: + ODS("The status of the driver is: SERVICE_STOPPED\n"); + break; + + default: + ODS("The status of the driver is: unknown\n"); + break; + } +#endif + + if(!QuerySStat || SStat.dwCurrentState != SERVICE_RUNNING){ + + ODS("Calling startservice\n"); + + if (StartService(svcHandle, 0, NULL)==0){ + error = GetLastError(); + if(error!=ERROR_SERVICE_ALREADY_RUNNING && error!=ERROR_ALREADY_EXISTS){ + if (scmHandle != NULL) CloseServiceHandle(scmHandle); + ODSEx("PacketOpenAdapterNPF: StartService failed, LastError=%d\n",error); + SetLastError(error); + return NULL; + } + } + } + + CloseServiceHandle( svcHandle ); + svcHandle = NULL; + + } + else{ + error = GetLastError(); + ODSEx("OpenService failed! LastError=%d", error); + SetLastError(error); + } + } + } + } + + if (scmHandle != NULL) CloseServiceHandle(scmHandle); + + lpAdapter=(LPADAPTER)GlobalAllocPtr(GMEM_MOVEABLE | GMEM_ZEROINIT, sizeof(ADAPTER)); + if (lpAdapter==NULL) + { + ODS("PacketOpenAdapterNPF: GlobalAlloc Failed\n"); + error=GetLastError(); + //set the error to the one on which we failed + SetLastError(error); + ODS("PacketOpenAdapterNPF: Failed to allocate the adapter structure\n"); + return NULL; + } + lpAdapter->NumWrites=1; + + if (LOWORD(GetVersion()) == 4) + wsprintf(SymbolicLink,TEXT("\\\\.\\%s"),&AdapterName[16]); + else + wsprintf(SymbolicLink,TEXT("\\\\.\\Global\\%s"),&AdapterName[16]); + + // Copy only the bytes that fit in the adapter structure. + // Note that lpAdapter->SymbolicLink is present for backward compatibility but will + // never be used by the apps + memcpy(lpAdapter->SymbolicLink, (PCHAR)SymbolicLink, MAX_LINK_NAME_LENGTH); + + //try if it is possible to open the adapter immediately + lpAdapter->hFile=CreateFile(SymbolicLink,GENERIC_WRITE | GENERIC_READ, + 0,NULL,OPEN_EXISTING,0,0); + + if (lpAdapter->hFile != INVALID_HANDLE_VALUE) + { + + if(PacketSetReadEvt(lpAdapter)==FALSE){ + error=GetLastError(); + ODS("PacketOpenAdapterNPF: Unable to open the read event\n"); + GlobalFreePtr(lpAdapter); + //set the error to the one on which we failed + SetLastError(error); + ODSEx("PacketOpenAdapterNPF: PacketSetReadEvt failed, LastError=%d\n",error); + return NULL; + } + + PacketSetMaxLookaheadsize(lpAdapter); + + _snprintf(lpAdapter->Name, ADAPTER_NAME_LENGTH, "%S", AdapterName); + + return lpAdapter; + } + + + error=GetLastError(); + GlobalFreePtr(lpAdapter); + //set the error to the one on which we failed + ODSEx("PacketOpenAdapterNPF: CreateFile failed, LastError= %d\n",error); + SetLastError(error); + return NULL; +} + +/*! + \brief Opens an adapter using the DAG capture API. + \param AdapterName A string containing the name of the device to open. + \return If the function succeeds, the return value is the pointer to a properly initialized ADAPTER object, + otherwise the return value is NULL. + + \note internal function used by PacketOpenAdapter() +*/ +#ifdef HAVE_DAG_API +LPADAPTER PacketOpenAdapterDAG(PCHAR AdapterName, BOOLEAN IsAFile) +{ + CHAR DagEbuf[DAGC_ERRBUF_SIZE]; + LPADAPTER lpAdapter; + LONG status; + HKEY dagkey; + DWORD lptype; + DWORD fpc; + DWORD lpcbdata = sizeof(fpc); + WCHAR keyname[512]; + PWCHAR tsn; + + + lpAdapter = (LPADAPTER) GlobalAllocPtr(GMEM_MOVEABLE | GMEM_ZEROINIT, + sizeof(ADAPTER)); + if (lpAdapter == NULL) + { + return NULL; + } + + if(IsAFile) + { + // We must add an entry to the adapter description list, otherwise many function will not + // be able to work + if(!PacketAddAdapterDag(AdapterName, "DAG file", IsAFile)) + { + GlobalFreePtr(lpAdapter); + return NULL; + } + + // Flag that this is a DAG file + lpAdapter->Flags = INFO_FLAG_DAG_FILE; + } + else + { + // Flag that this is a DAG card + lpAdapter->Flags = INFO_FLAG_DAG_CARD; + } + + // + // See if the user is asking for fast capture with this device + // + + lpAdapter->DagFastProcess = FALSE; + + tsn = (strstr(strlwr((char*)AdapterName), "dag") != NULL)? + SChar2WChar(strstr(strlwr((char*)AdapterName), "dag")): + L""; + + _snwprintf(keyname, sizeof(keyname), L"%s\\CardParams\\%ws", + L"SYSTEM\\CurrentControlSet\\Services\\DAG", + tsn); + + GlobalFreePtr(tsn); + + do + { + status = RegOpenKeyEx(HKEY_LOCAL_MACHINE, keyname, 0 , KEY_READ, &dagkey); + if(status != ERROR_SUCCESS) + break; + + status = RegQueryValueEx(dagkey, + L"FastCap", + NULL, + &lptype, + (char*)&fpc, + &lpcbdata); + + if(status == ERROR_SUCCESS) + lpAdapter->DagFastProcess = fpc; + + RegCloseKey(dagkey); + } + while(FALSE); + + // + // Open the card + // + lpAdapter->pDagCard = p_dagc_open(AdapterName, + 0, + DagEbuf); + + if(lpAdapter->pDagCard == NULL) + { + GlobalFreePtr(lpAdapter); + return NULL; + } + + lpAdapter->DagFcsLen = p_dagc_getfcslen(lpAdapter->pDagCard); + + _snprintf(lpAdapter->Name, ADAPTER_NAME_LENGTH, "%s", AdapterName); + + // XXX we could create the read event here + + return lpAdapter; +} +#endif // HAVE_DAG_API + +//--------------------------------------------------------------------------- +// PUBLIC API +//--------------------------------------------------------------------------- + +/** @ingroup packetapi + * @{ + */ + +/** @defgroup packet32 Packet.dll exported functions and variables + * @{ + */ + +/*! + \brief Return a string with the dll version. + \return A char pointer to the version of the library. +*/ +PCHAR PacketGetVersion() +{ + return PacketLibraryVersion; +} + +/*! + \brief Return a string with the version of the NPF.sys device driver. + \return A char pointer to the version of the driver. +*/ +PCHAR PacketGetDriverVersion() +{ + return PacketDriverVersion; +} + +/*! + \brief Stops and unloads the WinPcap device driver. + \return If the function succeeds, the return value is nonzero, otherwise it is zero. + + This function can be used to unload the driver from memory when the application no more needs it. + Note that the driver is physically stopped and unloaded only when all the files on its devices + are closed, i.e. when all the applications that use WinPcap close all their adapters. +*/ +BOOL PacketStopDriver() +{ + SC_HANDLE scmHandle; + SC_HANDLE schService; + BOOL ret; + SERVICE_STATUS serviceStatus; + + scmHandle = OpenSCManager(NULL, NULL, SC_MANAGER_ALL_ACCESS); + + if(scmHandle != NULL){ + + schService = OpenService (scmHandle, + NPFServiceName, + SERVICE_ALL_ACCESS + ); + + if (schService != NULL) + { + + ret = ControlService (schService, + SERVICE_CONTROL_STOP, + &serviceStatus + ); + if (!ret) + { + } + + CloseServiceHandle (schService); + + CloseServiceHandle(scmHandle); + + return ret; + } + } + + return FALSE; +} + +/*! + \brief Opens an adapter. + \param AdapterName A string containing the name of the device to open. + Use the PacketGetAdapterNames() function to retrieve the list of available devices. + \return If the function succeeds, the return value is the pointer to a properly initialized ADAPTER object, + otherwise the return value is NULL. +*/ +LPADAPTER PacketOpenAdapter(PCHAR AdapterName) +{ + LPADAPTER lpAdapter; + WCHAR *AdapterNameU; + SC_HANDLE svcHandle = NULL; + PCHAR AdapterNameA = NULL; +#ifndef _WINNT4 + PADAPTER_INFO TAdInfo; +#endif // _WINNT4 + ODSEx("PacketOpenAdapter: trying to open the adapter=%s\n",AdapterName) + + if(AdapterName[1]!=0) + { + // + // ASCII + // + + AdapterNameU = SChar2WChar(AdapterName); + AdapterNameA = AdapterName; + AdapterName = (PCHAR)AdapterNameU; + } + else + { + // + // Unicode + // + AdapterNameU = NULL; + AdapterNameA = WChar2SChar((PWCHAR)AdapterName); + } + +#ifndef _WINNT4 + + WaitForSingleObject(AdaptersInfoMutex, INFINITE); + // Find the PADAPTER_INFO structure associated with this adapter + TAdInfo = PacketFindAdInfo(AdapterNameA); + if(TAdInfo == NULL) + { + PacketUpdateAdInfo(AdapterNameA); + TAdInfo = PacketFindAdInfo(AdapterNameA); + if(TAdInfo == NULL) + { + + //can be an ERF file? + lpAdapter = PacketOpenAdapterDAG(AdapterNameA, TRUE); + + if (AdapterNameU != NULL) + GlobalFreePtr(AdapterNameU); + else + GlobalFreePtr(AdapterNameA); + + ReleaseMutex(AdaptersInfoMutex); + if (lpAdapter == NULL) + SetLastError(ERROR_BAD_UNIT); //this is the best we can do.... + return lpAdapter; + } + } + + // + // Check adapter type + // + if(TAdInfo->Flags != INFO_FLAG_NDIS_ADAPTER) + { + // + // Not a standard NDIS adapter, we must have specific handling + // + + if(TAdInfo->Flags & INFO_FLAG_NDISWAN_ADAPTER) + { + // + // This is a wan adapter. Open it using the netmon API + // + lpAdapter = (LPADAPTER) GlobalAllocPtr(GMEM_MOVEABLE | GMEM_ZEROINIT, + sizeof(ADAPTER)); + if (lpAdapter == NULL) + { + if (AdapterNameU != NULL) GlobalFreePtr(AdapterNameU); + else GlobalFreePtr(AdapterNameA); + ReleaseMutex(AdaptersInfoMutex); + SetLastError(ERROR_BAD_UNIT); + return NULL; + } + + // Backup flags for future usage + lpAdapter->Flags = TAdInfo->Flags; + + // Open the adapter + lpAdapter->pWanAdapter = WanPacketOpenAdapter(); + if (lpAdapter->pWanAdapter == NULL) + { + if (AdapterNameU != NULL) GlobalFreePtr(AdapterNameU); + else GlobalFreePtr(AdapterNameA); + + GlobalFreePtr(lpAdapter); + ReleaseMutex(AdaptersInfoMutex); + SetLastError(ERROR_BAD_UNIT); + return NULL; + } + + _snprintf(lpAdapter->Name, ADAPTER_NAME_LENGTH, "%s", AdapterNameA); + + lpAdapter->ReadEvent = WanPacketGetReadEvent(lpAdapter->pWanAdapter); + + if (AdapterNameU != NULL) + GlobalFreePtr(AdapterNameU); + else + GlobalFreePtr(AdapterNameA); + + ReleaseMutex(AdaptersInfoMutex); + return lpAdapter; + } + else + if(TAdInfo->Flags & INFO_FLAG_DAG_CARD) + { + // + // This is a Dag card. Open it using the dagc API + // + lpAdapter = PacketOpenAdapterDAG(AdapterNameA, FALSE); + + if (AdapterNameU != NULL) + GlobalFreePtr(AdapterNameU); + else + GlobalFreePtr(AdapterNameA); + + ReleaseMutex(AdaptersInfoMutex); + if (lpAdapter == NULL) + SetLastError(ERROR_BAD_UNIT); + return lpAdapter; + } + else + if(TAdInfo->Flags == INFO_FLAG_DONT_EXPORT) + { + // + // The adapter is flagged as not exported, probably because it's broken + // or incompatible with WinPcap. We end here with an error. + // + ODSEx("The user openend the adapter %s which is flagged as not exported", AdapterNameA); + if (AdapterNameU != NULL) GlobalFreePtr(AdapterNameU); + else GlobalFreePtr(AdapterNameA); + ReleaseMutex(AdaptersInfoMutex); + SetLastError(ERROR_BAD_UNIT); + return NULL; + } + } + + ReleaseMutex(AdaptersInfoMutex); + +#endif // _WINNT4 + + lpAdapter = PacketOpenAdapterNPF(AdapterName); + + if (AdapterNameU != NULL) + GlobalFreePtr(AdapterNameU); + else + GlobalFreePtr(AdapterNameA); + + return lpAdapter; +} + +/*! + \brief Closes an adapter. + \param lpAdapter the pointer to the adapter to close. + + PacketCloseAdapter closes the given adapter and frees the associated ADAPTER structure +*/ +VOID PacketCloseAdapter(LPADAPTER lpAdapter) +{ + if(!lpAdapter) + { + ODS("PacketCloseAdapter: attempt to close a NULL adapter\n"); + return; + } + +#ifndef _WINNT4 + if(lpAdapter->pWanAdapter != NULL) + { + WanPacketCloseAdapter(lpAdapter->pWanAdapter); + GlobalFreePtr(lpAdapter); + return; + } +#ifdef HAVE_DAG_API + else + if(lpAdapter->pDagCard != NULL) + { + if(lpAdapter->Flags & INFO_FLAG_DAG_FILE & ~INFO_FLAG_DAG_CARD) + { + // This is a file. We must remove the entry in the adapter description list + PacketUpdateAdInfo(lpAdapter->Name); + } + p_dagc_close(lpAdapter->pDagCard); + } +#endif // HAVE_DAG_API +#endif // _WINNT4 + + CloseHandle(lpAdapter->hFile); + SetEvent(lpAdapter->ReadEvent); + CloseHandle(lpAdapter->ReadEvent); + GlobalFreePtr(lpAdapter); +} + +/*! + \brief Allocates a _PACKET structure. + \return On succeess, the return value is the pointer to a _PACKET structure otherwise the + return value is NULL. + + The structure returned will be passed to the PacketReceivePacket() function to receive the + packets from the driver. + + \warning The Buffer field of the _PACKET structure is not set by this function. + The buffer \b must be allocated by the application, and associated to the PACKET structure + with a call to PacketInitPacket. +*/ +LPPACKET PacketAllocatePacket(void) +{ + + LPPACKET lpPacket; + lpPacket=(LPPACKET)GlobalAllocPtr(GMEM_MOVEABLE | GMEM_ZEROINIT,sizeof(PACKET)); + if (lpPacket==NULL) + { + ODS("PacketAllocatePacket: GlobalAlloc Failed\n"); + return NULL; + } + return lpPacket; +} + +/*! + \brief Frees a _PACKET structure. + \param lpPacket The structure to free. + + \warning the user-allocated buffer associated with the _PACKET structure is not deallocated + by this function and \b must be explicitly deallocated by the programmer. + +*/ +VOID PacketFreePacket(LPPACKET lpPacket) + +{ + GlobalFreePtr(lpPacket); +} + +/*! + \brief Initializes a _PACKET structure. + \param lpPacket The structure to initialize. + \param Buffer A pointer to a user-allocated buffer that will contain the captured data. + \param Length the length of the buffer. This is the maximum buffer size that will be + transferred from the driver to the application using a single read. + + \note the size of the buffer associated with the PACKET structure is a parameter that can sensibly + influence the performance of the capture process, since this buffer will contain the packets received + from the the driver. The driver is able to return several packets using a single read call + (see the PacketReceivePacket() function for details), and the number of packets transferable to the + application in a call is limited only by the size of the buffer associated with the PACKET structure + passed to PacketReceivePacket(). Therefore setting a big buffer with PacketInitPacket can noticeably + decrease the number of system calls, reducing the impcat of the capture process on the processor. +*/ + +VOID PacketInitPacket(LPPACKET lpPacket,PVOID Buffer,UINT Length) + +{ + lpPacket->Buffer = Buffer; + lpPacket->Length = Length; + lpPacket->ulBytesReceived = 0; + lpPacket->bIoComplete = FALSE; +} + +/*! + \brief Read data (packets or statistics) from the NPF driver. + \param AdapterObject Pointer to an _ADAPTER structure identifying the network adapter from which + the data is received. + \param lpPacket Pointer to a PACKET structure that will contain the data. + \param Sync This parameter is deprecated and will be ignored. It is present for compatibility with + older applications. + \return If the function succeeds, the return value is nonzero. + + The data received with this function can be a group of packets or a static on the network traffic, + depending on the working mode of the driver. The working mode can be set with the PacketSetMode() + function. Give a look at that function if you are interested in the format used to return statistics + values, here only the normal capture mode will be described. + + The number of packets received with this function is variable. It depends on the number of packets + currently stored in the driver buffer, on the size of these packets and on the size of the buffer + associated to the lpPacket parameter. The following figure shows the format used by the driver to pass + packets to the application. + + \image html encoding.gif "method used to encode the packets" + + Packets are stored in the buffer associated with the lpPacket _PACKET structure. The Length field of + that structure is updated with the amount of data copied in the buffer. Each packet has a header + consisting in a bpf_hdr structure that defines its length and contains its timestamp. A padding field + is used to word-align the data in the buffer (to speed up the access to the packets). The bh_datalen + and bh_hdrlen fields of the bpf_hdr structures should be used to extract the packets from the buffer. + + Examples can be seen either in the TestApp sample application (see the \ref packetsamps page) provided + in the developer's pack, or in the pcap_read() function of wpcap. +*/ +BOOLEAN PacketReceivePacket(LPADAPTER AdapterObject,LPPACKET lpPacket,BOOLEAN Sync) +{ + BOOLEAN res; + +#ifndef _WINNT4 + + if (AdapterObject->pWanAdapter != NULL) + { + lpPacket->ulBytesReceived = WanPacketReceivePacket(AdapterObject->pWanAdapter, lpPacket->Buffer, lpPacket->Length); + return TRUE; + } +#ifdef HAVE_DAG_API + else + if(AdapterObject->pDagCard != NULL) + { + + p_dagc_wait(AdapterObject->pDagCard, &AdapterObject->DagReadTimeout); + + if(p_dagc_receive(AdapterObject->pDagCard, &AdapterObject->DagBuffer, &lpPacket->ulBytesReceived) == 0) + return TRUE; + else + return FALSE; + } +#endif // HAVE_DAG_API +#endif // _WINNT4 + + if((int)AdapterObject->ReadTimeOut != -1) + WaitForSingleObject(AdapterObject->ReadEvent, (AdapterObject->ReadTimeOut==0)?INFINITE:AdapterObject->ReadTimeOut); + + res = ReadFile(AdapterObject->hFile, lpPacket->Buffer, lpPacket->Length, &lpPacket->ulBytesReceived,NULL); + + return res; +} + +/*! + \brief Sends one (or more) copies of a packet to the network. + \param AdapterObject Pointer to an _ADAPTER structure identifying the network adapter that will + send the packets. + \param lpPacket Pointer to a PACKET structure with the packet to send. + \param Sync This parameter is deprecated and will be ignored. It is present for compatibility with + older applications. + \return If the function succeeds, the return value is nonzero. + + This function is used to send a raw packet to the network. 'Raw packet' means that the programmer + will have to include the protocol headers, since the packet is sent to the network 'as is'. + The CRC needs not to be calculated and put at the end of the packet, because it will be transparently + added by the network interface. + + The behavior of this function is influenced by the PacketSetNumWrites() function. With PacketSetNumWrites(), + it is possible to change the number of times a single write must be repeated. The default is 1, + i.e. every call to PacketSendPacket() will correspond to one packet sent to the network. If this number is + greater than 1, for example 1000, every raw packet written by the application will be sent 1000 times on + the network. This feature mitigates the overhead of the context switches and therefore can be used to generate + high speed traffic. It is particularly useful for tools that test networks, routers, and servers and need + to obtain high network loads. + The optimized sending process is still limited to one packet at a time: for the moment it cannot be used + to send a buffer with multiple packets. + + \note The ability to write multiple packets is currently present only in the Windows NTx version of the + packet driver. In Windows 95/98/ME it is emulated at user level in packet.dll. This means that an application + that uses the multiple write method will run in Windows 9x as well, but its performance will be very low + compared to the one of WindowsNTx. +*/ +BOOLEAN PacketSendPacket(LPADAPTER AdapterObject,LPPACKET lpPacket,BOOLEAN Sync) +{ + DWORD BytesTransfered; + + +#ifndef _WINNT4 + if(AdapterObject->Flags != INFO_FLAG_NDIS_ADAPTER) + { + ODS("PacketSendPacket: packet sending not allowed on wan adapters\n"); + return FALSE; + } +#endif // _WINNT4 + + return WriteFile(AdapterObject->hFile,lpPacket->Buffer,lpPacket->Length,&BytesTransfered,NULL); +} + + +/*! + \brief Sends a buffer of packets to the network. + \param AdapterObject Pointer to an _ADAPTER structure identifying the network adapter that will + send the packets. + \param PacketBuff Pointer to buffer with the packets to send. + \param Size Size of the buffer pointed by the PacketBuff argument. + \param Sync if TRUE, the packets are sent respecting the timestamps. If FALSE, the packets are sent as + fast as possible + \return The amount of bytes actually sent. If the return value is smaller than the Size parameter, an + error occurred during the send. The error can be caused by a driver/adapter problem or by an + inconsistent/bogus packet buffer. + + This function is used to send a buffer of raw packets to the network. The buffer can contain an arbitrary + number of raw packets, each of which preceded by a dump_bpf_hdr structure. The dump_bpf_hdr is the same used + by WinPcap and libpcap to store the packets in a file, therefore sending a capture file is straightforward. + 'Raw packets' means that the sending application will have to include the protocol headers, since every packet + is sent to the network 'as is'. The CRC of the packets needs not to be calculated, because it will be + transparently added by the network interface. + + \note Using this function if more efficient than issuing a series of PacketSendPacket(), because the packets are + buffered in the kernel driver, so the number of context switches is reduced. + + \note When Sync is set to TRUE, the packets are synchronized in the kerenl with a high precision timestamp. + This requires a remarkable amount of CPU, but allows to send the packets with a precision of some microseconds + (depending on the precision of the performance counter of the machine). Such a precision cannot be reached + sending the packets separately with PacketSendPacket(). +*/ +INT PacketSendPackets(LPADAPTER AdapterObject, PVOID PacketBuff, ULONG Size, BOOLEAN Sync) +{ + BOOLEAN Res; + DWORD BytesTransfered, TotBytesTransfered=0; + DWORD last_total = 0; + struct timeval BufStartTime; + //LARGE_INTEGER StartTicks, CurTicks, TargetTicks, TimeFreq; + UINT num_count = 0; + + + ODS("PacketSendPackets"); + +#ifndef _WINNT4 + if(AdapterObject->Flags != INFO_FLAG_NDIS_ADAPTER) + { + ODS("PacketSendPackets: packet sending not allowed on wan adapters\n"); + return FALSE; + } +#endif // _WINNT4 + + // Obtain starting timestamp of the buffer + BufStartTime.tv_sec = ((struct timeval*)(PacketBuff))->tv_sec; + BufStartTime.tv_usec = ((struct timeval*)(PacketBuff))->tv_usec; + + // Retrieve the reference time counters +// QueryPerformanceCounter(&StartTicks); +// QueryPerformanceFrequency(&TimeFreq); + +// CurTicks.QuadPart = StartTicks.QuadPart; + + do{ + // Send the data to the driver + Res = DeviceIoControl(AdapterObject->hFile, + (Sync)?pBIOCSENDPACKETSSYNC:pBIOCSENDPACKETSNOSYNC, + (PCHAR)PacketBuff + TotBytesTransfered, + Size - TotBytesTransfered, + NULL, + 0, + &BytesTransfered, + NULL); + + TotBytesTransfered += BytesTransfered; + + // Exit from the loop on termination or error + if(TotBytesTransfered >= Size || Res != TRUE) + break; + + if (last_total != TotBytesTransfered) + { + num_count = 0; + last_total = TotBytesTransfered; + } + + num_count++; + + if (num_count >= 100000) + { + // Fatal Error: Infinite Loop + return 0x7FFFFFFF; + } + + // calculate the time interval to wait before sending the next packet + /*TargetTicks.QuadPart = StartTicks.QuadPart + + (LONGLONG) + ((((struct timeval*)((PCHAR)PacketBuff + TotBytesTransfered))->tv_sec - BufStartTime.tv_sec) * 1000000 + + (((struct timeval*)((PCHAR)PacketBuff + TotBytesTransfered))->tv_usec - BufStartTime.tv_usec)) * + (TimeFreq.QuadPart) / 1000000; + + // Wait until the time interval has elapsed + while( CurTicks.QuadPart <= TargetTicks.QuadPart ) + QueryPerformanceCounter(&CurTicks);*/ + + } + while(TRUE); + + return TotBytesTransfered; +} + +/*! + \brief Defines the minimum amount of data that will be received in a read. + \param AdapterObject Pointer to an _ADAPTER structure + \param nbytes the minimum amount of data in the kernel buffer that will cause the driver to + release a read on this adapter. + \return If the function succeeds, the return value is nonzero. + + In presence of a large value for nbytes, the kernel waits for the arrival of several packets before + copying the data to the user. This guarantees a low number of system calls, i.e. lower processor usage, + i.e. better performance, which is a good setting for applications like sniffers. Vice versa, a small value + means that the kernel will copy the packets as soon as the application is ready to receive them. This is + suggested for real time applications (like, for example, a bridge) that need the better responsiveness from + the kernel. + + \b note: this function has effect only in Windows NTx. The driver for Windows 9x doesn't offer + this possibility, therefore PacketSetMinToCopy is implemented under these systems only for compatibility. +*/ + +BOOLEAN PacketSetMinToCopy(LPADAPTER AdapterObject,int nbytes) +{ + DWORD BytesReturned; + +#ifndef _WINNT4 + if (AdapterObject->Flags == INFO_FLAG_NDISWAN_ADAPTER) + return WanPacketSetMinToCopy(AdapterObject->pWanAdapter, nbytes); +#ifdef HAVE_DAG_API + else + if(AdapterObject->Flags & INFO_FLAG_DAG_CARD) + // No mintocopy with DAGs + return TRUE; +#endif // HAVE_DAG_API +#endif // _WINNT4 + + return DeviceIoControl(AdapterObject->hFile,pBIOCSMINTOCOPY,&nbytes,4,NULL,0,&BytesReturned,NULL); +} + +/*! + \brief Sets the working mode of an adapter. + \param AdapterObject Pointer to an _ADAPTER structure. + \param mode The new working mode of the adapter. + \return If the function succeeds, the return value is nonzero. + + The device driver of WinPcap has 4 working modes: + - Capture mode (mode = PACKET_MODE_CAPT): normal capture mode. The packets transiting on the wire are copied + to the application when PacketReceivePacket() is called. This is the default working mode of an adapter. + - Statistical mode (mode = PACKET_MODE_STAT): programmable statistical mode. PacketReceivePacket() returns, at + precise intervals, statics values on the network traffic. The interval between the statistic samples is + by default 1 second but it can be set to any other value (with a 1 ms precision) with the + PacketSetReadTimeout() function. The data returned by PacketReceivePacket() when the adapter is in statistical + mode is shown in the following figure:

+ \image html stats.gif "data structure returned by statistical mode" + Two 64-bit counters are provided: the number of packets and the amount of bytes that satisfy a filter + previously set with PacketSetBPF(). If no filter has been set, all the packets are counted. The counters are + encapsulated in a bpf_hdr structure, so that they will be parsed correctly by wpcap. Statistical mode has a + very low impact on system performance compared to capture mode. + - Dump mode (mode = PACKET_MODE_DUMP): the packets are dumped to disk by the driver, in libpcap format. This + method is much faster than saving the packets after having captured them. No data is returned + by PacketReceivePacket(). If the application sets a filter with PacketSetBPF(), only the packets that satisfy + this filter are dumped to disk. + - Statitical Dump mode (mode = PACKET_MODE_STAT_DUMP): the packets are dumped to disk by the driver, in libpcap + format, like in dump mode. PacketReceivePacket() returns, at precise intervals, statics values on the + network traffic and on the amount of data saved to file, in a way similar to statistical mode. + The data returned by PacketReceivePacket() when the adapter is in statistical dump mode is shown in + the following figure:

+ \image html dump.gif "data structure returned by statistical dump mode" + Three 64-bit counters are provided: the number of packets accepted, the amount of bytes accepted and the + effective amount of data (including headers) dumped to file. If no filter has been set, all the packets are + dumped to disk. The counters are encapsulated in a bpf_hdr structure, so that they will be parsed correctly + by wpcap. + Look at the NetMeter example in the + WinPcap developer's pack to see how to use statistics mode. +*/ +BOOLEAN PacketSetMode(LPADAPTER AdapterObject,int mode) +{ + DWORD BytesReturned; + +#ifndef _WINNT4 + if (AdapterObject->pWanAdapter != NULL) + return WanPacketSetMode(AdapterObject->pWanAdapter, mode); +#endif // _WINNT4 + + return DeviceIoControl(AdapterObject->hFile,pBIOCSMODE,&mode,4,NULL,0,&BytesReturned,NULL); +} + +/*! + \brief Sets the name of the file that will receive the packet when the adapter is in dump mode. + \param AdapterObject Pointer to an _ADAPTER structure. + \param name the file name, in ASCII or UNICODE. + \param len the length of the buffer containing the name, in bytes. + \return If the function succeeds, the return value is nonzero. + + This function defines the file name that the driver will open to store the packets on disk when + it works in dump mode. The adapter must be in dump mode, i.e. PacketSetMode() should have been + called previously with mode = PACKET_MODE_DUMP. otherwise this function will fail. + If PacketSetDumpName was already invoked on the adapter pointed by AdapterObject, the driver + closes the old file and opens the new one. +*/ + +BOOLEAN PacketSetDumpName(LPADAPTER AdapterObject, void *name, int len) +{ + DWORD BytesReturned; + WCHAR *FileName; + BOOLEAN res; + WCHAR NameWithPath[1024]; + int TStrLen; + WCHAR *NamePos; + +#ifndef _WINNT4 + if (AdapterObject->Flags != INFO_FLAG_NDIS_ADAPTER) + { + ODS("PacketSetDumpName: not allowed on wan adapters\n"); + return FALSE; + } +#endif // _WINNT4 + + if(((PUCHAR)name)[1]!=0 && len>1){ //ASCII + FileName=SChar2WChar(name); + len*=2; + } + else { //Unicode + FileName=name; + } + + TStrLen=GetFullPathName(FileName,1024,NameWithPath,&NamePos); + + len=TStrLen*2+2; //add the terminating null character + + // Try to catch malformed strings + if(len>2048){ + if(((PUCHAR)name)[1]!=0 && len>1) free(FileName); + return FALSE; + } + + res = DeviceIoControl(AdapterObject->hFile,pBIOCSETDUMPFILENAME,NameWithPath,len,NULL,0,&BytesReturned,NULL); + free(FileName); + return res; +} + +/*! + \brief Set the dump mode limits. + \param AdapterObject Pointer to an _ADAPTER structure. + \param maxfilesize The maximum dimension of the dump file, in bytes. 0 means no limit. + \param maxnpacks The maximum number of packets contained in the dump file. 0 means no limit. + \return If the function succeeds, the return value is nonzero. + + This function sets the limits after which the NPF driver stops to save the packets to file when an adapter + is in dump mode. This allows to limit the dump file to a precise number of bytes or packets, avoiding that + very long dumps fill the disk space. If both maxfilesize and maxnpacks are set, the dump is stopped when + the first of the two is reached. + + \note When a limit is reached, the dump is stopped, but the file remains opened. In order to flush + correctly the data and access the file consistently, you need to close the adapter with PacketCloseAdapter(). +*/ +BOOLEAN PacketSetDumpLimits(LPADAPTER AdapterObject, UINT maxfilesize, UINT maxnpacks) +{ + DWORD BytesReturned; + UINT valbuff[2]; + +#ifndef _WINNT4 + if (AdapterObject->Flags != INFO_FLAG_NDIS_ADAPTER) + { + ODS("PacketSetDumpLimits: not allowed on wan adapters\n"); + return FALSE; + } +#endif // _WINNT4 + + valbuff[0] = maxfilesize; + valbuff[1] = maxnpacks; + + return DeviceIoControl(AdapterObject->hFile, + pBIOCSETDUMPLIMITS, + valbuff, + sizeof valbuff, + NULL, + 0, + &BytesReturned, + NULL); +} + +/*! + \brief Returns the status of the kernel dump process, i.e. tells if one of the limits defined with PacketSetDumpLimits() was reached. + \param AdapterObject Pointer to an _ADAPTER structure. + \param sync if TRUE, the function blocks until the dump is finished, otherwise it returns immediately. + \return TRUE if the dump is ended, FALSE otherwise. + + PacketIsDumpEnded() informs the user about the limits that were set with a previous call to + PacketSetDumpLimits(). + + \warning If no calls to PacketSetDumpLimits() were performed or if the dump process has no limits + (i.e. if the arguments of the last call to PacketSetDumpLimits() were both 0), setting sync to TRUE will + block the application on this call forever. +*/ +BOOLEAN PacketIsDumpEnded(LPADAPTER AdapterObject, BOOLEAN sync) +{ + DWORD BytesReturned; + int IsDumpEnded; + BOOLEAN res; + +#ifndef _WINNT4 + if(AdapterObject->Flags != INFO_FLAG_NDIS_ADAPTER) + { + ODS("PacketIsDumpEnded: not allowed on wan adapters\n"); + return FALSE; + } +#endif // _WINNT4 + + if(sync) + WaitForSingleObject(AdapterObject->ReadEvent, INFINITE); + + res = DeviceIoControl(AdapterObject->hFile, + pBIOCISDUMPENDED, + NULL, + 0, + &IsDumpEnded, + 4, + &BytesReturned, + NULL); + + if(res == FALSE) return TRUE; // If the IOCTL returns an error we consider the dump finished + + return (BOOLEAN)IsDumpEnded; +} + +/*! + \brief Returns the notification event associated with the read calls on an adapter. + \param AdapterObject Pointer to an _ADAPTER structure. + \return The handle of the event that the driver signals when some data is available in the kernel buffer. + + The event returned by this function is signaled by the driver if: + - The adapter pointed by AdapterObject is in capture mode and an amount of data greater or equal + than the one set with the PacketSetMinToCopy() function is received from the network. + - the adapter pointed by AdapterObject is in capture mode, no data has been received from the network + but the the timeout set with the PacketSetReadTimeout() function has elapsed. + - the adapter pointed by AdapterObject is in statics mode and the the timeout set with the + PacketSetReadTimeout() function has elapsed. This means that a new statistic sample is available. + + In every case, a call to PacketReceivePacket() will return immediately. + The event can be passed to standard Win32 functions (like WaitForSingleObject or WaitForMultipleObjects) + to wait until the driver's buffer contains some data. It is particularly useful in GUI applications that + need to wait concurrently on several events. + +*/ +HANDLE PacketGetReadEvent(LPADAPTER AdapterObject) +{ + return AdapterObject->ReadEvent; +} + +/*! + \brief Sets the number of times a single packet written with PacketSendPacket() will be repeated on the network. + \param AdapterObject Pointer to an _ADAPTER structure. + \param nwrites Number of copies of a packet that will be physically sent by the interface. + \return If the function succeeds, the return value is nonzero. + + See PacketSendPacket() for details. +*/ +BOOLEAN PacketSetNumWrites(LPADAPTER AdapterObject,int nwrites) +{ + DWORD BytesReturned; + +#ifndef _WINNT4 + if(AdapterObject->Flags != INFO_FLAG_NDIS_ADAPTER) + { + ODS("PacketSetNumWrites: not allowed on wan adapters\n"); + return FALSE; + } +#endif // _WINNT4 + + return DeviceIoControl(AdapterObject->hFile,pBIOCSWRITEREP,&nwrites,4,NULL,0,&BytesReturned,NULL); +} + +/*! + \brief Sets the timeout after which a read on an adapter returns. + \param AdapterObject Pointer to an _ADAPTER structure. + \param timeout indicates the timeout, in milliseconds, after which a call to PacketReceivePacket() on + the adapter pointed by AdapterObject will be released, also if no packets have been captured by the driver. + Setting timeout to 0 means no timeout, i.e. PacketReceivePacket() never returns if no packet arrives. + A timeout of -1 causes PacketReceivePacket() to always return immediately. + \return If the function succeeds, the return value is nonzero. + + \note This function works also if the adapter is working in statistics mode, and can be used to set the + time interval between two statistic reports. +*/ +BOOLEAN PacketSetReadTimeout(LPADAPTER AdapterObject,int timeout) +{ + DWORD BytesReturned; + int DriverTimeOut=-1; + +#ifndef _WINNT4 + if (AdapterObject->pWanAdapter != NULL) + return WanPacketSetReadTimeout(AdapterObject->pWanAdapter,timeout); +#endif // _WINNT4 + + AdapterObject->ReadTimeOut=timeout; + +#ifdef HAVE_DAG_API + // Under DAG, we simply store the timeout value and then + if(AdapterObject->Flags & INFO_FLAG_DAG_CARD) + { + if(timeout == 1) + { + // tell DAG card to return immediately + AdapterObject->DagReadTimeout.tv_sec = 0; + AdapterObject->DagReadTimeout.tv_usec = 0; + } + else + if(timeout == 1) + { + // tell the DAG card to wait forever + AdapterObject->DagReadTimeout.tv_sec = -1; + AdapterObject->DagReadTimeout.tv_usec = -1; + } + else + { + // Set the timeout for the DAG card + AdapterObject->DagReadTimeout.tv_sec = timeout / 1000; + AdapterObject->DagReadTimeout.tv_usec = (timeout * 1000) % 1000000; + } + + return TRUE; + } +#endif // HAVE_DAG_API + + return DeviceIoControl(AdapterObject->hFile,pBIOCSRTIMEOUT,&DriverTimeOut,4,NULL,0,&BytesReturned,NULL); +} + +/*! + \brief Sets the size of the kernel-level buffer associated with a capture. + \param AdapterObject Pointer to an _ADAPTER structure. + \param dim New size of the buffer, in \b kilobytes. + \return The function returns TRUE if successfully completed, FALSE if there is not enough memory to + allocate the new buffer. + + When a new dimension is set, the data in the old buffer is discarded and the packets stored in it are + lost. + + Note: the dimension of the kernel buffer affects heavily the performances of the capture process. + An adequate buffer in the driver is able to keep the packets while the application is busy, compensating + the delays of the application and avoiding the loss of packets during bursts or high network activity. + The buffer size is set to 0 when an instance of the driver is opened: the programmer should remember to + set it to a proper value. As an example, wpcap sets the buffer size to 1MB at the beginning of a capture. +*/ +BOOLEAN PacketSetBuff(LPADAPTER AdapterObject,int dim) +{ + DWORD BytesReturned; + +#ifndef _WINNT4 + if (AdapterObject->pWanAdapter != NULL) + return WanPacketSetBufferSize(AdapterObject->pWanAdapter, dim); +#ifdef HAVE_DAG_API + else + if(AdapterObject->Flags & INFO_FLAG_DAG_CARD) + // We can't change DAG buffers + return TRUE; +#endif // HAVE_DAG_API + +#endif // _WINNT4 + return DeviceIoControl(AdapterObject->hFile,pBIOCSETBUFFERSIZE,&dim,4,NULL,0,&BytesReturned,NULL); +} + +/*! + \brief Sets a kernel-level packet filter. + \param AdapterObject Pointer to an _ADAPTER structure. + \param fp Pointer to a filtering program that will be associated with this capture or monitoring + instance and that will be executed on every incoming packet. + \return This function returns TRUE if the filter is set successfully, FALSE if an error occurs + or if the filter program is not accepted after a safeness check by the driver. The driver performs + the check in order to avoid system crashes due to buggy or malicious filters, and it rejects non + conformant filters. + + This function associates a new BPF filter to the adapter AdapterObject. The filter, pointed by fp, is a + set of bpf_insn instructions. + + A filter can be automatically created by using the pcap_compile() function of wpcap. This function + converts a human readable text expression with the syntax of WinDump (see the manual of WinDump at + http://netgroup.polito.it/windump for details) into a BPF program. If your program doesn't link wpcap, but + you need to know the code of a particular filter, you can launch WinDump with the -d or -dd or -ddd + flags to obtain the pseudocode. + +*/ +BOOLEAN PacketSetBpf(LPADAPTER AdapterObject, struct bpf_program *fp) +{ + DWORD BytesReturned; + +#ifndef _WINNT4 + if (AdapterObject->pWanAdapter != NULL) + return WanPacketSetBpfFilter(AdapterObject->pWanAdapter, (PUCHAR)fp->bf_insns, fp->bf_len * sizeof(struct bpf_insn)); +#ifdef HAVE_DAG_API + else + if(AdapterObject->Flags & INFO_FLAG_DAG_CARD) + // Delegate the filtering to higher layers since it's too expensive here + return TRUE; +#endif // HAVE_DAG_API +#endif // _WINNT4 + + return DeviceIoControl(AdapterObject->hFile,pBIOCSETF,(char*)fp->bf_insns,fp->bf_len*sizeof(struct bpf_insn),NULL,0,&BytesReturned,NULL); +} + +/*! + \brief Sets the snap len on the adapters that allow it. + \param AdapterObject Pointer to an _ADAPTER structure. + \param snaplen Desired snap len for this capture. + \return If the function succeeds, the return value is nonzero and specifies the actual snaplen that + the card is using. If the function fails or if the card doesn't allow to set sna length, the return + value is 0. + + The snap len is the amount of packet that is actually captured by the interface and received by the + application. Some interfaces allow to capture only a portion of any packet for performance reasons. + + \note: the return value can be different from the snaplen parameter, for example some boards round the + snaplen to 4 bytes. +*/ +INT PacketSetSnapLen(LPADAPTER AdapterObject, int snaplen) +{ + +#ifdef HAVE_DAG_API + if(AdapterObject->Flags & INFO_FLAG_DAG_CARD) + return p_dagc_setsnaplen(AdapterObject->pDagCard, snaplen); + else +#endif // HAVE_DAG_API + return 0; +} + +/*! + \brief Returns a couple of statistic values about the current capture session. + \param AdapterObject Pointer to an _ADAPTER structure. + \param s Pointer to a user provided bpf_stat structure that will be filled by the function. + \return If the function succeeds, the return value is nonzero. + + With this function, the programmer can know the value of two internal variables of the driver: + + - the number of packets that have been received by the adapter AdapterObject, starting at the + time in which it was opened with PacketOpenAdapter. + - the number of packets that have been dropped by the driver. A packet is dropped when the kernel + buffer associated with the adapter is full. +*/ +BOOLEAN PacketGetStats(LPADAPTER AdapterObject,struct bpf_stat *s) +{ + BOOLEAN Res; + DWORD BytesReturned; + struct bpf_stat tmpstat; // We use a support structure to avoid kernel-level inconsistencies with old or malicious applications + +#ifndef _WINNT4 +#ifdef HAVE_DAG_API + if(AdapterObject->Flags & INFO_FLAG_DAG_CARD) + { + dagc_stats_t DagStats; + + // Note: DAG cards are currently very limited from the statistics reporting point of view, + // so most of the values returned by dagc_stats() are zero at the moment + if(p_dagc_stats(AdapterObject->pDagCard, &DagStats) == 0) + { + // XXX: Only copy the dropped packets for now, since the received counter is not supported by + // DAGS at the moment + + s->bs_recv = (ULONG)DagStats.received; + s->bs_drop = (ULONG)DagStats.dropped; + return TRUE; + } + else + return FALSE; + } + else +#endif // HAVE_DAG_API + if ( AdapterObject->pWanAdapter != NULL) + Res = WanPacketGetStats(AdapterObject->pWanAdapter, (PVOID)&tmpstat); + else +#endif // _WINNT4 + + Res = DeviceIoControl(AdapterObject->hFile, + pBIOCGSTATS, + NULL, + 0, + &tmpstat, + sizeof(struct bpf_stat), + &BytesReturned, + NULL); + + + // Copy only the first two values retrieved from the driver + s->bs_recv = tmpstat.bs_recv; + s->bs_drop = tmpstat.bs_drop; + + return Res; +} + +/*! + \brief Returns statistic values about the current capture session. Enhanced version of PacketGetStats(). + \param AdapterObject Pointer to an _ADAPTER structure. + \param s Pointer to a user provided bpf_stat structure that will be filled by the function. + \return If the function succeeds, the return value is nonzero. + + With this function, the programmer can retrieve the sname values provided by PacketGetStats(), plus: + + - the number of drops by interface (not yet supported, always 0). + - the number of packets that reached the application, i.e that were accepted by the kernel filter and + that fitted in the kernel buffer. +*/ +BOOLEAN PacketGetStatsEx(LPADAPTER AdapterObject,struct bpf_stat *s) +{ + BOOLEAN Res; + DWORD BytesReturned; + struct bpf_stat tmpstat; // We use a support structure to avoid kernel-level inconsistencies with old or malicious applications + +#ifndef _WINNT4 +#ifdef HAVE_DAG_API + if(AdapterObject->Flags & INFO_FLAG_DAG_CARD) + { + dagc_stats_t DagStats; + + // Note: DAG cards are currently very limited from the statistics reporting point of view, + // so most of the values returned by dagc_stats() are zero at the moment + p_dagc_stats(AdapterObject->pDagCard, &DagStats); + s->bs_recv = (ULONG)DagStats.received; + s->bs_drop = (ULONG)DagStats.dropped; + s->ps_ifdrop = 0; + s->bs_capt = (ULONG)DagStats.captured; + } +#endif // HAVE_DAG_API + if(AdapterObject->pWanAdapter != NULL) + Res = WanPacketGetStats(AdapterObject->pWanAdapter, (PVOID)&tmpstat); + else +#endif // _WINNT4 + + Res = DeviceIoControl(AdapterObject->hFile, + pBIOCGSTATS, + NULL, + 0, + &tmpstat, + sizeof(struct bpf_stat), + &BytesReturned, + NULL); + + s->bs_recv = tmpstat.bs_recv; + s->bs_drop = tmpstat.bs_drop; + s->ps_ifdrop = tmpstat.ps_ifdrop; + s->bs_capt = tmpstat.bs_capt; + + return Res; +} + +/*! + \brief Performs a query/set operation on an internal variable of the network card driver. + \param AdapterObject Pointer to an _ADAPTER structure. + \param Set Determines if the operation is a set (Set=TRUE) or a query (Set=FALSE). + \param OidData A pointer to a _PACKET_OID_DATA structure that contains or receives the data. + \return If the function succeeds, the return value is nonzero. + + \note not all the network adapters implement all the query/set functions. There is a set of mandatory + OID functions that is granted to be present on all the adapters, and a set of facultative functions, not + provided by all the cards (see the Microsoft DDKs to see which functions are mandatory). If you use a + facultative function, be careful to enclose it in an if statement to check the result. +*/ +BOOLEAN PacketRequest(LPADAPTER AdapterObject,BOOLEAN Set,PPACKET_OID_DATA OidData) +{ + DWORD BytesReturned; + BOOLEAN Result; + +#ifndef _WINNT4 + if(AdapterObject->Flags != INFO_FLAG_NDIS_ADAPTER) + return FALSE; +#endif // _WINNT4 + + Result=DeviceIoControl(AdapterObject->hFile,(DWORD) Set ? (DWORD)pBIOCSETOID : (DWORD)pBIOCQUERYOID, + OidData,sizeof(PACKET_OID_DATA)-1+OidData->Length,OidData, + sizeof(PACKET_OID_DATA)-1+OidData->Length,&BytesReturned,NULL); + + // output some debug info + ODSEx("PacketRequest, OID=%d ", OidData->Oid); + ODSEx("Length=%d ", OidData->Length); + ODSEx("Set=%d ", Set); + ODSEx("Res=%d\n", Result); + + return Result; +} + +/*! + \brief Sets a hardware filter on the incoming packets. + \param AdapterObject Pointer to an _ADAPTER structure. + \param Filter The identifier of the filter. + \return If the function succeeds, the return value is nonzero. + + The filter defined with this filter is evaluated by the network card, at a level that is under the NPF + device driver. Here is a list of the most useful hardware filters (A complete list can be found in ntddndis.h): + + - NDIS_PACKET_TYPE_PROMISCUOUS: sets promiscuous mode. Every incoming packet is accepted by the adapter. + - NDIS_PACKET_TYPE_DIRECTED: only packets directed to the workstation's adapter are accepted. + - NDIS_PACKET_TYPE_BROADCAST: only broadcast packets are accepted. + - NDIS_PACKET_TYPE_MULTICAST: only multicast packets belonging to groups of which this adapter is a member are accepted. + - NDIS_PACKET_TYPE_ALL_MULTICAST: every multicast packet is accepted. + - NDIS_PACKET_TYPE_ALL_LOCAL: all local packets, i.e. NDIS_PACKET_TYPE_DIRECTED + NDIS_PACKET_TYPE_BROADCAST + NDIS_PACKET_TYPE_MULTICAST +*/ +BOOLEAN PacketSetHwFilter(LPADAPTER AdapterObject,ULONG Filter) +{ + BOOLEAN Status; + ULONG IoCtlBufferLength=(sizeof(PACKET_OID_DATA)+sizeof(ULONG)-1); + PPACKET_OID_DATA OidData; + +#ifndef _WINNT4 + if(AdapterObject->Flags != INFO_FLAG_NDIS_ADAPTER) + return TRUE; +#endif // _WINNT4 + + OidData=GlobalAllocPtr(GMEM_MOVEABLE | GMEM_ZEROINIT,IoCtlBufferLength); + if (OidData == NULL) { + ODS("PacketSetHwFilter: GlobalAlloc Failed\n"); + return FALSE; + } + OidData->Oid=OID_GEN_CURRENT_PACKET_FILTER; + OidData->Length=sizeof(ULONG); + *((PULONG)OidData->Data)=Filter; + Status=PacketRequest(AdapterObject,TRUE,OidData); + GlobalFreePtr(OidData); + return Status; +} + +/*! + \brief Retrieve the list of available network adapters and their description. + \param pStr User allocated string that will be filled with the names of the adapters. + \param BufferSize Length of the buffer pointed by pStr. If the function fails, this variable contains the + number of bytes that are needed to contain the adapter list. + \return If the function succeeds, the return value is nonzero. If the return value is zero, BufferSize contains + the number of bytes that are needed to contain the adapter list. + + Usually, this is the first function that should be used to communicate with the driver. + It returns the names of the adapters installed on the system and supported by WinPcap. + After the names of the adapters, pStr contains a string that describes each of them. + + After a call to PacketGetAdapterNames pStr contains, in succession: + - a variable number of ASCII strings, each with the names of an adapter, separated by a "\0" + - a double "\0" + - a number of ASCII strings, each with the description of an adapter, separated by a "\0". The number + of descriptions is the same of the one of names. The first description corresponds to the first name, and + so on. + - a double "\0". +*/ + +BOOLEAN PacketGetAdapterNames(PTSTR pStr,PULONG BufferSize) +{ + PADAPTER_INFO TAdInfo; + ULONG SizeNeeded = 1; + ULONG SizeNames = 1; + ULONG SizeDesc; + ULONG OffDescriptions; + + ODSEx("PacketGetAdapterNames: BufferSize=%d\n", *BufferSize); + + // + // Create the adapter information list + // + PacketPopulateAdaptersInfoList(); + + WaitForSingleObject(AdaptersInfoMutex, INFINITE); + if(!AdaptersInfoList) + { + ReleaseMutex(AdaptersInfoMutex); + *BufferSize = 0; + return FALSE; // No adapters to return + } + + // + // First scan of the list to calculate the offsets and check the sizes + // + for(TAdInfo = AdaptersInfoList; TAdInfo != NULL; TAdInfo = TAdInfo->Next) + { + if(TAdInfo->Flags != INFO_FLAG_DONT_EXPORT) + { + // Update the size variables + SizeNeeded += (int)strlen(TAdInfo->Name) + (int)strlen(TAdInfo->Description) + 2; + SizeNames += (int)strlen(TAdInfo->Name) + 1; + } + } + + // Check that we don't overflow the buffer. + // Note: 2 is the number of additional separators needed inside the list + if(SizeNeeded + 2 >= *BufferSize || pStr == NULL) + { + ReleaseMutex(AdaptersInfoMutex); + + ODS("PacketGetAdapterNames: input buffer too small\n"); + *BufferSize = SizeNeeded + 4; // Report the required size + return FALSE; + } + + OffDescriptions = SizeNames; + + // + // Second scan of the list to copy the information + // + for(TAdInfo = AdaptersInfoList, SizeNames = 0, SizeDesc = 0; TAdInfo != NULL; TAdInfo = TAdInfo->Next) + { + if(TAdInfo->Flags != INFO_FLAG_DONT_EXPORT) + { + // Copy the data + strcpy(((PCHAR)pStr) + SizeNames, TAdInfo->Name); + strcpy(((PCHAR)pStr) + OffDescriptions + SizeDesc, TAdInfo->Description); + + // Update the size variables + SizeNames += (int)strlen(TAdInfo->Name) + 1; + SizeDesc += (int)strlen(TAdInfo->Description) + 1; + } + } + + // Separate the two lists + ((PCHAR)pStr)[SizeNames] = 0; + + // End the list with a further \0 + ((PCHAR)pStr)[SizeNeeded] = 0; + + + ReleaseMutex(AdaptersInfoMutex); + return TRUE; +} + +/*! + \brief Returns comprehensive information the addresses of an adapter. + \param AdapterName String that contains the name of the adapter. + \param buffer A user allocated array of npf_if_addr that will be filled by the function. + \param NEntries Size of the array (in npf_if_addr). + \return If the function succeeds, the return value is nonzero. + + This function grabs from the registry information like the IP addresses, the netmasks + and the broadcast addresses of an interface. The buffer passed by the user is filled with + npf_if_addr structures, each of which contains the data for a single address. If the buffer + is full, the reaming addresses are dropped, therefore set its dimension to sizeof(npf_if_addr) + if you want only the first address. +*/ +BOOLEAN PacketGetNetInfoEx(PCHAR AdapterName, npf_if_addr* buffer, PLONG NEntries) +{ + PADAPTER_INFO TAdInfo; + PCHAR Tname; + BOOLEAN Res, FreeBuff; + + ODS("PacketGetNetInfo\n"); + + // Provide conversion for backward compatibility + if(AdapterName[1] != 0) + { //ASCII + Tname = AdapterName; + FreeBuff = FALSE; + } + else + { + Tname = WChar2SChar((PWCHAR)AdapterName); + FreeBuff = TRUE; + } + + // + // Update the information about this adapter + // + if(!PacketUpdateAdInfo(Tname)) + { + ODS("PacketGetNetInfo: Adapter not found\n"); + if(FreeBuff)GlobalFreePtr(Tname); + return FALSE; + } + + WaitForSingleObject(AdaptersInfoMutex, INFINITE); + // Find the PADAPTER_INFO structure associated with this adapter + TAdInfo = PacketFindAdInfo(Tname); + + if(TAdInfo != NULL) + { + *NEntries = (TAdInfo->NNetworkAddresses < *NEntries)? TAdInfo->NNetworkAddresses: *NEntries; + //TODO what if nentries = 0? + if (*NEntries > 0) + memcpy(buffer, TAdInfo->NetworkAddresses, *NEntries * sizeof(npf_if_addr)); + Res = TRUE; + } + else + { + ODS("PacketGetNetInfo: Adapter not found\n"); + Res = FALSE; + } + + ReleaseMutex(AdaptersInfoMutex); + + if(FreeBuff)GlobalFreePtr(Tname); + + return Res; +} + +/*! + \brief Returns information about the MAC type of an adapter. + \param AdapterObject The adapter on which information is needed. + \param type Pointer to a NetType structure that will be filled by the function. + \return If the function succeeds, the return value is nonzero, otherwise the return value is zero. + + This function return the link layer and the speed (in bps) of an opened adapter. + The LinkType field of the type parameter can have one of the following values: + + - NdisMedium802_3: Ethernet (802.3) + - NdisMediumWan: WAN + - NdisMedium802_5: Token Ring (802.5) + - NdisMediumFddi: FDDI + - NdisMediumAtm: ATM + - NdisMediumArcnet878_2: ARCNET (878.2) +*/ +BOOLEAN PacketGetNetType(LPADAPTER AdapterObject, NetType *type) +{ + PADAPTER_INFO TAdInfo; + BOOLEAN ret; + ODS("PacketGetNetType\n"); + + WaitForSingleObject(AdaptersInfoMutex, INFINITE); + // Find the PADAPTER_INFO structure associated with this adapter + TAdInfo = PacketFindAdInfo(AdapterObject->Name); + + if(TAdInfo != NULL) + { + // Copy the data + memcpy(type, &(TAdInfo->LinkLayer), sizeof(struct NetType)); + ret = TRUE; + } + else + { + ODS("PacketGetNetType: Adapter not found\n"); + ret = FALSE; + } + + ReleaseMutex(AdaptersInfoMutex); + + return ret; +} + +/* @} */ +BOOLEAN PacketSetLoopbackBehavior(LPADAPTER AdapterObject, UINT LoopbackBehavior) +{ + DWORD BytesReturned; + BOOLEAN result; + + if (AdapterObject->Flags != INFO_FLAG_NDIS_ADAPTER) + { + return FALSE; + } + + + result = (BOOLEAN)DeviceIoControl(AdapterObject->hFile, + pBIOCISETLOBBEH, + &LoopbackBehavior, + sizeof(UINT), + NULL, + 0, + &BytesReturned, + NULL); + + return result; +} + diff --git a/src/SeeDll/Packet32.h b/src/SeeDll/Packet32.h index ddfb34e9..6c963317 100644 --- a/src/SeeDll/Packet32.h +++ b/src/SeeDll/Packet32.h @@ -1,424 +1,424 @@ -/* - * Copyright (c) 1999 - 2003 - * NetGroup, Politecnico di Torino (Italy) - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the Politecnico di Torino nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - */ - -/** @ingroup packetapi - * @{ - */ - -/** @defgroup packet32h Packet.dll definitions and data structures - * Packet32.h contains the data structures and the definitions used by packet.dll. - * The file is used both by the Win9x and the WinNTx versions of packet.dll, and can be included - * by the applications that use the functions of this library - * @{ - */ - -#ifndef __PACKET32 -#define __PACKET32 - -#include -#include "devioctl.h" -#ifdef HAVE_DAG_API -#include -#endif /* HAVE_DAG_API */ - -// Working modes -#define PACKET_MODE_CAPT 0x0 ///< Capture mode -#define PACKET_MODE_STAT 0x1 ///< Statistical mode -#define PACKET_MODE_MON 0x2 ///< Monitoring mode -#define PACKET_MODE_DUMP 0x10 ///< Dump mode -#define PACKET_MODE_STAT_DUMP MODE_DUMP | MODE_STAT ///< Statistical dump Mode - -// ioctls -#define FILE_DEVICE_PROTOCOL 0x8000 - -#define IOCTL_PROTOCOL_STATISTICS CTL_CODE(FILE_DEVICE_PROTOCOL, 2 , METHOD_BUFFERED, FILE_ANY_ACCESS) -#define IOCTL_PROTOCOL_RESET CTL_CODE(FILE_DEVICE_PROTOCOL, 3 , METHOD_BUFFERED, FILE_ANY_ACCESS) -#define IOCTL_PROTOCOL_READ CTL_CODE(FILE_DEVICE_PROTOCOL, 4 , METHOD_BUFFERED, FILE_ANY_ACCESS) -#define IOCTL_PROTOCOL_WRITE CTL_CODE(FILE_DEVICE_PROTOCOL, 5 , METHOD_BUFFERED, FILE_ANY_ACCESS) -#define IOCTL_PROTOCOL_MACNAME CTL_CODE(FILE_DEVICE_PROTOCOL, 6 , METHOD_BUFFERED, FILE_ANY_ACCESS) -#define IOCTL_OPEN CTL_CODE(FILE_DEVICE_PROTOCOL, 7 , METHOD_BUFFERED, FILE_ANY_ACCESS) -#define IOCTL_CLOSE CTL_CODE(FILE_DEVICE_PROTOCOL, 8 , METHOD_BUFFERED, FILE_ANY_ACCESS) - -#define pBIOCSETBUFFERSIZE 9592 ///< IOCTL code: set kernel buffer size. -#define pBIOCSETF 9030 ///< IOCTL code: set packet filtering program. -#define pBIOCGSTATS 9031 ///< IOCTL code: get the capture stats. -#define pBIOCSRTIMEOUT 7416 ///< IOCTL code: set the read timeout. -#define pBIOCSMODE 7412 ///< IOCTL code: set working mode. -#define pBIOCSWRITEREP 7413 ///< IOCTL code: set number of physical repetions of every packet written by the app. -#define pBIOCSMINTOCOPY 7414 ///< IOCTL code: set minimum amount of data in the kernel buffer that unlocks a read call. -#define pBIOCSETOID 2147483648 ///< IOCTL code: set an OID value. -#define pBIOCQUERYOID 2147483652 ///< IOCTL code: get an OID value. -#define pATTACHPROCESS 7117 ///< IOCTL code: attach a process to the driver. Used in Win9x only. -#define pDETACHPROCESS 7118 ///< IOCTL code: detach a process from the driver. Used in Win9x only. -#define pBIOCSETDUMPFILENAME 9029 ///< IOCTL code: set the name of a the file used by kernel dump mode. -#define pBIOCEVNAME 7415 ///< IOCTL code: get the name of the event that the driver signals when some data is present in the buffer. -#define pBIOCSENDPACKETSNOSYNC 9032 ///< IOCTL code: Send a buffer containing multiple packets to the network, ignoring the timestamps associated with the packets. -#define pBIOCSENDPACKETSSYNC 9033 ///< IOCTL code: Send a buffer containing multiple packets to the network, respecting the timestamps associated with the packets. -#define pBIOCSETDUMPLIMITS 9034 ///< IOCTL code: Set the dump file limits. See the PacketSetDumpLimits() function. -#define pBIOCISETLOBBEH 7410 -#define pBIOCISDUMPENDED 7411 ///< IOCTL code: Get the status of the kernel dump process. See the PacketIsDumpEnded() function. - -#define pBIOCSTIMEZONE 7471 ///< IOCTL code: set time zone. Used in Win9x only. - - -/// Alignment macro. Defines the alignment size. -#define Packet_ALIGNMENT sizeof(int) -/// Alignment macro. Rounds up to the next even multiple of Packet_ALIGNMENT. -#define Packet_WORDALIGN(x) (((x)+(Packet_ALIGNMENT-1))&~(Packet_ALIGNMENT-1)) - - -#define NdisMediumNull -1 // Custom linktype: NDIS doesn't provide an equivalent -#define NdisMediumCHDLC -2 // Custom linktype: NDIS doesn't provide an equivalent -#define NdisMediumPPPSerial -3 // Custom linktype: NDIS doesn't provide an equivalent - -/*! - \brief Network type structure. - - This structure is used by the PacketGetNetType() function to return information on the current adapter's type and speed. -*/ -typedef struct NetType -{ - UINT LinkType; ///< The MAC of the current network adapter (see function PacketGetNetType() for more information) - ULONGLONG LinkSpeed; ///< The speed of the network in bits per second -}NetType; - - -//some definitions stolen from libpcap - -#ifndef BPF_MAJOR_VERSION - -/*! - \brief A BPF pseudo-assembly program. - - The program will be injected in the kernel by the PacketSetBPF() function and applied to every incoming packet. -*/ -struct bpf_program -{ - UINT bf_len; ///< Indicates the number of instructions of the program, i.e. the number of struct bpf_insn that will follow. - struct bpf_insn *bf_insns; ///< A pointer to the first instruction of the program. -}; - -/*! - \brief A single BPF pseudo-instruction. - - bpf_insn contains a single instruction for the BPF register-machine. It is used to send a filter program to the driver. -*/ -struct bpf_insn -{ - USHORT code; ///< Instruction type and addressing mode. - UCHAR jt; ///< Jump if true - UCHAR jf; ///< Jump if false - int k; ///< Generic field used for various purposes. -}; - -/*! - \brief Structure that contains a couple of statistics values on the current capture. - - It is used by packet.dll to return statistics about a capture session. -*/ -struct bpf_stat -{ - UINT bs_recv; ///< Number of packets that the driver received from the network adapter - ///< from the beginning of the current capture. This value includes the packets - ///< lost by the driver. - UINT bs_drop; ///< number of packets that the driver lost from the beginning of a capture. - ///< Basically, a packet is lost when the the buffer of the driver is full. - ///< In this situation the packet cannot be stored and the driver rejects it. - UINT ps_ifdrop; ///< drops by interface. XXX not yet supported - UINT bs_capt; ///< number of packets that pass the filter, find place in the kernel buffer and - ///< thus reach the application. -}; - -/*! - \brief Packet header. - - This structure defines the header associated with every packet delivered to the application. -*/ -struct bpf_hdr -{ - struct timeval bh_tstamp; ///< The timestamp associated with the captured packet. - ///< It is stored in a TimeVal structure. - UINT bh_caplen; ///< Length of captured portion. The captured portion can be different - ///< from the original packet, because it is possible (with a proper filter) - ///< to instruct the driver to capture only a portion of the packets. - UINT bh_datalen; ///< Original length of packet - USHORT bh_hdrlen; ///< Length of bpf header (this struct plus alignment padding). In some cases, - ///< a padding could be added between the end of this structure and the packet - ///< data for performance reasons. This filed can be used to retrieve the actual data - ///< of the packet. -}; - -/*! - \brief Dump packet header. - - This structure defines the header associated with the packets in a buffer to be used with PacketSendPackets(). - It is simpler than the bpf_hdr, because it corresponds to the header associated by WinPcap and libpcap to a - packet in a dump file. This makes straightforward sending WinPcap dump files to the network. -*/ -struct dump_bpf_hdr{ - struct timeval ts; ///< Time stamp of the packet - UINT caplen; ///< Length of captured portion. The captured portion can smaller than the - ///< the original packet, because it is possible (with a proper filter) to - ///< instruct the driver to capture only a portion of the packets. - UINT len; ///< Length of the original packet (off wire). -}; - - -#endif - -#define DOSNAMEPREFIX TEXT("Packet_") ///< Prefix added to the adapters device names to create the WinPcap devices -#define MAX_LINK_NAME_LENGTH 64 //< Maximum length of the devices symbolic links -#define NMAX_PACKET 65535 - -/*! - \brief Addresses of a network adapter. - - This structure is used by the PacketGetNetInfoEx() function to return the IP addresses associated with - an adapter. -*/ -typedef struct npf_if_addr { - struct sockaddr_storage IPAddress; ///< IP address. - struct sockaddr_storage SubnetMask; ///< Netmask for that address. - struct sockaddr_storage Broadcast; ///< Broadcast address. -}npf_if_addr; - - -#define ADAPTER_NAME_LENGTH 256 + 12 ///< Maximum length for the name of an adapter. The value is the same used by the IP Helper API. -#define ADAPTER_DESC_LENGTH 128 ///< Maximum length for the description of an adapter. The value is the same used by the IP Helper API. -#define MAX_MAC_ADDR_LENGTH 8 ///< Maximum length for the link layer address of an adapter. The value is the same used by the IP Helper API. -#define MAX_NETWORK_ADDRESSES 16 ///< Maximum length for the link layer address of an adapter. The value is the same used by the IP Helper API. - - -typedef struct WAN_ADAPTER_INT WAN_ADAPTER; ///< Describes an opened wan (dialup, VPN...) network adapter using the NetMon API -typedef WAN_ADAPTER *PWAN_ADAPTER; ///< Describes an opened wan (dialup, VPN...) network adapter using the NetMon API - -#define INFO_FLAG_NDIS_ADAPTER 0 ///< Flag for ADAPTER_INFO: this is a traditional ndis adapter -#define INFO_FLAG_NDISWAN_ADAPTER 1 ///< Flag for ADAPTER_INFO: this is a NdisWan adapter -#define INFO_FLAG_DAG_CARD 2 ///< Flag for ADAPTER_INFO: this is a DAG card -#define INFO_FLAG_DAG_FILE 6 ///< Flag for ADAPTER_INFO: this is a DAG file -#define INFO_FLAG_DONT_EXPORT 8 ///< Flag for ADAPTER_INFO: when this flag is set, the adapter will not be listed or openend by winpcap. This allows to prevent exporting broken network adapters, like for example FireWire ones. - -/*! - \brief Contains comprehensive information about a network adapter. - - This structure is filled with all the accessory information that the user can need about an adapter installed - on his system. -*/ -typedef struct _ADAPTER_INFO -{ - struct _ADAPTER_INFO *Next; ///< Pointer to the next adapter in the list. - CHAR Name[ADAPTER_NAME_LENGTH + 1]; ///< Name of the device representing the adapter. - CHAR Description[ADAPTER_DESC_LENGTH + 1]; ///< Human understandable description of the adapter - UINT MacAddressLen; ///< Length of the link layer address. - UCHAR MacAddress[MAX_MAC_ADDR_LENGTH]; ///< Link layer address. - NetType LinkLayer; ///< Physical characteristics of this adapter. This NetType structure contains the link type and the speed of the adapter. - INT NNetworkAddresses; ///< Number of network layer addresses of this adapter. - npf_if_addr *NetworkAddresses; ///< Pointer to an array of npf_if_addr, each of which specifies a network address of this adapter. - UINT Flags; ///< Adapter's flags. Tell if this adapter must be treated in a different way, using the Netmon API or the dagc API. -} -ADAPTER_INFO, *PADAPTER_INFO; - -/*! - \brief Describes an opened network adapter. - - This structure is the most important for the functioning of packet.dll, but the great part of its fields - should be ignored by the user, since the library offers functions that avoid to cope with low-level parameters -*/ -typedef struct _ADAPTER { - HANDLE hFile; ///< \internal Handle to an open instance of the NPF driver. - CHAR SymbolicLink[MAX_LINK_NAME_LENGTH]; ///< \internal A string containing the name of the network adapter currently opened. - int NumWrites; ///< \internal Number of times a packets written on this adapter will be repeated - ///< on the wire. - HANDLE ReadEvent; ///< A notification event associated with the read calls on the adapter. - ///< It can be passed to standard Win32 functions (like WaitForSingleObject - ///< or WaitForMultipleObjects) to wait until the driver's buffer contains some - ///< data. It is particularly useful in GUI applications that need to wait - ///< concurrently on several events. In Windows NT/2000 the PacketSetMinToCopy() - ///< function can be used to define the minimum amount of data in the kernel buffer - ///< that will cause the event to be signalled. - - UINT ReadTimeOut; ///< \internal The amount of time after which a read on the driver will be released and - ///< ReadEvent will be signaled, also if no packets were captured - CHAR Name[ADAPTER_NAME_LENGTH]; - PWAN_ADAPTER pWanAdapter; - UINT Flags; ///< Adapter's flags. Tell if this adapter must be treated in a different way, using the Netmon API or the dagc API. -#ifdef HAVE_DAG_API - dagc_t *pDagCard; ///< Pointer to the dagc API adapter descriptor for this adapter - PCHAR DagBuffer; ///< Pointer to the buffer with the packets that is received from the DAG card - struct timeval DagReadTimeout; ///< Read timeout. The dagc API requires a timeval structure - unsigned DagFcsLen; ///< Length of the frame check sequence attached to any packet by the card. Obtained from the registry - DWORD DagFastProcess; ///< True if the user requests fast capture processing on this card. Higher level applications can use this value to provide a faster but possibly unprecise capture (for example, libpcap doesn't convert the timestamps). -#endif // HAVE_DAG_API -} ADAPTER, *LPADAPTER; - -/*! - \brief Structure that contains a group of packets coming from the driver. - - This structure defines the header associated with every packet delivered to the application. -*/ -typedef struct _PACKET { - HANDLE hEvent; ///< \deprecated Still present for compatibility with old applications. - OVERLAPPED OverLapped; ///< \deprecated Still present for compatibility with old applications. - PVOID Buffer; ///< Buffer with containing the packets. See the PacketReceivePacket() for - ///< details about the organization of the data in this buffer - UINT Length; ///< Length of the buffer - DWORD ulBytesReceived; ///< Number of valid bytes present in the buffer, i.e. amount of data - ///< received by the last call to PacketReceivePacket() - BOOLEAN bIoComplete; ///< \deprecated Still present for compatibility with old applications. -} PACKET, *LPPACKET; - -/*! - \brief Structure containing an OID request. - - It is used by the PacketRequest() function to send an OID to the interface card driver. - It can be used, for example, to retrieve the status of the error counters on the adapter, its MAC address, - the list of the multicast groups defined on it, and so on. -*/ -struct _PACKET_OID_DATA { - ULONG Oid; ///< OID code. See the Microsoft DDK documentation or the file ntddndis.h - ///< for a complete list of valid codes. - ULONG Length; ///< Length of the data field - UCHAR Data[1]; ///< variable-length field that contains the information passed to or received - ///< from the adapter. -}; -typedef struct _PACKET_OID_DATA PACKET_OID_DATA, *PPACKET_OID_DATA; - - -#if _DBG -#define ODS(_x) OutputDebugString(TEXT(_x)) -#define ODSEx(_x, _y) -#else -#ifdef _DEBUG_TO_FILE -/*! - \brief Macro to print a debug string. The behavior differs depending on the debug level -*/ -#define ODS(_x) { \ - FILE *f; \ - f = fopen("winpcap_debug.txt", "a"); \ - fprintf(f, "%s", _x); \ - fclose(f); \ -} -/*! - \brief Macro to print debug data with the printf convention. The behavior differs depending on - the debug level -*/ -#define ODSEx(_x, _y) { \ - FILE *f; \ - f = fopen("winpcap_debug.txt", "a"); \ - fprintf(f, _x, _y); \ - fclose(f); \ -} - - - -LONG PacketDumpRegistryKey(PCHAR KeyName, PCHAR FileName); -#else -#define ODS(_x) -#define ODSEx(_x, _y) -#endif -#endif - -/* We load dynamically the dag library in order link it only when it's present on the system */ -#ifdef HAVE_DAG_API -typedef dagc_t* (*dagc_open_handler)(const char *source, unsigned flags, char *ebuf); ///< prototype used to dynamically load the dag dll -typedef void (*dagc_close_handler)(dagc_t *dagcfd); ///< prototype used to dynamically load the dag dll -typedef int (*dagc_getlinktype_handler)(dagc_t *dagcfd); ///< prototype used to dynamically load the dag dll -typedef int (*dagc_getlinkspeed_handler)(dagc_t *dagcfd); ///< prototype used to dynamically load the dag dll -typedef int (*dagc_setsnaplen_handler)(dagc_t *dagcfd, unsigned snaplen); ///< prototype used to dynamically load the dag dll -typedef unsigned (*dagc_getfcslen_handler)(dagc_t *dagcfd); ///< prototype used to dynamically load the dag dll -typedef int (*dagc_receive_handler)(dagc_t *dagcfd, u_char **buffer, u_int *bufsize); ///< prototype used to dynamically load the dag dll -typedef int (*dagc_stats_handler)(dagc_t *dagcfd, dagc_stats_t *ps); ///< prototype used to dynamically load the dag dll -typedef int (*dagc_wait_handler)(dagc_t *dagcfd, struct timeval *timeout); ///< prototype used to dynamically load the dag dll -typedef int (*dagc_finddevs_handler)(dagc_if_t **alldevsp, char *ebuf); ///< prototype used to dynamically load the dag dll -typedef int (*dagc_freedevs_handler)(dagc_if_t *alldevsp); ///< prototype used to dynamically load the dag dll -#endif // HAVE_DAG_API - -#ifdef __cplusplus -extern "C" { -#endif - -/** - * @} - */ - -// The following is used to check the adapter name in PacketOpenAdapterNPF and prevent -// opening of firewire adapters -#define FIREWIRE_SUBSTR L"1394" - -void PacketPopulateAdaptersInfoList(); -PWCHAR SChar2WChar(PCHAR string); -PCHAR WChar2SChar(PWCHAR string); -BOOL PacketGetFileVersion(LPTSTR FileName, PCHAR VersionBuff, UINT VersionBuffLen); -PADAPTER_INFO PacketFindAdInfo(PCHAR AdapterName); -BOOLEAN PacketUpdateAdInfo(PCHAR AdapterName); -BOOLEAN IsFireWire(TCHAR *AdapterDesc); - - -//--------------------------------------------------------------------------- -// EXPORTED FUNCTIONS -//--------------------------------------------------------------------------- - -PCHAR PacketGetVersion(); -PCHAR PacketGetDriverVersion(); -BOOLEAN PacketSetMinToCopy(LPADAPTER AdapterObject,int nbytes); -BOOLEAN PacketSetNumWrites(LPADAPTER AdapterObject,int nwrites); -BOOLEAN PacketSetMode(LPADAPTER AdapterObject,int mode); -BOOLEAN PacketSetReadTimeout(LPADAPTER AdapterObject,int timeout); -BOOLEAN PacketSetBpf(LPADAPTER AdapterObject,struct bpf_program *fp); -INT PacketSetSnapLen(LPADAPTER AdapterObject,int snaplen); -BOOLEAN PacketGetStats(LPADAPTER AdapterObject,struct bpf_stat *s); -BOOLEAN PacketGetStatsEx(LPADAPTER AdapterObject,struct bpf_stat *s); -BOOLEAN PacketSetBuff(LPADAPTER AdapterObject,int dim); -BOOLEAN PacketGetNetType (LPADAPTER AdapterObject,NetType *type); -LPADAPTER PacketOpenAdapter(PCHAR AdapterName); -BOOLEAN PacketSendPacket(LPADAPTER AdapterObject,LPPACKET pPacket,BOOLEAN Sync); -INT PacketSendPackets(LPADAPTER AdapterObject,PVOID PacketBuff,ULONG Size, BOOLEAN Sync); -LPPACKET PacketAllocatePacket(void); -VOID PacketInitPacket(LPPACKET lpPacket,PVOID Buffer,UINT Length); -VOID PacketFreePacket(LPPACKET lpPacket); -BOOLEAN PacketReceivePacket(LPADAPTER AdapterObject,LPPACKET lpPacket,BOOLEAN Sync); -BOOLEAN PacketSetHwFilter(LPADAPTER AdapterObject,ULONG Filter); -BOOLEAN PacketGetAdapterNames(PTSTR pStr,PULONG BufferSize); -BOOLEAN PacketGetNetInfoEx(PCHAR AdapterName, npf_if_addr* buffer, PLONG NEntries); -BOOLEAN PacketRequest(LPADAPTER AdapterObject,BOOLEAN Set,PPACKET_OID_DATA OidData); -HANDLE PacketGetReadEvent(LPADAPTER AdapterObject); -BOOLEAN PacketSetDumpName(LPADAPTER AdapterObject, void *name, int len); -BOOLEAN PacketSetDumpLimits(LPADAPTER AdapterObject, UINT maxfilesize, UINT maxnpacks); -BOOLEAN PacketIsDumpEnded(LPADAPTER AdapterObject, BOOLEAN sync); -BOOL PacketStopDriver(); -VOID PacketCloseAdapter(LPADAPTER lpAdapter); - -#ifdef __cplusplus -} -#endif - -#endif //__PACKET32 +/* + * Copyright (c) 1999 - 2003 + * NetGroup, Politecnico di Torino (Italy) + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the Politecnico di Torino nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +/** @ingroup packetapi + * @{ + */ + +/** @defgroup packet32h Packet.dll definitions and data structures + * Packet32.h contains the data structures and the definitions used by packet.dll. + * The file is used both by the Win9x and the WinNTx versions of packet.dll, and can be included + * by the applications that use the functions of this library + * @{ + */ + +#ifndef __PACKET32 +#define __PACKET32 + +#include +#include "devioctl.h" +#ifdef HAVE_DAG_API +#include +#endif /* HAVE_DAG_API */ + +// Working modes +#define PACKET_MODE_CAPT 0x0 ///< Capture mode +#define PACKET_MODE_STAT 0x1 ///< Statistical mode +#define PACKET_MODE_MON 0x2 ///< Monitoring mode +#define PACKET_MODE_DUMP 0x10 ///< Dump mode +#define PACKET_MODE_STAT_DUMP MODE_DUMP | MODE_STAT ///< Statistical dump Mode + +// ioctls +#define FILE_DEVICE_PROTOCOL 0x8000 + +#define IOCTL_PROTOCOL_STATISTICS CTL_CODE(FILE_DEVICE_PROTOCOL, 2 , METHOD_BUFFERED, FILE_ANY_ACCESS) +#define IOCTL_PROTOCOL_RESET CTL_CODE(FILE_DEVICE_PROTOCOL, 3 , METHOD_BUFFERED, FILE_ANY_ACCESS) +#define IOCTL_PROTOCOL_READ CTL_CODE(FILE_DEVICE_PROTOCOL, 4 , METHOD_BUFFERED, FILE_ANY_ACCESS) +#define IOCTL_PROTOCOL_WRITE CTL_CODE(FILE_DEVICE_PROTOCOL, 5 , METHOD_BUFFERED, FILE_ANY_ACCESS) +#define IOCTL_PROTOCOL_MACNAME CTL_CODE(FILE_DEVICE_PROTOCOL, 6 , METHOD_BUFFERED, FILE_ANY_ACCESS) +#define IOCTL_OPEN CTL_CODE(FILE_DEVICE_PROTOCOL, 7 , METHOD_BUFFERED, FILE_ANY_ACCESS) +#define IOCTL_CLOSE CTL_CODE(FILE_DEVICE_PROTOCOL, 8 , METHOD_BUFFERED, FILE_ANY_ACCESS) + +#define pBIOCSETBUFFERSIZE 9592 ///< IOCTL code: set kernel buffer size. +#define pBIOCSETF 9030 ///< IOCTL code: set packet filtering program. +#define pBIOCGSTATS 9031 ///< IOCTL code: get the capture stats. +#define pBIOCSRTIMEOUT 7416 ///< IOCTL code: set the read timeout. +#define pBIOCSMODE 7412 ///< IOCTL code: set working mode. +#define pBIOCSWRITEREP 7413 ///< IOCTL code: set number of physical repetions of every packet written by the app. +#define pBIOCSMINTOCOPY 7414 ///< IOCTL code: set minimum amount of data in the kernel buffer that unlocks a read call. +#define pBIOCSETOID 2147483648 ///< IOCTL code: set an OID value. +#define pBIOCQUERYOID 2147483652 ///< IOCTL code: get an OID value. +#define pATTACHPROCESS 7117 ///< IOCTL code: attach a process to the driver. Used in Win9x only. +#define pDETACHPROCESS 7118 ///< IOCTL code: detach a process from the driver. Used in Win9x only. +#define pBIOCSETDUMPFILENAME 9029 ///< IOCTL code: set the name of a the file used by kernel dump mode. +#define pBIOCEVNAME 7415 ///< IOCTL code: get the name of the event that the driver signals when some data is present in the buffer. +#define pBIOCSENDPACKETSNOSYNC 9032 ///< IOCTL code: Send a buffer containing multiple packets to the network, ignoring the timestamps associated with the packets. +#define pBIOCSENDPACKETSSYNC 9033 ///< IOCTL code: Send a buffer containing multiple packets to the network, respecting the timestamps associated with the packets. +#define pBIOCSETDUMPLIMITS 9034 ///< IOCTL code: Set the dump file limits. See the PacketSetDumpLimits() function. +#define pBIOCISETLOBBEH 7410 +#define pBIOCISDUMPENDED 7411 ///< IOCTL code: Get the status of the kernel dump process. See the PacketIsDumpEnded() function. + +#define pBIOCSTIMEZONE 7471 ///< IOCTL code: set time zone. Used in Win9x only. + + +/// Alignment macro. Defines the alignment size. +#define Packet_ALIGNMENT sizeof(int) +/// Alignment macro. Rounds up to the next even multiple of Packet_ALIGNMENT. +#define Packet_WORDALIGN(x) (((x)+(Packet_ALIGNMENT-1))&~(Packet_ALIGNMENT-1)) + + +#define NdisMediumNull -1 // Custom linktype: NDIS doesn't provide an equivalent +#define NdisMediumCHDLC -2 // Custom linktype: NDIS doesn't provide an equivalent +#define NdisMediumPPPSerial -3 // Custom linktype: NDIS doesn't provide an equivalent + +/*! + \brief Network type structure. + + This structure is used by the PacketGetNetType() function to return information on the current adapter's type and speed. +*/ +typedef struct NetType +{ + UINT LinkType; ///< The MAC of the current network adapter (see function PacketGetNetType() for more information) + ULONGLONG LinkSpeed; ///< The speed of the network in bits per second +}NetType; + + +//some definitions stolen from libpcap + +#ifndef BPF_MAJOR_VERSION + +/*! + \brief A BPF pseudo-assembly program. + + The program will be injected in the kernel by the PacketSetBPF() function and applied to every incoming packet. +*/ +struct bpf_program +{ + UINT bf_len; ///< Indicates the number of instructions of the program, i.e. the number of struct bpf_insn that will follow. + struct bpf_insn *bf_insns; ///< A pointer to the first instruction of the program. +}; + +/*! + \brief A single BPF pseudo-instruction. + + bpf_insn contains a single instruction for the BPF register-machine. It is used to send a filter program to the driver. +*/ +struct bpf_insn +{ + USHORT code; ///< Instruction type and addressing mode. + UCHAR jt; ///< Jump if true + UCHAR jf; ///< Jump if false + int k; ///< Generic field used for various purposes. +}; + +/*! + \brief Structure that contains a couple of statistics values on the current capture. + + It is used by packet.dll to return statistics about a capture session. +*/ +struct bpf_stat +{ + UINT bs_recv; ///< Number of packets that the driver received from the network adapter + ///< from the beginning of the current capture. This value includes the packets + ///< lost by the driver. + UINT bs_drop; ///< number of packets that the driver lost from the beginning of a capture. + ///< Basically, a packet is lost when the the buffer of the driver is full. + ///< In this situation the packet cannot be stored and the driver rejects it. + UINT ps_ifdrop; ///< drops by interface. XXX not yet supported + UINT bs_capt; ///< number of packets that pass the filter, find place in the kernel buffer and + ///< thus reach the application. +}; + +/*! + \brief Packet header. + + This structure defines the header associated with every packet delivered to the application. +*/ +struct bpf_hdr +{ + struct timeval bh_tstamp; ///< The timestamp associated with the captured packet. + ///< It is stored in a TimeVal structure. + UINT bh_caplen; ///< Length of captured portion. The captured portion can be different + ///< from the original packet, because it is possible (with a proper filter) + ///< to instruct the driver to capture only a portion of the packets. + UINT bh_datalen; ///< Original length of packet + USHORT bh_hdrlen; ///< Length of bpf header (this struct plus alignment padding). In some cases, + ///< a padding could be added between the end of this structure and the packet + ///< data for performance reasons. This filed can be used to retrieve the actual data + ///< of the packet. +}; + +/*! + \brief Dump packet header. + + This structure defines the header associated with the packets in a buffer to be used with PacketSendPackets(). + It is simpler than the bpf_hdr, because it corresponds to the header associated by WinPcap and libpcap to a + packet in a dump file. This makes straightforward sending WinPcap dump files to the network. +*/ +struct dump_bpf_hdr{ + struct timeval ts; ///< Time stamp of the packet + UINT caplen; ///< Length of captured portion. The captured portion can smaller than the + ///< the original packet, because it is possible (with a proper filter) to + ///< instruct the driver to capture only a portion of the packets. + UINT len; ///< Length of the original packet (off wire). +}; + + +#endif + +#define DOSNAMEPREFIX TEXT("Packet_") ///< Prefix added to the adapters device names to create the WinPcap devices +#define MAX_LINK_NAME_LENGTH 64 //< Maximum length of the devices symbolic links +#define NMAX_PACKET 65535 + +/*! + \brief Addresses of a network adapter. + + This structure is used by the PacketGetNetInfoEx() function to return the IP addresses associated with + an adapter. +*/ +typedef struct npf_if_addr { + struct sockaddr_storage IPAddress; ///< IP address. + struct sockaddr_storage SubnetMask; ///< Netmask for that address. + struct sockaddr_storage Broadcast; ///< Broadcast address. +}npf_if_addr; + + +#define ADAPTER_NAME_LENGTH 256 + 12 ///< Maximum length for the name of an adapter. The value is the same used by the IP Helper API. +#define ADAPTER_DESC_LENGTH 128 ///< Maximum length for the description of an adapter. The value is the same used by the IP Helper API. +#define MAX_MAC_ADDR_LENGTH 8 ///< Maximum length for the link layer address of an adapter. The value is the same used by the IP Helper API. +#define MAX_NETWORK_ADDRESSES 16 ///< Maximum length for the link layer address of an adapter. The value is the same used by the IP Helper API. + + +typedef struct WAN_ADAPTER_INT WAN_ADAPTER; ///< Describes an opened wan (dialup, VPN...) network adapter using the NetMon API +typedef WAN_ADAPTER *PWAN_ADAPTER; ///< Describes an opened wan (dialup, VPN...) network adapter using the NetMon API + +#define INFO_FLAG_NDIS_ADAPTER 0 ///< Flag for ADAPTER_INFO: this is a traditional ndis adapter +#define INFO_FLAG_NDISWAN_ADAPTER 1 ///< Flag for ADAPTER_INFO: this is a NdisWan adapter +#define INFO_FLAG_DAG_CARD 2 ///< Flag for ADAPTER_INFO: this is a DAG card +#define INFO_FLAG_DAG_FILE 6 ///< Flag for ADAPTER_INFO: this is a DAG file +#define INFO_FLAG_DONT_EXPORT 8 ///< Flag for ADAPTER_INFO: when this flag is set, the adapter will not be listed or openend by winpcap. This allows to prevent exporting broken network adapters, like for example FireWire ones. + +/*! + \brief Contains comprehensive information about a network adapter. + + This structure is filled with all the accessory information that the user can need about an adapter installed + on his system. +*/ +typedef struct _ADAPTER_INFO +{ + struct _ADAPTER_INFO *Next; ///< Pointer to the next adapter in the list. + CHAR Name[ADAPTER_NAME_LENGTH + 1]; ///< Name of the device representing the adapter. + CHAR Description[ADAPTER_DESC_LENGTH + 1]; ///< Human understandable description of the adapter + UINT MacAddressLen; ///< Length of the link layer address. + UCHAR MacAddress[MAX_MAC_ADDR_LENGTH]; ///< Link layer address. + NetType LinkLayer; ///< Physical characteristics of this adapter. This NetType structure contains the link type and the speed of the adapter. + INT NNetworkAddresses; ///< Number of network layer addresses of this adapter. + npf_if_addr *NetworkAddresses; ///< Pointer to an array of npf_if_addr, each of which specifies a network address of this adapter. + UINT Flags; ///< Adapter's flags. Tell if this adapter must be treated in a different way, using the Netmon API or the dagc API. +} +ADAPTER_INFO, *PADAPTER_INFO; + +/*! + \brief Describes an opened network adapter. + + This structure is the most important for the functioning of packet.dll, but the great part of its fields + should be ignored by the user, since the library offers functions that avoid to cope with low-level parameters +*/ +typedef struct _ADAPTER { + HANDLE hFile; ///< \internal Handle to an open instance of the NPF driver. + CHAR SymbolicLink[MAX_LINK_NAME_LENGTH]; ///< \internal A string containing the name of the network adapter currently opened. + int NumWrites; ///< \internal Number of times a packets written on this adapter will be repeated + ///< on the wire. + HANDLE ReadEvent; ///< A notification event associated with the read calls on the adapter. + ///< It can be passed to standard Win32 functions (like WaitForSingleObject + ///< or WaitForMultipleObjects) to wait until the driver's buffer contains some + ///< data. It is particularly useful in GUI applications that need to wait + ///< concurrently on several events. In Windows NT/2000 the PacketSetMinToCopy() + ///< function can be used to define the minimum amount of data in the kernel buffer + ///< that will cause the event to be signalled. + + UINT ReadTimeOut; ///< \internal The amount of time after which a read on the driver will be released and + ///< ReadEvent will be signaled, also if no packets were captured + CHAR Name[ADAPTER_NAME_LENGTH]; + PWAN_ADAPTER pWanAdapter; + UINT Flags; ///< Adapter's flags. Tell if this adapter must be treated in a different way, using the Netmon API or the dagc API. +#ifdef HAVE_DAG_API + dagc_t *pDagCard; ///< Pointer to the dagc API adapter descriptor for this adapter + PCHAR DagBuffer; ///< Pointer to the buffer with the packets that is received from the DAG card + struct timeval DagReadTimeout; ///< Read timeout. The dagc API requires a timeval structure + unsigned DagFcsLen; ///< Length of the frame check sequence attached to any packet by the card. Obtained from the registry + DWORD DagFastProcess; ///< True if the user requests fast capture processing on this card. Higher level applications can use this value to provide a faster but possibly unprecise capture (for example, libpcap doesn't convert the timestamps). +#endif // HAVE_DAG_API +} ADAPTER, *LPADAPTER; + +/*! + \brief Structure that contains a group of packets coming from the driver. + + This structure defines the header associated with every packet delivered to the application. +*/ +typedef struct _PACKET { + HANDLE hEvent; ///< \deprecated Still present for compatibility with old applications. + OVERLAPPED OverLapped; ///< \deprecated Still present for compatibility with old applications. + PVOID Buffer; ///< Buffer with containing the packets. See the PacketReceivePacket() for + ///< details about the organization of the data in this buffer + UINT Length; ///< Length of the buffer + DWORD ulBytesReceived; ///< Number of valid bytes present in the buffer, i.e. amount of data + ///< received by the last call to PacketReceivePacket() + BOOLEAN bIoComplete; ///< \deprecated Still present for compatibility with old applications. +} PACKET, *LPPACKET; + +/*! + \brief Structure containing an OID request. + + It is used by the PacketRequest() function to send an OID to the interface card driver. + It can be used, for example, to retrieve the status of the error counters on the adapter, its MAC address, + the list of the multicast groups defined on it, and so on. +*/ +struct _PACKET_OID_DATA { + ULONG Oid; ///< OID code. See the Microsoft DDK documentation or the file ntddndis.h + ///< for a complete list of valid codes. + ULONG Length; ///< Length of the data field + UCHAR Data[1]; ///< variable-length field that contains the information passed to or received + ///< from the adapter. +}; +typedef struct _PACKET_OID_DATA PACKET_OID_DATA, *PPACKET_OID_DATA; + + +#if _DBG +#define ODS(_x) OutputDebugString(TEXT(_x)) +#define ODSEx(_x, _y) +#else +#ifdef _DEBUG_TO_FILE +/*! + \brief Macro to print a debug string. The behavior differs depending on the debug level +*/ +#define ODS(_x) { \ + FILE *f; \ + f = fopen("winpcap_debug.txt", "a"); \ + fprintf(f, "%s", _x); \ + fclose(f); \ +} +/*! + \brief Macro to print debug data with the printf convention. The behavior differs depending on + the debug level +*/ +#define ODSEx(_x, _y) { \ + FILE *f; \ + f = fopen("winpcap_debug.txt", "a"); \ + fprintf(f, _x, _y); \ + fclose(f); \ +} + + + +LONG PacketDumpRegistryKey(PCHAR KeyName, PCHAR FileName); +#else +#define ODS(_x) +#define ODSEx(_x, _y) +#endif +#endif + +/* We load dynamically the dag library in order link it only when it's present on the system */ +#ifdef HAVE_DAG_API +typedef dagc_t* (*dagc_open_handler)(const char *source, unsigned flags, char *ebuf); ///< prototype used to dynamically load the dag dll +typedef void (*dagc_close_handler)(dagc_t *dagcfd); ///< prototype used to dynamically load the dag dll +typedef int (*dagc_getlinktype_handler)(dagc_t *dagcfd); ///< prototype used to dynamically load the dag dll +typedef int (*dagc_getlinkspeed_handler)(dagc_t *dagcfd); ///< prototype used to dynamically load the dag dll +typedef int (*dagc_setsnaplen_handler)(dagc_t *dagcfd, unsigned snaplen); ///< prototype used to dynamically load the dag dll +typedef unsigned (*dagc_getfcslen_handler)(dagc_t *dagcfd); ///< prototype used to dynamically load the dag dll +typedef int (*dagc_receive_handler)(dagc_t *dagcfd, u_char **buffer, u_int *bufsize); ///< prototype used to dynamically load the dag dll +typedef int (*dagc_stats_handler)(dagc_t *dagcfd, dagc_stats_t *ps); ///< prototype used to dynamically load the dag dll +typedef int (*dagc_wait_handler)(dagc_t *dagcfd, struct timeval *timeout); ///< prototype used to dynamically load the dag dll +typedef int (*dagc_finddevs_handler)(dagc_if_t **alldevsp, char *ebuf); ///< prototype used to dynamically load the dag dll +typedef int (*dagc_freedevs_handler)(dagc_if_t *alldevsp); ///< prototype used to dynamically load the dag dll +#endif // HAVE_DAG_API + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * @} + */ + +// The following is used to check the adapter name in PacketOpenAdapterNPF and prevent +// opening of firewire adapters +#define FIREWIRE_SUBSTR L"1394" + +void PacketPopulateAdaptersInfoList(); +PWCHAR SChar2WChar(PCHAR string); +PCHAR WChar2SChar(PWCHAR string); +BOOL PacketGetFileVersion(LPTSTR FileName, PCHAR VersionBuff, UINT VersionBuffLen); +PADAPTER_INFO PacketFindAdInfo(PCHAR AdapterName); +BOOLEAN PacketUpdateAdInfo(PCHAR AdapterName); +BOOLEAN IsFireWire(TCHAR *AdapterDesc); + + +//--------------------------------------------------------------------------- +// EXPORTED FUNCTIONS +//--------------------------------------------------------------------------- + +PCHAR PacketGetVersion(); +PCHAR PacketGetDriverVersion(); +BOOLEAN PacketSetMinToCopy(LPADAPTER AdapterObject,int nbytes); +BOOLEAN PacketSetNumWrites(LPADAPTER AdapterObject,int nwrites); +BOOLEAN PacketSetMode(LPADAPTER AdapterObject,int mode); +BOOLEAN PacketSetReadTimeout(LPADAPTER AdapterObject,int timeout); +BOOLEAN PacketSetBpf(LPADAPTER AdapterObject,struct bpf_program *fp); +INT PacketSetSnapLen(LPADAPTER AdapterObject,int snaplen); +BOOLEAN PacketGetStats(LPADAPTER AdapterObject,struct bpf_stat *s); +BOOLEAN PacketGetStatsEx(LPADAPTER AdapterObject,struct bpf_stat *s); +BOOLEAN PacketSetBuff(LPADAPTER AdapterObject,int dim); +BOOLEAN PacketGetNetType (LPADAPTER AdapterObject,NetType *type); +LPADAPTER PacketOpenAdapter(PCHAR AdapterName); +BOOLEAN PacketSendPacket(LPADAPTER AdapterObject,LPPACKET pPacket,BOOLEAN Sync); +INT PacketSendPackets(LPADAPTER AdapterObject,PVOID PacketBuff,ULONG Size, BOOLEAN Sync); +LPPACKET PacketAllocatePacket(void); +VOID PacketInitPacket(LPPACKET lpPacket,PVOID Buffer,UINT Length); +VOID PacketFreePacket(LPPACKET lpPacket); +BOOLEAN PacketReceivePacket(LPADAPTER AdapterObject,LPPACKET lpPacket,BOOLEAN Sync); +BOOLEAN PacketSetHwFilter(LPADAPTER AdapterObject,ULONG Filter); +BOOLEAN PacketGetAdapterNames(PTSTR pStr,PULONG BufferSize); +BOOLEAN PacketGetNetInfoEx(PCHAR AdapterName, npf_if_addr* buffer, PLONG NEntries); +BOOLEAN PacketRequest(LPADAPTER AdapterObject,BOOLEAN Set,PPACKET_OID_DATA OidData); +HANDLE PacketGetReadEvent(LPADAPTER AdapterObject); +BOOLEAN PacketSetDumpName(LPADAPTER AdapterObject, void *name, int len); +BOOLEAN PacketSetDumpLimits(LPADAPTER AdapterObject, UINT maxfilesize, UINT maxnpacks); +BOOLEAN PacketIsDumpEnded(LPADAPTER AdapterObject, BOOLEAN sync); +BOOL PacketStopDriver(); +VOID PacketCloseAdapter(LPADAPTER lpAdapter); + +#ifdef __cplusplus +} +#endif + +#endif //__PACKET32 diff --git a/src/SeeDll/SeeDll.rc b/src/SeeDll/SeeDll.rc index c0238161..1dde551d 100644 --- a/src/SeeDll/SeeDll.rc +++ b/src/SeeDll/SeeDll.rc @@ -1,63 +1,63 @@ -// Microsoft Visual C++ generated resource script. -// -#include "resource.h" - -#define APSTUDIO_READONLY_SYMBOLS -///////////////////////////////////////////////////////////////////////////// -// -// Generated from the TEXTINCLUDE 2 resource. -// -#include "winres.h" - -///////////////////////////////////////////////////////////////////////////// -#undef APSTUDIO_READONLY_SYMBOLS - -///////////////////////////////////////////////////////////////////////////// -// Japanese resources - -#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_JPN) -#ifdef _WIN32 -LANGUAGE LANG_JAPANESE, SUBLANG_DEFAULT -#pragma code_page(932) -#endif //_WIN32 - -#ifdef APSTUDIO_INVOKED -///////////////////////////////////////////////////////////////////////////// -// -// TEXTINCLUDE -// - -1 TEXTINCLUDE -BEGIN - "resource.h\0" -END - -2 TEXTINCLUDE -BEGIN - "#include ""winres.h""\r\n" - "\0" -END - -3 TEXTINCLUDE -BEGIN - "\r\n" - "\0" -END - -#endif // APSTUDIO_INVOKED - -#endif // Japanese resources -///////////////////////////////////////////////////////////////////////////// - - - -#ifndef APSTUDIO_INVOKED -///////////////////////////////////////////////////////////////////////////// -// -// Generated from the TEXTINCLUDE 3 resource. -// - - -///////////////////////////////////////////////////////////////////////////// -#endif // not APSTUDIO_INVOKED - +// Microsoft Visual C++ generated resource script. +// +#include "resource.h" + +#define APSTUDIO_READONLY_SYMBOLS +///////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 2 resource. +// +#include "winres.h" + +///////////////////////////////////////////////////////////////////////////// +#undef APSTUDIO_READONLY_SYMBOLS + +///////////////////////////////////////////////////////////////////////////// +// Japanese resources + +#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_JPN) +#ifdef _WIN32 +LANGUAGE LANG_JAPANESE, SUBLANG_DEFAULT +#pragma code_page(932) +#endif //_WIN32 + +#ifdef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// TEXTINCLUDE +// + +1 TEXTINCLUDE +BEGIN + "resource.h\0" +END + +2 TEXTINCLUDE +BEGIN + "#include ""winres.h""\r\n" + "\0" +END + +3 TEXTINCLUDE +BEGIN + "\r\n" + "\0" +END + +#endif // APSTUDIO_INVOKED + +#endif // Japanese resources +///////////////////////////////////////////////////////////////////////////// + + + +#ifndef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 3 resource. +// + + +///////////////////////////////////////////////////////////////////////////// +#endif // not APSTUDIO_INVOKED + diff --git a/src/SeeDll/SeeDll.vcproj b/src/SeeDll/SeeDll.vcproj index ec55be90..713926cd 100644 --- a/src/SeeDll/SeeDll.vcproj +++ b/src/SeeDll/SeeDll.vcproj @@ -1,290 +1,290 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/SeeDll/See_Win32.def b/src/SeeDll/See_Win32.def index 4c5c64f8..c95dd8bc 100644 --- a/src/SeeDll/See_Win32.def +++ b/src/SeeDll/See_Win32.def @@ -1,34 +1,34 @@ -LIBRARY see - -EXPORTS - PacketLibraryVersion - PacketGetVersion - PacketGetDriverVersion - PacketOpenAdapter - PacketSendPacket - PacketSendPackets - PacketAllocatePacket - PacketInitPacket - PacketFreePacket - PacketReceivePacket - PacketCloseAdapter - PacketSetHwFilter - PacketGetAdapterNames - PacketRequest - PacketSetBuff - PacketSetBpf - PacketSetSnapLen - PacketGetStats - PacketGetStatsEx - PacketGetNetType - PacketSetReadTimeout - PacketSetMode - PacketSetNumWrites - PacketGetNetInfoEx - PacketSetMinToCopy - PacketGetReadEvent - PacketStopDriver - PacketSetDumpName - PacketSetDumpLimits - PacketIsDumpEnded - PacketSetLoopbackBehavior +LIBRARY see + +EXPORTS + PacketLibraryVersion + PacketGetVersion + PacketGetDriverVersion + PacketOpenAdapter + PacketSendPacket + PacketSendPackets + PacketAllocatePacket + PacketInitPacket + PacketFreePacket + PacketReceivePacket + PacketCloseAdapter + PacketSetHwFilter + PacketGetAdapterNames + PacketRequest + PacketSetBuff + PacketSetBpf + PacketSetSnapLen + PacketGetStats + PacketGetStatsEx + PacketGetNetType + PacketSetReadTimeout + PacketSetMode + PacketSetNumWrites + PacketGetNetInfoEx + PacketSetMinToCopy + PacketGetReadEvent + PacketStopDriver + PacketSetDumpName + PacketSetDumpLimits + PacketIsDumpEnded + PacketSetLoopbackBehavior diff --git a/src/SeeDll/See_x64.def b/src/SeeDll/See_x64.def index 5f30a5fd..badc385f 100644 --- a/src/SeeDll/See_x64.def +++ b/src/SeeDll/See_x64.def @@ -1,34 +1,34 @@ -LIBRARY see_x64 - -EXPORTS - PacketLibraryVersion - PacketGetVersion - PacketGetDriverVersion - PacketOpenAdapter - PacketSendPacket - PacketSendPackets - PacketAllocatePacket - PacketInitPacket - PacketFreePacket - PacketReceivePacket - PacketCloseAdapter - PacketSetHwFilter - PacketGetAdapterNames - PacketRequest - PacketSetBuff - PacketSetBpf - PacketSetSnapLen - PacketGetStats - PacketGetStatsEx - PacketGetNetType - PacketSetReadTimeout - PacketSetMode - PacketSetNumWrites - PacketGetNetInfoEx - PacketSetMinToCopy - PacketGetReadEvent - PacketStopDriver - PacketSetDumpName - PacketSetDumpLimits - PacketIsDumpEnded - PacketSetLoopbackBehavior +LIBRARY see_x64 + +EXPORTS + PacketLibraryVersion + PacketGetVersion + PacketGetDriverVersion + PacketOpenAdapter + PacketSendPacket + PacketSendPackets + PacketAllocatePacket + PacketInitPacket + PacketFreePacket + PacketReceivePacket + PacketCloseAdapter + PacketSetHwFilter + PacketGetAdapterNames + PacketRequest + PacketSetBuff + PacketSetBpf + PacketSetSnapLen + PacketGetStats + PacketGetStatsEx + PacketGetNetType + PacketSetReadTimeout + PacketSetMode + PacketSetNumWrites + PacketGetNetInfoEx + PacketSetMinToCopy + PacketGetReadEvent + PacketStopDriver + PacketSetDumpName + PacketSetDumpLimits + PacketIsDumpEnded + PacketSetLoopbackBehavior diff --git a/src/SeeDll/dagc.h b/src/SeeDll/dagc.h index e676e40c..e3d3d512 100644 --- a/src/SeeDll/dagc.h +++ b/src/SeeDll/dagc.h @@ -1,225 +1,225 @@ -/* - * Copyright (c) 2003 - * NetGroup, Politecnico di Torino (Italy) - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the Politecnico di Torino nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - */ - -#define DAGC_ERRBUF_SIZE 512 -#define FILEBUFSIZE 65536 -#define MAXDAGCARDS 32 - -#ifndef _WIN32 - -typedef long long long_long; -typedef long long ull_t; -#define TRUE 1 -#define devicestring "/dev/dag%d" -#define dagc_sleepms(_MS) usleep(_MS * 1000) -#else /* _WIN32 */ - -typedef LONGLONG long_long; -typedef ULONGLONG ull_t; -#define dagc_sleepms(_MS) Sleep(_MS) -#define devicestring "\\\\.\\dag%d" - -#endif /* _WIN32 */ - -#define MIN_DAG_SNAPLEN 12 -#define MAX_DAG_SNAPLEN 2040 - -#define erffilestring "erffile://" - - -#define ATM_SNAPLEN 48 -/* Size of ATM payload */ -#define ATM_WLEN(h) ATM_SNAPLEN -#define ATM_SLEN(h) ATM_SNAPLEN - -/* Size Ethernet payload */ -#define ETHERNET_WLEN(h, b) ((u_int)ntohs((h)->wlen) - ((b) >> 3)) -#define ETHERNET_SLEN(h, b) min(ETHERNET_WLEN(h, b), \ - (u_int)ntohs((h)->rlen) - dag_record_size - 2) - -/* Size of HDLC payload */ -#define HDLC_WLEN(h, b) ((u_int)ntohs((h)->wlen) - ((b) >> 3)) -#define HDLC_SLEN(h, b) min(HDLC_WLEN(h, b), \ - (u_int)ntohs((h)->rlen) - dag_record_size) - -/* Flags for dagc_open */ -#define DAGC_OPEN_SHARED 1 -#define DAGC_OPEN_EXCLUSIVE 2 - -#define TYPE_LEGACY 0 -#define TYPE_HDLC_POS 1 -#define TYPE_ETH 2 -#define TYPE_ATM 3 -#define TYPE_AAL5 4 - -/* - * Card statistics. - */ -typedef struct dagc_stats_t -{ - ull_t received; /* (NOT IMPLEMENTED) total number of frames received by the DAG */ - ull_t dropped; /* number of frames dropped for buffer full */ - ull_t captured; /* (NOT IMPLEMENTED) number of frames that actually reach the - application, i.e that are not filtered or dropped */ -} dagc_stats_t; - -/* - * Descriptor of an open session. - * Note: the dagc_t descriptor is completely opaque to the application. It can be compared - * to a file descriptor. - */ -typedef struct dagc dagc_t; - -/* - * Card description. - */ -typedef struct dagc_if_t -{ - struct dagc_if_t *next; - char *name; /* pointer to a string to pass to dagc_open*/ - char *description; /* human-understandable description (e.g. Endace 3.5e Fast - Ethernet Card) */ -} dagc_if_t; - - - -/* - * returns a string with last dagc lib error - */ -#define dagc_getlasterror(dagcfd) dagcfd->errbuf - -/* - * returns a linked list with the cards available on the systems. For every card, it scans the - * card type and converts it to a human-understandable string, in order to provide a description - * useful for example when a system has more than one card - */ -int dagc_finddevs (dagc_if_t **alldevsp, char *ebuf); - - -/* - * frees the card list. - */ -void dagc_freedevs (dagc_if_t *alldevsp); - - -/* - * Opens a card (or a file) for capture. Snaplen is the portion of packet delivered to the - * application, flags can contain specific settings (for example promisc mode??), minbufsize - * is the smallest buffer that the API can provide to the application (to limit CPU waste - * with several small buffers under moderated network throughputs) - */ -dagc_t* dagc_open(const char *source, unsigned flags, char *ebuf); - -/* - * Sets the snaplen of a card - * Returns -1 on failure. On success, the actual snaplen is returned (snap len has to be a multiple of 4 - * with DAG cards). - */ -int dagc_setsnaplen(dagc_t *dagcfd, unsigned snaplen); - -/* - * closes a capture instance - */ -void dagc_close(dagc_t *dagcfd); - - -/* - * returns the linktype of a card - */ -int dagc_getlinktype(dagc_t *dagcfd); - - -/* - * returns the link speed of the adapter, in MB/s. - * If the link speed of the card is unknown, -1 is returned. - * XXX NOTE: Currently, there is no consistent way to get linkspeed querying the card. - * As a consequence, we determine this value statically from the card model. For cards that can run at - * different speeds, we report only the *maximum* speed. - */ -int dagc_getlinkspeed(dagc_t *dagcfd); - - -/* - * Returns the length of the CRC checksum that the card associates with any packet in the hole. This - * information will be used to understand the actual length of the packet on the wire. - * Note: this information is not provided consistently by DAG cards, so we gather it from an environment - * variable in Unix and from a registry key in Windows. - */ -unsigned dagc_getfcslen(dagc_t *dagcfd); - -/* - * provides a buffer with the new packets (from the board or from the file) and its size. - * On success, the return value is 0. If an error has occurred, the return value is -1. - * If EOF has reached, the return value is -2. Note that this function always returns - * immediately, eventually with an empty buffer, so it is possible to have a success (0) - * return value and bufsize = 0. - */ -int dagc_receive(dagc_t *dagcfd, u_char **buffer, u_int *bufsize); - - -/* - * returns nonzero if any data is available from dagcfd, -1 if an error occurred. Waits until almost the time - * specified by timeout has past or any data is available. If timeout=0, returns immediately. - * If timeout=NULL, blocks until a packet arrives. - */ -int dagc_wait(dagc_t *dagcfd, struct timeval *timeout); - - -/* - * returns statistics about current capture session - */ -int dagc_stats(dagc_t *dagcfd, dagc_stats_t *ps); - - -/* - * Opens a dump file to store the data of this capture. - * Returns 0 on success. - * NOTE: currently, dagc_dumpfile_open, dagc_dumpfile_close and dagc_dump are simply wrappers - * for open, close and write. However, if the programmer uses these functions, he is more protected - * against file format changes (for example if the file format will have an header in the future). - * Moreover, assuming that the user knows the file format is a bad practice: providing - * simple simple save functionality is more intuitive and user-friendly. - */ -int dagc_dumpfile_open(dagc_t *dagcfd, char* name); - - -/* - * Closes a dump file - */ -int dagc_dumpfile_close(dagc_t *dagcfd); - - -/* - * Writes a buffer of packets to a dump file - * Returns 0 on success. - */ -int dagc_dump(dagc_t *dagcfd, u_char *buffer, u_int bufsize); +/* + * Copyright (c) 2003 + * NetGroup, Politecnico di Torino (Italy) + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the Politecnico di Torino nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#define DAGC_ERRBUF_SIZE 512 +#define FILEBUFSIZE 65536 +#define MAXDAGCARDS 32 + +#ifndef _WIN32 + +typedef long long long_long; +typedef long long ull_t; +#define TRUE 1 +#define devicestring "/dev/dag%d" +#define dagc_sleepms(_MS) usleep(_MS * 1000) +#else /* _WIN32 */ + +typedef LONGLONG long_long; +typedef ULONGLONG ull_t; +#define dagc_sleepms(_MS) Sleep(_MS) +#define devicestring "\\\\.\\dag%d" + +#endif /* _WIN32 */ + +#define MIN_DAG_SNAPLEN 12 +#define MAX_DAG_SNAPLEN 2040 + +#define erffilestring "erffile://" + + +#define ATM_SNAPLEN 48 +/* Size of ATM payload */ +#define ATM_WLEN(h) ATM_SNAPLEN +#define ATM_SLEN(h) ATM_SNAPLEN + +/* Size Ethernet payload */ +#define ETHERNET_WLEN(h, b) ((u_int)ntohs((h)->wlen) - ((b) >> 3)) +#define ETHERNET_SLEN(h, b) min(ETHERNET_WLEN(h, b), \ + (u_int)ntohs((h)->rlen) - dag_record_size - 2) + +/* Size of HDLC payload */ +#define HDLC_WLEN(h, b) ((u_int)ntohs((h)->wlen) - ((b) >> 3)) +#define HDLC_SLEN(h, b) min(HDLC_WLEN(h, b), \ + (u_int)ntohs((h)->rlen) - dag_record_size) + +/* Flags for dagc_open */ +#define DAGC_OPEN_SHARED 1 +#define DAGC_OPEN_EXCLUSIVE 2 + +#define TYPE_LEGACY 0 +#define TYPE_HDLC_POS 1 +#define TYPE_ETH 2 +#define TYPE_ATM 3 +#define TYPE_AAL5 4 + +/* + * Card statistics. + */ +typedef struct dagc_stats_t +{ + ull_t received; /* (NOT IMPLEMENTED) total number of frames received by the DAG */ + ull_t dropped; /* number of frames dropped for buffer full */ + ull_t captured; /* (NOT IMPLEMENTED) number of frames that actually reach the + application, i.e that are not filtered or dropped */ +} dagc_stats_t; + +/* + * Descriptor of an open session. + * Note: the dagc_t descriptor is completely opaque to the application. It can be compared + * to a file descriptor. + */ +typedef struct dagc dagc_t; + +/* + * Card description. + */ +typedef struct dagc_if_t +{ + struct dagc_if_t *next; + char *name; /* pointer to a string to pass to dagc_open*/ + char *description; /* human-understandable description (e.g. Endace 3.5e Fast + Ethernet Card) */ +} dagc_if_t; + + + +/* + * returns a string with last dagc lib error + */ +#define dagc_getlasterror(dagcfd) dagcfd->errbuf + +/* + * returns a linked list with the cards available on the systems. For every card, it scans the + * card type and converts it to a human-understandable string, in order to provide a description + * useful for example when a system has more than one card + */ +int dagc_finddevs (dagc_if_t **alldevsp, char *ebuf); + + +/* + * frees the card list. + */ +void dagc_freedevs (dagc_if_t *alldevsp); + + +/* + * Opens a card (or a file) for capture. Snaplen is the portion of packet delivered to the + * application, flags can contain specific settings (for example promisc mode??), minbufsize + * is the smallest buffer that the API can provide to the application (to limit CPU waste + * with several small buffers under moderated network throughputs) + */ +dagc_t* dagc_open(const char *source, unsigned flags, char *ebuf); + +/* + * Sets the snaplen of a card + * Returns -1 on failure. On success, the actual snaplen is returned (snap len has to be a multiple of 4 + * with DAG cards). + */ +int dagc_setsnaplen(dagc_t *dagcfd, unsigned snaplen); + +/* + * closes a capture instance + */ +void dagc_close(dagc_t *dagcfd); + + +/* + * returns the linktype of a card + */ +int dagc_getlinktype(dagc_t *dagcfd); + + +/* + * returns the link speed of the adapter, in MB/s. + * If the link speed of the card is unknown, -1 is returned. + * XXX NOTE: Currently, there is no consistent way to get linkspeed querying the card. + * As a consequence, we determine this value statically from the card model. For cards that can run at + * different speeds, we report only the *maximum* speed. + */ +int dagc_getlinkspeed(dagc_t *dagcfd); + + +/* + * Returns the length of the CRC checksum that the card associates with any packet in the hole. This + * information will be used to understand the actual length of the packet on the wire. + * Note: this information is not provided consistently by DAG cards, so we gather it from an environment + * variable in Unix and from a registry key in Windows. + */ +unsigned dagc_getfcslen(dagc_t *dagcfd); + +/* + * provides a buffer with the new packets (from the board or from the file) and its size. + * On success, the return value is 0. If an error has occurred, the return value is -1. + * If EOF has reached, the return value is -2. Note that this function always returns + * immediately, eventually with an empty buffer, so it is possible to have a success (0) + * return value and bufsize = 0. + */ +int dagc_receive(dagc_t *dagcfd, u_char **buffer, u_int *bufsize); + + +/* + * returns nonzero if any data is available from dagcfd, -1 if an error occurred. Waits until almost the time + * specified by timeout has past or any data is available. If timeout=0, returns immediately. + * If timeout=NULL, blocks until a packet arrives. + */ +int dagc_wait(dagc_t *dagcfd, struct timeval *timeout); + + +/* + * returns statistics about current capture session + */ +int dagc_stats(dagc_t *dagcfd, dagc_stats_t *ps); + + +/* + * Opens a dump file to store the data of this capture. + * Returns 0 on success. + * NOTE: currently, dagc_dumpfile_open, dagc_dumpfile_close and dagc_dump are simply wrappers + * for open, close and write. However, if the programmer uses these functions, he is more protected + * against file format changes (for example if the file format will have an header in the future). + * Moreover, assuming that the user knows the file format is a bad practice: providing + * simple simple save functionality is more intuitive and user-friendly. + */ +int dagc_dumpfile_open(dagc_t *dagcfd, char* name); + + +/* + * Closes a dump file + */ +int dagc_dumpfile_close(dagc_t *dagcfd); + + +/* + * Writes a buffer of packets to a dump file + * Returns 0 on success. + */ +int dagc_dump(dagc_t *dagcfd, u_char *buffer, u_int bufsize); diff --git a/src/SeeDll/resource.h b/src/SeeDll/resource.h index eadf53fe..e22cbf9b 100644 --- a/src/SeeDll/resource.h +++ b/src/SeeDll/resource.h @@ -1,15 +1,15 @@ -//{{NO_DEPENDENCIES}} -// Microsoft Visual C++ generated include file. -// Used by SeeDll.rc - - -// Next default values for new objects -// -#ifdef APSTUDIO_INVOKED -#ifndef APSTUDIO_READONLY_SYMBOLS -#define _APS_NEXT_RESOURCE_VALUE 101 -#define _APS_NEXT_COMMAND_VALUE 40001 -#define _APS_NEXT_CONTROL_VALUE 1001 -#define _APS_NEXT_SYMED_VALUE 101 -#endif -#endif +//{{NO_DEPENDENCIES}} +// Microsoft Visual C++ generated include file. +// Used by SeeDll.rc + + +// Next default values for new objects +// +#ifdef APSTUDIO_INVOKED +#ifndef APSTUDIO_READONLY_SYMBOLS +#define _APS_NEXT_RESOURCE_VALUE 101 +#define _APS_NEXT_COMMAND_VALUE 40001 +#define _APS_NEXT_CONTROL_VALUE 1001 +#define _APS_NEXT_SYMED_VALUE 101 +#endif +#endif diff --git a/src/THIRD_PARTY.TXT b/src/THIRD_PARTY.TXT index 2c1b9e78..363f11af 100644 --- a/src/THIRD_PARTY.TXT +++ b/src/THIRD_PARTY.TXT @@ -1,691 +1,691 @@ -BitVisor(R) VPN Client Module (IPsec Driver): -Copyright (c) 2007, 2008 University of Tsukuba. -Copyright (C) 2007, 2008 National Institute of Information and Communications -Technology. -All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are met: - -1. Redistributions of source code must retain the above copyright notice, this -list of conditions and the following disclaimer. -2. Redistributions in binary form must reproduce the above copyright notice, -this list of conditions and the following disclaimer in the documentation -and/or other materials provided with the distribution. -3. Neither the name of the University of Tsukuba nor the names of its -contributors may be used to endorse or promote products derived from this -software without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE -FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR -SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, -OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -------------------- - -Microsoft(R) C Runtime Library: -(c) 2007 Microsoft Corporation. All Rights Reserved. - -------------------- - -RSA Security Inc. PKCS #11 Cryptographic Token Interface (Cryptoki): - -License to copy and use this software is granted provided that it is -identified as "RSA Security Inc. PKCS #11 Cryptographic Token Interface -(Cryptoki)" in all material mentioning or referencing this software. - -License is also granted to make and use derivative works provided that such -works are identified as "derived from the RSA Security Inc. PKCS #11 -Cryptographic Token Interface (Cryptoki)" in all material mentioning or -referencing the derived work. - -RSA Security Inc. makes no representations concerning either the -merchantability of this software or the suitability of this software for any -particular purpose. It is provided "as is" without express or implied warranty -of any kind. - -------------------- - -WinPcap: -Copyright (c) 2001 - 2003 NetGroup, Politecnico di Torino (Italy) -All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are met: - -1. Redistributions of source code must retain the above copyright notice, this -list of conditions and the following disclaimer. -2. Redistributions in binary form must reproduce the above copyright notice, -this list of conditions and the following disclaimer in the documentation -and/or other materials provided with the distribution. -3. Neither the name of the Politecnico di Torino nor the names of its -contributors may be used to endorse or promote products derived from this -software without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE -FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR -SERVICES; LOSS OF USE, -DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY -OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, -EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -------------------- - -libedit: -Copyright (c) 1992, 1993 The Regents of the University of California. All -rights reserved. - -This code is derived from software contributed to Berkeley by Christos Zoulas -of Cornell University. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are met: -1. Redistributions of source code must retain the above copyright notice, this -list of conditions and the following disclaimer. -2. Redistributions in binary form must reproduce the above copyright notice, -this list of conditions and the following disclaimer in the documentation -and/or other materials provided with the distribution. -3. Neither the name of the University nor the names of its contributors may be -used to endorse or promote products derived from this software without -specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND ANY -EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY -DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON -ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -------------------- - -libiconv: - - GNU LIBRARY GENERAL PUBLIC LICENSE - Version 2, June 1991 - - Copyright (C) 1991 Free Software Foundation, Inc. - 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA - Everyone is permitted to copy and distribute verbatim copies of this license -document, but changing it is not allowed. - -[This is the first released version of the library GPL. It is - numbered 2 because it goes with version 2 of the ordinary GPL.] - - Preamble - - The licenses for most software are designed to take away your freedom to -share and change it. By contrast, the GNU General Public Licenses are intended -to guarantee your freedom to share and change free software--to make sure the -software is free for all its users. - - This license, the Library General Public License, applies to some specially -designated Free Software Foundation software, and to any other libraries whose -authors decide to use it. You can use it for your libraries, too. - - When we speak of free software, we are referring to freedom, not price. Our -General Public Licenses are designed to make sure that you have the freedom to -distribute copies of free software (and charge for -this service if you wish), that you receive source code or can get it if you -want it, that you can change the software or use pieces of it in new free -programs; and that you know you can do these things. - - To protect your rights, we need to make restrictions that forbid anyone to -deny you these rights or to ask you to surrender the rights. These -restrictions translate to certain responsibilities for you if you distribute -copies of the library, or if you modify it. - - For example, if you distribute copies of the library, whether gratis or for -a fee, you must give the recipients all the rights that we gave you. You must -make sure that they, too, receive or can get the source -code. If you link a program with the library, you must provide complete object -files to the recipients so that they can relink them with the library, after -making changes to the library and recompiling it. And you must show them these -terms so they know their rights. - - Our method of protecting your rights has two steps: (1) copyright the -library, and (2) offer you this license which gives you legal permission to -copy, distribute and/or modify the library. - - Also, for each distributor's protection, we want to make certain that -everyone understands that there is no warranty for this free library. If the -library is modified by someone else and passed on, we want its recipients to -know that what they have is not the original version, so that any problems -introduced by others will not reflect on the original authors' reputations. - - Finally, any free program is threatened constantly by software patents. We -wish to avoid the danger that companies distributing free software will -individually obtain patent licenses, thus in effect transforming the program -into proprietary software. To prevent this, we have made it clear that any -patent must be licensed for everyone's free use or not licensed at all. - - Most GNU software, including some libraries, is covered by the ordinary GNU -General Public License, which was designed for utility programs. This license, -the GNU Library General Public License, applies to certain designated -libraries. This license is quite different from the ordinary one; be sure to -read it in full, and don't assume that anything in it is the same as in the -ordinary license. - - The reason we have a separate public license for some libraries is that they -blur the distinction we usually make between modifying or adding to a program -and simply using it. Linking a program with a library, without changing the -library, is in some sense simply using the library, and is analogous to -running a utility program or application program. However, in a textual and -legal sense, the linked executable is a combined work, a derivative of the -original library, and the ordinary General Public License treats it as such. - - Because of this blurred distinction, using the ordinary General Public -License for libraries did not effectively promote software sharing, because -most developers did not use the libraries. We concluded that weaker conditions -might promote sharing better. - - However, unrestricted linking of non-free programs would deprive the users -of those programs of all benefit from the free status of the libraries -themselves. This Library General Public License is intended to -permit developers of non-free programs to use free libraries, while preserving -your freedom as a user of such programs to change the free libraries that are -incorporated in them. (We have not seen how to achieve this as regards changes -in header files, but we have achieved it as regards changes in the actual -functions of the Library.) The hope is that this will lead to faster -development of free libraries. - - The precise terms and conditions for copying, distribution and modification -follow. Pay close attention to the difference between a "work based on the -library" and a "work that uses the library". The former contains code derived -from the library, while the latter only works together with the library. - - Note that it is possible for a library to be covered by the ordinary General -Public License rather than by this special one. - - GNU LIBRARY GENERAL PUBLIC LICENSE - TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION - - 0. This License Agreement applies to any software library which contains a -notice placed by the copyright holder or other authorized party saying it may -be distributed under the terms of this Library -General Public License (also called "this License"). Each licensee is -addressed as "you". - - A "library" means a collection of software functions and/or data prepared so -as to be conveniently linked with application programs (which use some of -those functions and data) to form executables. - - The "Library", below, refers to any such software library or work which has -been distributed under these terms. A "work based on the Library" means either -the Library or any derivative work under copyright law: that is to say, a work -containing the Library or a portion of it, either verbatim or with -modifications and/or translated straightforwardly into another language. -(Hereinafter, translation is included without limitation in the term -"modification".) - - "Source code" for a work means the preferred form of the work for making -modifications to it. For a library, complete source code means all the source -code for all modules it contains, plus any associated interface definition -files, plus the scripts used to control compilation and installation of the -library. - - Activities other than copying, distribution and modification are not covered -by this License; they are outside its scope. The act of running a program -using the Library is not restricted, and output from such a program is covered -only if its contents constitute a work based on the Library (independent of -the use of the Library in a tool for writing it). Whether that is true depends -on what the Library does and what the program that uses the Library does. - - 1. You may copy and distribute verbatim copies of the Library's complete -source code as you receive it, in any medium, provided that you conspicuously -and appropriately publish on each copy an appropriate copyright notice and -disclaimer of warranty; keep intact all the notices that refer to this License -and to the absence of any warranty; and distribute a copy of this License -along with the Library. - - You may charge a fee for the physical act of transferring a copy, and you -may at your option offer warranty protection in exchange for a fee. - - 2. You may modify your copy or copies of the Library or any portion of it, -thus forming a work based on the Library, and copy and distribute such -modifications or work under the terms of Section 1 above, provided that you -also meet all of these conditions: - - a) The modified work must itself be a software library. - - b) You must cause the files modified to carry prominent notices stating -that you changed the files and the date of any change. - - c) You must cause the whole of the work to be licensed at no charge to all -third parties under the terms of this License. - - d) If a facility in the modified Library refers to a function or a table -of data to be supplied by an application program that uses the facility, other -than as an argument passed when the facility is invoked, then you must make a -good faith effort to ensure that, in the event an application does not supply -such function or table, the facility still operates, and performs whatever -part of its purpose remains meaningful. - - (For example, a function in a library to compute square roots has a -purpose that is entirely well-defined independent of the application. -Therefore, Subsection 2d requires that any application-supplied function or -table used by this function must be optional: if the application does not -supply it, the square root function must still compute square roots.) - -These requirements apply to the modified work as a whole. If identifiable -sections of that work are not derived from the Library, and can be reasonably -considered independent and separate works in themselves, then this License, -and its terms, do not apply to those sections when you distribute them as -separate works. But when you distribute the same sections as part of a whole -which is a work based on the Library, the distribution of the whole must be on -the terms of this License, whose permissions for other licensees extend to the -entire whole, and thus to each and every part regardless of who wrote it. - -Thus, it is not the intent of this section to claim rights or contest your -rights to work written entirely by you; rather, the intent is to exercise the -right to control the distribution of derivative or collective works based on -the Library. - -In addition, mere aggregation of another work not based on the Library with -the Library (or with a work based on the Library) on a volume of a storage or -distribution medium does not bring the other work under the scope of this -License. - - 3. You may opt to apply the terms of the ordinary GNU General Public -License instead of this License to a given copy of the Library. To do this, -you must alter all the notices that refer to this License, so that they refer -to the ordinary GNU General Public License, version 2, instead of to this -License. (If a newer version than version 2 of the ordinary GNU General Public -License has appeared, then you can specify that version instead if you wish.) -Do not make any other change in these notices. - - Once this change is made in a given copy, it is irreversible for that copy, -so the ordinary GNU General Public License applies to all subsequent copies -and derivative works made from that copy. - - This option is useful when you wish to copy part of the code of the Library -into a program that is not a library. - - 4. You may copy and distribute the Library (or a portion or derivative of -it, under Section 2) in object code or executable form under the terms of -Sections 1 and 2 above provided that you accompany it with the complete -corresponding machine-readable source code, which must be distributed under -the terms of Sections 1 and 2 above on a medium customarily used for software -interchange. - - If distribution of object code is made by offering access to copy from a -designated place, then offering equivalent access to copy the source code from -the same place satisfies the requirement to distribute the source code, even -though third parties are not compelled to copy the source along with the -object code. - - 5. A program that contains no derivative of any portion of the Library, but -is designed to work with the Library by being compiled or linked with it, is -called a "work that uses the Library". Such a work, in isolation, is not a -derivative work of the Library, and therefore falls outside the scope of this -License. - - However, linking a "work that uses the Library" with the Library creates an -executable that is a derivative of the Library (because it contains portions -of the Library), rather than a "work that uses the library". The executable is -therefore covered by this License. -Section 6 states terms for distribution of such executables. - - When a "work that uses the Library" uses material from a header file that is -part of the Library, the object code for the work may be a derivative work of -the Library even though the source code is not. -Whether this is true is especially significant if the work can be linked -without the Library, or if the work is itself a library. The threshold for -this to be true is not precisely defined by law. - - If such an object file uses only numerical parameters, data structure -layouts and accessors, and small macros and small inline functions (ten lines -or less in length), then the use of the object file is unrestricted, -regardless of whether it is legally a derivative work. (Executables containing -this object code plus portions of the Library will still fall under Section -6.) - - Otherwise, if the work is a derivative of the Library, you may distribute -the object code for the work under the terms of Section 6. Any executables -containing that work also fall under Section 6, whether or not they are linked -directly with the Library itself. - - 6. As an exception to the Sections above, you may also compile or link a -"work that uses the Library" with the Library to produce a work containing -portions of the Library, and distribute that work under terms of your choice, -provided that the terms permit modification of the work for the customer's own -use and reverse engineering for debugging such modifications. - - You must give prominent notice with each copy of the work that the Library -is used in it and that the Library and its use are covered by this License. -You must supply a copy of this License. If the work during execution displays -copyright notices, you must include the copyright notice for the Library among -them, as well as a reference directing the user to the copy of this License. -Also, you must do one of these things: - - a) Accompany the work with the complete corresponding machine-readable -source code for the Library including whatever changes were used in the work -(which must be distributed under Sections 1 and 2 above) ; and, if the work is -an executable linked with the Library, with the complete machine-readable -"work that uses the Library", as object code and/or source code, so that the -user can modify the Library and then relink to produce a modified executable -containing the modified Library. (It is understood that the user who changes -the contents of definitions files in the Library will not necessarily be able -to recompile the application to use the modified definitions.) - - b) Accompany the work with a written offer, valid for at least three -years, to give the same user the materials specified in Subsection 6a, above, -for a charge no more than the cost of performing this distribution. - - c) If distribution of the work is made by offering access to copy from a -designated place, offer equivalent access to copy the above specified -materials from the same place. - - d) Verify that the user has already received a copy of these materials or -that you have already sent this user a copy. - - For an executable, the required form of the "work that uses the Library" -must include any data and utility programs needed for reproducing the -executable from it. However, as a special exception, the source code -distributed need not include anything that is normally distributed (in either -source or binary form) with the major components (compiler, kernel, and so on) -of the operating system on which the executable runs, unless that component -itself accompanies the executable. - - It may happen that this requirement contradicts the license restrictions of -other proprietary libraries that do not normally accompany the operating -system. Such a contradiction means you cannot use both them and the Library -together in an executable that you distribute. - - 7. You may place library facilities that are a work based on the Library -side-by-side in a single library together with other library facilities not -covered by this License, and distribute such a combined library, provided that -the separate distribution of the work based on the Library and of the other -library facilities is otherwise permitted, and provided that you do these two -things: - - a) Accompany the combined library with a copy of the same work based on -the Library, uncombined with any other library facilities. This must be -distributed under the terms of the Sections above. - - b) Give prominent notice with the combined library of the fact that part -of it is a work based on the Library, and explaining where to find the -accompanying uncombined form of the same work. - - 8. You may not copy, modify, sublicense, link with, or distribute the -Library except as expressly provided under this License. Any attempt otherwise -to copy, modify, sublicense, link with, or distribute the Library is void, and -will automatically terminate your rights under this License. However, parties -who have received copies, or rights, from you under this License will not have -their licenses terminated so long as such parties remain in full compliance. - - 9. You are not required to accept this License, since you have not signed -it. However, nothing else grants you permission to modify or distribute the -Library or its derivative works. These actions are prohibited by law if you do -not accept this License. Therefore, by modifying or distributing the Library -(or any work based on the Library), you indicate your acceptance of this -License to do so, and all its terms and conditions for copying, distributing -or modifying the Library or works based on it. - - 10. Each time you redistribute the Library (or any work based on the -Library), the recipient automatically receives a license from the original -licensor to copy, distribute, link with or modify the Library subject to these -terms and conditions. You may not impose any further restrictions on the -recipients' exercise of the rights granted herein. You are not responsible for -enforcing compliance by third parties to this License. - - 11. If, as a consequence of a court judgment or allegation of patent -infringement or for any other reason (not limited to patent issues), -conditions are imposed on you (whether by court order, agreement or otherwise) -that contradict the conditions of this License, they do not excuse you from -the conditions of this License. If you cannot distribute so as to satisfy -simultaneously your obligations under this License and any other pertinent -obligations, then as a consequence you may not distribute the Library at all. -For example, if a patent license would not permit royalty-free redistribution -of the Library by all those who receive copies directly or indirectly through -you, then the only way you could satisfy both it and this License would be to -refrain entirely from distribution of the Library. - -If any portion of this section is held invalid or unenforceable under any -particular circumstance, the balance of the section is intended to apply, and -the section as a whole is intended to apply in other circumstances. - -It is not the purpose of this section to induce you to infringe any patents or -other property right claims or to contest validity of any such claims; this -section has the sole purpose of protecting the integrity of the free software -distribution system which is implemented by public license practices. Many -people have made generous contributions to the wide range of software -distributed through that system in reliance on consistent application of that -system; it is up to the author/donor to decide if he or she is willing to -distribute software through any other system and a licensee cannot impose that -choice. - -This section is intended to make thoroughly clear what is believed to be a -consequence of the rest of this License. - - 12. If the distribution and/or use of the Library is restricted in certain -countries either by patents or by copyrighted interfaces, the original -copyright holder who places the Library under this License may add an explicit -geographical distribution limitation excluding those countries, so that -distribution is permitted only in or among countries not thus excluded. In -such case, this License incorporates the limitation as if written in the body -of this License. - - 13. The Free Software Foundation may publish revised and/or new versions of -the Library General Public License from time to time. Such new versions will -be similar in spirit to the present version, but may differ in detail to -address new problems or concerns. - -Each version is given a distinguishing version number. If the Library -specifies a version number of this License which applies to it and "any later -version", you have the option of following the terms and conditions either of -that version or of any later version published by the Free Software -Foundation. If the Library does not specify a license version number, you may -choose any version ever published by the Free Software Foundation. - - 14. If you wish to incorporate parts of the Library into other free programs -whose distribution conditions are incompatible with these, write to the author -to ask for permission. For software which is copyrighted by the Free Software -Foundation, write to the Free Software Foundation; we sometimes make -exceptions for this. Our decision will be guided by the two goals of -preserving the free status of all derivatives of our free software and of -promoting the sharing and reuse of software generally. - - NO WARRANTY - - 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR -THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE -STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE -LIBRARY "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, -INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND -FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND -PERFORMANCE OF THE LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, -YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. - - 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING -WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR -REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, -INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING -OUT OF THE USE OR INABILITY TO USE THE LIBRARY (INCLUDING BUT NOT LIMITED TO -LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR -THIRD PARTIES OR A FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), -EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH -DAMAGES. - - END OF TERMS AND CONDITIONS - -------------------- - -ncurses: -Copyright (c) 1998-2005,2006 Free Software Foundation, Inc. - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, distribute with -modifications, sublicense, and/or sell copies of the Software, and to permit -persons to whom the Software is furnished to do so, subject to the following -conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, -WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR -IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name(s) of the above copyright holders -shall not be used in advertising or otherwise to promote the sale, use or -other dealings in this Software without prior written authorization. - -------------------- - -OpenSSL: -OpenSSL License -Copyright (c) 1998-2011 The OpenSSL Project. All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are met: - -1. Redistributions of source code must retain the above copyright notice, this -list of conditions and the following disclaimer. - -2. Redistributions in binary form must reproduce the above copyright notice, -this list of conditions and the following disclaimer in the documentation -and/or other materials provided with the distribution. - -3. All advertising materials mentioning features or use of this software must -display the following acknowledgment: "This product includes software -developed by the OpenSSL Project for use in the OpenSSL Toolkit. -(http://www.openssl.org/)" - -4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to -endorse or promote products derived from this software without prior written -permission. For written permission, please contact openssl-core@openssl.org. - -5. Products derived from this software may not be called "OpenSSL" nor may -"OpenSSL" appear in their names without prior written permission of the -OpenSSL Project. - -6. Redistributions of any form whatsoever must retain the following -acknowledgment: "This product includes software developed by the OpenSSL -Project for use in the OpenSSL Toolkit (http://www.openssl.org/)" - -THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY EXPRESSED -OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES -OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO -EVENT SHALL THE OpenSSL PROJECT OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, -INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY -OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, -EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -This product includes cryptographic software written by Eric Young -(eay@cryptsoft.com). This product includes software written by Tim Hudson -(tjh@cryptsoft.com). - -Original SSLeay License -Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) All rights reserved. - -This package is an SSL implementation written by Eric Young -(eay@cryptsoft.com). The implementation was written so as to conform with -Netscapes SSL. - -This library is free for commercial and non-commercial use as long as the -following conditions are adhered to. The following conditions apply to all -code found in this distribution, be it the RC4, RSA, lhash, DES, etc., code; -not just the SSL code. The SSL documentation included with this distribution -is covered by the same copyright terms except that the holder is Tim Hudson -(tjh@cryptsoft.com). - -Copyright remains Eric Young's, and as such any Copyright notices in the code -are not to be removed. If this package is used in a product, Eric Young should -be given attribution as the author of the parts of the library used. This can -be in the form of a textual message at program startup or in documentation -(online or textual) provided with the package. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are met: -1. Redistributions of source code must retain the copyright notice, this list -of conditions and the following disclaimer. -2. Redistributions in binary form must reproduce the above copyright notice, -this list of conditions and the following disclaimer in the documentation -and/or other materials provided with the distribution. -3. All advertising materials mentioning features or use of this software must -display the following acknowledgement: "This product includes cryptographic -software written by Eric Young (eay@cryptsoft.com)" The word 'cryptographic' -can be left out if the rouines from the library being used are not -cryptographic related :-). -4. If you include any Windows specific code (or a derivative thereof) from the -apps directory (application code) you must include an acknowledgement: "This -product includes software written by Tim Hudson (tjh@cryptsoft.com)" - -THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND ANY EXPRESS OR IMPLIED -WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF -MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO -EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, -EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -The licence and distribution terms for any publically available version or -derivative of this code cannot be changed. i.e. this code cannot simply be -copied and put under another distribution licence [including the GNU Public -Licence.] - -------------------- - -zlib: -Acknowledgments: - The deflate format used by zlib was defined by Phil Katz. The deflate and -zlib specifications were written by L. Peter Deutsch. Thanks to all the people -who reported problems and suggested various improvements in zlib; they are too -numerous to cite here. - -Copyright notice: - (C) 1995-2004 Jean-loup Gailly and Mark Adler - - This software is provided 'as-is', without any express or implied warranty. -In no event will the authors be held liable for any damages arising from the -use of this software. - - Permission is granted to anyone to use this software for any purpose, -including commercial applications, and to alter it and redistribute it freely, -subject to the following restrictions: - - 1. The origin of this software must not be misrepresented; you must not -claim that you wrote the original software. If you use this software in a -product, an acknowledgment in the product documentation would be appreciated -but is not required. - 2. Altered source versions must be plainly marked as such, and must not be -misrepresented as being the original software. - 3. This notice may not be removed or altered from any source distribution. - - Jean-loup Gailly Mark Adler - jloup@gzip.org madler@alumni.caltech.edu - -If you use the zlib library in a product, we would appreciate *not* receiving -lengthy legal documents to sign. The sources are provided for free but without -warranty of any kind. The library has been entirely written by Jean-loup -Gailly and Mark Adler; it does not include third-party code. - -If you redistribute modified sources, we would appreciate that you include in -the file ChangeLog history information documenting your changes. Please read -the FAQ for more information on the distribution of modified source versions. +BitVisor(R) VPN Client Module (IPsec Driver): +Copyright (c) 2007, 2008 University of Tsukuba. +Copyright (C) 2007, 2008 National Institute of Information and Communications +Technology. +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + +1. Redistributions of source code must retain the above copyright notice, this +list of conditions and the following disclaimer. +2. Redistributions in binary form must reproduce the above copyright notice, +this list of conditions and the following disclaimer in the documentation +and/or other materials provided with the distribution. +3. Neither the name of the University of Tsukuba nor the names of its +contributors may be used to endorse or promote products derived from this +software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE +FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, +OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +------------------- + +Microsoft(R) C Runtime Library: +(c) 2007 Microsoft Corporation. All Rights Reserved. + +------------------- + +RSA Security Inc. PKCS #11 Cryptographic Token Interface (Cryptoki): + +License to copy and use this software is granted provided that it is +identified as "RSA Security Inc. PKCS #11 Cryptographic Token Interface +(Cryptoki)" in all material mentioning or referencing this software. + +License is also granted to make and use derivative works provided that such +works are identified as "derived from the RSA Security Inc. PKCS #11 +Cryptographic Token Interface (Cryptoki)" in all material mentioning or +referencing the derived work. + +RSA Security Inc. makes no representations concerning either the +merchantability of this software or the suitability of this software for any +particular purpose. It is provided "as is" without express or implied warranty +of any kind. + +------------------- + +WinPcap: +Copyright (c) 2001 - 2003 NetGroup, Politecnico di Torino (Italy) +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + +1. Redistributions of source code must retain the above copyright notice, this +list of conditions and the following disclaimer. +2. Redistributions in binary form must reproduce the above copyright notice, +this list of conditions and the following disclaimer in the documentation +and/or other materials provided with the distribution. +3. Neither the name of the Politecnico di Torino nor the names of its +contributors may be used to endorse or promote products derived from this +software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE +FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, +EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +------------------- + +libedit: +Copyright (c) 1992, 1993 The Regents of the University of California. All +rights reserved. + +This code is derived from software contributed to Berkeley by Christos Zoulas +of Cornell University. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: +1. Redistributions of source code must retain the above copyright notice, this +list of conditions and the following disclaimer. +2. Redistributions in binary form must reproduce the above copyright notice, +this list of conditions and the following disclaimer in the documentation +and/or other materials provided with the distribution. +3. Neither the name of the University nor the names of its contributors may be +used to endorse or promote products derived from this software without +specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND ANY +EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY +DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON +ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +------------------- + +libiconv: + + GNU LIBRARY GENERAL PUBLIC LICENSE + Version 2, June 1991 + + Copyright (C) 1991 Free Software Foundation, Inc. + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA + Everyone is permitted to copy and distribute verbatim copies of this license +document, but changing it is not allowed. + +[This is the first released version of the library GPL. It is + numbered 2 because it goes with version 2 of the ordinary GPL.] + + Preamble + + The licenses for most software are designed to take away your freedom to +share and change it. By contrast, the GNU General Public Licenses are intended +to guarantee your freedom to share and change free software--to make sure the +software is free for all its users. + + This license, the Library General Public License, applies to some specially +designated Free Software Foundation software, and to any other libraries whose +authors decide to use it. You can use it for your libraries, too. + + When we speak of free software, we are referring to freedom, not price. Our +General Public Licenses are designed to make sure that you have the freedom to +distribute copies of free software (and charge for +this service if you wish), that you receive source code or can get it if you +want it, that you can change the software or use pieces of it in new free +programs; and that you know you can do these things. + + To protect your rights, we need to make restrictions that forbid anyone to +deny you these rights or to ask you to surrender the rights. These +restrictions translate to certain responsibilities for you if you distribute +copies of the library, or if you modify it. + + For example, if you distribute copies of the library, whether gratis or for +a fee, you must give the recipients all the rights that we gave you. You must +make sure that they, too, receive or can get the source +code. If you link a program with the library, you must provide complete object +files to the recipients so that they can relink them with the library, after +making changes to the library and recompiling it. And you must show them these +terms so they know their rights. + + Our method of protecting your rights has two steps: (1) copyright the +library, and (2) offer you this license which gives you legal permission to +copy, distribute and/or modify the library. + + Also, for each distributor's protection, we want to make certain that +everyone understands that there is no warranty for this free library. If the +library is modified by someone else and passed on, we want its recipients to +know that what they have is not the original version, so that any problems +introduced by others will not reflect on the original authors' reputations. + + Finally, any free program is threatened constantly by software patents. We +wish to avoid the danger that companies distributing free software will +individually obtain patent licenses, thus in effect transforming the program +into proprietary software. To prevent this, we have made it clear that any +patent must be licensed for everyone's free use or not licensed at all. + + Most GNU software, including some libraries, is covered by the ordinary GNU +General Public License, which was designed for utility programs. This license, +the GNU Library General Public License, applies to certain designated +libraries. This license is quite different from the ordinary one; be sure to +read it in full, and don't assume that anything in it is the same as in the +ordinary license. + + The reason we have a separate public license for some libraries is that they +blur the distinction we usually make between modifying or adding to a program +and simply using it. Linking a program with a library, without changing the +library, is in some sense simply using the library, and is analogous to +running a utility program or application program. However, in a textual and +legal sense, the linked executable is a combined work, a derivative of the +original library, and the ordinary General Public License treats it as such. + + Because of this blurred distinction, using the ordinary General Public +License for libraries did not effectively promote software sharing, because +most developers did not use the libraries. We concluded that weaker conditions +might promote sharing better. + + However, unrestricted linking of non-free programs would deprive the users +of those programs of all benefit from the free status of the libraries +themselves. This Library General Public License is intended to +permit developers of non-free programs to use free libraries, while preserving +your freedom as a user of such programs to change the free libraries that are +incorporated in them. (We have not seen how to achieve this as regards changes +in header files, but we have achieved it as regards changes in the actual +functions of the Library.) The hope is that this will lead to faster +development of free libraries. + + The precise terms and conditions for copying, distribution and modification +follow. Pay close attention to the difference between a "work based on the +library" and a "work that uses the library". The former contains code derived +from the library, while the latter only works together with the library. + + Note that it is possible for a library to be covered by the ordinary General +Public License rather than by this special one. + + GNU LIBRARY GENERAL PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. This License Agreement applies to any software library which contains a +notice placed by the copyright holder or other authorized party saying it may +be distributed under the terms of this Library +General Public License (also called "this License"). Each licensee is +addressed as "you". + + A "library" means a collection of software functions and/or data prepared so +as to be conveniently linked with application programs (which use some of +those functions and data) to form executables. + + The "Library", below, refers to any such software library or work which has +been distributed under these terms. A "work based on the Library" means either +the Library or any derivative work under copyright law: that is to say, a work +containing the Library or a portion of it, either verbatim or with +modifications and/or translated straightforwardly into another language. +(Hereinafter, translation is included without limitation in the term +"modification".) + + "Source code" for a work means the preferred form of the work for making +modifications to it. For a library, complete source code means all the source +code for all modules it contains, plus any associated interface definition +files, plus the scripts used to control compilation and installation of the +library. + + Activities other than copying, distribution and modification are not covered +by this License; they are outside its scope. The act of running a program +using the Library is not restricted, and output from such a program is covered +only if its contents constitute a work based on the Library (independent of +the use of the Library in a tool for writing it). Whether that is true depends +on what the Library does and what the program that uses the Library does. + + 1. You may copy and distribute verbatim copies of the Library's complete +source code as you receive it, in any medium, provided that you conspicuously +and appropriately publish on each copy an appropriate copyright notice and +disclaimer of warranty; keep intact all the notices that refer to this License +and to the absence of any warranty; and distribute a copy of this License +along with the Library. + + You may charge a fee for the physical act of transferring a copy, and you +may at your option offer warranty protection in exchange for a fee. + + 2. You may modify your copy or copies of the Library or any portion of it, +thus forming a work based on the Library, and copy and distribute such +modifications or work under the terms of Section 1 above, provided that you +also meet all of these conditions: + + a) The modified work must itself be a software library. + + b) You must cause the files modified to carry prominent notices stating +that you changed the files and the date of any change. + + c) You must cause the whole of the work to be licensed at no charge to all +third parties under the terms of this License. + + d) If a facility in the modified Library refers to a function or a table +of data to be supplied by an application program that uses the facility, other +than as an argument passed when the facility is invoked, then you must make a +good faith effort to ensure that, in the event an application does not supply +such function or table, the facility still operates, and performs whatever +part of its purpose remains meaningful. + + (For example, a function in a library to compute square roots has a +purpose that is entirely well-defined independent of the application. +Therefore, Subsection 2d requires that any application-supplied function or +table used by this function must be optional: if the application does not +supply it, the square root function must still compute square roots.) + +These requirements apply to the modified work as a whole. If identifiable +sections of that work are not derived from the Library, and can be reasonably +considered independent and separate works in themselves, then this License, +and its terms, do not apply to those sections when you distribute them as +separate works. But when you distribute the same sections as part of a whole +which is a work based on the Library, the distribution of the whole must be on +the terms of this License, whose permissions for other licensees extend to the +entire whole, and thus to each and every part regardless of who wrote it. + +Thus, it is not the intent of this section to claim rights or contest your +rights to work written entirely by you; rather, the intent is to exercise the +right to control the distribution of derivative or collective works based on +the Library. + +In addition, mere aggregation of another work not based on the Library with +the Library (or with a work based on the Library) on a volume of a storage or +distribution medium does not bring the other work under the scope of this +License. + + 3. You may opt to apply the terms of the ordinary GNU General Public +License instead of this License to a given copy of the Library. To do this, +you must alter all the notices that refer to this License, so that they refer +to the ordinary GNU General Public License, version 2, instead of to this +License. (If a newer version than version 2 of the ordinary GNU General Public +License has appeared, then you can specify that version instead if you wish.) +Do not make any other change in these notices. + + Once this change is made in a given copy, it is irreversible for that copy, +so the ordinary GNU General Public License applies to all subsequent copies +and derivative works made from that copy. + + This option is useful when you wish to copy part of the code of the Library +into a program that is not a library. + + 4. You may copy and distribute the Library (or a portion or derivative of +it, under Section 2) in object code or executable form under the terms of +Sections 1 and 2 above provided that you accompany it with the complete +corresponding machine-readable source code, which must be distributed under +the terms of Sections 1 and 2 above on a medium customarily used for software +interchange. + + If distribution of object code is made by offering access to copy from a +designated place, then offering equivalent access to copy the source code from +the same place satisfies the requirement to distribute the source code, even +though third parties are not compelled to copy the source along with the +object code. + + 5. A program that contains no derivative of any portion of the Library, but +is designed to work with the Library by being compiled or linked with it, is +called a "work that uses the Library". Such a work, in isolation, is not a +derivative work of the Library, and therefore falls outside the scope of this +License. + + However, linking a "work that uses the Library" with the Library creates an +executable that is a derivative of the Library (because it contains portions +of the Library), rather than a "work that uses the library". The executable is +therefore covered by this License. +Section 6 states terms for distribution of such executables. + + When a "work that uses the Library" uses material from a header file that is +part of the Library, the object code for the work may be a derivative work of +the Library even though the source code is not. +Whether this is true is especially significant if the work can be linked +without the Library, or if the work is itself a library. The threshold for +this to be true is not precisely defined by law. + + If such an object file uses only numerical parameters, data structure +layouts and accessors, and small macros and small inline functions (ten lines +or less in length), then the use of the object file is unrestricted, +regardless of whether it is legally a derivative work. (Executables containing +this object code plus portions of the Library will still fall under Section +6.) + + Otherwise, if the work is a derivative of the Library, you may distribute +the object code for the work under the terms of Section 6. Any executables +containing that work also fall under Section 6, whether or not they are linked +directly with the Library itself. + + 6. As an exception to the Sections above, you may also compile or link a +"work that uses the Library" with the Library to produce a work containing +portions of the Library, and distribute that work under terms of your choice, +provided that the terms permit modification of the work for the customer's own +use and reverse engineering for debugging such modifications. + + You must give prominent notice with each copy of the work that the Library +is used in it and that the Library and its use are covered by this License. +You must supply a copy of this License. If the work during execution displays +copyright notices, you must include the copyright notice for the Library among +them, as well as a reference directing the user to the copy of this License. +Also, you must do one of these things: + + a) Accompany the work with the complete corresponding machine-readable +source code for the Library including whatever changes were used in the work +(which must be distributed under Sections 1 and 2 above) ; and, if the work is +an executable linked with the Library, with the complete machine-readable +"work that uses the Library", as object code and/or source code, so that the +user can modify the Library and then relink to produce a modified executable +containing the modified Library. (It is understood that the user who changes +the contents of definitions files in the Library will not necessarily be able +to recompile the application to use the modified definitions.) + + b) Accompany the work with a written offer, valid for at least three +years, to give the same user the materials specified in Subsection 6a, above, +for a charge no more than the cost of performing this distribution. + + c) If distribution of the work is made by offering access to copy from a +designated place, offer equivalent access to copy the above specified +materials from the same place. + + d) Verify that the user has already received a copy of these materials or +that you have already sent this user a copy. + + For an executable, the required form of the "work that uses the Library" +must include any data and utility programs needed for reproducing the +executable from it. However, as a special exception, the source code +distributed need not include anything that is normally distributed (in either +source or binary form) with the major components (compiler, kernel, and so on) +of the operating system on which the executable runs, unless that component +itself accompanies the executable. + + It may happen that this requirement contradicts the license restrictions of +other proprietary libraries that do not normally accompany the operating +system. Such a contradiction means you cannot use both them and the Library +together in an executable that you distribute. + + 7. You may place library facilities that are a work based on the Library +side-by-side in a single library together with other library facilities not +covered by this License, and distribute such a combined library, provided that +the separate distribution of the work based on the Library and of the other +library facilities is otherwise permitted, and provided that you do these two +things: + + a) Accompany the combined library with a copy of the same work based on +the Library, uncombined with any other library facilities. This must be +distributed under the terms of the Sections above. + + b) Give prominent notice with the combined library of the fact that part +of it is a work based on the Library, and explaining where to find the +accompanying uncombined form of the same work. + + 8. You may not copy, modify, sublicense, link with, or distribute the +Library except as expressly provided under this License. Any attempt otherwise +to copy, modify, sublicense, link with, or distribute the Library is void, and +will automatically terminate your rights under this License. However, parties +who have received copies, or rights, from you under this License will not have +their licenses terminated so long as such parties remain in full compliance. + + 9. You are not required to accept this License, since you have not signed +it. However, nothing else grants you permission to modify or distribute the +Library or its derivative works. These actions are prohibited by law if you do +not accept this License. Therefore, by modifying or distributing the Library +(or any work based on the Library), you indicate your acceptance of this +License to do so, and all its terms and conditions for copying, distributing +or modifying the Library or works based on it. + + 10. Each time you redistribute the Library (or any work based on the +Library), the recipient automatically receives a license from the original +licensor to copy, distribute, link with or modify the Library subject to these +terms and conditions. You may not impose any further restrictions on the +recipients' exercise of the rights granted herein. You are not responsible for +enforcing compliance by third parties to this License. + + 11. If, as a consequence of a court judgment or allegation of patent +infringement or for any other reason (not limited to patent issues), +conditions are imposed on you (whether by court order, agreement or otherwise) +that contradict the conditions of this License, they do not excuse you from +the conditions of this License. If you cannot distribute so as to satisfy +simultaneously your obligations under this License and any other pertinent +obligations, then as a consequence you may not distribute the Library at all. +For example, if a patent license would not permit royalty-free redistribution +of the Library by all those who receive copies directly or indirectly through +you, then the only way you could satisfy both it and this License would be to +refrain entirely from distribution of the Library. + +If any portion of this section is held invalid or unenforceable under any +particular circumstance, the balance of the section is intended to apply, and +the section as a whole is intended to apply in other circumstances. + +It is not the purpose of this section to induce you to infringe any patents or +other property right claims or to contest validity of any such claims; this +section has the sole purpose of protecting the integrity of the free software +distribution system which is implemented by public license practices. Many +people have made generous contributions to the wide range of software +distributed through that system in reliance on consistent application of that +system; it is up to the author/donor to decide if he or she is willing to +distribute software through any other system and a licensee cannot impose that +choice. + +This section is intended to make thoroughly clear what is believed to be a +consequence of the rest of this License. + + 12. If the distribution and/or use of the Library is restricted in certain +countries either by patents or by copyrighted interfaces, the original +copyright holder who places the Library under this License may add an explicit +geographical distribution limitation excluding those countries, so that +distribution is permitted only in or among countries not thus excluded. In +such case, this License incorporates the limitation as if written in the body +of this License. + + 13. The Free Software Foundation may publish revised and/or new versions of +the Library General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + +Each version is given a distinguishing version number. If the Library +specifies a version number of this License which applies to it and "any later +version", you have the option of following the terms and conditions either of +that version or of any later version published by the Free Software +Foundation. If the Library does not specify a license version number, you may +choose any version ever published by the Free Software Foundation. + + 14. If you wish to incorporate parts of the Library into other free programs +whose distribution conditions are incompatible with these, write to the author +to ask for permission. For software which is copyrighted by the Free Software +Foundation, write to the Free Software Foundation; we sometimes make +exceptions for this. Our decision will be guided by the two goals of +preserving the free status of all derivatives of our free software and of +promoting the sharing and reuse of software generally. + + NO WARRANTY + + 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR +THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE +STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE +LIBRARY "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, +INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND +FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND +PERFORMANCE OF THE LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, +YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR +REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, +INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING +OUT OF THE USE OR INABILITY TO USE THE LIBRARY (INCLUDING BUT NOT LIMITED TO +LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR +THIRD PARTIES OR A FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), +EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH +DAMAGES. + + END OF TERMS AND CONDITIONS + +------------------- + +ncurses: +Copyright (c) 1998-2005,2006 Free Software Foundation, Inc. + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, distribute with +modifications, sublicense, and/or sell copies of the Software, and to permit +persons to whom the Software is furnished to do so, subject to the following +conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR +IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name(s) of the above copyright holders +shall not be used in advertising or otherwise to promote the sale, use or +other dealings in this Software without prior written authorization. + +------------------- + +OpenSSL: +OpenSSL License +Copyright (c) 1998-2011 The OpenSSL Project. All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + +1. Redistributions of source code must retain the above copyright notice, this +list of conditions and the following disclaimer. + +2. Redistributions in binary form must reproduce the above copyright notice, +this list of conditions and the following disclaimer in the documentation +and/or other materials provided with the distribution. + +3. All advertising materials mentioning features or use of this software must +display the following acknowledgment: "This product includes software +developed by the OpenSSL Project for use in the OpenSSL Toolkit. +(http://www.openssl.org/)" + +4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to +endorse or promote products derived from this software without prior written +permission. For written permission, please contact openssl-core@openssl.org. + +5. Products derived from this software may not be called "OpenSSL" nor may +"OpenSSL" appear in their names without prior written permission of the +OpenSSL Project. + +6. Redistributions of any form whatsoever must retain the following +acknowledgment: "This product includes software developed by the OpenSSL +Project for use in the OpenSSL Toolkit (http://www.openssl.org/)" + +THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY EXPRESSED +OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES +OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO +EVENT SHALL THE OpenSSL PROJECT OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, +INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, +EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +This product includes cryptographic software written by Eric Young +(eay@cryptsoft.com). This product includes software written by Tim Hudson +(tjh@cryptsoft.com). + +Original SSLeay License +Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) All rights reserved. + +This package is an SSL implementation written by Eric Young +(eay@cryptsoft.com). The implementation was written so as to conform with +Netscapes SSL. + +This library is free for commercial and non-commercial use as long as the +following conditions are adhered to. The following conditions apply to all +code found in this distribution, be it the RC4, RSA, lhash, DES, etc., code; +not just the SSL code. The SSL documentation included with this distribution +is covered by the same copyright terms except that the holder is Tim Hudson +(tjh@cryptsoft.com). + +Copyright remains Eric Young's, and as such any Copyright notices in the code +are not to be removed. If this package is used in a product, Eric Young should +be given attribution as the author of the parts of the library used. This can +be in the form of a textual message at program startup or in documentation +(online or textual) provided with the package. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: +1. Redistributions of source code must retain the copyright notice, this list +of conditions and the following disclaimer. +2. Redistributions in binary form must reproduce the above copyright notice, +this list of conditions and the following disclaimer in the documentation +and/or other materials provided with the distribution. +3. All advertising materials mentioning features or use of this software must +display the following acknowledgement: "This product includes cryptographic +software written by Eric Young (eay@cryptsoft.com)" The word 'cryptographic' +can be left out if the rouines from the library being used are not +cryptographic related :-). +4. If you include any Windows specific code (or a derivative thereof) from the +apps directory (application code) you must include an acknowledgement: "This +product includes software written by Tim Hudson (tjh@cryptsoft.com)" + +THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND ANY EXPRESS OR IMPLIED +WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO +EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF +LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, +EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +The licence and distribution terms for any publically available version or +derivative of this code cannot be changed. i.e. this code cannot simply be +copied and put under another distribution licence [including the GNU Public +Licence.] + +------------------- + +zlib: +Acknowledgments: + The deflate format used by zlib was defined by Phil Katz. The deflate and +zlib specifications were written by L. Peter Deutsch. Thanks to all the people +who reported problems and suggested various improvements in zlib; they are too +numerous to cite here. + +Copyright notice: + (C) 1995-2004 Jean-loup Gailly and Mark Adler + + This software is provided 'as-is', without any express or implied warranty. +In no event will the authors be held liable for any damages arising from the +use of this software. + + Permission is granted to anyone to use this software for any purpose, +including commercial applications, and to alter it and redistribute it freely, +subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not +claim that you wrote the original software. If you use this software in a +product, an acknowledgment in the product documentation would be appreciated +but is not required. + 2. Altered source versions must be plainly marked as such, and must not be +misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. + + Jean-loup Gailly Mark Adler + jloup@gzip.org madler@alumni.caltech.edu + +If you use the zlib library in a product, we would appreciate *not* receiving +lengthy legal documents to sign. The sources are provided for free but without +warranty of any kind. The library has been entirely written by Jean-loup +Gailly and Mark Adler; it does not include third-party code. + +If you redistribute modified sources, we would appreciate that you include in +the file ChangeLog history information documenting your changes. Please read +the FAQ for more information on the distribution of modified source versions. diff --git a/src/WARNING.TXT b/src/WARNING.TXT index c61a4fda..e80bbafb 100644 --- a/src/WARNING.TXT +++ b/src/WARNING.TXT @@ -1,565 +1,565 @@ -THE IMPORTANT NOTICES ABOUT SOFTETHER VPN - -FUNCTIONS OF VPN COMMUNICATIONS EMBEDDED ON THIS SOFTWARE ARE VERY POWERFUL -THAN EVER. THIS STRONG VPN ABILITY WILL BRING YOU HUGE BENEFITS. HOWEVER, IF -YOU MISUSE THIS SOFTWARE, IT MIGHT DAMAGE YOURSELF. IN ORDER TO AVOID SUCH -RISKS, THIS DOCUMENT ACCOUNTS IMPORTANT NOTICES FOR CUSTOMERS WHO ARE WILLING -TO USE THIS SOFTWARE. THE FOLLOWING INSTRUCTIONS ARE VERY IMPORTANT. READ AND -UNDERSTAND IT CAREFULLY. ADDITIONALLY, IF YOU ARE PLANNING TO USE THE DYNAMIC -DNS, THE NAT TRAVERSAL OR THE VPN AZURE FUNCTIONS, READ THE SECTION 3.5 -CAREFULLY. THESE FUNCTIONS ARE FREE SERVICES PROVIDED VIA THE INTERNET, ARE -NOT GUARANTEED, AND ARE NOT INTENDED TO BE USED FOR BUSINESS OR COMMERCIAL -USE. DO NOT USE THESE SERVICES FOR YOUR BUSINESS OR COMMERCIAL USE. - - -1. VPN Communication Protocols -1.1. SoftEther VPN Protocol -SoftEther VPN can perform VPN communication. Unlike traditional VPN protocols, -SoftEther VPN has an implementation of the newly-designed "SoftEther VPN -Protocol (SE-VPN Protocol)" . SE-VPN protocol encapsulates any Ethernet -packets into a HTTPS (HTTP over SSL) connection. Therefore SE-VPN protocol can -communicate beyond firewalls even if the firewall is configured to block -traditional VPN packets by network administrator. SE-VPN protocol is designed -and implemented to comply TLS 1.0 (RFC 5246) and HTTPS (RFC 2818). However, it -sometimes have different behavior to RFCs. If you are a network administrator -and want to block SE-VPN protocols on the firewall, you can adopt a -"white-list" policy on the firewall to filter any TCP or UDP packets on the -border except explicitly allowed packets towards specific web sites and -servers. - -1.2. NAT Traversal Function -Generally, if you use traditional VPN systems you have to request a network -administrator to make the NAT or firewall to "open" or "relay" specific TCP or -UDP ports. However, there are demands somehow to eliminate such working costs -on network administrators. In order to satisfy such demands, SoftEther VPN has -the newly-implemented "NAT Traversal" function. NAT Traversal is enabled by -default. A SoftEther VPN Server running on the computer behind NAT or firewall -can accept VPN connections from the Internet, without any special -configurations on firewalls or NATs. If you want to disable the NAT Traversal -function, modify the "DisableNatTraversal" to "true" on the configuration file -of SoftEther VPN Server. In order to disable it on the client-side, append -"/tcp" suffix on the destination hostname. - -1.3. Dynamic DNS Function -Traditional legacy VPN system requires a static global IP address on the VPN -server. In consideration of shortage of global IP addresses, SoftEther -Corporation implements the "Dynamic DNS Function" on SoftEther VPN Server. -Dynamic DNS is enabled by default. Dynamic DNS function notify the current -global IP address of the PC to the Dynamic DNS Servers which are operated by -SoftEther Corporation. A globally-unique hostname (FQDN) such as -"abc.softether.net" ( "abc" varies as unique per a user) will be assigned on -the VPN Server. If you tell this unique hostname to a VPN user, the user can -specify it as the destination VPN Sever hostname on the VPN Client and will be -able to connect the VPN Server. No IP addresses are required to know -beforehand. If the IP address of the VPN Server varies, the registered IP -address related to the hostname of Dynamic DNS service will be changed -automatically. By this mechanism, no longer need a static global IP address -which costs monthly to ISPs. You can use consumer-level inexpensive Internet -connection with dynamic IP address in order to operate an enterprise-level VPN -system. If you want to disable Dynamic DNS, specify "true" on the "Disabled" -items of the "DDnsClient" directive on the SoftEther VPN Server configuration -file. * Note for residents in People's Republic of China: If your VPN Server -is running on the People's Republic of China, the DNS suffix will be replaced -to "sedns.cn" domain. The "sedns.cn" domain is the service possessed and -operated by "Beijing Daiyuu SoftEther Technology Co., Ltd" which is a -Chinese-local enterprise. - -1.4. VPN over ICMP / VPN over DNS functions -If you want to make a VPN connection between SoftEther VPN Client / Bridge and -SoftEther VPN Server, but if TCP and UDP packets are prohibited by the -firewall, then you can encapsulates payloads into "ICMP" (as known as Ping) or -"DNS" packets. This function can realize a VPN connection by using ICMP or DNS -even if the firewall or router blocks every TCP or UDP connections. VPN over -ICMP / VPN over DNS functions are designed to comply standard ICMP and DNS -specifications as possible, however it sometimes has a behavior not to fully -comply them. Therefore, few poor-quality routers may be caused a -memory-overflow or something troubles when a lot of ICMP or DNS packets are -passed, and such routers sometimes freezes or reboots. It might affects other -users on the same network. To avoid such risks, append the suffix "/tcp" on -the destination hostname which is specified on the VPN-client side to disable -VPN over ICMP / DNS functions. - -1.5. VPN Azure Cloud Service -If your SoftEther VPN Server is placed behind the NAT or firewall, and by some -reason you cannot use NAT Traversal function, Dynamic DNS function or VPN over -ICMP/DNS function, you can use VPN Azure Cloud Service. SoftEther Corporation -operates VPN Azure Cloud on Internet. After the VPN Server makes a connection -to the VPN Azure Cloud, the hostname "abc.vpnazure.net" ( "abc" is a unique -hostname) can be specified to connect to the VPN Server via the VPN Azure -Cloud. Practically, such a hostname is pointing a global IP address of one of -cloud servers which are operated by SoftEther Corporation. If A VPN Client -connects to such a VPN Azure host, then the VPN Azure host will relay all -traffics between the VPN Client and the VPN Server. VPN Azure is disabled by -default. You can activate it easily by using VPN Server Configuration Tool. - -1.6. UDP Acceleration -SoftEther VPN has the UDP Acceleration Function. If a VPN consists of two -sites detects that UDP channel can be established, UDP will be automatically -used. By this function, throughput of UDP increases. If direct UDP channel can -be established, direct UDP packets will be used. However, if there is -something obstacles such as firewalls or NATs, the "UDP Hole Punching" -technology will be used, instead. The "UDP Hole Punching" uses the cloud -servers which SoftEther Corporation operates on Internet. UDP Acceleration can -be disabled anytime by setting up so on the VPN-client side. - - -2. VPN Software -2.1. SoftEther VPN Client -If you use SoftEther VPN Client on Windows, the Virtual Network Adapter device -driver will be installed on Windows. The Virtual Network Adapter is -implemented as a kernel-mode driver for Windows. The driver is -digitally-signed by a certificate issued by VeriSign, Inc. and also sub-signed -by Symantec Corporation. A message to ask you want to sure install the driver -might be popped up on the screen. SoftEther VPN Client may response the -message if possible. SoftEther VPN Client also optimizes the configuration of -MMCSS (Multimedia Class Scheduler Service) on Windows. You can undo the -optimizations of MMCSS afterwards. - -2.2. SoftEther VPN Server / Bridge -If you use SoftEther VPN Server / Bridge on Windows with "Local Bridge" -functions, you have to install the low-level Ethernet packet processing driver -on the computer. The driver is digitally-signed by a certificate issued by -VeriSign, Inc. and also sub-signed by Symantec Corporation. SoftEther VPN -Server / Bridge may disable the TCP/IP offloading features on the physical -network adapter for Local Bridge function. In Windows Vista / 2008 or greater -version, VPN Server may inject a packet-filter driver which complies Windows -Filter Platform (WPF) specification into the kernel in order to provide IPsec -function. The packet-filter driver will be loaded available only if IPsec -function is enabled. Once you enables IPsec function of SoftEther VPN Server, -the built-in IPsec function of Windows will be disabled. After you disabled -IPsec function of SoftEther VPN Server, then the built-in IPsec function of -Windows will revive. In order to provide the Local Bridge function, SoftEther -VPN Server / Bridge disables the TCP/IP offloading function on the operating -system. - -2.3. User-mode Installation -You can install SoftEther VPN Server and SoftEther VPN Bridge as "User-mode" -on Windows. In other words, even if you don't have Windows system -administrator's privileges, you can install SoftEther VPN as a normal user. -User-mode install will disable a few functions, however other most functions -work well. Therefore, for example, an employee can install SoftEther VPN -Server on the computer in the office network, and he will be able to connect -to the server from his home. In order to realize such a system by user-self, -no system administrative privileges are required in the view-point of -technical. However, breaking rules of the company to install software on the -computer without authority might be regarded as an unfavorable behavior. If -you are an employee and belong to the company, and the company-policy -prohibits installing software or making communications towards Internet -without permission, you have to obtain a permission from the network -administrator or the executive officer of your company in advance to install -SoftEther VPN. If you install VPN Server / Bridge as User-mode, an icon will -be appeared on the Windows task-tray. If you feel that the icon disturbs you, -you can hide it by your operation. However, you must not exploit this hiding -function to install VPN Server on other person's computer as a spyware. Such -behavior might be an offence against the criminal law. - -2.4. Keep Alive Function -SoftEther VPN Server and SoftEther VPN Bridge has Keep Alive Function by -default. The purpose of this function is to sustain the Internet line active. -The function transmits UDP packets with a random-byte-array-payload -periodically. This function is useful to avoid automatic disconnection on -mobile or dial-up connections. You can disable Keep Alive Function anytime. - -2.5. Uninstallation -The uninstallation process of SoftEther VPN software will delete all program -files. However, non-program files (such as files and data which are generated -by running of programs) ) will not be deleted. For technical reason, the exe -and resource files of uninstaller might remain. Such remaining files never -affects to use the computer, however you can delete it manually. Kernel-mode -drivers might not be deleted, however such drivers will not be loaded after -the next boot of Windows. You can use "sc" command of Windows to delete -kernel-mode drivers manually. - -2.6. Security -You should set the administrator's password on SoftEther VPN Server / Bridge -after installation. If you neglect to do it, another person can access to -SoftEther VPN Server / Bridge and can set the password without your -permission. This caution might be also applied on SoftEther VPN Client for -Linux. - -2.7. Automatic Update Notification -SoftEther VPN software for Windows has an automatic update notification -function. It accesses to the SoftEther Update server periodically to check -whether or not the latest version of software is released. If the latest -version is released, the notification message will be popped up on the screen. -In order to achieve this purpose, the version, language settings, the unique -identifier, the IP address of your computer and the hostname of VPN Server -which is connected to will be sent to the SoftEther Update server. No personal -information will be sent. Automatic Update Notification is enabled by default, -however you can disable it on the configuration screen. The setting whether -turned on or turned off will be saved individually corresponding to each -destination VPN server, by VPN Server Manager. - -2.8. Virtual NAT Function -A Virtual Hub on SoftEther VPN Server / Bridge has "Virtual NAT Function" . -Virtual NAT Function can share a single IP address on the physical network by -multiple private IP address of VPN Clients. There are two operation mode of -Virtual NAT: User-mode and Kernel-mode. In the user-mode operation, Virtual -NAT shares an IP address which is assigned on the host operating system. -Unlike user-mode, the kernel-mode operation attempts to find DHCP servers on -the physical network. If there are two or more physical networks, a DHCP -server will be sought automatically for each segments serially. If a DHCP -server found, and an IP address is acquired, the IP address will be used by -the Virtual NAT. In this case, an IP entry as a DHCP client will be registered -on the IP pool of the physical DHCP Server. The physical default gateway and -the DNS server will be used by the Virtual NAT in order to communicate with -hosts in Internet. In kernel-mode operation, a Virtual Hub has a virtual MAC -address which is operating on the physical Ethernet segment. In order to check -the connectivity to Internet, SoftEther VPN periodically sends DNS query -packet to resolve the IP address of host "www.yahoo.com" or "www.baidu.com" , -and attempts to connect to the TCP port 80 of such a resulted IP address for -connectivity check. - -2.9. Unattended Installation of Kernel-mode Components -When SoftEther VPN will detect a necessity to install the kernel-mode -components on Windows, a confirmation message will be appeared by Windows -system. In this occasion, SoftEther VPN software will switch to the Unattended -Installation mode in order to respond "Yes" to Windows. This is a solution to -prevent dead-locks when a remote-administration is performed from remote -place. - -2.10. Windows Firewall -SoftEther VPN software will register itself as a safe-program. Such an entry -will be remain after the uninstallation. You can remove it manually from the -Control Panel of Windows. - - -3. Internet Services -3.1. Internet Services which are provided by SoftEther Corporation -SoftEther Corporation provides Dynamic DNS, NAT Traversal and VPN Azure server -services on the Internet. These services are free of charge. Customers can -access to the services by using SoftEther VPN software, via Internet. These -service will be planned to be available from Open-Source version of "SoftEther -VPN" which will be released in the future. - -3.2. Sent Information and Privacy Protection -SoftEther VPN software may send an IP address, hostname, the version of VPN -software on the customer's computer to the cloud service operated by SoftEther -Corporation, in order to use the above services. These sending of information -are minimal necessary to use the services. No personal information will be -sent. SoftEther Corporation records log files of the cloud service servers for -90 days at least with the received information. Such logs will be used for -troubleshooting and other legitimate activities. SoftEther Corporation may -provide logs to a public servant of Japanese government who are belonging to -courts, police stations and the prosecutor's office, in order to comply such -authorities' order. (Every Japanese public servants are liable by law to keep -the information close.) Moreover, the IP addresses or other information will -be processed statistically and provided to the public, not to expose the each -concrete IP address, in order to release the release of research activities. - -3.3. Communication Data via VPN Azure Service -Regardless of the above 3.2 rule, if the customer sends or receives VPN -packets using VPN Azure Cloud Service, the actual payloads will stored and -forwarded via the volatile memory of the servers for very short period. Such a -behavior is naturally needed to provide the "VPN relay service" . No payloads -will be recorded on "fixed" storages such as hard-drives. However, the -"Wiretapping for Criminals Procedures Act" (The 137th legislation ruled on -August 18, 1999 in Japan) requires telecommunication companies to allow the -Japanese government authority to conduct a wire-tapping on the line. VPN Azure -Servers which are physically placed on Japan are subjects of this law. - -3.4. Comply to Japanese Telecommunication Laws -SoftEther Corporation complies with Japanese Telecommunication Laws as -necessary to provide online services via Internet. - -3.5. Free and Academic Experiment Services -SoftEther provides Dynamic DNS, NAT Traversal and VPN Azure as academic -experiment services. Therefore, there services can be used for free of charge. -These services are not parts of "SoftEther VPN Software Products" . These -services are provided without any warranty. The services may be suspended or -discontinued by technical or operational matters. In such occasions, users -will not be able to use the services. A user have to understand such risks, -and to acknowledge that such risks are borne by a user-self. SoftEther will -never be liable to results or damages of use or unable-to-use of the service. -Even if the user has already paid the license-fee of the commercial version of -SoftEther VPN, such paid fees don't include any fees of these services. -Therefore, if the online services will stop or be discontinued, no refunds or -recoveries of damages will be provided by SoftEther Corporation. - -3.6. DNS Proxy Cloud Servers -In some regions, when a user uses Internet, a DNS query sometimes broken or -lost when it is passing through the ISP line. If SoftEther VPN Server, Client -or Bridge detects a possibility that the accessing to the actual VPN server -might be unstable, then DNS queries will be also transferred to the DNS proxy -cloud servers which are operated by SoftEther Corporation. A DNS proxy cloud -server will respond DNS queries with answering correct a IP address. - - -4. General Cautions -4.1. Needs an Approval from Network Administrator -SoftEther VPN has powerful functions which don't require special settings by -network administrators. For example, you need not to ask the administrator to -configure the existing firewall in order to "open" a TCP/UDP port. Such -characteristic features are for the purpose to eliminate working times and -costs of network administrators, and avoid misconfiguration-risks around the -tasks to open specific exception ports on the firewall. However, any employees -belong to the company have to obtain an approval from the network -administrator before installs SoftEther VPN. If your network administrator -neglects to provide such an approval, you can consider to take an approval -from an upper authority. (For example, executive officer of the company.) If -you use SoftEther VPN without any approvals from the authority of your -company, you might have disadvantage. SoftEther Corporation will be never -liable for results or damages of using SoftEther VPN. - -4.2. Observe Laws of Your Country -If your country's law prohibits the use of encryption, you have to disable the -encryption function of SoftEther VPN by yourself. Similarly, in some countries -or regions, some functions of SoftEther VPN might be prohibited to use by -laws. Other countries' laws are none of SoftEther Corporation's concern -because SoftEther Corporation is an enterprise which is located and registered -in Japan physically. For example, there might be a risk that a part of -SoftEther VPN conflicts an existing patent which is valid only on the specific -region. SoftEther Corporation has no interests in such specific region outside -Japan's territory. Therefore, if you want to use SoftEther VPN in regions -outside Japan, you have to be careful not to violate third-person's rights. -You have to verify the legitimacy of the use of SoftEther VPN in the specific -region before you actually use it in such region. By nature, there are almost -200 countries in the World, and each country's law is different each other. It -is practically impossible to verify every countries' laws and regulations and -make the software comply with all countries' laws in advance to release the -software. Therefore SoftEther Corporation has verified the legitimacy of -SoftEther VPN against the laws and regulations of only Japan. If a user uses -SoftEther VPN in a specific country, and damaged by public servants of the -government authority, SoftEther Corporation will never be liable to recover or -compensate such damages or criminal responsibilities. - - -5. VPN Gate Academic Experiment Project -(This chapter applies only on SoftEther VPN software package which contains -the extension plug-in for VPN Gate Academic Experiment Project.) -5.1. About VPN Gate Academic Experiment Project -VPN Gate Academic Experiment Project is an online service operated for just -the academic research purpose at the graduate school of University of Tsukuba, -Japan. The purpose of this research is to expend our knowledge about the -"Global Distributed Public VPN Relay Server" (GDPVRS) technology. For details, -please visit https://www.vpngate.net/. - -5.2. About VPN Gate Service -SoftEther VPN Server and SoftEther VPN Client may contain "VPN Gate Service" -program. However, VPN Gate Service is disabled by default. -VPN Gate Service should be activated and enabled by the voluntary intention of -the owner of the computer which SoftEther VPN Server or SoftEther VPN Client -is installed on. After you activate VPN Gate Service, the computer will be -start to serve as a part of the Global Distributed Public VPN Relay Servers. -The IP address, hostname and related information of the computer will be sent -and registered to the directory server of VPN Gate Academic Experiment -Project, and they will be published and disclosed to the public. This -mechanism will allow any VPN Gate Client software's user to connect to the VPN -Gate Service running on your computer. While the VPN session between a VPN -Gate Client and your VPN Gate Service is established, the VPN Gate Client's -user can send/receive any IP packets towards the Internet via the VPN Gate -Service. The global IP address of the VPN Gate Service's hosing computer will -be used as the source IP address of such communications which a VPN Gate -Client initiates. -VPN Gate Service will send some information to the VPN Gate Academic -Experiment Service Directory Server. The information includes the operator's -information which described in section 5.5, logging settings, uptime, -operating system version, type of protocol, port numbers, quality information, -statistical information, VPN Gate clients' log history data (includes dates, -IP addresses, version numbers and IDs) and the version of the software. These -information will be exposed on the directory. VPN Gate Service also receives a -key for encoding which is described on the chapter 5.9 from the directory -server. - -5.3. Details of VPN Gate Service's Behavior -If you enable VPN Gate Service manually, which is disabled by default, the -"VPNGATE" Virtual Hub will be created on the SoftEther VPN Server. If you are -using SoftEther VPN Client and attempt to active VPN Gate Service on it, an -equivalent program to SoftEther VPN Server will be invoked on the same process -of SoftEther VPN Client, and the "VPNGATE" Virtual Hub will be created. The -"VPNGATE" Virtual Hub contains a user named "VPN" by default which permits -anyone on the Internet to make a VPN connection to the Virtual Hub. Once a VPN -Client connects to the "VPNGATE" Virtual Hub, any communication between the -user and the Internet will pass through the Virtual Hub, and -transmitted/received using the physical network interface on the computer -which SoftEther VPN Server (or SoftEther VPN Client) is running on. This will -cause the result that a destination host specified by the VPN Client will -identify that the source of the communication has initiated from the VPN Gate -Service's hosting computer's IP address. However, for safety, any packets -which destinations are within 192.168.0.0/255.255.0.0, 172.16.0.0/255.240.0.0 -or 10.0.0.0/255.0.0.0 will be blocked by the "VPNGATE" Virtual Hub in order to -protect your local network. Therefore, if you run VPN Gate Service on your -corporate network or private network, it is safe because anonymous VPN Client -users will not be permitted to access such private networks. VPN Gate Service -also serves as relay for accessing to the VPN Gate Directory Server. -In order to make VPN Gate Service familiar with firewalls and NATs, it opens -an UDP port by using the NAT Traversal function which is described on the -section 1.2. It also opens and listens on some TCP ports, and some TCP and UDP -ports will be specified as the target port of Universal Plug and Play (UPnP) -Port Transfer entries which are requested to your local routers. UPnP request -packets will be sent periodically. Some routers keep such an opened TCP/UDP -port permanently on the device. If you wish to close them, do it manually. -VPN Gate Service also provides the mirror-site function for www.vpngate.net. -This is a mechanism that a copy of the latest contents from www.vpngate.net -will be hosted by the mirror-site tiny HTTP server which is running on the VPN -Gate Service program. It will register itself on the mirror-sites list in -www.vpngate.net. However, it never relays any other communications which are -not towards www.vpngate.net. - -5.4. Communication between Internet via VPN Gate Service -VPN Gate Service provides a routing between users and the Internet, by using -the Virtual NAT Function which is described on the section 2.8. VPN Gate -Service sends polling Ping packets to the server which is located on -University of Tsukuba, and the Google Public DNS Server which is identified as -8.8.8.8, in order to check the latest quality of your Internet line. VPN Gate -Service also sends and receives a lot of random packets to/from the Speed Test -Server on University of Tsukuba. These quality data will be reported to VPN -Gate Directory Server, automatically and periodically. The result will be -saved and disclosed to the public. These periodical polling communication are -adjusted not to occupy the Internet line, however in some circumstances they -might occupy the line. - -5.5. Operator's Information of VPN Gate Service -If you activate VPN Gate Service on your computer, the computer will be a part -of the Global Distributed Public VPN Relay Servers. Therefore, the Operator's -administrative information of your VPN Gate Service should be reported and -registered on the VPN Gate Service Directory. Operator's information contains -the name of the operator and the abuse-reporting contact e-mail address. These -information can be inputted on the screen if the VPN Gate configuration. -Inputted information will be transmitted to the VPN Gate Directory Server, -stored and disclosed to the public. So you have to be careful to input -information. By the way, until you specify something as the operator's -information, the computer's hostname will be used automatically as the field -of the name of the operator, by appending the "'s owner" string after the -hostname. - -5.6. Observe Laws to Operate VPN Gate Service -In some countries or regions, a user who is planning to activate and operate -VPN Gate Service, he are mandated to obtain a license or register a service -from/to the government. If your region has such a regulation, you must fulfill -mandated process before activating VPN Gate Service in advance. Neither the -developers nor operators of the VPN Gate Academic Experiment Project will be -liable for legal/criminal responsibilities or damages which are occurred from -failure to comply your local laws. - -5.7. Protect Privacy of Communication -Most of countries have a law which requires communication service's operators, -including VPN Gate Service operators, to protect the privacy of communication -of third-persons. When you operate VPN Gate Service, you must always protect -user's privacy. - -5.8. Packet Logs -The packet logging function is implemented on VPN Gate Service. It records -essential headers of major TCP/IP packets which are transmitted via the -Virtual Hub. This function will be helpful to investigate the "original IP -address" of the initiator of communication who was a connected user of your -VPN Gate Service, by checking the packet logs and the connection logs. The -packet logs are recorded only for such legitimate investigates purpose. Do not -peek nor leak packet logs except the rightful purpose. Such act will be -violate the section 5.7. - -5.9. Packet Logs Automatic Archiving and Encoding Function -The VPN Gate Academic Experiment Service is operated and running under the -Japanese constitution and laws. The Japanese constitution laws demand strictly -protection over the privacy of communication. Because this service is under -Japanese rules, the program of VPN Gate Service implements this "Automatic Log -File Encoding" protection mechanism, and enabled by default. -The VPN Gate Service is currently configured to encode packet log files which -has passed two or more weeks automatically, by default. In order to protect -privacy of communication, if a packet log file is once encoded, even the -administrator of the local computer cannot censor the packet log file. This -mechanism protects privacy of end-users of VPN Gate Service. -You can change the VPN Gate Service setting to disable this automatic encoding -function. Then packet log files will never be encoded even after two weeks -passed. In such a configuration, all packet logs will remain as plain-text on -the disk. Therefore you have to take care not to violate user's privacy. -If you are liable to decode an encoded packet log files (for example: a VPN -Gate Service's user illegally abused your VPN Gate Service and you have to -decode the packet logs in order to comply the laws), contact the administrator -of the VPN Gate Academic Experiment Service at Graduate School of University -of Tsukuba, Japan. You can find the contact address at -https://www.vpngate.net/. The administrator of VPN Gate Service will respond to -decode the packet logs if there is an appropriate and legal request from court -or other judicial authorities, according to laws. - -5.10. Caution if You Operate VPN Gate Service in the Japan's Territories -When a user operates VPN Gate Service in the Japan's territories, such an act -may be regulated under the Japanese Telecommunication Laws if the operation is -a subject to the law. However, in such a circumstance, according to the -"Japanese Telecommunication Business Compete Manual [supplemental version]" , -non- profitable operations of communications are not identified as a -"telecommunication business" . So usual operators of VPN Gate Service are not -subjects to "telecommunication business operators" , and not be mandated to -register to the government. Even so, legalities to protect the privacy of -communication still imposed. As a conclusion, if you operate VPN Gate Service -in the Japan's Territories, you must not leak the secrets of communications -which are transmitted via your operating VPN Gate Service. - -5.11. VPN Gate Client -If SoftEther VPN Client contains the VPN Gate Client plug-in, you can use it -to obtain the list of current operating VPN Gate Service servers in the -Internet, and make a VPN connection to a specific server on the list. -VPN Gate Client always keeps the latest list of the VPN Gate Services -periodically. Be careful if you are using a pay-per-use Internet line. -When you start the VPN Gate Client software, the screen which asks you -activate or not VPN Gate Service will be appeared. For details of VPN Gate -Service, read the above sections. - -5.12. Caution before Joining or Exploiting VPN Gate Academic Experiment -Project -The VPN Gate Academic Experiment Service is operated as a research project at -the graduate school on University of Tsukuba, Japan. The service is governed -under the Japanese laws. Other countries' laws are none of our concerns nor -responsibilities. -By nature, there are almost 200 countries in the World, with different laws. -It is impossible to verify every countries' laws and regulations and make the -software comply with all countries' laws in advance to release the software. -If a user uses VPN Gate service in a specific country, and damaged by public -servants of the authority, the developer of either the service or software -will never be liable to recover or compensate such damages or criminal -responsibilities. -By using this software and service, the user must observe all concerned laws -and rules with user's own responsibility. The user will be completely liable -to any damages and responsibilities which are results of using this software -and service, regardless of either inside or outside of Japan's territory. -If you don't agree nor understand the above warnings, do not use any of VPN -Gate Academic Experiment Service functions. -VPN Gate is a research project for just academic purpose only. VPN Gate was -developed as a plug-in for SoftEther VPN and UT-VPN. However, all parts of VPN -Gate were developed on this research project at University of Tsukuba. Any -parts of VPN Gate are not developed by SoftEther Corporation. The VPN Gate -Research Project is not a subject to be led, operated, promoted nor guaranteed -by SoftEther Corporation. - -5.13. The P2P Relay Function in the VPN Gate Client to strengthen the -capability of circumvention of censorship firewalls -VPN Gate Clients, which are published since January 2015, include the P2P -Relay Function. The P2P Relay Function is implemented in order to strengthen -the capability of circumvention of censorship firewalls. If the P2P Relay -Function in your VPN Gate Client is enabled, then the P2P Relay Function will -accept the incoming VPN connections from the VPN Gate users, which are located -on mainly same regions around you, and will provide the relay function to the -external remote VPN Gate Servers, which are hosted by third parties in the -free Internet environment. This P2P Relay Function never provides the shared -NAT functions nor replaces the outgoing IP address of the VPN Gate users to -your IP addresses because this P2P Relay Function only provides the -"reflection service" (hair-pin relaying), relaying from incoming VPN Gate -users to an external VPN Gate Server. In this situation, VPN tunnels via your -P2P Relay Function will be finally terminated on the external VPN Gate Server, -not your VPN Gate Client. However, the VPN Gate Server as the final -destination will record your IP address as the source IP address of VPN -tunnels which will be initiated by your P2P Relay Function. Additionally, user -packets which are transmitted via your P2P Relay Function will be recorded on -your computer as packet logs as described on the section 5.8. After you -installed the VPN Gate Client, and if the P2P Relay Function will be enabled -automatically, then all matters on the 5.2, 5.3, 5.4, 5.5, 5.6, 5.7, 5.8, 5.9, -5.10, 5.11 and 5.12 sections will be applied to you and your computer, as same -to the situation when you enabled the VPN Gate Service (the VPN Gate Server -function). If your P2P Function is enabled, then your computer's IP address -and the default operator's name which is described on the section 5.5 will be -listed on the VPN Gate Server List which is provided by the VPN Gate Project. -You can change these strings by editing the "vpn_gate_relay.config" file -manually. Note that you need to stop the VPN Client service before editing it. -The VPN Gate Client will automatically enable the P2P Relay Function on your -computer if the VPN Gate Client detects that your computer might be located in -regions where there are existing censorship firewalls. If you want to disable -the P2P Relay Function, you must set the "DisableRelayServer" flag to "true" -on the "vpn_client.config" file which is the configuration file of the VPN -Client. Note that you need to stop the VPN Client service before editing it. -The VPN Gate Client does not recognize the particular regulation of your -country or your region. The VPN Gate Client activates the P2P Relay Function -even if your country or your region has the law to restrict running P2P relay -functions. Therefore, in such a case, you must disable the P2P Relay Function -on the VPN Gate Client manually by setting the "DisableRelayServer" flag if -you reside in such a restricted area, in your own responsibility. - +THE IMPORTANT NOTICES ABOUT SOFTETHER VPN + +FUNCTIONS OF VPN COMMUNICATIONS EMBEDDED ON THIS SOFTWARE ARE VERY POWERFUL +THAN EVER. THIS STRONG VPN ABILITY WILL BRING YOU HUGE BENEFITS. HOWEVER, IF +YOU MISUSE THIS SOFTWARE, IT MIGHT DAMAGE YOURSELF. IN ORDER TO AVOID SUCH +RISKS, THIS DOCUMENT ACCOUNTS IMPORTANT NOTICES FOR CUSTOMERS WHO ARE WILLING +TO USE THIS SOFTWARE. THE FOLLOWING INSTRUCTIONS ARE VERY IMPORTANT. READ AND +UNDERSTAND IT CAREFULLY. ADDITIONALLY, IF YOU ARE PLANNING TO USE THE DYNAMIC +DNS, THE NAT TRAVERSAL OR THE VPN AZURE FUNCTIONS, READ THE SECTION 3.5 +CAREFULLY. THESE FUNCTIONS ARE FREE SERVICES PROVIDED VIA THE INTERNET, ARE +NOT GUARANTEED, AND ARE NOT INTENDED TO BE USED FOR BUSINESS OR COMMERCIAL +USE. DO NOT USE THESE SERVICES FOR YOUR BUSINESS OR COMMERCIAL USE. + + +1. VPN Communication Protocols +1.1. SoftEther VPN Protocol +SoftEther VPN can perform VPN communication. Unlike traditional VPN protocols, +SoftEther VPN has an implementation of the newly-designed "SoftEther VPN +Protocol (SE-VPN Protocol)" . SE-VPN protocol encapsulates any Ethernet +packets into a HTTPS (HTTP over SSL) connection. Therefore SE-VPN protocol can +communicate beyond firewalls even if the firewall is configured to block +traditional VPN packets by network administrator. SE-VPN protocol is designed +and implemented to comply TLS 1.0 (RFC 5246) and HTTPS (RFC 2818). However, it +sometimes have different behavior to RFCs. If you are a network administrator +and want to block SE-VPN protocols on the firewall, you can adopt a +"white-list" policy on the firewall to filter any TCP or UDP packets on the +border except explicitly allowed packets towards specific web sites and +servers. + +1.2. NAT Traversal Function +Generally, if you use traditional VPN systems you have to request a network +administrator to make the NAT or firewall to "open" or "relay" specific TCP or +UDP ports. However, there are demands somehow to eliminate such working costs +on network administrators. In order to satisfy such demands, SoftEther VPN has +the newly-implemented "NAT Traversal" function. NAT Traversal is enabled by +default. A SoftEther VPN Server running on the computer behind NAT or firewall +can accept VPN connections from the Internet, without any special +configurations on firewalls or NATs. If you want to disable the NAT Traversal +function, modify the "DisableNatTraversal" to "true" on the configuration file +of SoftEther VPN Server. In order to disable it on the client-side, append +"/tcp" suffix on the destination hostname. + +1.3. Dynamic DNS Function +Traditional legacy VPN system requires a static global IP address on the VPN +server. In consideration of shortage of global IP addresses, SoftEther +Corporation implements the "Dynamic DNS Function" on SoftEther VPN Server. +Dynamic DNS is enabled by default. Dynamic DNS function notify the current +global IP address of the PC to the Dynamic DNS Servers which are operated by +SoftEther Corporation. A globally-unique hostname (FQDN) such as +"abc.softether.net" ( "abc" varies as unique per a user) will be assigned on +the VPN Server. If you tell this unique hostname to a VPN user, the user can +specify it as the destination VPN Sever hostname on the VPN Client and will be +able to connect the VPN Server. No IP addresses are required to know +beforehand. If the IP address of the VPN Server varies, the registered IP +address related to the hostname of Dynamic DNS service will be changed +automatically. By this mechanism, no longer need a static global IP address +which costs monthly to ISPs. You can use consumer-level inexpensive Internet +connection with dynamic IP address in order to operate an enterprise-level VPN +system. If you want to disable Dynamic DNS, specify "true" on the "Disabled" +items of the "DDnsClient" directive on the SoftEther VPN Server configuration +file. * Note for residents in People's Republic of China: If your VPN Server +is running on the People's Republic of China, the DNS suffix will be replaced +to "sedns.cn" domain. The "sedns.cn" domain is the service possessed and +operated by "Beijing Daiyuu SoftEther Technology Co., Ltd" which is a +Chinese-local enterprise. + +1.4. VPN over ICMP / VPN over DNS functions +If you want to make a VPN connection between SoftEther VPN Client / Bridge and +SoftEther VPN Server, but if TCP and UDP packets are prohibited by the +firewall, then you can encapsulates payloads into "ICMP" (as known as Ping) or +"DNS" packets. This function can realize a VPN connection by using ICMP or DNS +even if the firewall or router blocks every TCP or UDP connections. VPN over +ICMP / VPN over DNS functions are designed to comply standard ICMP and DNS +specifications as possible, however it sometimes has a behavior not to fully +comply them. Therefore, few poor-quality routers may be caused a +memory-overflow or something troubles when a lot of ICMP or DNS packets are +passed, and such routers sometimes freezes or reboots. It might affects other +users on the same network. To avoid such risks, append the suffix "/tcp" on +the destination hostname which is specified on the VPN-client side to disable +VPN over ICMP / DNS functions. + +1.5. VPN Azure Cloud Service +If your SoftEther VPN Server is placed behind the NAT or firewall, and by some +reason you cannot use NAT Traversal function, Dynamic DNS function or VPN over +ICMP/DNS function, you can use VPN Azure Cloud Service. SoftEther Corporation +operates VPN Azure Cloud on Internet. After the VPN Server makes a connection +to the VPN Azure Cloud, the hostname "abc.vpnazure.net" ( "abc" is a unique +hostname) can be specified to connect to the VPN Server via the VPN Azure +Cloud. Practically, such a hostname is pointing a global IP address of one of +cloud servers which are operated by SoftEther Corporation. If A VPN Client +connects to such a VPN Azure host, then the VPN Azure host will relay all +traffics between the VPN Client and the VPN Server. VPN Azure is disabled by +default. You can activate it easily by using VPN Server Configuration Tool. + +1.6. UDP Acceleration +SoftEther VPN has the UDP Acceleration Function. If a VPN consists of two +sites detects that UDP channel can be established, UDP will be automatically +used. By this function, throughput of UDP increases. If direct UDP channel can +be established, direct UDP packets will be used. However, if there is +something obstacles such as firewalls or NATs, the "UDP Hole Punching" +technology will be used, instead. The "UDP Hole Punching" uses the cloud +servers which SoftEther Corporation operates on Internet. UDP Acceleration can +be disabled anytime by setting up so on the VPN-client side. + + +2. VPN Software +2.1. SoftEther VPN Client +If you use SoftEther VPN Client on Windows, the Virtual Network Adapter device +driver will be installed on Windows. The Virtual Network Adapter is +implemented as a kernel-mode driver for Windows. The driver is +digitally-signed by a certificate issued by VeriSign, Inc. and also sub-signed +by Symantec Corporation. A message to ask you want to sure install the driver +might be popped up on the screen. SoftEther VPN Client may response the +message if possible. SoftEther VPN Client also optimizes the configuration of +MMCSS (Multimedia Class Scheduler Service) on Windows. You can undo the +optimizations of MMCSS afterwards. + +2.2. SoftEther VPN Server / Bridge +If you use SoftEther VPN Server / Bridge on Windows with "Local Bridge" +functions, you have to install the low-level Ethernet packet processing driver +on the computer. The driver is digitally-signed by a certificate issued by +VeriSign, Inc. and also sub-signed by Symantec Corporation. SoftEther VPN +Server / Bridge may disable the TCP/IP offloading features on the physical +network adapter for Local Bridge function. In Windows Vista / 2008 or greater +version, VPN Server may inject a packet-filter driver which complies Windows +Filter Platform (WPF) specification into the kernel in order to provide IPsec +function. The packet-filter driver will be loaded available only if IPsec +function is enabled. Once you enables IPsec function of SoftEther VPN Server, +the built-in IPsec function of Windows will be disabled. After you disabled +IPsec function of SoftEther VPN Server, then the built-in IPsec function of +Windows will revive. In order to provide the Local Bridge function, SoftEther +VPN Server / Bridge disables the TCP/IP offloading function on the operating +system. + +2.3. User-mode Installation +You can install SoftEther VPN Server and SoftEther VPN Bridge as "User-mode" +on Windows. In other words, even if you don't have Windows system +administrator's privileges, you can install SoftEther VPN as a normal user. +User-mode install will disable a few functions, however other most functions +work well. Therefore, for example, an employee can install SoftEther VPN +Server on the computer in the office network, and he will be able to connect +to the server from his home. In order to realize such a system by user-self, +no system administrative privileges are required in the view-point of +technical. However, breaking rules of the company to install software on the +computer without authority might be regarded as an unfavorable behavior. If +you are an employee and belong to the company, and the company-policy +prohibits installing software or making communications towards Internet +without permission, you have to obtain a permission from the network +administrator or the executive officer of your company in advance to install +SoftEther VPN. If you install VPN Server / Bridge as User-mode, an icon will +be appeared on the Windows task-tray. If you feel that the icon disturbs you, +you can hide it by your operation. However, you must not exploit this hiding +function to install VPN Server on other person's computer as a spyware. Such +behavior might be an offence against the criminal law. + +2.4. Keep Alive Function +SoftEther VPN Server and SoftEther VPN Bridge has Keep Alive Function by +default. The purpose of this function is to sustain the Internet line active. +The function transmits UDP packets with a random-byte-array-payload +periodically. This function is useful to avoid automatic disconnection on +mobile or dial-up connections. You can disable Keep Alive Function anytime. + +2.5. Uninstallation +The uninstallation process of SoftEther VPN software will delete all program +files. However, non-program files (such as files and data which are generated +by running of programs) ) will not be deleted. For technical reason, the exe +and resource files of uninstaller might remain. Such remaining files never +affects to use the computer, however you can delete it manually. Kernel-mode +drivers might not be deleted, however such drivers will not be loaded after +the next boot of Windows. You can use "sc" command of Windows to delete +kernel-mode drivers manually. + +2.6. Security +You should set the administrator's password on SoftEther VPN Server / Bridge +after installation. If you neglect to do it, another person can access to +SoftEther VPN Server / Bridge and can set the password without your +permission. This caution might be also applied on SoftEther VPN Client for +Linux. + +2.7. Automatic Update Notification +SoftEther VPN software for Windows has an automatic update notification +function. It accesses to the SoftEther Update server periodically to check +whether or not the latest version of software is released. If the latest +version is released, the notification message will be popped up on the screen. +In order to achieve this purpose, the version, language settings, the unique +identifier, the IP address of your computer and the hostname of VPN Server +which is connected to will be sent to the SoftEther Update server. No personal +information will be sent. Automatic Update Notification is enabled by default, +however you can disable it on the configuration screen. The setting whether +turned on or turned off will be saved individually corresponding to each +destination VPN server, by VPN Server Manager. + +2.8. Virtual NAT Function +A Virtual Hub on SoftEther VPN Server / Bridge has "Virtual NAT Function" . +Virtual NAT Function can share a single IP address on the physical network by +multiple private IP address of VPN Clients. There are two operation mode of +Virtual NAT: User-mode and Kernel-mode. In the user-mode operation, Virtual +NAT shares an IP address which is assigned on the host operating system. +Unlike user-mode, the kernel-mode operation attempts to find DHCP servers on +the physical network. If there are two or more physical networks, a DHCP +server will be sought automatically for each segments serially. If a DHCP +server found, and an IP address is acquired, the IP address will be used by +the Virtual NAT. In this case, an IP entry as a DHCP client will be registered +on the IP pool of the physical DHCP Server. The physical default gateway and +the DNS server will be used by the Virtual NAT in order to communicate with +hosts in Internet. In kernel-mode operation, a Virtual Hub has a virtual MAC +address which is operating on the physical Ethernet segment. In order to check +the connectivity to Internet, SoftEther VPN periodically sends DNS query +packet to resolve the IP address of host "www.yahoo.com" or "www.baidu.com" , +and attempts to connect to the TCP port 80 of such a resulted IP address for +connectivity check. + +2.9. Unattended Installation of Kernel-mode Components +When SoftEther VPN will detect a necessity to install the kernel-mode +components on Windows, a confirmation message will be appeared by Windows +system. In this occasion, SoftEther VPN software will switch to the Unattended +Installation mode in order to respond "Yes" to Windows. This is a solution to +prevent dead-locks when a remote-administration is performed from remote +place. + +2.10. Windows Firewall +SoftEther VPN software will register itself as a safe-program. Such an entry +will be remain after the uninstallation. You can remove it manually from the +Control Panel of Windows. + + +3. Internet Services +3.1. Internet Services which are provided by SoftEther Corporation +SoftEther Corporation provides Dynamic DNS, NAT Traversal and VPN Azure server +services on the Internet. These services are free of charge. Customers can +access to the services by using SoftEther VPN software, via Internet. These +service will be planned to be available from Open-Source version of "SoftEther +VPN" which will be released in the future. + +3.2. Sent Information and Privacy Protection +SoftEther VPN software may send an IP address, hostname, the version of VPN +software on the customer's computer to the cloud service operated by SoftEther +Corporation, in order to use the above services. These sending of information +are minimal necessary to use the services. No personal information will be +sent. SoftEther Corporation records log files of the cloud service servers for +90 days at least with the received information. Such logs will be used for +troubleshooting and other legitimate activities. SoftEther Corporation may +provide logs to a public servant of Japanese government who are belonging to +courts, police stations and the prosecutor's office, in order to comply such +authorities' order. (Every Japanese public servants are liable by law to keep +the information close.) Moreover, the IP addresses or other information will +be processed statistically and provided to the public, not to expose the each +concrete IP address, in order to release the release of research activities. + +3.3. Communication Data via VPN Azure Service +Regardless of the above 3.2 rule, if the customer sends or receives VPN +packets using VPN Azure Cloud Service, the actual payloads will stored and +forwarded via the volatile memory of the servers for very short period. Such a +behavior is naturally needed to provide the "VPN relay service" . No payloads +will be recorded on "fixed" storages such as hard-drives. However, the +"Wiretapping for Criminals Procedures Act" (The 137th legislation ruled on +August 18, 1999 in Japan) requires telecommunication companies to allow the +Japanese government authority to conduct a wire-tapping on the line. VPN Azure +Servers which are physically placed on Japan are subjects of this law. + +3.4. Comply to Japanese Telecommunication Laws +SoftEther Corporation complies with Japanese Telecommunication Laws as +necessary to provide online services via Internet. + +3.5. Free and Academic Experiment Services +SoftEther provides Dynamic DNS, NAT Traversal and VPN Azure as academic +experiment services. Therefore, there services can be used for free of charge. +These services are not parts of "SoftEther VPN Software Products" . These +services are provided without any warranty. The services may be suspended or +discontinued by technical or operational matters. In such occasions, users +will not be able to use the services. A user have to understand such risks, +and to acknowledge that such risks are borne by a user-self. SoftEther will +never be liable to results or damages of use or unable-to-use of the service. +Even if the user has already paid the license-fee of the commercial version of +SoftEther VPN, such paid fees don't include any fees of these services. +Therefore, if the online services will stop or be discontinued, no refunds or +recoveries of damages will be provided by SoftEther Corporation. + +3.6. DNS Proxy Cloud Servers +In some regions, when a user uses Internet, a DNS query sometimes broken or +lost when it is passing through the ISP line. If SoftEther VPN Server, Client +or Bridge detects a possibility that the accessing to the actual VPN server +might be unstable, then DNS queries will be also transferred to the DNS proxy +cloud servers which are operated by SoftEther Corporation. A DNS proxy cloud +server will respond DNS queries with answering correct a IP address. + + +4. General Cautions +4.1. Needs an Approval from Network Administrator +SoftEther VPN has powerful functions which don't require special settings by +network administrators. For example, you need not to ask the administrator to +configure the existing firewall in order to "open" a TCP/UDP port. Such +characteristic features are for the purpose to eliminate working times and +costs of network administrators, and avoid misconfiguration-risks around the +tasks to open specific exception ports on the firewall. However, any employees +belong to the company have to obtain an approval from the network +administrator before installs SoftEther VPN. If your network administrator +neglects to provide such an approval, you can consider to take an approval +from an upper authority. (For example, executive officer of the company.) If +you use SoftEther VPN without any approvals from the authority of your +company, you might have disadvantage. SoftEther Corporation will be never +liable for results or damages of using SoftEther VPN. + +4.2. Observe Laws of Your Country +If your country's law prohibits the use of encryption, you have to disable the +encryption function of SoftEther VPN by yourself. Similarly, in some countries +or regions, some functions of SoftEther VPN might be prohibited to use by +laws. Other countries' laws are none of SoftEther Corporation's concern +because SoftEther Corporation is an enterprise which is located and registered +in Japan physically. For example, there might be a risk that a part of +SoftEther VPN conflicts an existing patent which is valid only on the specific +region. SoftEther Corporation has no interests in such specific region outside +Japan's territory. Therefore, if you want to use SoftEther VPN in regions +outside Japan, you have to be careful not to violate third-person's rights. +You have to verify the legitimacy of the use of SoftEther VPN in the specific +region before you actually use it in such region. By nature, there are almost +200 countries in the World, and each country's law is different each other. It +is practically impossible to verify every countries' laws and regulations and +make the software comply with all countries' laws in advance to release the +software. Therefore SoftEther Corporation has verified the legitimacy of +SoftEther VPN against the laws and regulations of only Japan. If a user uses +SoftEther VPN in a specific country, and damaged by public servants of the +government authority, SoftEther Corporation will never be liable to recover or +compensate such damages or criminal responsibilities. + + +5. VPN Gate Academic Experiment Project +(This chapter applies only on SoftEther VPN software package which contains +the extension plug-in for VPN Gate Academic Experiment Project.) +5.1. About VPN Gate Academic Experiment Project +VPN Gate Academic Experiment Project is an online service operated for just +the academic research purpose at the graduate school of University of Tsukuba, +Japan. The purpose of this research is to expend our knowledge about the +"Global Distributed Public VPN Relay Server" (GDPVRS) technology. For details, +please visit https://www.vpngate.net/. + +5.2. About VPN Gate Service +SoftEther VPN Server and SoftEther VPN Client may contain "VPN Gate Service" +program. However, VPN Gate Service is disabled by default. +VPN Gate Service should be activated and enabled by the voluntary intention of +the owner of the computer which SoftEther VPN Server or SoftEther VPN Client +is installed on. After you activate VPN Gate Service, the computer will be +start to serve as a part of the Global Distributed Public VPN Relay Servers. +The IP address, hostname and related information of the computer will be sent +and registered to the directory server of VPN Gate Academic Experiment +Project, and they will be published and disclosed to the public. This +mechanism will allow any VPN Gate Client software's user to connect to the VPN +Gate Service running on your computer. While the VPN session between a VPN +Gate Client and your VPN Gate Service is established, the VPN Gate Client's +user can send/receive any IP packets towards the Internet via the VPN Gate +Service. The global IP address of the VPN Gate Service's hosing computer will +be used as the source IP address of such communications which a VPN Gate +Client initiates. +VPN Gate Service will send some information to the VPN Gate Academic +Experiment Service Directory Server. The information includes the operator's +information which described in section 5.5, logging settings, uptime, +operating system version, type of protocol, port numbers, quality information, +statistical information, VPN Gate clients' log history data (includes dates, +IP addresses, version numbers and IDs) and the version of the software. These +information will be exposed on the directory. VPN Gate Service also receives a +key for encoding which is described on the chapter 5.9 from the directory +server. + +5.3. Details of VPN Gate Service's Behavior +If you enable VPN Gate Service manually, which is disabled by default, the +"VPNGATE" Virtual Hub will be created on the SoftEther VPN Server. If you are +using SoftEther VPN Client and attempt to active VPN Gate Service on it, an +equivalent program to SoftEther VPN Server will be invoked on the same process +of SoftEther VPN Client, and the "VPNGATE" Virtual Hub will be created. The +"VPNGATE" Virtual Hub contains a user named "VPN" by default which permits +anyone on the Internet to make a VPN connection to the Virtual Hub. Once a VPN +Client connects to the "VPNGATE" Virtual Hub, any communication between the +user and the Internet will pass through the Virtual Hub, and +transmitted/received using the physical network interface on the computer +which SoftEther VPN Server (or SoftEther VPN Client) is running on. This will +cause the result that a destination host specified by the VPN Client will +identify that the source of the communication has initiated from the VPN Gate +Service's hosting computer's IP address. However, for safety, any packets +which destinations are within 192.168.0.0/255.255.0.0, 172.16.0.0/255.240.0.0 +or 10.0.0.0/255.0.0.0 will be blocked by the "VPNGATE" Virtual Hub in order to +protect your local network. Therefore, if you run VPN Gate Service on your +corporate network or private network, it is safe because anonymous VPN Client +users will not be permitted to access such private networks. VPN Gate Service +also serves as relay for accessing to the VPN Gate Directory Server. +In order to make VPN Gate Service familiar with firewalls and NATs, it opens +an UDP port by using the NAT Traversal function which is described on the +section 1.2. It also opens and listens on some TCP ports, and some TCP and UDP +ports will be specified as the target port of Universal Plug and Play (UPnP) +Port Transfer entries which are requested to your local routers. UPnP request +packets will be sent periodically. Some routers keep such an opened TCP/UDP +port permanently on the device. If you wish to close them, do it manually. +VPN Gate Service also provides the mirror-site function for www.vpngate.net. +This is a mechanism that a copy of the latest contents from www.vpngate.net +will be hosted by the mirror-site tiny HTTP server which is running on the VPN +Gate Service program. It will register itself on the mirror-sites list in +www.vpngate.net. However, it never relays any other communications which are +not towards www.vpngate.net. + +5.4. Communication between Internet via VPN Gate Service +VPN Gate Service provides a routing between users and the Internet, by using +the Virtual NAT Function which is described on the section 2.8. VPN Gate +Service sends polling Ping packets to the server which is located on +University of Tsukuba, and the Google Public DNS Server which is identified as +8.8.8.8, in order to check the latest quality of your Internet line. VPN Gate +Service also sends and receives a lot of random packets to/from the Speed Test +Server on University of Tsukuba. These quality data will be reported to VPN +Gate Directory Server, automatically and periodically. The result will be +saved and disclosed to the public. These periodical polling communication are +adjusted not to occupy the Internet line, however in some circumstances they +might occupy the line. + +5.5. Operator's Information of VPN Gate Service +If you activate VPN Gate Service on your computer, the computer will be a part +of the Global Distributed Public VPN Relay Servers. Therefore, the Operator's +administrative information of your VPN Gate Service should be reported and +registered on the VPN Gate Service Directory. Operator's information contains +the name of the operator and the abuse-reporting contact e-mail address. These +information can be inputted on the screen if the VPN Gate configuration. +Inputted information will be transmitted to the VPN Gate Directory Server, +stored and disclosed to the public. So you have to be careful to input +information. By the way, until you specify something as the operator's +information, the computer's hostname will be used automatically as the field +of the name of the operator, by appending the "'s owner" string after the +hostname. + +5.6. Observe Laws to Operate VPN Gate Service +In some countries or regions, a user who is planning to activate and operate +VPN Gate Service, he are mandated to obtain a license or register a service +from/to the government. If your region has such a regulation, you must fulfill +mandated process before activating VPN Gate Service in advance. Neither the +developers nor operators of the VPN Gate Academic Experiment Project will be +liable for legal/criminal responsibilities or damages which are occurred from +failure to comply your local laws. + +5.7. Protect Privacy of Communication +Most of countries have a law which requires communication service's operators, +including VPN Gate Service operators, to protect the privacy of communication +of third-persons. When you operate VPN Gate Service, you must always protect +user's privacy. + +5.8. Packet Logs +The packet logging function is implemented on VPN Gate Service. It records +essential headers of major TCP/IP packets which are transmitted via the +Virtual Hub. This function will be helpful to investigate the "original IP +address" of the initiator of communication who was a connected user of your +VPN Gate Service, by checking the packet logs and the connection logs. The +packet logs are recorded only for such legitimate investigates purpose. Do not +peek nor leak packet logs except the rightful purpose. Such act will be +violate the section 5.7. + +5.9. Packet Logs Automatic Archiving and Encoding Function +The VPN Gate Academic Experiment Service is operated and running under the +Japanese constitution and laws. The Japanese constitution laws demand strictly +protection over the privacy of communication. Because this service is under +Japanese rules, the program of VPN Gate Service implements this "Automatic Log +File Encoding" protection mechanism, and enabled by default. +The VPN Gate Service is currently configured to encode packet log files which +has passed two or more weeks automatically, by default. In order to protect +privacy of communication, if a packet log file is once encoded, even the +administrator of the local computer cannot censor the packet log file. This +mechanism protects privacy of end-users of VPN Gate Service. +You can change the VPN Gate Service setting to disable this automatic encoding +function. Then packet log files will never be encoded even after two weeks +passed. In such a configuration, all packet logs will remain as plain-text on +the disk. Therefore you have to take care not to violate user's privacy. +If you are liable to decode an encoded packet log files (for example: a VPN +Gate Service's user illegally abused your VPN Gate Service and you have to +decode the packet logs in order to comply the laws), contact the administrator +of the VPN Gate Academic Experiment Service at Graduate School of University +of Tsukuba, Japan. You can find the contact address at +https://www.vpngate.net/. The administrator of VPN Gate Service will respond to +decode the packet logs if there is an appropriate and legal request from court +or other judicial authorities, according to laws. + +5.10. Caution if You Operate VPN Gate Service in the Japan's Territories +When a user operates VPN Gate Service in the Japan's territories, such an act +may be regulated under the Japanese Telecommunication Laws if the operation is +a subject to the law. However, in such a circumstance, according to the +"Japanese Telecommunication Business Compete Manual [supplemental version]" , +non- profitable operations of communications are not identified as a +"telecommunication business" . So usual operators of VPN Gate Service are not +subjects to "telecommunication business operators" , and not be mandated to +register to the government. Even so, legalities to protect the privacy of +communication still imposed. As a conclusion, if you operate VPN Gate Service +in the Japan's Territories, you must not leak the secrets of communications +which are transmitted via your operating VPN Gate Service. + +5.11. VPN Gate Client +If SoftEther VPN Client contains the VPN Gate Client plug-in, you can use it +to obtain the list of current operating VPN Gate Service servers in the +Internet, and make a VPN connection to a specific server on the list. +VPN Gate Client always keeps the latest list of the VPN Gate Services +periodically. Be careful if you are using a pay-per-use Internet line. +When you start the VPN Gate Client software, the screen which asks you +activate or not VPN Gate Service will be appeared. For details of VPN Gate +Service, read the above sections. + +5.12. Caution before Joining or Exploiting VPN Gate Academic Experiment +Project +The VPN Gate Academic Experiment Service is operated as a research project at +the graduate school on University of Tsukuba, Japan. The service is governed +under the Japanese laws. Other countries' laws are none of our concerns nor +responsibilities. +By nature, there are almost 200 countries in the World, with different laws. +It is impossible to verify every countries' laws and regulations and make the +software comply with all countries' laws in advance to release the software. +If a user uses VPN Gate service in a specific country, and damaged by public +servants of the authority, the developer of either the service or software +will never be liable to recover or compensate such damages or criminal +responsibilities. +By using this software and service, the user must observe all concerned laws +and rules with user's own responsibility. The user will be completely liable +to any damages and responsibilities which are results of using this software +and service, regardless of either inside or outside of Japan's territory. +If you don't agree nor understand the above warnings, do not use any of VPN +Gate Academic Experiment Service functions. +VPN Gate is a research project for just academic purpose only. VPN Gate was +developed as a plug-in for SoftEther VPN and UT-VPN. However, all parts of VPN +Gate were developed on this research project at University of Tsukuba. Any +parts of VPN Gate are not developed by SoftEther Corporation. The VPN Gate +Research Project is not a subject to be led, operated, promoted nor guaranteed +by SoftEther Corporation. + +5.13. The P2P Relay Function in the VPN Gate Client to strengthen the +capability of circumvention of censorship firewalls +VPN Gate Clients, which are published since January 2015, include the P2P +Relay Function. The P2P Relay Function is implemented in order to strengthen +the capability of circumvention of censorship firewalls. If the P2P Relay +Function in your VPN Gate Client is enabled, then the P2P Relay Function will +accept the incoming VPN connections from the VPN Gate users, which are located +on mainly same regions around you, and will provide the relay function to the +external remote VPN Gate Servers, which are hosted by third parties in the +free Internet environment. This P2P Relay Function never provides the shared +NAT functions nor replaces the outgoing IP address of the VPN Gate users to +your IP addresses because this P2P Relay Function only provides the +"reflection service" (hair-pin relaying), relaying from incoming VPN Gate +users to an external VPN Gate Server. In this situation, VPN tunnels via your +P2P Relay Function will be finally terminated on the external VPN Gate Server, +not your VPN Gate Client. However, the VPN Gate Server as the final +destination will record your IP address as the source IP address of VPN +tunnels which will be initiated by your P2P Relay Function. Additionally, user +packets which are transmitted via your P2P Relay Function will be recorded on +your computer as packet logs as described on the section 5.8. After you +installed the VPN Gate Client, and if the P2P Relay Function will be enabled +automatically, then all matters on the 5.2, 5.3, 5.4, 5.5, 5.6, 5.7, 5.8, 5.9, +5.10, 5.11 and 5.12 sections will be applied to you and your computer, as same +to the situation when you enabled the VPN Gate Service (the VPN Gate Server +function). If your P2P Function is enabled, then your computer's IP address +and the default operator's name which is described on the section 5.5 will be +listed on the VPN Gate Server List which is provided by the VPN Gate Project. +You can change these strings by editing the "vpn_gate_relay.config" file +manually. Note that you need to stop the VPN Client service before editing it. +The VPN Gate Client will automatically enable the P2P Relay Function on your +computer if the VPN Gate Client detects that your computer might be located in +regions where there are existing censorship firewalls. If you want to disable +the P2P Relay Function, you must set the "DisableRelayServer" flag to "true" +on the "vpn_client.config" file which is the configuration file of the VPN +Client. Note that you need to stop the VPN Client service before editing it. +The VPN Gate Client does not recognize the particular regulation of your +country or your region. The VPN Gate Client activates the P2P Relay Function +even if your country or your region has the law to restrict running P2P relay +functions. Therefore, in such a case, you must disable the P2P Relay Function +on the VPN Gate Client manually by setting the "DisableRelayServer" flag if +you reside in such a restricted area, in your own responsibility. + diff --git a/src/Wfp/Wfp.c b/src/Wfp/Wfp.c index facf11e9..4f4c900a 100644 --- a/src/Wfp/Wfp.c +++ b/src/Wfp/Wfp.c @@ -1,1243 +1,1243 @@ -// SoftEther VPN Source Code - Developer Edition Master Branch -// Windows Filtering Platform Callout Driver for Capturing IPsec Packets on Windows Vista / 7 / Server 2008 - - -// Wfp.c -// WFP Callout Driver - -#include - -#define WFP_DEVICE_DRIVER - -#include "WfpInner.h" -#include "Wfp.h" - -static WFP_CTX *wfp = NULL; -static bool g_is_win8 = false; -static POOL_TYPE g_pool_type = NonPagedPool; - -// Dispatch function -NTSTATUS DriverDispatch(DEVICE_OBJECT *device_object, IRP *irp) -{ - NTSTATUS ret = STATUS_SUCCESS; - IO_STACK_LOCATION *stack; - void *buf; - bool ok; - // Validate arguments - if (wfp == NULL || device_object == NULL || irp == NULL || wfp->Halting) - { - return NDIS_STATUS_FAILURE; - } - - // Get the IRP stack - stack = IoGetCurrentIrpStackLocation(irp); - - // Initialize the number of bytes - irp->IoStatus.Information = 0; - irp->IoStatus.Status = STATUS_SUCCESS; - - buf = irp->UserBuffer; - - if (wfp->Halting != FALSE) - { - // Device driver is terminating - irp->IoStatus.Information = STATUS_UNSUCCESSFUL; - IoCompleteRequest(irp, IO_NO_INCREMENT); - return STATUS_UNSUCCESSFUL; - } - - ok = false; - - // Branch to each operation - switch (stack->MajorFunction) - { - case IRP_MJ_CREATE: // Open - ok = true; - break; - - case IRP_MJ_CLOSE: // Close - ok = true; - break; - - case IRP_MJ_READ: // Read - ResetEvent(wfp->Event); - break; - - case IRP_MJ_WRITE: // Write - if ((stack->Parameters.Write.Length % sizeof(WFP_LOCAL_IP)) == 0) - { - // Address check - bool check_ok = true; - __try - { - ProbeForRead(buf, stack->Parameters.Write.Length, 1); - } - __except (EXCEPTION_EXECUTE_HANDLER) - { - check_ok = false; - } - - if (check_ok) - { - MDL *mdl = IoAllocateMdl(buf, stack->Parameters.Write.Length, false, false, NULL); - UINT size = MIN(WFP_MAX_LOCAL_IP_COUNT * sizeof(WFP_LOCAL_IP), stack->Parameters.Write.Length); - UCHAR *copied_buf = Malloc(size); - UCHAR *old_buf; - - if (mdl != NULL) - { - MmProbeAndLockPages(mdl, KernelMode, IoWriteAccess); - } - - Copy(copied_buf, buf, size); - - SpinLock(wfp->LocalIPListLock); - { - old_buf = wfp->LocalIPListData; - wfp->LocalIPListData = copied_buf; - wfp->LocalIPListSize = size; - } - SpinUnlock(wfp->LocalIPListLock); - - if (old_buf != NULL) - { - Free(old_buf); - } - - if (mdl != NULL) - { - MmUnlockPages(mdl); - IoFreeMdl(mdl); - } - } - } - irp->IoStatus.Information = stack->Parameters.Write.Length; - ok = true; - break; - } - - if (ok == false) - { - irp->IoStatus.Status = STATUS_UNSUCCESSFUL; - ret = STATUS_UNSUCCESSFUL; - } - - IoCompleteRequest(irp, IO_NO_INCREMENT); - - return ret; -} - -// Function to finish the insertion of the packet -void NTAPI CalloutInjectionCompleted(void *context, NET_BUFFER_LIST *net_buffer_list, BOOLEAN dispatch_level) -{ - WFP_INJECTED_PACKET_CONTEXT *ctx = (WFP_INJECTED_PACKET_CONTEXT *)context; - - if (ctx == NULL) - { - return; - } - - FreeInjectionCtx(ctx); -} - -// Release the injection data -void FreeInjectionCtx(WFP_INJECTED_PACKET_CONTEXT *ctx) -{ - // Validate arguments - if (ctx == NULL) - { - return; - } - - if (ctx->CurrentNetBuffer != NULL) - { - Copy(ctx->CurrentNetBuffer, &ctx->OriginalNetBufferData, sizeof(NET_BUFFER)); - } - - if (ctx->AllocatedNetBufferList != NULL) - { - FwpsFreeCloneNetBufferList0(ctx->AllocatedNetBufferList, 0); - } - - if (ctx->AllocatedMdl != NULL) - { - NdisFreeMdl(ctx->AllocatedMdl); - } - - if (ctx->AllocatedMemory != NULL) - { - Free(ctx->AllocatedMemory); - } - - Free(ctx); -} - -// Calculate the checksum -USHORT IpChecksum(void *buf, UINT size) -{ - int sum = 0; - USHORT *addr = (USHORT *)buf; - int len = (int)size; - USHORT *w = addr; - int nleft = len; - USHORT answer = 0; - - while (nleft > 1) - { - sum += *w++; - nleft -= 2; - } - - if (nleft == 1) - { - *(UCHAR *)(&answer) = *(UCHAR *)w; - sum += answer; - } - - sum = (sum >> 16) + (sum & 0xffff); - sum += (sum >> 16); - - answer = ~sum; - - return answer; -} - -// Modify the IPsec ESP packet -UCHAR *ModificationOfIPsecESPPacket(UCHAR *ip_packet, UINT ip_packet_size, UINT ip_header_size, UINT *dst_size_ptr, bool isv6) -{ - UINT ip_and_udp_header_size = ip_header_size + sizeof(WFP_UDP_HEADER); - UINT udp_packet_size; - UINT udp_payload_size; - UINT dst_udp_payload_size; - WFP_UDP_HEADER *src_udp; - WFP_UDP_HEADER *dst_udp; - UCHAR *src_udp_payload; - UCHAR *dst_data; - UINT dst_size; - // Validate arguments - if (ip_packet == NULL || ip_packet == 0 || ip_header_size == 0 || dst_size_ptr == NULL) - { - return NULL; - } - - if (ip_packet_size <= ip_and_udp_header_size) - { - // There is no UDP header - return NULL; - } - - // Get the UDP header - src_udp = (WFP_UDP_HEADER *)(ip_packet + ip_header_size); - udp_packet_size = Endian16(src_udp->PacketLength); - if (udp_packet_size < sizeof(WFP_UDP_HEADER)) - { - // There is no UDP payload - return NULL; - } - - // Get the UDP payload size - udp_payload_size = udp_packet_size - sizeof(WFP_UDP_HEADER); - - if (ip_packet_size < (ip_and_udp_header_size + udp_payload_size)) - { - // There is no UDP payload - return NULL; - } - - // Get the UDP payload - src_udp_payload = ip_packet + ip_and_udp_header_size; - - if (udp_payload_size < sizeof(UINT)) - { - // The size of the UDP payload is less than 5 bytes - return NULL; - } - - dst_udp_payload_size = udp_payload_size + sizeof(UINT) * 3; - if ((dst_udp_payload_size + sizeof(WFP_UDP_HEADER)) > 0xffff) - { - // UDP payload size overflows the 16bit - return NULL; - } - - // Build a new packet - dst_size = ip_and_udp_header_size + sizeof(UINT) * 3 + udp_payload_size; - if (dst_size > 0xffff) - { - // IP total size overflows the 16bit - return NULL; - } - - dst_data = Malloc(dst_size); - if (dst_data == NULL) - { - // Memory allocation failure - return NULL; - } - - // Copy the IP header + UDP header - Copy(dst_data, ip_packet, ip_and_udp_header_size); - - // Copy the original payload - Copy(dst_data + ip_and_udp_header_size + sizeof(UINT) * 3, src_udp_payload, udp_payload_size); - - // Insert a tag - *((UINT *)(dst_data + ip_and_udp_header_size + sizeof(UINT) * 0)) = 0; - *((UINT *)(dst_data + ip_and_udp_header_size + sizeof(UINT) * 1)) = WFP_ESP_PACKET_TAG_1; - *((UINT *)(dst_data + ip_and_udp_header_size + sizeof(UINT) * 2)) = WFP_ESP_PACKET_TAG_2; - - // Adjust the new IP header - if (isv6 == false) - { - WFP_IPV4_HEADER *ip = (WFP_IPV4_HEADER *)dst_data; - - ip->TotalLength = Endian16(dst_size); - ip->Checksum = 0; - ip->Checksum = IpChecksum(ip, ip_header_size); - } - else - { - WFP_IPV6_HEADER *ip = (WFP_IPV6_HEADER *)dst_data; - - ip->PayloadLength = Endian16(dst_size); - } - - // Adjust the new UDP header - dst_udp = (WFP_UDP_HEADER *)(dst_data + ip_header_size); - dst_udp->Checksum = 0; - dst_udp->PacketLength = Endian16((USHORT)(dst_udp_payload_size + sizeof(WFP_UDP_HEADER))); - - *dst_size_ptr = dst_size; - return dst_data; -} - -// Insert the packet into the stack -bool InjectPacket(HANDLE hInjection, NET_BUFFER_LIST *nbl, UCHAR *dst_data, UINT dst_size, const FWPS_INCOMING_VALUES0* inFixedValues, const FWPS_INCOMING_METADATA_VALUES0* inMetaValues) -{ - WFP_INJECTED_PACKET_CONTEXT *ctx; - bool block = false; - // Validate arguments - if (hInjection == NULL || nbl == NULL || dst_data == NULL || dst_size == 0 || inMetaValues == NULL || inFixedValues == NULL) - { - return false; - } - - ctx = ZeroMalloc(sizeof(WFP_INJECTED_PACKET_CONTEXT)); - - if (ctx != NULL) - { - // Generate a modified packet - ctx->AllocatedMemory = dst_data; - - if (dst_data != NULL) - { - NET_BUFFER_LIST *net_buffer_list; - NTSTATUS ret; - - // Clone the original NET_BUFFER_LIST - ret = FwpsAllocateCloneNetBufferList0(nbl, NULL, NULL, 0, &net_buffer_list); - - if (OK(ret) && net_buffer_list != NULL) - { - NET_BUFFER *net_buffer = NET_BUFFER_LIST_FIRST_NB(net_buffer_list); - - ctx->AllocatedNetBufferList = net_buffer_list; - ctx->CurrentNetBuffer = net_buffer; - - if (net_buffer != NULL) - { - MDL *mdl = NdisAllocateMdl(wfp->hNdis, dst_data, dst_size); - if (mdl != NULL) - { - NTSTATUS ret; - - ctx->AllocatedMdl = mdl; - - Copy(&ctx->OriginalNetBufferData, net_buffer, sizeof(NET_BUFFER)); - - NET_BUFFER_FIRST_MDL(net_buffer) = mdl; - NET_BUFFER_DATA_LENGTH(net_buffer) = dst_size; - NET_BUFFER_DATA_OFFSET(net_buffer) = 0; - NET_BUFFER_CURRENT_MDL(net_buffer) = mdl; - NET_BUFFER_CURRENT_MDL_OFFSET(net_buffer) = 0; - - // Insert packets of receiving direction - ret = FwpsInjectNetworkReceiveAsync0(hInjection, NULL, - 0, - (inMetaValues->currentMetadataValues & FWPS_METADATA_FIELD_COMPARTMENT_ID ? inMetaValues->compartmentId : UNSPECIFIED_COMPARTMENT_ID), - inFixedValues->incomingValue[FWPS_FIELD_INBOUND_IPPACKET_V4_INTERFACE_INDEX].value.uint32, - inFixedValues->incomingValue[FWPS_FIELD_INBOUND_IPPACKET_V4_SUB_INTERFACE_INDEX].value.uint32, - net_buffer_list, - CalloutInjectionCompleted, - (HANDLE)ctx); - - if (NG(ret)) - { - //CRUSH_WHERE; - } - else - { - block = true; - } - } - else - { - //CRUSH_WHERE; - } - } - else - { - //CRUSH_WHERE; - } - } - else - { - //CRUSH_WHERE; - } - } - else - { - //CRUSH_WHERE; - } - - if (block == false) - { - FreeInjectionCtx(ctx); - } - } - - return block; -} - -// Function to be notified of arriving packet -void NTAPI CalloutClassify(const FWPS_INCOMING_VALUES0* inFixedValues, - const FWPS_INCOMING_METADATA_VALUES0* inMetaValues, - void* layerData, - const FWPS_FILTER0* filter, - UINT64 flowContext, - FWPS_CLASSIFY_OUT0* classifyOut) -{ - NET_BUFFER_LIST *nbl = layerData; - FWPS_PACKET_INJECTION_STATE injection_state; - bool block = false; - HANDLE hInjection = NULL; - UINT ip_header_len = 0; - bool isv6 = false; - - if (wfp->Halting || nbl == NULL) - { - classifyOut->actionType = FWP_ACTION_CONTINUE; - return; - } - - switch (inFixedValues->layerId) - { - case FWPS_LAYER_INBOUND_IPPACKET_V4: - hInjection = wfp->hInjectionIPv4; - ip_header_len = sizeof(WFP_IPV4_HEADER); - break; - - case FWPS_LAYER_INBOUND_IPPACKET_V6: - hInjection = wfp->hInjectionIPv6; - ip_header_len = sizeof(WFP_IPV6_HEADER); - isv6 = true; - break; - } - - if (hInjection != NULL) - { - injection_state = FwpsQueryPacketInjectionState0(hInjection, nbl, NULL); - - if (injection_state == FWPS_PACKET_INJECTED_BY_SELF || injection_state == FWPS_PACKET_PREVIOUSLY_INJECTED_BY_SELF) - { - //SetEvent(wfp->Event); - classifyOut->actionType = FWP_ACTION_CONTINUE; // continue - return; - } - - if (nbl != NULL && NET_BUFFER_LIST_NEXT_NBL(nbl) == NULL) - { - NET_BUFFER *nb = NET_BUFFER_LIST_FIRST_NB(nbl); - - if (nb != NULL && NET_BUFFER_NEXT_NB(nb) == NULL && (NET_BUFFER_DATA_OFFSET(nb) >= inMetaValues->ipHeaderSize)) - { - if (OK(NdisRetreatNetBufferDataStart(nb, inMetaValues->ipHeaderSize, 0, NULL))) - { - WFP_IPV4_HEADER *ipv4; - WFP_IPV6_HEADER *ipv6; - UCHAR *alloc_buf = Malloc(ip_header_len); - - ipv4 = NdisGetDataBuffer(nb, ip_header_len, alloc_buf, 1, 0); - ipv6 = (WFP_IPV6_HEADER *)ipv4; - - if (ipv4 != NULL) - { - if ((isv6 == false && ipv4->Protocol == WFP_ESP_RAW_PROTOCOL_ID)) - { - if (IsIPv4AddressInList(&ipv4->DstIP)) - { - UINT src_size = NET_BUFFER_DATA_LENGTH(nb); - UCHAR *src_data = Malloc(src_size); - - if (src_data != NULL) - { - UCHAR *src_ptr = NdisGetDataBuffer(nb, src_size, src_data, 1, 0); - - if (src_ptr != NULL) - { - UINT dst_size = src_size; - UCHAR *dst_data = Malloc(dst_size); - - if (dst_data != NULL) - { - WFP_IPV4_HEADER *ipv4; - - Copy(dst_data, src_ptr, dst_size); - ipv4 = (WFP_IPV4_HEADER *)dst_data; - - ipv4->Protocol = WFP_ESP_RAW_PROTOCOL_ID_DST; - ipv4->Checksum = 0; - ipv4->Checksum = IpChecksum(ipv4, inMetaValues->ipHeaderSize); - - block = InjectPacket(hInjection, nbl, dst_data, dst_size, inFixedValues, inMetaValues); - } - } - - Free(src_data); - } - } - } - else if ((isv6 && ipv6->NextHeader == WFP_ESP_RAW_PROTOCOL_ID)) - { - if (IsIPv6AddressInList(&ipv6->DestAddress)) - { - UINT src_size = NET_BUFFER_DATA_LENGTH(nb); - UCHAR *src_data = Malloc(src_size); - - if (src_data != NULL) - { - UCHAR *src_ptr = NdisGetDataBuffer(nb, src_size, src_data, 1, 0); - - if (src_ptr != NULL) - { - UINT dst_size = src_size; - UCHAR *dst_data = Malloc(dst_size); - - if (dst_data != NULL) - { - WFP_IPV6_HEADER *ipv6; - - Copy(dst_data, src_ptr, dst_size); - ipv6 = (WFP_IPV6_HEADER *)dst_data; - - ipv6->NextHeader = WFP_ESP_RAW_PROTOCOL_ID_DST; - - block = InjectPacket(hInjection, nbl, dst_data, dst_size, inFixedValues, inMetaValues); - } - } - - Free(src_data); - } - } - } - - if ((isv6 == false && ipv4->Protocol == WFP_IP_PROTO_UDP) || - (isv6 && ipv6->NextHeader == WFP_IP_PROTO_UDP)) - { - UINT ip_and_udp_header_len = inMetaValues->ipHeaderSize + sizeof(WFP_UDP_HEADER); - UCHAR *ptr; - UCHAR *alloc_buf = Malloc(ip_and_udp_header_len); - - ptr = NdisGetDataBuffer(nb, ip_and_udp_header_len, alloc_buf, 1, 0); - if (ptr != NULL) - { - WFP_UDP_HEADER *udp = (WFP_UDP_HEADER *)(ptr + inMetaValues->ipHeaderSize); - - if (Endian16(udp->DstPort) == 4500) - { - if ((isv6 == false && IsIPv4AddressInList(&ipv4->DstIP)) || - (isv6 && IsIPv6AddressInList(&ipv6->DestAddress))) - { - UINT packet_size = NET_BUFFER_DATA_LENGTH(nb); - UCHAR *packet_buf_allocated = Malloc(packet_size); - UCHAR *packet_data = NdisGetDataBuffer(nb, packet_size, packet_buf_allocated, 1, 0); - - if (packet_data != NULL) - { - UCHAR *udp_payload = packet_data + ip_and_udp_header_len; - UINT udp_payload_size = packet_size - ip_and_udp_header_len; - - if (udp_payload_size >= 4) - { - UINT *i = (UINT *)udp_payload; - if (*i != 0) - { - // Generate a modified packet - UINT dst_size; - UCHAR *dst_data = ModificationOfIPsecESPPacket(packet_data, packet_size, - inMetaValues->ipHeaderSize, &dst_size, isv6); - - block = InjectPacket(hInjection, nbl, dst_data, dst_size, inFixedValues, inMetaValues); - } - } - } - else - { - //CRUSH_WHERE; - } - - Free(packet_buf_allocated); - } - } - } - else - { - //CRUSH_WHERE; - } - - Free(alloc_buf); - } - } - - Free(alloc_buf); - - NdisAdvanceNetBufferDataStart(nb, inMetaValues->ipHeaderSize, false, NULL); - } - else - { - //CRUSH_WHERE; - } - - nb = NET_BUFFER_NEXT_NB(nb); - } - - nbl = NET_BUFFER_LIST_NEXT_NBL(nbl); - } - } - - classifyOut->actionType = FWP_ACTION_CONTINUE; - - if (block) - { - // Block the packet - classifyOut->actionType = FWP_ACTION_BLOCK; - classifyOut->rights &= ~FWPS_RIGHT_ACTION_WRITE; - classifyOut->flags |= FWPS_CLASSIFY_OUT_FLAG_ABSORB; - //SetEvent(wfp->Event); - } -} - -// Function to receive notification from the WFP -NTSTATUS NTAPI CalloutNotify(FWPS_CALLOUT_NOTIFY_TYPE notifyType, - const GUID* filterKey, FWPS_FILTER0* filter) -{ - //Crush(1,0,0,0); - return 0; -} - -// Scan whether the specified IP address is in the local IP address list -bool IsIPAddressInList(struct WFP_LOCAL_IP *ip) -{ - bool ret = false; - // Validate arguments - if (ip == NULL) - { - return false; - } - - SpinLock(wfp->LocalIPListLock); - { - if (wfp->LocalIPListData != NULL) - { - UINT num = wfp->LocalIPListSize / sizeof(WFP_LOCAL_IP); - WFP_LOCAL_IP *o = (WFP_LOCAL_IP *)wfp->LocalIPListData; - UINT i; - - for (i = 0;i < num;i++) - { - if (Cmp(&o[i], ip, sizeof(WFP_LOCAL_IP)) == 0) - { - ret = true; - break; - } - } - } - } - SpinUnlock(wfp->LocalIPListLock); - - return ret; -} -bool IsIPv4AddressInList(void *addr) -{ - WFP_LOCAL_IP ip; - // Validate arguments - if (addr == NULL) - { - return false; - } - - Zero(&ip, sizeof(ip)); - ip.IpVersion = 4; - Copy(ip.IpAddress.IPv4Address, addr, 4); - - return IsIPAddressInList(&ip); -} -bool IsIPv6AddressInList(void *addr) -{ - WFP_LOCAL_IP ip; - // Validate arguments - if (addr == NULL) - { - return false; - } - - Zero(&ip, sizeof(ip)); - ip.IpVersion = 6; - Copy(ip.IpAddress.IPv6Address, addr, 16); - - return IsIPAddressInList(&ip); -} - -// Win32 driver entry point -NTSTATUS DriverEntry(DRIVER_OBJECT *driver_object, UNICODE_STRING *registry_path) -{ - NTSTATUS ret; - FWPM_SESSION0 t; - ULONG os_ver1 = 0, os_ver2 = 0; - - if (wfp != NULL) - { - return STATUS_UNSUCCESSFUL; - } - - g_is_win8 = false; - g_pool_type = NonPagedPool; - - PsGetVersion(&os_ver1, &os_ver2, NULL, NULL); - - if ((os_ver1 == 6 && os_ver2 >= 2) || (os_ver1 >= 7)) - { - g_is_win8 = true; - g_pool_type = 512; - } - - wfp = ZeroMalloc(sizeof(WFP_CTX)); - - RtlInitUnicodeString(&wfp->DeviceName, WFP_DEVICE_NAME); - RtlInitUnicodeString(&wfp->DeviceNameWin32, WFP_DEVICE_NAME_WIN32); - // Create a device - ret = IoCreateDevice(driver_object, 0, &wfp->DeviceName, FILE_DEVICE_NETWORK, 0, false, &wfp->DeviceObject); - if (NG(ret)) - { - return ret; - } - - // Open the NDIS handle - wfp->hNdis = NdisAllocateGenericObject(driver_object, MEMPOOL_TAG, 0); - if (wfp->hNdis == NULL) - { - DriverUnload(driver_object); - return STATUS_UNSUCCESSFUL; - } - - // Create a symbolic device for Win32 - ret = IoCreateSymbolicLink(&wfp->DeviceNameWin32, &wfp->DeviceName); - if (NG(ret)) - { - DriverUnload(driver_object); - return ret; - } - - driver_object->DriverUnload = DriverUnload; - - // Create an Event - wfp->Event = NewEvent(WFP_EVENT_NAME); - if (wfp->Event == NULL) - { - DriverUnload(driver_object); - return STATUS_UNSUCCESSFUL; - } - - // Open the WFP engine - Zero(&t, sizeof(t)); - t.flags = FWPM_SESSION_FLAG_DYNAMIC; - ret = FwpmEngineOpen0(NULL, RPC_C_AUTHN_DEFAULT, NULL, &t, &wfp->hEngine); - if (NG(ret)) - { - DriverUnload(driver_object); - return ret; - } - else - { - // Register itself as a Callout Driver - FWPS_CALLOUT0 s; -// FWPM_CALLOUT0 callout; - - Zero(&s, sizeof(s)); - s.calloutKey = GUID_WFP_CALLOUT_DRIVER_V4; - s.classifyFn = CalloutClassify; - s.notifyFn = CalloutNotify; - - ret = FwpsCalloutRegister0(wfp->DeviceObject, &s, &wfp->CalloutIdIPv4); - if (NG(ret)) - { - DriverUnload(driver_object); - return ret; - } - - Zero(&s, sizeof(s)); - s.calloutKey = GUID_WFP_CALLOUT_DRIVER_V6; - s.classifyFn = CalloutClassify; - s.notifyFn = CalloutNotify; - - ret = FwpsCalloutRegister0(wfp->DeviceObject, &s, &wfp->CalloutIdIPv6); - if (NG(ret)) - { - DriverUnload(driver_object); - return ret; - } - - /*// Create the Callout Driver (IPv4) - Zero(&callout, sizeof(callout)); - callout.calloutKey = GUID_WFP_CALLOUT_DRIVER_V4; - callout.applicableLayer = FWPM_LAYER_INBOUND_IPPACKET_V4; - callout.displayData.name = WFP_DRIVER_TITLE_V4; - ret = FwpmCalloutAdd0(wfp->hEngine, &callout, NULL, &wfp->CalloutObjIdIPv4); - - // Create the Callout Driver (IPv6) - Zero(&callout, sizeof(callout)); - callout.calloutKey = GUID_WFP_CALLOUT_DRIVER_V6; - callout.applicableLayer = FWPM_LAYER_INBOUND_IPPACKET_V6; - callout.displayData.name = WFP_DRIVER_TITLE_V6; - ret = FwpmCalloutAdd0(wfp->hEngine, &callout, NULL, &wfp->CalloutObjIdIPv6);*/ - - // Create an injection handle - FwpsInjectionHandleCreate0(AF_INET, FWPS_INJECTION_TYPE_NETWORK, &wfp->hInjectionIPv4); - if (NG(ret)) - { - wfp->hInjectionIPv4 = NULL; - } - ret = FwpsInjectionHandleCreate0(AF_INET6, FWPS_INJECTION_TYPE_NETWORK,&wfp->hInjectionIPv6); - if (NG(ret)) - { - wfp->hInjectionIPv6 = NULL; - } - } - - // Create a lock - wfp->LocalIPListLock = NewSpinLock(); - - // Specify a service function - driver_object->MajorFunction[IRP_MJ_CREATE] = - driver_object->MajorFunction[IRP_MJ_CLOSE] = - driver_object->MajorFunction[IRP_MJ_READ] = - driver_object->MajorFunction[IRP_MJ_WRITE] = DriverDispatch; - - return STATUS_SUCCESS; -} - -// Unload the driver -void DriverUnload(DRIVER_OBJECT *driver_object) -{ - // Validate arguments - if (wfp == NULL || driver_object == NULL) - { - return; - } - - wfp->Halting = true; - - // Delete the lock - FreeSpinLock(wfp->LocalIPListLock); - - // Delete the injection handle - if (wfp->hInjectionIPv4 != NULL) - { - FwpsInjectionHandleDestroy0(wfp->hInjectionIPv4); - } - if (wfp->hInjectionIPv6 != NULL) - { - FwpsInjectionHandleDestroy0(wfp->hInjectionIPv6); - } - - // Delete the Callout Object - if (wfp->hEngine != NULL) - { - //FwpmCalloutDeleteByKey0(wfp->hEngine, &GUID_WFP_CALLOUT_DRIVER_V4); - //FwpmCalloutDeleteByKey0(wfp->hEngine, &GUID_WFP_CALLOUT_DRIVER_V6); - } - - if (wfp->CalloutIdIPv4 != 0) - { - // Delete the registration of Callout Driver (IPv4) - FwpsCalloutUnregisterById0(wfp->CalloutIdIPv4); - } - - if (wfp->CalloutIdIPv6 != 0) - { - // Delete the registration of Callout Driver (IPv6) - FwpsCalloutUnregisterById0(wfp->CalloutIdIPv6); - } - - FreeEvent(wfp->Event); - - IoDeleteSymbolicLink(&wfp->DeviceNameWin32); - - if (wfp->DeviceObject != NULL) - { - IoDeleteDevice(wfp->DeviceObject); - } - - if (wfp->hEngine != NULL) - { - FwpmEngineClose0(wfp->hEngine); - } - - if (wfp->LocalIPListData != NULL) - { - Free(wfp->LocalIPListData); - } - - // Close the NDIS handle - if (wfp->hNdis != NULL) - { - NdisFreeGenericObject(wfp->hNdis); - } - - Free(wfp); - - wfp = NULL; -} - -// Create an Event -EVENT *NewEvent(wchar_t *name) -{ - EVENT *e; - KEVENT *ke; - HANDLE h; - UNICODE_STRING name_str; - // Validate arguments - if (name == NULL) - { - return NULL; - } - - RtlInitUnicodeString(&name_str, name); - - ke = IoCreateNotificationEvent(&name_str, &h); - if (ke == NULL) - { - return NULL; - } - - KeInitializeEvent(ke, NotificationEvent, false); - KeClearEvent(ke); - - e = ZeroMalloc(sizeof(EVENT)); - - e->EventObj = ke; - e->Handle = h; - - return e; -} - -// Delete the event -void FreeEvent(EVENT *e) -{ - // Validate arguments - if (e == NULL) - { - return; - } - - ZwClose(e->Handle); - - Free(e); -} - -// Set the event -void SetEvent(EVENT *e) -{ - // Validate arguments - if (e == NULL) - { - return; - } - - KeSetEvent(e->EventObj, 0, false); -} - -// Reset the event -void ResetEvent(EVENT *e) -{ - // Validate arguments - if (e == NULL) - { - return; - } - - KeResetEvent(e->EventObj); -} - -// Allocate the memory -void *Malloc(UINT size) -{ - void *p; - - p = ExAllocatePoolWithTag(g_pool_type, size + sizeof(UINT), MEMPOOL_TAG); - *((UINT *)p) = size; - - return ((UCHAR *)p) + sizeof(UINT); -} -void *ZeroMalloc(UINT size) -{ - void *p = Malloc(size); - Zero(p, size); - return p; -} - -// Change the memory block size -void *ReAlloc(void *p, UINT size) -{ - void *ret; - UINT oldsize; - // Validate arguments - if (p == NULL) - { - return NULL; - } - - ret = Malloc(size); - if (ret == NULL) - { - Free(p); - return NULL; - } - - oldsize = GetMemSize(p); - - Copy(ret, p, MIN(size, oldsize)); - - Free(p); - - return ret; -} - -// Copy memory -void Copy(void *dst, void *src, UINT size) -{ - // Validate arguments - if (dst == NULL || src == NULL || size == 0) - { - return; - } - - memcpy(dst, src, size); -} - -// Get the memory block size -UINT GetMemSize(void *p) -{ - // Validate arguments - if (p == NULL) - { - return 0; - } - - return *(UINT *)(((UCHAR *)p) - sizeof(UINT)); -} - -// Release the memory -void Free(void *p) -{ - // Validate arguments - if (p == NULL) - { - return; - } - - p = ((UCHAR *)p) - sizeof(UINT); - - ExFreePoolWithTag(p, MEMPOOL_TAG); -} - -// Clear the memory to zero -void Zero(void *p, UINT size) -{ - // Validate arguments - if (p == NULL || size == 0) - { - return; - } - - memset(p, 0, size); -} - -// Comparison of memory -UINT Cmp(void *p1, void *p2, UINT size) -{ - UCHAR *c1 = (UCHAR *)p1; - UCHAR *c2 = (UCHAR *)p2; - UINT i; - - for (i = 0;i < size;i++) - { - if (c1[i] != c2[i]) - { - if (c1[i] > c2[i]) - { - return 1; - } - else - { - return -1; - } - } - } - - return 0; -} - -// Create a spin lock -SPINLOCK *NewSpinLock() -{ - SPINLOCK *s = ZeroMalloc(sizeof(SPINLOCK)); - - KeInitializeSpinLock(&s->SpinLock); - - return s; -} - -// Lock -void SpinLock(SPINLOCK *s) -{ - // Validate arguments - if (s == NULL) - { - return; - } - - KeAcquireSpinLock(&s->SpinLock, &s->OldIrql); -} - -// Unlock -void SpinUnlock(SPINLOCK *s) -{ - // Validate arguments - if (s == NULL) - { - return; - } - - KeReleaseSpinLock(&s->SpinLock, s->OldIrql); -} - -// Release the spin lock -void FreeSpinLock(SPINLOCK *s) -{ - // Validate arguments - if (s == NULL) - { - return; - } - - Free(s); -} - -// Sleep -void Sleep(int milliSeconds) -{ - PKTIMER timer = ZeroMalloc(sizeof(KTIMER)); - LARGE_INTEGER duetime; - - duetime.QuadPart = (__int64)milliSeconds * -10000; - KeInitializeTimerEx(timer, NotificationTimer); - KeSetTimerEx(timer, duetime, 0, NULL); - - KeWaitForSingleObject (timer, Executive, KernelMode, FALSE, NULL); - - Free(timer); -} - -// 16-bit swap -USHORT Swap16(USHORT value) -{ - USHORT r; - ((BYTE *)&r)[0] = ((BYTE *)&value)[1]; - ((BYTE *)&r)[1] = ((BYTE *)&value)[0]; - return r; -} - -// 32-bit swap -UINT Swap32(UINT value) -{ - UINT r; - ((BYTE *)&r)[0] = ((BYTE *)&value)[3]; - ((BYTE *)&r)[1] = ((BYTE *)&value)[2]; - ((BYTE *)&r)[2] = ((BYTE *)&value)[1]; - ((BYTE *)&r)[3] = ((BYTE *)&value)[0]; - return r; -} - -// 64-bit swap -UINT64 Swap64(UINT64 value) -{ - UINT64 r; - ((BYTE *)&r)[0] = ((BYTE *)&value)[7]; - ((BYTE *)&r)[1] = ((BYTE *)&value)[6]; - ((BYTE *)&r)[2] = ((BYTE *)&value)[5]; - ((BYTE *)&r)[3] = ((BYTE *)&value)[4]; - ((BYTE *)&r)[4] = ((BYTE *)&value)[3]; - ((BYTE *)&r)[5] = ((BYTE *)&value)[2]; - ((BYTE *)&r)[6] = ((BYTE *)&value)[1]; - ((BYTE *)&r)[7] = ((BYTE *)&value)[0]; - return r; -} - -// Endian conversion 16bit -USHORT Endian16(USHORT src) -{ - int x = 1; - if (*((char *)&x)) - { - return Swap16(src); - } - else - { - return src; - } -} - -// Endian conversion 32bit -UINT Endian32(UINT src) -{ - int x = 1; - if (*((char *)&x)) - { - return Swap32(src); - } - else - { - return src; - } -} - -// Endian conversion 64bit -UINT64 Endian64(UINT64 src) -{ - int x = 1; - if (*((char *)&x)) - { - return Swap64(src); - } - else - { - return src; - } -} - -// Crash -void Crush(UINT a, UINT b, UINT c, UINT d) -{ - KeBugCheckEx(0x00000061, (ULONG_PTR)a, (ULONG_PTR)b, (ULONG_PTR)c, (ULONG_PTR)d); -} +// SoftEther VPN Source Code - Developer Edition Master Branch +// Windows Filtering Platform Callout Driver for Capturing IPsec Packets on Windows Vista / 7 / Server 2008 + + +// Wfp.c +// WFP Callout Driver + +#include + +#define WFP_DEVICE_DRIVER + +#include "WfpInner.h" +#include "Wfp.h" + +static WFP_CTX *wfp = NULL; +static bool g_is_win8 = false; +static POOL_TYPE g_pool_type = NonPagedPool; + +// Dispatch function +NTSTATUS DriverDispatch(DEVICE_OBJECT *device_object, IRP *irp) +{ + NTSTATUS ret = STATUS_SUCCESS; + IO_STACK_LOCATION *stack; + void *buf; + bool ok; + // Validate arguments + if (wfp == NULL || device_object == NULL || irp == NULL || wfp->Halting) + { + return NDIS_STATUS_FAILURE; + } + + // Get the IRP stack + stack = IoGetCurrentIrpStackLocation(irp); + + // Initialize the number of bytes + irp->IoStatus.Information = 0; + irp->IoStatus.Status = STATUS_SUCCESS; + + buf = irp->UserBuffer; + + if (wfp->Halting != FALSE) + { + // Device driver is terminating + irp->IoStatus.Information = STATUS_UNSUCCESSFUL; + IoCompleteRequest(irp, IO_NO_INCREMENT); + return STATUS_UNSUCCESSFUL; + } + + ok = false; + + // Branch to each operation + switch (stack->MajorFunction) + { + case IRP_MJ_CREATE: // Open + ok = true; + break; + + case IRP_MJ_CLOSE: // Close + ok = true; + break; + + case IRP_MJ_READ: // Read + ResetEvent(wfp->Event); + break; + + case IRP_MJ_WRITE: // Write + if ((stack->Parameters.Write.Length % sizeof(WFP_LOCAL_IP)) == 0) + { + // Address check + bool check_ok = true; + __try + { + ProbeForRead(buf, stack->Parameters.Write.Length, 1); + } + __except (EXCEPTION_EXECUTE_HANDLER) + { + check_ok = false; + } + + if (check_ok) + { + MDL *mdl = IoAllocateMdl(buf, stack->Parameters.Write.Length, false, false, NULL); + UINT size = MIN(WFP_MAX_LOCAL_IP_COUNT * sizeof(WFP_LOCAL_IP), stack->Parameters.Write.Length); + UCHAR *copied_buf = Malloc(size); + UCHAR *old_buf; + + if (mdl != NULL) + { + MmProbeAndLockPages(mdl, KernelMode, IoWriteAccess); + } + + Copy(copied_buf, buf, size); + + SpinLock(wfp->LocalIPListLock); + { + old_buf = wfp->LocalIPListData; + wfp->LocalIPListData = copied_buf; + wfp->LocalIPListSize = size; + } + SpinUnlock(wfp->LocalIPListLock); + + if (old_buf != NULL) + { + Free(old_buf); + } + + if (mdl != NULL) + { + MmUnlockPages(mdl); + IoFreeMdl(mdl); + } + } + } + irp->IoStatus.Information = stack->Parameters.Write.Length; + ok = true; + break; + } + + if (ok == false) + { + irp->IoStatus.Status = STATUS_UNSUCCESSFUL; + ret = STATUS_UNSUCCESSFUL; + } + + IoCompleteRequest(irp, IO_NO_INCREMENT); + + return ret; +} + +// Function to finish the insertion of the packet +void NTAPI CalloutInjectionCompleted(void *context, NET_BUFFER_LIST *net_buffer_list, BOOLEAN dispatch_level) +{ + WFP_INJECTED_PACKET_CONTEXT *ctx = (WFP_INJECTED_PACKET_CONTEXT *)context; + + if (ctx == NULL) + { + return; + } + + FreeInjectionCtx(ctx); +} + +// Release the injection data +void FreeInjectionCtx(WFP_INJECTED_PACKET_CONTEXT *ctx) +{ + // Validate arguments + if (ctx == NULL) + { + return; + } + + if (ctx->CurrentNetBuffer != NULL) + { + Copy(ctx->CurrentNetBuffer, &ctx->OriginalNetBufferData, sizeof(NET_BUFFER)); + } + + if (ctx->AllocatedNetBufferList != NULL) + { + FwpsFreeCloneNetBufferList0(ctx->AllocatedNetBufferList, 0); + } + + if (ctx->AllocatedMdl != NULL) + { + NdisFreeMdl(ctx->AllocatedMdl); + } + + if (ctx->AllocatedMemory != NULL) + { + Free(ctx->AllocatedMemory); + } + + Free(ctx); +} + +// Calculate the checksum +USHORT IpChecksum(void *buf, UINT size) +{ + int sum = 0; + USHORT *addr = (USHORT *)buf; + int len = (int)size; + USHORT *w = addr; + int nleft = len; + USHORT answer = 0; + + while (nleft > 1) + { + sum += *w++; + nleft -= 2; + } + + if (nleft == 1) + { + *(UCHAR *)(&answer) = *(UCHAR *)w; + sum += answer; + } + + sum = (sum >> 16) + (sum & 0xffff); + sum += (sum >> 16); + + answer = ~sum; + + return answer; +} + +// Modify the IPsec ESP packet +UCHAR *ModificationOfIPsecESPPacket(UCHAR *ip_packet, UINT ip_packet_size, UINT ip_header_size, UINT *dst_size_ptr, bool isv6) +{ + UINT ip_and_udp_header_size = ip_header_size + sizeof(WFP_UDP_HEADER); + UINT udp_packet_size; + UINT udp_payload_size; + UINT dst_udp_payload_size; + WFP_UDP_HEADER *src_udp; + WFP_UDP_HEADER *dst_udp; + UCHAR *src_udp_payload; + UCHAR *dst_data; + UINT dst_size; + // Validate arguments + if (ip_packet == NULL || ip_packet == 0 || ip_header_size == 0 || dst_size_ptr == NULL) + { + return NULL; + } + + if (ip_packet_size <= ip_and_udp_header_size) + { + // There is no UDP header + return NULL; + } + + // Get the UDP header + src_udp = (WFP_UDP_HEADER *)(ip_packet + ip_header_size); + udp_packet_size = Endian16(src_udp->PacketLength); + if (udp_packet_size < sizeof(WFP_UDP_HEADER)) + { + // There is no UDP payload + return NULL; + } + + // Get the UDP payload size + udp_payload_size = udp_packet_size - sizeof(WFP_UDP_HEADER); + + if (ip_packet_size < (ip_and_udp_header_size + udp_payload_size)) + { + // There is no UDP payload + return NULL; + } + + // Get the UDP payload + src_udp_payload = ip_packet + ip_and_udp_header_size; + + if (udp_payload_size < sizeof(UINT)) + { + // The size of the UDP payload is less than 5 bytes + return NULL; + } + + dst_udp_payload_size = udp_payload_size + sizeof(UINT) * 3; + if ((dst_udp_payload_size + sizeof(WFP_UDP_HEADER)) > 0xffff) + { + // UDP payload size overflows the 16bit + return NULL; + } + + // Build a new packet + dst_size = ip_and_udp_header_size + sizeof(UINT) * 3 + udp_payload_size; + if (dst_size > 0xffff) + { + // IP total size overflows the 16bit + return NULL; + } + + dst_data = Malloc(dst_size); + if (dst_data == NULL) + { + // Memory allocation failure + return NULL; + } + + // Copy the IP header + UDP header + Copy(dst_data, ip_packet, ip_and_udp_header_size); + + // Copy the original payload + Copy(dst_data + ip_and_udp_header_size + sizeof(UINT) * 3, src_udp_payload, udp_payload_size); + + // Insert a tag + *((UINT *)(dst_data + ip_and_udp_header_size + sizeof(UINT) * 0)) = 0; + *((UINT *)(dst_data + ip_and_udp_header_size + sizeof(UINT) * 1)) = WFP_ESP_PACKET_TAG_1; + *((UINT *)(dst_data + ip_and_udp_header_size + sizeof(UINT) * 2)) = WFP_ESP_PACKET_TAG_2; + + // Adjust the new IP header + if (isv6 == false) + { + WFP_IPV4_HEADER *ip = (WFP_IPV4_HEADER *)dst_data; + + ip->TotalLength = Endian16(dst_size); + ip->Checksum = 0; + ip->Checksum = IpChecksum(ip, ip_header_size); + } + else + { + WFP_IPV6_HEADER *ip = (WFP_IPV6_HEADER *)dst_data; + + ip->PayloadLength = Endian16(dst_size); + } + + // Adjust the new UDP header + dst_udp = (WFP_UDP_HEADER *)(dst_data + ip_header_size); + dst_udp->Checksum = 0; + dst_udp->PacketLength = Endian16((USHORT)(dst_udp_payload_size + sizeof(WFP_UDP_HEADER))); + + *dst_size_ptr = dst_size; + return dst_data; +} + +// Insert the packet into the stack +bool InjectPacket(HANDLE hInjection, NET_BUFFER_LIST *nbl, UCHAR *dst_data, UINT dst_size, const FWPS_INCOMING_VALUES0* inFixedValues, const FWPS_INCOMING_METADATA_VALUES0* inMetaValues) +{ + WFP_INJECTED_PACKET_CONTEXT *ctx; + bool block = false; + // Validate arguments + if (hInjection == NULL || nbl == NULL || dst_data == NULL || dst_size == 0 || inMetaValues == NULL || inFixedValues == NULL) + { + return false; + } + + ctx = ZeroMalloc(sizeof(WFP_INJECTED_PACKET_CONTEXT)); + + if (ctx != NULL) + { + // Generate a modified packet + ctx->AllocatedMemory = dst_data; + + if (dst_data != NULL) + { + NET_BUFFER_LIST *net_buffer_list; + NTSTATUS ret; + + // Clone the original NET_BUFFER_LIST + ret = FwpsAllocateCloneNetBufferList0(nbl, NULL, NULL, 0, &net_buffer_list); + + if (OK(ret) && net_buffer_list != NULL) + { + NET_BUFFER *net_buffer = NET_BUFFER_LIST_FIRST_NB(net_buffer_list); + + ctx->AllocatedNetBufferList = net_buffer_list; + ctx->CurrentNetBuffer = net_buffer; + + if (net_buffer != NULL) + { + MDL *mdl = NdisAllocateMdl(wfp->hNdis, dst_data, dst_size); + if (mdl != NULL) + { + NTSTATUS ret; + + ctx->AllocatedMdl = mdl; + + Copy(&ctx->OriginalNetBufferData, net_buffer, sizeof(NET_BUFFER)); + + NET_BUFFER_FIRST_MDL(net_buffer) = mdl; + NET_BUFFER_DATA_LENGTH(net_buffer) = dst_size; + NET_BUFFER_DATA_OFFSET(net_buffer) = 0; + NET_BUFFER_CURRENT_MDL(net_buffer) = mdl; + NET_BUFFER_CURRENT_MDL_OFFSET(net_buffer) = 0; + + // Insert packets of receiving direction + ret = FwpsInjectNetworkReceiveAsync0(hInjection, NULL, + 0, + (inMetaValues->currentMetadataValues & FWPS_METADATA_FIELD_COMPARTMENT_ID ? inMetaValues->compartmentId : UNSPECIFIED_COMPARTMENT_ID), + inFixedValues->incomingValue[FWPS_FIELD_INBOUND_IPPACKET_V4_INTERFACE_INDEX].value.uint32, + inFixedValues->incomingValue[FWPS_FIELD_INBOUND_IPPACKET_V4_SUB_INTERFACE_INDEX].value.uint32, + net_buffer_list, + CalloutInjectionCompleted, + (HANDLE)ctx); + + if (NG(ret)) + { + //CRUSH_WHERE; + } + else + { + block = true; + } + } + else + { + //CRUSH_WHERE; + } + } + else + { + //CRUSH_WHERE; + } + } + else + { + //CRUSH_WHERE; + } + } + else + { + //CRUSH_WHERE; + } + + if (block == false) + { + FreeInjectionCtx(ctx); + } + } + + return block; +} + +// Function to be notified of arriving packet +void NTAPI CalloutClassify(const FWPS_INCOMING_VALUES0* inFixedValues, + const FWPS_INCOMING_METADATA_VALUES0* inMetaValues, + void* layerData, + const FWPS_FILTER0* filter, + UINT64 flowContext, + FWPS_CLASSIFY_OUT0* classifyOut) +{ + NET_BUFFER_LIST *nbl = layerData; + FWPS_PACKET_INJECTION_STATE injection_state; + bool block = false; + HANDLE hInjection = NULL; + UINT ip_header_len = 0; + bool isv6 = false; + + if (wfp->Halting || nbl == NULL) + { + classifyOut->actionType = FWP_ACTION_CONTINUE; + return; + } + + switch (inFixedValues->layerId) + { + case FWPS_LAYER_INBOUND_IPPACKET_V4: + hInjection = wfp->hInjectionIPv4; + ip_header_len = sizeof(WFP_IPV4_HEADER); + break; + + case FWPS_LAYER_INBOUND_IPPACKET_V6: + hInjection = wfp->hInjectionIPv6; + ip_header_len = sizeof(WFP_IPV6_HEADER); + isv6 = true; + break; + } + + if (hInjection != NULL) + { + injection_state = FwpsQueryPacketInjectionState0(hInjection, nbl, NULL); + + if (injection_state == FWPS_PACKET_INJECTED_BY_SELF || injection_state == FWPS_PACKET_PREVIOUSLY_INJECTED_BY_SELF) + { + //SetEvent(wfp->Event); + classifyOut->actionType = FWP_ACTION_CONTINUE; // continue + return; + } + + if (nbl != NULL && NET_BUFFER_LIST_NEXT_NBL(nbl) == NULL) + { + NET_BUFFER *nb = NET_BUFFER_LIST_FIRST_NB(nbl); + + if (nb != NULL && NET_BUFFER_NEXT_NB(nb) == NULL && (NET_BUFFER_DATA_OFFSET(nb) >= inMetaValues->ipHeaderSize)) + { + if (OK(NdisRetreatNetBufferDataStart(nb, inMetaValues->ipHeaderSize, 0, NULL))) + { + WFP_IPV4_HEADER *ipv4; + WFP_IPV6_HEADER *ipv6; + UCHAR *alloc_buf = Malloc(ip_header_len); + + ipv4 = NdisGetDataBuffer(nb, ip_header_len, alloc_buf, 1, 0); + ipv6 = (WFP_IPV6_HEADER *)ipv4; + + if (ipv4 != NULL) + { + if ((isv6 == false && ipv4->Protocol == WFP_ESP_RAW_PROTOCOL_ID)) + { + if (IsIPv4AddressInList(&ipv4->DstIP)) + { + UINT src_size = NET_BUFFER_DATA_LENGTH(nb); + UCHAR *src_data = Malloc(src_size); + + if (src_data != NULL) + { + UCHAR *src_ptr = NdisGetDataBuffer(nb, src_size, src_data, 1, 0); + + if (src_ptr != NULL) + { + UINT dst_size = src_size; + UCHAR *dst_data = Malloc(dst_size); + + if (dst_data != NULL) + { + WFP_IPV4_HEADER *ipv4; + + Copy(dst_data, src_ptr, dst_size); + ipv4 = (WFP_IPV4_HEADER *)dst_data; + + ipv4->Protocol = WFP_ESP_RAW_PROTOCOL_ID_DST; + ipv4->Checksum = 0; + ipv4->Checksum = IpChecksum(ipv4, inMetaValues->ipHeaderSize); + + block = InjectPacket(hInjection, nbl, dst_data, dst_size, inFixedValues, inMetaValues); + } + } + + Free(src_data); + } + } + } + else if ((isv6 && ipv6->NextHeader == WFP_ESP_RAW_PROTOCOL_ID)) + { + if (IsIPv6AddressInList(&ipv6->DestAddress)) + { + UINT src_size = NET_BUFFER_DATA_LENGTH(nb); + UCHAR *src_data = Malloc(src_size); + + if (src_data != NULL) + { + UCHAR *src_ptr = NdisGetDataBuffer(nb, src_size, src_data, 1, 0); + + if (src_ptr != NULL) + { + UINT dst_size = src_size; + UCHAR *dst_data = Malloc(dst_size); + + if (dst_data != NULL) + { + WFP_IPV6_HEADER *ipv6; + + Copy(dst_data, src_ptr, dst_size); + ipv6 = (WFP_IPV6_HEADER *)dst_data; + + ipv6->NextHeader = WFP_ESP_RAW_PROTOCOL_ID_DST; + + block = InjectPacket(hInjection, nbl, dst_data, dst_size, inFixedValues, inMetaValues); + } + } + + Free(src_data); + } + } + } + + if ((isv6 == false && ipv4->Protocol == WFP_IP_PROTO_UDP) || + (isv6 && ipv6->NextHeader == WFP_IP_PROTO_UDP)) + { + UINT ip_and_udp_header_len = inMetaValues->ipHeaderSize + sizeof(WFP_UDP_HEADER); + UCHAR *ptr; + UCHAR *alloc_buf = Malloc(ip_and_udp_header_len); + + ptr = NdisGetDataBuffer(nb, ip_and_udp_header_len, alloc_buf, 1, 0); + if (ptr != NULL) + { + WFP_UDP_HEADER *udp = (WFP_UDP_HEADER *)(ptr + inMetaValues->ipHeaderSize); + + if (Endian16(udp->DstPort) == 4500) + { + if ((isv6 == false && IsIPv4AddressInList(&ipv4->DstIP)) || + (isv6 && IsIPv6AddressInList(&ipv6->DestAddress))) + { + UINT packet_size = NET_BUFFER_DATA_LENGTH(nb); + UCHAR *packet_buf_allocated = Malloc(packet_size); + UCHAR *packet_data = NdisGetDataBuffer(nb, packet_size, packet_buf_allocated, 1, 0); + + if (packet_data != NULL) + { + UCHAR *udp_payload = packet_data + ip_and_udp_header_len; + UINT udp_payload_size = packet_size - ip_and_udp_header_len; + + if (udp_payload_size >= 4) + { + UINT *i = (UINT *)udp_payload; + if (*i != 0) + { + // Generate a modified packet + UINT dst_size; + UCHAR *dst_data = ModificationOfIPsecESPPacket(packet_data, packet_size, + inMetaValues->ipHeaderSize, &dst_size, isv6); + + block = InjectPacket(hInjection, nbl, dst_data, dst_size, inFixedValues, inMetaValues); + } + } + } + else + { + //CRUSH_WHERE; + } + + Free(packet_buf_allocated); + } + } + } + else + { + //CRUSH_WHERE; + } + + Free(alloc_buf); + } + } + + Free(alloc_buf); + + NdisAdvanceNetBufferDataStart(nb, inMetaValues->ipHeaderSize, false, NULL); + } + else + { + //CRUSH_WHERE; + } + + nb = NET_BUFFER_NEXT_NB(nb); + } + + nbl = NET_BUFFER_LIST_NEXT_NBL(nbl); + } + } + + classifyOut->actionType = FWP_ACTION_CONTINUE; + + if (block) + { + // Block the packet + classifyOut->actionType = FWP_ACTION_BLOCK; + classifyOut->rights &= ~FWPS_RIGHT_ACTION_WRITE; + classifyOut->flags |= FWPS_CLASSIFY_OUT_FLAG_ABSORB; + //SetEvent(wfp->Event); + } +} + +// Function to receive notification from the WFP +NTSTATUS NTAPI CalloutNotify(FWPS_CALLOUT_NOTIFY_TYPE notifyType, + const GUID* filterKey, FWPS_FILTER0* filter) +{ + //Crush(1,0,0,0); + return 0; +} + +// Scan whether the specified IP address is in the local IP address list +bool IsIPAddressInList(struct WFP_LOCAL_IP *ip) +{ + bool ret = false; + // Validate arguments + if (ip == NULL) + { + return false; + } + + SpinLock(wfp->LocalIPListLock); + { + if (wfp->LocalIPListData != NULL) + { + UINT num = wfp->LocalIPListSize / sizeof(WFP_LOCAL_IP); + WFP_LOCAL_IP *o = (WFP_LOCAL_IP *)wfp->LocalIPListData; + UINT i; + + for (i = 0;i < num;i++) + { + if (Cmp(&o[i], ip, sizeof(WFP_LOCAL_IP)) == 0) + { + ret = true; + break; + } + } + } + } + SpinUnlock(wfp->LocalIPListLock); + + return ret; +} +bool IsIPv4AddressInList(void *addr) +{ + WFP_LOCAL_IP ip; + // Validate arguments + if (addr == NULL) + { + return false; + } + + Zero(&ip, sizeof(ip)); + ip.IpVersion = 4; + Copy(ip.IpAddress.IPv4Address, addr, 4); + + return IsIPAddressInList(&ip); +} +bool IsIPv6AddressInList(void *addr) +{ + WFP_LOCAL_IP ip; + // Validate arguments + if (addr == NULL) + { + return false; + } + + Zero(&ip, sizeof(ip)); + ip.IpVersion = 6; + Copy(ip.IpAddress.IPv6Address, addr, 16); + + return IsIPAddressInList(&ip); +} + +// Win32 driver entry point +NTSTATUS DriverEntry(DRIVER_OBJECT *driver_object, UNICODE_STRING *registry_path) +{ + NTSTATUS ret; + FWPM_SESSION0 t; + ULONG os_ver1 = 0, os_ver2 = 0; + + if (wfp != NULL) + { + return STATUS_UNSUCCESSFUL; + } + + g_is_win8 = false; + g_pool_type = NonPagedPool; + + PsGetVersion(&os_ver1, &os_ver2, NULL, NULL); + + if ((os_ver1 == 6 && os_ver2 >= 2) || (os_ver1 >= 7)) + { + g_is_win8 = true; + g_pool_type = 512; + } + + wfp = ZeroMalloc(sizeof(WFP_CTX)); + + RtlInitUnicodeString(&wfp->DeviceName, WFP_DEVICE_NAME); + RtlInitUnicodeString(&wfp->DeviceNameWin32, WFP_DEVICE_NAME_WIN32); + // Create a device + ret = IoCreateDevice(driver_object, 0, &wfp->DeviceName, FILE_DEVICE_NETWORK, 0, false, &wfp->DeviceObject); + if (NG(ret)) + { + return ret; + } + + // Open the NDIS handle + wfp->hNdis = NdisAllocateGenericObject(driver_object, MEMPOOL_TAG, 0); + if (wfp->hNdis == NULL) + { + DriverUnload(driver_object); + return STATUS_UNSUCCESSFUL; + } + + // Create a symbolic device for Win32 + ret = IoCreateSymbolicLink(&wfp->DeviceNameWin32, &wfp->DeviceName); + if (NG(ret)) + { + DriverUnload(driver_object); + return ret; + } + + driver_object->DriverUnload = DriverUnload; + + // Create an Event + wfp->Event = NewEvent(WFP_EVENT_NAME); + if (wfp->Event == NULL) + { + DriverUnload(driver_object); + return STATUS_UNSUCCESSFUL; + } + + // Open the WFP engine + Zero(&t, sizeof(t)); + t.flags = FWPM_SESSION_FLAG_DYNAMIC; + ret = FwpmEngineOpen0(NULL, RPC_C_AUTHN_DEFAULT, NULL, &t, &wfp->hEngine); + if (NG(ret)) + { + DriverUnload(driver_object); + return ret; + } + else + { + // Register itself as a Callout Driver + FWPS_CALLOUT0 s; +// FWPM_CALLOUT0 callout; + + Zero(&s, sizeof(s)); + s.calloutKey = GUID_WFP_CALLOUT_DRIVER_V4; + s.classifyFn = CalloutClassify; + s.notifyFn = CalloutNotify; + + ret = FwpsCalloutRegister0(wfp->DeviceObject, &s, &wfp->CalloutIdIPv4); + if (NG(ret)) + { + DriverUnload(driver_object); + return ret; + } + + Zero(&s, sizeof(s)); + s.calloutKey = GUID_WFP_CALLOUT_DRIVER_V6; + s.classifyFn = CalloutClassify; + s.notifyFn = CalloutNotify; + + ret = FwpsCalloutRegister0(wfp->DeviceObject, &s, &wfp->CalloutIdIPv6); + if (NG(ret)) + { + DriverUnload(driver_object); + return ret; + } + + /*// Create the Callout Driver (IPv4) + Zero(&callout, sizeof(callout)); + callout.calloutKey = GUID_WFP_CALLOUT_DRIVER_V4; + callout.applicableLayer = FWPM_LAYER_INBOUND_IPPACKET_V4; + callout.displayData.name = WFP_DRIVER_TITLE_V4; + ret = FwpmCalloutAdd0(wfp->hEngine, &callout, NULL, &wfp->CalloutObjIdIPv4); + + // Create the Callout Driver (IPv6) + Zero(&callout, sizeof(callout)); + callout.calloutKey = GUID_WFP_CALLOUT_DRIVER_V6; + callout.applicableLayer = FWPM_LAYER_INBOUND_IPPACKET_V6; + callout.displayData.name = WFP_DRIVER_TITLE_V6; + ret = FwpmCalloutAdd0(wfp->hEngine, &callout, NULL, &wfp->CalloutObjIdIPv6);*/ + + // Create an injection handle + FwpsInjectionHandleCreate0(AF_INET, FWPS_INJECTION_TYPE_NETWORK, &wfp->hInjectionIPv4); + if (NG(ret)) + { + wfp->hInjectionIPv4 = NULL; + } + ret = FwpsInjectionHandleCreate0(AF_INET6, FWPS_INJECTION_TYPE_NETWORK,&wfp->hInjectionIPv6); + if (NG(ret)) + { + wfp->hInjectionIPv6 = NULL; + } + } + + // Create a lock + wfp->LocalIPListLock = NewSpinLock(); + + // Specify a service function + driver_object->MajorFunction[IRP_MJ_CREATE] = + driver_object->MajorFunction[IRP_MJ_CLOSE] = + driver_object->MajorFunction[IRP_MJ_READ] = + driver_object->MajorFunction[IRP_MJ_WRITE] = DriverDispatch; + + return STATUS_SUCCESS; +} + +// Unload the driver +void DriverUnload(DRIVER_OBJECT *driver_object) +{ + // Validate arguments + if (wfp == NULL || driver_object == NULL) + { + return; + } + + wfp->Halting = true; + + // Delete the lock + FreeSpinLock(wfp->LocalIPListLock); + + // Delete the injection handle + if (wfp->hInjectionIPv4 != NULL) + { + FwpsInjectionHandleDestroy0(wfp->hInjectionIPv4); + } + if (wfp->hInjectionIPv6 != NULL) + { + FwpsInjectionHandleDestroy0(wfp->hInjectionIPv6); + } + + // Delete the Callout Object + if (wfp->hEngine != NULL) + { + //FwpmCalloutDeleteByKey0(wfp->hEngine, &GUID_WFP_CALLOUT_DRIVER_V4); + //FwpmCalloutDeleteByKey0(wfp->hEngine, &GUID_WFP_CALLOUT_DRIVER_V6); + } + + if (wfp->CalloutIdIPv4 != 0) + { + // Delete the registration of Callout Driver (IPv4) + FwpsCalloutUnregisterById0(wfp->CalloutIdIPv4); + } + + if (wfp->CalloutIdIPv6 != 0) + { + // Delete the registration of Callout Driver (IPv6) + FwpsCalloutUnregisterById0(wfp->CalloutIdIPv6); + } + + FreeEvent(wfp->Event); + + IoDeleteSymbolicLink(&wfp->DeviceNameWin32); + + if (wfp->DeviceObject != NULL) + { + IoDeleteDevice(wfp->DeviceObject); + } + + if (wfp->hEngine != NULL) + { + FwpmEngineClose0(wfp->hEngine); + } + + if (wfp->LocalIPListData != NULL) + { + Free(wfp->LocalIPListData); + } + + // Close the NDIS handle + if (wfp->hNdis != NULL) + { + NdisFreeGenericObject(wfp->hNdis); + } + + Free(wfp); + + wfp = NULL; +} + +// Create an Event +EVENT *NewEvent(wchar_t *name) +{ + EVENT *e; + KEVENT *ke; + HANDLE h; + UNICODE_STRING name_str; + // Validate arguments + if (name == NULL) + { + return NULL; + } + + RtlInitUnicodeString(&name_str, name); + + ke = IoCreateNotificationEvent(&name_str, &h); + if (ke == NULL) + { + return NULL; + } + + KeInitializeEvent(ke, NotificationEvent, false); + KeClearEvent(ke); + + e = ZeroMalloc(sizeof(EVENT)); + + e->EventObj = ke; + e->Handle = h; + + return e; +} + +// Delete the event +void FreeEvent(EVENT *e) +{ + // Validate arguments + if (e == NULL) + { + return; + } + + ZwClose(e->Handle); + + Free(e); +} + +// Set the event +void SetEvent(EVENT *e) +{ + // Validate arguments + if (e == NULL) + { + return; + } + + KeSetEvent(e->EventObj, 0, false); +} + +// Reset the event +void ResetEvent(EVENT *e) +{ + // Validate arguments + if (e == NULL) + { + return; + } + + KeResetEvent(e->EventObj); +} + +// Allocate the memory +void *Malloc(UINT size) +{ + void *p; + + p = ExAllocatePoolWithTag(g_pool_type, size + sizeof(UINT), MEMPOOL_TAG); + *((UINT *)p) = size; + + return ((UCHAR *)p) + sizeof(UINT); +} +void *ZeroMalloc(UINT size) +{ + void *p = Malloc(size); + Zero(p, size); + return p; +} + +// Change the memory block size +void *ReAlloc(void *p, UINT size) +{ + void *ret; + UINT oldsize; + // Validate arguments + if (p == NULL) + { + return NULL; + } + + ret = Malloc(size); + if (ret == NULL) + { + Free(p); + return NULL; + } + + oldsize = GetMemSize(p); + + Copy(ret, p, MIN(size, oldsize)); + + Free(p); + + return ret; +} + +// Copy memory +void Copy(void *dst, void *src, UINT size) +{ + // Validate arguments + if (dst == NULL || src == NULL || size == 0) + { + return; + } + + memcpy(dst, src, size); +} + +// Get the memory block size +UINT GetMemSize(void *p) +{ + // Validate arguments + if (p == NULL) + { + return 0; + } + + return *(UINT *)(((UCHAR *)p) - sizeof(UINT)); +} + +// Release the memory +void Free(void *p) +{ + // Validate arguments + if (p == NULL) + { + return; + } + + p = ((UCHAR *)p) - sizeof(UINT); + + ExFreePoolWithTag(p, MEMPOOL_TAG); +} + +// Clear the memory to zero +void Zero(void *p, UINT size) +{ + // Validate arguments + if (p == NULL || size == 0) + { + return; + } + + memset(p, 0, size); +} + +// Comparison of memory +UINT Cmp(void *p1, void *p2, UINT size) +{ + UCHAR *c1 = (UCHAR *)p1; + UCHAR *c2 = (UCHAR *)p2; + UINT i; + + for (i = 0;i < size;i++) + { + if (c1[i] != c2[i]) + { + if (c1[i] > c2[i]) + { + return 1; + } + else + { + return -1; + } + } + } + + return 0; +} + +// Create a spin lock +SPINLOCK *NewSpinLock() +{ + SPINLOCK *s = ZeroMalloc(sizeof(SPINLOCK)); + + KeInitializeSpinLock(&s->SpinLock); + + return s; +} + +// Lock +void SpinLock(SPINLOCK *s) +{ + // Validate arguments + if (s == NULL) + { + return; + } + + KeAcquireSpinLock(&s->SpinLock, &s->OldIrql); +} + +// Unlock +void SpinUnlock(SPINLOCK *s) +{ + // Validate arguments + if (s == NULL) + { + return; + } + + KeReleaseSpinLock(&s->SpinLock, s->OldIrql); +} + +// Release the spin lock +void FreeSpinLock(SPINLOCK *s) +{ + // Validate arguments + if (s == NULL) + { + return; + } + + Free(s); +} + +// Sleep +void Sleep(int milliSeconds) +{ + PKTIMER timer = ZeroMalloc(sizeof(KTIMER)); + LARGE_INTEGER duetime; + + duetime.QuadPart = (__int64)milliSeconds * -10000; + KeInitializeTimerEx(timer, NotificationTimer); + KeSetTimerEx(timer, duetime, 0, NULL); + + KeWaitForSingleObject (timer, Executive, KernelMode, FALSE, NULL); + + Free(timer); +} + +// 16-bit swap +USHORT Swap16(USHORT value) +{ + USHORT r; + ((BYTE *)&r)[0] = ((BYTE *)&value)[1]; + ((BYTE *)&r)[1] = ((BYTE *)&value)[0]; + return r; +} + +// 32-bit swap +UINT Swap32(UINT value) +{ + UINT r; + ((BYTE *)&r)[0] = ((BYTE *)&value)[3]; + ((BYTE *)&r)[1] = ((BYTE *)&value)[2]; + ((BYTE *)&r)[2] = ((BYTE *)&value)[1]; + ((BYTE *)&r)[3] = ((BYTE *)&value)[0]; + return r; +} + +// 64-bit swap +UINT64 Swap64(UINT64 value) +{ + UINT64 r; + ((BYTE *)&r)[0] = ((BYTE *)&value)[7]; + ((BYTE *)&r)[1] = ((BYTE *)&value)[6]; + ((BYTE *)&r)[2] = ((BYTE *)&value)[5]; + ((BYTE *)&r)[3] = ((BYTE *)&value)[4]; + ((BYTE *)&r)[4] = ((BYTE *)&value)[3]; + ((BYTE *)&r)[5] = ((BYTE *)&value)[2]; + ((BYTE *)&r)[6] = ((BYTE *)&value)[1]; + ((BYTE *)&r)[7] = ((BYTE *)&value)[0]; + return r; +} + +// Endian conversion 16bit +USHORT Endian16(USHORT src) +{ + int x = 1; + if (*((char *)&x)) + { + return Swap16(src); + } + else + { + return src; + } +} + +// Endian conversion 32bit +UINT Endian32(UINT src) +{ + int x = 1; + if (*((char *)&x)) + { + return Swap32(src); + } + else + { + return src; + } +} + +// Endian conversion 64bit +UINT64 Endian64(UINT64 src) +{ + int x = 1; + if (*((char *)&x)) + { + return Swap64(src); + } + else + { + return src; + } +} + +// Crash +void Crush(UINT a, UINT b, UINT c, UINT d) +{ + KeBugCheckEx(0x00000061, (ULONG_PTR)a, (ULONG_PTR)b, (ULONG_PTR)c, (ULONG_PTR)d); +} diff --git a/src/Wfp/Wfp.h b/src/Wfp/Wfp.h index 6456bb42..ce1136ab 100644 --- a/src/Wfp/Wfp.h +++ b/src/Wfp/Wfp.h @@ -1,46 +1,46 @@ -// SoftEther VPN Source Code - Developer Edition Master Branch -// Windows Filtering Platform Callout Driver for Capturing IPsec Packets on Windows Vista / 7 / Server 2008 - - -// Wfp.h -// Header File for WFP Callout Driver - -#ifndef WFP_H -#define WFP_H - -// Identify string -#define WFP_DEVICE_NAME L"\\Device\\PXWFP_DEVICE" -#define WFP_DEVICE_NAME_WIN32 L"\\DosDevices\\PXWFP_DEVICE" -#define WFP_DEVICE_FILE_NAME "\\\\.\\PXWFP_DEVICE" -#define WFP_EVENT_NAME L"\\BaseNamedObjects\\PXWFP_EVENT" -#define WFP_EVENT_NAME_WIN32 "Global\\PXWFP_EVENT" - -// PXWFP Callout Driver -// {4E6F16C5-C266-440a-9382-22E7B1AA4411} -DEFINE_GUID(GUID_WFP_CALLOUT_DRIVER_V4, - 0x4e6f16c5, 0xc266, 0x440a, 0x93, 0x82, 0x22, 0xe7, 0xb1, 0xaa, 0x44, 0x11); -// {CAE3EC1F-E2F9-4b07-B910-1467E223E55E} -DEFINE_GUID(GUID_WFP_CALLOUT_DRIVER_V6, - 0xcae3ec1f, 0xe2f9, 0x4b07, 0xb9, 0x10, 0x14, 0x67, 0xe2, 0x23, 0xe5, 0x5e); - -// PXWFP Filter for IPsec -// {4FB80D9C-B3D3-433c-B707-9D6EDE3A9493} -//DEFINE_GUID(GUID_WFP_FILTER, -// 0x4fb80d9c, 0xb3d3, 0x433c, 0xb7, 0x7, 0x9d, 0x6e, 0xde, 0x3a, 0x94, 0x94); - -// WFP local IP address -typedef struct WFP_LOCAL_IP -{ - UINT IpVersion; - UINT Padding; - union - { - UCHAR IPv4Address[4]; - UCHAR IPv6Address[16]; - } IpAddress; -} WFP_LOCAL_IP; - - -#endif // WFP_H - - +// SoftEther VPN Source Code - Developer Edition Master Branch +// Windows Filtering Platform Callout Driver for Capturing IPsec Packets on Windows Vista / 7 / Server 2008 + + +// Wfp.h +// Header File for WFP Callout Driver + +#ifndef WFP_H +#define WFP_H + +// Identify string +#define WFP_DEVICE_NAME L"\\Device\\PXWFP_DEVICE" +#define WFP_DEVICE_NAME_WIN32 L"\\DosDevices\\PXWFP_DEVICE" +#define WFP_DEVICE_FILE_NAME "\\\\.\\PXWFP_DEVICE" +#define WFP_EVENT_NAME L"\\BaseNamedObjects\\PXWFP_EVENT" +#define WFP_EVENT_NAME_WIN32 "Global\\PXWFP_EVENT" + +// PXWFP Callout Driver +// {4E6F16C5-C266-440a-9382-22E7B1AA4411} +DEFINE_GUID(GUID_WFP_CALLOUT_DRIVER_V4, + 0x4e6f16c5, 0xc266, 0x440a, 0x93, 0x82, 0x22, 0xe7, 0xb1, 0xaa, 0x44, 0x11); +// {CAE3EC1F-E2F9-4b07-B910-1467E223E55E} +DEFINE_GUID(GUID_WFP_CALLOUT_DRIVER_V6, + 0xcae3ec1f, 0xe2f9, 0x4b07, 0xb9, 0x10, 0x14, 0x67, 0xe2, 0x23, 0xe5, 0x5e); + +// PXWFP Filter for IPsec +// {4FB80D9C-B3D3-433c-B707-9D6EDE3A9493} +//DEFINE_GUID(GUID_WFP_FILTER, +// 0x4fb80d9c, 0xb3d3, 0x433c, 0xb7, 0x7, 0x9d, 0x6e, 0xde, 0x3a, 0x94, 0x94); + +// WFP local IP address +typedef struct WFP_LOCAL_IP +{ + UINT IpVersion; + UINT Padding; + union + { + UCHAR IPv4Address[4]; + UCHAR IPv6Address[16]; + } IpAddress; +} WFP_LOCAL_IP; + + +#endif // WFP_H + + diff --git a/src/Wfp/Wfp.rc b/src/Wfp/Wfp.rc index 8c739aa0..0c21525c 100644 --- a/src/Wfp/Wfp.rc +++ b/src/Wfp/Wfp.rc @@ -1,63 +1,63 @@ -// Microsoft Visual C++ generated resource script. -// -#include "resource1.h" - -#define APSTUDIO_READONLY_SYMBOLS -///////////////////////////////////////////////////////////////////////////// -// -// Generated from the TEXTINCLUDE 2 resource. -// -#include "winres.h" - -///////////////////////////////////////////////////////////////////////////// -#undef APSTUDIO_READONLY_SYMBOLS - -///////////////////////////////////////////////////////////////////////////// -// Japanese resources - -#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_JPN) -#ifdef _WIN32 -LANGUAGE LANG_JAPANESE, SUBLANG_DEFAULT -#pragma code_page(932) -#endif //_WIN32 - -#ifdef APSTUDIO_INVOKED -///////////////////////////////////////////////////////////////////////////// -// -// TEXTINCLUDE -// - -1 TEXTINCLUDE -BEGIN - "resource1.h\0" -END - -2 TEXTINCLUDE -BEGIN - "#include ""winres.h""\r\n" - "\0" -END - -3 TEXTINCLUDE -BEGIN - "\r\n" - "\0" -END - -#endif // APSTUDIO_INVOKED - -#endif // Japanese resources -///////////////////////////////////////////////////////////////////////////// - - - -#ifndef APSTUDIO_INVOKED -///////////////////////////////////////////////////////////////////////////// -// -// Generated from the TEXTINCLUDE 3 resource. -// - - -///////////////////////////////////////////////////////////////////////////// -#endif // not APSTUDIO_INVOKED - +// Microsoft Visual C++ generated resource script. +// +#include "resource1.h" + +#define APSTUDIO_READONLY_SYMBOLS +///////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 2 resource. +// +#include "winres.h" + +///////////////////////////////////////////////////////////////////////////// +#undef APSTUDIO_READONLY_SYMBOLS + +///////////////////////////////////////////////////////////////////////////// +// Japanese resources + +#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_JPN) +#ifdef _WIN32 +LANGUAGE LANG_JAPANESE, SUBLANG_DEFAULT +#pragma code_page(932) +#endif //_WIN32 + +#ifdef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// TEXTINCLUDE +// + +1 TEXTINCLUDE +BEGIN + "resource1.h\0" +END + +2 TEXTINCLUDE +BEGIN + "#include ""winres.h""\r\n" + "\0" +END + +3 TEXTINCLUDE +BEGIN + "\r\n" + "\0" +END + +#endif // APSTUDIO_INVOKED + +#endif // Japanese resources +///////////////////////////////////////////////////////////////////////////// + + + +#ifndef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 3 resource. +// + + +///////////////////////////////////////////////////////////////////////////// +#endif // not APSTUDIO_INVOKED + diff --git a/src/Wfp/Wfp.vcproj b/src/Wfp/Wfp.vcproj index fc331741..9b54eecc 100644 --- a/src/Wfp/Wfp.vcproj +++ b/src/Wfp/Wfp.vcproj @@ -1,276 +1,276 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/Wfp/WfpInner.h b/src/Wfp/WfpInner.h index f8861c9c..7bc29d8b 100644 --- a/src/Wfp/WfpInner.h +++ b/src/Wfp/WfpInner.h @@ -1,235 +1,235 @@ -// SoftEther VPN Source Code - Developer Edition Master Branch -// Windows Filtering Platform Callout Driver for Capturing IPsec Packets on Windows Vista / 7 / Server 2008 - - -// WfpInner.h -// Header File for WFP Callout Driver - -#ifndef WFPINNER_H -#define WFPINNER_H - -// Win32 DDK related -#ifndef CPU_64 -#define _X86_ -#define i386 -#else // CPU_64 -#define _AMD64_ -#define AMD64 -#define x64 -#endif // CPU_64 - -#define STD_CALL -#define CONDITION_HANDLING 1 -#define NT_UP 1 -#define NT_INST 0 -#define _NT1X_ 100 -#define _WIN32_WINNT 0x0600 -#define WINNT 1 -#define WINVER 0x0600 -#define _WIN32_IE 0x0700 -#define WIN32_LEAN_AND_MEAN 1 -#define DEVL 1 -#define __BUILDMACHINE__ WinDDK -#define FPO 0 -#define BINARY_COMPATIBLE 0 -#define NT -#define NDIS60 1 -#define NDIS_SUPPORT_NDIS6 1 -#define NTDDI_VERSION 0x06000100 - -#define KMDF_MAJOR_VERSION_STRING 01 -#define KMDF_MINOR_VERSION_STRING 009 - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#define INITGUID -#include - -#define TRUE 1 -#define FALSE 0 -typedef unsigned long bool; -#define true 1 -#define false 0 -typedef unsigned long long UINT64; -typedef signed long long INT64; -typedef unsigned short WORD; -typedef unsigned short USHORT; -typedef signed short SHORT; -typedef unsigned char BYTE; -typedef unsigned char UCHAR; -typedef signed char CHAR; -typedef unsigned long DWORD; -#define INFINITE 0xFFFFFFFF - -#define LESS(a, max_value) ((a) < (max_value) ? (a) : (max_value)) -#define MORE(a, min_value) ((a) > (min_value) ? (a) : (min_value)) -#define INNER(a, b, c) (((b) <= (c) && (a) >= (b) && (a) <= (c)) || ((b) >= (c) && (a) >= (c) && (a) <= (b))) -#define OUTER(a, b, c) (!INNER((a), (b), (c))) -#define MAKESURE(a, b, c) (((b) <= (c)) ? (MORE(LESS((a), (c)), (b))) : (MORE(LESS((a), (b)), (c)))) -#define MIN(a, b) ((a) >= (b) ? (b) : (a)) -#define MAX(a, b) ((a) >= (b) ? (a) : (b)) - -// Error checking macro -#define OK(val) (val == STATUS_SUCCESS) -#define NG(val) (!OK(val)) -#define CRUSH_WHERE //Crush(0xaaaaaaaa, __LINE__, __LINE__, __LINE__) - -// Constants -#define MEMPOOL_TAG 'wpfx' -#define WFP_MAX_LOCAL_IP_COUNT 4096 - -// Tag constant -#define WFP_ESP_PACKET_TAG_1 0x19841117 -#define WFP_ESP_PACKET_TAG_2 0x1accafe1 - -// ESP protocol number -#define WFP_ESP_RAW_PROTOCOL_ID 50 -#define WFP_ESP_RAW_PROTOCOL_ID_DST 52 - -// Event -typedef struct EVENT -{ - KEVENT *EventObj; - HANDLE Handle; -} EVENT; - -// Spin lock -typedef struct SPINLOCK -{ - KSPIN_LOCK SpinLock; - KIRQL OldIrql; -} SPINLOCK; - -// Instance data -typedef struct WFP_CTX -{ - DEVICE_OBJECT *DeviceObject; - UNICODE_STRING DeviceName; - UNICODE_STRING DeviceNameWin32; - EVENT *Event; - HANDLE hEngine; - bool Halting; - UINT CalloutIdIPv4; - UINT CalloutIdIPv6; - UINT CalloutObjIdIPv4; - UINT CalloutObjIdIPv6; - SPINLOCK *LocalIPListLock; - UCHAR *LocalIPListData; - UINT LocalIPListSize; - HANDLE hInjectionIPv4, hInjectionIPv6; - NDIS_HANDLE hNdis; -} WFP_CTX; - -#pragma pack(push, 1) - -#define WFP_IP_PROTO_UDP 0x11 // UDP protocol - -// IPv4 header -typedef struct WFP_IPV4_HEADER -{ - UCHAR VersionAndHeaderLength; // Version and header size - UCHAR TypeOfService; // Service Type - USHORT TotalLength; // Total size - USHORT Identification; // Identifier - UCHAR FlagsAndFragmentOffset[2]; // The flag and fragment offset - UCHAR TimeToLive; // TTL - UCHAR Protocol; // Protocol - USHORT Checksum; // Checksum - UINT SrcIP; // Source IP address - UINT DstIP; // Destination IP address -} WFP_IPV4_HEADER; - -// IPv6 header -typedef struct WFP_IPV6_HEADER -{ - UCHAR VersionAndTrafficClass1; // Version Number (4 bit) and Traffic Class 1 (4 bit) - UCHAR TrafficClass2AndFlowLabel1; // Traffic Class 2 (4 bit) and Flow Label 1 (4 bit) - UCHAR FlowLabel2; // Flow Label 2 (8 bit) - UCHAR FlowLabel3; // Flow Label 3 (8 bit) - USHORT PayloadLength; // Length of the payload (including extension header) - UCHAR NextHeader; // The next header - UCHAR HopLimit; // Hop limit - UCHAR SrcAddress[16]; // Source address - UCHAR DestAddress[16]; // Destination address -} WFP_IPV6_HEADER; - -// UDP header -typedef struct WFP_UDP_HEADER -{ - USHORT SrcPort; // Source port number - USHORT DstPort; // Destination port number - USHORT PacketLength; // Data length - USHORT Checksum; // Checksum -} WFP_UDP_HEADER; - -// Context of injected packet -typedef struct WFP_INJECTED_PACKET_CONTEXT -{ - NET_BUFFER OriginalNetBufferData; // Data of the original NET_BUFFER - NET_BUFFER *CurrentNetBuffer; // Pointer of the current NET_BUFFER - NET_BUFFER_LIST *AllocatedNetBufferList; // Newly allocated NET_BUFFER_LIST - MDL *AllocatedMdl; // MDL that newly allocated - void *AllocatedMemory; // Newly allocated memory -} WFP_INJECTED_PACKET_CONTEXT; - - -#pragma pack(pop) - - -// Function prototype -NTSTATUS DriverEntry(DRIVER_OBJECT *driver_object, UNICODE_STRING *registry_path); -void DriverUnload(DRIVER_OBJECT *driver_object); -NTSTATUS DriverDispatch(DEVICE_OBJECT *device_object, IRP *irp); - -void NTAPI CalloutClassify(const FWPS_INCOMING_VALUES0* inFixedValues, - const FWPS_INCOMING_METADATA_VALUES0* inMetaValues, - void* layerData, - const FWPS_FILTER0* filter, - UINT64 flowContext, - FWPS_CLASSIFY_OUT0* classifyOut); -NTSTATUS NTAPI CalloutNotify(FWPS_CALLOUT_NOTIFY_TYPE notifyType, - const GUID* filterKey, FWPS_FILTER0* filter); -bool IsIPAddressInList(struct WFP_LOCAL_IP *ip); -bool IsIPv4AddressInList(void *addr); -bool IsIPv6AddressInList(void *addr); -void FreeInjectionCtx(WFP_INJECTED_PACKET_CONTEXT *ctx); -UCHAR *ModificationOfIPsecESPPacket(UCHAR *ip_packet, UINT ip_packet_size, UINT ip_header_size, UINT *dst_size_ptr, bool isv6); -USHORT IpChecksum(void *buf, UINT size); -bool InjectPacket(HANDLE hInjection, NET_BUFFER_LIST *nbl, UCHAR *dst_data, UINT dst_size, const FWPS_INCOMING_VALUES0* inFixedValues, const FWPS_INCOMING_METADATA_VALUES0* inMetaValues); - -void *Malloc(UINT size); -void *ZeroMalloc(UINT size); -void Free(void *p); -void *ReAlloc(void *p, UINT size); -void Copy(void *dst, void *src, UINT size); -UINT GetMemSize(void *p); -void Zero(void *p, UINT size); -UINT Cmp(void *p1, void *p2, UINT size); -SPINLOCK *NewSpinLock(); -void SpinLock(SPINLOCK *s); -void SpinUnlock(SPINLOCK *s); -void FreeSpinLock(SPINLOCK *s); -EVENT *NewEvent(wchar_t *name); -void FreeEvent(EVENT *e); -void SetEvent(EVENT *e); -void ResetEvent(EVENT *e); -void Sleep(int milliSeconds); -USHORT Swap16(USHORT value); -UINT Swap32(UINT value); -UINT64 Swap64(UINT64 value); -USHORT Endian16(USHORT src); -UINT Endian32(UINT src); -UINT64 Endian64(UINT64 src); - -void Crush(); - - -#endif // WFPINNER_H - +// SoftEther VPN Source Code - Developer Edition Master Branch +// Windows Filtering Platform Callout Driver for Capturing IPsec Packets on Windows Vista / 7 / Server 2008 + + +// WfpInner.h +// Header File for WFP Callout Driver + +#ifndef WFPINNER_H +#define WFPINNER_H + +// Win32 DDK related +#ifndef CPU_64 +#define _X86_ +#define i386 +#else // CPU_64 +#define _AMD64_ +#define AMD64 +#define x64 +#endif // CPU_64 + +#define STD_CALL +#define CONDITION_HANDLING 1 +#define NT_UP 1 +#define NT_INST 0 +#define _NT1X_ 100 +#define _WIN32_WINNT 0x0600 +#define WINNT 1 +#define WINVER 0x0600 +#define _WIN32_IE 0x0700 +#define WIN32_LEAN_AND_MEAN 1 +#define DEVL 1 +#define __BUILDMACHINE__ WinDDK +#define FPO 0 +#define BINARY_COMPATIBLE 0 +#define NT +#define NDIS60 1 +#define NDIS_SUPPORT_NDIS6 1 +#define NTDDI_VERSION 0x06000100 + +#define KMDF_MAJOR_VERSION_STRING 01 +#define KMDF_MINOR_VERSION_STRING 009 + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#define INITGUID +#include + +#define TRUE 1 +#define FALSE 0 +typedef unsigned long bool; +#define true 1 +#define false 0 +typedef unsigned long long UINT64; +typedef signed long long INT64; +typedef unsigned short WORD; +typedef unsigned short USHORT; +typedef signed short SHORT; +typedef unsigned char BYTE; +typedef unsigned char UCHAR; +typedef signed char CHAR; +typedef unsigned long DWORD; +#define INFINITE 0xFFFFFFFF + +#define LESS(a, max_value) ((a) < (max_value) ? (a) : (max_value)) +#define MORE(a, min_value) ((a) > (min_value) ? (a) : (min_value)) +#define INNER(a, b, c) (((b) <= (c) && (a) >= (b) && (a) <= (c)) || ((b) >= (c) && (a) >= (c) && (a) <= (b))) +#define OUTER(a, b, c) (!INNER((a), (b), (c))) +#define MAKESURE(a, b, c) (((b) <= (c)) ? (MORE(LESS((a), (c)), (b))) : (MORE(LESS((a), (b)), (c)))) +#define MIN(a, b) ((a) >= (b) ? (b) : (a)) +#define MAX(a, b) ((a) >= (b) ? (a) : (b)) + +// Error checking macro +#define OK(val) (val == STATUS_SUCCESS) +#define NG(val) (!OK(val)) +#define CRUSH_WHERE //Crush(0xaaaaaaaa, __LINE__, __LINE__, __LINE__) + +// Constants +#define MEMPOOL_TAG 'wpfx' +#define WFP_MAX_LOCAL_IP_COUNT 4096 + +// Tag constant +#define WFP_ESP_PACKET_TAG_1 0x19841117 +#define WFP_ESP_PACKET_TAG_2 0x1accafe1 + +// ESP protocol number +#define WFP_ESP_RAW_PROTOCOL_ID 50 +#define WFP_ESP_RAW_PROTOCOL_ID_DST 52 + +// Event +typedef struct EVENT +{ + KEVENT *EventObj; + HANDLE Handle; +} EVENT; + +// Spin lock +typedef struct SPINLOCK +{ + KSPIN_LOCK SpinLock; + KIRQL OldIrql; +} SPINLOCK; + +// Instance data +typedef struct WFP_CTX +{ + DEVICE_OBJECT *DeviceObject; + UNICODE_STRING DeviceName; + UNICODE_STRING DeviceNameWin32; + EVENT *Event; + HANDLE hEngine; + bool Halting; + UINT CalloutIdIPv4; + UINT CalloutIdIPv6; + UINT CalloutObjIdIPv4; + UINT CalloutObjIdIPv6; + SPINLOCK *LocalIPListLock; + UCHAR *LocalIPListData; + UINT LocalIPListSize; + HANDLE hInjectionIPv4, hInjectionIPv6; + NDIS_HANDLE hNdis; +} WFP_CTX; + +#pragma pack(push, 1) + +#define WFP_IP_PROTO_UDP 0x11 // UDP protocol + +// IPv4 header +typedef struct WFP_IPV4_HEADER +{ + UCHAR VersionAndHeaderLength; // Version and header size + UCHAR TypeOfService; // Service Type + USHORT TotalLength; // Total size + USHORT Identification; // Identifier + UCHAR FlagsAndFragmentOffset[2]; // The flag and fragment offset + UCHAR TimeToLive; // TTL + UCHAR Protocol; // Protocol + USHORT Checksum; // Checksum + UINT SrcIP; // Source IP address + UINT DstIP; // Destination IP address +} WFP_IPV4_HEADER; + +// IPv6 header +typedef struct WFP_IPV6_HEADER +{ + UCHAR VersionAndTrafficClass1; // Version Number (4 bit) and Traffic Class 1 (4 bit) + UCHAR TrafficClass2AndFlowLabel1; // Traffic Class 2 (4 bit) and Flow Label 1 (4 bit) + UCHAR FlowLabel2; // Flow Label 2 (8 bit) + UCHAR FlowLabel3; // Flow Label 3 (8 bit) + USHORT PayloadLength; // Length of the payload (including extension header) + UCHAR NextHeader; // The next header + UCHAR HopLimit; // Hop limit + UCHAR SrcAddress[16]; // Source address + UCHAR DestAddress[16]; // Destination address +} WFP_IPV6_HEADER; + +// UDP header +typedef struct WFP_UDP_HEADER +{ + USHORT SrcPort; // Source port number + USHORT DstPort; // Destination port number + USHORT PacketLength; // Data length + USHORT Checksum; // Checksum +} WFP_UDP_HEADER; + +// Context of injected packet +typedef struct WFP_INJECTED_PACKET_CONTEXT +{ + NET_BUFFER OriginalNetBufferData; // Data of the original NET_BUFFER + NET_BUFFER *CurrentNetBuffer; // Pointer of the current NET_BUFFER + NET_BUFFER_LIST *AllocatedNetBufferList; // Newly allocated NET_BUFFER_LIST + MDL *AllocatedMdl; // MDL that newly allocated + void *AllocatedMemory; // Newly allocated memory +} WFP_INJECTED_PACKET_CONTEXT; + + +#pragma pack(pop) + + +// Function prototype +NTSTATUS DriverEntry(DRIVER_OBJECT *driver_object, UNICODE_STRING *registry_path); +void DriverUnload(DRIVER_OBJECT *driver_object); +NTSTATUS DriverDispatch(DEVICE_OBJECT *device_object, IRP *irp); + +void NTAPI CalloutClassify(const FWPS_INCOMING_VALUES0* inFixedValues, + const FWPS_INCOMING_METADATA_VALUES0* inMetaValues, + void* layerData, + const FWPS_FILTER0* filter, + UINT64 flowContext, + FWPS_CLASSIFY_OUT0* classifyOut); +NTSTATUS NTAPI CalloutNotify(FWPS_CALLOUT_NOTIFY_TYPE notifyType, + const GUID* filterKey, FWPS_FILTER0* filter); +bool IsIPAddressInList(struct WFP_LOCAL_IP *ip); +bool IsIPv4AddressInList(void *addr); +bool IsIPv6AddressInList(void *addr); +void FreeInjectionCtx(WFP_INJECTED_PACKET_CONTEXT *ctx); +UCHAR *ModificationOfIPsecESPPacket(UCHAR *ip_packet, UINT ip_packet_size, UINT ip_header_size, UINT *dst_size_ptr, bool isv6); +USHORT IpChecksum(void *buf, UINT size); +bool InjectPacket(HANDLE hInjection, NET_BUFFER_LIST *nbl, UCHAR *dst_data, UINT dst_size, const FWPS_INCOMING_VALUES0* inFixedValues, const FWPS_INCOMING_METADATA_VALUES0* inMetaValues); + +void *Malloc(UINT size); +void *ZeroMalloc(UINT size); +void Free(void *p); +void *ReAlloc(void *p, UINT size); +void Copy(void *dst, void *src, UINT size); +UINT GetMemSize(void *p); +void Zero(void *p, UINT size); +UINT Cmp(void *p1, void *p2, UINT size); +SPINLOCK *NewSpinLock(); +void SpinLock(SPINLOCK *s); +void SpinUnlock(SPINLOCK *s); +void FreeSpinLock(SPINLOCK *s); +EVENT *NewEvent(wchar_t *name); +void FreeEvent(EVENT *e); +void SetEvent(EVENT *e); +void ResetEvent(EVENT *e); +void Sleep(int milliSeconds); +USHORT Swap16(USHORT value); +UINT Swap32(UINT value); +UINT64 Swap64(UINT64 value); +USHORT Endian16(USHORT src); +UINT Endian32(UINT src); +UINT64 Endian64(UINT64 src); + +void Crush(); + + +#endif // WFPINNER_H + diff --git a/src/Wfp/resource1.h b/src/Wfp/resource1.h index 6e3a1548..30d2250c 100644 --- a/src/Wfp/resource1.h +++ b/src/Wfp/resource1.h @@ -1,15 +1,15 @@ -//{{NO_DEPENDENCIES}} -// Microsoft Visual C++ generated include file. -// Used by Wfp.rc - - -// Next default values for new objects -// -#ifdef APSTUDIO_INVOKED -#ifndef APSTUDIO_READONLY_SYMBOLS -#define _APS_NEXT_RESOURCE_VALUE 101 -#define _APS_NEXT_COMMAND_VALUE 40001 -#define _APS_NEXT_CONTROL_VALUE 1000 -#define _APS_NEXT_SYMED_VALUE 101 -#endif -#endif +//{{NO_DEPENDENCIES}} +// Microsoft Visual C++ generated include file. +// Used by Wfp.rc + + +// Next default values for new objects +// +#ifdef APSTUDIO_INVOKED +#ifndef APSTUDIO_READONLY_SYMBOLS +#define _APS_NEXT_RESOURCE_VALUE 101 +#define _APS_NEXT_COMMAND_VALUE 40001 +#define _APS_NEXT_CONTROL_VALUE 1000 +#define _APS_NEXT_SYMED_VALUE 101 +#endif +#endif diff --git a/src/bin/hamcore/DriverPackages/Neo/x64/Neo_x64.inf b/src/bin/hamcore/DriverPackages/Neo/x64/Neo_x64.inf index c630cc69..2a0324ba 100644 --- a/src/bin/hamcore/DriverPackages/Neo/x64/Neo_x64.inf +++ b/src/bin/hamcore/DriverPackages/Neo/x64/Neo_x64.inf @@ -1,114 +1,114 @@ -; VPN Client Device Driver for Windows 2000 and Greater -; -; Copyright (c) SoftEther Corporation. All Rights Reserved. -; http://www.softether.co.jp/ -; -; BUILD 9658 - -[Version] -Signature = "$Windows NT$" -Class = Net -ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} -Provider = %CompanyName% -DriverVer = 02/04/2018, 4.25.0.9658 -;CatalogFile.NT = $CATALOG_FILENAME$ - -[Manufacturer] -%CompanyName% = SoftEther, NTamd64 - -[SourceDisksNames] -1=%DiskDescription%, "", , - -[SourceDisksFiles] -$TAG_SYS_NAME$ = 1 - -[DestinationDirs] -DefaultDestDir = 12 -Neo.CopyFiles.Sys = 12 - -[Neo.CopyFiles.Sys] -$TAG_SYS_NAME$, , , 2 - -[SoftEther.NTamd64] -%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_$TAG_INSTANCE_NAME$ - -[NeoAdapter.Install] -Characteristics = 0x1 -AddReg = Neo.Reg, NeoAdapter.Ndi -CopyFiles = Neo.CopyFiles.Sys -*IfType = 6 -*MediaType = 0 -*PhysicalMediaType = 0 - -[NeoAdapter.Install.Services] -AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% - -[NeoAdapter.Ndi] -HKR, , NetworkAddress, 0, %DefaultAddress% -HKR, Ndi, DeviceID, , "NeoAdapter_$TAG_INSTANCE_NAME$" -HKR, , DevLoader, , ndis -HKR, , DeviceVxDs, , $TAG_SYS_NAME$ -HKR, NDIS, LogDriverName, , "Neo_$TAG_INSTANCE_NAME$" -HKR, NDIS, MajorNdisVersion, 1, 5 -HKR, NDIS, MinorNdisVersion, 1, 0 -HKR, Ndi\Interfaces, DefUpper, , "ndis5" -HKR, Ndi\Interfaces, UpperRange, , "ndis5" -HKR, Ndi\Interfaces, LowerRange, , "ethernet" -HKR, Ndi\Interfaces, DefLower, , "ethernet" -HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" -HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% -HKR, Ndi\Params\NetworkAddress, type, 0, "edit" -HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" -HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" -HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% -HKR, Ndi\Params\NetworkAddress, optional, 0, "0" -HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% -HKR, Ndi\Params\MaxSpeed, type, 0, "int" -HKR, Ndi\Params\MaxSpeed, default, 0, "100" -HKR, Ndi\Params\MaxSpeed, min, 0, "0" -HKR, Ndi\Params\MaxSpeed, max, 0, "2000" -HKR, Ndi\Params\MaxSpeed, step, 0, "1" -HKR, Ndi\Params\MaxSpeed, Base, 0, "10" -HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% -HKR, Ndi\Params\KeepLink, type, 0, "enum" -HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% -HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% -HKR, Ndi\Params\KeepLink, default, 0, "0" - - -[Neo.Service] -DisplayName = %Neo.Service.DispName% -Description = %Neo.Service.Desc% -ServiceType = 1 -StartType = 3 -ErrorControl = 1 -ServiceBinary = %12%\$TAG_SYS_NAME$ -LoadOrderGroup = NDIS - -[Neo.Reg] -HKR, Ndi, Service, 0, Neo.Service.Name -HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" -HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" - -[Neo.EventLog] -HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\$TAG_SYS_NAME$" -HKR, , TypesSupported, 0x00010001, 7 - -[Strings] -CompanyName = "SoftEther Corporation" -DiskDescription = "VPN Client Device Driver Install Disk" -Neo.Service.Name = "Neo_$TAG_INSTANCE_NAME$" -Neo.Service.DispName = "VPN Client Device Driver - $TAG_INSTANCE_NAME$" -Neo.Service.Desc = "VPN Client Adapter - $TAG_INSTANCE_NAME$" -NeoAdapter.DeviceDesc = "VPN Client Adapter - $TAG_INSTANCE_NAME$" -Neo.EventLog.Name = "Neo" -NetworkAddress = "MAC Address" -DefaultAddress = "$TAG_MAC_ADDRESS$" -MaxSpeed = "Indicate Speed (Mbps)" -KeepLink = "Keep Link" -On = "On" -Off = "Off" - - -; Auto Generated 20180205_163608.742 - +; VPN Client Device Driver for Windows 2000 and Greater +; +; Copyright (c) SoftEther Corporation. All Rights Reserved. +; http://www.softether.co.jp/ +; +; BUILD 9658 + +[Version] +Signature = "$Windows NT$" +Class = Net +ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} +Provider = %CompanyName% +DriverVer = 02/04/2018, 4.25.0.9658 +;CatalogFile.NT = $CATALOG_FILENAME$ + +[Manufacturer] +%CompanyName% = SoftEther, NTamd64 + +[SourceDisksNames] +1=%DiskDescription%, "", , + +[SourceDisksFiles] +$TAG_SYS_NAME$ = 1 + +[DestinationDirs] +DefaultDestDir = 12 +Neo.CopyFiles.Sys = 12 + +[Neo.CopyFiles.Sys] +$TAG_SYS_NAME$, , , 2 + +[SoftEther.NTamd64] +%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_$TAG_INSTANCE_NAME$ + +[NeoAdapter.Install] +Characteristics = 0x1 +AddReg = Neo.Reg, NeoAdapter.Ndi +CopyFiles = Neo.CopyFiles.Sys +*IfType = 6 +*MediaType = 0 +*PhysicalMediaType = 0 + +[NeoAdapter.Install.Services] +AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% + +[NeoAdapter.Ndi] +HKR, , NetworkAddress, 0, %DefaultAddress% +HKR, Ndi, DeviceID, , "NeoAdapter_$TAG_INSTANCE_NAME$" +HKR, , DevLoader, , ndis +HKR, , DeviceVxDs, , $TAG_SYS_NAME$ +HKR, NDIS, LogDriverName, , "Neo_$TAG_INSTANCE_NAME$" +HKR, NDIS, MajorNdisVersion, 1, 5 +HKR, NDIS, MinorNdisVersion, 1, 0 +HKR, Ndi\Interfaces, DefUpper, , "ndis5" +HKR, Ndi\Interfaces, UpperRange, , "ndis5" +HKR, Ndi\Interfaces, LowerRange, , "ethernet" +HKR, Ndi\Interfaces, DefLower, , "ethernet" +HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" +HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% +HKR, Ndi\Params\NetworkAddress, type, 0, "edit" +HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" +HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" +HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% +HKR, Ndi\Params\NetworkAddress, optional, 0, "0" +HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% +HKR, Ndi\Params\MaxSpeed, type, 0, "int" +HKR, Ndi\Params\MaxSpeed, default, 0, "100" +HKR, Ndi\Params\MaxSpeed, min, 0, "0" +HKR, Ndi\Params\MaxSpeed, max, 0, "2000" +HKR, Ndi\Params\MaxSpeed, step, 0, "1" +HKR, Ndi\Params\MaxSpeed, Base, 0, "10" +HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% +HKR, Ndi\Params\KeepLink, type, 0, "enum" +HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% +HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% +HKR, Ndi\Params\KeepLink, default, 0, "0" + + +[Neo.Service] +DisplayName = %Neo.Service.DispName% +Description = %Neo.Service.Desc% +ServiceType = 1 +StartType = 3 +ErrorControl = 1 +ServiceBinary = %12%\$TAG_SYS_NAME$ +LoadOrderGroup = NDIS + +[Neo.Reg] +HKR, Ndi, Service, 0, Neo.Service.Name +HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" +HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" + +[Neo.EventLog] +HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\$TAG_SYS_NAME$" +HKR, , TypesSupported, 0x00010001, 7 + +[Strings] +CompanyName = "SoftEther Corporation" +DiskDescription = "VPN Client Device Driver Install Disk" +Neo.Service.Name = "Neo_$TAG_INSTANCE_NAME$" +Neo.Service.DispName = "VPN Client Device Driver - $TAG_INSTANCE_NAME$" +Neo.Service.Desc = "VPN Client Adapter - $TAG_INSTANCE_NAME$" +NeoAdapter.DeviceDesc = "VPN Client Adapter - $TAG_INSTANCE_NAME$" +Neo.EventLog.Name = "Neo" +NetworkAddress = "MAC Address" +DefaultAddress = "$TAG_MAC_ADDRESS$" +MaxSpeed = "Indicate Speed (Mbps)" +KeepLink = "Keep Link" +On = "On" +Off = "Off" + + +; Auto Generated 20180205_163608.742 + diff --git a/src/bin/hamcore/DriverPackages/Neo/x86/Neo_x86.inf b/src/bin/hamcore/DriverPackages/Neo/x86/Neo_x86.inf index 4175ea05..ad2ee32e 100644 --- a/src/bin/hamcore/DriverPackages/Neo/x86/Neo_x86.inf +++ b/src/bin/hamcore/DriverPackages/Neo/x86/Neo_x86.inf @@ -1,114 +1,114 @@ -; VPN Client Device Driver for Windows 2000 and Greater -; -; Copyright (c) SoftEther Corporation. All Rights Reserved. -; http://www.softether.co.jp/ -; -; BUILD 9658 - -[Version] -Signature = "$Windows NT$" -Class = Net -ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} -Provider = %CompanyName% -DriverVer = 02/04/2018, 4.25.0.9658 -;CatalogFile.NT = $CATALOG_FILENAME$ - -[Manufacturer] -%CompanyName% = SoftEther - -[SourceDisksNames] -1=%DiskDescription%, "", , - -[SourceDisksFiles] -$TAG_SYS_NAME$ = 1 - -[DestinationDirs] -DefaultDestDir = 12 -Neo.CopyFiles.Sys = 12 - -[Neo.CopyFiles.Sys] -$TAG_SYS_NAME$, , , 2 - -[SoftEther] -%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_$TAG_INSTANCE_NAME$ - -[NeoAdapter.Install] -Characteristics = 0x1 -AddReg = Neo.Reg, NeoAdapter.Ndi -CopyFiles = Neo.CopyFiles.Sys -*IfType = 6 -*MediaType = 0 -*PhysicalMediaType = 0 - -[NeoAdapter.Install.Services] -AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% - -[NeoAdapter.Ndi] -HKR, , NetworkAddress, 0, %DefaultAddress% -HKR, Ndi, DeviceID, , "NeoAdapter_$TAG_INSTANCE_NAME$" -HKR, , DevLoader, , ndis -HKR, , DeviceVxDs, , $TAG_SYS_NAME$ -HKR, NDIS, LogDriverName, , "Neo_$TAG_INSTANCE_NAME$" -HKR, NDIS, MajorNdisVersion, 1, 5 -HKR, NDIS, MinorNdisVersion, 1, 0 -HKR, Ndi\Interfaces, DefUpper, , "ndis5" -HKR, Ndi\Interfaces, UpperRange, , "ndis5" -HKR, Ndi\Interfaces, LowerRange, , "ethernet" -HKR, Ndi\Interfaces, DefLower, , "ethernet" -HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" -HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% -HKR, Ndi\Params\NetworkAddress, type, 0, "edit" -HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" -HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" -HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% -HKR, Ndi\Params\NetworkAddress, optional, 0, "0" -HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% -HKR, Ndi\Params\MaxSpeed, type, 0, "int" -HKR, Ndi\Params\MaxSpeed, default, 0, "100" -HKR, Ndi\Params\MaxSpeed, min, 0, "0" -HKR, Ndi\Params\MaxSpeed, max, 0, "2000" -HKR, Ndi\Params\MaxSpeed, step, 0, "1" -HKR, Ndi\Params\MaxSpeed, Base, 0, "10" -HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% -HKR, Ndi\Params\KeepLink, type, 0, "enum" -HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% -HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% -HKR, Ndi\Params\KeepLink, default, 0, "0" - - -[Neo.Service] -DisplayName = %Neo.Service.DispName% -Description = %Neo.Service.Desc% -ServiceType = 1 -StartType = 3 -ErrorControl = 1 -ServiceBinary = %12%\$TAG_SYS_NAME$ -LoadOrderGroup = NDIS - -[Neo.Reg] -HKR, Ndi, Service, 0, Neo.Service.Name -HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" -HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" - -[Neo.EventLog] -HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_$TAG_INSTANCE_NAME$.sys" -HKR, , TypesSupported, 0x00010001, 7 - -[Strings] -CompanyName = "SoftEther Corporation" -DiskDescription = "VPN Client Device Driver Install Disk" -Neo.Service.Name = "Neo_$TAG_INSTANCE_NAME$" -Neo.Service.DispName = "VPN Client Device Driver - $TAG_INSTANCE_NAME$" -Neo.Service.Desc = "VPN Client Adapter - $TAG_INSTANCE_NAME$" -NeoAdapter.DeviceDesc = "VPN Client Adapter - $TAG_INSTANCE_NAME$" -Neo.EventLog.Name = "Neo" -NetworkAddress = "MAC Address" -DefaultAddress = "$TAG_MAC_ADDRESS$" -MaxSpeed = "Indicate Speed (Mbps)" -KeepLink = "Keep Link" -On = "On" -Off = "Off" - - -; Auto Generated 20180205_163608.741 - +; VPN Client Device Driver for Windows 2000 and Greater +; +; Copyright (c) SoftEther Corporation. All Rights Reserved. +; http://www.softether.co.jp/ +; +; BUILD 9658 + +[Version] +Signature = "$Windows NT$" +Class = Net +ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} +Provider = %CompanyName% +DriverVer = 02/04/2018, 4.25.0.9658 +;CatalogFile.NT = $CATALOG_FILENAME$ + +[Manufacturer] +%CompanyName% = SoftEther + +[SourceDisksNames] +1=%DiskDescription%, "", , + +[SourceDisksFiles] +$TAG_SYS_NAME$ = 1 + +[DestinationDirs] +DefaultDestDir = 12 +Neo.CopyFiles.Sys = 12 + +[Neo.CopyFiles.Sys] +$TAG_SYS_NAME$, , , 2 + +[SoftEther] +%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_$TAG_INSTANCE_NAME$ + +[NeoAdapter.Install] +Characteristics = 0x1 +AddReg = Neo.Reg, NeoAdapter.Ndi +CopyFiles = Neo.CopyFiles.Sys +*IfType = 6 +*MediaType = 0 +*PhysicalMediaType = 0 + +[NeoAdapter.Install.Services] +AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% + +[NeoAdapter.Ndi] +HKR, , NetworkAddress, 0, %DefaultAddress% +HKR, Ndi, DeviceID, , "NeoAdapter_$TAG_INSTANCE_NAME$" +HKR, , DevLoader, , ndis +HKR, , DeviceVxDs, , $TAG_SYS_NAME$ +HKR, NDIS, LogDriverName, , "Neo_$TAG_INSTANCE_NAME$" +HKR, NDIS, MajorNdisVersion, 1, 5 +HKR, NDIS, MinorNdisVersion, 1, 0 +HKR, Ndi\Interfaces, DefUpper, , "ndis5" +HKR, Ndi\Interfaces, UpperRange, , "ndis5" +HKR, Ndi\Interfaces, LowerRange, , "ethernet" +HKR, Ndi\Interfaces, DefLower, , "ethernet" +HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" +HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% +HKR, Ndi\Params\NetworkAddress, type, 0, "edit" +HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" +HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" +HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% +HKR, Ndi\Params\NetworkAddress, optional, 0, "0" +HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% +HKR, Ndi\Params\MaxSpeed, type, 0, "int" +HKR, Ndi\Params\MaxSpeed, default, 0, "100" +HKR, Ndi\Params\MaxSpeed, min, 0, "0" +HKR, Ndi\Params\MaxSpeed, max, 0, "2000" +HKR, Ndi\Params\MaxSpeed, step, 0, "1" +HKR, Ndi\Params\MaxSpeed, Base, 0, "10" +HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% +HKR, Ndi\Params\KeepLink, type, 0, "enum" +HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% +HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% +HKR, Ndi\Params\KeepLink, default, 0, "0" + + +[Neo.Service] +DisplayName = %Neo.Service.DispName% +Description = %Neo.Service.Desc% +ServiceType = 1 +StartType = 3 +ErrorControl = 1 +ServiceBinary = %12%\$TAG_SYS_NAME$ +LoadOrderGroup = NDIS + +[Neo.Reg] +HKR, Ndi, Service, 0, Neo.Service.Name +HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" +HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" + +[Neo.EventLog] +HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_$TAG_INSTANCE_NAME$.sys" +HKR, , TypesSupported, 0x00010001, 7 + +[Strings] +CompanyName = "SoftEther Corporation" +DiskDescription = "VPN Client Device Driver Install Disk" +Neo.Service.Name = "Neo_$TAG_INSTANCE_NAME$" +Neo.Service.DispName = "VPN Client Device Driver - $TAG_INSTANCE_NAME$" +Neo.Service.Desc = "VPN Client Adapter - $TAG_INSTANCE_NAME$" +NeoAdapter.DeviceDesc = "VPN Client Adapter - $TAG_INSTANCE_NAME$" +Neo.EventLog.Name = "Neo" +NetworkAddress = "MAC Address" +DefaultAddress = "$TAG_MAC_ADDRESS$" +MaxSpeed = "Indicate Speed (Mbps)" +KeepLink = "Keep Link" +On = "On" +Off = "Off" + + +; Auto Generated 20180205_163608.741 + diff --git a/src/bin/hamcore/DriverPackages/Neo6/x64/Neo6_x64.inf b/src/bin/hamcore/DriverPackages/Neo6/x64/Neo6_x64.inf index b6067d76..d8efbb91 100644 --- a/src/bin/hamcore/DriverPackages/Neo6/x64/Neo6_x64.inf +++ b/src/bin/hamcore/DriverPackages/Neo6/x64/Neo6_x64.inf @@ -1,114 +1,114 @@ -; VPN Client Device Driver for Windows 2000 and Greater -; -; Copyright (c) SoftEther Corporation. All Rights Reserved. -; http://www.softether.co.jp/ -; -; BUILD 9658 - -[Version] -Signature = "$Windows NT$" -Class = Net -ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} -Provider = %CompanyName% -DriverVer = 02/04/2018, 4.25.0.9658 -;CatalogFile.NT = $CATALOG_FILENAME$ - -[Manufacturer] -%CompanyName% = SoftEther, NTamd64 - -[SourceDisksNames] -1=%DiskDescription%, "", , - -[SourceDisksFiles] -$TAG_SYS_NAME$ = 1 - -[DestinationDirs] -DefaultDestDir = 12 -Neo.CopyFiles.Sys = 12 - -[Neo.CopyFiles.Sys] -$TAG_SYS_NAME$, , , 2 - -[SoftEther.NTamd64] -%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_$TAG_INSTANCE_NAME$ - -[NeoAdapter.Install] -Characteristics = 0x1 -AddReg = Neo.Reg, NeoAdapter.Ndi -CopyFiles = Neo.CopyFiles.Sys -*IfType = 53 -*MediaType = 0 -*PhysicalMediaType = 0 - -[NeoAdapter.Install.Services] -AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% - -[NeoAdapter.Ndi] -HKR, , NetworkAddress, 0, %DefaultAddress% -HKR, Ndi, DeviceID, , "NeoAdapter_$TAG_INSTANCE_NAME$" -HKR, , DevLoader, , ndis -HKR, , DeviceVxDs, , $TAG_SYS_NAME$ -HKR, NDIS, LogDriverName, , "Neo_$TAG_INSTANCE_NAME$" -HKR, NDIS, MajorNdisVersion, 1, 5 -HKR, NDIS, MinorNdisVersion, 1, 0 -HKR, Ndi\Interfaces, DefUpper, , "ndis5" -HKR, Ndi\Interfaces, UpperRange, , "ndis5" -HKR, Ndi\Interfaces, LowerRange, , "ethernet" -HKR, Ndi\Interfaces, DefLower, , "ethernet" -HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" -HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% -HKR, Ndi\Params\NetworkAddress, type, 0, "edit" -HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" -HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" -HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% -HKR, Ndi\Params\NetworkAddress, optional, 0, "0" -HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% -HKR, Ndi\Params\MaxSpeed, type, 0, "int" -HKR, Ndi\Params\MaxSpeed, default, 0, "100" -HKR, Ndi\Params\MaxSpeed, min, 0, "0" -HKR, Ndi\Params\MaxSpeed, max, 0, "2000" -HKR, Ndi\Params\MaxSpeed, step, 0, "1" -HKR, Ndi\Params\MaxSpeed, Base, 0, "10" -HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% -HKR, Ndi\Params\KeepLink, type, 0, "enum" -HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% -HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% -HKR, Ndi\Params\KeepLink, default, 0, "0" - - -[Neo.Service] -DisplayName = %Neo.Service.DispName% -Description = %Neo.Service.Desc% -ServiceType = 1 -StartType = 3 -ErrorControl = 1 -ServiceBinary = %12%\$TAG_SYS_NAME$ -LoadOrderGroup = NDIS - -[Neo.Reg] -HKR, Ndi, Service, 0, Neo.Service.Name -HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" -HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" - -[Neo.EventLog] -HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\$TAG_SYS_NAME$" -HKR, , TypesSupported, 0x00010001, 7 - -[Strings] -CompanyName = "SoftEther Corporation" -DiskDescription = "VPN Client Device Driver Install Disk" -Neo.Service.Name = "Neo_$TAG_INSTANCE_NAME$" -Neo.Service.DispName = "VPN Client Device Driver - $TAG_INSTANCE_NAME$" -Neo.Service.Desc = "VPN Client Adapter - $TAG_INSTANCE_NAME$" -NeoAdapter.DeviceDesc = "VPN Client Adapter - $TAG_INSTANCE_NAME$" -Neo.EventLog.Name = "Neo" -NetworkAddress = "MAC Address" -DefaultAddress = "$TAG_MAC_ADDRESS$" -MaxSpeed = "Indicate Speed (Mbps)" -KeepLink = "Keep Link" -On = "On" -Off = "Off" - - -; Auto Generated 20180205_163608.745 - +; VPN Client Device Driver for Windows 2000 and Greater +; +; Copyright (c) SoftEther Corporation. All Rights Reserved. +; http://www.softether.co.jp/ +; +; BUILD 9658 + +[Version] +Signature = "$Windows NT$" +Class = Net +ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} +Provider = %CompanyName% +DriverVer = 02/04/2018, 4.25.0.9658 +;CatalogFile.NT = $CATALOG_FILENAME$ + +[Manufacturer] +%CompanyName% = SoftEther, NTamd64 + +[SourceDisksNames] +1=%DiskDescription%, "", , + +[SourceDisksFiles] +$TAG_SYS_NAME$ = 1 + +[DestinationDirs] +DefaultDestDir = 12 +Neo.CopyFiles.Sys = 12 + +[Neo.CopyFiles.Sys] +$TAG_SYS_NAME$, , , 2 + +[SoftEther.NTamd64] +%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_$TAG_INSTANCE_NAME$ + +[NeoAdapter.Install] +Characteristics = 0x1 +AddReg = Neo.Reg, NeoAdapter.Ndi +CopyFiles = Neo.CopyFiles.Sys +*IfType = 53 +*MediaType = 0 +*PhysicalMediaType = 0 + +[NeoAdapter.Install.Services] +AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% + +[NeoAdapter.Ndi] +HKR, , NetworkAddress, 0, %DefaultAddress% +HKR, Ndi, DeviceID, , "NeoAdapter_$TAG_INSTANCE_NAME$" +HKR, , DevLoader, , ndis +HKR, , DeviceVxDs, , $TAG_SYS_NAME$ +HKR, NDIS, LogDriverName, , "Neo_$TAG_INSTANCE_NAME$" +HKR, NDIS, MajorNdisVersion, 1, 5 +HKR, NDIS, MinorNdisVersion, 1, 0 +HKR, Ndi\Interfaces, DefUpper, , "ndis5" +HKR, Ndi\Interfaces, UpperRange, , "ndis5" +HKR, Ndi\Interfaces, LowerRange, , "ethernet" +HKR, Ndi\Interfaces, DefLower, , "ethernet" +HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" +HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% +HKR, Ndi\Params\NetworkAddress, type, 0, "edit" +HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" +HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" +HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% +HKR, Ndi\Params\NetworkAddress, optional, 0, "0" +HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% +HKR, Ndi\Params\MaxSpeed, type, 0, "int" +HKR, Ndi\Params\MaxSpeed, default, 0, "100" +HKR, Ndi\Params\MaxSpeed, min, 0, "0" +HKR, Ndi\Params\MaxSpeed, max, 0, "2000" +HKR, Ndi\Params\MaxSpeed, step, 0, "1" +HKR, Ndi\Params\MaxSpeed, Base, 0, "10" +HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% +HKR, Ndi\Params\KeepLink, type, 0, "enum" +HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% +HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% +HKR, Ndi\Params\KeepLink, default, 0, "0" + + +[Neo.Service] +DisplayName = %Neo.Service.DispName% +Description = %Neo.Service.Desc% +ServiceType = 1 +StartType = 3 +ErrorControl = 1 +ServiceBinary = %12%\$TAG_SYS_NAME$ +LoadOrderGroup = NDIS + +[Neo.Reg] +HKR, Ndi, Service, 0, Neo.Service.Name +HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" +HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" + +[Neo.EventLog] +HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\$TAG_SYS_NAME$" +HKR, , TypesSupported, 0x00010001, 7 + +[Strings] +CompanyName = "SoftEther Corporation" +DiskDescription = "VPN Client Device Driver Install Disk" +Neo.Service.Name = "Neo_$TAG_INSTANCE_NAME$" +Neo.Service.DispName = "VPN Client Device Driver - $TAG_INSTANCE_NAME$" +Neo.Service.Desc = "VPN Client Adapter - $TAG_INSTANCE_NAME$" +NeoAdapter.DeviceDesc = "VPN Client Adapter - $TAG_INSTANCE_NAME$" +Neo.EventLog.Name = "Neo" +NetworkAddress = "MAC Address" +DefaultAddress = "$TAG_MAC_ADDRESS$" +MaxSpeed = "Indicate Speed (Mbps)" +KeepLink = "Keep Link" +On = "On" +Off = "Off" + + +; Auto Generated 20180205_163608.745 + diff --git a/src/bin/hamcore/DriverPackages/Neo6/x86/Neo6_x86.inf b/src/bin/hamcore/DriverPackages/Neo6/x86/Neo6_x86.inf index 61884036..e46bf3d6 100644 --- a/src/bin/hamcore/DriverPackages/Neo6/x86/Neo6_x86.inf +++ b/src/bin/hamcore/DriverPackages/Neo6/x86/Neo6_x86.inf @@ -1,114 +1,114 @@ -; VPN Client Device Driver for Windows 2000 and Greater -; -; Copyright (c) SoftEther Corporation. All Rights Reserved. -; http://www.softether.co.jp/ -; -; BUILD 9658 - -[Version] -Signature = "$Windows NT$" -Class = Net -ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} -Provider = %CompanyName% -DriverVer = 02/04/2018, 4.25.0.9658 -;CatalogFile.NT = $CATALOG_FILENAME$ - -[Manufacturer] -%CompanyName% = SoftEther - -[SourceDisksNames] -1=%DiskDescription%, "", , - -[SourceDisksFiles] -$TAG_SYS_NAME$ = 1 - -[DestinationDirs] -DefaultDestDir = 12 -Neo.CopyFiles.Sys = 12 - -[Neo.CopyFiles.Sys] -$TAG_SYS_NAME$, , , 2 - -[SoftEther] -%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_$TAG_INSTANCE_NAME$ - -[NeoAdapter.Install] -Characteristics = 0x1 -AddReg = Neo.Reg, NeoAdapter.Ndi -CopyFiles = Neo.CopyFiles.Sys -*IfType = 53 -*MediaType = 0 -*PhysicalMediaType = 0 - -[NeoAdapter.Install.Services] -AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% - -[NeoAdapter.Ndi] -HKR, , NetworkAddress, 0, %DefaultAddress% -HKR, Ndi, DeviceID, , "NeoAdapter_$TAG_INSTANCE_NAME$" -HKR, , DevLoader, , ndis -HKR, , DeviceVxDs, , $TAG_SYS_NAME$ -HKR, NDIS, LogDriverName, , "Neo_$TAG_INSTANCE_NAME$" -HKR, NDIS, MajorNdisVersion, 1, 5 -HKR, NDIS, MinorNdisVersion, 1, 0 -HKR, Ndi\Interfaces, DefUpper, , "ndis5" -HKR, Ndi\Interfaces, UpperRange, , "ndis5" -HKR, Ndi\Interfaces, LowerRange, , "ethernet" -HKR, Ndi\Interfaces, DefLower, , "ethernet" -HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" -HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% -HKR, Ndi\Params\NetworkAddress, type, 0, "edit" -HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" -HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" -HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% -HKR, Ndi\Params\NetworkAddress, optional, 0, "0" -HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% -HKR, Ndi\Params\MaxSpeed, type, 0, "int" -HKR, Ndi\Params\MaxSpeed, default, 0, "100" -HKR, Ndi\Params\MaxSpeed, min, 0, "0" -HKR, Ndi\Params\MaxSpeed, max, 0, "2000" -HKR, Ndi\Params\MaxSpeed, step, 0, "1" -HKR, Ndi\Params\MaxSpeed, Base, 0, "10" -HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% -HKR, Ndi\Params\KeepLink, type, 0, "enum" -HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% -HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% -HKR, Ndi\Params\KeepLink, default, 0, "0" - - -[Neo.Service] -DisplayName = %Neo.Service.DispName% -Description = %Neo.Service.Desc% -ServiceType = 1 -StartType = 3 -ErrorControl = 1 -ServiceBinary = %12%\$TAG_SYS_NAME$ -LoadOrderGroup = NDIS - -[Neo.Reg] -HKR, Ndi, Service, 0, Neo.Service.Name -HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" -HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" - -[Neo.EventLog] -HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_$TAG_INSTANCE_NAME$.sys" -HKR, , TypesSupported, 0x00010001, 7 - -[Strings] -CompanyName = "SoftEther Corporation" -DiskDescription = "VPN Client Device Driver Install Disk" -Neo.Service.Name = "Neo_$TAG_INSTANCE_NAME$" -Neo.Service.DispName = "VPN Client Device Driver - $TAG_INSTANCE_NAME$" -Neo.Service.Desc = "VPN Client Adapter - $TAG_INSTANCE_NAME$" -NeoAdapter.DeviceDesc = "VPN Client Adapter - $TAG_INSTANCE_NAME$" -Neo.EventLog.Name = "Neo" -NetworkAddress = "MAC Address" -DefaultAddress = "$TAG_MAC_ADDRESS$" -MaxSpeed = "Indicate Speed (Mbps)" -KeepLink = "Keep Link" -On = "On" -Off = "Off" - - -; Auto Generated 20180205_163608.744 - +; VPN Client Device Driver for Windows 2000 and Greater +; +; Copyright (c) SoftEther Corporation. All Rights Reserved. +; http://www.softether.co.jp/ +; +; BUILD 9658 + +[Version] +Signature = "$Windows NT$" +Class = Net +ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} +Provider = %CompanyName% +DriverVer = 02/04/2018, 4.25.0.9658 +;CatalogFile.NT = $CATALOG_FILENAME$ + +[Manufacturer] +%CompanyName% = SoftEther + +[SourceDisksNames] +1=%DiskDescription%, "", , + +[SourceDisksFiles] +$TAG_SYS_NAME$ = 1 + +[DestinationDirs] +DefaultDestDir = 12 +Neo.CopyFiles.Sys = 12 + +[Neo.CopyFiles.Sys] +$TAG_SYS_NAME$, , , 2 + +[SoftEther] +%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_$TAG_INSTANCE_NAME$ + +[NeoAdapter.Install] +Characteristics = 0x1 +AddReg = Neo.Reg, NeoAdapter.Ndi +CopyFiles = Neo.CopyFiles.Sys +*IfType = 53 +*MediaType = 0 +*PhysicalMediaType = 0 + +[NeoAdapter.Install.Services] +AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% + +[NeoAdapter.Ndi] +HKR, , NetworkAddress, 0, %DefaultAddress% +HKR, Ndi, DeviceID, , "NeoAdapter_$TAG_INSTANCE_NAME$" +HKR, , DevLoader, , ndis +HKR, , DeviceVxDs, , $TAG_SYS_NAME$ +HKR, NDIS, LogDriverName, , "Neo_$TAG_INSTANCE_NAME$" +HKR, NDIS, MajorNdisVersion, 1, 5 +HKR, NDIS, MinorNdisVersion, 1, 0 +HKR, Ndi\Interfaces, DefUpper, , "ndis5" +HKR, Ndi\Interfaces, UpperRange, , "ndis5" +HKR, Ndi\Interfaces, LowerRange, , "ethernet" +HKR, Ndi\Interfaces, DefLower, , "ethernet" +HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" +HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% +HKR, Ndi\Params\NetworkAddress, type, 0, "edit" +HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" +HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" +HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% +HKR, Ndi\Params\NetworkAddress, optional, 0, "0" +HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% +HKR, Ndi\Params\MaxSpeed, type, 0, "int" +HKR, Ndi\Params\MaxSpeed, default, 0, "100" +HKR, Ndi\Params\MaxSpeed, min, 0, "0" +HKR, Ndi\Params\MaxSpeed, max, 0, "2000" +HKR, Ndi\Params\MaxSpeed, step, 0, "1" +HKR, Ndi\Params\MaxSpeed, Base, 0, "10" +HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% +HKR, Ndi\Params\KeepLink, type, 0, "enum" +HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% +HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% +HKR, Ndi\Params\KeepLink, default, 0, "0" + + +[Neo.Service] +DisplayName = %Neo.Service.DispName% +Description = %Neo.Service.Desc% +ServiceType = 1 +StartType = 3 +ErrorControl = 1 +ServiceBinary = %12%\$TAG_SYS_NAME$ +LoadOrderGroup = NDIS + +[Neo.Reg] +HKR, Ndi, Service, 0, Neo.Service.Name +HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" +HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" + +[Neo.EventLog] +HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_$TAG_INSTANCE_NAME$.sys" +HKR, , TypesSupported, 0x00010001, 7 + +[Strings] +CompanyName = "SoftEther Corporation" +DiskDescription = "VPN Client Device Driver Install Disk" +Neo.Service.Name = "Neo_$TAG_INSTANCE_NAME$" +Neo.Service.DispName = "VPN Client Device Driver - $TAG_INSTANCE_NAME$" +Neo.Service.Desc = "VPN Client Adapter - $TAG_INSTANCE_NAME$" +NeoAdapter.DeviceDesc = "VPN Client Adapter - $TAG_INSTANCE_NAME$" +Neo.EventLog.Name = "Neo" +NetworkAddress = "MAC Address" +DefaultAddress = "$TAG_MAC_ADDRESS$" +MaxSpeed = "Indicate Speed (Mbps)" +KeepLink = "Keep Link" +On = "On" +Off = "Off" + + +; Auto Generated 20180205_163608.744 + diff --git a/src/bin/hamcore/DriverPackages/Neo6_Win10/x64/Neo6_x64_VPN.inf b/src/bin/hamcore/DriverPackages/Neo6_Win10/x64/Neo6_x64_VPN.inf index 645aca1e..9c4b77ba 100644 --- a/src/bin/hamcore/DriverPackages/Neo6_Win10/x64/Neo6_x64_VPN.inf +++ b/src/bin/hamcore/DriverPackages/Neo6_Win10/x64/Neo6_x64_VPN.inf @@ -1,114 +1,114 @@ -; VPN Client Device Driver for Windows 2000 and Greater -; -; Copyright (c) SoftEther Corporation. All Rights Reserved. -; http://www.softether.co.jp/ -; -; BUILD 9658 - -[Version] -Signature = "$Windows NT$" -Class = Net -ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} -Provider = %CompanyName% -DriverVer = 02/04/2018, 4.25.0.9658 -CatalogFile.NT = Neo6_x64_VPN.cat - -[Manufacturer] -%CompanyName% = SoftEther, NTamd64 - -[SourceDisksNames] -1=%DiskDescription%, "", , - -[SourceDisksFiles] -Neo6_x64_VPN.sys = 1 - -[DestinationDirs] -DefaultDestDir = 12 -Neo.CopyFiles.Sys = 12 - -[Neo.CopyFiles.Sys] -Neo6_x64_VPN.sys, , , 2 - -[SoftEther.NTamd64] -%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN - -[NeoAdapter.Install] -Characteristics = 0x1 -AddReg = Neo.Reg, NeoAdapter.Ndi -CopyFiles = Neo.CopyFiles.Sys -*IfType = 53 -*MediaType = 0 -*PhysicalMediaType = 0 - -[NeoAdapter.Install.Services] -AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% - -[NeoAdapter.Ndi] -HKR, , NetworkAddress, 0, %DefaultAddress% -HKR, Ndi, DeviceID, , "NeoAdapter_VPN" -HKR, , DevLoader, , ndis -HKR, , DeviceVxDs, , Neo6_x64_VPN.sys -HKR, NDIS, LogDriverName, , "Neo_VPN" -HKR, NDIS, MajorNdisVersion, 1, 5 -HKR, NDIS, MinorNdisVersion, 1, 0 -HKR, Ndi\Interfaces, DefUpper, , "ndis5" -HKR, Ndi\Interfaces, UpperRange, , "ndis5" -HKR, Ndi\Interfaces, LowerRange, , "ethernet" -HKR, Ndi\Interfaces, DefLower, , "ethernet" -HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" -HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% -HKR, Ndi\Params\NetworkAddress, type, 0, "edit" -HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" -HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" -HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% -HKR, Ndi\Params\NetworkAddress, optional, 0, "0" -HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% -HKR, Ndi\Params\MaxSpeed, type, 0, "int" -HKR, Ndi\Params\MaxSpeed, default, 0, "100" -HKR, Ndi\Params\MaxSpeed, min, 0, "0" -HKR, Ndi\Params\MaxSpeed, max, 0, "2000" -HKR, Ndi\Params\MaxSpeed, step, 0, "1" -HKR, Ndi\Params\MaxSpeed, Base, 0, "10" -HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% -HKR, Ndi\Params\KeepLink, type, 0, "enum" -HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% -HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% -HKR, Ndi\Params\KeepLink, default, 0, "0" - - -[Neo.Service] -DisplayName = %Neo.Service.DispName% -Description = %Neo.Service.Desc% -ServiceType = 1 -StartType = 3 -ErrorControl = 1 -ServiceBinary = %12%\Neo6_x64_VPN.sys -LoadOrderGroup = NDIS - -[Neo.Reg] -HKR, Ndi, Service, 0, Neo.Service.Name -HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" -HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" - -[Neo.EventLog] -HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo6_x64_VPN.sys" -HKR, , TypesSupported, 0x00010001, 7 - -[Strings] -CompanyName = "SoftEther Corporation" -DiskDescription = "VPN Client Device Driver Install Disk" -Neo.Service.Name = "Neo_VPN" -Neo.Service.DispName = "VPN Client Device Driver - VPN" -Neo.Service.Desc = "VPN Client Adapter - VPN" -NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN" -Neo.EventLog.Name = "Neo" -NetworkAddress = "MAC Address" -DefaultAddress = "000001000001" -MaxSpeed = "Indicate Speed (Mbps)" -KeepLink = "Keep Link" -On = "On" -Off = "Off" - - -; Auto Generated 20180205_163621.381 - +; VPN Client Device Driver for Windows 2000 and Greater +; +; Copyright (c) SoftEther Corporation. All Rights Reserved. +; http://www.softether.co.jp/ +; +; BUILD 9658 + +[Version] +Signature = "$Windows NT$" +Class = Net +ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} +Provider = %CompanyName% +DriverVer = 02/04/2018, 4.25.0.9658 +CatalogFile.NT = Neo6_x64_VPN.cat + +[Manufacturer] +%CompanyName% = SoftEther, NTamd64 + +[SourceDisksNames] +1=%DiskDescription%, "", , + +[SourceDisksFiles] +Neo6_x64_VPN.sys = 1 + +[DestinationDirs] +DefaultDestDir = 12 +Neo.CopyFiles.Sys = 12 + +[Neo.CopyFiles.Sys] +Neo6_x64_VPN.sys, , , 2 + +[SoftEther.NTamd64] +%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN + +[NeoAdapter.Install] +Characteristics = 0x1 +AddReg = Neo.Reg, NeoAdapter.Ndi +CopyFiles = Neo.CopyFiles.Sys +*IfType = 53 +*MediaType = 0 +*PhysicalMediaType = 0 + +[NeoAdapter.Install.Services] +AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% + +[NeoAdapter.Ndi] +HKR, , NetworkAddress, 0, %DefaultAddress% +HKR, Ndi, DeviceID, , "NeoAdapter_VPN" +HKR, , DevLoader, , ndis +HKR, , DeviceVxDs, , Neo6_x64_VPN.sys +HKR, NDIS, LogDriverName, , "Neo_VPN" +HKR, NDIS, MajorNdisVersion, 1, 5 +HKR, NDIS, MinorNdisVersion, 1, 0 +HKR, Ndi\Interfaces, DefUpper, , "ndis5" +HKR, Ndi\Interfaces, UpperRange, , "ndis5" +HKR, Ndi\Interfaces, LowerRange, , "ethernet" +HKR, Ndi\Interfaces, DefLower, , "ethernet" +HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" +HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% +HKR, Ndi\Params\NetworkAddress, type, 0, "edit" +HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" +HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" +HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% +HKR, Ndi\Params\NetworkAddress, optional, 0, "0" +HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% +HKR, Ndi\Params\MaxSpeed, type, 0, "int" +HKR, Ndi\Params\MaxSpeed, default, 0, "100" +HKR, Ndi\Params\MaxSpeed, min, 0, "0" +HKR, Ndi\Params\MaxSpeed, max, 0, "2000" +HKR, Ndi\Params\MaxSpeed, step, 0, "1" +HKR, Ndi\Params\MaxSpeed, Base, 0, "10" +HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% +HKR, Ndi\Params\KeepLink, type, 0, "enum" +HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% +HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% +HKR, Ndi\Params\KeepLink, default, 0, "0" + + +[Neo.Service] +DisplayName = %Neo.Service.DispName% +Description = %Neo.Service.Desc% +ServiceType = 1 +StartType = 3 +ErrorControl = 1 +ServiceBinary = %12%\Neo6_x64_VPN.sys +LoadOrderGroup = NDIS + +[Neo.Reg] +HKR, Ndi, Service, 0, Neo.Service.Name +HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" +HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" + +[Neo.EventLog] +HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo6_x64_VPN.sys" +HKR, , TypesSupported, 0x00010001, 7 + +[Strings] +CompanyName = "SoftEther Corporation" +DiskDescription = "VPN Client Device Driver Install Disk" +Neo.Service.Name = "Neo_VPN" +Neo.Service.DispName = "VPN Client Device Driver - VPN" +Neo.Service.Desc = "VPN Client Adapter - VPN" +NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN" +Neo.EventLog.Name = "Neo" +NetworkAddress = "MAC Address" +DefaultAddress = "000001000001" +MaxSpeed = "Indicate Speed (Mbps)" +KeepLink = "Keep Link" +On = "On" +Off = "Off" + + +; Auto Generated 20180205_163621.381 + diff --git a/src/bin/hamcore/DriverPackages/Neo6_Win10/x64/Neo6_x64_VPN10.inf b/src/bin/hamcore/DriverPackages/Neo6_Win10/x64/Neo6_x64_VPN10.inf index cde348bc..081bb440 100644 --- a/src/bin/hamcore/DriverPackages/Neo6_Win10/x64/Neo6_x64_VPN10.inf +++ b/src/bin/hamcore/DriverPackages/Neo6_Win10/x64/Neo6_x64_VPN10.inf @@ -1,114 +1,114 @@ -; VPN Client Device Driver for Windows 2000 and Greater -; -; Copyright (c) SoftEther Corporation. All Rights Reserved. -; http://www.softether.co.jp/ -; -; BUILD 9658 - -[Version] -Signature = "$Windows NT$" -Class = Net -ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} -Provider = %CompanyName% -DriverVer = 02/04/2018, 4.25.0.9658 -CatalogFile.NT = Neo6_x64_VPN10.cat - -[Manufacturer] -%CompanyName% = SoftEther, NTamd64 - -[SourceDisksNames] -1=%DiskDescription%, "", , - -[SourceDisksFiles] -Neo6_x64_VPN10.sys = 1 - -[DestinationDirs] -DefaultDestDir = 12 -Neo.CopyFiles.Sys = 12 - -[Neo.CopyFiles.Sys] -Neo6_x64_VPN10.sys, , , 2 - -[SoftEther.NTamd64] -%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN10 - -[NeoAdapter.Install] -Characteristics = 0x1 -AddReg = Neo.Reg, NeoAdapter.Ndi -CopyFiles = Neo.CopyFiles.Sys -*IfType = 53 -*MediaType = 0 -*PhysicalMediaType = 0 - -[NeoAdapter.Install.Services] -AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% - -[NeoAdapter.Ndi] -HKR, , NetworkAddress, 0, %DefaultAddress% -HKR, Ndi, DeviceID, , "NeoAdapter_VPN10" -HKR, , DevLoader, , ndis -HKR, , DeviceVxDs, , Neo6_x64_VPN10.sys -HKR, NDIS, LogDriverName, , "Neo_VPN10" -HKR, NDIS, MajorNdisVersion, 1, 5 -HKR, NDIS, MinorNdisVersion, 1, 0 -HKR, Ndi\Interfaces, DefUpper, , "ndis5" -HKR, Ndi\Interfaces, UpperRange, , "ndis5" -HKR, Ndi\Interfaces, LowerRange, , "ethernet" -HKR, Ndi\Interfaces, DefLower, , "ethernet" -HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" -HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% -HKR, Ndi\Params\NetworkAddress, type, 0, "edit" -HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" -HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" -HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% -HKR, Ndi\Params\NetworkAddress, optional, 0, "0" -HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% -HKR, Ndi\Params\MaxSpeed, type, 0, "int" -HKR, Ndi\Params\MaxSpeed, default, 0, "100" -HKR, Ndi\Params\MaxSpeed, min, 0, "0" -HKR, Ndi\Params\MaxSpeed, max, 0, "2000" -HKR, Ndi\Params\MaxSpeed, step, 0, "1" -HKR, Ndi\Params\MaxSpeed, Base, 0, "10" -HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% -HKR, Ndi\Params\KeepLink, type, 0, "enum" -HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% -HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% -HKR, Ndi\Params\KeepLink, default, 0, "0" - - -[Neo.Service] -DisplayName = %Neo.Service.DispName% -Description = %Neo.Service.Desc% -ServiceType = 1 -StartType = 3 -ErrorControl = 1 -ServiceBinary = %12%\Neo6_x64_VPN10.sys -LoadOrderGroup = NDIS - -[Neo.Reg] -HKR, Ndi, Service, 0, Neo.Service.Name -HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" -HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" - -[Neo.EventLog] -HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo6_x64_VPN10.sys" -HKR, , TypesSupported, 0x00010001, 7 - -[Strings] -CompanyName = "SoftEther Corporation" -DiskDescription = "VPN Client Device Driver Install Disk" -Neo.Service.Name = "Neo_VPN10" -Neo.Service.DispName = "VPN Client Device Driver - VPN10" -Neo.Service.Desc = "VPN Client Adapter - VPN10" -NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN10" -Neo.EventLog.Name = "Neo" -NetworkAddress = "MAC Address" -DefaultAddress = "000001000001" -MaxSpeed = "Indicate Speed (Mbps)" -KeepLink = "Keep Link" -On = "On" -Off = "Off" - - -; Auto Generated 20180205_163622.029 - +; VPN Client Device Driver for Windows 2000 and Greater +; +; Copyright (c) SoftEther Corporation. All Rights Reserved. +; http://www.softether.co.jp/ +; +; BUILD 9658 + +[Version] +Signature = "$Windows NT$" +Class = Net +ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} +Provider = %CompanyName% +DriverVer = 02/04/2018, 4.25.0.9658 +CatalogFile.NT = Neo6_x64_VPN10.cat + +[Manufacturer] +%CompanyName% = SoftEther, NTamd64 + +[SourceDisksNames] +1=%DiskDescription%, "", , + +[SourceDisksFiles] +Neo6_x64_VPN10.sys = 1 + +[DestinationDirs] +DefaultDestDir = 12 +Neo.CopyFiles.Sys = 12 + +[Neo.CopyFiles.Sys] +Neo6_x64_VPN10.sys, , , 2 + +[SoftEther.NTamd64] +%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN10 + +[NeoAdapter.Install] +Characteristics = 0x1 +AddReg = Neo.Reg, NeoAdapter.Ndi +CopyFiles = Neo.CopyFiles.Sys +*IfType = 53 +*MediaType = 0 +*PhysicalMediaType = 0 + +[NeoAdapter.Install.Services] +AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% + +[NeoAdapter.Ndi] +HKR, , NetworkAddress, 0, %DefaultAddress% +HKR, Ndi, DeviceID, , "NeoAdapter_VPN10" +HKR, , DevLoader, , ndis +HKR, , DeviceVxDs, , Neo6_x64_VPN10.sys +HKR, NDIS, LogDriverName, , "Neo_VPN10" +HKR, NDIS, MajorNdisVersion, 1, 5 +HKR, NDIS, MinorNdisVersion, 1, 0 +HKR, Ndi\Interfaces, DefUpper, , "ndis5" +HKR, Ndi\Interfaces, UpperRange, , "ndis5" +HKR, Ndi\Interfaces, LowerRange, , "ethernet" +HKR, Ndi\Interfaces, DefLower, , "ethernet" +HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" +HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% +HKR, Ndi\Params\NetworkAddress, type, 0, "edit" +HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" +HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" +HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% +HKR, Ndi\Params\NetworkAddress, optional, 0, "0" +HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% +HKR, Ndi\Params\MaxSpeed, type, 0, "int" +HKR, Ndi\Params\MaxSpeed, default, 0, "100" +HKR, Ndi\Params\MaxSpeed, min, 0, "0" +HKR, Ndi\Params\MaxSpeed, max, 0, "2000" +HKR, Ndi\Params\MaxSpeed, step, 0, "1" +HKR, Ndi\Params\MaxSpeed, Base, 0, "10" +HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% +HKR, Ndi\Params\KeepLink, type, 0, "enum" +HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% +HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% +HKR, Ndi\Params\KeepLink, default, 0, "0" + + +[Neo.Service] +DisplayName = %Neo.Service.DispName% +Description = %Neo.Service.Desc% +ServiceType = 1 +StartType = 3 +ErrorControl = 1 +ServiceBinary = %12%\Neo6_x64_VPN10.sys +LoadOrderGroup = NDIS + +[Neo.Reg] +HKR, Ndi, Service, 0, Neo.Service.Name +HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" +HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" + +[Neo.EventLog] +HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo6_x64_VPN10.sys" +HKR, , TypesSupported, 0x00010001, 7 + +[Strings] +CompanyName = "SoftEther Corporation" +DiskDescription = "VPN Client Device Driver Install Disk" +Neo.Service.Name = "Neo_VPN10" +Neo.Service.DispName = "VPN Client Device Driver - VPN10" +Neo.Service.Desc = "VPN Client Adapter - VPN10" +NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN10" +Neo.EventLog.Name = "Neo" +NetworkAddress = "MAC Address" +DefaultAddress = "000001000001" +MaxSpeed = "Indicate Speed (Mbps)" +KeepLink = "Keep Link" +On = "On" +Off = "Off" + + +; Auto Generated 20180205_163622.029 + diff --git a/src/bin/hamcore/DriverPackages/Neo6_Win10/x64/Neo6_x64_VPN100.inf b/src/bin/hamcore/DriverPackages/Neo6_Win10/x64/Neo6_x64_VPN100.inf index d2771015..3bdc0af6 100644 --- a/src/bin/hamcore/DriverPackages/Neo6_Win10/x64/Neo6_x64_VPN100.inf +++ b/src/bin/hamcore/DriverPackages/Neo6_Win10/x64/Neo6_x64_VPN100.inf @@ -1,114 +1,114 @@ -; VPN Client Device Driver for Windows 2000 and Greater -; -; Copyright (c) SoftEther Corporation. All Rights Reserved. -; http://www.softether.co.jp/ -; -; BUILD 9658 - -[Version] -Signature = "$Windows NT$" -Class = Net -ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} -Provider = %CompanyName% -DriverVer = 02/04/2018, 4.25.0.9658 -CatalogFile.NT = Neo6_x64_VPN100.cat - -[Manufacturer] -%CompanyName% = SoftEther, NTamd64 - -[SourceDisksNames] -1=%DiskDescription%, "", , - -[SourceDisksFiles] -Neo6_x64_VPN100.sys = 1 - -[DestinationDirs] -DefaultDestDir = 12 -Neo.CopyFiles.Sys = 12 - -[Neo.CopyFiles.Sys] -Neo6_x64_VPN100.sys, , , 2 - -[SoftEther.NTamd64] -%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN100 - -[NeoAdapter.Install] -Characteristics = 0x1 -AddReg = Neo.Reg, NeoAdapter.Ndi -CopyFiles = Neo.CopyFiles.Sys -*IfType = 53 -*MediaType = 0 -*PhysicalMediaType = 0 - -[NeoAdapter.Install.Services] -AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% - -[NeoAdapter.Ndi] -HKR, , NetworkAddress, 0, %DefaultAddress% -HKR, Ndi, DeviceID, , "NeoAdapter_VPN100" -HKR, , DevLoader, , ndis -HKR, , DeviceVxDs, , Neo6_x64_VPN100.sys -HKR, NDIS, LogDriverName, , "Neo_VPN100" -HKR, NDIS, MajorNdisVersion, 1, 5 -HKR, NDIS, MinorNdisVersion, 1, 0 -HKR, Ndi\Interfaces, DefUpper, , "ndis5" -HKR, Ndi\Interfaces, UpperRange, , "ndis5" -HKR, Ndi\Interfaces, LowerRange, , "ethernet" -HKR, Ndi\Interfaces, DefLower, , "ethernet" -HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" -HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% -HKR, Ndi\Params\NetworkAddress, type, 0, "edit" -HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" -HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" -HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% -HKR, Ndi\Params\NetworkAddress, optional, 0, "0" -HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% -HKR, Ndi\Params\MaxSpeed, type, 0, "int" -HKR, Ndi\Params\MaxSpeed, default, 0, "100" -HKR, Ndi\Params\MaxSpeed, min, 0, "0" -HKR, Ndi\Params\MaxSpeed, max, 0, "2000" -HKR, Ndi\Params\MaxSpeed, step, 0, "1" -HKR, Ndi\Params\MaxSpeed, Base, 0, "10" -HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% -HKR, Ndi\Params\KeepLink, type, 0, "enum" -HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% -HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% -HKR, Ndi\Params\KeepLink, default, 0, "0" - - -[Neo.Service] -DisplayName = %Neo.Service.DispName% -Description = %Neo.Service.Desc% -ServiceType = 1 -StartType = 3 -ErrorControl = 1 -ServiceBinary = %12%\Neo6_x64_VPN100.sys -LoadOrderGroup = NDIS - -[Neo.Reg] -HKR, Ndi, Service, 0, Neo.Service.Name -HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" -HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" - -[Neo.EventLog] -HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo6_x64_VPN100.sys" -HKR, , TypesSupported, 0x00010001, 7 - -[Strings] -CompanyName = "SoftEther Corporation" -DiskDescription = "VPN Client Device Driver Install Disk" -Neo.Service.Name = "Neo_VPN100" -Neo.Service.DispName = "VPN Client Device Driver - VPN100" -Neo.Service.Desc = "VPN Client Adapter - VPN100" -NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN100" -Neo.EventLog.Name = "Neo" -NetworkAddress = "MAC Address" -DefaultAddress = "000001000001" -MaxSpeed = "Indicate Speed (Mbps)" -KeepLink = "Keep Link" -On = "On" -Off = "Off" - - -; Auto Generated 20180205_163628.442 - +; VPN Client Device Driver for Windows 2000 and Greater +; +; Copyright (c) SoftEther Corporation. All Rights Reserved. +; http://www.softether.co.jp/ +; +; BUILD 9658 + +[Version] +Signature = "$Windows NT$" +Class = Net +ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} +Provider = %CompanyName% +DriverVer = 02/04/2018, 4.25.0.9658 +CatalogFile.NT = Neo6_x64_VPN100.cat + +[Manufacturer] +%CompanyName% = SoftEther, NTamd64 + +[SourceDisksNames] +1=%DiskDescription%, "", , + +[SourceDisksFiles] +Neo6_x64_VPN100.sys = 1 + +[DestinationDirs] +DefaultDestDir = 12 +Neo.CopyFiles.Sys = 12 + +[Neo.CopyFiles.Sys] +Neo6_x64_VPN100.sys, , , 2 + +[SoftEther.NTamd64] +%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN100 + +[NeoAdapter.Install] +Characteristics = 0x1 +AddReg = Neo.Reg, NeoAdapter.Ndi +CopyFiles = Neo.CopyFiles.Sys +*IfType = 53 +*MediaType = 0 +*PhysicalMediaType = 0 + +[NeoAdapter.Install.Services] +AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% + +[NeoAdapter.Ndi] +HKR, , NetworkAddress, 0, %DefaultAddress% +HKR, Ndi, DeviceID, , "NeoAdapter_VPN100" +HKR, , DevLoader, , ndis +HKR, , DeviceVxDs, , Neo6_x64_VPN100.sys +HKR, NDIS, LogDriverName, , "Neo_VPN100" +HKR, NDIS, MajorNdisVersion, 1, 5 +HKR, NDIS, MinorNdisVersion, 1, 0 +HKR, Ndi\Interfaces, DefUpper, , "ndis5" +HKR, Ndi\Interfaces, UpperRange, , "ndis5" +HKR, Ndi\Interfaces, LowerRange, , "ethernet" +HKR, Ndi\Interfaces, DefLower, , "ethernet" +HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" +HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% +HKR, Ndi\Params\NetworkAddress, type, 0, "edit" +HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" +HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" +HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% +HKR, Ndi\Params\NetworkAddress, optional, 0, "0" +HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% +HKR, Ndi\Params\MaxSpeed, type, 0, "int" +HKR, Ndi\Params\MaxSpeed, default, 0, "100" +HKR, Ndi\Params\MaxSpeed, min, 0, "0" +HKR, Ndi\Params\MaxSpeed, max, 0, "2000" +HKR, Ndi\Params\MaxSpeed, step, 0, "1" +HKR, Ndi\Params\MaxSpeed, Base, 0, "10" +HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% +HKR, Ndi\Params\KeepLink, type, 0, "enum" +HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% +HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% +HKR, Ndi\Params\KeepLink, default, 0, "0" + + +[Neo.Service] +DisplayName = %Neo.Service.DispName% +Description = %Neo.Service.Desc% +ServiceType = 1 +StartType = 3 +ErrorControl = 1 +ServiceBinary = %12%\Neo6_x64_VPN100.sys +LoadOrderGroup = NDIS + +[Neo.Reg] +HKR, Ndi, Service, 0, Neo.Service.Name +HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" +HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" + +[Neo.EventLog] +HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo6_x64_VPN100.sys" +HKR, , TypesSupported, 0x00010001, 7 + +[Strings] +CompanyName = "SoftEther Corporation" +DiskDescription = "VPN Client Device Driver Install Disk" +Neo.Service.Name = "Neo_VPN100" +Neo.Service.DispName = "VPN Client Device Driver - VPN100" +Neo.Service.Desc = "VPN Client Adapter - VPN100" +NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN100" +Neo.EventLog.Name = "Neo" +NetworkAddress = "MAC Address" +DefaultAddress = "000001000001" +MaxSpeed = "Indicate Speed (Mbps)" +KeepLink = "Keep Link" +On = "On" +Off = "Off" + + +; Auto Generated 20180205_163628.442 + diff --git a/src/bin/hamcore/DriverPackages/Neo6_Win10/x64/Neo6_x64_VPN101.inf b/src/bin/hamcore/DriverPackages/Neo6_Win10/x64/Neo6_x64_VPN101.inf index b9a15785..94fbcaa2 100644 --- a/src/bin/hamcore/DriverPackages/Neo6_Win10/x64/Neo6_x64_VPN101.inf +++ b/src/bin/hamcore/DriverPackages/Neo6_Win10/x64/Neo6_x64_VPN101.inf @@ -1,114 +1,114 @@ -; VPN Client Device Driver for Windows 2000 and Greater -; -; Copyright (c) SoftEther Corporation. All Rights Reserved. -; http://www.softether.co.jp/ -; -; BUILD 9658 - -[Version] -Signature = "$Windows NT$" -Class = Net -ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} -Provider = %CompanyName% -DriverVer = 02/04/2018, 4.25.0.9658 -CatalogFile.NT = Neo6_x64_VPN101.cat - -[Manufacturer] -%CompanyName% = SoftEther, NTamd64 - -[SourceDisksNames] -1=%DiskDescription%, "", , - -[SourceDisksFiles] -Neo6_x64_VPN101.sys = 1 - -[DestinationDirs] -DefaultDestDir = 12 -Neo.CopyFiles.Sys = 12 - -[Neo.CopyFiles.Sys] -Neo6_x64_VPN101.sys, , , 2 - -[SoftEther.NTamd64] -%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN101 - -[NeoAdapter.Install] -Characteristics = 0x1 -AddReg = Neo.Reg, NeoAdapter.Ndi -CopyFiles = Neo.CopyFiles.Sys -*IfType = 53 -*MediaType = 0 -*PhysicalMediaType = 0 - -[NeoAdapter.Install.Services] -AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% - -[NeoAdapter.Ndi] -HKR, , NetworkAddress, 0, %DefaultAddress% -HKR, Ndi, DeviceID, , "NeoAdapter_VPN101" -HKR, , DevLoader, , ndis -HKR, , DeviceVxDs, , Neo6_x64_VPN101.sys -HKR, NDIS, LogDriverName, , "Neo_VPN101" -HKR, NDIS, MajorNdisVersion, 1, 5 -HKR, NDIS, MinorNdisVersion, 1, 0 -HKR, Ndi\Interfaces, DefUpper, , "ndis5" -HKR, Ndi\Interfaces, UpperRange, , "ndis5" -HKR, Ndi\Interfaces, LowerRange, , "ethernet" -HKR, Ndi\Interfaces, DefLower, , "ethernet" -HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" -HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% -HKR, Ndi\Params\NetworkAddress, type, 0, "edit" -HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" -HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" -HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% -HKR, Ndi\Params\NetworkAddress, optional, 0, "0" -HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% -HKR, Ndi\Params\MaxSpeed, type, 0, "int" -HKR, Ndi\Params\MaxSpeed, default, 0, "100" -HKR, Ndi\Params\MaxSpeed, min, 0, "0" -HKR, Ndi\Params\MaxSpeed, max, 0, "2000" -HKR, Ndi\Params\MaxSpeed, step, 0, "1" -HKR, Ndi\Params\MaxSpeed, Base, 0, "10" -HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% -HKR, Ndi\Params\KeepLink, type, 0, "enum" -HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% -HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% -HKR, Ndi\Params\KeepLink, default, 0, "0" - - -[Neo.Service] -DisplayName = %Neo.Service.DispName% -Description = %Neo.Service.Desc% -ServiceType = 1 -StartType = 3 -ErrorControl = 1 -ServiceBinary = %12%\Neo6_x64_VPN101.sys -LoadOrderGroup = NDIS - -[Neo.Reg] -HKR, Ndi, Service, 0, Neo.Service.Name -HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" -HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" - -[Neo.EventLog] -HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo6_x64_VPN101.sys" -HKR, , TypesSupported, 0x00010001, 7 - -[Strings] -CompanyName = "SoftEther Corporation" -DiskDescription = "VPN Client Device Driver Install Disk" -Neo.Service.Name = "Neo_VPN101" -Neo.Service.DispName = "VPN Client Device Driver - VPN101" -Neo.Service.Desc = "VPN Client Adapter - VPN101" -NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN101" -Neo.EventLog.Name = "Neo" -NetworkAddress = "MAC Address" -DefaultAddress = "000001000001" -MaxSpeed = "Indicate Speed (Mbps)" -KeepLink = "Keep Link" -On = "On" -Off = "Off" - - -; Auto Generated 20180205_163628.518 - +; VPN Client Device Driver for Windows 2000 and Greater +; +; Copyright (c) SoftEther Corporation. All Rights Reserved. +; http://www.softether.co.jp/ +; +; BUILD 9658 + +[Version] +Signature = "$Windows NT$" +Class = Net +ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} +Provider = %CompanyName% +DriverVer = 02/04/2018, 4.25.0.9658 +CatalogFile.NT = Neo6_x64_VPN101.cat + +[Manufacturer] +%CompanyName% = SoftEther, NTamd64 + +[SourceDisksNames] +1=%DiskDescription%, "", , + +[SourceDisksFiles] +Neo6_x64_VPN101.sys = 1 + +[DestinationDirs] +DefaultDestDir = 12 +Neo.CopyFiles.Sys = 12 + +[Neo.CopyFiles.Sys] +Neo6_x64_VPN101.sys, , , 2 + +[SoftEther.NTamd64] +%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN101 + +[NeoAdapter.Install] +Characteristics = 0x1 +AddReg = Neo.Reg, NeoAdapter.Ndi +CopyFiles = Neo.CopyFiles.Sys +*IfType = 53 +*MediaType = 0 +*PhysicalMediaType = 0 + +[NeoAdapter.Install.Services] +AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% + +[NeoAdapter.Ndi] +HKR, , NetworkAddress, 0, %DefaultAddress% +HKR, Ndi, DeviceID, , "NeoAdapter_VPN101" +HKR, , DevLoader, , ndis +HKR, , DeviceVxDs, , Neo6_x64_VPN101.sys +HKR, NDIS, LogDriverName, , "Neo_VPN101" +HKR, NDIS, MajorNdisVersion, 1, 5 +HKR, NDIS, MinorNdisVersion, 1, 0 +HKR, Ndi\Interfaces, DefUpper, , "ndis5" +HKR, Ndi\Interfaces, UpperRange, , "ndis5" +HKR, Ndi\Interfaces, LowerRange, , "ethernet" +HKR, Ndi\Interfaces, DefLower, , "ethernet" +HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" +HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% +HKR, Ndi\Params\NetworkAddress, type, 0, "edit" +HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" +HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" +HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% +HKR, Ndi\Params\NetworkAddress, optional, 0, "0" +HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% +HKR, Ndi\Params\MaxSpeed, type, 0, "int" +HKR, Ndi\Params\MaxSpeed, default, 0, "100" +HKR, Ndi\Params\MaxSpeed, min, 0, "0" +HKR, Ndi\Params\MaxSpeed, max, 0, "2000" +HKR, Ndi\Params\MaxSpeed, step, 0, "1" +HKR, Ndi\Params\MaxSpeed, Base, 0, "10" +HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% +HKR, Ndi\Params\KeepLink, type, 0, "enum" +HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% +HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% +HKR, Ndi\Params\KeepLink, default, 0, "0" + + +[Neo.Service] +DisplayName = %Neo.Service.DispName% +Description = %Neo.Service.Desc% +ServiceType = 1 +StartType = 3 +ErrorControl = 1 +ServiceBinary = %12%\Neo6_x64_VPN101.sys +LoadOrderGroup = NDIS + +[Neo.Reg] +HKR, Ndi, Service, 0, Neo.Service.Name +HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" +HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" + +[Neo.EventLog] +HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo6_x64_VPN101.sys" +HKR, , TypesSupported, 0x00010001, 7 + +[Strings] +CompanyName = "SoftEther Corporation" +DiskDescription = "VPN Client Device Driver Install Disk" +Neo.Service.Name = "Neo_VPN101" +Neo.Service.DispName = "VPN Client Device Driver - VPN101" +Neo.Service.Desc = "VPN Client Adapter - VPN101" +NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN101" +Neo.EventLog.Name = "Neo" +NetworkAddress = "MAC Address" +DefaultAddress = "000001000001" +MaxSpeed = "Indicate Speed (Mbps)" +KeepLink = "Keep Link" +On = "On" +Off = "Off" + + +; Auto Generated 20180205_163628.518 + diff --git a/src/bin/hamcore/DriverPackages/Neo6_Win10/x64/Neo6_x64_VPN102.inf b/src/bin/hamcore/DriverPackages/Neo6_Win10/x64/Neo6_x64_VPN102.inf index 75f9b964..197c207b 100644 --- a/src/bin/hamcore/DriverPackages/Neo6_Win10/x64/Neo6_x64_VPN102.inf +++ b/src/bin/hamcore/DriverPackages/Neo6_Win10/x64/Neo6_x64_VPN102.inf @@ -1,114 +1,114 @@ -; VPN Client Device Driver for Windows 2000 and Greater -; -; Copyright (c) SoftEther Corporation. All Rights Reserved. -; http://www.softether.co.jp/ -; -; BUILD 9658 - -[Version] -Signature = "$Windows NT$" -Class = Net -ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} -Provider = %CompanyName% -DriverVer = 02/04/2018, 4.25.0.9658 -CatalogFile.NT = Neo6_x64_VPN102.cat - -[Manufacturer] -%CompanyName% = SoftEther, NTamd64 - -[SourceDisksNames] -1=%DiskDescription%, "", , - -[SourceDisksFiles] -Neo6_x64_VPN102.sys = 1 - -[DestinationDirs] -DefaultDestDir = 12 -Neo.CopyFiles.Sys = 12 - -[Neo.CopyFiles.Sys] -Neo6_x64_VPN102.sys, , , 2 - -[SoftEther.NTamd64] -%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN102 - -[NeoAdapter.Install] -Characteristics = 0x1 -AddReg = Neo.Reg, NeoAdapter.Ndi -CopyFiles = Neo.CopyFiles.Sys -*IfType = 53 -*MediaType = 0 -*PhysicalMediaType = 0 - -[NeoAdapter.Install.Services] -AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% - -[NeoAdapter.Ndi] -HKR, , NetworkAddress, 0, %DefaultAddress% -HKR, Ndi, DeviceID, , "NeoAdapter_VPN102" -HKR, , DevLoader, , ndis -HKR, , DeviceVxDs, , Neo6_x64_VPN102.sys -HKR, NDIS, LogDriverName, , "Neo_VPN102" -HKR, NDIS, MajorNdisVersion, 1, 5 -HKR, NDIS, MinorNdisVersion, 1, 0 -HKR, Ndi\Interfaces, DefUpper, , "ndis5" -HKR, Ndi\Interfaces, UpperRange, , "ndis5" -HKR, Ndi\Interfaces, LowerRange, , "ethernet" -HKR, Ndi\Interfaces, DefLower, , "ethernet" -HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" -HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% -HKR, Ndi\Params\NetworkAddress, type, 0, "edit" -HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" -HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" -HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% -HKR, Ndi\Params\NetworkAddress, optional, 0, "0" -HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% -HKR, Ndi\Params\MaxSpeed, type, 0, "int" -HKR, Ndi\Params\MaxSpeed, default, 0, "100" -HKR, Ndi\Params\MaxSpeed, min, 0, "0" -HKR, Ndi\Params\MaxSpeed, max, 0, "2000" -HKR, Ndi\Params\MaxSpeed, step, 0, "1" -HKR, Ndi\Params\MaxSpeed, Base, 0, "10" -HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% -HKR, Ndi\Params\KeepLink, type, 0, "enum" -HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% -HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% -HKR, Ndi\Params\KeepLink, default, 0, "0" - - -[Neo.Service] -DisplayName = %Neo.Service.DispName% -Description = %Neo.Service.Desc% -ServiceType = 1 -StartType = 3 -ErrorControl = 1 -ServiceBinary = %12%\Neo6_x64_VPN102.sys -LoadOrderGroup = NDIS - -[Neo.Reg] -HKR, Ndi, Service, 0, Neo.Service.Name -HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" -HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" - -[Neo.EventLog] -HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo6_x64_VPN102.sys" -HKR, , TypesSupported, 0x00010001, 7 - -[Strings] -CompanyName = "SoftEther Corporation" -DiskDescription = "VPN Client Device Driver Install Disk" -Neo.Service.Name = "Neo_VPN102" -Neo.Service.DispName = "VPN Client Device Driver - VPN102" -Neo.Service.Desc = "VPN Client Adapter - VPN102" -NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN102" -Neo.EventLog.Name = "Neo" -NetworkAddress = "MAC Address" -DefaultAddress = "000001000001" -MaxSpeed = "Indicate Speed (Mbps)" -KeepLink = "Keep Link" -On = "On" -Off = "Off" - - -; Auto Generated 20180205_163628.591 - +; VPN Client Device Driver for Windows 2000 and Greater +; +; Copyright (c) SoftEther Corporation. All Rights Reserved. +; http://www.softether.co.jp/ +; +; BUILD 9658 + +[Version] +Signature = "$Windows NT$" +Class = Net +ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} +Provider = %CompanyName% +DriverVer = 02/04/2018, 4.25.0.9658 +CatalogFile.NT = Neo6_x64_VPN102.cat + +[Manufacturer] +%CompanyName% = SoftEther, NTamd64 + +[SourceDisksNames] +1=%DiskDescription%, "", , + +[SourceDisksFiles] +Neo6_x64_VPN102.sys = 1 + +[DestinationDirs] +DefaultDestDir = 12 +Neo.CopyFiles.Sys = 12 + +[Neo.CopyFiles.Sys] +Neo6_x64_VPN102.sys, , , 2 + +[SoftEther.NTamd64] +%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN102 + +[NeoAdapter.Install] +Characteristics = 0x1 +AddReg = Neo.Reg, NeoAdapter.Ndi +CopyFiles = Neo.CopyFiles.Sys +*IfType = 53 +*MediaType = 0 +*PhysicalMediaType = 0 + +[NeoAdapter.Install.Services] +AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% + +[NeoAdapter.Ndi] +HKR, , NetworkAddress, 0, %DefaultAddress% +HKR, Ndi, DeviceID, , "NeoAdapter_VPN102" +HKR, , DevLoader, , ndis +HKR, , DeviceVxDs, , Neo6_x64_VPN102.sys +HKR, NDIS, LogDriverName, , "Neo_VPN102" +HKR, NDIS, MajorNdisVersion, 1, 5 +HKR, NDIS, MinorNdisVersion, 1, 0 +HKR, Ndi\Interfaces, DefUpper, , "ndis5" +HKR, Ndi\Interfaces, UpperRange, , "ndis5" +HKR, Ndi\Interfaces, LowerRange, , "ethernet" +HKR, Ndi\Interfaces, DefLower, , "ethernet" +HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" +HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% +HKR, Ndi\Params\NetworkAddress, type, 0, "edit" +HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" +HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" +HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% +HKR, Ndi\Params\NetworkAddress, optional, 0, "0" +HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% +HKR, Ndi\Params\MaxSpeed, type, 0, "int" +HKR, Ndi\Params\MaxSpeed, default, 0, "100" +HKR, Ndi\Params\MaxSpeed, min, 0, "0" +HKR, Ndi\Params\MaxSpeed, max, 0, "2000" +HKR, Ndi\Params\MaxSpeed, step, 0, "1" +HKR, Ndi\Params\MaxSpeed, Base, 0, "10" +HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% +HKR, Ndi\Params\KeepLink, type, 0, "enum" +HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% +HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% +HKR, Ndi\Params\KeepLink, default, 0, "0" + + +[Neo.Service] +DisplayName = %Neo.Service.DispName% +Description = %Neo.Service.Desc% +ServiceType = 1 +StartType = 3 +ErrorControl = 1 +ServiceBinary = %12%\Neo6_x64_VPN102.sys +LoadOrderGroup = NDIS + +[Neo.Reg] +HKR, Ndi, Service, 0, Neo.Service.Name +HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" +HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" + +[Neo.EventLog] +HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo6_x64_VPN102.sys" +HKR, , TypesSupported, 0x00010001, 7 + +[Strings] +CompanyName = "SoftEther Corporation" +DiskDescription = "VPN Client Device Driver Install Disk" +Neo.Service.Name = "Neo_VPN102" +Neo.Service.DispName = "VPN Client Device Driver - VPN102" +Neo.Service.Desc = "VPN Client Adapter - VPN102" +NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN102" +Neo.EventLog.Name = "Neo" +NetworkAddress = "MAC Address" +DefaultAddress = "000001000001" +MaxSpeed = "Indicate Speed (Mbps)" +KeepLink = "Keep Link" +On = "On" +Off = "Off" + + +; Auto Generated 20180205_163628.591 + diff --git a/src/bin/hamcore/DriverPackages/Neo6_Win10/x64/Neo6_x64_VPN103.inf b/src/bin/hamcore/DriverPackages/Neo6_Win10/x64/Neo6_x64_VPN103.inf index f2507548..253b86d8 100644 --- a/src/bin/hamcore/DriverPackages/Neo6_Win10/x64/Neo6_x64_VPN103.inf +++ b/src/bin/hamcore/DriverPackages/Neo6_Win10/x64/Neo6_x64_VPN103.inf @@ -1,114 +1,114 @@ -; VPN Client Device Driver for Windows 2000 and Greater -; -; Copyright (c) SoftEther Corporation. All Rights Reserved. -; http://www.softether.co.jp/ -; -; BUILD 9658 - -[Version] -Signature = "$Windows NT$" -Class = Net -ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} -Provider = %CompanyName% -DriverVer = 02/04/2018, 4.25.0.9658 -CatalogFile.NT = Neo6_x64_VPN103.cat - -[Manufacturer] -%CompanyName% = SoftEther, NTamd64 - -[SourceDisksNames] -1=%DiskDescription%, "", , - -[SourceDisksFiles] -Neo6_x64_VPN103.sys = 1 - -[DestinationDirs] -DefaultDestDir = 12 -Neo.CopyFiles.Sys = 12 - -[Neo.CopyFiles.Sys] -Neo6_x64_VPN103.sys, , , 2 - -[SoftEther.NTamd64] -%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN103 - -[NeoAdapter.Install] -Characteristics = 0x1 -AddReg = Neo.Reg, NeoAdapter.Ndi -CopyFiles = Neo.CopyFiles.Sys -*IfType = 53 -*MediaType = 0 -*PhysicalMediaType = 0 - -[NeoAdapter.Install.Services] -AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% - -[NeoAdapter.Ndi] -HKR, , NetworkAddress, 0, %DefaultAddress% -HKR, Ndi, DeviceID, , "NeoAdapter_VPN103" -HKR, , DevLoader, , ndis -HKR, , DeviceVxDs, , Neo6_x64_VPN103.sys -HKR, NDIS, LogDriverName, , "Neo_VPN103" -HKR, NDIS, MajorNdisVersion, 1, 5 -HKR, NDIS, MinorNdisVersion, 1, 0 -HKR, Ndi\Interfaces, DefUpper, , "ndis5" -HKR, Ndi\Interfaces, UpperRange, , "ndis5" -HKR, Ndi\Interfaces, LowerRange, , "ethernet" -HKR, Ndi\Interfaces, DefLower, , "ethernet" -HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" -HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% -HKR, Ndi\Params\NetworkAddress, type, 0, "edit" -HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" -HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" -HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% -HKR, Ndi\Params\NetworkAddress, optional, 0, "0" -HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% -HKR, Ndi\Params\MaxSpeed, type, 0, "int" -HKR, Ndi\Params\MaxSpeed, default, 0, "100" -HKR, Ndi\Params\MaxSpeed, min, 0, "0" -HKR, Ndi\Params\MaxSpeed, max, 0, "2000" -HKR, Ndi\Params\MaxSpeed, step, 0, "1" -HKR, Ndi\Params\MaxSpeed, Base, 0, "10" -HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% -HKR, Ndi\Params\KeepLink, type, 0, "enum" -HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% -HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% -HKR, Ndi\Params\KeepLink, default, 0, "0" - - -[Neo.Service] -DisplayName = %Neo.Service.DispName% -Description = %Neo.Service.Desc% -ServiceType = 1 -StartType = 3 -ErrorControl = 1 -ServiceBinary = %12%\Neo6_x64_VPN103.sys -LoadOrderGroup = NDIS - -[Neo.Reg] -HKR, Ndi, Service, 0, Neo.Service.Name -HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" -HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" - -[Neo.EventLog] -HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo6_x64_VPN103.sys" -HKR, , TypesSupported, 0x00010001, 7 - -[Strings] -CompanyName = "SoftEther Corporation" -DiskDescription = "VPN Client Device Driver Install Disk" -Neo.Service.Name = "Neo_VPN103" -Neo.Service.DispName = "VPN Client Device Driver - VPN103" -Neo.Service.Desc = "VPN Client Adapter - VPN103" -NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN103" -Neo.EventLog.Name = "Neo" -NetworkAddress = "MAC Address" -DefaultAddress = "000001000001" -MaxSpeed = "Indicate Speed (Mbps)" -KeepLink = "Keep Link" -On = "On" -Off = "Off" - - -; Auto Generated 20180205_163628.664 - +; VPN Client Device Driver for Windows 2000 and Greater +; +; Copyright (c) SoftEther Corporation. All Rights Reserved. +; http://www.softether.co.jp/ +; +; BUILD 9658 + +[Version] +Signature = "$Windows NT$" +Class = Net +ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} +Provider = %CompanyName% +DriverVer = 02/04/2018, 4.25.0.9658 +CatalogFile.NT = Neo6_x64_VPN103.cat + +[Manufacturer] +%CompanyName% = SoftEther, NTamd64 + +[SourceDisksNames] +1=%DiskDescription%, "", , + +[SourceDisksFiles] +Neo6_x64_VPN103.sys = 1 + +[DestinationDirs] +DefaultDestDir = 12 +Neo.CopyFiles.Sys = 12 + +[Neo.CopyFiles.Sys] +Neo6_x64_VPN103.sys, , , 2 + +[SoftEther.NTamd64] +%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN103 + +[NeoAdapter.Install] +Characteristics = 0x1 +AddReg = Neo.Reg, NeoAdapter.Ndi +CopyFiles = Neo.CopyFiles.Sys +*IfType = 53 +*MediaType = 0 +*PhysicalMediaType = 0 + +[NeoAdapter.Install.Services] +AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% + +[NeoAdapter.Ndi] +HKR, , NetworkAddress, 0, %DefaultAddress% +HKR, Ndi, DeviceID, , "NeoAdapter_VPN103" +HKR, , DevLoader, , ndis +HKR, , DeviceVxDs, , Neo6_x64_VPN103.sys +HKR, NDIS, LogDriverName, , "Neo_VPN103" +HKR, NDIS, MajorNdisVersion, 1, 5 +HKR, NDIS, MinorNdisVersion, 1, 0 +HKR, Ndi\Interfaces, DefUpper, , "ndis5" +HKR, Ndi\Interfaces, UpperRange, , "ndis5" +HKR, Ndi\Interfaces, LowerRange, , "ethernet" +HKR, Ndi\Interfaces, DefLower, , "ethernet" +HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" +HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% +HKR, Ndi\Params\NetworkAddress, type, 0, "edit" +HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" +HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" +HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% +HKR, Ndi\Params\NetworkAddress, optional, 0, "0" +HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% +HKR, Ndi\Params\MaxSpeed, type, 0, "int" +HKR, Ndi\Params\MaxSpeed, default, 0, "100" +HKR, Ndi\Params\MaxSpeed, min, 0, "0" +HKR, Ndi\Params\MaxSpeed, max, 0, "2000" +HKR, Ndi\Params\MaxSpeed, step, 0, "1" +HKR, Ndi\Params\MaxSpeed, Base, 0, "10" +HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% +HKR, Ndi\Params\KeepLink, type, 0, "enum" +HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% +HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% +HKR, Ndi\Params\KeepLink, default, 0, "0" + + +[Neo.Service] +DisplayName = %Neo.Service.DispName% +Description = %Neo.Service.Desc% +ServiceType = 1 +StartType = 3 +ErrorControl = 1 +ServiceBinary = %12%\Neo6_x64_VPN103.sys +LoadOrderGroup = NDIS + +[Neo.Reg] +HKR, Ndi, Service, 0, Neo.Service.Name +HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" +HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" + +[Neo.EventLog] +HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo6_x64_VPN103.sys" +HKR, , TypesSupported, 0x00010001, 7 + +[Strings] +CompanyName = "SoftEther Corporation" +DiskDescription = "VPN Client Device Driver Install Disk" +Neo.Service.Name = "Neo_VPN103" +Neo.Service.DispName = "VPN Client Device Driver - VPN103" +Neo.Service.Desc = "VPN Client Adapter - VPN103" +NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN103" +Neo.EventLog.Name = "Neo" +NetworkAddress = "MAC Address" +DefaultAddress = "000001000001" +MaxSpeed = "Indicate Speed (Mbps)" +KeepLink = "Keep Link" +On = "On" +Off = "Off" + + +; Auto Generated 20180205_163628.664 + diff --git a/src/bin/hamcore/DriverPackages/Neo6_Win10/x64/Neo6_x64_VPN104.inf b/src/bin/hamcore/DriverPackages/Neo6_Win10/x64/Neo6_x64_VPN104.inf index b7d04609..fc12db7e 100644 --- a/src/bin/hamcore/DriverPackages/Neo6_Win10/x64/Neo6_x64_VPN104.inf +++ b/src/bin/hamcore/DriverPackages/Neo6_Win10/x64/Neo6_x64_VPN104.inf @@ -1,114 +1,114 @@ -; VPN Client Device Driver for Windows 2000 and Greater -; -; Copyright (c) SoftEther Corporation. All Rights Reserved. -; http://www.softether.co.jp/ -; -; BUILD 9658 - -[Version] -Signature = "$Windows NT$" -Class = Net -ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} -Provider = %CompanyName% -DriverVer = 02/04/2018, 4.25.0.9658 -CatalogFile.NT = Neo6_x64_VPN104.cat - -[Manufacturer] -%CompanyName% = SoftEther, NTamd64 - -[SourceDisksNames] -1=%DiskDescription%, "", , - -[SourceDisksFiles] -Neo6_x64_VPN104.sys = 1 - -[DestinationDirs] -DefaultDestDir = 12 -Neo.CopyFiles.Sys = 12 - -[Neo.CopyFiles.Sys] -Neo6_x64_VPN104.sys, , , 2 - -[SoftEther.NTamd64] -%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN104 - -[NeoAdapter.Install] -Characteristics = 0x1 -AddReg = Neo.Reg, NeoAdapter.Ndi -CopyFiles = Neo.CopyFiles.Sys -*IfType = 53 -*MediaType = 0 -*PhysicalMediaType = 0 - -[NeoAdapter.Install.Services] -AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% - -[NeoAdapter.Ndi] -HKR, , NetworkAddress, 0, %DefaultAddress% -HKR, Ndi, DeviceID, , "NeoAdapter_VPN104" -HKR, , DevLoader, , ndis -HKR, , DeviceVxDs, , Neo6_x64_VPN104.sys -HKR, NDIS, LogDriverName, , "Neo_VPN104" -HKR, NDIS, MajorNdisVersion, 1, 5 -HKR, NDIS, MinorNdisVersion, 1, 0 -HKR, Ndi\Interfaces, DefUpper, , "ndis5" -HKR, Ndi\Interfaces, UpperRange, , "ndis5" -HKR, Ndi\Interfaces, LowerRange, , "ethernet" -HKR, Ndi\Interfaces, DefLower, , "ethernet" -HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" -HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% -HKR, Ndi\Params\NetworkAddress, type, 0, "edit" -HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" -HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" -HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% -HKR, Ndi\Params\NetworkAddress, optional, 0, "0" -HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% -HKR, Ndi\Params\MaxSpeed, type, 0, "int" -HKR, Ndi\Params\MaxSpeed, default, 0, "100" -HKR, Ndi\Params\MaxSpeed, min, 0, "0" -HKR, Ndi\Params\MaxSpeed, max, 0, "2000" -HKR, Ndi\Params\MaxSpeed, step, 0, "1" -HKR, Ndi\Params\MaxSpeed, Base, 0, "10" -HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% -HKR, Ndi\Params\KeepLink, type, 0, "enum" -HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% -HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% -HKR, Ndi\Params\KeepLink, default, 0, "0" - - -[Neo.Service] -DisplayName = %Neo.Service.DispName% -Description = %Neo.Service.Desc% -ServiceType = 1 -StartType = 3 -ErrorControl = 1 -ServiceBinary = %12%\Neo6_x64_VPN104.sys -LoadOrderGroup = NDIS - -[Neo.Reg] -HKR, Ndi, Service, 0, Neo.Service.Name -HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" -HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" - -[Neo.EventLog] -HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo6_x64_VPN104.sys" -HKR, , TypesSupported, 0x00010001, 7 - -[Strings] -CompanyName = "SoftEther Corporation" -DiskDescription = "VPN Client Device Driver Install Disk" -Neo.Service.Name = "Neo_VPN104" -Neo.Service.DispName = "VPN Client Device Driver - VPN104" -Neo.Service.Desc = "VPN Client Adapter - VPN104" -NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN104" -Neo.EventLog.Name = "Neo" -NetworkAddress = "MAC Address" -DefaultAddress = "000001000001" -MaxSpeed = "Indicate Speed (Mbps)" -KeepLink = "Keep Link" -On = "On" -Off = "Off" - - -; Auto Generated 20180205_163628.735 - +; VPN Client Device Driver for Windows 2000 and Greater +; +; Copyright (c) SoftEther Corporation. All Rights Reserved. +; http://www.softether.co.jp/ +; +; BUILD 9658 + +[Version] +Signature = "$Windows NT$" +Class = Net +ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} +Provider = %CompanyName% +DriverVer = 02/04/2018, 4.25.0.9658 +CatalogFile.NT = Neo6_x64_VPN104.cat + +[Manufacturer] +%CompanyName% = SoftEther, NTamd64 + +[SourceDisksNames] +1=%DiskDescription%, "", , + +[SourceDisksFiles] +Neo6_x64_VPN104.sys = 1 + +[DestinationDirs] +DefaultDestDir = 12 +Neo.CopyFiles.Sys = 12 + +[Neo.CopyFiles.Sys] +Neo6_x64_VPN104.sys, , , 2 + +[SoftEther.NTamd64] +%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN104 + +[NeoAdapter.Install] +Characteristics = 0x1 +AddReg = Neo.Reg, NeoAdapter.Ndi +CopyFiles = Neo.CopyFiles.Sys +*IfType = 53 +*MediaType = 0 +*PhysicalMediaType = 0 + +[NeoAdapter.Install.Services] +AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% + +[NeoAdapter.Ndi] +HKR, , NetworkAddress, 0, %DefaultAddress% +HKR, Ndi, DeviceID, , "NeoAdapter_VPN104" +HKR, , DevLoader, , ndis +HKR, , DeviceVxDs, , Neo6_x64_VPN104.sys +HKR, NDIS, LogDriverName, , "Neo_VPN104" +HKR, NDIS, MajorNdisVersion, 1, 5 +HKR, NDIS, MinorNdisVersion, 1, 0 +HKR, Ndi\Interfaces, DefUpper, , "ndis5" +HKR, Ndi\Interfaces, UpperRange, , "ndis5" +HKR, Ndi\Interfaces, LowerRange, , "ethernet" +HKR, Ndi\Interfaces, DefLower, , "ethernet" +HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" +HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% +HKR, Ndi\Params\NetworkAddress, type, 0, "edit" +HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" +HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" +HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% +HKR, Ndi\Params\NetworkAddress, optional, 0, "0" +HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% +HKR, Ndi\Params\MaxSpeed, type, 0, "int" +HKR, Ndi\Params\MaxSpeed, default, 0, "100" +HKR, Ndi\Params\MaxSpeed, min, 0, "0" +HKR, Ndi\Params\MaxSpeed, max, 0, "2000" +HKR, Ndi\Params\MaxSpeed, step, 0, "1" +HKR, Ndi\Params\MaxSpeed, Base, 0, "10" +HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% +HKR, Ndi\Params\KeepLink, type, 0, "enum" +HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% +HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% +HKR, Ndi\Params\KeepLink, default, 0, "0" + + +[Neo.Service] +DisplayName = %Neo.Service.DispName% +Description = %Neo.Service.Desc% +ServiceType = 1 +StartType = 3 +ErrorControl = 1 +ServiceBinary = %12%\Neo6_x64_VPN104.sys +LoadOrderGroup = NDIS + +[Neo.Reg] +HKR, Ndi, Service, 0, Neo.Service.Name +HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" +HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" + +[Neo.EventLog] +HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo6_x64_VPN104.sys" +HKR, , TypesSupported, 0x00010001, 7 + +[Strings] +CompanyName = "SoftEther Corporation" +DiskDescription = "VPN Client Device Driver Install Disk" +Neo.Service.Name = "Neo_VPN104" +Neo.Service.DispName = "VPN Client Device Driver - VPN104" +Neo.Service.Desc = "VPN Client Adapter - VPN104" +NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN104" +Neo.EventLog.Name = "Neo" +NetworkAddress = "MAC Address" +DefaultAddress = "000001000001" +MaxSpeed = "Indicate Speed (Mbps)" +KeepLink = "Keep Link" +On = "On" +Off = "Off" + + +; Auto Generated 20180205_163628.735 + diff --git a/src/bin/hamcore/DriverPackages/Neo6_Win10/x64/Neo6_x64_VPN105.inf b/src/bin/hamcore/DriverPackages/Neo6_Win10/x64/Neo6_x64_VPN105.inf index 37318fb3..388cd3e6 100644 --- a/src/bin/hamcore/DriverPackages/Neo6_Win10/x64/Neo6_x64_VPN105.inf +++ b/src/bin/hamcore/DriverPackages/Neo6_Win10/x64/Neo6_x64_VPN105.inf @@ -1,114 +1,114 @@ -; VPN Client Device Driver for Windows 2000 and Greater -; -; Copyright (c) SoftEther Corporation. All Rights Reserved. -; http://www.softether.co.jp/ -; -; BUILD 9658 - -[Version] -Signature = "$Windows NT$" -Class = Net -ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} -Provider = %CompanyName% -DriverVer = 02/04/2018, 4.25.0.9658 -CatalogFile.NT = Neo6_x64_VPN105.cat - -[Manufacturer] -%CompanyName% = SoftEther, NTamd64 - -[SourceDisksNames] -1=%DiskDescription%, "", , - -[SourceDisksFiles] -Neo6_x64_VPN105.sys = 1 - -[DestinationDirs] -DefaultDestDir = 12 -Neo.CopyFiles.Sys = 12 - -[Neo.CopyFiles.Sys] -Neo6_x64_VPN105.sys, , , 2 - -[SoftEther.NTamd64] -%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN105 - -[NeoAdapter.Install] -Characteristics = 0x1 -AddReg = Neo.Reg, NeoAdapter.Ndi -CopyFiles = Neo.CopyFiles.Sys -*IfType = 53 -*MediaType = 0 -*PhysicalMediaType = 0 - -[NeoAdapter.Install.Services] -AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% - -[NeoAdapter.Ndi] -HKR, , NetworkAddress, 0, %DefaultAddress% -HKR, Ndi, DeviceID, , "NeoAdapter_VPN105" -HKR, , DevLoader, , ndis -HKR, , DeviceVxDs, , Neo6_x64_VPN105.sys -HKR, NDIS, LogDriverName, , "Neo_VPN105" -HKR, NDIS, MajorNdisVersion, 1, 5 -HKR, NDIS, MinorNdisVersion, 1, 0 -HKR, Ndi\Interfaces, DefUpper, , "ndis5" -HKR, Ndi\Interfaces, UpperRange, , "ndis5" -HKR, Ndi\Interfaces, LowerRange, , "ethernet" -HKR, Ndi\Interfaces, DefLower, , "ethernet" -HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" -HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% -HKR, Ndi\Params\NetworkAddress, type, 0, "edit" -HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" -HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" -HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% -HKR, Ndi\Params\NetworkAddress, optional, 0, "0" -HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% -HKR, Ndi\Params\MaxSpeed, type, 0, "int" -HKR, Ndi\Params\MaxSpeed, default, 0, "100" -HKR, Ndi\Params\MaxSpeed, min, 0, "0" -HKR, Ndi\Params\MaxSpeed, max, 0, "2000" -HKR, Ndi\Params\MaxSpeed, step, 0, "1" -HKR, Ndi\Params\MaxSpeed, Base, 0, "10" -HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% -HKR, Ndi\Params\KeepLink, type, 0, "enum" -HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% -HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% -HKR, Ndi\Params\KeepLink, default, 0, "0" - - -[Neo.Service] -DisplayName = %Neo.Service.DispName% -Description = %Neo.Service.Desc% -ServiceType = 1 -StartType = 3 -ErrorControl = 1 -ServiceBinary = %12%\Neo6_x64_VPN105.sys -LoadOrderGroup = NDIS - -[Neo.Reg] -HKR, Ndi, Service, 0, Neo.Service.Name -HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" -HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" - -[Neo.EventLog] -HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo6_x64_VPN105.sys" -HKR, , TypesSupported, 0x00010001, 7 - -[Strings] -CompanyName = "SoftEther Corporation" -DiskDescription = "VPN Client Device Driver Install Disk" -Neo.Service.Name = "Neo_VPN105" -Neo.Service.DispName = "VPN Client Device Driver - VPN105" -Neo.Service.Desc = "VPN Client Adapter - VPN105" -NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN105" -Neo.EventLog.Name = "Neo" -NetworkAddress = "MAC Address" -DefaultAddress = "000001000001" -MaxSpeed = "Indicate Speed (Mbps)" -KeepLink = "Keep Link" -On = "On" -Off = "Off" - - -; Auto Generated 20180205_163628.808 - +; VPN Client Device Driver for Windows 2000 and Greater +; +; Copyright (c) SoftEther Corporation. All Rights Reserved. +; http://www.softether.co.jp/ +; +; BUILD 9658 + +[Version] +Signature = "$Windows NT$" +Class = Net +ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} +Provider = %CompanyName% +DriverVer = 02/04/2018, 4.25.0.9658 +CatalogFile.NT = Neo6_x64_VPN105.cat + +[Manufacturer] +%CompanyName% = SoftEther, NTamd64 + +[SourceDisksNames] +1=%DiskDescription%, "", , + +[SourceDisksFiles] +Neo6_x64_VPN105.sys = 1 + +[DestinationDirs] +DefaultDestDir = 12 +Neo.CopyFiles.Sys = 12 + +[Neo.CopyFiles.Sys] +Neo6_x64_VPN105.sys, , , 2 + +[SoftEther.NTamd64] +%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN105 + +[NeoAdapter.Install] +Characteristics = 0x1 +AddReg = Neo.Reg, NeoAdapter.Ndi +CopyFiles = Neo.CopyFiles.Sys +*IfType = 53 +*MediaType = 0 +*PhysicalMediaType = 0 + +[NeoAdapter.Install.Services] +AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% + +[NeoAdapter.Ndi] +HKR, , NetworkAddress, 0, %DefaultAddress% +HKR, Ndi, DeviceID, , "NeoAdapter_VPN105" +HKR, , DevLoader, , ndis +HKR, , DeviceVxDs, , Neo6_x64_VPN105.sys +HKR, NDIS, LogDriverName, , "Neo_VPN105" +HKR, NDIS, MajorNdisVersion, 1, 5 +HKR, NDIS, MinorNdisVersion, 1, 0 +HKR, Ndi\Interfaces, DefUpper, , "ndis5" +HKR, Ndi\Interfaces, UpperRange, , "ndis5" +HKR, Ndi\Interfaces, LowerRange, , "ethernet" +HKR, Ndi\Interfaces, DefLower, , "ethernet" +HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" +HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% +HKR, Ndi\Params\NetworkAddress, type, 0, "edit" +HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" +HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" +HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% +HKR, Ndi\Params\NetworkAddress, optional, 0, "0" +HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% +HKR, Ndi\Params\MaxSpeed, type, 0, "int" +HKR, Ndi\Params\MaxSpeed, default, 0, "100" +HKR, Ndi\Params\MaxSpeed, min, 0, "0" +HKR, Ndi\Params\MaxSpeed, max, 0, "2000" +HKR, Ndi\Params\MaxSpeed, step, 0, "1" +HKR, Ndi\Params\MaxSpeed, Base, 0, "10" +HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% +HKR, Ndi\Params\KeepLink, type, 0, "enum" +HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% +HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% +HKR, Ndi\Params\KeepLink, default, 0, "0" + + +[Neo.Service] +DisplayName = %Neo.Service.DispName% +Description = %Neo.Service.Desc% +ServiceType = 1 +StartType = 3 +ErrorControl = 1 +ServiceBinary = %12%\Neo6_x64_VPN105.sys +LoadOrderGroup = NDIS + +[Neo.Reg] +HKR, Ndi, Service, 0, Neo.Service.Name +HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" +HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" + +[Neo.EventLog] +HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo6_x64_VPN105.sys" +HKR, , TypesSupported, 0x00010001, 7 + +[Strings] +CompanyName = "SoftEther Corporation" +DiskDescription = "VPN Client Device Driver Install Disk" +Neo.Service.Name = "Neo_VPN105" +Neo.Service.DispName = "VPN Client Device Driver - VPN105" +Neo.Service.Desc = "VPN Client Adapter - VPN105" +NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN105" +Neo.EventLog.Name = "Neo" +NetworkAddress = "MAC Address" +DefaultAddress = "000001000001" +MaxSpeed = "Indicate Speed (Mbps)" +KeepLink = "Keep Link" +On = "On" +Off = "Off" + + +; Auto Generated 20180205_163628.808 + diff --git a/src/bin/hamcore/DriverPackages/Neo6_Win10/x64/Neo6_x64_VPN106.inf b/src/bin/hamcore/DriverPackages/Neo6_Win10/x64/Neo6_x64_VPN106.inf index 3147d941..881d2fb3 100644 --- a/src/bin/hamcore/DriverPackages/Neo6_Win10/x64/Neo6_x64_VPN106.inf +++ b/src/bin/hamcore/DriverPackages/Neo6_Win10/x64/Neo6_x64_VPN106.inf @@ -1,114 +1,114 @@ -; VPN Client Device Driver for Windows 2000 and Greater -; -; Copyright (c) SoftEther Corporation. All Rights Reserved. -; http://www.softether.co.jp/ -; -; BUILD 9658 - -[Version] -Signature = "$Windows NT$" -Class = Net -ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} -Provider = %CompanyName% -DriverVer = 02/04/2018, 4.25.0.9658 -CatalogFile.NT = Neo6_x64_VPN106.cat - -[Manufacturer] -%CompanyName% = SoftEther, NTamd64 - -[SourceDisksNames] -1=%DiskDescription%, "", , - -[SourceDisksFiles] -Neo6_x64_VPN106.sys = 1 - -[DestinationDirs] -DefaultDestDir = 12 -Neo.CopyFiles.Sys = 12 - -[Neo.CopyFiles.Sys] -Neo6_x64_VPN106.sys, , , 2 - -[SoftEther.NTamd64] -%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN106 - -[NeoAdapter.Install] -Characteristics = 0x1 -AddReg = Neo.Reg, NeoAdapter.Ndi -CopyFiles = Neo.CopyFiles.Sys -*IfType = 53 -*MediaType = 0 -*PhysicalMediaType = 0 - -[NeoAdapter.Install.Services] -AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% - -[NeoAdapter.Ndi] -HKR, , NetworkAddress, 0, %DefaultAddress% -HKR, Ndi, DeviceID, , "NeoAdapter_VPN106" -HKR, , DevLoader, , ndis -HKR, , DeviceVxDs, , Neo6_x64_VPN106.sys -HKR, NDIS, LogDriverName, , "Neo_VPN106" -HKR, NDIS, MajorNdisVersion, 1, 5 -HKR, NDIS, MinorNdisVersion, 1, 0 -HKR, Ndi\Interfaces, DefUpper, , "ndis5" -HKR, Ndi\Interfaces, UpperRange, , "ndis5" -HKR, Ndi\Interfaces, LowerRange, , "ethernet" -HKR, Ndi\Interfaces, DefLower, , "ethernet" -HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" -HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% -HKR, Ndi\Params\NetworkAddress, type, 0, "edit" -HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" -HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" -HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% -HKR, Ndi\Params\NetworkAddress, optional, 0, "0" -HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% -HKR, Ndi\Params\MaxSpeed, type, 0, "int" -HKR, Ndi\Params\MaxSpeed, default, 0, "100" -HKR, Ndi\Params\MaxSpeed, min, 0, "0" -HKR, Ndi\Params\MaxSpeed, max, 0, "2000" -HKR, Ndi\Params\MaxSpeed, step, 0, "1" -HKR, Ndi\Params\MaxSpeed, Base, 0, "10" -HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% -HKR, Ndi\Params\KeepLink, type, 0, "enum" -HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% -HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% -HKR, Ndi\Params\KeepLink, default, 0, "0" - - -[Neo.Service] -DisplayName = %Neo.Service.DispName% -Description = %Neo.Service.Desc% -ServiceType = 1 -StartType = 3 -ErrorControl = 1 -ServiceBinary = %12%\Neo6_x64_VPN106.sys -LoadOrderGroup = NDIS - -[Neo.Reg] -HKR, Ndi, Service, 0, Neo.Service.Name -HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" -HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" - -[Neo.EventLog] -HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo6_x64_VPN106.sys" -HKR, , TypesSupported, 0x00010001, 7 - -[Strings] -CompanyName = "SoftEther Corporation" -DiskDescription = "VPN Client Device Driver Install Disk" -Neo.Service.Name = "Neo_VPN106" -Neo.Service.DispName = "VPN Client Device Driver - VPN106" -Neo.Service.Desc = "VPN Client Adapter - VPN106" -NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN106" -Neo.EventLog.Name = "Neo" -NetworkAddress = "MAC Address" -DefaultAddress = "000001000001" -MaxSpeed = "Indicate Speed (Mbps)" -KeepLink = "Keep Link" -On = "On" -Off = "Off" - - -; Auto Generated 20180205_163628.880 - +; VPN Client Device Driver for Windows 2000 and Greater +; +; Copyright (c) SoftEther Corporation. All Rights Reserved. +; http://www.softether.co.jp/ +; +; BUILD 9658 + +[Version] +Signature = "$Windows NT$" +Class = Net +ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} +Provider = %CompanyName% +DriverVer = 02/04/2018, 4.25.0.9658 +CatalogFile.NT = Neo6_x64_VPN106.cat + +[Manufacturer] +%CompanyName% = SoftEther, NTamd64 + +[SourceDisksNames] +1=%DiskDescription%, "", , + +[SourceDisksFiles] +Neo6_x64_VPN106.sys = 1 + +[DestinationDirs] +DefaultDestDir = 12 +Neo.CopyFiles.Sys = 12 + +[Neo.CopyFiles.Sys] +Neo6_x64_VPN106.sys, , , 2 + +[SoftEther.NTamd64] +%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN106 + +[NeoAdapter.Install] +Characteristics = 0x1 +AddReg = Neo.Reg, NeoAdapter.Ndi +CopyFiles = Neo.CopyFiles.Sys +*IfType = 53 +*MediaType = 0 +*PhysicalMediaType = 0 + +[NeoAdapter.Install.Services] +AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% + +[NeoAdapter.Ndi] +HKR, , NetworkAddress, 0, %DefaultAddress% +HKR, Ndi, DeviceID, , "NeoAdapter_VPN106" +HKR, , DevLoader, , ndis +HKR, , DeviceVxDs, , Neo6_x64_VPN106.sys +HKR, NDIS, LogDriverName, , "Neo_VPN106" +HKR, NDIS, MajorNdisVersion, 1, 5 +HKR, NDIS, MinorNdisVersion, 1, 0 +HKR, Ndi\Interfaces, DefUpper, , "ndis5" +HKR, Ndi\Interfaces, UpperRange, , "ndis5" +HKR, Ndi\Interfaces, LowerRange, , "ethernet" +HKR, Ndi\Interfaces, DefLower, , "ethernet" +HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" +HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% +HKR, Ndi\Params\NetworkAddress, type, 0, "edit" +HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" +HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" +HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% +HKR, Ndi\Params\NetworkAddress, optional, 0, "0" +HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% +HKR, Ndi\Params\MaxSpeed, type, 0, "int" +HKR, Ndi\Params\MaxSpeed, default, 0, "100" +HKR, Ndi\Params\MaxSpeed, min, 0, "0" +HKR, Ndi\Params\MaxSpeed, max, 0, "2000" +HKR, Ndi\Params\MaxSpeed, step, 0, "1" +HKR, Ndi\Params\MaxSpeed, Base, 0, "10" +HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% +HKR, Ndi\Params\KeepLink, type, 0, "enum" +HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% +HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% +HKR, Ndi\Params\KeepLink, default, 0, "0" + + +[Neo.Service] +DisplayName = %Neo.Service.DispName% +Description = %Neo.Service.Desc% +ServiceType = 1 +StartType = 3 +ErrorControl = 1 +ServiceBinary = %12%\Neo6_x64_VPN106.sys +LoadOrderGroup = NDIS + +[Neo.Reg] +HKR, Ndi, Service, 0, Neo.Service.Name +HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" +HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" + +[Neo.EventLog] +HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo6_x64_VPN106.sys" +HKR, , TypesSupported, 0x00010001, 7 + +[Strings] +CompanyName = "SoftEther Corporation" +DiskDescription = "VPN Client Device Driver Install Disk" +Neo.Service.Name = "Neo_VPN106" +Neo.Service.DispName = "VPN Client Device Driver - VPN106" +Neo.Service.Desc = "VPN Client Adapter - VPN106" +NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN106" +Neo.EventLog.Name = "Neo" +NetworkAddress = "MAC Address" +DefaultAddress = "000001000001" +MaxSpeed = "Indicate Speed (Mbps)" +KeepLink = "Keep Link" +On = "On" +Off = "Off" + + +; Auto Generated 20180205_163628.880 + diff --git a/src/bin/hamcore/DriverPackages/Neo6_Win10/x64/Neo6_x64_VPN107.inf b/src/bin/hamcore/DriverPackages/Neo6_Win10/x64/Neo6_x64_VPN107.inf index 594ace22..b25d59f3 100644 --- a/src/bin/hamcore/DriverPackages/Neo6_Win10/x64/Neo6_x64_VPN107.inf +++ b/src/bin/hamcore/DriverPackages/Neo6_Win10/x64/Neo6_x64_VPN107.inf @@ -1,114 +1,114 @@ -; VPN Client Device Driver for Windows 2000 and Greater -; -; Copyright (c) SoftEther Corporation. All Rights Reserved. -; http://www.softether.co.jp/ -; -; BUILD 9658 - -[Version] -Signature = "$Windows NT$" -Class = Net -ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} -Provider = %CompanyName% -DriverVer = 02/04/2018, 4.25.0.9658 -CatalogFile.NT = Neo6_x64_VPN107.cat - -[Manufacturer] -%CompanyName% = SoftEther, NTamd64 - -[SourceDisksNames] -1=%DiskDescription%, "", , - -[SourceDisksFiles] -Neo6_x64_VPN107.sys = 1 - -[DestinationDirs] -DefaultDestDir = 12 -Neo.CopyFiles.Sys = 12 - -[Neo.CopyFiles.Sys] -Neo6_x64_VPN107.sys, , , 2 - -[SoftEther.NTamd64] -%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN107 - -[NeoAdapter.Install] -Characteristics = 0x1 -AddReg = Neo.Reg, NeoAdapter.Ndi -CopyFiles = Neo.CopyFiles.Sys -*IfType = 53 -*MediaType = 0 -*PhysicalMediaType = 0 - -[NeoAdapter.Install.Services] -AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% - -[NeoAdapter.Ndi] -HKR, , NetworkAddress, 0, %DefaultAddress% -HKR, Ndi, DeviceID, , "NeoAdapter_VPN107" -HKR, , DevLoader, , ndis -HKR, , DeviceVxDs, , Neo6_x64_VPN107.sys -HKR, NDIS, LogDriverName, , "Neo_VPN107" -HKR, NDIS, MajorNdisVersion, 1, 5 -HKR, NDIS, MinorNdisVersion, 1, 0 -HKR, Ndi\Interfaces, DefUpper, , "ndis5" -HKR, Ndi\Interfaces, UpperRange, , "ndis5" -HKR, Ndi\Interfaces, LowerRange, , "ethernet" -HKR, Ndi\Interfaces, DefLower, , "ethernet" -HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" -HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% -HKR, Ndi\Params\NetworkAddress, type, 0, "edit" -HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" -HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" -HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% -HKR, Ndi\Params\NetworkAddress, optional, 0, "0" -HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% -HKR, Ndi\Params\MaxSpeed, type, 0, "int" -HKR, Ndi\Params\MaxSpeed, default, 0, "100" -HKR, Ndi\Params\MaxSpeed, min, 0, "0" -HKR, Ndi\Params\MaxSpeed, max, 0, "2000" -HKR, Ndi\Params\MaxSpeed, step, 0, "1" -HKR, Ndi\Params\MaxSpeed, Base, 0, "10" -HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% -HKR, Ndi\Params\KeepLink, type, 0, "enum" -HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% -HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% -HKR, Ndi\Params\KeepLink, default, 0, "0" - - -[Neo.Service] -DisplayName = %Neo.Service.DispName% -Description = %Neo.Service.Desc% -ServiceType = 1 -StartType = 3 -ErrorControl = 1 -ServiceBinary = %12%\Neo6_x64_VPN107.sys -LoadOrderGroup = NDIS - -[Neo.Reg] -HKR, Ndi, Service, 0, Neo.Service.Name -HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" -HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" - -[Neo.EventLog] -HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo6_x64_VPN107.sys" -HKR, , TypesSupported, 0x00010001, 7 - -[Strings] -CompanyName = "SoftEther Corporation" -DiskDescription = "VPN Client Device Driver Install Disk" -Neo.Service.Name = "Neo_VPN107" -Neo.Service.DispName = "VPN Client Device Driver - VPN107" -Neo.Service.Desc = "VPN Client Adapter - VPN107" -NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN107" -Neo.EventLog.Name = "Neo" -NetworkAddress = "MAC Address" -DefaultAddress = "000001000001" -MaxSpeed = "Indicate Speed (Mbps)" -KeepLink = "Keep Link" -On = "On" -Off = "Off" - - -; Auto Generated 20180205_163628.951 - +; VPN Client Device Driver for Windows 2000 and Greater +; +; Copyright (c) SoftEther Corporation. All Rights Reserved. +; http://www.softether.co.jp/ +; +; BUILD 9658 + +[Version] +Signature = "$Windows NT$" +Class = Net +ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} +Provider = %CompanyName% +DriverVer = 02/04/2018, 4.25.0.9658 +CatalogFile.NT = Neo6_x64_VPN107.cat + +[Manufacturer] +%CompanyName% = SoftEther, NTamd64 + +[SourceDisksNames] +1=%DiskDescription%, "", , + +[SourceDisksFiles] +Neo6_x64_VPN107.sys = 1 + +[DestinationDirs] +DefaultDestDir = 12 +Neo.CopyFiles.Sys = 12 + +[Neo.CopyFiles.Sys] +Neo6_x64_VPN107.sys, , , 2 + +[SoftEther.NTamd64] +%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN107 + +[NeoAdapter.Install] +Characteristics = 0x1 +AddReg = Neo.Reg, NeoAdapter.Ndi +CopyFiles = Neo.CopyFiles.Sys +*IfType = 53 +*MediaType = 0 +*PhysicalMediaType = 0 + +[NeoAdapter.Install.Services] +AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% + +[NeoAdapter.Ndi] +HKR, , NetworkAddress, 0, %DefaultAddress% +HKR, Ndi, DeviceID, , "NeoAdapter_VPN107" +HKR, , DevLoader, , ndis +HKR, , DeviceVxDs, , Neo6_x64_VPN107.sys +HKR, NDIS, LogDriverName, , "Neo_VPN107" +HKR, NDIS, MajorNdisVersion, 1, 5 +HKR, NDIS, MinorNdisVersion, 1, 0 +HKR, Ndi\Interfaces, DefUpper, , "ndis5" +HKR, Ndi\Interfaces, UpperRange, , "ndis5" +HKR, Ndi\Interfaces, LowerRange, , "ethernet" +HKR, Ndi\Interfaces, DefLower, , "ethernet" +HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" +HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% +HKR, Ndi\Params\NetworkAddress, type, 0, "edit" +HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" +HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" +HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% +HKR, Ndi\Params\NetworkAddress, optional, 0, "0" +HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% +HKR, Ndi\Params\MaxSpeed, type, 0, "int" +HKR, Ndi\Params\MaxSpeed, default, 0, "100" +HKR, Ndi\Params\MaxSpeed, min, 0, "0" +HKR, Ndi\Params\MaxSpeed, max, 0, "2000" +HKR, Ndi\Params\MaxSpeed, step, 0, "1" +HKR, Ndi\Params\MaxSpeed, Base, 0, "10" +HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% +HKR, Ndi\Params\KeepLink, type, 0, "enum" +HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% +HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% +HKR, Ndi\Params\KeepLink, default, 0, "0" + + +[Neo.Service] +DisplayName = %Neo.Service.DispName% +Description = %Neo.Service.Desc% +ServiceType = 1 +StartType = 3 +ErrorControl = 1 +ServiceBinary = %12%\Neo6_x64_VPN107.sys +LoadOrderGroup = NDIS + +[Neo.Reg] +HKR, Ndi, Service, 0, Neo.Service.Name +HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" +HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" + +[Neo.EventLog] +HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo6_x64_VPN107.sys" +HKR, , TypesSupported, 0x00010001, 7 + +[Strings] +CompanyName = "SoftEther Corporation" +DiskDescription = "VPN Client Device Driver Install Disk" +Neo.Service.Name = "Neo_VPN107" +Neo.Service.DispName = "VPN Client Device Driver - VPN107" +Neo.Service.Desc = "VPN Client Adapter - VPN107" +NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN107" +Neo.EventLog.Name = "Neo" +NetworkAddress = "MAC Address" +DefaultAddress = "000001000001" +MaxSpeed = "Indicate Speed (Mbps)" +KeepLink = "Keep Link" +On = "On" +Off = "Off" + + +; Auto Generated 20180205_163628.951 + diff --git a/src/bin/hamcore/DriverPackages/Neo6_Win10/x64/Neo6_x64_VPN108.inf b/src/bin/hamcore/DriverPackages/Neo6_Win10/x64/Neo6_x64_VPN108.inf index 575cc4d1..52c34ffa 100644 --- a/src/bin/hamcore/DriverPackages/Neo6_Win10/x64/Neo6_x64_VPN108.inf +++ b/src/bin/hamcore/DriverPackages/Neo6_Win10/x64/Neo6_x64_VPN108.inf @@ -1,114 +1,114 @@ -; VPN Client Device Driver for Windows 2000 and Greater -; -; Copyright (c) SoftEther Corporation. All Rights Reserved. -; http://www.softether.co.jp/ -; -; BUILD 9658 - -[Version] -Signature = "$Windows NT$" -Class = Net -ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} -Provider = %CompanyName% -DriverVer = 02/04/2018, 4.25.0.9658 -CatalogFile.NT = Neo6_x64_VPN108.cat - -[Manufacturer] -%CompanyName% = SoftEther, NTamd64 - -[SourceDisksNames] -1=%DiskDescription%, "", , - -[SourceDisksFiles] -Neo6_x64_VPN108.sys = 1 - -[DestinationDirs] -DefaultDestDir = 12 -Neo.CopyFiles.Sys = 12 - -[Neo.CopyFiles.Sys] -Neo6_x64_VPN108.sys, , , 2 - -[SoftEther.NTamd64] -%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN108 - -[NeoAdapter.Install] -Characteristics = 0x1 -AddReg = Neo.Reg, NeoAdapter.Ndi -CopyFiles = Neo.CopyFiles.Sys -*IfType = 53 -*MediaType = 0 -*PhysicalMediaType = 0 - -[NeoAdapter.Install.Services] -AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% - -[NeoAdapter.Ndi] -HKR, , NetworkAddress, 0, %DefaultAddress% -HKR, Ndi, DeviceID, , "NeoAdapter_VPN108" -HKR, , DevLoader, , ndis -HKR, , DeviceVxDs, , Neo6_x64_VPN108.sys -HKR, NDIS, LogDriverName, , "Neo_VPN108" -HKR, NDIS, MajorNdisVersion, 1, 5 -HKR, NDIS, MinorNdisVersion, 1, 0 -HKR, Ndi\Interfaces, DefUpper, , "ndis5" -HKR, Ndi\Interfaces, UpperRange, , "ndis5" -HKR, Ndi\Interfaces, LowerRange, , "ethernet" -HKR, Ndi\Interfaces, DefLower, , "ethernet" -HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" -HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% -HKR, Ndi\Params\NetworkAddress, type, 0, "edit" -HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" -HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" -HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% -HKR, Ndi\Params\NetworkAddress, optional, 0, "0" -HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% -HKR, Ndi\Params\MaxSpeed, type, 0, "int" -HKR, Ndi\Params\MaxSpeed, default, 0, "100" -HKR, Ndi\Params\MaxSpeed, min, 0, "0" -HKR, Ndi\Params\MaxSpeed, max, 0, "2000" -HKR, Ndi\Params\MaxSpeed, step, 0, "1" -HKR, Ndi\Params\MaxSpeed, Base, 0, "10" -HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% -HKR, Ndi\Params\KeepLink, type, 0, "enum" -HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% -HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% -HKR, Ndi\Params\KeepLink, default, 0, "0" - - -[Neo.Service] -DisplayName = %Neo.Service.DispName% -Description = %Neo.Service.Desc% -ServiceType = 1 -StartType = 3 -ErrorControl = 1 -ServiceBinary = %12%\Neo6_x64_VPN108.sys -LoadOrderGroup = NDIS - -[Neo.Reg] -HKR, Ndi, Service, 0, Neo.Service.Name -HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" -HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" - -[Neo.EventLog] -HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo6_x64_VPN108.sys" -HKR, , TypesSupported, 0x00010001, 7 - -[Strings] -CompanyName = "SoftEther Corporation" -DiskDescription = "VPN Client Device Driver Install Disk" -Neo.Service.Name = "Neo_VPN108" -Neo.Service.DispName = "VPN Client Device Driver - VPN108" -Neo.Service.Desc = "VPN Client Adapter - VPN108" -NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN108" -Neo.EventLog.Name = "Neo" -NetworkAddress = "MAC Address" -DefaultAddress = "000001000001" -MaxSpeed = "Indicate Speed (Mbps)" -KeepLink = "Keep Link" -On = "On" -Off = "Off" - - -; Auto Generated 20180205_163629.021 - +; VPN Client Device Driver for Windows 2000 and Greater +; +; Copyright (c) SoftEther Corporation. All Rights Reserved. +; http://www.softether.co.jp/ +; +; BUILD 9658 + +[Version] +Signature = "$Windows NT$" +Class = Net +ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} +Provider = %CompanyName% +DriverVer = 02/04/2018, 4.25.0.9658 +CatalogFile.NT = Neo6_x64_VPN108.cat + +[Manufacturer] +%CompanyName% = SoftEther, NTamd64 + +[SourceDisksNames] +1=%DiskDescription%, "", , + +[SourceDisksFiles] +Neo6_x64_VPN108.sys = 1 + +[DestinationDirs] +DefaultDestDir = 12 +Neo.CopyFiles.Sys = 12 + +[Neo.CopyFiles.Sys] +Neo6_x64_VPN108.sys, , , 2 + +[SoftEther.NTamd64] +%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN108 + +[NeoAdapter.Install] +Characteristics = 0x1 +AddReg = Neo.Reg, NeoAdapter.Ndi +CopyFiles = Neo.CopyFiles.Sys +*IfType = 53 +*MediaType = 0 +*PhysicalMediaType = 0 + +[NeoAdapter.Install.Services] +AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% + +[NeoAdapter.Ndi] +HKR, , NetworkAddress, 0, %DefaultAddress% +HKR, Ndi, DeviceID, , "NeoAdapter_VPN108" +HKR, , DevLoader, , ndis +HKR, , DeviceVxDs, , Neo6_x64_VPN108.sys +HKR, NDIS, LogDriverName, , "Neo_VPN108" +HKR, NDIS, MajorNdisVersion, 1, 5 +HKR, NDIS, MinorNdisVersion, 1, 0 +HKR, Ndi\Interfaces, DefUpper, , "ndis5" +HKR, Ndi\Interfaces, UpperRange, , "ndis5" +HKR, Ndi\Interfaces, LowerRange, , "ethernet" +HKR, Ndi\Interfaces, DefLower, , "ethernet" +HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" +HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% +HKR, Ndi\Params\NetworkAddress, type, 0, "edit" +HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" +HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" +HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% +HKR, Ndi\Params\NetworkAddress, optional, 0, "0" +HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% +HKR, Ndi\Params\MaxSpeed, type, 0, "int" +HKR, Ndi\Params\MaxSpeed, default, 0, "100" +HKR, Ndi\Params\MaxSpeed, min, 0, "0" +HKR, Ndi\Params\MaxSpeed, max, 0, "2000" +HKR, Ndi\Params\MaxSpeed, step, 0, "1" +HKR, Ndi\Params\MaxSpeed, Base, 0, "10" +HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% +HKR, Ndi\Params\KeepLink, type, 0, "enum" +HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% +HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% +HKR, Ndi\Params\KeepLink, default, 0, "0" + + +[Neo.Service] +DisplayName = %Neo.Service.DispName% +Description = %Neo.Service.Desc% +ServiceType = 1 +StartType = 3 +ErrorControl = 1 +ServiceBinary = %12%\Neo6_x64_VPN108.sys +LoadOrderGroup = NDIS + +[Neo.Reg] +HKR, Ndi, Service, 0, Neo.Service.Name +HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" +HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" + +[Neo.EventLog] +HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo6_x64_VPN108.sys" +HKR, , TypesSupported, 0x00010001, 7 + +[Strings] +CompanyName = "SoftEther Corporation" +DiskDescription = "VPN Client Device Driver Install Disk" +Neo.Service.Name = "Neo_VPN108" +Neo.Service.DispName = "VPN Client Device Driver - VPN108" +Neo.Service.Desc = "VPN Client Adapter - VPN108" +NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN108" +Neo.EventLog.Name = "Neo" +NetworkAddress = "MAC Address" +DefaultAddress = "000001000001" +MaxSpeed = "Indicate Speed (Mbps)" +KeepLink = "Keep Link" +On = "On" +Off = "Off" + + +; Auto Generated 20180205_163629.021 + diff --git a/src/bin/hamcore/DriverPackages/Neo6_Win10/x64/Neo6_x64_VPN109.inf b/src/bin/hamcore/DriverPackages/Neo6_Win10/x64/Neo6_x64_VPN109.inf index 03d579b3..39a81762 100644 --- a/src/bin/hamcore/DriverPackages/Neo6_Win10/x64/Neo6_x64_VPN109.inf +++ b/src/bin/hamcore/DriverPackages/Neo6_Win10/x64/Neo6_x64_VPN109.inf @@ -1,114 +1,114 @@ -; VPN Client Device Driver for Windows 2000 and Greater -; -; Copyright (c) SoftEther Corporation. All Rights Reserved. -; http://www.softether.co.jp/ -; -; BUILD 9658 - -[Version] -Signature = "$Windows NT$" -Class = Net -ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} -Provider = %CompanyName% -DriverVer = 02/04/2018, 4.25.0.9658 -CatalogFile.NT = Neo6_x64_VPN109.cat - -[Manufacturer] -%CompanyName% = SoftEther, NTamd64 - -[SourceDisksNames] -1=%DiskDescription%, "", , - -[SourceDisksFiles] -Neo6_x64_VPN109.sys = 1 - -[DestinationDirs] -DefaultDestDir = 12 -Neo.CopyFiles.Sys = 12 - -[Neo.CopyFiles.Sys] -Neo6_x64_VPN109.sys, , , 2 - -[SoftEther.NTamd64] -%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN109 - -[NeoAdapter.Install] -Characteristics = 0x1 -AddReg = Neo.Reg, NeoAdapter.Ndi -CopyFiles = Neo.CopyFiles.Sys -*IfType = 53 -*MediaType = 0 -*PhysicalMediaType = 0 - -[NeoAdapter.Install.Services] -AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% - -[NeoAdapter.Ndi] -HKR, , NetworkAddress, 0, %DefaultAddress% -HKR, Ndi, DeviceID, , "NeoAdapter_VPN109" -HKR, , DevLoader, , ndis -HKR, , DeviceVxDs, , Neo6_x64_VPN109.sys -HKR, NDIS, LogDriverName, , "Neo_VPN109" -HKR, NDIS, MajorNdisVersion, 1, 5 -HKR, NDIS, MinorNdisVersion, 1, 0 -HKR, Ndi\Interfaces, DefUpper, , "ndis5" -HKR, Ndi\Interfaces, UpperRange, , "ndis5" -HKR, Ndi\Interfaces, LowerRange, , "ethernet" -HKR, Ndi\Interfaces, DefLower, , "ethernet" -HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" -HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% -HKR, Ndi\Params\NetworkAddress, type, 0, "edit" -HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" -HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" -HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% -HKR, Ndi\Params\NetworkAddress, optional, 0, "0" -HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% -HKR, Ndi\Params\MaxSpeed, type, 0, "int" -HKR, Ndi\Params\MaxSpeed, default, 0, "100" -HKR, Ndi\Params\MaxSpeed, min, 0, "0" -HKR, Ndi\Params\MaxSpeed, max, 0, "2000" -HKR, Ndi\Params\MaxSpeed, step, 0, "1" -HKR, Ndi\Params\MaxSpeed, Base, 0, "10" -HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% -HKR, Ndi\Params\KeepLink, type, 0, "enum" -HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% -HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% -HKR, Ndi\Params\KeepLink, default, 0, "0" - - -[Neo.Service] -DisplayName = %Neo.Service.DispName% -Description = %Neo.Service.Desc% -ServiceType = 1 -StartType = 3 -ErrorControl = 1 -ServiceBinary = %12%\Neo6_x64_VPN109.sys -LoadOrderGroup = NDIS - -[Neo.Reg] -HKR, Ndi, Service, 0, Neo.Service.Name -HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" -HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" - -[Neo.EventLog] -HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo6_x64_VPN109.sys" -HKR, , TypesSupported, 0x00010001, 7 - -[Strings] -CompanyName = "SoftEther Corporation" -DiskDescription = "VPN Client Device Driver Install Disk" -Neo.Service.Name = "Neo_VPN109" -Neo.Service.DispName = "VPN Client Device Driver - VPN109" -Neo.Service.Desc = "VPN Client Adapter - VPN109" -NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN109" -Neo.EventLog.Name = "Neo" -NetworkAddress = "MAC Address" -DefaultAddress = "000001000001" -MaxSpeed = "Indicate Speed (Mbps)" -KeepLink = "Keep Link" -On = "On" -Off = "Off" - - -; Auto Generated 20180205_163629.091 - +; VPN Client Device Driver for Windows 2000 and Greater +; +; Copyright (c) SoftEther Corporation. All Rights Reserved. +; http://www.softether.co.jp/ +; +; BUILD 9658 + +[Version] +Signature = "$Windows NT$" +Class = Net +ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} +Provider = %CompanyName% +DriverVer = 02/04/2018, 4.25.0.9658 +CatalogFile.NT = Neo6_x64_VPN109.cat + +[Manufacturer] +%CompanyName% = SoftEther, NTamd64 + +[SourceDisksNames] +1=%DiskDescription%, "", , + +[SourceDisksFiles] +Neo6_x64_VPN109.sys = 1 + +[DestinationDirs] +DefaultDestDir = 12 +Neo.CopyFiles.Sys = 12 + +[Neo.CopyFiles.Sys] +Neo6_x64_VPN109.sys, , , 2 + +[SoftEther.NTamd64] +%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN109 + +[NeoAdapter.Install] +Characteristics = 0x1 +AddReg = Neo.Reg, NeoAdapter.Ndi +CopyFiles = Neo.CopyFiles.Sys +*IfType = 53 +*MediaType = 0 +*PhysicalMediaType = 0 + +[NeoAdapter.Install.Services] +AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% + +[NeoAdapter.Ndi] +HKR, , NetworkAddress, 0, %DefaultAddress% +HKR, Ndi, DeviceID, , "NeoAdapter_VPN109" +HKR, , DevLoader, , ndis +HKR, , DeviceVxDs, , Neo6_x64_VPN109.sys +HKR, NDIS, LogDriverName, , "Neo_VPN109" +HKR, NDIS, MajorNdisVersion, 1, 5 +HKR, NDIS, MinorNdisVersion, 1, 0 +HKR, Ndi\Interfaces, DefUpper, , "ndis5" +HKR, Ndi\Interfaces, UpperRange, , "ndis5" +HKR, Ndi\Interfaces, LowerRange, , "ethernet" +HKR, Ndi\Interfaces, DefLower, , "ethernet" +HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" +HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% +HKR, Ndi\Params\NetworkAddress, type, 0, "edit" +HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" +HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" +HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% +HKR, Ndi\Params\NetworkAddress, optional, 0, "0" +HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% +HKR, Ndi\Params\MaxSpeed, type, 0, "int" +HKR, Ndi\Params\MaxSpeed, default, 0, "100" +HKR, Ndi\Params\MaxSpeed, min, 0, "0" +HKR, Ndi\Params\MaxSpeed, max, 0, "2000" +HKR, Ndi\Params\MaxSpeed, step, 0, "1" +HKR, Ndi\Params\MaxSpeed, Base, 0, "10" +HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% +HKR, Ndi\Params\KeepLink, type, 0, "enum" +HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% +HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% +HKR, Ndi\Params\KeepLink, default, 0, "0" + + +[Neo.Service] +DisplayName = %Neo.Service.DispName% +Description = %Neo.Service.Desc% +ServiceType = 1 +StartType = 3 +ErrorControl = 1 +ServiceBinary = %12%\Neo6_x64_VPN109.sys +LoadOrderGroup = NDIS + +[Neo.Reg] +HKR, Ndi, Service, 0, Neo.Service.Name +HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" +HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" + +[Neo.EventLog] +HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo6_x64_VPN109.sys" +HKR, , TypesSupported, 0x00010001, 7 + +[Strings] +CompanyName = "SoftEther Corporation" +DiskDescription = "VPN Client Device Driver Install Disk" +Neo.Service.Name = "Neo_VPN109" +Neo.Service.DispName = "VPN Client Device Driver - VPN109" +Neo.Service.Desc = "VPN Client Adapter - VPN109" +NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN109" +Neo.EventLog.Name = "Neo" +NetworkAddress = "MAC Address" +DefaultAddress = "000001000001" +MaxSpeed = "Indicate Speed (Mbps)" +KeepLink = "Keep Link" +On = "On" +Off = "Off" + + +; Auto Generated 20180205_163629.091 + diff --git a/src/bin/hamcore/DriverPackages/Neo6_Win10/x64/Neo6_x64_VPN11.inf b/src/bin/hamcore/DriverPackages/Neo6_Win10/x64/Neo6_x64_VPN11.inf index db95d2b9..127e3a18 100644 --- a/src/bin/hamcore/DriverPackages/Neo6_Win10/x64/Neo6_x64_VPN11.inf +++ b/src/bin/hamcore/DriverPackages/Neo6_Win10/x64/Neo6_x64_VPN11.inf @@ -1,114 +1,114 @@ -; VPN Client Device Driver for Windows 2000 and Greater -; -; Copyright (c) SoftEther Corporation. All Rights Reserved. -; http://www.softether.co.jp/ -; -; BUILD 9658 - -[Version] -Signature = "$Windows NT$" -Class = Net -ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} -Provider = %CompanyName% -DriverVer = 02/04/2018, 4.25.0.9658 -CatalogFile.NT = Neo6_x64_VPN11.cat - -[Manufacturer] -%CompanyName% = SoftEther, NTamd64 - -[SourceDisksNames] -1=%DiskDescription%, "", , - -[SourceDisksFiles] -Neo6_x64_VPN11.sys = 1 - -[DestinationDirs] -DefaultDestDir = 12 -Neo.CopyFiles.Sys = 12 - -[Neo.CopyFiles.Sys] -Neo6_x64_VPN11.sys, , , 2 - -[SoftEther.NTamd64] -%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN11 - -[NeoAdapter.Install] -Characteristics = 0x1 -AddReg = Neo.Reg, NeoAdapter.Ndi -CopyFiles = Neo.CopyFiles.Sys -*IfType = 53 -*MediaType = 0 -*PhysicalMediaType = 0 - -[NeoAdapter.Install.Services] -AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% - -[NeoAdapter.Ndi] -HKR, , NetworkAddress, 0, %DefaultAddress% -HKR, Ndi, DeviceID, , "NeoAdapter_VPN11" -HKR, , DevLoader, , ndis -HKR, , DeviceVxDs, , Neo6_x64_VPN11.sys -HKR, NDIS, LogDriverName, , "Neo_VPN11" -HKR, NDIS, MajorNdisVersion, 1, 5 -HKR, NDIS, MinorNdisVersion, 1, 0 -HKR, Ndi\Interfaces, DefUpper, , "ndis5" -HKR, Ndi\Interfaces, UpperRange, , "ndis5" -HKR, Ndi\Interfaces, LowerRange, , "ethernet" -HKR, Ndi\Interfaces, DefLower, , "ethernet" -HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" -HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% -HKR, Ndi\Params\NetworkAddress, type, 0, "edit" -HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" -HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" -HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% -HKR, Ndi\Params\NetworkAddress, optional, 0, "0" -HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% -HKR, Ndi\Params\MaxSpeed, type, 0, "int" -HKR, Ndi\Params\MaxSpeed, default, 0, "100" -HKR, Ndi\Params\MaxSpeed, min, 0, "0" -HKR, Ndi\Params\MaxSpeed, max, 0, "2000" -HKR, Ndi\Params\MaxSpeed, step, 0, "1" -HKR, Ndi\Params\MaxSpeed, Base, 0, "10" -HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% -HKR, Ndi\Params\KeepLink, type, 0, "enum" -HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% -HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% -HKR, Ndi\Params\KeepLink, default, 0, "0" - - -[Neo.Service] -DisplayName = %Neo.Service.DispName% -Description = %Neo.Service.Desc% -ServiceType = 1 -StartType = 3 -ErrorControl = 1 -ServiceBinary = %12%\Neo6_x64_VPN11.sys -LoadOrderGroup = NDIS - -[Neo.Reg] -HKR, Ndi, Service, 0, Neo.Service.Name -HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" -HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" - -[Neo.EventLog] -HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo6_x64_VPN11.sys" -HKR, , TypesSupported, 0x00010001, 7 - -[Strings] -CompanyName = "SoftEther Corporation" -DiskDescription = "VPN Client Device Driver Install Disk" -Neo.Service.Name = "Neo_VPN11" -Neo.Service.DispName = "VPN Client Device Driver - VPN11" -Neo.Service.Desc = "VPN Client Adapter - VPN11" -NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN11" -Neo.EventLog.Name = "Neo" -NetworkAddress = "MAC Address" -DefaultAddress = "000001000001" -MaxSpeed = "Indicate Speed (Mbps)" -KeepLink = "Keep Link" -On = "On" -Off = "Off" - - -; Auto Generated 20180205_163622.101 - +; VPN Client Device Driver for Windows 2000 and Greater +; +; Copyright (c) SoftEther Corporation. All Rights Reserved. +; http://www.softether.co.jp/ +; +; BUILD 9658 + +[Version] +Signature = "$Windows NT$" +Class = Net +ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} +Provider = %CompanyName% +DriverVer = 02/04/2018, 4.25.0.9658 +CatalogFile.NT = Neo6_x64_VPN11.cat + +[Manufacturer] +%CompanyName% = SoftEther, NTamd64 + +[SourceDisksNames] +1=%DiskDescription%, "", , + +[SourceDisksFiles] +Neo6_x64_VPN11.sys = 1 + +[DestinationDirs] +DefaultDestDir = 12 +Neo.CopyFiles.Sys = 12 + +[Neo.CopyFiles.Sys] +Neo6_x64_VPN11.sys, , , 2 + +[SoftEther.NTamd64] +%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN11 + +[NeoAdapter.Install] +Characteristics = 0x1 +AddReg = Neo.Reg, NeoAdapter.Ndi +CopyFiles = Neo.CopyFiles.Sys +*IfType = 53 +*MediaType = 0 +*PhysicalMediaType = 0 + +[NeoAdapter.Install.Services] +AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% + +[NeoAdapter.Ndi] +HKR, , NetworkAddress, 0, %DefaultAddress% +HKR, Ndi, DeviceID, , "NeoAdapter_VPN11" +HKR, , DevLoader, , ndis +HKR, , DeviceVxDs, , Neo6_x64_VPN11.sys +HKR, NDIS, LogDriverName, , "Neo_VPN11" +HKR, NDIS, MajorNdisVersion, 1, 5 +HKR, NDIS, MinorNdisVersion, 1, 0 +HKR, Ndi\Interfaces, DefUpper, , "ndis5" +HKR, Ndi\Interfaces, UpperRange, , "ndis5" +HKR, Ndi\Interfaces, LowerRange, , "ethernet" +HKR, Ndi\Interfaces, DefLower, , "ethernet" +HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" +HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% +HKR, Ndi\Params\NetworkAddress, type, 0, "edit" +HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" +HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" +HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% +HKR, Ndi\Params\NetworkAddress, optional, 0, "0" +HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% +HKR, Ndi\Params\MaxSpeed, type, 0, "int" +HKR, Ndi\Params\MaxSpeed, default, 0, "100" +HKR, Ndi\Params\MaxSpeed, min, 0, "0" +HKR, Ndi\Params\MaxSpeed, max, 0, "2000" +HKR, Ndi\Params\MaxSpeed, step, 0, "1" +HKR, Ndi\Params\MaxSpeed, Base, 0, "10" +HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% +HKR, Ndi\Params\KeepLink, type, 0, "enum" +HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% +HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% +HKR, Ndi\Params\KeepLink, default, 0, "0" + + +[Neo.Service] +DisplayName = %Neo.Service.DispName% +Description = %Neo.Service.Desc% +ServiceType = 1 +StartType = 3 +ErrorControl = 1 +ServiceBinary = %12%\Neo6_x64_VPN11.sys +LoadOrderGroup = NDIS + +[Neo.Reg] +HKR, Ndi, Service, 0, Neo.Service.Name +HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" +HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" + +[Neo.EventLog] +HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo6_x64_VPN11.sys" +HKR, , TypesSupported, 0x00010001, 7 + +[Strings] +CompanyName = "SoftEther Corporation" +DiskDescription = "VPN Client Device Driver Install Disk" +Neo.Service.Name = "Neo_VPN11" +Neo.Service.DispName = "VPN Client Device Driver - VPN11" +Neo.Service.Desc = "VPN Client Adapter - VPN11" +NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN11" +Neo.EventLog.Name = "Neo" +NetworkAddress = "MAC Address" +DefaultAddress = "000001000001" +MaxSpeed = "Indicate Speed (Mbps)" +KeepLink = "Keep Link" +On = "On" +Off = "Off" + + +; Auto Generated 20180205_163622.101 + diff --git a/src/bin/hamcore/DriverPackages/Neo6_Win10/x64/Neo6_x64_VPN110.inf b/src/bin/hamcore/DriverPackages/Neo6_Win10/x64/Neo6_x64_VPN110.inf index 689f52cf..972d4eeb 100644 --- a/src/bin/hamcore/DriverPackages/Neo6_Win10/x64/Neo6_x64_VPN110.inf +++ b/src/bin/hamcore/DriverPackages/Neo6_Win10/x64/Neo6_x64_VPN110.inf @@ -1,114 +1,114 @@ -; VPN Client Device Driver for Windows 2000 and Greater -; -; Copyright (c) SoftEther Corporation. All Rights Reserved. -; http://www.softether.co.jp/ -; -; BUILD 9658 - -[Version] -Signature = "$Windows NT$" -Class = Net -ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} -Provider = %CompanyName% -DriverVer = 02/04/2018, 4.25.0.9658 -CatalogFile.NT = Neo6_x64_VPN110.cat - -[Manufacturer] -%CompanyName% = SoftEther, NTamd64 - -[SourceDisksNames] -1=%DiskDescription%, "", , - -[SourceDisksFiles] -Neo6_x64_VPN110.sys = 1 - -[DestinationDirs] -DefaultDestDir = 12 -Neo.CopyFiles.Sys = 12 - -[Neo.CopyFiles.Sys] -Neo6_x64_VPN110.sys, , , 2 - -[SoftEther.NTamd64] -%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN110 - -[NeoAdapter.Install] -Characteristics = 0x1 -AddReg = Neo.Reg, NeoAdapter.Ndi -CopyFiles = Neo.CopyFiles.Sys -*IfType = 53 -*MediaType = 0 -*PhysicalMediaType = 0 - -[NeoAdapter.Install.Services] -AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% - -[NeoAdapter.Ndi] -HKR, , NetworkAddress, 0, %DefaultAddress% -HKR, Ndi, DeviceID, , "NeoAdapter_VPN110" -HKR, , DevLoader, , ndis -HKR, , DeviceVxDs, , Neo6_x64_VPN110.sys -HKR, NDIS, LogDriverName, , "Neo_VPN110" -HKR, NDIS, MajorNdisVersion, 1, 5 -HKR, NDIS, MinorNdisVersion, 1, 0 -HKR, Ndi\Interfaces, DefUpper, , "ndis5" -HKR, Ndi\Interfaces, UpperRange, , "ndis5" -HKR, Ndi\Interfaces, LowerRange, , "ethernet" -HKR, Ndi\Interfaces, DefLower, , "ethernet" -HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" -HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% -HKR, Ndi\Params\NetworkAddress, type, 0, "edit" -HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" -HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" -HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% -HKR, Ndi\Params\NetworkAddress, optional, 0, "0" -HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% -HKR, Ndi\Params\MaxSpeed, type, 0, "int" -HKR, Ndi\Params\MaxSpeed, default, 0, "100" -HKR, Ndi\Params\MaxSpeed, min, 0, "0" -HKR, Ndi\Params\MaxSpeed, max, 0, "2000" -HKR, Ndi\Params\MaxSpeed, step, 0, "1" -HKR, Ndi\Params\MaxSpeed, Base, 0, "10" -HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% -HKR, Ndi\Params\KeepLink, type, 0, "enum" -HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% -HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% -HKR, Ndi\Params\KeepLink, default, 0, "0" - - -[Neo.Service] -DisplayName = %Neo.Service.DispName% -Description = %Neo.Service.Desc% -ServiceType = 1 -StartType = 3 -ErrorControl = 1 -ServiceBinary = %12%\Neo6_x64_VPN110.sys -LoadOrderGroup = NDIS - -[Neo.Reg] -HKR, Ndi, Service, 0, Neo.Service.Name -HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" -HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" - -[Neo.EventLog] -HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo6_x64_VPN110.sys" -HKR, , TypesSupported, 0x00010001, 7 - -[Strings] -CompanyName = "SoftEther Corporation" -DiskDescription = "VPN Client Device Driver Install Disk" -Neo.Service.Name = "Neo_VPN110" -Neo.Service.DispName = "VPN Client Device Driver - VPN110" -Neo.Service.Desc = "VPN Client Adapter - VPN110" -NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN110" -Neo.EventLog.Name = "Neo" -NetworkAddress = "MAC Address" -DefaultAddress = "000001000001" -MaxSpeed = "Indicate Speed (Mbps)" -KeepLink = "Keep Link" -On = "On" -Off = "Off" - - -; Auto Generated 20180205_163629.164 - +; VPN Client Device Driver for Windows 2000 and Greater +; +; Copyright (c) SoftEther Corporation. All Rights Reserved. +; http://www.softether.co.jp/ +; +; BUILD 9658 + +[Version] +Signature = "$Windows NT$" +Class = Net +ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} +Provider = %CompanyName% +DriverVer = 02/04/2018, 4.25.0.9658 +CatalogFile.NT = Neo6_x64_VPN110.cat + +[Manufacturer] +%CompanyName% = SoftEther, NTamd64 + +[SourceDisksNames] +1=%DiskDescription%, "", , + +[SourceDisksFiles] +Neo6_x64_VPN110.sys = 1 + +[DestinationDirs] +DefaultDestDir = 12 +Neo.CopyFiles.Sys = 12 + +[Neo.CopyFiles.Sys] +Neo6_x64_VPN110.sys, , , 2 + +[SoftEther.NTamd64] +%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN110 + +[NeoAdapter.Install] +Characteristics = 0x1 +AddReg = Neo.Reg, NeoAdapter.Ndi +CopyFiles = Neo.CopyFiles.Sys +*IfType = 53 +*MediaType = 0 +*PhysicalMediaType = 0 + +[NeoAdapter.Install.Services] +AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% + +[NeoAdapter.Ndi] +HKR, , NetworkAddress, 0, %DefaultAddress% +HKR, Ndi, DeviceID, , "NeoAdapter_VPN110" +HKR, , DevLoader, , ndis +HKR, , DeviceVxDs, , Neo6_x64_VPN110.sys +HKR, NDIS, LogDriverName, , "Neo_VPN110" +HKR, NDIS, MajorNdisVersion, 1, 5 +HKR, NDIS, MinorNdisVersion, 1, 0 +HKR, Ndi\Interfaces, DefUpper, , "ndis5" +HKR, Ndi\Interfaces, UpperRange, , "ndis5" +HKR, Ndi\Interfaces, LowerRange, , "ethernet" +HKR, Ndi\Interfaces, DefLower, , "ethernet" +HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" +HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% +HKR, Ndi\Params\NetworkAddress, type, 0, "edit" +HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" +HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" +HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% +HKR, Ndi\Params\NetworkAddress, optional, 0, "0" +HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% +HKR, Ndi\Params\MaxSpeed, type, 0, "int" +HKR, Ndi\Params\MaxSpeed, default, 0, "100" +HKR, Ndi\Params\MaxSpeed, min, 0, "0" +HKR, Ndi\Params\MaxSpeed, max, 0, "2000" +HKR, Ndi\Params\MaxSpeed, step, 0, "1" +HKR, Ndi\Params\MaxSpeed, Base, 0, "10" +HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% +HKR, Ndi\Params\KeepLink, type, 0, "enum" +HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% +HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% +HKR, Ndi\Params\KeepLink, default, 0, "0" + + +[Neo.Service] +DisplayName = %Neo.Service.DispName% +Description = %Neo.Service.Desc% +ServiceType = 1 +StartType = 3 +ErrorControl = 1 +ServiceBinary = %12%\Neo6_x64_VPN110.sys +LoadOrderGroup = NDIS + +[Neo.Reg] +HKR, Ndi, Service, 0, Neo.Service.Name +HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" +HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" + +[Neo.EventLog] +HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo6_x64_VPN110.sys" +HKR, , TypesSupported, 0x00010001, 7 + +[Strings] +CompanyName = "SoftEther Corporation" +DiskDescription = "VPN Client Device Driver Install Disk" +Neo.Service.Name = "Neo_VPN110" +Neo.Service.DispName = "VPN Client Device Driver - VPN110" +Neo.Service.Desc = "VPN Client Adapter - VPN110" +NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN110" +Neo.EventLog.Name = "Neo" +NetworkAddress = "MAC Address" +DefaultAddress = "000001000001" +MaxSpeed = "Indicate Speed (Mbps)" +KeepLink = "Keep Link" +On = "On" +Off = "Off" + + +; Auto Generated 20180205_163629.164 + diff --git a/src/bin/hamcore/DriverPackages/Neo6_Win10/x64/Neo6_x64_VPN111.inf b/src/bin/hamcore/DriverPackages/Neo6_Win10/x64/Neo6_x64_VPN111.inf index e0ee689e..ea3e05d7 100644 --- a/src/bin/hamcore/DriverPackages/Neo6_Win10/x64/Neo6_x64_VPN111.inf +++ b/src/bin/hamcore/DriverPackages/Neo6_Win10/x64/Neo6_x64_VPN111.inf @@ -1,114 +1,114 @@ -; VPN Client Device Driver for Windows 2000 and Greater -; -; Copyright (c) SoftEther Corporation. All Rights Reserved. -; http://www.softether.co.jp/ -; -; BUILD 9658 - -[Version] -Signature = "$Windows NT$" -Class = Net -ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} -Provider = %CompanyName% -DriverVer = 02/04/2018, 4.25.0.9658 -CatalogFile.NT = Neo6_x64_VPN111.cat - -[Manufacturer] -%CompanyName% = SoftEther, NTamd64 - -[SourceDisksNames] -1=%DiskDescription%, "", , - -[SourceDisksFiles] -Neo6_x64_VPN111.sys = 1 - -[DestinationDirs] -DefaultDestDir = 12 -Neo.CopyFiles.Sys = 12 - -[Neo.CopyFiles.Sys] -Neo6_x64_VPN111.sys, , , 2 - -[SoftEther.NTamd64] -%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN111 - -[NeoAdapter.Install] -Characteristics = 0x1 -AddReg = Neo.Reg, NeoAdapter.Ndi -CopyFiles = Neo.CopyFiles.Sys -*IfType = 53 -*MediaType = 0 -*PhysicalMediaType = 0 - -[NeoAdapter.Install.Services] -AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% - -[NeoAdapter.Ndi] -HKR, , NetworkAddress, 0, %DefaultAddress% -HKR, Ndi, DeviceID, , "NeoAdapter_VPN111" -HKR, , DevLoader, , ndis -HKR, , DeviceVxDs, , Neo6_x64_VPN111.sys -HKR, NDIS, LogDriverName, , "Neo_VPN111" -HKR, NDIS, MajorNdisVersion, 1, 5 -HKR, NDIS, MinorNdisVersion, 1, 0 -HKR, Ndi\Interfaces, DefUpper, , "ndis5" -HKR, Ndi\Interfaces, UpperRange, , "ndis5" -HKR, Ndi\Interfaces, LowerRange, , "ethernet" -HKR, Ndi\Interfaces, DefLower, , "ethernet" -HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" -HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% -HKR, Ndi\Params\NetworkAddress, type, 0, "edit" -HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" -HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" -HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% -HKR, Ndi\Params\NetworkAddress, optional, 0, "0" -HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% -HKR, Ndi\Params\MaxSpeed, type, 0, "int" -HKR, Ndi\Params\MaxSpeed, default, 0, "100" -HKR, Ndi\Params\MaxSpeed, min, 0, "0" -HKR, Ndi\Params\MaxSpeed, max, 0, "2000" -HKR, Ndi\Params\MaxSpeed, step, 0, "1" -HKR, Ndi\Params\MaxSpeed, Base, 0, "10" -HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% -HKR, Ndi\Params\KeepLink, type, 0, "enum" -HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% -HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% -HKR, Ndi\Params\KeepLink, default, 0, "0" - - -[Neo.Service] -DisplayName = %Neo.Service.DispName% -Description = %Neo.Service.Desc% -ServiceType = 1 -StartType = 3 -ErrorControl = 1 -ServiceBinary = %12%\Neo6_x64_VPN111.sys -LoadOrderGroup = NDIS - -[Neo.Reg] -HKR, Ndi, Service, 0, Neo.Service.Name -HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" -HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" - -[Neo.EventLog] -HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo6_x64_VPN111.sys" -HKR, , TypesSupported, 0x00010001, 7 - -[Strings] -CompanyName = "SoftEther Corporation" -DiskDescription = "VPN Client Device Driver Install Disk" -Neo.Service.Name = "Neo_VPN111" -Neo.Service.DispName = "VPN Client Device Driver - VPN111" -Neo.Service.Desc = "VPN Client Adapter - VPN111" -NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN111" -Neo.EventLog.Name = "Neo" -NetworkAddress = "MAC Address" -DefaultAddress = "000001000001" -MaxSpeed = "Indicate Speed (Mbps)" -KeepLink = "Keep Link" -On = "On" -Off = "Off" - - -; Auto Generated 20180205_163629.237 - +; VPN Client Device Driver for Windows 2000 and Greater +; +; Copyright (c) SoftEther Corporation. All Rights Reserved. +; http://www.softether.co.jp/ +; +; BUILD 9658 + +[Version] +Signature = "$Windows NT$" +Class = Net +ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} +Provider = %CompanyName% +DriverVer = 02/04/2018, 4.25.0.9658 +CatalogFile.NT = Neo6_x64_VPN111.cat + +[Manufacturer] +%CompanyName% = SoftEther, NTamd64 + +[SourceDisksNames] +1=%DiskDescription%, "", , + +[SourceDisksFiles] +Neo6_x64_VPN111.sys = 1 + +[DestinationDirs] +DefaultDestDir = 12 +Neo.CopyFiles.Sys = 12 + +[Neo.CopyFiles.Sys] +Neo6_x64_VPN111.sys, , , 2 + +[SoftEther.NTamd64] +%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN111 + +[NeoAdapter.Install] +Characteristics = 0x1 +AddReg = Neo.Reg, NeoAdapter.Ndi +CopyFiles = Neo.CopyFiles.Sys +*IfType = 53 +*MediaType = 0 +*PhysicalMediaType = 0 + +[NeoAdapter.Install.Services] +AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% + +[NeoAdapter.Ndi] +HKR, , NetworkAddress, 0, %DefaultAddress% +HKR, Ndi, DeviceID, , "NeoAdapter_VPN111" +HKR, , DevLoader, , ndis +HKR, , DeviceVxDs, , Neo6_x64_VPN111.sys +HKR, NDIS, LogDriverName, , "Neo_VPN111" +HKR, NDIS, MajorNdisVersion, 1, 5 +HKR, NDIS, MinorNdisVersion, 1, 0 +HKR, Ndi\Interfaces, DefUpper, , "ndis5" +HKR, Ndi\Interfaces, UpperRange, , "ndis5" +HKR, Ndi\Interfaces, LowerRange, , "ethernet" +HKR, Ndi\Interfaces, DefLower, , "ethernet" +HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" +HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% +HKR, Ndi\Params\NetworkAddress, type, 0, "edit" +HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" +HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" +HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% +HKR, Ndi\Params\NetworkAddress, optional, 0, "0" +HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% +HKR, Ndi\Params\MaxSpeed, type, 0, "int" +HKR, Ndi\Params\MaxSpeed, default, 0, "100" +HKR, Ndi\Params\MaxSpeed, min, 0, "0" +HKR, Ndi\Params\MaxSpeed, max, 0, "2000" +HKR, Ndi\Params\MaxSpeed, step, 0, "1" +HKR, Ndi\Params\MaxSpeed, Base, 0, "10" +HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% +HKR, Ndi\Params\KeepLink, type, 0, "enum" +HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% +HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% +HKR, Ndi\Params\KeepLink, default, 0, "0" + + +[Neo.Service] +DisplayName = %Neo.Service.DispName% +Description = %Neo.Service.Desc% +ServiceType = 1 +StartType = 3 +ErrorControl = 1 +ServiceBinary = %12%\Neo6_x64_VPN111.sys +LoadOrderGroup = NDIS + +[Neo.Reg] +HKR, Ndi, Service, 0, Neo.Service.Name +HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" +HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" + +[Neo.EventLog] +HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo6_x64_VPN111.sys" +HKR, , TypesSupported, 0x00010001, 7 + +[Strings] +CompanyName = "SoftEther Corporation" +DiskDescription = "VPN Client Device Driver Install Disk" +Neo.Service.Name = "Neo_VPN111" +Neo.Service.DispName = "VPN Client Device Driver - VPN111" +Neo.Service.Desc = "VPN Client Adapter - VPN111" +NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN111" +Neo.EventLog.Name = "Neo" +NetworkAddress = "MAC Address" +DefaultAddress = "000001000001" +MaxSpeed = "Indicate Speed (Mbps)" +KeepLink = "Keep Link" +On = "On" +Off = "Off" + + +; Auto Generated 20180205_163629.237 + diff --git a/src/bin/hamcore/DriverPackages/Neo6_Win10/x64/Neo6_x64_VPN112.inf b/src/bin/hamcore/DriverPackages/Neo6_Win10/x64/Neo6_x64_VPN112.inf index 44519a3b..04676657 100644 --- a/src/bin/hamcore/DriverPackages/Neo6_Win10/x64/Neo6_x64_VPN112.inf +++ b/src/bin/hamcore/DriverPackages/Neo6_Win10/x64/Neo6_x64_VPN112.inf @@ -1,114 +1,114 @@ -; VPN Client Device Driver for Windows 2000 and Greater -; -; Copyright (c) SoftEther Corporation. All Rights Reserved. -; http://www.softether.co.jp/ -; -; BUILD 9658 - -[Version] -Signature = "$Windows NT$" -Class = Net -ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} -Provider = %CompanyName% -DriverVer = 02/04/2018, 4.25.0.9658 -CatalogFile.NT = Neo6_x64_VPN112.cat - -[Manufacturer] -%CompanyName% = SoftEther, NTamd64 - -[SourceDisksNames] -1=%DiskDescription%, "", , - -[SourceDisksFiles] -Neo6_x64_VPN112.sys = 1 - -[DestinationDirs] -DefaultDestDir = 12 -Neo.CopyFiles.Sys = 12 - -[Neo.CopyFiles.Sys] -Neo6_x64_VPN112.sys, , , 2 - -[SoftEther.NTamd64] -%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN112 - -[NeoAdapter.Install] -Characteristics = 0x1 -AddReg = Neo.Reg, NeoAdapter.Ndi -CopyFiles = Neo.CopyFiles.Sys -*IfType = 53 -*MediaType = 0 -*PhysicalMediaType = 0 - -[NeoAdapter.Install.Services] -AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% - -[NeoAdapter.Ndi] -HKR, , NetworkAddress, 0, %DefaultAddress% -HKR, Ndi, DeviceID, , "NeoAdapter_VPN112" -HKR, , DevLoader, , ndis -HKR, , DeviceVxDs, , Neo6_x64_VPN112.sys -HKR, NDIS, LogDriverName, , "Neo_VPN112" -HKR, NDIS, MajorNdisVersion, 1, 5 -HKR, NDIS, MinorNdisVersion, 1, 0 -HKR, Ndi\Interfaces, DefUpper, , "ndis5" -HKR, Ndi\Interfaces, UpperRange, , "ndis5" -HKR, Ndi\Interfaces, LowerRange, , "ethernet" -HKR, Ndi\Interfaces, DefLower, , "ethernet" -HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" -HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% -HKR, Ndi\Params\NetworkAddress, type, 0, "edit" -HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" -HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" -HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% -HKR, Ndi\Params\NetworkAddress, optional, 0, "0" -HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% -HKR, Ndi\Params\MaxSpeed, type, 0, "int" -HKR, Ndi\Params\MaxSpeed, default, 0, "100" -HKR, Ndi\Params\MaxSpeed, min, 0, "0" -HKR, Ndi\Params\MaxSpeed, max, 0, "2000" -HKR, Ndi\Params\MaxSpeed, step, 0, "1" -HKR, Ndi\Params\MaxSpeed, Base, 0, "10" -HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% -HKR, Ndi\Params\KeepLink, type, 0, "enum" -HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% -HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% -HKR, Ndi\Params\KeepLink, default, 0, "0" - - -[Neo.Service] -DisplayName = %Neo.Service.DispName% -Description = %Neo.Service.Desc% -ServiceType = 1 -StartType = 3 -ErrorControl = 1 -ServiceBinary = %12%\Neo6_x64_VPN112.sys -LoadOrderGroup = NDIS - -[Neo.Reg] -HKR, Ndi, Service, 0, Neo.Service.Name -HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" -HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" - -[Neo.EventLog] -HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo6_x64_VPN112.sys" -HKR, , TypesSupported, 0x00010001, 7 - -[Strings] -CompanyName = "SoftEther Corporation" -DiskDescription = "VPN Client Device Driver Install Disk" -Neo.Service.Name = "Neo_VPN112" -Neo.Service.DispName = "VPN Client Device Driver - VPN112" -Neo.Service.Desc = "VPN Client Adapter - VPN112" -NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN112" -Neo.EventLog.Name = "Neo" -NetworkAddress = "MAC Address" -DefaultAddress = "000001000001" -MaxSpeed = "Indicate Speed (Mbps)" -KeepLink = "Keep Link" -On = "On" -Off = "Off" - - -; Auto Generated 20180205_163629.312 - +; VPN Client Device Driver for Windows 2000 and Greater +; +; Copyright (c) SoftEther Corporation. All Rights Reserved. +; http://www.softether.co.jp/ +; +; BUILD 9658 + +[Version] +Signature = "$Windows NT$" +Class = Net +ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} +Provider = %CompanyName% +DriverVer = 02/04/2018, 4.25.0.9658 +CatalogFile.NT = Neo6_x64_VPN112.cat + +[Manufacturer] +%CompanyName% = SoftEther, NTamd64 + +[SourceDisksNames] +1=%DiskDescription%, "", , + +[SourceDisksFiles] +Neo6_x64_VPN112.sys = 1 + +[DestinationDirs] +DefaultDestDir = 12 +Neo.CopyFiles.Sys = 12 + +[Neo.CopyFiles.Sys] +Neo6_x64_VPN112.sys, , , 2 + +[SoftEther.NTamd64] +%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN112 + +[NeoAdapter.Install] +Characteristics = 0x1 +AddReg = Neo.Reg, NeoAdapter.Ndi +CopyFiles = Neo.CopyFiles.Sys +*IfType = 53 +*MediaType = 0 +*PhysicalMediaType = 0 + +[NeoAdapter.Install.Services] +AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% + +[NeoAdapter.Ndi] +HKR, , NetworkAddress, 0, %DefaultAddress% +HKR, Ndi, DeviceID, , "NeoAdapter_VPN112" +HKR, , DevLoader, , ndis +HKR, , DeviceVxDs, , Neo6_x64_VPN112.sys +HKR, NDIS, LogDriverName, , "Neo_VPN112" +HKR, NDIS, MajorNdisVersion, 1, 5 +HKR, NDIS, MinorNdisVersion, 1, 0 +HKR, Ndi\Interfaces, DefUpper, , "ndis5" +HKR, Ndi\Interfaces, UpperRange, , "ndis5" +HKR, Ndi\Interfaces, LowerRange, , "ethernet" +HKR, Ndi\Interfaces, DefLower, , "ethernet" +HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" +HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% +HKR, Ndi\Params\NetworkAddress, type, 0, "edit" +HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" +HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" +HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% +HKR, Ndi\Params\NetworkAddress, optional, 0, "0" +HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% +HKR, Ndi\Params\MaxSpeed, type, 0, "int" +HKR, Ndi\Params\MaxSpeed, default, 0, "100" +HKR, Ndi\Params\MaxSpeed, min, 0, "0" +HKR, Ndi\Params\MaxSpeed, max, 0, "2000" +HKR, Ndi\Params\MaxSpeed, step, 0, "1" +HKR, Ndi\Params\MaxSpeed, Base, 0, "10" +HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% +HKR, Ndi\Params\KeepLink, type, 0, "enum" +HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% +HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% +HKR, Ndi\Params\KeepLink, default, 0, "0" + + +[Neo.Service] +DisplayName = %Neo.Service.DispName% +Description = %Neo.Service.Desc% +ServiceType = 1 +StartType = 3 +ErrorControl = 1 +ServiceBinary = %12%\Neo6_x64_VPN112.sys +LoadOrderGroup = NDIS + +[Neo.Reg] +HKR, Ndi, Service, 0, Neo.Service.Name +HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" +HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" + +[Neo.EventLog] +HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo6_x64_VPN112.sys" +HKR, , TypesSupported, 0x00010001, 7 + +[Strings] +CompanyName = "SoftEther Corporation" +DiskDescription = "VPN Client Device Driver Install Disk" +Neo.Service.Name = "Neo_VPN112" +Neo.Service.DispName = "VPN Client Device Driver - VPN112" +Neo.Service.Desc = "VPN Client Adapter - VPN112" +NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN112" +Neo.EventLog.Name = "Neo" +NetworkAddress = "MAC Address" +DefaultAddress = "000001000001" +MaxSpeed = "Indicate Speed (Mbps)" +KeepLink = "Keep Link" +On = "On" +Off = "Off" + + +; Auto Generated 20180205_163629.312 + diff --git a/src/bin/hamcore/DriverPackages/Neo6_Win10/x64/Neo6_x64_VPN113.inf b/src/bin/hamcore/DriverPackages/Neo6_Win10/x64/Neo6_x64_VPN113.inf index 89d0f726..f56a5940 100644 --- a/src/bin/hamcore/DriverPackages/Neo6_Win10/x64/Neo6_x64_VPN113.inf +++ b/src/bin/hamcore/DriverPackages/Neo6_Win10/x64/Neo6_x64_VPN113.inf @@ -1,114 +1,114 @@ -; VPN Client Device Driver for Windows 2000 and Greater -; -; Copyright (c) SoftEther Corporation. All Rights Reserved. -; http://www.softether.co.jp/ -; -; BUILD 9658 - -[Version] -Signature = "$Windows NT$" -Class = Net -ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} -Provider = %CompanyName% -DriverVer = 02/04/2018, 4.25.0.9658 -CatalogFile.NT = Neo6_x64_VPN113.cat - -[Manufacturer] -%CompanyName% = SoftEther, NTamd64 - -[SourceDisksNames] -1=%DiskDescription%, "", , - -[SourceDisksFiles] -Neo6_x64_VPN113.sys = 1 - -[DestinationDirs] -DefaultDestDir = 12 -Neo.CopyFiles.Sys = 12 - -[Neo.CopyFiles.Sys] -Neo6_x64_VPN113.sys, , , 2 - -[SoftEther.NTamd64] -%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN113 - -[NeoAdapter.Install] -Characteristics = 0x1 -AddReg = Neo.Reg, NeoAdapter.Ndi -CopyFiles = Neo.CopyFiles.Sys -*IfType = 53 -*MediaType = 0 -*PhysicalMediaType = 0 - -[NeoAdapter.Install.Services] -AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% - -[NeoAdapter.Ndi] -HKR, , NetworkAddress, 0, %DefaultAddress% -HKR, Ndi, DeviceID, , "NeoAdapter_VPN113" -HKR, , DevLoader, , ndis -HKR, , DeviceVxDs, , Neo6_x64_VPN113.sys -HKR, NDIS, LogDriverName, , "Neo_VPN113" -HKR, NDIS, MajorNdisVersion, 1, 5 -HKR, NDIS, MinorNdisVersion, 1, 0 -HKR, Ndi\Interfaces, DefUpper, , "ndis5" -HKR, Ndi\Interfaces, UpperRange, , "ndis5" -HKR, Ndi\Interfaces, LowerRange, , "ethernet" -HKR, Ndi\Interfaces, DefLower, , "ethernet" -HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" -HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% -HKR, Ndi\Params\NetworkAddress, type, 0, "edit" -HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" -HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" -HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% -HKR, Ndi\Params\NetworkAddress, optional, 0, "0" -HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% -HKR, Ndi\Params\MaxSpeed, type, 0, "int" -HKR, Ndi\Params\MaxSpeed, default, 0, "100" -HKR, Ndi\Params\MaxSpeed, min, 0, "0" -HKR, Ndi\Params\MaxSpeed, max, 0, "2000" -HKR, Ndi\Params\MaxSpeed, step, 0, "1" -HKR, Ndi\Params\MaxSpeed, Base, 0, "10" -HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% -HKR, Ndi\Params\KeepLink, type, 0, "enum" -HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% -HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% -HKR, Ndi\Params\KeepLink, default, 0, "0" - - -[Neo.Service] -DisplayName = %Neo.Service.DispName% -Description = %Neo.Service.Desc% -ServiceType = 1 -StartType = 3 -ErrorControl = 1 -ServiceBinary = %12%\Neo6_x64_VPN113.sys -LoadOrderGroup = NDIS - -[Neo.Reg] -HKR, Ndi, Service, 0, Neo.Service.Name -HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" -HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" - -[Neo.EventLog] -HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo6_x64_VPN113.sys" -HKR, , TypesSupported, 0x00010001, 7 - -[Strings] -CompanyName = "SoftEther Corporation" -DiskDescription = "VPN Client Device Driver Install Disk" -Neo.Service.Name = "Neo_VPN113" -Neo.Service.DispName = "VPN Client Device Driver - VPN113" -Neo.Service.Desc = "VPN Client Adapter - VPN113" -NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN113" -Neo.EventLog.Name = "Neo" -NetworkAddress = "MAC Address" -DefaultAddress = "000001000001" -MaxSpeed = "Indicate Speed (Mbps)" -KeepLink = "Keep Link" -On = "On" -Off = "Off" - - -; Auto Generated 20180205_163629.382 - +; VPN Client Device Driver for Windows 2000 and Greater +; +; Copyright (c) SoftEther Corporation. All Rights Reserved. +; http://www.softether.co.jp/ +; +; BUILD 9658 + +[Version] +Signature = "$Windows NT$" +Class = Net +ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} +Provider = %CompanyName% +DriverVer = 02/04/2018, 4.25.0.9658 +CatalogFile.NT = Neo6_x64_VPN113.cat + +[Manufacturer] +%CompanyName% = SoftEther, NTamd64 + +[SourceDisksNames] +1=%DiskDescription%, "", , + +[SourceDisksFiles] +Neo6_x64_VPN113.sys = 1 + +[DestinationDirs] +DefaultDestDir = 12 +Neo.CopyFiles.Sys = 12 + +[Neo.CopyFiles.Sys] +Neo6_x64_VPN113.sys, , , 2 + +[SoftEther.NTamd64] +%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN113 + +[NeoAdapter.Install] +Characteristics = 0x1 +AddReg = Neo.Reg, NeoAdapter.Ndi +CopyFiles = Neo.CopyFiles.Sys +*IfType = 53 +*MediaType = 0 +*PhysicalMediaType = 0 + +[NeoAdapter.Install.Services] +AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% + +[NeoAdapter.Ndi] +HKR, , NetworkAddress, 0, %DefaultAddress% +HKR, Ndi, DeviceID, , "NeoAdapter_VPN113" +HKR, , DevLoader, , ndis +HKR, , DeviceVxDs, , Neo6_x64_VPN113.sys +HKR, NDIS, LogDriverName, , "Neo_VPN113" +HKR, NDIS, MajorNdisVersion, 1, 5 +HKR, NDIS, MinorNdisVersion, 1, 0 +HKR, Ndi\Interfaces, DefUpper, , "ndis5" +HKR, Ndi\Interfaces, UpperRange, , "ndis5" +HKR, Ndi\Interfaces, LowerRange, , "ethernet" +HKR, Ndi\Interfaces, DefLower, , "ethernet" +HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" +HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% +HKR, Ndi\Params\NetworkAddress, type, 0, "edit" +HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" +HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" +HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% +HKR, Ndi\Params\NetworkAddress, optional, 0, "0" +HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% +HKR, Ndi\Params\MaxSpeed, type, 0, "int" +HKR, Ndi\Params\MaxSpeed, default, 0, "100" +HKR, Ndi\Params\MaxSpeed, min, 0, "0" +HKR, Ndi\Params\MaxSpeed, max, 0, "2000" +HKR, Ndi\Params\MaxSpeed, step, 0, "1" +HKR, Ndi\Params\MaxSpeed, Base, 0, "10" +HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% +HKR, Ndi\Params\KeepLink, type, 0, "enum" +HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% +HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% +HKR, Ndi\Params\KeepLink, default, 0, "0" + + +[Neo.Service] +DisplayName = %Neo.Service.DispName% +Description = %Neo.Service.Desc% +ServiceType = 1 +StartType = 3 +ErrorControl = 1 +ServiceBinary = %12%\Neo6_x64_VPN113.sys +LoadOrderGroup = NDIS + +[Neo.Reg] +HKR, Ndi, Service, 0, Neo.Service.Name +HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" +HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" + +[Neo.EventLog] +HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo6_x64_VPN113.sys" +HKR, , TypesSupported, 0x00010001, 7 + +[Strings] +CompanyName = "SoftEther Corporation" +DiskDescription = "VPN Client Device Driver Install Disk" +Neo.Service.Name = "Neo_VPN113" +Neo.Service.DispName = "VPN Client Device Driver - VPN113" +Neo.Service.Desc = "VPN Client Adapter - VPN113" +NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN113" +Neo.EventLog.Name = "Neo" +NetworkAddress = "MAC Address" +DefaultAddress = "000001000001" +MaxSpeed = "Indicate Speed (Mbps)" +KeepLink = "Keep Link" +On = "On" +Off = "Off" + + +; Auto Generated 20180205_163629.382 + diff --git a/src/bin/hamcore/DriverPackages/Neo6_Win10/x64/Neo6_x64_VPN114.inf b/src/bin/hamcore/DriverPackages/Neo6_Win10/x64/Neo6_x64_VPN114.inf index ed205a7d..65df8e9e 100644 --- a/src/bin/hamcore/DriverPackages/Neo6_Win10/x64/Neo6_x64_VPN114.inf +++ b/src/bin/hamcore/DriverPackages/Neo6_Win10/x64/Neo6_x64_VPN114.inf @@ -1,114 +1,114 @@ -; VPN Client Device Driver for Windows 2000 and Greater -; -; Copyright (c) SoftEther Corporation. All Rights Reserved. -; http://www.softether.co.jp/ -; -; BUILD 9658 - -[Version] -Signature = "$Windows NT$" -Class = Net -ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} -Provider = %CompanyName% -DriverVer = 02/04/2018, 4.25.0.9658 -CatalogFile.NT = Neo6_x64_VPN114.cat - -[Manufacturer] -%CompanyName% = SoftEther, NTamd64 - -[SourceDisksNames] -1=%DiskDescription%, "", , - -[SourceDisksFiles] -Neo6_x64_VPN114.sys = 1 - -[DestinationDirs] -DefaultDestDir = 12 -Neo.CopyFiles.Sys = 12 - -[Neo.CopyFiles.Sys] -Neo6_x64_VPN114.sys, , , 2 - -[SoftEther.NTamd64] -%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN114 - -[NeoAdapter.Install] -Characteristics = 0x1 -AddReg = Neo.Reg, NeoAdapter.Ndi -CopyFiles = Neo.CopyFiles.Sys -*IfType = 53 -*MediaType = 0 -*PhysicalMediaType = 0 - -[NeoAdapter.Install.Services] -AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% - -[NeoAdapter.Ndi] -HKR, , NetworkAddress, 0, %DefaultAddress% -HKR, Ndi, DeviceID, , "NeoAdapter_VPN114" -HKR, , DevLoader, , ndis -HKR, , DeviceVxDs, , Neo6_x64_VPN114.sys -HKR, NDIS, LogDriverName, , "Neo_VPN114" -HKR, NDIS, MajorNdisVersion, 1, 5 -HKR, NDIS, MinorNdisVersion, 1, 0 -HKR, Ndi\Interfaces, DefUpper, , "ndis5" -HKR, Ndi\Interfaces, UpperRange, , "ndis5" -HKR, Ndi\Interfaces, LowerRange, , "ethernet" -HKR, Ndi\Interfaces, DefLower, , "ethernet" -HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" -HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% -HKR, Ndi\Params\NetworkAddress, type, 0, "edit" -HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" -HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" -HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% -HKR, Ndi\Params\NetworkAddress, optional, 0, "0" -HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% -HKR, Ndi\Params\MaxSpeed, type, 0, "int" -HKR, Ndi\Params\MaxSpeed, default, 0, "100" -HKR, Ndi\Params\MaxSpeed, min, 0, "0" -HKR, Ndi\Params\MaxSpeed, max, 0, "2000" -HKR, Ndi\Params\MaxSpeed, step, 0, "1" -HKR, Ndi\Params\MaxSpeed, Base, 0, "10" -HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% -HKR, Ndi\Params\KeepLink, type, 0, "enum" -HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% -HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% -HKR, Ndi\Params\KeepLink, default, 0, "0" - - -[Neo.Service] -DisplayName = %Neo.Service.DispName% -Description = %Neo.Service.Desc% -ServiceType = 1 -StartType = 3 -ErrorControl = 1 -ServiceBinary = %12%\Neo6_x64_VPN114.sys -LoadOrderGroup = NDIS - -[Neo.Reg] -HKR, Ndi, Service, 0, Neo.Service.Name -HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" -HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" - -[Neo.EventLog] -HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo6_x64_VPN114.sys" -HKR, , TypesSupported, 0x00010001, 7 - -[Strings] -CompanyName = "SoftEther Corporation" -DiskDescription = "VPN Client Device Driver Install Disk" -Neo.Service.Name = "Neo_VPN114" -Neo.Service.DispName = "VPN Client Device Driver - VPN114" -Neo.Service.Desc = "VPN Client Adapter - VPN114" -NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN114" -Neo.EventLog.Name = "Neo" -NetworkAddress = "MAC Address" -DefaultAddress = "000001000001" -MaxSpeed = "Indicate Speed (Mbps)" -KeepLink = "Keep Link" -On = "On" -Off = "Off" - - -; Auto Generated 20180205_163629.453 - +; VPN Client Device Driver for Windows 2000 and Greater +; +; Copyright (c) SoftEther Corporation. All Rights Reserved. +; http://www.softether.co.jp/ +; +; BUILD 9658 + +[Version] +Signature = "$Windows NT$" +Class = Net +ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} +Provider = %CompanyName% +DriverVer = 02/04/2018, 4.25.0.9658 +CatalogFile.NT = Neo6_x64_VPN114.cat + +[Manufacturer] +%CompanyName% = SoftEther, NTamd64 + +[SourceDisksNames] +1=%DiskDescription%, "", , + +[SourceDisksFiles] +Neo6_x64_VPN114.sys = 1 + +[DestinationDirs] +DefaultDestDir = 12 +Neo.CopyFiles.Sys = 12 + +[Neo.CopyFiles.Sys] +Neo6_x64_VPN114.sys, , , 2 + +[SoftEther.NTamd64] +%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN114 + +[NeoAdapter.Install] +Characteristics = 0x1 +AddReg = Neo.Reg, NeoAdapter.Ndi +CopyFiles = Neo.CopyFiles.Sys +*IfType = 53 +*MediaType = 0 +*PhysicalMediaType = 0 + +[NeoAdapter.Install.Services] +AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% + +[NeoAdapter.Ndi] +HKR, , NetworkAddress, 0, %DefaultAddress% +HKR, Ndi, DeviceID, , "NeoAdapter_VPN114" +HKR, , DevLoader, , ndis +HKR, , DeviceVxDs, , Neo6_x64_VPN114.sys +HKR, NDIS, LogDriverName, , "Neo_VPN114" +HKR, NDIS, MajorNdisVersion, 1, 5 +HKR, NDIS, MinorNdisVersion, 1, 0 +HKR, Ndi\Interfaces, DefUpper, , "ndis5" +HKR, Ndi\Interfaces, UpperRange, , "ndis5" +HKR, Ndi\Interfaces, LowerRange, , "ethernet" +HKR, Ndi\Interfaces, DefLower, , "ethernet" +HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" +HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% +HKR, Ndi\Params\NetworkAddress, type, 0, "edit" +HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" +HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" +HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% +HKR, Ndi\Params\NetworkAddress, optional, 0, "0" +HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% +HKR, Ndi\Params\MaxSpeed, type, 0, "int" +HKR, Ndi\Params\MaxSpeed, default, 0, "100" +HKR, Ndi\Params\MaxSpeed, min, 0, "0" +HKR, Ndi\Params\MaxSpeed, max, 0, "2000" +HKR, Ndi\Params\MaxSpeed, step, 0, "1" +HKR, Ndi\Params\MaxSpeed, Base, 0, "10" +HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% +HKR, Ndi\Params\KeepLink, type, 0, "enum" +HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% +HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% +HKR, Ndi\Params\KeepLink, default, 0, "0" + + +[Neo.Service] +DisplayName = %Neo.Service.DispName% +Description = %Neo.Service.Desc% +ServiceType = 1 +StartType = 3 +ErrorControl = 1 +ServiceBinary = %12%\Neo6_x64_VPN114.sys +LoadOrderGroup = NDIS + +[Neo.Reg] +HKR, Ndi, Service, 0, Neo.Service.Name +HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" +HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" + +[Neo.EventLog] +HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo6_x64_VPN114.sys" +HKR, , TypesSupported, 0x00010001, 7 + +[Strings] +CompanyName = "SoftEther Corporation" +DiskDescription = "VPN Client Device Driver Install Disk" +Neo.Service.Name = "Neo_VPN114" +Neo.Service.DispName = "VPN Client Device Driver - VPN114" +Neo.Service.Desc = "VPN Client Adapter - VPN114" +NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN114" +Neo.EventLog.Name = "Neo" +NetworkAddress = "MAC Address" +DefaultAddress = "000001000001" +MaxSpeed = "Indicate Speed (Mbps)" +KeepLink = "Keep Link" +On = "On" +Off = "Off" + + +; Auto Generated 20180205_163629.453 + diff --git a/src/bin/hamcore/DriverPackages/Neo6_Win10/x64/Neo6_x64_VPN115.inf b/src/bin/hamcore/DriverPackages/Neo6_Win10/x64/Neo6_x64_VPN115.inf index 3c163326..08e7764f 100644 --- a/src/bin/hamcore/DriverPackages/Neo6_Win10/x64/Neo6_x64_VPN115.inf +++ b/src/bin/hamcore/DriverPackages/Neo6_Win10/x64/Neo6_x64_VPN115.inf @@ -1,114 +1,114 @@ -; VPN Client Device Driver for Windows 2000 and Greater -; -; Copyright (c) SoftEther Corporation. All Rights Reserved. -; http://www.softether.co.jp/ -; -; BUILD 9658 - -[Version] -Signature = "$Windows NT$" -Class = Net -ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} -Provider = %CompanyName% -DriverVer = 02/04/2018, 4.25.0.9658 -CatalogFile.NT = Neo6_x64_VPN115.cat - -[Manufacturer] -%CompanyName% = SoftEther, NTamd64 - -[SourceDisksNames] -1=%DiskDescription%, "", , - -[SourceDisksFiles] -Neo6_x64_VPN115.sys = 1 - -[DestinationDirs] -DefaultDestDir = 12 -Neo.CopyFiles.Sys = 12 - -[Neo.CopyFiles.Sys] -Neo6_x64_VPN115.sys, , , 2 - -[SoftEther.NTamd64] -%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN115 - -[NeoAdapter.Install] -Characteristics = 0x1 -AddReg = Neo.Reg, NeoAdapter.Ndi -CopyFiles = Neo.CopyFiles.Sys -*IfType = 53 -*MediaType = 0 -*PhysicalMediaType = 0 - -[NeoAdapter.Install.Services] -AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% - -[NeoAdapter.Ndi] -HKR, , NetworkAddress, 0, %DefaultAddress% -HKR, Ndi, DeviceID, , "NeoAdapter_VPN115" -HKR, , DevLoader, , ndis -HKR, , DeviceVxDs, , Neo6_x64_VPN115.sys -HKR, NDIS, LogDriverName, , "Neo_VPN115" -HKR, NDIS, MajorNdisVersion, 1, 5 -HKR, NDIS, MinorNdisVersion, 1, 0 -HKR, Ndi\Interfaces, DefUpper, , "ndis5" -HKR, Ndi\Interfaces, UpperRange, , "ndis5" -HKR, Ndi\Interfaces, LowerRange, , "ethernet" -HKR, Ndi\Interfaces, DefLower, , "ethernet" -HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" -HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% -HKR, Ndi\Params\NetworkAddress, type, 0, "edit" -HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" -HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" -HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% -HKR, Ndi\Params\NetworkAddress, optional, 0, "0" -HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% -HKR, Ndi\Params\MaxSpeed, type, 0, "int" -HKR, Ndi\Params\MaxSpeed, default, 0, "100" -HKR, Ndi\Params\MaxSpeed, min, 0, "0" -HKR, Ndi\Params\MaxSpeed, max, 0, "2000" -HKR, Ndi\Params\MaxSpeed, step, 0, "1" -HKR, Ndi\Params\MaxSpeed, Base, 0, "10" -HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% -HKR, Ndi\Params\KeepLink, type, 0, "enum" -HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% -HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% -HKR, Ndi\Params\KeepLink, default, 0, "0" - - -[Neo.Service] -DisplayName = %Neo.Service.DispName% -Description = %Neo.Service.Desc% -ServiceType = 1 -StartType = 3 -ErrorControl = 1 -ServiceBinary = %12%\Neo6_x64_VPN115.sys -LoadOrderGroup = NDIS - -[Neo.Reg] -HKR, Ndi, Service, 0, Neo.Service.Name -HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" -HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" - -[Neo.EventLog] -HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo6_x64_VPN115.sys" -HKR, , TypesSupported, 0x00010001, 7 - -[Strings] -CompanyName = "SoftEther Corporation" -DiskDescription = "VPN Client Device Driver Install Disk" -Neo.Service.Name = "Neo_VPN115" -Neo.Service.DispName = "VPN Client Device Driver - VPN115" -Neo.Service.Desc = "VPN Client Adapter - VPN115" -NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN115" -Neo.EventLog.Name = "Neo" -NetworkAddress = "MAC Address" -DefaultAddress = "000001000001" -MaxSpeed = "Indicate Speed (Mbps)" -KeepLink = "Keep Link" -On = "On" -Off = "Off" - - -; Auto Generated 20180205_163629.522 - +; VPN Client Device Driver for Windows 2000 and Greater +; +; Copyright (c) SoftEther Corporation. All Rights Reserved. +; http://www.softether.co.jp/ +; +; BUILD 9658 + +[Version] +Signature = "$Windows NT$" +Class = Net +ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} +Provider = %CompanyName% +DriverVer = 02/04/2018, 4.25.0.9658 +CatalogFile.NT = Neo6_x64_VPN115.cat + +[Manufacturer] +%CompanyName% = SoftEther, NTamd64 + +[SourceDisksNames] +1=%DiskDescription%, "", , + +[SourceDisksFiles] +Neo6_x64_VPN115.sys = 1 + +[DestinationDirs] +DefaultDestDir = 12 +Neo.CopyFiles.Sys = 12 + +[Neo.CopyFiles.Sys] +Neo6_x64_VPN115.sys, , , 2 + +[SoftEther.NTamd64] +%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN115 + +[NeoAdapter.Install] +Characteristics = 0x1 +AddReg = Neo.Reg, NeoAdapter.Ndi +CopyFiles = Neo.CopyFiles.Sys +*IfType = 53 +*MediaType = 0 +*PhysicalMediaType = 0 + +[NeoAdapter.Install.Services] +AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% + +[NeoAdapter.Ndi] +HKR, , NetworkAddress, 0, %DefaultAddress% +HKR, Ndi, DeviceID, , "NeoAdapter_VPN115" +HKR, , DevLoader, , ndis +HKR, , DeviceVxDs, , Neo6_x64_VPN115.sys +HKR, NDIS, LogDriverName, , "Neo_VPN115" +HKR, NDIS, MajorNdisVersion, 1, 5 +HKR, NDIS, MinorNdisVersion, 1, 0 +HKR, Ndi\Interfaces, DefUpper, , "ndis5" +HKR, Ndi\Interfaces, UpperRange, , "ndis5" +HKR, Ndi\Interfaces, LowerRange, , "ethernet" +HKR, Ndi\Interfaces, DefLower, , "ethernet" +HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" +HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% +HKR, Ndi\Params\NetworkAddress, type, 0, "edit" +HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" +HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" +HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% +HKR, Ndi\Params\NetworkAddress, optional, 0, "0" +HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% +HKR, Ndi\Params\MaxSpeed, type, 0, "int" +HKR, Ndi\Params\MaxSpeed, default, 0, "100" +HKR, Ndi\Params\MaxSpeed, min, 0, "0" +HKR, Ndi\Params\MaxSpeed, max, 0, "2000" +HKR, Ndi\Params\MaxSpeed, step, 0, "1" +HKR, Ndi\Params\MaxSpeed, Base, 0, "10" +HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% +HKR, Ndi\Params\KeepLink, type, 0, "enum" +HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% +HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% +HKR, Ndi\Params\KeepLink, default, 0, "0" + + +[Neo.Service] +DisplayName = %Neo.Service.DispName% +Description = %Neo.Service.Desc% +ServiceType = 1 +StartType = 3 +ErrorControl = 1 +ServiceBinary = %12%\Neo6_x64_VPN115.sys +LoadOrderGroup = NDIS + +[Neo.Reg] +HKR, Ndi, Service, 0, Neo.Service.Name +HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" +HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" + +[Neo.EventLog] +HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo6_x64_VPN115.sys" +HKR, , TypesSupported, 0x00010001, 7 + +[Strings] +CompanyName = "SoftEther Corporation" +DiskDescription = "VPN Client Device Driver Install Disk" +Neo.Service.Name = "Neo_VPN115" +Neo.Service.DispName = "VPN Client Device Driver - VPN115" +Neo.Service.Desc = "VPN Client Adapter - VPN115" +NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN115" +Neo.EventLog.Name = "Neo" +NetworkAddress = "MAC Address" +DefaultAddress = "000001000001" +MaxSpeed = "Indicate Speed (Mbps)" +KeepLink = "Keep Link" +On = "On" +Off = "Off" + + +; Auto Generated 20180205_163629.522 + diff --git a/src/bin/hamcore/DriverPackages/Neo6_Win10/x64/Neo6_x64_VPN116.inf b/src/bin/hamcore/DriverPackages/Neo6_Win10/x64/Neo6_x64_VPN116.inf index a809bd88..f4c6cb6a 100644 --- a/src/bin/hamcore/DriverPackages/Neo6_Win10/x64/Neo6_x64_VPN116.inf +++ b/src/bin/hamcore/DriverPackages/Neo6_Win10/x64/Neo6_x64_VPN116.inf @@ -1,114 +1,114 @@ -; VPN Client Device Driver for Windows 2000 and Greater -; -; Copyright (c) SoftEther Corporation. All Rights Reserved. -; http://www.softether.co.jp/ -; -; BUILD 9658 - -[Version] -Signature = "$Windows NT$" -Class = Net -ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} -Provider = %CompanyName% -DriverVer = 02/04/2018, 4.25.0.9658 -CatalogFile.NT = Neo6_x64_VPN116.cat - -[Manufacturer] -%CompanyName% = SoftEther, NTamd64 - -[SourceDisksNames] -1=%DiskDescription%, "", , - -[SourceDisksFiles] -Neo6_x64_VPN116.sys = 1 - -[DestinationDirs] -DefaultDestDir = 12 -Neo.CopyFiles.Sys = 12 - -[Neo.CopyFiles.Sys] -Neo6_x64_VPN116.sys, , , 2 - -[SoftEther.NTamd64] -%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN116 - -[NeoAdapter.Install] -Characteristics = 0x1 -AddReg = Neo.Reg, NeoAdapter.Ndi -CopyFiles = Neo.CopyFiles.Sys -*IfType = 53 -*MediaType = 0 -*PhysicalMediaType = 0 - -[NeoAdapter.Install.Services] -AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% - -[NeoAdapter.Ndi] -HKR, , NetworkAddress, 0, %DefaultAddress% -HKR, Ndi, DeviceID, , "NeoAdapter_VPN116" -HKR, , DevLoader, , ndis -HKR, , DeviceVxDs, , Neo6_x64_VPN116.sys -HKR, NDIS, LogDriverName, , "Neo_VPN116" -HKR, NDIS, MajorNdisVersion, 1, 5 -HKR, NDIS, MinorNdisVersion, 1, 0 -HKR, Ndi\Interfaces, DefUpper, , "ndis5" -HKR, Ndi\Interfaces, UpperRange, , "ndis5" -HKR, Ndi\Interfaces, LowerRange, , "ethernet" -HKR, Ndi\Interfaces, DefLower, , "ethernet" -HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" -HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% -HKR, Ndi\Params\NetworkAddress, type, 0, "edit" -HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" -HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" -HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% -HKR, Ndi\Params\NetworkAddress, optional, 0, "0" -HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% -HKR, Ndi\Params\MaxSpeed, type, 0, "int" -HKR, Ndi\Params\MaxSpeed, default, 0, "100" -HKR, Ndi\Params\MaxSpeed, min, 0, "0" -HKR, Ndi\Params\MaxSpeed, max, 0, "2000" -HKR, Ndi\Params\MaxSpeed, step, 0, "1" -HKR, Ndi\Params\MaxSpeed, Base, 0, "10" -HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% -HKR, Ndi\Params\KeepLink, type, 0, "enum" -HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% -HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% -HKR, Ndi\Params\KeepLink, default, 0, "0" - - -[Neo.Service] -DisplayName = %Neo.Service.DispName% -Description = %Neo.Service.Desc% -ServiceType = 1 -StartType = 3 -ErrorControl = 1 -ServiceBinary = %12%\Neo6_x64_VPN116.sys -LoadOrderGroup = NDIS - -[Neo.Reg] -HKR, Ndi, Service, 0, Neo.Service.Name -HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" -HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" - -[Neo.EventLog] -HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo6_x64_VPN116.sys" -HKR, , TypesSupported, 0x00010001, 7 - -[Strings] -CompanyName = "SoftEther Corporation" -DiskDescription = "VPN Client Device Driver Install Disk" -Neo.Service.Name = "Neo_VPN116" -Neo.Service.DispName = "VPN Client Device Driver - VPN116" -Neo.Service.Desc = "VPN Client Adapter - VPN116" -NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN116" -Neo.EventLog.Name = "Neo" -NetworkAddress = "MAC Address" -DefaultAddress = "000001000001" -MaxSpeed = "Indicate Speed (Mbps)" -KeepLink = "Keep Link" -On = "On" -Off = "Off" - - -; Auto Generated 20180205_163629.594 - +; VPN Client Device Driver for Windows 2000 and Greater +; +; Copyright (c) SoftEther Corporation. All Rights Reserved. +; http://www.softether.co.jp/ +; +; BUILD 9658 + +[Version] +Signature = "$Windows NT$" +Class = Net +ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} +Provider = %CompanyName% +DriverVer = 02/04/2018, 4.25.0.9658 +CatalogFile.NT = Neo6_x64_VPN116.cat + +[Manufacturer] +%CompanyName% = SoftEther, NTamd64 + +[SourceDisksNames] +1=%DiskDescription%, "", , + +[SourceDisksFiles] +Neo6_x64_VPN116.sys = 1 + +[DestinationDirs] +DefaultDestDir = 12 +Neo.CopyFiles.Sys = 12 + +[Neo.CopyFiles.Sys] +Neo6_x64_VPN116.sys, , , 2 + +[SoftEther.NTamd64] +%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN116 + +[NeoAdapter.Install] +Characteristics = 0x1 +AddReg = Neo.Reg, NeoAdapter.Ndi +CopyFiles = Neo.CopyFiles.Sys +*IfType = 53 +*MediaType = 0 +*PhysicalMediaType = 0 + +[NeoAdapter.Install.Services] +AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% + +[NeoAdapter.Ndi] +HKR, , NetworkAddress, 0, %DefaultAddress% +HKR, Ndi, DeviceID, , "NeoAdapter_VPN116" +HKR, , DevLoader, , ndis +HKR, , DeviceVxDs, , Neo6_x64_VPN116.sys +HKR, NDIS, LogDriverName, , "Neo_VPN116" +HKR, NDIS, MajorNdisVersion, 1, 5 +HKR, NDIS, MinorNdisVersion, 1, 0 +HKR, Ndi\Interfaces, DefUpper, , "ndis5" +HKR, Ndi\Interfaces, UpperRange, , "ndis5" +HKR, Ndi\Interfaces, LowerRange, , "ethernet" +HKR, Ndi\Interfaces, DefLower, , "ethernet" +HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" +HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% +HKR, Ndi\Params\NetworkAddress, type, 0, "edit" +HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" +HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" +HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% +HKR, Ndi\Params\NetworkAddress, optional, 0, "0" +HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% +HKR, Ndi\Params\MaxSpeed, type, 0, "int" +HKR, Ndi\Params\MaxSpeed, default, 0, "100" +HKR, Ndi\Params\MaxSpeed, min, 0, "0" +HKR, Ndi\Params\MaxSpeed, max, 0, "2000" +HKR, Ndi\Params\MaxSpeed, step, 0, "1" +HKR, Ndi\Params\MaxSpeed, Base, 0, "10" +HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% +HKR, Ndi\Params\KeepLink, type, 0, "enum" +HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% +HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% +HKR, Ndi\Params\KeepLink, default, 0, "0" + + +[Neo.Service] +DisplayName = %Neo.Service.DispName% +Description = %Neo.Service.Desc% +ServiceType = 1 +StartType = 3 +ErrorControl = 1 +ServiceBinary = %12%\Neo6_x64_VPN116.sys +LoadOrderGroup = NDIS + +[Neo.Reg] +HKR, Ndi, Service, 0, Neo.Service.Name +HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" +HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" + +[Neo.EventLog] +HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo6_x64_VPN116.sys" +HKR, , TypesSupported, 0x00010001, 7 + +[Strings] +CompanyName = "SoftEther Corporation" +DiskDescription = "VPN Client Device Driver Install Disk" +Neo.Service.Name = "Neo_VPN116" +Neo.Service.DispName = "VPN Client Device Driver - VPN116" +Neo.Service.Desc = "VPN Client Adapter - VPN116" +NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN116" +Neo.EventLog.Name = "Neo" +NetworkAddress = "MAC Address" +DefaultAddress = "000001000001" +MaxSpeed = "Indicate Speed (Mbps)" +KeepLink = "Keep Link" +On = "On" +Off = "Off" + + +; Auto Generated 20180205_163629.594 + diff --git a/src/bin/hamcore/DriverPackages/Neo6_Win10/x64/Neo6_x64_VPN117.inf b/src/bin/hamcore/DriverPackages/Neo6_Win10/x64/Neo6_x64_VPN117.inf index 48420c4f..c4467c71 100644 --- a/src/bin/hamcore/DriverPackages/Neo6_Win10/x64/Neo6_x64_VPN117.inf +++ b/src/bin/hamcore/DriverPackages/Neo6_Win10/x64/Neo6_x64_VPN117.inf @@ -1,114 +1,114 @@ -; VPN Client Device Driver for Windows 2000 and Greater -; -; Copyright (c) SoftEther Corporation. All Rights Reserved. -; http://www.softether.co.jp/ -; -; BUILD 9658 - -[Version] -Signature = "$Windows NT$" -Class = Net -ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} -Provider = %CompanyName% -DriverVer = 02/04/2018, 4.25.0.9658 -CatalogFile.NT = Neo6_x64_VPN117.cat - -[Manufacturer] -%CompanyName% = SoftEther, NTamd64 - -[SourceDisksNames] -1=%DiskDescription%, "", , - -[SourceDisksFiles] -Neo6_x64_VPN117.sys = 1 - -[DestinationDirs] -DefaultDestDir = 12 -Neo.CopyFiles.Sys = 12 - -[Neo.CopyFiles.Sys] -Neo6_x64_VPN117.sys, , , 2 - -[SoftEther.NTamd64] -%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN117 - -[NeoAdapter.Install] -Characteristics = 0x1 -AddReg = Neo.Reg, NeoAdapter.Ndi -CopyFiles = Neo.CopyFiles.Sys -*IfType = 53 -*MediaType = 0 -*PhysicalMediaType = 0 - -[NeoAdapter.Install.Services] -AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% - -[NeoAdapter.Ndi] -HKR, , NetworkAddress, 0, %DefaultAddress% -HKR, Ndi, DeviceID, , "NeoAdapter_VPN117" -HKR, , DevLoader, , ndis -HKR, , DeviceVxDs, , Neo6_x64_VPN117.sys -HKR, NDIS, LogDriverName, , "Neo_VPN117" -HKR, NDIS, MajorNdisVersion, 1, 5 -HKR, NDIS, MinorNdisVersion, 1, 0 -HKR, Ndi\Interfaces, DefUpper, , "ndis5" -HKR, Ndi\Interfaces, UpperRange, , "ndis5" -HKR, Ndi\Interfaces, LowerRange, , "ethernet" -HKR, Ndi\Interfaces, DefLower, , "ethernet" -HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" -HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% -HKR, Ndi\Params\NetworkAddress, type, 0, "edit" -HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" -HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" -HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% -HKR, Ndi\Params\NetworkAddress, optional, 0, "0" -HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% -HKR, Ndi\Params\MaxSpeed, type, 0, "int" -HKR, Ndi\Params\MaxSpeed, default, 0, "100" -HKR, Ndi\Params\MaxSpeed, min, 0, "0" -HKR, Ndi\Params\MaxSpeed, max, 0, "2000" -HKR, Ndi\Params\MaxSpeed, step, 0, "1" -HKR, Ndi\Params\MaxSpeed, Base, 0, "10" -HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% -HKR, Ndi\Params\KeepLink, type, 0, "enum" -HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% -HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% -HKR, Ndi\Params\KeepLink, default, 0, "0" - - -[Neo.Service] -DisplayName = %Neo.Service.DispName% -Description = %Neo.Service.Desc% -ServiceType = 1 -StartType = 3 -ErrorControl = 1 -ServiceBinary = %12%\Neo6_x64_VPN117.sys -LoadOrderGroup = NDIS - -[Neo.Reg] -HKR, Ndi, Service, 0, Neo.Service.Name -HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" -HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" - -[Neo.EventLog] -HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo6_x64_VPN117.sys" -HKR, , TypesSupported, 0x00010001, 7 - -[Strings] -CompanyName = "SoftEther Corporation" -DiskDescription = "VPN Client Device Driver Install Disk" -Neo.Service.Name = "Neo_VPN117" -Neo.Service.DispName = "VPN Client Device Driver - VPN117" -Neo.Service.Desc = "VPN Client Adapter - VPN117" -NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN117" -Neo.EventLog.Name = "Neo" -NetworkAddress = "MAC Address" -DefaultAddress = "000001000001" -MaxSpeed = "Indicate Speed (Mbps)" -KeepLink = "Keep Link" -On = "On" -Off = "Off" - - -; Auto Generated 20180205_163629.664 - +; VPN Client Device Driver for Windows 2000 and Greater +; +; Copyright (c) SoftEther Corporation. All Rights Reserved. +; http://www.softether.co.jp/ +; +; BUILD 9658 + +[Version] +Signature = "$Windows NT$" +Class = Net +ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} +Provider = %CompanyName% +DriverVer = 02/04/2018, 4.25.0.9658 +CatalogFile.NT = Neo6_x64_VPN117.cat + +[Manufacturer] +%CompanyName% = SoftEther, NTamd64 + +[SourceDisksNames] +1=%DiskDescription%, "", , + +[SourceDisksFiles] +Neo6_x64_VPN117.sys = 1 + +[DestinationDirs] +DefaultDestDir = 12 +Neo.CopyFiles.Sys = 12 + +[Neo.CopyFiles.Sys] +Neo6_x64_VPN117.sys, , , 2 + +[SoftEther.NTamd64] +%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN117 + +[NeoAdapter.Install] +Characteristics = 0x1 +AddReg = Neo.Reg, NeoAdapter.Ndi +CopyFiles = Neo.CopyFiles.Sys +*IfType = 53 +*MediaType = 0 +*PhysicalMediaType = 0 + +[NeoAdapter.Install.Services] +AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% + +[NeoAdapter.Ndi] +HKR, , NetworkAddress, 0, %DefaultAddress% +HKR, Ndi, DeviceID, , "NeoAdapter_VPN117" +HKR, , DevLoader, , ndis +HKR, , DeviceVxDs, , Neo6_x64_VPN117.sys +HKR, NDIS, LogDriverName, , "Neo_VPN117" +HKR, NDIS, MajorNdisVersion, 1, 5 +HKR, NDIS, MinorNdisVersion, 1, 0 +HKR, Ndi\Interfaces, DefUpper, , "ndis5" +HKR, Ndi\Interfaces, UpperRange, , "ndis5" +HKR, Ndi\Interfaces, LowerRange, , "ethernet" +HKR, Ndi\Interfaces, DefLower, , "ethernet" +HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" +HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% +HKR, Ndi\Params\NetworkAddress, type, 0, "edit" +HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" +HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" +HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% +HKR, Ndi\Params\NetworkAddress, optional, 0, "0" +HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% +HKR, Ndi\Params\MaxSpeed, type, 0, "int" +HKR, Ndi\Params\MaxSpeed, default, 0, "100" +HKR, Ndi\Params\MaxSpeed, min, 0, "0" +HKR, Ndi\Params\MaxSpeed, max, 0, "2000" +HKR, Ndi\Params\MaxSpeed, step, 0, "1" +HKR, Ndi\Params\MaxSpeed, Base, 0, "10" +HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% +HKR, Ndi\Params\KeepLink, type, 0, "enum" +HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% +HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% +HKR, Ndi\Params\KeepLink, default, 0, "0" + + +[Neo.Service] +DisplayName = %Neo.Service.DispName% +Description = %Neo.Service.Desc% +ServiceType = 1 +StartType = 3 +ErrorControl = 1 +ServiceBinary = %12%\Neo6_x64_VPN117.sys +LoadOrderGroup = NDIS + +[Neo.Reg] +HKR, Ndi, Service, 0, Neo.Service.Name +HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" +HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" + +[Neo.EventLog] +HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo6_x64_VPN117.sys" +HKR, , TypesSupported, 0x00010001, 7 + +[Strings] +CompanyName = "SoftEther Corporation" +DiskDescription = "VPN Client Device Driver Install Disk" +Neo.Service.Name = "Neo_VPN117" +Neo.Service.DispName = "VPN Client Device Driver - VPN117" +Neo.Service.Desc = "VPN Client Adapter - VPN117" +NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN117" +Neo.EventLog.Name = "Neo" +NetworkAddress = "MAC Address" +DefaultAddress = "000001000001" +MaxSpeed = "Indicate Speed (Mbps)" +KeepLink = "Keep Link" +On = "On" +Off = "Off" + + +; Auto Generated 20180205_163629.664 + diff --git a/src/bin/hamcore/DriverPackages/Neo6_Win10/x64/Neo6_x64_VPN118.inf b/src/bin/hamcore/DriverPackages/Neo6_Win10/x64/Neo6_x64_VPN118.inf index ad6dfc2a..5abfbf90 100644 --- a/src/bin/hamcore/DriverPackages/Neo6_Win10/x64/Neo6_x64_VPN118.inf +++ b/src/bin/hamcore/DriverPackages/Neo6_Win10/x64/Neo6_x64_VPN118.inf @@ -1,114 +1,114 @@ -; VPN Client Device Driver for Windows 2000 and Greater -; -; Copyright (c) SoftEther Corporation. All Rights Reserved. -; http://www.softether.co.jp/ -; -; BUILD 9658 - -[Version] -Signature = "$Windows NT$" -Class = Net -ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} -Provider = %CompanyName% -DriverVer = 02/04/2018, 4.25.0.9658 -CatalogFile.NT = Neo6_x64_VPN118.cat - -[Manufacturer] -%CompanyName% = SoftEther, NTamd64 - -[SourceDisksNames] -1=%DiskDescription%, "", , - -[SourceDisksFiles] -Neo6_x64_VPN118.sys = 1 - -[DestinationDirs] -DefaultDestDir = 12 -Neo.CopyFiles.Sys = 12 - -[Neo.CopyFiles.Sys] -Neo6_x64_VPN118.sys, , , 2 - -[SoftEther.NTamd64] -%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN118 - -[NeoAdapter.Install] -Characteristics = 0x1 -AddReg = Neo.Reg, NeoAdapter.Ndi -CopyFiles = Neo.CopyFiles.Sys -*IfType = 53 -*MediaType = 0 -*PhysicalMediaType = 0 - -[NeoAdapter.Install.Services] -AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% - -[NeoAdapter.Ndi] -HKR, , NetworkAddress, 0, %DefaultAddress% -HKR, Ndi, DeviceID, , "NeoAdapter_VPN118" -HKR, , DevLoader, , ndis -HKR, , DeviceVxDs, , Neo6_x64_VPN118.sys -HKR, NDIS, LogDriverName, , "Neo_VPN118" -HKR, NDIS, MajorNdisVersion, 1, 5 -HKR, NDIS, MinorNdisVersion, 1, 0 -HKR, Ndi\Interfaces, DefUpper, , "ndis5" -HKR, Ndi\Interfaces, UpperRange, , "ndis5" -HKR, Ndi\Interfaces, LowerRange, , "ethernet" -HKR, Ndi\Interfaces, DefLower, , "ethernet" -HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" -HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% -HKR, Ndi\Params\NetworkAddress, type, 0, "edit" -HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" -HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" -HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% -HKR, Ndi\Params\NetworkAddress, optional, 0, "0" -HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% -HKR, Ndi\Params\MaxSpeed, type, 0, "int" -HKR, Ndi\Params\MaxSpeed, default, 0, "100" -HKR, Ndi\Params\MaxSpeed, min, 0, "0" -HKR, Ndi\Params\MaxSpeed, max, 0, "2000" -HKR, Ndi\Params\MaxSpeed, step, 0, "1" -HKR, Ndi\Params\MaxSpeed, Base, 0, "10" -HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% -HKR, Ndi\Params\KeepLink, type, 0, "enum" -HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% -HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% -HKR, Ndi\Params\KeepLink, default, 0, "0" - - -[Neo.Service] -DisplayName = %Neo.Service.DispName% -Description = %Neo.Service.Desc% -ServiceType = 1 -StartType = 3 -ErrorControl = 1 -ServiceBinary = %12%\Neo6_x64_VPN118.sys -LoadOrderGroup = NDIS - -[Neo.Reg] -HKR, Ndi, Service, 0, Neo.Service.Name -HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" -HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" - -[Neo.EventLog] -HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo6_x64_VPN118.sys" -HKR, , TypesSupported, 0x00010001, 7 - -[Strings] -CompanyName = "SoftEther Corporation" -DiskDescription = "VPN Client Device Driver Install Disk" -Neo.Service.Name = "Neo_VPN118" -Neo.Service.DispName = "VPN Client Device Driver - VPN118" -Neo.Service.Desc = "VPN Client Adapter - VPN118" -NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN118" -Neo.EventLog.Name = "Neo" -NetworkAddress = "MAC Address" -DefaultAddress = "000001000001" -MaxSpeed = "Indicate Speed (Mbps)" -KeepLink = "Keep Link" -On = "On" -Off = "Off" - - -; Auto Generated 20180205_163629.737 - +; VPN Client Device Driver for Windows 2000 and Greater +; +; Copyright (c) SoftEther Corporation. All Rights Reserved. +; http://www.softether.co.jp/ +; +; BUILD 9658 + +[Version] +Signature = "$Windows NT$" +Class = Net +ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} +Provider = %CompanyName% +DriverVer = 02/04/2018, 4.25.0.9658 +CatalogFile.NT = Neo6_x64_VPN118.cat + +[Manufacturer] +%CompanyName% = SoftEther, NTamd64 + +[SourceDisksNames] +1=%DiskDescription%, "", , + +[SourceDisksFiles] +Neo6_x64_VPN118.sys = 1 + +[DestinationDirs] +DefaultDestDir = 12 +Neo.CopyFiles.Sys = 12 + +[Neo.CopyFiles.Sys] +Neo6_x64_VPN118.sys, , , 2 + +[SoftEther.NTamd64] +%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN118 + +[NeoAdapter.Install] +Characteristics = 0x1 +AddReg = Neo.Reg, NeoAdapter.Ndi +CopyFiles = Neo.CopyFiles.Sys +*IfType = 53 +*MediaType = 0 +*PhysicalMediaType = 0 + +[NeoAdapter.Install.Services] +AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% + +[NeoAdapter.Ndi] +HKR, , NetworkAddress, 0, %DefaultAddress% +HKR, Ndi, DeviceID, , "NeoAdapter_VPN118" +HKR, , DevLoader, , ndis +HKR, , DeviceVxDs, , Neo6_x64_VPN118.sys +HKR, NDIS, LogDriverName, , "Neo_VPN118" +HKR, NDIS, MajorNdisVersion, 1, 5 +HKR, NDIS, MinorNdisVersion, 1, 0 +HKR, Ndi\Interfaces, DefUpper, , "ndis5" +HKR, Ndi\Interfaces, UpperRange, , "ndis5" +HKR, Ndi\Interfaces, LowerRange, , "ethernet" +HKR, Ndi\Interfaces, DefLower, , "ethernet" +HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" +HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% +HKR, Ndi\Params\NetworkAddress, type, 0, "edit" +HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" +HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" +HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% +HKR, Ndi\Params\NetworkAddress, optional, 0, "0" +HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% +HKR, Ndi\Params\MaxSpeed, type, 0, "int" +HKR, Ndi\Params\MaxSpeed, default, 0, "100" +HKR, Ndi\Params\MaxSpeed, min, 0, "0" +HKR, Ndi\Params\MaxSpeed, max, 0, "2000" +HKR, Ndi\Params\MaxSpeed, step, 0, "1" +HKR, Ndi\Params\MaxSpeed, Base, 0, "10" +HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% +HKR, Ndi\Params\KeepLink, type, 0, "enum" +HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% +HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% +HKR, Ndi\Params\KeepLink, default, 0, "0" + + +[Neo.Service] +DisplayName = %Neo.Service.DispName% +Description = %Neo.Service.Desc% +ServiceType = 1 +StartType = 3 +ErrorControl = 1 +ServiceBinary = %12%\Neo6_x64_VPN118.sys +LoadOrderGroup = NDIS + +[Neo.Reg] +HKR, Ndi, Service, 0, Neo.Service.Name +HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" +HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" + +[Neo.EventLog] +HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo6_x64_VPN118.sys" +HKR, , TypesSupported, 0x00010001, 7 + +[Strings] +CompanyName = "SoftEther Corporation" +DiskDescription = "VPN Client Device Driver Install Disk" +Neo.Service.Name = "Neo_VPN118" +Neo.Service.DispName = "VPN Client Device Driver - VPN118" +Neo.Service.Desc = "VPN Client Adapter - VPN118" +NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN118" +Neo.EventLog.Name = "Neo" +NetworkAddress = "MAC Address" +DefaultAddress = "000001000001" +MaxSpeed = "Indicate Speed (Mbps)" +KeepLink = "Keep Link" +On = "On" +Off = "Off" + + +; Auto Generated 20180205_163629.737 + diff --git a/src/bin/hamcore/DriverPackages/Neo6_Win10/x64/Neo6_x64_VPN119.inf b/src/bin/hamcore/DriverPackages/Neo6_Win10/x64/Neo6_x64_VPN119.inf index f6369cc5..b8fe0e2f 100644 --- a/src/bin/hamcore/DriverPackages/Neo6_Win10/x64/Neo6_x64_VPN119.inf +++ b/src/bin/hamcore/DriverPackages/Neo6_Win10/x64/Neo6_x64_VPN119.inf @@ -1,114 +1,114 @@ -; VPN Client Device Driver for Windows 2000 and Greater -; -; Copyright (c) SoftEther Corporation. All Rights Reserved. -; http://www.softether.co.jp/ -; -; BUILD 9658 - -[Version] -Signature = "$Windows NT$" -Class = Net -ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} -Provider = %CompanyName% -DriverVer = 02/04/2018, 4.25.0.9658 -CatalogFile.NT = Neo6_x64_VPN119.cat - -[Manufacturer] -%CompanyName% = SoftEther, NTamd64 - -[SourceDisksNames] -1=%DiskDescription%, "", , - -[SourceDisksFiles] -Neo6_x64_VPN119.sys = 1 - -[DestinationDirs] -DefaultDestDir = 12 -Neo.CopyFiles.Sys = 12 - -[Neo.CopyFiles.Sys] -Neo6_x64_VPN119.sys, , , 2 - -[SoftEther.NTamd64] -%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN119 - -[NeoAdapter.Install] -Characteristics = 0x1 -AddReg = Neo.Reg, NeoAdapter.Ndi -CopyFiles = Neo.CopyFiles.Sys -*IfType = 53 -*MediaType = 0 -*PhysicalMediaType = 0 - -[NeoAdapter.Install.Services] -AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% - -[NeoAdapter.Ndi] -HKR, , NetworkAddress, 0, %DefaultAddress% -HKR, Ndi, DeviceID, , "NeoAdapter_VPN119" -HKR, , DevLoader, , ndis -HKR, , DeviceVxDs, , Neo6_x64_VPN119.sys -HKR, NDIS, LogDriverName, , "Neo_VPN119" -HKR, NDIS, MajorNdisVersion, 1, 5 -HKR, NDIS, MinorNdisVersion, 1, 0 -HKR, Ndi\Interfaces, DefUpper, , "ndis5" -HKR, Ndi\Interfaces, UpperRange, , "ndis5" -HKR, Ndi\Interfaces, LowerRange, , "ethernet" -HKR, Ndi\Interfaces, DefLower, , "ethernet" -HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" -HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% -HKR, Ndi\Params\NetworkAddress, type, 0, "edit" -HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" -HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" -HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% -HKR, Ndi\Params\NetworkAddress, optional, 0, "0" -HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% -HKR, Ndi\Params\MaxSpeed, type, 0, "int" -HKR, Ndi\Params\MaxSpeed, default, 0, "100" -HKR, Ndi\Params\MaxSpeed, min, 0, "0" -HKR, Ndi\Params\MaxSpeed, max, 0, "2000" -HKR, Ndi\Params\MaxSpeed, step, 0, "1" -HKR, Ndi\Params\MaxSpeed, Base, 0, "10" -HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% -HKR, Ndi\Params\KeepLink, type, 0, "enum" -HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% -HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% -HKR, Ndi\Params\KeepLink, default, 0, "0" - - -[Neo.Service] -DisplayName = %Neo.Service.DispName% -Description = %Neo.Service.Desc% -ServiceType = 1 -StartType = 3 -ErrorControl = 1 -ServiceBinary = %12%\Neo6_x64_VPN119.sys -LoadOrderGroup = NDIS - -[Neo.Reg] -HKR, Ndi, Service, 0, Neo.Service.Name -HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" -HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" - -[Neo.EventLog] -HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo6_x64_VPN119.sys" -HKR, , TypesSupported, 0x00010001, 7 - -[Strings] -CompanyName = "SoftEther Corporation" -DiskDescription = "VPN Client Device Driver Install Disk" -Neo.Service.Name = "Neo_VPN119" -Neo.Service.DispName = "VPN Client Device Driver - VPN119" -Neo.Service.Desc = "VPN Client Adapter - VPN119" -NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN119" -Neo.EventLog.Name = "Neo" -NetworkAddress = "MAC Address" -DefaultAddress = "000001000001" -MaxSpeed = "Indicate Speed (Mbps)" -KeepLink = "Keep Link" -On = "On" -Off = "Off" - - -; Auto Generated 20180205_163629.808 - +; VPN Client Device Driver for Windows 2000 and Greater +; +; Copyright (c) SoftEther Corporation. All Rights Reserved. +; http://www.softether.co.jp/ +; +; BUILD 9658 + +[Version] +Signature = "$Windows NT$" +Class = Net +ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} +Provider = %CompanyName% +DriverVer = 02/04/2018, 4.25.0.9658 +CatalogFile.NT = Neo6_x64_VPN119.cat + +[Manufacturer] +%CompanyName% = SoftEther, NTamd64 + +[SourceDisksNames] +1=%DiskDescription%, "", , + +[SourceDisksFiles] +Neo6_x64_VPN119.sys = 1 + +[DestinationDirs] +DefaultDestDir = 12 +Neo.CopyFiles.Sys = 12 + +[Neo.CopyFiles.Sys] +Neo6_x64_VPN119.sys, , , 2 + +[SoftEther.NTamd64] +%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN119 + +[NeoAdapter.Install] +Characteristics = 0x1 +AddReg = Neo.Reg, NeoAdapter.Ndi +CopyFiles = Neo.CopyFiles.Sys +*IfType = 53 +*MediaType = 0 +*PhysicalMediaType = 0 + +[NeoAdapter.Install.Services] +AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% + +[NeoAdapter.Ndi] +HKR, , NetworkAddress, 0, %DefaultAddress% +HKR, Ndi, DeviceID, , "NeoAdapter_VPN119" +HKR, , DevLoader, , ndis +HKR, , DeviceVxDs, , Neo6_x64_VPN119.sys +HKR, NDIS, LogDriverName, , "Neo_VPN119" +HKR, NDIS, MajorNdisVersion, 1, 5 +HKR, NDIS, MinorNdisVersion, 1, 0 +HKR, Ndi\Interfaces, DefUpper, , "ndis5" +HKR, Ndi\Interfaces, UpperRange, , "ndis5" +HKR, Ndi\Interfaces, LowerRange, , "ethernet" +HKR, Ndi\Interfaces, DefLower, , "ethernet" +HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" +HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% +HKR, Ndi\Params\NetworkAddress, type, 0, "edit" +HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" +HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" +HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% +HKR, Ndi\Params\NetworkAddress, optional, 0, "0" +HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% +HKR, Ndi\Params\MaxSpeed, type, 0, "int" +HKR, Ndi\Params\MaxSpeed, default, 0, "100" +HKR, Ndi\Params\MaxSpeed, min, 0, "0" +HKR, Ndi\Params\MaxSpeed, max, 0, "2000" +HKR, Ndi\Params\MaxSpeed, step, 0, "1" +HKR, Ndi\Params\MaxSpeed, Base, 0, "10" +HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% +HKR, Ndi\Params\KeepLink, type, 0, "enum" +HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% +HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% +HKR, Ndi\Params\KeepLink, default, 0, "0" + + +[Neo.Service] +DisplayName = %Neo.Service.DispName% +Description = %Neo.Service.Desc% +ServiceType = 1 +StartType = 3 +ErrorControl = 1 +ServiceBinary = %12%\Neo6_x64_VPN119.sys +LoadOrderGroup = NDIS + +[Neo.Reg] +HKR, Ndi, Service, 0, Neo.Service.Name +HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" +HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" + +[Neo.EventLog] +HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo6_x64_VPN119.sys" +HKR, , TypesSupported, 0x00010001, 7 + +[Strings] +CompanyName = "SoftEther Corporation" +DiskDescription = "VPN Client Device Driver Install Disk" +Neo.Service.Name = "Neo_VPN119" +Neo.Service.DispName = "VPN Client Device Driver - VPN119" +Neo.Service.Desc = "VPN Client Adapter - VPN119" +NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN119" +Neo.EventLog.Name = "Neo" +NetworkAddress = "MAC Address" +DefaultAddress = "000001000001" +MaxSpeed = "Indicate Speed (Mbps)" +KeepLink = "Keep Link" +On = "On" +Off = "Off" + + +; Auto Generated 20180205_163629.808 + diff --git a/src/bin/hamcore/DriverPackages/Neo6_Win10/x64/Neo6_x64_VPN12.inf b/src/bin/hamcore/DriverPackages/Neo6_Win10/x64/Neo6_x64_VPN12.inf index 185e6c85..f9f62e3d 100644 --- a/src/bin/hamcore/DriverPackages/Neo6_Win10/x64/Neo6_x64_VPN12.inf +++ b/src/bin/hamcore/DriverPackages/Neo6_Win10/x64/Neo6_x64_VPN12.inf @@ -1,114 +1,114 @@ -; VPN Client Device Driver for Windows 2000 and Greater -; -; Copyright (c) SoftEther Corporation. All Rights Reserved. -; http://www.softether.co.jp/ -; -; BUILD 9658 - -[Version] -Signature = "$Windows NT$" -Class = Net -ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} -Provider = %CompanyName% -DriverVer = 02/04/2018, 4.25.0.9658 -CatalogFile.NT = Neo6_x64_VPN12.cat - -[Manufacturer] -%CompanyName% = SoftEther, NTamd64 - -[SourceDisksNames] -1=%DiskDescription%, "", , - -[SourceDisksFiles] -Neo6_x64_VPN12.sys = 1 - -[DestinationDirs] -DefaultDestDir = 12 -Neo.CopyFiles.Sys = 12 - -[Neo.CopyFiles.Sys] -Neo6_x64_VPN12.sys, , , 2 - -[SoftEther.NTamd64] -%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN12 - -[NeoAdapter.Install] -Characteristics = 0x1 -AddReg = Neo.Reg, NeoAdapter.Ndi -CopyFiles = Neo.CopyFiles.Sys -*IfType = 53 -*MediaType = 0 -*PhysicalMediaType = 0 - -[NeoAdapter.Install.Services] -AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% - -[NeoAdapter.Ndi] -HKR, , NetworkAddress, 0, %DefaultAddress% -HKR, Ndi, DeviceID, , "NeoAdapter_VPN12" -HKR, , DevLoader, , ndis -HKR, , DeviceVxDs, , Neo6_x64_VPN12.sys -HKR, NDIS, LogDriverName, , "Neo_VPN12" -HKR, NDIS, MajorNdisVersion, 1, 5 -HKR, NDIS, MinorNdisVersion, 1, 0 -HKR, Ndi\Interfaces, DefUpper, , "ndis5" -HKR, Ndi\Interfaces, UpperRange, , "ndis5" -HKR, Ndi\Interfaces, LowerRange, , "ethernet" -HKR, Ndi\Interfaces, DefLower, , "ethernet" -HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" -HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% -HKR, Ndi\Params\NetworkAddress, type, 0, "edit" -HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" -HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" -HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% -HKR, Ndi\Params\NetworkAddress, optional, 0, "0" -HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% -HKR, Ndi\Params\MaxSpeed, type, 0, "int" -HKR, Ndi\Params\MaxSpeed, default, 0, "100" -HKR, Ndi\Params\MaxSpeed, min, 0, "0" -HKR, Ndi\Params\MaxSpeed, max, 0, "2000" -HKR, Ndi\Params\MaxSpeed, step, 0, "1" -HKR, Ndi\Params\MaxSpeed, Base, 0, "10" -HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% -HKR, Ndi\Params\KeepLink, type, 0, "enum" -HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% -HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% -HKR, Ndi\Params\KeepLink, default, 0, "0" - - -[Neo.Service] -DisplayName = %Neo.Service.DispName% -Description = %Neo.Service.Desc% -ServiceType = 1 -StartType = 3 -ErrorControl = 1 -ServiceBinary = %12%\Neo6_x64_VPN12.sys -LoadOrderGroup = NDIS - -[Neo.Reg] -HKR, Ndi, Service, 0, Neo.Service.Name -HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" -HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" - -[Neo.EventLog] -HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo6_x64_VPN12.sys" -HKR, , TypesSupported, 0x00010001, 7 - -[Strings] -CompanyName = "SoftEther Corporation" -DiskDescription = "VPN Client Device Driver Install Disk" -Neo.Service.Name = "Neo_VPN12" -Neo.Service.DispName = "VPN Client Device Driver - VPN12" -Neo.Service.Desc = "VPN Client Adapter - VPN12" -NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN12" -Neo.EventLog.Name = "Neo" -NetworkAddress = "MAC Address" -DefaultAddress = "000001000001" -MaxSpeed = "Indicate Speed (Mbps)" -KeepLink = "Keep Link" -On = "On" -Off = "Off" - - -; Auto Generated 20180205_163622.172 - +; VPN Client Device Driver for Windows 2000 and Greater +; +; Copyright (c) SoftEther Corporation. All Rights Reserved. +; http://www.softether.co.jp/ +; +; BUILD 9658 + +[Version] +Signature = "$Windows NT$" +Class = Net +ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} +Provider = %CompanyName% +DriverVer = 02/04/2018, 4.25.0.9658 +CatalogFile.NT = Neo6_x64_VPN12.cat + +[Manufacturer] +%CompanyName% = SoftEther, NTamd64 + +[SourceDisksNames] +1=%DiskDescription%, "", , + +[SourceDisksFiles] +Neo6_x64_VPN12.sys = 1 + +[DestinationDirs] +DefaultDestDir = 12 +Neo.CopyFiles.Sys = 12 + +[Neo.CopyFiles.Sys] +Neo6_x64_VPN12.sys, , , 2 + +[SoftEther.NTamd64] +%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN12 + +[NeoAdapter.Install] +Characteristics = 0x1 +AddReg = Neo.Reg, NeoAdapter.Ndi +CopyFiles = Neo.CopyFiles.Sys +*IfType = 53 +*MediaType = 0 +*PhysicalMediaType = 0 + +[NeoAdapter.Install.Services] +AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% + +[NeoAdapter.Ndi] +HKR, , NetworkAddress, 0, %DefaultAddress% +HKR, Ndi, DeviceID, , "NeoAdapter_VPN12" +HKR, , DevLoader, , ndis +HKR, , DeviceVxDs, , Neo6_x64_VPN12.sys +HKR, NDIS, LogDriverName, , "Neo_VPN12" +HKR, NDIS, MajorNdisVersion, 1, 5 +HKR, NDIS, MinorNdisVersion, 1, 0 +HKR, Ndi\Interfaces, DefUpper, , "ndis5" +HKR, Ndi\Interfaces, UpperRange, , "ndis5" +HKR, Ndi\Interfaces, LowerRange, , "ethernet" +HKR, Ndi\Interfaces, DefLower, , "ethernet" +HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" +HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% +HKR, Ndi\Params\NetworkAddress, type, 0, "edit" +HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" +HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" +HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% +HKR, Ndi\Params\NetworkAddress, optional, 0, "0" +HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% +HKR, Ndi\Params\MaxSpeed, type, 0, "int" +HKR, Ndi\Params\MaxSpeed, default, 0, "100" +HKR, Ndi\Params\MaxSpeed, min, 0, "0" +HKR, Ndi\Params\MaxSpeed, max, 0, "2000" +HKR, Ndi\Params\MaxSpeed, step, 0, "1" +HKR, Ndi\Params\MaxSpeed, Base, 0, "10" +HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% +HKR, Ndi\Params\KeepLink, type, 0, "enum" +HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% +HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% +HKR, Ndi\Params\KeepLink, default, 0, "0" + + +[Neo.Service] +DisplayName = %Neo.Service.DispName% +Description = %Neo.Service.Desc% +ServiceType = 1 +StartType = 3 +ErrorControl = 1 +ServiceBinary = %12%\Neo6_x64_VPN12.sys +LoadOrderGroup = NDIS + +[Neo.Reg] +HKR, Ndi, Service, 0, Neo.Service.Name +HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" +HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" + +[Neo.EventLog] +HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo6_x64_VPN12.sys" +HKR, , TypesSupported, 0x00010001, 7 + +[Strings] +CompanyName = "SoftEther Corporation" +DiskDescription = "VPN Client Device Driver Install Disk" +Neo.Service.Name = "Neo_VPN12" +Neo.Service.DispName = "VPN Client Device Driver - VPN12" +Neo.Service.Desc = "VPN Client Adapter - VPN12" +NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN12" +Neo.EventLog.Name = "Neo" +NetworkAddress = "MAC Address" +DefaultAddress = "000001000001" +MaxSpeed = "Indicate Speed (Mbps)" +KeepLink = "Keep Link" +On = "On" +Off = "Off" + + +; Auto Generated 20180205_163622.172 + diff --git a/src/bin/hamcore/DriverPackages/Neo6_Win10/x64/Neo6_x64_VPN120.inf b/src/bin/hamcore/DriverPackages/Neo6_Win10/x64/Neo6_x64_VPN120.inf index 254e8eb3..ec2e06b9 100644 --- a/src/bin/hamcore/DriverPackages/Neo6_Win10/x64/Neo6_x64_VPN120.inf +++ b/src/bin/hamcore/DriverPackages/Neo6_Win10/x64/Neo6_x64_VPN120.inf @@ -1,114 +1,114 @@ -; VPN Client Device Driver for Windows 2000 and Greater -; -; Copyright (c) SoftEther Corporation. All Rights Reserved. -; http://www.softether.co.jp/ -; -; BUILD 9658 - -[Version] -Signature = "$Windows NT$" -Class = Net -ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} -Provider = %CompanyName% -DriverVer = 02/04/2018, 4.25.0.9658 -CatalogFile.NT = Neo6_x64_VPN120.cat - -[Manufacturer] -%CompanyName% = SoftEther, NTamd64 - -[SourceDisksNames] -1=%DiskDescription%, "", , - -[SourceDisksFiles] -Neo6_x64_VPN120.sys = 1 - -[DestinationDirs] -DefaultDestDir = 12 -Neo.CopyFiles.Sys = 12 - -[Neo.CopyFiles.Sys] -Neo6_x64_VPN120.sys, , , 2 - -[SoftEther.NTamd64] -%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN120 - -[NeoAdapter.Install] -Characteristics = 0x1 -AddReg = Neo.Reg, NeoAdapter.Ndi -CopyFiles = Neo.CopyFiles.Sys -*IfType = 53 -*MediaType = 0 -*PhysicalMediaType = 0 - -[NeoAdapter.Install.Services] -AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% - -[NeoAdapter.Ndi] -HKR, , NetworkAddress, 0, %DefaultAddress% -HKR, Ndi, DeviceID, , "NeoAdapter_VPN120" -HKR, , DevLoader, , ndis -HKR, , DeviceVxDs, , Neo6_x64_VPN120.sys -HKR, NDIS, LogDriverName, , "Neo_VPN120" -HKR, NDIS, MajorNdisVersion, 1, 5 -HKR, NDIS, MinorNdisVersion, 1, 0 -HKR, Ndi\Interfaces, DefUpper, , "ndis5" -HKR, Ndi\Interfaces, UpperRange, , "ndis5" -HKR, Ndi\Interfaces, LowerRange, , "ethernet" -HKR, Ndi\Interfaces, DefLower, , "ethernet" -HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" -HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% -HKR, Ndi\Params\NetworkAddress, type, 0, "edit" -HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" -HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" -HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% -HKR, Ndi\Params\NetworkAddress, optional, 0, "0" -HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% -HKR, Ndi\Params\MaxSpeed, type, 0, "int" -HKR, Ndi\Params\MaxSpeed, default, 0, "100" -HKR, Ndi\Params\MaxSpeed, min, 0, "0" -HKR, Ndi\Params\MaxSpeed, max, 0, "2000" -HKR, Ndi\Params\MaxSpeed, step, 0, "1" -HKR, Ndi\Params\MaxSpeed, Base, 0, "10" -HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% -HKR, Ndi\Params\KeepLink, type, 0, "enum" -HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% -HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% -HKR, Ndi\Params\KeepLink, default, 0, "0" - - -[Neo.Service] -DisplayName = %Neo.Service.DispName% -Description = %Neo.Service.Desc% -ServiceType = 1 -StartType = 3 -ErrorControl = 1 -ServiceBinary = %12%\Neo6_x64_VPN120.sys -LoadOrderGroup = NDIS - -[Neo.Reg] -HKR, Ndi, Service, 0, Neo.Service.Name -HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" -HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" - -[Neo.EventLog] -HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo6_x64_VPN120.sys" -HKR, , TypesSupported, 0x00010001, 7 - -[Strings] -CompanyName = "SoftEther Corporation" -DiskDescription = "VPN Client Device Driver Install Disk" -Neo.Service.Name = "Neo_VPN120" -Neo.Service.DispName = "VPN Client Device Driver - VPN120" -Neo.Service.Desc = "VPN Client Adapter - VPN120" -NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN120" -Neo.EventLog.Name = "Neo" -NetworkAddress = "MAC Address" -DefaultAddress = "000001000001" -MaxSpeed = "Indicate Speed (Mbps)" -KeepLink = "Keep Link" -On = "On" -Off = "Off" - - -; Auto Generated 20180205_163629.881 - +; VPN Client Device Driver for Windows 2000 and Greater +; +; Copyright (c) SoftEther Corporation. All Rights Reserved. +; http://www.softether.co.jp/ +; +; BUILD 9658 + +[Version] +Signature = "$Windows NT$" +Class = Net +ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} +Provider = %CompanyName% +DriverVer = 02/04/2018, 4.25.0.9658 +CatalogFile.NT = Neo6_x64_VPN120.cat + +[Manufacturer] +%CompanyName% = SoftEther, NTamd64 + +[SourceDisksNames] +1=%DiskDescription%, "", , + +[SourceDisksFiles] +Neo6_x64_VPN120.sys = 1 + +[DestinationDirs] +DefaultDestDir = 12 +Neo.CopyFiles.Sys = 12 + +[Neo.CopyFiles.Sys] +Neo6_x64_VPN120.sys, , , 2 + +[SoftEther.NTamd64] +%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN120 + +[NeoAdapter.Install] +Characteristics = 0x1 +AddReg = Neo.Reg, NeoAdapter.Ndi +CopyFiles = Neo.CopyFiles.Sys +*IfType = 53 +*MediaType = 0 +*PhysicalMediaType = 0 + +[NeoAdapter.Install.Services] +AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% + +[NeoAdapter.Ndi] +HKR, , NetworkAddress, 0, %DefaultAddress% +HKR, Ndi, DeviceID, , "NeoAdapter_VPN120" +HKR, , DevLoader, , ndis +HKR, , DeviceVxDs, , Neo6_x64_VPN120.sys +HKR, NDIS, LogDriverName, , "Neo_VPN120" +HKR, NDIS, MajorNdisVersion, 1, 5 +HKR, NDIS, MinorNdisVersion, 1, 0 +HKR, Ndi\Interfaces, DefUpper, , "ndis5" +HKR, Ndi\Interfaces, UpperRange, , "ndis5" +HKR, Ndi\Interfaces, LowerRange, , "ethernet" +HKR, Ndi\Interfaces, DefLower, , "ethernet" +HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" +HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% +HKR, Ndi\Params\NetworkAddress, type, 0, "edit" +HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" +HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" +HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% +HKR, Ndi\Params\NetworkAddress, optional, 0, "0" +HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% +HKR, Ndi\Params\MaxSpeed, type, 0, "int" +HKR, Ndi\Params\MaxSpeed, default, 0, "100" +HKR, Ndi\Params\MaxSpeed, min, 0, "0" +HKR, Ndi\Params\MaxSpeed, max, 0, "2000" +HKR, Ndi\Params\MaxSpeed, step, 0, "1" +HKR, Ndi\Params\MaxSpeed, Base, 0, "10" +HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% +HKR, Ndi\Params\KeepLink, type, 0, "enum" +HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% +HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% +HKR, Ndi\Params\KeepLink, default, 0, "0" + + +[Neo.Service] +DisplayName = %Neo.Service.DispName% +Description = %Neo.Service.Desc% +ServiceType = 1 +StartType = 3 +ErrorControl = 1 +ServiceBinary = %12%\Neo6_x64_VPN120.sys +LoadOrderGroup = NDIS + +[Neo.Reg] +HKR, Ndi, Service, 0, Neo.Service.Name +HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" +HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" + +[Neo.EventLog] +HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo6_x64_VPN120.sys" +HKR, , TypesSupported, 0x00010001, 7 + +[Strings] +CompanyName = "SoftEther Corporation" +DiskDescription = "VPN Client Device Driver Install Disk" +Neo.Service.Name = "Neo_VPN120" +Neo.Service.DispName = "VPN Client Device Driver - VPN120" +Neo.Service.Desc = "VPN Client Adapter - VPN120" +NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN120" +Neo.EventLog.Name = "Neo" +NetworkAddress = "MAC Address" +DefaultAddress = "000001000001" +MaxSpeed = "Indicate Speed (Mbps)" +KeepLink = "Keep Link" +On = "On" +Off = "Off" + + +; Auto Generated 20180205_163629.881 + diff --git a/src/bin/hamcore/DriverPackages/Neo6_Win10/x64/Neo6_x64_VPN121.inf b/src/bin/hamcore/DriverPackages/Neo6_Win10/x64/Neo6_x64_VPN121.inf index 9f764caa..a618bde4 100644 --- a/src/bin/hamcore/DriverPackages/Neo6_Win10/x64/Neo6_x64_VPN121.inf +++ b/src/bin/hamcore/DriverPackages/Neo6_Win10/x64/Neo6_x64_VPN121.inf @@ -1,114 +1,114 @@ -; VPN Client Device Driver for Windows 2000 and Greater -; -; Copyright (c) SoftEther Corporation. All Rights Reserved. -; http://www.softether.co.jp/ -; -; BUILD 9658 - -[Version] -Signature = "$Windows NT$" -Class = Net -ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} -Provider = %CompanyName% -DriverVer = 02/04/2018, 4.25.0.9658 -CatalogFile.NT = Neo6_x64_VPN121.cat - -[Manufacturer] -%CompanyName% = SoftEther, NTamd64 - -[SourceDisksNames] -1=%DiskDescription%, "", , - -[SourceDisksFiles] -Neo6_x64_VPN121.sys = 1 - -[DestinationDirs] -DefaultDestDir = 12 -Neo.CopyFiles.Sys = 12 - -[Neo.CopyFiles.Sys] -Neo6_x64_VPN121.sys, , , 2 - -[SoftEther.NTamd64] -%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN121 - -[NeoAdapter.Install] -Characteristics = 0x1 -AddReg = Neo.Reg, NeoAdapter.Ndi -CopyFiles = Neo.CopyFiles.Sys -*IfType = 53 -*MediaType = 0 -*PhysicalMediaType = 0 - -[NeoAdapter.Install.Services] -AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% - -[NeoAdapter.Ndi] -HKR, , NetworkAddress, 0, %DefaultAddress% -HKR, Ndi, DeviceID, , "NeoAdapter_VPN121" -HKR, , DevLoader, , ndis -HKR, , DeviceVxDs, , Neo6_x64_VPN121.sys -HKR, NDIS, LogDriverName, , "Neo_VPN121" -HKR, NDIS, MajorNdisVersion, 1, 5 -HKR, NDIS, MinorNdisVersion, 1, 0 -HKR, Ndi\Interfaces, DefUpper, , "ndis5" -HKR, Ndi\Interfaces, UpperRange, , "ndis5" -HKR, Ndi\Interfaces, LowerRange, , "ethernet" -HKR, Ndi\Interfaces, DefLower, , "ethernet" -HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" -HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% -HKR, Ndi\Params\NetworkAddress, type, 0, "edit" -HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" -HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" -HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% -HKR, Ndi\Params\NetworkAddress, optional, 0, "0" -HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% -HKR, Ndi\Params\MaxSpeed, type, 0, "int" -HKR, Ndi\Params\MaxSpeed, default, 0, "100" -HKR, Ndi\Params\MaxSpeed, min, 0, "0" -HKR, Ndi\Params\MaxSpeed, max, 0, "2000" -HKR, Ndi\Params\MaxSpeed, step, 0, "1" -HKR, Ndi\Params\MaxSpeed, Base, 0, "10" -HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% -HKR, Ndi\Params\KeepLink, type, 0, "enum" -HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% -HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% -HKR, Ndi\Params\KeepLink, default, 0, "0" - - -[Neo.Service] -DisplayName = %Neo.Service.DispName% -Description = %Neo.Service.Desc% -ServiceType = 1 -StartType = 3 -ErrorControl = 1 -ServiceBinary = %12%\Neo6_x64_VPN121.sys -LoadOrderGroup = NDIS - -[Neo.Reg] -HKR, Ndi, Service, 0, Neo.Service.Name -HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" -HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" - -[Neo.EventLog] -HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo6_x64_VPN121.sys" -HKR, , TypesSupported, 0x00010001, 7 - -[Strings] -CompanyName = "SoftEther Corporation" -DiskDescription = "VPN Client Device Driver Install Disk" -Neo.Service.Name = "Neo_VPN121" -Neo.Service.DispName = "VPN Client Device Driver - VPN121" -Neo.Service.Desc = "VPN Client Adapter - VPN121" -NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN121" -Neo.EventLog.Name = "Neo" -NetworkAddress = "MAC Address" -DefaultAddress = "000001000001" -MaxSpeed = "Indicate Speed (Mbps)" -KeepLink = "Keep Link" -On = "On" -Off = "Off" - - -; Auto Generated 20180205_163629.951 - +; VPN Client Device Driver for Windows 2000 and Greater +; +; Copyright (c) SoftEther Corporation. All Rights Reserved. +; http://www.softether.co.jp/ +; +; BUILD 9658 + +[Version] +Signature = "$Windows NT$" +Class = Net +ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} +Provider = %CompanyName% +DriverVer = 02/04/2018, 4.25.0.9658 +CatalogFile.NT = Neo6_x64_VPN121.cat + +[Manufacturer] +%CompanyName% = SoftEther, NTamd64 + +[SourceDisksNames] +1=%DiskDescription%, "", , + +[SourceDisksFiles] +Neo6_x64_VPN121.sys = 1 + +[DestinationDirs] +DefaultDestDir = 12 +Neo.CopyFiles.Sys = 12 + +[Neo.CopyFiles.Sys] +Neo6_x64_VPN121.sys, , , 2 + +[SoftEther.NTamd64] +%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN121 + +[NeoAdapter.Install] +Characteristics = 0x1 +AddReg = Neo.Reg, NeoAdapter.Ndi +CopyFiles = Neo.CopyFiles.Sys +*IfType = 53 +*MediaType = 0 +*PhysicalMediaType = 0 + +[NeoAdapter.Install.Services] +AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% + +[NeoAdapter.Ndi] +HKR, , NetworkAddress, 0, %DefaultAddress% +HKR, Ndi, DeviceID, , "NeoAdapter_VPN121" +HKR, , DevLoader, , ndis +HKR, , DeviceVxDs, , Neo6_x64_VPN121.sys +HKR, NDIS, LogDriverName, , "Neo_VPN121" +HKR, NDIS, MajorNdisVersion, 1, 5 +HKR, NDIS, MinorNdisVersion, 1, 0 +HKR, Ndi\Interfaces, DefUpper, , "ndis5" +HKR, Ndi\Interfaces, UpperRange, , "ndis5" +HKR, Ndi\Interfaces, LowerRange, , "ethernet" +HKR, Ndi\Interfaces, DefLower, , "ethernet" +HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" +HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% +HKR, Ndi\Params\NetworkAddress, type, 0, "edit" +HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" +HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" +HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% +HKR, Ndi\Params\NetworkAddress, optional, 0, "0" +HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% +HKR, Ndi\Params\MaxSpeed, type, 0, "int" +HKR, Ndi\Params\MaxSpeed, default, 0, "100" +HKR, Ndi\Params\MaxSpeed, min, 0, "0" +HKR, Ndi\Params\MaxSpeed, max, 0, "2000" +HKR, Ndi\Params\MaxSpeed, step, 0, "1" +HKR, Ndi\Params\MaxSpeed, Base, 0, "10" +HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% +HKR, Ndi\Params\KeepLink, type, 0, "enum" +HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% +HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% +HKR, Ndi\Params\KeepLink, default, 0, "0" + + +[Neo.Service] +DisplayName = %Neo.Service.DispName% +Description = %Neo.Service.Desc% +ServiceType = 1 +StartType = 3 +ErrorControl = 1 +ServiceBinary = %12%\Neo6_x64_VPN121.sys +LoadOrderGroup = NDIS + +[Neo.Reg] +HKR, Ndi, Service, 0, Neo.Service.Name +HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" +HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" + +[Neo.EventLog] +HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo6_x64_VPN121.sys" +HKR, , TypesSupported, 0x00010001, 7 + +[Strings] +CompanyName = "SoftEther Corporation" +DiskDescription = "VPN Client Device Driver Install Disk" +Neo.Service.Name = "Neo_VPN121" +Neo.Service.DispName = "VPN Client Device Driver - VPN121" +Neo.Service.Desc = "VPN Client Adapter - VPN121" +NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN121" +Neo.EventLog.Name = "Neo" +NetworkAddress = "MAC Address" +DefaultAddress = "000001000001" +MaxSpeed = "Indicate Speed (Mbps)" +KeepLink = "Keep Link" +On = "On" +Off = "Off" + + +; Auto Generated 20180205_163629.951 + diff --git a/src/bin/hamcore/DriverPackages/Neo6_Win10/x64/Neo6_x64_VPN122.inf b/src/bin/hamcore/DriverPackages/Neo6_Win10/x64/Neo6_x64_VPN122.inf index a7f9ab87..775b5ab8 100644 --- a/src/bin/hamcore/DriverPackages/Neo6_Win10/x64/Neo6_x64_VPN122.inf +++ b/src/bin/hamcore/DriverPackages/Neo6_Win10/x64/Neo6_x64_VPN122.inf @@ -1,114 +1,114 @@ -; VPN Client Device Driver for Windows 2000 and Greater -; -; Copyright (c) SoftEther Corporation. All Rights Reserved. -; http://www.softether.co.jp/ -; -; BUILD 9658 - -[Version] -Signature = "$Windows NT$" -Class = Net -ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} -Provider = %CompanyName% -DriverVer = 02/04/2018, 4.25.0.9658 -CatalogFile.NT = Neo6_x64_VPN122.cat - -[Manufacturer] -%CompanyName% = SoftEther, NTamd64 - -[SourceDisksNames] -1=%DiskDescription%, "", , - -[SourceDisksFiles] -Neo6_x64_VPN122.sys = 1 - -[DestinationDirs] -DefaultDestDir = 12 -Neo.CopyFiles.Sys = 12 - -[Neo.CopyFiles.Sys] -Neo6_x64_VPN122.sys, , , 2 - -[SoftEther.NTamd64] -%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN122 - -[NeoAdapter.Install] -Characteristics = 0x1 -AddReg = Neo.Reg, NeoAdapter.Ndi -CopyFiles = Neo.CopyFiles.Sys -*IfType = 53 -*MediaType = 0 -*PhysicalMediaType = 0 - -[NeoAdapter.Install.Services] -AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% - -[NeoAdapter.Ndi] -HKR, , NetworkAddress, 0, %DefaultAddress% -HKR, Ndi, DeviceID, , "NeoAdapter_VPN122" -HKR, , DevLoader, , ndis -HKR, , DeviceVxDs, , Neo6_x64_VPN122.sys -HKR, NDIS, LogDriverName, , "Neo_VPN122" -HKR, NDIS, MajorNdisVersion, 1, 5 -HKR, NDIS, MinorNdisVersion, 1, 0 -HKR, Ndi\Interfaces, DefUpper, , "ndis5" -HKR, Ndi\Interfaces, UpperRange, , "ndis5" -HKR, Ndi\Interfaces, LowerRange, , "ethernet" -HKR, Ndi\Interfaces, DefLower, , "ethernet" -HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" -HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% -HKR, Ndi\Params\NetworkAddress, type, 0, "edit" -HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" -HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" -HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% -HKR, Ndi\Params\NetworkAddress, optional, 0, "0" -HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% -HKR, Ndi\Params\MaxSpeed, type, 0, "int" -HKR, Ndi\Params\MaxSpeed, default, 0, "100" -HKR, Ndi\Params\MaxSpeed, min, 0, "0" -HKR, Ndi\Params\MaxSpeed, max, 0, "2000" -HKR, Ndi\Params\MaxSpeed, step, 0, "1" -HKR, Ndi\Params\MaxSpeed, Base, 0, "10" -HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% -HKR, Ndi\Params\KeepLink, type, 0, "enum" -HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% -HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% -HKR, Ndi\Params\KeepLink, default, 0, "0" - - -[Neo.Service] -DisplayName = %Neo.Service.DispName% -Description = %Neo.Service.Desc% -ServiceType = 1 -StartType = 3 -ErrorControl = 1 -ServiceBinary = %12%\Neo6_x64_VPN122.sys -LoadOrderGroup = NDIS - -[Neo.Reg] -HKR, Ndi, Service, 0, Neo.Service.Name -HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" -HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" - -[Neo.EventLog] -HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo6_x64_VPN122.sys" -HKR, , TypesSupported, 0x00010001, 7 - -[Strings] -CompanyName = "SoftEther Corporation" -DiskDescription = "VPN Client Device Driver Install Disk" -Neo.Service.Name = "Neo_VPN122" -Neo.Service.DispName = "VPN Client Device Driver - VPN122" -Neo.Service.Desc = "VPN Client Adapter - VPN122" -NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN122" -Neo.EventLog.Name = "Neo" -NetworkAddress = "MAC Address" -DefaultAddress = "000001000001" -MaxSpeed = "Indicate Speed (Mbps)" -KeepLink = "Keep Link" -On = "On" -Off = "Off" - - -; Auto Generated 20180205_163630.023 - +; VPN Client Device Driver for Windows 2000 and Greater +; +; Copyright (c) SoftEther Corporation. All Rights Reserved. +; http://www.softether.co.jp/ +; +; BUILD 9658 + +[Version] +Signature = "$Windows NT$" +Class = Net +ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} +Provider = %CompanyName% +DriverVer = 02/04/2018, 4.25.0.9658 +CatalogFile.NT = Neo6_x64_VPN122.cat + +[Manufacturer] +%CompanyName% = SoftEther, NTamd64 + +[SourceDisksNames] +1=%DiskDescription%, "", , + +[SourceDisksFiles] +Neo6_x64_VPN122.sys = 1 + +[DestinationDirs] +DefaultDestDir = 12 +Neo.CopyFiles.Sys = 12 + +[Neo.CopyFiles.Sys] +Neo6_x64_VPN122.sys, , , 2 + +[SoftEther.NTamd64] +%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN122 + +[NeoAdapter.Install] +Characteristics = 0x1 +AddReg = Neo.Reg, NeoAdapter.Ndi +CopyFiles = Neo.CopyFiles.Sys +*IfType = 53 +*MediaType = 0 +*PhysicalMediaType = 0 + +[NeoAdapter.Install.Services] +AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% + +[NeoAdapter.Ndi] +HKR, , NetworkAddress, 0, %DefaultAddress% +HKR, Ndi, DeviceID, , "NeoAdapter_VPN122" +HKR, , DevLoader, , ndis +HKR, , DeviceVxDs, , Neo6_x64_VPN122.sys +HKR, NDIS, LogDriverName, , "Neo_VPN122" +HKR, NDIS, MajorNdisVersion, 1, 5 +HKR, NDIS, MinorNdisVersion, 1, 0 +HKR, Ndi\Interfaces, DefUpper, , "ndis5" +HKR, Ndi\Interfaces, UpperRange, , "ndis5" +HKR, Ndi\Interfaces, LowerRange, , "ethernet" +HKR, Ndi\Interfaces, DefLower, , "ethernet" +HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" +HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% +HKR, Ndi\Params\NetworkAddress, type, 0, "edit" +HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" +HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" +HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% +HKR, Ndi\Params\NetworkAddress, optional, 0, "0" +HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% +HKR, Ndi\Params\MaxSpeed, type, 0, "int" +HKR, Ndi\Params\MaxSpeed, default, 0, "100" +HKR, Ndi\Params\MaxSpeed, min, 0, "0" +HKR, Ndi\Params\MaxSpeed, max, 0, "2000" +HKR, Ndi\Params\MaxSpeed, step, 0, "1" +HKR, Ndi\Params\MaxSpeed, Base, 0, "10" +HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% +HKR, Ndi\Params\KeepLink, type, 0, "enum" +HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% +HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% +HKR, Ndi\Params\KeepLink, default, 0, "0" + + +[Neo.Service] +DisplayName = %Neo.Service.DispName% +Description = %Neo.Service.Desc% +ServiceType = 1 +StartType = 3 +ErrorControl = 1 +ServiceBinary = %12%\Neo6_x64_VPN122.sys +LoadOrderGroup = NDIS + +[Neo.Reg] +HKR, Ndi, Service, 0, Neo.Service.Name +HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" +HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" + +[Neo.EventLog] +HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo6_x64_VPN122.sys" +HKR, , TypesSupported, 0x00010001, 7 + +[Strings] +CompanyName = "SoftEther Corporation" +DiskDescription = "VPN Client Device Driver Install Disk" +Neo.Service.Name = "Neo_VPN122" +Neo.Service.DispName = "VPN Client Device Driver - VPN122" +Neo.Service.Desc = "VPN Client Adapter - VPN122" +NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN122" +Neo.EventLog.Name = "Neo" +NetworkAddress = "MAC Address" +DefaultAddress = "000001000001" +MaxSpeed = "Indicate Speed (Mbps)" +KeepLink = "Keep Link" +On = "On" +Off = "Off" + + +; Auto Generated 20180205_163630.023 + diff --git a/src/bin/hamcore/DriverPackages/Neo6_Win10/x64/Neo6_x64_VPN123.inf b/src/bin/hamcore/DriverPackages/Neo6_Win10/x64/Neo6_x64_VPN123.inf index fec2e29f..9d951263 100644 --- a/src/bin/hamcore/DriverPackages/Neo6_Win10/x64/Neo6_x64_VPN123.inf +++ b/src/bin/hamcore/DriverPackages/Neo6_Win10/x64/Neo6_x64_VPN123.inf @@ -1,114 +1,114 @@ -; VPN Client Device Driver for Windows 2000 and Greater -; -; Copyright (c) SoftEther Corporation. All Rights Reserved. -; http://www.softether.co.jp/ -; -; BUILD 9658 - -[Version] -Signature = "$Windows NT$" -Class = Net -ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} -Provider = %CompanyName% -DriverVer = 02/04/2018, 4.25.0.9658 -CatalogFile.NT = Neo6_x64_VPN123.cat - -[Manufacturer] -%CompanyName% = SoftEther, NTamd64 - -[SourceDisksNames] -1=%DiskDescription%, "", , - -[SourceDisksFiles] -Neo6_x64_VPN123.sys = 1 - -[DestinationDirs] -DefaultDestDir = 12 -Neo.CopyFiles.Sys = 12 - -[Neo.CopyFiles.Sys] -Neo6_x64_VPN123.sys, , , 2 - -[SoftEther.NTamd64] -%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN123 - -[NeoAdapter.Install] -Characteristics = 0x1 -AddReg = Neo.Reg, NeoAdapter.Ndi -CopyFiles = Neo.CopyFiles.Sys -*IfType = 53 -*MediaType = 0 -*PhysicalMediaType = 0 - -[NeoAdapter.Install.Services] -AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% - -[NeoAdapter.Ndi] -HKR, , NetworkAddress, 0, %DefaultAddress% -HKR, Ndi, DeviceID, , "NeoAdapter_VPN123" -HKR, , DevLoader, , ndis -HKR, , DeviceVxDs, , Neo6_x64_VPN123.sys -HKR, NDIS, LogDriverName, , "Neo_VPN123" -HKR, NDIS, MajorNdisVersion, 1, 5 -HKR, NDIS, MinorNdisVersion, 1, 0 -HKR, Ndi\Interfaces, DefUpper, , "ndis5" -HKR, Ndi\Interfaces, UpperRange, , "ndis5" -HKR, Ndi\Interfaces, LowerRange, , "ethernet" -HKR, Ndi\Interfaces, DefLower, , "ethernet" -HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" -HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% -HKR, Ndi\Params\NetworkAddress, type, 0, "edit" -HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" -HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" -HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% -HKR, Ndi\Params\NetworkAddress, optional, 0, "0" -HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% -HKR, Ndi\Params\MaxSpeed, type, 0, "int" -HKR, Ndi\Params\MaxSpeed, default, 0, "100" -HKR, Ndi\Params\MaxSpeed, min, 0, "0" -HKR, Ndi\Params\MaxSpeed, max, 0, "2000" -HKR, Ndi\Params\MaxSpeed, step, 0, "1" -HKR, Ndi\Params\MaxSpeed, Base, 0, "10" -HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% -HKR, Ndi\Params\KeepLink, type, 0, "enum" -HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% -HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% -HKR, Ndi\Params\KeepLink, default, 0, "0" - - -[Neo.Service] -DisplayName = %Neo.Service.DispName% -Description = %Neo.Service.Desc% -ServiceType = 1 -StartType = 3 -ErrorControl = 1 -ServiceBinary = %12%\Neo6_x64_VPN123.sys -LoadOrderGroup = NDIS - -[Neo.Reg] -HKR, Ndi, Service, 0, Neo.Service.Name -HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" -HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" - -[Neo.EventLog] -HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo6_x64_VPN123.sys" -HKR, , TypesSupported, 0x00010001, 7 - -[Strings] -CompanyName = "SoftEther Corporation" -DiskDescription = "VPN Client Device Driver Install Disk" -Neo.Service.Name = "Neo_VPN123" -Neo.Service.DispName = "VPN Client Device Driver - VPN123" -Neo.Service.Desc = "VPN Client Adapter - VPN123" -NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN123" -Neo.EventLog.Name = "Neo" -NetworkAddress = "MAC Address" -DefaultAddress = "000001000001" -MaxSpeed = "Indicate Speed (Mbps)" -KeepLink = "Keep Link" -On = "On" -Off = "Off" - - -; Auto Generated 20180205_163630.096 - +; VPN Client Device Driver for Windows 2000 and Greater +; +; Copyright (c) SoftEther Corporation. All Rights Reserved. +; http://www.softether.co.jp/ +; +; BUILD 9658 + +[Version] +Signature = "$Windows NT$" +Class = Net +ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} +Provider = %CompanyName% +DriverVer = 02/04/2018, 4.25.0.9658 +CatalogFile.NT = Neo6_x64_VPN123.cat + +[Manufacturer] +%CompanyName% = SoftEther, NTamd64 + +[SourceDisksNames] +1=%DiskDescription%, "", , + +[SourceDisksFiles] +Neo6_x64_VPN123.sys = 1 + +[DestinationDirs] +DefaultDestDir = 12 +Neo.CopyFiles.Sys = 12 + +[Neo.CopyFiles.Sys] +Neo6_x64_VPN123.sys, , , 2 + +[SoftEther.NTamd64] +%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN123 + +[NeoAdapter.Install] +Characteristics = 0x1 +AddReg = Neo.Reg, NeoAdapter.Ndi +CopyFiles = Neo.CopyFiles.Sys +*IfType = 53 +*MediaType = 0 +*PhysicalMediaType = 0 + +[NeoAdapter.Install.Services] +AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% + +[NeoAdapter.Ndi] +HKR, , NetworkAddress, 0, %DefaultAddress% +HKR, Ndi, DeviceID, , "NeoAdapter_VPN123" +HKR, , DevLoader, , ndis +HKR, , DeviceVxDs, , Neo6_x64_VPN123.sys +HKR, NDIS, LogDriverName, , "Neo_VPN123" +HKR, NDIS, MajorNdisVersion, 1, 5 +HKR, NDIS, MinorNdisVersion, 1, 0 +HKR, Ndi\Interfaces, DefUpper, , "ndis5" +HKR, Ndi\Interfaces, UpperRange, , "ndis5" +HKR, Ndi\Interfaces, LowerRange, , "ethernet" +HKR, Ndi\Interfaces, DefLower, , "ethernet" +HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" +HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% +HKR, Ndi\Params\NetworkAddress, type, 0, "edit" +HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" +HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" +HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% +HKR, Ndi\Params\NetworkAddress, optional, 0, "0" +HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% +HKR, Ndi\Params\MaxSpeed, type, 0, "int" +HKR, Ndi\Params\MaxSpeed, default, 0, "100" +HKR, Ndi\Params\MaxSpeed, min, 0, "0" +HKR, Ndi\Params\MaxSpeed, max, 0, "2000" +HKR, Ndi\Params\MaxSpeed, step, 0, "1" +HKR, Ndi\Params\MaxSpeed, Base, 0, "10" +HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% +HKR, Ndi\Params\KeepLink, type, 0, "enum" +HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% +HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% +HKR, Ndi\Params\KeepLink, default, 0, "0" + + +[Neo.Service] +DisplayName = %Neo.Service.DispName% +Description = %Neo.Service.Desc% +ServiceType = 1 +StartType = 3 +ErrorControl = 1 +ServiceBinary = %12%\Neo6_x64_VPN123.sys +LoadOrderGroup = NDIS + +[Neo.Reg] +HKR, Ndi, Service, 0, Neo.Service.Name +HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" +HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" + +[Neo.EventLog] +HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo6_x64_VPN123.sys" +HKR, , TypesSupported, 0x00010001, 7 + +[Strings] +CompanyName = "SoftEther Corporation" +DiskDescription = "VPN Client Device Driver Install Disk" +Neo.Service.Name = "Neo_VPN123" +Neo.Service.DispName = "VPN Client Device Driver - VPN123" +Neo.Service.Desc = "VPN Client Adapter - VPN123" +NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN123" +Neo.EventLog.Name = "Neo" +NetworkAddress = "MAC Address" +DefaultAddress = "000001000001" +MaxSpeed = "Indicate Speed (Mbps)" +KeepLink = "Keep Link" +On = "On" +Off = "Off" + + +; Auto Generated 20180205_163630.096 + diff --git a/src/bin/hamcore/DriverPackages/Neo6_Win10/x64/Neo6_x64_VPN124.inf b/src/bin/hamcore/DriverPackages/Neo6_Win10/x64/Neo6_x64_VPN124.inf index 16fbd3e6..278a6fc9 100644 --- a/src/bin/hamcore/DriverPackages/Neo6_Win10/x64/Neo6_x64_VPN124.inf +++ b/src/bin/hamcore/DriverPackages/Neo6_Win10/x64/Neo6_x64_VPN124.inf @@ -1,114 +1,114 @@ -; VPN Client Device Driver for Windows 2000 and Greater -; -; Copyright (c) SoftEther Corporation. All Rights Reserved. -; http://www.softether.co.jp/ -; -; BUILD 9658 - -[Version] -Signature = "$Windows NT$" -Class = Net -ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} -Provider = %CompanyName% -DriverVer = 02/04/2018, 4.25.0.9658 -CatalogFile.NT = Neo6_x64_VPN124.cat - -[Manufacturer] -%CompanyName% = SoftEther, NTamd64 - -[SourceDisksNames] -1=%DiskDescription%, "", , - -[SourceDisksFiles] -Neo6_x64_VPN124.sys = 1 - -[DestinationDirs] -DefaultDestDir = 12 -Neo.CopyFiles.Sys = 12 - -[Neo.CopyFiles.Sys] -Neo6_x64_VPN124.sys, , , 2 - -[SoftEther.NTamd64] -%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN124 - -[NeoAdapter.Install] -Characteristics = 0x1 -AddReg = Neo.Reg, NeoAdapter.Ndi -CopyFiles = Neo.CopyFiles.Sys -*IfType = 53 -*MediaType = 0 -*PhysicalMediaType = 0 - -[NeoAdapter.Install.Services] -AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% - -[NeoAdapter.Ndi] -HKR, , NetworkAddress, 0, %DefaultAddress% -HKR, Ndi, DeviceID, , "NeoAdapter_VPN124" -HKR, , DevLoader, , ndis -HKR, , DeviceVxDs, , Neo6_x64_VPN124.sys -HKR, NDIS, LogDriverName, , "Neo_VPN124" -HKR, NDIS, MajorNdisVersion, 1, 5 -HKR, NDIS, MinorNdisVersion, 1, 0 -HKR, Ndi\Interfaces, DefUpper, , "ndis5" -HKR, Ndi\Interfaces, UpperRange, , "ndis5" -HKR, Ndi\Interfaces, LowerRange, , "ethernet" -HKR, Ndi\Interfaces, DefLower, , "ethernet" -HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" -HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% -HKR, Ndi\Params\NetworkAddress, type, 0, "edit" -HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" -HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" -HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% -HKR, Ndi\Params\NetworkAddress, optional, 0, "0" -HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% -HKR, Ndi\Params\MaxSpeed, type, 0, "int" -HKR, Ndi\Params\MaxSpeed, default, 0, "100" -HKR, Ndi\Params\MaxSpeed, min, 0, "0" -HKR, Ndi\Params\MaxSpeed, max, 0, "2000" -HKR, Ndi\Params\MaxSpeed, step, 0, "1" -HKR, Ndi\Params\MaxSpeed, Base, 0, "10" -HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% -HKR, Ndi\Params\KeepLink, type, 0, "enum" -HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% -HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% -HKR, Ndi\Params\KeepLink, default, 0, "0" - - -[Neo.Service] -DisplayName = %Neo.Service.DispName% -Description = %Neo.Service.Desc% -ServiceType = 1 -StartType = 3 -ErrorControl = 1 -ServiceBinary = %12%\Neo6_x64_VPN124.sys -LoadOrderGroup = NDIS - -[Neo.Reg] -HKR, Ndi, Service, 0, Neo.Service.Name -HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" -HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" - -[Neo.EventLog] -HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo6_x64_VPN124.sys" -HKR, , TypesSupported, 0x00010001, 7 - -[Strings] -CompanyName = "SoftEther Corporation" -DiskDescription = "VPN Client Device Driver Install Disk" -Neo.Service.Name = "Neo_VPN124" -Neo.Service.DispName = "VPN Client Device Driver - VPN124" -Neo.Service.Desc = "VPN Client Adapter - VPN124" -NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN124" -Neo.EventLog.Name = "Neo" -NetworkAddress = "MAC Address" -DefaultAddress = "000001000001" -MaxSpeed = "Indicate Speed (Mbps)" -KeepLink = "Keep Link" -On = "On" -Off = "Off" - - -; Auto Generated 20180205_163630.167 - +; VPN Client Device Driver for Windows 2000 and Greater +; +; Copyright (c) SoftEther Corporation. All Rights Reserved. +; http://www.softether.co.jp/ +; +; BUILD 9658 + +[Version] +Signature = "$Windows NT$" +Class = Net +ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} +Provider = %CompanyName% +DriverVer = 02/04/2018, 4.25.0.9658 +CatalogFile.NT = Neo6_x64_VPN124.cat + +[Manufacturer] +%CompanyName% = SoftEther, NTamd64 + +[SourceDisksNames] +1=%DiskDescription%, "", , + +[SourceDisksFiles] +Neo6_x64_VPN124.sys = 1 + +[DestinationDirs] +DefaultDestDir = 12 +Neo.CopyFiles.Sys = 12 + +[Neo.CopyFiles.Sys] +Neo6_x64_VPN124.sys, , , 2 + +[SoftEther.NTamd64] +%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN124 + +[NeoAdapter.Install] +Characteristics = 0x1 +AddReg = Neo.Reg, NeoAdapter.Ndi +CopyFiles = Neo.CopyFiles.Sys +*IfType = 53 +*MediaType = 0 +*PhysicalMediaType = 0 + +[NeoAdapter.Install.Services] +AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% + +[NeoAdapter.Ndi] +HKR, , NetworkAddress, 0, %DefaultAddress% +HKR, Ndi, DeviceID, , "NeoAdapter_VPN124" +HKR, , DevLoader, , ndis +HKR, , DeviceVxDs, , Neo6_x64_VPN124.sys +HKR, NDIS, LogDriverName, , "Neo_VPN124" +HKR, NDIS, MajorNdisVersion, 1, 5 +HKR, NDIS, MinorNdisVersion, 1, 0 +HKR, Ndi\Interfaces, DefUpper, , "ndis5" +HKR, Ndi\Interfaces, UpperRange, , "ndis5" +HKR, Ndi\Interfaces, LowerRange, , "ethernet" +HKR, Ndi\Interfaces, DefLower, , "ethernet" +HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" +HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% +HKR, Ndi\Params\NetworkAddress, type, 0, "edit" +HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" +HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" +HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% +HKR, Ndi\Params\NetworkAddress, optional, 0, "0" +HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% +HKR, Ndi\Params\MaxSpeed, type, 0, "int" +HKR, Ndi\Params\MaxSpeed, default, 0, "100" +HKR, Ndi\Params\MaxSpeed, min, 0, "0" +HKR, Ndi\Params\MaxSpeed, max, 0, "2000" +HKR, Ndi\Params\MaxSpeed, step, 0, "1" +HKR, Ndi\Params\MaxSpeed, Base, 0, "10" +HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% +HKR, Ndi\Params\KeepLink, type, 0, "enum" +HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% +HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% +HKR, Ndi\Params\KeepLink, default, 0, "0" + + +[Neo.Service] +DisplayName = %Neo.Service.DispName% +Description = %Neo.Service.Desc% +ServiceType = 1 +StartType = 3 +ErrorControl = 1 +ServiceBinary = %12%\Neo6_x64_VPN124.sys +LoadOrderGroup = NDIS + +[Neo.Reg] +HKR, Ndi, Service, 0, Neo.Service.Name +HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" +HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" + +[Neo.EventLog] +HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo6_x64_VPN124.sys" +HKR, , TypesSupported, 0x00010001, 7 + +[Strings] +CompanyName = "SoftEther Corporation" +DiskDescription = "VPN Client Device Driver Install Disk" +Neo.Service.Name = "Neo_VPN124" +Neo.Service.DispName = "VPN Client Device Driver - VPN124" +Neo.Service.Desc = "VPN Client Adapter - VPN124" +NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN124" +Neo.EventLog.Name = "Neo" +NetworkAddress = "MAC Address" +DefaultAddress = "000001000001" +MaxSpeed = "Indicate Speed (Mbps)" +KeepLink = "Keep Link" +On = "On" +Off = "Off" + + +; Auto Generated 20180205_163630.167 + diff --git a/src/bin/hamcore/DriverPackages/Neo6_Win10/x64/Neo6_x64_VPN125.inf b/src/bin/hamcore/DriverPackages/Neo6_Win10/x64/Neo6_x64_VPN125.inf index a2c4452c..d2a1b60c 100644 --- a/src/bin/hamcore/DriverPackages/Neo6_Win10/x64/Neo6_x64_VPN125.inf +++ b/src/bin/hamcore/DriverPackages/Neo6_Win10/x64/Neo6_x64_VPN125.inf @@ -1,114 +1,114 @@ -; VPN Client Device Driver for Windows 2000 and Greater -; -; Copyright (c) SoftEther Corporation. All Rights Reserved. -; http://www.softether.co.jp/ -; -; BUILD 9658 - -[Version] -Signature = "$Windows NT$" -Class = Net -ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} -Provider = %CompanyName% -DriverVer = 02/04/2018, 4.25.0.9658 -CatalogFile.NT = Neo6_x64_VPN125.cat - -[Manufacturer] -%CompanyName% = SoftEther, NTamd64 - -[SourceDisksNames] -1=%DiskDescription%, "", , - -[SourceDisksFiles] -Neo6_x64_VPN125.sys = 1 - -[DestinationDirs] -DefaultDestDir = 12 -Neo.CopyFiles.Sys = 12 - -[Neo.CopyFiles.Sys] -Neo6_x64_VPN125.sys, , , 2 - -[SoftEther.NTamd64] -%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN125 - -[NeoAdapter.Install] -Characteristics = 0x1 -AddReg = Neo.Reg, NeoAdapter.Ndi -CopyFiles = Neo.CopyFiles.Sys -*IfType = 53 -*MediaType = 0 -*PhysicalMediaType = 0 - -[NeoAdapter.Install.Services] -AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% - -[NeoAdapter.Ndi] -HKR, , NetworkAddress, 0, %DefaultAddress% -HKR, Ndi, DeviceID, , "NeoAdapter_VPN125" -HKR, , DevLoader, , ndis -HKR, , DeviceVxDs, , Neo6_x64_VPN125.sys -HKR, NDIS, LogDriverName, , "Neo_VPN125" -HKR, NDIS, MajorNdisVersion, 1, 5 -HKR, NDIS, MinorNdisVersion, 1, 0 -HKR, Ndi\Interfaces, DefUpper, , "ndis5" -HKR, Ndi\Interfaces, UpperRange, , "ndis5" -HKR, Ndi\Interfaces, LowerRange, , "ethernet" -HKR, Ndi\Interfaces, DefLower, , "ethernet" -HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" -HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% -HKR, Ndi\Params\NetworkAddress, type, 0, "edit" -HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" -HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" -HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% -HKR, Ndi\Params\NetworkAddress, optional, 0, "0" -HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% -HKR, Ndi\Params\MaxSpeed, type, 0, "int" -HKR, Ndi\Params\MaxSpeed, default, 0, "100" -HKR, Ndi\Params\MaxSpeed, min, 0, "0" -HKR, Ndi\Params\MaxSpeed, max, 0, "2000" -HKR, Ndi\Params\MaxSpeed, step, 0, "1" -HKR, Ndi\Params\MaxSpeed, Base, 0, "10" -HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% -HKR, Ndi\Params\KeepLink, type, 0, "enum" -HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% -HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% -HKR, Ndi\Params\KeepLink, default, 0, "0" - - -[Neo.Service] -DisplayName = %Neo.Service.DispName% -Description = %Neo.Service.Desc% -ServiceType = 1 -StartType = 3 -ErrorControl = 1 -ServiceBinary = %12%\Neo6_x64_VPN125.sys -LoadOrderGroup = NDIS - -[Neo.Reg] -HKR, Ndi, Service, 0, Neo.Service.Name -HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" -HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" - -[Neo.EventLog] -HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo6_x64_VPN125.sys" -HKR, , TypesSupported, 0x00010001, 7 - -[Strings] -CompanyName = "SoftEther Corporation" -DiskDescription = "VPN Client Device Driver Install Disk" -Neo.Service.Name = "Neo_VPN125" -Neo.Service.DispName = "VPN Client Device Driver - VPN125" -Neo.Service.Desc = "VPN Client Adapter - VPN125" -NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN125" -Neo.EventLog.Name = "Neo" -NetworkAddress = "MAC Address" -DefaultAddress = "000001000001" -MaxSpeed = "Indicate Speed (Mbps)" -KeepLink = "Keep Link" -On = "On" -Off = "Off" - - -; Auto Generated 20180205_163630.239 - +; VPN Client Device Driver for Windows 2000 and Greater +; +; Copyright (c) SoftEther Corporation. All Rights Reserved. +; http://www.softether.co.jp/ +; +; BUILD 9658 + +[Version] +Signature = "$Windows NT$" +Class = Net +ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} +Provider = %CompanyName% +DriverVer = 02/04/2018, 4.25.0.9658 +CatalogFile.NT = Neo6_x64_VPN125.cat + +[Manufacturer] +%CompanyName% = SoftEther, NTamd64 + +[SourceDisksNames] +1=%DiskDescription%, "", , + +[SourceDisksFiles] +Neo6_x64_VPN125.sys = 1 + +[DestinationDirs] +DefaultDestDir = 12 +Neo.CopyFiles.Sys = 12 + +[Neo.CopyFiles.Sys] +Neo6_x64_VPN125.sys, , , 2 + +[SoftEther.NTamd64] +%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN125 + +[NeoAdapter.Install] +Characteristics = 0x1 +AddReg = Neo.Reg, NeoAdapter.Ndi +CopyFiles = Neo.CopyFiles.Sys +*IfType = 53 +*MediaType = 0 +*PhysicalMediaType = 0 + +[NeoAdapter.Install.Services] +AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% + +[NeoAdapter.Ndi] +HKR, , NetworkAddress, 0, %DefaultAddress% +HKR, Ndi, DeviceID, , "NeoAdapter_VPN125" +HKR, , DevLoader, , ndis +HKR, , DeviceVxDs, , Neo6_x64_VPN125.sys +HKR, NDIS, LogDriverName, , "Neo_VPN125" +HKR, NDIS, MajorNdisVersion, 1, 5 +HKR, NDIS, MinorNdisVersion, 1, 0 +HKR, Ndi\Interfaces, DefUpper, , "ndis5" +HKR, Ndi\Interfaces, UpperRange, , "ndis5" +HKR, Ndi\Interfaces, LowerRange, , "ethernet" +HKR, Ndi\Interfaces, DefLower, , "ethernet" +HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" +HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% +HKR, Ndi\Params\NetworkAddress, type, 0, "edit" +HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" +HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" +HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% +HKR, Ndi\Params\NetworkAddress, optional, 0, "0" +HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% +HKR, Ndi\Params\MaxSpeed, type, 0, "int" +HKR, Ndi\Params\MaxSpeed, default, 0, "100" +HKR, Ndi\Params\MaxSpeed, min, 0, "0" +HKR, Ndi\Params\MaxSpeed, max, 0, "2000" +HKR, Ndi\Params\MaxSpeed, step, 0, "1" +HKR, Ndi\Params\MaxSpeed, Base, 0, "10" +HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% +HKR, Ndi\Params\KeepLink, type, 0, "enum" +HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% +HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% +HKR, Ndi\Params\KeepLink, default, 0, "0" + + +[Neo.Service] +DisplayName = %Neo.Service.DispName% +Description = %Neo.Service.Desc% +ServiceType = 1 +StartType = 3 +ErrorControl = 1 +ServiceBinary = %12%\Neo6_x64_VPN125.sys +LoadOrderGroup = NDIS + +[Neo.Reg] +HKR, Ndi, Service, 0, Neo.Service.Name +HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" +HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" + +[Neo.EventLog] +HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo6_x64_VPN125.sys" +HKR, , TypesSupported, 0x00010001, 7 + +[Strings] +CompanyName = "SoftEther Corporation" +DiskDescription = "VPN Client Device Driver Install Disk" +Neo.Service.Name = "Neo_VPN125" +Neo.Service.DispName = "VPN Client Device Driver - VPN125" +Neo.Service.Desc = "VPN Client Adapter - VPN125" +NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN125" +Neo.EventLog.Name = "Neo" +NetworkAddress = "MAC Address" +DefaultAddress = "000001000001" +MaxSpeed = "Indicate Speed (Mbps)" +KeepLink = "Keep Link" +On = "On" +Off = "Off" + + +; Auto Generated 20180205_163630.239 + diff --git a/src/bin/hamcore/DriverPackages/Neo6_Win10/x64/Neo6_x64_VPN126.inf b/src/bin/hamcore/DriverPackages/Neo6_Win10/x64/Neo6_x64_VPN126.inf index 3e241e11..216252b3 100644 --- a/src/bin/hamcore/DriverPackages/Neo6_Win10/x64/Neo6_x64_VPN126.inf +++ b/src/bin/hamcore/DriverPackages/Neo6_Win10/x64/Neo6_x64_VPN126.inf @@ -1,114 +1,114 @@ -; VPN Client Device Driver for Windows 2000 and Greater -; -; Copyright (c) SoftEther Corporation. All Rights Reserved. -; http://www.softether.co.jp/ -; -; BUILD 9658 - -[Version] -Signature = "$Windows NT$" -Class = Net -ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} -Provider = %CompanyName% -DriverVer = 02/04/2018, 4.25.0.9658 -CatalogFile.NT = Neo6_x64_VPN126.cat - -[Manufacturer] -%CompanyName% = SoftEther, NTamd64 - -[SourceDisksNames] -1=%DiskDescription%, "", , - -[SourceDisksFiles] -Neo6_x64_VPN126.sys = 1 - -[DestinationDirs] -DefaultDestDir = 12 -Neo.CopyFiles.Sys = 12 - -[Neo.CopyFiles.Sys] -Neo6_x64_VPN126.sys, , , 2 - -[SoftEther.NTamd64] -%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN126 - -[NeoAdapter.Install] -Characteristics = 0x1 -AddReg = Neo.Reg, NeoAdapter.Ndi -CopyFiles = Neo.CopyFiles.Sys -*IfType = 53 -*MediaType = 0 -*PhysicalMediaType = 0 - -[NeoAdapter.Install.Services] -AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% - -[NeoAdapter.Ndi] -HKR, , NetworkAddress, 0, %DefaultAddress% -HKR, Ndi, DeviceID, , "NeoAdapter_VPN126" -HKR, , DevLoader, , ndis -HKR, , DeviceVxDs, , Neo6_x64_VPN126.sys -HKR, NDIS, LogDriverName, , "Neo_VPN126" -HKR, NDIS, MajorNdisVersion, 1, 5 -HKR, NDIS, MinorNdisVersion, 1, 0 -HKR, Ndi\Interfaces, DefUpper, , "ndis5" -HKR, Ndi\Interfaces, UpperRange, , "ndis5" -HKR, Ndi\Interfaces, LowerRange, , "ethernet" -HKR, Ndi\Interfaces, DefLower, , "ethernet" -HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" -HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% -HKR, Ndi\Params\NetworkAddress, type, 0, "edit" -HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" -HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" -HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% -HKR, Ndi\Params\NetworkAddress, optional, 0, "0" -HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% -HKR, Ndi\Params\MaxSpeed, type, 0, "int" -HKR, Ndi\Params\MaxSpeed, default, 0, "100" -HKR, Ndi\Params\MaxSpeed, min, 0, "0" -HKR, Ndi\Params\MaxSpeed, max, 0, "2000" -HKR, Ndi\Params\MaxSpeed, step, 0, "1" -HKR, Ndi\Params\MaxSpeed, Base, 0, "10" -HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% -HKR, Ndi\Params\KeepLink, type, 0, "enum" -HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% -HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% -HKR, Ndi\Params\KeepLink, default, 0, "0" - - -[Neo.Service] -DisplayName = %Neo.Service.DispName% -Description = %Neo.Service.Desc% -ServiceType = 1 -StartType = 3 -ErrorControl = 1 -ServiceBinary = %12%\Neo6_x64_VPN126.sys -LoadOrderGroup = NDIS - -[Neo.Reg] -HKR, Ndi, Service, 0, Neo.Service.Name -HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" -HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" - -[Neo.EventLog] -HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo6_x64_VPN126.sys" -HKR, , TypesSupported, 0x00010001, 7 - -[Strings] -CompanyName = "SoftEther Corporation" -DiskDescription = "VPN Client Device Driver Install Disk" -Neo.Service.Name = "Neo_VPN126" -Neo.Service.DispName = "VPN Client Device Driver - VPN126" -Neo.Service.Desc = "VPN Client Adapter - VPN126" -NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN126" -Neo.EventLog.Name = "Neo" -NetworkAddress = "MAC Address" -DefaultAddress = "000001000001" -MaxSpeed = "Indicate Speed (Mbps)" -KeepLink = "Keep Link" -On = "On" -Off = "Off" - - -; Auto Generated 20180205_163630.310 - +; VPN Client Device Driver for Windows 2000 and Greater +; +; Copyright (c) SoftEther Corporation. All Rights Reserved. +; http://www.softether.co.jp/ +; +; BUILD 9658 + +[Version] +Signature = "$Windows NT$" +Class = Net +ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} +Provider = %CompanyName% +DriverVer = 02/04/2018, 4.25.0.9658 +CatalogFile.NT = Neo6_x64_VPN126.cat + +[Manufacturer] +%CompanyName% = SoftEther, NTamd64 + +[SourceDisksNames] +1=%DiskDescription%, "", , + +[SourceDisksFiles] +Neo6_x64_VPN126.sys = 1 + +[DestinationDirs] +DefaultDestDir = 12 +Neo.CopyFiles.Sys = 12 + +[Neo.CopyFiles.Sys] +Neo6_x64_VPN126.sys, , , 2 + +[SoftEther.NTamd64] +%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN126 + +[NeoAdapter.Install] +Characteristics = 0x1 +AddReg = Neo.Reg, NeoAdapter.Ndi +CopyFiles = Neo.CopyFiles.Sys +*IfType = 53 +*MediaType = 0 +*PhysicalMediaType = 0 + +[NeoAdapter.Install.Services] +AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% + +[NeoAdapter.Ndi] +HKR, , NetworkAddress, 0, %DefaultAddress% +HKR, Ndi, DeviceID, , "NeoAdapter_VPN126" +HKR, , DevLoader, , ndis +HKR, , DeviceVxDs, , Neo6_x64_VPN126.sys +HKR, NDIS, LogDriverName, , "Neo_VPN126" +HKR, NDIS, MajorNdisVersion, 1, 5 +HKR, NDIS, MinorNdisVersion, 1, 0 +HKR, Ndi\Interfaces, DefUpper, , "ndis5" +HKR, Ndi\Interfaces, UpperRange, , "ndis5" +HKR, Ndi\Interfaces, LowerRange, , "ethernet" +HKR, Ndi\Interfaces, DefLower, , "ethernet" +HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" +HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% +HKR, Ndi\Params\NetworkAddress, type, 0, "edit" +HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" +HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" +HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% +HKR, Ndi\Params\NetworkAddress, optional, 0, "0" +HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% +HKR, Ndi\Params\MaxSpeed, type, 0, "int" +HKR, Ndi\Params\MaxSpeed, default, 0, "100" +HKR, Ndi\Params\MaxSpeed, min, 0, "0" +HKR, Ndi\Params\MaxSpeed, max, 0, "2000" +HKR, Ndi\Params\MaxSpeed, step, 0, "1" +HKR, Ndi\Params\MaxSpeed, Base, 0, "10" +HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% +HKR, Ndi\Params\KeepLink, type, 0, "enum" +HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% +HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% +HKR, Ndi\Params\KeepLink, default, 0, "0" + + +[Neo.Service] +DisplayName = %Neo.Service.DispName% +Description = %Neo.Service.Desc% +ServiceType = 1 +StartType = 3 +ErrorControl = 1 +ServiceBinary = %12%\Neo6_x64_VPN126.sys +LoadOrderGroup = NDIS + +[Neo.Reg] +HKR, Ndi, Service, 0, Neo.Service.Name +HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" +HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" + +[Neo.EventLog] +HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo6_x64_VPN126.sys" +HKR, , TypesSupported, 0x00010001, 7 + +[Strings] +CompanyName = "SoftEther Corporation" +DiskDescription = "VPN Client Device Driver Install Disk" +Neo.Service.Name = "Neo_VPN126" +Neo.Service.DispName = "VPN Client Device Driver - VPN126" +Neo.Service.Desc = "VPN Client Adapter - VPN126" +NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN126" +Neo.EventLog.Name = "Neo" +NetworkAddress = "MAC Address" +DefaultAddress = "000001000001" +MaxSpeed = "Indicate Speed (Mbps)" +KeepLink = "Keep Link" +On = "On" +Off = "Off" + + +; Auto Generated 20180205_163630.310 + diff --git a/src/bin/hamcore/DriverPackages/Neo6_Win10/x64/Neo6_x64_VPN127.inf b/src/bin/hamcore/DriverPackages/Neo6_Win10/x64/Neo6_x64_VPN127.inf index 9246511d..453df1d3 100644 --- a/src/bin/hamcore/DriverPackages/Neo6_Win10/x64/Neo6_x64_VPN127.inf +++ b/src/bin/hamcore/DriverPackages/Neo6_Win10/x64/Neo6_x64_VPN127.inf @@ -1,114 +1,114 @@ -; VPN Client Device Driver for Windows 2000 and Greater -; -; Copyright (c) SoftEther Corporation. All Rights Reserved. -; http://www.softether.co.jp/ -; -; BUILD 9658 - -[Version] -Signature = "$Windows NT$" -Class = Net -ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} -Provider = %CompanyName% -DriverVer = 02/04/2018, 4.25.0.9658 -CatalogFile.NT = Neo6_x64_VPN127.cat - -[Manufacturer] -%CompanyName% = SoftEther, NTamd64 - -[SourceDisksNames] -1=%DiskDescription%, "", , - -[SourceDisksFiles] -Neo6_x64_VPN127.sys = 1 - -[DestinationDirs] -DefaultDestDir = 12 -Neo.CopyFiles.Sys = 12 - -[Neo.CopyFiles.Sys] -Neo6_x64_VPN127.sys, , , 2 - -[SoftEther.NTamd64] -%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN127 - -[NeoAdapter.Install] -Characteristics = 0x1 -AddReg = Neo.Reg, NeoAdapter.Ndi -CopyFiles = Neo.CopyFiles.Sys -*IfType = 53 -*MediaType = 0 -*PhysicalMediaType = 0 - -[NeoAdapter.Install.Services] -AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% - -[NeoAdapter.Ndi] -HKR, , NetworkAddress, 0, %DefaultAddress% -HKR, Ndi, DeviceID, , "NeoAdapter_VPN127" -HKR, , DevLoader, , ndis -HKR, , DeviceVxDs, , Neo6_x64_VPN127.sys -HKR, NDIS, LogDriverName, , "Neo_VPN127" -HKR, NDIS, MajorNdisVersion, 1, 5 -HKR, NDIS, MinorNdisVersion, 1, 0 -HKR, Ndi\Interfaces, DefUpper, , "ndis5" -HKR, Ndi\Interfaces, UpperRange, , "ndis5" -HKR, Ndi\Interfaces, LowerRange, , "ethernet" -HKR, Ndi\Interfaces, DefLower, , "ethernet" -HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" -HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% -HKR, Ndi\Params\NetworkAddress, type, 0, "edit" -HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" -HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" -HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% -HKR, Ndi\Params\NetworkAddress, optional, 0, "0" -HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% -HKR, Ndi\Params\MaxSpeed, type, 0, "int" -HKR, Ndi\Params\MaxSpeed, default, 0, "100" -HKR, Ndi\Params\MaxSpeed, min, 0, "0" -HKR, Ndi\Params\MaxSpeed, max, 0, "2000" -HKR, Ndi\Params\MaxSpeed, step, 0, "1" -HKR, Ndi\Params\MaxSpeed, Base, 0, "10" -HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% -HKR, Ndi\Params\KeepLink, type, 0, "enum" -HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% -HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% -HKR, Ndi\Params\KeepLink, default, 0, "0" - - -[Neo.Service] -DisplayName = %Neo.Service.DispName% -Description = %Neo.Service.Desc% -ServiceType = 1 -StartType = 3 -ErrorControl = 1 -ServiceBinary = %12%\Neo6_x64_VPN127.sys -LoadOrderGroup = NDIS - -[Neo.Reg] -HKR, Ndi, Service, 0, Neo.Service.Name -HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" -HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" - -[Neo.EventLog] -HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo6_x64_VPN127.sys" -HKR, , TypesSupported, 0x00010001, 7 - -[Strings] -CompanyName = "SoftEther Corporation" -DiskDescription = "VPN Client Device Driver Install Disk" -Neo.Service.Name = "Neo_VPN127" -Neo.Service.DispName = "VPN Client Device Driver - VPN127" -Neo.Service.Desc = "VPN Client Adapter - VPN127" -NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN127" -Neo.EventLog.Name = "Neo" -NetworkAddress = "MAC Address" -DefaultAddress = "000001000001" -MaxSpeed = "Indicate Speed (Mbps)" -KeepLink = "Keep Link" -On = "On" -Off = "Off" - - -; Auto Generated 20180205_163630.382 - +; VPN Client Device Driver for Windows 2000 and Greater +; +; Copyright (c) SoftEther Corporation. All Rights Reserved. +; http://www.softether.co.jp/ +; +; BUILD 9658 + +[Version] +Signature = "$Windows NT$" +Class = Net +ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} +Provider = %CompanyName% +DriverVer = 02/04/2018, 4.25.0.9658 +CatalogFile.NT = Neo6_x64_VPN127.cat + +[Manufacturer] +%CompanyName% = SoftEther, NTamd64 + +[SourceDisksNames] +1=%DiskDescription%, "", , + +[SourceDisksFiles] +Neo6_x64_VPN127.sys = 1 + +[DestinationDirs] +DefaultDestDir = 12 +Neo.CopyFiles.Sys = 12 + +[Neo.CopyFiles.Sys] +Neo6_x64_VPN127.sys, , , 2 + +[SoftEther.NTamd64] +%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN127 + +[NeoAdapter.Install] +Characteristics = 0x1 +AddReg = Neo.Reg, NeoAdapter.Ndi +CopyFiles = Neo.CopyFiles.Sys +*IfType = 53 +*MediaType = 0 +*PhysicalMediaType = 0 + +[NeoAdapter.Install.Services] +AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% + +[NeoAdapter.Ndi] +HKR, , NetworkAddress, 0, %DefaultAddress% +HKR, Ndi, DeviceID, , "NeoAdapter_VPN127" +HKR, , DevLoader, , ndis +HKR, , DeviceVxDs, , Neo6_x64_VPN127.sys +HKR, NDIS, LogDriverName, , "Neo_VPN127" +HKR, NDIS, MajorNdisVersion, 1, 5 +HKR, NDIS, MinorNdisVersion, 1, 0 +HKR, Ndi\Interfaces, DefUpper, , "ndis5" +HKR, Ndi\Interfaces, UpperRange, , "ndis5" +HKR, Ndi\Interfaces, LowerRange, , "ethernet" +HKR, Ndi\Interfaces, DefLower, , "ethernet" +HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" +HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% +HKR, Ndi\Params\NetworkAddress, type, 0, "edit" +HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" +HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" +HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% +HKR, Ndi\Params\NetworkAddress, optional, 0, "0" +HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% +HKR, Ndi\Params\MaxSpeed, type, 0, "int" +HKR, Ndi\Params\MaxSpeed, default, 0, "100" +HKR, Ndi\Params\MaxSpeed, min, 0, "0" +HKR, Ndi\Params\MaxSpeed, max, 0, "2000" +HKR, Ndi\Params\MaxSpeed, step, 0, "1" +HKR, Ndi\Params\MaxSpeed, Base, 0, "10" +HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% +HKR, Ndi\Params\KeepLink, type, 0, "enum" +HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% +HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% +HKR, Ndi\Params\KeepLink, default, 0, "0" + + +[Neo.Service] +DisplayName = %Neo.Service.DispName% +Description = %Neo.Service.Desc% +ServiceType = 1 +StartType = 3 +ErrorControl = 1 +ServiceBinary = %12%\Neo6_x64_VPN127.sys +LoadOrderGroup = NDIS + +[Neo.Reg] +HKR, Ndi, Service, 0, Neo.Service.Name +HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" +HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" + +[Neo.EventLog] +HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo6_x64_VPN127.sys" +HKR, , TypesSupported, 0x00010001, 7 + +[Strings] +CompanyName = "SoftEther Corporation" +DiskDescription = "VPN Client Device Driver Install Disk" +Neo.Service.Name = "Neo_VPN127" +Neo.Service.DispName = "VPN Client Device Driver - VPN127" +Neo.Service.Desc = "VPN Client Adapter - VPN127" +NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN127" +Neo.EventLog.Name = "Neo" +NetworkAddress = "MAC Address" +DefaultAddress = "000001000001" +MaxSpeed = "Indicate Speed (Mbps)" +KeepLink = "Keep Link" +On = "On" +Off = "Off" + + +; Auto Generated 20180205_163630.382 + diff --git a/src/bin/hamcore/DriverPackages/Neo6_Win10/x64/Neo6_x64_VPN13.inf b/src/bin/hamcore/DriverPackages/Neo6_Win10/x64/Neo6_x64_VPN13.inf index 594ccdc8..ed83bfda 100644 --- a/src/bin/hamcore/DriverPackages/Neo6_Win10/x64/Neo6_x64_VPN13.inf +++ b/src/bin/hamcore/DriverPackages/Neo6_Win10/x64/Neo6_x64_VPN13.inf @@ -1,114 +1,114 @@ -; VPN Client Device Driver for Windows 2000 and Greater -; -; Copyright (c) SoftEther Corporation. All Rights Reserved. -; http://www.softether.co.jp/ -; -; BUILD 9658 - -[Version] -Signature = "$Windows NT$" -Class = Net -ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} -Provider = %CompanyName% -DriverVer = 02/04/2018, 4.25.0.9658 -CatalogFile.NT = Neo6_x64_VPN13.cat - -[Manufacturer] -%CompanyName% = SoftEther, NTamd64 - -[SourceDisksNames] -1=%DiskDescription%, "", , - -[SourceDisksFiles] -Neo6_x64_VPN13.sys = 1 - -[DestinationDirs] -DefaultDestDir = 12 -Neo.CopyFiles.Sys = 12 - -[Neo.CopyFiles.Sys] -Neo6_x64_VPN13.sys, , , 2 - -[SoftEther.NTamd64] -%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN13 - -[NeoAdapter.Install] -Characteristics = 0x1 -AddReg = Neo.Reg, NeoAdapter.Ndi -CopyFiles = Neo.CopyFiles.Sys -*IfType = 53 -*MediaType = 0 -*PhysicalMediaType = 0 - -[NeoAdapter.Install.Services] -AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% - -[NeoAdapter.Ndi] -HKR, , NetworkAddress, 0, %DefaultAddress% -HKR, Ndi, DeviceID, , "NeoAdapter_VPN13" -HKR, , DevLoader, , ndis -HKR, , DeviceVxDs, , Neo6_x64_VPN13.sys -HKR, NDIS, LogDriverName, , "Neo_VPN13" -HKR, NDIS, MajorNdisVersion, 1, 5 -HKR, NDIS, MinorNdisVersion, 1, 0 -HKR, Ndi\Interfaces, DefUpper, , "ndis5" -HKR, Ndi\Interfaces, UpperRange, , "ndis5" -HKR, Ndi\Interfaces, LowerRange, , "ethernet" -HKR, Ndi\Interfaces, DefLower, , "ethernet" -HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" -HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% -HKR, Ndi\Params\NetworkAddress, type, 0, "edit" -HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" -HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" -HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% -HKR, Ndi\Params\NetworkAddress, optional, 0, "0" -HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% -HKR, Ndi\Params\MaxSpeed, type, 0, "int" -HKR, Ndi\Params\MaxSpeed, default, 0, "100" -HKR, Ndi\Params\MaxSpeed, min, 0, "0" -HKR, Ndi\Params\MaxSpeed, max, 0, "2000" -HKR, Ndi\Params\MaxSpeed, step, 0, "1" -HKR, Ndi\Params\MaxSpeed, Base, 0, "10" -HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% -HKR, Ndi\Params\KeepLink, type, 0, "enum" -HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% -HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% -HKR, Ndi\Params\KeepLink, default, 0, "0" - - -[Neo.Service] -DisplayName = %Neo.Service.DispName% -Description = %Neo.Service.Desc% -ServiceType = 1 -StartType = 3 -ErrorControl = 1 -ServiceBinary = %12%\Neo6_x64_VPN13.sys -LoadOrderGroup = NDIS - -[Neo.Reg] -HKR, Ndi, Service, 0, Neo.Service.Name -HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" -HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" - -[Neo.EventLog] -HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo6_x64_VPN13.sys" -HKR, , TypesSupported, 0x00010001, 7 - -[Strings] -CompanyName = "SoftEther Corporation" -DiskDescription = "VPN Client Device Driver Install Disk" -Neo.Service.Name = "Neo_VPN13" -Neo.Service.DispName = "VPN Client Device Driver - VPN13" -Neo.Service.Desc = "VPN Client Adapter - VPN13" -NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN13" -Neo.EventLog.Name = "Neo" -NetworkAddress = "MAC Address" -DefaultAddress = "000001000001" -MaxSpeed = "Indicate Speed (Mbps)" -KeepLink = "Keep Link" -On = "On" -Off = "Off" - - -; Auto Generated 20180205_163622.242 - +; VPN Client Device Driver for Windows 2000 and Greater +; +; Copyright (c) SoftEther Corporation. All Rights Reserved. +; http://www.softether.co.jp/ +; +; BUILD 9658 + +[Version] +Signature = "$Windows NT$" +Class = Net +ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} +Provider = %CompanyName% +DriverVer = 02/04/2018, 4.25.0.9658 +CatalogFile.NT = Neo6_x64_VPN13.cat + +[Manufacturer] +%CompanyName% = SoftEther, NTamd64 + +[SourceDisksNames] +1=%DiskDescription%, "", , + +[SourceDisksFiles] +Neo6_x64_VPN13.sys = 1 + +[DestinationDirs] +DefaultDestDir = 12 +Neo.CopyFiles.Sys = 12 + +[Neo.CopyFiles.Sys] +Neo6_x64_VPN13.sys, , , 2 + +[SoftEther.NTamd64] +%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN13 + +[NeoAdapter.Install] +Characteristics = 0x1 +AddReg = Neo.Reg, NeoAdapter.Ndi +CopyFiles = Neo.CopyFiles.Sys +*IfType = 53 +*MediaType = 0 +*PhysicalMediaType = 0 + +[NeoAdapter.Install.Services] +AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% + +[NeoAdapter.Ndi] +HKR, , NetworkAddress, 0, %DefaultAddress% +HKR, Ndi, DeviceID, , "NeoAdapter_VPN13" +HKR, , DevLoader, , ndis +HKR, , DeviceVxDs, , Neo6_x64_VPN13.sys +HKR, NDIS, LogDriverName, , "Neo_VPN13" +HKR, NDIS, MajorNdisVersion, 1, 5 +HKR, NDIS, MinorNdisVersion, 1, 0 +HKR, Ndi\Interfaces, DefUpper, , "ndis5" +HKR, Ndi\Interfaces, UpperRange, , "ndis5" +HKR, Ndi\Interfaces, LowerRange, , "ethernet" +HKR, Ndi\Interfaces, DefLower, , "ethernet" +HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" +HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% +HKR, Ndi\Params\NetworkAddress, type, 0, "edit" +HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" +HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" +HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% +HKR, Ndi\Params\NetworkAddress, optional, 0, "0" +HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% +HKR, Ndi\Params\MaxSpeed, type, 0, "int" +HKR, Ndi\Params\MaxSpeed, default, 0, "100" +HKR, Ndi\Params\MaxSpeed, min, 0, "0" +HKR, Ndi\Params\MaxSpeed, max, 0, "2000" +HKR, Ndi\Params\MaxSpeed, step, 0, "1" +HKR, Ndi\Params\MaxSpeed, Base, 0, "10" +HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% +HKR, Ndi\Params\KeepLink, type, 0, "enum" +HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% +HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% +HKR, Ndi\Params\KeepLink, default, 0, "0" + + +[Neo.Service] +DisplayName = %Neo.Service.DispName% +Description = %Neo.Service.Desc% +ServiceType = 1 +StartType = 3 +ErrorControl = 1 +ServiceBinary = %12%\Neo6_x64_VPN13.sys +LoadOrderGroup = NDIS + +[Neo.Reg] +HKR, Ndi, Service, 0, Neo.Service.Name +HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" +HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" + +[Neo.EventLog] +HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo6_x64_VPN13.sys" +HKR, , TypesSupported, 0x00010001, 7 + +[Strings] +CompanyName = "SoftEther Corporation" +DiskDescription = "VPN Client Device Driver Install Disk" +Neo.Service.Name = "Neo_VPN13" +Neo.Service.DispName = "VPN Client Device Driver - VPN13" +Neo.Service.Desc = "VPN Client Adapter - VPN13" +NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN13" +Neo.EventLog.Name = "Neo" +NetworkAddress = "MAC Address" +DefaultAddress = "000001000001" +MaxSpeed = "Indicate Speed (Mbps)" +KeepLink = "Keep Link" +On = "On" +Off = "Off" + + +; Auto Generated 20180205_163622.242 + diff --git a/src/bin/hamcore/DriverPackages/Neo6_Win10/x64/Neo6_x64_VPN14.inf b/src/bin/hamcore/DriverPackages/Neo6_Win10/x64/Neo6_x64_VPN14.inf index 8fb2c019..15a0f060 100644 --- a/src/bin/hamcore/DriverPackages/Neo6_Win10/x64/Neo6_x64_VPN14.inf +++ b/src/bin/hamcore/DriverPackages/Neo6_Win10/x64/Neo6_x64_VPN14.inf @@ -1,114 +1,114 @@ -; VPN Client Device Driver for Windows 2000 and Greater -; -; Copyright (c) SoftEther Corporation. All Rights Reserved. -; http://www.softether.co.jp/ -; -; BUILD 9658 - -[Version] -Signature = "$Windows NT$" -Class = Net -ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} -Provider = %CompanyName% -DriverVer = 02/04/2018, 4.25.0.9658 -CatalogFile.NT = Neo6_x64_VPN14.cat - -[Manufacturer] -%CompanyName% = SoftEther, NTamd64 - -[SourceDisksNames] -1=%DiskDescription%, "", , - -[SourceDisksFiles] -Neo6_x64_VPN14.sys = 1 - -[DestinationDirs] -DefaultDestDir = 12 -Neo.CopyFiles.Sys = 12 - -[Neo.CopyFiles.Sys] -Neo6_x64_VPN14.sys, , , 2 - -[SoftEther.NTamd64] -%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN14 - -[NeoAdapter.Install] -Characteristics = 0x1 -AddReg = Neo.Reg, NeoAdapter.Ndi -CopyFiles = Neo.CopyFiles.Sys -*IfType = 53 -*MediaType = 0 -*PhysicalMediaType = 0 - -[NeoAdapter.Install.Services] -AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% - -[NeoAdapter.Ndi] -HKR, , NetworkAddress, 0, %DefaultAddress% -HKR, Ndi, DeviceID, , "NeoAdapter_VPN14" -HKR, , DevLoader, , ndis -HKR, , DeviceVxDs, , Neo6_x64_VPN14.sys -HKR, NDIS, LogDriverName, , "Neo_VPN14" -HKR, NDIS, MajorNdisVersion, 1, 5 -HKR, NDIS, MinorNdisVersion, 1, 0 -HKR, Ndi\Interfaces, DefUpper, , "ndis5" -HKR, Ndi\Interfaces, UpperRange, , "ndis5" -HKR, Ndi\Interfaces, LowerRange, , "ethernet" -HKR, Ndi\Interfaces, DefLower, , "ethernet" -HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" -HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% -HKR, Ndi\Params\NetworkAddress, type, 0, "edit" -HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" -HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" -HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% -HKR, Ndi\Params\NetworkAddress, optional, 0, "0" -HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% -HKR, Ndi\Params\MaxSpeed, type, 0, "int" -HKR, Ndi\Params\MaxSpeed, default, 0, "100" -HKR, Ndi\Params\MaxSpeed, min, 0, "0" -HKR, Ndi\Params\MaxSpeed, max, 0, "2000" -HKR, Ndi\Params\MaxSpeed, step, 0, "1" -HKR, Ndi\Params\MaxSpeed, Base, 0, "10" -HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% -HKR, Ndi\Params\KeepLink, type, 0, "enum" -HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% -HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% -HKR, Ndi\Params\KeepLink, default, 0, "0" - - -[Neo.Service] -DisplayName = %Neo.Service.DispName% -Description = %Neo.Service.Desc% -ServiceType = 1 -StartType = 3 -ErrorControl = 1 -ServiceBinary = %12%\Neo6_x64_VPN14.sys -LoadOrderGroup = NDIS - -[Neo.Reg] -HKR, Ndi, Service, 0, Neo.Service.Name -HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" -HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" - -[Neo.EventLog] -HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo6_x64_VPN14.sys" -HKR, , TypesSupported, 0x00010001, 7 - -[Strings] -CompanyName = "SoftEther Corporation" -DiskDescription = "VPN Client Device Driver Install Disk" -Neo.Service.Name = "Neo_VPN14" -Neo.Service.DispName = "VPN Client Device Driver - VPN14" -Neo.Service.Desc = "VPN Client Adapter - VPN14" -NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN14" -Neo.EventLog.Name = "Neo" -NetworkAddress = "MAC Address" -DefaultAddress = "000001000001" -MaxSpeed = "Indicate Speed (Mbps)" -KeepLink = "Keep Link" -On = "On" -Off = "Off" - - -; Auto Generated 20180205_163622.313 - +; VPN Client Device Driver for Windows 2000 and Greater +; +; Copyright (c) SoftEther Corporation. All Rights Reserved. +; http://www.softether.co.jp/ +; +; BUILD 9658 + +[Version] +Signature = "$Windows NT$" +Class = Net +ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} +Provider = %CompanyName% +DriverVer = 02/04/2018, 4.25.0.9658 +CatalogFile.NT = Neo6_x64_VPN14.cat + +[Manufacturer] +%CompanyName% = SoftEther, NTamd64 + +[SourceDisksNames] +1=%DiskDescription%, "", , + +[SourceDisksFiles] +Neo6_x64_VPN14.sys = 1 + +[DestinationDirs] +DefaultDestDir = 12 +Neo.CopyFiles.Sys = 12 + +[Neo.CopyFiles.Sys] +Neo6_x64_VPN14.sys, , , 2 + +[SoftEther.NTamd64] +%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN14 + +[NeoAdapter.Install] +Characteristics = 0x1 +AddReg = Neo.Reg, NeoAdapter.Ndi +CopyFiles = Neo.CopyFiles.Sys +*IfType = 53 +*MediaType = 0 +*PhysicalMediaType = 0 + +[NeoAdapter.Install.Services] +AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% + +[NeoAdapter.Ndi] +HKR, , NetworkAddress, 0, %DefaultAddress% +HKR, Ndi, DeviceID, , "NeoAdapter_VPN14" +HKR, , DevLoader, , ndis +HKR, , DeviceVxDs, , Neo6_x64_VPN14.sys +HKR, NDIS, LogDriverName, , "Neo_VPN14" +HKR, NDIS, MajorNdisVersion, 1, 5 +HKR, NDIS, MinorNdisVersion, 1, 0 +HKR, Ndi\Interfaces, DefUpper, , "ndis5" +HKR, Ndi\Interfaces, UpperRange, , "ndis5" +HKR, Ndi\Interfaces, LowerRange, , "ethernet" +HKR, Ndi\Interfaces, DefLower, , "ethernet" +HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" +HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% +HKR, Ndi\Params\NetworkAddress, type, 0, "edit" +HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" +HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" +HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% +HKR, Ndi\Params\NetworkAddress, optional, 0, "0" +HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% +HKR, Ndi\Params\MaxSpeed, type, 0, "int" +HKR, Ndi\Params\MaxSpeed, default, 0, "100" +HKR, Ndi\Params\MaxSpeed, min, 0, "0" +HKR, Ndi\Params\MaxSpeed, max, 0, "2000" +HKR, Ndi\Params\MaxSpeed, step, 0, "1" +HKR, Ndi\Params\MaxSpeed, Base, 0, "10" +HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% +HKR, Ndi\Params\KeepLink, type, 0, "enum" +HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% +HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% +HKR, Ndi\Params\KeepLink, default, 0, "0" + + +[Neo.Service] +DisplayName = %Neo.Service.DispName% +Description = %Neo.Service.Desc% +ServiceType = 1 +StartType = 3 +ErrorControl = 1 +ServiceBinary = %12%\Neo6_x64_VPN14.sys +LoadOrderGroup = NDIS + +[Neo.Reg] +HKR, Ndi, Service, 0, Neo.Service.Name +HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" +HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" + +[Neo.EventLog] +HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo6_x64_VPN14.sys" +HKR, , TypesSupported, 0x00010001, 7 + +[Strings] +CompanyName = "SoftEther Corporation" +DiskDescription = "VPN Client Device Driver Install Disk" +Neo.Service.Name = "Neo_VPN14" +Neo.Service.DispName = "VPN Client Device Driver - VPN14" +Neo.Service.Desc = "VPN Client Adapter - VPN14" +NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN14" +Neo.EventLog.Name = "Neo" +NetworkAddress = "MAC Address" +DefaultAddress = "000001000001" +MaxSpeed = "Indicate Speed (Mbps)" +KeepLink = "Keep Link" +On = "On" +Off = "Off" + + +; Auto Generated 20180205_163622.313 + diff --git a/src/bin/hamcore/DriverPackages/Neo6_Win10/x64/Neo6_x64_VPN15.inf b/src/bin/hamcore/DriverPackages/Neo6_Win10/x64/Neo6_x64_VPN15.inf index 7e9b768b..722b4664 100644 --- a/src/bin/hamcore/DriverPackages/Neo6_Win10/x64/Neo6_x64_VPN15.inf +++ b/src/bin/hamcore/DriverPackages/Neo6_Win10/x64/Neo6_x64_VPN15.inf @@ -1,114 +1,114 @@ -; VPN Client Device Driver for Windows 2000 and Greater -; -; Copyright (c) SoftEther Corporation. All Rights Reserved. -; http://www.softether.co.jp/ -; -; BUILD 9658 - -[Version] -Signature = "$Windows NT$" -Class = Net -ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} -Provider = %CompanyName% -DriverVer = 02/04/2018, 4.25.0.9658 -CatalogFile.NT = Neo6_x64_VPN15.cat - -[Manufacturer] -%CompanyName% = SoftEther, NTamd64 - -[SourceDisksNames] -1=%DiskDescription%, "", , - -[SourceDisksFiles] -Neo6_x64_VPN15.sys = 1 - -[DestinationDirs] -DefaultDestDir = 12 -Neo.CopyFiles.Sys = 12 - -[Neo.CopyFiles.Sys] -Neo6_x64_VPN15.sys, , , 2 - -[SoftEther.NTamd64] -%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN15 - -[NeoAdapter.Install] -Characteristics = 0x1 -AddReg = Neo.Reg, NeoAdapter.Ndi -CopyFiles = Neo.CopyFiles.Sys -*IfType = 53 -*MediaType = 0 -*PhysicalMediaType = 0 - -[NeoAdapter.Install.Services] -AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% - -[NeoAdapter.Ndi] -HKR, , NetworkAddress, 0, %DefaultAddress% -HKR, Ndi, DeviceID, , "NeoAdapter_VPN15" -HKR, , DevLoader, , ndis -HKR, , DeviceVxDs, , Neo6_x64_VPN15.sys -HKR, NDIS, LogDriverName, , "Neo_VPN15" -HKR, NDIS, MajorNdisVersion, 1, 5 -HKR, NDIS, MinorNdisVersion, 1, 0 -HKR, Ndi\Interfaces, DefUpper, , "ndis5" -HKR, Ndi\Interfaces, UpperRange, , "ndis5" -HKR, Ndi\Interfaces, LowerRange, , "ethernet" -HKR, Ndi\Interfaces, DefLower, , "ethernet" -HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" -HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% -HKR, Ndi\Params\NetworkAddress, type, 0, "edit" -HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" -HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" -HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% -HKR, Ndi\Params\NetworkAddress, optional, 0, "0" -HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% -HKR, Ndi\Params\MaxSpeed, type, 0, "int" -HKR, Ndi\Params\MaxSpeed, default, 0, "100" -HKR, Ndi\Params\MaxSpeed, min, 0, "0" -HKR, Ndi\Params\MaxSpeed, max, 0, "2000" -HKR, Ndi\Params\MaxSpeed, step, 0, "1" -HKR, Ndi\Params\MaxSpeed, Base, 0, "10" -HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% -HKR, Ndi\Params\KeepLink, type, 0, "enum" -HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% -HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% -HKR, Ndi\Params\KeepLink, default, 0, "0" - - -[Neo.Service] -DisplayName = %Neo.Service.DispName% -Description = %Neo.Service.Desc% -ServiceType = 1 -StartType = 3 -ErrorControl = 1 -ServiceBinary = %12%\Neo6_x64_VPN15.sys -LoadOrderGroup = NDIS - -[Neo.Reg] -HKR, Ndi, Service, 0, Neo.Service.Name -HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" -HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" - -[Neo.EventLog] -HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo6_x64_VPN15.sys" -HKR, , TypesSupported, 0x00010001, 7 - -[Strings] -CompanyName = "SoftEther Corporation" -DiskDescription = "VPN Client Device Driver Install Disk" -Neo.Service.Name = "Neo_VPN15" -Neo.Service.DispName = "VPN Client Device Driver - VPN15" -Neo.Service.Desc = "VPN Client Adapter - VPN15" -NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN15" -Neo.EventLog.Name = "Neo" -NetworkAddress = "MAC Address" -DefaultAddress = "000001000001" -MaxSpeed = "Indicate Speed (Mbps)" -KeepLink = "Keep Link" -On = "On" -Off = "Off" - - -; Auto Generated 20180205_163622.383 - +; VPN Client Device Driver for Windows 2000 and Greater +; +; Copyright (c) SoftEther Corporation. All Rights Reserved. +; http://www.softether.co.jp/ +; +; BUILD 9658 + +[Version] +Signature = "$Windows NT$" +Class = Net +ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} +Provider = %CompanyName% +DriverVer = 02/04/2018, 4.25.0.9658 +CatalogFile.NT = Neo6_x64_VPN15.cat + +[Manufacturer] +%CompanyName% = SoftEther, NTamd64 + +[SourceDisksNames] +1=%DiskDescription%, "", , + +[SourceDisksFiles] +Neo6_x64_VPN15.sys = 1 + +[DestinationDirs] +DefaultDestDir = 12 +Neo.CopyFiles.Sys = 12 + +[Neo.CopyFiles.Sys] +Neo6_x64_VPN15.sys, , , 2 + +[SoftEther.NTamd64] +%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN15 + +[NeoAdapter.Install] +Characteristics = 0x1 +AddReg = Neo.Reg, NeoAdapter.Ndi +CopyFiles = Neo.CopyFiles.Sys +*IfType = 53 +*MediaType = 0 +*PhysicalMediaType = 0 + +[NeoAdapter.Install.Services] +AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% + +[NeoAdapter.Ndi] +HKR, , NetworkAddress, 0, %DefaultAddress% +HKR, Ndi, DeviceID, , "NeoAdapter_VPN15" +HKR, , DevLoader, , ndis +HKR, , DeviceVxDs, , Neo6_x64_VPN15.sys +HKR, NDIS, LogDriverName, , "Neo_VPN15" +HKR, NDIS, MajorNdisVersion, 1, 5 +HKR, NDIS, MinorNdisVersion, 1, 0 +HKR, Ndi\Interfaces, DefUpper, , "ndis5" +HKR, Ndi\Interfaces, UpperRange, , "ndis5" +HKR, Ndi\Interfaces, LowerRange, , "ethernet" +HKR, Ndi\Interfaces, DefLower, , "ethernet" +HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" +HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% +HKR, Ndi\Params\NetworkAddress, type, 0, "edit" +HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" +HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" +HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% +HKR, Ndi\Params\NetworkAddress, optional, 0, "0" +HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% +HKR, Ndi\Params\MaxSpeed, type, 0, "int" +HKR, Ndi\Params\MaxSpeed, default, 0, "100" +HKR, Ndi\Params\MaxSpeed, min, 0, "0" +HKR, Ndi\Params\MaxSpeed, max, 0, "2000" +HKR, Ndi\Params\MaxSpeed, step, 0, "1" +HKR, Ndi\Params\MaxSpeed, Base, 0, "10" +HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% +HKR, Ndi\Params\KeepLink, type, 0, "enum" +HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% +HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% +HKR, Ndi\Params\KeepLink, default, 0, "0" + + +[Neo.Service] +DisplayName = %Neo.Service.DispName% +Description = %Neo.Service.Desc% +ServiceType = 1 +StartType = 3 +ErrorControl = 1 +ServiceBinary = %12%\Neo6_x64_VPN15.sys +LoadOrderGroup = NDIS + +[Neo.Reg] +HKR, Ndi, Service, 0, Neo.Service.Name +HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" +HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" + +[Neo.EventLog] +HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo6_x64_VPN15.sys" +HKR, , TypesSupported, 0x00010001, 7 + +[Strings] +CompanyName = "SoftEther Corporation" +DiskDescription = "VPN Client Device Driver Install Disk" +Neo.Service.Name = "Neo_VPN15" +Neo.Service.DispName = "VPN Client Device Driver - VPN15" +Neo.Service.Desc = "VPN Client Adapter - VPN15" +NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN15" +Neo.EventLog.Name = "Neo" +NetworkAddress = "MAC Address" +DefaultAddress = "000001000001" +MaxSpeed = "Indicate Speed (Mbps)" +KeepLink = "Keep Link" +On = "On" +Off = "Off" + + +; Auto Generated 20180205_163622.383 + diff --git a/src/bin/hamcore/DriverPackages/Neo6_Win10/x64/Neo6_x64_VPN16.inf b/src/bin/hamcore/DriverPackages/Neo6_Win10/x64/Neo6_x64_VPN16.inf index 4dcb9772..8548b342 100644 --- a/src/bin/hamcore/DriverPackages/Neo6_Win10/x64/Neo6_x64_VPN16.inf +++ b/src/bin/hamcore/DriverPackages/Neo6_Win10/x64/Neo6_x64_VPN16.inf @@ -1,114 +1,114 @@ -; VPN Client Device Driver for Windows 2000 and Greater -; -; Copyright (c) SoftEther Corporation. All Rights Reserved. -; http://www.softether.co.jp/ -; -; BUILD 9658 - -[Version] -Signature = "$Windows NT$" -Class = Net -ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} -Provider = %CompanyName% -DriverVer = 02/04/2018, 4.25.0.9658 -CatalogFile.NT = Neo6_x64_VPN16.cat - -[Manufacturer] -%CompanyName% = SoftEther, NTamd64 - -[SourceDisksNames] -1=%DiskDescription%, "", , - -[SourceDisksFiles] -Neo6_x64_VPN16.sys = 1 - -[DestinationDirs] -DefaultDestDir = 12 -Neo.CopyFiles.Sys = 12 - -[Neo.CopyFiles.Sys] -Neo6_x64_VPN16.sys, , , 2 - -[SoftEther.NTamd64] -%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN16 - -[NeoAdapter.Install] -Characteristics = 0x1 -AddReg = Neo.Reg, NeoAdapter.Ndi -CopyFiles = Neo.CopyFiles.Sys -*IfType = 53 -*MediaType = 0 -*PhysicalMediaType = 0 - -[NeoAdapter.Install.Services] -AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% - -[NeoAdapter.Ndi] -HKR, , NetworkAddress, 0, %DefaultAddress% -HKR, Ndi, DeviceID, , "NeoAdapter_VPN16" -HKR, , DevLoader, , ndis -HKR, , DeviceVxDs, , Neo6_x64_VPN16.sys -HKR, NDIS, LogDriverName, , "Neo_VPN16" -HKR, NDIS, MajorNdisVersion, 1, 5 -HKR, NDIS, MinorNdisVersion, 1, 0 -HKR, Ndi\Interfaces, DefUpper, , "ndis5" -HKR, Ndi\Interfaces, UpperRange, , "ndis5" -HKR, Ndi\Interfaces, LowerRange, , "ethernet" -HKR, Ndi\Interfaces, DefLower, , "ethernet" -HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" -HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% -HKR, Ndi\Params\NetworkAddress, type, 0, "edit" -HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" -HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" -HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% -HKR, Ndi\Params\NetworkAddress, optional, 0, "0" -HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% -HKR, Ndi\Params\MaxSpeed, type, 0, "int" -HKR, Ndi\Params\MaxSpeed, default, 0, "100" -HKR, Ndi\Params\MaxSpeed, min, 0, "0" -HKR, Ndi\Params\MaxSpeed, max, 0, "2000" -HKR, Ndi\Params\MaxSpeed, step, 0, "1" -HKR, Ndi\Params\MaxSpeed, Base, 0, "10" -HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% -HKR, Ndi\Params\KeepLink, type, 0, "enum" -HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% -HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% -HKR, Ndi\Params\KeepLink, default, 0, "0" - - -[Neo.Service] -DisplayName = %Neo.Service.DispName% -Description = %Neo.Service.Desc% -ServiceType = 1 -StartType = 3 -ErrorControl = 1 -ServiceBinary = %12%\Neo6_x64_VPN16.sys -LoadOrderGroup = NDIS - -[Neo.Reg] -HKR, Ndi, Service, 0, Neo.Service.Name -HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" -HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" - -[Neo.EventLog] -HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo6_x64_VPN16.sys" -HKR, , TypesSupported, 0x00010001, 7 - -[Strings] -CompanyName = "SoftEther Corporation" -DiskDescription = "VPN Client Device Driver Install Disk" -Neo.Service.Name = "Neo_VPN16" -Neo.Service.DispName = "VPN Client Device Driver - VPN16" -Neo.Service.Desc = "VPN Client Adapter - VPN16" -NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN16" -Neo.EventLog.Name = "Neo" -NetworkAddress = "MAC Address" -DefaultAddress = "000001000001" -MaxSpeed = "Indicate Speed (Mbps)" -KeepLink = "Keep Link" -On = "On" -Off = "Off" - - -; Auto Generated 20180205_163622.456 - +; VPN Client Device Driver for Windows 2000 and Greater +; +; Copyright (c) SoftEther Corporation. All Rights Reserved. +; http://www.softether.co.jp/ +; +; BUILD 9658 + +[Version] +Signature = "$Windows NT$" +Class = Net +ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} +Provider = %CompanyName% +DriverVer = 02/04/2018, 4.25.0.9658 +CatalogFile.NT = Neo6_x64_VPN16.cat + +[Manufacturer] +%CompanyName% = SoftEther, NTamd64 + +[SourceDisksNames] +1=%DiskDescription%, "", , + +[SourceDisksFiles] +Neo6_x64_VPN16.sys = 1 + +[DestinationDirs] +DefaultDestDir = 12 +Neo.CopyFiles.Sys = 12 + +[Neo.CopyFiles.Sys] +Neo6_x64_VPN16.sys, , , 2 + +[SoftEther.NTamd64] +%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN16 + +[NeoAdapter.Install] +Characteristics = 0x1 +AddReg = Neo.Reg, NeoAdapter.Ndi +CopyFiles = Neo.CopyFiles.Sys +*IfType = 53 +*MediaType = 0 +*PhysicalMediaType = 0 + +[NeoAdapter.Install.Services] +AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% + +[NeoAdapter.Ndi] +HKR, , NetworkAddress, 0, %DefaultAddress% +HKR, Ndi, DeviceID, , "NeoAdapter_VPN16" +HKR, , DevLoader, , ndis +HKR, , DeviceVxDs, , Neo6_x64_VPN16.sys +HKR, NDIS, LogDriverName, , "Neo_VPN16" +HKR, NDIS, MajorNdisVersion, 1, 5 +HKR, NDIS, MinorNdisVersion, 1, 0 +HKR, Ndi\Interfaces, DefUpper, , "ndis5" +HKR, Ndi\Interfaces, UpperRange, , "ndis5" +HKR, Ndi\Interfaces, LowerRange, , "ethernet" +HKR, Ndi\Interfaces, DefLower, , "ethernet" +HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" +HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% +HKR, Ndi\Params\NetworkAddress, type, 0, "edit" +HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" +HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" +HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% +HKR, Ndi\Params\NetworkAddress, optional, 0, "0" +HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% +HKR, Ndi\Params\MaxSpeed, type, 0, "int" +HKR, Ndi\Params\MaxSpeed, default, 0, "100" +HKR, Ndi\Params\MaxSpeed, min, 0, "0" +HKR, Ndi\Params\MaxSpeed, max, 0, "2000" +HKR, Ndi\Params\MaxSpeed, step, 0, "1" +HKR, Ndi\Params\MaxSpeed, Base, 0, "10" +HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% +HKR, Ndi\Params\KeepLink, type, 0, "enum" +HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% +HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% +HKR, Ndi\Params\KeepLink, default, 0, "0" + + +[Neo.Service] +DisplayName = %Neo.Service.DispName% +Description = %Neo.Service.Desc% +ServiceType = 1 +StartType = 3 +ErrorControl = 1 +ServiceBinary = %12%\Neo6_x64_VPN16.sys +LoadOrderGroup = NDIS + +[Neo.Reg] +HKR, Ndi, Service, 0, Neo.Service.Name +HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" +HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" + +[Neo.EventLog] +HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo6_x64_VPN16.sys" +HKR, , TypesSupported, 0x00010001, 7 + +[Strings] +CompanyName = "SoftEther Corporation" +DiskDescription = "VPN Client Device Driver Install Disk" +Neo.Service.Name = "Neo_VPN16" +Neo.Service.DispName = "VPN Client Device Driver - VPN16" +Neo.Service.Desc = "VPN Client Adapter - VPN16" +NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN16" +Neo.EventLog.Name = "Neo" +NetworkAddress = "MAC Address" +DefaultAddress = "000001000001" +MaxSpeed = "Indicate Speed (Mbps)" +KeepLink = "Keep Link" +On = "On" +Off = "Off" + + +; Auto Generated 20180205_163622.456 + diff --git a/src/bin/hamcore/DriverPackages/Neo6_Win10/x64/Neo6_x64_VPN17.inf b/src/bin/hamcore/DriverPackages/Neo6_Win10/x64/Neo6_x64_VPN17.inf index 1d545c31..48d58174 100644 --- a/src/bin/hamcore/DriverPackages/Neo6_Win10/x64/Neo6_x64_VPN17.inf +++ b/src/bin/hamcore/DriverPackages/Neo6_Win10/x64/Neo6_x64_VPN17.inf @@ -1,114 +1,114 @@ -; VPN Client Device Driver for Windows 2000 and Greater -; -; Copyright (c) SoftEther Corporation. All Rights Reserved. -; http://www.softether.co.jp/ -; -; BUILD 9658 - -[Version] -Signature = "$Windows NT$" -Class = Net -ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} -Provider = %CompanyName% -DriverVer = 02/04/2018, 4.25.0.9658 -CatalogFile.NT = Neo6_x64_VPN17.cat - -[Manufacturer] -%CompanyName% = SoftEther, NTamd64 - -[SourceDisksNames] -1=%DiskDescription%, "", , - -[SourceDisksFiles] -Neo6_x64_VPN17.sys = 1 - -[DestinationDirs] -DefaultDestDir = 12 -Neo.CopyFiles.Sys = 12 - -[Neo.CopyFiles.Sys] -Neo6_x64_VPN17.sys, , , 2 - -[SoftEther.NTamd64] -%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN17 - -[NeoAdapter.Install] -Characteristics = 0x1 -AddReg = Neo.Reg, NeoAdapter.Ndi -CopyFiles = Neo.CopyFiles.Sys -*IfType = 53 -*MediaType = 0 -*PhysicalMediaType = 0 - -[NeoAdapter.Install.Services] -AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% - -[NeoAdapter.Ndi] -HKR, , NetworkAddress, 0, %DefaultAddress% -HKR, Ndi, DeviceID, , "NeoAdapter_VPN17" -HKR, , DevLoader, , ndis -HKR, , DeviceVxDs, , Neo6_x64_VPN17.sys -HKR, NDIS, LogDriverName, , "Neo_VPN17" -HKR, NDIS, MajorNdisVersion, 1, 5 -HKR, NDIS, MinorNdisVersion, 1, 0 -HKR, Ndi\Interfaces, DefUpper, , "ndis5" -HKR, Ndi\Interfaces, UpperRange, , "ndis5" -HKR, Ndi\Interfaces, LowerRange, , "ethernet" -HKR, Ndi\Interfaces, DefLower, , "ethernet" -HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" -HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% -HKR, Ndi\Params\NetworkAddress, type, 0, "edit" -HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" -HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" -HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% -HKR, Ndi\Params\NetworkAddress, optional, 0, "0" -HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% -HKR, Ndi\Params\MaxSpeed, type, 0, "int" -HKR, Ndi\Params\MaxSpeed, default, 0, "100" -HKR, Ndi\Params\MaxSpeed, min, 0, "0" -HKR, Ndi\Params\MaxSpeed, max, 0, "2000" -HKR, Ndi\Params\MaxSpeed, step, 0, "1" -HKR, Ndi\Params\MaxSpeed, Base, 0, "10" -HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% -HKR, Ndi\Params\KeepLink, type, 0, "enum" -HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% -HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% -HKR, Ndi\Params\KeepLink, default, 0, "0" - - -[Neo.Service] -DisplayName = %Neo.Service.DispName% -Description = %Neo.Service.Desc% -ServiceType = 1 -StartType = 3 -ErrorControl = 1 -ServiceBinary = %12%\Neo6_x64_VPN17.sys -LoadOrderGroup = NDIS - -[Neo.Reg] -HKR, Ndi, Service, 0, Neo.Service.Name -HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" -HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" - -[Neo.EventLog] -HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo6_x64_VPN17.sys" -HKR, , TypesSupported, 0x00010001, 7 - -[Strings] -CompanyName = "SoftEther Corporation" -DiskDescription = "VPN Client Device Driver Install Disk" -Neo.Service.Name = "Neo_VPN17" -Neo.Service.DispName = "VPN Client Device Driver - VPN17" -Neo.Service.Desc = "VPN Client Adapter - VPN17" -NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN17" -Neo.EventLog.Name = "Neo" -NetworkAddress = "MAC Address" -DefaultAddress = "000001000001" -MaxSpeed = "Indicate Speed (Mbps)" -KeepLink = "Keep Link" -On = "On" -Off = "Off" - - -; Auto Generated 20180205_163622.528 - +; VPN Client Device Driver for Windows 2000 and Greater +; +; Copyright (c) SoftEther Corporation. All Rights Reserved. +; http://www.softether.co.jp/ +; +; BUILD 9658 + +[Version] +Signature = "$Windows NT$" +Class = Net +ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} +Provider = %CompanyName% +DriverVer = 02/04/2018, 4.25.0.9658 +CatalogFile.NT = Neo6_x64_VPN17.cat + +[Manufacturer] +%CompanyName% = SoftEther, NTamd64 + +[SourceDisksNames] +1=%DiskDescription%, "", , + +[SourceDisksFiles] +Neo6_x64_VPN17.sys = 1 + +[DestinationDirs] +DefaultDestDir = 12 +Neo.CopyFiles.Sys = 12 + +[Neo.CopyFiles.Sys] +Neo6_x64_VPN17.sys, , , 2 + +[SoftEther.NTamd64] +%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN17 + +[NeoAdapter.Install] +Characteristics = 0x1 +AddReg = Neo.Reg, NeoAdapter.Ndi +CopyFiles = Neo.CopyFiles.Sys +*IfType = 53 +*MediaType = 0 +*PhysicalMediaType = 0 + +[NeoAdapter.Install.Services] +AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% + +[NeoAdapter.Ndi] +HKR, , NetworkAddress, 0, %DefaultAddress% +HKR, Ndi, DeviceID, , "NeoAdapter_VPN17" +HKR, , DevLoader, , ndis +HKR, , DeviceVxDs, , Neo6_x64_VPN17.sys +HKR, NDIS, LogDriverName, , "Neo_VPN17" +HKR, NDIS, MajorNdisVersion, 1, 5 +HKR, NDIS, MinorNdisVersion, 1, 0 +HKR, Ndi\Interfaces, DefUpper, , "ndis5" +HKR, Ndi\Interfaces, UpperRange, , "ndis5" +HKR, Ndi\Interfaces, LowerRange, , "ethernet" +HKR, Ndi\Interfaces, DefLower, , "ethernet" +HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" +HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% +HKR, Ndi\Params\NetworkAddress, type, 0, "edit" +HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" +HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" +HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% +HKR, Ndi\Params\NetworkAddress, optional, 0, "0" +HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% +HKR, Ndi\Params\MaxSpeed, type, 0, "int" +HKR, Ndi\Params\MaxSpeed, default, 0, "100" +HKR, Ndi\Params\MaxSpeed, min, 0, "0" +HKR, Ndi\Params\MaxSpeed, max, 0, "2000" +HKR, Ndi\Params\MaxSpeed, step, 0, "1" +HKR, Ndi\Params\MaxSpeed, Base, 0, "10" +HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% +HKR, Ndi\Params\KeepLink, type, 0, "enum" +HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% +HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% +HKR, Ndi\Params\KeepLink, default, 0, "0" + + +[Neo.Service] +DisplayName = %Neo.Service.DispName% +Description = %Neo.Service.Desc% +ServiceType = 1 +StartType = 3 +ErrorControl = 1 +ServiceBinary = %12%\Neo6_x64_VPN17.sys +LoadOrderGroup = NDIS + +[Neo.Reg] +HKR, Ndi, Service, 0, Neo.Service.Name +HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" +HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" + +[Neo.EventLog] +HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo6_x64_VPN17.sys" +HKR, , TypesSupported, 0x00010001, 7 + +[Strings] +CompanyName = "SoftEther Corporation" +DiskDescription = "VPN Client Device Driver Install Disk" +Neo.Service.Name = "Neo_VPN17" +Neo.Service.DispName = "VPN Client Device Driver - VPN17" +Neo.Service.Desc = "VPN Client Adapter - VPN17" +NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN17" +Neo.EventLog.Name = "Neo" +NetworkAddress = "MAC Address" +DefaultAddress = "000001000001" +MaxSpeed = "Indicate Speed (Mbps)" +KeepLink = "Keep Link" +On = "On" +Off = "Off" + + +; Auto Generated 20180205_163622.528 + diff --git a/src/bin/hamcore/DriverPackages/Neo6_Win10/x64/Neo6_x64_VPN18.inf b/src/bin/hamcore/DriverPackages/Neo6_Win10/x64/Neo6_x64_VPN18.inf index fdca2475..2e97ab6b 100644 --- a/src/bin/hamcore/DriverPackages/Neo6_Win10/x64/Neo6_x64_VPN18.inf +++ b/src/bin/hamcore/DriverPackages/Neo6_Win10/x64/Neo6_x64_VPN18.inf @@ -1,114 +1,114 @@ -; VPN Client Device Driver for Windows 2000 and Greater -; -; Copyright (c) SoftEther Corporation. All Rights Reserved. -; http://www.softether.co.jp/ -; -; BUILD 9658 - -[Version] -Signature = "$Windows NT$" -Class = Net -ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} -Provider = %CompanyName% -DriverVer = 02/04/2018, 4.25.0.9658 -CatalogFile.NT = Neo6_x64_VPN18.cat - -[Manufacturer] -%CompanyName% = SoftEther, NTamd64 - -[SourceDisksNames] -1=%DiskDescription%, "", , - -[SourceDisksFiles] -Neo6_x64_VPN18.sys = 1 - -[DestinationDirs] -DefaultDestDir = 12 -Neo.CopyFiles.Sys = 12 - -[Neo.CopyFiles.Sys] -Neo6_x64_VPN18.sys, , , 2 - -[SoftEther.NTamd64] -%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN18 - -[NeoAdapter.Install] -Characteristics = 0x1 -AddReg = Neo.Reg, NeoAdapter.Ndi -CopyFiles = Neo.CopyFiles.Sys -*IfType = 53 -*MediaType = 0 -*PhysicalMediaType = 0 - -[NeoAdapter.Install.Services] -AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% - -[NeoAdapter.Ndi] -HKR, , NetworkAddress, 0, %DefaultAddress% -HKR, Ndi, DeviceID, , "NeoAdapter_VPN18" -HKR, , DevLoader, , ndis -HKR, , DeviceVxDs, , Neo6_x64_VPN18.sys -HKR, NDIS, LogDriverName, , "Neo_VPN18" -HKR, NDIS, MajorNdisVersion, 1, 5 -HKR, NDIS, MinorNdisVersion, 1, 0 -HKR, Ndi\Interfaces, DefUpper, , "ndis5" -HKR, Ndi\Interfaces, UpperRange, , "ndis5" -HKR, Ndi\Interfaces, LowerRange, , "ethernet" -HKR, Ndi\Interfaces, DefLower, , "ethernet" -HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" -HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% -HKR, Ndi\Params\NetworkAddress, type, 0, "edit" -HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" -HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" -HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% -HKR, Ndi\Params\NetworkAddress, optional, 0, "0" -HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% -HKR, Ndi\Params\MaxSpeed, type, 0, "int" -HKR, Ndi\Params\MaxSpeed, default, 0, "100" -HKR, Ndi\Params\MaxSpeed, min, 0, "0" -HKR, Ndi\Params\MaxSpeed, max, 0, "2000" -HKR, Ndi\Params\MaxSpeed, step, 0, "1" -HKR, Ndi\Params\MaxSpeed, Base, 0, "10" -HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% -HKR, Ndi\Params\KeepLink, type, 0, "enum" -HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% -HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% -HKR, Ndi\Params\KeepLink, default, 0, "0" - - -[Neo.Service] -DisplayName = %Neo.Service.DispName% -Description = %Neo.Service.Desc% -ServiceType = 1 -StartType = 3 -ErrorControl = 1 -ServiceBinary = %12%\Neo6_x64_VPN18.sys -LoadOrderGroup = NDIS - -[Neo.Reg] -HKR, Ndi, Service, 0, Neo.Service.Name -HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" -HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" - -[Neo.EventLog] -HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo6_x64_VPN18.sys" -HKR, , TypesSupported, 0x00010001, 7 - -[Strings] -CompanyName = "SoftEther Corporation" -DiskDescription = "VPN Client Device Driver Install Disk" -Neo.Service.Name = "Neo_VPN18" -Neo.Service.DispName = "VPN Client Device Driver - VPN18" -Neo.Service.Desc = "VPN Client Adapter - VPN18" -NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN18" -Neo.EventLog.Name = "Neo" -NetworkAddress = "MAC Address" -DefaultAddress = "000001000001" -MaxSpeed = "Indicate Speed (Mbps)" -KeepLink = "Keep Link" -On = "On" -Off = "Off" - - -; Auto Generated 20180205_163622.599 - +; VPN Client Device Driver for Windows 2000 and Greater +; +; Copyright (c) SoftEther Corporation. All Rights Reserved. +; http://www.softether.co.jp/ +; +; BUILD 9658 + +[Version] +Signature = "$Windows NT$" +Class = Net +ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} +Provider = %CompanyName% +DriverVer = 02/04/2018, 4.25.0.9658 +CatalogFile.NT = Neo6_x64_VPN18.cat + +[Manufacturer] +%CompanyName% = SoftEther, NTamd64 + +[SourceDisksNames] +1=%DiskDescription%, "", , + +[SourceDisksFiles] +Neo6_x64_VPN18.sys = 1 + +[DestinationDirs] +DefaultDestDir = 12 +Neo.CopyFiles.Sys = 12 + +[Neo.CopyFiles.Sys] +Neo6_x64_VPN18.sys, , , 2 + +[SoftEther.NTamd64] +%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN18 + +[NeoAdapter.Install] +Characteristics = 0x1 +AddReg = Neo.Reg, NeoAdapter.Ndi +CopyFiles = Neo.CopyFiles.Sys +*IfType = 53 +*MediaType = 0 +*PhysicalMediaType = 0 + +[NeoAdapter.Install.Services] +AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% + +[NeoAdapter.Ndi] +HKR, , NetworkAddress, 0, %DefaultAddress% +HKR, Ndi, DeviceID, , "NeoAdapter_VPN18" +HKR, , DevLoader, , ndis +HKR, , DeviceVxDs, , Neo6_x64_VPN18.sys +HKR, NDIS, LogDriverName, , "Neo_VPN18" +HKR, NDIS, MajorNdisVersion, 1, 5 +HKR, NDIS, MinorNdisVersion, 1, 0 +HKR, Ndi\Interfaces, DefUpper, , "ndis5" +HKR, Ndi\Interfaces, UpperRange, , "ndis5" +HKR, Ndi\Interfaces, LowerRange, , "ethernet" +HKR, Ndi\Interfaces, DefLower, , "ethernet" +HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" +HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% +HKR, Ndi\Params\NetworkAddress, type, 0, "edit" +HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" +HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" +HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% +HKR, Ndi\Params\NetworkAddress, optional, 0, "0" +HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% +HKR, Ndi\Params\MaxSpeed, type, 0, "int" +HKR, Ndi\Params\MaxSpeed, default, 0, "100" +HKR, Ndi\Params\MaxSpeed, min, 0, "0" +HKR, Ndi\Params\MaxSpeed, max, 0, "2000" +HKR, Ndi\Params\MaxSpeed, step, 0, "1" +HKR, Ndi\Params\MaxSpeed, Base, 0, "10" +HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% +HKR, Ndi\Params\KeepLink, type, 0, "enum" +HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% +HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% +HKR, Ndi\Params\KeepLink, default, 0, "0" + + +[Neo.Service] +DisplayName = %Neo.Service.DispName% +Description = %Neo.Service.Desc% +ServiceType = 1 +StartType = 3 +ErrorControl = 1 +ServiceBinary = %12%\Neo6_x64_VPN18.sys +LoadOrderGroup = NDIS + +[Neo.Reg] +HKR, Ndi, Service, 0, Neo.Service.Name +HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" +HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" + +[Neo.EventLog] +HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo6_x64_VPN18.sys" +HKR, , TypesSupported, 0x00010001, 7 + +[Strings] +CompanyName = "SoftEther Corporation" +DiskDescription = "VPN Client Device Driver Install Disk" +Neo.Service.Name = "Neo_VPN18" +Neo.Service.DispName = "VPN Client Device Driver - VPN18" +Neo.Service.Desc = "VPN Client Adapter - VPN18" +NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN18" +Neo.EventLog.Name = "Neo" +NetworkAddress = "MAC Address" +DefaultAddress = "000001000001" +MaxSpeed = "Indicate Speed (Mbps)" +KeepLink = "Keep Link" +On = "On" +Off = "Off" + + +; Auto Generated 20180205_163622.599 + diff --git a/src/bin/hamcore/DriverPackages/Neo6_Win10/x64/Neo6_x64_VPN19.inf b/src/bin/hamcore/DriverPackages/Neo6_Win10/x64/Neo6_x64_VPN19.inf index 5252ac07..f8c7ec3a 100644 --- a/src/bin/hamcore/DriverPackages/Neo6_Win10/x64/Neo6_x64_VPN19.inf +++ b/src/bin/hamcore/DriverPackages/Neo6_Win10/x64/Neo6_x64_VPN19.inf @@ -1,114 +1,114 @@ -; VPN Client Device Driver for Windows 2000 and Greater -; -; Copyright (c) SoftEther Corporation. All Rights Reserved. -; http://www.softether.co.jp/ -; -; BUILD 9658 - -[Version] -Signature = "$Windows NT$" -Class = Net -ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} -Provider = %CompanyName% -DriverVer = 02/04/2018, 4.25.0.9658 -CatalogFile.NT = Neo6_x64_VPN19.cat - -[Manufacturer] -%CompanyName% = SoftEther, NTamd64 - -[SourceDisksNames] -1=%DiskDescription%, "", , - -[SourceDisksFiles] -Neo6_x64_VPN19.sys = 1 - -[DestinationDirs] -DefaultDestDir = 12 -Neo.CopyFiles.Sys = 12 - -[Neo.CopyFiles.Sys] -Neo6_x64_VPN19.sys, , , 2 - -[SoftEther.NTamd64] -%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN19 - -[NeoAdapter.Install] -Characteristics = 0x1 -AddReg = Neo.Reg, NeoAdapter.Ndi -CopyFiles = Neo.CopyFiles.Sys -*IfType = 53 -*MediaType = 0 -*PhysicalMediaType = 0 - -[NeoAdapter.Install.Services] -AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% - -[NeoAdapter.Ndi] -HKR, , NetworkAddress, 0, %DefaultAddress% -HKR, Ndi, DeviceID, , "NeoAdapter_VPN19" -HKR, , DevLoader, , ndis -HKR, , DeviceVxDs, , Neo6_x64_VPN19.sys -HKR, NDIS, LogDriverName, , "Neo_VPN19" -HKR, NDIS, MajorNdisVersion, 1, 5 -HKR, NDIS, MinorNdisVersion, 1, 0 -HKR, Ndi\Interfaces, DefUpper, , "ndis5" -HKR, Ndi\Interfaces, UpperRange, , "ndis5" -HKR, Ndi\Interfaces, LowerRange, , "ethernet" -HKR, Ndi\Interfaces, DefLower, , "ethernet" -HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" -HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% -HKR, Ndi\Params\NetworkAddress, type, 0, "edit" -HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" -HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" -HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% -HKR, Ndi\Params\NetworkAddress, optional, 0, "0" -HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% -HKR, Ndi\Params\MaxSpeed, type, 0, "int" -HKR, Ndi\Params\MaxSpeed, default, 0, "100" -HKR, Ndi\Params\MaxSpeed, min, 0, "0" -HKR, Ndi\Params\MaxSpeed, max, 0, "2000" -HKR, Ndi\Params\MaxSpeed, step, 0, "1" -HKR, Ndi\Params\MaxSpeed, Base, 0, "10" -HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% -HKR, Ndi\Params\KeepLink, type, 0, "enum" -HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% -HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% -HKR, Ndi\Params\KeepLink, default, 0, "0" - - -[Neo.Service] -DisplayName = %Neo.Service.DispName% -Description = %Neo.Service.Desc% -ServiceType = 1 -StartType = 3 -ErrorControl = 1 -ServiceBinary = %12%\Neo6_x64_VPN19.sys -LoadOrderGroup = NDIS - -[Neo.Reg] -HKR, Ndi, Service, 0, Neo.Service.Name -HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" -HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" - -[Neo.EventLog] -HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo6_x64_VPN19.sys" -HKR, , TypesSupported, 0x00010001, 7 - -[Strings] -CompanyName = "SoftEther Corporation" -DiskDescription = "VPN Client Device Driver Install Disk" -Neo.Service.Name = "Neo_VPN19" -Neo.Service.DispName = "VPN Client Device Driver - VPN19" -Neo.Service.Desc = "VPN Client Adapter - VPN19" -NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN19" -Neo.EventLog.Name = "Neo" -NetworkAddress = "MAC Address" -DefaultAddress = "000001000001" -MaxSpeed = "Indicate Speed (Mbps)" -KeepLink = "Keep Link" -On = "On" -Off = "Off" - - -; Auto Generated 20180205_163622.670 - +; VPN Client Device Driver for Windows 2000 and Greater +; +; Copyright (c) SoftEther Corporation. All Rights Reserved. +; http://www.softether.co.jp/ +; +; BUILD 9658 + +[Version] +Signature = "$Windows NT$" +Class = Net +ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} +Provider = %CompanyName% +DriverVer = 02/04/2018, 4.25.0.9658 +CatalogFile.NT = Neo6_x64_VPN19.cat + +[Manufacturer] +%CompanyName% = SoftEther, NTamd64 + +[SourceDisksNames] +1=%DiskDescription%, "", , + +[SourceDisksFiles] +Neo6_x64_VPN19.sys = 1 + +[DestinationDirs] +DefaultDestDir = 12 +Neo.CopyFiles.Sys = 12 + +[Neo.CopyFiles.Sys] +Neo6_x64_VPN19.sys, , , 2 + +[SoftEther.NTamd64] +%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN19 + +[NeoAdapter.Install] +Characteristics = 0x1 +AddReg = Neo.Reg, NeoAdapter.Ndi +CopyFiles = Neo.CopyFiles.Sys +*IfType = 53 +*MediaType = 0 +*PhysicalMediaType = 0 + +[NeoAdapter.Install.Services] +AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% + +[NeoAdapter.Ndi] +HKR, , NetworkAddress, 0, %DefaultAddress% +HKR, Ndi, DeviceID, , "NeoAdapter_VPN19" +HKR, , DevLoader, , ndis +HKR, , DeviceVxDs, , Neo6_x64_VPN19.sys +HKR, NDIS, LogDriverName, , "Neo_VPN19" +HKR, NDIS, MajorNdisVersion, 1, 5 +HKR, NDIS, MinorNdisVersion, 1, 0 +HKR, Ndi\Interfaces, DefUpper, , "ndis5" +HKR, Ndi\Interfaces, UpperRange, , "ndis5" +HKR, Ndi\Interfaces, LowerRange, , "ethernet" +HKR, Ndi\Interfaces, DefLower, , "ethernet" +HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" +HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% +HKR, Ndi\Params\NetworkAddress, type, 0, "edit" +HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" +HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" +HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% +HKR, Ndi\Params\NetworkAddress, optional, 0, "0" +HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% +HKR, Ndi\Params\MaxSpeed, type, 0, "int" +HKR, Ndi\Params\MaxSpeed, default, 0, "100" +HKR, Ndi\Params\MaxSpeed, min, 0, "0" +HKR, Ndi\Params\MaxSpeed, max, 0, "2000" +HKR, Ndi\Params\MaxSpeed, step, 0, "1" +HKR, Ndi\Params\MaxSpeed, Base, 0, "10" +HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% +HKR, Ndi\Params\KeepLink, type, 0, "enum" +HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% +HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% +HKR, Ndi\Params\KeepLink, default, 0, "0" + + +[Neo.Service] +DisplayName = %Neo.Service.DispName% +Description = %Neo.Service.Desc% +ServiceType = 1 +StartType = 3 +ErrorControl = 1 +ServiceBinary = %12%\Neo6_x64_VPN19.sys +LoadOrderGroup = NDIS + +[Neo.Reg] +HKR, Ndi, Service, 0, Neo.Service.Name +HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" +HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" + +[Neo.EventLog] +HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo6_x64_VPN19.sys" +HKR, , TypesSupported, 0x00010001, 7 + +[Strings] +CompanyName = "SoftEther Corporation" +DiskDescription = "VPN Client Device Driver Install Disk" +Neo.Service.Name = "Neo_VPN19" +Neo.Service.DispName = "VPN Client Device Driver - VPN19" +Neo.Service.Desc = "VPN Client Adapter - VPN19" +NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN19" +Neo.EventLog.Name = "Neo" +NetworkAddress = "MAC Address" +DefaultAddress = "000001000001" +MaxSpeed = "Indicate Speed (Mbps)" +KeepLink = "Keep Link" +On = "On" +Off = "Off" + + +; Auto Generated 20180205_163622.670 + diff --git a/src/bin/hamcore/DriverPackages/Neo6_Win10/x64/Neo6_x64_VPN2.inf b/src/bin/hamcore/DriverPackages/Neo6_Win10/x64/Neo6_x64_VPN2.inf index e03059b7..892dfde1 100644 --- a/src/bin/hamcore/DriverPackages/Neo6_Win10/x64/Neo6_x64_VPN2.inf +++ b/src/bin/hamcore/DriverPackages/Neo6_Win10/x64/Neo6_x64_VPN2.inf @@ -1,114 +1,114 @@ -; VPN Client Device Driver for Windows 2000 and Greater -; -; Copyright (c) SoftEther Corporation. All Rights Reserved. -; http://www.softether.co.jp/ -; -; BUILD 9658 - -[Version] -Signature = "$Windows NT$" -Class = Net -ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} -Provider = %CompanyName% -DriverVer = 02/04/2018, 4.25.0.9658 -CatalogFile.NT = Neo6_x64_VPN2.cat - -[Manufacturer] -%CompanyName% = SoftEther, NTamd64 - -[SourceDisksNames] -1=%DiskDescription%, "", , - -[SourceDisksFiles] -Neo6_x64_VPN2.sys = 1 - -[DestinationDirs] -DefaultDestDir = 12 -Neo.CopyFiles.Sys = 12 - -[Neo.CopyFiles.Sys] -Neo6_x64_VPN2.sys, , , 2 - -[SoftEther.NTamd64] -%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN2 - -[NeoAdapter.Install] -Characteristics = 0x1 -AddReg = Neo.Reg, NeoAdapter.Ndi -CopyFiles = Neo.CopyFiles.Sys -*IfType = 53 -*MediaType = 0 -*PhysicalMediaType = 0 - -[NeoAdapter.Install.Services] -AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% - -[NeoAdapter.Ndi] -HKR, , NetworkAddress, 0, %DefaultAddress% -HKR, Ndi, DeviceID, , "NeoAdapter_VPN2" -HKR, , DevLoader, , ndis -HKR, , DeviceVxDs, , Neo6_x64_VPN2.sys -HKR, NDIS, LogDriverName, , "Neo_VPN2" -HKR, NDIS, MajorNdisVersion, 1, 5 -HKR, NDIS, MinorNdisVersion, 1, 0 -HKR, Ndi\Interfaces, DefUpper, , "ndis5" -HKR, Ndi\Interfaces, UpperRange, , "ndis5" -HKR, Ndi\Interfaces, LowerRange, , "ethernet" -HKR, Ndi\Interfaces, DefLower, , "ethernet" -HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" -HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% -HKR, Ndi\Params\NetworkAddress, type, 0, "edit" -HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" -HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" -HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% -HKR, Ndi\Params\NetworkAddress, optional, 0, "0" -HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% -HKR, Ndi\Params\MaxSpeed, type, 0, "int" -HKR, Ndi\Params\MaxSpeed, default, 0, "100" -HKR, Ndi\Params\MaxSpeed, min, 0, "0" -HKR, Ndi\Params\MaxSpeed, max, 0, "2000" -HKR, Ndi\Params\MaxSpeed, step, 0, "1" -HKR, Ndi\Params\MaxSpeed, Base, 0, "10" -HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% -HKR, Ndi\Params\KeepLink, type, 0, "enum" -HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% -HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% -HKR, Ndi\Params\KeepLink, default, 0, "0" - - -[Neo.Service] -DisplayName = %Neo.Service.DispName% -Description = %Neo.Service.Desc% -ServiceType = 1 -StartType = 3 -ErrorControl = 1 -ServiceBinary = %12%\Neo6_x64_VPN2.sys -LoadOrderGroup = NDIS - -[Neo.Reg] -HKR, Ndi, Service, 0, Neo.Service.Name -HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" -HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" - -[Neo.EventLog] -HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo6_x64_VPN2.sys" -HKR, , TypesSupported, 0x00010001, 7 - -[Strings] -CompanyName = "SoftEther Corporation" -DiskDescription = "VPN Client Device Driver Install Disk" -Neo.Service.Name = "Neo_VPN2" -Neo.Service.DispName = "VPN Client Device Driver - VPN2" -Neo.Service.Desc = "VPN Client Adapter - VPN2" -NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN2" -Neo.EventLog.Name = "Neo" -NetworkAddress = "MAC Address" -DefaultAddress = "000001000001" -MaxSpeed = "Indicate Speed (Mbps)" -KeepLink = "Keep Link" -On = "On" -Off = "Off" - - -; Auto Generated 20180205_163621.454 - +; VPN Client Device Driver for Windows 2000 and Greater +; +; Copyright (c) SoftEther Corporation. All Rights Reserved. +; http://www.softether.co.jp/ +; +; BUILD 9658 + +[Version] +Signature = "$Windows NT$" +Class = Net +ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} +Provider = %CompanyName% +DriverVer = 02/04/2018, 4.25.0.9658 +CatalogFile.NT = Neo6_x64_VPN2.cat + +[Manufacturer] +%CompanyName% = SoftEther, NTamd64 + +[SourceDisksNames] +1=%DiskDescription%, "", , + +[SourceDisksFiles] +Neo6_x64_VPN2.sys = 1 + +[DestinationDirs] +DefaultDestDir = 12 +Neo.CopyFiles.Sys = 12 + +[Neo.CopyFiles.Sys] +Neo6_x64_VPN2.sys, , , 2 + +[SoftEther.NTamd64] +%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN2 + +[NeoAdapter.Install] +Characteristics = 0x1 +AddReg = Neo.Reg, NeoAdapter.Ndi +CopyFiles = Neo.CopyFiles.Sys +*IfType = 53 +*MediaType = 0 +*PhysicalMediaType = 0 + +[NeoAdapter.Install.Services] +AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% + +[NeoAdapter.Ndi] +HKR, , NetworkAddress, 0, %DefaultAddress% +HKR, Ndi, DeviceID, , "NeoAdapter_VPN2" +HKR, , DevLoader, , ndis +HKR, , DeviceVxDs, , Neo6_x64_VPN2.sys +HKR, NDIS, LogDriverName, , "Neo_VPN2" +HKR, NDIS, MajorNdisVersion, 1, 5 +HKR, NDIS, MinorNdisVersion, 1, 0 +HKR, Ndi\Interfaces, DefUpper, , "ndis5" +HKR, Ndi\Interfaces, UpperRange, , "ndis5" +HKR, Ndi\Interfaces, LowerRange, , "ethernet" +HKR, Ndi\Interfaces, DefLower, , "ethernet" +HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" +HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% +HKR, Ndi\Params\NetworkAddress, type, 0, "edit" +HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" +HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" +HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% +HKR, Ndi\Params\NetworkAddress, optional, 0, "0" +HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% +HKR, Ndi\Params\MaxSpeed, type, 0, "int" +HKR, Ndi\Params\MaxSpeed, default, 0, "100" +HKR, Ndi\Params\MaxSpeed, min, 0, "0" +HKR, Ndi\Params\MaxSpeed, max, 0, "2000" +HKR, Ndi\Params\MaxSpeed, step, 0, "1" +HKR, Ndi\Params\MaxSpeed, Base, 0, "10" +HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% +HKR, Ndi\Params\KeepLink, type, 0, "enum" +HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% +HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% +HKR, Ndi\Params\KeepLink, default, 0, "0" + + +[Neo.Service] +DisplayName = %Neo.Service.DispName% +Description = %Neo.Service.Desc% +ServiceType = 1 +StartType = 3 +ErrorControl = 1 +ServiceBinary = %12%\Neo6_x64_VPN2.sys +LoadOrderGroup = NDIS + +[Neo.Reg] +HKR, Ndi, Service, 0, Neo.Service.Name +HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" +HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" + +[Neo.EventLog] +HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo6_x64_VPN2.sys" +HKR, , TypesSupported, 0x00010001, 7 + +[Strings] +CompanyName = "SoftEther Corporation" +DiskDescription = "VPN Client Device Driver Install Disk" +Neo.Service.Name = "Neo_VPN2" +Neo.Service.DispName = "VPN Client Device Driver - VPN2" +Neo.Service.Desc = "VPN Client Adapter - VPN2" +NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN2" +Neo.EventLog.Name = "Neo" +NetworkAddress = "MAC Address" +DefaultAddress = "000001000001" +MaxSpeed = "Indicate Speed (Mbps)" +KeepLink = "Keep Link" +On = "On" +Off = "Off" + + +; Auto Generated 20180205_163621.454 + diff --git a/src/bin/hamcore/DriverPackages/Neo6_Win10/x64/Neo6_x64_VPN20.inf b/src/bin/hamcore/DriverPackages/Neo6_Win10/x64/Neo6_x64_VPN20.inf index d2942c35..57f98b76 100644 --- a/src/bin/hamcore/DriverPackages/Neo6_Win10/x64/Neo6_x64_VPN20.inf +++ b/src/bin/hamcore/DriverPackages/Neo6_Win10/x64/Neo6_x64_VPN20.inf @@ -1,114 +1,114 @@ -; VPN Client Device Driver for Windows 2000 and Greater -; -; Copyright (c) SoftEther Corporation. All Rights Reserved. -; http://www.softether.co.jp/ -; -; BUILD 9658 - -[Version] -Signature = "$Windows NT$" -Class = Net -ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} -Provider = %CompanyName% -DriverVer = 02/04/2018, 4.25.0.9658 -CatalogFile.NT = Neo6_x64_VPN20.cat - -[Manufacturer] -%CompanyName% = SoftEther, NTamd64 - -[SourceDisksNames] -1=%DiskDescription%, "", , - -[SourceDisksFiles] -Neo6_x64_VPN20.sys = 1 - -[DestinationDirs] -DefaultDestDir = 12 -Neo.CopyFiles.Sys = 12 - -[Neo.CopyFiles.Sys] -Neo6_x64_VPN20.sys, , , 2 - -[SoftEther.NTamd64] -%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN20 - -[NeoAdapter.Install] -Characteristics = 0x1 -AddReg = Neo.Reg, NeoAdapter.Ndi -CopyFiles = Neo.CopyFiles.Sys -*IfType = 53 -*MediaType = 0 -*PhysicalMediaType = 0 - -[NeoAdapter.Install.Services] -AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% - -[NeoAdapter.Ndi] -HKR, , NetworkAddress, 0, %DefaultAddress% -HKR, Ndi, DeviceID, , "NeoAdapter_VPN20" -HKR, , DevLoader, , ndis -HKR, , DeviceVxDs, , Neo6_x64_VPN20.sys -HKR, NDIS, LogDriverName, , "Neo_VPN20" -HKR, NDIS, MajorNdisVersion, 1, 5 -HKR, NDIS, MinorNdisVersion, 1, 0 -HKR, Ndi\Interfaces, DefUpper, , "ndis5" -HKR, Ndi\Interfaces, UpperRange, , "ndis5" -HKR, Ndi\Interfaces, LowerRange, , "ethernet" -HKR, Ndi\Interfaces, DefLower, , "ethernet" -HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" -HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% -HKR, Ndi\Params\NetworkAddress, type, 0, "edit" -HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" -HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" -HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% -HKR, Ndi\Params\NetworkAddress, optional, 0, "0" -HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% -HKR, Ndi\Params\MaxSpeed, type, 0, "int" -HKR, Ndi\Params\MaxSpeed, default, 0, "100" -HKR, Ndi\Params\MaxSpeed, min, 0, "0" -HKR, Ndi\Params\MaxSpeed, max, 0, "2000" -HKR, Ndi\Params\MaxSpeed, step, 0, "1" -HKR, Ndi\Params\MaxSpeed, Base, 0, "10" -HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% -HKR, Ndi\Params\KeepLink, type, 0, "enum" -HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% -HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% -HKR, Ndi\Params\KeepLink, default, 0, "0" - - -[Neo.Service] -DisplayName = %Neo.Service.DispName% -Description = %Neo.Service.Desc% -ServiceType = 1 -StartType = 3 -ErrorControl = 1 -ServiceBinary = %12%\Neo6_x64_VPN20.sys -LoadOrderGroup = NDIS - -[Neo.Reg] -HKR, Ndi, Service, 0, Neo.Service.Name -HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" -HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" - -[Neo.EventLog] -HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo6_x64_VPN20.sys" -HKR, , TypesSupported, 0x00010001, 7 - -[Strings] -CompanyName = "SoftEther Corporation" -DiskDescription = "VPN Client Device Driver Install Disk" -Neo.Service.Name = "Neo_VPN20" -Neo.Service.DispName = "VPN Client Device Driver - VPN20" -Neo.Service.Desc = "VPN Client Adapter - VPN20" -NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN20" -Neo.EventLog.Name = "Neo" -NetworkAddress = "MAC Address" -DefaultAddress = "000001000001" -MaxSpeed = "Indicate Speed (Mbps)" -KeepLink = "Keep Link" -On = "On" -Off = "Off" - - -; Auto Generated 20180205_163622.743 - +; VPN Client Device Driver for Windows 2000 and Greater +; +; Copyright (c) SoftEther Corporation. All Rights Reserved. +; http://www.softether.co.jp/ +; +; BUILD 9658 + +[Version] +Signature = "$Windows NT$" +Class = Net +ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} +Provider = %CompanyName% +DriverVer = 02/04/2018, 4.25.0.9658 +CatalogFile.NT = Neo6_x64_VPN20.cat + +[Manufacturer] +%CompanyName% = SoftEther, NTamd64 + +[SourceDisksNames] +1=%DiskDescription%, "", , + +[SourceDisksFiles] +Neo6_x64_VPN20.sys = 1 + +[DestinationDirs] +DefaultDestDir = 12 +Neo.CopyFiles.Sys = 12 + +[Neo.CopyFiles.Sys] +Neo6_x64_VPN20.sys, , , 2 + +[SoftEther.NTamd64] +%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN20 + +[NeoAdapter.Install] +Characteristics = 0x1 +AddReg = Neo.Reg, NeoAdapter.Ndi +CopyFiles = Neo.CopyFiles.Sys +*IfType = 53 +*MediaType = 0 +*PhysicalMediaType = 0 + +[NeoAdapter.Install.Services] +AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% + +[NeoAdapter.Ndi] +HKR, , NetworkAddress, 0, %DefaultAddress% +HKR, Ndi, DeviceID, , "NeoAdapter_VPN20" +HKR, , DevLoader, , ndis +HKR, , DeviceVxDs, , Neo6_x64_VPN20.sys +HKR, NDIS, LogDriverName, , "Neo_VPN20" +HKR, NDIS, MajorNdisVersion, 1, 5 +HKR, NDIS, MinorNdisVersion, 1, 0 +HKR, Ndi\Interfaces, DefUpper, , "ndis5" +HKR, Ndi\Interfaces, UpperRange, , "ndis5" +HKR, Ndi\Interfaces, LowerRange, , "ethernet" +HKR, Ndi\Interfaces, DefLower, , "ethernet" +HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" +HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% +HKR, Ndi\Params\NetworkAddress, type, 0, "edit" +HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" +HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" +HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% +HKR, Ndi\Params\NetworkAddress, optional, 0, "0" +HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% +HKR, Ndi\Params\MaxSpeed, type, 0, "int" +HKR, Ndi\Params\MaxSpeed, default, 0, "100" +HKR, Ndi\Params\MaxSpeed, min, 0, "0" +HKR, Ndi\Params\MaxSpeed, max, 0, "2000" +HKR, Ndi\Params\MaxSpeed, step, 0, "1" +HKR, Ndi\Params\MaxSpeed, Base, 0, "10" +HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% +HKR, Ndi\Params\KeepLink, type, 0, "enum" +HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% +HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% +HKR, Ndi\Params\KeepLink, default, 0, "0" + + +[Neo.Service] +DisplayName = %Neo.Service.DispName% +Description = %Neo.Service.Desc% +ServiceType = 1 +StartType = 3 +ErrorControl = 1 +ServiceBinary = %12%\Neo6_x64_VPN20.sys +LoadOrderGroup = NDIS + +[Neo.Reg] +HKR, Ndi, Service, 0, Neo.Service.Name +HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" +HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" + +[Neo.EventLog] +HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo6_x64_VPN20.sys" +HKR, , TypesSupported, 0x00010001, 7 + +[Strings] +CompanyName = "SoftEther Corporation" +DiskDescription = "VPN Client Device Driver Install Disk" +Neo.Service.Name = "Neo_VPN20" +Neo.Service.DispName = "VPN Client Device Driver - VPN20" +Neo.Service.Desc = "VPN Client Adapter - VPN20" +NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN20" +Neo.EventLog.Name = "Neo" +NetworkAddress = "MAC Address" +DefaultAddress = "000001000001" +MaxSpeed = "Indicate Speed (Mbps)" +KeepLink = "Keep Link" +On = "On" +Off = "Off" + + +; Auto Generated 20180205_163622.743 + diff --git a/src/bin/hamcore/DriverPackages/Neo6_Win10/x64/Neo6_x64_VPN21.inf b/src/bin/hamcore/DriverPackages/Neo6_Win10/x64/Neo6_x64_VPN21.inf index be6de484..d614c278 100644 --- a/src/bin/hamcore/DriverPackages/Neo6_Win10/x64/Neo6_x64_VPN21.inf +++ b/src/bin/hamcore/DriverPackages/Neo6_Win10/x64/Neo6_x64_VPN21.inf @@ -1,114 +1,114 @@ -; VPN Client Device Driver for Windows 2000 and Greater -; -; Copyright (c) SoftEther Corporation. All Rights Reserved. -; http://www.softether.co.jp/ -; -; BUILD 9658 - -[Version] -Signature = "$Windows NT$" -Class = Net -ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} -Provider = %CompanyName% -DriverVer = 02/04/2018, 4.25.0.9658 -CatalogFile.NT = Neo6_x64_VPN21.cat - -[Manufacturer] -%CompanyName% = SoftEther, NTamd64 - -[SourceDisksNames] -1=%DiskDescription%, "", , - -[SourceDisksFiles] -Neo6_x64_VPN21.sys = 1 - -[DestinationDirs] -DefaultDestDir = 12 -Neo.CopyFiles.Sys = 12 - -[Neo.CopyFiles.Sys] -Neo6_x64_VPN21.sys, , , 2 - -[SoftEther.NTamd64] -%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN21 - -[NeoAdapter.Install] -Characteristics = 0x1 -AddReg = Neo.Reg, NeoAdapter.Ndi -CopyFiles = Neo.CopyFiles.Sys -*IfType = 53 -*MediaType = 0 -*PhysicalMediaType = 0 - -[NeoAdapter.Install.Services] -AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% - -[NeoAdapter.Ndi] -HKR, , NetworkAddress, 0, %DefaultAddress% -HKR, Ndi, DeviceID, , "NeoAdapter_VPN21" -HKR, , DevLoader, , ndis -HKR, , DeviceVxDs, , Neo6_x64_VPN21.sys -HKR, NDIS, LogDriverName, , "Neo_VPN21" -HKR, NDIS, MajorNdisVersion, 1, 5 -HKR, NDIS, MinorNdisVersion, 1, 0 -HKR, Ndi\Interfaces, DefUpper, , "ndis5" -HKR, Ndi\Interfaces, UpperRange, , "ndis5" -HKR, Ndi\Interfaces, LowerRange, , "ethernet" -HKR, Ndi\Interfaces, DefLower, , "ethernet" -HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" -HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% -HKR, Ndi\Params\NetworkAddress, type, 0, "edit" -HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" -HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" -HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% -HKR, Ndi\Params\NetworkAddress, optional, 0, "0" -HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% -HKR, Ndi\Params\MaxSpeed, type, 0, "int" -HKR, Ndi\Params\MaxSpeed, default, 0, "100" -HKR, Ndi\Params\MaxSpeed, min, 0, "0" -HKR, Ndi\Params\MaxSpeed, max, 0, "2000" -HKR, Ndi\Params\MaxSpeed, step, 0, "1" -HKR, Ndi\Params\MaxSpeed, Base, 0, "10" -HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% -HKR, Ndi\Params\KeepLink, type, 0, "enum" -HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% -HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% -HKR, Ndi\Params\KeepLink, default, 0, "0" - - -[Neo.Service] -DisplayName = %Neo.Service.DispName% -Description = %Neo.Service.Desc% -ServiceType = 1 -StartType = 3 -ErrorControl = 1 -ServiceBinary = %12%\Neo6_x64_VPN21.sys -LoadOrderGroup = NDIS - -[Neo.Reg] -HKR, Ndi, Service, 0, Neo.Service.Name -HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" -HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" - -[Neo.EventLog] -HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo6_x64_VPN21.sys" -HKR, , TypesSupported, 0x00010001, 7 - -[Strings] -CompanyName = "SoftEther Corporation" -DiskDescription = "VPN Client Device Driver Install Disk" -Neo.Service.Name = "Neo_VPN21" -Neo.Service.DispName = "VPN Client Device Driver - VPN21" -Neo.Service.Desc = "VPN Client Adapter - VPN21" -NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN21" -Neo.EventLog.Name = "Neo" -NetworkAddress = "MAC Address" -DefaultAddress = "000001000001" -MaxSpeed = "Indicate Speed (Mbps)" -KeepLink = "Keep Link" -On = "On" -Off = "Off" - - -; Auto Generated 20180205_163622.813 - +; VPN Client Device Driver for Windows 2000 and Greater +; +; Copyright (c) SoftEther Corporation. All Rights Reserved. +; http://www.softether.co.jp/ +; +; BUILD 9658 + +[Version] +Signature = "$Windows NT$" +Class = Net +ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} +Provider = %CompanyName% +DriverVer = 02/04/2018, 4.25.0.9658 +CatalogFile.NT = Neo6_x64_VPN21.cat + +[Manufacturer] +%CompanyName% = SoftEther, NTamd64 + +[SourceDisksNames] +1=%DiskDescription%, "", , + +[SourceDisksFiles] +Neo6_x64_VPN21.sys = 1 + +[DestinationDirs] +DefaultDestDir = 12 +Neo.CopyFiles.Sys = 12 + +[Neo.CopyFiles.Sys] +Neo6_x64_VPN21.sys, , , 2 + +[SoftEther.NTamd64] +%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN21 + +[NeoAdapter.Install] +Characteristics = 0x1 +AddReg = Neo.Reg, NeoAdapter.Ndi +CopyFiles = Neo.CopyFiles.Sys +*IfType = 53 +*MediaType = 0 +*PhysicalMediaType = 0 + +[NeoAdapter.Install.Services] +AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% + +[NeoAdapter.Ndi] +HKR, , NetworkAddress, 0, %DefaultAddress% +HKR, Ndi, DeviceID, , "NeoAdapter_VPN21" +HKR, , DevLoader, , ndis +HKR, , DeviceVxDs, , Neo6_x64_VPN21.sys +HKR, NDIS, LogDriverName, , "Neo_VPN21" +HKR, NDIS, MajorNdisVersion, 1, 5 +HKR, NDIS, MinorNdisVersion, 1, 0 +HKR, Ndi\Interfaces, DefUpper, , "ndis5" +HKR, Ndi\Interfaces, UpperRange, , "ndis5" +HKR, Ndi\Interfaces, LowerRange, , "ethernet" +HKR, Ndi\Interfaces, DefLower, , "ethernet" +HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" +HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% +HKR, Ndi\Params\NetworkAddress, type, 0, "edit" +HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" +HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" +HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% +HKR, Ndi\Params\NetworkAddress, optional, 0, "0" +HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% +HKR, Ndi\Params\MaxSpeed, type, 0, "int" +HKR, Ndi\Params\MaxSpeed, default, 0, "100" +HKR, Ndi\Params\MaxSpeed, min, 0, "0" +HKR, Ndi\Params\MaxSpeed, max, 0, "2000" +HKR, Ndi\Params\MaxSpeed, step, 0, "1" +HKR, Ndi\Params\MaxSpeed, Base, 0, "10" +HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% +HKR, Ndi\Params\KeepLink, type, 0, "enum" +HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% +HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% +HKR, Ndi\Params\KeepLink, default, 0, "0" + + +[Neo.Service] +DisplayName = %Neo.Service.DispName% +Description = %Neo.Service.Desc% +ServiceType = 1 +StartType = 3 +ErrorControl = 1 +ServiceBinary = %12%\Neo6_x64_VPN21.sys +LoadOrderGroup = NDIS + +[Neo.Reg] +HKR, Ndi, Service, 0, Neo.Service.Name +HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" +HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" + +[Neo.EventLog] +HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo6_x64_VPN21.sys" +HKR, , TypesSupported, 0x00010001, 7 + +[Strings] +CompanyName = "SoftEther Corporation" +DiskDescription = "VPN Client Device Driver Install Disk" +Neo.Service.Name = "Neo_VPN21" +Neo.Service.DispName = "VPN Client Device Driver - VPN21" +Neo.Service.Desc = "VPN Client Adapter - VPN21" +NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN21" +Neo.EventLog.Name = "Neo" +NetworkAddress = "MAC Address" +DefaultAddress = "000001000001" +MaxSpeed = "Indicate Speed (Mbps)" +KeepLink = "Keep Link" +On = "On" +Off = "Off" + + +; Auto Generated 20180205_163622.813 + diff --git a/src/bin/hamcore/DriverPackages/Neo6_Win10/x64/Neo6_x64_VPN22.inf b/src/bin/hamcore/DriverPackages/Neo6_Win10/x64/Neo6_x64_VPN22.inf index 58829887..7984399f 100644 --- a/src/bin/hamcore/DriverPackages/Neo6_Win10/x64/Neo6_x64_VPN22.inf +++ b/src/bin/hamcore/DriverPackages/Neo6_Win10/x64/Neo6_x64_VPN22.inf @@ -1,114 +1,114 @@ -; VPN Client Device Driver for Windows 2000 and Greater -; -; Copyright (c) SoftEther Corporation. All Rights Reserved. -; http://www.softether.co.jp/ -; -; BUILD 9658 - -[Version] -Signature = "$Windows NT$" -Class = Net -ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} -Provider = %CompanyName% -DriverVer = 02/04/2018, 4.25.0.9658 -CatalogFile.NT = Neo6_x64_VPN22.cat - -[Manufacturer] -%CompanyName% = SoftEther, NTamd64 - -[SourceDisksNames] -1=%DiskDescription%, "", , - -[SourceDisksFiles] -Neo6_x64_VPN22.sys = 1 - -[DestinationDirs] -DefaultDestDir = 12 -Neo.CopyFiles.Sys = 12 - -[Neo.CopyFiles.Sys] -Neo6_x64_VPN22.sys, , , 2 - -[SoftEther.NTamd64] -%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN22 - -[NeoAdapter.Install] -Characteristics = 0x1 -AddReg = Neo.Reg, NeoAdapter.Ndi -CopyFiles = Neo.CopyFiles.Sys -*IfType = 53 -*MediaType = 0 -*PhysicalMediaType = 0 - -[NeoAdapter.Install.Services] -AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% - -[NeoAdapter.Ndi] -HKR, , NetworkAddress, 0, %DefaultAddress% -HKR, Ndi, DeviceID, , "NeoAdapter_VPN22" -HKR, , DevLoader, , ndis -HKR, , DeviceVxDs, , Neo6_x64_VPN22.sys -HKR, NDIS, LogDriverName, , "Neo_VPN22" -HKR, NDIS, MajorNdisVersion, 1, 5 -HKR, NDIS, MinorNdisVersion, 1, 0 -HKR, Ndi\Interfaces, DefUpper, , "ndis5" -HKR, Ndi\Interfaces, UpperRange, , "ndis5" -HKR, Ndi\Interfaces, LowerRange, , "ethernet" -HKR, Ndi\Interfaces, DefLower, , "ethernet" -HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" -HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% -HKR, Ndi\Params\NetworkAddress, type, 0, "edit" -HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" -HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" -HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% -HKR, Ndi\Params\NetworkAddress, optional, 0, "0" -HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% -HKR, Ndi\Params\MaxSpeed, type, 0, "int" -HKR, Ndi\Params\MaxSpeed, default, 0, "100" -HKR, Ndi\Params\MaxSpeed, min, 0, "0" -HKR, Ndi\Params\MaxSpeed, max, 0, "2000" -HKR, Ndi\Params\MaxSpeed, step, 0, "1" -HKR, Ndi\Params\MaxSpeed, Base, 0, "10" -HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% -HKR, Ndi\Params\KeepLink, type, 0, "enum" -HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% -HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% -HKR, Ndi\Params\KeepLink, default, 0, "0" - - -[Neo.Service] -DisplayName = %Neo.Service.DispName% -Description = %Neo.Service.Desc% -ServiceType = 1 -StartType = 3 -ErrorControl = 1 -ServiceBinary = %12%\Neo6_x64_VPN22.sys -LoadOrderGroup = NDIS - -[Neo.Reg] -HKR, Ndi, Service, 0, Neo.Service.Name -HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" -HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" - -[Neo.EventLog] -HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo6_x64_VPN22.sys" -HKR, , TypesSupported, 0x00010001, 7 - -[Strings] -CompanyName = "SoftEther Corporation" -DiskDescription = "VPN Client Device Driver Install Disk" -Neo.Service.Name = "Neo_VPN22" -Neo.Service.DispName = "VPN Client Device Driver - VPN22" -Neo.Service.Desc = "VPN Client Adapter - VPN22" -NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN22" -Neo.EventLog.Name = "Neo" -NetworkAddress = "MAC Address" -DefaultAddress = "000001000001" -MaxSpeed = "Indicate Speed (Mbps)" -KeepLink = "Keep Link" -On = "On" -Off = "Off" - - -; Auto Generated 20180205_163622.882 - +; VPN Client Device Driver for Windows 2000 and Greater +; +; Copyright (c) SoftEther Corporation. All Rights Reserved. +; http://www.softether.co.jp/ +; +; BUILD 9658 + +[Version] +Signature = "$Windows NT$" +Class = Net +ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} +Provider = %CompanyName% +DriverVer = 02/04/2018, 4.25.0.9658 +CatalogFile.NT = Neo6_x64_VPN22.cat + +[Manufacturer] +%CompanyName% = SoftEther, NTamd64 + +[SourceDisksNames] +1=%DiskDescription%, "", , + +[SourceDisksFiles] +Neo6_x64_VPN22.sys = 1 + +[DestinationDirs] +DefaultDestDir = 12 +Neo.CopyFiles.Sys = 12 + +[Neo.CopyFiles.Sys] +Neo6_x64_VPN22.sys, , , 2 + +[SoftEther.NTamd64] +%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN22 + +[NeoAdapter.Install] +Characteristics = 0x1 +AddReg = Neo.Reg, NeoAdapter.Ndi +CopyFiles = Neo.CopyFiles.Sys +*IfType = 53 +*MediaType = 0 +*PhysicalMediaType = 0 + +[NeoAdapter.Install.Services] +AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% + +[NeoAdapter.Ndi] +HKR, , NetworkAddress, 0, %DefaultAddress% +HKR, Ndi, DeviceID, , "NeoAdapter_VPN22" +HKR, , DevLoader, , ndis +HKR, , DeviceVxDs, , Neo6_x64_VPN22.sys +HKR, NDIS, LogDriverName, , "Neo_VPN22" +HKR, NDIS, MajorNdisVersion, 1, 5 +HKR, NDIS, MinorNdisVersion, 1, 0 +HKR, Ndi\Interfaces, DefUpper, , "ndis5" +HKR, Ndi\Interfaces, UpperRange, , "ndis5" +HKR, Ndi\Interfaces, LowerRange, , "ethernet" +HKR, Ndi\Interfaces, DefLower, , "ethernet" +HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" +HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% +HKR, Ndi\Params\NetworkAddress, type, 0, "edit" +HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" +HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" +HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% +HKR, Ndi\Params\NetworkAddress, optional, 0, "0" +HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% +HKR, Ndi\Params\MaxSpeed, type, 0, "int" +HKR, Ndi\Params\MaxSpeed, default, 0, "100" +HKR, Ndi\Params\MaxSpeed, min, 0, "0" +HKR, Ndi\Params\MaxSpeed, max, 0, "2000" +HKR, Ndi\Params\MaxSpeed, step, 0, "1" +HKR, Ndi\Params\MaxSpeed, Base, 0, "10" +HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% +HKR, Ndi\Params\KeepLink, type, 0, "enum" +HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% +HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% +HKR, Ndi\Params\KeepLink, default, 0, "0" + + +[Neo.Service] +DisplayName = %Neo.Service.DispName% +Description = %Neo.Service.Desc% +ServiceType = 1 +StartType = 3 +ErrorControl = 1 +ServiceBinary = %12%\Neo6_x64_VPN22.sys +LoadOrderGroup = NDIS + +[Neo.Reg] +HKR, Ndi, Service, 0, Neo.Service.Name +HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" +HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" + +[Neo.EventLog] +HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo6_x64_VPN22.sys" +HKR, , TypesSupported, 0x00010001, 7 + +[Strings] +CompanyName = "SoftEther Corporation" +DiskDescription = "VPN Client Device Driver Install Disk" +Neo.Service.Name = "Neo_VPN22" +Neo.Service.DispName = "VPN Client Device Driver - VPN22" +Neo.Service.Desc = "VPN Client Adapter - VPN22" +NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN22" +Neo.EventLog.Name = "Neo" +NetworkAddress = "MAC Address" +DefaultAddress = "000001000001" +MaxSpeed = "Indicate Speed (Mbps)" +KeepLink = "Keep Link" +On = "On" +Off = "Off" + + +; Auto Generated 20180205_163622.882 + diff --git a/src/bin/hamcore/DriverPackages/Neo6_Win10/x64/Neo6_x64_VPN23.inf b/src/bin/hamcore/DriverPackages/Neo6_Win10/x64/Neo6_x64_VPN23.inf index 658d0576..bdc62692 100644 --- a/src/bin/hamcore/DriverPackages/Neo6_Win10/x64/Neo6_x64_VPN23.inf +++ b/src/bin/hamcore/DriverPackages/Neo6_Win10/x64/Neo6_x64_VPN23.inf @@ -1,114 +1,114 @@ -; VPN Client Device Driver for Windows 2000 and Greater -; -; Copyright (c) SoftEther Corporation. All Rights Reserved. -; http://www.softether.co.jp/ -; -; BUILD 9658 - -[Version] -Signature = "$Windows NT$" -Class = Net -ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} -Provider = %CompanyName% -DriverVer = 02/04/2018, 4.25.0.9658 -CatalogFile.NT = Neo6_x64_VPN23.cat - -[Manufacturer] -%CompanyName% = SoftEther, NTamd64 - -[SourceDisksNames] -1=%DiskDescription%, "", , - -[SourceDisksFiles] -Neo6_x64_VPN23.sys = 1 - -[DestinationDirs] -DefaultDestDir = 12 -Neo.CopyFiles.Sys = 12 - -[Neo.CopyFiles.Sys] -Neo6_x64_VPN23.sys, , , 2 - -[SoftEther.NTamd64] -%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN23 - -[NeoAdapter.Install] -Characteristics = 0x1 -AddReg = Neo.Reg, NeoAdapter.Ndi -CopyFiles = Neo.CopyFiles.Sys -*IfType = 53 -*MediaType = 0 -*PhysicalMediaType = 0 - -[NeoAdapter.Install.Services] -AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% - -[NeoAdapter.Ndi] -HKR, , NetworkAddress, 0, %DefaultAddress% -HKR, Ndi, DeviceID, , "NeoAdapter_VPN23" -HKR, , DevLoader, , ndis -HKR, , DeviceVxDs, , Neo6_x64_VPN23.sys -HKR, NDIS, LogDriverName, , "Neo_VPN23" -HKR, NDIS, MajorNdisVersion, 1, 5 -HKR, NDIS, MinorNdisVersion, 1, 0 -HKR, Ndi\Interfaces, DefUpper, , "ndis5" -HKR, Ndi\Interfaces, UpperRange, , "ndis5" -HKR, Ndi\Interfaces, LowerRange, , "ethernet" -HKR, Ndi\Interfaces, DefLower, , "ethernet" -HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" -HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% -HKR, Ndi\Params\NetworkAddress, type, 0, "edit" -HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" -HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" -HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% -HKR, Ndi\Params\NetworkAddress, optional, 0, "0" -HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% -HKR, Ndi\Params\MaxSpeed, type, 0, "int" -HKR, Ndi\Params\MaxSpeed, default, 0, "100" -HKR, Ndi\Params\MaxSpeed, min, 0, "0" -HKR, Ndi\Params\MaxSpeed, max, 0, "2000" -HKR, Ndi\Params\MaxSpeed, step, 0, "1" -HKR, Ndi\Params\MaxSpeed, Base, 0, "10" -HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% -HKR, Ndi\Params\KeepLink, type, 0, "enum" -HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% -HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% -HKR, Ndi\Params\KeepLink, default, 0, "0" - - -[Neo.Service] -DisplayName = %Neo.Service.DispName% -Description = %Neo.Service.Desc% -ServiceType = 1 -StartType = 3 -ErrorControl = 1 -ServiceBinary = %12%\Neo6_x64_VPN23.sys -LoadOrderGroup = NDIS - -[Neo.Reg] -HKR, Ndi, Service, 0, Neo.Service.Name -HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" -HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" - -[Neo.EventLog] -HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo6_x64_VPN23.sys" -HKR, , TypesSupported, 0x00010001, 7 - -[Strings] -CompanyName = "SoftEther Corporation" -DiskDescription = "VPN Client Device Driver Install Disk" -Neo.Service.Name = "Neo_VPN23" -Neo.Service.DispName = "VPN Client Device Driver - VPN23" -Neo.Service.Desc = "VPN Client Adapter - VPN23" -NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN23" -Neo.EventLog.Name = "Neo" -NetworkAddress = "MAC Address" -DefaultAddress = "000001000001" -MaxSpeed = "Indicate Speed (Mbps)" -KeepLink = "Keep Link" -On = "On" -Off = "Off" - - -; Auto Generated 20180205_163622.953 - +; VPN Client Device Driver for Windows 2000 and Greater +; +; Copyright (c) SoftEther Corporation. All Rights Reserved. +; http://www.softether.co.jp/ +; +; BUILD 9658 + +[Version] +Signature = "$Windows NT$" +Class = Net +ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} +Provider = %CompanyName% +DriverVer = 02/04/2018, 4.25.0.9658 +CatalogFile.NT = Neo6_x64_VPN23.cat + +[Manufacturer] +%CompanyName% = SoftEther, NTamd64 + +[SourceDisksNames] +1=%DiskDescription%, "", , + +[SourceDisksFiles] +Neo6_x64_VPN23.sys = 1 + +[DestinationDirs] +DefaultDestDir = 12 +Neo.CopyFiles.Sys = 12 + +[Neo.CopyFiles.Sys] +Neo6_x64_VPN23.sys, , , 2 + +[SoftEther.NTamd64] +%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN23 + +[NeoAdapter.Install] +Characteristics = 0x1 +AddReg = Neo.Reg, NeoAdapter.Ndi +CopyFiles = Neo.CopyFiles.Sys +*IfType = 53 +*MediaType = 0 +*PhysicalMediaType = 0 + +[NeoAdapter.Install.Services] +AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% + +[NeoAdapter.Ndi] +HKR, , NetworkAddress, 0, %DefaultAddress% +HKR, Ndi, DeviceID, , "NeoAdapter_VPN23" +HKR, , DevLoader, , ndis +HKR, , DeviceVxDs, , Neo6_x64_VPN23.sys +HKR, NDIS, LogDriverName, , "Neo_VPN23" +HKR, NDIS, MajorNdisVersion, 1, 5 +HKR, NDIS, MinorNdisVersion, 1, 0 +HKR, Ndi\Interfaces, DefUpper, , "ndis5" +HKR, Ndi\Interfaces, UpperRange, , "ndis5" +HKR, Ndi\Interfaces, LowerRange, , "ethernet" +HKR, Ndi\Interfaces, DefLower, , "ethernet" +HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" +HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% +HKR, Ndi\Params\NetworkAddress, type, 0, "edit" +HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" +HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" +HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% +HKR, Ndi\Params\NetworkAddress, optional, 0, "0" +HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% +HKR, Ndi\Params\MaxSpeed, type, 0, "int" +HKR, Ndi\Params\MaxSpeed, default, 0, "100" +HKR, Ndi\Params\MaxSpeed, min, 0, "0" +HKR, Ndi\Params\MaxSpeed, max, 0, "2000" +HKR, Ndi\Params\MaxSpeed, step, 0, "1" +HKR, Ndi\Params\MaxSpeed, Base, 0, "10" +HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% +HKR, Ndi\Params\KeepLink, type, 0, "enum" +HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% +HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% +HKR, Ndi\Params\KeepLink, default, 0, "0" + + +[Neo.Service] +DisplayName = %Neo.Service.DispName% +Description = %Neo.Service.Desc% +ServiceType = 1 +StartType = 3 +ErrorControl = 1 +ServiceBinary = %12%\Neo6_x64_VPN23.sys +LoadOrderGroup = NDIS + +[Neo.Reg] +HKR, Ndi, Service, 0, Neo.Service.Name +HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" +HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" + +[Neo.EventLog] +HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo6_x64_VPN23.sys" +HKR, , TypesSupported, 0x00010001, 7 + +[Strings] +CompanyName = "SoftEther Corporation" +DiskDescription = "VPN Client Device Driver Install Disk" +Neo.Service.Name = "Neo_VPN23" +Neo.Service.DispName = "VPN Client Device Driver - VPN23" +Neo.Service.Desc = "VPN Client Adapter - VPN23" +NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN23" +Neo.EventLog.Name = "Neo" +NetworkAddress = "MAC Address" +DefaultAddress = "000001000001" +MaxSpeed = "Indicate Speed (Mbps)" +KeepLink = "Keep Link" +On = "On" +Off = "Off" + + +; Auto Generated 20180205_163622.953 + diff --git a/src/bin/hamcore/DriverPackages/Neo6_Win10/x64/Neo6_x64_VPN24.inf b/src/bin/hamcore/DriverPackages/Neo6_Win10/x64/Neo6_x64_VPN24.inf index 5be475fe..a5343f08 100644 --- a/src/bin/hamcore/DriverPackages/Neo6_Win10/x64/Neo6_x64_VPN24.inf +++ b/src/bin/hamcore/DriverPackages/Neo6_Win10/x64/Neo6_x64_VPN24.inf @@ -1,114 +1,114 @@ -; VPN Client Device Driver for Windows 2000 and Greater -; -; Copyright (c) SoftEther Corporation. All Rights Reserved. -; http://www.softether.co.jp/ -; -; BUILD 9658 - -[Version] -Signature = "$Windows NT$" -Class = Net -ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} -Provider = %CompanyName% -DriverVer = 02/04/2018, 4.25.0.9658 -CatalogFile.NT = Neo6_x64_VPN24.cat - -[Manufacturer] -%CompanyName% = SoftEther, NTamd64 - -[SourceDisksNames] -1=%DiskDescription%, "", , - -[SourceDisksFiles] -Neo6_x64_VPN24.sys = 1 - -[DestinationDirs] -DefaultDestDir = 12 -Neo.CopyFiles.Sys = 12 - -[Neo.CopyFiles.Sys] -Neo6_x64_VPN24.sys, , , 2 - -[SoftEther.NTamd64] -%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN24 - -[NeoAdapter.Install] -Characteristics = 0x1 -AddReg = Neo.Reg, NeoAdapter.Ndi -CopyFiles = Neo.CopyFiles.Sys -*IfType = 53 -*MediaType = 0 -*PhysicalMediaType = 0 - -[NeoAdapter.Install.Services] -AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% - -[NeoAdapter.Ndi] -HKR, , NetworkAddress, 0, %DefaultAddress% -HKR, Ndi, DeviceID, , "NeoAdapter_VPN24" -HKR, , DevLoader, , ndis -HKR, , DeviceVxDs, , Neo6_x64_VPN24.sys -HKR, NDIS, LogDriverName, , "Neo_VPN24" -HKR, NDIS, MajorNdisVersion, 1, 5 -HKR, NDIS, MinorNdisVersion, 1, 0 -HKR, Ndi\Interfaces, DefUpper, , "ndis5" -HKR, Ndi\Interfaces, UpperRange, , "ndis5" -HKR, Ndi\Interfaces, LowerRange, , "ethernet" -HKR, Ndi\Interfaces, DefLower, , "ethernet" -HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" -HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% -HKR, Ndi\Params\NetworkAddress, type, 0, "edit" -HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" -HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" -HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% -HKR, Ndi\Params\NetworkAddress, optional, 0, "0" -HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% -HKR, Ndi\Params\MaxSpeed, type, 0, "int" -HKR, Ndi\Params\MaxSpeed, default, 0, "100" -HKR, Ndi\Params\MaxSpeed, min, 0, "0" -HKR, Ndi\Params\MaxSpeed, max, 0, "2000" -HKR, Ndi\Params\MaxSpeed, step, 0, "1" -HKR, Ndi\Params\MaxSpeed, Base, 0, "10" -HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% -HKR, Ndi\Params\KeepLink, type, 0, "enum" -HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% -HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% -HKR, Ndi\Params\KeepLink, default, 0, "0" - - -[Neo.Service] -DisplayName = %Neo.Service.DispName% -Description = %Neo.Service.Desc% -ServiceType = 1 -StartType = 3 -ErrorControl = 1 -ServiceBinary = %12%\Neo6_x64_VPN24.sys -LoadOrderGroup = NDIS - -[Neo.Reg] -HKR, Ndi, Service, 0, Neo.Service.Name -HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" -HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" - -[Neo.EventLog] -HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo6_x64_VPN24.sys" -HKR, , TypesSupported, 0x00010001, 7 - -[Strings] -CompanyName = "SoftEther Corporation" -DiskDescription = "VPN Client Device Driver Install Disk" -Neo.Service.Name = "Neo_VPN24" -Neo.Service.DispName = "VPN Client Device Driver - VPN24" -Neo.Service.Desc = "VPN Client Adapter - VPN24" -NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN24" -Neo.EventLog.Name = "Neo" -NetworkAddress = "MAC Address" -DefaultAddress = "000001000001" -MaxSpeed = "Indicate Speed (Mbps)" -KeepLink = "Keep Link" -On = "On" -Off = "Off" - - -; Auto Generated 20180205_163623.024 - +; VPN Client Device Driver for Windows 2000 and Greater +; +; Copyright (c) SoftEther Corporation. All Rights Reserved. +; http://www.softether.co.jp/ +; +; BUILD 9658 + +[Version] +Signature = "$Windows NT$" +Class = Net +ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} +Provider = %CompanyName% +DriverVer = 02/04/2018, 4.25.0.9658 +CatalogFile.NT = Neo6_x64_VPN24.cat + +[Manufacturer] +%CompanyName% = SoftEther, NTamd64 + +[SourceDisksNames] +1=%DiskDescription%, "", , + +[SourceDisksFiles] +Neo6_x64_VPN24.sys = 1 + +[DestinationDirs] +DefaultDestDir = 12 +Neo.CopyFiles.Sys = 12 + +[Neo.CopyFiles.Sys] +Neo6_x64_VPN24.sys, , , 2 + +[SoftEther.NTamd64] +%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN24 + +[NeoAdapter.Install] +Characteristics = 0x1 +AddReg = Neo.Reg, NeoAdapter.Ndi +CopyFiles = Neo.CopyFiles.Sys +*IfType = 53 +*MediaType = 0 +*PhysicalMediaType = 0 + +[NeoAdapter.Install.Services] +AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% + +[NeoAdapter.Ndi] +HKR, , NetworkAddress, 0, %DefaultAddress% +HKR, Ndi, DeviceID, , "NeoAdapter_VPN24" +HKR, , DevLoader, , ndis +HKR, , DeviceVxDs, , Neo6_x64_VPN24.sys +HKR, NDIS, LogDriverName, , "Neo_VPN24" +HKR, NDIS, MajorNdisVersion, 1, 5 +HKR, NDIS, MinorNdisVersion, 1, 0 +HKR, Ndi\Interfaces, DefUpper, , "ndis5" +HKR, Ndi\Interfaces, UpperRange, , "ndis5" +HKR, Ndi\Interfaces, LowerRange, , "ethernet" +HKR, Ndi\Interfaces, DefLower, , "ethernet" +HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" +HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% +HKR, Ndi\Params\NetworkAddress, type, 0, "edit" +HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" +HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" +HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% +HKR, Ndi\Params\NetworkAddress, optional, 0, "0" +HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% +HKR, Ndi\Params\MaxSpeed, type, 0, "int" +HKR, Ndi\Params\MaxSpeed, default, 0, "100" +HKR, Ndi\Params\MaxSpeed, min, 0, "0" +HKR, Ndi\Params\MaxSpeed, max, 0, "2000" +HKR, Ndi\Params\MaxSpeed, step, 0, "1" +HKR, Ndi\Params\MaxSpeed, Base, 0, "10" +HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% +HKR, Ndi\Params\KeepLink, type, 0, "enum" +HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% +HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% +HKR, Ndi\Params\KeepLink, default, 0, "0" + + +[Neo.Service] +DisplayName = %Neo.Service.DispName% +Description = %Neo.Service.Desc% +ServiceType = 1 +StartType = 3 +ErrorControl = 1 +ServiceBinary = %12%\Neo6_x64_VPN24.sys +LoadOrderGroup = NDIS + +[Neo.Reg] +HKR, Ndi, Service, 0, Neo.Service.Name +HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" +HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" + +[Neo.EventLog] +HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo6_x64_VPN24.sys" +HKR, , TypesSupported, 0x00010001, 7 + +[Strings] +CompanyName = "SoftEther Corporation" +DiskDescription = "VPN Client Device Driver Install Disk" +Neo.Service.Name = "Neo_VPN24" +Neo.Service.DispName = "VPN Client Device Driver - VPN24" +Neo.Service.Desc = "VPN Client Adapter - VPN24" +NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN24" +Neo.EventLog.Name = "Neo" +NetworkAddress = "MAC Address" +DefaultAddress = "000001000001" +MaxSpeed = "Indicate Speed (Mbps)" +KeepLink = "Keep Link" +On = "On" +Off = "Off" + + +; Auto Generated 20180205_163623.024 + diff --git a/src/bin/hamcore/DriverPackages/Neo6_Win10/x64/Neo6_x64_VPN25.inf b/src/bin/hamcore/DriverPackages/Neo6_Win10/x64/Neo6_x64_VPN25.inf index 3d6dbb5c..f76ed738 100644 --- a/src/bin/hamcore/DriverPackages/Neo6_Win10/x64/Neo6_x64_VPN25.inf +++ b/src/bin/hamcore/DriverPackages/Neo6_Win10/x64/Neo6_x64_VPN25.inf @@ -1,114 +1,114 @@ -; VPN Client Device Driver for Windows 2000 and Greater -; -; Copyright (c) SoftEther Corporation. All Rights Reserved. -; http://www.softether.co.jp/ -; -; BUILD 9658 - -[Version] -Signature = "$Windows NT$" -Class = Net -ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} -Provider = %CompanyName% -DriverVer = 02/04/2018, 4.25.0.9658 -CatalogFile.NT = Neo6_x64_VPN25.cat - -[Manufacturer] -%CompanyName% = SoftEther, NTamd64 - -[SourceDisksNames] -1=%DiskDescription%, "", , - -[SourceDisksFiles] -Neo6_x64_VPN25.sys = 1 - -[DestinationDirs] -DefaultDestDir = 12 -Neo.CopyFiles.Sys = 12 - -[Neo.CopyFiles.Sys] -Neo6_x64_VPN25.sys, , , 2 - -[SoftEther.NTamd64] -%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN25 - -[NeoAdapter.Install] -Characteristics = 0x1 -AddReg = Neo.Reg, NeoAdapter.Ndi -CopyFiles = Neo.CopyFiles.Sys -*IfType = 53 -*MediaType = 0 -*PhysicalMediaType = 0 - -[NeoAdapter.Install.Services] -AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% - -[NeoAdapter.Ndi] -HKR, , NetworkAddress, 0, %DefaultAddress% -HKR, Ndi, DeviceID, , "NeoAdapter_VPN25" -HKR, , DevLoader, , ndis -HKR, , DeviceVxDs, , Neo6_x64_VPN25.sys -HKR, NDIS, LogDriverName, , "Neo_VPN25" -HKR, NDIS, MajorNdisVersion, 1, 5 -HKR, NDIS, MinorNdisVersion, 1, 0 -HKR, Ndi\Interfaces, DefUpper, , "ndis5" -HKR, Ndi\Interfaces, UpperRange, , "ndis5" -HKR, Ndi\Interfaces, LowerRange, , "ethernet" -HKR, Ndi\Interfaces, DefLower, , "ethernet" -HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" -HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% -HKR, Ndi\Params\NetworkAddress, type, 0, "edit" -HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" -HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" -HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% -HKR, Ndi\Params\NetworkAddress, optional, 0, "0" -HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% -HKR, Ndi\Params\MaxSpeed, type, 0, "int" -HKR, Ndi\Params\MaxSpeed, default, 0, "100" -HKR, Ndi\Params\MaxSpeed, min, 0, "0" -HKR, Ndi\Params\MaxSpeed, max, 0, "2000" -HKR, Ndi\Params\MaxSpeed, step, 0, "1" -HKR, Ndi\Params\MaxSpeed, Base, 0, "10" -HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% -HKR, Ndi\Params\KeepLink, type, 0, "enum" -HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% -HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% -HKR, Ndi\Params\KeepLink, default, 0, "0" - - -[Neo.Service] -DisplayName = %Neo.Service.DispName% -Description = %Neo.Service.Desc% -ServiceType = 1 -StartType = 3 -ErrorControl = 1 -ServiceBinary = %12%\Neo6_x64_VPN25.sys -LoadOrderGroup = NDIS - -[Neo.Reg] -HKR, Ndi, Service, 0, Neo.Service.Name -HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" -HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" - -[Neo.EventLog] -HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo6_x64_VPN25.sys" -HKR, , TypesSupported, 0x00010001, 7 - -[Strings] -CompanyName = "SoftEther Corporation" -DiskDescription = "VPN Client Device Driver Install Disk" -Neo.Service.Name = "Neo_VPN25" -Neo.Service.DispName = "VPN Client Device Driver - VPN25" -Neo.Service.Desc = "VPN Client Adapter - VPN25" -NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN25" -Neo.EventLog.Name = "Neo" -NetworkAddress = "MAC Address" -DefaultAddress = "000001000001" -MaxSpeed = "Indicate Speed (Mbps)" -KeepLink = "Keep Link" -On = "On" -Off = "Off" - - -; Auto Generated 20180205_163623.094 - +; VPN Client Device Driver for Windows 2000 and Greater +; +; Copyright (c) SoftEther Corporation. All Rights Reserved. +; http://www.softether.co.jp/ +; +; BUILD 9658 + +[Version] +Signature = "$Windows NT$" +Class = Net +ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} +Provider = %CompanyName% +DriverVer = 02/04/2018, 4.25.0.9658 +CatalogFile.NT = Neo6_x64_VPN25.cat + +[Manufacturer] +%CompanyName% = SoftEther, NTamd64 + +[SourceDisksNames] +1=%DiskDescription%, "", , + +[SourceDisksFiles] +Neo6_x64_VPN25.sys = 1 + +[DestinationDirs] +DefaultDestDir = 12 +Neo.CopyFiles.Sys = 12 + +[Neo.CopyFiles.Sys] +Neo6_x64_VPN25.sys, , , 2 + +[SoftEther.NTamd64] +%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN25 + +[NeoAdapter.Install] +Characteristics = 0x1 +AddReg = Neo.Reg, NeoAdapter.Ndi +CopyFiles = Neo.CopyFiles.Sys +*IfType = 53 +*MediaType = 0 +*PhysicalMediaType = 0 + +[NeoAdapter.Install.Services] +AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% + +[NeoAdapter.Ndi] +HKR, , NetworkAddress, 0, %DefaultAddress% +HKR, Ndi, DeviceID, , "NeoAdapter_VPN25" +HKR, , DevLoader, , ndis +HKR, , DeviceVxDs, , Neo6_x64_VPN25.sys +HKR, NDIS, LogDriverName, , "Neo_VPN25" +HKR, NDIS, MajorNdisVersion, 1, 5 +HKR, NDIS, MinorNdisVersion, 1, 0 +HKR, Ndi\Interfaces, DefUpper, , "ndis5" +HKR, Ndi\Interfaces, UpperRange, , "ndis5" +HKR, Ndi\Interfaces, LowerRange, , "ethernet" +HKR, Ndi\Interfaces, DefLower, , "ethernet" +HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" +HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% +HKR, Ndi\Params\NetworkAddress, type, 0, "edit" +HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" +HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" +HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% +HKR, Ndi\Params\NetworkAddress, optional, 0, "0" +HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% +HKR, Ndi\Params\MaxSpeed, type, 0, "int" +HKR, Ndi\Params\MaxSpeed, default, 0, "100" +HKR, Ndi\Params\MaxSpeed, min, 0, "0" +HKR, Ndi\Params\MaxSpeed, max, 0, "2000" +HKR, Ndi\Params\MaxSpeed, step, 0, "1" +HKR, Ndi\Params\MaxSpeed, Base, 0, "10" +HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% +HKR, Ndi\Params\KeepLink, type, 0, "enum" +HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% +HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% +HKR, Ndi\Params\KeepLink, default, 0, "0" + + +[Neo.Service] +DisplayName = %Neo.Service.DispName% +Description = %Neo.Service.Desc% +ServiceType = 1 +StartType = 3 +ErrorControl = 1 +ServiceBinary = %12%\Neo6_x64_VPN25.sys +LoadOrderGroup = NDIS + +[Neo.Reg] +HKR, Ndi, Service, 0, Neo.Service.Name +HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" +HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" + +[Neo.EventLog] +HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo6_x64_VPN25.sys" +HKR, , TypesSupported, 0x00010001, 7 + +[Strings] +CompanyName = "SoftEther Corporation" +DiskDescription = "VPN Client Device Driver Install Disk" +Neo.Service.Name = "Neo_VPN25" +Neo.Service.DispName = "VPN Client Device Driver - VPN25" +Neo.Service.Desc = "VPN Client Adapter - VPN25" +NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN25" +Neo.EventLog.Name = "Neo" +NetworkAddress = "MAC Address" +DefaultAddress = "000001000001" +MaxSpeed = "Indicate Speed (Mbps)" +KeepLink = "Keep Link" +On = "On" +Off = "Off" + + +; Auto Generated 20180205_163623.094 + diff --git a/src/bin/hamcore/DriverPackages/Neo6_Win10/x64/Neo6_x64_VPN26.inf b/src/bin/hamcore/DriverPackages/Neo6_Win10/x64/Neo6_x64_VPN26.inf index 86f6b661..8db58dc3 100644 --- a/src/bin/hamcore/DriverPackages/Neo6_Win10/x64/Neo6_x64_VPN26.inf +++ b/src/bin/hamcore/DriverPackages/Neo6_Win10/x64/Neo6_x64_VPN26.inf @@ -1,114 +1,114 @@ -; VPN Client Device Driver for Windows 2000 and Greater -; -; Copyright (c) SoftEther Corporation. All Rights Reserved. -; http://www.softether.co.jp/ -; -; BUILD 9658 - -[Version] -Signature = "$Windows NT$" -Class = Net -ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} -Provider = %CompanyName% -DriverVer = 02/04/2018, 4.25.0.9658 -CatalogFile.NT = Neo6_x64_VPN26.cat - -[Manufacturer] -%CompanyName% = SoftEther, NTamd64 - -[SourceDisksNames] -1=%DiskDescription%, "", , - -[SourceDisksFiles] -Neo6_x64_VPN26.sys = 1 - -[DestinationDirs] -DefaultDestDir = 12 -Neo.CopyFiles.Sys = 12 - -[Neo.CopyFiles.Sys] -Neo6_x64_VPN26.sys, , , 2 - -[SoftEther.NTamd64] -%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN26 - -[NeoAdapter.Install] -Characteristics = 0x1 -AddReg = Neo.Reg, NeoAdapter.Ndi -CopyFiles = Neo.CopyFiles.Sys -*IfType = 53 -*MediaType = 0 -*PhysicalMediaType = 0 - -[NeoAdapter.Install.Services] -AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% - -[NeoAdapter.Ndi] -HKR, , NetworkAddress, 0, %DefaultAddress% -HKR, Ndi, DeviceID, , "NeoAdapter_VPN26" -HKR, , DevLoader, , ndis -HKR, , DeviceVxDs, , Neo6_x64_VPN26.sys -HKR, NDIS, LogDriverName, , "Neo_VPN26" -HKR, NDIS, MajorNdisVersion, 1, 5 -HKR, NDIS, MinorNdisVersion, 1, 0 -HKR, Ndi\Interfaces, DefUpper, , "ndis5" -HKR, Ndi\Interfaces, UpperRange, , "ndis5" -HKR, Ndi\Interfaces, LowerRange, , "ethernet" -HKR, Ndi\Interfaces, DefLower, , "ethernet" -HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" -HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% -HKR, Ndi\Params\NetworkAddress, type, 0, "edit" -HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" -HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" -HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% -HKR, Ndi\Params\NetworkAddress, optional, 0, "0" -HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% -HKR, Ndi\Params\MaxSpeed, type, 0, "int" -HKR, Ndi\Params\MaxSpeed, default, 0, "100" -HKR, Ndi\Params\MaxSpeed, min, 0, "0" -HKR, Ndi\Params\MaxSpeed, max, 0, "2000" -HKR, Ndi\Params\MaxSpeed, step, 0, "1" -HKR, Ndi\Params\MaxSpeed, Base, 0, "10" -HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% -HKR, Ndi\Params\KeepLink, type, 0, "enum" -HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% -HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% -HKR, Ndi\Params\KeepLink, default, 0, "0" - - -[Neo.Service] -DisplayName = %Neo.Service.DispName% -Description = %Neo.Service.Desc% -ServiceType = 1 -StartType = 3 -ErrorControl = 1 -ServiceBinary = %12%\Neo6_x64_VPN26.sys -LoadOrderGroup = NDIS - -[Neo.Reg] -HKR, Ndi, Service, 0, Neo.Service.Name -HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" -HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" - -[Neo.EventLog] -HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo6_x64_VPN26.sys" -HKR, , TypesSupported, 0x00010001, 7 - -[Strings] -CompanyName = "SoftEther Corporation" -DiskDescription = "VPN Client Device Driver Install Disk" -Neo.Service.Name = "Neo_VPN26" -Neo.Service.DispName = "VPN Client Device Driver - VPN26" -Neo.Service.Desc = "VPN Client Adapter - VPN26" -NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN26" -Neo.EventLog.Name = "Neo" -NetworkAddress = "MAC Address" -DefaultAddress = "000001000001" -MaxSpeed = "Indicate Speed (Mbps)" -KeepLink = "Keep Link" -On = "On" -Off = "Off" - - -; Auto Generated 20180205_163623.164 - +; VPN Client Device Driver for Windows 2000 and Greater +; +; Copyright (c) SoftEther Corporation. All Rights Reserved. +; http://www.softether.co.jp/ +; +; BUILD 9658 + +[Version] +Signature = "$Windows NT$" +Class = Net +ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} +Provider = %CompanyName% +DriverVer = 02/04/2018, 4.25.0.9658 +CatalogFile.NT = Neo6_x64_VPN26.cat + +[Manufacturer] +%CompanyName% = SoftEther, NTamd64 + +[SourceDisksNames] +1=%DiskDescription%, "", , + +[SourceDisksFiles] +Neo6_x64_VPN26.sys = 1 + +[DestinationDirs] +DefaultDestDir = 12 +Neo.CopyFiles.Sys = 12 + +[Neo.CopyFiles.Sys] +Neo6_x64_VPN26.sys, , , 2 + +[SoftEther.NTamd64] +%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN26 + +[NeoAdapter.Install] +Characteristics = 0x1 +AddReg = Neo.Reg, NeoAdapter.Ndi +CopyFiles = Neo.CopyFiles.Sys +*IfType = 53 +*MediaType = 0 +*PhysicalMediaType = 0 + +[NeoAdapter.Install.Services] +AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% + +[NeoAdapter.Ndi] +HKR, , NetworkAddress, 0, %DefaultAddress% +HKR, Ndi, DeviceID, , "NeoAdapter_VPN26" +HKR, , DevLoader, , ndis +HKR, , DeviceVxDs, , Neo6_x64_VPN26.sys +HKR, NDIS, LogDriverName, , "Neo_VPN26" +HKR, NDIS, MajorNdisVersion, 1, 5 +HKR, NDIS, MinorNdisVersion, 1, 0 +HKR, Ndi\Interfaces, DefUpper, , "ndis5" +HKR, Ndi\Interfaces, UpperRange, , "ndis5" +HKR, Ndi\Interfaces, LowerRange, , "ethernet" +HKR, Ndi\Interfaces, DefLower, , "ethernet" +HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" +HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% +HKR, Ndi\Params\NetworkAddress, type, 0, "edit" +HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" +HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" +HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% +HKR, Ndi\Params\NetworkAddress, optional, 0, "0" +HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% +HKR, Ndi\Params\MaxSpeed, type, 0, "int" +HKR, Ndi\Params\MaxSpeed, default, 0, "100" +HKR, Ndi\Params\MaxSpeed, min, 0, "0" +HKR, Ndi\Params\MaxSpeed, max, 0, "2000" +HKR, Ndi\Params\MaxSpeed, step, 0, "1" +HKR, Ndi\Params\MaxSpeed, Base, 0, "10" +HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% +HKR, Ndi\Params\KeepLink, type, 0, "enum" +HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% +HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% +HKR, Ndi\Params\KeepLink, default, 0, "0" + + +[Neo.Service] +DisplayName = %Neo.Service.DispName% +Description = %Neo.Service.Desc% +ServiceType = 1 +StartType = 3 +ErrorControl = 1 +ServiceBinary = %12%\Neo6_x64_VPN26.sys +LoadOrderGroup = NDIS + +[Neo.Reg] +HKR, Ndi, Service, 0, Neo.Service.Name +HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" +HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" + +[Neo.EventLog] +HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo6_x64_VPN26.sys" +HKR, , TypesSupported, 0x00010001, 7 + +[Strings] +CompanyName = "SoftEther Corporation" +DiskDescription = "VPN Client Device Driver Install Disk" +Neo.Service.Name = "Neo_VPN26" +Neo.Service.DispName = "VPN Client Device Driver - VPN26" +Neo.Service.Desc = "VPN Client Adapter - VPN26" +NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN26" +Neo.EventLog.Name = "Neo" +NetworkAddress = "MAC Address" +DefaultAddress = "000001000001" +MaxSpeed = "Indicate Speed (Mbps)" +KeepLink = "Keep Link" +On = "On" +Off = "Off" + + +; Auto Generated 20180205_163623.164 + diff --git a/src/bin/hamcore/DriverPackages/Neo6_Win10/x64/Neo6_x64_VPN27.inf b/src/bin/hamcore/DriverPackages/Neo6_Win10/x64/Neo6_x64_VPN27.inf index 4ecd69a1..3272cfeb 100644 --- a/src/bin/hamcore/DriverPackages/Neo6_Win10/x64/Neo6_x64_VPN27.inf +++ b/src/bin/hamcore/DriverPackages/Neo6_Win10/x64/Neo6_x64_VPN27.inf @@ -1,114 +1,114 @@ -; VPN Client Device Driver for Windows 2000 and Greater -; -; Copyright (c) SoftEther Corporation. All Rights Reserved. -; http://www.softether.co.jp/ -; -; BUILD 9658 - -[Version] -Signature = "$Windows NT$" -Class = Net -ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} -Provider = %CompanyName% -DriverVer = 02/04/2018, 4.25.0.9658 -CatalogFile.NT = Neo6_x64_VPN27.cat - -[Manufacturer] -%CompanyName% = SoftEther, NTamd64 - -[SourceDisksNames] -1=%DiskDescription%, "", , - -[SourceDisksFiles] -Neo6_x64_VPN27.sys = 1 - -[DestinationDirs] -DefaultDestDir = 12 -Neo.CopyFiles.Sys = 12 - -[Neo.CopyFiles.Sys] -Neo6_x64_VPN27.sys, , , 2 - -[SoftEther.NTamd64] -%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN27 - -[NeoAdapter.Install] -Characteristics = 0x1 -AddReg = Neo.Reg, NeoAdapter.Ndi -CopyFiles = Neo.CopyFiles.Sys -*IfType = 53 -*MediaType = 0 -*PhysicalMediaType = 0 - -[NeoAdapter.Install.Services] -AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% - -[NeoAdapter.Ndi] -HKR, , NetworkAddress, 0, %DefaultAddress% -HKR, Ndi, DeviceID, , "NeoAdapter_VPN27" -HKR, , DevLoader, , ndis -HKR, , DeviceVxDs, , Neo6_x64_VPN27.sys -HKR, NDIS, LogDriverName, , "Neo_VPN27" -HKR, NDIS, MajorNdisVersion, 1, 5 -HKR, NDIS, MinorNdisVersion, 1, 0 -HKR, Ndi\Interfaces, DefUpper, , "ndis5" -HKR, Ndi\Interfaces, UpperRange, , "ndis5" -HKR, Ndi\Interfaces, LowerRange, , "ethernet" -HKR, Ndi\Interfaces, DefLower, , "ethernet" -HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" -HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% -HKR, Ndi\Params\NetworkAddress, type, 0, "edit" -HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" -HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" -HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% -HKR, Ndi\Params\NetworkAddress, optional, 0, "0" -HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% -HKR, Ndi\Params\MaxSpeed, type, 0, "int" -HKR, Ndi\Params\MaxSpeed, default, 0, "100" -HKR, Ndi\Params\MaxSpeed, min, 0, "0" -HKR, Ndi\Params\MaxSpeed, max, 0, "2000" -HKR, Ndi\Params\MaxSpeed, step, 0, "1" -HKR, Ndi\Params\MaxSpeed, Base, 0, "10" -HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% -HKR, Ndi\Params\KeepLink, type, 0, "enum" -HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% -HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% -HKR, Ndi\Params\KeepLink, default, 0, "0" - - -[Neo.Service] -DisplayName = %Neo.Service.DispName% -Description = %Neo.Service.Desc% -ServiceType = 1 -StartType = 3 -ErrorControl = 1 -ServiceBinary = %12%\Neo6_x64_VPN27.sys -LoadOrderGroup = NDIS - -[Neo.Reg] -HKR, Ndi, Service, 0, Neo.Service.Name -HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" -HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" - -[Neo.EventLog] -HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo6_x64_VPN27.sys" -HKR, , TypesSupported, 0x00010001, 7 - -[Strings] -CompanyName = "SoftEther Corporation" -DiskDescription = "VPN Client Device Driver Install Disk" -Neo.Service.Name = "Neo_VPN27" -Neo.Service.DispName = "VPN Client Device Driver - VPN27" -Neo.Service.Desc = "VPN Client Adapter - VPN27" -NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN27" -Neo.EventLog.Name = "Neo" -NetworkAddress = "MAC Address" -DefaultAddress = "000001000001" -MaxSpeed = "Indicate Speed (Mbps)" -KeepLink = "Keep Link" -On = "On" -Off = "Off" - - -; Auto Generated 20180205_163623.235 - +; VPN Client Device Driver for Windows 2000 and Greater +; +; Copyright (c) SoftEther Corporation. All Rights Reserved. +; http://www.softether.co.jp/ +; +; BUILD 9658 + +[Version] +Signature = "$Windows NT$" +Class = Net +ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} +Provider = %CompanyName% +DriverVer = 02/04/2018, 4.25.0.9658 +CatalogFile.NT = Neo6_x64_VPN27.cat + +[Manufacturer] +%CompanyName% = SoftEther, NTamd64 + +[SourceDisksNames] +1=%DiskDescription%, "", , + +[SourceDisksFiles] +Neo6_x64_VPN27.sys = 1 + +[DestinationDirs] +DefaultDestDir = 12 +Neo.CopyFiles.Sys = 12 + +[Neo.CopyFiles.Sys] +Neo6_x64_VPN27.sys, , , 2 + +[SoftEther.NTamd64] +%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN27 + +[NeoAdapter.Install] +Characteristics = 0x1 +AddReg = Neo.Reg, NeoAdapter.Ndi +CopyFiles = Neo.CopyFiles.Sys +*IfType = 53 +*MediaType = 0 +*PhysicalMediaType = 0 + +[NeoAdapter.Install.Services] +AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% + +[NeoAdapter.Ndi] +HKR, , NetworkAddress, 0, %DefaultAddress% +HKR, Ndi, DeviceID, , "NeoAdapter_VPN27" +HKR, , DevLoader, , ndis +HKR, , DeviceVxDs, , Neo6_x64_VPN27.sys +HKR, NDIS, LogDriverName, , "Neo_VPN27" +HKR, NDIS, MajorNdisVersion, 1, 5 +HKR, NDIS, MinorNdisVersion, 1, 0 +HKR, Ndi\Interfaces, DefUpper, , "ndis5" +HKR, Ndi\Interfaces, UpperRange, , "ndis5" +HKR, Ndi\Interfaces, LowerRange, , "ethernet" +HKR, Ndi\Interfaces, DefLower, , "ethernet" +HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" +HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% +HKR, Ndi\Params\NetworkAddress, type, 0, "edit" +HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" +HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" +HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% +HKR, Ndi\Params\NetworkAddress, optional, 0, "0" +HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% +HKR, Ndi\Params\MaxSpeed, type, 0, "int" +HKR, Ndi\Params\MaxSpeed, default, 0, "100" +HKR, Ndi\Params\MaxSpeed, min, 0, "0" +HKR, Ndi\Params\MaxSpeed, max, 0, "2000" +HKR, Ndi\Params\MaxSpeed, step, 0, "1" +HKR, Ndi\Params\MaxSpeed, Base, 0, "10" +HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% +HKR, Ndi\Params\KeepLink, type, 0, "enum" +HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% +HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% +HKR, Ndi\Params\KeepLink, default, 0, "0" + + +[Neo.Service] +DisplayName = %Neo.Service.DispName% +Description = %Neo.Service.Desc% +ServiceType = 1 +StartType = 3 +ErrorControl = 1 +ServiceBinary = %12%\Neo6_x64_VPN27.sys +LoadOrderGroup = NDIS + +[Neo.Reg] +HKR, Ndi, Service, 0, Neo.Service.Name +HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" +HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" + +[Neo.EventLog] +HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo6_x64_VPN27.sys" +HKR, , TypesSupported, 0x00010001, 7 + +[Strings] +CompanyName = "SoftEther Corporation" +DiskDescription = "VPN Client Device Driver Install Disk" +Neo.Service.Name = "Neo_VPN27" +Neo.Service.DispName = "VPN Client Device Driver - VPN27" +Neo.Service.Desc = "VPN Client Adapter - VPN27" +NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN27" +Neo.EventLog.Name = "Neo" +NetworkAddress = "MAC Address" +DefaultAddress = "000001000001" +MaxSpeed = "Indicate Speed (Mbps)" +KeepLink = "Keep Link" +On = "On" +Off = "Off" + + +; Auto Generated 20180205_163623.235 + diff --git a/src/bin/hamcore/DriverPackages/Neo6_Win10/x64/Neo6_x64_VPN28.inf b/src/bin/hamcore/DriverPackages/Neo6_Win10/x64/Neo6_x64_VPN28.inf index 11bd0e1b..55d03a28 100644 --- a/src/bin/hamcore/DriverPackages/Neo6_Win10/x64/Neo6_x64_VPN28.inf +++ b/src/bin/hamcore/DriverPackages/Neo6_Win10/x64/Neo6_x64_VPN28.inf @@ -1,114 +1,114 @@ -; VPN Client Device Driver for Windows 2000 and Greater -; -; Copyright (c) SoftEther Corporation. All Rights Reserved. -; http://www.softether.co.jp/ -; -; BUILD 9658 - -[Version] -Signature = "$Windows NT$" -Class = Net -ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} -Provider = %CompanyName% -DriverVer = 02/04/2018, 4.25.0.9658 -CatalogFile.NT = Neo6_x64_VPN28.cat - -[Manufacturer] -%CompanyName% = SoftEther, NTamd64 - -[SourceDisksNames] -1=%DiskDescription%, "", , - -[SourceDisksFiles] -Neo6_x64_VPN28.sys = 1 - -[DestinationDirs] -DefaultDestDir = 12 -Neo.CopyFiles.Sys = 12 - -[Neo.CopyFiles.Sys] -Neo6_x64_VPN28.sys, , , 2 - -[SoftEther.NTamd64] -%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN28 - -[NeoAdapter.Install] -Characteristics = 0x1 -AddReg = Neo.Reg, NeoAdapter.Ndi -CopyFiles = Neo.CopyFiles.Sys -*IfType = 53 -*MediaType = 0 -*PhysicalMediaType = 0 - -[NeoAdapter.Install.Services] -AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% - -[NeoAdapter.Ndi] -HKR, , NetworkAddress, 0, %DefaultAddress% -HKR, Ndi, DeviceID, , "NeoAdapter_VPN28" -HKR, , DevLoader, , ndis -HKR, , DeviceVxDs, , Neo6_x64_VPN28.sys -HKR, NDIS, LogDriverName, , "Neo_VPN28" -HKR, NDIS, MajorNdisVersion, 1, 5 -HKR, NDIS, MinorNdisVersion, 1, 0 -HKR, Ndi\Interfaces, DefUpper, , "ndis5" -HKR, Ndi\Interfaces, UpperRange, , "ndis5" -HKR, Ndi\Interfaces, LowerRange, , "ethernet" -HKR, Ndi\Interfaces, DefLower, , "ethernet" -HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" -HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% -HKR, Ndi\Params\NetworkAddress, type, 0, "edit" -HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" -HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" -HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% -HKR, Ndi\Params\NetworkAddress, optional, 0, "0" -HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% -HKR, Ndi\Params\MaxSpeed, type, 0, "int" -HKR, Ndi\Params\MaxSpeed, default, 0, "100" -HKR, Ndi\Params\MaxSpeed, min, 0, "0" -HKR, Ndi\Params\MaxSpeed, max, 0, "2000" -HKR, Ndi\Params\MaxSpeed, step, 0, "1" -HKR, Ndi\Params\MaxSpeed, Base, 0, "10" -HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% -HKR, Ndi\Params\KeepLink, type, 0, "enum" -HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% -HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% -HKR, Ndi\Params\KeepLink, default, 0, "0" - - -[Neo.Service] -DisplayName = %Neo.Service.DispName% -Description = %Neo.Service.Desc% -ServiceType = 1 -StartType = 3 -ErrorControl = 1 -ServiceBinary = %12%\Neo6_x64_VPN28.sys -LoadOrderGroup = NDIS - -[Neo.Reg] -HKR, Ndi, Service, 0, Neo.Service.Name -HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" -HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" - -[Neo.EventLog] -HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo6_x64_VPN28.sys" -HKR, , TypesSupported, 0x00010001, 7 - -[Strings] -CompanyName = "SoftEther Corporation" -DiskDescription = "VPN Client Device Driver Install Disk" -Neo.Service.Name = "Neo_VPN28" -Neo.Service.DispName = "VPN Client Device Driver - VPN28" -Neo.Service.Desc = "VPN Client Adapter - VPN28" -NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN28" -Neo.EventLog.Name = "Neo" -NetworkAddress = "MAC Address" -DefaultAddress = "000001000001" -MaxSpeed = "Indicate Speed (Mbps)" -KeepLink = "Keep Link" -On = "On" -Off = "Off" - - -; Auto Generated 20180205_163623.306 - +; VPN Client Device Driver for Windows 2000 and Greater +; +; Copyright (c) SoftEther Corporation. All Rights Reserved. +; http://www.softether.co.jp/ +; +; BUILD 9658 + +[Version] +Signature = "$Windows NT$" +Class = Net +ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} +Provider = %CompanyName% +DriverVer = 02/04/2018, 4.25.0.9658 +CatalogFile.NT = Neo6_x64_VPN28.cat + +[Manufacturer] +%CompanyName% = SoftEther, NTamd64 + +[SourceDisksNames] +1=%DiskDescription%, "", , + +[SourceDisksFiles] +Neo6_x64_VPN28.sys = 1 + +[DestinationDirs] +DefaultDestDir = 12 +Neo.CopyFiles.Sys = 12 + +[Neo.CopyFiles.Sys] +Neo6_x64_VPN28.sys, , , 2 + +[SoftEther.NTamd64] +%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN28 + +[NeoAdapter.Install] +Characteristics = 0x1 +AddReg = Neo.Reg, NeoAdapter.Ndi +CopyFiles = Neo.CopyFiles.Sys +*IfType = 53 +*MediaType = 0 +*PhysicalMediaType = 0 + +[NeoAdapter.Install.Services] +AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% + +[NeoAdapter.Ndi] +HKR, , NetworkAddress, 0, %DefaultAddress% +HKR, Ndi, DeviceID, , "NeoAdapter_VPN28" +HKR, , DevLoader, , ndis +HKR, , DeviceVxDs, , Neo6_x64_VPN28.sys +HKR, NDIS, LogDriverName, , "Neo_VPN28" +HKR, NDIS, MajorNdisVersion, 1, 5 +HKR, NDIS, MinorNdisVersion, 1, 0 +HKR, Ndi\Interfaces, DefUpper, , "ndis5" +HKR, Ndi\Interfaces, UpperRange, , "ndis5" +HKR, Ndi\Interfaces, LowerRange, , "ethernet" +HKR, Ndi\Interfaces, DefLower, , "ethernet" +HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" +HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% +HKR, Ndi\Params\NetworkAddress, type, 0, "edit" +HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" +HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" +HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% +HKR, Ndi\Params\NetworkAddress, optional, 0, "0" +HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% +HKR, Ndi\Params\MaxSpeed, type, 0, "int" +HKR, Ndi\Params\MaxSpeed, default, 0, "100" +HKR, Ndi\Params\MaxSpeed, min, 0, "0" +HKR, Ndi\Params\MaxSpeed, max, 0, "2000" +HKR, Ndi\Params\MaxSpeed, step, 0, "1" +HKR, Ndi\Params\MaxSpeed, Base, 0, "10" +HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% +HKR, Ndi\Params\KeepLink, type, 0, "enum" +HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% +HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% +HKR, Ndi\Params\KeepLink, default, 0, "0" + + +[Neo.Service] +DisplayName = %Neo.Service.DispName% +Description = %Neo.Service.Desc% +ServiceType = 1 +StartType = 3 +ErrorControl = 1 +ServiceBinary = %12%\Neo6_x64_VPN28.sys +LoadOrderGroup = NDIS + +[Neo.Reg] +HKR, Ndi, Service, 0, Neo.Service.Name +HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" +HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" + +[Neo.EventLog] +HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo6_x64_VPN28.sys" +HKR, , TypesSupported, 0x00010001, 7 + +[Strings] +CompanyName = "SoftEther Corporation" +DiskDescription = "VPN Client Device Driver Install Disk" +Neo.Service.Name = "Neo_VPN28" +Neo.Service.DispName = "VPN Client Device Driver - VPN28" +Neo.Service.Desc = "VPN Client Adapter - VPN28" +NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN28" +Neo.EventLog.Name = "Neo" +NetworkAddress = "MAC Address" +DefaultAddress = "000001000001" +MaxSpeed = "Indicate Speed (Mbps)" +KeepLink = "Keep Link" +On = "On" +Off = "Off" + + +; Auto Generated 20180205_163623.306 + diff --git a/src/bin/hamcore/DriverPackages/Neo6_Win10/x64/Neo6_x64_VPN29.inf b/src/bin/hamcore/DriverPackages/Neo6_Win10/x64/Neo6_x64_VPN29.inf index 2b9269d2..dcdf1396 100644 --- a/src/bin/hamcore/DriverPackages/Neo6_Win10/x64/Neo6_x64_VPN29.inf +++ b/src/bin/hamcore/DriverPackages/Neo6_Win10/x64/Neo6_x64_VPN29.inf @@ -1,114 +1,114 @@ -; VPN Client Device Driver for Windows 2000 and Greater -; -; Copyright (c) SoftEther Corporation. All Rights Reserved. -; http://www.softether.co.jp/ -; -; BUILD 9658 - -[Version] -Signature = "$Windows NT$" -Class = Net -ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} -Provider = %CompanyName% -DriverVer = 02/04/2018, 4.25.0.9658 -CatalogFile.NT = Neo6_x64_VPN29.cat - -[Manufacturer] -%CompanyName% = SoftEther, NTamd64 - -[SourceDisksNames] -1=%DiskDescription%, "", , - -[SourceDisksFiles] -Neo6_x64_VPN29.sys = 1 - -[DestinationDirs] -DefaultDestDir = 12 -Neo.CopyFiles.Sys = 12 - -[Neo.CopyFiles.Sys] -Neo6_x64_VPN29.sys, , , 2 - -[SoftEther.NTamd64] -%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN29 - -[NeoAdapter.Install] -Characteristics = 0x1 -AddReg = Neo.Reg, NeoAdapter.Ndi -CopyFiles = Neo.CopyFiles.Sys -*IfType = 53 -*MediaType = 0 -*PhysicalMediaType = 0 - -[NeoAdapter.Install.Services] -AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% - -[NeoAdapter.Ndi] -HKR, , NetworkAddress, 0, %DefaultAddress% -HKR, Ndi, DeviceID, , "NeoAdapter_VPN29" -HKR, , DevLoader, , ndis -HKR, , DeviceVxDs, , Neo6_x64_VPN29.sys -HKR, NDIS, LogDriverName, , "Neo_VPN29" -HKR, NDIS, MajorNdisVersion, 1, 5 -HKR, NDIS, MinorNdisVersion, 1, 0 -HKR, Ndi\Interfaces, DefUpper, , "ndis5" -HKR, Ndi\Interfaces, UpperRange, , "ndis5" -HKR, Ndi\Interfaces, LowerRange, , "ethernet" -HKR, Ndi\Interfaces, DefLower, , "ethernet" -HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" -HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% -HKR, Ndi\Params\NetworkAddress, type, 0, "edit" -HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" -HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" -HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% -HKR, Ndi\Params\NetworkAddress, optional, 0, "0" -HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% -HKR, Ndi\Params\MaxSpeed, type, 0, "int" -HKR, Ndi\Params\MaxSpeed, default, 0, "100" -HKR, Ndi\Params\MaxSpeed, min, 0, "0" -HKR, Ndi\Params\MaxSpeed, max, 0, "2000" -HKR, Ndi\Params\MaxSpeed, step, 0, "1" -HKR, Ndi\Params\MaxSpeed, Base, 0, "10" -HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% -HKR, Ndi\Params\KeepLink, type, 0, "enum" -HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% -HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% -HKR, Ndi\Params\KeepLink, default, 0, "0" - - -[Neo.Service] -DisplayName = %Neo.Service.DispName% -Description = %Neo.Service.Desc% -ServiceType = 1 -StartType = 3 -ErrorControl = 1 -ServiceBinary = %12%\Neo6_x64_VPN29.sys -LoadOrderGroup = NDIS - -[Neo.Reg] -HKR, Ndi, Service, 0, Neo.Service.Name -HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" -HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" - -[Neo.EventLog] -HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo6_x64_VPN29.sys" -HKR, , TypesSupported, 0x00010001, 7 - -[Strings] -CompanyName = "SoftEther Corporation" -DiskDescription = "VPN Client Device Driver Install Disk" -Neo.Service.Name = "Neo_VPN29" -Neo.Service.DispName = "VPN Client Device Driver - VPN29" -Neo.Service.Desc = "VPN Client Adapter - VPN29" -NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN29" -Neo.EventLog.Name = "Neo" -NetworkAddress = "MAC Address" -DefaultAddress = "000001000001" -MaxSpeed = "Indicate Speed (Mbps)" -KeepLink = "Keep Link" -On = "On" -Off = "Off" - - -; Auto Generated 20180205_163623.377 - +; VPN Client Device Driver for Windows 2000 and Greater +; +; Copyright (c) SoftEther Corporation. All Rights Reserved. +; http://www.softether.co.jp/ +; +; BUILD 9658 + +[Version] +Signature = "$Windows NT$" +Class = Net +ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} +Provider = %CompanyName% +DriverVer = 02/04/2018, 4.25.0.9658 +CatalogFile.NT = Neo6_x64_VPN29.cat + +[Manufacturer] +%CompanyName% = SoftEther, NTamd64 + +[SourceDisksNames] +1=%DiskDescription%, "", , + +[SourceDisksFiles] +Neo6_x64_VPN29.sys = 1 + +[DestinationDirs] +DefaultDestDir = 12 +Neo.CopyFiles.Sys = 12 + +[Neo.CopyFiles.Sys] +Neo6_x64_VPN29.sys, , , 2 + +[SoftEther.NTamd64] +%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN29 + +[NeoAdapter.Install] +Characteristics = 0x1 +AddReg = Neo.Reg, NeoAdapter.Ndi +CopyFiles = Neo.CopyFiles.Sys +*IfType = 53 +*MediaType = 0 +*PhysicalMediaType = 0 + +[NeoAdapter.Install.Services] +AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% + +[NeoAdapter.Ndi] +HKR, , NetworkAddress, 0, %DefaultAddress% +HKR, Ndi, DeviceID, , "NeoAdapter_VPN29" +HKR, , DevLoader, , ndis +HKR, , DeviceVxDs, , Neo6_x64_VPN29.sys +HKR, NDIS, LogDriverName, , "Neo_VPN29" +HKR, NDIS, MajorNdisVersion, 1, 5 +HKR, NDIS, MinorNdisVersion, 1, 0 +HKR, Ndi\Interfaces, DefUpper, , "ndis5" +HKR, Ndi\Interfaces, UpperRange, , "ndis5" +HKR, Ndi\Interfaces, LowerRange, , "ethernet" +HKR, Ndi\Interfaces, DefLower, , "ethernet" +HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" +HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% +HKR, Ndi\Params\NetworkAddress, type, 0, "edit" +HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" +HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" +HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% +HKR, Ndi\Params\NetworkAddress, optional, 0, "0" +HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% +HKR, Ndi\Params\MaxSpeed, type, 0, "int" +HKR, Ndi\Params\MaxSpeed, default, 0, "100" +HKR, Ndi\Params\MaxSpeed, min, 0, "0" +HKR, Ndi\Params\MaxSpeed, max, 0, "2000" +HKR, Ndi\Params\MaxSpeed, step, 0, "1" +HKR, Ndi\Params\MaxSpeed, Base, 0, "10" +HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% +HKR, Ndi\Params\KeepLink, type, 0, "enum" +HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% +HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% +HKR, Ndi\Params\KeepLink, default, 0, "0" + + +[Neo.Service] +DisplayName = %Neo.Service.DispName% +Description = %Neo.Service.Desc% +ServiceType = 1 +StartType = 3 +ErrorControl = 1 +ServiceBinary = %12%\Neo6_x64_VPN29.sys +LoadOrderGroup = NDIS + +[Neo.Reg] +HKR, Ndi, Service, 0, Neo.Service.Name +HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" +HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" + +[Neo.EventLog] +HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo6_x64_VPN29.sys" +HKR, , TypesSupported, 0x00010001, 7 + +[Strings] +CompanyName = "SoftEther Corporation" +DiskDescription = "VPN Client Device Driver Install Disk" +Neo.Service.Name = "Neo_VPN29" +Neo.Service.DispName = "VPN Client Device Driver - VPN29" +Neo.Service.Desc = "VPN Client Adapter - VPN29" +NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN29" +Neo.EventLog.Name = "Neo" +NetworkAddress = "MAC Address" +DefaultAddress = "000001000001" +MaxSpeed = "Indicate Speed (Mbps)" +KeepLink = "Keep Link" +On = "On" +Off = "Off" + + +; Auto Generated 20180205_163623.377 + diff --git a/src/bin/hamcore/DriverPackages/Neo6_Win10/x64/Neo6_x64_VPN3.inf b/src/bin/hamcore/DriverPackages/Neo6_Win10/x64/Neo6_x64_VPN3.inf index 785c5852..f9bf271c 100644 --- a/src/bin/hamcore/DriverPackages/Neo6_Win10/x64/Neo6_x64_VPN3.inf +++ b/src/bin/hamcore/DriverPackages/Neo6_Win10/x64/Neo6_x64_VPN3.inf @@ -1,114 +1,114 @@ -; VPN Client Device Driver for Windows 2000 and Greater -; -; Copyright (c) SoftEther Corporation. All Rights Reserved. -; http://www.softether.co.jp/ -; -; BUILD 9658 - -[Version] -Signature = "$Windows NT$" -Class = Net -ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} -Provider = %CompanyName% -DriverVer = 02/04/2018, 4.25.0.9658 -CatalogFile.NT = Neo6_x64_VPN3.cat - -[Manufacturer] -%CompanyName% = SoftEther, NTamd64 - -[SourceDisksNames] -1=%DiskDescription%, "", , - -[SourceDisksFiles] -Neo6_x64_VPN3.sys = 1 - -[DestinationDirs] -DefaultDestDir = 12 -Neo.CopyFiles.Sys = 12 - -[Neo.CopyFiles.Sys] -Neo6_x64_VPN3.sys, , , 2 - -[SoftEther.NTamd64] -%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN3 - -[NeoAdapter.Install] -Characteristics = 0x1 -AddReg = Neo.Reg, NeoAdapter.Ndi -CopyFiles = Neo.CopyFiles.Sys -*IfType = 53 -*MediaType = 0 -*PhysicalMediaType = 0 - -[NeoAdapter.Install.Services] -AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% - -[NeoAdapter.Ndi] -HKR, , NetworkAddress, 0, %DefaultAddress% -HKR, Ndi, DeviceID, , "NeoAdapter_VPN3" -HKR, , DevLoader, , ndis -HKR, , DeviceVxDs, , Neo6_x64_VPN3.sys -HKR, NDIS, LogDriverName, , "Neo_VPN3" -HKR, NDIS, MajorNdisVersion, 1, 5 -HKR, NDIS, MinorNdisVersion, 1, 0 -HKR, Ndi\Interfaces, DefUpper, , "ndis5" -HKR, Ndi\Interfaces, UpperRange, , "ndis5" -HKR, Ndi\Interfaces, LowerRange, , "ethernet" -HKR, Ndi\Interfaces, DefLower, , "ethernet" -HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" -HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% -HKR, Ndi\Params\NetworkAddress, type, 0, "edit" -HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" -HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" -HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% -HKR, Ndi\Params\NetworkAddress, optional, 0, "0" -HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% -HKR, Ndi\Params\MaxSpeed, type, 0, "int" -HKR, Ndi\Params\MaxSpeed, default, 0, "100" -HKR, Ndi\Params\MaxSpeed, min, 0, "0" -HKR, Ndi\Params\MaxSpeed, max, 0, "2000" -HKR, Ndi\Params\MaxSpeed, step, 0, "1" -HKR, Ndi\Params\MaxSpeed, Base, 0, "10" -HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% -HKR, Ndi\Params\KeepLink, type, 0, "enum" -HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% -HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% -HKR, Ndi\Params\KeepLink, default, 0, "0" - - -[Neo.Service] -DisplayName = %Neo.Service.DispName% -Description = %Neo.Service.Desc% -ServiceType = 1 -StartType = 3 -ErrorControl = 1 -ServiceBinary = %12%\Neo6_x64_VPN3.sys -LoadOrderGroup = NDIS - -[Neo.Reg] -HKR, Ndi, Service, 0, Neo.Service.Name -HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" -HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" - -[Neo.EventLog] -HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo6_x64_VPN3.sys" -HKR, , TypesSupported, 0x00010001, 7 - -[Strings] -CompanyName = "SoftEther Corporation" -DiskDescription = "VPN Client Device Driver Install Disk" -Neo.Service.Name = "Neo_VPN3" -Neo.Service.DispName = "VPN Client Device Driver - VPN3" -Neo.Service.Desc = "VPN Client Adapter - VPN3" -NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN3" -Neo.EventLog.Name = "Neo" -NetworkAddress = "MAC Address" -DefaultAddress = "000001000001" -MaxSpeed = "Indicate Speed (Mbps)" -KeepLink = "Keep Link" -On = "On" -Off = "Off" - - -; Auto Generated 20180205_163621.525 - +; VPN Client Device Driver for Windows 2000 and Greater +; +; Copyright (c) SoftEther Corporation. All Rights Reserved. +; http://www.softether.co.jp/ +; +; BUILD 9658 + +[Version] +Signature = "$Windows NT$" +Class = Net +ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} +Provider = %CompanyName% +DriverVer = 02/04/2018, 4.25.0.9658 +CatalogFile.NT = Neo6_x64_VPN3.cat + +[Manufacturer] +%CompanyName% = SoftEther, NTamd64 + +[SourceDisksNames] +1=%DiskDescription%, "", , + +[SourceDisksFiles] +Neo6_x64_VPN3.sys = 1 + +[DestinationDirs] +DefaultDestDir = 12 +Neo.CopyFiles.Sys = 12 + +[Neo.CopyFiles.Sys] +Neo6_x64_VPN3.sys, , , 2 + +[SoftEther.NTamd64] +%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN3 + +[NeoAdapter.Install] +Characteristics = 0x1 +AddReg = Neo.Reg, NeoAdapter.Ndi +CopyFiles = Neo.CopyFiles.Sys +*IfType = 53 +*MediaType = 0 +*PhysicalMediaType = 0 + +[NeoAdapter.Install.Services] +AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% + +[NeoAdapter.Ndi] +HKR, , NetworkAddress, 0, %DefaultAddress% +HKR, Ndi, DeviceID, , "NeoAdapter_VPN3" +HKR, , DevLoader, , ndis +HKR, , DeviceVxDs, , Neo6_x64_VPN3.sys +HKR, NDIS, LogDriverName, , "Neo_VPN3" +HKR, NDIS, MajorNdisVersion, 1, 5 +HKR, NDIS, MinorNdisVersion, 1, 0 +HKR, Ndi\Interfaces, DefUpper, , "ndis5" +HKR, Ndi\Interfaces, UpperRange, , "ndis5" +HKR, Ndi\Interfaces, LowerRange, , "ethernet" +HKR, Ndi\Interfaces, DefLower, , "ethernet" +HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" +HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% +HKR, Ndi\Params\NetworkAddress, type, 0, "edit" +HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" +HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" +HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% +HKR, Ndi\Params\NetworkAddress, optional, 0, "0" +HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% +HKR, Ndi\Params\MaxSpeed, type, 0, "int" +HKR, Ndi\Params\MaxSpeed, default, 0, "100" +HKR, Ndi\Params\MaxSpeed, min, 0, "0" +HKR, Ndi\Params\MaxSpeed, max, 0, "2000" +HKR, Ndi\Params\MaxSpeed, step, 0, "1" +HKR, Ndi\Params\MaxSpeed, Base, 0, "10" +HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% +HKR, Ndi\Params\KeepLink, type, 0, "enum" +HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% +HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% +HKR, Ndi\Params\KeepLink, default, 0, "0" + + +[Neo.Service] +DisplayName = %Neo.Service.DispName% +Description = %Neo.Service.Desc% +ServiceType = 1 +StartType = 3 +ErrorControl = 1 +ServiceBinary = %12%\Neo6_x64_VPN3.sys +LoadOrderGroup = NDIS + +[Neo.Reg] +HKR, Ndi, Service, 0, Neo.Service.Name +HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" +HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" + +[Neo.EventLog] +HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo6_x64_VPN3.sys" +HKR, , TypesSupported, 0x00010001, 7 + +[Strings] +CompanyName = "SoftEther Corporation" +DiskDescription = "VPN Client Device Driver Install Disk" +Neo.Service.Name = "Neo_VPN3" +Neo.Service.DispName = "VPN Client Device Driver - VPN3" +Neo.Service.Desc = "VPN Client Adapter - VPN3" +NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN3" +Neo.EventLog.Name = "Neo" +NetworkAddress = "MAC Address" +DefaultAddress = "000001000001" +MaxSpeed = "Indicate Speed (Mbps)" +KeepLink = "Keep Link" +On = "On" +Off = "Off" + + +; Auto Generated 20180205_163621.525 + diff --git a/src/bin/hamcore/DriverPackages/Neo6_Win10/x64/Neo6_x64_VPN30.inf b/src/bin/hamcore/DriverPackages/Neo6_Win10/x64/Neo6_x64_VPN30.inf index 5c75533b..689d6ae2 100644 --- a/src/bin/hamcore/DriverPackages/Neo6_Win10/x64/Neo6_x64_VPN30.inf +++ b/src/bin/hamcore/DriverPackages/Neo6_Win10/x64/Neo6_x64_VPN30.inf @@ -1,114 +1,114 @@ -; VPN Client Device Driver for Windows 2000 and Greater -; -; Copyright (c) SoftEther Corporation. All Rights Reserved. -; http://www.softether.co.jp/ -; -; BUILD 9658 - -[Version] -Signature = "$Windows NT$" -Class = Net -ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} -Provider = %CompanyName% -DriverVer = 02/04/2018, 4.25.0.9658 -CatalogFile.NT = Neo6_x64_VPN30.cat - -[Manufacturer] -%CompanyName% = SoftEther, NTamd64 - -[SourceDisksNames] -1=%DiskDescription%, "", , - -[SourceDisksFiles] -Neo6_x64_VPN30.sys = 1 - -[DestinationDirs] -DefaultDestDir = 12 -Neo.CopyFiles.Sys = 12 - -[Neo.CopyFiles.Sys] -Neo6_x64_VPN30.sys, , , 2 - -[SoftEther.NTamd64] -%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN30 - -[NeoAdapter.Install] -Characteristics = 0x1 -AddReg = Neo.Reg, NeoAdapter.Ndi -CopyFiles = Neo.CopyFiles.Sys -*IfType = 53 -*MediaType = 0 -*PhysicalMediaType = 0 - -[NeoAdapter.Install.Services] -AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% - -[NeoAdapter.Ndi] -HKR, , NetworkAddress, 0, %DefaultAddress% -HKR, Ndi, DeviceID, , "NeoAdapter_VPN30" -HKR, , DevLoader, , ndis -HKR, , DeviceVxDs, , Neo6_x64_VPN30.sys -HKR, NDIS, LogDriverName, , "Neo_VPN30" -HKR, NDIS, MajorNdisVersion, 1, 5 -HKR, NDIS, MinorNdisVersion, 1, 0 -HKR, Ndi\Interfaces, DefUpper, , "ndis5" -HKR, Ndi\Interfaces, UpperRange, , "ndis5" -HKR, Ndi\Interfaces, LowerRange, , "ethernet" -HKR, Ndi\Interfaces, DefLower, , "ethernet" -HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" -HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% -HKR, Ndi\Params\NetworkAddress, type, 0, "edit" -HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" -HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" -HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% -HKR, Ndi\Params\NetworkAddress, optional, 0, "0" -HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% -HKR, Ndi\Params\MaxSpeed, type, 0, "int" -HKR, Ndi\Params\MaxSpeed, default, 0, "100" -HKR, Ndi\Params\MaxSpeed, min, 0, "0" -HKR, Ndi\Params\MaxSpeed, max, 0, "2000" -HKR, Ndi\Params\MaxSpeed, step, 0, "1" -HKR, Ndi\Params\MaxSpeed, Base, 0, "10" -HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% -HKR, Ndi\Params\KeepLink, type, 0, "enum" -HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% -HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% -HKR, Ndi\Params\KeepLink, default, 0, "0" - - -[Neo.Service] -DisplayName = %Neo.Service.DispName% -Description = %Neo.Service.Desc% -ServiceType = 1 -StartType = 3 -ErrorControl = 1 -ServiceBinary = %12%\Neo6_x64_VPN30.sys -LoadOrderGroup = NDIS - -[Neo.Reg] -HKR, Ndi, Service, 0, Neo.Service.Name -HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" -HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" - -[Neo.EventLog] -HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo6_x64_VPN30.sys" -HKR, , TypesSupported, 0x00010001, 7 - -[Strings] -CompanyName = "SoftEther Corporation" -DiskDescription = "VPN Client Device Driver Install Disk" -Neo.Service.Name = "Neo_VPN30" -Neo.Service.DispName = "VPN Client Device Driver - VPN30" -Neo.Service.Desc = "VPN Client Adapter - VPN30" -NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN30" -Neo.EventLog.Name = "Neo" -NetworkAddress = "MAC Address" -DefaultAddress = "000001000001" -MaxSpeed = "Indicate Speed (Mbps)" -KeepLink = "Keep Link" -On = "On" -Off = "Off" - - -; Auto Generated 20180205_163623.452 - +; VPN Client Device Driver for Windows 2000 and Greater +; +; Copyright (c) SoftEther Corporation. All Rights Reserved. +; http://www.softether.co.jp/ +; +; BUILD 9658 + +[Version] +Signature = "$Windows NT$" +Class = Net +ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} +Provider = %CompanyName% +DriverVer = 02/04/2018, 4.25.0.9658 +CatalogFile.NT = Neo6_x64_VPN30.cat + +[Manufacturer] +%CompanyName% = SoftEther, NTamd64 + +[SourceDisksNames] +1=%DiskDescription%, "", , + +[SourceDisksFiles] +Neo6_x64_VPN30.sys = 1 + +[DestinationDirs] +DefaultDestDir = 12 +Neo.CopyFiles.Sys = 12 + +[Neo.CopyFiles.Sys] +Neo6_x64_VPN30.sys, , , 2 + +[SoftEther.NTamd64] +%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN30 + +[NeoAdapter.Install] +Characteristics = 0x1 +AddReg = Neo.Reg, NeoAdapter.Ndi +CopyFiles = Neo.CopyFiles.Sys +*IfType = 53 +*MediaType = 0 +*PhysicalMediaType = 0 + +[NeoAdapter.Install.Services] +AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% + +[NeoAdapter.Ndi] +HKR, , NetworkAddress, 0, %DefaultAddress% +HKR, Ndi, DeviceID, , "NeoAdapter_VPN30" +HKR, , DevLoader, , ndis +HKR, , DeviceVxDs, , Neo6_x64_VPN30.sys +HKR, NDIS, LogDriverName, , "Neo_VPN30" +HKR, NDIS, MajorNdisVersion, 1, 5 +HKR, NDIS, MinorNdisVersion, 1, 0 +HKR, Ndi\Interfaces, DefUpper, , "ndis5" +HKR, Ndi\Interfaces, UpperRange, , "ndis5" +HKR, Ndi\Interfaces, LowerRange, , "ethernet" +HKR, Ndi\Interfaces, DefLower, , "ethernet" +HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" +HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% +HKR, Ndi\Params\NetworkAddress, type, 0, "edit" +HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" +HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" +HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% +HKR, Ndi\Params\NetworkAddress, optional, 0, "0" +HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% +HKR, Ndi\Params\MaxSpeed, type, 0, "int" +HKR, Ndi\Params\MaxSpeed, default, 0, "100" +HKR, Ndi\Params\MaxSpeed, min, 0, "0" +HKR, Ndi\Params\MaxSpeed, max, 0, "2000" +HKR, Ndi\Params\MaxSpeed, step, 0, "1" +HKR, Ndi\Params\MaxSpeed, Base, 0, "10" +HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% +HKR, Ndi\Params\KeepLink, type, 0, "enum" +HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% +HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% +HKR, Ndi\Params\KeepLink, default, 0, "0" + + +[Neo.Service] +DisplayName = %Neo.Service.DispName% +Description = %Neo.Service.Desc% +ServiceType = 1 +StartType = 3 +ErrorControl = 1 +ServiceBinary = %12%\Neo6_x64_VPN30.sys +LoadOrderGroup = NDIS + +[Neo.Reg] +HKR, Ndi, Service, 0, Neo.Service.Name +HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" +HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" + +[Neo.EventLog] +HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo6_x64_VPN30.sys" +HKR, , TypesSupported, 0x00010001, 7 + +[Strings] +CompanyName = "SoftEther Corporation" +DiskDescription = "VPN Client Device Driver Install Disk" +Neo.Service.Name = "Neo_VPN30" +Neo.Service.DispName = "VPN Client Device Driver - VPN30" +Neo.Service.Desc = "VPN Client Adapter - VPN30" +NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN30" +Neo.EventLog.Name = "Neo" +NetworkAddress = "MAC Address" +DefaultAddress = "000001000001" +MaxSpeed = "Indicate Speed (Mbps)" +KeepLink = "Keep Link" +On = "On" +Off = "Off" + + +; Auto Generated 20180205_163623.452 + diff --git a/src/bin/hamcore/DriverPackages/Neo6_Win10/x64/Neo6_x64_VPN31.inf b/src/bin/hamcore/DriverPackages/Neo6_Win10/x64/Neo6_x64_VPN31.inf index 7b8e0724..93bdc378 100644 --- a/src/bin/hamcore/DriverPackages/Neo6_Win10/x64/Neo6_x64_VPN31.inf +++ b/src/bin/hamcore/DriverPackages/Neo6_Win10/x64/Neo6_x64_VPN31.inf @@ -1,114 +1,114 @@ -; VPN Client Device Driver for Windows 2000 and Greater -; -; Copyright (c) SoftEther Corporation. All Rights Reserved. -; http://www.softether.co.jp/ -; -; BUILD 9658 - -[Version] -Signature = "$Windows NT$" -Class = Net -ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} -Provider = %CompanyName% -DriverVer = 02/04/2018, 4.25.0.9658 -CatalogFile.NT = Neo6_x64_VPN31.cat - -[Manufacturer] -%CompanyName% = SoftEther, NTamd64 - -[SourceDisksNames] -1=%DiskDescription%, "", , - -[SourceDisksFiles] -Neo6_x64_VPN31.sys = 1 - -[DestinationDirs] -DefaultDestDir = 12 -Neo.CopyFiles.Sys = 12 - -[Neo.CopyFiles.Sys] -Neo6_x64_VPN31.sys, , , 2 - -[SoftEther.NTamd64] -%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN31 - -[NeoAdapter.Install] -Characteristics = 0x1 -AddReg = Neo.Reg, NeoAdapter.Ndi -CopyFiles = Neo.CopyFiles.Sys -*IfType = 53 -*MediaType = 0 -*PhysicalMediaType = 0 - -[NeoAdapter.Install.Services] -AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% - -[NeoAdapter.Ndi] -HKR, , NetworkAddress, 0, %DefaultAddress% -HKR, Ndi, DeviceID, , "NeoAdapter_VPN31" -HKR, , DevLoader, , ndis -HKR, , DeviceVxDs, , Neo6_x64_VPN31.sys -HKR, NDIS, LogDriverName, , "Neo_VPN31" -HKR, NDIS, MajorNdisVersion, 1, 5 -HKR, NDIS, MinorNdisVersion, 1, 0 -HKR, Ndi\Interfaces, DefUpper, , "ndis5" -HKR, Ndi\Interfaces, UpperRange, , "ndis5" -HKR, Ndi\Interfaces, LowerRange, , "ethernet" -HKR, Ndi\Interfaces, DefLower, , "ethernet" -HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" -HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% -HKR, Ndi\Params\NetworkAddress, type, 0, "edit" -HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" -HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" -HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% -HKR, Ndi\Params\NetworkAddress, optional, 0, "0" -HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% -HKR, Ndi\Params\MaxSpeed, type, 0, "int" -HKR, Ndi\Params\MaxSpeed, default, 0, "100" -HKR, Ndi\Params\MaxSpeed, min, 0, "0" -HKR, Ndi\Params\MaxSpeed, max, 0, "2000" -HKR, Ndi\Params\MaxSpeed, step, 0, "1" -HKR, Ndi\Params\MaxSpeed, Base, 0, "10" -HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% -HKR, Ndi\Params\KeepLink, type, 0, "enum" -HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% -HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% -HKR, Ndi\Params\KeepLink, default, 0, "0" - - -[Neo.Service] -DisplayName = %Neo.Service.DispName% -Description = %Neo.Service.Desc% -ServiceType = 1 -StartType = 3 -ErrorControl = 1 -ServiceBinary = %12%\Neo6_x64_VPN31.sys -LoadOrderGroup = NDIS - -[Neo.Reg] -HKR, Ndi, Service, 0, Neo.Service.Name -HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" -HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" - -[Neo.EventLog] -HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo6_x64_VPN31.sys" -HKR, , TypesSupported, 0x00010001, 7 - -[Strings] -CompanyName = "SoftEther Corporation" -DiskDescription = "VPN Client Device Driver Install Disk" -Neo.Service.Name = "Neo_VPN31" -Neo.Service.DispName = "VPN Client Device Driver - VPN31" -Neo.Service.Desc = "VPN Client Adapter - VPN31" -NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN31" -Neo.EventLog.Name = "Neo" -NetworkAddress = "MAC Address" -DefaultAddress = "000001000001" -MaxSpeed = "Indicate Speed (Mbps)" -KeepLink = "Keep Link" -On = "On" -Off = "Off" - - -; Auto Generated 20180205_163623.522 - +; VPN Client Device Driver for Windows 2000 and Greater +; +; Copyright (c) SoftEther Corporation. All Rights Reserved. +; http://www.softether.co.jp/ +; +; BUILD 9658 + +[Version] +Signature = "$Windows NT$" +Class = Net +ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} +Provider = %CompanyName% +DriverVer = 02/04/2018, 4.25.0.9658 +CatalogFile.NT = Neo6_x64_VPN31.cat + +[Manufacturer] +%CompanyName% = SoftEther, NTamd64 + +[SourceDisksNames] +1=%DiskDescription%, "", , + +[SourceDisksFiles] +Neo6_x64_VPN31.sys = 1 + +[DestinationDirs] +DefaultDestDir = 12 +Neo.CopyFiles.Sys = 12 + +[Neo.CopyFiles.Sys] +Neo6_x64_VPN31.sys, , , 2 + +[SoftEther.NTamd64] +%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN31 + +[NeoAdapter.Install] +Characteristics = 0x1 +AddReg = Neo.Reg, NeoAdapter.Ndi +CopyFiles = Neo.CopyFiles.Sys +*IfType = 53 +*MediaType = 0 +*PhysicalMediaType = 0 + +[NeoAdapter.Install.Services] +AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% + +[NeoAdapter.Ndi] +HKR, , NetworkAddress, 0, %DefaultAddress% +HKR, Ndi, DeviceID, , "NeoAdapter_VPN31" +HKR, , DevLoader, , ndis +HKR, , DeviceVxDs, , Neo6_x64_VPN31.sys +HKR, NDIS, LogDriverName, , "Neo_VPN31" +HKR, NDIS, MajorNdisVersion, 1, 5 +HKR, NDIS, MinorNdisVersion, 1, 0 +HKR, Ndi\Interfaces, DefUpper, , "ndis5" +HKR, Ndi\Interfaces, UpperRange, , "ndis5" +HKR, Ndi\Interfaces, LowerRange, , "ethernet" +HKR, Ndi\Interfaces, DefLower, , "ethernet" +HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" +HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% +HKR, Ndi\Params\NetworkAddress, type, 0, "edit" +HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" +HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" +HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% +HKR, Ndi\Params\NetworkAddress, optional, 0, "0" +HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% +HKR, Ndi\Params\MaxSpeed, type, 0, "int" +HKR, Ndi\Params\MaxSpeed, default, 0, "100" +HKR, Ndi\Params\MaxSpeed, min, 0, "0" +HKR, Ndi\Params\MaxSpeed, max, 0, "2000" +HKR, Ndi\Params\MaxSpeed, step, 0, "1" +HKR, Ndi\Params\MaxSpeed, Base, 0, "10" +HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% +HKR, Ndi\Params\KeepLink, type, 0, "enum" +HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% +HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% +HKR, Ndi\Params\KeepLink, default, 0, "0" + + +[Neo.Service] +DisplayName = %Neo.Service.DispName% +Description = %Neo.Service.Desc% +ServiceType = 1 +StartType = 3 +ErrorControl = 1 +ServiceBinary = %12%\Neo6_x64_VPN31.sys +LoadOrderGroup = NDIS + +[Neo.Reg] +HKR, Ndi, Service, 0, Neo.Service.Name +HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" +HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" + +[Neo.EventLog] +HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo6_x64_VPN31.sys" +HKR, , TypesSupported, 0x00010001, 7 + +[Strings] +CompanyName = "SoftEther Corporation" +DiskDescription = "VPN Client Device Driver Install Disk" +Neo.Service.Name = "Neo_VPN31" +Neo.Service.DispName = "VPN Client Device Driver - VPN31" +Neo.Service.Desc = "VPN Client Adapter - VPN31" +NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN31" +Neo.EventLog.Name = "Neo" +NetworkAddress = "MAC Address" +DefaultAddress = "000001000001" +MaxSpeed = "Indicate Speed (Mbps)" +KeepLink = "Keep Link" +On = "On" +Off = "Off" + + +; Auto Generated 20180205_163623.522 + diff --git a/src/bin/hamcore/DriverPackages/Neo6_Win10/x64/Neo6_x64_VPN32.inf b/src/bin/hamcore/DriverPackages/Neo6_Win10/x64/Neo6_x64_VPN32.inf index b1af9a30..df2c334d 100644 --- a/src/bin/hamcore/DriverPackages/Neo6_Win10/x64/Neo6_x64_VPN32.inf +++ b/src/bin/hamcore/DriverPackages/Neo6_Win10/x64/Neo6_x64_VPN32.inf @@ -1,114 +1,114 @@ -; VPN Client Device Driver for Windows 2000 and Greater -; -; Copyright (c) SoftEther Corporation. All Rights Reserved. -; http://www.softether.co.jp/ -; -; BUILD 9658 - -[Version] -Signature = "$Windows NT$" -Class = Net -ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} -Provider = %CompanyName% -DriverVer = 02/04/2018, 4.25.0.9658 -CatalogFile.NT = Neo6_x64_VPN32.cat - -[Manufacturer] -%CompanyName% = SoftEther, NTamd64 - -[SourceDisksNames] -1=%DiskDescription%, "", , - -[SourceDisksFiles] -Neo6_x64_VPN32.sys = 1 - -[DestinationDirs] -DefaultDestDir = 12 -Neo.CopyFiles.Sys = 12 - -[Neo.CopyFiles.Sys] -Neo6_x64_VPN32.sys, , , 2 - -[SoftEther.NTamd64] -%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN32 - -[NeoAdapter.Install] -Characteristics = 0x1 -AddReg = Neo.Reg, NeoAdapter.Ndi -CopyFiles = Neo.CopyFiles.Sys -*IfType = 53 -*MediaType = 0 -*PhysicalMediaType = 0 - -[NeoAdapter.Install.Services] -AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% - -[NeoAdapter.Ndi] -HKR, , NetworkAddress, 0, %DefaultAddress% -HKR, Ndi, DeviceID, , "NeoAdapter_VPN32" -HKR, , DevLoader, , ndis -HKR, , DeviceVxDs, , Neo6_x64_VPN32.sys -HKR, NDIS, LogDriverName, , "Neo_VPN32" -HKR, NDIS, MajorNdisVersion, 1, 5 -HKR, NDIS, MinorNdisVersion, 1, 0 -HKR, Ndi\Interfaces, DefUpper, , "ndis5" -HKR, Ndi\Interfaces, UpperRange, , "ndis5" -HKR, Ndi\Interfaces, LowerRange, , "ethernet" -HKR, Ndi\Interfaces, DefLower, , "ethernet" -HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" -HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% -HKR, Ndi\Params\NetworkAddress, type, 0, "edit" -HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" -HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" -HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% -HKR, Ndi\Params\NetworkAddress, optional, 0, "0" -HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% -HKR, Ndi\Params\MaxSpeed, type, 0, "int" -HKR, Ndi\Params\MaxSpeed, default, 0, "100" -HKR, Ndi\Params\MaxSpeed, min, 0, "0" -HKR, Ndi\Params\MaxSpeed, max, 0, "2000" -HKR, Ndi\Params\MaxSpeed, step, 0, "1" -HKR, Ndi\Params\MaxSpeed, Base, 0, "10" -HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% -HKR, Ndi\Params\KeepLink, type, 0, "enum" -HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% -HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% -HKR, Ndi\Params\KeepLink, default, 0, "0" - - -[Neo.Service] -DisplayName = %Neo.Service.DispName% -Description = %Neo.Service.Desc% -ServiceType = 1 -StartType = 3 -ErrorControl = 1 -ServiceBinary = %12%\Neo6_x64_VPN32.sys -LoadOrderGroup = NDIS - -[Neo.Reg] -HKR, Ndi, Service, 0, Neo.Service.Name -HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" -HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" - -[Neo.EventLog] -HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo6_x64_VPN32.sys" -HKR, , TypesSupported, 0x00010001, 7 - -[Strings] -CompanyName = "SoftEther Corporation" -DiskDescription = "VPN Client Device Driver Install Disk" -Neo.Service.Name = "Neo_VPN32" -Neo.Service.DispName = "VPN Client Device Driver - VPN32" -Neo.Service.Desc = "VPN Client Adapter - VPN32" -NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN32" -Neo.EventLog.Name = "Neo" -NetworkAddress = "MAC Address" -DefaultAddress = "000001000001" -MaxSpeed = "Indicate Speed (Mbps)" -KeepLink = "Keep Link" -On = "On" -Off = "Off" - - -; Auto Generated 20180205_163623.593 - +; VPN Client Device Driver for Windows 2000 and Greater +; +; Copyright (c) SoftEther Corporation. All Rights Reserved. +; http://www.softether.co.jp/ +; +; BUILD 9658 + +[Version] +Signature = "$Windows NT$" +Class = Net +ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} +Provider = %CompanyName% +DriverVer = 02/04/2018, 4.25.0.9658 +CatalogFile.NT = Neo6_x64_VPN32.cat + +[Manufacturer] +%CompanyName% = SoftEther, NTamd64 + +[SourceDisksNames] +1=%DiskDescription%, "", , + +[SourceDisksFiles] +Neo6_x64_VPN32.sys = 1 + +[DestinationDirs] +DefaultDestDir = 12 +Neo.CopyFiles.Sys = 12 + +[Neo.CopyFiles.Sys] +Neo6_x64_VPN32.sys, , , 2 + +[SoftEther.NTamd64] +%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN32 + +[NeoAdapter.Install] +Characteristics = 0x1 +AddReg = Neo.Reg, NeoAdapter.Ndi +CopyFiles = Neo.CopyFiles.Sys +*IfType = 53 +*MediaType = 0 +*PhysicalMediaType = 0 + +[NeoAdapter.Install.Services] +AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% + +[NeoAdapter.Ndi] +HKR, , NetworkAddress, 0, %DefaultAddress% +HKR, Ndi, DeviceID, , "NeoAdapter_VPN32" +HKR, , DevLoader, , ndis +HKR, , DeviceVxDs, , Neo6_x64_VPN32.sys +HKR, NDIS, LogDriverName, , "Neo_VPN32" +HKR, NDIS, MajorNdisVersion, 1, 5 +HKR, NDIS, MinorNdisVersion, 1, 0 +HKR, Ndi\Interfaces, DefUpper, , "ndis5" +HKR, Ndi\Interfaces, UpperRange, , "ndis5" +HKR, Ndi\Interfaces, LowerRange, , "ethernet" +HKR, Ndi\Interfaces, DefLower, , "ethernet" +HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" +HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% +HKR, Ndi\Params\NetworkAddress, type, 0, "edit" +HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" +HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" +HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% +HKR, Ndi\Params\NetworkAddress, optional, 0, "0" +HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% +HKR, Ndi\Params\MaxSpeed, type, 0, "int" +HKR, Ndi\Params\MaxSpeed, default, 0, "100" +HKR, Ndi\Params\MaxSpeed, min, 0, "0" +HKR, Ndi\Params\MaxSpeed, max, 0, "2000" +HKR, Ndi\Params\MaxSpeed, step, 0, "1" +HKR, Ndi\Params\MaxSpeed, Base, 0, "10" +HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% +HKR, Ndi\Params\KeepLink, type, 0, "enum" +HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% +HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% +HKR, Ndi\Params\KeepLink, default, 0, "0" + + +[Neo.Service] +DisplayName = %Neo.Service.DispName% +Description = %Neo.Service.Desc% +ServiceType = 1 +StartType = 3 +ErrorControl = 1 +ServiceBinary = %12%\Neo6_x64_VPN32.sys +LoadOrderGroup = NDIS + +[Neo.Reg] +HKR, Ndi, Service, 0, Neo.Service.Name +HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" +HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" + +[Neo.EventLog] +HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo6_x64_VPN32.sys" +HKR, , TypesSupported, 0x00010001, 7 + +[Strings] +CompanyName = "SoftEther Corporation" +DiskDescription = "VPN Client Device Driver Install Disk" +Neo.Service.Name = "Neo_VPN32" +Neo.Service.DispName = "VPN Client Device Driver - VPN32" +Neo.Service.Desc = "VPN Client Adapter - VPN32" +NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN32" +Neo.EventLog.Name = "Neo" +NetworkAddress = "MAC Address" +DefaultAddress = "000001000001" +MaxSpeed = "Indicate Speed (Mbps)" +KeepLink = "Keep Link" +On = "On" +Off = "Off" + + +; Auto Generated 20180205_163623.593 + diff --git a/src/bin/hamcore/DriverPackages/Neo6_Win10/x64/Neo6_x64_VPN33.inf b/src/bin/hamcore/DriverPackages/Neo6_Win10/x64/Neo6_x64_VPN33.inf index 31c9b04d..b9e2f5f9 100644 --- a/src/bin/hamcore/DriverPackages/Neo6_Win10/x64/Neo6_x64_VPN33.inf +++ b/src/bin/hamcore/DriverPackages/Neo6_Win10/x64/Neo6_x64_VPN33.inf @@ -1,114 +1,114 @@ -; VPN Client Device Driver for Windows 2000 and Greater -; -; Copyright (c) SoftEther Corporation. All Rights Reserved. -; http://www.softether.co.jp/ -; -; BUILD 9658 - -[Version] -Signature = "$Windows NT$" -Class = Net -ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} -Provider = %CompanyName% -DriverVer = 02/04/2018, 4.25.0.9658 -CatalogFile.NT = Neo6_x64_VPN33.cat - -[Manufacturer] -%CompanyName% = SoftEther, NTamd64 - -[SourceDisksNames] -1=%DiskDescription%, "", , - -[SourceDisksFiles] -Neo6_x64_VPN33.sys = 1 - -[DestinationDirs] -DefaultDestDir = 12 -Neo.CopyFiles.Sys = 12 - -[Neo.CopyFiles.Sys] -Neo6_x64_VPN33.sys, , , 2 - -[SoftEther.NTamd64] -%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN33 - -[NeoAdapter.Install] -Characteristics = 0x1 -AddReg = Neo.Reg, NeoAdapter.Ndi -CopyFiles = Neo.CopyFiles.Sys -*IfType = 53 -*MediaType = 0 -*PhysicalMediaType = 0 - -[NeoAdapter.Install.Services] -AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% - -[NeoAdapter.Ndi] -HKR, , NetworkAddress, 0, %DefaultAddress% -HKR, Ndi, DeviceID, , "NeoAdapter_VPN33" -HKR, , DevLoader, , ndis -HKR, , DeviceVxDs, , Neo6_x64_VPN33.sys -HKR, NDIS, LogDriverName, , "Neo_VPN33" -HKR, NDIS, MajorNdisVersion, 1, 5 -HKR, NDIS, MinorNdisVersion, 1, 0 -HKR, Ndi\Interfaces, DefUpper, , "ndis5" -HKR, Ndi\Interfaces, UpperRange, , "ndis5" -HKR, Ndi\Interfaces, LowerRange, , "ethernet" -HKR, Ndi\Interfaces, DefLower, , "ethernet" -HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" -HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% -HKR, Ndi\Params\NetworkAddress, type, 0, "edit" -HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" -HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" -HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% -HKR, Ndi\Params\NetworkAddress, optional, 0, "0" -HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% -HKR, Ndi\Params\MaxSpeed, type, 0, "int" -HKR, Ndi\Params\MaxSpeed, default, 0, "100" -HKR, Ndi\Params\MaxSpeed, min, 0, "0" -HKR, Ndi\Params\MaxSpeed, max, 0, "2000" -HKR, Ndi\Params\MaxSpeed, step, 0, "1" -HKR, Ndi\Params\MaxSpeed, Base, 0, "10" -HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% -HKR, Ndi\Params\KeepLink, type, 0, "enum" -HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% -HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% -HKR, Ndi\Params\KeepLink, default, 0, "0" - - -[Neo.Service] -DisplayName = %Neo.Service.DispName% -Description = %Neo.Service.Desc% -ServiceType = 1 -StartType = 3 -ErrorControl = 1 -ServiceBinary = %12%\Neo6_x64_VPN33.sys -LoadOrderGroup = NDIS - -[Neo.Reg] -HKR, Ndi, Service, 0, Neo.Service.Name -HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" -HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" - -[Neo.EventLog] -HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo6_x64_VPN33.sys" -HKR, , TypesSupported, 0x00010001, 7 - -[Strings] -CompanyName = "SoftEther Corporation" -DiskDescription = "VPN Client Device Driver Install Disk" -Neo.Service.Name = "Neo_VPN33" -Neo.Service.DispName = "VPN Client Device Driver - VPN33" -Neo.Service.Desc = "VPN Client Adapter - VPN33" -NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN33" -Neo.EventLog.Name = "Neo" -NetworkAddress = "MAC Address" -DefaultAddress = "000001000001" -MaxSpeed = "Indicate Speed (Mbps)" -KeepLink = "Keep Link" -On = "On" -Off = "Off" - - -; Auto Generated 20180205_163623.665 - +; VPN Client Device Driver for Windows 2000 and Greater +; +; Copyright (c) SoftEther Corporation. All Rights Reserved. +; http://www.softether.co.jp/ +; +; BUILD 9658 + +[Version] +Signature = "$Windows NT$" +Class = Net +ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} +Provider = %CompanyName% +DriverVer = 02/04/2018, 4.25.0.9658 +CatalogFile.NT = Neo6_x64_VPN33.cat + +[Manufacturer] +%CompanyName% = SoftEther, NTamd64 + +[SourceDisksNames] +1=%DiskDescription%, "", , + +[SourceDisksFiles] +Neo6_x64_VPN33.sys = 1 + +[DestinationDirs] +DefaultDestDir = 12 +Neo.CopyFiles.Sys = 12 + +[Neo.CopyFiles.Sys] +Neo6_x64_VPN33.sys, , , 2 + +[SoftEther.NTamd64] +%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN33 + +[NeoAdapter.Install] +Characteristics = 0x1 +AddReg = Neo.Reg, NeoAdapter.Ndi +CopyFiles = Neo.CopyFiles.Sys +*IfType = 53 +*MediaType = 0 +*PhysicalMediaType = 0 + +[NeoAdapter.Install.Services] +AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% + +[NeoAdapter.Ndi] +HKR, , NetworkAddress, 0, %DefaultAddress% +HKR, Ndi, DeviceID, , "NeoAdapter_VPN33" +HKR, , DevLoader, , ndis +HKR, , DeviceVxDs, , Neo6_x64_VPN33.sys +HKR, NDIS, LogDriverName, , "Neo_VPN33" +HKR, NDIS, MajorNdisVersion, 1, 5 +HKR, NDIS, MinorNdisVersion, 1, 0 +HKR, Ndi\Interfaces, DefUpper, , "ndis5" +HKR, Ndi\Interfaces, UpperRange, , "ndis5" +HKR, Ndi\Interfaces, LowerRange, , "ethernet" +HKR, Ndi\Interfaces, DefLower, , "ethernet" +HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" +HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% +HKR, Ndi\Params\NetworkAddress, type, 0, "edit" +HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" +HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" +HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% +HKR, Ndi\Params\NetworkAddress, optional, 0, "0" +HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% +HKR, Ndi\Params\MaxSpeed, type, 0, "int" +HKR, Ndi\Params\MaxSpeed, default, 0, "100" +HKR, Ndi\Params\MaxSpeed, min, 0, "0" +HKR, Ndi\Params\MaxSpeed, max, 0, "2000" +HKR, Ndi\Params\MaxSpeed, step, 0, "1" +HKR, Ndi\Params\MaxSpeed, Base, 0, "10" +HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% +HKR, Ndi\Params\KeepLink, type, 0, "enum" +HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% +HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% +HKR, Ndi\Params\KeepLink, default, 0, "0" + + +[Neo.Service] +DisplayName = %Neo.Service.DispName% +Description = %Neo.Service.Desc% +ServiceType = 1 +StartType = 3 +ErrorControl = 1 +ServiceBinary = %12%\Neo6_x64_VPN33.sys +LoadOrderGroup = NDIS + +[Neo.Reg] +HKR, Ndi, Service, 0, Neo.Service.Name +HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" +HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" + +[Neo.EventLog] +HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo6_x64_VPN33.sys" +HKR, , TypesSupported, 0x00010001, 7 + +[Strings] +CompanyName = "SoftEther Corporation" +DiskDescription = "VPN Client Device Driver Install Disk" +Neo.Service.Name = "Neo_VPN33" +Neo.Service.DispName = "VPN Client Device Driver - VPN33" +Neo.Service.Desc = "VPN Client Adapter - VPN33" +NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN33" +Neo.EventLog.Name = "Neo" +NetworkAddress = "MAC Address" +DefaultAddress = "000001000001" +MaxSpeed = "Indicate Speed (Mbps)" +KeepLink = "Keep Link" +On = "On" +Off = "Off" + + +; Auto Generated 20180205_163623.665 + diff --git a/src/bin/hamcore/DriverPackages/Neo6_Win10/x64/Neo6_x64_VPN34.inf b/src/bin/hamcore/DriverPackages/Neo6_Win10/x64/Neo6_x64_VPN34.inf index 4952d2f7..de153b8e 100644 --- a/src/bin/hamcore/DriverPackages/Neo6_Win10/x64/Neo6_x64_VPN34.inf +++ b/src/bin/hamcore/DriverPackages/Neo6_Win10/x64/Neo6_x64_VPN34.inf @@ -1,114 +1,114 @@ -; VPN Client Device Driver for Windows 2000 and Greater -; -; Copyright (c) SoftEther Corporation. All Rights Reserved. -; http://www.softether.co.jp/ -; -; BUILD 9658 - -[Version] -Signature = "$Windows NT$" -Class = Net -ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} -Provider = %CompanyName% -DriverVer = 02/04/2018, 4.25.0.9658 -CatalogFile.NT = Neo6_x64_VPN34.cat - -[Manufacturer] -%CompanyName% = SoftEther, NTamd64 - -[SourceDisksNames] -1=%DiskDescription%, "", , - -[SourceDisksFiles] -Neo6_x64_VPN34.sys = 1 - -[DestinationDirs] -DefaultDestDir = 12 -Neo.CopyFiles.Sys = 12 - -[Neo.CopyFiles.Sys] -Neo6_x64_VPN34.sys, , , 2 - -[SoftEther.NTamd64] -%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN34 - -[NeoAdapter.Install] -Characteristics = 0x1 -AddReg = Neo.Reg, NeoAdapter.Ndi -CopyFiles = Neo.CopyFiles.Sys -*IfType = 53 -*MediaType = 0 -*PhysicalMediaType = 0 - -[NeoAdapter.Install.Services] -AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% - -[NeoAdapter.Ndi] -HKR, , NetworkAddress, 0, %DefaultAddress% -HKR, Ndi, DeviceID, , "NeoAdapter_VPN34" -HKR, , DevLoader, , ndis -HKR, , DeviceVxDs, , Neo6_x64_VPN34.sys -HKR, NDIS, LogDriverName, , "Neo_VPN34" -HKR, NDIS, MajorNdisVersion, 1, 5 -HKR, NDIS, MinorNdisVersion, 1, 0 -HKR, Ndi\Interfaces, DefUpper, , "ndis5" -HKR, Ndi\Interfaces, UpperRange, , "ndis5" -HKR, Ndi\Interfaces, LowerRange, , "ethernet" -HKR, Ndi\Interfaces, DefLower, , "ethernet" -HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" -HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% -HKR, Ndi\Params\NetworkAddress, type, 0, "edit" -HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" -HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" -HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% -HKR, Ndi\Params\NetworkAddress, optional, 0, "0" -HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% -HKR, Ndi\Params\MaxSpeed, type, 0, "int" -HKR, Ndi\Params\MaxSpeed, default, 0, "100" -HKR, Ndi\Params\MaxSpeed, min, 0, "0" -HKR, Ndi\Params\MaxSpeed, max, 0, "2000" -HKR, Ndi\Params\MaxSpeed, step, 0, "1" -HKR, Ndi\Params\MaxSpeed, Base, 0, "10" -HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% -HKR, Ndi\Params\KeepLink, type, 0, "enum" -HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% -HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% -HKR, Ndi\Params\KeepLink, default, 0, "0" - - -[Neo.Service] -DisplayName = %Neo.Service.DispName% -Description = %Neo.Service.Desc% -ServiceType = 1 -StartType = 3 -ErrorControl = 1 -ServiceBinary = %12%\Neo6_x64_VPN34.sys -LoadOrderGroup = NDIS - -[Neo.Reg] -HKR, Ndi, Service, 0, Neo.Service.Name -HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" -HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" - -[Neo.EventLog] -HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo6_x64_VPN34.sys" -HKR, , TypesSupported, 0x00010001, 7 - -[Strings] -CompanyName = "SoftEther Corporation" -DiskDescription = "VPN Client Device Driver Install Disk" -Neo.Service.Name = "Neo_VPN34" -Neo.Service.DispName = "VPN Client Device Driver - VPN34" -Neo.Service.Desc = "VPN Client Adapter - VPN34" -NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN34" -Neo.EventLog.Name = "Neo" -NetworkAddress = "MAC Address" -DefaultAddress = "000001000001" -MaxSpeed = "Indicate Speed (Mbps)" -KeepLink = "Keep Link" -On = "On" -Off = "Off" - - -; Auto Generated 20180205_163623.736 - +; VPN Client Device Driver for Windows 2000 and Greater +; +; Copyright (c) SoftEther Corporation. All Rights Reserved. +; http://www.softether.co.jp/ +; +; BUILD 9658 + +[Version] +Signature = "$Windows NT$" +Class = Net +ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} +Provider = %CompanyName% +DriverVer = 02/04/2018, 4.25.0.9658 +CatalogFile.NT = Neo6_x64_VPN34.cat + +[Manufacturer] +%CompanyName% = SoftEther, NTamd64 + +[SourceDisksNames] +1=%DiskDescription%, "", , + +[SourceDisksFiles] +Neo6_x64_VPN34.sys = 1 + +[DestinationDirs] +DefaultDestDir = 12 +Neo.CopyFiles.Sys = 12 + +[Neo.CopyFiles.Sys] +Neo6_x64_VPN34.sys, , , 2 + +[SoftEther.NTamd64] +%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN34 + +[NeoAdapter.Install] +Characteristics = 0x1 +AddReg = Neo.Reg, NeoAdapter.Ndi +CopyFiles = Neo.CopyFiles.Sys +*IfType = 53 +*MediaType = 0 +*PhysicalMediaType = 0 + +[NeoAdapter.Install.Services] +AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% + +[NeoAdapter.Ndi] +HKR, , NetworkAddress, 0, %DefaultAddress% +HKR, Ndi, DeviceID, , "NeoAdapter_VPN34" +HKR, , DevLoader, , ndis +HKR, , DeviceVxDs, , Neo6_x64_VPN34.sys +HKR, NDIS, LogDriverName, , "Neo_VPN34" +HKR, NDIS, MajorNdisVersion, 1, 5 +HKR, NDIS, MinorNdisVersion, 1, 0 +HKR, Ndi\Interfaces, DefUpper, , "ndis5" +HKR, Ndi\Interfaces, UpperRange, , "ndis5" +HKR, Ndi\Interfaces, LowerRange, , "ethernet" +HKR, Ndi\Interfaces, DefLower, , "ethernet" +HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" +HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% +HKR, Ndi\Params\NetworkAddress, type, 0, "edit" +HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" +HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" +HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% +HKR, Ndi\Params\NetworkAddress, optional, 0, "0" +HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% +HKR, Ndi\Params\MaxSpeed, type, 0, "int" +HKR, Ndi\Params\MaxSpeed, default, 0, "100" +HKR, Ndi\Params\MaxSpeed, min, 0, "0" +HKR, Ndi\Params\MaxSpeed, max, 0, "2000" +HKR, Ndi\Params\MaxSpeed, step, 0, "1" +HKR, Ndi\Params\MaxSpeed, Base, 0, "10" +HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% +HKR, Ndi\Params\KeepLink, type, 0, "enum" +HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% +HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% +HKR, Ndi\Params\KeepLink, default, 0, "0" + + +[Neo.Service] +DisplayName = %Neo.Service.DispName% +Description = %Neo.Service.Desc% +ServiceType = 1 +StartType = 3 +ErrorControl = 1 +ServiceBinary = %12%\Neo6_x64_VPN34.sys +LoadOrderGroup = NDIS + +[Neo.Reg] +HKR, Ndi, Service, 0, Neo.Service.Name +HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" +HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" + +[Neo.EventLog] +HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo6_x64_VPN34.sys" +HKR, , TypesSupported, 0x00010001, 7 + +[Strings] +CompanyName = "SoftEther Corporation" +DiskDescription = "VPN Client Device Driver Install Disk" +Neo.Service.Name = "Neo_VPN34" +Neo.Service.DispName = "VPN Client Device Driver - VPN34" +Neo.Service.Desc = "VPN Client Adapter - VPN34" +NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN34" +Neo.EventLog.Name = "Neo" +NetworkAddress = "MAC Address" +DefaultAddress = "000001000001" +MaxSpeed = "Indicate Speed (Mbps)" +KeepLink = "Keep Link" +On = "On" +Off = "Off" + + +; Auto Generated 20180205_163623.736 + diff --git a/src/bin/hamcore/DriverPackages/Neo6_Win10/x64/Neo6_x64_VPN35.inf b/src/bin/hamcore/DriverPackages/Neo6_Win10/x64/Neo6_x64_VPN35.inf index c726161a..91b67ccf 100644 --- a/src/bin/hamcore/DriverPackages/Neo6_Win10/x64/Neo6_x64_VPN35.inf +++ b/src/bin/hamcore/DriverPackages/Neo6_Win10/x64/Neo6_x64_VPN35.inf @@ -1,114 +1,114 @@ -; VPN Client Device Driver for Windows 2000 and Greater -; -; Copyright (c) SoftEther Corporation. All Rights Reserved. -; http://www.softether.co.jp/ -; -; BUILD 9658 - -[Version] -Signature = "$Windows NT$" -Class = Net -ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} -Provider = %CompanyName% -DriverVer = 02/04/2018, 4.25.0.9658 -CatalogFile.NT = Neo6_x64_VPN35.cat - -[Manufacturer] -%CompanyName% = SoftEther, NTamd64 - -[SourceDisksNames] -1=%DiskDescription%, "", , - -[SourceDisksFiles] -Neo6_x64_VPN35.sys = 1 - -[DestinationDirs] -DefaultDestDir = 12 -Neo.CopyFiles.Sys = 12 - -[Neo.CopyFiles.Sys] -Neo6_x64_VPN35.sys, , , 2 - -[SoftEther.NTamd64] -%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN35 - -[NeoAdapter.Install] -Characteristics = 0x1 -AddReg = Neo.Reg, NeoAdapter.Ndi -CopyFiles = Neo.CopyFiles.Sys -*IfType = 53 -*MediaType = 0 -*PhysicalMediaType = 0 - -[NeoAdapter.Install.Services] -AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% - -[NeoAdapter.Ndi] -HKR, , NetworkAddress, 0, %DefaultAddress% -HKR, Ndi, DeviceID, , "NeoAdapter_VPN35" -HKR, , DevLoader, , ndis -HKR, , DeviceVxDs, , Neo6_x64_VPN35.sys -HKR, NDIS, LogDriverName, , "Neo_VPN35" -HKR, NDIS, MajorNdisVersion, 1, 5 -HKR, NDIS, MinorNdisVersion, 1, 0 -HKR, Ndi\Interfaces, DefUpper, , "ndis5" -HKR, Ndi\Interfaces, UpperRange, , "ndis5" -HKR, Ndi\Interfaces, LowerRange, , "ethernet" -HKR, Ndi\Interfaces, DefLower, , "ethernet" -HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" -HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% -HKR, Ndi\Params\NetworkAddress, type, 0, "edit" -HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" -HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" -HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% -HKR, Ndi\Params\NetworkAddress, optional, 0, "0" -HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% -HKR, Ndi\Params\MaxSpeed, type, 0, "int" -HKR, Ndi\Params\MaxSpeed, default, 0, "100" -HKR, Ndi\Params\MaxSpeed, min, 0, "0" -HKR, Ndi\Params\MaxSpeed, max, 0, "2000" -HKR, Ndi\Params\MaxSpeed, step, 0, "1" -HKR, Ndi\Params\MaxSpeed, Base, 0, "10" -HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% -HKR, Ndi\Params\KeepLink, type, 0, "enum" -HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% -HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% -HKR, Ndi\Params\KeepLink, default, 0, "0" - - -[Neo.Service] -DisplayName = %Neo.Service.DispName% -Description = %Neo.Service.Desc% -ServiceType = 1 -StartType = 3 -ErrorControl = 1 -ServiceBinary = %12%\Neo6_x64_VPN35.sys -LoadOrderGroup = NDIS - -[Neo.Reg] -HKR, Ndi, Service, 0, Neo.Service.Name -HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" -HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" - -[Neo.EventLog] -HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo6_x64_VPN35.sys" -HKR, , TypesSupported, 0x00010001, 7 - -[Strings] -CompanyName = "SoftEther Corporation" -DiskDescription = "VPN Client Device Driver Install Disk" -Neo.Service.Name = "Neo_VPN35" -Neo.Service.DispName = "VPN Client Device Driver - VPN35" -Neo.Service.Desc = "VPN Client Adapter - VPN35" -NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN35" -Neo.EventLog.Name = "Neo" -NetworkAddress = "MAC Address" -DefaultAddress = "000001000001" -MaxSpeed = "Indicate Speed (Mbps)" -KeepLink = "Keep Link" -On = "On" -Off = "Off" - - -; Auto Generated 20180205_163623.807 - +; VPN Client Device Driver for Windows 2000 and Greater +; +; Copyright (c) SoftEther Corporation. All Rights Reserved. +; http://www.softether.co.jp/ +; +; BUILD 9658 + +[Version] +Signature = "$Windows NT$" +Class = Net +ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} +Provider = %CompanyName% +DriverVer = 02/04/2018, 4.25.0.9658 +CatalogFile.NT = Neo6_x64_VPN35.cat + +[Manufacturer] +%CompanyName% = SoftEther, NTamd64 + +[SourceDisksNames] +1=%DiskDescription%, "", , + +[SourceDisksFiles] +Neo6_x64_VPN35.sys = 1 + +[DestinationDirs] +DefaultDestDir = 12 +Neo.CopyFiles.Sys = 12 + +[Neo.CopyFiles.Sys] +Neo6_x64_VPN35.sys, , , 2 + +[SoftEther.NTamd64] +%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN35 + +[NeoAdapter.Install] +Characteristics = 0x1 +AddReg = Neo.Reg, NeoAdapter.Ndi +CopyFiles = Neo.CopyFiles.Sys +*IfType = 53 +*MediaType = 0 +*PhysicalMediaType = 0 + +[NeoAdapter.Install.Services] +AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% + +[NeoAdapter.Ndi] +HKR, , NetworkAddress, 0, %DefaultAddress% +HKR, Ndi, DeviceID, , "NeoAdapter_VPN35" +HKR, , DevLoader, , ndis +HKR, , DeviceVxDs, , Neo6_x64_VPN35.sys +HKR, NDIS, LogDriverName, , "Neo_VPN35" +HKR, NDIS, MajorNdisVersion, 1, 5 +HKR, NDIS, MinorNdisVersion, 1, 0 +HKR, Ndi\Interfaces, DefUpper, , "ndis5" +HKR, Ndi\Interfaces, UpperRange, , "ndis5" +HKR, Ndi\Interfaces, LowerRange, , "ethernet" +HKR, Ndi\Interfaces, DefLower, , "ethernet" +HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" +HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% +HKR, Ndi\Params\NetworkAddress, type, 0, "edit" +HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" +HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" +HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% +HKR, Ndi\Params\NetworkAddress, optional, 0, "0" +HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% +HKR, Ndi\Params\MaxSpeed, type, 0, "int" +HKR, Ndi\Params\MaxSpeed, default, 0, "100" +HKR, Ndi\Params\MaxSpeed, min, 0, "0" +HKR, Ndi\Params\MaxSpeed, max, 0, "2000" +HKR, Ndi\Params\MaxSpeed, step, 0, "1" +HKR, Ndi\Params\MaxSpeed, Base, 0, "10" +HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% +HKR, Ndi\Params\KeepLink, type, 0, "enum" +HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% +HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% +HKR, Ndi\Params\KeepLink, default, 0, "0" + + +[Neo.Service] +DisplayName = %Neo.Service.DispName% +Description = %Neo.Service.Desc% +ServiceType = 1 +StartType = 3 +ErrorControl = 1 +ServiceBinary = %12%\Neo6_x64_VPN35.sys +LoadOrderGroup = NDIS + +[Neo.Reg] +HKR, Ndi, Service, 0, Neo.Service.Name +HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" +HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" + +[Neo.EventLog] +HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo6_x64_VPN35.sys" +HKR, , TypesSupported, 0x00010001, 7 + +[Strings] +CompanyName = "SoftEther Corporation" +DiskDescription = "VPN Client Device Driver Install Disk" +Neo.Service.Name = "Neo_VPN35" +Neo.Service.DispName = "VPN Client Device Driver - VPN35" +Neo.Service.Desc = "VPN Client Adapter - VPN35" +NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN35" +Neo.EventLog.Name = "Neo" +NetworkAddress = "MAC Address" +DefaultAddress = "000001000001" +MaxSpeed = "Indicate Speed (Mbps)" +KeepLink = "Keep Link" +On = "On" +Off = "Off" + + +; Auto Generated 20180205_163623.807 + diff --git a/src/bin/hamcore/DriverPackages/Neo6_Win10/x64/Neo6_x64_VPN36.inf b/src/bin/hamcore/DriverPackages/Neo6_Win10/x64/Neo6_x64_VPN36.inf index e28fe31f..513793d0 100644 --- a/src/bin/hamcore/DriverPackages/Neo6_Win10/x64/Neo6_x64_VPN36.inf +++ b/src/bin/hamcore/DriverPackages/Neo6_Win10/x64/Neo6_x64_VPN36.inf @@ -1,114 +1,114 @@ -; VPN Client Device Driver for Windows 2000 and Greater -; -; Copyright (c) SoftEther Corporation. All Rights Reserved. -; http://www.softether.co.jp/ -; -; BUILD 9658 - -[Version] -Signature = "$Windows NT$" -Class = Net -ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} -Provider = %CompanyName% -DriverVer = 02/04/2018, 4.25.0.9658 -CatalogFile.NT = Neo6_x64_VPN36.cat - -[Manufacturer] -%CompanyName% = SoftEther, NTamd64 - -[SourceDisksNames] -1=%DiskDescription%, "", , - -[SourceDisksFiles] -Neo6_x64_VPN36.sys = 1 - -[DestinationDirs] -DefaultDestDir = 12 -Neo.CopyFiles.Sys = 12 - -[Neo.CopyFiles.Sys] -Neo6_x64_VPN36.sys, , , 2 - -[SoftEther.NTamd64] -%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN36 - -[NeoAdapter.Install] -Characteristics = 0x1 -AddReg = Neo.Reg, NeoAdapter.Ndi -CopyFiles = Neo.CopyFiles.Sys -*IfType = 53 -*MediaType = 0 -*PhysicalMediaType = 0 - -[NeoAdapter.Install.Services] -AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% - -[NeoAdapter.Ndi] -HKR, , NetworkAddress, 0, %DefaultAddress% -HKR, Ndi, DeviceID, , "NeoAdapter_VPN36" -HKR, , DevLoader, , ndis -HKR, , DeviceVxDs, , Neo6_x64_VPN36.sys -HKR, NDIS, LogDriverName, , "Neo_VPN36" -HKR, NDIS, MajorNdisVersion, 1, 5 -HKR, NDIS, MinorNdisVersion, 1, 0 -HKR, Ndi\Interfaces, DefUpper, , "ndis5" -HKR, Ndi\Interfaces, UpperRange, , "ndis5" -HKR, Ndi\Interfaces, LowerRange, , "ethernet" -HKR, Ndi\Interfaces, DefLower, , "ethernet" -HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" -HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% -HKR, Ndi\Params\NetworkAddress, type, 0, "edit" -HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" -HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" -HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% -HKR, Ndi\Params\NetworkAddress, optional, 0, "0" -HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% -HKR, Ndi\Params\MaxSpeed, type, 0, "int" -HKR, Ndi\Params\MaxSpeed, default, 0, "100" -HKR, Ndi\Params\MaxSpeed, min, 0, "0" -HKR, Ndi\Params\MaxSpeed, max, 0, "2000" -HKR, Ndi\Params\MaxSpeed, step, 0, "1" -HKR, Ndi\Params\MaxSpeed, Base, 0, "10" -HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% -HKR, Ndi\Params\KeepLink, type, 0, "enum" -HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% -HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% -HKR, Ndi\Params\KeepLink, default, 0, "0" - - -[Neo.Service] -DisplayName = %Neo.Service.DispName% -Description = %Neo.Service.Desc% -ServiceType = 1 -StartType = 3 -ErrorControl = 1 -ServiceBinary = %12%\Neo6_x64_VPN36.sys -LoadOrderGroup = NDIS - -[Neo.Reg] -HKR, Ndi, Service, 0, Neo.Service.Name -HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" -HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" - -[Neo.EventLog] -HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo6_x64_VPN36.sys" -HKR, , TypesSupported, 0x00010001, 7 - -[Strings] -CompanyName = "SoftEther Corporation" -DiskDescription = "VPN Client Device Driver Install Disk" -Neo.Service.Name = "Neo_VPN36" -Neo.Service.DispName = "VPN Client Device Driver - VPN36" -Neo.Service.Desc = "VPN Client Adapter - VPN36" -NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN36" -Neo.EventLog.Name = "Neo" -NetworkAddress = "MAC Address" -DefaultAddress = "000001000001" -MaxSpeed = "Indicate Speed (Mbps)" -KeepLink = "Keep Link" -On = "On" -Off = "Off" - - -; Auto Generated 20180205_163623.878 - +; VPN Client Device Driver for Windows 2000 and Greater +; +; Copyright (c) SoftEther Corporation. All Rights Reserved. +; http://www.softether.co.jp/ +; +; BUILD 9658 + +[Version] +Signature = "$Windows NT$" +Class = Net +ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} +Provider = %CompanyName% +DriverVer = 02/04/2018, 4.25.0.9658 +CatalogFile.NT = Neo6_x64_VPN36.cat + +[Manufacturer] +%CompanyName% = SoftEther, NTamd64 + +[SourceDisksNames] +1=%DiskDescription%, "", , + +[SourceDisksFiles] +Neo6_x64_VPN36.sys = 1 + +[DestinationDirs] +DefaultDestDir = 12 +Neo.CopyFiles.Sys = 12 + +[Neo.CopyFiles.Sys] +Neo6_x64_VPN36.sys, , , 2 + +[SoftEther.NTamd64] +%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN36 + +[NeoAdapter.Install] +Characteristics = 0x1 +AddReg = Neo.Reg, NeoAdapter.Ndi +CopyFiles = Neo.CopyFiles.Sys +*IfType = 53 +*MediaType = 0 +*PhysicalMediaType = 0 + +[NeoAdapter.Install.Services] +AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% + +[NeoAdapter.Ndi] +HKR, , NetworkAddress, 0, %DefaultAddress% +HKR, Ndi, DeviceID, , "NeoAdapter_VPN36" +HKR, , DevLoader, , ndis +HKR, , DeviceVxDs, , Neo6_x64_VPN36.sys +HKR, NDIS, LogDriverName, , "Neo_VPN36" +HKR, NDIS, MajorNdisVersion, 1, 5 +HKR, NDIS, MinorNdisVersion, 1, 0 +HKR, Ndi\Interfaces, DefUpper, , "ndis5" +HKR, Ndi\Interfaces, UpperRange, , "ndis5" +HKR, Ndi\Interfaces, LowerRange, , "ethernet" +HKR, Ndi\Interfaces, DefLower, , "ethernet" +HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" +HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% +HKR, Ndi\Params\NetworkAddress, type, 0, "edit" +HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" +HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" +HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% +HKR, Ndi\Params\NetworkAddress, optional, 0, "0" +HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% +HKR, Ndi\Params\MaxSpeed, type, 0, "int" +HKR, Ndi\Params\MaxSpeed, default, 0, "100" +HKR, Ndi\Params\MaxSpeed, min, 0, "0" +HKR, Ndi\Params\MaxSpeed, max, 0, "2000" +HKR, Ndi\Params\MaxSpeed, step, 0, "1" +HKR, Ndi\Params\MaxSpeed, Base, 0, "10" +HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% +HKR, Ndi\Params\KeepLink, type, 0, "enum" +HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% +HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% +HKR, Ndi\Params\KeepLink, default, 0, "0" + + +[Neo.Service] +DisplayName = %Neo.Service.DispName% +Description = %Neo.Service.Desc% +ServiceType = 1 +StartType = 3 +ErrorControl = 1 +ServiceBinary = %12%\Neo6_x64_VPN36.sys +LoadOrderGroup = NDIS + +[Neo.Reg] +HKR, Ndi, Service, 0, Neo.Service.Name +HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" +HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" + +[Neo.EventLog] +HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo6_x64_VPN36.sys" +HKR, , TypesSupported, 0x00010001, 7 + +[Strings] +CompanyName = "SoftEther Corporation" +DiskDescription = "VPN Client Device Driver Install Disk" +Neo.Service.Name = "Neo_VPN36" +Neo.Service.DispName = "VPN Client Device Driver - VPN36" +Neo.Service.Desc = "VPN Client Adapter - VPN36" +NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN36" +Neo.EventLog.Name = "Neo" +NetworkAddress = "MAC Address" +DefaultAddress = "000001000001" +MaxSpeed = "Indicate Speed (Mbps)" +KeepLink = "Keep Link" +On = "On" +Off = "Off" + + +; Auto Generated 20180205_163623.878 + diff --git a/src/bin/hamcore/DriverPackages/Neo6_Win10/x64/Neo6_x64_VPN37.inf b/src/bin/hamcore/DriverPackages/Neo6_Win10/x64/Neo6_x64_VPN37.inf index 22e5ab17..ad1e0b71 100644 --- a/src/bin/hamcore/DriverPackages/Neo6_Win10/x64/Neo6_x64_VPN37.inf +++ b/src/bin/hamcore/DriverPackages/Neo6_Win10/x64/Neo6_x64_VPN37.inf @@ -1,114 +1,114 @@ -; VPN Client Device Driver for Windows 2000 and Greater -; -; Copyright (c) SoftEther Corporation. All Rights Reserved. -; http://www.softether.co.jp/ -; -; BUILD 9658 - -[Version] -Signature = "$Windows NT$" -Class = Net -ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} -Provider = %CompanyName% -DriverVer = 02/04/2018, 4.25.0.9658 -CatalogFile.NT = Neo6_x64_VPN37.cat - -[Manufacturer] -%CompanyName% = SoftEther, NTamd64 - -[SourceDisksNames] -1=%DiskDescription%, "", , - -[SourceDisksFiles] -Neo6_x64_VPN37.sys = 1 - -[DestinationDirs] -DefaultDestDir = 12 -Neo.CopyFiles.Sys = 12 - -[Neo.CopyFiles.Sys] -Neo6_x64_VPN37.sys, , , 2 - -[SoftEther.NTamd64] -%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN37 - -[NeoAdapter.Install] -Characteristics = 0x1 -AddReg = Neo.Reg, NeoAdapter.Ndi -CopyFiles = Neo.CopyFiles.Sys -*IfType = 53 -*MediaType = 0 -*PhysicalMediaType = 0 - -[NeoAdapter.Install.Services] -AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% - -[NeoAdapter.Ndi] -HKR, , NetworkAddress, 0, %DefaultAddress% -HKR, Ndi, DeviceID, , "NeoAdapter_VPN37" -HKR, , DevLoader, , ndis -HKR, , DeviceVxDs, , Neo6_x64_VPN37.sys -HKR, NDIS, LogDriverName, , "Neo_VPN37" -HKR, NDIS, MajorNdisVersion, 1, 5 -HKR, NDIS, MinorNdisVersion, 1, 0 -HKR, Ndi\Interfaces, DefUpper, , "ndis5" -HKR, Ndi\Interfaces, UpperRange, , "ndis5" -HKR, Ndi\Interfaces, LowerRange, , "ethernet" -HKR, Ndi\Interfaces, DefLower, , "ethernet" -HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" -HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% -HKR, Ndi\Params\NetworkAddress, type, 0, "edit" -HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" -HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" -HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% -HKR, Ndi\Params\NetworkAddress, optional, 0, "0" -HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% -HKR, Ndi\Params\MaxSpeed, type, 0, "int" -HKR, Ndi\Params\MaxSpeed, default, 0, "100" -HKR, Ndi\Params\MaxSpeed, min, 0, "0" -HKR, Ndi\Params\MaxSpeed, max, 0, "2000" -HKR, Ndi\Params\MaxSpeed, step, 0, "1" -HKR, Ndi\Params\MaxSpeed, Base, 0, "10" -HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% -HKR, Ndi\Params\KeepLink, type, 0, "enum" -HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% -HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% -HKR, Ndi\Params\KeepLink, default, 0, "0" - - -[Neo.Service] -DisplayName = %Neo.Service.DispName% -Description = %Neo.Service.Desc% -ServiceType = 1 -StartType = 3 -ErrorControl = 1 -ServiceBinary = %12%\Neo6_x64_VPN37.sys -LoadOrderGroup = NDIS - -[Neo.Reg] -HKR, Ndi, Service, 0, Neo.Service.Name -HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" -HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" - -[Neo.EventLog] -HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo6_x64_VPN37.sys" -HKR, , TypesSupported, 0x00010001, 7 - -[Strings] -CompanyName = "SoftEther Corporation" -DiskDescription = "VPN Client Device Driver Install Disk" -Neo.Service.Name = "Neo_VPN37" -Neo.Service.DispName = "VPN Client Device Driver - VPN37" -Neo.Service.Desc = "VPN Client Adapter - VPN37" -NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN37" -Neo.EventLog.Name = "Neo" -NetworkAddress = "MAC Address" -DefaultAddress = "000001000001" -MaxSpeed = "Indicate Speed (Mbps)" -KeepLink = "Keep Link" -On = "On" -Off = "Off" - - -; Auto Generated 20180205_163623.949 - +; VPN Client Device Driver for Windows 2000 and Greater +; +; Copyright (c) SoftEther Corporation. All Rights Reserved. +; http://www.softether.co.jp/ +; +; BUILD 9658 + +[Version] +Signature = "$Windows NT$" +Class = Net +ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} +Provider = %CompanyName% +DriverVer = 02/04/2018, 4.25.0.9658 +CatalogFile.NT = Neo6_x64_VPN37.cat + +[Manufacturer] +%CompanyName% = SoftEther, NTamd64 + +[SourceDisksNames] +1=%DiskDescription%, "", , + +[SourceDisksFiles] +Neo6_x64_VPN37.sys = 1 + +[DestinationDirs] +DefaultDestDir = 12 +Neo.CopyFiles.Sys = 12 + +[Neo.CopyFiles.Sys] +Neo6_x64_VPN37.sys, , , 2 + +[SoftEther.NTamd64] +%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN37 + +[NeoAdapter.Install] +Characteristics = 0x1 +AddReg = Neo.Reg, NeoAdapter.Ndi +CopyFiles = Neo.CopyFiles.Sys +*IfType = 53 +*MediaType = 0 +*PhysicalMediaType = 0 + +[NeoAdapter.Install.Services] +AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% + +[NeoAdapter.Ndi] +HKR, , NetworkAddress, 0, %DefaultAddress% +HKR, Ndi, DeviceID, , "NeoAdapter_VPN37" +HKR, , DevLoader, , ndis +HKR, , DeviceVxDs, , Neo6_x64_VPN37.sys +HKR, NDIS, LogDriverName, , "Neo_VPN37" +HKR, NDIS, MajorNdisVersion, 1, 5 +HKR, NDIS, MinorNdisVersion, 1, 0 +HKR, Ndi\Interfaces, DefUpper, , "ndis5" +HKR, Ndi\Interfaces, UpperRange, , "ndis5" +HKR, Ndi\Interfaces, LowerRange, , "ethernet" +HKR, Ndi\Interfaces, DefLower, , "ethernet" +HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" +HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% +HKR, Ndi\Params\NetworkAddress, type, 0, "edit" +HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" +HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" +HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% +HKR, Ndi\Params\NetworkAddress, optional, 0, "0" +HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% +HKR, Ndi\Params\MaxSpeed, type, 0, "int" +HKR, Ndi\Params\MaxSpeed, default, 0, "100" +HKR, Ndi\Params\MaxSpeed, min, 0, "0" +HKR, Ndi\Params\MaxSpeed, max, 0, "2000" +HKR, Ndi\Params\MaxSpeed, step, 0, "1" +HKR, Ndi\Params\MaxSpeed, Base, 0, "10" +HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% +HKR, Ndi\Params\KeepLink, type, 0, "enum" +HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% +HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% +HKR, Ndi\Params\KeepLink, default, 0, "0" + + +[Neo.Service] +DisplayName = %Neo.Service.DispName% +Description = %Neo.Service.Desc% +ServiceType = 1 +StartType = 3 +ErrorControl = 1 +ServiceBinary = %12%\Neo6_x64_VPN37.sys +LoadOrderGroup = NDIS + +[Neo.Reg] +HKR, Ndi, Service, 0, Neo.Service.Name +HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" +HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" + +[Neo.EventLog] +HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo6_x64_VPN37.sys" +HKR, , TypesSupported, 0x00010001, 7 + +[Strings] +CompanyName = "SoftEther Corporation" +DiskDescription = "VPN Client Device Driver Install Disk" +Neo.Service.Name = "Neo_VPN37" +Neo.Service.DispName = "VPN Client Device Driver - VPN37" +Neo.Service.Desc = "VPN Client Adapter - VPN37" +NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN37" +Neo.EventLog.Name = "Neo" +NetworkAddress = "MAC Address" +DefaultAddress = "000001000001" +MaxSpeed = "Indicate Speed (Mbps)" +KeepLink = "Keep Link" +On = "On" +Off = "Off" + + +; Auto Generated 20180205_163623.949 + diff --git a/src/bin/hamcore/DriverPackages/Neo6_Win10/x64/Neo6_x64_VPN38.inf b/src/bin/hamcore/DriverPackages/Neo6_Win10/x64/Neo6_x64_VPN38.inf index 34ca48ea..3b27219d 100644 --- a/src/bin/hamcore/DriverPackages/Neo6_Win10/x64/Neo6_x64_VPN38.inf +++ b/src/bin/hamcore/DriverPackages/Neo6_Win10/x64/Neo6_x64_VPN38.inf @@ -1,114 +1,114 @@ -; VPN Client Device Driver for Windows 2000 and Greater -; -; Copyright (c) SoftEther Corporation. All Rights Reserved. -; http://www.softether.co.jp/ -; -; BUILD 9658 - -[Version] -Signature = "$Windows NT$" -Class = Net -ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} -Provider = %CompanyName% -DriverVer = 02/04/2018, 4.25.0.9658 -CatalogFile.NT = Neo6_x64_VPN38.cat - -[Manufacturer] -%CompanyName% = SoftEther, NTamd64 - -[SourceDisksNames] -1=%DiskDescription%, "", , - -[SourceDisksFiles] -Neo6_x64_VPN38.sys = 1 - -[DestinationDirs] -DefaultDestDir = 12 -Neo.CopyFiles.Sys = 12 - -[Neo.CopyFiles.Sys] -Neo6_x64_VPN38.sys, , , 2 - -[SoftEther.NTamd64] -%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN38 - -[NeoAdapter.Install] -Characteristics = 0x1 -AddReg = Neo.Reg, NeoAdapter.Ndi -CopyFiles = Neo.CopyFiles.Sys -*IfType = 53 -*MediaType = 0 -*PhysicalMediaType = 0 - -[NeoAdapter.Install.Services] -AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% - -[NeoAdapter.Ndi] -HKR, , NetworkAddress, 0, %DefaultAddress% -HKR, Ndi, DeviceID, , "NeoAdapter_VPN38" -HKR, , DevLoader, , ndis -HKR, , DeviceVxDs, , Neo6_x64_VPN38.sys -HKR, NDIS, LogDriverName, , "Neo_VPN38" -HKR, NDIS, MajorNdisVersion, 1, 5 -HKR, NDIS, MinorNdisVersion, 1, 0 -HKR, Ndi\Interfaces, DefUpper, , "ndis5" -HKR, Ndi\Interfaces, UpperRange, , "ndis5" -HKR, Ndi\Interfaces, LowerRange, , "ethernet" -HKR, Ndi\Interfaces, DefLower, , "ethernet" -HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" -HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% -HKR, Ndi\Params\NetworkAddress, type, 0, "edit" -HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" -HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" -HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% -HKR, Ndi\Params\NetworkAddress, optional, 0, "0" -HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% -HKR, Ndi\Params\MaxSpeed, type, 0, "int" -HKR, Ndi\Params\MaxSpeed, default, 0, "100" -HKR, Ndi\Params\MaxSpeed, min, 0, "0" -HKR, Ndi\Params\MaxSpeed, max, 0, "2000" -HKR, Ndi\Params\MaxSpeed, step, 0, "1" -HKR, Ndi\Params\MaxSpeed, Base, 0, "10" -HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% -HKR, Ndi\Params\KeepLink, type, 0, "enum" -HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% -HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% -HKR, Ndi\Params\KeepLink, default, 0, "0" - - -[Neo.Service] -DisplayName = %Neo.Service.DispName% -Description = %Neo.Service.Desc% -ServiceType = 1 -StartType = 3 -ErrorControl = 1 -ServiceBinary = %12%\Neo6_x64_VPN38.sys -LoadOrderGroup = NDIS - -[Neo.Reg] -HKR, Ndi, Service, 0, Neo.Service.Name -HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" -HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" - -[Neo.EventLog] -HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo6_x64_VPN38.sys" -HKR, , TypesSupported, 0x00010001, 7 - -[Strings] -CompanyName = "SoftEther Corporation" -DiskDescription = "VPN Client Device Driver Install Disk" -Neo.Service.Name = "Neo_VPN38" -Neo.Service.DispName = "VPN Client Device Driver - VPN38" -Neo.Service.Desc = "VPN Client Adapter - VPN38" -NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN38" -Neo.EventLog.Name = "Neo" -NetworkAddress = "MAC Address" -DefaultAddress = "000001000001" -MaxSpeed = "Indicate Speed (Mbps)" -KeepLink = "Keep Link" -On = "On" -Off = "Off" - - -; Auto Generated 20180205_163624.018 - +; VPN Client Device Driver for Windows 2000 and Greater +; +; Copyright (c) SoftEther Corporation. All Rights Reserved. +; http://www.softether.co.jp/ +; +; BUILD 9658 + +[Version] +Signature = "$Windows NT$" +Class = Net +ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} +Provider = %CompanyName% +DriverVer = 02/04/2018, 4.25.0.9658 +CatalogFile.NT = Neo6_x64_VPN38.cat + +[Manufacturer] +%CompanyName% = SoftEther, NTamd64 + +[SourceDisksNames] +1=%DiskDescription%, "", , + +[SourceDisksFiles] +Neo6_x64_VPN38.sys = 1 + +[DestinationDirs] +DefaultDestDir = 12 +Neo.CopyFiles.Sys = 12 + +[Neo.CopyFiles.Sys] +Neo6_x64_VPN38.sys, , , 2 + +[SoftEther.NTamd64] +%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN38 + +[NeoAdapter.Install] +Characteristics = 0x1 +AddReg = Neo.Reg, NeoAdapter.Ndi +CopyFiles = Neo.CopyFiles.Sys +*IfType = 53 +*MediaType = 0 +*PhysicalMediaType = 0 + +[NeoAdapter.Install.Services] +AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% + +[NeoAdapter.Ndi] +HKR, , NetworkAddress, 0, %DefaultAddress% +HKR, Ndi, DeviceID, , "NeoAdapter_VPN38" +HKR, , DevLoader, , ndis +HKR, , DeviceVxDs, , Neo6_x64_VPN38.sys +HKR, NDIS, LogDriverName, , "Neo_VPN38" +HKR, NDIS, MajorNdisVersion, 1, 5 +HKR, NDIS, MinorNdisVersion, 1, 0 +HKR, Ndi\Interfaces, DefUpper, , "ndis5" +HKR, Ndi\Interfaces, UpperRange, , "ndis5" +HKR, Ndi\Interfaces, LowerRange, , "ethernet" +HKR, Ndi\Interfaces, DefLower, , "ethernet" +HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" +HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% +HKR, Ndi\Params\NetworkAddress, type, 0, "edit" +HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" +HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" +HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% +HKR, Ndi\Params\NetworkAddress, optional, 0, "0" +HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% +HKR, Ndi\Params\MaxSpeed, type, 0, "int" +HKR, Ndi\Params\MaxSpeed, default, 0, "100" +HKR, Ndi\Params\MaxSpeed, min, 0, "0" +HKR, Ndi\Params\MaxSpeed, max, 0, "2000" +HKR, Ndi\Params\MaxSpeed, step, 0, "1" +HKR, Ndi\Params\MaxSpeed, Base, 0, "10" +HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% +HKR, Ndi\Params\KeepLink, type, 0, "enum" +HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% +HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% +HKR, Ndi\Params\KeepLink, default, 0, "0" + + +[Neo.Service] +DisplayName = %Neo.Service.DispName% +Description = %Neo.Service.Desc% +ServiceType = 1 +StartType = 3 +ErrorControl = 1 +ServiceBinary = %12%\Neo6_x64_VPN38.sys +LoadOrderGroup = NDIS + +[Neo.Reg] +HKR, Ndi, Service, 0, Neo.Service.Name +HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" +HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" + +[Neo.EventLog] +HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo6_x64_VPN38.sys" +HKR, , TypesSupported, 0x00010001, 7 + +[Strings] +CompanyName = "SoftEther Corporation" +DiskDescription = "VPN Client Device Driver Install Disk" +Neo.Service.Name = "Neo_VPN38" +Neo.Service.DispName = "VPN Client Device Driver - VPN38" +Neo.Service.Desc = "VPN Client Adapter - VPN38" +NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN38" +Neo.EventLog.Name = "Neo" +NetworkAddress = "MAC Address" +DefaultAddress = "000001000001" +MaxSpeed = "Indicate Speed (Mbps)" +KeepLink = "Keep Link" +On = "On" +Off = "Off" + + +; Auto Generated 20180205_163624.018 + diff --git a/src/bin/hamcore/DriverPackages/Neo6_Win10/x64/Neo6_x64_VPN39.inf b/src/bin/hamcore/DriverPackages/Neo6_Win10/x64/Neo6_x64_VPN39.inf index d8794a16..5b1fd711 100644 --- a/src/bin/hamcore/DriverPackages/Neo6_Win10/x64/Neo6_x64_VPN39.inf +++ b/src/bin/hamcore/DriverPackages/Neo6_Win10/x64/Neo6_x64_VPN39.inf @@ -1,114 +1,114 @@ -; VPN Client Device Driver for Windows 2000 and Greater -; -; Copyright (c) SoftEther Corporation. All Rights Reserved. -; http://www.softether.co.jp/ -; -; BUILD 9658 - -[Version] -Signature = "$Windows NT$" -Class = Net -ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} -Provider = %CompanyName% -DriverVer = 02/04/2018, 4.25.0.9658 -CatalogFile.NT = Neo6_x64_VPN39.cat - -[Manufacturer] -%CompanyName% = SoftEther, NTamd64 - -[SourceDisksNames] -1=%DiskDescription%, "", , - -[SourceDisksFiles] -Neo6_x64_VPN39.sys = 1 - -[DestinationDirs] -DefaultDestDir = 12 -Neo.CopyFiles.Sys = 12 - -[Neo.CopyFiles.Sys] -Neo6_x64_VPN39.sys, , , 2 - -[SoftEther.NTamd64] -%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN39 - -[NeoAdapter.Install] -Characteristics = 0x1 -AddReg = Neo.Reg, NeoAdapter.Ndi -CopyFiles = Neo.CopyFiles.Sys -*IfType = 53 -*MediaType = 0 -*PhysicalMediaType = 0 - -[NeoAdapter.Install.Services] -AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% - -[NeoAdapter.Ndi] -HKR, , NetworkAddress, 0, %DefaultAddress% -HKR, Ndi, DeviceID, , "NeoAdapter_VPN39" -HKR, , DevLoader, , ndis -HKR, , DeviceVxDs, , Neo6_x64_VPN39.sys -HKR, NDIS, LogDriverName, , "Neo_VPN39" -HKR, NDIS, MajorNdisVersion, 1, 5 -HKR, NDIS, MinorNdisVersion, 1, 0 -HKR, Ndi\Interfaces, DefUpper, , "ndis5" -HKR, Ndi\Interfaces, UpperRange, , "ndis5" -HKR, Ndi\Interfaces, LowerRange, , "ethernet" -HKR, Ndi\Interfaces, DefLower, , "ethernet" -HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" -HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% -HKR, Ndi\Params\NetworkAddress, type, 0, "edit" -HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" -HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" -HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% -HKR, Ndi\Params\NetworkAddress, optional, 0, "0" -HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% -HKR, Ndi\Params\MaxSpeed, type, 0, "int" -HKR, Ndi\Params\MaxSpeed, default, 0, "100" -HKR, Ndi\Params\MaxSpeed, min, 0, "0" -HKR, Ndi\Params\MaxSpeed, max, 0, "2000" -HKR, Ndi\Params\MaxSpeed, step, 0, "1" -HKR, Ndi\Params\MaxSpeed, Base, 0, "10" -HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% -HKR, Ndi\Params\KeepLink, type, 0, "enum" -HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% -HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% -HKR, Ndi\Params\KeepLink, default, 0, "0" - - -[Neo.Service] -DisplayName = %Neo.Service.DispName% -Description = %Neo.Service.Desc% -ServiceType = 1 -StartType = 3 -ErrorControl = 1 -ServiceBinary = %12%\Neo6_x64_VPN39.sys -LoadOrderGroup = NDIS - -[Neo.Reg] -HKR, Ndi, Service, 0, Neo.Service.Name -HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" -HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" - -[Neo.EventLog] -HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo6_x64_VPN39.sys" -HKR, , TypesSupported, 0x00010001, 7 - -[Strings] -CompanyName = "SoftEther Corporation" -DiskDescription = "VPN Client Device Driver Install Disk" -Neo.Service.Name = "Neo_VPN39" -Neo.Service.DispName = "VPN Client Device Driver - VPN39" -Neo.Service.Desc = "VPN Client Adapter - VPN39" -NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN39" -Neo.EventLog.Name = "Neo" -NetworkAddress = "MAC Address" -DefaultAddress = "000001000001" -MaxSpeed = "Indicate Speed (Mbps)" -KeepLink = "Keep Link" -On = "On" -Off = "Off" - - -; Auto Generated 20180205_163624.088 - +; VPN Client Device Driver for Windows 2000 and Greater +; +; Copyright (c) SoftEther Corporation. All Rights Reserved. +; http://www.softether.co.jp/ +; +; BUILD 9658 + +[Version] +Signature = "$Windows NT$" +Class = Net +ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} +Provider = %CompanyName% +DriverVer = 02/04/2018, 4.25.0.9658 +CatalogFile.NT = Neo6_x64_VPN39.cat + +[Manufacturer] +%CompanyName% = SoftEther, NTamd64 + +[SourceDisksNames] +1=%DiskDescription%, "", , + +[SourceDisksFiles] +Neo6_x64_VPN39.sys = 1 + +[DestinationDirs] +DefaultDestDir = 12 +Neo.CopyFiles.Sys = 12 + +[Neo.CopyFiles.Sys] +Neo6_x64_VPN39.sys, , , 2 + +[SoftEther.NTamd64] +%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN39 + +[NeoAdapter.Install] +Characteristics = 0x1 +AddReg = Neo.Reg, NeoAdapter.Ndi +CopyFiles = Neo.CopyFiles.Sys +*IfType = 53 +*MediaType = 0 +*PhysicalMediaType = 0 + +[NeoAdapter.Install.Services] +AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% + +[NeoAdapter.Ndi] +HKR, , NetworkAddress, 0, %DefaultAddress% +HKR, Ndi, DeviceID, , "NeoAdapter_VPN39" +HKR, , DevLoader, , ndis +HKR, , DeviceVxDs, , Neo6_x64_VPN39.sys +HKR, NDIS, LogDriverName, , "Neo_VPN39" +HKR, NDIS, MajorNdisVersion, 1, 5 +HKR, NDIS, MinorNdisVersion, 1, 0 +HKR, Ndi\Interfaces, DefUpper, , "ndis5" +HKR, Ndi\Interfaces, UpperRange, , "ndis5" +HKR, Ndi\Interfaces, LowerRange, , "ethernet" +HKR, Ndi\Interfaces, DefLower, , "ethernet" +HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" +HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% +HKR, Ndi\Params\NetworkAddress, type, 0, "edit" +HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" +HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" +HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% +HKR, Ndi\Params\NetworkAddress, optional, 0, "0" +HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% +HKR, Ndi\Params\MaxSpeed, type, 0, "int" +HKR, Ndi\Params\MaxSpeed, default, 0, "100" +HKR, Ndi\Params\MaxSpeed, min, 0, "0" +HKR, Ndi\Params\MaxSpeed, max, 0, "2000" +HKR, Ndi\Params\MaxSpeed, step, 0, "1" +HKR, Ndi\Params\MaxSpeed, Base, 0, "10" +HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% +HKR, Ndi\Params\KeepLink, type, 0, "enum" +HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% +HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% +HKR, Ndi\Params\KeepLink, default, 0, "0" + + +[Neo.Service] +DisplayName = %Neo.Service.DispName% +Description = %Neo.Service.Desc% +ServiceType = 1 +StartType = 3 +ErrorControl = 1 +ServiceBinary = %12%\Neo6_x64_VPN39.sys +LoadOrderGroup = NDIS + +[Neo.Reg] +HKR, Ndi, Service, 0, Neo.Service.Name +HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" +HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" + +[Neo.EventLog] +HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo6_x64_VPN39.sys" +HKR, , TypesSupported, 0x00010001, 7 + +[Strings] +CompanyName = "SoftEther Corporation" +DiskDescription = "VPN Client Device Driver Install Disk" +Neo.Service.Name = "Neo_VPN39" +Neo.Service.DispName = "VPN Client Device Driver - VPN39" +Neo.Service.Desc = "VPN Client Adapter - VPN39" +NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN39" +Neo.EventLog.Name = "Neo" +NetworkAddress = "MAC Address" +DefaultAddress = "000001000001" +MaxSpeed = "Indicate Speed (Mbps)" +KeepLink = "Keep Link" +On = "On" +Off = "Off" + + +; Auto Generated 20180205_163624.088 + diff --git a/src/bin/hamcore/DriverPackages/Neo6_Win10/x64/Neo6_x64_VPN4.inf b/src/bin/hamcore/DriverPackages/Neo6_Win10/x64/Neo6_x64_VPN4.inf index 0a3a10d7..30dd4e6c 100644 --- a/src/bin/hamcore/DriverPackages/Neo6_Win10/x64/Neo6_x64_VPN4.inf +++ b/src/bin/hamcore/DriverPackages/Neo6_Win10/x64/Neo6_x64_VPN4.inf @@ -1,114 +1,114 @@ -; VPN Client Device Driver for Windows 2000 and Greater -; -; Copyright (c) SoftEther Corporation. All Rights Reserved. -; http://www.softether.co.jp/ -; -; BUILD 9658 - -[Version] -Signature = "$Windows NT$" -Class = Net -ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} -Provider = %CompanyName% -DriverVer = 02/04/2018, 4.25.0.9658 -CatalogFile.NT = Neo6_x64_VPN4.cat - -[Manufacturer] -%CompanyName% = SoftEther, NTamd64 - -[SourceDisksNames] -1=%DiskDescription%, "", , - -[SourceDisksFiles] -Neo6_x64_VPN4.sys = 1 - -[DestinationDirs] -DefaultDestDir = 12 -Neo.CopyFiles.Sys = 12 - -[Neo.CopyFiles.Sys] -Neo6_x64_VPN4.sys, , , 2 - -[SoftEther.NTamd64] -%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN4 - -[NeoAdapter.Install] -Characteristics = 0x1 -AddReg = Neo.Reg, NeoAdapter.Ndi -CopyFiles = Neo.CopyFiles.Sys -*IfType = 53 -*MediaType = 0 -*PhysicalMediaType = 0 - -[NeoAdapter.Install.Services] -AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% - -[NeoAdapter.Ndi] -HKR, , NetworkAddress, 0, %DefaultAddress% -HKR, Ndi, DeviceID, , "NeoAdapter_VPN4" -HKR, , DevLoader, , ndis -HKR, , DeviceVxDs, , Neo6_x64_VPN4.sys -HKR, NDIS, LogDriverName, , "Neo_VPN4" -HKR, NDIS, MajorNdisVersion, 1, 5 -HKR, NDIS, MinorNdisVersion, 1, 0 -HKR, Ndi\Interfaces, DefUpper, , "ndis5" -HKR, Ndi\Interfaces, UpperRange, , "ndis5" -HKR, Ndi\Interfaces, LowerRange, , "ethernet" -HKR, Ndi\Interfaces, DefLower, , "ethernet" -HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" -HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% -HKR, Ndi\Params\NetworkAddress, type, 0, "edit" -HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" -HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" -HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% -HKR, Ndi\Params\NetworkAddress, optional, 0, "0" -HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% -HKR, Ndi\Params\MaxSpeed, type, 0, "int" -HKR, Ndi\Params\MaxSpeed, default, 0, "100" -HKR, Ndi\Params\MaxSpeed, min, 0, "0" -HKR, Ndi\Params\MaxSpeed, max, 0, "2000" -HKR, Ndi\Params\MaxSpeed, step, 0, "1" -HKR, Ndi\Params\MaxSpeed, Base, 0, "10" -HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% -HKR, Ndi\Params\KeepLink, type, 0, "enum" -HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% -HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% -HKR, Ndi\Params\KeepLink, default, 0, "0" - - -[Neo.Service] -DisplayName = %Neo.Service.DispName% -Description = %Neo.Service.Desc% -ServiceType = 1 -StartType = 3 -ErrorControl = 1 -ServiceBinary = %12%\Neo6_x64_VPN4.sys -LoadOrderGroup = NDIS - -[Neo.Reg] -HKR, Ndi, Service, 0, Neo.Service.Name -HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" -HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" - -[Neo.EventLog] -HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo6_x64_VPN4.sys" -HKR, , TypesSupported, 0x00010001, 7 - -[Strings] -CompanyName = "SoftEther Corporation" -DiskDescription = "VPN Client Device Driver Install Disk" -Neo.Service.Name = "Neo_VPN4" -Neo.Service.DispName = "VPN Client Device Driver - VPN4" -Neo.Service.Desc = "VPN Client Adapter - VPN4" -NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN4" -Neo.EventLog.Name = "Neo" -NetworkAddress = "MAC Address" -DefaultAddress = "000001000001" -MaxSpeed = "Indicate Speed (Mbps)" -KeepLink = "Keep Link" -On = "On" -Off = "Off" - - -; Auto Generated 20180205_163621.595 - +; VPN Client Device Driver for Windows 2000 and Greater +; +; Copyright (c) SoftEther Corporation. All Rights Reserved. +; http://www.softether.co.jp/ +; +; BUILD 9658 + +[Version] +Signature = "$Windows NT$" +Class = Net +ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} +Provider = %CompanyName% +DriverVer = 02/04/2018, 4.25.0.9658 +CatalogFile.NT = Neo6_x64_VPN4.cat + +[Manufacturer] +%CompanyName% = SoftEther, NTamd64 + +[SourceDisksNames] +1=%DiskDescription%, "", , + +[SourceDisksFiles] +Neo6_x64_VPN4.sys = 1 + +[DestinationDirs] +DefaultDestDir = 12 +Neo.CopyFiles.Sys = 12 + +[Neo.CopyFiles.Sys] +Neo6_x64_VPN4.sys, , , 2 + +[SoftEther.NTamd64] +%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN4 + +[NeoAdapter.Install] +Characteristics = 0x1 +AddReg = Neo.Reg, NeoAdapter.Ndi +CopyFiles = Neo.CopyFiles.Sys +*IfType = 53 +*MediaType = 0 +*PhysicalMediaType = 0 + +[NeoAdapter.Install.Services] +AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% + +[NeoAdapter.Ndi] +HKR, , NetworkAddress, 0, %DefaultAddress% +HKR, Ndi, DeviceID, , "NeoAdapter_VPN4" +HKR, , DevLoader, , ndis +HKR, , DeviceVxDs, , Neo6_x64_VPN4.sys +HKR, NDIS, LogDriverName, , "Neo_VPN4" +HKR, NDIS, MajorNdisVersion, 1, 5 +HKR, NDIS, MinorNdisVersion, 1, 0 +HKR, Ndi\Interfaces, DefUpper, , "ndis5" +HKR, Ndi\Interfaces, UpperRange, , "ndis5" +HKR, Ndi\Interfaces, LowerRange, , "ethernet" +HKR, Ndi\Interfaces, DefLower, , "ethernet" +HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" +HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% +HKR, Ndi\Params\NetworkAddress, type, 0, "edit" +HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" +HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" +HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% +HKR, Ndi\Params\NetworkAddress, optional, 0, "0" +HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% +HKR, Ndi\Params\MaxSpeed, type, 0, "int" +HKR, Ndi\Params\MaxSpeed, default, 0, "100" +HKR, Ndi\Params\MaxSpeed, min, 0, "0" +HKR, Ndi\Params\MaxSpeed, max, 0, "2000" +HKR, Ndi\Params\MaxSpeed, step, 0, "1" +HKR, Ndi\Params\MaxSpeed, Base, 0, "10" +HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% +HKR, Ndi\Params\KeepLink, type, 0, "enum" +HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% +HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% +HKR, Ndi\Params\KeepLink, default, 0, "0" + + +[Neo.Service] +DisplayName = %Neo.Service.DispName% +Description = %Neo.Service.Desc% +ServiceType = 1 +StartType = 3 +ErrorControl = 1 +ServiceBinary = %12%\Neo6_x64_VPN4.sys +LoadOrderGroup = NDIS + +[Neo.Reg] +HKR, Ndi, Service, 0, Neo.Service.Name +HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" +HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" + +[Neo.EventLog] +HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo6_x64_VPN4.sys" +HKR, , TypesSupported, 0x00010001, 7 + +[Strings] +CompanyName = "SoftEther Corporation" +DiskDescription = "VPN Client Device Driver Install Disk" +Neo.Service.Name = "Neo_VPN4" +Neo.Service.DispName = "VPN Client Device Driver - VPN4" +Neo.Service.Desc = "VPN Client Adapter - VPN4" +NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN4" +Neo.EventLog.Name = "Neo" +NetworkAddress = "MAC Address" +DefaultAddress = "000001000001" +MaxSpeed = "Indicate Speed (Mbps)" +KeepLink = "Keep Link" +On = "On" +Off = "Off" + + +; Auto Generated 20180205_163621.595 + diff --git a/src/bin/hamcore/DriverPackages/Neo6_Win10/x64/Neo6_x64_VPN40.inf b/src/bin/hamcore/DriverPackages/Neo6_Win10/x64/Neo6_x64_VPN40.inf index e366a37a..628e639f 100644 --- a/src/bin/hamcore/DriverPackages/Neo6_Win10/x64/Neo6_x64_VPN40.inf +++ b/src/bin/hamcore/DriverPackages/Neo6_Win10/x64/Neo6_x64_VPN40.inf @@ -1,114 +1,114 @@ -; VPN Client Device Driver for Windows 2000 and Greater -; -; Copyright (c) SoftEther Corporation. All Rights Reserved. -; http://www.softether.co.jp/ -; -; BUILD 9658 - -[Version] -Signature = "$Windows NT$" -Class = Net -ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} -Provider = %CompanyName% -DriverVer = 02/04/2018, 4.25.0.9658 -CatalogFile.NT = Neo6_x64_VPN40.cat - -[Manufacturer] -%CompanyName% = SoftEther, NTamd64 - -[SourceDisksNames] -1=%DiskDescription%, "", , - -[SourceDisksFiles] -Neo6_x64_VPN40.sys = 1 - -[DestinationDirs] -DefaultDestDir = 12 -Neo.CopyFiles.Sys = 12 - -[Neo.CopyFiles.Sys] -Neo6_x64_VPN40.sys, , , 2 - -[SoftEther.NTamd64] -%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN40 - -[NeoAdapter.Install] -Characteristics = 0x1 -AddReg = Neo.Reg, NeoAdapter.Ndi -CopyFiles = Neo.CopyFiles.Sys -*IfType = 53 -*MediaType = 0 -*PhysicalMediaType = 0 - -[NeoAdapter.Install.Services] -AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% - -[NeoAdapter.Ndi] -HKR, , NetworkAddress, 0, %DefaultAddress% -HKR, Ndi, DeviceID, , "NeoAdapter_VPN40" -HKR, , DevLoader, , ndis -HKR, , DeviceVxDs, , Neo6_x64_VPN40.sys -HKR, NDIS, LogDriverName, , "Neo_VPN40" -HKR, NDIS, MajorNdisVersion, 1, 5 -HKR, NDIS, MinorNdisVersion, 1, 0 -HKR, Ndi\Interfaces, DefUpper, , "ndis5" -HKR, Ndi\Interfaces, UpperRange, , "ndis5" -HKR, Ndi\Interfaces, LowerRange, , "ethernet" -HKR, Ndi\Interfaces, DefLower, , "ethernet" -HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" -HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% -HKR, Ndi\Params\NetworkAddress, type, 0, "edit" -HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" -HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" -HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% -HKR, Ndi\Params\NetworkAddress, optional, 0, "0" -HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% -HKR, Ndi\Params\MaxSpeed, type, 0, "int" -HKR, Ndi\Params\MaxSpeed, default, 0, "100" -HKR, Ndi\Params\MaxSpeed, min, 0, "0" -HKR, Ndi\Params\MaxSpeed, max, 0, "2000" -HKR, Ndi\Params\MaxSpeed, step, 0, "1" -HKR, Ndi\Params\MaxSpeed, Base, 0, "10" -HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% -HKR, Ndi\Params\KeepLink, type, 0, "enum" -HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% -HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% -HKR, Ndi\Params\KeepLink, default, 0, "0" - - -[Neo.Service] -DisplayName = %Neo.Service.DispName% -Description = %Neo.Service.Desc% -ServiceType = 1 -StartType = 3 -ErrorControl = 1 -ServiceBinary = %12%\Neo6_x64_VPN40.sys -LoadOrderGroup = NDIS - -[Neo.Reg] -HKR, Ndi, Service, 0, Neo.Service.Name -HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" -HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" - -[Neo.EventLog] -HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo6_x64_VPN40.sys" -HKR, , TypesSupported, 0x00010001, 7 - -[Strings] -CompanyName = "SoftEther Corporation" -DiskDescription = "VPN Client Device Driver Install Disk" -Neo.Service.Name = "Neo_VPN40" -Neo.Service.DispName = "VPN Client Device Driver - VPN40" -Neo.Service.Desc = "VPN Client Adapter - VPN40" -NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN40" -Neo.EventLog.Name = "Neo" -NetworkAddress = "MAC Address" -DefaultAddress = "000001000001" -MaxSpeed = "Indicate Speed (Mbps)" -KeepLink = "Keep Link" -On = "On" -Off = "Off" - - -; Auto Generated 20180205_163624.160 - +; VPN Client Device Driver for Windows 2000 and Greater +; +; Copyright (c) SoftEther Corporation. All Rights Reserved. +; http://www.softether.co.jp/ +; +; BUILD 9658 + +[Version] +Signature = "$Windows NT$" +Class = Net +ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} +Provider = %CompanyName% +DriverVer = 02/04/2018, 4.25.0.9658 +CatalogFile.NT = Neo6_x64_VPN40.cat + +[Manufacturer] +%CompanyName% = SoftEther, NTamd64 + +[SourceDisksNames] +1=%DiskDescription%, "", , + +[SourceDisksFiles] +Neo6_x64_VPN40.sys = 1 + +[DestinationDirs] +DefaultDestDir = 12 +Neo.CopyFiles.Sys = 12 + +[Neo.CopyFiles.Sys] +Neo6_x64_VPN40.sys, , , 2 + +[SoftEther.NTamd64] +%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN40 + +[NeoAdapter.Install] +Characteristics = 0x1 +AddReg = Neo.Reg, NeoAdapter.Ndi +CopyFiles = Neo.CopyFiles.Sys +*IfType = 53 +*MediaType = 0 +*PhysicalMediaType = 0 + +[NeoAdapter.Install.Services] +AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% + +[NeoAdapter.Ndi] +HKR, , NetworkAddress, 0, %DefaultAddress% +HKR, Ndi, DeviceID, , "NeoAdapter_VPN40" +HKR, , DevLoader, , ndis +HKR, , DeviceVxDs, , Neo6_x64_VPN40.sys +HKR, NDIS, LogDriverName, , "Neo_VPN40" +HKR, NDIS, MajorNdisVersion, 1, 5 +HKR, NDIS, MinorNdisVersion, 1, 0 +HKR, Ndi\Interfaces, DefUpper, , "ndis5" +HKR, Ndi\Interfaces, UpperRange, , "ndis5" +HKR, Ndi\Interfaces, LowerRange, , "ethernet" +HKR, Ndi\Interfaces, DefLower, , "ethernet" +HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" +HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% +HKR, Ndi\Params\NetworkAddress, type, 0, "edit" +HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" +HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" +HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% +HKR, Ndi\Params\NetworkAddress, optional, 0, "0" +HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% +HKR, Ndi\Params\MaxSpeed, type, 0, "int" +HKR, Ndi\Params\MaxSpeed, default, 0, "100" +HKR, Ndi\Params\MaxSpeed, min, 0, "0" +HKR, Ndi\Params\MaxSpeed, max, 0, "2000" +HKR, Ndi\Params\MaxSpeed, step, 0, "1" +HKR, Ndi\Params\MaxSpeed, Base, 0, "10" +HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% +HKR, Ndi\Params\KeepLink, type, 0, "enum" +HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% +HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% +HKR, Ndi\Params\KeepLink, default, 0, "0" + + +[Neo.Service] +DisplayName = %Neo.Service.DispName% +Description = %Neo.Service.Desc% +ServiceType = 1 +StartType = 3 +ErrorControl = 1 +ServiceBinary = %12%\Neo6_x64_VPN40.sys +LoadOrderGroup = NDIS + +[Neo.Reg] +HKR, Ndi, Service, 0, Neo.Service.Name +HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" +HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" + +[Neo.EventLog] +HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo6_x64_VPN40.sys" +HKR, , TypesSupported, 0x00010001, 7 + +[Strings] +CompanyName = "SoftEther Corporation" +DiskDescription = "VPN Client Device Driver Install Disk" +Neo.Service.Name = "Neo_VPN40" +Neo.Service.DispName = "VPN Client Device Driver - VPN40" +Neo.Service.Desc = "VPN Client Adapter - VPN40" +NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN40" +Neo.EventLog.Name = "Neo" +NetworkAddress = "MAC Address" +DefaultAddress = "000001000001" +MaxSpeed = "Indicate Speed (Mbps)" +KeepLink = "Keep Link" +On = "On" +Off = "Off" + + +; Auto Generated 20180205_163624.160 + diff --git a/src/bin/hamcore/DriverPackages/Neo6_Win10/x64/Neo6_x64_VPN41.inf b/src/bin/hamcore/DriverPackages/Neo6_Win10/x64/Neo6_x64_VPN41.inf index ee6cc15f..e5df63d2 100644 --- a/src/bin/hamcore/DriverPackages/Neo6_Win10/x64/Neo6_x64_VPN41.inf +++ b/src/bin/hamcore/DriverPackages/Neo6_Win10/x64/Neo6_x64_VPN41.inf @@ -1,114 +1,114 @@ -; VPN Client Device Driver for Windows 2000 and Greater -; -; Copyright (c) SoftEther Corporation. All Rights Reserved. -; http://www.softether.co.jp/ -; -; BUILD 9658 - -[Version] -Signature = "$Windows NT$" -Class = Net -ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} -Provider = %CompanyName% -DriverVer = 02/04/2018, 4.25.0.9658 -CatalogFile.NT = Neo6_x64_VPN41.cat - -[Manufacturer] -%CompanyName% = SoftEther, NTamd64 - -[SourceDisksNames] -1=%DiskDescription%, "", , - -[SourceDisksFiles] -Neo6_x64_VPN41.sys = 1 - -[DestinationDirs] -DefaultDestDir = 12 -Neo.CopyFiles.Sys = 12 - -[Neo.CopyFiles.Sys] -Neo6_x64_VPN41.sys, , , 2 - -[SoftEther.NTamd64] -%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN41 - -[NeoAdapter.Install] -Characteristics = 0x1 -AddReg = Neo.Reg, NeoAdapter.Ndi -CopyFiles = Neo.CopyFiles.Sys -*IfType = 53 -*MediaType = 0 -*PhysicalMediaType = 0 - -[NeoAdapter.Install.Services] -AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% - -[NeoAdapter.Ndi] -HKR, , NetworkAddress, 0, %DefaultAddress% -HKR, Ndi, DeviceID, , "NeoAdapter_VPN41" -HKR, , DevLoader, , ndis -HKR, , DeviceVxDs, , Neo6_x64_VPN41.sys -HKR, NDIS, LogDriverName, , "Neo_VPN41" -HKR, NDIS, MajorNdisVersion, 1, 5 -HKR, NDIS, MinorNdisVersion, 1, 0 -HKR, Ndi\Interfaces, DefUpper, , "ndis5" -HKR, Ndi\Interfaces, UpperRange, , "ndis5" -HKR, Ndi\Interfaces, LowerRange, , "ethernet" -HKR, Ndi\Interfaces, DefLower, , "ethernet" -HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" -HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% -HKR, Ndi\Params\NetworkAddress, type, 0, "edit" -HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" -HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" -HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% -HKR, Ndi\Params\NetworkAddress, optional, 0, "0" -HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% -HKR, Ndi\Params\MaxSpeed, type, 0, "int" -HKR, Ndi\Params\MaxSpeed, default, 0, "100" -HKR, Ndi\Params\MaxSpeed, min, 0, "0" -HKR, Ndi\Params\MaxSpeed, max, 0, "2000" -HKR, Ndi\Params\MaxSpeed, step, 0, "1" -HKR, Ndi\Params\MaxSpeed, Base, 0, "10" -HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% -HKR, Ndi\Params\KeepLink, type, 0, "enum" -HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% -HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% -HKR, Ndi\Params\KeepLink, default, 0, "0" - - -[Neo.Service] -DisplayName = %Neo.Service.DispName% -Description = %Neo.Service.Desc% -ServiceType = 1 -StartType = 3 -ErrorControl = 1 -ServiceBinary = %12%\Neo6_x64_VPN41.sys -LoadOrderGroup = NDIS - -[Neo.Reg] -HKR, Ndi, Service, 0, Neo.Service.Name -HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" -HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" - -[Neo.EventLog] -HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo6_x64_VPN41.sys" -HKR, , TypesSupported, 0x00010001, 7 - -[Strings] -CompanyName = "SoftEther Corporation" -DiskDescription = "VPN Client Device Driver Install Disk" -Neo.Service.Name = "Neo_VPN41" -Neo.Service.DispName = "VPN Client Device Driver - VPN41" -Neo.Service.Desc = "VPN Client Adapter - VPN41" -NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN41" -Neo.EventLog.Name = "Neo" -NetworkAddress = "MAC Address" -DefaultAddress = "000001000001" -MaxSpeed = "Indicate Speed (Mbps)" -KeepLink = "Keep Link" -On = "On" -Off = "Off" - - -; Auto Generated 20180205_163624.234 - +; VPN Client Device Driver for Windows 2000 and Greater +; +; Copyright (c) SoftEther Corporation. All Rights Reserved. +; http://www.softether.co.jp/ +; +; BUILD 9658 + +[Version] +Signature = "$Windows NT$" +Class = Net +ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} +Provider = %CompanyName% +DriverVer = 02/04/2018, 4.25.0.9658 +CatalogFile.NT = Neo6_x64_VPN41.cat + +[Manufacturer] +%CompanyName% = SoftEther, NTamd64 + +[SourceDisksNames] +1=%DiskDescription%, "", , + +[SourceDisksFiles] +Neo6_x64_VPN41.sys = 1 + +[DestinationDirs] +DefaultDestDir = 12 +Neo.CopyFiles.Sys = 12 + +[Neo.CopyFiles.Sys] +Neo6_x64_VPN41.sys, , , 2 + +[SoftEther.NTamd64] +%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN41 + +[NeoAdapter.Install] +Characteristics = 0x1 +AddReg = Neo.Reg, NeoAdapter.Ndi +CopyFiles = Neo.CopyFiles.Sys +*IfType = 53 +*MediaType = 0 +*PhysicalMediaType = 0 + +[NeoAdapter.Install.Services] +AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% + +[NeoAdapter.Ndi] +HKR, , NetworkAddress, 0, %DefaultAddress% +HKR, Ndi, DeviceID, , "NeoAdapter_VPN41" +HKR, , DevLoader, , ndis +HKR, , DeviceVxDs, , Neo6_x64_VPN41.sys +HKR, NDIS, LogDriverName, , "Neo_VPN41" +HKR, NDIS, MajorNdisVersion, 1, 5 +HKR, NDIS, MinorNdisVersion, 1, 0 +HKR, Ndi\Interfaces, DefUpper, , "ndis5" +HKR, Ndi\Interfaces, UpperRange, , "ndis5" +HKR, Ndi\Interfaces, LowerRange, , "ethernet" +HKR, Ndi\Interfaces, DefLower, , "ethernet" +HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" +HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% +HKR, Ndi\Params\NetworkAddress, type, 0, "edit" +HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" +HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" +HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% +HKR, Ndi\Params\NetworkAddress, optional, 0, "0" +HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% +HKR, Ndi\Params\MaxSpeed, type, 0, "int" +HKR, Ndi\Params\MaxSpeed, default, 0, "100" +HKR, Ndi\Params\MaxSpeed, min, 0, "0" +HKR, Ndi\Params\MaxSpeed, max, 0, "2000" +HKR, Ndi\Params\MaxSpeed, step, 0, "1" +HKR, Ndi\Params\MaxSpeed, Base, 0, "10" +HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% +HKR, Ndi\Params\KeepLink, type, 0, "enum" +HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% +HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% +HKR, Ndi\Params\KeepLink, default, 0, "0" + + +[Neo.Service] +DisplayName = %Neo.Service.DispName% +Description = %Neo.Service.Desc% +ServiceType = 1 +StartType = 3 +ErrorControl = 1 +ServiceBinary = %12%\Neo6_x64_VPN41.sys +LoadOrderGroup = NDIS + +[Neo.Reg] +HKR, Ndi, Service, 0, Neo.Service.Name +HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" +HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" + +[Neo.EventLog] +HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo6_x64_VPN41.sys" +HKR, , TypesSupported, 0x00010001, 7 + +[Strings] +CompanyName = "SoftEther Corporation" +DiskDescription = "VPN Client Device Driver Install Disk" +Neo.Service.Name = "Neo_VPN41" +Neo.Service.DispName = "VPN Client Device Driver - VPN41" +Neo.Service.Desc = "VPN Client Adapter - VPN41" +NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN41" +Neo.EventLog.Name = "Neo" +NetworkAddress = "MAC Address" +DefaultAddress = "000001000001" +MaxSpeed = "Indicate Speed (Mbps)" +KeepLink = "Keep Link" +On = "On" +Off = "Off" + + +; Auto Generated 20180205_163624.234 + diff --git a/src/bin/hamcore/DriverPackages/Neo6_Win10/x64/Neo6_x64_VPN42.inf b/src/bin/hamcore/DriverPackages/Neo6_Win10/x64/Neo6_x64_VPN42.inf index b89ce360..6d58513d 100644 --- a/src/bin/hamcore/DriverPackages/Neo6_Win10/x64/Neo6_x64_VPN42.inf +++ b/src/bin/hamcore/DriverPackages/Neo6_Win10/x64/Neo6_x64_VPN42.inf @@ -1,114 +1,114 @@ -; VPN Client Device Driver for Windows 2000 and Greater -; -; Copyright (c) SoftEther Corporation. All Rights Reserved. -; http://www.softether.co.jp/ -; -; BUILD 9658 - -[Version] -Signature = "$Windows NT$" -Class = Net -ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} -Provider = %CompanyName% -DriverVer = 02/04/2018, 4.25.0.9658 -CatalogFile.NT = Neo6_x64_VPN42.cat - -[Manufacturer] -%CompanyName% = SoftEther, NTamd64 - -[SourceDisksNames] -1=%DiskDescription%, "", , - -[SourceDisksFiles] -Neo6_x64_VPN42.sys = 1 - -[DestinationDirs] -DefaultDestDir = 12 -Neo.CopyFiles.Sys = 12 - -[Neo.CopyFiles.Sys] -Neo6_x64_VPN42.sys, , , 2 - -[SoftEther.NTamd64] -%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN42 - -[NeoAdapter.Install] -Characteristics = 0x1 -AddReg = Neo.Reg, NeoAdapter.Ndi -CopyFiles = Neo.CopyFiles.Sys -*IfType = 53 -*MediaType = 0 -*PhysicalMediaType = 0 - -[NeoAdapter.Install.Services] -AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% - -[NeoAdapter.Ndi] -HKR, , NetworkAddress, 0, %DefaultAddress% -HKR, Ndi, DeviceID, , "NeoAdapter_VPN42" -HKR, , DevLoader, , ndis -HKR, , DeviceVxDs, , Neo6_x64_VPN42.sys -HKR, NDIS, LogDriverName, , "Neo_VPN42" -HKR, NDIS, MajorNdisVersion, 1, 5 -HKR, NDIS, MinorNdisVersion, 1, 0 -HKR, Ndi\Interfaces, DefUpper, , "ndis5" -HKR, Ndi\Interfaces, UpperRange, , "ndis5" -HKR, Ndi\Interfaces, LowerRange, , "ethernet" -HKR, Ndi\Interfaces, DefLower, , "ethernet" -HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" -HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% -HKR, Ndi\Params\NetworkAddress, type, 0, "edit" -HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" -HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" -HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% -HKR, Ndi\Params\NetworkAddress, optional, 0, "0" -HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% -HKR, Ndi\Params\MaxSpeed, type, 0, "int" -HKR, Ndi\Params\MaxSpeed, default, 0, "100" -HKR, Ndi\Params\MaxSpeed, min, 0, "0" -HKR, Ndi\Params\MaxSpeed, max, 0, "2000" -HKR, Ndi\Params\MaxSpeed, step, 0, "1" -HKR, Ndi\Params\MaxSpeed, Base, 0, "10" -HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% -HKR, Ndi\Params\KeepLink, type, 0, "enum" -HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% -HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% -HKR, Ndi\Params\KeepLink, default, 0, "0" - - -[Neo.Service] -DisplayName = %Neo.Service.DispName% -Description = %Neo.Service.Desc% -ServiceType = 1 -StartType = 3 -ErrorControl = 1 -ServiceBinary = %12%\Neo6_x64_VPN42.sys -LoadOrderGroup = NDIS - -[Neo.Reg] -HKR, Ndi, Service, 0, Neo.Service.Name -HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" -HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" - -[Neo.EventLog] -HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo6_x64_VPN42.sys" -HKR, , TypesSupported, 0x00010001, 7 - -[Strings] -CompanyName = "SoftEther Corporation" -DiskDescription = "VPN Client Device Driver Install Disk" -Neo.Service.Name = "Neo_VPN42" -Neo.Service.DispName = "VPN Client Device Driver - VPN42" -Neo.Service.Desc = "VPN Client Adapter - VPN42" -NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN42" -Neo.EventLog.Name = "Neo" -NetworkAddress = "MAC Address" -DefaultAddress = "000001000001" -MaxSpeed = "Indicate Speed (Mbps)" -KeepLink = "Keep Link" -On = "On" -Off = "Off" - - -; Auto Generated 20180205_163624.305 - +; VPN Client Device Driver for Windows 2000 and Greater +; +; Copyright (c) SoftEther Corporation. All Rights Reserved. +; http://www.softether.co.jp/ +; +; BUILD 9658 + +[Version] +Signature = "$Windows NT$" +Class = Net +ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} +Provider = %CompanyName% +DriverVer = 02/04/2018, 4.25.0.9658 +CatalogFile.NT = Neo6_x64_VPN42.cat + +[Manufacturer] +%CompanyName% = SoftEther, NTamd64 + +[SourceDisksNames] +1=%DiskDescription%, "", , + +[SourceDisksFiles] +Neo6_x64_VPN42.sys = 1 + +[DestinationDirs] +DefaultDestDir = 12 +Neo.CopyFiles.Sys = 12 + +[Neo.CopyFiles.Sys] +Neo6_x64_VPN42.sys, , , 2 + +[SoftEther.NTamd64] +%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN42 + +[NeoAdapter.Install] +Characteristics = 0x1 +AddReg = Neo.Reg, NeoAdapter.Ndi +CopyFiles = Neo.CopyFiles.Sys +*IfType = 53 +*MediaType = 0 +*PhysicalMediaType = 0 + +[NeoAdapter.Install.Services] +AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% + +[NeoAdapter.Ndi] +HKR, , NetworkAddress, 0, %DefaultAddress% +HKR, Ndi, DeviceID, , "NeoAdapter_VPN42" +HKR, , DevLoader, , ndis +HKR, , DeviceVxDs, , Neo6_x64_VPN42.sys +HKR, NDIS, LogDriverName, , "Neo_VPN42" +HKR, NDIS, MajorNdisVersion, 1, 5 +HKR, NDIS, MinorNdisVersion, 1, 0 +HKR, Ndi\Interfaces, DefUpper, , "ndis5" +HKR, Ndi\Interfaces, UpperRange, , "ndis5" +HKR, Ndi\Interfaces, LowerRange, , "ethernet" +HKR, Ndi\Interfaces, DefLower, , "ethernet" +HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" +HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% +HKR, Ndi\Params\NetworkAddress, type, 0, "edit" +HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" +HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" +HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% +HKR, Ndi\Params\NetworkAddress, optional, 0, "0" +HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% +HKR, Ndi\Params\MaxSpeed, type, 0, "int" +HKR, Ndi\Params\MaxSpeed, default, 0, "100" +HKR, Ndi\Params\MaxSpeed, min, 0, "0" +HKR, Ndi\Params\MaxSpeed, max, 0, "2000" +HKR, Ndi\Params\MaxSpeed, step, 0, "1" +HKR, Ndi\Params\MaxSpeed, Base, 0, "10" +HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% +HKR, Ndi\Params\KeepLink, type, 0, "enum" +HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% +HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% +HKR, Ndi\Params\KeepLink, default, 0, "0" + + +[Neo.Service] +DisplayName = %Neo.Service.DispName% +Description = %Neo.Service.Desc% +ServiceType = 1 +StartType = 3 +ErrorControl = 1 +ServiceBinary = %12%\Neo6_x64_VPN42.sys +LoadOrderGroup = NDIS + +[Neo.Reg] +HKR, Ndi, Service, 0, Neo.Service.Name +HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" +HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" + +[Neo.EventLog] +HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo6_x64_VPN42.sys" +HKR, , TypesSupported, 0x00010001, 7 + +[Strings] +CompanyName = "SoftEther Corporation" +DiskDescription = "VPN Client Device Driver Install Disk" +Neo.Service.Name = "Neo_VPN42" +Neo.Service.DispName = "VPN Client Device Driver - VPN42" +Neo.Service.Desc = "VPN Client Adapter - VPN42" +NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN42" +Neo.EventLog.Name = "Neo" +NetworkAddress = "MAC Address" +DefaultAddress = "000001000001" +MaxSpeed = "Indicate Speed (Mbps)" +KeepLink = "Keep Link" +On = "On" +Off = "Off" + + +; Auto Generated 20180205_163624.305 + diff --git a/src/bin/hamcore/DriverPackages/Neo6_Win10/x64/Neo6_x64_VPN43.inf b/src/bin/hamcore/DriverPackages/Neo6_Win10/x64/Neo6_x64_VPN43.inf index ffcdb9e3..2804d69e 100644 --- a/src/bin/hamcore/DriverPackages/Neo6_Win10/x64/Neo6_x64_VPN43.inf +++ b/src/bin/hamcore/DriverPackages/Neo6_Win10/x64/Neo6_x64_VPN43.inf @@ -1,114 +1,114 @@ -; VPN Client Device Driver for Windows 2000 and Greater -; -; Copyright (c) SoftEther Corporation. All Rights Reserved. -; http://www.softether.co.jp/ -; -; BUILD 9658 - -[Version] -Signature = "$Windows NT$" -Class = Net -ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} -Provider = %CompanyName% -DriverVer = 02/04/2018, 4.25.0.9658 -CatalogFile.NT = Neo6_x64_VPN43.cat - -[Manufacturer] -%CompanyName% = SoftEther, NTamd64 - -[SourceDisksNames] -1=%DiskDescription%, "", , - -[SourceDisksFiles] -Neo6_x64_VPN43.sys = 1 - -[DestinationDirs] -DefaultDestDir = 12 -Neo.CopyFiles.Sys = 12 - -[Neo.CopyFiles.Sys] -Neo6_x64_VPN43.sys, , , 2 - -[SoftEther.NTamd64] -%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN43 - -[NeoAdapter.Install] -Characteristics = 0x1 -AddReg = Neo.Reg, NeoAdapter.Ndi -CopyFiles = Neo.CopyFiles.Sys -*IfType = 53 -*MediaType = 0 -*PhysicalMediaType = 0 - -[NeoAdapter.Install.Services] -AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% - -[NeoAdapter.Ndi] -HKR, , NetworkAddress, 0, %DefaultAddress% -HKR, Ndi, DeviceID, , "NeoAdapter_VPN43" -HKR, , DevLoader, , ndis -HKR, , DeviceVxDs, , Neo6_x64_VPN43.sys -HKR, NDIS, LogDriverName, , "Neo_VPN43" -HKR, NDIS, MajorNdisVersion, 1, 5 -HKR, NDIS, MinorNdisVersion, 1, 0 -HKR, Ndi\Interfaces, DefUpper, , "ndis5" -HKR, Ndi\Interfaces, UpperRange, , "ndis5" -HKR, Ndi\Interfaces, LowerRange, , "ethernet" -HKR, Ndi\Interfaces, DefLower, , "ethernet" -HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" -HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% -HKR, Ndi\Params\NetworkAddress, type, 0, "edit" -HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" -HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" -HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% -HKR, Ndi\Params\NetworkAddress, optional, 0, "0" -HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% -HKR, Ndi\Params\MaxSpeed, type, 0, "int" -HKR, Ndi\Params\MaxSpeed, default, 0, "100" -HKR, Ndi\Params\MaxSpeed, min, 0, "0" -HKR, Ndi\Params\MaxSpeed, max, 0, "2000" -HKR, Ndi\Params\MaxSpeed, step, 0, "1" -HKR, Ndi\Params\MaxSpeed, Base, 0, "10" -HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% -HKR, Ndi\Params\KeepLink, type, 0, "enum" -HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% -HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% -HKR, Ndi\Params\KeepLink, default, 0, "0" - - -[Neo.Service] -DisplayName = %Neo.Service.DispName% -Description = %Neo.Service.Desc% -ServiceType = 1 -StartType = 3 -ErrorControl = 1 -ServiceBinary = %12%\Neo6_x64_VPN43.sys -LoadOrderGroup = NDIS - -[Neo.Reg] -HKR, Ndi, Service, 0, Neo.Service.Name -HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" -HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" - -[Neo.EventLog] -HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo6_x64_VPN43.sys" -HKR, , TypesSupported, 0x00010001, 7 - -[Strings] -CompanyName = "SoftEther Corporation" -DiskDescription = "VPN Client Device Driver Install Disk" -Neo.Service.Name = "Neo_VPN43" -Neo.Service.DispName = "VPN Client Device Driver - VPN43" -Neo.Service.Desc = "VPN Client Adapter - VPN43" -NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN43" -Neo.EventLog.Name = "Neo" -NetworkAddress = "MAC Address" -DefaultAddress = "000001000001" -MaxSpeed = "Indicate Speed (Mbps)" -KeepLink = "Keep Link" -On = "On" -Off = "Off" - - -; Auto Generated 20180205_163624.377 - +; VPN Client Device Driver for Windows 2000 and Greater +; +; Copyright (c) SoftEther Corporation. All Rights Reserved. +; http://www.softether.co.jp/ +; +; BUILD 9658 + +[Version] +Signature = "$Windows NT$" +Class = Net +ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} +Provider = %CompanyName% +DriverVer = 02/04/2018, 4.25.0.9658 +CatalogFile.NT = Neo6_x64_VPN43.cat + +[Manufacturer] +%CompanyName% = SoftEther, NTamd64 + +[SourceDisksNames] +1=%DiskDescription%, "", , + +[SourceDisksFiles] +Neo6_x64_VPN43.sys = 1 + +[DestinationDirs] +DefaultDestDir = 12 +Neo.CopyFiles.Sys = 12 + +[Neo.CopyFiles.Sys] +Neo6_x64_VPN43.sys, , , 2 + +[SoftEther.NTamd64] +%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN43 + +[NeoAdapter.Install] +Characteristics = 0x1 +AddReg = Neo.Reg, NeoAdapter.Ndi +CopyFiles = Neo.CopyFiles.Sys +*IfType = 53 +*MediaType = 0 +*PhysicalMediaType = 0 + +[NeoAdapter.Install.Services] +AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% + +[NeoAdapter.Ndi] +HKR, , NetworkAddress, 0, %DefaultAddress% +HKR, Ndi, DeviceID, , "NeoAdapter_VPN43" +HKR, , DevLoader, , ndis +HKR, , DeviceVxDs, , Neo6_x64_VPN43.sys +HKR, NDIS, LogDriverName, , "Neo_VPN43" +HKR, NDIS, MajorNdisVersion, 1, 5 +HKR, NDIS, MinorNdisVersion, 1, 0 +HKR, Ndi\Interfaces, DefUpper, , "ndis5" +HKR, Ndi\Interfaces, UpperRange, , "ndis5" +HKR, Ndi\Interfaces, LowerRange, , "ethernet" +HKR, Ndi\Interfaces, DefLower, , "ethernet" +HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" +HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% +HKR, Ndi\Params\NetworkAddress, type, 0, "edit" +HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" +HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" +HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% +HKR, Ndi\Params\NetworkAddress, optional, 0, "0" +HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% +HKR, Ndi\Params\MaxSpeed, type, 0, "int" +HKR, Ndi\Params\MaxSpeed, default, 0, "100" +HKR, Ndi\Params\MaxSpeed, min, 0, "0" +HKR, Ndi\Params\MaxSpeed, max, 0, "2000" +HKR, Ndi\Params\MaxSpeed, step, 0, "1" +HKR, Ndi\Params\MaxSpeed, Base, 0, "10" +HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% +HKR, Ndi\Params\KeepLink, type, 0, "enum" +HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% +HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% +HKR, Ndi\Params\KeepLink, default, 0, "0" + + +[Neo.Service] +DisplayName = %Neo.Service.DispName% +Description = %Neo.Service.Desc% +ServiceType = 1 +StartType = 3 +ErrorControl = 1 +ServiceBinary = %12%\Neo6_x64_VPN43.sys +LoadOrderGroup = NDIS + +[Neo.Reg] +HKR, Ndi, Service, 0, Neo.Service.Name +HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" +HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" + +[Neo.EventLog] +HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo6_x64_VPN43.sys" +HKR, , TypesSupported, 0x00010001, 7 + +[Strings] +CompanyName = "SoftEther Corporation" +DiskDescription = "VPN Client Device Driver Install Disk" +Neo.Service.Name = "Neo_VPN43" +Neo.Service.DispName = "VPN Client Device Driver - VPN43" +Neo.Service.Desc = "VPN Client Adapter - VPN43" +NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN43" +Neo.EventLog.Name = "Neo" +NetworkAddress = "MAC Address" +DefaultAddress = "000001000001" +MaxSpeed = "Indicate Speed (Mbps)" +KeepLink = "Keep Link" +On = "On" +Off = "Off" + + +; Auto Generated 20180205_163624.377 + diff --git a/src/bin/hamcore/DriverPackages/Neo6_Win10/x64/Neo6_x64_VPN44.inf b/src/bin/hamcore/DriverPackages/Neo6_Win10/x64/Neo6_x64_VPN44.inf index fb701f8a..c4c84d9e 100644 --- a/src/bin/hamcore/DriverPackages/Neo6_Win10/x64/Neo6_x64_VPN44.inf +++ b/src/bin/hamcore/DriverPackages/Neo6_Win10/x64/Neo6_x64_VPN44.inf @@ -1,114 +1,114 @@ -; VPN Client Device Driver for Windows 2000 and Greater -; -; Copyright (c) SoftEther Corporation. All Rights Reserved. -; http://www.softether.co.jp/ -; -; BUILD 9658 - -[Version] -Signature = "$Windows NT$" -Class = Net -ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} -Provider = %CompanyName% -DriverVer = 02/04/2018, 4.25.0.9658 -CatalogFile.NT = Neo6_x64_VPN44.cat - -[Manufacturer] -%CompanyName% = SoftEther, NTamd64 - -[SourceDisksNames] -1=%DiskDescription%, "", , - -[SourceDisksFiles] -Neo6_x64_VPN44.sys = 1 - -[DestinationDirs] -DefaultDestDir = 12 -Neo.CopyFiles.Sys = 12 - -[Neo.CopyFiles.Sys] -Neo6_x64_VPN44.sys, , , 2 - -[SoftEther.NTamd64] -%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN44 - -[NeoAdapter.Install] -Characteristics = 0x1 -AddReg = Neo.Reg, NeoAdapter.Ndi -CopyFiles = Neo.CopyFiles.Sys -*IfType = 53 -*MediaType = 0 -*PhysicalMediaType = 0 - -[NeoAdapter.Install.Services] -AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% - -[NeoAdapter.Ndi] -HKR, , NetworkAddress, 0, %DefaultAddress% -HKR, Ndi, DeviceID, , "NeoAdapter_VPN44" -HKR, , DevLoader, , ndis -HKR, , DeviceVxDs, , Neo6_x64_VPN44.sys -HKR, NDIS, LogDriverName, , "Neo_VPN44" -HKR, NDIS, MajorNdisVersion, 1, 5 -HKR, NDIS, MinorNdisVersion, 1, 0 -HKR, Ndi\Interfaces, DefUpper, , "ndis5" -HKR, Ndi\Interfaces, UpperRange, , "ndis5" -HKR, Ndi\Interfaces, LowerRange, , "ethernet" -HKR, Ndi\Interfaces, DefLower, , "ethernet" -HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" -HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% -HKR, Ndi\Params\NetworkAddress, type, 0, "edit" -HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" -HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" -HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% -HKR, Ndi\Params\NetworkAddress, optional, 0, "0" -HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% -HKR, Ndi\Params\MaxSpeed, type, 0, "int" -HKR, Ndi\Params\MaxSpeed, default, 0, "100" -HKR, Ndi\Params\MaxSpeed, min, 0, "0" -HKR, Ndi\Params\MaxSpeed, max, 0, "2000" -HKR, Ndi\Params\MaxSpeed, step, 0, "1" -HKR, Ndi\Params\MaxSpeed, Base, 0, "10" -HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% -HKR, Ndi\Params\KeepLink, type, 0, "enum" -HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% -HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% -HKR, Ndi\Params\KeepLink, default, 0, "0" - - -[Neo.Service] -DisplayName = %Neo.Service.DispName% -Description = %Neo.Service.Desc% -ServiceType = 1 -StartType = 3 -ErrorControl = 1 -ServiceBinary = %12%\Neo6_x64_VPN44.sys -LoadOrderGroup = NDIS - -[Neo.Reg] -HKR, Ndi, Service, 0, Neo.Service.Name -HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" -HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" - -[Neo.EventLog] -HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo6_x64_VPN44.sys" -HKR, , TypesSupported, 0x00010001, 7 - -[Strings] -CompanyName = "SoftEther Corporation" -DiskDescription = "VPN Client Device Driver Install Disk" -Neo.Service.Name = "Neo_VPN44" -Neo.Service.DispName = "VPN Client Device Driver - VPN44" -Neo.Service.Desc = "VPN Client Adapter - VPN44" -NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN44" -Neo.EventLog.Name = "Neo" -NetworkAddress = "MAC Address" -DefaultAddress = "000001000001" -MaxSpeed = "Indicate Speed (Mbps)" -KeepLink = "Keep Link" -On = "On" -Off = "Off" - - -; Auto Generated 20180205_163624.452 - +; VPN Client Device Driver for Windows 2000 and Greater +; +; Copyright (c) SoftEther Corporation. All Rights Reserved. +; http://www.softether.co.jp/ +; +; BUILD 9658 + +[Version] +Signature = "$Windows NT$" +Class = Net +ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} +Provider = %CompanyName% +DriverVer = 02/04/2018, 4.25.0.9658 +CatalogFile.NT = Neo6_x64_VPN44.cat + +[Manufacturer] +%CompanyName% = SoftEther, NTamd64 + +[SourceDisksNames] +1=%DiskDescription%, "", , + +[SourceDisksFiles] +Neo6_x64_VPN44.sys = 1 + +[DestinationDirs] +DefaultDestDir = 12 +Neo.CopyFiles.Sys = 12 + +[Neo.CopyFiles.Sys] +Neo6_x64_VPN44.sys, , , 2 + +[SoftEther.NTamd64] +%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN44 + +[NeoAdapter.Install] +Characteristics = 0x1 +AddReg = Neo.Reg, NeoAdapter.Ndi +CopyFiles = Neo.CopyFiles.Sys +*IfType = 53 +*MediaType = 0 +*PhysicalMediaType = 0 + +[NeoAdapter.Install.Services] +AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% + +[NeoAdapter.Ndi] +HKR, , NetworkAddress, 0, %DefaultAddress% +HKR, Ndi, DeviceID, , "NeoAdapter_VPN44" +HKR, , DevLoader, , ndis +HKR, , DeviceVxDs, , Neo6_x64_VPN44.sys +HKR, NDIS, LogDriverName, , "Neo_VPN44" +HKR, NDIS, MajorNdisVersion, 1, 5 +HKR, NDIS, MinorNdisVersion, 1, 0 +HKR, Ndi\Interfaces, DefUpper, , "ndis5" +HKR, Ndi\Interfaces, UpperRange, , "ndis5" +HKR, Ndi\Interfaces, LowerRange, , "ethernet" +HKR, Ndi\Interfaces, DefLower, , "ethernet" +HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" +HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% +HKR, Ndi\Params\NetworkAddress, type, 0, "edit" +HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" +HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" +HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% +HKR, Ndi\Params\NetworkAddress, optional, 0, "0" +HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% +HKR, Ndi\Params\MaxSpeed, type, 0, "int" +HKR, Ndi\Params\MaxSpeed, default, 0, "100" +HKR, Ndi\Params\MaxSpeed, min, 0, "0" +HKR, Ndi\Params\MaxSpeed, max, 0, "2000" +HKR, Ndi\Params\MaxSpeed, step, 0, "1" +HKR, Ndi\Params\MaxSpeed, Base, 0, "10" +HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% +HKR, Ndi\Params\KeepLink, type, 0, "enum" +HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% +HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% +HKR, Ndi\Params\KeepLink, default, 0, "0" + + +[Neo.Service] +DisplayName = %Neo.Service.DispName% +Description = %Neo.Service.Desc% +ServiceType = 1 +StartType = 3 +ErrorControl = 1 +ServiceBinary = %12%\Neo6_x64_VPN44.sys +LoadOrderGroup = NDIS + +[Neo.Reg] +HKR, Ndi, Service, 0, Neo.Service.Name +HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" +HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" + +[Neo.EventLog] +HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo6_x64_VPN44.sys" +HKR, , TypesSupported, 0x00010001, 7 + +[Strings] +CompanyName = "SoftEther Corporation" +DiskDescription = "VPN Client Device Driver Install Disk" +Neo.Service.Name = "Neo_VPN44" +Neo.Service.DispName = "VPN Client Device Driver - VPN44" +Neo.Service.Desc = "VPN Client Adapter - VPN44" +NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN44" +Neo.EventLog.Name = "Neo" +NetworkAddress = "MAC Address" +DefaultAddress = "000001000001" +MaxSpeed = "Indicate Speed (Mbps)" +KeepLink = "Keep Link" +On = "On" +Off = "Off" + + +; Auto Generated 20180205_163624.452 + diff --git a/src/bin/hamcore/DriverPackages/Neo6_Win10/x64/Neo6_x64_VPN45.inf b/src/bin/hamcore/DriverPackages/Neo6_Win10/x64/Neo6_x64_VPN45.inf index 1c313a5e..41327a4a 100644 --- a/src/bin/hamcore/DriverPackages/Neo6_Win10/x64/Neo6_x64_VPN45.inf +++ b/src/bin/hamcore/DriverPackages/Neo6_Win10/x64/Neo6_x64_VPN45.inf @@ -1,114 +1,114 @@ -; VPN Client Device Driver for Windows 2000 and Greater -; -; Copyright (c) SoftEther Corporation. All Rights Reserved. -; http://www.softether.co.jp/ -; -; BUILD 9658 - -[Version] -Signature = "$Windows NT$" -Class = Net -ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} -Provider = %CompanyName% -DriverVer = 02/04/2018, 4.25.0.9658 -CatalogFile.NT = Neo6_x64_VPN45.cat - -[Manufacturer] -%CompanyName% = SoftEther, NTamd64 - -[SourceDisksNames] -1=%DiskDescription%, "", , - -[SourceDisksFiles] -Neo6_x64_VPN45.sys = 1 - -[DestinationDirs] -DefaultDestDir = 12 -Neo.CopyFiles.Sys = 12 - -[Neo.CopyFiles.Sys] -Neo6_x64_VPN45.sys, , , 2 - -[SoftEther.NTamd64] -%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN45 - -[NeoAdapter.Install] -Characteristics = 0x1 -AddReg = Neo.Reg, NeoAdapter.Ndi -CopyFiles = Neo.CopyFiles.Sys -*IfType = 53 -*MediaType = 0 -*PhysicalMediaType = 0 - -[NeoAdapter.Install.Services] -AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% - -[NeoAdapter.Ndi] -HKR, , NetworkAddress, 0, %DefaultAddress% -HKR, Ndi, DeviceID, , "NeoAdapter_VPN45" -HKR, , DevLoader, , ndis -HKR, , DeviceVxDs, , Neo6_x64_VPN45.sys -HKR, NDIS, LogDriverName, , "Neo_VPN45" -HKR, NDIS, MajorNdisVersion, 1, 5 -HKR, NDIS, MinorNdisVersion, 1, 0 -HKR, Ndi\Interfaces, DefUpper, , "ndis5" -HKR, Ndi\Interfaces, UpperRange, , "ndis5" -HKR, Ndi\Interfaces, LowerRange, , "ethernet" -HKR, Ndi\Interfaces, DefLower, , "ethernet" -HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" -HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% -HKR, Ndi\Params\NetworkAddress, type, 0, "edit" -HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" -HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" -HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% -HKR, Ndi\Params\NetworkAddress, optional, 0, "0" -HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% -HKR, Ndi\Params\MaxSpeed, type, 0, "int" -HKR, Ndi\Params\MaxSpeed, default, 0, "100" -HKR, Ndi\Params\MaxSpeed, min, 0, "0" -HKR, Ndi\Params\MaxSpeed, max, 0, "2000" -HKR, Ndi\Params\MaxSpeed, step, 0, "1" -HKR, Ndi\Params\MaxSpeed, Base, 0, "10" -HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% -HKR, Ndi\Params\KeepLink, type, 0, "enum" -HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% -HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% -HKR, Ndi\Params\KeepLink, default, 0, "0" - - -[Neo.Service] -DisplayName = %Neo.Service.DispName% -Description = %Neo.Service.Desc% -ServiceType = 1 -StartType = 3 -ErrorControl = 1 -ServiceBinary = %12%\Neo6_x64_VPN45.sys -LoadOrderGroup = NDIS - -[Neo.Reg] -HKR, Ndi, Service, 0, Neo.Service.Name -HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" -HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" - -[Neo.EventLog] -HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo6_x64_VPN45.sys" -HKR, , TypesSupported, 0x00010001, 7 - -[Strings] -CompanyName = "SoftEther Corporation" -DiskDescription = "VPN Client Device Driver Install Disk" -Neo.Service.Name = "Neo_VPN45" -Neo.Service.DispName = "VPN Client Device Driver - VPN45" -Neo.Service.Desc = "VPN Client Adapter - VPN45" -NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN45" -Neo.EventLog.Name = "Neo" -NetworkAddress = "MAC Address" -DefaultAddress = "000001000001" -MaxSpeed = "Indicate Speed (Mbps)" -KeepLink = "Keep Link" -On = "On" -Off = "Off" - - -; Auto Generated 20180205_163624.523 - +; VPN Client Device Driver for Windows 2000 and Greater +; +; Copyright (c) SoftEther Corporation. All Rights Reserved. +; http://www.softether.co.jp/ +; +; BUILD 9658 + +[Version] +Signature = "$Windows NT$" +Class = Net +ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} +Provider = %CompanyName% +DriverVer = 02/04/2018, 4.25.0.9658 +CatalogFile.NT = Neo6_x64_VPN45.cat + +[Manufacturer] +%CompanyName% = SoftEther, NTamd64 + +[SourceDisksNames] +1=%DiskDescription%, "", , + +[SourceDisksFiles] +Neo6_x64_VPN45.sys = 1 + +[DestinationDirs] +DefaultDestDir = 12 +Neo.CopyFiles.Sys = 12 + +[Neo.CopyFiles.Sys] +Neo6_x64_VPN45.sys, , , 2 + +[SoftEther.NTamd64] +%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN45 + +[NeoAdapter.Install] +Characteristics = 0x1 +AddReg = Neo.Reg, NeoAdapter.Ndi +CopyFiles = Neo.CopyFiles.Sys +*IfType = 53 +*MediaType = 0 +*PhysicalMediaType = 0 + +[NeoAdapter.Install.Services] +AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% + +[NeoAdapter.Ndi] +HKR, , NetworkAddress, 0, %DefaultAddress% +HKR, Ndi, DeviceID, , "NeoAdapter_VPN45" +HKR, , DevLoader, , ndis +HKR, , DeviceVxDs, , Neo6_x64_VPN45.sys +HKR, NDIS, LogDriverName, , "Neo_VPN45" +HKR, NDIS, MajorNdisVersion, 1, 5 +HKR, NDIS, MinorNdisVersion, 1, 0 +HKR, Ndi\Interfaces, DefUpper, , "ndis5" +HKR, Ndi\Interfaces, UpperRange, , "ndis5" +HKR, Ndi\Interfaces, LowerRange, , "ethernet" +HKR, Ndi\Interfaces, DefLower, , "ethernet" +HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" +HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% +HKR, Ndi\Params\NetworkAddress, type, 0, "edit" +HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" +HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" +HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% +HKR, Ndi\Params\NetworkAddress, optional, 0, "0" +HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% +HKR, Ndi\Params\MaxSpeed, type, 0, "int" +HKR, Ndi\Params\MaxSpeed, default, 0, "100" +HKR, Ndi\Params\MaxSpeed, min, 0, "0" +HKR, Ndi\Params\MaxSpeed, max, 0, "2000" +HKR, Ndi\Params\MaxSpeed, step, 0, "1" +HKR, Ndi\Params\MaxSpeed, Base, 0, "10" +HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% +HKR, Ndi\Params\KeepLink, type, 0, "enum" +HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% +HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% +HKR, Ndi\Params\KeepLink, default, 0, "0" + + +[Neo.Service] +DisplayName = %Neo.Service.DispName% +Description = %Neo.Service.Desc% +ServiceType = 1 +StartType = 3 +ErrorControl = 1 +ServiceBinary = %12%\Neo6_x64_VPN45.sys +LoadOrderGroup = NDIS + +[Neo.Reg] +HKR, Ndi, Service, 0, Neo.Service.Name +HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" +HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" + +[Neo.EventLog] +HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo6_x64_VPN45.sys" +HKR, , TypesSupported, 0x00010001, 7 + +[Strings] +CompanyName = "SoftEther Corporation" +DiskDescription = "VPN Client Device Driver Install Disk" +Neo.Service.Name = "Neo_VPN45" +Neo.Service.DispName = "VPN Client Device Driver - VPN45" +Neo.Service.Desc = "VPN Client Adapter - VPN45" +NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN45" +Neo.EventLog.Name = "Neo" +NetworkAddress = "MAC Address" +DefaultAddress = "000001000001" +MaxSpeed = "Indicate Speed (Mbps)" +KeepLink = "Keep Link" +On = "On" +Off = "Off" + + +; Auto Generated 20180205_163624.523 + diff --git a/src/bin/hamcore/DriverPackages/Neo6_Win10/x64/Neo6_x64_VPN46.inf b/src/bin/hamcore/DriverPackages/Neo6_Win10/x64/Neo6_x64_VPN46.inf index 1399aab2..55eec2e2 100644 --- a/src/bin/hamcore/DriverPackages/Neo6_Win10/x64/Neo6_x64_VPN46.inf +++ b/src/bin/hamcore/DriverPackages/Neo6_Win10/x64/Neo6_x64_VPN46.inf @@ -1,114 +1,114 @@ -; VPN Client Device Driver for Windows 2000 and Greater -; -; Copyright (c) SoftEther Corporation. All Rights Reserved. -; http://www.softether.co.jp/ -; -; BUILD 9658 - -[Version] -Signature = "$Windows NT$" -Class = Net -ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} -Provider = %CompanyName% -DriverVer = 02/04/2018, 4.25.0.9658 -CatalogFile.NT = Neo6_x64_VPN46.cat - -[Manufacturer] -%CompanyName% = SoftEther, NTamd64 - -[SourceDisksNames] -1=%DiskDescription%, "", , - -[SourceDisksFiles] -Neo6_x64_VPN46.sys = 1 - -[DestinationDirs] -DefaultDestDir = 12 -Neo.CopyFiles.Sys = 12 - -[Neo.CopyFiles.Sys] -Neo6_x64_VPN46.sys, , , 2 - -[SoftEther.NTamd64] -%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN46 - -[NeoAdapter.Install] -Characteristics = 0x1 -AddReg = Neo.Reg, NeoAdapter.Ndi -CopyFiles = Neo.CopyFiles.Sys -*IfType = 53 -*MediaType = 0 -*PhysicalMediaType = 0 - -[NeoAdapter.Install.Services] -AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% - -[NeoAdapter.Ndi] -HKR, , NetworkAddress, 0, %DefaultAddress% -HKR, Ndi, DeviceID, , "NeoAdapter_VPN46" -HKR, , DevLoader, , ndis -HKR, , DeviceVxDs, , Neo6_x64_VPN46.sys -HKR, NDIS, LogDriverName, , "Neo_VPN46" -HKR, NDIS, MajorNdisVersion, 1, 5 -HKR, NDIS, MinorNdisVersion, 1, 0 -HKR, Ndi\Interfaces, DefUpper, , "ndis5" -HKR, Ndi\Interfaces, UpperRange, , "ndis5" -HKR, Ndi\Interfaces, LowerRange, , "ethernet" -HKR, Ndi\Interfaces, DefLower, , "ethernet" -HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" -HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% -HKR, Ndi\Params\NetworkAddress, type, 0, "edit" -HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" -HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" -HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% -HKR, Ndi\Params\NetworkAddress, optional, 0, "0" -HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% -HKR, Ndi\Params\MaxSpeed, type, 0, "int" -HKR, Ndi\Params\MaxSpeed, default, 0, "100" -HKR, Ndi\Params\MaxSpeed, min, 0, "0" -HKR, Ndi\Params\MaxSpeed, max, 0, "2000" -HKR, Ndi\Params\MaxSpeed, step, 0, "1" -HKR, Ndi\Params\MaxSpeed, Base, 0, "10" -HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% -HKR, Ndi\Params\KeepLink, type, 0, "enum" -HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% -HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% -HKR, Ndi\Params\KeepLink, default, 0, "0" - - -[Neo.Service] -DisplayName = %Neo.Service.DispName% -Description = %Neo.Service.Desc% -ServiceType = 1 -StartType = 3 -ErrorControl = 1 -ServiceBinary = %12%\Neo6_x64_VPN46.sys -LoadOrderGroup = NDIS - -[Neo.Reg] -HKR, Ndi, Service, 0, Neo.Service.Name -HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" -HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" - -[Neo.EventLog] -HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo6_x64_VPN46.sys" -HKR, , TypesSupported, 0x00010001, 7 - -[Strings] -CompanyName = "SoftEther Corporation" -DiskDescription = "VPN Client Device Driver Install Disk" -Neo.Service.Name = "Neo_VPN46" -Neo.Service.DispName = "VPN Client Device Driver - VPN46" -Neo.Service.Desc = "VPN Client Adapter - VPN46" -NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN46" -Neo.EventLog.Name = "Neo" -NetworkAddress = "MAC Address" -DefaultAddress = "000001000001" -MaxSpeed = "Indicate Speed (Mbps)" -KeepLink = "Keep Link" -On = "On" -Off = "Off" - - -; Auto Generated 20180205_163624.593 - +; VPN Client Device Driver for Windows 2000 and Greater +; +; Copyright (c) SoftEther Corporation. All Rights Reserved. +; http://www.softether.co.jp/ +; +; BUILD 9658 + +[Version] +Signature = "$Windows NT$" +Class = Net +ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} +Provider = %CompanyName% +DriverVer = 02/04/2018, 4.25.0.9658 +CatalogFile.NT = Neo6_x64_VPN46.cat + +[Manufacturer] +%CompanyName% = SoftEther, NTamd64 + +[SourceDisksNames] +1=%DiskDescription%, "", , + +[SourceDisksFiles] +Neo6_x64_VPN46.sys = 1 + +[DestinationDirs] +DefaultDestDir = 12 +Neo.CopyFiles.Sys = 12 + +[Neo.CopyFiles.Sys] +Neo6_x64_VPN46.sys, , , 2 + +[SoftEther.NTamd64] +%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN46 + +[NeoAdapter.Install] +Characteristics = 0x1 +AddReg = Neo.Reg, NeoAdapter.Ndi +CopyFiles = Neo.CopyFiles.Sys +*IfType = 53 +*MediaType = 0 +*PhysicalMediaType = 0 + +[NeoAdapter.Install.Services] +AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% + +[NeoAdapter.Ndi] +HKR, , NetworkAddress, 0, %DefaultAddress% +HKR, Ndi, DeviceID, , "NeoAdapter_VPN46" +HKR, , DevLoader, , ndis +HKR, , DeviceVxDs, , Neo6_x64_VPN46.sys +HKR, NDIS, LogDriverName, , "Neo_VPN46" +HKR, NDIS, MajorNdisVersion, 1, 5 +HKR, NDIS, MinorNdisVersion, 1, 0 +HKR, Ndi\Interfaces, DefUpper, , "ndis5" +HKR, Ndi\Interfaces, UpperRange, , "ndis5" +HKR, Ndi\Interfaces, LowerRange, , "ethernet" +HKR, Ndi\Interfaces, DefLower, , "ethernet" +HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" +HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% +HKR, Ndi\Params\NetworkAddress, type, 0, "edit" +HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" +HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" +HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% +HKR, Ndi\Params\NetworkAddress, optional, 0, "0" +HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% +HKR, Ndi\Params\MaxSpeed, type, 0, "int" +HKR, Ndi\Params\MaxSpeed, default, 0, "100" +HKR, Ndi\Params\MaxSpeed, min, 0, "0" +HKR, Ndi\Params\MaxSpeed, max, 0, "2000" +HKR, Ndi\Params\MaxSpeed, step, 0, "1" +HKR, Ndi\Params\MaxSpeed, Base, 0, "10" +HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% +HKR, Ndi\Params\KeepLink, type, 0, "enum" +HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% +HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% +HKR, Ndi\Params\KeepLink, default, 0, "0" + + +[Neo.Service] +DisplayName = %Neo.Service.DispName% +Description = %Neo.Service.Desc% +ServiceType = 1 +StartType = 3 +ErrorControl = 1 +ServiceBinary = %12%\Neo6_x64_VPN46.sys +LoadOrderGroup = NDIS + +[Neo.Reg] +HKR, Ndi, Service, 0, Neo.Service.Name +HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" +HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" + +[Neo.EventLog] +HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo6_x64_VPN46.sys" +HKR, , TypesSupported, 0x00010001, 7 + +[Strings] +CompanyName = "SoftEther Corporation" +DiskDescription = "VPN Client Device Driver Install Disk" +Neo.Service.Name = "Neo_VPN46" +Neo.Service.DispName = "VPN Client Device Driver - VPN46" +Neo.Service.Desc = "VPN Client Adapter - VPN46" +NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN46" +Neo.EventLog.Name = "Neo" +NetworkAddress = "MAC Address" +DefaultAddress = "000001000001" +MaxSpeed = "Indicate Speed (Mbps)" +KeepLink = "Keep Link" +On = "On" +Off = "Off" + + +; Auto Generated 20180205_163624.593 + diff --git a/src/bin/hamcore/DriverPackages/Neo6_Win10/x64/Neo6_x64_VPN47.inf b/src/bin/hamcore/DriverPackages/Neo6_Win10/x64/Neo6_x64_VPN47.inf index 6b96ae3b..3486095b 100644 --- a/src/bin/hamcore/DriverPackages/Neo6_Win10/x64/Neo6_x64_VPN47.inf +++ b/src/bin/hamcore/DriverPackages/Neo6_Win10/x64/Neo6_x64_VPN47.inf @@ -1,114 +1,114 @@ -; VPN Client Device Driver for Windows 2000 and Greater -; -; Copyright (c) SoftEther Corporation. All Rights Reserved. -; http://www.softether.co.jp/ -; -; BUILD 9658 - -[Version] -Signature = "$Windows NT$" -Class = Net -ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} -Provider = %CompanyName% -DriverVer = 02/04/2018, 4.25.0.9658 -CatalogFile.NT = Neo6_x64_VPN47.cat - -[Manufacturer] -%CompanyName% = SoftEther, NTamd64 - -[SourceDisksNames] -1=%DiskDescription%, "", , - -[SourceDisksFiles] -Neo6_x64_VPN47.sys = 1 - -[DestinationDirs] -DefaultDestDir = 12 -Neo.CopyFiles.Sys = 12 - -[Neo.CopyFiles.Sys] -Neo6_x64_VPN47.sys, , , 2 - -[SoftEther.NTamd64] -%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN47 - -[NeoAdapter.Install] -Characteristics = 0x1 -AddReg = Neo.Reg, NeoAdapter.Ndi -CopyFiles = Neo.CopyFiles.Sys -*IfType = 53 -*MediaType = 0 -*PhysicalMediaType = 0 - -[NeoAdapter.Install.Services] -AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% - -[NeoAdapter.Ndi] -HKR, , NetworkAddress, 0, %DefaultAddress% -HKR, Ndi, DeviceID, , "NeoAdapter_VPN47" -HKR, , DevLoader, , ndis -HKR, , DeviceVxDs, , Neo6_x64_VPN47.sys -HKR, NDIS, LogDriverName, , "Neo_VPN47" -HKR, NDIS, MajorNdisVersion, 1, 5 -HKR, NDIS, MinorNdisVersion, 1, 0 -HKR, Ndi\Interfaces, DefUpper, , "ndis5" -HKR, Ndi\Interfaces, UpperRange, , "ndis5" -HKR, Ndi\Interfaces, LowerRange, , "ethernet" -HKR, Ndi\Interfaces, DefLower, , "ethernet" -HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" -HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% -HKR, Ndi\Params\NetworkAddress, type, 0, "edit" -HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" -HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" -HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% -HKR, Ndi\Params\NetworkAddress, optional, 0, "0" -HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% -HKR, Ndi\Params\MaxSpeed, type, 0, "int" -HKR, Ndi\Params\MaxSpeed, default, 0, "100" -HKR, Ndi\Params\MaxSpeed, min, 0, "0" -HKR, Ndi\Params\MaxSpeed, max, 0, "2000" -HKR, Ndi\Params\MaxSpeed, step, 0, "1" -HKR, Ndi\Params\MaxSpeed, Base, 0, "10" -HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% -HKR, Ndi\Params\KeepLink, type, 0, "enum" -HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% -HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% -HKR, Ndi\Params\KeepLink, default, 0, "0" - - -[Neo.Service] -DisplayName = %Neo.Service.DispName% -Description = %Neo.Service.Desc% -ServiceType = 1 -StartType = 3 -ErrorControl = 1 -ServiceBinary = %12%\Neo6_x64_VPN47.sys -LoadOrderGroup = NDIS - -[Neo.Reg] -HKR, Ndi, Service, 0, Neo.Service.Name -HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" -HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" - -[Neo.EventLog] -HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo6_x64_VPN47.sys" -HKR, , TypesSupported, 0x00010001, 7 - -[Strings] -CompanyName = "SoftEther Corporation" -DiskDescription = "VPN Client Device Driver Install Disk" -Neo.Service.Name = "Neo_VPN47" -Neo.Service.DispName = "VPN Client Device Driver - VPN47" -Neo.Service.Desc = "VPN Client Adapter - VPN47" -NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN47" -Neo.EventLog.Name = "Neo" -NetworkAddress = "MAC Address" -DefaultAddress = "000001000001" -MaxSpeed = "Indicate Speed (Mbps)" -KeepLink = "Keep Link" -On = "On" -Off = "Off" - - -; Auto Generated 20180205_163624.665 - +; VPN Client Device Driver for Windows 2000 and Greater +; +; Copyright (c) SoftEther Corporation. All Rights Reserved. +; http://www.softether.co.jp/ +; +; BUILD 9658 + +[Version] +Signature = "$Windows NT$" +Class = Net +ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} +Provider = %CompanyName% +DriverVer = 02/04/2018, 4.25.0.9658 +CatalogFile.NT = Neo6_x64_VPN47.cat + +[Manufacturer] +%CompanyName% = SoftEther, NTamd64 + +[SourceDisksNames] +1=%DiskDescription%, "", , + +[SourceDisksFiles] +Neo6_x64_VPN47.sys = 1 + +[DestinationDirs] +DefaultDestDir = 12 +Neo.CopyFiles.Sys = 12 + +[Neo.CopyFiles.Sys] +Neo6_x64_VPN47.sys, , , 2 + +[SoftEther.NTamd64] +%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN47 + +[NeoAdapter.Install] +Characteristics = 0x1 +AddReg = Neo.Reg, NeoAdapter.Ndi +CopyFiles = Neo.CopyFiles.Sys +*IfType = 53 +*MediaType = 0 +*PhysicalMediaType = 0 + +[NeoAdapter.Install.Services] +AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% + +[NeoAdapter.Ndi] +HKR, , NetworkAddress, 0, %DefaultAddress% +HKR, Ndi, DeviceID, , "NeoAdapter_VPN47" +HKR, , DevLoader, , ndis +HKR, , DeviceVxDs, , Neo6_x64_VPN47.sys +HKR, NDIS, LogDriverName, , "Neo_VPN47" +HKR, NDIS, MajorNdisVersion, 1, 5 +HKR, NDIS, MinorNdisVersion, 1, 0 +HKR, Ndi\Interfaces, DefUpper, , "ndis5" +HKR, Ndi\Interfaces, UpperRange, , "ndis5" +HKR, Ndi\Interfaces, LowerRange, , "ethernet" +HKR, Ndi\Interfaces, DefLower, , "ethernet" +HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" +HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% +HKR, Ndi\Params\NetworkAddress, type, 0, "edit" +HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" +HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" +HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% +HKR, Ndi\Params\NetworkAddress, optional, 0, "0" +HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% +HKR, Ndi\Params\MaxSpeed, type, 0, "int" +HKR, Ndi\Params\MaxSpeed, default, 0, "100" +HKR, Ndi\Params\MaxSpeed, min, 0, "0" +HKR, Ndi\Params\MaxSpeed, max, 0, "2000" +HKR, Ndi\Params\MaxSpeed, step, 0, "1" +HKR, Ndi\Params\MaxSpeed, Base, 0, "10" +HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% +HKR, Ndi\Params\KeepLink, type, 0, "enum" +HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% +HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% +HKR, Ndi\Params\KeepLink, default, 0, "0" + + +[Neo.Service] +DisplayName = %Neo.Service.DispName% +Description = %Neo.Service.Desc% +ServiceType = 1 +StartType = 3 +ErrorControl = 1 +ServiceBinary = %12%\Neo6_x64_VPN47.sys +LoadOrderGroup = NDIS + +[Neo.Reg] +HKR, Ndi, Service, 0, Neo.Service.Name +HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" +HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" + +[Neo.EventLog] +HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo6_x64_VPN47.sys" +HKR, , TypesSupported, 0x00010001, 7 + +[Strings] +CompanyName = "SoftEther Corporation" +DiskDescription = "VPN Client Device Driver Install Disk" +Neo.Service.Name = "Neo_VPN47" +Neo.Service.DispName = "VPN Client Device Driver - VPN47" +Neo.Service.Desc = "VPN Client Adapter - VPN47" +NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN47" +Neo.EventLog.Name = "Neo" +NetworkAddress = "MAC Address" +DefaultAddress = "000001000001" +MaxSpeed = "Indicate Speed (Mbps)" +KeepLink = "Keep Link" +On = "On" +Off = "Off" + + +; Auto Generated 20180205_163624.665 + diff --git a/src/bin/hamcore/DriverPackages/Neo6_Win10/x64/Neo6_x64_VPN48.inf b/src/bin/hamcore/DriverPackages/Neo6_Win10/x64/Neo6_x64_VPN48.inf index dba2d647..ec303da4 100644 --- a/src/bin/hamcore/DriverPackages/Neo6_Win10/x64/Neo6_x64_VPN48.inf +++ b/src/bin/hamcore/DriverPackages/Neo6_Win10/x64/Neo6_x64_VPN48.inf @@ -1,114 +1,114 @@ -; VPN Client Device Driver for Windows 2000 and Greater -; -; Copyright (c) SoftEther Corporation. All Rights Reserved. -; http://www.softether.co.jp/ -; -; BUILD 9658 - -[Version] -Signature = "$Windows NT$" -Class = Net -ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} -Provider = %CompanyName% -DriverVer = 02/04/2018, 4.25.0.9658 -CatalogFile.NT = Neo6_x64_VPN48.cat - -[Manufacturer] -%CompanyName% = SoftEther, NTamd64 - -[SourceDisksNames] -1=%DiskDescription%, "", , - -[SourceDisksFiles] -Neo6_x64_VPN48.sys = 1 - -[DestinationDirs] -DefaultDestDir = 12 -Neo.CopyFiles.Sys = 12 - -[Neo.CopyFiles.Sys] -Neo6_x64_VPN48.sys, , , 2 - -[SoftEther.NTamd64] -%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN48 - -[NeoAdapter.Install] -Characteristics = 0x1 -AddReg = Neo.Reg, NeoAdapter.Ndi -CopyFiles = Neo.CopyFiles.Sys -*IfType = 53 -*MediaType = 0 -*PhysicalMediaType = 0 - -[NeoAdapter.Install.Services] -AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% - -[NeoAdapter.Ndi] -HKR, , NetworkAddress, 0, %DefaultAddress% -HKR, Ndi, DeviceID, , "NeoAdapter_VPN48" -HKR, , DevLoader, , ndis -HKR, , DeviceVxDs, , Neo6_x64_VPN48.sys -HKR, NDIS, LogDriverName, , "Neo_VPN48" -HKR, NDIS, MajorNdisVersion, 1, 5 -HKR, NDIS, MinorNdisVersion, 1, 0 -HKR, Ndi\Interfaces, DefUpper, , "ndis5" -HKR, Ndi\Interfaces, UpperRange, , "ndis5" -HKR, Ndi\Interfaces, LowerRange, , "ethernet" -HKR, Ndi\Interfaces, DefLower, , "ethernet" -HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" -HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% -HKR, Ndi\Params\NetworkAddress, type, 0, "edit" -HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" -HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" -HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% -HKR, Ndi\Params\NetworkAddress, optional, 0, "0" -HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% -HKR, Ndi\Params\MaxSpeed, type, 0, "int" -HKR, Ndi\Params\MaxSpeed, default, 0, "100" -HKR, Ndi\Params\MaxSpeed, min, 0, "0" -HKR, Ndi\Params\MaxSpeed, max, 0, "2000" -HKR, Ndi\Params\MaxSpeed, step, 0, "1" -HKR, Ndi\Params\MaxSpeed, Base, 0, "10" -HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% -HKR, Ndi\Params\KeepLink, type, 0, "enum" -HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% -HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% -HKR, Ndi\Params\KeepLink, default, 0, "0" - - -[Neo.Service] -DisplayName = %Neo.Service.DispName% -Description = %Neo.Service.Desc% -ServiceType = 1 -StartType = 3 -ErrorControl = 1 -ServiceBinary = %12%\Neo6_x64_VPN48.sys -LoadOrderGroup = NDIS - -[Neo.Reg] -HKR, Ndi, Service, 0, Neo.Service.Name -HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" -HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" - -[Neo.EventLog] -HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo6_x64_VPN48.sys" -HKR, , TypesSupported, 0x00010001, 7 - -[Strings] -CompanyName = "SoftEther Corporation" -DiskDescription = "VPN Client Device Driver Install Disk" -Neo.Service.Name = "Neo_VPN48" -Neo.Service.DispName = "VPN Client Device Driver - VPN48" -Neo.Service.Desc = "VPN Client Adapter - VPN48" -NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN48" -Neo.EventLog.Name = "Neo" -NetworkAddress = "MAC Address" -DefaultAddress = "000001000001" -MaxSpeed = "Indicate Speed (Mbps)" -KeepLink = "Keep Link" -On = "On" -Off = "Off" - - -; Auto Generated 20180205_163624.736 - +; VPN Client Device Driver for Windows 2000 and Greater +; +; Copyright (c) SoftEther Corporation. All Rights Reserved. +; http://www.softether.co.jp/ +; +; BUILD 9658 + +[Version] +Signature = "$Windows NT$" +Class = Net +ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} +Provider = %CompanyName% +DriverVer = 02/04/2018, 4.25.0.9658 +CatalogFile.NT = Neo6_x64_VPN48.cat + +[Manufacturer] +%CompanyName% = SoftEther, NTamd64 + +[SourceDisksNames] +1=%DiskDescription%, "", , + +[SourceDisksFiles] +Neo6_x64_VPN48.sys = 1 + +[DestinationDirs] +DefaultDestDir = 12 +Neo.CopyFiles.Sys = 12 + +[Neo.CopyFiles.Sys] +Neo6_x64_VPN48.sys, , , 2 + +[SoftEther.NTamd64] +%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN48 + +[NeoAdapter.Install] +Characteristics = 0x1 +AddReg = Neo.Reg, NeoAdapter.Ndi +CopyFiles = Neo.CopyFiles.Sys +*IfType = 53 +*MediaType = 0 +*PhysicalMediaType = 0 + +[NeoAdapter.Install.Services] +AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% + +[NeoAdapter.Ndi] +HKR, , NetworkAddress, 0, %DefaultAddress% +HKR, Ndi, DeviceID, , "NeoAdapter_VPN48" +HKR, , DevLoader, , ndis +HKR, , DeviceVxDs, , Neo6_x64_VPN48.sys +HKR, NDIS, LogDriverName, , "Neo_VPN48" +HKR, NDIS, MajorNdisVersion, 1, 5 +HKR, NDIS, MinorNdisVersion, 1, 0 +HKR, Ndi\Interfaces, DefUpper, , "ndis5" +HKR, Ndi\Interfaces, UpperRange, , "ndis5" +HKR, Ndi\Interfaces, LowerRange, , "ethernet" +HKR, Ndi\Interfaces, DefLower, , "ethernet" +HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" +HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% +HKR, Ndi\Params\NetworkAddress, type, 0, "edit" +HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" +HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" +HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% +HKR, Ndi\Params\NetworkAddress, optional, 0, "0" +HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% +HKR, Ndi\Params\MaxSpeed, type, 0, "int" +HKR, Ndi\Params\MaxSpeed, default, 0, "100" +HKR, Ndi\Params\MaxSpeed, min, 0, "0" +HKR, Ndi\Params\MaxSpeed, max, 0, "2000" +HKR, Ndi\Params\MaxSpeed, step, 0, "1" +HKR, Ndi\Params\MaxSpeed, Base, 0, "10" +HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% +HKR, Ndi\Params\KeepLink, type, 0, "enum" +HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% +HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% +HKR, Ndi\Params\KeepLink, default, 0, "0" + + +[Neo.Service] +DisplayName = %Neo.Service.DispName% +Description = %Neo.Service.Desc% +ServiceType = 1 +StartType = 3 +ErrorControl = 1 +ServiceBinary = %12%\Neo6_x64_VPN48.sys +LoadOrderGroup = NDIS + +[Neo.Reg] +HKR, Ndi, Service, 0, Neo.Service.Name +HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" +HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" + +[Neo.EventLog] +HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo6_x64_VPN48.sys" +HKR, , TypesSupported, 0x00010001, 7 + +[Strings] +CompanyName = "SoftEther Corporation" +DiskDescription = "VPN Client Device Driver Install Disk" +Neo.Service.Name = "Neo_VPN48" +Neo.Service.DispName = "VPN Client Device Driver - VPN48" +Neo.Service.Desc = "VPN Client Adapter - VPN48" +NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN48" +Neo.EventLog.Name = "Neo" +NetworkAddress = "MAC Address" +DefaultAddress = "000001000001" +MaxSpeed = "Indicate Speed (Mbps)" +KeepLink = "Keep Link" +On = "On" +Off = "Off" + + +; Auto Generated 20180205_163624.736 + diff --git a/src/bin/hamcore/DriverPackages/Neo6_Win10/x64/Neo6_x64_VPN49.inf b/src/bin/hamcore/DriverPackages/Neo6_Win10/x64/Neo6_x64_VPN49.inf index 2472b416..81d7d2cc 100644 --- a/src/bin/hamcore/DriverPackages/Neo6_Win10/x64/Neo6_x64_VPN49.inf +++ b/src/bin/hamcore/DriverPackages/Neo6_Win10/x64/Neo6_x64_VPN49.inf @@ -1,114 +1,114 @@ -; VPN Client Device Driver for Windows 2000 and Greater -; -; Copyright (c) SoftEther Corporation. All Rights Reserved. -; http://www.softether.co.jp/ -; -; BUILD 9658 - -[Version] -Signature = "$Windows NT$" -Class = Net -ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} -Provider = %CompanyName% -DriverVer = 02/04/2018, 4.25.0.9658 -CatalogFile.NT = Neo6_x64_VPN49.cat - -[Manufacturer] -%CompanyName% = SoftEther, NTamd64 - -[SourceDisksNames] -1=%DiskDescription%, "", , - -[SourceDisksFiles] -Neo6_x64_VPN49.sys = 1 - -[DestinationDirs] -DefaultDestDir = 12 -Neo.CopyFiles.Sys = 12 - -[Neo.CopyFiles.Sys] -Neo6_x64_VPN49.sys, , , 2 - -[SoftEther.NTamd64] -%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN49 - -[NeoAdapter.Install] -Characteristics = 0x1 -AddReg = Neo.Reg, NeoAdapter.Ndi -CopyFiles = Neo.CopyFiles.Sys -*IfType = 53 -*MediaType = 0 -*PhysicalMediaType = 0 - -[NeoAdapter.Install.Services] -AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% - -[NeoAdapter.Ndi] -HKR, , NetworkAddress, 0, %DefaultAddress% -HKR, Ndi, DeviceID, , "NeoAdapter_VPN49" -HKR, , DevLoader, , ndis -HKR, , DeviceVxDs, , Neo6_x64_VPN49.sys -HKR, NDIS, LogDriverName, , "Neo_VPN49" -HKR, NDIS, MajorNdisVersion, 1, 5 -HKR, NDIS, MinorNdisVersion, 1, 0 -HKR, Ndi\Interfaces, DefUpper, , "ndis5" -HKR, Ndi\Interfaces, UpperRange, , "ndis5" -HKR, Ndi\Interfaces, LowerRange, , "ethernet" -HKR, Ndi\Interfaces, DefLower, , "ethernet" -HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" -HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% -HKR, Ndi\Params\NetworkAddress, type, 0, "edit" -HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" -HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" -HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% -HKR, Ndi\Params\NetworkAddress, optional, 0, "0" -HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% -HKR, Ndi\Params\MaxSpeed, type, 0, "int" -HKR, Ndi\Params\MaxSpeed, default, 0, "100" -HKR, Ndi\Params\MaxSpeed, min, 0, "0" -HKR, Ndi\Params\MaxSpeed, max, 0, "2000" -HKR, Ndi\Params\MaxSpeed, step, 0, "1" -HKR, Ndi\Params\MaxSpeed, Base, 0, "10" -HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% -HKR, Ndi\Params\KeepLink, type, 0, "enum" -HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% -HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% -HKR, Ndi\Params\KeepLink, default, 0, "0" - - -[Neo.Service] -DisplayName = %Neo.Service.DispName% -Description = %Neo.Service.Desc% -ServiceType = 1 -StartType = 3 -ErrorControl = 1 -ServiceBinary = %12%\Neo6_x64_VPN49.sys -LoadOrderGroup = NDIS - -[Neo.Reg] -HKR, Ndi, Service, 0, Neo.Service.Name -HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" -HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" - -[Neo.EventLog] -HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo6_x64_VPN49.sys" -HKR, , TypesSupported, 0x00010001, 7 - -[Strings] -CompanyName = "SoftEther Corporation" -DiskDescription = "VPN Client Device Driver Install Disk" -Neo.Service.Name = "Neo_VPN49" -Neo.Service.DispName = "VPN Client Device Driver - VPN49" -Neo.Service.Desc = "VPN Client Adapter - VPN49" -NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN49" -Neo.EventLog.Name = "Neo" -NetworkAddress = "MAC Address" -DefaultAddress = "000001000001" -MaxSpeed = "Indicate Speed (Mbps)" -KeepLink = "Keep Link" -On = "On" -Off = "Off" - - -; Auto Generated 20180205_163624.809 - +; VPN Client Device Driver for Windows 2000 and Greater +; +; Copyright (c) SoftEther Corporation. All Rights Reserved. +; http://www.softether.co.jp/ +; +; BUILD 9658 + +[Version] +Signature = "$Windows NT$" +Class = Net +ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} +Provider = %CompanyName% +DriverVer = 02/04/2018, 4.25.0.9658 +CatalogFile.NT = Neo6_x64_VPN49.cat + +[Manufacturer] +%CompanyName% = SoftEther, NTamd64 + +[SourceDisksNames] +1=%DiskDescription%, "", , + +[SourceDisksFiles] +Neo6_x64_VPN49.sys = 1 + +[DestinationDirs] +DefaultDestDir = 12 +Neo.CopyFiles.Sys = 12 + +[Neo.CopyFiles.Sys] +Neo6_x64_VPN49.sys, , , 2 + +[SoftEther.NTamd64] +%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN49 + +[NeoAdapter.Install] +Characteristics = 0x1 +AddReg = Neo.Reg, NeoAdapter.Ndi +CopyFiles = Neo.CopyFiles.Sys +*IfType = 53 +*MediaType = 0 +*PhysicalMediaType = 0 + +[NeoAdapter.Install.Services] +AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% + +[NeoAdapter.Ndi] +HKR, , NetworkAddress, 0, %DefaultAddress% +HKR, Ndi, DeviceID, , "NeoAdapter_VPN49" +HKR, , DevLoader, , ndis +HKR, , DeviceVxDs, , Neo6_x64_VPN49.sys +HKR, NDIS, LogDriverName, , "Neo_VPN49" +HKR, NDIS, MajorNdisVersion, 1, 5 +HKR, NDIS, MinorNdisVersion, 1, 0 +HKR, Ndi\Interfaces, DefUpper, , "ndis5" +HKR, Ndi\Interfaces, UpperRange, , "ndis5" +HKR, Ndi\Interfaces, LowerRange, , "ethernet" +HKR, Ndi\Interfaces, DefLower, , "ethernet" +HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" +HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% +HKR, Ndi\Params\NetworkAddress, type, 0, "edit" +HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" +HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" +HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% +HKR, Ndi\Params\NetworkAddress, optional, 0, "0" +HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% +HKR, Ndi\Params\MaxSpeed, type, 0, "int" +HKR, Ndi\Params\MaxSpeed, default, 0, "100" +HKR, Ndi\Params\MaxSpeed, min, 0, "0" +HKR, Ndi\Params\MaxSpeed, max, 0, "2000" +HKR, Ndi\Params\MaxSpeed, step, 0, "1" +HKR, Ndi\Params\MaxSpeed, Base, 0, "10" +HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% +HKR, Ndi\Params\KeepLink, type, 0, "enum" +HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% +HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% +HKR, Ndi\Params\KeepLink, default, 0, "0" + + +[Neo.Service] +DisplayName = %Neo.Service.DispName% +Description = %Neo.Service.Desc% +ServiceType = 1 +StartType = 3 +ErrorControl = 1 +ServiceBinary = %12%\Neo6_x64_VPN49.sys +LoadOrderGroup = NDIS + +[Neo.Reg] +HKR, Ndi, Service, 0, Neo.Service.Name +HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" +HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" + +[Neo.EventLog] +HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo6_x64_VPN49.sys" +HKR, , TypesSupported, 0x00010001, 7 + +[Strings] +CompanyName = "SoftEther Corporation" +DiskDescription = "VPN Client Device Driver Install Disk" +Neo.Service.Name = "Neo_VPN49" +Neo.Service.DispName = "VPN Client Device Driver - VPN49" +Neo.Service.Desc = "VPN Client Adapter - VPN49" +NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN49" +Neo.EventLog.Name = "Neo" +NetworkAddress = "MAC Address" +DefaultAddress = "000001000001" +MaxSpeed = "Indicate Speed (Mbps)" +KeepLink = "Keep Link" +On = "On" +Off = "Off" + + +; Auto Generated 20180205_163624.809 + diff --git a/src/bin/hamcore/DriverPackages/Neo6_Win10/x64/Neo6_x64_VPN5.inf b/src/bin/hamcore/DriverPackages/Neo6_Win10/x64/Neo6_x64_VPN5.inf index 89f3470e..4189b6b9 100644 --- a/src/bin/hamcore/DriverPackages/Neo6_Win10/x64/Neo6_x64_VPN5.inf +++ b/src/bin/hamcore/DriverPackages/Neo6_Win10/x64/Neo6_x64_VPN5.inf @@ -1,114 +1,114 @@ -; VPN Client Device Driver for Windows 2000 and Greater -; -; Copyright (c) SoftEther Corporation. All Rights Reserved. -; http://www.softether.co.jp/ -; -; BUILD 9658 - -[Version] -Signature = "$Windows NT$" -Class = Net -ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} -Provider = %CompanyName% -DriverVer = 02/04/2018, 4.25.0.9658 -CatalogFile.NT = Neo6_x64_VPN5.cat - -[Manufacturer] -%CompanyName% = SoftEther, NTamd64 - -[SourceDisksNames] -1=%DiskDescription%, "", , - -[SourceDisksFiles] -Neo6_x64_VPN5.sys = 1 - -[DestinationDirs] -DefaultDestDir = 12 -Neo.CopyFiles.Sys = 12 - -[Neo.CopyFiles.Sys] -Neo6_x64_VPN5.sys, , , 2 - -[SoftEther.NTamd64] -%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN5 - -[NeoAdapter.Install] -Characteristics = 0x1 -AddReg = Neo.Reg, NeoAdapter.Ndi -CopyFiles = Neo.CopyFiles.Sys -*IfType = 53 -*MediaType = 0 -*PhysicalMediaType = 0 - -[NeoAdapter.Install.Services] -AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% - -[NeoAdapter.Ndi] -HKR, , NetworkAddress, 0, %DefaultAddress% -HKR, Ndi, DeviceID, , "NeoAdapter_VPN5" -HKR, , DevLoader, , ndis -HKR, , DeviceVxDs, , Neo6_x64_VPN5.sys -HKR, NDIS, LogDriverName, , "Neo_VPN5" -HKR, NDIS, MajorNdisVersion, 1, 5 -HKR, NDIS, MinorNdisVersion, 1, 0 -HKR, Ndi\Interfaces, DefUpper, , "ndis5" -HKR, Ndi\Interfaces, UpperRange, , "ndis5" -HKR, Ndi\Interfaces, LowerRange, , "ethernet" -HKR, Ndi\Interfaces, DefLower, , "ethernet" -HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" -HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% -HKR, Ndi\Params\NetworkAddress, type, 0, "edit" -HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" -HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" -HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% -HKR, Ndi\Params\NetworkAddress, optional, 0, "0" -HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% -HKR, Ndi\Params\MaxSpeed, type, 0, "int" -HKR, Ndi\Params\MaxSpeed, default, 0, "100" -HKR, Ndi\Params\MaxSpeed, min, 0, "0" -HKR, Ndi\Params\MaxSpeed, max, 0, "2000" -HKR, Ndi\Params\MaxSpeed, step, 0, "1" -HKR, Ndi\Params\MaxSpeed, Base, 0, "10" -HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% -HKR, Ndi\Params\KeepLink, type, 0, "enum" -HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% -HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% -HKR, Ndi\Params\KeepLink, default, 0, "0" - - -[Neo.Service] -DisplayName = %Neo.Service.DispName% -Description = %Neo.Service.Desc% -ServiceType = 1 -StartType = 3 -ErrorControl = 1 -ServiceBinary = %12%\Neo6_x64_VPN5.sys -LoadOrderGroup = NDIS - -[Neo.Reg] -HKR, Ndi, Service, 0, Neo.Service.Name -HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" -HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" - -[Neo.EventLog] -HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo6_x64_VPN5.sys" -HKR, , TypesSupported, 0x00010001, 7 - -[Strings] -CompanyName = "SoftEther Corporation" -DiskDescription = "VPN Client Device Driver Install Disk" -Neo.Service.Name = "Neo_VPN5" -Neo.Service.DispName = "VPN Client Device Driver - VPN5" -Neo.Service.Desc = "VPN Client Adapter - VPN5" -NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN5" -Neo.EventLog.Name = "Neo" -NetworkAddress = "MAC Address" -DefaultAddress = "000001000001" -MaxSpeed = "Indicate Speed (Mbps)" -KeepLink = "Keep Link" -On = "On" -Off = "Off" - - -; Auto Generated 20180205_163621.666 - +; VPN Client Device Driver for Windows 2000 and Greater +; +; Copyright (c) SoftEther Corporation. All Rights Reserved. +; http://www.softether.co.jp/ +; +; BUILD 9658 + +[Version] +Signature = "$Windows NT$" +Class = Net +ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} +Provider = %CompanyName% +DriverVer = 02/04/2018, 4.25.0.9658 +CatalogFile.NT = Neo6_x64_VPN5.cat + +[Manufacturer] +%CompanyName% = SoftEther, NTamd64 + +[SourceDisksNames] +1=%DiskDescription%, "", , + +[SourceDisksFiles] +Neo6_x64_VPN5.sys = 1 + +[DestinationDirs] +DefaultDestDir = 12 +Neo.CopyFiles.Sys = 12 + +[Neo.CopyFiles.Sys] +Neo6_x64_VPN5.sys, , , 2 + +[SoftEther.NTamd64] +%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN5 + +[NeoAdapter.Install] +Characteristics = 0x1 +AddReg = Neo.Reg, NeoAdapter.Ndi +CopyFiles = Neo.CopyFiles.Sys +*IfType = 53 +*MediaType = 0 +*PhysicalMediaType = 0 + +[NeoAdapter.Install.Services] +AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% + +[NeoAdapter.Ndi] +HKR, , NetworkAddress, 0, %DefaultAddress% +HKR, Ndi, DeviceID, , "NeoAdapter_VPN5" +HKR, , DevLoader, , ndis +HKR, , DeviceVxDs, , Neo6_x64_VPN5.sys +HKR, NDIS, LogDriverName, , "Neo_VPN5" +HKR, NDIS, MajorNdisVersion, 1, 5 +HKR, NDIS, MinorNdisVersion, 1, 0 +HKR, Ndi\Interfaces, DefUpper, , "ndis5" +HKR, Ndi\Interfaces, UpperRange, , "ndis5" +HKR, Ndi\Interfaces, LowerRange, , "ethernet" +HKR, Ndi\Interfaces, DefLower, , "ethernet" +HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" +HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% +HKR, Ndi\Params\NetworkAddress, type, 0, "edit" +HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" +HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" +HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% +HKR, Ndi\Params\NetworkAddress, optional, 0, "0" +HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% +HKR, Ndi\Params\MaxSpeed, type, 0, "int" +HKR, Ndi\Params\MaxSpeed, default, 0, "100" +HKR, Ndi\Params\MaxSpeed, min, 0, "0" +HKR, Ndi\Params\MaxSpeed, max, 0, "2000" +HKR, Ndi\Params\MaxSpeed, step, 0, "1" +HKR, Ndi\Params\MaxSpeed, Base, 0, "10" +HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% +HKR, Ndi\Params\KeepLink, type, 0, "enum" +HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% +HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% +HKR, Ndi\Params\KeepLink, default, 0, "0" + + +[Neo.Service] +DisplayName = %Neo.Service.DispName% +Description = %Neo.Service.Desc% +ServiceType = 1 +StartType = 3 +ErrorControl = 1 +ServiceBinary = %12%\Neo6_x64_VPN5.sys +LoadOrderGroup = NDIS + +[Neo.Reg] +HKR, Ndi, Service, 0, Neo.Service.Name +HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" +HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" + +[Neo.EventLog] +HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo6_x64_VPN5.sys" +HKR, , TypesSupported, 0x00010001, 7 + +[Strings] +CompanyName = "SoftEther Corporation" +DiskDescription = "VPN Client Device Driver Install Disk" +Neo.Service.Name = "Neo_VPN5" +Neo.Service.DispName = "VPN Client Device Driver - VPN5" +Neo.Service.Desc = "VPN Client Adapter - VPN5" +NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN5" +Neo.EventLog.Name = "Neo" +NetworkAddress = "MAC Address" +DefaultAddress = "000001000001" +MaxSpeed = "Indicate Speed (Mbps)" +KeepLink = "Keep Link" +On = "On" +Off = "Off" + + +; Auto Generated 20180205_163621.666 + diff --git a/src/bin/hamcore/DriverPackages/Neo6_Win10/x64/Neo6_x64_VPN50.inf b/src/bin/hamcore/DriverPackages/Neo6_Win10/x64/Neo6_x64_VPN50.inf index 59890a23..9a717fbd 100644 --- a/src/bin/hamcore/DriverPackages/Neo6_Win10/x64/Neo6_x64_VPN50.inf +++ b/src/bin/hamcore/DriverPackages/Neo6_Win10/x64/Neo6_x64_VPN50.inf @@ -1,114 +1,114 @@ -; VPN Client Device Driver for Windows 2000 and Greater -; -; Copyright (c) SoftEther Corporation. All Rights Reserved. -; http://www.softether.co.jp/ -; -; BUILD 9658 - -[Version] -Signature = "$Windows NT$" -Class = Net -ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} -Provider = %CompanyName% -DriverVer = 02/04/2018, 4.25.0.9658 -CatalogFile.NT = Neo6_x64_VPN50.cat - -[Manufacturer] -%CompanyName% = SoftEther, NTamd64 - -[SourceDisksNames] -1=%DiskDescription%, "", , - -[SourceDisksFiles] -Neo6_x64_VPN50.sys = 1 - -[DestinationDirs] -DefaultDestDir = 12 -Neo.CopyFiles.Sys = 12 - -[Neo.CopyFiles.Sys] -Neo6_x64_VPN50.sys, , , 2 - -[SoftEther.NTamd64] -%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN50 - -[NeoAdapter.Install] -Characteristics = 0x1 -AddReg = Neo.Reg, NeoAdapter.Ndi -CopyFiles = Neo.CopyFiles.Sys -*IfType = 53 -*MediaType = 0 -*PhysicalMediaType = 0 - -[NeoAdapter.Install.Services] -AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% - -[NeoAdapter.Ndi] -HKR, , NetworkAddress, 0, %DefaultAddress% -HKR, Ndi, DeviceID, , "NeoAdapter_VPN50" -HKR, , DevLoader, , ndis -HKR, , DeviceVxDs, , Neo6_x64_VPN50.sys -HKR, NDIS, LogDriverName, , "Neo_VPN50" -HKR, NDIS, MajorNdisVersion, 1, 5 -HKR, NDIS, MinorNdisVersion, 1, 0 -HKR, Ndi\Interfaces, DefUpper, , "ndis5" -HKR, Ndi\Interfaces, UpperRange, , "ndis5" -HKR, Ndi\Interfaces, LowerRange, , "ethernet" -HKR, Ndi\Interfaces, DefLower, , "ethernet" -HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" -HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% -HKR, Ndi\Params\NetworkAddress, type, 0, "edit" -HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" -HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" -HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% -HKR, Ndi\Params\NetworkAddress, optional, 0, "0" -HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% -HKR, Ndi\Params\MaxSpeed, type, 0, "int" -HKR, Ndi\Params\MaxSpeed, default, 0, "100" -HKR, Ndi\Params\MaxSpeed, min, 0, "0" -HKR, Ndi\Params\MaxSpeed, max, 0, "2000" -HKR, Ndi\Params\MaxSpeed, step, 0, "1" -HKR, Ndi\Params\MaxSpeed, Base, 0, "10" -HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% -HKR, Ndi\Params\KeepLink, type, 0, "enum" -HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% -HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% -HKR, Ndi\Params\KeepLink, default, 0, "0" - - -[Neo.Service] -DisplayName = %Neo.Service.DispName% -Description = %Neo.Service.Desc% -ServiceType = 1 -StartType = 3 -ErrorControl = 1 -ServiceBinary = %12%\Neo6_x64_VPN50.sys -LoadOrderGroup = NDIS - -[Neo.Reg] -HKR, Ndi, Service, 0, Neo.Service.Name -HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" -HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" - -[Neo.EventLog] -HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo6_x64_VPN50.sys" -HKR, , TypesSupported, 0x00010001, 7 - -[Strings] -CompanyName = "SoftEther Corporation" -DiskDescription = "VPN Client Device Driver Install Disk" -Neo.Service.Name = "Neo_VPN50" -Neo.Service.DispName = "VPN Client Device Driver - VPN50" -Neo.Service.Desc = "VPN Client Adapter - VPN50" -NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN50" -Neo.EventLog.Name = "Neo" -NetworkAddress = "MAC Address" -DefaultAddress = "000001000001" -MaxSpeed = "Indicate Speed (Mbps)" -KeepLink = "Keep Link" -On = "On" -Off = "Off" - - -; Auto Generated 20180205_163624.880 - +; VPN Client Device Driver for Windows 2000 and Greater +; +; Copyright (c) SoftEther Corporation. All Rights Reserved. +; http://www.softether.co.jp/ +; +; BUILD 9658 + +[Version] +Signature = "$Windows NT$" +Class = Net +ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} +Provider = %CompanyName% +DriverVer = 02/04/2018, 4.25.0.9658 +CatalogFile.NT = Neo6_x64_VPN50.cat + +[Manufacturer] +%CompanyName% = SoftEther, NTamd64 + +[SourceDisksNames] +1=%DiskDescription%, "", , + +[SourceDisksFiles] +Neo6_x64_VPN50.sys = 1 + +[DestinationDirs] +DefaultDestDir = 12 +Neo.CopyFiles.Sys = 12 + +[Neo.CopyFiles.Sys] +Neo6_x64_VPN50.sys, , , 2 + +[SoftEther.NTamd64] +%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN50 + +[NeoAdapter.Install] +Characteristics = 0x1 +AddReg = Neo.Reg, NeoAdapter.Ndi +CopyFiles = Neo.CopyFiles.Sys +*IfType = 53 +*MediaType = 0 +*PhysicalMediaType = 0 + +[NeoAdapter.Install.Services] +AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% + +[NeoAdapter.Ndi] +HKR, , NetworkAddress, 0, %DefaultAddress% +HKR, Ndi, DeviceID, , "NeoAdapter_VPN50" +HKR, , DevLoader, , ndis +HKR, , DeviceVxDs, , Neo6_x64_VPN50.sys +HKR, NDIS, LogDriverName, , "Neo_VPN50" +HKR, NDIS, MajorNdisVersion, 1, 5 +HKR, NDIS, MinorNdisVersion, 1, 0 +HKR, Ndi\Interfaces, DefUpper, , "ndis5" +HKR, Ndi\Interfaces, UpperRange, , "ndis5" +HKR, Ndi\Interfaces, LowerRange, , "ethernet" +HKR, Ndi\Interfaces, DefLower, , "ethernet" +HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" +HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% +HKR, Ndi\Params\NetworkAddress, type, 0, "edit" +HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" +HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" +HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% +HKR, Ndi\Params\NetworkAddress, optional, 0, "0" +HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% +HKR, Ndi\Params\MaxSpeed, type, 0, "int" +HKR, Ndi\Params\MaxSpeed, default, 0, "100" +HKR, Ndi\Params\MaxSpeed, min, 0, "0" +HKR, Ndi\Params\MaxSpeed, max, 0, "2000" +HKR, Ndi\Params\MaxSpeed, step, 0, "1" +HKR, Ndi\Params\MaxSpeed, Base, 0, "10" +HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% +HKR, Ndi\Params\KeepLink, type, 0, "enum" +HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% +HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% +HKR, Ndi\Params\KeepLink, default, 0, "0" + + +[Neo.Service] +DisplayName = %Neo.Service.DispName% +Description = %Neo.Service.Desc% +ServiceType = 1 +StartType = 3 +ErrorControl = 1 +ServiceBinary = %12%\Neo6_x64_VPN50.sys +LoadOrderGroup = NDIS + +[Neo.Reg] +HKR, Ndi, Service, 0, Neo.Service.Name +HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" +HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" + +[Neo.EventLog] +HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo6_x64_VPN50.sys" +HKR, , TypesSupported, 0x00010001, 7 + +[Strings] +CompanyName = "SoftEther Corporation" +DiskDescription = "VPN Client Device Driver Install Disk" +Neo.Service.Name = "Neo_VPN50" +Neo.Service.DispName = "VPN Client Device Driver - VPN50" +Neo.Service.Desc = "VPN Client Adapter - VPN50" +NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN50" +Neo.EventLog.Name = "Neo" +NetworkAddress = "MAC Address" +DefaultAddress = "000001000001" +MaxSpeed = "Indicate Speed (Mbps)" +KeepLink = "Keep Link" +On = "On" +Off = "Off" + + +; Auto Generated 20180205_163624.880 + diff --git a/src/bin/hamcore/DriverPackages/Neo6_Win10/x64/Neo6_x64_VPN51.inf b/src/bin/hamcore/DriverPackages/Neo6_Win10/x64/Neo6_x64_VPN51.inf index a1a079b4..0aef5f2d 100644 --- a/src/bin/hamcore/DriverPackages/Neo6_Win10/x64/Neo6_x64_VPN51.inf +++ b/src/bin/hamcore/DriverPackages/Neo6_Win10/x64/Neo6_x64_VPN51.inf @@ -1,114 +1,114 @@ -; VPN Client Device Driver for Windows 2000 and Greater -; -; Copyright (c) SoftEther Corporation. All Rights Reserved. -; http://www.softether.co.jp/ -; -; BUILD 9658 - -[Version] -Signature = "$Windows NT$" -Class = Net -ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} -Provider = %CompanyName% -DriverVer = 02/04/2018, 4.25.0.9658 -CatalogFile.NT = Neo6_x64_VPN51.cat - -[Manufacturer] -%CompanyName% = SoftEther, NTamd64 - -[SourceDisksNames] -1=%DiskDescription%, "", , - -[SourceDisksFiles] -Neo6_x64_VPN51.sys = 1 - -[DestinationDirs] -DefaultDestDir = 12 -Neo.CopyFiles.Sys = 12 - -[Neo.CopyFiles.Sys] -Neo6_x64_VPN51.sys, , , 2 - -[SoftEther.NTamd64] -%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN51 - -[NeoAdapter.Install] -Characteristics = 0x1 -AddReg = Neo.Reg, NeoAdapter.Ndi -CopyFiles = Neo.CopyFiles.Sys -*IfType = 53 -*MediaType = 0 -*PhysicalMediaType = 0 - -[NeoAdapter.Install.Services] -AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% - -[NeoAdapter.Ndi] -HKR, , NetworkAddress, 0, %DefaultAddress% -HKR, Ndi, DeviceID, , "NeoAdapter_VPN51" -HKR, , DevLoader, , ndis -HKR, , DeviceVxDs, , Neo6_x64_VPN51.sys -HKR, NDIS, LogDriverName, , "Neo_VPN51" -HKR, NDIS, MajorNdisVersion, 1, 5 -HKR, NDIS, MinorNdisVersion, 1, 0 -HKR, Ndi\Interfaces, DefUpper, , "ndis5" -HKR, Ndi\Interfaces, UpperRange, , "ndis5" -HKR, Ndi\Interfaces, LowerRange, , "ethernet" -HKR, Ndi\Interfaces, DefLower, , "ethernet" -HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" -HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% -HKR, Ndi\Params\NetworkAddress, type, 0, "edit" -HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" -HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" -HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% -HKR, Ndi\Params\NetworkAddress, optional, 0, "0" -HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% -HKR, Ndi\Params\MaxSpeed, type, 0, "int" -HKR, Ndi\Params\MaxSpeed, default, 0, "100" -HKR, Ndi\Params\MaxSpeed, min, 0, "0" -HKR, Ndi\Params\MaxSpeed, max, 0, "2000" -HKR, Ndi\Params\MaxSpeed, step, 0, "1" -HKR, Ndi\Params\MaxSpeed, Base, 0, "10" -HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% -HKR, Ndi\Params\KeepLink, type, 0, "enum" -HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% -HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% -HKR, Ndi\Params\KeepLink, default, 0, "0" - - -[Neo.Service] -DisplayName = %Neo.Service.DispName% -Description = %Neo.Service.Desc% -ServiceType = 1 -StartType = 3 -ErrorControl = 1 -ServiceBinary = %12%\Neo6_x64_VPN51.sys -LoadOrderGroup = NDIS - -[Neo.Reg] -HKR, Ndi, Service, 0, Neo.Service.Name -HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" -HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" - -[Neo.EventLog] -HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo6_x64_VPN51.sys" -HKR, , TypesSupported, 0x00010001, 7 - -[Strings] -CompanyName = "SoftEther Corporation" -DiskDescription = "VPN Client Device Driver Install Disk" -Neo.Service.Name = "Neo_VPN51" -Neo.Service.DispName = "VPN Client Device Driver - VPN51" -Neo.Service.Desc = "VPN Client Adapter - VPN51" -NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN51" -Neo.EventLog.Name = "Neo" -NetworkAddress = "MAC Address" -DefaultAddress = "000001000001" -MaxSpeed = "Indicate Speed (Mbps)" -KeepLink = "Keep Link" -On = "On" -Off = "Off" - - -; Auto Generated 20180205_163624.951 - +; VPN Client Device Driver for Windows 2000 and Greater +; +; Copyright (c) SoftEther Corporation. All Rights Reserved. +; http://www.softether.co.jp/ +; +; BUILD 9658 + +[Version] +Signature = "$Windows NT$" +Class = Net +ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} +Provider = %CompanyName% +DriverVer = 02/04/2018, 4.25.0.9658 +CatalogFile.NT = Neo6_x64_VPN51.cat + +[Manufacturer] +%CompanyName% = SoftEther, NTamd64 + +[SourceDisksNames] +1=%DiskDescription%, "", , + +[SourceDisksFiles] +Neo6_x64_VPN51.sys = 1 + +[DestinationDirs] +DefaultDestDir = 12 +Neo.CopyFiles.Sys = 12 + +[Neo.CopyFiles.Sys] +Neo6_x64_VPN51.sys, , , 2 + +[SoftEther.NTamd64] +%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN51 + +[NeoAdapter.Install] +Characteristics = 0x1 +AddReg = Neo.Reg, NeoAdapter.Ndi +CopyFiles = Neo.CopyFiles.Sys +*IfType = 53 +*MediaType = 0 +*PhysicalMediaType = 0 + +[NeoAdapter.Install.Services] +AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% + +[NeoAdapter.Ndi] +HKR, , NetworkAddress, 0, %DefaultAddress% +HKR, Ndi, DeviceID, , "NeoAdapter_VPN51" +HKR, , DevLoader, , ndis +HKR, , DeviceVxDs, , Neo6_x64_VPN51.sys +HKR, NDIS, LogDriverName, , "Neo_VPN51" +HKR, NDIS, MajorNdisVersion, 1, 5 +HKR, NDIS, MinorNdisVersion, 1, 0 +HKR, Ndi\Interfaces, DefUpper, , "ndis5" +HKR, Ndi\Interfaces, UpperRange, , "ndis5" +HKR, Ndi\Interfaces, LowerRange, , "ethernet" +HKR, Ndi\Interfaces, DefLower, , "ethernet" +HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" +HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% +HKR, Ndi\Params\NetworkAddress, type, 0, "edit" +HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" +HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" +HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% +HKR, Ndi\Params\NetworkAddress, optional, 0, "0" +HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% +HKR, Ndi\Params\MaxSpeed, type, 0, "int" +HKR, Ndi\Params\MaxSpeed, default, 0, "100" +HKR, Ndi\Params\MaxSpeed, min, 0, "0" +HKR, Ndi\Params\MaxSpeed, max, 0, "2000" +HKR, Ndi\Params\MaxSpeed, step, 0, "1" +HKR, Ndi\Params\MaxSpeed, Base, 0, "10" +HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% +HKR, Ndi\Params\KeepLink, type, 0, "enum" +HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% +HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% +HKR, Ndi\Params\KeepLink, default, 0, "0" + + +[Neo.Service] +DisplayName = %Neo.Service.DispName% +Description = %Neo.Service.Desc% +ServiceType = 1 +StartType = 3 +ErrorControl = 1 +ServiceBinary = %12%\Neo6_x64_VPN51.sys +LoadOrderGroup = NDIS + +[Neo.Reg] +HKR, Ndi, Service, 0, Neo.Service.Name +HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" +HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" + +[Neo.EventLog] +HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo6_x64_VPN51.sys" +HKR, , TypesSupported, 0x00010001, 7 + +[Strings] +CompanyName = "SoftEther Corporation" +DiskDescription = "VPN Client Device Driver Install Disk" +Neo.Service.Name = "Neo_VPN51" +Neo.Service.DispName = "VPN Client Device Driver - VPN51" +Neo.Service.Desc = "VPN Client Adapter - VPN51" +NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN51" +Neo.EventLog.Name = "Neo" +NetworkAddress = "MAC Address" +DefaultAddress = "000001000001" +MaxSpeed = "Indicate Speed (Mbps)" +KeepLink = "Keep Link" +On = "On" +Off = "Off" + + +; Auto Generated 20180205_163624.951 + diff --git a/src/bin/hamcore/DriverPackages/Neo6_Win10/x64/Neo6_x64_VPN52.inf b/src/bin/hamcore/DriverPackages/Neo6_Win10/x64/Neo6_x64_VPN52.inf index 6e947dca..10968529 100644 --- a/src/bin/hamcore/DriverPackages/Neo6_Win10/x64/Neo6_x64_VPN52.inf +++ b/src/bin/hamcore/DriverPackages/Neo6_Win10/x64/Neo6_x64_VPN52.inf @@ -1,114 +1,114 @@ -; VPN Client Device Driver for Windows 2000 and Greater -; -; Copyright (c) SoftEther Corporation. All Rights Reserved. -; http://www.softether.co.jp/ -; -; BUILD 9658 - -[Version] -Signature = "$Windows NT$" -Class = Net -ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} -Provider = %CompanyName% -DriverVer = 02/04/2018, 4.25.0.9658 -CatalogFile.NT = Neo6_x64_VPN52.cat - -[Manufacturer] -%CompanyName% = SoftEther, NTamd64 - -[SourceDisksNames] -1=%DiskDescription%, "", , - -[SourceDisksFiles] -Neo6_x64_VPN52.sys = 1 - -[DestinationDirs] -DefaultDestDir = 12 -Neo.CopyFiles.Sys = 12 - -[Neo.CopyFiles.Sys] -Neo6_x64_VPN52.sys, , , 2 - -[SoftEther.NTamd64] -%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN52 - -[NeoAdapter.Install] -Characteristics = 0x1 -AddReg = Neo.Reg, NeoAdapter.Ndi -CopyFiles = Neo.CopyFiles.Sys -*IfType = 53 -*MediaType = 0 -*PhysicalMediaType = 0 - -[NeoAdapter.Install.Services] -AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% - -[NeoAdapter.Ndi] -HKR, , NetworkAddress, 0, %DefaultAddress% -HKR, Ndi, DeviceID, , "NeoAdapter_VPN52" -HKR, , DevLoader, , ndis -HKR, , DeviceVxDs, , Neo6_x64_VPN52.sys -HKR, NDIS, LogDriverName, , "Neo_VPN52" -HKR, NDIS, MajorNdisVersion, 1, 5 -HKR, NDIS, MinorNdisVersion, 1, 0 -HKR, Ndi\Interfaces, DefUpper, , "ndis5" -HKR, Ndi\Interfaces, UpperRange, , "ndis5" -HKR, Ndi\Interfaces, LowerRange, , "ethernet" -HKR, Ndi\Interfaces, DefLower, , "ethernet" -HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" -HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% -HKR, Ndi\Params\NetworkAddress, type, 0, "edit" -HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" -HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" -HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% -HKR, Ndi\Params\NetworkAddress, optional, 0, "0" -HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% -HKR, Ndi\Params\MaxSpeed, type, 0, "int" -HKR, Ndi\Params\MaxSpeed, default, 0, "100" -HKR, Ndi\Params\MaxSpeed, min, 0, "0" -HKR, Ndi\Params\MaxSpeed, max, 0, "2000" -HKR, Ndi\Params\MaxSpeed, step, 0, "1" -HKR, Ndi\Params\MaxSpeed, Base, 0, "10" -HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% -HKR, Ndi\Params\KeepLink, type, 0, "enum" -HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% -HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% -HKR, Ndi\Params\KeepLink, default, 0, "0" - - -[Neo.Service] -DisplayName = %Neo.Service.DispName% -Description = %Neo.Service.Desc% -ServiceType = 1 -StartType = 3 -ErrorControl = 1 -ServiceBinary = %12%\Neo6_x64_VPN52.sys -LoadOrderGroup = NDIS - -[Neo.Reg] -HKR, Ndi, Service, 0, Neo.Service.Name -HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" -HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" - -[Neo.EventLog] -HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo6_x64_VPN52.sys" -HKR, , TypesSupported, 0x00010001, 7 - -[Strings] -CompanyName = "SoftEther Corporation" -DiskDescription = "VPN Client Device Driver Install Disk" -Neo.Service.Name = "Neo_VPN52" -Neo.Service.DispName = "VPN Client Device Driver - VPN52" -Neo.Service.Desc = "VPN Client Adapter - VPN52" -NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN52" -Neo.EventLog.Name = "Neo" -NetworkAddress = "MAC Address" -DefaultAddress = "000001000001" -MaxSpeed = "Indicate Speed (Mbps)" -KeepLink = "Keep Link" -On = "On" -Off = "Off" - - -; Auto Generated 20180205_163625.021 - +; VPN Client Device Driver for Windows 2000 and Greater +; +; Copyright (c) SoftEther Corporation. All Rights Reserved. +; http://www.softether.co.jp/ +; +; BUILD 9658 + +[Version] +Signature = "$Windows NT$" +Class = Net +ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} +Provider = %CompanyName% +DriverVer = 02/04/2018, 4.25.0.9658 +CatalogFile.NT = Neo6_x64_VPN52.cat + +[Manufacturer] +%CompanyName% = SoftEther, NTamd64 + +[SourceDisksNames] +1=%DiskDescription%, "", , + +[SourceDisksFiles] +Neo6_x64_VPN52.sys = 1 + +[DestinationDirs] +DefaultDestDir = 12 +Neo.CopyFiles.Sys = 12 + +[Neo.CopyFiles.Sys] +Neo6_x64_VPN52.sys, , , 2 + +[SoftEther.NTamd64] +%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN52 + +[NeoAdapter.Install] +Characteristics = 0x1 +AddReg = Neo.Reg, NeoAdapter.Ndi +CopyFiles = Neo.CopyFiles.Sys +*IfType = 53 +*MediaType = 0 +*PhysicalMediaType = 0 + +[NeoAdapter.Install.Services] +AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% + +[NeoAdapter.Ndi] +HKR, , NetworkAddress, 0, %DefaultAddress% +HKR, Ndi, DeviceID, , "NeoAdapter_VPN52" +HKR, , DevLoader, , ndis +HKR, , DeviceVxDs, , Neo6_x64_VPN52.sys +HKR, NDIS, LogDriverName, , "Neo_VPN52" +HKR, NDIS, MajorNdisVersion, 1, 5 +HKR, NDIS, MinorNdisVersion, 1, 0 +HKR, Ndi\Interfaces, DefUpper, , "ndis5" +HKR, Ndi\Interfaces, UpperRange, , "ndis5" +HKR, Ndi\Interfaces, LowerRange, , "ethernet" +HKR, Ndi\Interfaces, DefLower, , "ethernet" +HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" +HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% +HKR, Ndi\Params\NetworkAddress, type, 0, "edit" +HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" +HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" +HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% +HKR, Ndi\Params\NetworkAddress, optional, 0, "0" +HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% +HKR, Ndi\Params\MaxSpeed, type, 0, "int" +HKR, Ndi\Params\MaxSpeed, default, 0, "100" +HKR, Ndi\Params\MaxSpeed, min, 0, "0" +HKR, Ndi\Params\MaxSpeed, max, 0, "2000" +HKR, Ndi\Params\MaxSpeed, step, 0, "1" +HKR, Ndi\Params\MaxSpeed, Base, 0, "10" +HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% +HKR, Ndi\Params\KeepLink, type, 0, "enum" +HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% +HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% +HKR, Ndi\Params\KeepLink, default, 0, "0" + + +[Neo.Service] +DisplayName = %Neo.Service.DispName% +Description = %Neo.Service.Desc% +ServiceType = 1 +StartType = 3 +ErrorControl = 1 +ServiceBinary = %12%\Neo6_x64_VPN52.sys +LoadOrderGroup = NDIS + +[Neo.Reg] +HKR, Ndi, Service, 0, Neo.Service.Name +HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" +HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" + +[Neo.EventLog] +HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo6_x64_VPN52.sys" +HKR, , TypesSupported, 0x00010001, 7 + +[Strings] +CompanyName = "SoftEther Corporation" +DiskDescription = "VPN Client Device Driver Install Disk" +Neo.Service.Name = "Neo_VPN52" +Neo.Service.DispName = "VPN Client Device Driver - VPN52" +Neo.Service.Desc = "VPN Client Adapter - VPN52" +NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN52" +Neo.EventLog.Name = "Neo" +NetworkAddress = "MAC Address" +DefaultAddress = "000001000001" +MaxSpeed = "Indicate Speed (Mbps)" +KeepLink = "Keep Link" +On = "On" +Off = "Off" + + +; Auto Generated 20180205_163625.021 + diff --git a/src/bin/hamcore/DriverPackages/Neo6_Win10/x64/Neo6_x64_VPN53.inf b/src/bin/hamcore/DriverPackages/Neo6_Win10/x64/Neo6_x64_VPN53.inf index 2f5fea18..204cf0b9 100644 --- a/src/bin/hamcore/DriverPackages/Neo6_Win10/x64/Neo6_x64_VPN53.inf +++ b/src/bin/hamcore/DriverPackages/Neo6_Win10/x64/Neo6_x64_VPN53.inf @@ -1,114 +1,114 @@ -; VPN Client Device Driver for Windows 2000 and Greater -; -; Copyright (c) SoftEther Corporation. All Rights Reserved. -; http://www.softether.co.jp/ -; -; BUILD 9658 - -[Version] -Signature = "$Windows NT$" -Class = Net -ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} -Provider = %CompanyName% -DriverVer = 02/04/2018, 4.25.0.9658 -CatalogFile.NT = Neo6_x64_VPN53.cat - -[Manufacturer] -%CompanyName% = SoftEther, NTamd64 - -[SourceDisksNames] -1=%DiskDescription%, "", , - -[SourceDisksFiles] -Neo6_x64_VPN53.sys = 1 - -[DestinationDirs] -DefaultDestDir = 12 -Neo.CopyFiles.Sys = 12 - -[Neo.CopyFiles.Sys] -Neo6_x64_VPN53.sys, , , 2 - -[SoftEther.NTamd64] -%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN53 - -[NeoAdapter.Install] -Characteristics = 0x1 -AddReg = Neo.Reg, NeoAdapter.Ndi -CopyFiles = Neo.CopyFiles.Sys -*IfType = 53 -*MediaType = 0 -*PhysicalMediaType = 0 - -[NeoAdapter.Install.Services] -AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% - -[NeoAdapter.Ndi] -HKR, , NetworkAddress, 0, %DefaultAddress% -HKR, Ndi, DeviceID, , "NeoAdapter_VPN53" -HKR, , DevLoader, , ndis -HKR, , DeviceVxDs, , Neo6_x64_VPN53.sys -HKR, NDIS, LogDriverName, , "Neo_VPN53" -HKR, NDIS, MajorNdisVersion, 1, 5 -HKR, NDIS, MinorNdisVersion, 1, 0 -HKR, Ndi\Interfaces, DefUpper, , "ndis5" -HKR, Ndi\Interfaces, UpperRange, , "ndis5" -HKR, Ndi\Interfaces, LowerRange, , "ethernet" -HKR, Ndi\Interfaces, DefLower, , "ethernet" -HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" -HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% -HKR, Ndi\Params\NetworkAddress, type, 0, "edit" -HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" -HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" -HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% -HKR, Ndi\Params\NetworkAddress, optional, 0, "0" -HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% -HKR, Ndi\Params\MaxSpeed, type, 0, "int" -HKR, Ndi\Params\MaxSpeed, default, 0, "100" -HKR, Ndi\Params\MaxSpeed, min, 0, "0" -HKR, Ndi\Params\MaxSpeed, max, 0, "2000" -HKR, Ndi\Params\MaxSpeed, step, 0, "1" -HKR, Ndi\Params\MaxSpeed, Base, 0, "10" -HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% -HKR, Ndi\Params\KeepLink, type, 0, "enum" -HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% -HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% -HKR, Ndi\Params\KeepLink, default, 0, "0" - - -[Neo.Service] -DisplayName = %Neo.Service.DispName% -Description = %Neo.Service.Desc% -ServiceType = 1 -StartType = 3 -ErrorControl = 1 -ServiceBinary = %12%\Neo6_x64_VPN53.sys -LoadOrderGroup = NDIS - -[Neo.Reg] -HKR, Ndi, Service, 0, Neo.Service.Name -HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" -HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" - -[Neo.EventLog] -HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo6_x64_VPN53.sys" -HKR, , TypesSupported, 0x00010001, 7 - -[Strings] -CompanyName = "SoftEther Corporation" -DiskDescription = "VPN Client Device Driver Install Disk" -Neo.Service.Name = "Neo_VPN53" -Neo.Service.DispName = "VPN Client Device Driver - VPN53" -Neo.Service.Desc = "VPN Client Adapter - VPN53" -NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN53" -Neo.EventLog.Name = "Neo" -NetworkAddress = "MAC Address" -DefaultAddress = "000001000001" -MaxSpeed = "Indicate Speed (Mbps)" -KeepLink = "Keep Link" -On = "On" -Off = "Off" - - -; Auto Generated 20180205_163625.093 - +; VPN Client Device Driver for Windows 2000 and Greater +; +; Copyright (c) SoftEther Corporation. All Rights Reserved. +; http://www.softether.co.jp/ +; +; BUILD 9658 + +[Version] +Signature = "$Windows NT$" +Class = Net +ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} +Provider = %CompanyName% +DriverVer = 02/04/2018, 4.25.0.9658 +CatalogFile.NT = Neo6_x64_VPN53.cat + +[Manufacturer] +%CompanyName% = SoftEther, NTamd64 + +[SourceDisksNames] +1=%DiskDescription%, "", , + +[SourceDisksFiles] +Neo6_x64_VPN53.sys = 1 + +[DestinationDirs] +DefaultDestDir = 12 +Neo.CopyFiles.Sys = 12 + +[Neo.CopyFiles.Sys] +Neo6_x64_VPN53.sys, , , 2 + +[SoftEther.NTamd64] +%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN53 + +[NeoAdapter.Install] +Characteristics = 0x1 +AddReg = Neo.Reg, NeoAdapter.Ndi +CopyFiles = Neo.CopyFiles.Sys +*IfType = 53 +*MediaType = 0 +*PhysicalMediaType = 0 + +[NeoAdapter.Install.Services] +AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% + +[NeoAdapter.Ndi] +HKR, , NetworkAddress, 0, %DefaultAddress% +HKR, Ndi, DeviceID, , "NeoAdapter_VPN53" +HKR, , DevLoader, , ndis +HKR, , DeviceVxDs, , Neo6_x64_VPN53.sys +HKR, NDIS, LogDriverName, , "Neo_VPN53" +HKR, NDIS, MajorNdisVersion, 1, 5 +HKR, NDIS, MinorNdisVersion, 1, 0 +HKR, Ndi\Interfaces, DefUpper, , "ndis5" +HKR, Ndi\Interfaces, UpperRange, , "ndis5" +HKR, Ndi\Interfaces, LowerRange, , "ethernet" +HKR, Ndi\Interfaces, DefLower, , "ethernet" +HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" +HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% +HKR, Ndi\Params\NetworkAddress, type, 0, "edit" +HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" +HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" +HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% +HKR, Ndi\Params\NetworkAddress, optional, 0, "0" +HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% +HKR, Ndi\Params\MaxSpeed, type, 0, "int" +HKR, Ndi\Params\MaxSpeed, default, 0, "100" +HKR, Ndi\Params\MaxSpeed, min, 0, "0" +HKR, Ndi\Params\MaxSpeed, max, 0, "2000" +HKR, Ndi\Params\MaxSpeed, step, 0, "1" +HKR, Ndi\Params\MaxSpeed, Base, 0, "10" +HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% +HKR, Ndi\Params\KeepLink, type, 0, "enum" +HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% +HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% +HKR, Ndi\Params\KeepLink, default, 0, "0" + + +[Neo.Service] +DisplayName = %Neo.Service.DispName% +Description = %Neo.Service.Desc% +ServiceType = 1 +StartType = 3 +ErrorControl = 1 +ServiceBinary = %12%\Neo6_x64_VPN53.sys +LoadOrderGroup = NDIS + +[Neo.Reg] +HKR, Ndi, Service, 0, Neo.Service.Name +HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" +HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" + +[Neo.EventLog] +HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo6_x64_VPN53.sys" +HKR, , TypesSupported, 0x00010001, 7 + +[Strings] +CompanyName = "SoftEther Corporation" +DiskDescription = "VPN Client Device Driver Install Disk" +Neo.Service.Name = "Neo_VPN53" +Neo.Service.DispName = "VPN Client Device Driver - VPN53" +Neo.Service.Desc = "VPN Client Adapter - VPN53" +NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN53" +Neo.EventLog.Name = "Neo" +NetworkAddress = "MAC Address" +DefaultAddress = "000001000001" +MaxSpeed = "Indicate Speed (Mbps)" +KeepLink = "Keep Link" +On = "On" +Off = "Off" + + +; Auto Generated 20180205_163625.093 + diff --git a/src/bin/hamcore/DriverPackages/Neo6_Win10/x64/Neo6_x64_VPN54.inf b/src/bin/hamcore/DriverPackages/Neo6_Win10/x64/Neo6_x64_VPN54.inf index cec2260b..4b04a00e 100644 --- a/src/bin/hamcore/DriverPackages/Neo6_Win10/x64/Neo6_x64_VPN54.inf +++ b/src/bin/hamcore/DriverPackages/Neo6_Win10/x64/Neo6_x64_VPN54.inf @@ -1,114 +1,114 @@ -; VPN Client Device Driver for Windows 2000 and Greater -; -; Copyright (c) SoftEther Corporation. All Rights Reserved. -; http://www.softether.co.jp/ -; -; BUILD 9658 - -[Version] -Signature = "$Windows NT$" -Class = Net -ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} -Provider = %CompanyName% -DriverVer = 02/04/2018, 4.25.0.9658 -CatalogFile.NT = Neo6_x64_VPN54.cat - -[Manufacturer] -%CompanyName% = SoftEther, NTamd64 - -[SourceDisksNames] -1=%DiskDescription%, "", , - -[SourceDisksFiles] -Neo6_x64_VPN54.sys = 1 - -[DestinationDirs] -DefaultDestDir = 12 -Neo.CopyFiles.Sys = 12 - -[Neo.CopyFiles.Sys] -Neo6_x64_VPN54.sys, , , 2 - -[SoftEther.NTamd64] -%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN54 - -[NeoAdapter.Install] -Characteristics = 0x1 -AddReg = Neo.Reg, NeoAdapter.Ndi -CopyFiles = Neo.CopyFiles.Sys -*IfType = 53 -*MediaType = 0 -*PhysicalMediaType = 0 - -[NeoAdapter.Install.Services] -AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% - -[NeoAdapter.Ndi] -HKR, , NetworkAddress, 0, %DefaultAddress% -HKR, Ndi, DeviceID, , "NeoAdapter_VPN54" -HKR, , DevLoader, , ndis -HKR, , DeviceVxDs, , Neo6_x64_VPN54.sys -HKR, NDIS, LogDriverName, , "Neo_VPN54" -HKR, NDIS, MajorNdisVersion, 1, 5 -HKR, NDIS, MinorNdisVersion, 1, 0 -HKR, Ndi\Interfaces, DefUpper, , "ndis5" -HKR, Ndi\Interfaces, UpperRange, , "ndis5" -HKR, Ndi\Interfaces, LowerRange, , "ethernet" -HKR, Ndi\Interfaces, DefLower, , "ethernet" -HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" -HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% -HKR, Ndi\Params\NetworkAddress, type, 0, "edit" -HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" -HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" -HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% -HKR, Ndi\Params\NetworkAddress, optional, 0, "0" -HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% -HKR, Ndi\Params\MaxSpeed, type, 0, "int" -HKR, Ndi\Params\MaxSpeed, default, 0, "100" -HKR, Ndi\Params\MaxSpeed, min, 0, "0" -HKR, Ndi\Params\MaxSpeed, max, 0, "2000" -HKR, Ndi\Params\MaxSpeed, step, 0, "1" -HKR, Ndi\Params\MaxSpeed, Base, 0, "10" -HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% -HKR, Ndi\Params\KeepLink, type, 0, "enum" -HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% -HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% -HKR, Ndi\Params\KeepLink, default, 0, "0" - - -[Neo.Service] -DisplayName = %Neo.Service.DispName% -Description = %Neo.Service.Desc% -ServiceType = 1 -StartType = 3 -ErrorControl = 1 -ServiceBinary = %12%\Neo6_x64_VPN54.sys -LoadOrderGroup = NDIS - -[Neo.Reg] -HKR, Ndi, Service, 0, Neo.Service.Name -HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" -HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" - -[Neo.EventLog] -HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo6_x64_VPN54.sys" -HKR, , TypesSupported, 0x00010001, 7 - -[Strings] -CompanyName = "SoftEther Corporation" -DiskDescription = "VPN Client Device Driver Install Disk" -Neo.Service.Name = "Neo_VPN54" -Neo.Service.DispName = "VPN Client Device Driver - VPN54" -Neo.Service.Desc = "VPN Client Adapter - VPN54" -NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN54" -Neo.EventLog.Name = "Neo" -NetworkAddress = "MAC Address" -DefaultAddress = "000001000001" -MaxSpeed = "Indicate Speed (Mbps)" -KeepLink = "Keep Link" -On = "On" -Off = "Off" - - -; Auto Generated 20180205_163625.164 - +; VPN Client Device Driver for Windows 2000 and Greater +; +; Copyright (c) SoftEther Corporation. All Rights Reserved. +; http://www.softether.co.jp/ +; +; BUILD 9658 + +[Version] +Signature = "$Windows NT$" +Class = Net +ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} +Provider = %CompanyName% +DriverVer = 02/04/2018, 4.25.0.9658 +CatalogFile.NT = Neo6_x64_VPN54.cat + +[Manufacturer] +%CompanyName% = SoftEther, NTamd64 + +[SourceDisksNames] +1=%DiskDescription%, "", , + +[SourceDisksFiles] +Neo6_x64_VPN54.sys = 1 + +[DestinationDirs] +DefaultDestDir = 12 +Neo.CopyFiles.Sys = 12 + +[Neo.CopyFiles.Sys] +Neo6_x64_VPN54.sys, , , 2 + +[SoftEther.NTamd64] +%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN54 + +[NeoAdapter.Install] +Characteristics = 0x1 +AddReg = Neo.Reg, NeoAdapter.Ndi +CopyFiles = Neo.CopyFiles.Sys +*IfType = 53 +*MediaType = 0 +*PhysicalMediaType = 0 + +[NeoAdapter.Install.Services] +AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% + +[NeoAdapter.Ndi] +HKR, , NetworkAddress, 0, %DefaultAddress% +HKR, Ndi, DeviceID, , "NeoAdapter_VPN54" +HKR, , DevLoader, , ndis +HKR, , DeviceVxDs, , Neo6_x64_VPN54.sys +HKR, NDIS, LogDriverName, , "Neo_VPN54" +HKR, NDIS, MajorNdisVersion, 1, 5 +HKR, NDIS, MinorNdisVersion, 1, 0 +HKR, Ndi\Interfaces, DefUpper, , "ndis5" +HKR, Ndi\Interfaces, UpperRange, , "ndis5" +HKR, Ndi\Interfaces, LowerRange, , "ethernet" +HKR, Ndi\Interfaces, DefLower, , "ethernet" +HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" +HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% +HKR, Ndi\Params\NetworkAddress, type, 0, "edit" +HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" +HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" +HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% +HKR, Ndi\Params\NetworkAddress, optional, 0, "0" +HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% +HKR, Ndi\Params\MaxSpeed, type, 0, "int" +HKR, Ndi\Params\MaxSpeed, default, 0, "100" +HKR, Ndi\Params\MaxSpeed, min, 0, "0" +HKR, Ndi\Params\MaxSpeed, max, 0, "2000" +HKR, Ndi\Params\MaxSpeed, step, 0, "1" +HKR, Ndi\Params\MaxSpeed, Base, 0, "10" +HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% +HKR, Ndi\Params\KeepLink, type, 0, "enum" +HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% +HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% +HKR, Ndi\Params\KeepLink, default, 0, "0" + + +[Neo.Service] +DisplayName = %Neo.Service.DispName% +Description = %Neo.Service.Desc% +ServiceType = 1 +StartType = 3 +ErrorControl = 1 +ServiceBinary = %12%\Neo6_x64_VPN54.sys +LoadOrderGroup = NDIS + +[Neo.Reg] +HKR, Ndi, Service, 0, Neo.Service.Name +HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" +HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" + +[Neo.EventLog] +HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo6_x64_VPN54.sys" +HKR, , TypesSupported, 0x00010001, 7 + +[Strings] +CompanyName = "SoftEther Corporation" +DiskDescription = "VPN Client Device Driver Install Disk" +Neo.Service.Name = "Neo_VPN54" +Neo.Service.DispName = "VPN Client Device Driver - VPN54" +Neo.Service.Desc = "VPN Client Adapter - VPN54" +NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN54" +Neo.EventLog.Name = "Neo" +NetworkAddress = "MAC Address" +DefaultAddress = "000001000001" +MaxSpeed = "Indicate Speed (Mbps)" +KeepLink = "Keep Link" +On = "On" +Off = "Off" + + +; Auto Generated 20180205_163625.164 + diff --git a/src/bin/hamcore/DriverPackages/Neo6_Win10/x64/Neo6_x64_VPN55.inf b/src/bin/hamcore/DriverPackages/Neo6_Win10/x64/Neo6_x64_VPN55.inf index 5fe45837..93ea5d9a 100644 --- a/src/bin/hamcore/DriverPackages/Neo6_Win10/x64/Neo6_x64_VPN55.inf +++ b/src/bin/hamcore/DriverPackages/Neo6_Win10/x64/Neo6_x64_VPN55.inf @@ -1,114 +1,114 @@ -; VPN Client Device Driver for Windows 2000 and Greater -; -; Copyright (c) SoftEther Corporation. All Rights Reserved. -; http://www.softether.co.jp/ -; -; BUILD 9658 - -[Version] -Signature = "$Windows NT$" -Class = Net -ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} -Provider = %CompanyName% -DriverVer = 02/04/2018, 4.25.0.9658 -CatalogFile.NT = Neo6_x64_VPN55.cat - -[Manufacturer] -%CompanyName% = SoftEther, NTamd64 - -[SourceDisksNames] -1=%DiskDescription%, "", , - -[SourceDisksFiles] -Neo6_x64_VPN55.sys = 1 - -[DestinationDirs] -DefaultDestDir = 12 -Neo.CopyFiles.Sys = 12 - -[Neo.CopyFiles.Sys] -Neo6_x64_VPN55.sys, , , 2 - -[SoftEther.NTamd64] -%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN55 - -[NeoAdapter.Install] -Characteristics = 0x1 -AddReg = Neo.Reg, NeoAdapter.Ndi -CopyFiles = Neo.CopyFiles.Sys -*IfType = 53 -*MediaType = 0 -*PhysicalMediaType = 0 - -[NeoAdapter.Install.Services] -AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% - -[NeoAdapter.Ndi] -HKR, , NetworkAddress, 0, %DefaultAddress% -HKR, Ndi, DeviceID, , "NeoAdapter_VPN55" -HKR, , DevLoader, , ndis -HKR, , DeviceVxDs, , Neo6_x64_VPN55.sys -HKR, NDIS, LogDriverName, , "Neo_VPN55" -HKR, NDIS, MajorNdisVersion, 1, 5 -HKR, NDIS, MinorNdisVersion, 1, 0 -HKR, Ndi\Interfaces, DefUpper, , "ndis5" -HKR, Ndi\Interfaces, UpperRange, , "ndis5" -HKR, Ndi\Interfaces, LowerRange, , "ethernet" -HKR, Ndi\Interfaces, DefLower, , "ethernet" -HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" -HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% -HKR, Ndi\Params\NetworkAddress, type, 0, "edit" -HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" -HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" -HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% -HKR, Ndi\Params\NetworkAddress, optional, 0, "0" -HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% -HKR, Ndi\Params\MaxSpeed, type, 0, "int" -HKR, Ndi\Params\MaxSpeed, default, 0, "100" -HKR, Ndi\Params\MaxSpeed, min, 0, "0" -HKR, Ndi\Params\MaxSpeed, max, 0, "2000" -HKR, Ndi\Params\MaxSpeed, step, 0, "1" -HKR, Ndi\Params\MaxSpeed, Base, 0, "10" -HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% -HKR, Ndi\Params\KeepLink, type, 0, "enum" -HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% -HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% -HKR, Ndi\Params\KeepLink, default, 0, "0" - - -[Neo.Service] -DisplayName = %Neo.Service.DispName% -Description = %Neo.Service.Desc% -ServiceType = 1 -StartType = 3 -ErrorControl = 1 -ServiceBinary = %12%\Neo6_x64_VPN55.sys -LoadOrderGroup = NDIS - -[Neo.Reg] -HKR, Ndi, Service, 0, Neo.Service.Name -HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" -HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" - -[Neo.EventLog] -HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo6_x64_VPN55.sys" -HKR, , TypesSupported, 0x00010001, 7 - -[Strings] -CompanyName = "SoftEther Corporation" -DiskDescription = "VPN Client Device Driver Install Disk" -Neo.Service.Name = "Neo_VPN55" -Neo.Service.DispName = "VPN Client Device Driver - VPN55" -Neo.Service.Desc = "VPN Client Adapter - VPN55" -NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN55" -Neo.EventLog.Name = "Neo" -NetworkAddress = "MAC Address" -DefaultAddress = "000001000001" -MaxSpeed = "Indicate Speed (Mbps)" -KeepLink = "Keep Link" -On = "On" -Off = "Off" - - -; Auto Generated 20180205_163625.234 - +; VPN Client Device Driver for Windows 2000 and Greater +; +; Copyright (c) SoftEther Corporation. All Rights Reserved. +; http://www.softether.co.jp/ +; +; BUILD 9658 + +[Version] +Signature = "$Windows NT$" +Class = Net +ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} +Provider = %CompanyName% +DriverVer = 02/04/2018, 4.25.0.9658 +CatalogFile.NT = Neo6_x64_VPN55.cat + +[Manufacturer] +%CompanyName% = SoftEther, NTamd64 + +[SourceDisksNames] +1=%DiskDescription%, "", , + +[SourceDisksFiles] +Neo6_x64_VPN55.sys = 1 + +[DestinationDirs] +DefaultDestDir = 12 +Neo.CopyFiles.Sys = 12 + +[Neo.CopyFiles.Sys] +Neo6_x64_VPN55.sys, , , 2 + +[SoftEther.NTamd64] +%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN55 + +[NeoAdapter.Install] +Characteristics = 0x1 +AddReg = Neo.Reg, NeoAdapter.Ndi +CopyFiles = Neo.CopyFiles.Sys +*IfType = 53 +*MediaType = 0 +*PhysicalMediaType = 0 + +[NeoAdapter.Install.Services] +AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% + +[NeoAdapter.Ndi] +HKR, , NetworkAddress, 0, %DefaultAddress% +HKR, Ndi, DeviceID, , "NeoAdapter_VPN55" +HKR, , DevLoader, , ndis +HKR, , DeviceVxDs, , Neo6_x64_VPN55.sys +HKR, NDIS, LogDriverName, , "Neo_VPN55" +HKR, NDIS, MajorNdisVersion, 1, 5 +HKR, NDIS, MinorNdisVersion, 1, 0 +HKR, Ndi\Interfaces, DefUpper, , "ndis5" +HKR, Ndi\Interfaces, UpperRange, , "ndis5" +HKR, Ndi\Interfaces, LowerRange, , "ethernet" +HKR, Ndi\Interfaces, DefLower, , "ethernet" +HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" +HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% +HKR, Ndi\Params\NetworkAddress, type, 0, "edit" +HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" +HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" +HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% +HKR, Ndi\Params\NetworkAddress, optional, 0, "0" +HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% +HKR, Ndi\Params\MaxSpeed, type, 0, "int" +HKR, Ndi\Params\MaxSpeed, default, 0, "100" +HKR, Ndi\Params\MaxSpeed, min, 0, "0" +HKR, Ndi\Params\MaxSpeed, max, 0, "2000" +HKR, Ndi\Params\MaxSpeed, step, 0, "1" +HKR, Ndi\Params\MaxSpeed, Base, 0, "10" +HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% +HKR, Ndi\Params\KeepLink, type, 0, "enum" +HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% +HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% +HKR, Ndi\Params\KeepLink, default, 0, "0" + + +[Neo.Service] +DisplayName = %Neo.Service.DispName% +Description = %Neo.Service.Desc% +ServiceType = 1 +StartType = 3 +ErrorControl = 1 +ServiceBinary = %12%\Neo6_x64_VPN55.sys +LoadOrderGroup = NDIS + +[Neo.Reg] +HKR, Ndi, Service, 0, Neo.Service.Name +HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" +HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" + +[Neo.EventLog] +HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo6_x64_VPN55.sys" +HKR, , TypesSupported, 0x00010001, 7 + +[Strings] +CompanyName = "SoftEther Corporation" +DiskDescription = "VPN Client Device Driver Install Disk" +Neo.Service.Name = "Neo_VPN55" +Neo.Service.DispName = "VPN Client Device Driver - VPN55" +Neo.Service.Desc = "VPN Client Adapter - VPN55" +NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN55" +Neo.EventLog.Name = "Neo" +NetworkAddress = "MAC Address" +DefaultAddress = "000001000001" +MaxSpeed = "Indicate Speed (Mbps)" +KeepLink = "Keep Link" +On = "On" +Off = "Off" + + +; Auto Generated 20180205_163625.234 + diff --git a/src/bin/hamcore/DriverPackages/Neo6_Win10/x64/Neo6_x64_VPN56.inf b/src/bin/hamcore/DriverPackages/Neo6_Win10/x64/Neo6_x64_VPN56.inf index 5c0989f3..5815fc4c 100644 --- a/src/bin/hamcore/DriverPackages/Neo6_Win10/x64/Neo6_x64_VPN56.inf +++ b/src/bin/hamcore/DriverPackages/Neo6_Win10/x64/Neo6_x64_VPN56.inf @@ -1,114 +1,114 @@ -; VPN Client Device Driver for Windows 2000 and Greater -; -; Copyright (c) SoftEther Corporation. All Rights Reserved. -; http://www.softether.co.jp/ -; -; BUILD 9658 - -[Version] -Signature = "$Windows NT$" -Class = Net -ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} -Provider = %CompanyName% -DriverVer = 02/04/2018, 4.25.0.9658 -CatalogFile.NT = Neo6_x64_VPN56.cat - -[Manufacturer] -%CompanyName% = SoftEther, NTamd64 - -[SourceDisksNames] -1=%DiskDescription%, "", , - -[SourceDisksFiles] -Neo6_x64_VPN56.sys = 1 - -[DestinationDirs] -DefaultDestDir = 12 -Neo.CopyFiles.Sys = 12 - -[Neo.CopyFiles.Sys] -Neo6_x64_VPN56.sys, , , 2 - -[SoftEther.NTamd64] -%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN56 - -[NeoAdapter.Install] -Characteristics = 0x1 -AddReg = Neo.Reg, NeoAdapter.Ndi -CopyFiles = Neo.CopyFiles.Sys -*IfType = 53 -*MediaType = 0 -*PhysicalMediaType = 0 - -[NeoAdapter.Install.Services] -AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% - -[NeoAdapter.Ndi] -HKR, , NetworkAddress, 0, %DefaultAddress% -HKR, Ndi, DeviceID, , "NeoAdapter_VPN56" -HKR, , DevLoader, , ndis -HKR, , DeviceVxDs, , Neo6_x64_VPN56.sys -HKR, NDIS, LogDriverName, , "Neo_VPN56" -HKR, NDIS, MajorNdisVersion, 1, 5 -HKR, NDIS, MinorNdisVersion, 1, 0 -HKR, Ndi\Interfaces, DefUpper, , "ndis5" -HKR, Ndi\Interfaces, UpperRange, , "ndis5" -HKR, Ndi\Interfaces, LowerRange, , "ethernet" -HKR, Ndi\Interfaces, DefLower, , "ethernet" -HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" -HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% -HKR, Ndi\Params\NetworkAddress, type, 0, "edit" -HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" -HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" -HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% -HKR, Ndi\Params\NetworkAddress, optional, 0, "0" -HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% -HKR, Ndi\Params\MaxSpeed, type, 0, "int" -HKR, Ndi\Params\MaxSpeed, default, 0, "100" -HKR, Ndi\Params\MaxSpeed, min, 0, "0" -HKR, Ndi\Params\MaxSpeed, max, 0, "2000" -HKR, Ndi\Params\MaxSpeed, step, 0, "1" -HKR, Ndi\Params\MaxSpeed, Base, 0, "10" -HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% -HKR, Ndi\Params\KeepLink, type, 0, "enum" -HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% -HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% -HKR, Ndi\Params\KeepLink, default, 0, "0" - - -[Neo.Service] -DisplayName = %Neo.Service.DispName% -Description = %Neo.Service.Desc% -ServiceType = 1 -StartType = 3 -ErrorControl = 1 -ServiceBinary = %12%\Neo6_x64_VPN56.sys -LoadOrderGroup = NDIS - -[Neo.Reg] -HKR, Ndi, Service, 0, Neo.Service.Name -HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" -HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" - -[Neo.EventLog] -HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo6_x64_VPN56.sys" -HKR, , TypesSupported, 0x00010001, 7 - -[Strings] -CompanyName = "SoftEther Corporation" -DiskDescription = "VPN Client Device Driver Install Disk" -Neo.Service.Name = "Neo_VPN56" -Neo.Service.DispName = "VPN Client Device Driver - VPN56" -Neo.Service.Desc = "VPN Client Adapter - VPN56" -NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN56" -Neo.EventLog.Name = "Neo" -NetworkAddress = "MAC Address" -DefaultAddress = "000001000001" -MaxSpeed = "Indicate Speed (Mbps)" -KeepLink = "Keep Link" -On = "On" -Off = "Off" - - -; Auto Generated 20180205_163625.304 - +; VPN Client Device Driver for Windows 2000 and Greater +; +; Copyright (c) SoftEther Corporation. All Rights Reserved. +; http://www.softether.co.jp/ +; +; BUILD 9658 + +[Version] +Signature = "$Windows NT$" +Class = Net +ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} +Provider = %CompanyName% +DriverVer = 02/04/2018, 4.25.0.9658 +CatalogFile.NT = Neo6_x64_VPN56.cat + +[Manufacturer] +%CompanyName% = SoftEther, NTamd64 + +[SourceDisksNames] +1=%DiskDescription%, "", , + +[SourceDisksFiles] +Neo6_x64_VPN56.sys = 1 + +[DestinationDirs] +DefaultDestDir = 12 +Neo.CopyFiles.Sys = 12 + +[Neo.CopyFiles.Sys] +Neo6_x64_VPN56.sys, , , 2 + +[SoftEther.NTamd64] +%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN56 + +[NeoAdapter.Install] +Characteristics = 0x1 +AddReg = Neo.Reg, NeoAdapter.Ndi +CopyFiles = Neo.CopyFiles.Sys +*IfType = 53 +*MediaType = 0 +*PhysicalMediaType = 0 + +[NeoAdapter.Install.Services] +AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% + +[NeoAdapter.Ndi] +HKR, , NetworkAddress, 0, %DefaultAddress% +HKR, Ndi, DeviceID, , "NeoAdapter_VPN56" +HKR, , DevLoader, , ndis +HKR, , DeviceVxDs, , Neo6_x64_VPN56.sys +HKR, NDIS, LogDriverName, , "Neo_VPN56" +HKR, NDIS, MajorNdisVersion, 1, 5 +HKR, NDIS, MinorNdisVersion, 1, 0 +HKR, Ndi\Interfaces, DefUpper, , "ndis5" +HKR, Ndi\Interfaces, UpperRange, , "ndis5" +HKR, Ndi\Interfaces, LowerRange, , "ethernet" +HKR, Ndi\Interfaces, DefLower, , "ethernet" +HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" +HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% +HKR, Ndi\Params\NetworkAddress, type, 0, "edit" +HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" +HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" +HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% +HKR, Ndi\Params\NetworkAddress, optional, 0, "0" +HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% +HKR, Ndi\Params\MaxSpeed, type, 0, "int" +HKR, Ndi\Params\MaxSpeed, default, 0, "100" +HKR, Ndi\Params\MaxSpeed, min, 0, "0" +HKR, Ndi\Params\MaxSpeed, max, 0, "2000" +HKR, Ndi\Params\MaxSpeed, step, 0, "1" +HKR, Ndi\Params\MaxSpeed, Base, 0, "10" +HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% +HKR, Ndi\Params\KeepLink, type, 0, "enum" +HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% +HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% +HKR, Ndi\Params\KeepLink, default, 0, "0" + + +[Neo.Service] +DisplayName = %Neo.Service.DispName% +Description = %Neo.Service.Desc% +ServiceType = 1 +StartType = 3 +ErrorControl = 1 +ServiceBinary = %12%\Neo6_x64_VPN56.sys +LoadOrderGroup = NDIS + +[Neo.Reg] +HKR, Ndi, Service, 0, Neo.Service.Name +HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" +HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" + +[Neo.EventLog] +HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo6_x64_VPN56.sys" +HKR, , TypesSupported, 0x00010001, 7 + +[Strings] +CompanyName = "SoftEther Corporation" +DiskDescription = "VPN Client Device Driver Install Disk" +Neo.Service.Name = "Neo_VPN56" +Neo.Service.DispName = "VPN Client Device Driver - VPN56" +Neo.Service.Desc = "VPN Client Adapter - VPN56" +NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN56" +Neo.EventLog.Name = "Neo" +NetworkAddress = "MAC Address" +DefaultAddress = "000001000001" +MaxSpeed = "Indicate Speed (Mbps)" +KeepLink = "Keep Link" +On = "On" +Off = "Off" + + +; Auto Generated 20180205_163625.304 + diff --git a/src/bin/hamcore/DriverPackages/Neo6_Win10/x64/Neo6_x64_VPN57.inf b/src/bin/hamcore/DriverPackages/Neo6_Win10/x64/Neo6_x64_VPN57.inf index fa51f47c..f74e415d 100644 --- a/src/bin/hamcore/DriverPackages/Neo6_Win10/x64/Neo6_x64_VPN57.inf +++ b/src/bin/hamcore/DriverPackages/Neo6_Win10/x64/Neo6_x64_VPN57.inf @@ -1,114 +1,114 @@ -; VPN Client Device Driver for Windows 2000 and Greater -; -; Copyright (c) SoftEther Corporation. All Rights Reserved. -; http://www.softether.co.jp/ -; -; BUILD 9658 - -[Version] -Signature = "$Windows NT$" -Class = Net -ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} -Provider = %CompanyName% -DriverVer = 02/04/2018, 4.25.0.9658 -CatalogFile.NT = Neo6_x64_VPN57.cat - -[Manufacturer] -%CompanyName% = SoftEther, NTamd64 - -[SourceDisksNames] -1=%DiskDescription%, "", , - -[SourceDisksFiles] -Neo6_x64_VPN57.sys = 1 - -[DestinationDirs] -DefaultDestDir = 12 -Neo.CopyFiles.Sys = 12 - -[Neo.CopyFiles.Sys] -Neo6_x64_VPN57.sys, , , 2 - -[SoftEther.NTamd64] -%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN57 - -[NeoAdapter.Install] -Characteristics = 0x1 -AddReg = Neo.Reg, NeoAdapter.Ndi -CopyFiles = Neo.CopyFiles.Sys -*IfType = 53 -*MediaType = 0 -*PhysicalMediaType = 0 - -[NeoAdapter.Install.Services] -AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% - -[NeoAdapter.Ndi] -HKR, , NetworkAddress, 0, %DefaultAddress% -HKR, Ndi, DeviceID, , "NeoAdapter_VPN57" -HKR, , DevLoader, , ndis -HKR, , DeviceVxDs, , Neo6_x64_VPN57.sys -HKR, NDIS, LogDriverName, , "Neo_VPN57" -HKR, NDIS, MajorNdisVersion, 1, 5 -HKR, NDIS, MinorNdisVersion, 1, 0 -HKR, Ndi\Interfaces, DefUpper, , "ndis5" -HKR, Ndi\Interfaces, UpperRange, , "ndis5" -HKR, Ndi\Interfaces, LowerRange, , "ethernet" -HKR, Ndi\Interfaces, DefLower, , "ethernet" -HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" -HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% -HKR, Ndi\Params\NetworkAddress, type, 0, "edit" -HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" -HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" -HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% -HKR, Ndi\Params\NetworkAddress, optional, 0, "0" -HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% -HKR, Ndi\Params\MaxSpeed, type, 0, "int" -HKR, Ndi\Params\MaxSpeed, default, 0, "100" -HKR, Ndi\Params\MaxSpeed, min, 0, "0" -HKR, Ndi\Params\MaxSpeed, max, 0, "2000" -HKR, Ndi\Params\MaxSpeed, step, 0, "1" -HKR, Ndi\Params\MaxSpeed, Base, 0, "10" -HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% -HKR, Ndi\Params\KeepLink, type, 0, "enum" -HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% -HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% -HKR, Ndi\Params\KeepLink, default, 0, "0" - - -[Neo.Service] -DisplayName = %Neo.Service.DispName% -Description = %Neo.Service.Desc% -ServiceType = 1 -StartType = 3 -ErrorControl = 1 -ServiceBinary = %12%\Neo6_x64_VPN57.sys -LoadOrderGroup = NDIS - -[Neo.Reg] -HKR, Ndi, Service, 0, Neo.Service.Name -HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" -HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" - -[Neo.EventLog] -HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo6_x64_VPN57.sys" -HKR, , TypesSupported, 0x00010001, 7 - -[Strings] -CompanyName = "SoftEther Corporation" -DiskDescription = "VPN Client Device Driver Install Disk" -Neo.Service.Name = "Neo_VPN57" -Neo.Service.DispName = "VPN Client Device Driver - VPN57" -Neo.Service.Desc = "VPN Client Adapter - VPN57" -NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN57" -Neo.EventLog.Name = "Neo" -NetworkAddress = "MAC Address" -DefaultAddress = "000001000001" -MaxSpeed = "Indicate Speed (Mbps)" -KeepLink = "Keep Link" -On = "On" -Off = "Off" - - -; Auto Generated 20180205_163625.374 - +; VPN Client Device Driver for Windows 2000 and Greater +; +; Copyright (c) SoftEther Corporation. All Rights Reserved. +; http://www.softether.co.jp/ +; +; BUILD 9658 + +[Version] +Signature = "$Windows NT$" +Class = Net +ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} +Provider = %CompanyName% +DriverVer = 02/04/2018, 4.25.0.9658 +CatalogFile.NT = Neo6_x64_VPN57.cat + +[Manufacturer] +%CompanyName% = SoftEther, NTamd64 + +[SourceDisksNames] +1=%DiskDescription%, "", , + +[SourceDisksFiles] +Neo6_x64_VPN57.sys = 1 + +[DestinationDirs] +DefaultDestDir = 12 +Neo.CopyFiles.Sys = 12 + +[Neo.CopyFiles.Sys] +Neo6_x64_VPN57.sys, , , 2 + +[SoftEther.NTamd64] +%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN57 + +[NeoAdapter.Install] +Characteristics = 0x1 +AddReg = Neo.Reg, NeoAdapter.Ndi +CopyFiles = Neo.CopyFiles.Sys +*IfType = 53 +*MediaType = 0 +*PhysicalMediaType = 0 + +[NeoAdapter.Install.Services] +AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% + +[NeoAdapter.Ndi] +HKR, , NetworkAddress, 0, %DefaultAddress% +HKR, Ndi, DeviceID, , "NeoAdapter_VPN57" +HKR, , DevLoader, , ndis +HKR, , DeviceVxDs, , Neo6_x64_VPN57.sys +HKR, NDIS, LogDriverName, , "Neo_VPN57" +HKR, NDIS, MajorNdisVersion, 1, 5 +HKR, NDIS, MinorNdisVersion, 1, 0 +HKR, Ndi\Interfaces, DefUpper, , "ndis5" +HKR, Ndi\Interfaces, UpperRange, , "ndis5" +HKR, Ndi\Interfaces, LowerRange, , "ethernet" +HKR, Ndi\Interfaces, DefLower, , "ethernet" +HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" +HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% +HKR, Ndi\Params\NetworkAddress, type, 0, "edit" +HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" +HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" +HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% +HKR, Ndi\Params\NetworkAddress, optional, 0, "0" +HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% +HKR, Ndi\Params\MaxSpeed, type, 0, "int" +HKR, Ndi\Params\MaxSpeed, default, 0, "100" +HKR, Ndi\Params\MaxSpeed, min, 0, "0" +HKR, Ndi\Params\MaxSpeed, max, 0, "2000" +HKR, Ndi\Params\MaxSpeed, step, 0, "1" +HKR, Ndi\Params\MaxSpeed, Base, 0, "10" +HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% +HKR, Ndi\Params\KeepLink, type, 0, "enum" +HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% +HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% +HKR, Ndi\Params\KeepLink, default, 0, "0" + + +[Neo.Service] +DisplayName = %Neo.Service.DispName% +Description = %Neo.Service.Desc% +ServiceType = 1 +StartType = 3 +ErrorControl = 1 +ServiceBinary = %12%\Neo6_x64_VPN57.sys +LoadOrderGroup = NDIS + +[Neo.Reg] +HKR, Ndi, Service, 0, Neo.Service.Name +HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" +HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" + +[Neo.EventLog] +HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo6_x64_VPN57.sys" +HKR, , TypesSupported, 0x00010001, 7 + +[Strings] +CompanyName = "SoftEther Corporation" +DiskDescription = "VPN Client Device Driver Install Disk" +Neo.Service.Name = "Neo_VPN57" +Neo.Service.DispName = "VPN Client Device Driver - VPN57" +Neo.Service.Desc = "VPN Client Adapter - VPN57" +NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN57" +Neo.EventLog.Name = "Neo" +NetworkAddress = "MAC Address" +DefaultAddress = "000001000001" +MaxSpeed = "Indicate Speed (Mbps)" +KeepLink = "Keep Link" +On = "On" +Off = "Off" + + +; Auto Generated 20180205_163625.374 + diff --git a/src/bin/hamcore/DriverPackages/Neo6_Win10/x64/Neo6_x64_VPN58.inf b/src/bin/hamcore/DriverPackages/Neo6_Win10/x64/Neo6_x64_VPN58.inf index 81b1c841..ac3ec519 100644 --- a/src/bin/hamcore/DriverPackages/Neo6_Win10/x64/Neo6_x64_VPN58.inf +++ b/src/bin/hamcore/DriverPackages/Neo6_Win10/x64/Neo6_x64_VPN58.inf @@ -1,114 +1,114 @@ -; VPN Client Device Driver for Windows 2000 and Greater -; -; Copyright (c) SoftEther Corporation. All Rights Reserved. -; http://www.softether.co.jp/ -; -; BUILD 9658 - -[Version] -Signature = "$Windows NT$" -Class = Net -ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} -Provider = %CompanyName% -DriverVer = 02/04/2018, 4.25.0.9658 -CatalogFile.NT = Neo6_x64_VPN58.cat - -[Manufacturer] -%CompanyName% = SoftEther, NTamd64 - -[SourceDisksNames] -1=%DiskDescription%, "", , - -[SourceDisksFiles] -Neo6_x64_VPN58.sys = 1 - -[DestinationDirs] -DefaultDestDir = 12 -Neo.CopyFiles.Sys = 12 - -[Neo.CopyFiles.Sys] -Neo6_x64_VPN58.sys, , , 2 - -[SoftEther.NTamd64] -%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN58 - -[NeoAdapter.Install] -Characteristics = 0x1 -AddReg = Neo.Reg, NeoAdapter.Ndi -CopyFiles = Neo.CopyFiles.Sys -*IfType = 53 -*MediaType = 0 -*PhysicalMediaType = 0 - -[NeoAdapter.Install.Services] -AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% - -[NeoAdapter.Ndi] -HKR, , NetworkAddress, 0, %DefaultAddress% -HKR, Ndi, DeviceID, , "NeoAdapter_VPN58" -HKR, , DevLoader, , ndis -HKR, , DeviceVxDs, , Neo6_x64_VPN58.sys -HKR, NDIS, LogDriverName, , "Neo_VPN58" -HKR, NDIS, MajorNdisVersion, 1, 5 -HKR, NDIS, MinorNdisVersion, 1, 0 -HKR, Ndi\Interfaces, DefUpper, , "ndis5" -HKR, Ndi\Interfaces, UpperRange, , "ndis5" -HKR, Ndi\Interfaces, LowerRange, , "ethernet" -HKR, Ndi\Interfaces, DefLower, , "ethernet" -HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" -HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% -HKR, Ndi\Params\NetworkAddress, type, 0, "edit" -HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" -HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" -HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% -HKR, Ndi\Params\NetworkAddress, optional, 0, "0" -HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% -HKR, Ndi\Params\MaxSpeed, type, 0, "int" -HKR, Ndi\Params\MaxSpeed, default, 0, "100" -HKR, Ndi\Params\MaxSpeed, min, 0, "0" -HKR, Ndi\Params\MaxSpeed, max, 0, "2000" -HKR, Ndi\Params\MaxSpeed, step, 0, "1" -HKR, Ndi\Params\MaxSpeed, Base, 0, "10" -HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% -HKR, Ndi\Params\KeepLink, type, 0, "enum" -HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% -HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% -HKR, Ndi\Params\KeepLink, default, 0, "0" - - -[Neo.Service] -DisplayName = %Neo.Service.DispName% -Description = %Neo.Service.Desc% -ServiceType = 1 -StartType = 3 -ErrorControl = 1 -ServiceBinary = %12%\Neo6_x64_VPN58.sys -LoadOrderGroup = NDIS - -[Neo.Reg] -HKR, Ndi, Service, 0, Neo.Service.Name -HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" -HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" - -[Neo.EventLog] -HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo6_x64_VPN58.sys" -HKR, , TypesSupported, 0x00010001, 7 - -[Strings] -CompanyName = "SoftEther Corporation" -DiskDescription = "VPN Client Device Driver Install Disk" -Neo.Service.Name = "Neo_VPN58" -Neo.Service.DispName = "VPN Client Device Driver - VPN58" -Neo.Service.Desc = "VPN Client Adapter - VPN58" -NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN58" -Neo.EventLog.Name = "Neo" -NetworkAddress = "MAC Address" -DefaultAddress = "000001000001" -MaxSpeed = "Indicate Speed (Mbps)" -KeepLink = "Keep Link" -On = "On" -Off = "Off" - - -; Auto Generated 20180205_163625.445 - +; VPN Client Device Driver for Windows 2000 and Greater +; +; Copyright (c) SoftEther Corporation. All Rights Reserved. +; http://www.softether.co.jp/ +; +; BUILD 9658 + +[Version] +Signature = "$Windows NT$" +Class = Net +ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} +Provider = %CompanyName% +DriverVer = 02/04/2018, 4.25.0.9658 +CatalogFile.NT = Neo6_x64_VPN58.cat + +[Manufacturer] +%CompanyName% = SoftEther, NTamd64 + +[SourceDisksNames] +1=%DiskDescription%, "", , + +[SourceDisksFiles] +Neo6_x64_VPN58.sys = 1 + +[DestinationDirs] +DefaultDestDir = 12 +Neo.CopyFiles.Sys = 12 + +[Neo.CopyFiles.Sys] +Neo6_x64_VPN58.sys, , , 2 + +[SoftEther.NTamd64] +%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN58 + +[NeoAdapter.Install] +Characteristics = 0x1 +AddReg = Neo.Reg, NeoAdapter.Ndi +CopyFiles = Neo.CopyFiles.Sys +*IfType = 53 +*MediaType = 0 +*PhysicalMediaType = 0 + +[NeoAdapter.Install.Services] +AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% + +[NeoAdapter.Ndi] +HKR, , NetworkAddress, 0, %DefaultAddress% +HKR, Ndi, DeviceID, , "NeoAdapter_VPN58" +HKR, , DevLoader, , ndis +HKR, , DeviceVxDs, , Neo6_x64_VPN58.sys +HKR, NDIS, LogDriverName, , "Neo_VPN58" +HKR, NDIS, MajorNdisVersion, 1, 5 +HKR, NDIS, MinorNdisVersion, 1, 0 +HKR, Ndi\Interfaces, DefUpper, , "ndis5" +HKR, Ndi\Interfaces, UpperRange, , "ndis5" +HKR, Ndi\Interfaces, LowerRange, , "ethernet" +HKR, Ndi\Interfaces, DefLower, , "ethernet" +HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" +HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% +HKR, Ndi\Params\NetworkAddress, type, 0, "edit" +HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" +HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" +HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% +HKR, Ndi\Params\NetworkAddress, optional, 0, "0" +HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% +HKR, Ndi\Params\MaxSpeed, type, 0, "int" +HKR, Ndi\Params\MaxSpeed, default, 0, "100" +HKR, Ndi\Params\MaxSpeed, min, 0, "0" +HKR, Ndi\Params\MaxSpeed, max, 0, "2000" +HKR, Ndi\Params\MaxSpeed, step, 0, "1" +HKR, Ndi\Params\MaxSpeed, Base, 0, "10" +HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% +HKR, Ndi\Params\KeepLink, type, 0, "enum" +HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% +HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% +HKR, Ndi\Params\KeepLink, default, 0, "0" + + +[Neo.Service] +DisplayName = %Neo.Service.DispName% +Description = %Neo.Service.Desc% +ServiceType = 1 +StartType = 3 +ErrorControl = 1 +ServiceBinary = %12%\Neo6_x64_VPN58.sys +LoadOrderGroup = NDIS + +[Neo.Reg] +HKR, Ndi, Service, 0, Neo.Service.Name +HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" +HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" + +[Neo.EventLog] +HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo6_x64_VPN58.sys" +HKR, , TypesSupported, 0x00010001, 7 + +[Strings] +CompanyName = "SoftEther Corporation" +DiskDescription = "VPN Client Device Driver Install Disk" +Neo.Service.Name = "Neo_VPN58" +Neo.Service.DispName = "VPN Client Device Driver - VPN58" +Neo.Service.Desc = "VPN Client Adapter - VPN58" +NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN58" +Neo.EventLog.Name = "Neo" +NetworkAddress = "MAC Address" +DefaultAddress = "000001000001" +MaxSpeed = "Indicate Speed (Mbps)" +KeepLink = "Keep Link" +On = "On" +Off = "Off" + + +; Auto Generated 20180205_163625.445 + diff --git a/src/bin/hamcore/DriverPackages/Neo6_Win10/x64/Neo6_x64_VPN59.inf b/src/bin/hamcore/DriverPackages/Neo6_Win10/x64/Neo6_x64_VPN59.inf index 2e398d47..d014af7c 100644 --- a/src/bin/hamcore/DriverPackages/Neo6_Win10/x64/Neo6_x64_VPN59.inf +++ b/src/bin/hamcore/DriverPackages/Neo6_Win10/x64/Neo6_x64_VPN59.inf @@ -1,114 +1,114 @@ -; VPN Client Device Driver for Windows 2000 and Greater -; -; Copyright (c) SoftEther Corporation. All Rights Reserved. -; http://www.softether.co.jp/ -; -; BUILD 9658 - -[Version] -Signature = "$Windows NT$" -Class = Net -ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} -Provider = %CompanyName% -DriverVer = 02/04/2018, 4.25.0.9658 -CatalogFile.NT = Neo6_x64_VPN59.cat - -[Manufacturer] -%CompanyName% = SoftEther, NTamd64 - -[SourceDisksNames] -1=%DiskDescription%, "", , - -[SourceDisksFiles] -Neo6_x64_VPN59.sys = 1 - -[DestinationDirs] -DefaultDestDir = 12 -Neo.CopyFiles.Sys = 12 - -[Neo.CopyFiles.Sys] -Neo6_x64_VPN59.sys, , , 2 - -[SoftEther.NTamd64] -%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN59 - -[NeoAdapter.Install] -Characteristics = 0x1 -AddReg = Neo.Reg, NeoAdapter.Ndi -CopyFiles = Neo.CopyFiles.Sys -*IfType = 53 -*MediaType = 0 -*PhysicalMediaType = 0 - -[NeoAdapter.Install.Services] -AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% - -[NeoAdapter.Ndi] -HKR, , NetworkAddress, 0, %DefaultAddress% -HKR, Ndi, DeviceID, , "NeoAdapter_VPN59" -HKR, , DevLoader, , ndis -HKR, , DeviceVxDs, , Neo6_x64_VPN59.sys -HKR, NDIS, LogDriverName, , "Neo_VPN59" -HKR, NDIS, MajorNdisVersion, 1, 5 -HKR, NDIS, MinorNdisVersion, 1, 0 -HKR, Ndi\Interfaces, DefUpper, , "ndis5" -HKR, Ndi\Interfaces, UpperRange, , "ndis5" -HKR, Ndi\Interfaces, LowerRange, , "ethernet" -HKR, Ndi\Interfaces, DefLower, , "ethernet" -HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" -HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% -HKR, Ndi\Params\NetworkAddress, type, 0, "edit" -HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" -HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" -HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% -HKR, Ndi\Params\NetworkAddress, optional, 0, "0" -HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% -HKR, Ndi\Params\MaxSpeed, type, 0, "int" -HKR, Ndi\Params\MaxSpeed, default, 0, "100" -HKR, Ndi\Params\MaxSpeed, min, 0, "0" -HKR, Ndi\Params\MaxSpeed, max, 0, "2000" -HKR, Ndi\Params\MaxSpeed, step, 0, "1" -HKR, Ndi\Params\MaxSpeed, Base, 0, "10" -HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% -HKR, Ndi\Params\KeepLink, type, 0, "enum" -HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% -HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% -HKR, Ndi\Params\KeepLink, default, 0, "0" - - -[Neo.Service] -DisplayName = %Neo.Service.DispName% -Description = %Neo.Service.Desc% -ServiceType = 1 -StartType = 3 -ErrorControl = 1 -ServiceBinary = %12%\Neo6_x64_VPN59.sys -LoadOrderGroup = NDIS - -[Neo.Reg] -HKR, Ndi, Service, 0, Neo.Service.Name -HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" -HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" - -[Neo.EventLog] -HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo6_x64_VPN59.sys" -HKR, , TypesSupported, 0x00010001, 7 - -[Strings] -CompanyName = "SoftEther Corporation" -DiskDescription = "VPN Client Device Driver Install Disk" -Neo.Service.Name = "Neo_VPN59" -Neo.Service.DispName = "VPN Client Device Driver - VPN59" -Neo.Service.Desc = "VPN Client Adapter - VPN59" -NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN59" -Neo.EventLog.Name = "Neo" -NetworkAddress = "MAC Address" -DefaultAddress = "000001000001" -MaxSpeed = "Indicate Speed (Mbps)" -KeepLink = "Keep Link" -On = "On" -Off = "Off" - - -; Auto Generated 20180205_163625.519 - +; VPN Client Device Driver for Windows 2000 and Greater +; +; Copyright (c) SoftEther Corporation. All Rights Reserved. +; http://www.softether.co.jp/ +; +; BUILD 9658 + +[Version] +Signature = "$Windows NT$" +Class = Net +ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} +Provider = %CompanyName% +DriverVer = 02/04/2018, 4.25.0.9658 +CatalogFile.NT = Neo6_x64_VPN59.cat + +[Manufacturer] +%CompanyName% = SoftEther, NTamd64 + +[SourceDisksNames] +1=%DiskDescription%, "", , + +[SourceDisksFiles] +Neo6_x64_VPN59.sys = 1 + +[DestinationDirs] +DefaultDestDir = 12 +Neo.CopyFiles.Sys = 12 + +[Neo.CopyFiles.Sys] +Neo6_x64_VPN59.sys, , , 2 + +[SoftEther.NTamd64] +%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN59 + +[NeoAdapter.Install] +Characteristics = 0x1 +AddReg = Neo.Reg, NeoAdapter.Ndi +CopyFiles = Neo.CopyFiles.Sys +*IfType = 53 +*MediaType = 0 +*PhysicalMediaType = 0 + +[NeoAdapter.Install.Services] +AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% + +[NeoAdapter.Ndi] +HKR, , NetworkAddress, 0, %DefaultAddress% +HKR, Ndi, DeviceID, , "NeoAdapter_VPN59" +HKR, , DevLoader, , ndis +HKR, , DeviceVxDs, , Neo6_x64_VPN59.sys +HKR, NDIS, LogDriverName, , "Neo_VPN59" +HKR, NDIS, MajorNdisVersion, 1, 5 +HKR, NDIS, MinorNdisVersion, 1, 0 +HKR, Ndi\Interfaces, DefUpper, , "ndis5" +HKR, Ndi\Interfaces, UpperRange, , "ndis5" +HKR, Ndi\Interfaces, LowerRange, , "ethernet" +HKR, Ndi\Interfaces, DefLower, , "ethernet" +HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" +HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% +HKR, Ndi\Params\NetworkAddress, type, 0, "edit" +HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" +HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" +HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% +HKR, Ndi\Params\NetworkAddress, optional, 0, "0" +HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% +HKR, Ndi\Params\MaxSpeed, type, 0, "int" +HKR, Ndi\Params\MaxSpeed, default, 0, "100" +HKR, Ndi\Params\MaxSpeed, min, 0, "0" +HKR, Ndi\Params\MaxSpeed, max, 0, "2000" +HKR, Ndi\Params\MaxSpeed, step, 0, "1" +HKR, Ndi\Params\MaxSpeed, Base, 0, "10" +HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% +HKR, Ndi\Params\KeepLink, type, 0, "enum" +HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% +HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% +HKR, Ndi\Params\KeepLink, default, 0, "0" + + +[Neo.Service] +DisplayName = %Neo.Service.DispName% +Description = %Neo.Service.Desc% +ServiceType = 1 +StartType = 3 +ErrorControl = 1 +ServiceBinary = %12%\Neo6_x64_VPN59.sys +LoadOrderGroup = NDIS + +[Neo.Reg] +HKR, Ndi, Service, 0, Neo.Service.Name +HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" +HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" + +[Neo.EventLog] +HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo6_x64_VPN59.sys" +HKR, , TypesSupported, 0x00010001, 7 + +[Strings] +CompanyName = "SoftEther Corporation" +DiskDescription = "VPN Client Device Driver Install Disk" +Neo.Service.Name = "Neo_VPN59" +Neo.Service.DispName = "VPN Client Device Driver - VPN59" +Neo.Service.Desc = "VPN Client Adapter - VPN59" +NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN59" +Neo.EventLog.Name = "Neo" +NetworkAddress = "MAC Address" +DefaultAddress = "000001000001" +MaxSpeed = "Indicate Speed (Mbps)" +KeepLink = "Keep Link" +On = "On" +Off = "Off" + + +; Auto Generated 20180205_163625.519 + diff --git a/src/bin/hamcore/DriverPackages/Neo6_Win10/x64/Neo6_x64_VPN6.inf b/src/bin/hamcore/DriverPackages/Neo6_Win10/x64/Neo6_x64_VPN6.inf index 52b4150f..6366c55f 100644 --- a/src/bin/hamcore/DriverPackages/Neo6_Win10/x64/Neo6_x64_VPN6.inf +++ b/src/bin/hamcore/DriverPackages/Neo6_Win10/x64/Neo6_x64_VPN6.inf @@ -1,114 +1,114 @@ -; VPN Client Device Driver for Windows 2000 and Greater -; -; Copyright (c) SoftEther Corporation. All Rights Reserved. -; http://www.softether.co.jp/ -; -; BUILD 9658 - -[Version] -Signature = "$Windows NT$" -Class = Net -ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} -Provider = %CompanyName% -DriverVer = 02/04/2018, 4.25.0.9658 -CatalogFile.NT = Neo6_x64_VPN6.cat - -[Manufacturer] -%CompanyName% = SoftEther, NTamd64 - -[SourceDisksNames] -1=%DiskDescription%, "", , - -[SourceDisksFiles] -Neo6_x64_VPN6.sys = 1 - -[DestinationDirs] -DefaultDestDir = 12 -Neo.CopyFiles.Sys = 12 - -[Neo.CopyFiles.Sys] -Neo6_x64_VPN6.sys, , , 2 - -[SoftEther.NTamd64] -%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN6 - -[NeoAdapter.Install] -Characteristics = 0x1 -AddReg = Neo.Reg, NeoAdapter.Ndi -CopyFiles = Neo.CopyFiles.Sys -*IfType = 53 -*MediaType = 0 -*PhysicalMediaType = 0 - -[NeoAdapter.Install.Services] -AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% - -[NeoAdapter.Ndi] -HKR, , NetworkAddress, 0, %DefaultAddress% -HKR, Ndi, DeviceID, , "NeoAdapter_VPN6" -HKR, , DevLoader, , ndis -HKR, , DeviceVxDs, , Neo6_x64_VPN6.sys -HKR, NDIS, LogDriverName, , "Neo_VPN6" -HKR, NDIS, MajorNdisVersion, 1, 5 -HKR, NDIS, MinorNdisVersion, 1, 0 -HKR, Ndi\Interfaces, DefUpper, , "ndis5" -HKR, Ndi\Interfaces, UpperRange, , "ndis5" -HKR, Ndi\Interfaces, LowerRange, , "ethernet" -HKR, Ndi\Interfaces, DefLower, , "ethernet" -HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" -HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% -HKR, Ndi\Params\NetworkAddress, type, 0, "edit" -HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" -HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" -HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% -HKR, Ndi\Params\NetworkAddress, optional, 0, "0" -HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% -HKR, Ndi\Params\MaxSpeed, type, 0, "int" -HKR, Ndi\Params\MaxSpeed, default, 0, "100" -HKR, Ndi\Params\MaxSpeed, min, 0, "0" -HKR, Ndi\Params\MaxSpeed, max, 0, "2000" -HKR, Ndi\Params\MaxSpeed, step, 0, "1" -HKR, Ndi\Params\MaxSpeed, Base, 0, "10" -HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% -HKR, Ndi\Params\KeepLink, type, 0, "enum" -HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% -HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% -HKR, Ndi\Params\KeepLink, default, 0, "0" - - -[Neo.Service] -DisplayName = %Neo.Service.DispName% -Description = %Neo.Service.Desc% -ServiceType = 1 -StartType = 3 -ErrorControl = 1 -ServiceBinary = %12%\Neo6_x64_VPN6.sys -LoadOrderGroup = NDIS - -[Neo.Reg] -HKR, Ndi, Service, 0, Neo.Service.Name -HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" -HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" - -[Neo.EventLog] -HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo6_x64_VPN6.sys" -HKR, , TypesSupported, 0x00010001, 7 - -[Strings] -CompanyName = "SoftEther Corporation" -DiskDescription = "VPN Client Device Driver Install Disk" -Neo.Service.Name = "Neo_VPN6" -Neo.Service.DispName = "VPN Client Device Driver - VPN6" -Neo.Service.Desc = "VPN Client Adapter - VPN6" -NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN6" -Neo.EventLog.Name = "Neo" -NetworkAddress = "MAC Address" -DefaultAddress = "000001000001" -MaxSpeed = "Indicate Speed (Mbps)" -KeepLink = "Keep Link" -On = "On" -Off = "Off" - - -; Auto Generated 20180205_163621.739 - +; VPN Client Device Driver for Windows 2000 and Greater +; +; Copyright (c) SoftEther Corporation. All Rights Reserved. +; http://www.softether.co.jp/ +; +; BUILD 9658 + +[Version] +Signature = "$Windows NT$" +Class = Net +ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} +Provider = %CompanyName% +DriverVer = 02/04/2018, 4.25.0.9658 +CatalogFile.NT = Neo6_x64_VPN6.cat + +[Manufacturer] +%CompanyName% = SoftEther, NTamd64 + +[SourceDisksNames] +1=%DiskDescription%, "", , + +[SourceDisksFiles] +Neo6_x64_VPN6.sys = 1 + +[DestinationDirs] +DefaultDestDir = 12 +Neo.CopyFiles.Sys = 12 + +[Neo.CopyFiles.Sys] +Neo6_x64_VPN6.sys, , , 2 + +[SoftEther.NTamd64] +%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN6 + +[NeoAdapter.Install] +Characteristics = 0x1 +AddReg = Neo.Reg, NeoAdapter.Ndi +CopyFiles = Neo.CopyFiles.Sys +*IfType = 53 +*MediaType = 0 +*PhysicalMediaType = 0 + +[NeoAdapter.Install.Services] +AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% + +[NeoAdapter.Ndi] +HKR, , NetworkAddress, 0, %DefaultAddress% +HKR, Ndi, DeviceID, , "NeoAdapter_VPN6" +HKR, , DevLoader, , ndis +HKR, , DeviceVxDs, , Neo6_x64_VPN6.sys +HKR, NDIS, LogDriverName, , "Neo_VPN6" +HKR, NDIS, MajorNdisVersion, 1, 5 +HKR, NDIS, MinorNdisVersion, 1, 0 +HKR, Ndi\Interfaces, DefUpper, , "ndis5" +HKR, Ndi\Interfaces, UpperRange, , "ndis5" +HKR, Ndi\Interfaces, LowerRange, , "ethernet" +HKR, Ndi\Interfaces, DefLower, , "ethernet" +HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" +HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% +HKR, Ndi\Params\NetworkAddress, type, 0, "edit" +HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" +HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" +HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% +HKR, Ndi\Params\NetworkAddress, optional, 0, "0" +HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% +HKR, Ndi\Params\MaxSpeed, type, 0, "int" +HKR, Ndi\Params\MaxSpeed, default, 0, "100" +HKR, Ndi\Params\MaxSpeed, min, 0, "0" +HKR, Ndi\Params\MaxSpeed, max, 0, "2000" +HKR, Ndi\Params\MaxSpeed, step, 0, "1" +HKR, Ndi\Params\MaxSpeed, Base, 0, "10" +HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% +HKR, Ndi\Params\KeepLink, type, 0, "enum" +HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% +HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% +HKR, Ndi\Params\KeepLink, default, 0, "0" + + +[Neo.Service] +DisplayName = %Neo.Service.DispName% +Description = %Neo.Service.Desc% +ServiceType = 1 +StartType = 3 +ErrorControl = 1 +ServiceBinary = %12%\Neo6_x64_VPN6.sys +LoadOrderGroup = NDIS + +[Neo.Reg] +HKR, Ndi, Service, 0, Neo.Service.Name +HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" +HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" + +[Neo.EventLog] +HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo6_x64_VPN6.sys" +HKR, , TypesSupported, 0x00010001, 7 + +[Strings] +CompanyName = "SoftEther Corporation" +DiskDescription = "VPN Client Device Driver Install Disk" +Neo.Service.Name = "Neo_VPN6" +Neo.Service.DispName = "VPN Client Device Driver - VPN6" +Neo.Service.Desc = "VPN Client Adapter - VPN6" +NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN6" +Neo.EventLog.Name = "Neo" +NetworkAddress = "MAC Address" +DefaultAddress = "000001000001" +MaxSpeed = "Indicate Speed (Mbps)" +KeepLink = "Keep Link" +On = "On" +Off = "Off" + + +; Auto Generated 20180205_163621.739 + diff --git a/src/bin/hamcore/DriverPackages/Neo6_Win10/x64/Neo6_x64_VPN60.inf b/src/bin/hamcore/DriverPackages/Neo6_Win10/x64/Neo6_x64_VPN60.inf index 7bf751c0..eec8b83a 100644 --- a/src/bin/hamcore/DriverPackages/Neo6_Win10/x64/Neo6_x64_VPN60.inf +++ b/src/bin/hamcore/DriverPackages/Neo6_Win10/x64/Neo6_x64_VPN60.inf @@ -1,114 +1,114 @@ -; VPN Client Device Driver for Windows 2000 and Greater -; -; Copyright (c) SoftEther Corporation. All Rights Reserved. -; http://www.softether.co.jp/ -; -; BUILD 9658 - -[Version] -Signature = "$Windows NT$" -Class = Net -ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} -Provider = %CompanyName% -DriverVer = 02/04/2018, 4.25.0.9658 -CatalogFile.NT = Neo6_x64_VPN60.cat - -[Manufacturer] -%CompanyName% = SoftEther, NTamd64 - -[SourceDisksNames] -1=%DiskDescription%, "", , - -[SourceDisksFiles] -Neo6_x64_VPN60.sys = 1 - -[DestinationDirs] -DefaultDestDir = 12 -Neo.CopyFiles.Sys = 12 - -[Neo.CopyFiles.Sys] -Neo6_x64_VPN60.sys, , , 2 - -[SoftEther.NTamd64] -%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN60 - -[NeoAdapter.Install] -Characteristics = 0x1 -AddReg = Neo.Reg, NeoAdapter.Ndi -CopyFiles = Neo.CopyFiles.Sys -*IfType = 53 -*MediaType = 0 -*PhysicalMediaType = 0 - -[NeoAdapter.Install.Services] -AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% - -[NeoAdapter.Ndi] -HKR, , NetworkAddress, 0, %DefaultAddress% -HKR, Ndi, DeviceID, , "NeoAdapter_VPN60" -HKR, , DevLoader, , ndis -HKR, , DeviceVxDs, , Neo6_x64_VPN60.sys -HKR, NDIS, LogDriverName, , "Neo_VPN60" -HKR, NDIS, MajorNdisVersion, 1, 5 -HKR, NDIS, MinorNdisVersion, 1, 0 -HKR, Ndi\Interfaces, DefUpper, , "ndis5" -HKR, Ndi\Interfaces, UpperRange, , "ndis5" -HKR, Ndi\Interfaces, LowerRange, , "ethernet" -HKR, Ndi\Interfaces, DefLower, , "ethernet" -HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" -HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% -HKR, Ndi\Params\NetworkAddress, type, 0, "edit" -HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" -HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" -HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% -HKR, Ndi\Params\NetworkAddress, optional, 0, "0" -HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% -HKR, Ndi\Params\MaxSpeed, type, 0, "int" -HKR, Ndi\Params\MaxSpeed, default, 0, "100" -HKR, Ndi\Params\MaxSpeed, min, 0, "0" -HKR, Ndi\Params\MaxSpeed, max, 0, "2000" -HKR, Ndi\Params\MaxSpeed, step, 0, "1" -HKR, Ndi\Params\MaxSpeed, Base, 0, "10" -HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% -HKR, Ndi\Params\KeepLink, type, 0, "enum" -HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% -HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% -HKR, Ndi\Params\KeepLink, default, 0, "0" - - -[Neo.Service] -DisplayName = %Neo.Service.DispName% -Description = %Neo.Service.Desc% -ServiceType = 1 -StartType = 3 -ErrorControl = 1 -ServiceBinary = %12%\Neo6_x64_VPN60.sys -LoadOrderGroup = NDIS - -[Neo.Reg] -HKR, Ndi, Service, 0, Neo.Service.Name -HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" -HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" - -[Neo.EventLog] -HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo6_x64_VPN60.sys" -HKR, , TypesSupported, 0x00010001, 7 - -[Strings] -CompanyName = "SoftEther Corporation" -DiskDescription = "VPN Client Device Driver Install Disk" -Neo.Service.Name = "Neo_VPN60" -Neo.Service.DispName = "VPN Client Device Driver - VPN60" -Neo.Service.Desc = "VPN Client Adapter - VPN60" -NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN60" -Neo.EventLog.Name = "Neo" -NetworkAddress = "MAC Address" -DefaultAddress = "000001000001" -MaxSpeed = "Indicate Speed (Mbps)" -KeepLink = "Keep Link" -On = "On" -Off = "Off" - - -; Auto Generated 20180205_163625.589 - +; VPN Client Device Driver for Windows 2000 and Greater +; +; Copyright (c) SoftEther Corporation. All Rights Reserved. +; http://www.softether.co.jp/ +; +; BUILD 9658 + +[Version] +Signature = "$Windows NT$" +Class = Net +ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} +Provider = %CompanyName% +DriverVer = 02/04/2018, 4.25.0.9658 +CatalogFile.NT = Neo6_x64_VPN60.cat + +[Manufacturer] +%CompanyName% = SoftEther, NTamd64 + +[SourceDisksNames] +1=%DiskDescription%, "", , + +[SourceDisksFiles] +Neo6_x64_VPN60.sys = 1 + +[DestinationDirs] +DefaultDestDir = 12 +Neo.CopyFiles.Sys = 12 + +[Neo.CopyFiles.Sys] +Neo6_x64_VPN60.sys, , , 2 + +[SoftEther.NTamd64] +%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN60 + +[NeoAdapter.Install] +Characteristics = 0x1 +AddReg = Neo.Reg, NeoAdapter.Ndi +CopyFiles = Neo.CopyFiles.Sys +*IfType = 53 +*MediaType = 0 +*PhysicalMediaType = 0 + +[NeoAdapter.Install.Services] +AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% + +[NeoAdapter.Ndi] +HKR, , NetworkAddress, 0, %DefaultAddress% +HKR, Ndi, DeviceID, , "NeoAdapter_VPN60" +HKR, , DevLoader, , ndis +HKR, , DeviceVxDs, , Neo6_x64_VPN60.sys +HKR, NDIS, LogDriverName, , "Neo_VPN60" +HKR, NDIS, MajorNdisVersion, 1, 5 +HKR, NDIS, MinorNdisVersion, 1, 0 +HKR, Ndi\Interfaces, DefUpper, , "ndis5" +HKR, Ndi\Interfaces, UpperRange, , "ndis5" +HKR, Ndi\Interfaces, LowerRange, , "ethernet" +HKR, Ndi\Interfaces, DefLower, , "ethernet" +HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" +HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% +HKR, Ndi\Params\NetworkAddress, type, 0, "edit" +HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" +HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" +HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% +HKR, Ndi\Params\NetworkAddress, optional, 0, "0" +HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% +HKR, Ndi\Params\MaxSpeed, type, 0, "int" +HKR, Ndi\Params\MaxSpeed, default, 0, "100" +HKR, Ndi\Params\MaxSpeed, min, 0, "0" +HKR, Ndi\Params\MaxSpeed, max, 0, "2000" +HKR, Ndi\Params\MaxSpeed, step, 0, "1" +HKR, Ndi\Params\MaxSpeed, Base, 0, "10" +HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% +HKR, Ndi\Params\KeepLink, type, 0, "enum" +HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% +HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% +HKR, Ndi\Params\KeepLink, default, 0, "0" + + +[Neo.Service] +DisplayName = %Neo.Service.DispName% +Description = %Neo.Service.Desc% +ServiceType = 1 +StartType = 3 +ErrorControl = 1 +ServiceBinary = %12%\Neo6_x64_VPN60.sys +LoadOrderGroup = NDIS + +[Neo.Reg] +HKR, Ndi, Service, 0, Neo.Service.Name +HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" +HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" + +[Neo.EventLog] +HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo6_x64_VPN60.sys" +HKR, , TypesSupported, 0x00010001, 7 + +[Strings] +CompanyName = "SoftEther Corporation" +DiskDescription = "VPN Client Device Driver Install Disk" +Neo.Service.Name = "Neo_VPN60" +Neo.Service.DispName = "VPN Client Device Driver - VPN60" +Neo.Service.Desc = "VPN Client Adapter - VPN60" +NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN60" +Neo.EventLog.Name = "Neo" +NetworkAddress = "MAC Address" +DefaultAddress = "000001000001" +MaxSpeed = "Indicate Speed (Mbps)" +KeepLink = "Keep Link" +On = "On" +Off = "Off" + + +; Auto Generated 20180205_163625.589 + diff --git a/src/bin/hamcore/DriverPackages/Neo6_Win10/x64/Neo6_x64_VPN61.inf b/src/bin/hamcore/DriverPackages/Neo6_Win10/x64/Neo6_x64_VPN61.inf index 07551f87..7007e76b 100644 --- a/src/bin/hamcore/DriverPackages/Neo6_Win10/x64/Neo6_x64_VPN61.inf +++ b/src/bin/hamcore/DriverPackages/Neo6_Win10/x64/Neo6_x64_VPN61.inf @@ -1,114 +1,114 @@ -; VPN Client Device Driver for Windows 2000 and Greater -; -; Copyright (c) SoftEther Corporation. All Rights Reserved. -; http://www.softether.co.jp/ -; -; BUILD 9658 - -[Version] -Signature = "$Windows NT$" -Class = Net -ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} -Provider = %CompanyName% -DriverVer = 02/04/2018, 4.25.0.9658 -CatalogFile.NT = Neo6_x64_VPN61.cat - -[Manufacturer] -%CompanyName% = SoftEther, NTamd64 - -[SourceDisksNames] -1=%DiskDescription%, "", , - -[SourceDisksFiles] -Neo6_x64_VPN61.sys = 1 - -[DestinationDirs] -DefaultDestDir = 12 -Neo.CopyFiles.Sys = 12 - -[Neo.CopyFiles.Sys] -Neo6_x64_VPN61.sys, , , 2 - -[SoftEther.NTamd64] -%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN61 - -[NeoAdapter.Install] -Characteristics = 0x1 -AddReg = Neo.Reg, NeoAdapter.Ndi -CopyFiles = Neo.CopyFiles.Sys -*IfType = 53 -*MediaType = 0 -*PhysicalMediaType = 0 - -[NeoAdapter.Install.Services] -AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% - -[NeoAdapter.Ndi] -HKR, , NetworkAddress, 0, %DefaultAddress% -HKR, Ndi, DeviceID, , "NeoAdapter_VPN61" -HKR, , DevLoader, , ndis -HKR, , DeviceVxDs, , Neo6_x64_VPN61.sys -HKR, NDIS, LogDriverName, , "Neo_VPN61" -HKR, NDIS, MajorNdisVersion, 1, 5 -HKR, NDIS, MinorNdisVersion, 1, 0 -HKR, Ndi\Interfaces, DefUpper, , "ndis5" -HKR, Ndi\Interfaces, UpperRange, , "ndis5" -HKR, Ndi\Interfaces, LowerRange, , "ethernet" -HKR, Ndi\Interfaces, DefLower, , "ethernet" -HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" -HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% -HKR, Ndi\Params\NetworkAddress, type, 0, "edit" -HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" -HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" -HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% -HKR, Ndi\Params\NetworkAddress, optional, 0, "0" -HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% -HKR, Ndi\Params\MaxSpeed, type, 0, "int" -HKR, Ndi\Params\MaxSpeed, default, 0, "100" -HKR, Ndi\Params\MaxSpeed, min, 0, "0" -HKR, Ndi\Params\MaxSpeed, max, 0, "2000" -HKR, Ndi\Params\MaxSpeed, step, 0, "1" -HKR, Ndi\Params\MaxSpeed, Base, 0, "10" -HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% -HKR, Ndi\Params\KeepLink, type, 0, "enum" -HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% -HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% -HKR, Ndi\Params\KeepLink, default, 0, "0" - - -[Neo.Service] -DisplayName = %Neo.Service.DispName% -Description = %Neo.Service.Desc% -ServiceType = 1 -StartType = 3 -ErrorControl = 1 -ServiceBinary = %12%\Neo6_x64_VPN61.sys -LoadOrderGroup = NDIS - -[Neo.Reg] -HKR, Ndi, Service, 0, Neo.Service.Name -HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" -HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" - -[Neo.EventLog] -HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo6_x64_VPN61.sys" -HKR, , TypesSupported, 0x00010001, 7 - -[Strings] -CompanyName = "SoftEther Corporation" -DiskDescription = "VPN Client Device Driver Install Disk" -Neo.Service.Name = "Neo_VPN61" -Neo.Service.DispName = "VPN Client Device Driver - VPN61" -Neo.Service.Desc = "VPN Client Adapter - VPN61" -NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN61" -Neo.EventLog.Name = "Neo" -NetworkAddress = "MAC Address" -DefaultAddress = "000001000001" -MaxSpeed = "Indicate Speed (Mbps)" -KeepLink = "Keep Link" -On = "On" -Off = "Off" - - -; Auto Generated 20180205_163625.660 - +; VPN Client Device Driver for Windows 2000 and Greater +; +; Copyright (c) SoftEther Corporation. All Rights Reserved. +; http://www.softether.co.jp/ +; +; BUILD 9658 + +[Version] +Signature = "$Windows NT$" +Class = Net +ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} +Provider = %CompanyName% +DriverVer = 02/04/2018, 4.25.0.9658 +CatalogFile.NT = Neo6_x64_VPN61.cat + +[Manufacturer] +%CompanyName% = SoftEther, NTamd64 + +[SourceDisksNames] +1=%DiskDescription%, "", , + +[SourceDisksFiles] +Neo6_x64_VPN61.sys = 1 + +[DestinationDirs] +DefaultDestDir = 12 +Neo.CopyFiles.Sys = 12 + +[Neo.CopyFiles.Sys] +Neo6_x64_VPN61.sys, , , 2 + +[SoftEther.NTamd64] +%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN61 + +[NeoAdapter.Install] +Characteristics = 0x1 +AddReg = Neo.Reg, NeoAdapter.Ndi +CopyFiles = Neo.CopyFiles.Sys +*IfType = 53 +*MediaType = 0 +*PhysicalMediaType = 0 + +[NeoAdapter.Install.Services] +AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% + +[NeoAdapter.Ndi] +HKR, , NetworkAddress, 0, %DefaultAddress% +HKR, Ndi, DeviceID, , "NeoAdapter_VPN61" +HKR, , DevLoader, , ndis +HKR, , DeviceVxDs, , Neo6_x64_VPN61.sys +HKR, NDIS, LogDriverName, , "Neo_VPN61" +HKR, NDIS, MajorNdisVersion, 1, 5 +HKR, NDIS, MinorNdisVersion, 1, 0 +HKR, Ndi\Interfaces, DefUpper, , "ndis5" +HKR, Ndi\Interfaces, UpperRange, , "ndis5" +HKR, Ndi\Interfaces, LowerRange, , "ethernet" +HKR, Ndi\Interfaces, DefLower, , "ethernet" +HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" +HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% +HKR, Ndi\Params\NetworkAddress, type, 0, "edit" +HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" +HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" +HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% +HKR, Ndi\Params\NetworkAddress, optional, 0, "0" +HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% +HKR, Ndi\Params\MaxSpeed, type, 0, "int" +HKR, Ndi\Params\MaxSpeed, default, 0, "100" +HKR, Ndi\Params\MaxSpeed, min, 0, "0" +HKR, Ndi\Params\MaxSpeed, max, 0, "2000" +HKR, Ndi\Params\MaxSpeed, step, 0, "1" +HKR, Ndi\Params\MaxSpeed, Base, 0, "10" +HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% +HKR, Ndi\Params\KeepLink, type, 0, "enum" +HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% +HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% +HKR, Ndi\Params\KeepLink, default, 0, "0" + + +[Neo.Service] +DisplayName = %Neo.Service.DispName% +Description = %Neo.Service.Desc% +ServiceType = 1 +StartType = 3 +ErrorControl = 1 +ServiceBinary = %12%\Neo6_x64_VPN61.sys +LoadOrderGroup = NDIS + +[Neo.Reg] +HKR, Ndi, Service, 0, Neo.Service.Name +HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" +HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" + +[Neo.EventLog] +HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo6_x64_VPN61.sys" +HKR, , TypesSupported, 0x00010001, 7 + +[Strings] +CompanyName = "SoftEther Corporation" +DiskDescription = "VPN Client Device Driver Install Disk" +Neo.Service.Name = "Neo_VPN61" +Neo.Service.DispName = "VPN Client Device Driver - VPN61" +Neo.Service.Desc = "VPN Client Adapter - VPN61" +NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN61" +Neo.EventLog.Name = "Neo" +NetworkAddress = "MAC Address" +DefaultAddress = "000001000001" +MaxSpeed = "Indicate Speed (Mbps)" +KeepLink = "Keep Link" +On = "On" +Off = "Off" + + +; Auto Generated 20180205_163625.660 + diff --git a/src/bin/hamcore/DriverPackages/Neo6_Win10/x64/Neo6_x64_VPN62.inf b/src/bin/hamcore/DriverPackages/Neo6_Win10/x64/Neo6_x64_VPN62.inf index 58e811d7..febf9bd4 100644 --- a/src/bin/hamcore/DriverPackages/Neo6_Win10/x64/Neo6_x64_VPN62.inf +++ b/src/bin/hamcore/DriverPackages/Neo6_Win10/x64/Neo6_x64_VPN62.inf @@ -1,114 +1,114 @@ -; VPN Client Device Driver for Windows 2000 and Greater -; -; Copyright (c) SoftEther Corporation. All Rights Reserved. -; http://www.softether.co.jp/ -; -; BUILD 9658 - -[Version] -Signature = "$Windows NT$" -Class = Net -ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} -Provider = %CompanyName% -DriverVer = 02/04/2018, 4.25.0.9658 -CatalogFile.NT = Neo6_x64_VPN62.cat - -[Manufacturer] -%CompanyName% = SoftEther, NTamd64 - -[SourceDisksNames] -1=%DiskDescription%, "", , - -[SourceDisksFiles] -Neo6_x64_VPN62.sys = 1 - -[DestinationDirs] -DefaultDestDir = 12 -Neo.CopyFiles.Sys = 12 - -[Neo.CopyFiles.Sys] -Neo6_x64_VPN62.sys, , , 2 - -[SoftEther.NTamd64] -%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN62 - -[NeoAdapter.Install] -Characteristics = 0x1 -AddReg = Neo.Reg, NeoAdapter.Ndi -CopyFiles = Neo.CopyFiles.Sys -*IfType = 53 -*MediaType = 0 -*PhysicalMediaType = 0 - -[NeoAdapter.Install.Services] -AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% - -[NeoAdapter.Ndi] -HKR, , NetworkAddress, 0, %DefaultAddress% -HKR, Ndi, DeviceID, , "NeoAdapter_VPN62" -HKR, , DevLoader, , ndis -HKR, , DeviceVxDs, , Neo6_x64_VPN62.sys -HKR, NDIS, LogDriverName, , "Neo_VPN62" -HKR, NDIS, MajorNdisVersion, 1, 5 -HKR, NDIS, MinorNdisVersion, 1, 0 -HKR, Ndi\Interfaces, DefUpper, , "ndis5" -HKR, Ndi\Interfaces, UpperRange, , "ndis5" -HKR, Ndi\Interfaces, LowerRange, , "ethernet" -HKR, Ndi\Interfaces, DefLower, , "ethernet" -HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" -HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% -HKR, Ndi\Params\NetworkAddress, type, 0, "edit" -HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" -HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" -HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% -HKR, Ndi\Params\NetworkAddress, optional, 0, "0" -HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% -HKR, Ndi\Params\MaxSpeed, type, 0, "int" -HKR, Ndi\Params\MaxSpeed, default, 0, "100" -HKR, Ndi\Params\MaxSpeed, min, 0, "0" -HKR, Ndi\Params\MaxSpeed, max, 0, "2000" -HKR, Ndi\Params\MaxSpeed, step, 0, "1" -HKR, Ndi\Params\MaxSpeed, Base, 0, "10" -HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% -HKR, Ndi\Params\KeepLink, type, 0, "enum" -HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% -HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% -HKR, Ndi\Params\KeepLink, default, 0, "0" - - -[Neo.Service] -DisplayName = %Neo.Service.DispName% -Description = %Neo.Service.Desc% -ServiceType = 1 -StartType = 3 -ErrorControl = 1 -ServiceBinary = %12%\Neo6_x64_VPN62.sys -LoadOrderGroup = NDIS - -[Neo.Reg] -HKR, Ndi, Service, 0, Neo.Service.Name -HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" -HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" - -[Neo.EventLog] -HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo6_x64_VPN62.sys" -HKR, , TypesSupported, 0x00010001, 7 - -[Strings] -CompanyName = "SoftEther Corporation" -DiskDescription = "VPN Client Device Driver Install Disk" -Neo.Service.Name = "Neo_VPN62" -Neo.Service.DispName = "VPN Client Device Driver - VPN62" -Neo.Service.Desc = "VPN Client Adapter - VPN62" -NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN62" -Neo.EventLog.Name = "Neo" -NetworkAddress = "MAC Address" -DefaultAddress = "000001000001" -MaxSpeed = "Indicate Speed (Mbps)" -KeepLink = "Keep Link" -On = "On" -Off = "Off" - - -; Auto Generated 20180205_163625.730 - +; VPN Client Device Driver for Windows 2000 and Greater +; +; Copyright (c) SoftEther Corporation. All Rights Reserved. +; http://www.softether.co.jp/ +; +; BUILD 9658 + +[Version] +Signature = "$Windows NT$" +Class = Net +ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} +Provider = %CompanyName% +DriverVer = 02/04/2018, 4.25.0.9658 +CatalogFile.NT = Neo6_x64_VPN62.cat + +[Manufacturer] +%CompanyName% = SoftEther, NTamd64 + +[SourceDisksNames] +1=%DiskDescription%, "", , + +[SourceDisksFiles] +Neo6_x64_VPN62.sys = 1 + +[DestinationDirs] +DefaultDestDir = 12 +Neo.CopyFiles.Sys = 12 + +[Neo.CopyFiles.Sys] +Neo6_x64_VPN62.sys, , , 2 + +[SoftEther.NTamd64] +%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN62 + +[NeoAdapter.Install] +Characteristics = 0x1 +AddReg = Neo.Reg, NeoAdapter.Ndi +CopyFiles = Neo.CopyFiles.Sys +*IfType = 53 +*MediaType = 0 +*PhysicalMediaType = 0 + +[NeoAdapter.Install.Services] +AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% + +[NeoAdapter.Ndi] +HKR, , NetworkAddress, 0, %DefaultAddress% +HKR, Ndi, DeviceID, , "NeoAdapter_VPN62" +HKR, , DevLoader, , ndis +HKR, , DeviceVxDs, , Neo6_x64_VPN62.sys +HKR, NDIS, LogDriverName, , "Neo_VPN62" +HKR, NDIS, MajorNdisVersion, 1, 5 +HKR, NDIS, MinorNdisVersion, 1, 0 +HKR, Ndi\Interfaces, DefUpper, , "ndis5" +HKR, Ndi\Interfaces, UpperRange, , "ndis5" +HKR, Ndi\Interfaces, LowerRange, , "ethernet" +HKR, Ndi\Interfaces, DefLower, , "ethernet" +HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" +HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% +HKR, Ndi\Params\NetworkAddress, type, 0, "edit" +HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" +HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" +HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% +HKR, Ndi\Params\NetworkAddress, optional, 0, "0" +HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% +HKR, Ndi\Params\MaxSpeed, type, 0, "int" +HKR, Ndi\Params\MaxSpeed, default, 0, "100" +HKR, Ndi\Params\MaxSpeed, min, 0, "0" +HKR, Ndi\Params\MaxSpeed, max, 0, "2000" +HKR, Ndi\Params\MaxSpeed, step, 0, "1" +HKR, Ndi\Params\MaxSpeed, Base, 0, "10" +HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% +HKR, Ndi\Params\KeepLink, type, 0, "enum" +HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% +HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% +HKR, Ndi\Params\KeepLink, default, 0, "0" + + +[Neo.Service] +DisplayName = %Neo.Service.DispName% +Description = %Neo.Service.Desc% +ServiceType = 1 +StartType = 3 +ErrorControl = 1 +ServiceBinary = %12%\Neo6_x64_VPN62.sys +LoadOrderGroup = NDIS + +[Neo.Reg] +HKR, Ndi, Service, 0, Neo.Service.Name +HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" +HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" + +[Neo.EventLog] +HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo6_x64_VPN62.sys" +HKR, , TypesSupported, 0x00010001, 7 + +[Strings] +CompanyName = "SoftEther Corporation" +DiskDescription = "VPN Client Device Driver Install Disk" +Neo.Service.Name = "Neo_VPN62" +Neo.Service.DispName = "VPN Client Device Driver - VPN62" +Neo.Service.Desc = "VPN Client Adapter - VPN62" +NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN62" +Neo.EventLog.Name = "Neo" +NetworkAddress = "MAC Address" +DefaultAddress = "000001000001" +MaxSpeed = "Indicate Speed (Mbps)" +KeepLink = "Keep Link" +On = "On" +Off = "Off" + + +; Auto Generated 20180205_163625.730 + diff --git a/src/bin/hamcore/DriverPackages/Neo6_Win10/x64/Neo6_x64_VPN63.inf b/src/bin/hamcore/DriverPackages/Neo6_Win10/x64/Neo6_x64_VPN63.inf index 9541847c..51998a1b 100644 --- a/src/bin/hamcore/DriverPackages/Neo6_Win10/x64/Neo6_x64_VPN63.inf +++ b/src/bin/hamcore/DriverPackages/Neo6_Win10/x64/Neo6_x64_VPN63.inf @@ -1,114 +1,114 @@ -; VPN Client Device Driver for Windows 2000 and Greater -; -; Copyright (c) SoftEther Corporation. All Rights Reserved. -; http://www.softether.co.jp/ -; -; BUILD 9658 - -[Version] -Signature = "$Windows NT$" -Class = Net -ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} -Provider = %CompanyName% -DriverVer = 02/04/2018, 4.25.0.9658 -CatalogFile.NT = Neo6_x64_VPN63.cat - -[Manufacturer] -%CompanyName% = SoftEther, NTamd64 - -[SourceDisksNames] -1=%DiskDescription%, "", , - -[SourceDisksFiles] -Neo6_x64_VPN63.sys = 1 - -[DestinationDirs] -DefaultDestDir = 12 -Neo.CopyFiles.Sys = 12 - -[Neo.CopyFiles.Sys] -Neo6_x64_VPN63.sys, , , 2 - -[SoftEther.NTamd64] -%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN63 - -[NeoAdapter.Install] -Characteristics = 0x1 -AddReg = Neo.Reg, NeoAdapter.Ndi -CopyFiles = Neo.CopyFiles.Sys -*IfType = 53 -*MediaType = 0 -*PhysicalMediaType = 0 - -[NeoAdapter.Install.Services] -AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% - -[NeoAdapter.Ndi] -HKR, , NetworkAddress, 0, %DefaultAddress% -HKR, Ndi, DeviceID, , "NeoAdapter_VPN63" -HKR, , DevLoader, , ndis -HKR, , DeviceVxDs, , Neo6_x64_VPN63.sys -HKR, NDIS, LogDriverName, , "Neo_VPN63" -HKR, NDIS, MajorNdisVersion, 1, 5 -HKR, NDIS, MinorNdisVersion, 1, 0 -HKR, Ndi\Interfaces, DefUpper, , "ndis5" -HKR, Ndi\Interfaces, UpperRange, , "ndis5" -HKR, Ndi\Interfaces, LowerRange, , "ethernet" -HKR, Ndi\Interfaces, DefLower, , "ethernet" -HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" -HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% -HKR, Ndi\Params\NetworkAddress, type, 0, "edit" -HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" -HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" -HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% -HKR, Ndi\Params\NetworkAddress, optional, 0, "0" -HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% -HKR, Ndi\Params\MaxSpeed, type, 0, "int" -HKR, Ndi\Params\MaxSpeed, default, 0, "100" -HKR, Ndi\Params\MaxSpeed, min, 0, "0" -HKR, Ndi\Params\MaxSpeed, max, 0, "2000" -HKR, Ndi\Params\MaxSpeed, step, 0, "1" -HKR, Ndi\Params\MaxSpeed, Base, 0, "10" -HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% -HKR, Ndi\Params\KeepLink, type, 0, "enum" -HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% -HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% -HKR, Ndi\Params\KeepLink, default, 0, "0" - - -[Neo.Service] -DisplayName = %Neo.Service.DispName% -Description = %Neo.Service.Desc% -ServiceType = 1 -StartType = 3 -ErrorControl = 1 -ServiceBinary = %12%\Neo6_x64_VPN63.sys -LoadOrderGroup = NDIS - -[Neo.Reg] -HKR, Ndi, Service, 0, Neo.Service.Name -HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" -HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" - -[Neo.EventLog] -HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo6_x64_VPN63.sys" -HKR, , TypesSupported, 0x00010001, 7 - -[Strings] -CompanyName = "SoftEther Corporation" -DiskDescription = "VPN Client Device Driver Install Disk" -Neo.Service.Name = "Neo_VPN63" -Neo.Service.DispName = "VPN Client Device Driver - VPN63" -Neo.Service.Desc = "VPN Client Adapter - VPN63" -NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN63" -Neo.EventLog.Name = "Neo" -NetworkAddress = "MAC Address" -DefaultAddress = "000001000001" -MaxSpeed = "Indicate Speed (Mbps)" -KeepLink = "Keep Link" -On = "On" -Off = "Off" - - -; Auto Generated 20180205_163625.802 - +; VPN Client Device Driver for Windows 2000 and Greater +; +; Copyright (c) SoftEther Corporation. All Rights Reserved. +; http://www.softether.co.jp/ +; +; BUILD 9658 + +[Version] +Signature = "$Windows NT$" +Class = Net +ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} +Provider = %CompanyName% +DriverVer = 02/04/2018, 4.25.0.9658 +CatalogFile.NT = Neo6_x64_VPN63.cat + +[Manufacturer] +%CompanyName% = SoftEther, NTamd64 + +[SourceDisksNames] +1=%DiskDescription%, "", , + +[SourceDisksFiles] +Neo6_x64_VPN63.sys = 1 + +[DestinationDirs] +DefaultDestDir = 12 +Neo.CopyFiles.Sys = 12 + +[Neo.CopyFiles.Sys] +Neo6_x64_VPN63.sys, , , 2 + +[SoftEther.NTamd64] +%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN63 + +[NeoAdapter.Install] +Characteristics = 0x1 +AddReg = Neo.Reg, NeoAdapter.Ndi +CopyFiles = Neo.CopyFiles.Sys +*IfType = 53 +*MediaType = 0 +*PhysicalMediaType = 0 + +[NeoAdapter.Install.Services] +AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% + +[NeoAdapter.Ndi] +HKR, , NetworkAddress, 0, %DefaultAddress% +HKR, Ndi, DeviceID, , "NeoAdapter_VPN63" +HKR, , DevLoader, , ndis +HKR, , DeviceVxDs, , Neo6_x64_VPN63.sys +HKR, NDIS, LogDriverName, , "Neo_VPN63" +HKR, NDIS, MajorNdisVersion, 1, 5 +HKR, NDIS, MinorNdisVersion, 1, 0 +HKR, Ndi\Interfaces, DefUpper, , "ndis5" +HKR, Ndi\Interfaces, UpperRange, , "ndis5" +HKR, Ndi\Interfaces, LowerRange, , "ethernet" +HKR, Ndi\Interfaces, DefLower, , "ethernet" +HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" +HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% +HKR, Ndi\Params\NetworkAddress, type, 0, "edit" +HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" +HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" +HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% +HKR, Ndi\Params\NetworkAddress, optional, 0, "0" +HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% +HKR, Ndi\Params\MaxSpeed, type, 0, "int" +HKR, Ndi\Params\MaxSpeed, default, 0, "100" +HKR, Ndi\Params\MaxSpeed, min, 0, "0" +HKR, Ndi\Params\MaxSpeed, max, 0, "2000" +HKR, Ndi\Params\MaxSpeed, step, 0, "1" +HKR, Ndi\Params\MaxSpeed, Base, 0, "10" +HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% +HKR, Ndi\Params\KeepLink, type, 0, "enum" +HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% +HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% +HKR, Ndi\Params\KeepLink, default, 0, "0" + + +[Neo.Service] +DisplayName = %Neo.Service.DispName% +Description = %Neo.Service.Desc% +ServiceType = 1 +StartType = 3 +ErrorControl = 1 +ServiceBinary = %12%\Neo6_x64_VPN63.sys +LoadOrderGroup = NDIS + +[Neo.Reg] +HKR, Ndi, Service, 0, Neo.Service.Name +HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" +HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" + +[Neo.EventLog] +HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo6_x64_VPN63.sys" +HKR, , TypesSupported, 0x00010001, 7 + +[Strings] +CompanyName = "SoftEther Corporation" +DiskDescription = "VPN Client Device Driver Install Disk" +Neo.Service.Name = "Neo_VPN63" +Neo.Service.DispName = "VPN Client Device Driver - VPN63" +Neo.Service.Desc = "VPN Client Adapter - VPN63" +NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN63" +Neo.EventLog.Name = "Neo" +NetworkAddress = "MAC Address" +DefaultAddress = "000001000001" +MaxSpeed = "Indicate Speed (Mbps)" +KeepLink = "Keep Link" +On = "On" +Off = "Off" + + +; Auto Generated 20180205_163625.802 + diff --git a/src/bin/hamcore/DriverPackages/Neo6_Win10/x64/Neo6_x64_VPN64.inf b/src/bin/hamcore/DriverPackages/Neo6_Win10/x64/Neo6_x64_VPN64.inf index 9dd3be2f..1c4db9c8 100644 --- a/src/bin/hamcore/DriverPackages/Neo6_Win10/x64/Neo6_x64_VPN64.inf +++ b/src/bin/hamcore/DriverPackages/Neo6_Win10/x64/Neo6_x64_VPN64.inf @@ -1,114 +1,114 @@ -; VPN Client Device Driver for Windows 2000 and Greater -; -; Copyright (c) SoftEther Corporation. All Rights Reserved. -; http://www.softether.co.jp/ -; -; BUILD 9658 - -[Version] -Signature = "$Windows NT$" -Class = Net -ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} -Provider = %CompanyName% -DriverVer = 02/04/2018, 4.25.0.9658 -CatalogFile.NT = Neo6_x64_VPN64.cat - -[Manufacturer] -%CompanyName% = SoftEther, NTamd64 - -[SourceDisksNames] -1=%DiskDescription%, "", , - -[SourceDisksFiles] -Neo6_x64_VPN64.sys = 1 - -[DestinationDirs] -DefaultDestDir = 12 -Neo.CopyFiles.Sys = 12 - -[Neo.CopyFiles.Sys] -Neo6_x64_VPN64.sys, , , 2 - -[SoftEther.NTamd64] -%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN64 - -[NeoAdapter.Install] -Characteristics = 0x1 -AddReg = Neo.Reg, NeoAdapter.Ndi -CopyFiles = Neo.CopyFiles.Sys -*IfType = 53 -*MediaType = 0 -*PhysicalMediaType = 0 - -[NeoAdapter.Install.Services] -AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% - -[NeoAdapter.Ndi] -HKR, , NetworkAddress, 0, %DefaultAddress% -HKR, Ndi, DeviceID, , "NeoAdapter_VPN64" -HKR, , DevLoader, , ndis -HKR, , DeviceVxDs, , Neo6_x64_VPN64.sys -HKR, NDIS, LogDriverName, , "Neo_VPN64" -HKR, NDIS, MajorNdisVersion, 1, 5 -HKR, NDIS, MinorNdisVersion, 1, 0 -HKR, Ndi\Interfaces, DefUpper, , "ndis5" -HKR, Ndi\Interfaces, UpperRange, , "ndis5" -HKR, Ndi\Interfaces, LowerRange, , "ethernet" -HKR, Ndi\Interfaces, DefLower, , "ethernet" -HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" -HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% -HKR, Ndi\Params\NetworkAddress, type, 0, "edit" -HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" -HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" -HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% -HKR, Ndi\Params\NetworkAddress, optional, 0, "0" -HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% -HKR, Ndi\Params\MaxSpeed, type, 0, "int" -HKR, Ndi\Params\MaxSpeed, default, 0, "100" -HKR, Ndi\Params\MaxSpeed, min, 0, "0" -HKR, Ndi\Params\MaxSpeed, max, 0, "2000" -HKR, Ndi\Params\MaxSpeed, step, 0, "1" -HKR, Ndi\Params\MaxSpeed, Base, 0, "10" -HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% -HKR, Ndi\Params\KeepLink, type, 0, "enum" -HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% -HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% -HKR, Ndi\Params\KeepLink, default, 0, "0" - - -[Neo.Service] -DisplayName = %Neo.Service.DispName% -Description = %Neo.Service.Desc% -ServiceType = 1 -StartType = 3 -ErrorControl = 1 -ServiceBinary = %12%\Neo6_x64_VPN64.sys -LoadOrderGroup = NDIS - -[Neo.Reg] -HKR, Ndi, Service, 0, Neo.Service.Name -HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" -HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" - -[Neo.EventLog] -HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo6_x64_VPN64.sys" -HKR, , TypesSupported, 0x00010001, 7 - -[Strings] -CompanyName = "SoftEther Corporation" -DiskDescription = "VPN Client Device Driver Install Disk" -Neo.Service.Name = "Neo_VPN64" -Neo.Service.DispName = "VPN Client Device Driver - VPN64" -Neo.Service.Desc = "VPN Client Adapter - VPN64" -NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN64" -Neo.EventLog.Name = "Neo" -NetworkAddress = "MAC Address" -DefaultAddress = "000001000001" -MaxSpeed = "Indicate Speed (Mbps)" -KeepLink = "Keep Link" -On = "On" -Off = "Off" - - -; Auto Generated 20180205_163625.874 - +; VPN Client Device Driver for Windows 2000 and Greater +; +; Copyright (c) SoftEther Corporation. All Rights Reserved. +; http://www.softether.co.jp/ +; +; BUILD 9658 + +[Version] +Signature = "$Windows NT$" +Class = Net +ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} +Provider = %CompanyName% +DriverVer = 02/04/2018, 4.25.0.9658 +CatalogFile.NT = Neo6_x64_VPN64.cat + +[Manufacturer] +%CompanyName% = SoftEther, NTamd64 + +[SourceDisksNames] +1=%DiskDescription%, "", , + +[SourceDisksFiles] +Neo6_x64_VPN64.sys = 1 + +[DestinationDirs] +DefaultDestDir = 12 +Neo.CopyFiles.Sys = 12 + +[Neo.CopyFiles.Sys] +Neo6_x64_VPN64.sys, , , 2 + +[SoftEther.NTamd64] +%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN64 + +[NeoAdapter.Install] +Characteristics = 0x1 +AddReg = Neo.Reg, NeoAdapter.Ndi +CopyFiles = Neo.CopyFiles.Sys +*IfType = 53 +*MediaType = 0 +*PhysicalMediaType = 0 + +[NeoAdapter.Install.Services] +AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% + +[NeoAdapter.Ndi] +HKR, , NetworkAddress, 0, %DefaultAddress% +HKR, Ndi, DeviceID, , "NeoAdapter_VPN64" +HKR, , DevLoader, , ndis +HKR, , DeviceVxDs, , Neo6_x64_VPN64.sys +HKR, NDIS, LogDriverName, , "Neo_VPN64" +HKR, NDIS, MajorNdisVersion, 1, 5 +HKR, NDIS, MinorNdisVersion, 1, 0 +HKR, Ndi\Interfaces, DefUpper, , "ndis5" +HKR, Ndi\Interfaces, UpperRange, , "ndis5" +HKR, Ndi\Interfaces, LowerRange, , "ethernet" +HKR, Ndi\Interfaces, DefLower, , "ethernet" +HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" +HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% +HKR, Ndi\Params\NetworkAddress, type, 0, "edit" +HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" +HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" +HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% +HKR, Ndi\Params\NetworkAddress, optional, 0, "0" +HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% +HKR, Ndi\Params\MaxSpeed, type, 0, "int" +HKR, Ndi\Params\MaxSpeed, default, 0, "100" +HKR, Ndi\Params\MaxSpeed, min, 0, "0" +HKR, Ndi\Params\MaxSpeed, max, 0, "2000" +HKR, Ndi\Params\MaxSpeed, step, 0, "1" +HKR, Ndi\Params\MaxSpeed, Base, 0, "10" +HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% +HKR, Ndi\Params\KeepLink, type, 0, "enum" +HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% +HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% +HKR, Ndi\Params\KeepLink, default, 0, "0" + + +[Neo.Service] +DisplayName = %Neo.Service.DispName% +Description = %Neo.Service.Desc% +ServiceType = 1 +StartType = 3 +ErrorControl = 1 +ServiceBinary = %12%\Neo6_x64_VPN64.sys +LoadOrderGroup = NDIS + +[Neo.Reg] +HKR, Ndi, Service, 0, Neo.Service.Name +HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" +HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" + +[Neo.EventLog] +HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo6_x64_VPN64.sys" +HKR, , TypesSupported, 0x00010001, 7 + +[Strings] +CompanyName = "SoftEther Corporation" +DiskDescription = "VPN Client Device Driver Install Disk" +Neo.Service.Name = "Neo_VPN64" +Neo.Service.DispName = "VPN Client Device Driver - VPN64" +Neo.Service.Desc = "VPN Client Adapter - VPN64" +NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN64" +Neo.EventLog.Name = "Neo" +NetworkAddress = "MAC Address" +DefaultAddress = "000001000001" +MaxSpeed = "Indicate Speed (Mbps)" +KeepLink = "Keep Link" +On = "On" +Off = "Off" + + +; Auto Generated 20180205_163625.874 + diff --git a/src/bin/hamcore/DriverPackages/Neo6_Win10/x64/Neo6_x64_VPN65.inf b/src/bin/hamcore/DriverPackages/Neo6_Win10/x64/Neo6_x64_VPN65.inf index 2d12d317..228e8a32 100644 --- a/src/bin/hamcore/DriverPackages/Neo6_Win10/x64/Neo6_x64_VPN65.inf +++ b/src/bin/hamcore/DriverPackages/Neo6_Win10/x64/Neo6_x64_VPN65.inf @@ -1,114 +1,114 @@ -; VPN Client Device Driver for Windows 2000 and Greater -; -; Copyright (c) SoftEther Corporation. All Rights Reserved. -; http://www.softether.co.jp/ -; -; BUILD 9658 - -[Version] -Signature = "$Windows NT$" -Class = Net -ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} -Provider = %CompanyName% -DriverVer = 02/04/2018, 4.25.0.9658 -CatalogFile.NT = Neo6_x64_VPN65.cat - -[Manufacturer] -%CompanyName% = SoftEther, NTamd64 - -[SourceDisksNames] -1=%DiskDescription%, "", , - -[SourceDisksFiles] -Neo6_x64_VPN65.sys = 1 - -[DestinationDirs] -DefaultDestDir = 12 -Neo.CopyFiles.Sys = 12 - -[Neo.CopyFiles.Sys] -Neo6_x64_VPN65.sys, , , 2 - -[SoftEther.NTamd64] -%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN65 - -[NeoAdapter.Install] -Characteristics = 0x1 -AddReg = Neo.Reg, NeoAdapter.Ndi -CopyFiles = Neo.CopyFiles.Sys -*IfType = 53 -*MediaType = 0 -*PhysicalMediaType = 0 - -[NeoAdapter.Install.Services] -AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% - -[NeoAdapter.Ndi] -HKR, , NetworkAddress, 0, %DefaultAddress% -HKR, Ndi, DeviceID, , "NeoAdapter_VPN65" -HKR, , DevLoader, , ndis -HKR, , DeviceVxDs, , Neo6_x64_VPN65.sys -HKR, NDIS, LogDriverName, , "Neo_VPN65" -HKR, NDIS, MajorNdisVersion, 1, 5 -HKR, NDIS, MinorNdisVersion, 1, 0 -HKR, Ndi\Interfaces, DefUpper, , "ndis5" -HKR, Ndi\Interfaces, UpperRange, , "ndis5" -HKR, Ndi\Interfaces, LowerRange, , "ethernet" -HKR, Ndi\Interfaces, DefLower, , "ethernet" -HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" -HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% -HKR, Ndi\Params\NetworkAddress, type, 0, "edit" -HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" -HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" -HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% -HKR, Ndi\Params\NetworkAddress, optional, 0, "0" -HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% -HKR, Ndi\Params\MaxSpeed, type, 0, "int" -HKR, Ndi\Params\MaxSpeed, default, 0, "100" -HKR, Ndi\Params\MaxSpeed, min, 0, "0" -HKR, Ndi\Params\MaxSpeed, max, 0, "2000" -HKR, Ndi\Params\MaxSpeed, step, 0, "1" -HKR, Ndi\Params\MaxSpeed, Base, 0, "10" -HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% -HKR, Ndi\Params\KeepLink, type, 0, "enum" -HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% -HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% -HKR, Ndi\Params\KeepLink, default, 0, "0" - - -[Neo.Service] -DisplayName = %Neo.Service.DispName% -Description = %Neo.Service.Desc% -ServiceType = 1 -StartType = 3 -ErrorControl = 1 -ServiceBinary = %12%\Neo6_x64_VPN65.sys -LoadOrderGroup = NDIS - -[Neo.Reg] -HKR, Ndi, Service, 0, Neo.Service.Name -HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" -HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" - -[Neo.EventLog] -HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo6_x64_VPN65.sys" -HKR, , TypesSupported, 0x00010001, 7 - -[Strings] -CompanyName = "SoftEther Corporation" -DiskDescription = "VPN Client Device Driver Install Disk" -Neo.Service.Name = "Neo_VPN65" -Neo.Service.DispName = "VPN Client Device Driver - VPN65" -Neo.Service.Desc = "VPN Client Adapter - VPN65" -NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN65" -Neo.EventLog.Name = "Neo" -NetworkAddress = "MAC Address" -DefaultAddress = "000001000001" -MaxSpeed = "Indicate Speed (Mbps)" -KeepLink = "Keep Link" -On = "On" -Off = "Off" - - -; Auto Generated 20180205_163625.948 - +; VPN Client Device Driver for Windows 2000 and Greater +; +; Copyright (c) SoftEther Corporation. All Rights Reserved. +; http://www.softether.co.jp/ +; +; BUILD 9658 + +[Version] +Signature = "$Windows NT$" +Class = Net +ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} +Provider = %CompanyName% +DriverVer = 02/04/2018, 4.25.0.9658 +CatalogFile.NT = Neo6_x64_VPN65.cat + +[Manufacturer] +%CompanyName% = SoftEther, NTamd64 + +[SourceDisksNames] +1=%DiskDescription%, "", , + +[SourceDisksFiles] +Neo6_x64_VPN65.sys = 1 + +[DestinationDirs] +DefaultDestDir = 12 +Neo.CopyFiles.Sys = 12 + +[Neo.CopyFiles.Sys] +Neo6_x64_VPN65.sys, , , 2 + +[SoftEther.NTamd64] +%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN65 + +[NeoAdapter.Install] +Characteristics = 0x1 +AddReg = Neo.Reg, NeoAdapter.Ndi +CopyFiles = Neo.CopyFiles.Sys +*IfType = 53 +*MediaType = 0 +*PhysicalMediaType = 0 + +[NeoAdapter.Install.Services] +AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% + +[NeoAdapter.Ndi] +HKR, , NetworkAddress, 0, %DefaultAddress% +HKR, Ndi, DeviceID, , "NeoAdapter_VPN65" +HKR, , DevLoader, , ndis +HKR, , DeviceVxDs, , Neo6_x64_VPN65.sys +HKR, NDIS, LogDriverName, , "Neo_VPN65" +HKR, NDIS, MajorNdisVersion, 1, 5 +HKR, NDIS, MinorNdisVersion, 1, 0 +HKR, Ndi\Interfaces, DefUpper, , "ndis5" +HKR, Ndi\Interfaces, UpperRange, , "ndis5" +HKR, Ndi\Interfaces, LowerRange, , "ethernet" +HKR, Ndi\Interfaces, DefLower, , "ethernet" +HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" +HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% +HKR, Ndi\Params\NetworkAddress, type, 0, "edit" +HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" +HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" +HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% +HKR, Ndi\Params\NetworkAddress, optional, 0, "0" +HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% +HKR, Ndi\Params\MaxSpeed, type, 0, "int" +HKR, Ndi\Params\MaxSpeed, default, 0, "100" +HKR, Ndi\Params\MaxSpeed, min, 0, "0" +HKR, Ndi\Params\MaxSpeed, max, 0, "2000" +HKR, Ndi\Params\MaxSpeed, step, 0, "1" +HKR, Ndi\Params\MaxSpeed, Base, 0, "10" +HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% +HKR, Ndi\Params\KeepLink, type, 0, "enum" +HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% +HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% +HKR, Ndi\Params\KeepLink, default, 0, "0" + + +[Neo.Service] +DisplayName = %Neo.Service.DispName% +Description = %Neo.Service.Desc% +ServiceType = 1 +StartType = 3 +ErrorControl = 1 +ServiceBinary = %12%\Neo6_x64_VPN65.sys +LoadOrderGroup = NDIS + +[Neo.Reg] +HKR, Ndi, Service, 0, Neo.Service.Name +HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" +HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" + +[Neo.EventLog] +HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo6_x64_VPN65.sys" +HKR, , TypesSupported, 0x00010001, 7 + +[Strings] +CompanyName = "SoftEther Corporation" +DiskDescription = "VPN Client Device Driver Install Disk" +Neo.Service.Name = "Neo_VPN65" +Neo.Service.DispName = "VPN Client Device Driver - VPN65" +Neo.Service.Desc = "VPN Client Adapter - VPN65" +NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN65" +Neo.EventLog.Name = "Neo" +NetworkAddress = "MAC Address" +DefaultAddress = "000001000001" +MaxSpeed = "Indicate Speed (Mbps)" +KeepLink = "Keep Link" +On = "On" +Off = "Off" + + +; Auto Generated 20180205_163625.948 + diff --git a/src/bin/hamcore/DriverPackages/Neo6_Win10/x64/Neo6_x64_VPN66.inf b/src/bin/hamcore/DriverPackages/Neo6_Win10/x64/Neo6_x64_VPN66.inf index 7ad80a01..df7d39f9 100644 --- a/src/bin/hamcore/DriverPackages/Neo6_Win10/x64/Neo6_x64_VPN66.inf +++ b/src/bin/hamcore/DriverPackages/Neo6_Win10/x64/Neo6_x64_VPN66.inf @@ -1,114 +1,114 @@ -; VPN Client Device Driver for Windows 2000 and Greater -; -; Copyright (c) SoftEther Corporation. All Rights Reserved. -; http://www.softether.co.jp/ -; -; BUILD 9658 - -[Version] -Signature = "$Windows NT$" -Class = Net -ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} -Provider = %CompanyName% -DriverVer = 02/04/2018, 4.25.0.9658 -CatalogFile.NT = Neo6_x64_VPN66.cat - -[Manufacturer] -%CompanyName% = SoftEther, NTamd64 - -[SourceDisksNames] -1=%DiskDescription%, "", , - -[SourceDisksFiles] -Neo6_x64_VPN66.sys = 1 - -[DestinationDirs] -DefaultDestDir = 12 -Neo.CopyFiles.Sys = 12 - -[Neo.CopyFiles.Sys] -Neo6_x64_VPN66.sys, , , 2 - -[SoftEther.NTamd64] -%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN66 - -[NeoAdapter.Install] -Characteristics = 0x1 -AddReg = Neo.Reg, NeoAdapter.Ndi -CopyFiles = Neo.CopyFiles.Sys -*IfType = 53 -*MediaType = 0 -*PhysicalMediaType = 0 - -[NeoAdapter.Install.Services] -AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% - -[NeoAdapter.Ndi] -HKR, , NetworkAddress, 0, %DefaultAddress% -HKR, Ndi, DeviceID, , "NeoAdapter_VPN66" -HKR, , DevLoader, , ndis -HKR, , DeviceVxDs, , Neo6_x64_VPN66.sys -HKR, NDIS, LogDriverName, , "Neo_VPN66" -HKR, NDIS, MajorNdisVersion, 1, 5 -HKR, NDIS, MinorNdisVersion, 1, 0 -HKR, Ndi\Interfaces, DefUpper, , "ndis5" -HKR, Ndi\Interfaces, UpperRange, , "ndis5" -HKR, Ndi\Interfaces, LowerRange, , "ethernet" -HKR, Ndi\Interfaces, DefLower, , "ethernet" -HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" -HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% -HKR, Ndi\Params\NetworkAddress, type, 0, "edit" -HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" -HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" -HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% -HKR, Ndi\Params\NetworkAddress, optional, 0, "0" -HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% -HKR, Ndi\Params\MaxSpeed, type, 0, "int" -HKR, Ndi\Params\MaxSpeed, default, 0, "100" -HKR, Ndi\Params\MaxSpeed, min, 0, "0" -HKR, Ndi\Params\MaxSpeed, max, 0, "2000" -HKR, Ndi\Params\MaxSpeed, step, 0, "1" -HKR, Ndi\Params\MaxSpeed, Base, 0, "10" -HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% -HKR, Ndi\Params\KeepLink, type, 0, "enum" -HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% -HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% -HKR, Ndi\Params\KeepLink, default, 0, "0" - - -[Neo.Service] -DisplayName = %Neo.Service.DispName% -Description = %Neo.Service.Desc% -ServiceType = 1 -StartType = 3 -ErrorControl = 1 -ServiceBinary = %12%\Neo6_x64_VPN66.sys -LoadOrderGroup = NDIS - -[Neo.Reg] -HKR, Ndi, Service, 0, Neo.Service.Name -HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" -HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" - -[Neo.EventLog] -HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo6_x64_VPN66.sys" -HKR, , TypesSupported, 0x00010001, 7 - -[Strings] -CompanyName = "SoftEther Corporation" -DiskDescription = "VPN Client Device Driver Install Disk" -Neo.Service.Name = "Neo_VPN66" -Neo.Service.DispName = "VPN Client Device Driver - VPN66" -Neo.Service.Desc = "VPN Client Adapter - VPN66" -NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN66" -Neo.EventLog.Name = "Neo" -NetworkAddress = "MAC Address" -DefaultAddress = "000001000001" -MaxSpeed = "Indicate Speed (Mbps)" -KeepLink = "Keep Link" -On = "On" -Off = "Off" - - -; Auto Generated 20180205_163626.018 - +; VPN Client Device Driver for Windows 2000 and Greater +; +; Copyright (c) SoftEther Corporation. All Rights Reserved. +; http://www.softether.co.jp/ +; +; BUILD 9658 + +[Version] +Signature = "$Windows NT$" +Class = Net +ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} +Provider = %CompanyName% +DriverVer = 02/04/2018, 4.25.0.9658 +CatalogFile.NT = Neo6_x64_VPN66.cat + +[Manufacturer] +%CompanyName% = SoftEther, NTamd64 + +[SourceDisksNames] +1=%DiskDescription%, "", , + +[SourceDisksFiles] +Neo6_x64_VPN66.sys = 1 + +[DestinationDirs] +DefaultDestDir = 12 +Neo.CopyFiles.Sys = 12 + +[Neo.CopyFiles.Sys] +Neo6_x64_VPN66.sys, , , 2 + +[SoftEther.NTamd64] +%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN66 + +[NeoAdapter.Install] +Characteristics = 0x1 +AddReg = Neo.Reg, NeoAdapter.Ndi +CopyFiles = Neo.CopyFiles.Sys +*IfType = 53 +*MediaType = 0 +*PhysicalMediaType = 0 + +[NeoAdapter.Install.Services] +AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% + +[NeoAdapter.Ndi] +HKR, , NetworkAddress, 0, %DefaultAddress% +HKR, Ndi, DeviceID, , "NeoAdapter_VPN66" +HKR, , DevLoader, , ndis +HKR, , DeviceVxDs, , Neo6_x64_VPN66.sys +HKR, NDIS, LogDriverName, , "Neo_VPN66" +HKR, NDIS, MajorNdisVersion, 1, 5 +HKR, NDIS, MinorNdisVersion, 1, 0 +HKR, Ndi\Interfaces, DefUpper, , "ndis5" +HKR, Ndi\Interfaces, UpperRange, , "ndis5" +HKR, Ndi\Interfaces, LowerRange, , "ethernet" +HKR, Ndi\Interfaces, DefLower, , "ethernet" +HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" +HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% +HKR, Ndi\Params\NetworkAddress, type, 0, "edit" +HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" +HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" +HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% +HKR, Ndi\Params\NetworkAddress, optional, 0, "0" +HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% +HKR, Ndi\Params\MaxSpeed, type, 0, "int" +HKR, Ndi\Params\MaxSpeed, default, 0, "100" +HKR, Ndi\Params\MaxSpeed, min, 0, "0" +HKR, Ndi\Params\MaxSpeed, max, 0, "2000" +HKR, Ndi\Params\MaxSpeed, step, 0, "1" +HKR, Ndi\Params\MaxSpeed, Base, 0, "10" +HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% +HKR, Ndi\Params\KeepLink, type, 0, "enum" +HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% +HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% +HKR, Ndi\Params\KeepLink, default, 0, "0" + + +[Neo.Service] +DisplayName = %Neo.Service.DispName% +Description = %Neo.Service.Desc% +ServiceType = 1 +StartType = 3 +ErrorControl = 1 +ServiceBinary = %12%\Neo6_x64_VPN66.sys +LoadOrderGroup = NDIS + +[Neo.Reg] +HKR, Ndi, Service, 0, Neo.Service.Name +HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" +HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" + +[Neo.EventLog] +HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo6_x64_VPN66.sys" +HKR, , TypesSupported, 0x00010001, 7 + +[Strings] +CompanyName = "SoftEther Corporation" +DiskDescription = "VPN Client Device Driver Install Disk" +Neo.Service.Name = "Neo_VPN66" +Neo.Service.DispName = "VPN Client Device Driver - VPN66" +Neo.Service.Desc = "VPN Client Adapter - VPN66" +NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN66" +Neo.EventLog.Name = "Neo" +NetworkAddress = "MAC Address" +DefaultAddress = "000001000001" +MaxSpeed = "Indicate Speed (Mbps)" +KeepLink = "Keep Link" +On = "On" +Off = "Off" + + +; Auto Generated 20180205_163626.018 + diff --git a/src/bin/hamcore/DriverPackages/Neo6_Win10/x64/Neo6_x64_VPN67.inf b/src/bin/hamcore/DriverPackages/Neo6_Win10/x64/Neo6_x64_VPN67.inf index 8a75097e..73102bd8 100644 --- a/src/bin/hamcore/DriverPackages/Neo6_Win10/x64/Neo6_x64_VPN67.inf +++ b/src/bin/hamcore/DriverPackages/Neo6_Win10/x64/Neo6_x64_VPN67.inf @@ -1,114 +1,114 @@ -; VPN Client Device Driver for Windows 2000 and Greater -; -; Copyright (c) SoftEther Corporation. All Rights Reserved. -; http://www.softether.co.jp/ -; -; BUILD 9658 - -[Version] -Signature = "$Windows NT$" -Class = Net -ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} -Provider = %CompanyName% -DriverVer = 02/04/2018, 4.25.0.9658 -CatalogFile.NT = Neo6_x64_VPN67.cat - -[Manufacturer] -%CompanyName% = SoftEther, NTamd64 - -[SourceDisksNames] -1=%DiskDescription%, "", , - -[SourceDisksFiles] -Neo6_x64_VPN67.sys = 1 - -[DestinationDirs] -DefaultDestDir = 12 -Neo.CopyFiles.Sys = 12 - -[Neo.CopyFiles.Sys] -Neo6_x64_VPN67.sys, , , 2 - -[SoftEther.NTamd64] -%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN67 - -[NeoAdapter.Install] -Characteristics = 0x1 -AddReg = Neo.Reg, NeoAdapter.Ndi -CopyFiles = Neo.CopyFiles.Sys -*IfType = 53 -*MediaType = 0 -*PhysicalMediaType = 0 - -[NeoAdapter.Install.Services] -AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% - -[NeoAdapter.Ndi] -HKR, , NetworkAddress, 0, %DefaultAddress% -HKR, Ndi, DeviceID, , "NeoAdapter_VPN67" -HKR, , DevLoader, , ndis -HKR, , DeviceVxDs, , Neo6_x64_VPN67.sys -HKR, NDIS, LogDriverName, , "Neo_VPN67" -HKR, NDIS, MajorNdisVersion, 1, 5 -HKR, NDIS, MinorNdisVersion, 1, 0 -HKR, Ndi\Interfaces, DefUpper, , "ndis5" -HKR, Ndi\Interfaces, UpperRange, , "ndis5" -HKR, Ndi\Interfaces, LowerRange, , "ethernet" -HKR, Ndi\Interfaces, DefLower, , "ethernet" -HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" -HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% -HKR, Ndi\Params\NetworkAddress, type, 0, "edit" -HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" -HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" -HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% -HKR, Ndi\Params\NetworkAddress, optional, 0, "0" -HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% -HKR, Ndi\Params\MaxSpeed, type, 0, "int" -HKR, Ndi\Params\MaxSpeed, default, 0, "100" -HKR, Ndi\Params\MaxSpeed, min, 0, "0" -HKR, Ndi\Params\MaxSpeed, max, 0, "2000" -HKR, Ndi\Params\MaxSpeed, step, 0, "1" -HKR, Ndi\Params\MaxSpeed, Base, 0, "10" -HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% -HKR, Ndi\Params\KeepLink, type, 0, "enum" -HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% -HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% -HKR, Ndi\Params\KeepLink, default, 0, "0" - - -[Neo.Service] -DisplayName = %Neo.Service.DispName% -Description = %Neo.Service.Desc% -ServiceType = 1 -StartType = 3 -ErrorControl = 1 -ServiceBinary = %12%\Neo6_x64_VPN67.sys -LoadOrderGroup = NDIS - -[Neo.Reg] -HKR, Ndi, Service, 0, Neo.Service.Name -HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" -HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" - -[Neo.EventLog] -HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo6_x64_VPN67.sys" -HKR, , TypesSupported, 0x00010001, 7 - -[Strings] -CompanyName = "SoftEther Corporation" -DiskDescription = "VPN Client Device Driver Install Disk" -Neo.Service.Name = "Neo_VPN67" -Neo.Service.DispName = "VPN Client Device Driver - VPN67" -Neo.Service.Desc = "VPN Client Adapter - VPN67" -NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN67" -Neo.EventLog.Name = "Neo" -NetworkAddress = "MAC Address" -DefaultAddress = "000001000001" -MaxSpeed = "Indicate Speed (Mbps)" -KeepLink = "Keep Link" -On = "On" -Off = "Off" - - -; Auto Generated 20180205_163626.090 - +; VPN Client Device Driver for Windows 2000 and Greater +; +; Copyright (c) SoftEther Corporation. All Rights Reserved. +; http://www.softether.co.jp/ +; +; BUILD 9658 + +[Version] +Signature = "$Windows NT$" +Class = Net +ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} +Provider = %CompanyName% +DriverVer = 02/04/2018, 4.25.0.9658 +CatalogFile.NT = Neo6_x64_VPN67.cat + +[Manufacturer] +%CompanyName% = SoftEther, NTamd64 + +[SourceDisksNames] +1=%DiskDescription%, "", , + +[SourceDisksFiles] +Neo6_x64_VPN67.sys = 1 + +[DestinationDirs] +DefaultDestDir = 12 +Neo.CopyFiles.Sys = 12 + +[Neo.CopyFiles.Sys] +Neo6_x64_VPN67.sys, , , 2 + +[SoftEther.NTamd64] +%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN67 + +[NeoAdapter.Install] +Characteristics = 0x1 +AddReg = Neo.Reg, NeoAdapter.Ndi +CopyFiles = Neo.CopyFiles.Sys +*IfType = 53 +*MediaType = 0 +*PhysicalMediaType = 0 + +[NeoAdapter.Install.Services] +AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% + +[NeoAdapter.Ndi] +HKR, , NetworkAddress, 0, %DefaultAddress% +HKR, Ndi, DeviceID, , "NeoAdapter_VPN67" +HKR, , DevLoader, , ndis +HKR, , DeviceVxDs, , Neo6_x64_VPN67.sys +HKR, NDIS, LogDriverName, , "Neo_VPN67" +HKR, NDIS, MajorNdisVersion, 1, 5 +HKR, NDIS, MinorNdisVersion, 1, 0 +HKR, Ndi\Interfaces, DefUpper, , "ndis5" +HKR, Ndi\Interfaces, UpperRange, , "ndis5" +HKR, Ndi\Interfaces, LowerRange, , "ethernet" +HKR, Ndi\Interfaces, DefLower, , "ethernet" +HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" +HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% +HKR, Ndi\Params\NetworkAddress, type, 0, "edit" +HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" +HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" +HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% +HKR, Ndi\Params\NetworkAddress, optional, 0, "0" +HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% +HKR, Ndi\Params\MaxSpeed, type, 0, "int" +HKR, Ndi\Params\MaxSpeed, default, 0, "100" +HKR, Ndi\Params\MaxSpeed, min, 0, "0" +HKR, Ndi\Params\MaxSpeed, max, 0, "2000" +HKR, Ndi\Params\MaxSpeed, step, 0, "1" +HKR, Ndi\Params\MaxSpeed, Base, 0, "10" +HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% +HKR, Ndi\Params\KeepLink, type, 0, "enum" +HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% +HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% +HKR, Ndi\Params\KeepLink, default, 0, "0" + + +[Neo.Service] +DisplayName = %Neo.Service.DispName% +Description = %Neo.Service.Desc% +ServiceType = 1 +StartType = 3 +ErrorControl = 1 +ServiceBinary = %12%\Neo6_x64_VPN67.sys +LoadOrderGroup = NDIS + +[Neo.Reg] +HKR, Ndi, Service, 0, Neo.Service.Name +HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" +HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" + +[Neo.EventLog] +HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo6_x64_VPN67.sys" +HKR, , TypesSupported, 0x00010001, 7 + +[Strings] +CompanyName = "SoftEther Corporation" +DiskDescription = "VPN Client Device Driver Install Disk" +Neo.Service.Name = "Neo_VPN67" +Neo.Service.DispName = "VPN Client Device Driver - VPN67" +Neo.Service.Desc = "VPN Client Adapter - VPN67" +NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN67" +Neo.EventLog.Name = "Neo" +NetworkAddress = "MAC Address" +DefaultAddress = "000001000001" +MaxSpeed = "Indicate Speed (Mbps)" +KeepLink = "Keep Link" +On = "On" +Off = "Off" + + +; Auto Generated 20180205_163626.090 + diff --git a/src/bin/hamcore/DriverPackages/Neo6_Win10/x64/Neo6_x64_VPN68.inf b/src/bin/hamcore/DriverPackages/Neo6_Win10/x64/Neo6_x64_VPN68.inf index 8ad428ab..9c95f8c2 100644 --- a/src/bin/hamcore/DriverPackages/Neo6_Win10/x64/Neo6_x64_VPN68.inf +++ b/src/bin/hamcore/DriverPackages/Neo6_Win10/x64/Neo6_x64_VPN68.inf @@ -1,114 +1,114 @@ -; VPN Client Device Driver for Windows 2000 and Greater -; -; Copyright (c) SoftEther Corporation. All Rights Reserved. -; http://www.softether.co.jp/ -; -; BUILD 9658 - -[Version] -Signature = "$Windows NT$" -Class = Net -ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} -Provider = %CompanyName% -DriverVer = 02/04/2018, 4.25.0.9658 -CatalogFile.NT = Neo6_x64_VPN68.cat - -[Manufacturer] -%CompanyName% = SoftEther, NTamd64 - -[SourceDisksNames] -1=%DiskDescription%, "", , - -[SourceDisksFiles] -Neo6_x64_VPN68.sys = 1 - -[DestinationDirs] -DefaultDestDir = 12 -Neo.CopyFiles.Sys = 12 - -[Neo.CopyFiles.Sys] -Neo6_x64_VPN68.sys, , , 2 - -[SoftEther.NTamd64] -%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN68 - -[NeoAdapter.Install] -Characteristics = 0x1 -AddReg = Neo.Reg, NeoAdapter.Ndi -CopyFiles = Neo.CopyFiles.Sys -*IfType = 53 -*MediaType = 0 -*PhysicalMediaType = 0 - -[NeoAdapter.Install.Services] -AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% - -[NeoAdapter.Ndi] -HKR, , NetworkAddress, 0, %DefaultAddress% -HKR, Ndi, DeviceID, , "NeoAdapter_VPN68" -HKR, , DevLoader, , ndis -HKR, , DeviceVxDs, , Neo6_x64_VPN68.sys -HKR, NDIS, LogDriverName, , "Neo_VPN68" -HKR, NDIS, MajorNdisVersion, 1, 5 -HKR, NDIS, MinorNdisVersion, 1, 0 -HKR, Ndi\Interfaces, DefUpper, , "ndis5" -HKR, Ndi\Interfaces, UpperRange, , "ndis5" -HKR, Ndi\Interfaces, LowerRange, , "ethernet" -HKR, Ndi\Interfaces, DefLower, , "ethernet" -HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" -HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% -HKR, Ndi\Params\NetworkAddress, type, 0, "edit" -HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" -HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" -HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% -HKR, Ndi\Params\NetworkAddress, optional, 0, "0" -HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% -HKR, Ndi\Params\MaxSpeed, type, 0, "int" -HKR, Ndi\Params\MaxSpeed, default, 0, "100" -HKR, Ndi\Params\MaxSpeed, min, 0, "0" -HKR, Ndi\Params\MaxSpeed, max, 0, "2000" -HKR, Ndi\Params\MaxSpeed, step, 0, "1" -HKR, Ndi\Params\MaxSpeed, Base, 0, "10" -HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% -HKR, Ndi\Params\KeepLink, type, 0, "enum" -HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% -HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% -HKR, Ndi\Params\KeepLink, default, 0, "0" - - -[Neo.Service] -DisplayName = %Neo.Service.DispName% -Description = %Neo.Service.Desc% -ServiceType = 1 -StartType = 3 -ErrorControl = 1 -ServiceBinary = %12%\Neo6_x64_VPN68.sys -LoadOrderGroup = NDIS - -[Neo.Reg] -HKR, Ndi, Service, 0, Neo.Service.Name -HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" -HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" - -[Neo.EventLog] -HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo6_x64_VPN68.sys" -HKR, , TypesSupported, 0x00010001, 7 - -[Strings] -CompanyName = "SoftEther Corporation" -DiskDescription = "VPN Client Device Driver Install Disk" -Neo.Service.Name = "Neo_VPN68" -Neo.Service.DispName = "VPN Client Device Driver - VPN68" -Neo.Service.Desc = "VPN Client Adapter - VPN68" -NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN68" -Neo.EventLog.Name = "Neo" -NetworkAddress = "MAC Address" -DefaultAddress = "000001000001" -MaxSpeed = "Indicate Speed (Mbps)" -KeepLink = "Keep Link" -On = "On" -Off = "Off" - - -; Auto Generated 20180205_163626.161 - +; VPN Client Device Driver for Windows 2000 and Greater +; +; Copyright (c) SoftEther Corporation. All Rights Reserved. +; http://www.softether.co.jp/ +; +; BUILD 9658 + +[Version] +Signature = "$Windows NT$" +Class = Net +ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} +Provider = %CompanyName% +DriverVer = 02/04/2018, 4.25.0.9658 +CatalogFile.NT = Neo6_x64_VPN68.cat + +[Manufacturer] +%CompanyName% = SoftEther, NTamd64 + +[SourceDisksNames] +1=%DiskDescription%, "", , + +[SourceDisksFiles] +Neo6_x64_VPN68.sys = 1 + +[DestinationDirs] +DefaultDestDir = 12 +Neo.CopyFiles.Sys = 12 + +[Neo.CopyFiles.Sys] +Neo6_x64_VPN68.sys, , , 2 + +[SoftEther.NTamd64] +%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN68 + +[NeoAdapter.Install] +Characteristics = 0x1 +AddReg = Neo.Reg, NeoAdapter.Ndi +CopyFiles = Neo.CopyFiles.Sys +*IfType = 53 +*MediaType = 0 +*PhysicalMediaType = 0 + +[NeoAdapter.Install.Services] +AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% + +[NeoAdapter.Ndi] +HKR, , NetworkAddress, 0, %DefaultAddress% +HKR, Ndi, DeviceID, , "NeoAdapter_VPN68" +HKR, , DevLoader, , ndis +HKR, , DeviceVxDs, , Neo6_x64_VPN68.sys +HKR, NDIS, LogDriverName, , "Neo_VPN68" +HKR, NDIS, MajorNdisVersion, 1, 5 +HKR, NDIS, MinorNdisVersion, 1, 0 +HKR, Ndi\Interfaces, DefUpper, , "ndis5" +HKR, Ndi\Interfaces, UpperRange, , "ndis5" +HKR, Ndi\Interfaces, LowerRange, , "ethernet" +HKR, Ndi\Interfaces, DefLower, , "ethernet" +HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" +HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% +HKR, Ndi\Params\NetworkAddress, type, 0, "edit" +HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" +HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" +HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% +HKR, Ndi\Params\NetworkAddress, optional, 0, "0" +HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% +HKR, Ndi\Params\MaxSpeed, type, 0, "int" +HKR, Ndi\Params\MaxSpeed, default, 0, "100" +HKR, Ndi\Params\MaxSpeed, min, 0, "0" +HKR, Ndi\Params\MaxSpeed, max, 0, "2000" +HKR, Ndi\Params\MaxSpeed, step, 0, "1" +HKR, Ndi\Params\MaxSpeed, Base, 0, "10" +HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% +HKR, Ndi\Params\KeepLink, type, 0, "enum" +HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% +HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% +HKR, Ndi\Params\KeepLink, default, 0, "0" + + +[Neo.Service] +DisplayName = %Neo.Service.DispName% +Description = %Neo.Service.Desc% +ServiceType = 1 +StartType = 3 +ErrorControl = 1 +ServiceBinary = %12%\Neo6_x64_VPN68.sys +LoadOrderGroup = NDIS + +[Neo.Reg] +HKR, Ndi, Service, 0, Neo.Service.Name +HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" +HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" + +[Neo.EventLog] +HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo6_x64_VPN68.sys" +HKR, , TypesSupported, 0x00010001, 7 + +[Strings] +CompanyName = "SoftEther Corporation" +DiskDescription = "VPN Client Device Driver Install Disk" +Neo.Service.Name = "Neo_VPN68" +Neo.Service.DispName = "VPN Client Device Driver - VPN68" +Neo.Service.Desc = "VPN Client Adapter - VPN68" +NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN68" +Neo.EventLog.Name = "Neo" +NetworkAddress = "MAC Address" +DefaultAddress = "000001000001" +MaxSpeed = "Indicate Speed (Mbps)" +KeepLink = "Keep Link" +On = "On" +Off = "Off" + + +; Auto Generated 20180205_163626.161 + diff --git a/src/bin/hamcore/DriverPackages/Neo6_Win10/x64/Neo6_x64_VPN69.inf b/src/bin/hamcore/DriverPackages/Neo6_Win10/x64/Neo6_x64_VPN69.inf index 438e56f0..5f0b9363 100644 --- a/src/bin/hamcore/DriverPackages/Neo6_Win10/x64/Neo6_x64_VPN69.inf +++ b/src/bin/hamcore/DriverPackages/Neo6_Win10/x64/Neo6_x64_VPN69.inf @@ -1,114 +1,114 @@ -; VPN Client Device Driver for Windows 2000 and Greater -; -; Copyright (c) SoftEther Corporation. All Rights Reserved. -; http://www.softether.co.jp/ -; -; BUILD 9658 - -[Version] -Signature = "$Windows NT$" -Class = Net -ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} -Provider = %CompanyName% -DriverVer = 02/04/2018, 4.25.0.9658 -CatalogFile.NT = Neo6_x64_VPN69.cat - -[Manufacturer] -%CompanyName% = SoftEther, NTamd64 - -[SourceDisksNames] -1=%DiskDescription%, "", , - -[SourceDisksFiles] -Neo6_x64_VPN69.sys = 1 - -[DestinationDirs] -DefaultDestDir = 12 -Neo.CopyFiles.Sys = 12 - -[Neo.CopyFiles.Sys] -Neo6_x64_VPN69.sys, , , 2 - -[SoftEther.NTamd64] -%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN69 - -[NeoAdapter.Install] -Characteristics = 0x1 -AddReg = Neo.Reg, NeoAdapter.Ndi -CopyFiles = Neo.CopyFiles.Sys -*IfType = 53 -*MediaType = 0 -*PhysicalMediaType = 0 - -[NeoAdapter.Install.Services] -AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% - -[NeoAdapter.Ndi] -HKR, , NetworkAddress, 0, %DefaultAddress% -HKR, Ndi, DeviceID, , "NeoAdapter_VPN69" -HKR, , DevLoader, , ndis -HKR, , DeviceVxDs, , Neo6_x64_VPN69.sys -HKR, NDIS, LogDriverName, , "Neo_VPN69" -HKR, NDIS, MajorNdisVersion, 1, 5 -HKR, NDIS, MinorNdisVersion, 1, 0 -HKR, Ndi\Interfaces, DefUpper, , "ndis5" -HKR, Ndi\Interfaces, UpperRange, , "ndis5" -HKR, Ndi\Interfaces, LowerRange, , "ethernet" -HKR, Ndi\Interfaces, DefLower, , "ethernet" -HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" -HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% -HKR, Ndi\Params\NetworkAddress, type, 0, "edit" -HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" -HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" -HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% -HKR, Ndi\Params\NetworkAddress, optional, 0, "0" -HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% -HKR, Ndi\Params\MaxSpeed, type, 0, "int" -HKR, Ndi\Params\MaxSpeed, default, 0, "100" -HKR, Ndi\Params\MaxSpeed, min, 0, "0" -HKR, Ndi\Params\MaxSpeed, max, 0, "2000" -HKR, Ndi\Params\MaxSpeed, step, 0, "1" -HKR, Ndi\Params\MaxSpeed, Base, 0, "10" -HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% -HKR, Ndi\Params\KeepLink, type, 0, "enum" -HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% -HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% -HKR, Ndi\Params\KeepLink, default, 0, "0" - - -[Neo.Service] -DisplayName = %Neo.Service.DispName% -Description = %Neo.Service.Desc% -ServiceType = 1 -StartType = 3 -ErrorControl = 1 -ServiceBinary = %12%\Neo6_x64_VPN69.sys -LoadOrderGroup = NDIS - -[Neo.Reg] -HKR, Ndi, Service, 0, Neo.Service.Name -HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" -HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" - -[Neo.EventLog] -HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo6_x64_VPN69.sys" -HKR, , TypesSupported, 0x00010001, 7 - -[Strings] -CompanyName = "SoftEther Corporation" -DiskDescription = "VPN Client Device Driver Install Disk" -Neo.Service.Name = "Neo_VPN69" -Neo.Service.DispName = "VPN Client Device Driver - VPN69" -Neo.Service.Desc = "VPN Client Adapter - VPN69" -NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN69" -Neo.EventLog.Name = "Neo" -NetworkAddress = "MAC Address" -DefaultAddress = "000001000001" -MaxSpeed = "Indicate Speed (Mbps)" -KeepLink = "Keep Link" -On = "On" -Off = "Off" - - -; Auto Generated 20180205_163626.233 - +; VPN Client Device Driver for Windows 2000 and Greater +; +; Copyright (c) SoftEther Corporation. All Rights Reserved. +; http://www.softether.co.jp/ +; +; BUILD 9658 + +[Version] +Signature = "$Windows NT$" +Class = Net +ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} +Provider = %CompanyName% +DriverVer = 02/04/2018, 4.25.0.9658 +CatalogFile.NT = Neo6_x64_VPN69.cat + +[Manufacturer] +%CompanyName% = SoftEther, NTamd64 + +[SourceDisksNames] +1=%DiskDescription%, "", , + +[SourceDisksFiles] +Neo6_x64_VPN69.sys = 1 + +[DestinationDirs] +DefaultDestDir = 12 +Neo.CopyFiles.Sys = 12 + +[Neo.CopyFiles.Sys] +Neo6_x64_VPN69.sys, , , 2 + +[SoftEther.NTamd64] +%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN69 + +[NeoAdapter.Install] +Characteristics = 0x1 +AddReg = Neo.Reg, NeoAdapter.Ndi +CopyFiles = Neo.CopyFiles.Sys +*IfType = 53 +*MediaType = 0 +*PhysicalMediaType = 0 + +[NeoAdapter.Install.Services] +AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% + +[NeoAdapter.Ndi] +HKR, , NetworkAddress, 0, %DefaultAddress% +HKR, Ndi, DeviceID, , "NeoAdapter_VPN69" +HKR, , DevLoader, , ndis +HKR, , DeviceVxDs, , Neo6_x64_VPN69.sys +HKR, NDIS, LogDriverName, , "Neo_VPN69" +HKR, NDIS, MajorNdisVersion, 1, 5 +HKR, NDIS, MinorNdisVersion, 1, 0 +HKR, Ndi\Interfaces, DefUpper, , "ndis5" +HKR, Ndi\Interfaces, UpperRange, , "ndis5" +HKR, Ndi\Interfaces, LowerRange, , "ethernet" +HKR, Ndi\Interfaces, DefLower, , "ethernet" +HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" +HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% +HKR, Ndi\Params\NetworkAddress, type, 0, "edit" +HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" +HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" +HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% +HKR, Ndi\Params\NetworkAddress, optional, 0, "0" +HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% +HKR, Ndi\Params\MaxSpeed, type, 0, "int" +HKR, Ndi\Params\MaxSpeed, default, 0, "100" +HKR, Ndi\Params\MaxSpeed, min, 0, "0" +HKR, Ndi\Params\MaxSpeed, max, 0, "2000" +HKR, Ndi\Params\MaxSpeed, step, 0, "1" +HKR, Ndi\Params\MaxSpeed, Base, 0, "10" +HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% +HKR, Ndi\Params\KeepLink, type, 0, "enum" +HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% +HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% +HKR, Ndi\Params\KeepLink, default, 0, "0" + + +[Neo.Service] +DisplayName = %Neo.Service.DispName% +Description = %Neo.Service.Desc% +ServiceType = 1 +StartType = 3 +ErrorControl = 1 +ServiceBinary = %12%\Neo6_x64_VPN69.sys +LoadOrderGroup = NDIS + +[Neo.Reg] +HKR, Ndi, Service, 0, Neo.Service.Name +HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" +HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" + +[Neo.EventLog] +HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo6_x64_VPN69.sys" +HKR, , TypesSupported, 0x00010001, 7 + +[Strings] +CompanyName = "SoftEther Corporation" +DiskDescription = "VPN Client Device Driver Install Disk" +Neo.Service.Name = "Neo_VPN69" +Neo.Service.DispName = "VPN Client Device Driver - VPN69" +Neo.Service.Desc = "VPN Client Adapter - VPN69" +NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN69" +Neo.EventLog.Name = "Neo" +NetworkAddress = "MAC Address" +DefaultAddress = "000001000001" +MaxSpeed = "Indicate Speed (Mbps)" +KeepLink = "Keep Link" +On = "On" +Off = "Off" + + +; Auto Generated 20180205_163626.233 + diff --git a/src/bin/hamcore/DriverPackages/Neo6_Win10/x64/Neo6_x64_VPN7.inf b/src/bin/hamcore/DriverPackages/Neo6_Win10/x64/Neo6_x64_VPN7.inf index 8d1730a8..e96e65f5 100644 --- a/src/bin/hamcore/DriverPackages/Neo6_Win10/x64/Neo6_x64_VPN7.inf +++ b/src/bin/hamcore/DriverPackages/Neo6_Win10/x64/Neo6_x64_VPN7.inf @@ -1,114 +1,114 @@ -; VPN Client Device Driver for Windows 2000 and Greater -; -; Copyright (c) SoftEther Corporation. All Rights Reserved. -; http://www.softether.co.jp/ -; -; BUILD 9658 - -[Version] -Signature = "$Windows NT$" -Class = Net -ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} -Provider = %CompanyName% -DriverVer = 02/04/2018, 4.25.0.9658 -CatalogFile.NT = Neo6_x64_VPN7.cat - -[Manufacturer] -%CompanyName% = SoftEther, NTamd64 - -[SourceDisksNames] -1=%DiskDescription%, "", , - -[SourceDisksFiles] -Neo6_x64_VPN7.sys = 1 - -[DestinationDirs] -DefaultDestDir = 12 -Neo.CopyFiles.Sys = 12 - -[Neo.CopyFiles.Sys] -Neo6_x64_VPN7.sys, , , 2 - -[SoftEther.NTamd64] -%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN7 - -[NeoAdapter.Install] -Characteristics = 0x1 -AddReg = Neo.Reg, NeoAdapter.Ndi -CopyFiles = Neo.CopyFiles.Sys -*IfType = 53 -*MediaType = 0 -*PhysicalMediaType = 0 - -[NeoAdapter.Install.Services] -AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% - -[NeoAdapter.Ndi] -HKR, , NetworkAddress, 0, %DefaultAddress% -HKR, Ndi, DeviceID, , "NeoAdapter_VPN7" -HKR, , DevLoader, , ndis -HKR, , DeviceVxDs, , Neo6_x64_VPN7.sys -HKR, NDIS, LogDriverName, , "Neo_VPN7" -HKR, NDIS, MajorNdisVersion, 1, 5 -HKR, NDIS, MinorNdisVersion, 1, 0 -HKR, Ndi\Interfaces, DefUpper, , "ndis5" -HKR, Ndi\Interfaces, UpperRange, , "ndis5" -HKR, Ndi\Interfaces, LowerRange, , "ethernet" -HKR, Ndi\Interfaces, DefLower, , "ethernet" -HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" -HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% -HKR, Ndi\Params\NetworkAddress, type, 0, "edit" -HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" -HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" -HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% -HKR, Ndi\Params\NetworkAddress, optional, 0, "0" -HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% -HKR, Ndi\Params\MaxSpeed, type, 0, "int" -HKR, Ndi\Params\MaxSpeed, default, 0, "100" -HKR, Ndi\Params\MaxSpeed, min, 0, "0" -HKR, Ndi\Params\MaxSpeed, max, 0, "2000" -HKR, Ndi\Params\MaxSpeed, step, 0, "1" -HKR, Ndi\Params\MaxSpeed, Base, 0, "10" -HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% -HKR, Ndi\Params\KeepLink, type, 0, "enum" -HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% -HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% -HKR, Ndi\Params\KeepLink, default, 0, "0" - - -[Neo.Service] -DisplayName = %Neo.Service.DispName% -Description = %Neo.Service.Desc% -ServiceType = 1 -StartType = 3 -ErrorControl = 1 -ServiceBinary = %12%\Neo6_x64_VPN7.sys -LoadOrderGroup = NDIS - -[Neo.Reg] -HKR, Ndi, Service, 0, Neo.Service.Name -HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" -HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" - -[Neo.EventLog] -HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo6_x64_VPN7.sys" -HKR, , TypesSupported, 0x00010001, 7 - -[Strings] -CompanyName = "SoftEther Corporation" -DiskDescription = "VPN Client Device Driver Install Disk" -Neo.Service.Name = "Neo_VPN7" -Neo.Service.DispName = "VPN Client Device Driver - VPN7" -Neo.Service.Desc = "VPN Client Adapter - VPN7" -NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN7" -Neo.EventLog.Name = "Neo" -NetworkAddress = "MAC Address" -DefaultAddress = "000001000001" -MaxSpeed = "Indicate Speed (Mbps)" -KeepLink = "Keep Link" -On = "On" -Off = "Off" - - -; Auto Generated 20180205_163621.810 - +; VPN Client Device Driver for Windows 2000 and Greater +; +; Copyright (c) SoftEther Corporation. All Rights Reserved. +; http://www.softether.co.jp/ +; +; BUILD 9658 + +[Version] +Signature = "$Windows NT$" +Class = Net +ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} +Provider = %CompanyName% +DriverVer = 02/04/2018, 4.25.0.9658 +CatalogFile.NT = Neo6_x64_VPN7.cat + +[Manufacturer] +%CompanyName% = SoftEther, NTamd64 + +[SourceDisksNames] +1=%DiskDescription%, "", , + +[SourceDisksFiles] +Neo6_x64_VPN7.sys = 1 + +[DestinationDirs] +DefaultDestDir = 12 +Neo.CopyFiles.Sys = 12 + +[Neo.CopyFiles.Sys] +Neo6_x64_VPN7.sys, , , 2 + +[SoftEther.NTamd64] +%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN7 + +[NeoAdapter.Install] +Characteristics = 0x1 +AddReg = Neo.Reg, NeoAdapter.Ndi +CopyFiles = Neo.CopyFiles.Sys +*IfType = 53 +*MediaType = 0 +*PhysicalMediaType = 0 + +[NeoAdapter.Install.Services] +AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% + +[NeoAdapter.Ndi] +HKR, , NetworkAddress, 0, %DefaultAddress% +HKR, Ndi, DeviceID, , "NeoAdapter_VPN7" +HKR, , DevLoader, , ndis +HKR, , DeviceVxDs, , Neo6_x64_VPN7.sys +HKR, NDIS, LogDriverName, , "Neo_VPN7" +HKR, NDIS, MajorNdisVersion, 1, 5 +HKR, NDIS, MinorNdisVersion, 1, 0 +HKR, Ndi\Interfaces, DefUpper, , "ndis5" +HKR, Ndi\Interfaces, UpperRange, , "ndis5" +HKR, Ndi\Interfaces, LowerRange, , "ethernet" +HKR, Ndi\Interfaces, DefLower, , "ethernet" +HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" +HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% +HKR, Ndi\Params\NetworkAddress, type, 0, "edit" +HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" +HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" +HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% +HKR, Ndi\Params\NetworkAddress, optional, 0, "0" +HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% +HKR, Ndi\Params\MaxSpeed, type, 0, "int" +HKR, Ndi\Params\MaxSpeed, default, 0, "100" +HKR, Ndi\Params\MaxSpeed, min, 0, "0" +HKR, Ndi\Params\MaxSpeed, max, 0, "2000" +HKR, Ndi\Params\MaxSpeed, step, 0, "1" +HKR, Ndi\Params\MaxSpeed, Base, 0, "10" +HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% +HKR, Ndi\Params\KeepLink, type, 0, "enum" +HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% +HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% +HKR, Ndi\Params\KeepLink, default, 0, "0" + + +[Neo.Service] +DisplayName = %Neo.Service.DispName% +Description = %Neo.Service.Desc% +ServiceType = 1 +StartType = 3 +ErrorControl = 1 +ServiceBinary = %12%\Neo6_x64_VPN7.sys +LoadOrderGroup = NDIS + +[Neo.Reg] +HKR, Ndi, Service, 0, Neo.Service.Name +HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" +HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" + +[Neo.EventLog] +HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo6_x64_VPN7.sys" +HKR, , TypesSupported, 0x00010001, 7 + +[Strings] +CompanyName = "SoftEther Corporation" +DiskDescription = "VPN Client Device Driver Install Disk" +Neo.Service.Name = "Neo_VPN7" +Neo.Service.DispName = "VPN Client Device Driver - VPN7" +Neo.Service.Desc = "VPN Client Adapter - VPN7" +NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN7" +Neo.EventLog.Name = "Neo" +NetworkAddress = "MAC Address" +DefaultAddress = "000001000001" +MaxSpeed = "Indicate Speed (Mbps)" +KeepLink = "Keep Link" +On = "On" +Off = "Off" + + +; Auto Generated 20180205_163621.810 + diff --git a/src/bin/hamcore/DriverPackages/Neo6_Win10/x64/Neo6_x64_VPN70.inf b/src/bin/hamcore/DriverPackages/Neo6_Win10/x64/Neo6_x64_VPN70.inf index f080fc0d..2a5fa0f8 100644 --- a/src/bin/hamcore/DriverPackages/Neo6_Win10/x64/Neo6_x64_VPN70.inf +++ b/src/bin/hamcore/DriverPackages/Neo6_Win10/x64/Neo6_x64_VPN70.inf @@ -1,114 +1,114 @@ -; VPN Client Device Driver for Windows 2000 and Greater -; -; Copyright (c) SoftEther Corporation. All Rights Reserved. -; http://www.softether.co.jp/ -; -; BUILD 9658 - -[Version] -Signature = "$Windows NT$" -Class = Net -ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} -Provider = %CompanyName% -DriverVer = 02/04/2018, 4.25.0.9658 -CatalogFile.NT = Neo6_x64_VPN70.cat - -[Manufacturer] -%CompanyName% = SoftEther, NTamd64 - -[SourceDisksNames] -1=%DiskDescription%, "", , - -[SourceDisksFiles] -Neo6_x64_VPN70.sys = 1 - -[DestinationDirs] -DefaultDestDir = 12 -Neo.CopyFiles.Sys = 12 - -[Neo.CopyFiles.Sys] -Neo6_x64_VPN70.sys, , , 2 - -[SoftEther.NTamd64] -%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN70 - -[NeoAdapter.Install] -Characteristics = 0x1 -AddReg = Neo.Reg, NeoAdapter.Ndi -CopyFiles = Neo.CopyFiles.Sys -*IfType = 53 -*MediaType = 0 -*PhysicalMediaType = 0 - -[NeoAdapter.Install.Services] -AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% - -[NeoAdapter.Ndi] -HKR, , NetworkAddress, 0, %DefaultAddress% -HKR, Ndi, DeviceID, , "NeoAdapter_VPN70" -HKR, , DevLoader, , ndis -HKR, , DeviceVxDs, , Neo6_x64_VPN70.sys -HKR, NDIS, LogDriverName, , "Neo_VPN70" -HKR, NDIS, MajorNdisVersion, 1, 5 -HKR, NDIS, MinorNdisVersion, 1, 0 -HKR, Ndi\Interfaces, DefUpper, , "ndis5" -HKR, Ndi\Interfaces, UpperRange, , "ndis5" -HKR, Ndi\Interfaces, LowerRange, , "ethernet" -HKR, Ndi\Interfaces, DefLower, , "ethernet" -HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" -HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% -HKR, Ndi\Params\NetworkAddress, type, 0, "edit" -HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" -HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" -HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% -HKR, Ndi\Params\NetworkAddress, optional, 0, "0" -HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% -HKR, Ndi\Params\MaxSpeed, type, 0, "int" -HKR, Ndi\Params\MaxSpeed, default, 0, "100" -HKR, Ndi\Params\MaxSpeed, min, 0, "0" -HKR, Ndi\Params\MaxSpeed, max, 0, "2000" -HKR, Ndi\Params\MaxSpeed, step, 0, "1" -HKR, Ndi\Params\MaxSpeed, Base, 0, "10" -HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% -HKR, Ndi\Params\KeepLink, type, 0, "enum" -HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% -HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% -HKR, Ndi\Params\KeepLink, default, 0, "0" - - -[Neo.Service] -DisplayName = %Neo.Service.DispName% -Description = %Neo.Service.Desc% -ServiceType = 1 -StartType = 3 -ErrorControl = 1 -ServiceBinary = %12%\Neo6_x64_VPN70.sys -LoadOrderGroup = NDIS - -[Neo.Reg] -HKR, Ndi, Service, 0, Neo.Service.Name -HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" -HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" - -[Neo.EventLog] -HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo6_x64_VPN70.sys" -HKR, , TypesSupported, 0x00010001, 7 - -[Strings] -CompanyName = "SoftEther Corporation" -DiskDescription = "VPN Client Device Driver Install Disk" -Neo.Service.Name = "Neo_VPN70" -Neo.Service.DispName = "VPN Client Device Driver - VPN70" -Neo.Service.Desc = "VPN Client Adapter - VPN70" -NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN70" -Neo.EventLog.Name = "Neo" -NetworkAddress = "MAC Address" -DefaultAddress = "000001000001" -MaxSpeed = "Indicate Speed (Mbps)" -KeepLink = "Keep Link" -On = "On" -Off = "Off" - - -; Auto Generated 20180205_163626.305 - +; VPN Client Device Driver for Windows 2000 and Greater +; +; Copyright (c) SoftEther Corporation. All Rights Reserved. +; http://www.softether.co.jp/ +; +; BUILD 9658 + +[Version] +Signature = "$Windows NT$" +Class = Net +ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} +Provider = %CompanyName% +DriverVer = 02/04/2018, 4.25.0.9658 +CatalogFile.NT = Neo6_x64_VPN70.cat + +[Manufacturer] +%CompanyName% = SoftEther, NTamd64 + +[SourceDisksNames] +1=%DiskDescription%, "", , + +[SourceDisksFiles] +Neo6_x64_VPN70.sys = 1 + +[DestinationDirs] +DefaultDestDir = 12 +Neo.CopyFiles.Sys = 12 + +[Neo.CopyFiles.Sys] +Neo6_x64_VPN70.sys, , , 2 + +[SoftEther.NTamd64] +%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN70 + +[NeoAdapter.Install] +Characteristics = 0x1 +AddReg = Neo.Reg, NeoAdapter.Ndi +CopyFiles = Neo.CopyFiles.Sys +*IfType = 53 +*MediaType = 0 +*PhysicalMediaType = 0 + +[NeoAdapter.Install.Services] +AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% + +[NeoAdapter.Ndi] +HKR, , NetworkAddress, 0, %DefaultAddress% +HKR, Ndi, DeviceID, , "NeoAdapter_VPN70" +HKR, , DevLoader, , ndis +HKR, , DeviceVxDs, , Neo6_x64_VPN70.sys +HKR, NDIS, LogDriverName, , "Neo_VPN70" +HKR, NDIS, MajorNdisVersion, 1, 5 +HKR, NDIS, MinorNdisVersion, 1, 0 +HKR, Ndi\Interfaces, DefUpper, , "ndis5" +HKR, Ndi\Interfaces, UpperRange, , "ndis5" +HKR, Ndi\Interfaces, LowerRange, , "ethernet" +HKR, Ndi\Interfaces, DefLower, , "ethernet" +HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" +HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% +HKR, Ndi\Params\NetworkAddress, type, 0, "edit" +HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" +HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" +HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% +HKR, Ndi\Params\NetworkAddress, optional, 0, "0" +HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% +HKR, Ndi\Params\MaxSpeed, type, 0, "int" +HKR, Ndi\Params\MaxSpeed, default, 0, "100" +HKR, Ndi\Params\MaxSpeed, min, 0, "0" +HKR, Ndi\Params\MaxSpeed, max, 0, "2000" +HKR, Ndi\Params\MaxSpeed, step, 0, "1" +HKR, Ndi\Params\MaxSpeed, Base, 0, "10" +HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% +HKR, Ndi\Params\KeepLink, type, 0, "enum" +HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% +HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% +HKR, Ndi\Params\KeepLink, default, 0, "0" + + +[Neo.Service] +DisplayName = %Neo.Service.DispName% +Description = %Neo.Service.Desc% +ServiceType = 1 +StartType = 3 +ErrorControl = 1 +ServiceBinary = %12%\Neo6_x64_VPN70.sys +LoadOrderGroup = NDIS + +[Neo.Reg] +HKR, Ndi, Service, 0, Neo.Service.Name +HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" +HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" + +[Neo.EventLog] +HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo6_x64_VPN70.sys" +HKR, , TypesSupported, 0x00010001, 7 + +[Strings] +CompanyName = "SoftEther Corporation" +DiskDescription = "VPN Client Device Driver Install Disk" +Neo.Service.Name = "Neo_VPN70" +Neo.Service.DispName = "VPN Client Device Driver - VPN70" +Neo.Service.Desc = "VPN Client Adapter - VPN70" +NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN70" +Neo.EventLog.Name = "Neo" +NetworkAddress = "MAC Address" +DefaultAddress = "000001000001" +MaxSpeed = "Indicate Speed (Mbps)" +KeepLink = "Keep Link" +On = "On" +Off = "Off" + + +; Auto Generated 20180205_163626.305 + diff --git a/src/bin/hamcore/DriverPackages/Neo6_Win10/x64/Neo6_x64_VPN71.inf b/src/bin/hamcore/DriverPackages/Neo6_Win10/x64/Neo6_x64_VPN71.inf index 6a3a199f..b8976f3d 100644 --- a/src/bin/hamcore/DriverPackages/Neo6_Win10/x64/Neo6_x64_VPN71.inf +++ b/src/bin/hamcore/DriverPackages/Neo6_Win10/x64/Neo6_x64_VPN71.inf @@ -1,114 +1,114 @@ -; VPN Client Device Driver for Windows 2000 and Greater -; -; Copyright (c) SoftEther Corporation. All Rights Reserved. -; http://www.softether.co.jp/ -; -; BUILD 9658 - -[Version] -Signature = "$Windows NT$" -Class = Net -ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} -Provider = %CompanyName% -DriverVer = 02/04/2018, 4.25.0.9658 -CatalogFile.NT = Neo6_x64_VPN71.cat - -[Manufacturer] -%CompanyName% = SoftEther, NTamd64 - -[SourceDisksNames] -1=%DiskDescription%, "", , - -[SourceDisksFiles] -Neo6_x64_VPN71.sys = 1 - -[DestinationDirs] -DefaultDestDir = 12 -Neo.CopyFiles.Sys = 12 - -[Neo.CopyFiles.Sys] -Neo6_x64_VPN71.sys, , , 2 - -[SoftEther.NTamd64] -%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN71 - -[NeoAdapter.Install] -Characteristics = 0x1 -AddReg = Neo.Reg, NeoAdapter.Ndi -CopyFiles = Neo.CopyFiles.Sys -*IfType = 53 -*MediaType = 0 -*PhysicalMediaType = 0 - -[NeoAdapter.Install.Services] -AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% - -[NeoAdapter.Ndi] -HKR, , NetworkAddress, 0, %DefaultAddress% -HKR, Ndi, DeviceID, , "NeoAdapter_VPN71" -HKR, , DevLoader, , ndis -HKR, , DeviceVxDs, , Neo6_x64_VPN71.sys -HKR, NDIS, LogDriverName, , "Neo_VPN71" -HKR, NDIS, MajorNdisVersion, 1, 5 -HKR, NDIS, MinorNdisVersion, 1, 0 -HKR, Ndi\Interfaces, DefUpper, , "ndis5" -HKR, Ndi\Interfaces, UpperRange, , "ndis5" -HKR, Ndi\Interfaces, LowerRange, , "ethernet" -HKR, Ndi\Interfaces, DefLower, , "ethernet" -HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" -HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% -HKR, Ndi\Params\NetworkAddress, type, 0, "edit" -HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" -HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" -HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% -HKR, Ndi\Params\NetworkAddress, optional, 0, "0" -HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% -HKR, Ndi\Params\MaxSpeed, type, 0, "int" -HKR, Ndi\Params\MaxSpeed, default, 0, "100" -HKR, Ndi\Params\MaxSpeed, min, 0, "0" -HKR, Ndi\Params\MaxSpeed, max, 0, "2000" -HKR, Ndi\Params\MaxSpeed, step, 0, "1" -HKR, Ndi\Params\MaxSpeed, Base, 0, "10" -HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% -HKR, Ndi\Params\KeepLink, type, 0, "enum" -HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% -HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% -HKR, Ndi\Params\KeepLink, default, 0, "0" - - -[Neo.Service] -DisplayName = %Neo.Service.DispName% -Description = %Neo.Service.Desc% -ServiceType = 1 -StartType = 3 -ErrorControl = 1 -ServiceBinary = %12%\Neo6_x64_VPN71.sys -LoadOrderGroup = NDIS - -[Neo.Reg] -HKR, Ndi, Service, 0, Neo.Service.Name -HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" -HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" - -[Neo.EventLog] -HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo6_x64_VPN71.sys" -HKR, , TypesSupported, 0x00010001, 7 - -[Strings] -CompanyName = "SoftEther Corporation" -DiskDescription = "VPN Client Device Driver Install Disk" -Neo.Service.Name = "Neo_VPN71" -Neo.Service.DispName = "VPN Client Device Driver - VPN71" -Neo.Service.Desc = "VPN Client Adapter - VPN71" -NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN71" -Neo.EventLog.Name = "Neo" -NetworkAddress = "MAC Address" -DefaultAddress = "000001000001" -MaxSpeed = "Indicate Speed (Mbps)" -KeepLink = "Keep Link" -On = "On" -Off = "Off" - - -; Auto Generated 20180205_163626.375 - +; VPN Client Device Driver for Windows 2000 and Greater +; +; Copyright (c) SoftEther Corporation. All Rights Reserved. +; http://www.softether.co.jp/ +; +; BUILD 9658 + +[Version] +Signature = "$Windows NT$" +Class = Net +ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} +Provider = %CompanyName% +DriverVer = 02/04/2018, 4.25.0.9658 +CatalogFile.NT = Neo6_x64_VPN71.cat + +[Manufacturer] +%CompanyName% = SoftEther, NTamd64 + +[SourceDisksNames] +1=%DiskDescription%, "", , + +[SourceDisksFiles] +Neo6_x64_VPN71.sys = 1 + +[DestinationDirs] +DefaultDestDir = 12 +Neo.CopyFiles.Sys = 12 + +[Neo.CopyFiles.Sys] +Neo6_x64_VPN71.sys, , , 2 + +[SoftEther.NTamd64] +%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN71 + +[NeoAdapter.Install] +Characteristics = 0x1 +AddReg = Neo.Reg, NeoAdapter.Ndi +CopyFiles = Neo.CopyFiles.Sys +*IfType = 53 +*MediaType = 0 +*PhysicalMediaType = 0 + +[NeoAdapter.Install.Services] +AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% + +[NeoAdapter.Ndi] +HKR, , NetworkAddress, 0, %DefaultAddress% +HKR, Ndi, DeviceID, , "NeoAdapter_VPN71" +HKR, , DevLoader, , ndis +HKR, , DeviceVxDs, , Neo6_x64_VPN71.sys +HKR, NDIS, LogDriverName, , "Neo_VPN71" +HKR, NDIS, MajorNdisVersion, 1, 5 +HKR, NDIS, MinorNdisVersion, 1, 0 +HKR, Ndi\Interfaces, DefUpper, , "ndis5" +HKR, Ndi\Interfaces, UpperRange, , "ndis5" +HKR, Ndi\Interfaces, LowerRange, , "ethernet" +HKR, Ndi\Interfaces, DefLower, , "ethernet" +HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" +HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% +HKR, Ndi\Params\NetworkAddress, type, 0, "edit" +HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" +HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" +HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% +HKR, Ndi\Params\NetworkAddress, optional, 0, "0" +HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% +HKR, Ndi\Params\MaxSpeed, type, 0, "int" +HKR, Ndi\Params\MaxSpeed, default, 0, "100" +HKR, Ndi\Params\MaxSpeed, min, 0, "0" +HKR, Ndi\Params\MaxSpeed, max, 0, "2000" +HKR, Ndi\Params\MaxSpeed, step, 0, "1" +HKR, Ndi\Params\MaxSpeed, Base, 0, "10" +HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% +HKR, Ndi\Params\KeepLink, type, 0, "enum" +HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% +HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% +HKR, Ndi\Params\KeepLink, default, 0, "0" + + +[Neo.Service] +DisplayName = %Neo.Service.DispName% +Description = %Neo.Service.Desc% +ServiceType = 1 +StartType = 3 +ErrorControl = 1 +ServiceBinary = %12%\Neo6_x64_VPN71.sys +LoadOrderGroup = NDIS + +[Neo.Reg] +HKR, Ndi, Service, 0, Neo.Service.Name +HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" +HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" + +[Neo.EventLog] +HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo6_x64_VPN71.sys" +HKR, , TypesSupported, 0x00010001, 7 + +[Strings] +CompanyName = "SoftEther Corporation" +DiskDescription = "VPN Client Device Driver Install Disk" +Neo.Service.Name = "Neo_VPN71" +Neo.Service.DispName = "VPN Client Device Driver - VPN71" +Neo.Service.Desc = "VPN Client Adapter - VPN71" +NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN71" +Neo.EventLog.Name = "Neo" +NetworkAddress = "MAC Address" +DefaultAddress = "000001000001" +MaxSpeed = "Indicate Speed (Mbps)" +KeepLink = "Keep Link" +On = "On" +Off = "Off" + + +; Auto Generated 20180205_163626.375 + diff --git a/src/bin/hamcore/DriverPackages/Neo6_Win10/x64/Neo6_x64_VPN72.inf b/src/bin/hamcore/DriverPackages/Neo6_Win10/x64/Neo6_x64_VPN72.inf index 532c0cb2..7d42a64d 100644 --- a/src/bin/hamcore/DriverPackages/Neo6_Win10/x64/Neo6_x64_VPN72.inf +++ b/src/bin/hamcore/DriverPackages/Neo6_Win10/x64/Neo6_x64_VPN72.inf @@ -1,114 +1,114 @@ -; VPN Client Device Driver for Windows 2000 and Greater -; -; Copyright (c) SoftEther Corporation. All Rights Reserved. -; http://www.softether.co.jp/ -; -; BUILD 9658 - -[Version] -Signature = "$Windows NT$" -Class = Net -ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} -Provider = %CompanyName% -DriverVer = 02/04/2018, 4.25.0.9658 -CatalogFile.NT = Neo6_x64_VPN72.cat - -[Manufacturer] -%CompanyName% = SoftEther, NTamd64 - -[SourceDisksNames] -1=%DiskDescription%, "", , - -[SourceDisksFiles] -Neo6_x64_VPN72.sys = 1 - -[DestinationDirs] -DefaultDestDir = 12 -Neo.CopyFiles.Sys = 12 - -[Neo.CopyFiles.Sys] -Neo6_x64_VPN72.sys, , , 2 - -[SoftEther.NTamd64] -%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN72 - -[NeoAdapter.Install] -Characteristics = 0x1 -AddReg = Neo.Reg, NeoAdapter.Ndi -CopyFiles = Neo.CopyFiles.Sys -*IfType = 53 -*MediaType = 0 -*PhysicalMediaType = 0 - -[NeoAdapter.Install.Services] -AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% - -[NeoAdapter.Ndi] -HKR, , NetworkAddress, 0, %DefaultAddress% -HKR, Ndi, DeviceID, , "NeoAdapter_VPN72" -HKR, , DevLoader, , ndis -HKR, , DeviceVxDs, , Neo6_x64_VPN72.sys -HKR, NDIS, LogDriverName, , "Neo_VPN72" -HKR, NDIS, MajorNdisVersion, 1, 5 -HKR, NDIS, MinorNdisVersion, 1, 0 -HKR, Ndi\Interfaces, DefUpper, , "ndis5" -HKR, Ndi\Interfaces, UpperRange, , "ndis5" -HKR, Ndi\Interfaces, LowerRange, , "ethernet" -HKR, Ndi\Interfaces, DefLower, , "ethernet" -HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" -HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% -HKR, Ndi\Params\NetworkAddress, type, 0, "edit" -HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" -HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" -HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% -HKR, Ndi\Params\NetworkAddress, optional, 0, "0" -HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% -HKR, Ndi\Params\MaxSpeed, type, 0, "int" -HKR, Ndi\Params\MaxSpeed, default, 0, "100" -HKR, Ndi\Params\MaxSpeed, min, 0, "0" -HKR, Ndi\Params\MaxSpeed, max, 0, "2000" -HKR, Ndi\Params\MaxSpeed, step, 0, "1" -HKR, Ndi\Params\MaxSpeed, Base, 0, "10" -HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% -HKR, Ndi\Params\KeepLink, type, 0, "enum" -HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% -HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% -HKR, Ndi\Params\KeepLink, default, 0, "0" - - -[Neo.Service] -DisplayName = %Neo.Service.DispName% -Description = %Neo.Service.Desc% -ServiceType = 1 -StartType = 3 -ErrorControl = 1 -ServiceBinary = %12%\Neo6_x64_VPN72.sys -LoadOrderGroup = NDIS - -[Neo.Reg] -HKR, Ndi, Service, 0, Neo.Service.Name -HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" -HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" - -[Neo.EventLog] -HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo6_x64_VPN72.sys" -HKR, , TypesSupported, 0x00010001, 7 - -[Strings] -CompanyName = "SoftEther Corporation" -DiskDescription = "VPN Client Device Driver Install Disk" -Neo.Service.Name = "Neo_VPN72" -Neo.Service.DispName = "VPN Client Device Driver - VPN72" -Neo.Service.Desc = "VPN Client Adapter - VPN72" -NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN72" -Neo.EventLog.Name = "Neo" -NetworkAddress = "MAC Address" -DefaultAddress = "000001000001" -MaxSpeed = "Indicate Speed (Mbps)" -KeepLink = "Keep Link" -On = "On" -Off = "Off" - - -; Auto Generated 20180205_163626.445 - +; VPN Client Device Driver for Windows 2000 and Greater +; +; Copyright (c) SoftEther Corporation. All Rights Reserved. +; http://www.softether.co.jp/ +; +; BUILD 9658 + +[Version] +Signature = "$Windows NT$" +Class = Net +ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} +Provider = %CompanyName% +DriverVer = 02/04/2018, 4.25.0.9658 +CatalogFile.NT = Neo6_x64_VPN72.cat + +[Manufacturer] +%CompanyName% = SoftEther, NTamd64 + +[SourceDisksNames] +1=%DiskDescription%, "", , + +[SourceDisksFiles] +Neo6_x64_VPN72.sys = 1 + +[DestinationDirs] +DefaultDestDir = 12 +Neo.CopyFiles.Sys = 12 + +[Neo.CopyFiles.Sys] +Neo6_x64_VPN72.sys, , , 2 + +[SoftEther.NTamd64] +%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN72 + +[NeoAdapter.Install] +Characteristics = 0x1 +AddReg = Neo.Reg, NeoAdapter.Ndi +CopyFiles = Neo.CopyFiles.Sys +*IfType = 53 +*MediaType = 0 +*PhysicalMediaType = 0 + +[NeoAdapter.Install.Services] +AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% + +[NeoAdapter.Ndi] +HKR, , NetworkAddress, 0, %DefaultAddress% +HKR, Ndi, DeviceID, , "NeoAdapter_VPN72" +HKR, , DevLoader, , ndis +HKR, , DeviceVxDs, , Neo6_x64_VPN72.sys +HKR, NDIS, LogDriverName, , "Neo_VPN72" +HKR, NDIS, MajorNdisVersion, 1, 5 +HKR, NDIS, MinorNdisVersion, 1, 0 +HKR, Ndi\Interfaces, DefUpper, , "ndis5" +HKR, Ndi\Interfaces, UpperRange, , "ndis5" +HKR, Ndi\Interfaces, LowerRange, , "ethernet" +HKR, Ndi\Interfaces, DefLower, , "ethernet" +HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" +HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% +HKR, Ndi\Params\NetworkAddress, type, 0, "edit" +HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" +HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" +HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% +HKR, Ndi\Params\NetworkAddress, optional, 0, "0" +HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% +HKR, Ndi\Params\MaxSpeed, type, 0, "int" +HKR, Ndi\Params\MaxSpeed, default, 0, "100" +HKR, Ndi\Params\MaxSpeed, min, 0, "0" +HKR, Ndi\Params\MaxSpeed, max, 0, "2000" +HKR, Ndi\Params\MaxSpeed, step, 0, "1" +HKR, Ndi\Params\MaxSpeed, Base, 0, "10" +HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% +HKR, Ndi\Params\KeepLink, type, 0, "enum" +HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% +HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% +HKR, Ndi\Params\KeepLink, default, 0, "0" + + +[Neo.Service] +DisplayName = %Neo.Service.DispName% +Description = %Neo.Service.Desc% +ServiceType = 1 +StartType = 3 +ErrorControl = 1 +ServiceBinary = %12%\Neo6_x64_VPN72.sys +LoadOrderGroup = NDIS + +[Neo.Reg] +HKR, Ndi, Service, 0, Neo.Service.Name +HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" +HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" + +[Neo.EventLog] +HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo6_x64_VPN72.sys" +HKR, , TypesSupported, 0x00010001, 7 + +[Strings] +CompanyName = "SoftEther Corporation" +DiskDescription = "VPN Client Device Driver Install Disk" +Neo.Service.Name = "Neo_VPN72" +Neo.Service.DispName = "VPN Client Device Driver - VPN72" +Neo.Service.Desc = "VPN Client Adapter - VPN72" +NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN72" +Neo.EventLog.Name = "Neo" +NetworkAddress = "MAC Address" +DefaultAddress = "000001000001" +MaxSpeed = "Indicate Speed (Mbps)" +KeepLink = "Keep Link" +On = "On" +Off = "Off" + + +; Auto Generated 20180205_163626.445 + diff --git a/src/bin/hamcore/DriverPackages/Neo6_Win10/x64/Neo6_x64_VPN73.inf b/src/bin/hamcore/DriverPackages/Neo6_Win10/x64/Neo6_x64_VPN73.inf index e41398b9..46cf4a8e 100644 --- a/src/bin/hamcore/DriverPackages/Neo6_Win10/x64/Neo6_x64_VPN73.inf +++ b/src/bin/hamcore/DriverPackages/Neo6_Win10/x64/Neo6_x64_VPN73.inf @@ -1,114 +1,114 @@ -; VPN Client Device Driver for Windows 2000 and Greater -; -; Copyright (c) SoftEther Corporation. All Rights Reserved. -; http://www.softether.co.jp/ -; -; BUILD 9658 - -[Version] -Signature = "$Windows NT$" -Class = Net -ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} -Provider = %CompanyName% -DriverVer = 02/04/2018, 4.25.0.9658 -CatalogFile.NT = Neo6_x64_VPN73.cat - -[Manufacturer] -%CompanyName% = SoftEther, NTamd64 - -[SourceDisksNames] -1=%DiskDescription%, "", , - -[SourceDisksFiles] -Neo6_x64_VPN73.sys = 1 - -[DestinationDirs] -DefaultDestDir = 12 -Neo.CopyFiles.Sys = 12 - -[Neo.CopyFiles.Sys] -Neo6_x64_VPN73.sys, , , 2 - -[SoftEther.NTamd64] -%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN73 - -[NeoAdapter.Install] -Characteristics = 0x1 -AddReg = Neo.Reg, NeoAdapter.Ndi -CopyFiles = Neo.CopyFiles.Sys -*IfType = 53 -*MediaType = 0 -*PhysicalMediaType = 0 - -[NeoAdapter.Install.Services] -AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% - -[NeoAdapter.Ndi] -HKR, , NetworkAddress, 0, %DefaultAddress% -HKR, Ndi, DeviceID, , "NeoAdapter_VPN73" -HKR, , DevLoader, , ndis -HKR, , DeviceVxDs, , Neo6_x64_VPN73.sys -HKR, NDIS, LogDriverName, , "Neo_VPN73" -HKR, NDIS, MajorNdisVersion, 1, 5 -HKR, NDIS, MinorNdisVersion, 1, 0 -HKR, Ndi\Interfaces, DefUpper, , "ndis5" -HKR, Ndi\Interfaces, UpperRange, , "ndis5" -HKR, Ndi\Interfaces, LowerRange, , "ethernet" -HKR, Ndi\Interfaces, DefLower, , "ethernet" -HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" -HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% -HKR, Ndi\Params\NetworkAddress, type, 0, "edit" -HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" -HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" -HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% -HKR, Ndi\Params\NetworkAddress, optional, 0, "0" -HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% -HKR, Ndi\Params\MaxSpeed, type, 0, "int" -HKR, Ndi\Params\MaxSpeed, default, 0, "100" -HKR, Ndi\Params\MaxSpeed, min, 0, "0" -HKR, Ndi\Params\MaxSpeed, max, 0, "2000" -HKR, Ndi\Params\MaxSpeed, step, 0, "1" -HKR, Ndi\Params\MaxSpeed, Base, 0, "10" -HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% -HKR, Ndi\Params\KeepLink, type, 0, "enum" -HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% -HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% -HKR, Ndi\Params\KeepLink, default, 0, "0" - - -[Neo.Service] -DisplayName = %Neo.Service.DispName% -Description = %Neo.Service.Desc% -ServiceType = 1 -StartType = 3 -ErrorControl = 1 -ServiceBinary = %12%\Neo6_x64_VPN73.sys -LoadOrderGroup = NDIS - -[Neo.Reg] -HKR, Ndi, Service, 0, Neo.Service.Name -HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" -HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" - -[Neo.EventLog] -HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo6_x64_VPN73.sys" -HKR, , TypesSupported, 0x00010001, 7 - -[Strings] -CompanyName = "SoftEther Corporation" -DiskDescription = "VPN Client Device Driver Install Disk" -Neo.Service.Name = "Neo_VPN73" -Neo.Service.DispName = "VPN Client Device Driver - VPN73" -Neo.Service.Desc = "VPN Client Adapter - VPN73" -NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN73" -Neo.EventLog.Name = "Neo" -NetworkAddress = "MAC Address" -DefaultAddress = "000001000001" -MaxSpeed = "Indicate Speed (Mbps)" -KeepLink = "Keep Link" -On = "On" -Off = "Off" - - -; Auto Generated 20180205_163626.516 - +; VPN Client Device Driver for Windows 2000 and Greater +; +; Copyright (c) SoftEther Corporation. All Rights Reserved. +; http://www.softether.co.jp/ +; +; BUILD 9658 + +[Version] +Signature = "$Windows NT$" +Class = Net +ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} +Provider = %CompanyName% +DriverVer = 02/04/2018, 4.25.0.9658 +CatalogFile.NT = Neo6_x64_VPN73.cat + +[Manufacturer] +%CompanyName% = SoftEther, NTamd64 + +[SourceDisksNames] +1=%DiskDescription%, "", , + +[SourceDisksFiles] +Neo6_x64_VPN73.sys = 1 + +[DestinationDirs] +DefaultDestDir = 12 +Neo.CopyFiles.Sys = 12 + +[Neo.CopyFiles.Sys] +Neo6_x64_VPN73.sys, , , 2 + +[SoftEther.NTamd64] +%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN73 + +[NeoAdapter.Install] +Characteristics = 0x1 +AddReg = Neo.Reg, NeoAdapter.Ndi +CopyFiles = Neo.CopyFiles.Sys +*IfType = 53 +*MediaType = 0 +*PhysicalMediaType = 0 + +[NeoAdapter.Install.Services] +AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% + +[NeoAdapter.Ndi] +HKR, , NetworkAddress, 0, %DefaultAddress% +HKR, Ndi, DeviceID, , "NeoAdapter_VPN73" +HKR, , DevLoader, , ndis +HKR, , DeviceVxDs, , Neo6_x64_VPN73.sys +HKR, NDIS, LogDriverName, , "Neo_VPN73" +HKR, NDIS, MajorNdisVersion, 1, 5 +HKR, NDIS, MinorNdisVersion, 1, 0 +HKR, Ndi\Interfaces, DefUpper, , "ndis5" +HKR, Ndi\Interfaces, UpperRange, , "ndis5" +HKR, Ndi\Interfaces, LowerRange, , "ethernet" +HKR, Ndi\Interfaces, DefLower, , "ethernet" +HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" +HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% +HKR, Ndi\Params\NetworkAddress, type, 0, "edit" +HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" +HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" +HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% +HKR, Ndi\Params\NetworkAddress, optional, 0, "0" +HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% +HKR, Ndi\Params\MaxSpeed, type, 0, "int" +HKR, Ndi\Params\MaxSpeed, default, 0, "100" +HKR, Ndi\Params\MaxSpeed, min, 0, "0" +HKR, Ndi\Params\MaxSpeed, max, 0, "2000" +HKR, Ndi\Params\MaxSpeed, step, 0, "1" +HKR, Ndi\Params\MaxSpeed, Base, 0, "10" +HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% +HKR, Ndi\Params\KeepLink, type, 0, "enum" +HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% +HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% +HKR, Ndi\Params\KeepLink, default, 0, "0" + + +[Neo.Service] +DisplayName = %Neo.Service.DispName% +Description = %Neo.Service.Desc% +ServiceType = 1 +StartType = 3 +ErrorControl = 1 +ServiceBinary = %12%\Neo6_x64_VPN73.sys +LoadOrderGroup = NDIS + +[Neo.Reg] +HKR, Ndi, Service, 0, Neo.Service.Name +HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" +HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" + +[Neo.EventLog] +HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo6_x64_VPN73.sys" +HKR, , TypesSupported, 0x00010001, 7 + +[Strings] +CompanyName = "SoftEther Corporation" +DiskDescription = "VPN Client Device Driver Install Disk" +Neo.Service.Name = "Neo_VPN73" +Neo.Service.DispName = "VPN Client Device Driver - VPN73" +Neo.Service.Desc = "VPN Client Adapter - VPN73" +NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN73" +Neo.EventLog.Name = "Neo" +NetworkAddress = "MAC Address" +DefaultAddress = "000001000001" +MaxSpeed = "Indicate Speed (Mbps)" +KeepLink = "Keep Link" +On = "On" +Off = "Off" + + +; Auto Generated 20180205_163626.516 + diff --git a/src/bin/hamcore/DriverPackages/Neo6_Win10/x64/Neo6_x64_VPN74.inf b/src/bin/hamcore/DriverPackages/Neo6_Win10/x64/Neo6_x64_VPN74.inf index ba35a888..9b92f82a 100644 --- a/src/bin/hamcore/DriverPackages/Neo6_Win10/x64/Neo6_x64_VPN74.inf +++ b/src/bin/hamcore/DriverPackages/Neo6_Win10/x64/Neo6_x64_VPN74.inf @@ -1,114 +1,114 @@ -; VPN Client Device Driver for Windows 2000 and Greater -; -; Copyright (c) SoftEther Corporation. All Rights Reserved. -; http://www.softether.co.jp/ -; -; BUILD 9658 - -[Version] -Signature = "$Windows NT$" -Class = Net -ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} -Provider = %CompanyName% -DriverVer = 02/04/2018, 4.25.0.9658 -CatalogFile.NT = Neo6_x64_VPN74.cat - -[Manufacturer] -%CompanyName% = SoftEther, NTamd64 - -[SourceDisksNames] -1=%DiskDescription%, "", , - -[SourceDisksFiles] -Neo6_x64_VPN74.sys = 1 - -[DestinationDirs] -DefaultDestDir = 12 -Neo.CopyFiles.Sys = 12 - -[Neo.CopyFiles.Sys] -Neo6_x64_VPN74.sys, , , 2 - -[SoftEther.NTamd64] -%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN74 - -[NeoAdapter.Install] -Characteristics = 0x1 -AddReg = Neo.Reg, NeoAdapter.Ndi -CopyFiles = Neo.CopyFiles.Sys -*IfType = 53 -*MediaType = 0 -*PhysicalMediaType = 0 - -[NeoAdapter.Install.Services] -AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% - -[NeoAdapter.Ndi] -HKR, , NetworkAddress, 0, %DefaultAddress% -HKR, Ndi, DeviceID, , "NeoAdapter_VPN74" -HKR, , DevLoader, , ndis -HKR, , DeviceVxDs, , Neo6_x64_VPN74.sys -HKR, NDIS, LogDriverName, , "Neo_VPN74" -HKR, NDIS, MajorNdisVersion, 1, 5 -HKR, NDIS, MinorNdisVersion, 1, 0 -HKR, Ndi\Interfaces, DefUpper, , "ndis5" -HKR, Ndi\Interfaces, UpperRange, , "ndis5" -HKR, Ndi\Interfaces, LowerRange, , "ethernet" -HKR, Ndi\Interfaces, DefLower, , "ethernet" -HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" -HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% -HKR, Ndi\Params\NetworkAddress, type, 0, "edit" -HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" -HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" -HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% -HKR, Ndi\Params\NetworkAddress, optional, 0, "0" -HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% -HKR, Ndi\Params\MaxSpeed, type, 0, "int" -HKR, Ndi\Params\MaxSpeed, default, 0, "100" -HKR, Ndi\Params\MaxSpeed, min, 0, "0" -HKR, Ndi\Params\MaxSpeed, max, 0, "2000" -HKR, Ndi\Params\MaxSpeed, step, 0, "1" -HKR, Ndi\Params\MaxSpeed, Base, 0, "10" -HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% -HKR, Ndi\Params\KeepLink, type, 0, "enum" -HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% -HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% -HKR, Ndi\Params\KeepLink, default, 0, "0" - - -[Neo.Service] -DisplayName = %Neo.Service.DispName% -Description = %Neo.Service.Desc% -ServiceType = 1 -StartType = 3 -ErrorControl = 1 -ServiceBinary = %12%\Neo6_x64_VPN74.sys -LoadOrderGroup = NDIS - -[Neo.Reg] -HKR, Ndi, Service, 0, Neo.Service.Name -HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" -HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" - -[Neo.EventLog] -HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo6_x64_VPN74.sys" -HKR, , TypesSupported, 0x00010001, 7 - -[Strings] -CompanyName = "SoftEther Corporation" -DiskDescription = "VPN Client Device Driver Install Disk" -Neo.Service.Name = "Neo_VPN74" -Neo.Service.DispName = "VPN Client Device Driver - VPN74" -Neo.Service.Desc = "VPN Client Adapter - VPN74" -NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN74" -Neo.EventLog.Name = "Neo" -NetworkAddress = "MAC Address" -DefaultAddress = "000001000001" -MaxSpeed = "Indicate Speed (Mbps)" -KeepLink = "Keep Link" -On = "On" -Off = "Off" - - -; Auto Generated 20180205_163626.585 - +; VPN Client Device Driver for Windows 2000 and Greater +; +; Copyright (c) SoftEther Corporation. All Rights Reserved. +; http://www.softether.co.jp/ +; +; BUILD 9658 + +[Version] +Signature = "$Windows NT$" +Class = Net +ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} +Provider = %CompanyName% +DriverVer = 02/04/2018, 4.25.0.9658 +CatalogFile.NT = Neo6_x64_VPN74.cat + +[Manufacturer] +%CompanyName% = SoftEther, NTamd64 + +[SourceDisksNames] +1=%DiskDescription%, "", , + +[SourceDisksFiles] +Neo6_x64_VPN74.sys = 1 + +[DestinationDirs] +DefaultDestDir = 12 +Neo.CopyFiles.Sys = 12 + +[Neo.CopyFiles.Sys] +Neo6_x64_VPN74.sys, , , 2 + +[SoftEther.NTamd64] +%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN74 + +[NeoAdapter.Install] +Characteristics = 0x1 +AddReg = Neo.Reg, NeoAdapter.Ndi +CopyFiles = Neo.CopyFiles.Sys +*IfType = 53 +*MediaType = 0 +*PhysicalMediaType = 0 + +[NeoAdapter.Install.Services] +AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% + +[NeoAdapter.Ndi] +HKR, , NetworkAddress, 0, %DefaultAddress% +HKR, Ndi, DeviceID, , "NeoAdapter_VPN74" +HKR, , DevLoader, , ndis +HKR, , DeviceVxDs, , Neo6_x64_VPN74.sys +HKR, NDIS, LogDriverName, , "Neo_VPN74" +HKR, NDIS, MajorNdisVersion, 1, 5 +HKR, NDIS, MinorNdisVersion, 1, 0 +HKR, Ndi\Interfaces, DefUpper, , "ndis5" +HKR, Ndi\Interfaces, UpperRange, , "ndis5" +HKR, Ndi\Interfaces, LowerRange, , "ethernet" +HKR, Ndi\Interfaces, DefLower, , "ethernet" +HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" +HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% +HKR, Ndi\Params\NetworkAddress, type, 0, "edit" +HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" +HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" +HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% +HKR, Ndi\Params\NetworkAddress, optional, 0, "0" +HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% +HKR, Ndi\Params\MaxSpeed, type, 0, "int" +HKR, Ndi\Params\MaxSpeed, default, 0, "100" +HKR, Ndi\Params\MaxSpeed, min, 0, "0" +HKR, Ndi\Params\MaxSpeed, max, 0, "2000" +HKR, Ndi\Params\MaxSpeed, step, 0, "1" +HKR, Ndi\Params\MaxSpeed, Base, 0, "10" +HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% +HKR, Ndi\Params\KeepLink, type, 0, "enum" +HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% +HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% +HKR, Ndi\Params\KeepLink, default, 0, "0" + + +[Neo.Service] +DisplayName = %Neo.Service.DispName% +Description = %Neo.Service.Desc% +ServiceType = 1 +StartType = 3 +ErrorControl = 1 +ServiceBinary = %12%\Neo6_x64_VPN74.sys +LoadOrderGroup = NDIS + +[Neo.Reg] +HKR, Ndi, Service, 0, Neo.Service.Name +HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" +HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" + +[Neo.EventLog] +HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo6_x64_VPN74.sys" +HKR, , TypesSupported, 0x00010001, 7 + +[Strings] +CompanyName = "SoftEther Corporation" +DiskDescription = "VPN Client Device Driver Install Disk" +Neo.Service.Name = "Neo_VPN74" +Neo.Service.DispName = "VPN Client Device Driver - VPN74" +Neo.Service.Desc = "VPN Client Adapter - VPN74" +NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN74" +Neo.EventLog.Name = "Neo" +NetworkAddress = "MAC Address" +DefaultAddress = "000001000001" +MaxSpeed = "Indicate Speed (Mbps)" +KeepLink = "Keep Link" +On = "On" +Off = "Off" + + +; Auto Generated 20180205_163626.585 + diff --git a/src/bin/hamcore/DriverPackages/Neo6_Win10/x64/Neo6_x64_VPN75.inf b/src/bin/hamcore/DriverPackages/Neo6_Win10/x64/Neo6_x64_VPN75.inf index c97f02c0..cfd856c9 100644 --- a/src/bin/hamcore/DriverPackages/Neo6_Win10/x64/Neo6_x64_VPN75.inf +++ b/src/bin/hamcore/DriverPackages/Neo6_Win10/x64/Neo6_x64_VPN75.inf @@ -1,114 +1,114 @@ -; VPN Client Device Driver for Windows 2000 and Greater -; -; Copyright (c) SoftEther Corporation. All Rights Reserved. -; http://www.softether.co.jp/ -; -; BUILD 9658 - -[Version] -Signature = "$Windows NT$" -Class = Net -ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} -Provider = %CompanyName% -DriverVer = 02/04/2018, 4.25.0.9658 -CatalogFile.NT = Neo6_x64_VPN75.cat - -[Manufacturer] -%CompanyName% = SoftEther, NTamd64 - -[SourceDisksNames] -1=%DiskDescription%, "", , - -[SourceDisksFiles] -Neo6_x64_VPN75.sys = 1 - -[DestinationDirs] -DefaultDestDir = 12 -Neo.CopyFiles.Sys = 12 - -[Neo.CopyFiles.Sys] -Neo6_x64_VPN75.sys, , , 2 - -[SoftEther.NTamd64] -%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN75 - -[NeoAdapter.Install] -Characteristics = 0x1 -AddReg = Neo.Reg, NeoAdapter.Ndi -CopyFiles = Neo.CopyFiles.Sys -*IfType = 53 -*MediaType = 0 -*PhysicalMediaType = 0 - -[NeoAdapter.Install.Services] -AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% - -[NeoAdapter.Ndi] -HKR, , NetworkAddress, 0, %DefaultAddress% -HKR, Ndi, DeviceID, , "NeoAdapter_VPN75" -HKR, , DevLoader, , ndis -HKR, , DeviceVxDs, , Neo6_x64_VPN75.sys -HKR, NDIS, LogDriverName, , "Neo_VPN75" -HKR, NDIS, MajorNdisVersion, 1, 5 -HKR, NDIS, MinorNdisVersion, 1, 0 -HKR, Ndi\Interfaces, DefUpper, , "ndis5" -HKR, Ndi\Interfaces, UpperRange, , "ndis5" -HKR, Ndi\Interfaces, LowerRange, , "ethernet" -HKR, Ndi\Interfaces, DefLower, , "ethernet" -HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" -HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% -HKR, Ndi\Params\NetworkAddress, type, 0, "edit" -HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" -HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" -HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% -HKR, Ndi\Params\NetworkAddress, optional, 0, "0" -HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% -HKR, Ndi\Params\MaxSpeed, type, 0, "int" -HKR, Ndi\Params\MaxSpeed, default, 0, "100" -HKR, Ndi\Params\MaxSpeed, min, 0, "0" -HKR, Ndi\Params\MaxSpeed, max, 0, "2000" -HKR, Ndi\Params\MaxSpeed, step, 0, "1" -HKR, Ndi\Params\MaxSpeed, Base, 0, "10" -HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% -HKR, Ndi\Params\KeepLink, type, 0, "enum" -HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% -HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% -HKR, Ndi\Params\KeepLink, default, 0, "0" - - -[Neo.Service] -DisplayName = %Neo.Service.DispName% -Description = %Neo.Service.Desc% -ServiceType = 1 -StartType = 3 -ErrorControl = 1 -ServiceBinary = %12%\Neo6_x64_VPN75.sys -LoadOrderGroup = NDIS - -[Neo.Reg] -HKR, Ndi, Service, 0, Neo.Service.Name -HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" -HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" - -[Neo.EventLog] -HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo6_x64_VPN75.sys" -HKR, , TypesSupported, 0x00010001, 7 - -[Strings] -CompanyName = "SoftEther Corporation" -DiskDescription = "VPN Client Device Driver Install Disk" -Neo.Service.Name = "Neo_VPN75" -Neo.Service.DispName = "VPN Client Device Driver - VPN75" -Neo.Service.Desc = "VPN Client Adapter - VPN75" -NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN75" -Neo.EventLog.Name = "Neo" -NetworkAddress = "MAC Address" -DefaultAddress = "000001000001" -MaxSpeed = "Indicate Speed (Mbps)" -KeepLink = "Keep Link" -On = "On" -Off = "Off" - - -; Auto Generated 20180205_163626.654 - +; VPN Client Device Driver for Windows 2000 and Greater +; +; Copyright (c) SoftEther Corporation. All Rights Reserved. +; http://www.softether.co.jp/ +; +; BUILD 9658 + +[Version] +Signature = "$Windows NT$" +Class = Net +ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} +Provider = %CompanyName% +DriverVer = 02/04/2018, 4.25.0.9658 +CatalogFile.NT = Neo6_x64_VPN75.cat + +[Manufacturer] +%CompanyName% = SoftEther, NTamd64 + +[SourceDisksNames] +1=%DiskDescription%, "", , + +[SourceDisksFiles] +Neo6_x64_VPN75.sys = 1 + +[DestinationDirs] +DefaultDestDir = 12 +Neo.CopyFiles.Sys = 12 + +[Neo.CopyFiles.Sys] +Neo6_x64_VPN75.sys, , , 2 + +[SoftEther.NTamd64] +%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN75 + +[NeoAdapter.Install] +Characteristics = 0x1 +AddReg = Neo.Reg, NeoAdapter.Ndi +CopyFiles = Neo.CopyFiles.Sys +*IfType = 53 +*MediaType = 0 +*PhysicalMediaType = 0 + +[NeoAdapter.Install.Services] +AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% + +[NeoAdapter.Ndi] +HKR, , NetworkAddress, 0, %DefaultAddress% +HKR, Ndi, DeviceID, , "NeoAdapter_VPN75" +HKR, , DevLoader, , ndis +HKR, , DeviceVxDs, , Neo6_x64_VPN75.sys +HKR, NDIS, LogDriverName, , "Neo_VPN75" +HKR, NDIS, MajorNdisVersion, 1, 5 +HKR, NDIS, MinorNdisVersion, 1, 0 +HKR, Ndi\Interfaces, DefUpper, , "ndis5" +HKR, Ndi\Interfaces, UpperRange, , "ndis5" +HKR, Ndi\Interfaces, LowerRange, , "ethernet" +HKR, Ndi\Interfaces, DefLower, , "ethernet" +HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" +HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% +HKR, Ndi\Params\NetworkAddress, type, 0, "edit" +HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" +HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" +HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% +HKR, Ndi\Params\NetworkAddress, optional, 0, "0" +HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% +HKR, Ndi\Params\MaxSpeed, type, 0, "int" +HKR, Ndi\Params\MaxSpeed, default, 0, "100" +HKR, Ndi\Params\MaxSpeed, min, 0, "0" +HKR, Ndi\Params\MaxSpeed, max, 0, "2000" +HKR, Ndi\Params\MaxSpeed, step, 0, "1" +HKR, Ndi\Params\MaxSpeed, Base, 0, "10" +HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% +HKR, Ndi\Params\KeepLink, type, 0, "enum" +HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% +HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% +HKR, Ndi\Params\KeepLink, default, 0, "0" + + +[Neo.Service] +DisplayName = %Neo.Service.DispName% +Description = %Neo.Service.Desc% +ServiceType = 1 +StartType = 3 +ErrorControl = 1 +ServiceBinary = %12%\Neo6_x64_VPN75.sys +LoadOrderGroup = NDIS + +[Neo.Reg] +HKR, Ndi, Service, 0, Neo.Service.Name +HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" +HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" + +[Neo.EventLog] +HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo6_x64_VPN75.sys" +HKR, , TypesSupported, 0x00010001, 7 + +[Strings] +CompanyName = "SoftEther Corporation" +DiskDescription = "VPN Client Device Driver Install Disk" +Neo.Service.Name = "Neo_VPN75" +Neo.Service.DispName = "VPN Client Device Driver - VPN75" +Neo.Service.Desc = "VPN Client Adapter - VPN75" +NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN75" +Neo.EventLog.Name = "Neo" +NetworkAddress = "MAC Address" +DefaultAddress = "000001000001" +MaxSpeed = "Indicate Speed (Mbps)" +KeepLink = "Keep Link" +On = "On" +Off = "Off" + + +; Auto Generated 20180205_163626.654 + diff --git a/src/bin/hamcore/DriverPackages/Neo6_Win10/x64/Neo6_x64_VPN76.inf b/src/bin/hamcore/DriverPackages/Neo6_Win10/x64/Neo6_x64_VPN76.inf index e1708c74..83478922 100644 --- a/src/bin/hamcore/DriverPackages/Neo6_Win10/x64/Neo6_x64_VPN76.inf +++ b/src/bin/hamcore/DriverPackages/Neo6_Win10/x64/Neo6_x64_VPN76.inf @@ -1,114 +1,114 @@ -; VPN Client Device Driver for Windows 2000 and Greater -; -; Copyright (c) SoftEther Corporation. All Rights Reserved. -; http://www.softether.co.jp/ -; -; BUILD 9658 - -[Version] -Signature = "$Windows NT$" -Class = Net -ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} -Provider = %CompanyName% -DriverVer = 02/04/2018, 4.25.0.9658 -CatalogFile.NT = Neo6_x64_VPN76.cat - -[Manufacturer] -%CompanyName% = SoftEther, NTamd64 - -[SourceDisksNames] -1=%DiskDescription%, "", , - -[SourceDisksFiles] -Neo6_x64_VPN76.sys = 1 - -[DestinationDirs] -DefaultDestDir = 12 -Neo.CopyFiles.Sys = 12 - -[Neo.CopyFiles.Sys] -Neo6_x64_VPN76.sys, , , 2 - -[SoftEther.NTamd64] -%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN76 - -[NeoAdapter.Install] -Characteristics = 0x1 -AddReg = Neo.Reg, NeoAdapter.Ndi -CopyFiles = Neo.CopyFiles.Sys -*IfType = 53 -*MediaType = 0 -*PhysicalMediaType = 0 - -[NeoAdapter.Install.Services] -AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% - -[NeoAdapter.Ndi] -HKR, , NetworkAddress, 0, %DefaultAddress% -HKR, Ndi, DeviceID, , "NeoAdapter_VPN76" -HKR, , DevLoader, , ndis -HKR, , DeviceVxDs, , Neo6_x64_VPN76.sys -HKR, NDIS, LogDriverName, , "Neo_VPN76" -HKR, NDIS, MajorNdisVersion, 1, 5 -HKR, NDIS, MinorNdisVersion, 1, 0 -HKR, Ndi\Interfaces, DefUpper, , "ndis5" -HKR, Ndi\Interfaces, UpperRange, , "ndis5" -HKR, Ndi\Interfaces, LowerRange, , "ethernet" -HKR, Ndi\Interfaces, DefLower, , "ethernet" -HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" -HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% -HKR, Ndi\Params\NetworkAddress, type, 0, "edit" -HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" -HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" -HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% -HKR, Ndi\Params\NetworkAddress, optional, 0, "0" -HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% -HKR, Ndi\Params\MaxSpeed, type, 0, "int" -HKR, Ndi\Params\MaxSpeed, default, 0, "100" -HKR, Ndi\Params\MaxSpeed, min, 0, "0" -HKR, Ndi\Params\MaxSpeed, max, 0, "2000" -HKR, Ndi\Params\MaxSpeed, step, 0, "1" -HKR, Ndi\Params\MaxSpeed, Base, 0, "10" -HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% -HKR, Ndi\Params\KeepLink, type, 0, "enum" -HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% -HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% -HKR, Ndi\Params\KeepLink, default, 0, "0" - - -[Neo.Service] -DisplayName = %Neo.Service.DispName% -Description = %Neo.Service.Desc% -ServiceType = 1 -StartType = 3 -ErrorControl = 1 -ServiceBinary = %12%\Neo6_x64_VPN76.sys -LoadOrderGroup = NDIS - -[Neo.Reg] -HKR, Ndi, Service, 0, Neo.Service.Name -HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" -HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" - -[Neo.EventLog] -HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo6_x64_VPN76.sys" -HKR, , TypesSupported, 0x00010001, 7 - -[Strings] -CompanyName = "SoftEther Corporation" -DiskDescription = "VPN Client Device Driver Install Disk" -Neo.Service.Name = "Neo_VPN76" -Neo.Service.DispName = "VPN Client Device Driver - VPN76" -Neo.Service.Desc = "VPN Client Adapter - VPN76" -NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN76" -Neo.EventLog.Name = "Neo" -NetworkAddress = "MAC Address" -DefaultAddress = "000001000001" -MaxSpeed = "Indicate Speed (Mbps)" -KeepLink = "Keep Link" -On = "On" -Off = "Off" - - -; Auto Generated 20180205_163626.725 - +; VPN Client Device Driver for Windows 2000 and Greater +; +; Copyright (c) SoftEther Corporation. All Rights Reserved. +; http://www.softether.co.jp/ +; +; BUILD 9658 + +[Version] +Signature = "$Windows NT$" +Class = Net +ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} +Provider = %CompanyName% +DriverVer = 02/04/2018, 4.25.0.9658 +CatalogFile.NT = Neo6_x64_VPN76.cat + +[Manufacturer] +%CompanyName% = SoftEther, NTamd64 + +[SourceDisksNames] +1=%DiskDescription%, "", , + +[SourceDisksFiles] +Neo6_x64_VPN76.sys = 1 + +[DestinationDirs] +DefaultDestDir = 12 +Neo.CopyFiles.Sys = 12 + +[Neo.CopyFiles.Sys] +Neo6_x64_VPN76.sys, , , 2 + +[SoftEther.NTamd64] +%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN76 + +[NeoAdapter.Install] +Characteristics = 0x1 +AddReg = Neo.Reg, NeoAdapter.Ndi +CopyFiles = Neo.CopyFiles.Sys +*IfType = 53 +*MediaType = 0 +*PhysicalMediaType = 0 + +[NeoAdapter.Install.Services] +AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% + +[NeoAdapter.Ndi] +HKR, , NetworkAddress, 0, %DefaultAddress% +HKR, Ndi, DeviceID, , "NeoAdapter_VPN76" +HKR, , DevLoader, , ndis +HKR, , DeviceVxDs, , Neo6_x64_VPN76.sys +HKR, NDIS, LogDriverName, , "Neo_VPN76" +HKR, NDIS, MajorNdisVersion, 1, 5 +HKR, NDIS, MinorNdisVersion, 1, 0 +HKR, Ndi\Interfaces, DefUpper, , "ndis5" +HKR, Ndi\Interfaces, UpperRange, , "ndis5" +HKR, Ndi\Interfaces, LowerRange, , "ethernet" +HKR, Ndi\Interfaces, DefLower, , "ethernet" +HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" +HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% +HKR, Ndi\Params\NetworkAddress, type, 0, "edit" +HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" +HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" +HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% +HKR, Ndi\Params\NetworkAddress, optional, 0, "0" +HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% +HKR, Ndi\Params\MaxSpeed, type, 0, "int" +HKR, Ndi\Params\MaxSpeed, default, 0, "100" +HKR, Ndi\Params\MaxSpeed, min, 0, "0" +HKR, Ndi\Params\MaxSpeed, max, 0, "2000" +HKR, Ndi\Params\MaxSpeed, step, 0, "1" +HKR, Ndi\Params\MaxSpeed, Base, 0, "10" +HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% +HKR, Ndi\Params\KeepLink, type, 0, "enum" +HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% +HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% +HKR, Ndi\Params\KeepLink, default, 0, "0" + + +[Neo.Service] +DisplayName = %Neo.Service.DispName% +Description = %Neo.Service.Desc% +ServiceType = 1 +StartType = 3 +ErrorControl = 1 +ServiceBinary = %12%\Neo6_x64_VPN76.sys +LoadOrderGroup = NDIS + +[Neo.Reg] +HKR, Ndi, Service, 0, Neo.Service.Name +HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" +HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" + +[Neo.EventLog] +HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo6_x64_VPN76.sys" +HKR, , TypesSupported, 0x00010001, 7 + +[Strings] +CompanyName = "SoftEther Corporation" +DiskDescription = "VPN Client Device Driver Install Disk" +Neo.Service.Name = "Neo_VPN76" +Neo.Service.DispName = "VPN Client Device Driver - VPN76" +Neo.Service.Desc = "VPN Client Adapter - VPN76" +NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN76" +Neo.EventLog.Name = "Neo" +NetworkAddress = "MAC Address" +DefaultAddress = "000001000001" +MaxSpeed = "Indicate Speed (Mbps)" +KeepLink = "Keep Link" +On = "On" +Off = "Off" + + +; Auto Generated 20180205_163626.725 + diff --git a/src/bin/hamcore/DriverPackages/Neo6_Win10/x64/Neo6_x64_VPN77.inf b/src/bin/hamcore/DriverPackages/Neo6_Win10/x64/Neo6_x64_VPN77.inf index a1cb56eb..e0af7946 100644 --- a/src/bin/hamcore/DriverPackages/Neo6_Win10/x64/Neo6_x64_VPN77.inf +++ b/src/bin/hamcore/DriverPackages/Neo6_Win10/x64/Neo6_x64_VPN77.inf @@ -1,114 +1,114 @@ -; VPN Client Device Driver for Windows 2000 and Greater -; -; Copyright (c) SoftEther Corporation. All Rights Reserved. -; http://www.softether.co.jp/ -; -; BUILD 9658 - -[Version] -Signature = "$Windows NT$" -Class = Net -ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} -Provider = %CompanyName% -DriverVer = 02/04/2018, 4.25.0.9658 -CatalogFile.NT = Neo6_x64_VPN77.cat - -[Manufacturer] -%CompanyName% = SoftEther, NTamd64 - -[SourceDisksNames] -1=%DiskDescription%, "", , - -[SourceDisksFiles] -Neo6_x64_VPN77.sys = 1 - -[DestinationDirs] -DefaultDestDir = 12 -Neo.CopyFiles.Sys = 12 - -[Neo.CopyFiles.Sys] -Neo6_x64_VPN77.sys, , , 2 - -[SoftEther.NTamd64] -%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN77 - -[NeoAdapter.Install] -Characteristics = 0x1 -AddReg = Neo.Reg, NeoAdapter.Ndi -CopyFiles = Neo.CopyFiles.Sys -*IfType = 53 -*MediaType = 0 -*PhysicalMediaType = 0 - -[NeoAdapter.Install.Services] -AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% - -[NeoAdapter.Ndi] -HKR, , NetworkAddress, 0, %DefaultAddress% -HKR, Ndi, DeviceID, , "NeoAdapter_VPN77" -HKR, , DevLoader, , ndis -HKR, , DeviceVxDs, , Neo6_x64_VPN77.sys -HKR, NDIS, LogDriverName, , "Neo_VPN77" -HKR, NDIS, MajorNdisVersion, 1, 5 -HKR, NDIS, MinorNdisVersion, 1, 0 -HKR, Ndi\Interfaces, DefUpper, , "ndis5" -HKR, Ndi\Interfaces, UpperRange, , "ndis5" -HKR, Ndi\Interfaces, LowerRange, , "ethernet" -HKR, Ndi\Interfaces, DefLower, , "ethernet" -HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" -HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% -HKR, Ndi\Params\NetworkAddress, type, 0, "edit" -HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" -HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" -HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% -HKR, Ndi\Params\NetworkAddress, optional, 0, "0" -HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% -HKR, Ndi\Params\MaxSpeed, type, 0, "int" -HKR, Ndi\Params\MaxSpeed, default, 0, "100" -HKR, Ndi\Params\MaxSpeed, min, 0, "0" -HKR, Ndi\Params\MaxSpeed, max, 0, "2000" -HKR, Ndi\Params\MaxSpeed, step, 0, "1" -HKR, Ndi\Params\MaxSpeed, Base, 0, "10" -HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% -HKR, Ndi\Params\KeepLink, type, 0, "enum" -HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% -HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% -HKR, Ndi\Params\KeepLink, default, 0, "0" - - -[Neo.Service] -DisplayName = %Neo.Service.DispName% -Description = %Neo.Service.Desc% -ServiceType = 1 -StartType = 3 -ErrorControl = 1 -ServiceBinary = %12%\Neo6_x64_VPN77.sys -LoadOrderGroup = NDIS - -[Neo.Reg] -HKR, Ndi, Service, 0, Neo.Service.Name -HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" -HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" - -[Neo.EventLog] -HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo6_x64_VPN77.sys" -HKR, , TypesSupported, 0x00010001, 7 - -[Strings] -CompanyName = "SoftEther Corporation" -DiskDescription = "VPN Client Device Driver Install Disk" -Neo.Service.Name = "Neo_VPN77" -Neo.Service.DispName = "VPN Client Device Driver - VPN77" -Neo.Service.Desc = "VPN Client Adapter - VPN77" -NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN77" -Neo.EventLog.Name = "Neo" -NetworkAddress = "MAC Address" -DefaultAddress = "000001000001" -MaxSpeed = "Indicate Speed (Mbps)" -KeepLink = "Keep Link" -On = "On" -Off = "Off" - - -; Auto Generated 20180205_163626.795 - +; VPN Client Device Driver for Windows 2000 and Greater +; +; Copyright (c) SoftEther Corporation. All Rights Reserved. +; http://www.softether.co.jp/ +; +; BUILD 9658 + +[Version] +Signature = "$Windows NT$" +Class = Net +ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} +Provider = %CompanyName% +DriverVer = 02/04/2018, 4.25.0.9658 +CatalogFile.NT = Neo6_x64_VPN77.cat + +[Manufacturer] +%CompanyName% = SoftEther, NTamd64 + +[SourceDisksNames] +1=%DiskDescription%, "", , + +[SourceDisksFiles] +Neo6_x64_VPN77.sys = 1 + +[DestinationDirs] +DefaultDestDir = 12 +Neo.CopyFiles.Sys = 12 + +[Neo.CopyFiles.Sys] +Neo6_x64_VPN77.sys, , , 2 + +[SoftEther.NTamd64] +%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN77 + +[NeoAdapter.Install] +Characteristics = 0x1 +AddReg = Neo.Reg, NeoAdapter.Ndi +CopyFiles = Neo.CopyFiles.Sys +*IfType = 53 +*MediaType = 0 +*PhysicalMediaType = 0 + +[NeoAdapter.Install.Services] +AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% + +[NeoAdapter.Ndi] +HKR, , NetworkAddress, 0, %DefaultAddress% +HKR, Ndi, DeviceID, , "NeoAdapter_VPN77" +HKR, , DevLoader, , ndis +HKR, , DeviceVxDs, , Neo6_x64_VPN77.sys +HKR, NDIS, LogDriverName, , "Neo_VPN77" +HKR, NDIS, MajorNdisVersion, 1, 5 +HKR, NDIS, MinorNdisVersion, 1, 0 +HKR, Ndi\Interfaces, DefUpper, , "ndis5" +HKR, Ndi\Interfaces, UpperRange, , "ndis5" +HKR, Ndi\Interfaces, LowerRange, , "ethernet" +HKR, Ndi\Interfaces, DefLower, , "ethernet" +HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" +HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% +HKR, Ndi\Params\NetworkAddress, type, 0, "edit" +HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" +HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" +HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% +HKR, Ndi\Params\NetworkAddress, optional, 0, "0" +HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% +HKR, Ndi\Params\MaxSpeed, type, 0, "int" +HKR, Ndi\Params\MaxSpeed, default, 0, "100" +HKR, Ndi\Params\MaxSpeed, min, 0, "0" +HKR, Ndi\Params\MaxSpeed, max, 0, "2000" +HKR, Ndi\Params\MaxSpeed, step, 0, "1" +HKR, Ndi\Params\MaxSpeed, Base, 0, "10" +HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% +HKR, Ndi\Params\KeepLink, type, 0, "enum" +HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% +HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% +HKR, Ndi\Params\KeepLink, default, 0, "0" + + +[Neo.Service] +DisplayName = %Neo.Service.DispName% +Description = %Neo.Service.Desc% +ServiceType = 1 +StartType = 3 +ErrorControl = 1 +ServiceBinary = %12%\Neo6_x64_VPN77.sys +LoadOrderGroup = NDIS + +[Neo.Reg] +HKR, Ndi, Service, 0, Neo.Service.Name +HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" +HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" + +[Neo.EventLog] +HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo6_x64_VPN77.sys" +HKR, , TypesSupported, 0x00010001, 7 + +[Strings] +CompanyName = "SoftEther Corporation" +DiskDescription = "VPN Client Device Driver Install Disk" +Neo.Service.Name = "Neo_VPN77" +Neo.Service.DispName = "VPN Client Device Driver - VPN77" +Neo.Service.Desc = "VPN Client Adapter - VPN77" +NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN77" +Neo.EventLog.Name = "Neo" +NetworkAddress = "MAC Address" +DefaultAddress = "000001000001" +MaxSpeed = "Indicate Speed (Mbps)" +KeepLink = "Keep Link" +On = "On" +Off = "Off" + + +; Auto Generated 20180205_163626.795 + diff --git a/src/bin/hamcore/DriverPackages/Neo6_Win10/x64/Neo6_x64_VPN78.inf b/src/bin/hamcore/DriverPackages/Neo6_Win10/x64/Neo6_x64_VPN78.inf index ce867097..3972bc6d 100644 --- a/src/bin/hamcore/DriverPackages/Neo6_Win10/x64/Neo6_x64_VPN78.inf +++ b/src/bin/hamcore/DriverPackages/Neo6_Win10/x64/Neo6_x64_VPN78.inf @@ -1,114 +1,114 @@ -; VPN Client Device Driver for Windows 2000 and Greater -; -; Copyright (c) SoftEther Corporation. All Rights Reserved. -; http://www.softether.co.jp/ -; -; BUILD 9658 - -[Version] -Signature = "$Windows NT$" -Class = Net -ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} -Provider = %CompanyName% -DriverVer = 02/04/2018, 4.25.0.9658 -CatalogFile.NT = Neo6_x64_VPN78.cat - -[Manufacturer] -%CompanyName% = SoftEther, NTamd64 - -[SourceDisksNames] -1=%DiskDescription%, "", , - -[SourceDisksFiles] -Neo6_x64_VPN78.sys = 1 - -[DestinationDirs] -DefaultDestDir = 12 -Neo.CopyFiles.Sys = 12 - -[Neo.CopyFiles.Sys] -Neo6_x64_VPN78.sys, , , 2 - -[SoftEther.NTamd64] -%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN78 - -[NeoAdapter.Install] -Characteristics = 0x1 -AddReg = Neo.Reg, NeoAdapter.Ndi -CopyFiles = Neo.CopyFiles.Sys -*IfType = 53 -*MediaType = 0 -*PhysicalMediaType = 0 - -[NeoAdapter.Install.Services] -AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% - -[NeoAdapter.Ndi] -HKR, , NetworkAddress, 0, %DefaultAddress% -HKR, Ndi, DeviceID, , "NeoAdapter_VPN78" -HKR, , DevLoader, , ndis -HKR, , DeviceVxDs, , Neo6_x64_VPN78.sys -HKR, NDIS, LogDriverName, , "Neo_VPN78" -HKR, NDIS, MajorNdisVersion, 1, 5 -HKR, NDIS, MinorNdisVersion, 1, 0 -HKR, Ndi\Interfaces, DefUpper, , "ndis5" -HKR, Ndi\Interfaces, UpperRange, , "ndis5" -HKR, Ndi\Interfaces, LowerRange, , "ethernet" -HKR, Ndi\Interfaces, DefLower, , "ethernet" -HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" -HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% -HKR, Ndi\Params\NetworkAddress, type, 0, "edit" -HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" -HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" -HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% -HKR, Ndi\Params\NetworkAddress, optional, 0, "0" -HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% -HKR, Ndi\Params\MaxSpeed, type, 0, "int" -HKR, Ndi\Params\MaxSpeed, default, 0, "100" -HKR, Ndi\Params\MaxSpeed, min, 0, "0" -HKR, Ndi\Params\MaxSpeed, max, 0, "2000" -HKR, Ndi\Params\MaxSpeed, step, 0, "1" -HKR, Ndi\Params\MaxSpeed, Base, 0, "10" -HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% -HKR, Ndi\Params\KeepLink, type, 0, "enum" -HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% -HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% -HKR, Ndi\Params\KeepLink, default, 0, "0" - - -[Neo.Service] -DisplayName = %Neo.Service.DispName% -Description = %Neo.Service.Desc% -ServiceType = 1 -StartType = 3 -ErrorControl = 1 -ServiceBinary = %12%\Neo6_x64_VPN78.sys -LoadOrderGroup = NDIS - -[Neo.Reg] -HKR, Ndi, Service, 0, Neo.Service.Name -HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" -HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" - -[Neo.EventLog] -HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo6_x64_VPN78.sys" -HKR, , TypesSupported, 0x00010001, 7 - -[Strings] -CompanyName = "SoftEther Corporation" -DiskDescription = "VPN Client Device Driver Install Disk" -Neo.Service.Name = "Neo_VPN78" -Neo.Service.DispName = "VPN Client Device Driver - VPN78" -Neo.Service.Desc = "VPN Client Adapter - VPN78" -NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN78" -Neo.EventLog.Name = "Neo" -NetworkAddress = "MAC Address" -DefaultAddress = "000001000001" -MaxSpeed = "Indicate Speed (Mbps)" -KeepLink = "Keep Link" -On = "On" -Off = "Off" - - -; Auto Generated 20180205_163626.865 - +; VPN Client Device Driver for Windows 2000 and Greater +; +; Copyright (c) SoftEther Corporation. All Rights Reserved. +; http://www.softether.co.jp/ +; +; BUILD 9658 + +[Version] +Signature = "$Windows NT$" +Class = Net +ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} +Provider = %CompanyName% +DriverVer = 02/04/2018, 4.25.0.9658 +CatalogFile.NT = Neo6_x64_VPN78.cat + +[Manufacturer] +%CompanyName% = SoftEther, NTamd64 + +[SourceDisksNames] +1=%DiskDescription%, "", , + +[SourceDisksFiles] +Neo6_x64_VPN78.sys = 1 + +[DestinationDirs] +DefaultDestDir = 12 +Neo.CopyFiles.Sys = 12 + +[Neo.CopyFiles.Sys] +Neo6_x64_VPN78.sys, , , 2 + +[SoftEther.NTamd64] +%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN78 + +[NeoAdapter.Install] +Characteristics = 0x1 +AddReg = Neo.Reg, NeoAdapter.Ndi +CopyFiles = Neo.CopyFiles.Sys +*IfType = 53 +*MediaType = 0 +*PhysicalMediaType = 0 + +[NeoAdapter.Install.Services] +AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% + +[NeoAdapter.Ndi] +HKR, , NetworkAddress, 0, %DefaultAddress% +HKR, Ndi, DeviceID, , "NeoAdapter_VPN78" +HKR, , DevLoader, , ndis +HKR, , DeviceVxDs, , Neo6_x64_VPN78.sys +HKR, NDIS, LogDriverName, , "Neo_VPN78" +HKR, NDIS, MajorNdisVersion, 1, 5 +HKR, NDIS, MinorNdisVersion, 1, 0 +HKR, Ndi\Interfaces, DefUpper, , "ndis5" +HKR, Ndi\Interfaces, UpperRange, , "ndis5" +HKR, Ndi\Interfaces, LowerRange, , "ethernet" +HKR, Ndi\Interfaces, DefLower, , "ethernet" +HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" +HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% +HKR, Ndi\Params\NetworkAddress, type, 0, "edit" +HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" +HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" +HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% +HKR, Ndi\Params\NetworkAddress, optional, 0, "0" +HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% +HKR, Ndi\Params\MaxSpeed, type, 0, "int" +HKR, Ndi\Params\MaxSpeed, default, 0, "100" +HKR, Ndi\Params\MaxSpeed, min, 0, "0" +HKR, Ndi\Params\MaxSpeed, max, 0, "2000" +HKR, Ndi\Params\MaxSpeed, step, 0, "1" +HKR, Ndi\Params\MaxSpeed, Base, 0, "10" +HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% +HKR, Ndi\Params\KeepLink, type, 0, "enum" +HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% +HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% +HKR, Ndi\Params\KeepLink, default, 0, "0" + + +[Neo.Service] +DisplayName = %Neo.Service.DispName% +Description = %Neo.Service.Desc% +ServiceType = 1 +StartType = 3 +ErrorControl = 1 +ServiceBinary = %12%\Neo6_x64_VPN78.sys +LoadOrderGroup = NDIS + +[Neo.Reg] +HKR, Ndi, Service, 0, Neo.Service.Name +HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" +HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" + +[Neo.EventLog] +HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo6_x64_VPN78.sys" +HKR, , TypesSupported, 0x00010001, 7 + +[Strings] +CompanyName = "SoftEther Corporation" +DiskDescription = "VPN Client Device Driver Install Disk" +Neo.Service.Name = "Neo_VPN78" +Neo.Service.DispName = "VPN Client Device Driver - VPN78" +Neo.Service.Desc = "VPN Client Adapter - VPN78" +NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN78" +Neo.EventLog.Name = "Neo" +NetworkAddress = "MAC Address" +DefaultAddress = "000001000001" +MaxSpeed = "Indicate Speed (Mbps)" +KeepLink = "Keep Link" +On = "On" +Off = "Off" + + +; Auto Generated 20180205_163626.865 + diff --git a/src/bin/hamcore/DriverPackages/Neo6_Win10/x64/Neo6_x64_VPN79.inf b/src/bin/hamcore/DriverPackages/Neo6_Win10/x64/Neo6_x64_VPN79.inf index 5f587134..9bfebcd7 100644 --- a/src/bin/hamcore/DriverPackages/Neo6_Win10/x64/Neo6_x64_VPN79.inf +++ b/src/bin/hamcore/DriverPackages/Neo6_Win10/x64/Neo6_x64_VPN79.inf @@ -1,114 +1,114 @@ -; VPN Client Device Driver for Windows 2000 and Greater -; -; Copyright (c) SoftEther Corporation. All Rights Reserved. -; http://www.softether.co.jp/ -; -; BUILD 9658 - -[Version] -Signature = "$Windows NT$" -Class = Net -ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} -Provider = %CompanyName% -DriverVer = 02/04/2018, 4.25.0.9658 -CatalogFile.NT = Neo6_x64_VPN79.cat - -[Manufacturer] -%CompanyName% = SoftEther, NTamd64 - -[SourceDisksNames] -1=%DiskDescription%, "", , - -[SourceDisksFiles] -Neo6_x64_VPN79.sys = 1 - -[DestinationDirs] -DefaultDestDir = 12 -Neo.CopyFiles.Sys = 12 - -[Neo.CopyFiles.Sys] -Neo6_x64_VPN79.sys, , , 2 - -[SoftEther.NTamd64] -%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN79 - -[NeoAdapter.Install] -Characteristics = 0x1 -AddReg = Neo.Reg, NeoAdapter.Ndi -CopyFiles = Neo.CopyFiles.Sys -*IfType = 53 -*MediaType = 0 -*PhysicalMediaType = 0 - -[NeoAdapter.Install.Services] -AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% - -[NeoAdapter.Ndi] -HKR, , NetworkAddress, 0, %DefaultAddress% -HKR, Ndi, DeviceID, , "NeoAdapter_VPN79" -HKR, , DevLoader, , ndis -HKR, , DeviceVxDs, , Neo6_x64_VPN79.sys -HKR, NDIS, LogDriverName, , "Neo_VPN79" -HKR, NDIS, MajorNdisVersion, 1, 5 -HKR, NDIS, MinorNdisVersion, 1, 0 -HKR, Ndi\Interfaces, DefUpper, , "ndis5" -HKR, Ndi\Interfaces, UpperRange, , "ndis5" -HKR, Ndi\Interfaces, LowerRange, , "ethernet" -HKR, Ndi\Interfaces, DefLower, , "ethernet" -HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" -HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% -HKR, Ndi\Params\NetworkAddress, type, 0, "edit" -HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" -HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" -HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% -HKR, Ndi\Params\NetworkAddress, optional, 0, "0" -HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% -HKR, Ndi\Params\MaxSpeed, type, 0, "int" -HKR, Ndi\Params\MaxSpeed, default, 0, "100" -HKR, Ndi\Params\MaxSpeed, min, 0, "0" -HKR, Ndi\Params\MaxSpeed, max, 0, "2000" -HKR, Ndi\Params\MaxSpeed, step, 0, "1" -HKR, Ndi\Params\MaxSpeed, Base, 0, "10" -HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% -HKR, Ndi\Params\KeepLink, type, 0, "enum" -HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% -HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% -HKR, Ndi\Params\KeepLink, default, 0, "0" - - -[Neo.Service] -DisplayName = %Neo.Service.DispName% -Description = %Neo.Service.Desc% -ServiceType = 1 -StartType = 3 -ErrorControl = 1 -ServiceBinary = %12%\Neo6_x64_VPN79.sys -LoadOrderGroup = NDIS - -[Neo.Reg] -HKR, Ndi, Service, 0, Neo.Service.Name -HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" -HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" - -[Neo.EventLog] -HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo6_x64_VPN79.sys" -HKR, , TypesSupported, 0x00010001, 7 - -[Strings] -CompanyName = "SoftEther Corporation" -DiskDescription = "VPN Client Device Driver Install Disk" -Neo.Service.Name = "Neo_VPN79" -Neo.Service.DispName = "VPN Client Device Driver - VPN79" -Neo.Service.Desc = "VPN Client Adapter - VPN79" -NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN79" -Neo.EventLog.Name = "Neo" -NetworkAddress = "MAC Address" -DefaultAddress = "000001000001" -MaxSpeed = "Indicate Speed (Mbps)" -KeepLink = "Keep Link" -On = "On" -Off = "Off" - - -; Auto Generated 20180205_163626.935 - +; VPN Client Device Driver for Windows 2000 and Greater +; +; Copyright (c) SoftEther Corporation. All Rights Reserved. +; http://www.softether.co.jp/ +; +; BUILD 9658 + +[Version] +Signature = "$Windows NT$" +Class = Net +ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} +Provider = %CompanyName% +DriverVer = 02/04/2018, 4.25.0.9658 +CatalogFile.NT = Neo6_x64_VPN79.cat + +[Manufacturer] +%CompanyName% = SoftEther, NTamd64 + +[SourceDisksNames] +1=%DiskDescription%, "", , + +[SourceDisksFiles] +Neo6_x64_VPN79.sys = 1 + +[DestinationDirs] +DefaultDestDir = 12 +Neo.CopyFiles.Sys = 12 + +[Neo.CopyFiles.Sys] +Neo6_x64_VPN79.sys, , , 2 + +[SoftEther.NTamd64] +%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN79 + +[NeoAdapter.Install] +Characteristics = 0x1 +AddReg = Neo.Reg, NeoAdapter.Ndi +CopyFiles = Neo.CopyFiles.Sys +*IfType = 53 +*MediaType = 0 +*PhysicalMediaType = 0 + +[NeoAdapter.Install.Services] +AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% + +[NeoAdapter.Ndi] +HKR, , NetworkAddress, 0, %DefaultAddress% +HKR, Ndi, DeviceID, , "NeoAdapter_VPN79" +HKR, , DevLoader, , ndis +HKR, , DeviceVxDs, , Neo6_x64_VPN79.sys +HKR, NDIS, LogDriverName, , "Neo_VPN79" +HKR, NDIS, MajorNdisVersion, 1, 5 +HKR, NDIS, MinorNdisVersion, 1, 0 +HKR, Ndi\Interfaces, DefUpper, , "ndis5" +HKR, Ndi\Interfaces, UpperRange, , "ndis5" +HKR, Ndi\Interfaces, LowerRange, , "ethernet" +HKR, Ndi\Interfaces, DefLower, , "ethernet" +HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" +HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% +HKR, Ndi\Params\NetworkAddress, type, 0, "edit" +HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" +HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" +HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% +HKR, Ndi\Params\NetworkAddress, optional, 0, "0" +HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% +HKR, Ndi\Params\MaxSpeed, type, 0, "int" +HKR, Ndi\Params\MaxSpeed, default, 0, "100" +HKR, Ndi\Params\MaxSpeed, min, 0, "0" +HKR, Ndi\Params\MaxSpeed, max, 0, "2000" +HKR, Ndi\Params\MaxSpeed, step, 0, "1" +HKR, Ndi\Params\MaxSpeed, Base, 0, "10" +HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% +HKR, Ndi\Params\KeepLink, type, 0, "enum" +HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% +HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% +HKR, Ndi\Params\KeepLink, default, 0, "0" + + +[Neo.Service] +DisplayName = %Neo.Service.DispName% +Description = %Neo.Service.Desc% +ServiceType = 1 +StartType = 3 +ErrorControl = 1 +ServiceBinary = %12%\Neo6_x64_VPN79.sys +LoadOrderGroup = NDIS + +[Neo.Reg] +HKR, Ndi, Service, 0, Neo.Service.Name +HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" +HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" + +[Neo.EventLog] +HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo6_x64_VPN79.sys" +HKR, , TypesSupported, 0x00010001, 7 + +[Strings] +CompanyName = "SoftEther Corporation" +DiskDescription = "VPN Client Device Driver Install Disk" +Neo.Service.Name = "Neo_VPN79" +Neo.Service.DispName = "VPN Client Device Driver - VPN79" +Neo.Service.Desc = "VPN Client Adapter - VPN79" +NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN79" +Neo.EventLog.Name = "Neo" +NetworkAddress = "MAC Address" +DefaultAddress = "000001000001" +MaxSpeed = "Indicate Speed (Mbps)" +KeepLink = "Keep Link" +On = "On" +Off = "Off" + + +; Auto Generated 20180205_163626.935 + diff --git a/src/bin/hamcore/DriverPackages/Neo6_Win10/x64/Neo6_x64_VPN8.inf b/src/bin/hamcore/DriverPackages/Neo6_Win10/x64/Neo6_x64_VPN8.inf index f8671f9f..e495f4d5 100644 --- a/src/bin/hamcore/DriverPackages/Neo6_Win10/x64/Neo6_x64_VPN8.inf +++ b/src/bin/hamcore/DriverPackages/Neo6_Win10/x64/Neo6_x64_VPN8.inf @@ -1,114 +1,114 @@ -; VPN Client Device Driver for Windows 2000 and Greater -; -; Copyright (c) SoftEther Corporation. All Rights Reserved. -; http://www.softether.co.jp/ -; -; BUILD 9658 - -[Version] -Signature = "$Windows NT$" -Class = Net -ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} -Provider = %CompanyName% -DriverVer = 02/04/2018, 4.25.0.9658 -CatalogFile.NT = Neo6_x64_VPN8.cat - -[Manufacturer] -%CompanyName% = SoftEther, NTamd64 - -[SourceDisksNames] -1=%DiskDescription%, "", , - -[SourceDisksFiles] -Neo6_x64_VPN8.sys = 1 - -[DestinationDirs] -DefaultDestDir = 12 -Neo.CopyFiles.Sys = 12 - -[Neo.CopyFiles.Sys] -Neo6_x64_VPN8.sys, , , 2 - -[SoftEther.NTamd64] -%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN8 - -[NeoAdapter.Install] -Characteristics = 0x1 -AddReg = Neo.Reg, NeoAdapter.Ndi -CopyFiles = Neo.CopyFiles.Sys -*IfType = 53 -*MediaType = 0 -*PhysicalMediaType = 0 - -[NeoAdapter.Install.Services] -AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% - -[NeoAdapter.Ndi] -HKR, , NetworkAddress, 0, %DefaultAddress% -HKR, Ndi, DeviceID, , "NeoAdapter_VPN8" -HKR, , DevLoader, , ndis -HKR, , DeviceVxDs, , Neo6_x64_VPN8.sys -HKR, NDIS, LogDriverName, , "Neo_VPN8" -HKR, NDIS, MajorNdisVersion, 1, 5 -HKR, NDIS, MinorNdisVersion, 1, 0 -HKR, Ndi\Interfaces, DefUpper, , "ndis5" -HKR, Ndi\Interfaces, UpperRange, , "ndis5" -HKR, Ndi\Interfaces, LowerRange, , "ethernet" -HKR, Ndi\Interfaces, DefLower, , "ethernet" -HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" -HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% -HKR, Ndi\Params\NetworkAddress, type, 0, "edit" -HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" -HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" -HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% -HKR, Ndi\Params\NetworkAddress, optional, 0, "0" -HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% -HKR, Ndi\Params\MaxSpeed, type, 0, "int" -HKR, Ndi\Params\MaxSpeed, default, 0, "100" -HKR, Ndi\Params\MaxSpeed, min, 0, "0" -HKR, Ndi\Params\MaxSpeed, max, 0, "2000" -HKR, Ndi\Params\MaxSpeed, step, 0, "1" -HKR, Ndi\Params\MaxSpeed, Base, 0, "10" -HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% -HKR, Ndi\Params\KeepLink, type, 0, "enum" -HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% -HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% -HKR, Ndi\Params\KeepLink, default, 0, "0" - - -[Neo.Service] -DisplayName = %Neo.Service.DispName% -Description = %Neo.Service.Desc% -ServiceType = 1 -StartType = 3 -ErrorControl = 1 -ServiceBinary = %12%\Neo6_x64_VPN8.sys -LoadOrderGroup = NDIS - -[Neo.Reg] -HKR, Ndi, Service, 0, Neo.Service.Name -HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" -HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" - -[Neo.EventLog] -HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo6_x64_VPN8.sys" -HKR, , TypesSupported, 0x00010001, 7 - -[Strings] -CompanyName = "SoftEther Corporation" -DiskDescription = "VPN Client Device Driver Install Disk" -Neo.Service.Name = "Neo_VPN8" -Neo.Service.DispName = "VPN Client Device Driver - VPN8" -Neo.Service.Desc = "VPN Client Adapter - VPN8" -NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN8" -Neo.EventLog.Name = "Neo" -NetworkAddress = "MAC Address" -DefaultAddress = "000001000001" -MaxSpeed = "Indicate Speed (Mbps)" -KeepLink = "Keep Link" -On = "On" -Off = "Off" - - -; Auto Generated 20180205_163621.882 - +; VPN Client Device Driver for Windows 2000 and Greater +; +; Copyright (c) SoftEther Corporation. All Rights Reserved. +; http://www.softether.co.jp/ +; +; BUILD 9658 + +[Version] +Signature = "$Windows NT$" +Class = Net +ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} +Provider = %CompanyName% +DriverVer = 02/04/2018, 4.25.0.9658 +CatalogFile.NT = Neo6_x64_VPN8.cat + +[Manufacturer] +%CompanyName% = SoftEther, NTamd64 + +[SourceDisksNames] +1=%DiskDescription%, "", , + +[SourceDisksFiles] +Neo6_x64_VPN8.sys = 1 + +[DestinationDirs] +DefaultDestDir = 12 +Neo.CopyFiles.Sys = 12 + +[Neo.CopyFiles.Sys] +Neo6_x64_VPN8.sys, , , 2 + +[SoftEther.NTamd64] +%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN8 + +[NeoAdapter.Install] +Characteristics = 0x1 +AddReg = Neo.Reg, NeoAdapter.Ndi +CopyFiles = Neo.CopyFiles.Sys +*IfType = 53 +*MediaType = 0 +*PhysicalMediaType = 0 + +[NeoAdapter.Install.Services] +AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% + +[NeoAdapter.Ndi] +HKR, , NetworkAddress, 0, %DefaultAddress% +HKR, Ndi, DeviceID, , "NeoAdapter_VPN8" +HKR, , DevLoader, , ndis +HKR, , DeviceVxDs, , Neo6_x64_VPN8.sys +HKR, NDIS, LogDriverName, , "Neo_VPN8" +HKR, NDIS, MajorNdisVersion, 1, 5 +HKR, NDIS, MinorNdisVersion, 1, 0 +HKR, Ndi\Interfaces, DefUpper, , "ndis5" +HKR, Ndi\Interfaces, UpperRange, , "ndis5" +HKR, Ndi\Interfaces, LowerRange, , "ethernet" +HKR, Ndi\Interfaces, DefLower, , "ethernet" +HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" +HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% +HKR, Ndi\Params\NetworkAddress, type, 0, "edit" +HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" +HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" +HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% +HKR, Ndi\Params\NetworkAddress, optional, 0, "0" +HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% +HKR, Ndi\Params\MaxSpeed, type, 0, "int" +HKR, Ndi\Params\MaxSpeed, default, 0, "100" +HKR, Ndi\Params\MaxSpeed, min, 0, "0" +HKR, Ndi\Params\MaxSpeed, max, 0, "2000" +HKR, Ndi\Params\MaxSpeed, step, 0, "1" +HKR, Ndi\Params\MaxSpeed, Base, 0, "10" +HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% +HKR, Ndi\Params\KeepLink, type, 0, "enum" +HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% +HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% +HKR, Ndi\Params\KeepLink, default, 0, "0" + + +[Neo.Service] +DisplayName = %Neo.Service.DispName% +Description = %Neo.Service.Desc% +ServiceType = 1 +StartType = 3 +ErrorControl = 1 +ServiceBinary = %12%\Neo6_x64_VPN8.sys +LoadOrderGroup = NDIS + +[Neo.Reg] +HKR, Ndi, Service, 0, Neo.Service.Name +HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" +HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" + +[Neo.EventLog] +HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo6_x64_VPN8.sys" +HKR, , TypesSupported, 0x00010001, 7 + +[Strings] +CompanyName = "SoftEther Corporation" +DiskDescription = "VPN Client Device Driver Install Disk" +Neo.Service.Name = "Neo_VPN8" +Neo.Service.DispName = "VPN Client Device Driver - VPN8" +Neo.Service.Desc = "VPN Client Adapter - VPN8" +NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN8" +Neo.EventLog.Name = "Neo" +NetworkAddress = "MAC Address" +DefaultAddress = "000001000001" +MaxSpeed = "Indicate Speed (Mbps)" +KeepLink = "Keep Link" +On = "On" +Off = "Off" + + +; Auto Generated 20180205_163621.882 + diff --git a/src/bin/hamcore/DriverPackages/Neo6_Win10/x64/Neo6_x64_VPN80.inf b/src/bin/hamcore/DriverPackages/Neo6_Win10/x64/Neo6_x64_VPN80.inf index 3a5b3b89..966d8526 100644 --- a/src/bin/hamcore/DriverPackages/Neo6_Win10/x64/Neo6_x64_VPN80.inf +++ b/src/bin/hamcore/DriverPackages/Neo6_Win10/x64/Neo6_x64_VPN80.inf @@ -1,114 +1,114 @@ -; VPN Client Device Driver for Windows 2000 and Greater -; -; Copyright (c) SoftEther Corporation. All Rights Reserved. -; http://www.softether.co.jp/ -; -; BUILD 9658 - -[Version] -Signature = "$Windows NT$" -Class = Net -ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} -Provider = %CompanyName% -DriverVer = 02/04/2018, 4.25.0.9658 -CatalogFile.NT = Neo6_x64_VPN80.cat - -[Manufacturer] -%CompanyName% = SoftEther, NTamd64 - -[SourceDisksNames] -1=%DiskDescription%, "", , - -[SourceDisksFiles] -Neo6_x64_VPN80.sys = 1 - -[DestinationDirs] -DefaultDestDir = 12 -Neo.CopyFiles.Sys = 12 - -[Neo.CopyFiles.Sys] -Neo6_x64_VPN80.sys, , , 2 - -[SoftEther.NTamd64] -%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN80 - -[NeoAdapter.Install] -Characteristics = 0x1 -AddReg = Neo.Reg, NeoAdapter.Ndi -CopyFiles = Neo.CopyFiles.Sys -*IfType = 53 -*MediaType = 0 -*PhysicalMediaType = 0 - -[NeoAdapter.Install.Services] -AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% - -[NeoAdapter.Ndi] -HKR, , NetworkAddress, 0, %DefaultAddress% -HKR, Ndi, DeviceID, , "NeoAdapter_VPN80" -HKR, , DevLoader, , ndis -HKR, , DeviceVxDs, , Neo6_x64_VPN80.sys -HKR, NDIS, LogDriverName, , "Neo_VPN80" -HKR, NDIS, MajorNdisVersion, 1, 5 -HKR, NDIS, MinorNdisVersion, 1, 0 -HKR, Ndi\Interfaces, DefUpper, , "ndis5" -HKR, Ndi\Interfaces, UpperRange, , "ndis5" -HKR, Ndi\Interfaces, LowerRange, , "ethernet" -HKR, Ndi\Interfaces, DefLower, , "ethernet" -HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" -HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% -HKR, Ndi\Params\NetworkAddress, type, 0, "edit" -HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" -HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" -HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% -HKR, Ndi\Params\NetworkAddress, optional, 0, "0" -HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% -HKR, Ndi\Params\MaxSpeed, type, 0, "int" -HKR, Ndi\Params\MaxSpeed, default, 0, "100" -HKR, Ndi\Params\MaxSpeed, min, 0, "0" -HKR, Ndi\Params\MaxSpeed, max, 0, "2000" -HKR, Ndi\Params\MaxSpeed, step, 0, "1" -HKR, Ndi\Params\MaxSpeed, Base, 0, "10" -HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% -HKR, Ndi\Params\KeepLink, type, 0, "enum" -HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% -HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% -HKR, Ndi\Params\KeepLink, default, 0, "0" - - -[Neo.Service] -DisplayName = %Neo.Service.DispName% -Description = %Neo.Service.Desc% -ServiceType = 1 -StartType = 3 -ErrorControl = 1 -ServiceBinary = %12%\Neo6_x64_VPN80.sys -LoadOrderGroup = NDIS - -[Neo.Reg] -HKR, Ndi, Service, 0, Neo.Service.Name -HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" -HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" - -[Neo.EventLog] -HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo6_x64_VPN80.sys" -HKR, , TypesSupported, 0x00010001, 7 - -[Strings] -CompanyName = "SoftEther Corporation" -DiskDescription = "VPN Client Device Driver Install Disk" -Neo.Service.Name = "Neo_VPN80" -Neo.Service.DispName = "VPN Client Device Driver - VPN80" -Neo.Service.Desc = "VPN Client Adapter - VPN80" -NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN80" -Neo.EventLog.Name = "Neo" -NetworkAddress = "MAC Address" -DefaultAddress = "000001000001" -MaxSpeed = "Indicate Speed (Mbps)" -KeepLink = "Keep Link" -On = "On" -Off = "Off" - - -; Auto Generated 20180205_163627.007 - +; VPN Client Device Driver for Windows 2000 and Greater +; +; Copyright (c) SoftEther Corporation. All Rights Reserved. +; http://www.softether.co.jp/ +; +; BUILD 9658 + +[Version] +Signature = "$Windows NT$" +Class = Net +ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} +Provider = %CompanyName% +DriverVer = 02/04/2018, 4.25.0.9658 +CatalogFile.NT = Neo6_x64_VPN80.cat + +[Manufacturer] +%CompanyName% = SoftEther, NTamd64 + +[SourceDisksNames] +1=%DiskDescription%, "", , + +[SourceDisksFiles] +Neo6_x64_VPN80.sys = 1 + +[DestinationDirs] +DefaultDestDir = 12 +Neo.CopyFiles.Sys = 12 + +[Neo.CopyFiles.Sys] +Neo6_x64_VPN80.sys, , , 2 + +[SoftEther.NTamd64] +%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN80 + +[NeoAdapter.Install] +Characteristics = 0x1 +AddReg = Neo.Reg, NeoAdapter.Ndi +CopyFiles = Neo.CopyFiles.Sys +*IfType = 53 +*MediaType = 0 +*PhysicalMediaType = 0 + +[NeoAdapter.Install.Services] +AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% + +[NeoAdapter.Ndi] +HKR, , NetworkAddress, 0, %DefaultAddress% +HKR, Ndi, DeviceID, , "NeoAdapter_VPN80" +HKR, , DevLoader, , ndis +HKR, , DeviceVxDs, , Neo6_x64_VPN80.sys +HKR, NDIS, LogDriverName, , "Neo_VPN80" +HKR, NDIS, MajorNdisVersion, 1, 5 +HKR, NDIS, MinorNdisVersion, 1, 0 +HKR, Ndi\Interfaces, DefUpper, , "ndis5" +HKR, Ndi\Interfaces, UpperRange, , "ndis5" +HKR, Ndi\Interfaces, LowerRange, , "ethernet" +HKR, Ndi\Interfaces, DefLower, , "ethernet" +HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" +HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% +HKR, Ndi\Params\NetworkAddress, type, 0, "edit" +HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" +HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" +HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% +HKR, Ndi\Params\NetworkAddress, optional, 0, "0" +HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% +HKR, Ndi\Params\MaxSpeed, type, 0, "int" +HKR, Ndi\Params\MaxSpeed, default, 0, "100" +HKR, Ndi\Params\MaxSpeed, min, 0, "0" +HKR, Ndi\Params\MaxSpeed, max, 0, "2000" +HKR, Ndi\Params\MaxSpeed, step, 0, "1" +HKR, Ndi\Params\MaxSpeed, Base, 0, "10" +HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% +HKR, Ndi\Params\KeepLink, type, 0, "enum" +HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% +HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% +HKR, Ndi\Params\KeepLink, default, 0, "0" + + +[Neo.Service] +DisplayName = %Neo.Service.DispName% +Description = %Neo.Service.Desc% +ServiceType = 1 +StartType = 3 +ErrorControl = 1 +ServiceBinary = %12%\Neo6_x64_VPN80.sys +LoadOrderGroup = NDIS + +[Neo.Reg] +HKR, Ndi, Service, 0, Neo.Service.Name +HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" +HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" + +[Neo.EventLog] +HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo6_x64_VPN80.sys" +HKR, , TypesSupported, 0x00010001, 7 + +[Strings] +CompanyName = "SoftEther Corporation" +DiskDescription = "VPN Client Device Driver Install Disk" +Neo.Service.Name = "Neo_VPN80" +Neo.Service.DispName = "VPN Client Device Driver - VPN80" +Neo.Service.Desc = "VPN Client Adapter - VPN80" +NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN80" +Neo.EventLog.Name = "Neo" +NetworkAddress = "MAC Address" +DefaultAddress = "000001000001" +MaxSpeed = "Indicate Speed (Mbps)" +KeepLink = "Keep Link" +On = "On" +Off = "Off" + + +; Auto Generated 20180205_163627.007 + diff --git a/src/bin/hamcore/DriverPackages/Neo6_Win10/x64/Neo6_x64_VPN81.inf b/src/bin/hamcore/DriverPackages/Neo6_Win10/x64/Neo6_x64_VPN81.inf index 568b86fc..6e9f42bc 100644 --- a/src/bin/hamcore/DriverPackages/Neo6_Win10/x64/Neo6_x64_VPN81.inf +++ b/src/bin/hamcore/DriverPackages/Neo6_Win10/x64/Neo6_x64_VPN81.inf @@ -1,114 +1,114 @@ -; VPN Client Device Driver for Windows 2000 and Greater -; -; Copyright (c) SoftEther Corporation. All Rights Reserved. -; http://www.softether.co.jp/ -; -; BUILD 9658 - -[Version] -Signature = "$Windows NT$" -Class = Net -ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} -Provider = %CompanyName% -DriverVer = 02/04/2018, 4.25.0.9658 -CatalogFile.NT = Neo6_x64_VPN81.cat - -[Manufacturer] -%CompanyName% = SoftEther, NTamd64 - -[SourceDisksNames] -1=%DiskDescription%, "", , - -[SourceDisksFiles] -Neo6_x64_VPN81.sys = 1 - -[DestinationDirs] -DefaultDestDir = 12 -Neo.CopyFiles.Sys = 12 - -[Neo.CopyFiles.Sys] -Neo6_x64_VPN81.sys, , , 2 - -[SoftEther.NTamd64] -%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN81 - -[NeoAdapter.Install] -Characteristics = 0x1 -AddReg = Neo.Reg, NeoAdapter.Ndi -CopyFiles = Neo.CopyFiles.Sys -*IfType = 53 -*MediaType = 0 -*PhysicalMediaType = 0 - -[NeoAdapter.Install.Services] -AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% - -[NeoAdapter.Ndi] -HKR, , NetworkAddress, 0, %DefaultAddress% -HKR, Ndi, DeviceID, , "NeoAdapter_VPN81" -HKR, , DevLoader, , ndis -HKR, , DeviceVxDs, , Neo6_x64_VPN81.sys -HKR, NDIS, LogDriverName, , "Neo_VPN81" -HKR, NDIS, MajorNdisVersion, 1, 5 -HKR, NDIS, MinorNdisVersion, 1, 0 -HKR, Ndi\Interfaces, DefUpper, , "ndis5" -HKR, Ndi\Interfaces, UpperRange, , "ndis5" -HKR, Ndi\Interfaces, LowerRange, , "ethernet" -HKR, Ndi\Interfaces, DefLower, , "ethernet" -HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" -HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% -HKR, Ndi\Params\NetworkAddress, type, 0, "edit" -HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" -HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" -HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% -HKR, Ndi\Params\NetworkAddress, optional, 0, "0" -HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% -HKR, Ndi\Params\MaxSpeed, type, 0, "int" -HKR, Ndi\Params\MaxSpeed, default, 0, "100" -HKR, Ndi\Params\MaxSpeed, min, 0, "0" -HKR, Ndi\Params\MaxSpeed, max, 0, "2000" -HKR, Ndi\Params\MaxSpeed, step, 0, "1" -HKR, Ndi\Params\MaxSpeed, Base, 0, "10" -HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% -HKR, Ndi\Params\KeepLink, type, 0, "enum" -HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% -HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% -HKR, Ndi\Params\KeepLink, default, 0, "0" - - -[Neo.Service] -DisplayName = %Neo.Service.DispName% -Description = %Neo.Service.Desc% -ServiceType = 1 -StartType = 3 -ErrorControl = 1 -ServiceBinary = %12%\Neo6_x64_VPN81.sys -LoadOrderGroup = NDIS - -[Neo.Reg] -HKR, Ndi, Service, 0, Neo.Service.Name -HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" -HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" - -[Neo.EventLog] -HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo6_x64_VPN81.sys" -HKR, , TypesSupported, 0x00010001, 7 - -[Strings] -CompanyName = "SoftEther Corporation" -DiskDescription = "VPN Client Device Driver Install Disk" -Neo.Service.Name = "Neo_VPN81" -Neo.Service.DispName = "VPN Client Device Driver - VPN81" -Neo.Service.Desc = "VPN Client Adapter - VPN81" -NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN81" -Neo.EventLog.Name = "Neo" -NetworkAddress = "MAC Address" -DefaultAddress = "000001000001" -MaxSpeed = "Indicate Speed (Mbps)" -KeepLink = "Keep Link" -On = "On" -Off = "Off" - - -; Auto Generated 20180205_163627.079 - +; VPN Client Device Driver for Windows 2000 and Greater +; +; Copyright (c) SoftEther Corporation. All Rights Reserved. +; http://www.softether.co.jp/ +; +; BUILD 9658 + +[Version] +Signature = "$Windows NT$" +Class = Net +ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} +Provider = %CompanyName% +DriverVer = 02/04/2018, 4.25.0.9658 +CatalogFile.NT = Neo6_x64_VPN81.cat + +[Manufacturer] +%CompanyName% = SoftEther, NTamd64 + +[SourceDisksNames] +1=%DiskDescription%, "", , + +[SourceDisksFiles] +Neo6_x64_VPN81.sys = 1 + +[DestinationDirs] +DefaultDestDir = 12 +Neo.CopyFiles.Sys = 12 + +[Neo.CopyFiles.Sys] +Neo6_x64_VPN81.sys, , , 2 + +[SoftEther.NTamd64] +%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN81 + +[NeoAdapter.Install] +Characteristics = 0x1 +AddReg = Neo.Reg, NeoAdapter.Ndi +CopyFiles = Neo.CopyFiles.Sys +*IfType = 53 +*MediaType = 0 +*PhysicalMediaType = 0 + +[NeoAdapter.Install.Services] +AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% + +[NeoAdapter.Ndi] +HKR, , NetworkAddress, 0, %DefaultAddress% +HKR, Ndi, DeviceID, , "NeoAdapter_VPN81" +HKR, , DevLoader, , ndis +HKR, , DeviceVxDs, , Neo6_x64_VPN81.sys +HKR, NDIS, LogDriverName, , "Neo_VPN81" +HKR, NDIS, MajorNdisVersion, 1, 5 +HKR, NDIS, MinorNdisVersion, 1, 0 +HKR, Ndi\Interfaces, DefUpper, , "ndis5" +HKR, Ndi\Interfaces, UpperRange, , "ndis5" +HKR, Ndi\Interfaces, LowerRange, , "ethernet" +HKR, Ndi\Interfaces, DefLower, , "ethernet" +HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" +HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% +HKR, Ndi\Params\NetworkAddress, type, 0, "edit" +HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" +HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" +HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% +HKR, Ndi\Params\NetworkAddress, optional, 0, "0" +HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% +HKR, Ndi\Params\MaxSpeed, type, 0, "int" +HKR, Ndi\Params\MaxSpeed, default, 0, "100" +HKR, Ndi\Params\MaxSpeed, min, 0, "0" +HKR, Ndi\Params\MaxSpeed, max, 0, "2000" +HKR, Ndi\Params\MaxSpeed, step, 0, "1" +HKR, Ndi\Params\MaxSpeed, Base, 0, "10" +HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% +HKR, Ndi\Params\KeepLink, type, 0, "enum" +HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% +HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% +HKR, Ndi\Params\KeepLink, default, 0, "0" + + +[Neo.Service] +DisplayName = %Neo.Service.DispName% +Description = %Neo.Service.Desc% +ServiceType = 1 +StartType = 3 +ErrorControl = 1 +ServiceBinary = %12%\Neo6_x64_VPN81.sys +LoadOrderGroup = NDIS + +[Neo.Reg] +HKR, Ndi, Service, 0, Neo.Service.Name +HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" +HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" + +[Neo.EventLog] +HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo6_x64_VPN81.sys" +HKR, , TypesSupported, 0x00010001, 7 + +[Strings] +CompanyName = "SoftEther Corporation" +DiskDescription = "VPN Client Device Driver Install Disk" +Neo.Service.Name = "Neo_VPN81" +Neo.Service.DispName = "VPN Client Device Driver - VPN81" +Neo.Service.Desc = "VPN Client Adapter - VPN81" +NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN81" +Neo.EventLog.Name = "Neo" +NetworkAddress = "MAC Address" +DefaultAddress = "000001000001" +MaxSpeed = "Indicate Speed (Mbps)" +KeepLink = "Keep Link" +On = "On" +Off = "Off" + + +; Auto Generated 20180205_163627.079 + diff --git a/src/bin/hamcore/DriverPackages/Neo6_Win10/x64/Neo6_x64_VPN82.inf b/src/bin/hamcore/DriverPackages/Neo6_Win10/x64/Neo6_x64_VPN82.inf index 0beaf591..15c638c2 100644 --- a/src/bin/hamcore/DriverPackages/Neo6_Win10/x64/Neo6_x64_VPN82.inf +++ b/src/bin/hamcore/DriverPackages/Neo6_Win10/x64/Neo6_x64_VPN82.inf @@ -1,114 +1,114 @@ -; VPN Client Device Driver for Windows 2000 and Greater -; -; Copyright (c) SoftEther Corporation. All Rights Reserved. -; http://www.softether.co.jp/ -; -; BUILD 9658 - -[Version] -Signature = "$Windows NT$" -Class = Net -ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} -Provider = %CompanyName% -DriverVer = 02/04/2018, 4.25.0.9658 -CatalogFile.NT = Neo6_x64_VPN82.cat - -[Manufacturer] -%CompanyName% = SoftEther, NTamd64 - -[SourceDisksNames] -1=%DiskDescription%, "", , - -[SourceDisksFiles] -Neo6_x64_VPN82.sys = 1 - -[DestinationDirs] -DefaultDestDir = 12 -Neo.CopyFiles.Sys = 12 - -[Neo.CopyFiles.Sys] -Neo6_x64_VPN82.sys, , , 2 - -[SoftEther.NTamd64] -%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN82 - -[NeoAdapter.Install] -Characteristics = 0x1 -AddReg = Neo.Reg, NeoAdapter.Ndi -CopyFiles = Neo.CopyFiles.Sys -*IfType = 53 -*MediaType = 0 -*PhysicalMediaType = 0 - -[NeoAdapter.Install.Services] -AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% - -[NeoAdapter.Ndi] -HKR, , NetworkAddress, 0, %DefaultAddress% -HKR, Ndi, DeviceID, , "NeoAdapter_VPN82" -HKR, , DevLoader, , ndis -HKR, , DeviceVxDs, , Neo6_x64_VPN82.sys -HKR, NDIS, LogDriverName, , "Neo_VPN82" -HKR, NDIS, MajorNdisVersion, 1, 5 -HKR, NDIS, MinorNdisVersion, 1, 0 -HKR, Ndi\Interfaces, DefUpper, , "ndis5" -HKR, Ndi\Interfaces, UpperRange, , "ndis5" -HKR, Ndi\Interfaces, LowerRange, , "ethernet" -HKR, Ndi\Interfaces, DefLower, , "ethernet" -HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" -HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% -HKR, Ndi\Params\NetworkAddress, type, 0, "edit" -HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" -HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" -HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% -HKR, Ndi\Params\NetworkAddress, optional, 0, "0" -HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% -HKR, Ndi\Params\MaxSpeed, type, 0, "int" -HKR, Ndi\Params\MaxSpeed, default, 0, "100" -HKR, Ndi\Params\MaxSpeed, min, 0, "0" -HKR, Ndi\Params\MaxSpeed, max, 0, "2000" -HKR, Ndi\Params\MaxSpeed, step, 0, "1" -HKR, Ndi\Params\MaxSpeed, Base, 0, "10" -HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% -HKR, Ndi\Params\KeepLink, type, 0, "enum" -HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% -HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% -HKR, Ndi\Params\KeepLink, default, 0, "0" - - -[Neo.Service] -DisplayName = %Neo.Service.DispName% -Description = %Neo.Service.Desc% -ServiceType = 1 -StartType = 3 -ErrorControl = 1 -ServiceBinary = %12%\Neo6_x64_VPN82.sys -LoadOrderGroup = NDIS - -[Neo.Reg] -HKR, Ndi, Service, 0, Neo.Service.Name -HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" -HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" - -[Neo.EventLog] -HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo6_x64_VPN82.sys" -HKR, , TypesSupported, 0x00010001, 7 - -[Strings] -CompanyName = "SoftEther Corporation" -DiskDescription = "VPN Client Device Driver Install Disk" -Neo.Service.Name = "Neo_VPN82" -Neo.Service.DispName = "VPN Client Device Driver - VPN82" -Neo.Service.Desc = "VPN Client Adapter - VPN82" -NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN82" -Neo.EventLog.Name = "Neo" -NetworkAddress = "MAC Address" -DefaultAddress = "000001000001" -MaxSpeed = "Indicate Speed (Mbps)" -KeepLink = "Keep Link" -On = "On" -Off = "Off" - - -; Auto Generated 20180205_163627.150 - +; VPN Client Device Driver for Windows 2000 and Greater +; +; Copyright (c) SoftEther Corporation. All Rights Reserved. +; http://www.softether.co.jp/ +; +; BUILD 9658 + +[Version] +Signature = "$Windows NT$" +Class = Net +ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} +Provider = %CompanyName% +DriverVer = 02/04/2018, 4.25.0.9658 +CatalogFile.NT = Neo6_x64_VPN82.cat + +[Manufacturer] +%CompanyName% = SoftEther, NTamd64 + +[SourceDisksNames] +1=%DiskDescription%, "", , + +[SourceDisksFiles] +Neo6_x64_VPN82.sys = 1 + +[DestinationDirs] +DefaultDestDir = 12 +Neo.CopyFiles.Sys = 12 + +[Neo.CopyFiles.Sys] +Neo6_x64_VPN82.sys, , , 2 + +[SoftEther.NTamd64] +%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN82 + +[NeoAdapter.Install] +Characteristics = 0x1 +AddReg = Neo.Reg, NeoAdapter.Ndi +CopyFiles = Neo.CopyFiles.Sys +*IfType = 53 +*MediaType = 0 +*PhysicalMediaType = 0 + +[NeoAdapter.Install.Services] +AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% + +[NeoAdapter.Ndi] +HKR, , NetworkAddress, 0, %DefaultAddress% +HKR, Ndi, DeviceID, , "NeoAdapter_VPN82" +HKR, , DevLoader, , ndis +HKR, , DeviceVxDs, , Neo6_x64_VPN82.sys +HKR, NDIS, LogDriverName, , "Neo_VPN82" +HKR, NDIS, MajorNdisVersion, 1, 5 +HKR, NDIS, MinorNdisVersion, 1, 0 +HKR, Ndi\Interfaces, DefUpper, , "ndis5" +HKR, Ndi\Interfaces, UpperRange, , "ndis5" +HKR, Ndi\Interfaces, LowerRange, , "ethernet" +HKR, Ndi\Interfaces, DefLower, , "ethernet" +HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" +HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% +HKR, Ndi\Params\NetworkAddress, type, 0, "edit" +HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" +HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" +HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% +HKR, Ndi\Params\NetworkAddress, optional, 0, "0" +HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% +HKR, Ndi\Params\MaxSpeed, type, 0, "int" +HKR, Ndi\Params\MaxSpeed, default, 0, "100" +HKR, Ndi\Params\MaxSpeed, min, 0, "0" +HKR, Ndi\Params\MaxSpeed, max, 0, "2000" +HKR, Ndi\Params\MaxSpeed, step, 0, "1" +HKR, Ndi\Params\MaxSpeed, Base, 0, "10" +HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% +HKR, Ndi\Params\KeepLink, type, 0, "enum" +HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% +HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% +HKR, Ndi\Params\KeepLink, default, 0, "0" + + +[Neo.Service] +DisplayName = %Neo.Service.DispName% +Description = %Neo.Service.Desc% +ServiceType = 1 +StartType = 3 +ErrorControl = 1 +ServiceBinary = %12%\Neo6_x64_VPN82.sys +LoadOrderGroup = NDIS + +[Neo.Reg] +HKR, Ndi, Service, 0, Neo.Service.Name +HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" +HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" + +[Neo.EventLog] +HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo6_x64_VPN82.sys" +HKR, , TypesSupported, 0x00010001, 7 + +[Strings] +CompanyName = "SoftEther Corporation" +DiskDescription = "VPN Client Device Driver Install Disk" +Neo.Service.Name = "Neo_VPN82" +Neo.Service.DispName = "VPN Client Device Driver - VPN82" +Neo.Service.Desc = "VPN Client Adapter - VPN82" +NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN82" +Neo.EventLog.Name = "Neo" +NetworkAddress = "MAC Address" +DefaultAddress = "000001000001" +MaxSpeed = "Indicate Speed (Mbps)" +KeepLink = "Keep Link" +On = "On" +Off = "Off" + + +; Auto Generated 20180205_163627.150 + diff --git a/src/bin/hamcore/DriverPackages/Neo6_Win10/x64/Neo6_x64_VPN83.inf b/src/bin/hamcore/DriverPackages/Neo6_Win10/x64/Neo6_x64_VPN83.inf index 9be648d1..121f939f 100644 --- a/src/bin/hamcore/DriverPackages/Neo6_Win10/x64/Neo6_x64_VPN83.inf +++ b/src/bin/hamcore/DriverPackages/Neo6_Win10/x64/Neo6_x64_VPN83.inf @@ -1,114 +1,114 @@ -; VPN Client Device Driver for Windows 2000 and Greater -; -; Copyright (c) SoftEther Corporation. All Rights Reserved. -; http://www.softether.co.jp/ -; -; BUILD 9658 - -[Version] -Signature = "$Windows NT$" -Class = Net -ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} -Provider = %CompanyName% -DriverVer = 02/04/2018, 4.25.0.9658 -CatalogFile.NT = Neo6_x64_VPN83.cat - -[Manufacturer] -%CompanyName% = SoftEther, NTamd64 - -[SourceDisksNames] -1=%DiskDescription%, "", , - -[SourceDisksFiles] -Neo6_x64_VPN83.sys = 1 - -[DestinationDirs] -DefaultDestDir = 12 -Neo.CopyFiles.Sys = 12 - -[Neo.CopyFiles.Sys] -Neo6_x64_VPN83.sys, , , 2 - -[SoftEther.NTamd64] -%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN83 - -[NeoAdapter.Install] -Characteristics = 0x1 -AddReg = Neo.Reg, NeoAdapter.Ndi -CopyFiles = Neo.CopyFiles.Sys -*IfType = 53 -*MediaType = 0 -*PhysicalMediaType = 0 - -[NeoAdapter.Install.Services] -AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% - -[NeoAdapter.Ndi] -HKR, , NetworkAddress, 0, %DefaultAddress% -HKR, Ndi, DeviceID, , "NeoAdapter_VPN83" -HKR, , DevLoader, , ndis -HKR, , DeviceVxDs, , Neo6_x64_VPN83.sys -HKR, NDIS, LogDriverName, , "Neo_VPN83" -HKR, NDIS, MajorNdisVersion, 1, 5 -HKR, NDIS, MinorNdisVersion, 1, 0 -HKR, Ndi\Interfaces, DefUpper, , "ndis5" -HKR, Ndi\Interfaces, UpperRange, , "ndis5" -HKR, Ndi\Interfaces, LowerRange, , "ethernet" -HKR, Ndi\Interfaces, DefLower, , "ethernet" -HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" -HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% -HKR, Ndi\Params\NetworkAddress, type, 0, "edit" -HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" -HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" -HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% -HKR, Ndi\Params\NetworkAddress, optional, 0, "0" -HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% -HKR, Ndi\Params\MaxSpeed, type, 0, "int" -HKR, Ndi\Params\MaxSpeed, default, 0, "100" -HKR, Ndi\Params\MaxSpeed, min, 0, "0" -HKR, Ndi\Params\MaxSpeed, max, 0, "2000" -HKR, Ndi\Params\MaxSpeed, step, 0, "1" -HKR, Ndi\Params\MaxSpeed, Base, 0, "10" -HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% -HKR, Ndi\Params\KeepLink, type, 0, "enum" -HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% -HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% -HKR, Ndi\Params\KeepLink, default, 0, "0" - - -[Neo.Service] -DisplayName = %Neo.Service.DispName% -Description = %Neo.Service.Desc% -ServiceType = 1 -StartType = 3 -ErrorControl = 1 -ServiceBinary = %12%\Neo6_x64_VPN83.sys -LoadOrderGroup = NDIS - -[Neo.Reg] -HKR, Ndi, Service, 0, Neo.Service.Name -HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" -HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" - -[Neo.EventLog] -HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo6_x64_VPN83.sys" -HKR, , TypesSupported, 0x00010001, 7 - -[Strings] -CompanyName = "SoftEther Corporation" -DiskDescription = "VPN Client Device Driver Install Disk" -Neo.Service.Name = "Neo_VPN83" -Neo.Service.DispName = "VPN Client Device Driver - VPN83" -Neo.Service.Desc = "VPN Client Adapter - VPN83" -NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN83" -Neo.EventLog.Name = "Neo" -NetworkAddress = "MAC Address" -DefaultAddress = "000001000001" -MaxSpeed = "Indicate Speed (Mbps)" -KeepLink = "Keep Link" -On = "On" -Off = "Off" - - -; Auto Generated 20180205_163627.226 - +; VPN Client Device Driver for Windows 2000 and Greater +; +; Copyright (c) SoftEther Corporation. All Rights Reserved. +; http://www.softether.co.jp/ +; +; BUILD 9658 + +[Version] +Signature = "$Windows NT$" +Class = Net +ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} +Provider = %CompanyName% +DriverVer = 02/04/2018, 4.25.0.9658 +CatalogFile.NT = Neo6_x64_VPN83.cat + +[Manufacturer] +%CompanyName% = SoftEther, NTamd64 + +[SourceDisksNames] +1=%DiskDescription%, "", , + +[SourceDisksFiles] +Neo6_x64_VPN83.sys = 1 + +[DestinationDirs] +DefaultDestDir = 12 +Neo.CopyFiles.Sys = 12 + +[Neo.CopyFiles.Sys] +Neo6_x64_VPN83.sys, , , 2 + +[SoftEther.NTamd64] +%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN83 + +[NeoAdapter.Install] +Characteristics = 0x1 +AddReg = Neo.Reg, NeoAdapter.Ndi +CopyFiles = Neo.CopyFiles.Sys +*IfType = 53 +*MediaType = 0 +*PhysicalMediaType = 0 + +[NeoAdapter.Install.Services] +AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% + +[NeoAdapter.Ndi] +HKR, , NetworkAddress, 0, %DefaultAddress% +HKR, Ndi, DeviceID, , "NeoAdapter_VPN83" +HKR, , DevLoader, , ndis +HKR, , DeviceVxDs, , Neo6_x64_VPN83.sys +HKR, NDIS, LogDriverName, , "Neo_VPN83" +HKR, NDIS, MajorNdisVersion, 1, 5 +HKR, NDIS, MinorNdisVersion, 1, 0 +HKR, Ndi\Interfaces, DefUpper, , "ndis5" +HKR, Ndi\Interfaces, UpperRange, , "ndis5" +HKR, Ndi\Interfaces, LowerRange, , "ethernet" +HKR, Ndi\Interfaces, DefLower, , "ethernet" +HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" +HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% +HKR, Ndi\Params\NetworkAddress, type, 0, "edit" +HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" +HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" +HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% +HKR, Ndi\Params\NetworkAddress, optional, 0, "0" +HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% +HKR, Ndi\Params\MaxSpeed, type, 0, "int" +HKR, Ndi\Params\MaxSpeed, default, 0, "100" +HKR, Ndi\Params\MaxSpeed, min, 0, "0" +HKR, Ndi\Params\MaxSpeed, max, 0, "2000" +HKR, Ndi\Params\MaxSpeed, step, 0, "1" +HKR, Ndi\Params\MaxSpeed, Base, 0, "10" +HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% +HKR, Ndi\Params\KeepLink, type, 0, "enum" +HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% +HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% +HKR, Ndi\Params\KeepLink, default, 0, "0" + + +[Neo.Service] +DisplayName = %Neo.Service.DispName% +Description = %Neo.Service.Desc% +ServiceType = 1 +StartType = 3 +ErrorControl = 1 +ServiceBinary = %12%\Neo6_x64_VPN83.sys +LoadOrderGroup = NDIS + +[Neo.Reg] +HKR, Ndi, Service, 0, Neo.Service.Name +HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" +HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" + +[Neo.EventLog] +HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo6_x64_VPN83.sys" +HKR, , TypesSupported, 0x00010001, 7 + +[Strings] +CompanyName = "SoftEther Corporation" +DiskDescription = "VPN Client Device Driver Install Disk" +Neo.Service.Name = "Neo_VPN83" +Neo.Service.DispName = "VPN Client Device Driver - VPN83" +Neo.Service.Desc = "VPN Client Adapter - VPN83" +NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN83" +Neo.EventLog.Name = "Neo" +NetworkAddress = "MAC Address" +DefaultAddress = "000001000001" +MaxSpeed = "Indicate Speed (Mbps)" +KeepLink = "Keep Link" +On = "On" +Off = "Off" + + +; Auto Generated 20180205_163627.226 + diff --git a/src/bin/hamcore/DriverPackages/Neo6_Win10/x64/Neo6_x64_VPN84.inf b/src/bin/hamcore/DriverPackages/Neo6_Win10/x64/Neo6_x64_VPN84.inf index 4d3a0734..12674317 100644 --- a/src/bin/hamcore/DriverPackages/Neo6_Win10/x64/Neo6_x64_VPN84.inf +++ b/src/bin/hamcore/DriverPackages/Neo6_Win10/x64/Neo6_x64_VPN84.inf @@ -1,114 +1,114 @@ -; VPN Client Device Driver for Windows 2000 and Greater -; -; Copyright (c) SoftEther Corporation. All Rights Reserved. -; http://www.softether.co.jp/ -; -; BUILD 9658 - -[Version] -Signature = "$Windows NT$" -Class = Net -ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} -Provider = %CompanyName% -DriverVer = 02/04/2018, 4.25.0.9658 -CatalogFile.NT = Neo6_x64_VPN84.cat - -[Manufacturer] -%CompanyName% = SoftEther, NTamd64 - -[SourceDisksNames] -1=%DiskDescription%, "", , - -[SourceDisksFiles] -Neo6_x64_VPN84.sys = 1 - -[DestinationDirs] -DefaultDestDir = 12 -Neo.CopyFiles.Sys = 12 - -[Neo.CopyFiles.Sys] -Neo6_x64_VPN84.sys, , , 2 - -[SoftEther.NTamd64] -%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN84 - -[NeoAdapter.Install] -Characteristics = 0x1 -AddReg = Neo.Reg, NeoAdapter.Ndi -CopyFiles = Neo.CopyFiles.Sys -*IfType = 53 -*MediaType = 0 -*PhysicalMediaType = 0 - -[NeoAdapter.Install.Services] -AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% - -[NeoAdapter.Ndi] -HKR, , NetworkAddress, 0, %DefaultAddress% -HKR, Ndi, DeviceID, , "NeoAdapter_VPN84" -HKR, , DevLoader, , ndis -HKR, , DeviceVxDs, , Neo6_x64_VPN84.sys -HKR, NDIS, LogDriverName, , "Neo_VPN84" -HKR, NDIS, MajorNdisVersion, 1, 5 -HKR, NDIS, MinorNdisVersion, 1, 0 -HKR, Ndi\Interfaces, DefUpper, , "ndis5" -HKR, Ndi\Interfaces, UpperRange, , "ndis5" -HKR, Ndi\Interfaces, LowerRange, , "ethernet" -HKR, Ndi\Interfaces, DefLower, , "ethernet" -HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" -HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% -HKR, Ndi\Params\NetworkAddress, type, 0, "edit" -HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" -HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" -HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% -HKR, Ndi\Params\NetworkAddress, optional, 0, "0" -HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% -HKR, Ndi\Params\MaxSpeed, type, 0, "int" -HKR, Ndi\Params\MaxSpeed, default, 0, "100" -HKR, Ndi\Params\MaxSpeed, min, 0, "0" -HKR, Ndi\Params\MaxSpeed, max, 0, "2000" -HKR, Ndi\Params\MaxSpeed, step, 0, "1" -HKR, Ndi\Params\MaxSpeed, Base, 0, "10" -HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% -HKR, Ndi\Params\KeepLink, type, 0, "enum" -HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% -HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% -HKR, Ndi\Params\KeepLink, default, 0, "0" - - -[Neo.Service] -DisplayName = %Neo.Service.DispName% -Description = %Neo.Service.Desc% -ServiceType = 1 -StartType = 3 -ErrorControl = 1 -ServiceBinary = %12%\Neo6_x64_VPN84.sys -LoadOrderGroup = NDIS - -[Neo.Reg] -HKR, Ndi, Service, 0, Neo.Service.Name -HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" -HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" - -[Neo.EventLog] -HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo6_x64_VPN84.sys" -HKR, , TypesSupported, 0x00010001, 7 - -[Strings] -CompanyName = "SoftEther Corporation" -DiskDescription = "VPN Client Device Driver Install Disk" -Neo.Service.Name = "Neo_VPN84" -Neo.Service.DispName = "VPN Client Device Driver - VPN84" -Neo.Service.Desc = "VPN Client Adapter - VPN84" -NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN84" -Neo.EventLog.Name = "Neo" -NetworkAddress = "MAC Address" -DefaultAddress = "000001000001" -MaxSpeed = "Indicate Speed (Mbps)" -KeepLink = "Keep Link" -On = "On" -Off = "Off" - - -; Auto Generated 20180205_163627.297 - +; VPN Client Device Driver for Windows 2000 and Greater +; +; Copyright (c) SoftEther Corporation. All Rights Reserved. +; http://www.softether.co.jp/ +; +; BUILD 9658 + +[Version] +Signature = "$Windows NT$" +Class = Net +ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} +Provider = %CompanyName% +DriverVer = 02/04/2018, 4.25.0.9658 +CatalogFile.NT = Neo6_x64_VPN84.cat + +[Manufacturer] +%CompanyName% = SoftEther, NTamd64 + +[SourceDisksNames] +1=%DiskDescription%, "", , + +[SourceDisksFiles] +Neo6_x64_VPN84.sys = 1 + +[DestinationDirs] +DefaultDestDir = 12 +Neo.CopyFiles.Sys = 12 + +[Neo.CopyFiles.Sys] +Neo6_x64_VPN84.sys, , , 2 + +[SoftEther.NTamd64] +%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN84 + +[NeoAdapter.Install] +Characteristics = 0x1 +AddReg = Neo.Reg, NeoAdapter.Ndi +CopyFiles = Neo.CopyFiles.Sys +*IfType = 53 +*MediaType = 0 +*PhysicalMediaType = 0 + +[NeoAdapter.Install.Services] +AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% + +[NeoAdapter.Ndi] +HKR, , NetworkAddress, 0, %DefaultAddress% +HKR, Ndi, DeviceID, , "NeoAdapter_VPN84" +HKR, , DevLoader, , ndis +HKR, , DeviceVxDs, , Neo6_x64_VPN84.sys +HKR, NDIS, LogDriverName, , "Neo_VPN84" +HKR, NDIS, MajorNdisVersion, 1, 5 +HKR, NDIS, MinorNdisVersion, 1, 0 +HKR, Ndi\Interfaces, DefUpper, , "ndis5" +HKR, Ndi\Interfaces, UpperRange, , "ndis5" +HKR, Ndi\Interfaces, LowerRange, , "ethernet" +HKR, Ndi\Interfaces, DefLower, , "ethernet" +HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" +HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% +HKR, Ndi\Params\NetworkAddress, type, 0, "edit" +HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" +HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" +HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% +HKR, Ndi\Params\NetworkAddress, optional, 0, "0" +HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% +HKR, Ndi\Params\MaxSpeed, type, 0, "int" +HKR, Ndi\Params\MaxSpeed, default, 0, "100" +HKR, Ndi\Params\MaxSpeed, min, 0, "0" +HKR, Ndi\Params\MaxSpeed, max, 0, "2000" +HKR, Ndi\Params\MaxSpeed, step, 0, "1" +HKR, Ndi\Params\MaxSpeed, Base, 0, "10" +HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% +HKR, Ndi\Params\KeepLink, type, 0, "enum" +HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% +HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% +HKR, Ndi\Params\KeepLink, default, 0, "0" + + +[Neo.Service] +DisplayName = %Neo.Service.DispName% +Description = %Neo.Service.Desc% +ServiceType = 1 +StartType = 3 +ErrorControl = 1 +ServiceBinary = %12%\Neo6_x64_VPN84.sys +LoadOrderGroup = NDIS + +[Neo.Reg] +HKR, Ndi, Service, 0, Neo.Service.Name +HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" +HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" + +[Neo.EventLog] +HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo6_x64_VPN84.sys" +HKR, , TypesSupported, 0x00010001, 7 + +[Strings] +CompanyName = "SoftEther Corporation" +DiskDescription = "VPN Client Device Driver Install Disk" +Neo.Service.Name = "Neo_VPN84" +Neo.Service.DispName = "VPN Client Device Driver - VPN84" +Neo.Service.Desc = "VPN Client Adapter - VPN84" +NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN84" +Neo.EventLog.Name = "Neo" +NetworkAddress = "MAC Address" +DefaultAddress = "000001000001" +MaxSpeed = "Indicate Speed (Mbps)" +KeepLink = "Keep Link" +On = "On" +Off = "Off" + + +; Auto Generated 20180205_163627.297 + diff --git a/src/bin/hamcore/DriverPackages/Neo6_Win10/x64/Neo6_x64_VPN85.inf b/src/bin/hamcore/DriverPackages/Neo6_Win10/x64/Neo6_x64_VPN85.inf index 5e51f87d..821e7b2a 100644 --- a/src/bin/hamcore/DriverPackages/Neo6_Win10/x64/Neo6_x64_VPN85.inf +++ b/src/bin/hamcore/DriverPackages/Neo6_Win10/x64/Neo6_x64_VPN85.inf @@ -1,114 +1,114 @@ -; VPN Client Device Driver for Windows 2000 and Greater -; -; Copyright (c) SoftEther Corporation. All Rights Reserved. -; http://www.softether.co.jp/ -; -; BUILD 9658 - -[Version] -Signature = "$Windows NT$" -Class = Net -ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} -Provider = %CompanyName% -DriverVer = 02/04/2018, 4.25.0.9658 -CatalogFile.NT = Neo6_x64_VPN85.cat - -[Manufacturer] -%CompanyName% = SoftEther, NTamd64 - -[SourceDisksNames] -1=%DiskDescription%, "", , - -[SourceDisksFiles] -Neo6_x64_VPN85.sys = 1 - -[DestinationDirs] -DefaultDestDir = 12 -Neo.CopyFiles.Sys = 12 - -[Neo.CopyFiles.Sys] -Neo6_x64_VPN85.sys, , , 2 - -[SoftEther.NTamd64] -%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN85 - -[NeoAdapter.Install] -Characteristics = 0x1 -AddReg = Neo.Reg, NeoAdapter.Ndi -CopyFiles = Neo.CopyFiles.Sys -*IfType = 53 -*MediaType = 0 -*PhysicalMediaType = 0 - -[NeoAdapter.Install.Services] -AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% - -[NeoAdapter.Ndi] -HKR, , NetworkAddress, 0, %DefaultAddress% -HKR, Ndi, DeviceID, , "NeoAdapter_VPN85" -HKR, , DevLoader, , ndis -HKR, , DeviceVxDs, , Neo6_x64_VPN85.sys -HKR, NDIS, LogDriverName, , "Neo_VPN85" -HKR, NDIS, MajorNdisVersion, 1, 5 -HKR, NDIS, MinorNdisVersion, 1, 0 -HKR, Ndi\Interfaces, DefUpper, , "ndis5" -HKR, Ndi\Interfaces, UpperRange, , "ndis5" -HKR, Ndi\Interfaces, LowerRange, , "ethernet" -HKR, Ndi\Interfaces, DefLower, , "ethernet" -HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" -HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% -HKR, Ndi\Params\NetworkAddress, type, 0, "edit" -HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" -HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" -HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% -HKR, Ndi\Params\NetworkAddress, optional, 0, "0" -HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% -HKR, Ndi\Params\MaxSpeed, type, 0, "int" -HKR, Ndi\Params\MaxSpeed, default, 0, "100" -HKR, Ndi\Params\MaxSpeed, min, 0, "0" -HKR, Ndi\Params\MaxSpeed, max, 0, "2000" -HKR, Ndi\Params\MaxSpeed, step, 0, "1" -HKR, Ndi\Params\MaxSpeed, Base, 0, "10" -HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% -HKR, Ndi\Params\KeepLink, type, 0, "enum" -HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% -HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% -HKR, Ndi\Params\KeepLink, default, 0, "0" - - -[Neo.Service] -DisplayName = %Neo.Service.DispName% -Description = %Neo.Service.Desc% -ServiceType = 1 -StartType = 3 -ErrorControl = 1 -ServiceBinary = %12%\Neo6_x64_VPN85.sys -LoadOrderGroup = NDIS - -[Neo.Reg] -HKR, Ndi, Service, 0, Neo.Service.Name -HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" -HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" - -[Neo.EventLog] -HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo6_x64_VPN85.sys" -HKR, , TypesSupported, 0x00010001, 7 - -[Strings] -CompanyName = "SoftEther Corporation" -DiskDescription = "VPN Client Device Driver Install Disk" -Neo.Service.Name = "Neo_VPN85" -Neo.Service.DispName = "VPN Client Device Driver - VPN85" -Neo.Service.Desc = "VPN Client Adapter - VPN85" -NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN85" -Neo.EventLog.Name = "Neo" -NetworkAddress = "MAC Address" -DefaultAddress = "000001000001" -MaxSpeed = "Indicate Speed (Mbps)" -KeepLink = "Keep Link" -On = "On" -Off = "Off" - - -; Auto Generated 20180205_163627.368 - +; VPN Client Device Driver for Windows 2000 and Greater +; +; Copyright (c) SoftEther Corporation. All Rights Reserved. +; http://www.softether.co.jp/ +; +; BUILD 9658 + +[Version] +Signature = "$Windows NT$" +Class = Net +ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} +Provider = %CompanyName% +DriverVer = 02/04/2018, 4.25.0.9658 +CatalogFile.NT = Neo6_x64_VPN85.cat + +[Manufacturer] +%CompanyName% = SoftEther, NTamd64 + +[SourceDisksNames] +1=%DiskDescription%, "", , + +[SourceDisksFiles] +Neo6_x64_VPN85.sys = 1 + +[DestinationDirs] +DefaultDestDir = 12 +Neo.CopyFiles.Sys = 12 + +[Neo.CopyFiles.Sys] +Neo6_x64_VPN85.sys, , , 2 + +[SoftEther.NTamd64] +%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN85 + +[NeoAdapter.Install] +Characteristics = 0x1 +AddReg = Neo.Reg, NeoAdapter.Ndi +CopyFiles = Neo.CopyFiles.Sys +*IfType = 53 +*MediaType = 0 +*PhysicalMediaType = 0 + +[NeoAdapter.Install.Services] +AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% + +[NeoAdapter.Ndi] +HKR, , NetworkAddress, 0, %DefaultAddress% +HKR, Ndi, DeviceID, , "NeoAdapter_VPN85" +HKR, , DevLoader, , ndis +HKR, , DeviceVxDs, , Neo6_x64_VPN85.sys +HKR, NDIS, LogDriverName, , "Neo_VPN85" +HKR, NDIS, MajorNdisVersion, 1, 5 +HKR, NDIS, MinorNdisVersion, 1, 0 +HKR, Ndi\Interfaces, DefUpper, , "ndis5" +HKR, Ndi\Interfaces, UpperRange, , "ndis5" +HKR, Ndi\Interfaces, LowerRange, , "ethernet" +HKR, Ndi\Interfaces, DefLower, , "ethernet" +HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" +HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% +HKR, Ndi\Params\NetworkAddress, type, 0, "edit" +HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" +HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" +HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% +HKR, Ndi\Params\NetworkAddress, optional, 0, "0" +HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% +HKR, Ndi\Params\MaxSpeed, type, 0, "int" +HKR, Ndi\Params\MaxSpeed, default, 0, "100" +HKR, Ndi\Params\MaxSpeed, min, 0, "0" +HKR, Ndi\Params\MaxSpeed, max, 0, "2000" +HKR, Ndi\Params\MaxSpeed, step, 0, "1" +HKR, Ndi\Params\MaxSpeed, Base, 0, "10" +HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% +HKR, Ndi\Params\KeepLink, type, 0, "enum" +HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% +HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% +HKR, Ndi\Params\KeepLink, default, 0, "0" + + +[Neo.Service] +DisplayName = %Neo.Service.DispName% +Description = %Neo.Service.Desc% +ServiceType = 1 +StartType = 3 +ErrorControl = 1 +ServiceBinary = %12%\Neo6_x64_VPN85.sys +LoadOrderGroup = NDIS + +[Neo.Reg] +HKR, Ndi, Service, 0, Neo.Service.Name +HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" +HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" + +[Neo.EventLog] +HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo6_x64_VPN85.sys" +HKR, , TypesSupported, 0x00010001, 7 + +[Strings] +CompanyName = "SoftEther Corporation" +DiskDescription = "VPN Client Device Driver Install Disk" +Neo.Service.Name = "Neo_VPN85" +Neo.Service.DispName = "VPN Client Device Driver - VPN85" +Neo.Service.Desc = "VPN Client Adapter - VPN85" +NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN85" +Neo.EventLog.Name = "Neo" +NetworkAddress = "MAC Address" +DefaultAddress = "000001000001" +MaxSpeed = "Indicate Speed (Mbps)" +KeepLink = "Keep Link" +On = "On" +Off = "Off" + + +; Auto Generated 20180205_163627.368 + diff --git a/src/bin/hamcore/DriverPackages/Neo6_Win10/x64/Neo6_x64_VPN86.inf b/src/bin/hamcore/DriverPackages/Neo6_Win10/x64/Neo6_x64_VPN86.inf index b5ae9d2d..3c3b3407 100644 --- a/src/bin/hamcore/DriverPackages/Neo6_Win10/x64/Neo6_x64_VPN86.inf +++ b/src/bin/hamcore/DriverPackages/Neo6_Win10/x64/Neo6_x64_VPN86.inf @@ -1,114 +1,114 @@ -; VPN Client Device Driver for Windows 2000 and Greater -; -; Copyright (c) SoftEther Corporation. All Rights Reserved. -; http://www.softether.co.jp/ -; -; BUILD 9658 - -[Version] -Signature = "$Windows NT$" -Class = Net -ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} -Provider = %CompanyName% -DriverVer = 02/04/2018, 4.25.0.9658 -CatalogFile.NT = Neo6_x64_VPN86.cat - -[Manufacturer] -%CompanyName% = SoftEther, NTamd64 - -[SourceDisksNames] -1=%DiskDescription%, "", , - -[SourceDisksFiles] -Neo6_x64_VPN86.sys = 1 - -[DestinationDirs] -DefaultDestDir = 12 -Neo.CopyFiles.Sys = 12 - -[Neo.CopyFiles.Sys] -Neo6_x64_VPN86.sys, , , 2 - -[SoftEther.NTamd64] -%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN86 - -[NeoAdapter.Install] -Characteristics = 0x1 -AddReg = Neo.Reg, NeoAdapter.Ndi -CopyFiles = Neo.CopyFiles.Sys -*IfType = 53 -*MediaType = 0 -*PhysicalMediaType = 0 - -[NeoAdapter.Install.Services] -AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% - -[NeoAdapter.Ndi] -HKR, , NetworkAddress, 0, %DefaultAddress% -HKR, Ndi, DeviceID, , "NeoAdapter_VPN86" -HKR, , DevLoader, , ndis -HKR, , DeviceVxDs, , Neo6_x64_VPN86.sys -HKR, NDIS, LogDriverName, , "Neo_VPN86" -HKR, NDIS, MajorNdisVersion, 1, 5 -HKR, NDIS, MinorNdisVersion, 1, 0 -HKR, Ndi\Interfaces, DefUpper, , "ndis5" -HKR, Ndi\Interfaces, UpperRange, , "ndis5" -HKR, Ndi\Interfaces, LowerRange, , "ethernet" -HKR, Ndi\Interfaces, DefLower, , "ethernet" -HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" -HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% -HKR, Ndi\Params\NetworkAddress, type, 0, "edit" -HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" -HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" -HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% -HKR, Ndi\Params\NetworkAddress, optional, 0, "0" -HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% -HKR, Ndi\Params\MaxSpeed, type, 0, "int" -HKR, Ndi\Params\MaxSpeed, default, 0, "100" -HKR, Ndi\Params\MaxSpeed, min, 0, "0" -HKR, Ndi\Params\MaxSpeed, max, 0, "2000" -HKR, Ndi\Params\MaxSpeed, step, 0, "1" -HKR, Ndi\Params\MaxSpeed, Base, 0, "10" -HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% -HKR, Ndi\Params\KeepLink, type, 0, "enum" -HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% -HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% -HKR, Ndi\Params\KeepLink, default, 0, "0" - - -[Neo.Service] -DisplayName = %Neo.Service.DispName% -Description = %Neo.Service.Desc% -ServiceType = 1 -StartType = 3 -ErrorControl = 1 -ServiceBinary = %12%\Neo6_x64_VPN86.sys -LoadOrderGroup = NDIS - -[Neo.Reg] -HKR, Ndi, Service, 0, Neo.Service.Name -HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" -HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" - -[Neo.EventLog] -HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo6_x64_VPN86.sys" -HKR, , TypesSupported, 0x00010001, 7 - -[Strings] -CompanyName = "SoftEther Corporation" -DiskDescription = "VPN Client Device Driver Install Disk" -Neo.Service.Name = "Neo_VPN86" -Neo.Service.DispName = "VPN Client Device Driver - VPN86" -Neo.Service.Desc = "VPN Client Adapter - VPN86" -NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN86" -Neo.EventLog.Name = "Neo" -NetworkAddress = "MAC Address" -DefaultAddress = "000001000001" -MaxSpeed = "Indicate Speed (Mbps)" -KeepLink = "Keep Link" -On = "On" -Off = "Off" - - -; Auto Generated 20180205_163627.441 - +; VPN Client Device Driver for Windows 2000 and Greater +; +; Copyright (c) SoftEther Corporation. All Rights Reserved. +; http://www.softether.co.jp/ +; +; BUILD 9658 + +[Version] +Signature = "$Windows NT$" +Class = Net +ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} +Provider = %CompanyName% +DriverVer = 02/04/2018, 4.25.0.9658 +CatalogFile.NT = Neo6_x64_VPN86.cat + +[Manufacturer] +%CompanyName% = SoftEther, NTamd64 + +[SourceDisksNames] +1=%DiskDescription%, "", , + +[SourceDisksFiles] +Neo6_x64_VPN86.sys = 1 + +[DestinationDirs] +DefaultDestDir = 12 +Neo.CopyFiles.Sys = 12 + +[Neo.CopyFiles.Sys] +Neo6_x64_VPN86.sys, , , 2 + +[SoftEther.NTamd64] +%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN86 + +[NeoAdapter.Install] +Characteristics = 0x1 +AddReg = Neo.Reg, NeoAdapter.Ndi +CopyFiles = Neo.CopyFiles.Sys +*IfType = 53 +*MediaType = 0 +*PhysicalMediaType = 0 + +[NeoAdapter.Install.Services] +AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% + +[NeoAdapter.Ndi] +HKR, , NetworkAddress, 0, %DefaultAddress% +HKR, Ndi, DeviceID, , "NeoAdapter_VPN86" +HKR, , DevLoader, , ndis +HKR, , DeviceVxDs, , Neo6_x64_VPN86.sys +HKR, NDIS, LogDriverName, , "Neo_VPN86" +HKR, NDIS, MajorNdisVersion, 1, 5 +HKR, NDIS, MinorNdisVersion, 1, 0 +HKR, Ndi\Interfaces, DefUpper, , "ndis5" +HKR, Ndi\Interfaces, UpperRange, , "ndis5" +HKR, Ndi\Interfaces, LowerRange, , "ethernet" +HKR, Ndi\Interfaces, DefLower, , "ethernet" +HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" +HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% +HKR, Ndi\Params\NetworkAddress, type, 0, "edit" +HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" +HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" +HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% +HKR, Ndi\Params\NetworkAddress, optional, 0, "0" +HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% +HKR, Ndi\Params\MaxSpeed, type, 0, "int" +HKR, Ndi\Params\MaxSpeed, default, 0, "100" +HKR, Ndi\Params\MaxSpeed, min, 0, "0" +HKR, Ndi\Params\MaxSpeed, max, 0, "2000" +HKR, Ndi\Params\MaxSpeed, step, 0, "1" +HKR, Ndi\Params\MaxSpeed, Base, 0, "10" +HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% +HKR, Ndi\Params\KeepLink, type, 0, "enum" +HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% +HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% +HKR, Ndi\Params\KeepLink, default, 0, "0" + + +[Neo.Service] +DisplayName = %Neo.Service.DispName% +Description = %Neo.Service.Desc% +ServiceType = 1 +StartType = 3 +ErrorControl = 1 +ServiceBinary = %12%\Neo6_x64_VPN86.sys +LoadOrderGroup = NDIS + +[Neo.Reg] +HKR, Ndi, Service, 0, Neo.Service.Name +HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" +HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" + +[Neo.EventLog] +HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo6_x64_VPN86.sys" +HKR, , TypesSupported, 0x00010001, 7 + +[Strings] +CompanyName = "SoftEther Corporation" +DiskDescription = "VPN Client Device Driver Install Disk" +Neo.Service.Name = "Neo_VPN86" +Neo.Service.DispName = "VPN Client Device Driver - VPN86" +Neo.Service.Desc = "VPN Client Adapter - VPN86" +NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN86" +Neo.EventLog.Name = "Neo" +NetworkAddress = "MAC Address" +DefaultAddress = "000001000001" +MaxSpeed = "Indicate Speed (Mbps)" +KeepLink = "Keep Link" +On = "On" +Off = "Off" + + +; Auto Generated 20180205_163627.441 + diff --git a/src/bin/hamcore/DriverPackages/Neo6_Win10/x64/Neo6_x64_VPN87.inf b/src/bin/hamcore/DriverPackages/Neo6_Win10/x64/Neo6_x64_VPN87.inf index 89939005..82db43d0 100644 --- a/src/bin/hamcore/DriverPackages/Neo6_Win10/x64/Neo6_x64_VPN87.inf +++ b/src/bin/hamcore/DriverPackages/Neo6_Win10/x64/Neo6_x64_VPN87.inf @@ -1,114 +1,114 @@ -; VPN Client Device Driver for Windows 2000 and Greater -; -; Copyright (c) SoftEther Corporation. All Rights Reserved. -; http://www.softether.co.jp/ -; -; BUILD 9658 - -[Version] -Signature = "$Windows NT$" -Class = Net -ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} -Provider = %CompanyName% -DriverVer = 02/04/2018, 4.25.0.9658 -CatalogFile.NT = Neo6_x64_VPN87.cat - -[Manufacturer] -%CompanyName% = SoftEther, NTamd64 - -[SourceDisksNames] -1=%DiskDescription%, "", , - -[SourceDisksFiles] -Neo6_x64_VPN87.sys = 1 - -[DestinationDirs] -DefaultDestDir = 12 -Neo.CopyFiles.Sys = 12 - -[Neo.CopyFiles.Sys] -Neo6_x64_VPN87.sys, , , 2 - -[SoftEther.NTamd64] -%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN87 - -[NeoAdapter.Install] -Characteristics = 0x1 -AddReg = Neo.Reg, NeoAdapter.Ndi -CopyFiles = Neo.CopyFiles.Sys -*IfType = 53 -*MediaType = 0 -*PhysicalMediaType = 0 - -[NeoAdapter.Install.Services] -AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% - -[NeoAdapter.Ndi] -HKR, , NetworkAddress, 0, %DefaultAddress% -HKR, Ndi, DeviceID, , "NeoAdapter_VPN87" -HKR, , DevLoader, , ndis -HKR, , DeviceVxDs, , Neo6_x64_VPN87.sys -HKR, NDIS, LogDriverName, , "Neo_VPN87" -HKR, NDIS, MajorNdisVersion, 1, 5 -HKR, NDIS, MinorNdisVersion, 1, 0 -HKR, Ndi\Interfaces, DefUpper, , "ndis5" -HKR, Ndi\Interfaces, UpperRange, , "ndis5" -HKR, Ndi\Interfaces, LowerRange, , "ethernet" -HKR, Ndi\Interfaces, DefLower, , "ethernet" -HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" -HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% -HKR, Ndi\Params\NetworkAddress, type, 0, "edit" -HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" -HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" -HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% -HKR, Ndi\Params\NetworkAddress, optional, 0, "0" -HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% -HKR, Ndi\Params\MaxSpeed, type, 0, "int" -HKR, Ndi\Params\MaxSpeed, default, 0, "100" -HKR, Ndi\Params\MaxSpeed, min, 0, "0" -HKR, Ndi\Params\MaxSpeed, max, 0, "2000" -HKR, Ndi\Params\MaxSpeed, step, 0, "1" -HKR, Ndi\Params\MaxSpeed, Base, 0, "10" -HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% -HKR, Ndi\Params\KeepLink, type, 0, "enum" -HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% -HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% -HKR, Ndi\Params\KeepLink, default, 0, "0" - - -[Neo.Service] -DisplayName = %Neo.Service.DispName% -Description = %Neo.Service.Desc% -ServiceType = 1 -StartType = 3 -ErrorControl = 1 -ServiceBinary = %12%\Neo6_x64_VPN87.sys -LoadOrderGroup = NDIS - -[Neo.Reg] -HKR, Ndi, Service, 0, Neo.Service.Name -HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" -HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" - -[Neo.EventLog] -HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo6_x64_VPN87.sys" -HKR, , TypesSupported, 0x00010001, 7 - -[Strings] -CompanyName = "SoftEther Corporation" -DiskDescription = "VPN Client Device Driver Install Disk" -Neo.Service.Name = "Neo_VPN87" -Neo.Service.DispName = "VPN Client Device Driver - VPN87" -Neo.Service.Desc = "VPN Client Adapter - VPN87" -NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN87" -Neo.EventLog.Name = "Neo" -NetworkAddress = "MAC Address" -DefaultAddress = "000001000001" -MaxSpeed = "Indicate Speed (Mbps)" -KeepLink = "Keep Link" -On = "On" -Off = "Off" - - -; Auto Generated 20180205_163627.511 - +; VPN Client Device Driver for Windows 2000 and Greater +; +; Copyright (c) SoftEther Corporation. All Rights Reserved. +; http://www.softether.co.jp/ +; +; BUILD 9658 + +[Version] +Signature = "$Windows NT$" +Class = Net +ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} +Provider = %CompanyName% +DriverVer = 02/04/2018, 4.25.0.9658 +CatalogFile.NT = Neo6_x64_VPN87.cat + +[Manufacturer] +%CompanyName% = SoftEther, NTamd64 + +[SourceDisksNames] +1=%DiskDescription%, "", , + +[SourceDisksFiles] +Neo6_x64_VPN87.sys = 1 + +[DestinationDirs] +DefaultDestDir = 12 +Neo.CopyFiles.Sys = 12 + +[Neo.CopyFiles.Sys] +Neo6_x64_VPN87.sys, , , 2 + +[SoftEther.NTamd64] +%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN87 + +[NeoAdapter.Install] +Characteristics = 0x1 +AddReg = Neo.Reg, NeoAdapter.Ndi +CopyFiles = Neo.CopyFiles.Sys +*IfType = 53 +*MediaType = 0 +*PhysicalMediaType = 0 + +[NeoAdapter.Install.Services] +AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% + +[NeoAdapter.Ndi] +HKR, , NetworkAddress, 0, %DefaultAddress% +HKR, Ndi, DeviceID, , "NeoAdapter_VPN87" +HKR, , DevLoader, , ndis +HKR, , DeviceVxDs, , Neo6_x64_VPN87.sys +HKR, NDIS, LogDriverName, , "Neo_VPN87" +HKR, NDIS, MajorNdisVersion, 1, 5 +HKR, NDIS, MinorNdisVersion, 1, 0 +HKR, Ndi\Interfaces, DefUpper, , "ndis5" +HKR, Ndi\Interfaces, UpperRange, , "ndis5" +HKR, Ndi\Interfaces, LowerRange, , "ethernet" +HKR, Ndi\Interfaces, DefLower, , "ethernet" +HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" +HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% +HKR, Ndi\Params\NetworkAddress, type, 0, "edit" +HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" +HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" +HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% +HKR, Ndi\Params\NetworkAddress, optional, 0, "0" +HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% +HKR, Ndi\Params\MaxSpeed, type, 0, "int" +HKR, Ndi\Params\MaxSpeed, default, 0, "100" +HKR, Ndi\Params\MaxSpeed, min, 0, "0" +HKR, Ndi\Params\MaxSpeed, max, 0, "2000" +HKR, Ndi\Params\MaxSpeed, step, 0, "1" +HKR, Ndi\Params\MaxSpeed, Base, 0, "10" +HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% +HKR, Ndi\Params\KeepLink, type, 0, "enum" +HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% +HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% +HKR, Ndi\Params\KeepLink, default, 0, "0" + + +[Neo.Service] +DisplayName = %Neo.Service.DispName% +Description = %Neo.Service.Desc% +ServiceType = 1 +StartType = 3 +ErrorControl = 1 +ServiceBinary = %12%\Neo6_x64_VPN87.sys +LoadOrderGroup = NDIS + +[Neo.Reg] +HKR, Ndi, Service, 0, Neo.Service.Name +HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" +HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" + +[Neo.EventLog] +HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo6_x64_VPN87.sys" +HKR, , TypesSupported, 0x00010001, 7 + +[Strings] +CompanyName = "SoftEther Corporation" +DiskDescription = "VPN Client Device Driver Install Disk" +Neo.Service.Name = "Neo_VPN87" +Neo.Service.DispName = "VPN Client Device Driver - VPN87" +Neo.Service.Desc = "VPN Client Adapter - VPN87" +NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN87" +Neo.EventLog.Name = "Neo" +NetworkAddress = "MAC Address" +DefaultAddress = "000001000001" +MaxSpeed = "Indicate Speed (Mbps)" +KeepLink = "Keep Link" +On = "On" +Off = "Off" + + +; Auto Generated 20180205_163627.511 + diff --git a/src/bin/hamcore/DriverPackages/Neo6_Win10/x64/Neo6_x64_VPN88.inf b/src/bin/hamcore/DriverPackages/Neo6_Win10/x64/Neo6_x64_VPN88.inf index 56b66b47..3674b60c 100644 --- a/src/bin/hamcore/DriverPackages/Neo6_Win10/x64/Neo6_x64_VPN88.inf +++ b/src/bin/hamcore/DriverPackages/Neo6_Win10/x64/Neo6_x64_VPN88.inf @@ -1,114 +1,114 @@ -; VPN Client Device Driver for Windows 2000 and Greater -; -; Copyright (c) SoftEther Corporation. All Rights Reserved. -; http://www.softether.co.jp/ -; -; BUILD 9658 - -[Version] -Signature = "$Windows NT$" -Class = Net -ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} -Provider = %CompanyName% -DriverVer = 02/04/2018, 4.25.0.9658 -CatalogFile.NT = Neo6_x64_VPN88.cat - -[Manufacturer] -%CompanyName% = SoftEther, NTamd64 - -[SourceDisksNames] -1=%DiskDescription%, "", , - -[SourceDisksFiles] -Neo6_x64_VPN88.sys = 1 - -[DestinationDirs] -DefaultDestDir = 12 -Neo.CopyFiles.Sys = 12 - -[Neo.CopyFiles.Sys] -Neo6_x64_VPN88.sys, , , 2 - -[SoftEther.NTamd64] -%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN88 - -[NeoAdapter.Install] -Characteristics = 0x1 -AddReg = Neo.Reg, NeoAdapter.Ndi -CopyFiles = Neo.CopyFiles.Sys -*IfType = 53 -*MediaType = 0 -*PhysicalMediaType = 0 - -[NeoAdapter.Install.Services] -AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% - -[NeoAdapter.Ndi] -HKR, , NetworkAddress, 0, %DefaultAddress% -HKR, Ndi, DeviceID, , "NeoAdapter_VPN88" -HKR, , DevLoader, , ndis -HKR, , DeviceVxDs, , Neo6_x64_VPN88.sys -HKR, NDIS, LogDriverName, , "Neo_VPN88" -HKR, NDIS, MajorNdisVersion, 1, 5 -HKR, NDIS, MinorNdisVersion, 1, 0 -HKR, Ndi\Interfaces, DefUpper, , "ndis5" -HKR, Ndi\Interfaces, UpperRange, , "ndis5" -HKR, Ndi\Interfaces, LowerRange, , "ethernet" -HKR, Ndi\Interfaces, DefLower, , "ethernet" -HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" -HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% -HKR, Ndi\Params\NetworkAddress, type, 0, "edit" -HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" -HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" -HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% -HKR, Ndi\Params\NetworkAddress, optional, 0, "0" -HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% -HKR, Ndi\Params\MaxSpeed, type, 0, "int" -HKR, Ndi\Params\MaxSpeed, default, 0, "100" -HKR, Ndi\Params\MaxSpeed, min, 0, "0" -HKR, Ndi\Params\MaxSpeed, max, 0, "2000" -HKR, Ndi\Params\MaxSpeed, step, 0, "1" -HKR, Ndi\Params\MaxSpeed, Base, 0, "10" -HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% -HKR, Ndi\Params\KeepLink, type, 0, "enum" -HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% -HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% -HKR, Ndi\Params\KeepLink, default, 0, "0" - - -[Neo.Service] -DisplayName = %Neo.Service.DispName% -Description = %Neo.Service.Desc% -ServiceType = 1 -StartType = 3 -ErrorControl = 1 -ServiceBinary = %12%\Neo6_x64_VPN88.sys -LoadOrderGroup = NDIS - -[Neo.Reg] -HKR, Ndi, Service, 0, Neo.Service.Name -HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" -HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" - -[Neo.EventLog] -HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo6_x64_VPN88.sys" -HKR, , TypesSupported, 0x00010001, 7 - -[Strings] -CompanyName = "SoftEther Corporation" -DiskDescription = "VPN Client Device Driver Install Disk" -Neo.Service.Name = "Neo_VPN88" -Neo.Service.DispName = "VPN Client Device Driver - VPN88" -Neo.Service.Desc = "VPN Client Adapter - VPN88" -NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN88" -Neo.EventLog.Name = "Neo" -NetworkAddress = "MAC Address" -DefaultAddress = "000001000001" -MaxSpeed = "Indicate Speed (Mbps)" -KeepLink = "Keep Link" -On = "On" -Off = "Off" - - -; Auto Generated 20180205_163627.584 - +; VPN Client Device Driver for Windows 2000 and Greater +; +; Copyright (c) SoftEther Corporation. All Rights Reserved. +; http://www.softether.co.jp/ +; +; BUILD 9658 + +[Version] +Signature = "$Windows NT$" +Class = Net +ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} +Provider = %CompanyName% +DriverVer = 02/04/2018, 4.25.0.9658 +CatalogFile.NT = Neo6_x64_VPN88.cat + +[Manufacturer] +%CompanyName% = SoftEther, NTamd64 + +[SourceDisksNames] +1=%DiskDescription%, "", , + +[SourceDisksFiles] +Neo6_x64_VPN88.sys = 1 + +[DestinationDirs] +DefaultDestDir = 12 +Neo.CopyFiles.Sys = 12 + +[Neo.CopyFiles.Sys] +Neo6_x64_VPN88.sys, , , 2 + +[SoftEther.NTamd64] +%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN88 + +[NeoAdapter.Install] +Characteristics = 0x1 +AddReg = Neo.Reg, NeoAdapter.Ndi +CopyFiles = Neo.CopyFiles.Sys +*IfType = 53 +*MediaType = 0 +*PhysicalMediaType = 0 + +[NeoAdapter.Install.Services] +AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% + +[NeoAdapter.Ndi] +HKR, , NetworkAddress, 0, %DefaultAddress% +HKR, Ndi, DeviceID, , "NeoAdapter_VPN88" +HKR, , DevLoader, , ndis +HKR, , DeviceVxDs, , Neo6_x64_VPN88.sys +HKR, NDIS, LogDriverName, , "Neo_VPN88" +HKR, NDIS, MajorNdisVersion, 1, 5 +HKR, NDIS, MinorNdisVersion, 1, 0 +HKR, Ndi\Interfaces, DefUpper, , "ndis5" +HKR, Ndi\Interfaces, UpperRange, , "ndis5" +HKR, Ndi\Interfaces, LowerRange, , "ethernet" +HKR, Ndi\Interfaces, DefLower, , "ethernet" +HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" +HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% +HKR, Ndi\Params\NetworkAddress, type, 0, "edit" +HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" +HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" +HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% +HKR, Ndi\Params\NetworkAddress, optional, 0, "0" +HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% +HKR, Ndi\Params\MaxSpeed, type, 0, "int" +HKR, Ndi\Params\MaxSpeed, default, 0, "100" +HKR, Ndi\Params\MaxSpeed, min, 0, "0" +HKR, Ndi\Params\MaxSpeed, max, 0, "2000" +HKR, Ndi\Params\MaxSpeed, step, 0, "1" +HKR, Ndi\Params\MaxSpeed, Base, 0, "10" +HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% +HKR, Ndi\Params\KeepLink, type, 0, "enum" +HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% +HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% +HKR, Ndi\Params\KeepLink, default, 0, "0" + + +[Neo.Service] +DisplayName = %Neo.Service.DispName% +Description = %Neo.Service.Desc% +ServiceType = 1 +StartType = 3 +ErrorControl = 1 +ServiceBinary = %12%\Neo6_x64_VPN88.sys +LoadOrderGroup = NDIS + +[Neo.Reg] +HKR, Ndi, Service, 0, Neo.Service.Name +HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" +HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" + +[Neo.EventLog] +HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo6_x64_VPN88.sys" +HKR, , TypesSupported, 0x00010001, 7 + +[Strings] +CompanyName = "SoftEther Corporation" +DiskDescription = "VPN Client Device Driver Install Disk" +Neo.Service.Name = "Neo_VPN88" +Neo.Service.DispName = "VPN Client Device Driver - VPN88" +Neo.Service.Desc = "VPN Client Adapter - VPN88" +NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN88" +Neo.EventLog.Name = "Neo" +NetworkAddress = "MAC Address" +DefaultAddress = "000001000001" +MaxSpeed = "Indicate Speed (Mbps)" +KeepLink = "Keep Link" +On = "On" +Off = "Off" + + +; Auto Generated 20180205_163627.584 + diff --git a/src/bin/hamcore/DriverPackages/Neo6_Win10/x64/Neo6_x64_VPN89.inf b/src/bin/hamcore/DriverPackages/Neo6_Win10/x64/Neo6_x64_VPN89.inf index b95fa8c6..cad57b7a 100644 --- a/src/bin/hamcore/DriverPackages/Neo6_Win10/x64/Neo6_x64_VPN89.inf +++ b/src/bin/hamcore/DriverPackages/Neo6_Win10/x64/Neo6_x64_VPN89.inf @@ -1,114 +1,114 @@ -; VPN Client Device Driver for Windows 2000 and Greater -; -; Copyright (c) SoftEther Corporation. All Rights Reserved. -; http://www.softether.co.jp/ -; -; BUILD 9658 - -[Version] -Signature = "$Windows NT$" -Class = Net -ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} -Provider = %CompanyName% -DriverVer = 02/04/2018, 4.25.0.9658 -CatalogFile.NT = Neo6_x64_VPN89.cat - -[Manufacturer] -%CompanyName% = SoftEther, NTamd64 - -[SourceDisksNames] -1=%DiskDescription%, "", , - -[SourceDisksFiles] -Neo6_x64_VPN89.sys = 1 - -[DestinationDirs] -DefaultDestDir = 12 -Neo.CopyFiles.Sys = 12 - -[Neo.CopyFiles.Sys] -Neo6_x64_VPN89.sys, , , 2 - -[SoftEther.NTamd64] -%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN89 - -[NeoAdapter.Install] -Characteristics = 0x1 -AddReg = Neo.Reg, NeoAdapter.Ndi -CopyFiles = Neo.CopyFiles.Sys -*IfType = 53 -*MediaType = 0 -*PhysicalMediaType = 0 - -[NeoAdapter.Install.Services] -AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% - -[NeoAdapter.Ndi] -HKR, , NetworkAddress, 0, %DefaultAddress% -HKR, Ndi, DeviceID, , "NeoAdapter_VPN89" -HKR, , DevLoader, , ndis -HKR, , DeviceVxDs, , Neo6_x64_VPN89.sys -HKR, NDIS, LogDriverName, , "Neo_VPN89" -HKR, NDIS, MajorNdisVersion, 1, 5 -HKR, NDIS, MinorNdisVersion, 1, 0 -HKR, Ndi\Interfaces, DefUpper, , "ndis5" -HKR, Ndi\Interfaces, UpperRange, , "ndis5" -HKR, Ndi\Interfaces, LowerRange, , "ethernet" -HKR, Ndi\Interfaces, DefLower, , "ethernet" -HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" -HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% -HKR, Ndi\Params\NetworkAddress, type, 0, "edit" -HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" -HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" -HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% -HKR, Ndi\Params\NetworkAddress, optional, 0, "0" -HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% -HKR, Ndi\Params\MaxSpeed, type, 0, "int" -HKR, Ndi\Params\MaxSpeed, default, 0, "100" -HKR, Ndi\Params\MaxSpeed, min, 0, "0" -HKR, Ndi\Params\MaxSpeed, max, 0, "2000" -HKR, Ndi\Params\MaxSpeed, step, 0, "1" -HKR, Ndi\Params\MaxSpeed, Base, 0, "10" -HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% -HKR, Ndi\Params\KeepLink, type, 0, "enum" -HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% -HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% -HKR, Ndi\Params\KeepLink, default, 0, "0" - - -[Neo.Service] -DisplayName = %Neo.Service.DispName% -Description = %Neo.Service.Desc% -ServiceType = 1 -StartType = 3 -ErrorControl = 1 -ServiceBinary = %12%\Neo6_x64_VPN89.sys -LoadOrderGroup = NDIS - -[Neo.Reg] -HKR, Ndi, Service, 0, Neo.Service.Name -HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" -HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" - -[Neo.EventLog] -HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo6_x64_VPN89.sys" -HKR, , TypesSupported, 0x00010001, 7 - -[Strings] -CompanyName = "SoftEther Corporation" -DiskDescription = "VPN Client Device Driver Install Disk" -Neo.Service.Name = "Neo_VPN89" -Neo.Service.DispName = "VPN Client Device Driver - VPN89" -Neo.Service.Desc = "VPN Client Adapter - VPN89" -NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN89" -Neo.EventLog.Name = "Neo" -NetworkAddress = "MAC Address" -DefaultAddress = "000001000001" -MaxSpeed = "Indicate Speed (Mbps)" -KeepLink = "Keep Link" -On = "On" -Off = "Off" - - -; Auto Generated 20180205_163627.655 - +; VPN Client Device Driver for Windows 2000 and Greater +; +; Copyright (c) SoftEther Corporation. All Rights Reserved. +; http://www.softether.co.jp/ +; +; BUILD 9658 + +[Version] +Signature = "$Windows NT$" +Class = Net +ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} +Provider = %CompanyName% +DriverVer = 02/04/2018, 4.25.0.9658 +CatalogFile.NT = Neo6_x64_VPN89.cat + +[Manufacturer] +%CompanyName% = SoftEther, NTamd64 + +[SourceDisksNames] +1=%DiskDescription%, "", , + +[SourceDisksFiles] +Neo6_x64_VPN89.sys = 1 + +[DestinationDirs] +DefaultDestDir = 12 +Neo.CopyFiles.Sys = 12 + +[Neo.CopyFiles.Sys] +Neo6_x64_VPN89.sys, , , 2 + +[SoftEther.NTamd64] +%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN89 + +[NeoAdapter.Install] +Characteristics = 0x1 +AddReg = Neo.Reg, NeoAdapter.Ndi +CopyFiles = Neo.CopyFiles.Sys +*IfType = 53 +*MediaType = 0 +*PhysicalMediaType = 0 + +[NeoAdapter.Install.Services] +AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% + +[NeoAdapter.Ndi] +HKR, , NetworkAddress, 0, %DefaultAddress% +HKR, Ndi, DeviceID, , "NeoAdapter_VPN89" +HKR, , DevLoader, , ndis +HKR, , DeviceVxDs, , Neo6_x64_VPN89.sys +HKR, NDIS, LogDriverName, , "Neo_VPN89" +HKR, NDIS, MajorNdisVersion, 1, 5 +HKR, NDIS, MinorNdisVersion, 1, 0 +HKR, Ndi\Interfaces, DefUpper, , "ndis5" +HKR, Ndi\Interfaces, UpperRange, , "ndis5" +HKR, Ndi\Interfaces, LowerRange, , "ethernet" +HKR, Ndi\Interfaces, DefLower, , "ethernet" +HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" +HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% +HKR, Ndi\Params\NetworkAddress, type, 0, "edit" +HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" +HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" +HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% +HKR, Ndi\Params\NetworkAddress, optional, 0, "0" +HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% +HKR, Ndi\Params\MaxSpeed, type, 0, "int" +HKR, Ndi\Params\MaxSpeed, default, 0, "100" +HKR, Ndi\Params\MaxSpeed, min, 0, "0" +HKR, Ndi\Params\MaxSpeed, max, 0, "2000" +HKR, Ndi\Params\MaxSpeed, step, 0, "1" +HKR, Ndi\Params\MaxSpeed, Base, 0, "10" +HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% +HKR, Ndi\Params\KeepLink, type, 0, "enum" +HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% +HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% +HKR, Ndi\Params\KeepLink, default, 0, "0" + + +[Neo.Service] +DisplayName = %Neo.Service.DispName% +Description = %Neo.Service.Desc% +ServiceType = 1 +StartType = 3 +ErrorControl = 1 +ServiceBinary = %12%\Neo6_x64_VPN89.sys +LoadOrderGroup = NDIS + +[Neo.Reg] +HKR, Ndi, Service, 0, Neo.Service.Name +HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" +HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" + +[Neo.EventLog] +HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo6_x64_VPN89.sys" +HKR, , TypesSupported, 0x00010001, 7 + +[Strings] +CompanyName = "SoftEther Corporation" +DiskDescription = "VPN Client Device Driver Install Disk" +Neo.Service.Name = "Neo_VPN89" +Neo.Service.DispName = "VPN Client Device Driver - VPN89" +Neo.Service.Desc = "VPN Client Adapter - VPN89" +NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN89" +Neo.EventLog.Name = "Neo" +NetworkAddress = "MAC Address" +DefaultAddress = "000001000001" +MaxSpeed = "Indicate Speed (Mbps)" +KeepLink = "Keep Link" +On = "On" +Off = "Off" + + +; Auto Generated 20180205_163627.655 + diff --git a/src/bin/hamcore/DriverPackages/Neo6_Win10/x64/Neo6_x64_VPN9.inf b/src/bin/hamcore/DriverPackages/Neo6_Win10/x64/Neo6_x64_VPN9.inf index 1de695fa..11ad4612 100644 --- a/src/bin/hamcore/DriverPackages/Neo6_Win10/x64/Neo6_x64_VPN9.inf +++ b/src/bin/hamcore/DriverPackages/Neo6_Win10/x64/Neo6_x64_VPN9.inf @@ -1,114 +1,114 @@ -; VPN Client Device Driver for Windows 2000 and Greater -; -; Copyright (c) SoftEther Corporation. All Rights Reserved. -; http://www.softether.co.jp/ -; -; BUILD 9658 - -[Version] -Signature = "$Windows NT$" -Class = Net -ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} -Provider = %CompanyName% -DriverVer = 02/04/2018, 4.25.0.9658 -CatalogFile.NT = Neo6_x64_VPN9.cat - -[Manufacturer] -%CompanyName% = SoftEther, NTamd64 - -[SourceDisksNames] -1=%DiskDescription%, "", , - -[SourceDisksFiles] -Neo6_x64_VPN9.sys = 1 - -[DestinationDirs] -DefaultDestDir = 12 -Neo.CopyFiles.Sys = 12 - -[Neo.CopyFiles.Sys] -Neo6_x64_VPN9.sys, , , 2 - -[SoftEther.NTamd64] -%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN9 - -[NeoAdapter.Install] -Characteristics = 0x1 -AddReg = Neo.Reg, NeoAdapter.Ndi -CopyFiles = Neo.CopyFiles.Sys -*IfType = 53 -*MediaType = 0 -*PhysicalMediaType = 0 - -[NeoAdapter.Install.Services] -AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% - -[NeoAdapter.Ndi] -HKR, , NetworkAddress, 0, %DefaultAddress% -HKR, Ndi, DeviceID, , "NeoAdapter_VPN9" -HKR, , DevLoader, , ndis -HKR, , DeviceVxDs, , Neo6_x64_VPN9.sys -HKR, NDIS, LogDriverName, , "Neo_VPN9" -HKR, NDIS, MajorNdisVersion, 1, 5 -HKR, NDIS, MinorNdisVersion, 1, 0 -HKR, Ndi\Interfaces, DefUpper, , "ndis5" -HKR, Ndi\Interfaces, UpperRange, , "ndis5" -HKR, Ndi\Interfaces, LowerRange, , "ethernet" -HKR, Ndi\Interfaces, DefLower, , "ethernet" -HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" -HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% -HKR, Ndi\Params\NetworkAddress, type, 0, "edit" -HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" -HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" -HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% -HKR, Ndi\Params\NetworkAddress, optional, 0, "0" -HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% -HKR, Ndi\Params\MaxSpeed, type, 0, "int" -HKR, Ndi\Params\MaxSpeed, default, 0, "100" -HKR, Ndi\Params\MaxSpeed, min, 0, "0" -HKR, Ndi\Params\MaxSpeed, max, 0, "2000" -HKR, Ndi\Params\MaxSpeed, step, 0, "1" -HKR, Ndi\Params\MaxSpeed, Base, 0, "10" -HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% -HKR, Ndi\Params\KeepLink, type, 0, "enum" -HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% -HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% -HKR, Ndi\Params\KeepLink, default, 0, "0" - - -[Neo.Service] -DisplayName = %Neo.Service.DispName% -Description = %Neo.Service.Desc% -ServiceType = 1 -StartType = 3 -ErrorControl = 1 -ServiceBinary = %12%\Neo6_x64_VPN9.sys -LoadOrderGroup = NDIS - -[Neo.Reg] -HKR, Ndi, Service, 0, Neo.Service.Name -HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" -HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" - -[Neo.EventLog] -HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo6_x64_VPN9.sys" -HKR, , TypesSupported, 0x00010001, 7 - -[Strings] -CompanyName = "SoftEther Corporation" -DiskDescription = "VPN Client Device Driver Install Disk" -Neo.Service.Name = "Neo_VPN9" -Neo.Service.DispName = "VPN Client Device Driver - VPN9" -Neo.Service.Desc = "VPN Client Adapter - VPN9" -NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN9" -Neo.EventLog.Name = "Neo" -NetworkAddress = "MAC Address" -DefaultAddress = "000001000001" -MaxSpeed = "Indicate Speed (Mbps)" -KeepLink = "Keep Link" -On = "On" -Off = "Off" - - -; Auto Generated 20180205_163621.956 - +; VPN Client Device Driver for Windows 2000 and Greater +; +; Copyright (c) SoftEther Corporation. All Rights Reserved. +; http://www.softether.co.jp/ +; +; BUILD 9658 + +[Version] +Signature = "$Windows NT$" +Class = Net +ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} +Provider = %CompanyName% +DriverVer = 02/04/2018, 4.25.0.9658 +CatalogFile.NT = Neo6_x64_VPN9.cat + +[Manufacturer] +%CompanyName% = SoftEther, NTamd64 + +[SourceDisksNames] +1=%DiskDescription%, "", , + +[SourceDisksFiles] +Neo6_x64_VPN9.sys = 1 + +[DestinationDirs] +DefaultDestDir = 12 +Neo.CopyFiles.Sys = 12 + +[Neo.CopyFiles.Sys] +Neo6_x64_VPN9.sys, , , 2 + +[SoftEther.NTamd64] +%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN9 + +[NeoAdapter.Install] +Characteristics = 0x1 +AddReg = Neo.Reg, NeoAdapter.Ndi +CopyFiles = Neo.CopyFiles.Sys +*IfType = 53 +*MediaType = 0 +*PhysicalMediaType = 0 + +[NeoAdapter.Install.Services] +AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% + +[NeoAdapter.Ndi] +HKR, , NetworkAddress, 0, %DefaultAddress% +HKR, Ndi, DeviceID, , "NeoAdapter_VPN9" +HKR, , DevLoader, , ndis +HKR, , DeviceVxDs, , Neo6_x64_VPN9.sys +HKR, NDIS, LogDriverName, , "Neo_VPN9" +HKR, NDIS, MajorNdisVersion, 1, 5 +HKR, NDIS, MinorNdisVersion, 1, 0 +HKR, Ndi\Interfaces, DefUpper, , "ndis5" +HKR, Ndi\Interfaces, UpperRange, , "ndis5" +HKR, Ndi\Interfaces, LowerRange, , "ethernet" +HKR, Ndi\Interfaces, DefLower, , "ethernet" +HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" +HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% +HKR, Ndi\Params\NetworkAddress, type, 0, "edit" +HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" +HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" +HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% +HKR, Ndi\Params\NetworkAddress, optional, 0, "0" +HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% +HKR, Ndi\Params\MaxSpeed, type, 0, "int" +HKR, Ndi\Params\MaxSpeed, default, 0, "100" +HKR, Ndi\Params\MaxSpeed, min, 0, "0" +HKR, Ndi\Params\MaxSpeed, max, 0, "2000" +HKR, Ndi\Params\MaxSpeed, step, 0, "1" +HKR, Ndi\Params\MaxSpeed, Base, 0, "10" +HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% +HKR, Ndi\Params\KeepLink, type, 0, "enum" +HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% +HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% +HKR, Ndi\Params\KeepLink, default, 0, "0" + + +[Neo.Service] +DisplayName = %Neo.Service.DispName% +Description = %Neo.Service.Desc% +ServiceType = 1 +StartType = 3 +ErrorControl = 1 +ServiceBinary = %12%\Neo6_x64_VPN9.sys +LoadOrderGroup = NDIS + +[Neo.Reg] +HKR, Ndi, Service, 0, Neo.Service.Name +HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" +HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" + +[Neo.EventLog] +HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo6_x64_VPN9.sys" +HKR, , TypesSupported, 0x00010001, 7 + +[Strings] +CompanyName = "SoftEther Corporation" +DiskDescription = "VPN Client Device Driver Install Disk" +Neo.Service.Name = "Neo_VPN9" +Neo.Service.DispName = "VPN Client Device Driver - VPN9" +Neo.Service.Desc = "VPN Client Adapter - VPN9" +NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN9" +Neo.EventLog.Name = "Neo" +NetworkAddress = "MAC Address" +DefaultAddress = "000001000001" +MaxSpeed = "Indicate Speed (Mbps)" +KeepLink = "Keep Link" +On = "On" +Off = "Off" + + +; Auto Generated 20180205_163621.956 + diff --git a/src/bin/hamcore/DriverPackages/Neo6_Win10/x64/Neo6_x64_VPN90.inf b/src/bin/hamcore/DriverPackages/Neo6_Win10/x64/Neo6_x64_VPN90.inf index 85285d61..e088079e 100644 --- a/src/bin/hamcore/DriverPackages/Neo6_Win10/x64/Neo6_x64_VPN90.inf +++ b/src/bin/hamcore/DriverPackages/Neo6_Win10/x64/Neo6_x64_VPN90.inf @@ -1,114 +1,114 @@ -; VPN Client Device Driver for Windows 2000 and Greater -; -; Copyright (c) SoftEther Corporation. All Rights Reserved. -; http://www.softether.co.jp/ -; -; BUILD 9658 - -[Version] -Signature = "$Windows NT$" -Class = Net -ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} -Provider = %CompanyName% -DriverVer = 02/04/2018, 4.25.0.9658 -CatalogFile.NT = Neo6_x64_VPN90.cat - -[Manufacturer] -%CompanyName% = SoftEther, NTamd64 - -[SourceDisksNames] -1=%DiskDescription%, "", , - -[SourceDisksFiles] -Neo6_x64_VPN90.sys = 1 - -[DestinationDirs] -DefaultDestDir = 12 -Neo.CopyFiles.Sys = 12 - -[Neo.CopyFiles.Sys] -Neo6_x64_VPN90.sys, , , 2 - -[SoftEther.NTamd64] -%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN90 - -[NeoAdapter.Install] -Characteristics = 0x1 -AddReg = Neo.Reg, NeoAdapter.Ndi -CopyFiles = Neo.CopyFiles.Sys -*IfType = 53 -*MediaType = 0 -*PhysicalMediaType = 0 - -[NeoAdapter.Install.Services] -AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% - -[NeoAdapter.Ndi] -HKR, , NetworkAddress, 0, %DefaultAddress% -HKR, Ndi, DeviceID, , "NeoAdapter_VPN90" -HKR, , DevLoader, , ndis -HKR, , DeviceVxDs, , Neo6_x64_VPN90.sys -HKR, NDIS, LogDriverName, , "Neo_VPN90" -HKR, NDIS, MajorNdisVersion, 1, 5 -HKR, NDIS, MinorNdisVersion, 1, 0 -HKR, Ndi\Interfaces, DefUpper, , "ndis5" -HKR, Ndi\Interfaces, UpperRange, , "ndis5" -HKR, Ndi\Interfaces, LowerRange, , "ethernet" -HKR, Ndi\Interfaces, DefLower, , "ethernet" -HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" -HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% -HKR, Ndi\Params\NetworkAddress, type, 0, "edit" -HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" -HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" -HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% -HKR, Ndi\Params\NetworkAddress, optional, 0, "0" -HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% -HKR, Ndi\Params\MaxSpeed, type, 0, "int" -HKR, Ndi\Params\MaxSpeed, default, 0, "100" -HKR, Ndi\Params\MaxSpeed, min, 0, "0" -HKR, Ndi\Params\MaxSpeed, max, 0, "2000" -HKR, Ndi\Params\MaxSpeed, step, 0, "1" -HKR, Ndi\Params\MaxSpeed, Base, 0, "10" -HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% -HKR, Ndi\Params\KeepLink, type, 0, "enum" -HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% -HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% -HKR, Ndi\Params\KeepLink, default, 0, "0" - - -[Neo.Service] -DisplayName = %Neo.Service.DispName% -Description = %Neo.Service.Desc% -ServiceType = 1 -StartType = 3 -ErrorControl = 1 -ServiceBinary = %12%\Neo6_x64_VPN90.sys -LoadOrderGroup = NDIS - -[Neo.Reg] -HKR, Ndi, Service, 0, Neo.Service.Name -HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" -HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" - -[Neo.EventLog] -HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo6_x64_VPN90.sys" -HKR, , TypesSupported, 0x00010001, 7 - -[Strings] -CompanyName = "SoftEther Corporation" -DiskDescription = "VPN Client Device Driver Install Disk" -Neo.Service.Name = "Neo_VPN90" -Neo.Service.DispName = "VPN Client Device Driver - VPN90" -Neo.Service.Desc = "VPN Client Adapter - VPN90" -NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN90" -Neo.EventLog.Name = "Neo" -NetworkAddress = "MAC Address" -DefaultAddress = "000001000001" -MaxSpeed = "Indicate Speed (Mbps)" -KeepLink = "Keep Link" -On = "On" -Off = "Off" - - -; Auto Generated 20180205_163627.726 - +; VPN Client Device Driver for Windows 2000 and Greater +; +; Copyright (c) SoftEther Corporation. All Rights Reserved. +; http://www.softether.co.jp/ +; +; BUILD 9658 + +[Version] +Signature = "$Windows NT$" +Class = Net +ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} +Provider = %CompanyName% +DriverVer = 02/04/2018, 4.25.0.9658 +CatalogFile.NT = Neo6_x64_VPN90.cat + +[Manufacturer] +%CompanyName% = SoftEther, NTamd64 + +[SourceDisksNames] +1=%DiskDescription%, "", , + +[SourceDisksFiles] +Neo6_x64_VPN90.sys = 1 + +[DestinationDirs] +DefaultDestDir = 12 +Neo.CopyFiles.Sys = 12 + +[Neo.CopyFiles.Sys] +Neo6_x64_VPN90.sys, , , 2 + +[SoftEther.NTamd64] +%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN90 + +[NeoAdapter.Install] +Characteristics = 0x1 +AddReg = Neo.Reg, NeoAdapter.Ndi +CopyFiles = Neo.CopyFiles.Sys +*IfType = 53 +*MediaType = 0 +*PhysicalMediaType = 0 + +[NeoAdapter.Install.Services] +AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% + +[NeoAdapter.Ndi] +HKR, , NetworkAddress, 0, %DefaultAddress% +HKR, Ndi, DeviceID, , "NeoAdapter_VPN90" +HKR, , DevLoader, , ndis +HKR, , DeviceVxDs, , Neo6_x64_VPN90.sys +HKR, NDIS, LogDriverName, , "Neo_VPN90" +HKR, NDIS, MajorNdisVersion, 1, 5 +HKR, NDIS, MinorNdisVersion, 1, 0 +HKR, Ndi\Interfaces, DefUpper, , "ndis5" +HKR, Ndi\Interfaces, UpperRange, , "ndis5" +HKR, Ndi\Interfaces, LowerRange, , "ethernet" +HKR, Ndi\Interfaces, DefLower, , "ethernet" +HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" +HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% +HKR, Ndi\Params\NetworkAddress, type, 0, "edit" +HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" +HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" +HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% +HKR, Ndi\Params\NetworkAddress, optional, 0, "0" +HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% +HKR, Ndi\Params\MaxSpeed, type, 0, "int" +HKR, Ndi\Params\MaxSpeed, default, 0, "100" +HKR, Ndi\Params\MaxSpeed, min, 0, "0" +HKR, Ndi\Params\MaxSpeed, max, 0, "2000" +HKR, Ndi\Params\MaxSpeed, step, 0, "1" +HKR, Ndi\Params\MaxSpeed, Base, 0, "10" +HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% +HKR, Ndi\Params\KeepLink, type, 0, "enum" +HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% +HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% +HKR, Ndi\Params\KeepLink, default, 0, "0" + + +[Neo.Service] +DisplayName = %Neo.Service.DispName% +Description = %Neo.Service.Desc% +ServiceType = 1 +StartType = 3 +ErrorControl = 1 +ServiceBinary = %12%\Neo6_x64_VPN90.sys +LoadOrderGroup = NDIS + +[Neo.Reg] +HKR, Ndi, Service, 0, Neo.Service.Name +HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" +HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" + +[Neo.EventLog] +HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo6_x64_VPN90.sys" +HKR, , TypesSupported, 0x00010001, 7 + +[Strings] +CompanyName = "SoftEther Corporation" +DiskDescription = "VPN Client Device Driver Install Disk" +Neo.Service.Name = "Neo_VPN90" +Neo.Service.DispName = "VPN Client Device Driver - VPN90" +Neo.Service.Desc = "VPN Client Adapter - VPN90" +NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN90" +Neo.EventLog.Name = "Neo" +NetworkAddress = "MAC Address" +DefaultAddress = "000001000001" +MaxSpeed = "Indicate Speed (Mbps)" +KeepLink = "Keep Link" +On = "On" +Off = "Off" + + +; Auto Generated 20180205_163627.726 + diff --git a/src/bin/hamcore/DriverPackages/Neo6_Win10/x64/Neo6_x64_VPN91.inf b/src/bin/hamcore/DriverPackages/Neo6_Win10/x64/Neo6_x64_VPN91.inf index e9e075d2..342729e1 100644 --- a/src/bin/hamcore/DriverPackages/Neo6_Win10/x64/Neo6_x64_VPN91.inf +++ b/src/bin/hamcore/DriverPackages/Neo6_Win10/x64/Neo6_x64_VPN91.inf @@ -1,114 +1,114 @@ -; VPN Client Device Driver for Windows 2000 and Greater -; -; Copyright (c) SoftEther Corporation. All Rights Reserved. -; http://www.softether.co.jp/ -; -; BUILD 9658 - -[Version] -Signature = "$Windows NT$" -Class = Net -ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} -Provider = %CompanyName% -DriverVer = 02/04/2018, 4.25.0.9658 -CatalogFile.NT = Neo6_x64_VPN91.cat - -[Manufacturer] -%CompanyName% = SoftEther, NTamd64 - -[SourceDisksNames] -1=%DiskDescription%, "", , - -[SourceDisksFiles] -Neo6_x64_VPN91.sys = 1 - -[DestinationDirs] -DefaultDestDir = 12 -Neo.CopyFiles.Sys = 12 - -[Neo.CopyFiles.Sys] -Neo6_x64_VPN91.sys, , , 2 - -[SoftEther.NTamd64] -%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN91 - -[NeoAdapter.Install] -Characteristics = 0x1 -AddReg = Neo.Reg, NeoAdapter.Ndi -CopyFiles = Neo.CopyFiles.Sys -*IfType = 53 -*MediaType = 0 -*PhysicalMediaType = 0 - -[NeoAdapter.Install.Services] -AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% - -[NeoAdapter.Ndi] -HKR, , NetworkAddress, 0, %DefaultAddress% -HKR, Ndi, DeviceID, , "NeoAdapter_VPN91" -HKR, , DevLoader, , ndis -HKR, , DeviceVxDs, , Neo6_x64_VPN91.sys -HKR, NDIS, LogDriverName, , "Neo_VPN91" -HKR, NDIS, MajorNdisVersion, 1, 5 -HKR, NDIS, MinorNdisVersion, 1, 0 -HKR, Ndi\Interfaces, DefUpper, , "ndis5" -HKR, Ndi\Interfaces, UpperRange, , "ndis5" -HKR, Ndi\Interfaces, LowerRange, , "ethernet" -HKR, Ndi\Interfaces, DefLower, , "ethernet" -HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" -HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% -HKR, Ndi\Params\NetworkAddress, type, 0, "edit" -HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" -HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" -HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% -HKR, Ndi\Params\NetworkAddress, optional, 0, "0" -HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% -HKR, Ndi\Params\MaxSpeed, type, 0, "int" -HKR, Ndi\Params\MaxSpeed, default, 0, "100" -HKR, Ndi\Params\MaxSpeed, min, 0, "0" -HKR, Ndi\Params\MaxSpeed, max, 0, "2000" -HKR, Ndi\Params\MaxSpeed, step, 0, "1" -HKR, Ndi\Params\MaxSpeed, Base, 0, "10" -HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% -HKR, Ndi\Params\KeepLink, type, 0, "enum" -HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% -HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% -HKR, Ndi\Params\KeepLink, default, 0, "0" - - -[Neo.Service] -DisplayName = %Neo.Service.DispName% -Description = %Neo.Service.Desc% -ServiceType = 1 -StartType = 3 -ErrorControl = 1 -ServiceBinary = %12%\Neo6_x64_VPN91.sys -LoadOrderGroup = NDIS - -[Neo.Reg] -HKR, Ndi, Service, 0, Neo.Service.Name -HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" -HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" - -[Neo.EventLog] -HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo6_x64_VPN91.sys" -HKR, , TypesSupported, 0x00010001, 7 - -[Strings] -CompanyName = "SoftEther Corporation" -DiskDescription = "VPN Client Device Driver Install Disk" -Neo.Service.Name = "Neo_VPN91" -Neo.Service.DispName = "VPN Client Device Driver - VPN91" -Neo.Service.Desc = "VPN Client Adapter - VPN91" -NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN91" -Neo.EventLog.Name = "Neo" -NetworkAddress = "MAC Address" -DefaultAddress = "000001000001" -MaxSpeed = "Indicate Speed (Mbps)" -KeepLink = "Keep Link" -On = "On" -Off = "Off" - - -; Auto Generated 20180205_163627.799 - +; VPN Client Device Driver for Windows 2000 and Greater +; +; Copyright (c) SoftEther Corporation. All Rights Reserved. +; http://www.softether.co.jp/ +; +; BUILD 9658 + +[Version] +Signature = "$Windows NT$" +Class = Net +ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} +Provider = %CompanyName% +DriverVer = 02/04/2018, 4.25.0.9658 +CatalogFile.NT = Neo6_x64_VPN91.cat + +[Manufacturer] +%CompanyName% = SoftEther, NTamd64 + +[SourceDisksNames] +1=%DiskDescription%, "", , + +[SourceDisksFiles] +Neo6_x64_VPN91.sys = 1 + +[DestinationDirs] +DefaultDestDir = 12 +Neo.CopyFiles.Sys = 12 + +[Neo.CopyFiles.Sys] +Neo6_x64_VPN91.sys, , , 2 + +[SoftEther.NTamd64] +%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN91 + +[NeoAdapter.Install] +Characteristics = 0x1 +AddReg = Neo.Reg, NeoAdapter.Ndi +CopyFiles = Neo.CopyFiles.Sys +*IfType = 53 +*MediaType = 0 +*PhysicalMediaType = 0 + +[NeoAdapter.Install.Services] +AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% + +[NeoAdapter.Ndi] +HKR, , NetworkAddress, 0, %DefaultAddress% +HKR, Ndi, DeviceID, , "NeoAdapter_VPN91" +HKR, , DevLoader, , ndis +HKR, , DeviceVxDs, , Neo6_x64_VPN91.sys +HKR, NDIS, LogDriverName, , "Neo_VPN91" +HKR, NDIS, MajorNdisVersion, 1, 5 +HKR, NDIS, MinorNdisVersion, 1, 0 +HKR, Ndi\Interfaces, DefUpper, , "ndis5" +HKR, Ndi\Interfaces, UpperRange, , "ndis5" +HKR, Ndi\Interfaces, LowerRange, , "ethernet" +HKR, Ndi\Interfaces, DefLower, , "ethernet" +HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" +HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% +HKR, Ndi\Params\NetworkAddress, type, 0, "edit" +HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" +HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" +HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% +HKR, Ndi\Params\NetworkAddress, optional, 0, "0" +HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% +HKR, Ndi\Params\MaxSpeed, type, 0, "int" +HKR, Ndi\Params\MaxSpeed, default, 0, "100" +HKR, Ndi\Params\MaxSpeed, min, 0, "0" +HKR, Ndi\Params\MaxSpeed, max, 0, "2000" +HKR, Ndi\Params\MaxSpeed, step, 0, "1" +HKR, Ndi\Params\MaxSpeed, Base, 0, "10" +HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% +HKR, Ndi\Params\KeepLink, type, 0, "enum" +HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% +HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% +HKR, Ndi\Params\KeepLink, default, 0, "0" + + +[Neo.Service] +DisplayName = %Neo.Service.DispName% +Description = %Neo.Service.Desc% +ServiceType = 1 +StartType = 3 +ErrorControl = 1 +ServiceBinary = %12%\Neo6_x64_VPN91.sys +LoadOrderGroup = NDIS + +[Neo.Reg] +HKR, Ndi, Service, 0, Neo.Service.Name +HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" +HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" + +[Neo.EventLog] +HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo6_x64_VPN91.sys" +HKR, , TypesSupported, 0x00010001, 7 + +[Strings] +CompanyName = "SoftEther Corporation" +DiskDescription = "VPN Client Device Driver Install Disk" +Neo.Service.Name = "Neo_VPN91" +Neo.Service.DispName = "VPN Client Device Driver - VPN91" +Neo.Service.Desc = "VPN Client Adapter - VPN91" +NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN91" +Neo.EventLog.Name = "Neo" +NetworkAddress = "MAC Address" +DefaultAddress = "000001000001" +MaxSpeed = "Indicate Speed (Mbps)" +KeepLink = "Keep Link" +On = "On" +Off = "Off" + + +; Auto Generated 20180205_163627.799 + diff --git a/src/bin/hamcore/DriverPackages/Neo6_Win10/x64/Neo6_x64_VPN92.inf b/src/bin/hamcore/DriverPackages/Neo6_Win10/x64/Neo6_x64_VPN92.inf index 3d792c8c..ea5e345b 100644 --- a/src/bin/hamcore/DriverPackages/Neo6_Win10/x64/Neo6_x64_VPN92.inf +++ b/src/bin/hamcore/DriverPackages/Neo6_Win10/x64/Neo6_x64_VPN92.inf @@ -1,114 +1,114 @@ -; VPN Client Device Driver for Windows 2000 and Greater -; -; Copyright (c) SoftEther Corporation. All Rights Reserved. -; http://www.softether.co.jp/ -; -; BUILD 9658 - -[Version] -Signature = "$Windows NT$" -Class = Net -ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} -Provider = %CompanyName% -DriverVer = 02/04/2018, 4.25.0.9658 -CatalogFile.NT = Neo6_x64_VPN92.cat - -[Manufacturer] -%CompanyName% = SoftEther, NTamd64 - -[SourceDisksNames] -1=%DiskDescription%, "", , - -[SourceDisksFiles] -Neo6_x64_VPN92.sys = 1 - -[DestinationDirs] -DefaultDestDir = 12 -Neo.CopyFiles.Sys = 12 - -[Neo.CopyFiles.Sys] -Neo6_x64_VPN92.sys, , , 2 - -[SoftEther.NTamd64] -%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN92 - -[NeoAdapter.Install] -Characteristics = 0x1 -AddReg = Neo.Reg, NeoAdapter.Ndi -CopyFiles = Neo.CopyFiles.Sys -*IfType = 53 -*MediaType = 0 -*PhysicalMediaType = 0 - -[NeoAdapter.Install.Services] -AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% - -[NeoAdapter.Ndi] -HKR, , NetworkAddress, 0, %DefaultAddress% -HKR, Ndi, DeviceID, , "NeoAdapter_VPN92" -HKR, , DevLoader, , ndis -HKR, , DeviceVxDs, , Neo6_x64_VPN92.sys -HKR, NDIS, LogDriverName, , "Neo_VPN92" -HKR, NDIS, MajorNdisVersion, 1, 5 -HKR, NDIS, MinorNdisVersion, 1, 0 -HKR, Ndi\Interfaces, DefUpper, , "ndis5" -HKR, Ndi\Interfaces, UpperRange, , "ndis5" -HKR, Ndi\Interfaces, LowerRange, , "ethernet" -HKR, Ndi\Interfaces, DefLower, , "ethernet" -HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" -HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% -HKR, Ndi\Params\NetworkAddress, type, 0, "edit" -HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" -HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" -HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% -HKR, Ndi\Params\NetworkAddress, optional, 0, "0" -HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% -HKR, Ndi\Params\MaxSpeed, type, 0, "int" -HKR, Ndi\Params\MaxSpeed, default, 0, "100" -HKR, Ndi\Params\MaxSpeed, min, 0, "0" -HKR, Ndi\Params\MaxSpeed, max, 0, "2000" -HKR, Ndi\Params\MaxSpeed, step, 0, "1" -HKR, Ndi\Params\MaxSpeed, Base, 0, "10" -HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% -HKR, Ndi\Params\KeepLink, type, 0, "enum" -HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% -HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% -HKR, Ndi\Params\KeepLink, default, 0, "0" - - -[Neo.Service] -DisplayName = %Neo.Service.DispName% -Description = %Neo.Service.Desc% -ServiceType = 1 -StartType = 3 -ErrorControl = 1 -ServiceBinary = %12%\Neo6_x64_VPN92.sys -LoadOrderGroup = NDIS - -[Neo.Reg] -HKR, Ndi, Service, 0, Neo.Service.Name -HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" -HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" - -[Neo.EventLog] -HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo6_x64_VPN92.sys" -HKR, , TypesSupported, 0x00010001, 7 - -[Strings] -CompanyName = "SoftEther Corporation" -DiskDescription = "VPN Client Device Driver Install Disk" -Neo.Service.Name = "Neo_VPN92" -Neo.Service.DispName = "VPN Client Device Driver - VPN92" -Neo.Service.Desc = "VPN Client Adapter - VPN92" -NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN92" -Neo.EventLog.Name = "Neo" -NetworkAddress = "MAC Address" -DefaultAddress = "000001000001" -MaxSpeed = "Indicate Speed (Mbps)" -KeepLink = "Keep Link" -On = "On" -Off = "Off" - - -; Auto Generated 20180205_163627.872 - +; VPN Client Device Driver for Windows 2000 and Greater +; +; Copyright (c) SoftEther Corporation. All Rights Reserved. +; http://www.softether.co.jp/ +; +; BUILD 9658 + +[Version] +Signature = "$Windows NT$" +Class = Net +ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} +Provider = %CompanyName% +DriverVer = 02/04/2018, 4.25.0.9658 +CatalogFile.NT = Neo6_x64_VPN92.cat + +[Manufacturer] +%CompanyName% = SoftEther, NTamd64 + +[SourceDisksNames] +1=%DiskDescription%, "", , + +[SourceDisksFiles] +Neo6_x64_VPN92.sys = 1 + +[DestinationDirs] +DefaultDestDir = 12 +Neo.CopyFiles.Sys = 12 + +[Neo.CopyFiles.Sys] +Neo6_x64_VPN92.sys, , , 2 + +[SoftEther.NTamd64] +%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN92 + +[NeoAdapter.Install] +Characteristics = 0x1 +AddReg = Neo.Reg, NeoAdapter.Ndi +CopyFiles = Neo.CopyFiles.Sys +*IfType = 53 +*MediaType = 0 +*PhysicalMediaType = 0 + +[NeoAdapter.Install.Services] +AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% + +[NeoAdapter.Ndi] +HKR, , NetworkAddress, 0, %DefaultAddress% +HKR, Ndi, DeviceID, , "NeoAdapter_VPN92" +HKR, , DevLoader, , ndis +HKR, , DeviceVxDs, , Neo6_x64_VPN92.sys +HKR, NDIS, LogDriverName, , "Neo_VPN92" +HKR, NDIS, MajorNdisVersion, 1, 5 +HKR, NDIS, MinorNdisVersion, 1, 0 +HKR, Ndi\Interfaces, DefUpper, , "ndis5" +HKR, Ndi\Interfaces, UpperRange, , "ndis5" +HKR, Ndi\Interfaces, LowerRange, , "ethernet" +HKR, Ndi\Interfaces, DefLower, , "ethernet" +HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" +HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% +HKR, Ndi\Params\NetworkAddress, type, 0, "edit" +HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" +HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" +HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% +HKR, Ndi\Params\NetworkAddress, optional, 0, "0" +HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% +HKR, Ndi\Params\MaxSpeed, type, 0, "int" +HKR, Ndi\Params\MaxSpeed, default, 0, "100" +HKR, Ndi\Params\MaxSpeed, min, 0, "0" +HKR, Ndi\Params\MaxSpeed, max, 0, "2000" +HKR, Ndi\Params\MaxSpeed, step, 0, "1" +HKR, Ndi\Params\MaxSpeed, Base, 0, "10" +HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% +HKR, Ndi\Params\KeepLink, type, 0, "enum" +HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% +HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% +HKR, Ndi\Params\KeepLink, default, 0, "0" + + +[Neo.Service] +DisplayName = %Neo.Service.DispName% +Description = %Neo.Service.Desc% +ServiceType = 1 +StartType = 3 +ErrorControl = 1 +ServiceBinary = %12%\Neo6_x64_VPN92.sys +LoadOrderGroup = NDIS + +[Neo.Reg] +HKR, Ndi, Service, 0, Neo.Service.Name +HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" +HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" + +[Neo.EventLog] +HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo6_x64_VPN92.sys" +HKR, , TypesSupported, 0x00010001, 7 + +[Strings] +CompanyName = "SoftEther Corporation" +DiskDescription = "VPN Client Device Driver Install Disk" +Neo.Service.Name = "Neo_VPN92" +Neo.Service.DispName = "VPN Client Device Driver - VPN92" +Neo.Service.Desc = "VPN Client Adapter - VPN92" +NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN92" +Neo.EventLog.Name = "Neo" +NetworkAddress = "MAC Address" +DefaultAddress = "000001000001" +MaxSpeed = "Indicate Speed (Mbps)" +KeepLink = "Keep Link" +On = "On" +Off = "Off" + + +; Auto Generated 20180205_163627.872 + diff --git a/src/bin/hamcore/DriverPackages/Neo6_Win10/x64/Neo6_x64_VPN93.inf b/src/bin/hamcore/DriverPackages/Neo6_Win10/x64/Neo6_x64_VPN93.inf index 5751eb18..eb70a10a 100644 --- a/src/bin/hamcore/DriverPackages/Neo6_Win10/x64/Neo6_x64_VPN93.inf +++ b/src/bin/hamcore/DriverPackages/Neo6_Win10/x64/Neo6_x64_VPN93.inf @@ -1,114 +1,114 @@ -; VPN Client Device Driver for Windows 2000 and Greater -; -; Copyright (c) SoftEther Corporation. All Rights Reserved. -; http://www.softether.co.jp/ -; -; BUILD 9658 - -[Version] -Signature = "$Windows NT$" -Class = Net -ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} -Provider = %CompanyName% -DriverVer = 02/04/2018, 4.25.0.9658 -CatalogFile.NT = Neo6_x64_VPN93.cat - -[Manufacturer] -%CompanyName% = SoftEther, NTamd64 - -[SourceDisksNames] -1=%DiskDescription%, "", , - -[SourceDisksFiles] -Neo6_x64_VPN93.sys = 1 - -[DestinationDirs] -DefaultDestDir = 12 -Neo.CopyFiles.Sys = 12 - -[Neo.CopyFiles.Sys] -Neo6_x64_VPN93.sys, , , 2 - -[SoftEther.NTamd64] -%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN93 - -[NeoAdapter.Install] -Characteristics = 0x1 -AddReg = Neo.Reg, NeoAdapter.Ndi -CopyFiles = Neo.CopyFiles.Sys -*IfType = 53 -*MediaType = 0 -*PhysicalMediaType = 0 - -[NeoAdapter.Install.Services] -AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% - -[NeoAdapter.Ndi] -HKR, , NetworkAddress, 0, %DefaultAddress% -HKR, Ndi, DeviceID, , "NeoAdapter_VPN93" -HKR, , DevLoader, , ndis -HKR, , DeviceVxDs, , Neo6_x64_VPN93.sys -HKR, NDIS, LogDriverName, , "Neo_VPN93" -HKR, NDIS, MajorNdisVersion, 1, 5 -HKR, NDIS, MinorNdisVersion, 1, 0 -HKR, Ndi\Interfaces, DefUpper, , "ndis5" -HKR, Ndi\Interfaces, UpperRange, , "ndis5" -HKR, Ndi\Interfaces, LowerRange, , "ethernet" -HKR, Ndi\Interfaces, DefLower, , "ethernet" -HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" -HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% -HKR, Ndi\Params\NetworkAddress, type, 0, "edit" -HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" -HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" -HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% -HKR, Ndi\Params\NetworkAddress, optional, 0, "0" -HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% -HKR, Ndi\Params\MaxSpeed, type, 0, "int" -HKR, Ndi\Params\MaxSpeed, default, 0, "100" -HKR, Ndi\Params\MaxSpeed, min, 0, "0" -HKR, Ndi\Params\MaxSpeed, max, 0, "2000" -HKR, Ndi\Params\MaxSpeed, step, 0, "1" -HKR, Ndi\Params\MaxSpeed, Base, 0, "10" -HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% -HKR, Ndi\Params\KeepLink, type, 0, "enum" -HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% -HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% -HKR, Ndi\Params\KeepLink, default, 0, "0" - - -[Neo.Service] -DisplayName = %Neo.Service.DispName% -Description = %Neo.Service.Desc% -ServiceType = 1 -StartType = 3 -ErrorControl = 1 -ServiceBinary = %12%\Neo6_x64_VPN93.sys -LoadOrderGroup = NDIS - -[Neo.Reg] -HKR, Ndi, Service, 0, Neo.Service.Name -HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" -HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" - -[Neo.EventLog] -HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo6_x64_VPN93.sys" -HKR, , TypesSupported, 0x00010001, 7 - -[Strings] -CompanyName = "SoftEther Corporation" -DiskDescription = "VPN Client Device Driver Install Disk" -Neo.Service.Name = "Neo_VPN93" -Neo.Service.DispName = "VPN Client Device Driver - VPN93" -Neo.Service.Desc = "VPN Client Adapter - VPN93" -NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN93" -Neo.EventLog.Name = "Neo" -NetworkAddress = "MAC Address" -DefaultAddress = "000001000001" -MaxSpeed = "Indicate Speed (Mbps)" -KeepLink = "Keep Link" -On = "On" -Off = "Off" - - -; Auto Generated 20180205_163627.942 - +; VPN Client Device Driver for Windows 2000 and Greater +; +; Copyright (c) SoftEther Corporation. All Rights Reserved. +; http://www.softether.co.jp/ +; +; BUILD 9658 + +[Version] +Signature = "$Windows NT$" +Class = Net +ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} +Provider = %CompanyName% +DriverVer = 02/04/2018, 4.25.0.9658 +CatalogFile.NT = Neo6_x64_VPN93.cat + +[Manufacturer] +%CompanyName% = SoftEther, NTamd64 + +[SourceDisksNames] +1=%DiskDescription%, "", , + +[SourceDisksFiles] +Neo6_x64_VPN93.sys = 1 + +[DestinationDirs] +DefaultDestDir = 12 +Neo.CopyFiles.Sys = 12 + +[Neo.CopyFiles.Sys] +Neo6_x64_VPN93.sys, , , 2 + +[SoftEther.NTamd64] +%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN93 + +[NeoAdapter.Install] +Characteristics = 0x1 +AddReg = Neo.Reg, NeoAdapter.Ndi +CopyFiles = Neo.CopyFiles.Sys +*IfType = 53 +*MediaType = 0 +*PhysicalMediaType = 0 + +[NeoAdapter.Install.Services] +AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% + +[NeoAdapter.Ndi] +HKR, , NetworkAddress, 0, %DefaultAddress% +HKR, Ndi, DeviceID, , "NeoAdapter_VPN93" +HKR, , DevLoader, , ndis +HKR, , DeviceVxDs, , Neo6_x64_VPN93.sys +HKR, NDIS, LogDriverName, , "Neo_VPN93" +HKR, NDIS, MajorNdisVersion, 1, 5 +HKR, NDIS, MinorNdisVersion, 1, 0 +HKR, Ndi\Interfaces, DefUpper, , "ndis5" +HKR, Ndi\Interfaces, UpperRange, , "ndis5" +HKR, Ndi\Interfaces, LowerRange, , "ethernet" +HKR, Ndi\Interfaces, DefLower, , "ethernet" +HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" +HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% +HKR, Ndi\Params\NetworkAddress, type, 0, "edit" +HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" +HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" +HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% +HKR, Ndi\Params\NetworkAddress, optional, 0, "0" +HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% +HKR, Ndi\Params\MaxSpeed, type, 0, "int" +HKR, Ndi\Params\MaxSpeed, default, 0, "100" +HKR, Ndi\Params\MaxSpeed, min, 0, "0" +HKR, Ndi\Params\MaxSpeed, max, 0, "2000" +HKR, Ndi\Params\MaxSpeed, step, 0, "1" +HKR, Ndi\Params\MaxSpeed, Base, 0, "10" +HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% +HKR, Ndi\Params\KeepLink, type, 0, "enum" +HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% +HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% +HKR, Ndi\Params\KeepLink, default, 0, "0" + + +[Neo.Service] +DisplayName = %Neo.Service.DispName% +Description = %Neo.Service.Desc% +ServiceType = 1 +StartType = 3 +ErrorControl = 1 +ServiceBinary = %12%\Neo6_x64_VPN93.sys +LoadOrderGroup = NDIS + +[Neo.Reg] +HKR, Ndi, Service, 0, Neo.Service.Name +HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" +HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" + +[Neo.EventLog] +HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo6_x64_VPN93.sys" +HKR, , TypesSupported, 0x00010001, 7 + +[Strings] +CompanyName = "SoftEther Corporation" +DiskDescription = "VPN Client Device Driver Install Disk" +Neo.Service.Name = "Neo_VPN93" +Neo.Service.DispName = "VPN Client Device Driver - VPN93" +Neo.Service.Desc = "VPN Client Adapter - VPN93" +NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN93" +Neo.EventLog.Name = "Neo" +NetworkAddress = "MAC Address" +DefaultAddress = "000001000001" +MaxSpeed = "Indicate Speed (Mbps)" +KeepLink = "Keep Link" +On = "On" +Off = "Off" + + +; Auto Generated 20180205_163627.942 + diff --git a/src/bin/hamcore/DriverPackages/Neo6_Win10/x64/Neo6_x64_VPN94.inf b/src/bin/hamcore/DriverPackages/Neo6_Win10/x64/Neo6_x64_VPN94.inf index ec0fd4a3..1c329061 100644 --- a/src/bin/hamcore/DriverPackages/Neo6_Win10/x64/Neo6_x64_VPN94.inf +++ b/src/bin/hamcore/DriverPackages/Neo6_Win10/x64/Neo6_x64_VPN94.inf @@ -1,114 +1,114 @@ -; VPN Client Device Driver for Windows 2000 and Greater -; -; Copyright (c) SoftEther Corporation. All Rights Reserved. -; http://www.softether.co.jp/ -; -; BUILD 9658 - -[Version] -Signature = "$Windows NT$" -Class = Net -ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} -Provider = %CompanyName% -DriverVer = 02/04/2018, 4.25.0.9658 -CatalogFile.NT = Neo6_x64_VPN94.cat - -[Manufacturer] -%CompanyName% = SoftEther, NTamd64 - -[SourceDisksNames] -1=%DiskDescription%, "", , - -[SourceDisksFiles] -Neo6_x64_VPN94.sys = 1 - -[DestinationDirs] -DefaultDestDir = 12 -Neo.CopyFiles.Sys = 12 - -[Neo.CopyFiles.Sys] -Neo6_x64_VPN94.sys, , , 2 - -[SoftEther.NTamd64] -%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN94 - -[NeoAdapter.Install] -Characteristics = 0x1 -AddReg = Neo.Reg, NeoAdapter.Ndi -CopyFiles = Neo.CopyFiles.Sys -*IfType = 53 -*MediaType = 0 -*PhysicalMediaType = 0 - -[NeoAdapter.Install.Services] -AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% - -[NeoAdapter.Ndi] -HKR, , NetworkAddress, 0, %DefaultAddress% -HKR, Ndi, DeviceID, , "NeoAdapter_VPN94" -HKR, , DevLoader, , ndis -HKR, , DeviceVxDs, , Neo6_x64_VPN94.sys -HKR, NDIS, LogDriverName, , "Neo_VPN94" -HKR, NDIS, MajorNdisVersion, 1, 5 -HKR, NDIS, MinorNdisVersion, 1, 0 -HKR, Ndi\Interfaces, DefUpper, , "ndis5" -HKR, Ndi\Interfaces, UpperRange, , "ndis5" -HKR, Ndi\Interfaces, LowerRange, , "ethernet" -HKR, Ndi\Interfaces, DefLower, , "ethernet" -HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" -HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% -HKR, Ndi\Params\NetworkAddress, type, 0, "edit" -HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" -HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" -HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% -HKR, Ndi\Params\NetworkAddress, optional, 0, "0" -HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% -HKR, Ndi\Params\MaxSpeed, type, 0, "int" -HKR, Ndi\Params\MaxSpeed, default, 0, "100" -HKR, Ndi\Params\MaxSpeed, min, 0, "0" -HKR, Ndi\Params\MaxSpeed, max, 0, "2000" -HKR, Ndi\Params\MaxSpeed, step, 0, "1" -HKR, Ndi\Params\MaxSpeed, Base, 0, "10" -HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% -HKR, Ndi\Params\KeepLink, type, 0, "enum" -HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% -HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% -HKR, Ndi\Params\KeepLink, default, 0, "0" - - -[Neo.Service] -DisplayName = %Neo.Service.DispName% -Description = %Neo.Service.Desc% -ServiceType = 1 -StartType = 3 -ErrorControl = 1 -ServiceBinary = %12%\Neo6_x64_VPN94.sys -LoadOrderGroup = NDIS - -[Neo.Reg] -HKR, Ndi, Service, 0, Neo.Service.Name -HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" -HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" - -[Neo.EventLog] -HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo6_x64_VPN94.sys" -HKR, , TypesSupported, 0x00010001, 7 - -[Strings] -CompanyName = "SoftEther Corporation" -DiskDescription = "VPN Client Device Driver Install Disk" -Neo.Service.Name = "Neo_VPN94" -Neo.Service.DispName = "VPN Client Device Driver - VPN94" -Neo.Service.Desc = "VPN Client Adapter - VPN94" -NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN94" -Neo.EventLog.Name = "Neo" -NetworkAddress = "MAC Address" -DefaultAddress = "000001000001" -MaxSpeed = "Indicate Speed (Mbps)" -KeepLink = "Keep Link" -On = "On" -Off = "Off" - - -; Auto Generated 20180205_163628.012 - +; VPN Client Device Driver for Windows 2000 and Greater +; +; Copyright (c) SoftEther Corporation. All Rights Reserved. +; http://www.softether.co.jp/ +; +; BUILD 9658 + +[Version] +Signature = "$Windows NT$" +Class = Net +ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} +Provider = %CompanyName% +DriverVer = 02/04/2018, 4.25.0.9658 +CatalogFile.NT = Neo6_x64_VPN94.cat + +[Manufacturer] +%CompanyName% = SoftEther, NTamd64 + +[SourceDisksNames] +1=%DiskDescription%, "", , + +[SourceDisksFiles] +Neo6_x64_VPN94.sys = 1 + +[DestinationDirs] +DefaultDestDir = 12 +Neo.CopyFiles.Sys = 12 + +[Neo.CopyFiles.Sys] +Neo6_x64_VPN94.sys, , , 2 + +[SoftEther.NTamd64] +%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN94 + +[NeoAdapter.Install] +Characteristics = 0x1 +AddReg = Neo.Reg, NeoAdapter.Ndi +CopyFiles = Neo.CopyFiles.Sys +*IfType = 53 +*MediaType = 0 +*PhysicalMediaType = 0 + +[NeoAdapter.Install.Services] +AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% + +[NeoAdapter.Ndi] +HKR, , NetworkAddress, 0, %DefaultAddress% +HKR, Ndi, DeviceID, , "NeoAdapter_VPN94" +HKR, , DevLoader, , ndis +HKR, , DeviceVxDs, , Neo6_x64_VPN94.sys +HKR, NDIS, LogDriverName, , "Neo_VPN94" +HKR, NDIS, MajorNdisVersion, 1, 5 +HKR, NDIS, MinorNdisVersion, 1, 0 +HKR, Ndi\Interfaces, DefUpper, , "ndis5" +HKR, Ndi\Interfaces, UpperRange, , "ndis5" +HKR, Ndi\Interfaces, LowerRange, , "ethernet" +HKR, Ndi\Interfaces, DefLower, , "ethernet" +HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" +HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% +HKR, Ndi\Params\NetworkAddress, type, 0, "edit" +HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" +HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" +HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% +HKR, Ndi\Params\NetworkAddress, optional, 0, "0" +HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% +HKR, Ndi\Params\MaxSpeed, type, 0, "int" +HKR, Ndi\Params\MaxSpeed, default, 0, "100" +HKR, Ndi\Params\MaxSpeed, min, 0, "0" +HKR, Ndi\Params\MaxSpeed, max, 0, "2000" +HKR, Ndi\Params\MaxSpeed, step, 0, "1" +HKR, Ndi\Params\MaxSpeed, Base, 0, "10" +HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% +HKR, Ndi\Params\KeepLink, type, 0, "enum" +HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% +HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% +HKR, Ndi\Params\KeepLink, default, 0, "0" + + +[Neo.Service] +DisplayName = %Neo.Service.DispName% +Description = %Neo.Service.Desc% +ServiceType = 1 +StartType = 3 +ErrorControl = 1 +ServiceBinary = %12%\Neo6_x64_VPN94.sys +LoadOrderGroup = NDIS + +[Neo.Reg] +HKR, Ndi, Service, 0, Neo.Service.Name +HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" +HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" + +[Neo.EventLog] +HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo6_x64_VPN94.sys" +HKR, , TypesSupported, 0x00010001, 7 + +[Strings] +CompanyName = "SoftEther Corporation" +DiskDescription = "VPN Client Device Driver Install Disk" +Neo.Service.Name = "Neo_VPN94" +Neo.Service.DispName = "VPN Client Device Driver - VPN94" +Neo.Service.Desc = "VPN Client Adapter - VPN94" +NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN94" +Neo.EventLog.Name = "Neo" +NetworkAddress = "MAC Address" +DefaultAddress = "000001000001" +MaxSpeed = "Indicate Speed (Mbps)" +KeepLink = "Keep Link" +On = "On" +Off = "Off" + + +; Auto Generated 20180205_163628.012 + diff --git a/src/bin/hamcore/DriverPackages/Neo6_Win10/x64/Neo6_x64_VPN95.inf b/src/bin/hamcore/DriverPackages/Neo6_Win10/x64/Neo6_x64_VPN95.inf index 930438ef..f61a55ed 100644 --- a/src/bin/hamcore/DriverPackages/Neo6_Win10/x64/Neo6_x64_VPN95.inf +++ b/src/bin/hamcore/DriverPackages/Neo6_Win10/x64/Neo6_x64_VPN95.inf @@ -1,114 +1,114 @@ -; VPN Client Device Driver for Windows 2000 and Greater -; -; Copyright (c) SoftEther Corporation. All Rights Reserved. -; http://www.softether.co.jp/ -; -; BUILD 9658 - -[Version] -Signature = "$Windows NT$" -Class = Net -ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} -Provider = %CompanyName% -DriverVer = 02/04/2018, 4.25.0.9658 -CatalogFile.NT = Neo6_x64_VPN95.cat - -[Manufacturer] -%CompanyName% = SoftEther, NTamd64 - -[SourceDisksNames] -1=%DiskDescription%, "", , - -[SourceDisksFiles] -Neo6_x64_VPN95.sys = 1 - -[DestinationDirs] -DefaultDestDir = 12 -Neo.CopyFiles.Sys = 12 - -[Neo.CopyFiles.Sys] -Neo6_x64_VPN95.sys, , , 2 - -[SoftEther.NTamd64] -%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN95 - -[NeoAdapter.Install] -Characteristics = 0x1 -AddReg = Neo.Reg, NeoAdapter.Ndi -CopyFiles = Neo.CopyFiles.Sys -*IfType = 53 -*MediaType = 0 -*PhysicalMediaType = 0 - -[NeoAdapter.Install.Services] -AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% - -[NeoAdapter.Ndi] -HKR, , NetworkAddress, 0, %DefaultAddress% -HKR, Ndi, DeviceID, , "NeoAdapter_VPN95" -HKR, , DevLoader, , ndis -HKR, , DeviceVxDs, , Neo6_x64_VPN95.sys -HKR, NDIS, LogDriverName, , "Neo_VPN95" -HKR, NDIS, MajorNdisVersion, 1, 5 -HKR, NDIS, MinorNdisVersion, 1, 0 -HKR, Ndi\Interfaces, DefUpper, , "ndis5" -HKR, Ndi\Interfaces, UpperRange, , "ndis5" -HKR, Ndi\Interfaces, LowerRange, , "ethernet" -HKR, Ndi\Interfaces, DefLower, , "ethernet" -HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" -HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% -HKR, Ndi\Params\NetworkAddress, type, 0, "edit" -HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" -HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" -HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% -HKR, Ndi\Params\NetworkAddress, optional, 0, "0" -HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% -HKR, Ndi\Params\MaxSpeed, type, 0, "int" -HKR, Ndi\Params\MaxSpeed, default, 0, "100" -HKR, Ndi\Params\MaxSpeed, min, 0, "0" -HKR, Ndi\Params\MaxSpeed, max, 0, "2000" -HKR, Ndi\Params\MaxSpeed, step, 0, "1" -HKR, Ndi\Params\MaxSpeed, Base, 0, "10" -HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% -HKR, Ndi\Params\KeepLink, type, 0, "enum" -HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% -HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% -HKR, Ndi\Params\KeepLink, default, 0, "0" - - -[Neo.Service] -DisplayName = %Neo.Service.DispName% -Description = %Neo.Service.Desc% -ServiceType = 1 -StartType = 3 -ErrorControl = 1 -ServiceBinary = %12%\Neo6_x64_VPN95.sys -LoadOrderGroup = NDIS - -[Neo.Reg] -HKR, Ndi, Service, 0, Neo.Service.Name -HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" -HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" - -[Neo.EventLog] -HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo6_x64_VPN95.sys" -HKR, , TypesSupported, 0x00010001, 7 - -[Strings] -CompanyName = "SoftEther Corporation" -DiskDescription = "VPN Client Device Driver Install Disk" -Neo.Service.Name = "Neo_VPN95" -Neo.Service.DispName = "VPN Client Device Driver - VPN95" -Neo.Service.Desc = "VPN Client Adapter - VPN95" -NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN95" -Neo.EventLog.Name = "Neo" -NetworkAddress = "MAC Address" -DefaultAddress = "000001000001" -MaxSpeed = "Indicate Speed (Mbps)" -KeepLink = "Keep Link" -On = "On" -Off = "Off" - - -; Auto Generated 20180205_163628.084 - +; VPN Client Device Driver for Windows 2000 and Greater +; +; Copyright (c) SoftEther Corporation. All Rights Reserved. +; http://www.softether.co.jp/ +; +; BUILD 9658 + +[Version] +Signature = "$Windows NT$" +Class = Net +ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} +Provider = %CompanyName% +DriverVer = 02/04/2018, 4.25.0.9658 +CatalogFile.NT = Neo6_x64_VPN95.cat + +[Manufacturer] +%CompanyName% = SoftEther, NTamd64 + +[SourceDisksNames] +1=%DiskDescription%, "", , + +[SourceDisksFiles] +Neo6_x64_VPN95.sys = 1 + +[DestinationDirs] +DefaultDestDir = 12 +Neo.CopyFiles.Sys = 12 + +[Neo.CopyFiles.Sys] +Neo6_x64_VPN95.sys, , , 2 + +[SoftEther.NTamd64] +%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN95 + +[NeoAdapter.Install] +Characteristics = 0x1 +AddReg = Neo.Reg, NeoAdapter.Ndi +CopyFiles = Neo.CopyFiles.Sys +*IfType = 53 +*MediaType = 0 +*PhysicalMediaType = 0 + +[NeoAdapter.Install.Services] +AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% + +[NeoAdapter.Ndi] +HKR, , NetworkAddress, 0, %DefaultAddress% +HKR, Ndi, DeviceID, , "NeoAdapter_VPN95" +HKR, , DevLoader, , ndis +HKR, , DeviceVxDs, , Neo6_x64_VPN95.sys +HKR, NDIS, LogDriverName, , "Neo_VPN95" +HKR, NDIS, MajorNdisVersion, 1, 5 +HKR, NDIS, MinorNdisVersion, 1, 0 +HKR, Ndi\Interfaces, DefUpper, , "ndis5" +HKR, Ndi\Interfaces, UpperRange, , "ndis5" +HKR, Ndi\Interfaces, LowerRange, , "ethernet" +HKR, Ndi\Interfaces, DefLower, , "ethernet" +HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" +HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% +HKR, Ndi\Params\NetworkAddress, type, 0, "edit" +HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" +HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" +HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% +HKR, Ndi\Params\NetworkAddress, optional, 0, "0" +HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% +HKR, Ndi\Params\MaxSpeed, type, 0, "int" +HKR, Ndi\Params\MaxSpeed, default, 0, "100" +HKR, Ndi\Params\MaxSpeed, min, 0, "0" +HKR, Ndi\Params\MaxSpeed, max, 0, "2000" +HKR, Ndi\Params\MaxSpeed, step, 0, "1" +HKR, Ndi\Params\MaxSpeed, Base, 0, "10" +HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% +HKR, Ndi\Params\KeepLink, type, 0, "enum" +HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% +HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% +HKR, Ndi\Params\KeepLink, default, 0, "0" + + +[Neo.Service] +DisplayName = %Neo.Service.DispName% +Description = %Neo.Service.Desc% +ServiceType = 1 +StartType = 3 +ErrorControl = 1 +ServiceBinary = %12%\Neo6_x64_VPN95.sys +LoadOrderGroup = NDIS + +[Neo.Reg] +HKR, Ndi, Service, 0, Neo.Service.Name +HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" +HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" + +[Neo.EventLog] +HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo6_x64_VPN95.sys" +HKR, , TypesSupported, 0x00010001, 7 + +[Strings] +CompanyName = "SoftEther Corporation" +DiskDescription = "VPN Client Device Driver Install Disk" +Neo.Service.Name = "Neo_VPN95" +Neo.Service.DispName = "VPN Client Device Driver - VPN95" +Neo.Service.Desc = "VPN Client Adapter - VPN95" +NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN95" +Neo.EventLog.Name = "Neo" +NetworkAddress = "MAC Address" +DefaultAddress = "000001000001" +MaxSpeed = "Indicate Speed (Mbps)" +KeepLink = "Keep Link" +On = "On" +Off = "Off" + + +; Auto Generated 20180205_163628.084 + diff --git a/src/bin/hamcore/DriverPackages/Neo6_Win10/x64/Neo6_x64_VPN96.inf b/src/bin/hamcore/DriverPackages/Neo6_Win10/x64/Neo6_x64_VPN96.inf index 3ff30549..3fe8ea23 100644 --- a/src/bin/hamcore/DriverPackages/Neo6_Win10/x64/Neo6_x64_VPN96.inf +++ b/src/bin/hamcore/DriverPackages/Neo6_Win10/x64/Neo6_x64_VPN96.inf @@ -1,114 +1,114 @@ -; VPN Client Device Driver for Windows 2000 and Greater -; -; Copyright (c) SoftEther Corporation. All Rights Reserved. -; http://www.softether.co.jp/ -; -; BUILD 9658 - -[Version] -Signature = "$Windows NT$" -Class = Net -ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} -Provider = %CompanyName% -DriverVer = 02/04/2018, 4.25.0.9658 -CatalogFile.NT = Neo6_x64_VPN96.cat - -[Manufacturer] -%CompanyName% = SoftEther, NTamd64 - -[SourceDisksNames] -1=%DiskDescription%, "", , - -[SourceDisksFiles] -Neo6_x64_VPN96.sys = 1 - -[DestinationDirs] -DefaultDestDir = 12 -Neo.CopyFiles.Sys = 12 - -[Neo.CopyFiles.Sys] -Neo6_x64_VPN96.sys, , , 2 - -[SoftEther.NTamd64] -%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN96 - -[NeoAdapter.Install] -Characteristics = 0x1 -AddReg = Neo.Reg, NeoAdapter.Ndi -CopyFiles = Neo.CopyFiles.Sys -*IfType = 53 -*MediaType = 0 -*PhysicalMediaType = 0 - -[NeoAdapter.Install.Services] -AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% - -[NeoAdapter.Ndi] -HKR, , NetworkAddress, 0, %DefaultAddress% -HKR, Ndi, DeviceID, , "NeoAdapter_VPN96" -HKR, , DevLoader, , ndis -HKR, , DeviceVxDs, , Neo6_x64_VPN96.sys -HKR, NDIS, LogDriverName, , "Neo_VPN96" -HKR, NDIS, MajorNdisVersion, 1, 5 -HKR, NDIS, MinorNdisVersion, 1, 0 -HKR, Ndi\Interfaces, DefUpper, , "ndis5" -HKR, Ndi\Interfaces, UpperRange, , "ndis5" -HKR, Ndi\Interfaces, LowerRange, , "ethernet" -HKR, Ndi\Interfaces, DefLower, , "ethernet" -HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" -HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% -HKR, Ndi\Params\NetworkAddress, type, 0, "edit" -HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" -HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" -HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% -HKR, Ndi\Params\NetworkAddress, optional, 0, "0" -HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% -HKR, Ndi\Params\MaxSpeed, type, 0, "int" -HKR, Ndi\Params\MaxSpeed, default, 0, "100" -HKR, Ndi\Params\MaxSpeed, min, 0, "0" -HKR, Ndi\Params\MaxSpeed, max, 0, "2000" -HKR, Ndi\Params\MaxSpeed, step, 0, "1" -HKR, Ndi\Params\MaxSpeed, Base, 0, "10" -HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% -HKR, Ndi\Params\KeepLink, type, 0, "enum" -HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% -HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% -HKR, Ndi\Params\KeepLink, default, 0, "0" - - -[Neo.Service] -DisplayName = %Neo.Service.DispName% -Description = %Neo.Service.Desc% -ServiceType = 1 -StartType = 3 -ErrorControl = 1 -ServiceBinary = %12%\Neo6_x64_VPN96.sys -LoadOrderGroup = NDIS - -[Neo.Reg] -HKR, Ndi, Service, 0, Neo.Service.Name -HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" -HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" - -[Neo.EventLog] -HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo6_x64_VPN96.sys" -HKR, , TypesSupported, 0x00010001, 7 - -[Strings] -CompanyName = "SoftEther Corporation" -DiskDescription = "VPN Client Device Driver Install Disk" -Neo.Service.Name = "Neo_VPN96" -Neo.Service.DispName = "VPN Client Device Driver - VPN96" -Neo.Service.Desc = "VPN Client Adapter - VPN96" -NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN96" -Neo.EventLog.Name = "Neo" -NetworkAddress = "MAC Address" -DefaultAddress = "000001000001" -MaxSpeed = "Indicate Speed (Mbps)" -KeepLink = "Keep Link" -On = "On" -Off = "Off" - - -; Auto Generated 20180205_163628.156 - +; VPN Client Device Driver for Windows 2000 and Greater +; +; Copyright (c) SoftEther Corporation. All Rights Reserved. +; http://www.softether.co.jp/ +; +; BUILD 9658 + +[Version] +Signature = "$Windows NT$" +Class = Net +ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} +Provider = %CompanyName% +DriverVer = 02/04/2018, 4.25.0.9658 +CatalogFile.NT = Neo6_x64_VPN96.cat + +[Manufacturer] +%CompanyName% = SoftEther, NTamd64 + +[SourceDisksNames] +1=%DiskDescription%, "", , + +[SourceDisksFiles] +Neo6_x64_VPN96.sys = 1 + +[DestinationDirs] +DefaultDestDir = 12 +Neo.CopyFiles.Sys = 12 + +[Neo.CopyFiles.Sys] +Neo6_x64_VPN96.sys, , , 2 + +[SoftEther.NTamd64] +%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN96 + +[NeoAdapter.Install] +Characteristics = 0x1 +AddReg = Neo.Reg, NeoAdapter.Ndi +CopyFiles = Neo.CopyFiles.Sys +*IfType = 53 +*MediaType = 0 +*PhysicalMediaType = 0 + +[NeoAdapter.Install.Services] +AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% + +[NeoAdapter.Ndi] +HKR, , NetworkAddress, 0, %DefaultAddress% +HKR, Ndi, DeviceID, , "NeoAdapter_VPN96" +HKR, , DevLoader, , ndis +HKR, , DeviceVxDs, , Neo6_x64_VPN96.sys +HKR, NDIS, LogDriverName, , "Neo_VPN96" +HKR, NDIS, MajorNdisVersion, 1, 5 +HKR, NDIS, MinorNdisVersion, 1, 0 +HKR, Ndi\Interfaces, DefUpper, , "ndis5" +HKR, Ndi\Interfaces, UpperRange, , "ndis5" +HKR, Ndi\Interfaces, LowerRange, , "ethernet" +HKR, Ndi\Interfaces, DefLower, , "ethernet" +HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" +HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% +HKR, Ndi\Params\NetworkAddress, type, 0, "edit" +HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" +HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" +HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% +HKR, Ndi\Params\NetworkAddress, optional, 0, "0" +HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% +HKR, Ndi\Params\MaxSpeed, type, 0, "int" +HKR, Ndi\Params\MaxSpeed, default, 0, "100" +HKR, Ndi\Params\MaxSpeed, min, 0, "0" +HKR, Ndi\Params\MaxSpeed, max, 0, "2000" +HKR, Ndi\Params\MaxSpeed, step, 0, "1" +HKR, Ndi\Params\MaxSpeed, Base, 0, "10" +HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% +HKR, Ndi\Params\KeepLink, type, 0, "enum" +HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% +HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% +HKR, Ndi\Params\KeepLink, default, 0, "0" + + +[Neo.Service] +DisplayName = %Neo.Service.DispName% +Description = %Neo.Service.Desc% +ServiceType = 1 +StartType = 3 +ErrorControl = 1 +ServiceBinary = %12%\Neo6_x64_VPN96.sys +LoadOrderGroup = NDIS + +[Neo.Reg] +HKR, Ndi, Service, 0, Neo.Service.Name +HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" +HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" + +[Neo.EventLog] +HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo6_x64_VPN96.sys" +HKR, , TypesSupported, 0x00010001, 7 + +[Strings] +CompanyName = "SoftEther Corporation" +DiskDescription = "VPN Client Device Driver Install Disk" +Neo.Service.Name = "Neo_VPN96" +Neo.Service.DispName = "VPN Client Device Driver - VPN96" +Neo.Service.Desc = "VPN Client Adapter - VPN96" +NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN96" +Neo.EventLog.Name = "Neo" +NetworkAddress = "MAC Address" +DefaultAddress = "000001000001" +MaxSpeed = "Indicate Speed (Mbps)" +KeepLink = "Keep Link" +On = "On" +Off = "Off" + + +; Auto Generated 20180205_163628.156 + diff --git a/src/bin/hamcore/DriverPackages/Neo6_Win10/x64/Neo6_x64_VPN97.inf b/src/bin/hamcore/DriverPackages/Neo6_Win10/x64/Neo6_x64_VPN97.inf index 8008b359..012fc455 100644 --- a/src/bin/hamcore/DriverPackages/Neo6_Win10/x64/Neo6_x64_VPN97.inf +++ b/src/bin/hamcore/DriverPackages/Neo6_Win10/x64/Neo6_x64_VPN97.inf @@ -1,114 +1,114 @@ -; VPN Client Device Driver for Windows 2000 and Greater -; -; Copyright (c) SoftEther Corporation. All Rights Reserved. -; http://www.softether.co.jp/ -; -; BUILD 9658 - -[Version] -Signature = "$Windows NT$" -Class = Net -ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} -Provider = %CompanyName% -DriverVer = 02/04/2018, 4.25.0.9658 -CatalogFile.NT = Neo6_x64_VPN97.cat - -[Manufacturer] -%CompanyName% = SoftEther, NTamd64 - -[SourceDisksNames] -1=%DiskDescription%, "", , - -[SourceDisksFiles] -Neo6_x64_VPN97.sys = 1 - -[DestinationDirs] -DefaultDestDir = 12 -Neo.CopyFiles.Sys = 12 - -[Neo.CopyFiles.Sys] -Neo6_x64_VPN97.sys, , , 2 - -[SoftEther.NTamd64] -%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN97 - -[NeoAdapter.Install] -Characteristics = 0x1 -AddReg = Neo.Reg, NeoAdapter.Ndi -CopyFiles = Neo.CopyFiles.Sys -*IfType = 53 -*MediaType = 0 -*PhysicalMediaType = 0 - -[NeoAdapter.Install.Services] -AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% - -[NeoAdapter.Ndi] -HKR, , NetworkAddress, 0, %DefaultAddress% -HKR, Ndi, DeviceID, , "NeoAdapter_VPN97" -HKR, , DevLoader, , ndis -HKR, , DeviceVxDs, , Neo6_x64_VPN97.sys -HKR, NDIS, LogDriverName, , "Neo_VPN97" -HKR, NDIS, MajorNdisVersion, 1, 5 -HKR, NDIS, MinorNdisVersion, 1, 0 -HKR, Ndi\Interfaces, DefUpper, , "ndis5" -HKR, Ndi\Interfaces, UpperRange, , "ndis5" -HKR, Ndi\Interfaces, LowerRange, , "ethernet" -HKR, Ndi\Interfaces, DefLower, , "ethernet" -HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" -HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% -HKR, Ndi\Params\NetworkAddress, type, 0, "edit" -HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" -HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" -HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% -HKR, Ndi\Params\NetworkAddress, optional, 0, "0" -HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% -HKR, Ndi\Params\MaxSpeed, type, 0, "int" -HKR, Ndi\Params\MaxSpeed, default, 0, "100" -HKR, Ndi\Params\MaxSpeed, min, 0, "0" -HKR, Ndi\Params\MaxSpeed, max, 0, "2000" -HKR, Ndi\Params\MaxSpeed, step, 0, "1" -HKR, Ndi\Params\MaxSpeed, Base, 0, "10" -HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% -HKR, Ndi\Params\KeepLink, type, 0, "enum" -HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% -HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% -HKR, Ndi\Params\KeepLink, default, 0, "0" - - -[Neo.Service] -DisplayName = %Neo.Service.DispName% -Description = %Neo.Service.Desc% -ServiceType = 1 -StartType = 3 -ErrorControl = 1 -ServiceBinary = %12%\Neo6_x64_VPN97.sys -LoadOrderGroup = NDIS - -[Neo.Reg] -HKR, Ndi, Service, 0, Neo.Service.Name -HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" -HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" - -[Neo.EventLog] -HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo6_x64_VPN97.sys" -HKR, , TypesSupported, 0x00010001, 7 - -[Strings] -CompanyName = "SoftEther Corporation" -DiskDescription = "VPN Client Device Driver Install Disk" -Neo.Service.Name = "Neo_VPN97" -Neo.Service.DispName = "VPN Client Device Driver - VPN97" -Neo.Service.Desc = "VPN Client Adapter - VPN97" -NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN97" -Neo.EventLog.Name = "Neo" -NetworkAddress = "MAC Address" -DefaultAddress = "000001000001" -MaxSpeed = "Indicate Speed (Mbps)" -KeepLink = "Keep Link" -On = "On" -Off = "Off" - - -; Auto Generated 20180205_163628.227 - +; VPN Client Device Driver for Windows 2000 and Greater +; +; Copyright (c) SoftEther Corporation. All Rights Reserved. +; http://www.softether.co.jp/ +; +; BUILD 9658 + +[Version] +Signature = "$Windows NT$" +Class = Net +ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} +Provider = %CompanyName% +DriverVer = 02/04/2018, 4.25.0.9658 +CatalogFile.NT = Neo6_x64_VPN97.cat + +[Manufacturer] +%CompanyName% = SoftEther, NTamd64 + +[SourceDisksNames] +1=%DiskDescription%, "", , + +[SourceDisksFiles] +Neo6_x64_VPN97.sys = 1 + +[DestinationDirs] +DefaultDestDir = 12 +Neo.CopyFiles.Sys = 12 + +[Neo.CopyFiles.Sys] +Neo6_x64_VPN97.sys, , , 2 + +[SoftEther.NTamd64] +%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN97 + +[NeoAdapter.Install] +Characteristics = 0x1 +AddReg = Neo.Reg, NeoAdapter.Ndi +CopyFiles = Neo.CopyFiles.Sys +*IfType = 53 +*MediaType = 0 +*PhysicalMediaType = 0 + +[NeoAdapter.Install.Services] +AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% + +[NeoAdapter.Ndi] +HKR, , NetworkAddress, 0, %DefaultAddress% +HKR, Ndi, DeviceID, , "NeoAdapter_VPN97" +HKR, , DevLoader, , ndis +HKR, , DeviceVxDs, , Neo6_x64_VPN97.sys +HKR, NDIS, LogDriverName, , "Neo_VPN97" +HKR, NDIS, MajorNdisVersion, 1, 5 +HKR, NDIS, MinorNdisVersion, 1, 0 +HKR, Ndi\Interfaces, DefUpper, , "ndis5" +HKR, Ndi\Interfaces, UpperRange, , "ndis5" +HKR, Ndi\Interfaces, LowerRange, , "ethernet" +HKR, Ndi\Interfaces, DefLower, , "ethernet" +HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" +HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% +HKR, Ndi\Params\NetworkAddress, type, 0, "edit" +HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" +HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" +HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% +HKR, Ndi\Params\NetworkAddress, optional, 0, "0" +HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% +HKR, Ndi\Params\MaxSpeed, type, 0, "int" +HKR, Ndi\Params\MaxSpeed, default, 0, "100" +HKR, Ndi\Params\MaxSpeed, min, 0, "0" +HKR, Ndi\Params\MaxSpeed, max, 0, "2000" +HKR, Ndi\Params\MaxSpeed, step, 0, "1" +HKR, Ndi\Params\MaxSpeed, Base, 0, "10" +HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% +HKR, Ndi\Params\KeepLink, type, 0, "enum" +HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% +HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% +HKR, Ndi\Params\KeepLink, default, 0, "0" + + +[Neo.Service] +DisplayName = %Neo.Service.DispName% +Description = %Neo.Service.Desc% +ServiceType = 1 +StartType = 3 +ErrorControl = 1 +ServiceBinary = %12%\Neo6_x64_VPN97.sys +LoadOrderGroup = NDIS + +[Neo.Reg] +HKR, Ndi, Service, 0, Neo.Service.Name +HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" +HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" + +[Neo.EventLog] +HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo6_x64_VPN97.sys" +HKR, , TypesSupported, 0x00010001, 7 + +[Strings] +CompanyName = "SoftEther Corporation" +DiskDescription = "VPN Client Device Driver Install Disk" +Neo.Service.Name = "Neo_VPN97" +Neo.Service.DispName = "VPN Client Device Driver - VPN97" +Neo.Service.Desc = "VPN Client Adapter - VPN97" +NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN97" +Neo.EventLog.Name = "Neo" +NetworkAddress = "MAC Address" +DefaultAddress = "000001000001" +MaxSpeed = "Indicate Speed (Mbps)" +KeepLink = "Keep Link" +On = "On" +Off = "Off" + + +; Auto Generated 20180205_163628.227 + diff --git a/src/bin/hamcore/DriverPackages/Neo6_Win10/x64/Neo6_x64_VPN98.inf b/src/bin/hamcore/DriverPackages/Neo6_Win10/x64/Neo6_x64_VPN98.inf index 842333a0..ef76c6a7 100644 --- a/src/bin/hamcore/DriverPackages/Neo6_Win10/x64/Neo6_x64_VPN98.inf +++ b/src/bin/hamcore/DriverPackages/Neo6_Win10/x64/Neo6_x64_VPN98.inf @@ -1,114 +1,114 @@ -; VPN Client Device Driver for Windows 2000 and Greater -; -; Copyright (c) SoftEther Corporation. All Rights Reserved. -; http://www.softether.co.jp/ -; -; BUILD 9658 - -[Version] -Signature = "$Windows NT$" -Class = Net -ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} -Provider = %CompanyName% -DriverVer = 02/04/2018, 4.25.0.9658 -CatalogFile.NT = Neo6_x64_VPN98.cat - -[Manufacturer] -%CompanyName% = SoftEther, NTamd64 - -[SourceDisksNames] -1=%DiskDescription%, "", , - -[SourceDisksFiles] -Neo6_x64_VPN98.sys = 1 - -[DestinationDirs] -DefaultDestDir = 12 -Neo.CopyFiles.Sys = 12 - -[Neo.CopyFiles.Sys] -Neo6_x64_VPN98.sys, , , 2 - -[SoftEther.NTamd64] -%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN98 - -[NeoAdapter.Install] -Characteristics = 0x1 -AddReg = Neo.Reg, NeoAdapter.Ndi -CopyFiles = Neo.CopyFiles.Sys -*IfType = 53 -*MediaType = 0 -*PhysicalMediaType = 0 - -[NeoAdapter.Install.Services] -AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% - -[NeoAdapter.Ndi] -HKR, , NetworkAddress, 0, %DefaultAddress% -HKR, Ndi, DeviceID, , "NeoAdapter_VPN98" -HKR, , DevLoader, , ndis -HKR, , DeviceVxDs, , Neo6_x64_VPN98.sys -HKR, NDIS, LogDriverName, , "Neo_VPN98" -HKR, NDIS, MajorNdisVersion, 1, 5 -HKR, NDIS, MinorNdisVersion, 1, 0 -HKR, Ndi\Interfaces, DefUpper, , "ndis5" -HKR, Ndi\Interfaces, UpperRange, , "ndis5" -HKR, Ndi\Interfaces, LowerRange, , "ethernet" -HKR, Ndi\Interfaces, DefLower, , "ethernet" -HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" -HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% -HKR, Ndi\Params\NetworkAddress, type, 0, "edit" -HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" -HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" -HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% -HKR, Ndi\Params\NetworkAddress, optional, 0, "0" -HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% -HKR, Ndi\Params\MaxSpeed, type, 0, "int" -HKR, Ndi\Params\MaxSpeed, default, 0, "100" -HKR, Ndi\Params\MaxSpeed, min, 0, "0" -HKR, Ndi\Params\MaxSpeed, max, 0, "2000" -HKR, Ndi\Params\MaxSpeed, step, 0, "1" -HKR, Ndi\Params\MaxSpeed, Base, 0, "10" -HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% -HKR, Ndi\Params\KeepLink, type, 0, "enum" -HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% -HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% -HKR, Ndi\Params\KeepLink, default, 0, "0" - - -[Neo.Service] -DisplayName = %Neo.Service.DispName% -Description = %Neo.Service.Desc% -ServiceType = 1 -StartType = 3 -ErrorControl = 1 -ServiceBinary = %12%\Neo6_x64_VPN98.sys -LoadOrderGroup = NDIS - -[Neo.Reg] -HKR, Ndi, Service, 0, Neo.Service.Name -HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" -HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" - -[Neo.EventLog] -HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo6_x64_VPN98.sys" -HKR, , TypesSupported, 0x00010001, 7 - -[Strings] -CompanyName = "SoftEther Corporation" -DiskDescription = "VPN Client Device Driver Install Disk" -Neo.Service.Name = "Neo_VPN98" -Neo.Service.DispName = "VPN Client Device Driver - VPN98" -Neo.Service.Desc = "VPN Client Adapter - VPN98" -NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN98" -Neo.EventLog.Name = "Neo" -NetworkAddress = "MAC Address" -DefaultAddress = "000001000001" -MaxSpeed = "Indicate Speed (Mbps)" -KeepLink = "Keep Link" -On = "On" -Off = "Off" - - -; Auto Generated 20180205_163628.298 - +; VPN Client Device Driver for Windows 2000 and Greater +; +; Copyright (c) SoftEther Corporation. All Rights Reserved. +; http://www.softether.co.jp/ +; +; BUILD 9658 + +[Version] +Signature = "$Windows NT$" +Class = Net +ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} +Provider = %CompanyName% +DriverVer = 02/04/2018, 4.25.0.9658 +CatalogFile.NT = Neo6_x64_VPN98.cat + +[Manufacturer] +%CompanyName% = SoftEther, NTamd64 + +[SourceDisksNames] +1=%DiskDescription%, "", , + +[SourceDisksFiles] +Neo6_x64_VPN98.sys = 1 + +[DestinationDirs] +DefaultDestDir = 12 +Neo.CopyFiles.Sys = 12 + +[Neo.CopyFiles.Sys] +Neo6_x64_VPN98.sys, , , 2 + +[SoftEther.NTamd64] +%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN98 + +[NeoAdapter.Install] +Characteristics = 0x1 +AddReg = Neo.Reg, NeoAdapter.Ndi +CopyFiles = Neo.CopyFiles.Sys +*IfType = 53 +*MediaType = 0 +*PhysicalMediaType = 0 + +[NeoAdapter.Install.Services] +AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% + +[NeoAdapter.Ndi] +HKR, , NetworkAddress, 0, %DefaultAddress% +HKR, Ndi, DeviceID, , "NeoAdapter_VPN98" +HKR, , DevLoader, , ndis +HKR, , DeviceVxDs, , Neo6_x64_VPN98.sys +HKR, NDIS, LogDriverName, , "Neo_VPN98" +HKR, NDIS, MajorNdisVersion, 1, 5 +HKR, NDIS, MinorNdisVersion, 1, 0 +HKR, Ndi\Interfaces, DefUpper, , "ndis5" +HKR, Ndi\Interfaces, UpperRange, , "ndis5" +HKR, Ndi\Interfaces, LowerRange, , "ethernet" +HKR, Ndi\Interfaces, DefLower, , "ethernet" +HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" +HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% +HKR, Ndi\Params\NetworkAddress, type, 0, "edit" +HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" +HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" +HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% +HKR, Ndi\Params\NetworkAddress, optional, 0, "0" +HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% +HKR, Ndi\Params\MaxSpeed, type, 0, "int" +HKR, Ndi\Params\MaxSpeed, default, 0, "100" +HKR, Ndi\Params\MaxSpeed, min, 0, "0" +HKR, Ndi\Params\MaxSpeed, max, 0, "2000" +HKR, Ndi\Params\MaxSpeed, step, 0, "1" +HKR, Ndi\Params\MaxSpeed, Base, 0, "10" +HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% +HKR, Ndi\Params\KeepLink, type, 0, "enum" +HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% +HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% +HKR, Ndi\Params\KeepLink, default, 0, "0" + + +[Neo.Service] +DisplayName = %Neo.Service.DispName% +Description = %Neo.Service.Desc% +ServiceType = 1 +StartType = 3 +ErrorControl = 1 +ServiceBinary = %12%\Neo6_x64_VPN98.sys +LoadOrderGroup = NDIS + +[Neo.Reg] +HKR, Ndi, Service, 0, Neo.Service.Name +HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" +HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" + +[Neo.EventLog] +HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo6_x64_VPN98.sys" +HKR, , TypesSupported, 0x00010001, 7 + +[Strings] +CompanyName = "SoftEther Corporation" +DiskDescription = "VPN Client Device Driver Install Disk" +Neo.Service.Name = "Neo_VPN98" +Neo.Service.DispName = "VPN Client Device Driver - VPN98" +Neo.Service.Desc = "VPN Client Adapter - VPN98" +NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN98" +Neo.EventLog.Name = "Neo" +NetworkAddress = "MAC Address" +DefaultAddress = "000001000001" +MaxSpeed = "Indicate Speed (Mbps)" +KeepLink = "Keep Link" +On = "On" +Off = "Off" + + +; Auto Generated 20180205_163628.298 + diff --git a/src/bin/hamcore/DriverPackages/Neo6_Win10/x64/Neo6_x64_VPN99.inf b/src/bin/hamcore/DriverPackages/Neo6_Win10/x64/Neo6_x64_VPN99.inf index b7a594d6..0e5c2b79 100644 --- a/src/bin/hamcore/DriverPackages/Neo6_Win10/x64/Neo6_x64_VPN99.inf +++ b/src/bin/hamcore/DriverPackages/Neo6_Win10/x64/Neo6_x64_VPN99.inf @@ -1,114 +1,114 @@ -; VPN Client Device Driver for Windows 2000 and Greater -; -; Copyright (c) SoftEther Corporation. All Rights Reserved. -; http://www.softether.co.jp/ -; -; BUILD 9658 - -[Version] -Signature = "$Windows NT$" -Class = Net -ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} -Provider = %CompanyName% -DriverVer = 02/04/2018, 4.25.0.9658 -CatalogFile.NT = Neo6_x64_VPN99.cat - -[Manufacturer] -%CompanyName% = SoftEther, NTamd64 - -[SourceDisksNames] -1=%DiskDescription%, "", , - -[SourceDisksFiles] -Neo6_x64_VPN99.sys = 1 - -[DestinationDirs] -DefaultDestDir = 12 -Neo.CopyFiles.Sys = 12 - -[Neo.CopyFiles.Sys] -Neo6_x64_VPN99.sys, , , 2 - -[SoftEther.NTamd64] -%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN99 - -[NeoAdapter.Install] -Characteristics = 0x1 -AddReg = Neo.Reg, NeoAdapter.Ndi -CopyFiles = Neo.CopyFiles.Sys -*IfType = 53 -*MediaType = 0 -*PhysicalMediaType = 0 - -[NeoAdapter.Install.Services] -AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% - -[NeoAdapter.Ndi] -HKR, , NetworkAddress, 0, %DefaultAddress% -HKR, Ndi, DeviceID, , "NeoAdapter_VPN99" -HKR, , DevLoader, , ndis -HKR, , DeviceVxDs, , Neo6_x64_VPN99.sys -HKR, NDIS, LogDriverName, , "Neo_VPN99" -HKR, NDIS, MajorNdisVersion, 1, 5 -HKR, NDIS, MinorNdisVersion, 1, 0 -HKR, Ndi\Interfaces, DefUpper, , "ndis5" -HKR, Ndi\Interfaces, UpperRange, , "ndis5" -HKR, Ndi\Interfaces, LowerRange, , "ethernet" -HKR, Ndi\Interfaces, DefLower, , "ethernet" -HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" -HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% -HKR, Ndi\Params\NetworkAddress, type, 0, "edit" -HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" -HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" -HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% -HKR, Ndi\Params\NetworkAddress, optional, 0, "0" -HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% -HKR, Ndi\Params\MaxSpeed, type, 0, "int" -HKR, Ndi\Params\MaxSpeed, default, 0, "100" -HKR, Ndi\Params\MaxSpeed, min, 0, "0" -HKR, Ndi\Params\MaxSpeed, max, 0, "2000" -HKR, Ndi\Params\MaxSpeed, step, 0, "1" -HKR, Ndi\Params\MaxSpeed, Base, 0, "10" -HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% -HKR, Ndi\Params\KeepLink, type, 0, "enum" -HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% -HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% -HKR, Ndi\Params\KeepLink, default, 0, "0" - - -[Neo.Service] -DisplayName = %Neo.Service.DispName% -Description = %Neo.Service.Desc% -ServiceType = 1 -StartType = 3 -ErrorControl = 1 -ServiceBinary = %12%\Neo6_x64_VPN99.sys -LoadOrderGroup = NDIS - -[Neo.Reg] -HKR, Ndi, Service, 0, Neo.Service.Name -HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" -HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" - -[Neo.EventLog] -HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo6_x64_VPN99.sys" -HKR, , TypesSupported, 0x00010001, 7 - -[Strings] -CompanyName = "SoftEther Corporation" -DiskDescription = "VPN Client Device Driver Install Disk" -Neo.Service.Name = "Neo_VPN99" -Neo.Service.DispName = "VPN Client Device Driver - VPN99" -Neo.Service.Desc = "VPN Client Adapter - VPN99" -NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN99" -Neo.EventLog.Name = "Neo" -NetworkAddress = "MAC Address" -DefaultAddress = "000001000001" -MaxSpeed = "Indicate Speed (Mbps)" -KeepLink = "Keep Link" -On = "On" -Off = "Off" - - -; Auto Generated 20180205_163628.370 - +; VPN Client Device Driver for Windows 2000 and Greater +; +; Copyright (c) SoftEther Corporation. All Rights Reserved. +; http://www.softether.co.jp/ +; +; BUILD 9658 + +[Version] +Signature = "$Windows NT$" +Class = Net +ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} +Provider = %CompanyName% +DriverVer = 02/04/2018, 4.25.0.9658 +CatalogFile.NT = Neo6_x64_VPN99.cat + +[Manufacturer] +%CompanyName% = SoftEther, NTamd64 + +[SourceDisksNames] +1=%DiskDescription%, "", , + +[SourceDisksFiles] +Neo6_x64_VPN99.sys = 1 + +[DestinationDirs] +DefaultDestDir = 12 +Neo.CopyFiles.Sys = 12 + +[Neo.CopyFiles.Sys] +Neo6_x64_VPN99.sys, , , 2 + +[SoftEther.NTamd64] +%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN99 + +[NeoAdapter.Install] +Characteristics = 0x1 +AddReg = Neo.Reg, NeoAdapter.Ndi +CopyFiles = Neo.CopyFiles.Sys +*IfType = 53 +*MediaType = 0 +*PhysicalMediaType = 0 + +[NeoAdapter.Install.Services] +AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% + +[NeoAdapter.Ndi] +HKR, , NetworkAddress, 0, %DefaultAddress% +HKR, Ndi, DeviceID, , "NeoAdapter_VPN99" +HKR, , DevLoader, , ndis +HKR, , DeviceVxDs, , Neo6_x64_VPN99.sys +HKR, NDIS, LogDriverName, , "Neo_VPN99" +HKR, NDIS, MajorNdisVersion, 1, 5 +HKR, NDIS, MinorNdisVersion, 1, 0 +HKR, Ndi\Interfaces, DefUpper, , "ndis5" +HKR, Ndi\Interfaces, UpperRange, , "ndis5" +HKR, Ndi\Interfaces, LowerRange, , "ethernet" +HKR, Ndi\Interfaces, DefLower, , "ethernet" +HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" +HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% +HKR, Ndi\Params\NetworkAddress, type, 0, "edit" +HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" +HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" +HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% +HKR, Ndi\Params\NetworkAddress, optional, 0, "0" +HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% +HKR, Ndi\Params\MaxSpeed, type, 0, "int" +HKR, Ndi\Params\MaxSpeed, default, 0, "100" +HKR, Ndi\Params\MaxSpeed, min, 0, "0" +HKR, Ndi\Params\MaxSpeed, max, 0, "2000" +HKR, Ndi\Params\MaxSpeed, step, 0, "1" +HKR, Ndi\Params\MaxSpeed, Base, 0, "10" +HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% +HKR, Ndi\Params\KeepLink, type, 0, "enum" +HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% +HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% +HKR, Ndi\Params\KeepLink, default, 0, "0" + + +[Neo.Service] +DisplayName = %Neo.Service.DispName% +Description = %Neo.Service.Desc% +ServiceType = 1 +StartType = 3 +ErrorControl = 1 +ServiceBinary = %12%\Neo6_x64_VPN99.sys +LoadOrderGroup = NDIS + +[Neo.Reg] +HKR, Ndi, Service, 0, Neo.Service.Name +HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" +HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" + +[Neo.EventLog] +HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo6_x64_VPN99.sys" +HKR, , TypesSupported, 0x00010001, 7 + +[Strings] +CompanyName = "SoftEther Corporation" +DiskDescription = "VPN Client Device Driver Install Disk" +Neo.Service.Name = "Neo_VPN99" +Neo.Service.DispName = "VPN Client Device Driver - VPN99" +Neo.Service.Desc = "VPN Client Adapter - VPN99" +NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN99" +Neo.EventLog.Name = "Neo" +NetworkAddress = "MAC Address" +DefaultAddress = "000001000001" +MaxSpeed = "Indicate Speed (Mbps)" +KeepLink = "Keep Link" +On = "On" +Off = "Off" + + +; Auto Generated 20180205_163628.370 + diff --git a/src/bin/hamcore/DriverPackages/Neo6_Win10/x86/Neo6_x86_VPN.inf b/src/bin/hamcore/DriverPackages/Neo6_Win10/x86/Neo6_x86_VPN.inf index 6b2f9cb5..415c9b68 100644 --- a/src/bin/hamcore/DriverPackages/Neo6_Win10/x86/Neo6_x86_VPN.inf +++ b/src/bin/hamcore/DriverPackages/Neo6_Win10/x86/Neo6_x86_VPN.inf @@ -1,114 +1,114 @@ -; VPN Client Device Driver for Windows 2000 and Greater -; -; Copyright (c) SoftEther Corporation. All Rights Reserved. -; http://www.softether.co.jp/ -; -; BUILD 9658 - -[Version] -Signature = "$Windows NT$" -Class = Net -ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} -Provider = %CompanyName% -DriverVer = 02/04/2018, 4.25.0.9658 -CatalogFile.NT = Neo6_x86_VPN.cat - -[Manufacturer] -%CompanyName% = SoftEther - -[SourceDisksNames] -1=%DiskDescription%, "", , - -[SourceDisksFiles] -Neo6_x86_VPN.sys = 1 - -[DestinationDirs] -DefaultDestDir = 12 -Neo.CopyFiles.Sys = 12 - -[Neo.CopyFiles.Sys] -Neo6_x86_VPN.sys, , , 2 - -[SoftEther] -%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN - -[NeoAdapter.Install] -Characteristics = 0x1 -AddReg = Neo.Reg, NeoAdapter.Ndi -CopyFiles = Neo.CopyFiles.Sys -*IfType = 53 -*MediaType = 0 -*PhysicalMediaType = 0 - -[NeoAdapter.Install.Services] -AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% - -[NeoAdapter.Ndi] -HKR, , NetworkAddress, 0, %DefaultAddress% -HKR, Ndi, DeviceID, , "NeoAdapter_VPN" -HKR, , DevLoader, , ndis -HKR, , DeviceVxDs, , Neo6_x86_VPN.sys -HKR, NDIS, LogDriverName, , "Neo_VPN" -HKR, NDIS, MajorNdisVersion, 1, 5 -HKR, NDIS, MinorNdisVersion, 1, 0 -HKR, Ndi\Interfaces, DefUpper, , "ndis5" -HKR, Ndi\Interfaces, UpperRange, , "ndis5" -HKR, Ndi\Interfaces, LowerRange, , "ethernet" -HKR, Ndi\Interfaces, DefLower, , "ethernet" -HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" -HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% -HKR, Ndi\Params\NetworkAddress, type, 0, "edit" -HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" -HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" -HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% -HKR, Ndi\Params\NetworkAddress, optional, 0, "0" -HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% -HKR, Ndi\Params\MaxSpeed, type, 0, "int" -HKR, Ndi\Params\MaxSpeed, default, 0, "100" -HKR, Ndi\Params\MaxSpeed, min, 0, "0" -HKR, Ndi\Params\MaxSpeed, max, 0, "2000" -HKR, Ndi\Params\MaxSpeed, step, 0, "1" -HKR, Ndi\Params\MaxSpeed, Base, 0, "10" -HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% -HKR, Ndi\Params\KeepLink, type, 0, "enum" -HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% -HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% -HKR, Ndi\Params\KeepLink, default, 0, "0" - - -[Neo.Service] -DisplayName = %Neo.Service.DispName% -Description = %Neo.Service.Desc% -ServiceType = 1 -StartType = 3 -ErrorControl = 1 -ServiceBinary = %12%\Neo6_x86_VPN.sys -LoadOrderGroup = NDIS - -[Neo.Reg] -HKR, Ndi, Service, 0, Neo.Service.Name -HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" -HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" - -[Neo.EventLog] -HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN.sys" -HKR, , TypesSupported, 0x00010001, 7 - -[Strings] -CompanyName = "SoftEther Corporation" -DiskDescription = "VPN Client Device Driver Install Disk" -Neo.Service.Name = "Neo_VPN" -Neo.Service.DispName = "VPN Client Device Driver - VPN" -Neo.Service.Desc = "VPN Client Adapter - VPN" -NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN" -Neo.EventLog.Name = "Neo" -NetworkAddress = "MAC Address" -DefaultAddress = "000001000001" -MaxSpeed = "Indicate Speed (Mbps)" -KeepLink = "Keep Link" -On = "On" -Off = "Off" - - -; Auto Generated 20180205_163612.334 - +; VPN Client Device Driver for Windows 2000 and Greater +; +; Copyright (c) SoftEther Corporation. All Rights Reserved. +; http://www.softether.co.jp/ +; +; BUILD 9658 + +[Version] +Signature = "$Windows NT$" +Class = Net +ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} +Provider = %CompanyName% +DriverVer = 02/04/2018, 4.25.0.9658 +CatalogFile.NT = Neo6_x86_VPN.cat + +[Manufacturer] +%CompanyName% = SoftEther + +[SourceDisksNames] +1=%DiskDescription%, "", , + +[SourceDisksFiles] +Neo6_x86_VPN.sys = 1 + +[DestinationDirs] +DefaultDestDir = 12 +Neo.CopyFiles.Sys = 12 + +[Neo.CopyFiles.Sys] +Neo6_x86_VPN.sys, , , 2 + +[SoftEther] +%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN + +[NeoAdapter.Install] +Characteristics = 0x1 +AddReg = Neo.Reg, NeoAdapter.Ndi +CopyFiles = Neo.CopyFiles.Sys +*IfType = 53 +*MediaType = 0 +*PhysicalMediaType = 0 + +[NeoAdapter.Install.Services] +AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% + +[NeoAdapter.Ndi] +HKR, , NetworkAddress, 0, %DefaultAddress% +HKR, Ndi, DeviceID, , "NeoAdapter_VPN" +HKR, , DevLoader, , ndis +HKR, , DeviceVxDs, , Neo6_x86_VPN.sys +HKR, NDIS, LogDriverName, , "Neo_VPN" +HKR, NDIS, MajorNdisVersion, 1, 5 +HKR, NDIS, MinorNdisVersion, 1, 0 +HKR, Ndi\Interfaces, DefUpper, , "ndis5" +HKR, Ndi\Interfaces, UpperRange, , "ndis5" +HKR, Ndi\Interfaces, LowerRange, , "ethernet" +HKR, Ndi\Interfaces, DefLower, , "ethernet" +HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" +HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% +HKR, Ndi\Params\NetworkAddress, type, 0, "edit" +HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" +HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" +HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% +HKR, Ndi\Params\NetworkAddress, optional, 0, "0" +HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% +HKR, Ndi\Params\MaxSpeed, type, 0, "int" +HKR, Ndi\Params\MaxSpeed, default, 0, "100" +HKR, Ndi\Params\MaxSpeed, min, 0, "0" +HKR, Ndi\Params\MaxSpeed, max, 0, "2000" +HKR, Ndi\Params\MaxSpeed, step, 0, "1" +HKR, Ndi\Params\MaxSpeed, Base, 0, "10" +HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% +HKR, Ndi\Params\KeepLink, type, 0, "enum" +HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% +HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% +HKR, Ndi\Params\KeepLink, default, 0, "0" + + +[Neo.Service] +DisplayName = %Neo.Service.DispName% +Description = %Neo.Service.Desc% +ServiceType = 1 +StartType = 3 +ErrorControl = 1 +ServiceBinary = %12%\Neo6_x86_VPN.sys +LoadOrderGroup = NDIS + +[Neo.Reg] +HKR, Ndi, Service, 0, Neo.Service.Name +HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" +HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" + +[Neo.EventLog] +HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN.sys" +HKR, , TypesSupported, 0x00010001, 7 + +[Strings] +CompanyName = "SoftEther Corporation" +DiskDescription = "VPN Client Device Driver Install Disk" +Neo.Service.Name = "Neo_VPN" +Neo.Service.DispName = "VPN Client Device Driver - VPN" +Neo.Service.Desc = "VPN Client Adapter - VPN" +NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN" +Neo.EventLog.Name = "Neo" +NetworkAddress = "MAC Address" +DefaultAddress = "000001000001" +MaxSpeed = "Indicate Speed (Mbps)" +KeepLink = "Keep Link" +On = "On" +Off = "Off" + + +; Auto Generated 20180205_163612.334 + diff --git a/src/bin/hamcore/DriverPackages/Neo6_Win10/x86/Neo6_x86_VPN10.inf b/src/bin/hamcore/DriverPackages/Neo6_Win10/x86/Neo6_x86_VPN10.inf index 27545286..9254b898 100644 --- a/src/bin/hamcore/DriverPackages/Neo6_Win10/x86/Neo6_x86_VPN10.inf +++ b/src/bin/hamcore/DriverPackages/Neo6_Win10/x86/Neo6_x86_VPN10.inf @@ -1,114 +1,114 @@ -; VPN Client Device Driver for Windows 2000 and Greater -; -; Copyright (c) SoftEther Corporation. All Rights Reserved. -; http://www.softether.co.jp/ -; -; BUILD 9658 - -[Version] -Signature = "$Windows NT$" -Class = Net -ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} -Provider = %CompanyName% -DriverVer = 02/04/2018, 4.25.0.9658 -CatalogFile.NT = Neo6_x86_VPN10.cat - -[Manufacturer] -%CompanyName% = SoftEther - -[SourceDisksNames] -1=%DiskDescription%, "", , - -[SourceDisksFiles] -Neo6_x86_VPN10.sys = 1 - -[DestinationDirs] -DefaultDestDir = 12 -Neo.CopyFiles.Sys = 12 - -[Neo.CopyFiles.Sys] -Neo6_x86_VPN10.sys, , , 2 - -[SoftEther] -%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN10 - -[NeoAdapter.Install] -Characteristics = 0x1 -AddReg = Neo.Reg, NeoAdapter.Ndi -CopyFiles = Neo.CopyFiles.Sys -*IfType = 53 -*MediaType = 0 -*PhysicalMediaType = 0 - -[NeoAdapter.Install.Services] -AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% - -[NeoAdapter.Ndi] -HKR, , NetworkAddress, 0, %DefaultAddress% -HKR, Ndi, DeviceID, , "NeoAdapter_VPN10" -HKR, , DevLoader, , ndis -HKR, , DeviceVxDs, , Neo6_x86_VPN10.sys -HKR, NDIS, LogDriverName, , "Neo_VPN10" -HKR, NDIS, MajorNdisVersion, 1, 5 -HKR, NDIS, MinorNdisVersion, 1, 0 -HKR, Ndi\Interfaces, DefUpper, , "ndis5" -HKR, Ndi\Interfaces, UpperRange, , "ndis5" -HKR, Ndi\Interfaces, LowerRange, , "ethernet" -HKR, Ndi\Interfaces, DefLower, , "ethernet" -HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" -HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% -HKR, Ndi\Params\NetworkAddress, type, 0, "edit" -HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" -HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" -HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% -HKR, Ndi\Params\NetworkAddress, optional, 0, "0" -HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% -HKR, Ndi\Params\MaxSpeed, type, 0, "int" -HKR, Ndi\Params\MaxSpeed, default, 0, "100" -HKR, Ndi\Params\MaxSpeed, min, 0, "0" -HKR, Ndi\Params\MaxSpeed, max, 0, "2000" -HKR, Ndi\Params\MaxSpeed, step, 0, "1" -HKR, Ndi\Params\MaxSpeed, Base, 0, "10" -HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% -HKR, Ndi\Params\KeepLink, type, 0, "enum" -HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% -HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% -HKR, Ndi\Params\KeepLink, default, 0, "0" - - -[Neo.Service] -DisplayName = %Neo.Service.DispName% -Description = %Neo.Service.Desc% -ServiceType = 1 -StartType = 3 -ErrorControl = 1 -ServiceBinary = %12%\Neo6_x86_VPN10.sys -LoadOrderGroup = NDIS - -[Neo.Reg] -HKR, Ndi, Service, 0, Neo.Service.Name -HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" -HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" - -[Neo.EventLog] -HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN10.sys" -HKR, , TypesSupported, 0x00010001, 7 - -[Strings] -CompanyName = "SoftEther Corporation" -DiskDescription = "VPN Client Device Driver Install Disk" -Neo.Service.Name = "Neo_VPN10" -Neo.Service.DispName = "VPN Client Device Driver - VPN10" -Neo.Service.Desc = "VPN Client Adapter - VPN10" -NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN10" -Neo.EventLog.Name = "Neo" -NetworkAddress = "MAC Address" -DefaultAddress = "000001000001" -MaxSpeed = "Indicate Speed (Mbps)" -KeepLink = "Keep Link" -On = "On" -Off = "Off" - - -; Auto Generated 20180205_163612.975 - +; VPN Client Device Driver for Windows 2000 and Greater +; +; Copyright (c) SoftEther Corporation. All Rights Reserved. +; http://www.softether.co.jp/ +; +; BUILD 9658 + +[Version] +Signature = "$Windows NT$" +Class = Net +ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} +Provider = %CompanyName% +DriverVer = 02/04/2018, 4.25.0.9658 +CatalogFile.NT = Neo6_x86_VPN10.cat + +[Manufacturer] +%CompanyName% = SoftEther + +[SourceDisksNames] +1=%DiskDescription%, "", , + +[SourceDisksFiles] +Neo6_x86_VPN10.sys = 1 + +[DestinationDirs] +DefaultDestDir = 12 +Neo.CopyFiles.Sys = 12 + +[Neo.CopyFiles.Sys] +Neo6_x86_VPN10.sys, , , 2 + +[SoftEther] +%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN10 + +[NeoAdapter.Install] +Characteristics = 0x1 +AddReg = Neo.Reg, NeoAdapter.Ndi +CopyFiles = Neo.CopyFiles.Sys +*IfType = 53 +*MediaType = 0 +*PhysicalMediaType = 0 + +[NeoAdapter.Install.Services] +AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% + +[NeoAdapter.Ndi] +HKR, , NetworkAddress, 0, %DefaultAddress% +HKR, Ndi, DeviceID, , "NeoAdapter_VPN10" +HKR, , DevLoader, , ndis +HKR, , DeviceVxDs, , Neo6_x86_VPN10.sys +HKR, NDIS, LogDriverName, , "Neo_VPN10" +HKR, NDIS, MajorNdisVersion, 1, 5 +HKR, NDIS, MinorNdisVersion, 1, 0 +HKR, Ndi\Interfaces, DefUpper, , "ndis5" +HKR, Ndi\Interfaces, UpperRange, , "ndis5" +HKR, Ndi\Interfaces, LowerRange, , "ethernet" +HKR, Ndi\Interfaces, DefLower, , "ethernet" +HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" +HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% +HKR, Ndi\Params\NetworkAddress, type, 0, "edit" +HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" +HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" +HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% +HKR, Ndi\Params\NetworkAddress, optional, 0, "0" +HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% +HKR, Ndi\Params\MaxSpeed, type, 0, "int" +HKR, Ndi\Params\MaxSpeed, default, 0, "100" +HKR, Ndi\Params\MaxSpeed, min, 0, "0" +HKR, Ndi\Params\MaxSpeed, max, 0, "2000" +HKR, Ndi\Params\MaxSpeed, step, 0, "1" +HKR, Ndi\Params\MaxSpeed, Base, 0, "10" +HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% +HKR, Ndi\Params\KeepLink, type, 0, "enum" +HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% +HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% +HKR, Ndi\Params\KeepLink, default, 0, "0" + + +[Neo.Service] +DisplayName = %Neo.Service.DispName% +Description = %Neo.Service.Desc% +ServiceType = 1 +StartType = 3 +ErrorControl = 1 +ServiceBinary = %12%\Neo6_x86_VPN10.sys +LoadOrderGroup = NDIS + +[Neo.Reg] +HKR, Ndi, Service, 0, Neo.Service.Name +HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" +HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" + +[Neo.EventLog] +HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN10.sys" +HKR, , TypesSupported, 0x00010001, 7 + +[Strings] +CompanyName = "SoftEther Corporation" +DiskDescription = "VPN Client Device Driver Install Disk" +Neo.Service.Name = "Neo_VPN10" +Neo.Service.DispName = "VPN Client Device Driver - VPN10" +Neo.Service.Desc = "VPN Client Adapter - VPN10" +NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN10" +Neo.EventLog.Name = "Neo" +NetworkAddress = "MAC Address" +DefaultAddress = "000001000001" +MaxSpeed = "Indicate Speed (Mbps)" +KeepLink = "Keep Link" +On = "On" +Off = "Off" + + +; Auto Generated 20180205_163612.975 + diff --git a/src/bin/hamcore/DriverPackages/Neo6_Win10/x86/Neo6_x86_VPN100.inf b/src/bin/hamcore/DriverPackages/Neo6_Win10/x86/Neo6_x86_VPN100.inf index ae08f775..86c77fbd 100644 --- a/src/bin/hamcore/DriverPackages/Neo6_Win10/x86/Neo6_x86_VPN100.inf +++ b/src/bin/hamcore/DriverPackages/Neo6_Win10/x86/Neo6_x86_VPN100.inf @@ -1,114 +1,114 @@ -; VPN Client Device Driver for Windows 2000 and Greater -; -; Copyright (c) SoftEther Corporation. All Rights Reserved. -; http://www.softether.co.jp/ -; -; BUILD 9658 - -[Version] -Signature = "$Windows NT$" -Class = Net -ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} -Provider = %CompanyName% -DriverVer = 02/04/2018, 4.25.0.9658 -CatalogFile.NT = Neo6_x86_VPN100.cat - -[Manufacturer] -%CompanyName% = SoftEther - -[SourceDisksNames] -1=%DiskDescription%, "", , - -[SourceDisksFiles] -Neo6_x86_VPN100.sys = 1 - -[DestinationDirs] -DefaultDestDir = 12 -Neo.CopyFiles.Sys = 12 - -[Neo.CopyFiles.Sys] -Neo6_x86_VPN100.sys, , , 2 - -[SoftEther] -%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN100 - -[NeoAdapter.Install] -Characteristics = 0x1 -AddReg = Neo.Reg, NeoAdapter.Ndi -CopyFiles = Neo.CopyFiles.Sys -*IfType = 53 -*MediaType = 0 -*PhysicalMediaType = 0 - -[NeoAdapter.Install.Services] -AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% - -[NeoAdapter.Ndi] -HKR, , NetworkAddress, 0, %DefaultAddress% -HKR, Ndi, DeviceID, , "NeoAdapter_VPN100" -HKR, , DevLoader, , ndis -HKR, , DeviceVxDs, , Neo6_x86_VPN100.sys -HKR, NDIS, LogDriverName, , "Neo_VPN100" -HKR, NDIS, MajorNdisVersion, 1, 5 -HKR, NDIS, MinorNdisVersion, 1, 0 -HKR, Ndi\Interfaces, DefUpper, , "ndis5" -HKR, Ndi\Interfaces, UpperRange, , "ndis5" -HKR, Ndi\Interfaces, LowerRange, , "ethernet" -HKR, Ndi\Interfaces, DefLower, , "ethernet" -HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" -HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% -HKR, Ndi\Params\NetworkAddress, type, 0, "edit" -HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" -HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" -HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% -HKR, Ndi\Params\NetworkAddress, optional, 0, "0" -HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% -HKR, Ndi\Params\MaxSpeed, type, 0, "int" -HKR, Ndi\Params\MaxSpeed, default, 0, "100" -HKR, Ndi\Params\MaxSpeed, min, 0, "0" -HKR, Ndi\Params\MaxSpeed, max, 0, "2000" -HKR, Ndi\Params\MaxSpeed, step, 0, "1" -HKR, Ndi\Params\MaxSpeed, Base, 0, "10" -HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% -HKR, Ndi\Params\KeepLink, type, 0, "enum" -HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% -HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% -HKR, Ndi\Params\KeepLink, default, 0, "0" - - -[Neo.Service] -DisplayName = %Neo.Service.DispName% -Description = %Neo.Service.Desc% -ServiceType = 1 -StartType = 3 -ErrorControl = 1 -ServiceBinary = %12%\Neo6_x86_VPN100.sys -LoadOrderGroup = NDIS - -[Neo.Reg] -HKR, Ndi, Service, 0, Neo.Service.Name -HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" -HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" - -[Neo.EventLog] -HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN100.sys" -HKR, , TypesSupported, 0x00010001, 7 - -[Strings] -CompanyName = "SoftEther Corporation" -DiskDescription = "VPN Client Device Driver Install Disk" -Neo.Service.Name = "Neo_VPN100" -Neo.Service.DispName = "VPN Client Device Driver - VPN100" -Neo.Service.Desc = "VPN Client Adapter - VPN100" -NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN100" -Neo.EventLog.Name = "Neo" -NetworkAddress = "MAC Address" -DefaultAddress = "000001000001" -MaxSpeed = "Indicate Speed (Mbps)" -KeepLink = "Keep Link" -On = "On" -Off = "Off" - - -; Auto Generated 20180205_163619.389 - +; VPN Client Device Driver for Windows 2000 and Greater +; +; Copyright (c) SoftEther Corporation. All Rights Reserved. +; http://www.softether.co.jp/ +; +; BUILD 9658 + +[Version] +Signature = "$Windows NT$" +Class = Net +ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} +Provider = %CompanyName% +DriverVer = 02/04/2018, 4.25.0.9658 +CatalogFile.NT = Neo6_x86_VPN100.cat + +[Manufacturer] +%CompanyName% = SoftEther + +[SourceDisksNames] +1=%DiskDescription%, "", , + +[SourceDisksFiles] +Neo6_x86_VPN100.sys = 1 + +[DestinationDirs] +DefaultDestDir = 12 +Neo.CopyFiles.Sys = 12 + +[Neo.CopyFiles.Sys] +Neo6_x86_VPN100.sys, , , 2 + +[SoftEther] +%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN100 + +[NeoAdapter.Install] +Characteristics = 0x1 +AddReg = Neo.Reg, NeoAdapter.Ndi +CopyFiles = Neo.CopyFiles.Sys +*IfType = 53 +*MediaType = 0 +*PhysicalMediaType = 0 + +[NeoAdapter.Install.Services] +AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% + +[NeoAdapter.Ndi] +HKR, , NetworkAddress, 0, %DefaultAddress% +HKR, Ndi, DeviceID, , "NeoAdapter_VPN100" +HKR, , DevLoader, , ndis +HKR, , DeviceVxDs, , Neo6_x86_VPN100.sys +HKR, NDIS, LogDriverName, , "Neo_VPN100" +HKR, NDIS, MajorNdisVersion, 1, 5 +HKR, NDIS, MinorNdisVersion, 1, 0 +HKR, Ndi\Interfaces, DefUpper, , "ndis5" +HKR, Ndi\Interfaces, UpperRange, , "ndis5" +HKR, Ndi\Interfaces, LowerRange, , "ethernet" +HKR, Ndi\Interfaces, DefLower, , "ethernet" +HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" +HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% +HKR, Ndi\Params\NetworkAddress, type, 0, "edit" +HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" +HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" +HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% +HKR, Ndi\Params\NetworkAddress, optional, 0, "0" +HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% +HKR, Ndi\Params\MaxSpeed, type, 0, "int" +HKR, Ndi\Params\MaxSpeed, default, 0, "100" +HKR, Ndi\Params\MaxSpeed, min, 0, "0" +HKR, Ndi\Params\MaxSpeed, max, 0, "2000" +HKR, Ndi\Params\MaxSpeed, step, 0, "1" +HKR, Ndi\Params\MaxSpeed, Base, 0, "10" +HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% +HKR, Ndi\Params\KeepLink, type, 0, "enum" +HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% +HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% +HKR, Ndi\Params\KeepLink, default, 0, "0" + + +[Neo.Service] +DisplayName = %Neo.Service.DispName% +Description = %Neo.Service.Desc% +ServiceType = 1 +StartType = 3 +ErrorControl = 1 +ServiceBinary = %12%\Neo6_x86_VPN100.sys +LoadOrderGroup = NDIS + +[Neo.Reg] +HKR, Ndi, Service, 0, Neo.Service.Name +HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" +HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" + +[Neo.EventLog] +HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN100.sys" +HKR, , TypesSupported, 0x00010001, 7 + +[Strings] +CompanyName = "SoftEther Corporation" +DiskDescription = "VPN Client Device Driver Install Disk" +Neo.Service.Name = "Neo_VPN100" +Neo.Service.DispName = "VPN Client Device Driver - VPN100" +Neo.Service.Desc = "VPN Client Adapter - VPN100" +NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN100" +Neo.EventLog.Name = "Neo" +NetworkAddress = "MAC Address" +DefaultAddress = "000001000001" +MaxSpeed = "Indicate Speed (Mbps)" +KeepLink = "Keep Link" +On = "On" +Off = "Off" + + +; Auto Generated 20180205_163619.389 + diff --git a/src/bin/hamcore/DriverPackages/Neo6_Win10/x86/Neo6_x86_VPN101.inf b/src/bin/hamcore/DriverPackages/Neo6_Win10/x86/Neo6_x86_VPN101.inf index 41910473..e3ad39f9 100644 --- a/src/bin/hamcore/DriverPackages/Neo6_Win10/x86/Neo6_x86_VPN101.inf +++ b/src/bin/hamcore/DriverPackages/Neo6_Win10/x86/Neo6_x86_VPN101.inf @@ -1,114 +1,114 @@ -; VPN Client Device Driver for Windows 2000 and Greater -; -; Copyright (c) SoftEther Corporation. All Rights Reserved. -; http://www.softether.co.jp/ -; -; BUILD 9658 - -[Version] -Signature = "$Windows NT$" -Class = Net -ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} -Provider = %CompanyName% -DriverVer = 02/04/2018, 4.25.0.9658 -CatalogFile.NT = Neo6_x86_VPN101.cat - -[Manufacturer] -%CompanyName% = SoftEther - -[SourceDisksNames] -1=%DiskDescription%, "", , - -[SourceDisksFiles] -Neo6_x86_VPN101.sys = 1 - -[DestinationDirs] -DefaultDestDir = 12 -Neo.CopyFiles.Sys = 12 - -[Neo.CopyFiles.Sys] -Neo6_x86_VPN101.sys, , , 2 - -[SoftEther] -%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN101 - -[NeoAdapter.Install] -Characteristics = 0x1 -AddReg = Neo.Reg, NeoAdapter.Ndi -CopyFiles = Neo.CopyFiles.Sys -*IfType = 53 -*MediaType = 0 -*PhysicalMediaType = 0 - -[NeoAdapter.Install.Services] -AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% - -[NeoAdapter.Ndi] -HKR, , NetworkAddress, 0, %DefaultAddress% -HKR, Ndi, DeviceID, , "NeoAdapter_VPN101" -HKR, , DevLoader, , ndis -HKR, , DeviceVxDs, , Neo6_x86_VPN101.sys -HKR, NDIS, LogDriverName, , "Neo_VPN101" -HKR, NDIS, MajorNdisVersion, 1, 5 -HKR, NDIS, MinorNdisVersion, 1, 0 -HKR, Ndi\Interfaces, DefUpper, , "ndis5" -HKR, Ndi\Interfaces, UpperRange, , "ndis5" -HKR, Ndi\Interfaces, LowerRange, , "ethernet" -HKR, Ndi\Interfaces, DefLower, , "ethernet" -HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" -HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% -HKR, Ndi\Params\NetworkAddress, type, 0, "edit" -HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" -HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" -HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% -HKR, Ndi\Params\NetworkAddress, optional, 0, "0" -HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% -HKR, Ndi\Params\MaxSpeed, type, 0, "int" -HKR, Ndi\Params\MaxSpeed, default, 0, "100" -HKR, Ndi\Params\MaxSpeed, min, 0, "0" -HKR, Ndi\Params\MaxSpeed, max, 0, "2000" -HKR, Ndi\Params\MaxSpeed, step, 0, "1" -HKR, Ndi\Params\MaxSpeed, Base, 0, "10" -HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% -HKR, Ndi\Params\KeepLink, type, 0, "enum" -HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% -HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% -HKR, Ndi\Params\KeepLink, default, 0, "0" - - -[Neo.Service] -DisplayName = %Neo.Service.DispName% -Description = %Neo.Service.Desc% -ServiceType = 1 -StartType = 3 -ErrorControl = 1 -ServiceBinary = %12%\Neo6_x86_VPN101.sys -LoadOrderGroup = NDIS - -[Neo.Reg] -HKR, Ndi, Service, 0, Neo.Service.Name -HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" -HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" - -[Neo.EventLog] -HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN101.sys" -HKR, , TypesSupported, 0x00010001, 7 - -[Strings] -CompanyName = "SoftEther Corporation" -DiskDescription = "VPN Client Device Driver Install Disk" -Neo.Service.Name = "Neo_VPN101" -Neo.Service.DispName = "VPN Client Device Driver - VPN101" -Neo.Service.Desc = "VPN Client Adapter - VPN101" -NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN101" -Neo.EventLog.Name = "Neo" -NetworkAddress = "MAC Address" -DefaultAddress = "000001000001" -MaxSpeed = "Indicate Speed (Mbps)" -KeepLink = "Keep Link" -On = "On" -Off = "Off" - - -; Auto Generated 20180205_163619.460 - +; VPN Client Device Driver for Windows 2000 and Greater +; +; Copyright (c) SoftEther Corporation. All Rights Reserved. +; http://www.softether.co.jp/ +; +; BUILD 9658 + +[Version] +Signature = "$Windows NT$" +Class = Net +ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} +Provider = %CompanyName% +DriverVer = 02/04/2018, 4.25.0.9658 +CatalogFile.NT = Neo6_x86_VPN101.cat + +[Manufacturer] +%CompanyName% = SoftEther + +[SourceDisksNames] +1=%DiskDescription%, "", , + +[SourceDisksFiles] +Neo6_x86_VPN101.sys = 1 + +[DestinationDirs] +DefaultDestDir = 12 +Neo.CopyFiles.Sys = 12 + +[Neo.CopyFiles.Sys] +Neo6_x86_VPN101.sys, , , 2 + +[SoftEther] +%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN101 + +[NeoAdapter.Install] +Characteristics = 0x1 +AddReg = Neo.Reg, NeoAdapter.Ndi +CopyFiles = Neo.CopyFiles.Sys +*IfType = 53 +*MediaType = 0 +*PhysicalMediaType = 0 + +[NeoAdapter.Install.Services] +AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% + +[NeoAdapter.Ndi] +HKR, , NetworkAddress, 0, %DefaultAddress% +HKR, Ndi, DeviceID, , "NeoAdapter_VPN101" +HKR, , DevLoader, , ndis +HKR, , DeviceVxDs, , Neo6_x86_VPN101.sys +HKR, NDIS, LogDriverName, , "Neo_VPN101" +HKR, NDIS, MajorNdisVersion, 1, 5 +HKR, NDIS, MinorNdisVersion, 1, 0 +HKR, Ndi\Interfaces, DefUpper, , "ndis5" +HKR, Ndi\Interfaces, UpperRange, , "ndis5" +HKR, Ndi\Interfaces, LowerRange, , "ethernet" +HKR, Ndi\Interfaces, DefLower, , "ethernet" +HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" +HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% +HKR, Ndi\Params\NetworkAddress, type, 0, "edit" +HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" +HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" +HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% +HKR, Ndi\Params\NetworkAddress, optional, 0, "0" +HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% +HKR, Ndi\Params\MaxSpeed, type, 0, "int" +HKR, Ndi\Params\MaxSpeed, default, 0, "100" +HKR, Ndi\Params\MaxSpeed, min, 0, "0" +HKR, Ndi\Params\MaxSpeed, max, 0, "2000" +HKR, Ndi\Params\MaxSpeed, step, 0, "1" +HKR, Ndi\Params\MaxSpeed, Base, 0, "10" +HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% +HKR, Ndi\Params\KeepLink, type, 0, "enum" +HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% +HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% +HKR, Ndi\Params\KeepLink, default, 0, "0" + + +[Neo.Service] +DisplayName = %Neo.Service.DispName% +Description = %Neo.Service.Desc% +ServiceType = 1 +StartType = 3 +ErrorControl = 1 +ServiceBinary = %12%\Neo6_x86_VPN101.sys +LoadOrderGroup = NDIS + +[Neo.Reg] +HKR, Ndi, Service, 0, Neo.Service.Name +HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" +HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" + +[Neo.EventLog] +HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN101.sys" +HKR, , TypesSupported, 0x00010001, 7 + +[Strings] +CompanyName = "SoftEther Corporation" +DiskDescription = "VPN Client Device Driver Install Disk" +Neo.Service.Name = "Neo_VPN101" +Neo.Service.DispName = "VPN Client Device Driver - VPN101" +Neo.Service.Desc = "VPN Client Adapter - VPN101" +NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN101" +Neo.EventLog.Name = "Neo" +NetworkAddress = "MAC Address" +DefaultAddress = "000001000001" +MaxSpeed = "Indicate Speed (Mbps)" +KeepLink = "Keep Link" +On = "On" +Off = "Off" + + +; Auto Generated 20180205_163619.460 + diff --git a/src/bin/hamcore/DriverPackages/Neo6_Win10/x86/Neo6_x86_VPN102.inf b/src/bin/hamcore/DriverPackages/Neo6_Win10/x86/Neo6_x86_VPN102.inf index aad38cca..79b77019 100644 --- a/src/bin/hamcore/DriverPackages/Neo6_Win10/x86/Neo6_x86_VPN102.inf +++ b/src/bin/hamcore/DriverPackages/Neo6_Win10/x86/Neo6_x86_VPN102.inf @@ -1,114 +1,114 @@ -; VPN Client Device Driver for Windows 2000 and Greater -; -; Copyright (c) SoftEther Corporation. All Rights Reserved. -; http://www.softether.co.jp/ -; -; BUILD 9658 - -[Version] -Signature = "$Windows NT$" -Class = Net -ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} -Provider = %CompanyName% -DriverVer = 02/04/2018, 4.25.0.9658 -CatalogFile.NT = Neo6_x86_VPN102.cat - -[Manufacturer] -%CompanyName% = SoftEther - -[SourceDisksNames] -1=%DiskDescription%, "", , - -[SourceDisksFiles] -Neo6_x86_VPN102.sys = 1 - -[DestinationDirs] -DefaultDestDir = 12 -Neo.CopyFiles.Sys = 12 - -[Neo.CopyFiles.Sys] -Neo6_x86_VPN102.sys, , , 2 - -[SoftEther] -%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN102 - -[NeoAdapter.Install] -Characteristics = 0x1 -AddReg = Neo.Reg, NeoAdapter.Ndi -CopyFiles = Neo.CopyFiles.Sys -*IfType = 53 -*MediaType = 0 -*PhysicalMediaType = 0 - -[NeoAdapter.Install.Services] -AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% - -[NeoAdapter.Ndi] -HKR, , NetworkAddress, 0, %DefaultAddress% -HKR, Ndi, DeviceID, , "NeoAdapter_VPN102" -HKR, , DevLoader, , ndis -HKR, , DeviceVxDs, , Neo6_x86_VPN102.sys -HKR, NDIS, LogDriverName, , "Neo_VPN102" -HKR, NDIS, MajorNdisVersion, 1, 5 -HKR, NDIS, MinorNdisVersion, 1, 0 -HKR, Ndi\Interfaces, DefUpper, , "ndis5" -HKR, Ndi\Interfaces, UpperRange, , "ndis5" -HKR, Ndi\Interfaces, LowerRange, , "ethernet" -HKR, Ndi\Interfaces, DefLower, , "ethernet" -HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" -HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% -HKR, Ndi\Params\NetworkAddress, type, 0, "edit" -HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" -HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" -HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% -HKR, Ndi\Params\NetworkAddress, optional, 0, "0" -HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% -HKR, Ndi\Params\MaxSpeed, type, 0, "int" -HKR, Ndi\Params\MaxSpeed, default, 0, "100" -HKR, Ndi\Params\MaxSpeed, min, 0, "0" -HKR, Ndi\Params\MaxSpeed, max, 0, "2000" -HKR, Ndi\Params\MaxSpeed, step, 0, "1" -HKR, Ndi\Params\MaxSpeed, Base, 0, "10" -HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% -HKR, Ndi\Params\KeepLink, type, 0, "enum" -HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% -HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% -HKR, Ndi\Params\KeepLink, default, 0, "0" - - -[Neo.Service] -DisplayName = %Neo.Service.DispName% -Description = %Neo.Service.Desc% -ServiceType = 1 -StartType = 3 -ErrorControl = 1 -ServiceBinary = %12%\Neo6_x86_VPN102.sys -LoadOrderGroup = NDIS - -[Neo.Reg] -HKR, Ndi, Service, 0, Neo.Service.Name -HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" -HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" - -[Neo.EventLog] -HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN102.sys" -HKR, , TypesSupported, 0x00010001, 7 - -[Strings] -CompanyName = "SoftEther Corporation" -DiskDescription = "VPN Client Device Driver Install Disk" -Neo.Service.Name = "Neo_VPN102" -Neo.Service.DispName = "VPN Client Device Driver - VPN102" -Neo.Service.Desc = "VPN Client Adapter - VPN102" -NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN102" -Neo.EventLog.Name = "Neo" -NetworkAddress = "MAC Address" -DefaultAddress = "000001000001" -MaxSpeed = "Indicate Speed (Mbps)" -KeepLink = "Keep Link" -On = "On" -Off = "Off" - - -; Auto Generated 20180205_163619.532 - +; VPN Client Device Driver for Windows 2000 and Greater +; +; Copyright (c) SoftEther Corporation. All Rights Reserved. +; http://www.softether.co.jp/ +; +; BUILD 9658 + +[Version] +Signature = "$Windows NT$" +Class = Net +ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} +Provider = %CompanyName% +DriverVer = 02/04/2018, 4.25.0.9658 +CatalogFile.NT = Neo6_x86_VPN102.cat + +[Manufacturer] +%CompanyName% = SoftEther + +[SourceDisksNames] +1=%DiskDescription%, "", , + +[SourceDisksFiles] +Neo6_x86_VPN102.sys = 1 + +[DestinationDirs] +DefaultDestDir = 12 +Neo.CopyFiles.Sys = 12 + +[Neo.CopyFiles.Sys] +Neo6_x86_VPN102.sys, , , 2 + +[SoftEther] +%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN102 + +[NeoAdapter.Install] +Characteristics = 0x1 +AddReg = Neo.Reg, NeoAdapter.Ndi +CopyFiles = Neo.CopyFiles.Sys +*IfType = 53 +*MediaType = 0 +*PhysicalMediaType = 0 + +[NeoAdapter.Install.Services] +AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% + +[NeoAdapter.Ndi] +HKR, , NetworkAddress, 0, %DefaultAddress% +HKR, Ndi, DeviceID, , "NeoAdapter_VPN102" +HKR, , DevLoader, , ndis +HKR, , DeviceVxDs, , Neo6_x86_VPN102.sys +HKR, NDIS, LogDriverName, , "Neo_VPN102" +HKR, NDIS, MajorNdisVersion, 1, 5 +HKR, NDIS, MinorNdisVersion, 1, 0 +HKR, Ndi\Interfaces, DefUpper, , "ndis5" +HKR, Ndi\Interfaces, UpperRange, , "ndis5" +HKR, Ndi\Interfaces, LowerRange, , "ethernet" +HKR, Ndi\Interfaces, DefLower, , "ethernet" +HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" +HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% +HKR, Ndi\Params\NetworkAddress, type, 0, "edit" +HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" +HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" +HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% +HKR, Ndi\Params\NetworkAddress, optional, 0, "0" +HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% +HKR, Ndi\Params\MaxSpeed, type, 0, "int" +HKR, Ndi\Params\MaxSpeed, default, 0, "100" +HKR, Ndi\Params\MaxSpeed, min, 0, "0" +HKR, Ndi\Params\MaxSpeed, max, 0, "2000" +HKR, Ndi\Params\MaxSpeed, step, 0, "1" +HKR, Ndi\Params\MaxSpeed, Base, 0, "10" +HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% +HKR, Ndi\Params\KeepLink, type, 0, "enum" +HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% +HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% +HKR, Ndi\Params\KeepLink, default, 0, "0" + + +[Neo.Service] +DisplayName = %Neo.Service.DispName% +Description = %Neo.Service.Desc% +ServiceType = 1 +StartType = 3 +ErrorControl = 1 +ServiceBinary = %12%\Neo6_x86_VPN102.sys +LoadOrderGroup = NDIS + +[Neo.Reg] +HKR, Ndi, Service, 0, Neo.Service.Name +HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" +HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" + +[Neo.EventLog] +HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN102.sys" +HKR, , TypesSupported, 0x00010001, 7 + +[Strings] +CompanyName = "SoftEther Corporation" +DiskDescription = "VPN Client Device Driver Install Disk" +Neo.Service.Name = "Neo_VPN102" +Neo.Service.DispName = "VPN Client Device Driver - VPN102" +Neo.Service.Desc = "VPN Client Adapter - VPN102" +NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN102" +Neo.EventLog.Name = "Neo" +NetworkAddress = "MAC Address" +DefaultAddress = "000001000001" +MaxSpeed = "Indicate Speed (Mbps)" +KeepLink = "Keep Link" +On = "On" +Off = "Off" + + +; Auto Generated 20180205_163619.532 + diff --git a/src/bin/hamcore/DriverPackages/Neo6_Win10/x86/Neo6_x86_VPN103.inf b/src/bin/hamcore/DriverPackages/Neo6_Win10/x86/Neo6_x86_VPN103.inf index 89443618..4584901a 100644 --- a/src/bin/hamcore/DriverPackages/Neo6_Win10/x86/Neo6_x86_VPN103.inf +++ b/src/bin/hamcore/DriverPackages/Neo6_Win10/x86/Neo6_x86_VPN103.inf @@ -1,114 +1,114 @@ -; VPN Client Device Driver for Windows 2000 and Greater -; -; Copyright (c) SoftEther Corporation. All Rights Reserved. -; http://www.softether.co.jp/ -; -; BUILD 9658 - -[Version] -Signature = "$Windows NT$" -Class = Net -ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} -Provider = %CompanyName% -DriverVer = 02/04/2018, 4.25.0.9658 -CatalogFile.NT = Neo6_x86_VPN103.cat - -[Manufacturer] -%CompanyName% = SoftEther - -[SourceDisksNames] -1=%DiskDescription%, "", , - -[SourceDisksFiles] -Neo6_x86_VPN103.sys = 1 - -[DestinationDirs] -DefaultDestDir = 12 -Neo.CopyFiles.Sys = 12 - -[Neo.CopyFiles.Sys] -Neo6_x86_VPN103.sys, , , 2 - -[SoftEther] -%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN103 - -[NeoAdapter.Install] -Characteristics = 0x1 -AddReg = Neo.Reg, NeoAdapter.Ndi -CopyFiles = Neo.CopyFiles.Sys -*IfType = 53 -*MediaType = 0 -*PhysicalMediaType = 0 - -[NeoAdapter.Install.Services] -AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% - -[NeoAdapter.Ndi] -HKR, , NetworkAddress, 0, %DefaultAddress% -HKR, Ndi, DeviceID, , "NeoAdapter_VPN103" -HKR, , DevLoader, , ndis -HKR, , DeviceVxDs, , Neo6_x86_VPN103.sys -HKR, NDIS, LogDriverName, , "Neo_VPN103" -HKR, NDIS, MajorNdisVersion, 1, 5 -HKR, NDIS, MinorNdisVersion, 1, 0 -HKR, Ndi\Interfaces, DefUpper, , "ndis5" -HKR, Ndi\Interfaces, UpperRange, , "ndis5" -HKR, Ndi\Interfaces, LowerRange, , "ethernet" -HKR, Ndi\Interfaces, DefLower, , "ethernet" -HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" -HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% -HKR, Ndi\Params\NetworkAddress, type, 0, "edit" -HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" -HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" -HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% -HKR, Ndi\Params\NetworkAddress, optional, 0, "0" -HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% -HKR, Ndi\Params\MaxSpeed, type, 0, "int" -HKR, Ndi\Params\MaxSpeed, default, 0, "100" -HKR, Ndi\Params\MaxSpeed, min, 0, "0" -HKR, Ndi\Params\MaxSpeed, max, 0, "2000" -HKR, Ndi\Params\MaxSpeed, step, 0, "1" -HKR, Ndi\Params\MaxSpeed, Base, 0, "10" -HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% -HKR, Ndi\Params\KeepLink, type, 0, "enum" -HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% -HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% -HKR, Ndi\Params\KeepLink, default, 0, "0" - - -[Neo.Service] -DisplayName = %Neo.Service.DispName% -Description = %Neo.Service.Desc% -ServiceType = 1 -StartType = 3 -ErrorControl = 1 -ServiceBinary = %12%\Neo6_x86_VPN103.sys -LoadOrderGroup = NDIS - -[Neo.Reg] -HKR, Ndi, Service, 0, Neo.Service.Name -HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" -HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" - -[Neo.EventLog] -HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN103.sys" -HKR, , TypesSupported, 0x00010001, 7 - -[Strings] -CompanyName = "SoftEther Corporation" -DiskDescription = "VPN Client Device Driver Install Disk" -Neo.Service.Name = "Neo_VPN103" -Neo.Service.DispName = "VPN Client Device Driver - VPN103" -Neo.Service.Desc = "VPN Client Adapter - VPN103" -NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN103" -Neo.EventLog.Name = "Neo" -NetworkAddress = "MAC Address" -DefaultAddress = "000001000001" -MaxSpeed = "Indicate Speed (Mbps)" -KeepLink = "Keep Link" -On = "On" -Off = "Off" - - -; Auto Generated 20180205_163619.602 - +; VPN Client Device Driver for Windows 2000 and Greater +; +; Copyright (c) SoftEther Corporation. All Rights Reserved. +; http://www.softether.co.jp/ +; +; BUILD 9658 + +[Version] +Signature = "$Windows NT$" +Class = Net +ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} +Provider = %CompanyName% +DriverVer = 02/04/2018, 4.25.0.9658 +CatalogFile.NT = Neo6_x86_VPN103.cat + +[Manufacturer] +%CompanyName% = SoftEther + +[SourceDisksNames] +1=%DiskDescription%, "", , + +[SourceDisksFiles] +Neo6_x86_VPN103.sys = 1 + +[DestinationDirs] +DefaultDestDir = 12 +Neo.CopyFiles.Sys = 12 + +[Neo.CopyFiles.Sys] +Neo6_x86_VPN103.sys, , , 2 + +[SoftEther] +%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN103 + +[NeoAdapter.Install] +Characteristics = 0x1 +AddReg = Neo.Reg, NeoAdapter.Ndi +CopyFiles = Neo.CopyFiles.Sys +*IfType = 53 +*MediaType = 0 +*PhysicalMediaType = 0 + +[NeoAdapter.Install.Services] +AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% + +[NeoAdapter.Ndi] +HKR, , NetworkAddress, 0, %DefaultAddress% +HKR, Ndi, DeviceID, , "NeoAdapter_VPN103" +HKR, , DevLoader, , ndis +HKR, , DeviceVxDs, , Neo6_x86_VPN103.sys +HKR, NDIS, LogDriverName, , "Neo_VPN103" +HKR, NDIS, MajorNdisVersion, 1, 5 +HKR, NDIS, MinorNdisVersion, 1, 0 +HKR, Ndi\Interfaces, DefUpper, , "ndis5" +HKR, Ndi\Interfaces, UpperRange, , "ndis5" +HKR, Ndi\Interfaces, LowerRange, , "ethernet" +HKR, Ndi\Interfaces, DefLower, , "ethernet" +HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" +HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% +HKR, Ndi\Params\NetworkAddress, type, 0, "edit" +HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" +HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" +HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% +HKR, Ndi\Params\NetworkAddress, optional, 0, "0" +HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% +HKR, Ndi\Params\MaxSpeed, type, 0, "int" +HKR, Ndi\Params\MaxSpeed, default, 0, "100" +HKR, Ndi\Params\MaxSpeed, min, 0, "0" +HKR, Ndi\Params\MaxSpeed, max, 0, "2000" +HKR, Ndi\Params\MaxSpeed, step, 0, "1" +HKR, Ndi\Params\MaxSpeed, Base, 0, "10" +HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% +HKR, Ndi\Params\KeepLink, type, 0, "enum" +HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% +HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% +HKR, Ndi\Params\KeepLink, default, 0, "0" + + +[Neo.Service] +DisplayName = %Neo.Service.DispName% +Description = %Neo.Service.Desc% +ServiceType = 1 +StartType = 3 +ErrorControl = 1 +ServiceBinary = %12%\Neo6_x86_VPN103.sys +LoadOrderGroup = NDIS + +[Neo.Reg] +HKR, Ndi, Service, 0, Neo.Service.Name +HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" +HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" + +[Neo.EventLog] +HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN103.sys" +HKR, , TypesSupported, 0x00010001, 7 + +[Strings] +CompanyName = "SoftEther Corporation" +DiskDescription = "VPN Client Device Driver Install Disk" +Neo.Service.Name = "Neo_VPN103" +Neo.Service.DispName = "VPN Client Device Driver - VPN103" +Neo.Service.Desc = "VPN Client Adapter - VPN103" +NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN103" +Neo.EventLog.Name = "Neo" +NetworkAddress = "MAC Address" +DefaultAddress = "000001000001" +MaxSpeed = "Indicate Speed (Mbps)" +KeepLink = "Keep Link" +On = "On" +Off = "Off" + + +; Auto Generated 20180205_163619.602 + diff --git a/src/bin/hamcore/DriverPackages/Neo6_Win10/x86/Neo6_x86_VPN104.inf b/src/bin/hamcore/DriverPackages/Neo6_Win10/x86/Neo6_x86_VPN104.inf index 72ea8f5b..a8d51b60 100644 --- a/src/bin/hamcore/DriverPackages/Neo6_Win10/x86/Neo6_x86_VPN104.inf +++ b/src/bin/hamcore/DriverPackages/Neo6_Win10/x86/Neo6_x86_VPN104.inf @@ -1,114 +1,114 @@ -; VPN Client Device Driver for Windows 2000 and Greater -; -; Copyright (c) SoftEther Corporation. All Rights Reserved. -; http://www.softether.co.jp/ -; -; BUILD 9658 - -[Version] -Signature = "$Windows NT$" -Class = Net -ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} -Provider = %CompanyName% -DriverVer = 02/04/2018, 4.25.0.9658 -CatalogFile.NT = Neo6_x86_VPN104.cat - -[Manufacturer] -%CompanyName% = SoftEther - -[SourceDisksNames] -1=%DiskDescription%, "", , - -[SourceDisksFiles] -Neo6_x86_VPN104.sys = 1 - -[DestinationDirs] -DefaultDestDir = 12 -Neo.CopyFiles.Sys = 12 - -[Neo.CopyFiles.Sys] -Neo6_x86_VPN104.sys, , , 2 - -[SoftEther] -%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN104 - -[NeoAdapter.Install] -Characteristics = 0x1 -AddReg = Neo.Reg, NeoAdapter.Ndi -CopyFiles = Neo.CopyFiles.Sys -*IfType = 53 -*MediaType = 0 -*PhysicalMediaType = 0 - -[NeoAdapter.Install.Services] -AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% - -[NeoAdapter.Ndi] -HKR, , NetworkAddress, 0, %DefaultAddress% -HKR, Ndi, DeviceID, , "NeoAdapter_VPN104" -HKR, , DevLoader, , ndis -HKR, , DeviceVxDs, , Neo6_x86_VPN104.sys -HKR, NDIS, LogDriverName, , "Neo_VPN104" -HKR, NDIS, MajorNdisVersion, 1, 5 -HKR, NDIS, MinorNdisVersion, 1, 0 -HKR, Ndi\Interfaces, DefUpper, , "ndis5" -HKR, Ndi\Interfaces, UpperRange, , "ndis5" -HKR, Ndi\Interfaces, LowerRange, , "ethernet" -HKR, Ndi\Interfaces, DefLower, , "ethernet" -HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" -HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% -HKR, Ndi\Params\NetworkAddress, type, 0, "edit" -HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" -HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" -HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% -HKR, Ndi\Params\NetworkAddress, optional, 0, "0" -HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% -HKR, Ndi\Params\MaxSpeed, type, 0, "int" -HKR, Ndi\Params\MaxSpeed, default, 0, "100" -HKR, Ndi\Params\MaxSpeed, min, 0, "0" -HKR, Ndi\Params\MaxSpeed, max, 0, "2000" -HKR, Ndi\Params\MaxSpeed, step, 0, "1" -HKR, Ndi\Params\MaxSpeed, Base, 0, "10" -HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% -HKR, Ndi\Params\KeepLink, type, 0, "enum" -HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% -HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% -HKR, Ndi\Params\KeepLink, default, 0, "0" - - -[Neo.Service] -DisplayName = %Neo.Service.DispName% -Description = %Neo.Service.Desc% -ServiceType = 1 -StartType = 3 -ErrorControl = 1 -ServiceBinary = %12%\Neo6_x86_VPN104.sys -LoadOrderGroup = NDIS - -[Neo.Reg] -HKR, Ndi, Service, 0, Neo.Service.Name -HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" -HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" - -[Neo.EventLog] -HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN104.sys" -HKR, , TypesSupported, 0x00010001, 7 - -[Strings] -CompanyName = "SoftEther Corporation" -DiskDescription = "VPN Client Device Driver Install Disk" -Neo.Service.Name = "Neo_VPN104" -Neo.Service.DispName = "VPN Client Device Driver - VPN104" -Neo.Service.Desc = "VPN Client Adapter - VPN104" -NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN104" -Neo.EventLog.Name = "Neo" -NetworkAddress = "MAC Address" -DefaultAddress = "000001000001" -MaxSpeed = "Indicate Speed (Mbps)" -KeepLink = "Keep Link" -On = "On" -Off = "Off" - - -; Auto Generated 20180205_163619.673 - +; VPN Client Device Driver for Windows 2000 and Greater +; +; Copyright (c) SoftEther Corporation. All Rights Reserved. +; http://www.softether.co.jp/ +; +; BUILD 9658 + +[Version] +Signature = "$Windows NT$" +Class = Net +ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} +Provider = %CompanyName% +DriverVer = 02/04/2018, 4.25.0.9658 +CatalogFile.NT = Neo6_x86_VPN104.cat + +[Manufacturer] +%CompanyName% = SoftEther + +[SourceDisksNames] +1=%DiskDescription%, "", , + +[SourceDisksFiles] +Neo6_x86_VPN104.sys = 1 + +[DestinationDirs] +DefaultDestDir = 12 +Neo.CopyFiles.Sys = 12 + +[Neo.CopyFiles.Sys] +Neo6_x86_VPN104.sys, , , 2 + +[SoftEther] +%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN104 + +[NeoAdapter.Install] +Characteristics = 0x1 +AddReg = Neo.Reg, NeoAdapter.Ndi +CopyFiles = Neo.CopyFiles.Sys +*IfType = 53 +*MediaType = 0 +*PhysicalMediaType = 0 + +[NeoAdapter.Install.Services] +AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% + +[NeoAdapter.Ndi] +HKR, , NetworkAddress, 0, %DefaultAddress% +HKR, Ndi, DeviceID, , "NeoAdapter_VPN104" +HKR, , DevLoader, , ndis +HKR, , DeviceVxDs, , Neo6_x86_VPN104.sys +HKR, NDIS, LogDriverName, , "Neo_VPN104" +HKR, NDIS, MajorNdisVersion, 1, 5 +HKR, NDIS, MinorNdisVersion, 1, 0 +HKR, Ndi\Interfaces, DefUpper, , "ndis5" +HKR, Ndi\Interfaces, UpperRange, , "ndis5" +HKR, Ndi\Interfaces, LowerRange, , "ethernet" +HKR, Ndi\Interfaces, DefLower, , "ethernet" +HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" +HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% +HKR, Ndi\Params\NetworkAddress, type, 0, "edit" +HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" +HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" +HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% +HKR, Ndi\Params\NetworkAddress, optional, 0, "0" +HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% +HKR, Ndi\Params\MaxSpeed, type, 0, "int" +HKR, Ndi\Params\MaxSpeed, default, 0, "100" +HKR, Ndi\Params\MaxSpeed, min, 0, "0" +HKR, Ndi\Params\MaxSpeed, max, 0, "2000" +HKR, Ndi\Params\MaxSpeed, step, 0, "1" +HKR, Ndi\Params\MaxSpeed, Base, 0, "10" +HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% +HKR, Ndi\Params\KeepLink, type, 0, "enum" +HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% +HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% +HKR, Ndi\Params\KeepLink, default, 0, "0" + + +[Neo.Service] +DisplayName = %Neo.Service.DispName% +Description = %Neo.Service.Desc% +ServiceType = 1 +StartType = 3 +ErrorControl = 1 +ServiceBinary = %12%\Neo6_x86_VPN104.sys +LoadOrderGroup = NDIS + +[Neo.Reg] +HKR, Ndi, Service, 0, Neo.Service.Name +HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" +HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" + +[Neo.EventLog] +HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN104.sys" +HKR, , TypesSupported, 0x00010001, 7 + +[Strings] +CompanyName = "SoftEther Corporation" +DiskDescription = "VPN Client Device Driver Install Disk" +Neo.Service.Name = "Neo_VPN104" +Neo.Service.DispName = "VPN Client Device Driver - VPN104" +Neo.Service.Desc = "VPN Client Adapter - VPN104" +NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN104" +Neo.EventLog.Name = "Neo" +NetworkAddress = "MAC Address" +DefaultAddress = "000001000001" +MaxSpeed = "Indicate Speed (Mbps)" +KeepLink = "Keep Link" +On = "On" +Off = "Off" + + +; Auto Generated 20180205_163619.673 + diff --git a/src/bin/hamcore/DriverPackages/Neo6_Win10/x86/Neo6_x86_VPN105.inf b/src/bin/hamcore/DriverPackages/Neo6_Win10/x86/Neo6_x86_VPN105.inf index 0c36068c..830991e4 100644 --- a/src/bin/hamcore/DriverPackages/Neo6_Win10/x86/Neo6_x86_VPN105.inf +++ b/src/bin/hamcore/DriverPackages/Neo6_Win10/x86/Neo6_x86_VPN105.inf @@ -1,114 +1,114 @@ -; VPN Client Device Driver for Windows 2000 and Greater -; -; Copyright (c) SoftEther Corporation. All Rights Reserved. -; http://www.softether.co.jp/ -; -; BUILD 9658 - -[Version] -Signature = "$Windows NT$" -Class = Net -ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} -Provider = %CompanyName% -DriverVer = 02/04/2018, 4.25.0.9658 -CatalogFile.NT = Neo6_x86_VPN105.cat - -[Manufacturer] -%CompanyName% = SoftEther - -[SourceDisksNames] -1=%DiskDescription%, "", , - -[SourceDisksFiles] -Neo6_x86_VPN105.sys = 1 - -[DestinationDirs] -DefaultDestDir = 12 -Neo.CopyFiles.Sys = 12 - -[Neo.CopyFiles.Sys] -Neo6_x86_VPN105.sys, , , 2 - -[SoftEther] -%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN105 - -[NeoAdapter.Install] -Characteristics = 0x1 -AddReg = Neo.Reg, NeoAdapter.Ndi -CopyFiles = Neo.CopyFiles.Sys -*IfType = 53 -*MediaType = 0 -*PhysicalMediaType = 0 - -[NeoAdapter.Install.Services] -AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% - -[NeoAdapter.Ndi] -HKR, , NetworkAddress, 0, %DefaultAddress% -HKR, Ndi, DeviceID, , "NeoAdapter_VPN105" -HKR, , DevLoader, , ndis -HKR, , DeviceVxDs, , Neo6_x86_VPN105.sys -HKR, NDIS, LogDriverName, , "Neo_VPN105" -HKR, NDIS, MajorNdisVersion, 1, 5 -HKR, NDIS, MinorNdisVersion, 1, 0 -HKR, Ndi\Interfaces, DefUpper, , "ndis5" -HKR, Ndi\Interfaces, UpperRange, , "ndis5" -HKR, Ndi\Interfaces, LowerRange, , "ethernet" -HKR, Ndi\Interfaces, DefLower, , "ethernet" -HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" -HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% -HKR, Ndi\Params\NetworkAddress, type, 0, "edit" -HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" -HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" -HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% -HKR, Ndi\Params\NetworkAddress, optional, 0, "0" -HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% -HKR, Ndi\Params\MaxSpeed, type, 0, "int" -HKR, Ndi\Params\MaxSpeed, default, 0, "100" -HKR, Ndi\Params\MaxSpeed, min, 0, "0" -HKR, Ndi\Params\MaxSpeed, max, 0, "2000" -HKR, Ndi\Params\MaxSpeed, step, 0, "1" -HKR, Ndi\Params\MaxSpeed, Base, 0, "10" -HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% -HKR, Ndi\Params\KeepLink, type, 0, "enum" -HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% -HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% -HKR, Ndi\Params\KeepLink, default, 0, "0" - - -[Neo.Service] -DisplayName = %Neo.Service.DispName% -Description = %Neo.Service.Desc% -ServiceType = 1 -StartType = 3 -ErrorControl = 1 -ServiceBinary = %12%\Neo6_x86_VPN105.sys -LoadOrderGroup = NDIS - -[Neo.Reg] -HKR, Ndi, Service, 0, Neo.Service.Name -HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" -HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" - -[Neo.EventLog] -HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN105.sys" -HKR, , TypesSupported, 0x00010001, 7 - -[Strings] -CompanyName = "SoftEther Corporation" -DiskDescription = "VPN Client Device Driver Install Disk" -Neo.Service.Name = "Neo_VPN105" -Neo.Service.DispName = "VPN Client Device Driver - VPN105" -Neo.Service.Desc = "VPN Client Adapter - VPN105" -NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN105" -Neo.EventLog.Name = "Neo" -NetworkAddress = "MAC Address" -DefaultAddress = "000001000001" -MaxSpeed = "Indicate Speed (Mbps)" -KeepLink = "Keep Link" -On = "On" -Off = "Off" - - -; Auto Generated 20180205_163619.742 - +; VPN Client Device Driver for Windows 2000 and Greater +; +; Copyright (c) SoftEther Corporation. All Rights Reserved. +; http://www.softether.co.jp/ +; +; BUILD 9658 + +[Version] +Signature = "$Windows NT$" +Class = Net +ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} +Provider = %CompanyName% +DriverVer = 02/04/2018, 4.25.0.9658 +CatalogFile.NT = Neo6_x86_VPN105.cat + +[Manufacturer] +%CompanyName% = SoftEther + +[SourceDisksNames] +1=%DiskDescription%, "", , + +[SourceDisksFiles] +Neo6_x86_VPN105.sys = 1 + +[DestinationDirs] +DefaultDestDir = 12 +Neo.CopyFiles.Sys = 12 + +[Neo.CopyFiles.Sys] +Neo6_x86_VPN105.sys, , , 2 + +[SoftEther] +%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN105 + +[NeoAdapter.Install] +Characteristics = 0x1 +AddReg = Neo.Reg, NeoAdapter.Ndi +CopyFiles = Neo.CopyFiles.Sys +*IfType = 53 +*MediaType = 0 +*PhysicalMediaType = 0 + +[NeoAdapter.Install.Services] +AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% + +[NeoAdapter.Ndi] +HKR, , NetworkAddress, 0, %DefaultAddress% +HKR, Ndi, DeviceID, , "NeoAdapter_VPN105" +HKR, , DevLoader, , ndis +HKR, , DeviceVxDs, , Neo6_x86_VPN105.sys +HKR, NDIS, LogDriverName, , "Neo_VPN105" +HKR, NDIS, MajorNdisVersion, 1, 5 +HKR, NDIS, MinorNdisVersion, 1, 0 +HKR, Ndi\Interfaces, DefUpper, , "ndis5" +HKR, Ndi\Interfaces, UpperRange, , "ndis5" +HKR, Ndi\Interfaces, LowerRange, , "ethernet" +HKR, Ndi\Interfaces, DefLower, , "ethernet" +HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" +HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% +HKR, Ndi\Params\NetworkAddress, type, 0, "edit" +HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" +HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" +HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% +HKR, Ndi\Params\NetworkAddress, optional, 0, "0" +HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% +HKR, Ndi\Params\MaxSpeed, type, 0, "int" +HKR, Ndi\Params\MaxSpeed, default, 0, "100" +HKR, Ndi\Params\MaxSpeed, min, 0, "0" +HKR, Ndi\Params\MaxSpeed, max, 0, "2000" +HKR, Ndi\Params\MaxSpeed, step, 0, "1" +HKR, Ndi\Params\MaxSpeed, Base, 0, "10" +HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% +HKR, Ndi\Params\KeepLink, type, 0, "enum" +HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% +HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% +HKR, Ndi\Params\KeepLink, default, 0, "0" + + +[Neo.Service] +DisplayName = %Neo.Service.DispName% +Description = %Neo.Service.Desc% +ServiceType = 1 +StartType = 3 +ErrorControl = 1 +ServiceBinary = %12%\Neo6_x86_VPN105.sys +LoadOrderGroup = NDIS + +[Neo.Reg] +HKR, Ndi, Service, 0, Neo.Service.Name +HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" +HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" + +[Neo.EventLog] +HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN105.sys" +HKR, , TypesSupported, 0x00010001, 7 + +[Strings] +CompanyName = "SoftEther Corporation" +DiskDescription = "VPN Client Device Driver Install Disk" +Neo.Service.Name = "Neo_VPN105" +Neo.Service.DispName = "VPN Client Device Driver - VPN105" +Neo.Service.Desc = "VPN Client Adapter - VPN105" +NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN105" +Neo.EventLog.Name = "Neo" +NetworkAddress = "MAC Address" +DefaultAddress = "000001000001" +MaxSpeed = "Indicate Speed (Mbps)" +KeepLink = "Keep Link" +On = "On" +Off = "Off" + + +; Auto Generated 20180205_163619.742 + diff --git a/src/bin/hamcore/DriverPackages/Neo6_Win10/x86/Neo6_x86_VPN106.inf b/src/bin/hamcore/DriverPackages/Neo6_Win10/x86/Neo6_x86_VPN106.inf index d4fc1030..9e6e695c 100644 --- a/src/bin/hamcore/DriverPackages/Neo6_Win10/x86/Neo6_x86_VPN106.inf +++ b/src/bin/hamcore/DriverPackages/Neo6_Win10/x86/Neo6_x86_VPN106.inf @@ -1,114 +1,114 @@ -; VPN Client Device Driver for Windows 2000 and Greater -; -; Copyright (c) SoftEther Corporation. All Rights Reserved. -; http://www.softether.co.jp/ -; -; BUILD 9658 - -[Version] -Signature = "$Windows NT$" -Class = Net -ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} -Provider = %CompanyName% -DriverVer = 02/04/2018, 4.25.0.9658 -CatalogFile.NT = Neo6_x86_VPN106.cat - -[Manufacturer] -%CompanyName% = SoftEther - -[SourceDisksNames] -1=%DiskDescription%, "", , - -[SourceDisksFiles] -Neo6_x86_VPN106.sys = 1 - -[DestinationDirs] -DefaultDestDir = 12 -Neo.CopyFiles.Sys = 12 - -[Neo.CopyFiles.Sys] -Neo6_x86_VPN106.sys, , , 2 - -[SoftEther] -%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN106 - -[NeoAdapter.Install] -Characteristics = 0x1 -AddReg = Neo.Reg, NeoAdapter.Ndi -CopyFiles = Neo.CopyFiles.Sys -*IfType = 53 -*MediaType = 0 -*PhysicalMediaType = 0 - -[NeoAdapter.Install.Services] -AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% - -[NeoAdapter.Ndi] -HKR, , NetworkAddress, 0, %DefaultAddress% -HKR, Ndi, DeviceID, , "NeoAdapter_VPN106" -HKR, , DevLoader, , ndis -HKR, , DeviceVxDs, , Neo6_x86_VPN106.sys -HKR, NDIS, LogDriverName, , "Neo_VPN106" -HKR, NDIS, MajorNdisVersion, 1, 5 -HKR, NDIS, MinorNdisVersion, 1, 0 -HKR, Ndi\Interfaces, DefUpper, , "ndis5" -HKR, Ndi\Interfaces, UpperRange, , "ndis5" -HKR, Ndi\Interfaces, LowerRange, , "ethernet" -HKR, Ndi\Interfaces, DefLower, , "ethernet" -HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" -HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% -HKR, Ndi\Params\NetworkAddress, type, 0, "edit" -HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" -HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" -HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% -HKR, Ndi\Params\NetworkAddress, optional, 0, "0" -HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% -HKR, Ndi\Params\MaxSpeed, type, 0, "int" -HKR, Ndi\Params\MaxSpeed, default, 0, "100" -HKR, Ndi\Params\MaxSpeed, min, 0, "0" -HKR, Ndi\Params\MaxSpeed, max, 0, "2000" -HKR, Ndi\Params\MaxSpeed, step, 0, "1" -HKR, Ndi\Params\MaxSpeed, Base, 0, "10" -HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% -HKR, Ndi\Params\KeepLink, type, 0, "enum" -HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% -HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% -HKR, Ndi\Params\KeepLink, default, 0, "0" - - -[Neo.Service] -DisplayName = %Neo.Service.DispName% -Description = %Neo.Service.Desc% -ServiceType = 1 -StartType = 3 -ErrorControl = 1 -ServiceBinary = %12%\Neo6_x86_VPN106.sys -LoadOrderGroup = NDIS - -[Neo.Reg] -HKR, Ndi, Service, 0, Neo.Service.Name -HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" -HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" - -[Neo.EventLog] -HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN106.sys" -HKR, , TypesSupported, 0x00010001, 7 - -[Strings] -CompanyName = "SoftEther Corporation" -DiskDescription = "VPN Client Device Driver Install Disk" -Neo.Service.Name = "Neo_VPN106" -Neo.Service.DispName = "VPN Client Device Driver - VPN106" -Neo.Service.Desc = "VPN Client Adapter - VPN106" -NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN106" -Neo.EventLog.Name = "Neo" -NetworkAddress = "MAC Address" -DefaultAddress = "000001000001" -MaxSpeed = "Indicate Speed (Mbps)" -KeepLink = "Keep Link" -On = "On" -Off = "Off" - - -; Auto Generated 20180205_163619.812 - +; VPN Client Device Driver for Windows 2000 and Greater +; +; Copyright (c) SoftEther Corporation. All Rights Reserved. +; http://www.softether.co.jp/ +; +; BUILD 9658 + +[Version] +Signature = "$Windows NT$" +Class = Net +ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} +Provider = %CompanyName% +DriverVer = 02/04/2018, 4.25.0.9658 +CatalogFile.NT = Neo6_x86_VPN106.cat + +[Manufacturer] +%CompanyName% = SoftEther + +[SourceDisksNames] +1=%DiskDescription%, "", , + +[SourceDisksFiles] +Neo6_x86_VPN106.sys = 1 + +[DestinationDirs] +DefaultDestDir = 12 +Neo.CopyFiles.Sys = 12 + +[Neo.CopyFiles.Sys] +Neo6_x86_VPN106.sys, , , 2 + +[SoftEther] +%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN106 + +[NeoAdapter.Install] +Characteristics = 0x1 +AddReg = Neo.Reg, NeoAdapter.Ndi +CopyFiles = Neo.CopyFiles.Sys +*IfType = 53 +*MediaType = 0 +*PhysicalMediaType = 0 + +[NeoAdapter.Install.Services] +AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% + +[NeoAdapter.Ndi] +HKR, , NetworkAddress, 0, %DefaultAddress% +HKR, Ndi, DeviceID, , "NeoAdapter_VPN106" +HKR, , DevLoader, , ndis +HKR, , DeviceVxDs, , Neo6_x86_VPN106.sys +HKR, NDIS, LogDriverName, , "Neo_VPN106" +HKR, NDIS, MajorNdisVersion, 1, 5 +HKR, NDIS, MinorNdisVersion, 1, 0 +HKR, Ndi\Interfaces, DefUpper, , "ndis5" +HKR, Ndi\Interfaces, UpperRange, , "ndis5" +HKR, Ndi\Interfaces, LowerRange, , "ethernet" +HKR, Ndi\Interfaces, DefLower, , "ethernet" +HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" +HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% +HKR, Ndi\Params\NetworkAddress, type, 0, "edit" +HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" +HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" +HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% +HKR, Ndi\Params\NetworkAddress, optional, 0, "0" +HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% +HKR, Ndi\Params\MaxSpeed, type, 0, "int" +HKR, Ndi\Params\MaxSpeed, default, 0, "100" +HKR, Ndi\Params\MaxSpeed, min, 0, "0" +HKR, Ndi\Params\MaxSpeed, max, 0, "2000" +HKR, Ndi\Params\MaxSpeed, step, 0, "1" +HKR, Ndi\Params\MaxSpeed, Base, 0, "10" +HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% +HKR, Ndi\Params\KeepLink, type, 0, "enum" +HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% +HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% +HKR, Ndi\Params\KeepLink, default, 0, "0" + + +[Neo.Service] +DisplayName = %Neo.Service.DispName% +Description = %Neo.Service.Desc% +ServiceType = 1 +StartType = 3 +ErrorControl = 1 +ServiceBinary = %12%\Neo6_x86_VPN106.sys +LoadOrderGroup = NDIS + +[Neo.Reg] +HKR, Ndi, Service, 0, Neo.Service.Name +HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" +HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" + +[Neo.EventLog] +HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN106.sys" +HKR, , TypesSupported, 0x00010001, 7 + +[Strings] +CompanyName = "SoftEther Corporation" +DiskDescription = "VPN Client Device Driver Install Disk" +Neo.Service.Name = "Neo_VPN106" +Neo.Service.DispName = "VPN Client Device Driver - VPN106" +Neo.Service.Desc = "VPN Client Adapter - VPN106" +NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN106" +Neo.EventLog.Name = "Neo" +NetworkAddress = "MAC Address" +DefaultAddress = "000001000001" +MaxSpeed = "Indicate Speed (Mbps)" +KeepLink = "Keep Link" +On = "On" +Off = "Off" + + +; Auto Generated 20180205_163619.812 + diff --git a/src/bin/hamcore/DriverPackages/Neo6_Win10/x86/Neo6_x86_VPN107.inf b/src/bin/hamcore/DriverPackages/Neo6_Win10/x86/Neo6_x86_VPN107.inf index 590162c1..afeffbb5 100644 --- a/src/bin/hamcore/DriverPackages/Neo6_Win10/x86/Neo6_x86_VPN107.inf +++ b/src/bin/hamcore/DriverPackages/Neo6_Win10/x86/Neo6_x86_VPN107.inf @@ -1,114 +1,114 @@ -; VPN Client Device Driver for Windows 2000 and Greater -; -; Copyright (c) SoftEther Corporation. All Rights Reserved. -; http://www.softether.co.jp/ -; -; BUILD 9658 - -[Version] -Signature = "$Windows NT$" -Class = Net -ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} -Provider = %CompanyName% -DriverVer = 02/04/2018, 4.25.0.9658 -CatalogFile.NT = Neo6_x86_VPN107.cat - -[Manufacturer] -%CompanyName% = SoftEther - -[SourceDisksNames] -1=%DiskDescription%, "", , - -[SourceDisksFiles] -Neo6_x86_VPN107.sys = 1 - -[DestinationDirs] -DefaultDestDir = 12 -Neo.CopyFiles.Sys = 12 - -[Neo.CopyFiles.Sys] -Neo6_x86_VPN107.sys, , , 2 - -[SoftEther] -%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN107 - -[NeoAdapter.Install] -Characteristics = 0x1 -AddReg = Neo.Reg, NeoAdapter.Ndi -CopyFiles = Neo.CopyFiles.Sys -*IfType = 53 -*MediaType = 0 -*PhysicalMediaType = 0 - -[NeoAdapter.Install.Services] -AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% - -[NeoAdapter.Ndi] -HKR, , NetworkAddress, 0, %DefaultAddress% -HKR, Ndi, DeviceID, , "NeoAdapter_VPN107" -HKR, , DevLoader, , ndis -HKR, , DeviceVxDs, , Neo6_x86_VPN107.sys -HKR, NDIS, LogDriverName, , "Neo_VPN107" -HKR, NDIS, MajorNdisVersion, 1, 5 -HKR, NDIS, MinorNdisVersion, 1, 0 -HKR, Ndi\Interfaces, DefUpper, , "ndis5" -HKR, Ndi\Interfaces, UpperRange, , "ndis5" -HKR, Ndi\Interfaces, LowerRange, , "ethernet" -HKR, Ndi\Interfaces, DefLower, , "ethernet" -HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" -HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% -HKR, Ndi\Params\NetworkAddress, type, 0, "edit" -HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" -HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" -HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% -HKR, Ndi\Params\NetworkAddress, optional, 0, "0" -HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% -HKR, Ndi\Params\MaxSpeed, type, 0, "int" -HKR, Ndi\Params\MaxSpeed, default, 0, "100" -HKR, Ndi\Params\MaxSpeed, min, 0, "0" -HKR, Ndi\Params\MaxSpeed, max, 0, "2000" -HKR, Ndi\Params\MaxSpeed, step, 0, "1" -HKR, Ndi\Params\MaxSpeed, Base, 0, "10" -HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% -HKR, Ndi\Params\KeepLink, type, 0, "enum" -HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% -HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% -HKR, Ndi\Params\KeepLink, default, 0, "0" - - -[Neo.Service] -DisplayName = %Neo.Service.DispName% -Description = %Neo.Service.Desc% -ServiceType = 1 -StartType = 3 -ErrorControl = 1 -ServiceBinary = %12%\Neo6_x86_VPN107.sys -LoadOrderGroup = NDIS - -[Neo.Reg] -HKR, Ndi, Service, 0, Neo.Service.Name -HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" -HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" - -[Neo.EventLog] -HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN107.sys" -HKR, , TypesSupported, 0x00010001, 7 - -[Strings] -CompanyName = "SoftEther Corporation" -DiskDescription = "VPN Client Device Driver Install Disk" -Neo.Service.Name = "Neo_VPN107" -Neo.Service.DispName = "VPN Client Device Driver - VPN107" -Neo.Service.Desc = "VPN Client Adapter - VPN107" -NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN107" -Neo.EventLog.Name = "Neo" -NetworkAddress = "MAC Address" -DefaultAddress = "000001000001" -MaxSpeed = "Indicate Speed (Mbps)" -KeepLink = "Keep Link" -On = "On" -Off = "Off" - - -; Auto Generated 20180205_163619.882 - +; VPN Client Device Driver for Windows 2000 and Greater +; +; Copyright (c) SoftEther Corporation. All Rights Reserved. +; http://www.softether.co.jp/ +; +; BUILD 9658 + +[Version] +Signature = "$Windows NT$" +Class = Net +ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} +Provider = %CompanyName% +DriverVer = 02/04/2018, 4.25.0.9658 +CatalogFile.NT = Neo6_x86_VPN107.cat + +[Manufacturer] +%CompanyName% = SoftEther + +[SourceDisksNames] +1=%DiskDescription%, "", , + +[SourceDisksFiles] +Neo6_x86_VPN107.sys = 1 + +[DestinationDirs] +DefaultDestDir = 12 +Neo.CopyFiles.Sys = 12 + +[Neo.CopyFiles.Sys] +Neo6_x86_VPN107.sys, , , 2 + +[SoftEther] +%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN107 + +[NeoAdapter.Install] +Characteristics = 0x1 +AddReg = Neo.Reg, NeoAdapter.Ndi +CopyFiles = Neo.CopyFiles.Sys +*IfType = 53 +*MediaType = 0 +*PhysicalMediaType = 0 + +[NeoAdapter.Install.Services] +AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% + +[NeoAdapter.Ndi] +HKR, , NetworkAddress, 0, %DefaultAddress% +HKR, Ndi, DeviceID, , "NeoAdapter_VPN107" +HKR, , DevLoader, , ndis +HKR, , DeviceVxDs, , Neo6_x86_VPN107.sys +HKR, NDIS, LogDriverName, , "Neo_VPN107" +HKR, NDIS, MajorNdisVersion, 1, 5 +HKR, NDIS, MinorNdisVersion, 1, 0 +HKR, Ndi\Interfaces, DefUpper, , "ndis5" +HKR, Ndi\Interfaces, UpperRange, , "ndis5" +HKR, Ndi\Interfaces, LowerRange, , "ethernet" +HKR, Ndi\Interfaces, DefLower, , "ethernet" +HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" +HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% +HKR, Ndi\Params\NetworkAddress, type, 0, "edit" +HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" +HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" +HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% +HKR, Ndi\Params\NetworkAddress, optional, 0, "0" +HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% +HKR, Ndi\Params\MaxSpeed, type, 0, "int" +HKR, Ndi\Params\MaxSpeed, default, 0, "100" +HKR, Ndi\Params\MaxSpeed, min, 0, "0" +HKR, Ndi\Params\MaxSpeed, max, 0, "2000" +HKR, Ndi\Params\MaxSpeed, step, 0, "1" +HKR, Ndi\Params\MaxSpeed, Base, 0, "10" +HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% +HKR, Ndi\Params\KeepLink, type, 0, "enum" +HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% +HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% +HKR, Ndi\Params\KeepLink, default, 0, "0" + + +[Neo.Service] +DisplayName = %Neo.Service.DispName% +Description = %Neo.Service.Desc% +ServiceType = 1 +StartType = 3 +ErrorControl = 1 +ServiceBinary = %12%\Neo6_x86_VPN107.sys +LoadOrderGroup = NDIS + +[Neo.Reg] +HKR, Ndi, Service, 0, Neo.Service.Name +HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" +HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" + +[Neo.EventLog] +HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN107.sys" +HKR, , TypesSupported, 0x00010001, 7 + +[Strings] +CompanyName = "SoftEther Corporation" +DiskDescription = "VPN Client Device Driver Install Disk" +Neo.Service.Name = "Neo_VPN107" +Neo.Service.DispName = "VPN Client Device Driver - VPN107" +Neo.Service.Desc = "VPN Client Adapter - VPN107" +NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN107" +Neo.EventLog.Name = "Neo" +NetworkAddress = "MAC Address" +DefaultAddress = "000001000001" +MaxSpeed = "Indicate Speed (Mbps)" +KeepLink = "Keep Link" +On = "On" +Off = "Off" + + +; Auto Generated 20180205_163619.882 + diff --git a/src/bin/hamcore/DriverPackages/Neo6_Win10/x86/Neo6_x86_VPN108.inf b/src/bin/hamcore/DriverPackages/Neo6_Win10/x86/Neo6_x86_VPN108.inf index 3becd23b..9f1adb9f 100644 --- a/src/bin/hamcore/DriverPackages/Neo6_Win10/x86/Neo6_x86_VPN108.inf +++ b/src/bin/hamcore/DriverPackages/Neo6_Win10/x86/Neo6_x86_VPN108.inf @@ -1,114 +1,114 @@ -; VPN Client Device Driver for Windows 2000 and Greater -; -; Copyright (c) SoftEther Corporation. All Rights Reserved. -; http://www.softether.co.jp/ -; -; BUILD 9658 - -[Version] -Signature = "$Windows NT$" -Class = Net -ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} -Provider = %CompanyName% -DriverVer = 02/04/2018, 4.25.0.9658 -CatalogFile.NT = Neo6_x86_VPN108.cat - -[Manufacturer] -%CompanyName% = SoftEther - -[SourceDisksNames] -1=%DiskDescription%, "", , - -[SourceDisksFiles] -Neo6_x86_VPN108.sys = 1 - -[DestinationDirs] -DefaultDestDir = 12 -Neo.CopyFiles.Sys = 12 - -[Neo.CopyFiles.Sys] -Neo6_x86_VPN108.sys, , , 2 - -[SoftEther] -%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN108 - -[NeoAdapter.Install] -Characteristics = 0x1 -AddReg = Neo.Reg, NeoAdapter.Ndi -CopyFiles = Neo.CopyFiles.Sys -*IfType = 53 -*MediaType = 0 -*PhysicalMediaType = 0 - -[NeoAdapter.Install.Services] -AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% - -[NeoAdapter.Ndi] -HKR, , NetworkAddress, 0, %DefaultAddress% -HKR, Ndi, DeviceID, , "NeoAdapter_VPN108" -HKR, , DevLoader, , ndis -HKR, , DeviceVxDs, , Neo6_x86_VPN108.sys -HKR, NDIS, LogDriverName, , "Neo_VPN108" -HKR, NDIS, MajorNdisVersion, 1, 5 -HKR, NDIS, MinorNdisVersion, 1, 0 -HKR, Ndi\Interfaces, DefUpper, , "ndis5" -HKR, Ndi\Interfaces, UpperRange, , "ndis5" -HKR, Ndi\Interfaces, LowerRange, , "ethernet" -HKR, Ndi\Interfaces, DefLower, , "ethernet" -HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" -HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% -HKR, Ndi\Params\NetworkAddress, type, 0, "edit" -HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" -HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" -HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% -HKR, Ndi\Params\NetworkAddress, optional, 0, "0" -HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% -HKR, Ndi\Params\MaxSpeed, type, 0, "int" -HKR, Ndi\Params\MaxSpeed, default, 0, "100" -HKR, Ndi\Params\MaxSpeed, min, 0, "0" -HKR, Ndi\Params\MaxSpeed, max, 0, "2000" -HKR, Ndi\Params\MaxSpeed, step, 0, "1" -HKR, Ndi\Params\MaxSpeed, Base, 0, "10" -HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% -HKR, Ndi\Params\KeepLink, type, 0, "enum" -HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% -HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% -HKR, Ndi\Params\KeepLink, default, 0, "0" - - -[Neo.Service] -DisplayName = %Neo.Service.DispName% -Description = %Neo.Service.Desc% -ServiceType = 1 -StartType = 3 -ErrorControl = 1 -ServiceBinary = %12%\Neo6_x86_VPN108.sys -LoadOrderGroup = NDIS - -[Neo.Reg] -HKR, Ndi, Service, 0, Neo.Service.Name -HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" -HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" - -[Neo.EventLog] -HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN108.sys" -HKR, , TypesSupported, 0x00010001, 7 - -[Strings] -CompanyName = "SoftEther Corporation" -DiskDescription = "VPN Client Device Driver Install Disk" -Neo.Service.Name = "Neo_VPN108" -Neo.Service.DispName = "VPN Client Device Driver - VPN108" -Neo.Service.Desc = "VPN Client Adapter - VPN108" -NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN108" -Neo.EventLog.Name = "Neo" -NetworkAddress = "MAC Address" -DefaultAddress = "000001000001" -MaxSpeed = "Indicate Speed (Mbps)" -KeepLink = "Keep Link" -On = "On" -Off = "Off" - - -; Auto Generated 20180205_163619.953 - +; VPN Client Device Driver for Windows 2000 and Greater +; +; Copyright (c) SoftEther Corporation. All Rights Reserved. +; http://www.softether.co.jp/ +; +; BUILD 9658 + +[Version] +Signature = "$Windows NT$" +Class = Net +ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} +Provider = %CompanyName% +DriverVer = 02/04/2018, 4.25.0.9658 +CatalogFile.NT = Neo6_x86_VPN108.cat + +[Manufacturer] +%CompanyName% = SoftEther + +[SourceDisksNames] +1=%DiskDescription%, "", , + +[SourceDisksFiles] +Neo6_x86_VPN108.sys = 1 + +[DestinationDirs] +DefaultDestDir = 12 +Neo.CopyFiles.Sys = 12 + +[Neo.CopyFiles.Sys] +Neo6_x86_VPN108.sys, , , 2 + +[SoftEther] +%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN108 + +[NeoAdapter.Install] +Characteristics = 0x1 +AddReg = Neo.Reg, NeoAdapter.Ndi +CopyFiles = Neo.CopyFiles.Sys +*IfType = 53 +*MediaType = 0 +*PhysicalMediaType = 0 + +[NeoAdapter.Install.Services] +AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% + +[NeoAdapter.Ndi] +HKR, , NetworkAddress, 0, %DefaultAddress% +HKR, Ndi, DeviceID, , "NeoAdapter_VPN108" +HKR, , DevLoader, , ndis +HKR, , DeviceVxDs, , Neo6_x86_VPN108.sys +HKR, NDIS, LogDriverName, , "Neo_VPN108" +HKR, NDIS, MajorNdisVersion, 1, 5 +HKR, NDIS, MinorNdisVersion, 1, 0 +HKR, Ndi\Interfaces, DefUpper, , "ndis5" +HKR, Ndi\Interfaces, UpperRange, , "ndis5" +HKR, Ndi\Interfaces, LowerRange, , "ethernet" +HKR, Ndi\Interfaces, DefLower, , "ethernet" +HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" +HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% +HKR, Ndi\Params\NetworkAddress, type, 0, "edit" +HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" +HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" +HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% +HKR, Ndi\Params\NetworkAddress, optional, 0, "0" +HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% +HKR, Ndi\Params\MaxSpeed, type, 0, "int" +HKR, Ndi\Params\MaxSpeed, default, 0, "100" +HKR, Ndi\Params\MaxSpeed, min, 0, "0" +HKR, Ndi\Params\MaxSpeed, max, 0, "2000" +HKR, Ndi\Params\MaxSpeed, step, 0, "1" +HKR, Ndi\Params\MaxSpeed, Base, 0, "10" +HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% +HKR, Ndi\Params\KeepLink, type, 0, "enum" +HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% +HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% +HKR, Ndi\Params\KeepLink, default, 0, "0" + + +[Neo.Service] +DisplayName = %Neo.Service.DispName% +Description = %Neo.Service.Desc% +ServiceType = 1 +StartType = 3 +ErrorControl = 1 +ServiceBinary = %12%\Neo6_x86_VPN108.sys +LoadOrderGroup = NDIS + +[Neo.Reg] +HKR, Ndi, Service, 0, Neo.Service.Name +HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" +HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" + +[Neo.EventLog] +HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN108.sys" +HKR, , TypesSupported, 0x00010001, 7 + +[Strings] +CompanyName = "SoftEther Corporation" +DiskDescription = "VPN Client Device Driver Install Disk" +Neo.Service.Name = "Neo_VPN108" +Neo.Service.DispName = "VPN Client Device Driver - VPN108" +Neo.Service.Desc = "VPN Client Adapter - VPN108" +NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN108" +Neo.EventLog.Name = "Neo" +NetworkAddress = "MAC Address" +DefaultAddress = "000001000001" +MaxSpeed = "Indicate Speed (Mbps)" +KeepLink = "Keep Link" +On = "On" +Off = "Off" + + +; Auto Generated 20180205_163619.953 + diff --git a/src/bin/hamcore/DriverPackages/Neo6_Win10/x86/Neo6_x86_VPN109.inf b/src/bin/hamcore/DriverPackages/Neo6_Win10/x86/Neo6_x86_VPN109.inf index 03b1b213..2ab58a19 100644 --- a/src/bin/hamcore/DriverPackages/Neo6_Win10/x86/Neo6_x86_VPN109.inf +++ b/src/bin/hamcore/DriverPackages/Neo6_Win10/x86/Neo6_x86_VPN109.inf @@ -1,114 +1,114 @@ -; VPN Client Device Driver for Windows 2000 and Greater -; -; Copyright (c) SoftEther Corporation. All Rights Reserved. -; http://www.softether.co.jp/ -; -; BUILD 9658 - -[Version] -Signature = "$Windows NT$" -Class = Net -ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} -Provider = %CompanyName% -DriverVer = 02/04/2018, 4.25.0.9658 -CatalogFile.NT = Neo6_x86_VPN109.cat - -[Manufacturer] -%CompanyName% = SoftEther - -[SourceDisksNames] -1=%DiskDescription%, "", , - -[SourceDisksFiles] -Neo6_x86_VPN109.sys = 1 - -[DestinationDirs] -DefaultDestDir = 12 -Neo.CopyFiles.Sys = 12 - -[Neo.CopyFiles.Sys] -Neo6_x86_VPN109.sys, , , 2 - -[SoftEther] -%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN109 - -[NeoAdapter.Install] -Characteristics = 0x1 -AddReg = Neo.Reg, NeoAdapter.Ndi -CopyFiles = Neo.CopyFiles.Sys -*IfType = 53 -*MediaType = 0 -*PhysicalMediaType = 0 - -[NeoAdapter.Install.Services] -AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% - -[NeoAdapter.Ndi] -HKR, , NetworkAddress, 0, %DefaultAddress% -HKR, Ndi, DeviceID, , "NeoAdapter_VPN109" -HKR, , DevLoader, , ndis -HKR, , DeviceVxDs, , Neo6_x86_VPN109.sys -HKR, NDIS, LogDriverName, , "Neo_VPN109" -HKR, NDIS, MajorNdisVersion, 1, 5 -HKR, NDIS, MinorNdisVersion, 1, 0 -HKR, Ndi\Interfaces, DefUpper, , "ndis5" -HKR, Ndi\Interfaces, UpperRange, , "ndis5" -HKR, Ndi\Interfaces, LowerRange, , "ethernet" -HKR, Ndi\Interfaces, DefLower, , "ethernet" -HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" -HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% -HKR, Ndi\Params\NetworkAddress, type, 0, "edit" -HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" -HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" -HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% -HKR, Ndi\Params\NetworkAddress, optional, 0, "0" -HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% -HKR, Ndi\Params\MaxSpeed, type, 0, "int" -HKR, Ndi\Params\MaxSpeed, default, 0, "100" -HKR, Ndi\Params\MaxSpeed, min, 0, "0" -HKR, Ndi\Params\MaxSpeed, max, 0, "2000" -HKR, Ndi\Params\MaxSpeed, step, 0, "1" -HKR, Ndi\Params\MaxSpeed, Base, 0, "10" -HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% -HKR, Ndi\Params\KeepLink, type, 0, "enum" -HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% -HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% -HKR, Ndi\Params\KeepLink, default, 0, "0" - - -[Neo.Service] -DisplayName = %Neo.Service.DispName% -Description = %Neo.Service.Desc% -ServiceType = 1 -StartType = 3 -ErrorControl = 1 -ServiceBinary = %12%\Neo6_x86_VPN109.sys -LoadOrderGroup = NDIS - -[Neo.Reg] -HKR, Ndi, Service, 0, Neo.Service.Name -HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" -HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" - -[Neo.EventLog] -HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN109.sys" -HKR, , TypesSupported, 0x00010001, 7 - -[Strings] -CompanyName = "SoftEther Corporation" -DiskDescription = "VPN Client Device Driver Install Disk" -Neo.Service.Name = "Neo_VPN109" -Neo.Service.DispName = "VPN Client Device Driver - VPN109" -Neo.Service.Desc = "VPN Client Adapter - VPN109" -NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN109" -Neo.EventLog.Name = "Neo" -NetworkAddress = "MAC Address" -DefaultAddress = "000001000001" -MaxSpeed = "Indicate Speed (Mbps)" -KeepLink = "Keep Link" -On = "On" -Off = "Off" - - -; Auto Generated 20180205_163620.024 - +; VPN Client Device Driver for Windows 2000 and Greater +; +; Copyright (c) SoftEther Corporation. All Rights Reserved. +; http://www.softether.co.jp/ +; +; BUILD 9658 + +[Version] +Signature = "$Windows NT$" +Class = Net +ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} +Provider = %CompanyName% +DriverVer = 02/04/2018, 4.25.0.9658 +CatalogFile.NT = Neo6_x86_VPN109.cat + +[Manufacturer] +%CompanyName% = SoftEther + +[SourceDisksNames] +1=%DiskDescription%, "", , + +[SourceDisksFiles] +Neo6_x86_VPN109.sys = 1 + +[DestinationDirs] +DefaultDestDir = 12 +Neo.CopyFiles.Sys = 12 + +[Neo.CopyFiles.Sys] +Neo6_x86_VPN109.sys, , , 2 + +[SoftEther] +%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN109 + +[NeoAdapter.Install] +Characteristics = 0x1 +AddReg = Neo.Reg, NeoAdapter.Ndi +CopyFiles = Neo.CopyFiles.Sys +*IfType = 53 +*MediaType = 0 +*PhysicalMediaType = 0 + +[NeoAdapter.Install.Services] +AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% + +[NeoAdapter.Ndi] +HKR, , NetworkAddress, 0, %DefaultAddress% +HKR, Ndi, DeviceID, , "NeoAdapter_VPN109" +HKR, , DevLoader, , ndis +HKR, , DeviceVxDs, , Neo6_x86_VPN109.sys +HKR, NDIS, LogDriverName, , "Neo_VPN109" +HKR, NDIS, MajorNdisVersion, 1, 5 +HKR, NDIS, MinorNdisVersion, 1, 0 +HKR, Ndi\Interfaces, DefUpper, , "ndis5" +HKR, Ndi\Interfaces, UpperRange, , "ndis5" +HKR, Ndi\Interfaces, LowerRange, , "ethernet" +HKR, Ndi\Interfaces, DefLower, , "ethernet" +HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" +HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% +HKR, Ndi\Params\NetworkAddress, type, 0, "edit" +HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" +HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" +HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% +HKR, Ndi\Params\NetworkAddress, optional, 0, "0" +HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% +HKR, Ndi\Params\MaxSpeed, type, 0, "int" +HKR, Ndi\Params\MaxSpeed, default, 0, "100" +HKR, Ndi\Params\MaxSpeed, min, 0, "0" +HKR, Ndi\Params\MaxSpeed, max, 0, "2000" +HKR, Ndi\Params\MaxSpeed, step, 0, "1" +HKR, Ndi\Params\MaxSpeed, Base, 0, "10" +HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% +HKR, Ndi\Params\KeepLink, type, 0, "enum" +HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% +HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% +HKR, Ndi\Params\KeepLink, default, 0, "0" + + +[Neo.Service] +DisplayName = %Neo.Service.DispName% +Description = %Neo.Service.Desc% +ServiceType = 1 +StartType = 3 +ErrorControl = 1 +ServiceBinary = %12%\Neo6_x86_VPN109.sys +LoadOrderGroup = NDIS + +[Neo.Reg] +HKR, Ndi, Service, 0, Neo.Service.Name +HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" +HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" + +[Neo.EventLog] +HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN109.sys" +HKR, , TypesSupported, 0x00010001, 7 + +[Strings] +CompanyName = "SoftEther Corporation" +DiskDescription = "VPN Client Device Driver Install Disk" +Neo.Service.Name = "Neo_VPN109" +Neo.Service.DispName = "VPN Client Device Driver - VPN109" +Neo.Service.Desc = "VPN Client Adapter - VPN109" +NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN109" +Neo.EventLog.Name = "Neo" +NetworkAddress = "MAC Address" +DefaultAddress = "000001000001" +MaxSpeed = "Indicate Speed (Mbps)" +KeepLink = "Keep Link" +On = "On" +Off = "Off" + + +; Auto Generated 20180205_163620.024 + diff --git a/src/bin/hamcore/DriverPackages/Neo6_Win10/x86/Neo6_x86_VPN11.inf b/src/bin/hamcore/DriverPackages/Neo6_Win10/x86/Neo6_x86_VPN11.inf index f8d708c6..bfb772ba 100644 --- a/src/bin/hamcore/DriverPackages/Neo6_Win10/x86/Neo6_x86_VPN11.inf +++ b/src/bin/hamcore/DriverPackages/Neo6_Win10/x86/Neo6_x86_VPN11.inf @@ -1,114 +1,114 @@ -; VPN Client Device Driver for Windows 2000 and Greater -; -; Copyright (c) SoftEther Corporation. All Rights Reserved. -; http://www.softether.co.jp/ -; -; BUILD 9658 - -[Version] -Signature = "$Windows NT$" -Class = Net -ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} -Provider = %CompanyName% -DriverVer = 02/04/2018, 4.25.0.9658 -CatalogFile.NT = Neo6_x86_VPN11.cat - -[Manufacturer] -%CompanyName% = SoftEther - -[SourceDisksNames] -1=%DiskDescription%, "", , - -[SourceDisksFiles] -Neo6_x86_VPN11.sys = 1 - -[DestinationDirs] -DefaultDestDir = 12 -Neo.CopyFiles.Sys = 12 - -[Neo.CopyFiles.Sys] -Neo6_x86_VPN11.sys, , , 2 - -[SoftEther] -%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN11 - -[NeoAdapter.Install] -Characteristics = 0x1 -AddReg = Neo.Reg, NeoAdapter.Ndi -CopyFiles = Neo.CopyFiles.Sys -*IfType = 53 -*MediaType = 0 -*PhysicalMediaType = 0 - -[NeoAdapter.Install.Services] -AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% - -[NeoAdapter.Ndi] -HKR, , NetworkAddress, 0, %DefaultAddress% -HKR, Ndi, DeviceID, , "NeoAdapter_VPN11" -HKR, , DevLoader, , ndis -HKR, , DeviceVxDs, , Neo6_x86_VPN11.sys -HKR, NDIS, LogDriverName, , "Neo_VPN11" -HKR, NDIS, MajorNdisVersion, 1, 5 -HKR, NDIS, MinorNdisVersion, 1, 0 -HKR, Ndi\Interfaces, DefUpper, , "ndis5" -HKR, Ndi\Interfaces, UpperRange, , "ndis5" -HKR, Ndi\Interfaces, LowerRange, , "ethernet" -HKR, Ndi\Interfaces, DefLower, , "ethernet" -HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" -HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% -HKR, Ndi\Params\NetworkAddress, type, 0, "edit" -HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" -HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" -HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% -HKR, Ndi\Params\NetworkAddress, optional, 0, "0" -HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% -HKR, Ndi\Params\MaxSpeed, type, 0, "int" -HKR, Ndi\Params\MaxSpeed, default, 0, "100" -HKR, Ndi\Params\MaxSpeed, min, 0, "0" -HKR, Ndi\Params\MaxSpeed, max, 0, "2000" -HKR, Ndi\Params\MaxSpeed, step, 0, "1" -HKR, Ndi\Params\MaxSpeed, Base, 0, "10" -HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% -HKR, Ndi\Params\KeepLink, type, 0, "enum" -HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% -HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% -HKR, Ndi\Params\KeepLink, default, 0, "0" - - -[Neo.Service] -DisplayName = %Neo.Service.DispName% -Description = %Neo.Service.Desc% -ServiceType = 1 -StartType = 3 -ErrorControl = 1 -ServiceBinary = %12%\Neo6_x86_VPN11.sys -LoadOrderGroup = NDIS - -[Neo.Reg] -HKR, Ndi, Service, 0, Neo.Service.Name -HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" -HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" - -[Neo.EventLog] -HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN11.sys" -HKR, , TypesSupported, 0x00010001, 7 - -[Strings] -CompanyName = "SoftEther Corporation" -DiskDescription = "VPN Client Device Driver Install Disk" -Neo.Service.Name = "Neo_VPN11" -Neo.Service.DispName = "VPN Client Device Driver - VPN11" -Neo.Service.Desc = "VPN Client Adapter - VPN11" -NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN11" -Neo.EventLog.Name = "Neo" -NetworkAddress = "MAC Address" -DefaultAddress = "000001000001" -MaxSpeed = "Indicate Speed (Mbps)" -KeepLink = "Keep Link" -On = "On" -Off = "Off" - - -; Auto Generated 20180205_163613.045 - +; VPN Client Device Driver for Windows 2000 and Greater +; +; Copyright (c) SoftEther Corporation. All Rights Reserved. +; http://www.softether.co.jp/ +; +; BUILD 9658 + +[Version] +Signature = "$Windows NT$" +Class = Net +ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} +Provider = %CompanyName% +DriverVer = 02/04/2018, 4.25.0.9658 +CatalogFile.NT = Neo6_x86_VPN11.cat + +[Manufacturer] +%CompanyName% = SoftEther + +[SourceDisksNames] +1=%DiskDescription%, "", , + +[SourceDisksFiles] +Neo6_x86_VPN11.sys = 1 + +[DestinationDirs] +DefaultDestDir = 12 +Neo.CopyFiles.Sys = 12 + +[Neo.CopyFiles.Sys] +Neo6_x86_VPN11.sys, , , 2 + +[SoftEther] +%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN11 + +[NeoAdapter.Install] +Characteristics = 0x1 +AddReg = Neo.Reg, NeoAdapter.Ndi +CopyFiles = Neo.CopyFiles.Sys +*IfType = 53 +*MediaType = 0 +*PhysicalMediaType = 0 + +[NeoAdapter.Install.Services] +AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% + +[NeoAdapter.Ndi] +HKR, , NetworkAddress, 0, %DefaultAddress% +HKR, Ndi, DeviceID, , "NeoAdapter_VPN11" +HKR, , DevLoader, , ndis +HKR, , DeviceVxDs, , Neo6_x86_VPN11.sys +HKR, NDIS, LogDriverName, , "Neo_VPN11" +HKR, NDIS, MajorNdisVersion, 1, 5 +HKR, NDIS, MinorNdisVersion, 1, 0 +HKR, Ndi\Interfaces, DefUpper, , "ndis5" +HKR, Ndi\Interfaces, UpperRange, , "ndis5" +HKR, Ndi\Interfaces, LowerRange, , "ethernet" +HKR, Ndi\Interfaces, DefLower, , "ethernet" +HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" +HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% +HKR, Ndi\Params\NetworkAddress, type, 0, "edit" +HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" +HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" +HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% +HKR, Ndi\Params\NetworkAddress, optional, 0, "0" +HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% +HKR, Ndi\Params\MaxSpeed, type, 0, "int" +HKR, Ndi\Params\MaxSpeed, default, 0, "100" +HKR, Ndi\Params\MaxSpeed, min, 0, "0" +HKR, Ndi\Params\MaxSpeed, max, 0, "2000" +HKR, Ndi\Params\MaxSpeed, step, 0, "1" +HKR, Ndi\Params\MaxSpeed, Base, 0, "10" +HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% +HKR, Ndi\Params\KeepLink, type, 0, "enum" +HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% +HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% +HKR, Ndi\Params\KeepLink, default, 0, "0" + + +[Neo.Service] +DisplayName = %Neo.Service.DispName% +Description = %Neo.Service.Desc% +ServiceType = 1 +StartType = 3 +ErrorControl = 1 +ServiceBinary = %12%\Neo6_x86_VPN11.sys +LoadOrderGroup = NDIS + +[Neo.Reg] +HKR, Ndi, Service, 0, Neo.Service.Name +HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" +HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" + +[Neo.EventLog] +HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN11.sys" +HKR, , TypesSupported, 0x00010001, 7 + +[Strings] +CompanyName = "SoftEther Corporation" +DiskDescription = "VPN Client Device Driver Install Disk" +Neo.Service.Name = "Neo_VPN11" +Neo.Service.DispName = "VPN Client Device Driver - VPN11" +Neo.Service.Desc = "VPN Client Adapter - VPN11" +NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN11" +Neo.EventLog.Name = "Neo" +NetworkAddress = "MAC Address" +DefaultAddress = "000001000001" +MaxSpeed = "Indicate Speed (Mbps)" +KeepLink = "Keep Link" +On = "On" +Off = "Off" + + +; Auto Generated 20180205_163613.045 + diff --git a/src/bin/hamcore/DriverPackages/Neo6_Win10/x86/Neo6_x86_VPN110.inf b/src/bin/hamcore/DriverPackages/Neo6_Win10/x86/Neo6_x86_VPN110.inf index f9eeca84..8a539dcd 100644 --- a/src/bin/hamcore/DriverPackages/Neo6_Win10/x86/Neo6_x86_VPN110.inf +++ b/src/bin/hamcore/DriverPackages/Neo6_Win10/x86/Neo6_x86_VPN110.inf @@ -1,114 +1,114 @@ -; VPN Client Device Driver for Windows 2000 and Greater -; -; Copyright (c) SoftEther Corporation. All Rights Reserved. -; http://www.softether.co.jp/ -; -; BUILD 9658 - -[Version] -Signature = "$Windows NT$" -Class = Net -ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} -Provider = %CompanyName% -DriverVer = 02/04/2018, 4.25.0.9658 -CatalogFile.NT = Neo6_x86_VPN110.cat - -[Manufacturer] -%CompanyName% = SoftEther - -[SourceDisksNames] -1=%DiskDescription%, "", , - -[SourceDisksFiles] -Neo6_x86_VPN110.sys = 1 - -[DestinationDirs] -DefaultDestDir = 12 -Neo.CopyFiles.Sys = 12 - -[Neo.CopyFiles.Sys] -Neo6_x86_VPN110.sys, , , 2 - -[SoftEther] -%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN110 - -[NeoAdapter.Install] -Characteristics = 0x1 -AddReg = Neo.Reg, NeoAdapter.Ndi -CopyFiles = Neo.CopyFiles.Sys -*IfType = 53 -*MediaType = 0 -*PhysicalMediaType = 0 - -[NeoAdapter.Install.Services] -AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% - -[NeoAdapter.Ndi] -HKR, , NetworkAddress, 0, %DefaultAddress% -HKR, Ndi, DeviceID, , "NeoAdapter_VPN110" -HKR, , DevLoader, , ndis -HKR, , DeviceVxDs, , Neo6_x86_VPN110.sys -HKR, NDIS, LogDriverName, , "Neo_VPN110" -HKR, NDIS, MajorNdisVersion, 1, 5 -HKR, NDIS, MinorNdisVersion, 1, 0 -HKR, Ndi\Interfaces, DefUpper, , "ndis5" -HKR, Ndi\Interfaces, UpperRange, , "ndis5" -HKR, Ndi\Interfaces, LowerRange, , "ethernet" -HKR, Ndi\Interfaces, DefLower, , "ethernet" -HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" -HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% -HKR, Ndi\Params\NetworkAddress, type, 0, "edit" -HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" -HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" -HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% -HKR, Ndi\Params\NetworkAddress, optional, 0, "0" -HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% -HKR, Ndi\Params\MaxSpeed, type, 0, "int" -HKR, Ndi\Params\MaxSpeed, default, 0, "100" -HKR, Ndi\Params\MaxSpeed, min, 0, "0" -HKR, Ndi\Params\MaxSpeed, max, 0, "2000" -HKR, Ndi\Params\MaxSpeed, step, 0, "1" -HKR, Ndi\Params\MaxSpeed, Base, 0, "10" -HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% -HKR, Ndi\Params\KeepLink, type, 0, "enum" -HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% -HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% -HKR, Ndi\Params\KeepLink, default, 0, "0" - - -[Neo.Service] -DisplayName = %Neo.Service.DispName% -Description = %Neo.Service.Desc% -ServiceType = 1 -StartType = 3 -ErrorControl = 1 -ServiceBinary = %12%\Neo6_x86_VPN110.sys -LoadOrderGroup = NDIS - -[Neo.Reg] -HKR, Ndi, Service, 0, Neo.Service.Name -HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" -HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" - -[Neo.EventLog] -HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN110.sys" -HKR, , TypesSupported, 0x00010001, 7 - -[Strings] -CompanyName = "SoftEther Corporation" -DiskDescription = "VPN Client Device Driver Install Disk" -Neo.Service.Name = "Neo_VPN110" -Neo.Service.DispName = "VPN Client Device Driver - VPN110" -Neo.Service.Desc = "VPN Client Adapter - VPN110" -NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN110" -Neo.EventLog.Name = "Neo" -NetworkAddress = "MAC Address" -DefaultAddress = "000001000001" -MaxSpeed = "Indicate Speed (Mbps)" -KeepLink = "Keep Link" -On = "On" -Off = "Off" - - -; Auto Generated 20180205_163620.095 - +; VPN Client Device Driver for Windows 2000 and Greater +; +; Copyright (c) SoftEther Corporation. All Rights Reserved. +; http://www.softether.co.jp/ +; +; BUILD 9658 + +[Version] +Signature = "$Windows NT$" +Class = Net +ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} +Provider = %CompanyName% +DriverVer = 02/04/2018, 4.25.0.9658 +CatalogFile.NT = Neo6_x86_VPN110.cat + +[Manufacturer] +%CompanyName% = SoftEther + +[SourceDisksNames] +1=%DiskDescription%, "", , + +[SourceDisksFiles] +Neo6_x86_VPN110.sys = 1 + +[DestinationDirs] +DefaultDestDir = 12 +Neo.CopyFiles.Sys = 12 + +[Neo.CopyFiles.Sys] +Neo6_x86_VPN110.sys, , , 2 + +[SoftEther] +%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN110 + +[NeoAdapter.Install] +Characteristics = 0x1 +AddReg = Neo.Reg, NeoAdapter.Ndi +CopyFiles = Neo.CopyFiles.Sys +*IfType = 53 +*MediaType = 0 +*PhysicalMediaType = 0 + +[NeoAdapter.Install.Services] +AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% + +[NeoAdapter.Ndi] +HKR, , NetworkAddress, 0, %DefaultAddress% +HKR, Ndi, DeviceID, , "NeoAdapter_VPN110" +HKR, , DevLoader, , ndis +HKR, , DeviceVxDs, , Neo6_x86_VPN110.sys +HKR, NDIS, LogDriverName, , "Neo_VPN110" +HKR, NDIS, MajorNdisVersion, 1, 5 +HKR, NDIS, MinorNdisVersion, 1, 0 +HKR, Ndi\Interfaces, DefUpper, , "ndis5" +HKR, Ndi\Interfaces, UpperRange, , "ndis5" +HKR, Ndi\Interfaces, LowerRange, , "ethernet" +HKR, Ndi\Interfaces, DefLower, , "ethernet" +HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" +HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% +HKR, Ndi\Params\NetworkAddress, type, 0, "edit" +HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" +HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" +HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% +HKR, Ndi\Params\NetworkAddress, optional, 0, "0" +HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% +HKR, Ndi\Params\MaxSpeed, type, 0, "int" +HKR, Ndi\Params\MaxSpeed, default, 0, "100" +HKR, Ndi\Params\MaxSpeed, min, 0, "0" +HKR, Ndi\Params\MaxSpeed, max, 0, "2000" +HKR, Ndi\Params\MaxSpeed, step, 0, "1" +HKR, Ndi\Params\MaxSpeed, Base, 0, "10" +HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% +HKR, Ndi\Params\KeepLink, type, 0, "enum" +HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% +HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% +HKR, Ndi\Params\KeepLink, default, 0, "0" + + +[Neo.Service] +DisplayName = %Neo.Service.DispName% +Description = %Neo.Service.Desc% +ServiceType = 1 +StartType = 3 +ErrorControl = 1 +ServiceBinary = %12%\Neo6_x86_VPN110.sys +LoadOrderGroup = NDIS + +[Neo.Reg] +HKR, Ndi, Service, 0, Neo.Service.Name +HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" +HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" + +[Neo.EventLog] +HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN110.sys" +HKR, , TypesSupported, 0x00010001, 7 + +[Strings] +CompanyName = "SoftEther Corporation" +DiskDescription = "VPN Client Device Driver Install Disk" +Neo.Service.Name = "Neo_VPN110" +Neo.Service.DispName = "VPN Client Device Driver - VPN110" +Neo.Service.Desc = "VPN Client Adapter - VPN110" +NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN110" +Neo.EventLog.Name = "Neo" +NetworkAddress = "MAC Address" +DefaultAddress = "000001000001" +MaxSpeed = "Indicate Speed (Mbps)" +KeepLink = "Keep Link" +On = "On" +Off = "Off" + + +; Auto Generated 20180205_163620.095 + diff --git a/src/bin/hamcore/DriverPackages/Neo6_Win10/x86/Neo6_x86_VPN111.inf b/src/bin/hamcore/DriverPackages/Neo6_Win10/x86/Neo6_x86_VPN111.inf index db5ffb59..98f90760 100644 --- a/src/bin/hamcore/DriverPackages/Neo6_Win10/x86/Neo6_x86_VPN111.inf +++ b/src/bin/hamcore/DriverPackages/Neo6_Win10/x86/Neo6_x86_VPN111.inf @@ -1,114 +1,114 @@ -; VPN Client Device Driver for Windows 2000 and Greater -; -; Copyright (c) SoftEther Corporation. All Rights Reserved. -; http://www.softether.co.jp/ -; -; BUILD 9658 - -[Version] -Signature = "$Windows NT$" -Class = Net -ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} -Provider = %CompanyName% -DriverVer = 02/04/2018, 4.25.0.9658 -CatalogFile.NT = Neo6_x86_VPN111.cat - -[Manufacturer] -%CompanyName% = SoftEther - -[SourceDisksNames] -1=%DiskDescription%, "", , - -[SourceDisksFiles] -Neo6_x86_VPN111.sys = 1 - -[DestinationDirs] -DefaultDestDir = 12 -Neo.CopyFiles.Sys = 12 - -[Neo.CopyFiles.Sys] -Neo6_x86_VPN111.sys, , , 2 - -[SoftEther] -%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN111 - -[NeoAdapter.Install] -Characteristics = 0x1 -AddReg = Neo.Reg, NeoAdapter.Ndi -CopyFiles = Neo.CopyFiles.Sys -*IfType = 53 -*MediaType = 0 -*PhysicalMediaType = 0 - -[NeoAdapter.Install.Services] -AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% - -[NeoAdapter.Ndi] -HKR, , NetworkAddress, 0, %DefaultAddress% -HKR, Ndi, DeviceID, , "NeoAdapter_VPN111" -HKR, , DevLoader, , ndis -HKR, , DeviceVxDs, , Neo6_x86_VPN111.sys -HKR, NDIS, LogDriverName, , "Neo_VPN111" -HKR, NDIS, MajorNdisVersion, 1, 5 -HKR, NDIS, MinorNdisVersion, 1, 0 -HKR, Ndi\Interfaces, DefUpper, , "ndis5" -HKR, Ndi\Interfaces, UpperRange, , "ndis5" -HKR, Ndi\Interfaces, LowerRange, , "ethernet" -HKR, Ndi\Interfaces, DefLower, , "ethernet" -HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" -HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% -HKR, Ndi\Params\NetworkAddress, type, 0, "edit" -HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" -HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" -HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% -HKR, Ndi\Params\NetworkAddress, optional, 0, "0" -HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% -HKR, Ndi\Params\MaxSpeed, type, 0, "int" -HKR, Ndi\Params\MaxSpeed, default, 0, "100" -HKR, Ndi\Params\MaxSpeed, min, 0, "0" -HKR, Ndi\Params\MaxSpeed, max, 0, "2000" -HKR, Ndi\Params\MaxSpeed, step, 0, "1" -HKR, Ndi\Params\MaxSpeed, Base, 0, "10" -HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% -HKR, Ndi\Params\KeepLink, type, 0, "enum" -HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% -HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% -HKR, Ndi\Params\KeepLink, default, 0, "0" - - -[Neo.Service] -DisplayName = %Neo.Service.DispName% -Description = %Neo.Service.Desc% -ServiceType = 1 -StartType = 3 -ErrorControl = 1 -ServiceBinary = %12%\Neo6_x86_VPN111.sys -LoadOrderGroup = NDIS - -[Neo.Reg] -HKR, Ndi, Service, 0, Neo.Service.Name -HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" -HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" - -[Neo.EventLog] -HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN111.sys" -HKR, , TypesSupported, 0x00010001, 7 - -[Strings] -CompanyName = "SoftEther Corporation" -DiskDescription = "VPN Client Device Driver Install Disk" -Neo.Service.Name = "Neo_VPN111" -Neo.Service.DispName = "VPN Client Device Driver - VPN111" -Neo.Service.Desc = "VPN Client Adapter - VPN111" -NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN111" -Neo.EventLog.Name = "Neo" -NetworkAddress = "MAC Address" -DefaultAddress = "000001000001" -MaxSpeed = "Indicate Speed (Mbps)" -KeepLink = "Keep Link" -On = "On" -Off = "Off" - - -; Auto Generated 20180205_163620.167 - +; VPN Client Device Driver for Windows 2000 and Greater +; +; Copyright (c) SoftEther Corporation. All Rights Reserved. +; http://www.softether.co.jp/ +; +; BUILD 9658 + +[Version] +Signature = "$Windows NT$" +Class = Net +ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} +Provider = %CompanyName% +DriverVer = 02/04/2018, 4.25.0.9658 +CatalogFile.NT = Neo6_x86_VPN111.cat + +[Manufacturer] +%CompanyName% = SoftEther + +[SourceDisksNames] +1=%DiskDescription%, "", , + +[SourceDisksFiles] +Neo6_x86_VPN111.sys = 1 + +[DestinationDirs] +DefaultDestDir = 12 +Neo.CopyFiles.Sys = 12 + +[Neo.CopyFiles.Sys] +Neo6_x86_VPN111.sys, , , 2 + +[SoftEther] +%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN111 + +[NeoAdapter.Install] +Characteristics = 0x1 +AddReg = Neo.Reg, NeoAdapter.Ndi +CopyFiles = Neo.CopyFiles.Sys +*IfType = 53 +*MediaType = 0 +*PhysicalMediaType = 0 + +[NeoAdapter.Install.Services] +AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% + +[NeoAdapter.Ndi] +HKR, , NetworkAddress, 0, %DefaultAddress% +HKR, Ndi, DeviceID, , "NeoAdapter_VPN111" +HKR, , DevLoader, , ndis +HKR, , DeviceVxDs, , Neo6_x86_VPN111.sys +HKR, NDIS, LogDriverName, , "Neo_VPN111" +HKR, NDIS, MajorNdisVersion, 1, 5 +HKR, NDIS, MinorNdisVersion, 1, 0 +HKR, Ndi\Interfaces, DefUpper, , "ndis5" +HKR, Ndi\Interfaces, UpperRange, , "ndis5" +HKR, Ndi\Interfaces, LowerRange, , "ethernet" +HKR, Ndi\Interfaces, DefLower, , "ethernet" +HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" +HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% +HKR, Ndi\Params\NetworkAddress, type, 0, "edit" +HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" +HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" +HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% +HKR, Ndi\Params\NetworkAddress, optional, 0, "0" +HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% +HKR, Ndi\Params\MaxSpeed, type, 0, "int" +HKR, Ndi\Params\MaxSpeed, default, 0, "100" +HKR, Ndi\Params\MaxSpeed, min, 0, "0" +HKR, Ndi\Params\MaxSpeed, max, 0, "2000" +HKR, Ndi\Params\MaxSpeed, step, 0, "1" +HKR, Ndi\Params\MaxSpeed, Base, 0, "10" +HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% +HKR, Ndi\Params\KeepLink, type, 0, "enum" +HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% +HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% +HKR, Ndi\Params\KeepLink, default, 0, "0" + + +[Neo.Service] +DisplayName = %Neo.Service.DispName% +Description = %Neo.Service.Desc% +ServiceType = 1 +StartType = 3 +ErrorControl = 1 +ServiceBinary = %12%\Neo6_x86_VPN111.sys +LoadOrderGroup = NDIS + +[Neo.Reg] +HKR, Ndi, Service, 0, Neo.Service.Name +HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" +HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" + +[Neo.EventLog] +HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN111.sys" +HKR, , TypesSupported, 0x00010001, 7 + +[Strings] +CompanyName = "SoftEther Corporation" +DiskDescription = "VPN Client Device Driver Install Disk" +Neo.Service.Name = "Neo_VPN111" +Neo.Service.DispName = "VPN Client Device Driver - VPN111" +Neo.Service.Desc = "VPN Client Adapter - VPN111" +NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN111" +Neo.EventLog.Name = "Neo" +NetworkAddress = "MAC Address" +DefaultAddress = "000001000001" +MaxSpeed = "Indicate Speed (Mbps)" +KeepLink = "Keep Link" +On = "On" +Off = "Off" + + +; Auto Generated 20180205_163620.167 + diff --git a/src/bin/hamcore/DriverPackages/Neo6_Win10/x86/Neo6_x86_VPN112.inf b/src/bin/hamcore/DriverPackages/Neo6_Win10/x86/Neo6_x86_VPN112.inf index 4fa94f70..7c20eb13 100644 --- a/src/bin/hamcore/DriverPackages/Neo6_Win10/x86/Neo6_x86_VPN112.inf +++ b/src/bin/hamcore/DriverPackages/Neo6_Win10/x86/Neo6_x86_VPN112.inf @@ -1,114 +1,114 @@ -; VPN Client Device Driver for Windows 2000 and Greater -; -; Copyright (c) SoftEther Corporation. All Rights Reserved. -; http://www.softether.co.jp/ -; -; BUILD 9658 - -[Version] -Signature = "$Windows NT$" -Class = Net -ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} -Provider = %CompanyName% -DriverVer = 02/04/2018, 4.25.0.9658 -CatalogFile.NT = Neo6_x86_VPN112.cat - -[Manufacturer] -%CompanyName% = SoftEther - -[SourceDisksNames] -1=%DiskDescription%, "", , - -[SourceDisksFiles] -Neo6_x86_VPN112.sys = 1 - -[DestinationDirs] -DefaultDestDir = 12 -Neo.CopyFiles.Sys = 12 - -[Neo.CopyFiles.Sys] -Neo6_x86_VPN112.sys, , , 2 - -[SoftEther] -%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN112 - -[NeoAdapter.Install] -Characteristics = 0x1 -AddReg = Neo.Reg, NeoAdapter.Ndi -CopyFiles = Neo.CopyFiles.Sys -*IfType = 53 -*MediaType = 0 -*PhysicalMediaType = 0 - -[NeoAdapter.Install.Services] -AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% - -[NeoAdapter.Ndi] -HKR, , NetworkAddress, 0, %DefaultAddress% -HKR, Ndi, DeviceID, , "NeoAdapter_VPN112" -HKR, , DevLoader, , ndis -HKR, , DeviceVxDs, , Neo6_x86_VPN112.sys -HKR, NDIS, LogDriverName, , "Neo_VPN112" -HKR, NDIS, MajorNdisVersion, 1, 5 -HKR, NDIS, MinorNdisVersion, 1, 0 -HKR, Ndi\Interfaces, DefUpper, , "ndis5" -HKR, Ndi\Interfaces, UpperRange, , "ndis5" -HKR, Ndi\Interfaces, LowerRange, , "ethernet" -HKR, Ndi\Interfaces, DefLower, , "ethernet" -HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" -HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% -HKR, Ndi\Params\NetworkAddress, type, 0, "edit" -HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" -HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" -HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% -HKR, Ndi\Params\NetworkAddress, optional, 0, "0" -HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% -HKR, Ndi\Params\MaxSpeed, type, 0, "int" -HKR, Ndi\Params\MaxSpeed, default, 0, "100" -HKR, Ndi\Params\MaxSpeed, min, 0, "0" -HKR, Ndi\Params\MaxSpeed, max, 0, "2000" -HKR, Ndi\Params\MaxSpeed, step, 0, "1" -HKR, Ndi\Params\MaxSpeed, Base, 0, "10" -HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% -HKR, Ndi\Params\KeepLink, type, 0, "enum" -HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% -HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% -HKR, Ndi\Params\KeepLink, default, 0, "0" - - -[Neo.Service] -DisplayName = %Neo.Service.DispName% -Description = %Neo.Service.Desc% -ServiceType = 1 -StartType = 3 -ErrorControl = 1 -ServiceBinary = %12%\Neo6_x86_VPN112.sys -LoadOrderGroup = NDIS - -[Neo.Reg] -HKR, Ndi, Service, 0, Neo.Service.Name -HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" -HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" - -[Neo.EventLog] -HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN112.sys" -HKR, , TypesSupported, 0x00010001, 7 - -[Strings] -CompanyName = "SoftEther Corporation" -DiskDescription = "VPN Client Device Driver Install Disk" -Neo.Service.Name = "Neo_VPN112" -Neo.Service.DispName = "VPN Client Device Driver - VPN112" -Neo.Service.Desc = "VPN Client Adapter - VPN112" -NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN112" -Neo.EventLog.Name = "Neo" -NetworkAddress = "MAC Address" -DefaultAddress = "000001000001" -MaxSpeed = "Indicate Speed (Mbps)" -KeepLink = "Keep Link" -On = "On" -Off = "Off" - - -; Auto Generated 20180205_163620.238 - +; VPN Client Device Driver for Windows 2000 and Greater +; +; Copyright (c) SoftEther Corporation. All Rights Reserved. +; http://www.softether.co.jp/ +; +; BUILD 9658 + +[Version] +Signature = "$Windows NT$" +Class = Net +ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} +Provider = %CompanyName% +DriverVer = 02/04/2018, 4.25.0.9658 +CatalogFile.NT = Neo6_x86_VPN112.cat + +[Manufacturer] +%CompanyName% = SoftEther + +[SourceDisksNames] +1=%DiskDescription%, "", , + +[SourceDisksFiles] +Neo6_x86_VPN112.sys = 1 + +[DestinationDirs] +DefaultDestDir = 12 +Neo.CopyFiles.Sys = 12 + +[Neo.CopyFiles.Sys] +Neo6_x86_VPN112.sys, , , 2 + +[SoftEther] +%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN112 + +[NeoAdapter.Install] +Characteristics = 0x1 +AddReg = Neo.Reg, NeoAdapter.Ndi +CopyFiles = Neo.CopyFiles.Sys +*IfType = 53 +*MediaType = 0 +*PhysicalMediaType = 0 + +[NeoAdapter.Install.Services] +AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% + +[NeoAdapter.Ndi] +HKR, , NetworkAddress, 0, %DefaultAddress% +HKR, Ndi, DeviceID, , "NeoAdapter_VPN112" +HKR, , DevLoader, , ndis +HKR, , DeviceVxDs, , Neo6_x86_VPN112.sys +HKR, NDIS, LogDriverName, , "Neo_VPN112" +HKR, NDIS, MajorNdisVersion, 1, 5 +HKR, NDIS, MinorNdisVersion, 1, 0 +HKR, Ndi\Interfaces, DefUpper, , "ndis5" +HKR, Ndi\Interfaces, UpperRange, , "ndis5" +HKR, Ndi\Interfaces, LowerRange, , "ethernet" +HKR, Ndi\Interfaces, DefLower, , "ethernet" +HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" +HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% +HKR, Ndi\Params\NetworkAddress, type, 0, "edit" +HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" +HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" +HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% +HKR, Ndi\Params\NetworkAddress, optional, 0, "0" +HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% +HKR, Ndi\Params\MaxSpeed, type, 0, "int" +HKR, Ndi\Params\MaxSpeed, default, 0, "100" +HKR, Ndi\Params\MaxSpeed, min, 0, "0" +HKR, Ndi\Params\MaxSpeed, max, 0, "2000" +HKR, Ndi\Params\MaxSpeed, step, 0, "1" +HKR, Ndi\Params\MaxSpeed, Base, 0, "10" +HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% +HKR, Ndi\Params\KeepLink, type, 0, "enum" +HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% +HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% +HKR, Ndi\Params\KeepLink, default, 0, "0" + + +[Neo.Service] +DisplayName = %Neo.Service.DispName% +Description = %Neo.Service.Desc% +ServiceType = 1 +StartType = 3 +ErrorControl = 1 +ServiceBinary = %12%\Neo6_x86_VPN112.sys +LoadOrderGroup = NDIS + +[Neo.Reg] +HKR, Ndi, Service, 0, Neo.Service.Name +HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" +HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" + +[Neo.EventLog] +HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN112.sys" +HKR, , TypesSupported, 0x00010001, 7 + +[Strings] +CompanyName = "SoftEther Corporation" +DiskDescription = "VPN Client Device Driver Install Disk" +Neo.Service.Name = "Neo_VPN112" +Neo.Service.DispName = "VPN Client Device Driver - VPN112" +Neo.Service.Desc = "VPN Client Adapter - VPN112" +NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN112" +Neo.EventLog.Name = "Neo" +NetworkAddress = "MAC Address" +DefaultAddress = "000001000001" +MaxSpeed = "Indicate Speed (Mbps)" +KeepLink = "Keep Link" +On = "On" +Off = "Off" + + +; Auto Generated 20180205_163620.238 + diff --git a/src/bin/hamcore/DriverPackages/Neo6_Win10/x86/Neo6_x86_VPN113.inf b/src/bin/hamcore/DriverPackages/Neo6_Win10/x86/Neo6_x86_VPN113.inf index 82968149..bb33eb76 100644 --- a/src/bin/hamcore/DriverPackages/Neo6_Win10/x86/Neo6_x86_VPN113.inf +++ b/src/bin/hamcore/DriverPackages/Neo6_Win10/x86/Neo6_x86_VPN113.inf @@ -1,114 +1,114 @@ -; VPN Client Device Driver for Windows 2000 and Greater -; -; Copyright (c) SoftEther Corporation. All Rights Reserved. -; http://www.softether.co.jp/ -; -; BUILD 9658 - -[Version] -Signature = "$Windows NT$" -Class = Net -ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} -Provider = %CompanyName% -DriverVer = 02/04/2018, 4.25.0.9658 -CatalogFile.NT = Neo6_x86_VPN113.cat - -[Manufacturer] -%CompanyName% = SoftEther - -[SourceDisksNames] -1=%DiskDescription%, "", , - -[SourceDisksFiles] -Neo6_x86_VPN113.sys = 1 - -[DestinationDirs] -DefaultDestDir = 12 -Neo.CopyFiles.Sys = 12 - -[Neo.CopyFiles.Sys] -Neo6_x86_VPN113.sys, , , 2 - -[SoftEther] -%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN113 - -[NeoAdapter.Install] -Characteristics = 0x1 -AddReg = Neo.Reg, NeoAdapter.Ndi -CopyFiles = Neo.CopyFiles.Sys -*IfType = 53 -*MediaType = 0 -*PhysicalMediaType = 0 - -[NeoAdapter.Install.Services] -AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% - -[NeoAdapter.Ndi] -HKR, , NetworkAddress, 0, %DefaultAddress% -HKR, Ndi, DeviceID, , "NeoAdapter_VPN113" -HKR, , DevLoader, , ndis -HKR, , DeviceVxDs, , Neo6_x86_VPN113.sys -HKR, NDIS, LogDriverName, , "Neo_VPN113" -HKR, NDIS, MajorNdisVersion, 1, 5 -HKR, NDIS, MinorNdisVersion, 1, 0 -HKR, Ndi\Interfaces, DefUpper, , "ndis5" -HKR, Ndi\Interfaces, UpperRange, , "ndis5" -HKR, Ndi\Interfaces, LowerRange, , "ethernet" -HKR, Ndi\Interfaces, DefLower, , "ethernet" -HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" -HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% -HKR, Ndi\Params\NetworkAddress, type, 0, "edit" -HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" -HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" -HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% -HKR, Ndi\Params\NetworkAddress, optional, 0, "0" -HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% -HKR, Ndi\Params\MaxSpeed, type, 0, "int" -HKR, Ndi\Params\MaxSpeed, default, 0, "100" -HKR, Ndi\Params\MaxSpeed, min, 0, "0" -HKR, Ndi\Params\MaxSpeed, max, 0, "2000" -HKR, Ndi\Params\MaxSpeed, step, 0, "1" -HKR, Ndi\Params\MaxSpeed, Base, 0, "10" -HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% -HKR, Ndi\Params\KeepLink, type, 0, "enum" -HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% -HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% -HKR, Ndi\Params\KeepLink, default, 0, "0" - - -[Neo.Service] -DisplayName = %Neo.Service.DispName% -Description = %Neo.Service.Desc% -ServiceType = 1 -StartType = 3 -ErrorControl = 1 -ServiceBinary = %12%\Neo6_x86_VPN113.sys -LoadOrderGroup = NDIS - -[Neo.Reg] -HKR, Ndi, Service, 0, Neo.Service.Name -HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" -HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" - -[Neo.EventLog] -HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN113.sys" -HKR, , TypesSupported, 0x00010001, 7 - -[Strings] -CompanyName = "SoftEther Corporation" -DiskDescription = "VPN Client Device Driver Install Disk" -Neo.Service.Name = "Neo_VPN113" -Neo.Service.DispName = "VPN Client Device Driver - VPN113" -Neo.Service.Desc = "VPN Client Adapter - VPN113" -NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN113" -Neo.EventLog.Name = "Neo" -NetworkAddress = "MAC Address" -DefaultAddress = "000001000001" -MaxSpeed = "Indicate Speed (Mbps)" -KeepLink = "Keep Link" -On = "On" -Off = "Off" - - -; Auto Generated 20180205_163620.311 - +; VPN Client Device Driver for Windows 2000 and Greater +; +; Copyright (c) SoftEther Corporation. All Rights Reserved. +; http://www.softether.co.jp/ +; +; BUILD 9658 + +[Version] +Signature = "$Windows NT$" +Class = Net +ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} +Provider = %CompanyName% +DriverVer = 02/04/2018, 4.25.0.9658 +CatalogFile.NT = Neo6_x86_VPN113.cat + +[Manufacturer] +%CompanyName% = SoftEther + +[SourceDisksNames] +1=%DiskDescription%, "", , + +[SourceDisksFiles] +Neo6_x86_VPN113.sys = 1 + +[DestinationDirs] +DefaultDestDir = 12 +Neo.CopyFiles.Sys = 12 + +[Neo.CopyFiles.Sys] +Neo6_x86_VPN113.sys, , , 2 + +[SoftEther] +%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN113 + +[NeoAdapter.Install] +Characteristics = 0x1 +AddReg = Neo.Reg, NeoAdapter.Ndi +CopyFiles = Neo.CopyFiles.Sys +*IfType = 53 +*MediaType = 0 +*PhysicalMediaType = 0 + +[NeoAdapter.Install.Services] +AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% + +[NeoAdapter.Ndi] +HKR, , NetworkAddress, 0, %DefaultAddress% +HKR, Ndi, DeviceID, , "NeoAdapter_VPN113" +HKR, , DevLoader, , ndis +HKR, , DeviceVxDs, , Neo6_x86_VPN113.sys +HKR, NDIS, LogDriverName, , "Neo_VPN113" +HKR, NDIS, MajorNdisVersion, 1, 5 +HKR, NDIS, MinorNdisVersion, 1, 0 +HKR, Ndi\Interfaces, DefUpper, , "ndis5" +HKR, Ndi\Interfaces, UpperRange, , "ndis5" +HKR, Ndi\Interfaces, LowerRange, , "ethernet" +HKR, Ndi\Interfaces, DefLower, , "ethernet" +HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" +HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% +HKR, Ndi\Params\NetworkAddress, type, 0, "edit" +HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" +HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" +HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% +HKR, Ndi\Params\NetworkAddress, optional, 0, "0" +HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% +HKR, Ndi\Params\MaxSpeed, type, 0, "int" +HKR, Ndi\Params\MaxSpeed, default, 0, "100" +HKR, Ndi\Params\MaxSpeed, min, 0, "0" +HKR, Ndi\Params\MaxSpeed, max, 0, "2000" +HKR, Ndi\Params\MaxSpeed, step, 0, "1" +HKR, Ndi\Params\MaxSpeed, Base, 0, "10" +HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% +HKR, Ndi\Params\KeepLink, type, 0, "enum" +HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% +HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% +HKR, Ndi\Params\KeepLink, default, 0, "0" + + +[Neo.Service] +DisplayName = %Neo.Service.DispName% +Description = %Neo.Service.Desc% +ServiceType = 1 +StartType = 3 +ErrorControl = 1 +ServiceBinary = %12%\Neo6_x86_VPN113.sys +LoadOrderGroup = NDIS + +[Neo.Reg] +HKR, Ndi, Service, 0, Neo.Service.Name +HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" +HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" + +[Neo.EventLog] +HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN113.sys" +HKR, , TypesSupported, 0x00010001, 7 + +[Strings] +CompanyName = "SoftEther Corporation" +DiskDescription = "VPN Client Device Driver Install Disk" +Neo.Service.Name = "Neo_VPN113" +Neo.Service.DispName = "VPN Client Device Driver - VPN113" +Neo.Service.Desc = "VPN Client Adapter - VPN113" +NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN113" +Neo.EventLog.Name = "Neo" +NetworkAddress = "MAC Address" +DefaultAddress = "000001000001" +MaxSpeed = "Indicate Speed (Mbps)" +KeepLink = "Keep Link" +On = "On" +Off = "Off" + + +; Auto Generated 20180205_163620.311 + diff --git a/src/bin/hamcore/DriverPackages/Neo6_Win10/x86/Neo6_x86_VPN114.inf b/src/bin/hamcore/DriverPackages/Neo6_Win10/x86/Neo6_x86_VPN114.inf index 3b1c04b4..1d846425 100644 --- a/src/bin/hamcore/DriverPackages/Neo6_Win10/x86/Neo6_x86_VPN114.inf +++ b/src/bin/hamcore/DriverPackages/Neo6_Win10/x86/Neo6_x86_VPN114.inf @@ -1,114 +1,114 @@ -; VPN Client Device Driver for Windows 2000 and Greater -; -; Copyright (c) SoftEther Corporation. All Rights Reserved. -; http://www.softether.co.jp/ -; -; BUILD 9658 - -[Version] -Signature = "$Windows NT$" -Class = Net -ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} -Provider = %CompanyName% -DriverVer = 02/04/2018, 4.25.0.9658 -CatalogFile.NT = Neo6_x86_VPN114.cat - -[Manufacturer] -%CompanyName% = SoftEther - -[SourceDisksNames] -1=%DiskDescription%, "", , - -[SourceDisksFiles] -Neo6_x86_VPN114.sys = 1 - -[DestinationDirs] -DefaultDestDir = 12 -Neo.CopyFiles.Sys = 12 - -[Neo.CopyFiles.Sys] -Neo6_x86_VPN114.sys, , , 2 - -[SoftEther] -%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN114 - -[NeoAdapter.Install] -Characteristics = 0x1 -AddReg = Neo.Reg, NeoAdapter.Ndi -CopyFiles = Neo.CopyFiles.Sys -*IfType = 53 -*MediaType = 0 -*PhysicalMediaType = 0 - -[NeoAdapter.Install.Services] -AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% - -[NeoAdapter.Ndi] -HKR, , NetworkAddress, 0, %DefaultAddress% -HKR, Ndi, DeviceID, , "NeoAdapter_VPN114" -HKR, , DevLoader, , ndis -HKR, , DeviceVxDs, , Neo6_x86_VPN114.sys -HKR, NDIS, LogDriverName, , "Neo_VPN114" -HKR, NDIS, MajorNdisVersion, 1, 5 -HKR, NDIS, MinorNdisVersion, 1, 0 -HKR, Ndi\Interfaces, DefUpper, , "ndis5" -HKR, Ndi\Interfaces, UpperRange, , "ndis5" -HKR, Ndi\Interfaces, LowerRange, , "ethernet" -HKR, Ndi\Interfaces, DefLower, , "ethernet" -HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" -HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% -HKR, Ndi\Params\NetworkAddress, type, 0, "edit" -HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" -HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" -HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% -HKR, Ndi\Params\NetworkAddress, optional, 0, "0" -HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% -HKR, Ndi\Params\MaxSpeed, type, 0, "int" -HKR, Ndi\Params\MaxSpeed, default, 0, "100" -HKR, Ndi\Params\MaxSpeed, min, 0, "0" -HKR, Ndi\Params\MaxSpeed, max, 0, "2000" -HKR, Ndi\Params\MaxSpeed, step, 0, "1" -HKR, Ndi\Params\MaxSpeed, Base, 0, "10" -HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% -HKR, Ndi\Params\KeepLink, type, 0, "enum" -HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% -HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% -HKR, Ndi\Params\KeepLink, default, 0, "0" - - -[Neo.Service] -DisplayName = %Neo.Service.DispName% -Description = %Neo.Service.Desc% -ServiceType = 1 -StartType = 3 -ErrorControl = 1 -ServiceBinary = %12%\Neo6_x86_VPN114.sys -LoadOrderGroup = NDIS - -[Neo.Reg] -HKR, Ndi, Service, 0, Neo.Service.Name -HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" -HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" - -[Neo.EventLog] -HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN114.sys" -HKR, , TypesSupported, 0x00010001, 7 - -[Strings] -CompanyName = "SoftEther Corporation" -DiskDescription = "VPN Client Device Driver Install Disk" -Neo.Service.Name = "Neo_VPN114" -Neo.Service.DispName = "VPN Client Device Driver - VPN114" -Neo.Service.Desc = "VPN Client Adapter - VPN114" -NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN114" -Neo.EventLog.Name = "Neo" -NetworkAddress = "MAC Address" -DefaultAddress = "000001000001" -MaxSpeed = "Indicate Speed (Mbps)" -KeepLink = "Keep Link" -On = "On" -Off = "Off" - - -; Auto Generated 20180205_163620.383 - +; VPN Client Device Driver for Windows 2000 and Greater +; +; Copyright (c) SoftEther Corporation. All Rights Reserved. +; http://www.softether.co.jp/ +; +; BUILD 9658 + +[Version] +Signature = "$Windows NT$" +Class = Net +ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} +Provider = %CompanyName% +DriverVer = 02/04/2018, 4.25.0.9658 +CatalogFile.NT = Neo6_x86_VPN114.cat + +[Manufacturer] +%CompanyName% = SoftEther + +[SourceDisksNames] +1=%DiskDescription%, "", , + +[SourceDisksFiles] +Neo6_x86_VPN114.sys = 1 + +[DestinationDirs] +DefaultDestDir = 12 +Neo.CopyFiles.Sys = 12 + +[Neo.CopyFiles.Sys] +Neo6_x86_VPN114.sys, , , 2 + +[SoftEther] +%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN114 + +[NeoAdapter.Install] +Characteristics = 0x1 +AddReg = Neo.Reg, NeoAdapter.Ndi +CopyFiles = Neo.CopyFiles.Sys +*IfType = 53 +*MediaType = 0 +*PhysicalMediaType = 0 + +[NeoAdapter.Install.Services] +AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% + +[NeoAdapter.Ndi] +HKR, , NetworkAddress, 0, %DefaultAddress% +HKR, Ndi, DeviceID, , "NeoAdapter_VPN114" +HKR, , DevLoader, , ndis +HKR, , DeviceVxDs, , Neo6_x86_VPN114.sys +HKR, NDIS, LogDriverName, , "Neo_VPN114" +HKR, NDIS, MajorNdisVersion, 1, 5 +HKR, NDIS, MinorNdisVersion, 1, 0 +HKR, Ndi\Interfaces, DefUpper, , "ndis5" +HKR, Ndi\Interfaces, UpperRange, , "ndis5" +HKR, Ndi\Interfaces, LowerRange, , "ethernet" +HKR, Ndi\Interfaces, DefLower, , "ethernet" +HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" +HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% +HKR, Ndi\Params\NetworkAddress, type, 0, "edit" +HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" +HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" +HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% +HKR, Ndi\Params\NetworkAddress, optional, 0, "0" +HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% +HKR, Ndi\Params\MaxSpeed, type, 0, "int" +HKR, Ndi\Params\MaxSpeed, default, 0, "100" +HKR, Ndi\Params\MaxSpeed, min, 0, "0" +HKR, Ndi\Params\MaxSpeed, max, 0, "2000" +HKR, Ndi\Params\MaxSpeed, step, 0, "1" +HKR, Ndi\Params\MaxSpeed, Base, 0, "10" +HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% +HKR, Ndi\Params\KeepLink, type, 0, "enum" +HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% +HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% +HKR, Ndi\Params\KeepLink, default, 0, "0" + + +[Neo.Service] +DisplayName = %Neo.Service.DispName% +Description = %Neo.Service.Desc% +ServiceType = 1 +StartType = 3 +ErrorControl = 1 +ServiceBinary = %12%\Neo6_x86_VPN114.sys +LoadOrderGroup = NDIS + +[Neo.Reg] +HKR, Ndi, Service, 0, Neo.Service.Name +HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" +HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" + +[Neo.EventLog] +HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN114.sys" +HKR, , TypesSupported, 0x00010001, 7 + +[Strings] +CompanyName = "SoftEther Corporation" +DiskDescription = "VPN Client Device Driver Install Disk" +Neo.Service.Name = "Neo_VPN114" +Neo.Service.DispName = "VPN Client Device Driver - VPN114" +Neo.Service.Desc = "VPN Client Adapter - VPN114" +NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN114" +Neo.EventLog.Name = "Neo" +NetworkAddress = "MAC Address" +DefaultAddress = "000001000001" +MaxSpeed = "Indicate Speed (Mbps)" +KeepLink = "Keep Link" +On = "On" +Off = "Off" + + +; Auto Generated 20180205_163620.383 + diff --git a/src/bin/hamcore/DriverPackages/Neo6_Win10/x86/Neo6_x86_VPN115.inf b/src/bin/hamcore/DriverPackages/Neo6_Win10/x86/Neo6_x86_VPN115.inf index b7a0cc09..1bad8f09 100644 --- a/src/bin/hamcore/DriverPackages/Neo6_Win10/x86/Neo6_x86_VPN115.inf +++ b/src/bin/hamcore/DriverPackages/Neo6_Win10/x86/Neo6_x86_VPN115.inf @@ -1,114 +1,114 @@ -; VPN Client Device Driver for Windows 2000 and Greater -; -; Copyright (c) SoftEther Corporation. All Rights Reserved. -; http://www.softether.co.jp/ -; -; BUILD 9658 - -[Version] -Signature = "$Windows NT$" -Class = Net -ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} -Provider = %CompanyName% -DriverVer = 02/04/2018, 4.25.0.9658 -CatalogFile.NT = Neo6_x86_VPN115.cat - -[Manufacturer] -%CompanyName% = SoftEther - -[SourceDisksNames] -1=%DiskDescription%, "", , - -[SourceDisksFiles] -Neo6_x86_VPN115.sys = 1 - -[DestinationDirs] -DefaultDestDir = 12 -Neo.CopyFiles.Sys = 12 - -[Neo.CopyFiles.Sys] -Neo6_x86_VPN115.sys, , , 2 - -[SoftEther] -%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN115 - -[NeoAdapter.Install] -Characteristics = 0x1 -AddReg = Neo.Reg, NeoAdapter.Ndi -CopyFiles = Neo.CopyFiles.Sys -*IfType = 53 -*MediaType = 0 -*PhysicalMediaType = 0 - -[NeoAdapter.Install.Services] -AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% - -[NeoAdapter.Ndi] -HKR, , NetworkAddress, 0, %DefaultAddress% -HKR, Ndi, DeviceID, , "NeoAdapter_VPN115" -HKR, , DevLoader, , ndis -HKR, , DeviceVxDs, , Neo6_x86_VPN115.sys -HKR, NDIS, LogDriverName, , "Neo_VPN115" -HKR, NDIS, MajorNdisVersion, 1, 5 -HKR, NDIS, MinorNdisVersion, 1, 0 -HKR, Ndi\Interfaces, DefUpper, , "ndis5" -HKR, Ndi\Interfaces, UpperRange, , "ndis5" -HKR, Ndi\Interfaces, LowerRange, , "ethernet" -HKR, Ndi\Interfaces, DefLower, , "ethernet" -HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" -HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% -HKR, Ndi\Params\NetworkAddress, type, 0, "edit" -HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" -HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" -HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% -HKR, Ndi\Params\NetworkAddress, optional, 0, "0" -HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% -HKR, Ndi\Params\MaxSpeed, type, 0, "int" -HKR, Ndi\Params\MaxSpeed, default, 0, "100" -HKR, Ndi\Params\MaxSpeed, min, 0, "0" -HKR, Ndi\Params\MaxSpeed, max, 0, "2000" -HKR, Ndi\Params\MaxSpeed, step, 0, "1" -HKR, Ndi\Params\MaxSpeed, Base, 0, "10" -HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% -HKR, Ndi\Params\KeepLink, type, 0, "enum" -HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% -HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% -HKR, Ndi\Params\KeepLink, default, 0, "0" - - -[Neo.Service] -DisplayName = %Neo.Service.DispName% -Description = %Neo.Service.Desc% -ServiceType = 1 -StartType = 3 -ErrorControl = 1 -ServiceBinary = %12%\Neo6_x86_VPN115.sys -LoadOrderGroup = NDIS - -[Neo.Reg] -HKR, Ndi, Service, 0, Neo.Service.Name -HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" -HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" - -[Neo.EventLog] -HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN115.sys" -HKR, , TypesSupported, 0x00010001, 7 - -[Strings] -CompanyName = "SoftEther Corporation" -DiskDescription = "VPN Client Device Driver Install Disk" -Neo.Service.Name = "Neo_VPN115" -Neo.Service.DispName = "VPN Client Device Driver - VPN115" -Neo.Service.Desc = "VPN Client Adapter - VPN115" -NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN115" -Neo.EventLog.Name = "Neo" -NetworkAddress = "MAC Address" -DefaultAddress = "000001000001" -MaxSpeed = "Indicate Speed (Mbps)" -KeepLink = "Keep Link" -On = "On" -Off = "Off" - - -; Auto Generated 20180205_163620.457 - +; VPN Client Device Driver for Windows 2000 and Greater +; +; Copyright (c) SoftEther Corporation. All Rights Reserved. +; http://www.softether.co.jp/ +; +; BUILD 9658 + +[Version] +Signature = "$Windows NT$" +Class = Net +ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} +Provider = %CompanyName% +DriverVer = 02/04/2018, 4.25.0.9658 +CatalogFile.NT = Neo6_x86_VPN115.cat + +[Manufacturer] +%CompanyName% = SoftEther + +[SourceDisksNames] +1=%DiskDescription%, "", , + +[SourceDisksFiles] +Neo6_x86_VPN115.sys = 1 + +[DestinationDirs] +DefaultDestDir = 12 +Neo.CopyFiles.Sys = 12 + +[Neo.CopyFiles.Sys] +Neo6_x86_VPN115.sys, , , 2 + +[SoftEther] +%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN115 + +[NeoAdapter.Install] +Characteristics = 0x1 +AddReg = Neo.Reg, NeoAdapter.Ndi +CopyFiles = Neo.CopyFiles.Sys +*IfType = 53 +*MediaType = 0 +*PhysicalMediaType = 0 + +[NeoAdapter.Install.Services] +AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% + +[NeoAdapter.Ndi] +HKR, , NetworkAddress, 0, %DefaultAddress% +HKR, Ndi, DeviceID, , "NeoAdapter_VPN115" +HKR, , DevLoader, , ndis +HKR, , DeviceVxDs, , Neo6_x86_VPN115.sys +HKR, NDIS, LogDriverName, , "Neo_VPN115" +HKR, NDIS, MajorNdisVersion, 1, 5 +HKR, NDIS, MinorNdisVersion, 1, 0 +HKR, Ndi\Interfaces, DefUpper, , "ndis5" +HKR, Ndi\Interfaces, UpperRange, , "ndis5" +HKR, Ndi\Interfaces, LowerRange, , "ethernet" +HKR, Ndi\Interfaces, DefLower, , "ethernet" +HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" +HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% +HKR, Ndi\Params\NetworkAddress, type, 0, "edit" +HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" +HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" +HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% +HKR, Ndi\Params\NetworkAddress, optional, 0, "0" +HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% +HKR, Ndi\Params\MaxSpeed, type, 0, "int" +HKR, Ndi\Params\MaxSpeed, default, 0, "100" +HKR, Ndi\Params\MaxSpeed, min, 0, "0" +HKR, Ndi\Params\MaxSpeed, max, 0, "2000" +HKR, Ndi\Params\MaxSpeed, step, 0, "1" +HKR, Ndi\Params\MaxSpeed, Base, 0, "10" +HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% +HKR, Ndi\Params\KeepLink, type, 0, "enum" +HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% +HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% +HKR, Ndi\Params\KeepLink, default, 0, "0" + + +[Neo.Service] +DisplayName = %Neo.Service.DispName% +Description = %Neo.Service.Desc% +ServiceType = 1 +StartType = 3 +ErrorControl = 1 +ServiceBinary = %12%\Neo6_x86_VPN115.sys +LoadOrderGroup = NDIS + +[Neo.Reg] +HKR, Ndi, Service, 0, Neo.Service.Name +HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" +HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" + +[Neo.EventLog] +HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN115.sys" +HKR, , TypesSupported, 0x00010001, 7 + +[Strings] +CompanyName = "SoftEther Corporation" +DiskDescription = "VPN Client Device Driver Install Disk" +Neo.Service.Name = "Neo_VPN115" +Neo.Service.DispName = "VPN Client Device Driver - VPN115" +Neo.Service.Desc = "VPN Client Adapter - VPN115" +NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN115" +Neo.EventLog.Name = "Neo" +NetworkAddress = "MAC Address" +DefaultAddress = "000001000001" +MaxSpeed = "Indicate Speed (Mbps)" +KeepLink = "Keep Link" +On = "On" +Off = "Off" + + +; Auto Generated 20180205_163620.457 + diff --git a/src/bin/hamcore/DriverPackages/Neo6_Win10/x86/Neo6_x86_VPN116.inf b/src/bin/hamcore/DriverPackages/Neo6_Win10/x86/Neo6_x86_VPN116.inf index f0203c97..141c68b9 100644 --- a/src/bin/hamcore/DriverPackages/Neo6_Win10/x86/Neo6_x86_VPN116.inf +++ b/src/bin/hamcore/DriverPackages/Neo6_Win10/x86/Neo6_x86_VPN116.inf @@ -1,114 +1,114 @@ -; VPN Client Device Driver for Windows 2000 and Greater -; -; Copyright (c) SoftEther Corporation. All Rights Reserved. -; http://www.softether.co.jp/ -; -; BUILD 9658 - -[Version] -Signature = "$Windows NT$" -Class = Net -ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} -Provider = %CompanyName% -DriverVer = 02/04/2018, 4.25.0.9658 -CatalogFile.NT = Neo6_x86_VPN116.cat - -[Manufacturer] -%CompanyName% = SoftEther - -[SourceDisksNames] -1=%DiskDescription%, "", , - -[SourceDisksFiles] -Neo6_x86_VPN116.sys = 1 - -[DestinationDirs] -DefaultDestDir = 12 -Neo.CopyFiles.Sys = 12 - -[Neo.CopyFiles.Sys] -Neo6_x86_VPN116.sys, , , 2 - -[SoftEther] -%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN116 - -[NeoAdapter.Install] -Characteristics = 0x1 -AddReg = Neo.Reg, NeoAdapter.Ndi -CopyFiles = Neo.CopyFiles.Sys -*IfType = 53 -*MediaType = 0 -*PhysicalMediaType = 0 - -[NeoAdapter.Install.Services] -AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% - -[NeoAdapter.Ndi] -HKR, , NetworkAddress, 0, %DefaultAddress% -HKR, Ndi, DeviceID, , "NeoAdapter_VPN116" -HKR, , DevLoader, , ndis -HKR, , DeviceVxDs, , Neo6_x86_VPN116.sys -HKR, NDIS, LogDriverName, , "Neo_VPN116" -HKR, NDIS, MajorNdisVersion, 1, 5 -HKR, NDIS, MinorNdisVersion, 1, 0 -HKR, Ndi\Interfaces, DefUpper, , "ndis5" -HKR, Ndi\Interfaces, UpperRange, , "ndis5" -HKR, Ndi\Interfaces, LowerRange, , "ethernet" -HKR, Ndi\Interfaces, DefLower, , "ethernet" -HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" -HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% -HKR, Ndi\Params\NetworkAddress, type, 0, "edit" -HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" -HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" -HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% -HKR, Ndi\Params\NetworkAddress, optional, 0, "0" -HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% -HKR, Ndi\Params\MaxSpeed, type, 0, "int" -HKR, Ndi\Params\MaxSpeed, default, 0, "100" -HKR, Ndi\Params\MaxSpeed, min, 0, "0" -HKR, Ndi\Params\MaxSpeed, max, 0, "2000" -HKR, Ndi\Params\MaxSpeed, step, 0, "1" -HKR, Ndi\Params\MaxSpeed, Base, 0, "10" -HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% -HKR, Ndi\Params\KeepLink, type, 0, "enum" -HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% -HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% -HKR, Ndi\Params\KeepLink, default, 0, "0" - - -[Neo.Service] -DisplayName = %Neo.Service.DispName% -Description = %Neo.Service.Desc% -ServiceType = 1 -StartType = 3 -ErrorControl = 1 -ServiceBinary = %12%\Neo6_x86_VPN116.sys -LoadOrderGroup = NDIS - -[Neo.Reg] -HKR, Ndi, Service, 0, Neo.Service.Name -HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" -HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" - -[Neo.EventLog] -HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN116.sys" -HKR, , TypesSupported, 0x00010001, 7 - -[Strings] -CompanyName = "SoftEther Corporation" -DiskDescription = "VPN Client Device Driver Install Disk" -Neo.Service.Name = "Neo_VPN116" -Neo.Service.DispName = "VPN Client Device Driver - VPN116" -Neo.Service.Desc = "VPN Client Adapter - VPN116" -NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN116" -Neo.EventLog.Name = "Neo" -NetworkAddress = "MAC Address" -DefaultAddress = "000001000001" -MaxSpeed = "Indicate Speed (Mbps)" -KeepLink = "Keep Link" -On = "On" -Off = "Off" - - -; Auto Generated 20180205_163620.531 - +; VPN Client Device Driver for Windows 2000 and Greater +; +; Copyright (c) SoftEther Corporation. All Rights Reserved. +; http://www.softether.co.jp/ +; +; BUILD 9658 + +[Version] +Signature = "$Windows NT$" +Class = Net +ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} +Provider = %CompanyName% +DriverVer = 02/04/2018, 4.25.0.9658 +CatalogFile.NT = Neo6_x86_VPN116.cat + +[Manufacturer] +%CompanyName% = SoftEther + +[SourceDisksNames] +1=%DiskDescription%, "", , + +[SourceDisksFiles] +Neo6_x86_VPN116.sys = 1 + +[DestinationDirs] +DefaultDestDir = 12 +Neo.CopyFiles.Sys = 12 + +[Neo.CopyFiles.Sys] +Neo6_x86_VPN116.sys, , , 2 + +[SoftEther] +%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN116 + +[NeoAdapter.Install] +Characteristics = 0x1 +AddReg = Neo.Reg, NeoAdapter.Ndi +CopyFiles = Neo.CopyFiles.Sys +*IfType = 53 +*MediaType = 0 +*PhysicalMediaType = 0 + +[NeoAdapter.Install.Services] +AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% + +[NeoAdapter.Ndi] +HKR, , NetworkAddress, 0, %DefaultAddress% +HKR, Ndi, DeviceID, , "NeoAdapter_VPN116" +HKR, , DevLoader, , ndis +HKR, , DeviceVxDs, , Neo6_x86_VPN116.sys +HKR, NDIS, LogDriverName, , "Neo_VPN116" +HKR, NDIS, MajorNdisVersion, 1, 5 +HKR, NDIS, MinorNdisVersion, 1, 0 +HKR, Ndi\Interfaces, DefUpper, , "ndis5" +HKR, Ndi\Interfaces, UpperRange, , "ndis5" +HKR, Ndi\Interfaces, LowerRange, , "ethernet" +HKR, Ndi\Interfaces, DefLower, , "ethernet" +HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" +HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% +HKR, Ndi\Params\NetworkAddress, type, 0, "edit" +HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" +HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" +HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% +HKR, Ndi\Params\NetworkAddress, optional, 0, "0" +HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% +HKR, Ndi\Params\MaxSpeed, type, 0, "int" +HKR, Ndi\Params\MaxSpeed, default, 0, "100" +HKR, Ndi\Params\MaxSpeed, min, 0, "0" +HKR, Ndi\Params\MaxSpeed, max, 0, "2000" +HKR, Ndi\Params\MaxSpeed, step, 0, "1" +HKR, Ndi\Params\MaxSpeed, Base, 0, "10" +HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% +HKR, Ndi\Params\KeepLink, type, 0, "enum" +HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% +HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% +HKR, Ndi\Params\KeepLink, default, 0, "0" + + +[Neo.Service] +DisplayName = %Neo.Service.DispName% +Description = %Neo.Service.Desc% +ServiceType = 1 +StartType = 3 +ErrorControl = 1 +ServiceBinary = %12%\Neo6_x86_VPN116.sys +LoadOrderGroup = NDIS + +[Neo.Reg] +HKR, Ndi, Service, 0, Neo.Service.Name +HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" +HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" + +[Neo.EventLog] +HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN116.sys" +HKR, , TypesSupported, 0x00010001, 7 + +[Strings] +CompanyName = "SoftEther Corporation" +DiskDescription = "VPN Client Device Driver Install Disk" +Neo.Service.Name = "Neo_VPN116" +Neo.Service.DispName = "VPN Client Device Driver - VPN116" +Neo.Service.Desc = "VPN Client Adapter - VPN116" +NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN116" +Neo.EventLog.Name = "Neo" +NetworkAddress = "MAC Address" +DefaultAddress = "000001000001" +MaxSpeed = "Indicate Speed (Mbps)" +KeepLink = "Keep Link" +On = "On" +Off = "Off" + + +; Auto Generated 20180205_163620.531 + diff --git a/src/bin/hamcore/DriverPackages/Neo6_Win10/x86/Neo6_x86_VPN117.inf b/src/bin/hamcore/DriverPackages/Neo6_Win10/x86/Neo6_x86_VPN117.inf index a3516974..ae6765c5 100644 --- a/src/bin/hamcore/DriverPackages/Neo6_Win10/x86/Neo6_x86_VPN117.inf +++ b/src/bin/hamcore/DriverPackages/Neo6_Win10/x86/Neo6_x86_VPN117.inf @@ -1,114 +1,114 @@ -; VPN Client Device Driver for Windows 2000 and Greater -; -; Copyright (c) SoftEther Corporation. All Rights Reserved. -; http://www.softether.co.jp/ -; -; BUILD 9658 - -[Version] -Signature = "$Windows NT$" -Class = Net -ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} -Provider = %CompanyName% -DriverVer = 02/04/2018, 4.25.0.9658 -CatalogFile.NT = Neo6_x86_VPN117.cat - -[Manufacturer] -%CompanyName% = SoftEther - -[SourceDisksNames] -1=%DiskDescription%, "", , - -[SourceDisksFiles] -Neo6_x86_VPN117.sys = 1 - -[DestinationDirs] -DefaultDestDir = 12 -Neo.CopyFiles.Sys = 12 - -[Neo.CopyFiles.Sys] -Neo6_x86_VPN117.sys, , , 2 - -[SoftEther] -%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN117 - -[NeoAdapter.Install] -Characteristics = 0x1 -AddReg = Neo.Reg, NeoAdapter.Ndi -CopyFiles = Neo.CopyFiles.Sys -*IfType = 53 -*MediaType = 0 -*PhysicalMediaType = 0 - -[NeoAdapter.Install.Services] -AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% - -[NeoAdapter.Ndi] -HKR, , NetworkAddress, 0, %DefaultAddress% -HKR, Ndi, DeviceID, , "NeoAdapter_VPN117" -HKR, , DevLoader, , ndis -HKR, , DeviceVxDs, , Neo6_x86_VPN117.sys -HKR, NDIS, LogDriverName, , "Neo_VPN117" -HKR, NDIS, MajorNdisVersion, 1, 5 -HKR, NDIS, MinorNdisVersion, 1, 0 -HKR, Ndi\Interfaces, DefUpper, , "ndis5" -HKR, Ndi\Interfaces, UpperRange, , "ndis5" -HKR, Ndi\Interfaces, LowerRange, , "ethernet" -HKR, Ndi\Interfaces, DefLower, , "ethernet" -HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" -HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% -HKR, Ndi\Params\NetworkAddress, type, 0, "edit" -HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" -HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" -HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% -HKR, Ndi\Params\NetworkAddress, optional, 0, "0" -HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% -HKR, Ndi\Params\MaxSpeed, type, 0, "int" -HKR, Ndi\Params\MaxSpeed, default, 0, "100" -HKR, Ndi\Params\MaxSpeed, min, 0, "0" -HKR, Ndi\Params\MaxSpeed, max, 0, "2000" -HKR, Ndi\Params\MaxSpeed, step, 0, "1" -HKR, Ndi\Params\MaxSpeed, Base, 0, "10" -HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% -HKR, Ndi\Params\KeepLink, type, 0, "enum" -HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% -HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% -HKR, Ndi\Params\KeepLink, default, 0, "0" - - -[Neo.Service] -DisplayName = %Neo.Service.DispName% -Description = %Neo.Service.Desc% -ServiceType = 1 -StartType = 3 -ErrorControl = 1 -ServiceBinary = %12%\Neo6_x86_VPN117.sys -LoadOrderGroup = NDIS - -[Neo.Reg] -HKR, Ndi, Service, 0, Neo.Service.Name -HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" -HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" - -[Neo.EventLog] -HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN117.sys" -HKR, , TypesSupported, 0x00010001, 7 - -[Strings] -CompanyName = "SoftEther Corporation" -DiskDescription = "VPN Client Device Driver Install Disk" -Neo.Service.Name = "Neo_VPN117" -Neo.Service.DispName = "VPN Client Device Driver - VPN117" -Neo.Service.Desc = "VPN Client Adapter - VPN117" -NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN117" -Neo.EventLog.Name = "Neo" -NetworkAddress = "MAC Address" -DefaultAddress = "000001000001" -MaxSpeed = "Indicate Speed (Mbps)" -KeepLink = "Keep Link" -On = "On" -Off = "Off" - - -; Auto Generated 20180205_163620.602 - +; VPN Client Device Driver for Windows 2000 and Greater +; +; Copyright (c) SoftEther Corporation. All Rights Reserved. +; http://www.softether.co.jp/ +; +; BUILD 9658 + +[Version] +Signature = "$Windows NT$" +Class = Net +ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} +Provider = %CompanyName% +DriverVer = 02/04/2018, 4.25.0.9658 +CatalogFile.NT = Neo6_x86_VPN117.cat + +[Manufacturer] +%CompanyName% = SoftEther + +[SourceDisksNames] +1=%DiskDescription%, "", , + +[SourceDisksFiles] +Neo6_x86_VPN117.sys = 1 + +[DestinationDirs] +DefaultDestDir = 12 +Neo.CopyFiles.Sys = 12 + +[Neo.CopyFiles.Sys] +Neo6_x86_VPN117.sys, , , 2 + +[SoftEther] +%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN117 + +[NeoAdapter.Install] +Characteristics = 0x1 +AddReg = Neo.Reg, NeoAdapter.Ndi +CopyFiles = Neo.CopyFiles.Sys +*IfType = 53 +*MediaType = 0 +*PhysicalMediaType = 0 + +[NeoAdapter.Install.Services] +AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% + +[NeoAdapter.Ndi] +HKR, , NetworkAddress, 0, %DefaultAddress% +HKR, Ndi, DeviceID, , "NeoAdapter_VPN117" +HKR, , DevLoader, , ndis +HKR, , DeviceVxDs, , Neo6_x86_VPN117.sys +HKR, NDIS, LogDriverName, , "Neo_VPN117" +HKR, NDIS, MajorNdisVersion, 1, 5 +HKR, NDIS, MinorNdisVersion, 1, 0 +HKR, Ndi\Interfaces, DefUpper, , "ndis5" +HKR, Ndi\Interfaces, UpperRange, , "ndis5" +HKR, Ndi\Interfaces, LowerRange, , "ethernet" +HKR, Ndi\Interfaces, DefLower, , "ethernet" +HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" +HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% +HKR, Ndi\Params\NetworkAddress, type, 0, "edit" +HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" +HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" +HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% +HKR, Ndi\Params\NetworkAddress, optional, 0, "0" +HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% +HKR, Ndi\Params\MaxSpeed, type, 0, "int" +HKR, Ndi\Params\MaxSpeed, default, 0, "100" +HKR, Ndi\Params\MaxSpeed, min, 0, "0" +HKR, Ndi\Params\MaxSpeed, max, 0, "2000" +HKR, Ndi\Params\MaxSpeed, step, 0, "1" +HKR, Ndi\Params\MaxSpeed, Base, 0, "10" +HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% +HKR, Ndi\Params\KeepLink, type, 0, "enum" +HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% +HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% +HKR, Ndi\Params\KeepLink, default, 0, "0" + + +[Neo.Service] +DisplayName = %Neo.Service.DispName% +Description = %Neo.Service.Desc% +ServiceType = 1 +StartType = 3 +ErrorControl = 1 +ServiceBinary = %12%\Neo6_x86_VPN117.sys +LoadOrderGroup = NDIS + +[Neo.Reg] +HKR, Ndi, Service, 0, Neo.Service.Name +HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" +HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" + +[Neo.EventLog] +HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN117.sys" +HKR, , TypesSupported, 0x00010001, 7 + +[Strings] +CompanyName = "SoftEther Corporation" +DiskDescription = "VPN Client Device Driver Install Disk" +Neo.Service.Name = "Neo_VPN117" +Neo.Service.DispName = "VPN Client Device Driver - VPN117" +Neo.Service.Desc = "VPN Client Adapter - VPN117" +NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN117" +Neo.EventLog.Name = "Neo" +NetworkAddress = "MAC Address" +DefaultAddress = "000001000001" +MaxSpeed = "Indicate Speed (Mbps)" +KeepLink = "Keep Link" +On = "On" +Off = "Off" + + +; Auto Generated 20180205_163620.602 + diff --git a/src/bin/hamcore/DriverPackages/Neo6_Win10/x86/Neo6_x86_VPN118.inf b/src/bin/hamcore/DriverPackages/Neo6_Win10/x86/Neo6_x86_VPN118.inf index 27699564..359a60e3 100644 --- a/src/bin/hamcore/DriverPackages/Neo6_Win10/x86/Neo6_x86_VPN118.inf +++ b/src/bin/hamcore/DriverPackages/Neo6_Win10/x86/Neo6_x86_VPN118.inf @@ -1,114 +1,114 @@ -; VPN Client Device Driver for Windows 2000 and Greater -; -; Copyright (c) SoftEther Corporation. All Rights Reserved. -; http://www.softether.co.jp/ -; -; BUILD 9658 - -[Version] -Signature = "$Windows NT$" -Class = Net -ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} -Provider = %CompanyName% -DriverVer = 02/04/2018, 4.25.0.9658 -CatalogFile.NT = Neo6_x86_VPN118.cat - -[Manufacturer] -%CompanyName% = SoftEther - -[SourceDisksNames] -1=%DiskDescription%, "", , - -[SourceDisksFiles] -Neo6_x86_VPN118.sys = 1 - -[DestinationDirs] -DefaultDestDir = 12 -Neo.CopyFiles.Sys = 12 - -[Neo.CopyFiles.Sys] -Neo6_x86_VPN118.sys, , , 2 - -[SoftEther] -%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN118 - -[NeoAdapter.Install] -Characteristics = 0x1 -AddReg = Neo.Reg, NeoAdapter.Ndi -CopyFiles = Neo.CopyFiles.Sys -*IfType = 53 -*MediaType = 0 -*PhysicalMediaType = 0 - -[NeoAdapter.Install.Services] -AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% - -[NeoAdapter.Ndi] -HKR, , NetworkAddress, 0, %DefaultAddress% -HKR, Ndi, DeviceID, , "NeoAdapter_VPN118" -HKR, , DevLoader, , ndis -HKR, , DeviceVxDs, , Neo6_x86_VPN118.sys -HKR, NDIS, LogDriverName, , "Neo_VPN118" -HKR, NDIS, MajorNdisVersion, 1, 5 -HKR, NDIS, MinorNdisVersion, 1, 0 -HKR, Ndi\Interfaces, DefUpper, , "ndis5" -HKR, Ndi\Interfaces, UpperRange, , "ndis5" -HKR, Ndi\Interfaces, LowerRange, , "ethernet" -HKR, Ndi\Interfaces, DefLower, , "ethernet" -HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" -HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% -HKR, Ndi\Params\NetworkAddress, type, 0, "edit" -HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" -HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" -HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% -HKR, Ndi\Params\NetworkAddress, optional, 0, "0" -HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% -HKR, Ndi\Params\MaxSpeed, type, 0, "int" -HKR, Ndi\Params\MaxSpeed, default, 0, "100" -HKR, Ndi\Params\MaxSpeed, min, 0, "0" -HKR, Ndi\Params\MaxSpeed, max, 0, "2000" -HKR, Ndi\Params\MaxSpeed, step, 0, "1" -HKR, Ndi\Params\MaxSpeed, Base, 0, "10" -HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% -HKR, Ndi\Params\KeepLink, type, 0, "enum" -HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% -HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% -HKR, Ndi\Params\KeepLink, default, 0, "0" - - -[Neo.Service] -DisplayName = %Neo.Service.DispName% -Description = %Neo.Service.Desc% -ServiceType = 1 -StartType = 3 -ErrorControl = 1 -ServiceBinary = %12%\Neo6_x86_VPN118.sys -LoadOrderGroup = NDIS - -[Neo.Reg] -HKR, Ndi, Service, 0, Neo.Service.Name -HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" -HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" - -[Neo.EventLog] -HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN118.sys" -HKR, , TypesSupported, 0x00010001, 7 - -[Strings] -CompanyName = "SoftEther Corporation" -DiskDescription = "VPN Client Device Driver Install Disk" -Neo.Service.Name = "Neo_VPN118" -Neo.Service.DispName = "VPN Client Device Driver - VPN118" -Neo.Service.Desc = "VPN Client Adapter - VPN118" -NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN118" -Neo.EventLog.Name = "Neo" -NetworkAddress = "MAC Address" -DefaultAddress = "000001000001" -MaxSpeed = "Indicate Speed (Mbps)" -KeepLink = "Keep Link" -On = "On" -Off = "Off" - - -; Auto Generated 20180205_163620.673 - +; VPN Client Device Driver for Windows 2000 and Greater +; +; Copyright (c) SoftEther Corporation. All Rights Reserved. +; http://www.softether.co.jp/ +; +; BUILD 9658 + +[Version] +Signature = "$Windows NT$" +Class = Net +ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} +Provider = %CompanyName% +DriverVer = 02/04/2018, 4.25.0.9658 +CatalogFile.NT = Neo6_x86_VPN118.cat + +[Manufacturer] +%CompanyName% = SoftEther + +[SourceDisksNames] +1=%DiskDescription%, "", , + +[SourceDisksFiles] +Neo6_x86_VPN118.sys = 1 + +[DestinationDirs] +DefaultDestDir = 12 +Neo.CopyFiles.Sys = 12 + +[Neo.CopyFiles.Sys] +Neo6_x86_VPN118.sys, , , 2 + +[SoftEther] +%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN118 + +[NeoAdapter.Install] +Characteristics = 0x1 +AddReg = Neo.Reg, NeoAdapter.Ndi +CopyFiles = Neo.CopyFiles.Sys +*IfType = 53 +*MediaType = 0 +*PhysicalMediaType = 0 + +[NeoAdapter.Install.Services] +AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% + +[NeoAdapter.Ndi] +HKR, , NetworkAddress, 0, %DefaultAddress% +HKR, Ndi, DeviceID, , "NeoAdapter_VPN118" +HKR, , DevLoader, , ndis +HKR, , DeviceVxDs, , Neo6_x86_VPN118.sys +HKR, NDIS, LogDriverName, , "Neo_VPN118" +HKR, NDIS, MajorNdisVersion, 1, 5 +HKR, NDIS, MinorNdisVersion, 1, 0 +HKR, Ndi\Interfaces, DefUpper, , "ndis5" +HKR, Ndi\Interfaces, UpperRange, , "ndis5" +HKR, Ndi\Interfaces, LowerRange, , "ethernet" +HKR, Ndi\Interfaces, DefLower, , "ethernet" +HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" +HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% +HKR, Ndi\Params\NetworkAddress, type, 0, "edit" +HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" +HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" +HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% +HKR, Ndi\Params\NetworkAddress, optional, 0, "0" +HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% +HKR, Ndi\Params\MaxSpeed, type, 0, "int" +HKR, Ndi\Params\MaxSpeed, default, 0, "100" +HKR, Ndi\Params\MaxSpeed, min, 0, "0" +HKR, Ndi\Params\MaxSpeed, max, 0, "2000" +HKR, Ndi\Params\MaxSpeed, step, 0, "1" +HKR, Ndi\Params\MaxSpeed, Base, 0, "10" +HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% +HKR, Ndi\Params\KeepLink, type, 0, "enum" +HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% +HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% +HKR, Ndi\Params\KeepLink, default, 0, "0" + + +[Neo.Service] +DisplayName = %Neo.Service.DispName% +Description = %Neo.Service.Desc% +ServiceType = 1 +StartType = 3 +ErrorControl = 1 +ServiceBinary = %12%\Neo6_x86_VPN118.sys +LoadOrderGroup = NDIS + +[Neo.Reg] +HKR, Ndi, Service, 0, Neo.Service.Name +HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" +HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" + +[Neo.EventLog] +HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN118.sys" +HKR, , TypesSupported, 0x00010001, 7 + +[Strings] +CompanyName = "SoftEther Corporation" +DiskDescription = "VPN Client Device Driver Install Disk" +Neo.Service.Name = "Neo_VPN118" +Neo.Service.DispName = "VPN Client Device Driver - VPN118" +Neo.Service.Desc = "VPN Client Adapter - VPN118" +NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN118" +Neo.EventLog.Name = "Neo" +NetworkAddress = "MAC Address" +DefaultAddress = "000001000001" +MaxSpeed = "Indicate Speed (Mbps)" +KeepLink = "Keep Link" +On = "On" +Off = "Off" + + +; Auto Generated 20180205_163620.673 + diff --git a/src/bin/hamcore/DriverPackages/Neo6_Win10/x86/Neo6_x86_VPN119.inf b/src/bin/hamcore/DriverPackages/Neo6_Win10/x86/Neo6_x86_VPN119.inf index 803e81ae..dfe7f084 100644 --- a/src/bin/hamcore/DriverPackages/Neo6_Win10/x86/Neo6_x86_VPN119.inf +++ b/src/bin/hamcore/DriverPackages/Neo6_Win10/x86/Neo6_x86_VPN119.inf @@ -1,114 +1,114 @@ -; VPN Client Device Driver for Windows 2000 and Greater -; -; Copyright (c) SoftEther Corporation. All Rights Reserved. -; http://www.softether.co.jp/ -; -; BUILD 9658 - -[Version] -Signature = "$Windows NT$" -Class = Net -ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} -Provider = %CompanyName% -DriverVer = 02/04/2018, 4.25.0.9658 -CatalogFile.NT = Neo6_x86_VPN119.cat - -[Manufacturer] -%CompanyName% = SoftEther - -[SourceDisksNames] -1=%DiskDescription%, "", , - -[SourceDisksFiles] -Neo6_x86_VPN119.sys = 1 - -[DestinationDirs] -DefaultDestDir = 12 -Neo.CopyFiles.Sys = 12 - -[Neo.CopyFiles.Sys] -Neo6_x86_VPN119.sys, , , 2 - -[SoftEther] -%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN119 - -[NeoAdapter.Install] -Characteristics = 0x1 -AddReg = Neo.Reg, NeoAdapter.Ndi -CopyFiles = Neo.CopyFiles.Sys -*IfType = 53 -*MediaType = 0 -*PhysicalMediaType = 0 - -[NeoAdapter.Install.Services] -AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% - -[NeoAdapter.Ndi] -HKR, , NetworkAddress, 0, %DefaultAddress% -HKR, Ndi, DeviceID, , "NeoAdapter_VPN119" -HKR, , DevLoader, , ndis -HKR, , DeviceVxDs, , Neo6_x86_VPN119.sys -HKR, NDIS, LogDriverName, , "Neo_VPN119" -HKR, NDIS, MajorNdisVersion, 1, 5 -HKR, NDIS, MinorNdisVersion, 1, 0 -HKR, Ndi\Interfaces, DefUpper, , "ndis5" -HKR, Ndi\Interfaces, UpperRange, , "ndis5" -HKR, Ndi\Interfaces, LowerRange, , "ethernet" -HKR, Ndi\Interfaces, DefLower, , "ethernet" -HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" -HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% -HKR, Ndi\Params\NetworkAddress, type, 0, "edit" -HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" -HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" -HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% -HKR, Ndi\Params\NetworkAddress, optional, 0, "0" -HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% -HKR, Ndi\Params\MaxSpeed, type, 0, "int" -HKR, Ndi\Params\MaxSpeed, default, 0, "100" -HKR, Ndi\Params\MaxSpeed, min, 0, "0" -HKR, Ndi\Params\MaxSpeed, max, 0, "2000" -HKR, Ndi\Params\MaxSpeed, step, 0, "1" -HKR, Ndi\Params\MaxSpeed, Base, 0, "10" -HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% -HKR, Ndi\Params\KeepLink, type, 0, "enum" -HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% -HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% -HKR, Ndi\Params\KeepLink, default, 0, "0" - - -[Neo.Service] -DisplayName = %Neo.Service.DispName% -Description = %Neo.Service.Desc% -ServiceType = 1 -StartType = 3 -ErrorControl = 1 -ServiceBinary = %12%\Neo6_x86_VPN119.sys -LoadOrderGroup = NDIS - -[Neo.Reg] -HKR, Ndi, Service, 0, Neo.Service.Name -HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" -HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" - -[Neo.EventLog] -HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN119.sys" -HKR, , TypesSupported, 0x00010001, 7 - -[Strings] -CompanyName = "SoftEther Corporation" -DiskDescription = "VPN Client Device Driver Install Disk" -Neo.Service.Name = "Neo_VPN119" -Neo.Service.DispName = "VPN Client Device Driver - VPN119" -Neo.Service.Desc = "VPN Client Adapter - VPN119" -NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN119" -Neo.EventLog.Name = "Neo" -NetworkAddress = "MAC Address" -DefaultAddress = "000001000001" -MaxSpeed = "Indicate Speed (Mbps)" -KeepLink = "Keep Link" -On = "On" -Off = "Off" - - -; Auto Generated 20180205_163620.743 - +; VPN Client Device Driver for Windows 2000 and Greater +; +; Copyright (c) SoftEther Corporation. All Rights Reserved. +; http://www.softether.co.jp/ +; +; BUILD 9658 + +[Version] +Signature = "$Windows NT$" +Class = Net +ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} +Provider = %CompanyName% +DriverVer = 02/04/2018, 4.25.0.9658 +CatalogFile.NT = Neo6_x86_VPN119.cat + +[Manufacturer] +%CompanyName% = SoftEther + +[SourceDisksNames] +1=%DiskDescription%, "", , + +[SourceDisksFiles] +Neo6_x86_VPN119.sys = 1 + +[DestinationDirs] +DefaultDestDir = 12 +Neo.CopyFiles.Sys = 12 + +[Neo.CopyFiles.Sys] +Neo6_x86_VPN119.sys, , , 2 + +[SoftEther] +%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN119 + +[NeoAdapter.Install] +Characteristics = 0x1 +AddReg = Neo.Reg, NeoAdapter.Ndi +CopyFiles = Neo.CopyFiles.Sys +*IfType = 53 +*MediaType = 0 +*PhysicalMediaType = 0 + +[NeoAdapter.Install.Services] +AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% + +[NeoAdapter.Ndi] +HKR, , NetworkAddress, 0, %DefaultAddress% +HKR, Ndi, DeviceID, , "NeoAdapter_VPN119" +HKR, , DevLoader, , ndis +HKR, , DeviceVxDs, , Neo6_x86_VPN119.sys +HKR, NDIS, LogDriverName, , "Neo_VPN119" +HKR, NDIS, MajorNdisVersion, 1, 5 +HKR, NDIS, MinorNdisVersion, 1, 0 +HKR, Ndi\Interfaces, DefUpper, , "ndis5" +HKR, Ndi\Interfaces, UpperRange, , "ndis5" +HKR, Ndi\Interfaces, LowerRange, , "ethernet" +HKR, Ndi\Interfaces, DefLower, , "ethernet" +HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" +HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% +HKR, Ndi\Params\NetworkAddress, type, 0, "edit" +HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" +HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" +HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% +HKR, Ndi\Params\NetworkAddress, optional, 0, "0" +HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% +HKR, Ndi\Params\MaxSpeed, type, 0, "int" +HKR, Ndi\Params\MaxSpeed, default, 0, "100" +HKR, Ndi\Params\MaxSpeed, min, 0, "0" +HKR, Ndi\Params\MaxSpeed, max, 0, "2000" +HKR, Ndi\Params\MaxSpeed, step, 0, "1" +HKR, Ndi\Params\MaxSpeed, Base, 0, "10" +HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% +HKR, Ndi\Params\KeepLink, type, 0, "enum" +HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% +HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% +HKR, Ndi\Params\KeepLink, default, 0, "0" + + +[Neo.Service] +DisplayName = %Neo.Service.DispName% +Description = %Neo.Service.Desc% +ServiceType = 1 +StartType = 3 +ErrorControl = 1 +ServiceBinary = %12%\Neo6_x86_VPN119.sys +LoadOrderGroup = NDIS + +[Neo.Reg] +HKR, Ndi, Service, 0, Neo.Service.Name +HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" +HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" + +[Neo.EventLog] +HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN119.sys" +HKR, , TypesSupported, 0x00010001, 7 + +[Strings] +CompanyName = "SoftEther Corporation" +DiskDescription = "VPN Client Device Driver Install Disk" +Neo.Service.Name = "Neo_VPN119" +Neo.Service.DispName = "VPN Client Device Driver - VPN119" +Neo.Service.Desc = "VPN Client Adapter - VPN119" +NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN119" +Neo.EventLog.Name = "Neo" +NetworkAddress = "MAC Address" +DefaultAddress = "000001000001" +MaxSpeed = "Indicate Speed (Mbps)" +KeepLink = "Keep Link" +On = "On" +Off = "Off" + + +; Auto Generated 20180205_163620.743 + diff --git a/src/bin/hamcore/DriverPackages/Neo6_Win10/x86/Neo6_x86_VPN12.inf b/src/bin/hamcore/DriverPackages/Neo6_Win10/x86/Neo6_x86_VPN12.inf index 7c0263ec..dfab5a16 100644 --- a/src/bin/hamcore/DriverPackages/Neo6_Win10/x86/Neo6_x86_VPN12.inf +++ b/src/bin/hamcore/DriverPackages/Neo6_Win10/x86/Neo6_x86_VPN12.inf @@ -1,114 +1,114 @@ -; VPN Client Device Driver for Windows 2000 and Greater -; -; Copyright (c) SoftEther Corporation. All Rights Reserved. -; http://www.softether.co.jp/ -; -; BUILD 9658 - -[Version] -Signature = "$Windows NT$" -Class = Net -ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} -Provider = %CompanyName% -DriverVer = 02/04/2018, 4.25.0.9658 -CatalogFile.NT = Neo6_x86_VPN12.cat - -[Manufacturer] -%CompanyName% = SoftEther - -[SourceDisksNames] -1=%DiskDescription%, "", , - -[SourceDisksFiles] -Neo6_x86_VPN12.sys = 1 - -[DestinationDirs] -DefaultDestDir = 12 -Neo.CopyFiles.Sys = 12 - -[Neo.CopyFiles.Sys] -Neo6_x86_VPN12.sys, , , 2 - -[SoftEther] -%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN12 - -[NeoAdapter.Install] -Characteristics = 0x1 -AddReg = Neo.Reg, NeoAdapter.Ndi -CopyFiles = Neo.CopyFiles.Sys -*IfType = 53 -*MediaType = 0 -*PhysicalMediaType = 0 - -[NeoAdapter.Install.Services] -AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% - -[NeoAdapter.Ndi] -HKR, , NetworkAddress, 0, %DefaultAddress% -HKR, Ndi, DeviceID, , "NeoAdapter_VPN12" -HKR, , DevLoader, , ndis -HKR, , DeviceVxDs, , Neo6_x86_VPN12.sys -HKR, NDIS, LogDriverName, , "Neo_VPN12" -HKR, NDIS, MajorNdisVersion, 1, 5 -HKR, NDIS, MinorNdisVersion, 1, 0 -HKR, Ndi\Interfaces, DefUpper, , "ndis5" -HKR, Ndi\Interfaces, UpperRange, , "ndis5" -HKR, Ndi\Interfaces, LowerRange, , "ethernet" -HKR, Ndi\Interfaces, DefLower, , "ethernet" -HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" -HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% -HKR, Ndi\Params\NetworkAddress, type, 0, "edit" -HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" -HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" -HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% -HKR, Ndi\Params\NetworkAddress, optional, 0, "0" -HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% -HKR, Ndi\Params\MaxSpeed, type, 0, "int" -HKR, Ndi\Params\MaxSpeed, default, 0, "100" -HKR, Ndi\Params\MaxSpeed, min, 0, "0" -HKR, Ndi\Params\MaxSpeed, max, 0, "2000" -HKR, Ndi\Params\MaxSpeed, step, 0, "1" -HKR, Ndi\Params\MaxSpeed, Base, 0, "10" -HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% -HKR, Ndi\Params\KeepLink, type, 0, "enum" -HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% -HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% -HKR, Ndi\Params\KeepLink, default, 0, "0" - - -[Neo.Service] -DisplayName = %Neo.Service.DispName% -Description = %Neo.Service.Desc% -ServiceType = 1 -StartType = 3 -ErrorControl = 1 -ServiceBinary = %12%\Neo6_x86_VPN12.sys -LoadOrderGroup = NDIS - -[Neo.Reg] -HKR, Ndi, Service, 0, Neo.Service.Name -HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" -HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" - -[Neo.EventLog] -HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN12.sys" -HKR, , TypesSupported, 0x00010001, 7 - -[Strings] -CompanyName = "SoftEther Corporation" -DiskDescription = "VPN Client Device Driver Install Disk" -Neo.Service.Name = "Neo_VPN12" -Neo.Service.DispName = "VPN Client Device Driver - VPN12" -Neo.Service.Desc = "VPN Client Adapter - VPN12" -NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN12" -Neo.EventLog.Name = "Neo" -NetworkAddress = "MAC Address" -DefaultAddress = "000001000001" -MaxSpeed = "Indicate Speed (Mbps)" -KeepLink = "Keep Link" -On = "On" -Off = "Off" - - -; Auto Generated 20180205_163613.115 - +; VPN Client Device Driver for Windows 2000 and Greater +; +; Copyright (c) SoftEther Corporation. All Rights Reserved. +; http://www.softether.co.jp/ +; +; BUILD 9658 + +[Version] +Signature = "$Windows NT$" +Class = Net +ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} +Provider = %CompanyName% +DriverVer = 02/04/2018, 4.25.0.9658 +CatalogFile.NT = Neo6_x86_VPN12.cat + +[Manufacturer] +%CompanyName% = SoftEther + +[SourceDisksNames] +1=%DiskDescription%, "", , + +[SourceDisksFiles] +Neo6_x86_VPN12.sys = 1 + +[DestinationDirs] +DefaultDestDir = 12 +Neo.CopyFiles.Sys = 12 + +[Neo.CopyFiles.Sys] +Neo6_x86_VPN12.sys, , , 2 + +[SoftEther] +%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN12 + +[NeoAdapter.Install] +Characteristics = 0x1 +AddReg = Neo.Reg, NeoAdapter.Ndi +CopyFiles = Neo.CopyFiles.Sys +*IfType = 53 +*MediaType = 0 +*PhysicalMediaType = 0 + +[NeoAdapter.Install.Services] +AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% + +[NeoAdapter.Ndi] +HKR, , NetworkAddress, 0, %DefaultAddress% +HKR, Ndi, DeviceID, , "NeoAdapter_VPN12" +HKR, , DevLoader, , ndis +HKR, , DeviceVxDs, , Neo6_x86_VPN12.sys +HKR, NDIS, LogDriverName, , "Neo_VPN12" +HKR, NDIS, MajorNdisVersion, 1, 5 +HKR, NDIS, MinorNdisVersion, 1, 0 +HKR, Ndi\Interfaces, DefUpper, , "ndis5" +HKR, Ndi\Interfaces, UpperRange, , "ndis5" +HKR, Ndi\Interfaces, LowerRange, , "ethernet" +HKR, Ndi\Interfaces, DefLower, , "ethernet" +HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" +HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% +HKR, Ndi\Params\NetworkAddress, type, 0, "edit" +HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" +HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" +HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% +HKR, Ndi\Params\NetworkAddress, optional, 0, "0" +HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% +HKR, Ndi\Params\MaxSpeed, type, 0, "int" +HKR, Ndi\Params\MaxSpeed, default, 0, "100" +HKR, Ndi\Params\MaxSpeed, min, 0, "0" +HKR, Ndi\Params\MaxSpeed, max, 0, "2000" +HKR, Ndi\Params\MaxSpeed, step, 0, "1" +HKR, Ndi\Params\MaxSpeed, Base, 0, "10" +HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% +HKR, Ndi\Params\KeepLink, type, 0, "enum" +HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% +HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% +HKR, Ndi\Params\KeepLink, default, 0, "0" + + +[Neo.Service] +DisplayName = %Neo.Service.DispName% +Description = %Neo.Service.Desc% +ServiceType = 1 +StartType = 3 +ErrorControl = 1 +ServiceBinary = %12%\Neo6_x86_VPN12.sys +LoadOrderGroup = NDIS + +[Neo.Reg] +HKR, Ndi, Service, 0, Neo.Service.Name +HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" +HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" + +[Neo.EventLog] +HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN12.sys" +HKR, , TypesSupported, 0x00010001, 7 + +[Strings] +CompanyName = "SoftEther Corporation" +DiskDescription = "VPN Client Device Driver Install Disk" +Neo.Service.Name = "Neo_VPN12" +Neo.Service.DispName = "VPN Client Device Driver - VPN12" +Neo.Service.Desc = "VPN Client Adapter - VPN12" +NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN12" +Neo.EventLog.Name = "Neo" +NetworkAddress = "MAC Address" +DefaultAddress = "000001000001" +MaxSpeed = "Indicate Speed (Mbps)" +KeepLink = "Keep Link" +On = "On" +Off = "Off" + + +; Auto Generated 20180205_163613.115 + diff --git a/src/bin/hamcore/DriverPackages/Neo6_Win10/x86/Neo6_x86_VPN120.inf b/src/bin/hamcore/DriverPackages/Neo6_Win10/x86/Neo6_x86_VPN120.inf index 2090035a..6ac42b70 100644 --- a/src/bin/hamcore/DriverPackages/Neo6_Win10/x86/Neo6_x86_VPN120.inf +++ b/src/bin/hamcore/DriverPackages/Neo6_Win10/x86/Neo6_x86_VPN120.inf @@ -1,114 +1,114 @@ -; VPN Client Device Driver for Windows 2000 and Greater -; -; Copyright (c) SoftEther Corporation. All Rights Reserved. -; http://www.softether.co.jp/ -; -; BUILD 9658 - -[Version] -Signature = "$Windows NT$" -Class = Net -ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} -Provider = %CompanyName% -DriverVer = 02/04/2018, 4.25.0.9658 -CatalogFile.NT = Neo6_x86_VPN120.cat - -[Manufacturer] -%CompanyName% = SoftEther - -[SourceDisksNames] -1=%DiskDescription%, "", , - -[SourceDisksFiles] -Neo6_x86_VPN120.sys = 1 - -[DestinationDirs] -DefaultDestDir = 12 -Neo.CopyFiles.Sys = 12 - -[Neo.CopyFiles.Sys] -Neo6_x86_VPN120.sys, , , 2 - -[SoftEther] -%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN120 - -[NeoAdapter.Install] -Characteristics = 0x1 -AddReg = Neo.Reg, NeoAdapter.Ndi -CopyFiles = Neo.CopyFiles.Sys -*IfType = 53 -*MediaType = 0 -*PhysicalMediaType = 0 - -[NeoAdapter.Install.Services] -AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% - -[NeoAdapter.Ndi] -HKR, , NetworkAddress, 0, %DefaultAddress% -HKR, Ndi, DeviceID, , "NeoAdapter_VPN120" -HKR, , DevLoader, , ndis -HKR, , DeviceVxDs, , Neo6_x86_VPN120.sys -HKR, NDIS, LogDriverName, , "Neo_VPN120" -HKR, NDIS, MajorNdisVersion, 1, 5 -HKR, NDIS, MinorNdisVersion, 1, 0 -HKR, Ndi\Interfaces, DefUpper, , "ndis5" -HKR, Ndi\Interfaces, UpperRange, , "ndis5" -HKR, Ndi\Interfaces, LowerRange, , "ethernet" -HKR, Ndi\Interfaces, DefLower, , "ethernet" -HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" -HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% -HKR, Ndi\Params\NetworkAddress, type, 0, "edit" -HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" -HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" -HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% -HKR, Ndi\Params\NetworkAddress, optional, 0, "0" -HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% -HKR, Ndi\Params\MaxSpeed, type, 0, "int" -HKR, Ndi\Params\MaxSpeed, default, 0, "100" -HKR, Ndi\Params\MaxSpeed, min, 0, "0" -HKR, Ndi\Params\MaxSpeed, max, 0, "2000" -HKR, Ndi\Params\MaxSpeed, step, 0, "1" -HKR, Ndi\Params\MaxSpeed, Base, 0, "10" -HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% -HKR, Ndi\Params\KeepLink, type, 0, "enum" -HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% -HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% -HKR, Ndi\Params\KeepLink, default, 0, "0" - - -[Neo.Service] -DisplayName = %Neo.Service.DispName% -Description = %Neo.Service.Desc% -ServiceType = 1 -StartType = 3 -ErrorControl = 1 -ServiceBinary = %12%\Neo6_x86_VPN120.sys -LoadOrderGroup = NDIS - -[Neo.Reg] -HKR, Ndi, Service, 0, Neo.Service.Name -HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" -HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" - -[Neo.EventLog] -HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN120.sys" -HKR, , TypesSupported, 0x00010001, 7 - -[Strings] -CompanyName = "SoftEther Corporation" -DiskDescription = "VPN Client Device Driver Install Disk" -Neo.Service.Name = "Neo_VPN120" -Neo.Service.DispName = "VPN Client Device Driver - VPN120" -Neo.Service.Desc = "VPN Client Adapter - VPN120" -NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN120" -Neo.EventLog.Name = "Neo" -NetworkAddress = "MAC Address" -DefaultAddress = "000001000001" -MaxSpeed = "Indicate Speed (Mbps)" -KeepLink = "Keep Link" -On = "On" -Off = "Off" - - -; Auto Generated 20180205_163620.814 - +; VPN Client Device Driver for Windows 2000 and Greater +; +; Copyright (c) SoftEther Corporation. All Rights Reserved. +; http://www.softether.co.jp/ +; +; BUILD 9658 + +[Version] +Signature = "$Windows NT$" +Class = Net +ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} +Provider = %CompanyName% +DriverVer = 02/04/2018, 4.25.0.9658 +CatalogFile.NT = Neo6_x86_VPN120.cat + +[Manufacturer] +%CompanyName% = SoftEther + +[SourceDisksNames] +1=%DiskDescription%, "", , + +[SourceDisksFiles] +Neo6_x86_VPN120.sys = 1 + +[DestinationDirs] +DefaultDestDir = 12 +Neo.CopyFiles.Sys = 12 + +[Neo.CopyFiles.Sys] +Neo6_x86_VPN120.sys, , , 2 + +[SoftEther] +%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN120 + +[NeoAdapter.Install] +Characteristics = 0x1 +AddReg = Neo.Reg, NeoAdapter.Ndi +CopyFiles = Neo.CopyFiles.Sys +*IfType = 53 +*MediaType = 0 +*PhysicalMediaType = 0 + +[NeoAdapter.Install.Services] +AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% + +[NeoAdapter.Ndi] +HKR, , NetworkAddress, 0, %DefaultAddress% +HKR, Ndi, DeviceID, , "NeoAdapter_VPN120" +HKR, , DevLoader, , ndis +HKR, , DeviceVxDs, , Neo6_x86_VPN120.sys +HKR, NDIS, LogDriverName, , "Neo_VPN120" +HKR, NDIS, MajorNdisVersion, 1, 5 +HKR, NDIS, MinorNdisVersion, 1, 0 +HKR, Ndi\Interfaces, DefUpper, , "ndis5" +HKR, Ndi\Interfaces, UpperRange, , "ndis5" +HKR, Ndi\Interfaces, LowerRange, , "ethernet" +HKR, Ndi\Interfaces, DefLower, , "ethernet" +HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" +HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% +HKR, Ndi\Params\NetworkAddress, type, 0, "edit" +HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" +HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" +HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% +HKR, Ndi\Params\NetworkAddress, optional, 0, "0" +HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% +HKR, Ndi\Params\MaxSpeed, type, 0, "int" +HKR, Ndi\Params\MaxSpeed, default, 0, "100" +HKR, Ndi\Params\MaxSpeed, min, 0, "0" +HKR, Ndi\Params\MaxSpeed, max, 0, "2000" +HKR, Ndi\Params\MaxSpeed, step, 0, "1" +HKR, Ndi\Params\MaxSpeed, Base, 0, "10" +HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% +HKR, Ndi\Params\KeepLink, type, 0, "enum" +HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% +HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% +HKR, Ndi\Params\KeepLink, default, 0, "0" + + +[Neo.Service] +DisplayName = %Neo.Service.DispName% +Description = %Neo.Service.Desc% +ServiceType = 1 +StartType = 3 +ErrorControl = 1 +ServiceBinary = %12%\Neo6_x86_VPN120.sys +LoadOrderGroup = NDIS + +[Neo.Reg] +HKR, Ndi, Service, 0, Neo.Service.Name +HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" +HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" + +[Neo.EventLog] +HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN120.sys" +HKR, , TypesSupported, 0x00010001, 7 + +[Strings] +CompanyName = "SoftEther Corporation" +DiskDescription = "VPN Client Device Driver Install Disk" +Neo.Service.Name = "Neo_VPN120" +Neo.Service.DispName = "VPN Client Device Driver - VPN120" +Neo.Service.Desc = "VPN Client Adapter - VPN120" +NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN120" +Neo.EventLog.Name = "Neo" +NetworkAddress = "MAC Address" +DefaultAddress = "000001000001" +MaxSpeed = "Indicate Speed (Mbps)" +KeepLink = "Keep Link" +On = "On" +Off = "Off" + + +; Auto Generated 20180205_163620.814 + diff --git a/src/bin/hamcore/DriverPackages/Neo6_Win10/x86/Neo6_x86_VPN121.inf b/src/bin/hamcore/DriverPackages/Neo6_Win10/x86/Neo6_x86_VPN121.inf index 8b2d1c69..4cce4363 100644 --- a/src/bin/hamcore/DriverPackages/Neo6_Win10/x86/Neo6_x86_VPN121.inf +++ b/src/bin/hamcore/DriverPackages/Neo6_Win10/x86/Neo6_x86_VPN121.inf @@ -1,114 +1,114 @@ -; VPN Client Device Driver for Windows 2000 and Greater -; -; Copyright (c) SoftEther Corporation. All Rights Reserved. -; http://www.softether.co.jp/ -; -; BUILD 9658 - -[Version] -Signature = "$Windows NT$" -Class = Net -ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} -Provider = %CompanyName% -DriverVer = 02/04/2018, 4.25.0.9658 -CatalogFile.NT = Neo6_x86_VPN121.cat - -[Manufacturer] -%CompanyName% = SoftEther - -[SourceDisksNames] -1=%DiskDescription%, "", , - -[SourceDisksFiles] -Neo6_x86_VPN121.sys = 1 - -[DestinationDirs] -DefaultDestDir = 12 -Neo.CopyFiles.Sys = 12 - -[Neo.CopyFiles.Sys] -Neo6_x86_VPN121.sys, , , 2 - -[SoftEther] -%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN121 - -[NeoAdapter.Install] -Characteristics = 0x1 -AddReg = Neo.Reg, NeoAdapter.Ndi -CopyFiles = Neo.CopyFiles.Sys -*IfType = 53 -*MediaType = 0 -*PhysicalMediaType = 0 - -[NeoAdapter.Install.Services] -AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% - -[NeoAdapter.Ndi] -HKR, , NetworkAddress, 0, %DefaultAddress% -HKR, Ndi, DeviceID, , "NeoAdapter_VPN121" -HKR, , DevLoader, , ndis -HKR, , DeviceVxDs, , Neo6_x86_VPN121.sys -HKR, NDIS, LogDriverName, , "Neo_VPN121" -HKR, NDIS, MajorNdisVersion, 1, 5 -HKR, NDIS, MinorNdisVersion, 1, 0 -HKR, Ndi\Interfaces, DefUpper, , "ndis5" -HKR, Ndi\Interfaces, UpperRange, , "ndis5" -HKR, Ndi\Interfaces, LowerRange, , "ethernet" -HKR, Ndi\Interfaces, DefLower, , "ethernet" -HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" -HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% -HKR, Ndi\Params\NetworkAddress, type, 0, "edit" -HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" -HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" -HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% -HKR, Ndi\Params\NetworkAddress, optional, 0, "0" -HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% -HKR, Ndi\Params\MaxSpeed, type, 0, "int" -HKR, Ndi\Params\MaxSpeed, default, 0, "100" -HKR, Ndi\Params\MaxSpeed, min, 0, "0" -HKR, Ndi\Params\MaxSpeed, max, 0, "2000" -HKR, Ndi\Params\MaxSpeed, step, 0, "1" -HKR, Ndi\Params\MaxSpeed, Base, 0, "10" -HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% -HKR, Ndi\Params\KeepLink, type, 0, "enum" -HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% -HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% -HKR, Ndi\Params\KeepLink, default, 0, "0" - - -[Neo.Service] -DisplayName = %Neo.Service.DispName% -Description = %Neo.Service.Desc% -ServiceType = 1 -StartType = 3 -ErrorControl = 1 -ServiceBinary = %12%\Neo6_x86_VPN121.sys -LoadOrderGroup = NDIS - -[Neo.Reg] -HKR, Ndi, Service, 0, Neo.Service.Name -HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" -HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" - -[Neo.EventLog] -HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN121.sys" -HKR, , TypesSupported, 0x00010001, 7 - -[Strings] -CompanyName = "SoftEther Corporation" -DiskDescription = "VPN Client Device Driver Install Disk" -Neo.Service.Name = "Neo_VPN121" -Neo.Service.DispName = "VPN Client Device Driver - VPN121" -Neo.Service.Desc = "VPN Client Adapter - VPN121" -NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN121" -Neo.EventLog.Name = "Neo" -NetworkAddress = "MAC Address" -DefaultAddress = "000001000001" -MaxSpeed = "Indicate Speed (Mbps)" -KeepLink = "Keep Link" -On = "On" -Off = "Off" - - -; Auto Generated 20180205_163620.884 - +; VPN Client Device Driver for Windows 2000 and Greater +; +; Copyright (c) SoftEther Corporation. All Rights Reserved. +; http://www.softether.co.jp/ +; +; BUILD 9658 + +[Version] +Signature = "$Windows NT$" +Class = Net +ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} +Provider = %CompanyName% +DriverVer = 02/04/2018, 4.25.0.9658 +CatalogFile.NT = Neo6_x86_VPN121.cat + +[Manufacturer] +%CompanyName% = SoftEther + +[SourceDisksNames] +1=%DiskDescription%, "", , + +[SourceDisksFiles] +Neo6_x86_VPN121.sys = 1 + +[DestinationDirs] +DefaultDestDir = 12 +Neo.CopyFiles.Sys = 12 + +[Neo.CopyFiles.Sys] +Neo6_x86_VPN121.sys, , , 2 + +[SoftEther] +%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN121 + +[NeoAdapter.Install] +Characteristics = 0x1 +AddReg = Neo.Reg, NeoAdapter.Ndi +CopyFiles = Neo.CopyFiles.Sys +*IfType = 53 +*MediaType = 0 +*PhysicalMediaType = 0 + +[NeoAdapter.Install.Services] +AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% + +[NeoAdapter.Ndi] +HKR, , NetworkAddress, 0, %DefaultAddress% +HKR, Ndi, DeviceID, , "NeoAdapter_VPN121" +HKR, , DevLoader, , ndis +HKR, , DeviceVxDs, , Neo6_x86_VPN121.sys +HKR, NDIS, LogDriverName, , "Neo_VPN121" +HKR, NDIS, MajorNdisVersion, 1, 5 +HKR, NDIS, MinorNdisVersion, 1, 0 +HKR, Ndi\Interfaces, DefUpper, , "ndis5" +HKR, Ndi\Interfaces, UpperRange, , "ndis5" +HKR, Ndi\Interfaces, LowerRange, , "ethernet" +HKR, Ndi\Interfaces, DefLower, , "ethernet" +HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" +HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% +HKR, Ndi\Params\NetworkAddress, type, 0, "edit" +HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" +HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" +HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% +HKR, Ndi\Params\NetworkAddress, optional, 0, "0" +HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% +HKR, Ndi\Params\MaxSpeed, type, 0, "int" +HKR, Ndi\Params\MaxSpeed, default, 0, "100" +HKR, Ndi\Params\MaxSpeed, min, 0, "0" +HKR, Ndi\Params\MaxSpeed, max, 0, "2000" +HKR, Ndi\Params\MaxSpeed, step, 0, "1" +HKR, Ndi\Params\MaxSpeed, Base, 0, "10" +HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% +HKR, Ndi\Params\KeepLink, type, 0, "enum" +HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% +HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% +HKR, Ndi\Params\KeepLink, default, 0, "0" + + +[Neo.Service] +DisplayName = %Neo.Service.DispName% +Description = %Neo.Service.Desc% +ServiceType = 1 +StartType = 3 +ErrorControl = 1 +ServiceBinary = %12%\Neo6_x86_VPN121.sys +LoadOrderGroup = NDIS + +[Neo.Reg] +HKR, Ndi, Service, 0, Neo.Service.Name +HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" +HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" + +[Neo.EventLog] +HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN121.sys" +HKR, , TypesSupported, 0x00010001, 7 + +[Strings] +CompanyName = "SoftEther Corporation" +DiskDescription = "VPN Client Device Driver Install Disk" +Neo.Service.Name = "Neo_VPN121" +Neo.Service.DispName = "VPN Client Device Driver - VPN121" +Neo.Service.Desc = "VPN Client Adapter - VPN121" +NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN121" +Neo.EventLog.Name = "Neo" +NetworkAddress = "MAC Address" +DefaultAddress = "000001000001" +MaxSpeed = "Indicate Speed (Mbps)" +KeepLink = "Keep Link" +On = "On" +Off = "Off" + + +; Auto Generated 20180205_163620.884 + diff --git a/src/bin/hamcore/DriverPackages/Neo6_Win10/x86/Neo6_x86_VPN122.inf b/src/bin/hamcore/DriverPackages/Neo6_Win10/x86/Neo6_x86_VPN122.inf index 5bba5881..df95db15 100644 --- a/src/bin/hamcore/DriverPackages/Neo6_Win10/x86/Neo6_x86_VPN122.inf +++ b/src/bin/hamcore/DriverPackages/Neo6_Win10/x86/Neo6_x86_VPN122.inf @@ -1,114 +1,114 @@ -; VPN Client Device Driver for Windows 2000 and Greater -; -; Copyright (c) SoftEther Corporation. All Rights Reserved. -; http://www.softether.co.jp/ -; -; BUILD 9658 - -[Version] -Signature = "$Windows NT$" -Class = Net -ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} -Provider = %CompanyName% -DriverVer = 02/04/2018, 4.25.0.9658 -CatalogFile.NT = Neo6_x86_VPN122.cat - -[Manufacturer] -%CompanyName% = SoftEther - -[SourceDisksNames] -1=%DiskDescription%, "", , - -[SourceDisksFiles] -Neo6_x86_VPN122.sys = 1 - -[DestinationDirs] -DefaultDestDir = 12 -Neo.CopyFiles.Sys = 12 - -[Neo.CopyFiles.Sys] -Neo6_x86_VPN122.sys, , , 2 - -[SoftEther] -%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN122 - -[NeoAdapter.Install] -Characteristics = 0x1 -AddReg = Neo.Reg, NeoAdapter.Ndi -CopyFiles = Neo.CopyFiles.Sys -*IfType = 53 -*MediaType = 0 -*PhysicalMediaType = 0 - -[NeoAdapter.Install.Services] -AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% - -[NeoAdapter.Ndi] -HKR, , NetworkAddress, 0, %DefaultAddress% -HKR, Ndi, DeviceID, , "NeoAdapter_VPN122" -HKR, , DevLoader, , ndis -HKR, , DeviceVxDs, , Neo6_x86_VPN122.sys -HKR, NDIS, LogDriverName, , "Neo_VPN122" -HKR, NDIS, MajorNdisVersion, 1, 5 -HKR, NDIS, MinorNdisVersion, 1, 0 -HKR, Ndi\Interfaces, DefUpper, , "ndis5" -HKR, Ndi\Interfaces, UpperRange, , "ndis5" -HKR, Ndi\Interfaces, LowerRange, , "ethernet" -HKR, Ndi\Interfaces, DefLower, , "ethernet" -HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" -HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% -HKR, Ndi\Params\NetworkAddress, type, 0, "edit" -HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" -HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" -HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% -HKR, Ndi\Params\NetworkAddress, optional, 0, "0" -HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% -HKR, Ndi\Params\MaxSpeed, type, 0, "int" -HKR, Ndi\Params\MaxSpeed, default, 0, "100" -HKR, Ndi\Params\MaxSpeed, min, 0, "0" -HKR, Ndi\Params\MaxSpeed, max, 0, "2000" -HKR, Ndi\Params\MaxSpeed, step, 0, "1" -HKR, Ndi\Params\MaxSpeed, Base, 0, "10" -HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% -HKR, Ndi\Params\KeepLink, type, 0, "enum" -HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% -HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% -HKR, Ndi\Params\KeepLink, default, 0, "0" - - -[Neo.Service] -DisplayName = %Neo.Service.DispName% -Description = %Neo.Service.Desc% -ServiceType = 1 -StartType = 3 -ErrorControl = 1 -ServiceBinary = %12%\Neo6_x86_VPN122.sys -LoadOrderGroup = NDIS - -[Neo.Reg] -HKR, Ndi, Service, 0, Neo.Service.Name -HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" -HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" - -[Neo.EventLog] -HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN122.sys" -HKR, , TypesSupported, 0x00010001, 7 - -[Strings] -CompanyName = "SoftEther Corporation" -DiskDescription = "VPN Client Device Driver Install Disk" -Neo.Service.Name = "Neo_VPN122" -Neo.Service.DispName = "VPN Client Device Driver - VPN122" -Neo.Service.Desc = "VPN Client Adapter - VPN122" -NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN122" -Neo.EventLog.Name = "Neo" -NetworkAddress = "MAC Address" -DefaultAddress = "000001000001" -MaxSpeed = "Indicate Speed (Mbps)" -KeepLink = "Keep Link" -On = "On" -Off = "Off" - - -; Auto Generated 20180205_163620.954 - +; VPN Client Device Driver for Windows 2000 and Greater +; +; Copyright (c) SoftEther Corporation. All Rights Reserved. +; http://www.softether.co.jp/ +; +; BUILD 9658 + +[Version] +Signature = "$Windows NT$" +Class = Net +ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} +Provider = %CompanyName% +DriverVer = 02/04/2018, 4.25.0.9658 +CatalogFile.NT = Neo6_x86_VPN122.cat + +[Manufacturer] +%CompanyName% = SoftEther + +[SourceDisksNames] +1=%DiskDescription%, "", , + +[SourceDisksFiles] +Neo6_x86_VPN122.sys = 1 + +[DestinationDirs] +DefaultDestDir = 12 +Neo.CopyFiles.Sys = 12 + +[Neo.CopyFiles.Sys] +Neo6_x86_VPN122.sys, , , 2 + +[SoftEther] +%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN122 + +[NeoAdapter.Install] +Characteristics = 0x1 +AddReg = Neo.Reg, NeoAdapter.Ndi +CopyFiles = Neo.CopyFiles.Sys +*IfType = 53 +*MediaType = 0 +*PhysicalMediaType = 0 + +[NeoAdapter.Install.Services] +AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% + +[NeoAdapter.Ndi] +HKR, , NetworkAddress, 0, %DefaultAddress% +HKR, Ndi, DeviceID, , "NeoAdapter_VPN122" +HKR, , DevLoader, , ndis +HKR, , DeviceVxDs, , Neo6_x86_VPN122.sys +HKR, NDIS, LogDriverName, , "Neo_VPN122" +HKR, NDIS, MajorNdisVersion, 1, 5 +HKR, NDIS, MinorNdisVersion, 1, 0 +HKR, Ndi\Interfaces, DefUpper, , "ndis5" +HKR, Ndi\Interfaces, UpperRange, , "ndis5" +HKR, Ndi\Interfaces, LowerRange, , "ethernet" +HKR, Ndi\Interfaces, DefLower, , "ethernet" +HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" +HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% +HKR, Ndi\Params\NetworkAddress, type, 0, "edit" +HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" +HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" +HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% +HKR, Ndi\Params\NetworkAddress, optional, 0, "0" +HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% +HKR, Ndi\Params\MaxSpeed, type, 0, "int" +HKR, Ndi\Params\MaxSpeed, default, 0, "100" +HKR, Ndi\Params\MaxSpeed, min, 0, "0" +HKR, Ndi\Params\MaxSpeed, max, 0, "2000" +HKR, Ndi\Params\MaxSpeed, step, 0, "1" +HKR, Ndi\Params\MaxSpeed, Base, 0, "10" +HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% +HKR, Ndi\Params\KeepLink, type, 0, "enum" +HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% +HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% +HKR, Ndi\Params\KeepLink, default, 0, "0" + + +[Neo.Service] +DisplayName = %Neo.Service.DispName% +Description = %Neo.Service.Desc% +ServiceType = 1 +StartType = 3 +ErrorControl = 1 +ServiceBinary = %12%\Neo6_x86_VPN122.sys +LoadOrderGroup = NDIS + +[Neo.Reg] +HKR, Ndi, Service, 0, Neo.Service.Name +HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" +HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" + +[Neo.EventLog] +HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN122.sys" +HKR, , TypesSupported, 0x00010001, 7 + +[Strings] +CompanyName = "SoftEther Corporation" +DiskDescription = "VPN Client Device Driver Install Disk" +Neo.Service.Name = "Neo_VPN122" +Neo.Service.DispName = "VPN Client Device Driver - VPN122" +Neo.Service.Desc = "VPN Client Adapter - VPN122" +NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN122" +Neo.EventLog.Name = "Neo" +NetworkAddress = "MAC Address" +DefaultAddress = "000001000001" +MaxSpeed = "Indicate Speed (Mbps)" +KeepLink = "Keep Link" +On = "On" +Off = "Off" + + +; Auto Generated 20180205_163620.954 + diff --git a/src/bin/hamcore/DriverPackages/Neo6_Win10/x86/Neo6_x86_VPN123.inf b/src/bin/hamcore/DriverPackages/Neo6_Win10/x86/Neo6_x86_VPN123.inf index 2f676ae8..8fb0ab6f 100644 --- a/src/bin/hamcore/DriverPackages/Neo6_Win10/x86/Neo6_x86_VPN123.inf +++ b/src/bin/hamcore/DriverPackages/Neo6_Win10/x86/Neo6_x86_VPN123.inf @@ -1,114 +1,114 @@ -; VPN Client Device Driver for Windows 2000 and Greater -; -; Copyright (c) SoftEther Corporation. All Rights Reserved. -; http://www.softether.co.jp/ -; -; BUILD 9658 - -[Version] -Signature = "$Windows NT$" -Class = Net -ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} -Provider = %CompanyName% -DriverVer = 02/04/2018, 4.25.0.9658 -CatalogFile.NT = Neo6_x86_VPN123.cat - -[Manufacturer] -%CompanyName% = SoftEther - -[SourceDisksNames] -1=%DiskDescription%, "", , - -[SourceDisksFiles] -Neo6_x86_VPN123.sys = 1 - -[DestinationDirs] -DefaultDestDir = 12 -Neo.CopyFiles.Sys = 12 - -[Neo.CopyFiles.Sys] -Neo6_x86_VPN123.sys, , , 2 - -[SoftEther] -%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN123 - -[NeoAdapter.Install] -Characteristics = 0x1 -AddReg = Neo.Reg, NeoAdapter.Ndi -CopyFiles = Neo.CopyFiles.Sys -*IfType = 53 -*MediaType = 0 -*PhysicalMediaType = 0 - -[NeoAdapter.Install.Services] -AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% - -[NeoAdapter.Ndi] -HKR, , NetworkAddress, 0, %DefaultAddress% -HKR, Ndi, DeviceID, , "NeoAdapter_VPN123" -HKR, , DevLoader, , ndis -HKR, , DeviceVxDs, , Neo6_x86_VPN123.sys -HKR, NDIS, LogDriverName, , "Neo_VPN123" -HKR, NDIS, MajorNdisVersion, 1, 5 -HKR, NDIS, MinorNdisVersion, 1, 0 -HKR, Ndi\Interfaces, DefUpper, , "ndis5" -HKR, Ndi\Interfaces, UpperRange, , "ndis5" -HKR, Ndi\Interfaces, LowerRange, , "ethernet" -HKR, Ndi\Interfaces, DefLower, , "ethernet" -HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" -HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% -HKR, Ndi\Params\NetworkAddress, type, 0, "edit" -HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" -HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" -HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% -HKR, Ndi\Params\NetworkAddress, optional, 0, "0" -HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% -HKR, Ndi\Params\MaxSpeed, type, 0, "int" -HKR, Ndi\Params\MaxSpeed, default, 0, "100" -HKR, Ndi\Params\MaxSpeed, min, 0, "0" -HKR, Ndi\Params\MaxSpeed, max, 0, "2000" -HKR, Ndi\Params\MaxSpeed, step, 0, "1" -HKR, Ndi\Params\MaxSpeed, Base, 0, "10" -HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% -HKR, Ndi\Params\KeepLink, type, 0, "enum" -HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% -HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% -HKR, Ndi\Params\KeepLink, default, 0, "0" - - -[Neo.Service] -DisplayName = %Neo.Service.DispName% -Description = %Neo.Service.Desc% -ServiceType = 1 -StartType = 3 -ErrorControl = 1 -ServiceBinary = %12%\Neo6_x86_VPN123.sys -LoadOrderGroup = NDIS - -[Neo.Reg] -HKR, Ndi, Service, 0, Neo.Service.Name -HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" -HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" - -[Neo.EventLog] -HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN123.sys" -HKR, , TypesSupported, 0x00010001, 7 - -[Strings] -CompanyName = "SoftEther Corporation" -DiskDescription = "VPN Client Device Driver Install Disk" -Neo.Service.Name = "Neo_VPN123" -Neo.Service.DispName = "VPN Client Device Driver - VPN123" -Neo.Service.Desc = "VPN Client Adapter - VPN123" -NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN123" -Neo.EventLog.Name = "Neo" -NetworkAddress = "MAC Address" -DefaultAddress = "000001000001" -MaxSpeed = "Indicate Speed (Mbps)" -KeepLink = "Keep Link" -On = "On" -Off = "Off" - - -; Auto Generated 20180205_163621.024 - +; VPN Client Device Driver for Windows 2000 and Greater +; +; Copyright (c) SoftEther Corporation. All Rights Reserved. +; http://www.softether.co.jp/ +; +; BUILD 9658 + +[Version] +Signature = "$Windows NT$" +Class = Net +ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} +Provider = %CompanyName% +DriverVer = 02/04/2018, 4.25.0.9658 +CatalogFile.NT = Neo6_x86_VPN123.cat + +[Manufacturer] +%CompanyName% = SoftEther + +[SourceDisksNames] +1=%DiskDescription%, "", , + +[SourceDisksFiles] +Neo6_x86_VPN123.sys = 1 + +[DestinationDirs] +DefaultDestDir = 12 +Neo.CopyFiles.Sys = 12 + +[Neo.CopyFiles.Sys] +Neo6_x86_VPN123.sys, , , 2 + +[SoftEther] +%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN123 + +[NeoAdapter.Install] +Characteristics = 0x1 +AddReg = Neo.Reg, NeoAdapter.Ndi +CopyFiles = Neo.CopyFiles.Sys +*IfType = 53 +*MediaType = 0 +*PhysicalMediaType = 0 + +[NeoAdapter.Install.Services] +AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% + +[NeoAdapter.Ndi] +HKR, , NetworkAddress, 0, %DefaultAddress% +HKR, Ndi, DeviceID, , "NeoAdapter_VPN123" +HKR, , DevLoader, , ndis +HKR, , DeviceVxDs, , Neo6_x86_VPN123.sys +HKR, NDIS, LogDriverName, , "Neo_VPN123" +HKR, NDIS, MajorNdisVersion, 1, 5 +HKR, NDIS, MinorNdisVersion, 1, 0 +HKR, Ndi\Interfaces, DefUpper, , "ndis5" +HKR, Ndi\Interfaces, UpperRange, , "ndis5" +HKR, Ndi\Interfaces, LowerRange, , "ethernet" +HKR, Ndi\Interfaces, DefLower, , "ethernet" +HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" +HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% +HKR, Ndi\Params\NetworkAddress, type, 0, "edit" +HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" +HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" +HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% +HKR, Ndi\Params\NetworkAddress, optional, 0, "0" +HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% +HKR, Ndi\Params\MaxSpeed, type, 0, "int" +HKR, Ndi\Params\MaxSpeed, default, 0, "100" +HKR, Ndi\Params\MaxSpeed, min, 0, "0" +HKR, Ndi\Params\MaxSpeed, max, 0, "2000" +HKR, Ndi\Params\MaxSpeed, step, 0, "1" +HKR, Ndi\Params\MaxSpeed, Base, 0, "10" +HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% +HKR, Ndi\Params\KeepLink, type, 0, "enum" +HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% +HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% +HKR, Ndi\Params\KeepLink, default, 0, "0" + + +[Neo.Service] +DisplayName = %Neo.Service.DispName% +Description = %Neo.Service.Desc% +ServiceType = 1 +StartType = 3 +ErrorControl = 1 +ServiceBinary = %12%\Neo6_x86_VPN123.sys +LoadOrderGroup = NDIS + +[Neo.Reg] +HKR, Ndi, Service, 0, Neo.Service.Name +HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" +HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" + +[Neo.EventLog] +HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN123.sys" +HKR, , TypesSupported, 0x00010001, 7 + +[Strings] +CompanyName = "SoftEther Corporation" +DiskDescription = "VPN Client Device Driver Install Disk" +Neo.Service.Name = "Neo_VPN123" +Neo.Service.DispName = "VPN Client Device Driver - VPN123" +Neo.Service.Desc = "VPN Client Adapter - VPN123" +NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN123" +Neo.EventLog.Name = "Neo" +NetworkAddress = "MAC Address" +DefaultAddress = "000001000001" +MaxSpeed = "Indicate Speed (Mbps)" +KeepLink = "Keep Link" +On = "On" +Off = "Off" + + +; Auto Generated 20180205_163621.024 + diff --git a/src/bin/hamcore/DriverPackages/Neo6_Win10/x86/Neo6_x86_VPN124.inf b/src/bin/hamcore/DriverPackages/Neo6_Win10/x86/Neo6_x86_VPN124.inf index f989fc5b..1d9aaabe 100644 --- a/src/bin/hamcore/DriverPackages/Neo6_Win10/x86/Neo6_x86_VPN124.inf +++ b/src/bin/hamcore/DriverPackages/Neo6_Win10/x86/Neo6_x86_VPN124.inf @@ -1,114 +1,114 @@ -; VPN Client Device Driver for Windows 2000 and Greater -; -; Copyright (c) SoftEther Corporation. All Rights Reserved. -; http://www.softether.co.jp/ -; -; BUILD 9658 - -[Version] -Signature = "$Windows NT$" -Class = Net -ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} -Provider = %CompanyName% -DriverVer = 02/04/2018, 4.25.0.9658 -CatalogFile.NT = Neo6_x86_VPN124.cat - -[Manufacturer] -%CompanyName% = SoftEther - -[SourceDisksNames] -1=%DiskDescription%, "", , - -[SourceDisksFiles] -Neo6_x86_VPN124.sys = 1 - -[DestinationDirs] -DefaultDestDir = 12 -Neo.CopyFiles.Sys = 12 - -[Neo.CopyFiles.Sys] -Neo6_x86_VPN124.sys, , , 2 - -[SoftEther] -%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN124 - -[NeoAdapter.Install] -Characteristics = 0x1 -AddReg = Neo.Reg, NeoAdapter.Ndi -CopyFiles = Neo.CopyFiles.Sys -*IfType = 53 -*MediaType = 0 -*PhysicalMediaType = 0 - -[NeoAdapter.Install.Services] -AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% - -[NeoAdapter.Ndi] -HKR, , NetworkAddress, 0, %DefaultAddress% -HKR, Ndi, DeviceID, , "NeoAdapter_VPN124" -HKR, , DevLoader, , ndis -HKR, , DeviceVxDs, , Neo6_x86_VPN124.sys -HKR, NDIS, LogDriverName, , "Neo_VPN124" -HKR, NDIS, MajorNdisVersion, 1, 5 -HKR, NDIS, MinorNdisVersion, 1, 0 -HKR, Ndi\Interfaces, DefUpper, , "ndis5" -HKR, Ndi\Interfaces, UpperRange, , "ndis5" -HKR, Ndi\Interfaces, LowerRange, , "ethernet" -HKR, Ndi\Interfaces, DefLower, , "ethernet" -HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" -HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% -HKR, Ndi\Params\NetworkAddress, type, 0, "edit" -HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" -HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" -HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% -HKR, Ndi\Params\NetworkAddress, optional, 0, "0" -HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% -HKR, Ndi\Params\MaxSpeed, type, 0, "int" -HKR, Ndi\Params\MaxSpeed, default, 0, "100" -HKR, Ndi\Params\MaxSpeed, min, 0, "0" -HKR, Ndi\Params\MaxSpeed, max, 0, "2000" -HKR, Ndi\Params\MaxSpeed, step, 0, "1" -HKR, Ndi\Params\MaxSpeed, Base, 0, "10" -HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% -HKR, Ndi\Params\KeepLink, type, 0, "enum" -HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% -HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% -HKR, Ndi\Params\KeepLink, default, 0, "0" - - -[Neo.Service] -DisplayName = %Neo.Service.DispName% -Description = %Neo.Service.Desc% -ServiceType = 1 -StartType = 3 -ErrorControl = 1 -ServiceBinary = %12%\Neo6_x86_VPN124.sys -LoadOrderGroup = NDIS - -[Neo.Reg] -HKR, Ndi, Service, 0, Neo.Service.Name -HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" -HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" - -[Neo.EventLog] -HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN124.sys" -HKR, , TypesSupported, 0x00010001, 7 - -[Strings] -CompanyName = "SoftEther Corporation" -DiskDescription = "VPN Client Device Driver Install Disk" -Neo.Service.Name = "Neo_VPN124" -Neo.Service.DispName = "VPN Client Device Driver - VPN124" -Neo.Service.Desc = "VPN Client Adapter - VPN124" -NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN124" -Neo.EventLog.Name = "Neo" -NetworkAddress = "MAC Address" -DefaultAddress = "000001000001" -MaxSpeed = "Indicate Speed (Mbps)" -KeepLink = "Keep Link" -On = "On" -Off = "Off" - - -; Auto Generated 20180205_163621.097 - +; VPN Client Device Driver for Windows 2000 and Greater +; +; Copyright (c) SoftEther Corporation. All Rights Reserved. +; http://www.softether.co.jp/ +; +; BUILD 9658 + +[Version] +Signature = "$Windows NT$" +Class = Net +ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} +Provider = %CompanyName% +DriverVer = 02/04/2018, 4.25.0.9658 +CatalogFile.NT = Neo6_x86_VPN124.cat + +[Manufacturer] +%CompanyName% = SoftEther + +[SourceDisksNames] +1=%DiskDescription%, "", , + +[SourceDisksFiles] +Neo6_x86_VPN124.sys = 1 + +[DestinationDirs] +DefaultDestDir = 12 +Neo.CopyFiles.Sys = 12 + +[Neo.CopyFiles.Sys] +Neo6_x86_VPN124.sys, , , 2 + +[SoftEther] +%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN124 + +[NeoAdapter.Install] +Characteristics = 0x1 +AddReg = Neo.Reg, NeoAdapter.Ndi +CopyFiles = Neo.CopyFiles.Sys +*IfType = 53 +*MediaType = 0 +*PhysicalMediaType = 0 + +[NeoAdapter.Install.Services] +AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% + +[NeoAdapter.Ndi] +HKR, , NetworkAddress, 0, %DefaultAddress% +HKR, Ndi, DeviceID, , "NeoAdapter_VPN124" +HKR, , DevLoader, , ndis +HKR, , DeviceVxDs, , Neo6_x86_VPN124.sys +HKR, NDIS, LogDriverName, , "Neo_VPN124" +HKR, NDIS, MajorNdisVersion, 1, 5 +HKR, NDIS, MinorNdisVersion, 1, 0 +HKR, Ndi\Interfaces, DefUpper, , "ndis5" +HKR, Ndi\Interfaces, UpperRange, , "ndis5" +HKR, Ndi\Interfaces, LowerRange, , "ethernet" +HKR, Ndi\Interfaces, DefLower, , "ethernet" +HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" +HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% +HKR, Ndi\Params\NetworkAddress, type, 0, "edit" +HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" +HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" +HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% +HKR, Ndi\Params\NetworkAddress, optional, 0, "0" +HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% +HKR, Ndi\Params\MaxSpeed, type, 0, "int" +HKR, Ndi\Params\MaxSpeed, default, 0, "100" +HKR, Ndi\Params\MaxSpeed, min, 0, "0" +HKR, Ndi\Params\MaxSpeed, max, 0, "2000" +HKR, Ndi\Params\MaxSpeed, step, 0, "1" +HKR, Ndi\Params\MaxSpeed, Base, 0, "10" +HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% +HKR, Ndi\Params\KeepLink, type, 0, "enum" +HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% +HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% +HKR, Ndi\Params\KeepLink, default, 0, "0" + + +[Neo.Service] +DisplayName = %Neo.Service.DispName% +Description = %Neo.Service.Desc% +ServiceType = 1 +StartType = 3 +ErrorControl = 1 +ServiceBinary = %12%\Neo6_x86_VPN124.sys +LoadOrderGroup = NDIS + +[Neo.Reg] +HKR, Ndi, Service, 0, Neo.Service.Name +HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" +HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" + +[Neo.EventLog] +HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN124.sys" +HKR, , TypesSupported, 0x00010001, 7 + +[Strings] +CompanyName = "SoftEther Corporation" +DiskDescription = "VPN Client Device Driver Install Disk" +Neo.Service.Name = "Neo_VPN124" +Neo.Service.DispName = "VPN Client Device Driver - VPN124" +Neo.Service.Desc = "VPN Client Adapter - VPN124" +NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN124" +Neo.EventLog.Name = "Neo" +NetworkAddress = "MAC Address" +DefaultAddress = "000001000001" +MaxSpeed = "Indicate Speed (Mbps)" +KeepLink = "Keep Link" +On = "On" +Off = "Off" + + +; Auto Generated 20180205_163621.097 + diff --git a/src/bin/hamcore/DriverPackages/Neo6_Win10/x86/Neo6_x86_VPN125.inf b/src/bin/hamcore/DriverPackages/Neo6_Win10/x86/Neo6_x86_VPN125.inf index 77fa0019..b7b56f77 100644 --- a/src/bin/hamcore/DriverPackages/Neo6_Win10/x86/Neo6_x86_VPN125.inf +++ b/src/bin/hamcore/DriverPackages/Neo6_Win10/x86/Neo6_x86_VPN125.inf @@ -1,114 +1,114 @@ -; VPN Client Device Driver for Windows 2000 and Greater -; -; Copyright (c) SoftEther Corporation. All Rights Reserved. -; http://www.softether.co.jp/ -; -; BUILD 9658 - -[Version] -Signature = "$Windows NT$" -Class = Net -ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} -Provider = %CompanyName% -DriverVer = 02/04/2018, 4.25.0.9658 -CatalogFile.NT = Neo6_x86_VPN125.cat - -[Manufacturer] -%CompanyName% = SoftEther - -[SourceDisksNames] -1=%DiskDescription%, "", , - -[SourceDisksFiles] -Neo6_x86_VPN125.sys = 1 - -[DestinationDirs] -DefaultDestDir = 12 -Neo.CopyFiles.Sys = 12 - -[Neo.CopyFiles.Sys] -Neo6_x86_VPN125.sys, , , 2 - -[SoftEther] -%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN125 - -[NeoAdapter.Install] -Characteristics = 0x1 -AddReg = Neo.Reg, NeoAdapter.Ndi -CopyFiles = Neo.CopyFiles.Sys -*IfType = 53 -*MediaType = 0 -*PhysicalMediaType = 0 - -[NeoAdapter.Install.Services] -AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% - -[NeoAdapter.Ndi] -HKR, , NetworkAddress, 0, %DefaultAddress% -HKR, Ndi, DeviceID, , "NeoAdapter_VPN125" -HKR, , DevLoader, , ndis -HKR, , DeviceVxDs, , Neo6_x86_VPN125.sys -HKR, NDIS, LogDriverName, , "Neo_VPN125" -HKR, NDIS, MajorNdisVersion, 1, 5 -HKR, NDIS, MinorNdisVersion, 1, 0 -HKR, Ndi\Interfaces, DefUpper, , "ndis5" -HKR, Ndi\Interfaces, UpperRange, , "ndis5" -HKR, Ndi\Interfaces, LowerRange, , "ethernet" -HKR, Ndi\Interfaces, DefLower, , "ethernet" -HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" -HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% -HKR, Ndi\Params\NetworkAddress, type, 0, "edit" -HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" -HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" -HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% -HKR, Ndi\Params\NetworkAddress, optional, 0, "0" -HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% -HKR, Ndi\Params\MaxSpeed, type, 0, "int" -HKR, Ndi\Params\MaxSpeed, default, 0, "100" -HKR, Ndi\Params\MaxSpeed, min, 0, "0" -HKR, Ndi\Params\MaxSpeed, max, 0, "2000" -HKR, Ndi\Params\MaxSpeed, step, 0, "1" -HKR, Ndi\Params\MaxSpeed, Base, 0, "10" -HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% -HKR, Ndi\Params\KeepLink, type, 0, "enum" -HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% -HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% -HKR, Ndi\Params\KeepLink, default, 0, "0" - - -[Neo.Service] -DisplayName = %Neo.Service.DispName% -Description = %Neo.Service.Desc% -ServiceType = 1 -StartType = 3 -ErrorControl = 1 -ServiceBinary = %12%\Neo6_x86_VPN125.sys -LoadOrderGroup = NDIS - -[Neo.Reg] -HKR, Ndi, Service, 0, Neo.Service.Name -HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" -HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" - -[Neo.EventLog] -HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN125.sys" -HKR, , TypesSupported, 0x00010001, 7 - -[Strings] -CompanyName = "SoftEther Corporation" -DiskDescription = "VPN Client Device Driver Install Disk" -Neo.Service.Name = "Neo_VPN125" -Neo.Service.DispName = "VPN Client Device Driver - VPN125" -Neo.Service.Desc = "VPN Client Adapter - VPN125" -NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN125" -Neo.EventLog.Name = "Neo" -NetworkAddress = "MAC Address" -DefaultAddress = "000001000001" -MaxSpeed = "Indicate Speed (Mbps)" -KeepLink = "Keep Link" -On = "On" -Off = "Off" - - -; Auto Generated 20180205_163621.167 - +; VPN Client Device Driver for Windows 2000 and Greater +; +; Copyright (c) SoftEther Corporation. All Rights Reserved. +; http://www.softether.co.jp/ +; +; BUILD 9658 + +[Version] +Signature = "$Windows NT$" +Class = Net +ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} +Provider = %CompanyName% +DriverVer = 02/04/2018, 4.25.0.9658 +CatalogFile.NT = Neo6_x86_VPN125.cat + +[Manufacturer] +%CompanyName% = SoftEther + +[SourceDisksNames] +1=%DiskDescription%, "", , + +[SourceDisksFiles] +Neo6_x86_VPN125.sys = 1 + +[DestinationDirs] +DefaultDestDir = 12 +Neo.CopyFiles.Sys = 12 + +[Neo.CopyFiles.Sys] +Neo6_x86_VPN125.sys, , , 2 + +[SoftEther] +%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN125 + +[NeoAdapter.Install] +Characteristics = 0x1 +AddReg = Neo.Reg, NeoAdapter.Ndi +CopyFiles = Neo.CopyFiles.Sys +*IfType = 53 +*MediaType = 0 +*PhysicalMediaType = 0 + +[NeoAdapter.Install.Services] +AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% + +[NeoAdapter.Ndi] +HKR, , NetworkAddress, 0, %DefaultAddress% +HKR, Ndi, DeviceID, , "NeoAdapter_VPN125" +HKR, , DevLoader, , ndis +HKR, , DeviceVxDs, , Neo6_x86_VPN125.sys +HKR, NDIS, LogDriverName, , "Neo_VPN125" +HKR, NDIS, MajorNdisVersion, 1, 5 +HKR, NDIS, MinorNdisVersion, 1, 0 +HKR, Ndi\Interfaces, DefUpper, , "ndis5" +HKR, Ndi\Interfaces, UpperRange, , "ndis5" +HKR, Ndi\Interfaces, LowerRange, , "ethernet" +HKR, Ndi\Interfaces, DefLower, , "ethernet" +HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" +HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% +HKR, Ndi\Params\NetworkAddress, type, 0, "edit" +HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" +HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" +HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% +HKR, Ndi\Params\NetworkAddress, optional, 0, "0" +HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% +HKR, Ndi\Params\MaxSpeed, type, 0, "int" +HKR, Ndi\Params\MaxSpeed, default, 0, "100" +HKR, Ndi\Params\MaxSpeed, min, 0, "0" +HKR, Ndi\Params\MaxSpeed, max, 0, "2000" +HKR, Ndi\Params\MaxSpeed, step, 0, "1" +HKR, Ndi\Params\MaxSpeed, Base, 0, "10" +HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% +HKR, Ndi\Params\KeepLink, type, 0, "enum" +HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% +HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% +HKR, Ndi\Params\KeepLink, default, 0, "0" + + +[Neo.Service] +DisplayName = %Neo.Service.DispName% +Description = %Neo.Service.Desc% +ServiceType = 1 +StartType = 3 +ErrorControl = 1 +ServiceBinary = %12%\Neo6_x86_VPN125.sys +LoadOrderGroup = NDIS + +[Neo.Reg] +HKR, Ndi, Service, 0, Neo.Service.Name +HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" +HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" + +[Neo.EventLog] +HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN125.sys" +HKR, , TypesSupported, 0x00010001, 7 + +[Strings] +CompanyName = "SoftEther Corporation" +DiskDescription = "VPN Client Device Driver Install Disk" +Neo.Service.Name = "Neo_VPN125" +Neo.Service.DispName = "VPN Client Device Driver - VPN125" +Neo.Service.Desc = "VPN Client Adapter - VPN125" +NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN125" +Neo.EventLog.Name = "Neo" +NetworkAddress = "MAC Address" +DefaultAddress = "000001000001" +MaxSpeed = "Indicate Speed (Mbps)" +KeepLink = "Keep Link" +On = "On" +Off = "Off" + + +; Auto Generated 20180205_163621.167 + diff --git a/src/bin/hamcore/DriverPackages/Neo6_Win10/x86/Neo6_x86_VPN126.inf b/src/bin/hamcore/DriverPackages/Neo6_Win10/x86/Neo6_x86_VPN126.inf index 423e714e..00d27e67 100644 --- a/src/bin/hamcore/DriverPackages/Neo6_Win10/x86/Neo6_x86_VPN126.inf +++ b/src/bin/hamcore/DriverPackages/Neo6_Win10/x86/Neo6_x86_VPN126.inf @@ -1,114 +1,114 @@ -; VPN Client Device Driver for Windows 2000 and Greater -; -; Copyright (c) SoftEther Corporation. All Rights Reserved. -; http://www.softether.co.jp/ -; -; BUILD 9658 - -[Version] -Signature = "$Windows NT$" -Class = Net -ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} -Provider = %CompanyName% -DriverVer = 02/04/2018, 4.25.0.9658 -CatalogFile.NT = Neo6_x86_VPN126.cat - -[Manufacturer] -%CompanyName% = SoftEther - -[SourceDisksNames] -1=%DiskDescription%, "", , - -[SourceDisksFiles] -Neo6_x86_VPN126.sys = 1 - -[DestinationDirs] -DefaultDestDir = 12 -Neo.CopyFiles.Sys = 12 - -[Neo.CopyFiles.Sys] -Neo6_x86_VPN126.sys, , , 2 - -[SoftEther] -%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN126 - -[NeoAdapter.Install] -Characteristics = 0x1 -AddReg = Neo.Reg, NeoAdapter.Ndi -CopyFiles = Neo.CopyFiles.Sys -*IfType = 53 -*MediaType = 0 -*PhysicalMediaType = 0 - -[NeoAdapter.Install.Services] -AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% - -[NeoAdapter.Ndi] -HKR, , NetworkAddress, 0, %DefaultAddress% -HKR, Ndi, DeviceID, , "NeoAdapter_VPN126" -HKR, , DevLoader, , ndis -HKR, , DeviceVxDs, , Neo6_x86_VPN126.sys -HKR, NDIS, LogDriverName, , "Neo_VPN126" -HKR, NDIS, MajorNdisVersion, 1, 5 -HKR, NDIS, MinorNdisVersion, 1, 0 -HKR, Ndi\Interfaces, DefUpper, , "ndis5" -HKR, Ndi\Interfaces, UpperRange, , "ndis5" -HKR, Ndi\Interfaces, LowerRange, , "ethernet" -HKR, Ndi\Interfaces, DefLower, , "ethernet" -HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" -HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% -HKR, Ndi\Params\NetworkAddress, type, 0, "edit" -HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" -HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" -HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% -HKR, Ndi\Params\NetworkAddress, optional, 0, "0" -HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% -HKR, Ndi\Params\MaxSpeed, type, 0, "int" -HKR, Ndi\Params\MaxSpeed, default, 0, "100" -HKR, Ndi\Params\MaxSpeed, min, 0, "0" -HKR, Ndi\Params\MaxSpeed, max, 0, "2000" -HKR, Ndi\Params\MaxSpeed, step, 0, "1" -HKR, Ndi\Params\MaxSpeed, Base, 0, "10" -HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% -HKR, Ndi\Params\KeepLink, type, 0, "enum" -HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% -HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% -HKR, Ndi\Params\KeepLink, default, 0, "0" - - -[Neo.Service] -DisplayName = %Neo.Service.DispName% -Description = %Neo.Service.Desc% -ServiceType = 1 -StartType = 3 -ErrorControl = 1 -ServiceBinary = %12%\Neo6_x86_VPN126.sys -LoadOrderGroup = NDIS - -[Neo.Reg] -HKR, Ndi, Service, 0, Neo.Service.Name -HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" -HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" - -[Neo.EventLog] -HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN126.sys" -HKR, , TypesSupported, 0x00010001, 7 - -[Strings] -CompanyName = "SoftEther Corporation" -DiskDescription = "VPN Client Device Driver Install Disk" -Neo.Service.Name = "Neo_VPN126" -Neo.Service.DispName = "VPN Client Device Driver - VPN126" -Neo.Service.Desc = "VPN Client Adapter - VPN126" -NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN126" -Neo.EventLog.Name = "Neo" -NetworkAddress = "MAC Address" -DefaultAddress = "000001000001" -MaxSpeed = "Indicate Speed (Mbps)" -KeepLink = "Keep Link" -On = "On" -Off = "Off" - - -; Auto Generated 20180205_163621.240 - +; VPN Client Device Driver for Windows 2000 and Greater +; +; Copyright (c) SoftEther Corporation. All Rights Reserved. +; http://www.softether.co.jp/ +; +; BUILD 9658 + +[Version] +Signature = "$Windows NT$" +Class = Net +ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} +Provider = %CompanyName% +DriverVer = 02/04/2018, 4.25.0.9658 +CatalogFile.NT = Neo6_x86_VPN126.cat + +[Manufacturer] +%CompanyName% = SoftEther + +[SourceDisksNames] +1=%DiskDescription%, "", , + +[SourceDisksFiles] +Neo6_x86_VPN126.sys = 1 + +[DestinationDirs] +DefaultDestDir = 12 +Neo.CopyFiles.Sys = 12 + +[Neo.CopyFiles.Sys] +Neo6_x86_VPN126.sys, , , 2 + +[SoftEther] +%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN126 + +[NeoAdapter.Install] +Characteristics = 0x1 +AddReg = Neo.Reg, NeoAdapter.Ndi +CopyFiles = Neo.CopyFiles.Sys +*IfType = 53 +*MediaType = 0 +*PhysicalMediaType = 0 + +[NeoAdapter.Install.Services] +AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% + +[NeoAdapter.Ndi] +HKR, , NetworkAddress, 0, %DefaultAddress% +HKR, Ndi, DeviceID, , "NeoAdapter_VPN126" +HKR, , DevLoader, , ndis +HKR, , DeviceVxDs, , Neo6_x86_VPN126.sys +HKR, NDIS, LogDriverName, , "Neo_VPN126" +HKR, NDIS, MajorNdisVersion, 1, 5 +HKR, NDIS, MinorNdisVersion, 1, 0 +HKR, Ndi\Interfaces, DefUpper, , "ndis5" +HKR, Ndi\Interfaces, UpperRange, , "ndis5" +HKR, Ndi\Interfaces, LowerRange, , "ethernet" +HKR, Ndi\Interfaces, DefLower, , "ethernet" +HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" +HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% +HKR, Ndi\Params\NetworkAddress, type, 0, "edit" +HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" +HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" +HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% +HKR, Ndi\Params\NetworkAddress, optional, 0, "0" +HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% +HKR, Ndi\Params\MaxSpeed, type, 0, "int" +HKR, Ndi\Params\MaxSpeed, default, 0, "100" +HKR, Ndi\Params\MaxSpeed, min, 0, "0" +HKR, Ndi\Params\MaxSpeed, max, 0, "2000" +HKR, Ndi\Params\MaxSpeed, step, 0, "1" +HKR, Ndi\Params\MaxSpeed, Base, 0, "10" +HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% +HKR, Ndi\Params\KeepLink, type, 0, "enum" +HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% +HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% +HKR, Ndi\Params\KeepLink, default, 0, "0" + + +[Neo.Service] +DisplayName = %Neo.Service.DispName% +Description = %Neo.Service.Desc% +ServiceType = 1 +StartType = 3 +ErrorControl = 1 +ServiceBinary = %12%\Neo6_x86_VPN126.sys +LoadOrderGroup = NDIS + +[Neo.Reg] +HKR, Ndi, Service, 0, Neo.Service.Name +HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" +HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" + +[Neo.EventLog] +HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN126.sys" +HKR, , TypesSupported, 0x00010001, 7 + +[Strings] +CompanyName = "SoftEther Corporation" +DiskDescription = "VPN Client Device Driver Install Disk" +Neo.Service.Name = "Neo_VPN126" +Neo.Service.DispName = "VPN Client Device Driver - VPN126" +Neo.Service.Desc = "VPN Client Adapter - VPN126" +NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN126" +Neo.EventLog.Name = "Neo" +NetworkAddress = "MAC Address" +DefaultAddress = "000001000001" +MaxSpeed = "Indicate Speed (Mbps)" +KeepLink = "Keep Link" +On = "On" +Off = "Off" + + +; Auto Generated 20180205_163621.240 + diff --git a/src/bin/hamcore/DriverPackages/Neo6_Win10/x86/Neo6_x86_VPN127.inf b/src/bin/hamcore/DriverPackages/Neo6_Win10/x86/Neo6_x86_VPN127.inf index 0be1127f..afd5db61 100644 --- a/src/bin/hamcore/DriverPackages/Neo6_Win10/x86/Neo6_x86_VPN127.inf +++ b/src/bin/hamcore/DriverPackages/Neo6_Win10/x86/Neo6_x86_VPN127.inf @@ -1,114 +1,114 @@ -; VPN Client Device Driver for Windows 2000 and Greater -; -; Copyright (c) SoftEther Corporation. All Rights Reserved. -; http://www.softether.co.jp/ -; -; BUILD 9658 - -[Version] -Signature = "$Windows NT$" -Class = Net -ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} -Provider = %CompanyName% -DriverVer = 02/04/2018, 4.25.0.9658 -CatalogFile.NT = Neo6_x86_VPN127.cat - -[Manufacturer] -%CompanyName% = SoftEther - -[SourceDisksNames] -1=%DiskDescription%, "", , - -[SourceDisksFiles] -Neo6_x86_VPN127.sys = 1 - -[DestinationDirs] -DefaultDestDir = 12 -Neo.CopyFiles.Sys = 12 - -[Neo.CopyFiles.Sys] -Neo6_x86_VPN127.sys, , , 2 - -[SoftEther] -%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN127 - -[NeoAdapter.Install] -Characteristics = 0x1 -AddReg = Neo.Reg, NeoAdapter.Ndi -CopyFiles = Neo.CopyFiles.Sys -*IfType = 53 -*MediaType = 0 -*PhysicalMediaType = 0 - -[NeoAdapter.Install.Services] -AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% - -[NeoAdapter.Ndi] -HKR, , NetworkAddress, 0, %DefaultAddress% -HKR, Ndi, DeviceID, , "NeoAdapter_VPN127" -HKR, , DevLoader, , ndis -HKR, , DeviceVxDs, , Neo6_x86_VPN127.sys -HKR, NDIS, LogDriverName, , "Neo_VPN127" -HKR, NDIS, MajorNdisVersion, 1, 5 -HKR, NDIS, MinorNdisVersion, 1, 0 -HKR, Ndi\Interfaces, DefUpper, , "ndis5" -HKR, Ndi\Interfaces, UpperRange, , "ndis5" -HKR, Ndi\Interfaces, LowerRange, , "ethernet" -HKR, Ndi\Interfaces, DefLower, , "ethernet" -HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" -HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% -HKR, Ndi\Params\NetworkAddress, type, 0, "edit" -HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" -HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" -HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% -HKR, Ndi\Params\NetworkAddress, optional, 0, "0" -HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% -HKR, Ndi\Params\MaxSpeed, type, 0, "int" -HKR, Ndi\Params\MaxSpeed, default, 0, "100" -HKR, Ndi\Params\MaxSpeed, min, 0, "0" -HKR, Ndi\Params\MaxSpeed, max, 0, "2000" -HKR, Ndi\Params\MaxSpeed, step, 0, "1" -HKR, Ndi\Params\MaxSpeed, Base, 0, "10" -HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% -HKR, Ndi\Params\KeepLink, type, 0, "enum" -HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% -HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% -HKR, Ndi\Params\KeepLink, default, 0, "0" - - -[Neo.Service] -DisplayName = %Neo.Service.DispName% -Description = %Neo.Service.Desc% -ServiceType = 1 -StartType = 3 -ErrorControl = 1 -ServiceBinary = %12%\Neo6_x86_VPN127.sys -LoadOrderGroup = NDIS - -[Neo.Reg] -HKR, Ndi, Service, 0, Neo.Service.Name -HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" -HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" - -[Neo.EventLog] -HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN127.sys" -HKR, , TypesSupported, 0x00010001, 7 - -[Strings] -CompanyName = "SoftEther Corporation" -DiskDescription = "VPN Client Device Driver Install Disk" -Neo.Service.Name = "Neo_VPN127" -Neo.Service.DispName = "VPN Client Device Driver - VPN127" -Neo.Service.Desc = "VPN Client Adapter - VPN127" -NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN127" -Neo.EventLog.Name = "Neo" -NetworkAddress = "MAC Address" -DefaultAddress = "000001000001" -MaxSpeed = "Indicate Speed (Mbps)" -KeepLink = "Keep Link" -On = "On" -Off = "Off" - - -; Auto Generated 20180205_163621.310 - +; VPN Client Device Driver for Windows 2000 and Greater +; +; Copyright (c) SoftEther Corporation. All Rights Reserved. +; http://www.softether.co.jp/ +; +; BUILD 9658 + +[Version] +Signature = "$Windows NT$" +Class = Net +ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} +Provider = %CompanyName% +DriverVer = 02/04/2018, 4.25.0.9658 +CatalogFile.NT = Neo6_x86_VPN127.cat + +[Manufacturer] +%CompanyName% = SoftEther + +[SourceDisksNames] +1=%DiskDescription%, "", , + +[SourceDisksFiles] +Neo6_x86_VPN127.sys = 1 + +[DestinationDirs] +DefaultDestDir = 12 +Neo.CopyFiles.Sys = 12 + +[Neo.CopyFiles.Sys] +Neo6_x86_VPN127.sys, , , 2 + +[SoftEther] +%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN127 + +[NeoAdapter.Install] +Characteristics = 0x1 +AddReg = Neo.Reg, NeoAdapter.Ndi +CopyFiles = Neo.CopyFiles.Sys +*IfType = 53 +*MediaType = 0 +*PhysicalMediaType = 0 + +[NeoAdapter.Install.Services] +AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% + +[NeoAdapter.Ndi] +HKR, , NetworkAddress, 0, %DefaultAddress% +HKR, Ndi, DeviceID, , "NeoAdapter_VPN127" +HKR, , DevLoader, , ndis +HKR, , DeviceVxDs, , Neo6_x86_VPN127.sys +HKR, NDIS, LogDriverName, , "Neo_VPN127" +HKR, NDIS, MajorNdisVersion, 1, 5 +HKR, NDIS, MinorNdisVersion, 1, 0 +HKR, Ndi\Interfaces, DefUpper, , "ndis5" +HKR, Ndi\Interfaces, UpperRange, , "ndis5" +HKR, Ndi\Interfaces, LowerRange, , "ethernet" +HKR, Ndi\Interfaces, DefLower, , "ethernet" +HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" +HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% +HKR, Ndi\Params\NetworkAddress, type, 0, "edit" +HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" +HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" +HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% +HKR, Ndi\Params\NetworkAddress, optional, 0, "0" +HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% +HKR, Ndi\Params\MaxSpeed, type, 0, "int" +HKR, Ndi\Params\MaxSpeed, default, 0, "100" +HKR, Ndi\Params\MaxSpeed, min, 0, "0" +HKR, Ndi\Params\MaxSpeed, max, 0, "2000" +HKR, Ndi\Params\MaxSpeed, step, 0, "1" +HKR, Ndi\Params\MaxSpeed, Base, 0, "10" +HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% +HKR, Ndi\Params\KeepLink, type, 0, "enum" +HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% +HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% +HKR, Ndi\Params\KeepLink, default, 0, "0" + + +[Neo.Service] +DisplayName = %Neo.Service.DispName% +Description = %Neo.Service.Desc% +ServiceType = 1 +StartType = 3 +ErrorControl = 1 +ServiceBinary = %12%\Neo6_x86_VPN127.sys +LoadOrderGroup = NDIS + +[Neo.Reg] +HKR, Ndi, Service, 0, Neo.Service.Name +HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" +HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" + +[Neo.EventLog] +HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN127.sys" +HKR, , TypesSupported, 0x00010001, 7 + +[Strings] +CompanyName = "SoftEther Corporation" +DiskDescription = "VPN Client Device Driver Install Disk" +Neo.Service.Name = "Neo_VPN127" +Neo.Service.DispName = "VPN Client Device Driver - VPN127" +Neo.Service.Desc = "VPN Client Adapter - VPN127" +NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN127" +Neo.EventLog.Name = "Neo" +NetworkAddress = "MAC Address" +DefaultAddress = "000001000001" +MaxSpeed = "Indicate Speed (Mbps)" +KeepLink = "Keep Link" +On = "On" +Off = "Off" + + +; Auto Generated 20180205_163621.310 + diff --git a/src/bin/hamcore/DriverPackages/Neo6_Win10/x86/Neo6_x86_VPN13.inf b/src/bin/hamcore/DriverPackages/Neo6_Win10/x86/Neo6_x86_VPN13.inf index 3877ebce..a7156d74 100644 --- a/src/bin/hamcore/DriverPackages/Neo6_Win10/x86/Neo6_x86_VPN13.inf +++ b/src/bin/hamcore/DriverPackages/Neo6_Win10/x86/Neo6_x86_VPN13.inf @@ -1,114 +1,114 @@ -; VPN Client Device Driver for Windows 2000 and Greater -; -; Copyright (c) SoftEther Corporation. All Rights Reserved. -; http://www.softether.co.jp/ -; -; BUILD 9658 - -[Version] -Signature = "$Windows NT$" -Class = Net -ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} -Provider = %CompanyName% -DriverVer = 02/04/2018, 4.25.0.9658 -CatalogFile.NT = Neo6_x86_VPN13.cat - -[Manufacturer] -%CompanyName% = SoftEther - -[SourceDisksNames] -1=%DiskDescription%, "", , - -[SourceDisksFiles] -Neo6_x86_VPN13.sys = 1 - -[DestinationDirs] -DefaultDestDir = 12 -Neo.CopyFiles.Sys = 12 - -[Neo.CopyFiles.Sys] -Neo6_x86_VPN13.sys, , , 2 - -[SoftEther] -%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN13 - -[NeoAdapter.Install] -Characteristics = 0x1 -AddReg = Neo.Reg, NeoAdapter.Ndi -CopyFiles = Neo.CopyFiles.Sys -*IfType = 53 -*MediaType = 0 -*PhysicalMediaType = 0 - -[NeoAdapter.Install.Services] -AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% - -[NeoAdapter.Ndi] -HKR, , NetworkAddress, 0, %DefaultAddress% -HKR, Ndi, DeviceID, , "NeoAdapter_VPN13" -HKR, , DevLoader, , ndis -HKR, , DeviceVxDs, , Neo6_x86_VPN13.sys -HKR, NDIS, LogDriverName, , "Neo_VPN13" -HKR, NDIS, MajorNdisVersion, 1, 5 -HKR, NDIS, MinorNdisVersion, 1, 0 -HKR, Ndi\Interfaces, DefUpper, , "ndis5" -HKR, Ndi\Interfaces, UpperRange, , "ndis5" -HKR, Ndi\Interfaces, LowerRange, , "ethernet" -HKR, Ndi\Interfaces, DefLower, , "ethernet" -HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" -HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% -HKR, Ndi\Params\NetworkAddress, type, 0, "edit" -HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" -HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" -HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% -HKR, Ndi\Params\NetworkAddress, optional, 0, "0" -HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% -HKR, Ndi\Params\MaxSpeed, type, 0, "int" -HKR, Ndi\Params\MaxSpeed, default, 0, "100" -HKR, Ndi\Params\MaxSpeed, min, 0, "0" -HKR, Ndi\Params\MaxSpeed, max, 0, "2000" -HKR, Ndi\Params\MaxSpeed, step, 0, "1" -HKR, Ndi\Params\MaxSpeed, Base, 0, "10" -HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% -HKR, Ndi\Params\KeepLink, type, 0, "enum" -HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% -HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% -HKR, Ndi\Params\KeepLink, default, 0, "0" - - -[Neo.Service] -DisplayName = %Neo.Service.DispName% -Description = %Neo.Service.Desc% -ServiceType = 1 -StartType = 3 -ErrorControl = 1 -ServiceBinary = %12%\Neo6_x86_VPN13.sys -LoadOrderGroup = NDIS - -[Neo.Reg] -HKR, Ndi, Service, 0, Neo.Service.Name -HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" -HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" - -[Neo.EventLog] -HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN13.sys" -HKR, , TypesSupported, 0x00010001, 7 - -[Strings] -CompanyName = "SoftEther Corporation" -DiskDescription = "VPN Client Device Driver Install Disk" -Neo.Service.Name = "Neo_VPN13" -Neo.Service.DispName = "VPN Client Device Driver - VPN13" -Neo.Service.Desc = "VPN Client Adapter - VPN13" -NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN13" -Neo.EventLog.Name = "Neo" -NetworkAddress = "MAC Address" -DefaultAddress = "000001000001" -MaxSpeed = "Indicate Speed (Mbps)" -KeepLink = "Keep Link" -On = "On" -Off = "Off" - - -; Auto Generated 20180205_163613.186 - +; VPN Client Device Driver for Windows 2000 and Greater +; +; Copyright (c) SoftEther Corporation. All Rights Reserved. +; http://www.softether.co.jp/ +; +; BUILD 9658 + +[Version] +Signature = "$Windows NT$" +Class = Net +ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} +Provider = %CompanyName% +DriverVer = 02/04/2018, 4.25.0.9658 +CatalogFile.NT = Neo6_x86_VPN13.cat + +[Manufacturer] +%CompanyName% = SoftEther + +[SourceDisksNames] +1=%DiskDescription%, "", , + +[SourceDisksFiles] +Neo6_x86_VPN13.sys = 1 + +[DestinationDirs] +DefaultDestDir = 12 +Neo.CopyFiles.Sys = 12 + +[Neo.CopyFiles.Sys] +Neo6_x86_VPN13.sys, , , 2 + +[SoftEther] +%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN13 + +[NeoAdapter.Install] +Characteristics = 0x1 +AddReg = Neo.Reg, NeoAdapter.Ndi +CopyFiles = Neo.CopyFiles.Sys +*IfType = 53 +*MediaType = 0 +*PhysicalMediaType = 0 + +[NeoAdapter.Install.Services] +AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% + +[NeoAdapter.Ndi] +HKR, , NetworkAddress, 0, %DefaultAddress% +HKR, Ndi, DeviceID, , "NeoAdapter_VPN13" +HKR, , DevLoader, , ndis +HKR, , DeviceVxDs, , Neo6_x86_VPN13.sys +HKR, NDIS, LogDriverName, , "Neo_VPN13" +HKR, NDIS, MajorNdisVersion, 1, 5 +HKR, NDIS, MinorNdisVersion, 1, 0 +HKR, Ndi\Interfaces, DefUpper, , "ndis5" +HKR, Ndi\Interfaces, UpperRange, , "ndis5" +HKR, Ndi\Interfaces, LowerRange, , "ethernet" +HKR, Ndi\Interfaces, DefLower, , "ethernet" +HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" +HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% +HKR, Ndi\Params\NetworkAddress, type, 0, "edit" +HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" +HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" +HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% +HKR, Ndi\Params\NetworkAddress, optional, 0, "0" +HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% +HKR, Ndi\Params\MaxSpeed, type, 0, "int" +HKR, Ndi\Params\MaxSpeed, default, 0, "100" +HKR, Ndi\Params\MaxSpeed, min, 0, "0" +HKR, Ndi\Params\MaxSpeed, max, 0, "2000" +HKR, Ndi\Params\MaxSpeed, step, 0, "1" +HKR, Ndi\Params\MaxSpeed, Base, 0, "10" +HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% +HKR, Ndi\Params\KeepLink, type, 0, "enum" +HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% +HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% +HKR, Ndi\Params\KeepLink, default, 0, "0" + + +[Neo.Service] +DisplayName = %Neo.Service.DispName% +Description = %Neo.Service.Desc% +ServiceType = 1 +StartType = 3 +ErrorControl = 1 +ServiceBinary = %12%\Neo6_x86_VPN13.sys +LoadOrderGroup = NDIS + +[Neo.Reg] +HKR, Ndi, Service, 0, Neo.Service.Name +HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" +HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" + +[Neo.EventLog] +HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN13.sys" +HKR, , TypesSupported, 0x00010001, 7 + +[Strings] +CompanyName = "SoftEther Corporation" +DiskDescription = "VPN Client Device Driver Install Disk" +Neo.Service.Name = "Neo_VPN13" +Neo.Service.DispName = "VPN Client Device Driver - VPN13" +Neo.Service.Desc = "VPN Client Adapter - VPN13" +NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN13" +Neo.EventLog.Name = "Neo" +NetworkAddress = "MAC Address" +DefaultAddress = "000001000001" +MaxSpeed = "Indicate Speed (Mbps)" +KeepLink = "Keep Link" +On = "On" +Off = "Off" + + +; Auto Generated 20180205_163613.186 + diff --git a/src/bin/hamcore/DriverPackages/Neo6_Win10/x86/Neo6_x86_VPN14.inf b/src/bin/hamcore/DriverPackages/Neo6_Win10/x86/Neo6_x86_VPN14.inf index ede46ddc..c538c9d5 100644 --- a/src/bin/hamcore/DriverPackages/Neo6_Win10/x86/Neo6_x86_VPN14.inf +++ b/src/bin/hamcore/DriverPackages/Neo6_Win10/x86/Neo6_x86_VPN14.inf @@ -1,114 +1,114 @@ -; VPN Client Device Driver for Windows 2000 and Greater -; -; Copyright (c) SoftEther Corporation. All Rights Reserved. -; http://www.softether.co.jp/ -; -; BUILD 9658 - -[Version] -Signature = "$Windows NT$" -Class = Net -ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} -Provider = %CompanyName% -DriverVer = 02/04/2018, 4.25.0.9658 -CatalogFile.NT = Neo6_x86_VPN14.cat - -[Manufacturer] -%CompanyName% = SoftEther - -[SourceDisksNames] -1=%DiskDescription%, "", , - -[SourceDisksFiles] -Neo6_x86_VPN14.sys = 1 - -[DestinationDirs] -DefaultDestDir = 12 -Neo.CopyFiles.Sys = 12 - -[Neo.CopyFiles.Sys] -Neo6_x86_VPN14.sys, , , 2 - -[SoftEther] -%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN14 - -[NeoAdapter.Install] -Characteristics = 0x1 -AddReg = Neo.Reg, NeoAdapter.Ndi -CopyFiles = Neo.CopyFiles.Sys -*IfType = 53 -*MediaType = 0 -*PhysicalMediaType = 0 - -[NeoAdapter.Install.Services] -AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% - -[NeoAdapter.Ndi] -HKR, , NetworkAddress, 0, %DefaultAddress% -HKR, Ndi, DeviceID, , "NeoAdapter_VPN14" -HKR, , DevLoader, , ndis -HKR, , DeviceVxDs, , Neo6_x86_VPN14.sys -HKR, NDIS, LogDriverName, , "Neo_VPN14" -HKR, NDIS, MajorNdisVersion, 1, 5 -HKR, NDIS, MinorNdisVersion, 1, 0 -HKR, Ndi\Interfaces, DefUpper, , "ndis5" -HKR, Ndi\Interfaces, UpperRange, , "ndis5" -HKR, Ndi\Interfaces, LowerRange, , "ethernet" -HKR, Ndi\Interfaces, DefLower, , "ethernet" -HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" -HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% -HKR, Ndi\Params\NetworkAddress, type, 0, "edit" -HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" -HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" -HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% -HKR, Ndi\Params\NetworkAddress, optional, 0, "0" -HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% -HKR, Ndi\Params\MaxSpeed, type, 0, "int" -HKR, Ndi\Params\MaxSpeed, default, 0, "100" -HKR, Ndi\Params\MaxSpeed, min, 0, "0" -HKR, Ndi\Params\MaxSpeed, max, 0, "2000" -HKR, Ndi\Params\MaxSpeed, step, 0, "1" -HKR, Ndi\Params\MaxSpeed, Base, 0, "10" -HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% -HKR, Ndi\Params\KeepLink, type, 0, "enum" -HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% -HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% -HKR, Ndi\Params\KeepLink, default, 0, "0" - - -[Neo.Service] -DisplayName = %Neo.Service.DispName% -Description = %Neo.Service.Desc% -ServiceType = 1 -StartType = 3 -ErrorControl = 1 -ServiceBinary = %12%\Neo6_x86_VPN14.sys -LoadOrderGroup = NDIS - -[Neo.Reg] -HKR, Ndi, Service, 0, Neo.Service.Name -HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" -HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" - -[Neo.EventLog] -HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN14.sys" -HKR, , TypesSupported, 0x00010001, 7 - -[Strings] -CompanyName = "SoftEther Corporation" -DiskDescription = "VPN Client Device Driver Install Disk" -Neo.Service.Name = "Neo_VPN14" -Neo.Service.DispName = "VPN Client Device Driver - VPN14" -Neo.Service.Desc = "VPN Client Adapter - VPN14" -NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN14" -Neo.EventLog.Name = "Neo" -NetworkAddress = "MAC Address" -DefaultAddress = "000001000001" -MaxSpeed = "Indicate Speed (Mbps)" -KeepLink = "Keep Link" -On = "On" -Off = "Off" - - -; Auto Generated 20180205_163613.258 - +; VPN Client Device Driver for Windows 2000 and Greater +; +; Copyright (c) SoftEther Corporation. All Rights Reserved. +; http://www.softether.co.jp/ +; +; BUILD 9658 + +[Version] +Signature = "$Windows NT$" +Class = Net +ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} +Provider = %CompanyName% +DriverVer = 02/04/2018, 4.25.0.9658 +CatalogFile.NT = Neo6_x86_VPN14.cat + +[Manufacturer] +%CompanyName% = SoftEther + +[SourceDisksNames] +1=%DiskDescription%, "", , + +[SourceDisksFiles] +Neo6_x86_VPN14.sys = 1 + +[DestinationDirs] +DefaultDestDir = 12 +Neo.CopyFiles.Sys = 12 + +[Neo.CopyFiles.Sys] +Neo6_x86_VPN14.sys, , , 2 + +[SoftEther] +%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN14 + +[NeoAdapter.Install] +Characteristics = 0x1 +AddReg = Neo.Reg, NeoAdapter.Ndi +CopyFiles = Neo.CopyFiles.Sys +*IfType = 53 +*MediaType = 0 +*PhysicalMediaType = 0 + +[NeoAdapter.Install.Services] +AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% + +[NeoAdapter.Ndi] +HKR, , NetworkAddress, 0, %DefaultAddress% +HKR, Ndi, DeviceID, , "NeoAdapter_VPN14" +HKR, , DevLoader, , ndis +HKR, , DeviceVxDs, , Neo6_x86_VPN14.sys +HKR, NDIS, LogDriverName, , "Neo_VPN14" +HKR, NDIS, MajorNdisVersion, 1, 5 +HKR, NDIS, MinorNdisVersion, 1, 0 +HKR, Ndi\Interfaces, DefUpper, , "ndis5" +HKR, Ndi\Interfaces, UpperRange, , "ndis5" +HKR, Ndi\Interfaces, LowerRange, , "ethernet" +HKR, Ndi\Interfaces, DefLower, , "ethernet" +HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" +HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% +HKR, Ndi\Params\NetworkAddress, type, 0, "edit" +HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" +HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" +HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% +HKR, Ndi\Params\NetworkAddress, optional, 0, "0" +HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% +HKR, Ndi\Params\MaxSpeed, type, 0, "int" +HKR, Ndi\Params\MaxSpeed, default, 0, "100" +HKR, Ndi\Params\MaxSpeed, min, 0, "0" +HKR, Ndi\Params\MaxSpeed, max, 0, "2000" +HKR, Ndi\Params\MaxSpeed, step, 0, "1" +HKR, Ndi\Params\MaxSpeed, Base, 0, "10" +HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% +HKR, Ndi\Params\KeepLink, type, 0, "enum" +HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% +HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% +HKR, Ndi\Params\KeepLink, default, 0, "0" + + +[Neo.Service] +DisplayName = %Neo.Service.DispName% +Description = %Neo.Service.Desc% +ServiceType = 1 +StartType = 3 +ErrorControl = 1 +ServiceBinary = %12%\Neo6_x86_VPN14.sys +LoadOrderGroup = NDIS + +[Neo.Reg] +HKR, Ndi, Service, 0, Neo.Service.Name +HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" +HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" + +[Neo.EventLog] +HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN14.sys" +HKR, , TypesSupported, 0x00010001, 7 + +[Strings] +CompanyName = "SoftEther Corporation" +DiskDescription = "VPN Client Device Driver Install Disk" +Neo.Service.Name = "Neo_VPN14" +Neo.Service.DispName = "VPN Client Device Driver - VPN14" +Neo.Service.Desc = "VPN Client Adapter - VPN14" +NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN14" +Neo.EventLog.Name = "Neo" +NetworkAddress = "MAC Address" +DefaultAddress = "000001000001" +MaxSpeed = "Indicate Speed (Mbps)" +KeepLink = "Keep Link" +On = "On" +Off = "Off" + + +; Auto Generated 20180205_163613.258 + diff --git a/src/bin/hamcore/DriverPackages/Neo6_Win10/x86/Neo6_x86_VPN15.inf b/src/bin/hamcore/DriverPackages/Neo6_Win10/x86/Neo6_x86_VPN15.inf index 215781c5..72115238 100644 --- a/src/bin/hamcore/DriverPackages/Neo6_Win10/x86/Neo6_x86_VPN15.inf +++ b/src/bin/hamcore/DriverPackages/Neo6_Win10/x86/Neo6_x86_VPN15.inf @@ -1,114 +1,114 @@ -; VPN Client Device Driver for Windows 2000 and Greater -; -; Copyright (c) SoftEther Corporation. All Rights Reserved. -; http://www.softether.co.jp/ -; -; BUILD 9658 - -[Version] -Signature = "$Windows NT$" -Class = Net -ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} -Provider = %CompanyName% -DriverVer = 02/04/2018, 4.25.0.9658 -CatalogFile.NT = Neo6_x86_VPN15.cat - -[Manufacturer] -%CompanyName% = SoftEther - -[SourceDisksNames] -1=%DiskDescription%, "", , - -[SourceDisksFiles] -Neo6_x86_VPN15.sys = 1 - -[DestinationDirs] -DefaultDestDir = 12 -Neo.CopyFiles.Sys = 12 - -[Neo.CopyFiles.Sys] -Neo6_x86_VPN15.sys, , , 2 - -[SoftEther] -%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN15 - -[NeoAdapter.Install] -Characteristics = 0x1 -AddReg = Neo.Reg, NeoAdapter.Ndi -CopyFiles = Neo.CopyFiles.Sys -*IfType = 53 -*MediaType = 0 -*PhysicalMediaType = 0 - -[NeoAdapter.Install.Services] -AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% - -[NeoAdapter.Ndi] -HKR, , NetworkAddress, 0, %DefaultAddress% -HKR, Ndi, DeviceID, , "NeoAdapter_VPN15" -HKR, , DevLoader, , ndis -HKR, , DeviceVxDs, , Neo6_x86_VPN15.sys -HKR, NDIS, LogDriverName, , "Neo_VPN15" -HKR, NDIS, MajorNdisVersion, 1, 5 -HKR, NDIS, MinorNdisVersion, 1, 0 -HKR, Ndi\Interfaces, DefUpper, , "ndis5" -HKR, Ndi\Interfaces, UpperRange, , "ndis5" -HKR, Ndi\Interfaces, LowerRange, , "ethernet" -HKR, Ndi\Interfaces, DefLower, , "ethernet" -HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" -HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% -HKR, Ndi\Params\NetworkAddress, type, 0, "edit" -HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" -HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" -HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% -HKR, Ndi\Params\NetworkAddress, optional, 0, "0" -HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% -HKR, Ndi\Params\MaxSpeed, type, 0, "int" -HKR, Ndi\Params\MaxSpeed, default, 0, "100" -HKR, Ndi\Params\MaxSpeed, min, 0, "0" -HKR, Ndi\Params\MaxSpeed, max, 0, "2000" -HKR, Ndi\Params\MaxSpeed, step, 0, "1" -HKR, Ndi\Params\MaxSpeed, Base, 0, "10" -HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% -HKR, Ndi\Params\KeepLink, type, 0, "enum" -HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% -HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% -HKR, Ndi\Params\KeepLink, default, 0, "0" - - -[Neo.Service] -DisplayName = %Neo.Service.DispName% -Description = %Neo.Service.Desc% -ServiceType = 1 -StartType = 3 -ErrorControl = 1 -ServiceBinary = %12%\Neo6_x86_VPN15.sys -LoadOrderGroup = NDIS - -[Neo.Reg] -HKR, Ndi, Service, 0, Neo.Service.Name -HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" -HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" - -[Neo.EventLog] -HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN15.sys" -HKR, , TypesSupported, 0x00010001, 7 - -[Strings] -CompanyName = "SoftEther Corporation" -DiskDescription = "VPN Client Device Driver Install Disk" -Neo.Service.Name = "Neo_VPN15" -Neo.Service.DispName = "VPN Client Device Driver - VPN15" -Neo.Service.Desc = "VPN Client Adapter - VPN15" -NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN15" -Neo.EventLog.Name = "Neo" -NetworkAddress = "MAC Address" -DefaultAddress = "000001000001" -MaxSpeed = "Indicate Speed (Mbps)" -KeepLink = "Keep Link" -On = "On" -Off = "Off" - - -; Auto Generated 20180205_163613.330 - +; VPN Client Device Driver for Windows 2000 and Greater +; +; Copyright (c) SoftEther Corporation. All Rights Reserved. +; http://www.softether.co.jp/ +; +; BUILD 9658 + +[Version] +Signature = "$Windows NT$" +Class = Net +ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} +Provider = %CompanyName% +DriverVer = 02/04/2018, 4.25.0.9658 +CatalogFile.NT = Neo6_x86_VPN15.cat + +[Manufacturer] +%CompanyName% = SoftEther + +[SourceDisksNames] +1=%DiskDescription%, "", , + +[SourceDisksFiles] +Neo6_x86_VPN15.sys = 1 + +[DestinationDirs] +DefaultDestDir = 12 +Neo.CopyFiles.Sys = 12 + +[Neo.CopyFiles.Sys] +Neo6_x86_VPN15.sys, , , 2 + +[SoftEther] +%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN15 + +[NeoAdapter.Install] +Characteristics = 0x1 +AddReg = Neo.Reg, NeoAdapter.Ndi +CopyFiles = Neo.CopyFiles.Sys +*IfType = 53 +*MediaType = 0 +*PhysicalMediaType = 0 + +[NeoAdapter.Install.Services] +AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% + +[NeoAdapter.Ndi] +HKR, , NetworkAddress, 0, %DefaultAddress% +HKR, Ndi, DeviceID, , "NeoAdapter_VPN15" +HKR, , DevLoader, , ndis +HKR, , DeviceVxDs, , Neo6_x86_VPN15.sys +HKR, NDIS, LogDriverName, , "Neo_VPN15" +HKR, NDIS, MajorNdisVersion, 1, 5 +HKR, NDIS, MinorNdisVersion, 1, 0 +HKR, Ndi\Interfaces, DefUpper, , "ndis5" +HKR, Ndi\Interfaces, UpperRange, , "ndis5" +HKR, Ndi\Interfaces, LowerRange, , "ethernet" +HKR, Ndi\Interfaces, DefLower, , "ethernet" +HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" +HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% +HKR, Ndi\Params\NetworkAddress, type, 0, "edit" +HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" +HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" +HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% +HKR, Ndi\Params\NetworkAddress, optional, 0, "0" +HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% +HKR, Ndi\Params\MaxSpeed, type, 0, "int" +HKR, Ndi\Params\MaxSpeed, default, 0, "100" +HKR, Ndi\Params\MaxSpeed, min, 0, "0" +HKR, Ndi\Params\MaxSpeed, max, 0, "2000" +HKR, Ndi\Params\MaxSpeed, step, 0, "1" +HKR, Ndi\Params\MaxSpeed, Base, 0, "10" +HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% +HKR, Ndi\Params\KeepLink, type, 0, "enum" +HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% +HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% +HKR, Ndi\Params\KeepLink, default, 0, "0" + + +[Neo.Service] +DisplayName = %Neo.Service.DispName% +Description = %Neo.Service.Desc% +ServiceType = 1 +StartType = 3 +ErrorControl = 1 +ServiceBinary = %12%\Neo6_x86_VPN15.sys +LoadOrderGroup = NDIS + +[Neo.Reg] +HKR, Ndi, Service, 0, Neo.Service.Name +HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" +HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" + +[Neo.EventLog] +HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN15.sys" +HKR, , TypesSupported, 0x00010001, 7 + +[Strings] +CompanyName = "SoftEther Corporation" +DiskDescription = "VPN Client Device Driver Install Disk" +Neo.Service.Name = "Neo_VPN15" +Neo.Service.DispName = "VPN Client Device Driver - VPN15" +Neo.Service.Desc = "VPN Client Adapter - VPN15" +NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN15" +Neo.EventLog.Name = "Neo" +NetworkAddress = "MAC Address" +DefaultAddress = "000001000001" +MaxSpeed = "Indicate Speed (Mbps)" +KeepLink = "Keep Link" +On = "On" +Off = "Off" + + +; Auto Generated 20180205_163613.330 + diff --git a/src/bin/hamcore/DriverPackages/Neo6_Win10/x86/Neo6_x86_VPN16.inf b/src/bin/hamcore/DriverPackages/Neo6_Win10/x86/Neo6_x86_VPN16.inf index 9e096a95..67e9344d 100644 --- a/src/bin/hamcore/DriverPackages/Neo6_Win10/x86/Neo6_x86_VPN16.inf +++ b/src/bin/hamcore/DriverPackages/Neo6_Win10/x86/Neo6_x86_VPN16.inf @@ -1,114 +1,114 @@ -; VPN Client Device Driver for Windows 2000 and Greater -; -; Copyright (c) SoftEther Corporation. All Rights Reserved. -; http://www.softether.co.jp/ -; -; BUILD 9658 - -[Version] -Signature = "$Windows NT$" -Class = Net -ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} -Provider = %CompanyName% -DriverVer = 02/04/2018, 4.25.0.9658 -CatalogFile.NT = Neo6_x86_VPN16.cat - -[Manufacturer] -%CompanyName% = SoftEther - -[SourceDisksNames] -1=%DiskDescription%, "", , - -[SourceDisksFiles] -Neo6_x86_VPN16.sys = 1 - -[DestinationDirs] -DefaultDestDir = 12 -Neo.CopyFiles.Sys = 12 - -[Neo.CopyFiles.Sys] -Neo6_x86_VPN16.sys, , , 2 - -[SoftEther] -%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN16 - -[NeoAdapter.Install] -Characteristics = 0x1 -AddReg = Neo.Reg, NeoAdapter.Ndi -CopyFiles = Neo.CopyFiles.Sys -*IfType = 53 -*MediaType = 0 -*PhysicalMediaType = 0 - -[NeoAdapter.Install.Services] -AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% - -[NeoAdapter.Ndi] -HKR, , NetworkAddress, 0, %DefaultAddress% -HKR, Ndi, DeviceID, , "NeoAdapter_VPN16" -HKR, , DevLoader, , ndis -HKR, , DeviceVxDs, , Neo6_x86_VPN16.sys -HKR, NDIS, LogDriverName, , "Neo_VPN16" -HKR, NDIS, MajorNdisVersion, 1, 5 -HKR, NDIS, MinorNdisVersion, 1, 0 -HKR, Ndi\Interfaces, DefUpper, , "ndis5" -HKR, Ndi\Interfaces, UpperRange, , "ndis5" -HKR, Ndi\Interfaces, LowerRange, , "ethernet" -HKR, Ndi\Interfaces, DefLower, , "ethernet" -HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" -HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% -HKR, Ndi\Params\NetworkAddress, type, 0, "edit" -HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" -HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" -HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% -HKR, Ndi\Params\NetworkAddress, optional, 0, "0" -HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% -HKR, Ndi\Params\MaxSpeed, type, 0, "int" -HKR, Ndi\Params\MaxSpeed, default, 0, "100" -HKR, Ndi\Params\MaxSpeed, min, 0, "0" -HKR, Ndi\Params\MaxSpeed, max, 0, "2000" -HKR, Ndi\Params\MaxSpeed, step, 0, "1" -HKR, Ndi\Params\MaxSpeed, Base, 0, "10" -HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% -HKR, Ndi\Params\KeepLink, type, 0, "enum" -HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% -HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% -HKR, Ndi\Params\KeepLink, default, 0, "0" - - -[Neo.Service] -DisplayName = %Neo.Service.DispName% -Description = %Neo.Service.Desc% -ServiceType = 1 -StartType = 3 -ErrorControl = 1 -ServiceBinary = %12%\Neo6_x86_VPN16.sys -LoadOrderGroup = NDIS - -[Neo.Reg] -HKR, Ndi, Service, 0, Neo.Service.Name -HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" -HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" - -[Neo.EventLog] -HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN16.sys" -HKR, , TypesSupported, 0x00010001, 7 - -[Strings] -CompanyName = "SoftEther Corporation" -DiskDescription = "VPN Client Device Driver Install Disk" -Neo.Service.Name = "Neo_VPN16" -Neo.Service.DispName = "VPN Client Device Driver - VPN16" -Neo.Service.Desc = "VPN Client Adapter - VPN16" -NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN16" -Neo.EventLog.Name = "Neo" -NetworkAddress = "MAC Address" -DefaultAddress = "000001000001" -MaxSpeed = "Indicate Speed (Mbps)" -KeepLink = "Keep Link" -On = "On" -Off = "Off" - - -; Auto Generated 20180205_163613.400 - +; VPN Client Device Driver for Windows 2000 and Greater +; +; Copyright (c) SoftEther Corporation. All Rights Reserved. +; http://www.softether.co.jp/ +; +; BUILD 9658 + +[Version] +Signature = "$Windows NT$" +Class = Net +ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} +Provider = %CompanyName% +DriverVer = 02/04/2018, 4.25.0.9658 +CatalogFile.NT = Neo6_x86_VPN16.cat + +[Manufacturer] +%CompanyName% = SoftEther + +[SourceDisksNames] +1=%DiskDescription%, "", , + +[SourceDisksFiles] +Neo6_x86_VPN16.sys = 1 + +[DestinationDirs] +DefaultDestDir = 12 +Neo.CopyFiles.Sys = 12 + +[Neo.CopyFiles.Sys] +Neo6_x86_VPN16.sys, , , 2 + +[SoftEther] +%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN16 + +[NeoAdapter.Install] +Characteristics = 0x1 +AddReg = Neo.Reg, NeoAdapter.Ndi +CopyFiles = Neo.CopyFiles.Sys +*IfType = 53 +*MediaType = 0 +*PhysicalMediaType = 0 + +[NeoAdapter.Install.Services] +AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% + +[NeoAdapter.Ndi] +HKR, , NetworkAddress, 0, %DefaultAddress% +HKR, Ndi, DeviceID, , "NeoAdapter_VPN16" +HKR, , DevLoader, , ndis +HKR, , DeviceVxDs, , Neo6_x86_VPN16.sys +HKR, NDIS, LogDriverName, , "Neo_VPN16" +HKR, NDIS, MajorNdisVersion, 1, 5 +HKR, NDIS, MinorNdisVersion, 1, 0 +HKR, Ndi\Interfaces, DefUpper, , "ndis5" +HKR, Ndi\Interfaces, UpperRange, , "ndis5" +HKR, Ndi\Interfaces, LowerRange, , "ethernet" +HKR, Ndi\Interfaces, DefLower, , "ethernet" +HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" +HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% +HKR, Ndi\Params\NetworkAddress, type, 0, "edit" +HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" +HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" +HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% +HKR, Ndi\Params\NetworkAddress, optional, 0, "0" +HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% +HKR, Ndi\Params\MaxSpeed, type, 0, "int" +HKR, Ndi\Params\MaxSpeed, default, 0, "100" +HKR, Ndi\Params\MaxSpeed, min, 0, "0" +HKR, Ndi\Params\MaxSpeed, max, 0, "2000" +HKR, Ndi\Params\MaxSpeed, step, 0, "1" +HKR, Ndi\Params\MaxSpeed, Base, 0, "10" +HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% +HKR, Ndi\Params\KeepLink, type, 0, "enum" +HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% +HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% +HKR, Ndi\Params\KeepLink, default, 0, "0" + + +[Neo.Service] +DisplayName = %Neo.Service.DispName% +Description = %Neo.Service.Desc% +ServiceType = 1 +StartType = 3 +ErrorControl = 1 +ServiceBinary = %12%\Neo6_x86_VPN16.sys +LoadOrderGroup = NDIS + +[Neo.Reg] +HKR, Ndi, Service, 0, Neo.Service.Name +HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" +HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" + +[Neo.EventLog] +HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN16.sys" +HKR, , TypesSupported, 0x00010001, 7 + +[Strings] +CompanyName = "SoftEther Corporation" +DiskDescription = "VPN Client Device Driver Install Disk" +Neo.Service.Name = "Neo_VPN16" +Neo.Service.DispName = "VPN Client Device Driver - VPN16" +Neo.Service.Desc = "VPN Client Adapter - VPN16" +NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN16" +Neo.EventLog.Name = "Neo" +NetworkAddress = "MAC Address" +DefaultAddress = "000001000001" +MaxSpeed = "Indicate Speed (Mbps)" +KeepLink = "Keep Link" +On = "On" +Off = "Off" + + +; Auto Generated 20180205_163613.400 + diff --git a/src/bin/hamcore/DriverPackages/Neo6_Win10/x86/Neo6_x86_VPN17.inf b/src/bin/hamcore/DriverPackages/Neo6_Win10/x86/Neo6_x86_VPN17.inf index b5d72e5c..54f9b2ae 100644 --- a/src/bin/hamcore/DriverPackages/Neo6_Win10/x86/Neo6_x86_VPN17.inf +++ b/src/bin/hamcore/DriverPackages/Neo6_Win10/x86/Neo6_x86_VPN17.inf @@ -1,114 +1,114 @@ -; VPN Client Device Driver for Windows 2000 and Greater -; -; Copyright (c) SoftEther Corporation. All Rights Reserved. -; http://www.softether.co.jp/ -; -; BUILD 9658 - -[Version] -Signature = "$Windows NT$" -Class = Net -ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} -Provider = %CompanyName% -DriverVer = 02/04/2018, 4.25.0.9658 -CatalogFile.NT = Neo6_x86_VPN17.cat - -[Manufacturer] -%CompanyName% = SoftEther - -[SourceDisksNames] -1=%DiskDescription%, "", , - -[SourceDisksFiles] -Neo6_x86_VPN17.sys = 1 - -[DestinationDirs] -DefaultDestDir = 12 -Neo.CopyFiles.Sys = 12 - -[Neo.CopyFiles.Sys] -Neo6_x86_VPN17.sys, , , 2 - -[SoftEther] -%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN17 - -[NeoAdapter.Install] -Characteristics = 0x1 -AddReg = Neo.Reg, NeoAdapter.Ndi -CopyFiles = Neo.CopyFiles.Sys -*IfType = 53 -*MediaType = 0 -*PhysicalMediaType = 0 - -[NeoAdapter.Install.Services] -AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% - -[NeoAdapter.Ndi] -HKR, , NetworkAddress, 0, %DefaultAddress% -HKR, Ndi, DeviceID, , "NeoAdapter_VPN17" -HKR, , DevLoader, , ndis -HKR, , DeviceVxDs, , Neo6_x86_VPN17.sys -HKR, NDIS, LogDriverName, , "Neo_VPN17" -HKR, NDIS, MajorNdisVersion, 1, 5 -HKR, NDIS, MinorNdisVersion, 1, 0 -HKR, Ndi\Interfaces, DefUpper, , "ndis5" -HKR, Ndi\Interfaces, UpperRange, , "ndis5" -HKR, Ndi\Interfaces, LowerRange, , "ethernet" -HKR, Ndi\Interfaces, DefLower, , "ethernet" -HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" -HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% -HKR, Ndi\Params\NetworkAddress, type, 0, "edit" -HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" -HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" -HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% -HKR, Ndi\Params\NetworkAddress, optional, 0, "0" -HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% -HKR, Ndi\Params\MaxSpeed, type, 0, "int" -HKR, Ndi\Params\MaxSpeed, default, 0, "100" -HKR, Ndi\Params\MaxSpeed, min, 0, "0" -HKR, Ndi\Params\MaxSpeed, max, 0, "2000" -HKR, Ndi\Params\MaxSpeed, step, 0, "1" -HKR, Ndi\Params\MaxSpeed, Base, 0, "10" -HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% -HKR, Ndi\Params\KeepLink, type, 0, "enum" -HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% -HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% -HKR, Ndi\Params\KeepLink, default, 0, "0" - - -[Neo.Service] -DisplayName = %Neo.Service.DispName% -Description = %Neo.Service.Desc% -ServiceType = 1 -StartType = 3 -ErrorControl = 1 -ServiceBinary = %12%\Neo6_x86_VPN17.sys -LoadOrderGroup = NDIS - -[Neo.Reg] -HKR, Ndi, Service, 0, Neo.Service.Name -HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" -HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" - -[Neo.EventLog] -HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN17.sys" -HKR, , TypesSupported, 0x00010001, 7 - -[Strings] -CompanyName = "SoftEther Corporation" -DiskDescription = "VPN Client Device Driver Install Disk" -Neo.Service.Name = "Neo_VPN17" -Neo.Service.DispName = "VPN Client Device Driver - VPN17" -Neo.Service.Desc = "VPN Client Adapter - VPN17" -NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN17" -Neo.EventLog.Name = "Neo" -NetworkAddress = "MAC Address" -DefaultAddress = "000001000001" -MaxSpeed = "Indicate Speed (Mbps)" -KeepLink = "Keep Link" -On = "On" -Off = "Off" - - -; Auto Generated 20180205_163613.471 - +; VPN Client Device Driver for Windows 2000 and Greater +; +; Copyright (c) SoftEther Corporation. All Rights Reserved. +; http://www.softether.co.jp/ +; +; BUILD 9658 + +[Version] +Signature = "$Windows NT$" +Class = Net +ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} +Provider = %CompanyName% +DriverVer = 02/04/2018, 4.25.0.9658 +CatalogFile.NT = Neo6_x86_VPN17.cat + +[Manufacturer] +%CompanyName% = SoftEther + +[SourceDisksNames] +1=%DiskDescription%, "", , + +[SourceDisksFiles] +Neo6_x86_VPN17.sys = 1 + +[DestinationDirs] +DefaultDestDir = 12 +Neo.CopyFiles.Sys = 12 + +[Neo.CopyFiles.Sys] +Neo6_x86_VPN17.sys, , , 2 + +[SoftEther] +%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN17 + +[NeoAdapter.Install] +Characteristics = 0x1 +AddReg = Neo.Reg, NeoAdapter.Ndi +CopyFiles = Neo.CopyFiles.Sys +*IfType = 53 +*MediaType = 0 +*PhysicalMediaType = 0 + +[NeoAdapter.Install.Services] +AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% + +[NeoAdapter.Ndi] +HKR, , NetworkAddress, 0, %DefaultAddress% +HKR, Ndi, DeviceID, , "NeoAdapter_VPN17" +HKR, , DevLoader, , ndis +HKR, , DeviceVxDs, , Neo6_x86_VPN17.sys +HKR, NDIS, LogDriverName, , "Neo_VPN17" +HKR, NDIS, MajorNdisVersion, 1, 5 +HKR, NDIS, MinorNdisVersion, 1, 0 +HKR, Ndi\Interfaces, DefUpper, , "ndis5" +HKR, Ndi\Interfaces, UpperRange, , "ndis5" +HKR, Ndi\Interfaces, LowerRange, , "ethernet" +HKR, Ndi\Interfaces, DefLower, , "ethernet" +HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" +HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% +HKR, Ndi\Params\NetworkAddress, type, 0, "edit" +HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" +HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" +HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% +HKR, Ndi\Params\NetworkAddress, optional, 0, "0" +HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% +HKR, Ndi\Params\MaxSpeed, type, 0, "int" +HKR, Ndi\Params\MaxSpeed, default, 0, "100" +HKR, Ndi\Params\MaxSpeed, min, 0, "0" +HKR, Ndi\Params\MaxSpeed, max, 0, "2000" +HKR, Ndi\Params\MaxSpeed, step, 0, "1" +HKR, Ndi\Params\MaxSpeed, Base, 0, "10" +HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% +HKR, Ndi\Params\KeepLink, type, 0, "enum" +HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% +HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% +HKR, Ndi\Params\KeepLink, default, 0, "0" + + +[Neo.Service] +DisplayName = %Neo.Service.DispName% +Description = %Neo.Service.Desc% +ServiceType = 1 +StartType = 3 +ErrorControl = 1 +ServiceBinary = %12%\Neo6_x86_VPN17.sys +LoadOrderGroup = NDIS + +[Neo.Reg] +HKR, Ndi, Service, 0, Neo.Service.Name +HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" +HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" + +[Neo.EventLog] +HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN17.sys" +HKR, , TypesSupported, 0x00010001, 7 + +[Strings] +CompanyName = "SoftEther Corporation" +DiskDescription = "VPN Client Device Driver Install Disk" +Neo.Service.Name = "Neo_VPN17" +Neo.Service.DispName = "VPN Client Device Driver - VPN17" +Neo.Service.Desc = "VPN Client Adapter - VPN17" +NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN17" +Neo.EventLog.Name = "Neo" +NetworkAddress = "MAC Address" +DefaultAddress = "000001000001" +MaxSpeed = "Indicate Speed (Mbps)" +KeepLink = "Keep Link" +On = "On" +Off = "Off" + + +; Auto Generated 20180205_163613.471 + diff --git a/src/bin/hamcore/DriverPackages/Neo6_Win10/x86/Neo6_x86_VPN18.inf b/src/bin/hamcore/DriverPackages/Neo6_Win10/x86/Neo6_x86_VPN18.inf index 1f051b33..fd72f914 100644 --- a/src/bin/hamcore/DriverPackages/Neo6_Win10/x86/Neo6_x86_VPN18.inf +++ b/src/bin/hamcore/DriverPackages/Neo6_Win10/x86/Neo6_x86_VPN18.inf @@ -1,114 +1,114 @@ -; VPN Client Device Driver for Windows 2000 and Greater -; -; Copyright (c) SoftEther Corporation. All Rights Reserved. -; http://www.softether.co.jp/ -; -; BUILD 9658 - -[Version] -Signature = "$Windows NT$" -Class = Net -ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} -Provider = %CompanyName% -DriverVer = 02/04/2018, 4.25.0.9658 -CatalogFile.NT = Neo6_x86_VPN18.cat - -[Manufacturer] -%CompanyName% = SoftEther - -[SourceDisksNames] -1=%DiskDescription%, "", , - -[SourceDisksFiles] -Neo6_x86_VPN18.sys = 1 - -[DestinationDirs] -DefaultDestDir = 12 -Neo.CopyFiles.Sys = 12 - -[Neo.CopyFiles.Sys] -Neo6_x86_VPN18.sys, , , 2 - -[SoftEther] -%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN18 - -[NeoAdapter.Install] -Characteristics = 0x1 -AddReg = Neo.Reg, NeoAdapter.Ndi -CopyFiles = Neo.CopyFiles.Sys -*IfType = 53 -*MediaType = 0 -*PhysicalMediaType = 0 - -[NeoAdapter.Install.Services] -AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% - -[NeoAdapter.Ndi] -HKR, , NetworkAddress, 0, %DefaultAddress% -HKR, Ndi, DeviceID, , "NeoAdapter_VPN18" -HKR, , DevLoader, , ndis -HKR, , DeviceVxDs, , Neo6_x86_VPN18.sys -HKR, NDIS, LogDriverName, , "Neo_VPN18" -HKR, NDIS, MajorNdisVersion, 1, 5 -HKR, NDIS, MinorNdisVersion, 1, 0 -HKR, Ndi\Interfaces, DefUpper, , "ndis5" -HKR, Ndi\Interfaces, UpperRange, , "ndis5" -HKR, Ndi\Interfaces, LowerRange, , "ethernet" -HKR, Ndi\Interfaces, DefLower, , "ethernet" -HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" -HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% -HKR, Ndi\Params\NetworkAddress, type, 0, "edit" -HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" -HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" -HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% -HKR, Ndi\Params\NetworkAddress, optional, 0, "0" -HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% -HKR, Ndi\Params\MaxSpeed, type, 0, "int" -HKR, Ndi\Params\MaxSpeed, default, 0, "100" -HKR, Ndi\Params\MaxSpeed, min, 0, "0" -HKR, Ndi\Params\MaxSpeed, max, 0, "2000" -HKR, Ndi\Params\MaxSpeed, step, 0, "1" -HKR, Ndi\Params\MaxSpeed, Base, 0, "10" -HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% -HKR, Ndi\Params\KeepLink, type, 0, "enum" -HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% -HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% -HKR, Ndi\Params\KeepLink, default, 0, "0" - - -[Neo.Service] -DisplayName = %Neo.Service.DispName% -Description = %Neo.Service.Desc% -ServiceType = 1 -StartType = 3 -ErrorControl = 1 -ServiceBinary = %12%\Neo6_x86_VPN18.sys -LoadOrderGroup = NDIS - -[Neo.Reg] -HKR, Ndi, Service, 0, Neo.Service.Name -HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" -HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" - -[Neo.EventLog] -HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN18.sys" -HKR, , TypesSupported, 0x00010001, 7 - -[Strings] -CompanyName = "SoftEther Corporation" -DiskDescription = "VPN Client Device Driver Install Disk" -Neo.Service.Name = "Neo_VPN18" -Neo.Service.DispName = "VPN Client Device Driver - VPN18" -Neo.Service.Desc = "VPN Client Adapter - VPN18" -NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN18" -Neo.EventLog.Name = "Neo" -NetworkAddress = "MAC Address" -DefaultAddress = "000001000001" -MaxSpeed = "Indicate Speed (Mbps)" -KeepLink = "Keep Link" -On = "On" -Off = "Off" - - -; Auto Generated 20180205_163613.543 - +; VPN Client Device Driver for Windows 2000 and Greater +; +; Copyright (c) SoftEther Corporation. All Rights Reserved. +; http://www.softether.co.jp/ +; +; BUILD 9658 + +[Version] +Signature = "$Windows NT$" +Class = Net +ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} +Provider = %CompanyName% +DriverVer = 02/04/2018, 4.25.0.9658 +CatalogFile.NT = Neo6_x86_VPN18.cat + +[Manufacturer] +%CompanyName% = SoftEther + +[SourceDisksNames] +1=%DiskDescription%, "", , + +[SourceDisksFiles] +Neo6_x86_VPN18.sys = 1 + +[DestinationDirs] +DefaultDestDir = 12 +Neo.CopyFiles.Sys = 12 + +[Neo.CopyFiles.Sys] +Neo6_x86_VPN18.sys, , , 2 + +[SoftEther] +%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN18 + +[NeoAdapter.Install] +Characteristics = 0x1 +AddReg = Neo.Reg, NeoAdapter.Ndi +CopyFiles = Neo.CopyFiles.Sys +*IfType = 53 +*MediaType = 0 +*PhysicalMediaType = 0 + +[NeoAdapter.Install.Services] +AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% + +[NeoAdapter.Ndi] +HKR, , NetworkAddress, 0, %DefaultAddress% +HKR, Ndi, DeviceID, , "NeoAdapter_VPN18" +HKR, , DevLoader, , ndis +HKR, , DeviceVxDs, , Neo6_x86_VPN18.sys +HKR, NDIS, LogDriverName, , "Neo_VPN18" +HKR, NDIS, MajorNdisVersion, 1, 5 +HKR, NDIS, MinorNdisVersion, 1, 0 +HKR, Ndi\Interfaces, DefUpper, , "ndis5" +HKR, Ndi\Interfaces, UpperRange, , "ndis5" +HKR, Ndi\Interfaces, LowerRange, , "ethernet" +HKR, Ndi\Interfaces, DefLower, , "ethernet" +HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" +HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% +HKR, Ndi\Params\NetworkAddress, type, 0, "edit" +HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" +HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" +HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% +HKR, Ndi\Params\NetworkAddress, optional, 0, "0" +HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% +HKR, Ndi\Params\MaxSpeed, type, 0, "int" +HKR, Ndi\Params\MaxSpeed, default, 0, "100" +HKR, Ndi\Params\MaxSpeed, min, 0, "0" +HKR, Ndi\Params\MaxSpeed, max, 0, "2000" +HKR, Ndi\Params\MaxSpeed, step, 0, "1" +HKR, Ndi\Params\MaxSpeed, Base, 0, "10" +HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% +HKR, Ndi\Params\KeepLink, type, 0, "enum" +HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% +HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% +HKR, Ndi\Params\KeepLink, default, 0, "0" + + +[Neo.Service] +DisplayName = %Neo.Service.DispName% +Description = %Neo.Service.Desc% +ServiceType = 1 +StartType = 3 +ErrorControl = 1 +ServiceBinary = %12%\Neo6_x86_VPN18.sys +LoadOrderGroup = NDIS + +[Neo.Reg] +HKR, Ndi, Service, 0, Neo.Service.Name +HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" +HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" + +[Neo.EventLog] +HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN18.sys" +HKR, , TypesSupported, 0x00010001, 7 + +[Strings] +CompanyName = "SoftEther Corporation" +DiskDescription = "VPN Client Device Driver Install Disk" +Neo.Service.Name = "Neo_VPN18" +Neo.Service.DispName = "VPN Client Device Driver - VPN18" +Neo.Service.Desc = "VPN Client Adapter - VPN18" +NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN18" +Neo.EventLog.Name = "Neo" +NetworkAddress = "MAC Address" +DefaultAddress = "000001000001" +MaxSpeed = "Indicate Speed (Mbps)" +KeepLink = "Keep Link" +On = "On" +Off = "Off" + + +; Auto Generated 20180205_163613.543 + diff --git a/src/bin/hamcore/DriverPackages/Neo6_Win10/x86/Neo6_x86_VPN19.inf b/src/bin/hamcore/DriverPackages/Neo6_Win10/x86/Neo6_x86_VPN19.inf index d3aa8821..66546975 100644 --- a/src/bin/hamcore/DriverPackages/Neo6_Win10/x86/Neo6_x86_VPN19.inf +++ b/src/bin/hamcore/DriverPackages/Neo6_Win10/x86/Neo6_x86_VPN19.inf @@ -1,114 +1,114 @@ -; VPN Client Device Driver for Windows 2000 and Greater -; -; Copyright (c) SoftEther Corporation. All Rights Reserved. -; http://www.softether.co.jp/ -; -; BUILD 9658 - -[Version] -Signature = "$Windows NT$" -Class = Net -ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} -Provider = %CompanyName% -DriverVer = 02/04/2018, 4.25.0.9658 -CatalogFile.NT = Neo6_x86_VPN19.cat - -[Manufacturer] -%CompanyName% = SoftEther - -[SourceDisksNames] -1=%DiskDescription%, "", , - -[SourceDisksFiles] -Neo6_x86_VPN19.sys = 1 - -[DestinationDirs] -DefaultDestDir = 12 -Neo.CopyFiles.Sys = 12 - -[Neo.CopyFiles.Sys] -Neo6_x86_VPN19.sys, , , 2 - -[SoftEther] -%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN19 - -[NeoAdapter.Install] -Characteristics = 0x1 -AddReg = Neo.Reg, NeoAdapter.Ndi -CopyFiles = Neo.CopyFiles.Sys -*IfType = 53 -*MediaType = 0 -*PhysicalMediaType = 0 - -[NeoAdapter.Install.Services] -AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% - -[NeoAdapter.Ndi] -HKR, , NetworkAddress, 0, %DefaultAddress% -HKR, Ndi, DeviceID, , "NeoAdapter_VPN19" -HKR, , DevLoader, , ndis -HKR, , DeviceVxDs, , Neo6_x86_VPN19.sys -HKR, NDIS, LogDriverName, , "Neo_VPN19" -HKR, NDIS, MajorNdisVersion, 1, 5 -HKR, NDIS, MinorNdisVersion, 1, 0 -HKR, Ndi\Interfaces, DefUpper, , "ndis5" -HKR, Ndi\Interfaces, UpperRange, , "ndis5" -HKR, Ndi\Interfaces, LowerRange, , "ethernet" -HKR, Ndi\Interfaces, DefLower, , "ethernet" -HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" -HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% -HKR, Ndi\Params\NetworkAddress, type, 0, "edit" -HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" -HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" -HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% -HKR, Ndi\Params\NetworkAddress, optional, 0, "0" -HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% -HKR, Ndi\Params\MaxSpeed, type, 0, "int" -HKR, Ndi\Params\MaxSpeed, default, 0, "100" -HKR, Ndi\Params\MaxSpeed, min, 0, "0" -HKR, Ndi\Params\MaxSpeed, max, 0, "2000" -HKR, Ndi\Params\MaxSpeed, step, 0, "1" -HKR, Ndi\Params\MaxSpeed, Base, 0, "10" -HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% -HKR, Ndi\Params\KeepLink, type, 0, "enum" -HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% -HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% -HKR, Ndi\Params\KeepLink, default, 0, "0" - - -[Neo.Service] -DisplayName = %Neo.Service.DispName% -Description = %Neo.Service.Desc% -ServiceType = 1 -StartType = 3 -ErrorControl = 1 -ServiceBinary = %12%\Neo6_x86_VPN19.sys -LoadOrderGroup = NDIS - -[Neo.Reg] -HKR, Ndi, Service, 0, Neo.Service.Name -HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" -HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" - -[Neo.EventLog] -HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN19.sys" -HKR, , TypesSupported, 0x00010001, 7 - -[Strings] -CompanyName = "SoftEther Corporation" -DiskDescription = "VPN Client Device Driver Install Disk" -Neo.Service.Name = "Neo_VPN19" -Neo.Service.DispName = "VPN Client Device Driver - VPN19" -Neo.Service.Desc = "VPN Client Adapter - VPN19" -NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN19" -Neo.EventLog.Name = "Neo" -NetworkAddress = "MAC Address" -DefaultAddress = "000001000001" -MaxSpeed = "Indicate Speed (Mbps)" -KeepLink = "Keep Link" -On = "On" -Off = "Off" - - -; Auto Generated 20180205_163613.613 - +; VPN Client Device Driver for Windows 2000 and Greater +; +; Copyright (c) SoftEther Corporation. All Rights Reserved. +; http://www.softether.co.jp/ +; +; BUILD 9658 + +[Version] +Signature = "$Windows NT$" +Class = Net +ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} +Provider = %CompanyName% +DriverVer = 02/04/2018, 4.25.0.9658 +CatalogFile.NT = Neo6_x86_VPN19.cat + +[Manufacturer] +%CompanyName% = SoftEther + +[SourceDisksNames] +1=%DiskDescription%, "", , + +[SourceDisksFiles] +Neo6_x86_VPN19.sys = 1 + +[DestinationDirs] +DefaultDestDir = 12 +Neo.CopyFiles.Sys = 12 + +[Neo.CopyFiles.Sys] +Neo6_x86_VPN19.sys, , , 2 + +[SoftEther] +%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN19 + +[NeoAdapter.Install] +Characteristics = 0x1 +AddReg = Neo.Reg, NeoAdapter.Ndi +CopyFiles = Neo.CopyFiles.Sys +*IfType = 53 +*MediaType = 0 +*PhysicalMediaType = 0 + +[NeoAdapter.Install.Services] +AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% + +[NeoAdapter.Ndi] +HKR, , NetworkAddress, 0, %DefaultAddress% +HKR, Ndi, DeviceID, , "NeoAdapter_VPN19" +HKR, , DevLoader, , ndis +HKR, , DeviceVxDs, , Neo6_x86_VPN19.sys +HKR, NDIS, LogDriverName, , "Neo_VPN19" +HKR, NDIS, MajorNdisVersion, 1, 5 +HKR, NDIS, MinorNdisVersion, 1, 0 +HKR, Ndi\Interfaces, DefUpper, , "ndis5" +HKR, Ndi\Interfaces, UpperRange, , "ndis5" +HKR, Ndi\Interfaces, LowerRange, , "ethernet" +HKR, Ndi\Interfaces, DefLower, , "ethernet" +HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" +HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% +HKR, Ndi\Params\NetworkAddress, type, 0, "edit" +HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" +HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" +HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% +HKR, Ndi\Params\NetworkAddress, optional, 0, "0" +HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% +HKR, Ndi\Params\MaxSpeed, type, 0, "int" +HKR, Ndi\Params\MaxSpeed, default, 0, "100" +HKR, Ndi\Params\MaxSpeed, min, 0, "0" +HKR, Ndi\Params\MaxSpeed, max, 0, "2000" +HKR, Ndi\Params\MaxSpeed, step, 0, "1" +HKR, Ndi\Params\MaxSpeed, Base, 0, "10" +HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% +HKR, Ndi\Params\KeepLink, type, 0, "enum" +HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% +HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% +HKR, Ndi\Params\KeepLink, default, 0, "0" + + +[Neo.Service] +DisplayName = %Neo.Service.DispName% +Description = %Neo.Service.Desc% +ServiceType = 1 +StartType = 3 +ErrorControl = 1 +ServiceBinary = %12%\Neo6_x86_VPN19.sys +LoadOrderGroup = NDIS + +[Neo.Reg] +HKR, Ndi, Service, 0, Neo.Service.Name +HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" +HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" + +[Neo.EventLog] +HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN19.sys" +HKR, , TypesSupported, 0x00010001, 7 + +[Strings] +CompanyName = "SoftEther Corporation" +DiskDescription = "VPN Client Device Driver Install Disk" +Neo.Service.Name = "Neo_VPN19" +Neo.Service.DispName = "VPN Client Device Driver - VPN19" +Neo.Service.Desc = "VPN Client Adapter - VPN19" +NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN19" +Neo.EventLog.Name = "Neo" +NetworkAddress = "MAC Address" +DefaultAddress = "000001000001" +MaxSpeed = "Indicate Speed (Mbps)" +KeepLink = "Keep Link" +On = "On" +Off = "Off" + + +; Auto Generated 20180205_163613.613 + diff --git a/src/bin/hamcore/DriverPackages/Neo6_Win10/x86/Neo6_x86_VPN2.inf b/src/bin/hamcore/DriverPackages/Neo6_Win10/x86/Neo6_x86_VPN2.inf index 3a382164..3435cead 100644 --- a/src/bin/hamcore/DriverPackages/Neo6_Win10/x86/Neo6_x86_VPN2.inf +++ b/src/bin/hamcore/DriverPackages/Neo6_Win10/x86/Neo6_x86_VPN2.inf @@ -1,114 +1,114 @@ -; VPN Client Device Driver for Windows 2000 and Greater -; -; Copyright (c) SoftEther Corporation. All Rights Reserved. -; http://www.softether.co.jp/ -; -; BUILD 9658 - -[Version] -Signature = "$Windows NT$" -Class = Net -ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} -Provider = %CompanyName% -DriverVer = 02/04/2018, 4.25.0.9658 -CatalogFile.NT = Neo6_x86_VPN2.cat - -[Manufacturer] -%CompanyName% = SoftEther - -[SourceDisksNames] -1=%DiskDescription%, "", , - -[SourceDisksFiles] -Neo6_x86_VPN2.sys = 1 - -[DestinationDirs] -DefaultDestDir = 12 -Neo.CopyFiles.Sys = 12 - -[Neo.CopyFiles.Sys] -Neo6_x86_VPN2.sys, , , 2 - -[SoftEther] -%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN2 - -[NeoAdapter.Install] -Characteristics = 0x1 -AddReg = Neo.Reg, NeoAdapter.Ndi -CopyFiles = Neo.CopyFiles.Sys -*IfType = 53 -*MediaType = 0 -*PhysicalMediaType = 0 - -[NeoAdapter.Install.Services] -AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% - -[NeoAdapter.Ndi] -HKR, , NetworkAddress, 0, %DefaultAddress% -HKR, Ndi, DeviceID, , "NeoAdapter_VPN2" -HKR, , DevLoader, , ndis -HKR, , DeviceVxDs, , Neo6_x86_VPN2.sys -HKR, NDIS, LogDriverName, , "Neo_VPN2" -HKR, NDIS, MajorNdisVersion, 1, 5 -HKR, NDIS, MinorNdisVersion, 1, 0 -HKR, Ndi\Interfaces, DefUpper, , "ndis5" -HKR, Ndi\Interfaces, UpperRange, , "ndis5" -HKR, Ndi\Interfaces, LowerRange, , "ethernet" -HKR, Ndi\Interfaces, DefLower, , "ethernet" -HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" -HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% -HKR, Ndi\Params\NetworkAddress, type, 0, "edit" -HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" -HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" -HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% -HKR, Ndi\Params\NetworkAddress, optional, 0, "0" -HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% -HKR, Ndi\Params\MaxSpeed, type, 0, "int" -HKR, Ndi\Params\MaxSpeed, default, 0, "100" -HKR, Ndi\Params\MaxSpeed, min, 0, "0" -HKR, Ndi\Params\MaxSpeed, max, 0, "2000" -HKR, Ndi\Params\MaxSpeed, step, 0, "1" -HKR, Ndi\Params\MaxSpeed, Base, 0, "10" -HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% -HKR, Ndi\Params\KeepLink, type, 0, "enum" -HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% -HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% -HKR, Ndi\Params\KeepLink, default, 0, "0" - - -[Neo.Service] -DisplayName = %Neo.Service.DispName% -Description = %Neo.Service.Desc% -ServiceType = 1 -StartType = 3 -ErrorControl = 1 -ServiceBinary = %12%\Neo6_x86_VPN2.sys -LoadOrderGroup = NDIS - -[Neo.Reg] -HKR, Ndi, Service, 0, Neo.Service.Name -HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" -HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" - -[Neo.EventLog] -HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN2.sys" -HKR, , TypesSupported, 0x00010001, 7 - -[Strings] -CompanyName = "SoftEther Corporation" -DiskDescription = "VPN Client Device Driver Install Disk" -Neo.Service.Name = "Neo_VPN2" -Neo.Service.DispName = "VPN Client Device Driver - VPN2" -Neo.Service.Desc = "VPN Client Adapter - VPN2" -NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN2" -Neo.EventLog.Name = "Neo" -NetworkAddress = "MAC Address" -DefaultAddress = "000001000001" -MaxSpeed = "Indicate Speed (Mbps)" -KeepLink = "Keep Link" -On = "On" -Off = "Off" - - -; Auto Generated 20180205_163612.405 - +; VPN Client Device Driver for Windows 2000 and Greater +; +; Copyright (c) SoftEther Corporation. All Rights Reserved. +; http://www.softether.co.jp/ +; +; BUILD 9658 + +[Version] +Signature = "$Windows NT$" +Class = Net +ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} +Provider = %CompanyName% +DriverVer = 02/04/2018, 4.25.0.9658 +CatalogFile.NT = Neo6_x86_VPN2.cat + +[Manufacturer] +%CompanyName% = SoftEther + +[SourceDisksNames] +1=%DiskDescription%, "", , + +[SourceDisksFiles] +Neo6_x86_VPN2.sys = 1 + +[DestinationDirs] +DefaultDestDir = 12 +Neo.CopyFiles.Sys = 12 + +[Neo.CopyFiles.Sys] +Neo6_x86_VPN2.sys, , , 2 + +[SoftEther] +%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN2 + +[NeoAdapter.Install] +Characteristics = 0x1 +AddReg = Neo.Reg, NeoAdapter.Ndi +CopyFiles = Neo.CopyFiles.Sys +*IfType = 53 +*MediaType = 0 +*PhysicalMediaType = 0 + +[NeoAdapter.Install.Services] +AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% + +[NeoAdapter.Ndi] +HKR, , NetworkAddress, 0, %DefaultAddress% +HKR, Ndi, DeviceID, , "NeoAdapter_VPN2" +HKR, , DevLoader, , ndis +HKR, , DeviceVxDs, , Neo6_x86_VPN2.sys +HKR, NDIS, LogDriverName, , "Neo_VPN2" +HKR, NDIS, MajorNdisVersion, 1, 5 +HKR, NDIS, MinorNdisVersion, 1, 0 +HKR, Ndi\Interfaces, DefUpper, , "ndis5" +HKR, Ndi\Interfaces, UpperRange, , "ndis5" +HKR, Ndi\Interfaces, LowerRange, , "ethernet" +HKR, Ndi\Interfaces, DefLower, , "ethernet" +HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" +HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% +HKR, Ndi\Params\NetworkAddress, type, 0, "edit" +HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" +HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" +HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% +HKR, Ndi\Params\NetworkAddress, optional, 0, "0" +HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% +HKR, Ndi\Params\MaxSpeed, type, 0, "int" +HKR, Ndi\Params\MaxSpeed, default, 0, "100" +HKR, Ndi\Params\MaxSpeed, min, 0, "0" +HKR, Ndi\Params\MaxSpeed, max, 0, "2000" +HKR, Ndi\Params\MaxSpeed, step, 0, "1" +HKR, Ndi\Params\MaxSpeed, Base, 0, "10" +HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% +HKR, Ndi\Params\KeepLink, type, 0, "enum" +HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% +HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% +HKR, Ndi\Params\KeepLink, default, 0, "0" + + +[Neo.Service] +DisplayName = %Neo.Service.DispName% +Description = %Neo.Service.Desc% +ServiceType = 1 +StartType = 3 +ErrorControl = 1 +ServiceBinary = %12%\Neo6_x86_VPN2.sys +LoadOrderGroup = NDIS + +[Neo.Reg] +HKR, Ndi, Service, 0, Neo.Service.Name +HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" +HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" + +[Neo.EventLog] +HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN2.sys" +HKR, , TypesSupported, 0x00010001, 7 + +[Strings] +CompanyName = "SoftEther Corporation" +DiskDescription = "VPN Client Device Driver Install Disk" +Neo.Service.Name = "Neo_VPN2" +Neo.Service.DispName = "VPN Client Device Driver - VPN2" +Neo.Service.Desc = "VPN Client Adapter - VPN2" +NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN2" +Neo.EventLog.Name = "Neo" +NetworkAddress = "MAC Address" +DefaultAddress = "000001000001" +MaxSpeed = "Indicate Speed (Mbps)" +KeepLink = "Keep Link" +On = "On" +Off = "Off" + + +; Auto Generated 20180205_163612.405 + diff --git a/src/bin/hamcore/DriverPackages/Neo6_Win10/x86/Neo6_x86_VPN20.inf b/src/bin/hamcore/DriverPackages/Neo6_Win10/x86/Neo6_x86_VPN20.inf index 2e8c1998..4526dbf1 100644 --- a/src/bin/hamcore/DriverPackages/Neo6_Win10/x86/Neo6_x86_VPN20.inf +++ b/src/bin/hamcore/DriverPackages/Neo6_Win10/x86/Neo6_x86_VPN20.inf @@ -1,114 +1,114 @@ -; VPN Client Device Driver for Windows 2000 and Greater -; -; Copyright (c) SoftEther Corporation. All Rights Reserved. -; http://www.softether.co.jp/ -; -; BUILD 9658 - -[Version] -Signature = "$Windows NT$" -Class = Net -ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} -Provider = %CompanyName% -DriverVer = 02/04/2018, 4.25.0.9658 -CatalogFile.NT = Neo6_x86_VPN20.cat - -[Manufacturer] -%CompanyName% = SoftEther - -[SourceDisksNames] -1=%DiskDescription%, "", , - -[SourceDisksFiles] -Neo6_x86_VPN20.sys = 1 - -[DestinationDirs] -DefaultDestDir = 12 -Neo.CopyFiles.Sys = 12 - -[Neo.CopyFiles.Sys] -Neo6_x86_VPN20.sys, , , 2 - -[SoftEther] -%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN20 - -[NeoAdapter.Install] -Characteristics = 0x1 -AddReg = Neo.Reg, NeoAdapter.Ndi -CopyFiles = Neo.CopyFiles.Sys -*IfType = 53 -*MediaType = 0 -*PhysicalMediaType = 0 - -[NeoAdapter.Install.Services] -AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% - -[NeoAdapter.Ndi] -HKR, , NetworkAddress, 0, %DefaultAddress% -HKR, Ndi, DeviceID, , "NeoAdapter_VPN20" -HKR, , DevLoader, , ndis -HKR, , DeviceVxDs, , Neo6_x86_VPN20.sys -HKR, NDIS, LogDriverName, , "Neo_VPN20" -HKR, NDIS, MajorNdisVersion, 1, 5 -HKR, NDIS, MinorNdisVersion, 1, 0 -HKR, Ndi\Interfaces, DefUpper, , "ndis5" -HKR, Ndi\Interfaces, UpperRange, , "ndis5" -HKR, Ndi\Interfaces, LowerRange, , "ethernet" -HKR, Ndi\Interfaces, DefLower, , "ethernet" -HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" -HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% -HKR, Ndi\Params\NetworkAddress, type, 0, "edit" -HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" -HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" -HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% -HKR, Ndi\Params\NetworkAddress, optional, 0, "0" -HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% -HKR, Ndi\Params\MaxSpeed, type, 0, "int" -HKR, Ndi\Params\MaxSpeed, default, 0, "100" -HKR, Ndi\Params\MaxSpeed, min, 0, "0" -HKR, Ndi\Params\MaxSpeed, max, 0, "2000" -HKR, Ndi\Params\MaxSpeed, step, 0, "1" -HKR, Ndi\Params\MaxSpeed, Base, 0, "10" -HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% -HKR, Ndi\Params\KeepLink, type, 0, "enum" -HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% -HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% -HKR, Ndi\Params\KeepLink, default, 0, "0" - - -[Neo.Service] -DisplayName = %Neo.Service.DispName% -Description = %Neo.Service.Desc% -ServiceType = 1 -StartType = 3 -ErrorControl = 1 -ServiceBinary = %12%\Neo6_x86_VPN20.sys -LoadOrderGroup = NDIS - -[Neo.Reg] -HKR, Ndi, Service, 0, Neo.Service.Name -HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" -HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" - -[Neo.EventLog] -HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN20.sys" -HKR, , TypesSupported, 0x00010001, 7 - -[Strings] -CompanyName = "SoftEther Corporation" -DiskDescription = "VPN Client Device Driver Install Disk" -Neo.Service.Name = "Neo_VPN20" -Neo.Service.DispName = "VPN Client Device Driver - VPN20" -Neo.Service.Desc = "VPN Client Adapter - VPN20" -NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN20" -Neo.EventLog.Name = "Neo" -NetworkAddress = "MAC Address" -DefaultAddress = "000001000001" -MaxSpeed = "Indicate Speed (Mbps)" -KeepLink = "Keep Link" -On = "On" -Off = "Off" - - -; Auto Generated 20180205_163613.684 - +; VPN Client Device Driver for Windows 2000 and Greater +; +; Copyright (c) SoftEther Corporation. All Rights Reserved. +; http://www.softether.co.jp/ +; +; BUILD 9658 + +[Version] +Signature = "$Windows NT$" +Class = Net +ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} +Provider = %CompanyName% +DriverVer = 02/04/2018, 4.25.0.9658 +CatalogFile.NT = Neo6_x86_VPN20.cat + +[Manufacturer] +%CompanyName% = SoftEther + +[SourceDisksNames] +1=%DiskDescription%, "", , + +[SourceDisksFiles] +Neo6_x86_VPN20.sys = 1 + +[DestinationDirs] +DefaultDestDir = 12 +Neo.CopyFiles.Sys = 12 + +[Neo.CopyFiles.Sys] +Neo6_x86_VPN20.sys, , , 2 + +[SoftEther] +%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN20 + +[NeoAdapter.Install] +Characteristics = 0x1 +AddReg = Neo.Reg, NeoAdapter.Ndi +CopyFiles = Neo.CopyFiles.Sys +*IfType = 53 +*MediaType = 0 +*PhysicalMediaType = 0 + +[NeoAdapter.Install.Services] +AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% + +[NeoAdapter.Ndi] +HKR, , NetworkAddress, 0, %DefaultAddress% +HKR, Ndi, DeviceID, , "NeoAdapter_VPN20" +HKR, , DevLoader, , ndis +HKR, , DeviceVxDs, , Neo6_x86_VPN20.sys +HKR, NDIS, LogDriverName, , "Neo_VPN20" +HKR, NDIS, MajorNdisVersion, 1, 5 +HKR, NDIS, MinorNdisVersion, 1, 0 +HKR, Ndi\Interfaces, DefUpper, , "ndis5" +HKR, Ndi\Interfaces, UpperRange, , "ndis5" +HKR, Ndi\Interfaces, LowerRange, , "ethernet" +HKR, Ndi\Interfaces, DefLower, , "ethernet" +HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" +HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% +HKR, Ndi\Params\NetworkAddress, type, 0, "edit" +HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" +HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" +HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% +HKR, Ndi\Params\NetworkAddress, optional, 0, "0" +HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% +HKR, Ndi\Params\MaxSpeed, type, 0, "int" +HKR, Ndi\Params\MaxSpeed, default, 0, "100" +HKR, Ndi\Params\MaxSpeed, min, 0, "0" +HKR, Ndi\Params\MaxSpeed, max, 0, "2000" +HKR, Ndi\Params\MaxSpeed, step, 0, "1" +HKR, Ndi\Params\MaxSpeed, Base, 0, "10" +HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% +HKR, Ndi\Params\KeepLink, type, 0, "enum" +HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% +HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% +HKR, Ndi\Params\KeepLink, default, 0, "0" + + +[Neo.Service] +DisplayName = %Neo.Service.DispName% +Description = %Neo.Service.Desc% +ServiceType = 1 +StartType = 3 +ErrorControl = 1 +ServiceBinary = %12%\Neo6_x86_VPN20.sys +LoadOrderGroup = NDIS + +[Neo.Reg] +HKR, Ndi, Service, 0, Neo.Service.Name +HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" +HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" + +[Neo.EventLog] +HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN20.sys" +HKR, , TypesSupported, 0x00010001, 7 + +[Strings] +CompanyName = "SoftEther Corporation" +DiskDescription = "VPN Client Device Driver Install Disk" +Neo.Service.Name = "Neo_VPN20" +Neo.Service.DispName = "VPN Client Device Driver - VPN20" +Neo.Service.Desc = "VPN Client Adapter - VPN20" +NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN20" +Neo.EventLog.Name = "Neo" +NetworkAddress = "MAC Address" +DefaultAddress = "000001000001" +MaxSpeed = "Indicate Speed (Mbps)" +KeepLink = "Keep Link" +On = "On" +Off = "Off" + + +; Auto Generated 20180205_163613.684 + diff --git a/src/bin/hamcore/DriverPackages/Neo6_Win10/x86/Neo6_x86_VPN21.inf b/src/bin/hamcore/DriverPackages/Neo6_Win10/x86/Neo6_x86_VPN21.inf index a515f674..ceeedafa 100644 --- a/src/bin/hamcore/DriverPackages/Neo6_Win10/x86/Neo6_x86_VPN21.inf +++ b/src/bin/hamcore/DriverPackages/Neo6_Win10/x86/Neo6_x86_VPN21.inf @@ -1,114 +1,114 @@ -; VPN Client Device Driver for Windows 2000 and Greater -; -; Copyright (c) SoftEther Corporation. All Rights Reserved. -; http://www.softether.co.jp/ -; -; BUILD 9658 - -[Version] -Signature = "$Windows NT$" -Class = Net -ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} -Provider = %CompanyName% -DriverVer = 02/04/2018, 4.25.0.9658 -CatalogFile.NT = Neo6_x86_VPN21.cat - -[Manufacturer] -%CompanyName% = SoftEther - -[SourceDisksNames] -1=%DiskDescription%, "", , - -[SourceDisksFiles] -Neo6_x86_VPN21.sys = 1 - -[DestinationDirs] -DefaultDestDir = 12 -Neo.CopyFiles.Sys = 12 - -[Neo.CopyFiles.Sys] -Neo6_x86_VPN21.sys, , , 2 - -[SoftEther] -%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN21 - -[NeoAdapter.Install] -Characteristics = 0x1 -AddReg = Neo.Reg, NeoAdapter.Ndi -CopyFiles = Neo.CopyFiles.Sys -*IfType = 53 -*MediaType = 0 -*PhysicalMediaType = 0 - -[NeoAdapter.Install.Services] -AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% - -[NeoAdapter.Ndi] -HKR, , NetworkAddress, 0, %DefaultAddress% -HKR, Ndi, DeviceID, , "NeoAdapter_VPN21" -HKR, , DevLoader, , ndis -HKR, , DeviceVxDs, , Neo6_x86_VPN21.sys -HKR, NDIS, LogDriverName, , "Neo_VPN21" -HKR, NDIS, MajorNdisVersion, 1, 5 -HKR, NDIS, MinorNdisVersion, 1, 0 -HKR, Ndi\Interfaces, DefUpper, , "ndis5" -HKR, Ndi\Interfaces, UpperRange, , "ndis5" -HKR, Ndi\Interfaces, LowerRange, , "ethernet" -HKR, Ndi\Interfaces, DefLower, , "ethernet" -HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" -HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% -HKR, Ndi\Params\NetworkAddress, type, 0, "edit" -HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" -HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" -HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% -HKR, Ndi\Params\NetworkAddress, optional, 0, "0" -HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% -HKR, Ndi\Params\MaxSpeed, type, 0, "int" -HKR, Ndi\Params\MaxSpeed, default, 0, "100" -HKR, Ndi\Params\MaxSpeed, min, 0, "0" -HKR, Ndi\Params\MaxSpeed, max, 0, "2000" -HKR, Ndi\Params\MaxSpeed, step, 0, "1" -HKR, Ndi\Params\MaxSpeed, Base, 0, "10" -HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% -HKR, Ndi\Params\KeepLink, type, 0, "enum" -HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% -HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% -HKR, Ndi\Params\KeepLink, default, 0, "0" - - -[Neo.Service] -DisplayName = %Neo.Service.DispName% -Description = %Neo.Service.Desc% -ServiceType = 1 -StartType = 3 -ErrorControl = 1 -ServiceBinary = %12%\Neo6_x86_VPN21.sys -LoadOrderGroup = NDIS - -[Neo.Reg] -HKR, Ndi, Service, 0, Neo.Service.Name -HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" -HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" - -[Neo.EventLog] -HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN21.sys" -HKR, , TypesSupported, 0x00010001, 7 - -[Strings] -CompanyName = "SoftEther Corporation" -DiskDescription = "VPN Client Device Driver Install Disk" -Neo.Service.Name = "Neo_VPN21" -Neo.Service.DispName = "VPN Client Device Driver - VPN21" -Neo.Service.Desc = "VPN Client Adapter - VPN21" -NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN21" -Neo.EventLog.Name = "Neo" -NetworkAddress = "MAC Address" -DefaultAddress = "000001000001" -MaxSpeed = "Indicate Speed (Mbps)" -KeepLink = "Keep Link" -On = "On" -Off = "Off" - - -; Auto Generated 20180205_163613.755 - +; VPN Client Device Driver for Windows 2000 and Greater +; +; Copyright (c) SoftEther Corporation. All Rights Reserved. +; http://www.softether.co.jp/ +; +; BUILD 9658 + +[Version] +Signature = "$Windows NT$" +Class = Net +ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} +Provider = %CompanyName% +DriverVer = 02/04/2018, 4.25.0.9658 +CatalogFile.NT = Neo6_x86_VPN21.cat + +[Manufacturer] +%CompanyName% = SoftEther + +[SourceDisksNames] +1=%DiskDescription%, "", , + +[SourceDisksFiles] +Neo6_x86_VPN21.sys = 1 + +[DestinationDirs] +DefaultDestDir = 12 +Neo.CopyFiles.Sys = 12 + +[Neo.CopyFiles.Sys] +Neo6_x86_VPN21.sys, , , 2 + +[SoftEther] +%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN21 + +[NeoAdapter.Install] +Characteristics = 0x1 +AddReg = Neo.Reg, NeoAdapter.Ndi +CopyFiles = Neo.CopyFiles.Sys +*IfType = 53 +*MediaType = 0 +*PhysicalMediaType = 0 + +[NeoAdapter.Install.Services] +AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% + +[NeoAdapter.Ndi] +HKR, , NetworkAddress, 0, %DefaultAddress% +HKR, Ndi, DeviceID, , "NeoAdapter_VPN21" +HKR, , DevLoader, , ndis +HKR, , DeviceVxDs, , Neo6_x86_VPN21.sys +HKR, NDIS, LogDriverName, , "Neo_VPN21" +HKR, NDIS, MajorNdisVersion, 1, 5 +HKR, NDIS, MinorNdisVersion, 1, 0 +HKR, Ndi\Interfaces, DefUpper, , "ndis5" +HKR, Ndi\Interfaces, UpperRange, , "ndis5" +HKR, Ndi\Interfaces, LowerRange, , "ethernet" +HKR, Ndi\Interfaces, DefLower, , "ethernet" +HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" +HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% +HKR, Ndi\Params\NetworkAddress, type, 0, "edit" +HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" +HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" +HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% +HKR, Ndi\Params\NetworkAddress, optional, 0, "0" +HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% +HKR, Ndi\Params\MaxSpeed, type, 0, "int" +HKR, Ndi\Params\MaxSpeed, default, 0, "100" +HKR, Ndi\Params\MaxSpeed, min, 0, "0" +HKR, Ndi\Params\MaxSpeed, max, 0, "2000" +HKR, Ndi\Params\MaxSpeed, step, 0, "1" +HKR, Ndi\Params\MaxSpeed, Base, 0, "10" +HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% +HKR, Ndi\Params\KeepLink, type, 0, "enum" +HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% +HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% +HKR, Ndi\Params\KeepLink, default, 0, "0" + + +[Neo.Service] +DisplayName = %Neo.Service.DispName% +Description = %Neo.Service.Desc% +ServiceType = 1 +StartType = 3 +ErrorControl = 1 +ServiceBinary = %12%\Neo6_x86_VPN21.sys +LoadOrderGroup = NDIS + +[Neo.Reg] +HKR, Ndi, Service, 0, Neo.Service.Name +HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" +HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" + +[Neo.EventLog] +HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN21.sys" +HKR, , TypesSupported, 0x00010001, 7 + +[Strings] +CompanyName = "SoftEther Corporation" +DiskDescription = "VPN Client Device Driver Install Disk" +Neo.Service.Name = "Neo_VPN21" +Neo.Service.DispName = "VPN Client Device Driver - VPN21" +Neo.Service.Desc = "VPN Client Adapter - VPN21" +NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN21" +Neo.EventLog.Name = "Neo" +NetworkAddress = "MAC Address" +DefaultAddress = "000001000001" +MaxSpeed = "Indicate Speed (Mbps)" +KeepLink = "Keep Link" +On = "On" +Off = "Off" + + +; Auto Generated 20180205_163613.755 + diff --git a/src/bin/hamcore/DriverPackages/Neo6_Win10/x86/Neo6_x86_VPN22.inf b/src/bin/hamcore/DriverPackages/Neo6_Win10/x86/Neo6_x86_VPN22.inf index 05aad97a..ff7a561c 100644 --- a/src/bin/hamcore/DriverPackages/Neo6_Win10/x86/Neo6_x86_VPN22.inf +++ b/src/bin/hamcore/DriverPackages/Neo6_Win10/x86/Neo6_x86_VPN22.inf @@ -1,114 +1,114 @@ -; VPN Client Device Driver for Windows 2000 and Greater -; -; Copyright (c) SoftEther Corporation. All Rights Reserved. -; http://www.softether.co.jp/ -; -; BUILD 9658 - -[Version] -Signature = "$Windows NT$" -Class = Net -ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} -Provider = %CompanyName% -DriverVer = 02/04/2018, 4.25.0.9658 -CatalogFile.NT = Neo6_x86_VPN22.cat - -[Manufacturer] -%CompanyName% = SoftEther - -[SourceDisksNames] -1=%DiskDescription%, "", , - -[SourceDisksFiles] -Neo6_x86_VPN22.sys = 1 - -[DestinationDirs] -DefaultDestDir = 12 -Neo.CopyFiles.Sys = 12 - -[Neo.CopyFiles.Sys] -Neo6_x86_VPN22.sys, , , 2 - -[SoftEther] -%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN22 - -[NeoAdapter.Install] -Characteristics = 0x1 -AddReg = Neo.Reg, NeoAdapter.Ndi -CopyFiles = Neo.CopyFiles.Sys -*IfType = 53 -*MediaType = 0 -*PhysicalMediaType = 0 - -[NeoAdapter.Install.Services] -AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% - -[NeoAdapter.Ndi] -HKR, , NetworkAddress, 0, %DefaultAddress% -HKR, Ndi, DeviceID, , "NeoAdapter_VPN22" -HKR, , DevLoader, , ndis -HKR, , DeviceVxDs, , Neo6_x86_VPN22.sys -HKR, NDIS, LogDriverName, , "Neo_VPN22" -HKR, NDIS, MajorNdisVersion, 1, 5 -HKR, NDIS, MinorNdisVersion, 1, 0 -HKR, Ndi\Interfaces, DefUpper, , "ndis5" -HKR, Ndi\Interfaces, UpperRange, , "ndis5" -HKR, Ndi\Interfaces, LowerRange, , "ethernet" -HKR, Ndi\Interfaces, DefLower, , "ethernet" -HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" -HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% -HKR, Ndi\Params\NetworkAddress, type, 0, "edit" -HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" -HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" -HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% -HKR, Ndi\Params\NetworkAddress, optional, 0, "0" -HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% -HKR, Ndi\Params\MaxSpeed, type, 0, "int" -HKR, Ndi\Params\MaxSpeed, default, 0, "100" -HKR, Ndi\Params\MaxSpeed, min, 0, "0" -HKR, Ndi\Params\MaxSpeed, max, 0, "2000" -HKR, Ndi\Params\MaxSpeed, step, 0, "1" -HKR, Ndi\Params\MaxSpeed, Base, 0, "10" -HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% -HKR, Ndi\Params\KeepLink, type, 0, "enum" -HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% -HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% -HKR, Ndi\Params\KeepLink, default, 0, "0" - - -[Neo.Service] -DisplayName = %Neo.Service.DispName% -Description = %Neo.Service.Desc% -ServiceType = 1 -StartType = 3 -ErrorControl = 1 -ServiceBinary = %12%\Neo6_x86_VPN22.sys -LoadOrderGroup = NDIS - -[Neo.Reg] -HKR, Ndi, Service, 0, Neo.Service.Name -HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" -HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" - -[Neo.EventLog] -HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN22.sys" -HKR, , TypesSupported, 0x00010001, 7 - -[Strings] -CompanyName = "SoftEther Corporation" -DiskDescription = "VPN Client Device Driver Install Disk" -Neo.Service.Name = "Neo_VPN22" -Neo.Service.DispName = "VPN Client Device Driver - VPN22" -Neo.Service.Desc = "VPN Client Adapter - VPN22" -NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN22" -Neo.EventLog.Name = "Neo" -NetworkAddress = "MAC Address" -DefaultAddress = "000001000001" -MaxSpeed = "Indicate Speed (Mbps)" -KeepLink = "Keep Link" -On = "On" -Off = "Off" - - -; Auto Generated 20180205_163613.826 - +; VPN Client Device Driver for Windows 2000 and Greater +; +; Copyright (c) SoftEther Corporation. All Rights Reserved. +; http://www.softether.co.jp/ +; +; BUILD 9658 + +[Version] +Signature = "$Windows NT$" +Class = Net +ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} +Provider = %CompanyName% +DriverVer = 02/04/2018, 4.25.0.9658 +CatalogFile.NT = Neo6_x86_VPN22.cat + +[Manufacturer] +%CompanyName% = SoftEther + +[SourceDisksNames] +1=%DiskDescription%, "", , + +[SourceDisksFiles] +Neo6_x86_VPN22.sys = 1 + +[DestinationDirs] +DefaultDestDir = 12 +Neo.CopyFiles.Sys = 12 + +[Neo.CopyFiles.Sys] +Neo6_x86_VPN22.sys, , , 2 + +[SoftEther] +%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN22 + +[NeoAdapter.Install] +Characteristics = 0x1 +AddReg = Neo.Reg, NeoAdapter.Ndi +CopyFiles = Neo.CopyFiles.Sys +*IfType = 53 +*MediaType = 0 +*PhysicalMediaType = 0 + +[NeoAdapter.Install.Services] +AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% + +[NeoAdapter.Ndi] +HKR, , NetworkAddress, 0, %DefaultAddress% +HKR, Ndi, DeviceID, , "NeoAdapter_VPN22" +HKR, , DevLoader, , ndis +HKR, , DeviceVxDs, , Neo6_x86_VPN22.sys +HKR, NDIS, LogDriverName, , "Neo_VPN22" +HKR, NDIS, MajorNdisVersion, 1, 5 +HKR, NDIS, MinorNdisVersion, 1, 0 +HKR, Ndi\Interfaces, DefUpper, , "ndis5" +HKR, Ndi\Interfaces, UpperRange, , "ndis5" +HKR, Ndi\Interfaces, LowerRange, , "ethernet" +HKR, Ndi\Interfaces, DefLower, , "ethernet" +HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" +HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% +HKR, Ndi\Params\NetworkAddress, type, 0, "edit" +HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" +HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" +HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% +HKR, Ndi\Params\NetworkAddress, optional, 0, "0" +HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% +HKR, Ndi\Params\MaxSpeed, type, 0, "int" +HKR, Ndi\Params\MaxSpeed, default, 0, "100" +HKR, Ndi\Params\MaxSpeed, min, 0, "0" +HKR, Ndi\Params\MaxSpeed, max, 0, "2000" +HKR, Ndi\Params\MaxSpeed, step, 0, "1" +HKR, Ndi\Params\MaxSpeed, Base, 0, "10" +HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% +HKR, Ndi\Params\KeepLink, type, 0, "enum" +HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% +HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% +HKR, Ndi\Params\KeepLink, default, 0, "0" + + +[Neo.Service] +DisplayName = %Neo.Service.DispName% +Description = %Neo.Service.Desc% +ServiceType = 1 +StartType = 3 +ErrorControl = 1 +ServiceBinary = %12%\Neo6_x86_VPN22.sys +LoadOrderGroup = NDIS + +[Neo.Reg] +HKR, Ndi, Service, 0, Neo.Service.Name +HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" +HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" + +[Neo.EventLog] +HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN22.sys" +HKR, , TypesSupported, 0x00010001, 7 + +[Strings] +CompanyName = "SoftEther Corporation" +DiskDescription = "VPN Client Device Driver Install Disk" +Neo.Service.Name = "Neo_VPN22" +Neo.Service.DispName = "VPN Client Device Driver - VPN22" +Neo.Service.Desc = "VPN Client Adapter - VPN22" +NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN22" +Neo.EventLog.Name = "Neo" +NetworkAddress = "MAC Address" +DefaultAddress = "000001000001" +MaxSpeed = "Indicate Speed (Mbps)" +KeepLink = "Keep Link" +On = "On" +Off = "Off" + + +; Auto Generated 20180205_163613.826 + diff --git a/src/bin/hamcore/DriverPackages/Neo6_Win10/x86/Neo6_x86_VPN23.inf b/src/bin/hamcore/DriverPackages/Neo6_Win10/x86/Neo6_x86_VPN23.inf index 1eb65884..cb3a2056 100644 --- a/src/bin/hamcore/DriverPackages/Neo6_Win10/x86/Neo6_x86_VPN23.inf +++ b/src/bin/hamcore/DriverPackages/Neo6_Win10/x86/Neo6_x86_VPN23.inf @@ -1,114 +1,114 @@ -; VPN Client Device Driver for Windows 2000 and Greater -; -; Copyright (c) SoftEther Corporation. All Rights Reserved. -; http://www.softether.co.jp/ -; -; BUILD 9658 - -[Version] -Signature = "$Windows NT$" -Class = Net -ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} -Provider = %CompanyName% -DriverVer = 02/04/2018, 4.25.0.9658 -CatalogFile.NT = Neo6_x86_VPN23.cat - -[Manufacturer] -%CompanyName% = SoftEther - -[SourceDisksNames] -1=%DiskDescription%, "", , - -[SourceDisksFiles] -Neo6_x86_VPN23.sys = 1 - -[DestinationDirs] -DefaultDestDir = 12 -Neo.CopyFiles.Sys = 12 - -[Neo.CopyFiles.Sys] -Neo6_x86_VPN23.sys, , , 2 - -[SoftEther] -%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN23 - -[NeoAdapter.Install] -Characteristics = 0x1 -AddReg = Neo.Reg, NeoAdapter.Ndi -CopyFiles = Neo.CopyFiles.Sys -*IfType = 53 -*MediaType = 0 -*PhysicalMediaType = 0 - -[NeoAdapter.Install.Services] -AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% - -[NeoAdapter.Ndi] -HKR, , NetworkAddress, 0, %DefaultAddress% -HKR, Ndi, DeviceID, , "NeoAdapter_VPN23" -HKR, , DevLoader, , ndis -HKR, , DeviceVxDs, , Neo6_x86_VPN23.sys -HKR, NDIS, LogDriverName, , "Neo_VPN23" -HKR, NDIS, MajorNdisVersion, 1, 5 -HKR, NDIS, MinorNdisVersion, 1, 0 -HKR, Ndi\Interfaces, DefUpper, , "ndis5" -HKR, Ndi\Interfaces, UpperRange, , "ndis5" -HKR, Ndi\Interfaces, LowerRange, , "ethernet" -HKR, Ndi\Interfaces, DefLower, , "ethernet" -HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" -HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% -HKR, Ndi\Params\NetworkAddress, type, 0, "edit" -HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" -HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" -HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% -HKR, Ndi\Params\NetworkAddress, optional, 0, "0" -HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% -HKR, Ndi\Params\MaxSpeed, type, 0, "int" -HKR, Ndi\Params\MaxSpeed, default, 0, "100" -HKR, Ndi\Params\MaxSpeed, min, 0, "0" -HKR, Ndi\Params\MaxSpeed, max, 0, "2000" -HKR, Ndi\Params\MaxSpeed, step, 0, "1" -HKR, Ndi\Params\MaxSpeed, Base, 0, "10" -HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% -HKR, Ndi\Params\KeepLink, type, 0, "enum" -HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% -HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% -HKR, Ndi\Params\KeepLink, default, 0, "0" - - -[Neo.Service] -DisplayName = %Neo.Service.DispName% -Description = %Neo.Service.Desc% -ServiceType = 1 -StartType = 3 -ErrorControl = 1 -ServiceBinary = %12%\Neo6_x86_VPN23.sys -LoadOrderGroup = NDIS - -[Neo.Reg] -HKR, Ndi, Service, 0, Neo.Service.Name -HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" -HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" - -[Neo.EventLog] -HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN23.sys" -HKR, , TypesSupported, 0x00010001, 7 - -[Strings] -CompanyName = "SoftEther Corporation" -DiskDescription = "VPN Client Device Driver Install Disk" -Neo.Service.Name = "Neo_VPN23" -Neo.Service.DispName = "VPN Client Device Driver - VPN23" -Neo.Service.Desc = "VPN Client Adapter - VPN23" -NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN23" -Neo.EventLog.Name = "Neo" -NetworkAddress = "MAC Address" -DefaultAddress = "000001000001" -MaxSpeed = "Indicate Speed (Mbps)" -KeepLink = "Keep Link" -On = "On" -Off = "Off" - - -; Auto Generated 20180205_163613.896 - +; VPN Client Device Driver for Windows 2000 and Greater +; +; Copyright (c) SoftEther Corporation. All Rights Reserved. +; http://www.softether.co.jp/ +; +; BUILD 9658 + +[Version] +Signature = "$Windows NT$" +Class = Net +ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} +Provider = %CompanyName% +DriverVer = 02/04/2018, 4.25.0.9658 +CatalogFile.NT = Neo6_x86_VPN23.cat + +[Manufacturer] +%CompanyName% = SoftEther + +[SourceDisksNames] +1=%DiskDescription%, "", , + +[SourceDisksFiles] +Neo6_x86_VPN23.sys = 1 + +[DestinationDirs] +DefaultDestDir = 12 +Neo.CopyFiles.Sys = 12 + +[Neo.CopyFiles.Sys] +Neo6_x86_VPN23.sys, , , 2 + +[SoftEther] +%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN23 + +[NeoAdapter.Install] +Characteristics = 0x1 +AddReg = Neo.Reg, NeoAdapter.Ndi +CopyFiles = Neo.CopyFiles.Sys +*IfType = 53 +*MediaType = 0 +*PhysicalMediaType = 0 + +[NeoAdapter.Install.Services] +AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% + +[NeoAdapter.Ndi] +HKR, , NetworkAddress, 0, %DefaultAddress% +HKR, Ndi, DeviceID, , "NeoAdapter_VPN23" +HKR, , DevLoader, , ndis +HKR, , DeviceVxDs, , Neo6_x86_VPN23.sys +HKR, NDIS, LogDriverName, , "Neo_VPN23" +HKR, NDIS, MajorNdisVersion, 1, 5 +HKR, NDIS, MinorNdisVersion, 1, 0 +HKR, Ndi\Interfaces, DefUpper, , "ndis5" +HKR, Ndi\Interfaces, UpperRange, , "ndis5" +HKR, Ndi\Interfaces, LowerRange, , "ethernet" +HKR, Ndi\Interfaces, DefLower, , "ethernet" +HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" +HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% +HKR, Ndi\Params\NetworkAddress, type, 0, "edit" +HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" +HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" +HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% +HKR, Ndi\Params\NetworkAddress, optional, 0, "0" +HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% +HKR, Ndi\Params\MaxSpeed, type, 0, "int" +HKR, Ndi\Params\MaxSpeed, default, 0, "100" +HKR, Ndi\Params\MaxSpeed, min, 0, "0" +HKR, Ndi\Params\MaxSpeed, max, 0, "2000" +HKR, Ndi\Params\MaxSpeed, step, 0, "1" +HKR, Ndi\Params\MaxSpeed, Base, 0, "10" +HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% +HKR, Ndi\Params\KeepLink, type, 0, "enum" +HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% +HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% +HKR, Ndi\Params\KeepLink, default, 0, "0" + + +[Neo.Service] +DisplayName = %Neo.Service.DispName% +Description = %Neo.Service.Desc% +ServiceType = 1 +StartType = 3 +ErrorControl = 1 +ServiceBinary = %12%\Neo6_x86_VPN23.sys +LoadOrderGroup = NDIS + +[Neo.Reg] +HKR, Ndi, Service, 0, Neo.Service.Name +HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" +HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" + +[Neo.EventLog] +HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN23.sys" +HKR, , TypesSupported, 0x00010001, 7 + +[Strings] +CompanyName = "SoftEther Corporation" +DiskDescription = "VPN Client Device Driver Install Disk" +Neo.Service.Name = "Neo_VPN23" +Neo.Service.DispName = "VPN Client Device Driver - VPN23" +Neo.Service.Desc = "VPN Client Adapter - VPN23" +NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN23" +Neo.EventLog.Name = "Neo" +NetworkAddress = "MAC Address" +DefaultAddress = "000001000001" +MaxSpeed = "Indicate Speed (Mbps)" +KeepLink = "Keep Link" +On = "On" +Off = "Off" + + +; Auto Generated 20180205_163613.896 + diff --git a/src/bin/hamcore/DriverPackages/Neo6_Win10/x86/Neo6_x86_VPN24.inf b/src/bin/hamcore/DriverPackages/Neo6_Win10/x86/Neo6_x86_VPN24.inf index 5c9fa735..508c079f 100644 --- a/src/bin/hamcore/DriverPackages/Neo6_Win10/x86/Neo6_x86_VPN24.inf +++ b/src/bin/hamcore/DriverPackages/Neo6_Win10/x86/Neo6_x86_VPN24.inf @@ -1,114 +1,114 @@ -; VPN Client Device Driver for Windows 2000 and Greater -; -; Copyright (c) SoftEther Corporation. All Rights Reserved. -; http://www.softether.co.jp/ -; -; BUILD 9658 - -[Version] -Signature = "$Windows NT$" -Class = Net -ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} -Provider = %CompanyName% -DriverVer = 02/04/2018, 4.25.0.9658 -CatalogFile.NT = Neo6_x86_VPN24.cat - -[Manufacturer] -%CompanyName% = SoftEther - -[SourceDisksNames] -1=%DiskDescription%, "", , - -[SourceDisksFiles] -Neo6_x86_VPN24.sys = 1 - -[DestinationDirs] -DefaultDestDir = 12 -Neo.CopyFiles.Sys = 12 - -[Neo.CopyFiles.Sys] -Neo6_x86_VPN24.sys, , , 2 - -[SoftEther] -%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN24 - -[NeoAdapter.Install] -Characteristics = 0x1 -AddReg = Neo.Reg, NeoAdapter.Ndi -CopyFiles = Neo.CopyFiles.Sys -*IfType = 53 -*MediaType = 0 -*PhysicalMediaType = 0 - -[NeoAdapter.Install.Services] -AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% - -[NeoAdapter.Ndi] -HKR, , NetworkAddress, 0, %DefaultAddress% -HKR, Ndi, DeviceID, , "NeoAdapter_VPN24" -HKR, , DevLoader, , ndis -HKR, , DeviceVxDs, , Neo6_x86_VPN24.sys -HKR, NDIS, LogDriverName, , "Neo_VPN24" -HKR, NDIS, MajorNdisVersion, 1, 5 -HKR, NDIS, MinorNdisVersion, 1, 0 -HKR, Ndi\Interfaces, DefUpper, , "ndis5" -HKR, Ndi\Interfaces, UpperRange, , "ndis5" -HKR, Ndi\Interfaces, LowerRange, , "ethernet" -HKR, Ndi\Interfaces, DefLower, , "ethernet" -HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" -HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% -HKR, Ndi\Params\NetworkAddress, type, 0, "edit" -HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" -HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" -HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% -HKR, Ndi\Params\NetworkAddress, optional, 0, "0" -HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% -HKR, Ndi\Params\MaxSpeed, type, 0, "int" -HKR, Ndi\Params\MaxSpeed, default, 0, "100" -HKR, Ndi\Params\MaxSpeed, min, 0, "0" -HKR, Ndi\Params\MaxSpeed, max, 0, "2000" -HKR, Ndi\Params\MaxSpeed, step, 0, "1" -HKR, Ndi\Params\MaxSpeed, Base, 0, "10" -HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% -HKR, Ndi\Params\KeepLink, type, 0, "enum" -HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% -HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% -HKR, Ndi\Params\KeepLink, default, 0, "0" - - -[Neo.Service] -DisplayName = %Neo.Service.DispName% -Description = %Neo.Service.Desc% -ServiceType = 1 -StartType = 3 -ErrorControl = 1 -ServiceBinary = %12%\Neo6_x86_VPN24.sys -LoadOrderGroup = NDIS - -[Neo.Reg] -HKR, Ndi, Service, 0, Neo.Service.Name -HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" -HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" - -[Neo.EventLog] -HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN24.sys" -HKR, , TypesSupported, 0x00010001, 7 - -[Strings] -CompanyName = "SoftEther Corporation" -DiskDescription = "VPN Client Device Driver Install Disk" -Neo.Service.Name = "Neo_VPN24" -Neo.Service.DispName = "VPN Client Device Driver - VPN24" -Neo.Service.Desc = "VPN Client Adapter - VPN24" -NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN24" -Neo.EventLog.Name = "Neo" -NetworkAddress = "MAC Address" -DefaultAddress = "000001000001" -MaxSpeed = "Indicate Speed (Mbps)" -KeepLink = "Keep Link" -On = "On" -Off = "Off" - - -; Auto Generated 20180205_163613.968 - +; VPN Client Device Driver for Windows 2000 and Greater +; +; Copyright (c) SoftEther Corporation. All Rights Reserved. +; http://www.softether.co.jp/ +; +; BUILD 9658 + +[Version] +Signature = "$Windows NT$" +Class = Net +ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} +Provider = %CompanyName% +DriverVer = 02/04/2018, 4.25.0.9658 +CatalogFile.NT = Neo6_x86_VPN24.cat + +[Manufacturer] +%CompanyName% = SoftEther + +[SourceDisksNames] +1=%DiskDescription%, "", , + +[SourceDisksFiles] +Neo6_x86_VPN24.sys = 1 + +[DestinationDirs] +DefaultDestDir = 12 +Neo.CopyFiles.Sys = 12 + +[Neo.CopyFiles.Sys] +Neo6_x86_VPN24.sys, , , 2 + +[SoftEther] +%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN24 + +[NeoAdapter.Install] +Characteristics = 0x1 +AddReg = Neo.Reg, NeoAdapter.Ndi +CopyFiles = Neo.CopyFiles.Sys +*IfType = 53 +*MediaType = 0 +*PhysicalMediaType = 0 + +[NeoAdapter.Install.Services] +AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% + +[NeoAdapter.Ndi] +HKR, , NetworkAddress, 0, %DefaultAddress% +HKR, Ndi, DeviceID, , "NeoAdapter_VPN24" +HKR, , DevLoader, , ndis +HKR, , DeviceVxDs, , Neo6_x86_VPN24.sys +HKR, NDIS, LogDriverName, , "Neo_VPN24" +HKR, NDIS, MajorNdisVersion, 1, 5 +HKR, NDIS, MinorNdisVersion, 1, 0 +HKR, Ndi\Interfaces, DefUpper, , "ndis5" +HKR, Ndi\Interfaces, UpperRange, , "ndis5" +HKR, Ndi\Interfaces, LowerRange, , "ethernet" +HKR, Ndi\Interfaces, DefLower, , "ethernet" +HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" +HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% +HKR, Ndi\Params\NetworkAddress, type, 0, "edit" +HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" +HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" +HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% +HKR, Ndi\Params\NetworkAddress, optional, 0, "0" +HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% +HKR, Ndi\Params\MaxSpeed, type, 0, "int" +HKR, Ndi\Params\MaxSpeed, default, 0, "100" +HKR, Ndi\Params\MaxSpeed, min, 0, "0" +HKR, Ndi\Params\MaxSpeed, max, 0, "2000" +HKR, Ndi\Params\MaxSpeed, step, 0, "1" +HKR, Ndi\Params\MaxSpeed, Base, 0, "10" +HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% +HKR, Ndi\Params\KeepLink, type, 0, "enum" +HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% +HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% +HKR, Ndi\Params\KeepLink, default, 0, "0" + + +[Neo.Service] +DisplayName = %Neo.Service.DispName% +Description = %Neo.Service.Desc% +ServiceType = 1 +StartType = 3 +ErrorControl = 1 +ServiceBinary = %12%\Neo6_x86_VPN24.sys +LoadOrderGroup = NDIS + +[Neo.Reg] +HKR, Ndi, Service, 0, Neo.Service.Name +HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" +HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" + +[Neo.EventLog] +HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN24.sys" +HKR, , TypesSupported, 0x00010001, 7 + +[Strings] +CompanyName = "SoftEther Corporation" +DiskDescription = "VPN Client Device Driver Install Disk" +Neo.Service.Name = "Neo_VPN24" +Neo.Service.DispName = "VPN Client Device Driver - VPN24" +Neo.Service.Desc = "VPN Client Adapter - VPN24" +NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN24" +Neo.EventLog.Name = "Neo" +NetworkAddress = "MAC Address" +DefaultAddress = "000001000001" +MaxSpeed = "Indicate Speed (Mbps)" +KeepLink = "Keep Link" +On = "On" +Off = "Off" + + +; Auto Generated 20180205_163613.968 + diff --git a/src/bin/hamcore/DriverPackages/Neo6_Win10/x86/Neo6_x86_VPN25.inf b/src/bin/hamcore/DriverPackages/Neo6_Win10/x86/Neo6_x86_VPN25.inf index 79e64c7f..cd220ab3 100644 --- a/src/bin/hamcore/DriverPackages/Neo6_Win10/x86/Neo6_x86_VPN25.inf +++ b/src/bin/hamcore/DriverPackages/Neo6_Win10/x86/Neo6_x86_VPN25.inf @@ -1,114 +1,114 @@ -; VPN Client Device Driver for Windows 2000 and Greater -; -; Copyright (c) SoftEther Corporation. All Rights Reserved. -; http://www.softether.co.jp/ -; -; BUILD 9658 - -[Version] -Signature = "$Windows NT$" -Class = Net -ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} -Provider = %CompanyName% -DriverVer = 02/04/2018, 4.25.0.9658 -CatalogFile.NT = Neo6_x86_VPN25.cat - -[Manufacturer] -%CompanyName% = SoftEther - -[SourceDisksNames] -1=%DiskDescription%, "", , - -[SourceDisksFiles] -Neo6_x86_VPN25.sys = 1 - -[DestinationDirs] -DefaultDestDir = 12 -Neo.CopyFiles.Sys = 12 - -[Neo.CopyFiles.Sys] -Neo6_x86_VPN25.sys, , , 2 - -[SoftEther] -%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN25 - -[NeoAdapter.Install] -Characteristics = 0x1 -AddReg = Neo.Reg, NeoAdapter.Ndi -CopyFiles = Neo.CopyFiles.Sys -*IfType = 53 -*MediaType = 0 -*PhysicalMediaType = 0 - -[NeoAdapter.Install.Services] -AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% - -[NeoAdapter.Ndi] -HKR, , NetworkAddress, 0, %DefaultAddress% -HKR, Ndi, DeviceID, , "NeoAdapter_VPN25" -HKR, , DevLoader, , ndis -HKR, , DeviceVxDs, , Neo6_x86_VPN25.sys -HKR, NDIS, LogDriverName, , "Neo_VPN25" -HKR, NDIS, MajorNdisVersion, 1, 5 -HKR, NDIS, MinorNdisVersion, 1, 0 -HKR, Ndi\Interfaces, DefUpper, , "ndis5" -HKR, Ndi\Interfaces, UpperRange, , "ndis5" -HKR, Ndi\Interfaces, LowerRange, , "ethernet" -HKR, Ndi\Interfaces, DefLower, , "ethernet" -HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" -HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% -HKR, Ndi\Params\NetworkAddress, type, 0, "edit" -HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" -HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" -HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% -HKR, Ndi\Params\NetworkAddress, optional, 0, "0" -HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% -HKR, Ndi\Params\MaxSpeed, type, 0, "int" -HKR, Ndi\Params\MaxSpeed, default, 0, "100" -HKR, Ndi\Params\MaxSpeed, min, 0, "0" -HKR, Ndi\Params\MaxSpeed, max, 0, "2000" -HKR, Ndi\Params\MaxSpeed, step, 0, "1" -HKR, Ndi\Params\MaxSpeed, Base, 0, "10" -HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% -HKR, Ndi\Params\KeepLink, type, 0, "enum" -HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% -HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% -HKR, Ndi\Params\KeepLink, default, 0, "0" - - -[Neo.Service] -DisplayName = %Neo.Service.DispName% -Description = %Neo.Service.Desc% -ServiceType = 1 -StartType = 3 -ErrorControl = 1 -ServiceBinary = %12%\Neo6_x86_VPN25.sys -LoadOrderGroup = NDIS - -[Neo.Reg] -HKR, Ndi, Service, 0, Neo.Service.Name -HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" -HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" - -[Neo.EventLog] -HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN25.sys" -HKR, , TypesSupported, 0x00010001, 7 - -[Strings] -CompanyName = "SoftEther Corporation" -DiskDescription = "VPN Client Device Driver Install Disk" -Neo.Service.Name = "Neo_VPN25" -Neo.Service.DispName = "VPN Client Device Driver - VPN25" -Neo.Service.Desc = "VPN Client Adapter - VPN25" -NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN25" -Neo.EventLog.Name = "Neo" -NetworkAddress = "MAC Address" -DefaultAddress = "000001000001" -MaxSpeed = "Indicate Speed (Mbps)" -KeepLink = "Keep Link" -On = "On" -Off = "Off" - - -; Auto Generated 20180205_163614.039 - +; VPN Client Device Driver for Windows 2000 and Greater +; +; Copyright (c) SoftEther Corporation. All Rights Reserved. +; http://www.softether.co.jp/ +; +; BUILD 9658 + +[Version] +Signature = "$Windows NT$" +Class = Net +ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} +Provider = %CompanyName% +DriverVer = 02/04/2018, 4.25.0.9658 +CatalogFile.NT = Neo6_x86_VPN25.cat + +[Manufacturer] +%CompanyName% = SoftEther + +[SourceDisksNames] +1=%DiskDescription%, "", , + +[SourceDisksFiles] +Neo6_x86_VPN25.sys = 1 + +[DestinationDirs] +DefaultDestDir = 12 +Neo.CopyFiles.Sys = 12 + +[Neo.CopyFiles.Sys] +Neo6_x86_VPN25.sys, , , 2 + +[SoftEther] +%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN25 + +[NeoAdapter.Install] +Characteristics = 0x1 +AddReg = Neo.Reg, NeoAdapter.Ndi +CopyFiles = Neo.CopyFiles.Sys +*IfType = 53 +*MediaType = 0 +*PhysicalMediaType = 0 + +[NeoAdapter.Install.Services] +AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% + +[NeoAdapter.Ndi] +HKR, , NetworkAddress, 0, %DefaultAddress% +HKR, Ndi, DeviceID, , "NeoAdapter_VPN25" +HKR, , DevLoader, , ndis +HKR, , DeviceVxDs, , Neo6_x86_VPN25.sys +HKR, NDIS, LogDriverName, , "Neo_VPN25" +HKR, NDIS, MajorNdisVersion, 1, 5 +HKR, NDIS, MinorNdisVersion, 1, 0 +HKR, Ndi\Interfaces, DefUpper, , "ndis5" +HKR, Ndi\Interfaces, UpperRange, , "ndis5" +HKR, Ndi\Interfaces, LowerRange, , "ethernet" +HKR, Ndi\Interfaces, DefLower, , "ethernet" +HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" +HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% +HKR, Ndi\Params\NetworkAddress, type, 0, "edit" +HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" +HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" +HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% +HKR, Ndi\Params\NetworkAddress, optional, 0, "0" +HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% +HKR, Ndi\Params\MaxSpeed, type, 0, "int" +HKR, Ndi\Params\MaxSpeed, default, 0, "100" +HKR, Ndi\Params\MaxSpeed, min, 0, "0" +HKR, Ndi\Params\MaxSpeed, max, 0, "2000" +HKR, Ndi\Params\MaxSpeed, step, 0, "1" +HKR, Ndi\Params\MaxSpeed, Base, 0, "10" +HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% +HKR, Ndi\Params\KeepLink, type, 0, "enum" +HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% +HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% +HKR, Ndi\Params\KeepLink, default, 0, "0" + + +[Neo.Service] +DisplayName = %Neo.Service.DispName% +Description = %Neo.Service.Desc% +ServiceType = 1 +StartType = 3 +ErrorControl = 1 +ServiceBinary = %12%\Neo6_x86_VPN25.sys +LoadOrderGroup = NDIS + +[Neo.Reg] +HKR, Ndi, Service, 0, Neo.Service.Name +HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" +HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" + +[Neo.EventLog] +HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN25.sys" +HKR, , TypesSupported, 0x00010001, 7 + +[Strings] +CompanyName = "SoftEther Corporation" +DiskDescription = "VPN Client Device Driver Install Disk" +Neo.Service.Name = "Neo_VPN25" +Neo.Service.DispName = "VPN Client Device Driver - VPN25" +Neo.Service.Desc = "VPN Client Adapter - VPN25" +NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN25" +Neo.EventLog.Name = "Neo" +NetworkAddress = "MAC Address" +DefaultAddress = "000001000001" +MaxSpeed = "Indicate Speed (Mbps)" +KeepLink = "Keep Link" +On = "On" +Off = "Off" + + +; Auto Generated 20180205_163614.039 + diff --git a/src/bin/hamcore/DriverPackages/Neo6_Win10/x86/Neo6_x86_VPN26.inf b/src/bin/hamcore/DriverPackages/Neo6_Win10/x86/Neo6_x86_VPN26.inf index c20db992..d5eab4ee 100644 --- a/src/bin/hamcore/DriverPackages/Neo6_Win10/x86/Neo6_x86_VPN26.inf +++ b/src/bin/hamcore/DriverPackages/Neo6_Win10/x86/Neo6_x86_VPN26.inf @@ -1,114 +1,114 @@ -; VPN Client Device Driver for Windows 2000 and Greater -; -; Copyright (c) SoftEther Corporation. All Rights Reserved. -; http://www.softether.co.jp/ -; -; BUILD 9658 - -[Version] -Signature = "$Windows NT$" -Class = Net -ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} -Provider = %CompanyName% -DriverVer = 02/04/2018, 4.25.0.9658 -CatalogFile.NT = Neo6_x86_VPN26.cat - -[Manufacturer] -%CompanyName% = SoftEther - -[SourceDisksNames] -1=%DiskDescription%, "", , - -[SourceDisksFiles] -Neo6_x86_VPN26.sys = 1 - -[DestinationDirs] -DefaultDestDir = 12 -Neo.CopyFiles.Sys = 12 - -[Neo.CopyFiles.Sys] -Neo6_x86_VPN26.sys, , , 2 - -[SoftEther] -%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN26 - -[NeoAdapter.Install] -Characteristics = 0x1 -AddReg = Neo.Reg, NeoAdapter.Ndi -CopyFiles = Neo.CopyFiles.Sys -*IfType = 53 -*MediaType = 0 -*PhysicalMediaType = 0 - -[NeoAdapter.Install.Services] -AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% - -[NeoAdapter.Ndi] -HKR, , NetworkAddress, 0, %DefaultAddress% -HKR, Ndi, DeviceID, , "NeoAdapter_VPN26" -HKR, , DevLoader, , ndis -HKR, , DeviceVxDs, , Neo6_x86_VPN26.sys -HKR, NDIS, LogDriverName, , "Neo_VPN26" -HKR, NDIS, MajorNdisVersion, 1, 5 -HKR, NDIS, MinorNdisVersion, 1, 0 -HKR, Ndi\Interfaces, DefUpper, , "ndis5" -HKR, Ndi\Interfaces, UpperRange, , "ndis5" -HKR, Ndi\Interfaces, LowerRange, , "ethernet" -HKR, Ndi\Interfaces, DefLower, , "ethernet" -HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" -HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% -HKR, Ndi\Params\NetworkAddress, type, 0, "edit" -HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" -HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" -HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% -HKR, Ndi\Params\NetworkAddress, optional, 0, "0" -HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% -HKR, Ndi\Params\MaxSpeed, type, 0, "int" -HKR, Ndi\Params\MaxSpeed, default, 0, "100" -HKR, Ndi\Params\MaxSpeed, min, 0, "0" -HKR, Ndi\Params\MaxSpeed, max, 0, "2000" -HKR, Ndi\Params\MaxSpeed, step, 0, "1" -HKR, Ndi\Params\MaxSpeed, Base, 0, "10" -HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% -HKR, Ndi\Params\KeepLink, type, 0, "enum" -HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% -HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% -HKR, Ndi\Params\KeepLink, default, 0, "0" - - -[Neo.Service] -DisplayName = %Neo.Service.DispName% -Description = %Neo.Service.Desc% -ServiceType = 1 -StartType = 3 -ErrorControl = 1 -ServiceBinary = %12%\Neo6_x86_VPN26.sys -LoadOrderGroup = NDIS - -[Neo.Reg] -HKR, Ndi, Service, 0, Neo.Service.Name -HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" -HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" - -[Neo.EventLog] -HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN26.sys" -HKR, , TypesSupported, 0x00010001, 7 - -[Strings] -CompanyName = "SoftEther Corporation" -DiskDescription = "VPN Client Device Driver Install Disk" -Neo.Service.Name = "Neo_VPN26" -Neo.Service.DispName = "VPN Client Device Driver - VPN26" -Neo.Service.Desc = "VPN Client Adapter - VPN26" -NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN26" -Neo.EventLog.Name = "Neo" -NetworkAddress = "MAC Address" -DefaultAddress = "000001000001" -MaxSpeed = "Indicate Speed (Mbps)" -KeepLink = "Keep Link" -On = "On" -Off = "Off" - - -; Auto Generated 20180205_163614.110 - +; VPN Client Device Driver for Windows 2000 and Greater +; +; Copyright (c) SoftEther Corporation. All Rights Reserved. +; http://www.softether.co.jp/ +; +; BUILD 9658 + +[Version] +Signature = "$Windows NT$" +Class = Net +ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} +Provider = %CompanyName% +DriverVer = 02/04/2018, 4.25.0.9658 +CatalogFile.NT = Neo6_x86_VPN26.cat + +[Manufacturer] +%CompanyName% = SoftEther + +[SourceDisksNames] +1=%DiskDescription%, "", , + +[SourceDisksFiles] +Neo6_x86_VPN26.sys = 1 + +[DestinationDirs] +DefaultDestDir = 12 +Neo.CopyFiles.Sys = 12 + +[Neo.CopyFiles.Sys] +Neo6_x86_VPN26.sys, , , 2 + +[SoftEther] +%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN26 + +[NeoAdapter.Install] +Characteristics = 0x1 +AddReg = Neo.Reg, NeoAdapter.Ndi +CopyFiles = Neo.CopyFiles.Sys +*IfType = 53 +*MediaType = 0 +*PhysicalMediaType = 0 + +[NeoAdapter.Install.Services] +AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% + +[NeoAdapter.Ndi] +HKR, , NetworkAddress, 0, %DefaultAddress% +HKR, Ndi, DeviceID, , "NeoAdapter_VPN26" +HKR, , DevLoader, , ndis +HKR, , DeviceVxDs, , Neo6_x86_VPN26.sys +HKR, NDIS, LogDriverName, , "Neo_VPN26" +HKR, NDIS, MajorNdisVersion, 1, 5 +HKR, NDIS, MinorNdisVersion, 1, 0 +HKR, Ndi\Interfaces, DefUpper, , "ndis5" +HKR, Ndi\Interfaces, UpperRange, , "ndis5" +HKR, Ndi\Interfaces, LowerRange, , "ethernet" +HKR, Ndi\Interfaces, DefLower, , "ethernet" +HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" +HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% +HKR, Ndi\Params\NetworkAddress, type, 0, "edit" +HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" +HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" +HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% +HKR, Ndi\Params\NetworkAddress, optional, 0, "0" +HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% +HKR, Ndi\Params\MaxSpeed, type, 0, "int" +HKR, Ndi\Params\MaxSpeed, default, 0, "100" +HKR, Ndi\Params\MaxSpeed, min, 0, "0" +HKR, Ndi\Params\MaxSpeed, max, 0, "2000" +HKR, Ndi\Params\MaxSpeed, step, 0, "1" +HKR, Ndi\Params\MaxSpeed, Base, 0, "10" +HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% +HKR, Ndi\Params\KeepLink, type, 0, "enum" +HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% +HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% +HKR, Ndi\Params\KeepLink, default, 0, "0" + + +[Neo.Service] +DisplayName = %Neo.Service.DispName% +Description = %Neo.Service.Desc% +ServiceType = 1 +StartType = 3 +ErrorControl = 1 +ServiceBinary = %12%\Neo6_x86_VPN26.sys +LoadOrderGroup = NDIS + +[Neo.Reg] +HKR, Ndi, Service, 0, Neo.Service.Name +HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" +HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" + +[Neo.EventLog] +HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN26.sys" +HKR, , TypesSupported, 0x00010001, 7 + +[Strings] +CompanyName = "SoftEther Corporation" +DiskDescription = "VPN Client Device Driver Install Disk" +Neo.Service.Name = "Neo_VPN26" +Neo.Service.DispName = "VPN Client Device Driver - VPN26" +Neo.Service.Desc = "VPN Client Adapter - VPN26" +NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN26" +Neo.EventLog.Name = "Neo" +NetworkAddress = "MAC Address" +DefaultAddress = "000001000001" +MaxSpeed = "Indicate Speed (Mbps)" +KeepLink = "Keep Link" +On = "On" +Off = "Off" + + +; Auto Generated 20180205_163614.110 + diff --git a/src/bin/hamcore/DriverPackages/Neo6_Win10/x86/Neo6_x86_VPN27.inf b/src/bin/hamcore/DriverPackages/Neo6_Win10/x86/Neo6_x86_VPN27.inf index 18a761c3..0293437e 100644 --- a/src/bin/hamcore/DriverPackages/Neo6_Win10/x86/Neo6_x86_VPN27.inf +++ b/src/bin/hamcore/DriverPackages/Neo6_Win10/x86/Neo6_x86_VPN27.inf @@ -1,114 +1,114 @@ -; VPN Client Device Driver for Windows 2000 and Greater -; -; Copyright (c) SoftEther Corporation. All Rights Reserved. -; http://www.softether.co.jp/ -; -; BUILD 9658 - -[Version] -Signature = "$Windows NT$" -Class = Net -ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} -Provider = %CompanyName% -DriverVer = 02/04/2018, 4.25.0.9658 -CatalogFile.NT = Neo6_x86_VPN27.cat - -[Manufacturer] -%CompanyName% = SoftEther - -[SourceDisksNames] -1=%DiskDescription%, "", , - -[SourceDisksFiles] -Neo6_x86_VPN27.sys = 1 - -[DestinationDirs] -DefaultDestDir = 12 -Neo.CopyFiles.Sys = 12 - -[Neo.CopyFiles.Sys] -Neo6_x86_VPN27.sys, , , 2 - -[SoftEther] -%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN27 - -[NeoAdapter.Install] -Characteristics = 0x1 -AddReg = Neo.Reg, NeoAdapter.Ndi -CopyFiles = Neo.CopyFiles.Sys -*IfType = 53 -*MediaType = 0 -*PhysicalMediaType = 0 - -[NeoAdapter.Install.Services] -AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% - -[NeoAdapter.Ndi] -HKR, , NetworkAddress, 0, %DefaultAddress% -HKR, Ndi, DeviceID, , "NeoAdapter_VPN27" -HKR, , DevLoader, , ndis -HKR, , DeviceVxDs, , Neo6_x86_VPN27.sys -HKR, NDIS, LogDriverName, , "Neo_VPN27" -HKR, NDIS, MajorNdisVersion, 1, 5 -HKR, NDIS, MinorNdisVersion, 1, 0 -HKR, Ndi\Interfaces, DefUpper, , "ndis5" -HKR, Ndi\Interfaces, UpperRange, , "ndis5" -HKR, Ndi\Interfaces, LowerRange, , "ethernet" -HKR, Ndi\Interfaces, DefLower, , "ethernet" -HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" -HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% -HKR, Ndi\Params\NetworkAddress, type, 0, "edit" -HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" -HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" -HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% -HKR, Ndi\Params\NetworkAddress, optional, 0, "0" -HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% -HKR, Ndi\Params\MaxSpeed, type, 0, "int" -HKR, Ndi\Params\MaxSpeed, default, 0, "100" -HKR, Ndi\Params\MaxSpeed, min, 0, "0" -HKR, Ndi\Params\MaxSpeed, max, 0, "2000" -HKR, Ndi\Params\MaxSpeed, step, 0, "1" -HKR, Ndi\Params\MaxSpeed, Base, 0, "10" -HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% -HKR, Ndi\Params\KeepLink, type, 0, "enum" -HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% -HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% -HKR, Ndi\Params\KeepLink, default, 0, "0" - - -[Neo.Service] -DisplayName = %Neo.Service.DispName% -Description = %Neo.Service.Desc% -ServiceType = 1 -StartType = 3 -ErrorControl = 1 -ServiceBinary = %12%\Neo6_x86_VPN27.sys -LoadOrderGroup = NDIS - -[Neo.Reg] -HKR, Ndi, Service, 0, Neo.Service.Name -HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" -HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" - -[Neo.EventLog] -HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN27.sys" -HKR, , TypesSupported, 0x00010001, 7 - -[Strings] -CompanyName = "SoftEther Corporation" -DiskDescription = "VPN Client Device Driver Install Disk" -Neo.Service.Name = "Neo_VPN27" -Neo.Service.DispName = "VPN Client Device Driver - VPN27" -Neo.Service.Desc = "VPN Client Adapter - VPN27" -NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN27" -Neo.EventLog.Name = "Neo" -NetworkAddress = "MAC Address" -DefaultAddress = "000001000001" -MaxSpeed = "Indicate Speed (Mbps)" -KeepLink = "Keep Link" -On = "On" -Off = "Off" - - -; Auto Generated 20180205_163614.184 - +; VPN Client Device Driver for Windows 2000 and Greater +; +; Copyright (c) SoftEther Corporation. All Rights Reserved. +; http://www.softether.co.jp/ +; +; BUILD 9658 + +[Version] +Signature = "$Windows NT$" +Class = Net +ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} +Provider = %CompanyName% +DriverVer = 02/04/2018, 4.25.0.9658 +CatalogFile.NT = Neo6_x86_VPN27.cat + +[Manufacturer] +%CompanyName% = SoftEther + +[SourceDisksNames] +1=%DiskDescription%, "", , + +[SourceDisksFiles] +Neo6_x86_VPN27.sys = 1 + +[DestinationDirs] +DefaultDestDir = 12 +Neo.CopyFiles.Sys = 12 + +[Neo.CopyFiles.Sys] +Neo6_x86_VPN27.sys, , , 2 + +[SoftEther] +%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN27 + +[NeoAdapter.Install] +Characteristics = 0x1 +AddReg = Neo.Reg, NeoAdapter.Ndi +CopyFiles = Neo.CopyFiles.Sys +*IfType = 53 +*MediaType = 0 +*PhysicalMediaType = 0 + +[NeoAdapter.Install.Services] +AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% + +[NeoAdapter.Ndi] +HKR, , NetworkAddress, 0, %DefaultAddress% +HKR, Ndi, DeviceID, , "NeoAdapter_VPN27" +HKR, , DevLoader, , ndis +HKR, , DeviceVxDs, , Neo6_x86_VPN27.sys +HKR, NDIS, LogDriverName, , "Neo_VPN27" +HKR, NDIS, MajorNdisVersion, 1, 5 +HKR, NDIS, MinorNdisVersion, 1, 0 +HKR, Ndi\Interfaces, DefUpper, , "ndis5" +HKR, Ndi\Interfaces, UpperRange, , "ndis5" +HKR, Ndi\Interfaces, LowerRange, , "ethernet" +HKR, Ndi\Interfaces, DefLower, , "ethernet" +HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" +HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% +HKR, Ndi\Params\NetworkAddress, type, 0, "edit" +HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" +HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" +HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% +HKR, Ndi\Params\NetworkAddress, optional, 0, "0" +HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% +HKR, Ndi\Params\MaxSpeed, type, 0, "int" +HKR, Ndi\Params\MaxSpeed, default, 0, "100" +HKR, Ndi\Params\MaxSpeed, min, 0, "0" +HKR, Ndi\Params\MaxSpeed, max, 0, "2000" +HKR, Ndi\Params\MaxSpeed, step, 0, "1" +HKR, Ndi\Params\MaxSpeed, Base, 0, "10" +HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% +HKR, Ndi\Params\KeepLink, type, 0, "enum" +HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% +HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% +HKR, Ndi\Params\KeepLink, default, 0, "0" + + +[Neo.Service] +DisplayName = %Neo.Service.DispName% +Description = %Neo.Service.Desc% +ServiceType = 1 +StartType = 3 +ErrorControl = 1 +ServiceBinary = %12%\Neo6_x86_VPN27.sys +LoadOrderGroup = NDIS + +[Neo.Reg] +HKR, Ndi, Service, 0, Neo.Service.Name +HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" +HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" + +[Neo.EventLog] +HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN27.sys" +HKR, , TypesSupported, 0x00010001, 7 + +[Strings] +CompanyName = "SoftEther Corporation" +DiskDescription = "VPN Client Device Driver Install Disk" +Neo.Service.Name = "Neo_VPN27" +Neo.Service.DispName = "VPN Client Device Driver - VPN27" +Neo.Service.Desc = "VPN Client Adapter - VPN27" +NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN27" +Neo.EventLog.Name = "Neo" +NetworkAddress = "MAC Address" +DefaultAddress = "000001000001" +MaxSpeed = "Indicate Speed (Mbps)" +KeepLink = "Keep Link" +On = "On" +Off = "Off" + + +; Auto Generated 20180205_163614.184 + diff --git a/src/bin/hamcore/DriverPackages/Neo6_Win10/x86/Neo6_x86_VPN28.inf b/src/bin/hamcore/DriverPackages/Neo6_Win10/x86/Neo6_x86_VPN28.inf index 15308a78..d609a46d 100644 --- a/src/bin/hamcore/DriverPackages/Neo6_Win10/x86/Neo6_x86_VPN28.inf +++ b/src/bin/hamcore/DriverPackages/Neo6_Win10/x86/Neo6_x86_VPN28.inf @@ -1,114 +1,114 @@ -; VPN Client Device Driver for Windows 2000 and Greater -; -; Copyright (c) SoftEther Corporation. All Rights Reserved. -; http://www.softether.co.jp/ -; -; BUILD 9658 - -[Version] -Signature = "$Windows NT$" -Class = Net -ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} -Provider = %CompanyName% -DriverVer = 02/04/2018, 4.25.0.9658 -CatalogFile.NT = Neo6_x86_VPN28.cat - -[Manufacturer] -%CompanyName% = SoftEther - -[SourceDisksNames] -1=%DiskDescription%, "", , - -[SourceDisksFiles] -Neo6_x86_VPN28.sys = 1 - -[DestinationDirs] -DefaultDestDir = 12 -Neo.CopyFiles.Sys = 12 - -[Neo.CopyFiles.Sys] -Neo6_x86_VPN28.sys, , , 2 - -[SoftEther] -%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN28 - -[NeoAdapter.Install] -Characteristics = 0x1 -AddReg = Neo.Reg, NeoAdapter.Ndi -CopyFiles = Neo.CopyFiles.Sys -*IfType = 53 -*MediaType = 0 -*PhysicalMediaType = 0 - -[NeoAdapter.Install.Services] -AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% - -[NeoAdapter.Ndi] -HKR, , NetworkAddress, 0, %DefaultAddress% -HKR, Ndi, DeviceID, , "NeoAdapter_VPN28" -HKR, , DevLoader, , ndis -HKR, , DeviceVxDs, , Neo6_x86_VPN28.sys -HKR, NDIS, LogDriverName, , "Neo_VPN28" -HKR, NDIS, MajorNdisVersion, 1, 5 -HKR, NDIS, MinorNdisVersion, 1, 0 -HKR, Ndi\Interfaces, DefUpper, , "ndis5" -HKR, Ndi\Interfaces, UpperRange, , "ndis5" -HKR, Ndi\Interfaces, LowerRange, , "ethernet" -HKR, Ndi\Interfaces, DefLower, , "ethernet" -HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" -HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% -HKR, Ndi\Params\NetworkAddress, type, 0, "edit" -HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" -HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" -HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% -HKR, Ndi\Params\NetworkAddress, optional, 0, "0" -HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% -HKR, Ndi\Params\MaxSpeed, type, 0, "int" -HKR, Ndi\Params\MaxSpeed, default, 0, "100" -HKR, Ndi\Params\MaxSpeed, min, 0, "0" -HKR, Ndi\Params\MaxSpeed, max, 0, "2000" -HKR, Ndi\Params\MaxSpeed, step, 0, "1" -HKR, Ndi\Params\MaxSpeed, Base, 0, "10" -HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% -HKR, Ndi\Params\KeepLink, type, 0, "enum" -HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% -HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% -HKR, Ndi\Params\KeepLink, default, 0, "0" - - -[Neo.Service] -DisplayName = %Neo.Service.DispName% -Description = %Neo.Service.Desc% -ServiceType = 1 -StartType = 3 -ErrorControl = 1 -ServiceBinary = %12%\Neo6_x86_VPN28.sys -LoadOrderGroup = NDIS - -[Neo.Reg] -HKR, Ndi, Service, 0, Neo.Service.Name -HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" -HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" - -[Neo.EventLog] -HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN28.sys" -HKR, , TypesSupported, 0x00010001, 7 - -[Strings] -CompanyName = "SoftEther Corporation" -DiskDescription = "VPN Client Device Driver Install Disk" -Neo.Service.Name = "Neo_VPN28" -Neo.Service.DispName = "VPN Client Device Driver - VPN28" -Neo.Service.Desc = "VPN Client Adapter - VPN28" -NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN28" -Neo.EventLog.Name = "Neo" -NetworkAddress = "MAC Address" -DefaultAddress = "000001000001" -MaxSpeed = "Indicate Speed (Mbps)" -KeepLink = "Keep Link" -On = "On" -Off = "Off" - - -; Auto Generated 20180205_163614.255 - +; VPN Client Device Driver for Windows 2000 and Greater +; +; Copyright (c) SoftEther Corporation. All Rights Reserved. +; http://www.softether.co.jp/ +; +; BUILD 9658 + +[Version] +Signature = "$Windows NT$" +Class = Net +ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} +Provider = %CompanyName% +DriverVer = 02/04/2018, 4.25.0.9658 +CatalogFile.NT = Neo6_x86_VPN28.cat + +[Manufacturer] +%CompanyName% = SoftEther + +[SourceDisksNames] +1=%DiskDescription%, "", , + +[SourceDisksFiles] +Neo6_x86_VPN28.sys = 1 + +[DestinationDirs] +DefaultDestDir = 12 +Neo.CopyFiles.Sys = 12 + +[Neo.CopyFiles.Sys] +Neo6_x86_VPN28.sys, , , 2 + +[SoftEther] +%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN28 + +[NeoAdapter.Install] +Characteristics = 0x1 +AddReg = Neo.Reg, NeoAdapter.Ndi +CopyFiles = Neo.CopyFiles.Sys +*IfType = 53 +*MediaType = 0 +*PhysicalMediaType = 0 + +[NeoAdapter.Install.Services] +AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% + +[NeoAdapter.Ndi] +HKR, , NetworkAddress, 0, %DefaultAddress% +HKR, Ndi, DeviceID, , "NeoAdapter_VPN28" +HKR, , DevLoader, , ndis +HKR, , DeviceVxDs, , Neo6_x86_VPN28.sys +HKR, NDIS, LogDriverName, , "Neo_VPN28" +HKR, NDIS, MajorNdisVersion, 1, 5 +HKR, NDIS, MinorNdisVersion, 1, 0 +HKR, Ndi\Interfaces, DefUpper, , "ndis5" +HKR, Ndi\Interfaces, UpperRange, , "ndis5" +HKR, Ndi\Interfaces, LowerRange, , "ethernet" +HKR, Ndi\Interfaces, DefLower, , "ethernet" +HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" +HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% +HKR, Ndi\Params\NetworkAddress, type, 0, "edit" +HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" +HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" +HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% +HKR, Ndi\Params\NetworkAddress, optional, 0, "0" +HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% +HKR, Ndi\Params\MaxSpeed, type, 0, "int" +HKR, Ndi\Params\MaxSpeed, default, 0, "100" +HKR, Ndi\Params\MaxSpeed, min, 0, "0" +HKR, Ndi\Params\MaxSpeed, max, 0, "2000" +HKR, Ndi\Params\MaxSpeed, step, 0, "1" +HKR, Ndi\Params\MaxSpeed, Base, 0, "10" +HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% +HKR, Ndi\Params\KeepLink, type, 0, "enum" +HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% +HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% +HKR, Ndi\Params\KeepLink, default, 0, "0" + + +[Neo.Service] +DisplayName = %Neo.Service.DispName% +Description = %Neo.Service.Desc% +ServiceType = 1 +StartType = 3 +ErrorControl = 1 +ServiceBinary = %12%\Neo6_x86_VPN28.sys +LoadOrderGroup = NDIS + +[Neo.Reg] +HKR, Ndi, Service, 0, Neo.Service.Name +HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" +HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" + +[Neo.EventLog] +HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN28.sys" +HKR, , TypesSupported, 0x00010001, 7 + +[Strings] +CompanyName = "SoftEther Corporation" +DiskDescription = "VPN Client Device Driver Install Disk" +Neo.Service.Name = "Neo_VPN28" +Neo.Service.DispName = "VPN Client Device Driver - VPN28" +Neo.Service.Desc = "VPN Client Adapter - VPN28" +NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN28" +Neo.EventLog.Name = "Neo" +NetworkAddress = "MAC Address" +DefaultAddress = "000001000001" +MaxSpeed = "Indicate Speed (Mbps)" +KeepLink = "Keep Link" +On = "On" +Off = "Off" + + +; Auto Generated 20180205_163614.255 + diff --git a/src/bin/hamcore/DriverPackages/Neo6_Win10/x86/Neo6_x86_VPN29.inf b/src/bin/hamcore/DriverPackages/Neo6_Win10/x86/Neo6_x86_VPN29.inf index 03003b00..d4240443 100644 --- a/src/bin/hamcore/DriverPackages/Neo6_Win10/x86/Neo6_x86_VPN29.inf +++ b/src/bin/hamcore/DriverPackages/Neo6_Win10/x86/Neo6_x86_VPN29.inf @@ -1,114 +1,114 @@ -; VPN Client Device Driver for Windows 2000 and Greater -; -; Copyright (c) SoftEther Corporation. All Rights Reserved. -; http://www.softether.co.jp/ -; -; BUILD 9658 - -[Version] -Signature = "$Windows NT$" -Class = Net -ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} -Provider = %CompanyName% -DriverVer = 02/04/2018, 4.25.0.9658 -CatalogFile.NT = Neo6_x86_VPN29.cat - -[Manufacturer] -%CompanyName% = SoftEther - -[SourceDisksNames] -1=%DiskDescription%, "", , - -[SourceDisksFiles] -Neo6_x86_VPN29.sys = 1 - -[DestinationDirs] -DefaultDestDir = 12 -Neo.CopyFiles.Sys = 12 - -[Neo.CopyFiles.Sys] -Neo6_x86_VPN29.sys, , , 2 - -[SoftEther] -%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN29 - -[NeoAdapter.Install] -Characteristics = 0x1 -AddReg = Neo.Reg, NeoAdapter.Ndi -CopyFiles = Neo.CopyFiles.Sys -*IfType = 53 -*MediaType = 0 -*PhysicalMediaType = 0 - -[NeoAdapter.Install.Services] -AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% - -[NeoAdapter.Ndi] -HKR, , NetworkAddress, 0, %DefaultAddress% -HKR, Ndi, DeviceID, , "NeoAdapter_VPN29" -HKR, , DevLoader, , ndis -HKR, , DeviceVxDs, , Neo6_x86_VPN29.sys -HKR, NDIS, LogDriverName, , "Neo_VPN29" -HKR, NDIS, MajorNdisVersion, 1, 5 -HKR, NDIS, MinorNdisVersion, 1, 0 -HKR, Ndi\Interfaces, DefUpper, , "ndis5" -HKR, Ndi\Interfaces, UpperRange, , "ndis5" -HKR, Ndi\Interfaces, LowerRange, , "ethernet" -HKR, Ndi\Interfaces, DefLower, , "ethernet" -HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" -HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% -HKR, Ndi\Params\NetworkAddress, type, 0, "edit" -HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" -HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" -HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% -HKR, Ndi\Params\NetworkAddress, optional, 0, "0" -HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% -HKR, Ndi\Params\MaxSpeed, type, 0, "int" -HKR, Ndi\Params\MaxSpeed, default, 0, "100" -HKR, Ndi\Params\MaxSpeed, min, 0, "0" -HKR, Ndi\Params\MaxSpeed, max, 0, "2000" -HKR, Ndi\Params\MaxSpeed, step, 0, "1" -HKR, Ndi\Params\MaxSpeed, Base, 0, "10" -HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% -HKR, Ndi\Params\KeepLink, type, 0, "enum" -HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% -HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% -HKR, Ndi\Params\KeepLink, default, 0, "0" - - -[Neo.Service] -DisplayName = %Neo.Service.DispName% -Description = %Neo.Service.Desc% -ServiceType = 1 -StartType = 3 -ErrorControl = 1 -ServiceBinary = %12%\Neo6_x86_VPN29.sys -LoadOrderGroup = NDIS - -[Neo.Reg] -HKR, Ndi, Service, 0, Neo.Service.Name -HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" -HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" - -[Neo.EventLog] -HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN29.sys" -HKR, , TypesSupported, 0x00010001, 7 - -[Strings] -CompanyName = "SoftEther Corporation" -DiskDescription = "VPN Client Device Driver Install Disk" -Neo.Service.Name = "Neo_VPN29" -Neo.Service.DispName = "VPN Client Device Driver - VPN29" -Neo.Service.Desc = "VPN Client Adapter - VPN29" -NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN29" -Neo.EventLog.Name = "Neo" -NetworkAddress = "MAC Address" -DefaultAddress = "000001000001" -MaxSpeed = "Indicate Speed (Mbps)" -KeepLink = "Keep Link" -On = "On" -Off = "Off" - - -; Auto Generated 20180205_163614.327 - +; VPN Client Device Driver for Windows 2000 and Greater +; +; Copyright (c) SoftEther Corporation. All Rights Reserved. +; http://www.softether.co.jp/ +; +; BUILD 9658 + +[Version] +Signature = "$Windows NT$" +Class = Net +ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} +Provider = %CompanyName% +DriverVer = 02/04/2018, 4.25.0.9658 +CatalogFile.NT = Neo6_x86_VPN29.cat + +[Manufacturer] +%CompanyName% = SoftEther + +[SourceDisksNames] +1=%DiskDescription%, "", , + +[SourceDisksFiles] +Neo6_x86_VPN29.sys = 1 + +[DestinationDirs] +DefaultDestDir = 12 +Neo.CopyFiles.Sys = 12 + +[Neo.CopyFiles.Sys] +Neo6_x86_VPN29.sys, , , 2 + +[SoftEther] +%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN29 + +[NeoAdapter.Install] +Characteristics = 0x1 +AddReg = Neo.Reg, NeoAdapter.Ndi +CopyFiles = Neo.CopyFiles.Sys +*IfType = 53 +*MediaType = 0 +*PhysicalMediaType = 0 + +[NeoAdapter.Install.Services] +AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% + +[NeoAdapter.Ndi] +HKR, , NetworkAddress, 0, %DefaultAddress% +HKR, Ndi, DeviceID, , "NeoAdapter_VPN29" +HKR, , DevLoader, , ndis +HKR, , DeviceVxDs, , Neo6_x86_VPN29.sys +HKR, NDIS, LogDriverName, , "Neo_VPN29" +HKR, NDIS, MajorNdisVersion, 1, 5 +HKR, NDIS, MinorNdisVersion, 1, 0 +HKR, Ndi\Interfaces, DefUpper, , "ndis5" +HKR, Ndi\Interfaces, UpperRange, , "ndis5" +HKR, Ndi\Interfaces, LowerRange, , "ethernet" +HKR, Ndi\Interfaces, DefLower, , "ethernet" +HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" +HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% +HKR, Ndi\Params\NetworkAddress, type, 0, "edit" +HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" +HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" +HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% +HKR, Ndi\Params\NetworkAddress, optional, 0, "0" +HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% +HKR, Ndi\Params\MaxSpeed, type, 0, "int" +HKR, Ndi\Params\MaxSpeed, default, 0, "100" +HKR, Ndi\Params\MaxSpeed, min, 0, "0" +HKR, Ndi\Params\MaxSpeed, max, 0, "2000" +HKR, Ndi\Params\MaxSpeed, step, 0, "1" +HKR, Ndi\Params\MaxSpeed, Base, 0, "10" +HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% +HKR, Ndi\Params\KeepLink, type, 0, "enum" +HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% +HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% +HKR, Ndi\Params\KeepLink, default, 0, "0" + + +[Neo.Service] +DisplayName = %Neo.Service.DispName% +Description = %Neo.Service.Desc% +ServiceType = 1 +StartType = 3 +ErrorControl = 1 +ServiceBinary = %12%\Neo6_x86_VPN29.sys +LoadOrderGroup = NDIS + +[Neo.Reg] +HKR, Ndi, Service, 0, Neo.Service.Name +HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" +HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" + +[Neo.EventLog] +HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN29.sys" +HKR, , TypesSupported, 0x00010001, 7 + +[Strings] +CompanyName = "SoftEther Corporation" +DiskDescription = "VPN Client Device Driver Install Disk" +Neo.Service.Name = "Neo_VPN29" +Neo.Service.DispName = "VPN Client Device Driver - VPN29" +Neo.Service.Desc = "VPN Client Adapter - VPN29" +NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN29" +Neo.EventLog.Name = "Neo" +NetworkAddress = "MAC Address" +DefaultAddress = "000001000001" +MaxSpeed = "Indicate Speed (Mbps)" +KeepLink = "Keep Link" +On = "On" +Off = "Off" + + +; Auto Generated 20180205_163614.327 + diff --git a/src/bin/hamcore/DriverPackages/Neo6_Win10/x86/Neo6_x86_VPN3.inf b/src/bin/hamcore/DriverPackages/Neo6_Win10/x86/Neo6_x86_VPN3.inf index e14b3e67..d24e4551 100644 --- a/src/bin/hamcore/DriverPackages/Neo6_Win10/x86/Neo6_x86_VPN3.inf +++ b/src/bin/hamcore/DriverPackages/Neo6_Win10/x86/Neo6_x86_VPN3.inf @@ -1,114 +1,114 @@ -; VPN Client Device Driver for Windows 2000 and Greater -; -; Copyright (c) SoftEther Corporation. All Rights Reserved. -; http://www.softether.co.jp/ -; -; BUILD 9658 - -[Version] -Signature = "$Windows NT$" -Class = Net -ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} -Provider = %CompanyName% -DriverVer = 02/04/2018, 4.25.0.9658 -CatalogFile.NT = Neo6_x86_VPN3.cat - -[Manufacturer] -%CompanyName% = SoftEther - -[SourceDisksNames] -1=%DiskDescription%, "", , - -[SourceDisksFiles] -Neo6_x86_VPN3.sys = 1 - -[DestinationDirs] -DefaultDestDir = 12 -Neo.CopyFiles.Sys = 12 - -[Neo.CopyFiles.Sys] -Neo6_x86_VPN3.sys, , , 2 - -[SoftEther] -%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN3 - -[NeoAdapter.Install] -Characteristics = 0x1 -AddReg = Neo.Reg, NeoAdapter.Ndi -CopyFiles = Neo.CopyFiles.Sys -*IfType = 53 -*MediaType = 0 -*PhysicalMediaType = 0 - -[NeoAdapter.Install.Services] -AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% - -[NeoAdapter.Ndi] -HKR, , NetworkAddress, 0, %DefaultAddress% -HKR, Ndi, DeviceID, , "NeoAdapter_VPN3" -HKR, , DevLoader, , ndis -HKR, , DeviceVxDs, , Neo6_x86_VPN3.sys -HKR, NDIS, LogDriverName, , "Neo_VPN3" -HKR, NDIS, MajorNdisVersion, 1, 5 -HKR, NDIS, MinorNdisVersion, 1, 0 -HKR, Ndi\Interfaces, DefUpper, , "ndis5" -HKR, Ndi\Interfaces, UpperRange, , "ndis5" -HKR, Ndi\Interfaces, LowerRange, , "ethernet" -HKR, Ndi\Interfaces, DefLower, , "ethernet" -HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" -HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% -HKR, Ndi\Params\NetworkAddress, type, 0, "edit" -HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" -HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" -HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% -HKR, Ndi\Params\NetworkAddress, optional, 0, "0" -HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% -HKR, Ndi\Params\MaxSpeed, type, 0, "int" -HKR, Ndi\Params\MaxSpeed, default, 0, "100" -HKR, Ndi\Params\MaxSpeed, min, 0, "0" -HKR, Ndi\Params\MaxSpeed, max, 0, "2000" -HKR, Ndi\Params\MaxSpeed, step, 0, "1" -HKR, Ndi\Params\MaxSpeed, Base, 0, "10" -HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% -HKR, Ndi\Params\KeepLink, type, 0, "enum" -HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% -HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% -HKR, Ndi\Params\KeepLink, default, 0, "0" - - -[Neo.Service] -DisplayName = %Neo.Service.DispName% -Description = %Neo.Service.Desc% -ServiceType = 1 -StartType = 3 -ErrorControl = 1 -ServiceBinary = %12%\Neo6_x86_VPN3.sys -LoadOrderGroup = NDIS - -[Neo.Reg] -HKR, Ndi, Service, 0, Neo.Service.Name -HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" -HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" - -[Neo.EventLog] -HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN3.sys" -HKR, , TypesSupported, 0x00010001, 7 - -[Strings] -CompanyName = "SoftEther Corporation" -DiskDescription = "VPN Client Device Driver Install Disk" -Neo.Service.Name = "Neo_VPN3" -Neo.Service.DispName = "VPN Client Device Driver - VPN3" -Neo.Service.Desc = "VPN Client Adapter - VPN3" -NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN3" -Neo.EventLog.Name = "Neo" -NetworkAddress = "MAC Address" -DefaultAddress = "000001000001" -MaxSpeed = "Indicate Speed (Mbps)" -KeepLink = "Keep Link" -On = "On" -Off = "Off" - - -; Auto Generated 20180205_163612.475 - +; VPN Client Device Driver for Windows 2000 and Greater +; +; Copyright (c) SoftEther Corporation. All Rights Reserved. +; http://www.softether.co.jp/ +; +; BUILD 9658 + +[Version] +Signature = "$Windows NT$" +Class = Net +ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} +Provider = %CompanyName% +DriverVer = 02/04/2018, 4.25.0.9658 +CatalogFile.NT = Neo6_x86_VPN3.cat + +[Manufacturer] +%CompanyName% = SoftEther + +[SourceDisksNames] +1=%DiskDescription%, "", , + +[SourceDisksFiles] +Neo6_x86_VPN3.sys = 1 + +[DestinationDirs] +DefaultDestDir = 12 +Neo.CopyFiles.Sys = 12 + +[Neo.CopyFiles.Sys] +Neo6_x86_VPN3.sys, , , 2 + +[SoftEther] +%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN3 + +[NeoAdapter.Install] +Characteristics = 0x1 +AddReg = Neo.Reg, NeoAdapter.Ndi +CopyFiles = Neo.CopyFiles.Sys +*IfType = 53 +*MediaType = 0 +*PhysicalMediaType = 0 + +[NeoAdapter.Install.Services] +AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% + +[NeoAdapter.Ndi] +HKR, , NetworkAddress, 0, %DefaultAddress% +HKR, Ndi, DeviceID, , "NeoAdapter_VPN3" +HKR, , DevLoader, , ndis +HKR, , DeviceVxDs, , Neo6_x86_VPN3.sys +HKR, NDIS, LogDriverName, , "Neo_VPN3" +HKR, NDIS, MajorNdisVersion, 1, 5 +HKR, NDIS, MinorNdisVersion, 1, 0 +HKR, Ndi\Interfaces, DefUpper, , "ndis5" +HKR, Ndi\Interfaces, UpperRange, , "ndis5" +HKR, Ndi\Interfaces, LowerRange, , "ethernet" +HKR, Ndi\Interfaces, DefLower, , "ethernet" +HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" +HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% +HKR, Ndi\Params\NetworkAddress, type, 0, "edit" +HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" +HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" +HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% +HKR, Ndi\Params\NetworkAddress, optional, 0, "0" +HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% +HKR, Ndi\Params\MaxSpeed, type, 0, "int" +HKR, Ndi\Params\MaxSpeed, default, 0, "100" +HKR, Ndi\Params\MaxSpeed, min, 0, "0" +HKR, Ndi\Params\MaxSpeed, max, 0, "2000" +HKR, Ndi\Params\MaxSpeed, step, 0, "1" +HKR, Ndi\Params\MaxSpeed, Base, 0, "10" +HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% +HKR, Ndi\Params\KeepLink, type, 0, "enum" +HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% +HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% +HKR, Ndi\Params\KeepLink, default, 0, "0" + + +[Neo.Service] +DisplayName = %Neo.Service.DispName% +Description = %Neo.Service.Desc% +ServiceType = 1 +StartType = 3 +ErrorControl = 1 +ServiceBinary = %12%\Neo6_x86_VPN3.sys +LoadOrderGroup = NDIS + +[Neo.Reg] +HKR, Ndi, Service, 0, Neo.Service.Name +HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" +HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" + +[Neo.EventLog] +HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN3.sys" +HKR, , TypesSupported, 0x00010001, 7 + +[Strings] +CompanyName = "SoftEther Corporation" +DiskDescription = "VPN Client Device Driver Install Disk" +Neo.Service.Name = "Neo_VPN3" +Neo.Service.DispName = "VPN Client Device Driver - VPN3" +Neo.Service.Desc = "VPN Client Adapter - VPN3" +NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN3" +Neo.EventLog.Name = "Neo" +NetworkAddress = "MAC Address" +DefaultAddress = "000001000001" +MaxSpeed = "Indicate Speed (Mbps)" +KeepLink = "Keep Link" +On = "On" +Off = "Off" + + +; Auto Generated 20180205_163612.475 + diff --git a/src/bin/hamcore/DriverPackages/Neo6_Win10/x86/Neo6_x86_VPN30.inf b/src/bin/hamcore/DriverPackages/Neo6_Win10/x86/Neo6_x86_VPN30.inf index 5d71aa64..7315336d 100644 --- a/src/bin/hamcore/DriverPackages/Neo6_Win10/x86/Neo6_x86_VPN30.inf +++ b/src/bin/hamcore/DriverPackages/Neo6_Win10/x86/Neo6_x86_VPN30.inf @@ -1,114 +1,114 @@ -; VPN Client Device Driver for Windows 2000 and Greater -; -; Copyright (c) SoftEther Corporation. All Rights Reserved. -; http://www.softether.co.jp/ -; -; BUILD 9658 - -[Version] -Signature = "$Windows NT$" -Class = Net -ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} -Provider = %CompanyName% -DriverVer = 02/04/2018, 4.25.0.9658 -CatalogFile.NT = Neo6_x86_VPN30.cat - -[Manufacturer] -%CompanyName% = SoftEther - -[SourceDisksNames] -1=%DiskDescription%, "", , - -[SourceDisksFiles] -Neo6_x86_VPN30.sys = 1 - -[DestinationDirs] -DefaultDestDir = 12 -Neo.CopyFiles.Sys = 12 - -[Neo.CopyFiles.Sys] -Neo6_x86_VPN30.sys, , , 2 - -[SoftEther] -%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN30 - -[NeoAdapter.Install] -Characteristics = 0x1 -AddReg = Neo.Reg, NeoAdapter.Ndi -CopyFiles = Neo.CopyFiles.Sys -*IfType = 53 -*MediaType = 0 -*PhysicalMediaType = 0 - -[NeoAdapter.Install.Services] -AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% - -[NeoAdapter.Ndi] -HKR, , NetworkAddress, 0, %DefaultAddress% -HKR, Ndi, DeviceID, , "NeoAdapter_VPN30" -HKR, , DevLoader, , ndis -HKR, , DeviceVxDs, , Neo6_x86_VPN30.sys -HKR, NDIS, LogDriverName, , "Neo_VPN30" -HKR, NDIS, MajorNdisVersion, 1, 5 -HKR, NDIS, MinorNdisVersion, 1, 0 -HKR, Ndi\Interfaces, DefUpper, , "ndis5" -HKR, Ndi\Interfaces, UpperRange, , "ndis5" -HKR, Ndi\Interfaces, LowerRange, , "ethernet" -HKR, Ndi\Interfaces, DefLower, , "ethernet" -HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" -HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% -HKR, Ndi\Params\NetworkAddress, type, 0, "edit" -HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" -HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" -HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% -HKR, Ndi\Params\NetworkAddress, optional, 0, "0" -HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% -HKR, Ndi\Params\MaxSpeed, type, 0, "int" -HKR, Ndi\Params\MaxSpeed, default, 0, "100" -HKR, Ndi\Params\MaxSpeed, min, 0, "0" -HKR, Ndi\Params\MaxSpeed, max, 0, "2000" -HKR, Ndi\Params\MaxSpeed, step, 0, "1" -HKR, Ndi\Params\MaxSpeed, Base, 0, "10" -HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% -HKR, Ndi\Params\KeepLink, type, 0, "enum" -HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% -HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% -HKR, Ndi\Params\KeepLink, default, 0, "0" - - -[Neo.Service] -DisplayName = %Neo.Service.DispName% -Description = %Neo.Service.Desc% -ServiceType = 1 -StartType = 3 -ErrorControl = 1 -ServiceBinary = %12%\Neo6_x86_VPN30.sys -LoadOrderGroup = NDIS - -[Neo.Reg] -HKR, Ndi, Service, 0, Neo.Service.Name -HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" -HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" - -[Neo.EventLog] -HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN30.sys" -HKR, , TypesSupported, 0x00010001, 7 - -[Strings] -CompanyName = "SoftEther Corporation" -DiskDescription = "VPN Client Device Driver Install Disk" -Neo.Service.Name = "Neo_VPN30" -Neo.Service.DispName = "VPN Client Device Driver - VPN30" -Neo.Service.Desc = "VPN Client Adapter - VPN30" -NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN30" -Neo.EventLog.Name = "Neo" -NetworkAddress = "MAC Address" -DefaultAddress = "000001000001" -MaxSpeed = "Indicate Speed (Mbps)" -KeepLink = "Keep Link" -On = "On" -Off = "Off" - - -; Auto Generated 20180205_163614.399 - +; VPN Client Device Driver for Windows 2000 and Greater +; +; Copyright (c) SoftEther Corporation. All Rights Reserved. +; http://www.softether.co.jp/ +; +; BUILD 9658 + +[Version] +Signature = "$Windows NT$" +Class = Net +ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} +Provider = %CompanyName% +DriverVer = 02/04/2018, 4.25.0.9658 +CatalogFile.NT = Neo6_x86_VPN30.cat + +[Manufacturer] +%CompanyName% = SoftEther + +[SourceDisksNames] +1=%DiskDescription%, "", , + +[SourceDisksFiles] +Neo6_x86_VPN30.sys = 1 + +[DestinationDirs] +DefaultDestDir = 12 +Neo.CopyFiles.Sys = 12 + +[Neo.CopyFiles.Sys] +Neo6_x86_VPN30.sys, , , 2 + +[SoftEther] +%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN30 + +[NeoAdapter.Install] +Characteristics = 0x1 +AddReg = Neo.Reg, NeoAdapter.Ndi +CopyFiles = Neo.CopyFiles.Sys +*IfType = 53 +*MediaType = 0 +*PhysicalMediaType = 0 + +[NeoAdapter.Install.Services] +AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% + +[NeoAdapter.Ndi] +HKR, , NetworkAddress, 0, %DefaultAddress% +HKR, Ndi, DeviceID, , "NeoAdapter_VPN30" +HKR, , DevLoader, , ndis +HKR, , DeviceVxDs, , Neo6_x86_VPN30.sys +HKR, NDIS, LogDriverName, , "Neo_VPN30" +HKR, NDIS, MajorNdisVersion, 1, 5 +HKR, NDIS, MinorNdisVersion, 1, 0 +HKR, Ndi\Interfaces, DefUpper, , "ndis5" +HKR, Ndi\Interfaces, UpperRange, , "ndis5" +HKR, Ndi\Interfaces, LowerRange, , "ethernet" +HKR, Ndi\Interfaces, DefLower, , "ethernet" +HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" +HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% +HKR, Ndi\Params\NetworkAddress, type, 0, "edit" +HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" +HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" +HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% +HKR, Ndi\Params\NetworkAddress, optional, 0, "0" +HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% +HKR, Ndi\Params\MaxSpeed, type, 0, "int" +HKR, Ndi\Params\MaxSpeed, default, 0, "100" +HKR, Ndi\Params\MaxSpeed, min, 0, "0" +HKR, Ndi\Params\MaxSpeed, max, 0, "2000" +HKR, Ndi\Params\MaxSpeed, step, 0, "1" +HKR, Ndi\Params\MaxSpeed, Base, 0, "10" +HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% +HKR, Ndi\Params\KeepLink, type, 0, "enum" +HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% +HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% +HKR, Ndi\Params\KeepLink, default, 0, "0" + + +[Neo.Service] +DisplayName = %Neo.Service.DispName% +Description = %Neo.Service.Desc% +ServiceType = 1 +StartType = 3 +ErrorControl = 1 +ServiceBinary = %12%\Neo6_x86_VPN30.sys +LoadOrderGroup = NDIS + +[Neo.Reg] +HKR, Ndi, Service, 0, Neo.Service.Name +HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" +HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" + +[Neo.EventLog] +HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN30.sys" +HKR, , TypesSupported, 0x00010001, 7 + +[Strings] +CompanyName = "SoftEther Corporation" +DiskDescription = "VPN Client Device Driver Install Disk" +Neo.Service.Name = "Neo_VPN30" +Neo.Service.DispName = "VPN Client Device Driver - VPN30" +Neo.Service.Desc = "VPN Client Adapter - VPN30" +NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN30" +Neo.EventLog.Name = "Neo" +NetworkAddress = "MAC Address" +DefaultAddress = "000001000001" +MaxSpeed = "Indicate Speed (Mbps)" +KeepLink = "Keep Link" +On = "On" +Off = "Off" + + +; Auto Generated 20180205_163614.399 + diff --git a/src/bin/hamcore/DriverPackages/Neo6_Win10/x86/Neo6_x86_VPN31.inf b/src/bin/hamcore/DriverPackages/Neo6_Win10/x86/Neo6_x86_VPN31.inf index 8a560f6b..c617cf31 100644 --- a/src/bin/hamcore/DriverPackages/Neo6_Win10/x86/Neo6_x86_VPN31.inf +++ b/src/bin/hamcore/DriverPackages/Neo6_Win10/x86/Neo6_x86_VPN31.inf @@ -1,114 +1,114 @@ -; VPN Client Device Driver for Windows 2000 and Greater -; -; Copyright (c) SoftEther Corporation. All Rights Reserved. -; http://www.softether.co.jp/ -; -; BUILD 9658 - -[Version] -Signature = "$Windows NT$" -Class = Net -ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} -Provider = %CompanyName% -DriverVer = 02/04/2018, 4.25.0.9658 -CatalogFile.NT = Neo6_x86_VPN31.cat - -[Manufacturer] -%CompanyName% = SoftEther - -[SourceDisksNames] -1=%DiskDescription%, "", , - -[SourceDisksFiles] -Neo6_x86_VPN31.sys = 1 - -[DestinationDirs] -DefaultDestDir = 12 -Neo.CopyFiles.Sys = 12 - -[Neo.CopyFiles.Sys] -Neo6_x86_VPN31.sys, , , 2 - -[SoftEther] -%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN31 - -[NeoAdapter.Install] -Characteristics = 0x1 -AddReg = Neo.Reg, NeoAdapter.Ndi -CopyFiles = Neo.CopyFiles.Sys -*IfType = 53 -*MediaType = 0 -*PhysicalMediaType = 0 - -[NeoAdapter.Install.Services] -AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% - -[NeoAdapter.Ndi] -HKR, , NetworkAddress, 0, %DefaultAddress% -HKR, Ndi, DeviceID, , "NeoAdapter_VPN31" -HKR, , DevLoader, , ndis -HKR, , DeviceVxDs, , Neo6_x86_VPN31.sys -HKR, NDIS, LogDriverName, , "Neo_VPN31" -HKR, NDIS, MajorNdisVersion, 1, 5 -HKR, NDIS, MinorNdisVersion, 1, 0 -HKR, Ndi\Interfaces, DefUpper, , "ndis5" -HKR, Ndi\Interfaces, UpperRange, , "ndis5" -HKR, Ndi\Interfaces, LowerRange, , "ethernet" -HKR, Ndi\Interfaces, DefLower, , "ethernet" -HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" -HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% -HKR, Ndi\Params\NetworkAddress, type, 0, "edit" -HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" -HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" -HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% -HKR, Ndi\Params\NetworkAddress, optional, 0, "0" -HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% -HKR, Ndi\Params\MaxSpeed, type, 0, "int" -HKR, Ndi\Params\MaxSpeed, default, 0, "100" -HKR, Ndi\Params\MaxSpeed, min, 0, "0" -HKR, Ndi\Params\MaxSpeed, max, 0, "2000" -HKR, Ndi\Params\MaxSpeed, step, 0, "1" -HKR, Ndi\Params\MaxSpeed, Base, 0, "10" -HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% -HKR, Ndi\Params\KeepLink, type, 0, "enum" -HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% -HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% -HKR, Ndi\Params\KeepLink, default, 0, "0" - - -[Neo.Service] -DisplayName = %Neo.Service.DispName% -Description = %Neo.Service.Desc% -ServiceType = 1 -StartType = 3 -ErrorControl = 1 -ServiceBinary = %12%\Neo6_x86_VPN31.sys -LoadOrderGroup = NDIS - -[Neo.Reg] -HKR, Ndi, Service, 0, Neo.Service.Name -HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" -HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" - -[Neo.EventLog] -HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN31.sys" -HKR, , TypesSupported, 0x00010001, 7 - -[Strings] -CompanyName = "SoftEther Corporation" -DiskDescription = "VPN Client Device Driver Install Disk" -Neo.Service.Name = "Neo_VPN31" -Neo.Service.DispName = "VPN Client Device Driver - VPN31" -Neo.Service.Desc = "VPN Client Adapter - VPN31" -NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN31" -Neo.EventLog.Name = "Neo" -NetworkAddress = "MAC Address" -DefaultAddress = "000001000001" -MaxSpeed = "Indicate Speed (Mbps)" -KeepLink = "Keep Link" -On = "On" -Off = "Off" - - -; Auto Generated 20180205_163614.471 - +; VPN Client Device Driver for Windows 2000 and Greater +; +; Copyright (c) SoftEther Corporation. All Rights Reserved. +; http://www.softether.co.jp/ +; +; BUILD 9658 + +[Version] +Signature = "$Windows NT$" +Class = Net +ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} +Provider = %CompanyName% +DriverVer = 02/04/2018, 4.25.0.9658 +CatalogFile.NT = Neo6_x86_VPN31.cat + +[Manufacturer] +%CompanyName% = SoftEther + +[SourceDisksNames] +1=%DiskDescription%, "", , + +[SourceDisksFiles] +Neo6_x86_VPN31.sys = 1 + +[DestinationDirs] +DefaultDestDir = 12 +Neo.CopyFiles.Sys = 12 + +[Neo.CopyFiles.Sys] +Neo6_x86_VPN31.sys, , , 2 + +[SoftEther] +%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN31 + +[NeoAdapter.Install] +Characteristics = 0x1 +AddReg = Neo.Reg, NeoAdapter.Ndi +CopyFiles = Neo.CopyFiles.Sys +*IfType = 53 +*MediaType = 0 +*PhysicalMediaType = 0 + +[NeoAdapter.Install.Services] +AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% + +[NeoAdapter.Ndi] +HKR, , NetworkAddress, 0, %DefaultAddress% +HKR, Ndi, DeviceID, , "NeoAdapter_VPN31" +HKR, , DevLoader, , ndis +HKR, , DeviceVxDs, , Neo6_x86_VPN31.sys +HKR, NDIS, LogDriverName, , "Neo_VPN31" +HKR, NDIS, MajorNdisVersion, 1, 5 +HKR, NDIS, MinorNdisVersion, 1, 0 +HKR, Ndi\Interfaces, DefUpper, , "ndis5" +HKR, Ndi\Interfaces, UpperRange, , "ndis5" +HKR, Ndi\Interfaces, LowerRange, , "ethernet" +HKR, Ndi\Interfaces, DefLower, , "ethernet" +HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" +HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% +HKR, Ndi\Params\NetworkAddress, type, 0, "edit" +HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" +HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" +HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% +HKR, Ndi\Params\NetworkAddress, optional, 0, "0" +HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% +HKR, Ndi\Params\MaxSpeed, type, 0, "int" +HKR, Ndi\Params\MaxSpeed, default, 0, "100" +HKR, Ndi\Params\MaxSpeed, min, 0, "0" +HKR, Ndi\Params\MaxSpeed, max, 0, "2000" +HKR, Ndi\Params\MaxSpeed, step, 0, "1" +HKR, Ndi\Params\MaxSpeed, Base, 0, "10" +HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% +HKR, Ndi\Params\KeepLink, type, 0, "enum" +HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% +HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% +HKR, Ndi\Params\KeepLink, default, 0, "0" + + +[Neo.Service] +DisplayName = %Neo.Service.DispName% +Description = %Neo.Service.Desc% +ServiceType = 1 +StartType = 3 +ErrorControl = 1 +ServiceBinary = %12%\Neo6_x86_VPN31.sys +LoadOrderGroup = NDIS + +[Neo.Reg] +HKR, Ndi, Service, 0, Neo.Service.Name +HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" +HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" + +[Neo.EventLog] +HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN31.sys" +HKR, , TypesSupported, 0x00010001, 7 + +[Strings] +CompanyName = "SoftEther Corporation" +DiskDescription = "VPN Client Device Driver Install Disk" +Neo.Service.Name = "Neo_VPN31" +Neo.Service.DispName = "VPN Client Device Driver - VPN31" +Neo.Service.Desc = "VPN Client Adapter - VPN31" +NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN31" +Neo.EventLog.Name = "Neo" +NetworkAddress = "MAC Address" +DefaultAddress = "000001000001" +MaxSpeed = "Indicate Speed (Mbps)" +KeepLink = "Keep Link" +On = "On" +Off = "Off" + + +; Auto Generated 20180205_163614.471 + diff --git a/src/bin/hamcore/DriverPackages/Neo6_Win10/x86/Neo6_x86_VPN32.inf b/src/bin/hamcore/DriverPackages/Neo6_Win10/x86/Neo6_x86_VPN32.inf index f6d0807b..234a1298 100644 --- a/src/bin/hamcore/DriverPackages/Neo6_Win10/x86/Neo6_x86_VPN32.inf +++ b/src/bin/hamcore/DriverPackages/Neo6_Win10/x86/Neo6_x86_VPN32.inf @@ -1,114 +1,114 @@ -; VPN Client Device Driver for Windows 2000 and Greater -; -; Copyright (c) SoftEther Corporation. All Rights Reserved. -; http://www.softether.co.jp/ -; -; BUILD 9658 - -[Version] -Signature = "$Windows NT$" -Class = Net -ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} -Provider = %CompanyName% -DriverVer = 02/04/2018, 4.25.0.9658 -CatalogFile.NT = Neo6_x86_VPN32.cat - -[Manufacturer] -%CompanyName% = SoftEther - -[SourceDisksNames] -1=%DiskDescription%, "", , - -[SourceDisksFiles] -Neo6_x86_VPN32.sys = 1 - -[DestinationDirs] -DefaultDestDir = 12 -Neo.CopyFiles.Sys = 12 - -[Neo.CopyFiles.Sys] -Neo6_x86_VPN32.sys, , , 2 - -[SoftEther] -%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN32 - -[NeoAdapter.Install] -Characteristics = 0x1 -AddReg = Neo.Reg, NeoAdapter.Ndi -CopyFiles = Neo.CopyFiles.Sys -*IfType = 53 -*MediaType = 0 -*PhysicalMediaType = 0 - -[NeoAdapter.Install.Services] -AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% - -[NeoAdapter.Ndi] -HKR, , NetworkAddress, 0, %DefaultAddress% -HKR, Ndi, DeviceID, , "NeoAdapter_VPN32" -HKR, , DevLoader, , ndis -HKR, , DeviceVxDs, , Neo6_x86_VPN32.sys -HKR, NDIS, LogDriverName, , "Neo_VPN32" -HKR, NDIS, MajorNdisVersion, 1, 5 -HKR, NDIS, MinorNdisVersion, 1, 0 -HKR, Ndi\Interfaces, DefUpper, , "ndis5" -HKR, Ndi\Interfaces, UpperRange, , "ndis5" -HKR, Ndi\Interfaces, LowerRange, , "ethernet" -HKR, Ndi\Interfaces, DefLower, , "ethernet" -HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" -HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% -HKR, Ndi\Params\NetworkAddress, type, 0, "edit" -HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" -HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" -HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% -HKR, Ndi\Params\NetworkAddress, optional, 0, "0" -HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% -HKR, Ndi\Params\MaxSpeed, type, 0, "int" -HKR, Ndi\Params\MaxSpeed, default, 0, "100" -HKR, Ndi\Params\MaxSpeed, min, 0, "0" -HKR, Ndi\Params\MaxSpeed, max, 0, "2000" -HKR, Ndi\Params\MaxSpeed, step, 0, "1" -HKR, Ndi\Params\MaxSpeed, Base, 0, "10" -HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% -HKR, Ndi\Params\KeepLink, type, 0, "enum" -HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% -HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% -HKR, Ndi\Params\KeepLink, default, 0, "0" - - -[Neo.Service] -DisplayName = %Neo.Service.DispName% -Description = %Neo.Service.Desc% -ServiceType = 1 -StartType = 3 -ErrorControl = 1 -ServiceBinary = %12%\Neo6_x86_VPN32.sys -LoadOrderGroup = NDIS - -[Neo.Reg] -HKR, Ndi, Service, 0, Neo.Service.Name -HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" -HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" - -[Neo.EventLog] -HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN32.sys" -HKR, , TypesSupported, 0x00010001, 7 - -[Strings] -CompanyName = "SoftEther Corporation" -DiskDescription = "VPN Client Device Driver Install Disk" -Neo.Service.Name = "Neo_VPN32" -Neo.Service.DispName = "VPN Client Device Driver - VPN32" -Neo.Service.Desc = "VPN Client Adapter - VPN32" -NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN32" -Neo.EventLog.Name = "Neo" -NetworkAddress = "MAC Address" -DefaultAddress = "000001000001" -MaxSpeed = "Indicate Speed (Mbps)" -KeepLink = "Keep Link" -On = "On" -Off = "Off" - - -; Auto Generated 20180205_163614.542 - +; VPN Client Device Driver for Windows 2000 and Greater +; +; Copyright (c) SoftEther Corporation. All Rights Reserved. +; http://www.softether.co.jp/ +; +; BUILD 9658 + +[Version] +Signature = "$Windows NT$" +Class = Net +ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} +Provider = %CompanyName% +DriverVer = 02/04/2018, 4.25.0.9658 +CatalogFile.NT = Neo6_x86_VPN32.cat + +[Manufacturer] +%CompanyName% = SoftEther + +[SourceDisksNames] +1=%DiskDescription%, "", , + +[SourceDisksFiles] +Neo6_x86_VPN32.sys = 1 + +[DestinationDirs] +DefaultDestDir = 12 +Neo.CopyFiles.Sys = 12 + +[Neo.CopyFiles.Sys] +Neo6_x86_VPN32.sys, , , 2 + +[SoftEther] +%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN32 + +[NeoAdapter.Install] +Characteristics = 0x1 +AddReg = Neo.Reg, NeoAdapter.Ndi +CopyFiles = Neo.CopyFiles.Sys +*IfType = 53 +*MediaType = 0 +*PhysicalMediaType = 0 + +[NeoAdapter.Install.Services] +AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% + +[NeoAdapter.Ndi] +HKR, , NetworkAddress, 0, %DefaultAddress% +HKR, Ndi, DeviceID, , "NeoAdapter_VPN32" +HKR, , DevLoader, , ndis +HKR, , DeviceVxDs, , Neo6_x86_VPN32.sys +HKR, NDIS, LogDriverName, , "Neo_VPN32" +HKR, NDIS, MajorNdisVersion, 1, 5 +HKR, NDIS, MinorNdisVersion, 1, 0 +HKR, Ndi\Interfaces, DefUpper, , "ndis5" +HKR, Ndi\Interfaces, UpperRange, , "ndis5" +HKR, Ndi\Interfaces, LowerRange, , "ethernet" +HKR, Ndi\Interfaces, DefLower, , "ethernet" +HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" +HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% +HKR, Ndi\Params\NetworkAddress, type, 0, "edit" +HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" +HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" +HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% +HKR, Ndi\Params\NetworkAddress, optional, 0, "0" +HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% +HKR, Ndi\Params\MaxSpeed, type, 0, "int" +HKR, Ndi\Params\MaxSpeed, default, 0, "100" +HKR, Ndi\Params\MaxSpeed, min, 0, "0" +HKR, Ndi\Params\MaxSpeed, max, 0, "2000" +HKR, Ndi\Params\MaxSpeed, step, 0, "1" +HKR, Ndi\Params\MaxSpeed, Base, 0, "10" +HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% +HKR, Ndi\Params\KeepLink, type, 0, "enum" +HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% +HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% +HKR, Ndi\Params\KeepLink, default, 0, "0" + + +[Neo.Service] +DisplayName = %Neo.Service.DispName% +Description = %Neo.Service.Desc% +ServiceType = 1 +StartType = 3 +ErrorControl = 1 +ServiceBinary = %12%\Neo6_x86_VPN32.sys +LoadOrderGroup = NDIS + +[Neo.Reg] +HKR, Ndi, Service, 0, Neo.Service.Name +HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" +HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" + +[Neo.EventLog] +HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN32.sys" +HKR, , TypesSupported, 0x00010001, 7 + +[Strings] +CompanyName = "SoftEther Corporation" +DiskDescription = "VPN Client Device Driver Install Disk" +Neo.Service.Name = "Neo_VPN32" +Neo.Service.DispName = "VPN Client Device Driver - VPN32" +Neo.Service.Desc = "VPN Client Adapter - VPN32" +NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN32" +Neo.EventLog.Name = "Neo" +NetworkAddress = "MAC Address" +DefaultAddress = "000001000001" +MaxSpeed = "Indicate Speed (Mbps)" +KeepLink = "Keep Link" +On = "On" +Off = "Off" + + +; Auto Generated 20180205_163614.542 + diff --git a/src/bin/hamcore/DriverPackages/Neo6_Win10/x86/Neo6_x86_VPN33.inf b/src/bin/hamcore/DriverPackages/Neo6_Win10/x86/Neo6_x86_VPN33.inf index 80b55e59..1f55548d 100644 --- a/src/bin/hamcore/DriverPackages/Neo6_Win10/x86/Neo6_x86_VPN33.inf +++ b/src/bin/hamcore/DriverPackages/Neo6_Win10/x86/Neo6_x86_VPN33.inf @@ -1,114 +1,114 @@ -; VPN Client Device Driver for Windows 2000 and Greater -; -; Copyright (c) SoftEther Corporation. All Rights Reserved. -; http://www.softether.co.jp/ -; -; BUILD 9658 - -[Version] -Signature = "$Windows NT$" -Class = Net -ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} -Provider = %CompanyName% -DriverVer = 02/04/2018, 4.25.0.9658 -CatalogFile.NT = Neo6_x86_VPN33.cat - -[Manufacturer] -%CompanyName% = SoftEther - -[SourceDisksNames] -1=%DiskDescription%, "", , - -[SourceDisksFiles] -Neo6_x86_VPN33.sys = 1 - -[DestinationDirs] -DefaultDestDir = 12 -Neo.CopyFiles.Sys = 12 - -[Neo.CopyFiles.Sys] -Neo6_x86_VPN33.sys, , , 2 - -[SoftEther] -%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN33 - -[NeoAdapter.Install] -Characteristics = 0x1 -AddReg = Neo.Reg, NeoAdapter.Ndi -CopyFiles = Neo.CopyFiles.Sys -*IfType = 53 -*MediaType = 0 -*PhysicalMediaType = 0 - -[NeoAdapter.Install.Services] -AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% - -[NeoAdapter.Ndi] -HKR, , NetworkAddress, 0, %DefaultAddress% -HKR, Ndi, DeviceID, , "NeoAdapter_VPN33" -HKR, , DevLoader, , ndis -HKR, , DeviceVxDs, , Neo6_x86_VPN33.sys -HKR, NDIS, LogDriverName, , "Neo_VPN33" -HKR, NDIS, MajorNdisVersion, 1, 5 -HKR, NDIS, MinorNdisVersion, 1, 0 -HKR, Ndi\Interfaces, DefUpper, , "ndis5" -HKR, Ndi\Interfaces, UpperRange, , "ndis5" -HKR, Ndi\Interfaces, LowerRange, , "ethernet" -HKR, Ndi\Interfaces, DefLower, , "ethernet" -HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" -HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% -HKR, Ndi\Params\NetworkAddress, type, 0, "edit" -HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" -HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" -HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% -HKR, Ndi\Params\NetworkAddress, optional, 0, "0" -HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% -HKR, Ndi\Params\MaxSpeed, type, 0, "int" -HKR, Ndi\Params\MaxSpeed, default, 0, "100" -HKR, Ndi\Params\MaxSpeed, min, 0, "0" -HKR, Ndi\Params\MaxSpeed, max, 0, "2000" -HKR, Ndi\Params\MaxSpeed, step, 0, "1" -HKR, Ndi\Params\MaxSpeed, Base, 0, "10" -HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% -HKR, Ndi\Params\KeepLink, type, 0, "enum" -HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% -HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% -HKR, Ndi\Params\KeepLink, default, 0, "0" - - -[Neo.Service] -DisplayName = %Neo.Service.DispName% -Description = %Neo.Service.Desc% -ServiceType = 1 -StartType = 3 -ErrorControl = 1 -ServiceBinary = %12%\Neo6_x86_VPN33.sys -LoadOrderGroup = NDIS - -[Neo.Reg] -HKR, Ndi, Service, 0, Neo.Service.Name -HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" -HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" - -[Neo.EventLog] -HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN33.sys" -HKR, , TypesSupported, 0x00010001, 7 - -[Strings] -CompanyName = "SoftEther Corporation" -DiskDescription = "VPN Client Device Driver Install Disk" -Neo.Service.Name = "Neo_VPN33" -Neo.Service.DispName = "VPN Client Device Driver - VPN33" -Neo.Service.Desc = "VPN Client Adapter - VPN33" -NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN33" -Neo.EventLog.Name = "Neo" -NetworkAddress = "MAC Address" -DefaultAddress = "000001000001" -MaxSpeed = "Indicate Speed (Mbps)" -KeepLink = "Keep Link" -On = "On" -Off = "Off" - - -; Auto Generated 20180205_163614.614 - +; VPN Client Device Driver for Windows 2000 and Greater +; +; Copyright (c) SoftEther Corporation. All Rights Reserved. +; http://www.softether.co.jp/ +; +; BUILD 9658 + +[Version] +Signature = "$Windows NT$" +Class = Net +ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} +Provider = %CompanyName% +DriverVer = 02/04/2018, 4.25.0.9658 +CatalogFile.NT = Neo6_x86_VPN33.cat + +[Manufacturer] +%CompanyName% = SoftEther + +[SourceDisksNames] +1=%DiskDescription%, "", , + +[SourceDisksFiles] +Neo6_x86_VPN33.sys = 1 + +[DestinationDirs] +DefaultDestDir = 12 +Neo.CopyFiles.Sys = 12 + +[Neo.CopyFiles.Sys] +Neo6_x86_VPN33.sys, , , 2 + +[SoftEther] +%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN33 + +[NeoAdapter.Install] +Characteristics = 0x1 +AddReg = Neo.Reg, NeoAdapter.Ndi +CopyFiles = Neo.CopyFiles.Sys +*IfType = 53 +*MediaType = 0 +*PhysicalMediaType = 0 + +[NeoAdapter.Install.Services] +AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% + +[NeoAdapter.Ndi] +HKR, , NetworkAddress, 0, %DefaultAddress% +HKR, Ndi, DeviceID, , "NeoAdapter_VPN33" +HKR, , DevLoader, , ndis +HKR, , DeviceVxDs, , Neo6_x86_VPN33.sys +HKR, NDIS, LogDriverName, , "Neo_VPN33" +HKR, NDIS, MajorNdisVersion, 1, 5 +HKR, NDIS, MinorNdisVersion, 1, 0 +HKR, Ndi\Interfaces, DefUpper, , "ndis5" +HKR, Ndi\Interfaces, UpperRange, , "ndis5" +HKR, Ndi\Interfaces, LowerRange, , "ethernet" +HKR, Ndi\Interfaces, DefLower, , "ethernet" +HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" +HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% +HKR, Ndi\Params\NetworkAddress, type, 0, "edit" +HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" +HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" +HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% +HKR, Ndi\Params\NetworkAddress, optional, 0, "0" +HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% +HKR, Ndi\Params\MaxSpeed, type, 0, "int" +HKR, Ndi\Params\MaxSpeed, default, 0, "100" +HKR, Ndi\Params\MaxSpeed, min, 0, "0" +HKR, Ndi\Params\MaxSpeed, max, 0, "2000" +HKR, Ndi\Params\MaxSpeed, step, 0, "1" +HKR, Ndi\Params\MaxSpeed, Base, 0, "10" +HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% +HKR, Ndi\Params\KeepLink, type, 0, "enum" +HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% +HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% +HKR, Ndi\Params\KeepLink, default, 0, "0" + + +[Neo.Service] +DisplayName = %Neo.Service.DispName% +Description = %Neo.Service.Desc% +ServiceType = 1 +StartType = 3 +ErrorControl = 1 +ServiceBinary = %12%\Neo6_x86_VPN33.sys +LoadOrderGroup = NDIS + +[Neo.Reg] +HKR, Ndi, Service, 0, Neo.Service.Name +HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" +HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" + +[Neo.EventLog] +HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN33.sys" +HKR, , TypesSupported, 0x00010001, 7 + +[Strings] +CompanyName = "SoftEther Corporation" +DiskDescription = "VPN Client Device Driver Install Disk" +Neo.Service.Name = "Neo_VPN33" +Neo.Service.DispName = "VPN Client Device Driver - VPN33" +Neo.Service.Desc = "VPN Client Adapter - VPN33" +NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN33" +Neo.EventLog.Name = "Neo" +NetworkAddress = "MAC Address" +DefaultAddress = "000001000001" +MaxSpeed = "Indicate Speed (Mbps)" +KeepLink = "Keep Link" +On = "On" +Off = "Off" + + +; Auto Generated 20180205_163614.614 + diff --git a/src/bin/hamcore/DriverPackages/Neo6_Win10/x86/Neo6_x86_VPN34.inf b/src/bin/hamcore/DriverPackages/Neo6_Win10/x86/Neo6_x86_VPN34.inf index 7a49bd8c..16a6b61b 100644 --- a/src/bin/hamcore/DriverPackages/Neo6_Win10/x86/Neo6_x86_VPN34.inf +++ b/src/bin/hamcore/DriverPackages/Neo6_Win10/x86/Neo6_x86_VPN34.inf @@ -1,114 +1,114 @@ -; VPN Client Device Driver for Windows 2000 and Greater -; -; Copyright (c) SoftEther Corporation. All Rights Reserved. -; http://www.softether.co.jp/ -; -; BUILD 9658 - -[Version] -Signature = "$Windows NT$" -Class = Net -ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} -Provider = %CompanyName% -DriverVer = 02/04/2018, 4.25.0.9658 -CatalogFile.NT = Neo6_x86_VPN34.cat - -[Manufacturer] -%CompanyName% = SoftEther - -[SourceDisksNames] -1=%DiskDescription%, "", , - -[SourceDisksFiles] -Neo6_x86_VPN34.sys = 1 - -[DestinationDirs] -DefaultDestDir = 12 -Neo.CopyFiles.Sys = 12 - -[Neo.CopyFiles.Sys] -Neo6_x86_VPN34.sys, , , 2 - -[SoftEther] -%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN34 - -[NeoAdapter.Install] -Characteristics = 0x1 -AddReg = Neo.Reg, NeoAdapter.Ndi -CopyFiles = Neo.CopyFiles.Sys -*IfType = 53 -*MediaType = 0 -*PhysicalMediaType = 0 - -[NeoAdapter.Install.Services] -AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% - -[NeoAdapter.Ndi] -HKR, , NetworkAddress, 0, %DefaultAddress% -HKR, Ndi, DeviceID, , "NeoAdapter_VPN34" -HKR, , DevLoader, , ndis -HKR, , DeviceVxDs, , Neo6_x86_VPN34.sys -HKR, NDIS, LogDriverName, , "Neo_VPN34" -HKR, NDIS, MajorNdisVersion, 1, 5 -HKR, NDIS, MinorNdisVersion, 1, 0 -HKR, Ndi\Interfaces, DefUpper, , "ndis5" -HKR, Ndi\Interfaces, UpperRange, , "ndis5" -HKR, Ndi\Interfaces, LowerRange, , "ethernet" -HKR, Ndi\Interfaces, DefLower, , "ethernet" -HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" -HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% -HKR, Ndi\Params\NetworkAddress, type, 0, "edit" -HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" -HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" -HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% -HKR, Ndi\Params\NetworkAddress, optional, 0, "0" -HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% -HKR, Ndi\Params\MaxSpeed, type, 0, "int" -HKR, Ndi\Params\MaxSpeed, default, 0, "100" -HKR, Ndi\Params\MaxSpeed, min, 0, "0" -HKR, Ndi\Params\MaxSpeed, max, 0, "2000" -HKR, Ndi\Params\MaxSpeed, step, 0, "1" -HKR, Ndi\Params\MaxSpeed, Base, 0, "10" -HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% -HKR, Ndi\Params\KeepLink, type, 0, "enum" -HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% -HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% -HKR, Ndi\Params\KeepLink, default, 0, "0" - - -[Neo.Service] -DisplayName = %Neo.Service.DispName% -Description = %Neo.Service.Desc% -ServiceType = 1 -StartType = 3 -ErrorControl = 1 -ServiceBinary = %12%\Neo6_x86_VPN34.sys -LoadOrderGroup = NDIS - -[Neo.Reg] -HKR, Ndi, Service, 0, Neo.Service.Name -HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" -HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" - -[Neo.EventLog] -HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN34.sys" -HKR, , TypesSupported, 0x00010001, 7 - -[Strings] -CompanyName = "SoftEther Corporation" -DiskDescription = "VPN Client Device Driver Install Disk" -Neo.Service.Name = "Neo_VPN34" -Neo.Service.DispName = "VPN Client Device Driver - VPN34" -Neo.Service.Desc = "VPN Client Adapter - VPN34" -NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN34" -Neo.EventLog.Name = "Neo" -NetworkAddress = "MAC Address" -DefaultAddress = "000001000001" -MaxSpeed = "Indicate Speed (Mbps)" -KeepLink = "Keep Link" -On = "On" -Off = "Off" - - -; Auto Generated 20180205_163614.684 - +; VPN Client Device Driver for Windows 2000 and Greater +; +; Copyright (c) SoftEther Corporation. All Rights Reserved. +; http://www.softether.co.jp/ +; +; BUILD 9658 + +[Version] +Signature = "$Windows NT$" +Class = Net +ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} +Provider = %CompanyName% +DriverVer = 02/04/2018, 4.25.0.9658 +CatalogFile.NT = Neo6_x86_VPN34.cat + +[Manufacturer] +%CompanyName% = SoftEther + +[SourceDisksNames] +1=%DiskDescription%, "", , + +[SourceDisksFiles] +Neo6_x86_VPN34.sys = 1 + +[DestinationDirs] +DefaultDestDir = 12 +Neo.CopyFiles.Sys = 12 + +[Neo.CopyFiles.Sys] +Neo6_x86_VPN34.sys, , , 2 + +[SoftEther] +%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN34 + +[NeoAdapter.Install] +Characteristics = 0x1 +AddReg = Neo.Reg, NeoAdapter.Ndi +CopyFiles = Neo.CopyFiles.Sys +*IfType = 53 +*MediaType = 0 +*PhysicalMediaType = 0 + +[NeoAdapter.Install.Services] +AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% + +[NeoAdapter.Ndi] +HKR, , NetworkAddress, 0, %DefaultAddress% +HKR, Ndi, DeviceID, , "NeoAdapter_VPN34" +HKR, , DevLoader, , ndis +HKR, , DeviceVxDs, , Neo6_x86_VPN34.sys +HKR, NDIS, LogDriverName, , "Neo_VPN34" +HKR, NDIS, MajorNdisVersion, 1, 5 +HKR, NDIS, MinorNdisVersion, 1, 0 +HKR, Ndi\Interfaces, DefUpper, , "ndis5" +HKR, Ndi\Interfaces, UpperRange, , "ndis5" +HKR, Ndi\Interfaces, LowerRange, , "ethernet" +HKR, Ndi\Interfaces, DefLower, , "ethernet" +HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" +HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% +HKR, Ndi\Params\NetworkAddress, type, 0, "edit" +HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" +HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" +HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% +HKR, Ndi\Params\NetworkAddress, optional, 0, "0" +HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% +HKR, Ndi\Params\MaxSpeed, type, 0, "int" +HKR, Ndi\Params\MaxSpeed, default, 0, "100" +HKR, Ndi\Params\MaxSpeed, min, 0, "0" +HKR, Ndi\Params\MaxSpeed, max, 0, "2000" +HKR, Ndi\Params\MaxSpeed, step, 0, "1" +HKR, Ndi\Params\MaxSpeed, Base, 0, "10" +HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% +HKR, Ndi\Params\KeepLink, type, 0, "enum" +HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% +HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% +HKR, Ndi\Params\KeepLink, default, 0, "0" + + +[Neo.Service] +DisplayName = %Neo.Service.DispName% +Description = %Neo.Service.Desc% +ServiceType = 1 +StartType = 3 +ErrorControl = 1 +ServiceBinary = %12%\Neo6_x86_VPN34.sys +LoadOrderGroup = NDIS + +[Neo.Reg] +HKR, Ndi, Service, 0, Neo.Service.Name +HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" +HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" + +[Neo.EventLog] +HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN34.sys" +HKR, , TypesSupported, 0x00010001, 7 + +[Strings] +CompanyName = "SoftEther Corporation" +DiskDescription = "VPN Client Device Driver Install Disk" +Neo.Service.Name = "Neo_VPN34" +Neo.Service.DispName = "VPN Client Device Driver - VPN34" +Neo.Service.Desc = "VPN Client Adapter - VPN34" +NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN34" +Neo.EventLog.Name = "Neo" +NetworkAddress = "MAC Address" +DefaultAddress = "000001000001" +MaxSpeed = "Indicate Speed (Mbps)" +KeepLink = "Keep Link" +On = "On" +Off = "Off" + + +; Auto Generated 20180205_163614.684 + diff --git a/src/bin/hamcore/DriverPackages/Neo6_Win10/x86/Neo6_x86_VPN35.inf b/src/bin/hamcore/DriverPackages/Neo6_Win10/x86/Neo6_x86_VPN35.inf index a2307dc6..7b814c70 100644 --- a/src/bin/hamcore/DriverPackages/Neo6_Win10/x86/Neo6_x86_VPN35.inf +++ b/src/bin/hamcore/DriverPackages/Neo6_Win10/x86/Neo6_x86_VPN35.inf @@ -1,114 +1,114 @@ -; VPN Client Device Driver for Windows 2000 and Greater -; -; Copyright (c) SoftEther Corporation. All Rights Reserved. -; http://www.softether.co.jp/ -; -; BUILD 9658 - -[Version] -Signature = "$Windows NT$" -Class = Net -ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} -Provider = %CompanyName% -DriverVer = 02/04/2018, 4.25.0.9658 -CatalogFile.NT = Neo6_x86_VPN35.cat - -[Manufacturer] -%CompanyName% = SoftEther - -[SourceDisksNames] -1=%DiskDescription%, "", , - -[SourceDisksFiles] -Neo6_x86_VPN35.sys = 1 - -[DestinationDirs] -DefaultDestDir = 12 -Neo.CopyFiles.Sys = 12 - -[Neo.CopyFiles.Sys] -Neo6_x86_VPN35.sys, , , 2 - -[SoftEther] -%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN35 - -[NeoAdapter.Install] -Characteristics = 0x1 -AddReg = Neo.Reg, NeoAdapter.Ndi -CopyFiles = Neo.CopyFiles.Sys -*IfType = 53 -*MediaType = 0 -*PhysicalMediaType = 0 - -[NeoAdapter.Install.Services] -AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% - -[NeoAdapter.Ndi] -HKR, , NetworkAddress, 0, %DefaultAddress% -HKR, Ndi, DeviceID, , "NeoAdapter_VPN35" -HKR, , DevLoader, , ndis -HKR, , DeviceVxDs, , Neo6_x86_VPN35.sys -HKR, NDIS, LogDriverName, , "Neo_VPN35" -HKR, NDIS, MajorNdisVersion, 1, 5 -HKR, NDIS, MinorNdisVersion, 1, 0 -HKR, Ndi\Interfaces, DefUpper, , "ndis5" -HKR, Ndi\Interfaces, UpperRange, , "ndis5" -HKR, Ndi\Interfaces, LowerRange, , "ethernet" -HKR, Ndi\Interfaces, DefLower, , "ethernet" -HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" -HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% -HKR, Ndi\Params\NetworkAddress, type, 0, "edit" -HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" -HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" -HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% -HKR, Ndi\Params\NetworkAddress, optional, 0, "0" -HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% -HKR, Ndi\Params\MaxSpeed, type, 0, "int" -HKR, Ndi\Params\MaxSpeed, default, 0, "100" -HKR, Ndi\Params\MaxSpeed, min, 0, "0" -HKR, Ndi\Params\MaxSpeed, max, 0, "2000" -HKR, Ndi\Params\MaxSpeed, step, 0, "1" -HKR, Ndi\Params\MaxSpeed, Base, 0, "10" -HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% -HKR, Ndi\Params\KeepLink, type, 0, "enum" -HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% -HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% -HKR, Ndi\Params\KeepLink, default, 0, "0" - - -[Neo.Service] -DisplayName = %Neo.Service.DispName% -Description = %Neo.Service.Desc% -ServiceType = 1 -StartType = 3 -ErrorControl = 1 -ServiceBinary = %12%\Neo6_x86_VPN35.sys -LoadOrderGroup = NDIS - -[Neo.Reg] -HKR, Ndi, Service, 0, Neo.Service.Name -HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" -HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" - -[Neo.EventLog] -HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN35.sys" -HKR, , TypesSupported, 0x00010001, 7 - -[Strings] -CompanyName = "SoftEther Corporation" -DiskDescription = "VPN Client Device Driver Install Disk" -Neo.Service.Name = "Neo_VPN35" -Neo.Service.DispName = "VPN Client Device Driver - VPN35" -Neo.Service.Desc = "VPN Client Adapter - VPN35" -NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN35" -Neo.EventLog.Name = "Neo" -NetworkAddress = "MAC Address" -DefaultAddress = "000001000001" -MaxSpeed = "Indicate Speed (Mbps)" -KeepLink = "Keep Link" -On = "On" -Off = "Off" - - -; Auto Generated 20180205_163614.753 - +; VPN Client Device Driver for Windows 2000 and Greater +; +; Copyright (c) SoftEther Corporation. All Rights Reserved. +; http://www.softether.co.jp/ +; +; BUILD 9658 + +[Version] +Signature = "$Windows NT$" +Class = Net +ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} +Provider = %CompanyName% +DriverVer = 02/04/2018, 4.25.0.9658 +CatalogFile.NT = Neo6_x86_VPN35.cat + +[Manufacturer] +%CompanyName% = SoftEther + +[SourceDisksNames] +1=%DiskDescription%, "", , + +[SourceDisksFiles] +Neo6_x86_VPN35.sys = 1 + +[DestinationDirs] +DefaultDestDir = 12 +Neo.CopyFiles.Sys = 12 + +[Neo.CopyFiles.Sys] +Neo6_x86_VPN35.sys, , , 2 + +[SoftEther] +%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN35 + +[NeoAdapter.Install] +Characteristics = 0x1 +AddReg = Neo.Reg, NeoAdapter.Ndi +CopyFiles = Neo.CopyFiles.Sys +*IfType = 53 +*MediaType = 0 +*PhysicalMediaType = 0 + +[NeoAdapter.Install.Services] +AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% + +[NeoAdapter.Ndi] +HKR, , NetworkAddress, 0, %DefaultAddress% +HKR, Ndi, DeviceID, , "NeoAdapter_VPN35" +HKR, , DevLoader, , ndis +HKR, , DeviceVxDs, , Neo6_x86_VPN35.sys +HKR, NDIS, LogDriverName, , "Neo_VPN35" +HKR, NDIS, MajorNdisVersion, 1, 5 +HKR, NDIS, MinorNdisVersion, 1, 0 +HKR, Ndi\Interfaces, DefUpper, , "ndis5" +HKR, Ndi\Interfaces, UpperRange, , "ndis5" +HKR, Ndi\Interfaces, LowerRange, , "ethernet" +HKR, Ndi\Interfaces, DefLower, , "ethernet" +HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" +HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% +HKR, Ndi\Params\NetworkAddress, type, 0, "edit" +HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" +HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" +HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% +HKR, Ndi\Params\NetworkAddress, optional, 0, "0" +HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% +HKR, Ndi\Params\MaxSpeed, type, 0, "int" +HKR, Ndi\Params\MaxSpeed, default, 0, "100" +HKR, Ndi\Params\MaxSpeed, min, 0, "0" +HKR, Ndi\Params\MaxSpeed, max, 0, "2000" +HKR, Ndi\Params\MaxSpeed, step, 0, "1" +HKR, Ndi\Params\MaxSpeed, Base, 0, "10" +HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% +HKR, Ndi\Params\KeepLink, type, 0, "enum" +HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% +HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% +HKR, Ndi\Params\KeepLink, default, 0, "0" + + +[Neo.Service] +DisplayName = %Neo.Service.DispName% +Description = %Neo.Service.Desc% +ServiceType = 1 +StartType = 3 +ErrorControl = 1 +ServiceBinary = %12%\Neo6_x86_VPN35.sys +LoadOrderGroup = NDIS + +[Neo.Reg] +HKR, Ndi, Service, 0, Neo.Service.Name +HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" +HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" + +[Neo.EventLog] +HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN35.sys" +HKR, , TypesSupported, 0x00010001, 7 + +[Strings] +CompanyName = "SoftEther Corporation" +DiskDescription = "VPN Client Device Driver Install Disk" +Neo.Service.Name = "Neo_VPN35" +Neo.Service.DispName = "VPN Client Device Driver - VPN35" +Neo.Service.Desc = "VPN Client Adapter - VPN35" +NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN35" +Neo.EventLog.Name = "Neo" +NetworkAddress = "MAC Address" +DefaultAddress = "000001000001" +MaxSpeed = "Indicate Speed (Mbps)" +KeepLink = "Keep Link" +On = "On" +Off = "Off" + + +; Auto Generated 20180205_163614.753 + diff --git a/src/bin/hamcore/DriverPackages/Neo6_Win10/x86/Neo6_x86_VPN36.inf b/src/bin/hamcore/DriverPackages/Neo6_Win10/x86/Neo6_x86_VPN36.inf index 273f37d7..2d2bd55e 100644 --- a/src/bin/hamcore/DriverPackages/Neo6_Win10/x86/Neo6_x86_VPN36.inf +++ b/src/bin/hamcore/DriverPackages/Neo6_Win10/x86/Neo6_x86_VPN36.inf @@ -1,114 +1,114 @@ -; VPN Client Device Driver for Windows 2000 and Greater -; -; Copyright (c) SoftEther Corporation. All Rights Reserved. -; http://www.softether.co.jp/ -; -; BUILD 9658 - -[Version] -Signature = "$Windows NT$" -Class = Net -ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} -Provider = %CompanyName% -DriverVer = 02/04/2018, 4.25.0.9658 -CatalogFile.NT = Neo6_x86_VPN36.cat - -[Manufacturer] -%CompanyName% = SoftEther - -[SourceDisksNames] -1=%DiskDescription%, "", , - -[SourceDisksFiles] -Neo6_x86_VPN36.sys = 1 - -[DestinationDirs] -DefaultDestDir = 12 -Neo.CopyFiles.Sys = 12 - -[Neo.CopyFiles.Sys] -Neo6_x86_VPN36.sys, , , 2 - -[SoftEther] -%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN36 - -[NeoAdapter.Install] -Characteristics = 0x1 -AddReg = Neo.Reg, NeoAdapter.Ndi -CopyFiles = Neo.CopyFiles.Sys -*IfType = 53 -*MediaType = 0 -*PhysicalMediaType = 0 - -[NeoAdapter.Install.Services] -AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% - -[NeoAdapter.Ndi] -HKR, , NetworkAddress, 0, %DefaultAddress% -HKR, Ndi, DeviceID, , "NeoAdapter_VPN36" -HKR, , DevLoader, , ndis -HKR, , DeviceVxDs, , Neo6_x86_VPN36.sys -HKR, NDIS, LogDriverName, , "Neo_VPN36" -HKR, NDIS, MajorNdisVersion, 1, 5 -HKR, NDIS, MinorNdisVersion, 1, 0 -HKR, Ndi\Interfaces, DefUpper, , "ndis5" -HKR, Ndi\Interfaces, UpperRange, , "ndis5" -HKR, Ndi\Interfaces, LowerRange, , "ethernet" -HKR, Ndi\Interfaces, DefLower, , "ethernet" -HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" -HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% -HKR, Ndi\Params\NetworkAddress, type, 0, "edit" -HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" -HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" -HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% -HKR, Ndi\Params\NetworkAddress, optional, 0, "0" -HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% -HKR, Ndi\Params\MaxSpeed, type, 0, "int" -HKR, Ndi\Params\MaxSpeed, default, 0, "100" -HKR, Ndi\Params\MaxSpeed, min, 0, "0" -HKR, Ndi\Params\MaxSpeed, max, 0, "2000" -HKR, Ndi\Params\MaxSpeed, step, 0, "1" -HKR, Ndi\Params\MaxSpeed, Base, 0, "10" -HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% -HKR, Ndi\Params\KeepLink, type, 0, "enum" -HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% -HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% -HKR, Ndi\Params\KeepLink, default, 0, "0" - - -[Neo.Service] -DisplayName = %Neo.Service.DispName% -Description = %Neo.Service.Desc% -ServiceType = 1 -StartType = 3 -ErrorControl = 1 -ServiceBinary = %12%\Neo6_x86_VPN36.sys -LoadOrderGroup = NDIS - -[Neo.Reg] -HKR, Ndi, Service, 0, Neo.Service.Name -HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" -HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" - -[Neo.EventLog] -HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN36.sys" -HKR, , TypesSupported, 0x00010001, 7 - -[Strings] -CompanyName = "SoftEther Corporation" -DiskDescription = "VPN Client Device Driver Install Disk" -Neo.Service.Name = "Neo_VPN36" -Neo.Service.DispName = "VPN Client Device Driver - VPN36" -Neo.Service.Desc = "VPN Client Adapter - VPN36" -NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN36" -Neo.EventLog.Name = "Neo" -NetworkAddress = "MAC Address" -DefaultAddress = "000001000001" -MaxSpeed = "Indicate Speed (Mbps)" -KeepLink = "Keep Link" -On = "On" -Off = "Off" - - -; Auto Generated 20180205_163614.824 - +; VPN Client Device Driver for Windows 2000 and Greater +; +; Copyright (c) SoftEther Corporation. All Rights Reserved. +; http://www.softether.co.jp/ +; +; BUILD 9658 + +[Version] +Signature = "$Windows NT$" +Class = Net +ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} +Provider = %CompanyName% +DriverVer = 02/04/2018, 4.25.0.9658 +CatalogFile.NT = Neo6_x86_VPN36.cat + +[Manufacturer] +%CompanyName% = SoftEther + +[SourceDisksNames] +1=%DiskDescription%, "", , + +[SourceDisksFiles] +Neo6_x86_VPN36.sys = 1 + +[DestinationDirs] +DefaultDestDir = 12 +Neo.CopyFiles.Sys = 12 + +[Neo.CopyFiles.Sys] +Neo6_x86_VPN36.sys, , , 2 + +[SoftEther] +%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN36 + +[NeoAdapter.Install] +Characteristics = 0x1 +AddReg = Neo.Reg, NeoAdapter.Ndi +CopyFiles = Neo.CopyFiles.Sys +*IfType = 53 +*MediaType = 0 +*PhysicalMediaType = 0 + +[NeoAdapter.Install.Services] +AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% + +[NeoAdapter.Ndi] +HKR, , NetworkAddress, 0, %DefaultAddress% +HKR, Ndi, DeviceID, , "NeoAdapter_VPN36" +HKR, , DevLoader, , ndis +HKR, , DeviceVxDs, , Neo6_x86_VPN36.sys +HKR, NDIS, LogDriverName, , "Neo_VPN36" +HKR, NDIS, MajorNdisVersion, 1, 5 +HKR, NDIS, MinorNdisVersion, 1, 0 +HKR, Ndi\Interfaces, DefUpper, , "ndis5" +HKR, Ndi\Interfaces, UpperRange, , "ndis5" +HKR, Ndi\Interfaces, LowerRange, , "ethernet" +HKR, Ndi\Interfaces, DefLower, , "ethernet" +HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" +HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% +HKR, Ndi\Params\NetworkAddress, type, 0, "edit" +HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" +HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" +HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% +HKR, Ndi\Params\NetworkAddress, optional, 0, "0" +HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% +HKR, Ndi\Params\MaxSpeed, type, 0, "int" +HKR, Ndi\Params\MaxSpeed, default, 0, "100" +HKR, Ndi\Params\MaxSpeed, min, 0, "0" +HKR, Ndi\Params\MaxSpeed, max, 0, "2000" +HKR, Ndi\Params\MaxSpeed, step, 0, "1" +HKR, Ndi\Params\MaxSpeed, Base, 0, "10" +HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% +HKR, Ndi\Params\KeepLink, type, 0, "enum" +HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% +HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% +HKR, Ndi\Params\KeepLink, default, 0, "0" + + +[Neo.Service] +DisplayName = %Neo.Service.DispName% +Description = %Neo.Service.Desc% +ServiceType = 1 +StartType = 3 +ErrorControl = 1 +ServiceBinary = %12%\Neo6_x86_VPN36.sys +LoadOrderGroup = NDIS + +[Neo.Reg] +HKR, Ndi, Service, 0, Neo.Service.Name +HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" +HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" + +[Neo.EventLog] +HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN36.sys" +HKR, , TypesSupported, 0x00010001, 7 + +[Strings] +CompanyName = "SoftEther Corporation" +DiskDescription = "VPN Client Device Driver Install Disk" +Neo.Service.Name = "Neo_VPN36" +Neo.Service.DispName = "VPN Client Device Driver - VPN36" +Neo.Service.Desc = "VPN Client Adapter - VPN36" +NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN36" +Neo.EventLog.Name = "Neo" +NetworkAddress = "MAC Address" +DefaultAddress = "000001000001" +MaxSpeed = "Indicate Speed (Mbps)" +KeepLink = "Keep Link" +On = "On" +Off = "Off" + + +; Auto Generated 20180205_163614.824 + diff --git a/src/bin/hamcore/DriverPackages/Neo6_Win10/x86/Neo6_x86_VPN37.inf b/src/bin/hamcore/DriverPackages/Neo6_Win10/x86/Neo6_x86_VPN37.inf index 77bde18d..44293057 100644 --- a/src/bin/hamcore/DriverPackages/Neo6_Win10/x86/Neo6_x86_VPN37.inf +++ b/src/bin/hamcore/DriverPackages/Neo6_Win10/x86/Neo6_x86_VPN37.inf @@ -1,114 +1,114 @@ -; VPN Client Device Driver for Windows 2000 and Greater -; -; Copyright (c) SoftEther Corporation. All Rights Reserved. -; http://www.softether.co.jp/ -; -; BUILD 9658 - -[Version] -Signature = "$Windows NT$" -Class = Net -ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} -Provider = %CompanyName% -DriverVer = 02/04/2018, 4.25.0.9658 -CatalogFile.NT = Neo6_x86_VPN37.cat - -[Manufacturer] -%CompanyName% = SoftEther - -[SourceDisksNames] -1=%DiskDescription%, "", , - -[SourceDisksFiles] -Neo6_x86_VPN37.sys = 1 - -[DestinationDirs] -DefaultDestDir = 12 -Neo.CopyFiles.Sys = 12 - -[Neo.CopyFiles.Sys] -Neo6_x86_VPN37.sys, , , 2 - -[SoftEther] -%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN37 - -[NeoAdapter.Install] -Characteristics = 0x1 -AddReg = Neo.Reg, NeoAdapter.Ndi -CopyFiles = Neo.CopyFiles.Sys -*IfType = 53 -*MediaType = 0 -*PhysicalMediaType = 0 - -[NeoAdapter.Install.Services] -AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% - -[NeoAdapter.Ndi] -HKR, , NetworkAddress, 0, %DefaultAddress% -HKR, Ndi, DeviceID, , "NeoAdapter_VPN37" -HKR, , DevLoader, , ndis -HKR, , DeviceVxDs, , Neo6_x86_VPN37.sys -HKR, NDIS, LogDriverName, , "Neo_VPN37" -HKR, NDIS, MajorNdisVersion, 1, 5 -HKR, NDIS, MinorNdisVersion, 1, 0 -HKR, Ndi\Interfaces, DefUpper, , "ndis5" -HKR, Ndi\Interfaces, UpperRange, , "ndis5" -HKR, Ndi\Interfaces, LowerRange, , "ethernet" -HKR, Ndi\Interfaces, DefLower, , "ethernet" -HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" -HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% -HKR, Ndi\Params\NetworkAddress, type, 0, "edit" -HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" -HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" -HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% -HKR, Ndi\Params\NetworkAddress, optional, 0, "0" -HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% -HKR, Ndi\Params\MaxSpeed, type, 0, "int" -HKR, Ndi\Params\MaxSpeed, default, 0, "100" -HKR, Ndi\Params\MaxSpeed, min, 0, "0" -HKR, Ndi\Params\MaxSpeed, max, 0, "2000" -HKR, Ndi\Params\MaxSpeed, step, 0, "1" -HKR, Ndi\Params\MaxSpeed, Base, 0, "10" -HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% -HKR, Ndi\Params\KeepLink, type, 0, "enum" -HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% -HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% -HKR, Ndi\Params\KeepLink, default, 0, "0" - - -[Neo.Service] -DisplayName = %Neo.Service.DispName% -Description = %Neo.Service.Desc% -ServiceType = 1 -StartType = 3 -ErrorControl = 1 -ServiceBinary = %12%\Neo6_x86_VPN37.sys -LoadOrderGroup = NDIS - -[Neo.Reg] -HKR, Ndi, Service, 0, Neo.Service.Name -HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" -HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" - -[Neo.EventLog] -HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN37.sys" -HKR, , TypesSupported, 0x00010001, 7 - -[Strings] -CompanyName = "SoftEther Corporation" -DiskDescription = "VPN Client Device Driver Install Disk" -Neo.Service.Name = "Neo_VPN37" -Neo.Service.DispName = "VPN Client Device Driver - VPN37" -Neo.Service.Desc = "VPN Client Adapter - VPN37" -NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN37" -Neo.EventLog.Name = "Neo" -NetworkAddress = "MAC Address" -DefaultAddress = "000001000001" -MaxSpeed = "Indicate Speed (Mbps)" -KeepLink = "Keep Link" -On = "On" -Off = "Off" - - -; Auto Generated 20180205_163614.894 - +; VPN Client Device Driver for Windows 2000 and Greater +; +; Copyright (c) SoftEther Corporation. All Rights Reserved. +; http://www.softether.co.jp/ +; +; BUILD 9658 + +[Version] +Signature = "$Windows NT$" +Class = Net +ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} +Provider = %CompanyName% +DriverVer = 02/04/2018, 4.25.0.9658 +CatalogFile.NT = Neo6_x86_VPN37.cat + +[Manufacturer] +%CompanyName% = SoftEther + +[SourceDisksNames] +1=%DiskDescription%, "", , + +[SourceDisksFiles] +Neo6_x86_VPN37.sys = 1 + +[DestinationDirs] +DefaultDestDir = 12 +Neo.CopyFiles.Sys = 12 + +[Neo.CopyFiles.Sys] +Neo6_x86_VPN37.sys, , , 2 + +[SoftEther] +%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN37 + +[NeoAdapter.Install] +Characteristics = 0x1 +AddReg = Neo.Reg, NeoAdapter.Ndi +CopyFiles = Neo.CopyFiles.Sys +*IfType = 53 +*MediaType = 0 +*PhysicalMediaType = 0 + +[NeoAdapter.Install.Services] +AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% + +[NeoAdapter.Ndi] +HKR, , NetworkAddress, 0, %DefaultAddress% +HKR, Ndi, DeviceID, , "NeoAdapter_VPN37" +HKR, , DevLoader, , ndis +HKR, , DeviceVxDs, , Neo6_x86_VPN37.sys +HKR, NDIS, LogDriverName, , "Neo_VPN37" +HKR, NDIS, MajorNdisVersion, 1, 5 +HKR, NDIS, MinorNdisVersion, 1, 0 +HKR, Ndi\Interfaces, DefUpper, , "ndis5" +HKR, Ndi\Interfaces, UpperRange, , "ndis5" +HKR, Ndi\Interfaces, LowerRange, , "ethernet" +HKR, Ndi\Interfaces, DefLower, , "ethernet" +HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" +HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% +HKR, Ndi\Params\NetworkAddress, type, 0, "edit" +HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" +HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" +HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% +HKR, Ndi\Params\NetworkAddress, optional, 0, "0" +HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% +HKR, Ndi\Params\MaxSpeed, type, 0, "int" +HKR, Ndi\Params\MaxSpeed, default, 0, "100" +HKR, Ndi\Params\MaxSpeed, min, 0, "0" +HKR, Ndi\Params\MaxSpeed, max, 0, "2000" +HKR, Ndi\Params\MaxSpeed, step, 0, "1" +HKR, Ndi\Params\MaxSpeed, Base, 0, "10" +HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% +HKR, Ndi\Params\KeepLink, type, 0, "enum" +HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% +HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% +HKR, Ndi\Params\KeepLink, default, 0, "0" + + +[Neo.Service] +DisplayName = %Neo.Service.DispName% +Description = %Neo.Service.Desc% +ServiceType = 1 +StartType = 3 +ErrorControl = 1 +ServiceBinary = %12%\Neo6_x86_VPN37.sys +LoadOrderGroup = NDIS + +[Neo.Reg] +HKR, Ndi, Service, 0, Neo.Service.Name +HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" +HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" + +[Neo.EventLog] +HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN37.sys" +HKR, , TypesSupported, 0x00010001, 7 + +[Strings] +CompanyName = "SoftEther Corporation" +DiskDescription = "VPN Client Device Driver Install Disk" +Neo.Service.Name = "Neo_VPN37" +Neo.Service.DispName = "VPN Client Device Driver - VPN37" +Neo.Service.Desc = "VPN Client Adapter - VPN37" +NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN37" +Neo.EventLog.Name = "Neo" +NetworkAddress = "MAC Address" +DefaultAddress = "000001000001" +MaxSpeed = "Indicate Speed (Mbps)" +KeepLink = "Keep Link" +On = "On" +Off = "Off" + + +; Auto Generated 20180205_163614.894 + diff --git a/src/bin/hamcore/DriverPackages/Neo6_Win10/x86/Neo6_x86_VPN38.inf b/src/bin/hamcore/DriverPackages/Neo6_Win10/x86/Neo6_x86_VPN38.inf index 95e42cff..c274c517 100644 --- a/src/bin/hamcore/DriverPackages/Neo6_Win10/x86/Neo6_x86_VPN38.inf +++ b/src/bin/hamcore/DriverPackages/Neo6_Win10/x86/Neo6_x86_VPN38.inf @@ -1,114 +1,114 @@ -; VPN Client Device Driver for Windows 2000 and Greater -; -; Copyright (c) SoftEther Corporation. All Rights Reserved. -; http://www.softether.co.jp/ -; -; BUILD 9658 - -[Version] -Signature = "$Windows NT$" -Class = Net -ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} -Provider = %CompanyName% -DriverVer = 02/04/2018, 4.25.0.9658 -CatalogFile.NT = Neo6_x86_VPN38.cat - -[Manufacturer] -%CompanyName% = SoftEther - -[SourceDisksNames] -1=%DiskDescription%, "", , - -[SourceDisksFiles] -Neo6_x86_VPN38.sys = 1 - -[DestinationDirs] -DefaultDestDir = 12 -Neo.CopyFiles.Sys = 12 - -[Neo.CopyFiles.Sys] -Neo6_x86_VPN38.sys, , , 2 - -[SoftEther] -%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN38 - -[NeoAdapter.Install] -Characteristics = 0x1 -AddReg = Neo.Reg, NeoAdapter.Ndi -CopyFiles = Neo.CopyFiles.Sys -*IfType = 53 -*MediaType = 0 -*PhysicalMediaType = 0 - -[NeoAdapter.Install.Services] -AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% - -[NeoAdapter.Ndi] -HKR, , NetworkAddress, 0, %DefaultAddress% -HKR, Ndi, DeviceID, , "NeoAdapter_VPN38" -HKR, , DevLoader, , ndis -HKR, , DeviceVxDs, , Neo6_x86_VPN38.sys -HKR, NDIS, LogDriverName, , "Neo_VPN38" -HKR, NDIS, MajorNdisVersion, 1, 5 -HKR, NDIS, MinorNdisVersion, 1, 0 -HKR, Ndi\Interfaces, DefUpper, , "ndis5" -HKR, Ndi\Interfaces, UpperRange, , "ndis5" -HKR, Ndi\Interfaces, LowerRange, , "ethernet" -HKR, Ndi\Interfaces, DefLower, , "ethernet" -HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" -HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% -HKR, Ndi\Params\NetworkAddress, type, 0, "edit" -HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" -HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" -HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% -HKR, Ndi\Params\NetworkAddress, optional, 0, "0" -HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% -HKR, Ndi\Params\MaxSpeed, type, 0, "int" -HKR, Ndi\Params\MaxSpeed, default, 0, "100" -HKR, Ndi\Params\MaxSpeed, min, 0, "0" -HKR, Ndi\Params\MaxSpeed, max, 0, "2000" -HKR, Ndi\Params\MaxSpeed, step, 0, "1" -HKR, Ndi\Params\MaxSpeed, Base, 0, "10" -HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% -HKR, Ndi\Params\KeepLink, type, 0, "enum" -HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% -HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% -HKR, Ndi\Params\KeepLink, default, 0, "0" - - -[Neo.Service] -DisplayName = %Neo.Service.DispName% -Description = %Neo.Service.Desc% -ServiceType = 1 -StartType = 3 -ErrorControl = 1 -ServiceBinary = %12%\Neo6_x86_VPN38.sys -LoadOrderGroup = NDIS - -[Neo.Reg] -HKR, Ndi, Service, 0, Neo.Service.Name -HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" -HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" - -[Neo.EventLog] -HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN38.sys" -HKR, , TypesSupported, 0x00010001, 7 - -[Strings] -CompanyName = "SoftEther Corporation" -DiskDescription = "VPN Client Device Driver Install Disk" -Neo.Service.Name = "Neo_VPN38" -Neo.Service.DispName = "VPN Client Device Driver - VPN38" -Neo.Service.Desc = "VPN Client Adapter - VPN38" -NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN38" -Neo.EventLog.Name = "Neo" -NetworkAddress = "MAC Address" -DefaultAddress = "000001000001" -MaxSpeed = "Indicate Speed (Mbps)" -KeepLink = "Keep Link" -On = "On" -Off = "Off" - - -; Auto Generated 20180205_163614.964 - +; VPN Client Device Driver for Windows 2000 and Greater +; +; Copyright (c) SoftEther Corporation. All Rights Reserved. +; http://www.softether.co.jp/ +; +; BUILD 9658 + +[Version] +Signature = "$Windows NT$" +Class = Net +ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} +Provider = %CompanyName% +DriverVer = 02/04/2018, 4.25.0.9658 +CatalogFile.NT = Neo6_x86_VPN38.cat + +[Manufacturer] +%CompanyName% = SoftEther + +[SourceDisksNames] +1=%DiskDescription%, "", , + +[SourceDisksFiles] +Neo6_x86_VPN38.sys = 1 + +[DestinationDirs] +DefaultDestDir = 12 +Neo.CopyFiles.Sys = 12 + +[Neo.CopyFiles.Sys] +Neo6_x86_VPN38.sys, , , 2 + +[SoftEther] +%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN38 + +[NeoAdapter.Install] +Characteristics = 0x1 +AddReg = Neo.Reg, NeoAdapter.Ndi +CopyFiles = Neo.CopyFiles.Sys +*IfType = 53 +*MediaType = 0 +*PhysicalMediaType = 0 + +[NeoAdapter.Install.Services] +AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% + +[NeoAdapter.Ndi] +HKR, , NetworkAddress, 0, %DefaultAddress% +HKR, Ndi, DeviceID, , "NeoAdapter_VPN38" +HKR, , DevLoader, , ndis +HKR, , DeviceVxDs, , Neo6_x86_VPN38.sys +HKR, NDIS, LogDriverName, , "Neo_VPN38" +HKR, NDIS, MajorNdisVersion, 1, 5 +HKR, NDIS, MinorNdisVersion, 1, 0 +HKR, Ndi\Interfaces, DefUpper, , "ndis5" +HKR, Ndi\Interfaces, UpperRange, , "ndis5" +HKR, Ndi\Interfaces, LowerRange, , "ethernet" +HKR, Ndi\Interfaces, DefLower, , "ethernet" +HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" +HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% +HKR, Ndi\Params\NetworkAddress, type, 0, "edit" +HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" +HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" +HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% +HKR, Ndi\Params\NetworkAddress, optional, 0, "0" +HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% +HKR, Ndi\Params\MaxSpeed, type, 0, "int" +HKR, Ndi\Params\MaxSpeed, default, 0, "100" +HKR, Ndi\Params\MaxSpeed, min, 0, "0" +HKR, Ndi\Params\MaxSpeed, max, 0, "2000" +HKR, Ndi\Params\MaxSpeed, step, 0, "1" +HKR, Ndi\Params\MaxSpeed, Base, 0, "10" +HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% +HKR, Ndi\Params\KeepLink, type, 0, "enum" +HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% +HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% +HKR, Ndi\Params\KeepLink, default, 0, "0" + + +[Neo.Service] +DisplayName = %Neo.Service.DispName% +Description = %Neo.Service.Desc% +ServiceType = 1 +StartType = 3 +ErrorControl = 1 +ServiceBinary = %12%\Neo6_x86_VPN38.sys +LoadOrderGroup = NDIS + +[Neo.Reg] +HKR, Ndi, Service, 0, Neo.Service.Name +HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" +HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" + +[Neo.EventLog] +HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN38.sys" +HKR, , TypesSupported, 0x00010001, 7 + +[Strings] +CompanyName = "SoftEther Corporation" +DiskDescription = "VPN Client Device Driver Install Disk" +Neo.Service.Name = "Neo_VPN38" +Neo.Service.DispName = "VPN Client Device Driver - VPN38" +Neo.Service.Desc = "VPN Client Adapter - VPN38" +NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN38" +Neo.EventLog.Name = "Neo" +NetworkAddress = "MAC Address" +DefaultAddress = "000001000001" +MaxSpeed = "Indicate Speed (Mbps)" +KeepLink = "Keep Link" +On = "On" +Off = "Off" + + +; Auto Generated 20180205_163614.964 + diff --git a/src/bin/hamcore/DriverPackages/Neo6_Win10/x86/Neo6_x86_VPN39.inf b/src/bin/hamcore/DriverPackages/Neo6_Win10/x86/Neo6_x86_VPN39.inf index a148bff2..ad7eac87 100644 --- a/src/bin/hamcore/DriverPackages/Neo6_Win10/x86/Neo6_x86_VPN39.inf +++ b/src/bin/hamcore/DriverPackages/Neo6_Win10/x86/Neo6_x86_VPN39.inf @@ -1,114 +1,114 @@ -; VPN Client Device Driver for Windows 2000 and Greater -; -; Copyright (c) SoftEther Corporation. All Rights Reserved. -; http://www.softether.co.jp/ -; -; BUILD 9658 - -[Version] -Signature = "$Windows NT$" -Class = Net -ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} -Provider = %CompanyName% -DriverVer = 02/04/2018, 4.25.0.9658 -CatalogFile.NT = Neo6_x86_VPN39.cat - -[Manufacturer] -%CompanyName% = SoftEther - -[SourceDisksNames] -1=%DiskDescription%, "", , - -[SourceDisksFiles] -Neo6_x86_VPN39.sys = 1 - -[DestinationDirs] -DefaultDestDir = 12 -Neo.CopyFiles.Sys = 12 - -[Neo.CopyFiles.Sys] -Neo6_x86_VPN39.sys, , , 2 - -[SoftEther] -%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN39 - -[NeoAdapter.Install] -Characteristics = 0x1 -AddReg = Neo.Reg, NeoAdapter.Ndi -CopyFiles = Neo.CopyFiles.Sys -*IfType = 53 -*MediaType = 0 -*PhysicalMediaType = 0 - -[NeoAdapter.Install.Services] -AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% - -[NeoAdapter.Ndi] -HKR, , NetworkAddress, 0, %DefaultAddress% -HKR, Ndi, DeviceID, , "NeoAdapter_VPN39" -HKR, , DevLoader, , ndis -HKR, , DeviceVxDs, , Neo6_x86_VPN39.sys -HKR, NDIS, LogDriverName, , "Neo_VPN39" -HKR, NDIS, MajorNdisVersion, 1, 5 -HKR, NDIS, MinorNdisVersion, 1, 0 -HKR, Ndi\Interfaces, DefUpper, , "ndis5" -HKR, Ndi\Interfaces, UpperRange, , "ndis5" -HKR, Ndi\Interfaces, LowerRange, , "ethernet" -HKR, Ndi\Interfaces, DefLower, , "ethernet" -HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" -HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% -HKR, Ndi\Params\NetworkAddress, type, 0, "edit" -HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" -HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" -HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% -HKR, Ndi\Params\NetworkAddress, optional, 0, "0" -HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% -HKR, Ndi\Params\MaxSpeed, type, 0, "int" -HKR, Ndi\Params\MaxSpeed, default, 0, "100" -HKR, Ndi\Params\MaxSpeed, min, 0, "0" -HKR, Ndi\Params\MaxSpeed, max, 0, "2000" -HKR, Ndi\Params\MaxSpeed, step, 0, "1" -HKR, Ndi\Params\MaxSpeed, Base, 0, "10" -HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% -HKR, Ndi\Params\KeepLink, type, 0, "enum" -HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% -HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% -HKR, Ndi\Params\KeepLink, default, 0, "0" - - -[Neo.Service] -DisplayName = %Neo.Service.DispName% -Description = %Neo.Service.Desc% -ServiceType = 1 -StartType = 3 -ErrorControl = 1 -ServiceBinary = %12%\Neo6_x86_VPN39.sys -LoadOrderGroup = NDIS - -[Neo.Reg] -HKR, Ndi, Service, 0, Neo.Service.Name -HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" -HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" - -[Neo.EventLog] -HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN39.sys" -HKR, , TypesSupported, 0x00010001, 7 - -[Strings] -CompanyName = "SoftEther Corporation" -DiskDescription = "VPN Client Device Driver Install Disk" -Neo.Service.Name = "Neo_VPN39" -Neo.Service.DispName = "VPN Client Device Driver - VPN39" -Neo.Service.Desc = "VPN Client Adapter - VPN39" -NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN39" -Neo.EventLog.Name = "Neo" -NetworkAddress = "MAC Address" -DefaultAddress = "000001000001" -MaxSpeed = "Indicate Speed (Mbps)" -KeepLink = "Keep Link" -On = "On" -Off = "Off" - - -; Auto Generated 20180205_163615.035 - +; VPN Client Device Driver for Windows 2000 and Greater +; +; Copyright (c) SoftEther Corporation. All Rights Reserved. +; http://www.softether.co.jp/ +; +; BUILD 9658 + +[Version] +Signature = "$Windows NT$" +Class = Net +ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} +Provider = %CompanyName% +DriverVer = 02/04/2018, 4.25.0.9658 +CatalogFile.NT = Neo6_x86_VPN39.cat + +[Manufacturer] +%CompanyName% = SoftEther + +[SourceDisksNames] +1=%DiskDescription%, "", , + +[SourceDisksFiles] +Neo6_x86_VPN39.sys = 1 + +[DestinationDirs] +DefaultDestDir = 12 +Neo.CopyFiles.Sys = 12 + +[Neo.CopyFiles.Sys] +Neo6_x86_VPN39.sys, , , 2 + +[SoftEther] +%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN39 + +[NeoAdapter.Install] +Characteristics = 0x1 +AddReg = Neo.Reg, NeoAdapter.Ndi +CopyFiles = Neo.CopyFiles.Sys +*IfType = 53 +*MediaType = 0 +*PhysicalMediaType = 0 + +[NeoAdapter.Install.Services] +AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% + +[NeoAdapter.Ndi] +HKR, , NetworkAddress, 0, %DefaultAddress% +HKR, Ndi, DeviceID, , "NeoAdapter_VPN39" +HKR, , DevLoader, , ndis +HKR, , DeviceVxDs, , Neo6_x86_VPN39.sys +HKR, NDIS, LogDriverName, , "Neo_VPN39" +HKR, NDIS, MajorNdisVersion, 1, 5 +HKR, NDIS, MinorNdisVersion, 1, 0 +HKR, Ndi\Interfaces, DefUpper, , "ndis5" +HKR, Ndi\Interfaces, UpperRange, , "ndis5" +HKR, Ndi\Interfaces, LowerRange, , "ethernet" +HKR, Ndi\Interfaces, DefLower, , "ethernet" +HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" +HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% +HKR, Ndi\Params\NetworkAddress, type, 0, "edit" +HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" +HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" +HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% +HKR, Ndi\Params\NetworkAddress, optional, 0, "0" +HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% +HKR, Ndi\Params\MaxSpeed, type, 0, "int" +HKR, Ndi\Params\MaxSpeed, default, 0, "100" +HKR, Ndi\Params\MaxSpeed, min, 0, "0" +HKR, Ndi\Params\MaxSpeed, max, 0, "2000" +HKR, Ndi\Params\MaxSpeed, step, 0, "1" +HKR, Ndi\Params\MaxSpeed, Base, 0, "10" +HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% +HKR, Ndi\Params\KeepLink, type, 0, "enum" +HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% +HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% +HKR, Ndi\Params\KeepLink, default, 0, "0" + + +[Neo.Service] +DisplayName = %Neo.Service.DispName% +Description = %Neo.Service.Desc% +ServiceType = 1 +StartType = 3 +ErrorControl = 1 +ServiceBinary = %12%\Neo6_x86_VPN39.sys +LoadOrderGroup = NDIS + +[Neo.Reg] +HKR, Ndi, Service, 0, Neo.Service.Name +HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" +HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" + +[Neo.EventLog] +HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN39.sys" +HKR, , TypesSupported, 0x00010001, 7 + +[Strings] +CompanyName = "SoftEther Corporation" +DiskDescription = "VPN Client Device Driver Install Disk" +Neo.Service.Name = "Neo_VPN39" +Neo.Service.DispName = "VPN Client Device Driver - VPN39" +Neo.Service.Desc = "VPN Client Adapter - VPN39" +NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN39" +Neo.EventLog.Name = "Neo" +NetworkAddress = "MAC Address" +DefaultAddress = "000001000001" +MaxSpeed = "Indicate Speed (Mbps)" +KeepLink = "Keep Link" +On = "On" +Off = "Off" + + +; Auto Generated 20180205_163615.035 + diff --git a/src/bin/hamcore/DriverPackages/Neo6_Win10/x86/Neo6_x86_VPN4.inf b/src/bin/hamcore/DriverPackages/Neo6_Win10/x86/Neo6_x86_VPN4.inf index 0c4356d3..3c99900c 100644 --- a/src/bin/hamcore/DriverPackages/Neo6_Win10/x86/Neo6_x86_VPN4.inf +++ b/src/bin/hamcore/DriverPackages/Neo6_Win10/x86/Neo6_x86_VPN4.inf @@ -1,114 +1,114 @@ -; VPN Client Device Driver for Windows 2000 and Greater -; -; Copyright (c) SoftEther Corporation. All Rights Reserved. -; http://www.softether.co.jp/ -; -; BUILD 9658 - -[Version] -Signature = "$Windows NT$" -Class = Net -ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} -Provider = %CompanyName% -DriverVer = 02/04/2018, 4.25.0.9658 -CatalogFile.NT = Neo6_x86_VPN4.cat - -[Manufacturer] -%CompanyName% = SoftEther - -[SourceDisksNames] -1=%DiskDescription%, "", , - -[SourceDisksFiles] -Neo6_x86_VPN4.sys = 1 - -[DestinationDirs] -DefaultDestDir = 12 -Neo.CopyFiles.Sys = 12 - -[Neo.CopyFiles.Sys] -Neo6_x86_VPN4.sys, , , 2 - -[SoftEther] -%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN4 - -[NeoAdapter.Install] -Characteristics = 0x1 -AddReg = Neo.Reg, NeoAdapter.Ndi -CopyFiles = Neo.CopyFiles.Sys -*IfType = 53 -*MediaType = 0 -*PhysicalMediaType = 0 - -[NeoAdapter.Install.Services] -AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% - -[NeoAdapter.Ndi] -HKR, , NetworkAddress, 0, %DefaultAddress% -HKR, Ndi, DeviceID, , "NeoAdapter_VPN4" -HKR, , DevLoader, , ndis -HKR, , DeviceVxDs, , Neo6_x86_VPN4.sys -HKR, NDIS, LogDriverName, , "Neo_VPN4" -HKR, NDIS, MajorNdisVersion, 1, 5 -HKR, NDIS, MinorNdisVersion, 1, 0 -HKR, Ndi\Interfaces, DefUpper, , "ndis5" -HKR, Ndi\Interfaces, UpperRange, , "ndis5" -HKR, Ndi\Interfaces, LowerRange, , "ethernet" -HKR, Ndi\Interfaces, DefLower, , "ethernet" -HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" -HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% -HKR, Ndi\Params\NetworkAddress, type, 0, "edit" -HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" -HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" -HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% -HKR, Ndi\Params\NetworkAddress, optional, 0, "0" -HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% -HKR, Ndi\Params\MaxSpeed, type, 0, "int" -HKR, Ndi\Params\MaxSpeed, default, 0, "100" -HKR, Ndi\Params\MaxSpeed, min, 0, "0" -HKR, Ndi\Params\MaxSpeed, max, 0, "2000" -HKR, Ndi\Params\MaxSpeed, step, 0, "1" -HKR, Ndi\Params\MaxSpeed, Base, 0, "10" -HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% -HKR, Ndi\Params\KeepLink, type, 0, "enum" -HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% -HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% -HKR, Ndi\Params\KeepLink, default, 0, "0" - - -[Neo.Service] -DisplayName = %Neo.Service.DispName% -Description = %Neo.Service.Desc% -ServiceType = 1 -StartType = 3 -ErrorControl = 1 -ServiceBinary = %12%\Neo6_x86_VPN4.sys -LoadOrderGroup = NDIS - -[Neo.Reg] -HKR, Ndi, Service, 0, Neo.Service.Name -HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" -HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" - -[Neo.EventLog] -HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN4.sys" -HKR, , TypesSupported, 0x00010001, 7 - -[Strings] -CompanyName = "SoftEther Corporation" -DiskDescription = "VPN Client Device Driver Install Disk" -Neo.Service.Name = "Neo_VPN4" -Neo.Service.DispName = "VPN Client Device Driver - VPN4" -Neo.Service.Desc = "VPN Client Adapter - VPN4" -NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN4" -Neo.EventLog.Name = "Neo" -NetworkAddress = "MAC Address" -DefaultAddress = "000001000001" -MaxSpeed = "Indicate Speed (Mbps)" -KeepLink = "Keep Link" -On = "On" -Off = "Off" - - -; Auto Generated 20180205_163612.548 - +; VPN Client Device Driver for Windows 2000 and Greater +; +; Copyright (c) SoftEther Corporation. All Rights Reserved. +; http://www.softether.co.jp/ +; +; BUILD 9658 + +[Version] +Signature = "$Windows NT$" +Class = Net +ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} +Provider = %CompanyName% +DriverVer = 02/04/2018, 4.25.0.9658 +CatalogFile.NT = Neo6_x86_VPN4.cat + +[Manufacturer] +%CompanyName% = SoftEther + +[SourceDisksNames] +1=%DiskDescription%, "", , + +[SourceDisksFiles] +Neo6_x86_VPN4.sys = 1 + +[DestinationDirs] +DefaultDestDir = 12 +Neo.CopyFiles.Sys = 12 + +[Neo.CopyFiles.Sys] +Neo6_x86_VPN4.sys, , , 2 + +[SoftEther] +%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN4 + +[NeoAdapter.Install] +Characteristics = 0x1 +AddReg = Neo.Reg, NeoAdapter.Ndi +CopyFiles = Neo.CopyFiles.Sys +*IfType = 53 +*MediaType = 0 +*PhysicalMediaType = 0 + +[NeoAdapter.Install.Services] +AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% + +[NeoAdapter.Ndi] +HKR, , NetworkAddress, 0, %DefaultAddress% +HKR, Ndi, DeviceID, , "NeoAdapter_VPN4" +HKR, , DevLoader, , ndis +HKR, , DeviceVxDs, , Neo6_x86_VPN4.sys +HKR, NDIS, LogDriverName, , "Neo_VPN4" +HKR, NDIS, MajorNdisVersion, 1, 5 +HKR, NDIS, MinorNdisVersion, 1, 0 +HKR, Ndi\Interfaces, DefUpper, , "ndis5" +HKR, Ndi\Interfaces, UpperRange, , "ndis5" +HKR, Ndi\Interfaces, LowerRange, , "ethernet" +HKR, Ndi\Interfaces, DefLower, , "ethernet" +HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" +HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% +HKR, Ndi\Params\NetworkAddress, type, 0, "edit" +HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" +HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" +HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% +HKR, Ndi\Params\NetworkAddress, optional, 0, "0" +HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% +HKR, Ndi\Params\MaxSpeed, type, 0, "int" +HKR, Ndi\Params\MaxSpeed, default, 0, "100" +HKR, Ndi\Params\MaxSpeed, min, 0, "0" +HKR, Ndi\Params\MaxSpeed, max, 0, "2000" +HKR, Ndi\Params\MaxSpeed, step, 0, "1" +HKR, Ndi\Params\MaxSpeed, Base, 0, "10" +HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% +HKR, Ndi\Params\KeepLink, type, 0, "enum" +HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% +HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% +HKR, Ndi\Params\KeepLink, default, 0, "0" + + +[Neo.Service] +DisplayName = %Neo.Service.DispName% +Description = %Neo.Service.Desc% +ServiceType = 1 +StartType = 3 +ErrorControl = 1 +ServiceBinary = %12%\Neo6_x86_VPN4.sys +LoadOrderGroup = NDIS + +[Neo.Reg] +HKR, Ndi, Service, 0, Neo.Service.Name +HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" +HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" + +[Neo.EventLog] +HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN4.sys" +HKR, , TypesSupported, 0x00010001, 7 + +[Strings] +CompanyName = "SoftEther Corporation" +DiskDescription = "VPN Client Device Driver Install Disk" +Neo.Service.Name = "Neo_VPN4" +Neo.Service.DispName = "VPN Client Device Driver - VPN4" +Neo.Service.Desc = "VPN Client Adapter - VPN4" +NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN4" +Neo.EventLog.Name = "Neo" +NetworkAddress = "MAC Address" +DefaultAddress = "000001000001" +MaxSpeed = "Indicate Speed (Mbps)" +KeepLink = "Keep Link" +On = "On" +Off = "Off" + + +; Auto Generated 20180205_163612.548 + diff --git a/src/bin/hamcore/DriverPackages/Neo6_Win10/x86/Neo6_x86_VPN40.inf b/src/bin/hamcore/DriverPackages/Neo6_Win10/x86/Neo6_x86_VPN40.inf index 4080f663..d1ccc8ad 100644 --- a/src/bin/hamcore/DriverPackages/Neo6_Win10/x86/Neo6_x86_VPN40.inf +++ b/src/bin/hamcore/DriverPackages/Neo6_Win10/x86/Neo6_x86_VPN40.inf @@ -1,114 +1,114 @@ -; VPN Client Device Driver for Windows 2000 and Greater -; -; Copyright (c) SoftEther Corporation. All Rights Reserved. -; http://www.softether.co.jp/ -; -; BUILD 9658 - -[Version] -Signature = "$Windows NT$" -Class = Net -ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} -Provider = %CompanyName% -DriverVer = 02/04/2018, 4.25.0.9658 -CatalogFile.NT = Neo6_x86_VPN40.cat - -[Manufacturer] -%CompanyName% = SoftEther - -[SourceDisksNames] -1=%DiskDescription%, "", , - -[SourceDisksFiles] -Neo6_x86_VPN40.sys = 1 - -[DestinationDirs] -DefaultDestDir = 12 -Neo.CopyFiles.Sys = 12 - -[Neo.CopyFiles.Sys] -Neo6_x86_VPN40.sys, , , 2 - -[SoftEther] -%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN40 - -[NeoAdapter.Install] -Characteristics = 0x1 -AddReg = Neo.Reg, NeoAdapter.Ndi -CopyFiles = Neo.CopyFiles.Sys -*IfType = 53 -*MediaType = 0 -*PhysicalMediaType = 0 - -[NeoAdapter.Install.Services] -AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% - -[NeoAdapter.Ndi] -HKR, , NetworkAddress, 0, %DefaultAddress% -HKR, Ndi, DeviceID, , "NeoAdapter_VPN40" -HKR, , DevLoader, , ndis -HKR, , DeviceVxDs, , Neo6_x86_VPN40.sys -HKR, NDIS, LogDriverName, , "Neo_VPN40" -HKR, NDIS, MajorNdisVersion, 1, 5 -HKR, NDIS, MinorNdisVersion, 1, 0 -HKR, Ndi\Interfaces, DefUpper, , "ndis5" -HKR, Ndi\Interfaces, UpperRange, , "ndis5" -HKR, Ndi\Interfaces, LowerRange, , "ethernet" -HKR, Ndi\Interfaces, DefLower, , "ethernet" -HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" -HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% -HKR, Ndi\Params\NetworkAddress, type, 0, "edit" -HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" -HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" -HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% -HKR, Ndi\Params\NetworkAddress, optional, 0, "0" -HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% -HKR, Ndi\Params\MaxSpeed, type, 0, "int" -HKR, Ndi\Params\MaxSpeed, default, 0, "100" -HKR, Ndi\Params\MaxSpeed, min, 0, "0" -HKR, Ndi\Params\MaxSpeed, max, 0, "2000" -HKR, Ndi\Params\MaxSpeed, step, 0, "1" -HKR, Ndi\Params\MaxSpeed, Base, 0, "10" -HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% -HKR, Ndi\Params\KeepLink, type, 0, "enum" -HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% -HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% -HKR, Ndi\Params\KeepLink, default, 0, "0" - - -[Neo.Service] -DisplayName = %Neo.Service.DispName% -Description = %Neo.Service.Desc% -ServiceType = 1 -StartType = 3 -ErrorControl = 1 -ServiceBinary = %12%\Neo6_x86_VPN40.sys -LoadOrderGroup = NDIS - -[Neo.Reg] -HKR, Ndi, Service, 0, Neo.Service.Name -HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" -HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" - -[Neo.EventLog] -HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN40.sys" -HKR, , TypesSupported, 0x00010001, 7 - -[Strings] -CompanyName = "SoftEther Corporation" -DiskDescription = "VPN Client Device Driver Install Disk" -Neo.Service.Name = "Neo_VPN40" -Neo.Service.DispName = "VPN Client Device Driver - VPN40" -Neo.Service.Desc = "VPN Client Adapter - VPN40" -NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN40" -Neo.EventLog.Name = "Neo" -NetworkAddress = "MAC Address" -DefaultAddress = "000001000001" -MaxSpeed = "Indicate Speed (Mbps)" -KeepLink = "Keep Link" -On = "On" -Off = "Off" - - -; Auto Generated 20180205_163615.106 - +; VPN Client Device Driver for Windows 2000 and Greater +; +; Copyright (c) SoftEther Corporation. All Rights Reserved. +; http://www.softether.co.jp/ +; +; BUILD 9658 + +[Version] +Signature = "$Windows NT$" +Class = Net +ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} +Provider = %CompanyName% +DriverVer = 02/04/2018, 4.25.0.9658 +CatalogFile.NT = Neo6_x86_VPN40.cat + +[Manufacturer] +%CompanyName% = SoftEther + +[SourceDisksNames] +1=%DiskDescription%, "", , + +[SourceDisksFiles] +Neo6_x86_VPN40.sys = 1 + +[DestinationDirs] +DefaultDestDir = 12 +Neo.CopyFiles.Sys = 12 + +[Neo.CopyFiles.Sys] +Neo6_x86_VPN40.sys, , , 2 + +[SoftEther] +%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN40 + +[NeoAdapter.Install] +Characteristics = 0x1 +AddReg = Neo.Reg, NeoAdapter.Ndi +CopyFiles = Neo.CopyFiles.Sys +*IfType = 53 +*MediaType = 0 +*PhysicalMediaType = 0 + +[NeoAdapter.Install.Services] +AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% + +[NeoAdapter.Ndi] +HKR, , NetworkAddress, 0, %DefaultAddress% +HKR, Ndi, DeviceID, , "NeoAdapter_VPN40" +HKR, , DevLoader, , ndis +HKR, , DeviceVxDs, , Neo6_x86_VPN40.sys +HKR, NDIS, LogDriverName, , "Neo_VPN40" +HKR, NDIS, MajorNdisVersion, 1, 5 +HKR, NDIS, MinorNdisVersion, 1, 0 +HKR, Ndi\Interfaces, DefUpper, , "ndis5" +HKR, Ndi\Interfaces, UpperRange, , "ndis5" +HKR, Ndi\Interfaces, LowerRange, , "ethernet" +HKR, Ndi\Interfaces, DefLower, , "ethernet" +HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" +HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% +HKR, Ndi\Params\NetworkAddress, type, 0, "edit" +HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" +HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" +HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% +HKR, Ndi\Params\NetworkAddress, optional, 0, "0" +HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% +HKR, Ndi\Params\MaxSpeed, type, 0, "int" +HKR, Ndi\Params\MaxSpeed, default, 0, "100" +HKR, Ndi\Params\MaxSpeed, min, 0, "0" +HKR, Ndi\Params\MaxSpeed, max, 0, "2000" +HKR, Ndi\Params\MaxSpeed, step, 0, "1" +HKR, Ndi\Params\MaxSpeed, Base, 0, "10" +HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% +HKR, Ndi\Params\KeepLink, type, 0, "enum" +HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% +HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% +HKR, Ndi\Params\KeepLink, default, 0, "0" + + +[Neo.Service] +DisplayName = %Neo.Service.DispName% +Description = %Neo.Service.Desc% +ServiceType = 1 +StartType = 3 +ErrorControl = 1 +ServiceBinary = %12%\Neo6_x86_VPN40.sys +LoadOrderGroup = NDIS + +[Neo.Reg] +HKR, Ndi, Service, 0, Neo.Service.Name +HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" +HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" + +[Neo.EventLog] +HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN40.sys" +HKR, , TypesSupported, 0x00010001, 7 + +[Strings] +CompanyName = "SoftEther Corporation" +DiskDescription = "VPN Client Device Driver Install Disk" +Neo.Service.Name = "Neo_VPN40" +Neo.Service.DispName = "VPN Client Device Driver - VPN40" +Neo.Service.Desc = "VPN Client Adapter - VPN40" +NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN40" +Neo.EventLog.Name = "Neo" +NetworkAddress = "MAC Address" +DefaultAddress = "000001000001" +MaxSpeed = "Indicate Speed (Mbps)" +KeepLink = "Keep Link" +On = "On" +Off = "Off" + + +; Auto Generated 20180205_163615.106 + diff --git a/src/bin/hamcore/DriverPackages/Neo6_Win10/x86/Neo6_x86_VPN41.inf b/src/bin/hamcore/DriverPackages/Neo6_Win10/x86/Neo6_x86_VPN41.inf index e6bf1236..ba3d61a4 100644 --- a/src/bin/hamcore/DriverPackages/Neo6_Win10/x86/Neo6_x86_VPN41.inf +++ b/src/bin/hamcore/DriverPackages/Neo6_Win10/x86/Neo6_x86_VPN41.inf @@ -1,114 +1,114 @@ -; VPN Client Device Driver for Windows 2000 and Greater -; -; Copyright (c) SoftEther Corporation. All Rights Reserved. -; http://www.softether.co.jp/ -; -; BUILD 9658 - -[Version] -Signature = "$Windows NT$" -Class = Net -ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} -Provider = %CompanyName% -DriverVer = 02/04/2018, 4.25.0.9658 -CatalogFile.NT = Neo6_x86_VPN41.cat - -[Manufacturer] -%CompanyName% = SoftEther - -[SourceDisksNames] -1=%DiskDescription%, "", , - -[SourceDisksFiles] -Neo6_x86_VPN41.sys = 1 - -[DestinationDirs] -DefaultDestDir = 12 -Neo.CopyFiles.Sys = 12 - -[Neo.CopyFiles.Sys] -Neo6_x86_VPN41.sys, , , 2 - -[SoftEther] -%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN41 - -[NeoAdapter.Install] -Characteristics = 0x1 -AddReg = Neo.Reg, NeoAdapter.Ndi -CopyFiles = Neo.CopyFiles.Sys -*IfType = 53 -*MediaType = 0 -*PhysicalMediaType = 0 - -[NeoAdapter.Install.Services] -AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% - -[NeoAdapter.Ndi] -HKR, , NetworkAddress, 0, %DefaultAddress% -HKR, Ndi, DeviceID, , "NeoAdapter_VPN41" -HKR, , DevLoader, , ndis -HKR, , DeviceVxDs, , Neo6_x86_VPN41.sys -HKR, NDIS, LogDriverName, , "Neo_VPN41" -HKR, NDIS, MajorNdisVersion, 1, 5 -HKR, NDIS, MinorNdisVersion, 1, 0 -HKR, Ndi\Interfaces, DefUpper, , "ndis5" -HKR, Ndi\Interfaces, UpperRange, , "ndis5" -HKR, Ndi\Interfaces, LowerRange, , "ethernet" -HKR, Ndi\Interfaces, DefLower, , "ethernet" -HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" -HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% -HKR, Ndi\Params\NetworkAddress, type, 0, "edit" -HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" -HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" -HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% -HKR, Ndi\Params\NetworkAddress, optional, 0, "0" -HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% -HKR, Ndi\Params\MaxSpeed, type, 0, "int" -HKR, Ndi\Params\MaxSpeed, default, 0, "100" -HKR, Ndi\Params\MaxSpeed, min, 0, "0" -HKR, Ndi\Params\MaxSpeed, max, 0, "2000" -HKR, Ndi\Params\MaxSpeed, step, 0, "1" -HKR, Ndi\Params\MaxSpeed, Base, 0, "10" -HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% -HKR, Ndi\Params\KeepLink, type, 0, "enum" -HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% -HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% -HKR, Ndi\Params\KeepLink, default, 0, "0" - - -[Neo.Service] -DisplayName = %Neo.Service.DispName% -Description = %Neo.Service.Desc% -ServiceType = 1 -StartType = 3 -ErrorControl = 1 -ServiceBinary = %12%\Neo6_x86_VPN41.sys -LoadOrderGroup = NDIS - -[Neo.Reg] -HKR, Ndi, Service, 0, Neo.Service.Name -HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" -HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" - -[Neo.EventLog] -HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN41.sys" -HKR, , TypesSupported, 0x00010001, 7 - -[Strings] -CompanyName = "SoftEther Corporation" -DiskDescription = "VPN Client Device Driver Install Disk" -Neo.Service.Name = "Neo_VPN41" -Neo.Service.DispName = "VPN Client Device Driver - VPN41" -Neo.Service.Desc = "VPN Client Adapter - VPN41" -NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN41" -Neo.EventLog.Name = "Neo" -NetworkAddress = "MAC Address" -DefaultAddress = "000001000001" -MaxSpeed = "Indicate Speed (Mbps)" -KeepLink = "Keep Link" -On = "On" -Off = "Off" - - -; Auto Generated 20180205_163615.176 - +; VPN Client Device Driver for Windows 2000 and Greater +; +; Copyright (c) SoftEther Corporation. All Rights Reserved. +; http://www.softether.co.jp/ +; +; BUILD 9658 + +[Version] +Signature = "$Windows NT$" +Class = Net +ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} +Provider = %CompanyName% +DriverVer = 02/04/2018, 4.25.0.9658 +CatalogFile.NT = Neo6_x86_VPN41.cat + +[Manufacturer] +%CompanyName% = SoftEther + +[SourceDisksNames] +1=%DiskDescription%, "", , + +[SourceDisksFiles] +Neo6_x86_VPN41.sys = 1 + +[DestinationDirs] +DefaultDestDir = 12 +Neo.CopyFiles.Sys = 12 + +[Neo.CopyFiles.Sys] +Neo6_x86_VPN41.sys, , , 2 + +[SoftEther] +%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN41 + +[NeoAdapter.Install] +Characteristics = 0x1 +AddReg = Neo.Reg, NeoAdapter.Ndi +CopyFiles = Neo.CopyFiles.Sys +*IfType = 53 +*MediaType = 0 +*PhysicalMediaType = 0 + +[NeoAdapter.Install.Services] +AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% + +[NeoAdapter.Ndi] +HKR, , NetworkAddress, 0, %DefaultAddress% +HKR, Ndi, DeviceID, , "NeoAdapter_VPN41" +HKR, , DevLoader, , ndis +HKR, , DeviceVxDs, , Neo6_x86_VPN41.sys +HKR, NDIS, LogDriverName, , "Neo_VPN41" +HKR, NDIS, MajorNdisVersion, 1, 5 +HKR, NDIS, MinorNdisVersion, 1, 0 +HKR, Ndi\Interfaces, DefUpper, , "ndis5" +HKR, Ndi\Interfaces, UpperRange, , "ndis5" +HKR, Ndi\Interfaces, LowerRange, , "ethernet" +HKR, Ndi\Interfaces, DefLower, , "ethernet" +HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" +HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% +HKR, Ndi\Params\NetworkAddress, type, 0, "edit" +HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" +HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" +HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% +HKR, Ndi\Params\NetworkAddress, optional, 0, "0" +HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% +HKR, Ndi\Params\MaxSpeed, type, 0, "int" +HKR, Ndi\Params\MaxSpeed, default, 0, "100" +HKR, Ndi\Params\MaxSpeed, min, 0, "0" +HKR, Ndi\Params\MaxSpeed, max, 0, "2000" +HKR, Ndi\Params\MaxSpeed, step, 0, "1" +HKR, Ndi\Params\MaxSpeed, Base, 0, "10" +HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% +HKR, Ndi\Params\KeepLink, type, 0, "enum" +HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% +HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% +HKR, Ndi\Params\KeepLink, default, 0, "0" + + +[Neo.Service] +DisplayName = %Neo.Service.DispName% +Description = %Neo.Service.Desc% +ServiceType = 1 +StartType = 3 +ErrorControl = 1 +ServiceBinary = %12%\Neo6_x86_VPN41.sys +LoadOrderGroup = NDIS + +[Neo.Reg] +HKR, Ndi, Service, 0, Neo.Service.Name +HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" +HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" + +[Neo.EventLog] +HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN41.sys" +HKR, , TypesSupported, 0x00010001, 7 + +[Strings] +CompanyName = "SoftEther Corporation" +DiskDescription = "VPN Client Device Driver Install Disk" +Neo.Service.Name = "Neo_VPN41" +Neo.Service.DispName = "VPN Client Device Driver - VPN41" +Neo.Service.Desc = "VPN Client Adapter - VPN41" +NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN41" +Neo.EventLog.Name = "Neo" +NetworkAddress = "MAC Address" +DefaultAddress = "000001000001" +MaxSpeed = "Indicate Speed (Mbps)" +KeepLink = "Keep Link" +On = "On" +Off = "Off" + + +; Auto Generated 20180205_163615.176 + diff --git a/src/bin/hamcore/DriverPackages/Neo6_Win10/x86/Neo6_x86_VPN42.inf b/src/bin/hamcore/DriverPackages/Neo6_Win10/x86/Neo6_x86_VPN42.inf index 3f3beeb4..77dace8e 100644 --- a/src/bin/hamcore/DriverPackages/Neo6_Win10/x86/Neo6_x86_VPN42.inf +++ b/src/bin/hamcore/DriverPackages/Neo6_Win10/x86/Neo6_x86_VPN42.inf @@ -1,114 +1,114 @@ -; VPN Client Device Driver for Windows 2000 and Greater -; -; Copyright (c) SoftEther Corporation. All Rights Reserved. -; http://www.softether.co.jp/ -; -; BUILD 9658 - -[Version] -Signature = "$Windows NT$" -Class = Net -ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} -Provider = %CompanyName% -DriverVer = 02/04/2018, 4.25.0.9658 -CatalogFile.NT = Neo6_x86_VPN42.cat - -[Manufacturer] -%CompanyName% = SoftEther - -[SourceDisksNames] -1=%DiskDescription%, "", , - -[SourceDisksFiles] -Neo6_x86_VPN42.sys = 1 - -[DestinationDirs] -DefaultDestDir = 12 -Neo.CopyFiles.Sys = 12 - -[Neo.CopyFiles.Sys] -Neo6_x86_VPN42.sys, , , 2 - -[SoftEther] -%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN42 - -[NeoAdapter.Install] -Characteristics = 0x1 -AddReg = Neo.Reg, NeoAdapter.Ndi -CopyFiles = Neo.CopyFiles.Sys -*IfType = 53 -*MediaType = 0 -*PhysicalMediaType = 0 - -[NeoAdapter.Install.Services] -AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% - -[NeoAdapter.Ndi] -HKR, , NetworkAddress, 0, %DefaultAddress% -HKR, Ndi, DeviceID, , "NeoAdapter_VPN42" -HKR, , DevLoader, , ndis -HKR, , DeviceVxDs, , Neo6_x86_VPN42.sys -HKR, NDIS, LogDriverName, , "Neo_VPN42" -HKR, NDIS, MajorNdisVersion, 1, 5 -HKR, NDIS, MinorNdisVersion, 1, 0 -HKR, Ndi\Interfaces, DefUpper, , "ndis5" -HKR, Ndi\Interfaces, UpperRange, , "ndis5" -HKR, Ndi\Interfaces, LowerRange, , "ethernet" -HKR, Ndi\Interfaces, DefLower, , "ethernet" -HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" -HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% -HKR, Ndi\Params\NetworkAddress, type, 0, "edit" -HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" -HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" -HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% -HKR, Ndi\Params\NetworkAddress, optional, 0, "0" -HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% -HKR, Ndi\Params\MaxSpeed, type, 0, "int" -HKR, Ndi\Params\MaxSpeed, default, 0, "100" -HKR, Ndi\Params\MaxSpeed, min, 0, "0" -HKR, Ndi\Params\MaxSpeed, max, 0, "2000" -HKR, Ndi\Params\MaxSpeed, step, 0, "1" -HKR, Ndi\Params\MaxSpeed, Base, 0, "10" -HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% -HKR, Ndi\Params\KeepLink, type, 0, "enum" -HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% -HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% -HKR, Ndi\Params\KeepLink, default, 0, "0" - - -[Neo.Service] -DisplayName = %Neo.Service.DispName% -Description = %Neo.Service.Desc% -ServiceType = 1 -StartType = 3 -ErrorControl = 1 -ServiceBinary = %12%\Neo6_x86_VPN42.sys -LoadOrderGroup = NDIS - -[Neo.Reg] -HKR, Ndi, Service, 0, Neo.Service.Name -HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" -HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" - -[Neo.EventLog] -HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN42.sys" -HKR, , TypesSupported, 0x00010001, 7 - -[Strings] -CompanyName = "SoftEther Corporation" -DiskDescription = "VPN Client Device Driver Install Disk" -Neo.Service.Name = "Neo_VPN42" -Neo.Service.DispName = "VPN Client Device Driver - VPN42" -Neo.Service.Desc = "VPN Client Adapter - VPN42" -NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN42" -Neo.EventLog.Name = "Neo" -NetworkAddress = "MAC Address" -DefaultAddress = "000001000001" -MaxSpeed = "Indicate Speed (Mbps)" -KeepLink = "Keep Link" -On = "On" -Off = "Off" - - -; Auto Generated 20180205_163615.248 - +; VPN Client Device Driver for Windows 2000 and Greater +; +; Copyright (c) SoftEther Corporation. All Rights Reserved. +; http://www.softether.co.jp/ +; +; BUILD 9658 + +[Version] +Signature = "$Windows NT$" +Class = Net +ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} +Provider = %CompanyName% +DriverVer = 02/04/2018, 4.25.0.9658 +CatalogFile.NT = Neo6_x86_VPN42.cat + +[Manufacturer] +%CompanyName% = SoftEther + +[SourceDisksNames] +1=%DiskDescription%, "", , + +[SourceDisksFiles] +Neo6_x86_VPN42.sys = 1 + +[DestinationDirs] +DefaultDestDir = 12 +Neo.CopyFiles.Sys = 12 + +[Neo.CopyFiles.Sys] +Neo6_x86_VPN42.sys, , , 2 + +[SoftEther] +%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN42 + +[NeoAdapter.Install] +Characteristics = 0x1 +AddReg = Neo.Reg, NeoAdapter.Ndi +CopyFiles = Neo.CopyFiles.Sys +*IfType = 53 +*MediaType = 0 +*PhysicalMediaType = 0 + +[NeoAdapter.Install.Services] +AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% + +[NeoAdapter.Ndi] +HKR, , NetworkAddress, 0, %DefaultAddress% +HKR, Ndi, DeviceID, , "NeoAdapter_VPN42" +HKR, , DevLoader, , ndis +HKR, , DeviceVxDs, , Neo6_x86_VPN42.sys +HKR, NDIS, LogDriverName, , "Neo_VPN42" +HKR, NDIS, MajorNdisVersion, 1, 5 +HKR, NDIS, MinorNdisVersion, 1, 0 +HKR, Ndi\Interfaces, DefUpper, , "ndis5" +HKR, Ndi\Interfaces, UpperRange, , "ndis5" +HKR, Ndi\Interfaces, LowerRange, , "ethernet" +HKR, Ndi\Interfaces, DefLower, , "ethernet" +HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" +HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% +HKR, Ndi\Params\NetworkAddress, type, 0, "edit" +HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" +HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" +HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% +HKR, Ndi\Params\NetworkAddress, optional, 0, "0" +HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% +HKR, Ndi\Params\MaxSpeed, type, 0, "int" +HKR, Ndi\Params\MaxSpeed, default, 0, "100" +HKR, Ndi\Params\MaxSpeed, min, 0, "0" +HKR, Ndi\Params\MaxSpeed, max, 0, "2000" +HKR, Ndi\Params\MaxSpeed, step, 0, "1" +HKR, Ndi\Params\MaxSpeed, Base, 0, "10" +HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% +HKR, Ndi\Params\KeepLink, type, 0, "enum" +HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% +HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% +HKR, Ndi\Params\KeepLink, default, 0, "0" + + +[Neo.Service] +DisplayName = %Neo.Service.DispName% +Description = %Neo.Service.Desc% +ServiceType = 1 +StartType = 3 +ErrorControl = 1 +ServiceBinary = %12%\Neo6_x86_VPN42.sys +LoadOrderGroup = NDIS + +[Neo.Reg] +HKR, Ndi, Service, 0, Neo.Service.Name +HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" +HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" + +[Neo.EventLog] +HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN42.sys" +HKR, , TypesSupported, 0x00010001, 7 + +[Strings] +CompanyName = "SoftEther Corporation" +DiskDescription = "VPN Client Device Driver Install Disk" +Neo.Service.Name = "Neo_VPN42" +Neo.Service.DispName = "VPN Client Device Driver - VPN42" +Neo.Service.Desc = "VPN Client Adapter - VPN42" +NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN42" +Neo.EventLog.Name = "Neo" +NetworkAddress = "MAC Address" +DefaultAddress = "000001000001" +MaxSpeed = "Indicate Speed (Mbps)" +KeepLink = "Keep Link" +On = "On" +Off = "Off" + + +; Auto Generated 20180205_163615.248 + diff --git a/src/bin/hamcore/DriverPackages/Neo6_Win10/x86/Neo6_x86_VPN43.inf b/src/bin/hamcore/DriverPackages/Neo6_Win10/x86/Neo6_x86_VPN43.inf index 748d2c4e..d2b59fc4 100644 --- a/src/bin/hamcore/DriverPackages/Neo6_Win10/x86/Neo6_x86_VPN43.inf +++ b/src/bin/hamcore/DriverPackages/Neo6_Win10/x86/Neo6_x86_VPN43.inf @@ -1,114 +1,114 @@ -; VPN Client Device Driver for Windows 2000 and Greater -; -; Copyright (c) SoftEther Corporation. All Rights Reserved. -; http://www.softether.co.jp/ -; -; BUILD 9658 - -[Version] -Signature = "$Windows NT$" -Class = Net -ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} -Provider = %CompanyName% -DriverVer = 02/04/2018, 4.25.0.9658 -CatalogFile.NT = Neo6_x86_VPN43.cat - -[Manufacturer] -%CompanyName% = SoftEther - -[SourceDisksNames] -1=%DiskDescription%, "", , - -[SourceDisksFiles] -Neo6_x86_VPN43.sys = 1 - -[DestinationDirs] -DefaultDestDir = 12 -Neo.CopyFiles.Sys = 12 - -[Neo.CopyFiles.Sys] -Neo6_x86_VPN43.sys, , , 2 - -[SoftEther] -%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN43 - -[NeoAdapter.Install] -Characteristics = 0x1 -AddReg = Neo.Reg, NeoAdapter.Ndi -CopyFiles = Neo.CopyFiles.Sys -*IfType = 53 -*MediaType = 0 -*PhysicalMediaType = 0 - -[NeoAdapter.Install.Services] -AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% - -[NeoAdapter.Ndi] -HKR, , NetworkAddress, 0, %DefaultAddress% -HKR, Ndi, DeviceID, , "NeoAdapter_VPN43" -HKR, , DevLoader, , ndis -HKR, , DeviceVxDs, , Neo6_x86_VPN43.sys -HKR, NDIS, LogDriverName, , "Neo_VPN43" -HKR, NDIS, MajorNdisVersion, 1, 5 -HKR, NDIS, MinorNdisVersion, 1, 0 -HKR, Ndi\Interfaces, DefUpper, , "ndis5" -HKR, Ndi\Interfaces, UpperRange, , "ndis5" -HKR, Ndi\Interfaces, LowerRange, , "ethernet" -HKR, Ndi\Interfaces, DefLower, , "ethernet" -HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" -HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% -HKR, Ndi\Params\NetworkAddress, type, 0, "edit" -HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" -HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" -HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% -HKR, Ndi\Params\NetworkAddress, optional, 0, "0" -HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% -HKR, Ndi\Params\MaxSpeed, type, 0, "int" -HKR, Ndi\Params\MaxSpeed, default, 0, "100" -HKR, Ndi\Params\MaxSpeed, min, 0, "0" -HKR, Ndi\Params\MaxSpeed, max, 0, "2000" -HKR, Ndi\Params\MaxSpeed, step, 0, "1" -HKR, Ndi\Params\MaxSpeed, Base, 0, "10" -HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% -HKR, Ndi\Params\KeepLink, type, 0, "enum" -HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% -HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% -HKR, Ndi\Params\KeepLink, default, 0, "0" - - -[Neo.Service] -DisplayName = %Neo.Service.DispName% -Description = %Neo.Service.Desc% -ServiceType = 1 -StartType = 3 -ErrorControl = 1 -ServiceBinary = %12%\Neo6_x86_VPN43.sys -LoadOrderGroup = NDIS - -[Neo.Reg] -HKR, Ndi, Service, 0, Neo.Service.Name -HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" -HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" - -[Neo.EventLog] -HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN43.sys" -HKR, , TypesSupported, 0x00010001, 7 - -[Strings] -CompanyName = "SoftEther Corporation" -DiskDescription = "VPN Client Device Driver Install Disk" -Neo.Service.Name = "Neo_VPN43" -Neo.Service.DispName = "VPN Client Device Driver - VPN43" -Neo.Service.Desc = "VPN Client Adapter - VPN43" -NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN43" -Neo.EventLog.Name = "Neo" -NetworkAddress = "MAC Address" -DefaultAddress = "000001000001" -MaxSpeed = "Indicate Speed (Mbps)" -KeepLink = "Keep Link" -On = "On" -Off = "Off" - - -; Auto Generated 20180205_163615.319 - +; VPN Client Device Driver for Windows 2000 and Greater +; +; Copyright (c) SoftEther Corporation. All Rights Reserved. +; http://www.softether.co.jp/ +; +; BUILD 9658 + +[Version] +Signature = "$Windows NT$" +Class = Net +ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} +Provider = %CompanyName% +DriverVer = 02/04/2018, 4.25.0.9658 +CatalogFile.NT = Neo6_x86_VPN43.cat + +[Manufacturer] +%CompanyName% = SoftEther + +[SourceDisksNames] +1=%DiskDescription%, "", , + +[SourceDisksFiles] +Neo6_x86_VPN43.sys = 1 + +[DestinationDirs] +DefaultDestDir = 12 +Neo.CopyFiles.Sys = 12 + +[Neo.CopyFiles.Sys] +Neo6_x86_VPN43.sys, , , 2 + +[SoftEther] +%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN43 + +[NeoAdapter.Install] +Characteristics = 0x1 +AddReg = Neo.Reg, NeoAdapter.Ndi +CopyFiles = Neo.CopyFiles.Sys +*IfType = 53 +*MediaType = 0 +*PhysicalMediaType = 0 + +[NeoAdapter.Install.Services] +AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% + +[NeoAdapter.Ndi] +HKR, , NetworkAddress, 0, %DefaultAddress% +HKR, Ndi, DeviceID, , "NeoAdapter_VPN43" +HKR, , DevLoader, , ndis +HKR, , DeviceVxDs, , Neo6_x86_VPN43.sys +HKR, NDIS, LogDriverName, , "Neo_VPN43" +HKR, NDIS, MajorNdisVersion, 1, 5 +HKR, NDIS, MinorNdisVersion, 1, 0 +HKR, Ndi\Interfaces, DefUpper, , "ndis5" +HKR, Ndi\Interfaces, UpperRange, , "ndis5" +HKR, Ndi\Interfaces, LowerRange, , "ethernet" +HKR, Ndi\Interfaces, DefLower, , "ethernet" +HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" +HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% +HKR, Ndi\Params\NetworkAddress, type, 0, "edit" +HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" +HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" +HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% +HKR, Ndi\Params\NetworkAddress, optional, 0, "0" +HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% +HKR, Ndi\Params\MaxSpeed, type, 0, "int" +HKR, Ndi\Params\MaxSpeed, default, 0, "100" +HKR, Ndi\Params\MaxSpeed, min, 0, "0" +HKR, Ndi\Params\MaxSpeed, max, 0, "2000" +HKR, Ndi\Params\MaxSpeed, step, 0, "1" +HKR, Ndi\Params\MaxSpeed, Base, 0, "10" +HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% +HKR, Ndi\Params\KeepLink, type, 0, "enum" +HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% +HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% +HKR, Ndi\Params\KeepLink, default, 0, "0" + + +[Neo.Service] +DisplayName = %Neo.Service.DispName% +Description = %Neo.Service.Desc% +ServiceType = 1 +StartType = 3 +ErrorControl = 1 +ServiceBinary = %12%\Neo6_x86_VPN43.sys +LoadOrderGroup = NDIS + +[Neo.Reg] +HKR, Ndi, Service, 0, Neo.Service.Name +HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" +HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" + +[Neo.EventLog] +HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN43.sys" +HKR, , TypesSupported, 0x00010001, 7 + +[Strings] +CompanyName = "SoftEther Corporation" +DiskDescription = "VPN Client Device Driver Install Disk" +Neo.Service.Name = "Neo_VPN43" +Neo.Service.DispName = "VPN Client Device Driver - VPN43" +Neo.Service.Desc = "VPN Client Adapter - VPN43" +NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN43" +Neo.EventLog.Name = "Neo" +NetworkAddress = "MAC Address" +DefaultAddress = "000001000001" +MaxSpeed = "Indicate Speed (Mbps)" +KeepLink = "Keep Link" +On = "On" +Off = "Off" + + +; Auto Generated 20180205_163615.319 + diff --git a/src/bin/hamcore/DriverPackages/Neo6_Win10/x86/Neo6_x86_VPN44.inf b/src/bin/hamcore/DriverPackages/Neo6_Win10/x86/Neo6_x86_VPN44.inf index 6a4fdf5f..3ac1025d 100644 --- a/src/bin/hamcore/DriverPackages/Neo6_Win10/x86/Neo6_x86_VPN44.inf +++ b/src/bin/hamcore/DriverPackages/Neo6_Win10/x86/Neo6_x86_VPN44.inf @@ -1,114 +1,114 @@ -; VPN Client Device Driver for Windows 2000 and Greater -; -; Copyright (c) SoftEther Corporation. All Rights Reserved. -; http://www.softether.co.jp/ -; -; BUILD 9658 - -[Version] -Signature = "$Windows NT$" -Class = Net -ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} -Provider = %CompanyName% -DriverVer = 02/04/2018, 4.25.0.9658 -CatalogFile.NT = Neo6_x86_VPN44.cat - -[Manufacturer] -%CompanyName% = SoftEther - -[SourceDisksNames] -1=%DiskDescription%, "", , - -[SourceDisksFiles] -Neo6_x86_VPN44.sys = 1 - -[DestinationDirs] -DefaultDestDir = 12 -Neo.CopyFiles.Sys = 12 - -[Neo.CopyFiles.Sys] -Neo6_x86_VPN44.sys, , , 2 - -[SoftEther] -%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN44 - -[NeoAdapter.Install] -Characteristics = 0x1 -AddReg = Neo.Reg, NeoAdapter.Ndi -CopyFiles = Neo.CopyFiles.Sys -*IfType = 53 -*MediaType = 0 -*PhysicalMediaType = 0 - -[NeoAdapter.Install.Services] -AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% - -[NeoAdapter.Ndi] -HKR, , NetworkAddress, 0, %DefaultAddress% -HKR, Ndi, DeviceID, , "NeoAdapter_VPN44" -HKR, , DevLoader, , ndis -HKR, , DeviceVxDs, , Neo6_x86_VPN44.sys -HKR, NDIS, LogDriverName, , "Neo_VPN44" -HKR, NDIS, MajorNdisVersion, 1, 5 -HKR, NDIS, MinorNdisVersion, 1, 0 -HKR, Ndi\Interfaces, DefUpper, , "ndis5" -HKR, Ndi\Interfaces, UpperRange, , "ndis5" -HKR, Ndi\Interfaces, LowerRange, , "ethernet" -HKR, Ndi\Interfaces, DefLower, , "ethernet" -HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" -HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% -HKR, Ndi\Params\NetworkAddress, type, 0, "edit" -HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" -HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" -HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% -HKR, Ndi\Params\NetworkAddress, optional, 0, "0" -HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% -HKR, Ndi\Params\MaxSpeed, type, 0, "int" -HKR, Ndi\Params\MaxSpeed, default, 0, "100" -HKR, Ndi\Params\MaxSpeed, min, 0, "0" -HKR, Ndi\Params\MaxSpeed, max, 0, "2000" -HKR, Ndi\Params\MaxSpeed, step, 0, "1" -HKR, Ndi\Params\MaxSpeed, Base, 0, "10" -HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% -HKR, Ndi\Params\KeepLink, type, 0, "enum" -HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% -HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% -HKR, Ndi\Params\KeepLink, default, 0, "0" - - -[Neo.Service] -DisplayName = %Neo.Service.DispName% -Description = %Neo.Service.Desc% -ServiceType = 1 -StartType = 3 -ErrorControl = 1 -ServiceBinary = %12%\Neo6_x86_VPN44.sys -LoadOrderGroup = NDIS - -[Neo.Reg] -HKR, Ndi, Service, 0, Neo.Service.Name -HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" -HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" - -[Neo.EventLog] -HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN44.sys" -HKR, , TypesSupported, 0x00010001, 7 - -[Strings] -CompanyName = "SoftEther Corporation" -DiskDescription = "VPN Client Device Driver Install Disk" -Neo.Service.Name = "Neo_VPN44" -Neo.Service.DispName = "VPN Client Device Driver - VPN44" -Neo.Service.Desc = "VPN Client Adapter - VPN44" -NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN44" -Neo.EventLog.Name = "Neo" -NetworkAddress = "MAC Address" -DefaultAddress = "000001000001" -MaxSpeed = "Indicate Speed (Mbps)" -KeepLink = "Keep Link" -On = "On" -Off = "Off" - - -; Auto Generated 20180205_163615.392 - +; VPN Client Device Driver for Windows 2000 and Greater +; +; Copyright (c) SoftEther Corporation. All Rights Reserved. +; http://www.softether.co.jp/ +; +; BUILD 9658 + +[Version] +Signature = "$Windows NT$" +Class = Net +ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} +Provider = %CompanyName% +DriverVer = 02/04/2018, 4.25.0.9658 +CatalogFile.NT = Neo6_x86_VPN44.cat + +[Manufacturer] +%CompanyName% = SoftEther + +[SourceDisksNames] +1=%DiskDescription%, "", , + +[SourceDisksFiles] +Neo6_x86_VPN44.sys = 1 + +[DestinationDirs] +DefaultDestDir = 12 +Neo.CopyFiles.Sys = 12 + +[Neo.CopyFiles.Sys] +Neo6_x86_VPN44.sys, , , 2 + +[SoftEther] +%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN44 + +[NeoAdapter.Install] +Characteristics = 0x1 +AddReg = Neo.Reg, NeoAdapter.Ndi +CopyFiles = Neo.CopyFiles.Sys +*IfType = 53 +*MediaType = 0 +*PhysicalMediaType = 0 + +[NeoAdapter.Install.Services] +AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% + +[NeoAdapter.Ndi] +HKR, , NetworkAddress, 0, %DefaultAddress% +HKR, Ndi, DeviceID, , "NeoAdapter_VPN44" +HKR, , DevLoader, , ndis +HKR, , DeviceVxDs, , Neo6_x86_VPN44.sys +HKR, NDIS, LogDriverName, , "Neo_VPN44" +HKR, NDIS, MajorNdisVersion, 1, 5 +HKR, NDIS, MinorNdisVersion, 1, 0 +HKR, Ndi\Interfaces, DefUpper, , "ndis5" +HKR, Ndi\Interfaces, UpperRange, , "ndis5" +HKR, Ndi\Interfaces, LowerRange, , "ethernet" +HKR, Ndi\Interfaces, DefLower, , "ethernet" +HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" +HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% +HKR, Ndi\Params\NetworkAddress, type, 0, "edit" +HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" +HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" +HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% +HKR, Ndi\Params\NetworkAddress, optional, 0, "0" +HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% +HKR, Ndi\Params\MaxSpeed, type, 0, "int" +HKR, Ndi\Params\MaxSpeed, default, 0, "100" +HKR, Ndi\Params\MaxSpeed, min, 0, "0" +HKR, Ndi\Params\MaxSpeed, max, 0, "2000" +HKR, Ndi\Params\MaxSpeed, step, 0, "1" +HKR, Ndi\Params\MaxSpeed, Base, 0, "10" +HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% +HKR, Ndi\Params\KeepLink, type, 0, "enum" +HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% +HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% +HKR, Ndi\Params\KeepLink, default, 0, "0" + + +[Neo.Service] +DisplayName = %Neo.Service.DispName% +Description = %Neo.Service.Desc% +ServiceType = 1 +StartType = 3 +ErrorControl = 1 +ServiceBinary = %12%\Neo6_x86_VPN44.sys +LoadOrderGroup = NDIS + +[Neo.Reg] +HKR, Ndi, Service, 0, Neo.Service.Name +HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" +HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" + +[Neo.EventLog] +HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN44.sys" +HKR, , TypesSupported, 0x00010001, 7 + +[Strings] +CompanyName = "SoftEther Corporation" +DiskDescription = "VPN Client Device Driver Install Disk" +Neo.Service.Name = "Neo_VPN44" +Neo.Service.DispName = "VPN Client Device Driver - VPN44" +Neo.Service.Desc = "VPN Client Adapter - VPN44" +NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN44" +Neo.EventLog.Name = "Neo" +NetworkAddress = "MAC Address" +DefaultAddress = "000001000001" +MaxSpeed = "Indicate Speed (Mbps)" +KeepLink = "Keep Link" +On = "On" +Off = "Off" + + +; Auto Generated 20180205_163615.392 + diff --git a/src/bin/hamcore/DriverPackages/Neo6_Win10/x86/Neo6_x86_VPN45.inf b/src/bin/hamcore/DriverPackages/Neo6_Win10/x86/Neo6_x86_VPN45.inf index b9d58540..d6bcbaa6 100644 --- a/src/bin/hamcore/DriverPackages/Neo6_Win10/x86/Neo6_x86_VPN45.inf +++ b/src/bin/hamcore/DriverPackages/Neo6_Win10/x86/Neo6_x86_VPN45.inf @@ -1,114 +1,114 @@ -; VPN Client Device Driver for Windows 2000 and Greater -; -; Copyright (c) SoftEther Corporation. All Rights Reserved. -; http://www.softether.co.jp/ -; -; BUILD 9658 - -[Version] -Signature = "$Windows NT$" -Class = Net -ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} -Provider = %CompanyName% -DriverVer = 02/04/2018, 4.25.0.9658 -CatalogFile.NT = Neo6_x86_VPN45.cat - -[Manufacturer] -%CompanyName% = SoftEther - -[SourceDisksNames] -1=%DiskDescription%, "", , - -[SourceDisksFiles] -Neo6_x86_VPN45.sys = 1 - -[DestinationDirs] -DefaultDestDir = 12 -Neo.CopyFiles.Sys = 12 - -[Neo.CopyFiles.Sys] -Neo6_x86_VPN45.sys, , , 2 - -[SoftEther] -%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN45 - -[NeoAdapter.Install] -Characteristics = 0x1 -AddReg = Neo.Reg, NeoAdapter.Ndi -CopyFiles = Neo.CopyFiles.Sys -*IfType = 53 -*MediaType = 0 -*PhysicalMediaType = 0 - -[NeoAdapter.Install.Services] -AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% - -[NeoAdapter.Ndi] -HKR, , NetworkAddress, 0, %DefaultAddress% -HKR, Ndi, DeviceID, , "NeoAdapter_VPN45" -HKR, , DevLoader, , ndis -HKR, , DeviceVxDs, , Neo6_x86_VPN45.sys -HKR, NDIS, LogDriverName, , "Neo_VPN45" -HKR, NDIS, MajorNdisVersion, 1, 5 -HKR, NDIS, MinorNdisVersion, 1, 0 -HKR, Ndi\Interfaces, DefUpper, , "ndis5" -HKR, Ndi\Interfaces, UpperRange, , "ndis5" -HKR, Ndi\Interfaces, LowerRange, , "ethernet" -HKR, Ndi\Interfaces, DefLower, , "ethernet" -HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" -HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% -HKR, Ndi\Params\NetworkAddress, type, 0, "edit" -HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" -HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" -HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% -HKR, Ndi\Params\NetworkAddress, optional, 0, "0" -HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% -HKR, Ndi\Params\MaxSpeed, type, 0, "int" -HKR, Ndi\Params\MaxSpeed, default, 0, "100" -HKR, Ndi\Params\MaxSpeed, min, 0, "0" -HKR, Ndi\Params\MaxSpeed, max, 0, "2000" -HKR, Ndi\Params\MaxSpeed, step, 0, "1" -HKR, Ndi\Params\MaxSpeed, Base, 0, "10" -HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% -HKR, Ndi\Params\KeepLink, type, 0, "enum" -HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% -HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% -HKR, Ndi\Params\KeepLink, default, 0, "0" - - -[Neo.Service] -DisplayName = %Neo.Service.DispName% -Description = %Neo.Service.Desc% -ServiceType = 1 -StartType = 3 -ErrorControl = 1 -ServiceBinary = %12%\Neo6_x86_VPN45.sys -LoadOrderGroup = NDIS - -[Neo.Reg] -HKR, Ndi, Service, 0, Neo.Service.Name -HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" -HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" - -[Neo.EventLog] -HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN45.sys" -HKR, , TypesSupported, 0x00010001, 7 - -[Strings] -CompanyName = "SoftEther Corporation" -DiskDescription = "VPN Client Device Driver Install Disk" -Neo.Service.Name = "Neo_VPN45" -Neo.Service.DispName = "VPN Client Device Driver - VPN45" -Neo.Service.Desc = "VPN Client Adapter - VPN45" -NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN45" -Neo.EventLog.Name = "Neo" -NetworkAddress = "MAC Address" -DefaultAddress = "000001000001" -MaxSpeed = "Indicate Speed (Mbps)" -KeepLink = "Keep Link" -On = "On" -Off = "Off" - - -; Auto Generated 20180205_163615.464 - +; VPN Client Device Driver for Windows 2000 and Greater +; +; Copyright (c) SoftEther Corporation. All Rights Reserved. +; http://www.softether.co.jp/ +; +; BUILD 9658 + +[Version] +Signature = "$Windows NT$" +Class = Net +ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} +Provider = %CompanyName% +DriverVer = 02/04/2018, 4.25.0.9658 +CatalogFile.NT = Neo6_x86_VPN45.cat + +[Manufacturer] +%CompanyName% = SoftEther + +[SourceDisksNames] +1=%DiskDescription%, "", , + +[SourceDisksFiles] +Neo6_x86_VPN45.sys = 1 + +[DestinationDirs] +DefaultDestDir = 12 +Neo.CopyFiles.Sys = 12 + +[Neo.CopyFiles.Sys] +Neo6_x86_VPN45.sys, , , 2 + +[SoftEther] +%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN45 + +[NeoAdapter.Install] +Characteristics = 0x1 +AddReg = Neo.Reg, NeoAdapter.Ndi +CopyFiles = Neo.CopyFiles.Sys +*IfType = 53 +*MediaType = 0 +*PhysicalMediaType = 0 + +[NeoAdapter.Install.Services] +AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% + +[NeoAdapter.Ndi] +HKR, , NetworkAddress, 0, %DefaultAddress% +HKR, Ndi, DeviceID, , "NeoAdapter_VPN45" +HKR, , DevLoader, , ndis +HKR, , DeviceVxDs, , Neo6_x86_VPN45.sys +HKR, NDIS, LogDriverName, , "Neo_VPN45" +HKR, NDIS, MajorNdisVersion, 1, 5 +HKR, NDIS, MinorNdisVersion, 1, 0 +HKR, Ndi\Interfaces, DefUpper, , "ndis5" +HKR, Ndi\Interfaces, UpperRange, , "ndis5" +HKR, Ndi\Interfaces, LowerRange, , "ethernet" +HKR, Ndi\Interfaces, DefLower, , "ethernet" +HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" +HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% +HKR, Ndi\Params\NetworkAddress, type, 0, "edit" +HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" +HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" +HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% +HKR, Ndi\Params\NetworkAddress, optional, 0, "0" +HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% +HKR, Ndi\Params\MaxSpeed, type, 0, "int" +HKR, Ndi\Params\MaxSpeed, default, 0, "100" +HKR, Ndi\Params\MaxSpeed, min, 0, "0" +HKR, Ndi\Params\MaxSpeed, max, 0, "2000" +HKR, Ndi\Params\MaxSpeed, step, 0, "1" +HKR, Ndi\Params\MaxSpeed, Base, 0, "10" +HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% +HKR, Ndi\Params\KeepLink, type, 0, "enum" +HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% +HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% +HKR, Ndi\Params\KeepLink, default, 0, "0" + + +[Neo.Service] +DisplayName = %Neo.Service.DispName% +Description = %Neo.Service.Desc% +ServiceType = 1 +StartType = 3 +ErrorControl = 1 +ServiceBinary = %12%\Neo6_x86_VPN45.sys +LoadOrderGroup = NDIS + +[Neo.Reg] +HKR, Ndi, Service, 0, Neo.Service.Name +HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" +HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" + +[Neo.EventLog] +HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN45.sys" +HKR, , TypesSupported, 0x00010001, 7 + +[Strings] +CompanyName = "SoftEther Corporation" +DiskDescription = "VPN Client Device Driver Install Disk" +Neo.Service.Name = "Neo_VPN45" +Neo.Service.DispName = "VPN Client Device Driver - VPN45" +Neo.Service.Desc = "VPN Client Adapter - VPN45" +NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN45" +Neo.EventLog.Name = "Neo" +NetworkAddress = "MAC Address" +DefaultAddress = "000001000001" +MaxSpeed = "Indicate Speed (Mbps)" +KeepLink = "Keep Link" +On = "On" +Off = "Off" + + +; Auto Generated 20180205_163615.464 + diff --git a/src/bin/hamcore/DriverPackages/Neo6_Win10/x86/Neo6_x86_VPN46.inf b/src/bin/hamcore/DriverPackages/Neo6_Win10/x86/Neo6_x86_VPN46.inf index 83afbc82..d6428c79 100644 --- a/src/bin/hamcore/DriverPackages/Neo6_Win10/x86/Neo6_x86_VPN46.inf +++ b/src/bin/hamcore/DriverPackages/Neo6_Win10/x86/Neo6_x86_VPN46.inf @@ -1,114 +1,114 @@ -; VPN Client Device Driver for Windows 2000 and Greater -; -; Copyright (c) SoftEther Corporation. All Rights Reserved. -; http://www.softether.co.jp/ -; -; BUILD 9658 - -[Version] -Signature = "$Windows NT$" -Class = Net -ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} -Provider = %CompanyName% -DriverVer = 02/04/2018, 4.25.0.9658 -CatalogFile.NT = Neo6_x86_VPN46.cat - -[Manufacturer] -%CompanyName% = SoftEther - -[SourceDisksNames] -1=%DiskDescription%, "", , - -[SourceDisksFiles] -Neo6_x86_VPN46.sys = 1 - -[DestinationDirs] -DefaultDestDir = 12 -Neo.CopyFiles.Sys = 12 - -[Neo.CopyFiles.Sys] -Neo6_x86_VPN46.sys, , , 2 - -[SoftEther] -%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN46 - -[NeoAdapter.Install] -Characteristics = 0x1 -AddReg = Neo.Reg, NeoAdapter.Ndi -CopyFiles = Neo.CopyFiles.Sys -*IfType = 53 -*MediaType = 0 -*PhysicalMediaType = 0 - -[NeoAdapter.Install.Services] -AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% - -[NeoAdapter.Ndi] -HKR, , NetworkAddress, 0, %DefaultAddress% -HKR, Ndi, DeviceID, , "NeoAdapter_VPN46" -HKR, , DevLoader, , ndis -HKR, , DeviceVxDs, , Neo6_x86_VPN46.sys -HKR, NDIS, LogDriverName, , "Neo_VPN46" -HKR, NDIS, MajorNdisVersion, 1, 5 -HKR, NDIS, MinorNdisVersion, 1, 0 -HKR, Ndi\Interfaces, DefUpper, , "ndis5" -HKR, Ndi\Interfaces, UpperRange, , "ndis5" -HKR, Ndi\Interfaces, LowerRange, , "ethernet" -HKR, Ndi\Interfaces, DefLower, , "ethernet" -HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" -HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% -HKR, Ndi\Params\NetworkAddress, type, 0, "edit" -HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" -HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" -HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% -HKR, Ndi\Params\NetworkAddress, optional, 0, "0" -HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% -HKR, Ndi\Params\MaxSpeed, type, 0, "int" -HKR, Ndi\Params\MaxSpeed, default, 0, "100" -HKR, Ndi\Params\MaxSpeed, min, 0, "0" -HKR, Ndi\Params\MaxSpeed, max, 0, "2000" -HKR, Ndi\Params\MaxSpeed, step, 0, "1" -HKR, Ndi\Params\MaxSpeed, Base, 0, "10" -HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% -HKR, Ndi\Params\KeepLink, type, 0, "enum" -HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% -HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% -HKR, Ndi\Params\KeepLink, default, 0, "0" - - -[Neo.Service] -DisplayName = %Neo.Service.DispName% -Description = %Neo.Service.Desc% -ServiceType = 1 -StartType = 3 -ErrorControl = 1 -ServiceBinary = %12%\Neo6_x86_VPN46.sys -LoadOrderGroup = NDIS - -[Neo.Reg] -HKR, Ndi, Service, 0, Neo.Service.Name -HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" -HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" - -[Neo.EventLog] -HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN46.sys" -HKR, , TypesSupported, 0x00010001, 7 - -[Strings] -CompanyName = "SoftEther Corporation" -DiskDescription = "VPN Client Device Driver Install Disk" -Neo.Service.Name = "Neo_VPN46" -Neo.Service.DispName = "VPN Client Device Driver - VPN46" -Neo.Service.Desc = "VPN Client Adapter - VPN46" -NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN46" -Neo.EventLog.Name = "Neo" -NetworkAddress = "MAC Address" -DefaultAddress = "000001000001" -MaxSpeed = "Indicate Speed (Mbps)" -KeepLink = "Keep Link" -On = "On" -Off = "Off" - - -; Auto Generated 20180205_163615.542 - +; VPN Client Device Driver for Windows 2000 and Greater +; +; Copyright (c) SoftEther Corporation. All Rights Reserved. +; http://www.softether.co.jp/ +; +; BUILD 9658 + +[Version] +Signature = "$Windows NT$" +Class = Net +ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} +Provider = %CompanyName% +DriverVer = 02/04/2018, 4.25.0.9658 +CatalogFile.NT = Neo6_x86_VPN46.cat + +[Manufacturer] +%CompanyName% = SoftEther + +[SourceDisksNames] +1=%DiskDescription%, "", , + +[SourceDisksFiles] +Neo6_x86_VPN46.sys = 1 + +[DestinationDirs] +DefaultDestDir = 12 +Neo.CopyFiles.Sys = 12 + +[Neo.CopyFiles.Sys] +Neo6_x86_VPN46.sys, , , 2 + +[SoftEther] +%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN46 + +[NeoAdapter.Install] +Characteristics = 0x1 +AddReg = Neo.Reg, NeoAdapter.Ndi +CopyFiles = Neo.CopyFiles.Sys +*IfType = 53 +*MediaType = 0 +*PhysicalMediaType = 0 + +[NeoAdapter.Install.Services] +AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% + +[NeoAdapter.Ndi] +HKR, , NetworkAddress, 0, %DefaultAddress% +HKR, Ndi, DeviceID, , "NeoAdapter_VPN46" +HKR, , DevLoader, , ndis +HKR, , DeviceVxDs, , Neo6_x86_VPN46.sys +HKR, NDIS, LogDriverName, , "Neo_VPN46" +HKR, NDIS, MajorNdisVersion, 1, 5 +HKR, NDIS, MinorNdisVersion, 1, 0 +HKR, Ndi\Interfaces, DefUpper, , "ndis5" +HKR, Ndi\Interfaces, UpperRange, , "ndis5" +HKR, Ndi\Interfaces, LowerRange, , "ethernet" +HKR, Ndi\Interfaces, DefLower, , "ethernet" +HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" +HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% +HKR, Ndi\Params\NetworkAddress, type, 0, "edit" +HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" +HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" +HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% +HKR, Ndi\Params\NetworkAddress, optional, 0, "0" +HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% +HKR, Ndi\Params\MaxSpeed, type, 0, "int" +HKR, Ndi\Params\MaxSpeed, default, 0, "100" +HKR, Ndi\Params\MaxSpeed, min, 0, "0" +HKR, Ndi\Params\MaxSpeed, max, 0, "2000" +HKR, Ndi\Params\MaxSpeed, step, 0, "1" +HKR, Ndi\Params\MaxSpeed, Base, 0, "10" +HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% +HKR, Ndi\Params\KeepLink, type, 0, "enum" +HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% +HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% +HKR, Ndi\Params\KeepLink, default, 0, "0" + + +[Neo.Service] +DisplayName = %Neo.Service.DispName% +Description = %Neo.Service.Desc% +ServiceType = 1 +StartType = 3 +ErrorControl = 1 +ServiceBinary = %12%\Neo6_x86_VPN46.sys +LoadOrderGroup = NDIS + +[Neo.Reg] +HKR, Ndi, Service, 0, Neo.Service.Name +HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" +HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" + +[Neo.EventLog] +HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN46.sys" +HKR, , TypesSupported, 0x00010001, 7 + +[Strings] +CompanyName = "SoftEther Corporation" +DiskDescription = "VPN Client Device Driver Install Disk" +Neo.Service.Name = "Neo_VPN46" +Neo.Service.DispName = "VPN Client Device Driver - VPN46" +Neo.Service.Desc = "VPN Client Adapter - VPN46" +NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN46" +Neo.EventLog.Name = "Neo" +NetworkAddress = "MAC Address" +DefaultAddress = "000001000001" +MaxSpeed = "Indicate Speed (Mbps)" +KeepLink = "Keep Link" +On = "On" +Off = "Off" + + +; Auto Generated 20180205_163615.542 + diff --git a/src/bin/hamcore/DriverPackages/Neo6_Win10/x86/Neo6_x86_VPN47.inf b/src/bin/hamcore/DriverPackages/Neo6_Win10/x86/Neo6_x86_VPN47.inf index 225c51e3..750bd380 100644 --- a/src/bin/hamcore/DriverPackages/Neo6_Win10/x86/Neo6_x86_VPN47.inf +++ b/src/bin/hamcore/DriverPackages/Neo6_Win10/x86/Neo6_x86_VPN47.inf @@ -1,114 +1,114 @@ -; VPN Client Device Driver for Windows 2000 and Greater -; -; Copyright (c) SoftEther Corporation. All Rights Reserved. -; http://www.softether.co.jp/ -; -; BUILD 9658 - -[Version] -Signature = "$Windows NT$" -Class = Net -ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} -Provider = %CompanyName% -DriverVer = 02/04/2018, 4.25.0.9658 -CatalogFile.NT = Neo6_x86_VPN47.cat - -[Manufacturer] -%CompanyName% = SoftEther - -[SourceDisksNames] -1=%DiskDescription%, "", , - -[SourceDisksFiles] -Neo6_x86_VPN47.sys = 1 - -[DestinationDirs] -DefaultDestDir = 12 -Neo.CopyFiles.Sys = 12 - -[Neo.CopyFiles.Sys] -Neo6_x86_VPN47.sys, , , 2 - -[SoftEther] -%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN47 - -[NeoAdapter.Install] -Characteristics = 0x1 -AddReg = Neo.Reg, NeoAdapter.Ndi -CopyFiles = Neo.CopyFiles.Sys -*IfType = 53 -*MediaType = 0 -*PhysicalMediaType = 0 - -[NeoAdapter.Install.Services] -AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% - -[NeoAdapter.Ndi] -HKR, , NetworkAddress, 0, %DefaultAddress% -HKR, Ndi, DeviceID, , "NeoAdapter_VPN47" -HKR, , DevLoader, , ndis -HKR, , DeviceVxDs, , Neo6_x86_VPN47.sys -HKR, NDIS, LogDriverName, , "Neo_VPN47" -HKR, NDIS, MajorNdisVersion, 1, 5 -HKR, NDIS, MinorNdisVersion, 1, 0 -HKR, Ndi\Interfaces, DefUpper, , "ndis5" -HKR, Ndi\Interfaces, UpperRange, , "ndis5" -HKR, Ndi\Interfaces, LowerRange, , "ethernet" -HKR, Ndi\Interfaces, DefLower, , "ethernet" -HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" -HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% -HKR, Ndi\Params\NetworkAddress, type, 0, "edit" -HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" -HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" -HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% -HKR, Ndi\Params\NetworkAddress, optional, 0, "0" -HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% -HKR, Ndi\Params\MaxSpeed, type, 0, "int" -HKR, Ndi\Params\MaxSpeed, default, 0, "100" -HKR, Ndi\Params\MaxSpeed, min, 0, "0" -HKR, Ndi\Params\MaxSpeed, max, 0, "2000" -HKR, Ndi\Params\MaxSpeed, step, 0, "1" -HKR, Ndi\Params\MaxSpeed, Base, 0, "10" -HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% -HKR, Ndi\Params\KeepLink, type, 0, "enum" -HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% -HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% -HKR, Ndi\Params\KeepLink, default, 0, "0" - - -[Neo.Service] -DisplayName = %Neo.Service.DispName% -Description = %Neo.Service.Desc% -ServiceType = 1 -StartType = 3 -ErrorControl = 1 -ServiceBinary = %12%\Neo6_x86_VPN47.sys -LoadOrderGroup = NDIS - -[Neo.Reg] -HKR, Ndi, Service, 0, Neo.Service.Name -HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" -HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" - -[Neo.EventLog] -HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN47.sys" -HKR, , TypesSupported, 0x00010001, 7 - -[Strings] -CompanyName = "SoftEther Corporation" -DiskDescription = "VPN Client Device Driver Install Disk" -Neo.Service.Name = "Neo_VPN47" -Neo.Service.DispName = "VPN Client Device Driver - VPN47" -Neo.Service.Desc = "VPN Client Adapter - VPN47" -NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN47" -Neo.EventLog.Name = "Neo" -NetworkAddress = "MAC Address" -DefaultAddress = "000001000001" -MaxSpeed = "Indicate Speed (Mbps)" -KeepLink = "Keep Link" -On = "On" -Off = "Off" - - -; Auto Generated 20180205_163615.612 - +; VPN Client Device Driver for Windows 2000 and Greater +; +; Copyright (c) SoftEther Corporation. All Rights Reserved. +; http://www.softether.co.jp/ +; +; BUILD 9658 + +[Version] +Signature = "$Windows NT$" +Class = Net +ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} +Provider = %CompanyName% +DriverVer = 02/04/2018, 4.25.0.9658 +CatalogFile.NT = Neo6_x86_VPN47.cat + +[Manufacturer] +%CompanyName% = SoftEther + +[SourceDisksNames] +1=%DiskDescription%, "", , + +[SourceDisksFiles] +Neo6_x86_VPN47.sys = 1 + +[DestinationDirs] +DefaultDestDir = 12 +Neo.CopyFiles.Sys = 12 + +[Neo.CopyFiles.Sys] +Neo6_x86_VPN47.sys, , , 2 + +[SoftEther] +%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN47 + +[NeoAdapter.Install] +Characteristics = 0x1 +AddReg = Neo.Reg, NeoAdapter.Ndi +CopyFiles = Neo.CopyFiles.Sys +*IfType = 53 +*MediaType = 0 +*PhysicalMediaType = 0 + +[NeoAdapter.Install.Services] +AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% + +[NeoAdapter.Ndi] +HKR, , NetworkAddress, 0, %DefaultAddress% +HKR, Ndi, DeviceID, , "NeoAdapter_VPN47" +HKR, , DevLoader, , ndis +HKR, , DeviceVxDs, , Neo6_x86_VPN47.sys +HKR, NDIS, LogDriverName, , "Neo_VPN47" +HKR, NDIS, MajorNdisVersion, 1, 5 +HKR, NDIS, MinorNdisVersion, 1, 0 +HKR, Ndi\Interfaces, DefUpper, , "ndis5" +HKR, Ndi\Interfaces, UpperRange, , "ndis5" +HKR, Ndi\Interfaces, LowerRange, , "ethernet" +HKR, Ndi\Interfaces, DefLower, , "ethernet" +HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" +HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% +HKR, Ndi\Params\NetworkAddress, type, 0, "edit" +HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" +HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" +HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% +HKR, Ndi\Params\NetworkAddress, optional, 0, "0" +HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% +HKR, Ndi\Params\MaxSpeed, type, 0, "int" +HKR, Ndi\Params\MaxSpeed, default, 0, "100" +HKR, Ndi\Params\MaxSpeed, min, 0, "0" +HKR, Ndi\Params\MaxSpeed, max, 0, "2000" +HKR, Ndi\Params\MaxSpeed, step, 0, "1" +HKR, Ndi\Params\MaxSpeed, Base, 0, "10" +HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% +HKR, Ndi\Params\KeepLink, type, 0, "enum" +HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% +HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% +HKR, Ndi\Params\KeepLink, default, 0, "0" + + +[Neo.Service] +DisplayName = %Neo.Service.DispName% +Description = %Neo.Service.Desc% +ServiceType = 1 +StartType = 3 +ErrorControl = 1 +ServiceBinary = %12%\Neo6_x86_VPN47.sys +LoadOrderGroup = NDIS + +[Neo.Reg] +HKR, Ndi, Service, 0, Neo.Service.Name +HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" +HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" + +[Neo.EventLog] +HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN47.sys" +HKR, , TypesSupported, 0x00010001, 7 + +[Strings] +CompanyName = "SoftEther Corporation" +DiskDescription = "VPN Client Device Driver Install Disk" +Neo.Service.Name = "Neo_VPN47" +Neo.Service.DispName = "VPN Client Device Driver - VPN47" +Neo.Service.Desc = "VPN Client Adapter - VPN47" +NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN47" +Neo.EventLog.Name = "Neo" +NetworkAddress = "MAC Address" +DefaultAddress = "000001000001" +MaxSpeed = "Indicate Speed (Mbps)" +KeepLink = "Keep Link" +On = "On" +Off = "Off" + + +; Auto Generated 20180205_163615.612 + diff --git a/src/bin/hamcore/DriverPackages/Neo6_Win10/x86/Neo6_x86_VPN48.inf b/src/bin/hamcore/DriverPackages/Neo6_Win10/x86/Neo6_x86_VPN48.inf index 0c5721bd..57b36ff6 100644 --- a/src/bin/hamcore/DriverPackages/Neo6_Win10/x86/Neo6_x86_VPN48.inf +++ b/src/bin/hamcore/DriverPackages/Neo6_Win10/x86/Neo6_x86_VPN48.inf @@ -1,114 +1,114 @@ -; VPN Client Device Driver for Windows 2000 and Greater -; -; Copyright (c) SoftEther Corporation. All Rights Reserved. -; http://www.softether.co.jp/ -; -; BUILD 9658 - -[Version] -Signature = "$Windows NT$" -Class = Net -ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} -Provider = %CompanyName% -DriverVer = 02/04/2018, 4.25.0.9658 -CatalogFile.NT = Neo6_x86_VPN48.cat - -[Manufacturer] -%CompanyName% = SoftEther - -[SourceDisksNames] -1=%DiskDescription%, "", , - -[SourceDisksFiles] -Neo6_x86_VPN48.sys = 1 - -[DestinationDirs] -DefaultDestDir = 12 -Neo.CopyFiles.Sys = 12 - -[Neo.CopyFiles.Sys] -Neo6_x86_VPN48.sys, , , 2 - -[SoftEther] -%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN48 - -[NeoAdapter.Install] -Characteristics = 0x1 -AddReg = Neo.Reg, NeoAdapter.Ndi -CopyFiles = Neo.CopyFiles.Sys -*IfType = 53 -*MediaType = 0 -*PhysicalMediaType = 0 - -[NeoAdapter.Install.Services] -AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% - -[NeoAdapter.Ndi] -HKR, , NetworkAddress, 0, %DefaultAddress% -HKR, Ndi, DeviceID, , "NeoAdapter_VPN48" -HKR, , DevLoader, , ndis -HKR, , DeviceVxDs, , Neo6_x86_VPN48.sys -HKR, NDIS, LogDriverName, , "Neo_VPN48" -HKR, NDIS, MajorNdisVersion, 1, 5 -HKR, NDIS, MinorNdisVersion, 1, 0 -HKR, Ndi\Interfaces, DefUpper, , "ndis5" -HKR, Ndi\Interfaces, UpperRange, , "ndis5" -HKR, Ndi\Interfaces, LowerRange, , "ethernet" -HKR, Ndi\Interfaces, DefLower, , "ethernet" -HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" -HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% -HKR, Ndi\Params\NetworkAddress, type, 0, "edit" -HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" -HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" -HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% -HKR, Ndi\Params\NetworkAddress, optional, 0, "0" -HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% -HKR, Ndi\Params\MaxSpeed, type, 0, "int" -HKR, Ndi\Params\MaxSpeed, default, 0, "100" -HKR, Ndi\Params\MaxSpeed, min, 0, "0" -HKR, Ndi\Params\MaxSpeed, max, 0, "2000" -HKR, Ndi\Params\MaxSpeed, step, 0, "1" -HKR, Ndi\Params\MaxSpeed, Base, 0, "10" -HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% -HKR, Ndi\Params\KeepLink, type, 0, "enum" -HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% -HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% -HKR, Ndi\Params\KeepLink, default, 0, "0" - - -[Neo.Service] -DisplayName = %Neo.Service.DispName% -Description = %Neo.Service.Desc% -ServiceType = 1 -StartType = 3 -ErrorControl = 1 -ServiceBinary = %12%\Neo6_x86_VPN48.sys -LoadOrderGroup = NDIS - -[Neo.Reg] -HKR, Ndi, Service, 0, Neo.Service.Name -HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" -HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" - -[Neo.EventLog] -HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN48.sys" -HKR, , TypesSupported, 0x00010001, 7 - -[Strings] -CompanyName = "SoftEther Corporation" -DiskDescription = "VPN Client Device Driver Install Disk" -Neo.Service.Name = "Neo_VPN48" -Neo.Service.DispName = "VPN Client Device Driver - VPN48" -Neo.Service.Desc = "VPN Client Adapter - VPN48" -NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN48" -Neo.EventLog.Name = "Neo" -NetworkAddress = "MAC Address" -DefaultAddress = "000001000001" -MaxSpeed = "Indicate Speed (Mbps)" -KeepLink = "Keep Link" -On = "On" -Off = "Off" - - -; Auto Generated 20180205_163615.684 - +; VPN Client Device Driver for Windows 2000 and Greater +; +; Copyright (c) SoftEther Corporation. All Rights Reserved. +; http://www.softether.co.jp/ +; +; BUILD 9658 + +[Version] +Signature = "$Windows NT$" +Class = Net +ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} +Provider = %CompanyName% +DriverVer = 02/04/2018, 4.25.0.9658 +CatalogFile.NT = Neo6_x86_VPN48.cat + +[Manufacturer] +%CompanyName% = SoftEther + +[SourceDisksNames] +1=%DiskDescription%, "", , + +[SourceDisksFiles] +Neo6_x86_VPN48.sys = 1 + +[DestinationDirs] +DefaultDestDir = 12 +Neo.CopyFiles.Sys = 12 + +[Neo.CopyFiles.Sys] +Neo6_x86_VPN48.sys, , , 2 + +[SoftEther] +%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN48 + +[NeoAdapter.Install] +Characteristics = 0x1 +AddReg = Neo.Reg, NeoAdapter.Ndi +CopyFiles = Neo.CopyFiles.Sys +*IfType = 53 +*MediaType = 0 +*PhysicalMediaType = 0 + +[NeoAdapter.Install.Services] +AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% + +[NeoAdapter.Ndi] +HKR, , NetworkAddress, 0, %DefaultAddress% +HKR, Ndi, DeviceID, , "NeoAdapter_VPN48" +HKR, , DevLoader, , ndis +HKR, , DeviceVxDs, , Neo6_x86_VPN48.sys +HKR, NDIS, LogDriverName, , "Neo_VPN48" +HKR, NDIS, MajorNdisVersion, 1, 5 +HKR, NDIS, MinorNdisVersion, 1, 0 +HKR, Ndi\Interfaces, DefUpper, , "ndis5" +HKR, Ndi\Interfaces, UpperRange, , "ndis5" +HKR, Ndi\Interfaces, LowerRange, , "ethernet" +HKR, Ndi\Interfaces, DefLower, , "ethernet" +HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" +HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% +HKR, Ndi\Params\NetworkAddress, type, 0, "edit" +HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" +HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" +HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% +HKR, Ndi\Params\NetworkAddress, optional, 0, "0" +HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% +HKR, Ndi\Params\MaxSpeed, type, 0, "int" +HKR, Ndi\Params\MaxSpeed, default, 0, "100" +HKR, Ndi\Params\MaxSpeed, min, 0, "0" +HKR, Ndi\Params\MaxSpeed, max, 0, "2000" +HKR, Ndi\Params\MaxSpeed, step, 0, "1" +HKR, Ndi\Params\MaxSpeed, Base, 0, "10" +HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% +HKR, Ndi\Params\KeepLink, type, 0, "enum" +HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% +HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% +HKR, Ndi\Params\KeepLink, default, 0, "0" + + +[Neo.Service] +DisplayName = %Neo.Service.DispName% +Description = %Neo.Service.Desc% +ServiceType = 1 +StartType = 3 +ErrorControl = 1 +ServiceBinary = %12%\Neo6_x86_VPN48.sys +LoadOrderGroup = NDIS + +[Neo.Reg] +HKR, Ndi, Service, 0, Neo.Service.Name +HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" +HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" + +[Neo.EventLog] +HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN48.sys" +HKR, , TypesSupported, 0x00010001, 7 + +[Strings] +CompanyName = "SoftEther Corporation" +DiskDescription = "VPN Client Device Driver Install Disk" +Neo.Service.Name = "Neo_VPN48" +Neo.Service.DispName = "VPN Client Device Driver - VPN48" +Neo.Service.Desc = "VPN Client Adapter - VPN48" +NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN48" +Neo.EventLog.Name = "Neo" +NetworkAddress = "MAC Address" +DefaultAddress = "000001000001" +MaxSpeed = "Indicate Speed (Mbps)" +KeepLink = "Keep Link" +On = "On" +Off = "Off" + + +; Auto Generated 20180205_163615.684 + diff --git a/src/bin/hamcore/DriverPackages/Neo6_Win10/x86/Neo6_x86_VPN49.inf b/src/bin/hamcore/DriverPackages/Neo6_Win10/x86/Neo6_x86_VPN49.inf index 09fb0a3b..6ce684ba 100644 --- a/src/bin/hamcore/DriverPackages/Neo6_Win10/x86/Neo6_x86_VPN49.inf +++ b/src/bin/hamcore/DriverPackages/Neo6_Win10/x86/Neo6_x86_VPN49.inf @@ -1,114 +1,114 @@ -; VPN Client Device Driver for Windows 2000 and Greater -; -; Copyright (c) SoftEther Corporation. All Rights Reserved. -; http://www.softether.co.jp/ -; -; BUILD 9658 - -[Version] -Signature = "$Windows NT$" -Class = Net -ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} -Provider = %CompanyName% -DriverVer = 02/04/2018, 4.25.0.9658 -CatalogFile.NT = Neo6_x86_VPN49.cat - -[Manufacturer] -%CompanyName% = SoftEther - -[SourceDisksNames] -1=%DiskDescription%, "", , - -[SourceDisksFiles] -Neo6_x86_VPN49.sys = 1 - -[DestinationDirs] -DefaultDestDir = 12 -Neo.CopyFiles.Sys = 12 - -[Neo.CopyFiles.Sys] -Neo6_x86_VPN49.sys, , , 2 - -[SoftEther] -%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN49 - -[NeoAdapter.Install] -Characteristics = 0x1 -AddReg = Neo.Reg, NeoAdapter.Ndi -CopyFiles = Neo.CopyFiles.Sys -*IfType = 53 -*MediaType = 0 -*PhysicalMediaType = 0 - -[NeoAdapter.Install.Services] -AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% - -[NeoAdapter.Ndi] -HKR, , NetworkAddress, 0, %DefaultAddress% -HKR, Ndi, DeviceID, , "NeoAdapter_VPN49" -HKR, , DevLoader, , ndis -HKR, , DeviceVxDs, , Neo6_x86_VPN49.sys -HKR, NDIS, LogDriverName, , "Neo_VPN49" -HKR, NDIS, MajorNdisVersion, 1, 5 -HKR, NDIS, MinorNdisVersion, 1, 0 -HKR, Ndi\Interfaces, DefUpper, , "ndis5" -HKR, Ndi\Interfaces, UpperRange, , "ndis5" -HKR, Ndi\Interfaces, LowerRange, , "ethernet" -HKR, Ndi\Interfaces, DefLower, , "ethernet" -HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" -HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% -HKR, Ndi\Params\NetworkAddress, type, 0, "edit" -HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" -HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" -HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% -HKR, Ndi\Params\NetworkAddress, optional, 0, "0" -HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% -HKR, Ndi\Params\MaxSpeed, type, 0, "int" -HKR, Ndi\Params\MaxSpeed, default, 0, "100" -HKR, Ndi\Params\MaxSpeed, min, 0, "0" -HKR, Ndi\Params\MaxSpeed, max, 0, "2000" -HKR, Ndi\Params\MaxSpeed, step, 0, "1" -HKR, Ndi\Params\MaxSpeed, Base, 0, "10" -HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% -HKR, Ndi\Params\KeepLink, type, 0, "enum" -HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% -HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% -HKR, Ndi\Params\KeepLink, default, 0, "0" - - -[Neo.Service] -DisplayName = %Neo.Service.DispName% -Description = %Neo.Service.Desc% -ServiceType = 1 -StartType = 3 -ErrorControl = 1 -ServiceBinary = %12%\Neo6_x86_VPN49.sys -LoadOrderGroup = NDIS - -[Neo.Reg] -HKR, Ndi, Service, 0, Neo.Service.Name -HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" -HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" - -[Neo.EventLog] -HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN49.sys" -HKR, , TypesSupported, 0x00010001, 7 - -[Strings] -CompanyName = "SoftEther Corporation" -DiskDescription = "VPN Client Device Driver Install Disk" -Neo.Service.Name = "Neo_VPN49" -Neo.Service.DispName = "VPN Client Device Driver - VPN49" -Neo.Service.Desc = "VPN Client Adapter - VPN49" -NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN49" -Neo.EventLog.Name = "Neo" -NetworkAddress = "MAC Address" -DefaultAddress = "000001000001" -MaxSpeed = "Indicate Speed (Mbps)" -KeepLink = "Keep Link" -On = "On" -Off = "Off" - - -; Auto Generated 20180205_163615.754 - +; VPN Client Device Driver for Windows 2000 and Greater +; +; Copyright (c) SoftEther Corporation. All Rights Reserved. +; http://www.softether.co.jp/ +; +; BUILD 9658 + +[Version] +Signature = "$Windows NT$" +Class = Net +ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} +Provider = %CompanyName% +DriverVer = 02/04/2018, 4.25.0.9658 +CatalogFile.NT = Neo6_x86_VPN49.cat + +[Manufacturer] +%CompanyName% = SoftEther + +[SourceDisksNames] +1=%DiskDescription%, "", , + +[SourceDisksFiles] +Neo6_x86_VPN49.sys = 1 + +[DestinationDirs] +DefaultDestDir = 12 +Neo.CopyFiles.Sys = 12 + +[Neo.CopyFiles.Sys] +Neo6_x86_VPN49.sys, , , 2 + +[SoftEther] +%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN49 + +[NeoAdapter.Install] +Characteristics = 0x1 +AddReg = Neo.Reg, NeoAdapter.Ndi +CopyFiles = Neo.CopyFiles.Sys +*IfType = 53 +*MediaType = 0 +*PhysicalMediaType = 0 + +[NeoAdapter.Install.Services] +AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% + +[NeoAdapter.Ndi] +HKR, , NetworkAddress, 0, %DefaultAddress% +HKR, Ndi, DeviceID, , "NeoAdapter_VPN49" +HKR, , DevLoader, , ndis +HKR, , DeviceVxDs, , Neo6_x86_VPN49.sys +HKR, NDIS, LogDriverName, , "Neo_VPN49" +HKR, NDIS, MajorNdisVersion, 1, 5 +HKR, NDIS, MinorNdisVersion, 1, 0 +HKR, Ndi\Interfaces, DefUpper, , "ndis5" +HKR, Ndi\Interfaces, UpperRange, , "ndis5" +HKR, Ndi\Interfaces, LowerRange, , "ethernet" +HKR, Ndi\Interfaces, DefLower, , "ethernet" +HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" +HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% +HKR, Ndi\Params\NetworkAddress, type, 0, "edit" +HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" +HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" +HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% +HKR, Ndi\Params\NetworkAddress, optional, 0, "0" +HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% +HKR, Ndi\Params\MaxSpeed, type, 0, "int" +HKR, Ndi\Params\MaxSpeed, default, 0, "100" +HKR, Ndi\Params\MaxSpeed, min, 0, "0" +HKR, Ndi\Params\MaxSpeed, max, 0, "2000" +HKR, Ndi\Params\MaxSpeed, step, 0, "1" +HKR, Ndi\Params\MaxSpeed, Base, 0, "10" +HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% +HKR, Ndi\Params\KeepLink, type, 0, "enum" +HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% +HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% +HKR, Ndi\Params\KeepLink, default, 0, "0" + + +[Neo.Service] +DisplayName = %Neo.Service.DispName% +Description = %Neo.Service.Desc% +ServiceType = 1 +StartType = 3 +ErrorControl = 1 +ServiceBinary = %12%\Neo6_x86_VPN49.sys +LoadOrderGroup = NDIS + +[Neo.Reg] +HKR, Ndi, Service, 0, Neo.Service.Name +HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" +HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" + +[Neo.EventLog] +HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN49.sys" +HKR, , TypesSupported, 0x00010001, 7 + +[Strings] +CompanyName = "SoftEther Corporation" +DiskDescription = "VPN Client Device Driver Install Disk" +Neo.Service.Name = "Neo_VPN49" +Neo.Service.DispName = "VPN Client Device Driver - VPN49" +Neo.Service.Desc = "VPN Client Adapter - VPN49" +NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN49" +Neo.EventLog.Name = "Neo" +NetworkAddress = "MAC Address" +DefaultAddress = "000001000001" +MaxSpeed = "Indicate Speed (Mbps)" +KeepLink = "Keep Link" +On = "On" +Off = "Off" + + +; Auto Generated 20180205_163615.754 + diff --git a/src/bin/hamcore/DriverPackages/Neo6_Win10/x86/Neo6_x86_VPN5.inf b/src/bin/hamcore/DriverPackages/Neo6_Win10/x86/Neo6_x86_VPN5.inf index 5f5f60a6..efb851ce 100644 --- a/src/bin/hamcore/DriverPackages/Neo6_Win10/x86/Neo6_x86_VPN5.inf +++ b/src/bin/hamcore/DriverPackages/Neo6_Win10/x86/Neo6_x86_VPN5.inf @@ -1,114 +1,114 @@ -; VPN Client Device Driver for Windows 2000 and Greater -; -; Copyright (c) SoftEther Corporation. All Rights Reserved. -; http://www.softether.co.jp/ -; -; BUILD 9658 - -[Version] -Signature = "$Windows NT$" -Class = Net -ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} -Provider = %CompanyName% -DriverVer = 02/04/2018, 4.25.0.9658 -CatalogFile.NT = Neo6_x86_VPN5.cat - -[Manufacturer] -%CompanyName% = SoftEther - -[SourceDisksNames] -1=%DiskDescription%, "", , - -[SourceDisksFiles] -Neo6_x86_VPN5.sys = 1 - -[DestinationDirs] -DefaultDestDir = 12 -Neo.CopyFiles.Sys = 12 - -[Neo.CopyFiles.Sys] -Neo6_x86_VPN5.sys, , , 2 - -[SoftEther] -%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN5 - -[NeoAdapter.Install] -Characteristics = 0x1 -AddReg = Neo.Reg, NeoAdapter.Ndi -CopyFiles = Neo.CopyFiles.Sys -*IfType = 53 -*MediaType = 0 -*PhysicalMediaType = 0 - -[NeoAdapter.Install.Services] -AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% - -[NeoAdapter.Ndi] -HKR, , NetworkAddress, 0, %DefaultAddress% -HKR, Ndi, DeviceID, , "NeoAdapter_VPN5" -HKR, , DevLoader, , ndis -HKR, , DeviceVxDs, , Neo6_x86_VPN5.sys -HKR, NDIS, LogDriverName, , "Neo_VPN5" -HKR, NDIS, MajorNdisVersion, 1, 5 -HKR, NDIS, MinorNdisVersion, 1, 0 -HKR, Ndi\Interfaces, DefUpper, , "ndis5" -HKR, Ndi\Interfaces, UpperRange, , "ndis5" -HKR, Ndi\Interfaces, LowerRange, , "ethernet" -HKR, Ndi\Interfaces, DefLower, , "ethernet" -HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" -HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% -HKR, Ndi\Params\NetworkAddress, type, 0, "edit" -HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" -HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" -HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% -HKR, Ndi\Params\NetworkAddress, optional, 0, "0" -HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% -HKR, Ndi\Params\MaxSpeed, type, 0, "int" -HKR, Ndi\Params\MaxSpeed, default, 0, "100" -HKR, Ndi\Params\MaxSpeed, min, 0, "0" -HKR, Ndi\Params\MaxSpeed, max, 0, "2000" -HKR, Ndi\Params\MaxSpeed, step, 0, "1" -HKR, Ndi\Params\MaxSpeed, Base, 0, "10" -HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% -HKR, Ndi\Params\KeepLink, type, 0, "enum" -HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% -HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% -HKR, Ndi\Params\KeepLink, default, 0, "0" - - -[Neo.Service] -DisplayName = %Neo.Service.DispName% -Description = %Neo.Service.Desc% -ServiceType = 1 -StartType = 3 -ErrorControl = 1 -ServiceBinary = %12%\Neo6_x86_VPN5.sys -LoadOrderGroup = NDIS - -[Neo.Reg] -HKR, Ndi, Service, 0, Neo.Service.Name -HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" -HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" - -[Neo.EventLog] -HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN5.sys" -HKR, , TypesSupported, 0x00010001, 7 - -[Strings] -CompanyName = "SoftEther Corporation" -DiskDescription = "VPN Client Device Driver Install Disk" -Neo.Service.Name = "Neo_VPN5" -Neo.Service.DispName = "VPN Client Device Driver - VPN5" -Neo.Service.Desc = "VPN Client Adapter - VPN5" -NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN5" -Neo.EventLog.Name = "Neo" -NetworkAddress = "MAC Address" -DefaultAddress = "000001000001" -MaxSpeed = "Indicate Speed (Mbps)" -KeepLink = "Keep Link" -On = "On" -Off = "Off" - - -; Auto Generated 20180205_163612.620 - +; VPN Client Device Driver for Windows 2000 and Greater +; +; Copyright (c) SoftEther Corporation. All Rights Reserved. +; http://www.softether.co.jp/ +; +; BUILD 9658 + +[Version] +Signature = "$Windows NT$" +Class = Net +ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} +Provider = %CompanyName% +DriverVer = 02/04/2018, 4.25.0.9658 +CatalogFile.NT = Neo6_x86_VPN5.cat + +[Manufacturer] +%CompanyName% = SoftEther + +[SourceDisksNames] +1=%DiskDescription%, "", , + +[SourceDisksFiles] +Neo6_x86_VPN5.sys = 1 + +[DestinationDirs] +DefaultDestDir = 12 +Neo.CopyFiles.Sys = 12 + +[Neo.CopyFiles.Sys] +Neo6_x86_VPN5.sys, , , 2 + +[SoftEther] +%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN5 + +[NeoAdapter.Install] +Characteristics = 0x1 +AddReg = Neo.Reg, NeoAdapter.Ndi +CopyFiles = Neo.CopyFiles.Sys +*IfType = 53 +*MediaType = 0 +*PhysicalMediaType = 0 + +[NeoAdapter.Install.Services] +AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% + +[NeoAdapter.Ndi] +HKR, , NetworkAddress, 0, %DefaultAddress% +HKR, Ndi, DeviceID, , "NeoAdapter_VPN5" +HKR, , DevLoader, , ndis +HKR, , DeviceVxDs, , Neo6_x86_VPN5.sys +HKR, NDIS, LogDriverName, , "Neo_VPN5" +HKR, NDIS, MajorNdisVersion, 1, 5 +HKR, NDIS, MinorNdisVersion, 1, 0 +HKR, Ndi\Interfaces, DefUpper, , "ndis5" +HKR, Ndi\Interfaces, UpperRange, , "ndis5" +HKR, Ndi\Interfaces, LowerRange, , "ethernet" +HKR, Ndi\Interfaces, DefLower, , "ethernet" +HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" +HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% +HKR, Ndi\Params\NetworkAddress, type, 0, "edit" +HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" +HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" +HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% +HKR, Ndi\Params\NetworkAddress, optional, 0, "0" +HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% +HKR, Ndi\Params\MaxSpeed, type, 0, "int" +HKR, Ndi\Params\MaxSpeed, default, 0, "100" +HKR, Ndi\Params\MaxSpeed, min, 0, "0" +HKR, Ndi\Params\MaxSpeed, max, 0, "2000" +HKR, Ndi\Params\MaxSpeed, step, 0, "1" +HKR, Ndi\Params\MaxSpeed, Base, 0, "10" +HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% +HKR, Ndi\Params\KeepLink, type, 0, "enum" +HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% +HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% +HKR, Ndi\Params\KeepLink, default, 0, "0" + + +[Neo.Service] +DisplayName = %Neo.Service.DispName% +Description = %Neo.Service.Desc% +ServiceType = 1 +StartType = 3 +ErrorControl = 1 +ServiceBinary = %12%\Neo6_x86_VPN5.sys +LoadOrderGroup = NDIS + +[Neo.Reg] +HKR, Ndi, Service, 0, Neo.Service.Name +HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" +HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" + +[Neo.EventLog] +HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN5.sys" +HKR, , TypesSupported, 0x00010001, 7 + +[Strings] +CompanyName = "SoftEther Corporation" +DiskDescription = "VPN Client Device Driver Install Disk" +Neo.Service.Name = "Neo_VPN5" +Neo.Service.DispName = "VPN Client Device Driver - VPN5" +Neo.Service.Desc = "VPN Client Adapter - VPN5" +NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN5" +Neo.EventLog.Name = "Neo" +NetworkAddress = "MAC Address" +DefaultAddress = "000001000001" +MaxSpeed = "Indicate Speed (Mbps)" +KeepLink = "Keep Link" +On = "On" +Off = "Off" + + +; Auto Generated 20180205_163612.620 + diff --git a/src/bin/hamcore/DriverPackages/Neo6_Win10/x86/Neo6_x86_VPN50.inf b/src/bin/hamcore/DriverPackages/Neo6_Win10/x86/Neo6_x86_VPN50.inf index 65c0c3fb..d3bcd65d 100644 --- a/src/bin/hamcore/DriverPackages/Neo6_Win10/x86/Neo6_x86_VPN50.inf +++ b/src/bin/hamcore/DriverPackages/Neo6_Win10/x86/Neo6_x86_VPN50.inf @@ -1,114 +1,114 @@ -; VPN Client Device Driver for Windows 2000 and Greater -; -; Copyright (c) SoftEther Corporation. All Rights Reserved. -; http://www.softether.co.jp/ -; -; BUILD 9658 - -[Version] -Signature = "$Windows NT$" -Class = Net -ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} -Provider = %CompanyName% -DriverVer = 02/04/2018, 4.25.0.9658 -CatalogFile.NT = Neo6_x86_VPN50.cat - -[Manufacturer] -%CompanyName% = SoftEther - -[SourceDisksNames] -1=%DiskDescription%, "", , - -[SourceDisksFiles] -Neo6_x86_VPN50.sys = 1 - -[DestinationDirs] -DefaultDestDir = 12 -Neo.CopyFiles.Sys = 12 - -[Neo.CopyFiles.Sys] -Neo6_x86_VPN50.sys, , , 2 - -[SoftEther] -%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN50 - -[NeoAdapter.Install] -Characteristics = 0x1 -AddReg = Neo.Reg, NeoAdapter.Ndi -CopyFiles = Neo.CopyFiles.Sys -*IfType = 53 -*MediaType = 0 -*PhysicalMediaType = 0 - -[NeoAdapter.Install.Services] -AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% - -[NeoAdapter.Ndi] -HKR, , NetworkAddress, 0, %DefaultAddress% -HKR, Ndi, DeviceID, , "NeoAdapter_VPN50" -HKR, , DevLoader, , ndis -HKR, , DeviceVxDs, , Neo6_x86_VPN50.sys -HKR, NDIS, LogDriverName, , "Neo_VPN50" -HKR, NDIS, MajorNdisVersion, 1, 5 -HKR, NDIS, MinorNdisVersion, 1, 0 -HKR, Ndi\Interfaces, DefUpper, , "ndis5" -HKR, Ndi\Interfaces, UpperRange, , "ndis5" -HKR, Ndi\Interfaces, LowerRange, , "ethernet" -HKR, Ndi\Interfaces, DefLower, , "ethernet" -HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" -HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% -HKR, Ndi\Params\NetworkAddress, type, 0, "edit" -HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" -HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" -HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% -HKR, Ndi\Params\NetworkAddress, optional, 0, "0" -HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% -HKR, Ndi\Params\MaxSpeed, type, 0, "int" -HKR, Ndi\Params\MaxSpeed, default, 0, "100" -HKR, Ndi\Params\MaxSpeed, min, 0, "0" -HKR, Ndi\Params\MaxSpeed, max, 0, "2000" -HKR, Ndi\Params\MaxSpeed, step, 0, "1" -HKR, Ndi\Params\MaxSpeed, Base, 0, "10" -HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% -HKR, Ndi\Params\KeepLink, type, 0, "enum" -HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% -HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% -HKR, Ndi\Params\KeepLink, default, 0, "0" - - -[Neo.Service] -DisplayName = %Neo.Service.DispName% -Description = %Neo.Service.Desc% -ServiceType = 1 -StartType = 3 -ErrorControl = 1 -ServiceBinary = %12%\Neo6_x86_VPN50.sys -LoadOrderGroup = NDIS - -[Neo.Reg] -HKR, Ndi, Service, 0, Neo.Service.Name -HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" -HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" - -[Neo.EventLog] -HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN50.sys" -HKR, , TypesSupported, 0x00010001, 7 - -[Strings] -CompanyName = "SoftEther Corporation" -DiskDescription = "VPN Client Device Driver Install Disk" -Neo.Service.Name = "Neo_VPN50" -Neo.Service.DispName = "VPN Client Device Driver - VPN50" -Neo.Service.Desc = "VPN Client Adapter - VPN50" -NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN50" -Neo.EventLog.Name = "Neo" -NetworkAddress = "MAC Address" -DefaultAddress = "000001000001" -MaxSpeed = "Indicate Speed (Mbps)" -KeepLink = "Keep Link" -On = "On" -Off = "Off" - - -; Auto Generated 20180205_163615.823 - +; VPN Client Device Driver for Windows 2000 and Greater +; +; Copyright (c) SoftEther Corporation. All Rights Reserved. +; http://www.softether.co.jp/ +; +; BUILD 9658 + +[Version] +Signature = "$Windows NT$" +Class = Net +ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} +Provider = %CompanyName% +DriverVer = 02/04/2018, 4.25.0.9658 +CatalogFile.NT = Neo6_x86_VPN50.cat + +[Manufacturer] +%CompanyName% = SoftEther + +[SourceDisksNames] +1=%DiskDescription%, "", , + +[SourceDisksFiles] +Neo6_x86_VPN50.sys = 1 + +[DestinationDirs] +DefaultDestDir = 12 +Neo.CopyFiles.Sys = 12 + +[Neo.CopyFiles.Sys] +Neo6_x86_VPN50.sys, , , 2 + +[SoftEther] +%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN50 + +[NeoAdapter.Install] +Characteristics = 0x1 +AddReg = Neo.Reg, NeoAdapter.Ndi +CopyFiles = Neo.CopyFiles.Sys +*IfType = 53 +*MediaType = 0 +*PhysicalMediaType = 0 + +[NeoAdapter.Install.Services] +AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% + +[NeoAdapter.Ndi] +HKR, , NetworkAddress, 0, %DefaultAddress% +HKR, Ndi, DeviceID, , "NeoAdapter_VPN50" +HKR, , DevLoader, , ndis +HKR, , DeviceVxDs, , Neo6_x86_VPN50.sys +HKR, NDIS, LogDriverName, , "Neo_VPN50" +HKR, NDIS, MajorNdisVersion, 1, 5 +HKR, NDIS, MinorNdisVersion, 1, 0 +HKR, Ndi\Interfaces, DefUpper, , "ndis5" +HKR, Ndi\Interfaces, UpperRange, , "ndis5" +HKR, Ndi\Interfaces, LowerRange, , "ethernet" +HKR, Ndi\Interfaces, DefLower, , "ethernet" +HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" +HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% +HKR, Ndi\Params\NetworkAddress, type, 0, "edit" +HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" +HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" +HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% +HKR, Ndi\Params\NetworkAddress, optional, 0, "0" +HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% +HKR, Ndi\Params\MaxSpeed, type, 0, "int" +HKR, Ndi\Params\MaxSpeed, default, 0, "100" +HKR, Ndi\Params\MaxSpeed, min, 0, "0" +HKR, Ndi\Params\MaxSpeed, max, 0, "2000" +HKR, Ndi\Params\MaxSpeed, step, 0, "1" +HKR, Ndi\Params\MaxSpeed, Base, 0, "10" +HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% +HKR, Ndi\Params\KeepLink, type, 0, "enum" +HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% +HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% +HKR, Ndi\Params\KeepLink, default, 0, "0" + + +[Neo.Service] +DisplayName = %Neo.Service.DispName% +Description = %Neo.Service.Desc% +ServiceType = 1 +StartType = 3 +ErrorControl = 1 +ServiceBinary = %12%\Neo6_x86_VPN50.sys +LoadOrderGroup = NDIS + +[Neo.Reg] +HKR, Ndi, Service, 0, Neo.Service.Name +HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" +HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" + +[Neo.EventLog] +HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN50.sys" +HKR, , TypesSupported, 0x00010001, 7 + +[Strings] +CompanyName = "SoftEther Corporation" +DiskDescription = "VPN Client Device Driver Install Disk" +Neo.Service.Name = "Neo_VPN50" +Neo.Service.DispName = "VPN Client Device Driver - VPN50" +Neo.Service.Desc = "VPN Client Adapter - VPN50" +NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN50" +Neo.EventLog.Name = "Neo" +NetworkAddress = "MAC Address" +DefaultAddress = "000001000001" +MaxSpeed = "Indicate Speed (Mbps)" +KeepLink = "Keep Link" +On = "On" +Off = "Off" + + +; Auto Generated 20180205_163615.823 + diff --git a/src/bin/hamcore/DriverPackages/Neo6_Win10/x86/Neo6_x86_VPN51.inf b/src/bin/hamcore/DriverPackages/Neo6_Win10/x86/Neo6_x86_VPN51.inf index 6c5180ce..e1e699be 100644 --- a/src/bin/hamcore/DriverPackages/Neo6_Win10/x86/Neo6_x86_VPN51.inf +++ b/src/bin/hamcore/DriverPackages/Neo6_Win10/x86/Neo6_x86_VPN51.inf @@ -1,114 +1,114 @@ -; VPN Client Device Driver for Windows 2000 and Greater -; -; Copyright (c) SoftEther Corporation. All Rights Reserved. -; http://www.softether.co.jp/ -; -; BUILD 9658 - -[Version] -Signature = "$Windows NT$" -Class = Net -ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} -Provider = %CompanyName% -DriverVer = 02/04/2018, 4.25.0.9658 -CatalogFile.NT = Neo6_x86_VPN51.cat - -[Manufacturer] -%CompanyName% = SoftEther - -[SourceDisksNames] -1=%DiskDescription%, "", , - -[SourceDisksFiles] -Neo6_x86_VPN51.sys = 1 - -[DestinationDirs] -DefaultDestDir = 12 -Neo.CopyFiles.Sys = 12 - -[Neo.CopyFiles.Sys] -Neo6_x86_VPN51.sys, , , 2 - -[SoftEther] -%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN51 - -[NeoAdapter.Install] -Characteristics = 0x1 -AddReg = Neo.Reg, NeoAdapter.Ndi -CopyFiles = Neo.CopyFiles.Sys -*IfType = 53 -*MediaType = 0 -*PhysicalMediaType = 0 - -[NeoAdapter.Install.Services] -AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% - -[NeoAdapter.Ndi] -HKR, , NetworkAddress, 0, %DefaultAddress% -HKR, Ndi, DeviceID, , "NeoAdapter_VPN51" -HKR, , DevLoader, , ndis -HKR, , DeviceVxDs, , Neo6_x86_VPN51.sys -HKR, NDIS, LogDriverName, , "Neo_VPN51" -HKR, NDIS, MajorNdisVersion, 1, 5 -HKR, NDIS, MinorNdisVersion, 1, 0 -HKR, Ndi\Interfaces, DefUpper, , "ndis5" -HKR, Ndi\Interfaces, UpperRange, , "ndis5" -HKR, Ndi\Interfaces, LowerRange, , "ethernet" -HKR, Ndi\Interfaces, DefLower, , "ethernet" -HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" -HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% -HKR, Ndi\Params\NetworkAddress, type, 0, "edit" -HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" -HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" -HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% -HKR, Ndi\Params\NetworkAddress, optional, 0, "0" -HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% -HKR, Ndi\Params\MaxSpeed, type, 0, "int" -HKR, Ndi\Params\MaxSpeed, default, 0, "100" -HKR, Ndi\Params\MaxSpeed, min, 0, "0" -HKR, Ndi\Params\MaxSpeed, max, 0, "2000" -HKR, Ndi\Params\MaxSpeed, step, 0, "1" -HKR, Ndi\Params\MaxSpeed, Base, 0, "10" -HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% -HKR, Ndi\Params\KeepLink, type, 0, "enum" -HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% -HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% -HKR, Ndi\Params\KeepLink, default, 0, "0" - - -[Neo.Service] -DisplayName = %Neo.Service.DispName% -Description = %Neo.Service.Desc% -ServiceType = 1 -StartType = 3 -ErrorControl = 1 -ServiceBinary = %12%\Neo6_x86_VPN51.sys -LoadOrderGroup = NDIS - -[Neo.Reg] -HKR, Ndi, Service, 0, Neo.Service.Name -HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" -HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" - -[Neo.EventLog] -HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN51.sys" -HKR, , TypesSupported, 0x00010001, 7 - -[Strings] -CompanyName = "SoftEther Corporation" -DiskDescription = "VPN Client Device Driver Install Disk" -Neo.Service.Name = "Neo_VPN51" -Neo.Service.DispName = "VPN Client Device Driver - VPN51" -Neo.Service.Desc = "VPN Client Adapter - VPN51" -NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN51" -Neo.EventLog.Name = "Neo" -NetworkAddress = "MAC Address" -DefaultAddress = "000001000001" -MaxSpeed = "Indicate Speed (Mbps)" -KeepLink = "Keep Link" -On = "On" -Off = "Off" - - -; Auto Generated 20180205_163615.895 - +; VPN Client Device Driver for Windows 2000 and Greater +; +; Copyright (c) SoftEther Corporation. All Rights Reserved. +; http://www.softether.co.jp/ +; +; BUILD 9658 + +[Version] +Signature = "$Windows NT$" +Class = Net +ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} +Provider = %CompanyName% +DriverVer = 02/04/2018, 4.25.0.9658 +CatalogFile.NT = Neo6_x86_VPN51.cat + +[Manufacturer] +%CompanyName% = SoftEther + +[SourceDisksNames] +1=%DiskDescription%, "", , + +[SourceDisksFiles] +Neo6_x86_VPN51.sys = 1 + +[DestinationDirs] +DefaultDestDir = 12 +Neo.CopyFiles.Sys = 12 + +[Neo.CopyFiles.Sys] +Neo6_x86_VPN51.sys, , , 2 + +[SoftEther] +%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN51 + +[NeoAdapter.Install] +Characteristics = 0x1 +AddReg = Neo.Reg, NeoAdapter.Ndi +CopyFiles = Neo.CopyFiles.Sys +*IfType = 53 +*MediaType = 0 +*PhysicalMediaType = 0 + +[NeoAdapter.Install.Services] +AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% + +[NeoAdapter.Ndi] +HKR, , NetworkAddress, 0, %DefaultAddress% +HKR, Ndi, DeviceID, , "NeoAdapter_VPN51" +HKR, , DevLoader, , ndis +HKR, , DeviceVxDs, , Neo6_x86_VPN51.sys +HKR, NDIS, LogDriverName, , "Neo_VPN51" +HKR, NDIS, MajorNdisVersion, 1, 5 +HKR, NDIS, MinorNdisVersion, 1, 0 +HKR, Ndi\Interfaces, DefUpper, , "ndis5" +HKR, Ndi\Interfaces, UpperRange, , "ndis5" +HKR, Ndi\Interfaces, LowerRange, , "ethernet" +HKR, Ndi\Interfaces, DefLower, , "ethernet" +HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" +HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% +HKR, Ndi\Params\NetworkAddress, type, 0, "edit" +HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" +HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" +HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% +HKR, Ndi\Params\NetworkAddress, optional, 0, "0" +HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% +HKR, Ndi\Params\MaxSpeed, type, 0, "int" +HKR, Ndi\Params\MaxSpeed, default, 0, "100" +HKR, Ndi\Params\MaxSpeed, min, 0, "0" +HKR, Ndi\Params\MaxSpeed, max, 0, "2000" +HKR, Ndi\Params\MaxSpeed, step, 0, "1" +HKR, Ndi\Params\MaxSpeed, Base, 0, "10" +HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% +HKR, Ndi\Params\KeepLink, type, 0, "enum" +HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% +HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% +HKR, Ndi\Params\KeepLink, default, 0, "0" + + +[Neo.Service] +DisplayName = %Neo.Service.DispName% +Description = %Neo.Service.Desc% +ServiceType = 1 +StartType = 3 +ErrorControl = 1 +ServiceBinary = %12%\Neo6_x86_VPN51.sys +LoadOrderGroup = NDIS + +[Neo.Reg] +HKR, Ndi, Service, 0, Neo.Service.Name +HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" +HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" + +[Neo.EventLog] +HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN51.sys" +HKR, , TypesSupported, 0x00010001, 7 + +[Strings] +CompanyName = "SoftEther Corporation" +DiskDescription = "VPN Client Device Driver Install Disk" +Neo.Service.Name = "Neo_VPN51" +Neo.Service.DispName = "VPN Client Device Driver - VPN51" +Neo.Service.Desc = "VPN Client Adapter - VPN51" +NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN51" +Neo.EventLog.Name = "Neo" +NetworkAddress = "MAC Address" +DefaultAddress = "000001000001" +MaxSpeed = "Indicate Speed (Mbps)" +KeepLink = "Keep Link" +On = "On" +Off = "Off" + + +; Auto Generated 20180205_163615.895 + diff --git a/src/bin/hamcore/DriverPackages/Neo6_Win10/x86/Neo6_x86_VPN52.inf b/src/bin/hamcore/DriverPackages/Neo6_Win10/x86/Neo6_x86_VPN52.inf index e2e53931..09828e32 100644 --- a/src/bin/hamcore/DriverPackages/Neo6_Win10/x86/Neo6_x86_VPN52.inf +++ b/src/bin/hamcore/DriverPackages/Neo6_Win10/x86/Neo6_x86_VPN52.inf @@ -1,114 +1,114 @@ -; VPN Client Device Driver for Windows 2000 and Greater -; -; Copyright (c) SoftEther Corporation. All Rights Reserved. -; http://www.softether.co.jp/ -; -; BUILD 9658 - -[Version] -Signature = "$Windows NT$" -Class = Net -ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} -Provider = %CompanyName% -DriverVer = 02/04/2018, 4.25.0.9658 -CatalogFile.NT = Neo6_x86_VPN52.cat - -[Manufacturer] -%CompanyName% = SoftEther - -[SourceDisksNames] -1=%DiskDescription%, "", , - -[SourceDisksFiles] -Neo6_x86_VPN52.sys = 1 - -[DestinationDirs] -DefaultDestDir = 12 -Neo.CopyFiles.Sys = 12 - -[Neo.CopyFiles.Sys] -Neo6_x86_VPN52.sys, , , 2 - -[SoftEther] -%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN52 - -[NeoAdapter.Install] -Characteristics = 0x1 -AddReg = Neo.Reg, NeoAdapter.Ndi -CopyFiles = Neo.CopyFiles.Sys -*IfType = 53 -*MediaType = 0 -*PhysicalMediaType = 0 - -[NeoAdapter.Install.Services] -AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% - -[NeoAdapter.Ndi] -HKR, , NetworkAddress, 0, %DefaultAddress% -HKR, Ndi, DeviceID, , "NeoAdapter_VPN52" -HKR, , DevLoader, , ndis -HKR, , DeviceVxDs, , Neo6_x86_VPN52.sys -HKR, NDIS, LogDriverName, , "Neo_VPN52" -HKR, NDIS, MajorNdisVersion, 1, 5 -HKR, NDIS, MinorNdisVersion, 1, 0 -HKR, Ndi\Interfaces, DefUpper, , "ndis5" -HKR, Ndi\Interfaces, UpperRange, , "ndis5" -HKR, Ndi\Interfaces, LowerRange, , "ethernet" -HKR, Ndi\Interfaces, DefLower, , "ethernet" -HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" -HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% -HKR, Ndi\Params\NetworkAddress, type, 0, "edit" -HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" -HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" -HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% -HKR, Ndi\Params\NetworkAddress, optional, 0, "0" -HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% -HKR, Ndi\Params\MaxSpeed, type, 0, "int" -HKR, Ndi\Params\MaxSpeed, default, 0, "100" -HKR, Ndi\Params\MaxSpeed, min, 0, "0" -HKR, Ndi\Params\MaxSpeed, max, 0, "2000" -HKR, Ndi\Params\MaxSpeed, step, 0, "1" -HKR, Ndi\Params\MaxSpeed, Base, 0, "10" -HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% -HKR, Ndi\Params\KeepLink, type, 0, "enum" -HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% -HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% -HKR, Ndi\Params\KeepLink, default, 0, "0" - - -[Neo.Service] -DisplayName = %Neo.Service.DispName% -Description = %Neo.Service.Desc% -ServiceType = 1 -StartType = 3 -ErrorControl = 1 -ServiceBinary = %12%\Neo6_x86_VPN52.sys -LoadOrderGroup = NDIS - -[Neo.Reg] -HKR, Ndi, Service, 0, Neo.Service.Name -HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" -HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" - -[Neo.EventLog] -HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN52.sys" -HKR, , TypesSupported, 0x00010001, 7 - -[Strings] -CompanyName = "SoftEther Corporation" -DiskDescription = "VPN Client Device Driver Install Disk" -Neo.Service.Name = "Neo_VPN52" -Neo.Service.DispName = "VPN Client Device Driver - VPN52" -Neo.Service.Desc = "VPN Client Adapter - VPN52" -NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN52" -Neo.EventLog.Name = "Neo" -NetworkAddress = "MAC Address" -DefaultAddress = "000001000001" -MaxSpeed = "Indicate Speed (Mbps)" -KeepLink = "Keep Link" -On = "On" -Off = "Off" - - -; Auto Generated 20180205_163615.965 - +; VPN Client Device Driver for Windows 2000 and Greater +; +; Copyright (c) SoftEther Corporation. All Rights Reserved. +; http://www.softether.co.jp/ +; +; BUILD 9658 + +[Version] +Signature = "$Windows NT$" +Class = Net +ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} +Provider = %CompanyName% +DriverVer = 02/04/2018, 4.25.0.9658 +CatalogFile.NT = Neo6_x86_VPN52.cat + +[Manufacturer] +%CompanyName% = SoftEther + +[SourceDisksNames] +1=%DiskDescription%, "", , + +[SourceDisksFiles] +Neo6_x86_VPN52.sys = 1 + +[DestinationDirs] +DefaultDestDir = 12 +Neo.CopyFiles.Sys = 12 + +[Neo.CopyFiles.Sys] +Neo6_x86_VPN52.sys, , , 2 + +[SoftEther] +%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN52 + +[NeoAdapter.Install] +Characteristics = 0x1 +AddReg = Neo.Reg, NeoAdapter.Ndi +CopyFiles = Neo.CopyFiles.Sys +*IfType = 53 +*MediaType = 0 +*PhysicalMediaType = 0 + +[NeoAdapter.Install.Services] +AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% + +[NeoAdapter.Ndi] +HKR, , NetworkAddress, 0, %DefaultAddress% +HKR, Ndi, DeviceID, , "NeoAdapter_VPN52" +HKR, , DevLoader, , ndis +HKR, , DeviceVxDs, , Neo6_x86_VPN52.sys +HKR, NDIS, LogDriverName, , "Neo_VPN52" +HKR, NDIS, MajorNdisVersion, 1, 5 +HKR, NDIS, MinorNdisVersion, 1, 0 +HKR, Ndi\Interfaces, DefUpper, , "ndis5" +HKR, Ndi\Interfaces, UpperRange, , "ndis5" +HKR, Ndi\Interfaces, LowerRange, , "ethernet" +HKR, Ndi\Interfaces, DefLower, , "ethernet" +HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" +HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% +HKR, Ndi\Params\NetworkAddress, type, 0, "edit" +HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" +HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" +HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% +HKR, Ndi\Params\NetworkAddress, optional, 0, "0" +HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% +HKR, Ndi\Params\MaxSpeed, type, 0, "int" +HKR, Ndi\Params\MaxSpeed, default, 0, "100" +HKR, Ndi\Params\MaxSpeed, min, 0, "0" +HKR, Ndi\Params\MaxSpeed, max, 0, "2000" +HKR, Ndi\Params\MaxSpeed, step, 0, "1" +HKR, Ndi\Params\MaxSpeed, Base, 0, "10" +HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% +HKR, Ndi\Params\KeepLink, type, 0, "enum" +HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% +HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% +HKR, Ndi\Params\KeepLink, default, 0, "0" + + +[Neo.Service] +DisplayName = %Neo.Service.DispName% +Description = %Neo.Service.Desc% +ServiceType = 1 +StartType = 3 +ErrorControl = 1 +ServiceBinary = %12%\Neo6_x86_VPN52.sys +LoadOrderGroup = NDIS + +[Neo.Reg] +HKR, Ndi, Service, 0, Neo.Service.Name +HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" +HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" + +[Neo.EventLog] +HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN52.sys" +HKR, , TypesSupported, 0x00010001, 7 + +[Strings] +CompanyName = "SoftEther Corporation" +DiskDescription = "VPN Client Device Driver Install Disk" +Neo.Service.Name = "Neo_VPN52" +Neo.Service.DispName = "VPN Client Device Driver - VPN52" +Neo.Service.Desc = "VPN Client Adapter - VPN52" +NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN52" +Neo.EventLog.Name = "Neo" +NetworkAddress = "MAC Address" +DefaultAddress = "000001000001" +MaxSpeed = "Indicate Speed (Mbps)" +KeepLink = "Keep Link" +On = "On" +Off = "Off" + + +; Auto Generated 20180205_163615.965 + diff --git a/src/bin/hamcore/DriverPackages/Neo6_Win10/x86/Neo6_x86_VPN53.inf b/src/bin/hamcore/DriverPackages/Neo6_Win10/x86/Neo6_x86_VPN53.inf index f236a2a8..5f82e26b 100644 --- a/src/bin/hamcore/DriverPackages/Neo6_Win10/x86/Neo6_x86_VPN53.inf +++ b/src/bin/hamcore/DriverPackages/Neo6_Win10/x86/Neo6_x86_VPN53.inf @@ -1,114 +1,114 @@ -; VPN Client Device Driver for Windows 2000 and Greater -; -; Copyright (c) SoftEther Corporation. All Rights Reserved. -; http://www.softether.co.jp/ -; -; BUILD 9658 - -[Version] -Signature = "$Windows NT$" -Class = Net -ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} -Provider = %CompanyName% -DriverVer = 02/04/2018, 4.25.0.9658 -CatalogFile.NT = Neo6_x86_VPN53.cat - -[Manufacturer] -%CompanyName% = SoftEther - -[SourceDisksNames] -1=%DiskDescription%, "", , - -[SourceDisksFiles] -Neo6_x86_VPN53.sys = 1 - -[DestinationDirs] -DefaultDestDir = 12 -Neo.CopyFiles.Sys = 12 - -[Neo.CopyFiles.Sys] -Neo6_x86_VPN53.sys, , , 2 - -[SoftEther] -%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN53 - -[NeoAdapter.Install] -Characteristics = 0x1 -AddReg = Neo.Reg, NeoAdapter.Ndi -CopyFiles = Neo.CopyFiles.Sys -*IfType = 53 -*MediaType = 0 -*PhysicalMediaType = 0 - -[NeoAdapter.Install.Services] -AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% - -[NeoAdapter.Ndi] -HKR, , NetworkAddress, 0, %DefaultAddress% -HKR, Ndi, DeviceID, , "NeoAdapter_VPN53" -HKR, , DevLoader, , ndis -HKR, , DeviceVxDs, , Neo6_x86_VPN53.sys -HKR, NDIS, LogDriverName, , "Neo_VPN53" -HKR, NDIS, MajorNdisVersion, 1, 5 -HKR, NDIS, MinorNdisVersion, 1, 0 -HKR, Ndi\Interfaces, DefUpper, , "ndis5" -HKR, Ndi\Interfaces, UpperRange, , "ndis5" -HKR, Ndi\Interfaces, LowerRange, , "ethernet" -HKR, Ndi\Interfaces, DefLower, , "ethernet" -HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" -HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% -HKR, Ndi\Params\NetworkAddress, type, 0, "edit" -HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" -HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" -HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% -HKR, Ndi\Params\NetworkAddress, optional, 0, "0" -HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% -HKR, Ndi\Params\MaxSpeed, type, 0, "int" -HKR, Ndi\Params\MaxSpeed, default, 0, "100" -HKR, Ndi\Params\MaxSpeed, min, 0, "0" -HKR, Ndi\Params\MaxSpeed, max, 0, "2000" -HKR, Ndi\Params\MaxSpeed, step, 0, "1" -HKR, Ndi\Params\MaxSpeed, Base, 0, "10" -HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% -HKR, Ndi\Params\KeepLink, type, 0, "enum" -HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% -HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% -HKR, Ndi\Params\KeepLink, default, 0, "0" - - -[Neo.Service] -DisplayName = %Neo.Service.DispName% -Description = %Neo.Service.Desc% -ServiceType = 1 -StartType = 3 -ErrorControl = 1 -ServiceBinary = %12%\Neo6_x86_VPN53.sys -LoadOrderGroup = NDIS - -[Neo.Reg] -HKR, Ndi, Service, 0, Neo.Service.Name -HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" -HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" - -[Neo.EventLog] -HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN53.sys" -HKR, , TypesSupported, 0x00010001, 7 - -[Strings] -CompanyName = "SoftEther Corporation" -DiskDescription = "VPN Client Device Driver Install Disk" -Neo.Service.Name = "Neo_VPN53" -Neo.Service.DispName = "VPN Client Device Driver - VPN53" -Neo.Service.Desc = "VPN Client Adapter - VPN53" -NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN53" -Neo.EventLog.Name = "Neo" -NetworkAddress = "MAC Address" -DefaultAddress = "000001000001" -MaxSpeed = "Indicate Speed (Mbps)" -KeepLink = "Keep Link" -On = "On" -Off = "Off" - - -; Auto Generated 20180205_163616.037 - +; VPN Client Device Driver for Windows 2000 and Greater +; +; Copyright (c) SoftEther Corporation. All Rights Reserved. +; http://www.softether.co.jp/ +; +; BUILD 9658 + +[Version] +Signature = "$Windows NT$" +Class = Net +ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} +Provider = %CompanyName% +DriverVer = 02/04/2018, 4.25.0.9658 +CatalogFile.NT = Neo6_x86_VPN53.cat + +[Manufacturer] +%CompanyName% = SoftEther + +[SourceDisksNames] +1=%DiskDescription%, "", , + +[SourceDisksFiles] +Neo6_x86_VPN53.sys = 1 + +[DestinationDirs] +DefaultDestDir = 12 +Neo.CopyFiles.Sys = 12 + +[Neo.CopyFiles.Sys] +Neo6_x86_VPN53.sys, , , 2 + +[SoftEther] +%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN53 + +[NeoAdapter.Install] +Characteristics = 0x1 +AddReg = Neo.Reg, NeoAdapter.Ndi +CopyFiles = Neo.CopyFiles.Sys +*IfType = 53 +*MediaType = 0 +*PhysicalMediaType = 0 + +[NeoAdapter.Install.Services] +AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% + +[NeoAdapter.Ndi] +HKR, , NetworkAddress, 0, %DefaultAddress% +HKR, Ndi, DeviceID, , "NeoAdapter_VPN53" +HKR, , DevLoader, , ndis +HKR, , DeviceVxDs, , Neo6_x86_VPN53.sys +HKR, NDIS, LogDriverName, , "Neo_VPN53" +HKR, NDIS, MajorNdisVersion, 1, 5 +HKR, NDIS, MinorNdisVersion, 1, 0 +HKR, Ndi\Interfaces, DefUpper, , "ndis5" +HKR, Ndi\Interfaces, UpperRange, , "ndis5" +HKR, Ndi\Interfaces, LowerRange, , "ethernet" +HKR, Ndi\Interfaces, DefLower, , "ethernet" +HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" +HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% +HKR, Ndi\Params\NetworkAddress, type, 0, "edit" +HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" +HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" +HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% +HKR, Ndi\Params\NetworkAddress, optional, 0, "0" +HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% +HKR, Ndi\Params\MaxSpeed, type, 0, "int" +HKR, Ndi\Params\MaxSpeed, default, 0, "100" +HKR, Ndi\Params\MaxSpeed, min, 0, "0" +HKR, Ndi\Params\MaxSpeed, max, 0, "2000" +HKR, Ndi\Params\MaxSpeed, step, 0, "1" +HKR, Ndi\Params\MaxSpeed, Base, 0, "10" +HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% +HKR, Ndi\Params\KeepLink, type, 0, "enum" +HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% +HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% +HKR, Ndi\Params\KeepLink, default, 0, "0" + + +[Neo.Service] +DisplayName = %Neo.Service.DispName% +Description = %Neo.Service.Desc% +ServiceType = 1 +StartType = 3 +ErrorControl = 1 +ServiceBinary = %12%\Neo6_x86_VPN53.sys +LoadOrderGroup = NDIS + +[Neo.Reg] +HKR, Ndi, Service, 0, Neo.Service.Name +HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" +HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" + +[Neo.EventLog] +HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN53.sys" +HKR, , TypesSupported, 0x00010001, 7 + +[Strings] +CompanyName = "SoftEther Corporation" +DiskDescription = "VPN Client Device Driver Install Disk" +Neo.Service.Name = "Neo_VPN53" +Neo.Service.DispName = "VPN Client Device Driver - VPN53" +Neo.Service.Desc = "VPN Client Adapter - VPN53" +NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN53" +Neo.EventLog.Name = "Neo" +NetworkAddress = "MAC Address" +DefaultAddress = "000001000001" +MaxSpeed = "Indicate Speed (Mbps)" +KeepLink = "Keep Link" +On = "On" +Off = "Off" + + +; Auto Generated 20180205_163616.037 + diff --git a/src/bin/hamcore/DriverPackages/Neo6_Win10/x86/Neo6_x86_VPN54.inf b/src/bin/hamcore/DriverPackages/Neo6_Win10/x86/Neo6_x86_VPN54.inf index 8a3b5a73..759378df 100644 --- a/src/bin/hamcore/DriverPackages/Neo6_Win10/x86/Neo6_x86_VPN54.inf +++ b/src/bin/hamcore/DriverPackages/Neo6_Win10/x86/Neo6_x86_VPN54.inf @@ -1,114 +1,114 @@ -; VPN Client Device Driver for Windows 2000 and Greater -; -; Copyright (c) SoftEther Corporation. All Rights Reserved. -; http://www.softether.co.jp/ -; -; BUILD 9658 - -[Version] -Signature = "$Windows NT$" -Class = Net -ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} -Provider = %CompanyName% -DriverVer = 02/04/2018, 4.25.0.9658 -CatalogFile.NT = Neo6_x86_VPN54.cat - -[Manufacturer] -%CompanyName% = SoftEther - -[SourceDisksNames] -1=%DiskDescription%, "", , - -[SourceDisksFiles] -Neo6_x86_VPN54.sys = 1 - -[DestinationDirs] -DefaultDestDir = 12 -Neo.CopyFiles.Sys = 12 - -[Neo.CopyFiles.Sys] -Neo6_x86_VPN54.sys, , , 2 - -[SoftEther] -%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN54 - -[NeoAdapter.Install] -Characteristics = 0x1 -AddReg = Neo.Reg, NeoAdapter.Ndi -CopyFiles = Neo.CopyFiles.Sys -*IfType = 53 -*MediaType = 0 -*PhysicalMediaType = 0 - -[NeoAdapter.Install.Services] -AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% - -[NeoAdapter.Ndi] -HKR, , NetworkAddress, 0, %DefaultAddress% -HKR, Ndi, DeviceID, , "NeoAdapter_VPN54" -HKR, , DevLoader, , ndis -HKR, , DeviceVxDs, , Neo6_x86_VPN54.sys -HKR, NDIS, LogDriverName, , "Neo_VPN54" -HKR, NDIS, MajorNdisVersion, 1, 5 -HKR, NDIS, MinorNdisVersion, 1, 0 -HKR, Ndi\Interfaces, DefUpper, , "ndis5" -HKR, Ndi\Interfaces, UpperRange, , "ndis5" -HKR, Ndi\Interfaces, LowerRange, , "ethernet" -HKR, Ndi\Interfaces, DefLower, , "ethernet" -HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" -HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% -HKR, Ndi\Params\NetworkAddress, type, 0, "edit" -HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" -HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" -HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% -HKR, Ndi\Params\NetworkAddress, optional, 0, "0" -HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% -HKR, Ndi\Params\MaxSpeed, type, 0, "int" -HKR, Ndi\Params\MaxSpeed, default, 0, "100" -HKR, Ndi\Params\MaxSpeed, min, 0, "0" -HKR, Ndi\Params\MaxSpeed, max, 0, "2000" -HKR, Ndi\Params\MaxSpeed, step, 0, "1" -HKR, Ndi\Params\MaxSpeed, Base, 0, "10" -HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% -HKR, Ndi\Params\KeepLink, type, 0, "enum" -HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% -HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% -HKR, Ndi\Params\KeepLink, default, 0, "0" - - -[Neo.Service] -DisplayName = %Neo.Service.DispName% -Description = %Neo.Service.Desc% -ServiceType = 1 -StartType = 3 -ErrorControl = 1 -ServiceBinary = %12%\Neo6_x86_VPN54.sys -LoadOrderGroup = NDIS - -[Neo.Reg] -HKR, Ndi, Service, 0, Neo.Service.Name -HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" -HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" - -[Neo.EventLog] -HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN54.sys" -HKR, , TypesSupported, 0x00010001, 7 - -[Strings] -CompanyName = "SoftEther Corporation" -DiskDescription = "VPN Client Device Driver Install Disk" -Neo.Service.Name = "Neo_VPN54" -Neo.Service.DispName = "VPN Client Device Driver - VPN54" -Neo.Service.Desc = "VPN Client Adapter - VPN54" -NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN54" -Neo.EventLog.Name = "Neo" -NetworkAddress = "MAC Address" -DefaultAddress = "000001000001" -MaxSpeed = "Indicate Speed (Mbps)" -KeepLink = "Keep Link" -On = "On" -Off = "Off" - - -; Auto Generated 20180205_163616.108 - +; VPN Client Device Driver for Windows 2000 and Greater +; +; Copyright (c) SoftEther Corporation. All Rights Reserved. +; http://www.softether.co.jp/ +; +; BUILD 9658 + +[Version] +Signature = "$Windows NT$" +Class = Net +ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} +Provider = %CompanyName% +DriverVer = 02/04/2018, 4.25.0.9658 +CatalogFile.NT = Neo6_x86_VPN54.cat + +[Manufacturer] +%CompanyName% = SoftEther + +[SourceDisksNames] +1=%DiskDescription%, "", , + +[SourceDisksFiles] +Neo6_x86_VPN54.sys = 1 + +[DestinationDirs] +DefaultDestDir = 12 +Neo.CopyFiles.Sys = 12 + +[Neo.CopyFiles.Sys] +Neo6_x86_VPN54.sys, , , 2 + +[SoftEther] +%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN54 + +[NeoAdapter.Install] +Characteristics = 0x1 +AddReg = Neo.Reg, NeoAdapter.Ndi +CopyFiles = Neo.CopyFiles.Sys +*IfType = 53 +*MediaType = 0 +*PhysicalMediaType = 0 + +[NeoAdapter.Install.Services] +AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% + +[NeoAdapter.Ndi] +HKR, , NetworkAddress, 0, %DefaultAddress% +HKR, Ndi, DeviceID, , "NeoAdapter_VPN54" +HKR, , DevLoader, , ndis +HKR, , DeviceVxDs, , Neo6_x86_VPN54.sys +HKR, NDIS, LogDriverName, , "Neo_VPN54" +HKR, NDIS, MajorNdisVersion, 1, 5 +HKR, NDIS, MinorNdisVersion, 1, 0 +HKR, Ndi\Interfaces, DefUpper, , "ndis5" +HKR, Ndi\Interfaces, UpperRange, , "ndis5" +HKR, Ndi\Interfaces, LowerRange, , "ethernet" +HKR, Ndi\Interfaces, DefLower, , "ethernet" +HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" +HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% +HKR, Ndi\Params\NetworkAddress, type, 0, "edit" +HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" +HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" +HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% +HKR, Ndi\Params\NetworkAddress, optional, 0, "0" +HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% +HKR, Ndi\Params\MaxSpeed, type, 0, "int" +HKR, Ndi\Params\MaxSpeed, default, 0, "100" +HKR, Ndi\Params\MaxSpeed, min, 0, "0" +HKR, Ndi\Params\MaxSpeed, max, 0, "2000" +HKR, Ndi\Params\MaxSpeed, step, 0, "1" +HKR, Ndi\Params\MaxSpeed, Base, 0, "10" +HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% +HKR, Ndi\Params\KeepLink, type, 0, "enum" +HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% +HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% +HKR, Ndi\Params\KeepLink, default, 0, "0" + + +[Neo.Service] +DisplayName = %Neo.Service.DispName% +Description = %Neo.Service.Desc% +ServiceType = 1 +StartType = 3 +ErrorControl = 1 +ServiceBinary = %12%\Neo6_x86_VPN54.sys +LoadOrderGroup = NDIS + +[Neo.Reg] +HKR, Ndi, Service, 0, Neo.Service.Name +HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" +HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" + +[Neo.EventLog] +HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN54.sys" +HKR, , TypesSupported, 0x00010001, 7 + +[Strings] +CompanyName = "SoftEther Corporation" +DiskDescription = "VPN Client Device Driver Install Disk" +Neo.Service.Name = "Neo_VPN54" +Neo.Service.DispName = "VPN Client Device Driver - VPN54" +Neo.Service.Desc = "VPN Client Adapter - VPN54" +NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN54" +Neo.EventLog.Name = "Neo" +NetworkAddress = "MAC Address" +DefaultAddress = "000001000001" +MaxSpeed = "Indicate Speed (Mbps)" +KeepLink = "Keep Link" +On = "On" +Off = "Off" + + +; Auto Generated 20180205_163616.108 + diff --git a/src/bin/hamcore/DriverPackages/Neo6_Win10/x86/Neo6_x86_VPN55.inf b/src/bin/hamcore/DriverPackages/Neo6_Win10/x86/Neo6_x86_VPN55.inf index 3945acbf..3fad5132 100644 --- a/src/bin/hamcore/DriverPackages/Neo6_Win10/x86/Neo6_x86_VPN55.inf +++ b/src/bin/hamcore/DriverPackages/Neo6_Win10/x86/Neo6_x86_VPN55.inf @@ -1,114 +1,114 @@ -; VPN Client Device Driver for Windows 2000 and Greater -; -; Copyright (c) SoftEther Corporation. All Rights Reserved. -; http://www.softether.co.jp/ -; -; BUILD 9658 - -[Version] -Signature = "$Windows NT$" -Class = Net -ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} -Provider = %CompanyName% -DriverVer = 02/04/2018, 4.25.0.9658 -CatalogFile.NT = Neo6_x86_VPN55.cat - -[Manufacturer] -%CompanyName% = SoftEther - -[SourceDisksNames] -1=%DiskDescription%, "", , - -[SourceDisksFiles] -Neo6_x86_VPN55.sys = 1 - -[DestinationDirs] -DefaultDestDir = 12 -Neo.CopyFiles.Sys = 12 - -[Neo.CopyFiles.Sys] -Neo6_x86_VPN55.sys, , , 2 - -[SoftEther] -%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN55 - -[NeoAdapter.Install] -Characteristics = 0x1 -AddReg = Neo.Reg, NeoAdapter.Ndi -CopyFiles = Neo.CopyFiles.Sys -*IfType = 53 -*MediaType = 0 -*PhysicalMediaType = 0 - -[NeoAdapter.Install.Services] -AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% - -[NeoAdapter.Ndi] -HKR, , NetworkAddress, 0, %DefaultAddress% -HKR, Ndi, DeviceID, , "NeoAdapter_VPN55" -HKR, , DevLoader, , ndis -HKR, , DeviceVxDs, , Neo6_x86_VPN55.sys -HKR, NDIS, LogDriverName, , "Neo_VPN55" -HKR, NDIS, MajorNdisVersion, 1, 5 -HKR, NDIS, MinorNdisVersion, 1, 0 -HKR, Ndi\Interfaces, DefUpper, , "ndis5" -HKR, Ndi\Interfaces, UpperRange, , "ndis5" -HKR, Ndi\Interfaces, LowerRange, , "ethernet" -HKR, Ndi\Interfaces, DefLower, , "ethernet" -HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" -HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% -HKR, Ndi\Params\NetworkAddress, type, 0, "edit" -HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" -HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" -HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% -HKR, Ndi\Params\NetworkAddress, optional, 0, "0" -HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% -HKR, Ndi\Params\MaxSpeed, type, 0, "int" -HKR, Ndi\Params\MaxSpeed, default, 0, "100" -HKR, Ndi\Params\MaxSpeed, min, 0, "0" -HKR, Ndi\Params\MaxSpeed, max, 0, "2000" -HKR, Ndi\Params\MaxSpeed, step, 0, "1" -HKR, Ndi\Params\MaxSpeed, Base, 0, "10" -HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% -HKR, Ndi\Params\KeepLink, type, 0, "enum" -HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% -HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% -HKR, Ndi\Params\KeepLink, default, 0, "0" - - -[Neo.Service] -DisplayName = %Neo.Service.DispName% -Description = %Neo.Service.Desc% -ServiceType = 1 -StartType = 3 -ErrorControl = 1 -ServiceBinary = %12%\Neo6_x86_VPN55.sys -LoadOrderGroup = NDIS - -[Neo.Reg] -HKR, Ndi, Service, 0, Neo.Service.Name -HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" -HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" - -[Neo.EventLog] -HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN55.sys" -HKR, , TypesSupported, 0x00010001, 7 - -[Strings] -CompanyName = "SoftEther Corporation" -DiskDescription = "VPN Client Device Driver Install Disk" -Neo.Service.Name = "Neo_VPN55" -Neo.Service.DispName = "VPN Client Device Driver - VPN55" -Neo.Service.Desc = "VPN Client Adapter - VPN55" -NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN55" -Neo.EventLog.Name = "Neo" -NetworkAddress = "MAC Address" -DefaultAddress = "000001000001" -MaxSpeed = "Indicate Speed (Mbps)" -KeepLink = "Keep Link" -On = "On" -Off = "Off" - - -; Auto Generated 20180205_163616.178 - +; VPN Client Device Driver for Windows 2000 and Greater +; +; Copyright (c) SoftEther Corporation. All Rights Reserved. +; http://www.softether.co.jp/ +; +; BUILD 9658 + +[Version] +Signature = "$Windows NT$" +Class = Net +ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} +Provider = %CompanyName% +DriverVer = 02/04/2018, 4.25.0.9658 +CatalogFile.NT = Neo6_x86_VPN55.cat + +[Manufacturer] +%CompanyName% = SoftEther + +[SourceDisksNames] +1=%DiskDescription%, "", , + +[SourceDisksFiles] +Neo6_x86_VPN55.sys = 1 + +[DestinationDirs] +DefaultDestDir = 12 +Neo.CopyFiles.Sys = 12 + +[Neo.CopyFiles.Sys] +Neo6_x86_VPN55.sys, , , 2 + +[SoftEther] +%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN55 + +[NeoAdapter.Install] +Characteristics = 0x1 +AddReg = Neo.Reg, NeoAdapter.Ndi +CopyFiles = Neo.CopyFiles.Sys +*IfType = 53 +*MediaType = 0 +*PhysicalMediaType = 0 + +[NeoAdapter.Install.Services] +AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% + +[NeoAdapter.Ndi] +HKR, , NetworkAddress, 0, %DefaultAddress% +HKR, Ndi, DeviceID, , "NeoAdapter_VPN55" +HKR, , DevLoader, , ndis +HKR, , DeviceVxDs, , Neo6_x86_VPN55.sys +HKR, NDIS, LogDriverName, , "Neo_VPN55" +HKR, NDIS, MajorNdisVersion, 1, 5 +HKR, NDIS, MinorNdisVersion, 1, 0 +HKR, Ndi\Interfaces, DefUpper, , "ndis5" +HKR, Ndi\Interfaces, UpperRange, , "ndis5" +HKR, Ndi\Interfaces, LowerRange, , "ethernet" +HKR, Ndi\Interfaces, DefLower, , "ethernet" +HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" +HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% +HKR, Ndi\Params\NetworkAddress, type, 0, "edit" +HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" +HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" +HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% +HKR, Ndi\Params\NetworkAddress, optional, 0, "0" +HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% +HKR, Ndi\Params\MaxSpeed, type, 0, "int" +HKR, Ndi\Params\MaxSpeed, default, 0, "100" +HKR, Ndi\Params\MaxSpeed, min, 0, "0" +HKR, Ndi\Params\MaxSpeed, max, 0, "2000" +HKR, Ndi\Params\MaxSpeed, step, 0, "1" +HKR, Ndi\Params\MaxSpeed, Base, 0, "10" +HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% +HKR, Ndi\Params\KeepLink, type, 0, "enum" +HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% +HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% +HKR, Ndi\Params\KeepLink, default, 0, "0" + + +[Neo.Service] +DisplayName = %Neo.Service.DispName% +Description = %Neo.Service.Desc% +ServiceType = 1 +StartType = 3 +ErrorControl = 1 +ServiceBinary = %12%\Neo6_x86_VPN55.sys +LoadOrderGroup = NDIS + +[Neo.Reg] +HKR, Ndi, Service, 0, Neo.Service.Name +HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" +HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" + +[Neo.EventLog] +HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN55.sys" +HKR, , TypesSupported, 0x00010001, 7 + +[Strings] +CompanyName = "SoftEther Corporation" +DiskDescription = "VPN Client Device Driver Install Disk" +Neo.Service.Name = "Neo_VPN55" +Neo.Service.DispName = "VPN Client Device Driver - VPN55" +Neo.Service.Desc = "VPN Client Adapter - VPN55" +NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN55" +Neo.EventLog.Name = "Neo" +NetworkAddress = "MAC Address" +DefaultAddress = "000001000001" +MaxSpeed = "Indicate Speed (Mbps)" +KeepLink = "Keep Link" +On = "On" +Off = "Off" + + +; Auto Generated 20180205_163616.178 + diff --git a/src/bin/hamcore/DriverPackages/Neo6_Win10/x86/Neo6_x86_VPN56.inf b/src/bin/hamcore/DriverPackages/Neo6_Win10/x86/Neo6_x86_VPN56.inf index d7cf6f0a..ce0c9803 100644 --- a/src/bin/hamcore/DriverPackages/Neo6_Win10/x86/Neo6_x86_VPN56.inf +++ b/src/bin/hamcore/DriverPackages/Neo6_Win10/x86/Neo6_x86_VPN56.inf @@ -1,114 +1,114 @@ -; VPN Client Device Driver for Windows 2000 and Greater -; -; Copyright (c) SoftEther Corporation. All Rights Reserved. -; http://www.softether.co.jp/ -; -; BUILD 9658 - -[Version] -Signature = "$Windows NT$" -Class = Net -ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} -Provider = %CompanyName% -DriverVer = 02/04/2018, 4.25.0.9658 -CatalogFile.NT = Neo6_x86_VPN56.cat - -[Manufacturer] -%CompanyName% = SoftEther - -[SourceDisksNames] -1=%DiskDescription%, "", , - -[SourceDisksFiles] -Neo6_x86_VPN56.sys = 1 - -[DestinationDirs] -DefaultDestDir = 12 -Neo.CopyFiles.Sys = 12 - -[Neo.CopyFiles.Sys] -Neo6_x86_VPN56.sys, , , 2 - -[SoftEther] -%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN56 - -[NeoAdapter.Install] -Characteristics = 0x1 -AddReg = Neo.Reg, NeoAdapter.Ndi -CopyFiles = Neo.CopyFiles.Sys -*IfType = 53 -*MediaType = 0 -*PhysicalMediaType = 0 - -[NeoAdapter.Install.Services] -AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% - -[NeoAdapter.Ndi] -HKR, , NetworkAddress, 0, %DefaultAddress% -HKR, Ndi, DeviceID, , "NeoAdapter_VPN56" -HKR, , DevLoader, , ndis -HKR, , DeviceVxDs, , Neo6_x86_VPN56.sys -HKR, NDIS, LogDriverName, , "Neo_VPN56" -HKR, NDIS, MajorNdisVersion, 1, 5 -HKR, NDIS, MinorNdisVersion, 1, 0 -HKR, Ndi\Interfaces, DefUpper, , "ndis5" -HKR, Ndi\Interfaces, UpperRange, , "ndis5" -HKR, Ndi\Interfaces, LowerRange, , "ethernet" -HKR, Ndi\Interfaces, DefLower, , "ethernet" -HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" -HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% -HKR, Ndi\Params\NetworkAddress, type, 0, "edit" -HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" -HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" -HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% -HKR, Ndi\Params\NetworkAddress, optional, 0, "0" -HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% -HKR, Ndi\Params\MaxSpeed, type, 0, "int" -HKR, Ndi\Params\MaxSpeed, default, 0, "100" -HKR, Ndi\Params\MaxSpeed, min, 0, "0" -HKR, Ndi\Params\MaxSpeed, max, 0, "2000" -HKR, Ndi\Params\MaxSpeed, step, 0, "1" -HKR, Ndi\Params\MaxSpeed, Base, 0, "10" -HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% -HKR, Ndi\Params\KeepLink, type, 0, "enum" -HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% -HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% -HKR, Ndi\Params\KeepLink, default, 0, "0" - - -[Neo.Service] -DisplayName = %Neo.Service.DispName% -Description = %Neo.Service.Desc% -ServiceType = 1 -StartType = 3 -ErrorControl = 1 -ServiceBinary = %12%\Neo6_x86_VPN56.sys -LoadOrderGroup = NDIS - -[Neo.Reg] -HKR, Ndi, Service, 0, Neo.Service.Name -HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" -HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" - -[Neo.EventLog] -HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN56.sys" -HKR, , TypesSupported, 0x00010001, 7 - -[Strings] -CompanyName = "SoftEther Corporation" -DiskDescription = "VPN Client Device Driver Install Disk" -Neo.Service.Name = "Neo_VPN56" -Neo.Service.DispName = "VPN Client Device Driver - VPN56" -Neo.Service.Desc = "VPN Client Adapter - VPN56" -NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN56" -Neo.EventLog.Name = "Neo" -NetworkAddress = "MAC Address" -DefaultAddress = "000001000001" -MaxSpeed = "Indicate Speed (Mbps)" -KeepLink = "Keep Link" -On = "On" -Off = "Off" - - -; Auto Generated 20180205_163616.250 - +; VPN Client Device Driver for Windows 2000 and Greater +; +; Copyright (c) SoftEther Corporation. All Rights Reserved. +; http://www.softether.co.jp/ +; +; BUILD 9658 + +[Version] +Signature = "$Windows NT$" +Class = Net +ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} +Provider = %CompanyName% +DriverVer = 02/04/2018, 4.25.0.9658 +CatalogFile.NT = Neo6_x86_VPN56.cat + +[Manufacturer] +%CompanyName% = SoftEther + +[SourceDisksNames] +1=%DiskDescription%, "", , + +[SourceDisksFiles] +Neo6_x86_VPN56.sys = 1 + +[DestinationDirs] +DefaultDestDir = 12 +Neo.CopyFiles.Sys = 12 + +[Neo.CopyFiles.Sys] +Neo6_x86_VPN56.sys, , , 2 + +[SoftEther] +%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN56 + +[NeoAdapter.Install] +Characteristics = 0x1 +AddReg = Neo.Reg, NeoAdapter.Ndi +CopyFiles = Neo.CopyFiles.Sys +*IfType = 53 +*MediaType = 0 +*PhysicalMediaType = 0 + +[NeoAdapter.Install.Services] +AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% + +[NeoAdapter.Ndi] +HKR, , NetworkAddress, 0, %DefaultAddress% +HKR, Ndi, DeviceID, , "NeoAdapter_VPN56" +HKR, , DevLoader, , ndis +HKR, , DeviceVxDs, , Neo6_x86_VPN56.sys +HKR, NDIS, LogDriverName, , "Neo_VPN56" +HKR, NDIS, MajorNdisVersion, 1, 5 +HKR, NDIS, MinorNdisVersion, 1, 0 +HKR, Ndi\Interfaces, DefUpper, , "ndis5" +HKR, Ndi\Interfaces, UpperRange, , "ndis5" +HKR, Ndi\Interfaces, LowerRange, , "ethernet" +HKR, Ndi\Interfaces, DefLower, , "ethernet" +HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" +HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% +HKR, Ndi\Params\NetworkAddress, type, 0, "edit" +HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" +HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" +HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% +HKR, Ndi\Params\NetworkAddress, optional, 0, "0" +HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% +HKR, Ndi\Params\MaxSpeed, type, 0, "int" +HKR, Ndi\Params\MaxSpeed, default, 0, "100" +HKR, Ndi\Params\MaxSpeed, min, 0, "0" +HKR, Ndi\Params\MaxSpeed, max, 0, "2000" +HKR, Ndi\Params\MaxSpeed, step, 0, "1" +HKR, Ndi\Params\MaxSpeed, Base, 0, "10" +HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% +HKR, Ndi\Params\KeepLink, type, 0, "enum" +HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% +HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% +HKR, Ndi\Params\KeepLink, default, 0, "0" + + +[Neo.Service] +DisplayName = %Neo.Service.DispName% +Description = %Neo.Service.Desc% +ServiceType = 1 +StartType = 3 +ErrorControl = 1 +ServiceBinary = %12%\Neo6_x86_VPN56.sys +LoadOrderGroup = NDIS + +[Neo.Reg] +HKR, Ndi, Service, 0, Neo.Service.Name +HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" +HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" + +[Neo.EventLog] +HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN56.sys" +HKR, , TypesSupported, 0x00010001, 7 + +[Strings] +CompanyName = "SoftEther Corporation" +DiskDescription = "VPN Client Device Driver Install Disk" +Neo.Service.Name = "Neo_VPN56" +Neo.Service.DispName = "VPN Client Device Driver - VPN56" +Neo.Service.Desc = "VPN Client Adapter - VPN56" +NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN56" +Neo.EventLog.Name = "Neo" +NetworkAddress = "MAC Address" +DefaultAddress = "000001000001" +MaxSpeed = "Indicate Speed (Mbps)" +KeepLink = "Keep Link" +On = "On" +Off = "Off" + + +; Auto Generated 20180205_163616.250 + diff --git a/src/bin/hamcore/DriverPackages/Neo6_Win10/x86/Neo6_x86_VPN57.inf b/src/bin/hamcore/DriverPackages/Neo6_Win10/x86/Neo6_x86_VPN57.inf index a13b02c1..93385e10 100644 --- a/src/bin/hamcore/DriverPackages/Neo6_Win10/x86/Neo6_x86_VPN57.inf +++ b/src/bin/hamcore/DriverPackages/Neo6_Win10/x86/Neo6_x86_VPN57.inf @@ -1,114 +1,114 @@ -; VPN Client Device Driver for Windows 2000 and Greater -; -; Copyright (c) SoftEther Corporation. All Rights Reserved. -; http://www.softether.co.jp/ -; -; BUILD 9658 - -[Version] -Signature = "$Windows NT$" -Class = Net -ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} -Provider = %CompanyName% -DriverVer = 02/04/2018, 4.25.0.9658 -CatalogFile.NT = Neo6_x86_VPN57.cat - -[Manufacturer] -%CompanyName% = SoftEther - -[SourceDisksNames] -1=%DiskDescription%, "", , - -[SourceDisksFiles] -Neo6_x86_VPN57.sys = 1 - -[DestinationDirs] -DefaultDestDir = 12 -Neo.CopyFiles.Sys = 12 - -[Neo.CopyFiles.Sys] -Neo6_x86_VPN57.sys, , , 2 - -[SoftEther] -%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN57 - -[NeoAdapter.Install] -Characteristics = 0x1 -AddReg = Neo.Reg, NeoAdapter.Ndi -CopyFiles = Neo.CopyFiles.Sys -*IfType = 53 -*MediaType = 0 -*PhysicalMediaType = 0 - -[NeoAdapter.Install.Services] -AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% - -[NeoAdapter.Ndi] -HKR, , NetworkAddress, 0, %DefaultAddress% -HKR, Ndi, DeviceID, , "NeoAdapter_VPN57" -HKR, , DevLoader, , ndis -HKR, , DeviceVxDs, , Neo6_x86_VPN57.sys -HKR, NDIS, LogDriverName, , "Neo_VPN57" -HKR, NDIS, MajorNdisVersion, 1, 5 -HKR, NDIS, MinorNdisVersion, 1, 0 -HKR, Ndi\Interfaces, DefUpper, , "ndis5" -HKR, Ndi\Interfaces, UpperRange, , "ndis5" -HKR, Ndi\Interfaces, LowerRange, , "ethernet" -HKR, Ndi\Interfaces, DefLower, , "ethernet" -HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" -HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% -HKR, Ndi\Params\NetworkAddress, type, 0, "edit" -HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" -HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" -HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% -HKR, Ndi\Params\NetworkAddress, optional, 0, "0" -HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% -HKR, Ndi\Params\MaxSpeed, type, 0, "int" -HKR, Ndi\Params\MaxSpeed, default, 0, "100" -HKR, Ndi\Params\MaxSpeed, min, 0, "0" -HKR, Ndi\Params\MaxSpeed, max, 0, "2000" -HKR, Ndi\Params\MaxSpeed, step, 0, "1" -HKR, Ndi\Params\MaxSpeed, Base, 0, "10" -HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% -HKR, Ndi\Params\KeepLink, type, 0, "enum" -HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% -HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% -HKR, Ndi\Params\KeepLink, default, 0, "0" - - -[Neo.Service] -DisplayName = %Neo.Service.DispName% -Description = %Neo.Service.Desc% -ServiceType = 1 -StartType = 3 -ErrorControl = 1 -ServiceBinary = %12%\Neo6_x86_VPN57.sys -LoadOrderGroup = NDIS - -[Neo.Reg] -HKR, Ndi, Service, 0, Neo.Service.Name -HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" -HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" - -[Neo.EventLog] -HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN57.sys" -HKR, , TypesSupported, 0x00010001, 7 - -[Strings] -CompanyName = "SoftEther Corporation" -DiskDescription = "VPN Client Device Driver Install Disk" -Neo.Service.Name = "Neo_VPN57" -Neo.Service.DispName = "VPN Client Device Driver - VPN57" -Neo.Service.Desc = "VPN Client Adapter - VPN57" -NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN57" -Neo.EventLog.Name = "Neo" -NetworkAddress = "MAC Address" -DefaultAddress = "000001000001" -MaxSpeed = "Indicate Speed (Mbps)" -KeepLink = "Keep Link" -On = "On" -Off = "Off" - - -; Auto Generated 20180205_163616.323 - +; VPN Client Device Driver for Windows 2000 and Greater +; +; Copyright (c) SoftEther Corporation. All Rights Reserved. +; http://www.softether.co.jp/ +; +; BUILD 9658 + +[Version] +Signature = "$Windows NT$" +Class = Net +ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} +Provider = %CompanyName% +DriverVer = 02/04/2018, 4.25.0.9658 +CatalogFile.NT = Neo6_x86_VPN57.cat + +[Manufacturer] +%CompanyName% = SoftEther + +[SourceDisksNames] +1=%DiskDescription%, "", , + +[SourceDisksFiles] +Neo6_x86_VPN57.sys = 1 + +[DestinationDirs] +DefaultDestDir = 12 +Neo.CopyFiles.Sys = 12 + +[Neo.CopyFiles.Sys] +Neo6_x86_VPN57.sys, , , 2 + +[SoftEther] +%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN57 + +[NeoAdapter.Install] +Characteristics = 0x1 +AddReg = Neo.Reg, NeoAdapter.Ndi +CopyFiles = Neo.CopyFiles.Sys +*IfType = 53 +*MediaType = 0 +*PhysicalMediaType = 0 + +[NeoAdapter.Install.Services] +AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% + +[NeoAdapter.Ndi] +HKR, , NetworkAddress, 0, %DefaultAddress% +HKR, Ndi, DeviceID, , "NeoAdapter_VPN57" +HKR, , DevLoader, , ndis +HKR, , DeviceVxDs, , Neo6_x86_VPN57.sys +HKR, NDIS, LogDriverName, , "Neo_VPN57" +HKR, NDIS, MajorNdisVersion, 1, 5 +HKR, NDIS, MinorNdisVersion, 1, 0 +HKR, Ndi\Interfaces, DefUpper, , "ndis5" +HKR, Ndi\Interfaces, UpperRange, , "ndis5" +HKR, Ndi\Interfaces, LowerRange, , "ethernet" +HKR, Ndi\Interfaces, DefLower, , "ethernet" +HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" +HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% +HKR, Ndi\Params\NetworkAddress, type, 0, "edit" +HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" +HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" +HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% +HKR, Ndi\Params\NetworkAddress, optional, 0, "0" +HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% +HKR, Ndi\Params\MaxSpeed, type, 0, "int" +HKR, Ndi\Params\MaxSpeed, default, 0, "100" +HKR, Ndi\Params\MaxSpeed, min, 0, "0" +HKR, Ndi\Params\MaxSpeed, max, 0, "2000" +HKR, Ndi\Params\MaxSpeed, step, 0, "1" +HKR, Ndi\Params\MaxSpeed, Base, 0, "10" +HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% +HKR, Ndi\Params\KeepLink, type, 0, "enum" +HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% +HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% +HKR, Ndi\Params\KeepLink, default, 0, "0" + + +[Neo.Service] +DisplayName = %Neo.Service.DispName% +Description = %Neo.Service.Desc% +ServiceType = 1 +StartType = 3 +ErrorControl = 1 +ServiceBinary = %12%\Neo6_x86_VPN57.sys +LoadOrderGroup = NDIS + +[Neo.Reg] +HKR, Ndi, Service, 0, Neo.Service.Name +HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" +HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" + +[Neo.EventLog] +HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN57.sys" +HKR, , TypesSupported, 0x00010001, 7 + +[Strings] +CompanyName = "SoftEther Corporation" +DiskDescription = "VPN Client Device Driver Install Disk" +Neo.Service.Name = "Neo_VPN57" +Neo.Service.DispName = "VPN Client Device Driver - VPN57" +Neo.Service.Desc = "VPN Client Adapter - VPN57" +NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN57" +Neo.EventLog.Name = "Neo" +NetworkAddress = "MAC Address" +DefaultAddress = "000001000001" +MaxSpeed = "Indicate Speed (Mbps)" +KeepLink = "Keep Link" +On = "On" +Off = "Off" + + +; Auto Generated 20180205_163616.323 + diff --git a/src/bin/hamcore/DriverPackages/Neo6_Win10/x86/Neo6_x86_VPN58.inf b/src/bin/hamcore/DriverPackages/Neo6_Win10/x86/Neo6_x86_VPN58.inf index df3dd630..87d96c0f 100644 --- a/src/bin/hamcore/DriverPackages/Neo6_Win10/x86/Neo6_x86_VPN58.inf +++ b/src/bin/hamcore/DriverPackages/Neo6_Win10/x86/Neo6_x86_VPN58.inf @@ -1,114 +1,114 @@ -; VPN Client Device Driver for Windows 2000 and Greater -; -; Copyright (c) SoftEther Corporation. All Rights Reserved. -; http://www.softether.co.jp/ -; -; BUILD 9658 - -[Version] -Signature = "$Windows NT$" -Class = Net -ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} -Provider = %CompanyName% -DriverVer = 02/04/2018, 4.25.0.9658 -CatalogFile.NT = Neo6_x86_VPN58.cat - -[Manufacturer] -%CompanyName% = SoftEther - -[SourceDisksNames] -1=%DiskDescription%, "", , - -[SourceDisksFiles] -Neo6_x86_VPN58.sys = 1 - -[DestinationDirs] -DefaultDestDir = 12 -Neo.CopyFiles.Sys = 12 - -[Neo.CopyFiles.Sys] -Neo6_x86_VPN58.sys, , , 2 - -[SoftEther] -%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN58 - -[NeoAdapter.Install] -Characteristics = 0x1 -AddReg = Neo.Reg, NeoAdapter.Ndi -CopyFiles = Neo.CopyFiles.Sys -*IfType = 53 -*MediaType = 0 -*PhysicalMediaType = 0 - -[NeoAdapter.Install.Services] -AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% - -[NeoAdapter.Ndi] -HKR, , NetworkAddress, 0, %DefaultAddress% -HKR, Ndi, DeviceID, , "NeoAdapter_VPN58" -HKR, , DevLoader, , ndis -HKR, , DeviceVxDs, , Neo6_x86_VPN58.sys -HKR, NDIS, LogDriverName, , "Neo_VPN58" -HKR, NDIS, MajorNdisVersion, 1, 5 -HKR, NDIS, MinorNdisVersion, 1, 0 -HKR, Ndi\Interfaces, DefUpper, , "ndis5" -HKR, Ndi\Interfaces, UpperRange, , "ndis5" -HKR, Ndi\Interfaces, LowerRange, , "ethernet" -HKR, Ndi\Interfaces, DefLower, , "ethernet" -HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" -HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% -HKR, Ndi\Params\NetworkAddress, type, 0, "edit" -HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" -HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" -HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% -HKR, Ndi\Params\NetworkAddress, optional, 0, "0" -HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% -HKR, Ndi\Params\MaxSpeed, type, 0, "int" -HKR, Ndi\Params\MaxSpeed, default, 0, "100" -HKR, Ndi\Params\MaxSpeed, min, 0, "0" -HKR, Ndi\Params\MaxSpeed, max, 0, "2000" -HKR, Ndi\Params\MaxSpeed, step, 0, "1" -HKR, Ndi\Params\MaxSpeed, Base, 0, "10" -HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% -HKR, Ndi\Params\KeepLink, type, 0, "enum" -HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% -HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% -HKR, Ndi\Params\KeepLink, default, 0, "0" - - -[Neo.Service] -DisplayName = %Neo.Service.DispName% -Description = %Neo.Service.Desc% -ServiceType = 1 -StartType = 3 -ErrorControl = 1 -ServiceBinary = %12%\Neo6_x86_VPN58.sys -LoadOrderGroup = NDIS - -[Neo.Reg] -HKR, Ndi, Service, 0, Neo.Service.Name -HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" -HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" - -[Neo.EventLog] -HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN58.sys" -HKR, , TypesSupported, 0x00010001, 7 - -[Strings] -CompanyName = "SoftEther Corporation" -DiskDescription = "VPN Client Device Driver Install Disk" -Neo.Service.Name = "Neo_VPN58" -Neo.Service.DispName = "VPN Client Device Driver - VPN58" -Neo.Service.Desc = "VPN Client Adapter - VPN58" -NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN58" -Neo.EventLog.Name = "Neo" -NetworkAddress = "MAC Address" -DefaultAddress = "000001000001" -MaxSpeed = "Indicate Speed (Mbps)" -KeepLink = "Keep Link" -On = "On" -Off = "Off" - - -; Auto Generated 20180205_163616.396 - +; VPN Client Device Driver for Windows 2000 and Greater +; +; Copyright (c) SoftEther Corporation. All Rights Reserved. +; http://www.softether.co.jp/ +; +; BUILD 9658 + +[Version] +Signature = "$Windows NT$" +Class = Net +ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} +Provider = %CompanyName% +DriverVer = 02/04/2018, 4.25.0.9658 +CatalogFile.NT = Neo6_x86_VPN58.cat + +[Manufacturer] +%CompanyName% = SoftEther + +[SourceDisksNames] +1=%DiskDescription%, "", , + +[SourceDisksFiles] +Neo6_x86_VPN58.sys = 1 + +[DestinationDirs] +DefaultDestDir = 12 +Neo.CopyFiles.Sys = 12 + +[Neo.CopyFiles.Sys] +Neo6_x86_VPN58.sys, , , 2 + +[SoftEther] +%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN58 + +[NeoAdapter.Install] +Characteristics = 0x1 +AddReg = Neo.Reg, NeoAdapter.Ndi +CopyFiles = Neo.CopyFiles.Sys +*IfType = 53 +*MediaType = 0 +*PhysicalMediaType = 0 + +[NeoAdapter.Install.Services] +AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% + +[NeoAdapter.Ndi] +HKR, , NetworkAddress, 0, %DefaultAddress% +HKR, Ndi, DeviceID, , "NeoAdapter_VPN58" +HKR, , DevLoader, , ndis +HKR, , DeviceVxDs, , Neo6_x86_VPN58.sys +HKR, NDIS, LogDriverName, , "Neo_VPN58" +HKR, NDIS, MajorNdisVersion, 1, 5 +HKR, NDIS, MinorNdisVersion, 1, 0 +HKR, Ndi\Interfaces, DefUpper, , "ndis5" +HKR, Ndi\Interfaces, UpperRange, , "ndis5" +HKR, Ndi\Interfaces, LowerRange, , "ethernet" +HKR, Ndi\Interfaces, DefLower, , "ethernet" +HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" +HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% +HKR, Ndi\Params\NetworkAddress, type, 0, "edit" +HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" +HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" +HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% +HKR, Ndi\Params\NetworkAddress, optional, 0, "0" +HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% +HKR, Ndi\Params\MaxSpeed, type, 0, "int" +HKR, Ndi\Params\MaxSpeed, default, 0, "100" +HKR, Ndi\Params\MaxSpeed, min, 0, "0" +HKR, Ndi\Params\MaxSpeed, max, 0, "2000" +HKR, Ndi\Params\MaxSpeed, step, 0, "1" +HKR, Ndi\Params\MaxSpeed, Base, 0, "10" +HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% +HKR, Ndi\Params\KeepLink, type, 0, "enum" +HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% +HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% +HKR, Ndi\Params\KeepLink, default, 0, "0" + + +[Neo.Service] +DisplayName = %Neo.Service.DispName% +Description = %Neo.Service.Desc% +ServiceType = 1 +StartType = 3 +ErrorControl = 1 +ServiceBinary = %12%\Neo6_x86_VPN58.sys +LoadOrderGroup = NDIS + +[Neo.Reg] +HKR, Ndi, Service, 0, Neo.Service.Name +HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" +HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" + +[Neo.EventLog] +HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN58.sys" +HKR, , TypesSupported, 0x00010001, 7 + +[Strings] +CompanyName = "SoftEther Corporation" +DiskDescription = "VPN Client Device Driver Install Disk" +Neo.Service.Name = "Neo_VPN58" +Neo.Service.DispName = "VPN Client Device Driver - VPN58" +Neo.Service.Desc = "VPN Client Adapter - VPN58" +NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN58" +Neo.EventLog.Name = "Neo" +NetworkAddress = "MAC Address" +DefaultAddress = "000001000001" +MaxSpeed = "Indicate Speed (Mbps)" +KeepLink = "Keep Link" +On = "On" +Off = "Off" + + +; Auto Generated 20180205_163616.396 + diff --git a/src/bin/hamcore/DriverPackages/Neo6_Win10/x86/Neo6_x86_VPN59.inf b/src/bin/hamcore/DriverPackages/Neo6_Win10/x86/Neo6_x86_VPN59.inf index 951c1200..c1a68af7 100644 --- a/src/bin/hamcore/DriverPackages/Neo6_Win10/x86/Neo6_x86_VPN59.inf +++ b/src/bin/hamcore/DriverPackages/Neo6_Win10/x86/Neo6_x86_VPN59.inf @@ -1,114 +1,114 @@ -; VPN Client Device Driver for Windows 2000 and Greater -; -; Copyright (c) SoftEther Corporation. All Rights Reserved. -; http://www.softether.co.jp/ -; -; BUILD 9658 - -[Version] -Signature = "$Windows NT$" -Class = Net -ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} -Provider = %CompanyName% -DriverVer = 02/04/2018, 4.25.0.9658 -CatalogFile.NT = Neo6_x86_VPN59.cat - -[Manufacturer] -%CompanyName% = SoftEther - -[SourceDisksNames] -1=%DiskDescription%, "", , - -[SourceDisksFiles] -Neo6_x86_VPN59.sys = 1 - -[DestinationDirs] -DefaultDestDir = 12 -Neo.CopyFiles.Sys = 12 - -[Neo.CopyFiles.Sys] -Neo6_x86_VPN59.sys, , , 2 - -[SoftEther] -%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN59 - -[NeoAdapter.Install] -Characteristics = 0x1 -AddReg = Neo.Reg, NeoAdapter.Ndi -CopyFiles = Neo.CopyFiles.Sys -*IfType = 53 -*MediaType = 0 -*PhysicalMediaType = 0 - -[NeoAdapter.Install.Services] -AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% - -[NeoAdapter.Ndi] -HKR, , NetworkAddress, 0, %DefaultAddress% -HKR, Ndi, DeviceID, , "NeoAdapter_VPN59" -HKR, , DevLoader, , ndis -HKR, , DeviceVxDs, , Neo6_x86_VPN59.sys -HKR, NDIS, LogDriverName, , "Neo_VPN59" -HKR, NDIS, MajorNdisVersion, 1, 5 -HKR, NDIS, MinorNdisVersion, 1, 0 -HKR, Ndi\Interfaces, DefUpper, , "ndis5" -HKR, Ndi\Interfaces, UpperRange, , "ndis5" -HKR, Ndi\Interfaces, LowerRange, , "ethernet" -HKR, Ndi\Interfaces, DefLower, , "ethernet" -HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" -HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% -HKR, Ndi\Params\NetworkAddress, type, 0, "edit" -HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" -HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" -HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% -HKR, Ndi\Params\NetworkAddress, optional, 0, "0" -HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% -HKR, Ndi\Params\MaxSpeed, type, 0, "int" -HKR, Ndi\Params\MaxSpeed, default, 0, "100" -HKR, Ndi\Params\MaxSpeed, min, 0, "0" -HKR, Ndi\Params\MaxSpeed, max, 0, "2000" -HKR, Ndi\Params\MaxSpeed, step, 0, "1" -HKR, Ndi\Params\MaxSpeed, Base, 0, "10" -HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% -HKR, Ndi\Params\KeepLink, type, 0, "enum" -HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% -HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% -HKR, Ndi\Params\KeepLink, default, 0, "0" - - -[Neo.Service] -DisplayName = %Neo.Service.DispName% -Description = %Neo.Service.Desc% -ServiceType = 1 -StartType = 3 -ErrorControl = 1 -ServiceBinary = %12%\Neo6_x86_VPN59.sys -LoadOrderGroup = NDIS - -[Neo.Reg] -HKR, Ndi, Service, 0, Neo.Service.Name -HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" -HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" - -[Neo.EventLog] -HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN59.sys" -HKR, , TypesSupported, 0x00010001, 7 - -[Strings] -CompanyName = "SoftEther Corporation" -DiskDescription = "VPN Client Device Driver Install Disk" -Neo.Service.Name = "Neo_VPN59" -Neo.Service.DispName = "VPN Client Device Driver - VPN59" -Neo.Service.Desc = "VPN Client Adapter - VPN59" -NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN59" -Neo.EventLog.Name = "Neo" -NetworkAddress = "MAC Address" -DefaultAddress = "000001000001" -MaxSpeed = "Indicate Speed (Mbps)" -KeepLink = "Keep Link" -On = "On" -Off = "Off" - - -; Auto Generated 20180205_163616.468 - +; VPN Client Device Driver for Windows 2000 and Greater +; +; Copyright (c) SoftEther Corporation. All Rights Reserved. +; http://www.softether.co.jp/ +; +; BUILD 9658 + +[Version] +Signature = "$Windows NT$" +Class = Net +ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} +Provider = %CompanyName% +DriverVer = 02/04/2018, 4.25.0.9658 +CatalogFile.NT = Neo6_x86_VPN59.cat + +[Manufacturer] +%CompanyName% = SoftEther + +[SourceDisksNames] +1=%DiskDescription%, "", , + +[SourceDisksFiles] +Neo6_x86_VPN59.sys = 1 + +[DestinationDirs] +DefaultDestDir = 12 +Neo.CopyFiles.Sys = 12 + +[Neo.CopyFiles.Sys] +Neo6_x86_VPN59.sys, , , 2 + +[SoftEther] +%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN59 + +[NeoAdapter.Install] +Characteristics = 0x1 +AddReg = Neo.Reg, NeoAdapter.Ndi +CopyFiles = Neo.CopyFiles.Sys +*IfType = 53 +*MediaType = 0 +*PhysicalMediaType = 0 + +[NeoAdapter.Install.Services] +AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% + +[NeoAdapter.Ndi] +HKR, , NetworkAddress, 0, %DefaultAddress% +HKR, Ndi, DeviceID, , "NeoAdapter_VPN59" +HKR, , DevLoader, , ndis +HKR, , DeviceVxDs, , Neo6_x86_VPN59.sys +HKR, NDIS, LogDriverName, , "Neo_VPN59" +HKR, NDIS, MajorNdisVersion, 1, 5 +HKR, NDIS, MinorNdisVersion, 1, 0 +HKR, Ndi\Interfaces, DefUpper, , "ndis5" +HKR, Ndi\Interfaces, UpperRange, , "ndis5" +HKR, Ndi\Interfaces, LowerRange, , "ethernet" +HKR, Ndi\Interfaces, DefLower, , "ethernet" +HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" +HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% +HKR, Ndi\Params\NetworkAddress, type, 0, "edit" +HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" +HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" +HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% +HKR, Ndi\Params\NetworkAddress, optional, 0, "0" +HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% +HKR, Ndi\Params\MaxSpeed, type, 0, "int" +HKR, Ndi\Params\MaxSpeed, default, 0, "100" +HKR, Ndi\Params\MaxSpeed, min, 0, "0" +HKR, Ndi\Params\MaxSpeed, max, 0, "2000" +HKR, Ndi\Params\MaxSpeed, step, 0, "1" +HKR, Ndi\Params\MaxSpeed, Base, 0, "10" +HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% +HKR, Ndi\Params\KeepLink, type, 0, "enum" +HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% +HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% +HKR, Ndi\Params\KeepLink, default, 0, "0" + + +[Neo.Service] +DisplayName = %Neo.Service.DispName% +Description = %Neo.Service.Desc% +ServiceType = 1 +StartType = 3 +ErrorControl = 1 +ServiceBinary = %12%\Neo6_x86_VPN59.sys +LoadOrderGroup = NDIS + +[Neo.Reg] +HKR, Ndi, Service, 0, Neo.Service.Name +HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" +HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" + +[Neo.EventLog] +HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN59.sys" +HKR, , TypesSupported, 0x00010001, 7 + +[Strings] +CompanyName = "SoftEther Corporation" +DiskDescription = "VPN Client Device Driver Install Disk" +Neo.Service.Name = "Neo_VPN59" +Neo.Service.DispName = "VPN Client Device Driver - VPN59" +Neo.Service.Desc = "VPN Client Adapter - VPN59" +NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN59" +Neo.EventLog.Name = "Neo" +NetworkAddress = "MAC Address" +DefaultAddress = "000001000001" +MaxSpeed = "Indicate Speed (Mbps)" +KeepLink = "Keep Link" +On = "On" +Off = "Off" + + +; Auto Generated 20180205_163616.468 + diff --git a/src/bin/hamcore/DriverPackages/Neo6_Win10/x86/Neo6_x86_VPN6.inf b/src/bin/hamcore/DriverPackages/Neo6_Win10/x86/Neo6_x86_VPN6.inf index aedee90c..bbbaa540 100644 --- a/src/bin/hamcore/DriverPackages/Neo6_Win10/x86/Neo6_x86_VPN6.inf +++ b/src/bin/hamcore/DriverPackages/Neo6_Win10/x86/Neo6_x86_VPN6.inf @@ -1,114 +1,114 @@ -; VPN Client Device Driver for Windows 2000 and Greater -; -; Copyright (c) SoftEther Corporation. All Rights Reserved. -; http://www.softether.co.jp/ -; -; BUILD 9658 - -[Version] -Signature = "$Windows NT$" -Class = Net -ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} -Provider = %CompanyName% -DriverVer = 02/04/2018, 4.25.0.9658 -CatalogFile.NT = Neo6_x86_VPN6.cat - -[Manufacturer] -%CompanyName% = SoftEther - -[SourceDisksNames] -1=%DiskDescription%, "", , - -[SourceDisksFiles] -Neo6_x86_VPN6.sys = 1 - -[DestinationDirs] -DefaultDestDir = 12 -Neo.CopyFiles.Sys = 12 - -[Neo.CopyFiles.Sys] -Neo6_x86_VPN6.sys, , , 2 - -[SoftEther] -%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN6 - -[NeoAdapter.Install] -Characteristics = 0x1 -AddReg = Neo.Reg, NeoAdapter.Ndi -CopyFiles = Neo.CopyFiles.Sys -*IfType = 53 -*MediaType = 0 -*PhysicalMediaType = 0 - -[NeoAdapter.Install.Services] -AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% - -[NeoAdapter.Ndi] -HKR, , NetworkAddress, 0, %DefaultAddress% -HKR, Ndi, DeviceID, , "NeoAdapter_VPN6" -HKR, , DevLoader, , ndis -HKR, , DeviceVxDs, , Neo6_x86_VPN6.sys -HKR, NDIS, LogDriverName, , "Neo_VPN6" -HKR, NDIS, MajorNdisVersion, 1, 5 -HKR, NDIS, MinorNdisVersion, 1, 0 -HKR, Ndi\Interfaces, DefUpper, , "ndis5" -HKR, Ndi\Interfaces, UpperRange, , "ndis5" -HKR, Ndi\Interfaces, LowerRange, , "ethernet" -HKR, Ndi\Interfaces, DefLower, , "ethernet" -HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" -HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% -HKR, Ndi\Params\NetworkAddress, type, 0, "edit" -HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" -HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" -HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% -HKR, Ndi\Params\NetworkAddress, optional, 0, "0" -HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% -HKR, Ndi\Params\MaxSpeed, type, 0, "int" -HKR, Ndi\Params\MaxSpeed, default, 0, "100" -HKR, Ndi\Params\MaxSpeed, min, 0, "0" -HKR, Ndi\Params\MaxSpeed, max, 0, "2000" -HKR, Ndi\Params\MaxSpeed, step, 0, "1" -HKR, Ndi\Params\MaxSpeed, Base, 0, "10" -HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% -HKR, Ndi\Params\KeepLink, type, 0, "enum" -HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% -HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% -HKR, Ndi\Params\KeepLink, default, 0, "0" - - -[Neo.Service] -DisplayName = %Neo.Service.DispName% -Description = %Neo.Service.Desc% -ServiceType = 1 -StartType = 3 -ErrorControl = 1 -ServiceBinary = %12%\Neo6_x86_VPN6.sys -LoadOrderGroup = NDIS - -[Neo.Reg] -HKR, Ndi, Service, 0, Neo.Service.Name -HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" -HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" - -[Neo.EventLog] -HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN6.sys" -HKR, , TypesSupported, 0x00010001, 7 - -[Strings] -CompanyName = "SoftEther Corporation" -DiskDescription = "VPN Client Device Driver Install Disk" -Neo.Service.Name = "Neo_VPN6" -Neo.Service.DispName = "VPN Client Device Driver - VPN6" -Neo.Service.Desc = "VPN Client Adapter - VPN6" -NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN6" -Neo.EventLog.Name = "Neo" -NetworkAddress = "MAC Address" -DefaultAddress = "000001000001" -MaxSpeed = "Indicate Speed (Mbps)" -KeepLink = "Keep Link" -On = "On" -Off = "Off" - - -; Auto Generated 20180205_163612.692 - +; VPN Client Device Driver for Windows 2000 and Greater +; +; Copyright (c) SoftEther Corporation. All Rights Reserved. +; http://www.softether.co.jp/ +; +; BUILD 9658 + +[Version] +Signature = "$Windows NT$" +Class = Net +ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} +Provider = %CompanyName% +DriverVer = 02/04/2018, 4.25.0.9658 +CatalogFile.NT = Neo6_x86_VPN6.cat + +[Manufacturer] +%CompanyName% = SoftEther + +[SourceDisksNames] +1=%DiskDescription%, "", , + +[SourceDisksFiles] +Neo6_x86_VPN6.sys = 1 + +[DestinationDirs] +DefaultDestDir = 12 +Neo.CopyFiles.Sys = 12 + +[Neo.CopyFiles.Sys] +Neo6_x86_VPN6.sys, , , 2 + +[SoftEther] +%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN6 + +[NeoAdapter.Install] +Characteristics = 0x1 +AddReg = Neo.Reg, NeoAdapter.Ndi +CopyFiles = Neo.CopyFiles.Sys +*IfType = 53 +*MediaType = 0 +*PhysicalMediaType = 0 + +[NeoAdapter.Install.Services] +AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% + +[NeoAdapter.Ndi] +HKR, , NetworkAddress, 0, %DefaultAddress% +HKR, Ndi, DeviceID, , "NeoAdapter_VPN6" +HKR, , DevLoader, , ndis +HKR, , DeviceVxDs, , Neo6_x86_VPN6.sys +HKR, NDIS, LogDriverName, , "Neo_VPN6" +HKR, NDIS, MajorNdisVersion, 1, 5 +HKR, NDIS, MinorNdisVersion, 1, 0 +HKR, Ndi\Interfaces, DefUpper, , "ndis5" +HKR, Ndi\Interfaces, UpperRange, , "ndis5" +HKR, Ndi\Interfaces, LowerRange, , "ethernet" +HKR, Ndi\Interfaces, DefLower, , "ethernet" +HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" +HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% +HKR, Ndi\Params\NetworkAddress, type, 0, "edit" +HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" +HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" +HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% +HKR, Ndi\Params\NetworkAddress, optional, 0, "0" +HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% +HKR, Ndi\Params\MaxSpeed, type, 0, "int" +HKR, Ndi\Params\MaxSpeed, default, 0, "100" +HKR, Ndi\Params\MaxSpeed, min, 0, "0" +HKR, Ndi\Params\MaxSpeed, max, 0, "2000" +HKR, Ndi\Params\MaxSpeed, step, 0, "1" +HKR, Ndi\Params\MaxSpeed, Base, 0, "10" +HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% +HKR, Ndi\Params\KeepLink, type, 0, "enum" +HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% +HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% +HKR, Ndi\Params\KeepLink, default, 0, "0" + + +[Neo.Service] +DisplayName = %Neo.Service.DispName% +Description = %Neo.Service.Desc% +ServiceType = 1 +StartType = 3 +ErrorControl = 1 +ServiceBinary = %12%\Neo6_x86_VPN6.sys +LoadOrderGroup = NDIS + +[Neo.Reg] +HKR, Ndi, Service, 0, Neo.Service.Name +HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" +HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" + +[Neo.EventLog] +HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN6.sys" +HKR, , TypesSupported, 0x00010001, 7 + +[Strings] +CompanyName = "SoftEther Corporation" +DiskDescription = "VPN Client Device Driver Install Disk" +Neo.Service.Name = "Neo_VPN6" +Neo.Service.DispName = "VPN Client Device Driver - VPN6" +Neo.Service.Desc = "VPN Client Adapter - VPN6" +NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN6" +Neo.EventLog.Name = "Neo" +NetworkAddress = "MAC Address" +DefaultAddress = "000001000001" +MaxSpeed = "Indicate Speed (Mbps)" +KeepLink = "Keep Link" +On = "On" +Off = "Off" + + +; Auto Generated 20180205_163612.692 + diff --git a/src/bin/hamcore/DriverPackages/Neo6_Win10/x86/Neo6_x86_VPN60.inf b/src/bin/hamcore/DriverPackages/Neo6_Win10/x86/Neo6_x86_VPN60.inf index b56053a8..b98d1770 100644 --- a/src/bin/hamcore/DriverPackages/Neo6_Win10/x86/Neo6_x86_VPN60.inf +++ b/src/bin/hamcore/DriverPackages/Neo6_Win10/x86/Neo6_x86_VPN60.inf @@ -1,114 +1,114 @@ -; VPN Client Device Driver for Windows 2000 and Greater -; -; Copyright (c) SoftEther Corporation. All Rights Reserved. -; http://www.softether.co.jp/ -; -; BUILD 9658 - -[Version] -Signature = "$Windows NT$" -Class = Net -ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} -Provider = %CompanyName% -DriverVer = 02/04/2018, 4.25.0.9658 -CatalogFile.NT = Neo6_x86_VPN60.cat - -[Manufacturer] -%CompanyName% = SoftEther - -[SourceDisksNames] -1=%DiskDescription%, "", , - -[SourceDisksFiles] -Neo6_x86_VPN60.sys = 1 - -[DestinationDirs] -DefaultDestDir = 12 -Neo.CopyFiles.Sys = 12 - -[Neo.CopyFiles.Sys] -Neo6_x86_VPN60.sys, , , 2 - -[SoftEther] -%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN60 - -[NeoAdapter.Install] -Characteristics = 0x1 -AddReg = Neo.Reg, NeoAdapter.Ndi -CopyFiles = Neo.CopyFiles.Sys -*IfType = 53 -*MediaType = 0 -*PhysicalMediaType = 0 - -[NeoAdapter.Install.Services] -AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% - -[NeoAdapter.Ndi] -HKR, , NetworkAddress, 0, %DefaultAddress% -HKR, Ndi, DeviceID, , "NeoAdapter_VPN60" -HKR, , DevLoader, , ndis -HKR, , DeviceVxDs, , Neo6_x86_VPN60.sys -HKR, NDIS, LogDriverName, , "Neo_VPN60" -HKR, NDIS, MajorNdisVersion, 1, 5 -HKR, NDIS, MinorNdisVersion, 1, 0 -HKR, Ndi\Interfaces, DefUpper, , "ndis5" -HKR, Ndi\Interfaces, UpperRange, , "ndis5" -HKR, Ndi\Interfaces, LowerRange, , "ethernet" -HKR, Ndi\Interfaces, DefLower, , "ethernet" -HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" -HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% -HKR, Ndi\Params\NetworkAddress, type, 0, "edit" -HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" -HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" -HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% -HKR, Ndi\Params\NetworkAddress, optional, 0, "0" -HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% -HKR, Ndi\Params\MaxSpeed, type, 0, "int" -HKR, Ndi\Params\MaxSpeed, default, 0, "100" -HKR, Ndi\Params\MaxSpeed, min, 0, "0" -HKR, Ndi\Params\MaxSpeed, max, 0, "2000" -HKR, Ndi\Params\MaxSpeed, step, 0, "1" -HKR, Ndi\Params\MaxSpeed, Base, 0, "10" -HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% -HKR, Ndi\Params\KeepLink, type, 0, "enum" -HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% -HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% -HKR, Ndi\Params\KeepLink, default, 0, "0" - - -[Neo.Service] -DisplayName = %Neo.Service.DispName% -Description = %Neo.Service.Desc% -ServiceType = 1 -StartType = 3 -ErrorControl = 1 -ServiceBinary = %12%\Neo6_x86_VPN60.sys -LoadOrderGroup = NDIS - -[Neo.Reg] -HKR, Ndi, Service, 0, Neo.Service.Name -HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" -HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" - -[Neo.EventLog] -HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN60.sys" -HKR, , TypesSupported, 0x00010001, 7 - -[Strings] -CompanyName = "SoftEther Corporation" -DiskDescription = "VPN Client Device Driver Install Disk" -Neo.Service.Name = "Neo_VPN60" -Neo.Service.DispName = "VPN Client Device Driver - VPN60" -Neo.Service.Desc = "VPN Client Adapter - VPN60" -NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN60" -Neo.EventLog.Name = "Neo" -NetworkAddress = "MAC Address" -DefaultAddress = "000001000001" -MaxSpeed = "Indicate Speed (Mbps)" -KeepLink = "Keep Link" -On = "On" -Off = "Off" - - -; Auto Generated 20180205_163616.540 - +; VPN Client Device Driver for Windows 2000 and Greater +; +; Copyright (c) SoftEther Corporation. All Rights Reserved. +; http://www.softether.co.jp/ +; +; BUILD 9658 + +[Version] +Signature = "$Windows NT$" +Class = Net +ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} +Provider = %CompanyName% +DriverVer = 02/04/2018, 4.25.0.9658 +CatalogFile.NT = Neo6_x86_VPN60.cat + +[Manufacturer] +%CompanyName% = SoftEther + +[SourceDisksNames] +1=%DiskDescription%, "", , + +[SourceDisksFiles] +Neo6_x86_VPN60.sys = 1 + +[DestinationDirs] +DefaultDestDir = 12 +Neo.CopyFiles.Sys = 12 + +[Neo.CopyFiles.Sys] +Neo6_x86_VPN60.sys, , , 2 + +[SoftEther] +%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN60 + +[NeoAdapter.Install] +Characteristics = 0x1 +AddReg = Neo.Reg, NeoAdapter.Ndi +CopyFiles = Neo.CopyFiles.Sys +*IfType = 53 +*MediaType = 0 +*PhysicalMediaType = 0 + +[NeoAdapter.Install.Services] +AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% + +[NeoAdapter.Ndi] +HKR, , NetworkAddress, 0, %DefaultAddress% +HKR, Ndi, DeviceID, , "NeoAdapter_VPN60" +HKR, , DevLoader, , ndis +HKR, , DeviceVxDs, , Neo6_x86_VPN60.sys +HKR, NDIS, LogDriverName, , "Neo_VPN60" +HKR, NDIS, MajorNdisVersion, 1, 5 +HKR, NDIS, MinorNdisVersion, 1, 0 +HKR, Ndi\Interfaces, DefUpper, , "ndis5" +HKR, Ndi\Interfaces, UpperRange, , "ndis5" +HKR, Ndi\Interfaces, LowerRange, , "ethernet" +HKR, Ndi\Interfaces, DefLower, , "ethernet" +HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" +HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% +HKR, Ndi\Params\NetworkAddress, type, 0, "edit" +HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" +HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" +HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% +HKR, Ndi\Params\NetworkAddress, optional, 0, "0" +HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% +HKR, Ndi\Params\MaxSpeed, type, 0, "int" +HKR, Ndi\Params\MaxSpeed, default, 0, "100" +HKR, Ndi\Params\MaxSpeed, min, 0, "0" +HKR, Ndi\Params\MaxSpeed, max, 0, "2000" +HKR, Ndi\Params\MaxSpeed, step, 0, "1" +HKR, Ndi\Params\MaxSpeed, Base, 0, "10" +HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% +HKR, Ndi\Params\KeepLink, type, 0, "enum" +HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% +HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% +HKR, Ndi\Params\KeepLink, default, 0, "0" + + +[Neo.Service] +DisplayName = %Neo.Service.DispName% +Description = %Neo.Service.Desc% +ServiceType = 1 +StartType = 3 +ErrorControl = 1 +ServiceBinary = %12%\Neo6_x86_VPN60.sys +LoadOrderGroup = NDIS + +[Neo.Reg] +HKR, Ndi, Service, 0, Neo.Service.Name +HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" +HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" + +[Neo.EventLog] +HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN60.sys" +HKR, , TypesSupported, 0x00010001, 7 + +[Strings] +CompanyName = "SoftEther Corporation" +DiskDescription = "VPN Client Device Driver Install Disk" +Neo.Service.Name = "Neo_VPN60" +Neo.Service.DispName = "VPN Client Device Driver - VPN60" +Neo.Service.Desc = "VPN Client Adapter - VPN60" +NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN60" +Neo.EventLog.Name = "Neo" +NetworkAddress = "MAC Address" +DefaultAddress = "000001000001" +MaxSpeed = "Indicate Speed (Mbps)" +KeepLink = "Keep Link" +On = "On" +Off = "Off" + + +; Auto Generated 20180205_163616.540 + diff --git a/src/bin/hamcore/DriverPackages/Neo6_Win10/x86/Neo6_x86_VPN61.inf b/src/bin/hamcore/DriverPackages/Neo6_Win10/x86/Neo6_x86_VPN61.inf index 28d2b664..6fb54296 100644 --- a/src/bin/hamcore/DriverPackages/Neo6_Win10/x86/Neo6_x86_VPN61.inf +++ b/src/bin/hamcore/DriverPackages/Neo6_Win10/x86/Neo6_x86_VPN61.inf @@ -1,114 +1,114 @@ -; VPN Client Device Driver for Windows 2000 and Greater -; -; Copyright (c) SoftEther Corporation. All Rights Reserved. -; http://www.softether.co.jp/ -; -; BUILD 9658 - -[Version] -Signature = "$Windows NT$" -Class = Net -ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} -Provider = %CompanyName% -DriverVer = 02/04/2018, 4.25.0.9658 -CatalogFile.NT = Neo6_x86_VPN61.cat - -[Manufacturer] -%CompanyName% = SoftEther - -[SourceDisksNames] -1=%DiskDescription%, "", , - -[SourceDisksFiles] -Neo6_x86_VPN61.sys = 1 - -[DestinationDirs] -DefaultDestDir = 12 -Neo.CopyFiles.Sys = 12 - -[Neo.CopyFiles.Sys] -Neo6_x86_VPN61.sys, , , 2 - -[SoftEther] -%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN61 - -[NeoAdapter.Install] -Characteristics = 0x1 -AddReg = Neo.Reg, NeoAdapter.Ndi -CopyFiles = Neo.CopyFiles.Sys -*IfType = 53 -*MediaType = 0 -*PhysicalMediaType = 0 - -[NeoAdapter.Install.Services] -AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% - -[NeoAdapter.Ndi] -HKR, , NetworkAddress, 0, %DefaultAddress% -HKR, Ndi, DeviceID, , "NeoAdapter_VPN61" -HKR, , DevLoader, , ndis -HKR, , DeviceVxDs, , Neo6_x86_VPN61.sys -HKR, NDIS, LogDriverName, , "Neo_VPN61" -HKR, NDIS, MajorNdisVersion, 1, 5 -HKR, NDIS, MinorNdisVersion, 1, 0 -HKR, Ndi\Interfaces, DefUpper, , "ndis5" -HKR, Ndi\Interfaces, UpperRange, , "ndis5" -HKR, Ndi\Interfaces, LowerRange, , "ethernet" -HKR, Ndi\Interfaces, DefLower, , "ethernet" -HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" -HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% -HKR, Ndi\Params\NetworkAddress, type, 0, "edit" -HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" -HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" -HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% -HKR, Ndi\Params\NetworkAddress, optional, 0, "0" -HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% -HKR, Ndi\Params\MaxSpeed, type, 0, "int" -HKR, Ndi\Params\MaxSpeed, default, 0, "100" -HKR, Ndi\Params\MaxSpeed, min, 0, "0" -HKR, Ndi\Params\MaxSpeed, max, 0, "2000" -HKR, Ndi\Params\MaxSpeed, step, 0, "1" -HKR, Ndi\Params\MaxSpeed, Base, 0, "10" -HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% -HKR, Ndi\Params\KeepLink, type, 0, "enum" -HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% -HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% -HKR, Ndi\Params\KeepLink, default, 0, "0" - - -[Neo.Service] -DisplayName = %Neo.Service.DispName% -Description = %Neo.Service.Desc% -ServiceType = 1 -StartType = 3 -ErrorControl = 1 -ServiceBinary = %12%\Neo6_x86_VPN61.sys -LoadOrderGroup = NDIS - -[Neo.Reg] -HKR, Ndi, Service, 0, Neo.Service.Name -HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" -HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" - -[Neo.EventLog] -HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN61.sys" -HKR, , TypesSupported, 0x00010001, 7 - -[Strings] -CompanyName = "SoftEther Corporation" -DiskDescription = "VPN Client Device Driver Install Disk" -Neo.Service.Name = "Neo_VPN61" -Neo.Service.DispName = "VPN Client Device Driver - VPN61" -Neo.Service.Desc = "VPN Client Adapter - VPN61" -NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN61" -Neo.EventLog.Name = "Neo" -NetworkAddress = "MAC Address" -DefaultAddress = "000001000001" -MaxSpeed = "Indicate Speed (Mbps)" -KeepLink = "Keep Link" -On = "On" -Off = "Off" - - -; Auto Generated 20180205_163616.611 - +; VPN Client Device Driver for Windows 2000 and Greater +; +; Copyright (c) SoftEther Corporation. All Rights Reserved. +; http://www.softether.co.jp/ +; +; BUILD 9658 + +[Version] +Signature = "$Windows NT$" +Class = Net +ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} +Provider = %CompanyName% +DriverVer = 02/04/2018, 4.25.0.9658 +CatalogFile.NT = Neo6_x86_VPN61.cat + +[Manufacturer] +%CompanyName% = SoftEther + +[SourceDisksNames] +1=%DiskDescription%, "", , + +[SourceDisksFiles] +Neo6_x86_VPN61.sys = 1 + +[DestinationDirs] +DefaultDestDir = 12 +Neo.CopyFiles.Sys = 12 + +[Neo.CopyFiles.Sys] +Neo6_x86_VPN61.sys, , , 2 + +[SoftEther] +%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN61 + +[NeoAdapter.Install] +Characteristics = 0x1 +AddReg = Neo.Reg, NeoAdapter.Ndi +CopyFiles = Neo.CopyFiles.Sys +*IfType = 53 +*MediaType = 0 +*PhysicalMediaType = 0 + +[NeoAdapter.Install.Services] +AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% + +[NeoAdapter.Ndi] +HKR, , NetworkAddress, 0, %DefaultAddress% +HKR, Ndi, DeviceID, , "NeoAdapter_VPN61" +HKR, , DevLoader, , ndis +HKR, , DeviceVxDs, , Neo6_x86_VPN61.sys +HKR, NDIS, LogDriverName, , "Neo_VPN61" +HKR, NDIS, MajorNdisVersion, 1, 5 +HKR, NDIS, MinorNdisVersion, 1, 0 +HKR, Ndi\Interfaces, DefUpper, , "ndis5" +HKR, Ndi\Interfaces, UpperRange, , "ndis5" +HKR, Ndi\Interfaces, LowerRange, , "ethernet" +HKR, Ndi\Interfaces, DefLower, , "ethernet" +HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" +HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% +HKR, Ndi\Params\NetworkAddress, type, 0, "edit" +HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" +HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" +HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% +HKR, Ndi\Params\NetworkAddress, optional, 0, "0" +HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% +HKR, Ndi\Params\MaxSpeed, type, 0, "int" +HKR, Ndi\Params\MaxSpeed, default, 0, "100" +HKR, Ndi\Params\MaxSpeed, min, 0, "0" +HKR, Ndi\Params\MaxSpeed, max, 0, "2000" +HKR, Ndi\Params\MaxSpeed, step, 0, "1" +HKR, Ndi\Params\MaxSpeed, Base, 0, "10" +HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% +HKR, Ndi\Params\KeepLink, type, 0, "enum" +HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% +HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% +HKR, Ndi\Params\KeepLink, default, 0, "0" + + +[Neo.Service] +DisplayName = %Neo.Service.DispName% +Description = %Neo.Service.Desc% +ServiceType = 1 +StartType = 3 +ErrorControl = 1 +ServiceBinary = %12%\Neo6_x86_VPN61.sys +LoadOrderGroup = NDIS + +[Neo.Reg] +HKR, Ndi, Service, 0, Neo.Service.Name +HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" +HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" + +[Neo.EventLog] +HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN61.sys" +HKR, , TypesSupported, 0x00010001, 7 + +[Strings] +CompanyName = "SoftEther Corporation" +DiskDescription = "VPN Client Device Driver Install Disk" +Neo.Service.Name = "Neo_VPN61" +Neo.Service.DispName = "VPN Client Device Driver - VPN61" +Neo.Service.Desc = "VPN Client Adapter - VPN61" +NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN61" +Neo.EventLog.Name = "Neo" +NetworkAddress = "MAC Address" +DefaultAddress = "000001000001" +MaxSpeed = "Indicate Speed (Mbps)" +KeepLink = "Keep Link" +On = "On" +Off = "Off" + + +; Auto Generated 20180205_163616.611 + diff --git a/src/bin/hamcore/DriverPackages/Neo6_Win10/x86/Neo6_x86_VPN62.inf b/src/bin/hamcore/DriverPackages/Neo6_Win10/x86/Neo6_x86_VPN62.inf index 5ae4b7bb..1563942c 100644 --- a/src/bin/hamcore/DriverPackages/Neo6_Win10/x86/Neo6_x86_VPN62.inf +++ b/src/bin/hamcore/DriverPackages/Neo6_Win10/x86/Neo6_x86_VPN62.inf @@ -1,114 +1,114 @@ -; VPN Client Device Driver for Windows 2000 and Greater -; -; Copyright (c) SoftEther Corporation. All Rights Reserved. -; http://www.softether.co.jp/ -; -; BUILD 9658 - -[Version] -Signature = "$Windows NT$" -Class = Net -ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} -Provider = %CompanyName% -DriverVer = 02/04/2018, 4.25.0.9658 -CatalogFile.NT = Neo6_x86_VPN62.cat - -[Manufacturer] -%CompanyName% = SoftEther - -[SourceDisksNames] -1=%DiskDescription%, "", , - -[SourceDisksFiles] -Neo6_x86_VPN62.sys = 1 - -[DestinationDirs] -DefaultDestDir = 12 -Neo.CopyFiles.Sys = 12 - -[Neo.CopyFiles.Sys] -Neo6_x86_VPN62.sys, , , 2 - -[SoftEther] -%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN62 - -[NeoAdapter.Install] -Characteristics = 0x1 -AddReg = Neo.Reg, NeoAdapter.Ndi -CopyFiles = Neo.CopyFiles.Sys -*IfType = 53 -*MediaType = 0 -*PhysicalMediaType = 0 - -[NeoAdapter.Install.Services] -AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% - -[NeoAdapter.Ndi] -HKR, , NetworkAddress, 0, %DefaultAddress% -HKR, Ndi, DeviceID, , "NeoAdapter_VPN62" -HKR, , DevLoader, , ndis -HKR, , DeviceVxDs, , Neo6_x86_VPN62.sys -HKR, NDIS, LogDriverName, , "Neo_VPN62" -HKR, NDIS, MajorNdisVersion, 1, 5 -HKR, NDIS, MinorNdisVersion, 1, 0 -HKR, Ndi\Interfaces, DefUpper, , "ndis5" -HKR, Ndi\Interfaces, UpperRange, , "ndis5" -HKR, Ndi\Interfaces, LowerRange, , "ethernet" -HKR, Ndi\Interfaces, DefLower, , "ethernet" -HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" -HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% -HKR, Ndi\Params\NetworkAddress, type, 0, "edit" -HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" -HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" -HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% -HKR, Ndi\Params\NetworkAddress, optional, 0, "0" -HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% -HKR, Ndi\Params\MaxSpeed, type, 0, "int" -HKR, Ndi\Params\MaxSpeed, default, 0, "100" -HKR, Ndi\Params\MaxSpeed, min, 0, "0" -HKR, Ndi\Params\MaxSpeed, max, 0, "2000" -HKR, Ndi\Params\MaxSpeed, step, 0, "1" -HKR, Ndi\Params\MaxSpeed, Base, 0, "10" -HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% -HKR, Ndi\Params\KeepLink, type, 0, "enum" -HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% -HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% -HKR, Ndi\Params\KeepLink, default, 0, "0" - - -[Neo.Service] -DisplayName = %Neo.Service.DispName% -Description = %Neo.Service.Desc% -ServiceType = 1 -StartType = 3 -ErrorControl = 1 -ServiceBinary = %12%\Neo6_x86_VPN62.sys -LoadOrderGroup = NDIS - -[Neo.Reg] -HKR, Ndi, Service, 0, Neo.Service.Name -HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" -HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" - -[Neo.EventLog] -HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN62.sys" -HKR, , TypesSupported, 0x00010001, 7 - -[Strings] -CompanyName = "SoftEther Corporation" -DiskDescription = "VPN Client Device Driver Install Disk" -Neo.Service.Name = "Neo_VPN62" -Neo.Service.DispName = "VPN Client Device Driver - VPN62" -Neo.Service.Desc = "VPN Client Adapter - VPN62" -NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN62" -Neo.EventLog.Name = "Neo" -NetworkAddress = "MAC Address" -DefaultAddress = "000001000001" -MaxSpeed = "Indicate Speed (Mbps)" -KeepLink = "Keep Link" -On = "On" -Off = "Off" - - -; Auto Generated 20180205_163616.681 - +; VPN Client Device Driver for Windows 2000 and Greater +; +; Copyright (c) SoftEther Corporation. All Rights Reserved. +; http://www.softether.co.jp/ +; +; BUILD 9658 + +[Version] +Signature = "$Windows NT$" +Class = Net +ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} +Provider = %CompanyName% +DriverVer = 02/04/2018, 4.25.0.9658 +CatalogFile.NT = Neo6_x86_VPN62.cat + +[Manufacturer] +%CompanyName% = SoftEther + +[SourceDisksNames] +1=%DiskDescription%, "", , + +[SourceDisksFiles] +Neo6_x86_VPN62.sys = 1 + +[DestinationDirs] +DefaultDestDir = 12 +Neo.CopyFiles.Sys = 12 + +[Neo.CopyFiles.Sys] +Neo6_x86_VPN62.sys, , , 2 + +[SoftEther] +%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN62 + +[NeoAdapter.Install] +Characteristics = 0x1 +AddReg = Neo.Reg, NeoAdapter.Ndi +CopyFiles = Neo.CopyFiles.Sys +*IfType = 53 +*MediaType = 0 +*PhysicalMediaType = 0 + +[NeoAdapter.Install.Services] +AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% + +[NeoAdapter.Ndi] +HKR, , NetworkAddress, 0, %DefaultAddress% +HKR, Ndi, DeviceID, , "NeoAdapter_VPN62" +HKR, , DevLoader, , ndis +HKR, , DeviceVxDs, , Neo6_x86_VPN62.sys +HKR, NDIS, LogDriverName, , "Neo_VPN62" +HKR, NDIS, MajorNdisVersion, 1, 5 +HKR, NDIS, MinorNdisVersion, 1, 0 +HKR, Ndi\Interfaces, DefUpper, , "ndis5" +HKR, Ndi\Interfaces, UpperRange, , "ndis5" +HKR, Ndi\Interfaces, LowerRange, , "ethernet" +HKR, Ndi\Interfaces, DefLower, , "ethernet" +HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" +HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% +HKR, Ndi\Params\NetworkAddress, type, 0, "edit" +HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" +HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" +HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% +HKR, Ndi\Params\NetworkAddress, optional, 0, "0" +HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% +HKR, Ndi\Params\MaxSpeed, type, 0, "int" +HKR, Ndi\Params\MaxSpeed, default, 0, "100" +HKR, Ndi\Params\MaxSpeed, min, 0, "0" +HKR, Ndi\Params\MaxSpeed, max, 0, "2000" +HKR, Ndi\Params\MaxSpeed, step, 0, "1" +HKR, Ndi\Params\MaxSpeed, Base, 0, "10" +HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% +HKR, Ndi\Params\KeepLink, type, 0, "enum" +HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% +HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% +HKR, Ndi\Params\KeepLink, default, 0, "0" + + +[Neo.Service] +DisplayName = %Neo.Service.DispName% +Description = %Neo.Service.Desc% +ServiceType = 1 +StartType = 3 +ErrorControl = 1 +ServiceBinary = %12%\Neo6_x86_VPN62.sys +LoadOrderGroup = NDIS + +[Neo.Reg] +HKR, Ndi, Service, 0, Neo.Service.Name +HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" +HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" + +[Neo.EventLog] +HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN62.sys" +HKR, , TypesSupported, 0x00010001, 7 + +[Strings] +CompanyName = "SoftEther Corporation" +DiskDescription = "VPN Client Device Driver Install Disk" +Neo.Service.Name = "Neo_VPN62" +Neo.Service.DispName = "VPN Client Device Driver - VPN62" +Neo.Service.Desc = "VPN Client Adapter - VPN62" +NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN62" +Neo.EventLog.Name = "Neo" +NetworkAddress = "MAC Address" +DefaultAddress = "000001000001" +MaxSpeed = "Indicate Speed (Mbps)" +KeepLink = "Keep Link" +On = "On" +Off = "Off" + + +; Auto Generated 20180205_163616.681 + diff --git a/src/bin/hamcore/DriverPackages/Neo6_Win10/x86/Neo6_x86_VPN63.inf b/src/bin/hamcore/DriverPackages/Neo6_Win10/x86/Neo6_x86_VPN63.inf index 5ac16d0a..1969d81d 100644 --- a/src/bin/hamcore/DriverPackages/Neo6_Win10/x86/Neo6_x86_VPN63.inf +++ b/src/bin/hamcore/DriverPackages/Neo6_Win10/x86/Neo6_x86_VPN63.inf @@ -1,114 +1,114 @@ -; VPN Client Device Driver for Windows 2000 and Greater -; -; Copyright (c) SoftEther Corporation. All Rights Reserved. -; http://www.softether.co.jp/ -; -; BUILD 9658 - -[Version] -Signature = "$Windows NT$" -Class = Net -ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} -Provider = %CompanyName% -DriverVer = 02/04/2018, 4.25.0.9658 -CatalogFile.NT = Neo6_x86_VPN63.cat - -[Manufacturer] -%CompanyName% = SoftEther - -[SourceDisksNames] -1=%DiskDescription%, "", , - -[SourceDisksFiles] -Neo6_x86_VPN63.sys = 1 - -[DestinationDirs] -DefaultDestDir = 12 -Neo.CopyFiles.Sys = 12 - -[Neo.CopyFiles.Sys] -Neo6_x86_VPN63.sys, , , 2 - -[SoftEther] -%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN63 - -[NeoAdapter.Install] -Characteristics = 0x1 -AddReg = Neo.Reg, NeoAdapter.Ndi -CopyFiles = Neo.CopyFiles.Sys -*IfType = 53 -*MediaType = 0 -*PhysicalMediaType = 0 - -[NeoAdapter.Install.Services] -AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% - -[NeoAdapter.Ndi] -HKR, , NetworkAddress, 0, %DefaultAddress% -HKR, Ndi, DeviceID, , "NeoAdapter_VPN63" -HKR, , DevLoader, , ndis -HKR, , DeviceVxDs, , Neo6_x86_VPN63.sys -HKR, NDIS, LogDriverName, , "Neo_VPN63" -HKR, NDIS, MajorNdisVersion, 1, 5 -HKR, NDIS, MinorNdisVersion, 1, 0 -HKR, Ndi\Interfaces, DefUpper, , "ndis5" -HKR, Ndi\Interfaces, UpperRange, , "ndis5" -HKR, Ndi\Interfaces, LowerRange, , "ethernet" -HKR, Ndi\Interfaces, DefLower, , "ethernet" -HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" -HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% -HKR, Ndi\Params\NetworkAddress, type, 0, "edit" -HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" -HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" -HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% -HKR, Ndi\Params\NetworkAddress, optional, 0, "0" -HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% -HKR, Ndi\Params\MaxSpeed, type, 0, "int" -HKR, Ndi\Params\MaxSpeed, default, 0, "100" -HKR, Ndi\Params\MaxSpeed, min, 0, "0" -HKR, Ndi\Params\MaxSpeed, max, 0, "2000" -HKR, Ndi\Params\MaxSpeed, step, 0, "1" -HKR, Ndi\Params\MaxSpeed, Base, 0, "10" -HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% -HKR, Ndi\Params\KeepLink, type, 0, "enum" -HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% -HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% -HKR, Ndi\Params\KeepLink, default, 0, "0" - - -[Neo.Service] -DisplayName = %Neo.Service.DispName% -Description = %Neo.Service.Desc% -ServiceType = 1 -StartType = 3 -ErrorControl = 1 -ServiceBinary = %12%\Neo6_x86_VPN63.sys -LoadOrderGroup = NDIS - -[Neo.Reg] -HKR, Ndi, Service, 0, Neo.Service.Name -HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" -HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" - -[Neo.EventLog] -HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN63.sys" -HKR, , TypesSupported, 0x00010001, 7 - -[Strings] -CompanyName = "SoftEther Corporation" -DiskDescription = "VPN Client Device Driver Install Disk" -Neo.Service.Name = "Neo_VPN63" -Neo.Service.DispName = "VPN Client Device Driver - VPN63" -Neo.Service.Desc = "VPN Client Adapter - VPN63" -NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN63" -Neo.EventLog.Name = "Neo" -NetworkAddress = "MAC Address" -DefaultAddress = "000001000001" -MaxSpeed = "Indicate Speed (Mbps)" -KeepLink = "Keep Link" -On = "On" -Off = "Off" - - -; Auto Generated 20180205_163616.752 - +; VPN Client Device Driver for Windows 2000 and Greater +; +; Copyright (c) SoftEther Corporation. All Rights Reserved. +; http://www.softether.co.jp/ +; +; BUILD 9658 + +[Version] +Signature = "$Windows NT$" +Class = Net +ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} +Provider = %CompanyName% +DriverVer = 02/04/2018, 4.25.0.9658 +CatalogFile.NT = Neo6_x86_VPN63.cat + +[Manufacturer] +%CompanyName% = SoftEther + +[SourceDisksNames] +1=%DiskDescription%, "", , + +[SourceDisksFiles] +Neo6_x86_VPN63.sys = 1 + +[DestinationDirs] +DefaultDestDir = 12 +Neo.CopyFiles.Sys = 12 + +[Neo.CopyFiles.Sys] +Neo6_x86_VPN63.sys, , , 2 + +[SoftEther] +%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN63 + +[NeoAdapter.Install] +Characteristics = 0x1 +AddReg = Neo.Reg, NeoAdapter.Ndi +CopyFiles = Neo.CopyFiles.Sys +*IfType = 53 +*MediaType = 0 +*PhysicalMediaType = 0 + +[NeoAdapter.Install.Services] +AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% + +[NeoAdapter.Ndi] +HKR, , NetworkAddress, 0, %DefaultAddress% +HKR, Ndi, DeviceID, , "NeoAdapter_VPN63" +HKR, , DevLoader, , ndis +HKR, , DeviceVxDs, , Neo6_x86_VPN63.sys +HKR, NDIS, LogDriverName, , "Neo_VPN63" +HKR, NDIS, MajorNdisVersion, 1, 5 +HKR, NDIS, MinorNdisVersion, 1, 0 +HKR, Ndi\Interfaces, DefUpper, , "ndis5" +HKR, Ndi\Interfaces, UpperRange, , "ndis5" +HKR, Ndi\Interfaces, LowerRange, , "ethernet" +HKR, Ndi\Interfaces, DefLower, , "ethernet" +HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" +HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% +HKR, Ndi\Params\NetworkAddress, type, 0, "edit" +HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" +HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" +HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% +HKR, Ndi\Params\NetworkAddress, optional, 0, "0" +HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% +HKR, Ndi\Params\MaxSpeed, type, 0, "int" +HKR, Ndi\Params\MaxSpeed, default, 0, "100" +HKR, Ndi\Params\MaxSpeed, min, 0, "0" +HKR, Ndi\Params\MaxSpeed, max, 0, "2000" +HKR, Ndi\Params\MaxSpeed, step, 0, "1" +HKR, Ndi\Params\MaxSpeed, Base, 0, "10" +HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% +HKR, Ndi\Params\KeepLink, type, 0, "enum" +HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% +HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% +HKR, Ndi\Params\KeepLink, default, 0, "0" + + +[Neo.Service] +DisplayName = %Neo.Service.DispName% +Description = %Neo.Service.Desc% +ServiceType = 1 +StartType = 3 +ErrorControl = 1 +ServiceBinary = %12%\Neo6_x86_VPN63.sys +LoadOrderGroup = NDIS + +[Neo.Reg] +HKR, Ndi, Service, 0, Neo.Service.Name +HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" +HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" + +[Neo.EventLog] +HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN63.sys" +HKR, , TypesSupported, 0x00010001, 7 + +[Strings] +CompanyName = "SoftEther Corporation" +DiskDescription = "VPN Client Device Driver Install Disk" +Neo.Service.Name = "Neo_VPN63" +Neo.Service.DispName = "VPN Client Device Driver - VPN63" +Neo.Service.Desc = "VPN Client Adapter - VPN63" +NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN63" +Neo.EventLog.Name = "Neo" +NetworkAddress = "MAC Address" +DefaultAddress = "000001000001" +MaxSpeed = "Indicate Speed (Mbps)" +KeepLink = "Keep Link" +On = "On" +Off = "Off" + + +; Auto Generated 20180205_163616.752 + diff --git a/src/bin/hamcore/DriverPackages/Neo6_Win10/x86/Neo6_x86_VPN64.inf b/src/bin/hamcore/DriverPackages/Neo6_Win10/x86/Neo6_x86_VPN64.inf index 45bd4081..e60da488 100644 --- a/src/bin/hamcore/DriverPackages/Neo6_Win10/x86/Neo6_x86_VPN64.inf +++ b/src/bin/hamcore/DriverPackages/Neo6_Win10/x86/Neo6_x86_VPN64.inf @@ -1,114 +1,114 @@ -; VPN Client Device Driver for Windows 2000 and Greater -; -; Copyright (c) SoftEther Corporation. All Rights Reserved. -; http://www.softether.co.jp/ -; -; BUILD 9658 - -[Version] -Signature = "$Windows NT$" -Class = Net -ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} -Provider = %CompanyName% -DriverVer = 02/04/2018, 4.25.0.9658 -CatalogFile.NT = Neo6_x86_VPN64.cat - -[Manufacturer] -%CompanyName% = SoftEther - -[SourceDisksNames] -1=%DiskDescription%, "", , - -[SourceDisksFiles] -Neo6_x86_VPN64.sys = 1 - -[DestinationDirs] -DefaultDestDir = 12 -Neo.CopyFiles.Sys = 12 - -[Neo.CopyFiles.Sys] -Neo6_x86_VPN64.sys, , , 2 - -[SoftEther] -%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN64 - -[NeoAdapter.Install] -Characteristics = 0x1 -AddReg = Neo.Reg, NeoAdapter.Ndi -CopyFiles = Neo.CopyFiles.Sys -*IfType = 53 -*MediaType = 0 -*PhysicalMediaType = 0 - -[NeoAdapter.Install.Services] -AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% - -[NeoAdapter.Ndi] -HKR, , NetworkAddress, 0, %DefaultAddress% -HKR, Ndi, DeviceID, , "NeoAdapter_VPN64" -HKR, , DevLoader, , ndis -HKR, , DeviceVxDs, , Neo6_x86_VPN64.sys -HKR, NDIS, LogDriverName, , "Neo_VPN64" -HKR, NDIS, MajorNdisVersion, 1, 5 -HKR, NDIS, MinorNdisVersion, 1, 0 -HKR, Ndi\Interfaces, DefUpper, , "ndis5" -HKR, Ndi\Interfaces, UpperRange, , "ndis5" -HKR, Ndi\Interfaces, LowerRange, , "ethernet" -HKR, Ndi\Interfaces, DefLower, , "ethernet" -HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" -HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% -HKR, Ndi\Params\NetworkAddress, type, 0, "edit" -HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" -HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" -HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% -HKR, Ndi\Params\NetworkAddress, optional, 0, "0" -HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% -HKR, Ndi\Params\MaxSpeed, type, 0, "int" -HKR, Ndi\Params\MaxSpeed, default, 0, "100" -HKR, Ndi\Params\MaxSpeed, min, 0, "0" -HKR, Ndi\Params\MaxSpeed, max, 0, "2000" -HKR, Ndi\Params\MaxSpeed, step, 0, "1" -HKR, Ndi\Params\MaxSpeed, Base, 0, "10" -HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% -HKR, Ndi\Params\KeepLink, type, 0, "enum" -HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% -HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% -HKR, Ndi\Params\KeepLink, default, 0, "0" - - -[Neo.Service] -DisplayName = %Neo.Service.DispName% -Description = %Neo.Service.Desc% -ServiceType = 1 -StartType = 3 -ErrorControl = 1 -ServiceBinary = %12%\Neo6_x86_VPN64.sys -LoadOrderGroup = NDIS - -[Neo.Reg] -HKR, Ndi, Service, 0, Neo.Service.Name -HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" -HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" - -[Neo.EventLog] -HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN64.sys" -HKR, , TypesSupported, 0x00010001, 7 - -[Strings] -CompanyName = "SoftEther Corporation" -DiskDescription = "VPN Client Device Driver Install Disk" -Neo.Service.Name = "Neo_VPN64" -Neo.Service.DispName = "VPN Client Device Driver - VPN64" -Neo.Service.Desc = "VPN Client Adapter - VPN64" -NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN64" -Neo.EventLog.Name = "Neo" -NetworkAddress = "MAC Address" -DefaultAddress = "000001000001" -MaxSpeed = "Indicate Speed (Mbps)" -KeepLink = "Keep Link" -On = "On" -Off = "Off" - - -; Auto Generated 20180205_163616.822 - +; VPN Client Device Driver for Windows 2000 and Greater +; +; Copyright (c) SoftEther Corporation. All Rights Reserved. +; http://www.softether.co.jp/ +; +; BUILD 9658 + +[Version] +Signature = "$Windows NT$" +Class = Net +ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} +Provider = %CompanyName% +DriverVer = 02/04/2018, 4.25.0.9658 +CatalogFile.NT = Neo6_x86_VPN64.cat + +[Manufacturer] +%CompanyName% = SoftEther + +[SourceDisksNames] +1=%DiskDescription%, "", , + +[SourceDisksFiles] +Neo6_x86_VPN64.sys = 1 + +[DestinationDirs] +DefaultDestDir = 12 +Neo.CopyFiles.Sys = 12 + +[Neo.CopyFiles.Sys] +Neo6_x86_VPN64.sys, , , 2 + +[SoftEther] +%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN64 + +[NeoAdapter.Install] +Characteristics = 0x1 +AddReg = Neo.Reg, NeoAdapter.Ndi +CopyFiles = Neo.CopyFiles.Sys +*IfType = 53 +*MediaType = 0 +*PhysicalMediaType = 0 + +[NeoAdapter.Install.Services] +AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% + +[NeoAdapter.Ndi] +HKR, , NetworkAddress, 0, %DefaultAddress% +HKR, Ndi, DeviceID, , "NeoAdapter_VPN64" +HKR, , DevLoader, , ndis +HKR, , DeviceVxDs, , Neo6_x86_VPN64.sys +HKR, NDIS, LogDriverName, , "Neo_VPN64" +HKR, NDIS, MajorNdisVersion, 1, 5 +HKR, NDIS, MinorNdisVersion, 1, 0 +HKR, Ndi\Interfaces, DefUpper, , "ndis5" +HKR, Ndi\Interfaces, UpperRange, , "ndis5" +HKR, Ndi\Interfaces, LowerRange, , "ethernet" +HKR, Ndi\Interfaces, DefLower, , "ethernet" +HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" +HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% +HKR, Ndi\Params\NetworkAddress, type, 0, "edit" +HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" +HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" +HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% +HKR, Ndi\Params\NetworkAddress, optional, 0, "0" +HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% +HKR, Ndi\Params\MaxSpeed, type, 0, "int" +HKR, Ndi\Params\MaxSpeed, default, 0, "100" +HKR, Ndi\Params\MaxSpeed, min, 0, "0" +HKR, Ndi\Params\MaxSpeed, max, 0, "2000" +HKR, Ndi\Params\MaxSpeed, step, 0, "1" +HKR, Ndi\Params\MaxSpeed, Base, 0, "10" +HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% +HKR, Ndi\Params\KeepLink, type, 0, "enum" +HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% +HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% +HKR, Ndi\Params\KeepLink, default, 0, "0" + + +[Neo.Service] +DisplayName = %Neo.Service.DispName% +Description = %Neo.Service.Desc% +ServiceType = 1 +StartType = 3 +ErrorControl = 1 +ServiceBinary = %12%\Neo6_x86_VPN64.sys +LoadOrderGroup = NDIS + +[Neo.Reg] +HKR, Ndi, Service, 0, Neo.Service.Name +HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" +HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" + +[Neo.EventLog] +HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN64.sys" +HKR, , TypesSupported, 0x00010001, 7 + +[Strings] +CompanyName = "SoftEther Corporation" +DiskDescription = "VPN Client Device Driver Install Disk" +Neo.Service.Name = "Neo_VPN64" +Neo.Service.DispName = "VPN Client Device Driver - VPN64" +Neo.Service.Desc = "VPN Client Adapter - VPN64" +NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN64" +Neo.EventLog.Name = "Neo" +NetworkAddress = "MAC Address" +DefaultAddress = "000001000001" +MaxSpeed = "Indicate Speed (Mbps)" +KeepLink = "Keep Link" +On = "On" +Off = "Off" + + +; Auto Generated 20180205_163616.822 + diff --git a/src/bin/hamcore/DriverPackages/Neo6_Win10/x86/Neo6_x86_VPN65.inf b/src/bin/hamcore/DriverPackages/Neo6_Win10/x86/Neo6_x86_VPN65.inf index bc64cdf2..bd445be6 100644 --- a/src/bin/hamcore/DriverPackages/Neo6_Win10/x86/Neo6_x86_VPN65.inf +++ b/src/bin/hamcore/DriverPackages/Neo6_Win10/x86/Neo6_x86_VPN65.inf @@ -1,114 +1,114 @@ -; VPN Client Device Driver for Windows 2000 and Greater -; -; Copyright (c) SoftEther Corporation. All Rights Reserved. -; http://www.softether.co.jp/ -; -; BUILD 9658 - -[Version] -Signature = "$Windows NT$" -Class = Net -ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} -Provider = %CompanyName% -DriverVer = 02/04/2018, 4.25.0.9658 -CatalogFile.NT = Neo6_x86_VPN65.cat - -[Manufacturer] -%CompanyName% = SoftEther - -[SourceDisksNames] -1=%DiskDescription%, "", , - -[SourceDisksFiles] -Neo6_x86_VPN65.sys = 1 - -[DestinationDirs] -DefaultDestDir = 12 -Neo.CopyFiles.Sys = 12 - -[Neo.CopyFiles.Sys] -Neo6_x86_VPN65.sys, , , 2 - -[SoftEther] -%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN65 - -[NeoAdapter.Install] -Characteristics = 0x1 -AddReg = Neo.Reg, NeoAdapter.Ndi -CopyFiles = Neo.CopyFiles.Sys -*IfType = 53 -*MediaType = 0 -*PhysicalMediaType = 0 - -[NeoAdapter.Install.Services] -AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% - -[NeoAdapter.Ndi] -HKR, , NetworkAddress, 0, %DefaultAddress% -HKR, Ndi, DeviceID, , "NeoAdapter_VPN65" -HKR, , DevLoader, , ndis -HKR, , DeviceVxDs, , Neo6_x86_VPN65.sys -HKR, NDIS, LogDriverName, , "Neo_VPN65" -HKR, NDIS, MajorNdisVersion, 1, 5 -HKR, NDIS, MinorNdisVersion, 1, 0 -HKR, Ndi\Interfaces, DefUpper, , "ndis5" -HKR, Ndi\Interfaces, UpperRange, , "ndis5" -HKR, Ndi\Interfaces, LowerRange, , "ethernet" -HKR, Ndi\Interfaces, DefLower, , "ethernet" -HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" -HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% -HKR, Ndi\Params\NetworkAddress, type, 0, "edit" -HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" -HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" -HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% -HKR, Ndi\Params\NetworkAddress, optional, 0, "0" -HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% -HKR, Ndi\Params\MaxSpeed, type, 0, "int" -HKR, Ndi\Params\MaxSpeed, default, 0, "100" -HKR, Ndi\Params\MaxSpeed, min, 0, "0" -HKR, Ndi\Params\MaxSpeed, max, 0, "2000" -HKR, Ndi\Params\MaxSpeed, step, 0, "1" -HKR, Ndi\Params\MaxSpeed, Base, 0, "10" -HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% -HKR, Ndi\Params\KeepLink, type, 0, "enum" -HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% -HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% -HKR, Ndi\Params\KeepLink, default, 0, "0" - - -[Neo.Service] -DisplayName = %Neo.Service.DispName% -Description = %Neo.Service.Desc% -ServiceType = 1 -StartType = 3 -ErrorControl = 1 -ServiceBinary = %12%\Neo6_x86_VPN65.sys -LoadOrderGroup = NDIS - -[Neo.Reg] -HKR, Ndi, Service, 0, Neo.Service.Name -HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" -HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" - -[Neo.EventLog] -HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN65.sys" -HKR, , TypesSupported, 0x00010001, 7 - -[Strings] -CompanyName = "SoftEther Corporation" -DiskDescription = "VPN Client Device Driver Install Disk" -Neo.Service.Name = "Neo_VPN65" -Neo.Service.DispName = "VPN Client Device Driver - VPN65" -Neo.Service.Desc = "VPN Client Adapter - VPN65" -NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN65" -Neo.EventLog.Name = "Neo" -NetworkAddress = "MAC Address" -DefaultAddress = "000001000001" -MaxSpeed = "Indicate Speed (Mbps)" -KeepLink = "Keep Link" -On = "On" -Off = "Off" - - -; Auto Generated 20180205_163616.893 - +; VPN Client Device Driver for Windows 2000 and Greater +; +; Copyright (c) SoftEther Corporation. All Rights Reserved. +; http://www.softether.co.jp/ +; +; BUILD 9658 + +[Version] +Signature = "$Windows NT$" +Class = Net +ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} +Provider = %CompanyName% +DriverVer = 02/04/2018, 4.25.0.9658 +CatalogFile.NT = Neo6_x86_VPN65.cat + +[Manufacturer] +%CompanyName% = SoftEther + +[SourceDisksNames] +1=%DiskDescription%, "", , + +[SourceDisksFiles] +Neo6_x86_VPN65.sys = 1 + +[DestinationDirs] +DefaultDestDir = 12 +Neo.CopyFiles.Sys = 12 + +[Neo.CopyFiles.Sys] +Neo6_x86_VPN65.sys, , , 2 + +[SoftEther] +%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN65 + +[NeoAdapter.Install] +Characteristics = 0x1 +AddReg = Neo.Reg, NeoAdapter.Ndi +CopyFiles = Neo.CopyFiles.Sys +*IfType = 53 +*MediaType = 0 +*PhysicalMediaType = 0 + +[NeoAdapter.Install.Services] +AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% + +[NeoAdapter.Ndi] +HKR, , NetworkAddress, 0, %DefaultAddress% +HKR, Ndi, DeviceID, , "NeoAdapter_VPN65" +HKR, , DevLoader, , ndis +HKR, , DeviceVxDs, , Neo6_x86_VPN65.sys +HKR, NDIS, LogDriverName, , "Neo_VPN65" +HKR, NDIS, MajorNdisVersion, 1, 5 +HKR, NDIS, MinorNdisVersion, 1, 0 +HKR, Ndi\Interfaces, DefUpper, , "ndis5" +HKR, Ndi\Interfaces, UpperRange, , "ndis5" +HKR, Ndi\Interfaces, LowerRange, , "ethernet" +HKR, Ndi\Interfaces, DefLower, , "ethernet" +HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" +HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% +HKR, Ndi\Params\NetworkAddress, type, 0, "edit" +HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" +HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" +HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% +HKR, Ndi\Params\NetworkAddress, optional, 0, "0" +HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% +HKR, Ndi\Params\MaxSpeed, type, 0, "int" +HKR, Ndi\Params\MaxSpeed, default, 0, "100" +HKR, Ndi\Params\MaxSpeed, min, 0, "0" +HKR, Ndi\Params\MaxSpeed, max, 0, "2000" +HKR, Ndi\Params\MaxSpeed, step, 0, "1" +HKR, Ndi\Params\MaxSpeed, Base, 0, "10" +HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% +HKR, Ndi\Params\KeepLink, type, 0, "enum" +HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% +HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% +HKR, Ndi\Params\KeepLink, default, 0, "0" + + +[Neo.Service] +DisplayName = %Neo.Service.DispName% +Description = %Neo.Service.Desc% +ServiceType = 1 +StartType = 3 +ErrorControl = 1 +ServiceBinary = %12%\Neo6_x86_VPN65.sys +LoadOrderGroup = NDIS + +[Neo.Reg] +HKR, Ndi, Service, 0, Neo.Service.Name +HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" +HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" + +[Neo.EventLog] +HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN65.sys" +HKR, , TypesSupported, 0x00010001, 7 + +[Strings] +CompanyName = "SoftEther Corporation" +DiskDescription = "VPN Client Device Driver Install Disk" +Neo.Service.Name = "Neo_VPN65" +Neo.Service.DispName = "VPN Client Device Driver - VPN65" +Neo.Service.Desc = "VPN Client Adapter - VPN65" +NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN65" +Neo.EventLog.Name = "Neo" +NetworkAddress = "MAC Address" +DefaultAddress = "000001000001" +MaxSpeed = "Indicate Speed (Mbps)" +KeepLink = "Keep Link" +On = "On" +Off = "Off" + + +; Auto Generated 20180205_163616.893 + diff --git a/src/bin/hamcore/DriverPackages/Neo6_Win10/x86/Neo6_x86_VPN66.inf b/src/bin/hamcore/DriverPackages/Neo6_Win10/x86/Neo6_x86_VPN66.inf index edc5dade..fdc3feb3 100644 --- a/src/bin/hamcore/DriverPackages/Neo6_Win10/x86/Neo6_x86_VPN66.inf +++ b/src/bin/hamcore/DriverPackages/Neo6_Win10/x86/Neo6_x86_VPN66.inf @@ -1,114 +1,114 @@ -; VPN Client Device Driver for Windows 2000 and Greater -; -; Copyright (c) SoftEther Corporation. All Rights Reserved. -; http://www.softether.co.jp/ -; -; BUILD 9658 - -[Version] -Signature = "$Windows NT$" -Class = Net -ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} -Provider = %CompanyName% -DriverVer = 02/04/2018, 4.25.0.9658 -CatalogFile.NT = Neo6_x86_VPN66.cat - -[Manufacturer] -%CompanyName% = SoftEther - -[SourceDisksNames] -1=%DiskDescription%, "", , - -[SourceDisksFiles] -Neo6_x86_VPN66.sys = 1 - -[DestinationDirs] -DefaultDestDir = 12 -Neo.CopyFiles.Sys = 12 - -[Neo.CopyFiles.Sys] -Neo6_x86_VPN66.sys, , , 2 - -[SoftEther] -%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN66 - -[NeoAdapter.Install] -Characteristics = 0x1 -AddReg = Neo.Reg, NeoAdapter.Ndi -CopyFiles = Neo.CopyFiles.Sys -*IfType = 53 -*MediaType = 0 -*PhysicalMediaType = 0 - -[NeoAdapter.Install.Services] -AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% - -[NeoAdapter.Ndi] -HKR, , NetworkAddress, 0, %DefaultAddress% -HKR, Ndi, DeviceID, , "NeoAdapter_VPN66" -HKR, , DevLoader, , ndis -HKR, , DeviceVxDs, , Neo6_x86_VPN66.sys -HKR, NDIS, LogDriverName, , "Neo_VPN66" -HKR, NDIS, MajorNdisVersion, 1, 5 -HKR, NDIS, MinorNdisVersion, 1, 0 -HKR, Ndi\Interfaces, DefUpper, , "ndis5" -HKR, Ndi\Interfaces, UpperRange, , "ndis5" -HKR, Ndi\Interfaces, LowerRange, , "ethernet" -HKR, Ndi\Interfaces, DefLower, , "ethernet" -HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" -HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% -HKR, Ndi\Params\NetworkAddress, type, 0, "edit" -HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" -HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" -HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% -HKR, Ndi\Params\NetworkAddress, optional, 0, "0" -HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% -HKR, Ndi\Params\MaxSpeed, type, 0, "int" -HKR, Ndi\Params\MaxSpeed, default, 0, "100" -HKR, Ndi\Params\MaxSpeed, min, 0, "0" -HKR, Ndi\Params\MaxSpeed, max, 0, "2000" -HKR, Ndi\Params\MaxSpeed, step, 0, "1" -HKR, Ndi\Params\MaxSpeed, Base, 0, "10" -HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% -HKR, Ndi\Params\KeepLink, type, 0, "enum" -HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% -HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% -HKR, Ndi\Params\KeepLink, default, 0, "0" - - -[Neo.Service] -DisplayName = %Neo.Service.DispName% -Description = %Neo.Service.Desc% -ServiceType = 1 -StartType = 3 -ErrorControl = 1 -ServiceBinary = %12%\Neo6_x86_VPN66.sys -LoadOrderGroup = NDIS - -[Neo.Reg] -HKR, Ndi, Service, 0, Neo.Service.Name -HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" -HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" - -[Neo.EventLog] -HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN66.sys" -HKR, , TypesSupported, 0x00010001, 7 - -[Strings] -CompanyName = "SoftEther Corporation" -DiskDescription = "VPN Client Device Driver Install Disk" -Neo.Service.Name = "Neo_VPN66" -Neo.Service.DispName = "VPN Client Device Driver - VPN66" -Neo.Service.Desc = "VPN Client Adapter - VPN66" -NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN66" -Neo.EventLog.Name = "Neo" -NetworkAddress = "MAC Address" -DefaultAddress = "000001000001" -MaxSpeed = "Indicate Speed (Mbps)" -KeepLink = "Keep Link" -On = "On" -Off = "Off" - - -; Auto Generated 20180205_163616.964 - +; VPN Client Device Driver for Windows 2000 and Greater +; +; Copyright (c) SoftEther Corporation. All Rights Reserved. +; http://www.softether.co.jp/ +; +; BUILD 9658 + +[Version] +Signature = "$Windows NT$" +Class = Net +ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} +Provider = %CompanyName% +DriverVer = 02/04/2018, 4.25.0.9658 +CatalogFile.NT = Neo6_x86_VPN66.cat + +[Manufacturer] +%CompanyName% = SoftEther + +[SourceDisksNames] +1=%DiskDescription%, "", , + +[SourceDisksFiles] +Neo6_x86_VPN66.sys = 1 + +[DestinationDirs] +DefaultDestDir = 12 +Neo.CopyFiles.Sys = 12 + +[Neo.CopyFiles.Sys] +Neo6_x86_VPN66.sys, , , 2 + +[SoftEther] +%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN66 + +[NeoAdapter.Install] +Characteristics = 0x1 +AddReg = Neo.Reg, NeoAdapter.Ndi +CopyFiles = Neo.CopyFiles.Sys +*IfType = 53 +*MediaType = 0 +*PhysicalMediaType = 0 + +[NeoAdapter.Install.Services] +AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% + +[NeoAdapter.Ndi] +HKR, , NetworkAddress, 0, %DefaultAddress% +HKR, Ndi, DeviceID, , "NeoAdapter_VPN66" +HKR, , DevLoader, , ndis +HKR, , DeviceVxDs, , Neo6_x86_VPN66.sys +HKR, NDIS, LogDriverName, , "Neo_VPN66" +HKR, NDIS, MajorNdisVersion, 1, 5 +HKR, NDIS, MinorNdisVersion, 1, 0 +HKR, Ndi\Interfaces, DefUpper, , "ndis5" +HKR, Ndi\Interfaces, UpperRange, , "ndis5" +HKR, Ndi\Interfaces, LowerRange, , "ethernet" +HKR, Ndi\Interfaces, DefLower, , "ethernet" +HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" +HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% +HKR, Ndi\Params\NetworkAddress, type, 0, "edit" +HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" +HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" +HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% +HKR, Ndi\Params\NetworkAddress, optional, 0, "0" +HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% +HKR, Ndi\Params\MaxSpeed, type, 0, "int" +HKR, Ndi\Params\MaxSpeed, default, 0, "100" +HKR, Ndi\Params\MaxSpeed, min, 0, "0" +HKR, Ndi\Params\MaxSpeed, max, 0, "2000" +HKR, Ndi\Params\MaxSpeed, step, 0, "1" +HKR, Ndi\Params\MaxSpeed, Base, 0, "10" +HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% +HKR, Ndi\Params\KeepLink, type, 0, "enum" +HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% +HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% +HKR, Ndi\Params\KeepLink, default, 0, "0" + + +[Neo.Service] +DisplayName = %Neo.Service.DispName% +Description = %Neo.Service.Desc% +ServiceType = 1 +StartType = 3 +ErrorControl = 1 +ServiceBinary = %12%\Neo6_x86_VPN66.sys +LoadOrderGroup = NDIS + +[Neo.Reg] +HKR, Ndi, Service, 0, Neo.Service.Name +HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" +HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" + +[Neo.EventLog] +HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN66.sys" +HKR, , TypesSupported, 0x00010001, 7 + +[Strings] +CompanyName = "SoftEther Corporation" +DiskDescription = "VPN Client Device Driver Install Disk" +Neo.Service.Name = "Neo_VPN66" +Neo.Service.DispName = "VPN Client Device Driver - VPN66" +Neo.Service.Desc = "VPN Client Adapter - VPN66" +NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN66" +Neo.EventLog.Name = "Neo" +NetworkAddress = "MAC Address" +DefaultAddress = "000001000001" +MaxSpeed = "Indicate Speed (Mbps)" +KeepLink = "Keep Link" +On = "On" +Off = "Off" + + +; Auto Generated 20180205_163616.964 + diff --git a/src/bin/hamcore/DriverPackages/Neo6_Win10/x86/Neo6_x86_VPN67.inf b/src/bin/hamcore/DriverPackages/Neo6_Win10/x86/Neo6_x86_VPN67.inf index 5f8d9c86..1d5b3b17 100644 --- a/src/bin/hamcore/DriverPackages/Neo6_Win10/x86/Neo6_x86_VPN67.inf +++ b/src/bin/hamcore/DriverPackages/Neo6_Win10/x86/Neo6_x86_VPN67.inf @@ -1,114 +1,114 @@ -; VPN Client Device Driver for Windows 2000 and Greater -; -; Copyright (c) SoftEther Corporation. All Rights Reserved. -; http://www.softether.co.jp/ -; -; BUILD 9658 - -[Version] -Signature = "$Windows NT$" -Class = Net -ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} -Provider = %CompanyName% -DriverVer = 02/04/2018, 4.25.0.9658 -CatalogFile.NT = Neo6_x86_VPN67.cat - -[Manufacturer] -%CompanyName% = SoftEther - -[SourceDisksNames] -1=%DiskDescription%, "", , - -[SourceDisksFiles] -Neo6_x86_VPN67.sys = 1 - -[DestinationDirs] -DefaultDestDir = 12 -Neo.CopyFiles.Sys = 12 - -[Neo.CopyFiles.Sys] -Neo6_x86_VPN67.sys, , , 2 - -[SoftEther] -%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN67 - -[NeoAdapter.Install] -Characteristics = 0x1 -AddReg = Neo.Reg, NeoAdapter.Ndi -CopyFiles = Neo.CopyFiles.Sys -*IfType = 53 -*MediaType = 0 -*PhysicalMediaType = 0 - -[NeoAdapter.Install.Services] -AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% - -[NeoAdapter.Ndi] -HKR, , NetworkAddress, 0, %DefaultAddress% -HKR, Ndi, DeviceID, , "NeoAdapter_VPN67" -HKR, , DevLoader, , ndis -HKR, , DeviceVxDs, , Neo6_x86_VPN67.sys -HKR, NDIS, LogDriverName, , "Neo_VPN67" -HKR, NDIS, MajorNdisVersion, 1, 5 -HKR, NDIS, MinorNdisVersion, 1, 0 -HKR, Ndi\Interfaces, DefUpper, , "ndis5" -HKR, Ndi\Interfaces, UpperRange, , "ndis5" -HKR, Ndi\Interfaces, LowerRange, , "ethernet" -HKR, Ndi\Interfaces, DefLower, , "ethernet" -HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" -HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% -HKR, Ndi\Params\NetworkAddress, type, 0, "edit" -HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" -HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" -HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% -HKR, Ndi\Params\NetworkAddress, optional, 0, "0" -HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% -HKR, Ndi\Params\MaxSpeed, type, 0, "int" -HKR, Ndi\Params\MaxSpeed, default, 0, "100" -HKR, Ndi\Params\MaxSpeed, min, 0, "0" -HKR, Ndi\Params\MaxSpeed, max, 0, "2000" -HKR, Ndi\Params\MaxSpeed, step, 0, "1" -HKR, Ndi\Params\MaxSpeed, Base, 0, "10" -HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% -HKR, Ndi\Params\KeepLink, type, 0, "enum" -HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% -HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% -HKR, Ndi\Params\KeepLink, default, 0, "0" - - -[Neo.Service] -DisplayName = %Neo.Service.DispName% -Description = %Neo.Service.Desc% -ServiceType = 1 -StartType = 3 -ErrorControl = 1 -ServiceBinary = %12%\Neo6_x86_VPN67.sys -LoadOrderGroup = NDIS - -[Neo.Reg] -HKR, Ndi, Service, 0, Neo.Service.Name -HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" -HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" - -[Neo.EventLog] -HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN67.sys" -HKR, , TypesSupported, 0x00010001, 7 - -[Strings] -CompanyName = "SoftEther Corporation" -DiskDescription = "VPN Client Device Driver Install Disk" -Neo.Service.Name = "Neo_VPN67" -Neo.Service.DispName = "VPN Client Device Driver - VPN67" -Neo.Service.Desc = "VPN Client Adapter - VPN67" -NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN67" -Neo.EventLog.Name = "Neo" -NetworkAddress = "MAC Address" -DefaultAddress = "000001000001" -MaxSpeed = "Indicate Speed (Mbps)" -KeepLink = "Keep Link" -On = "On" -Off = "Off" - - -; Auto Generated 20180205_163617.037 - +; VPN Client Device Driver for Windows 2000 and Greater +; +; Copyright (c) SoftEther Corporation. All Rights Reserved. +; http://www.softether.co.jp/ +; +; BUILD 9658 + +[Version] +Signature = "$Windows NT$" +Class = Net +ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} +Provider = %CompanyName% +DriverVer = 02/04/2018, 4.25.0.9658 +CatalogFile.NT = Neo6_x86_VPN67.cat + +[Manufacturer] +%CompanyName% = SoftEther + +[SourceDisksNames] +1=%DiskDescription%, "", , + +[SourceDisksFiles] +Neo6_x86_VPN67.sys = 1 + +[DestinationDirs] +DefaultDestDir = 12 +Neo.CopyFiles.Sys = 12 + +[Neo.CopyFiles.Sys] +Neo6_x86_VPN67.sys, , , 2 + +[SoftEther] +%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN67 + +[NeoAdapter.Install] +Characteristics = 0x1 +AddReg = Neo.Reg, NeoAdapter.Ndi +CopyFiles = Neo.CopyFiles.Sys +*IfType = 53 +*MediaType = 0 +*PhysicalMediaType = 0 + +[NeoAdapter.Install.Services] +AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% + +[NeoAdapter.Ndi] +HKR, , NetworkAddress, 0, %DefaultAddress% +HKR, Ndi, DeviceID, , "NeoAdapter_VPN67" +HKR, , DevLoader, , ndis +HKR, , DeviceVxDs, , Neo6_x86_VPN67.sys +HKR, NDIS, LogDriverName, , "Neo_VPN67" +HKR, NDIS, MajorNdisVersion, 1, 5 +HKR, NDIS, MinorNdisVersion, 1, 0 +HKR, Ndi\Interfaces, DefUpper, , "ndis5" +HKR, Ndi\Interfaces, UpperRange, , "ndis5" +HKR, Ndi\Interfaces, LowerRange, , "ethernet" +HKR, Ndi\Interfaces, DefLower, , "ethernet" +HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" +HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% +HKR, Ndi\Params\NetworkAddress, type, 0, "edit" +HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" +HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" +HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% +HKR, Ndi\Params\NetworkAddress, optional, 0, "0" +HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% +HKR, Ndi\Params\MaxSpeed, type, 0, "int" +HKR, Ndi\Params\MaxSpeed, default, 0, "100" +HKR, Ndi\Params\MaxSpeed, min, 0, "0" +HKR, Ndi\Params\MaxSpeed, max, 0, "2000" +HKR, Ndi\Params\MaxSpeed, step, 0, "1" +HKR, Ndi\Params\MaxSpeed, Base, 0, "10" +HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% +HKR, Ndi\Params\KeepLink, type, 0, "enum" +HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% +HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% +HKR, Ndi\Params\KeepLink, default, 0, "0" + + +[Neo.Service] +DisplayName = %Neo.Service.DispName% +Description = %Neo.Service.Desc% +ServiceType = 1 +StartType = 3 +ErrorControl = 1 +ServiceBinary = %12%\Neo6_x86_VPN67.sys +LoadOrderGroup = NDIS + +[Neo.Reg] +HKR, Ndi, Service, 0, Neo.Service.Name +HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" +HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" + +[Neo.EventLog] +HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN67.sys" +HKR, , TypesSupported, 0x00010001, 7 + +[Strings] +CompanyName = "SoftEther Corporation" +DiskDescription = "VPN Client Device Driver Install Disk" +Neo.Service.Name = "Neo_VPN67" +Neo.Service.DispName = "VPN Client Device Driver - VPN67" +Neo.Service.Desc = "VPN Client Adapter - VPN67" +NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN67" +Neo.EventLog.Name = "Neo" +NetworkAddress = "MAC Address" +DefaultAddress = "000001000001" +MaxSpeed = "Indicate Speed (Mbps)" +KeepLink = "Keep Link" +On = "On" +Off = "Off" + + +; Auto Generated 20180205_163617.037 + diff --git a/src/bin/hamcore/DriverPackages/Neo6_Win10/x86/Neo6_x86_VPN68.inf b/src/bin/hamcore/DriverPackages/Neo6_Win10/x86/Neo6_x86_VPN68.inf index 6b03ca5a..5f86734b 100644 --- a/src/bin/hamcore/DriverPackages/Neo6_Win10/x86/Neo6_x86_VPN68.inf +++ b/src/bin/hamcore/DriverPackages/Neo6_Win10/x86/Neo6_x86_VPN68.inf @@ -1,114 +1,114 @@ -; VPN Client Device Driver for Windows 2000 and Greater -; -; Copyright (c) SoftEther Corporation. All Rights Reserved. -; http://www.softether.co.jp/ -; -; BUILD 9658 - -[Version] -Signature = "$Windows NT$" -Class = Net -ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} -Provider = %CompanyName% -DriverVer = 02/04/2018, 4.25.0.9658 -CatalogFile.NT = Neo6_x86_VPN68.cat - -[Manufacturer] -%CompanyName% = SoftEther - -[SourceDisksNames] -1=%DiskDescription%, "", , - -[SourceDisksFiles] -Neo6_x86_VPN68.sys = 1 - -[DestinationDirs] -DefaultDestDir = 12 -Neo.CopyFiles.Sys = 12 - -[Neo.CopyFiles.Sys] -Neo6_x86_VPN68.sys, , , 2 - -[SoftEther] -%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN68 - -[NeoAdapter.Install] -Characteristics = 0x1 -AddReg = Neo.Reg, NeoAdapter.Ndi -CopyFiles = Neo.CopyFiles.Sys -*IfType = 53 -*MediaType = 0 -*PhysicalMediaType = 0 - -[NeoAdapter.Install.Services] -AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% - -[NeoAdapter.Ndi] -HKR, , NetworkAddress, 0, %DefaultAddress% -HKR, Ndi, DeviceID, , "NeoAdapter_VPN68" -HKR, , DevLoader, , ndis -HKR, , DeviceVxDs, , Neo6_x86_VPN68.sys -HKR, NDIS, LogDriverName, , "Neo_VPN68" -HKR, NDIS, MajorNdisVersion, 1, 5 -HKR, NDIS, MinorNdisVersion, 1, 0 -HKR, Ndi\Interfaces, DefUpper, , "ndis5" -HKR, Ndi\Interfaces, UpperRange, , "ndis5" -HKR, Ndi\Interfaces, LowerRange, , "ethernet" -HKR, Ndi\Interfaces, DefLower, , "ethernet" -HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" -HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% -HKR, Ndi\Params\NetworkAddress, type, 0, "edit" -HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" -HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" -HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% -HKR, Ndi\Params\NetworkAddress, optional, 0, "0" -HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% -HKR, Ndi\Params\MaxSpeed, type, 0, "int" -HKR, Ndi\Params\MaxSpeed, default, 0, "100" -HKR, Ndi\Params\MaxSpeed, min, 0, "0" -HKR, Ndi\Params\MaxSpeed, max, 0, "2000" -HKR, Ndi\Params\MaxSpeed, step, 0, "1" -HKR, Ndi\Params\MaxSpeed, Base, 0, "10" -HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% -HKR, Ndi\Params\KeepLink, type, 0, "enum" -HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% -HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% -HKR, Ndi\Params\KeepLink, default, 0, "0" - - -[Neo.Service] -DisplayName = %Neo.Service.DispName% -Description = %Neo.Service.Desc% -ServiceType = 1 -StartType = 3 -ErrorControl = 1 -ServiceBinary = %12%\Neo6_x86_VPN68.sys -LoadOrderGroup = NDIS - -[Neo.Reg] -HKR, Ndi, Service, 0, Neo.Service.Name -HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" -HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" - -[Neo.EventLog] -HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN68.sys" -HKR, , TypesSupported, 0x00010001, 7 - -[Strings] -CompanyName = "SoftEther Corporation" -DiskDescription = "VPN Client Device Driver Install Disk" -Neo.Service.Name = "Neo_VPN68" -Neo.Service.DispName = "VPN Client Device Driver - VPN68" -Neo.Service.Desc = "VPN Client Adapter - VPN68" -NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN68" -Neo.EventLog.Name = "Neo" -NetworkAddress = "MAC Address" -DefaultAddress = "000001000001" -MaxSpeed = "Indicate Speed (Mbps)" -KeepLink = "Keep Link" -On = "On" -Off = "Off" - - -; Auto Generated 20180205_163617.110 - +; VPN Client Device Driver for Windows 2000 and Greater +; +; Copyright (c) SoftEther Corporation. All Rights Reserved. +; http://www.softether.co.jp/ +; +; BUILD 9658 + +[Version] +Signature = "$Windows NT$" +Class = Net +ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} +Provider = %CompanyName% +DriverVer = 02/04/2018, 4.25.0.9658 +CatalogFile.NT = Neo6_x86_VPN68.cat + +[Manufacturer] +%CompanyName% = SoftEther + +[SourceDisksNames] +1=%DiskDescription%, "", , + +[SourceDisksFiles] +Neo6_x86_VPN68.sys = 1 + +[DestinationDirs] +DefaultDestDir = 12 +Neo.CopyFiles.Sys = 12 + +[Neo.CopyFiles.Sys] +Neo6_x86_VPN68.sys, , , 2 + +[SoftEther] +%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN68 + +[NeoAdapter.Install] +Characteristics = 0x1 +AddReg = Neo.Reg, NeoAdapter.Ndi +CopyFiles = Neo.CopyFiles.Sys +*IfType = 53 +*MediaType = 0 +*PhysicalMediaType = 0 + +[NeoAdapter.Install.Services] +AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% + +[NeoAdapter.Ndi] +HKR, , NetworkAddress, 0, %DefaultAddress% +HKR, Ndi, DeviceID, , "NeoAdapter_VPN68" +HKR, , DevLoader, , ndis +HKR, , DeviceVxDs, , Neo6_x86_VPN68.sys +HKR, NDIS, LogDriverName, , "Neo_VPN68" +HKR, NDIS, MajorNdisVersion, 1, 5 +HKR, NDIS, MinorNdisVersion, 1, 0 +HKR, Ndi\Interfaces, DefUpper, , "ndis5" +HKR, Ndi\Interfaces, UpperRange, , "ndis5" +HKR, Ndi\Interfaces, LowerRange, , "ethernet" +HKR, Ndi\Interfaces, DefLower, , "ethernet" +HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" +HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% +HKR, Ndi\Params\NetworkAddress, type, 0, "edit" +HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" +HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" +HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% +HKR, Ndi\Params\NetworkAddress, optional, 0, "0" +HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% +HKR, Ndi\Params\MaxSpeed, type, 0, "int" +HKR, Ndi\Params\MaxSpeed, default, 0, "100" +HKR, Ndi\Params\MaxSpeed, min, 0, "0" +HKR, Ndi\Params\MaxSpeed, max, 0, "2000" +HKR, Ndi\Params\MaxSpeed, step, 0, "1" +HKR, Ndi\Params\MaxSpeed, Base, 0, "10" +HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% +HKR, Ndi\Params\KeepLink, type, 0, "enum" +HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% +HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% +HKR, Ndi\Params\KeepLink, default, 0, "0" + + +[Neo.Service] +DisplayName = %Neo.Service.DispName% +Description = %Neo.Service.Desc% +ServiceType = 1 +StartType = 3 +ErrorControl = 1 +ServiceBinary = %12%\Neo6_x86_VPN68.sys +LoadOrderGroup = NDIS + +[Neo.Reg] +HKR, Ndi, Service, 0, Neo.Service.Name +HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" +HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" + +[Neo.EventLog] +HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN68.sys" +HKR, , TypesSupported, 0x00010001, 7 + +[Strings] +CompanyName = "SoftEther Corporation" +DiskDescription = "VPN Client Device Driver Install Disk" +Neo.Service.Name = "Neo_VPN68" +Neo.Service.DispName = "VPN Client Device Driver - VPN68" +Neo.Service.Desc = "VPN Client Adapter - VPN68" +NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN68" +Neo.EventLog.Name = "Neo" +NetworkAddress = "MAC Address" +DefaultAddress = "000001000001" +MaxSpeed = "Indicate Speed (Mbps)" +KeepLink = "Keep Link" +On = "On" +Off = "Off" + + +; Auto Generated 20180205_163617.110 + diff --git a/src/bin/hamcore/DriverPackages/Neo6_Win10/x86/Neo6_x86_VPN69.inf b/src/bin/hamcore/DriverPackages/Neo6_Win10/x86/Neo6_x86_VPN69.inf index db0d4647..e2fd9122 100644 --- a/src/bin/hamcore/DriverPackages/Neo6_Win10/x86/Neo6_x86_VPN69.inf +++ b/src/bin/hamcore/DriverPackages/Neo6_Win10/x86/Neo6_x86_VPN69.inf @@ -1,114 +1,114 @@ -; VPN Client Device Driver for Windows 2000 and Greater -; -; Copyright (c) SoftEther Corporation. All Rights Reserved. -; http://www.softether.co.jp/ -; -; BUILD 9658 - -[Version] -Signature = "$Windows NT$" -Class = Net -ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} -Provider = %CompanyName% -DriverVer = 02/04/2018, 4.25.0.9658 -CatalogFile.NT = Neo6_x86_VPN69.cat - -[Manufacturer] -%CompanyName% = SoftEther - -[SourceDisksNames] -1=%DiskDescription%, "", , - -[SourceDisksFiles] -Neo6_x86_VPN69.sys = 1 - -[DestinationDirs] -DefaultDestDir = 12 -Neo.CopyFiles.Sys = 12 - -[Neo.CopyFiles.Sys] -Neo6_x86_VPN69.sys, , , 2 - -[SoftEther] -%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN69 - -[NeoAdapter.Install] -Characteristics = 0x1 -AddReg = Neo.Reg, NeoAdapter.Ndi -CopyFiles = Neo.CopyFiles.Sys -*IfType = 53 -*MediaType = 0 -*PhysicalMediaType = 0 - -[NeoAdapter.Install.Services] -AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% - -[NeoAdapter.Ndi] -HKR, , NetworkAddress, 0, %DefaultAddress% -HKR, Ndi, DeviceID, , "NeoAdapter_VPN69" -HKR, , DevLoader, , ndis -HKR, , DeviceVxDs, , Neo6_x86_VPN69.sys -HKR, NDIS, LogDriverName, , "Neo_VPN69" -HKR, NDIS, MajorNdisVersion, 1, 5 -HKR, NDIS, MinorNdisVersion, 1, 0 -HKR, Ndi\Interfaces, DefUpper, , "ndis5" -HKR, Ndi\Interfaces, UpperRange, , "ndis5" -HKR, Ndi\Interfaces, LowerRange, , "ethernet" -HKR, Ndi\Interfaces, DefLower, , "ethernet" -HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" -HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% -HKR, Ndi\Params\NetworkAddress, type, 0, "edit" -HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" -HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" -HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% -HKR, Ndi\Params\NetworkAddress, optional, 0, "0" -HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% -HKR, Ndi\Params\MaxSpeed, type, 0, "int" -HKR, Ndi\Params\MaxSpeed, default, 0, "100" -HKR, Ndi\Params\MaxSpeed, min, 0, "0" -HKR, Ndi\Params\MaxSpeed, max, 0, "2000" -HKR, Ndi\Params\MaxSpeed, step, 0, "1" -HKR, Ndi\Params\MaxSpeed, Base, 0, "10" -HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% -HKR, Ndi\Params\KeepLink, type, 0, "enum" -HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% -HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% -HKR, Ndi\Params\KeepLink, default, 0, "0" - - -[Neo.Service] -DisplayName = %Neo.Service.DispName% -Description = %Neo.Service.Desc% -ServiceType = 1 -StartType = 3 -ErrorControl = 1 -ServiceBinary = %12%\Neo6_x86_VPN69.sys -LoadOrderGroup = NDIS - -[Neo.Reg] -HKR, Ndi, Service, 0, Neo.Service.Name -HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" -HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" - -[Neo.EventLog] -HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN69.sys" -HKR, , TypesSupported, 0x00010001, 7 - -[Strings] -CompanyName = "SoftEther Corporation" -DiskDescription = "VPN Client Device Driver Install Disk" -Neo.Service.Name = "Neo_VPN69" -Neo.Service.DispName = "VPN Client Device Driver - VPN69" -Neo.Service.Desc = "VPN Client Adapter - VPN69" -NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN69" -Neo.EventLog.Name = "Neo" -NetworkAddress = "MAC Address" -DefaultAddress = "000001000001" -MaxSpeed = "Indicate Speed (Mbps)" -KeepLink = "Keep Link" -On = "On" -Off = "Off" - - -; Auto Generated 20180205_163617.183 - +; VPN Client Device Driver for Windows 2000 and Greater +; +; Copyright (c) SoftEther Corporation. All Rights Reserved. +; http://www.softether.co.jp/ +; +; BUILD 9658 + +[Version] +Signature = "$Windows NT$" +Class = Net +ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} +Provider = %CompanyName% +DriverVer = 02/04/2018, 4.25.0.9658 +CatalogFile.NT = Neo6_x86_VPN69.cat + +[Manufacturer] +%CompanyName% = SoftEther + +[SourceDisksNames] +1=%DiskDescription%, "", , + +[SourceDisksFiles] +Neo6_x86_VPN69.sys = 1 + +[DestinationDirs] +DefaultDestDir = 12 +Neo.CopyFiles.Sys = 12 + +[Neo.CopyFiles.Sys] +Neo6_x86_VPN69.sys, , , 2 + +[SoftEther] +%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN69 + +[NeoAdapter.Install] +Characteristics = 0x1 +AddReg = Neo.Reg, NeoAdapter.Ndi +CopyFiles = Neo.CopyFiles.Sys +*IfType = 53 +*MediaType = 0 +*PhysicalMediaType = 0 + +[NeoAdapter.Install.Services] +AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% + +[NeoAdapter.Ndi] +HKR, , NetworkAddress, 0, %DefaultAddress% +HKR, Ndi, DeviceID, , "NeoAdapter_VPN69" +HKR, , DevLoader, , ndis +HKR, , DeviceVxDs, , Neo6_x86_VPN69.sys +HKR, NDIS, LogDriverName, , "Neo_VPN69" +HKR, NDIS, MajorNdisVersion, 1, 5 +HKR, NDIS, MinorNdisVersion, 1, 0 +HKR, Ndi\Interfaces, DefUpper, , "ndis5" +HKR, Ndi\Interfaces, UpperRange, , "ndis5" +HKR, Ndi\Interfaces, LowerRange, , "ethernet" +HKR, Ndi\Interfaces, DefLower, , "ethernet" +HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" +HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% +HKR, Ndi\Params\NetworkAddress, type, 0, "edit" +HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" +HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" +HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% +HKR, Ndi\Params\NetworkAddress, optional, 0, "0" +HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% +HKR, Ndi\Params\MaxSpeed, type, 0, "int" +HKR, Ndi\Params\MaxSpeed, default, 0, "100" +HKR, Ndi\Params\MaxSpeed, min, 0, "0" +HKR, Ndi\Params\MaxSpeed, max, 0, "2000" +HKR, Ndi\Params\MaxSpeed, step, 0, "1" +HKR, Ndi\Params\MaxSpeed, Base, 0, "10" +HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% +HKR, Ndi\Params\KeepLink, type, 0, "enum" +HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% +HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% +HKR, Ndi\Params\KeepLink, default, 0, "0" + + +[Neo.Service] +DisplayName = %Neo.Service.DispName% +Description = %Neo.Service.Desc% +ServiceType = 1 +StartType = 3 +ErrorControl = 1 +ServiceBinary = %12%\Neo6_x86_VPN69.sys +LoadOrderGroup = NDIS + +[Neo.Reg] +HKR, Ndi, Service, 0, Neo.Service.Name +HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" +HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" + +[Neo.EventLog] +HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN69.sys" +HKR, , TypesSupported, 0x00010001, 7 + +[Strings] +CompanyName = "SoftEther Corporation" +DiskDescription = "VPN Client Device Driver Install Disk" +Neo.Service.Name = "Neo_VPN69" +Neo.Service.DispName = "VPN Client Device Driver - VPN69" +Neo.Service.Desc = "VPN Client Adapter - VPN69" +NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN69" +Neo.EventLog.Name = "Neo" +NetworkAddress = "MAC Address" +DefaultAddress = "000001000001" +MaxSpeed = "Indicate Speed (Mbps)" +KeepLink = "Keep Link" +On = "On" +Off = "Off" + + +; Auto Generated 20180205_163617.183 + diff --git a/src/bin/hamcore/DriverPackages/Neo6_Win10/x86/Neo6_x86_VPN7.inf b/src/bin/hamcore/DriverPackages/Neo6_Win10/x86/Neo6_x86_VPN7.inf index a65b8d8d..096d8f06 100644 --- a/src/bin/hamcore/DriverPackages/Neo6_Win10/x86/Neo6_x86_VPN7.inf +++ b/src/bin/hamcore/DriverPackages/Neo6_Win10/x86/Neo6_x86_VPN7.inf @@ -1,114 +1,114 @@ -; VPN Client Device Driver for Windows 2000 and Greater -; -; Copyright (c) SoftEther Corporation. All Rights Reserved. -; http://www.softether.co.jp/ -; -; BUILD 9658 - -[Version] -Signature = "$Windows NT$" -Class = Net -ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} -Provider = %CompanyName% -DriverVer = 02/04/2018, 4.25.0.9658 -CatalogFile.NT = Neo6_x86_VPN7.cat - -[Manufacturer] -%CompanyName% = SoftEther - -[SourceDisksNames] -1=%DiskDescription%, "", , - -[SourceDisksFiles] -Neo6_x86_VPN7.sys = 1 - -[DestinationDirs] -DefaultDestDir = 12 -Neo.CopyFiles.Sys = 12 - -[Neo.CopyFiles.Sys] -Neo6_x86_VPN7.sys, , , 2 - -[SoftEther] -%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN7 - -[NeoAdapter.Install] -Characteristics = 0x1 -AddReg = Neo.Reg, NeoAdapter.Ndi -CopyFiles = Neo.CopyFiles.Sys -*IfType = 53 -*MediaType = 0 -*PhysicalMediaType = 0 - -[NeoAdapter.Install.Services] -AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% - -[NeoAdapter.Ndi] -HKR, , NetworkAddress, 0, %DefaultAddress% -HKR, Ndi, DeviceID, , "NeoAdapter_VPN7" -HKR, , DevLoader, , ndis -HKR, , DeviceVxDs, , Neo6_x86_VPN7.sys -HKR, NDIS, LogDriverName, , "Neo_VPN7" -HKR, NDIS, MajorNdisVersion, 1, 5 -HKR, NDIS, MinorNdisVersion, 1, 0 -HKR, Ndi\Interfaces, DefUpper, , "ndis5" -HKR, Ndi\Interfaces, UpperRange, , "ndis5" -HKR, Ndi\Interfaces, LowerRange, , "ethernet" -HKR, Ndi\Interfaces, DefLower, , "ethernet" -HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" -HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% -HKR, Ndi\Params\NetworkAddress, type, 0, "edit" -HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" -HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" -HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% -HKR, Ndi\Params\NetworkAddress, optional, 0, "0" -HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% -HKR, Ndi\Params\MaxSpeed, type, 0, "int" -HKR, Ndi\Params\MaxSpeed, default, 0, "100" -HKR, Ndi\Params\MaxSpeed, min, 0, "0" -HKR, Ndi\Params\MaxSpeed, max, 0, "2000" -HKR, Ndi\Params\MaxSpeed, step, 0, "1" -HKR, Ndi\Params\MaxSpeed, Base, 0, "10" -HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% -HKR, Ndi\Params\KeepLink, type, 0, "enum" -HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% -HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% -HKR, Ndi\Params\KeepLink, default, 0, "0" - - -[Neo.Service] -DisplayName = %Neo.Service.DispName% -Description = %Neo.Service.Desc% -ServiceType = 1 -StartType = 3 -ErrorControl = 1 -ServiceBinary = %12%\Neo6_x86_VPN7.sys -LoadOrderGroup = NDIS - -[Neo.Reg] -HKR, Ndi, Service, 0, Neo.Service.Name -HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" -HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" - -[Neo.EventLog] -HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN7.sys" -HKR, , TypesSupported, 0x00010001, 7 - -[Strings] -CompanyName = "SoftEther Corporation" -DiskDescription = "VPN Client Device Driver Install Disk" -Neo.Service.Name = "Neo_VPN7" -Neo.Service.DispName = "VPN Client Device Driver - VPN7" -Neo.Service.Desc = "VPN Client Adapter - VPN7" -NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN7" -Neo.EventLog.Name = "Neo" -NetworkAddress = "MAC Address" -DefaultAddress = "000001000001" -MaxSpeed = "Indicate Speed (Mbps)" -KeepLink = "Keep Link" -On = "On" -Off = "Off" - - -; Auto Generated 20180205_163612.763 - +; VPN Client Device Driver for Windows 2000 and Greater +; +; Copyright (c) SoftEther Corporation. All Rights Reserved. +; http://www.softether.co.jp/ +; +; BUILD 9658 + +[Version] +Signature = "$Windows NT$" +Class = Net +ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} +Provider = %CompanyName% +DriverVer = 02/04/2018, 4.25.0.9658 +CatalogFile.NT = Neo6_x86_VPN7.cat + +[Manufacturer] +%CompanyName% = SoftEther + +[SourceDisksNames] +1=%DiskDescription%, "", , + +[SourceDisksFiles] +Neo6_x86_VPN7.sys = 1 + +[DestinationDirs] +DefaultDestDir = 12 +Neo.CopyFiles.Sys = 12 + +[Neo.CopyFiles.Sys] +Neo6_x86_VPN7.sys, , , 2 + +[SoftEther] +%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN7 + +[NeoAdapter.Install] +Characteristics = 0x1 +AddReg = Neo.Reg, NeoAdapter.Ndi +CopyFiles = Neo.CopyFiles.Sys +*IfType = 53 +*MediaType = 0 +*PhysicalMediaType = 0 + +[NeoAdapter.Install.Services] +AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% + +[NeoAdapter.Ndi] +HKR, , NetworkAddress, 0, %DefaultAddress% +HKR, Ndi, DeviceID, , "NeoAdapter_VPN7" +HKR, , DevLoader, , ndis +HKR, , DeviceVxDs, , Neo6_x86_VPN7.sys +HKR, NDIS, LogDriverName, , "Neo_VPN7" +HKR, NDIS, MajorNdisVersion, 1, 5 +HKR, NDIS, MinorNdisVersion, 1, 0 +HKR, Ndi\Interfaces, DefUpper, , "ndis5" +HKR, Ndi\Interfaces, UpperRange, , "ndis5" +HKR, Ndi\Interfaces, LowerRange, , "ethernet" +HKR, Ndi\Interfaces, DefLower, , "ethernet" +HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" +HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% +HKR, Ndi\Params\NetworkAddress, type, 0, "edit" +HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" +HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" +HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% +HKR, Ndi\Params\NetworkAddress, optional, 0, "0" +HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% +HKR, Ndi\Params\MaxSpeed, type, 0, "int" +HKR, Ndi\Params\MaxSpeed, default, 0, "100" +HKR, Ndi\Params\MaxSpeed, min, 0, "0" +HKR, Ndi\Params\MaxSpeed, max, 0, "2000" +HKR, Ndi\Params\MaxSpeed, step, 0, "1" +HKR, Ndi\Params\MaxSpeed, Base, 0, "10" +HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% +HKR, Ndi\Params\KeepLink, type, 0, "enum" +HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% +HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% +HKR, Ndi\Params\KeepLink, default, 0, "0" + + +[Neo.Service] +DisplayName = %Neo.Service.DispName% +Description = %Neo.Service.Desc% +ServiceType = 1 +StartType = 3 +ErrorControl = 1 +ServiceBinary = %12%\Neo6_x86_VPN7.sys +LoadOrderGroup = NDIS + +[Neo.Reg] +HKR, Ndi, Service, 0, Neo.Service.Name +HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" +HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" + +[Neo.EventLog] +HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN7.sys" +HKR, , TypesSupported, 0x00010001, 7 + +[Strings] +CompanyName = "SoftEther Corporation" +DiskDescription = "VPN Client Device Driver Install Disk" +Neo.Service.Name = "Neo_VPN7" +Neo.Service.DispName = "VPN Client Device Driver - VPN7" +Neo.Service.Desc = "VPN Client Adapter - VPN7" +NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN7" +Neo.EventLog.Name = "Neo" +NetworkAddress = "MAC Address" +DefaultAddress = "000001000001" +MaxSpeed = "Indicate Speed (Mbps)" +KeepLink = "Keep Link" +On = "On" +Off = "Off" + + +; Auto Generated 20180205_163612.763 + diff --git a/src/bin/hamcore/DriverPackages/Neo6_Win10/x86/Neo6_x86_VPN70.inf b/src/bin/hamcore/DriverPackages/Neo6_Win10/x86/Neo6_x86_VPN70.inf index c6fa2f08..061cb048 100644 --- a/src/bin/hamcore/DriverPackages/Neo6_Win10/x86/Neo6_x86_VPN70.inf +++ b/src/bin/hamcore/DriverPackages/Neo6_Win10/x86/Neo6_x86_VPN70.inf @@ -1,114 +1,114 @@ -; VPN Client Device Driver for Windows 2000 and Greater -; -; Copyright (c) SoftEther Corporation. All Rights Reserved. -; http://www.softether.co.jp/ -; -; BUILD 9658 - -[Version] -Signature = "$Windows NT$" -Class = Net -ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} -Provider = %CompanyName% -DriverVer = 02/04/2018, 4.25.0.9658 -CatalogFile.NT = Neo6_x86_VPN70.cat - -[Manufacturer] -%CompanyName% = SoftEther - -[SourceDisksNames] -1=%DiskDescription%, "", , - -[SourceDisksFiles] -Neo6_x86_VPN70.sys = 1 - -[DestinationDirs] -DefaultDestDir = 12 -Neo.CopyFiles.Sys = 12 - -[Neo.CopyFiles.Sys] -Neo6_x86_VPN70.sys, , , 2 - -[SoftEther] -%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN70 - -[NeoAdapter.Install] -Characteristics = 0x1 -AddReg = Neo.Reg, NeoAdapter.Ndi -CopyFiles = Neo.CopyFiles.Sys -*IfType = 53 -*MediaType = 0 -*PhysicalMediaType = 0 - -[NeoAdapter.Install.Services] -AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% - -[NeoAdapter.Ndi] -HKR, , NetworkAddress, 0, %DefaultAddress% -HKR, Ndi, DeviceID, , "NeoAdapter_VPN70" -HKR, , DevLoader, , ndis -HKR, , DeviceVxDs, , Neo6_x86_VPN70.sys -HKR, NDIS, LogDriverName, , "Neo_VPN70" -HKR, NDIS, MajorNdisVersion, 1, 5 -HKR, NDIS, MinorNdisVersion, 1, 0 -HKR, Ndi\Interfaces, DefUpper, , "ndis5" -HKR, Ndi\Interfaces, UpperRange, , "ndis5" -HKR, Ndi\Interfaces, LowerRange, , "ethernet" -HKR, Ndi\Interfaces, DefLower, , "ethernet" -HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" -HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% -HKR, Ndi\Params\NetworkAddress, type, 0, "edit" -HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" -HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" -HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% -HKR, Ndi\Params\NetworkAddress, optional, 0, "0" -HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% -HKR, Ndi\Params\MaxSpeed, type, 0, "int" -HKR, Ndi\Params\MaxSpeed, default, 0, "100" -HKR, Ndi\Params\MaxSpeed, min, 0, "0" -HKR, Ndi\Params\MaxSpeed, max, 0, "2000" -HKR, Ndi\Params\MaxSpeed, step, 0, "1" -HKR, Ndi\Params\MaxSpeed, Base, 0, "10" -HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% -HKR, Ndi\Params\KeepLink, type, 0, "enum" -HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% -HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% -HKR, Ndi\Params\KeepLink, default, 0, "0" - - -[Neo.Service] -DisplayName = %Neo.Service.DispName% -Description = %Neo.Service.Desc% -ServiceType = 1 -StartType = 3 -ErrorControl = 1 -ServiceBinary = %12%\Neo6_x86_VPN70.sys -LoadOrderGroup = NDIS - -[Neo.Reg] -HKR, Ndi, Service, 0, Neo.Service.Name -HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" -HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" - -[Neo.EventLog] -HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN70.sys" -HKR, , TypesSupported, 0x00010001, 7 - -[Strings] -CompanyName = "SoftEther Corporation" -DiskDescription = "VPN Client Device Driver Install Disk" -Neo.Service.Name = "Neo_VPN70" -Neo.Service.DispName = "VPN Client Device Driver - VPN70" -Neo.Service.Desc = "VPN Client Adapter - VPN70" -NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN70" -Neo.EventLog.Name = "Neo" -NetworkAddress = "MAC Address" -DefaultAddress = "000001000001" -MaxSpeed = "Indicate Speed (Mbps)" -KeepLink = "Keep Link" -On = "On" -Off = "Off" - - -; Auto Generated 20180205_163617.259 - +; VPN Client Device Driver for Windows 2000 and Greater +; +; Copyright (c) SoftEther Corporation. All Rights Reserved. +; http://www.softether.co.jp/ +; +; BUILD 9658 + +[Version] +Signature = "$Windows NT$" +Class = Net +ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} +Provider = %CompanyName% +DriverVer = 02/04/2018, 4.25.0.9658 +CatalogFile.NT = Neo6_x86_VPN70.cat + +[Manufacturer] +%CompanyName% = SoftEther + +[SourceDisksNames] +1=%DiskDescription%, "", , + +[SourceDisksFiles] +Neo6_x86_VPN70.sys = 1 + +[DestinationDirs] +DefaultDestDir = 12 +Neo.CopyFiles.Sys = 12 + +[Neo.CopyFiles.Sys] +Neo6_x86_VPN70.sys, , , 2 + +[SoftEther] +%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN70 + +[NeoAdapter.Install] +Characteristics = 0x1 +AddReg = Neo.Reg, NeoAdapter.Ndi +CopyFiles = Neo.CopyFiles.Sys +*IfType = 53 +*MediaType = 0 +*PhysicalMediaType = 0 + +[NeoAdapter.Install.Services] +AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% + +[NeoAdapter.Ndi] +HKR, , NetworkAddress, 0, %DefaultAddress% +HKR, Ndi, DeviceID, , "NeoAdapter_VPN70" +HKR, , DevLoader, , ndis +HKR, , DeviceVxDs, , Neo6_x86_VPN70.sys +HKR, NDIS, LogDriverName, , "Neo_VPN70" +HKR, NDIS, MajorNdisVersion, 1, 5 +HKR, NDIS, MinorNdisVersion, 1, 0 +HKR, Ndi\Interfaces, DefUpper, , "ndis5" +HKR, Ndi\Interfaces, UpperRange, , "ndis5" +HKR, Ndi\Interfaces, LowerRange, , "ethernet" +HKR, Ndi\Interfaces, DefLower, , "ethernet" +HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" +HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% +HKR, Ndi\Params\NetworkAddress, type, 0, "edit" +HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" +HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" +HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% +HKR, Ndi\Params\NetworkAddress, optional, 0, "0" +HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% +HKR, Ndi\Params\MaxSpeed, type, 0, "int" +HKR, Ndi\Params\MaxSpeed, default, 0, "100" +HKR, Ndi\Params\MaxSpeed, min, 0, "0" +HKR, Ndi\Params\MaxSpeed, max, 0, "2000" +HKR, Ndi\Params\MaxSpeed, step, 0, "1" +HKR, Ndi\Params\MaxSpeed, Base, 0, "10" +HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% +HKR, Ndi\Params\KeepLink, type, 0, "enum" +HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% +HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% +HKR, Ndi\Params\KeepLink, default, 0, "0" + + +[Neo.Service] +DisplayName = %Neo.Service.DispName% +Description = %Neo.Service.Desc% +ServiceType = 1 +StartType = 3 +ErrorControl = 1 +ServiceBinary = %12%\Neo6_x86_VPN70.sys +LoadOrderGroup = NDIS + +[Neo.Reg] +HKR, Ndi, Service, 0, Neo.Service.Name +HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" +HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" + +[Neo.EventLog] +HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN70.sys" +HKR, , TypesSupported, 0x00010001, 7 + +[Strings] +CompanyName = "SoftEther Corporation" +DiskDescription = "VPN Client Device Driver Install Disk" +Neo.Service.Name = "Neo_VPN70" +Neo.Service.DispName = "VPN Client Device Driver - VPN70" +Neo.Service.Desc = "VPN Client Adapter - VPN70" +NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN70" +Neo.EventLog.Name = "Neo" +NetworkAddress = "MAC Address" +DefaultAddress = "000001000001" +MaxSpeed = "Indicate Speed (Mbps)" +KeepLink = "Keep Link" +On = "On" +Off = "Off" + + +; Auto Generated 20180205_163617.259 + diff --git a/src/bin/hamcore/DriverPackages/Neo6_Win10/x86/Neo6_x86_VPN71.inf b/src/bin/hamcore/DriverPackages/Neo6_Win10/x86/Neo6_x86_VPN71.inf index f6d09f6c..c1a3c0a6 100644 --- a/src/bin/hamcore/DriverPackages/Neo6_Win10/x86/Neo6_x86_VPN71.inf +++ b/src/bin/hamcore/DriverPackages/Neo6_Win10/x86/Neo6_x86_VPN71.inf @@ -1,114 +1,114 @@ -; VPN Client Device Driver for Windows 2000 and Greater -; -; Copyright (c) SoftEther Corporation. All Rights Reserved. -; http://www.softether.co.jp/ -; -; BUILD 9658 - -[Version] -Signature = "$Windows NT$" -Class = Net -ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} -Provider = %CompanyName% -DriverVer = 02/04/2018, 4.25.0.9658 -CatalogFile.NT = Neo6_x86_VPN71.cat - -[Manufacturer] -%CompanyName% = SoftEther - -[SourceDisksNames] -1=%DiskDescription%, "", , - -[SourceDisksFiles] -Neo6_x86_VPN71.sys = 1 - -[DestinationDirs] -DefaultDestDir = 12 -Neo.CopyFiles.Sys = 12 - -[Neo.CopyFiles.Sys] -Neo6_x86_VPN71.sys, , , 2 - -[SoftEther] -%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN71 - -[NeoAdapter.Install] -Characteristics = 0x1 -AddReg = Neo.Reg, NeoAdapter.Ndi -CopyFiles = Neo.CopyFiles.Sys -*IfType = 53 -*MediaType = 0 -*PhysicalMediaType = 0 - -[NeoAdapter.Install.Services] -AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% - -[NeoAdapter.Ndi] -HKR, , NetworkAddress, 0, %DefaultAddress% -HKR, Ndi, DeviceID, , "NeoAdapter_VPN71" -HKR, , DevLoader, , ndis -HKR, , DeviceVxDs, , Neo6_x86_VPN71.sys -HKR, NDIS, LogDriverName, , "Neo_VPN71" -HKR, NDIS, MajorNdisVersion, 1, 5 -HKR, NDIS, MinorNdisVersion, 1, 0 -HKR, Ndi\Interfaces, DefUpper, , "ndis5" -HKR, Ndi\Interfaces, UpperRange, , "ndis5" -HKR, Ndi\Interfaces, LowerRange, , "ethernet" -HKR, Ndi\Interfaces, DefLower, , "ethernet" -HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" -HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% -HKR, Ndi\Params\NetworkAddress, type, 0, "edit" -HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" -HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" -HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% -HKR, Ndi\Params\NetworkAddress, optional, 0, "0" -HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% -HKR, Ndi\Params\MaxSpeed, type, 0, "int" -HKR, Ndi\Params\MaxSpeed, default, 0, "100" -HKR, Ndi\Params\MaxSpeed, min, 0, "0" -HKR, Ndi\Params\MaxSpeed, max, 0, "2000" -HKR, Ndi\Params\MaxSpeed, step, 0, "1" -HKR, Ndi\Params\MaxSpeed, Base, 0, "10" -HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% -HKR, Ndi\Params\KeepLink, type, 0, "enum" -HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% -HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% -HKR, Ndi\Params\KeepLink, default, 0, "0" - - -[Neo.Service] -DisplayName = %Neo.Service.DispName% -Description = %Neo.Service.Desc% -ServiceType = 1 -StartType = 3 -ErrorControl = 1 -ServiceBinary = %12%\Neo6_x86_VPN71.sys -LoadOrderGroup = NDIS - -[Neo.Reg] -HKR, Ndi, Service, 0, Neo.Service.Name -HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" -HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" - -[Neo.EventLog] -HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN71.sys" -HKR, , TypesSupported, 0x00010001, 7 - -[Strings] -CompanyName = "SoftEther Corporation" -DiskDescription = "VPN Client Device Driver Install Disk" -Neo.Service.Name = "Neo_VPN71" -Neo.Service.DispName = "VPN Client Device Driver - VPN71" -Neo.Service.Desc = "VPN Client Adapter - VPN71" -NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN71" -Neo.EventLog.Name = "Neo" -NetworkAddress = "MAC Address" -DefaultAddress = "000001000001" -MaxSpeed = "Indicate Speed (Mbps)" -KeepLink = "Keep Link" -On = "On" -Off = "Off" - - -; Auto Generated 20180205_163617.330 - +; VPN Client Device Driver for Windows 2000 and Greater +; +; Copyright (c) SoftEther Corporation. All Rights Reserved. +; http://www.softether.co.jp/ +; +; BUILD 9658 + +[Version] +Signature = "$Windows NT$" +Class = Net +ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} +Provider = %CompanyName% +DriverVer = 02/04/2018, 4.25.0.9658 +CatalogFile.NT = Neo6_x86_VPN71.cat + +[Manufacturer] +%CompanyName% = SoftEther + +[SourceDisksNames] +1=%DiskDescription%, "", , + +[SourceDisksFiles] +Neo6_x86_VPN71.sys = 1 + +[DestinationDirs] +DefaultDestDir = 12 +Neo.CopyFiles.Sys = 12 + +[Neo.CopyFiles.Sys] +Neo6_x86_VPN71.sys, , , 2 + +[SoftEther] +%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN71 + +[NeoAdapter.Install] +Characteristics = 0x1 +AddReg = Neo.Reg, NeoAdapter.Ndi +CopyFiles = Neo.CopyFiles.Sys +*IfType = 53 +*MediaType = 0 +*PhysicalMediaType = 0 + +[NeoAdapter.Install.Services] +AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% + +[NeoAdapter.Ndi] +HKR, , NetworkAddress, 0, %DefaultAddress% +HKR, Ndi, DeviceID, , "NeoAdapter_VPN71" +HKR, , DevLoader, , ndis +HKR, , DeviceVxDs, , Neo6_x86_VPN71.sys +HKR, NDIS, LogDriverName, , "Neo_VPN71" +HKR, NDIS, MajorNdisVersion, 1, 5 +HKR, NDIS, MinorNdisVersion, 1, 0 +HKR, Ndi\Interfaces, DefUpper, , "ndis5" +HKR, Ndi\Interfaces, UpperRange, , "ndis5" +HKR, Ndi\Interfaces, LowerRange, , "ethernet" +HKR, Ndi\Interfaces, DefLower, , "ethernet" +HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" +HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% +HKR, Ndi\Params\NetworkAddress, type, 0, "edit" +HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" +HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" +HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% +HKR, Ndi\Params\NetworkAddress, optional, 0, "0" +HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% +HKR, Ndi\Params\MaxSpeed, type, 0, "int" +HKR, Ndi\Params\MaxSpeed, default, 0, "100" +HKR, Ndi\Params\MaxSpeed, min, 0, "0" +HKR, Ndi\Params\MaxSpeed, max, 0, "2000" +HKR, Ndi\Params\MaxSpeed, step, 0, "1" +HKR, Ndi\Params\MaxSpeed, Base, 0, "10" +HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% +HKR, Ndi\Params\KeepLink, type, 0, "enum" +HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% +HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% +HKR, Ndi\Params\KeepLink, default, 0, "0" + + +[Neo.Service] +DisplayName = %Neo.Service.DispName% +Description = %Neo.Service.Desc% +ServiceType = 1 +StartType = 3 +ErrorControl = 1 +ServiceBinary = %12%\Neo6_x86_VPN71.sys +LoadOrderGroup = NDIS + +[Neo.Reg] +HKR, Ndi, Service, 0, Neo.Service.Name +HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" +HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" + +[Neo.EventLog] +HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN71.sys" +HKR, , TypesSupported, 0x00010001, 7 + +[Strings] +CompanyName = "SoftEther Corporation" +DiskDescription = "VPN Client Device Driver Install Disk" +Neo.Service.Name = "Neo_VPN71" +Neo.Service.DispName = "VPN Client Device Driver - VPN71" +Neo.Service.Desc = "VPN Client Adapter - VPN71" +NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN71" +Neo.EventLog.Name = "Neo" +NetworkAddress = "MAC Address" +DefaultAddress = "000001000001" +MaxSpeed = "Indicate Speed (Mbps)" +KeepLink = "Keep Link" +On = "On" +Off = "Off" + + +; Auto Generated 20180205_163617.330 + diff --git a/src/bin/hamcore/DriverPackages/Neo6_Win10/x86/Neo6_x86_VPN72.inf b/src/bin/hamcore/DriverPackages/Neo6_Win10/x86/Neo6_x86_VPN72.inf index 9e863ad2..c7b3c54d 100644 --- a/src/bin/hamcore/DriverPackages/Neo6_Win10/x86/Neo6_x86_VPN72.inf +++ b/src/bin/hamcore/DriverPackages/Neo6_Win10/x86/Neo6_x86_VPN72.inf @@ -1,114 +1,114 @@ -; VPN Client Device Driver for Windows 2000 and Greater -; -; Copyright (c) SoftEther Corporation. All Rights Reserved. -; http://www.softether.co.jp/ -; -; BUILD 9658 - -[Version] -Signature = "$Windows NT$" -Class = Net -ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} -Provider = %CompanyName% -DriverVer = 02/04/2018, 4.25.0.9658 -CatalogFile.NT = Neo6_x86_VPN72.cat - -[Manufacturer] -%CompanyName% = SoftEther - -[SourceDisksNames] -1=%DiskDescription%, "", , - -[SourceDisksFiles] -Neo6_x86_VPN72.sys = 1 - -[DestinationDirs] -DefaultDestDir = 12 -Neo.CopyFiles.Sys = 12 - -[Neo.CopyFiles.Sys] -Neo6_x86_VPN72.sys, , , 2 - -[SoftEther] -%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN72 - -[NeoAdapter.Install] -Characteristics = 0x1 -AddReg = Neo.Reg, NeoAdapter.Ndi -CopyFiles = Neo.CopyFiles.Sys -*IfType = 53 -*MediaType = 0 -*PhysicalMediaType = 0 - -[NeoAdapter.Install.Services] -AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% - -[NeoAdapter.Ndi] -HKR, , NetworkAddress, 0, %DefaultAddress% -HKR, Ndi, DeviceID, , "NeoAdapter_VPN72" -HKR, , DevLoader, , ndis -HKR, , DeviceVxDs, , Neo6_x86_VPN72.sys -HKR, NDIS, LogDriverName, , "Neo_VPN72" -HKR, NDIS, MajorNdisVersion, 1, 5 -HKR, NDIS, MinorNdisVersion, 1, 0 -HKR, Ndi\Interfaces, DefUpper, , "ndis5" -HKR, Ndi\Interfaces, UpperRange, , "ndis5" -HKR, Ndi\Interfaces, LowerRange, , "ethernet" -HKR, Ndi\Interfaces, DefLower, , "ethernet" -HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" -HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% -HKR, Ndi\Params\NetworkAddress, type, 0, "edit" -HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" -HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" -HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% -HKR, Ndi\Params\NetworkAddress, optional, 0, "0" -HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% -HKR, Ndi\Params\MaxSpeed, type, 0, "int" -HKR, Ndi\Params\MaxSpeed, default, 0, "100" -HKR, Ndi\Params\MaxSpeed, min, 0, "0" -HKR, Ndi\Params\MaxSpeed, max, 0, "2000" -HKR, Ndi\Params\MaxSpeed, step, 0, "1" -HKR, Ndi\Params\MaxSpeed, Base, 0, "10" -HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% -HKR, Ndi\Params\KeepLink, type, 0, "enum" -HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% -HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% -HKR, Ndi\Params\KeepLink, default, 0, "0" - - -[Neo.Service] -DisplayName = %Neo.Service.DispName% -Description = %Neo.Service.Desc% -ServiceType = 1 -StartType = 3 -ErrorControl = 1 -ServiceBinary = %12%\Neo6_x86_VPN72.sys -LoadOrderGroup = NDIS - -[Neo.Reg] -HKR, Ndi, Service, 0, Neo.Service.Name -HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" -HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" - -[Neo.EventLog] -HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN72.sys" -HKR, , TypesSupported, 0x00010001, 7 - -[Strings] -CompanyName = "SoftEther Corporation" -DiskDescription = "VPN Client Device Driver Install Disk" -Neo.Service.Name = "Neo_VPN72" -Neo.Service.DispName = "VPN Client Device Driver - VPN72" -Neo.Service.Desc = "VPN Client Adapter - VPN72" -NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN72" -Neo.EventLog.Name = "Neo" -NetworkAddress = "MAC Address" -DefaultAddress = "000001000001" -MaxSpeed = "Indicate Speed (Mbps)" -KeepLink = "Keep Link" -On = "On" -Off = "Off" - - -; Auto Generated 20180205_163617.400 - +; VPN Client Device Driver for Windows 2000 and Greater +; +; Copyright (c) SoftEther Corporation. All Rights Reserved. +; http://www.softether.co.jp/ +; +; BUILD 9658 + +[Version] +Signature = "$Windows NT$" +Class = Net +ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} +Provider = %CompanyName% +DriverVer = 02/04/2018, 4.25.0.9658 +CatalogFile.NT = Neo6_x86_VPN72.cat + +[Manufacturer] +%CompanyName% = SoftEther + +[SourceDisksNames] +1=%DiskDescription%, "", , + +[SourceDisksFiles] +Neo6_x86_VPN72.sys = 1 + +[DestinationDirs] +DefaultDestDir = 12 +Neo.CopyFiles.Sys = 12 + +[Neo.CopyFiles.Sys] +Neo6_x86_VPN72.sys, , , 2 + +[SoftEther] +%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN72 + +[NeoAdapter.Install] +Characteristics = 0x1 +AddReg = Neo.Reg, NeoAdapter.Ndi +CopyFiles = Neo.CopyFiles.Sys +*IfType = 53 +*MediaType = 0 +*PhysicalMediaType = 0 + +[NeoAdapter.Install.Services] +AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% + +[NeoAdapter.Ndi] +HKR, , NetworkAddress, 0, %DefaultAddress% +HKR, Ndi, DeviceID, , "NeoAdapter_VPN72" +HKR, , DevLoader, , ndis +HKR, , DeviceVxDs, , Neo6_x86_VPN72.sys +HKR, NDIS, LogDriverName, , "Neo_VPN72" +HKR, NDIS, MajorNdisVersion, 1, 5 +HKR, NDIS, MinorNdisVersion, 1, 0 +HKR, Ndi\Interfaces, DefUpper, , "ndis5" +HKR, Ndi\Interfaces, UpperRange, , "ndis5" +HKR, Ndi\Interfaces, LowerRange, , "ethernet" +HKR, Ndi\Interfaces, DefLower, , "ethernet" +HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" +HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% +HKR, Ndi\Params\NetworkAddress, type, 0, "edit" +HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" +HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" +HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% +HKR, Ndi\Params\NetworkAddress, optional, 0, "0" +HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% +HKR, Ndi\Params\MaxSpeed, type, 0, "int" +HKR, Ndi\Params\MaxSpeed, default, 0, "100" +HKR, Ndi\Params\MaxSpeed, min, 0, "0" +HKR, Ndi\Params\MaxSpeed, max, 0, "2000" +HKR, Ndi\Params\MaxSpeed, step, 0, "1" +HKR, Ndi\Params\MaxSpeed, Base, 0, "10" +HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% +HKR, Ndi\Params\KeepLink, type, 0, "enum" +HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% +HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% +HKR, Ndi\Params\KeepLink, default, 0, "0" + + +[Neo.Service] +DisplayName = %Neo.Service.DispName% +Description = %Neo.Service.Desc% +ServiceType = 1 +StartType = 3 +ErrorControl = 1 +ServiceBinary = %12%\Neo6_x86_VPN72.sys +LoadOrderGroup = NDIS + +[Neo.Reg] +HKR, Ndi, Service, 0, Neo.Service.Name +HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" +HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" + +[Neo.EventLog] +HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN72.sys" +HKR, , TypesSupported, 0x00010001, 7 + +[Strings] +CompanyName = "SoftEther Corporation" +DiskDescription = "VPN Client Device Driver Install Disk" +Neo.Service.Name = "Neo_VPN72" +Neo.Service.DispName = "VPN Client Device Driver - VPN72" +Neo.Service.Desc = "VPN Client Adapter - VPN72" +NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN72" +Neo.EventLog.Name = "Neo" +NetworkAddress = "MAC Address" +DefaultAddress = "000001000001" +MaxSpeed = "Indicate Speed (Mbps)" +KeepLink = "Keep Link" +On = "On" +Off = "Off" + + +; Auto Generated 20180205_163617.400 + diff --git a/src/bin/hamcore/DriverPackages/Neo6_Win10/x86/Neo6_x86_VPN73.inf b/src/bin/hamcore/DriverPackages/Neo6_Win10/x86/Neo6_x86_VPN73.inf index e9fd3182..9b19f5f1 100644 --- a/src/bin/hamcore/DriverPackages/Neo6_Win10/x86/Neo6_x86_VPN73.inf +++ b/src/bin/hamcore/DriverPackages/Neo6_Win10/x86/Neo6_x86_VPN73.inf @@ -1,114 +1,114 @@ -; VPN Client Device Driver for Windows 2000 and Greater -; -; Copyright (c) SoftEther Corporation. All Rights Reserved. -; http://www.softether.co.jp/ -; -; BUILD 9658 - -[Version] -Signature = "$Windows NT$" -Class = Net -ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} -Provider = %CompanyName% -DriverVer = 02/04/2018, 4.25.0.9658 -CatalogFile.NT = Neo6_x86_VPN73.cat - -[Manufacturer] -%CompanyName% = SoftEther - -[SourceDisksNames] -1=%DiskDescription%, "", , - -[SourceDisksFiles] -Neo6_x86_VPN73.sys = 1 - -[DestinationDirs] -DefaultDestDir = 12 -Neo.CopyFiles.Sys = 12 - -[Neo.CopyFiles.Sys] -Neo6_x86_VPN73.sys, , , 2 - -[SoftEther] -%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN73 - -[NeoAdapter.Install] -Characteristics = 0x1 -AddReg = Neo.Reg, NeoAdapter.Ndi -CopyFiles = Neo.CopyFiles.Sys -*IfType = 53 -*MediaType = 0 -*PhysicalMediaType = 0 - -[NeoAdapter.Install.Services] -AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% - -[NeoAdapter.Ndi] -HKR, , NetworkAddress, 0, %DefaultAddress% -HKR, Ndi, DeviceID, , "NeoAdapter_VPN73" -HKR, , DevLoader, , ndis -HKR, , DeviceVxDs, , Neo6_x86_VPN73.sys -HKR, NDIS, LogDriverName, , "Neo_VPN73" -HKR, NDIS, MajorNdisVersion, 1, 5 -HKR, NDIS, MinorNdisVersion, 1, 0 -HKR, Ndi\Interfaces, DefUpper, , "ndis5" -HKR, Ndi\Interfaces, UpperRange, , "ndis5" -HKR, Ndi\Interfaces, LowerRange, , "ethernet" -HKR, Ndi\Interfaces, DefLower, , "ethernet" -HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" -HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% -HKR, Ndi\Params\NetworkAddress, type, 0, "edit" -HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" -HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" -HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% -HKR, Ndi\Params\NetworkAddress, optional, 0, "0" -HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% -HKR, Ndi\Params\MaxSpeed, type, 0, "int" -HKR, Ndi\Params\MaxSpeed, default, 0, "100" -HKR, Ndi\Params\MaxSpeed, min, 0, "0" -HKR, Ndi\Params\MaxSpeed, max, 0, "2000" -HKR, Ndi\Params\MaxSpeed, step, 0, "1" -HKR, Ndi\Params\MaxSpeed, Base, 0, "10" -HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% -HKR, Ndi\Params\KeepLink, type, 0, "enum" -HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% -HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% -HKR, Ndi\Params\KeepLink, default, 0, "0" - - -[Neo.Service] -DisplayName = %Neo.Service.DispName% -Description = %Neo.Service.Desc% -ServiceType = 1 -StartType = 3 -ErrorControl = 1 -ServiceBinary = %12%\Neo6_x86_VPN73.sys -LoadOrderGroup = NDIS - -[Neo.Reg] -HKR, Ndi, Service, 0, Neo.Service.Name -HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" -HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" - -[Neo.EventLog] -HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN73.sys" -HKR, , TypesSupported, 0x00010001, 7 - -[Strings] -CompanyName = "SoftEther Corporation" -DiskDescription = "VPN Client Device Driver Install Disk" -Neo.Service.Name = "Neo_VPN73" -Neo.Service.DispName = "VPN Client Device Driver - VPN73" -Neo.Service.Desc = "VPN Client Adapter - VPN73" -NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN73" -Neo.EventLog.Name = "Neo" -NetworkAddress = "MAC Address" -DefaultAddress = "000001000001" -MaxSpeed = "Indicate Speed (Mbps)" -KeepLink = "Keep Link" -On = "On" -Off = "Off" - - -; Auto Generated 20180205_163617.473 - +; VPN Client Device Driver for Windows 2000 and Greater +; +; Copyright (c) SoftEther Corporation. All Rights Reserved. +; http://www.softether.co.jp/ +; +; BUILD 9658 + +[Version] +Signature = "$Windows NT$" +Class = Net +ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} +Provider = %CompanyName% +DriverVer = 02/04/2018, 4.25.0.9658 +CatalogFile.NT = Neo6_x86_VPN73.cat + +[Manufacturer] +%CompanyName% = SoftEther + +[SourceDisksNames] +1=%DiskDescription%, "", , + +[SourceDisksFiles] +Neo6_x86_VPN73.sys = 1 + +[DestinationDirs] +DefaultDestDir = 12 +Neo.CopyFiles.Sys = 12 + +[Neo.CopyFiles.Sys] +Neo6_x86_VPN73.sys, , , 2 + +[SoftEther] +%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN73 + +[NeoAdapter.Install] +Characteristics = 0x1 +AddReg = Neo.Reg, NeoAdapter.Ndi +CopyFiles = Neo.CopyFiles.Sys +*IfType = 53 +*MediaType = 0 +*PhysicalMediaType = 0 + +[NeoAdapter.Install.Services] +AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% + +[NeoAdapter.Ndi] +HKR, , NetworkAddress, 0, %DefaultAddress% +HKR, Ndi, DeviceID, , "NeoAdapter_VPN73" +HKR, , DevLoader, , ndis +HKR, , DeviceVxDs, , Neo6_x86_VPN73.sys +HKR, NDIS, LogDriverName, , "Neo_VPN73" +HKR, NDIS, MajorNdisVersion, 1, 5 +HKR, NDIS, MinorNdisVersion, 1, 0 +HKR, Ndi\Interfaces, DefUpper, , "ndis5" +HKR, Ndi\Interfaces, UpperRange, , "ndis5" +HKR, Ndi\Interfaces, LowerRange, , "ethernet" +HKR, Ndi\Interfaces, DefLower, , "ethernet" +HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" +HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% +HKR, Ndi\Params\NetworkAddress, type, 0, "edit" +HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" +HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" +HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% +HKR, Ndi\Params\NetworkAddress, optional, 0, "0" +HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% +HKR, Ndi\Params\MaxSpeed, type, 0, "int" +HKR, Ndi\Params\MaxSpeed, default, 0, "100" +HKR, Ndi\Params\MaxSpeed, min, 0, "0" +HKR, Ndi\Params\MaxSpeed, max, 0, "2000" +HKR, Ndi\Params\MaxSpeed, step, 0, "1" +HKR, Ndi\Params\MaxSpeed, Base, 0, "10" +HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% +HKR, Ndi\Params\KeepLink, type, 0, "enum" +HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% +HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% +HKR, Ndi\Params\KeepLink, default, 0, "0" + + +[Neo.Service] +DisplayName = %Neo.Service.DispName% +Description = %Neo.Service.Desc% +ServiceType = 1 +StartType = 3 +ErrorControl = 1 +ServiceBinary = %12%\Neo6_x86_VPN73.sys +LoadOrderGroup = NDIS + +[Neo.Reg] +HKR, Ndi, Service, 0, Neo.Service.Name +HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" +HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" + +[Neo.EventLog] +HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN73.sys" +HKR, , TypesSupported, 0x00010001, 7 + +[Strings] +CompanyName = "SoftEther Corporation" +DiskDescription = "VPN Client Device Driver Install Disk" +Neo.Service.Name = "Neo_VPN73" +Neo.Service.DispName = "VPN Client Device Driver - VPN73" +Neo.Service.Desc = "VPN Client Adapter - VPN73" +NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN73" +Neo.EventLog.Name = "Neo" +NetworkAddress = "MAC Address" +DefaultAddress = "000001000001" +MaxSpeed = "Indicate Speed (Mbps)" +KeepLink = "Keep Link" +On = "On" +Off = "Off" + + +; Auto Generated 20180205_163617.473 + diff --git a/src/bin/hamcore/DriverPackages/Neo6_Win10/x86/Neo6_x86_VPN74.inf b/src/bin/hamcore/DriverPackages/Neo6_Win10/x86/Neo6_x86_VPN74.inf index a96194c3..ec4426a4 100644 --- a/src/bin/hamcore/DriverPackages/Neo6_Win10/x86/Neo6_x86_VPN74.inf +++ b/src/bin/hamcore/DriverPackages/Neo6_Win10/x86/Neo6_x86_VPN74.inf @@ -1,114 +1,114 @@ -; VPN Client Device Driver for Windows 2000 and Greater -; -; Copyright (c) SoftEther Corporation. All Rights Reserved. -; http://www.softether.co.jp/ -; -; BUILD 9658 - -[Version] -Signature = "$Windows NT$" -Class = Net -ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} -Provider = %CompanyName% -DriverVer = 02/04/2018, 4.25.0.9658 -CatalogFile.NT = Neo6_x86_VPN74.cat - -[Manufacturer] -%CompanyName% = SoftEther - -[SourceDisksNames] -1=%DiskDescription%, "", , - -[SourceDisksFiles] -Neo6_x86_VPN74.sys = 1 - -[DestinationDirs] -DefaultDestDir = 12 -Neo.CopyFiles.Sys = 12 - -[Neo.CopyFiles.Sys] -Neo6_x86_VPN74.sys, , , 2 - -[SoftEther] -%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN74 - -[NeoAdapter.Install] -Characteristics = 0x1 -AddReg = Neo.Reg, NeoAdapter.Ndi -CopyFiles = Neo.CopyFiles.Sys -*IfType = 53 -*MediaType = 0 -*PhysicalMediaType = 0 - -[NeoAdapter.Install.Services] -AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% - -[NeoAdapter.Ndi] -HKR, , NetworkAddress, 0, %DefaultAddress% -HKR, Ndi, DeviceID, , "NeoAdapter_VPN74" -HKR, , DevLoader, , ndis -HKR, , DeviceVxDs, , Neo6_x86_VPN74.sys -HKR, NDIS, LogDriverName, , "Neo_VPN74" -HKR, NDIS, MajorNdisVersion, 1, 5 -HKR, NDIS, MinorNdisVersion, 1, 0 -HKR, Ndi\Interfaces, DefUpper, , "ndis5" -HKR, Ndi\Interfaces, UpperRange, , "ndis5" -HKR, Ndi\Interfaces, LowerRange, , "ethernet" -HKR, Ndi\Interfaces, DefLower, , "ethernet" -HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" -HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% -HKR, Ndi\Params\NetworkAddress, type, 0, "edit" -HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" -HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" -HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% -HKR, Ndi\Params\NetworkAddress, optional, 0, "0" -HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% -HKR, Ndi\Params\MaxSpeed, type, 0, "int" -HKR, Ndi\Params\MaxSpeed, default, 0, "100" -HKR, Ndi\Params\MaxSpeed, min, 0, "0" -HKR, Ndi\Params\MaxSpeed, max, 0, "2000" -HKR, Ndi\Params\MaxSpeed, step, 0, "1" -HKR, Ndi\Params\MaxSpeed, Base, 0, "10" -HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% -HKR, Ndi\Params\KeepLink, type, 0, "enum" -HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% -HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% -HKR, Ndi\Params\KeepLink, default, 0, "0" - - -[Neo.Service] -DisplayName = %Neo.Service.DispName% -Description = %Neo.Service.Desc% -ServiceType = 1 -StartType = 3 -ErrorControl = 1 -ServiceBinary = %12%\Neo6_x86_VPN74.sys -LoadOrderGroup = NDIS - -[Neo.Reg] -HKR, Ndi, Service, 0, Neo.Service.Name -HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" -HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" - -[Neo.EventLog] -HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN74.sys" -HKR, , TypesSupported, 0x00010001, 7 - -[Strings] -CompanyName = "SoftEther Corporation" -DiskDescription = "VPN Client Device Driver Install Disk" -Neo.Service.Name = "Neo_VPN74" -Neo.Service.DispName = "VPN Client Device Driver - VPN74" -Neo.Service.Desc = "VPN Client Adapter - VPN74" -NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN74" -Neo.EventLog.Name = "Neo" -NetworkAddress = "MAC Address" -DefaultAddress = "000001000001" -MaxSpeed = "Indicate Speed (Mbps)" -KeepLink = "Keep Link" -On = "On" -Off = "Off" - - -; Auto Generated 20180205_163617.546 - +; VPN Client Device Driver for Windows 2000 and Greater +; +; Copyright (c) SoftEther Corporation. All Rights Reserved. +; http://www.softether.co.jp/ +; +; BUILD 9658 + +[Version] +Signature = "$Windows NT$" +Class = Net +ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} +Provider = %CompanyName% +DriverVer = 02/04/2018, 4.25.0.9658 +CatalogFile.NT = Neo6_x86_VPN74.cat + +[Manufacturer] +%CompanyName% = SoftEther + +[SourceDisksNames] +1=%DiskDescription%, "", , + +[SourceDisksFiles] +Neo6_x86_VPN74.sys = 1 + +[DestinationDirs] +DefaultDestDir = 12 +Neo.CopyFiles.Sys = 12 + +[Neo.CopyFiles.Sys] +Neo6_x86_VPN74.sys, , , 2 + +[SoftEther] +%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN74 + +[NeoAdapter.Install] +Characteristics = 0x1 +AddReg = Neo.Reg, NeoAdapter.Ndi +CopyFiles = Neo.CopyFiles.Sys +*IfType = 53 +*MediaType = 0 +*PhysicalMediaType = 0 + +[NeoAdapter.Install.Services] +AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% + +[NeoAdapter.Ndi] +HKR, , NetworkAddress, 0, %DefaultAddress% +HKR, Ndi, DeviceID, , "NeoAdapter_VPN74" +HKR, , DevLoader, , ndis +HKR, , DeviceVxDs, , Neo6_x86_VPN74.sys +HKR, NDIS, LogDriverName, , "Neo_VPN74" +HKR, NDIS, MajorNdisVersion, 1, 5 +HKR, NDIS, MinorNdisVersion, 1, 0 +HKR, Ndi\Interfaces, DefUpper, , "ndis5" +HKR, Ndi\Interfaces, UpperRange, , "ndis5" +HKR, Ndi\Interfaces, LowerRange, , "ethernet" +HKR, Ndi\Interfaces, DefLower, , "ethernet" +HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" +HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% +HKR, Ndi\Params\NetworkAddress, type, 0, "edit" +HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" +HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" +HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% +HKR, Ndi\Params\NetworkAddress, optional, 0, "0" +HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% +HKR, Ndi\Params\MaxSpeed, type, 0, "int" +HKR, Ndi\Params\MaxSpeed, default, 0, "100" +HKR, Ndi\Params\MaxSpeed, min, 0, "0" +HKR, Ndi\Params\MaxSpeed, max, 0, "2000" +HKR, Ndi\Params\MaxSpeed, step, 0, "1" +HKR, Ndi\Params\MaxSpeed, Base, 0, "10" +HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% +HKR, Ndi\Params\KeepLink, type, 0, "enum" +HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% +HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% +HKR, Ndi\Params\KeepLink, default, 0, "0" + + +[Neo.Service] +DisplayName = %Neo.Service.DispName% +Description = %Neo.Service.Desc% +ServiceType = 1 +StartType = 3 +ErrorControl = 1 +ServiceBinary = %12%\Neo6_x86_VPN74.sys +LoadOrderGroup = NDIS + +[Neo.Reg] +HKR, Ndi, Service, 0, Neo.Service.Name +HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" +HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" + +[Neo.EventLog] +HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN74.sys" +HKR, , TypesSupported, 0x00010001, 7 + +[Strings] +CompanyName = "SoftEther Corporation" +DiskDescription = "VPN Client Device Driver Install Disk" +Neo.Service.Name = "Neo_VPN74" +Neo.Service.DispName = "VPN Client Device Driver - VPN74" +Neo.Service.Desc = "VPN Client Adapter - VPN74" +NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN74" +Neo.EventLog.Name = "Neo" +NetworkAddress = "MAC Address" +DefaultAddress = "000001000001" +MaxSpeed = "Indicate Speed (Mbps)" +KeepLink = "Keep Link" +On = "On" +Off = "Off" + + +; Auto Generated 20180205_163617.546 + diff --git a/src/bin/hamcore/DriverPackages/Neo6_Win10/x86/Neo6_x86_VPN75.inf b/src/bin/hamcore/DriverPackages/Neo6_Win10/x86/Neo6_x86_VPN75.inf index 6baad707..5793defb 100644 --- a/src/bin/hamcore/DriverPackages/Neo6_Win10/x86/Neo6_x86_VPN75.inf +++ b/src/bin/hamcore/DriverPackages/Neo6_Win10/x86/Neo6_x86_VPN75.inf @@ -1,114 +1,114 @@ -; VPN Client Device Driver for Windows 2000 and Greater -; -; Copyright (c) SoftEther Corporation. All Rights Reserved. -; http://www.softether.co.jp/ -; -; BUILD 9658 - -[Version] -Signature = "$Windows NT$" -Class = Net -ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} -Provider = %CompanyName% -DriverVer = 02/04/2018, 4.25.0.9658 -CatalogFile.NT = Neo6_x86_VPN75.cat - -[Manufacturer] -%CompanyName% = SoftEther - -[SourceDisksNames] -1=%DiskDescription%, "", , - -[SourceDisksFiles] -Neo6_x86_VPN75.sys = 1 - -[DestinationDirs] -DefaultDestDir = 12 -Neo.CopyFiles.Sys = 12 - -[Neo.CopyFiles.Sys] -Neo6_x86_VPN75.sys, , , 2 - -[SoftEther] -%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN75 - -[NeoAdapter.Install] -Characteristics = 0x1 -AddReg = Neo.Reg, NeoAdapter.Ndi -CopyFiles = Neo.CopyFiles.Sys -*IfType = 53 -*MediaType = 0 -*PhysicalMediaType = 0 - -[NeoAdapter.Install.Services] -AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% - -[NeoAdapter.Ndi] -HKR, , NetworkAddress, 0, %DefaultAddress% -HKR, Ndi, DeviceID, , "NeoAdapter_VPN75" -HKR, , DevLoader, , ndis -HKR, , DeviceVxDs, , Neo6_x86_VPN75.sys -HKR, NDIS, LogDriverName, , "Neo_VPN75" -HKR, NDIS, MajorNdisVersion, 1, 5 -HKR, NDIS, MinorNdisVersion, 1, 0 -HKR, Ndi\Interfaces, DefUpper, , "ndis5" -HKR, Ndi\Interfaces, UpperRange, , "ndis5" -HKR, Ndi\Interfaces, LowerRange, , "ethernet" -HKR, Ndi\Interfaces, DefLower, , "ethernet" -HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" -HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% -HKR, Ndi\Params\NetworkAddress, type, 0, "edit" -HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" -HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" -HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% -HKR, Ndi\Params\NetworkAddress, optional, 0, "0" -HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% -HKR, Ndi\Params\MaxSpeed, type, 0, "int" -HKR, Ndi\Params\MaxSpeed, default, 0, "100" -HKR, Ndi\Params\MaxSpeed, min, 0, "0" -HKR, Ndi\Params\MaxSpeed, max, 0, "2000" -HKR, Ndi\Params\MaxSpeed, step, 0, "1" -HKR, Ndi\Params\MaxSpeed, Base, 0, "10" -HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% -HKR, Ndi\Params\KeepLink, type, 0, "enum" -HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% -HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% -HKR, Ndi\Params\KeepLink, default, 0, "0" - - -[Neo.Service] -DisplayName = %Neo.Service.DispName% -Description = %Neo.Service.Desc% -ServiceType = 1 -StartType = 3 -ErrorControl = 1 -ServiceBinary = %12%\Neo6_x86_VPN75.sys -LoadOrderGroup = NDIS - -[Neo.Reg] -HKR, Ndi, Service, 0, Neo.Service.Name -HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" -HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" - -[Neo.EventLog] -HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN75.sys" -HKR, , TypesSupported, 0x00010001, 7 - -[Strings] -CompanyName = "SoftEther Corporation" -DiskDescription = "VPN Client Device Driver Install Disk" -Neo.Service.Name = "Neo_VPN75" -Neo.Service.DispName = "VPN Client Device Driver - VPN75" -Neo.Service.Desc = "VPN Client Adapter - VPN75" -NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN75" -Neo.EventLog.Name = "Neo" -NetworkAddress = "MAC Address" -DefaultAddress = "000001000001" -MaxSpeed = "Indicate Speed (Mbps)" -KeepLink = "Keep Link" -On = "On" -Off = "Off" - - -; Auto Generated 20180205_163617.618 - +; VPN Client Device Driver for Windows 2000 and Greater +; +; Copyright (c) SoftEther Corporation. All Rights Reserved. +; http://www.softether.co.jp/ +; +; BUILD 9658 + +[Version] +Signature = "$Windows NT$" +Class = Net +ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} +Provider = %CompanyName% +DriverVer = 02/04/2018, 4.25.0.9658 +CatalogFile.NT = Neo6_x86_VPN75.cat + +[Manufacturer] +%CompanyName% = SoftEther + +[SourceDisksNames] +1=%DiskDescription%, "", , + +[SourceDisksFiles] +Neo6_x86_VPN75.sys = 1 + +[DestinationDirs] +DefaultDestDir = 12 +Neo.CopyFiles.Sys = 12 + +[Neo.CopyFiles.Sys] +Neo6_x86_VPN75.sys, , , 2 + +[SoftEther] +%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN75 + +[NeoAdapter.Install] +Characteristics = 0x1 +AddReg = Neo.Reg, NeoAdapter.Ndi +CopyFiles = Neo.CopyFiles.Sys +*IfType = 53 +*MediaType = 0 +*PhysicalMediaType = 0 + +[NeoAdapter.Install.Services] +AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% + +[NeoAdapter.Ndi] +HKR, , NetworkAddress, 0, %DefaultAddress% +HKR, Ndi, DeviceID, , "NeoAdapter_VPN75" +HKR, , DevLoader, , ndis +HKR, , DeviceVxDs, , Neo6_x86_VPN75.sys +HKR, NDIS, LogDriverName, , "Neo_VPN75" +HKR, NDIS, MajorNdisVersion, 1, 5 +HKR, NDIS, MinorNdisVersion, 1, 0 +HKR, Ndi\Interfaces, DefUpper, , "ndis5" +HKR, Ndi\Interfaces, UpperRange, , "ndis5" +HKR, Ndi\Interfaces, LowerRange, , "ethernet" +HKR, Ndi\Interfaces, DefLower, , "ethernet" +HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" +HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% +HKR, Ndi\Params\NetworkAddress, type, 0, "edit" +HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" +HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" +HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% +HKR, Ndi\Params\NetworkAddress, optional, 0, "0" +HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% +HKR, Ndi\Params\MaxSpeed, type, 0, "int" +HKR, Ndi\Params\MaxSpeed, default, 0, "100" +HKR, Ndi\Params\MaxSpeed, min, 0, "0" +HKR, Ndi\Params\MaxSpeed, max, 0, "2000" +HKR, Ndi\Params\MaxSpeed, step, 0, "1" +HKR, Ndi\Params\MaxSpeed, Base, 0, "10" +HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% +HKR, Ndi\Params\KeepLink, type, 0, "enum" +HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% +HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% +HKR, Ndi\Params\KeepLink, default, 0, "0" + + +[Neo.Service] +DisplayName = %Neo.Service.DispName% +Description = %Neo.Service.Desc% +ServiceType = 1 +StartType = 3 +ErrorControl = 1 +ServiceBinary = %12%\Neo6_x86_VPN75.sys +LoadOrderGroup = NDIS + +[Neo.Reg] +HKR, Ndi, Service, 0, Neo.Service.Name +HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" +HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" + +[Neo.EventLog] +HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN75.sys" +HKR, , TypesSupported, 0x00010001, 7 + +[Strings] +CompanyName = "SoftEther Corporation" +DiskDescription = "VPN Client Device Driver Install Disk" +Neo.Service.Name = "Neo_VPN75" +Neo.Service.DispName = "VPN Client Device Driver - VPN75" +Neo.Service.Desc = "VPN Client Adapter - VPN75" +NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN75" +Neo.EventLog.Name = "Neo" +NetworkAddress = "MAC Address" +DefaultAddress = "000001000001" +MaxSpeed = "Indicate Speed (Mbps)" +KeepLink = "Keep Link" +On = "On" +Off = "Off" + + +; Auto Generated 20180205_163617.618 + diff --git a/src/bin/hamcore/DriverPackages/Neo6_Win10/x86/Neo6_x86_VPN76.inf b/src/bin/hamcore/DriverPackages/Neo6_Win10/x86/Neo6_x86_VPN76.inf index 71a5d3e5..eb8a7296 100644 --- a/src/bin/hamcore/DriverPackages/Neo6_Win10/x86/Neo6_x86_VPN76.inf +++ b/src/bin/hamcore/DriverPackages/Neo6_Win10/x86/Neo6_x86_VPN76.inf @@ -1,114 +1,114 @@ -; VPN Client Device Driver for Windows 2000 and Greater -; -; Copyright (c) SoftEther Corporation. All Rights Reserved. -; http://www.softether.co.jp/ -; -; BUILD 9658 - -[Version] -Signature = "$Windows NT$" -Class = Net -ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} -Provider = %CompanyName% -DriverVer = 02/04/2018, 4.25.0.9658 -CatalogFile.NT = Neo6_x86_VPN76.cat - -[Manufacturer] -%CompanyName% = SoftEther - -[SourceDisksNames] -1=%DiskDescription%, "", , - -[SourceDisksFiles] -Neo6_x86_VPN76.sys = 1 - -[DestinationDirs] -DefaultDestDir = 12 -Neo.CopyFiles.Sys = 12 - -[Neo.CopyFiles.Sys] -Neo6_x86_VPN76.sys, , , 2 - -[SoftEther] -%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN76 - -[NeoAdapter.Install] -Characteristics = 0x1 -AddReg = Neo.Reg, NeoAdapter.Ndi -CopyFiles = Neo.CopyFiles.Sys -*IfType = 53 -*MediaType = 0 -*PhysicalMediaType = 0 - -[NeoAdapter.Install.Services] -AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% - -[NeoAdapter.Ndi] -HKR, , NetworkAddress, 0, %DefaultAddress% -HKR, Ndi, DeviceID, , "NeoAdapter_VPN76" -HKR, , DevLoader, , ndis -HKR, , DeviceVxDs, , Neo6_x86_VPN76.sys -HKR, NDIS, LogDriverName, , "Neo_VPN76" -HKR, NDIS, MajorNdisVersion, 1, 5 -HKR, NDIS, MinorNdisVersion, 1, 0 -HKR, Ndi\Interfaces, DefUpper, , "ndis5" -HKR, Ndi\Interfaces, UpperRange, , "ndis5" -HKR, Ndi\Interfaces, LowerRange, , "ethernet" -HKR, Ndi\Interfaces, DefLower, , "ethernet" -HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" -HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% -HKR, Ndi\Params\NetworkAddress, type, 0, "edit" -HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" -HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" -HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% -HKR, Ndi\Params\NetworkAddress, optional, 0, "0" -HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% -HKR, Ndi\Params\MaxSpeed, type, 0, "int" -HKR, Ndi\Params\MaxSpeed, default, 0, "100" -HKR, Ndi\Params\MaxSpeed, min, 0, "0" -HKR, Ndi\Params\MaxSpeed, max, 0, "2000" -HKR, Ndi\Params\MaxSpeed, step, 0, "1" -HKR, Ndi\Params\MaxSpeed, Base, 0, "10" -HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% -HKR, Ndi\Params\KeepLink, type, 0, "enum" -HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% -HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% -HKR, Ndi\Params\KeepLink, default, 0, "0" - - -[Neo.Service] -DisplayName = %Neo.Service.DispName% -Description = %Neo.Service.Desc% -ServiceType = 1 -StartType = 3 -ErrorControl = 1 -ServiceBinary = %12%\Neo6_x86_VPN76.sys -LoadOrderGroup = NDIS - -[Neo.Reg] -HKR, Ndi, Service, 0, Neo.Service.Name -HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" -HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" - -[Neo.EventLog] -HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN76.sys" -HKR, , TypesSupported, 0x00010001, 7 - -[Strings] -CompanyName = "SoftEther Corporation" -DiskDescription = "VPN Client Device Driver Install Disk" -Neo.Service.Name = "Neo_VPN76" -Neo.Service.DispName = "VPN Client Device Driver - VPN76" -Neo.Service.Desc = "VPN Client Adapter - VPN76" -NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN76" -Neo.EventLog.Name = "Neo" -NetworkAddress = "MAC Address" -DefaultAddress = "000001000001" -MaxSpeed = "Indicate Speed (Mbps)" -KeepLink = "Keep Link" -On = "On" -Off = "Off" - - -; Auto Generated 20180205_163617.690 - +; VPN Client Device Driver for Windows 2000 and Greater +; +; Copyright (c) SoftEther Corporation. All Rights Reserved. +; http://www.softether.co.jp/ +; +; BUILD 9658 + +[Version] +Signature = "$Windows NT$" +Class = Net +ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} +Provider = %CompanyName% +DriverVer = 02/04/2018, 4.25.0.9658 +CatalogFile.NT = Neo6_x86_VPN76.cat + +[Manufacturer] +%CompanyName% = SoftEther + +[SourceDisksNames] +1=%DiskDescription%, "", , + +[SourceDisksFiles] +Neo6_x86_VPN76.sys = 1 + +[DestinationDirs] +DefaultDestDir = 12 +Neo.CopyFiles.Sys = 12 + +[Neo.CopyFiles.Sys] +Neo6_x86_VPN76.sys, , , 2 + +[SoftEther] +%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN76 + +[NeoAdapter.Install] +Characteristics = 0x1 +AddReg = Neo.Reg, NeoAdapter.Ndi +CopyFiles = Neo.CopyFiles.Sys +*IfType = 53 +*MediaType = 0 +*PhysicalMediaType = 0 + +[NeoAdapter.Install.Services] +AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% + +[NeoAdapter.Ndi] +HKR, , NetworkAddress, 0, %DefaultAddress% +HKR, Ndi, DeviceID, , "NeoAdapter_VPN76" +HKR, , DevLoader, , ndis +HKR, , DeviceVxDs, , Neo6_x86_VPN76.sys +HKR, NDIS, LogDriverName, , "Neo_VPN76" +HKR, NDIS, MajorNdisVersion, 1, 5 +HKR, NDIS, MinorNdisVersion, 1, 0 +HKR, Ndi\Interfaces, DefUpper, , "ndis5" +HKR, Ndi\Interfaces, UpperRange, , "ndis5" +HKR, Ndi\Interfaces, LowerRange, , "ethernet" +HKR, Ndi\Interfaces, DefLower, , "ethernet" +HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" +HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% +HKR, Ndi\Params\NetworkAddress, type, 0, "edit" +HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" +HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" +HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% +HKR, Ndi\Params\NetworkAddress, optional, 0, "0" +HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% +HKR, Ndi\Params\MaxSpeed, type, 0, "int" +HKR, Ndi\Params\MaxSpeed, default, 0, "100" +HKR, Ndi\Params\MaxSpeed, min, 0, "0" +HKR, Ndi\Params\MaxSpeed, max, 0, "2000" +HKR, Ndi\Params\MaxSpeed, step, 0, "1" +HKR, Ndi\Params\MaxSpeed, Base, 0, "10" +HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% +HKR, Ndi\Params\KeepLink, type, 0, "enum" +HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% +HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% +HKR, Ndi\Params\KeepLink, default, 0, "0" + + +[Neo.Service] +DisplayName = %Neo.Service.DispName% +Description = %Neo.Service.Desc% +ServiceType = 1 +StartType = 3 +ErrorControl = 1 +ServiceBinary = %12%\Neo6_x86_VPN76.sys +LoadOrderGroup = NDIS + +[Neo.Reg] +HKR, Ndi, Service, 0, Neo.Service.Name +HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" +HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" + +[Neo.EventLog] +HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN76.sys" +HKR, , TypesSupported, 0x00010001, 7 + +[Strings] +CompanyName = "SoftEther Corporation" +DiskDescription = "VPN Client Device Driver Install Disk" +Neo.Service.Name = "Neo_VPN76" +Neo.Service.DispName = "VPN Client Device Driver - VPN76" +Neo.Service.Desc = "VPN Client Adapter - VPN76" +NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN76" +Neo.EventLog.Name = "Neo" +NetworkAddress = "MAC Address" +DefaultAddress = "000001000001" +MaxSpeed = "Indicate Speed (Mbps)" +KeepLink = "Keep Link" +On = "On" +Off = "Off" + + +; Auto Generated 20180205_163617.690 + diff --git a/src/bin/hamcore/DriverPackages/Neo6_Win10/x86/Neo6_x86_VPN77.inf b/src/bin/hamcore/DriverPackages/Neo6_Win10/x86/Neo6_x86_VPN77.inf index 030323a6..4f7598ad 100644 --- a/src/bin/hamcore/DriverPackages/Neo6_Win10/x86/Neo6_x86_VPN77.inf +++ b/src/bin/hamcore/DriverPackages/Neo6_Win10/x86/Neo6_x86_VPN77.inf @@ -1,114 +1,114 @@ -; VPN Client Device Driver for Windows 2000 and Greater -; -; Copyright (c) SoftEther Corporation. All Rights Reserved. -; http://www.softether.co.jp/ -; -; BUILD 9658 - -[Version] -Signature = "$Windows NT$" -Class = Net -ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} -Provider = %CompanyName% -DriverVer = 02/04/2018, 4.25.0.9658 -CatalogFile.NT = Neo6_x86_VPN77.cat - -[Manufacturer] -%CompanyName% = SoftEther - -[SourceDisksNames] -1=%DiskDescription%, "", , - -[SourceDisksFiles] -Neo6_x86_VPN77.sys = 1 - -[DestinationDirs] -DefaultDestDir = 12 -Neo.CopyFiles.Sys = 12 - -[Neo.CopyFiles.Sys] -Neo6_x86_VPN77.sys, , , 2 - -[SoftEther] -%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN77 - -[NeoAdapter.Install] -Characteristics = 0x1 -AddReg = Neo.Reg, NeoAdapter.Ndi -CopyFiles = Neo.CopyFiles.Sys -*IfType = 53 -*MediaType = 0 -*PhysicalMediaType = 0 - -[NeoAdapter.Install.Services] -AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% - -[NeoAdapter.Ndi] -HKR, , NetworkAddress, 0, %DefaultAddress% -HKR, Ndi, DeviceID, , "NeoAdapter_VPN77" -HKR, , DevLoader, , ndis -HKR, , DeviceVxDs, , Neo6_x86_VPN77.sys -HKR, NDIS, LogDriverName, , "Neo_VPN77" -HKR, NDIS, MajorNdisVersion, 1, 5 -HKR, NDIS, MinorNdisVersion, 1, 0 -HKR, Ndi\Interfaces, DefUpper, , "ndis5" -HKR, Ndi\Interfaces, UpperRange, , "ndis5" -HKR, Ndi\Interfaces, LowerRange, , "ethernet" -HKR, Ndi\Interfaces, DefLower, , "ethernet" -HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" -HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% -HKR, Ndi\Params\NetworkAddress, type, 0, "edit" -HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" -HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" -HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% -HKR, Ndi\Params\NetworkAddress, optional, 0, "0" -HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% -HKR, Ndi\Params\MaxSpeed, type, 0, "int" -HKR, Ndi\Params\MaxSpeed, default, 0, "100" -HKR, Ndi\Params\MaxSpeed, min, 0, "0" -HKR, Ndi\Params\MaxSpeed, max, 0, "2000" -HKR, Ndi\Params\MaxSpeed, step, 0, "1" -HKR, Ndi\Params\MaxSpeed, Base, 0, "10" -HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% -HKR, Ndi\Params\KeepLink, type, 0, "enum" -HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% -HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% -HKR, Ndi\Params\KeepLink, default, 0, "0" - - -[Neo.Service] -DisplayName = %Neo.Service.DispName% -Description = %Neo.Service.Desc% -ServiceType = 1 -StartType = 3 -ErrorControl = 1 -ServiceBinary = %12%\Neo6_x86_VPN77.sys -LoadOrderGroup = NDIS - -[Neo.Reg] -HKR, Ndi, Service, 0, Neo.Service.Name -HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" -HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" - -[Neo.EventLog] -HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN77.sys" -HKR, , TypesSupported, 0x00010001, 7 - -[Strings] -CompanyName = "SoftEther Corporation" -DiskDescription = "VPN Client Device Driver Install Disk" -Neo.Service.Name = "Neo_VPN77" -Neo.Service.DispName = "VPN Client Device Driver - VPN77" -Neo.Service.Desc = "VPN Client Adapter - VPN77" -NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN77" -Neo.EventLog.Name = "Neo" -NetworkAddress = "MAC Address" -DefaultAddress = "000001000001" -MaxSpeed = "Indicate Speed (Mbps)" -KeepLink = "Keep Link" -On = "On" -Off = "Off" - - -; Auto Generated 20180205_163617.760 - +; VPN Client Device Driver for Windows 2000 and Greater +; +; Copyright (c) SoftEther Corporation. All Rights Reserved. +; http://www.softether.co.jp/ +; +; BUILD 9658 + +[Version] +Signature = "$Windows NT$" +Class = Net +ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} +Provider = %CompanyName% +DriverVer = 02/04/2018, 4.25.0.9658 +CatalogFile.NT = Neo6_x86_VPN77.cat + +[Manufacturer] +%CompanyName% = SoftEther + +[SourceDisksNames] +1=%DiskDescription%, "", , + +[SourceDisksFiles] +Neo6_x86_VPN77.sys = 1 + +[DestinationDirs] +DefaultDestDir = 12 +Neo.CopyFiles.Sys = 12 + +[Neo.CopyFiles.Sys] +Neo6_x86_VPN77.sys, , , 2 + +[SoftEther] +%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN77 + +[NeoAdapter.Install] +Characteristics = 0x1 +AddReg = Neo.Reg, NeoAdapter.Ndi +CopyFiles = Neo.CopyFiles.Sys +*IfType = 53 +*MediaType = 0 +*PhysicalMediaType = 0 + +[NeoAdapter.Install.Services] +AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% + +[NeoAdapter.Ndi] +HKR, , NetworkAddress, 0, %DefaultAddress% +HKR, Ndi, DeviceID, , "NeoAdapter_VPN77" +HKR, , DevLoader, , ndis +HKR, , DeviceVxDs, , Neo6_x86_VPN77.sys +HKR, NDIS, LogDriverName, , "Neo_VPN77" +HKR, NDIS, MajorNdisVersion, 1, 5 +HKR, NDIS, MinorNdisVersion, 1, 0 +HKR, Ndi\Interfaces, DefUpper, , "ndis5" +HKR, Ndi\Interfaces, UpperRange, , "ndis5" +HKR, Ndi\Interfaces, LowerRange, , "ethernet" +HKR, Ndi\Interfaces, DefLower, , "ethernet" +HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" +HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% +HKR, Ndi\Params\NetworkAddress, type, 0, "edit" +HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" +HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" +HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% +HKR, Ndi\Params\NetworkAddress, optional, 0, "0" +HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% +HKR, Ndi\Params\MaxSpeed, type, 0, "int" +HKR, Ndi\Params\MaxSpeed, default, 0, "100" +HKR, Ndi\Params\MaxSpeed, min, 0, "0" +HKR, Ndi\Params\MaxSpeed, max, 0, "2000" +HKR, Ndi\Params\MaxSpeed, step, 0, "1" +HKR, Ndi\Params\MaxSpeed, Base, 0, "10" +HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% +HKR, Ndi\Params\KeepLink, type, 0, "enum" +HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% +HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% +HKR, Ndi\Params\KeepLink, default, 0, "0" + + +[Neo.Service] +DisplayName = %Neo.Service.DispName% +Description = %Neo.Service.Desc% +ServiceType = 1 +StartType = 3 +ErrorControl = 1 +ServiceBinary = %12%\Neo6_x86_VPN77.sys +LoadOrderGroup = NDIS + +[Neo.Reg] +HKR, Ndi, Service, 0, Neo.Service.Name +HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" +HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" + +[Neo.EventLog] +HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN77.sys" +HKR, , TypesSupported, 0x00010001, 7 + +[Strings] +CompanyName = "SoftEther Corporation" +DiskDescription = "VPN Client Device Driver Install Disk" +Neo.Service.Name = "Neo_VPN77" +Neo.Service.DispName = "VPN Client Device Driver - VPN77" +Neo.Service.Desc = "VPN Client Adapter - VPN77" +NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN77" +Neo.EventLog.Name = "Neo" +NetworkAddress = "MAC Address" +DefaultAddress = "000001000001" +MaxSpeed = "Indicate Speed (Mbps)" +KeepLink = "Keep Link" +On = "On" +Off = "Off" + + +; Auto Generated 20180205_163617.760 + diff --git a/src/bin/hamcore/DriverPackages/Neo6_Win10/x86/Neo6_x86_VPN78.inf b/src/bin/hamcore/DriverPackages/Neo6_Win10/x86/Neo6_x86_VPN78.inf index 8b124558..827784c6 100644 --- a/src/bin/hamcore/DriverPackages/Neo6_Win10/x86/Neo6_x86_VPN78.inf +++ b/src/bin/hamcore/DriverPackages/Neo6_Win10/x86/Neo6_x86_VPN78.inf @@ -1,114 +1,114 @@ -; VPN Client Device Driver for Windows 2000 and Greater -; -; Copyright (c) SoftEther Corporation. All Rights Reserved. -; http://www.softether.co.jp/ -; -; BUILD 9658 - -[Version] -Signature = "$Windows NT$" -Class = Net -ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} -Provider = %CompanyName% -DriverVer = 02/04/2018, 4.25.0.9658 -CatalogFile.NT = Neo6_x86_VPN78.cat - -[Manufacturer] -%CompanyName% = SoftEther - -[SourceDisksNames] -1=%DiskDescription%, "", , - -[SourceDisksFiles] -Neo6_x86_VPN78.sys = 1 - -[DestinationDirs] -DefaultDestDir = 12 -Neo.CopyFiles.Sys = 12 - -[Neo.CopyFiles.Sys] -Neo6_x86_VPN78.sys, , , 2 - -[SoftEther] -%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN78 - -[NeoAdapter.Install] -Characteristics = 0x1 -AddReg = Neo.Reg, NeoAdapter.Ndi -CopyFiles = Neo.CopyFiles.Sys -*IfType = 53 -*MediaType = 0 -*PhysicalMediaType = 0 - -[NeoAdapter.Install.Services] -AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% - -[NeoAdapter.Ndi] -HKR, , NetworkAddress, 0, %DefaultAddress% -HKR, Ndi, DeviceID, , "NeoAdapter_VPN78" -HKR, , DevLoader, , ndis -HKR, , DeviceVxDs, , Neo6_x86_VPN78.sys -HKR, NDIS, LogDriverName, , "Neo_VPN78" -HKR, NDIS, MajorNdisVersion, 1, 5 -HKR, NDIS, MinorNdisVersion, 1, 0 -HKR, Ndi\Interfaces, DefUpper, , "ndis5" -HKR, Ndi\Interfaces, UpperRange, , "ndis5" -HKR, Ndi\Interfaces, LowerRange, , "ethernet" -HKR, Ndi\Interfaces, DefLower, , "ethernet" -HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" -HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% -HKR, Ndi\Params\NetworkAddress, type, 0, "edit" -HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" -HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" -HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% -HKR, Ndi\Params\NetworkAddress, optional, 0, "0" -HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% -HKR, Ndi\Params\MaxSpeed, type, 0, "int" -HKR, Ndi\Params\MaxSpeed, default, 0, "100" -HKR, Ndi\Params\MaxSpeed, min, 0, "0" -HKR, Ndi\Params\MaxSpeed, max, 0, "2000" -HKR, Ndi\Params\MaxSpeed, step, 0, "1" -HKR, Ndi\Params\MaxSpeed, Base, 0, "10" -HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% -HKR, Ndi\Params\KeepLink, type, 0, "enum" -HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% -HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% -HKR, Ndi\Params\KeepLink, default, 0, "0" - - -[Neo.Service] -DisplayName = %Neo.Service.DispName% -Description = %Neo.Service.Desc% -ServiceType = 1 -StartType = 3 -ErrorControl = 1 -ServiceBinary = %12%\Neo6_x86_VPN78.sys -LoadOrderGroup = NDIS - -[Neo.Reg] -HKR, Ndi, Service, 0, Neo.Service.Name -HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" -HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" - -[Neo.EventLog] -HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN78.sys" -HKR, , TypesSupported, 0x00010001, 7 - -[Strings] -CompanyName = "SoftEther Corporation" -DiskDescription = "VPN Client Device Driver Install Disk" -Neo.Service.Name = "Neo_VPN78" -Neo.Service.DispName = "VPN Client Device Driver - VPN78" -Neo.Service.Desc = "VPN Client Adapter - VPN78" -NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN78" -Neo.EventLog.Name = "Neo" -NetworkAddress = "MAC Address" -DefaultAddress = "000001000001" -MaxSpeed = "Indicate Speed (Mbps)" -KeepLink = "Keep Link" -On = "On" -Off = "Off" - - -; Auto Generated 20180205_163617.831 - +; VPN Client Device Driver for Windows 2000 and Greater +; +; Copyright (c) SoftEther Corporation. All Rights Reserved. +; http://www.softether.co.jp/ +; +; BUILD 9658 + +[Version] +Signature = "$Windows NT$" +Class = Net +ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} +Provider = %CompanyName% +DriverVer = 02/04/2018, 4.25.0.9658 +CatalogFile.NT = Neo6_x86_VPN78.cat + +[Manufacturer] +%CompanyName% = SoftEther + +[SourceDisksNames] +1=%DiskDescription%, "", , + +[SourceDisksFiles] +Neo6_x86_VPN78.sys = 1 + +[DestinationDirs] +DefaultDestDir = 12 +Neo.CopyFiles.Sys = 12 + +[Neo.CopyFiles.Sys] +Neo6_x86_VPN78.sys, , , 2 + +[SoftEther] +%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN78 + +[NeoAdapter.Install] +Characteristics = 0x1 +AddReg = Neo.Reg, NeoAdapter.Ndi +CopyFiles = Neo.CopyFiles.Sys +*IfType = 53 +*MediaType = 0 +*PhysicalMediaType = 0 + +[NeoAdapter.Install.Services] +AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% + +[NeoAdapter.Ndi] +HKR, , NetworkAddress, 0, %DefaultAddress% +HKR, Ndi, DeviceID, , "NeoAdapter_VPN78" +HKR, , DevLoader, , ndis +HKR, , DeviceVxDs, , Neo6_x86_VPN78.sys +HKR, NDIS, LogDriverName, , "Neo_VPN78" +HKR, NDIS, MajorNdisVersion, 1, 5 +HKR, NDIS, MinorNdisVersion, 1, 0 +HKR, Ndi\Interfaces, DefUpper, , "ndis5" +HKR, Ndi\Interfaces, UpperRange, , "ndis5" +HKR, Ndi\Interfaces, LowerRange, , "ethernet" +HKR, Ndi\Interfaces, DefLower, , "ethernet" +HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" +HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% +HKR, Ndi\Params\NetworkAddress, type, 0, "edit" +HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" +HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" +HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% +HKR, Ndi\Params\NetworkAddress, optional, 0, "0" +HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% +HKR, Ndi\Params\MaxSpeed, type, 0, "int" +HKR, Ndi\Params\MaxSpeed, default, 0, "100" +HKR, Ndi\Params\MaxSpeed, min, 0, "0" +HKR, Ndi\Params\MaxSpeed, max, 0, "2000" +HKR, Ndi\Params\MaxSpeed, step, 0, "1" +HKR, Ndi\Params\MaxSpeed, Base, 0, "10" +HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% +HKR, Ndi\Params\KeepLink, type, 0, "enum" +HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% +HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% +HKR, Ndi\Params\KeepLink, default, 0, "0" + + +[Neo.Service] +DisplayName = %Neo.Service.DispName% +Description = %Neo.Service.Desc% +ServiceType = 1 +StartType = 3 +ErrorControl = 1 +ServiceBinary = %12%\Neo6_x86_VPN78.sys +LoadOrderGroup = NDIS + +[Neo.Reg] +HKR, Ndi, Service, 0, Neo.Service.Name +HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" +HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" + +[Neo.EventLog] +HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN78.sys" +HKR, , TypesSupported, 0x00010001, 7 + +[Strings] +CompanyName = "SoftEther Corporation" +DiskDescription = "VPN Client Device Driver Install Disk" +Neo.Service.Name = "Neo_VPN78" +Neo.Service.DispName = "VPN Client Device Driver - VPN78" +Neo.Service.Desc = "VPN Client Adapter - VPN78" +NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN78" +Neo.EventLog.Name = "Neo" +NetworkAddress = "MAC Address" +DefaultAddress = "000001000001" +MaxSpeed = "Indicate Speed (Mbps)" +KeepLink = "Keep Link" +On = "On" +Off = "Off" + + +; Auto Generated 20180205_163617.831 + diff --git a/src/bin/hamcore/DriverPackages/Neo6_Win10/x86/Neo6_x86_VPN79.inf b/src/bin/hamcore/DriverPackages/Neo6_Win10/x86/Neo6_x86_VPN79.inf index bc25f1a8..e7a80f81 100644 --- a/src/bin/hamcore/DriverPackages/Neo6_Win10/x86/Neo6_x86_VPN79.inf +++ b/src/bin/hamcore/DriverPackages/Neo6_Win10/x86/Neo6_x86_VPN79.inf @@ -1,114 +1,114 @@ -; VPN Client Device Driver for Windows 2000 and Greater -; -; Copyright (c) SoftEther Corporation. All Rights Reserved. -; http://www.softether.co.jp/ -; -; BUILD 9658 - -[Version] -Signature = "$Windows NT$" -Class = Net -ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} -Provider = %CompanyName% -DriverVer = 02/04/2018, 4.25.0.9658 -CatalogFile.NT = Neo6_x86_VPN79.cat - -[Manufacturer] -%CompanyName% = SoftEther - -[SourceDisksNames] -1=%DiskDescription%, "", , - -[SourceDisksFiles] -Neo6_x86_VPN79.sys = 1 - -[DestinationDirs] -DefaultDestDir = 12 -Neo.CopyFiles.Sys = 12 - -[Neo.CopyFiles.Sys] -Neo6_x86_VPN79.sys, , , 2 - -[SoftEther] -%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN79 - -[NeoAdapter.Install] -Characteristics = 0x1 -AddReg = Neo.Reg, NeoAdapter.Ndi -CopyFiles = Neo.CopyFiles.Sys -*IfType = 53 -*MediaType = 0 -*PhysicalMediaType = 0 - -[NeoAdapter.Install.Services] -AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% - -[NeoAdapter.Ndi] -HKR, , NetworkAddress, 0, %DefaultAddress% -HKR, Ndi, DeviceID, , "NeoAdapter_VPN79" -HKR, , DevLoader, , ndis -HKR, , DeviceVxDs, , Neo6_x86_VPN79.sys -HKR, NDIS, LogDriverName, , "Neo_VPN79" -HKR, NDIS, MajorNdisVersion, 1, 5 -HKR, NDIS, MinorNdisVersion, 1, 0 -HKR, Ndi\Interfaces, DefUpper, , "ndis5" -HKR, Ndi\Interfaces, UpperRange, , "ndis5" -HKR, Ndi\Interfaces, LowerRange, , "ethernet" -HKR, Ndi\Interfaces, DefLower, , "ethernet" -HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" -HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% -HKR, Ndi\Params\NetworkAddress, type, 0, "edit" -HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" -HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" -HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% -HKR, Ndi\Params\NetworkAddress, optional, 0, "0" -HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% -HKR, Ndi\Params\MaxSpeed, type, 0, "int" -HKR, Ndi\Params\MaxSpeed, default, 0, "100" -HKR, Ndi\Params\MaxSpeed, min, 0, "0" -HKR, Ndi\Params\MaxSpeed, max, 0, "2000" -HKR, Ndi\Params\MaxSpeed, step, 0, "1" -HKR, Ndi\Params\MaxSpeed, Base, 0, "10" -HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% -HKR, Ndi\Params\KeepLink, type, 0, "enum" -HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% -HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% -HKR, Ndi\Params\KeepLink, default, 0, "0" - - -[Neo.Service] -DisplayName = %Neo.Service.DispName% -Description = %Neo.Service.Desc% -ServiceType = 1 -StartType = 3 -ErrorControl = 1 -ServiceBinary = %12%\Neo6_x86_VPN79.sys -LoadOrderGroup = NDIS - -[Neo.Reg] -HKR, Ndi, Service, 0, Neo.Service.Name -HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" -HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" - -[Neo.EventLog] -HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN79.sys" -HKR, , TypesSupported, 0x00010001, 7 - -[Strings] -CompanyName = "SoftEther Corporation" -DiskDescription = "VPN Client Device Driver Install Disk" -Neo.Service.Name = "Neo_VPN79" -Neo.Service.DispName = "VPN Client Device Driver - VPN79" -Neo.Service.Desc = "VPN Client Adapter - VPN79" -NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN79" -Neo.EventLog.Name = "Neo" -NetworkAddress = "MAC Address" -DefaultAddress = "000001000001" -MaxSpeed = "Indicate Speed (Mbps)" -KeepLink = "Keep Link" -On = "On" -Off = "Off" - - -; Auto Generated 20180205_163617.901 - +; VPN Client Device Driver for Windows 2000 and Greater +; +; Copyright (c) SoftEther Corporation. All Rights Reserved. +; http://www.softether.co.jp/ +; +; BUILD 9658 + +[Version] +Signature = "$Windows NT$" +Class = Net +ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} +Provider = %CompanyName% +DriverVer = 02/04/2018, 4.25.0.9658 +CatalogFile.NT = Neo6_x86_VPN79.cat + +[Manufacturer] +%CompanyName% = SoftEther + +[SourceDisksNames] +1=%DiskDescription%, "", , + +[SourceDisksFiles] +Neo6_x86_VPN79.sys = 1 + +[DestinationDirs] +DefaultDestDir = 12 +Neo.CopyFiles.Sys = 12 + +[Neo.CopyFiles.Sys] +Neo6_x86_VPN79.sys, , , 2 + +[SoftEther] +%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN79 + +[NeoAdapter.Install] +Characteristics = 0x1 +AddReg = Neo.Reg, NeoAdapter.Ndi +CopyFiles = Neo.CopyFiles.Sys +*IfType = 53 +*MediaType = 0 +*PhysicalMediaType = 0 + +[NeoAdapter.Install.Services] +AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% + +[NeoAdapter.Ndi] +HKR, , NetworkAddress, 0, %DefaultAddress% +HKR, Ndi, DeviceID, , "NeoAdapter_VPN79" +HKR, , DevLoader, , ndis +HKR, , DeviceVxDs, , Neo6_x86_VPN79.sys +HKR, NDIS, LogDriverName, , "Neo_VPN79" +HKR, NDIS, MajorNdisVersion, 1, 5 +HKR, NDIS, MinorNdisVersion, 1, 0 +HKR, Ndi\Interfaces, DefUpper, , "ndis5" +HKR, Ndi\Interfaces, UpperRange, , "ndis5" +HKR, Ndi\Interfaces, LowerRange, , "ethernet" +HKR, Ndi\Interfaces, DefLower, , "ethernet" +HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" +HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% +HKR, Ndi\Params\NetworkAddress, type, 0, "edit" +HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" +HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" +HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% +HKR, Ndi\Params\NetworkAddress, optional, 0, "0" +HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% +HKR, Ndi\Params\MaxSpeed, type, 0, "int" +HKR, Ndi\Params\MaxSpeed, default, 0, "100" +HKR, Ndi\Params\MaxSpeed, min, 0, "0" +HKR, Ndi\Params\MaxSpeed, max, 0, "2000" +HKR, Ndi\Params\MaxSpeed, step, 0, "1" +HKR, Ndi\Params\MaxSpeed, Base, 0, "10" +HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% +HKR, Ndi\Params\KeepLink, type, 0, "enum" +HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% +HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% +HKR, Ndi\Params\KeepLink, default, 0, "0" + + +[Neo.Service] +DisplayName = %Neo.Service.DispName% +Description = %Neo.Service.Desc% +ServiceType = 1 +StartType = 3 +ErrorControl = 1 +ServiceBinary = %12%\Neo6_x86_VPN79.sys +LoadOrderGroup = NDIS + +[Neo.Reg] +HKR, Ndi, Service, 0, Neo.Service.Name +HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" +HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" + +[Neo.EventLog] +HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN79.sys" +HKR, , TypesSupported, 0x00010001, 7 + +[Strings] +CompanyName = "SoftEther Corporation" +DiskDescription = "VPN Client Device Driver Install Disk" +Neo.Service.Name = "Neo_VPN79" +Neo.Service.DispName = "VPN Client Device Driver - VPN79" +Neo.Service.Desc = "VPN Client Adapter - VPN79" +NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN79" +Neo.EventLog.Name = "Neo" +NetworkAddress = "MAC Address" +DefaultAddress = "000001000001" +MaxSpeed = "Indicate Speed (Mbps)" +KeepLink = "Keep Link" +On = "On" +Off = "Off" + + +; Auto Generated 20180205_163617.901 + diff --git a/src/bin/hamcore/DriverPackages/Neo6_Win10/x86/Neo6_x86_VPN8.inf b/src/bin/hamcore/DriverPackages/Neo6_Win10/x86/Neo6_x86_VPN8.inf index 9547baa4..e881d176 100644 --- a/src/bin/hamcore/DriverPackages/Neo6_Win10/x86/Neo6_x86_VPN8.inf +++ b/src/bin/hamcore/DriverPackages/Neo6_Win10/x86/Neo6_x86_VPN8.inf @@ -1,114 +1,114 @@ -; VPN Client Device Driver for Windows 2000 and Greater -; -; Copyright (c) SoftEther Corporation. All Rights Reserved. -; http://www.softether.co.jp/ -; -; BUILD 9658 - -[Version] -Signature = "$Windows NT$" -Class = Net -ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} -Provider = %CompanyName% -DriverVer = 02/04/2018, 4.25.0.9658 -CatalogFile.NT = Neo6_x86_VPN8.cat - -[Manufacturer] -%CompanyName% = SoftEther - -[SourceDisksNames] -1=%DiskDescription%, "", , - -[SourceDisksFiles] -Neo6_x86_VPN8.sys = 1 - -[DestinationDirs] -DefaultDestDir = 12 -Neo.CopyFiles.Sys = 12 - -[Neo.CopyFiles.Sys] -Neo6_x86_VPN8.sys, , , 2 - -[SoftEther] -%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN8 - -[NeoAdapter.Install] -Characteristics = 0x1 -AddReg = Neo.Reg, NeoAdapter.Ndi -CopyFiles = Neo.CopyFiles.Sys -*IfType = 53 -*MediaType = 0 -*PhysicalMediaType = 0 - -[NeoAdapter.Install.Services] -AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% - -[NeoAdapter.Ndi] -HKR, , NetworkAddress, 0, %DefaultAddress% -HKR, Ndi, DeviceID, , "NeoAdapter_VPN8" -HKR, , DevLoader, , ndis -HKR, , DeviceVxDs, , Neo6_x86_VPN8.sys -HKR, NDIS, LogDriverName, , "Neo_VPN8" -HKR, NDIS, MajorNdisVersion, 1, 5 -HKR, NDIS, MinorNdisVersion, 1, 0 -HKR, Ndi\Interfaces, DefUpper, , "ndis5" -HKR, Ndi\Interfaces, UpperRange, , "ndis5" -HKR, Ndi\Interfaces, LowerRange, , "ethernet" -HKR, Ndi\Interfaces, DefLower, , "ethernet" -HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" -HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% -HKR, Ndi\Params\NetworkAddress, type, 0, "edit" -HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" -HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" -HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% -HKR, Ndi\Params\NetworkAddress, optional, 0, "0" -HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% -HKR, Ndi\Params\MaxSpeed, type, 0, "int" -HKR, Ndi\Params\MaxSpeed, default, 0, "100" -HKR, Ndi\Params\MaxSpeed, min, 0, "0" -HKR, Ndi\Params\MaxSpeed, max, 0, "2000" -HKR, Ndi\Params\MaxSpeed, step, 0, "1" -HKR, Ndi\Params\MaxSpeed, Base, 0, "10" -HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% -HKR, Ndi\Params\KeepLink, type, 0, "enum" -HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% -HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% -HKR, Ndi\Params\KeepLink, default, 0, "0" - - -[Neo.Service] -DisplayName = %Neo.Service.DispName% -Description = %Neo.Service.Desc% -ServiceType = 1 -StartType = 3 -ErrorControl = 1 -ServiceBinary = %12%\Neo6_x86_VPN8.sys -LoadOrderGroup = NDIS - -[Neo.Reg] -HKR, Ndi, Service, 0, Neo.Service.Name -HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" -HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" - -[Neo.EventLog] -HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN8.sys" -HKR, , TypesSupported, 0x00010001, 7 - -[Strings] -CompanyName = "SoftEther Corporation" -DiskDescription = "VPN Client Device Driver Install Disk" -Neo.Service.Name = "Neo_VPN8" -Neo.Service.DispName = "VPN Client Device Driver - VPN8" -Neo.Service.Desc = "VPN Client Adapter - VPN8" -NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN8" -Neo.EventLog.Name = "Neo" -NetworkAddress = "MAC Address" -DefaultAddress = "000001000001" -MaxSpeed = "Indicate Speed (Mbps)" -KeepLink = "Keep Link" -On = "On" -Off = "Off" - - -; Auto Generated 20180205_163612.834 - +; VPN Client Device Driver for Windows 2000 and Greater +; +; Copyright (c) SoftEther Corporation. All Rights Reserved. +; http://www.softether.co.jp/ +; +; BUILD 9658 + +[Version] +Signature = "$Windows NT$" +Class = Net +ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} +Provider = %CompanyName% +DriverVer = 02/04/2018, 4.25.0.9658 +CatalogFile.NT = Neo6_x86_VPN8.cat + +[Manufacturer] +%CompanyName% = SoftEther + +[SourceDisksNames] +1=%DiskDescription%, "", , + +[SourceDisksFiles] +Neo6_x86_VPN8.sys = 1 + +[DestinationDirs] +DefaultDestDir = 12 +Neo.CopyFiles.Sys = 12 + +[Neo.CopyFiles.Sys] +Neo6_x86_VPN8.sys, , , 2 + +[SoftEther] +%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN8 + +[NeoAdapter.Install] +Characteristics = 0x1 +AddReg = Neo.Reg, NeoAdapter.Ndi +CopyFiles = Neo.CopyFiles.Sys +*IfType = 53 +*MediaType = 0 +*PhysicalMediaType = 0 + +[NeoAdapter.Install.Services] +AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% + +[NeoAdapter.Ndi] +HKR, , NetworkAddress, 0, %DefaultAddress% +HKR, Ndi, DeviceID, , "NeoAdapter_VPN8" +HKR, , DevLoader, , ndis +HKR, , DeviceVxDs, , Neo6_x86_VPN8.sys +HKR, NDIS, LogDriverName, , "Neo_VPN8" +HKR, NDIS, MajorNdisVersion, 1, 5 +HKR, NDIS, MinorNdisVersion, 1, 0 +HKR, Ndi\Interfaces, DefUpper, , "ndis5" +HKR, Ndi\Interfaces, UpperRange, , "ndis5" +HKR, Ndi\Interfaces, LowerRange, , "ethernet" +HKR, Ndi\Interfaces, DefLower, , "ethernet" +HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" +HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% +HKR, Ndi\Params\NetworkAddress, type, 0, "edit" +HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" +HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" +HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% +HKR, Ndi\Params\NetworkAddress, optional, 0, "0" +HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% +HKR, Ndi\Params\MaxSpeed, type, 0, "int" +HKR, Ndi\Params\MaxSpeed, default, 0, "100" +HKR, Ndi\Params\MaxSpeed, min, 0, "0" +HKR, Ndi\Params\MaxSpeed, max, 0, "2000" +HKR, Ndi\Params\MaxSpeed, step, 0, "1" +HKR, Ndi\Params\MaxSpeed, Base, 0, "10" +HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% +HKR, Ndi\Params\KeepLink, type, 0, "enum" +HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% +HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% +HKR, Ndi\Params\KeepLink, default, 0, "0" + + +[Neo.Service] +DisplayName = %Neo.Service.DispName% +Description = %Neo.Service.Desc% +ServiceType = 1 +StartType = 3 +ErrorControl = 1 +ServiceBinary = %12%\Neo6_x86_VPN8.sys +LoadOrderGroup = NDIS + +[Neo.Reg] +HKR, Ndi, Service, 0, Neo.Service.Name +HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" +HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" + +[Neo.EventLog] +HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN8.sys" +HKR, , TypesSupported, 0x00010001, 7 + +[Strings] +CompanyName = "SoftEther Corporation" +DiskDescription = "VPN Client Device Driver Install Disk" +Neo.Service.Name = "Neo_VPN8" +Neo.Service.DispName = "VPN Client Device Driver - VPN8" +Neo.Service.Desc = "VPN Client Adapter - VPN8" +NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN8" +Neo.EventLog.Name = "Neo" +NetworkAddress = "MAC Address" +DefaultAddress = "000001000001" +MaxSpeed = "Indicate Speed (Mbps)" +KeepLink = "Keep Link" +On = "On" +Off = "Off" + + +; Auto Generated 20180205_163612.834 + diff --git a/src/bin/hamcore/DriverPackages/Neo6_Win10/x86/Neo6_x86_VPN80.inf b/src/bin/hamcore/DriverPackages/Neo6_Win10/x86/Neo6_x86_VPN80.inf index a7b7e55a..a04d8cc4 100644 --- a/src/bin/hamcore/DriverPackages/Neo6_Win10/x86/Neo6_x86_VPN80.inf +++ b/src/bin/hamcore/DriverPackages/Neo6_Win10/x86/Neo6_x86_VPN80.inf @@ -1,114 +1,114 @@ -; VPN Client Device Driver for Windows 2000 and Greater -; -; Copyright (c) SoftEther Corporation. All Rights Reserved. -; http://www.softether.co.jp/ -; -; BUILD 9658 - -[Version] -Signature = "$Windows NT$" -Class = Net -ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} -Provider = %CompanyName% -DriverVer = 02/04/2018, 4.25.0.9658 -CatalogFile.NT = Neo6_x86_VPN80.cat - -[Manufacturer] -%CompanyName% = SoftEther - -[SourceDisksNames] -1=%DiskDescription%, "", , - -[SourceDisksFiles] -Neo6_x86_VPN80.sys = 1 - -[DestinationDirs] -DefaultDestDir = 12 -Neo.CopyFiles.Sys = 12 - -[Neo.CopyFiles.Sys] -Neo6_x86_VPN80.sys, , , 2 - -[SoftEther] -%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN80 - -[NeoAdapter.Install] -Characteristics = 0x1 -AddReg = Neo.Reg, NeoAdapter.Ndi -CopyFiles = Neo.CopyFiles.Sys -*IfType = 53 -*MediaType = 0 -*PhysicalMediaType = 0 - -[NeoAdapter.Install.Services] -AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% - -[NeoAdapter.Ndi] -HKR, , NetworkAddress, 0, %DefaultAddress% -HKR, Ndi, DeviceID, , "NeoAdapter_VPN80" -HKR, , DevLoader, , ndis -HKR, , DeviceVxDs, , Neo6_x86_VPN80.sys -HKR, NDIS, LogDriverName, , "Neo_VPN80" -HKR, NDIS, MajorNdisVersion, 1, 5 -HKR, NDIS, MinorNdisVersion, 1, 0 -HKR, Ndi\Interfaces, DefUpper, , "ndis5" -HKR, Ndi\Interfaces, UpperRange, , "ndis5" -HKR, Ndi\Interfaces, LowerRange, , "ethernet" -HKR, Ndi\Interfaces, DefLower, , "ethernet" -HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" -HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% -HKR, Ndi\Params\NetworkAddress, type, 0, "edit" -HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" -HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" -HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% -HKR, Ndi\Params\NetworkAddress, optional, 0, "0" -HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% -HKR, Ndi\Params\MaxSpeed, type, 0, "int" -HKR, Ndi\Params\MaxSpeed, default, 0, "100" -HKR, Ndi\Params\MaxSpeed, min, 0, "0" -HKR, Ndi\Params\MaxSpeed, max, 0, "2000" -HKR, Ndi\Params\MaxSpeed, step, 0, "1" -HKR, Ndi\Params\MaxSpeed, Base, 0, "10" -HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% -HKR, Ndi\Params\KeepLink, type, 0, "enum" -HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% -HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% -HKR, Ndi\Params\KeepLink, default, 0, "0" - - -[Neo.Service] -DisplayName = %Neo.Service.DispName% -Description = %Neo.Service.Desc% -ServiceType = 1 -StartType = 3 -ErrorControl = 1 -ServiceBinary = %12%\Neo6_x86_VPN80.sys -LoadOrderGroup = NDIS - -[Neo.Reg] -HKR, Ndi, Service, 0, Neo.Service.Name -HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" -HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" - -[Neo.EventLog] -HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN80.sys" -HKR, , TypesSupported, 0x00010001, 7 - -[Strings] -CompanyName = "SoftEther Corporation" -DiskDescription = "VPN Client Device Driver Install Disk" -Neo.Service.Name = "Neo_VPN80" -Neo.Service.DispName = "VPN Client Device Driver - VPN80" -Neo.Service.Desc = "VPN Client Adapter - VPN80" -NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN80" -Neo.EventLog.Name = "Neo" -NetworkAddress = "MAC Address" -DefaultAddress = "000001000001" -MaxSpeed = "Indicate Speed (Mbps)" -KeepLink = "Keep Link" -On = "On" -Off = "Off" - - -; Auto Generated 20180205_163617.971 - +; VPN Client Device Driver for Windows 2000 and Greater +; +; Copyright (c) SoftEther Corporation. All Rights Reserved. +; http://www.softether.co.jp/ +; +; BUILD 9658 + +[Version] +Signature = "$Windows NT$" +Class = Net +ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} +Provider = %CompanyName% +DriverVer = 02/04/2018, 4.25.0.9658 +CatalogFile.NT = Neo6_x86_VPN80.cat + +[Manufacturer] +%CompanyName% = SoftEther + +[SourceDisksNames] +1=%DiskDescription%, "", , + +[SourceDisksFiles] +Neo6_x86_VPN80.sys = 1 + +[DestinationDirs] +DefaultDestDir = 12 +Neo.CopyFiles.Sys = 12 + +[Neo.CopyFiles.Sys] +Neo6_x86_VPN80.sys, , , 2 + +[SoftEther] +%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN80 + +[NeoAdapter.Install] +Characteristics = 0x1 +AddReg = Neo.Reg, NeoAdapter.Ndi +CopyFiles = Neo.CopyFiles.Sys +*IfType = 53 +*MediaType = 0 +*PhysicalMediaType = 0 + +[NeoAdapter.Install.Services] +AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% + +[NeoAdapter.Ndi] +HKR, , NetworkAddress, 0, %DefaultAddress% +HKR, Ndi, DeviceID, , "NeoAdapter_VPN80" +HKR, , DevLoader, , ndis +HKR, , DeviceVxDs, , Neo6_x86_VPN80.sys +HKR, NDIS, LogDriverName, , "Neo_VPN80" +HKR, NDIS, MajorNdisVersion, 1, 5 +HKR, NDIS, MinorNdisVersion, 1, 0 +HKR, Ndi\Interfaces, DefUpper, , "ndis5" +HKR, Ndi\Interfaces, UpperRange, , "ndis5" +HKR, Ndi\Interfaces, LowerRange, , "ethernet" +HKR, Ndi\Interfaces, DefLower, , "ethernet" +HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" +HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% +HKR, Ndi\Params\NetworkAddress, type, 0, "edit" +HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" +HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" +HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% +HKR, Ndi\Params\NetworkAddress, optional, 0, "0" +HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% +HKR, Ndi\Params\MaxSpeed, type, 0, "int" +HKR, Ndi\Params\MaxSpeed, default, 0, "100" +HKR, Ndi\Params\MaxSpeed, min, 0, "0" +HKR, Ndi\Params\MaxSpeed, max, 0, "2000" +HKR, Ndi\Params\MaxSpeed, step, 0, "1" +HKR, Ndi\Params\MaxSpeed, Base, 0, "10" +HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% +HKR, Ndi\Params\KeepLink, type, 0, "enum" +HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% +HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% +HKR, Ndi\Params\KeepLink, default, 0, "0" + + +[Neo.Service] +DisplayName = %Neo.Service.DispName% +Description = %Neo.Service.Desc% +ServiceType = 1 +StartType = 3 +ErrorControl = 1 +ServiceBinary = %12%\Neo6_x86_VPN80.sys +LoadOrderGroup = NDIS + +[Neo.Reg] +HKR, Ndi, Service, 0, Neo.Service.Name +HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" +HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" + +[Neo.EventLog] +HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN80.sys" +HKR, , TypesSupported, 0x00010001, 7 + +[Strings] +CompanyName = "SoftEther Corporation" +DiskDescription = "VPN Client Device Driver Install Disk" +Neo.Service.Name = "Neo_VPN80" +Neo.Service.DispName = "VPN Client Device Driver - VPN80" +Neo.Service.Desc = "VPN Client Adapter - VPN80" +NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN80" +Neo.EventLog.Name = "Neo" +NetworkAddress = "MAC Address" +DefaultAddress = "000001000001" +MaxSpeed = "Indicate Speed (Mbps)" +KeepLink = "Keep Link" +On = "On" +Off = "Off" + + +; Auto Generated 20180205_163617.971 + diff --git a/src/bin/hamcore/DriverPackages/Neo6_Win10/x86/Neo6_x86_VPN81.inf b/src/bin/hamcore/DriverPackages/Neo6_Win10/x86/Neo6_x86_VPN81.inf index 1fcb8181..a29846bf 100644 --- a/src/bin/hamcore/DriverPackages/Neo6_Win10/x86/Neo6_x86_VPN81.inf +++ b/src/bin/hamcore/DriverPackages/Neo6_Win10/x86/Neo6_x86_VPN81.inf @@ -1,114 +1,114 @@ -; VPN Client Device Driver for Windows 2000 and Greater -; -; Copyright (c) SoftEther Corporation. All Rights Reserved. -; http://www.softether.co.jp/ -; -; BUILD 9658 - -[Version] -Signature = "$Windows NT$" -Class = Net -ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} -Provider = %CompanyName% -DriverVer = 02/04/2018, 4.25.0.9658 -CatalogFile.NT = Neo6_x86_VPN81.cat - -[Manufacturer] -%CompanyName% = SoftEther - -[SourceDisksNames] -1=%DiskDescription%, "", , - -[SourceDisksFiles] -Neo6_x86_VPN81.sys = 1 - -[DestinationDirs] -DefaultDestDir = 12 -Neo.CopyFiles.Sys = 12 - -[Neo.CopyFiles.Sys] -Neo6_x86_VPN81.sys, , , 2 - -[SoftEther] -%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN81 - -[NeoAdapter.Install] -Characteristics = 0x1 -AddReg = Neo.Reg, NeoAdapter.Ndi -CopyFiles = Neo.CopyFiles.Sys -*IfType = 53 -*MediaType = 0 -*PhysicalMediaType = 0 - -[NeoAdapter.Install.Services] -AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% - -[NeoAdapter.Ndi] -HKR, , NetworkAddress, 0, %DefaultAddress% -HKR, Ndi, DeviceID, , "NeoAdapter_VPN81" -HKR, , DevLoader, , ndis -HKR, , DeviceVxDs, , Neo6_x86_VPN81.sys -HKR, NDIS, LogDriverName, , "Neo_VPN81" -HKR, NDIS, MajorNdisVersion, 1, 5 -HKR, NDIS, MinorNdisVersion, 1, 0 -HKR, Ndi\Interfaces, DefUpper, , "ndis5" -HKR, Ndi\Interfaces, UpperRange, , "ndis5" -HKR, Ndi\Interfaces, LowerRange, , "ethernet" -HKR, Ndi\Interfaces, DefLower, , "ethernet" -HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" -HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% -HKR, Ndi\Params\NetworkAddress, type, 0, "edit" -HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" -HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" -HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% -HKR, Ndi\Params\NetworkAddress, optional, 0, "0" -HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% -HKR, Ndi\Params\MaxSpeed, type, 0, "int" -HKR, Ndi\Params\MaxSpeed, default, 0, "100" -HKR, Ndi\Params\MaxSpeed, min, 0, "0" -HKR, Ndi\Params\MaxSpeed, max, 0, "2000" -HKR, Ndi\Params\MaxSpeed, step, 0, "1" -HKR, Ndi\Params\MaxSpeed, Base, 0, "10" -HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% -HKR, Ndi\Params\KeepLink, type, 0, "enum" -HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% -HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% -HKR, Ndi\Params\KeepLink, default, 0, "0" - - -[Neo.Service] -DisplayName = %Neo.Service.DispName% -Description = %Neo.Service.Desc% -ServiceType = 1 -StartType = 3 -ErrorControl = 1 -ServiceBinary = %12%\Neo6_x86_VPN81.sys -LoadOrderGroup = NDIS - -[Neo.Reg] -HKR, Ndi, Service, 0, Neo.Service.Name -HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" -HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" - -[Neo.EventLog] -HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN81.sys" -HKR, , TypesSupported, 0x00010001, 7 - -[Strings] -CompanyName = "SoftEther Corporation" -DiskDescription = "VPN Client Device Driver Install Disk" -Neo.Service.Name = "Neo_VPN81" -Neo.Service.DispName = "VPN Client Device Driver - VPN81" -Neo.Service.Desc = "VPN Client Adapter - VPN81" -NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN81" -Neo.EventLog.Name = "Neo" -NetworkAddress = "MAC Address" -DefaultAddress = "000001000001" -MaxSpeed = "Indicate Speed (Mbps)" -KeepLink = "Keep Link" -On = "On" -Off = "Off" - - -; Auto Generated 20180205_163618.042 - +; VPN Client Device Driver for Windows 2000 and Greater +; +; Copyright (c) SoftEther Corporation. All Rights Reserved. +; http://www.softether.co.jp/ +; +; BUILD 9658 + +[Version] +Signature = "$Windows NT$" +Class = Net +ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} +Provider = %CompanyName% +DriverVer = 02/04/2018, 4.25.0.9658 +CatalogFile.NT = Neo6_x86_VPN81.cat + +[Manufacturer] +%CompanyName% = SoftEther + +[SourceDisksNames] +1=%DiskDescription%, "", , + +[SourceDisksFiles] +Neo6_x86_VPN81.sys = 1 + +[DestinationDirs] +DefaultDestDir = 12 +Neo.CopyFiles.Sys = 12 + +[Neo.CopyFiles.Sys] +Neo6_x86_VPN81.sys, , , 2 + +[SoftEther] +%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN81 + +[NeoAdapter.Install] +Characteristics = 0x1 +AddReg = Neo.Reg, NeoAdapter.Ndi +CopyFiles = Neo.CopyFiles.Sys +*IfType = 53 +*MediaType = 0 +*PhysicalMediaType = 0 + +[NeoAdapter.Install.Services] +AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% + +[NeoAdapter.Ndi] +HKR, , NetworkAddress, 0, %DefaultAddress% +HKR, Ndi, DeviceID, , "NeoAdapter_VPN81" +HKR, , DevLoader, , ndis +HKR, , DeviceVxDs, , Neo6_x86_VPN81.sys +HKR, NDIS, LogDriverName, , "Neo_VPN81" +HKR, NDIS, MajorNdisVersion, 1, 5 +HKR, NDIS, MinorNdisVersion, 1, 0 +HKR, Ndi\Interfaces, DefUpper, , "ndis5" +HKR, Ndi\Interfaces, UpperRange, , "ndis5" +HKR, Ndi\Interfaces, LowerRange, , "ethernet" +HKR, Ndi\Interfaces, DefLower, , "ethernet" +HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" +HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% +HKR, Ndi\Params\NetworkAddress, type, 0, "edit" +HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" +HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" +HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% +HKR, Ndi\Params\NetworkAddress, optional, 0, "0" +HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% +HKR, Ndi\Params\MaxSpeed, type, 0, "int" +HKR, Ndi\Params\MaxSpeed, default, 0, "100" +HKR, Ndi\Params\MaxSpeed, min, 0, "0" +HKR, Ndi\Params\MaxSpeed, max, 0, "2000" +HKR, Ndi\Params\MaxSpeed, step, 0, "1" +HKR, Ndi\Params\MaxSpeed, Base, 0, "10" +HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% +HKR, Ndi\Params\KeepLink, type, 0, "enum" +HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% +HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% +HKR, Ndi\Params\KeepLink, default, 0, "0" + + +[Neo.Service] +DisplayName = %Neo.Service.DispName% +Description = %Neo.Service.Desc% +ServiceType = 1 +StartType = 3 +ErrorControl = 1 +ServiceBinary = %12%\Neo6_x86_VPN81.sys +LoadOrderGroup = NDIS + +[Neo.Reg] +HKR, Ndi, Service, 0, Neo.Service.Name +HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" +HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" + +[Neo.EventLog] +HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN81.sys" +HKR, , TypesSupported, 0x00010001, 7 + +[Strings] +CompanyName = "SoftEther Corporation" +DiskDescription = "VPN Client Device Driver Install Disk" +Neo.Service.Name = "Neo_VPN81" +Neo.Service.DispName = "VPN Client Device Driver - VPN81" +Neo.Service.Desc = "VPN Client Adapter - VPN81" +NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN81" +Neo.EventLog.Name = "Neo" +NetworkAddress = "MAC Address" +DefaultAddress = "000001000001" +MaxSpeed = "Indicate Speed (Mbps)" +KeepLink = "Keep Link" +On = "On" +Off = "Off" + + +; Auto Generated 20180205_163618.042 + diff --git a/src/bin/hamcore/DriverPackages/Neo6_Win10/x86/Neo6_x86_VPN82.inf b/src/bin/hamcore/DriverPackages/Neo6_Win10/x86/Neo6_x86_VPN82.inf index bea5dc58..9628d846 100644 --- a/src/bin/hamcore/DriverPackages/Neo6_Win10/x86/Neo6_x86_VPN82.inf +++ b/src/bin/hamcore/DriverPackages/Neo6_Win10/x86/Neo6_x86_VPN82.inf @@ -1,114 +1,114 @@ -; VPN Client Device Driver for Windows 2000 and Greater -; -; Copyright (c) SoftEther Corporation. All Rights Reserved. -; http://www.softether.co.jp/ -; -; BUILD 9658 - -[Version] -Signature = "$Windows NT$" -Class = Net -ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} -Provider = %CompanyName% -DriverVer = 02/04/2018, 4.25.0.9658 -CatalogFile.NT = Neo6_x86_VPN82.cat - -[Manufacturer] -%CompanyName% = SoftEther - -[SourceDisksNames] -1=%DiskDescription%, "", , - -[SourceDisksFiles] -Neo6_x86_VPN82.sys = 1 - -[DestinationDirs] -DefaultDestDir = 12 -Neo.CopyFiles.Sys = 12 - -[Neo.CopyFiles.Sys] -Neo6_x86_VPN82.sys, , , 2 - -[SoftEther] -%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN82 - -[NeoAdapter.Install] -Characteristics = 0x1 -AddReg = Neo.Reg, NeoAdapter.Ndi -CopyFiles = Neo.CopyFiles.Sys -*IfType = 53 -*MediaType = 0 -*PhysicalMediaType = 0 - -[NeoAdapter.Install.Services] -AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% - -[NeoAdapter.Ndi] -HKR, , NetworkAddress, 0, %DefaultAddress% -HKR, Ndi, DeviceID, , "NeoAdapter_VPN82" -HKR, , DevLoader, , ndis -HKR, , DeviceVxDs, , Neo6_x86_VPN82.sys -HKR, NDIS, LogDriverName, , "Neo_VPN82" -HKR, NDIS, MajorNdisVersion, 1, 5 -HKR, NDIS, MinorNdisVersion, 1, 0 -HKR, Ndi\Interfaces, DefUpper, , "ndis5" -HKR, Ndi\Interfaces, UpperRange, , "ndis5" -HKR, Ndi\Interfaces, LowerRange, , "ethernet" -HKR, Ndi\Interfaces, DefLower, , "ethernet" -HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" -HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% -HKR, Ndi\Params\NetworkAddress, type, 0, "edit" -HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" -HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" -HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% -HKR, Ndi\Params\NetworkAddress, optional, 0, "0" -HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% -HKR, Ndi\Params\MaxSpeed, type, 0, "int" -HKR, Ndi\Params\MaxSpeed, default, 0, "100" -HKR, Ndi\Params\MaxSpeed, min, 0, "0" -HKR, Ndi\Params\MaxSpeed, max, 0, "2000" -HKR, Ndi\Params\MaxSpeed, step, 0, "1" -HKR, Ndi\Params\MaxSpeed, Base, 0, "10" -HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% -HKR, Ndi\Params\KeepLink, type, 0, "enum" -HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% -HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% -HKR, Ndi\Params\KeepLink, default, 0, "0" - - -[Neo.Service] -DisplayName = %Neo.Service.DispName% -Description = %Neo.Service.Desc% -ServiceType = 1 -StartType = 3 -ErrorControl = 1 -ServiceBinary = %12%\Neo6_x86_VPN82.sys -LoadOrderGroup = NDIS - -[Neo.Reg] -HKR, Ndi, Service, 0, Neo.Service.Name -HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" -HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" - -[Neo.EventLog] -HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN82.sys" -HKR, , TypesSupported, 0x00010001, 7 - -[Strings] -CompanyName = "SoftEther Corporation" -DiskDescription = "VPN Client Device Driver Install Disk" -Neo.Service.Name = "Neo_VPN82" -Neo.Service.DispName = "VPN Client Device Driver - VPN82" -Neo.Service.Desc = "VPN Client Adapter - VPN82" -NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN82" -Neo.EventLog.Name = "Neo" -NetworkAddress = "MAC Address" -DefaultAddress = "000001000001" -MaxSpeed = "Indicate Speed (Mbps)" -KeepLink = "Keep Link" -On = "On" -Off = "Off" - - -; Auto Generated 20180205_163618.113 - +; VPN Client Device Driver for Windows 2000 and Greater +; +; Copyright (c) SoftEther Corporation. All Rights Reserved. +; http://www.softether.co.jp/ +; +; BUILD 9658 + +[Version] +Signature = "$Windows NT$" +Class = Net +ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} +Provider = %CompanyName% +DriverVer = 02/04/2018, 4.25.0.9658 +CatalogFile.NT = Neo6_x86_VPN82.cat + +[Manufacturer] +%CompanyName% = SoftEther + +[SourceDisksNames] +1=%DiskDescription%, "", , + +[SourceDisksFiles] +Neo6_x86_VPN82.sys = 1 + +[DestinationDirs] +DefaultDestDir = 12 +Neo.CopyFiles.Sys = 12 + +[Neo.CopyFiles.Sys] +Neo6_x86_VPN82.sys, , , 2 + +[SoftEther] +%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN82 + +[NeoAdapter.Install] +Characteristics = 0x1 +AddReg = Neo.Reg, NeoAdapter.Ndi +CopyFiles = Neo.CopyFiles.Sys +*IfType = 53 +*MediaType = 0 +*PhysicalMediaType = 0 + +[NeoAdapter.Install.Services] +AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% + +[NeoAdapter.Ndi] +HKR, , NetworkAddress, 0, %DefaultAddress% +HKR, Ndi, DeviceID, , "NeoAdapter_VPN82" +HKR, , DevLoader, , ndis +HKR, , DeviceVxDs, , Neo6_x86_VPN82.sys +HKR, NDIS, LogDriverName, , "Neo_VPN82" +HKR, NDIS, MajorNdisVersion, 1, 5 +HKR, NDIS, MinorNdisVersion, 1, 0 +HKR, Ndi\Interfaces, DefUpper, , "ndis5" +HKR, Ndi\Interfaces, UpperRange, , "ndis5" +HKR, Ndi\Interfaces, LowerRange, , "ethernet" +HKR, Ndi\Interfaces, DefLower, , "ethernet" +HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" +HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% +HKR, Ndi\Params\NetworkAddress, type, 0, "edit" +HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" +HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" +HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% +HKR, Ndi\Params\NetworkAddress, optional, 0, "0" +HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% +HKR, Ndi\Params\MaxSpeed, type, 0, "int" +HKR, Ndi\Params\MaxSpeed, default, 0, "100" +HKR, Ndi\Params\MaxSpeed, min, 0, "0" +HKR, Ndi\Params\MaxSpeed, max, 0, "2000" +HKR, Ndi\Params\MaxSpeed, step, 0, "1" +HKR, Ndi\Params\MaxSpeed, Base, 0, "10" +HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% +HKR, Ndi\Params\KeepLink, type, 0, "enum" +HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% +HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% +HKR, Ndi\Params\KeepLink, default, 0, "0" + + +[Neo.Service] +DisplayName = %Neo.Service.DispName% +Description = %Neo.Service.Desc% +ServiceType = 1 +StartType = 3 +ErrorControl = 1 +ServiceBinary = %12%\Neo6_x86_VPN82.sys +LoadOrderGroup = NDIS + +[Neo.Reg] +HKR, Ndi, Service, 0, Neo.Service.Name +HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" +HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" + +[Neo.EventLog] +HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN82.sys" +HKR, , TypesSupported, 0x00010001, 7 + +[Strings] +CompanyName = "SoftEther Corporation" +DiskDescription = "VPN Client Device Driver Install Disk" +Neo.Service.Name = "Neo_VPN82" +Neo.Service.DispName = "VPN Client Device Driver - VPN82" +Neo.Service.Desc = "VPN Client Adapter - VPN82" +NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN82" +Neo.EventLog.Name = "Neo" +NetworkAddress = "MAC Address" +DefaultAddress = "000001000001" +MaxSpeed = "Indicate Speed (Mbps)" +KeepLink = "Keep Link" +On = "On" +Off = "Off" + + +; Auto Generated 20180205_163618.113 + diff --git a/src/bin/hamcore/DriverPackages/Neo6_Win10/x86/Neo6_x86_VPN83.inf b/src/bin/hamcore/DriverPackages/Neo6_Win10/x86/Neo6_x86_VPN83.inf index 021b3a6f..d01f4f7c 100644 --- a/src/bin/hamcore/DriverPackages/Neo6_Win10/x86/Neo6_x86_VPN83.inf +++ b/src/bin/hamcore/DriverPackages/Neo6_Win10/x86/Neo6_x86_VPN83.inf @@ -1,114 +1,114 @@ -; VPN Client Device Driver for Windows 2000 and Greater -; -; Copyright (c) SoftEther Corporation. All Rights Reserved. -; http://www.softether.co.jp/ -; -; BUILD 9658 - -[Version] -Signature = "$Windows NT$" -Class = Net -ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} -Provider = %CompanyName% -DriverVer = 02/04/2018, 4.25.0.9658 -CatalogFile.NT = Neo6_x86_VPN83.cat - -[Manufacturer] -%CompanyName% = SoftEther - -[SourceDisksNames] -1=%DiskDescription%, "", , - -[SourceDisksFiles] -Neo6_x86_VPN83.sys = 1 - -[DestinationDirs] -DefaultDestDir = 12 -Neo.CopyFiles.Sys = 12 - -[Neo.CopyFiles.Sys] -Neo6_x86_VPN83.sys, , , 2 - -[SoftEther] -%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN83 - -[NeoAdapter.Install] -Characteristics = 0x1 -AddReg = Neo.Reg, NeoAdapter.Ndi -CopyFiles = Neo.CopyFiles.Sys -*IfType = 53 -*MediaType = 0 -*PhysicalMediaType = 0 - -[NeoAdapter.Install.Services] -AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% - -[NeoAdapter.Ndi] -HKR, , NetworkAddress, 0, %DefaultAddress% -HKR, Ndi, DeviceID, , "NeoAdapter_VPN83" -HKR, , DevLoader, , ndis -HKR, , DeviceVxDs, , Neo6_x86_VPN83.sys -HKR, NDIS, LogDriverName, , "Neo_VPN83" -HKR, NDIS, MajorNdisVersion, 1, 5 -HKR, NDIS, MinorNdisVersion, 1, 0 -HKR, Ndi\Interfaces, DefUpper, , "ndis5" -HKR, Ndi\Interfaces, UpperRange, , "ndis5" -HKR, Ndi\Interfaces, LowerRange, , "ethernet" -HKR, Ndi\Interfaces, DefLower, , "ethernet" -HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" -HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% -HKR, Ndi\Params\NetworkAddress, type, 0, "edit" -HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" -HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" -HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% -HKR, Ndi\Params\NetworkAddress, optional, 0, "0" -HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% -HKR, Ndi\Params\MaxSpeed, type, 0, "int" -HKR, Ndi\Params\MaxSpeed, default, 0, "100" -HKR, Ndi\Params\MaxSpeed, min, 0, "0" -HKR, Ndi\Params\MaxSpeed, max, 0, "2000" -HKR, Ndi\Params\MaxSpeed, step, 0, "1" -HKR, Ndi\Params\MaxSpeed, Base, 0, "10" -HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% -HKR, Ndi\Params\KeepLink, type, 0, "enum" -HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% -HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% -HKR, Ndi\Params\KeepLink, default, 0, "0" - - -[Neo.Service] -DisplayName = %Neo.Service.DispName% -Description = %Neo.Service.Desc% -ServiceType = 1 -StartType = 3 -ErrorControl = 1 -ServiceBinary = %12%\Neo6_x86_VPN83.sys -LoadOrderGroup = NDIS - -[Neo.Reg] -HKR, Ndi, Service, 0, Neo.Service.Name -HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" -HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" - -[Neo.EventLog] -HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN83.sys" -HKR, , TypesSupported, 0x00010001, 7 - -[Strings] -CompanyName = "SoftEther Corporation" -DiskDescription = "VPN Client Device Driver Install Disk" -Neo.Service.Name = "Neo_VPN83" -Neo.Service.DispName = "VPN Client Device Driver - VPN83" -Neo.Service.Desc = "VPN Client Adapter - VPN83" -NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN83" -Neo.EventLog.Name = "Neo" -NetworkAddress = "MAC Address" -DefaultAddress = "000001000001" -MaxSpeed = "Indicate Speed (Mbps)" -KeepLink = "Keep Link" -On = "On" -Off = "Off" - - -; Auto Generated 20180205_163618.184 - +; VPN Client Device Driver for Windows 2000 and Greater +; +; Copyright (c) SoftEther Corporation. All Rights Reserved. +; http://www.softether.co.jp/ +; +; BUILD 9658 + +[Version] +Signature = "$Windows NT$" +Class = Net +ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} +Provider = %CompanyName% +DriverVer = 02/04/2018, 4.25.0.9658 +CatalogFile.NT = Neo6_x86_VPN83.cat + +[Manufacturer] +%CompanyName% = SoftEther + +[SourceDisksNames] +1=%DiskDescription%, "", , + +[SourceDisksFiles] +Neo6_x86_VPN83.sys = 1 + +[DestinationDirs] +DefaultDestDir = 12 +Neo.CopyFiles.Sys = 12 + +[Neo.CopyFiles.Sys] +Neo6_x86_VPN83.sys, , , 2 + +[SoftEther] +%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN83 + +[NeoAdapter.Install] +Characteristics = 0x1 +AddReg = Neo.Reg, NeoAdapter.Ndi +CopyFiles = Neo.CopyFiles.Sys +*IfType = 53 +*MediaType = 0 +*PhysicalMediaType = 0 + +[NeoAdapter.Install.Services] +AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% + +[NeoAdapter.Ndi] +HKR, , NetworkAddress, 0, %DefaultAddress% +HKR, Ndi, DeviceID, , "NeoAdapter_VPN83" +HKR, , DevLoader, , ndis +HKR, , DeviceVxDs, , Neo6_x86_VPN83.sys +HKR, NDIS, LogDriverName, , "Neo_VPN83" +HKR, NDIS, MajorNdisVersion, 1, 5 +HKR, NDIS, MinorNdisVersion, 1, 0 +HKR, Ndi\Interfaces, DefUpper, , "ndis5" +HKR, Ndi\Interfaces, UpperRange, , "ndis5" +HKR, Ndi\Interfaces, LowerRange, , "ethernet" +HKR, Ndi\Interfaces, DefLower, , "ethernet" +HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" +HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% +HKR, Ndi\Params\NetworkAddress, type, 0, "edit" +HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" +HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" +HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% +HKR, Ndi\Params\NetworkAddress, optional, 0, "0" +HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% +HKR, Ndi\Params\MaxSpeed, type, 0, "int" +HKR, Ndi\Params\MaxSpeed, default, 0, "100" +HKR, Ndi\Params\MaxSpeed, min, 0, "0" +HKR, Ndi\Params\MaxSpeed, max, 0, "2000" +HKR, Ndi\Params\MaxSpeed, step, 0, "1" +HKR, Ndi\Params\MaxSpeed, Base, 0, "10" +HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% +HKR, Ndi\Params\KeepLink, type, 0, "enum" +HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% +HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% +HKR, Ndi\Params\KeepLink, default, 0, "0" + + +[Neo.Service] +DisplayName = %Neo.Service.DispName% +Description = %Neo.Service.Desc% +ServiceType = 1 +StartType = 3 +ErrorControl = 1 +ServiceBinary = %12%\Neo6_x86_VPN83.sys +LoadOrderGroup = NDIS + +[Neo.Reg] +HKR, Ndi, Service, 0, Neo.Service.Name +HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" +HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" + +[Neo.EventLog] +HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN83.sys" +HKR, , TypesSupported, 0x00010001, 7 + +[Strings] +CompanyName = "SoftEther Corporation" +DiskDescription = "VPN Client Device Driver Install Disk" +Neo.Service.Name = "Neo_VPN83" +Neo.Service.DispName = "VPN Client Device Driver - VPN83" +Neo.Service.Desc = "VPN Client Adapter - VPN83" +NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN83" +Neo.EventLog.Name = "Neo" +NetworkAddress = "MAC Address" +DefaultAddress = "000001000001" +MaxSpeed = "Indicate Speed (Mbps)" +KeepLink = "Keep Link" +On = "On" +Off = "Off" + + +; Auto Generated 20180205_163618.184 + diff --git a/src/bin/hamcore/DriverPackages/Neo6_Win10/x86/Neo6_x86_VPN84.inf b/src/bin/hamcore/DriverPackages/Neo6_Win10/x86/Neo6_x86_VPN84.inf index 2067e30a..6ced84e3 100644 --- a/src/bin/hamcore/DriverPackages/Neo6_Win10/x86/Neo6_x86_VPN84.inf +++ b/src/bin/hamcore/DriverPackages/Neo6_Win10/x86/Neo6_x86_VPN84.inf @@ -1,114 +1,114 @@ -; VPN Client Device Driver for Windows 2000 and Greater -; -; Copyright (c) SoftEther Corporation. All Rights Reserved. -; http://www.softether.co.jp/ -; -; BUILD 9658 - -[Version] -Signature = "$Windows NT$" -Class = Net -ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} -Provider = %CompanyName% -DriverVer = 02/04/2018, 4.25.0.9658 -CatalogFile.NT = Neo6_x86_VPN84.cat - -[Manufacturer] -%CompanyName% = SoftEther - -[SourceDisksNames] -1=%DiskDescription%, "", , - -[SourceDisksFiles] -Neo6_x86_VPN84.sys = 1 - -[DestinationDirs] -DefaultDestDir = 12 -Neo.CopyFiles.Sys = 12 - -[Neo.CopyFiles.Sys] -Neo6_x86_VPN84.sys, , , 2 - -[SoftEther] -%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN84 - -[NeoAdapter.Install] -Characteristics = 0x1 -AddReg = Neo.Reg, NeoAdapter.Ndi -CopyFiles = Neo.CopyFiles.Sys -*IfType = 53 -*MediaType = 0 -*PhysicalMediaType = 0 - -[NeoAdapter.Install.Services] -AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% - -[NeoAdapter.Ndi] -HKR, , NetworkAddress, 0, %DefaultAddress% -HKR, Ndi, DeviceID, , "NeoAdapter_VPN84" -HKR, , DevLoader, , ndis -HKR, , DeviceVxDs, , Neo6_x86_VPN84.sys -HKR, NDIS, LogDriverName, , "Neo_VPN84" -HKR, NDIS, MajorNdisVersion, 1, 5 -HKR, NDIS, MinorNdisVersion, 1, 0 -HKR, Ndi\Interfaces, DefUpper, , "ndis5" -HKR, Ndi\Interfaces, UpperRange, , "ndis5" -HKR, Ndi\Interfaces, LowerRange, , "ethernet" -HKR, Ndi\Interfaces, DefLower, , "ethernet" -HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" -HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% -HKR, Ndi\Params\NetworkAddress, type, 0, "edit" -HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" -HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" -HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% -HKR, Ndi\Params\NetworkAddress, optional, 0, "0" -HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% -HKR, Ndi\Params\MaxSpeed, type, 0, "int" -HKR, Ndi\Params\MaxSpeed, default, 0, "100" -HKR, Ndi\Params\MaxSpeed, min, 0, "0" -HKR, Ndi\Params\MaxSpeed, max, 0, "2000" -HKR, Ndi\Params\MaxSpeed, step, 0, "1" -HKR, Ndi\Params\MaxSpeed, Base, 0, "10" -HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% -HKR, Ndi\Params\KeepLink, type, 0, "enum" -HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% -HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% -HKR, Ndi\Params\KeepLink, default, 0, "0" - - -[Neo.Service] -DisplayName = %Neo.Service.DispName% -Description = %Neo.Service.Desc% -ServiceType = 1 -StartType = 3 -ErrorControl = 1 -ServiceBinary = %12%\Neo6_x86_VPN84.sys -LoadOrderGroup = NDIS - -[Neo.Reg] -HKR, Ndi, Service, 0, Neo.Service.Name -HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" -HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" - -[Neo.EventLog] -HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN84.sys" -HKR, , TypesSupported, 0x00010001, 7 - -[Strings] -CompanyName = "SoftEther Corporation" -DiskDescription = "VPN Client Device Driver Install Disk" -Neo.Service.Name = "Neo_VPN84" -Neo.Service.DispName = "VPN Client Device Driver - VPN84" -Neo.Service.Desc = "VPN Client Adapter - VPN84" -NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN84" -Neo.EventLog.Name = "Neo" -NetworkAddress = "MAC Address" -DefaultAddress = "000001000001" -MaxSpeed = "Indicate Speed (Mbps)" -KeepLink = "Keep Link" -On = "On" -Off = "Off" - - -; Auto Generated 20180205_163618.255 - +; VPN Client Device Driver for Windows 2000 and Greater +; +; Copyright (c) SoftEther Corporation. All Rights Reserved. +; http://www.softether.co.jp/ +; +; BUILD 9658 + +[Version] +Signature = "$Windows NT$" +Class = Net +ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} +Provider = %CompanyName% +DriverVer = 02/04/2018, 4.25.0.9658 +CatalogFile.NT = Neo6_x86_VPN84.cat + +[Manufacturer] +%CompanyName% = SoftEther + +[SourceDisksNames] +1=%DiskDescription%, "", , + +[SourceDisksFiles] +Neo6_x86_VPN84.sys = 1 + +[DestinationDirs] +DefaultDestDir = 12 +Neo.CopyFiles.Sys = 12 + +[Neo.CopyFiles.Sys] +Neo6_x86_VPN84.sys, , , 2 + +[SoftEther] +%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN84 + +[NeoAdapter.Install] +Characteristics = 0x1 +AddReg = Neo.Reg, NeoAdapter.Ndi +CopyFiles = Neo.CopyFiles.Sys +*IfType = 53 +*MediaType = 0 +*PhysicalMediaType = 0 + +[NeoAdapter.Install.Services] +AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% + +[NeoAdapter.Ndi] +HKR, , NetworkAddress, 0, %DefaultAddress% +HKR, Ndi, DeviceID, , "NeoAdapter_VPN84" +HKR, , DevLoader, , ndis +HKR, , DeviceVxDs, , Neo6_x86_VPN84.sys +HKR, NDIS, LogDriverName, , "Neo_VPN84" +HKR, NDIS, MajorNdisVersion, 1, 5 +HKR, NDIS, MinorNdisVersion, 1, 0 +HKR, Ndi\Interfaces, DefUpper, , "ndis5" +HKR, Ndi\Interfaces, UpperRange, , "ndis5" +HKR, Ndi\Interfaces, LowerRange, , "ethernet" +HKR, Ndi\Interfaces, DefLower, , "ethernet" +HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" +HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% +HKR, Ndi\Params\NetworkAddress, type, 0, "edit" +HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" +HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" +HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% +HKR, Ndi\Params\NetworkAddress, optional, 0, "0" +HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% +HKR, Ndi\Params\MaxSpeed, type, 0, "int" +HKR, Ndi\Params\MaxSpeed, default, 0, "100" +HKR, Ndi\Params\MaxSpeed, min, 0, "0" +HKR, Ndi\Params\MaxSpeed, max, 0, "2000" +HKR, Ndi\Params\MaxSpeed, step, 0, "1" +HKR, Ndi\Params\MaxSpeed, Base, 0, "10" +HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% +HKR, Ndi\Params\KeepLink, type, 0, "enum" +HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% +HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% +HKR, Ndi\Params\KeepLink, default, 0, "0" + + +[Neo.Service] +DisplayName = %Neo.Service.DispName% +Description = %Neo.Service.Desc% +ServiceType = 1 +StartType = 3 +ErrorControl = 1 +ServiceBinary = %12%\Neo6_x86_VPN84.sys +LoadOrderGroup = NDIS + +[Neo.Reg] +HKR, Ndi, Service, 0, Neo.Service.Name +HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" +HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" + +[Neo.EventLog] +HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN84.sys" +HKR, , TypesSupported, 0x00010001, 7 + +[Strings] +CompanyName = "SoftEther Corporation" +DiskDescription = "VPN Client Device Driver Install Disk" +Neo.Service.Name = "Neo_VPN84" +Neo.Service.DispName = "VPN Client Device Driver - VPN84" +Neo.Service.Desc = "VPN Client Adapter - VPN84" +NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN84" +Neo.EventLog.Name = "Neo" +NetworkAddress = "MAC Address" +DefaultAddress = "000001000001" +MaxSpeed = "Indicate Speed (Mbps)" +KeepLink = "Keep Link" +On = "On" +Off = "Off" + + +; Auto Generated 20180205_163618.255 + diff --git a/src/bin/hamcore/DriverPackages/Neo6_Win10/x86/Neo6_x86_VPN85.inf b/src/bin/hamcore/DriverPackages/Neo6_Win10/x86/Neo6_x86_VPN85.inf index 51d6b49a..d4a28d32 100644 --- a/src/bin/hamcore/DriverPackages/Neo6_Win10/x86/Neo6_x86_VPN85.inf +++ b/src/bin/hamcore/DriverPackages/Neo6_Win10/x86/Neo6_x86_VPN85.inf @@ -1,114 +1,114 @@ -; VPN Client Device Driver for Windows 2000 and Greater -; -; Copyright (c) SoftEther Corporation. All Rights Reserved. -; http://www.softether.co.jp/ -; -; BUILD 9658 - -[Version] -Signature = "$Windows NT$" -Class = Net -ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} -Provider = %CompanyName% -DriverVer = 02/04/2018, 4.25.0.9658 -CatalogFile.NT = Neo6_x86_VPN85.cat - -[Manufacturer] -%CompanyName% = SoftEther - -[SourceDisksNames] -1=%DiskDescription%, "", , - -[SourceDisksFiles] -Neo6_x86_VPN85.sys = 1 - -[DestinationDirs] -DefaultDestDir = 12 -Neo.CopyFiles.Sys = 12 - -[Neo.CopyFiles.Sys] -Neo6_x86_VPN85.sys, , , 2 - -[SoftEther] -%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN85 - -[NeoAdapter.Install] -Characteristics = 0x1 -AddReg = Neo.Reg, NeoAdapter.Ndi -CopyFiles = Neo.CopyFiles.Sys -*IfType = 53 -*MediaType = 0 -*PhysicalMediaType = 0 - -[NeoAdapter.Install.Services] -AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% - -[NeoAdapter.Ndi] -HKR, , NetworkAddress, 0, %DefaultAddress% -HKR, Ndi, DeviceID, , "NeoAdapter_VPN85" -HKR, , DevLoader, , ndis -HKR, , DeviceVxDs, , Neo6_x86_VPN85.sys -HKR, NDIS, LogDriverName, , "Neo_VPN85" -HKR, NDIS, MajorNdisVersion, 1, 5 -HKR, NDIS, MinorNdisVersion, 1, 0 -HKR, Ndi\Interfaces, DefUpper, , "ndis5" -HKR, Ndi\Interfaces, UpperRange, , "ndis5" -HKR, Ndi\Interfaces, LowerRange, , "ethernet" -HKR, Ndi\Interfaces, DefLower, , "ethernet" -HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" -HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% -HKR, Ndi\Params\NetworkAddress, type, 0, "edit" -HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" -HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" -HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% -HKR, Ndi\Params\NetworkAddress, optional, 0, "0" -HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% -HKR, Ndi\Params\MaxSpeed, type, 0, "int" -HKR, Ndi\Params\MaxSpeed, default, 0, "100" -HKR, Ndi\Params\MaxSpeed, min, 0, "0" -HKR, Ndi\Params\MaxSpeed, max, 0, "2000" -HKR, Ndi\Params\MaxSpeed, step, 0, "1" -HKR, Ndi\Params\MaxSpeed, Base, 0, "10" -HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% -HKR, Ndi\Params\KeepLink, type, 0, "enum" -HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% -HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% -HKR, Ndi\Params\KeepLink, default, 0, "0" - - -[Neo.Service] -DisplayName = %Neo.Service.DispName% -Description = %Neo.Service.Desc% -ServiceType = 1 -StartType = 3 -ErrorControl = 1 -ServiceBinary = %12%\Neo6_x86_VPN85.sys -LoadOrderGroup = NDIS - -[Neo.Reg] -HKR, Ndi, Service, 0, Neo.Service.Name -HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" -HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" - -[Neo.EventLog] -HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN85.sys" -HKR, , TypesSupported, 0x00010001, 7 - -[Strings] -CompanyName = "SoftEther Corporation" -DiskDescription = "VPN Client Device Driver Install Disk" -Neo.Service.Name = "Neo_VPN85" -Neo.Service.DispName = "VPN Client Device Driver - VPN85" -Neo.Service.Desc = "VPN Client Adapter - VPN85" -NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN85" -Neo.EventLog.Name = "Neo" -NetworkAddress = "MAC Address" -DefaultAddress = "000001000001" -MaxSpeed = "Indicate Speed (Mbps)" -KeepLink = "Keep Link" -On = "On" -Off = "Off" - - -; Auto Generated 20180205_163618.328 - +; VPN Client Device Driver for Windows 2000 and Greater +; +; Copyright (c) SoftEther Corporation. All Rights Reserved. +; http://www.softether.co.jp/ +; +; BUILD 9658 + +[Version] +Signature = "$Windows NT$" +Class = Net +ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} +Provider = %CompanyName% +DriverVer = 02/04/2018, 4.25.0.9658 +CatalogFile.NT = Neo6_x86_VPN85.cat + +[Manufacturer] +%CompanyName% = SoftEther + +[SourceDisksNames] +1=%DiskDescription%, "", , + +[SourceDisksFiles] +Neo6_x86_VPN85.sys = 1 + +[DestinationDirs] +DefaultDestDir = 12 +Neo.CopyFiles.Sys = 12 + +[Neo.CopyFiles.Sys] +Neo6_x86_VPN85.sys, , , 2 + +[SoftEther] +%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN85 + +[NeoAdapter.Install] +Characteristics = 0x1 +AddReg = Neo.Reg, NeoAdapter.Ndi +CopyFiles = Neo.CopyFiles.Sys +*IfType = 53 +*MediaType = 0 +*PhysicalMediaType = 0 + +[NeoAdapter.Install.Services] +AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% + +[NeoAdapter.Ndi] +HKR, , NetworkAddress, 0, %DefaultAddress% +HKR, Ndi, DeviceID, , "NeoAdapter_VPN85" +HKR, , DevLoader, , ndis +HKR, , DeviceVxDs, , Neo6_x86_VPN85.sys +HKR, NDIS, LogDriverName, , "Neo_VPN85" +HKR, NDIS, MajorNdisVersion, 1, 5 +HKR, NDIS, MinorNdisVersion, 1, 0 +HKR, Ndi\Interfaces, DefUpper, , "ndis5" +HKR, Ndi\Interfaces, UpperRange, , "ndis5" +HKR, Ndi\Interfaces, LowerRange, , "ethernet" +HKR, Ndi\Interfaces, DefLower, , "ethernet" +HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" +HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% +HKR, Ndi\Params\NetworkAddress, type, 0, "edit" +HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" +HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" +HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% +HKR, Ndi\Params\NetworkAddress, optional, 0, "0" +HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% +HKR, Ndi\Params\MaxSpeed, type, 0, "int" +HKR, Ndi\Params\MaxSpeed, default, 0, "100" +HKR, Ndi\Params\MaxSpeed, min, 0, "0" +HKR, Ndi\Params\MaxSpeed, max, 0, "2000" +HKR, Ndi\Params\MaxSpeed, step, 0, "1" +HKR, Ndi\Params\MaxSpeed, Base, 0, "10" +HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% +HKR, Ndi\Params\KeepLink, type, 0, "enum" +HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% +HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% +HKR, Ndi\Params\KeepLink, default, 0, "0" + + +[Neo.Service] +DisplayName = %Neo.Service.DispName% +Description = %Neo.Service.Desc% +ServiceType = 1 +StartType = 3 +ErrorControl = 1 +ServiceBinary = %12%\Neo6_x86_VPN85.sys +LoadOrderGroup = NDIS + +[Neo.Reg] +HKR, Ndi, Service, 0, Neo.Service.Name +HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" +HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" + +[Neo.EventLog] +HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN85.sys" +HKR, , TypesSupported, 0x00010001, 7 + +[Strings] +CompanyName = "SoftEther Corporation" +DiskDescription = "VPN Client Device Driver Install Disk" +Neo.Service.Name = "Neo_VPN85" +Neo.Service.DispName = "VPN Client Device Driver - VPN85" +Neo.Service.Desc = "VPN Client Adapter - VPN85" +NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN85" +Neo.EventLog.Name = "Neo" +NetworkAddress = "MAC Address" +DefaultAddress = "000001000001" +MaxSpeed = "Indicate Speed (Mbps)" +KeepLink = "Keep Link" +On = "On" +Off = "Off" + + +; Auto Generated 20180205_163618.328 + diff --git a/src/bin/hamcore/DriverPackages/Neo6_Win10/x86/Neo6_x86_VPN86.inf b/src/bin/hamcore/DriverPackages/Neo6_Win10/x86/Neo6_x86_VPN86.inf index 6f0d08d8..f89ca077 100644 --- a/src/bin/hamcore/DriverPackages/Neo6_Win10/x86/Neo6_x86_VPN86.inf +++ b/src/bin/hamcore/DriverPackages/Neo6_Win10/x86/Neo6_x86_VPN86.inf @@ -1,114 +1,114 @@ -; VPN Client Device Driver for Windows 2000 and Greater -; -; Copyright (c) SoftEther Corporation. All Rights Reserved. -; http://www.softether.co.jp/ -; -; BUILD 9658 - -[Version] -Signature = "$Windows NT$" -Class = Net -ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} -Provider = %CompanyName% -DriverVer = 02/04/2018, 4.25.0.9658 -CatalogFile.NT = Neo6_x86_VPN86.cat - -[Manufacturer] -%CompanyName% = SoftEther - -[SourceDisksNames] -1=%DiskDescription%, "", , - -[SourceDisksFiles] -Neo6_x86_VPN86.sys = 1 - -[DestinationDirs] -DefaultDestDir = 12 -Neo.CopyFiles.Sys = 12 - -[Neo.CopyFiles.Sys] -Neo6_x86_VPN86.sys, , , 2 - -[SoftEther] -%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN86 - -[NeoAdapter.Install] -Characteristics = 0x1 -AddReg = Neo.Reg, NeoAdapter.Ndi -CopyFiles = Neo.CopyFiles.Sys -*IfType = 53 -*MediaType = 0 -*PhysicalMediaType = 0 - -[NeoAdapter.Install.Services] -AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% - -[NeoAdapter.Ndi] -HKR, , NetworkAddress, 0, %DefaultAddress% -HKR, Ndi, DeviceID, , "NeoAdapter_VPN86" -HKR, , DevLoader, , ndis -HKR, , DeviceVxDs, , Neo6_x86_VPN86.sys -HKR, NDIS, LogDriverName, , "Neo_VPN86" -HKR, NDIS, MajorNdisVersion, 1, 5 -HKR, NDIS, MinorNdisVersion, 1, 0 -HKR, Ndi\Interfaces, DefUpper, , "ndis5" -HKR, Ndi\Interfaces, UpperRange, , "ndis5" -HKR, Ndi\Interfaces, LowerRange, , "ethernet" -HKR, Ndi\Interfaces, DefLower, , "ethernet" -HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" -HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% -HKR, Ndi\Params\NetworkAddress, type, 0, "edit" -HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" -HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" -HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% -HKR, Ndi\Params\NetworkAddress, optional, 0, "0" -HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% -HKR, Ndi\Params\MaxSpeed, type, 0, "int" -HKR, Ndi\Params\MaxSpeed, default, 0, "100" -HKR, Ndi\Params\MaxSpeed, min, 0, "0" -HKR, Ndi\Params\MaxSpeed, max, 0, "2000" -HKR, Ndi\Params\MaxSpeed, step, 0, "1" -HKR, Ndi\Params\MaxSpeed, Base, 0, "10" -HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% -HKR, Ndi\Params\KeepLink, type, 0, "enum" -HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% -HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% -HKR, Ndi\Params\KeepLink, default, 0, "0" - - -[Neo.Service] -DisplayName = %Neo.Service.DispName% -Description = %Neo.Service.Desc% -ServiceType = 1 -StartType = 3 -ErrorControl = 1 -ServiceBinary = %12%\Neo6_x86_VPN86.sys -LoadOrderGroup = NDIS - -[Neo.Reg] -HKR, Ndi, Service, 0, Neo.Service.Name -HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" -HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" - -[Neo.EventLog] -HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN86.sys" -HKR, , TypesSupported, 0x00010001, 7 - -[Strings] -CompanyName = "SoftEther Corporation" -DiskDescription = "VPN Client Device Driver Install Disk" -Neo.Service.Name = "Neo_VPN86" -Neo.Service.DispName = "VPN Client Device Driver - VPN86" -Neo.Service.Desc = "VPN Client Adapter - VPN86" -NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN86" -Neo.EventLog.Name = "Neo" -NetworkAddress = "MAC Address" -DefaultAddress = "000001000001" -MaxSpeed = "Indicate Speed (Mbps)" -KeepLink = "Keep Link" -On = "On" -Off = "Off" - - -; Auto Generated 20180205_163618.399 - +; VPN Client Device Driver for Windows 2000 and Greater +; +; Copyright (c) SoftEther Corporation. All Rights Reserved. +; http://www.softether.co.jp/ +; +; BUILD 9658 + +[Version] +Signature = "$Windows NT$" +Class = Net +ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} +Provider = %CompanyName% +DriverVer = 02/04/2018, 4.25.0.9658 +CatalogFile.NT = Neo6_x86_VPN86.cat + +[Manufacturer] +%CompanyName% = SoftEther + +[SourceDisksNames] +1=%DiskDescription%, "", , + +[SourceDisksFiles] +Neo6_x86_VPN86.sys = 1 + +[DestinationDirs] +DefaultDestDir = 12 +Neo.CopyFiles.Sys = 12 + +[Neo.CopyFiles.Sys] +Neo6_x86_VPN86.sys, , , 2 + +[SoftEther] +%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN86 + +[NeoAdapter.Install] +Characteristics = 0x1 +AddReg = Neo.Reg, NeoAdapter.Ndi +CopyFiles = Neo.CopyFiles.Sys +*IfType = 53 +*MediaType = 0 +*PhysicalMediaType = 0 + +[NeoAdapter.Install.Services] +AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% + +[NeoAdapter.Ndi] +HKR, , NetworkAddress, 0, %DefaultAddress% +HKR, Ndi, DeviceID, , "NeoAdapter_VPN86" +HKR, , DevLoader, , ndis +HKR, , DeviceVxDs, , Neo6_x86_VPN86.sys +HKR, NDIS, LogDriverName, , "Neo_VPN86" +HKR, NDIS, MajorNdisVersion, 1, 5 +HKR, NDIS, MinorNdisVersion, 1, 0 +HKR, Ndi\Interfaces, DefUpper, , "ndis5" +HKR, Ndi\Interfaces, UpperRange, , "ndis5" +HKR, Ndi\Interfaces, LowerRange, , "ethernet" +HKR, Ndi\Interfaces, DefLower, , "ethernet" +HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" +HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% +HKR, Ndi\Params\NetworkAddress, type, 0, "edit" +HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" +HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" +HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% +HKR, Ndi\Params\NetworkAddress, optional, 0, "0" +HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% +HKR, Ndi\Params\MaxSpeed, type, 0, "int" +HKR, Ndi\Params\MaxSpeed, default, 0, "100" +HKR, Ndi\Params\MaxSpeed, min, 0, "0" +HKR, Ndi\Params\MaxSpeed, max, 0, "2000" +HKR, Ndi\Params\MaxSpeed, step, 0, "1" +HKR, Ndi\Params\MaxSpeed, Base, 0, "10" +HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% +HKR, Ndi\Params\KeepLink, type, 0, "enum" +HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% +HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% +HKR, Ndi\Params\KeepLink, default, 0, "0" + + +[Neo.Service] +DisplayName = %Neo.Service.DispName% +Description = %Neo.Service.Desc% +ServiceType = 1 +StartType = 3 +ErrorControl = 1 +ServiceBinary = %12%\Neo6_x86_VPN86.sys +LoadOrderGroup = NDIS + +[Neo.Reg] +HKR, Ndi, Service, 0, Neo.Service.Name +HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" +HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" + +[Neo.EventLog] +HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN86.sys" +HKR, , TypesSupported, 0x00010001, 7 + +[Strings] +CompanyName = "SoftEther Corporation" +DiskDescription = "VPN Client Device Driver Install Disk" +Neo.Service.Name = "Neo_VPN86" +Neo.Service.DispName = "VPN Client Device Driver - VPN86" +Neo.Service.Desc = "VPN Client Adapter - VPN86" +NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN86" +Neo.EventLog.Name = "Neo" +NetworkAddress = "MAC Address" +DefaultAddress = "000001000001" +MaxSpeed = "Indicate Speed (Mbps)" +KeepLink = "Keep Link" +On = "On" +Off = "Off" + + +; Auto Generated 20180205_163618.399 + diff --git a/src/bin/hamcore/DriverPackages/Neo6_Win10/x86/Neo6_x86_VPN87.inf b/src/bin/hamcore/DriverPackages/Neo6_Win10/x86/Neo6_x86_VPN87.inf index edcf47c8..cc61c3ce 100644 --- a/src/bin/hamcore/DriverPackages/Neo6_Win10/x86/Neo6_x86_VPN87.inf +++ b/src/bin/hamcore/DriverPackages/Neo6_Win10/x86/Neo6_x86_VPN87.inf @@ -1,114 +1,114 @@ -; VPN Client Device Driver for Windows 2000 and Greater -; -; Copyright (c) SoftEther Corporation. All Rights Reserved. -; http://www.softether.co.jp/ -; -; BUILD 9658 - -[Version] -Signature = "$Windows NT$" -Class = Net -ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} -Provider = %CompanyName% -DriverVer = 02/04/2018, 4.25.0.9658 -CatalogFile.NT = Neo6_x86_VPN87.cat - -[Manufacturer] -%CompanyName% = SoftEther - -[SourceDisksNames] -1=%DiskDescription%, "", , - -[SourceDisksFiles] -Neo6_x86_VPN87.sys = 1 - -[DestinationDirs] -DefaultDestDir = 12 -Neo.CopyFiles.Sys = 12 - -[Neo.CopyFiles.Sys] -Neo6_x86_VPN87.sys, , , 2 - -[SoftEther] -%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN87 - -[NeoAdapter.Install] -Characteristics = 0x1 -AddReg = Neo.Reg, NeoAdapter.Ndi -CopyFiles = Neo.CopyFiles.Sys -*IfType = 53 -*MediaType = 0 -*PhysicalMediaType = 0 - -[NeoAdapter.Install.Services] -AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% - -[NeoAdapter.Ndi] -HKR, , NetworkAddress, 0, %DefaultAddress% -HKR, Ndi, DeviceID, , "NeoAdapter_VPN87" -HKR, , DevLoader, , ndis -HKR, , DeviceVxDs, , Neo6_x86_VPN87.sys -HKR, NDIS, LogDriverName, , "Neo_VPN87" -HKR, NDIS, MajorNdisVersion, 1, 5 -HKR, NDIS, MinorNdisVersion, 1, 0 -HKR, Ndi\Interfaces, DefUpper, , "ndis5" -HKR, Ndi\Interfaces, UpperRange, , "ndis5" -HKR, Ndi\Interfaces, LowerRange, , "ethernet" -HKR, Ndi\Interfaces, DefLower, , "ethernet" -HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" -HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% -HKR, Ndi\Params\NetworkAddress, type, 0, "edit" -HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" -HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" -HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% -HKR, Ndi\Params\NetworkAddress, optional, 0, "0" -HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% -HKR, Ndi\Params\MaxSpeed, type, 0, "int" -HKR, Ndi\Params\MaxSpeed, default, 0, "100" -HKR, Ndi\Params\MaxSpeed, min, 0, "0" -HKR, Ndi\Params\MaxSpeed, max, 0, "2000" -HKR, Ndi\Params\MaxSpeed, step, 0, "1" -HKR, Ndi\Params\MaxSpeed, Base, 0, "10" -HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% -HKR, Ndi\Params\KeepLink, type, 0, "enum" -HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% -HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% -HKR, Ndi\Params\KeepLink, default, 0, "0" - - -[Neo.Service] -DisplayName = %Neo.Service.DispName% -Description = %Neo.Service.Desc% -ServiceType = 1 -StartType = 3 -ErrorControl = 1 -ServiceBinary = %12%\Neo6_x86_VPN87.sys -LoadOrderGroup = NDIS - -[Neo.Reg] -HKR, Ndi, Service, 0, Neo.Service.Name -HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" -HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" - -[Neo.EventLog] -HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN87.sys" -HKR, , TypesSupported, 0x00010001, 7 - -[Strings] -CompanyName = "SoftEther Corporation" -DiskDescription = "VPN Client Device Driver Install Disk" -Neo.Service.Name = "Neo_VPN87" -Neo.Service.DispName = "VPN Client Device Driver - VPN87" -Neo.Service.Desc = "VPN Client Adapter - VPN87" -NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN87" -Neo.EventLog.Name = "Neo" -NetworkAddress = "MAC Address" -DefaultAddress = "000001000001" -MaxSpeed = "Indicate Speed (Mbps)" -KeepLink = "Keep Link" -On = "On" -Off = "Off" - - -; Auto Generated 20180205_163618.470 - +; VPN Client Device Driver for Windows 2000 and Greater +; +; Copyright (c) SoftEther Corporation. All Rights Reserved. +; http://www.softether.co.jp/ +; +; BUILD 9658 + +[Version] +Signature = "$Windows NT$" +Class = Net +ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} +Provider = %CompanyName% +DriverVer = 02/04/2018, 4.25.0.9658 +CatalogFile.NT = Neo6_x86_VPN87.cat + +[Manufacturer] +%CompanyName% = SoftEther + +[SourceDisksNames] +1=%DiskDescription%, "", , + +[SourceDisksFiles] +Neo6_x86_VPN87.sys = 1 + +[DestinationDirs] +DefaultDestDir = 12 +Neo.CopyFiles.Sys = 12 + +[Neo.CopyFiles.Sys] +Neo6_x86_VPN87.sys, , , 2 + +[SoftEther] +%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN87 + +[NeoAdapter.Install] +Characteristics = 0x1 +AddReg = Neo.Reg, NeoAdapter.Ndi +CopyFiles = Neo.CopyFiles.Sys +*IfType = 53 +*MediaType = 0 +*PhysicalMediaType = 0 + +[NeoAdapter.Install.Services] +AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% + +[NeoAdapter.Ndi] +HKR, , NetworkAddress, 0, %DefaultAddress% +HKR, Ndi, DeviceID, , "NeoAdapter_VPN87" +HKR, , DevLoader, , ndis +HKR, , DeviceVxDs, , Neo6_x86_VPN87.sys +HKR, NDIS, LogDriverName, , "Neo_VPN87" +HKR, NDIS, MajorNdisVersion, 1, 5 +HKR, NDIS, MinorNdisVersion, 1, 0 +HKR, Ndi\Interfaces, DefUpper, , "ndis5" +HKR, Ndi\Interfaces, UpperRange, , "ndis5" +HKR, Ndi\Interfaces, LowerRange, , "ethernet" +HKR, Ndi\Interfaces, DefLower, , "ethernet" +HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" +HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% +HKR, Ndi\Params\NetworkAddress, type, 0, "edit" +HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" +HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" +HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% +HKR, Ndi\Params\NetworkAddress, optional, 0, "0" +HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% +HKR, Ndi\Params\MaxSpeed, type, 0, "int" +HKR, Ndi\Params\MaxSpeed, default, 0, "100" +HKR, Ndi\Params\MaxSpeed, min, 0, "0" +HKR, Ndi\Params\MaxSpeed, max, 0, "2000" +HKR, Ndi\Params\MaxSpeed, step, 0, "1" +HKR, Ndi\Params\MaxSpeed, Base, 0, "10" +HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% +HKR, Ndi\Params\KeepLink, type, 0, "enum" +HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% +HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% +HKR, Ndi\Params\KeepLink, default, 0, "0" + + +[Neo.Service] +DisplayName = %Neo.Service.DispName% +Description = %Neo.Service.Desc% +ServiceType = 1 +StartType = 3 +ErrorControl = 1 +ServiceBinary = %12%\Neo6_x86_VPN87.sys +LoadOrderGroup = NDIS + +[Neo.Reg] +HKR, Ndi, Service, 0, Neo.Service.Name +HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" +HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" + +[Neo.EventLog] +HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN87.sys" +HKR, , TypesSupported, 0x00010001, 7 + +[Strings] +CompanyName = "SoftEther Corporation" +DiskDescription = "VPN Client Device Driver Install Disk" +Neo.Service.Name = "Neo_VPN87" +Neo.Service.DispName = "VPN Client Device Driver - VPN87" +Neo.Service.Desc = "VPN Client Adapter - VPN87" +NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN87" +Neo.EventLog.Name = "Neo" +NetworkAddress = "MAC Address" +DefaultAddress = "000001000001" +MaxSpeed = "Indicate Speed (Mbps)" +KeepLink = "Keep Link" +On = "On" +Off = "Off" + + +; Auto Generated 20180205_163618.470 + diff --git a/src/bin/hamcore/DriverPackages/Neo6_Win10/x86/Neo6_x86_VPN88.inf b/src/bin/hamcore/DriverPackages/Neo6_Win10/x86/Neo6_x86_VPN88.inf index 18cd74b0..5e70826a 100644 --- a/src/bin/hamcore/DriverPackages/Neo6_Win10/x86/Neo6_x86_VPN88.inf +++ b/src/bin/hamcore/DriverPackages/Neo6_Win10/x86/Neo6_x86_VPN88.inf @@ -1,114 +1,114 @@ -; VPN Client Device Driver for Windows 2000 and Greater -; -; Copyright (c) SoftEther Corporation. All Rights Reserved. -; http://www.softether.co.jp/ -; -; BUILD 9658 - -[Version] -Signature = "$Windows NT$" -Class = Net -ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} -Provider = %CompanyName% -DriverVer = 02/04/2018, 4.25.0.9658 -CatalogFile.NT = Neo6_x86_VPN88.cat - -[Manufacturer] -%CompanyName% = SoftEther - -[SourceDisksNames] -1=%DiskDescription%, "", , - -[SourceDisksFiles] -Neo6_x86_VPN88.sys = 1 - -[DestinationDirs] -DefaultDestDir = 12 -Neo.CopyFiles.Sys = 12 - -[Neo.CopyFiles.Sys] -Neo6_x86_VPN88.sys, , , 2 - -[SoftEther] -%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN88 - -[NeoAdapter.Install] -Characteristics = 0x1 -AddReg = Neo.Reg, NeoAdapter.Ndi -CopyFiles = Neo.CopyFiles.Sys -*IfType = 53 -*MediaType = 0 -*PhysicalMediaType = 0 - -[NeoAdapter.Install.Services] -AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% - -[NeoAdapter.Ndi] -HKR, , NetworkAddress, 0, %DefaultAddress% -HKR, Ndi, DeviceID, , "NeoAdapter_VPN88" -HKR, , DevLoader, , ndis -HKR, , DeviceVxDs, , Neo6_x86_VPN88.sys -HKR, NDIS, LogDriverName, , "Neo_VPN88" -HKR, NDIS, MajorNdisVersion, 1, 5 -HKR, NDIS, MinorNdisVersion, 1, 0 -HKR, Ndi\Interfaces, DefUpper, , "ndis5" -HKR, Ndi\Interfaces, UpperRange, , "ndis5" -HKR, Ndi\Interfaces, LowerRange, , "ethernet" -HKR, Ndi\Interfaces, DefLower, , "ethernet" -HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" -HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% -HKR, Ndi\Params\NetworkAddress, type, 0, "edit" -HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" -HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" -HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% -HKR, Ndi\Params\NetworkAddress, optional, 0, "0" -HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% -HKR, Ndi\Params\MaxSpeed, type, 0, "int" -HKR, Ndi\Params\MaxSpeed, default, 0, "100" -HKR, Ndi\Params\MaxSpeed, min, 0, "0" -HKR, Ndi\Params\MaxSpeed, max, 0, "2000" -HKR, Ndi\Params\MaxSpeed, step, 0, "1" -HKR, Ndi\Params\MaxSpeed, Base, 0, "10" -HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% -HKR, Ndi\Params\KeepLink, type, 0, "enum" -HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% -HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% -HKR, Ndi\Params\KeepLink, default, 0, "0" - - -[Neo.Service] -DisplayName = %Neo.Service.DispName% -Description = %Neo.Service.Desc% -ServiceType = 1 -StartType = 3 -ErrorControl = 1 -ServiceBinary = %12%\Neo6_x86_VPN88.sys -LoadOrderGroup = NDIS - -[Neo.Reg] -HKR, Ndi, Service, 0, Neo.Service.Name -HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" -HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" - -[Neo.EventLog] -HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN88.sys" -HKR, , TypesSupported, 0x00010001, 7 - -[Strings] -CompanyName = "SoftEther Corporation" -DiskDescription = "VPN Client Device Driver Install Disk" -Neo.Service.Name = "Neo_VPN88" -Neo.Service.DispName = "VPN Client Device Driver - VPN88" -Neo.Service.Desc = "VPN Client Adapter - VPN88" -NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN88" -Neo.EventLog.Name = "Neo" -NetworkAddress = "MAC Address" -DefaultAddress = "000001000001" -MaxSpeed = "Indicate Speed (Mbps)" -KeepLink = "Keep Link" -On = "On" -Off = "Off" - - -; Auto Generated 20180205_163618.541 - +; VPN Client Device Driver for Windows 2000 and Greater +; +; Copyright (c) SoftEther Corporation. All Rights Reserved. +; http://www.softether.co.jp/ +; +; BUILD 9658 + +[Version] +Signature = "$Windows NT$" +Class = Net +ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} +Provider = %CompanyName% +DriverVer = 02/04/2018, 4.25.0.9658 +CatalogFile.NT = Neo6_x86_VPN88.cat + +[Manufacturer] +%CompanyName% = SoftEther + +[SourceDisksNames] +1=%DiskDescription%, "", , + +[SourceDisksFiles] +Neo6_x86_VPN88.sys = 1 + +[DestinationDirs] +DefaultDestDir = 12 +Neo.CopyFiles.Sys = 12 + +[Neo.CopyFiles.Sys] +Neo6_x86_VPN88.sys, , , 2 + +[SoftEther] +%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN88 + +[NeoAdapter.Install] +Characteristics = 0x1 +AddReg = Neo.Reg, NeoAdapter.Ndi +CopyFiles = Neo.CopyFiles.Sys +*IfType = 53 +*MediaType = 0 +*PhysicalMediaType = 0 + +[NeoAdapter.Install.Services] +AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% + +[NeoAdapter.Ndi] +HKR, , NetworkAddress, 0, %DefaultAddress% +HKR, Ndi, DeviceID, , "NeoAdapter_VPN88" +HKR, , DevLoader, , ndis +HKR, , DeviceVxDs, , Neo6_x86_VPN88.sys +HKR, NDIS, LogDriverName, , "Neo_VPN88" +HKR, NDIS, MajorNdisVersion, 1, 5 +HKR, NDIS, MinorNdisVersion, 1, 0 +HKR, Ndi\Interfaces, DefUpper, , "ndis5" +HKR, Ndi\Interfaces, UpperRange, , "ndis5" +HKR, Ndi\Interfaces, LowerRange, , "ethernet" +HKR, Ndi\Interfaces, DefLower, , "ethernet" +HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" +HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% +HKR, Ndi\Params\NetworkAddress, type, 0, "edit" +HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" +HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" +HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% +HKR, Ndi\Params\NetworkAddress, optional, 0, "0" +HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% +HKR, Ndi\Params\MaxSpeed, type, 0, "int" +HKR, Ndi\Params\MaxSpeed, default, 0, "100" +HKR, Ndi\Params\MaxSpeed, min, 0, "0" +HKR, Ndi\Params\MaxSpeed, max, 0, "2000" +HKR, Ndi\Params\MaxSpeed, step, 0, "1" +HKR, Ndi\Params\MaxSpeed, Base, 0, "10" +HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% +HKR, Ndi\Params\KeepLink, type, 0, "enum" +HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% +HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% +HKR, Ndi\Params\KeepLink, default, 0, "0" + + +[Neo.Service] +DisplayName = %Neo.Service.DispName% +Description = %Neo.Service.Desc% +ServiceType = 1 +StartType = 3 +ErrorControl = 1 +ServiceBinary = %12%\Neo6_x86_VPN88.sys +LoadOrderGroup = NDIS + +[Neo.Reg] +HKR, Ndi, Service, 0, Neo.Service.Name +HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" +HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" + +[Neo.EventLog] +HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN88.sys" +HKR, , TypesSupported, 0x00010001, 7 + +[Strings] +CompanyName = "SoftEther Corporation" +DiskDescription = "VPN Client Device Driver Install Disk" +Neo.Service.Name = "Neo_VPN88" +Neo.Service.DispName = "VPN Client Device Driver - VPN88" +Neo.Service.Desc = "VPN Client Adapter - VPN88" +NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN88" +Neo.EventLog.Name = "Neo" +NetworkAddress = "MAC Address" +DefaultAddress = "000001000001" +MaxSpeed = "Indicate Speed (Mbps)" +KeepLink = "Keep Link" +On = "On" +Off = "Off" + + +; Auto Generated 20180205_163618.541 + diff --git a/src/bin/hamcore/DriverPackages/Neo6_Win10/x86/Neo6_x86_VPN89.inf b/src/bin/hamcore/DriverPackages/Neo6_Win10/x86/Neo6_x86_VPN89.inf index 892f0a88..3e9cedd1 100644 --- a/src/bin/hamcore/DriverPackages/Neo6_Win10/x86/Neo6_x86_VPN89.inf +++ b/src/bin/hamcore/DriverPackages/Neo6_Win10/x86/Neo6_x86_VPN89.inf @@ -1,114 +1,114 @@ -; VPN Client Device Driver for Windows 2000 and Greater -; -; Copyright (c) SoftEther Corporation. All Rights Reserved. -; http://www.softether.co.jp/ -; -; BUILD 9658 - -[Version] -Signature = "$Windows NT$" -Class = Net -ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} -Provider = %CompanyName% -DriverVer = 02/04/2018, 4.25.0.9658 -CatalogFile.NT = Neo6_x86_VPN89.cat - -[Manufacturer] -%CompanyName% = SoftEther - -[SourceDisksNames] -1=%DiskDescription%, "", , - -[SourceDisksFiles] -Neo6_x86_VPN89.sys = 1 - -[DestinationDirs] -DefaultDestDir = 12 -Neo.CopyFiles.Sys = 12 - -[Neo.CopyFiles.Sys] -Neo6_x86_VPN89.sys, , , 2 - -[SoftEther] -%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN89 - -[NeoAdapter.Install] -Characteristics = 0x1 -AddReg = Neo.Reg, NeoAdapter.Ndi -CopyFiles = Neo.CopyFiles.Sys -*IfType = 53 -*MediaType = 0 -*PhysicalMediaType = 0 - -[NeoAdapter.Install.Services] -AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% - -[NeoAdapter.Ndi] -HKR, , NetworkAddress, 0, %DefaultAddress% -HKR, Ndi, DeviceID, , "NeoAdapter_VPN89" -HKR, , DevLoader, , ndis -HKR, , DeviceVxDs, , Neo6_x86_VPN89.sys -HKR, NDIS, LogDriverName, , "Neo_VPN89" -HKR, NDIS, MajorNdisVersion, 1, 5 -HKR, NDIS, MinorNdisVersion, 1, 0 -HKR, Ndi\Interfaces, DefUpper, , "ndis5" -HKR, Ndi\Interfaces, UpperRange, , "ndis5" -HKR, Ndi\Interfaces, LowerRange, , "ethernet" -HKR, Ndi\Interfaces, DefLower, , "ethernet" -HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" -HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% -HKR, Ndi\Params\NetworkAddress, type, 0, "edit" -HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" -HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" -HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% -HKR, Ndi\Params\NetworkAddress, optional, 0, "0" -HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% -HKR, Ndi\Params\MaxSpeed, type, 0, "int" -HKR, Ndi\Params\MaxSpeed, default, 0, "100" -HKR, Ndi\Params\MaxSpeed, min, 0, "0" -HKR, Ndi\Params\MaxSpeed, max, 0, "2000" -HKR, Ndi\Params\MaxSpeed, step, 0, "1" -HKR, Ndi\Params\MaxSpeed, Base, 0, "10" -HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% -HKR, Ndi\Params\KeepLink, type, 0, "enum" -HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% -HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% -HKR, Ndi\Params\KeepLink, default, 0, "0" - - -[Neo.Service] -DisplayName = %Neo.Service.DispName% -Description = %Neo.Service.Desc% -ServiceType = 1 -StartType = 3 -ErrorControl = 1 -ServiceBinary = %12%\Neo6_x86_VPN89.sys -LoadOrderGroup = NDIS - -[Neo.Reg] -HKR, Ndi, Service, 0, Neo.Service.Name -HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" -HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" - -[Neo.EventLog] -HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN89.sys" -HKR, , TypesSupported, 0x00010001, 7 - -[Strings] -CompanyName = "SoftEther Corporation" -DiskDescription = "VPN Client Device Driver Install Disk" -Neo.Service.Name = "Neo_VPN89" -Neo.Service.DispName = "VPN Client Device Driver - VPN89" -Neo.Service.Desc = "VPN Client Adapter - VPN89" -NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN89" -Neo.EventLog.Name = "Neo" -NetworkAddress = "MAC Address" -DefaultAddress = "000001000001" -MaxSpeed = "Indicate Speed (Mbps)" -KeepLink = "Keep Link" -On = "On" -Off = "Off" - - -; Auto Generated 20180205_163618.611 - +; VPN Client Device Driver for Windows 2000 and Greater +; +; Copyright (c) SoftEther Corporation. All Rights Reserved. +; http://www.softether.co.jp/ +; +; BUILD 9658 + +[Version] +Signature = "$Windows NT$" +Class = Net +ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} +Provider = %CompanyName% +DriverVer = 02/04/2018, 4.25.0.9658 +CatalogFile.NT = Neo6_x86_VPN89.cat + +[Manufacturer] +%CompanyName% = SoftEther + +[SourceDisksNames] +1=%DiskDescription%, "", , + +[SourceDisksFiles] +Neo6_x86_VPN89.sys = 1 + +[DestinationDirs] +DefaultDestDir = 12 +Neo.CopyFiles.Sys = 12 + +[Neo.CopyFiles.Sys] +Neo6_x86_VPN89.sys, , , 2 + +[SoftEther] +%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN89 + +[NeoAdapter.Install] +Characteristics = 0x1 +AddReg = Neo.Reg, NeoAdapter.Ndi +CopyFiles = Neo.CopyFiles.Sys +*IfType = 53 +*MediaType = 0 +*PhysicalMediaType = 0 + +[NeoAdapter.Install.Services] +AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% + +[NeoAdapter.Ndi] +HKR, , NetworkAddress, 0, %DefaultAddress% +HKR, Ndi, DeviceID, , "NeoAdapter_VPN89" +HKR, , DevLoader, , ndis +HKR, , DeviceVxDs, , Neo6_x86_VPN89.sys +HKR, NDIS, LogDriverName, , "Neo_VPN89" +HKR, NDIS, MajorNdisVersion, 1, 5 +HKR, NDIS, MinorNdisVersion, 1, 0 +HKR, Ndi\Interfaces, DefUpper, , "ndis5" +HKR, Ndi\Interfaces, UpperRange, , "ndis5" +HKR, Ndi\Interfaces, LowerRange, , "ethernet" +HKR, Ndi\Interfaces, DefLower, , "ethernet" +HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" +HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% +HKR, Ndi\Params\NetworkAddress, type, 0, "edit" +HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" +HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" +HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% +HKR, Ndi\Params\NetworkAddress, optional, 0, "0" +HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% +HKR, Ndi\Params\MaxSpeed, type, 0, "int" +HKR, Ndi\Params\MaxSpeed, default, 0, "100" +HKR, Ndi\Params\MaxSpeed, min, 0, "0" +HKR, Ndi\Params\MaxSpeed, max, 0, "2000" +HKR, Ndi\Params\MaxSpeed, step, 0, "1" +HKR, Ndi\Params\MaxSpeed, Base, 0, "10" +HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% +HKR, Ndi\Params\KeepLink, type, 0, "enum" +HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% +HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% +HKR, Ndi\Params\KeepLink, default, 0, "0" + + +[Neo.Service] +DisplayName = %Neo.Service.DispName% +Description = %Neo.Service.Desc% +ServiceType = 1 +StartType = 3 +ErrorControl = 1 +ServiceBinary = %12%\Neo6_x86_VPN89.sys +LoadOrderGroup = NDIS + +[Neo.Reg] +HKR, Ndi, Service, 0, Neo.Service.Name +HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" +HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" + +[Neo.EventLog] +HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN89.sys" +HKR, , TypesSupported, 0x00010001, 7 + +[Strings] +CompanyName = "SoftEther Corporation" +DiskDescription = "VPN Client Device Driver Install Disk" +Neo.Service.Name = "Neo_VPN89" +Neo.Service.DispName = "VPN Client Device Driver - VPN89" +Neo.Service.Desc = "VPN Client Adapter - VPN89" +NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN89" +Neo.EventLog.Name = "Neo" +NetworkAddress = "MAC Address" +DefaultAddress = "000001000001" +MaxSpeed = "Indicate Speed (Mbps)" +KeepLink = "Keep Link" +On = "On" +Off = "Off" + + +; Auto Generated 20180205_163618.611 + diff --git a/src/bin/hamcore/DriverPackages/Neo6_Win10/x86/Neo6_x86_VPN9.inf b/src/bin/hamcore/DriverPackages/Neo6_Win10/x86/Neo6_x86_VPN9.inf index 9b0b0b0f..b7d596b1 100644 --- a/src/bin/hamcore/DriverPackages/Neo6_Win10/x86/Neo6_x86_VPN9.inf +++ b/src/bin/hamcore/DriverPackages/Neo6_Win10/x86/Neo6_x86_VPN9.inf @@ -1,114 +1,114 @@ -; VPN Client Device Driver for Windows 2000 and Greater -; -; Copyright (c) SoftEther Corporation. All Rights Reserved. -; http://www.softether.co.jp/ -; -; BUILD 9658 - -[Version] -Signature = "$Windows NT$" -Class = Net -ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} -Provider = %CompanyName% -DriverVer = 02/04/2018, 4.25.0.9658 -CatalogFile.NT = Neo6_x86_VPN9.cat - -[Manufacturer] -%CompanyName% = SoftEther - -[SourceDisksNames] -1=%DiskDescription%, "", , - -[SourceDisksFiles] -Neo6_x86_VPN9.sys = 1 - -[DestinationDirs] -DefaultDestDir = 12 -Neo.CopyFiles.Sys = 12 - -[Neo.CopyFiles.Sys] -Neo6_x86_VPN9.sys, , , 2 - -[SoftEther] -%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN9 - -[NeoAdapter.Install] -Characteristics = 0x1 -AddReg = Neo.Reg, NeoAdapter.Ndi -CopyFiles = Neo.CopyFiles.Sys -*IfType = 53 -*MediaType = 0 -*PhysicalMediaType = 0 - -[NeoAdapter.Install.Services] -AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% - -[NeoAdapter.Ndi] -HKR, , NetworkAddress, 0, %DefaultAddress% -HKR, Ndi, DeviceID, , "NeoAdapter_VPN9" -HKR, , DevLoader, , ndis -HKR, , DeviceVxDs, , Neo6_x86_VPN9.sys -HKR, NDIS, LogDriverName, , "Neo_VPN9" -HKR, NDIS, MajorNdisVersion, 1, 5 -HKR, NDIS, MinorNdisVersion, 1, 0 -HKR, Ndi\Interfaces, DefUpper, , "ndis5" -HKR, Ndi\Interfaces, UpperRange, , "ndis5" -HKR, Ndi\Interfaces, LowerRange, , "ethernet" -HKR, Ndi\Interfaces, DefLower, , "ethernet" -HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" -HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% -HKR, Ndi\Params\NetworkAddress, type, 0, "edit" -HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" -HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" -HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% -HKR, Ndi\Params\NetworkAddress, optional, 0, "0" -HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% -HKR, Ndi\Params\MaxSpeed, type, 0, "int" -HKR, Ndi\Params\MaxSpeed, default, 0, "100" -HKR, Ndi\Params\MaxSpeed, min, 0, "0" -HKR, Ndi\Params\MaxSpeed, max, 0, "2000" -HKR, Ndi\Params\MaxSpeed, step, 0, "1" -HKR, Ndi\Params\MaxSpeed, Base, 0, "10" -HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% -HKR, Ndi\Params\KeepLink, type, 0, "enum" -HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% -HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% -HKR, Ndi\Params\KeepLink, default, 0, "0" - - -[Neo.Service] -DisplayName = %Neo.Service.DispName% -Description = %Neo.Service.Desc% -ServiceType = 1 -StartType = 3 -ErrorControl = 1 -ServiceBinary = %12%\Neo6_x86_VPN9.sys -LoadOrderGroup = NDIS - -[Neo.Reg] -HKR, Ndi, Service, 0, Neo.Service.Name -HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" -HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" - -[Neo.EventLog] -HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN9.sys" -HKR, , TypesSupported, 0x00010001, 7 - -[Strings] -CompanyName = "SoftEther Corporation" -DiskDescription = "VPN Client Device Driver Install Disk" -Neo.Service.Name = "Neo_VPN9" -Neo.Service.DispName = "VPN Client Device Driver - VPN9" -Neo.Service.Desc = "VPN Client Adapter - VPN9" -NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN9" -Neo.EventLog.Name = "Neo" -NetworkAddress = "MAC Address" -DefaultAddress = "000001000001" -MaxSpeed = "Indicate Speed (Mbps)" -KeepLink = "Keep Link" -On = "On" -Off = "Off" - - -; Auto Generated 20180205_163612.904 - +; VPN Client Device Driver for Windows 2000 and Greater +; +; Copyright (c) SoftEther Corporation. All Rights Reserved. +; http://www.softether.co.jp/ +; +; BUILD 9658 + +[Version] +Signature = "$Windows NT$" +Class = Net +ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} +Provider = %CompanyName% +DriverVer = 02/04/2018, 4.25.0.9658 +CatalogFile.NT = Neo6_x86_VPN9.cat + +[Manufacturer] +%CompanyName% = SoftEther + +[SourceDisksNames] +1=%DiskDescription%, "", , + +[SourceDisksFiles] +Neo6_x86_VPN9.sys = 1 + +[DestinationDirs] +DefaultDestDir = 12 +Neo.CopyFiles.Sys = 12 + +[Neo.CopyFiles.Sys] +Neo6_x86_VPN9.sys, , , 2 + +[SoftEther] +%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN9 + +[NeoAdapter.Install] +Characteristics = 0x1 +AddReg = Neo.Reg, NeoAdapter.Ndi +CopyFiles = Neo.CopyFiles.Sys +*IfType = 53 +*MediaType = 0 +*PhysicalMediaType = 0 + +[NeoAdapter.Install.Services] +AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% + +[NeoAdapter.Ndi] +HKR, , NetworkAddress, 0, %DefaultAddress% +HKR, Ndi, DeviceID, , "NeoAdapter_VPN9" +HKR, , DevLoader, , ndis +HKR, , DeviceVxDs, , Neo6_x86_VPN9.sys +HKR, NDIS, LogDriverName, , "Neo_VPN9" +HKR, NDIS, MajorNdisVersion, 1, 5 +HKR, NDIS, MinorNdisVersion, 1, 0 +HKR, Ndi\Interfaces, DefUpper, , "ndis5" +HKR, Ndi\Interfaces, UpperRange, , "ndis5" +HKR, Ndi\Interfaces, LowerRange, , "ethernet" +HKR, Ndi\Interfaces, DefLower, , "ethernet" +HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" +HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% +HKR, Ndi\Params\NetworkAddress, type, 0, "edit" +HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" +HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" +HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% +HKR, Ndi\Params\NetworkAddress, optional, 0, "0" +HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% +HKR, Ndi\Params\MaxSpeed, type, 0, "int" +HKR, Ndi\Params\MaxSpeed, default, 0, "100" +HKR, Ndi\Params\MaxSpeed, min, 0, "0" +HKR, Ndi\Params\MaxSpeed, max, 0, "2000" +HKR, Ndi\Params\MaxSpeed, step, 0, "1" +HKR, Ndi\Params\MaxSpeed, Base, 0, "10" +HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% +HKR, Ndi\Params\KeepLink, type, 0, "enum" +HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% +HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% +HKR, Ndi\Params\KeepLink, default, 0, "0" + + +[Neo.Service] +DisplayName = %Neo.Service.DispName% +Description = %Neo.Service.Desc% +ServiceType = 1 +StartType = 3 +ErrorControl = 1 +ServiceBinary = %12%\Neo6_x86_VPN9.sys +LoadOrderGroup = NDIS + +[Neo.Reg] +HKR, Ndi, Service, 0, Neo.Service.Name +HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" +HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" + +[Neo.EventLog] +HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN9.sys" +HKR, , TypesSupported, 0x00010001, 7 + +[Strings] +CompanyName = "SoftEther Corporation" +DiskDescription = "VPN Client Device Driver Install Disk" +Neo.Service.Name = "Neo_VPN9" +Neo.Service.DispName = "VPN Client Device Driver - VPN9" +Neo.Service.Desc = "VPN Client Adapter - VPN9" +NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN9" +Neo.EventLog.Name = "Neo" +NetworkAddress = "MAC Address" +DefaultAddress = "000001000001" +MaxSpeed = "Indicate Speed (Mbps)" +KeepLink = "Keep Link" +On = "On" +Off = "Off" + + +; Auto Generated 20180205_163612.904 + diff --git a/src/bin/hamcore/DriverPackages/Neo6_Win10/x86/Neo6_x86_VPN90.inf b/src/bin/hamcore/DriverPackages/Neo6_Win10/x86/Neo6_x86_VPN90.inf index 4fdcfd03..19a47e96 100644 --- a/src/bin/hamcore/DriverPackages/Neo6_Win10/x86/Neo6_x86_VPN90.inf +++ b/src/bin/hamcore/DriverPackages/Neo6_Win10/x86/Neo6_x86_VPN90.inf @@ -1,114 +1,114 @@ -; VPN Client Device Driver for Windows 2000 and Greater -; -; Copyright (c) SoftEther Corporation. All Rights Reserved. -; http://www.softether.co.jp/ -; -; BUILD 9658 - -[Version] -Signature = "$Windows NT$" -Class = Net -ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} -Provider = %CompanyName% -DriverVer = 02/04/2018, 4.25.0.9658 -CatalogFile.NT = Neo6_x86_VPN90.cat - -[Manufacturer] -%CompanyName% = SoftEther - -[SourceDisksNames] -1=%DiskDescription%, "", , - -[SourceDisksFiles] -Neo6_x86_VPN90.sys = 1 - -[DestinationDirs] -DefaultDestDir = 12 -Neo.CopyFiles.Sys = 12 - -[Neo.CopyFiles.Sys] -Neo6_x86_VPN90.sys, , , 2 - -[SoftEther] -%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN90 - -[NeoAdapter.Install] -Characteristics = 0x1 -AddReg = Neo.Reg, NeoAdapter.Ndi -CopyFiles = Neo.CopyFiles.Sys -*IfType = 53 -*MediaType = 0 -*PhysicalMediaType = 0 - -[NeoAdapter.Install.Services] -AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% - -[NeoAdapter.Ndi] -HKR, , NetworkAddress, 0, %DefaultAddress% -HKR, Ndi, DeviceID, , "NeoAdapter_VPN90" -HKR, , DevLoader, , ndis -HKR, , DeviceVxDs, , Neo6_x86_VPN90.sys -HKR, NDIS, LogDriverName, , "Neo_VPN90" -HKR, NDIS, MajorNdisVersion, 1, 5 -HKR, NDIS, MinorNdisVersion, 1, 0 -HKR, Ndi\Interfaces, DefUpper, , "ndis5" -HKR, Ndi\Interfaces, UpperRange, , "ndis5" -HKR, Ndi\Interfaces, LowerRange, , "ethernet" -HKR, Ndi\Interfaces, DefLower, , "ethernet" -HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" -HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% -HKR, Ndi\Params\NetworkAddress, type, 0, "edit" -HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" -HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" -HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% -HKR, Ndi\Params\NetworkAddress, optional, 0, "0" -HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% -HKR, Ndi\Params\MaxSpeed, type, 0, "int" -HKR, Ndi\Params\MaxSpeed, default, 0, "100" -HKR, Ndi\Params\MaxSpeed, min, 0, "0" -HKR, Ndi\Params\MaxSpeed, max, 0, "2000" -HKR, Ndi\Params\MaxSpeed, step, 0, "1" -HKR, Ndi\Params\MaxSpeed, Base, 0, "10" -HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% -HKR, Ndi\Params\KeepLink, type, 0, "enum" -HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% -HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% -HKR, Ndi\Params\KeepLink, default, 0, "0" - - -[Neo.Service] -DisplayName = %Neo.Service.DispName% -Description = %Neo.Service.Desc% -ServiceType = 1 -StartType = 3 -ErrorControl = 1 -ServiceBinary = %12%\Neo6_x86_VPN90.sys -LoadOrderGroup = NDIS - -[Neo.Reg] -HKR, Ndi, Service, 0, Neo.Service.Name -HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" -HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" - -[Neo.EventLog] -HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN90.sys" -HKR, , TypesSupported, 0x00010001, 7 - -[Strings] -CompanyName = "SoftEther Corporation" -DiskDescription = "VPN Client Device Driver Install Disk" -Neo.Service.Name = "Neo_VPN90" -Neo.Service.DispName = "VPN Client Device Driver - VPN90" -Neo.Service.Desc = "VPN Client Adapter - VPN90" -NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN90" -Neo.EventLog.Name = "Neo" -NetworkAddress = "MAC Address" -DefaultAddress = "000001000001" -MaxSpeed = "Indicate Speed (Mbps)" -KeepLink = "Keep Link" -On = "On" -Off = "Off" - - -; Auto Generated 20180205_163618.682 - +; VPN Client Device Driver for Windows 2000 and Greater +; +; Copyright (c) SoftEther Corporation. All Rights Reserved. +; http://www.softether.co.jp/ +; +; BUILD 9658 + +[Version] +Signature = "$Windows NT$" +Class = Net +ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} +Provider = %CompanyName% +DriverVer = 02/04/2018, 4.25.0.9658 +CatalogFile.NT = Neo6_x86_VPN90.cat + +[Manufacturer] +%CompanyName% = SoftEther + +[SourceDisksNames] +1=%DiskDescription%, "", , + +[SourceDisksFiles] +Neo6_x86_VPN90.sys = 1 + +[DestinationDirs] +DefaultDestDir = 12 +Neo.CopyFiles.Sys = 12 + +[Neo.CopyFiles.Sys] +Neo6_x86_VPN90.sys, , , 2 + +[SoftEther] +%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN90 + +[NeoAdapter.Install] +Characteristics = 0x1 +AddReg = Neo.Reg, NeoAdapter.Ndi +CopyFiles = Neo.CopyFiles.Sys +*IfType = 53 +*MediaType = 0 +*PhysicalMediaType = 0 + +[NeoAdapter.Install.Services] +AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% + +[NeoAdapter.Ndi] +HKR, , NetworkAddress, 0, %DefaultAddress% +HKR, Ndi, DeviceID, , "NeoAdapter_VPN90" +HKR, , DevLoader, , ndis +HKR, , DeviceVxDs, , Neo6_x86_VPN90.sys +HKR, NDIS, LogDriverName, , "Neo_VPN90" +HKR, NDIS, MajorNdisVersion, 1, 5 +HKR, NDIS, MinorNdisVersion, 1, 0 +HKR, Ndi\Interfaces, DefUpper, , "ndis5" +HKR, Ndi\Interfaces, UpperRange, , "ndis5" +HKR, Ndi\Interfaces, LowerRange, , "ethernet" +HKR, Ndi\Interfaces, DefLower, , "ethernet" +HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" +HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% +HKR, Ndi\Params\NetworkAddress, type, 0, "edit" +HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" +HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" +HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% +HKR, Ndi\Params\NetworkAddress, optional, 0, "0" +HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% +HKR, Ndi\Params\MaxSpeed, type, 0, "int" +HKR, Ndi\Params\MaxSpeed, default, 0, "100" +HKR, Ndi\Params\MaxSpeed, min, 0, "0" +HKR, Ndi\Params\MaxSpeed, max, 0, "2000" +HKR, Ndi\Params\MaxSpeed, step, 0, "1" +HKR, Ndi\Params\MaxSpeed, Base, 0, "10" +HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% +HKR, Ndi\Params\KeepLink, type, 0, "enum" +HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% +HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% +HKR, Ndi\Params\KeepLink, default, 0, "0" + + +[Neo.Service] +DisplayName = %Neo.Service.DispName% +Description = %Neo.Service.Desc% +ServiceType = 1 +StartType = 3 +ErrorControl = 1 +ServiceBinary = %12%\Neo6_x86_VPN90.sys +LoadOrderGroup = NDIS + +[Neo.Reg] +HKR, Ndi, Service, 0, Neo.Service.Name +HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" +HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" + +[Neo.EventLog] +HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN90.sys" +HKR, , TypesSupported, 0x00010001, 7 + +[Strings] +CompanyName = "SoftEther Corporation" +DiskDescription = "VPN Client Device Driver Install Disk" +Neo.Service.Name = "Neo_VPN90" +Neo.Service.DispName = "VPN Client Device Driver - VPN90" +Neo.Service.Desc = "VPN Client Adapter - VPN90" +NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN90" +Neo.EventLog.Name = "Neo" +NetworkAddress = "MAC Address" +DefaultAddress = "000001000001" +MaxSpeed = "Indicate Speed (Mbps)" +KeepLink = "Keep Link" +On = "On" +Off = "Off" + + +; Auto Generated 20180205_163618.682 + diff --git a/src/bin/hamcore/DriverPackages/Neo6_Win10/x86/Neo6_x86_VPN91.inf b/src/bin/hamcore/DriverPackages/Neo6_Win10/x86/Neo6_x86_VPN91.inf index 3bd95196..e4766f3c 100644 --- a/src/bin/hamcore/DriverPackages/Neo6_Win10/x86/Neo6_x86_VPN91.inf +++ b/src/bin/hamcore/DriverPackages/Neo6_Win10/x86/Neo6_x86_VPN91.inf @@ -1,114 +1,114 @@ -; VPN Client Device Driver for Windows 2000 and Greater -; -; Copyright (c) SoftEther Corporation. All Rights Reserved. -; http://www.softether.co.jp/ -; -; BUILD 9658 - -[Version] -Signature = "$Windows NT$" -Class = Net -ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} -Provider = %CompanyName% -DriverVer = 02/04/2018, 4.25.0.9658 -CatalogFile.NT = Neo6_x86_VPN91.cat - -[Manufacturer] -%CompanyName% = SoftEther - -[SourceDisksNames] -1=%DiskDescription%, "", , - -[SourceDisksFiles] -Neo6_x86_VPN91.sys = 1 - -[DestinationDirs] -DefaultDestDir = 12 -Neo.CopyFiles.Sys = 12 - -[Neo.CopyFiles.Sys] -Neo6_x86_VPN91.sys, , , 2 - -[SoftEther] -%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN91 - -[NeoAdapter.Install] -Characteristics = 0x1 -AddReg = Neo.Reg, NeoAdapter.Ndi -CopyFiles = Neo.CopyFiles.Sys -*IfType = 53 -*MediaType = 0 -*PhysicalMediaType = 0 - -[NeoAdapter.Install.Services] -AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% - -[NeoAdapter.Ndi] -HKR, , NetworkAddress, 0, %DefaultAddress% -HKR, Ndi, DeviceID, , "NeoAdapter_VPN91" -HKR, , DevLoader, , ndis -HKR, , DeviceVxDs, , Neo6_x86_VPN91.sys -HKR, NDIS, LogDriverName, , "Neo_VPN91" -HKR, NDIS, MajorNdisVersion, 1, 5 -HKR, NDIS, MinorNdisVersion, 1, 0 -HKR, Ndi\Interfaces, DefUpper, , "ndis5" -HKR, Ndi\Interfaces, UpperRange, , "ndis5" -HKR, Ndi\Interfaces, LowerRange, , "ethernet" -HKR, Ndi\Interfaces, DefLower, , "ethernet" -HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" -HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% -HKR, Ndi\Params\NetworkAddress, type, 0, "edit" -HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" -HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" -HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% -HKR, Ndi\Params\NetworkAddress, optional, 0, "0" -HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% -HKR, Ndi\Params\MaxSpeed, type, 0, "int" -HKR, Ndi\Params\MaxSpeed, default, 0, "100" -HKR, Ndi\Params\MaxSpeed, min, 0, "0" -HKR, Ndi\Params\MaxSpeed, max, 0, "2000" -HKR, Ndi\Params\MaxSpeed, step, 0, "1" -HKR, Ndi\Params\MaxSpeed, Base, 0, "10" -HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% -HKR, Ndi\Params\KeepLink, type, 0, "enum" -HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% -HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% -HKR, Ndi\Params\KeepLink, default, 0, "0" - - -[Neo.Service] -DisplayName = %Neo.Service.DispName% -Description = %Neo.Service.Desc% -ServiceType = 1 -StartType = 3 -ErrorControl = 1 -ServiceBinary = %12%\Neo6_x86_VPN91.sys -LoadOrderGroup = NDIS - -[Neo.Reg] -HKR, Ndi, Service, 0, Neo.Service.Name -HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" -HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" - -[Neo.EventLog] -HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN91.sys" -HKR, , TypesSupported, 0x00010001, 7 - -[Strings] -CompanyName = "SoftEther Corporation" -DiskDescription = "VPN Client Device Driver Install Disk" -Neo.Service.Name = "Neo_VPN91" -Neo.Service.DispName = "VPN Client Device Driver - VPN91" -Neo.Service.Desc = "VPN Client Adapter - VPN91" -NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN91" -Neo.EventLog.Name = "Neo" -NetworkAddress = "MAC Address" -DefaultAddress = "000001000001" -MaxSpeed = "Indicate Speed (Mbps)" -KeepLink = "Keep Link" -On = "On" -Off = "Off" - - -; Auto Generated 20180205_163618.752 - +; VPN Client Device Driver for Windows 2000 and Greater +; +; Copyright (c) SoftEther Corporation. All Rights Reserved. +; http://www.softether.co.jp/ +; +; BUILD 9658 + +[Version] +Signature = "$Windows NT$" +Class = Net +ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} +Provider = %CompanyName% +DriverVer = 02/04/2018, 4.25.0.9658 +CatalogFile.NT = Neo6_x86_VPN91.cat + +[Manufacturer] +%CompanyName% = SoftEther + +[SourceDisksNames] +1=%DiskDescription%, "", , + +[SourceDisksFiles] +Neo6_x86_VPN91.sys = 1 + +[DestinationDirs] +DefaultDestDir = 12 +Neo.CopyFiles.Sys = 12 + +[Neo.CopyFiles.Sys] +Neo6_x86_VPN91.sys, , , 2 + +[SoftEther] +%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN91 + +[NeoAdapter.Install] +Characteristics = 0x1 +AddReg = Neo.Reg, NeoAdapter.Ndi +CopyFiles = Neo.CopyFiles.Sys +*IfType = 53 +*MediaType = 0 +*PhysicalMediaType = 0 + +[NeoAdapter.Install.Services] +AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% + +[NeoAdapter.Ndi] +HKR, , NetworkAddress, 0, %DefaultAddress% +HKR, Ndi, DeviceID, , "NeoAdapter_VPN91" +HKR, , DevLoader, , ndis +HKR, , DeviceVxDs, , Neo6_x86_VPN91.sys +HKR, NDIS, LogDriverName, , "Neo_VPN91" +HKR, NDIS, MajorNdisVersion, 1, 5 +HKR, NDIS, MinorNdisVersion, 1, 0 +HKR, Ndi\Interfaces, DefUpper, , "ndis5" +HKR, Ndi\Interfaces, UpperRange, , "ndis5" +HKR, Ndi\Interfaces, LowerRange, , "ethernet" +HKR, Ndi\Interfaces, DefLower, , "ethernet" +HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" +HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% +HKR, Ndi\Params\NetworkAddress, type, 0, "edit" +HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" +HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" +HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% +HKR, Ndi\Params\NetworkAddress, optional, 0, "0" +HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% +HKR, Ndi\Params\MaxSpeed, type, 0, "int" +HKR, Ndi\Params\MaxSpeed, default, 0, "100" +HKR, Ndi\Params\MaxSpeed, min, 0, "0" +HKR, Ndi\Params\MaxSpeed, max, 0, "2000" +HKR, Ndi\Params\MaxSpeed, step, 0, "1" +HKR, Ndi\Params\MaxSpeed, Base, 0, "10" +HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% +HKR, Ndi\Params\KeepLink, type, 0, "enum" +HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% +HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% +HKR, Ndi\Params\KeepLink, default, 0, "0" + + +[Neo.Service] +DisplayName = %Neo.Service.DispName% +Description = %Neo.Service.Desc% +ServiceType = 1 +StartType = 3 +ErrorControl = 1 +ServiceBinary = %12%\Neo6_x86_VPN91.sys +LoadOrderGroup = NDIS + +[Neo.Reg] +HKR, Ndi, Service, 0, Neo.Service.Name +HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" +HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" + +[Neo.EventLog] +HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN91.sys" +HKR, , TypesSupported, 0x00010001, 7 + +[Strings] +CompanyName = "SoftEther Corporation" +DiskDescription = "VPN Client Device Driver Install Disk" +Neo.Service.Name = "Neo_VPN91" +Neo.Service.DispName = "VPN Client Device Driver - VPN91" +Neo.Service.Desc = "VPN Client Adapter - VPN91" +NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN91" +Neo.EventLog.Name = "Neo" +NetworkAddress = "MAC Address" +DefaultAddress = "000001000001" +MaxSpeed = "Indicate Speed (Mbps)" +KeepLink = "Keep Link" +On = "On" +Off = "Off" + + +; Auto Generated 20180205_163618.752 + diff --git a/src/bin/hamcore/DriverPackages/Neo6_Win10/x86/Neo6_x86_VPN92.inf b/src/bin/hamcore/DriverPackages/Neo6_Win10/x86/Neo6_x86_VPN92.inf index e152c553..6a412d0b 100644 --- a/src/bin/hamcore/DriverPackages/Neo6_Win10/x86/Neo6_x86_VPN92.inf +++ b/src/bin/hamcore/DriverPackages/Neo6_Win10/x86/Neo6_x86_VPN92.inf @@ -1,114 +1,114 @@ -; VPN Client Device Driver for Windows 2000 and Greater -; -; Copyright (c) SoftEther Corporation. All Rights Reserved. -; http://www.softether.co.jp/ -; -; BUILD 9658 - -[Version] -Signature = "$Windows NT$" -Class = Net -ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} -Provider = %CompanyName% -DriverVer = 02/04/2018, 4.25.0.9658 -CatalogFile.NT = Neo6_x86_VPN92.cat - -[Manufacturer] -%CompanyName% = SoftEther - -[SourceDisksNames] -1=%DiskDescription%, "", , - -[SourceDisksFiles] -Neo6_x86_VPN92.sys = 1 - -[DestinationDirs] -DefaultDestDir = 12 -Neo.CopyFiles.Sys = 12 - -[Neo.CopyFiles.Sys] -Neo6_x86_VPN92.sys, , , 2 - -[SoftEther] -%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN92 - -[NeoAdapter.Install] -Characteristics = 0x1 -AddReg = Neo.Reg, NeoAdapter.Ndi -CopyFiles = Neo.CopyFiles.Sys -*IfType = 53 -*MediaType = 0 -*PhysicalMediaType = 0 - -[NeoAdapter.Install.Services] -AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% - -[NeoAdapter.Ndi] -HKR, , NetworkAddress, 0, %DefaultAddress% -HKR, Ndi, DeviceID, , "NeoAdapter_VPN92" -HKR, , DevLoader, , ndis -HKR, , DeviceVxDs, , Neo6_x86_VPN92.sys -HKR, NDIS, LogDriverName, , "Neo_VPN92" -HKR, NDIS, MajorNdisVersion, 1, 5 -HKR, NDIS, MinorNdisVersion, 1, 0 -HKR, Ndi\Interfaces, DefUpper, , "ndis5" -HKR, Ndi\Interfaces, UpperRange, , "ndis5" -HKR, Ndi\Interfaces, LowerRange, , "ethernet" -HKR, Ndi\Interfaces, DefLower, , "ethernet" -HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" -HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% -HKR, Ndi\Params\NetworkAddress, type, 0, "edit" -HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" -HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" -HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% -HKR, Ndi\Params\NetworkAddress, optional, 0, "0" -HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% -HKR, Ndi\Params\MaxSpeed, type, 0, "int" -HKR, Ndi\Params\MaxSpeed, default, 0, "100" -HKR, Ndi\Params\MaxSpeed, min, 0, "0" -HKR, Ndi\Params\MaxSpeed, max, 0, "2000" -HKR, Ndi\Params\MaxSpeed, step, 0, "1" -HKR, Ndi\Params\MaxSpeed, Base, 0, "10" -HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% -HKR, Ndi\Params\KeepLink, type, 0, "enum" -HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% -HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% -HKR, Ndi\Params\KeepLink, default, 0, "0" - - -[Neo.Service] -DisplayName = %Neo.Service.DispName% -Description = %Neo.Service.Desc% -ServiceType = 1 -StartType = 3 -ErrorControl = 1 -ServiceBinary = %12%\Neo6_x86_VPN92.sys -LoadOrderGroup = NDIS - -[Neo.Reg] -HKR, Ndi, Service, 0, Neo.Service.Name -HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" -HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" - -[Neo.EventLog] -HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN92.sys" -HKR, , TypesSupported, 0x00010001, 7 - -[Strings] -CompanyName = "SoftEther Corporation" -DiskDescription = "VPN Client Device Driver Install Disk" -Neo.Service.Name = "Neo_VPN92" -Neo.Service.DispName = "VPN Client Device Driver - VPN92" -Neo.Service.Desc = "VPN Client Adapter - VPN92" -NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN92" -Neo.EventLog.Name = "Neo" -NetworkAddress = "MAC Address" -DefaultAddress = "000001000001" -MaxSpeed = "Indicate Speed (Mbps)" -KeepLink = "Keep Link" -On = "On" -Off = "Off" - - -; Auto Generated 20180205_163618.823 - +; VPN Client Device Driver for Windows 2000 and Greater +; +; Copyright (c) SoftEther Corporation. All Rights Reserved. +; http://www.softether.co.jp/ +; +; BUILD 9658 + +[Version] +Signature = "$Windows NT$" +Class = Net +ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} +Provider = %CompanyName% +DriverVer = 02/04/2018, 4.25.0.9658 +CatalogFile.NT = Neo6_x86_VPN92.cat + +[Manufacturer] +%CompanyName% = SoftEther + +[SourceDisksNames] +1=%DiskDescription%, "", , + +[SourceDisksFiles] +Neo6_x86_VPN92.sys = 1 + +[DestinationDirs] +DefaultDestDir = 12 +Neo.CopyFiles.Sys = 12 + +[Neo.CopyFiles.Sys] +Neo6_x86_VPN92.sys, , , 2 + +[SoftEther] +%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN92 + +[NeoAdapter.Install] +Characteristics = 0x1 +AddReg = Neo.Reg, NeoAdapter.Ndi +CopyFiles = Neo.CopyFiles.Sys +*IfType = 53 +*MediaType = 0 +*PhysicalMediaType = 0 + +[NeoAdapter.Install.Services] +AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% + +[NeoAdapter.Ndi] +HKR, , NetworkAddress, 0, %DefaultAddress% +HKR, Ndi, DeviceID, , "NeoAdapter_VPN92" +HKR, , DevLoader, , ndis +HKR, , DeviceVxDs, , Neo6_x86_VPN92.sys +HKR, NDIS, LogDriverName, , "Neo_VPN92" +HKR, NDIS, MajorNdisVersion, 1, 5 +HKR, NDIS, MinorNdisVersion, 1, 0 +HKR, Ndi\Interfaces, DefUpper, , "ndis5" +HKR, Ndi\Interfaces, UpperRange, , "ndis5" +HKR, Ndi\Interfaces, LowerRange, , "ethernet" +HKR, Ndi\Interfaces, DefLower, , "ethernet" +HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" +HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% +HKR, Ndi\Params\NetworkAddress, type, 0, "edit" +HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" +HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" +HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% +HKR, Ndi\Params\NetworkAddress, optional, 0, "0" +HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% +HKR, Ndi\Params\MaxSpeed, type, 0, "int" +HKR, Ndi\Params\MaxSpeed, default, 0, "100" +HKR, Ndi\Params\MaxSpeed, min, 0, "0" +HKR, Ndi\Params\MaxSpeed, max, 0, "2000" +HKR, Ndi\Params\MaxSpeed, step, 0, "1" +HKR, Ndi\Params\MaxSpeed, Base, 0, "10" +HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% +HKR, Ndi\Params\KeepLink, type, 0, "enum" +HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% +HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% +HKR, Ndi\Params\KeepLink, default, 0, "0" + + +[Neo.Service] +DisplayName = %Neo.Service.DispName% +Description = %Neo.Service.Desc% +ServiceType = 1 +StartType = 3 +ErrorControl = 1 +ServiceBinary = %12%\Neo6_x86_VPN92.sys +LoadOrderGroup = NDIS + +[Neo.Reg] +HKR, Ndi, Service, 0, Neo.Service.Name +HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" +HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" + +[Neo.EventLog] +HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN92.sys" +HKR, , TypesSupported, 0x00010001, 7 + +[Strings] +CompanyName = "SoftEther Corporation" +DiskDescription = "VPN Client Device Driver Install Disk" +Neo.Service.Name = "Neo_VPN92" +Neo.Service.DispName = "VPN Client Device Driver - VPN92" +Neo.Service.Desc = "VPN Client Adapter - VPN92" +NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN92" +Neo.EventLog.Name = "Neo" +NetworkAddress = "MAC Address" +DefaultAddress = "000001000001" +MaxSpeed = "Indicate Speed (Mbps)" +KeepLink = "Keep Link" +On = "On" +Off = "Off" + + +; Auto Generated 20180205_163618.823 + diff --git a/src/bin/hamcore/DriverPackages/Neo6_Win10/x86/Neo6_x86_VPN93.inf b/src/bin/hamcore/DriverPackages/Neo6_Win10/x86/Neo6_x86_VPN93.inf index f75e5dc7..35db89ce 100644 --- a/src/bin/hamcore/DriverPackages/Neo6_Win10/x86/Neo6_x86_VPN93.inf +++ b/src/bin/hamcore/DriverPackages/Neo6_Win10/x86/Neo6_x86_VPN93.inf @@ -1,114 +1,114 @@ -; VPN Client Device Driver for Windows 2000 and Greater -; -; Copyright (c) SoftEther Corporation. All Rights Reserved. -; http://www.softether.co.jp/ -; -; BUILD 9658 - -[Version] -Signature = "$Windows NT$" -Class = Net -ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} -Provider = %CompanyName% -DriverVer = 02/04/2018, 4.25.0.9658 -CatalogFile.NT = Neo6_x86_VPN93.cat - -[Manufacturer] -%CompanyName% = SoftEther - -[SourceDisksNames] -1=%DiskDescription%, "", , - -[SourceDisksFiles] -Neo6_x86_VPN93.sys = 1 - -[DestinationDirs] -DefaultDestDir = 12 -Neo.CopyFiles.Sys = 12 - -[Neo.CopyFiles.Sys] -Neo6_x86_VPN93.sys, , , 2 - -[SoftEther] -%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN93 - -[NeoAdapter.Install] -Characteristics = 0x1 -AddReg = Neo.Reg, NeoAdapter.Ndi -CopyFiles = Neo.CopyFiles.Sys -*IfType = 53 -*MediaType = 0 -*PhysicalMediaType = 0 - -[NeoAdapter.Install.Services] -AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% - -[NeoAdapter.Ndi] -HKR, , NetworkAddress, 0, %DefaultAddress% -HKR, Ndi, DeviceID, , "NeoAdapter_VPN93" -HKR, , DevLoader, , ndis -HKR, , DeviceVxDs, , Neo6_x86_VPN93.sys -HKR, NDIS, LogDriverName, , "Neo_VPN93" -HKR, NDIS, MajorNdisVersion, 1, 5 -HKR, NDIS, MinorNdisVersion, 1, 0 -HKR, Ndi\Interfaces, DefUpper, , "ndis5" -HKR, Ndi\Interfaces, UpperRange, , "ndis5" -HKR, Ndi\Interfaces, LowerRange, , "ethernet" -HKR, Ndi\Interfaces, DefLower, , "ethernet" -HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" -HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% -HKR, Ndi\Params\NetworkAddress, type, 0, "edit" -HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" -HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" -HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% -HKR, Ndi\Params\NetworkAddress, optional, 0, "0" -HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% -HKR, Ndi\Params\MaxSpeed, type, 0, "int" -HKR, Ndi\Params\MaxSpeed, default, 0, "100" -HKR, Ndi\Params\MaxSpeed, min, 0, "0" -HKR, Ndi\Params\MaxSpeed, max, 0, "2000" -HKR, Ndi\Params\MaxSpeed, step, 0, "1" -HKR, Ndi\Params\MaxSpeed, Base, 0, "10" -HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% -HKR, Ndi\Params\KeepLink, type, 0, "enum" -HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% -HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% -HKR, Ndi\Params\KeepLink, default, 0, "0" - - -[Neo.Service] -DisplayName = %Neo.Service.DispName% -Description = %Neo.Service.Desc% -ServiceType = 1 -StartType = 3 -ErrorControl = 1 -ServiceBinary = %12%\Neo6_x86_VPN93.sys -LoadOrderGroup = NDIS - -[Neo.Reg] -HKR, Ndi, Service, 0, Neo.Service.Name -HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" -HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" - -[Neo.EventLog] -HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN93.sys" -HKR, , TypesSupported, 0x00010001, 7 - -[Strings] -CompanyName = "SoftEther Corporation" -DiskDescription = "VPN Client Device Driver Install Disk" -Neo.Service.Name = "Neo_VPN93" -Neo.Service.DispName = "VPN Client Device Driver - VPN93" -Neo.Service.Desc = "VPN Client Adapter - VPN93" -NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN93" -Neo.EventLog.Name = "Neo" -NetworkAddress = "MAC Address" -DefaultAddress = "000001000001" -MaxSpeed = "Indicate Speed (Mbps)" -KeepLink = "Keep Link" -On = "On" -Off = "Off" - - -; Auto Generated 20180205_163618.895 - +; VPN Client Device Driver for Windows 2000 and Greater +; +; Copyright (c) SoftEther Corporation. All Rights Reserved. +; http://www.softether.co.jp/ +; +; BUILD 9658 + +[Version] +Signature = "$Windows NT$" +Class = Net +ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} +Provider = %CompanyName% +DriverVer = 02/04/2018, 4.25.0.9658 +CatalogFile.NT = Neo6_x86_VPN93.cat + +[Manufacturer] +%CompanyName% = SoftEther + +[SourceDisksNames] +1=%DiskDescription%, "", , + +[SourceDisksFiles] +Neo6_x86_VPN93.sys = 1 + +[DestinationDirs] +DefaultDestDir = 12 +Neo.CopyFiles.Sys = 12 + +[Neo.CopyFiles.Sys] +Neo6_x86_VPN93.sys, , , 2 + +[SoftEther] +%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN93 + +[NeoAdapter.Install] +Characteristics = 0x1 +AddReg = Neo.Reg, NeoAdapter.Ndi +CopyFiles = Neo.CopyFiles.Sys +*IfType = 53 +*MediaType = 0 +*PhysicalMediaType = 0 + +[NeoAdapter.Install.Services] +AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% + +[NeoAdapter.Ndi] +HKR, , NetworkAddress, 0, %DefaultAddress% +HKR, Ndi, DeviceID, , "NeoAdapter_VPN93" +HKR, , DevLoader, , ndis +HKR, , DeviceVxDs, , Neo6_x86_VPN93.sys +HKR, NDIS, LogDriverName, , "Neo_VPN93" +HKR, NDIS, MajorNdisVersion, 1, 5 +HKR, NDIS, MinorNdisVersion, 1, 0 +HKR, Ndi\Interfaces, DefUpper, , "ndis5" +HKR, Ndi\Interfaces, UpperRange, , "ndis5" +HKR, Ndi\Interfaces, LowerRange, , "ethernet" +HKR, Ndi\Interfaces, DefLower, , "ethernet" +HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" +HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% +HKR, Ndi\Params\NetworkAddress, type, 0, "edit" +HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" +HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" +HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% +HKR, Ndi\Params\NetworkAddress, optional, 0, "0" +HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% +HKR, Ndi\Params\MaxSpeed, type, 0, "int" +HKR, Ndi\Params\MaxSpeed, default, 0, "100" +HKR, Ndi\Params\MaxSpeed, min, 0, "0" +HKR, Ndi\Params\MaxSpeed, max, 0, "2000" +HKR, Ndi\Params\MaxSpeed, step, 0, "1" +HKR, Ndi\Params\MaxSpeed, Base, 0, "10" +HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% +HKR, Ndi\Params\KeepLink, type, 0, "enum" +HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% +HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% +HKR, Ndi\Params\KeepLink, default, 0, "0" + + +[Neo.Service] +DisplayName = %Neo.Service.DispName% +Description = %Neo.Service.Desc% +ServiceType = 1 +StartType = 3 +ErrorControl = 1 +ServiceBinary = %12%\Neo6_x86_VPN93.sys +LoadOrderGroup = NDIS + +[Neo.Reg] +HKR, Ndi, Service, 0, Neo.Service.Name +HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" +HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" + +[Neo.EventLog] +HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN93.sys" +HKR, , TypesSupported, 0x00010001, 7 + +[Strings] +CompanyName = "SoftEther Corporation" +DiskDescription = "VPN Client Device Driver Install Disk" +Neo.Service.Name = "Neo_VPN93" +Neo.Service.DispName = "VPN Client Device Driver - VPN93" +Neo.Service.Desc = "VPN Client Adapter - VPN93" +NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN93" +Neo.EventLog.Name = "Neo" +NetworkAddress = "MAC Address" +DefaultAddress = "000001000001" +MaxSpeed = "Indicate Speed (Mbps)" +KeepLink = "Keep Link" +On = "On" +Off = "Off" + + +; Auto Generated 20180205_163618.895 + diff --git a/src/bin/hamcore/DriverPackages/Neo6_Win10/x86/Neo6_x86_VPN94.inf b/src/bin/hamcore/DriverPackages/Neo6_Win10/x86/Neo6_x86_VPN94.inf index ac52e718..84baa3ca 100644 --- a/src/bin/hamcore/DriverPackages/Neo6_Win10/x86/Neo6_x86_VPN94.inf +++ b/src/bin/hamcore/DriverPackages/Neo6_Win10/x86/Neo6_x86_VPN94.inf @@ -1,114 +1,114 @@ -; VPN Client Device Driver for Windows 2000 and Greater -; -; Copyright (c) SoftEther Corporation. All Rights Reserved. -; http://www.softether.co.jp/ -; -; BUILD 9658 - -[Version] -Signature = "$Windows NT$" -Class = Net -ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} -Provider = %CompanyName% -DriverVer = 02/04/2018, 4.25.0.9658 -CatalogFile.NT = Neo6_x86_VPN94.cat - -[Manufacturer] -%CompanyName% = SoftEther - -[SourceDisksNames] -1=%DiskDescription%, "", , - -[SourceDisksFiles] -Neo6_x86_VPN94.sys = 1 - -[DestinationDirs] -DefaultDestDir = 12 -Neo.CopyFiles.Sys = 12 - -[Neo.CopyFiles.Sys] -Neo6_x86_VPN94.sys, , , 2 - -[SoftEther] -%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN94 - -[NeoAdapter.Install] -Characteristics = 0x1 -AddReg = Neo.Reg, NeoAdapter.Ndi -CopyFiles = Neo.CopyFiles.Sys -*IfType = 53 -*MediaType = 0 -*PhysicalMediaType = 0 - -[NeoAdapter.Install.Services] -AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% - -[NeoAdapter.Ndi] -HKR, , NetworkAddress, 0, %DefaultAddress% -HKR, Ndi, DeviceID, , "NeoAdapter_VPN94" -HKR, , DevLoader, , ndis -HKR, , DeviceVxDs, , Neo6_x86_VPN94.sys -HKR, NDIS, LogDriverName, , "Neo_VPN94" -HKR, NDIS, MajorNdisVersion, 1, 5 -HKR, NDIS, MinorNdisVersion, 1, 0 -HKR, Ndi\Interfaces, DefUpper, , "ndis5" -HKR, Ndi\Interfaces, UpperRange, , "ndis5" -HKR, Ndi\Interfaces, LowerRange, , "ethernet" -HKR, Ndi\Interfaces, DefLower, , "ethernet" -HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" -HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% -HKR, Ndi\Params\NetworkAddress, type, 0, "edit" -HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" -HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" -HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% -HKR, Ndi\Params\NetworkAddress, optional, 0, "0" -HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% -HKR, Ndi\Params\MaxSpeed, type, 0, "int" -HKR, Ndi\Params\MaxSpeed, default, 0, "100" -HKR, Ndi\Params\MaxSpeed, min, 0, "0" -HKR, Ndi\Params\MaxSpeed, max, 0, "2000" -HKR, Ndi\Params\MaxSpeed, step, 0, "1" -HKR, Ndi\Params\MaxSpeed, Base, 0, "10" -HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% -HKR, Ndi\Params\KeepLink, type, 0, "enum" -HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% -HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% -HKR, Ndi\Params\KeepLink, default, 0, "0" - - -[Neo.Service] -DisplayName = %Neo.Service.DispName% -Description = %Neo.Service.Desc% -ServiceType = 1 -StartType = 3 -ErrorControl = 1 -ServiceBinary = %12%\Neo6_x86_VPN94.sys -LoadOrderGroup = NDIS - -[Neo.Reg] -HKR, Ndi, Service, 0, Neo.Service.Name -HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" -HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" - -[Neo.EventLog] -HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN94.sys" -HKR, , TypesSupported, 0x00010001, 7 - -[Strings] -CompanyName = "SoftEther Corporation" -DiskDescription = "VPN Client Device Driver Install Disk" -Neo.Service.Name = "Neo_VPN94" -Neo.Service.DispName = "VPN Client Device Driver - VPN94" -Neo.Service.Desc = "VPN Client Adapter - VPN94" -NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN94" -Neo.EventLog.Name = "Neo" -NetworkAddress = "MAC Address" -DefaultAddress = "000001000001" -MaxSpeed = "Indicate Speed (Mbps)" -KeepLink = "Keep Link" -On = "On" -Off = "Off" - - -; Auto Generated 20180205_163618.965 - +; VPN Client Device Driver for Windows 2000 and Greater +; +; Copyright (c) SoftEther Corporation. All Rights Reserved. +; http://www.softether.co.jp/ +; +; BUILD 9658 + +[Version] +Signature = "$Windows NT$" +Class = Net +ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} +Provider = %CompanyName% +DriverVer = 02/04/2018, 4.25.0.9658 +CatalogFile.NT = Neo6_x86_VPN94.cat + +[Manufacturer] +%CompanyName% = SoftEther + +[SourceDisksNames] +1=%DiskDescription%, "", , + +[SourceDisksFiles] +Neo6_x86_VPN94.sys = 1 + +[DestinationDirs] +DefaultDestDir = 12 +Neo.CopyFiles.Sys = 12 + +[Neo.CopyFiles.Sys] +Neo6_x86_VPN94.sys, , , 2 + +[SoftEther] +%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN94 + +[NeoAdapter.Install] +Characteristics = 0x1 +AddReg = Neo.Reg, NeoAdapter.Ndi +CopyFiles = Neo.CopyFiles.Sys +*IfType = 53 +*MediaType = 0 +*PhysicalMediaType = 0 + +[NeoAdapter.Install.Services] +AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% + +[NeoAdapter.Ndi] +HKR, , NetworkAddress, 0, %DefaultAddress% +HKR, Ndi, DeviceID, , "NeoAdapter_VPN94" +HKR, , DevLoader, , ndis +HKR, , DeviceVxDs, , Neo6_x86_VPN94.sys +HKR, NDIS, LogDriverName, , "Neo_VPN94" +HKR, NDIS, MajorNdisVersion, 1, 5 +HKR, NDIS, MinorNdisVersion, 1, 0 +HKR, Ndi\Interfaces, DefUpper, , "ndis5" +HKR, Ndi\Interfaces, UpperRange, , "ndis5" +HKR, Ndi\Interfaces, LowerRange, , "ethernet" +HKR, Ndi\Interfaces, DefLower, , "ethernet" +HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" +HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% +HKR, Ndi\Params\NetworkAddress, type, 0, "edit" +HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" +HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" +HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% +HKR, Ndi\Params\NetworkAddress, optional, 0, "0" +HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% +HKR, Ndi\Params\MaxSpeed, type, 0, "int" +HKR, Ndi\Params\MaxSpeed, default, 0, "100" +HKR, Ndi\Params\MaxSpeed, min, 0, "0" +HKR, Ndi\Params\MaxSpeed, max, 0, "2000" +HKR, Ndi\Params\MaxSpeed, step, 0, "1" +HKR, Ndi\Params\MaxSpeed, Base, 0, "10" +HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% +HKR, Ndi\Params\KeepLink, type, 0, "enum" +HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% +HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% +HKR, Ndi\Params\KeepLink, default, 0, "0" + + +[Neo.Service] +DisplayName = %Neo.Service.DispName% +Description = %Neo.Service.Desc% +ServiceType = 1 +StartType = 3 +ErrorControl = 1 +ServiceBinary = %12%\Neo6_x86_VPN94.sys +LoadOrderGroup = NDIS + +[Neo.Reg] +HKR, Ndi, Service, 0, Neo.Service.Name +HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" +HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" + +[Neo.EventLog] +HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN94.sys" +HKR, , TypesSupported, 0x00010001, 7 + +[Strings] +CompanyName = "SoftEther Corporation" +DiskDescription = "VPN Client Device Driver Install Disk" +Neo.Service.Name = "Neo_VPN94" +Neo.Service.DispName = "VPN Client Device Driver - VPN94" +Neo.Service.Desc = "VPN Client Adapter - VPN94" +NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN94" +Neo.EventLog.Name = "Neo" +NetworkAddress = "MAC Address" +DefaultAddress = "000001000001" +MaxSpeed = "Indicate Speed (Mbps)" +KeepLink = "Keep Link" +On = "On" +Off = "Off" + + +; Auto Generated 20180205_163618.965 + diff --git a/src/bin/hamcore/DriverPackages/Neo6_Win10/x86/Neo6_x86_VPN95.inf b/src/bin/hamcore/DriverPackages/Neo6_Win10/x86/Neo6_x86_VPN95.inf index fc17d04e..dc362860 100644 --- a/src/bin/hamcore/DriverPackages/Neo6_Win10/x86/Neo6_x86_VPN95.inf +++ b/src/bin/hamcore/DriverPackages/Neo6_Win10/x86/Neo6_x86_VPN95.inf @@ -1,114 +1,114 @@ -; VPN Client Device Driver for Windows 2000 and Greater -; -; Copyright (c) SoftEther Corporation. All Rights Reserved. -; http://www.softether.co.jp/ -; -; BUILD 9658 - -[Version] -Signature = "$Windows NT$" -Class = Net -ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} -Provider = %CompanyName% -DriverVer = 02/04/2018, 4.25.0.9658 -CatalogFile.NT = Neo6_x86_VPN95.cat - -[Manufacturer] -%CompanyName% = SoftEther - -[SourceDisksNames] -1=%DiskDescription%, "", , - -[SourceDisksFiles] -Neo6_x86_VPN95.sys = 1 - -[DestinationDirs] -DefaultDestDir = 12 -Neo.CopyFiles.Sys = 12 - -[Neo.CopyFiles.Sys] -Neo6_x86_VPN95.sys, , , 2 - -[SoftEther] -%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN95 - -[NeoAdapter.Install] -Characteristics = 0x1 -AddReg = Neo.Reg, NeoAdapter.Ndi -CopyFiles = Neo.CopyFiles.Sys -*IfType = 53 -*MediaType = 0 -*PhysicalMediaType = 0 - -[NeoAdapter.Install.Services] -AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% - -[NeoAdapter.Ndi] -HKR, , NetworkAddress, 0, %DefaultAddress% -HKR, Ndi, DeviceID, , "NeoAdapter_VPN95" -HKR, , DevLoader, , ndis -HKR, , DeviceVxDs, , Neo6_x86_VPN95.sys -HKR, NDIS, LogDriverName, , "Neo_VPN95" -HKR, NDIS, MajorNdisVersion, 1, 5 -HKR, NDIS, MinorNdisVersion, 1, 0 -HKR, Ndi\Interfaces, DefUpper, , "ndis5" -HKR, Ndi\Interfaces, UpperRange, , "ndis5" -HKR, Ndi\Interfaces, LowerRange, , "ethernet" -HKR, Ndi\Interfaces, DefLower, , "ethernet" -HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" -HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% -HKR, Ndi\Params\NetworkAddress, type, 0, "edit" -HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" -HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" -HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% -HKR, Ndi\Params\NetworkAddress, optional, 0, "0" -HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% -HKR, Ndi\Params\MaxSpeed, type, 0, "int" -HKR, Ndi\Params\MaxSpeed, default, 0, "100" -HKR, Ndi\Params\MaxSpeed, min, 0, "0" -HKR, Ndi\Params\MaxSpeed, max, 0, "2000" -HKR, Ndi\Params\MaxSpeed, step, 0, "1" -HKR, Ndi\Params\MaxSpeed, Base, 0, "10" -HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% -HKR, Ndi\Params\KeepLink, type, 0, "enum" -HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% -HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% -HKR, Ndi\Params\KeepLink, default, 0, "0" - - -[Neo.Service] -DisplayName = %Neo.Service.DispName% -Description = %Neo.Service.Desc% -ServiceType = 1 -StartType = 3 -ErrorControl = 1 -ServiceBinary = %12%\Neo6_x86_VPN95.sys -LoadOrderGroup = NDIS - -[Neo.Reg] -HKR, Ndi, Service, 0, Neo.Service.Name -HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" -HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" - -[Neo.EventLog] -HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN95.sys" -HKR, , TypesSupported, 0x00010001, 7 - -[Strings] -CompanyName = "SoftEther Corporation" -DiskDescription = "VPN Client Device Driver Install Disk" -Neo.Service.Name = "Neo_VPN95" -Neo.Service.DispName = "VPN Client Device Driver - VPN95" -Neo.Service.Desc = "VPN Client Adapter - VPN95" -NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN95" -Neo.EventLog.Name = "Neo" -NetworkAddress = "MAC Address" -DefaultAddress = "000001000001" -MaxSpeed = "Indicate Speed (Mbps)" -KeepLink = "Keep Link" -On = "On" -Off = "Off" - - -; Auto Generated 20180205_163619.035 - +; VPN Client Device Driver for Windows 2000 and Greater +; +; Copyright (c) SoftEther Corporation. All Rights Reserved. +; http://www.softether.co.jp/ +; +; BUILD 9658 + +[Version] +Signature = "$Windows NT$" +Class = Net +ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} +Provider = %CompanyName% +DriverVer = 02/04/2018, 4.25.0.9658 +CatalogFile.NT = Neo6_x86_VPN95.cat + +[Manufacturer] +%CompanyName% = SoftEther + +[SourceDisksNames] +1=%DiskDescription%, "", , + +[SourceDisksFiles] +Neo6_x86_VPN95.sys = 1 + +[DestinationDirs] +DefaultDestDir = 12 +Neo.CopyFiles.Sys = 12 + +[Neo.CopyFiles.Sys] +Neo6_x86_VPN95.sys, , , 2 + +[SoftEther] +%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN95 + +[NeoAdapter.Install] +Characteristics = 0x1 +AddReg = Neo.Reg, NeoAdapter.Ndi +CopyFiles = Neo.CopyFiles.Sys +*IfType = 53 +*MediaType = 0 +*PhysicalMediaType = 0 + +[NeoAdapter.Install.Services] +AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% + +[NeoAdapter.Ndi] +HKR, , NetworkAddress, 0, %DefaultAddress% +HKR, Ndi, DeviceID, , "NeoAdapter_VPN95" +HKR, , DevLoader, , ndis +HKR, , DeviceVxDs, , Neo6_x86_VPN95.sys +HKR, NDIS, LogDriverName, , "Neo_VPN95" +HKR, NDIS, MajorNdisVersion, 1, 5 +HKR, NDIS, MinorNdisVersion, 1, 0 +HKR, Ndi\Interfaces, DefUpper, , "ndis5" +HKR, Ndi\Interfaces, UpperRange, , "ndis5" +HKR, Ndi\Interfaces, LowerRange, , "ethernet" +HKR, Ndi\Interfaces, DefLower, , "ethernet" +HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" +HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% +HKR, Ndi\Params\NetworkAddress, type, 0, "edit" +HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" +HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" +HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% +HKR, Ndi\Params\NetworkAddress, optional, 0, "0" +HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% +HKR, Ndi\Params\MaxSpeed, type, 0, "int" +HKR, Ndi\Params\MaxSpeed, default, 0, "100" +HKR, Ndi\Params\MaxSpeed, min, 0, "0" +HKR, Ndi\Params\MaxSpeed, max, 0, "2000" +HKR, Ndi\Params\MaxSpeed, step, 0, "1" +HKR, Ndi\Params\MaxSpeed, Base, 0, "10" +HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% +HKR, Ndi\Params\KeepLink, type, 0, "enum" +HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% +HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% +HKR, Ndi\Params\KeepLink, default, 0, "0" + + +[Neo.Service] +DisplayName = %Neo.Service.DispName% +Description = %Neo.Service.Desc% +ServiceType = 1 +StartType = 3 +ErrorControl = 1 +ServiceBinary = %12%\Neo6_x86_VPN95.sys +LoadOrderGroup = NDIS + +[Neo.Reg] +HKR, Ndi, Service, 0, Neo.Service.Name +HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" +HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" + +[Neo.EventLog] +HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN95.sys" +HKR, , TypesSupported, 0x00010001, 7 + +[Strings] +CompanyName = "SoftEther Corporation" +DiskDescription = "VPN Client Device Driver Install Disk" +Neo.Service.Name = "Neo_VPN95" +Neo.Service.DispName = "VPN Client Device Driver - VPN95" +Neo.Service.Desc = "VPN Client Adapter - VPN95" +NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN95" +Neo.EventLog.Name = "Neo" +NetworkAddress = "MAC Address" +DefaultAddress = "000001000001" +MaxSpeed = "Indicate Speed (Mbps)" +KeepLink = "Keep Link" +On = "On" +Off = "Off" + + +; Auto Generated 20180205_163619.035 + diff --git a/src/bin/hamcore/DriverPackages/Neo6_Win10/x86/Neo6_x86_VPN96.inf b/src/bin/hamcore/DriverPackages/Neo6_Win10/x86/Neo6_x86_VPN96.inf index 0cbef207..7d11abe1 100644 --- a/src/bin/hamcore/DriverPackages/Neo6_Win10/x86/Neo6_x86_VPN96.inf +++ b/src/bin/hamcore/DriverPackages/Neo6_Win10/x86/Neo6_x86_VPN96.inf @@ -1,114 +1,114 @@ -; VPN Client Device Driver for Windows 2000 and Greater -; -; Copyright (c) SoftEther Corporation. All Rights Reserved. -; http://www.softether.co.jp/ -; -; BUILD 9658 - -[Version] -Signature = "$Windows NT$" -Class = Net -ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} -Provider = %CompanyName% -DriverVer = 02/04/2018, 4.25.0.9658 -CatalogFile.NT = Neo6_x86_VPN96.cat - -[Manufacturer] -%CompanyName% = SoftEther - -[SourceDisksNames] -1=%DiskDescription%, "", , - -[SourceDisksFiles] -Neo6_x86_VPN96.sys = 1 - -[DestinationDirs] -DefaultDestDir = 12 -Neo.CopyFiles.Sys = 12 - -[Neo.CopyFiles.Sys] -Neo6_x86_VPN96.sys, , , 2 - -[SoftEther] -%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN96 - -[NeoAdapter.Install] -Characteristics = 0x1 -AddReg = Neo.Reg, NeoAdapter.Ndi -CopyFiles = Neo.CopyFiles.Sys -*IfType = 53 -*MediaType = 0 -*PhysicalMediaType = 0 - -[NeoAdapter.Install.Services] -AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% - -[NeoAdapter.Ndi] -HKR, , NetworkAddress, 0, %DefaultAddress% -HKR, Ndi, DeviceID, , "NeoAdapter_VPN96" -HKR, , DevLoader, , ndis -HKR, , DeviceVxDs, , Neo6_x86_VPN96.sys -HKR, NDIS, LogDriverName, , "Neo_VPN96" -HKR, NDIS, MajorNdisVersion, 1, 5 -HKR, NDIS, MinorNdisVersion, 1, 0 -HKR, Ndi\Interfaces, DefUpper, , "ndis5" -HKR, Ndi\Interfaces, UpperRange, , "ndis5" -HKR, Ndi\Interfaces, LowerRange, , "ethernet" -HKR, Ndi\Interfaces, DefLower, , "ethernet" -HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" -HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% -HKR, Ndi\Params\NetworkAddress, type, 0, "edit" -HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" -HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" -HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% -HKR, Ndi\Params\NetworkAddress, optional, 0, "0" -HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% -HKR, Ndi\Params\MaxSpeed, type, 0, "int" -HKR, Ndi\Params\MaxSpeed, default, 0, "100" -HKR, Ndi\Params\MaxSpeed, min, 0, "0" -HKR, Ndi\Params\MaxSpeed, max, 0, "2000" -HKR, Ndi\Params\MaxSpeed, step, 0, "1" -HKR, Ndi\Params\MaxSpeed, Base, 0, "10" -HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% -HKR, Ndi\Params\KeepLink, type, 0, "enum" -HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% -HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% -HKR, Ndi\Params\KeepLink, default, 0, "0" - - -[Neo.Service] -DisplayName = %Neo.Service.DispName% -Description = %Neo.Service.Desc% -ServiceType = 1 -StartType = 3 -ErrorControl = 1 -ServiceBinary = %12%\Neo6_x86_VPN96.sys -LoadOrderGroup = NDIS - -[Neo.Reg] -HKR, Ndi, Service, 0, Neo.Service.Name -HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" -HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" - -[Neo.EventLog] -HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN96.sys" -HKR, , TypesSupported, 0x00010001, 7 - -[Strings] -CompanyName = "SoftEther Corporation" -DiskDescription = "VPN Client Device Driver Install Disk" -Neo.Service.Name = "Neo_VPN96" -Neo.Service.DispName = "VPN Client Device Driver - VPN96" -Neo.Service.Desc = "VPN Client Adapter - VPN96" -NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN96" -Neo.EventLog.Name = "Neo" -NetworkAddress = "MAC Address" -DefaultAddress = "000001000001" -MaxSpeed = "Indicate Speed (Mbps)" -KeepLink = "Keep Link" -On = "On" -Off = "Off" - - -; Auto Generated 20180205_163619.107 - +; VPN Client Device Driver for Windows 2000 and Greater +; +; Copyright (c) SoftEther Corporation. All Rights Reserved. +; http://www.softether.co.jp/ +; +; BUILD 9658 + +[Version] +Signature = "$Windows NT$" +Class = Net +ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} +Provider = %CompanyName% +DriverVer = 02/04/2018, 4.25.0.9658 +CatalogFile.NT = Neo6_x86_VPN96.cat + +[Manufacturer] +%CompanyName% = SoftEther + +[SourceDisksNames] +1=%DiskDescription%, "", , + +[SourceDisksFiles] +Neo6_x86_VPN96.sys = 1 + +[DestinationDirs] +DefaultDestDir = 12 +Neo.CopyFiles.Sys = 12 + +[Neo.CopyFiles.Sys] +Neo6_x86_VPN96.sys, , , 2 + +[SoftEther] +%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN96 + +[NeoAdapter.Install] +Characteristics = 0x1 +AddReg = Neo.Reg, NeoAdapter.Ndi +CopyFiles = Neo.CopyFiles.Sys +*IfType = 53 +*MediaType = 0 +*PhysicalMediaType = 0 + +[NeoAdapter.Install.Services] +AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% + +[NeoAdapter.Ndi] +HKR, , NetworkAddress, 0, %DefaultAddress% +HKR, Ndi, DeviceID, , "NeoAdapter_VPN96" +HKR, , DevLoader, , ndis +HKR, , DeviceVxDs, , Neo6_x86_VPN96.sys +HKR, NDIS, LogDriverName, , "Neo_VPN96" +HKR, NDIS, MajorNdisVersion, 1, 5 +HKR, NDIS, MinorNdisVersion, 1, 0 +HKR, Ndi\Interfaces, DefUpper, , "ndis5" +HKR, Ndi\Interfaces, UpperRange, , "ndis5" +HKR, Ndi\Interfaces, LowerRange, , "ethernet" +HKR, Ndi\Interfaces, DefLower, , "ethernet" +HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" +HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% +HKR, Ndi\Params\NetworkAddress, type, 0, "edit" +HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" +HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" +HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% +HKR, Ndi\Params\NetworkAddress, optional, 0, "0" +HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% +HKR, Ndi\Params\MaxSpeed, type, 0, "int" +HKR, Ndi\Params\MaxSpeed, default, 0, "100" +HKR, Ndi\Params\MaxSpeed, min, 0, "0" +HKR, Ndi\Params\MaxSpeed, max, 0, "2000" +HKR, Ndi\Params\MaxSpeed, step, 0, "1" +HKR, Ndi\Params\MaxSpeed, Base, 0, "10" +HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% +HKR, Ndi\Params\KeepLink, type, 0, "enum" +HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% +HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% +HKR, Ndi\Params\KeepLink, default, 0, "0" + + +[Neo.Service] +DisplayName = %Neo.Service.DispName% +Description = %Neo.Service.Desc% +ServiceType = 1 +StartType = 3 +ErrorControl = 1 +ServiceBinary = %12%\Neo6_x86_VPN96.sys +LoadOrderGroup = NDIS + +[Neo.Reg] +HKR, Ndi, Service, 0, Neo.Service.Name +HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" +HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" + +[Neo.EventLog] +HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN96.sys" +HKR, , TypesSupported, 0x00010001, 7 + +[Strings] +CompanyName = "SoftEther Corporation" +DiskDescription = "VPN Client Device Driver Install Disk" +Neo.Service.Name = "Neo_VPN96" +Neo.Service.DispName = "VPN Client Device Driver - VPN96" +Neo.Service.Desc = "VPN Client Adapter - VPN96" +NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN96" +Neo.EventLog.Name = "Neo" +NetworkAddress = "MAC Address" +DefaultAddress = "000001000001" +MaxSpeed = "Indicate Speed (Mbps)" +KeepLink = "Keep Link" +On = "On" +Off = "Off" + + +; Auto Generated 20180205_163619.107 + diff --git a/src/bin/hamcore/DriverPackages/Neo6_Win10/x86/Neo6_x86_VPN97.inf b/src/bin/hamcore/DriverPackages/Neo6_Win10/x86/Neo6_x86_VPN97.inf index 734f7fc8..b8795c72 100644 --- a/src/bin/hamcore/DriverPackages/Neo6_Win10/x86/Neo6_x86_VPN97.inf +++ b/src/bin/hamcore/DriverPackages/Neo6_Win10/x86/Neo6_x86_VPN97.inf @@ -1,114 +1,114 @@ -; VPN Client Device Driver for Windows 2000 and Greater -; -; Copyright (c) SoftEther Corporation. All Rights Reserved. -; http://www.softether.co.jp/ -; -; BUILD 9658 - -[Version] -Signature = "$Windows NT$" -Class = Net -ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} -Provider = %CompanyName% -DriverVer = 02/04/2018, 4.25.0.9658 -CatalogFile.NT = Neo6_x86_VPN97.cat - -[Manufacturer] -%CompanyName% = SoftEther - -[SourceDisksNames] -1=%DiskDescription%, "", , - -[SourceDisksFiles] -Neo6_x86_VPN97.sys = 1 - -[DestinationDirs] -DefaultDestDir = 12 -Neo.CopyFiles.Sys = 12 - -[Neo.CopyFiles.Sys] -Neo6_x86_VPN97.sys, , , 2 - -[SoftEther] -%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN97 - -[NeoAdapter.Install] -Characteristics = 0x1 -AddReg = Neo.Reg, NeoAdapter.Ndi -CopyFiles = Neo.CopyFiles.Sys -*IfType = 53 -*MediaType = 0 -*PhysicalMediaType = 0 - -[NeoAdapter.Install.Services] -AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% - -[NeoAdapter.Ndi] -HKR, , NetworkAddress, 0, %DefaultAddress% -HKR, Ndi, DeviceID, , "NeoAdapter_VPN97" -HKR, , DevLoader, , ndis -HKR, , DeviceVxDs, , Neo6_x86_VPN97.sys -HKR, NDIS, LogDriverName, , "Neo_VPN97" -HKR, NDIS, MajorNdisVersion, 1, 5 -HKR, NDIS, MinorNdisVersion, 1, 0 -HKR, Ndi\Interfaces, DefUpper, , "ndis5" -HKR, Ndi\Interfaces, UpperRange, , "ndis5" -HKR, Ndi\Interfaces, LowerRange, , "ethernet" -HKR, Ndi\Interfaces, DefLower, , "ethernet" -HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" -HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% -HKR, Ndi\Params\NetworkAddress, type, 0, "edit" -HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" -HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" -HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% -HKR, Ndi\Params\NetworkAddress, optional, 0, "0" -HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% -HKR, Ndi\Params\MaxSpeed, type, 0, "int" -HKR, Ndi\Params\MaxSpeed, default, 0, "100" -HKR, Ndi\Params\MaxSpeed, min, 0, "0" -HKR, Ndi\Params\MaxSpeed, max, 0, "2000" -HKR, Ndi\Params\MaxSpeed, step, 0, "1" -HKR, Ndi\Params\MaxSpeed, Base, 0, "10" -HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% -HKR, Ndi\Params\KeepLink, type, 0, "enum" -HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% -HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% -HKR, Ndi\Params\KeepLink, default, 0, "0" - - -[Neo.Service] -DisplayName = %Neo.Service.DispName% -Description = %Neo.Service.Desc% -ServiceType = 1 -StartType = 3 -ErrorControl = 1 -ServiceBinary = %12%\Neo6_x86_VPN97.sys -LoadOrderGroup = NDIS - -[Neo.Reg] -HKR, Ndi, Service, 0, Neo.Service.Name -HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" -HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" - -[Neo.EventLog] -HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN97.sys" -HKR, , TypesSupported, 0x00010001, 7 - -[Strings] -CompanyName = "SoftEther Corporation" -DiskDescription = "VPN Client Device Driver Install Disk" -Neo.Service.Name = "Neo_VPN97" -Neo.Service.DispName = "VPN Client Device Driver - VPN97" -Neo.Service.Desc = "VPN Client Adapter - VPN97" -NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN97" -Neo.EventLog.Name = "Neo" -NetworkAddress = "MAC Address" -DefaultAddress = "000001000001" -MaxSpeed = "Indicate Speed (Mbps)" -KeepLink = "Keep Link" -On = "On" -Off = "Off" - - -; Auto Generated 20180205_163619.177 - +; VPN Client Device Driver for Windows 2000 and Greater +; +; Copyright (c) SoftEther Corporation. All Rights Reserved. +; http://www.softether.co.jp/ +; +; BUILD 9658 + +[Version] +Signature = "$Windows NT$" +Class = Net +ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} +Provider = %CompanyName% +DriverVer = 02/04/2018, 4.25.0.9658 +CatalogFile.NT = Neo6_x86_VPN97.cat + +[Manufacturer] +%CompanyName% = SoftEther + +[SourceDisksNames] +1=%DiskDescription%, "", , + +[SourceDisksFiles] +Neo6_x86_VPN97.sys = 1 + +[DestinationDirs] +DefaultDestDir = 12 +Neo.CopyFiles.Sys = 12 + +[Neo.CopyFiles.Sys] +Neo6_x86_VPN97.sys, , , 2 + +[SoftEther] +%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN97 + +[NeoAdapter.Install] +Characteristics = 0x1 +AddReg = Neo.Reg, NeoAdapter.Ndi +CopyFiles = Neo.CopyFiles.Sys +*IfType = 53 +*MediaType = 0 +*PhysicalMediaType = 0 + +[NeoAdapter.Install.Services] +AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% + +[NeoAdapter.Ndi] +HKR, , NetworkAddress, 0, %DefaultAddress% +HKR, Ndi, DeviceID, , "NeoAdapter_VPN97" +HKR, , DevLoader, , ndis +HKR, , DeviceVxDs, , Neo6_x86_VPN97.sys +HKR, NDIS, LogDriverName, , "Neo_VPN97" +HKR, NDIS, MajorNdisVersion, 1, 5 +HKR, NDIS, MinorNdisVersion, 1, 0 +HKR, Ndi\Interfaces, DefUpper, , "ndis5" +HKR, Ndi\Interfaces, UpperRange, , "ndis5" +HKR, Ndi\Interfaces, LowerRange, , "ethernet" +HKR, Ndi\Interfaces, DefLower, , "ethernet" +HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" +HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% +HKR, Ndi\Params\NetworkAddress, type, 0, "edit" +HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" +HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" +HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% +HKR, Ndi\Params\NetworkAddress, optional, 0, "0" +HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% +HKR, Ndi\Params\MaxSpeed, type, 0, "int" +HKR, Ndi\Params\MaxSpeed, default, 0, "100" +HKR, Ndi\Params\MaxSpeed, min, 0, "0" +HKR, Ndi\Params\MaxSpeed, max, 0, "2000" +HKR, Ndi\Params\MaxSpeed, step, 0, "1" +HKR, Ndi\Params\MaxSpeed, Base, 0, "10" +HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% +HKR, Ndi\Params\KeepLink, type, 0, "enum" +HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% +HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% +HKR, Ndi\Params\KeepLink, default, 0, "0" + + +[Neo.Service] +DisplayName = %Neo.Service.DispName% +Description = %Neo.Service.Desc% +ServiceType = 1 +StartType = 3 +ErrorControl = 1 +ServiceBinary = %12%\Neo6_x86_VPN97.sys +LoadOrderGroup = NDIS + +[Neo.Reg] +HKR, Ndi, Service, 0, Neo.Service.Name +HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" +HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" + +[Neo.EventLog] +HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN97.sys" +HKR, , TypesSupported, 0x00010001, 7 + +[Strings] +CompanyName = "SoftEther Corporation" +DiskDescription = "VPN Client Device Driver Install Disk" +Neo.Service.Name = "Neo_VPN97" +Neo.Service.DispName = "VPN Client Device Driver - VPN97" +Neo.Service.Desc = "VPN Client Adapter - VPN97" +NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN97" +Neo.EventLog.Name = "Neo" +NetworkAddress = "MAC Address" +DefaultAddress = "000001000001" +MaxSpeed = "Indicate Speed (Mbps)" +KeepLink = "Keep Link" +On = "On" +Off = "Off" + + +; Auto Generated 20180205_163619.177 + diff --git a/src/bin/hamcore/DriverPackages/Neo6_Win10/x86/Neo6_x86_VPN98.inf b/src/bin/hamcore/DriverPackages/Neo6_Win10/x86/Neo6_x86_VPN98.inf index d0acf88e..659e0278 100644 --- a/src/bin/hamcore/DriverPackages/Neo6_Win10/x86/Neo6_x86_VPN98.inf +++ b/src/bin/hamcore/DriverPackages/Neo6_Win10/x86/Neo6_x86_VPN98.inf @@ -1,114 +1,114 @@ -; VPN Client Device Driver for Windows 2000 and Greater -; -; Copyright (c) SoftEther Corporation. All Rights Reserved. -; http://www.softether.co.jp/ -; -; BUILD 9658 - -[Version] -Signature = "$Windows NT$" -Class = Net -ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} -Provider = %CompanyName% -DriverVer = 02/04/2018, 4.25.0.9658 -CatalogFile.NT = Neo6_x86_VPN98.cat - -[Manufacturer] -%CompanyName% = SoftEther - -[SourceDisksNames] -1=%DiskDescription%, "", , - -[SourceDisksFiles] -Neo6_x86_VPN98.sys = 1 - -[DestinationDirs] -DefaultDestDir = 12 -Neo.CopyFiles.Sys = 12 - -[Neo.CopyFiles.Sys] -Neo6_x86_VPN98.sys, , , 2 - -[SoftEther] -%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN98 - -[NeoAdapter.Install] -Characteristics = 0x1 -AddReg = Neo.Reg, NeoAdapter.Ndi -CopyFiles = Neo.CopyFiles.Sys -*IfType = 53 -*MediaType = 0 -*PhysicalMediaType = 0 - -[NeoAdapter.Install.Services] -AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% - -[NeoAdapter.Ndi] -HKR, , NetworkAddress, 0, %DefaultAddress% -HKR, Ndi, DeviceID, , "NeoAdapter_VPN98" -HKR, , DevLoader, , ndis -HKR, , DeviceVxDs, , Neo6_x86_VPN98.sys -HKR, NDIS, LogDriverName, , "Neo_VPN98" -HKR, NDIS, MajorNdisVersion, 1, 5 -HKR, NDIS, MinorNdisVersion, 1, 0 -HKR, Ndi\Interfaces, DefUpper, , "ndis5" -HKR, Ndi\Interfaces, UpperRange, , "ndis5" -HKR, Ndi\Interfaces, LowerRange, , "ethernet" -HKR, Ndi\Interfaces, DefLower, , "ethernet" -HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" -HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% -HKR, Ndi\Params\NetworkAddress, type, 0, "edit" -HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" -HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" -HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% -HKR, Ndi\Params\NetworkAddress, optional, 0, "0" -HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% -HKR, Ndi\Params\MaxSpeed, type, 0, "int" -HKR, Ndi\Params\MaxSpeed, default, 0, "100" -HKR, Ndi\Params\MaxSpeed, min, 0, "0" -HKR, Ndi\Params\MaxSpeed, max, 0, "2000" -HKR, Ndi\Params\MaxSpeed, step, 0, "1" -HKR, Ndi\Params\MaxSpeed, Base, 0, "10" -HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% -HKR, Ndi\Params\KeepLink, type, 0, "enum" -HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% -HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% -HKR, Ndi\Params\KeepLink, default, 0, "0" - - -[Neo.Service] -DisplayName = %Neo.Service.DispName% -Description = %Neo.Service.Desc% -ServiceType = 1 -StartType = 3 -ErrorControl = 1 -ServiceBinary = %12%\Neo6_x86_VPN98.sys -LoadOrderGroup = NDIS - -[Neo.Reg] -HKR, Ndi, Service, 0, Neo.Service.Name -HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" -HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" - -[Neo.EventLog] -HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN98.sys" -HKR, , TypesSupported, 0x00010001, 7 - -[Strings] -CompanyName = "SoftEther Corporation" -DiskDescription = "VPN Client Device Driver Install Disk" -Neo.Service.Name = "Neo_VPN98" -Neo.Service.DispName = "VPN Client Device Driver - VPN98" -Neo.Service.Desc = "VPN Client Adapter - VPN98" -NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN98" -Neo.EventLog.Name = "Neo" -NetworkAddress = "MAC Address" -DefaultAddress = "000001000001" -MaxSpeed = "Indicate Speed (Mbps)" -KeepLink = "Keep Link" -On = "On" -Off = "Off" - - -; Auto Generated 20180205_163619.248 - +; VPN Client Device Driver for Windows 2000 and Greater +; +; Copyright (c) SoftEther Corporation. All Rights Reserved. +; http://www.softether.co.jp/ +; +; BUILD 9658 + +[Version] +Signature = "$Windows NT$" +Class = Net +ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} +Provider = %CompanyName% +DriverVer = 02/04/2018, 4.25.0.9658 +CatalogFile.NT = Neo6_x86_VPN98.cat + +[Manufacturer] +%CompanyName% = SoftEther + +[SourceDisksNames] +1=%DiskDescription%, "", , + +[SourceDisksFiles] +Neo6_x86_VPN98.sys = 1 + +[DestinationDirs] +DefaultDestDir = 12 +Neo.CopyFiles.Sys = 12 + +[Neo.CopyFiles.Sys] +Neo6_x86_VPN98.sys, , , 2 + +[SoftEther] +%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN98 + +[NeoAdapter.Install] +Characteristics = 0x1 +AddReg = Neo.Reg, NeoAdapter.Ndi +CopyFiles = Neo.CopyFiles.Sys +*IfType = 53 +*MediaType = 0 +*PhysicalMediaType = 0 + +[NeoAdapter.Install.Services] +AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% + +[NeoAdapter.Ndi] +HKR, , NetworkAddress, 0, %DefaultAddress% +HKR, Ndi, DeviceID, , "NeoAdapter_VPN98" +HKR, , DevLoader, , ndis +HKR, , DeviceVxDs, , Neo6_x86_VPN98.sys +HKR, NDIS, LogDriverName, , "Neo_VPN98" +HKR, NDIS, MajorNdisVersion, 1, 5 +HKR, NDIS, MinorNdisVersion, 1, 0 +HKR, Ndi\Interfaces, DefUpper, , "ndis5" +HKR, Ndi\Interfaces, UpperRange, , "ndis5" +HKR, Ndi\Interfaces, LowerRange, , "ethernet" +HKR, Ndi\Interfaces, DefLower, , "ethernet" +HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" +HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% +HKR, Ndi\Params\NetworkAddress, type, 0, "edit" +HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" +HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" +HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% +HKR, Ndi\Params\NetworkAddress, optional, 0, "0" +HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% +HKR, Ndi\Params\MaxSpeed, type, 0, "int" +HKR, Ndi\Params\MaxSpeed, default, 0, "100" +HKR, Ndi\Params\MaxSpeed, min, 0, "0" +HKR, Ndi\Params\MaxSpeed, max, 0, "2000" +HKR, Ndi\Params\MaxSpeed, step, 0, "1" +HKR, Ndi\Params\MaxSpeed, Base, 0, "10" +HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% +HKR, Ndi\Params\KeepLink, type, 0, "enum" +HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% +HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% +HKR, Ndi\Params\KeepLink, default, 0, "0" + + +[Neo.Service] +DisplayName = %Neo.Service.DispName% +Description = %Neo.Service.Desc% +ServiceType = 1 +StartType = 3 +ErrorControl = 1 +ServiceBinary = %12%\Neo6_x86_VPN98.sys +LoadOrderGroup = NDIS + +[Neo.Reg] +HKR, Ndi, Service, 0, Neo.Service.Name +HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" +HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" + +[Neo.EventLog] +HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN98.sys" +HKR, , TypesSupported, 0x00010001, 7 + +[Strings] +CompanyName = "SoftEther Corporation" +DiskDescription = "VPN Client Device Driver Install Disk" +Neo.Service.Name = "Neo_VPN98" +Neo.Service.DispName = "VPN Client Device Driver - VPN98" +Neo.Service.Desc = "VPN Client Adapter - VPN98" +NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN98" +Neo.EventLog.Name = "Neo" +NetworkAddress = "MAC Address" +DefaultAddress = "000001000001" +MaxSpeed = "Indicate Speed (Mbps)" +KeepLink = "Keep Link" +On = "On" +Off = "Off" + + +; Auto Generated 20180205_163619.248 + diff --git a/src/bin/hamcore/DriverPackages/Neo6_Win10/x86/Neo6_x86_VPN99.inf b/src/bin/hamcore/DriverPackages/Neo6_Win10/x86/Neo6_x86_VPN99.inf index ac0bd957..1acd8ab3 100644 --- a/src/bin/hamcore/DriverPackages/Neo6_Win10/x86/Neo6_x86_VPN99.inf +++ b/src/bin/hamcore/DriverPackages/Neo6_Win10/x86/Neo6_x86_VPN99.inf @@ -1,114 +1,114 @@ -; VPN Client Device Driver for Windows 2000 and Greater -; -; Copyright (c) SoftEther Corporation. All Rights Reserved. -; http://www.softether.co.jp/ -; -; BUILD 9658 - -[Version] -Signature = "$Windows NT$" -Class = Net -ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} -Provider = %CompanyName% -DriverVer = 02/04/2018, 4.25.0.9658 -CatalogFile.NT = Neo6_x86_VPN99.cat - -[Manufacturer] -%CompanyName% = SoftEther - -[SourceDisksNames] -1=%DiskDescription%, "", , - -[SourceDisksFiles] -Neo6_x86_VPN99.sys = 1 - -[DestinationDirs] -DefaultDestDir = 12 -Neo.CopyFiles.Sys = 12 - -[Neo.CopyFiles.Sys] -Neo6_x86_VPN99.sys, , , 2 - -[SoftEther] -%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN99 - -[NeoAdapter.Install] -Characteristics = 0x1 -AddReg = Neo.Reg, NeoAdapter.Ndi -CopyFiles = Neo.CopyFiles.Sys -*IfType = 53 -*MediaType = 0 -*PhysicalMediaType = 0 - -[NeoAdapter.Install.Services] -AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% - -[NeoAdapter.Ndi] -HKR, , NetworkAddress, 0, %DefaultAddress% -HKR, Ndi, DeviceID, , "NeoAdapter_VPN99" -HKR, , DevLoader, , ndis -HKR, , DeviceVxDs, , Neo6_x86_VPN99.sys -HKR, NDIS, LogDriverName, , "Neo_VPN99" -HKR, NDIS, MajorNdisVersion, 1, 5 -HKR, NDIS, MinorNdisVersion, 1, 0 -HKR, Ndi\Interfaces, DefUpper, , "ndis5" -HKR, Ndi\Interfaces, UpperRange, , "ndis5" -HKR, Ndi\Interfaces, LowerRange, , "ethernet" -HKR, Ndi\Interfaces, DefLower, , "ethernet" -HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" -HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% -HKR, Ndi\Params\NetworkAddress, type, 0, "edit" -HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" -HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" -HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% -HKR, Ndi\Params\NetworkAddress, optional, 0, "0" -HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% -HKR, Ndi\Params\MaxSpeed, type, 0, "int" -HKR, Ndi\Params\MaxSpeed, default, 0, "100" -HKR, Ndi\Params\MaxSpeed, min, 0, "0" -HKR, Ndi\Params\MaxSpeed, max, 0, "2000" -HKR, Ndi\Params\MaxSpeed, step, 0, "1" -HKR, Ndi\Params\MaxSpeed, Base, 0, "10" -HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% -HKR, Ndi\Params\KeepLink, type, 0, "enum" -HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% -HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% -HKR, Ndi\Params\KeepLink, default, 0, "0" - - -[Neo.Service] -DisplayName = %Neo.Service.DispName% -Description = %Neo.Service.Desc% -ServiceType = 1 -StartType = 3 -ErrorControl = 1 -ServiceBinary = %12%\Neo6_x86_VPN99.sys -LoadOrderGroup = NDIS - -[Neo.Reg] -HKR, Ndi, Service, 0, Neo.Service.Name -HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" -HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" - -[Neo.EventLog] -HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN99.sys" -HKR, , TypesSupported, 0x00010001, 7 - -[Strings] -CompanyName = "SoftEther Corporation" -DiskDescription = "VPN Client Device Driver Install Disk" -Neo.Service.Name = "Neo_VPN99" -Neo.Service.DispName = "VPN Client Device Driver - VPN99" -Neo.Service.Desc = "VPN Client Adapter - VPN99" -NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN99" -Neo.EventLog.Name = "Neo" -NetworkAddress = "MAC Address" -DefaultAddress = "000001000001" -MaxSpeed = "Indicate Speed (Mbps)" -KeepLink = "Keep Link" -On = "On" -Off = "Off" - - -; Auto Generated 20180205_163619.319 - +; VPN Client Device Driver for Windows 2000 and Greater +; +; Copyright (c) SoftEther Corporation. All Rights Reserved. +; http://www.softether.co.jp/ +; +; BUILD 9658 + +[Version] +Signature = "$Windows NT$" +Class = Net +ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} +Provider = %CompanyName% +DriverVer = 02/04/2018, 4.25.0.9658 +CatalogFile.NT = Neo6_x86_VPN99.cat + +[Manufacturer] +%CompanyName% = SoftEther + +[SourceDisksNames] +1=%DiskDescription%, "", , + +[SourceDisksFiles] +Neo6_x86_VPN99.sys = 1 + +[DestinationDirs] +DefaultDestDir = 12 +Neo.CopyFiles.Sys = 12 + +[Neo.CopyFiles.Sys] +Neo6_x86_VPN99.sys, , , 2 + +[SoftEther] +%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN99 + +[NeoAdapter.Install] +Characteristics = 0x1 +AddReg = Neo.Reg, NeoAdapter.Ndi +CopyFiles = Neo.CopyFiles.Sys +*IfType = 53 +*MediaType = 0 +*PhysicalMediaType = 0 + +[NeoAdapter.Install.Services] +AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% + +[NeoAdapter.Ndi] +HKR, , NetworkAddress, 0, %DefaultAddress% +HKR, Ndi, DeviceID, , "NeoAdapter_VPN99" +HKR, , DevLoader, , ndis +HKR, , DeviceVxDs, , Neo6_x86_VPN99.sys +HKR, NDIS, LogDriverName, , "Neo_VPN99" +HKR, NDIS, MajorNdisVersion, 1, 5 +HKR, NDIS, MinorNdisVersion, 1, 0 +HKR, Ndi\Interfaces, DefUpper, , "ndis5" +HKR, Ndi\Interfaces, UpperRange, , "ndis5" +HKR, Ndi\Interfaces, LowerRange, , "ethernet" +HKR, Ndi\Interfaces, DefLower, , "ethernet" +HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" +HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% +HKR, Ndi\Params\NetworkAddress, type, 0, "edit" +HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" +HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" +HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% +HKR, Ndi\Params\NetworkAddress, optional, 0, "0" +HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% +HKR, Ndi\Params\MaxSpeed, type, 0, "int" +HKR, Ndi\Params\MaxSpeed, default, 0, "100" +HKR, Ndi\Params\MaxSpeed, min, 0, "0" +HKR, Ndi\Params\MaxSpeed, max, 0, "2000" +HKR, Ndi\Params\MaxSpeed, step, 0, "1" +HKR, Ndi\Params\MaxSpeed, Base, 0, "10" +HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% +HKR, Ndi\Params\KeepLink, type, 0, "enum" +HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% +HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% +HKR, Ndi\Params\KeepLink, default, 0, "0" + + +[Neo.Service] +DisplayName = %Neo.Service.DispName% +Description = %Neo.Service.Desc% +ServiceType = 1 +StartType = 3 +ErrorControl = 1 +ServiceBinary = %12%\Neo6_x86_VPN99.sys +LoadOrderGroup = NDIS + +[Neo.Reg] +HKR, Ndi, Service, 0, Neo.Service.Name +HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" +HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" + +[Neo.EventLog] +HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN99.sys" +HKR, , TypesSupported, 0x00010001, 7 + +[Strings] +CompanyName = "SoftEther Corporation" +DiskDescription = "VPN Client Device Driver Install Disk" +Neo.Service.Name = "Neo_VPN99" +Neo.Service.DispName = "VPN Client Device Driver - VPN99" +Neo.Service.Desc = "VPN Client Adapter - VPN99" +NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN99" +Neo.EventLog.Name = "Neo" +NetworkAddress = "MAC Address" +DefaultAddress = "000001000001" +MaxSpeed = "Indicate Speed (Mbps)" +KeepLink = "Keep Link" +On = "On" +Off = "Off" + + +; Auto Generated 20180205_163619.319 + diff --git a/src/bin/hamcore/DriverPackages/Neo6_Win8/x64/Neo6_x64_VPN.inf b/src/bin/hamcore/DriverPackages/Neo6_Win8/x64/Neo6_x64_VPN.inf index 1660effa..c2a24b83 100644 --- a/src/bin/hamcore/DriverPackages/Neo6_Win8/x64/Neo6_x64_VPN.inf +++ b/src/bin/hamcore/DriverPackages/Neo6_Win8/x64/Neo6_x64_VPN.inf @@ -1,114 +1,114 @@ -; VPN Client Device Driver for Windows 2000 and Greater -; -; Copyright (c) SoftEther Corporation. All Rights Reserved. -; http://www.softether.co.jp/ -; -; BUILD 9658 - -[Version] -Signature = "$Windows NT$" -Class = Net -ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} -Provider = %CompanyName% -DriverVer = 02/04/2018, 4.25.0.9658 -CatalogFile.NT = inf_VPN.cat - -[Manufacturer] -%CompanyName% = SoftEther, NTamd64 - -[SourceDisksNames] -1=%DiskDescription%, "", , - -[SourceDisksFiles] -Neo_VPN.sys = 1 - -[DestinationDirs] -DefaultDestDir = 12 -Neo.CopyFiles.Sys = 12 - -[Neo.CopyFiles.Sys] -Neo_VPN.sys, , , 2 - -[SoftEther.NTamd64] -%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN - -[NeoAdapter.Install] -Characteristics = 0x1 -AddReg = Neo.Reg, NeoAdapter.Ndi -CopyFiles = Neo.CopyFiles.Sys -*IfType = 53 -*MediaType = 0 -*PhysicalMediaType = 0 - -[NeoAdapter.Install.Services] -AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% - -[NeoAdapter.Ndi] -HKR, , NetworkAddress, 0, %DefaultAddress% -HKR, Ndi, DeviceID, , "NeoAdapter_VPN" -HKR, , DevLoader, , ndis -HKR, , DeviceVxDs, , Neo_VPN.sys -HKR, NDIS, LogDriverName, , "Neo_VPN" -HKR, NDIS, MajorNdisVersion, 1, 5 -HKR, NDIS, MinorNdisVersion, 1, 0 -HKR, Ndi\Interfaces, DefUpper, , "ndis5" -HKR, Ndi\Interfaces, UpperRange, , "ndis5" -HKR, Ndi\Interfaces, LowerRange, , "ethernet" -HKR, Ndi\Interfaces, DefLower, , "ethernet" -HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" -HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% -HKR, Ndi\Params\NetworkAddress, type, 0, "edit" -HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" -HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" -HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% -HKR, Ndi\Params\NetworkAddress, optional, 0, "0" -HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% -HKR, Ndi\Params\MaxSpeed, type, 0, "int" -HKR, Ndi\Params\MaxSpeed, default, 0, "100" -HKR, Ndi\Params\MaxSpeed, min, 0, "0" -HKR, Ndi\Params\MaxSpeed, max, 0, "2000" -HKR, Ndi\Params\MaxSpeed, step, 0, "1" -HKR, Ndi\Params\MaxSpeed, Base, 0, "10" -HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% -HKR, Ndi\Params\KeepLink, type, 0, "enum" -HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% -HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% -HKR, Ndi\Params\KeepLink, default, 0, "0" - - -[Neo.Service] -DisplayName = %Neo.Service.DispName% -Description = %Neo.Service.Desc% -ServiceType = 1 -StartType = 3 -ErrorControl = 1 -ServiceBinary = %12%\Neo_VPN.sys -LoadOrderGroup = NDIS - -[Neo.Reg] -HKR, Ndi, Service, 0, Neo.Service.Name -HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" -HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" - -[Neo.EventLog] -HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN.sys" -HKR, , TypesSupported, 0x00010001, 7 - -[Strings] -CompanyName = "SoftEther Corporation" -DiskDescription = "VPN Client Device Driver Install Disk" -Neo.Service.Name = "Neo_VPN" -Neo.Service.DispName = "VPN Client Device Driver - VPN" -Neo.Service.Desc = "VPN Client Adapter - VPN" -NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN" -Neo.EventLog.Name = "Neo" -NetworkAddress = "MAC Address" -DefaultAddress = "000001000001" -MaxSpeed = "Indicate Speed (Mbps)" -KeepLink = "Keep Link" -On = "On" -Off = "Off" - - -; Auto Generated 20180205_163610.737 - +; VPN Client Device Driver for Windows 2000 and Greater +; +; Copyright (c) SoftEther Corporation. All Rights Reserved. +; http://www.softether.co.jp/ +; +; BUILD 9658 + +[Version] +Signature = "$Windows NT$" +Class = Net +ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} +Provider = %CompanyName% +DriverVer = 02/04/2018, 4.25.0.9658 +CatalogFile.NT = inf_VPN.cat + +[Manufacturer] +%CompanyName% = SoftEther, NTamd64 + +[SourceDisksNames] +1=%DiskDescription%, "", , + +[SourceDisksFiles] +Neo_VPN.sys = 1 + +[DestinationDirs] +DefaultDestDir = 12 +Neo.CopyFiles.Sys = 12 + +[Neo.CopyFiles.Sys] +Neo_VPN.sys, , , 2 + +[SoftEther.NTamd64] +%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN + +[NeoAdapter.Install] +Characteristics = 0x1 +AddReg = Neo.Reg, NeoAdapter.Ndi +CopyFiles = Neo.CopyFiles.Sys +*IfType = 53 +*MediaType = 0 +*PhysicalMediaType = 0 + +[NeoAdapter.Install.Services] +AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% + +[NeoAdapter.Ndi] +HKR, , NetworkAddress, 0, %DefaultAddress% +HKR, Ndi, DeviceID, , "NeoAdapter_VPN" +HKR, , DevLoader, , ndis +HKR, , DeviceVxDs, , Neo_VPN.sys +HKR, NDIS, LogDriverName, , "Neo_VPN" +HKR, NDIS, MajorNdisVersion, 1, 5 +HKR, NDIS, MinorNdisVersion, 1, 0 +HKR, Ndi\Interfaces, DefUpper, , "ndis5" +HKR, Ndi\Interfaces, UpperRange, , "ndis5" +HKR, Ndi\Interfaces, LowerRange, , "ethernet" +HKR, Ndi\Interfaces, DefLower, , "ethernet" +HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" +HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% +HKR, Ndi\Params\NetworkAddress, type, 0, "edit" +HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" +HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" +HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% +HKR, Ndi\Params\NetworkAddress, optional, 0, "0" +HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% +HKR, Ndi\Params\MaxSpeed, type, 0, "int" +HKR, Ndi\Params\MaxSpeed, default, 0, "100" +HKR, Ndi\Params\MaxSpeed, min, 0, "0" +HKR, Ndi\Params\MaxSpeed, max, 0, "2000" +HKR, Ndi\Params\MaxSpeed, step, 0, "1" +HKR, Ndi\Params\MaxSpeed, Base, 0, "10" +HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% +HKR, Ndi\Params\KeepLink, type, 0, "enum" +HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% +HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% +HKR, Ndi\Params\KeepLink, default, 0, "0" + + +[Neo.Service] +DisplayName = %Neo.Service.DispName% +Description = %Neo.Service.Desc% +ServiceType = 1 +StartType = 3 +ErrorControl = 1 +ServiceBinary = %12%\Neo_VPN.sys +LoadOrderGroup = NDIS + +[Neo.Reg] +HKR, Ndi, Service, 0, Neo.Service.Name +HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" +HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" + +[Neo.EventLog] +HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN.sys" +HKR, , TypesSupported, 0x00010001, 7 + +[Strings] +CompanyName = "SoftEther Corporation" +DiskDescription = "VPN Client Device Driver Install Disk" +Neo.Service.Name = "Neo_VPN" +Neo.Service.DispName = "VPN Client Device Driver - VPN" +Neo.Service.Desc = "VPN Client Adapter - VPN" +NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN" +Neo.EventLog.Name = "Neo" +NetworkAddress = "MAC Address" +DefaultAddress = "000001000001" +MaxSpeed = "Indicate Speed (Mbps)" +KeepLink = "Keep Link" +On = "On" +Off = "Off" + + +; Auto Generated 20180205_163610.737 + diff --git a/src/bin/hamcore/DriverPackages/Neo6_Win8/x64/Neo6_x64_VPN10.inf b/src/bin/hamcore/DriverPackages/Neo6_Win8/x64/Neo6_x64_VPN10.inf index b74bde6c..83eb478c 100644 --- a/src/bin/hamcore/DriverPackages/Neo6_Win8/x64/Neo6_x64_VPN10.inf +++ b/src/bin/hamcore/DriverPackages/Neo6_Win8/x64/Neo6_x64_VPN10.inf @@ -1,114 +1,114 @@ -; VPN Client Device Driver for Windows 2000 and Greater -; -; Copyright (c) SoftEther Corporation. All Rights Reserved. -; http://www.softether.co.jp/ -; -; BUILD 9658 - -[Version] -Signature = "$Windows NT$" -Class = Net -ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} -Provider = %CompanyName% -DriverVer = 02/04/2018, 4.25.0.9658 -CatalogFile.NT = inf_VPN10.cat - -[Manufacturer] -%CompanyName% = SoftEther, NTamd64 - -[SourceDisksNames] -1=%DiskDescription%, "", , - -[SourceDisksFiles] -Neo_VPN10.sys = 1 - -[DestinationDirs] -DefaultDestDir = 12 -Neo.CopyFiles.Sys = 12 - -[Neo.CopyFiles.Sys] -Neo_VPN10.sys, , , 2 - -[SoftEther.NTamd64] -%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN10 - -[NeoAdapter.Install] -Characteristics = 0x1 -AddReg = Neo.Reg, NeoAdapter.Ndi -CopyFiles = Neo.CopyFiles.Sys -*IfType = 53 -*MediaType = 0 -*PhysicalMediaType = 0 - -[NeoAdapter.Install.Services] -AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% - -[NeoAdapter.Ndi] -HKR, , NetworkAddress, 0, %DefaultAddress% -HKR, Ndi, DeviceID, , "NeoAdapter_VPN10" -HKR, , DevLoader, , ndis -HKR, , DeviceVxDs, , Neo_VPN10.sys -HKR, NDIS, LogDriverName, , "Neo_VPN10" -HKR, NDIS, MajorNdisVersion, 1, 5 -HKR, NDIS, MinorNdisVersion, 1, 0 -HKR, Ndi\Interfaces, DefUpper, , "ndis5" -HKR, Ndi\Interfaces, UpperRange, , "ndis5" -HKR, Ndi\Interfaces, LowerRange, , "ethernet" -HKR, Ndi\Interfaces, DefLower, , "ethernet" -HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" -HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% -HKR, Ndi\Params\NetworkAddress, type, 0, "edit" -HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" -HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" -HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% -HKR, Ndi\Params\NetworkAddress, optional, 0, "0" -HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% -HKR, Ndi\Params\MaxSpeed, type, 0, "int" -HKR, Ndi\Params\MaxSpeed, default, 0, "100" -HKR, Ndi\Params\MaxSpeed, min, 0, "0" -HKR, Ndi\Params\MaxSpeed, max, 0, "2000" -HKR, Ndi\Params\MaxSpeed, step, 0, "1" -HKR, Ndi\Params\MaxSpeed, Base, 0, "10" -HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% -HKR, Ndi\Params\KeepLink, type, 0, "enum" -HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% -HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% -HKR, Ndi\Params\KeepLink, default, 0, "0" - - -[Neo.Service] -DisplayName = %Neo.Service.DispName% -Description = %Neo.Service.Desc% -ServiceType = 1 -StartType = 3 -ErrorControl = 1 -ServiceBinary = %12%\Neo_VPN10.sys -LoadOrderGroup = NDIS - -[Neo.Reg] -HKR, Ndi, Service, 0, Neo.Service.Name -HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" -HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" - -[Neo.EventLog] -HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN10.sys" -HKR, , TypesSupported, 0x00010001, 7 - -[Strings] -CompanyName = "SoftEther Corporation" -DiskDescription = "VPN Client Device Driver Install Disk" -Neo.Service.Name = "Neo_VPN10" -Neo.Service.DispName = "VPN Client Device Driver - VPN10" -Neo.Service.Desc = "VPN Client Adapter - VPN10" -NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN10" -Neo.EventLog.Name = "Neo" -NetworkAddress = "MAC Address" -DefaultAddress = "000001000001" -MaxSpeed = "Indicate Speed (Mbps)" -KeepLink = "Keep Link" -On = "On" -Off = "Off" - - -; Auto Generated 20180205_163610.743 - +; VPN Client Device Driver for Windows 2000 and Greater +; +; Copyright (c) SoftEther Corporation. All Rights Reserved. +; http://www.softether.co.jp/ +; +; BUILD 9658 + +[Version] +Signature = "$Windows NT$" +Class = Net +ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} +Provider = %CompanyName% +DriverVer = 02/04/2018, 4.25.0.9658 +CatalogFile.NT = inf_VPN10.cat + +[Manufacturer] +%CompanyName% = SoftEther, NTamd64 + +[SourceDisksNames] +1=%DiskDescription%, "", , + +[SourceDisksFiles] +Neo_VPN10.sys = 1 + +[DestinationDirs] +DefaultDestDir = 12 +Neo.CopyFiles.Sys = 12 + +[Neo.CopyFiles.Sys] +Neo_VPN10.sys, , , 2 + +[SoftEther.NTamd64] +%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN10 + +[NeoAdapter.Install] +Characteristics = 0x1 +AddReg = Neo.Reg, NeoAdapter.Ndi +CopyFiles = Neo.CopyFiles.Sys +*IfType = 53 +*MediaType = 0 +*PhysicalMediaType = 0 + +[NeoAdapter.Install.Services] +AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% + +[NeoAdapter.Ndi] +HKR, , NetworkAddress, 0, %DefaultAddress% +HKR, Ndi, DeviceID, , "NeoAdapter_VPN10" +HKR, , DevLoader, , ndis +HKR, , DeviceVxDs, , Neo_VPN10.sys +HKR, NDIS, LogDriverName, , "Neo_VPN10" +HKR, NDIS, MajorNdisVersion, 1, 5 +HKR, NDIS, MinorNdisVersion, 1, 0 +HKR, Ndi\Interfaces, DefUpper, , "ndis5" +HKR, Ndi\Interfaces, UpperRange, , "ndis5" +HKR, Ndi\Interfaces, LowerRange, , "ethernet" +HKR, Ndi\Interfaces, DefLower, , "ethernet" +HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" +HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% +HKR, Ndi\Params\NetworkAddress, type, 0, "edit" +HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" +HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" +HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% +HKR, Ndi\Params\NetworkAddress, optional, 0, "0" +HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% +HKR, Ndi\Params\MaxSpeed, type, 0, "int" +HKR, Ndi\Params\MaxSpeed, default, 0, "100" +HKR, Ndi\Params\MaxSpeed, min, 0, "0" +HKR, Ndi\Params\MaxSpeed, max, 0, "2000" +HKR, Ndi\Params\MaxSpeed, step, 0, "1" +HKR, Ndi\Params\MaxSpeed, Base, 0, "10" +HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% +HKR, Ndi\Params\KeepLink, type, 0, "enum" +HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% +HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% +HKR, Ndi\Params\KeepLink, default, 0, "0" + + +[Neo.Service] +DisplayName = %Neo.Service.DispName% +Description = %Neo.Service.Desc% +ServiceType = 1 +StartType = 3 +ErrorControl = 1 +ServiceBinary = %12%\Neo_VPN10.sys +LoadOrderGroup = NDIS + +[Neo.Reg] +HKR, Ndi, Service, 0, Neo.Service.Name +HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" +HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" + +[Neo.EventLog] +HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN10.sys" +HKR, , TypesSupported, 0x00010001, 7 + +[Strings] +CompanyName = "SoftEther Corporation" +DiskDescription = "VPN Client Device Driver Install Disk" +Neo.Service.Name = "Neo_VPN10" +Neo.Service.DispName = "VPN Client Device Driver - VPN10" +Neo.Service.Desc = "VPN Client Adapter - VPN10" +NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN10" +Neo.EventLog.Name = "Neo" +NetworkAddress = "MAC Address" +DefaultAddress = "000001000001" +MaxSpeed = "Indicate Speed (Mbps)" +KeepLink = "Keep Link" +On = "On" +Off = "Off" + + +; Auto Generated 20180205_163610.743 + diff --git a/src/bin/hamcore/DriverPackages/Neo6_Win8/x64/Neo6_x64_VPN100.inf b/src/bin/hamcore/DriverPackages/Neo6_Win8/x64/Neo6_x64_VPN100.inf index c1d4bcf6..ad477e3e 100644 --- a/src/bin/hamcore/DriverPackages/Neo6_Win8/x64/Neo6_x64_VPN100.inf +++ b/src/bin/hamcore/DriverPackages/Neo6_Win8/x64/Neo6_x64_VPN100.inf @@ -1,114 +1,114 @@ -; VPN Client Device Driver for Windows 2000 and Greater -; -; Copyright (c) SoftEther Corporation. All Rights Reserved. -; http://www.softether.co.jp/ -; -; BUILD 9658 - -[Version] -Signature = "$Windows NT$" -Class = Net -ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} -Provider = %CompanyName% -DriverVer = 02/04/2018, 4.25.0.9658 -CatalogFile.NT = inf_VPN100.cat - -[Manufacturer] -%CompanyName% = SoftEther, NTamd64 - -[SourceDisksNames] -1=%DiskDescription%, "", , - -[SourceDisksFiles] -Neo_VPN100.sys = 1 - -[DestinationDirs] -DefaultDestDir = 12 -Neo.CopyFiles.Sys = 12 - -[Neo.CopyFiles.Sys] -Neo_VPN100.sys, , , 2 - -[SoftEther.NTamd64] -%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN100 - -[NeoAdapter.Install] -Characteristics = 0x1 -AddReg = Neo.Reg, NeoAdapter.Ndi -CopyFiles = Neo.CopyFiles.Sys -*IfType = 53 -*MediaType = 0 -*PhysicalMediaType = 0 - -[NeoAdapter.Install.Services] -AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% - -[NeoAdapter.Ndi] -HKR, , NetworkAddress, 0, %DefaultAddress% -HKR, Ndi, DeviceID, , "NeoAdapter_VPN100" -HKR, , DevLoader, , ndis -HKR, , DeviceVxDs, , Neo_VPN100.sys -HKR, NDIS, LogDriverName, , "Neo_VPN100" -HKR, NDIS, MajorNdisVersion, 1, 5 -HKR, NDIS, MinorNdisVersion, 1, 0 -HKR, Ndi\Interfaces, DefUpper, , "ndis5" -HKR, Ndi\Interfaces, UpperRange, , "ndis5" -HKR, Ndi\Interfaces, LowerRange, , "ethernet" -HKR, Ndi\Interfaces, DefLower, , "ethernet" -HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" -HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% -HKR, Ndi\Params\NetworkAddress, type, 0, "edit" -HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" -HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" -HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% -HKR, Ndi\Params\NetworkAddress, optional, 0, "0" -HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% -HKR, Ndi\Params\MaxSpeed, type, 0, "int" -HKR, Ndi\Params\MaxSpeed, default, 0, "100" -HKR, Ndi\Params\MaxSpeed, min, 0, "0" -HKR, Ndi\Params\MaxSpeed, max, 0, "2000" -HKR, Ndi\Params\MaxSpeed, step, 0, "1" -HKR, Ndi\Params\MaxSpeed, Base, 0, "10" -HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% -HKR, Ndi\Params\KeepLink, type, 0, "enum" -HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% -HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% -HKR, Ndi\Params\KeepLink, default, 0, "0" - - -[Neo.Service] -DisplayName = %Neo.Service.DispName% -Description = %Neo.Service.Desc% -ServiceType = 1 -StartType = 3 -ErrorControl = 1 -ServiceBinary = %12%\Neo_VPN100.sys -LoadOrderGroup = NDIS - -[Neo.Reg] -HKR, Ndi, Service, 0, Neo.Service.Name -HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" -HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" - -[Neo.EventLog] -HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN100.sys" -HKR, , TypesSupported, 0x00010001, 7 - -[Strings] -CompanyName = "SoftEther Corporation" -DiskDescription = "VPN Client Device Driver Install Disk" -Neo.Service.Name = "Neo_VPN100" -Neo.Service.DispName = "VPN Client Device Driver - VPN100" -Neo.Service.Desc = "VPN Client Adapter - VPN100" -NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN100" -Neo.EventLog.Name = "Neo" -NetworkAddress = "MAC Address" -DefaultAddress = "000001000001" -MaxSpeed = "Indicate Speed (Mbps)" -KeepLink = "Keep Link" -On = "On" -Off = "Off" - - -; Auto Generated 20180205_163610.799 - +; VPN Client Device Driver for Windows 2000 and Greater +; +; Copyright (c) SoftEther Corporation. All Rights Reserved. +; http://www.softether.co.jp/ +; +; BUILD 9658 + +[Version] +Signature = "$Windows NT$" +Class = Net +ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} +Provider = %CompanyName% +DriverVer = 02/04/2018, 4.25.0.9658 +CatalogFile.NT = inf_VPN100.cat + +[Manufacturer] +%CompanyName% = SoftEther, NTamd64 + +[SourceDisksNames] +1=%DiskDescription%, "", , + +[SourceDisksFiles] +Neo_VPN100.sys = 1 + +[DestinationDirs] +DefaultDestDir = 12 +Neo.CopyFiles.Sys = 12 + +[Neo.CopyFiles.Sys] +Neo_VPN100.sys, , , 2 + +[SoftEther.NTamd64] +%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN100 + +[NeoAdapter.Install] +Characteristics = 0x1 +AddReg = Neo.Reg, NeoAdapter.Ndi +CopyFiles = Neo.CopyFiles.Sys +*IfType = 53 +*MediaType = 0 +*PhysicalMediaType = 0 + +[NeoAdapter.Install.Services] +AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% + +[NeoAdapter.Ndi] +HKR, , NetworkAddress, 0, %DefaultAddress% +HKR, Ndi, DeviceID, , "NeoAdapter_VPN100" +HKR, , DevLoader, , ndis +HKR, , DeviceVxDs, , Neo_VPN100.sys +HKR, NDIS, LogDriverName, , "Neo_VPN100" +HKR, NDIS, MajorNdisVersion, 1, 5 +HKR, NDIS, MinorNdisVersion, 1, 0 +HKR, Ndi\Interfaces, DefUpper, , "ndis5" +HKR, Ndi\Interfaces, UpperRange, , "ndis5" +HKR, Ndi\Interfaces, LowerRange, , "ethernet" +HKR, Ndi\Interfaces, DefLower, , "ethernet" +HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" +HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% +HKR, Ndi\Params\NetworkAddress, type, 0, "edit" +HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" +HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" +HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% +HKR, Ndi\Params\NetworkAddress, optional, 0, "0" +HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% +HKR, Ndi\Params\MaxSpeed, type, 0, "int" +HKR, Ndi\Params\MaxSpeed, default, 0, "100" +HKR, Ndi\Params\MaxSpeed, min, 0, "0" +HKR, Ndi\Params\MaxSpeed, max, 0, "2000" +HKR, Ndi\Params\MaxSpeed, step, 0, "1" +HKR, Ndi\Params\MaxSpeed, Base, 0, "10" +HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% +HKR, Ndi\Params\KeepLink, type, 0, "enum" +HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% +HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% +HKR, Ndi\Params\KeepLink, default, 0, "0" + + +[Neo.Service] +DisplayName = %Neo.Service.DispName% +Description = %Neo.Service.Desc% +ServiceType = 1 +StartType = 3 +ErrorControl = 1 +ServiceBinary = %12%\Neo_VPN100.sys +LoadOrderGroup = NDIS + +[Neo.Reg] +HKR, Ndi, Service, 0, Neo.Service.Name +HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" +HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" + +[Neo.EventLog] +HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN100.sys" +HKR, , TypesSupported, 0x00010001, 7 + +[Strings] +CompanyName = "SoftEther Corporation" +DiskDescription = "VPN Client Device Driver Install Disk" +Neo.Service.Name = "Neo_VPN100" +Neo.Service.DispName = "VPN Client Device Driver - VPN100" +Neo.Service.Desc = "VPN Client Adapter - VPN100" +NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN100" +Neo.EventLog.Name = "Neo" +NetworkAddress = "MAC Address" +DefaultAddress = "000001000001" +MaxSpeed = "Indicate Speed (Mbps)" +KeepLink = "Keep Link" +On = "On" +Off = "Off" + + +; Auto Generated 20180205_163610.799 + diff --git a/src/bin/hamcore/DriverPackages/Neo6_Win8/x64/Neo6_x64_VPN101.inf b/src/bin/hamcore/DriverPackages/Neo6_Win8/x64/Neo6_x64_VPN101.inf index 5ef3a35e..7aac5657 100644 --- a/src/bin/hamcore/DriverPackages/Neo6_Win8/x64/Neo6_x64_VPN101.inf +++ b/src/bin/hamcore/DriverPackages/Neo6_Win8/x64/Neo6_x64_VPN101.inf @@ -1,114 +1,114 @@ -; VPN Client Device Driver for Windows 2000 and Greater -; -; Copyright (c) SoftEther Corporation. All Rights Reserved. -; http://www.softether.co.jp/ -; -; BUILD 9658 - -[Version] -Signature = "$Windows NT$" -Class = Net -ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} -Provider = %CompanyName% -DriverVer = 02/04/2018, 4.25.0.9658 -CatalogFile.NT = inf_VPN101.cat - -[Manufacturer] -%CompanyName% = SoftEther, NTamd64 - -[SourceDisksNames] -1=%DiskDescription%, "", , - -[SourceDisksFiles] -Neo_VPN101.sys = 1 - -[DestinationDirs] -DefaultDestDir = 12 -Neo.CopyFiles.Sys = 12 - -[Neo.CopyFiles.Sys] -Neo_VPN101.sys, , , 2 - -[SoftEther.NTamd64] -%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN101 - -[NeoAdapter.Install] -Characteristics = 0x1 -AddReg = Neo.Reg, NeoAdapter.Ndi -CopyFiles = Neo.CopyFiles.Sys -*IfType = 53 -*MediaType = 0 -*PhysicalMediaType = 0 - -[NeoAdapter.Install.Services] -AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% - -[NeoAdapter.Ndi] -HKR, , NetworkAddress, 0, %DefaultAddress% -HKR, Ndi, DeviceID, , "NeoAdapter_VPN101" -HKR, , DevLoader, , ndis -HKR, , DeviceVxDs, , Neo_VPN101.sys -HKR, NDIS, LogDriverName, , "Neo_VPN101" -HKR, NDIS, MajorNdisVersion, 1, 5 -HKR, NDIS, MinorNdisVersion, 1, 0 -HKR, Ndi\Interfaces, DefUpper, , "ndis5" -HKR, Ndi\Interfaces, UpperRange, , "ndis5" -HKR, Ndi\Interfaces, LowerRange, , "ethernet" -HKR, Ndi\Interfaces, DefLower, , "ethernet" -HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" -HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% -HKR, Ndi\Params\NetworkAddress, type, 0, "edit" -HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" -HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" -HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% -HKR, Ndi\Params\NetworkAddress, optional, 0, "0" -HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% -HKR, Ndi\Params\MaxSpeed, type, 0, "int" -HKR, Ndi\Params\MaxSpeed, default, 0, "100" -HKR, Ndi\Params\MaxSpeed, min, 0, "0" -HKR, Ndi\Params\MaxSpeed, max, 0, "2000" -HKR, Ndi\Params\MaxSpeed, step, 0, "1" -HKR, Ndi\Params\MaxSpeed, Base, 0, "10" -HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% -HKR, Ndi\Params\KeepLink, type, 0, "enum" -HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% -HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% -HKR, Ndi\Params\KeepLink, default, 0, "0" - - -[Neo.Service] -DisplayName = %Neo.Service.DispName% -Description = %Neo.Service.Desc% -ServiceType = 1 -StartType = 3 -ErrorControl = 1 -ServiceBinary = %12%\Neo_VPN101.sys -LoadOrderGroup = NDIS - -[Neo.Reg] -HKR, Ndi, Service, 0, Neo.Service.Name -HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" -HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" - -[Neo.EventLog] -HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN101.sys" -HKR, , TypesSupported, 0x00010001, 7 - -[Strings] -CompanyName = "SoftEther Corporation" -DiskDescription = "VPN Client Device Driver Install Disk" -Neo.Service.Name = "Neo_VPN101" -Neo.Service.DispName = "VPN Client Device Driver - VPN101" -Neo.Service.Desc = "VPN Client Adapter - VPN101" -NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN101" -Neo.EventLog.Name = "Neo" -NetworkAddress = "MAC Address" -DefaultAddress = "000001000001" -MaxSpeed = "Indicate Speed (Mbps)" -KeepLink = "Keep Link" -On = "On" -Off = "Off" - - -; Auto Generated 20180205_163610.800 - +; VPN Client Device Driver for Windows 2000 and Greater +; +; Copyright (c) SoftEther Corporation. All Rights Reserved. +; http://www.softether.co.jp/ +; +; BUILD 9658 + +[Version] +Signature = "$Windows NT$" +Class = Net +ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} +Provider = %CompanyName% +DriverVer = 02/04/2018, 4.25.0.9658 +CatalogFile.NT = inf_VPN101.cat + +[Manufacturer] +%CompanyName% = SoftEther, NTamd64 + +[SourceDisksNames] +1=%DiskDescription%, "", , + +[SourceDisksFiles] +Neo_VPN101.sys = 1 + +[DestinationDirs] +DefaultDestDir = 12 +Neo.CopyFiles.Sys = 12 + +[Neo.CopyFiles.Sys] +Neo_VPN101.sys, , , 2 + +[SoftEther.NTamd64] +%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN101 + +[NeoAdapter.Install] +Characteristics = 0x1 +AddReg = Neo.Reg, NeoAdapter.Ndi +CopyFiles = Neo.CopyFiles.Sys +*IfType = 53 +*MediaType = 0 +*PhysicalMediaType = 0 + +[NeoAdapter.Install.Services] +AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% + +[NeoAdapter.Ndi] +HKR, , NetworkAddress, 0, %DefaultAddress% +HKR, Ndi, DeviceID, , "NeoAdapter_VPN101" +HKR, , DevLoader, , ndis +HKR, , DeviceVxDs, , Neo_VPN101.sys +HKR, NDIS, LogDriverName, , "Neo_VPN101" +HKR, NDIS, MajorNdisVersion, 1, 5 +HKR, NDIS, MinorNdisVersion, 1, 0 +HKR, Ndi\Interfaces, DefUpper, , "ndis5" +HKR, Ndi\Interfaces, UpperRange, , "ndis5" +HKR, Ndi\Interfaces, LowerRange, , "ethernet" +HKR, Ndi\Interfaces, DefLower, , "ethernet" +HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" +HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% +HKR, Ndi\Params\NetworkAddress, type, 0, "edit" +HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" +HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" +HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% +HKR, Ndi\Params\NetworkAddress, optional, 0, "0" +HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% +HKR, Ndi\Params\MaxSpeed, type, 0, "int" +HKR, Ndi\Params\MaxSpeed, default, 0, "100" +HKR, Ndi\Params\MaxSpeed, min, 0, "0" +HKR, Ndi\Params\MaxSpeed, max, 0, "2000" +HKR, Ndi\Params\MaxSpeed, step, 0, "1" +HKR, Ndi\Params\MaxSpeed, Base, 0, "10" +HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% +HKR, Ndi\Params\KeepLink, type, 0, "enum" +HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% +HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% +HKR, Ndi\Params\KeepLink, default, 0, "0" + + +[Neo.Service] +DisplayName = %Neo.Service.DispName% +Description = %Neo.Service.Desc% +ServiceType = 1 +StartType = 3 +ErrorControl = 1 +ServiceBinary = %12%\Neo_VPN101.sys +LoadOrderGroup = NDIS + +[Neo.Reg] +HKR, Ndi, Service, 0, Neo.Service.Name +HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" +HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" + +[Neo.EventLog] +HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN101.sys" +HKR, , TypesSupported, 0x00010001, 7 + +[Strings] +CompanyName = "SoftEther Corporation" +DiskDescription = "VPN Client Device Driver Install Disk" +Neo.Service.Name = "Neo_VPN101" +Neo.Service.DispName = "VPN Client Device Driver - VPN101" +Neo.Service.Desc = "VPN Client Adapter - VPN101" +NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN101" +Neo.EventLog.Name = "Neo" +NetworkAddress = "MAC Address" +DefaultAddress = "000001000001" +MaxSpeed = "Indicate Speed (Mbps)" +KeepLink = "Keep Link" +On = "On" +Off = "Off" + + +; Auto Generated 20180205_163610.800 + diff --git a/src/bin/hamcore/DriverPackages/Neo6_Win8/x64/Neo6_x64_VPN102.inf b/src/bin/hamcore/DriverPackages/Neo6_Win8/x64/Neo6_x64_VPN102.inf index 3b4dbb84..7196a73e 100644 --- a/src/bin/hamcore/DriverPackages/Neo6_Win8/x64/Neo6_x64_VPN102.inf +++ b/src/bin/hamcore/DriverPackages/Neo6_Win8/x64/Neo6_x64_VPN102.inf @@ -1,114 +1,114 @@ -; VPN Client Device Driver for Windows 2000 and Greater -; -; Copyright (c) SoftEther Corporation. All Rights Reserved. -; http://www.softether.co.jp/ -; -; BUILD 9658 - -[Version] -Signature = "$Windows NT$" -Class = Net -ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} -Provider = %CompanyName% -DriverVer = 02/04/2018, 4.25.0.9658 -CatalogFile.NT = inf_VPN102.cat - -[Manufacturer] -%CompanyName% = SoftEther, NTamd64 - -[SourceDisksNames] -1=%DiskDescription%, "", , - -[SourceDisksFiles] -Neo_VPN102.sys = 1 - -[DestinationDirs] -DefaultDestDir = 12 -Neo.CopyFiles.Sys = 12 - -[Neo.CopyFiles.Sys] -Neo_VPN102.sys, , , 2 - -[SoftEther.NTamd64] -%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN102 - -[NeoAdapter.Install] -Characteristics = 0x1 -AddReg = Neo.Reg, NeoAdapter.Ndi -CopyFiles = Neo.CopyFiles.Sys -*IfType = 53 -*MediaType = 0 -*PhysicalMediaType = 0 - -[NeoAdapter.Install.Services] -AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% - -[NeoAdapter.Ndi] -HKR, , NetworkAddress, 0, %DefaultAddress% -HKR, Ndi, DeviceID, , "NeoAdapter_VPN102" -HKR, , DevLoader, , ndis -HKR, , DeviceVxDs, , Neo_VPN102.sys -HKR, NDIS, LogDriverName, , "Neo_VPN102" -HKR, NDIS, MajorNdisVersion, 1, 5 -HKR, NDIS, MinorNdisVersion, 1, 0 -HKR, Ndi\Interfaces, DefUpper, , "ndis5" -HKR, Ndi\Interfaces, UpperRange, , "ndis5" -HKR, Ndi\Interfaces, LowerRange, , "ethernet" -HKR, Ndi\Interfaces, DefLower, , "ethernet" -HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" -HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% -HKR, Ndi\Params\NetworkAddress, type, 0, "edit" -HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" -HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" -HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% -HKR, Ndi\Params\NetworkAddress, optional, 0, "0" -HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% -HKR, Ndi\Params\MaxSpeed, type, 0, "int" -HKR, Ndi\Params\MaxSpeed, default, 0, "100" -HKR, Ndi\Params\MaxSpeed, min, 0, "0" -HKR, Ndi\Params\MaxSpeed, max, 0, "2000" -HKR, Ndi\Params\MaxSpeed, step, 0, "1" -HKR, Ndi\Params\MaxSpeed, Base, 0, "10" -HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% -HKR, Ndi\Params\KeepLink, type, 0, "enum" -HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% -HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% -HKR, Ndi\Params\KeepLink, default, 0, "0" - - -[Neo.Service] -DisplayName = %Neo.Service.DispName% -Description = %Neo.Service.Desc% -ServiceType = 1 -StartType = 3 -ErrorControl = 1 -ServiceBinary = %12%\Neo_VPN102.sys -LoadOrderGroup = NDIS - -[Neo.Reg] -HKR, Ndi, Service, 0, Neo.Service.Name -HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" -HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" - -[Neo.EventLog] -HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN102.sys" -HKR, , TypesSupported, 0x00010001, 7 - -[Strings] -CompanyName = "SoftEther Corporation" -DiskDescription = "VPN Client Device Driver Install Disk" -Neo.Service.Name = "Neo_VPN102" -Neo.Service.DispName = "VPN Client Device Driver - VPN102" -Neo.Service.Desc = "VPN Client Adapter - VPN102" -NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN102" -Neo.EventLog.Name = "Neo" -NetworkAddress = "MAC Address" -DefaultAddress = "000001000001" -MaxSpeed = "Indicate Speed (Mbps)" -KeepLink = "Keep Link" -On = "On" -Off = "Off" - - -; Auto Generated 20180205_163610.801 - +; VPN Client Device Driver for Windows 2000 and Greater +; +; Copyright (c) SoftEther Corporation. All Rights Reserved. +; http://www.softether.co.jp/ +; +; BUILD 9658 + +[Version] +Signature = "$Windows NT$" +Class = Net +ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} +Provider = %CompanyName% +DriverVer = 02/04/2018, 4.25.0.9658 +CatalogFile.NT = inf_VPN102.cat + +[Manufacturer] +%CompanyName% = SoftEther, NTamd64 + +[SourceDisksNames] +1=%DiskDescription%, "", , + +[SourceDisksFiles] +Neo_VPN102.sys = 1 + +[DestinationDirs] +DefaultDestDir = 12 +Neo.CopyFiles.Sys = 12 + +[Neo.CopyFiles.Sys] +Neo_VPN102.sys, , , 2 + +[SoftEther.NTamd64] +%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN102 + +[NeoAdapter.Install] +Characteristics = 0x1 +AddReg = Neo.Reg, NeoAdapter.Ndi +CopyFiles = Neo.CopyFiles.Sys +*IfType = 53 +*MediaType = 0 +*PhysicalMediaType = 0 + +[NeoAdapter.Install.Services] +AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% + +[NeoAdapter.Ndi] +HKR, , NetworkAddress, 0, %DefaultAddress% +HKR, Ndi, DeviceID, , "NeoAdapter_VPN102" +HKR, , DevLoader, , ndis +HKR, , DeviceVxDs, , Neo_VPN102.sys +HKR, NDIS, LogDriverName, , "Neo_VPN102" +HKR, NDIS, MajorNdisVersion, 1, 5 +HKR, NDIS, MinorNdisVersion, 1, 0 +HKR, Ndi\Interfaces, DefUpper, , "ndis5" +HKR, Ndi\Interfaces, UpperRange, , "ndis5" +HKR, Ndi\Interfaces, LowerRange, , "ethernet" +HKR, Ndi\Interfaces, DefLower, , "ethernet" +HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" +HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% +HKR, Ndi\Params\NetworkAddress, type, 0, "edit" +HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" +HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" +HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% +HKR, Ndi\Params\NetworkAddress, optional, 0, "0" +HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% +HKR, Ndi\Params\MaxSpeed, type, 0, "int" +HKR, Ndi\Params\MaxSpeed, default, 0, "100" +HKR, Ndi\Params\MaxSpeed, min, 0, "0" +HKR, Ndi\Params\MaxSpeed, max, 0, "2000" +HKR, Ndi\Params\MaxSpeed, step, 0, "1" +HKR, Ndi\Params\MaxSpeed, Base, 0, "10" +HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% +HKR, Ndi\Params\KeepLink, type, 0, "enum" +HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% +HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% +HKR, Ndi\Params\KeepLink, default, 0, "0" + + +[Neo.Service] +DisplayName = %Neo.Service.DispName% +Description = %Neo.Service.Desc% +ServiceType = 1 +StartType = 3 +ErrorControl = 1 +ServiceBinary = %12%\Neo_VPN102.sys +LoadOrderGroup = NDIS + +[Neo.Reg] +HKR, Ndi, Service, 0, Neo.Service.Name +HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" +HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" + +[Neo.EventLog] +HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN102.sys" +HKR, , TypesSupported, 0x00010001, 7 + +[Strings] +CompanyName = "SoftEther Corporation" +DiskDescription = "VPN Client Device Driver Install Disk" +Neo.Service.Name = "Neo_VPN102" +Neo.Service.DispName = "VPN Client Device Driver - VPN102" +Neo.Service.Desc = "VPN Client Adapter - VPN102" +NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN102" +Neo.EventLog.Name = "Neo" +NetworkAddress = "MAC Address" +DefaultAddress = "000001000001" +MaxSpeed = "Indicate Speed (Mbps)" +KeepLink = "Keep Link" +On = "On" +Off = "Off" + + +; Auto Generated 20180205_163610.801 + diff --git a/src/bin/hamcore/DriverPackages/Neo6_Win8/x64/Neo6_x64_VPN103.inf b/src/bin/hamcore/DriverPackages/Neo6_Win8/x64/Neo6_x64_VPN103.inf index d967abb5..5fe554a5 100644 --- a/src/bin/hamcore/DriverPackages/Neo6_Win8/x64/Neo6_x64_VPN103.inf +++ b/src/bin/hamcore/DriverPackages/Neo6_Win8/x64/Neo6_x64_VPN103.inf @@ -1,114 +1,114 @@ -; VPN Client Device Driver for Windows 2000 and Greater -; -; Copyright (c) SoftEther Corporation. All Rights Reserved. -; http://www.softether.co.jp/ -; -; BUILD 9658 - -[Version] -Signature = "$Windows NT$" -Class = Net -ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} -Provider = %CompanyName% -DriverVer = 02/04/2018, 4.25.0.9658 -CatalogFile.NT = inf_VPN103.cat - -[Manufacturer] -%CompanyName% = SoftEther, NTamd64 - -[SourceDisksNames] -1=%DiskDescription%, "", , - -[SourceDisksFiles] -Neo_VPN103.sys = 1 - -[DestinationDirs] -DefaultDestDir = 12 -Neo.CopyFiles.Sys = 12 - -[Neo.CopyFiles.Sys] -Neo_VPN103.sys, , , 2 - -[SoftEther.NTamd64] -%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN103 - -[NeoAdapter.Install] -Characteristics = 0x1 -AddReg = Neo.Reg, NeoAdapter.Ndi -CopyFiles = Neo.CopyFiles.Sys -*IfType = 53 -*MediaType = 0 -*PhysicalMediaType = 0 - -[NeoAdapter.Install.Services] -AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% - -[NeoAdapter.Ndi] -HKR, , NetworkAddress, 0, %DefaultAddress% -HKR, Ndi, DeviceID, , "NeoAdapter_VPN103" -HKR, , DevLoader, , ndis -HKR, , DeviceVxDs, , Neo_VPN103.sys -HKR, NDIS, LogDriverName, , "Neo_VPN103" -HKR, NDIS, MajorNdisVersion, 1, 5 -HKR, NDIS, MinorNdisVersion, 1, 0 -HKR, Ndi\Interfaces, DefUpper, , "ndis5" -HKR, Ndi\Interfaces, UpperRange, , "ndis5" -HKR, Ndi\Interfaces, LowerRange, , "ethernet" -HKR, Ndi\Interfaces, DefLower, , "ethernet" -HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" -HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% -HKR, Ndi\Params\NetworkAddress, type, 0, "edit" -HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" -HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" -HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% -HKR, Ndi\Params\NetworkAddress, optional, 0, "0" -HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% -HKR, Ndi\Params\MaxSpeed, type, 0, "int" -HKR, Ndi\Params\MaxSpeed, default, 0, "100" -HKR, Ndi\Params\MaxSpeed, min, 0, "0" -HKR, Ndi\Params\MaxSpeed, max, 0, "2000" -HKR, Ndi\Params\MaxSpeed, step, 0, "1" -HKR, Ndi\Params\MaxSpeed, Base, 0, "10" -HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% -HKR, Ndi\Params\KeepLink, type, 0, "enum" -HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% -HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% -HKR, Ndi\Params\KeepLink, default, 0, "0" - - -[Neo.Service] -DisplayName = %Neo.Service.DispName% -Description = %Neo.Service.Desc% -ServiceType = 1 -StartType = 3 -ErrorControl = 1 -ServiceBinary = %12%\Neo_VPN103.sys -LoadOrderGroup = NDIS - -[Neo.Reg] -HKR, Ndi, Service, 0, Neo.Service.Name -HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" -HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" - -[Neo.EventLog] -HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN103.sys" -HKR, , TypesSupported, 0x00010001, 7 - -[Strings] -CompanyName = "SoftEther Corporation" -DiskDescription = "VPN Client Device Driver Install Disk" -Neo.Service.Name = "Neo_VPN103" -Neo.Service.DispName = "VPN Client Device Driver - VPN103" -Neo.Service.Desc = "VPN Client Adapter - VPN103" -NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN103" -Neo.EventLog.Name = "Neo" -NetworkAddress = "MAC Address" -DefaultAddress = "000001000001" -MaxSpeed = "Indicate Speed (Mbps)" -KeepLink = "Keep Link" -On = "On" -Off = "Off" - - -; Auto Generated 20180205_163610.801 - +; VPN Client Device Driver for Windows 2000 and Greater +; +; Copyright (c) SoftEther Corporation. All Rights Reserved. +; http://www.softether.co.jp/ +; +; BUILD 9658 + +[Version] +Signature = "$Windows NT$" +Class = Net +ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} +Provider = %CompanyName% +DriverVer = 02/04/2018, 4.25.0.9658 +CatalogFile.NT = inf_VPN103.cat + +[Manufacturer] +%CompanyName% = SoftEther, NTamd64 + +[SourceDisksNames] +1=%DiskDescription%, "", , + +[SourceDisksFiles] +Neo_VPN103.sys = 1 + +[DestinationDirs] +DefaultDestDir = 12 +Neo.CopyFiles.Sys = 12 + +[Neo.CopyFiles.Sys] +Neo_VPN103.sys, , , 2 + +[SoftEther.NTamd64] +%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN103 + +[NeoAdapter.Install] +Characteristics = 0x1 +AddReg = Neo.Reg, NeoAdapter.Ndi +CopyFiles = Neo.CopyFiles.Sys +*IfType = 53 +*MediaType = 0 +*PhysicalMediaType = 0 + +[NeoAdapter.Install.Services] +AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% + +[NeoAdapter.Ndi] +HKR, , NetworkAddress, 0, %DefaultAddress% +HKR, Ndi, DeviceID, , "NeoAdapter_VPN103" +HKR, , DevLoader, , ndis +HKR, , DeviceVxDs, , Neo_VPN103.sys +HKR, NDIS, LogDriverName, , "Neo_VPN103" +HKR, NDIS, MajorNdisVersion, 1, 5 +HKR, NDIS, MinorNdisVersion, 1, 0 +HKR, Ndi\Interfaces, DefUpper, , "ndis5" +HKR, Ndi\Interfaces, UpperRange, , "ndis5" +HKR, Ndi\Interfaces, LowerRange, , "ethernet" +HKR, Ndi\Interfaces, DefLower, , "ethernet" +HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" +HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% +HKR, Ndi\Params\NetworkAddress, type, 0, "edit" +HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" +HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" +HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% +HKR, Ndi\Params\NetworkAddress, optional, 0, "0" +HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% +HKR, Ndi\Params\MaxSpeed, type, 0, "int" +HKR, Ndi\Params\MaxSpeed, default, 0, "100" +HKR, Ndi\Params\MaxSpeed, min, 0, "0" +HKR, Ndi\Params\MaxSpeed, max, 0, "2000" +HKR, Ndi\Params\MaxSpeed, step, 0, "1" +HKR, Ndi\Params\MaxSpeed, Base, 0, "10" +HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% +HKR, Ndi\Params\KeepLink, type, 0, "enum" +HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% +HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% +HKR, Ndi\Params\KeepLink, default, 0, "0" + + +[Neo.Service] +DisplayName = %Neo.Service.DispName% +Description = %Neo.Service.Desc% +ServiceType = 1 +StartType = 3 +ErrorControl = 1 +ServiceBinary = %12%\Neo_VPN103.sys +LoadOrderGroup = NDIS + +[Neo.Reg] +HKR, Ndi, Service, 0, Neo.Service.Name +HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" +HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" + +[Neo.EventLog] +HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN103.sys" +HKR, , TypesSupported, 0x00010001, 7 + +[Strings] +CompanyName = "SoftEther Corporation" +DiskDescription = "VPN Client Device Driver Install Disk" +Neo.Service.Name = "Neo_VPN103" +Neo.Service.DispName = "VPN Client Device Driver - VPN103" +Neo.Service.Desc = "VPN Client Adapter - VPN103" +NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN103" +Neo.EventLog.Name = "Neo" +NetworkAddress = "MAC Address" +DefaultAddress = "000001000001" +MaxSpeed = "Indicate Speed (Mbps)" +KeepLink = "Keep Link" +On = "On" +Off = "Off" + + +; Auto Generated 20180205_163610.801 + diff --git a/src/bin/hamcore/DriverPackages/Neo6_Win8/x64/Neo6_x64_VPN104.inf b/src/bin/hamcore/DriverPackages/Neo6_Win8/x64/Neo6_x64_VPN104.inf index d26180e3..9b86b1cf 100644 --- a/src/bin/hamcore/DriverPackages/Neo6_Win8/x64/Neo6_x64_VPN104.inf +++ b/src/bin/hamcore/DriverPackages/Neo6_Win8/x64/Neo6_x64_VPN104.inf @@ -1,114 +1,114 @@ -; VPN Client Device Driver for Windows 2000 and Greater -; -; Copyright (c) SoftEther Corporation. All Rights Reserved. -; http://www.softether.co.jp/ -; -; BUILD 9658 - -[Version] -Signature = "$Windows NT$" -Class = Net -ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} -Provider = %CompanyName% -DriverVer = 02/04/2018, 4.25.0.9658 -CatalogFile.NT = inf_VPN104.cat - -[Manufacturer] -%CompanyName% = SoftEther, NTamd64 - -[SourceDisksNames] -1=%DiskDescription%, "", , - -[SourceDisksFiles] -Neo_VPN104.sys = 1 - -[DestinationDirs] -DefaultDestDir = 12 -Neo.CopyFiles.Sys = 12 - -[Neo.CopyFiles.Sys] -Neo_VPN104.sys, , , 2 - -[SoftEther.NTamd64] -%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN104 - -[NeoAdapter.Install] -Characteristics = 0x1 -AddReg = Neo.Reg, NeoAdapter.Ndi -CopyFiles = Neo.CopyFiles.Sys -*IfType = 53 -*MediaType = 0 -*PhysicalMediaType = 0 - -[NeoAdapter.Install.Services] -AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% - -[NeoAdapter.Ndi] -HKR, , NetworkAddress, 0, %DefaultAddress% -HKR, Ndi, DeviceID, , "NeoAdapter_VPN104" -HKR, , DevLoader, , ndis -HKR, , DeviceVxDs, , Neo_VPN104.sys -HKR, NDIS, LogDriverName, , "Neo_VPN104" -HKR, NDIS, MajorNdisVersion, 1, 5 -HKR, NDIS, MinorNdisVersion, 1, 0 -HKR, Ndi\Interfaces, DefUpper, , "ndis5" -HKR, Ndi\Interfaces, UpperRange, , "ndis5" -HKR, Ndi\Interfaces, LowerRange, , "ethernet" -HKR, Ndi\Interfaces, DefLower, , "ethernet" -HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" -HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% -HKR, Ndi\Params\NetworkAddress, type, 0, "edit" -HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" -HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" -HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% -HKR, Ndi\Params\NetworkAddress, optional, 0, "0" -HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% -HKR, Ndi\Params\MaxSpeed, type, 0, "int" -HKR, Ndi\Params\MaxSpeed, default, 0, "100" -HKR, Ndi\Params\MaxSpeed, min, 0, "0" -HKR, Ndi\Params\MaxSpeed, max, 0, "2000" -HKR, Ndi\Params\MaxSpeed, step, 0, "1" -HKR, Ndi\Params\MaxSpeed, Base, 0, "10" -HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% -HKR, Ndi\Params\KeepLink, type, 0, "enum" -HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% -HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% -HKR, Ndi\Params\KeepLink, default, 0, "0" - - -[Neo.Service] -DisplayName = %Neo.Service.DispName% -Description = %Neo.Service.Desc% -ServiceType = 1 -StartType = 3 -ErrorControl = 1 -ServiceBinary = %12%\Neo_VPN104.sys -LoadOrderGroup = NDIS - -[Neo.Reg] -HKR, Ndi, Service, 0, Neo.Service.Name -HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" -HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" - -[Neo.EventLog] -HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN104.sys" -HKR, , TypesSupported, 0x00010001, 7 - -[Strings] -CompanyName = "SoftEther Corporation" -DiskDescription = "VPN Client Device Driver Install Disk" -Neo.Service.Name = "Neo_VPN104" -Neo.Service.DispName = "VPN Client Device Driver - VPN104" -Neo.Service.Desc = "VPN Client Adapter - VPN104" -NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN104" -Neo.EventLog.Name = "Neo" -NetworkAddress = "MAC Address" -DefaultAddress = "000001000001" -MaxSpeed = "Indicate Speed (Mbps)" -KeepLink = "Keep Link" -On = "On" -Off = "Off" - - -; Auto Generated 20180205_163610.802 - +; VPN Client Device Driver for Windows 2000 and Greater +; +; Copyright (c) SoftEther Corporation. All Rights Reserved. +; http://www.softether.co.jp/ +; +; BUILD 9658 + +[Version] +Signature = "$Windows NT$" +Class = Net +ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} +Provider = %CompanyName% +DriverVer = 02/04/2018, 4.25.0.9658 +CatalogFile.NT = inf_VPN104.cat + +[Manufacturer] +%CompanyName% = SoftEther, NTamd64 + +[SourceDisksNames] +1=%DiskDescription%, "", , + +[SourceDisksFiles] +Neo_VPN104.sys = 1 + +[DestinationDirs] +DefaultDestDir = 12 +Neo.CopyFiles.Sys = 12 + +[Neo.CopyFiles.Sys] +Neo_VPN104.sys, , , 2 + +[SoftEther.NTamd64] +%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN104 + +[NeoAdapter.Install] +Characteristics = 0x1 +AddReg = Neo.Reg, NeoAdapter.Ndi +CopyFiles = Neo.CopyFiles.Sys +*IfType = 53 +*MediaType = 0 +*PhysicalMediaType = 0 + +[NeoAdapter.Install.Services] +AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% + +[NeoAdapter.Ndi] +HKR, , NetworkAddress, 0, %DefaultAddress% +HKR, Ndi, DeviceID, , "NeoAdapter_VPN104" +HKR, , DevLoader, , ndis +HKR, , DeviceVxDs, , Neo_VPN104.sys +HKR, NDIS, LogDriverName, , "Neo_VPN104" +HKR, NDIS, MajorNdisVersion, 1, 5 +HKR, NDIS, MinorNdisVersion, 1, 0 +HKR, Ndi\Interfaces, DefUpper, , "ndis5" +HKR, Ndi\Interfaces, UpperRange, , "ndis5" +HKR, Ndi\Interfaces, LowerRange, , "ethernet" +HKR, Ndi\Interfaces, DefLower, , "ethernet" +HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" +HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% +HKR, Ndi\Params\NetworkAddress, type, 0, "edit" +HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" +HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" +HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% +HKR, Ndi\Params\NetworkAddress, optional, 0, "0" +HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% +HKR, Ndi\Params\MaxSpeed, type, 0, "int" +HKR, Ndi\Params\MaxSpeed, default, 0, "100" +HKR, Ndi\Params\MaxSpeed, min, 0, "0" +HKR, Ndi\Params\MaxSpeed, max, 0, "2000" +HKR, Ndi\Params\MaxSpeed, step, 0, "1" +HKR, Ndi\Params\MaxSpeed, Base, 0, "10" +HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% +HKR, Ndi\Params\KeepLink, type, 0, "enum" +HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% +HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% +HKR, Ndi\Params\KeepLink, default, 0, "0" + + +[Neo.Service] +DisplayName = %Neo.Service.DispName% +Description = %Neo.Service.Desc% +ServiceType = 1 +StartType = 3 +ErrorControl = 1 +ServiceBinary = %12%\Neo_VPN104.sys +LoadOrderGroup = NDIS + +[Neo.Reg] +HKR, Ndi, Service, 0, Neo.Service.Name +HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" +HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" + +[Neo.EventLog] +HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN104.sys" +HKR, , TypesSupported, 0x00010001, 7 + +[Strings] +CompanyName = "SoftEther Corporation" +DiskDescription = "VPN Client Device Driver Install Disk" +Neo.Service.Name = "Neo_VPN104" +Neo.Service.DispName = "VPN Client Device Driver - VPN104" +Neo.Service.Desc = "VPN Client Adapter - VPN104" +NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN104" +Neo.EventLog.Name = "Neo" +NetworkAddress = "MAC Address" +DefaultAddress = "000001000001" +MaxSpeed = "Indicate Speed (Mbps)" +KeepLink = "Keep Link" +On = "On" +Off = "Off" + + +; Auto Generated 20180205_163610.802 + diff --git a/src/bin/hamcore/DriverPackages/Neo6_Win8/x64/Neo6_x64_VPN105.inf b/src/bin/hamcore/DriverPackages/Neo6_Win8/x64/Neo6_x64_VPN105.inf index 048bed9c..12bcf0bc 100644 --- a/src/bin/hamcore/DriverPackages/Neo6_Win8/x64/Neo6_x64_VPN105.inf +++ b/src/bin/hamcore/DriverPackages/Neo6_Win8/x64/Neo6_x64_VPN105.inf @@ -1,114 +1,114 @@ -; VPN Client Device Driver for Windows 2000 and Greater -; -; Copyright (c) SoftEther Corporation. All Rights Reserved. -; http://www.softether.co.jp/ -; -; BUILD 9658 - -[Version] -Signature = "$Windows NT$" -Class = Net -ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} -Provider = %CompanyName% -DriverVer = 02/04/2018, 4.25.0.9658 -CatalogFile.NT = inf_VPN105.cat - -[Manufacturer] -%CompanyName% = SoftEther, NTamd64 - -[SourceDisksNames] -1=%DiskDescription%, "", , - -[SourceDisksFiles] -Neo_VPN105.sys = 1 - -[DestinationDirs] -DefaultDestDir = 12 -Neo.CopyFiles.Sys = 12 - -[Neo.CopyFiles.Sys] -Neo_VPN105.sys, , , 2 - -[SoftEther.NTamd64] -%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN105 - -[NeoAdapter.Install] -Characteristics = 0x1 -AddReg = Neo.Reg, NeoAdapter.Ndi -CopyFiles = Neo.CopyFiles.Sys -*IfType = 53 -*MediaType = 0 -*PhysicalMediaType = 0 - -[NeoAdapter.Install.Services] -AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% - -[NeoAdapter.Ndi] -HKR, , NetworkAddress, 0, %DefaultAddress% -HKR, Ndi, DeviceID, , "NeoAdapter_VPN105" -HKR, , DevLoader, , ndis -HKR, , DeviceVxDs, , Neo_VPN105.sys -HKR, NDIS, LogDriverName, , "Neo_VPN105" -HKR, NDIS, MajorNdisVersion, 1, 5 -HKR, NDIS, MinorNdisVersion, 1, 0 -HKR, Ndi\Interfaces, DefUpper, , "ndis5" -HKR, Ndi\Interfaces, UpperRange, , "ndis5" -HKR, Ndi\Interfaces, LowerRange, , "ethernet" -HKR, Ndi\Interfaces, DefLower, , "ethernet" -HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" -HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% -HKR, Ndi\Params\NetworkAddress, type, 0, "edit" -HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" -HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" -HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% -HKR, Ndi\Params\NetworkAddress, optional, 0, "0" -HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% -HKR, Ndi\Params\MaxSpeed, type, 0, "int" -HKR, Ndi\Params\MaxSpeed, default, 0, "100" -HKR, Ndi\Params\MaxSpeed, min, 0, "0" -HKR, Ndi\Params\MaxSpeed, max, 0, "2000" -HKR, Ndi\Params\MaxSpeed, step, 0, "1" -HKR, Ndi\Params\MaxSpeed, Base, 0, "10" -HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% -HKR, Ndi\Params\KeepLink, type, 0, "enum" -HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% -HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% -HKR, Ndi\Params\KeepLink, default, 0, "0" - - -[Neo.Service] -DisplayName = %Neo.Service.DispName% -Description = %Neo.Service.Desc% -ServiceType = 1 -StartType = 3 -ErrorControl = 1 -ServiceBinary = %12%\Neo_VPN105.sys -LoadOrderGroup = NDIS - -[Neo.Reg] -HKR, Ndi, Service, 0, Neo.Service.Name -HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" -HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" - -[Neo.EventLog] -HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN105.sys" -HKR, , TypesSupported, 0x00010001, 7 - -[Strings] -CompanyName = "SoftEther Corporation" -DiskDescription = "VPN Client Device Driver Install Disk" -Neo.Service.Name = "Neo_VPN105" -Neo.Service.DispName = "VPN Client Device Driver - VPN105" -Neo.Service.Desc = "VPN Client Adapter - VPN105" -NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN105" -Neo.EventLog.Name = "Neo" -NetworkAddress = "MAC Address" -DefaultAddress = "000001000001" -MaxSpeed = "Indicate Speed (Mbps)" -KeepLink = "Keep Link" -On = "On" -Off = "Off" - - -; Auto Generated 20180205_163610.803 - +; VPN Client Device Driver for Windows 2000 and Greater +; +; Copyright (c) SoftEther Corporation. All Rights Reserved. +; http://www.softether.co.jp/ +; +; BUILD 9658 + +[Version] +Signature = "$Windows NT$" +Class = Net +ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} +Provider = %CompanyName% +DriverVer = 02/04/2018, 4.25.0.9658 +CatalogFile.NT = inf_VPN105.cat + +[Manufacturer] +%CompanyName% = SoftEther, NTamd64 + +[SourceDisksNames] +1=%DiskDescription%, "", , + +[SourceDisksFiles] +Neo_VPN105.sys = 1 + +[DestinationDirs] +DefaultDestDir = 12 +Neo.CopyFiles.Sys = 12 + +[Neo.CopyFiles.Sys] +Neo_VPN105.sys, , , 2 + +[SoftEther.NTamd64] +%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN105 + +[NeoAdapter.Install] +Characteristics = 0x1 +AddReg = Neo.Reg, NeoAdapter.Ndi +CopyFiles = Neo.CopyFiles.Sys +*IfType = 53 +*MediaType = 0 +*PhysicalMediaType = 0 + +[NeoAdapter.Install.Services] +AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% + +[NeoAdapter.Ndi] +HKR, , NetworkAddress, 0, %DefaultAddress% +HKR, Ndi, DeviceID, , "NeoAdapter_VPN105" +HKR, , DevLoader, , ndis +HKR, , DeviceVxDs, , Neo_VPN105.sys +HKR, NDIS, LogDriverName, , "Neo_VPN105" +HKR, NDIS, MajorNdisVersion, 1, 5 +HKR, NDIS, MinorNdisVersion, 1, 0 +HKR, Ndi\Interfaces, DefUpper, , "ndis5" +HKR, Ndi\Interfaces, UpperRange, , "ndis5" +HKR, Ndi\Interfaces, LowerRange, , "ethernet" +HKR, Ndi\Interfaces, DefLower, , "ethernet" +HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" +HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% +HKR, Ndi\Params\NetworkAddress, type, 0, "edit" +HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" +HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" +HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% +HKR, Ndi\Params\NetworkAddress, optional, 0, "0" +HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% +HKR, Ndi\Params\MaxSpeed, type, 0, "int" +HKR, Ndi\Params\MaxSpeed, default, 0, "100" +HKR, Ndi\Params\MaxSpeed, min, 0, "0" +HKR, Ndi\Params\MaxSpeed, max, 0, "2000" +HKR, Ndi\Params\MaxSpeed, step, 0, "1" +HKR, Ndi\Params\MaxSpeed, Base, 0, "10" +HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% +HKR, Ndi\Params\KeepLink, type, 0, "enum" +HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% +HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% +HKR, Ndi\Params\KeepLink, default, 0, "0" + + +[Neo.Service] +DisplayName = %Neo.Service.DispName% +Description = %Neo.Service.Desc% +ServiceType = 1 +StartType = 3 +ErrorControl = 1 +ServiceBinary = %12%\Neo_VPN105.sys +LoadOrderGroup = NDIS + +[Neo.Reg] +HKR, Ndi, Service, 0, Neo.Service.Name +HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" +HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" + +[Neo.EventLog] +HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN105.sys" +HKR, , TypesSupported, 0x00010001, 7 + +[Strings] +CompanyName = "SoftEther Corporation" +DiskDescription = "VPN Client Device Driver Install Disk" +Neo.Service.Name = "Neo_VPN105" +Neo.Service.DispName = "VPN Client Device Driver - VPN105" +Neo.Service.Desc = "VPN Client Adapter - VPN105" +NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN105" +Neo.EventLog.Name = "Neo" +NetworkAddress = "MAC Address" +DefaultAddress = "000001000001" +MaxSpeed = "Indicate Speed (Mbps)" +KeepLink = "Keep Link" +On = "On" +Off = "Off" + + +; Auto Generated 20180205_163610.803 + diff --git a/src/bin/hamcore/DriverPackages/Neo6_Win8/x64/Neo6_x64_VPN106.inf b/src/bin/hamcore/DriverPackages/Neo6_Win8/x64/Neo6_x64_VPN106.inf index ea9721a2..61bf95c9 100644 --- a/src/bin/hamcore/DriverPackages/Neo6_Win8/x64/Neo6_x64_VPN106.inf +++ b/src/bin/hamcore/DriverPackages/Neo6_Win8/x64/Neo6_x64_VPN106.inf @@ -1,114 +1,114 @@ -; VPN Client Device Driver for Windows 2000 and Greater -; -; Copyright (c) SoftEther Corporation. All Rights Reserved. -; http://www.softether.co.jp/ -; -; BUILD 9658 - -[Version] -Signature = "$Windows NT$" -Class = Net -ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} -Provider = %CompanyName% -DriverVer = 02/04/2018, 4.25.0.9658 -CatalogFile.NT = inf_VPN106.cat - -[Manufacturer] -%CompanyName% = SoftEther, NTamd64 - -[SourceDisksNames] -1=%DiskDescription%, "", , - -[SourceDisksFiles] -Neo_VPN106.sys = 1 - -[DestinationDirs] -DefaultDestDir = 12 -Neo.CopyFiles.Sys = 12 - -[Neo.CopyFiles.Sys] -Neo_VPN106.sys, , , 2 - -[SoftEther.NTamd64] -%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN106 - -[NeoAdapter.Install] -Characteristics = 0x1 -AddReg = Neo.Reg, NeoAdapter.Ndi -CopyFiles = Neo.CopyFiles.Sys -*IfType = 53 -*MediaType = 0 -*PhysicalMediaType = 0 - -[NeoAdapter.Install.Services] -AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% - -[NeoAdapter.Ndi] -HKR, , NetworkAddress, 0, %DefaultAddress% -HKR, Ndi, DeviceID, , "NeoAdapter_VPN106" -HKR, , DevLoader, , ndis -HKR, , DeviceVxDs, , Neo_VPN106.sys -HKR, NDIS, LogDriverName, , "Neo_VPN106" -HKR, NDIS, MajorNdisVersion, 1, 5 -HKR, NDIS, MinorNdisVersion, 1, 0 -HKR, Ndi\Interfaces, DefUpper, , "ndis5" -HKR, Ndi\Interfaces, UpperRange, , "ndis5" -HKR, Ndi\Interfaces, LowerRange, , "ethernet" -HKR, Ndi\Interfaces, DefLower, , "ethernet" -HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" -HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% -HKR, Ndi\Params\NetworkAddress, type, 0, "edit" -HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" -HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" -HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% -HKR, Ndi\Params\NetworkAddress, optional, 0, "0" -HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% -HKR, Ndi\Params\MaxSpeed, type, 0, "int" -HKR, Ndi\Params\MaxSpeed, default, 0, "100" -HKR, Ndi\Params\MaxSpeed, min, 0, "0" -HKR, Ndi\Params\MaxSpeed, max, 0, "2000" -HKR, Ndi\Params\MaxSpeed, step, 0, "1" -HKR, Ndi\Params\MaxSpeed, Base, 0, "10" -HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% -HKR, Ndi\Params\KeepLink, type, 0, "enum" -HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% -HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% -HKR, Ndi\Params\KeepLink, default, 0, "0" - - -[Neo.Service] -DisplayName = %Neo.Service.DispName% -Description = %Neo.Service.Desc% -ServiceType = 1 -StartType = 3 -ErrorControl = 1 -ServiceBinary = %12%\Neo_VPN106.sys -LoadOrderGroup = NDIS - -[Neo.Reg] -HKR, Ndi, Service, 0, Neo.Service.Name -HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" -HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" - -[Neo.EventLog] -HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN106.sys" -HKR, , TypesSupported, 0x00010001, 7 - -[Strings] -CompanyName = "SoftEther Corporation" -DiskDescription = "VPN Client Device Driver Install Disk" -Neo.Service.Name = "Neo_VPN106" -Neo.Service.DispName = "VPN Client Device Driver - VPN106" -Neo.Service.Desc = "VPN Client Adapter - VPN106" -NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN106" -Neo.EventLog.Name = "Neo" -NetworkAddress = "MAC Address" -DefaultAddress = "000001000001" -MaxSpeed = "Indicate Speed (Mbps)" -KeepLink = "Keep Link" -On = "On" -Off = "Off" - - -; Auto Generated 20180205_163610.804 - +; VPN Client Device Driver for Windows 2000 and Greater +; +; Copyright (c) SoftEther Corporation. All Rights Reserved. +; http://www.softether.co.jp/ +; +; BUILD 9658 + +[Version] +Signature = "$Windows NT$" +Class = Net +ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} +Provider = %CompanyName% +DriverVer = 02/04/2018, 4.25.0.9658 +CatalogFile.NT = inf_VPN106.cat + +[Manufacturer] +%CompanyName% = SoftEther, NTamd64 + +[SourceDisksNames] +1=%DiskDescription%, "", , + +[SourceDisksFiles] +Neo_VPN106.sys = 1 + +[DestinationDirs] +DefaultDestDir = 12 +Neo.CopyFiles.Sys = 12 + +[Neo.CopyFiles.Sys] +Neo_VPN106.sys, , , 2 + +[SoftEther.NTamd64] +%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN106 + +[NeoAdapter.Install] +Characteristics = 0x1 +AddReg = Neo.Reg, NeoAdapter.Ndi +CopyFiles = Neo.CopyFiles.Sys +*IfType = 53 +*MediaType = 0 +*PhysicalMediaType = 0 + +[NeoAdapter.Install.Services] +AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% + +[NeoAdapter.Ndi] +HKR, , NetworkAddress, 0, %DefaultAddress% +HKR, Ndi, DeviceID, , "NeoAdapter_VPN106" +HKR, , DevLoader, , ndis +HKR, , DeviceVxDs, , Neo_VPN106.sys +HKR, NDIS, LogDriverName, , "Neo_VPN106" +HKR, NDIS, MajorNdisVersion, 1, 5 +HKR, NDIS, MinorNdisVersion, 1, 0 +HKR, Ndi\Interfaces, DefUpper, , "ndis5" +HKR, Ndi\Interfaces, UpperRange, , "ndis5" +HKR, Ndi\Interfaces, LowerRange, , "ethernet" +HKR, Ndi\Interfaces, DefLower, , "ethernet" +HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" +HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% +HKR, Ndi\Params\NetworkAddress, type, 0, "edit" +HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" +HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" +HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% +HKR, Ndi\Params\NetworkAddress, optional, 0, "0" +HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% +HKR, Ndi\Params\MaxSpeed, type, 0, "int" +HKR, Ndi\Params\MaxSpeed, default, 0, "100" +HKR, Ndi\Params\MaxSpeed, min, 0, "0" +HKR, Ndi\Params\MaxSpeed, max, 0, "2000" +HKR, Ndi\Params\MaxSpeed, step, 0, "1" +HKR, Ndi\Params\MaxSpeed, Base, 0, "10" +HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% +HKR, Ndi\Params\KeepLink, type, 0, "enum" +HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% +HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% +HKR, Ndi\Params\KeepLink, default, 0, "0" + + +[Neo.Service] +DisplayName = %Neo.Service.DispName% +Description = %Neo.Service.Desc% +ServiceType = 1 +StartType = 3 +ErrorControl = 1 +ServiceBinary = %12%\Neo_VPN106.sys +LoadOrderGroup = NDIS + +[Neo.Reg] +HKR, Ndi, Service, 0, Neo.Service.Name +HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" +HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" + +[Neo.EventLog] +HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN106.sys" +HKR, , TypesSupported, 0x00010001, 7 + +[Strings] +CompanyName = "SoftEther Corporation" +DiskDescription = "VPN Client Device Driver Install Disk" +Neo.Service.Name = "Neo_VPN106" +Neo.Service.DispName = "VPN Client Device Driver - VPN106" +Neo.Service.Desc = "VPN Client Adapter - VPN106" +NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN106" +Neo.EventLog.Name = "Neo" +NetworkAddress = "MAC Address" +DefaultAddress = "000001000001" +MaxSpeed = "Indicate Speed (Mbps)" +KeepLink = "Keep Link" +On = "On" +Off = "Off" + + +; Auto Generated 20180205_163610.804 + diff --git a/src/bin/hamcore/DriverPackages/Neo6_Win8/x64/Neo6_x64_VPN107.inf b/src/bin/hamcore/DriverPackages/Neo6_Win8/x64/Neo6_x64_VPN107.inf index 292bd422..9723541b 100644 --- a/src/bin/hamcore/DriverPackages/Neo6_Win8/x64/Neo6_x64_VPN107.inf +++ b/src/bin/hamcore/DriverPackages/Neo6_Win8/x64/Neo6_x64_VPN107.inf @@ -1,114 +1,114 @@ -; VPN Client Device Driver for Windows 2000 and Greater -; -; Copyright (c) SoftEther Corporation. All Rights Reserved. -; http://www.softether.co.jp/ -; -; BUILD 9658 - -[Version] -Signature = "$Windows NT$" -Class = Net -ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} -Provider = %CompanyName% -DriverVer = 02/04/2018, 4.25.0.9658 -CatalogFile.NT = inf_VPN107.cat - -[Manufacturer] -%CompanyName% = SoftEther, NTamd64 - -[SourceDisksNames] -1=%DiskDescription%, "", , - -[SourceDisksFiles] -Neo_VPN107.sys = 1 - -[DestinationDirs] -DefaultDestDir = 12 -Neo.CopyFiles.Sys = 12 - -[Neo.CopyFiles.Sys] -Neo_VPN107.sys, , , 2 - -[SoftEther.NTamd64] -%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN107 - -[NeoAdapter.Install] -Characteristics = 0x1 -AddReg = Neo.Reg, NeoAdapter.Ndi -CopyFiles = Neo.CopyFiles.Sys -*IfType = 53 -*MediaType = 0 -*PhysicalMediaType = 0 - -[NeoAdapter.Install.Services] -AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% - -[NeoAdapter.Ndi] -HKR, , NetworkAddress, 0, %DefaultAddress% -HKR, Ndi, DeviceID, , "NeoAdapter_VPN107" -HKR, , DevLoader, , ndis -HKR, , DeviceVxDs, , Neo_VPN107.sys -HKR, NDIS, LogDriverName, , "Neo_VPN107" -HKR, NDIS, MajorNdisVersion, 1, 5 -HKR, NDIS, MinorNdisVersion, 1, 0 -HKR, Ndi\Interfaces, DefUpper, , "ndis5" -HKR, Ndi\Interfaces, UpperRange, , "ndis5" -HKR, Ndi\Interfaces, LowerRange, , "ethernet" -HKR, Ndi\Interfaces, DefLower, , "ethernet" -HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" -HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% -HKR, Ndi\Params\NetworkAddress, type, 0, "edit" -HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" -HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" -HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% -HKR, Ndi\Params\NetworkAddress, optional, 0, "0" -HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% -HKR, Ndi\Params\MaxSpeed, type, 0, "int" -HKR, Ndi\Params\MaxSpeed, default, 0, "100" -HKR, Ndi\Params\MaxSpeed, min, 0, "0" -HKR, Ndi\Params\MaxSpeed, max, 0, "2000" -HKR, Ndi\Params\MaxSpeed, step, 0, "1" -HKR, Ndi\Params\MaxSpeed, Base, 0, "10" -HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% -HKR, Ndi\Params\KeepLink, type, 0, "enum" -HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% -HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% -HKR, Ndi\Params\KeepLink, default, 0, "0" - - -[Neo.Service] -DisplayName = %Neo.Service.DispName% -Description = %Neo.Service.Desc% -ServiceType = 1 -StartType = 3 -ErrorControl = 1 -ServiceBinary = %12%\Neo_VPN107.sys -LoadOrderGroup = NDIS - -[Neo.Reg] -HKR, Ndi, Service, 0, Neo.Service.Name -HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" -HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" - -[Neo.EventLog] -HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN107.sys" -HKR, , TypesSupported, 0x00010001, 7 - -[Strings] -CompanyName = "SoftEther Corporation" -DiskDescription = "VPN Client Device Driver Install Disk" -Neo.Service.Name = "Neo_VPN107" -Neo.Service.DispName = "VPN Client Device Driver - VPN107" -Neo.Service.Desc = "VPN Client Adapter - VPN107" -NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN107" -Neo.EventLog.Name = "Neo" -NetworkAddress = "MAC Address" -DefaultAddress = "000001000001" -MaxSpeed = "Indicate Speed (Mbps)" -KeepLink = "Keep Link" -On = "On" -Off = "Off" - - -; Auto Generated 20180205_163610.804 - +; VPN Client Device Driver for Windows 2000 and Greater +; +; Copyright (c) SoftEther Corporation. All Rights Reserved. +; http://www.softether.co.jp/ +; +; BUILD 9658 + +[Version] +Signature = "$Windows NT$" +Class = Net +ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} +Provider = %CompanyName% +DriverVer = 02/04/2018, 4.25.0.9658 +CatalogFile.NT = inf_VPN107.cat + +[Manufacturer] +%CompanyName% = SoftEther, NTamd64 + +[SourceDisksNames] +1=%DiskDescription%, "", , + +[SourceDisksFiles] +Neo_VPN107.sys = 1 + +[DestinationDirs] +DefaultDestDir = 12 +Neo.CopyFiles.Sys = 12 + +[Neo.CopyFiles.Sys] +Neo_VPN107.sys, , , 2 + +[SoftEther.NTamd64] +%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN107 + +[NeoAdapter.Install] +Characteristics = 0x1 +AddReg = Neo.Reg, NeoAdapter.Ndi +CopyFiles = Neo.CopyFiles.Sys +*IfType = 53 +*MediaType = 0 +*PhysicalMediaType = 0 + +[NeoAdapter.Install.Services] +AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% + +[NeoAdapter.Ndi] +HKR, , NetworkAddress, 0, %DefaultAddress% +HKR, Ndi, DeviceID, , "NeoAdapter_VPN107" +HKR, , DevLoader, , ndis +HKR, , DeviceVxDs, , Neo_VPN107.sys +HKR, NDIS, LogDriverName, , "Neo_VPN107" +HKR, NDIS, MajorNdisVersion, 1, 5 +HKR, NDIS, MinorNdisVersion, 1, 0 +HKR, Ndi\Interfaces, DefUpper, , "ndis5" +HKR, Ndi\Interfaces, UpperRange, , "ndis5" +HKR, Ndi\Interfaces, LowerRange, , "ethernet" +HKR, Ndi\Interfaces, DefLower, , "ethernet" +HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" +HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% +HKR, Ndi\Params\NetworkAddress, type, 0, "edit" +HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" +HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" +HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% +HKR, Ndi\Params\NetworkAddress, optional, 0, "0" +HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% +HKR, Ndi\Params\MaxSpeed, type, 0, "int" +HKR, Ndi\Params\MaxSpeed, default, 0, "100" +HKR, Ndi\Params\MaxSpeed, min, 0, "0" +HKR, Ndi\Params\MaxSpeed, max, 0, "2000" +HKR, Ndi\Params\MaxSpeed, step, 0, "1" +HKR, Ndi\Params\MaxSpeed, Base, 0, "10" +HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% +HKR, Ndi\Params\KeepLink, type, 0, "enum" +HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% +HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% +HKR, Ndi\Params\KeepLink, default, 0, "0" + + +[Neo.Service] +DisplayName = %Neo.Service.DispName% +Description = %Neo.Service.Desc% +ServiceType = 1 +StartType = 3 +ErrorControl = 1 +ServiceBinary = %12%\Neo_VPN107.sys +LoadOrderGroup = NDIS + +[Neo.Reg] +HKR, Ndi, Service, 0, Neo.Service.Name +HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" +HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" + +[Neo.EventLog] +HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN107.sys" +HKR, , TypesSupported, 0x00010001, 7 + +[Strings] +CompanyName = "SoftEther Corporation" +DiskDescription = "VPN Client Device Driver Install Disk" +Neo.Service.Name = "Neo_VPN107" +Neo.Service.DispName = "VPN Client Device Driver - VPN107" +Neo.Service.Desc = "VPN Client Adapter - VPN107" +NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN107" +Neo.EventLog.Name = "Neo" +NetworkAddress = "MAC Address" +DefaultAddress = "000001000001" +MaxSpeed = "Indicate Speed (Mbps)" +KeepLink = "Keep Link" +On = "On" +Off = "Off" + + +; Auto Generated 20180205_163610.804 + diff --git a/src/bin/hamcore/DriverPackages/Neo6_Win8/x64/Neo6_x64_VPN108.inf b/src/bin/hamcore/DriverPackages/Neo6_Win8/x64/Neo6_x64_VPN108.inf index 375242e4..2e096ec5 100644 --- a/src/bin/hamcore/DriverPackages/Neo6_Win8/x64/Neo6_x64_VPN108.inf +++ b/src/bin/hamcore/DriverPackages/Neo6_Win8/x64/Neo6_x64_VPN108.inf @@ -1,114 +1,114 @@ -; VPN Client Device Driver for Windows 2000 and Greater -; -; Copyright (c) SoftEther Corporation. All Rights Reserved. -; http://www.softether.co.jp/ -; -; BUILD 9658 - -[Version] -Signature = "$Windows NT$" -Class = Net -ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} -Provider = %CompanyName% -DriverVer = 02/04/2018, 4.25.0.9658 -CatalogFile.NT = inf_VPN108.cat - -[Manufacturer] -%CompanyName% = SoftEther, NTamd64 - -[SourceDisksNames] -1=%DiskDescription%, "", , - -[SourceDisksFiles] -Neo_VPN108.sys = 1 - -[DestinationDirs] -DefaultDestDir = 12 -Neo.CopyFiles.Sys = 12 - -[Neo.CopyFiles.Sys] -Neo_VPN108.sys, , , 2 - -[SoftEther.NTamd64] -%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN108 - -[NeoAdapter.Install] -Characteristics = 0x1 -AddReg = Neo.Reg, NeoAdapter.Ndi -CopyFiles = Neo.CopyFiles.Sys -*IfType = 53 -*MediaType = 0 -*PhysicalMediaType = 0 - -[NeoAdapter.Install.Services] -AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% - -[NeoAdapter.Ndi] -HKR, , NetworkAddress, 0, %DefaultAddress% -HKR, Ndi, DeviceID, , "NeoAdapter_VPN108" -HKR, , DevLoader, , ndis -HKR, , DeviceVxDs, , Neo_VPN108.sys -HKR, NDIS, LogDriverName, , "Neo_VPN108" -HKR, NDIS, MajorNdisVersion, 1, 5 -HKR, NDIS, MinorNdisVersion, 1, 0 -HKR, Ndi\Interfaces, DefUpper, , "ndis5" -HKR, Ndi\Interfaces, UpperRange, , "ndis5" -HKR, Ndi\Interfaces, LowerRange, , "ethernet" -HKR, Ndi\Interfaces, DefLower, , "ethernet" -HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" -HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% -HKR, Ndi\Params\NetworkAddress, type, 0, "edit" -HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" -HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" -HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% -HKR, Ndi\Params\NetworkAddress, optional, 0, "0" -HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% -HKR, Ndi\Params\MaxSpeed, type, 0, "int" -HKR, Ndi\Params\MaxSpeed, default, 0, "100" -HKR, Ndi\Params\MaxSpeed, min, 0, "0" -HKR, Ndi\Params\MaxSpeed, max, 0, "2000" -HKR, Ndi\Params\MaxSpeed, step, 0, "1" -HKR, Ndi\Params\MaxSpeed, Base, 0, "10" -HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% -HKR, Ndi\Params\KeepLink, type, 0, "enum" -HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% -HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% -HKR, Ndi\Params\KeepLink, default, 0, "0" - - -[Neo.Service] -DisplayName = %Neo.Service.DispName% -Description = %Neo.Service.Desc% -ServiceType = 1 -StartType = 3 -ErrorControl = 1 -ServiceBinary = %12%\Neo_VPN108.sys -LoadOrderGroup = NDIS - -[Neo.Reg] -HKR, Ndi, Service, 0, Neo.Service.Name -HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" -HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" - -[Neo.EventLog] -HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN108.sys" -HKR, , TypesSupported, 0x00010001, 7 - -[Strings] -CompanyName = "SoftEther Corporation" -DiskDescription = "VPN Client Device Driver Install Disk" -Neo.Service.Name = "Neo_VPN108" -Neo.Service.DispName = "VPN Client Device Driver - VPN108" -Neo.Service.Desc = "VPN Client Adapter - VPN108" -NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN108" -Neo.EventLog.Name = "Neo" -NetworkAddress = "MAC Address" -DefaultAddress = "000001000001" -MaxSpeed = "Indicate Speed (Mbps)" -KeepLink = "Keep Link" -On = "On" -Off = "Off" - - -; Auto Generated 20180205_163610.805 - +; VPN Client Device Driver for Windows 2000 and Greater +; +; Copyright (c) SoftEther Corporation. All Rights Reserved. +; http://www.softether.co.jp/ +; +; BUILD 9658 + +[Version] +Signature = "$Windows NT$" +Class = Net +ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} +Provider = %CompanyName% +DriverVer = 02/04/2018, 4.25.0.9658 +CatalogFile.NT = inf_VPN108.cat + +[Manufacturer] +%CompanyName% = SoftEther, NTamd64 + +[SourceDisksNames] +1=%DiskDescription%, "", , + +[SourceDisksFiles] +Neo_VPN108.sys = 1 + +[DestinationDirs] +DefaultDestDir = 12 +Neo.CopyFiles.Sys = 12 + +[Neo.CopyFiles.Sys] +Neo_VPN108.sys, , , 2 + +[SoftEther.NTamd64] +%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN108 + +[NeoAdapter.Install] +Characteristics = 0x1 +AddReg = Neo.Reg, NeoAdapter.Ndi +CopyFiles = Neo.CopyFiles.Sys +*IfType = 53 +*MediaType = 0 +*PhysicalMediaType = 0 + +[NeoAdapter.Install.Services] +AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% + +[NeoAdapter.Ndi] +HKR, , NetworkAddress, 0, %DefaultAddress% +HKR, Ndi, DeviceID, , "NeoAdapter_VPN108" +HKR, , DevLoader, , ndis +HKR, , DeviceVxDs, , Neo_VPN108.sys +HKR, NDIS, LogDriverName, , "Neo_VPN108" +HKR, NDIS, MajorNdisVersion, 1, 5 +HKR, NDIS, MinorNdisVersion, 1, 0 +HKR, Ndi\Interfaces, DefUpper, , "ndis5" +HKR, Ndi\Interfaces, UpperRange, , "ndis5" +HKR, Ndi\Interfaces, LowerRange, , "ethernet" +HKR, Ndi\Interfaces, DefLower, , "ethernet" +HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" +HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% +HKR, Ndi\Params\NetworkAddress, type, 0, "edit" +HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" +HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" +HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% +HKR, Ndi\Params\NetworkAddress, optional, 0, "0" +HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% +HKR, Ndi\Params\MaxSpeed, type, 0, "int" +HKR, Ndi\Params\MaxSpeed, default, 0, "100" +HKR, Ndi\Params\MaxSpeed, min, 0, "0" +HKR, Ndi\Params\MaxSpeed, max, 0, "2000" +HKR, Ndi\Params\MaxSpeed, step, 0, "1" +HKR, Ndi\Params\MaxSpeed, Base, 0, "10" +HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% +HKR, Ndi\Params\KeepLink, type, 0, "enum" +HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% +HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% +HKR, Ndi\Params\KeepLink, default, 0, "0" + + +[Neo.Service] +DisplayName = %Neo.Service.DispName% +Description = %Neo.Service.Desc% +ServiceType = 1 +StartType = 3 +ErrorControl = 1 +ServiceBinary = %12%\Neo_VPN108.sys +LoadOrderGroup = NDIS + +[Neo.Reg] +HKR, Ndi, Service, 0, Neo.Service.Name +HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" +HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" + +[Neo.EventLog] +HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN108.sys" +HKR, , TypesSupported, 0x00010001, 7 + +[Strings] +CompanyName = "SoftEther Corporation" +DiskDescription = "VPN Client Device Driver Install Disk" +Neo.Service.Name = "Neo_VPN108" +Neo.Service.DispName = "VPN Client Device Driver - VPN108" +Neo.Service.Desc = "VPN Client Adapter - VPN108" +NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN108" +Neo.EventLog.Name = "Neo" +NetworkAddress = "MAC Address" +DefaultAddress = "000001000001" +MaxSpeed = "Indicate Speed (Mbps)" +KeepLink = "Keep Link" +On = "On" +Off = "Off" + + +; Auto Generated 20180205_163610.805 + diff --git a/src/bin/hamcore/DriverPackages/Neo6_Win8/x64/Neo6_x64_VPN109.inf b/src/bin/hamcore/DriverPackages/Neo6_Win8/x64/Neo6_x64_VPN109.inf index 3313b978..d075b7ed 100644 --- a/src/bin/hamcore/DriverPackages/Neo6_Win8/x64/Neo6_x64_VPN109.inf +++ b/src/bin/hamcore/DriverPackages/Neo6_Win8/x64/Neo6_x64_VPN109.inf @@ -1,114 +1,114 @@ -; VPN Client Device Driver for Windows 2000 and Greater -; -; Copyright (c) SoftEther Corporation. All Rights Reserved. -; http://www.softether.co.jp/ -; -; BUILD 9658 - -[Version] -Signature = "$Windows NT$" -Class = Net -ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} -Provider = %CompanyName% -DriverVer = 02/04/2018, 4.25.0.9658 -CatalogFile.NT = inf_VPN109.cat - -[Manufacturer] -%CompanyName% = SoftEther, NTamd64 - -[SourceDisksNames] -1=%DiskDescription%, "", , - -[SourceDisksFiles] -Neo_VPN109.sys = 1 - -[DestinationDirs] -DefaultDestDir = 12 -Neo.CopyFiles.Sys = 12 - -[Neo.CopyFiles.Sys] -Neo_VPN109.sys, , , 2 - -[SoftEther.NTamd64] -%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN109 - -[NeoAdapter.Install] -Characteristics = 0x1 -AddReg = Neo.Reg, NeoAdapter.Ndi -CopyFiles = Neo.CopyFiles.Sys -*IfType = 53 -*MediaType = 0 -*PhysicalMediaType = 0 - -[NeoAdapter.Install.Services] -AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% - -[NeoAdapter.Ndi] -HKR, , NetworkAddress, 0, %DefaultAddress% -HKR, Ndi, DeviceID, , "NeoAdapter_VPN109" -HKR, , DevLoader, , ndis -HKR, , DeviceVxDs, , Neo_VPN109.sys -HKR, NDIS, LogDriverName, , "Neo_VPN109" -HKR, NDIS, MajorNdisVersion, 1, 5 -HKR, NDIS, MinorNdisVersion, 1, 0 -HKR, Ndi\Interfaces, DefUpper, , "ndis5" -HKR, Ndi\Interfaces, UpperRange, , "ndis5" -HKR, Ndi\Interfaces, LowerRange, , "ethernet" -HKR, Ndi\Interfaces, DefLower, , "ethernet" -HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" -HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% -HKR, Ndi\Params\NetworkAddress, type, 0, "edit" -HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" -HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" -HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% -HKR, Ndi\Params\NetworkAddress, optional, 0, "0" -HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% -HKR, Ndi\Params\MaxSpeed, type, 0, "int" -HKR, Ndi\Params\MaxSpeed, default, 0, "100" -HKR, Ndi\Params\MaxSpeed, min, 0, "0" -HKR, Ndi\Params\MaxSpeed, max, 0, "2000" -HKR, Ndi\Params\MaxSpeed, step, 0, "1" -HKR, Ndi\Params\MaxSpeed, Base, 0, "10" -HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% -HKR, Ndi\Params\KeepLink, type, 0, "enum" -HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% -HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% -HKR, Ndi\Params\KeepLink, default, 0, "0" - - -[Neo.Service] -DisplayName = %Neo.Service.DispName% -Description = %Neo.Service.Desc% -ServiceType = 1 -StartType = 3 -ErrorControl = 1 -ServiceBinary = %12%\Neo_VPN109.sys -LoadOrderGroup = NDIS - -[Neo.Reg] -HKR, Ndi, Service, 0, Neo.Service.Name -HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" -HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" - -[Neo.EventLog] -HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN109.sys" -HKR, , TypesSupported, 0x00010001, 7 - -[Strings] -CompanyName = "SoftEther Corporation" -DiskDescription = "VPN Client Device Driver Install Disk" -Neo.Service.Name = "Neo_VPN109" -Neo.Service.DispName = "VPN Client Device Driver - VPN109" -Neo.Service.Desc = "VPN Client Adapter - VPN109" -NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN109" -Neo.EventLog.Name = "Neo" -NetworkAddress = "MAC Address" -DefaultAddress = "000001000001" -MaxSpeed = "Indicate Speed (Mbps)" -KeepLink = "Keep Link" -On = "On" -Off = "Off" - - -; Auto Generated 20180205_163610.806 - +; VPN Client Device Driver for Windows 2000 and Greater +; +; Copyright (c) SoftEther Corporation. All Rights Reserved. +; http://www.softether.co.jp/ +; +; BUILD 9658 + +[Version] +Signature = "$Windows NT$" +Class = Net +ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} +Provider = %CompanyName% +DriverVer = 02/04/2018, 4.25.0.9658 +CatalogFile.NT = inf_VPN109.cat + +[Manufacturer] +%CompanyName% = SoftEther, NTamd64 + +[SourceDisksNames] +1=%DiskDescription%, "", , + +[SourceDisksFiles] +Neo_VPN109.sys = 1 + +[DestinationDirs] +DefaultDestDir = 12 +Neo.CopyFiles.Sys = 12 + +[Neo.CopyFiles.Sys] +Neo_VPN109.sys, , , 2 + +[SoftEther.NTamd64] +%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN109 + +[NeoAdapter.Install] +Characteristics = 0x1 +AddReg = Neo.Reg, NeoAdapter.Ndi +CopyFiles = Neo.CopyFiles.Sys +*IfType = 53 +*MediaType = 0 +*PhysicalMediaType = 0 + +[NeoAdapter.Install.Services] +AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% + +[NeoAdapter.Ndi] +HKR, , NetworkAddress, 0, %DefaultAddress% +HKR, Ndi, DeviceID, , "NeoAdapter_VPN109" +HKR, , DevLoader, , ndis +HKR, , DeviceVxDs, , Neo_VPN109.sys +HKR, NDIS, LogDriverName, , "Neo_VPN109" +HKR, NDIS, MajorNdisVersion, 1, 5 +HKR, NDIS, MinorNdisVersion, 1, 0 +HKR, Ndi\Interfaces, DefUpper, , "ndis5" +HKR, Ndi\Interfaces, UpperRange, , "ndis5" +HKR, Ndi\Interfaces, LowerRange, , "ethernet" +HKR, Ndi\Interfaces, DefLower, , "ethernet" +HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" +HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% +HKR, Ndi\Params\NetworkAddress, type, 0, "edit" +HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" +HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" +HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% +HKR, Ndi\Params\NetworkAddress, optional, 0, "0" +HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% +HKR, Ndi\Params\MaxSpeed, type, 0, "int" +HKR, Ndi\Params\MaxSpeed, default, 0, "100" +HKR, Ndi\Params\MaxSpeed, min, 0, "0" +HKR, Ndi\Params\MaxSpeed, max, 0, "2000" +HKR, Ndi\Params\MaxSpeed, step, 0, "1" +HKR, Ndi\Params\MaxSpeed, Base, 0, "10" +HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% +HKR, Ndi\Params\KeepLink, type, 0, "enum" +HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% +HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% +HKR, Ndi\Params\KeepLink, default, 0, "0" + + +[Neo.Service] +DisplayName = %Neo.Service.DispName% +Description = %Neo.Service.Desc% +ServiceType = 1 +StartType = 3 +ErrorControl = 1 +ServiceBinary = %12%\Neo_VPN109.sys +LoadOrderGroup = NDIS + +[Neo.Reg] +HKR, Ndi, Service, 0, Neo.Service.Name +HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" +HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" + +[Neo.EventLog] +HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN109.sys" +HKR, , TypesSupported, 0x00010001, 7 + +[Strings] +CompanyName = "SoftEther Corporation" +DiskDescription = "VPN Client Device Driver Install Disk" +Neo.Service.Name = "Neo_VPN109" +Neo.Service.DispName = "VPN Client Device Driver - VPN109" +Neo.Service.Desc = "VPN Client Adapter - VPN109" +NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN109" +Neo.EventLog.Name = "Neo" +NetworkAddress = "MAC Address" +DefaultAddress = "000001000001" +MaxSpeed = "Indicate Speed (Mbps)" +KeepLink = "Keep Link" +On = "On" +Off = "Off" + + +; Auto Generated 20180205_163610.806 + diff --git a/src/bin/hamcore/DriverPackages/Neo6_Win8/x64/Neo6_x64_VPN11.inf b/src/bin/hamcore/DriverPackages/Neo6_Win8/x64/Neo6_x64_VPN11.inf index 77bdea8c..a4a01164 100644 --- a/src/bin/hamcore/DriverPackages/Neo6_Win8/x64/Neo6_x64_VPN11.inf +++ b/src/bin/hamcore/DriverPackages/Neo6_Win8/x64/Neo6_x64_VPN11.inf @@ -1,114 +1,114 @@ -; VPN Client Device Driver for Windows 2000 and Greater -; -; Copyright (c) SoftEther Corporation. All Rights Reserved. -; http://www.softether.co.jp/ -; -; BUILD 9658 - -[Version] -Signature = "$Windows NT$" -Class = Net -ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} -Provider = %CompanyName% -DriverVer = 02/04/2018, 4.25.0.9658 -CatalogFile.NT = inf_VPN11.cat - -[Manufacturer] -%CompanyName% = SoftEther, NTamd64 - -[SourceDisksNames] -1=%DiskDescription%, "", , - -[SourceDisksFiles] -Neo_VPN11.sys = 1 - -[DestinationDirs] -DefaultDestDir = 12 -Neo.CopyFiles.Sys = 12 - -[Neo.CopyFiles.Sys] -Neo_VPN11.sys, , , 2 - -[SoftEther.NTamd64] -%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN11 - -[NeoAdapter.Install] -Characteristics = 0x1 -AddReg = Neo.Reg, NeoAdapter.Ndi -CopyFiles = Neo.CopyFiles.Sys -*IfType = 53 -*MediaType = 0 -*PhysicalMediaType = 0 - -[NeoAdapter.Install.Services] -AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% - -[NeoAdapter.Ndi] -HKR, , NetworkAddress, 0, %DefaultAddress% -HKR, Ndi, DeviceID, , "NeoAdapter_VPN11" -HKR, , DevLoader, , ndis -HKR, , DeviceVxDs, , Neo_VPN11.sys -HKR, NDIS, LogDriverName, , "Neo_VPN11" -HKR, NDIS, MajorNdisVersion, 1, 5 -HKR, NDIS, MinorNdisVersion, 1, 0 -HKR, Ndi\Interfaces, DefUpper, , "ndis5" -HKR, Ndi\Interfaces, UpperRange, , "ndis5" -HKR, Ndi\Interfaces, LowerRange, , "ethernet" -HKR, Ndi\Interfaces, DefLower, , "ethernet" -HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" -HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% -HKR, Ndi\Params\NetworkAddress, type, 0, "edit" -HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" -HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" -HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% -HKR, Ndi\Params\NetworkAddress, optional, 0, "0" -HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% -HKR, Ndi\Params\MaxSpeed, type, 0, "int" -HKR, Ndi\Params\MaxSpeed, default, 0, "100" -HKR, Ndi\Params\MaxSpeed, min, 0, "0" -HKR, Ndi\Params\MaxSpeed, max, 0, "2000" -HKR, Ndi\Params\MaxSpeed, step, 0, "1" -HKR, Ndi\Params\MaxSpeed, Base, 0, "10" -HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% -HKR, Ndi\Params\KeepLink, type, 0, "enum" -HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% -HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% -HKR, Ndi\Params\KeepLink, default, 0, "0" - - -[Neo.Service] -DisplayName = %Neo.Service.DispName% -Description = %Neo.Service.Desc% -ServiceType = 1 -StartType = 3 -ErrorControl = 1 -ServiceBinary = %12%\Neo_VPN11.sys -LoadOrderGroup = NDIS - -[Neo.Reg] -HKR, Ndi, Service, 0, Neo.Service.Name -HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" -HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" - -[Neo.EventLog] -HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN11.sys" -HKR, , TypesSupported, 0x00010001, 7 - -[Strings] -CompanyName = "SoftEther Corporation" -DiskDescription = "VPN Client Device Driver Install Disk" -Neo.Service.Name = "Neo_VPN11" -Neo.Service.DispName = "VPN Client Device Driver - VPN11" -Neo.Service.Desc = "VPN Client Adapter - VPN11" -NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN11" -Neo.EventLog.Name = "Neo" -NetworkAddress = "MAC Address" -DefaultAddress = "000001000001" -MaxSpeed = "Indicate Speed (Mbps)" -KeepLink = "Keep Link" -On = "On" -Off = "Off" - - -; Auto Generated 20180205_163610.744 - +; VPN Client Device Driver for Windows 2000 and Greater +; +; Copyright (c) SoftEther Corporation. All Rights Reserved. +; http://www.softether.co.jp/ +; +; BUILD 9658 + +[Version] +Signature = "$Windows NT$" +Class = Net +ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} +Provider = %CompanyName% +DriverVer = 02/04/2018, 4.25.0.9658 +CatalogFile.NT = inf_VPN11.cat + +[Manufacturer] +%CompanyName% = SoftEther, NTamd64 + +[SourceDisksNames] +1=%DiskDescription%, "", , + +[SourceDisksFiles] +Neo_VPN11.sys = 1 + +[DestinationDirs] +DefaultDestDir = 12 +Neo.CopyFiles.Sys = 12 + +[Neo.CopyFiles.Sys] +Neo_VPN11.sys, , , 2 + +[SoftEther.NTamd64] +%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN11 + +[NeoAdapter.Install] +Characteristics = 0x1 +AddReg = Neo.Reg, NeoAdapter.Ndi +CopyFiles = Neo.CopyFiles.Sys +*IfType = 53 +*MediaType = 0 +*PhysicalMediaType = 0 + +[NeoAdapter.Install.Services] +AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% + +[NeoAdapter.Ndi] +HKR, , NetworkAddress, 0, %DefaultAddress% +HKR, Ndi, DeviceID, , "NeoAdapter_VPN11" +HKR, , DevLoader, , ndis +HKR, , DeviceVxDs, , Neo_VPN11.sys +HKR, NDIS, LogDriverName, , "Neo_VPN11" +HKR, NDIS, MajorNdisVersion, 1, 5 +HKR, NDIS, MinorNdisVersion, 1, 0 +HKR, Ndi\Interfaces, DefUpper, , "ndis5" +HKR, Ndi\Interfaces, UpperRange, , "ndis5" +HKR, Ndi\Interfaces, LowerRange, , "ethernet" +HKR, Ndi\Interfaces, DefLower, , "ethernet" +HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" +HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% +HKR, Ndi\Params\NetworkAddress, type, 0, "edit" +HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" +HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" +HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% +HKR, Ndi\Params\NetworkAddress, optional, 0, "0" +HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% +HKR, Ndi\Params\MaxSpeed, type, 0, "int" +HKR, Ndi\Params\MaxSpeed, default, 0, "100" +HKR, Ndi\Params\MaxSpeed, min, 0, "0" +HKR, Ndi\Params\MaxSpeed, max, 0, "2000" +HKR, Ndi\Params\MaxSpeed, step, 0, "1" +HKR, Ndi\Params\MaxSpeed, Base, 0, "10" +HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% +HKR, Ndi\Params\KeepLink, type, 0, "enum" +HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% +HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% +HKR, Ndi\Params\KeepLink, default, 0, "0" + + +[Neo.Service] +DisplayName = %Neo.Service.DispName% +Description = %Neo.Service.Desc% +ServiceType = 1 +StartType = 3 +ErrorControl = 1 +ServiceBinary = %12%\Neo_VPN11.sys +LoadOrderGroup = NDIS + +[Neo.Reg] +HKR, Ndi, Service, 0, Neo.Service.Name +HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" +HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" + +[Neo.EventLog] +HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN11.sys" +HKR, , TypesSupported, 0x00010001, 7 + +[Strings] +CompanyName = "SoftEther Corporation" +DiskDescription = "VPN Client Device Driver Install Disk" +Neo.Service.Name = "Neo_VPN11" +Neo.Service.DispName = "VPN Client Device Driver - VPN11" +Neo.Service.Desc = "VPN Client Adapter - VPN11" +NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN11" +Neo.EventLog.Name = "Neo" +NetworkAddress = "MAC Address" +DefaultAddress = "000001000001" +MaxSpeed = "Indicate Speed (Mbps)" +KeepLink = "Keep Link" +On = "On" +Off = "Off" + + +; Auto Generated 20180205_163610.744 + diff --git a/src/bin/hamcore/DriverPackages/Neo6_Win8/x64/Neo6_x64_VPN110.inf b/src/bin/hamcore/DriverPackages/Neo6_Win8/x64/Neo6_x64_VPN110.inf index c782f4cb..2f1beb7b 100644 --- a/src/bin/hamcore/DriverPackages/Neo6_Win8/x64/Neo6_x64_VPN110.inf +++ b/src/bin/hamcore/DriverPackages/Neo6_Win8/x64/Neo6_x64_VPN110.inf @@ -1,114 +1,114 @@ -; VPN Client Device Driver for Windows 2000 and Greater -; -; Copyright (c) SoftEther Corporation. All Rights Reserved. -; http://www.softether.co.jp/ -; -; BUILD 9658 - -[Version] -Signature = "$Windows NT$" -Class = Net -ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} -Provider = %CompanyName% -DriverVer = 02/04/2018, 4.25.0.9658 -CatalogFile.NT = inf_VPN110.cat - -[Manufacturer] -%CompanyName% = SoftEther, NTamd64 - -[SourceDisksNames] -1=%DiskDescription%, "", , - -[SourceDisksFiles] -Neo_VPN110.sys = 1 - -[DestinationDirs] -DefaultDestDir = 12 -Neo.CopyFiles.Sys = 12 - -[Neo.CopyFiles.Sys] -Neo_VPN110.sys, , , 2 - -[SoftEther.NTamd64] -%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN110 - -[NeoAdapter.Install] -Characteristics = 0x1 -AddReg = Neo.Reg, NeoAdapter.Ndi -CopyFiles = Neo.CopyFiles.Sys -*IfType = 53 -*MediaType = 0 -*PhysicalMediaType = 0 - -[NeoAdapter.Install.Services] -AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% - -[NeoAdapter.Ndi] -HKR, , NetworkAddress, 0, %DefaultAddress% -HKR, Ndi, DeviceID, , "NeoAdapter_VPN110" -HKR, , DevLoader, , ndis -HKR, , DeviceVxDs, , Neo_VPN110.sys -HKR, NDIS, LogDriverName, , "Neo_VPN110" -HKR, NDIS, MajorNdisVersion, 1, 5 -HKR, NDIS, MinorNdisVersion, 1, 0 -HKR, Ndi\Interfaces, DefUpper, , "ndis5" -HKR, Ndi\Interfaces, UpperRange, , "ndis5" -HKR, Ndi\Interfaces, LowerRange, , "ethernet" -HKR, Ndi\Interfaces, DefLower, , "ethernet" -HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" -HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% -HKR, Ndi\Params\NetworkAddress, type, 0, "edit" -HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" -HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" -HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% -HKR, Ndi\Params\NetworkAddress, optional, 0, "0" -HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% -HKR, Ndi\Params\MaxSpeed, type, 0, "int" -HKR, Ndi\Params\MaxSpeed, default, 0, "100" -HKR, Ndi\Params\MaxSpeed, min, 0, "0" -HKR, Ndi\Params\MaxSpeed, max, 0, "2000" -HKR, Ndi\Params\MaxSpeed, step, 0, "1" -HKR, Ndi\Params\MaxSpeed, Base, 0, "10" -HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% -HKR, Ndi\Params\KeepLink, type, 0, "enum" -HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% -HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% -HKR, Ndi\Params\KeepLink, default, 0, "0" - - -[Neo.Service] -DisplayName = %Neo.Service.DispName% -Description = %Neo.Service.Desc% -ServiceType = 1 -StartType = 3 -ErrorControl = 1 -ServiceBinary = %12%\Neo_VPN110.sys -LoadOrderGroup = NDIS - -[Neo.Reg] -HKR, Ndi, Service, 0, Neo.Service.Name -HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" -HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" - -[Neo.EventLog] -HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN110.sys" -HKR, , TypesSupported, 0x00010001, 7 - -[Strings] -CompanyName = "SoftEther Corporation" -DiskDescription = "VPN Client Device Driver Install Disk" -Neo.Service.Name = "Neo_VPN110" -Neo.Service.DispName = "VPN Client Device Driver - VPN110" -Neo.Service.Desc = "VPN Client Adapter - VPN110" -NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN110" -Neo.EventLog.Name = "Neo" -NetworkAddress = "MAC Address" -DefaultAddress = "000001000001" -MaxSpeed = "Indicate Speed (Mbps)" -KeepLink = "Keep Link" -On = "On" -Off = "Off" - - -; Auto Generated 20180205_163610.806 - +; VPN Client Device Driver for Windows 2000 and Greater +; +; Copyright (c) SoftEther Corporation. All Rights Reserved. +; http://www.softether.co.jp/ +; +; BUILD 9658 + +[Version] +Signature = "$Windows NT$" +Class = Net +ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} +Provider = %CompanyName% +DriverVer = 02/04/2018, 4.25.0.9658 +CatalogFile.NT = inf_VPN110.cat + +[Manufacturer] +%CompanyName% = SoftEther, NTamd64 + +[SourceDisksNames] +1=%DiskDescription%, "", , + +[SourceDisksFiles] +Neo_VPN110.sys = 1 + +[DestinationDirs] +DefaultDestDir = 12 +Neo.CopyFiles.Sys = 12 + +[Neo.CopyFiles.Sys] +Neo_VPN110.sys, , , 2 + +[SoftEther.NTamd64] +%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN110 + +[NeoAdapter.Install] +Characteristics = 0x1 +AddReg = Neo.Reg, NeoAdapter.Ndi +CopyFiles = Neo.CopyFiles.Sys +*IfType = 53 +*MediaType = 0 +*PhysicalMediaType = 0 + +[NeoAdapter.Install.Services] +AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% + +[NeoAdapter.Ndi] +HKR, , NetworkAddress, 0, %DefaultAddress% +HKR, Ndi, DeviceID, , "NeoAdapter_VPN110" +HKR, , DevLoader, , ndis +HKR, , DeviceVxDs, , Neo_VPN110.sys +HKR, NDIS, LogDriverName, , "Neo_VPN110" +HKR, NDIS, MajorNdisVersion, 1, 5 +HKR, NDIS, MinorNdisVersion, 1, 0 +HKR, Ndi\Interfaces, DefUpper, , "ndis5" +HKR, Ndi\Interfaces, UpperRange, , "ndis5" +HKR, Ndi\Interfaces, LowerRange, , "ethernet" +HKR, Ndi\Interfaces, DefLower, , "ethernet" +HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" +HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% +HKR, Ndi\Params\NetworkAddress, type, 0, "edit" +HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" +HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" +HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% +HKR, Ndi\Params\NetworkAddress, optional, 0, "0" +HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% +HKR, Ndi\Params\MaxSpeed, type, 0, "int" +HKR, Ndi\Params\MaxSpeed, default, 0, "100" +HKR, Ndi\Params\MaxSpeed, min, 0, "0" +HKR, Ndi\Params\MaxSpeed, max, 0, "2000" +HKR, Ndi\Params\MaxSpeed, step, 0, "1" +HKR, Ndi\Params\MaxSpeed, Base, 0, "10" +HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% +HKR, Ndi\Params\KeepLink, type, 0, "enum" +HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% +HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% +HKR, Ndi\Params\KeepLink, default, 0, "0" + + +[Neo.Service] +DisplayName = %Neo.Service.DispName% +Description = %Neo.Service.Desc% +ServiceType = 1 +StartType = 3 +ErrorControl = 1 +ServiceBinary = %12%\Neo_VPN110.sys +LoadOrderGroup = NDIS + +[Neo.Reg] +HKR, Ndi, Service, 0, Neo.Service.Name +HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" +HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" + +[Neo.EventLog] +HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN110.sys" +HKR, , TypesSupported, 0x00010001, 7 + +[Strings] +CompanyName = "SoftEther Corporation" +DiskDescription = "VPN Client Device Driver Install Disk" +Neo.Service.Name = "Neo_VPN110" +Neo.Service.DispName = "VPN Client Device Driver - VPN110" +Neo.Service.Desc = "VPN Client Adapter - VPN110" +NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN110" +Neo.EventLog.Name = "Neo" +NetworkAddress = "MAC Address" +DefaultAddress = "000001000001" +MaxSpeed = "Indicate Speed (Mbps)" +KeepLink = "Keep Link" +On = "On" +Off = "Off" + + +; Auto Generated 20180205_163610.806 + diff --git a/src/bin/hamcore/DriverPackages/Neo6_Win8/x64/Neo6_x64_VPN111.inf b/src/bin/hamcore/DriverPackages/Neo6_Win8/x64/Neo6_x64_VPN111.inf index 153c7b18..58fd3feb 100644 --- a/src/bin/hamcore/DriverPackages/Neo6_Win8/x64/Neo6_x64_VPN111.inf +++ b/src/bin/hamcore/DriverPackages/Neo6_Win8/x64/Neo6_x64_VPN111.inf @@ -1,114 +1,114 @@ -; VPN Client Device Driver for Windows 2000 and Greater -; -; Copyright (c) SoftEther Corporation. All Rights Reserved. -; http://www.softether.co.jp/ -; -; BUILD 9658 - -[Version] -Signature = "$Windows NT$" -Class = Net -ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} -Provider = %CompanyName% -DriverVer = 02/04/2018, 4.25.0.9658 -CatalogFile.NT = inf_VPN111.cat - -[Manufacturer] -%CompanyName% = SoftEther, NTamd64 - -[SourceDisksNames] -1=%DiskDescription%, "", , - -[SourceDisksFiles] -Neo_VPN111.sys = 1 - -[DestinationDirs] -DefaultDestDir = 12 -Neo.CopyFiles.Sys = 12 - -[Neo.CopyFiles.Sys] -Neo_VPN111.sys, , , 2 - -[SoftEther.NTamd64] -%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN111 - -[NeoAdapter.Install] -Characteristics = 0x1 -AddReg = Neo.Reg, NeoAdapter.Ndi -CopyFiles = Neo.CopyFiles.Sys -*IfType = 53 -*MediaType = 0 -*PhysicalMediaType = 0 - -[NeoAdapter.Install.Services] -AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% - -[NeoAdapter.Ndi] -HKR, , NetworkAddress, 0, %DefaultAddress% -HKR, Ndi, DeviceID, , "NeoAdapter_VPN111" -HKR, , DevLoader, , ndis -HKR, , DeviceVxDs, , Neo_VPN111.sys -HKR, NDIS, LogDriverName, , "Neo_VPN111" -HKR, NDIS, MajorNdisVersion, 1, 5 -HKR, NDIS, MinorNdisVersion, 1, 0 -HKR, Ndi\Interfaces, DefUpper, , "ndis5" -HKR, Ndi\Interfaces, UpperRange, , "ndis5" -HKR, Ndi\Interfaces, LowerRange, , "ethernet" -HKR, Ndi\Interfaces, DefLower, , "ethernet" -HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" -HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% -HKR, Ndi\Params\NetworkAddress, type, 0, "edit" -HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" -HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" -HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% -HKR, Ndi\Params\NetworkAddress, optional, 0, "0" -HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% -HKR, Ndi\Params\MaxSpeed, type, 0, "int" -HKR, Ndi\Params\MaxSpeed, default, 0, "100" -HKR, Ndi\Params\MaxSpeed, min, 0, "0" -HKR, Ndi\Params\MaxSpeed, max, 0, "2000" -HKR, Ndi\Params\MaxSpeed, step, 0, "1" -HKR, Ndi\Params\MaxSpeed, Base, 0, "10" -HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% -HKR, Ndi\Params\KeepLink, type, 0, "enum" -HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% -HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% -HKR, Ndi\Params\KeepLink, default, 0, "0" - - -[Neo.Service] -DisplayName = %Neo.Service.DispName% -Description = %Neo.Service.Desc% -ServiceType = 1 -StartType = 3 -ErrorControl = 1 -ServiceBinary = %12%\Neo_VPN111.sys -LoadOrderGroup = NDIS - -[Neo.Reg] -HKR, Ndi, Service, 0, Neo.Service.Name -HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" -HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" - -[Neo.EventLog] -HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN111.sys" -HKR, , TypesSupported, 0x00010001, 7 - -[Strings] -CompanyName = "SoftEther Corporation" -DiskDescription = "VPN Client Device Driver Install Disk" -Neo.Service.Name = "Neo_VPN111" -Neo.Service.DispName = "VPN Client Device Driver - VPN111" -Neo.Service.Desc = "VPN Client Adapter - VPN111" -NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN111" -Neo.EventLog.Name = "Neo" -NetworkAddress = "MAC Address" -DefaultAddress = "000001000001" -MaxSpeed = "Indicate Speed (Mbps)" -KeepLink = "Keep Link" -On = "On" -Off = "Off" - - -; Auto Generated 20180205_163610.807 - +; VPN Client Device Driver for Windows 2000 and Greater +; +; Copyright (c) SoftEther Corporation. All Rights Reserved. +; http://www.softether.co.jp/ +; +; BUILD 9658 + +[Version] +Signature = "$Windows NT$" +Class = Net +ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} +Provider = %CompanyName% +DriverVer = 02/04/2018, 4.25.0.9658 +CatalogFile.NT = inf_VPN111.cat + +[Manufacturer] +%CompanyName% = SoftEther, NTamd64 + +[SourceDisksNames] +1=%DiskDescription%, "", , + +[SourceDisksFiles] +Neo_VPN111.sys = 1 + +[DestinationDirs] +DefaultDestDir = 12 +Neo.CopyFiles.Sys = 12 + +[Neo.CopyFiles.Sys] +Neo_VPN111.sys, , , 2 + +[SoftEther.NTamd64] +%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN111 + +[NeoAdapter.Install] +Characteristics = 0x1 +AddReg = Neo.Reg, NeoAdapter.Ndi +CopyFiles = Neo.CopyFiles.Sys +*IfType = 53 +*MediaType = 0 +*PhysicalMediaType = 0 + +[NeoAdapter.Install.Services] +AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% + +[NeoAdapter.Ndi] +HKR, , NetworkAddress, 0, %DefaultAddress% +HKR, Ndi, DeviceID, , "NeoAdapter_VPN111" +HKR, , DevLoader, , ndis +HKR, , DeviceVxDs, , Neo_VPN111.sys +HKR, NDIS, LogDriverName, , "Neo_VPN111" +HKR, NDIS, MajorNdisVersion, 1, 5 +HKR, NDIS, MinorNdisVersion, 1, 0 +HKR, Ndi\Interfaces, DefUpper, , "ndis5" +HKR, Ndi\Interfaces, UpperRange, , "ndis5" +HKR, Ndi\Interfaces, LowerRange, , "ethernet" +HKR, Ndi\Interfaces, DefLower, , "ethernet" +HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" +HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% +HKR, Ndi\Params\NetworkAddress, type, 0, "edit" +HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" +HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" +HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% +HKR, Ndi\Params\NetworkAddress, optional, 0, "0" +HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% +HKR, Ndi\Params\MaxSpeed, type, 0, "int" +HKR, Ndi\Params\MaxSpeed, default, 0, "100" +HKR, Ndi\Params\MaxSpeed, min, 0, "0" +HKR, Ndi\Params\MaxSpeed, max, 0, "2000" +HKR, Ndi\Params\MaxSpeed, step, 0, "1" +HKR, Ndi\Params\MaxSpeed, Base, 0, "10" +HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% +HKR, Ndi\Params\KeepLink, type, 0, "enum" +HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% +HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% +HKR, Ndi\Params\KeepLink, default, 0, "0" + + +[Neo.Service] +DisplayName = %Neo.Service.DispName% +Description = %Neo.Service.Desc% +ServiceType = 1 +StartType = 3 +ErrorControl = 1 +ServiceBinary = %12%\Neo_VPN111.sys +LoadOrderGroup = NDIS + +[Neo.Reg] +HKR, Ndi, Service, 0, Neo.Service.Name +HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" +HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" + +[Neo.EventLog] +HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN111.sys" +HKR, , TypesSupported, 0x00010001, 7 + +[Strings] +CompanyName = "SoftEther Corporation" +DiskDescription = "VPN Client Device Driver Install Disk" +Neo.Service.Name = "Neo_VPN111" +Neo.Service.DispName = "VPN Client Device Driver - VPN111" +Neo.Service.Desc = "VPN Client Adapter - VPN111" +NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN111" +Neo.EventLog.Name = "Neo" +NetworkAddress = "MAC Address" +DefaultAddress = "000001000001" +MaxSpeed = "Indicate Speed (Mbps)" +KeepLink = "Keep Link" +On = "On" +Off = "Off" + + +; Auto Generated 20180205_163610.807 + diff --git a/src/bin/hamcore/DriverPackages/Neo6_Win8/x64/Neo6_x64_VPN112.inf b/src/bin/hamcore/DriverPackages/Neo6_Win8/x64/Neo6_x64_VPN112.inf index 289273d7..7b2d17b2 100644 --- a/src/bin/hamcore/DriverPackages/Neo6_Win8/x64/Neo6_x64_VPN112.inf +++ b/src/bin/hamcore/DriverPackages/Neo6_Win8/x64/Neo6_x64_VPN112.inf @@ -1,114 +1,114 @@ -; VPN Client Device Driver for Windows 2000 and Greater -; -; Copyright (c) SoftEther Corporation. All Rights Reserved. -; http://www.softether.co.jp/ -; -; BUILD 9658 - -[Version] -Signature = "$Windows NT$" -Class = Net -ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} -Provider = %CompanyName% -DriverVer = 02/04/2018, 4.25.0.9658 -CatalogFile.NT = inf_VPN112.cat - -[Manufacturer] -%CompanyName% = SoftEther, NTamd64 - -[SourceDisksNames] -1=%DiskDescription%, "", , - -[SourceDisksFiles] -Neo_VPN112.sys = 1 - -[DestinationDirs] -DefaultDestDir = 12 -Neo.CopyFiles.Sys = 12 - -[Neo.CopyFiles.Sys] -Neo_VPN112.sys, , , 2 - -[SoftEther.NTamd64] -%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN112 - -[NeoAdapter.Install] -Characteristics = 0x1 -AddReg = Neo.Reg, NeoAdapter.Ndi -CopyFiles = Neo.CopyFiles.Sys -*IfType = 53 -*MediaType = 0 -*PhysicalMediaType = 0 - -[NeoAdapter.Install.Services] -AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% - -[NeoAdapter.Ndi] -HKR, , NetworkAddress, 0, %DefaultAddress% -HKR, Ndi, DeviceID, , "NeoAdapter_VPN112" -HKR, , DevLoader, , ndis -HKR, , DeviceVxDs, , Neo_VPN112.sys -HKR, NDIS, LogDriverName, , "Neo_VPN112" -HKR, NDIS, MajorNdisVersion, 1, 5 -HKR, NDIS, MinorNdisVersion, 1, 0 -HKR, Ndi\Interfaces, DefUpper, , "ndis5" -HKR, Ndi\Interfaces, UpperRange, , "ndis5" -HKR, Ndi\Interfaces, LowerRange, , "ethernet" -HKR, Ndi\Interfaces, DefLower, , "ethernet" -HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" -HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% -HKR, Ndi\Params\NetworkAddress, type, 0, "edit" -HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" -HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" -HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% -HKR, Ndi\Params\NetworkAddress, optional, 0, "0" -HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% -HKR, Ndi\Params\MaxSpeed, type, 0, "int" -HKR, Ndi\Params\MaxSpeed, default, 0, "100" -HKR, Ndi\Params\MaxSpeed, min, 0, "0" -HKR, Ndi\Params\MaxSpeed, max, 0, "2000" -HKR, Ndi\Params\MaxSpeed, step, 0, "1" -HKR, Ndi\Params\MaxSpeed, Base, 0, "10" -HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% -HKR, Ndi\Params\KeepLink, type, 0, "enum" -HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% -HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% -HKR, Ndi\Params\KeepLink, default, 0, "0" - - -[Neo.Service] -DisplayName = %Neo.Service.DispName% -Description = %Neo.Service.Desc% -ServiceType = 1 -StartType = 3 -ErrorControl = 1 -ServiceBinary = %12%\Neo_VPN112.sys -LoadOrderGroup = NDIS - -[Neo.Reg] -HKR, Ndi, Service, 0, Neo.Service.Name -HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" -HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" - -[Neo.EventLog] -HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN112.sys" -HKR, , TypesSupported, 0x00010001, 7 - -[Strings] -CompanyName = "SoftEther Corporation" -DiskDescription = "VPN Client Device Driver Install Disk" -Neo.Service.Name = "Neo_VPN112" -Neo.Service.DispName = "VPN Client Device Driver - VPN112" -Neo.Service.Desc = "VPN Client Adapter - VPN112" -NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN112" -Neo.EventLog.Name = "Neo" -NetworkAddress = "MAC Address" -DefaultAddress = "000001000001" -MaxSpeed = "Indicate Speed (Mbps)" -KeepLink = "Keep Link" -On = "On" -Off = "Off" - - -; Auto Generated 20180205_163610.808 - +; VPN Client Device Driver for Windows 2000 and Greater +; +; Copyright (c) SoftEther Corporation. All Rights Reserved. +; http://www.softether.co.jp/ +; +; BUILD 9658 + +[Version] +Signature = "$Windows NT$" +Class = Net +ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} +Provider = %CompanyName% +DriverVer = 02/04/2018, 4.25.0.9658 +CatalogFile.NT = inf_VPN112.cat + +[Manufacturer] +%CompanyName% = SoftEther, NTamd64 + +[SourceDisksNames] +1=%DiskDescription%, "", , + +[SourceDisksFiles] +Neo_VPN112.sys = 1 + +[DestinationDirs] +DefaultDestDir = 12 +Neo.CopyFiles.Sys = 12 + +[Neo.CopyFiles.Sys] +Neo_VPN112.sys, , , 2 + +[SoftEther.NTamd64] +%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN112 + +[NeoAdapter.Install] +Characteristics = 0x1 +AddReg = Neo.Reg, NeoAdapter.Ndi +CopyFiles = Neo.CopyFiles.Sys +*IfType = 53 +*MediaType = 0 +*PhysicalMediaType = 0 + +[NeoAdapter.Install.Services] +AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% + +[NeoAdapter.Ndi] +HKR, , NetworkAddress, 0, %DefaultAddress% +HKR, Ndi, DeviceID, , "NeoAdapter_VPN112" +HKR, , DevLoader, , ndis +HKR, , DeviceVxDs, , Neo_VPN112.sys +HKR, NDIS, LogDriverName, , "Neo_VPN112" +HKR, NDIS, MajorNdisVersion, 1, 5 +HKR, NDIS, MinorNdisVersion, 1, 0 +HKR, Ndi\Interfaces, DefUpper, , "ndis5" +HKR, Ndi\Interfaces, UpperRange, , "ndis5" +HKR, Ndi\Interfaces, LowerRange, , "ethernet" +HKR, Ndi\Interfaces, DefLower, , "ethernet" +HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" +HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% +HKR, Ndi\Params\NetworkAddress, type, 0, "edit" +HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" +HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" +HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% +HKR, Ndi\Params\NetworkAddress, optional, 0, "0" +HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% +HKR, Ndi\Params\MaxSpeed, type, 0, "int" +HKR, Ndi\Params\MaxSpeed, default, 0, "100" +HKR, Ndi\Params\MaxSpeed, min, 0, "0" +HKR, Ndi\Params\MaxSpeed, max, 0, "2000" +HKR, Ndi\Params\MaxSpeed, step, 0, "1" +HKR, Ndi\Params\MaxSpeed, Base, 0, "10" +HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% +HKR, Ndi\Params\KeepLink, type, 0, "enum" +HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% +HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% +HKR, Ndi\Params\KeepLink, default, 0, "0" + + +[Neo.Service] +DisplayName = %Neo.Service.DispName% +Description = %Neo.Service.Desc% +ServiceType = 1 +StartType = 3 +ErrorControl = 1 +ServiceBinary = %12%\Neo_VPN112.sys +LoadOrderGroup = NDIS + +[Neo.Reg] +HKR, Ndi, Service, 0, Neo.Service.Name +HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" +HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" + +[Neo.EventLog] +HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN112.sys" +HKR, , TypesSupported, 0x00010001, 7 + +[Strings] +CompanyName = "SoftEther Corporation" +DiskDescription = "VPN Client Device Driver Install Disk" +Neo.Service.Name = "Neo_VPN112" +Neo.Service.DispName = "VPN Client Device Driver - VPN112" +Neo.Service.Desc = "VPN Client Adapter - VPN112" +NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN112" +Neo.EventLog.Name = "Neo" +NetworkAddress = "MAC Address" +DefaultAddress = "000001000001" +MaxSpeed = "Indicate Speed (Mbps)" +KeepLink = "Keep Link" +On = "On" +Off = "Off" + + +; Auto Generated 20180205_163610.808 + diff --git a/src/bin/hamcore/DriverPackages/Neo6_Win8/x64/Neo6_x64_VPN113.inf b/src/bin/hamcore/DriverPackages/Neo6_Win8/x64/Neo6_x64_VPN113.inf index f97181cc..1b161fbc 100644 --- a/src/bin/hamcore/DriverPackages/Neo6_Win8/x64/Neo6_x64_VPN113.inf +++ b/src/bin/hamcore/DriverPackages/Neo6_Win8/x64/Neo6_x64_VPN113.inf @@ -1,114 +1,114 @@ -; VPN Client Device Driver for Windows 2000 and Greater -; -; Copyright (c) SoftEther Corporation. All Rights Reserved. -; http://www.softether.co.jp/ -; -; BUILD 9658 - -[Version] -Signature = "$Windows NT$" -Class = Net -ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} -Provider = %CompanyName% -DriverVer = 02/04/2018, 4.25.0.9658 -CatalogFile.NT = inf_VPN113.cat - -[Manufacturer] -%CompanyName% = SoftEther, NTamd64 - -[SourceDisksNames] -1=%DiskDescription%, "", , - -[SourceDisksFiles] -Neo_VPN113.sys = 1 - -[DestinationDirs] -DefaultDestDir = 12 -Neo.CopyFiles.Sys = 12 - -[Neo.CopyFiles.Sys] -Neo_VPN113.sys, , , 2 - -[SoftEther.NTamd64] -%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN113 - -[NeoAdapter.Install] -Characteristics = 0x1 -AddReg = Neo.Reg, NeoAdapter.Ndi -CopyFiles = Neo.CopyFiles.Sys -*IfType = 53 -*MediaType = 0 -*PhysicalMediaType = 0 - -[NeoAdapter.Install.Services] -AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% - -[NeoAdapter.Ndi] -HKR, , NetworkAddress, 0, %DefaultAddress% -HKR, Ndi, DeviceID, , "NeoAdapter_VPN113" -HKR, , DevLoader, , ndis -HKR, , DeviceVxDs, , Neo_VPN113.sys -HKR, NDIS, LogDriverName, , "Neo_VPN113" -HKR, NDIS, MajorNdisVersion, 1, 5 -HKR, NDIS, MinorNdisVersion, 1, 0 -HKR, Ndi\Interfaces, DefUpper, , "ndis5" -HKR, Ndi\Interfaces, UpperRange, , "ndis5" -HKR, Ndi\Interfaces, LowerRange, , "ethernet" -HKR, Ndi\Interfaces, DefLower, , "ethernet" -HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" -HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% -HKR, Ndi\Params\NetworkAddress, type, 0, "edit" -HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" -HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" -HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% -HKR, Ndi\Params\NetworkAddress, optional, 0, "0" -HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% -HKR, Ndi\Params\MaxSpeed, type, 0, "int" -HKR, Ndi\Params\MaxSpeed, default, 0, "100" -HKR, Ndi\Params\MaxSpeed, min, 0, "0" -HKR, Ndi\Params\MaxSpeed, max, 0, "2000" -HKR, Ndi\Params\MaxSpeed, step, 0, "1" -HKR, Ndi\Params\MaxSpeed, Base, 0, "10" -HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% -HKR, Ndi\Params\KeepLink, type, 0, "enum" -HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% -HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% -HKR, Ndi\Params\KeepLink, default, 0, "0" - - -[Neo.Service] -DisplayName = %Neo.Service.DispName% -Description = %Neo.Service.Desc% -ServiceType = 1 -StartType = 3 -ErrorControl = 1 -ServiceBinary = %12%\Neo_VPN113.sys -LoadOrderGroup = NDIS - -[Neo.Reg] -HKR, Ndi, Service, 0, Neo.Service.Name -HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" -HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" - -[Neo.EventLog] -HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN113.sys" -HKR, , TypesSupported, 0x00010001, 7 - -[Strings] -CompanyName = "SoftEther Corporation" -DiskDescription = "VPN Client Device Driver Install Disk" -Neo.Service.Name = "Neo_VPN113" -Neo.Service.DispName = "VPN Client Device Driver - VPN113" -Neo.Service.Desc = "VPN Client Adapter - VPN113" -NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN113" -Neo.EventLog.Name = "Neo" -NetworkAddress = "MAC Address" -DefaultAddress = "000001000001" -MaxSpeed = "Indicate Speed (Mbps)" -KeepLink = "Keep Link" -On = "On" -Off = "Off" - - -; Auto Generated 20180205_163610.808 - +; VPN Client Device Driver for Windows 2000 and Greater +; +; Copyright (c) SoftEther Corporation. All Rights Reserved. +; http://www.softether.co.jp/ +; +; BUILD 9658 + +[Version] +Signature = "$Windows NT$" +Class = Net +ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} +Provider = %CompanyName% +DriverVer = 02/04/2018, 4.25.0.9658 +CatalogFile.NT = inf_VPN113.cat + +[Manufacturer] +%CompanyName% = SoftEther, NTamd64 + +[SourceDisksNames] +1=%DiskDescription%, "", , + +[SourceDisksFiles] +Neo_VPN113.sys = 1 + +[DestinationDirs] +DefaultDestDir = 12 +Neo.CopyFiles.Sys = 12 + +[Neo.CopyFiles.Sys] +Neo_VPN113.sys, , , 2 + +[SoftEther.NTamd64] +%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN113 + +[NeoAdapter.Install] +Characteristics = 0x1 +AddReg = Neo.Reg, NeoAdapter.Ndi +CopyFiles = Neo.CopyFiles.Sys +*IfType = 53 +*MediaType = 0 +*PhysicalMediaType = 0 + +[NeoAdapter.Install.Services] +AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% + +[NeoAdapter.Ndi] +HKR, , NetworkAddress, 0, %DefaultAddress% +HKR, Ndi, DeviceID, , "NeoAdapter_VPN113" +HKR, , DevLoader, , ndis +HKR, , DeviceVxDs, , Neo_VPN113.sys +HKR, NDIS, LogDriverName, , "Neo_VPN113" +HKR, NDIS, MajorNdisVersion, 1, 5 +HKR, NDIS, MinorNdisVersion, 1, 0 +HKR, Ndi\Interfaces, DefUpper, , "ndis5" +HKR, Ndi\Interfaces, UpperRange, , "ndis5" +HKR, Ndi\Interfaces, LowerRange, , "ethernet" +HKR, Ndi\Interfaces, DefLower, , "ethernet" +HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" +HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% +HKR, Ndi\Params\NetworkAddress, type, 0, "edit" +HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" +HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" +HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% +HKR, Ndi\Params\NetworkAddress, optional, 0, "0" +HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% +HKR, Ndi\Params\MaxSpeed, type, 0, "int" +HKR, Ndi\Params\MaxSpeed, default, 0, "100" +HKR, Ndi\Params\MaxSpeed, min, 0, "0" +HKR, Ndi\Params\MaxSpeed, max, 0, "2000" +HKR, Ndi\Params\MaxSpeed, step, 0, "1" +HKR, Ndi\Params\MaxSpeed, Base, 0, "10" +HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% +HKR, Ndi\Params\KeepLink, type, 0, "enum" +HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% +HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% +HKR, Ndi\Params\KeepLink, default, 0, "0" + + +[Neo.Service] +DisplayName = %Neo.Service.DispName% +Description = %Neo.Service.Desc% +ServiceType = 1 +StartType = 3 +ErrorControl = 1 +ServiceBinary = %12%\Neo_VPN113.sys +LoadOrderGroup = NDIS + +[Neo.Reg] +HKR, Ndi, Service, 0, Neo.Service.Name +HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" +HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" + +[Neo.EventLog] +HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN113.sys" +HKR, , TypesSupported, 0x00010001, 7 + +[Strings] +CompanyName = "SoftEther Corporation" +DiskDescription = "VPN Client Device Driver Install Disk" +Neo.Service.Name = "Neo_VPN113" +Neo.Service.DispName = "VPN Client Device Driver - VPN113" +Neo.Service.Desc = "VPN Client Adapter - VPN113" +NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN113" +Neo.EventLog.Name = "Neo" +NetworkAddress = "MAC Address" +DefaultAddress = "000001000001" +MaxSpeed = "Indicate Speed (Mbps)" +KeepLink = "Keep Link" +On = "On" +Off = "Off" + + +; Auto Generated 20180205_163610.808 + diff --git a/src/bin/hamcore/DriverPackages/Neo6_Win8/x64/Neo6_x64_VPN114.inf b/src/bin/hamcore/DriverPackages/Neo6_Win8/x64/Neo6_x64_VPN114.inf index 79dbfd93..125f3105 100644 --- a/src/bin/hamcore/DriverPackages/Neo6_Win8/x64/Neo6_x64_VPN114.inf +++ b/src/bin/hamcore/DriverPackages/Neo6_Win8/x64/Neo6_x64_VPN114.inf @@ -1,114 +1,114 @@ -; VPN Client Device Driver for Windows 2000 and Greater -; -; Copyright (c) SoftEther Corporation. All Rights Reserved. -; http://www.softether.co.jp/ -; -; BUILD 9658 - -[Version] -Signature = "$Windows NT$" -Class = Net -ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} -Provider = %CompanyName% -DriverVer = 02/04/2018, 4.25.0.9658 -CatalogFile.NT = inf_VPN114.cat - -[Manufacturer] -%CompanyName% = SoftEther, NTamd64 - -[SourceDisksNames] -1=%DiskDescription%, "", , - -[SourceDisksFiles] -Neo_VPN114.sys = 1 - -[DestinationDirs] -DefaultDestDir = 12 -Neo.CopyFiles.Sys = 12 - -[Neo.CopyFiles.Sys] -Neo_VPN114.sys, , , 2 - -[SoftEther.NTamd64] -%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN114 - -[NeoAdapter.Install] -Characteristics = 0x1 -AddReg = Neo.Reg, NeoAdapter.Ndi -CopyFiles = Neo.CopyFiles.Sys -*IfType = 53 -*MediaType = 0 -*PhysicalMediaType = 0 - -[NeoAdapter.Install.Services] -AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% - -[NeoAdapter.Ndi] -HKR, , NetworkAddress, 0, %DefaultAddress% -HKR, Ndi, DeviceID, , "NeoAdapter_VPN114" -HKR, , DevLoader, , ndis -HKR, , DeviceVxDs, , Neo_VPN114.sys -HKR, NDIS, LogDriverName, , "Neo_VPN114" -HKR, NDIS, MajorNdisVersion, 1, 5 -HKR, NDIS, MinorNdisVersion, 1, 0 -HKR, Ndi\Interfaces, DefUpper, , "ndis5" -HKR, Ndi\Interfaces, UpperRange, , "ndis5" -HKR, Ndi\Interfaces, LowerRange, , "ethernet" -HKR, Ndi\Interfaces, DefLower, , "ethernet" -HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" -HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% -HKR, Ndi\Params\NetworkAddress, type, 0, "edit" -HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" -HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" -HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% -HKR, Ndi\Params\NetworkAddress, optional, 0, "0" -HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% -HKR, Ndi\Params\MaxSpeed, type, 0, "int" -HKR, Ndi\Params\MaxSpeed, default, 0, "100" -HKR, Ndi\Params\MaxSpeed, min, 0, "0" -HKR, Ndi\Params\MaxSpeed, max, 0, "2000" -HKR, Ndi\Params\MaxSpeed, step, 0, "1" -HKR, Ndi\Params\MaxSpeed, Base, 0, "10" -HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% -HKR, Ndi\Params\KeepLink, type, 0, "enum" -HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% -HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% -HKR, Ndi\Params\KeepLink, default, 0, "0" - - -[Neo.Service] -DisplayName = %Neo.Service.DispName% -Description = %Neo.Service.Desc% -ServiceType = 1 -StartType = 3 -ErrorControl = 1 -ServiceBinary = %12%\Neo_VPN114.sys -LoadOrderGroup = NDIS - -[Neo.Reg] -HKR, Ndi, Service, 0, Neo.Service.Name -HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" -HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" - -[Neo.EventLog] -HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN114.sys" -HKR, , TypesSupported, 0x00010001, 7 - -[Strings] -CompanyName = "SoftEther Corporation" -DiskDescription = "VPN Client Device Driver Install Disk" -Neo.Service.Name = "Neo_VPN114" -Neo.Service.DispName = "VPN Client Device Driver - VPN114" -Neo.Service.Desc = "VPN Client Adapter - VPN114" -NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN114" -Neo.EventLog.Name = "Neo" -NetworkAddress = "MAC Address" -DefaultAddress = "000001000001" -MaxSpeed = "Indicate Speed (Mbps)" -KeepLink = "Keep Link" -On = "On" -Off = "Off" - - -; Auto Generated 20180205_163610.809 - +; VPN Client Device Driver for Windows 2000 and Greater +; +; Copyright (c) SoftEther Corporation. All Rights Reserved. +; http://www.softether.co.jp/ +; +; BUILD 9658 + +[Version] +Signature = "$Windows NT$" +Class = Net +ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} +Provider = %CompanyName% +DriverVer = 02/04/2018, 4.25.0.9658 +CatalogFile.NT = inf_VPN114.cat + +[Manufacturer] +%CompanyName% = SoftEther, NTamd64 + +[SourceDisksNames] +1=%DiskDescription%, "", , + +[SourceDisksFiles] +Neo_VPN114.sys = 1 + +[DestinationDirs] +DefaultDestDir = 12 +Neo.CopyFiles.Sys = 12 + +[Neo.CopyFiles.Sys] +Neo_VPN114.sys, , , 2 + +[SoftEther.NTamd64] +%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN114 + +[NeoAdapter.Install] +Characteristics = 0x1 +AddReg = Neo.Reg, NeoAdapter.Ndi +CopyFiles = Neo.CopyFiles.Sys +*IfType = 53 +*MediaType = 0 +*PhysicalMediaType = 0 + +[NeoAdapter.Install.Services] +AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% + +[NeoAdapter.Ndi] +HKR, , NetworkAddress, 0, %DefaultAddress% +HKR, Ndi, DeviceID, , "NeoAdapter_VPN114" +HKR, , DevLoader, , ndis +HKR, , DeviceVxDs, , Neo_VPN114.sys +HKR, NDIS, LogDriverName, , "Neo_VPN114" +HKR, NDIS, MajorNdisVersion, 1, 5 +HKR, NDIS, MinorNdisVersion, 1, 0 +HKR, Ndi\Interfaces, DefUpper, , "ndis5" +HKR, Ndi\Interfaces, UpperRange, , "ndis5" +HKR, Ndi\Interfaces, LowerRange, , "ethernet" +HKR, Ndi\Interfaces, DefLower, , "ethernet" +HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" +HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% +HKR, Ndi\Params\NetworkAddress, type, 0, "edit" +HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" +HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" +HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% +HKR, Ndi\Params\NetworkAddress, optional, 0, "0" +HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% +HKR, Ndi\Params\MaxSpeed, type, 0, "int" +HKR, Ndi\Params\MaxSpeed, default, 0, "100" +HKR, Ndi\Params\MaxSpeed, min, 0, "0" +HKR, Ndi\Params\MaxSpeed, max, 0, "2000" +HKR, Ndi\Params\MaxSpeed, step, 0, "1" +HKR, Ndi\Params\MaxSpeed, Base, 0, "10" +HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% +HKR, Ndi\Params\KeepLink, type, 0, "enum" +HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% +HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% +HKR, Ndi\Params\KeepLink, default, 0, "0" + + +[Neo.Service] +DisplayName = %Neo.Service.DispName% +Description = %Neo.Service.Desc% +ServiceType = 1 +StartType = 3 +ErrorControl = 1 +ServiceBinary = %12%\Neo_VPN114.sys +LoadOrderGroup = NDIS + +[Neo.Reg] +HKR, Ndi, Service, 0, Neo.Service.Name +HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" +HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" + +[Neo.EventLog] +HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN114.sys" +HKR, , TypesSupported, 0x00010001, 7 + +[Strings] +CompanyName = "SoftEther Corporation" +DiskDescription = "VPN Client Device Driver Install Disk" +Neo.Service.Name = "Neo_VPN114" +Neo.Service.DispName = "VPN Client Device Driver - VPN114" +Neo.Service.Desc = "VPN Client Adapter - VPN114" +NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN114" +Neo.EventLog.Name = "Neo" +NetworkAddress = "MAC Address" +DefaultAddress = "000001000001" +MaxSpeed = "Indicate Speed (Mbps)" +KeepLink = "Keep Link" +On = "On" +Off = "Off" + + +; Auto Generated 20180205_163610.809 + diff --git a/src/bin/hamcore/DriverPackages/Neo6_Win8/x64/Neo6_x64_VPN115.inf b/src/bin/hamcore/DriverPackages/Neo6_Win8/x64/Neo6_x64_VPN115.inf index 324698ab..6d7e58cf 100644 --- a/src/bin/hamcore/DriverPackages/Neo6_Win8/x64/Neo6_x64_VPN115.inf +++ b/src/bin/hamcore/DriverPackages/Neo6_Win8/x64/Neo6_x64_VPN115.inf @@ -1,114 +1,114 @@ -; VPN Client Device Driver for Windows 2000 and Greater -; -; Copyright (c) SoftEther Corporation. All Rights Reserved. -; http://www.softether.co.jp/ -; -; BUILD 9658 - -[Version] -Signature = "$Windows NT$" -Class = Net -ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} -Provider = %CompanyName% -DriverVer = 02/04/2018, 4.25.0.9658 -CatalogFile.NT = inf_VPN115.cat - -[Manufacturer] -%CompanyName% = SoftEther, NTamd64 - -[SourceDisksNames] -1=%DiskDescription%, "", , - -[SourceDisksFiles] -Neo_VPN115.sys = 1 - -[DestinationDirs] -DefaultDestDir = 12 -Neo.CopyFiles.Sys = 12 - -[Neo.CopyFiles.Sys] -Neo_VPN115.sys, , , 2 - -[SoftEther.NTamd64] -%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN115 - -[NeoAdapter.Install] -Characteristics = 0x1 -AddReg = Neo.Reg, NeoAdapter.Ndi -CopyFiles = Neo.CopyFiles.Sys -*IfType = 53 -*MediaType = 0 -*PhysicalMediaType = 0 - -[NeoAdapter.Install.Services] -AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% - -[NeoAdapter.Ndi] -HKR, , NetworkAddress, 0, %DefaultAddress% -HKR, Ndi, DeviceID, , "NeoAdapter_VPN115" -HKR, , DevLoader, , ndis -HKR, , DeviceVxDs, , Neo_VPN115.sys -HKR, NDIS, LogDriverName, , "Neo_VPN115" -HKR, NDIS, MajorNdisVersion, 1, 5 -HKR, NDIS, MinorNdisVersion, 1, 0 -HKR, Ndi\Interfaces, DefUpper, , "ndis5" -HKR, Ndi\Interfaces, UpperRange, , "ndis5" -HKR, Ndi\Interfaces, LowerRange, , "ethernet" -HKR, Ndi\Interfaces, DefLower, , "ethernet" -HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" -HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% -HKR, Ndi\Params\NetworkAddress, type, 0, "edit" -HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" -HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" -HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% -HKR, Ndi\Params\NetworkAddress, optional, 0, "0" -HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% -HKR, Ndi\Params\MaxSpeed, type, 0, "int" -HKR, Ndi\Params\MaxSpeed, default, 0, "100" -HKR, Ndi\Params\MaxSpeed, min, 0, "0" -HKR, Ndi\Params\MaxSpeed, max, 0, "2000" -HKR, Ndi\Params\MaxSpeed, step, 0, "1" -HKR, Ndi\Params\MaxSpeed, Base, 0, "10" -HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% -HKR, Ndi\Params\KeepLink, type, 0, "enum" -HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% -HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% -HKR, Ndi\Params\KeepLink, default, 0, "0" - - -[Neo.Service] -DisplayName = %Neo.Service.DispName% -Description = %Neo.Service.Desc% -ServiceType = 1 -StartType = 3 -ErrorControl = 1 -ServiceBinary = %12%\Neo_VPN115.sys -LoadOrderGroup = NDIS - -[Neo.Reg] -HKR, Ndi, Service, 0, Neo.Service.Name -HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" -HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" - -[Neo.EventLog] -HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN115.sys" -HKR, , TypesSupported, 0x00010001, 7 - -[Strings] -CompanyName = "SoftEther Corporation" -DiskDescription = "VPN Client Device Driver Install Disk" -Neo.Service.Name = "Neo_VPN115" -Neo.Service.DispName = "VPN Client Device Driver - VPN115" -Neo.Service.Desc = "VPN Client Adapter - VPN115" -NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN115" -Neo.EventLog.Name = "Neo" -NetworkAddress = "MAC Address" -DefaultAddress = "000001000001" -MaxSpeed = "Indicate Speed (Mbps)" -KeepLink = "Keep Link" -On = "On" -Off = "Off" - - -; Auto Generated 20180205_163610.810 - +; VPN Client Device Driver for Windows 2000 and Greater +; +; Copyright (c) SoftEther Corporation. All Rights Reserved. +; http://www.softether.co.jp/ +; +; BUILD 9658 + +[Version] +Signature = "$Windows NT$" +Class = Net +ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} +Provider = %CompanyName% +DriverVer = 02/04/2018, 4.25.0.9658 +CatalogFile.NT = inf_VPN115.cat + +[Manufacturer] +%CompanyName% = SoftEther, NTamd64 + +[SourceDisksNames] +1=%DiskDescription%, "", , + +[SourceDisksFiles] +Neo_VPN115.sys = 1 + +[DestinationDirs] +DefaultDestDir = 12 +Neo.CopyFiles.Sys = 12 + +[Neo.CopyFiles.Sys] +Neo_VPN115.sys, , , 2 + +[SoftEther.NTamd64] +%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN115 + +[NeoAdapter.Install] +Characteristics = 0x1 +AddReg = Neo.Reg, NeoAdapter.Ndi +CopyFiles = Neo.CopyFiles.Sys +*IfType = 53 +*MediaType = 0 +*PhysicalMediaType = 0 + +[NeoAdapter.Install.Services] +AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% + +[NeoAdapter.Ndi] +HKR, , NetworkAddress, 0, %DefaultAddress% +HKR, Ndi, DeviceID, , "NeoAdapter_VPN115" +HKR, , DevLoader, , ndis +HKR, , DeviceVxDs, , Neo_VPN115.sys +HKR, NDIS, LogDriverName, , "Neo_VPN115" +HKR, NDIS, MajorNdisVersion, 1, 5 +HKR, NDIS, MinorNdisVersion, 1, 0 +HKR, Ndi\Interfaces, DefUpper, , "ndis5" +HKR, Ndi\Interfaces, UpperRange, , "ndis5" +HKR, Ndi\Interfaces, LowerRange, , "ethernet" +HKR, Ndi\Interfaces, DefLower, , "ethernet" +HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" +HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% +HKR, Ndi\Params\NetworkAddress, type, 0, "edit" +HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" +HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" +HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% +HKR, Ndi\Params\NetworkAddress, optional, 0, "0" +HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% +HKR, Ndi\Params\MaxSpeed, type, 0, "int" +HKR, Ndi\Params\MaxSpeed, default, 0, "100" +HKR, Ndi\Params\MaxSpeed, min, 0, "0" +HKR, Ndi\Params\MaxSpeed, max, 0, "2000" +HKR, Ndi\Params\MaxSpeed, step, 0, "1" +HKR, Ndi\Params\MaxSpeed, Base, 0, "10" +HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% +HKR, Ndi\Params\KeepLink, type, 0, "enum" +HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% +HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% +HKR, Ndi\Params\KeepLink, default, 0, "0" + + +[Neo.Service] +DisplayName = %Neo.Service.DispName% +Description = %Neo.Service.Desc% +ServiceType = 1 +StartType = 3 +ErrorControl = 1 +ServiceBinary = %12%\Neo_VPN115.sys +LoadOrderGroup = NDIS + +[Neo.Reg] +HKR, Ndi, Service, 0, Neo.Service.Name +HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" +HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" + +[Neo.EventLog] +HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN115.sys" +HKR, , TypesSupported, 0x00010001, 7 + +[Strings] +CompanyName = "SoftEther Corporation" +DiskDescription = "VPN Client Device Driver Install Disk" +Neo.Service.Name = "Neo_VPN115" +Neo.Service.DispName = "VPN Client Device Driver - VPN115" +Neo.Service.Desc = "VPN Client Adapter - VPN115" +NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN115" +Neo.EventLog.Name = "Neo" +NetworkAddress = "MAC Address" +DefaultAddress = "000001000001" +MaxSpeed = "Indicate Speed (Mbps)" +KeepLink = "Keep Link" +On = "On" +Off = "Off" + + +; Auto Generated 20180205_163610.810 + diff --git a/src/bin/hamcore/DriverPackages/Neo6_Win8/x64/Neo6_x64_VPN116.inf b/src/bin/hamcore/DriverPackages/Neo6_Win8/x64/Neo6_x64_VPN116.inf index 5903e06d..7f945aef 100644 --- a/src/bin/hamcore/DriverPackages/Neo6_Win8/x64/Neo6_x64_VPN116.inf +++ b/src/bin/hamcore/DriverPackages/Neo6_Win8/x64/Neo6_x64_VPN116.inf @@ -1,114 +1,114 @@ -; VPN Client Device Driver for Windows 2000 and Greater -; -; Copyright (c) SoftEther Corporation. All Rights Reserved. -; http://www.softether.co.jp/ -; -; BUILD 9658 - -[Version] -Signature = "$Windows NT$" -Class = Net -ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} -Provider = %CompanyName% -DriverVer = 02/04/2018, 4.25.0.9658 -CatalogFile.NT = inf_VPN116.cat - -[Manufacturer] -%CompanyName% = SoftEther, NTamd64 - -[SourceDisksNames] -1=%DiskDescription%, "", , - -[SourceDisksFiles] -Neo_VPN116.sys = 1 - -[DestinationDirs] -DefaultDestDir = 12 -Neo.CopyFiles.Sys = 12 - -[Neo.CopyFiles.Sys] -Neo_VPN116.sys, , , 2 - -[SoftEther.NTamd64] -%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN116 - -[NeoAdapter.Install] -Characteristics = 0x1 -AddReg = Neo.Reg, NeoAdapter.Ndi -CopyFiles = Neo.CopyFiles.Sys -*IfType = 53 -*MediaType = 0 -*PhysicalMediaType = 0 - -[NeoAdapter.Install.Services] -AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% - -[NeoAdapter.Ndi] -HKR, , NetworkAddress, 0, %DefaultAddress% -HKR, Ndi, DeviceID, , "NeoAdapter_VPN116" -HKR, , DevLoader, , ndis -HKR, , DeviceVxDs, , Neo_VPN116.sys -HKR, NDIS, LogDriverName, , "Neo_VPN116" -HKR, NDIS, MajorNdisVersion, 1, 5 -HKR, NDIS, MinorNdisVersion, 1, 0 -HKR, Ndi\Interfaces, DefUpper, , "ndis5" -HKR, Ndi\Interfaces, UpperRange, , "ndis5" -HKR, Ndi\Interfaces, LowerRange, , "ethernet" -HKR, Ndi\Interfaces, DefLower, , "ethernet" -HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" -HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% -HKR, Ndi\Params\NetworkAddress, type, 0, "edit" -HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" -HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" -HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% -HKR, Ndi\Params\NetworkAddress, optional, 0, "0" -HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% -HKR, Ndi\Params\MaxSpeed, type, 0, "int" -HKR, Ndi\Params\MaxSpeed, default, 0, "100" -HKR, Ndi\Params\MaxSpeed, min, 0, "0" -HKR, Ndi\Params\MaxSpeed, max, 0, "2000" -HKR, Ndi\Params\MaxSpeed, step, 0, "1" -HKR, Ndi\Params\MaxSpeed, Base, 0, "10" -HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% -HKR, Ndi\Params\KeepLink, type, 0, "enum" -HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% -HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% -HKR, Ndi\Params\KeepLink, default, 0, "0" - - -[Neo.Service] -DisplayName = %Neo.Service.DispName% -Description = %Neo.Service.Desc% -ServiceType = 1 -StartType = 3 -ErrorControl = 1 -ServiceBinary = %12%\Neo_VPN116.sys -LoadOrderGroup = NDIS - -[Neo.Reg] -HKR, Ndi, Service, 0, Neo.Service.Name -HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" -HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" - -[Neo.EventLog] -HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN116.sys" -HKR, , TypesSupported, 0x00010001, 7 - -[Strings] -CompanyName = "SoftEther Corporation" -DiskDescription = "VPN Client Device Driver Install Disk" -Neo.Service.Name = "Neo_VPN116" -Neo.Service.DispName = "VPN Client Device Driver - VPN116" -Neo.Service.Desc = "VPN Client Adapter - VPN116" -NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN116" -Neo.EventLog.Name = "Neo" -NetworkAddress = "MAC Address" -DefaultAddress = "000001000001" -MaxSpeed = "Indicate Speed (Mbps)" -KeepLink = "Keep Link" -On = "On" -Off = "Off" - - -; Auto Generated 20180205_163610.810 - +; VPN Client Device Driver for Windows 2000 and Greater +; +; Copyright (c) SoftEther Corporation. All Rights Reserved. +; http://www.softether.co.jp/ +; +; BUILD 9658 + +[Version] +Signature = "$Windows NT$" +Class = Net +ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} +Provider = %CompanyName% +DriverVer = 02/04/2018, 4.25.0.9658 +CatalogFile.NT = inf_VPN116.cat + +[Manufacturer] +%CompanyName% = SoftEther, NTamd64 + +[SourceDisksNames] +1=%DiskDescription%, "", , + +[SourceDisksFiles] +Neo_VPN116.sys = 1 + +[DestinationDirs] +DefaultDestDir = 12 +Neo.CopyFiles.Sys = 12 + +[Neo.CopyFiles.Sys] +Neo_VPN116.sys, , , 2 + +[SoftEther.NTamd64] +%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN116 + +[NeoAdapter.Install] +Characteristics = 0x1 +AddReg = Neo.Reg, NeoAdapter.Ndi +CopyFiles = Neo.CopyFiles.Sys +*IfType = 53 +*MediaType = 0 +*PhysicalMediaType = 0 + +[NeoAdapter.Install.Services] +AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% + +[NeoAdapter.Ndi] +HKR, , NetworkAddress, 0, %DefaultAddress% +HKR, Ndi, DeviceID, , "NeoAdapter_VPN116" +HKR, , DevLoader, , ndis +HKR, , DeviceVxDs, , Neo_VPN116.sys +HKR, NDIS, LogDriverName, , "Neo_VPN116" +HKR, NDIS, MajorNdisVersion, 1, 5 +HKR, NDIS, MinorNdisVersion, 1, 0 +HKR, Ndi\Interfaces, DefUpper, , "ndis5" +HKR, Ndi\Interfaces, UpperRange, , "ndis5" +HKR, Ndi\Interfaces, LowerRange, , "ethernet" +HKR, Ndi\Interfaces, DefLower, , "ethernet" +HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" +HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% +HKR, Ndi\Params\NetworkAddress, type, 0, "edit" +HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" +HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" +HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% +HKR, Ndi\Params\NetworkAddress, optional, 0, "0" +HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% +HKR, Ndi\Params\MaxSpeed, type, 0, "int" +HKR, Ndi\Params\MaxSpeed, default, 0, "100" +HKR, Ndi\Params\MaxSpeed, min, 0, "0" +HKR, Ndi\Params\MaxSpeed, max, 0, "2000" +HKR, Ndi\Params\MaxSpeed, step, 0, "1" +HKR, Ndi\Params\MaxSpeed, Base, 0, "10" +HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% +HKR, Ndi\Params\KeepLink, type, 0, "enum" +HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% +HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% +HKR, Ndi\Params\KeepLink, default, 0, "0" + + +[Neo.Service] +DisplayName = %Neo.Service.DispName% +Description = %Neo.Service.Desc% +ServiceType = 1 +StartType = 3 +ErrorControl = 1 +ServiceBinary = %12%\Neo_VPN116.sys +LoadOrderGroup = NDIS + +[Neo.Reg] +HKR, Ndi, Service, 0, Neo.Service.Name +HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" +HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" + +[Neo.EventLog] +HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN116.sys" +HKR, , TypesSupported, 0x00010001, 7 + +[Strings] +CompanyName = "SoftEther Corporation" +DiskDescription = "VPN Client Device Driver Install Disk" +Neo.Service.Name = "Neo_VPN116" +Neo.Service.DispName = "VPN Client Device Driver - VPN116" +Neo.Service.Desc = "VPN Client Adapter - VPN116" +NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN116" +Neo.EventLog.Name = "Neo" +NetworkAddress = "MAC Address" +DefaultAddress = "000001000001" +MaxSpeed = "Indicate Speed (Mbps)" +KeepLink = "Keep Link" +On = "On" +Off = "Off" + + +; Auto Generated 20180205_163610.810 + diff --git a/src/bin/hamcore/DriverPackages/Neo6_Win8/x64/Neo6_x64_VPN117.inf b/src/bin/hamcore/DriverPackages/Neo6_Win8/x64/Neo6_x64_VPN117.inf index 734f6c62..04034404 100644 --- a/src/bin/hamcore/DriverPackages/Neo6_Win8/x64/Neo6_x64_VPN117.inf +++ b/src/bin/hamcore/DriverPackages/Neo6_Win8/x64/Neo6_x64_VPN117.inf @@ -1,114 +1,114 @@ -; VPN Client Device Driver for Windows 2000 and Greater -; -; Copyright (c) SoftEther Corporation. All Rights Reserved. -; http://www.softether.co.jp/ -; -; BUILD 9658 - -[Version] -Signature = "$Windows NT$" -Class = Net -ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} -Provider = %CompanyName% -DriverVer = 02/04/2018, 4.25.0.9658 -CatalogFile.NT = inf_VPN117.cat - -[Manufacturer] -%CompanyName% = SoftEther, NTamd64 - -[SourceDisksNames] -1=%DiskDescription%, "", , - -[SourceDisksFiles] -Neo_VPN117.sys = 1 - -[DestinationDirs] -DefaultDestDir = 12 -Neo.CopyFiles.Sys = 12 - -[Neo.CopyFiles.Sys] -Neo_VPN117.sys, , , 2 - -[SoftEther.NTamd64] -%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN117 - -[NeoAdapter.Install] -Characteristics = 0x1 -AddReg = Neo.Reg, NeoAdapter.Ndi -CopyFiles = Neo.CopyFiles.Sys -*IfType = 53 -*MediaType = 0 -*PhysicalMediaType = 0 - -[NeoAdapter.Install.Services] -AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% - -[NeoAdapter.Ndi] -HKR, , NetworkAddress, 0, %DefaultAddress% -HKR, Ndi, DeviceID, , "NeoAdapter_VPN117" -HKR, , DevLoader, , ndis -HKR, , DeviceVxDs, , Neo_VPN117.sys -HKR, NDIS, LogDriverName, , "Neo_VPN117" -HKR, NDIS, MajorNdisVersion, 1, 5 -HKR, NDIS, MinorNdisVersion, 1, 0 -HKR, Ndi\Interfaces, DefUpper, , "ndis5" -HKR, Ndi\Interfaces, UpperRange, , "ndis5" -HKR, Ndi\Interfaces, LowerRange, , "ethernet" -HKR, Ndi\Interfaces, DefLower, , "ethernet" -HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" -HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% -HKR, Ndi\Params\NetworkAddress, type, 0, "edit" -HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" -HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" -HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% -HKR, Ndi\Params\NetworkAddress, optional, 0, "0" -HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% -HKR, Ndi\Params\MaxSpeed, type, 0, "int" -HKR, Ndi\Params\MaxSpeed, default, 0, "100" -HKR, Ndi\Params\MaxSpeed, min, 0, "0" -HKR, Ndi\Params\MaxSpeed, max, 0, "2000" -HKR, Ndi\Params\MaxSpeed, step, 0, "1" -HKR, Ndi\Params\MaxSpeed, Base, 0, "10" -HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% -HKR, Ndi\Params\KeepLink, type, 0, "enum" -HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% -HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% -HKR, Ndi\Params\KeepLink, default, 0, "0" - - -[Neo.Service] -DisplayName = %Neo.Service.DispName% -Description = %Neo.Service.Desc% -ServiceType = 1 -StartType = 3 -ErrorControl = 1 -ServiceBinary = %12%\Neo_VPN117.sys -LoadOrderGroup = NDIS - -[Neo.Reg] -HKR, Ndi, Service, 0, Neo.Service.Name -HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" -HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" - -[Neo.EventLog] -HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN117.sys" -HKR, , TypesSupported, 0x00010001, 7 - -[Strings] -CompanyName = "SoftEther Corporation" -DiskDescription = "VPN Client Device Driver Install Disk" -Neo.Service.Name = "Neo_VPN117" -Neo.Service.DispName = "VPN Client Device Driver - VPN117" -Neo.Service.Desc = "VPN Client Adapter - VPN117" -NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN117" -Neo.EventLog.Name = "Neo" -NetworkAddress = "MAC Address" -DefaultAddress = "000001000001" -MaxSpeed = "Indicate Speed (Mbps)" -KeepLink = "Keep Link" -On = "On" -Off = "Off" - - -; Auto Generated 20180205_163610.811 - +; VPN Client Device Driver for Windows 2000 and Greater +; +; Copyright (c) SoftEther Corporation. All Rights Reserved. +; http://www.softether.co.jp/ +; +; BUILD 9658 + +[Version] +Signature = "$Windows NT$" +Class = Net +ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} +Provider = %CompanyName% +DriverVer = 02/04/2018, 4.25.0.9658 +CatalogFile.NT = inf_VPN117.cat + +[Manufacturer] +%CompanyName% = SoftEther, NTamd64 + +[SourceDisksNames] +1=%DiskDescription%, "", , + +[SourceDisksFiles] +Neo_VPN117.sys = 1 + +[DestinationDirs] +DefaultDestDir = 12 +Neo.CopyFiles.Sys = 12 + +[Neo.CopyFiles.Sys] +Neo_VPN117.sys, , , 2 + +[SoftEther.NTamd64] +%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN117 + +[NeoAdapter.Install] +Characteristics = 0x1 +AddReg = Neo.Reg, NeoAdapter.Ndi +CopyFiles = Neo.CopyFiles.Sys +*IfType = 53 +*MediaType = 0 +*PhysicalMediaType = 0 + +[NeoAdapter.Install.Services] +AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% + +[NeoAdapter.Ndi] +HKR, , NetworkAddress, 0, %DefaultAddress% +HKR, Ndi, DeviceID, , "NeoAdapter_VPN117" +HKR, , DevLoader, , ndis +HKR, , DeviceVxDs, , Neo_VPN117.sys +HKR, NDIS, LogDriverName, , "Neo_VPN117" +HKR, NDIS, MajorNdisVersion, 1, 5 +HKR, NDIS, MinorNdisVersion, 1, 0 +HKR, Ndi\Interfaces, DefUpper, , "ndis5" +HKR, Ndi\Interfaces, UpperRange, , "ndis5" +HKR, Ndi\Interfaces, LowerRange, , "ethernet" +HKR, Ndi\Interfaces, DefLower, , "ethernet" +HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" +HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% +HKR, Ndi\Params\NetworkAddress, type, 0, "edit" +HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" +HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" +HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% +HKR, Ndi\Params\NetworkAddress, optional, 0, "0" +HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% +HKR, Ndi\Params\MaxSpeed, type, 0, "int" +HKR, Ndi\Params\MaxSpeed, default, 0, "100" +HKR, Ndi\Params\MaxSpeed, min, 0, "0" +HKR, Ndi\Params\MaxSpeed, max, 0, "2000" +HKR, Ndi\Params\MaxSpeed, step, 0, "1" +HKR, Ndi\Params\MaxSpeed, Base, 0, "10" +HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% +HKR, Ndi\Params\KeepLink, type, 0, "enum" +HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% +HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% +HKR, Ndi\Params\KeepLink, default, 0, "0" + + +[Neo.Service] +DisplayName = %Neo.Service.DispName% +Description = %Neo.Service.Desc% +ServiceType = 1 +StartType = 3 +ErrorControl = 1 +ServiceBinary = %12%\Neo_VPN117.sys +LoadOrderGroup = NDIS + +[Neo.Reg] +HKR, Ndi, Service, 0, Neo.Service.Name +HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" +HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" + +[Neo.EventLog] +HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN117.sys" +HKR, , TypesSupported, 0x00010001, 7 + +[Strings] +CompanyName = "SoftEther Corporation" +DiskDescription = "VPN Client Device Driver Install Disk" +Neo.Service.Name = "Neo_VPN117" +Neo.Service.DispName = "VPN Client Device Driver - VPN117" +Neo.Service.Desc = "VPN Client Adapter - VPN117" +NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN117" +Neo.EventLog.Name = "Neo" +NetworkAddress = "MAC Address" +DefaultAddress = "000001000001" +MaxSpeed = "Indicate Speed (Mbps)" +KeepLink = "Keep Link" +On = "On" +Off = "Off" + + +; Auto Generated 20180205_163610.811 + diff --git a/src/bin/hamcore/DriverPackages/Neo6_Win8/x64/Neo6_x64_VPN118.inf b/src/bin/hamcore/DriverPackages/Neo6_Win8/x64/Neo6_x64_VPN118.inf index e6e9a0b1..1e96eb19 100644 --- a/src/bin/hamcore/DriverPackages/Neo6_Win8/x64/Neo6_x64_VPN118.inf +++ b/src/bin/hamcore/DriverPackages/Neo6_Win8/x64/Neo6_x64_VPN118.inf @@ -1,114 +1,114 @@ -; VPN Client Device Driver for Windows 2000 and Greater -; -; Copyright (c) SoftEther Corporation. All Rights Reserved. -; http://www.softether.co.jp/ -; -; BUILD 9658 - -[Version] -Signature = "$Windows NT$" -Class = Net -ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} -Provider = %CompanyName% -DriverVer = 02/04/2018, 4.25.0.9658 -CatalogFile.NT = inf_VPN118.cat - -[Manufacturer] -%CompanyName% = SoftEther, NTamd64 - -[SourceDisksNames] -1=%DiskDescription%, "", , - -[SourceDisksFiles] -Neo_VPN118.sys = 1 - -[DestinationDirs] -DefaultDestDir = 12 -Neo.CopyFiles.Sys = 12 - -[Neo.CopyFiles.Sys] -Neo_VPN118.sys, , , 2 - -[SoftEther.NTamd64] -%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN118 - -[NeoAdapter.Install] -Characteristics = 0x1 -AddReg = Neo.Reg, NeoAdapter.Ndi -CopyFiles = Neo.CopyFiles.Sys -*IfType = 53 -*MediaType = 0 -*PhysicalMediaType = 0 - -[NeoAdapter.Install.Services] -AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% - -[NeoAdapter.Ndi] -HKR, , NetworkAddress, 0, %DefaultAddress% -HKR, Ndi, DeviceID, , "NeoAdapter_VPN118" -HKR, , DevLoader, , ndis -HKR, , DeviceVxDs, , Neo_VPN118.sys -HKR, NDIS, LogDriverName, , "Neo_VPN118" -HKR, NDIS, MajorNdisVersion, 1, 5 -HKR, NDIS, MinorNdisVersion, 1, 0 -HKR, Ndi\Interfaces, DefUpper, , "ndis5" -HKR, Ndi\Interfaces, UpperRange, , "ndis5" -HKR, Ndi\Interfaces, LowerRange, , "ethernet" -HKR, Ndi\Interfaces, DefLower, , "ethernet" -HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" -HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% -HKR, Ndi\Params\NetworkAddress, type, 0, "edit" -HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" -HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" -HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% -HKR, Ndi\Params\NetworkAddress, optional, 0, "0" -HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% -HKR, Ndi\Params\MaxSpeed, type, 0, "int" -HKR, Ndi\Params\MaxSpeed, default, 0, "100" -HKR, Ndi\Params\MaxSpeed, min, 0, "0" -HKR, Ndi\Params\MaxSpeed, max, 0, "2000" -HKR, Ndi\Params\MaxSpeed, step, 0, "1" -HKR, Ndi\Params\MaxSpeed, Base, 0, "10" -HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% -HKR, Ndi\Params\KeepLink, type, 0, "enum" -HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% -HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% -HKR, Ndi\Params\KeepLink, default, 0, "0" - - -[Neo.Service] -DisplayName = %Neo.Service.DispName% -Description = %Neo.Service.Desc% -ServiceType = 1 -StartType = 3 -ErrorControl = 1 -ServiceBinary = %12%\Neo_VPN118.sys -LoadOrderGroup = NDIS - -[Neo.Reg] -HKR, Ndi, Service, 0, Neo.Service.Name -HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" -HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" - -[Neo.EventLog] -HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN118.sys" -HKR, , TypesSupported, 0x00010001, 7 - -[Strings] -CompanyName = "SoftEther Corporation" -DiskDescription = "VPN Client Device Driver Install Disk" -Neo.Service.Name = "Neo_VPN118" -Neo.Service.DispName = "VPN Client Device Driver - VPN118" -Neo.Service.Desc = "VPN Client Adapter - VPN118" -NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN118" -Neo.EventLog.Name = "Neo" -NetworkAddress = "MAC Address" -DefaultAddress = "000001000001" -MaxSpeed = "Indicate Speed (Mbps)" -KeepLink = "Keep Link" -On = "On" -Off = "Off" - - -; Auto Generated 20180205_163610.812 - +; VPN Client Device Driver for Windows 2000 and Greater +; +; Copyright (c) SoftEther Corporation. All Rights Reserved. +; http://www.softether.co.jp/ +; +; BUILD 9658 + +[Version] +Signature = "$Windows NT$" +Class = Net +ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} +Provider = %CompanyName% +DriverVer = 02/04/2018, 4.25.0.9658 +CatalogFile.NT = inf_VPN118.cat + +[Manufacturer] +%CompanyName% = SoftEther, NTamd64 + +[SourceDisksNames] +1=%DiskDescription%, "", , + +[SourceDisksFiles] +Neo_VPN118.sys = 1 + +[DestinationDirs] +DefaultDestDir = 12 +Neo.CopyFiles.Sys = 12 + +[Neo.CopyFiles.Sys] +Neo_VPN118.sys, , , 2 + +[SoftEther.NTamd64] +%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN118 + +[NeoAdapter.Install] +Characteristics = 0x1 +AddReg = Neo.Reg, NeoAdapter.Ndi +CopyFiles = Neo.CopyFiles.Sys +*IfType = 53 +*MediaType = 0 +*PhysicalMediaType = 0 + +[NeoAdapter.Install.Services] +AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% + +[NeoAdapter.Ndi] +HKR, , NetworkAddress, 0, %DefaultAddress% +HKR, Ndi, DeviceID, , "NeoAdapter_VPN118" +HKR, , DevLoader, , ndis +HKR, , DeviceVxDs, , Neo_VPN118.sys +HKR, NDIS, LogDriverName, , "Neo_VPN118" +HKR, NDIS, MajorNdisVersion, 1, 5 +HKR, NDIS, MinorNdisVersion, 1, 0 +HKR, Ndi\Interfaces, DefUpper, , "ndis5" +HKR, Ndi\Interfaces, UpperRange, , "ndis5" +HKR, Ndi\Interfaces, LowerRange, , "ethernet" +HKR, Ndi\Interfaces, DefLower, , "ethernet" +HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" +HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% +HKR, Ndi\Params\NetworkAddress, type, 0, "edit" +HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" +HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" +HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% +HKR, Ndi\Params\NetworkAddress, optional, 0, "0" +HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% +HKR, Ndi\Params\MaxSpeed, type, 0, "int" +HKR, Ndi\Params\MaxSpeed, default, 0, "100" +HKR, Ndi\Params\MaxSpeed, min, 0, "0" +HKR, Ndi\Params\MaxSpeed, max, 0, "2000" +HKR, Ndi\Params\MaxSpeed, step, 0, "1" +HKR, Ndi\Params\MaxSpeed, Base, 0, "10" +HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% +HKR, Ndi\Params\KeepLink, type, 0, "enum" +HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% +HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% +HKR, Ndi\Params\KeepLink, default, 0, "0" + + +[Neo.Service] +DisplayName = %Neo.Service.DispName% +Description = %Neo.Service.Desc% +ServiceType = 1 +StartType = 3 +ErrorControl = 1 +ServiceBinary = %12%\Neo_VPN118.sys +LoadOrderGroup = NDIS + +[Neo.Reg] +HKR, Ndi, Service, 0, Neo.Service.Name +HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" +HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" + +[Neo.EventLog] +HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN118.sys" +HKR, , TypesSupported, 0x00010001, 7 + +[Strings] +CompanyName = "SoftEther Corporation" +DiskDescription = "VPN Client Device Driver Install Disk" +Neo.Service.Name = "Neo_VPN118" +Neo.Service.DispName = "VPN Client Device Driver - VPN118" +Neo.Service.Desc = "VPN Client Adapter - VPN118" +NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN118" +Neo.EventLog.Name = "Neo" +NetworkAddress = "MAC Address" +DefaultAddress = "000001000001" +MaxSpeed = "Indicate Speed (Mbps)" +KeepLink = "Keep Link" +On = "On" +Off = "Off" + + +; Auto Generated 20180205_163610.812 + diff --git a/src/bin/hamcore/DriverPackages/Neo6_Win8/x64/Neo6_x64_VPN119.inf b/src/bin/hamcore/DriverPackages/Neo6_Win8/x64/Neo6_x64_VPN119.inf index 85b1f19d..6d5a86ad 100644 --- a/src/bin/hamcore/DriverPackages/Neo6_Win8/x64/Neo6_x64_VPN119.inf +++ b/src/bin/hamcore/DriverPackages/Neo6_Win8/x64/Neo6_x64_VPN119.inf @@ -1,114 +1,114 @@ -; VPN Client Device Driver for Windows 2000 and Greater -; -; Copyright (c) SoftEther Corporation. All Rights Reserved. -; http://www.softether.co.jp/ -; -; BUILD 9658 - -[Version] -Signature = "$Windows NT$" -Class = Net -ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} -Provider = %CompanyName% -DriverVer = 02/04/2018, 4.25.0.9658 -CatalogFile.NT = inf_VPN119.cat - -[Manufacturer] -%CompanyName% = SoftEther, NTamd64 - -[SourceDisksNames] -1=%DiskDescription%, "", , - -[SourceDisksFiles] -Neo_VPN119.sys = 1 - -[DestinationDirs] -DefaultDestDir = 12 -Neo.CopyFiles.Sys = 12 - -[Neo.CopyFiles.Sys] -Neo_VPN119.sys, , , 2 - -[SoftEther.NTamd64] -%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN119 - -[NeoAdapter.Install] -Characteristics = 0x1 -AddReg = Neo.Reg, NeoAdapter.Ndi -CopyFiles = Neo.CopyFiles.Sys -*IfType = 53 -*MediaType = 0 -*PhysicalMediaType = 0 - -[NeoAdapter.Install.Services] -AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% - -[NeoAdapter.Ndi] -HKR, , NetworkAddress, 0, %DefaultAddress% -HKR, Ndi, DeviceID, , "NeoAdapter_VPN119" -HKR, , DevLoader, , ndis -HKR, , DeviceVxDs, , Neo_VPN119.sys -HKR, NDIS, LogDriverName, , "Neo_VPN119" -HKR, NDIS, MajorNdisVersion, 1, 5 -HKR, NDIS, MinorNdisVersion, 1, 0 -HKR, Ndi\Interfaces, DefUpper, , "ndis5" -HKR, Ndi\Interfaces, UpperRange, , "ndis5" -HKR, Ndi\Interfaces, LowerRange, , "ethernet" -HKR, Ndi\Interfaces, DefLower, , "ethernet" -HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" -HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% -HKR, Ndi\Params\NetworkAddress, type, 0, "edit" -HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" -HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" -HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% -HKR, Ndi\Params\NetworkAddress, optional, 0, "0" -HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% -HKR, Ndi\Params\MaxSpeed, type, 0, "int" -HKR, Ndi\Params\MaxSpeed, default, 0, "100" -HKR, Ndi\Params\MaxSpeed, min, 0, "0" -HKR, Ndi\Params\MaxSpeed, max, 0, "2000" -HKR, Ndi\Params\MaxSpeed, step, 0, "1" -HKR, Ndi\Params\MaxSpeed, Base, 0, "10" -HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% -HKR, Ndi\Params\KeepLink, type, 0, "enum" -HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% -HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% -HKR, Ndi\Params\KeepLink, default, 0, "0" - - -[Neo.Service] -DisplayName = %Neo.Service.DispName% -Description = %Neo.Service.Desc% -ServiceType = 1 -StartType = 3 -ErrorControl = 1 -ServiceBinary = %12%\Neo_VPN119.sys -LoadOrderGroup = NDIS - -[Neo.Reg] -HKR, Ndi, Service, 0, Neo.Service.Name -HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" -HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" - -[Neo.EventLog] -HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN119.sys" -HKR, , TypesSupported, 0x00010001, 7 - -[Strings] -CompanyName = "SoftEther Corporation" -DiskDescription = "VPN Client Device Driver Install Disk" -Neo.Service.Name = "Neo_VPN119" -Neo.Service.DispName = "VPN Client Device Driver - VPN119" -Neo.Service.Desc = "VPN Client Adapter - VPN119" -NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN119" -Neo.EventLog.Name = "Neo" -NetworkAddress = "MAC Address" -DefaultAddress = "000001000001" -MaxSpeed = "Indicate Speed (Mbps)" -KeepLink = "Keep Link" -On = "On" -Off = "Off" - - -; Auto Generated 20180205_163610.812 - +; VPN Client Device Driver for Windows 2000 and Greater +; +; Copyright (c) SoftEther Corporation. All Rights Reserved. +; http://www.softether.co.jp/ +; +; BUILD 9658 + +[Version] +Signature = "$Windows NT$" +Class = Net +ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} +Provider = %CompanyName% +DriverVer = 02/04/2018, 4.25.0.9658 +CatalogFile.NT = inf_VPN119.cat + +[Manufacturer] +%CompanyName% = SoftEther, NTamd64 + +[SourceDisksNames] +1=%DiskDescription%, "", , + +[SourceDisksFiles] +Neo_VPN119.sys = 1 + +[DestinationDirs] +DefaultDestDir = 12 +Neo.CopyFiles.Sys = 12 + +[Neo.CopyFiles.Sys] +Neo_VPN119.sys, , , 2 + +[SoftEther.NTamd64] +%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN119 + +[NeoAdapter.Install] +Characteristics = 0x1 +AddReg = Neo.Reg, NeoAdapter.Ndi +CopyFiles = Neo.CopyFiles.Sys +*IfType = 53 +*MediaType = 0 +*PhysicalMediaType = 0 + +[NeoAdapter.Install.Services] +AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% + +[NeoAdapter.Ndi] +HKR, , NetworkAddress, 0, %DefaultAddress% +HKR, Ndi, DeviceID, , "NeoAdapter_VPN119" +HKR, , DevLoader, , ndis +HKR, , DeviceVxDs, , Neo_VPN119.sys +HKR, NDIS, LogDriverName, , "Neo_VPN119" +HKR, NDIS, MajorNdisVersion, 1, 5 +HKR, NDIS, MinorNdisVersion, 1, 0 +HKR, Ndi\Interfaces, DefUpper, , "ndis5" +HKR, Ndi\Interfaces, UpperRange, , "ndis5" +HKR, Ndi\Interfaces, LowerRange, , "ethernet" +HKR, Ndi\Interfaces, DefLower, , "ethernet" +HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" +HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% +HKR, Ndi\Params\NetworkAddress, type, 0, "edit" +HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" +HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" +HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% +HKR, Ndi\Params\NetworkAddress, optional, 0, "0" +HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% +HKR, Ndi\Params\MaxSpeed, type, 0, "int" +HKR, Ndi\Params\MaxSpeed, default, 0, "100" +HKR, Ndi\Params\MaxSpeed, min, 0, "0" +HKR, Ndi\Params\MaxSpeed, max, 0, "2000" +HKR, Ndi\Params\MaxSpeed, step, 0, "1" +HKR, Ndi\Params\MaxSpeed, Base, 0, "10" +HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% +HKR, Ndi\Params\KeepLink, type, 0, "enum" +HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% +HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% +HKR, Ndi\Params\KeepLink, default, 0, "0" + + +[Neo.Service] +DisplayName = %Neo.Service.DispName% +Description = %Neo.Service.Desc% +ServiceType = 1 +StartType = 3 +ErrorControl = 1 +ServiceBinary = %12%\Neo_VPN119.sys +LoadOrderGroup = NDIS + +[Neo.Reg] +HKR, Ndi, Service, 0, Neo.Service.Name +HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" +HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" + +[Neo.EventLog] +HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN119.sys" +HKR, , TypesSupported, 0x00010001, 7 + +[Strings] +CompanyName = "SoftEther Corporation" +DiskDescription = "VPN Client Device Driver Install Disk" +Neo.Service.Name = "Neo_VPN119" +Neo.Service.DispName = "VPN Client Device Driver - VPN119" +Neo.Service.Desc = "VPN Client Adapter - VPN119" +NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN119" +Neo.EventLog.Name = "Neo" +NetworkAddress = "MAC Address" +DefaultAddress = "000001000001" +MaxSpeed = "Indicate Speed (Mbps)" +KeepLink = "Keep Link" +On = "On" +Off = "Off" + + +; Auto Generated 20180205_163610.812 + diff --git a/src/bin/hamcore/DriverPackages/Neo6_Win8/x64/Neo6_x64_VPN12.inf b/src/bin/hamcore/DriverPackages/Neo6_Win8/x64/Neo6_x64_VPN12.inf index dbf7a736..079e095c 100644 --- a/src/bin/hamcore/DriverPackages/Neo6_Win8/x64/Neo6_x64_VPN12.inf +++ b/src/bin/hamcore/DriverPackages/Neo6_Win8/x64/Neo6_x64_VPN12.inf @@ -1,114 +1,114 @@ -; VPN Client Device Driver for Windows 2000 and Greater -; -; Copyright (c) SoftEther Corporation. All Rights Reserved. -; http://www.softether.co.jp/ -; -; BUILD 9658 - -[Version] -Signature = "$Windows NT$" -Class = Net -ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} -Provider = %CompanyName% -DriverVer = 02/04/2018, 4.25.0.9658 -CatalogFile.NT = inf_VPN12.cat - -[Manufacturer] -%CompanyName% = SoftEther, NTamd64 - -[SourceDisksNames] -1=%DiskDescription%, "", , - -[SourceDisksFiles] -Neo_VPN12.sys = 1 - -[DestinationDirs] -DefaultDestDir = 12 -Neo.CopyFiles.Sys = 12 - -[Neo.CopyFiles.Sys] -Neo_VPN12.sys, , , 2 - -[SoftEther.NTamd64] -%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN12 - -[NeoAdapter.Install] -Characteristics = 0x1 -AddReg = Neo.Reg, NeoAdapter.Ndi -CopyFiles = Neo.CopyFiles.Sys -*IfType = 53 -*MediaType = 0 -*PhysicalMediaType = 0 - -[NeoAdapter.Install.Services] -AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% - -[NeoAdapter.Ndi] -HKR, , NetworkAddress, 0, %DefaultAddress% -HKR, Ndi, DeviceID, , "NeoAdapter_VPN12" -HKR, , DevLoader, , ndis -HKR, , DeviceVxDs, , Neo_VPN12.sys -HKR, NDIS, LogDriverName, , "Neo_VPN12" -HKR, NDIS, MajorNdisVersion, 1, 5 -HKR, NDIS, MinorNdisVersion, 1, 0 -HKR, Ndi\Interfaces, DefUpper, , "ndis5" -HKR, Ndi\Interfaces, UpperRange, , "ndis5" -HKR, Ndi\Interfaces, LowerRange, , "ethernet" -HKR, Ndi\Interfaces, DefLower, , "ethernet" -HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" -HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% -HKR, Ndi\Params\NetworkAddress, type, 0, "edit" -HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" -HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" -HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% -HKR, Ndi\Params\NetworkAddress, optional, 0, "0" -HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% -HKR, Ndi\Params\MaxSpeed, type, 0, "int" -HKR, Ndi\Params\MaxSpeed, default, 0, "100" -HKR, Ndi\Params\MaxSpeed, min, 0, "0" -HKR, Ndi\Params\MaxSpeed, max, 0, "2000" -HKR, Ndi\Params\MaxSpeed, step, 0, "1" -HKR, Ndi\Params\MaxSpeed, Base, 0, "10" -HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% -HKR, Ndi\Params\KeepLink, type, 0, "enum" -HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% -HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% -HKR, Ndi\Params\KeepLink, default, 0, "0" - - -[Neo.Service] -DisplayName = %Neo.Service.DispName% -Description = %Neo.Service.Desc% -ServiceType = 1 -StartType = 3 -ErrorControl = 1 -ServiceBinary = %12%\Neo_VPN12.sys -LoadOrderGroup = NDIS - -[Neo.Reg] -HKR, Ndi, Service, 0, Neo.Service.Name -HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" -HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" - -[Neo.EventLog] -HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN12.sys" -HKR, , TypesSupported, 0x00010001, 7 - -[Strings] -CompanyName = "SoftEther Corporation" -DiskDescription = "VPN Client Device Driver Install Disk" -Neo.Service.Name = "Neo_VPN12" -Neo.Service.DispName = "VPN Client Device Driver - VPN12" -Neo.Service.Desc = "VPN Client Adapter - VPN12" -NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN12" -Neo.EventLog.Name = "Neo" -NetworkAddress = "MAC Address" -DefaultAddress = "000001000001" -MaxSpeed = "Indicate Speed (Mbps)" -KeepLink = "Keep Link" -On = "On" -Off = "Off" - - -; Auto Generated 20180205_163610.744 - +; VPN Client Device Driver for Windows 2000 and Greater +; +; Copyright (c) SoftEther Corporation. All Rights Reserved. +; http://www.softether.co.jp/ +; +; BUILD 9658 + +[Version] +Signature = "$Windows NT$" +Class = Net +ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} +Provider = %CompanyName% +DriverVer = 02/04/2018, 4.25.0.9658 +CatalogFile.NT = inf_VPN12.cat + +[Manufacturer] +%CompanyName% = SoftEther, NTamd64 + +[SourceDisksNames] +1=%DiskDescription%, "", , + +[SourceDisksFiles] +Neo_VPN12.sys = 1 + +[DestinationDirs] +DefaultDestDir = 12 +Neo.CopyFiles.Sys = 12 + +[Neo.CopyFiles.Sys] +Neo_VPN12.sys, , , 2 + +[SoftEther.NTamd64] +%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN12 + +[NeoAdapter.Install] +Characteristics = 0x1 +AddReg = Neo.Reg, NeoAdapter.Ndi +CopyFiles = Neo.CopyFiles.Sys +*IfType = 53 +*MediaType = 0 +*PhysicalMediaType = 0 + +[NeoAdapter.Install.Services] +AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% + +[NeoAdapter.Ndi] +HKR, , NetworkAddress, 0, %DefaultAddress% +HKR, Ndi, DeviceID, , "NeoAdapter_VPN12" +HKR, , DevLoader, , ndis +HKR, , DeviceVxDs, , Neo_VPN12.sys +HKR, NDIS, LogDriverName, , "Neo_VPN12" +HKR, NDIS, MajorNdisVersion, 1, 5 +HKR, NDIS, MinorNdisVersion, 1, 0 +HKR, Ndi\Interfaces, DefUpper, , "ndis5" +HKR, Ndi\Interfaces, UpperRange, , "ndis5" +HKR, Ndi\Interfaces, LowerRange, , "ethernet" +HKR, Ndi\Interfaces, DefLower, , "ethernet" +HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" +HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% +HKR, Ndi\Params\NetworkAddress, type, 0, "edit" +HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" +HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" +HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% +HKR, Ndi\Params\NetworkAddress, optional, 0, "0" +HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% +HKR, Ndi\Params\MaxSpeed, type, 0, "int" +HKR, Ndi\Params\MaxSpeed, default, 0, "100" +HKR, Ndi\Params\MaxSpeed, min, 0, "0" +HKR, Ndi\Params\MaxSpeed, max, 0, "2000" +HKR, Ndi\Params\MaxSpeed, step, 0, "1" +HKR, Ndi\Params\MaxSpeed, Base, 0, "10" +HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% +HKR, Ndi\Params\KeepLink, type, 0, "enum" +HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% +HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% +HKR, Ndi\Params\KeepLink, default, 0, "0" + + +[Neo.Service] +DisplayName = %Neo.Service.DispName% +Description = %Neo.Service.Desc% +ServiceType = 1 +StartType = 3 +ErrorControl = 1 +ServiceBinary = %12%\Neo_VPN12.sys +LoadOrderGroup = NDIS + +[Neo.Reg] +HKR, Ndi, Service, 0, Neo.Service.Name +HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" +HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" + +[Neo.EventLog] +HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN12.sys" +HKR, , TypesSupported, 0x00010001, 7 + +[Strings] +CompanyName = "SoftEther Corporation" +DiskDescription = "VPN Client Device Driver Install Disk" +Neo.Service.Name = "Neo_VPN12" +Neo.Service.DispName = "VPN Client Device Driver - VPN12" +Neo.Service.Desc = "VPN Client Adapter - VPN12" +NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN12" +Neo.EventLog.Name = "Neo" +NetworkAddress = "MAC Address" +DefaultAddress = "000001000001" +MaxSpeed = "Indicate Speed (Mbps)" +KeepLink = "Keep Link" +On = "On" +Off = "Off" + + +; Auto Generated 20180205_163610.744 + diff --git a/src/bin/hamcore/DriverPackages/Neo6_Win8/x64/Neo6_x64_VPN120.inf b/src/bin/hamcore/DriverPackages/Neo6_Win8/x64/Neo6_x64_VPN120.inf index b2edda89..ba1c9edd 100644 --- a/src/bin/hamcore/DriverPackages/Neo6_Win8/x64/Neo6_x64_VPN120.inf +++ b/src/bin/hamcore/DriverPackages/Neo6_Win8/x64/Neo6_x64_VPN120.inf @@ -1,114 +1,114 @@ -; VPN Client Device Driver for Windows 2000 and Greater -; -; Copyright (c) SoftEther Corporation. All Rights Reserved. -; http://www.softether.co.jp/ -; -; BUILD 9658 - -[Version] -Signature = "$Windows NT$" -Class = Net -ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} -Provider = %CompanyName% -DriverVer = 02/04/2018, 4.25.0.9658 -CatalogFile.NT = inf_VPN120.cat - -[Manufacturer] -%CompanyName% = SoftEther, NTamd64 - -[SourceDisksNames] -1=%DiskDescription%, "", , - -[SourceDisksFiles] -Neo_VPN120.sys = 1 - -[DestinationDirs] -DefaultDestDir = 12 -Neo.CopyFiles.Sys = 12 - -[Neo.CopyFiles.Sys] -Neo_VPN120.sys, , , 2 - -[SoftEther.NTamd64] -%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN120 - -[NeoAdapter.Install] -Characteristics = 0x1 -AddReg = Neo.Reg, NeoAdapter.Ndi -CopyFiles = Neo.CopyFiles.Sys -*IfType = 53 -*MediaType = 0 -*PhysicalMediaType = 0 - -[NeoAdapter.Install.Services] -AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% - -[NeoAdapter.Ndi] -HKR, , NetworkAddress, 0, %DefaultAddress% -HKR, Ndi, DeviceID, , "NeoAdapter_VPN120" -HKR, , DevLoader, , ndis -HKR, , DeviceVxDs, , Neo_VPN120.sys -HKR, NDIS, LogDriverName, , "Neo_VPN120" -HKR, NDIS, MajorNdisVersion, 1, 5 -HKR, NDIS, MinorNdisVersion, 1, 0 -HKR, Ndi\Interfaces, DefUpper, , "ndis5" -HKR, Ndi\Interfaces, UpperRange, , "ndis5" -HKR, Ndi\Interfaces, LowerRange, , "ethernet" -HKR, Ndi\Interfaces, DefLower, , "ethernet" -HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" -HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% -HKR, Ndi\Params\NetworkAddress, type, 0, "edit" -HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" -HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" -HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% -HKR, Ndi\Params\NetworkAddress, optional, 0, "0" -HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% -HKR, Ndi\Params\MaxSpeed, type, 0, "int" -HKR, Ndi\Params\MaxSpeed, default, 0, "100" -HKR, Ndi\Params\MaxSpeed, min, 0, "0" -HKR, Ndi\Params\MaxSpeed, max, 0, "2000" -HKR, Ndi\Params\MaxSpeed, step, 0, "1" -HKR, Ndi\Params\MaxSpeed, Base, 0, "10" -HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% -HKR, Ndi\Params\KeepLink, type, 0, "enum" -HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% -HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% -HKR, Ndi\Params\KeepLink, default, 0, "0" - - -[Neo.Service] -DisplayName = %Neo.Service.DispName% -Description = %Neo.Service.Desc% -ServiceType = 1 -StartType = 3 -ErrorControl = 1 -ServiceBinary = %12%\Neo_VPN120.sys -LoadOrderGroup = NDIS - -[Neo.Reg] -HKR, Ndi, Service, 0, Neo.Service.Name -HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" -HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" - -[Neo.EventLog] -HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN120.sys" -HKR, , TypesSupported, 0x00010001, 7 - -[Strings] -CompanyName = "SoftEther Corporation" -DiskDescription = "VPN Client Device Driver Install Disk" -Neo.Service.Name = "Neo_VPN120" -Neo.Service.DispName = "VPN Client Device Driver - VPN120" -Neo.Service.Desc = "VPN Client Adapter - VPN120" -NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN120" -Neo.EventLog.Name = "Neo" -NetworkAddress = "MAC Address" -DefaultAddress = "000001000001" -MaxSpeed = "Indicate Speed (Mbps)" -KeepLink = "Keep Link" -On = "On" -Off = "Off" - - -; Auto Generated 20180205_163610.813 - +; VPN Client Device Driver for Windows 2000 and Greater +; +; Copyright (c) SoftEther Corporation. All Rights Reserved. +; http://www.softether.co.jp/ +; +; BUILD 9658 + +[Version] +Signature = "$Windows NT$" +Class = Net +ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} +Provider = %CompanyName% +DriverVer = 02/04/2018, 4.25.0.9658 +CatalogFile.NT = inf_VPN120.cat + +[Manufacturer] +%CompanyName% = SoftEther, NTamd64 + +[SourceDisksNames] +1=%DiskDescription%, "", , + +[SourceDisksFiles] +Neo_VPN120.sys = 1 + +[DestinationDirs] +DefaultDestDir = 12 +Neo.CopyFiles.Sys = 12 + +[Neo.CopyFiles.Sys] +Neo_VPN120.sys, , , 2 + +[SoftEther.NTamd64] +%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN120 + +[NeoAdapter.Install] +Characteristics = 0x1 +AddReg = Neo.Reg, NeoAdapter.Ndi +CopyFiles = Neo.CopyFiles.Sys +*IfType = 53 +*MediaType = 0 +*PhysicalMediaType = 0 + +[NeoAdapter.Install.Services] +AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% + +[NeoAdapter.Ndi] +HKR, , NetworkAddress, 0, %DefaultAddress% +HKR, Ndi, DeviceID, , "NeoAdapter_VPN120" +HKR, , DevLoader, , ndis +HKR, , DeviceVxDs, , Neo_VPN120.sys +HKR, NDIS, LogDriverName, , "Neo_VPN120" +HKR, NDIS, MajorNdisVersion, 1, 5 +HKR, NDIS, MinorNdisVersion, 1, 0 +HKR, Ndi\Interfaces, DefUpper, , "ndis5" +HKR, Ndi\Interfaces, UpperRange, , "ndis5" +HKR, Ndi\Interfaces, LowerRange, , "ethernet" +HKR, Ndi\Interfaces, DefLower, , "ethernet" +HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" +HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% +HKR, Ndi\Params\NetworkAddress, type, 0, "edit" +HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" +HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" +HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% +HKR, Ndi\Params\NetworkAddress, optional, 0, "0" +HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% +HKR, Ndi\Params\MaxSpeed, type, 0, "int" +HKR, Ndi\Params\MaxSpeed, default, 0, "100" +HKR, Ndi\Params\MaxSpeed, min, 0, "0" +HKR, Ndi\Params\MaxSpeed, max, 0, "2000" +HKR, Ndi\Params\MaxSpeed, step, 0, "1" +HKR, Ndi\Params\MaxSpeed, Base, 0, "10" +HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% +HKR, Ndi\Params\KeepLink, type, 0, "enum" +HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% +HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% +HKR, Ndi\Params\KeepLink, default, 0, "0" + + +[Neo.Service] +DisplayName = %Neo.Service.DispName% +Description = %Neo.Service.Desc% +ServiceType = 1 +StartType = 3 +ErrorControl = 1 +ServiceBinary = %12%\Neo_VPN120.sys +LoadOrderGroup = NDIS + +[Neo.Reg] +HKR, Ndi, Service, 0, Neo.Service.Name +HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" +HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" + +[Neo.EventLog] +HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN120.sys" +HKR, , TypesSupported, 0x00010001, 7 + +[Strings] +CompanyName = "SoftEther Corporation" +DiskDescription = "VPN Client Device Driver Install Disk" +Neo.Service.Name = "Neo_VPN120" +Neo.Service.DispName = "VPN Client Device Driver - VPN120" +Neo.Service.Desc = "VPN Client Adapter - VPN120" +NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN120" +Neo.EventLog.Name = "Neo" +NetworkAddress = "MAC Address" +DefaultAddress = "000001000001" +MaxSpeed = "Indicate Speed (Mbps)" +KeepLink = "Keep Link" +On = "On" +Off = "Off" + + +; Auto Generated 20180205_163610.813 + diff --git a/src/bin/hamcore/DriverPackages/Neo6_Win8/x64/Neo6_x64_VPN121.inf b/src/bin/hamcore/DriverPackages/Neo6_Win8/x64/Neo6_x64_VPN121.inf index 1967aa59..812ece9f 100644 --- a/src/bin/hamcore/DriverPackages/Neo6_Win8/x64/Neo6_x64_VPN121.inf +++ b/src/bin/hamcore/DriverPackages/Neo6_Win8/x64/Neo6_x64_VPN121.inf @@ -1,114 +1,114 @@ -; VPN Client Device Driver for Windows 2000 and Greater -; -; Copyright (c) SoftEther Corporation. All Rights Reserved. -; http://www.softether.co.jp/ -; -; BUILD 9658 - -[Version] -Signature = "$Windows NT$" -Class = Net -ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} -Provider = %CompanyName% -DriverVer = 02/04/2018, 4.25.0.9658 -CatalogFile.NT = inf_VPN121.cat - -[Manufacturer] -%CompanyName% = SoftEther, NTamd64 - -[SourceDisksNames] -1=%DiskDescription%, "", , - -[SourceDisksFiles] -Neo_VPN121.sys = 1 - -[DestinationDirs] -DefaultDestDir = 12 -Neo.CopyFiles.Sys = 12 - -[Neo.CopyFiles.Sys] -Neo_VPN121.sys, , , 2 - -[SoftEther.NTamd64] -%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN121 - -[NeoAdapter.Install] -Characteristics = 0x1 -AddReg = Neo.Reg, NeoAdapter.Ndi -CopyFiles = Neo.CopyFiles.Sys -*IfType = 53 -*MediaType = 0 -*PhysicalMediaType = 0 - -[NeoAdapter.Install.Services] -AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% - -[NeoAdapter.Ndi] -HKR, , NetworkAddress, 0, %DefaultAddress% -HKR, Ndi, DeviceID, , "NeoAdapter_VPN121" -HKR, , DevLoader, , ndis -HKR, , DeviceVxDs, , Neo_VPN121.sys -HKR, NDIS, LogDriverName, , "Neo_VPN121" -HKR, NDIS, MajorNdisVersion, 1, 5 -HKR, NDIS, MinorNdisVersion, 1, 0 -HKR, Ndi\Interfaces, DefUpper, , "ndis5" -HKR, Ndi\Interfaces, UpperRange, , "ndis5" -HKR, Ndi\Interfaces, LowerRange, , "ethernet" -HKR, Ndi\Interfaces, DefLower, , "ethernet" -HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" -HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% -HKR, Ndi\Params\NetworkAddress, type, 0, "edit" -HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" -HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" -HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% -HKR, Ndi\Params\NetworkAddress, optional, 0, "0" -HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% -HKR, Ndi\Params\MaxSpeed, type, 0, "int" -HKR, Ndi\Params\MaxSpeed, default, 0, "100" -HKR, Ndi\Params\MaxSpeed, min, 0, "0" -HKR, Ndi\Params\MaxSpeed, max, 0, "2000" -HKR, Ndi\Params\MaxSpeed, step, 0, "1" -HKR, Ndi\Params\MaxSpeed, Base, 0, "10" -HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% -HKR, Ndi\Params\KeepLink, type, 0, "enum" -HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% -HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% -HKR, Ndi\Params\KeepLink, default, 0, "0" - - -[Neo.Service] -DisplayName = %Neo.Service.DispName% -Description = %Neo.Service.Desc% -ServiceType = 1 -StartType = 3 -ErrorControl = 1 -ServiceBinary = %12%\Neo_VPN121.sys -LoadOrderGroup = NDIS - -[Neo.Reg] -HKR, Ndi, Service, 0, Neo.Service.Name -HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" -HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" - -[Neo.EventLog] -HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN121.sys" -HKR, , TypesSupported, 0x00010001, 7 - -[Strings] -CompanyName = "SoftEther Corporation" -DiskDescription = "VPN Client Device Driver Install Disk" -Neo.Service.Name = "Neo_VPN121" -Neo.Service.DispName = "VPN Client Device Driver - VPN121" -Neo.Service.Desc = "VPN Client Adapter - VPN121" -NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN121" -Neo.EventLog.Name = "Neo" -NetworkAddress = "MAC Address" -DefaultAddress = "000001000001" -MaxSpeed = "Indicate Speed (Mbps)" -KeepLink = "Keep Link" -On = "On" -Off = "Off" - - -; Auto Generated 20180205_163610.814 - +; VPN Client Device Driver for Windows 2000 and Greater +; +; Copyright (c) SoftEther Corporation. All Rights Reserved. +; http://www.softether.co.jp/ +; +; BUILD 9658 + +[Version] +Signature = "$Windows NT$" +Class = Net +ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} +Provider = %CompanyName% +DriverVer = 02/04/2018, 4.25.0.9658 +CatalogFile.NT = inf_VPN121.cat + +[Manufacturer] +%CompanyName% = SoftEther, NTamd64 + +[SourceDisksNames] +1=%DiskDescription%, "", , + +[SourceDisksFiles] +Neo_VPN121.sys = 1 + +[DestinationDirs] +DefaultDestDir = 12 +Neo.CopyFiles.Sys = 12 + +[Neo.CopyFiles.Sys] +Neo_VPN121.sys, , , 2 + +[SoftEther.NTamd64] +%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN121 + +[NeoAdapter.Install] +Characteristics = 0x1 +AddReg = Neo.Reg, NeoAdapter.Ndi +CopyFiles = Neo.CopyFiles.Sys +*IfType = 53 +*MediaType = 0 +*PhysicalMediaType = 0 + +[NeoAdapter.Install.Services] +AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% + +[NeoAdapter.Ndi] +HKR, , NetworkAddress, 0, %DefaultAddress% +HKR, Ndi, DeviceID, , "NeoAdapter_VPN121" +HKR, , DevLoader, , ndis +HKR, , DeviceVxDs, , Neo_VPN121.sys +HKR, NDIS, LogDriverName, , "Neo_VPN121" +HKR, NDIS, MajorNdisVersion, 1, 5 +HKR, NDIS, MinorNdisVersion, 1, 0 +HKR, Ndi\Interfaces, DefUpper, , "ndis5" +HKR, Ndi\Interfaces, UpperRange, , "ndis5" +HKR, Ndi\Interfaces, LowerRange, , "ethernet" +HKR, Ndi\Interfaces, DefLower, , "ethernet" +HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" +HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% +HKR, Ndi\Params\NetworkAddress, type, 0, "edit" +HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" +HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" +HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% +HKR, Ndi\Params\NetworkAddress, optional, 0, "0" +HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% +HKR, Ndi\Params\MaxSpeed, type, 0, "int" +HKR, Ndi\Params\MaxSpeed, default, 0, "100" +HKR, Ndi\Params\MaxSpeed, min, 0, "0" +HKR, Ndi\Params\MaxSpeed, max, 0, "2000" +HKR, Ndi\Params\MaxSpeed, step, 0, "1" +HKR, Ndi\Params\MaxSpeed, Base, 0, "10" +HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% +HKR, Ndi\Params\KeepLink, type, 0, "enum" +HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% +HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% +HKR, Ndi\Params\KeepLink, default, 0, "0" + + +[Neo.Service] +DisplayName = %Neo.Service.DispName% +Description = %Neo.Service.Desc% +ServiceType = 1 +StartType = 3 +ErrorControl = 1 +ServiceBinary = %12%\Neo_VPN121.sys +LoadOrderGroup = NDIS + +[Neo.Reg] +HKR, Ndi, Service, 0, Neo.Service.Name +HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" +HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" + +[Neo.EventLog] +HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN121.sys" +HKR, , TypesSupported, 0x00010001, 7 + +[Strings] +CompanyName = "SoftEther Corporation" +DiskDescription = "VPN Client Device Driver Install Disk" +Neo.Service.Name = "Neo_VPN121" +Neo.Service.DispName = "VPN Client Device Driver - VPN121" +Neo.Service.Desc = "VPN Client Adapter - VPN121" +NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN121" +Neo.EventLog.Name = "Neo" +NetworkAddress = "MAC Address" +DefaultAddress = "000001000001" +MaxSpeed = "Indicate Speed (Mbps)" +KeepLink = "Keep Link" +On = "On" +Off = "Off" + + +; Auto Generated 20180205_163610.814 + diff --git a/src/bin/hamcore/DriverPackages/Neo6_Win8/x64/Neo6_x64_VPN122.inf b/src/bin/hamcore/DriverPackages/Neo6_Win8/x64/Neo6_x64_VPN122.inf index 868a75d4..3087bee8 100644 --- a/src/bin/hamcore/DriverPackages/Neo6_Win8/x64/Neo6_x64_VPN122.inf +++ b/src/bin/hamcore/DriverPackages/Neo6_Win8/x64/Neo6_x64_VPN122.inf @@ -1,114 +1,114 @@ -; VPN Client Device Driver for Windows 2000 and Greater -; -; Copyright (c) SoftEther Corporation. All Rights Reserved. -; http://www.softether.co.jp/ -; -; BUILD 9658 - -[Version] -Signature = "$Windows NT$" -Class = Net -ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} -Provider = %CompanyName% -DriverVer = 02/04/2018, 4.25.0.9658 -CatalogFile.NT = inf_VPN122.cat - -[Manufacturer] -%CompanyName% = SoftEther, NTamd64 - -[SourceDisksNames] -1=%DiskDescription%, "", , - -[SourceDisksFiles] -Neo_VPN122.sys = 1 - -[DestinationDirs] -DefaultDestDir = 12 -Neo.CopyFiles.Sys = 12 - -[Neo.CopyFiles.Sys] -Neo_VPN122.sys, , , 2 - -[SoftEther.NTamd64] -%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN122 - -[NeoAdapter.Install] -Characteristics = 0x1 -AddReg = Neo.Reg, NeoAdapter.Ndi -CopyFiles = Neo.CopyFiles.Sys -*IfType = 53 -*MediaType = 0 -*PhysicalMediaType = 0 - -[NeoAdapter.Install.Services] -AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% - -[NeoAdapter.Ndi] -HKR, , NetworkAddress, 0, %DefaultAddress% -HKR, Ndi, DeviceID, , "NeoAdapter_VPN122" -HKR, , DevLoader, , ndis -HKR, , DeviceVxDs, , Neo_VPN122.sys -HKR, NDIS, LogDriverName, , "Neo_VPN122" -HKR, NDIS, MajorNdisVersion, 1, 5 -HKR, NDIS, MinorNdisVersion, 1, 0 -HKR, Ndi\Interfaces, DefUpper, , "ndis5" -HKR, Ndi\Interfaces, UpperRange, , "ndis5" -HKR, Ndi\Interfaces, LowerRange, , "ethernet" -HKR, Ndi\Interfaces, DefLower, , "ethernet" -HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" -HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% -HKR, Ndi\Params\NetworkAddress, type, 0, "edit" -HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" -HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" -HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% -HKR, Ndi\Params\NetworkAddress, optional, 0, "0" -HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% -HKR, Ndi\Params\MaxSpeed, type, 0, "int" -HKR, Ndi\Params\MaxSpeed, default, 0, "100" -HKR, Ndi\Params\MaxSpeed, min, 0, "0" -HKR, Ndi\Params\MaxSpeed, max, 0, "2000" -HKR, Ndi\Params\MaxSpeed, step, 0, "1" -HKR, Ndi\Params\MaxSpeed, Base, 0, "10" -HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% -HKR, Ndi\Params\KeepLink, type, 0, "enum" -HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% -HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% -HKR, Ndi\Params\KeepLink, default, 0, "0" - - -[Neo.Service] -DisplayName = %Neo.Service.DispName% -Description = %Neo.Service.Desc% -ServiceType = 1 -StartType = 3 -ErrorControl = 1 -ServiceBinary = %12%\Neo_VPN122.sys -LoadOrderGroup = NDIS - -[Neo.Reg] -HKR, Ndi, Service, 0, Neo.Service.Name -HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" -HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" - -[Neo.EventLog] -HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN122.sys" -HKR, , TypesSupported, 0x00010001, 7 - -[Strings] -CompanyName = "SoftEther Corporation" -DiskDescription = "VPN Client Device Driver Install Disk" -Neo.Service.Name = "Neo_VPN122" -Neo.Service.DispName = "VPN Client Device Driver - VPN122" -Neo.Service.Desc = "VPN Client Adapter - VPN122" -NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN122" -Neo.EventLog.Name = "Neo" -NetworkAddress = "MAC Address" -DefaultAddress = "000001000001" -MaxSpeed = "Indicate Speed (Mbps)" -KeepLink = "Keep Link" -On = "On" -Off = "Off" - - -; Auto Generated 20180205_163610.814 - +; VPN Client Device Driver for Windows 2000 and Greater +; +; Copyright (c) SoftEther Corporation. All Rights Reserved. +; http://www.softether.co.jp/ +; +; BUILD 9658 + +[Version] +Signature = "$Windows NT$" +Class = Net +ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} +Provider = %CompanyName% +DriverVer = 02/04/2018, 4.25.0.9658 +CatalogFile.NT = inf_VPN122.cat + +[Manufacturer] +%CompanyName% = SoftEther, NTamd64 + +[SourceDisksNames] +1=%DiskDescription%, "", , + +[SourceDisksFiles] +Neo_VPN122.sys = 1 + +[DestinationDirs] +DefaultDestDir = 12 +Neo.CopyFiles.Sys = 12 + +[Neo.CopyFiles.Sys] +Neo_VPN122.sys, , , 2 + +[SoftEther.NTamd64] +%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN122 + +[NeoAdapter.Install] +Characteristics = 0x1 +AddReg = Neo.Reg, NeoAdapter.Ndi +CopyFiles = Neo.CopyFiles.Sys +*IfType = 53 +*MediaType = 0 +*PhysicalMediaType = 0 + +[NeoAdapter.Install.Services] +AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% + +[NeoAdapter.Ndi] +HKR, , NetworkAddress, 0, %DefaultAddress% +HKR, Ndi, DeviceID, , "NeoAdapter_VPN122" +HKR, , DevLoader, , ndis +HKR, , DeviceVxDs, , Neo_VPN122.sys +HKR, NDIS, LogDriverName, , "Neo_VPN122" +HKR, NDIS, MajorNdisVersion, 1, 5 +HKR, NDIS, MinorNdisVersion, 1, 0 +HKR, Ndi\Interfaces, DefUpper, , "ndis5" +HKR, Ndi\Interfaces, UpperRange, , "ndis5" +HKR, Ndi\Interfaces, LowerRange, , "ethernet" +HKR, Ndi\Interfaces, DefLower, , "ethernet" +HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" +HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% +HKR, Ndi\Params\NetworkAddress, type, 0, "edit" +HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" +HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" +HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% +HKR, Ndi\Params\NetworkAddress, optional, 0, "0" +HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% +HKR, Ndi\Params\MaxSpeed, type, 0, "int" +HKR, Ndi\Params\MaxSpeed, default, 0, "100" +HKR, Ndi\Params\MaxSpeed, min, 0, "0" +HKR, Ndi\Params\MaxSpeed, max, 0, "2000" +HKR, Ndi\Params\MaxSpeed, step, 0, "1" +HKR, Ndi\Params\MaxSpeed, Base, 0, "10" +HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% +HKR, Ndi\Params\KeepLink, type, 0, "enum" +HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% +HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% +HKR, Ndi\Params\KeepLink, default, 0, "0" + + +[Neo.Service] +DisplayName = %Neo.Service.DispName% +Description = %Neo.Service.Desc% +ServiceType = 1 +StartType = 3 +ErrorControl = 1 +ServiceBinary = %12%\Neo_VPN122.sys +LoadOrderGroup = NDIS + +[Neo.Reg] +HKR, Ndi, Service, 0, Neo.Service.Name +HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" +HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" + +[Neo.EventLog] +HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN122.sys" +HKR, , TypesSupported, 0x00010001, 7 + +[Strings] +CompanyName = "SoftEther Corporation" +DiskDescription = "VPN Client Device Driver Install Disk" +Neo.Service.Name = "Neo_VPN122" +Neo.Service.DispName = "VPN Client Device Driver - VPN122" +Neo.Service.Desc = "VPN Client Adapter - VPN122" +NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN122" +Neo.EventLog.Name = "Neo" +NetworkAddress = "MAC Address" +DefaultAddress = "000001000001" +MaxSpeed = "Indicate Speed (Mbps)" +KeepLink = "Keep Link" +On = "On" +Off = "Off" + + +; Auto Generated 20180205_163610.814 + diff --git a/src/bin/hamcore/DriverPackages/Neo6_Win8/x64/Neo6_x64_VPN123.inf b/src/bin/hamcore/DriverPackages/Neo6_Win8/x64/Neo6_x64_VPN123.inf index 47770540..2017833b 100644 --- a/src/bin/hamcore/DriverPackages/Neo6_Win8/x64/Neo6_x64_VPN123.inf +++ b/src/bin/hamcore/DriverPackages/Neo6_Win8/x64/Neo6_x64_VPN123.inf @@ -1,114 +1,114 @@ -; VPN Client Device Driver for Windows 2000 and Greater -; -; Copyright (c) SoftEther Corporation. All Rights Reserved. -; http://www.softether.co.jp/ -; -; BUILD 9658 - -[Version] -Signature = "$Windows NT$" -Class = Net -ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} -Provider = %CompanyName% -DriverVer = 02/04/2018, 4.25.0.9658 -CatalogFile.NT = inf_VPN123.cat - -[Manufacturer] -%CompanyName% = SoftEther, NTamd64 - -[SourceDisksNames] -1=%DiskDescription%, "", , - -[SourceDisksFiles] -Neo_VPN123.sys = 1 - -[DestinationDirs] -DefaultDestDir = 12 -Neo.CopyFiles.Sys = 12 - -[Neo.CopyFiles.Sys] -Neo_VPN123.sys, , , 2 - -[SoftEther.NTamd64] -%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN123 - -[NeoAdapter.Install] -Characteristics = 0x1 -AddReg = Neo.Reg, NeoAdapter.Ndi -CopyFiles = Neo.CopyFiles.Sys -*IfType = 53 -*MediaType = 0 -*PhysicalMediaType = 0 - -[NeoAdapter.Install.Services] -AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% - -[NeoAdapter.Ndi] -HKR, , NetworkAddress, 0, %DefaultAddress% -HKR, Ndi, DeviceID, , "NeoAdapter_VPN123" -HKR, , DevLoader, , ndis -HKR, , DeviceVxDs, , Neo_VPN123.sys -HKR, NDIS, LogDriverName, , "Neo_VPN123" -HKR, NDIS, MajorNdisVersion, 1, 5 -HKR, NDIS, MinorNdisVersion, 1, 0 -HKR, Ndi\Interfaces, DefUpper, , "ndis5" -HKR, Ndi\Interfaces, UpperRange, , "ndis5" -HKR, Ndi\Interfaces, LowerRange, , "ethernet" -HKR, Ndi\Interfaces, DefLower, , "ethernet" -HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" -HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% -HKR, Ndi\Params\NetworkAddress, type, 0, "edit" -HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" -HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" -HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% -HKR, Ndi\Params\NetworkAddress, optional, 0, "0" -HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% -HKR, Ndi\Params\MaxSpeed, type, 0, "int" -HKR, Ndi\Params\MaxSpeed, default, 0, "100" -HKR, Ndi\Params\MaxSpeed, min, 0, "0" -HKR, Ndi\Params\MaxSpeed, max, 0, "2000" -HKR, Ndi\Params\MaxSpeed, step, 0, "1" -HKR, Ndi\Params\MaxSpeed, Base, 0, "10" -HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% -HKR, Ndi\Params\KeepLink, type, 0, "enum" -HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% -HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% -HKR, Ndi\Params\KeepLink, default, 0, "0" - - -[Neo.Service] -DisplayName = %Neo.Service.DispName% -Description = %Neo.Service.Desc% -ServiceType = 1 -StartType = 3 -ErrorControl = 1 -ServiceBinary = %12%\Neo_VPN123.sys -LoadOrderGroup = NDIS - -[Neo.Reg] -HKR, Ndi, Service, 0, Neo.Service.Name -HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" -HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" - -[Neo.EventLog] -HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN123.sys" -HKR, , TypesSupported, 0x00010001, 7 - -[Strings] -CompanyName = "SoftEther Corporation" -DiskDescription = "VPN Client Device Driver Install Disk" -Neo.Service.Name = "Neo_VPN123" -Neo.Service.DispName = "VPN Client Device Driver - VPN123" -Neo.Service.Desc = "VPN Client Adapter - VPN123" -NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN123" -Neo.EventLog.Name = "Neo" -NetworkAddress = "MAC Address" -DefaultAddress = "000001000001" -MaxSpeed = "Indicate Speed (Mbps)" -KeepLink = "Keep Link" -On = "On" -Off = "Off" - - -; Auto Generated 20180205_163610.815 - +; VPN Client Device Driver for Windows 2000 and Greater +; +; Copyright (c) SoftEther Corporation. All Rights Reserved. +; http://www.softether.co.jp/ +; +; BUILD 9658 + +[Version] +Signature = "$Windows NT$" +Class = Net +ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} +Provider = %CompanyName% +DriverVer = 02/04/2018, 4.25.0.9658 +CatalogFile.NT = inf_VPN123.cat + +[Manufacturer] +%CompanyName% = SoftEther, NTamd64 + +[SourceDisksNames] +1=%DiskDescription%, "", , + +[SourceDisksFiles] +Neo_VPN123.sys = 1 + +[DestinationDirs] +DefaultDestDir = 12 +Neo.CopyFiles.Sys = 12 + +[Neo.CopyFiles.Sys] +Neo_VPN123.sys, , , 2 + +[SoftEther.NTamd64] +%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN123 + +[NeoAdapter.Install] +Characteristics = 0x1 +AddReg = Neo.Reg, NeoAdapter.Ndi +CopyFiles = Neo.CopyFiles.Sys +*IfType = 53 +*MediaType = 0 +*PhysicalMediaType = 0 + +[NeoAdapter.Install.Services] +AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% + +[NeoAdapter.Ndi] +HKR, , NetworkAddress, 0, %DefaultAddress% +HKR, Ndi, DeviceID, , "NeoAdapter_VPN123" +HKR, , DevLoader, , ndis +HKR, , DeviceVxDs, , Neo_VPN123.sys +HKR, NDIS, LogDriverName, , "Neo_VPN123" +HKR, NDIS, MajorNdisVersion, 1, 5 +HKR, NDIS, MinorNdisVersion, 1, 0 +HKR, Ndi\Interfaces, DefUpper, , "ndis5" +HKR, Ndi\Interfaces, UpperRange, , "ndis5" +HKR, Ndi\Interfaces, LowerRange, , "ethernet" +HKR, Ndi\Interfaces, DefLower, , "ethernet" +HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" +HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% +HKR, Ndi\Params\NetworkAddress, type, 0, "edit" +HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" +HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" +HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% +HKR, Ndi\Params\NetworkAddress, optional, 0, "0" +HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% +HKR, Ndi\Params\MaxSpeed, type, 0, "int" +HKR, Ndi\Params\MaxSpeed, default, 0, "100" +HKR, Ndi\Params\MaxSpeed, min, 0, "0" +HKR, Ndi\Params\MaxSpeed, max, 0, "2000" +HKR, Ndi\Params\MaxSpeed, step, 0, "1" +HKR, Ndi\Params\MaxSpeed, Base, 0, "10" +HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% +HKR, Ndi\Params\KeepLink, type, 0, "enum" +HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% +HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% +HKR, Ndi\Params\KeepLink, default, 0, "0" + + +[Neo.Service] +DisplayName = %Neo.Service.DispName% +Description = %Neo.Service.Desc% +ServiceType = 1 +StartType = 3 +ErrorControl = 1 +ServiceBinary = %12%\Neo_VPN123.sys +LoadOrderGroup = NDIS + +[Neo.Reg] +HKR, Ndi, Service, 0, Neo.Service.Name +HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" +HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" + +[Neo.EventLog] +HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN123.sys" +HKR, , TypesSupported, 0x00010001, 7 + +[Strings] +CompanyName = "SoftEther Corporation" +DiskDescription = "VPN Client Device Driver Install Disk" +Neo.Service.Name = "Neo_VPN123" +Neo.Service.DispName = "VPN Client Device Driver - VPN123" +Neo.Service.Desc = "VPN Client Adapter - VPN123" +NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN123" +Neo.EventLog.Name = "Neo" +NetworkAddress = "MAC Address" +DefaultAddress = "000001000001" +MaxSpeed = "Indicate Speed (Mbps)" +KeepLink = "Keep Link" +On = "On" +Off = "Off" + + +; Auto Generated 20180205_163610.815 + diff --git a/src/bin/hamcore/DriverPackages/Neo6_Win8/x64/Neo6_x64_VPN124.inf b/src/bin/hamcore/DriverPackages/Neo6_Win8/x64/Neo6_x64_VPN124.inf index aac0a57f..51f43706 100644 --- a/src/bin/hamcore/DriverPackages/Neo6_Win8/x64/Neo6_x64_VPN124.inf +++ b/src/bin/hamcore/DriverPackages/Neo6_Win8/x64/Neo6_x64_VPN124.inf @@ -1,114 +1,114 @@ -; VPN Client Device Driver for Windows 2000 and Greater -; -; Copyright (c) SoftEther Corporation. All Rights Reserved. -; http://www.softether.co.jp/ -; -; BUILD 9658 - -[Version] -Signature = "$Windows NT$" -Class = Net -ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} -Provider = %CompanyName% -DriverVer = 02/04/2018, 4.25.0.9658 -CatalogFile.NT = inf_VPN124.cat - -[Manufacturer] -%CompanyName% = SoftEther, NTamd64 - -[SourceDisksNames] -1=%DiskDescription%, "", , - -[SourceDisksFiles] -Neo_VPN124.sys = 1 - -[DestinationDirs] -DefaultDestDir = 12 -Neo.CopyFiles.Sys = 12 - -[Neo.CopyFiles.Sys] -Neo_VPN124.sys, , , 2 - -[SoftEther.NTamd64] -%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN124 - -[NeoAdapter.Install] -Characteristics = 0x1 -AddReg = Neo.Reg, NeoAdapter.Ndi -CopyFiles = Neo.CopyFiles.Sys -*IfType = 53 -*MediaType = 0 -*PhysicalMediaType = 0 - -[NeoAdapter.Install.Services] -AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% - -[NeoAdapter.Ndi] -HKR, , NetworkAddress, 0, %DefaultAddress% -HKR, Ndi, DeviceID, , "NeoAdapter_VPN124" -HKR, , DevLoader, , ndis -HKR, , DeviceVxDs, , Neo_VPN124.sys -HKR, NDIS, LogDriverName, , "Neo_VPN124" -HKR, NDIS, MajorNdisVersion, 1, 5 -HKR, NDIS, MinorNdisVersion, 1, 0 -HKR, Ndi\Interfaces, DefUpper, , "ndis5" -HKR, Ndi\Interfaces, UpperRange, , "ndis5" -HKR, Ndi\Interfaces, LowerRange, , "ethernet" -HKR, Ndi\Interfaces, DefLower, , "ethernet" -HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" -HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% -HKR, Ndi\Params\NetworkAddress, type, 0, "edit" -HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" -HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" -HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% -HKR, Ndi\Params\NetworkAddress, optional, 0, "0" -HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% -HKR, Ndi\Params\MaxSpeed, type, 0, "int" -HKR, Ndi\Params\MaxSpeed, default, 0, "100" -HKR, Ndi\Params\MaxSpeed, min, 0, "0" -HKR, Ndi\Params\MaxSpeed, max, 0, "2000" -HKR, Ndi\Params\MaxSpeed, step, 0, "1" -HKR, Ndi\Params\MaxSpeed, Base, 0, "10" -HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% -HKR, Ndi\Params\KeepLink, type, 0, "enum" -HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% -HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% -HKR, Ndi\Params\KeepLink, default, 0, "0" - - -[Neo.Service] -DisplayName = %Neo.Service.DispName% -Description = %Neo.Service.Desc% -ServiceType = 1 -StartType = 3 -ErrorControl = 1 -ServiceBinary = %12%\Neo_VPN124.sys -LoadOrderGroup = NDIS - -[Neo.Reg] -HKR, Ndi, Service, 0, Neo.Service.Name -HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" -HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" - -[Neo.EventLog] -HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN124.sys" -HKR, , TypesSupported, 0x00010001, 7 - -[Strings] -CompanyName = "SoftEther Corporation" -DiskDescription = "VPN Client Device Driver Install Disk" -Neo.Service.Name = "Neo_VPN124" -Neo.Service.DispName = "VPN Client Device Driver - VPN124" -Neo.Service.Desc = "VPN Client Adapter - VPN124" -NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN124" -Neo.EventLog.Name = "Neo" -NetworkAddress = "MAC Address" -DefaultAddress = "000001000001" -MaxSpeed = "Indicate Speed (Mbps)" -KeepLink = "Keep Link" -On = "On" -Off = "Off" - - -; Auto Generated 20180205_163610.816 - +; VPN Client Device Driver for Windows 2000 and Greater +; +; Copyright (c) SoftEther Corporation. All Rights Reserved. +; http://www.softether.co.jp/ +; +; BUILD 9658 + +[Version] +Signature = "$Windows NT$" +Class = Net +ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} +Provider = %CompanyName% +DriverVer = 02/04/2018, 4.25.0.9658 +CatalogFile.NT = inf_VPN124.cat + +[Manufacturer] +%CompanyName% = SoftEther, NTamd64 + +[SourceDisksNames] +1=%DiskDescription%, "", , + +[SourceDisksFiles] +Neo_VPN124.sys = 1 + +[DestinationDirs] +DefaultDestDir = 12 +Neo.CopyFiles.Sys = 12 + +[Neo.CopyFiles.Sys] +Neo_VPN124.sys, , , 2 + +[SoftEther.NTamd64] +%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN124 + +[NeoAdapter.Install] +Characteristics = 0x1 +AddReg = Neo.Reg, NeoAdapter.Ndi +CopyFiles = Neo.CopyFiles.Sys +*IfType = 53 +*MediaType = 0 +*PhysicalMediaType = 0 + +[NeoAdapter.Install.Services] +AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% + +[NeoAdapter.Ndi] +HKR, , NetworkAddress, 0, %DefaultAddress% +HKR, Ndi, DeviceID, , "NeoAdapter_VPN124" +HKR, , DevLoader, , ndis +HKR, , DeviceVxDs, , Neo_VPN124.sys +HKR, NDIS, LogDriverName, , "Neo_VPN124" +HKR, NDIS, MajorNdisVersion, 1, 5 +HKR, NDIS, MinorNdisVersion, 1, 0 +HKR, Ndi\Interfaces, DefUpper, , "ndis5" +HKR, Ndi\Interfaces, UpperRange, , "ndis5" +HKR, Ndi\Interfaces, LowerRange, , "ethernet" +HKR, Ndi\Interfaces, DefLower, , "ethernet" +HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" +HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% +HKR, Ndi\Params\NetworkAddress, type, 0, "edit" +HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" +HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" +HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% +HKR, Ndi\Params\NetworkAddress, optional, 0, "0" +HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% +HKR, Ndi\Params\MaxSpeed, type, 0, "int" +HKR, Ndi\Params\MaxSpeed, default, 0, "100" +HKR, Ndi\Params\MaxSpeed, min, 0, "0" +HKR, Ndi\Params\MaxSpeed, max, 0, "2000" +HKR, Ndi\Params\MaxSpeed, step, 0, "1" +HKR, Ndi\Params\MaxSpeed, Base, 0, "10" +HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% +HKR, Ndi\Params\KeepLink, type, 0, "enum" +HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% +HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% +HKR, Ndi\Params\KeepLink, default, 0, "0" + + +[Neo.Service] +DisplayName = %Neo.Service.DispName% +Description = %Neo.Service.Desc% +ServiceType = 1 +StartType = 3 +ErrorControl = 1 +ServiceBinary = %12%\Neo_VPN124.sys +LoadOrderGroup = NDIS + +[Neo.Reg] +HKR, Ndi, Service, 0, Neo.Service.Name +HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" +HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" + +[Neo.EventLog] +HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN124.sys" +HKR, , TypesSupported, 0x00010001, 7 + +[Strings] +CompanyName = "SoftEther Corporation" +DiskDescription = "VPN Client Device Driver Install Disk" +Neo.Service.Name = "Neo_VPN124" +Neo.Service.DispName = "VPN Client Device Driver - VPN124" +Neo.Service.Desc = "VPN Client Adapter - VPN124" +NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN124" +Neo.EventLog.Name = "Neo" +NetworkAddress = "MAC Address" +DefaultAddress = "000001000001" +MaxSpeed = "Indicate Speed (Mbps)" +KeepLink = "Keep Link" +On = "On" +Off = "Off" + + +; Auto Generated 20180205_163610.816 + diff --git a/src/bin/hamcore/DriverPackages/Neo6_Win8/x64/Neo6_x64_VPN125.inf b/src/bin/hamcore/DriverPackages/Neo6_Win8/x64/Neo6_x64_VPN125.inf index a1172a58..0fa15b64 100644 --- a/src/bin/hamcore/DriverPackages/Neo6_Win8/x64/Neo6_x64_VPN125.inf +++ b/src/bin/hamcore/DriverPackages/Neo6_Win8/x64/Neo6_x64_VPN125.inf @@ -1,114 +1,114 @@ -; VPN Client Device Driver for Windows 2000 and Greater -; -; Copyright (c) SoftEther Corporation. All Rights Reserved. -; http://www.softether.co.jp/ -; -; BUILD 9658 - -[Version] -Signature = "$Windows NT$" -Class = Net -ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} -Provider = %CompanyName% -DriverVer = 02/04/2018, 4.25.0.9658 -CatalogFile.NT = inf_VPN125.cat - -[Manufacturer] -%CompanyName% = SoftEther, NTamd64 - -[SourceDisksNames] -1=%DiskDescription%, "", , - -[SourceDisksFiles] -Neo_VPN125.sys = 1 - -[DestinationDirs] -DefaultDestDir = 12 -Neo.CopyFiles.Sys = 12 - -[Neo.CopyFiles.Sys] -Neo_VPN125.sys, , , 2 - -[SoftEther.NTamd64] -%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN125 - -[NeoAdapter.Install] -Characteristics = 0x1 -AddReg = Neo.Reg, NeoAdapter.Ndi -CopyFiles = Neo.CopyFiles.Sys -*IfType = 53 -*MediaType = 0 -*PhysicalMediaType = 0 - -[NeoAdapter.Install.Services] -AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% - -[NeoAdapter.Ndi] -HKR, , NetworkAddress, 0, %DefaultAddress% -HKR, Ndi, DeviceID, , "NeoAdapter_VPN125" -HKR, , DevLoader, , ndis -HKR, , DeviceVxDs, , Neo_VPN125.sys -HKR, NDIS, LogDriverName, , "Neo_VPN125" -HKR, NDIS, MajorNdisVersion, 1, 5 -HKR, NDIS, MinorNdisVersion, 1, 0 -HKR, Ndi\Interfaces, DefUpper, , "ndis5" -HKR, Ndi\Interfaces, UpperRange, , "ndis5" -HKR, Ndi\Interfaces, LowerRange, , "ethernet" -HKR, Ndi\Interfaces, DefLower, , "ethernet" -HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" -HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% -HKR, Ndi\Params\NetworkAddress, type, 0, "edit" -HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" -HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" -HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% -HKR, Ndi\Params\NetworkAddress, optional, 0, "0" -HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% -HKR, Ndi\Params\MaxSpeed, type, 0, "int" -HKR, Ndi\Params\MaxSpeed, default, 0, "100" -HKR, Ndi\Params\MaxSpeed, min, 0, "0" -HKR, Ndi\Params\MaxSpeed, max, 0, "2000" -HKR, Ndi\Params\MaxSpeed, step, 0, "1" -HKR, Ndi\Params\MaxSpeed, Base, 0, "10" -HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% -HKR, Ndi\Params\KeepLink, type, 0, "enum" -HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% -HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% -HKR, Ndi\Params\KeepLink, default, 0, "0" - - -[Neo.Service] -DisplayName = %Neo.Service.DispName% -Description = %Neo.Service.Desc% -ServiceType = 1 -StartType = 3 -ErrorControl = 1 -ServiceBinary = %12%\Neo_VPN125.sys -LoadOrderGroup = NDIS - -[Neo.Reg] -HKR, Ndi, Service, 0, Neo.Service.Name -HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" -HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" - -[Neo.EventLog] -HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN125.sys" -HKR, , TypesSupported, 0x00010001, 7 - -[Strings] -CompanyName = "SoftEther Corporation" -DiskDescription = "VPN Client Device Driver Install Disk" -Neo.Service.Name = "Neo_VPN125" -Neo.Service.DispName = "VPN Client Device Driver - VPN125" -Neo.Service.Desc = "VPN Client Adapter - VPN125" -NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN125" -Neo.EventLog.Name = "Neo" -NetworkAddress = "MAC Address" -DefaultAddress = "000001000001" -MaxSpeed = "Indicate Speed (Mbps)" -KeepLink = "Keep Link" -On = "On" -Off = "Off" - - -; Auto Generated 20180205_163610.816 - +; VPN Client Device Driver for Windows 2000 and Greater +; +; Copyright (c) SoftEther Corporation. All Rights Reserved. +; http://www.softether.co.jp/ +; +; BUILD 9658 + +[Version] +Signature = "$Windows NT$" +Class = Net +ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} +Provider = %CompanyName% +DriverVer = 02/04/2018, 4.25.0.9658 +CatalogFile.NT = inf_VPN125.cat + +[Manufacturer] +%CompanyName% = SoftEther, NTamd64 + +[SourceDisksNames] +1=%DiskDescription%, "", , + +[SourceDisksFiles] +Neo_VPN125.sys = 1 + +[DestinationDirs] +DefaultDestDir = 12 +Neo.CopyFiles.Sys = 12 + +[Neo.CopyFiles.Sys] +Neo_VPN125.sys, , , 2 + +[SoftEther.NTamd64] +%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN125 + +[NeoAdapter.Install] +Characteristics = 0x1 +AddReg = Neo.Reg, NeoAdapter.Ndi +CopyFiles = Neo.CopyFiles.Sys +*IfType = 53 +*MediaType = 0 +*PhysicalMediaType = 0 + +[NeoAdapter.Install.Services] +AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% + +[NeoAdapter.Ndi] +HKR, , NetworkAddress, 0, %DefaultAddress% +HKR, Ndi, DeviceID, , "NeoAdapter_VPN125" +HKR, , DevLoader, , ndis +HKR, , DeviceVxDs, , Neo_VPN125.sys +HKR, NDIS, LogDriverName, , "Neo_VPN125" +HKR, NDIS, MajorNdisVersion, 1, 5 +HKR, NDIS, MinorNdisVersion, 1, 0 +HKR, Ndi\Interfaces, DefUpper, , "ndis5" +HKR, Ndi\Interfaces, UpperRange, , "ndis5" +HKR, Ndi\Interfaces, LowerRange, , "ethernet" +HKR, Ndi\Interfaces, DefLower, , "ethernet" +HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" +HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% +HKR, Ndi\Params\NetworkAddress, type, 0, "edit" +HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" +HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" +HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% +HKR, Ndi\Params\NetworkAddress, optional, 0, "0" +HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% +HKR, Ndi\Params\MaxSpeed, type, 0, "int" +HKR, Ndi\Params\MaxSpeed, default, 0, "100" +HKR, Ndi\Params\MaxSpeed, min, 0, "0" +HKR, Ndi\Params\MaxSpeed, max, 0, "2000" +HKR, Ndi\Params\MaxSpeed, step, 0, "1" +HKR, Ndi\Params\MaxSpeed, Base, 0, "10" +HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% +HKR, Ndi\Params\KeepLink, type, 0, "enum" +HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% +HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% +HKR, Ndi\Params\KeepLink, default, 0, "0" + + +[Neo.Service] +DisplayName = %Neo.Service.DispName% +Description = %Neo.Service.Desc% +ServiceType = 1 +StartType = 3 +ErrorControl = 1 +ServiceBinary = %12%\Neo_VPN125.sys +LoadOrderGroup = NDIS + +[Neo.Reg] +HKR, Ndi, Service, 0, Neo.Service.Name +HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" +HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" + +[Neo.EventLog] +HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN125.sys" +HKR, , TypesSupported, 0x00010001, 7 + +[Strings] +CompanyName = "SoftEther Corporation" +DiskDescription = "VPN Client Device Driver Install Disk" +Neo.Service.Name = "Neo_VPN125" +Neo.Service.DispName = "VPN Client Device Driver - VPN125" +Neo.Service.Desc = "VPN Client Adapter - VPN125" +NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN125" +Neo.EventLog.Name = "Neo" +NetworkAddress = "MAC Address" +DefaultAddress = "000001000001" +MaxSpeed = "Indicate Speed (Mbps)" +KeepLink = "Keep Link" +On = "On" +Off = "Off" + + +; Auto Generated 20180205_163610.816 + diff --git a/src/bin/hamcore/DriverPackages/Neo6_Win8/x64/Neo6_x64_VPN126.inf b/src/bin/hamcore/DriverPackages/Neo6_Win8/x64/Neo6_x64_VPN126.inf index 15581c63..756a4152 100644 --- a/src/bin/hamcore/DriverPackages/Neo6_Win8/x64/Neo6_x64_VPN126.inf +++ b/src/bin/hamcore/DriverPackages/Neo6_Win8/x64/Neo6_x64_VPN126.inf @@ -1,114 +1,114 @@ -; VPN Client Device Driver for Windows 2000 and Greater -; -; Copyright (c) SoftEther Corporation. All Rights Reserved. -; http://www.softether.co.jp/ -; -; BUILD 9658 - -[Version] -Signature = "$Windows NT$" -Class = Net -ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} -Provider = %CompanyName% -DriverVer = 02/04/2018, 4.25.0.9658 -CatalogFile.NT = inf_VPN126.cat - -[Manufacturer] -%CompanyName% = SoftEther, NTamd64 - -[SourceDisksNames] -1=%DiskDescription%, "", , - -[SourceDisksFiles] -Neo_VPN126.sys = 1 - -[DestinationDirs] -DefaultDestDir = 12 -Neo.CopyFiles.Sys = 12 - -[Neo.CopyFiles.Sys] -Neo_VPN126.sys, , , 2 - -[SoftEther.NTamd64] -%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN126 - -[NeoAdapter.Install] -Characteristics = 0x1 -AddReg = Neo.Reg, NeoAdapter.Ndi -CopyFiles = Neo.CopyFiles.Sys -*IfType = 53 -*MediaType = 0 -*PhysicalMediaType = 0 - -[NeoAdapter.Install.Services] -AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% - -[NeoAdapter.Ndi] -HKR, , NetworkAddress, 0, %DefaultAddress% -HKR, Ndi, DeviceID, , "NeoAdapter_VPN126" -HKR, , DevLoader, , ndis -HKR, , DeviceVxDs, , Neo_VPN126.sys -HKR, NDIS, LogDriverName, , "Neo_VPN126" -HKR, NDIS, MajorNdisVersion, 1, 5 -HKR, NDIS, MinorNdisVersion, 1, 0 -HKR, Ndi\Interfaces, DefUpper, , "ndis5" -HKR, Ndi\Interfaces, UpperRange, , "ndis5" -HKR, Ndi\Interfaces, LowerRange, , "ethernet" -HKR, Ndi\Interfaces, DefLower, , "ethernet" -HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" -HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% -HKR, Ndi\Params\NetworkAddress, type, 0, "edit" -HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" -HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" -HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% -HKR, Ndi\Params\NetworkAddress, optional, 0, "0" -HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% -HKR, Ndi\Params\MaxSpeed, type, 0, "int" -HKR, Ndi\Params\MaxSpeed, default, 0, "100" -HKR, Ndi\Params\MaxSpeed, min, 0, "0" -HKR, Ndi\Params\MaxSpeed, max, 0, "2000" -HKR, Ndi\Params\MaxSpeed, step, 0, "1" -HKR, Ndi\Params\MaxSpeed, Base, 0, "10" -HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% -HKR, Ndi\Params\KeepLink, type, 0, "enum" -HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% -HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% -HKR, Ndi\Params\KeepLink, default, 0, "0" - - -[Neo.Service] -DisplayName = %Neo.Service.DispName% -Description = %Neo.Service.Desc% -ServiceType = 1 -StartType = 3 -ErrorControl = 1 -ServiceBinary = %12%\Neo_VPN126.sys -LoadOrderGroup = NDIS - -[Neo.Reg] -HKR, Ndi, Service, 0, Neo.Service.Name -HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" -HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" - -[Neo.EventLog] -HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN126.sys" -HKR, , TypesSupported, 0x00010001, 7 - -[Strings] -CompanyName = "SoftEther Corporation" -DiskDescription = "VPN Client Device Driver Install Disk" -Neo.Service.Name = "Neo_VPN126" -Neo.Service.DispName = "VPN Client Device Driver - VPN126" -Neo.Service.Desc = "VPN Client Adapter - VPN126" -NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN126" -Neo.EventLog.Name = "Neo" -NetworkAddress = "MAC Address" -DefaultAddress = "000001000001" -MaxSpeed = "Indicate Speed (Mbps)" -KeepLink = "Keep Link" -On = "On" -Off = "Off" - - -; Auto Generated 20180205_163610.817 - +; VPN Client Device Driver for Windows 2000 and Greater +; +; Copyright (c) SoftEther Corporation. All Rights Reserved. +; http://www.softether.co.jp/ +; +; BUILD 9658 + +[Version] +Signature = "$Windows NT$" +Class = Net +ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} +Provider = %CompanyName% +DriverVer = 02/04/2018, 4.25.0.9658 +CatalogFile.NT = inf_VPN126.cat + +[Manufacturer] +%CompanyName% = SoftEther, NTamd64 + +[SourceDisksNames] +1=%DiskDescription%, "", , + +[SourceDisksFiles] +Neo_VPN126.sys = 1 + +[DestinationDirs] +DefaultDestDir = 12 +Neo.CopyFiles.Sys = 12 + +[Neo.CopyFiles.Sys] +Neo_VPN126.sys, , , 2 + +[SoftEther.NTamd64] +%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN126 + +[NeoAdapter.Install] +Characteristics = 0x1 +AddReg = Neo.Reg, NeoAdapter.Ndi +CopyFiles = Neo.CopyFiles.Sys +*IfType = 53 +*MediaType = 0 +*PhysicalMediaType = 0 + +[NeoAdapter.Install.Services] +AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% + +[NeoAdapter.Ndi] +HKR, , NetworkAddress, 0, %DefaultAddress% +HKR, Ndi, DeviceID, , "NeoAdapter_VPN126" +HKR, , DevLoader, , ndis +HKR, , DeviceVxDs, , Neo_VPN126.sys +HKR, NDIS, LogDriverName, , "Neo_VPN126" +HKR, NDIS, MajorNdisVersion, 1, 5 +HKR, NDIS, MinorNdisVersion, 1, 0 +HKR, Ndi\Interfaces, DefUpper, , "ndis5" +HKR, Ndi\Interfaces, UpperRange, , "ndis5" +HKR, Ndi\Interfaces, LowerRange, , "ethernet" +HKR, Ndi\Interfaces, DefLower, , "ethernet" +HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" +HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% +HKR, Ndi\Params\NetworkAddress, type, 0, "edit" +HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" +HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" +HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% +HKR, Ndi\Params\NetworkAddress, optional, 0, "0" +HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% +HKR, Ndi\Params\MaxSpeed, type, 0, "int" +HKR, Ndi\Params\MaxSpeed, default, 0, "100" +HKR, Ndi\Params\MaxSpeed, min, 0, "0" +HKR, Ndi\Params\MaxSpeed, max, 0, "2000" +HKR, Ndi\Params\MaxSpeed, step, 0, "1" +HKR, Ndi\Params\MaxSpeed, Base, 0, "10" +HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% +HKR, Ndi\Params\KeepLink, type, 0, "enum" +HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% +HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% +HKR, Ndi\Params\KeepLink, default, 0, "0" + + +[Neo.Service] +DisplayName = %Neo.Service.DispName% +Description = %Neo.Service.Desc% +ServiceType = 1 +StartType = 3 +ErrorControl = 1 +ServiceBinary = %12%\Neo_VPN126.sys +LoadOrderGroup = NDIS + +[Neo.Reg] +HKR, Ndi, Service, 0, Neo.Service.Name +HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" +HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" + +[Neo.EventLog] +HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN126.sys" +HKR, , TypesSupported, 0x00010001, 7 + +[Strings] +CompanyName = "SoftEther Corporation" +DiskDescription = "VPN Client Device Driver Install Disk" +Neo.Service.Name = "Neo_VPN126" +Neo.Service.DispName = "VPN Client Device Driver - VPN126" +Neo.Service.Desc = "VPN Client Adapter - VPN126" +NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN126" +Neo.EventLog.Name = "Neo" +NetworkAddress = "MAC Address" +DefaultAddress = "000001000001" +MaxSpeed = "Indicate Speed (Mbps)" +KeepLink = "Keep Link" +On = "On" +Off = "Off" + + +; Auto Generated 20180205_163610.817 + diff --git a/src/bin/hamcore/DriverPackages/Neo6_Win8/x64/Neo6_x64_VPN127.inf b/src/bin/hamcore/DriverPackages/Neo6_Win8/x64/Neo6_x64_VPN127.inf index b82d7c19..4e663535 100644 --- a/src/bin/hamcore/DriverPackages/Neo6_Win8/x64/Neo6_x64_VPN127.inf +++ b/src/bin/hamcore/DriverPackages/Neo6_Win8/x64/Neo6_x64_VPN127.inf @@ -1,114 +1,114 @@ -; VPN Client Device Driver for Windows 2000 and Greater -; -; Copyright (c) SoftEther Corporation. All Rights Reserved. -; http://www.softether.co.jp/ -; -; BUILD 9658 - -[Version] -Signature = "$Windows NT$" -Class = Net -ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} -Provider = %CompanyName% -DriverVer = 02/04/2018, 4.25.0.9658 -CatalogFile.NT = inf_VPN127.cat - -[Manufacturer] -%CompanyName% = SoftEther, NTamd64 - -[SourceDisksNames] -1=%DiskDescription%, "", , - -[SourceDisksFiles] -Neo_VPN127.sys = 1 - -[DestinationDirs] -DefaultDestDir = 12 -Neo.CopyFiles.Sys = 12 - -[Neo.CopyFiles.Sys] -Neo_VPN127.sys, , , 2 - -[SoftEther.NTamd64] -%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN127 - -[NeoAdapter.Install] -Characteristics = 0x1 -AddReg = Neo.Reg, NeoAdapter.Ndi -CopyFiles = Neo.CopyFiles.Sys -*IfType = 53 -*MediaType = 0 -*PhysicalMediaType = 0 - -[NeoAdapter.Install.Services] -AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% - -[NeoAdapter.Ndi] -HKR, , NetworkAddress, 0, %DefaultAddress% -HKR, Ndi, DeviceID, , "NeoAdapter_VPN127" -HKR, , DevLoader, , ndis -HKR, , DeviceVxDs, , Neo_VPN127.sys -HKR, NDIS, LogDriverName, , "Neo_VPN127" -HKR, NDIS, MajorNdisVersion, 1, 5 -HKR, NDIS, MinorNdisVersion, 1, 0 -HKR, Ndi\Interfaces, DefUpper, , "ndis5" -HKR, Ndi\Interfaces, UpperRange, , "ndis5" -HKR, Ndi\Interfaces, LowerRange, , "ethernet" -HKR, Ndi\Interfaces, DefLower, , "ethernet" -HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" -HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% -HKR, Ndi\Params\NetworkAddress, type, 0, "edit" -HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" -HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" -HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% -HKR, Ndi\Params\NetworkAddress, optional, 0, "0" -HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% -HKR, Ndi\Params\MaxSpeed, type, 0, "int" -HKR, Ndi\Params\MaxSpeed, default, 0, "100" -HKR, Ndi\Params\MaxSpeed, min, 0, "0" -HKR, Ndi\Params\MaxSpeed, max, 0, "2000" -HKR, Ndi\Params\MaxSpeed, step, 0, "1" -HKR, Ndi\Params\MaxSpeed, Base, 0, "10" -HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% -HKR, Ndi\Params\KeepLink, type, 0, "enum" -HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% -HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% -HKR, Ndi\Params\KeepLink, default, 0, "0" - - -[Neo.Service] -DisplayName = %Neo.Service.DispName% -Description = %Neo.Service.Desc% -ServiceType = 1 -StartType = 3 -ErrorControl = 1 -ServiceBinary = %12%\Neo_VPN127.sys -LoadOrderGroup = NDIS - -[Neo.Reg] -HKR, Ndi, Service, 0, Neo.Service.Name -HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" -HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" - -[Neo.EventLog] -HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN127.sys" -HKR, , TypesSupported, 0x00010001, 7 - -[Strings] -CompanyName = "SoftEther Corporation" -DiskDescription = "VPN Client Device Driver Install Disk" -Neo.Service.Name = "Neo_VPN127" -Neo.Service.DispName = "VPN Client Device Driver - VPN127" -Neo.Service.Desc = "VPN Client Adapter - VPN127" -NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN127" -Neo.EventLog.Name = "Neo" -NetworkAddress = "MAC Address" -DefaultAddress = "000001000001" -MaxSpeed = "Indicate Speed (Mbps)" -KeepLink = "Keep Link" -On = "On" -Off = "Off" - - -; Auto Generated 20180205_163610.818 - +; VPN Client Device Driver for Windows 2000 and Greater +; +; Copyright (c) SoftEther Corporation. All Rights Reserved. +; http://www.softether.co.jp/ +; +; BUILD 9658 + +[Version] +Signature = "$Windows NT$" +Class = Net +ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} +Provider = %CompanyName% +DriverVer = 02/04/2018, 4.25.0.9658 +CatalogFile.NT = inf_VPN127.cat + +[Manufacturer] +%CompanyName% = SoftEther, NTamd64 + +[SourceDisksNames] +1=%DiskDescription%, "", , + +[SourceDisksFiles] +Neo_VPN127.sys = 1 + +[DestinationDirs] +DefaultDestDir = 12 +Neo.CopyFiles.Sys = 12 + +[Neo.CopyFiles.Sys] +Neo_VPN127.sys, , , 2 + +[SoftEther.NTamd64] +%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN127 + +[NeoAdapter.Install] +Characteristics = 0x1 +AddReg = Neo.Reg, NeoAdapter.Ndi +CopyFiles = Neo.CopyFiles.Sys +*IfType = 53 +*MediaType = 0 +*PhysicalMediaType = 0 + +[NeoAdapter.Install.Services] +AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% + +[NeoAdapter.Ndi] +HKR, , NetworkAddress, 0, %DefaultAddress% +HKR, Ndi, DeviceID, , "NeoAdapter_VPN127" +HKR, , DevLoader, , ndis +HKR, , DeviceVxDs, , Neo_VPN127.sys +HKR, NDIS, LogDriverName, , "Neo_VPN127" +HKR, NDIS, MajorNdisVersion, 1, 5 +HKR, NDIS, MinorNdisVersion, 1, 0 +HKR, Ndi\Interfaces, DefUpper, , "ndis5" +HKR, Ndi\Interfaces, UpperRange, , "ndis5" +HKR, Ndi\Interfaces, LowerRange, , "ethernet" +HKR, Ndi\Interfaces, DefLower, , "ethernet" +HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" +HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% +HKR, Ndi\Params\NetworkAddress, type, 0, "edit" +HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" +HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" +HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% +HKR, Ndi\Params\NetworkAddress, optional, 0, "0" +HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% +HKR, Ndi\Params\MaxSpeed, type, 0, "int" +HKR, Ndi\Params\MaxSpeed, default, 0, "100" +HKR, Ndi\Params\MaxSpeed, min, 0, "0" +HKR, Ndi\Params\MaxSpeed, max, 0, "2000" +HKR, Ndi\Params\MaxSpeed, step, 0, "1" +HKR, Ndi\Params\MaxSpeed, Base, 0, "10" +HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% +HKR, Ndi\Params\KeepLink, type, 0, "enum" +HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% +HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% +HKR, Ndi\Params\KeepLink, default, 0, "0" + + +[Neo.Service] +DisplayName = %Neo.Service.DispName% +Description = %Neo.Service.Desc% +ServiceType = 1 +StartType = 3 +ErrorControl = 1 +ServiceBinary = %12%\Neo_VPN127.sys +LoadOrderGroup = NDIS + +[Neo.Reg] +HKR, Ndi, Service, 0, Neo.Service.Name +HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" +HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" + +[Neo.EventLog] +HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN127.sys" +HKR, , TypesSupported, 0x00010001, 7 + +[Strings] +CompanyName = "SoftEther Corporation" +DiskDescription = "VPN Client Device Driver Install Disk" +Neo.Service.Name = "Neo_VPN127" +Neo.Service.DispName = "VPN Client Device Driver - VPN127" +Neo.Service.Desc = "VPN Client Adapter - VPN127" +NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN127" +Neo.EventLog.Name = "Neo" +NetworkAddress = "MAC Address" +DefaultAddress = "000001000001" +MaxSpeed = "Indicate Speed (Mbps)" +KeepLink = "Keep Link" +On = "On" +Off = "Off" + + +; Auto Generated 20180205_163610.818 + diff --git a/src/bin/hamcore/DriverPackages/Neo6_Win8/x64/Neo6_x64_VPN13.inf b/src/bin/hamcore/DriverPackages/Neo6_Win8/x64/Neo6_x64_VPN13.inf index 242a2189..ba5055cf 100644 --- a/src/bin/hamcore/DriverPackages/Neo6_Win8/x64/Neo6_x64_VPN13.inf +++ b/src/bin/hamcore/DriverPackages/Neo6_Win8/x64/Neo6_x64_VPN13.inf @@ -1,114 +1,114 @@ -; VPN Client Device Driver for Windows 2000 and Greater -; -; Copyright (c) SoftEther Corporation. All Rights Reserved. -; http://www.softether.co.jp/ -; -; BUILD 9658 - -[Version] -Signature = "$Windows NT$" -Class = Net -ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} -Provider = %CompanyName% -DriverVer = 02/04/2018, 4.25.0.9658 -CatalogFile.NT = inf_VPN13.cat - -[Manufacturer] -%CompanyName% = SoftEther, NTamd64 - -[SourceDisksNames] -1=%DiskDescription%, "", , - -[SourceDisksFiles] -Neo_VPN13.sys = 1 - -[DestinationDirs] -DefaultDestDir = 12 -Neo.CopyFiles.Sys = 12 - -[Neo.CopyFiles.Sys] -Neo_VPN13.sys, , , 2 - -[SoftEther.NTamd64] -%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN13 - -[NeoAdapter.Install] -Characteristics = 0x1 -AddReg = Neo.Reg, NeoAdapter.Ndi -CopyFiles = Neo.CopyFiles.Sys -*IfType = 53 -*MediaType = 0 -*PhysicalMediaType = 0 - -[NeoAdapter.Install.Services] -AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% - -[NeoAdapter.Ndi] -HKR, , NetworkAddress, 0, %DefaultAddress% -HKR, Ndi, DeviceID, , "NeoAdapter_VPN13" -HKR, , DevLoader, , ndis -HKR, , DeviceVxDs, , Neo_VPN13.sys -HKR, NDIS, LogDriverName, , "Neo_VPN13" -HKR, NDIS, MajorNdisVersion, 1, 5 -HKR, NDIS, MinorNdisVersion, 1, 0 -HKR, Ndi\Interfaces, DefUpper, , "ndis5" -HKR, Ndi\Interfaces, UpperRange, , "ndis5" -HKR, Ndi\Interfaces, LowerRange, , "ethernet" -HKR, Ndi\Interfaces, DefLower, , "ethernet" -HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" -HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% -HKR, Ndi\Params\NetworkAddress, type, 0, "edit" -HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" -HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" -HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% -HKR, Ndi\Params\NetworkAddress, optional, 0, "0" -HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% -HKR, Ndi\Params\MaxSpeed, type, 0, "int" -HKR, Ndi\Params\MaxSpeed, default, 0, "100" -HKR, Ndi\Params\MaxSpeed, min, 0, "0" -HKR, Ndi\Params\MaxSpeed, max, 0, "2000" -HKR, Ndi\Params\MaxSpeed, step, 0, "1" -HKR, Ndi\Params\MaxSpeed, Base, 0, "10" -HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% -HKR, Ndi\Params\KeepLink, type, 0, "enum" -HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% -HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% -HKR, Ndi\Params\KeepLink, default, 0, "0" - - -[Neo.Service] -DisplayName = %Neo.Service.DispName% -Description = %Neo.Service.Desc% -ServiceType = 1 -StartType = 3 -ErrorControl = 1 -ServiceBinary = %12%\Neo_VPN13.sys -LoadOrderGroup = NDIS - -[Neo.Reg] -HKR, Ndi, Service, 0, Neo.Service.Name -HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" -HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" - -[Neo.EventLog] -HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN13.sys" -HKR, , TypesSupported, 0x00010001, 7 - -[Strings] -CompanyName = "SoftEther Corporation" -DiskDescription = "VPN Client Device Driver Install Disk" -Neo.Service.Name = "Neo_VPN13" -Neo.Service.DispName = "VPN Client Device Driver - VPN13" -Neo.Service.Desc = "VPN Client Adapter - VPN13" -NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN13" -Neo.EventLog.Name = "Neo" -NetworkAddress = "MAC Address" -DefaultAddress = "000001000001" -MaxSpeed = "Indicate Speed (Mbps)" -KeepLink = "Keep Link" -On = "On" -Off = "Off" - - -; Auto Generated 20180205_163610.745 - +; VPN Client Device Driver for Windows 2000 and Greater +; +; Copyright (c) SoftEther Corporation. All Rights Reserved. +; http://www.softether.co.jp/ +; +; BUILD 9658 + +[Version] +Signature = "$Windows NT$" +Class = Net +ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} +Provider = %CompanyName% +DriverVer = 02/04/2018, 4.25.0.9658 +CatalogFile.NT = inf_VPN13.cat + +[Manufacturer] +%CompanyName% = SoftEther, NTamd64 + +[SourceDisksNames] +1=%DiskDescription%, "", , + +[SourceDisksFiles] +Neo_VPN13.sys = 1 + +[DestinationDirs] +DefaultDestDir = 12 +Neo.CopyFiles.Sys = 12 + +[Neo.CopyFiles.Sys] +Neo_VPN13.sys, , , 2 + +[SoftEther.NTamd64] +%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN13 + +[NeoAdapter.Install] +Characteristics = 0x1 +AddReg = Neo.Reg, NeoAdapter.Ndi +CopyFiles = Neo.CopyFiles.Sys +*IfType = 53 +*MediaType = 0 +*PhysicalMediaType = 0 + +[NeoAdapter.Install.Services] +AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% + +[NeoAdapter.Ndi] +HKR, , NetworkAddress, 0, %DefaultAddress% +HKR, Ndi, DeviceID, , "NeoAdapter_VPN13" +HKR, , DevLoader, , ndis +HKR, , DeviceVxDs, , Neo_VPN13.sys +HKR, NDIS, LogDriverName, , "Neo_VPN13" +HKR, NDIS, MajorNdisVersion, 1, 5 +HKR, NDIS, MinorNdisVersion, 1, 0 +HKR, Ndi\Interfaces, DefUpper, , "ndis5" +HKR, Ndi\Interfaces, UpperRange, , "ndis5" +HKR, Ndi\Interfaces, LowerRange, , "ethernet" +HKR, Ndi\Interfaces, DefLower, , "ethernet" +HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" +HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% +HKR, Ndi\Params\NetworkAddress, type, 0, "edit" +HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" +HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" +HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% +HKR, Ndi\Params\NetworkAddress, optional, 0, "0" +HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% +HKR, Ndi\Params\MaxSpeed, type, 0, "int" +HKR, Ndi\Params\MaxSpeed, default, 0, "100" +HKR, Ndi\Params\MaxSpeed, min, 0, "0" +HKR, Ndi\Params\MaxSpeed, max, 0, "2000" +HKR, Ndi\Params\MaxSpeed, step, 0, "1" +HKR, Ndi\Params\MaxSpeed, Base, 0, "10" +HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% +HKR, Ndi\Params\KeepLink, type, 0, "enum" +HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% +HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% +HKR, Ndi\Params\KeepLink, default, 0, "0" + + +[Neo.Service] +DisplayName = %Neo.Service.DispName% +Description = %Neo.Service.Desc% +ServiceType = 1 +StartType = 3 +ErrorControl = 1 +ServiceBinary = %12%\Neo_VPN13.sys +LoadOrderGroup = NDIS + +[Neo.Reg] +HKR, Ndi, Service, 0, Neo.Service.Name +HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" +HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" + +[Neo.EventLog] +HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN13.sys" +HKR, , TypesSupported, 0x00010001, 7 + +[Strings] +CompanyName = "SoftEther Corporation" +DiskDescription = "VPN Client Device Driver Install Disk" +Neo.Service.Name = "Neo_VPN13" +Neo.Service.DispName = "VPN Client Device Driver - VPN13" +Neo.Service.Desc = "VPN Client Adapter - VPN13" +NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN13" +Neo.EventLog.Name = "Neo" +NetworkAddress = "MAC Address" +DefaultAddress = "000001000001" +MaxSpeed = "Indicate Speed (Mbps)" +KeepLink = "Keep Link" +On = "On" +Off = "Off" + + +; Auto Generated 20180205_163610.745 + diff --git a/src/bin/hamcore/DriverPackages/Neo6_Win8/x64/Neo6_x64_VPN14.inf b/src/bin/hamcore/DriverPackages/Neo6_Win8/x64/Neo6_x64_VPN14.inf index ec310079..316309ff 100644 --- a/src/bin/hamcore/DriverPackages/Neo6_Win8/x64/Neo6_x64_VPN14.inf +++ b/src/bin/hamcore/DriverPackages/Neo6_Win8/x64/Neo6_x64_VPN14.inf @@ -1,114 +1,114 @@ -; VPN Client Device Driver for Windows 2000 and Greater -; -; Copyright (c) SoftEther Corporation. All Rights Reserved. -; http://www.softether.co.jp/ -; -; BUILD 9658 - -[Version] -Signature = "$Windows NT$" -Class = Net -ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} -Provider = %CompanyName% -DriverVer = 02/04/2018, 4.25.0.9658 -CatalogFile.NT = inf_VPN14.cat - -[Manufacturer] -%CompanyName% = SoftEther, NTamd64 - -[SourceDisksNames] -1=%DiskDescription%, "", , - -[SourceDisksFiles] -Neo_VPN14.sys = 1 - -[DestinationDirs] -DefaultDestDir = 12 -Neo.CopyFiles.Sys = 12 - -[Neo.CopyFiles.Sys] -Neo_VPN14.sys, , , 2 - -[SoftEther.NTamd64] -%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN14 - -[NeoAdapter.Install] -Characteristics = 0x1 -AddReg = Neo.Reg, NeoAdapter.Ndi -CopyFiles = Neo.CopyFiles.Sys -*IfType = 53 -*MediaType = 0 -*PhysicalMediaType = 0 - -[NeoAdapter.Install.Services] -AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% - -[NeoAdapter.Ndi] -HKR, , NetworkAddress, 0, %DefaultAddress% -HKR, Ndi, DeviceID, , "NeoAdapter_VPN14" -HKR, , DevLoader, , ndis -HKR, , DeviceVxDs, , Neo_VPN14.sys -HKR, NDIS, LogDriverName, , "Neo_VPN14" -HKR, NDIS, MajorNdisVersion, 1, 5 -HKR, NDIS, MinorNdisVersion, 1, 0 -HKR, Ndi\Interfaces, DefUpper, , "ndis5" -HKR, Ndi\Interfaces, UpperRange, , "ndis5" -HKR, Ndi\Interfaces, LowerRange, , "ethernet" -HKR, Ndi\Interfaces, DefLower, , "ethernet" -HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" -HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% -HKR, Ndi\Params\NetworkAddress, type, 0, "edit" -HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" -HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" -HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% -HKR, Ndi\Params\NetworkAddress, optional, 0, "0" -HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% -HKR, Ndi\Params\MaxSpeed, type, 0, "int" -HKR, Ndi\Params\MaxSpeed, default, 0, "100" -HKR, Ndi\Params\MaxSpeed, min, 0, "0" -HKR, Ndi\Params\MaxSpeed, max, 0, "2000" -HKR, Ndi\Params\MaxSpeed, step, 0, "1" -HKR, Ndi\Params\MaxSpeed, Base, 0, "10" -HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% -HKR, Ndi\Params\KeepLink, type, 0, "enum" -HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% -HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% -HKR, Ndi\Params\KeepLink, default, 0, "0" - - -[Neo.Service] -DisplayName = %Neo.Service.DispName% -Description = %Neo.Service.Desc% -ServiceType = 1 -StartType = 3 -ErrorControl = 1 -ServiceBinary = %12%\Neo_VPN14.sys -LoadOrderGroup = NDIS - -[Neo.Reg] -HKR, Ndi, Service, 0, Neo.Service.Name -HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" -HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" - -[Neo.EventLog] -HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN14.sys" -HKR, , TypesSupported, 0x00010001, 7 - -[Strings] -CompanyName = "SoftEther Corporation" -DiskDescription = "VPN Client Device Driver Install Disk" -Neo.Service.Name = "Neo_VPN14" -Neo.Service.DispName = "VPN Client Device Driver - VPN14" -Neo.Service.Desc = "VPN Client Adapter - VPN14" -NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN14" -Neo.EventLog.Name = "Neo" -NetworkAddress = "MAC Address" -DefaultAddress = "000001000001" -MaxSpeed = "Indicate Speed (Mbps)" -KeepLink = "Keep Link" -On = "On" -Off = "Off" - - -; Auto Generated 20180205_163610.746 - +; VPN Client Device Driver for Windows 2000 and Greater +; +; Copyright (c) SoftEther Corporation. All Rights Reserved. +; http://www.softether.co.jp/ +; +; BUILD 9658 + +[Version] +Signature = "$Windows NT$" +Class = Net +ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} +Provider = %CompanyName% +DriverVer = 02/04/2018, 4.25.0.9658 +CatalogFile.NT = inf_VPN14.cat + +[Manufacturer] +%CompanyName% = SoftEther, NTamd64 + +[SourceDisksNames] +1=%DiskDescription%, "", , + +[SourceDisksFiles] +Neo_VPN14.sys = 1 + +[DestinationDirs] +DefaultDestDir = 12 +Neo.CopyFiles.Sys = 12 + +[Neo.CopyFiles.Sys] +Neo_VPN14.sys, , , 2 + +[SoftEther.NTamd64] +%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN14 + +[NeoAdapter.Install] +Characteristics = 0x1 +AddReg = Neo.Reg, NeoAdapter.Ndi +CopyFiles = Neo.CopyFiles.Sys +*IfType = 53 +*MediaType = 0 +*PhysicalMediaType = 0 + +[NeoAdapter.Install.Services] +AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% + +[NeoAdapter.Ndi] +HKR, , NetworkAddress, 0, %DefaultAddress% +HKR, Ndi, DeviceID, , "NeoAdapter_VPN14" +HKR, , DevLoader, , ndis +HKR, , DeviceVxDs, , Neo_VPN14.sys +HKR, NDIS, LogDriverName, , "Neo_VPN14" +HKR, NDIS, MajorNdisVersion, 1, 5 +HKR, NDIS, MinorNdisVersion, 1, 0 +HKR, Ndi\Interfaces, DefUpper, , "ndis5" +HKR, Ndi\Interfaces, UpperRange, , "ndis5" +HKR, Ndi\Interfaces, LowerRange, , "ethernet" +HKR, Ndi\Interfaces, DefLower, , "ethernet" +HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" +HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% +HKR, Ndi\Params\NetworkAddress, type, 0, "edit" +HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" +HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" +HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% +HKR, Ndi\Params\NetworkAddress, optional, 0, "0" +HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% +HKR, Ndi\Params\MaxSpeed, type, 0, "int" +HKR, Ndi\Params\MaxSpeed, default, 0, "100" +HKR, Ndi\Params\MaxSpeed, min, 0, "0" +HKR, Ndi\Params\MaxSpeed, max, 0, "2000" +HKR, Ndi\Params\MaxSpeed, step, 0, "1" +HKR, Ndi\Params\MaxSpeed, Base, 0, "10" +HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% +HKR, Ndi\Params\KeepLink, type, 0, "enum" +HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% +HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% +HKR, Ndi\Params\KeepLink, default, 0, "0" + + +[Neo.Service] +DisplayName = %Neo.Service.DispName% +Description = %Neo.Service.Desc% +ServiceType = 1 +StartType = 3 +ErrorControl = 1 +ServiceBinary = %12%\Neo_VPN14.sys +LoadOrderGroup = NDIS + +[Neo.Reg] +HKR, Ndi, Service, 0, Neo.Service.Name +HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" +HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" + +[Neo.EventLog] +HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN14.sys" +HKR, , TypesSupported, 0x00010001, 7 + +[Strings] +CompanyName = "SoftEther Corporation" +DiskDescription = "VPN Client Device Driver Install Disk" +Neo.Service.Name = "Neo_VPN14" +Neo.Service.DispName = "VPN Client Device Driver - VPN14" +Neo.Service.Desc = "VPN Client Adapter - VPN14" +NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN14" +Neo.EventLog.Name = "Neo" +NetworkAddress = "MAC Address" +DefaultAddress = "000001000001" +MaxSpeed = "Indicate Speed (Mbps)" +KeepLink = "Keep Link" +On = "On" +Off = "Off" + + +; Auto Generated 20180205_163610.746 + diff --git a/src/bin/hamcore/DriverPackages/Neo6_Win8/x64/Neo6_x64_VPN15.inf b/src/bin/hamcore/DriverPackages/Neo6_Win8/x64/Neo6_x64_VPN15.inf index acd0bd17..7b0dd0ad 100644 --- a/src/bin/hamcore/DriverPackages/Neo6_Win8/x64/Neo6_x64_VPN15.inf +++ b/src/bin/hamcore/DriverPackages/Neo6_Win8/x64/Neo6_x64_VPN15.inf @@ -1,114 +1,114 @@ -; VPN Client Device Driver for Windows 2000 and Greater -; -; Copyright (c) SoftEther Corporation. All Rights Reserved. -; http://www.softether.co.jp/ -; -; BUILD 9658 - -[Version] -Signature = "$Windows NT$" -Class = Net -ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} -Provider = %CompanyName% -DriverVer = 02/04/2018, 4.25.0.9658 -CatalogFile.NT = inf_VPN15.cat - -[Manufacturer] -%CompanyName% = SoftEther, NTamd64 - -[SourceDisksNames] -1=%DiskDescription%, "", , - -[SourceDisksFiles] -Neo_VPN15.sys = 1 - -[DestinationDirs] -DefaultDestDir = 12 -Neo.CopyFiles.Sys = 12 - -[Neo.CopyFiles.Sys] -Neo_VPN15.sys, , , 2 - -[SoftEther.NTamd64] -%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN15 - -[NeoAdapter.Install] -Characteristics = 0x1 -AddReg = Neo.Reg, NeoAdapter.Ndi -CopyFiles = Neo.CopyFiles.Sys -*IfType = 53 -*MediaType = 0 -*PhysicalMediaType = 0 - -[NeoAdapter.Install.Services] -AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% - -[NeoAdapter.Ndi] -HKR, , NetworkAddress, 0, %DefaultAddress% -HKR, Ndi, DeviceID, , "NeoAdapter_VPN15" -HKR, , DevLoader, , ndis -HKR, , DeviceVxDs, , Neo_VPN15.sys -HKR, NDIS, LogDriverName, , "Neo_VPN15" -HKR, NDIS, MajorNdisVersion, 1, 5 -HKR, NDIS, MinorNdisVersion, 1, 0 -HKR, Ndi\Interfaces, DefUpper, , "ndis5" -HKR, Ndi\Interfaces, UpperRange, , "ndis5" -HKR, Ndi\Interfaces, LowerRange, , "ethernet" -HKR, Ndi\Interfaces, DefLower, , "ethernet" -HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" -HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% -HKR, Ndi\Params\NetworkAddress, type, 0, "edit" -HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" -HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" -HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% -HKR, Ndi\Params\NetworkAddress, optional, 0, "0" -HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% -HKR, Ndi\Params\MaxSpeed, type, 0, "int" -HKR, Ndi\Params\MaxSpeed, default, 0, "100" -HKR, Ndi\Params\MaxSpeed, min, 0, "0" -HKR, Ndi\Params\MaxSpeed, max, 0, "2000" -HKR, Ndi\Params\MaxSpeed, step, 0, "1" -HKR, Ndi\Params\MaxSpeed, Base, 0, "10" -HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% -HKR, Ndi\Params\KeepLink, type, 0, "enum" -HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% -HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% -HKR, Ndi\Params\KeepLink, default, 0, "0" - - -[Neo.Service] -DisplayName = %Neo.Service.DispName% -Description = %Neo.Service.Desc% -ServiceType = 1 -StartType = 3 -ErrorControl = 1 -ServiceBinary = %12%\Neo_VPN15.sys -LoadOrderGroup = NDIS - -[Neo.Reg] -HKR, Ndi, Service, 0, Neo.Service.Name -HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" -HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" - -[Neo.EventLog] -HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN15.sys" -HKR, , TypesSupported, 0x00010001, 7 - -[Strings] -CompanyName = "SoftEther Corporation" -DiskDescription = "VPN Client Device Driver Install Disk" -Neo.Service.Name = "Neo_VPN15" -Neo.Service.DispName = "VPN Client Device Driver - VPN15" -Neo.Service.Desc = "VPN Client Adapter - VPN15" -NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN15" -Neo.EventLog.Name = "Neo" -NetworkAddress = "MAC Address" -DefaultAddress = "000001000001" -MaxSpeed = "Indicate Speed (Mbps)" -KeepLink = "Keep Link" -On = "On" -Off = "Off" - - -; Auto Generated 20180205_163610.746 - +; VPN Client Device Driver for Windows 2000 and Greater +; +; Copyright (c) SoftEther Corporation. All Rights Reserved. +; http://www.softether.co.jp/ +; +; BUILD 9658 + +[Version] +Signature = "$Windows NT$" +Class = Net +ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} +Provider = %CompanyName% +DriverVer = 02/04/2018, 4.25.0.9658 +CatalogFile.NT = inf_VPN15.cat + +[Manufacturer] +%CompanyName% = SoftEther, NTamd64 + +[SourceDisksNames] +1=%DiskDescription%, "", , + +[SourceDisksFiles] +Neo_VPN15.sys = 1 + +[DestinationDirs] +DefaultDestDir = 12 +Neo.CopyFiles.Sys = 12 + +[Neo.CopyFiles.Sys] +Neo_VPN15.sys, , , 2 + +[SoftEther.NTamd64] +%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN15 + +[NeoAdapter.Install] +Characteristics = 0x1 +AddReg = Neo.Reg, NeoAdapter.Ndi +CopyFiles = Neo.CopyFiles.Sys +*IfType = 53 +*MediaType = 0 +*PhysicalMediaType = 0 + +[NeoAdapter.Install.Services] +AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% + +[NeoAdapter.Ndi] +HKR, , NetworkAddress, 0, %DefaultAddress% +HKR, Ndi, DeviceID, , "NeoAdapter_VPN15" +HKR, , DevLoader, , ndis +HKR, , DeviceVxDs, , Neo_VPN15.sys +HKR, NDIS, LogDriverName, , "Neo_VPN15" +HKR, NDIS, MajorNdisVersion, 1, 5 +HKR, NDIS, MinorNdisVersion, 1, 0 +HKR, Ndi\Interfaces, DefUpper, , "ndis5" +HKR, Ndi\Interfaces, UpperRange, , "ndis5" +HKR, Ndi\Interfaces, LowerRange, , "ethernet" +HKR, Ndi\Interfaces, DefLower, , "ethernet" +HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" +HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% +HKR, Ndi\Params\NetworkAddress, type, 0, "edit" +HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" +HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" +HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% +HKR, Ndi\Params\NetworkAddress, optional, 0, "0" +HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% +HKR, Ndi\Params\MaxSpeed, type, 0, "int" +HKR, Ndi\Params\MaxSpeed, default, 0, "100" +HKR, Ndi\Params\MaxSpeed, min, 0, "0" +HKR, Ndi\Params\MaxSpeed, max, 0, "2000" +HKR, Ndi\Params\MaxSpeed, step, 0, "1" +HKR, Ndi\Params\MaxSpeed, Base, 0, "10" +HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% +HKR, Ndi\Params\KeepLink, type, 0, "enum" +HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% +HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% +HKR, Ndi\Params\KeepLink, default, 0, "0" + + +[Neo.Service] +DisplayName = %Neo.Service.DispName% +Description = %Neo.Service.Desc% +ServiceType = 1 +StartType = 3 +ErrorControl = 1 +ServiceBinary = %12%\Neo_VPN15.sys +LoadOrderGroup = NDIS + +[Neo.Reg] +HKR, Ndi, Service, 0, Neo.Service.Name +HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" +HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" + +[Neo.EventLog] +HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN15.sys" +HKR, , TypesSupported, 0x00010001, 7 + +[Strings] +CompanyName = "SoftEther Corporation" +DiskDescription = "VPN Client Device Driver Install Disk" +Neo.Service.Name = "Neo_VPN15" +Neo.Service.DispName = "VPN Client Device Driver - VPN15" +Neo.Service.Desc = "VPN Client Adapter - VPN15" +NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN15" +Neo.EventLog.Name = "Neo" +NetworkAddress = "MAC Address" +DefaultAddress = "000001000001" +MaxSpeed = "Indicate Speed (Mbps)" +KeepLink = "Keep Link" +On = "On" +Off = "Off" + + +; Auto Generated 20180205_163610.746 + diff --git a/src/bin/hamcore/DriverPackages/Neo6_Win8/x64/Neo6_x64_VPN16.inf b/src/bin/hamcore/DriverPackages/Neo6_Win8/x64/Neo6_x64_VPN16.inf index 116f9cd1..d3359d91 100644 --- a/src/bin/hamcore/DriverPackages/Neo6_Win8/x64/Neo6_x64_VPN16.inf +++ b/src/bin/hamcore/DriverPackages/Neo6_Win8/x64/Neo6_x64_VPN16.inf @@ -1,114 +1,114 @@ -; VPN Client Device Driver for Windows 2000 and Greater -; -; Copyright (c) SoftEther Corporation. All Rights Reserved. -; http://www.softether.co.jp/ -; -; BUILD 9658 - -[Version] -Signature = "$Windows NT$" -Class = Net -ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} -Provider = %CompanyName% -DriverVer = 02/04/2018, 4.25.0.9658 -CatalogFile.NT = inf_VPN16.cat - -[Manufacturer] -%CompanyName% = SoftEther, NTamd64 - -[SourceDisksNames] -1=%DiskDescription%, "", , - -[SourceDisksFiles] -Neo_VPN16.sys = 1 - -[DestinationDirs] -DefaultDestDir = 12 -Neo.CopyFiles.Sys = 12 - -[Neo.CopyFiles.Sys] -Neo_VPN16.sys, , , 2 - -[SoftEther.NTamd64] -%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN16 - -[NeoAdapter.Install] -Characteristics = 0x1 -AddReg = Neo.Reg, NeoAdapter.Ndi -CopyFiles = Neo.CopyFiles.Sys -*IfType = 53 -*MediaType = 0 -*PhysicalMediaType = 0 - -[NeoAdapter.Install.Services] -AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% - -[NeoAdapter.Ndi] -HKR, , NetworkAddress, 0, %DefaultAddress% -HKR, Ndi, DeviceID, , "NeoAdapter_VPN16" -HKR, , DevLoader, , ndis -HKR, , DeviceVxDs, , Neo_VPN16.sys -HKR, NDIS, LogDriverName, , "Neo_VPN16" -HKR, NDIS, MajorNdisVersion, 1, 5 -HKR, NDIS, MinorNdisVersion, 1, 0 -HKR, Ndi\Interfaces, DefUpper, , "ndis5" -HKR, Ndi\Interfaces, UpperRange, , "ndis5" -HKR, Ndi\Interfaces, LowerRange, , "ethernet" -HKR, Ndi\Interfaces, DefLower, , "ethernet" -HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" -HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% -HKR, Ndi\Params\NetworkAddress, type, 0, "edit" -HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" -HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" -HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% -HKR, Ndi\Params\NetworkAddress, optional, 0, "0" -HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% -HKR, Ndi\Params\MaxSpeed, type, 0, "int" -HKR, Ndi\Params\MaxSpeed, default, 0, "100" -HKR, Ndi\Params\MaxSpeed, min, 0, "0" -HKR, Ndi\Params\MaxSpeed, max, 0, "2000" -HKR, Ndi\Params\MaxSpeed, step, 0, "1" -HKR, Ndi\Params\MaxSpeed, Base, 0, "10" -HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% -HKR, Ndi\Params\KeepLink, type, 0, "enum" -HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% -HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% -HKR, Ndi\Params\KeepLink, default, 0, "0" - - -[Neo.Service] -DisplayName = %Neo.Service.DispName% -Description = %Neo.Service.Desc% -ServiceType = 1 -StartType = 3 -ErrorControl = 1 -ServiceBinary = %12%\Neo_VPN16.sys -LoadOrderGroup = NDIS - -[Neo.Reg] -HKR, Ndi, Service, 0, Neo.Service.Name -HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" -HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" - -[Neo.EventLog] -HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN16.sys" -HKR, , TypesSupported, 0x00010001, 7 - -[Strings] -CompanyName = "SoftEther Corporation" -DiskDescription = "VPN Client Device Driver Install Disk" -Neo.Service.Name = "Neo_VPN16" -Neo.Service.DispName = "VPN Client Device Driver - VPN16" -Neo.Service.Desc = "VPN Client Adapter - VPN16" -NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN16" -Neo.EventLog.Name = "Neo" -NetworkAddress = "MAC Address" -DefaultAddress = "000001000001" -MaxSpeed = "Indicate Speed (Mbps)" -KeepLink = "Keep Link" -On = "On" -Off = "Off" - - -; Auto Generated 20180205_163610.747 - +; VPN Client Device Driver for Windows 2000 and Greater +; +; Copyright (c) SoftEther Corporation. All Rights Reserved. +; http://www.softether.co.jp/ +; +; BUILD 9658 + +[Version] +Signature = "$Windows NT$" +Class = Net +ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} +Provider = %CompanyName% +DriverVer = 02/04/2018, 4.25.0.9658 +CatalogFile.NT = inf_VPN16.cat + +[Manufacturer] +%CompanyName% = SoftEther, NTamd64 + +[SourceDisksNames] +1=%DiskDescription%, "", , + +[SourceDisksFiles] +Neo_VPN16.sys = 1 + +[DestinationDirs] +DefaultDestDir = 12 +Neo.CopyFiles.Sys = 12 + +[Neo.CopyFiles.Sys] +Neo_VPN16.sys, , , 2 + +[SoftEther.NTamd64] +%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN16 + +[NeoAdapter.Install] +Characteristics = 0x1 +AddReg = Neo.Reg, NeoAdapter.Ndi +CopyFiles = Neo.CopyFiles.Sys +*IfType = 53 +*MediaType = 0 +*PhysicalMediaType = 0 + +[NeoAdapter.Install.Services] +AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% + +[NeoAdapter.Ndi] +HKR, , NetworkAddress, 0, %DefaultAddress% +HKR, Ndi, DeviceID, , "NeoAdapter_VPN16" +HKR, , DevLoader, , ndis +HKR, , DeviceVxDs, , Neo_VPN16.sys +HKR, NDIS, LogDriverName, , "Neo_VPN16" +HKR, NDIS, MajorNdisVersion, 1, 5 +HKR, NDIS, MinorNdisVersion, 1, 0 +HKR, Ndi\Interfaces, DefUpper, , "ndis5" +HKR, Ndi\Interfaces, UpperRange, , "ndis5" +HKR, Ndi\Interfaces, LowerRange, , "ethernet" +HKR, Ndi\Interfaces, DefLower, , "ethernet" +HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" +HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% +HKR, Ndi\Params\NetworkAddress, type, 0, "edit" +HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" +HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" +HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% +HKR, Ndi\Params\NetworkAddress, optional, 0, "0" +HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% +HKR, Ndi\Params\MaxSpeed, type, 0, "int" +HKR, Ndi\Params\MaxSpeed, default, 0, "100" +HKR, Ndi\Params\MaxSpeed, min, 0, "0" +HKR, Ndi\Params\MaxSpeed, max, 0, "2000" +HKR, Ndi\Params\MaxSpeed, step, 0, "1" +HKR, Ndi\Params\MaxSpeed, Base, 0, "10" +HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% +HKR, Ndi\Params\KeepLink, type, 0, "enum" +HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% +HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% +HKR, Ndi\Params\KeepLink, default, 0, "0" + + +[Neo.Service] +DisplayName = %Neo.Service.DispName% +Description = %Neo.Service.Desc% +ServiceType = 1 +StartType = 3 +ErrorControl = 1 +ServiceBinary = %12%\Neo_VPN16.sys +LoadOrderGroup = NDIS + +[Neo.Reg] +HKR, Ndi, Service, 0, Neo.Service.Name +HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" +HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" + +[Neo.EventLog] +HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN16.sys" +HKR, , TypesSupported, 0x00010001, 7 + +[Strings] +CompanyName = "SoftEther Corporation" +DiskDescription = "VPN Client Device Driver Install Disk" +Neo.Service.Name = "Neo_VPN16" +Neo.Service.DispName = "VPN Client Device Driver - VPN16" +Neo.Service.Desc = "VPN Client Adapter - VPN16" +NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN16" +Neo.EventLog.Name = "Neo" +NetworkAddress = "MAC Address" +DefaultAddress = "000001000001" +MaxSpeed = "Indicate Speed (Mbps)" +KeepLink = "Keep Link" +On = "On" +Off = "Off" + + +; Auto Generated 20180205_163610.747 + diff --git a/src/bin/hamcore/DriverPackages/Neo6_Win8/x64/Neo6_x64_VPN17.inf b/src/bin/hamcore/DriverPackages/Neo6_Win8/x64/Neo6_x64_VPN17.inf index 3fa93bac..23328755 100644 --- a/src/bin/hamcore/DriverPackages/Neo6_Win8/x64/Neo6_x64_VPN17.inf +++ b/src/bin/hamcore/DriverPackages/Neo6_Win8/x64/Neo6_x64_VPN17.inf @@ -1,114 +1,114 @@ -; VPN Client Device Driver for Windows 2000 and Greater -; -; Copyright (c) SoftEther Corporation. All Rights Reserved. -; http://www.softether.co.jp/ -; -; BUILD 9658 - -[Version] -Signature = "$Windows NT$" -Class = Net -ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} -Provider = %CompanyName% -DriverVer = 02/04/2018, 4.25.0.9658 -CatalogFile.NT = inf_VPN17.cat - -[Manufacturer] -%CompanyName% = SoftEther, NTamd64 - -[SourceDisksNames] -1=%DiskDescription%, "", , - -[SourceDisksFiles] -Neo_VPN17.sys = 1 - -[DestinationDirs] -DefaultDestDir = 12 -Neo.CopyFiles.Sys = 12 - -[Neo.CopyFiles.Sys] -Neo_VPN17.sys, , , 2 - -[SoftEther.NTamd64] -%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN17 - -[NeoAdapter.Install] -Characteristics = 0x1 -AddReg = Neo.Reg, NeoAdapter.Ndi -CopyFiles = Neo.CopyFiles.Sys -*IfType = 53 -*MediaType = 0 -*PhysicalMediaType = 0 - -[NeoAdapter.Install.Services] -AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% - -[NeoAdapter.Ndi] -HKR, , NetworkAddress, 0, %DefaultAddress% -HKR, Ndi, DeviceID, , "NeoAdapter_VPN17" -HKR, , DevLoader, , ndis -HKR, , DeviceVxDs, , Neo_VPN17.sys -HKR, NDIS, LogDriverName, , "Neo_VPN17" -HKR, NDIS, MajorNdisVersion, 1, 5 -HKR, NDIS, MinorNdisVersion, 1, 0 -HKR, Ndi\Interfaces, DefUpper, , "ndis5" -HKR, Ndi\Interfaces, UpperRange, , "ndis5" -HKR, Ndi\Interfaces, LowerRange, , "ethernet" -HKR, Ndi\Interfaces, DefLower, , "ethernet" -HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" -HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% -HKR, Ndi\Params\NetworkAddress, type, 0, "edit" -HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" -HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" -HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% -HKR, Ndi\Params\NetworkAddress, optional, 0, "0" -HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% -HKR, Ndi\Params\MaxSpeed, type, 0, "int" -HKR, Ndi\Params\MaxSpeed, default, 0, "100" -HKR, Ndi\Params\MaxSpeed, min, 0, "0" -HKR, Ndi\Params\MaxSpeed, max, 0, "2000" -HKR, Ndi\Params\MaxSpeed, step, 0, "1" -HKR, Ndi\Params\MaxSpeed, Base, 0, "10" -HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% -HKR, Ndi\Params\KeepLink, type, 0, "enum" -HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% -HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% -HKR, Ndi\Params\KeepLink, default, 0, "0" - - -[Neo.Service] -DisplayName = %Neo.Service.DispName% -Description = %Neo.Service.Desc% -ServiceType = 1 -StartType = 3 -ErrorControl = 1 -ServiceBinary = %12%\Neo_VPN17.sys -LoadOrderGroup = NDIS - -[Neo.Reg] -HKR, Ndi, Service, 0, Neo.Service.Name -HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" -HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" - -[Neo.EventLog] -HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN17.sys" -HKR, , TypesSupported, 0x00010001, 7 - -[Strings] -CompanyName = "SoftEther Corporation" -DiskDescription = "VPN Client Device Driver Install Disk" -Neo.Service.Name = "Neo_VPN17" -Neo.Service.DispName = "VPN Client Device Driver - VPN17" -Neo.Service.Desc = "VPN Client Adapter - VPN17" -NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN17" -Neo.EventLog.Name = "Neo" -NetworkAddress = "MAC Address" -DefaultAddress = "000001000001" -MaxSpeed = "Indicate Speed (Mbps)" -KeepLink = "Keep Link" -On = "On" -Off = "Off" - - -; Auto Generated 20180205_163610.747 - +; VPN Client Device Driver for Windows 2000 and Greater +; +; Copyright (c) SoftEther Corporation. All Rights Reserved. +; http://www.softether.co.jp/ +; +; BUILD 9658 + +[Version] +Signature = "$Windows NT$" +Class = Net +ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} +Provider = %CompanyName% +DriverVer = 02/04/2018, 4.25.0.9658 +CatalogFile.NT = inf_VPN17.cat + +[Manufacturer] +%CompanyName% = SoftEther, NTamd64 + +[SourceDisksNames] +1=%DiskDescription%, "", , + +[SourceDisksFiles] +Neo_VPN17.sys = 1 + +[DestinationDirs] +DefaultDestDir = 12 +Neo.CopyFiles.Sys = 12 + +[Neo.CopyFiles.Sys] +Neo_VPN17.sys, , , 2 + +[SoftEther.NTamd64] +%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN17 + +[NeoAdapter.Install] +Characteristics = 0x1 +AddReg = Neo.Reg, NeoAdapter.Ndi +CopyFiles = Neo.CopyFiles.Sys +*IfType = 53 +*MediaType = 0 +*PhysicalMediaType = 0 + +[NeoAdapter.Install.Services] +AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% + +[NeoAdapter.Ndi] +HKR, , NetworkAddress, 0, %DefaultAddress% +HKR, Ndi, DeviceID, , "NeoAdapter_VPN17" +HKR, , DevLoader, , ndis +HKR, , DeviceVxDs, , Neo_VPN17.sys +HKR, NDIS, LogDriverName, , "Neo_VPN17" +HKR, NDIS, MajorNdisVersion, 1, 5 +HKR, NDIS, MinorNdisVersion, 1, 0 +HKR, Ndi\Interfaces, DefUpper, , "ndis5" +HKR, Ndi\Interfaces, UpperRange, , "ndis5" +HKR, Ndi\Interfaces, LowerRange, , "ethernet" +HKR, Ndi\Interfaces, DefLower, , "ethernet" +HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" +HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% +HKR, Ndi\Params\NetworkAddress, type, 0, "edit" +HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" +HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" +HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% +HKR, Ndi\Params\NetworkAddress, optional, 0, "0" +HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% +HKR, Ndi\Params\MaxSpeed, type, 0, "int" +HKR, Ndi\Params\MaxSpeed, default, 0, "100" +HKR, Ndi\Params\MaxSpeed, min, 0, "0" +HKR, Ndi\Params\MaxSpeed, max, 0, "2000" +HKR, Ndi\Params\MaxSpeed, step, 0, "1" +HKR, Ndi\Params\MaxSpeed, Base, 0, "10" +HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% +HKR, Ndi\Params\KeepLink, type, 0, "enum" +HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% +HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% +HKR, Ndi\Params\KeepLink, default, 0, "0" + + +[Neo.Service] +DisplayName = %Neo.Service.DispName% +Description = %Neo.Service.Desc% +ServiceType = 1 +StartType = 3 +ErrorControl = 1 +ServiceBinary = %12%\Neo_VPN17.sys +LoadOrderGroup = NDIS + +[Neo.Reg] +HKR, Ndi, Service, 0, Neo.Service.Name +HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" +HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" + +[Neo.EventLog] +HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN17.sys" +HKR, , TypesSupported, 0x00010001, 7 + +[Strings] +CompanyName = "SoftEther Corporation" +DiskDescription = "VPN Client Device Driver Install Disk" +Neo.Service.Name = "Neo_VPN17" +Neo.Service.DispName = "VPN Client Device Driver - VPN17" +Neo.Service.Desc = "VPN Client Adapter - VPN17" +NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN17" +Neo.EventLog.Name = "Neo" +NetworkAddress = "MAC Address" +DefaultAddress = "000001000001" +MaxSpeed = "Indicate Speed (Mbps)" +KeepLink = "Keep Link" +On = "On" +Off = "Off" + + +; Auto Generated 20180205_163610.747 + diff --git a/src/bin/hamcore/DriverPackages/Neo6_Win8/x64/Neo6_x64_VPN18.inf b/src/bin/hamcore/DriverPackages/Neo6_Win8/x64/Neo6_x64_VPN18.inf index b861892b..806f211c 100644 --- a/src/bin/hamcore/DriverPackages/Neo6_Win8/x64/Neo6_x64_VPN18.inf +++ b/src/bin/hamcore/DriverPackages/Neo6_Win8/x64/Neo6_x64_VPN18.inf @@ -1,114 +1,114 @@ -; VPN Client Device Driver for Windows 2000 and Greater -; -; Copyright (c) SoftEther Corporation. All Rights Reserved. -; http://www.softether.co.jp/ -; -; BUILD 9658 - -[Version] -Signature = "$Windows NT$" -Class = Net -ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} -Provider = %CompanyName% -DriverVer = 02/04/2018, 4.25.0.9658 -CatalogFile.NT = inf_VPN18.cat - -[Manufacturer] -%CompanyName% = SoftEther, NTamd64 - -[SourceDisksNames] -1=%DiskDescription%, "", , - -[SourceDisksFiles] -Neo_VPN18.sys = 1 - -[DestinationDirs] -DefaultDestDir = 12 -Neo.CopyFiles.Sys = 12 - -[Neo.CopyFiles.Sys] -Neo_VPN18.sys, , , 2 - -[SoftEther.NTamd64] -%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN18 - -[NeoAdapter.Install] -Characteristics = 0x1 -AddReg = Neo.Reg, NeoAdapter.Ndi -CopyFiles = Neo.CopyFiles.Sys -*IfType = 53 -*MediaType = 0 -*PhysicalMediaType = 0 - -[NeoAdapter.Install.Services] -AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% - -[NeoAdapter.Ndi] -HKR, , NetworkAddress, 0, %DefaultAddress% -HKR, Ndi, DeviceID, , "NeoAdapter_VPN18" -HKR, , DevLoader, , ndis -HKR, , DeviceVxDs, , Neo_VPN18.sys -HKR, NDIS, LogDriverName, , "Neo_VPN18" -HKR, NDIS, MajorNdisVersion, 1, 5 -HKR, NDIS, MinorNdisVersion, 1, 0 -HKR, Ndi\Interfaces, DefUpper, , "ndis5" -HKR, Ndi\Interfaces, UpperRange, , "ndis5" -HKR, Ndi\Interfaces, LowerRange, , "ethernet" -HKR, Ndi\Interfaces, DefLower, , "ethernet" -HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" -HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% -HKR, Ndi\Params\NetworkAddress, type, 0, "edit" -HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" -HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" -HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% -HKR, Ndi\Params\NetworkAddress, optional, 0, "0" -HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% -HKR, Ndi\Params\MaxSpeed, type, 0, "int" -HKR, Ndi\Params\MaxSpeed, default, 0, "100" -HKR, Ndi\Params\MaxSpeed, min, 0, "0" -HKR, Ndi\Params\MaxSpeed, max, 0, "2000" -HKR, Ndi\Params\MaxSpeed, step, 0, "1" -HKR, Ndi\Params\MaxSpeed, Base, 0, "10" -HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% -HKR, Ndi\Params\KeepLink, type, 0, "enum" -HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% -HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% -HKR, Ndi\Params\KeepLink, default, 0, "0" - - -[Neo.Service] -DisplayName = %Neo.Service.DispName% -Description = %Neo.Service.Desc% -ServiceType = 1 -StartType = 3 -ErrorControl = 1 -ServiceBinary = %12%\Neo_VPN18.sys -LoadOrderGroup = NDIS - -[Neo.Reg] -HKR, Ndi, Service, 0, Neo.Service.Name -HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" -HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" - -[Neo.EventLog] -HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN18.sys" -HKR, , TypesSupported, 0x00010001, 7 - -[Strings] -CompanyName = "SoftEther Corporation" -DiskDescription = "VPN Client Device Driver Install Disk" -Neo.Service.Name = "Neo_VPN18" -Neo.Service.DispName = "VPN Client Device Driver - VPN18" -Neo.Service.Desc = "VPN Client Adapter - VPN18" -NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN18" -Neo.EventLog.Name = "Neo" -NetworkAddress = "MAC Address" -DefaultAddress = "000001000001" -MaxSpeed = "Indicate Speed (Mbps)" -KeepLink = "Keep Link" -On = "On" -Off = "Off" - - -; Auto Generated 20180205_163610.748 - +; VPN Client Device Driver for Windows 2000 and Greater +; +; Copyright (c) SoftEther Corporation. All Rights Reserved. +; http://www.softether.co.jp/ +; +; BUILD 9658 + +[Version] +Signature = "$Windows NT$" +Class = Net +ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} +Provider = %CompanyName% +DriverVer = 02/04/2018, 4.25.0.9658 +CatalogFile.NT = inf_VPN18.cat + +[Manufacturer] +%CompanyName% = SoftEther, NTamd64 + +[SourceDisksNames] +1=%DiskDescription%, "", , + +[SourceDisksFiles] +Neo_VPN18.sys = 1 + +[DestinationDirs] +DefaultDestDir = 12 +Neo.CopyFiles.Sys = 12 + +[Neo.CopyFiles.Sys] +Neo_VPN18.sys, , , 2 + +[SoftEther.NTamd64] +%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN18 + +[NeoAdapter.Install] +Characteristics = 0x1 +AddReg = Neo.Reg, NeoAdapter.Ndi +CopyFiles = Neo.CopyFiles.Sys +*IfType = 53 +*MediaType = 0 +*PhysicalMediaType = 0 + +[NeoAdapter.Install.Services] +AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% + +[NeoAdapter.Ndi] +HKR, , NetworkAddress, 0, %DefaultAddress% +HKR, Ndi, DeviceID, , "NeoAdapter_VPN18" +HKR, , DevLoader, , ndis +HKR, , DeviceVxDs, , Neo_VPN18.sys +HKR, NDIS, LogDriverName, , "Neo_VPN18" +HKR, NDIS, MajorNdisVersion, 1, 5 +HKR, NDIS, MinorNdisVersion, 1, 0 +HKR, Ndi\Interfaces, DefUpper, , "ndis5" +HKR, Ndi\Interfaces, UpperRange, , "ndis5" +HKR, Ndi\Interfaces, LowerRange, , "ethernet" +HKR, Ndi\Interfaces, DefLower, , "ethernet" +HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" +HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% +HKR, Ndi\Params\NetworkAddress, type, 0, "edit" +HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" +HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" +HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% +HKR, Ndi\Params\NetworkAddress, optional, 0, "0" +HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% +HKR, Ndi\Params\MaxSpeed, type, 0, "int" +HKR, Ndi\Params\MaxSpeed, default, 0, "100" +HKR, Ndi\Params\MaxSpeed, min, 0, "0" +HKR, Ndi\Params\MaxSpeed, max, 0, "2000" +HKR, Ndi\Params\MaxSpeed, step, 0, "1" +HKR, Ndi\Params\MaxSpeed, Base, 0, "10" +HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% +HKR, Ndi\Params\KeepLink, type, 0, "enum" +HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% +HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% +HKR, Ndi\Params\KeepLink, default, 0, "0" + + +[Neo.Service] +DisplayName = %Neo.Service.DispName% +Description = %Neo.Service.Desc% +ServiceType = 1 +StartType = 3 +ErrorControl = 1 +ServiceBinary = %12%\Neo_VPN18.sys +LoadOrderGroup = NDIS + +[Neo.Reg] +HKR, Ndi, Service, 0, Neo.Service.Name +HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" +HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" + +[Neo.EventLog] +HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN18.sys" +HKR, , TypesSupported, 0x00010001, 7 + +[Strings] +CompanyName = "SoftEther Corporation" +DiskDescription = "VPN Client Device Driver Install Disk" +Neo.Service.Name = "Neo_VPN18" +Neo.Service.DispName = "VPN Client Device Driver - VPN18" +Neo.Service.Desc = "VPN Client Adapter - VPN18" +NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN18" +Neo.EventLog.Name = "Neo" +NetworkAddress = "MAC Address" +DefaultAddress = "000001000001" +MaxSpeed = "Indicate Speed (Mbps)" +KeepLink = "Keep Link" +On = "On" +Off = "Off" + + +; Auto Generated 20180205_163610.748 + diff --git a/src/bin/hamcore/DriverPackages/Neo6_Win8/x64/Neo6_x64_VPN19.inf b/src/bin/hamcore/DriverPackages/Neo6_Win8/x64/Neo6_x64_VPN19.inf index bd482801..310f34c3 100644 --- a/src/bin/hamcore/DriverPackages/Neo6_Win8/x64/Neo6_x64_VPN19.inf +++ b/src/bin/hamcore/DriverPackages/Neo6_Win8/x64/Neo6_x64_VPN19.inf @@ -1,114 +1,114 @@ -; VPN Client Device Driver for Windows 2000 and Greater -; -; Copyright (c) SoftEther Corporation. All Rights Reserved. -; http://www.softether.co.jp/ -; -; BUILD 9658 - -[Version] -Signature = "$Windows NT$" -Class = Net -ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} -Provider = %CompanyName% -DriverVer = 02/04/2018, 4.25.0.9658 -CatalogFile.NT = inf_VPN19.cat - -[Manufacturer] -%CompanyName% = SoftEther, NTamd64 - -[SourceDisksNames] -1=%DiskDescription%, "", , - -[SourceDisksFiles] -Neo_VPN19.sys = 1 - -[DestinationDirs] -DefaultDestDir = 12 -Neo.CopyFiles.Sys = 12 - -[Neo.CopyFiles.Sys] -Neo_VPN19.sys, , , 2 - -[SoftEther.NTamd64] -%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN19 - -[NeoAdapter.Install] -Characteristics = 0x1 -AddReg = Neo.Reg, NeoAdapter.Ndi -CopyFiles = Neo.CopyFiles.Sys -*IfType = 53 -*MediaType = 0 -*PhysicalMediaType = 0 - -[NeoAdapter.Install.Services] -AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% - -[NeoAdapter.Ndi] -HKR, , NetworkAddress, 0, %DefaultAddress% -HKR, Ndi, DeviceID, , "NeoAdapter_VPN19" -HKR, , DevLoader, , ndis -HKR, , DeviceVxDs, , Neo_VPN19.sys -HKR, NDIS, LogDriverName, , "Neo_VPN19" -HKR, NDIS, MajorNdisVersion, 1, 5 -HKR, NDIS, MinorNdisVersion, 1, 0 -HKR, Ndi\Interfaces, DefUpper, , "ndis5" -HKR, Ndi\Interfaces, UpperRange, , "ndis5" -HKR, Ndi\Interfaces, LowerRange, , "ethernet" -HKR, Ndi\Interfaces, DefLower, , "ethernet" -HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" -HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% -HKR, Ndi\Params\NetworkAddress, type, 0, "edit" -HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" -HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" -HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% -HKR, Ndi\Params\NetworkAddress, optional, 0, "0" -HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% -HKR, Ndi\Params\MaxSpeed, type, 0, "int" -HKR, Ndi\Params\MaxSpeed, default, 0, "100" -HKR, Ndi\Params\MaxSpeed, min, 0, "0" -HKR, Ndi\Params\MaxSpeed, max, 0, "2000" -HKR, Ndi\Params\MaxSpeed, step, 0, "1" -HKR, Ndi\Params\MaxSpeed, Base, 0, "10" -HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% -HKR, Ndi\Params\KeepLink, type, 0, "enum" -HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% -HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% -HKR, Ndi\Params\KeepLink, default, 0, "0" - - -[Neo.Service] -DisplayName = %Neo.Service.DispName% -Description = %Neo.Service.Desc% -ServiceType = 1 -StartType = 3 -ErrorControl = 1 -ServiceBinary = %12%\Neo_VPN19.sys -LoadOrderGroup = NDIS - -[Neo.Reg] -HKR, Ndi, Service, 0, Neo.Service.Name -HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" -HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" - -[Neo.EventLog] -HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN19.sys" -HKR, , TypesSupported, 0x00010001, 7 - -[Strings] -CompanyName = "SoftEther Corporation" -DiskDescription = "VPN Client Device Driver Install Disk" -Neo.Service.Name = "Neo_VPN19" -Neo.Service.DispName = "VPN Client Device Driver - VPN19" -Neo.Service.Desc = "VPN Client Adapter - VPN19" -NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN19" -Neo.EventLog.Name = "Neo" -NetworkAddress = "MAC Address" -DefaultAddress = "000001000001" -MaxSpeed = "Indicate Speed (Mbps)" -KeepLink = "Keep Link" -On = "On" -Off = "Off" - - -; Auto Generated 20180205_163610.749 - +; VPN Client Device Driver for Windows 2000 and Greater +; +; Copyright (c) SoftEther Corporation. All Rights Reserved. +; http://www.softether.co.jp/ +; +; BUILD 9658 + +[Version] +Signature = "$Windows NT$" +Class = Net +ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} +Provider = %CompanyName% +DriverVer = 02/04/2018, 4.25.0.9658 +CatalogFile.NT = inf_VPN19.cat + +[Manufacturer] +%CompanyName% = SoftEther, NTamd64 + +[SourceDisksNames] +1=%DiskDescription%, "", , + +[SourceDisksFiles] +Neo_VPN19.sys = 1 + +[DestinationDirs] +DefaultDestDir = 12 +Neo.CopyFiles.Sys = 12 + +[Neo.CopyFiles.Sys] +Neo_VPN19.sys, , , 2 + +[SoftEther.NTamd64] +%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN19 + +[NeoAdapter.Install] +Characteristics = 0x1 +AddReg = Neo.Reg, NeoAdapter.Ndi +CopyFiles = Neo.CopyFiles.Sys +*IfType = 53 +*MediaType = 0 +*PhysicalMediaType = 0 + +[NeoAdapter.Install.Services] +AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% + +[NeoAdapter.Ndi] +HKR, , NetworkAddress, 0, %DefaultAddress% +HKR, Ndi, DeviceID, , "NeoAdapter_VPN19" +HKR, , DevLoader, , ndis +HKR, , DeviceVxDs, , Neo_VPN19.sys +HKR, NDIS, LogDriverName, , "Neo_VPN19" +HKR, NDIS, MajorNdisVersion, 1, 5 +HKR, NDIS, MinorNdisVersion, 1, 0 +HKR, Ndi\Interfaces, DefUpper, , "ndis5" +HKR, Ndi\Interfaces, UpperRange, , "ndis5" +HKR, Ndi\Interfaces, LowerRange, , "ethernet" +HKR, Ndi\Interfaces, DefLower, , "ethernet" +HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" +HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% +HKR, Ndi\Params\NetworkAddress, type, 0, "edit" +HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" +HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" +HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% +HKR, Ndi\Params\NetworkAddress, optional, 0, "0" +HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% +HKR, Ndi\Params\MaxSpeed, type, 0, "int" +HKR, Ndi\Params\MaxSpeed, default, 0, "100" +HKR, Ndi\Params\MaxSpeed, min, 0, "0" +HKR, Ndi\Params\MaxSpeed, max, 0, "2000" +HKR, Ndi\Params\MaxSpeed, step, 0, "1" +HKR, Ndi\Params\MaxSpeed, Base, 0, "10" +HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% +HKR, Ndi\Params\KeepLink, type, 0, "enum" +HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% +HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% +HKR, Ndi\Params\KeepLink, default, 0, "0" + + +[Neo.Service] +DisplayName = %Neo.Service.DispName% +Description = %Neo.Service.Desc% +ServiceType = 1 +StartType = 3 +ErrorControl = 1 +ServiceBinary = %12%\Neo_VPN19.sys +LoadOrderGroup = NDIS + +[Neo.Reg] +HKR, Ndi, Service, 0, Neo.Service.Name +HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" +HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" + +[Neo.EventLog] +HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN19.sys" +HKR, , TypesSupported, 0x00010001, 7 + +[Strings] +CompanyName = "SoftEther Corporation" +DiskDescription = "VPN Client Device Driver Install Disk" +Neo.Service.Name = "Neo_VPN19" +Neo.Service.DispName = "VPN Client Device Driver - VPN19" +Neo.Service.Desc = "VPN Client Adapter - VPN19" +NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN19" +Neo.EventLog.Name = "Neo" +NetworkAddress = "MAC Address" +DefaultAddress = "000001000001" +MaxSpeed = "Indicate Speed (Mbps)" +KeepLink = "Keep Link" +On = "On" +Off = "Off" + + +; Auto Generated 20180205_163610.749 + diff --git a/src/bin/hamcore/DriverPackages/Neo6_Win8/x64/Neo6_x64_VPN2.inf b/src/bin/hamcore/DriverPackages/Neo6_Win8/x64/Neo6_x64_VPN2.inf index 5efa745b..8f99920f 100644 --- a/src/bin/hamcore/DriverPackages/Neo6_Win8/x64/Neo6_x64_VPN2.inf +++ b/src/bin/hamcore/DriverPackages/Neo6_Win8/x64/Neo6_x64_VPN2.inf @@ -1,114 +1,114 @@ -; VPN Client Device Driver for Windows 2000 and Greater -; -; Copyright (c) SoftEther Corporation. All Rights Reserved. -; http://www.softether.co.jp/ -; -; BUILD 9658 - -[Version] -Signature = "$Windows NT$" -Class = Net -ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} -Provider = %CompanyName% -DriverVer = 02/04/2018, 4.25.0.9658 -CatalogFile.NT = inf_VPN2.cat - -[Manufacturer] -%CompanyName% = SoftEther, NTamd64 - -[SourceDisksNames] -1=%DiskDescription%, "", , - -[SourceDisksFiles] -Neo_VPN2.sys = 1 - -[DestinationDirs] -DefaultDestDir = 12 -Neo.CopyFiles.Sys = 12 - -[Neo.CopyFiles.Sys] -Neo_VPN2.sys, , , 2 - -[SoftEther.NTamd64] -%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN2 - -[NeoAdapter.Install] -Characteristics = 0x1 -AddReg = Neo.Reg, NeoAdapter.Ndi -CopyFiles = Neo.CopyFiles.Sys -*IfType = 53 -*MediaType = 0 -*PhysicalMediaType = 0 - -[NeoAdapter.Install.Services] -AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% - -[NeoAdapter.Ndi] -HKR, , NetworkAddress, 0, %DefaultAddress% -HKR, Ndi, DeviceID, , "NeoAdapter_VPN2" -HKR, , DevLoader, , ndis -HKR, , DeviceVxDs, , Neo_VPN2.sys -HKR, NDIS, LogDriverName, , "Neo_VPN2" -HKR, NDIS, MajorNdisVersion, 1, 5 -HKR, NDIS, MinorNdisVersion, 1, 0 -HKR, Ndi\Interfaces, DefUpper, , "ndis5" -HKR, Ndi\Interfaces, UpperRange, , "ndis5" -HKR, Ndi\Interfaces, LowerRange, , "ethernet" -HKR, Ndi\Interfaces, DefLower, , "ethernet" -HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" -HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% -HKR, Ndi\Params\NetworkAddress, type, 0, "edit" -HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" -HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" -HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% -HKR, Ndi\Params\NetworkAddress, optional, 0, "0" -HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% -HKR, Ndi\Params\MaxSpeed, type, 0, "int" -HKR, Ndi\Params\MaxSpeed, default, 0, "100" -HKR, Ndi\Params\MaxSpeed, min, 0, "0" -HKR, Ndi\Params\MaxSpeed, max, 0, "2000" -HKR, Ndi\Params\MaxSpeed, step, 0, "1" -HKR, Ndi\Params\MaxSpeed, Base, 0, "10" -HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% -HKR, Ndi\Params\KeepLink, type, 0, "enum" -HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% -HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% -HKR, Ndi\Params\KeepLink, default, 0, "0" - - -[Neo.Service] -DisplayName = %Neo.Service.DispName% -Description = %Neo.Service.Desc% -ServiceType = 1 -StartType = 3 -ErrorControl = 1 -ServiceBinary = %12%\Neo_VPN2.sys -LoadOrderGroup = NDIS - -[Neo.Reg] -HKR, Ndi, Service, 0, Neo.Service.Name -HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" -HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" - -[Neo.EventLog] -HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN2.sys" -HKR, , TypesSupported, 0x00010001, 7 - -[Strings] -CompanyName = "SoftEther Corporation" -DiskDescription = "VPN Client Device Driver Install Disk" -Neo.Service.Name = "Neo_VPN2" -Neo.Service.DispName = "VPN Client Device Driver - VPN2" -Neo.Service.Desc = "VPN Client Adapter - VPN2" -NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN2" -Neo.EventLog.Name = "Neo" -NetworkAddress = "MAC Address" -DefaultAddress = "000001000001" -MaxSpeed = "Indicate Speed (Mbps)" -KeepLink = "Keep Link" -On = "On" -Off = "Off" - - -; Auto Generated 20180205_163610.738 - +; VPN Client Device Driver for Windows 2000 and Greater +; +; Copyright (c) SoftEther Corporation. All Rights Reserved. +; http://www.softether.co.jp/ +; +; BUILD 9658 + +[Version] +Signature = "$Windows NT$" +Class = Net +ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} +Provider = %CompanyName% +DriverVer = 02/04/2018, 4.25.0.9658 +CatalogFile.NT = inf_VPN2.cat + +[Manufacturer] +%CompanyName% = SoftEther, NTamd64 + +[SourceDisksNames] +1=%DiskDescription%, "", , + +[SourceDisksFiles] +Neo_VPN2.sys = 1 + +[DestinationDirs] +DefaultDestDir = 12 +Neo.CopyFiles.Sys = 12 + +[Neo.CopyFiles.Sys] +Neo_VPN2.sys, , , 2 + +[SoftEther.NTamd64] +%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN2 + +[NeoAdapter.Install] +Characteristics = 0x1 +AddReg = Neo.Reg, NeoAdapter.Ndi +CopyFiles = Neo.CopyFiles.Sys +*IfType = 53 +*MediaType = 0 +*PhysicalMediaType = 0 + +[NeoAdapter.Install.Services] +AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% + +[NeoAdapter.Ndi] +HKR, , NetworkAddress, 0, %DefaultAddress% +HKR, Ndi, DeviceID, , "NeoAdapter_VPN2" +HKR, , DevLoader, , ndis +HKR, , DeviceVxDs, , Neo_VPN2.sys +HKR, NDIS, LogDriverName, , "Neo_VPN2" +HKR, NDIS, MajorNdisVersion, 1, 5 +HKR, NDIS, MinorNdisVersion, 1, 0 +HKR, Ndi\Interfaces, DefUpper, , "ndis5" +HKR, Ndi\Interfaces, UpperRange, , "ndis5" +HKR, Ndi\Interfaces, LowerRange, , "ethernet" +HKR, Ndi\Interfaces, DefLower, , "ethernet" +HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" +HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% +HKR, Ndi\Params\NetworkAddress, type, 0, "edit" +HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" +HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" +HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% +HKR, Ndi\Params\NetworkAddress, optional, 0, "0" +HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% +HKR, Ndi\Params\MaxSpeed, type, 0, "int" +HKR, Ndi\Params\MaxSpeed, default, 0, "100" +HKR, Ndi\Params\MaxSpeed, min, 0, "0" +HKR, Ndi\Params\MaxSpeed, max, 0, "2000" +HKR, Ndi\Params\MaxSpeed, step, 0, "1" +HKR, Ndi\Params\MaxSpeed, Base, 0, "10" +HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% +HKR, Ndi\Params\KeepLink, type, 0, "enum" +HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% +HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% +HKR, Ndi\Params\KeepLink, default, 0, "0" + + +[Neo.Service] +DisplayName = %Neo.Service.DispName% +Description = %Neo.Service.Desc% +ServiceType = 1 +StartType = 3 +ErrorControl = 1 +ServiceBinary = %12%\Neo_VPN2.sys +LoadOrderGroup = NDIS + +[Neo.Reg] +HKR, Ndi, Service, 0, Neo.Service.Name +HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" +HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" + +[Neo.EventLog] +HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN2.sys" +HKR, , TypesSupported, 0x00010001, 7 + +[Strings] +CompanyName = "SoftEther Corporation" +DiskDescription = "VPN Client Device Driver Install Disk" +Neo.Service.Name = "Neo_VPN2" +Neo.Service.DispName = "VPN Client Device Driver - VPN2" +Neo.Service.Desc = "VPN Client Adapter - VPN2" +NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN2" +Neo.EventLog.Name = "Neo" +NetworkAddress = "MAC Address" +DefaultAddress = "000001000001" +MaxSpeed = "Indicate Speed (Mbps)" +KeepLink = "Keep Link" +On = "On" +Off = "Off" + + +; Auto Generated 20180205_163610.738 + diff --git a/src/bin/hamcore/DriverPackages/Neo6_Win8/x64/Neo6_x64_VPN20.inf b/src/bin/hamcore/DriverPackages/Neo6_Win8/x64/Neo6_x64_VPN20.inf index 2d7f062d..4ed17132 100644 --- a/src/bin/hamcore/DriverPackages/Neo6_Win8/x64/Neo6_x64_VPN20.inf +++ b/src/bin/hamcore/DriverPackages/Neo6_Win8/x64/Neo6_x64_VPN20.inf @@ -1,114 +1,114 @@ -; VPN Client Device Driver for Windows 2000 and Greater -; -; Copyright (c) SoftEther Corporation. All Rights Reserved. -; http://www.softether.co.jp/ -; -; BUILD 9658 - -[Version] -Signature = "$Windows NT$" -Class = Net -ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} -Provider = %CompanyName% -DriverVer = 02/04/2018, 4.25.0.9658 -CatalogFile.NT = inf_VPN20.cat - -[Manufacturer] -%CompanyName% = SoftEther, NTamd64 - -[SourceDisksNames] -1=%DiskDescription%, "", , - -[SourceDisksFiles] -Neo_VPN20.sys = 1 - -[DestinationDirs] -DefaultDestDir = 12 -Neo.CopyFiles.Sys = 12 - -[Neo.CopyFiles.Sys] -Neo_VPN20.sys, , , 2 - -[SoftEther.NTamd64] -%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN20 - -[NeoAdapter.Install] -Characteristics = 0x1 -AddReg = Neo.Reg, NeoAdapter.Ndi -CopyFiles = Neo.CopyFiles.Sys -*IfType = 53 -*MediaType = 0 -*PhysicalMediaType = 0 - -[NeoAdapter.Install.Services] -AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% - -[NeoAdapter.Ndi] -HKR, , NetworkAddress, 0, %DefaultAddress% -HKR, Ndi, DeviceID, , "NeoAdapter_VPN20" -HKR, , DevLoader, , ndis -HKR, , DeviceVxDs, , Neo_VPN20.sys -HKR, NDIS, LogDriverName, , "Neo_VPN20" -HKR, NDIS, MajorNdisVersion, 1, 5 -HKR, NDIS, MinorNdisVersion, 1, 0 -HKR, Ndi\Interfaces, DefUpper, , "ndis5" -HKR, Ndi\Interfaces, UpperRange, , "ndis5" -HKR, Ndi\Interfaces, LowerRange, , "ethernet" -HKR, Ndi\Interfaces, DefLower, , "ethernet" -HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" -HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% -HKR, Ndi\Params\NetworkAddress, type, 0, "edit" -HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" -HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" -HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% -HKR, Ndi\Params\NetworkAddress, optional, 0, "0" -HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% -HKR, Ndi\Params\MaxSpeed, type, 0, "int" -HKR, Ndi\Params\MaxSpeed, default, 0, "100" -HKR, Ndi\Params\MaxSpeed, min, 0, "0" -HKR, Ndi\Params\MaxSpeed, max, 0, "2000" -HKR, Ndi\Params\MaxSpeed, step, 0, "1" -HKR, Ndi\Params\MaxSpeed, Base, 0, "10" -HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% -HKR, Ndi\Params\KeepLink, type, 0, "enum" -HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% -HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% -HKR, Ndi\Params\KeepLink, default, 0, "0" - - -[Neo.Service] -DisplayName = %Neo.Service.DispName% -Description = %Neo.Service.Desc% -ServiceType = 1 -StartType = 3 -ErrorControl = 1 -ServiceBinary = %12%\Neo_VPN20.sys -LoadOrderGroup = NDIS - -[Neo.Reg] -HKR, Ndi, Service, 0, Neo.Service.Name -HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" -HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" - -[Neo.EventLog] -HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN20.sys" -HKR, , TypesSupported, 0x00010001, 7 - -[Strings] -CompanyName = "SoftEther Corporation" -DiskDescription = "VPN Client Device Driver Install Disk" -Neo.Service.Name = "Neo_VPN20" -Neo.Service.DispName = "VPN Client Device Driver - VPN20" -Neo.Service.Desc = "VPN Client Adapter - VPN20" -NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN20" -Neo.EventLog.Name = "Neo" -NetworkAddress = "MAC Address" -DefaultAddress = "000001000001" -MaxSpeed = "Indicate Speed (Mbps)" -KeepLink = "Keep Link" -On = "On" -Off = "Off" - - -; Auto Generated 20180205_163610.749 - +; VPN Client Device Driver for Windows 2000 and Greater +; +; Copyright (c) SoftEther Corporation. All Rights Reserved. +; http://www.softether.co.jp/ +; +; BUILD 9658 + +[Version] +Signature = "$Windows NT$" +Class = Net +ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} +Provider = %CompanyName% +DriverVer = 02/04/2018, 4.25.0.9658 +CatalogFile.NT = inf_VPN20.cat + +[Manufacturer] +%CompanyName% = SoftEther, NTamd64 + +[SourceDisksNames] +1=%DiskDescription%, "", , + +[SourceDisksFiles] +Neo_VPN20.sys = 1 + +[DestinationDirs] +DefaultDestDir = 12 +Neo.CopyFiles.Sys = 12 + +[Neo.CopyFiles.Sys] +Neo_VPN20.sys, , , 2 + +[SoftEther.NTamd64] +%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN20 + +[NeoAdapter.Install] +Characteristics = 0x1 +AddReg = Neo.Reg, NeoAdapter.Ndi +CopyFiles = Neo.CopyFiles.Sys +*IfType = 53 +*MediaType = 0 +*PhysicalMediaType = 0 + +[NeoAdapter.Install.Services] +AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% + +[NeoAdapter.Ndi] +HKR, , NetworkAddress, 0, %DefaultAddress% +HKR, Ndi, DeviceID, , "NeoAdapter_VPN20" +HKR, , DevLoader, , ndis +HKR, , DeviceVxDs, , Neo_VPN20.sys +HKR, NDIS, LogDriverName, , "Neo_VPN20" +HKR, NDIS, MajorNdisVersion, 1, 5 +HKR, NDIS, MinorNdisVersion, 1, 0 +HKR, Ndi\Interfaces, DefUpper, , "ndis5" +HKR, Ndi\Interfaces, UpperRange, , "ndis5" +HKR, Ndi\Interfaces, LowerRange, , "ethernet" +HKR, Ndi\Interfaces, DefLower, , "ethernet" +HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" +HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% +HKR, Ndi\Params\NetworkAddress, type, 0, "edit" +HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" +HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" +HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% +HKR, Ndi\Params\NetworkAddress, optional, 0, "0" +HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% +HKR, Ndi\Params\MaxSpeed, type, 0, "int" +HKR, Ndi\Params\MaxSpeed, default, 0, "100" +HKR, Ndi\Params\MaxSpeed, min, 0, "0" +HKR, Ndi\Params\MaxSpeed, max, 0, "2000" +HKR, Ndi\Params\MaxSpeed, step, 0, "1" +HKR, Ndi\Params\MaxSpeed, Base, 0, "10" +HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% +HKR, Ndi\Params\KeepLink, type, 0, "enum" +HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% +HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% +HKR, Ndi\Params\KeepLink, default, 0, "0" + + +[Neo.Service] +DisplayName = %Neo.Service.DispName% +Description = %Neo.Service.Desc% +ServiceType = 1 +StartType = 3 +ErrorControl = 1 +ServiceBinary = %12%\Neo_VPN20.sys +LoadOrderGroup = NDIS + +[Neo.Reg] +HKR, Ndi, Service, 0, Neo.Service.Name +HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" +HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" + +[Neo.EventLog] +HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN20.sys" +HKR, , TypesSupported, 0x00010001, 7 + +[Strings] +CompanyName = "SoftEther Corporation" +DiskDescription = "VPN Client Device Driver Install Disk" +Neo.Service.Name = "Neo_VPN20" +Neo.Service.DispName = "VPN Client Device Driver - VPN20" +Neo.Service.Desc = "VPN Client Adapter - VPN20" +NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN20" +Neo.EventLog.Name = "Neo" +NetworkAddress = "MAC Address" +DefaultAddress = "000001000001" +MaxSpeed = "Indicate Speed (Mbps)" +KeepLink = "Keep Link" +On = "On" +Off = "Off" + + +; Auto Generated 20180205_163610.749 + diff --git a/src/bin/hamcore/DriverPackages/Neo6_Win8/x64/Neo6_x64_VPN21.inf b/src/bin/hamcore/DriverPackages/Neo6_Win8/x64/Neo6_x64_VPN21.inf index 91627c57..9d11bd68 100644 --- a/src/bin/hamcore/DriverPackages/Neo6_Win8/x64/Neo6_x64_VPN21.inf +++ b/src/bin/hamcore/DriverPackages/Neo6_Win8/x64/Neo6_x64_VPN21.inf @@ -1,114 +1,114 @@ -; VPN Client Device Driver for Windows 2000 and Greater -; -; Copyright (c) SoftEther Corporation. All Rights Reserved. -; http://www.softether.co.jp/ -; -; BUILD 9658 - -[Version] -Signature = "$Windows NT$" -Class = Net -ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} -Provider = %CompanyName% -DriverVer = 02/04/2018, 4.25.0.9658 -CatalogFile.NT = inf_VPN21.cat - -[Manufacturer] -%CompanyName% = SoftEther, NTamd64 - -[SourceDisksNames] -1=%DiskDescription%, "", , - -[SourceDisksFiles] -Neo_VPN21.sys = 1 - -[DestinationDirs] -DefaultDestDir = 12 -Neo.CopyFiles.Sys = 12 - -[Neo.CopyFiles.Sys] -Neo_VPN21.sys, , , 2 - -[SoftEther.NTamd64] -%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN21 - -[NeoAdapter.Install] -Characteristics = 0x1 -AddReg = Neo.Reg, NeoAdapter.Ndi -CopyFiles = Neo.CopyFiles.Sys -*IfType = 53 -*MediaType = 0 -*PhysicalMediaType = 0 - -[NeoAdapter.Install.Services] -AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% - -[NeoAdapter.Ndi] -HKR, , NetworkAddress, 0, %DefaultAddress% -HKR, Ndi, DeviceID, , "NeoAdapter_VPN21" -HKR, , DevLoader, , ndis -HKR, , DeviceVxDs, , Neo_VPN21.sys -HKR, NDIS, LogDriverName, , "Neo_VPN21" -HKR, NDIS, MajorNdisVersion, 1, 5 -HKR, NDIS, MinorNdisVersion, 1, 0 -HKR, Ndi\Interfaces, DefUpper, , "ndis5" -HKR, Ndi\Interfaces, UpperRange, , "ndis5" -HKR, Ndi\Interfaces, LowerRange, , "ethernet" -HKR, Ndi\Interfaces, DefLower, , "ethernet" -HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" -HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% -HKR, Ndi\Params\NetworkAddress, type, 0, "edit" -HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" -HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" -HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% -HKR, Ndi\Params\NetworkAddress, optional, 0, "0" -HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% -HKR, Ndi\Params\MaxSpeed, type, 0, "int" -HKR, Ndi\Params\MaxSpeed, default, 0, "100" -HKR, Ndi\Params\MaxSpeed, min, 0, "0" -HKR, Ndi\Params\MaxSpeed, max, 0, "2000" -HKR, Ndi\Params\MaxSpeed, step, 0, "1" -HKR, Ndi\Params\MaxSpeed, Base, 0, "10" -HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% -HKR, Ndi\Params\KeepLink, type, 0, "enum" -HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% -HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% -HKR, Ndi\Params\KeepLink, default, 0, "0" - - -[Neo.Service] -DisplayName = %Neo.Service.DispName% -Description = %Neo.Service.Desc% -ServiceType = 1 -StartType = 3 -ErrorControl = 1 -ServiceBinary = %12%\Neo_VPN21.sys -LoadOrderGroup = NDIS - -[Neo.Reg] -HKR, Ndi, Service, 0, Neo.Service.Name -HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" -HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" - -[Neo.EventLog] -HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN21.sys" -HKR, , TypesSupported, 0x00010001, 7 - -[Strings] -CompanyName = "SoftEther Corporation" -DiskDescription = "VPN Client Device Driver Install Disk" -Neo.Service.Name = "Neo_VPN21" -Neo.Service.DispName = "VPN Client Device Driver - VPN21" -Neo.Service.Desc = "VPN Client Adapter - VPN21" -NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN21" -Neo.EventLog.Name = "Neo" -NetworkAddress = "MAC Address" -DefaultAddress = "000001000001" -MaxSpeed = "Indicate Speed (Mbps)" -KeepLink = "Keep Link" -On = "On" -Off = "Off" - - -; Auto Generated 20180205_163610.750 - +; VPN Client Device Driver for Windows 2000 and Greater +; +; Copyright (c) SoftEther Corporation. All Rights Reserved. +; http://www.softether.co.jp/ +; +; BUILD 9658 + +[Version] +Signature = "$Windows NT$" +Class = Net +ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} +Provider = %CompanyName% +DriverVer = 02/04/2018, 4.25.0.9658 +CatalogFile.NT = inf_VPN21.cat + +[Manufacturer] +%CompanyName% = SoftEther, NTamd64 + +[SourceDisksNames] +1=%DiskDescription%, "", , + +[SourceDisksFiles] +Neo_VPN21.sys = 1 + +[DestinationDirs] +DefaultDestDir = 12 +Neo.CopyFiles.Sys = 12 + +[Neo.CopyFiles.Sys] +Neo_VPN21.sys, , , 2 + +[SoftEther.NTamd64] +%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN21 + +[NeoAdapter.Install] +Characteristics = 0x1 +AddReg = Neo.Reg, NeoAdapter.Ndi +CopyFiles = Neo.CopyFiles.Sys +*IfType = 53 +*MediaType = 0 +*PhysicalMediaType = 0 + +[NeoAdapter.Install.Services] +AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% + +[NeoAdapter.Ndi] +HKR, , NetworkAddress, 0, %DefaultAddress% +HKR, Ndi, DeviceID, , "NeoAdapter_VPN21" +HKR, , DevLoader, , ndis +HKR, , DeviceVxDs, , Neo_VPN21.sys +HKR, NDIS, LogDriverName, , "Neo_VPN21" +HKR, NDIS, MajorNdisVersion, 1, 5 +HKR, NDIS, MinorNdisVersion, 1, 0 +HKR, Ndi\Interfaces, DefUpper, , "ndis5" +HKR, Ndi\Interfaces, UpperRange, , "ndis5" +HKR, Ndi\Interfaces, LowerRange, , "ethernet" +HKR, Ndi\Interfaces, DefLower, , "ethernet" +HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" +HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% +HKR, Ndi\Params\NetworkAddress, type, 0, "edit" +HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" +HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" +HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% +HKR, Ndi\Params\NetworkAddress, optional, 0, "0" +HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% +HKR, Ndi\Params\MaxSpeed, type, 0, "int" +HKR, Ndi\Params\MaxSpeed, default, 0, "100" +HKR, Ndi\Params\MaxSpeed, min, 0, "0" +HKR, Ndi\Params\MaxSpeed, max, 0, "2000" +HKR, Ndi\Params\MaxSpeed, step, 0, "1" +HKR, Ndi\Params\MaxSpeed, Base, 0, "10" +HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% +HKR, Ndi\Params\KeepLink, type, 0, "enum" +HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% +HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% +HKR, Ndi\Params\KeepLink, default, 0, "0" + + +[Neo.Service] +DisplayName = %Neo.Service.DispName% +Description = %Neo.Service.Desc% +ServiceType = 1 +StartType = 3 +ErrorControl = 1 +ServiceBinary = %12%\Neo_VPN21.sys +LoadOrderGroup = NDIS + +[Neo.Reg] +HKR, Ndi, Service, 0, Neo.Service.Name +HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" +HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" + +[Neo.EventLog] +HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN21.sys" +HKR, , TypesSupported, 0x00010001, 7 + +[Strings] +CompanyName = "SoftEther Corporation" +DiskDescription = "VPN Client Device Driver Install Disk" +Neo.Service.Name = "Neo_VPN21" +Neo.Service.DispName = "VPN Client Device Driver - VPN21" +Neo.Service.Desc = "VPN Client Adapter - VPN21" +NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN21" +Neo.EventLog.Name = "Neo" +NetworkAddress = "MAC Address" +DefaultAddress = "000001000001" +MaxSpeed = "Indicate Speed (Mbps)" +KeepLink = "Keep Link" +On = "On" +Off = "Off" + + +; Auto Generated 20180205_163610.750 + diff --git a/src/bin/hamcore/DriverPackages/Neo6_Win8/x64/Neo6_x64_VPN22.inf b/src/bin/hamcore/DriverPackages/Neo6_Win8/x64/Neo6_x64_VPN22.inf index e124358b..47999ef7 100644 --- a/src/bin/hamcore/DriverPackages/Neo6_Win8/x64/Neo6_x64_VPN22.inf +++ b/src/bin/hamcore/DriverPackages/Neo6_Win8/x64/Neo6_x64_VPN22.inf @@ -1,114 +1,114 @@ -; VPN Client Device Driver for Windows 2000 and Greater -; -; Copyright (c) SoftEther Corporation. All Rights Reserved. -; http://www.softether.co.jp/ -; -; BUILD 9658 - -[Version] -Signature = "$Windows NT$" -Class = Net -ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} -Provider = %CompanyName% -DriverVer = 02/04/2018, 4.25.0.9658 -CatalogFile.NT = inf_VPN22.cat - -[Manufacturer] -%CompanyName% = SoftEther, NTamd64 - -[SourceDisksNames] -1=%DiskDescription%, "", , - -[SourceDisksFiles] -Neo_VPN22.sys = 1 - -[DestinationDirs] -DefaultDestDir = 12 -Neo.CopyFiles.Sys = 12 - -[Neo.CopyFiles.Sys] -Neo_VPN22.sys, , , 2 - -[SoftEther.NTamd64] -%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN22 - -[NeoAdapter.Install] -Characteristics = 0x1 -AddReg = Neo.Reg, NeoAdapter.Ndi -CopyFiles = Neo.CopyFiles.Sys -*IfType = 53 -*MediaType = 0 -*PhysicalMediaType = 0 - -[NeoAdapter.Install.Services] -AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% - -[NeoAdapter.Ndi] -HKR, , NetworkAddress, 0, %DefaultAddress% -HKR, Ndi, DeviceID, , "NeoAdapter_VPN22" -HKR, , DevLoader, , ndis -HKR, , DeviceVxDs, , Neo_VPN22.sys -HKR, NDIS, LogDriverName, , "Neo_VPN22" -HKR, NDIS, MajorNdisVersion, 1, 5 -HKR, NDIS, MinorNdisVersion, 1, 0 -HKR, Ndi\Interfaces, DefUpper, , "ndis5" -HKR, Ndi\Interfaces, UpperRange, , "ndis5" -HKR, Ndi\Interfaces, LowerRange, , "ethernet" -HKR, Ndi\Interfaces, DefLower, , "ethernet" -HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" -HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% -HKR, Ndi\Params\NetworkAddress, type, 0, "edit" -HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" -HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" -HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% -HKR, Ndi\Params\NetworkAddress, optional, 0, "0" -HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% -HKR, Ndi\Params\MaxSpeed, type, 0, "int" -HKR, Ndi\Params\MaxSpeed, default, 0, "100" -HKR, Ndi\Params\MaxSpeed, min, 0, "0" -HKR, Ndi\Params\MaxSpeed, max, 0, "2000" -HKR, Ndi\Params\MaxSpeed, step, 0, "1" -HKR, Ndi\Params\MaxSpeed, Base, 0, "10" -HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% -HKR, Ndi\Params\KeepLink, type, 0, "enum" -HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% -HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% -HKR, Ndi\Params\KeepLink, default, 0, "0" - - -[Neo.Service] -DisplayName = %Neo.Service.DispName% -Description = %Neo.Service.Desc% -ServiceType = 1 -StartType = 3 -ErrorControl = 1 -ServiceBinary = %12%\Neo_VPN22.sys -LoadOrderGroup = NDIS - -[Neo.Reg] -HKR, Ndi, Service, 0, Neo.Service.Name -HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" -HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" - -[Neo.EventLog] -HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN22.sys" -HKR, , TypesSupported, 0x00010001, 7 - -[Strings] -CompanyName = "SoftEther Corporation" -DiskDescription = "VPN Client Device Driver Install Disk" -Neo.Service.Name = "Neo_VPN22" -Neo.Service.DispName = "VPN Client Device Driver - VPN22" -Neo.Service.Desc = "VPN Client Adapter - VPN22" -NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN22" -Neo.EventLog.Name = "Neo" -NetworkAddress = "MAC Address" -DefaultAddress = "000001000001" -MaxSpeed = "Indicate Speed (Mbps)" -KeepLink = "Keep Link" -On = "On" -Off = "Off" - - -; Auto Generated 20180205_163610.751 - +; VPN Client Device Driver for Windows 2000 and Greater +; +; Copyright (c) SoftEther Corporation. All Rights Reserved. +; http://www.softether.co.jp/ +; +; BUILD 9658 + +[Version] +Signature = "$Windows NT$" +Class = Net +ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} +Provider = %CompanyName% +DriverVer = 02/04/2018, 4.25.0.9658 +CatalogFile.NT = inf_VPN22.cat + +[Manufacturer] +%CompanyName% = SoftEther, NTamd64 + +[SourceDisksNames] +1=%DiskDescription%, "", , + +[SourceDisksFiles] +Neo_VPN22.sys = 1 + +[DestinationDirs] +DefaultDestDir = 12 +Neo.CopyFiles.Sys = 12 + +[Neo.CopyFiles.Sys] +Neo_VPN22.sys, , , 2 + +[SoftEther.NTamd64] +%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN22 + +[NeoAdapter.Install] +Characteristics = 0x1 +AddReg = Neo.Reg, NeoAdapter.Ndi +CopyFiles = Neo.CopyFiles.Sys +*IfType = 53 +*MediaType = 0 +*PhysicalMediaType = 0 + +[NeoAdapter.Install.Services] +AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% + +[NeoAdapter.Ndi] +HKR, , NetworkAddress, 0, %DefaultAddress% +HKR, Ndi, DeviceID, , "NeoAdapter_VPN22" +HKR, , DevLoader, , ndis +HKR, , DeviceVxDs, , Neo_VPN22.sys +HKR, NDIS, LogDriverName, , "Neo_VPN22" +HKR, NDIS, MajorNdisVersion, 1, 5 +HKR, NDIS, MinorNdisVersion, 1, 0 +HKR, Ndi\Interfaces, DefUpper, , "ndis5" +HKR, Ndi\Interfaces, UpperRange, , "ndis5" +HKR, Ndi\Interfaces, LowerRange, , "ethernet" +HKR, Ndi\Interfaces, DefLower, , "ethernet" +HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" +HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% +HKR, Ndi\Params\NetworkAddress, type, 0, "edit" +HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" +HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" +HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% +HKR, Ndi\Params\NetworkAddress, optional, 0, "0" +HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% +HKR, Ndi\Params\MaxSpeed, type, 0, "int" +HKR, Ndi\Params\MaxSpeed, default, 0, "100" +HKR, Ndi\Params\MaxSpeed, min, 0, "0" +HKR, Ndi\Params\MaxSpeed, max, 0, "2000" +HKR, Ndi\Params\MaxSpeed, step, 0, "1" +HKR, Ndi\Params\MaxSpeed, Base, 0, "10" +HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% +HKR, Ndi\Params\KeepLink, type, 0, "enum" +HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% +HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% +HKR, Ndi\Params\KeepLink, default, 0, "0" + + +[Neo.Service] +DisplayName = %Neo.Service.DispName% +Description = %Neo.Service.Desc% +ServiceType = 1 +StartType = 3 +ErrorControl = 1 +ServiceBinary = %12%\Neo_VPN22.sys +LoadOrderGroup = NDIS + +[Neo.Reg] +HKR, Ndi, Service, 0, Neo.Service.Name +HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" +HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" + +[Neo.EventLog] +HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN22.sys" +HKR, , TypesSupported, 0x00010001, 7 + +[Strings] +CompanyName = "SoftEther Corporation" +DiskDescription = "VPN Client Device Driver Install Disk" +Neo.Service.Name = "Neo_VPN22" +Neo.Service.DispName = "VPN Client Device Driver - VPN22" +Neo.Service.Desc = "VPN Client Adapter - VPN22" +NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN22" +Neo.EventLog.Name = "Neo" +NetworkAddress = "MAC Address" +DefaultAddress = "000001000001" +MaxSpeed = "Indicate Speed (Mbps)" +KeepLink = "Keep Link" +On = "On" +Off = "Off" + + +; Auto Generated 20180205_163610.751 + diff --git a/src/bin/hamcore/DriverPackages/Neo6_Win8/x64/Neo6_x64_VPN23.inf b/src/bin/hamcore/DriverPackages/Neo6_Win8/x64/Neo6_x64_VPN23.inf index 1fe1daa4..5c3ca159 100644 --- a/src/bin/hamcore/DriverPackages/Neo6_Win8/x64/Neo6_x64_VPN23.inf +++ b/src/bin/hamcore/DriverPackages/Neo6_Win8/x64/Neo6_x64_VPN23.inf @@ -1,114 +1,114 @@ -; VPN Client Device Driver for Windows 2000 and Greater -; -; Copyright (c) SoftEther Corporation. All Rights Reserved. -; http://www.softether.co.jp/ -; -; BUILD 9658 - -[Version] -Signature = "$Windows NT$" -Class = Net -ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} -Provider = %CompanyName% -DriverVer = 02/04/2018, 4.25.0.9658 -CatalogFile.NT = inf_VPN23.cat - -[Manufacturer] -%CompanyName% = SoftEther, NTamd64 - -[SourceDisksNames] -1=%DiskDescription%, "", , - -[SourceDisksFiles] -Neo_VPN23.sys = 1 - -[DestinationDirs] -DefaultDestDir = 12 -Neo.CopyFiles.Sys = 12 - -[Neo.CopyFiles.Sys] -Neo_VPN23.sys, , , 2 - -[SoftEther.NTamd64] -%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN23 - -[NeoAdapter.Install] -Characteristics = 0x1 -AddReg = Neo.Reg, NeoAdapter.Ndi -CopyFiles = Neo.CopyFiles.Sys -*IfType = 53 -*MediaType = 0 -*PhysicalMediaType = 0 - -[NeoAdapter.Install.Services] -AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% - -[NeoAdapter.Ndi] -HKR, , NetworkAddress, 0, %DefaultAddress% -HKR, Ndi, DeviceID, , "NeoAdapter_VPN23" -HKR, , DevLoader, , ndis -HKR, , DeviceVxDs, , Neo_VPN23.sys -HKR, NDIS, LogDriverName, , "Neo_VPN23" -HKR, NDIS, MajorNdisVersion, 1, 5 -HKR, NDIS, MinorNdisVersion, 1, 0 -HKR, Ndi\Interfaces, DefUpper, , "ndis5" -HKR, Ndi\Interfaces, UpperRange, , "ndis5" -HKR, Ndi\Interfaces, LowerRange, , "ethernet" -HKR, Ndi\Interfaces, DefLower, , "ethernet" -HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" -HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% -HKR, Ndi\Params\NetworkAddress, type, 0, "edit" -HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" -HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" -HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% -HKR, Ndi\Params\NetworkAddress, optional, 0, "0" -HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% -HKR, Ndi\Params\MaxSpeed, type, 0, "int" -HKR, Ndi\Params\MaxSpeed, default, 0, "100" -HKR, Ndi\Params\MaxSpeed, min, 0, "0" -HKR, Ndi\Params\MaxSpeed, max, 0, "2000" -HKR, Ndi\Params\MaxSpeed, step, 0, "1" -HKR, Ndi\Params\MaxSpeed, Base, 0, "10" -HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% -HKR, Ndi\Params\KeepLink, type, 0, "enum" -HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% -HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% -HKR, Ndi\Params\KeepLink, default, 0, "0" - - -[Neo.Service] -DisplayName = %Neo.Service.DispName% -Description = %Neo.Service.Desc% -ServiceType = 1 -StartType = 3 -ErrorControl = 1 -ServiceBinary = %12%\Neo_VPN23.sys -LoadOrderGroup = NDIS - -[Neo.Reg] -HKR, Ndi, Service, 0, Neo.Service.Name -HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" -HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" - -[Neo.EventLog] -HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN23.sys" -HKR, , TypesSupported, 0x00010001, 7 - -[Strings] -CompanyName = "SoftEther Corporation" -DiskDescription = "VPN Client Device Driver Install Disk" -Neo.Service.Name = "Neo_VPN23" -Neo.Service.DispName = "VPN Client Device Driver - VPN23" -Neo.Service.Desc = "VPN Client Adapter - VPN23" -NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN23" -Neo.EventLog.Name = "Neo" -NetworkAddress = "MAC Address" -DefaultAddress = "000001000001" -MaxSpeed = "Indicate Speed (Mbps)" -KeepLink = "Keep Link" -On = "On" -Off = "Off" - - -; Auto Generated 20180205_163610.751 - +; VPN Client Device Driver for Windows 2000 and Greater +; +; Copyright (c) SoftEther Corporation. All Rights Reserved. +; http://www.softether.co.jp/ +; +; BUILD 9658 + +[Version] +Signature = "$Windows NT$" +Class = Net +ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} +Provider = %CompanyName% +DriverVer = 02/04/2018, 4.25.0.9658 +CatalogFile.NT = inf_VPN23.cat + +[Manufacturer] +%CompanyName% = SoftEther, NTamd64 + +[SourceDisksNames] +1=%DiskDescription%, "", , + +[SourceDisksFiles] +Neo_VPN23.sys = 1 + +[DestinationDirs] +DefaultDestDir = 12 +Neo.CopyFiles.Sys = 12 + +[Neo.CopyFiles.Sys] +Neo_VPN23.sys, , , 2 + +[SoftEther.NTamd64] +%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN23 + +[NeoAdapter.Install] +Characteristics = 0x1 +AddReg = Neo.Reg, NeoAdapter.Ndi +CopyFiles = Neo.CopyFiles.Sys +*IfType = 53 +*MediaType = 0 +*PhysicalMediaType = 0 + +[NeoAdapter.Install.Services] +AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% + +[NeoAdapter.Ndi] +HKR, , NetworkAddress, 0, %DefaultAddress% +HKR, Ndi, DeviceID, , "NeoAdapter_VPN23" +HKR, , DevLoader, , ndis +HKR, , DeviceVxDs, , Neo_VPN23.sys +HKR, NDIS, LogDriverName, , "Neo_VPN23" +HKR, NDIS, MajorNdisVersion, 1, 5 +HKR, NDIS, MinorNdisVersion, 1, 0 +HKR, Ndi\Interfaces, DefUpper, , "ndis5" +HKR, Ndi\Interfaces, UpperRange, , "ndis5" +HKR, Ndi\Interfaces, LowerRange, , "ethernet" +HKR, Ndi\Interfaces, DefLower, , "ethernet" +HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" +HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% +HKR, Ndi\Params\NetworkAddress, type, 0, "edit" +HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" +HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" +HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% +HKR, Ndi\Params\NetworkAddress, optional, 0, "0" +HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% +HKR, Ndi\Params\MaxSpeed, type, 0, "int" +HKR, Ndi\Params\MaxSpeed, default, 0, "100" +HKR, Ndi\Params\MaxSpeed, min, 0, "0" +HKR, Ndi\Params\MaxSpeed, max, 0, "2000" +HKR, Ndi\Params\MaxSpeed, step, 0, "1" +HKR, Ndi\Params\MaxSpeed, Base, 0, "10" +HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% +HKR, Ndi\Params\KeepLink, type, 0, "enum" +HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% +HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% +HKR, Ndi\Params\KeepLink, default, 0, "0" + + +[Neo.Service] +DisplayName = %Neo.Service.DispName% +Description = %Neo.Service.Desc% +ServiceType = 1 +StartType = 3 +ErrorControl = 1 +ServiceBinary = %12%\Neo_VPN23.sys +LoadOrderGroup = NDIS + +[Neo.Reg] +HKR, Ndi, Service, 0, Neo.Service.Name +HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" +HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" + +[Neo.EventLog] +HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN23.sys" +HKR, , TypesSupported, 0x00010001, 7 + +[Strings] +CompanyName = "SoftEther Corporation" +DiskDescription = "VPN Client Device Driver Install Disk" +Neo.Service.Name = "Neo_VPN23" +Neo.Service.DispName = "VPN Client Device Driver - VPN23" +Neo.Service.Desc = "VPN Client Adapter - VPN23" +NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN23" +Neo.EventLog.Name = "Neo" +NetworkAddress = "MAC Address" +DefaultAddress = "000001000001" +MaxSpeed = "Indicate Speed (Mbps)" +KeepLink = "Keep Link" +On = "On" +Off = "Off" + + +; Auto Generated 20180205_163610.751 + diff --git a/src/bin/hamcore/DriverPackages/Neo6_Win8/x64/Neo6_x64_VPN24.inf b/src/bin/hamcore/DriverPackages/Neo6_Win8/x64/Neo6_x64_VPN24.inf index 50fc9909..ce6aef59 100644 --- a/src/bin/hamcore/DriverPackages/Neo6_Win8/x64/Neo6_x64_VPN24.inf +++ b/src/bin/hamcore/DriverPackages/Neo6_Win8/x64/Neo6_x64_VPN24.inf @@ -1,114 +1,114 @@ -; VPN Client Device Driver for Windows 2000 and Greater -; -; Copyright (c) SoftEther Corporation. All Rights Reserved. -; http://www.softether.co.jp/ -; -; BUILD 9658 - -[Version] -Signature = "$Windows NT$" -Class = Net -ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} -Provider = %CompanyName% -DriverVer = 02/04/2018, 4.25.0.9658 -CatalogFile.NT = inf_VPN24.cat - -[Manufacturer] -%CompanyName% = SoftEther, NTamd64 - -[SourceDisksNames] -1=%DiskDescription%, "", , - -[SourceDisksFiles] -Neo_VPN24.sys = 1 - -[DestinationDirs] -DefaultDestDir = 12 -Neo.CopyFiles.Sys = 12 - -[Neo.CopyFiles.Sys] -Neo_VPN24.sys, , , 2 - -[SoftEther.NTamd64] -%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN24 - -[NeoAdapter.Install] -Characteristics = 0x1 -AddReg = Neo.Reg, NeoAdapter.Ndi -CopyFiles = Neo.CopyFiles.Sys -*IfType = 53 -*MediaType = 0 -*PhysicalMediaType = 0 - -[NeoAdapter.Install.Services] -AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% - -[NeoAdapter.Ndi] -HKR, , NetworkAddress, 0, %DefaultAddress% -HKR, Ndi, DeviceID, , "NeoAdapter_VPN24" -HKR, , DevLoader, , ndis -HKR, , DeviceVxDs, , Neo_VPN24.sys -HKR, NDIS, LogDriverName, , "Neo_VPN24" -HKR, NDIS, MajorNdisVersion, 1, 5 -HKR, NDIS, MinorNdisVersion, 1, 0 -HKR, Ndi\Interfaces, DefUpper, , "ndis5" -HKR, Ndi\Interfaces, UpperRange, , "ndis5" -HKR, Ndi\Interfaces, LowerRange, , "ethernet" -HKR, Ndi\Interfaces, DefLower, , "ethernet" -HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" -HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% -HKR, Ndi\Params\NetworkAddress, type, 0, "edit" -HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" -HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" -HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% -HKR, Ndi\Params\NetworkAddress, optional, 0, "0" -HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% -HKR, Ndi\Params\MaxSpeed, type, 0, "int" -HKR, Ndi\Params\MaxSpeed, default, 0, "100" -HKR, Ndi\Params\MaxSpeed, min, 0, "0" -HKR, Ndi\Params\MaxSpeed, max, 0, "2000" -HKR, Ndi\Params\MaxSpeed, step, 0, "1" -HKR, Ndi\Params\MaxSpeed, Base, 0, "10" -HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% -HKR, Ndi\Params\KeepLink, type, 0, "enum" -HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% -HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% -HKR, Ndi\Params\KeepLink, default, 0, "0" - - -[Neo.Service] -DisplayName = %Neo.Service.DispName% -Description = %Neo.Service.Desc% -ServiceType = 1 -StartType = 3 -ErrorControl = 1 -ServiceBinary = %12%\Neo_VPN24.sys -LoadOrderGroup = NDIS - -[Neo.Reg] -HKR, Ndi, Service, 0, Neo.Service.Name -HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" -HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" - -[Neo.EventLog] -HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN24.sys" -HKR, , TypesSupported, 0x00010001, 7 - -[Strings] -CompanyName = "SoftEther Corporation" -DiskDescription = "VPN Client Device Driver Install Disk" -Neo.Service.Name = "Neo_VPN24" -Neo.Service.DispName = "VPN Client Device Driver - VPN24" -Neo.Service.Desc = "VPN Client Adapter - VPN24" -NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN24" -Neo.EventLog.Name = "Neo" -NetworkAddress = "MAC Address" -DefaultAddress = "000001000001" -MaxSpeed = "Indicate Speed (Mbps)" -KeepLink = "Keep Link" -On = "On" -Off = "Off" - - -; Auto Generated 20180205_163610.752 - +; VPN Client Device Driver for Windows 2000 and Greater +; +; Copyright (c) SoftEther Corporation. All Rights Reserved. +; http://www.softether.co.jp/ +; +; BUILD 9658 + +[Version] +Signature = "$Windows NT$" +Class = Net +ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} +Provider = %CompanyName% +DriverVer = 02/04/2018, 4.25.0.9658 +CatalogFile.NT = inf_VPN24.cat + +[Manufacturer] +%CompanyName% = SoftEther, NTamd64 + +[SourceDisksNames] +1=%DiskDescription%, "", , + +[SourceDisksFiles] +Neo_VPN24.sys = 1 + +[DestinationDirs] +DefaultDestDir = 12 +Neo.CopyFiles.Sys = 12 + +[Neo.CopyFiles.Sys] +Neo_VPN24.sys, , , 2 + +[SoftEther.NTamd64] +%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN24 + +[NeoAdapter.Install] +Characteristics = 0x1 +AddReg = Neo.Reg, NeoAdapter.Ndi +CopyFiles = Neo.CopyFiles.Sys +*IfType = 53 +*MediaType = 0 +*PhysicalMediaType = 0 + +[NeoAdapter.Install.Services] +AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% + +[NeoAdapter.Ndi] +HKR, , NetworkAddress, 0, %DefaultAddress% +HKR, Ndi, DeviceID, , "NeoAdapter_VPN24" +HKR, , DevLoader, , ndis +HKR, , DeviceVxDs, , Neo_VPN24.sys +HKR, NDIS, LogDriverName, , "Neo_VPN24" +HKR, NDIS, MajorNdisVersion, 1, 5 +HKR, NDIS, MinorNdisVersion, 1, 0 +HKR, Ndi\Interfaces, DefUpper, , "ndis5" +HKR, Ndi\Interfaces, UpperRange, , "ndis5" +HKR, Ndi\Interfaces, LowerRange, , "ethernet" +HKR, Ndi\Interfaces, DefLower, , "ethernet" +HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" +HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% +HKR, Ndi\Params\NetworkAddress, type, 0, "edit" +HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" +HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" +HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% +HKR, Ndi\Params\NetworkAddress, optional, 0, "0" +HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% +HKR, Ndi\Params\MaxSpeed, type, 0, "int" +HKR, Ndi\Params\MaxSpeed, default, 0, "100" +HKR, Ndi\Params\MaxSpeed, min, 0, "0" +HKR, Ndi\Params\MaxSpeed, max, 0, "2000" +HKR, Ndi\Params\MaxSpeed, step, 0, "1" +HKR, Ndi\Params\MaxSpeed, Base, 0, "10" +HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% +HKR, Ndi\Params\KeepLink, type, 0, "enum" +HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% +HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% +HKR, Ndi\Params\KeepLink, default, 0, "0" + + +[Neo.Service] +DisplayName = %Neo.Service.DispName% +Description = %Neo.Service.Desc% +ServiceType = 1 +StartType = 3 +ErrorControl = 1 +ServiceBinary = %12%\Neo_VPN24.sys +LoadOrderGroup = NDIS + +[Neo.Reg] +HKR, Ndi, Service, 0, Neo.Service.Name +HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" +HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" + +[Neo.EventLog] +HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN24.sys" +HKR, , TypesSupported, 0x00010001, 7 + +[Strings] +CompanyName = "SoftEther Corporation" +DiskDescription = "VPN Client Device Driver Install Disk" +Neo.Service.Name = "Neo_VPN24" +Neo.Service.DispName = "VPN Client Device Driver - VPN24" +Neo.Service.Desc = "VPN Client Adapter - VPN24" +NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN24" +Neo.EventLog.Name = "Neo" +NetworkAddress = "MAC Address" +DefaultAddress = "000001000001" +MaxSpeed = "Indicate Speed (Mbps)" +KeepLink = "Keep Link" +On = "On" +Off = "Off" + + +; Auto Generated 20180205_163610.752 + diff --git a/src/bin/hamcore/DriverPackages/Neo6_Win8/x64/Neo6_x64_VPN25.inf b/src/bin/hamcore/DriverPackages/Neo6_Win8/x64/Neo6_x64_VPN25.inf index 5439bfdb..ad30d030 100644 --- a/src/bin/hamcore/DriverPackages/Neo6_Win8/x64/Neo6_x64_VPN25.inf +++ b/src/bin/hamcore/DriverPackages/Neo6_Win8/x64/Neo6_x64_VPN25.inf @@ -1,114 +1,114 @@ -; VPN Client Device Driver for Windows 2000 and Greater -; -; Copyright (c) SoftEther Corporation. All Rights Reserved. -; http://www.softether.co.jp/ -; -; BUILD 9658 - -[Version] -Signature = "$Windows NT$" -Class = Net -ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} -Provider = %CompanyName% -DriverVer = 02/04/2018, 4.25.0.9658 -CatalogFile.NT = inf_VPN25.cat - -[Manufacturer] -%CompanyName% = SoftEther, NTamd64 - -[SourceDisksNames] -1=%DiskDescription%, "", , - -[SourceDisksFiles] -Neo_VPN25.sys = 1 - -[DestinationDirs] -DefaultDestDir = 12 -Neo.CopyFiles.Sys = 12 - -[Neo.CopyFiles.Sys] -Neo_VPN25.sys, , , 2 - -[SoftEther.NTamd64] -%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN25 - -[NeoAdapter.Install] -Characteristics = 0x1 -AddReg = Neo.Reg, NeoAdapter.Ndi -CopyFiles = Neo.CopyFiles.Sys -*IfType = 53 -*MediaType = 0 -*PhysicalMediaType = 0 - -[NeoAdapter.Install.Services] -AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% - -[NeoAdapter.Ndi] -HKR, , NetworkAddress, 0, %DefaultAddress% -HKR, Ndi, DeviceID, , "NeoAdapter_VPN25" -HKR, , DevLoader, , ndis -HKR, , DeviceVxDs, , Neo_VPN25.sys -HKR, NDIS, LogDriverName, , "Neo_VPN25" -HKR, NDIS, MajorNdisVersion, 1, 5 -HKR, NDIS, MinorNdisVersion, 1, 0 -HKR, Ndi\Interfaces, DefUpper, , "ndis5" -HKR, Ndi\Interfaces, UpperRange, , "ndis5" -HKR, Ndi\Interfaces, LowerRange, , "ethernet" -HKR, Ndi\Interfaces, DefLower, , "ethernet" -HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" -HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% -HKR, Ndi\Params\NetworkAddress, type, 0, "edit" -HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" -HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" -HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% -HKR, Ndi\Params\NetworkAddress, optional, 0, "0" -HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% -HKR, Ndi\Params\MaxSpeed, type, 0, "int" -HKR, Ndi\Params\MaxSpeed, default, 0, "100" -HKR, Ndi\Params\MaxSpeed, min, 0, "0" -HKR, Ndi\Params\MaxSpeed, max, 0, "2000" -HKR, Ndi\Params\MaxSpeed, step, 0, "1" -HKR, Ndi\Params\MaxSpeed, Base, 0, "10" -HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% -HKR, Ndi\Params\KeepLink, type, 0, "enum" -HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% -HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% -HKR, Ndi\Params\KeepLink, default, 0, "0" - - -[Neo.Service] -DisplayName = %Neo.Service.DispName% -Description = %Neo.Service.Desc% -ServiceType = 1 -StartType = 3 -ErrorControl = 1 -ServiceBinary = %12%\Neo_VPN25.sys -LoadOrderGroup = NDIS - -[Neo.Reg] -HKR, Ndi, Service, 0, Neo.Service.Name -HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" -HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" - -[Neo.EventLog] -HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN25.sys" -HKR, , TypesSupported, 0x00010001, 7 - -[Strings] -CompanyName = "SoftEther Corporation" -DiskDescription = "VPN Client Device Driver Install Disk" -Neo.Service.Name = "Neo_VPN25" -Neo.Service.DispName = "VPN Client Device Driver - VPN25" -Neo.Service.Desc = "VPN Client Adapter - VPN25" -NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN25" -Neo.EventLog.Name = "Neo" -NetworkAddress = "MAC Address" -DefaultAddress = "000001000001" -MaxSpeed = "Indicate Speed (Mbps)" -KeepLink = "Keep Link" -On = "On" -Off = "Off" - - -; Auto Generated 20180205_163610.752 - +; VPN Client Device Driver for Windows 2000 and Greater +; +; Copyright (c) SoftEther Corporation. All Rights Reserved. +; http://www.softether.co.jp/ +; +; BUILD 9658 + +[Version] +Signature = "$Windows NT$" +Class = Net +ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} +Provider = %CompanyName% +DriverVer = 02/04/2018, 4.25.0.9658 +CatalogFile.NT = inf_VPN25.cat + +[Manufacturer] +%CompanyName% = SoftEther, NTamd64 + +[SourceDisksNames] +1=%DiskDescription%, "", , + +[SourceDisksFiles] +Neo_VPN25.sys = 1 + +[DestinationDirs] +DefaultDestDir = 12 +Neo.CopyFiles.Sys = 12 + +[Neo.CopyFiles.Sys] +Neo_VPN25.sys, , , 2 + +[SoftEther.NTamd64] +%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN25 + +[NeoAdapter.Install] +Characteristics = 0x1 +AddReg = Neo.Reg, NeoAdapter.Ndi +CopyFiles = Neo.CopyFiles.Sys +*IfType = 53 +*MediaType = 0 +*PhysicalMediaType = 0 + +[NeoAdapter.Install.Services] +AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% + +[NeoAdapter.Ndi] +HKR, , NetworkAddress, 0, %DefaultAddress% +HKR, Ndi, DeviceID, , "NeoAdapter_VPN25" +HKR, , DevLoader, , ndis +HKR, , DeviceVxDs, , Neo_VPN25.sys +HKR, NDIS, LogDriverName, , "Neo_VPN25" +HKR, NDIS, MajorNdisVersion, 1, 5 +HKR, NDIS, MinorNdisVersion, 1, 0 +HKR, Ndi\Interfaces, DefUpper, , "ndis5" +HKR, Ndi\Interfaces, UpperRange, , "ndis5" +HKR, Ndi\Interfaces, LowerRange, , "ethernet" +HKR, Ndi\Interfaces, DefLower, , "ethernet" +HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" +HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% +HKR, Ndi\Params\NetworkAddress, type, 0, "edit" +HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" +HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" +HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% +HKR, Ndi\Params\NetworkAddress, optional, 0, "0" +HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% +HKR, Ndi\Params\MaxSpeed, type, 0, "int" +HKR, Ndi\Params\MaxSpeed, default, 0, "100" +HKR, Ndi\Params\MaxSpeed, min, 0, "0" +HKR, Ndi\Params\MaxSpeed, max, 0, "2000" +HKR, Ndi\Params\MaxSpeed, step, 0, "1" +HKR, Ndi\Params\MaxSpeed, Base, 0, "10" +HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% +HKR, Ndi\Params\KeepLink, type, 0, "enum" +HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% +HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% +HKR, Ndi\Params\KeepLink, default, 0, "0" + + +[Neo.Service] +DisplayName = %Neo.Service.DispName% +Description = %Neo.Service.Desc% +ServiceType = 1 +StartType = 3 +ErrorControl = 1 +ServiceBinary = %12%\Neo_VPN25.sys +LoadOrderGroup = NDIS + +[Neo.Reg] +HKR, Ndi, Service, 0, Neo.Service.Name +HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" +HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" + +[Neo.EventLog] +HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN25.sys" +HKR, , TypesSupported, 0x00010001, 7 + +[Strings] +CompanyName = "SoftEther Corporation" +DiskDescription = "VPN Client Device Driver Install Disk" +Neo.Service.Name = "Neo_VPN25" +Neo.Service.DispName = "VPN Client Device Driver - VPN25" +Neo.Service.Desc = "VPN Client Adapter - VPN25" +NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN25" +Neo.EventLog.Name = "Neo" +NetworkAddress = "MAC Address" +DefaultAddress = "000001000001" +MaxSpeed = "Indicate Speed (Mbps)" +KeepLink = "Keep Link" +On = "On" +Off = "Off" + + +; Auto Generated 20180205_163610.752 + diff --git a/src/bin/hamcore/DriverPackages/Neo6_Win8/x64/Neo6_x64_VPN26.inf b/src/bin/hamcore/DriverPackages/Neo6_Win8/x64/Neo6_x64_VPN26.inf index 06b300f8..7caa5218 100644 --- a/src/bin/hamcore/DriverPackages/Neo6_Win8/x64/Neo6_x64_VPN26.inf +++ b/src/bin/hamcore/DriverPackages/Neo6_Win8/x64/Neo6_x64_VPN26.inf @@ -1,114 +1,114 @@ -; VPN Client Device Driver for Windows 2000 and Greater -; -; Copyright (c) SoftEther Corporation. All Rights Reserved. -; http://www.softether.co.jp/ -; -; BUILD 9658 - -[Version] -Signature = "$Windows NT$" -Class = Net -ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} -Provider = %CompanyName% -DriverVer = 02/04/2018, 4.25.0.9658 -CatalogFile.NT = inf_VPN26.cat - -[Manufacturer] -%CompanyName% = SoftEther, NTamd64 - -[SourceDisksNames] -1=%DiskDescription%, "", , - -[SourceDisksFiles] -Neo_VPN26.sys = 1 - -[DestinationDirs] -DefaultDestDir = 12 -Neo.CopyFiles.Sys = 12 - -[Neo.CopyFiles.Sys] -Neo_VPN26.sys, , , 2 - -[SoftEther.NTamd64] -%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN26 - -[NeoAdapter.Install] -Characteristics = 0x1 -AddReg = Neo.Reg, NeoAdapter.Ndi -CopyFiles = Neo.CopyFiles.Sys -*IfType = 53 -*MediaType = 0 -*PhysicalMediaType = 0 - -[NeoAdapter.Install.Services] -AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% - -[NeoAdapter.Ndi] -HKR, , NetworkAddress, 0, %DefaultAddress% -HKR, Ndi, DeviceID, , "NeoAdapter_VPN26" -HKR, , DevLoader, , ndis -HKR, , DeviceVxDs, , Neo_VPN26.sys -HKR, NDIS, LogDriverName, , "Neo_VPN26" -HKR, NDIS, MajorNdisVersion, 1, 5 -HKR, NDIS, MinorNdisVersion, 1, 0 -HKR, Ndi\Interfaces, DefUpper, , "ndis5" -HKR, Ndi\Interfaces, UpperRange, , "ndis5" -HKR, Ndi\Interfaces, LowerRange, , "ethernet" -HKR, Ndi\Interfaces, DefLower, , "ethernet" -HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" -HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% -HKR, Ndi\Params\NetworkAddress, type, 0, "edit" -HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" -HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" -HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% -HKR, Ndi\Params\NetworkAddress, optional, 0, "0" -HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% -HKR, Ndi\Params\MaxSpeed, type, 0, "int" -HKR, Ndi\Params\MaxSpeed, default, 0, "100" -HKR, Ndi\Params\MaxSpeed, min, 0, "0" -HKR, Ndi\Params\MaxSpeed, max, 0, "2000" -HKR, Ndi\Params\MaxSpeed, step, 0, "1" -HKR, Ndi\Params\MaxSpeed, Base, 0, "10" -HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% -HKR, Ndi\Params\KeepLink, type, 0, "enum" -HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% -HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% -HKR, Ndi\Params\KeepLink, default, 0, "0" - - -[Neo.Service] -DisplayName = %Neo.Service.DispName% -Description = %Neo.Service.Desc% -ServiceType = 1 -StartType = 3 -ErrorControl = 1 -ServiceBinary = %12%\Neo_VPN26.sys -LoadOrderGroup = NDIS - -[Neo.Reg] -HKR, Ndi, Service, 0, Neo.Service.Name -HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" -HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" - -[Neo.EventLog] -HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN26.sys" -HKR, , TypesSupported, 0x00010001, 7 - -[Strings] -CompanyName = "SoftEther Corporation" -DiskDescription = "VPN Client Device Driver Install Disk" -Neo.Service.Name = "Neo_VPN26" -Neo.Service.DispName = "VPN Client Device Driver - VPN26" -Neo.Service.Desc = "VPN Client Adapter - VPN26" -NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN26" -Neo.EventLog.Name = "Neo" -NetworkAddress = "MAC Address" -DefaultAddress = "000001000001" -MaxSpeed = "Indicate Speed (Mbps)" -KeepLink = "Keep Link" -On = "On" -Off = "Off" - - -; Auto Generated 20180205_163610.753 - +; VPN Client Device Driver for Windows 2000 and Greater +; +; Copyright (c) SoftEther Corporation. All Rights Reserved. +; http://www.softether.co.jp/ +; +; BUILD 9658 + +[Version] +Signature = "$Windows NT$" +Class = Net +ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} +Provider = %CompanyName% +DriverVer = 02/04/2018, 4.25.0.9658 +CatalogFile.NT = inf_VPN26.cat + +[Manufacturer] +%CompanyName% = SoftEther, NTamd64 + +[SourceDisksNames] +1=%DiskDescription%, "", , + +[SourceDisksFiles] +Neo_VPN26.sys = 1 + +[DestinationDirs] +DefaultDestDir = 12 +Neo.CopyFiles.Sys = 12 + +[Neo.CopyFiles.Sys] +Neo_VPN26.sys, , , 2 + +[SoftEther.NTamd64] +%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN26 + +[NeoAdapter.Install] +Characteristics = 0x1 +AddReg = Neo.Reg, NeoAdapter.Ndi +CopyFiles = Neo.CopyFiles.Sys +*IfType = 53 +*MediaType = 0 +*PhysicalMediaType = 0 + +[NeoAdapter.Install.Services] +AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% + +[NeoAdapter.Ndi] +HKR, , NetworkAddress, 0, %DefaultAddress% +HKR, Ndi, DeviceID, , "NeoAdapter_VPN26" +HKR, , DevLoader, , ndis +HKR, , DeviceVxDs, , Neo_VPN26.sys +HKR, NDIS, LogDriverName, , "Neo_VPN26" +HKR, NDIS, MajorNdisVersion, 1, 5 +HKR, NDIS, MinorNdisVersion, 1, 0 +HKR, Ndi\Interfaces, DefUpper, , "ndis5" +HKR, Ndi\Interfaces, UpperRange, , "ndis5" +HKR, Ndi\Interfaces, LowerRange, , "ethernet" +HKR, Ndi\Interfaces, DefLower, , "ethernet" +HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" +HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% +HKR, Ndi\Params\NetworkAddress, type, 0, "edit" +HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" +HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" +HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% +HKR, Ndi\Params\NetworkAddress, optional, 0, "0" +HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% +HKR, Ndi\Params\MaxSpeed, type, 0, "int" +HKR, Ndi\Params\MaxSpeed, default, 0, "100" +HKR, Ndi\Params\MaxSpeed, min, 0, "0" +HKR, Ndi\Params\MaxSpeed, max, 0, "2000" +HKR, Ndi\Params\MaxSpeed, step, 0, "1" +HKR, Ndi\Params\MaxSpeed, Base, 0, "10" +HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% +HKR, Ndi\Params\KeepLink, type, 0, "enum" +HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% +HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% +HKR, Ndi\Params\KeepLink, default, 0, "0" + + +[Neo.Service] +DisplayName = %Neo.Service.DispName% +Description = %Neo.Service.Desc% +ServiceType = 1 +StartType = 3 +ErrorControl = 1 +ServiceBinary = %12%\Neo_VPN26.sys +LoadOrderGroup = NDIS + +[Neo.Reg] +HKR, Ndi, Service, 0, Neo.Service.Name +HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" +HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" + +[Neo.EventLog] +HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN26.sys" +HKR, , TypesSupported, 0x00010001, 7 + +[Strings] +CompanyName = "SoftEther Corporation" +DiskDescription = "VPN Client Device Driver Install Disk" +Neo.Service.Name = "Neo_VPN26" +Neo.Service.DispName = "VPN Client Device Driver - VPN26" +Neo.Service.Desc = "VPN Client Adapter - VPN26" +NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN26" +Neo.EventLog.Name = "Neo" +NetworkAddress = "MAC Address" +DefaultAddress = "000001000001" +MaxSpeed = "Indicate Speed (Mbps)" +KeepLink = "Keep Link" +On = "On" +Off = "Off" + + +; Auto Generated 20180205_163610.753 + diff --git a/src/bin/hamcore/DriverPackages/Neo6_Win8/x64/Neo6_x64_VPN27.inf b/src/bin/hamcore/DriverPackages/Neo6_Win8/x64/Neo6_x64_VPN27.inf index 85eaac3b..4a2d22aa 100644 --- a/src/bin/hamcore/DriverPackages/Neo6_Win8/x64/Neo6_x64_VPN27.inf +++ b/src/bin/hamcore/DriverPackages/Neo6_Win8/x64/Neo6_x64_VPN27.inf @@ -1,114 +1,114 @@ -; VPN Client Device Driver for Windows 2000 and Greater -; -; Copyright (c) SoftEther Corporation. All Rights Reserved. -; http://www.softether.co.jp/ -; -; BUILD 9658 - -[Version] -Signature = "$Windows NT$" -Class = Net -ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} -Provider = %CompanyName% -DriverVer = 02/04/2018, 4.25.0.9658 -CatalogFile.NT = inf_VPN27.cat - -[Manufacturer] -%CompanyName% = SoftEther, NTamd64 - -[SourceDisksNames] -1=%DiskDescription%, "", , - -[SourceDisksFiles] -Neo_VPN27.sys = 1 - -[DestinationDirs] -DefaultDestDir = 12 -Neo.CopyFiles.Sys = 12 - -[Neo.CopyFiles.Sys] -Neo_VPN27.sys, , , 2 - -[SoftEther.NTamd64] -%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN27 - -[NeoAdapter.Install] -Characteristics = 0x1 -AddReg = Neo.Reg, NeoAdapter.Ndi -CopyFiles = Neo.CopyFiles.Sys -*IfType = 53 -*MediaType = 0 -*PhysicalMediaType = 0 - -[NeoAdapter.Install.Services] -AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% - -[NeoAdapter.Ndi] -HKR, , NetworkAddress, 0, %DefaultAddress% -HKR, Ndi, DeviceID, , "NeoAdapter_VPN27" -HKR, , DevLoader, , ndis -HKR, , DeviceVxDs, , Neo_VPN27.sys -HKR, NDIS, LogDriverName, , "Neo_VPN27" -HKR, NDIS, MajorNdisVersion, 1, 5 -HKR, NDIS, MinorNdisVersion, 1, 0 -HKR, Ndi\Interfaces, DefUpper, , "ndis5" -HKR, Ndi\Interfaces, UpperRange, , "ndis5" -HKR, Ndi\Interfaces, LowerRange, , "ethernet" -HKR, Ndi\Interfaces, DefLower, , "ethernet" -HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" -HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% -HKR, Ndi\Params\NetworkAddress, type, 0, "edit" -HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" -HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" -HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% -HKR, Ndi\Params\NetworkAddress, optional, 0, "0" -HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% -HKR, Ndi\Params\MaxSpeed, type, 0, "int" -HKR, Ndi\Params\MaxSpeed, default, 0, "100" -HKR, Ndi\Params\MaxSpeed, min, 0, "0" -HKR, Ndi\Params\MaxSpeed, max, 0, "2000" -HKR, Ndi\Params\MaxSpeed, step, 0, "1" -HKR, Ndi\Params\MaxSpeed, Base, 0, "10" -HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% -HKR, Ndi\Params\KeepLink, type, 0, "enum" -HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% -HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% -HKR, Ndi\Params\KeepLink, default, 0, "0" - - -[Neo.Service] -DisplayName = %Neo.Service.DispName% -Description = %Neo.Service.Desc% -ServiceType = 1 -StartType = 3 -ErrorControl = 1 -ServiceBinary = %12%\Neo_VPN27.sys -LoadOrderGroup = NDIS - -[Neo.Reg] -HKR, Ndi, Service, 0, Neo.Service.Name -HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" -HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" - -[Neo.EventLog] -HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN27.sys" -HKR, , TypesSupported, 0x00010001, 7 - -[Strings] -CompanyName = "SoftEther Corporation" -DiskDescription = "VPN Client Device Driver Install Disk" -Neo.Service.Name = "Neo_VPN27" -Neo.Service.DispName = "VPN Client Device Driver - VPN27" -Neo.Service.Desc = "VPN Client Adapter - VPN27" -NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN27" -Neo.EventLog.Name = "Neo" -NetworkAddress = "MAC Address" -DefaultAddress = "000001000001" -MaxSpeed = "Indicate Speed (Mbps)" -KeepLink = "Keep Link" -On = "On" -Off = "Off" - - -; Auto Generated 20180205_163610.753 - +; VPN Client Device Driver for Windows 2000 and Greater +; +; Copyright (c) SoftEther Corporation. All Rights Reserved. +; http://www.softether.co.jp/ +; +; BUILD 9658 + +[Version] +Signature = "$Windows NT$" +Class = Net +ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} +Provider = %CompanyName% +DriverVer = 02/04/2018, 4.25.0.9658 +CatalogFile.NT = inf_VPN27.cat + +[Manufacturer] +%CompanyName% = SoftEther, NTamd64 + +[SourceDisksNames] +1=%DiskDescription%, "", , + +[SourceDisksFiles] +Neo_VPN27.sys = 1 + +[DestinationDirs] +DefaultDestDir = 12 +Neo.CopyFiles.Sys = 12 + +[Neo.CopyFiles.Sys] +Neo_VPN27.sys, , , 2 + +[SoftEther.NTamd64] +%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN27 + +[NeoAdapter.Install] +Characteristics = 0x1 +AddReg = Neo.Reg, NeoAdapter.Ndi +CopyFiles = Neo.CopyFiles.Sys +*IfType = 53 +*MediaType = 0 +*PhysicalMediaType = 0 + +[NeoAdapter.Install.Services] +AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% + +[NeoAdapter.Ndi] +HKR, , NetworkAddress, 0, %DefaultAddress% +HKR, Ndi, DeviceID, , "NeoAdapter_VPN27" +HKR, , DevLoader, , ndis +HKR, , DeviceVxDs, , Neo_VPN27.sys +HKR, NDIS, LogDriverName, , "Neo_VPN27" +HKR, NDIS, MajorNdisVersion, 1, 5 +HKR, NDIS, MinorNdisVersion, 1, 0 +HKR, Ndi\Interfaces, DefUpper, , "ndis5" +HKR, Ndi\Interfaces, UpperRange, , "ndis5" +HKR, Ndi\Interfaces, LowerRange, , "ethernet" +HKR, Ndi\Interfaces, DefLower, , "ethernet" +HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" +HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% +HKR, Ndi\Params\NetworkAddress, type, 0, "edit" +HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" +HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" +HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% +HKR, Ndi\Params\NetworkAddress, optional, 0, "0" +HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% +HKR, Ndi\Params\MaxSpeed, type, 0, "int" +HKR, Ndi\Params\MaxSpeed, default, 0, "100" +HKR, Ndi\Params\MaxSpeed, min, 0, "0" +HKR, Ndi\Params\MaxSpeed, max, 0, "2000" +HKR, Ndi\Params\MaxSpeed, step, 0, "1" +HKR, Ndi\Params\MaxSpeed, Base, 0, "10" +HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% +HKR, Ndi\Params\KeepLink, type, 0, "enum" +HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% +HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% +HKR, Ndi\Params\KeepLink, default, 0, "0" + + +[Neo.Service] +DisplayName = %Neo.Service.DispName% +Description = %Neo.Service.Desc% +ServiceType = 1 +StartType = 3 +ErrorControl = 1 +ServiceBinary = %12%\Neo_VPN27.sys +LoadOrderGroup = NDIS + +[Neo.Reg] +HKR, Ndi, Service, 0, Neo.Service.Name +HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" +HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" + +[Neo.EventLog] +HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN27.sys" +HKR, , TypesSupported, 0x00010001, 7 + +[Strings] +CompanyName = "SoftEther Corporation" +DiskDescription = "VPN Client Device Driver Install Disk" +Neo.Service.Name = "Neo_VPN27" +Neo.Service.DispName = "VPN Client Device Driver - VPN27" +Neo.Service.Desc = "VPN Client Adapter - VPN27" +NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN27" +Neo.EventLog.Name = "Neo" +NetworkAddress = "MAC Address" +DefaultAddress = "000001000001" +MaxSpeed = "Indicate Speed (Mbps)" +KeepLink = "Keep Link" +On = "On" +Off = "Off" + + +; Auto Generated 20180205_163610.753 + diff --git a/src/bin/hamcore/DriverPackages/Neo6_Win8/x64/Neo6_x64_VPN28.inf b/src/bin/hamcore/DriverPackages/Neo6_Win8/x64/Neo6_x64_VPN28.inf index 1162da8c..e7a6990b 100644 --- a/src/bin/hamcore/DriverPackages/Neo6_Win8/x64/Neo6_x64_VPN28.inf +++ b/src/bin/hamcore/DriverPackages/Neo6_Win8/x64/Neo6_x64_VPN28.inf @@ -1,114 +1,114 @@ -; VPN Client Device Driver for Windows 2000 and Greater -; -; Copyright (c) SoftEther Corporation. All Rights Reserved. -; http://www.softether.co.jp/ -; -; BUILD 9658 - -[Version] -Signature = "$Windows NT$" -Class = Net -ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} -Provider = %CompanyName% -DriverVer = 02/04/2018, 4.25.0.9658 -CatalogFile.NT = inf_VPN28.cat - -[Manufacturer] -%CompanyName% = SoftEther, NTamd64 - -[SourceDisksNames] -1=%DiskDescription%, "", , - -[SourceDisksFiles] -Neo_VPN28.sys = 1 - -[DestinationDirs] -DefaultDestDir = 12 -Neo.CopyFiles.Sys = 12 - -[Neo.CopyFiles.Sys] -Neo_VPN28.sys, , , 2 - -[SoftEther.NTamd64] -%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN28 - -[NeoAdapter.Install] -Characteristics = 0x1 -AddReg = Neo.Reg, NeoAdapter.Ndi -CopyFiles = Neo.CopyFiles.Sys -*IfType = 53 -*MediaType = 0 -*PhysicalMediaType = 0 - -[NeoAdapter.Install.Services] -AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% - -[NeoAdapter.Ndi] -HKR, , NetworkAddress, 0, %DefaultAddress% -HKR, Ndi, DeviceID, , "NeoAdapter_VPN28" -HKR, , DevLoader, , ndis -HKR, , DeviceVxDs, , Neo_VPN28.sys -HKR, NDIS, LogDriverName, , "Neo_VPN28" -HKR, NDIS, MajorNdisVersion, 1, 5 -HKR, NDIS, MinorNdisVersion, 1, 0 -HKR, Ndi\Interfaces, DefUpper, , "ndis5" -HKR, Ndi\Interfaces, UpperRange, , "ndis5" -HKR, Ndi\Interfaces, LowerRange, , "ethernet" -HKR, Ndi\Interfaces, DefLower, , "ethernet" -HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" -HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% -HKR, Ndi\Params\NetworkAddress, type, 0, "edit" -HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" -HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" -HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% -HKR, Ndi\Params\NetworkAddress, optional, 0, "0" -HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% -HKR, Ndi\Params\MaxSpeed, type, 0, "int" -HKR, Ndi\Params\MaxSpeed, default, 0, "100" -HKR, Ndi\Params\MaxSpeed, min, 0, "0" -HKR, Ndi\Params\MaxSpeed, max, 0, "2000" -HKR, Ndi\Params\MaxSpeed, step, 0, "1" -HKR, Ndi\Params\MaxSpeed, Base, 0, "10" -HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% -HKR, Ndi\Params\KeepLink, type, 0, "enum" -HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% -HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% -HKR, Ndi\Params\KeepLink, default, 0, "0" - - -[Neo.Service] -DisplayName = %Neo.Service.DispName% -Description = %Neo.Service.Desc% -ServiceType = 1 -StartType = 3 -ErrorControl = 1 -ServiceBinary = %12%\Neo_VPN28.sys -LoadOrderGroup = NDIS - -[Neo.Reg] -HKR, Ndi, Service, 0, Neo.Service.Name -HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" -HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" - -[Neo.EventLog] -HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN28.sys" -HKR, , TypesSupported, 0x00010001, 7 - -[Strings] -CompanyName = "SoftEther Corporation" -DiskDescription = "VPN Client Device Driver Install Disk" -Neo.Service.Name = "Neo_VPN28" -Neo.Service.DispName = "VPN Client Device Driver - VPN28" -Neo.Service.Desc = "VPN Client Adapter - VPN28" -NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN28" -Neo.EventLog.Name = "Neo" -NetworkAddress = "MAC Address" -DefaultAddress = "000001000001" -MaxSpeed = "Indicate Speed (Mbps)" -KeepLink = "Keep Link" -On = "On" -Off = "Off" - - -; Auto Generated 20180205_163610.754 - +; VPN Client Device Driver for Windows 2000 and Greater +; +; Copyright (c) SoftEther Corporation. All Rights Reserved. +; http://www.softether.co.jp/ +; +; BUILD 9658 + +[Version] +Signature = "$Windows NT$" +Class = Net +ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} +Provider = %CompanyName% +DriverVer = 02/04/2018, 4.25.0.9658 +CatalogFile.NT = inf_VPN28.cat + +[Manufacturer] +%CompanyName% = SoftEther, NTamd64 + +[SourceDisksNames] +1=%DiskDescription%, "", , + +[SourceDisksFiles] +Neo_VPN28.sys = 1 + +[DestinationDirs] +DefaultDestDir = 12 +Neo.CopyFiles.Sys = 12 + +[Neo.CopyFiles.Sys] +Neo_VPN28.sys, , , 2 + +[SoftEther.NTamd64] +%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN28 + +[NeoAdapter.Install] +Characteristics = 0x1 +AddReg = Neo.Reg, NeoAdapter.Ndi +CopyFiles = Neo.CopyFiles.Sys +*IfType = 53 +*MediaType = 0 +*PhysicalMediaType = 0 + +[NeoAdapter.Install.Services] +AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% + +[NeoAdapter.Ndi] +HKR, , NetworkAddress, 0, %DefaultAddress% +HKR, Ndi, DeviceID, , "NeoAdapter_VPN28" +HKR, , DevLoader, , ndis +HKR, , DeviceVxDs, , Neo_VPN28.sys +HKR, NDIS, LogDriverName, , "Neo_VPN28" +HKR, NDIS, MajorNdisVersion, 1, 5 +HKR, NDIS, MinorNdisVersion, 1, 0 +HKR, Ndi\Interfaces, DefUpper, , "ndis5" +HKR, Ndi\Interfaces, UpperRange, , "ndis5" +HKR, Ndi\Interfaces, LowerRange, , "ethernet" +HKR, Ndi\Interfaces, DefLower, , "ethernet" +HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" +HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% +HKR, Ndi\Params\NetworkAddress, type, 0, "edit" +HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" +HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" +HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% +HKR, Ndi\Params\NetworkAddress, optional, 0, "0" +HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% +HKR, Ndi\Params\MaxSpeed, type, 0, "int" +HKR, Ndi\Params\MaxSpeed, default, 0, "100" +HKR, Ndi\Params\MaxSpeed, min, 0, "0" +HKR, Ndi\Params\MaxSpeed, max, 0, "2000" +HKR, Ndi\Params\MaxSpeed, step, 0, "1" +HKR, Ndi\Params\MaxSpeed, Base, 0, "10" +HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% +HKR, Ndi\Params\KeepLink, type, 0, "enum" +HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% +HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% +HKR, Ndi\Params\KeepLink, default, 0, "0" + + +[Neo.Service] +DisplayName = %Neo.Service.DispName% +Description = %Neo.Service.Desc% +ServiceType = 1 +StartType = 3 +ErrorControl = 1 +ServiceBinary = %12%\Neo_VPN28.sys +LoadOrderGroup = NDIS + +[Neo.Reg] +HKR, Ndi, Service, 0, Neo.Service.Name +HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" +HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" + +[Neo.EventLog] +HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN28.sys" +HKR, , TypesSupported, 0x00010001, 7 + +[Strings] +CompanyName = "SoftEther Corporation" +DiskDescription = "VPN Client Device Driver Install Disk" +Neo.Service.Name = "Neo_VPN28" +Neo.Service.DispName = "VPN Client Device Driver - VPN28" +Neo.Service.Desc = "VPN Client Adapter - VPN28" +NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN28" +Neo.EventLog.Name = "Neo" +NetworkAddress = "MAC Address" +DefaultAddress = "000001000001" +MaxSpeed = "Indicate Speed (Mbps)" +KeepLink = "Keep Link" +On = "On" +Off = "Off" + + +; Auto Generated 20180205_163610.754 + diff --git a/src/bin/hamcore/DriverPackages/Neo6_Win8/x64/Neo6_x64_VPN29.inf b/src/bin/hamcore/DriverPackages/Neo6_Win8/x64/Neo6_x64_VPN29.inf index cd37dc6a..66f2e69b 100644 --- a/src/bin/hamcore/DriverPackages/Neo6_Win8/x64/Neo6_x64_VPN29.inf +++ b/src/bin/hamcore/DriverPackages/Neo6_Win8/x64/Neo6_x64_VPN29.inf @@ -1,114 +1,114 @@ -; VPN Client Device Driver for Windows 2000 and Greater -; -; Copyright (c) SoftEther Corporation. All Rights Reserved. -; http://www.softether.co.jp/ -; -; BUILD 9658 - -[Version] -Signature = "$Windows NT$" -Class = Net -ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} -Provider = %CompanyName% -DriverVer = 02/04/2018, 4.25.0.9658 -CatalogFile.NT = inf_VPN29.cat - -[Manufacturer] -%CompanyName% = SoftEther, NTamd64 - -[SourceDisksNames] -1=%DiskDescription%, "", , - -[SourceDisksFiles] -Neo_VPN29.sys = 1 - -[DestinationDirs] -DefaultDestDir = 12 -Neo.CopyFiles.Sys = 12 - -[Neo.CopyFiles.Sys] -Neo_VPN29.sys, , , 2 - -[SoftEther.NTamd64] -%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN29 - -[NeoAdapter.Install] -Characteristics = 0x1 -AddReg = Neo.Reg, NeoAdapter.Ndi -CopyFiles = Neo.CopyFiles.Sys -*IfType = 53 -*MediaType = 0 -*PhysicalMediaType = 0 - -[NeoAdapter.Install.Services] -AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% - -[NeoAdapter.Ndi] -HKR, , NetworkAddress, 0, %DefaultAddress% -HKR, Ndi, DeviceID, , "NeoAdapter_VPN29" -HKR, , DevLoader, , ndis -HKR, , DeviceVxDs, , Neo_VPN29.sys -HKR, NDIS, LogDriverName, , "Neo_VPN29" -HKR, NDIS, MajorNdisVersion, 1, 5 -HKR, NDIS, MinorNdisVersion, 1, 0 -HKR, Ndi\Interfaces, DefUpper, , "ndis5" -HKR, Ndi\Interfaces, UpperRange, , "ndis5" -HKR, Ndi\Interfaces, LowerRange, , "ethernet" -HKR, Ndi\Interfaces, DefLower, , "ethernet" -HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" -HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% -HKR, Ndi\Params\NetworkAddress, type, 0, "edit" -HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" -HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" -HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% -HKR, Ndi\Params\NetworkAddress, optional, 0, "0" -HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% -HKR, Ndi\Params\MaxSpeed, type, 0, "int" -HKR, Ndi\Params\MaxSpeed, default, 0, "100" -HKR, Ndi\Params\MaxSpeed, min, 0, "0" -HKR, Ndi\Params\MaxSpeed, max, 0, "2000" -HKR, Ndi\Params\MaxSpeed, step, 0, "1" -HKR, Ndi\Params\MaxSpeed, Base, 0, "10" -HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% -HKR, Ndi\Params\KeepLink, type, 0, "enum" -HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% -HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% -HKR, Ndi\Params\KeepLink, default, 0, "0" - - -[Neo.Service] -DisplayName = %Neo.Service.DispName% -Description = %Neo.Service.Desc% -ServiceType = 1 -StartType = 3 -ErrorControl = 1 -ServiceBinary = %12%\Neo_VPN29.sys -LoadOrderGroup = NDIS - -[Neo.Reg] -HKR, Ndi, Service, 0, Neo.Service.Name -HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" -HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" - -[Neo.EventLog] -HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN29.sys" -HKR, , TypesSupported, 0x00010001, 7 - -[Strings] -CompanyName = "SoftEther Corporation" -DiskDescription = "VPN Client Device Driver Install Disk" -Neo.Service.Name = "Neo_VPN29" -Neo.Service.DispName = "VPN Client Device Driver - VPN29" -Neo.Service.Desc = "VPN Client Adapter - VPN29" -NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN29" -Neo.EventLog.Name = "Neo" -NetworkAddress = "MAC Address" -DefaultAddress = "000001000001" -MaxSpeed = "Indicate Speed (Mbps)" -KeepLink = "Keep Link" -On = "On" -Off = "Off" - - -; Auto Generated 20180205_163610.754 - +; VPN Client Device Driver for Windows 2000 and Greater +; +; Copyright (c) SoftEther Corporation. All Rights Reserved. +; http://www.softether.co.jp/ +; +; BUILD 9658 + +[Version] +Signature = "$Windows NT$" +Class = Net +ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} +Provider = %CompanyName% +DriverVer = 02/04/2018, 4.25.0.9658 +CatalogFile.NT = inf_VPN29.cat + +[Manufacturer] +%CompanyName% = SoftEther, NTamd64 + +[SourceDisksNames] +1=%DiskDescription%, "", , + +[SourceDisksFiles] +Neo_VPN29.sys = 1 + +[DestinationDirs] +DefaultDestDir = 12 +Neo.CopyFiles.Sys = 12 + +[Neo.CopyFiles.Sys] +Neo_VPN29.sys, , , 2 + +[SoftEther.NTamd64] +%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN29 + +[NeoAdapter.Install] +Characteristics = 0x1 +AddReg = Neo.Reg, NeoAdapter.Ndi +CopyFiles = Neo.CopyFiles.Sys +*IfType = 53 +*MediaType = 0 +*PhysicalMediaType = 0 + +[NeoAdapter.Install.Services] +AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% + +[NeoAdapter.Ndi] +HKR, , NetworkAddress, 0, %DefaultAddress% +HKR, Ndi, DeviceID, , "NeoAdapter_VPN29" +HKR, , DevLoader, , ndis +HKR, , DeviceVxDs, , Neo_VPN29.sys +HKR, NDIS, LogDriverName, , "Neo_VPN29" +HKR, NDIS, MajorNdisVersion, 1, 5 +HKR, NDIS, MinorNdisVersion, 1, 0 +HKR, Ndi\Interfaces, DefUpper, , "ndis5" +HKR, Ndi\Interfaces, UpperRange, , "ndis5" +HKR, Ndi\Interfaces, LowerRange, , "ethernet" +HKR, Ndi\Interfaces, DefLower, , "ethernet" +HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" +HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% +HKR, Ndi\Params\NetworkAddress, type, 0, "edit" +HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" +HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" +HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% +HKR, Ndi\Params\NetworkAddress, optional, 0, "0" +HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% +HKR, Ndi\Params\MaxSpeed, type, 0, "int" +HKR, Ndi\Params\MaxSpeed, default, 0, "100" +HKR, Ndi\Params\MaxSpeed, min, 0, "0" +HKR, Ndi\Params\MaxSpeed, max, 0, "2000" +HKR, Ndi\Params\MaxSpeed, step, 0, "1" +HKR, Ndi\Params\MaxSpeed, Base, 0, "10" +HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% +HKR, Ndi\Params\KeepLink, type, 0, "enum" +HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% +HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% +HKR, Ndi\Params\KeepLink, default, 0, "0" + + +[Neo.Service] +DisplayName = %Neo.Service.DispName% +Description = %Neo.Service.Desc% +ServiceType = 1 +StartType = 3 +ErrorControl = 1 +ServiceBinary = %12%\Neo_VPN29.sys +LoadOrderGroup = NDIS + +[Neo.Reg] +HKR, Ndi, Service, 0, Neo.Service.Name +HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" +HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" + +[Neo.EventLog] +HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN29.sys" +HKR, , TypesSupported, 0x00010001, 7 + +[Strings] +CompanyName = "SoftEther Corporation" +DiskDescription = "VPN Client Device Driver Install Disk" +Neo.Service.Name = "Neo_VPN29" +Neo.Service.DispName = "VPN Client Device Driver - VPN29" +Neo.Service.Desc = "VPN Client Adapter - VPN29" +NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN29" +Neo.EventLog.Name = "Neo" +NetworkAddress = "MAC Address" +DefaultAddress = "000001000001" +MaxSpeed = "Indicate Speed (Mbps)" +KeepLink = "Keep Link" +On = "On" +Off = "Off" + + +; Auto Generated 20180205_163610.754 + diff --git a/src/bin/hamcore/DriverPackages/Neo6_Win8/x64/Neo6_x64_VPN3.inf b/src/bin/hamcore/DriverPackages/Neo6_Win8/x64/Neo6_x64_VPN3.inf index e624a9e4..376541b3 100644 --- a/src/bin/hamcore/DriverPackages/Neo6_Win8/x64/Neo6_x64_VPN3.inf +++ b/src/bin/hamcore/DriverPackages/Neo6_Win8/x64/Neo6_x64_VPN3.inf @@ -1,114 +1,114 @@ -; VPN Client Device Driver for Windows 2000 and Greater -; -; Copyright (c) SoftEther Corporation. All Rights Reserved. -; http://www.softether.co.jp/ -; -; BUILD 9658 - -[Version] -Signature = "$Windows NT$" -Class = Net -ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} -Provider = %CompanyName% -DriverVer = 02/04/2018, 4.25.0.9658 -CatalogFile.NT = inf_VPN3.cat - -[Manufacturer] -%CompanyName% = SoftEther, NTamd64 - -[SourceDisksNames] -1=%DiskDescription%, "", , - -[SourceDisksFiles] -Neo_VPN3.sys = 1 - -[DestinationDirs] -DefaultDestDir = 12 -Neo.CopyFiles.Sys = 12 - -[Neo.CopyFiles.Sys] -Neo_VPN3.sys, , , 2 - -[SoftEther.NTamd64] -%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN3 - -[NeoAdapter.Install] -Characteristics = 0x1 -AddReg = Neo.Reg, NeoAdapter.Ndi -CopyFiles = Neo.CopyFiles.Sys -*IfType = 53 -*MediaType = 0 -*PhysicalMediaType = 0 - -[NeoAdapter.Install.Services] -AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% - -[NeoAdapter.Ndi] -HKR, , NetworkAddress, 0, %DefaultAddress% -HKR, Ndi, DeviceID, , "NeoAdapter_VPN3" -HKR, , DevLoader, , ndis -HKR, , DeviceVxDs, , Neo_VPN3.sys -HKR, NDIS, LogDriverName, , "Neo_VPN3" -HKR, NDIS, MajorNdisVersion, 1, 5 -HKR, NDIS, MinorNdisVersion, 1, 0 -HKR, Ndi\Interfaces, DefUpper, , "ndis5" -HKR, Ndi\Interfaces, UpperRange, , "ndis5" -HKR, Ndi\Interfaces, LowerRange, , "ethernet" -HKR, Ndi\Interfaces, DefLower, , "ethernet" -HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" -HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% -HKR, Ndi\Params\NetworkAddress, type, 0, "edit" -HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" -HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" -HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% -HKR, Ndi\Params\NetworkAddress, optional, 0, "0" -HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% -HKR, Ndi\Params\MaxSpeed, type, 0, "int" -HKR, Ndi\Params\MaxSpeed, default, 0, "100" -HKR, Ndi\Params\MaxSpeed, min, 0, "0" -HKR, Ndi\Params\MaxSpeed, max, 0, "2000" -HKR, Ndi\Params\MaxSpeed, step, 0, "1" -HKR, Ndi\Params\MaxSpeed, Base, 0, "10" -HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% -HKR, Ndi\Params\KeepLink, type, 0, "enum" -HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% -HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% -HKR, Ndi\Params\KeepLink, default, 0, "0" - - -[Neo.Service] -DisplayName = %Neo.Service.DispName% -Description = %Neo.Service.Desc% -ServiceType = 1 -StartType = 3 -ErrorControl = 1 -ServiceBinary = %12%\Neo_VPN3.sys -LoadOrderGroup = NDIS - -[Neo.Reg] -HKR, Ndi, Service, 0, Neo.Service.Name -HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" -HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" - -[Neo.EventLog] -HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN3.sys" -HKR, , TypesSupported, 0x00010001, 7 - -[Strings] -CompanyName = "SoftEther Corporation" -DiskDescription = "VPN Client Device Driver Install Disk" -Neo.Service.Name = "Neo_VPN3" -Neo.Service.DispName = "VPN Client Device Driver - VPN3" -Neo.Service.Desc = "VPN Client Adapter - VPN3" -NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN3" -Neo.EventLog.Name = "Neo" -NetworkAddress = "MAC Address" -DefaultAddress = "000001000001" -MaxSpeed = "Indicate Speed (Mbps)" -KeepLink = "Keep Link" -On = "On" -Off = "Off" - - -; Auto Generated 20180205_163610.739 - +; VPN Client Device Driver for Windows 2000 and Greater +; +; Copyright (c) SoftEther Corporation. All Rights Reserved. +; http://www.softether.co.jp/ +; +; BUILD 9658 + +[Version] +Signature = "$Windows NT$" +Class = Net +ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} +Provider = %CompanyName% +DriverVer = 02/04/2018, 4.25.0.9658 +CatalogFile.NT = inf_VPN3.cat + +[Manufacturer] +%CompanyName% = SoftEther, NTamd64 + +[SourceDisksNames] +1=%DiskDescription%, "", , + +[SourceDisksFiles] +Neo_VPN3.sys = 1 + +[DestinationDirs] +DefaultDestDir = 12 +Neo.CopyFiles.Sys = 12 + +[Neo.CopyFiles.Sys] +Neo_VPN3.sys, , , 2 + +[SoftEther.NTamd64] +%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN3 + +[NeoAdapter.Install] +Characteristics = 0x1 +AddReg = Neo.Reg, NeoAdapter.Ndi +CopyFiles = Neo.CopyFiles.Sys +*IfType = 53 +*MediaType = 0 +*PhysicalMediaType = 0 + +[NeoAdapter.Install.Services] +AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% + +[NeoAdapter.Ndi] +HKR, , NetworkAddress, 0, %DefaultAddress% +HKR, Ndi, DeviceID, , "NeoAdapter_VPN3" +HKR, , DevLoader, , ndis +HKR, , DeviceVxDs, , Neo_VPN3.sys +HKR, NDIS, LogDriverName, , "Neo_VPN3" +HKR, NDIS, MajorNdisVersion, 1, 5 +HKR, NDIS, MinorNdisVersion, 1, 0 +HKR, Ndi\Interfaces, DefUpper, , "ndis5" +HKR, Ndi\Interfaces, UpperRange, , "ndis5" +HKR, Ndi\Interfaces, LowerRange, , "ethernet" +HKR, Ndi\Interfaces, DefLower, , "ethernet" +HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" +HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% +HKR, Ndi\Params\NetworkAddress, type, 0, "edit" +HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" +HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" +HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% +HKR, Ndi\Params\NetworkAddress, optional, 0, "0" +HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% +HKR, Ndi\Params\MaxSpeed, type, 0, "int" +HKR, Ndi\Params\MaxSpeed, default, 0, "100" +HKR, Ndi\Params\MaxSpeed, min, 0, "0" +HKR, Ndi\Params\MaxSpeed, max, 0, "2000" +HKR, Ndi\Params\MaxSpeed, step, 0, "1" +HKR, Ndi\Params\MaxSpeed, Base, 0, "10" +HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% +HKR, Ndi\Params\KeepLink, type, 0, "enum" +HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% +HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% +HKR, Ndi\Params\KeepLink, default, 0, "0" + + +[Neo.Service] +DisplayName = %Neo.Service.DispName% +Description = %Neo.Service.Desc% +ServiceType = 1 +StartType = 3 +ErrorControl = 1 +ServiceBinary = %12%\Neo_VPN3.sys +LoadOrderGroup = NDIS + +[Neo.Reg] +HKR, Ndi, Service, 0, Neo.Service.Name +HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" +HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" + +[Neo.EventLog] +HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN3.sys" +HKR, , TypesSupported, 0x00010001, 7 + +[Strings] +CompanyName = "SoftEther Corporation" +DiskDescription = "VPN Client Device Driver Install Disk" +Neo.Service.Name = "Neo_VPN3" +Neo.Service.DispName = "VPN Client Device Driver - VPN3" +Neo.Service.Desc = "VPN Client Adapter - VPN3" +NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN3" +Neo.EventLog.Name = "Neo" +NetworkAddress = "MAC Address" +DefaultAddress = "000001000001" +MaxSpeed = "Indicate Speed (Mbps)" +KeepLink = "Keep Link" +On = "On" +Off = "Off" + + +; Auto Generated 20180205_163610.739 + diff --git a/src/bin/hamcore/DriverPackages/Neo6_Win8/x64/Neo6_x64_VPN30.inf b/src/bin/hamcore/DriverPackages/Neo6_Win8/x64/Neo6_x64_VPN30.inf index 58a82b47..ab6f1132 100644 --- a/src/bin/hamcore/DriverPackages/Neo6_Win8/x64/Neo6_x64_VPN30.inf +++ b/src/bin/hamcore/DriverPackages/Neo6_Win8/x64/Neo6_x64_VPN30.inf @@ -1,114 +1,114 @@ -; VPN Client Device Driver for Windows 2000 and Greater -; -; Copyright (c) SoftEther Corporation. All Rights Reserved. -; http://www.softether.co.jp/ -; -; BUILD 9658 - -[Version] -Signature = "$Windows NT$" -Class = Net -ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} -Provider = %CompanyName% -DriverVer = 02/04/2018, 4.25.0.9658 -CatalogFile.NT = inf_VPN30.cat - -[Manufacturer] -%CompanyName% = SoftEther, NTamd64 - -[SourceDisksNames] -1=%DiskDescription%, "", , - -[SourceDisksFiles] -Neo_VPN30.sys = 1 - -[DestinationDirs] -DefaultDestDir = 12 -Neo.CopyFiles.Sys = 12 - -[Neo.CopyFiles.Sys] -Neo_VPN30.sys, , , 2 - -[SoftEther.NTamd64] -%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN30 - -[NeoAdapter.Install] -Characteristics = 0x1 -AddReg = Neo.Reg, NeoAdapter.Ndi -CopyFiles = Neo.CopyFiles.Sys -*IfType = 53 -*MediaType = 0 -*PhysicalMediaType = 0 - -[NeoAdapter.Install.Services] -AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% - -[NeoAdapter.Ndi] -HKR, , NetworkAddress, 0, %DefaultAddress% -HKR, Ndi, DeviceID, , "NeoAdapter_VPN30" -HKR, , DevLoader, , ndis -HKR, , DeviceVxDs, , Neo_VPN30.sys -HKR, NDIS, LogDriverName, , "Neo_VPN30" -HKR, NDIS, MajorNdisVersion, 1, 5 -HKR, NDIS, MinorNdisVersion, 1, 0 -HKR, Ndi\Interfaces, DefUpper, , "ndis5" -HKR, Ndi\Interfaces, UpperRange, , "ndis5" -HKR, Ndi\Interfaces, LowerRange, , "ethernet" -HKR, Ndi\Interfaces, DefLower, , "ethernet" -HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" -HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% -HKR, Ndi\Params\NetworkAddress, type, 0, "edit" -HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" -HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" -HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% -HKR, Ndi\Params\NetworkAddress, optional, 0, "0" -HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% -HKR, Ndi\Params\MaxSpeed, type, 0, "int" -HKR, Ndi\Params\MaxSpeed, default, 0, "100" -HKR, Ndi\Params\MaxSpeed, min, 0, "0" -HKR, Ndi\Params\MaxSpeed, max, 0, "2000" -HKR, Ndi\Params\MaxSpeed, step, 0, "1" -HKR, Ndi\Params\MaxSpeed, Base, 0, "10" -HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% -HKR, Ndi\Params\KeepLink, type, 0, "enum" -HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% -HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% -HKR, Ndi\Params\KeepLink, default, 0, "0" - - -[Neo.Service] -DisplayName = %Neo.Service.DispName% -Description = %Neo.Service.Desc% -ServiceType = 1 -StartType = 3 -ErrorControl = 1 -ServiceBinary = %12%\Neo_VPN30.sys -LoadOrderGroup = NDIS - -[Neo.Reg] -HKR, Ndi, Service, 0, Neo.Service.Name -HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" -HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" - -[Neo.EventLog] -HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN30.sys" -HKR, , TypesSupported, 0x00010001, 7 - -[Strings] -CompanyName = "SoftEther Corporation" -DiskDescription = "VPN Client Device Driver Install Disk" -Neo.Service.Name = "Neo_VPN30" -Neo.Service.DispName = "VPN Client Device Driver - VPN30" -Neo.Service.Desc = "VPN Client Adapter - VPN30" -NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN30" -Neo.EventLog.Name = "Neo" -NetworkAddress = "MAC Address" -DefaultAddress = "000001000001" -MaxSpeed = "Indicate Speed (Mbps)" -KeepLink = "Keep Link" -On = "On" -Off = "Off" - - -; Auto Generated 20180205_163610.755 - +; VPN Client Device Driver for Windows 2000 and Greater +; +; Copyright (c) SoftEther Corporation. All Rights Reserved. +; http://www.softether.co.jp/ +; +; BUILD 9658 + +[Version] +Signature = "$Windows NT$" +Class = Net +ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} +Provider = %CompanyName% +DriverVer = 02/04/2018, 4.25.0.9658 +CatalogFile.NT = inf_VPN30.cat + +[Manufacturer] +%CompanyName% = SoftEther, NTamd64 + +[SourceDisksNames] +1=%DiskDescription%, "", , + +[SourceDisksFiles] +Neo_VPN30.sys = 1 + +[DestinationDirs] +DefaultDestDir = 12 +Neo.CopyFiles.Sys = 12 + +[Neo.CopyFiles.Sys] +Neo_VPN30.sys, , , 2 + +[SoftEther.NTamd64] +%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN30 + +[NeoAdapter.Install] +Characteristics = 0x1 +AddReg = Neo.Reg, NeoAdapter.Ndi +CopyFiles = Neo.CopyFiles.Sys +*IfType = 53 +*MediaType = 0 +*PhysicalMediaType = 0 + +[NeoAdapter.Install.Services] +AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% + +[NeoAdapter.Ndi] +HKR, , NetworkAddress, 0, %DefaultAddress% +HKR, Ndi, DeviceID, , "NeoAdapter_VPN30" +HKR, , DevLoader, , ndis +HKR, , DeviceVxDs, , Neo_VPN30.sys +HKR, NDIS, LogDriverName, , "Neo_VPN30" +HKR, NDIS, MajorNdisVersion, 1, 5 +HKR, NDIS, MinorNdisVersion, 1, 0 +HKR, Ndi\Interfaces, DefUpper, , "ndis5" +HKR, Ndi\Interfaces, UpperRange, , "ndis5" +HKR, Ndi\Interfaces, LowerRange, , "ethernet" +HKR, Ndi\Interfaces, DefLower, , "ethernet" +HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" +HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% +HKR, Ndi\Params\NetworkAddress, type, 0, "edit" +HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" +HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" +HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% +HKR, Ndi\Params\NetworkAddress, optional, 0, "0" +HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% +HKR, Ndi\Params\MaxSpeed, type, 0, "int" +HKR, Ndi\Params\MaxSpeed, default, 0, "100" +HKR, Ndi\Params\MaxSpeed, min, 0, "0" +HKR, Ndi\Params\MaxSpeed, max, 0, "2000" +HKR, Ndi\Params\MaxSpeed, step, 0, "1" +HKR, Ndi\Params\MaxSpeed, Base, 0, "10" +HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% +HKR, Ndi\Params\KeepLink, type, 0, "enum" +HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% +HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% +HKR, Ndi\Params\KeepLink, default, 0, "0" + + +[Neo.Service] +DisplayName = %Neo.Service.DispName% +Description = %Neo.Service.Desc% +ServiceType = 1 +StartType = 3 +ErrorControl = 1 +ServiceBinary = %12%\Neo_VPN30.sys +LoadOrderGroup = NDIS + +[Neo.Reg] +HKR, Ndi, Service, 0, Neo.Service.Name +HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" +HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" + +[Neo.EventLog] +HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN30.sys" +HKR, , TypesSupported, 0x00010001, 7 + +[Strings] +CompanyName = "SoftEther Corporation" +DiskDescription = "VPN Client Device Driver Install Disk" +Neo.Service.Name = "Neo_VPN30" +Neo.Service.DispName = "VPN Client Device Driver - VPN30" +Neo.Service.Desc = "VPN Client Adapter - VPN30" +NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN30" +Neo.EventLog.Name = "Neo" +NetworkAddress = "MAC Address" +DefaultAddress = "000001000001" +MaxSpeed = "Indicate Speed (Mbps)" +KeepLink = "Keep Link" +On = "On" +Off = "Off" + + +; Auto Generated 20180205_163610.755 + diff --git a/src/bin/hamcore/DriverPackages/Neo6_Win8/x64/Neo6_x64_VPN31.inf b/src/bin/hamcore/DriverPackages/Neo6_Win8/x64/Neo6_x64_VPN31.inf index 7dd3595a..a6cc3120 100644 --- a/src/bin/hamcore/DriverPackages/Neo6_Win8/x64/Neo6_x64_VPN31.inf +++ b/src/bin/hamcore/DriverPackages/Neo6_Win8/x64/Neo6_x64_VPN31.inf @@ -1,114 +1,114 @@ -; VPN Client Device Driver for Windows 2000 and Greater -; -; Copyright (c) SoftEther Corporation. All Rights Reserved. -; http://www.softether.co.jp/ -; -; BUILD 9658 - -[Version] -Signature = "$Windows NT$" -Class = Net -ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} -Provider = %CompanyName% -DriverVer = 02/04/2018, 4.25.0.9658 -CatalogFile.NT = inf_VPN31.cat - -[Manufacturer] -%CompanyName% = SoftEther, NTamd64 - -[SourceDisksNames] -1=%DiskDescription%, "", , - -[SourceDisksFiles] -Neo_VPN31.sys = 1 - -[DestinationDirs] -DefaultDestDir = 12 -Neo.CopyFiles.Sys = 12 - -[Neo.CopyFiles.Sys] -Neo_VPN31.sys, , , 2 - -[SoftEther.NTamd64] -%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN31 - -[NeoAdapter.Install] -Characteristics = 0x1 -AddReg = Neo.Reg, NeoAdapter.Ndi -CopyFiles = Neo.CopyFiles.Sys -*IfType = 53 -*MediaType = 0 -*PhysicalMediaType = 0 - -[NeoAdapter.Install.Services] -AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% - -[NeoAdapter.Ndi] -HKR, , NetworkAddress, 0, %DefaultAddress% -HKR, Ndi, DeviceID, , "NeoAdapter_VPN31" -HKR, , DevLoader, , ndis -HKR, , DeviceVxDs, , Neo_VPN31.sys -HKR, NDIS, LogDriverName, , "Neo_VPN31" -HKR, NDIS, MajorNdisVersion, 1, 5 -HKR, NDIS, MinorNdisVersion, 1, 0 -HKR, Ndi\Interfaces, DefUpper, , "ndis5" -HKR, Ndi\Interfaces, UpperRange, , "ndis5" -HKR, Ndi\Interfaces, LowerRange, , "ethernet" -HKR, Ndi\Interfaces, DefLower, , "ethernet" -HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" -HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% -HKR, Ndi\Params\NetworkAddress, type, 0, "edit" -HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" -HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" -HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% -HKR, Ndi\Params\NetworkAddress, optional, 0, "0" -HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% -HKR, Ndi\Params\MaxSpeed, type, 0, "int" -HKR, Ndi\Params\MaxSpeed, default, 0, "100" -HKR, Ndi\Params\MaxSpeed, min, 0, "0" -HKR, Ndi\Params\MaxSpeed, max, 0, "2000" -HKR, Ndi\Params\MaxSpeed, step, 0, "1" -HKR, Ndi\Params\MaxSpeed, Base, 0, "10" -HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% -HKR, Ndi\Params\KeepLink, type, 0, "enum" -HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% -HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% -HKR, Ndi\Params\KeepLink, default, 0, "0" - - -[Neo.Service] -DisplayName = %Neo.Service.DispName% -Description = %Neo.Service.Desc% -ServiceType = 1 -StartType = 3 -ErrorControl = 1 -ServiceBinary = %12%\Neo_VPN31.sys -LoadOrderGroup = NDIS - -[Neo.Reg] -HKR, Ndi, Service, 0, Neo.Service.Name -HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" -HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" - -[Neo.EventLog] -HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN31.sys" -HKR, , TypesSupported, 0x00010001, 7 - -[Strings] -CompanyName = "SoftEther Corporation" -DiskDescription = "VPN Client Device Driver Install Disk" -Neo.Service.Name = "Neo_VPN31" -Neo.Service.DispName = "VPN Client Device Driver - VPN31" -Neo.Service.Desc = "VPN Client Adapter - VPN31" -NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN31" -Neo.EventLog.Name = "Neo" -NetworkAddress = "MAC Address" -DefaultAddress = "000001000001" -MaxSpeed = "Indicate Speed (Mbps)" -KeepLink = "Keep Link" -On = "On" -Off = "Off" - - -; Auto Generated 20180205_163610.755 - +; VPN Client Device Driver for Windows 2000 and Greater +; +; Copyright (c) SoftEther Corporation. All Rights Reserved. +; http://www.softether.co.jp/ +; +; BUILD 9658 + +[Version] +Signature = "$Windows NT$" +Class = Net +ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} +Provider = %CompanyName% +DriverVer = 02/04/2018, 4.25.0.9658 +CatalogFile.NT = inf_VPN31.cat + +[Manufacturer] +%CompanyName% = SoftEther, NTamd64 + +[SourceDisksNames] +1=%DiskDescription%, "", , + +[SourceDisksFiles] +Neo_VPN31.sys = 1 + +[DestinationDirs] +DefaultDestDir = 12 +Neo.CopyFiles.Sys = 12 + +[Neo.CopyFiles.Sys] +Neo_VPN31.sys, , , 2 + +[SoftEther.NTamd64] +%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN31 + +[NeoAdapter.Install] +Characteristics = 0x1 +AddReg = Neo.Reg, NeoAdapter.Ndi +CopyFiles = Neo.CopyFiles.Sys +*IfType = 53 +*MediaType = 0 +*PhysicalMediaType = 0 + +[NeoAdapter.Install.Services] +AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% + +[NeoAdapter.Ndi] +HKR, , NetworkAddress, 0, %DefaultAddress% +HKR, Ndi, DeviceID, , "NeoAdapter_VPN31" +HKR, , DevLoader, , ndis +HKR, , DeviceVxDs, , Neo_VPN31.sys +HKR, NDIS, LogDriverName, , "Neo_VPN31" +HKR, NDIS, MajorNdisVersion, 1, 5 +HKR, NDIS, MinorNdisVersion, 1, 0 +HKR, Ndi\Interfaces, DefUpper, , "ndis5" +HKR, Ndi\Interfaces, UpperRange, , "ndis5" +HKR, Ndi\Interfaces, LowerRange, , "ethernet" +HKR, Ndi\Interfaces, DefLower, , "ethernet" +HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" +HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% +HKR, Ndi\Params\NetworkAddress, type, 0, "edit" +HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" +HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" +HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% +HKR, Ndi\Params\NetworkAddress, optional, 0, "0" +HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% +HKR, Ndi\Params\MaxSpeed, type, 0, "int" +HKR, Ndi\Params\MaxSpeed, default, 0, "100" +HKR, Ndi\Params\MaxSpeed, min, 0, "0" +HKR, Ndi\Params\MaxSpeed, max, 0, "2000" +HKR, Ndi\Params\MaxSpeed, step, 0, "1" +HKR, Ndi\Params\MaxSpeed, Base, 0, "10" +HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% +HKR, Ndi\Params\KeepLink, type, 0, "enum" +HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% +HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% +HKR, Ndi\Params\KeepLink, default, 0, "0" + + +[Neo.Service] +DisplayName = %Neo.Service.DispName% +Description = %Neo.Service.Desc% +ServiceType = 1 +StartType = 3 +ErrorControl = 1 +ServiceBinary = %12%\Neo_VPN31.sys +LoadOrderGroup = NDIS + +[Neo.Reg] +HKR, Ndi, Service, 0, Neo.Service.Name +HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" +HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" + +[Neo.EventLog] +HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN31.sys" +HKR, , TypesSupported, 0x00010001, 7 + +[Strings] +CompanyName = "SoftEther Corporation" +DiskDescription = "VPN Client Device Driver Install Disk" +Neo.Service.Name = "Neo_VPN31" +Neo.Service.DispName = "VPN Client Device Driver - VPN31" +Neo.Service.Desc = "VPN Client Adapter - VPN31" +NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN31" +Neo.EventLog.Name = "Neo" +NetworkAddress = "MAC Address" +DefaultAddress = "000001000001" +MaxSpeed = "Indicate Speed (Mbps)" +KeepLink = "Keep Link" +On = "On" +Off = "Off" + + +; Auto Generated 20180205_163610.755 + diff --git a/src/bin/hamcore/DriverPackages/Neo6_Win8/x64/Neo6_x64_VPN32.inf b/src/bin/hamcore/DriverPackages/Neo6_Win8/x64/Neo6_x64_VPN32.inf index 77d82d55..6dfd6440 100644 --- a/src/bin/hamcore/DriverPackages/Neo6_Win8/x64/Neo6_x64_VPN32.inf +++ b/src/bin/hamcore/DriverPackages/Neo6_Win8/x64/Neo6_x64_VPN32.inf @@ -1,114 +1,114 @@ -; VPN Client Device Driver for Windows 2000 and Greater -; -; Copyright (c) SoftEther Corporation. All Rights Reserved. -; http://www.softether.co.jp/ -; -; BUILD 9658 - -[Version] -Signature = "$Windows NT$" -Class = Net -ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} -Provider = %CompanyName% -DriverVer = 02/04/2018, 4.25.0.9658 -CatalogFile.NT = inf_VPN32.cat - -[Manufacturer] -%CompanyName% = SoftEther, NTamd64 - -[SourceDisksNames] -1=%DiskDescription%, "", , - -[SourceDisksFiles] -Neo_VPN32.sys = 1 - -[DestinationDirs] -DefaultDestDir = 12 -Neo.CopyFiles.Sys = 12 - -[Neo.CopyFiles.Sys] -Neo_VPN32.sys, , , 2 - -[SoftEther.NTamd64] -%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN32 - -[NeoAdapter.Install] -Characteristics = 0x1 -AddReg = Neo.Reg, NeoAdapter.Ndi -CopyFiles = Neo.CopyFiles.Sys -*IfType = 53 -*MediaType = 0 -*PhysicalMediaType = 0 - -[NeoAdapter.Install.Services] -AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% - -[NeoAdapter.Ndi] -HKR, , NetworkAddress, 0, %DefaultAddress% -HKR, Ndi, DeviceID, , "NeoAdapter_VPN32" -HKR, , DevLoader, , ndis -HKR, , DeviceVxDs, , Neo_VPN32.sys -HKR, NDIS, LogDriverName, , "Neo_VPN32" -HKR, NDIS, MajorNdisVersion, 1, 5 -HKR, NDIS, MinorNdisVersion, 1, 0 -HKR, Ndi\Interfaces, DefUpper, , "ndis5" -HKR, Ndi\Interfaces, UpperRange, , "ndis5" -HKR, Ndi\Interfaces, LowerRange, , "ethernet" -HKR, Ndi\Interfaces, DefLower, , "ethernet" -HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" -HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% -HKR, Ndi\Params\NetworkAddress, type, 0, "edit" -HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" -HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" -HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% -HKR, Ndi\Params\NetworkAddress, optional, 0, "0" -HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% -HKR, Ndi\Params\MaxSpeed, type, 0, "int" -HKR, Ndi\Params\MaxSpeed, default, 0, "100" -HKR, Ndi\Params\MaxSpeed, min, 0, "0" -HKR, Ndi\Params\MaxSpeed, max, 0, "2000" -HKR, Ndi\Params\MaxSpeed, step, 0, "1" -HKR, Ndi\Params\MaxSpeed, Base, 0, "10" -HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% -HKR, Ndi\Params\KeepLink, type, 0, "enum" -HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% -HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% -HKR, Ndi\Params\KeepLink, default, 0, "0" - - -[Neo.Service] -DisplayName = %Neo.Service.DispName% -Description = %Neo.Service.Desc% -ServiceType = 1 -StartType = 3 -ErrorControl = 1 -ServiceBinary = %12%\Neo_VPN32.sys -LoadOrderGroup = NDIS - -[Neo.Reg] -HKR, Ndi, Service, 0, Neo.Service.Name -HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" -HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" - -[Neo.EventLog] -HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN32.sys" -HKR, , TypesSupported, 0x00010001, 7 - -[Strings] -CompanyName = "SoftEther Corporation" -DiskDescription = "VPN Client Device Driver Install Disk" -Neo.Service.Name = "Neo_VPN32" -Neo.Service.DispName = "VPN Client Device Driver - VPN32" -Neo.Service.Desc = "VPN Client Adapter - VPN32" -NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN32" -Neo.EventLog.Name = "Neo" -NetworkAddress = "MAC Address" -DefaultAddress = "000001000001" -MaxSpeed = "Indicate Speed (Mbps)" -KeepLink = "Keep Link" -On = "On" -Off = "Off" - - -; Auto Generated 20180205_163610.756 - +; VPN Client Device Driver for Windows 2000 and Greater +; +; Copyright (c) SoftEther Corporation. All Rights Reserved. +; http://www.softether.co.jp/ +; +; BUILD 9658 + +[Version] +Signature = "$Windows NT$" +Class = Net +ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} +Provider = %CompanyName% +DriverVer = 02/04/2018, 4.25.0.9658 +CatalogFile.NT = inf_VPN32.cat + +[Manufacturer] +%CompanyName% = SoftEther, NTamd64 + +[SourceDisksNames] +1=%DiskDescription%, "", , + +[SourceDisksFiles] +Neo_VPN32.sys = 1 + +[DestinationDirs] +DefaultDestDir = 12 +Neo.CopyFiles.Sys = 12 + +[Neo.CopyFiles.Sys] +Neo_VPN32.sys, , , 2 + +[SoftEther.NTamd64] +%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN32 + +[NeoAdapter.Install] +Characteristics = 0x1 +AddReg = Neo.Reg, NeoAdapter.Ndi +CopyFiles = Neo.CopyFiles.Sys +*IfType = 53 +*MediaType = 0 +*PhysicalMediaType = 0 + +[NeoAdapter.Install.Services] +AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% + +[NeoAdapter.Ndi] +HKR, , NetworkAddress, 0, %DefaultAddress% +HKR, Ndi, DeviceID, , "NeoAdapter_VPN32" +HKR, , DevLoader, , ndis +HKR, , DeviceVxDs, , Neo_VPN32.sys +HKR, NDIS, LogDriverName, , "Neo_VPN32" +HKR, NDIS, MajorNdisVersion, 1, 5 +HKR, NDIS, MinorNdisVersion, 1, 0 +HKR, Ndi\Interfaces, DefUpper, , "ndis5" +HKR, Ndi\Interfaces, UpperRange, , "ndis5" +HKR, Ndi\Interfaces, LowerRange, , "ethernet" +HKR, Ndi\Interfaces, DefLower, , "ethernet" +HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" +HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% +HKR, Ndi\Params\NetworkAddress, type, 0, "edit" +HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" +HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" +HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% +HKR, Ndi\Params\NetworkAddress, optional, 0, "0" +HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% +HKR, Ndi\Params\MaxSpeed, type, 0, "int" +HKR, Ndi\Params\MaxSpeed, default, 0, "100" +HKR, Ndi\Params\MaxSpeed, min, 0, "0" +HKR, Ndi\Params\MaxSpeed, max, 0, "2000" +HKR, Ndi\Params\MaxSpeed, step, 0, "1" +HKR, Ndi\Params\MaxSpeed, Base, 0, "10" +HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% +HKR, Ndi\Params\KeepLink, type, 0, "enum" +HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% +HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% +HKR, Ndi\Params\KeepLink, default, 0, "0" + + +[Neo.Service] +DisplayName = %Neo.Service.DispName% +Description = %Neo.Service.Desc% +ServiceType = 1 +StartType = 3 +ErrorControl = 1 +ServiceBinary = %12%\Neo_VPN32.sys +LoadOrderGroup = NDIS + +[Neo.Reg] +HKR, Ndi, Service, 0, Neo.Service.Name +HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" +HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" + +[Neo.EventLog] +HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN32.sys" +HKR, , TypesSupported, 0x00010001, 7 + +[Strings] +CompanyName = "SoftEther Corporation" +DiskDescription = "VPN Client Device Driver Install Disk" +Neo.Service.Name = "Neo_VPN32" +Neo.Service.DispName = "VPN Client Device Driver - VPN32" +Neo.Service.Desc = "VPN Client Adapter - VPN32" +NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN32" +Neo.EventLog.Name = "Neo" +NetworkAddress = "MAC Address" +DefaultAddress = "000001000001" +MaxSpeed = "Indicate Speed (Mbps)" +KeepLink = "Keep Link" +On = "On" +Off = "Off" + + +; Auto Generated 20180205_163610.756 + diff --git a/src/bin/hamcore/DriverPackages/Neo6_Win8/x64/Neo6_x64_VPN33.inf b/src/bin/hamcore/DriverPackages/Neo6_Win8/x64/Neo6_x64_VPN33.inf index 0ad8bd1a..d681f7f5 100644 --- a/src/bin/hamcore/DriverPackages/Neo6_Win8/x64/Neo6_x64_VPN33.inf +++ b/src/bin/hamcore/DriverPackages/Neo6_Win8/x64/Neo6_x64_VPN33.inf @@ -1,114 +1,114 @@ -; VPN Client Device Driver for Windows 2000 and Greater -; -; Copyright (c) SoftEther Corporation. All Rights Reserved. -; http://www.softether.co.jp/ -; -; BUILD 9658 - -[Version] -Signature = "$Windows NT$" -Class = Net -ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} -Provider = %CompanyName% -DriverVer = 02/04/2018, 4.25.0.9658 -CatalogFile.NT = inf_VPN33.cat - -[Manufacturer] -%CompanyName% = SoftEther, NTamd64 - -[SourceDisksNames] -1=%DiskDescription%, "", , - -[SourceDisksFiles] -Neo_VPN33.sys = 1 - -[DestinationDirs] -DefaultDestDir = 12 -Neo.CopyFiles.Sys = 12 - -[Neo.CopyFiles.Sys] -Neo_VPN33.sys, , , 2 - -[SoftEther.NTamd64] -%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN33 - -[NeoAdapter.Install] -Characteristics = 0x1 -AddReg = Neo.Reg, NeoAdapter.Ndi -CopyFiles = Neo.CopyFiles.Sys -*IfType = 53 -*MediaType = 0 -*PhysicalMediaType = 0 - -[NeoAdapter.Install.Services] -AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% - -[NeoAdapter.Ndi] -HKR, , NetworkAddress, 0, %DefaultAddress% -HKR, Ndi, DeviceID, , "NeoAdapter_VPN33" -HKR, , DevLoader, , ndis -HKR, , DeviceVxDs, , Neo_VPN33.sys -HKR, NDIS, LogDriverName, , "Neo_VPN33" -HKR, NDIS, MajorNdisVersion, 1, 5 -HKR, NDIS, MinorNdisVersion, 1, 0 -HKR, Ndi\Interfaces, DefUpper, , "ndis5" -HKR, Ndi\Interfaces, UpperRange, , "ndis5" -HKR, Ndi\Interfaces, LowerRange, , "ethernet" -HKR, Ndi\Interfaces, DefLower, , "ethernet" -HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" -HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% -HKR, Ndi\Params\NetworkAddress, type, 0, "edit" -HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" -HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" -HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% -HKR, Ndi\Params\NetworkAddress, optional, 0, "0" -HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% -HKR, Ndi\Params\MaxSpeed, type, 0, "int" -HKR, Ndi\Params\MaxSpeed, default, 0, "100" -HKR, Ndi\Params\MaxSpeed, min, 0, "0" -HKR, Ndi\Params\MaxSpeed, max, 0, "2000" -HKR, Ndi\Params\MaxSpeed, step, 0, "1" -HKR, Ndi\Params\MaxSpeed, Base, 0, "10" -HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% -HKR, Ndi\Params\KeepLink, type, 0, "enum" -HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% -HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% -HKR, Ndi\Params\KeepLink, default, 0, "0" - - -[Neo.Service] -DisplayName = %Neo.Service.DispName% -Description = %Neo.Service.Desc% -ServiceType = 1 -StartType = 3 -ErrorControl = 1 -ServiceBinary = %12%\Neo_VPN33.sys -LoadOrderGroup = NDIS - -[Neo.Reg] -HKR, Ndi, Service, 0, Neo.Service.Name -HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" -HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" - -[Neo.EventLog] -HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN33.sys" -HKR, , TypesSupported, 0x00010001, 7 - -[Strings] -CompanyName = "SoftEther Corporation" -DiskDescription = "VPN Client Device Driver Install Disk" -Neo.Service.Name = "Neo_VPN33" -Neo.Service.DispName = "VPN Client Device Driver - VPN33" -Neo.Service.Desc = "VPN Client Adapter - VPN33" -NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN33" -Neo.EventLog.Name = "Neo" -NetworkAddress = "MAC Address" -DefaultAddress = "000001000001" -MaxSpeed = "Indicate Speed (Mbps)" -KeepLink = "Keep Link" -On = "On" -Off = "Off" - - -; Auto Generated 20180205_163610.757 - +; VPN Client Device Driver for Windows 2000 and Greater +; +; Copyright (c) SoftEther Corporation. All Rights Reserved. +; http://www.softether.co.jp/ +; +; BUILD 9658 + +[Version] +Signature = "$Windows NT$" +Class = Net +ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} +Provider = %CompanyName% +DriverVer = 02/04/2018, 4.25.0.9658 +CatalogFile.NT = inf_VPN33.cat + +[Manufacturer] +%CompanyName% = SoftEther, NTamd64 + +[SourceDisksNames] +1=%DiskDescription%, "", , + +[SourceDisksFiles] +Neo_VPN33.sys = 1 + +[DestinationDirs] +DefaultDestDir = 12 +Neo.CopyFiles.Sys = 12 + +[Neo.CopyFiles.Sys] +Neo_VPN33.sys, , , 2 + +[SoftEther.NTamd64] +%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN33 + +[NeoAdapter.Install] +Characteristics = 0x1 +AddReg = Neo.Reg, NeoAdapter.Ndi +CopyFiles = Neo.CopyFiles.Sys +*IfType = 53 +*MediaType = 0 +*PhysicalMediaType = 0 + +[NeoAdapter.Install.Services] +AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% + +[NeoAdapter.Ndi] +HKR, , NetworkAddress, 0, %DefaultAddress% +HKR, Ndi, DeviceID, , "NeoAdapter_VPN33" +HKR, , DevLoader, , ndis +HKR, , DeviceVxDs, , Neo_VPN33.sys +HKR, NDIS, LogDriverName, , "Neo_VPN33" +HKR, NDIS, MajorNdisVersion, 1, 5 +HKR, NDIS, MinorNdisVersion, 1, 0 +HKR, Ndi\Interfaces, DefUpper, , "ndis5" +HKR, Ndi\Interfaces, UpperRange, , "ndis5" +HKR, Ndi\Interfaces, LowerRange, , "ethernet" +HKR, Ndi\Interfaces, DefLower, , "ethernet" +HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" +HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% +HKR, Ndi\Params\NetworkAddress, type, 0, "edit" +HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" +HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" +HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% +HKR, Ndi\Params\NetworkAddress, optional, 0, "0" +HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% +HKR, Ndi\Params\MaxSpeed, type, 0, "int" +HKR, Ndi\Params\MaxSpeed, default, 0, "100" +HKR, Ndi\Params\MaxSpeed, min, 0, "0" +HKR, Ndi\Params\MaxSpeed, max, 0, "2000" +HKR, Ndi\Params\MaxSpeed, step, 0, "1" +HKR, Ndi\Params\MaxSpeed, Base, 0, "10" +HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% +HKR, Ndi\Params\KeepLink, type, 0, "enum" +HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% +HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% +HKR, Ndi\Params\KeepLink, default, 0, "0" + + +[Neo.Service] +DisplayName = %Neo.Service.DispName% +Description = %Neo.Service.Desc% +ServiceType = 1 +StartType = 3 +ErrorControl = 1 +ServiceBinary = %12%\Neo_VPN33.sys +LoadOrderGroup = NDIS + +[Neo.Reg] +HKR, Ndi, Service, 0, Neo.Service.Name +HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" +HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" + +[Neo.EventLog] +HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN33.sys" +HKR, , TypesSupported, 0x00010001, 7 + +[Strings] +CompanyName = "SoftEther Corporation" +DiskDescription = "VPN Client Device Driver Install Disk" +Neo.Service.Name = "Neo_VPN33" +Neo.Service.DispName = "VPN Client Device Driver - VPN33" +Neo.Service.Desc = "VPN Client Adapter - VPN33" +NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN33" +Neo.EventLog.Name = "Neo" +NetworkAddress = "MAC Address" +DefaultAddress = "000001000001" +MaxSpeed = "Indicate Speed (Mbps)" +KeepLink = "Keep Link" +On = "On" +Off = "Off" + + +; Auto Generated 20180205_163610.757 + diff --git a/src/bin/hamcore/DriverPackages/Neo6_Win8/x64/Neo6_x64_VPN34.inf b/src/bin/hamcore/DriverPackages/Neo6_Win8/x64/Neo6_x64_VPN34.inf index e5aec46d..4552992f 100644 --- a/src/bin/hamcore/DriverPackages/Neo6_Win8/x64/Neo6_x64_VPN34.inf +++ b/src/bin/hamcore/DriverPackages/Neo6_Win8/x64/Neo6_x64_VPN34.inf @@ -1,114 +1,114 @@ -; VPN Client Device Driver for Windows 2000 and Greater -; -; Copyright (c) SoftEther Corporation. All Rights Reserved. -; http://www.softether.co.jp/ -; -; BUILD 9658 - -[Version] -Signature = "$Windows NT$" -Class = Net -ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} -Provider = %CompanyName% -DriverVer = 02/04/2018, 4.25.0.9658 -CatalogFile.NT = inf_VPN34.cat - -[Manufacturer] -%CompanyName% = SoftEther, NTamd64 - -[SourceDisksNames] -1=%DiskDescription%, "", , - -[SourceDisksFiles] -Neo_VPN34.sys = 1 - -[DestinationDirs] -DefaultDestDir = 12 -Neo.CopyFiles.Sys = 12 - -[Neo.CopyFiles.Sys] -Neo_VPN34.sys, , , 2 - -[SoftEther.NTamd64] -%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN34 - -[NeoAdapter.Install] -Characteristics = 0x1 -AddReg = Neo.Reg, NeoAdapter.Ndi -CopyFiles = Neo.CopyFiles.Sys -*IfType = 53 -*MediaType = 0 -*PhysicalMediaType = 0 - -[NeoAdapter.Install.Services] -AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% - -[NeoAdapter.Ndi] -HKR, , NetworkAddress, 0, %DefaultAddress% -HKR, Ndi, DeviceID, , "NeoAdapter_VPN34" -HKR, , DevLoader, , ndis -HKR, , DeviceVxDs, , Neo_VPN34.sys -HKR, NDIS, LogDriverName, , "Neo_VPN34" -HKR, NDIS, MajorNdisVersion, 1, 5 -HKR, NDIS, MinorNdisVersion, 1, 0 -HKR, Ndi\Interfaces, DefUpper, , "ndis5" -HKR, Ndi\Interfaces, UpperRange, , "ndis5" -HKR, Ndi\Interfaces, LowerRange, , "ethernet" -HKR, Ndi\Interfaces, DefLower, , "ethernet" -HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" -HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% -HKR, Ndi\Params\NetworkAddress, type, 0, "edit" -HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" -HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" -HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% -HKR, Ndi\Params\NetworkAddress, optional, 0, "0" -HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% -HKR, Ndi\Params\MaxSpeed, type, 0, "int" -HKR, Ndi\Params\MaxSpeed, default, 0, "100" -HKR, Ndi\Params\MaxSpeed, min, 0, "0" -HKR, Ndi\Params\MaxSpeed, max, 0, "2000" -HKR, Ndi\Params\MaxSpeed, step, 0, "1" -HKR, Ndi\Params\MaxSpeed, Base, 0, "10" -HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% -HKR, Ndi\Params\KeepLink, type, 0, "enum" -HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% -HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% -HKR, Ndi\Params\KeepLink, default, 0, "0" - - -[Neo.Service] -DisplayName = %Neo.Service.DispName% -Description = %Neo.Service.Desc% -ServiceType = 1 -StartType = 3 -ErrorControl = 1 -ServiceBinary = %12%\Neo_VPN34.sys -LoadOrderGroup = NDIS - -[Neo.Reg] -HKR, Ndi, Service, 0, Neo.Service.Name -HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" -HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" - -[Neo.EventLog] -HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN34.sys" -HKR, , TypesSupported, 0x00010001, 7 - -[Strings] -CompanyName = "SoftEther Corporation" -DiskDescription = "VPN Client Device Driver Install Disk" -Neo.Service.Name = "Neo_VPN34" -Neo.Service.DispName = "VPN Client Device Driver - VPN34" -Neo.Service.Desc = "VPN Client Adapter - VPN34" -NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN34" -Neo.EventLog.Name = "Neo" -NetworkAddress = "MAC Address" -DefaultAddress = "000001000001" -MaxSpeed = "Indicate Speed (Mbps)" -KeepLink = "Keep Link" -On = "On" -Off = "Off" - - -; Auto Generated 20180205_163610.758 - +; VPN Client Device Driver for Windows 2000 and Greater +; +; Copyright (c) SoftEther Corporation. All Rights Reserved. +; http://www.softether.co.jp/ +; +; BUILD 9658 + +[Version] +Signature = "$Windows NT$" +Class = Net +ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} +Provider = %CompanyName% +DriverVer = 02/04/2018, 4.25.0.9658 +CatalogFile.NT = inf_VPN34.cat + +[Manufacturer] +%CompanyName% = SoftEther, NTamd64 + +[SourceDisksNames] +1=%DiskDescription%, "", , + +[SourceDisksFiles] +Neo_VPN34.sys = 1 + +[DestinationDirs] +DefaultDestDir = 12 +Neo.CopyFiles.Sys = 12 + +[Neo.CopyFiles.Sys] +Neo_VPN34.sys, , , 2 + +[SoftEther.NTamd64] +%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN34 + +[NeoAdapter.Install] +Characteristics = 0x1 +AddReg = Neo.Reg, NeoAdapter.Ndi +CopyFiles = Neo.CopyFiles.Sys +*IfType = 53 +*MediaType = 0 +*PhysicalMediaType = 0 + +[NeoAdapter.Install.Services] +AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% + +[NeoAdapter.Ndi] +HKR, , NetworkAddress, 0, %DefaultAddress% +HKR, Ndi, DeviceID, , "NeoAdapter_VPN34" +HKR, , DevLoader, , ndis +HKR, , DeviceVxDs, , Neo_VPN34.sys +HKR, NDIS, LogDriverName, , "Neo_VPN34" +HKR, NDIS, MajorNdisVersion, 1, 5 +HKR, NDIS, MinorNdisVersion, 1, 0 +HKR, Ndi\Interfaces, DefUpper, , "ndis5" +HKR, Ndi\Interfaces, UpperRange, , "ndis5" +HKR, Ndi\Interfaces, LowerRange, , "ethernet" +HKR, Ndi\Interfaces, DefLower, , "ethernet" +HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" +HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% +HKR, Ndi\Params\NetworkAddress, type, 0, "edit" +HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" +HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" +HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% +HKR, Ndi\Params\NetworkAddress, optional, 0, "0" +HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% +HKR, Ndi\Params\MaxSpeed, type, 0, "int" +HKR, Ndi\Params\MaxSpeed, default, 0, "100" +HKR, Ndi\Params\MaxSpeed, min, 0, "0" +HKR, Ndi\Params\MaxSpeed, max, 0, "2000" +HKR, Ndi\Params\MaxSpeed, step, 0, "1" +HKR, Ndi\Params\MaxSpeed, Base, 0, "10" +HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% +HKR, Ndi\Params\KeepLink, type, 0, "enum" +HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% +HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% +HKR, Ndi\Params\KeepLink, default, 0, "0" + + +[Neo.Service] +DisplayName = %Neo.Service.DispName% +Description = %Neo.Service.Desc% +ServiceType = 1 +StartType = 3 +ErrorControl = 1 +ServiceBinary = %12%\Neo_VPN34.sys +LoadOrderGroup = NDIS + +[Neo.Reg] +HKR, Ndi, Service, 0, Neo.Service.Name +HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" +HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" + +[Neo.EventLog] +HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN34.sys" +HKR, , TypesSupported, 0x00010001, 7 + +[Strings] +CompanyName = "SoftEther Corporation" +DiskDescription = "VPN Client Device Driver Install Disk" +Neo.Service.Name = "Neo_VPN34" +Neo.Service.DispName = "VPN Client Device Driver - VPN34" +Neo.Service.Desc = "VPN Client Adapter - VPN34" +NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN34" +Neo.EventLog.Name = "Neo" +NetworkAddress = "MAC Address" +DefaultAddress = "000001000001" +MaxSpeed = "Indicate Speed (Mbps)" +KeepLink = "Keep Link" +On = "On" +Off = "Off" + + +; Auto Generated 20180205_163610.758 + diff --git a/src/bin/hamcore/DriverPackages/Neo6_Win8/x64/Neo6_x64_VPN35.inf b/src/bin/hamcore/DriverPackages/Neo6_Win8/x64/Neo6_x64_VPN35.inf index 0281dbc5..31c2c6ce 100644 --- a/src/bin/hamcore/DriverPackages/Neo6_Win8/x64/Neo6_x64_VPN35.inf +++ b/src/bin/hamcore/DriverPackages/Neo6_Win8/x64/Neo6_x64_VPN35.inf @@ -1,114 +1,114 @@ -; VPN Client Device Driver for Windows 2000 and Greater -; -; Copyright (c) SoftEther Corporation. All Rights Reserved. -; http://www.softether.co.jp/ -; -; BUILD 9658 - -[Version] -Signature = "$Windows NT$" -Class = Net -ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} -Provider = %CompanyName% -DriverVer = 02/04/2018, 4.25.0.9658 -CatalogFile.NT = inf_VPN35.cat - -[Manufacturer] -%CompanyName% = SoftEther, NTamd64 - -[SourceDisksNames] -1=%DiskDescription%, "", , - -[SourceDisksFiles] -Neo_VPN35.sys = 1 - -[DestinationDirs] -DefaultDestDir = 12 -Neo.CopyFiles.Sys = 12 - -[Neo.CopyFiles.Sys] -Neo_VPN35.sys, , , 2 - -[SoftEther.NTamd64] -%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN35 - -[NeoAdapter.Install] -Characteristics = 0x1 -AddReg = Neo.Reg, NeoAdapter.Ndi -CopyFiles = Neo.CopyFiles.Sys -*IfType = 53 -*MediaType = 0 -*PhysicalMediaType = 0 - -[NeoAdapter.Install.Services] -AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% - -[NeoAdapter.Ndi] -HKR, , NetworkAddress, 0, %DefaultAddress% -HKR, Ndi, DeviceID, , "NeoAdapter_VPN35" -HKR, , DevLoader, , ndis -HKR, , DeviceVxDs, , Neo_VPN35.sys -HKR, NDIS, LogDriverName, , "Neo_VPN35" -HKR, NDIS, MajorNdisVersion, 1, 5 -HKR, NDIS, MinorNdisVersion, 1, 0 -HKR, Ndi\Interfaces, DefUpper, , "ndis5" -HKR, Ndi\Interfaces, UpperRange, , "ndis5" -HKR, Ndi\Interfaces, LowerRange, , "ethernet" -HKR, Ndi\Interfaces, DefLower, , "ethernet" -HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" -HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% -HKR, Ndi\Params\NetworkAddress, type, 0, "edit" -HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" -HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" -HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% -HKR, Ndi\Params\NetworkAddress, optional, 0, "0" -HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% -HKR, Ndi\Params\MaxSpeed, type, 0, "int" -HKR, Ndi\Params\MaxSpeed, default, 0, "100" -HKR, Ndi\Params\MaxSpeed, min, 0, "0" -HKR, Ndi\Params\MaxSpeed, max, 0, "2000" -HKR, Ndi\Params\MaxSpeed, step, 0, "1" -HKR, Ndi\Params\MaxSpeed, Base, 0, "10" -HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% -HKR, Ndi\Params\KeepLink, type, 0, "enum" -HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% -HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% -HKR, Ndi\Params\KeepLink, default, 0, "0" - - -[Neo.Service] -DisplayName = %Neo.Service.DispName% -Description = %Neo.Service.Desc% -ServiceType = 1 -StartType = 3 -ErrorControl = 1 -ServiceBinary = %12%\Neo_VPN35.sys -LoadOrderGroup = NDIS - -[Neo.Reg] -HKR, Ndi, Service, 0, Neo.Service.Name -HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" -HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" - -[Neo.EventLog] -HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN35.sys" -HKR, , TypesSupported, 0x00010001, 7 - -[Strings] -CompanyName = "SoftEther Corporation" -DiskDescription = "VPN Client Device Driver Install Disk" -Neo.Service.Name = "Neo_VPN35" -Neo.Service.DispName = "VPN Client Device Driver - VPN35" -Neo.Service.Desc = "VPN Client Adapter - VPN35" -NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN35" -Neo.EventLog.Name = "Neo" -NetworkAddress = "MAC Address" -DefaultAddress = "000001000001" -MaxSpeed = "Indicate Speed (Mbps)" -KeepLink = "Keep Link" -On = "On" -Off = "Off" - - -; Auto Generated 20180205_163610.758 - +; VPN Client Device Driver for Windows 2000 and Greater +; +; Copyright (c) SoftEther Corporation. All Rights Reserved. +; http://www.softether.co.jp/ +; +; BUILD 9658 + +[Version] +Signature = "$Windows NT$" +Class = Net +ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} +Provider = %CompanyName% +DriverVer = 02/04/2018, 4.25.0.9658 +CatalogFile.NT = inf_VPN35.cat + +[Manufacturer] +%CompanyName% = SoftEther, NTamd64 + +[SourceDisksNames] +1=%DiskDescription%, "", , + +[SourceDisksFiles] +Neo_VPN35.sys = 1 + +[DestinationDirs] +DefaultDestDir = 12 +Neo.CopyFiles.Sys = 12 + +[Neo.CopyFiles.Sys] +Neo_VPN35.sys, , , 2 + +[SoftEther.NTamd64] +%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN35 + +[NeoAdapter.Install] +Characteristics = 0x1 +AddReg = Neo.Reg, NeoAdapter.Ndi +CopyFiles = Neo.CopyFiles.Sys +*IfType = 53 +*MediaType = 0 +*PhysicalMediaType = 0 + +[NeoAdapter.Install.Services] +AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% + +[NeoAdapter.Ndi] +HKR, , NetworkAddress, 0, %DefaultAddress% +HKR, Ndi, DeviceID, , "NeoAdapter_VPN35" +HKR, , DevLoader, , ndis +HKR, , DeviceVxDs, , Neo_VPN35.sys +HKR, NDIS, LogDriverName, , "Neo_VPN35" +HKR, NDIS, MajorNdisVersion, 1, 5 +HKR, NDIS, MinorNdisVersion, 1, 0 +HKR, Ndi\Interfaces, DefUpper, , "ndis5" +HKR, Ndi\Interfaces, UpperRange, , "ndis5" +HKR, Ndi\Interfaces, LowerRange, , "ethernet" +HKR, Ndi\Interfaces, DefLower, , "ethernet" +HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" +HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% +HKR, Ndi\Params\NetworkAddress, type, 0, "edit" +HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" +HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" +HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% +HKR, Ndi\Params\NetworkAddress, optional, 0, "0" +HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% +HKR, Ndi\Params\MaxSpeed, type, 0, "int" +HKR, Ndi\Params\MaxSpeed, default, 0, "100" +HKR, Ndi\Params\MaxSpeed, min, 0, "0" +HKR, Ndi\Params\MaxSpeed, max, 0, "2000" +HKR, Ndi\Params\MaxSpeed, step, 0, "1" +HKR, Ndi\Params\MaxSpeed, Base, 0, "10" +HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% +HKR, Ndi\Params\KeepLink, type, 0, "enum" +HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% +HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% +HKR, Ndi\Params\KeepLink, default, 0, "0" + + +[Neo.Service] +DisplayName = %Neo.Service.DispName% +Description = %Neo.Service.Desc% +ServiceType = 1 +StartType = 3 +ErrorControl = 1 +ServiceBinary = %12%\Neo_VPN35.sys +LoadOrderGroup = NDIS + +[Neo.Reg] +HKR, Ndi, Service, 0, Neo.Service.Name +HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" +HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" + +[Neo.EventLog] +HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN35.sys" +HKR, , TypesSupported, 0x00010001, 7 + +[Strings] +CompanyName = "SoftEther Corporation" +DiskDescription = "VPN Client Device Driver Install Disk" +Neo.Service.Name = "Neo_VPN35" +Neo.Service.DispName = "VPN Client Device Driver - VPN35" +Neo.Service.Desc = "VPN Client Adapter - VPN35" +NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN35" +Neo.EventLog.Name = "Neo" +NetworkAddress = "MAC Address" +DefaultAddress = "000001000001" +MaxSpeed = "Indicate Speed (Mbps)" +KeepLink = "Keep Link" +On = "On" +Off = "Off" + + +; Auto Generated 20180205_163610.758 + diff --git a/src/bin/hamcore/DriverPackages/Neo6_Win8/x64/Neo6_x64_VPN36.inf b/src/bin/hamcore/DriverPackages/Neo6_Win8/x64/Neo6_x64_VPN36.inf index 9734fd2f..b0a3a9e9 100644 --- a/src/bin/hamcore/DriverPackages/Neo6_Win8/x64/Neo6_x64_VPN36.inf +++ b/src/bin/hamcore/DriverPackages/Neo6_Win8/x64/Neo6_x64_VPN36.inf @@ -1,114 +1,114 @@ -; VPN Client Device Driver for Windows 2000 and Greater -; -; Copyright (c) SoftEther Corporation. All Rights Reserved. -; http://www.softether.co.jp/ -; -; BUILD 9658 - -[Version] -Signature = "$Windows NT$" -Class = Net -ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} -Provider = %CompanyName% -DriverVer = 02/04/2018, 4.25.0.9658 -CatalogFile.NT = inf_VPN36.cat - -[Manufacturer] -%CompanyName% = SoftEther, NTamd64 - -[SourceDisksNames] -1=%DiskDescription%, "", , - -[SourceDisksFiles] -Neo_VPN36.sys = 1 - -[DestinationDirs] -DefaultDestDir = 12 -Neo.CopyFiles.Sys = 12 - -[Neo.CopyFiles.Sys] -Neo_VPN36.sys, , , 2 - -[SoftEther.NTamd64] -%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN36 - -[NeoAdapter.Install] -Characteristics = 0x1 -AddReg = Neo.Reg, NeoAdapter.Ndi -CopyFiles = Neo.CopyFiles.Sys -*IfType = 53 -*MediaType = 0 -*PhysicalMediaType = 0 - -[NeoAdapter.Install.Services] -AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% - -[NeoAdapter.Ndi] -HKR, , NetworkAddress, 0, %DefaultAddress% -HKR, Ndi, DeviceID, , "NeoAdapter_VPN36" -HKR, , DevLoader, , ndis -HKR, , DeviceVxDs, , Neo_VPN36.sys -HKR, NDIS, LogDriverName, , "Neo_VPN36" -HKR, NDIS, MajorNdisVersion, 1, 5 -HKR, NDIS, MinorNdisVersion, 1, 0 -HKR, Ndi\Interfaces, DefUpper, , "ndis5" -HKR, Ndi\Interfaces, UpperRange, , "ndis5" -HKR, Ndi\Interfaces, LowerRange, , "ethernet" -HKR, Ndi\Interfaces, DefLower, , "ethernet" -HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" -HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% -HKR, Ndi\Params\NetworkAddress, type, 0, "edit" -HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" -HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" -HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% -HKR, Ndi\Params\NetworkAddress, optional, 0, "0" -HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% -HKR, Ndi\Params\MaxSpeed, type, 0, "int" -HKR, Ndi\Params\MaxSpeed, default, 0, "100" -HKR, Ndi\Params\MaxSpeed, min, 0, "0" -HKR, Ndi\Params\MaxSpeed, max, 0, "2000" -HKR, Ndi\Params\MaxSpeed, step, 0, "1" -HKR, Ndi\Params\MaxSpeed, Base, 0, "10" -HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% -HKR, Ndi\Params\KeepLink, type, 0, "enum" -HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% -HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% -HKR, Ndi\Params\KeepLink, default, 0, "0" - - -[Neo.Service] -DisplayName = %Neo.Service.DispName% -Description = %Neo.Service.Desc% -ServiceType = 1 -StartType = 3 -ErrorControl = 1 -ServiceBinary = %12%\Neo_VPN36.sys -LoadOrderGroup = NDIS - -[Neo.Reg] -HKR, Ndi, Service, 0, Neo.Service.Name -HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" -HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" - -[Neo.EventLog] -HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN36.sys" -HKR, , TypesSupported, 0x00010001, 7 - -[Strings] -CompanyName = "SoftEther Corporation" -DiskDescription = "VPN Client Device Driver Install Disk" -Neo.Service.Name = "Neo_VPN36" -Neo.Service.DispName = "VPN Client Device Driver - VPN36" -Neo.Service.Desc = "VPN Client Adapter - VPN36" -NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN36" -Neo.EventLog.Name = "Neo" -NetworkAddress = "MAC Address" -DefaultAddress = "000001000001" -MaxSpeed = "Indicate Speed (Mbps)" -KeepLink = "Keep Link" -On = "On" -Off = "Off" - - -; Auto Generated 20180205_163610.759 - +; VPN Client Device Driver for Windows 2000 and Greater +; +; Copyright (c) SoftEther Corporation. All Rights Reserved. +; http://www.softether.co.jp/ +; +; BUILD 9658 + +[Version] +Signature = "$Windows NT$" +Class = Net +ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} +Provider = %CompanyName% +DriverVer = 02/04/2018, 4.25.0.9658 +CatalogFile.NT = inf_VPN36.cat + +[Manufacturer] +%CompanyName% = SoftEther, NTamd64 + +[SourceDisksNames] +1=%DiskDescription%, "", , + +[SourceDisksFiles] +Neo_VPN36.sys = 1 + +[DestinationDirs] +DefaultDestDir = 12 +Neo.CopyFiles.Sys = 12 + +[Neo.CopyFiles.Sys] +Neo_VPN36.sys, , , 2 + +[SoftEther.NTamd64] +%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN36 + +[NeoAdapter.Install] +Characteristics = 0x1 +AddReg = Neo.Reg, NeoAdapter.Ndi +CopyFiles = Neo.CopyFiles.Sys +*IfType = 53 +*MediaType = 0 +*PhysicalMediaType = 0 + +[NeoAdapter.Install.Services] +AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% + +[NeoAdapter.Ndi] +HKR, , NetworkAddress, 0, %DefaultAddress% +HKR, Ndi, DeviceID, , "NeoAdapter_VPN36" +HKR, , DevLoader, , ndis +HKR, , DeviceVxDs, , Neo_VPN36.sys +HKR, NDIS, LogDriverName, , "Neo_VPN36" +HKR, NDIS, MajorNdisVersion, 1, 5 +HKR, NDIS, MinorNdisVersion, 1, 0 +HKR, Ndi\Interfaces, DefUpper, , "ndis5" +HKR, Ndi\Interfaces, UpperRange, , "ndis5" +HKR, Ndi\Interfaces, LowerRange, , "ethernet" +HKR, Ndi\Interfaces, DefLower, , "ethernet" +HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" +HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% +HKR, Ndi\Params\NetworkAddress, type, 0, "edit" +HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" +HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" +HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% +HKR, Ndi\Params\NetworkAddress, optional, 0, "0" +HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% +HKR, Ndi\Params\MaxSpeed, type, 0, "int" +HKR, Ndi\Params\MaxSpeed, default, 0, "100" +HKR, Ndi\Params\MaxSpeed, min, 0, "0" +HKR, Ndi\Params\MaxSpeed, max, 0, "2000" +HKR, Ndi\Params\MaxSpeed, step, 0, "1" +HKR, Ndi\Params\MaxSpeed, Base, 0, "10" +HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% +HKR, Ndi\Params\KeepLink, type, 0, "enum" +HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% +HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% +HKR, Ndi\Params\KeepLink, default, 0, "0" + + +[Neo.Service] +DisplayName = %Neo.Service.DispName% +Description = %Neo.Service.Desc% +ServiceType = 1 +StartType = 3 +ErrorControl = 1 +ServiceBinary = %12%\Neo_VPN36.sys +LoadOrderGroup = NDIS + +[Neo.Reg] +HKR, Ndi, Service, 0, Neo.Service.Name +HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" +HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" + +[Neo.EventLog] +HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN36.sys" +HKR, , TypesSupported, 0x00010001, 7 + +[Strings] +CompanyName = "SoftEther Corporation" +DiskDescription = "VPN Client Device Driver Install Disk" +Neo.Service.Name = "Neo_VPN36" +Neo.Service.DispName = "VPN Client Device Driver - VPN36" +Neo.Service.Desc = "VPN Client Adapter - VPN36" +NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN36" +Neo.EventLog.Name = "Neo" +NetworkAddress = "MAC Address" +DefaultAddress = "000001000001" +MaxSpeed = "Indicate Speed (Mbps)" +KeepLink = "Keep Link" +On = "On" +Off = "Off" + + +; Auto Generated 20180205_163610.759 + diff --git a/src/bin/hamcore/DriverPackages/Neo6_Win8/x64/Neo6_x64_VPN37.inf b/src/bin/hamcore/DriverPackages/Neo6_Win8/x64/Neo6_x64_VPN37.inf index c5a36bb2..4303b0e8 100644 --- a/src/bin/hamcore/DriverPackages/Neo6_Win8/x64/Neo6_x64_VPN37.inf +++ b/src/bin/hamcore/DriverPackages/Neo6_Win8/x64/Neo6_x64_VPN37.inf @@ -1,114 +1,114 @@ -; VPN Client Device Driver for Windows 2000 and Greater -; -; Copyright (c) SoftEther Corporation. All Rights Reserved. -; http://www.softether.co.jp/ -; -; BUILD 9658 - -[Version] -Signature = "$Windows NT$" -Class = Net -ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} -Provider = %CompanyName% -DriverVer = 02/04/2018, 4.25.0.9658 -CatalogFile.NT = inf_VPN37.cat - -[Manufacturer] -%CompanyName% = SoftEther, NTamd64 - -[SourceDisksNames] -1=%DiskDescription%, "", , - -[SourceDisksFiles] -Neo_VPN37.sys = 1 - -[DestinationDirs] -DefaultDestDir = 12 -Neo.CopyFiles.Sys = 12 - -[Neo.CopyFiles.Sys] -Neo_VPN37.sys, , , 2 - -[SoftEther.NTamd64] -%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN37 - -[NeoAdapter.Install] -Characteristics = 0x1 -AddReg = Neo.Reg, NeoAdapter.Ndi -CopyFiles = Neo.CopyFiles.Sys -*IfType = 53 -*MediaType = 0 -*PhysicalMediaType = 0 - -[NeoAdapter.Install.Services] -AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% - -[NeoAdapter.Ndi] -HKR, , NetworkAddress, 0, %DefaultAddress% -HKR, Ndi, DeviceID, , "NeoAdapter_VPN37" -HKR, , DevLoader, , ndis -HKR, , DeviceVxDs, , Neo_VPN37.sys -HKR, NDIS, LogDriverName, , "Neo_VPN37" -HKR, NDIS, MajorNdisVersion, 1, 5 -HKR, NDIS, MinorNdisVersion, 1, 0 -HKR, Ndi\Interfaces, DefUpper, , "ndis5" -HKR, Ndi\Interfaces, UpperRange, , "ndis5" -HKR, Ndi\Interfaces, LowerRange, , "ethernet" -HKR, Ndi\Interfaces, DefLower, , "ethernet" -HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" -HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% -HKR, Ndi\Params\NetworkAddress, type, 0, "edit" -HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" -HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" -HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% -HKR, Ndi\Params\NetworkAddress, optional, 0, "0" -HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% -HKR, Ndi\Params\MaxSpeed, type, 0, "int" -HKR, Ndi\Params\MaxSpeed, default, 0, "100" -HKR, Ndi\Params\MaxSpeed, min, 0, "0" -HKR, Ndi\Params\MaxSpeed, max, 0, "2000" -HKR, Ndi\Params\MaxSpeed, step, 0, "1" -HKR, Ndi\Params\MaxSpeed, Base, 0, "10" -HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% -HKR, Ndi\Params\KeepLink, type, 0, "enum" -HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% -HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% -HKR, Ndi\Params\KeepLink, default, 0, "0" - - -[Neo.Service] -DisplayName = %Neo.Service.DispName% -Description = %Neo.Service.Desc% -ServiceType = 1 -StartType = 3 -ErrorControl = 1 -ServiceBinary = %12%\Neo_VPN37.sys -LoadOrderGroup = NDIS - -[Neo.Reg] -HKR, Ndi, Service, 0, Neo.Service.Name -HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" -HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" - -[Neo.EventLog] -HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN37.sys" -HKR, , TypesSupported, 0x00010001, 7 - -[Strings] -CompanyName = "SoftEther Corporation" -DiskDescription = "VPN Client Device Driver Install Disk" -Neo.Service.Name = "Neo_VPN37" -Neo.Service.DispName = "VPN Client Device Driver - VPN37" -Neo.Service.Desc = "VPN Client Adapter - VPN37" -NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN37" -Neo.EventLog.Name = "Neo" -NetworkAddress = "MAC Address" -DefaultAddress = "000001000001" -MaxSpeed = "Indicate Speed (Mbps)" -KeepLink = "Keep Link" -On = "On" -Off = "Off" - - -; Auto Generated 20180205_163610.760 - +; VPN Client Device Driver for Windows 2000 and Greater +; +; Copyright (c) SoftEther Corporation. All Rights Reserved. +; http://www.softether.co.jp/ +; +; BUILD 9658 + +[Version] +Signature = "$Windows NT$" +Class = Net +ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} +Provider = %CompanyName% +DriverVer = 02/04/2018, 4.25.0.9658 +CatalogFile.NT = inf_VPN37.cat + +[Manufacturer] +%CompanyName% = SoftEther, NTamd64 + +[SourceDisksNames] +1=%DiskDescription%, "", , + +[SourceDisksFiles] +Neo_VPN37.sys = 1 + +[DestinationDirs] +DefaultDestDir = 12 +Neo.CopyFiles.Sys = 12 + +[Neo.CopyFiles.Sys] +Neo_VPN37.sys, , , 2 + +[SoftEther.NTamd64] +%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN37 + +[NeoAdapter.Install] +Characteristics = 0x1 +AddReg = Neo.Reg, NeoAdapter.Ndi +CopyFiles = Neo.CopyFiles.Sys +*IfType = 53 +*MediaType = 0 +*PhysicalMediaType = 0 + +[NeoAdapter.Install.Services] +AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% + +[NeoAdapter.Ndi] +HKR, , NetworkAddress, 0, %DefaultAddress% +HKR, Ndi, DeviceID, , "NeoAdapter_VPN37" +HKR, , DevLoader, , ndis +HKR, , DeviceVxDs, , Neo_VPN37.sys +HKR, NDIS, LogDriverName, , "Neo_VPN37" +HKR, NDIS, MajorNdisVersion, 1, 5 +HKR, NDIS, MinorNdisVersion, 1, 0 +HKR, Ndi\Interfaces, DefUpper, , "ndis5" +HKR, Ndi\Interfaces, UpperRange, , "ndis5" +HKR, Ndi\Interfaces, LowerRange, , "ethernet" +HKR, Ndi\Interfaces, DefLower, , "ethernet" +HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" +HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% +HKR, Ndi\Params\NetworkAddress, type, 0, "edit" +HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" +HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" +HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% +HKR, Ndi\Params\NetworkAddress, optional, 0, "0" +HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% +HKR, Ndi\Params\MaxSpeed, type, 0, "int" +HKR, Ndi\Params\MaxSpeed, default, 0, "100" +HKR, Ndi\Params\MaxSpeed, min, 0, "0" +HKR, Ndi\Params\MaxSpeed, max, 0, "2000" +HKR, Ndi\Params\MaxSpeed, step, 0, "1" +HKR, Ndi\Params\MaxSpeed, Base, 0, "10" +HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% +HKR, Ndi\Params\KeepLink, type, 0, "enum" +HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% +HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% +HKR, Ndi\Params\KeepLink, default, 0, "0" + + +[Neo.Service] +DisplayName = %Neo.Service.DispName% +Description = %Neo.Service.Desc% +ServiceType = 1 +StartType = 3 +ErrorControl = 1 +ServiceBinary = %12%\Neo_VPN37.sys +LoadOrderGroup = NDIS + +[Neo.Reg] +HKR, Ndi, Service, 0, Neo.Service.Name +HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" +HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" + +[Neo.EventLog] +HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN37.sys" +HKR, , TypesSupported, 0x00010001, 7 + +[Strings] +CompanyName = "SoftEther Corporation" +DiskDescription = "VPN Client Device Driver Install Disk" +Neo.Service.Name = "Neo_VPN37" +Neo.Service.DispName = "VPN Client Device Driver - VPN37" +Neo.Service.Desc = "VPN Client Adapter - VPN37" +NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN37" +Neo.EventLog.Name = "Neo" +NetworkAddress = "MAC Address" +DefaultAddress = "000001000001" +MaxSpeed = "Indicate Speed (Mbps)" +KeepLink = "Keep Link" +On = "On" +Off = "Off" + + +; Auto Generated 20180205_163610.760 + diff --git a/src/bin/hamcore/DriverPackages/Neo6_Win8/x64/Neo6_x64_VPN38.inf b/src/bin/hamcore/DriverPackages/Neo6_Win8/x64/Neo6_x64_VPN38.inf index 742ac196..e4f262cc 100644 --- a/src/bin/hamcore/DriverPackages/Neo6_Win8/x64/Neo6_x64_VPN38.inf +++ b/src/bin/hamcore/DriverPackages/Neo6_Win8/x64/Neo6_x64_VPN38.inf @@ -1,114 +1,114 @@ -; VPN Client Device Driver for Windows 2000 and Greater -; -; Copyright (c) SoftEther Corporation. All Rights Reserved. -; http://www.softether.co.jp/ -; -; BUILD 9658 - -[Version] -Signature = "$Windows NT$" -Class = Net -ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} -Provider = %CompanyName% -DriverVer = 02/04/2018, 4.25.0.9658 -CatalogFile.NT = inf_VPN38.cat - -[Manufacturer] -%CompanyName% = SoftEther, NTamd64 - -[SourceDisksNames] -1=%DiskDescription%, "", , - -[SourceDisksFiles] -Neo_VPN38.sys = 1 - -[DestinationDirs] -DefaultDestDir = 12 -Neo.CopyFiles.Sys = 12 - -[Neo.CopyFiles.Sys] -Neo_VPN38.sys, , , 2 - -[SoftEther.NTamd64] -%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN38 - -[NeoAdapter.Install] -Characteristics = 0x1 -AddReg = Neo.Reg, NeoAdapter.Ndi -CopyFiles = Neo.CopyFiles.Sys -*IfType = 53 -*MediaType = 0 -*PhysicalMediaType = 0 - -[NeoAdapter.Install.Services] -AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% - -[NeoAdapter.Ndi] -HKR, , NetworkAddress, 0, %DefaultAddress% -HKR, Ndi, DeviceID, , "NeoAdapter_VPN38" -HKR, , DevLoader, , ndis -HKR, , DeviceVxDs, , Neo_VPN38.sys -HKR, NDIS, LogDriverName, , "Neo_VPN38" -HKR, NDIS, MajorNdisVersion, 1, 5 -HKR, NDIS, MinorNdisVersion, 1, 0 -HKR, Ndi\Interfaces, DefUpper, , "ndis5" -HKR, Ndi\Interfaces, UpperRange, , "ndis5" -HKR, Ndi\Interfaces, LowerRange, , "ethernet" -HKR, Ndi\Interfaces, DefLower, , "ethernet" -HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" -HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% -HKR, Ndi\Params\NetworkAddress, type, 0, "edit" -HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" -HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" -HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% -HKR, Ndi\Params\NetworkAddress, optional, 0, "0" -HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% -HKR, Ndi\Params\MaxSpeed, type, 0, "int" -HKR, Ndi\Params\MaxSpeed, default, 0, "100" -HKR, Ndi\Params\MaxSpeed, min, 0, "0" -HKR, Ndi\Params\MaxSpeed, max, 0, "2000" -HKR, Ndi\Params\MaxSpeed, step, 0, "1" -HKR, Ndi\Params\MaxSpeed, Base, 0, "10" -HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% -HKR, Ndi\Params\KeepLink, type, 0, "enum" -HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% -HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% -HKR, Ndi\Params\KeepLink, default, 0, "0" - - -[Neo.Service] -DisplayName = %Neo.Service.DispName% -Description = %Neo.Service.Desc% -ServiceType = 1 -StartType = 3 -ErrorControl = 1 -ServiceBinary = %12%\Neo_VPN38.sys -LoadOrderGroup = NDIS - -[Neo.Reg] -HKR, Ndi, Service, 0, Neo.Service.Name -HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" -HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" - -[Neo.EventLog] -HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN38.sys" -HKR, , TypesSupported, 0x00010001, 7 - -[Strings] -CompanyName = "SoftEther Corporation" -DiskDescription = "VPN Client Device Driver Install Disk" -Neo.Service.Name = "Neo_VPN38" -Neo.Service.DispName = "VPN Client Device Driver - VPN38" -Neo.Service.Desc = "VPN Client Adapter - VPN38" -NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN38" -Neo.EventLog.Name = "Neo" -NetworkAddress = "MAC Address" -DefaultAddress = "000001000001" -MaxSpeed = "Indicate Speed (Mbps)" -KeepLink = "Keep Link" -On = "On" -Off = "Off" - - -; Auto Generated 20180205_163610.760 - +; VPN Client Device Driver for Windows 2000 and Greater +; +; Copyright (c) SoftEther Corporation. All Rights Reserved. +; http://www.softether.co.jp/ +; +; BUILD 9658 + +[Version] +Signature = "$Windows NT$" +Class = Net +ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} +Provider = %CompanyName% +DriverVer = 02/04/2018, 4.25.0.9658 +CatalogFile.NT = inf_VPN38.cat + +[Manufacturer] +%CompanyName% = SoftEther, NTamd64 + +[SourceDisksNames] +1=%DiskDescription%, "", , + +[SourceDisksFiles] +Neo_VPN38.sys = 1 + +[DestinationDirs] +DefaultDestDir = 12 +Neo.CopyFiles.Sys = 12 + +[Neo.CopyFiles.Sys] +Neo_VPN38.sys, , , 2 + +[SoftEther.NTamd64] +%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN38 + +[NeoAdapter.Install] +Characteristics = 0x1 +AddReg = Neo.Reg, NeoAdapter.Ndi +CopyFiles = Neo.CopyFiles.Sys +*IfType = 53 +*MediaType = 0 +*PhysicalMediaType = 0 + +[NeoAdapter.Install.Services] +AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% + +[NeoAdapter.Ndi] +HKR, , NetworkAddress, 0, %DefaultAddress% +HKR, Ndi, DeviceID, , "NeoAdapter_VPN38" +HKR, , DevLoader, , ndis +HKR, , DeviceVxDs, , Neo_VPN38.sys +HKR, NDIS, LogDriverName, , "Neo_VPN38" +HKR, NDIS, MajorNdisVersion, 1, 5 +HKR, NDIS, MinorNdisVersion, 1, 0 +HKR, Ndi\Interfaces, DefUpper, , "ndis5" +HKR, Ndi\Interfaces, UpperRange, , "ndis5" +HKR, Ndi\Interfaces, LowerRange, , "ethernet" +HKR, Ndi\Interfaces, DefLower, , "ethernet" +HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" +HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% +HKR, Ndi\Params\NetworkAddress, type, 0, "edit" +HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" +HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" +HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% +HKR, Ndi\Params\NetworkAddress, optional, 0, "0" +HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% +HKR, Ndi\Params\MaxSpeed, type, 0, "int" +HKR, Ndi\Params\MaxSpeed, default, 0, "100" +HKR, Ndi\Params\MaxSpeed, min, 0, "0" +HKR, Ndi\Params\MaxSpeed, max, 0, "2000" +HKR, Ndi\Params\MaxSpeed, step, 0, "1" +HKR, Ndi\Params\MaxSpeed, Base, 0, "10" +HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% +HKR, Ndi\Params\KeepLink, type, 0, "enum" +HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% +HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% +HKR, Ndi\Params\KeepLink, default, 0, "0" + + +[Neo.Service] +DisplayName = %Neo.Service.DispName% +Description = %Neo.Service.Desc% +ServiceType = 1 +StartType = 3 +ErrorControl = 1 +ServiceBinary = %12%\Neo_VPN38.sys +LoadOrderGroup = NDIS + +[Neo.Reg] +HKR, Ndi, Service, 0, Neo.Service.Name +HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" +HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" + +[Neo.EventLog] +HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN38.sys" +HKR, , TypesSupported, 0x00010001, 7 + +[Strings] +CompanyName = "SoftEther Corporation" +DiskDescription = "VPN Client Device Driver Install Disk" +Neo.Service.Name = "Neo_VPN38" +Neo.Service.DispName = "VPN Client Device Driver - VPN38" +Neo.Service.Desc = "VPN Client Adapter - VPN38" +NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN38" +Neo.EventLog.Name = "Neo" +NetworkAddress = "MAC Address" +DefaultAddress = "000001000001" +MaxSpeed = "Indicate Speed (Mbps)" +KeepLink = "Keep Link" +On = "On" +Off = "Off" + + +; Auto Generated 20180205_163610.760 + diff --git a/src/bin/hamcore/DriverPackages/Neo6_Win8/x64/Neo6_x64_VPN39.inf b/src/bin/hamcore/DriverPackages/Neo6_Win8/x64/Neo6_x64_VPN39.inf index 69164803..b292d3ca 100644 --- a/src/bin/hamcore/DriverPackages/Neo6_Win8/x64/Neo6_x64_VPN39.inf +++ b/src/bin/hamcore/DriverPackages/Neo6_Win8/x64/Neo6_x64_VPN39.inf @@ -1,114 +1,114 @@ -; VPN Client Device Driver for Windows 2000 and Greater -; -; Copyright (c) SoftEther Corporation. All Rights Reserved. -; http://www.softether.co.jp/ -; -; BUILD 9658 - -[Version] -Signature = "$Windows NT$" -Class = Net -ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} -Provider = %CompanyName% -DriverVer = 02/04/2018, 4.25.0.9658 -CatalogFile.NT = inf_VPN39.cat - -[Manufacturer] -%CompanyName% = SoftEther, NTamd64 - -[SourceDisksNames] -1=%DiskDescription%, "", , - -[SourceDisksFiles] -Neo_VPN39.sys = 1 - -[DestinationDirs] -DefaultDestDir = 12 -Neo.CopyFiles.Sys = 12 - -[Neo.CopyFiles.Sys] -Neo_VPN39.sys, , , 2 - -[SoftEther.NTamd64] -%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN39 - -[NeoAdapter.Install] -Characteristics = 0x1 -AddReg = Neo.Reg, NeoAdapter.Ndi -CopyFiles = Neo.CopyFiles.Sys -*IfType = 53 -*MediaType = 0 -*PhysicalMediaType = 0 - -[NeoAdapter.Install.Services] -AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% - -[NeoAdapter.Ndi] -HKR, , NetworkAddress, 0, %DefaultAddress% -HKR, Ndi, DeviceID, , "NeoAdapter_VPN39" -HKR, , DevLoader, , ndis -HKR, , DeviceVxDs, , Neo_VPN39.sys -HKR, NDIS, LogDriverName, , "Neo_VPN39" -HKR, NDIS, MajorNdisVersion, 1, 5 -HKR, NDIS, MinorNdisVersion, 1, 0 -HKR, Ndi\Interfaces, DefUpper, , "ndis5" -HKR, Ndi\Interfaces, UpperRange, , "ndis5" -HKR, Ndi\Interfaces, LowerRange, , "ethernet" -HKR, Ndi\Interfaces, DefLower, , "ethernet" -HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" -HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% -HKR, Ndi\Params\NetworkAddress, type, 0, "edit" -HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" -HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" -HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% -HKR, Ndi\Params\NetworkAddress, optional, 0, "0" -HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% -HKR, Ndi\Params\MaxSpeed, type, 0, "int" -HKR, Ndi\Params\MaxSpeed, default, 0, "100" -HKR, Ndi\Params\MaxSpeed, min, 0, "0" -HKR, Ndi\Params\MaxSpeed, max, 0, "2000" -HKR, Ndi\Params\MaxSpeed, step, 0, "1" -HKR, Ndi\Params\MaxSpeed, Base, 0, "10" -HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% -HKR, Ndi\Params\KeepLink, type, 0, "enum" -HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% -HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% -HKR, Ndi\Params\KeepLink, default, 0, "0" - - -[Neo.Service] -DisplayName = %Neo.Service.DispName% -Description = %Neo.Service.Desc% -ServiceType = 1 -StartType = 3 -ErrorControl = 1 -ServiceBinary = %12%\Neo_VPN39.sys -LoadOrderGroup = NDIS - -[Neo.Reg] -HKR, Ndi, Service, 0, Neo.Service.Name -HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" -HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" - -[Neo.EventLog] -HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN39.sys" -HKR, , TypesSupported, 0x00010001, 7 - -[Strings] -CompanyName = "SoftEther Corporation" -DiskDescription = "VPN Client Device Driver Install Disk" -Neo.Service.Name = "Neo_VPN39" -Neo.Service.DispName = "VPN Client Device Driver - VPN39" -Neo.Service.Desc = "VPN Client Adapter - VPN39" -NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN39" -Neo.EventLog.Name = "Neo" -NetworkAddress = "MAC Address" -DefaultAddress = "000001000001" -MaxSpeed = "Indicate Speed (Mbps)" -KeepLink = "Keep Link" -On = "On" -Off = "Off" - - -; Auto Generated 20180205_163610.761 - +; VPN Client Device Driver for Windows 2000 and Greater +; +; Copyright (c) SoftEther Corporation. All Rights Reserved. +; http://www.softether.co.jp/ +; +; BUILD 9658 + +[Version] +Signature = "$Windows NT$" +Class = Net +ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} +Provider = %CompanyName% +DriverVer = 02/04/2018, 4.25.0.9658 +CatalogFile.NT = inf_VPN39.cat + +[Manufacturer] +%CompanyName% = SoftEther, NTamd64 + +[SourceDisksNames] +1=%DiskDescription%, "", , + +[SourceDisksFiles] +Neo_VPN39.sys = 1 + +[DestinationDirs] +DefaultDestDir = 12 +Neo.CopyFiles.Sys = 12 + +[Neo.CopyFiles.Sys] +Neo_VPN39.sys, , , 2 + +[SoftEther.NTamd64] +%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN39 + +[NeoAdapter.Install] +Characteristics = 0x1 +AddReg = Neo.Reg, NeoAdapter.Ndi +CopyFiles = Neo.CopyFiles.Sys +*IfType = 53 +*MediaType = 0 +*PhysicalMediaType = 0 + +[NeoAdapter.Install.Services] +AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% + +[NeoAdapter.Ndi] +HKR, , NetworkAddress, 0, %DefaultAddress% +HKR, Ndi, DeviceID, , "NeoAdapter_VPN39" +HKR, , DevLoader, , ndis +HKR, , DeviceVxDs, , Neo_VPN39.sys +HKR, NDIS, LogDriverName, , "Neo_VPN39" +HKR, NDIS, MajorNdisVersion, 1, 5 +HKR, NDIS, MinorNdisVersion, 1, 0 +HKR, Ndi\Interfaces, DefUpper, , "ndis5" +HKR, Ndi\Interfaces, UpperRange, , "ndis5" +HKR, Ndi\Interfaces, LowerRange, , "ethernet" +HKR, Ndi\Interfaces, DefLower, , "ethernet" +HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" +HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% +HKR, Ndi\Params\NetworkAddress, type, 0, "edit" +HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" +HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" +HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% +HKR, Ndi\Params\NetworkAddress, optional, 0, "0" +HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% +HKR, Ndi\Params\MaxSpeed, type, 0, "int" +HKR, Ndi\Params\MaxSpeed, default, 0, "100" +HKR, Ndi\Params\MaxSpeed, min, 0, "0" +HKR, Ndi\Params\MaxSpeed, max, 0, "2000" +HKR, Ndi\Params\MaxSpeed, step, 0, "1" +HKR, Ndi\Params\MaxSpeed, Base, 0, "10" +HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% +HKR, Ndi\Params\KeepLink, type, 0, "enum" +HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% +HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% +HKR, Ndi\Params\KeepLink, default, 0, "0" + + +[Neo.Service] +DisplayName = %Neo.Service.DispName% +Description = %Neo.Service.Desc% +ServiceType = 1 +StartType = 3 +ErrorControl = 1 +ServiceBinary = %12%\Neo_VPN39.sys +LoadOrderGroup = NDIS + +[Neo.Reg] +HKR, Ndi, Service, 0, Neo.Service.Name +HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" +HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" + +[Neo.EventLog] +HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN39.sys" +HKR, , TypesSupported, 0x00010001, 7 + +[Strings] +CompanyName = "SoftEther Corporation" +DiskDescription = "VPN Client Device Driver Install Disk" +Neo.Service.Name = "Neo_VPN39" +Neo.Service.DispName = "VPN Client Device Driver - VPN39" +Neo.Service.Desc = "VPN Client Adapter - VPN39" +NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN39" +Neo.EventLog.Name = "Neo" +NetworkAddress = "MAC Address" +DefaultAddress = "000001000001" +MaxSpeed = "Indicate Speed (Mbps)" +KeepLink = "Keep Link" +On = "On" +Off = "Off" + + +; Auto Generated 20180205_163610.761 + diff --git a/src/bin/hamcore/DriverPackages/Neo6_Win8/x64/Neo6_x64_VPN4.inf b/src/bin/hamcore/DriverPackages/Neo6_Win8/x64/Neo6_x64_VPN4.inf index 39b55d38..f8d3baf3 100644 --- a/src/bin/hamcore/DriverPackages/Neo6_Win8/x64/Neo6_x64_VPN4.inf +++ b/src/bin/hamcore/DriverPackages/Neo6_Win8/x64/Neo6_x64_VPN4.inf @@ -1,114 +1,114 @@ -; VPN Client Device Driver for Windows 2000 and Greater -; -; Copyright (c) SoftEther Corporation. All Rights Reserved. -; http://www.softether.co.jp/ -; -; BUILD 9658 - -[Version] -Signature = "$Windows NT$" -Class = Net -ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} -Provider = %CompanyName% -DriverVer = 02/04/2018, 4.25.0.9658 -CatalogFile.NT = inf_VPN4.cat - -[Manufacturer] -%CompanyName% = SoftEther, NTamd64 - -[SourceDisksNames] -1=%DiskDescription%, "", , - -[SourceDisksFiles] -Neo_VPN4.sys = 1 - -[DestinationDirs] -DefaultDestDir = 12 -Neo.CopyFiles.Sys = 12 - -[Neo.CopyFiles.Sys] -Neo_VPN4.sys, , , 2 - -[SoftEther.NTamd64] -%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN4 - -[NeoAdapter.Install] -Characteristics = 0x1 -AddReg = Neo.Reg, NeoAdapter.Ndi -CopyFiles = Neo.CopyFiles.Sys -*IfType = 53 -*MediaType = 0 -*PhysicalMediaType = 0 - -[NeoAdapter.Install.Services] -AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% - -[NeoAdapter.Ndi] -HKR, , NetworkAddress, 0, %DefaultAddress% -HKR, Ndi, DeviceID, , "NeoAdapter_VPN4" -HKR, , DevLoader, , ndis -HKR, , DeviceVxDs, , Neo_VPN4.sys -HKR, NDIS, LogDriverName, , "Neo_VPN4" -HKR, NDIS, MajorNdisVersion, 1, 5 -HKR, NDIS, MinorNdisVersion, 1, 0 -HKR, Ndi\Interfaces, DefUpper, , "ndis5" -HKR, Ndi\Interfaces, UpperRange, , "ndis5" -HKR, Ndi\Interfaces, LowerRange, , "ethernet" -HKR, Ndi\Interfaces, DefLower, , "ethernet" -HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" -HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% -HKR, Ndi\Params\NetworkAddress, type, 0, "edit" -HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" -HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" -HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% -HKR, Ndi\Params\NetworkAddress, optional, 0, "0" -HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% -HKR, Ndi\Params\MaxSpeed, type, 0, "int" -HKR, Ndi\Params\MaxSpeed, default, 0, "100" -HKR, Ndi\Params\MaxSpeed, min, 0, "0" -HKR, Ndi\Params\MaxSpeed, max, 0, "2000" -HKR, Ndi\Params\MaxSpeed, step, 0, "1" -HKR, Ndi\Params\MaxSpeed, Base, 0, "10" -HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% -HKR, Ndi\Params\KeepLink, type, 0, "enum" -HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% -HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% -HKR, Ndi\Params\KeepLink, default, 0, "0" - - -[Neo.Service] -DisplayName = %Neo.Service.DispName% -Description = %Neo.Service.Desc% -ServiceType = 1 -StartType = 3 -ErrorControl = 1 -ServiceBinary = %12%\Neo_VPN4.sys -LoadOrderGroup = NDIS - -[Neo.Reg] -HKR, Ndi, Service, 0, Neo.Service.Name -HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" -HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" - -[Neo.EventLog] -HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN4.sys" -HKR, , TypesSupported, 0x00010001, 7 - -[Strings] -CompanyName = "SoftEther Corporation" -DiskDescription = "VPN Client Device Driver Install Disk" -Neo.Service.Name = "Neo_VPN4" -Neo.Service.DispName = "VPN Client Device Driver - VPN4" -Neo.Service.Desc = "VPN Client Adapter - VPN4" -NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN4" -Neo.EventLog.Name = "Neo" -NetworkAddress = "MAC Address" -DefaultAddress = "000001000001" -MaxSpeed = "Indicate Speed (Mbps)" -KeepLink = "Keep Link" -On = "On" -Off = "Off" - - -; Auto Generated 20180205_163610.740 - +; VPN Client Device Driver for Windows 2000 and Greater +; +; Copyright (c) SoftEther Corporation. All Rights Reserved. +; http://www.softether.co.jp/ +; +; BUILD 9658 + +[Version] +Signature = "$Windows NT$" +Class = Net +ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} +Provider = %CompanyName% +DriverVer = 02/04/2018, 4.25.0.9658 +CatalogFile.NT = inf_VPN4.cat + +[Manufacturer] +%CompanyName% = SoftEther, NTamd64 + +[SourceDisksNames] +1=%DiskDescription%, "", , + +[SourceDisksFiles] +Neo_VPN4.sys = 1 + +[DestinationDirs] +DefaultDestDir = 12 +Neo.CopyFiles.Sys = 12 + +[Neo.CopyFiles.Sys] +Neo_VPN4.sys, , , 2 + +[SoftEther.NTamd64] +%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN4 + +[NeoAdapter.Install] +Characteristics = 0x1 +AddReg = Neo.Reg, NeoAdapter.Ndi +CopyFiles = Neo.CopyFiles.Sys +*IfType = 53 +*MediaType = 0 +*PhysicalMediaType = 0 + +[NeoAdapter.Install.Services] +AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% + +[NeoAdapter.Ndi] +HKR, , NetworkAddress, 0, %DefaultAddress% +HKR, Ndi, DeviceID, , "NeoAdapter_VPN4" +HKR, , DevLoader, , ndis +HKR, , DeviceVxDs, , Neo_VPN4.sys +HKR, NDIS, LogDriverName, , "Neo_VPN4" +HKR, NDIS, MajorNdisVersion, 1, 5 +HKR, NDIS, MinorNdisVersion, 1, 0 +HKR, Ndi\Interfaces, DefUpper, , "ndis5" +HKR, Ndi\Interfaces, UpperRange, , "ndis5" +HKR, Ndi\Interfaces, LowerRange, , "ethernet" +HKR, Ndi\Interfaces, DefLower, , "ethernet" +HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" +HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% +HKR, Ndi\Params\NetworkAddress, type, 0, "edit" +HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" +HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" +HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% +HKR, Ndi\Params\NetworkAddress, optional, 0, "0" +HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% +HKR, Ndi\Params\MaxSpeed, type, 0, "int" +HKR, Ndi\Params\MaxSpeed, default, 0, "100" +HKR, Ndi\Params\MaxSpeed, min, 0, "0" +HKR, Ndi\Params\MaxSpeed, max, 0, "2000" +HKR, Ndi\Params\MaxSpeed, step, 0, "1" +HKR, Ndi\Params\MaxSpeed, Base, 0, "10" +HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% +HKR, Ndi\Params\KeepLink, type, 0, "enum" +HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% +HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% +HKR, Ndi\Params\KeepLink, default, 0, "0" + + +[Neo.Service] +DisplayName = %Neo.Service.DispName% +Description = %Neo.Service.Desc% +ServiceType = 1 +StartType = 3 +ErrorControl = 1 +ServiceBinary = %12%\Neo_VPN4.sys +LoadOrderGroup = NDIS + +[Neo.Reg] +HKR, Ndi, Service, 0, Neo.Service.Name +HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" +HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" + +[Neo.EventLog] +HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN4.sys" +HKR, , TypesSupported, 0x00010001, 7 + +[Strings] +CompanyName = "SoftEther Corporation" +DiskDescription = "VPN Client Device Driver Install Disk" +Neo.Service.Name = "Neo_VPN4" +Neo.Service.DispName = "VPN Client Device Driver - VPN4" +Neo.Service.Desc = "VPN Client Adapter - VPN4" +NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN4" +Neo.EventLog.Name = "Neo" +NetworkAddress = "MAC Address" +DefaultAddress = "000001000001" +MaxSpeed = "Indicate Speed (Mbps)" +KeepLink = "Keep Link" +On = "On" +Off = "Off" + + +; Auto Generated 20180205_163610.740 + diff --git a/src/bin/hamcore/DriverPackages/Neo6_Win8/x64/Neo6_x64_VPN40.inf b/src/bin/hamcore/DriverPackages/Neo6_Win8/x64/Neo6_x64_VPN40.inf index af8c4236..6b6e34e6 100644 --- a/src/bin/hamcore/DriverPackages/Neo6_Win8/x64/Neo6_x64_VPN40.inf +++ b/src/bin/hamcore/DriverPackages/Neo6_Win8/x64/Neo6_x64_VPN40.inf @@ -1,114 +1,114 @@ -; VPN Client Device Driver for Windows 2000 and Greater -; -; Copyright (c) SoftEther Corporation. All Rights Reserved. -; http://www.softether.co.jp/ -; -; BUILD 9658 - -[Version] -Signature = "$Windows NT$" -Class = Net -ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} -Provider = %CompanyName% -DriverVer = 02/04/2018, 4.25.0.9658 -CatalogFile.NT = inf_VPN40.cat - -[Manufacturer] -%CompanyName% = SoftEther, NTamd64 - -[SourceDisksNames] -1=%DiskDescription%, "", , - -[SourceDisksFiles] -Neo_VPN40.sys = 1 - -[DestinationDirs] -DefaultDestDir = 12 -Neo.CopyFiles.Sys = 12 - -[Neo.CopyFiles.Sys] -Neo_VPN40.sys, , , 2 - -[SoftEther.NTamd64] -%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN40 - -[NeoAdapter.Install] -Characteristics = 0x1 -AddReg = Neo.Reg, NeoAdapter.Ndi -CopyFiles = Neo.CopyFiles.Sys -*IfType = 53 -*MediaType = 0 -*PhysicalMediaType = 0 - -[NeoAdapter.Install.Services] -AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% - -[NeoAdapter.Ndi] -HKR, , NetworkAddress, 0, %DefaultAddress% -HKR, Ndi, DeviceID, , "NeoAdapter_VPN40" -HKR, , DevLoader, , ndis -HKR, , DeviceVxDs, , Neo_VPN40.sys -HKR, NDIS, LogDriverName, , "Neo_VPN40" -HKR, NDIS, MajorNdisVersion, 1, 5 -HKR, NDIS, MinorNdisVersion, 1, 0 -HKR, Ndi\Interfaces, DefUpper, , "ndis5" -HKR, Ndi\Interfaces, UpperRange, , "ndis5" -HKR, Ndi\Interfaces, LowerRange, , "ethernet" -HKR, Ndi\Interfaces, DefLower, , "ethernet" -HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" -HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% -HKR, Ndi\Params\NetworkAddress, type, 0, "edit" -HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" -HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" -HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% -HKR, Ndi\Params\NetworkAddress, optional, 0, "0" -HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% -HKR, Ndi\Params\MaxSpeed, type, 0, "int" -HKR, Ndi\Params\MaxSpeed, default, 0, "100" -HKR, Ndi\Params\MaxSpeed, min, 0, "0" -HKR, Ndi\Params\MaxSpeed, max, 0, "2000" -HKR, Ndi\Params\MaxSpeed, step, 0, "1" -HKR, Ndi\Params\MaxSpeed, Base, 0, "10" -HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% -HKR, Ndi\Params\KeepLink, type, 0, "enum" -HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% -HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% -HKR, Ndi\Params\KeepLink, default, 0, "0" - - -[Neo.Service] -DisplayName = %Neo.Service.DispName% -Description = %Neo.Service.Desc% -ServiceType = 1 -StartType = 3 -ErrorControl = 1 -ServiceBinary = %12%\Neo_VPN40.sys -LoadOrderGroup = NDIS - -[Neo.Reg] -HKR, Ndi, Service, 0, Neo.Service.Name -HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" -HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" - -[Neo.EventLog] -HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN40.sys" -HKR, , TypesSupported, 0x00010001, 7 - -[Strings] -CompanyName = "SoftEther Corporation" -DiskDescription = "VPN Client Device Driver Install Disk" -Neo.Service.Name = "Neo_VPN40" -Neo.Service.DispName = "VPN Client Device Driver - VPN40" -Neo.Service.Desc = "VPN Client Adapter - VPN40" -NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN40" -Neo.EventLog.Name = "Neo" -NetworkAddress = "MAC Address" -DefaultAddress = "000001000001" -MaxSpeed = "Indicate Speed (Mbps)" -KeepLink = "Keep Link" -On = "On" -Off = "Off" - - -; Auto Generated 20180205_163610.762 - +; VPN Client Device Driver for Windows 2000 and Greater +; +; Copyright (c) SoftEther Corporation. All Rights Reserved. +; http://www.softether.co.jp/ +; +; BUILD 9658 + +[Version] +Signature = "$Windows NT$" +Class = Net +ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} +Provider = %CompanyName% +DriverVer = 02/04/2018, 4.25.0.9658 +CatalogFile.NT = inf_VPN40.cat + +[Manufacturer] +%CompanyName% = SoftEther, NTamd64 + +[SourceDisksNames] +1=%DiskDescription%, "", , + +[SourceDisksFiles] +Neo_VPN40.sys = 1 + +[DestinationDirs] +DefaultDestDir = 12 +Neo.CopyFiles.Sys = 12 + +[Neo.CopyFiles.Sys] +Neo_VPN40.sys, , , 2 + +[SoftEther.NTamd64] +%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN40 + +[NeoAdapter.Install] +Characteristics = 0x1 +AddReg = Neo.Reg, NeoAdapter.Ndi +CopyFiles = Neo.CopyFiles.Sys +*IfType = 53 +*MediaType = 0 +*PhysicalMediaType = 0 + +[NeoAdapter.Install.Services] +AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% + +[NeoAdapter.Ndi] +HKR, , NetworkAddress, 0, %DefaultAddress% +HKR, Ndi, DeviceID, , "NeoAdapter_VPN40" +HKR, , DevLoader, , ndis +HKR, , DeviceVxDs, , Neo_VPN40.sys +HKR, NDIS, LogDriverName, , "Neo_VPN40" +HKR, NDIS, MajorNdisVersion, 1, 5 +HKR, NDIS, MinorNdisVersion, 1, 0 +HKR, Ndi\Interfaces, DefUpper, , "ndis5" +HKR, Ndi\Interfaces, UpperRange, , "ndis5" +HKR, Ndi\Interfaces, LowerRange, , "ethernet" +HKR, Ndi\Interfaces, DefLower, , "ethernet" +HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" +HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% +HKR, Ndi\Params\NetworkAddress, type, 0, "edit" +HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" +HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" +HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% +HKR, Ndi\Params\NetworkAddress, optional, 0, "0" +HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% +HKR, Ndi\Params\MaxSpeed, type, 0, "int" +HKR, Ndi\Params\MaxSpeed, default, 0, "100" +HKR, Ndi\Params\MaxSpeed, min, 0, "0" +HKR, Ndi\Params\MaxSpeed, max, 0, "2000" +HKR, Ndi\Params\MaxSpeed, step, 0, "1" +HKR, Ndi\Params\MaxSpeed, Base, 0, "10" +HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% +HKR, Ndi\Params\KeepLink, type, 0, "enum" +HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% +HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% +HKR, Ndi\Params\KeepLink, default, 0, "0" + + +[Neo.Service] +DisplayName = %Neo.Service.DispName% +Description = %Neo.Service.Desc% +ServiceType = 1 +StartType = 3 +ErrorControl = 1 +ServiceBinary = %12%\Neo_VPN40.sys +LoadOrderGroup = NDIS + +[Neo.Reg] +HKR, Ndi, Service, 0, Neo.Service.Name +HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" +HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" + +[Neo.EventLog] +HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN40.sys" +HKR, , TypesSupported, 0x00010001, 7 + +[Strings] +CompanyName = "SoftEther Corporation" +DiskDescription = "VPN Client Device Driver Install Disk" +Neo.Service.Name = "Neo_VPN40" +Neo.Service.DispName = "VPN Client Device Driver - VPN40" +Neo.Service.Desc = "VPN Client Adapter - VPN40" +NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN40" +Neo.EventLog.Name = "Neo" +NetworkAddress = "MAC Address" +DefaultAddress = "000001000001" +MaxSpeed = "Indicate Speed (Mbps)" +KeepLink = "Keep Link" +On = "On" +Off = "Off" + + +; Auto Generated 20180205_163610.762 + diff --git a/src/bin/hamcore/DriverPackages/Neo6_Win8/x64/Neo6_x64_VPN41.inf b/src/bin/hamcore/DriverPackages/Neo6_Win8/x64/Neo6_x64_VPN41.inf index 2c01f52f..46c48f11 100644 --- a/src/bin/hamcore/DriverPackages/Neo6_Win8/x64/Neo6_x64_VPN41.inf +++ b/src/bin/hamcore/DriverPackages/Neo6_Win8/x64/Neo6_x64_VPN41.inf @@ -1,114 +1,114 @@ -; VPN Client Device Driver for Windows 2000 and Greater -; -; Copyright (c) SoftEther Corporation. All Rights Reserved. -; http://www.softether.co.jp/ -; -; BUILD 9658 - -[Version] -Signature = "$Windows NT$" -Class = Net -ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} -Provider = %CompanyName% -DriverVer = 02/04/2018, 4.25.0.9658 -CatalogFile.NT = inf_VPN41.cat - -[Manufacturer] -%CompanyName% = SoftEther, NTamd64 - -[SourceDisksNames] -1=%DiskDescription%, "", , - -[SourceDisksFiles] -Neo_VPN41.sys = 1 - -[DestinationDirs] -DefaultDestDir = 12 -Neo.CopyFiles.Sys = 12 - -[Neo.CopyFiles.Sys] -Neo_VPN41.sys, , , 2 - -[SoftEther.NTamd64] -%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN41 - -[NeoAdapter.Install] -Characteristics = 0x1 -AddReg = Neo.Reg, NeoAdapter.Ndi -CopyFiles = Neo.CopyFiles.Sys -*IfType = 53 -*MediaType = 0 -*PhysicalMediaType = 0 - -[NeoAdapter.Install.Services] -AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% - -[NeoAdapter.Ndi] -HKR, , NetworkAddress, 0, %DefaultAddress% -HKR, Ndi, DeviceID, , "NeoAdapter_VPN41" -HKR, , DevLoader, , ndis -HKR, , DeviceVxDs, , Neo_VPN41.sys -HKR, NDIS, LogDriverName, , "Neo_VPN41" -HKR, NDIS, MajorNdisVersion, 1, 5 -HKR, NDIS, MinorNdisVersion, 1, 0 -HKR, Ndi\Interfaces, DefUpper, , "ndis5" -HKR, Ndi\Interfaces, UpperRange, , "ndis5" -HKR, Ndi\Interfaces, LowerRange, , "ethernet" -HKR, Ndi\Interfaces, DefLower, , "ethernet" -HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" -HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% -HKR, Ndi\Params\NetworkAddress, type, 0, "edit" -HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" -HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" -HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% -HKR, Ndi\Params\NetworkAddress, optional, 0, "0" -HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% -HKR, Ndi\Params\MaxSpeed, type, 0, "int" -HKR, Ndi\Params\MaxSpeed, default, 0, "100" -HKR, Ndi\Params\MaxSpeed, min, 0, "0" -HKR, Ndi\Params\MaxSpeed, max, 0, "2000" -HKR, Ndi\Params\MaxSpeed, step, 0, "1" -HKR, Ndi\Params\MaxSpeed, Base, 0, "10" -HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% -HKR, Ndi\Params\KeepLink, type, 0, "enum" -HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% -HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% -HKR, Ndi\Params\KeepLink, default, 0, "0" - - -[Neo.Service] -DisplayName = %Neo.Service.DispName% -Description = %Neo.Service.Desc% -ServiceType = 1 -StartType = 3 -ErrorControl = 1 -ServiceBinary = %12%\Neo_VPN41.sys -LoadOrderGroup = NDIS - -[Neo.Reg] -HKR, Ndi, Service, 0, Neo.Service.Name -HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" -HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" - -[Neo.EventLog] -HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN41.sys" -HKR, , TypesSupported, 0x00010001, 7 - -[Strings] -CompanyName = "SoftEther Corporation" -DiskDescription = "VPN Client Device Driver Install Disk" -Neo.Service.Name = "Neo_VPN41" -Neo.Service.DispName = "VPN Client Device Driver - VPN41" -Neo.Service.Desc = "VPN Client Adapter - VPN41" -NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN41" -Neo.EventLog.Name = "Neo" -NetworkAddress = "MAC Address" -DefaultAddress = "000001000001" -MaxSpeed = "Indicate Speed (Mbps)" -KeepLink = "Keep Link" -On = "On" -Off = "Off" - - -; Auto Generated 20180205_163610.762 - +; VPN Client Device Driver for Windows 2000 and Greater +; +; Copyright (c) SoftEther Corporation. All Rights Reserved. +; http://www.softether.co.jp/ +; +; BUILD 9658 + +[Version] +Signature = "$Windows NT$" +Class = Net +ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} +Provider = %CompanyName% +DriverVer = 02/04/2018, 4.25.0.9658 +CatalogFile.NT = inf_VPN41.cat + +[Manufacturer] +%CompanyName% = SoftEther, NTamd64 + +[SourceDisksNames] +1=%DiskDescription%, "", , + +[SourceDisksFiles] +Neo_VPN41.sys = 1 + +[DestinationDirs] +DefaultDestDir = 12 +Neo.CopyFiles.Sys = 12 + +[Neo.CopyFiles.Sys] +Neo_VPN41.sys, , , 2 + +[SoftEther.NTamd64] +%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN41 + +[NeoAdapter.Install] +Characteristics = 0x1 +AddReg = Neo.Reg, NeoAdapter.Ndi +CopyFiles = Neo.CopyFiles.Sys +*IfType = 53 +*MediaType = 0 +*PhysicalMediaType = 0 + +[NeoAdapter.Install.Services] +AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% + +[NeoAdapter.Ndi] +HKR, , NetworkAddress, 0, %DefaultAddress% +HKR, Ndi, DeviceID, , "NeoAdapter_VPN41" +HKR, , DevLoader, , ndis +HKR, , DeviceVxDs, , Neo_VPN41.sys +HKR, NDIS, LogDriverName, , "Neo_VPN41" +HKR, NDIS, MajorNdisVersion, 1, 5 +HKR, NDIS, MinorNdisVersion, 1, 0 +HKR, Ndi\Interfaces, DefUpper, , "ndis5" +HKR, Ndi\Interfaces, UpperRange, , "ndis5" +HKR, Ndi\Interfaces, LowerRange, , "ethernet" +HKR, Ndi\Interfaces, DefLower, , "ethernet" +HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" +HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% +HKR, Ndi\Params\NetworkAddress, type, 0, "edit" +HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" +HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" +HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% +HKR, Ndi\Params\NetworkAddress, optional, 0, "0" +HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% +HKR, Ndi\Params\MaxSpeed, type, 0, "int" +HKR, Ndi\Params\MaxSpeed, default, 0, "100" +HKR, Ndi\Params\MaxSpeed, min, 0, "0" +HKR, Ndi\Params\MaxSpeed, max, 0, "2000" +HKR, Ndi\Params\MaxSpeed, step, 0, "1" +HKR, Ndi\Params\MaxSpeed, Base, 0, "10" +HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% +HKR, Ndi\Params\KeepLink, type, 0, "enum" +HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% +HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% +HKR, Ndi\Params\KeepLink, default, 0, "0" + + +[Neo.Service] +DisplayName = %Neo.Service.DispName% +Description = %Neo.Service.Desc% +ServiceType = 1 +StartType = 3 +ErrorControl = 1 +ServiceBinary = %12%\Neo_VPN41.sys +LoadOrderGroup = NDIS + +[Neo.Reg] +HKR, Ndi, Service, 0, Neo.Service.Name +HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" +HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" + +[Neo.EventLog] +HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN41.sys" +HKR, , TypesSupported, 0x00010001, 7 + +[Strings] +CompanyName = "SoftEther Corporation" +DiskDescription = "VPN Client Device Driver Install Disk" +Neo.Service.Name = "Neo_VPN41" +Neo.Service.DispName = "VPN Client Device Driver - VPN41" +Neo.Service.Desc = "VPN Client Adapter - VPN41" +NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN41" +Neo.EventLog.Name = "Neo" +NetworkAddress = "MAC Address" +DefaultAddress = "000001000001" +MaxSpeed = "Indicate Speed (Mbps)" +KeepLink = "Keep Link" +On = "On" +Off = "Off" + + +; Auto Generated 20180205_163610.762 + diff --git a/src/bin/hamcore/DriverPackages/Neo6_Win8/x64/Neo6_x64_VPN42.inf b/src/bin/hamcore/DriverPackages/Neo6_Win8/x64/Neo6_x64_VPN42.inf index f4ca08f5..818e693e 100644 --- a/src/bin/hamcore/DriverPackages/Neo6_Win8/x64/Neo6_x64_VPN42.inf +++ b/src/bin/hamcore/DriverPackages/Neo6_Win8/x64/Neo6_x64_VPN42.inf @@ -1,114 +1,114 @@ -; VPN Client Device Driver for Windows 2000 and Greater -; -; Copyright (c) SoftEther Corporation. All Rights Reserved. -; http://www.softether.co.jp/ -; -; BUILD 9658 - -[Version] -Signature = "$Windows NT$" -Class = Net -ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} -Provider = %CompanyName% -DriverVer = 02/04/2018, 4.25.0.9658 -CatalogFile.NT = inf_VPN42.cat - -[Manufacturer] -%CompanyName% = SoftEther, NTamd64 - -[SourceDisksNames] -1=%DiskDescription%, "", , - -[SourceDisksFiles] -Neo_VPN42.sys = 1 - -[DestinationDirs] -DefaultDestDir = 12 -Neo.CopyFiles.Sys = 12 - -[Neo.CopyFiles.Sys] -Neo_VPN42.sys, , , 2 - -[SoftEther.NTamd64] -%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN42 - -[NeoAdapter.Install] -Characteristics = 0x1 -AddReg = Neo.Reg, NeoAdapter.Ndi -CopyFiles = Neo.CopyFiles.Sys -*IfType = 53 -*MediaType = 0 -*PhysicalMediaType = 0 - -[NeoAdapter.Install.Services] -AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% - -[NeoAdapter.Ndi] -HKR, , NetworkAddress, 0, %DefaultAddress% -HKR, Ndi, DeviceID, , "NeoAdapter_VPN42" -HKR, , DevLoader, , ndis -HKR, , DeviceVxDs, , Neo_VPN42.sys -HKR, NDIS, LogDriverName, , "Neo_VPN42" -HKR, NDIS, MajorNdisVersion, 1, 5 -HKR, NDIS, MinorNdisVersion, 1, 0 -HKR, Ndi\Interfaces, DefUpper, , "ndis5" -HKR, Ndi\Interfaces, UpperRange, , "ndis5" -HKR, Ndi\Interfaces, LowerRange, , "ethernet" -HKR, Ndi\Interfaces, DefLower, , "ethernet" -HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" -HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% -HKR, Ndi\Params\NetworkAddress, type, 0, "edit" -HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" -HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" -HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% -HKR, Ndi\Params\NetworkAddress, optional, 0, "0" -HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% -HKR, Ndi\Params\MaxSpeed, type, 0, "int" -HKR, Ndi\Params\MaxSpeed, default, 0, "100" -HKR, Ndi\Params\MaxSpeed, min, 0, "0" -HKR, Ndi\Params\MaxSpeed, max, 0, "2000" -HKR, Ndi\Params\MaxSpeed, step, 0, "1" -HKR, Ndi\Params\MaxSpeed, Base, 0, "10" -HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% -HKR, Ndi\Params\KeepLink, type, 0, "enum" -HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% -HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% -HKR, Ndi\Params\KeepLink, default, 0, "0" - - -[Neo.Service] -DisplayName = %Neo.Service.DispName% -Description = %Neo.Service.Desc% -ServiceType = 1 -StartType = 3 -ErrorControl = 1 -ServiceBinary = %12%\Neo_VPN42.sys -LoadOrderGroup = NDIS - -[Neo.Reg] -HKR, Ndi, Service, 0, Neo.Service.Name -HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" -HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" - -[Neo.EventLog] -HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN42.sys" -HKR, , TypesSupported, 0x00010001, 7 - -[Strings] -CompanyName = "SoftEther Corporation" -DiskDescription = "VPN Client Device Driver Install Disk" -Neo.Service.Name = "Neo_VPN42" -Neo.Service.DispName = "VPN Client Device Driver - VPN42" -Neo.Service.Desc = "VPN Client Adapter - VPN42" -NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN42" -Neo.EventLog.Name = "Neo" -NetworkAddress = "MAC Address" -DefaultAddress = "000001000001" -MaxSpeed = "Indicate Speed (Mbps)" -KeepLink = "Keep Link" -On = "On" -Off = "Off" - - -; Auto Generated 20180205_163610.763 - +; VPN Client Device Driver for Windows 2000 and Greater +; +; Copyright (c) SoftEther Corporation. All Rights Reserved. +; http://www.softether.co.jp/ +; +; BUILD 9658 + +[Version] +Signature = "$Windows NT$" +Class = Net +ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} +Provider = %CompanyName% +DriverVer = 02/04/2018, 4.25.0.9658 +CatalogFile.NT = inf_VPN42.cat + +[Manufacturer] +%CompanyName% = SoftEther, NTamd64 + +[SourceDisksNames] +1=%DiskDescription%, "", , + +[SourceDisksFiles] +Neo_VPN42.sys = 1 + +[DestinationDirs] +DefaultDestDir = 12 +Neo.CopyFiles.Sys = 12 + +[Neo.CopyFiles.Sys] +Neo_VPN42.sys, , , 2 + +[SoftEther.NTamd64] +%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN42 + +[NeoAdapter.Install] +Characteristics = 0x1 +AddReg = Neo.Reg, NeoAdapter.Ndi +CopyFiles = Neo.CopyFiles.Sys +*IfType = 53 +*MediaType = 0 +*PhysicalMediaType = 0 + +[NeoAdapter.Install.Services] +AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% + +[NeoAdapter.Ndi] +HKR, , NetworkAddress, 0, %DefaultAddress% +HKR, Ndi, DeviceID, , "NeoAdapter_VPN42" +HKR, , DevLoader, , ndis +HKR, , DeviceVxDs, , Neo_VPN42.sys +HKR, NDIS, LogDriverName, , "Neo_VPN42" +HKR, NDIS, MajorNdisVersion, 1, 5 +HKR, NDIS, MinorNdisVersion, 1, 0 +HKR, Ndi\Interfaces, DefUpper, , "ndis5" +HKR, Ndi\Interfaces, UpperRange, , "ndis5" +HKR, Ndi\Interfaces, LowerRange, , "ethernet" +HKR, Ndi\Interfaces, DefLower, , "ethernet" +HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" +HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% +HKR, Ndi\Params\NetworkAddress, type, 0, "edit" +HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" +HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" +HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% +HKR, Ndi\Params\NetworkAddress, optional, 0, "0" +HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% +HKR, Ndi\Params\MaxSpeed, type, 0, "int" +HKR, Ndi\Params\MaxSpeed, default, 0, "100" +HKR, Ndi\Params\MaxSpeed, min, 0, "0" +HKR, Ndi\Params\MaxSpeed, max, 0, "2000" +HKR, Ndi\Params\MaxSpeed, step, 0, "1" +HKR, Ndi\Params\MaxSpeed, Base, 0, "10" +HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% +HKR, Ndi\Params\KeepLink, type, 0, "enum" +HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% +HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% +HKR, Ndi\Params\KeepLink, default, 0, "0" + + +[Neo.Service] +DisplayName = %Neo.Service.DispName% +Description = %Neo.Service.Desc% +ServiceType = 1 +StartType = 3 +ErrorControl = 1 +ServiceBinary = %12%\Neo_VPN42.sys +LoadOrderGroup = NDIS + +[Neo.Reg] +HKR, Ndi, Service, 0, Neo.Service.Name +HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" +HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" + +[Neo.EventLog] +HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN42.sys" +HKR, , TypesSupported, 0x00010001, 7 + +[Strings] +CompanyName = "SoftEther Corporation" +DiskDescription = "VPN Client Device Driver Install Disk" +Neo.Service.Name = "Neo_VPN42" +Neo.Service.DispName = "VPN Client Device Driver - VPN42" +Neo.Service.Desc = "VPN Client Adapter - VPN42" +NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN42" +Neo.EventLog.Name = "Neo" +NetworkAddress = "MAC Address" +DefaultAddress = "000001000001" +MaxSpeed = "Indicate Speed (Mbps)" +KeepLink = "Keep Link" +On = "On" +Off = "Off" + + +; Auto Generated 20180205_163610.763 + diff --git a/src/bin/hamcore/DriverPackages/Neo6_Win8/x64/Neo6_x64_VPN43.inf b/src/bin/hamcore/DriverPackages/Neo6_Win8/x64/Neo6_x64_VPN43.inf index 19a9ad38..0e23ae33 100644 --- a/src/bin/hamcore/DriverPackages/Neo6_Win8/x64/Neo6_x64_VPN43.inf +++ b/src/bin/hamcore/DriverPackages/Neo6_Win8/x64/Neo6_x64_VPN43.inf @@ -1,114 +1,114 @@ -; VPN Client Device Driver for Windows 2000 and Greater -; -; Copyright (c) SoftEther Corporation. All Rights Reserved. -; http://www.softether.co.jp/ -; -; BUILD 9658 - -[Version] -Signature = "$Windows NT$" -Class = Net -ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} -Provider = %CompanyName% -DriverVer = 02/04/2018, 4.25.0.9658 -CatalogFile.NT = inf_VPN43.cat - -[Manufacturer] -%CompanyName% = SoftEther, NTamd64 - -[SourceDisksNames] -1=%DiskDescription%, "", , - -[SourceDisksFiles] -Neo_VPN43.sys = 1 - -[DestinationDirs] -DefaultDestDir = 12 -Neo.CopyFiles.Sys = 12 - -[Neo.CopyFiles.Sys] -Neo_VPN43.sys, , , 2 - -[SoftEther.NTamd64] -%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN43 - -[NeoAdapter.Install] -Characteristics = 0x1 -AddReg = Neo.Reg, NeoAdapter.Ndi -CopyFiles = Neo.CopyFiles.Sys -*IfType = 53 -*MediaType = 0 -*PhysicalMediaType = 0 - -[NeoAdapter.Install.Services] -AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% - -[NeoAdapter.Ndi] -HKR, , NetworkAddress, 0, %DefaultAddress% -HKR, Ndi, DeviceID, , "NeoAdapter_VPN43" -HKR, , DevLoader, , ndis -HKR, , DeviceVxDs, , Neo_VPN43.sys -HKR, NDIS, LogDriverName, , "Neo_VPN43" -HKR, NDIS, MajorNdisVersion, 1, 5 -HKR, NDIS, MinorNdisVersion, 1, 0 -HKR, Ndi\Interfaces, DefUpper, , "ndis5" -HKR, Ndi\Interfaces, UpperRange, , "ndis5" -HKR, Ndi\Interfaces, LowerRange, , "ethernet" -HKR, Ndi\Interfaces, DefLower, , "ethernet" -HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" -HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% -HKR, Ndi\Params\NetworkAddress, type, 0, "edit" -HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" -HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" -HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% -HKR, Ndi\Params\NetworkAddress, optional, 0, "0" -HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% -HKR, Ndi\Params\MaxSpeed, type, 0, "int" -HKR, Ndi\Params\MaxSpeed, default, 0, "100" -HKR, Ndi\Params\MaxSpeed, min, 0, "0" -HKR, Ndi\Params\MaxSpeed, max, 0, "2000" -HKR, Ndi\Params\MaxSpeed, step, 0, "1" -HKR, Ndi\Params\MaxSpeed, Base, 0, "10" -HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% -HKR, Ndi\Params\KeepLink, type, 0, "enum" -HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% -HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% -HKR, Ndi\Params\KeepLink, default, 0, "0" - - -[Neo.Service] -DisplayName = %Neo.Service.DispName% -Description = %Neo.Service.Desc% -ServiceType = 1 -StartType = 3 -ErrorControl = 1 -ServiceBinary = %12%\Neo_VPN43.sys -LoadOrderGroup = NDIS - -[Neo.Reg] -HKR, Ndi, Service, 0, Neo.Service.Name -HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" -HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" - -[Neo.EventLog] -HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN43.sys" -HKR, , TypesSupported, 0x00010001, 7 - -[Strings] -CompanyName = "SoftEther Corporation" -DiskDescription = "VPN Client Device Driver Install Disk" -Neo.Service.Name = "Neo_VPN43" -Neo.Service.DispName = "VPN Client Device Driver - VPN43" -Neo.Service.Desc = "VPN Client Adapter - VPN43" -NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN43" -Neo.EventLog.Name = "Neo" -NetworkAddress = "MAC Address" -DefaultAddress = "000001000001" -MaxSpeed = "Indicate Speed (Mbps)" -KeepLink = "Keep Link" -On = "On" -Off = "Off" - - -; Auto Generated 20180205_163610.763 - +; VPN Client Device Driver for Windows 2000 and Greater +; +; Copyright (c) SoftEther Corporation. All Rights Reserved. +; http://www.softether.co.jp/ +; +; BUILD 9658 + +[Version] +Signature = "$Windows NT$" +Class = Net +ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} +Provider = %CompanyName% +DriverVer = 02/04/2018, 4.25.0.9658 +CatalogFile.NT = inf_VPN43.cat + +[Manufacturer] +%CompanyName% = SoftEther, NTamd64 + +[SourceDisksNames] +1=%DiskDescription%, "", , + +[SourceDisksFiles] +Neo_VPN43.sys = 1 + +[DestinationDirs] +DefaultDestDir = 12 +Neo.CopyFiles.Sys = 12 + +[Neo.CopyFiles.Sys] +Neo_VPN43.sys, , , 2 + +[SoftEther.NTamd64] +%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN43 + +[NeoAdapter.Install] +Characteristics = 0x1 +AddReg = Neo.Reg, NeoAdapter.Ndi +CopyFiles = Neo.CopyFiles.Sys +*IfType = 53 +*MediaType = 0 +*PhysicalMediaType = 0 + +[NeoAdapter.Install.Services] +AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% + +[NeoAdapter.Ndi] +HKR, , NetworkAddress, 0, %DefaultAddress% +HKR, Ndi, DeviceID, , "NeoAdapter_VPN43" +HKR, , DevLoader, , ndis +HKR, , DeviceVxDs, , Neo_VPN43.sys +HKR, NDIS, LogDriverName, , "Neo_VPN43" +HKR, NDIS, MajorNdisVersion, 1, 5 +HKR, NDIS, MinorNdisVersion, 1, 0 +HKR, Ndi\Interfaces, DefUpper, , "ndis5" +HKR, Ndi\Interfaces, UpperRange, , "ndis5" +HKR, Ndi\Interfaces, LowerRange, , "ethernet" +HKR, Ndi\Interfaces, DefLower, , "ethernet" +HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" +HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% +HKR, Ndi\Params\NetworkAddress, type, 0, "edit" +HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" +HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" +HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% +HKR, Ndi\Params\NetworkAddress, optional, 0, "0" +HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% +HKR, Ndi\Params\MaxSpeed, type, 0, "int" +HKR, Ndi\Params\MaxSpeed, default, 0, "100" +HKR, Ndi\Params\MaxSpeed, min, 0, "0" +HKR, Ndi\Params\MaxSpeed, max, 0, "2000" +HKR, Ndi\Params\MaxSpeed, step, 0, "1" +HKR, Ndi\Params\MaxSpeed, Base, 0, "10" +HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% +HKR, Ndi\Params\KeepLink, type, 0, "enum" +HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% +HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% +HKR, Ndi\Params\KeepLink, default, 0, "0" + + +[Neo.Service] +DisplayName = %Neo.Service.DispName% +Description = %Neo.Service.Desc% +ServiceType = 1 +StartType = 3 +ErrorControl = 1 +ServiceBinary = %12%\Neo_VPN43.sys +LoadOrderGroup = NDIS + +[Neo.Reg] +HKR, Ndi, Service, 0, Neo.Service.Name +HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" +HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" + +[Neo.EventLog] +HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN43.sys" +HKR, , TypesSupported, 0x00010001, 7 + +[Strings] +CompanyName = "SoftEther Corporation" +DiskDescription = "VPN Client Device Driver Install Disk" +Neo.Service.Name = "Neo_VPN43" +Neo.Service.DispName = "VPN Client Device Driver - VPN43" +Neo.Service.Desc = "VPN Client Adapter - VPN43" +NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN43" +Neo.EventLog.Name = "Neo" +NetworkAddress = "MAC Address" +DefaultAddress = "000001000001" +MaxSpeed = "Indicate Speed (Mbps)" +KeepLink = "Keep Link" +On = "On" +Off = "Off" + + +; Auto Generated 20180205_163610.763 + diff --git a/src/bin/hamcore/DriverPackages/Neo6_Win8/x64/Neo6_x64_VPN44.inf b/src/bin/hamcore/DriverPackages/Neo6_Win8/x64/Neo6_x64_VPN44.inf index 6f7d7426..f1394c89 100644 --- a/src/bin/hamcore/DriverPackages/Neo6_Win8/x64/Neo6_x64_VPN44.inf +++ b/src/bin/hamcore/DriverPackages/Neo6_Win8/x64/Neo6_x64_VPN44.inf @@ -1,114 +1,114 @@ -; VPN Client Device Driver for Windows 2000 and Greater -; -; Copyright (c) SoftEther Corporation. All Rights Reserved. -; http://www.softether.co.jp/ -; -; BUILD 9658 - -[Version] -Signature = "$Windows NT$" -Class = Net -ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} -Provider = %CompanyName% -DriverVer = 02/04/2018, 4.25.0.9658 -CatalogFile.NT = inf_VPN44.cat - -[Manufacturer] -%CompanyName% = SoftEther, NTamd64 - -[SourceDisksNames] -1=%DiskDescription%, "", , - -[SourceDisksFiles] -Neo_VPN44.sys = 1 - -[DestinationDirs] -DefaultDestDir = 12 -Neo.CopyFiles.Sys = 12 - -[Neo.CopyFiles.Sys] -Neo_VPN44.sys, , , 2 - -[SoftEther.NTamd64] -%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN44 - -[NeoAdapter.Install] -Characteristics = 0x1 -AddReg = Neo.Reg, NeoAdapter.Ndi -CopyFiles = Neo.CopyFiles.Sys -*IfType = 53 -*MediaType = 0 -*PhysicalMediaType = 0 - -[NeoAdapter.Install.Services] -AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% - -[NeoAdapter.Ndi] -HKR, , NetworkAddress, 0, %DefaultAddress% -HKR, Ndi, DeviceID, , "NeoAdapter_VPN44" -HKR, , DevLoader, , ndis -HKR, , DeviceVxDs, , Neo_VPN44.sys -HKR, NDIS, LogDriverName, , "Neo_VPN44" -HKR, NDIS, MajorNdisVersion, 1, 5 -HKR, NDIS, MinorNdisVersion, 1, 0 -HKR, Ndi\Interfaces, DefUpper, , "ndis5" -HKR, Ndi\Interfaces, UpperRange, , "ndis5" -HKR, Ndi\Interfaces, LowerRange, , "ethernet" -HKR, Ndi\Interfaces, DefLower, , "ethernet" -HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" -HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% -HKR, Ndi\Params\NetworkAddress, type, 0, "edit" -HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" -HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" -HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% -HKR, Ndi\Params\NetworkAddress, optional, 0, "0" -HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% -HKR, Ndi\Params\MaxSpeed, type, 0, "int" -HKR, Ndi\Params\MaxSpeed, default, 0, "100" -HKR, Ndi\Params\MaxSpeed, min, 0, "0" -HKR, Ndi\Params\MaxSpeed, max, 0, "2000" -HKR, Ndi\Params\MaxSpeed, step, 0, "1" -HKR, Ndi\Params\MaxSpeed, Base, 0, "10" -HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% -HKR, Ndi\Params\KeepLink, type, 0, "enum" -HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% -HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% -HKR, Ndi\Params\KeepLink, default, 0, "0" - - -[Neo.Service] -DisplayName = %Neo.Service.DispName% -Description = %Neo.Service.Desc% -ServiceType = 1 -StartType = 3 -ErrorControl = 1 -ServiceBinary = %12%\Neo_VPN44.sys -LoadOrderGroup = NDIS - -[Neo.Reg] -HKR, Ndi, Service, 0, Neo.Service.Name -HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" -HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" - -[Neo.EventLog] -HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN44.sys" -HKR, , TypesSupported, 0x00010001, 7 - -[Strings] -CompanyName = "SoftEther Corporation" -DiskDescription = "VPN Client Device Driver Install Disk" -Neo.Service.Name = "Neo_VPN44" -Neo.Service.DispName = "VPN Client Device Driver - VPN44" -Neo.Service.Desc = "VPN Client Adapter - VPN44" -NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN44" -Neo.EventLog.Name = "Neo" -NetworkAddress = "MAC Address" -DefaultAddress = "000001000001" -MaxSpeed = "Indicate Speed (Mbps)" -KeepLink = "Keep Link" -On = "On" -Off = "Off" - - -; Auto Generated 20180205_163610.764 - +; VPN Client Device Driver for Windows 2000 and Greater +; +; Copyright (c) SoftEther Corporation. All Rights Reserved. +; http://www.softether.co.jp/ +; +; BUILD 9658 + +[Version] +Signature = "$Windows NT$" +Class = Net +ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} +Provider = %CompanyName% +DriverVer = 02/04/2018, 4.25.0.9658 +CatalogFile.NT = inf_VPN44.cat + +[Manufacturer] +%CompanyName% = SoftEther, NTamd64 + +[SourceDisksNames] +1=%DiskDescription%, "", , + +[SourceDisksFiles] +Neo_VPN44.sys = 1 + +[DestinationDirs] +DefaultDestDir = 12 +Neo.CopyFiles.Sys = 12 + +[Neo.CopyFiles.Sys] +Neo_VPN44.sys, , , 2 + +[SoftEther.NTamd64] +%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN44 + +[NeoAdapter.Install] +Characteristics = 0x1 +AddReg = Neo.Reg, NeoAdapter.Ndi +CopyFiles = Neo.CopyFiles.Sys +*IfType = 53 +*MediaType = 0 +*PhysicalMediaType = 0 + +[NeoAdapter.Install.Services] +AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% + +[NeoAdapter.Ndi] +HKR, , NetworkAddress, 0, %DefaultAddress% +HKR, Ndi, DeviceID, , "NeoAdapter_VPN44" +HKR, , DevLoader, , ndis +HKR, , DeviceVxDs, , Neo_VPN44.sys +HKR, NDIS, LogDriverName, , "Neo_VPN44" +HKR, NDIS, MajorNdisVersion, 1, 5 +HKR, NDIS, MinorNdisVersion, 1, 0 +HKR, Ndi\Interfaces, DefUpper, , "ndis5" +HKR, Ndi\Interfaces, UpperRange, , "ndis5" +HKR, Ndi\Interfaces, LowerRange, , "ethernet" +HKR, Ndi\Interfaces, DefLower, , "ethernet" +HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" +HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% +HKR, Ndi\Params\NetworkAddress, type, 0, "edit" +HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" +HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" +HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% +HKR, Ndi\Params\NetworkAddress, optional, 0, "0" +HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% +HKR, Ndi\Params\MaxSpeed, type, 0, "int" +HKR, Ndi\Params\MaxSpeed, default, 0, "100" +HKR, Ndi\Params\MaxSpeed, min, 0, "0" +HKR, Ndi\Params\MaxSpeed, max, 0, "2000" +HKR, Ndi\Params\MaxSpeed, step, 0, "1" +HKR, Ndi\Params\MaxSpeed, Base, 0, "10" +HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% +HKR, Ndi\Params\KeepLink, type, 0, "enum" +HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% +HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% +HKR, Ndi\Params\KeepLink, default, 0, "0" + + +[Neo.Service] +DisplayName = %Neo.Service.DispName% +Description = %Neo.Service.Desc% +ServiceType = 1 +StartType = 3 +ErrorControl = 1 +ServiceBinary = %12%\Neo_VPN44.sys +LoadOrderGroup = NDIS + +[Neo.Reg] +HKR, Ndi, Service, 0, Neo.Service.Name +HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" +HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" + +[Neo.EventLog] +HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN44.sys" +HKR, , TypesSupported, 0x00010001, 7 + +[Strings] +CompanyName = "SoftEther Corporation" +DiskDescription = "VPN Client Device Driver Install Disk" +Neo.Service.Name = "Neo_VPN44" +Neo.Service.DispName = "VPN Client Device Driver - VPN44" +Neo.Service.Desc = "VPN Client Adapter - VPN44" +NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN44" +Neo.EventLog.Name = "Neo" +NetworkAddress = "MAC Address" +DefaultAddress = "000001000001" +MaxSpeed = "Indicate Speed (Mbps)" +KeepLink = "Keep Link" +On = "On" +Off = "Off" + + +; Auto Generated 20180205_163610.764 + diff --git a/src/bin/hamcore/DriverPackages/Neo6_Win8/x64/Neo6_x64_VPN45.inf b/src/bin/hamcore/DriverPackages/Neo6_Win8/x64/Neo6_x64_VPN45.inf index 8b0a36bb..8883ced3 100644 --- a/src/bin/hamcore/DriverPackages/Neo6_Win8/x64/Neo6_x64_VPN45.inf +++ b/src/bin/hamcore/DriverPackages/Neo6_Win8/x64/Neo6_x64_VPN45.inf @@ -1,114 +1,114 @@ -; VPN Client Device Driver for Windows 2000 and Greater -; -; Copyright (c) SoftEther Corporation. All Rights Reserved. -; http://www.softether.co.jp/ -; -; BUILD 9658 - -[Version] -Signature = "$Windows NT$" -Class = Net -ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} -Provider = %CompanyName% -DriverVer = 02/04/2018, 4.25.0.9658 -CatalogFile.NT = inf_VPN45.cat - -[Manufacturer] -%CompanyName% = SoftEther, NTamd64 - -[SourceDisksNames] -1=%DiskDescription%, "", , - -[SourceDisksFiles] -Neo_VPN45.sys = 1 - -[DestinationDirs] -DefaultDestDir = 12 -Neo.CopyFiles.Sys = 12 - -[Neo.CopyFiles.Sys] -Neo_VPN45.sys, , , 2 - -[SoftEther.NTamd64] -%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN45 - -[NeoAdapter.Install] -Characteristics = 0x1 -AddReg = Neo.Reg, NeoAdapter.Ndi -CopyFiles = Neo.CopyFiles.Sys -*IfType = 53 -*MediaType = 0 -*PhysicalMediaType = 0 - -[NeoAdapter.Install.Services] -AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% - -[NeoAdapter.Ndi] -HKR, , NetworkAddress, 0, %DefaultAddress% -HKR, Ndi, DeviceID, , "NeoAdapter_VPN45" -HKR, , DevLoader, , ndis -HKR, , DeviceVxDs, , Neo_VPN45.sys -HKR, NDIS, LogDriverName, , "Neo_VPN45" -HKR, NDIS, MajorNdisVersion, 1, 5 -HKR, NDIS, MinorNdisVersion, 1, 0 -HKR, Ndi\Interfaces, DefUpper, , "ndis5" -HKR, Ndi\Interfaces, UpperRange, , "ndis5" -HKR, Ndi\Interfaces, LowerRange, , "ethernet" -HKR, Ndi\Interfaces, DefLower, , "ethernet" -HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" -HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% -HKR, Ndi\Params\NetworkAddress, type, 0, "edit" -HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" -HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" -HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% -HKR, Ndi\Params\NetworkAddress, optional, 0, "0" -HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% -HKR, Ndi\Params\MaxSpeed, type, 0, "int" -HKR, Ndi\Params\MaxSpeed, default, 0, "100" -HKR, Ndi\Params\MaxSpeed, min, 0, "0" -HKR, Ndi\Params\MaxSpeed, max, 0, "2000" -HKR, Ndi\Params\MaxSpeed, step, 0, "1" -HKR, Ndi\Params\MaxSpeed, Base, 0, "10" -HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% -HKR, Ndi\Params\KeepLink, type, 0, "enum" -HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% -HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% -HKR, Ndi\Params\KeepLink, default, 0, "0" - - -[Neo.Service] -DisplayName = %Neo.Service.DispName% -Description = %Neo.Service.Desc% -ServiceType = 1 -StartType = 3 -ErrorControl = 1 -ServiceBinary = %12%\Neo_VPN45.sys -LoadOrderGroup = NDIS - -[Neo.Reg] -HKR, Ndi, Service, 0, Neo.Service.Name -HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" -HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" - -[Neo.EventLog] -HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN45.sys" -HKR, , TypesSupported, 0x00010001, 7 - -[Strings] -CompanyName = "SoftEther Corporation" -DiskDescription = "VPN Client Device Driver Install Disk" -Neo.Service.Name = "Neo_VPN45" -Neo.Service.DispName = "VPN Client Device Driver - VPN45" -Neo.Service.Desc = "VPN Client Adapter - VPN45" -NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN45" -Neo.EventLog.Name = "Neo" -NetworkAddress = "MAC Address" -DefaultAddress = "000001000001" -MaxSpeed = "Indicate Speed (Mbps)" -KeepLink = "Keep Link" -On = "On" -Off = "Off" - - -; Auto Generated 20180205_163610.764 - +; VPN Client Device Driver for Windows 2000 and Greater +; +; Copyright (c) SoftEther Corporation. All Rights Reserved. +; http://www.softether.co.jp/ +; +; BUILD 9658 + +[Version] +Signature = "$Windows NT$" +Class = Net +ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} +Provider = %CompanyName% +DriverVer = 02/04/2018, 4.25.0.9658 +CatalogFile.NT = inf_VPN45.cat + +[Manufacturer] +%CompanyName% = SoftEther, NTamd64 + +[SourceDisksNames] +1=%DiskDescription%, "", , + +[SourceDisksFiles] +Neo_VPN45.sys = 1 + +[DestinationDirs] +DefaultDestDir = 12 +Neo.CopyFiles.Sys = 12 + +[Neo.CopyFiles.Sys] +Neo_VPN45.sys, , , 2 + +[SoftEther.NTamd64] +%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN45 + +[NeoAdapter.Install] +Characteristics = 0x1 +AddReg = Neo.Reg, NeoAdapter.Ndi +CopyFiles = Neo.CopyFiles.Sys +*IfType = 53 +*MediaType = 0 +*PhysicalMediaType = 0 + +[NeoAdapter.Install.Services] +AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% + +[NeoAdapter.Ndi] +HKR, , NetworkAddress, 0, %DefaultAddress% +HKR, Ndi, DeviceID, , "NeoAdapter_VPN45" +HKR, , DevLoader, , ndis +HKR, , DeviceVxDs, , Neo_VPN45.sys +HKR, NDIS, LogDriverName, , "Neo_VPN45" +HKR, NDIS, MajorNdisVersion, 1, 5 +HKR, NDIS, MinorNdisVersion, 1, 0 +HKR, Ndi\Interfaces, DefUpper, , "ndis5" +HKR, Ndi\Interfaces, UpperRange, , "ndis5" +HKR, Ndi\Interfaces, LowerRange, , "ethernet" +HKR, Ndi\Interfaces, DefLower, , "ethernet" +HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" +HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% +HKR, Ndi\Params\NetworkAddress, type, 0, "edit" +HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" +HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" +HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% +HKR, Ndi\Params\NetworkAddress, optional, 0, "0" +HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% +HKR, Ndi\Params\MaxSpeed, type, 0, "int" +HKR, Ndi\Params\MaxSpeed, default, 0, "100" +HKR, Ndi\Params\MaxSpeed, min, 0, "0" +HKR, Ndi\Params\MaxSpeed, max, 0, "2000" +HKR, Ndi\Params\MaxSpeed, step, 0, "1" +HKR, Ndi\Params\MaxSpeed, Base, 0, "10" +HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% +HKR, Ndi\Params\KeepLink, type, 0, "enum" +HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% +HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% +HKR, Ndi\Params\KeepLink, default, 0, "0" + + +[Neo.Service] +DisplayName = %Neo.Service.DispName% +Description = %Neo.Service.Desc% +ServiceType = 1 +StartType = 3 +ErrorControl = 1 +ServiceBinary = %12%\Neo_VPN45.sys +LoadOrderGroup = NDIS + +[Neo.Reg] +HKR, Ndi, Service, 0, Neo.Service.Name +HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" +HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" + +[Neo.EventLog] +HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN45.sys" +HKR, , TypesSupported, 0x00010001, 7 + +[Strings] +CompanyName = "SoftEther Corporation" +DiskDescription = "VPN Client Device Driver Install Disk" +Neo.Service.Name = "Neo_VPN45" +Neo.Service.DispName = "VPN Client Device Driver - VPN45" +Neo.Service.Desc = "VPN Client Adapter - VPN45" +NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN45" +Neo.EventLog.Name = "Neo" +NetworkAddress = "MAC Address" +DefaultAddress = "000001000001" +MaxSpeed = "Indicate Speed (Mbps)" +KeepLink = "Keep Link" +On = "On" +Off = "Off" + + +; Auto Generated 20180205_163610.764 + diff --git a/src/bin/hamcore/DriverPackages/Neo6_Win8/x64/Neo6_x64_VPN46.inf b/src/bin/hamcore/DriverPackages/Neo6_Win8/x64/Neo6_x64_VPN46.inf index 2f634c9e..bf8a16cf 100644 --- a/src/bin/hamcore/DriverPackages/Neo6_Win8/x64/Neo6_x64_VPN46.inf +++ b/src/bin/hamcore/DriverPackages/Neo6_Win8/x64/Neo6_x64_VPN46.inf @@ -1,114 +1,114 @@ -; VPN Client Device Driver for Windows 2000 and Greater -; -; Copyright (c) SoftEther Corporation. All Rights Reserved. -; http://www.softether.co.jp/ -; -; BUILD 9658 - -[Version] -Signature = "$Windows NT$" -Class = Net -ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} -Provider = %CompanyName% -DriverVer = 02/04/2018, 4.25.0.9658 -CatalogFile.NT = inf_VPN46.cat - -[Manufacturer] -%CompanyName% = SoftEther, NTamd64 - -[SourceDisksNames] -1=%DiskDescription%, "", , - -[SourceDisksFiles] -Neo_VPN46.sys = 1 - -[DestinationDirs] -DefaultDestDir = 12 -Neo.CopyFiles.Sys = 12 - -[Neo.CopyFiles.Sys] -Neo_VPN46.sys, , , 2 - -[SoftEther.NTamd64] -%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN46 - -[NeoAdapter.Install] -Characteristics = 0x1 -AddReg = Neo.Reg, NeoAdapter.Ndi -CopyFiles = Neo.CopyFiles.Sys -*IfType = 53 -*MediaType = 0 -*PhysicalMediaType = 0 - -[NeoAdapter.Install.Services] -AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% - -[NeoAdapter.Ndi] -HKR, , NetworkAddress, 0, %DefaultAddress% -HKR, Ndi, DeviceID, , "NeoAdapter_VPN46" -HKR, , DevLoader, , ndis -HKR, , DeviceVxDs, , Neo_VPN46.sys -HKR, NDIS, LogDriverName, , "Neo_VPN46" -HKR, NDIS, MajorNdisVersion, 1, 5 -HKR, NDIS, MinorNdisVersion, 1, 0 -HKR, Ndi\Interfaces, DefUpper, , "ndis5" -HKR, Ndi\Interfaces, UpperRange, , "ndis5" -HKR, Ndi\Interfaces, LowerRange, , "ethernet" -HKR, Ndi\Interfaces, DefLower, , "ethernet" -HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" -HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% -HKR, Ndi\Params\NetworkAddress, type, 0, "edit" -HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" -HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" -HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% -HKR, Ndi\Params\NetworkAddress, optional, 0, "0" -HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% -HKR, Ndi\Params\MaxSpeed, type, 0, "int" -HKR, Ndi\Params\MaxSpeed, default, 0, "100" -HKR, Ndi\Params\MaxSpeed, min, 0, "0" -HKR, Ndi\Params\MaxSpeed, max, 0, "2000" -HKR, Ndi\Params\MaxSpeed, step, 0, "1" -HKR, Ndi\Params\MaxSpeed, Base, 0, "10" -HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% -HKR, Ndi\Params\KeepLink, type, 0, "enum" -HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% -HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% -HKR, Ndi\Params\KeepLink, default, 0, "0" - - -[Neo.Service] -DisplayName = %Neo.Service.DispName% -Description = %Neo.Service.Desc% -ServiceType = 1 -StartType = 3 -ErrorControl = 1 -ServiceBinary = %12%\Neo_VPN46.sys -LoadOrderGroup = NDIS - -[Neo.Reg] -HKR, Ndi, Service, 0, Neo.Service.Name -HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" -HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" - -[Neo.EventLog] -HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN46.sys" -HKR, , TypesSupported, 0x00010001, 7 - -[Strings] -CompanyName = "SoftEther Corporation" -DiskDescription = "VPN Client Device Driver Install Disk" -Neo.Service.Name = "Neo_VPN46" -Neo.Service.DispName = "VPN Client Device Driver - VPN46" -Neo.Service.Desc = "VPN Client Adapter - VPN46" -NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN46" -Neo.EventLog.Name = "Neo" -NetworkAddress = "MAC Address" -DefaultAddress = "000001000001" -MaxSpeed = "Indicate Speed (Mbps)" -KeepLink = "Keep Link" -On = "On" -Off = "Off" - - -; Auto Generated 20180205_163610.765 - +; VPN Client Device Driver for Windows 2000 and Greater +; +; Copyright (c) SoftEther Corporation. All Rights Reserved. +; http://www.softether.co.jp/ +; +; BUILD 9658 + +[Version] +Signature = "$Windows NT$" +Class = Net +ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} +Provider = %CompanyName% +DriverVer = 02/04/2018, 4.25.0.9658 +CatalogFile.NT = inf_VPN46.cat + +[Manufacturer] +%CompanyName% = SoftEther, NTamd64 + +[SourceDisksNames] +1=%DiskDescription%, "", , + +[SourceDisksFiles] +Neo_VPN46.sys = 1 + +[DestinationDirs] +DefaultDestDir = 12 +Neo.CopyFiles.Sys = 12 + +[Neo.CopyFiles.Sys] +Neo_VPN46.sys, , , 2 + +[SoftEther.NTamd64] +%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN46 + +[NeoAdapter.Install] +Characteristics = 0x1 +AddReg = Neo.Reg, NeoAdapter.Ndi +CopyFiles = Neo.CopyFiles.Sys +*IfType = 53 +*MediaType = 0 +*PhysicalMediaType = 0 + +[NeoAdapter.Install.Services] +AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% + +[NeoAdapter.Ndi] +HKR, , NetworkAddress, 0, %DefaultAddress% +HKR, Ndi, DeviceID, , "NeoAdapter_VPN46" +HKR, , DevLoader, , ndis +HKR, , DeviceVxDs, , Neo_VPN46.sys +HKR, NDIS, LogDriverName, , "Neo_VPN46" +HKR, NDIS, MajorNdisVersion, 1, 5 +HKR, NDIS, MinorNdisVersion, 1, 0 +HKR, Ndi\Interfaces, DefUpper, , "ndis5" +HKR, Ndi\Interfaces, UpperRange, , "ndis5" +HKR, Ndi\Interfaces, LowerRange, , "ethernet" +HKR, Ndi\Interfaces, DefLower, , "ethernet" +HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" +HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% +HKR, Ndi\Params\NetworkAddress, type, 0, "edit" +HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" +HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" +HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% +HKR, Ndi\Params\NetworkAddress, optional, 0, "0" +HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% +HKR, Ndi\Params\MaxSpeed, type, 0, "int" +HKR, Ndi\Params\MaxSpeed, default, 0, "100" +HKR, Ndi\Params\MaxSpeed, min, 0, "0" +HKR, Ndi\Params\MaxSpeed, max, 0, "2000" +HKR, Ndi\Params\MaxSpeed, step, 0, "1" +HKR, Ndi\Params\MaxSpeed, Base, 0, "10" +HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% +HKR, Ndi\Params\KeepLink, type, 0, "enum" +HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% +HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% +HKR, Ndi\Params\KeepLink, default, 0, "0" + + +[Neo.Service] +DisplayName = %Neo.Service.DispName% +Description = %Neo.Service.Desc% +ServiceType = 1 +StartType = 3 +ErrorControl = 1 +ServiceBinary = %12%\Neo_VPN46.sys +LoadOrderGroup = NDIS + +[Neo.Reg] +HKR, Ndi, Service, 0, Neo.Service.Name +HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" +HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" + +[Neo.EventLog] +HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN46.sys" +HKR, , TypesSupported, 0x00010001, 7 + +[Strings] +CompanyName = "SoftEther Corporation" +DiskDescription = "VPN Client Device Driver Install Disk" +Neo.Service.Name = "Neo_VPN46" +Neo.Service.DispName = "VPN Client Device Driver - VPN46" +Neo.Service.Desc = "VPN Client Adapter - VPN46" +NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN46" +Neo.EventLog.Name = "Neo" +NetworkAddress = "MAC Address" +DefaultAddress = "000001000001" +MaxSpeed = "Indicate Speed (Mbps)" +KeepLink = "Keep Link" +On = "On" +Off = "Off" + + +; Auto Generated 20180205_163610.765 + diff --git a/src/bin/hamcore/DriverPackages/Neo6_Win8/x64/Neo6_x64_VPN47.inf b/src/bin/hamcore/DriverPackages/Neo6_Win8/x64/Neo6_x64_VPN47.inf index c04ba290..7ab1d001 100644 --- a/src/bin/hamcore/DriverPackages/Neo6_Win8/x64/Neo6_x64_VPN47.inf +++ b/src/bin/hamcore/DriverPackages/Neo6_Win8/x64/Neo6_x64_VPN47.inf @@ -1,114 +1,114 @@ -; VPN Client Device Driver for Windows 2000 and Greater -; -; Copyright (c) SoftEther Corporation. All Rights Reserved. -; http://www.softether.co.jp/ -; -; BUILD 9658 - -[Version] -Signature = "$Windows NT$" -Class = Net -ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} -Provider = %CompanyName% -DriverVer = 02/04/2018, 4.25.0.9658 -CatalogFile.NT = inf_VPN47.cat - -[Manufacturer] -%CompanyName% = SoftEther, NTamd64 - -[SourceDisksNames] -1=%DiskDescription%, "", , - -[SourceDisksFiles] -Neo_VPN47.sys = 1 - -[DestinationDirs] -DefaultDestDir = 12 -Neo.CopyFiles.Sys = 12 - -[Neo.CopyFiles.Sys] -Neo_VPN47.sys, , , 2 - -[SoftEther.NTamd64] -%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN47 - -[NeoAdapter.Install] -Characteristics = 0x1 -AddReg = Neo.Reg, NeoAdapter.Ndi -CopyFiles = Neo.CopyFiles.Sys -*IfType = 53 -*MediaType = 0 -*PhysicalMediaType = 0 - -[NeoAdapter.Install.Services] -AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% - -[NeoAdapter.Ndi] -HKR, , NetworkAddress, 0, %DefaultAddress% -HKR, Ndi, DeviceID, , "NeoAdapter_VPN47" -HKR, , DevLoader, , ndis -HKR, , DeviceVxDs, , Neo_VPN47.sys -HKR, NDIS, LogDriverName, , "Neo_VPN47" -HKR, NDIS, MajorNdisVersion, 1, 5 -HKR, NDIS, MinorNdisVersion, 1, 0 -HKR, Ndi\Interfaces, DefUpper, , "ndis5" -HKR, Ndi\Interfaces, UpperRange, , "ndis5" -HKR, Ndi\Interfaces, LowerRange, , "ethernet" -HKR, Ndi\Interfaces, DefLower, , "ethernet" -HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" -HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% -HKR, Ndi\Params\NetworkAddress, type, 0, "edit" -HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" -HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" -HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% -HKR, Ndi\Params\NetworkAddress, optional, 0, "0" -HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% -HKR, Ndi\Params\MaxSpeed, type, 0, "int" -HKR, Ndi\Params\MaxSpeed, default, 0, "100" -HKR, Ndi\Params\MaxSpeed, min, 0, "0" -HKR, Ndi\Params\MaxSpeed, max, 0, "2000" -HKR, Ndi\Params\MaxSpeed, step, 0, "1" -HKR, Ndi\Params\MaxSpeed, Base, 0, "10" -HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% -HKR, Ndi\Params\KeepLink, type, 0, "enum" -HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% -HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% -HKR, Ndi\Params\KeepLink, default, 0, "0" - - -[Neo.Service] -DisplayName = %Neo.Service.DispName% -Description = %Neo.Service.Desc% -ServiceType = 1 -StartType = 3 -ErrorControl = 1 -ServiceBinary = %12%\Neo_VPN47.sys -LoadOrderGroup = NDIS - -[Neo.Reg] -HKR, Ndi, Service, 0, Neo.Service.Name -HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" -HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" - -[Neo.EventLog] -HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN47.sys" -HKR, , TypesSupported, 0x00010001, 7 - -[Strings] -CompanyName = "SoftEther Corporation" -DiskDescription = "VPN Client Device Driver Install Disk" -Neo.Service.Name = "Neo_VPN47" -Neo.Service.DispName = "VPN Client Device Driver - VPN47" -Neo.Service.Desc = "VPN Client Adapter - VPN47" -NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN47" -Neo.EventLog.Name = "Neo" -NetworkAddress = "MAC Address" -DefaultAddress = "000001000001" -MaxSpeed = "Indicate Speed (Mbps)" -KeepLink = "Keep Link" -On = "On" -Off = "Off" - - -; Auto Generated 20180205_163610.765 - +; VPN Client Device Driver for Windows 2000 and Greater +; +; Copyright (c) SoftEther Corporation. All Rights Reserved. +; http://www.softether.co.jp/ +; +; BUILD 9658 + +[Version] +Signature = "$Windows NT$" +Class = Net +ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} +Provider = %CompanyName% +DriverVer = 02/04/2018, 4.25.0.9658 +CatalogFile.NT = inf_VPN47.cat + +[Manufacturer] +%CompanyName% = SoftEther, NTamd64 + +[SourceDisksNames] +1=%DiskDescription%, "", , + +[SourceDisksFiles] +Neo_VPN47.sys = 1 + +[DestinationDirs] +DefaultDestDir = 12 +Neo.CopyFiles.Sys = 12 + +[Neo.CopyFiles.Sys] +Neo_VPN47.sys, , , 2 + +[SoftEther.NTamd64] +%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN47 + +[NeoAdapter.Install] +Characteristics = 0x1 +AddReg = Neo.Reg, NeoAdapter.Ndi +CopyFiles = Neo.CopyFiles.Sys +*IfType = 53 +*MediaType = 0 +*PhysicalMediaType = 0 + +[NeoAdapter.Install.Services] +AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% + +[NeoAdapter.Ndi] +HKR, , NetworkAddress, 0, %DefaultAddress% +HKR, Ndi, DeviceID, , "NeoAdapter_VPN47" +HKR, , DevLoader, , ndis +HKR, , DeviceVxDs, , Neo_VPN47.sys +HKR, NDIS, LogDriverName, , "Neo_VPN47" +HKR, NDIS, MajorNdisVersion, 1, 5 +HKR, NDIS, MinorNdisVersion, 1, 0 +HKR, Ndi\Interfaces, DefUpper, , "ndis5" +HKR, Ndi\Interfaces, UpperRange, , "ndis5" +HKR, Ndi\Interfaces, LowerRange, , "ethernet" +HKR, Ndi\Interfaces, DefLower, , "ethernet" +HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" +HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% +HKR, Ndi\Params\NetworkAddress, type, 0, "edit" +HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" +HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" +HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% +HKR, Ndi\Params\NetworkAddress, optional, 0, "0" +HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% +HKR, Ndi\Params\MaxSpeed, type, 0, "int" +HKR, Ndi\Params\MaxSpeed, default, 0, "100" +HKR, Ndi\Params\MaxSpeed, min, 0, "0" +HKR, Ndi\Params\MaxSpeed, max, 0, "2000" +HKR, Ndi\Params\MaxSpeed, step, 0, "1" +HKR, Ndi\Params\MaxSpeed, Base, 0, "10" +HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% +HKR, Ndi\Params\KeepLink, type, 0, "enum" +HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% +HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% +HKR, Ndi\Params\KeepLink, default, 0, "0" + + +[Neo.Service] +DisplayName = %Neo.Service.DispName% +Description = %Neo.Service.Desc% +ServiceType = 1 +StartType = 3 +ErrorControl = 1 +ServiceBinary = %12%\Neo_VPN47.sys +LoadOrderGroup = NDIS + +[Neo.Reg] +HKR, Ndi, Service, 0, Neo.Service.Name +HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" +HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" + +[Neo.EventLog] +HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN47.sys" +HKR, , TypesSupported, 0x00010001, 7 + +[Strings] +CompanyName = "SoftEther Corporation" +DiskDescription = "VPN Client Device Driver Install Disk" +Neo.Service.Name = "Neo_VPN47" +Neo.Service.DispName = "VPN Client Device Driver - VPN47" +Neo.Service.Desc = "VPN Client Adapter - VPN47" +NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN47" +Neo.EventLog.Name = "Neo" +NetworkAddress = "MAC Address" +DefaultAddress = "000001000001" +MaxSpeed = "Indicate Speed (Mbps)" +KeepLink = "Keep Link" +On = "On" +Off = "Off" + + +; Auto Generated 20180205_163610.765 + diff --git a/src/bin/hamcore/DriverPackages/Neo6_Win8/x64/Neo6_x64_VPN48.inf b/src/bin/hamcore/DriverPackages/Neo6_Win8/x64/Neo6_x64_VPN48.inf index 61b4acb7..643996dd 100644 --- a/src/bin/hamcore/DriverPackages/Neo6_Win8/x64/Neo6_x64_VPN48.inf +++ b/src/bin/hamcore/DriverPackages/Neo6_Win8/x64/Neo6_x64_VPN48.inf @@ -1,114 +1,114 @@ -; VPN Client Device Driver for Windows 2000 and Greater -; -; Copyright (c) SoftEther Corporation. All Rights Reserved. -; http://www.softether.co.jp/ -; -; BUILD 9658 - -[Version] -Signature = "$Windows NT$" -Class = Net -ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} -Provider = %CompanyName% -DriverVer = 02/04/2018, 4.25.0.9658 -CatalogFile.NT = inf_VPN48.cat - -[Manufacturer] -%CompanyName% = SoftEther, NTamd64 - -[SourceDisksNames] -1=%DiskDescription%, "", , - -[SourceDisksFiles] -Neo_VPN48.sys = 1 - -[DestinationDirs] -DefaultDestDir = 12 -Neo.CopyFiles.Sys = 12 - -[Neo.CopyFiles.Sys] -Neo_VPN48.sys, , , 2 - -[SoftEther.NTamd64] -%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN48 - -[NeoAdapter.Install] -Characteristics = 0x1 -AddReg = Neo.Reg, NeoAdapter.Ndi -CopyFiles = Neo.CopyFiles.Sys -*IfType = 53 -*MediaType = 0 -*PhysicalMediaType = 0 - -[NeoAdapter.Install.Services] -AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% - -[NeoAdapter.Ndi] -HKR, , NetworkAddress, 0, %DefaultAddress% -HKR, Ndi, DeviceID, , "NeoAdapter_VPN48" -HKR, , DevLoader, , ndis -HKR, , DeviceVxDs, , Neo_VPN48.sys -HKR, NDIS, LogDriverName, , "Neo_VPN48" -HKR, NDIS, MajorNdisVersion, 1, 5 -HKR, NDIS, MinorNdisVersion, 1, 0 -HKR, Ndi\Interfaces, DefUpper, , "ndis5" -HKR, Ndi\Interfaces, UpperRange, , "ndis5" -HKR, Ndi\Interfaces, LowerRange, , "ethernet" -HKR, Ndi\Interfaces, DefLower, , "ethernet" -HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" -HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% -HKR, Ndi\Params\NetworkAddress, type, 0, "edit" -HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" -HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" -HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% -HKR, Ndi\Params\NetworkAddress, optional, 0, "0" -HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% -HKR, Ndi\Params\MaxSpeed, type, 0, "int" -HKR, Ndi\Params\MaxSpeed, default, 0, "100" -HKR, Ndi\Params\MaxSpeed, min, 0, "0" -HKR, Ndi\Params\MaxSpeed, max, 0, "2000" -HKR, Ndi\Params\MaxSpeed, step, 0, "1" -HKR, Ndi\Params\MaxSpeed, Base, 0, "10" -HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% -HKR, Ndi\Params\KeepLink, type, 0, "enum" -HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% -HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% -HKR, Ndi\Params\KeepLink, default, 0, "0" - - -[Neo.Service] -DisplayName = %Neo.Service.DispName% -Description = %Neo.Service.Desc% -ServiceType = 1 -StartType = 3 -ErrorControl = 1 -ServiceBinary = %12%\Neo_VPN48.sys -LoadOrderGroup = NDIS - -[Neo.Reg] -HKR, Ndi, Service, 0, Neo.Service.Name -HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" -HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" - -[Neo.EventLog] -HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN48.sys" -HKR, , TypesSupported, 0x00010001, 7 - -[Strings] -CompanyName = "SoftEther Corporation" -DiskDescription = "VPN Client Device Driver Install Disk" -Neo.Service.Name = "Neo_VPN48" -Neo.Service.DispName = "VPN Client Device Driver - VPN48" -Neo.Service.Desc = "VPN Client Adapter - VPN48" -NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN48" -Neo.EventLog.Name = "Neo" -NetworkAddress = "MAC Address" -DefaultAddress = "000001000001" -MaxSpeed = "Indicate Speed (Mbps)" -KeepLink = "Keep Link" -On = "On" -Off = "Off" - - -; Auto Generated 20180205_163610.766 - +; VPN Client Device Driver for Windows 2000 and Greater +; +; Copyright (c) SoftEther Corporation. All Rights Reserved. +; http://www.softether.co.jp/ +; +; BUILD 9658 + +[Version] +Signature = "$Windows NT$" +Class = Net +ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} +Provider = %CompanyName% +DriverVer = 02/04/2018, 4.25.0.9658 +CatalogFile.NT = inf_VPN48.cat + +[Manufacturer] +%CompanyName% = SoftEther, NTamd64 + +[SourceDisksNames] +1=%DiskDescription%, "", , + +[SourceDisksFiles] +Neo_VPN48.sys = 1 + +[DestinationDirs] +DefaultDestDir = 12 +Neo.CopyFiles.Sys = 12 + +[Neo.CopyFiles.Sys] +Neo_VPN48.sys, , , 2 + +[SoftEther.NTamd64] +%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN48 + +[NeoAdapter.Install] +Characteristics = 0x1 +AddReg = Neo.Reg, NeoAdapter.Ndi +CopyFiles = Neo.CopyFiles.Sys +*IfType = 53 +*MediaType = 0 +*PhysicalMediaType = 0 + +[NeoAdapter.Install.Services] +AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% + +[NeoAdapter.Ndi] +HKR, , NetworkAddress, 0, %DefaultAddress% +HKR, Ndi, DeviceID, , "NeoAdapter_VPN48" +HKR, , DevLoader, , ndis +HKR, , DeviceVxDs, , Neo_VPN48.sys +HKR, NDIS, LogDriverName, , "Neo_VPN48" +HKR, NDIS, MajorNdisVersion, 1, 5 +HKR, NDIS, MinorNdisVersion, 1, 0 +HKR, Ndi\Interfaces, DefUpper, , "ndis5" +HKR, Ndi\Interfaces, UpperRange, , "ndis5" +HKR, Ndi\Interfaces, LowerRange, , "ethernet" +HKR, Ndi\Interfaces, DefLower, , "ethernet" +HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" +HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% +HKR, Ndi\Params\NetworkAddress, type, 0, "edit" +HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" +HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" +HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% +HKR, Ndi\Params\NetworkAddress, optional, 0, "0" +HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% +HKR, Ndi\Params\MaxSpeed, type, 0, "int" +HKR, Ndi\Params\MaxSpeed, default, 0, "100" +HKR, Ndi\Params\MaxSpeed, min, 0, "0" +HKR, Ndi\Params\MaxSpeed, max, 0, "2000" +HKR, Ndi\Params\MaxSpeed, step, 0, "1" +HKR, Ndi\Params\MaxSpeed, Base, 0, "10" +HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% +HKR, Ndi\Params\KeepLink, type, 0, "enum" +HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% +HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% +HKR, Ndi\Params\KeepLink, default, 0, "0" + + +[Neo.Service] +DisplayName = %Neo.Service.DispName% +Description = %Neo.Service.Desc% +ServiceType = 1 +StartType = 3 +ErrorControl = 1 +ServiceBinary = %12%\Neo_VPN48.sys +LoadOrderGroup = NDIS + +[Neo.Reg] +HKR, Ndi, Service, 0, Neo.Service.Name +HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" +HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" + +[Neo.EventLog] +HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN48.sys" +HKR, , TypesSupported, 0x00010001, 7 + +[Strings] +CompanyName = "SoftEther Corporation" +DiskDescription = "VPN Client Device Driver Install Disk" +Neo.Service.Name = "Neo_VPN48" +Neo.Service.DispName = "VPN Client Device Driver - VPN48" +Neo.Service.Desc = "VPN Client Adapter - VPN48" +NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN48" +Neo.EventLog.Name = "Neo" +NetworkAddress = "MAC Address" +DefaultAddress = "000001000001" +MaxSpeed = "Indicate Speed (Mbps)" +KeepLink = "Keep Link" +On = "On" +Off = "Off" + + +; Auto Generated 20180205_163610.766 + diff --git a/src/bin/hamcore/DriverPackages/Neo6_Win8/x64/Neo6_x64_VPN49.inf b/src/bin/hamcore/DriverPackages/Neo6_Win8/x64/Neo6_x64_VPN49.inf index 8e6bc6e4..de45f7ce 100644 --- a/src/bin/hamcore/DriverPackages/Neo6_Win8/x64/Neo6_x64_VPN49.inf +++ b/src/bin/hamcore/DriverPackages/Neo6_Win8/x64/Neo6_x64_VPN49.inf @@ -1,114 +1,114 @@ -; VPN Client Device Driver for Windows 2000 and Greater -; -; Copyright (c) SoftEther Corporation. All Rights Reserved. -; http://www.softether.co.jp/ -; -; BUILD 9658 - -[Version] -Signature = "$Windows NT$" -Class = Net -ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} -Provider = %CompanyName% -DriverVer = 02/04/2018, 4.25.0.9658 -CatalogFile.NT = inf_VPN49.cat - -[Manufacturer] -%CompanyName% = SoftEther, NTamd64 - -[SourceDisksNames] -1=%DiskDescription%, "", , - -[SourceDisksFiles] -Neo_VPN49.sys = 1 - -[DestinationDirs] -DefaultDestDir = 12 -Neo.CopyFiles.Sys = 12 - -[Neo.CopyFiles.Sys] -Neo_VPN49.sys, , , 2 - -[SoftEther.NTamd64] -%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN49 - -[NeoAdapter.Install] -Characteristics = 0x1 -AddReg = Neo.Reg, NeoAdapter.Ndi -CopyFiles = Neo.CopyFiles.Sys -*IfType = 53 -*MediaType = 0 -*PhysicalMediaType = 0 - -[NeoAdapter.Install.Services] -AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% - -[NeoAdapter.Ndi] -HKR, , NetworkAddress, 0, %DefaultAddress% -HKR, Ndi, DeviceID, , "NeoAdapter_VPN49" -HKR, , DevLoader, , ndis -HKR, , DeviceVxDs, , Neo_VPN49.sys -HKR, NDIS, LogDriverName, , "Neo_VPN49" -HKR, NDIS, MajorNdisVersion, 1, 5 -HKR, NDIS, MinorNdisVersion, 1, 0 -HKR, Ndi\Interfaces, DefUpper, , "ndis5" -HKR, Ndi\Interfaces, UpperRange, , "ndis5" -HKR, Ndi\Interfaces, LowerRange, , "ethernet" -HKR, Ndi\Interfaces, DefLower, , "ethernet" -HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" -HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% -HKR, Ndi\Params\NetworkAddress, type, 0, "edit" -HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" -HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" -HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% -HKR, Ndi\Params\NetworkAddress, optional, 0, "0" -HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% -HKR, Ndi\Params\MaxSpeed, type, 0, "int" -HKR, Ndi\Params\MaxSpeed, default, 0, "100" -HKR, Ndi\Params\MaxSpeed, min, 0, "0" -HKR, Ndi\Params\MaxSpeed, max, 0, "2000" -HKR, Ndi\Params\MaxSpeed, step, 0, "1" -HKR, Ndi\Params\MaxSpeed, Base, 0, "10" -HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% -HKR, Ndi\Params\KeepLink, type, 0, "enum" -HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% -HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% -HKR, Ndi\Params\KeepLink, default, 0, "0" - - -[Neo.Service] -DisplayName = %Neo.Service.DispName% -Description = %Neo.Service.Desc% -ServiceType = 1 -StartType = 3 -ErrorControl = 1 -ServiceBinary = %12%\Neo_VPN49.sys -LoadOrderGroup = NDIS - -[Neo.Reg] -HKR, Ndi, Service, 0, Neo.Service.Name -HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" -HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" - -[Neo.EventLog] -HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN49.sys" -HKR, , TypesSupported, 0x00010001, 7 - -[Strings] -CompanyName = "SoftEther Corporation" -DiskDescription = "VPN Client Device Driver Install Disk" -Neo.Service.Name = "Neo_VPN49" -Neo.Service.DispName = "VPN Client Device Driver - VPN49" -Neo.Service.Desc = "VPN Client Adapter - VPN49" -NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN49" -Neo.EventLog.Name = "Neo" -NetworkAddress = "MAC Address" -DefaultAddress = "000001000001" -MaxSpeed = "Indicate Speed (Mbps)" -KeepLink = "Keep Link" -On = "On" -Off = "Off" - - -; Auto Generated 20180205_163610.767 - +; VPN Client Device Driver for Windows 2000 and Greater +; +; Copyright (c) SoftEther Corporation. All Rights Reserved. +; http://www.softether.co.jp/ +; +; BUILD 9658 + +[Version] +Signature = "$Windows NT$" +Class = Net +ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} +Provider = %CompanyName% +DriverVer = 02/04/2018, 4.25.0.9658 +CatalogFile.NT = inf_VPN49.cat + +[Manufacturer] +%CompanyName% = SoftEther, NTamd64 + +[SourceDisksNames] +1=%DiskDescription%, "", , + +[SourceDisksFiles] +Neo_VPN49.sys = 1 + +[DestinationDirs] +DefaultDestDir = 12 +Neo.CopyFiles.Sys = 12 + +[Neo.CopyFiles.Sys] +Neo_VPN49.sys, , , 2 + +[SoftEther.NTamd64] +%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN49 + +[NeoAdapter.Install] +Characteristics = 0x1 +AddReg = Neo.Reg, NeoAdapter.Ndi +CopyFiles = Neo.CopyFiles.Sys +*IfType = 53 +*MediaType = 0 +*PhysicalMediaType = 0 + +[NeoAdapter.Install.Services] +AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% + +[NeoAdapter.Ndi] +HKR, , NetworkAddress, 0, %DefaultAddress% +HKR, Ndi, DeviceID, , "NeoAdapter_VPN49" +HKR, , DevLoader, , ndis +HKR, , DeviceVxDs, , Neo_VPN49.sys +HKR, NDIS, LogDriverName, , "Neo_VPN49" +HKR, NDIS, MajorNdisVersion, 1, 5 +HKR, NDIS, MinorNdisVersion, 1, 0 +HKR, Ndi\Interfaces, DefUpper, , "ndis5" +HKR, Ndi\Interfaces, UpperRange, , "ndis5" +HKR, Ndi\Interfaces, LowerRange, , "ethernet" +HKR, Ndi\Interfaces, DefLower, , "ethernet" +HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" +HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% +HKR, Ndi\Params\NetworkAddress, type, 0, "edit" +HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" +HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" +HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% +HKR, Ndi\Params\NetworkAddress, optional, 0, "0" +HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% +HKR, Ndi\Params\MaxSpeed, type, 0, "int" +HKR, Ndi\Params\MaxSpeed, default, 0, "100" +HKR, Ndi\Params\MaxSpeed, min, 0, "0" +HKR, Ndi\Params\MaxSpeed, max, 0, "2000" +HKR, Ndi\Params\MaxSpeed, step, 0, "1" +HKR, Ndi\Params\MaxSpeed, Base, 0, "10" +HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% +HKR, Ndi\Params\KeepLink, type, 0, "enum" +HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% +HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% +HKR, Ndi\Params\KeepLink, default, 0, "0" + + +[Neo.Service] +DisplayName = %Neo.Service.DispName% +Description = %Neo.Service.Desc% +ServiceType = 1 +StartType = 3 +ErrorControl = 1 +ServiceBinary = %12%\Neo_VPN49.sys +LoadOrderGroup = NDIS + +[Neo.Reg] +HKR, Ndi, Service, 0, Neo.Service.Name +HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" +HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" + +[Neo.EventLog] +HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN49.sys" +HKR, , TypesSupported, 0x00010001, 7 + +[Strings] +CompanyName = "SoftEther Corporation" +DiskDescription = "VPN Client Device Driver Install Disk" +Neo.Service.Name = "Neo_VPN49" +Neo.Service.DispName = "VPN Client Device Driver - VPN49" +Neo.Service.Desc = "VPN Client Adapter - VPN49" +NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN49" +Neo.EventLog.Name = "Neo" +NetworkAddress = "MAC Address" +DefaultAddress = "000001000001" +MaxSpeed = "Indicate Speed (Mbps)" +KeepLink = "Keep Link" +On = "On" +Off = "Off" + + +; Auto Generated 20180205_163610.767 + diff --git a/src/bin/hamcore/DriverPackages/Neo6_Win8/x64/Neo6_x64_VPN5.inf b/src/bin/hamcore/DriverPackages/Neo6_Win8/x64/Neo6_x64_VPN5.inf index bc938a81..98dd5021 100644 --- a/src/bin/hamcore/DriverPackages/Neo6_Win8/x64/Neo6_x64_VPN5.inf +++ b/src/bin/hamcore/DriverPackages/Neo6_Win8/x64/Neo6_x64_VPN5.inf @@ -1,114 +1,114 @@ -; VPN Client Device Driver for Windows 2000 and Greater -; -; Copyright (c) SoftEther Corporation. All Rights Reserved. -; http://www.softether.co.jp/ -; -; BUILD 9658 - -[Version] -Signature = "$Windows NT$" -Class = Net -ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} -Provider = %CompanyName% -DriverVer = 02/04/2018, 4.25.0.9658 -CatalogFile.NT = inf_VPN5.cat - -[Manufacturer] -%CompanyName% = SoftEther, NTamd64 - -[SourceDisksNames] -1=%DiskDescription%, "", , - -[SourceDisksFiles] -Neo_VPN5.sys = 1 - -[DestinationDirs] -DefaultDestDir = 12 -Neo.CopyFiles.Sys = 12 - -[Neo.CopyFiles.Sys] -Neo_VPN5.sys, , , 2 - -[SoftEther.NTamd64] -%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN5 - -[NeoAdapter.Install] -Characteristics = 0x1 -AddReg = Neo.Reg, NeoAdapter.Ndi -CopyFiles = Neo.CopyFiles.Sys -*IfType = 53 -*MediaType = 0 -*PhysicalMediaType = 0 - -[NeoAdapter.Install.Services] -AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% - -[NeoAdapter.Ndi] -HKR, , NetworkAddress, 0, %DefaultAddress% -HKR, Ndi, DeviceID, , "NeoAdapter_VPN5" -HKR, , DevLoader, , ndis -HKR, , DeviceVxDs, , Neo_VPN5.sys -HKR, NDIS, LogDriverName, , "Neo_VPN5" -HKR, NDIS, MajorNdisVersion, 1, 5 -HKR, NDIS, MinorNdisVersion, 1, 0 -HKR, Ndi\Interfaces, DefUpper, , "ndis5" -HKR, Ndi\Interfaces, UpperRange, , "ndis5" -HKR, Ndi\Interfaces, LowerRange, , "ethernet" -HKR, Ndi\Interfaces, DefLower, , "ethernet" -HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" -HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% -HKR, Ndi\Params\NetworkAddress, type, 0, "edit" -HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" -HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" -HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% -HKR, Ndi\Params\NetworkAddress, optional, 0, "0" -HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% -HKR, Ndi\Params\MaxSpeed, type, 0, "int" -HKR, Ndi\Params\MaxSpeed, default, 0, "100" -HKR, Ndi\Params\MaxSpeed, min, 0, "0" -HKR, Ndi\Params\MaxSpeed, max, 0, "2000" -HKR, Ndi\Params\MaxSpeed, step, 0, "1" -HKR, Ndi\Params\MaxSpeed, Base, 0, "10" -HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% -HKR, Ndi\Params\KeepLink, type, 0, "enum" -HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% -HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% -HKR, Ndi\Params\KeepLink, default, 0, "0" - - -[Neo.Service] -DisplayName = %Neo.Service.DispName% -Description = %Neo.Service.Desc% -ServiceType = 1 -StartType = 3 -ErrorControl = 1 -ServiceBinary = %12%\Neo_VPN5.sys -LoadOrderGroup = NDIS - -[Neo.Reg] -HKR, Ndi, Service, 0, Neo.Service.Name -HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" -HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" - -[Neo.EventLog] -HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN5.sys" -HKR, , TypesSupported, 0x00010001, 7 - -[Strings] -CompanyName = "SoftEther Corporation" -DiskDescription = "VPN Client Device Driver Install Disk" -Neo.Service.Name = "Neo_VPN5" -Neo.Service.DispName = "VPN Client Device Driver - VPN5" -Neo.Service.Desc = "VPN Client Adapter - VPN5" -NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN5" -Neo.EventLog.Name = "Neo" -NetworkAddress = "MAC Address" -DefaultAddress = "000001000001" -MaxSpeed = "Indicate Speed (Mbps)" -KeepLink = "Keep Link" -On = "On" -Off = "Off" - - -; Auto Generated 20180205_163610.740 - +; VPN Client Device Driver for Windows 2000 and Greater +; +; Copyright (c) SoftEther Corporation. All Rights Reserved. +; http://www.softether.co.jp/ +; +; BUILD 9658 + +[Version] +Signature = "$Windows NT$" +Class = Net +ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} +Provider = %CompanyName% +DriverVer = 02/04/2018, 4.25.0.9658 +CatalogFile.NT = inf_VPN5.cat + +[Manufacturer] +%CompanyName% = SoftEther, NTamd64 + +[SourceDisksNames] +1=%DiskDescription%, "", , + +[SourceDisksFiles] +Neo_VPN5.sys = 1 + +[DestinationDirs] +DefaultDestDir = 12 +Neo.CopyFiles.Sys = 12 + +[Neo.CopyFiles.Sys] +Neo_VPN5.sys, , , 2 + +[SoftEther.NTamd64] +%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN5 + +[NeoAdapter.Install] +Characteristics = 0x1 +AddReg = Neo.Reg, NeoAdapter.Ndi +CopyFiles = Neo.CopyFiles.Sys +*IfType = 53 +*MediaType = 0 +*PhysicalMediaType = 0 + +[NeoAdapter.Install.Services] +AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% + +[NeoAdapter.Ndi] +HKR, , NetworkAddress, 0, %DefaultAddress% +HKR, Ndi, DeviceID, , "NeoAdapter_VPN5" +HKR, , DevLoader, , ndis +HKR, , DeviceVxDs, , Neo_VPN5.sys +HKR, NDIS, LogDriverName, , "Neo_VPN5" +HKR, NDIS, MajorNdisVersion, 1, 5 +HKR, NDIS, MinorNdisVersion, 1, 0 +HKR, Ndi\Interfaces, DefUpper, , "ndis5" +HKR, Ndi\Interfaces, UpperRange, , "ndis5" +HKR, Ndi\Interfaces, LowerRange, , "ethernet" +HKR, Ndi\Interfaces, DefLower, , "ethernet" +HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" +HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% +HKR, Ndi\Params\NetworkAddress, type, 0, "edit" +HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" +HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" +HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% +HKR, Ndi\Params\NetworkAddress, optional, 0, "0" +HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% +HKR, Ndi\Params\MaxSpeed, type, 0, "int" +HKR, Ndi\Params\MaxSpeed, default, 0, "100" +HKR, Ndi\Params\MaxSpeed, min, 0, "0" +HKR, Ndi\Params\MaxSpeed, max, 0, "2000" +HKR, Ndi\Params\MaxSpeed, step, 0, "1" +HKR, Ndi\Params\MaxSpeed, Base, 0, "10" +HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% +HKR, Ndi\Params\KeepLink, type, 0, "enum" +HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% +HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% +HKR, Ndi\Params\KeepLink, default, 0, "0" + + +[Neo.Service] +DisplayName = %Neo.Service.DispName% +Description = %Neo.Service.Desc% +ServiceType = 1 +StartType = 3 +ErrorControl = 1 +ServiceBinary = %12%\Neo_VPN5.sys +LoadOrderGroup = NDIS + +[Neo.Reg] +HKR, Ndi, Service, 0, Neo.Service.Name +HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" +HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" + +[Neo.EventLog] +HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN5.sys" +HKR, , TypesSupported, 0x00010001, 7 + +[Strings] +CompanyName = "SoftEther Corporation" +DiskDescription = "VPN Client Device Driver Install Disk" +Neo.Service.Name = "Neo_VPN5" +Neo.Service.DispName = "VPN Client Device Driver - VPN5" +Neo.Service.Desc = "VPN Client Adapter - VPN5" +NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN5" +Neo.EventLog.Name = "Neo" +NetworkAddress = "MAC Address" +DefaultAddress = "000001000001" +MaxSpeed = "Indicate Speed (Mbps)" +KeepLink = "Keep Link" +On = "On" +Off = "Off" + + +; Auto Generated 20180205_163610.740 + diff --git a/src/bin/hamcore/DriverPackages/Neo6_Win8/x64/Neo6_x64_VPN50.inf b/src/bin/hamcore/DriverPackages/Neo6_Win8/x64/Neo6_x64_VPN50.inf index 00ba3241..1a7123b5 100644 --- a/src/bin/hamcore/DriverPackages/Neo6_Win8/x64/Neo6_x64_VPN50.inf +++ b/src/bin/hamcore/DriverPackages/Neo6_Win8/x64/Neo6_x64_VPN50.inf @@ -1,114 +1,114 @@ -; VPN Client Device Driver for Windows 2000 and Greater -; -; Copyright (c) SoftEther Corporation. All Rights Reserved. -; http://www.softether.co.jp/ -; -; BUILD 9658 - -[Version] -Signature = "$Windows NT$" -Class = Net -ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} -Provider = %CompanyName% -DriverVer = 02/04/2018, 4.25.0.9658 -CatalogFile.NT = inf_VPN50.cat - -[Manufacturer] -%CompanyName% = SoftEther, NTamd64 - -[SourceDisksNames] -1=%DiskDescription%, "", , - -[SourceDisksFiles] -Neo_VPN50.sys = 1 - -[DestinationDirs] -DefaultDestDir = 12 -Neo.CopyFiles.Sys = 12 - -[Neo.CopyFiles.Sys] -Neo_VPN50.sys, , , 2 - -[SoftEther.NTamd64] -%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN50 - -[NeoAdapter.Install] -Characteristics = 0x1 -AddReg = Neo.Reg, NeoAdapter.Ndi -CopyFiles = Neo.CopyFiles.Sys -*IfType = 53 -*MediaType = 0 -*PhysicalMediaType = 0 - -[NeoAdapter.Install.Services] -AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% - -[NeoAdapter.Ndi] -HKR, , NetworkAddress, 0, %DefaultAddress% -HKR, Ndi, DeviceID, , "NeoAdapter_VPN50" -HKR, , DevLoader, , ndis -HKR, , DeviceVxDs, , Neo_VPN50.sys -HKR, NDIS, LogDriverName, , "Neo_VPN50" -HKR, NDIS, MajorNdisVersion, 1, 5 -HKR, NDIS, MinorNdisVersion, 1, 0 -HKR, Ndi\Interfaces, DefUpper, , "ndis5" -HKR, Ndi\Interfaces, UpperRange, , "ndis5" -HKR, Ndi\Interfaces, LowerRange, , "ethernet" -HKR, Ndi\Interfaces, DefLower, , "ethernet" -HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" -HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% -HKR, Ndi\Params\NetworkAddress, type, 0, "edit" -HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" -HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" -HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% -HKR, Ndi\Params\NetworkAddress, optional, 0, "0" -HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% -HKR, Ndi\Params\MaxSpeed, type, 0, "int" -HKR, Ndi\Params\MaxSpeed, default, 0, "100" -HKR, Ndi\Params\MaxSpeed, min, 0, "0" -HKR, Ndi\Params\MaxSpeed, max, 0, "2000" -HKR, Ndi\Params\MaxSpeed, step, 0, "1" -HKR, Ndi\Params\MaxSpeed, Base, 0, "10" -HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% -HKR, Ndi\Params\KeepLink, type, 0, "enum" -HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% -HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% -HKR, Ndi\Params\KeepLink, default, 0, "0" - - -[Neo.Service] -DisplayName = %Neo.Service.DispName% -Description = %Neo.Service.Desc% -ServiceType = 1 -StartType = 3 -ErrorControl = 1 -ServiceBinary = %12%\Neo_VPN50.sys -LoadOrderGroup = NDIS - -[Neo.Reg] -HKR, Ndi, Service, 0, Neo.Service.Name -HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" -HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" - -[Neo.EventLog] -HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN50.sys" -HKR, , TypesSupported, 0x00010001, 7 - -[Strings] -CompanyName = "SoftEther Corporation" -DiskDescription = "VPN Client Device Driver Install Disk" -Neo.Service.Name = "Neo_VPN50" -Neo.Service.DispName = "VPN Client Device Driver - VPN50" -Neo.Service.Desc = "VPN Client Adapter - VPN50" -NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN50" -Neo.EventLog.Name = "Neo" -NetworkAddress = "MAC Address" -DefaultAddress = "000001000001" -MaxSpeed = "Indicate Speed (Mbps)" -KeepLink = "Keep Link" -On = "On" -Off = "Off" - - -; Auto Generated 20180205_163610.767 - +; VPN Client Device Driver for Windows 2000 and Greater +; +; Copyright (c) SoftEther Corporation. All Rights Reserved. +; http://www.softether.co.jp/ +; +; BUILD 9658 + +[Version] +Signature = "$Windows NT$" +Class = Net +ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} +Provider = %CompanyName% +DriverVer = 02/04/2018, 4.25.0.9658 +CatalogFile.NT = inf_VPN50.cat + +[Manufacturer] +%CompanyName% = SoftEther, NTamd64 + +[SourceDisksNames] +1=%DiskDescription%, "", , + +[SourceDisksFiles] +Neo_VPN50.sys = 1 + +[DestinationDirs] +DefaultDestDir = 12 +Neo.CopyFiles.Sys = 12 + +[Neo.CopyFiles.Sys] +Neo_VPN50.sys, , , 2 + +[SoftEther.NTamd64] +%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN50 + +[NeoAdapter.Install] +Characteristics = 0x1 +AddReg = Neo.Reg, NeoAdapter.Ndi +CopyFiles = Neo.CopyFiles.Sys +*IfType = 53 +*MediaType = 0 +*PhysicalMediaType = 0 + +[NeoAdapter.Install.Services] +AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% + +[NeoAdapter.Ndi] +HKR, , NetworkAddress, 0, %DefaultAddress% +HKR, Ndi, DeviceID, , "NeoAdapter_VPN50" +HKR, , DevLoader, , ndis +HKR, , DeviceVxDs, , Neo_VPN50.sys +HKR, NDIS, LogDriverName, , "Neo_VPN50" +HKR, NDIS, MajorNdisVersion, 1, 5 +HKR, NDIS, MinorNdisVersion, 1, 0 +HKR, Ndi\Interfaces, DefUpper, , "ndis5" +HKR, Ndi\Interfaces, UpperRange, , "ndis5" +HKR, Ndi\Interfaces, LowerRange, , "ethernet" +HKR, Ndi\Interfaces, DefLower, , "ethernet" +HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" +HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% +HKR, Ndi\Params\NetworkAddress, type, 0, "edit" +HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" +HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" +HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% +HKR, Ndi\Params\NetworkAddress, optional, 0, "0" +HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% +HKR, Ndi\Params\MaxSpeed, type, 0, "int" +HKR, Ndi\Params\MaxSpeed, default, 0, "100" +HKR, Ndi\Params\MaxSpeed, min, 0, "0" +HKR, Ndi\Params\MaxSpeed, max, 0, "2000" +HKR, Ndi\Params\MaxSpeed, step, 0, "1" +HKR, Ndi\Params\MaxSpeed, Base, 0, "10" +HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% +HKR, Ndi\Params\KeepLink, type, 0, "enum" +HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% +HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% +HKR, Ndi\Params\KeepLink, default, 0, "0" + + +[Neo.Service] +DisplayName = %Neo.Service.DispName% +Description = %Neo.Service.Desc% +ServiceType = 1 +StartType = 3 +ErrorControl = 1 +ServiceBinary = %12%\Neo_VPN50.sys +LoadOrderGroup = NDIS + +[Neo.Reg] +HKR, Ndi, Service, 0, Neo.Service.Name +HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" +HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" + +[Neo.EventLog] +HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN50.sys" +HKR, , TypesSupported, 0x00010001, 7 + +[Strings] +CompanyName = "SoftEther Corporation" +DiskDescription = "VPN Client Device Driver Install Disk" +Neo.Service.Name = "Neo_VPN50" +Neo.Service.DispName = "VPN Client Device Driver - VPN50" +Neo.Service.Desc = "VPN Client Adapter - VPN50" +NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN50" +Neo.EventLog.Name = "Neo" +NetworkAddress = "MAC Address" +DefaultAddress = "000001000001" +MaxSpeed = "Indicate Speed (Mbps)" +KeepLink = "Keep Link" +On = "On" +Off = "Off" + + +; Auto Generated 20180205_163610.767 + diff --git a/src/bin/hamcore/DriverPackages/Neo6_Win8/x64/Neo6_x64_VPN51.inf b/src/bin/hamcore/DriverPackages/Neo6_Win8/x64/Neo6_x64_VPN51.inf index d94afb4f..ba55baf4 100644 --- a/src/bin/hamcore/DriverPackages/Neo6_Win8/x64/Neo6_x64_VPN51.inf +++ b/src/bin/hamcore/DriverPackages/Neo6_Win8/x64/Neo6_x64_VPN51.inf @@ -1,114 +1,114 @@ -; VPN Client Device Driver for Windows 2000 and Greater -; -; Copyright (c) SoftEther Corporation. All Rights Reserved. -; http://www.softether.co.jp/ -; -; BUILD 9658 - -[Version] -Signature = "$Windows NT$" -Class = Net -ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} -Provider = %CompanyName% -DriverVer = 02/04/2018, 4.25.0.9658 -CatalogFile.NT = inf_VPN51.cat - -[Manufacturer] -%CompanyName% = SoftEther, NTamd64 - -[SourceDisksNames] -1=%DiskDescription%, "", , - -[SourceDisksFiles] -Neo_VPN51.sys = 1 - -[DestinationDirs] -DefaultDestDir = 12 -Neo.CopyFiles.Sys = 12 - -[Neo.CopyFiles.Sys] -Neo_VPN51.sys, , , 2 - -[SoftEther.NTamd64] -%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN51 - -[NeoAdapter.Install] -Characteristics = 0x1 -AddReg = Neo.Reg, NeoAdapter.Ndi -CopyFiles = Neo.CopyFiles.Sys -*IfType = 53 -*MediaType = 0 -*PhysicalMediaType = 0 - -[NeoAdapter.Install.Services] -AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% - -[NeoAdapter.Ndi] -HKR, , NetworkAddress, 0, %DefaultAddress% -HKR, Ndi, DeviceID, , "NeoAdapter_VPN51" -HKR, , DevLoader, , ndis -HKR, , DeviceVxDs, , Neo_VPN51.sys -HKR, NDIS, LogDriverName, , "Neo_VPN51" -HKR, NDIS, MajorNdisVersion, 1, 5 -HKR, NDIS, MinorNdisVersion, 1, 0 -HKR, Ndi\Interfaces, DefUpper, , "ndis5" -HKR, Ndi\Interfaces, UpperRange, , "ndis5" -HKR, Ndi\Interfaces, LowerRange, , "ethernet" -HKR, Ndi\Interfaces, DefLower, , "ethernet" -HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" -HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% -HKR, Ndi\Params\NetworkAddress, type, 0, "edit" -HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" -HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" -HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% -HKR, Ndi\Params\NetworkAddress, optional, 0, "0" -HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% -HKR, Ndi\Params\MaxSpeed, type, 0, "int" -HKR, Ndi\Params\MaxSpeed, default, 0, "100" -HKR, Ndi\Params\MaxSpeed, min, 0, "0" -HKR, Ndi\Params\MaxSpeed, max, 0, "2000" -HKR, Ndi\Params\MaxSpeed, step, 0, "1" -HKR, Ndi\Params\MaxSpeed, Base, 0, "10" -HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% -HKR, Ndi\Params\KeepLink, type, 0, "enum" -HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% -HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% -HKR, Ndi\Params\KeepLink, default, 0, "0" - - -[Neo.Service] -DisplayName = %Neo.Service.DispName% -Description = %Neo.Service.Desc% -ServiceType = 1 -StartType = 3 -ErrorControl = 1 -ServiceBinary = %12%\Neo_VPN51.sys -LoadOrderGroup = NDIS - -[Neo.Reg] -HKR, Ndi, Service, 0, Neo.Service.Name -HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" -HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" - -[Neo.EventLog] -HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN51.sys" -HKR, , TypesSupported, 0x00010001, 7 - -[Strings] -CompanyName = "SoftEther Corporation" -DiskDescription = "VPN Client Device Driver Install Disk" -Neo.Service.Name = "Neo_VPN51" -Neo.Service.DispName = "VPN Client Device Driver - VPN51" -Neo.Service.Desc = "VPN Client Adapter - VPN51" -NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN51" -Neo.EventLog.Name = "Neo" -NetworkAddress = "MAC Address" -DefaultAddress = "000001000001" -MaxSpeed = "Indicate Speed (Mbps)" -KeepLink = "Keep Link" -On = "On" -Off = "Off" - - -; Auto Generated 20180205_163610.768 - +; VPN Client Device Driver for Windows 2000 and Greater +; +; Copyright (c) SoftEther Corporation. All Rights Reserved. +; http://www.softether.co.jp/ +; +; BUILD 9658 + +[Version] +Signature = "$Windows NT$" +Class = Net +ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} +Provider = %CompanyName% +DriverVer = 02/04/2018, 4.25.0.9658 +CatalogFile.NT = inf_VPN51.cat + +[Manufacturer] +%CompanyName% = SoftEther, NTamd64 + +[SourceDisksNames] +1=%DiskDescription%, "", , + +[SourceDisksFiles] +Neo_VPN51.sys = 1 + +[DestinationDirs] +DefaultDestDir = 12 +Neo.CopyFiles.Sys = 12 + +[Neo.CopyFiles.Sys] +Neo_VPN51.sys, , , 2 + +[SoftEther.NTamd64] +%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN51 + +[NeoAdapter.Install] +Characteristics = 0x1 +AddReg = Neo.Reg, NeoAdapter.Ndi +CopyFiles = Neo.CopyFiles.Sys +*IfType = 53 +*MediaType = 0 +*PhysicalMediaType = 0 + +[NeoAdapter.Install.Services] +AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% + +[NeoAdapter.Ndi] +HKR, , NetworkAddress, 0, %DefaultAddress% +HKR, Ndi, DeviceID, , "NeoAdapter_VPN51" +HKR, , DevLoader, , ndis +HKR, , DeviceVxDs, , Neo_VPN51.sys +HKR, NDIS, LogDriverName, , "Neo_VPN51" +HKR, NDIS, MajorNdisVersion, 1, 5 +HKR, NDIS, MinorNdisVersion, 1, 0 +HKR, Ndi\Interfaces, DefUpper, , "ndis5" +HKR, Ndi\Interfaces, UpperRange, , "ndis5" +HKR, Ndi\Interfaces, LowerRange, , "ethernet" +HKR, Ndi\Interfaces, DefLower, , "ethernet" +HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" +HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% +HKR, Ndi\Params\NetworkAddress, type, 0, "edit" +HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" +HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" +HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% +HKR, Ndi\Params\NetworkAddress, optional, 0, "0" +HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% +HKR, Ndi\Params\MaxSpeed, type, 0, "int" +HKR, Ndi\Params\MaxSpeed, default, 0, "100" +HKR, Ndi\Params\MaxSpeed, min, 0, "0" +HKR, Ndi\Params\MaxSpeed, max, 0, "2000" +HKR, Ndi\Params\MaxSpeed, step, 0, "1" +HKR, Ndi\Params\MaxSpeed, Base, 0, "10" +HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% +HKR, Ndi\Params\KeepLink, type, 0, "enum" +HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% +HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% +HKR, Ndi\Params\KeepLink, default, 0, "0" + + +[Neo.Service] +DisplayName = %Neo.Service.DispName% +Description = %Neo.Service.Desc% +ServiceType = 1 +StartType = 3 +ErrorControl = 1 +ServiceBinary = %12%\Neo_VPN51.sys +LoadOrderGroup = NDIS + +[Neo.Reg] +HKR, Ndi, Service, 0, Neo.Service.Name +HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" +HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" + +[Neo.EventLog] +HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN51.sys" +HKR, , TypesSupported, 0x00010001, 7 + +[Strings] +CompanyName = "SoftEther Corporation" +DiskDescription = "VPN Client Device Driver Install Disk" +Neo.Service.Name = "Neo_VPN51" +Neo.Service.DispName = "VPN Client Device Driver - VPN51" +Neo.Service.Desc = "VPN Client Adapter - VPN51" +NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN51" +Neo.EventLog.Name = "Neo" +NetworkAddress = "MAC Address" +DefaultAddress = "000001000001" +MaxSpeed = "Indicate Speed (Mbps)" +KeepLink = "Keep Link" +On = "On" +Off = "Off" + + +; Auto Generated 20180205_163610.768 + diff --git a/src/bin/hamcore/DriverPackages/Neo6_Win8/x64/Neo6_x64_VPN52.inf b/src/bin/hamcore/DriverPackages/Neo6_Win8/x64/Neo6_x64_VPN52.inf index 06de57fd..59b7ec15 100644 --- a/src/bin/hamcore/DriverPackages/Neo6_Win8/x64/Neo6_x64_VPN52.inf +++ b/src/bin/hamcore/DriverPackages/Neo6_Win8/x64/Neo6_x64_VPN52.inf @@ -1,114 +1,114 @@ -; VPN Client Device Driver for Windows 2000 and Greater -; -; Copyright (c) SoftEther Corporation. All Rights Reserved. -; http://www.softether.co.jp/ -; -; BUILD 9658 - -[Version] -Signature = "$Windows NT$" -Class = Net -ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} -Provider = %CompanyName% -DriverVer = 02/04/2018, 4.25.0.9658 -CatalogFile.NT = inf_VPN52.cat - -[Manufacturer] -%CompanyName% = SoftEther, NTamd64 - -[SourceDisksNames] -1=%DiskDescription%, "", , - -[SourceDisksFiles] -Neo_VPN52.sys = 1 - -[DestinationDirs] -DefaultDestDir = 12 -Neo.CopyFiles.Sys = 12 - -[Neo.CopyFiles.Sys] -Neo_VPN52.sys, , , 2 - -[SoftEther.NTamd64] -%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN52 - -[NeoAdapter.Install] -Characteristics = 0x1 -AddReg = Neo.Reg, NeoAdapter.Ndi -CopyFiles = Neo.CopyFiles.Sys -*IfType = 53 -*MediaType = 0 -*PhysicalMediaType = 0 - -[NeoAdapter.Install.Services] -AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% - -[NeoAdapter.Ndi] -HKR, , NetworkAddress, 0, %DefaultAddress% -HKR, Ndi, DeviceID, , "NeoAdapter_VPN52" -HKR, , DevLoader, , ndis -HKR, , DeviceVxDs, , Neo_VPN52.sys -HKR, NDIS, LogDriverName, , "Neo_VPN52" -HKR, NDIS, MajorNdisVersion, 1, 5 -HKR, NDIS, MinorNdisVersion, 1, 0 -HKR, Ndi\Interfaces, DefUpper, , "ndis5" -HKR, Ndi\Interfaces, UpperRange, , "ndis5" -HKR, Ndi\Interfaces, LowerRange, , "ethernet" -HKR, Ndi\Interfaces, DefLower, , "ethernet" -HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" -HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% -HKR, Ndi\Params\NetworkAddress, type, 0, "edit" -HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" -HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" -HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% -HKR, Ndi\Params\NetworkAddress, optional, 0, "0" -HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% -HKR, Ndi\Params\MaxSpeed, type, 0, "int" -HKR, Ndi\Params\MaxSpeed, default, 0, "100" -HKR, Ndi\Params\MaxSpeed, min, 0, "0" -HKR, Ndi\Params\MaxSpeed, max, 0, "2000" -HKR, Ndi\Params\MaxSpeed, step, 0, "1" -HKR, Ndi\Params\MaxSpeed, Base, 0, "10" -HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% -HKR, Ndi\Params\KeepLink, type, 0, "enum" -HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% -HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% -HKR, Ndi\Params\KeepLink, default, 0, "0" - - -[Neo.Service] -DisplayName = %Neo.Service.DispName% -Description = %Neo.Service.Desc% -ServiceType = 1 -StartType = 3 -ErrorControl = 1 -ServiceBinary = %12%\Neo_VPN52.sys -LoadOrderGroup = NDIS - -[Neo.Reg] -HKR, Ndi, Service, 0, Neo.Service.Name -HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" -HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" - -[Neo.EventLog] -HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN52.sys" -HKR, , TypesSupported, 0x00010001, 7 - -[Strings] -CompanyName = "SoftEther Corporation" -DiskDescription = "VPN Client Device Driver Install Disk" -Neo.Service.Name = "Neo_VPN52" -Neo.Service.DispName = "VPN Client Device Driver - VPN52" -Neo.Service.Desc = "VPN Client Adapter - VPN52" -NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN52" -Neo.EventLog.Name = "Neo" -NetworkAddress = "MAC Address" -DefaultAddress = "000001000001" -MaxSpeed = "Indicate Speed (Mbps)" -KeepLink = "Keep Link" -On = "On" -Off = "Off" - - -; Auto Generated 20180205_163610.768 - +; VPN Client Device Driver for Windows 2000 and Greater +; +; Copyright (c) SoftEther Corporation. All Rights Reserved. +; http://www.softether.co.jp/ +; +; BUILD 9658 + +[Version] +Signature = "$Windows NT$" +Class = Net +ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} +Provider = %CompanyName% +DriverVer = 02/04/2018, 4.25.0.9658 +CatalogFile.NT = inf_VPN52.cat + +[Manufacturer] +%CompanyName% = SoftEther, NTamd64 + +[SourceDisksNames] +1=%DiskDescription%, "", , + +[SourceDisksFiles] +Neo_VPN52.sys = 1 + +[DestinationDirs] +DefaultDestDir = 12 +Neo.CopyFiles.Sys = 12 + +[Neo.CopyFiles.Sys] +Neo_VPN52.sys, , , 2 + +[SoftEther.NTamd64] +%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN52 + +[NeoAdapter.Install] +Characteristics = 0x1 +AddReg = Neo.Reg, NeoAdapter.Ndi +CopyFiles = Neo.CopyFiles.Sys +*IfType = 53 +*MediaType = 0 +*PhysicalMediaType = 0 + +[NeoAdapter.Install.Services] +AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% + +[NeoAdapter.Ndi] +HKR, , NetworkAddress, 0, %DefaultAddress% +HKR, Ndi, DeviceID, , "NeoAdapter_VPN52" +HKR, , DevLoader, , ndis +HKR, , DeviceVxDs, , Neo_VPN52.sys +HKR, NDIS, LogDriverName, , "Neo_VPN52" +HKR, NDIS, MajorNdisVersion, 1, 5 +HKR, NDIS, MinorNdisVersion, 1, 0 +HKR, Ndi\Interfaces, DefUpper, , "ndis5" +HKR, Ndi\Interfaces, UpperRange, , "ndis5" +HKR, Ndi\Interfaces, LowerRange, , "ethernet" +HKR, Ndi\Interfaces, DefLower, , "ethernet" +HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" +HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% +HKR, Ndi\Params\NetworkAddress, type, 0, "edit" +HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" +HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" +HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% +HKR, Ndi\Params\NetworkAddress, optional, 0, "0" +HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% +HKR, Ndi\Params\MaxSpeed, type, 0, "int" +HKR, Ndi\Params\MaxSpeed, default, 0, "100" +HKR, Ndi\Params\MaxSpeed, min, 0, "0" +HKR, Ndi\Params\MaxSpeed, max, 0, "2000" +HKR, Ndi\Params\MaxSpeed, step, 0, "1" +HKR, Ndi\Params\MaxSpeed, Base, 0, "10" +HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% +HKR, Ndi\Params\KeepLink, type, 0, "enum" +HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% +HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% +HKR, Ndi\Params\KeepLink, default, 0, "0" + + +[Neo.Service] +DisplayName = %Neo.Service.DispName% +Description = %Neo.Service.Desc% +ServiceType = 1 +StartType = 3 +ErrorControl = 1 +ServiceBinary = %12%\Neo_VPN52.sys +LoadOrderGroup = NDIS + +[Neo.Reg] +HKR, Ndi, Service, 0, Neo.Service.Name +HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" +HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" + +[Neo.EventLog] +HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN52.sys" +HKR, , TypesSupported, 0x00010001, 7 + +[Strings] +CompanyName = "SoftEther Corporation" +DiskDescription = "VPN Client Device Driver Install Disk" +Neo.Service.Name = "Neo_VPN52" +Neo.Service.DispName = "VPN Client Device Driver - VPN52" +Neo.Service.Desc = "VPN Client Adapter - VPN52" +NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN52" +Neo.EventLog.Name = "Neo" +NetworkAddress = "MAC Address" +DefaultAddress = "000001000001" +MaxSpeed = "Indicate Speed (Mbps)" +KeepLink = "Keep Link" +On = "On" +Off = "Off" + + +; Auto Generated 20180205_163610.768 + diff --git a/src/bin/hamcore/DriverPackages/Neo6_Win8/x64/Neo6_x64_VPN53.inf b/src/bin/hamcore/DriverPackages/Neo6_Win8/x64/Neo6_x64_VPN53.inf index cc44ed24..1ef68f8b 100644 --- a/src/bin/hamcore/DriverPackages/Neo6_Win8/x64/Neo6_x64_VPN53.inf +++ b/src/bin/hamcore/DriverPackages/Neo6_Win8/x64/Neo6_x64_VPN53.inf @@ -1,114 +1,114 @@ -; VPN Client Device Driver for Windows 2000 and Greater -; -; Copyright (c) SoftEther Corporation. All Rights Reserved. -; http://www.softether.co.jp/ -; -; BUILD 9658 - -[Version] -Signature = "$Windows NT$" -Class = Net -ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} -Provider = %CompanyName% -DriverVer = 02/04/2018, 4.25.0.9658 -CatalogFile.NT = inf_VPN53.cat - -[Manufacturer] -%CompanyName% = SoftEther, NTamd64 - -[SourceDisksNames] -1=%DiskDescription%, "", , - -[SourceDisksFiles] -Neo_VPN53.sys = 1 - -[DestinationDirs] -DefaultDestDir = 12 -Neo.CopyFiles.Sys = 12 - -[Neo.CopyFiles.Sys] -Neo_VPN53.sys, , , 2 - -[SoftEther.NTamd64] -%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN53 - -[NeoAdapter.Install] -Characteristics = 0x1 -AddReg = Neo.Reg, NeoAdapter.Ndi -CopyFiles = Neo.CopyFiles.Sys -*IfType = 53 -*MediaType = 0 -*PhysicalMediaType = 0 - -[NeoAdapter.Install.Services] -AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% - -[NeoAdapter.Ndi] -HKR, , NetworkAddress, 0, %DefaultAddress% -HKR, Ndi, DeviceID, , "NeoAdapter_VPN53" -HKR, , DevLoader, , ndis -HKR, , DeviceVxDs, , Neo_VPN53.sys -HKR, NDIS, LogDriverName, , "Neo_VPN53" -HKR, NDIS, MajorNdisVersion, 1, 5 -HKR, NDIS, MinorNdisVersion, 1, 0 -HKR, Ndi\Interfaces, DefUpper, , "ndis5" -HKR, Ndi\Interfaces, UpperRange, , "ndis5" -HKR, Ndi\Interfaces, LowerRange, , "ethernet" -HKR, Ndi\Interfaces, DefLower, , "ethernet" -HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" -HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% -HKR, Ndi\Params\NetworkAddress, type, 0, "edit" -HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" -HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" -HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% -HKR, Ndi\Params\NetworkAddress, optional, 0, "0" -HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% -HKR, Ndi\Params\MaxSpeed, type, 0, "int" -HKR, Ndi\Params\MaxSpeed, default, 0, "100" -HKR, Ndi\Params\MaxSpeed, min, 0, "0" -HKR, Ndi\Params\MaxSpeed, max, 0, "2000" -HKR, Ndi\Params\MaxSpeed, step, 0, "1" -HKR, Ndi\Params\MaxSpeed, Base, 0, "10" -HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% -HKR, Ndi\Params\KeepLink, type, 0, "enum" -HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% -HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% -HKR, Ndi\Params\KeepLink, default, 0, "0" - - -[Neo.Service] -DisplayName = %Neo.Service.DispName% -Description = %Neo.Service.Desc% -ServiceType = 1 -StartType = 3 -ErrorControl = 1 -ServiceBinary = %12%\Neo_VPN53.sys -LoadOrderGroup = NDIS - -[Neo.Reg] -HKR, Ndi, Service, 0, Neo.Service.Name -HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" -HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" - -[Neo.EventLog] -HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN53.sys" -HKR, , TypesSupported, 0x00010001, 7 - -[Strings] -CompanyName = "SoftEther Corporation" -DiskDescription = "VPN Client Device Driver Install Disk" -Neo.Service.Name = "Neo_VPN53" -Neo.Service.DispName = "VPN Client Device Driver - VPN53" -Neo.Service.Desc = "VPN Client Adapter - VPN53" -NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN53" -Neo.EventLog.Name = "Neo" -NetworkAddress = "MAC Address" -DefaultAddress = "000001000001" -MaxSpeed = "Indicate Speed (Mbps)" -KeepLink = "Keep Link" -On = "On" -Off = "Off" - - -; Auto Generated 20180205_163610.769 - +; VPN Client Device Driver for Windows 2000 and Greater +; +; Copyright (c) SoftEther Corporation. All Rights Reserved. +; http://www.softether.co.jp/ +; +; BUILD 9658 + +[Version] +Signature = "$Windows NT$" +Class = Net +ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} +Provider = %CompanyName% +DriverVer = 02/04/2018, 4.25.0.9658 +CatalogFile.NT = inf_VPN53.cat + +[Manufacturer] +%CompanyName% = SoftEther, NTamd64 + +[SourceDisksNames] +1=%DiskDescription%, "", , + +[SourceDisksFiles] +Neo_VPN53.sys = 1 + +[DestinationDirs] +DefaultDestDir = 12 +Neo.CopyFiles.Sys = 12 + +[Neo.CopyFiles.Sys] +Neo_VPN53.sys, , , 2 + +[SoftEther.NTamd64] +%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN53 + +[NeoAdapter.Install] +Characteristics = 0x1 +AddReg = Neo.Reg, NeoAdapter.Ndi +CopyFiles = Neo.CopyFiles.Sys +*IfType = 53 +*MediaType = 0 +*PhysicalMediaType = 0 + +[NeoAdapter.Install.Services] +AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% + +[NeoAdapter.Ndi] +HKR, , NetworkAddress, 0, %DefaultAddress% +HKR, Ndi, DeviceID, , "NeoAdapter_VPN53" +HKR, , DevLoader, , ndis +HKR, , DeviceVxDs, , Neo_VPN53.sys +HKR, NDIS, LogDriverName, , "Neo_VPN53" +HKR, NDIS, MajorNdisVersion, 1, 5 +HKR, NDIS, MinorNdisVersion, 1, 0 +HKR, Ndi\Interfaces, DefUpper, , "ndis5" +HKR, Ndi\Interfaces, UpperRange, , "ndis5" +HKR, Ndi\Interfaces, LowerRange, , "ethernet" +HKR, Ndi\Interfaces, DefLower, , "ethernet" +HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" +HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% +HKR, Ndi\Params\NetworkAddress, type, 0, "edit" +HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" +HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" +HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% +HKR, Ndi\Params\NetworkAddress, optional, 0, "0" +HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% +HKR, Ndi\Params\MaxSpeed, type, 0, "int" +HKR, Ndi\Params\MaxSpeed, default, 0, "100" +HKR, Ndi\Params\MaxSpeed, min, 0, "0" +HKR, Ndi\Params\MaxSpeed, max, 0, "2000" +HKR, Ndi\Params\MaxSpeed, step, 0, "1" +HKR, Ndi\Params\MaxSpeed, Base, 0, "10" +HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% +HKR, Ndi\Params\KeepLink, type, 0, "enum" +HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% +HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% +HKR, Ndi\Params\KeepLink, default, 0, "0" + + +[Neo.Service] +DisplayName = %Neo.Service.DispName% +Description = %Neo.Service.Desc% +ServiceType = 1 +StartType = 3 +ErrorControl = 1 +ServiceBinary = %12%\Neo_VPN53.sys +LoadOrderGroup = NDIS + +[Neo.Reg] +HKR, Ndi, Service, 0, Neo.Service.Name +HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" +HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" + +[Neo.EventLog] +HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN53.sys" +HKR, , TypesSupported, 0x00010001, 7 + +[Strings] +CompanyName = "SoftEther Corporation" +DiskDescription = "VPN Client Device Driver Install Disk" +Neo.Service.Name = "Neo_VPN53" +Neo.Service.DispName = "VPN Client Device Driver - VPN53" +Neo.Service.Desc = "VPN Client Adapter - VPN53" +NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN53" +Neo.EventLog.Name = "Neo" +NetworkAddress = "MAC Address" +DefaultAddress = "000001000001" +MaxSpeed = "Indicate Speed (Mbps)" +KeepLink = "Keep Link" +On = "On" +Off = "Off" + + +; Auto Generated 20180205_163610.769 + diff --git a/src/bin/hamcore/DriverPackages/Neo6_Win8/x64/Neo6_x64_VPN54.inf b/src/bin/hamcore/DriverPackages/Neo6_Win8/x64/Neo6_x64_VPN54.inf index d45d009c..027aff12 100644 --- a/src/bin/hamcore/DriverPackages/Neo6_Win8/x64/Neo6_x64_VPN54.inf +++ b/src/bin/hamcore/DriverPackages/Neo6_Win8/x64/Neo6_x64_VPN54.inf @@ -1,114 +1,114 @@ -; VPN Client Device Driver for Windows 2000 and Greater -; -; Copyright (c) SoftEther Corporation. All Rights Reserved. -; http://www.softether.co.jp/ -; -; BUILD 9658 - -[Version] -Signature = "$Windows NT$" -Class = Net -ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} -Provider = %CompanyName% -DriverVer = 02/04/2018, 4.25.0.9658 -CatalogFile.NT = inf_VPN54.cat - -[Manufacturer] -%CompanyName% = SoftEther, NTamd64 - -[SourceDisksNames] -1=%DiskDescription%, "", , - -[SourceDisksFiles] -Neo_VPN54.sys = 1 - -[DestinationDirs] -DefaultDestDir = 12 -Neo.CopyFiles.Sys = 12 - -[Neo.CopyFiles.Sys] -Neo_VPN54.sys, , , 2 - -[SoftEther.NTamd64] -%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN54 - -[NeoAdapter.Install] -Characteristics = 0x1 -AddReg = Neo.Reg, NeoAdapter.Ndi -CopyFiles = Neo.CopyFiles.Sys -*IfType = 53 -*MediaType = 0 -*PhysicalMediaType = 0 - -[NeoAdapter.Install.Services] -AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% - -[NeoAdapter.Ndi] -HKR, , NetworkAddress, 0, %DefaultAddress% -HKR, Ndi, DeviceID, , "NeoAdapter_VPN54" -HKR, , DevLoader, , ndis -HKR, , DeviceVxDs, , Neo_VPN54.sys -HKR, NDIS, LogDriverName, , "Neo_VPN54" -HKR, NDIS, MajorNdisVersion, 1, 5 -HKR, NDIS, MinorNdisVersion, 1, 0 -HKR, Ndi\Interfaces, DefUpper, , "ndis5" -HKR, Ndi\Interfaces, UpperRange, , "ndis5" -HKR, Ndi\Interfaces, LowerRange, , "ethernet" -HKR, Ndi\Interfaces, DefLower, , "ethernet" -HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" -HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% -HKR, Ndi\Params\NetworkAddress, type, 0, "edit" -HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" -HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" -HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% -HKR, Ndi\Params\NetworkAddress, optional, 0, "0" -HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% -HKR, Ndi\Params\MaxSpeed, type, 0, "int" -HKR, Ndi\Params\MaxSpeed, default, 0, "100" -HKR, Ndi\Params\MaxSpeed, min, 0, "0" -HKR, Ndi\Params\MaxSpeed, max, 0, "2000" -HKR, Ndi\Params\MaxSpeed, step, 0, "1" -HKR, Ndi\Params\MaxSpeed, Base, 0, "10" -HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% -HKR, Ndi\Params\KeepLink, type, 0, "enum" -HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% -HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% -HKR, Ndi\Params\KeepLink, default, 0, "0" - - -[Neo.Service] -DisplayName = %Neo.Service.DispName% -Description = %Neo.Service.Desc% -ServiceType = 1 -StartType = 3 -ErrorControl = 1 -ServiceBinary = %12%\Neo_VPN54.sys -LoadOrderGroup = NDIS - -[Neo.Reg] -HKR, Ndi, Service, 0, Neo.Service.Name -HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" -HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" - -[Neo.EventLog] -HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN54.sys" -HKR, , TypesSupported, 0x00010001, 7 - -[Strings] -CompanyName = "SoftEther Corporation" -DiskDescription = "VPN Client Device Driver Install Disk" -Neo.Service.Name = "Neo_VPN54" -Neo.Service.DispName = "VPN Client Device Driver - VPN54" -Neo.Service.Desc = "VPN Client Adapter - VPN54" -NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN54" -Neo.EventLog.Name = "Neo" -NetworkAddress = "MAC Address" -DefaultAddress = "000001000001" -MaxSpeed = "Indicate Speed (Mbps)" -KeepLink = "Keep Link" -On = "On" -Off = "Off" - - -; Auto Generated 20180205_163610.770 - +; VPN Client Device Driver for Windows 2000 and Greater +; +; Copyright (c) SoftEther Corporation. All Rights Reserved. +; http://www.softether.co.jp/ +; +; BUILD 9658 + +[Version] +Signature = "$Windows NT$" +Class = Net +ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} +Provider = %CompanyName% +DriverVer = 02/04/2018, 4.25.0.9658 +CatalogFile.NT = inf_VPN54.cat + +[Manufacturer] +%CompanyName% = SoftEther, NTamd64 + +[SourceDisksNames] +1=%DiskDescription%, "", , + +[SourceDisksFiles] +Neo_VPN54.sys = 1 + +[DestinationDirs] +DefaultDestDir = 12 +Neo.CopyFiles.Sys = 12 + +[Neo.CopyFiles.Sys] +Neo_VPN54.sys, , , 2 + +[SoftEther.NTamd64] +%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN54 + +[NeoAdapter.Install] +Characteristics = 0x1 +AddReg = Neo.Reg, NeoAdapter.Ndi +CopyFiles = Neo.CopyFiles.Sys +*IfType = 53 +*MediaType = 0 +*PhysicalMediaType = 0 + +[NeoAdapter.Install.Services] +AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% + +[NeoAdapter.Ndi] +HKR, , NetworkAddress, 0, %DefaultAddress% +HKR, Ndi, DeviceID, , "NeoAdapter_VPN54" +HKR, , DevLoader, , ndis +HKR, , DeviceVxDs, , Neo_VPN54.sys +HKR, NDIS, LogDriverName, , "Neo_VPN54" +HKR, NDIS, MajorNdisVersion, 1, 5 +HKR, NDIS, MinorNdisVersion, 1, 0 +HKR, Ndi\Interfaces, DefUpper, , "ndis5" +HKR, Ndi\Interfaces, UpperRange, , "ndis5" +HKR, Ndi\Interfaces, LowerRange, , "ethernet" +HKR, Ndi\Interfaces, DefLower, , "ethernet" +HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" +HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% +HKR, Ndi\Params\NetworkAddress, type, 0, "edit" +HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" +HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" +HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% +HKR, Ndi\Params\NetworkAddress, optional, 0, "0" +HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% +HKR, Ndi\Params\MaxSpeed, type, 0, "int" +HKR, Ndi\Params\MaxSpeed, default, 0, "100" +HKR, Ndi\Params\MaxSpeed, min, 0, "0" +HKR, Ndi\Params\MaxSpeed, max, 0, "2000" +HKR, Ndi\Params\MaxSpeed, step, 0, "1" +HKR, Ndi\Params\MaxSpeed, Base, 0, "10" +HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% +HKR, Ndi\Params\KeepLink, type, 0, "enum" +HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% +HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% +HKR, Ndi\Params\KeepLink, default, 0, "0" + + +[Neo.Service] +DisplayName = %Neo.Service.DispName% +Description = %Neo.Service.Desc% +ServiceType = 1 +StartType = 3 +ErrorControl = 1 +ServiceBinary = %12%\Neo_VPN54.sys +LoadOrderGroup = NDIS + +[Neo.Reg] +HKR, Ndi, Service, 0, Neo.Service.Name +HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" +HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" + +[Neo.EventLog] +HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN54.sys" +HKR, , TypesSupported, 0x00010001, 7 + +[Strings] +CompanyName = "SoftEther Corporation" +DiskDescription = "VPN Client Device Driver Install Disk" +Neo.Service.Name = "Neo_VPN54" +Neo.Service.DispName = "VPN Client Device Driver - VPN54" +Neo.Service.Desc = "VPN Client Adapter - VPN54" +NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN54" +Neo.EventLog.Name = "Neo" +NetworkAddress = "MAC Address" +DefaultAddress = "000001000001" +MaxSpeed = "Indicate Speed (Mbps)" +KeepLink = "Keep Link" +On = "On" +Off = "Off" + + +; Auto Generated 20180205_163610.770 + diff --git a/src/bin/hamcore/DriverPackages/Neo6_Win8/x64/Neo6_x64_VPN55.inf b/src/bin/hamcore/DriverPackages/Neo6_Win8/x64/Neo6_x64_VPN55.inf index 438c239c..9f9c7407 100644 --- a/src/bin/hamcore/DriverPackages/Neo6_Win8/x64/Neo6_x64_VPN55.inf +++ b/src/bin/hamcore/DriverPackages/Neo6_Win8/x64/Neo6_x64_VPN55.inf @@ -1,114 +1,114 @@ -; VPN Client Device Driver for Windows 2000 and Greater -; -; Copyright (c) SoftEther Corporation. All Rights Reserved. -; http://www.softether.co.jp/ -; -; BUILD 9658 - -[Version] -Signature = "$Windows NT$" -Class = Net -ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} -Provider = %CompanyName% -DriverVer = 02/04/2018, 4.25.0.9658 -CatalogFile.NT = inf_VPN55.cat - -[Manufacturer] -%CompanyName% = SoftEther, NTamd64 - -[SourceDisksNames] -1=%DiskDescription%, "", , - -[SourceDisksFiles] -Neo_VPN55.sys = 1 - -[DestinationDirs] -DefaultDestDir = 12 -Neo.CopyFiles.Sys = 12 - -[Neo.CopyFiles.Sys] -Neo_VPN55.sys, , , 2 - -[SoftEther.NTamd64] -%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN55 - -[NeoAdapter.Install] -Characteristics = 0x1 -AddReg = Neo.Reg, NeoAdapter.Ndi -CopyFiles = Neo.CopyFiles.Sys -*IfType = 53 -*MediaType = 0 -*PhysicalMediaType = 0 - -[NeoAdapter.Install.Services] -AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% - -[NeoAdapter.Ndi] -HKR, , NetworkAddress, 0, %DefaultAddress% -HKR, Ndi, DeviceID, , "NeoAdapter_VPN55" -HKR, , DevLoader, , ndis -HKR, , DeviceVxDs, , Neo_VPN55.sys -HKR, NDIS, LogDriverName, , "Neo_VPN55" -HKR, NDIS, MajorNdisVersion, 1, 5 -HKR, NDIS, MinorNdisVersion, 1, 0 -HKR, Ndi\Interfaces, DefUpper, , "ndis5" -HKR, Ndi\Interfaces, UpperRange, , "ndis5" -HKR, Ndi\Interfaces, LowerRange, , "ethernet" -HKR, Ndi\Interfaces, DefLower, , "ethernet" -HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" -HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% -HKR, Ndi\Params\NetworkAddress, type, 0, "edit" -HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" -HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" -HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% -HKR, Ndi\Params\NetworkAddress, optional, 0, "0" -HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% -HKR, Ndi\Params\MaxSpeed, type, 0, "int" -HKR, Ndi\Params\MaxSpeed, default, 0, "100" -HKR, Ndi\Params\MaxSpeed, min, 0, "0" -HKR, Ndi\Params\MaxSpeed, max, 0, "2000" -HKR, Ndi\Params\MaxSpeed, step, 0, "1" -HKR, Ndi\Params\MaxSpeed, Base, 0, "10" -HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% -HKR, Ndi\Params\KeepLink, type, 0, "enum" -HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% -HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% -HKR, Ndi\Params\KeepLink, default, 0, "0" - - -[Neo.Service] -DisplayName = %Neo.Service.DispName% -Description = %Neo.Service.Desc% -ServiceType = 1 -StartType = 3 -ErrorControl = 1 -ServiceBinary = %12%\Neo_VPN55.sys -LoadOrderGroup = NDIS - -[Neo.Reg] -HKR, Ndi, Service, 0, Neo.Service.Name -HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" -HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" - -[Neo.EventLog] -HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN55.sys" -HKR, , TypesSupported, 0x00010001, 7 - -[Strings] -CompanyName = "SoftEther Corporation" -DiskDescription = "VPN Client Device Driver Install Disk" -Neo.Service.Name = "Neo_VPN55" -Neo.Service.DispName = "VPN Client Device Driver - VPN55" -Neo.Service.Desc = "VPN Client Adapter - VPN55" -NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN55" -Neo.EventLog.Name = "Neo" -NetworkAddress = "MAC Address" -DefaultAddress = "000001000001" -MaxSpeed = "Indicate Speed (Mbps)" -KeepLink = "Keep Link" -On = "On" -Off = "Off" - - -; Auto Generated 20180205_163610.770 - +; VPN Client Device Driver for Windows 2000 and Greater +; +; Copyright (c) SoftEther Corporation. All Rights Reserved. +; http://www.softether.co.jp/ +; +; BUILD 9658 + +[Version] +Signature = "$Windows NT$" +Class = Net +ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} +Provider = %CompanyName% +DriverVer = 02/04/2018, 4.25.0.9658 +CatalogFile.NT = inf_VPN55.cat + +[Manufacturer] +%CompanyName% = SoftEther, NTamd64 + +[SourceDisksNames] +1=%DiskDescription%, "", , + +[SourceDisksFiles] +Neo_VPN55.sys = 1 + +[DestinationDirs] +DefaultDestDir = 12 +Neo.CopyFiles.Sys = 12 + +[Neo.CopyFiles.Sys] +Neo_VPN55.sys, , , 2 + +[SoftEther.NTamd64] +%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN55 + +[NeoAdapter.Install] +Characteristics = 0x1 +AddReg = Neo.Reg, NeoAdapter.Ndi +CopyFiles = Neo.CopyFiles.Sys +*IfType = 53 +*MediaType = 0 +*PhysicalMediaType = 0 + +[NeoAdapter.Install.Services] +AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% + +[NeoAdapter.Ndi] +HKR, , NetworkAddress, 0, %DefaultAddress% +HKR, Ndi, DeviceID, , "NeoAdapter_VPN55" +HKR, , DevLoader, , ndis +HKR, , DeviceVxDs, , Neo_VPN55.sys +HKR, NDIS, LogDriverName, , "Neo_VPN55" +HKR, NDIS, MajorNdisVersion, 1, 5 +HKR, NDIS, MinorNdisVersion, 1, 0 +HKR, Ndi\Interfaces, DefUpper, , "ndis5" +HKR, Ndi\Interfaces, UpperRange, , "ndis5" +HKR, Ndi\Interfaces, LowerRange, , "ethernet" +HKR, Ndi\Interfaces, DefLower, , "ethernet" +HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" +HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% +HKR, Ndi\Params\NetworkAddress, type, 0, "edit" +HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" +HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" +HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% +HKR, Ndi\Params\NetworkAddress, optional, 0, "0" +HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% +HKR, Ndi\Params\MaxSpeed, type, 0, "int" +HKR, Ndi\Params\MaxSpeed, default, 0, "100" +HKR, Ndi\Params\MaxSpeed, min, 0, "0" +HKR, Ndi\Params\MaxSpeed, max, 0, "2000" +HKR, Ndi\Params\MaxSpeed, step, 0, "1" +HKR, Ndi\Params\MaxSpeed, Base, 0, "10" +HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% +HKR, Ndi\Params\KeepLink, type, 0, "enum" +HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% +HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% +HKR, Ndi\Params\KeepLink, default, 0, "0" + + +[Neo.Service] +DisplayName = %Neo.Service.DispName% +Description = %Neo.Service.Desc% +ServiceType = 1 +StartType = 3 +ErrorControl = 1 +ServiceBinary = %12%\Neo_VPN55.sys +LoadOrderGroup = NDIS + +[Neo.Reg] +HKR, Ndi, Service, 0, Neo.Service.Name +HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" +HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" + +[Neo.EventLog] +HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN55.sys" +HKR, , TypesSupported, 0x00010001, 7 + +[Strings] +CompanyName = "SoftEther Corporation" +DiskDescription = "VPN Client Device Driver Install Disk" +Neo.Service.Name = "Neo_VPN55" +Neo.Service.DispName = "VPN Client Device Driver - VPN55" +Neo.Service.Desc = "VPN Client Adapter - VPN55" +NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN55" +Neo.EventLog.Name = "Neo" +NetworkAddress = "MAC Address" +DefaultAddress = "000001000001" +MaxSpeed = "Indicate Speed (Mbps)" +KeepLink = "Keep Link" +On = "On" +Off = "Off" + + +; Auto Generated 20180205_163610.770 + diff --git a/src/bin/hamcore/DriverPackages/Neo6_Win8/x64/Neo6_x64_VPN56.inf b/src/bin/hamcore/DriverPackages/Neo6_Win8/x64/Neo6_x64_VPN56.inf index d5370081..ef4ce613 100644 --- a/src/bin/hamcore/DriverPackages/Neo6_Win8/x64/Neo6_x64_VPN56.inf +++ b/src/bin/hamcore/DriverPackages/Neo6_Win8/x64/Neo6_x64_VPN56.inf @@ -1,114 +1,114 @@ -; VPN Client Device Driver for Windows 2000 and Greater -; -; Copyright (c) SoftEther Corporation. All Rights Reserved. -; http://www.softether.co.jp/ -; -; BUILD 9658 - -[Version] -Signature = "$Windows NT$" -Class = Net -ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} -Provider = %CompanyName% -DriverVer = 02/04/2018, 4.25.0.9658 -CatalogFile.NT = inf_VPN56.cat - -[Manufacturer] -%CompanyName% = SoftEther, NTamd64 - -[SourceDisksNames] -1=%DiskDescription%, "", , - -[SourceDisksFiles] -Neo_VPN56.sys = 1 - -[DestinationDirs] -DefaultDestDir = 12 -Neo.CopyFiles.Sys = 12 - -[Neo.CopyFiles.Sys] -Neo_VPN56.sys, , , 2 - -[SoftEther.NTamd64] -%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN56 - -[NeoAdapter.Install] -Characteristics = 0x1 -AddReg = Neo.Reg, NeoAdapter.Ndi -CopyFiles = Neo.CopyFiles.Sys -*IfType = 53 -*MediaType = 0 -*PhysicalMediaType = 0 - -[NeoAdapter.Install.Services] -AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% - -[NeoAdapter.Ndi] -HKR, , NetworkAddress, 0, %DefaultAddress% -HKR, Ndi, DeviceID, , "NeoAdapter_VPN56" -HKR, , DevLoader, , ndis -HKR, , DeviceVxDs, , Neo_VPN56.sys -HKR, NDIS, LogDriverName, , "Neo_VPN56" -HKR, NDIS, MajorNdisVersion, 1, 5 -HKR, NDIS, MinorNdisVersion, 1, 0 -HKR, Ndi\Interfaces, DefUpper, , "ndis5" -HKR, Ndi\Interfaces, UpperRange, , "ndis5" -HKR, Ndi\Interfaces, LowerRange, , "ethernet" -HKR, Ndi\Interfaces, DefLower, , "ethernet" -HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" -HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% -HKR, Ndi\Params\NetworkAddress, type, 0, "edit" -HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" -HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" -HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% -HKR, Ndi\Params\NetworkAddress, optional, 0, "0" -HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% -HKR, Ndi\Params\MaxSpeed, type, 0, "int" -HKR, Ndi\Params\MaxSpeed, default, 0, "100" -HKR, Ndi\Params\MaxSpeed, min, 0, "0" -HKR, Ndi\Params\MaxSpeed, max, 0, "2000" -HKR, Ndi\Params\MaxSpeed, step, 0, "1" -HKR, Ndi\Params\MaxSpeed, Base, 0, "10" -HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% -HKR, Ndi\Params\KeepLink, type, 0, "enum" -HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% -HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% -HKR, Ndi\Params\KeepLink, default, 0, "0" - - -[Neo.Service] -DisplayName = %Neo.Service.DispName% -Description = %Neo.Service.Desc% -ServiceType = 1 -StartType = 3 -ErrorControl = 1 -ServiceBinary = %12%\Neo_VPN56.sys -LoadOrderGroup = NDIS - -[Neo.Reg] -HKR, Ndi, Service, 0, Neo.Service.Name -HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" -HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" - -[Neo.EventLog] -HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN56.sys" -HKR, , TypesSupported, 0x00010001, 7 - -[Strings] -CompanyName = "SoftEther Corporation" -DiskDescription = "VPN Client Device Driver Install Disk" -Neo.Service.Name = "Neo_VPN56" -Neo.Service.DispName = "VPN Client Device Driver - VPN56" -Neo.Service.Desc = "VPN Client Adapter - VPN56" -NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN56" -Neo.EventLog.Name = "Neo" -NetworkAddress = "MAC Address" -DefaultAddress = "000001000001" -MaxSpeed = "Indicate Speed (Mbps)" -KeepLink = "Keep Link" -On = "On" -Off = "Off" - - -; Auto Generated 20180205_163610.771 - +; VPN Client Device Driver for Windows 2000 and Greater +; +; Copyright (c) SoftEther Corporation. All Rights Reserved. +; http://www.softether.co.jp/ +; +; BUILD 9658 + +[Version] +Signature = "$Windows NT$" +Class = Net +ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} +Provider = %CompanyName% +DriverVer = 02/04/2018, 4.25.0.9658 +CatalogFile.NT = inf_VPN56.cat + +[Manufacturer] +%CompanyName% = SoftEther, NTamd64 + +[SourceDisksNames] +1=%DiskDescription%, "", , + +[SourceDisksFiles] +Neo_VPN56.sys = 1 + +[DestinationDirs] +DefaultDestDir = 12 +Neo.CopyFiles.Sys = 12 + +[Neo.CopyFiles.Sys] +Neo_VPN56.sys, , , 2 + +[SoftEther.NTamd64] +%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN56 + +[NeoAdapter.Install] +Characteristics = 0x1 +AddReg = Neo.Reg, NeoAdapter.Ndi +CopyFiles = Neo.CopyFiles.Sys +*IfType = 53 +*MediaType = 0 +*PhysicalMediaType = 0 + +[NeoAdapter.Install.Services] +AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% + +[NeoAdapter.Ndi] +HKR, , NetworkAddress, 0, %DefaultAddress% +HKR, Ndi, DeviceID, , "NeoAdapter_VPN56" +HKR, , DevLoader, , ndis +HKR, , DeviceVxDs, , Neo_VPN56.sys +HKR, NDIS, LogDriverName, , "Neo_VPN56" +HKR, NDIS, MajorNdisVersion, 1, 5 +HKR, NDIS, MinorNdisVersion, 1, 0 +HKR, Ndi\Interfaces, DefUpper, , "ndis5" +HKR, Ndi\Interfaces, UpperRange, , "ndis5" +HKR, Ndi\Interfaces, LowerRange, , "ethernet" +HKR, Ndi\Interfaces, DefLower, , "ethernet" +HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" +HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% +HKR, Ndi\Params\NetworkAddress, type, 0, "edit" +HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" +HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" +HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% +HKR, Ndi\Params\NetworkAddress, optional, 0, "0" +HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% +HKR, Ndi\Params\MaxSpeed, type, 0, "int" +HKR, Ndi\Params\MaxSpeed, default, 0, "100" +HKR, Ndi\Params\MaxSpeed, min, 0, "0" +HKR, Ndi\Params\MaxSpeed, max, 0, "2000" +HKR, Ndi\Params\MaxSpeed, step, 0, "1" +HKR, Ndi\Params\MaxSpeed, Base, 0, "10" +HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% +HKR, Ndi\Params\KeepLink, type, 0, "enum" +HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% +HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% +HKR, Ndi\Params\KeepLink, default, 0, "0" + + +[Neo.Service] +DisplayName = %Neo.Service.DispName% +Description = %Neo.Service.Desc% +ServiceType = 1 +StartType = 3 +ErrorControl = 1 +ServiceBinary = %12%\Neo_VPN56.sys +LoadOrderGroup = NDIS + +[Neo.Reg] +HKR, Ndi, Service, 0, Neo.Service.Name +HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" +HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" + +[Neo.EventLog] +HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN56.sys" +HKR, , TypesSupported, 0x00010001, 7 + +[Strings] +CompanyName = "SoftEther Corporation" +DiskDescription = "VPN Client Device Driver Install Disk" +Neo.Service.Name = "Neo_VPN56" +Neo.Service.DispName = "VPN Client Device Driver - VPN56" +Neo.Service.Desc = "VPN Client Adapter - VPN56" +NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN56" +Neo.EventLog.Name = "Neo" +NetworkAddress = "MAC Address" +DefaultAddress = "000001000001" +MaxSpeed = "Indicate Speed (Mbps)" +KeepLink = "Keep Link" +On = "On" +Off = "Off" + + +; Auto Generated 20180205_163610.771 + diff --git a/src/bin/hamcore/DriverPackages/Neo6_Win8/x64/Neo6_x64_VPN57.inf b/src/bin/hamcore/DriverPackages/Neo6_Win8/x64/Neo6_x64_VPN57.inf index 3d780c74..1fd04a0a 100644 --- a/src/bin/hamcore/DriverPackages/Neo6_Win8/x64/Neo6_x64_VPN57.inf +++ b/src/bin/hamcore/DriverPackages/Neo6_Win8/x64/Neo6_x64_VPN57.inf @@ -1,114 +1,114 @@ -; VPN Client Device Driver for Windows 2000 and Greater -; -; Copyright (c) SoftEther Corporation. All Rights Reserved. -; http://www.softether.co.jp/ -; -; BUILD 9658 - -[Version] -Signature = "$Windows NT$" -Class = Net -ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} -Provider = %CompanyName% -DriverVer = 02/04/2018, 4.25.0.9658 -CatalogFile.NT = inf_VPN57.cat - -[Manufacturer] -%CompanyName% = SoftEther, NTamd64 - -[SourceDisksNames] -1=%DiskDescription%, "", , - -[SourceDisksFiles] -Neo_VPN57.sys = 1 - -[DestinationDirs] -DefaultDestDir = 12 -Neo.CopyFiles.Sys = 12 - -[Neo.CopyFiles.Sys] -Neo_VPN57.sys, , , 2 - -[SoftEther.NTamd64] -%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN57 - -[NeoAdapter.Install] -Characteristics = 0x1 -AddReg = Neo.Reg, NeoAdapter.Ndi -CopyFiles = Neo.CopyFiles.Sys -*IfType = 53 -*MediaType = 0 -*PhysicalMediaType = 0 - -[NeoAdapter.Install.Services] -AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% - -[NeoAdapter.Ndi] -HKR, , NetworkAddress, 0, %DefaultAddress% -HKR, Ndi, DeviceID, , "NeoAdapter_VPN57" -HKR, , DevLoader, , ndis -HKR, , DeviceVxDs, , Neo_VPN57.sys -HKR, NDIS, LogDriverName, , "Neo_VPN57" -HKR, NDIS, MajorNdisVersion, 1, 5 -HKR, NDIS, MinorNdisVersion, 1, 0 -HKR, Ndi\Interfaces, DefUpper, , "ndis5" -HKR, Ndi\Interfaces, UpperRange, , "ndis5" -HKR, Ndi\Interfaces, LowerRange, , "ethernet" -HKR, Ndi\Interfaces, DefLower, , "ethernet" -HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" -HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% -HKR, Ndi\Params\NetworkAddress, type, 0, "edit" -HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" -HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" -HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% -HKR, Ndi\Params\NetworkAddress, optional, 0, "0" -HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% -HKR, Ndi\Params\MaxSpeed, type, 0, "int" -HKR, Ndi\Params\MaxSpeed, default, 0, "100" -HKR, Ndi\Params\MaxSpeed, min, 0, "0" -HKR, Ndi\Params\MaxSpeed, max, 0, "2000" -HKR, Ndi\Params\MaxSpeed, step, 0, "1" -HKR, Ndi\Params\MaxSpeed, Base, 0, "10" -HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% -HKR, Ndi\Params\KeepLink, type, 0, "enum" -HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% -HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% -HKR, Ndi\Params\KeepLink, default, 0, "0" - - -[Neo.Service] -DisplayName = %Neo.Service.DispName% -Description = %Neo.Service.Desc% -ServiceType = 1 -StartType = 3 -ErrorControl = 1 -ServiceBinary = %12%\Neo_VPN57.sys -LoadOrderGroup = NDIS - -[Neo.Reg] -HKR, Ndi, Service, 0, Neo.Service.Name -HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" -HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" - -[Neo.EventLog] -HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN57.sys" -HKR, , TypesSupported, 0x00010001, 7 - -[Strings] -CompanyName = "SoftEther Corporation" -DiskDescription = "VPN Client Device Driver Install Disk" -Neo.Service.Name = "Neo_VPN57" -Neo.Service.DispName = "VPN Client Device Driver - VPN57" -Neo.Service.Desc = "VPN Client Adapter - VPN57" -NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN57" -Neo.EventLog.Name = "Neo" -NetworkAddress = "MAC Address" -DefaultAddress = "000001000001" -MaxSpeed = "Indicate Speed (Mbps)" -KeepLink = "Keep Link" -On = "On" -Off = "Off" - - -; Auto Generated 20180205_163610.771 - +; VPN Client Device Driver for Windows 2000 and Greater +; +; Copyright (c) SoftEther Corporation. All Rights Reserved. +; http://www.softether.co.jp/ +; +; BUILD 9658 + +[Version] +Signature = "$Windows NT$" +Class = Net +ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} +Provider = %CompanyName% +DriverVer = 02/04/2018, 4.25.0.9658 +CatalogFile.NT = inf_VPN57.cat + +[Manufacturer] +%CompanyName% = SoftEther, NTamd64 + +[SourceDisksNames] +1=%DiskDescription%, "", , + +[SourceDisksFiles] +Neo_VPN57.sys = 1 + +[DestinationDirs] +DefaultDestDir = 12 +Neo.CopyFiles.Sys = 12 + +[Neo.CopyFiles.Sys] +Neo_VPN57.sys, , , 2 + +[SoftEther.NTamd64] +%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN57 + +[NeoAdapter.Install] +Characteristics = 0x1 +AddReg = Neo.Reg, NeoAdapter.Ndi +CopyFiles = Neo.CopyFiles.Sys +*IfType = 53 +*MediaType = 0 +*PhysicalMediaType = 0 + +[NeoAdapter.Install.Services] +AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% + +[NeoAdapter.Ndi] +HKR, , NetworkAddress, 0, %DefaultAddress% +HKR, Ndi, DeviceID, , "NeoAdapter_VPN57" +HKR, , DevLoader, , ndis +HKR, , DeviceVxDs, , Neo_VPN57.sys +HKR, NDIS, LogDriverName, , "Neo_VPN57" +HKR, NDIS, MajorNdisVersion, 1, 5 +HKR, NDIS, MinorNdisVersion, 1, 0 +HKR, Ndi\Interfaces, DefUpper, , "ndis5" +HKR, Ndi\Interfaces, UpperRange, , "ndis5" +HKR, Ndi\Interfaces, LowerRange, , "ethernet" +HKR, Ndi\Interfaces, DefLower, , "ethernet" +HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" +HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% +HKR, Ndi\Params\NetworkAddress, type, 0, "edit" +HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" +HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" +HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% +HKR, Ndi\Params\NetworkAddress, optional, 0, "0" +HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% +HKR, Ndi\Params\MaxSpeed, type, 0, "int" +HKR, Ndi\Params\MaxSpeed, default, 0, "100" +HKR, Ndi\Params\MaxSpeed, min, 0, "0" +HKR, Ndi\Params\MaxSpeed, max, 0, "2000" +HKR, Ndi\Params\MaxSpeed, step, 0, "1" +HKR, Ndi\Params\MaxSpeed, Base, 0, "10" +HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% +HKR, Ndi\Params\KeepLink, type, 0, "enum" +HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% +HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% +HKR, Ndi\Params\KeepLink, default, 0, "0" + + +[Neo.Service] +DisplayName = %Neo.Service.DispName% +Description = %Neo.Service.Desc% +ServiceType = 1 +StartType = 3 +ErrorControl = 1 +ServiceBinary = %12%\Neo_VPN57.sys +LoadOrderGroup = NDIS + +[Neo.Reg] +HKR, Ndi, Service, 0, Neo.Service.Name +HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" +HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" + +[Neo.EventLog] +HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN57.sys" +HKR, , TypesSupported, 0x00010001, 7 + +[Strings] +CompanyName = "SoftEther Corporation" +DiskDescription = "VPN Client Device Driver Install Disk" +Neo.Service.Name = "Neo_VPN57" +Neo.Service.DispName = "VPN Client Device Driver - VPN57" +Neo.Service.Desc = "VPN Client Adapter - VPN57" +NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN57" +Neo.EventLog.Name = "Neo" +NetworkAddress = "MAC Address" +DefaultAddress = "000001000001" +MaxSpeed = "Indicate Speed (Mbps)" +KeepLink = "Keep Link" +On = "On" +Off = "Off" + + +; Auto Generated 20180205_163610.771 + diff --git a/src/bin/hamcore/DriverPackages/Neo6_Win8/x64/Neo6_x64_VPN58.inf b/src/bin/hamcore/DriverPackages/Neo6_Win8/x64/Neo6_x64_VPN58.inf index f69de8db..7cdf68cb 100644 --- a/src/bin/hamcore/DriverPackages/Neo6_Win8/x64/Neo6_x64_VPN58.inf +++ b/src/bin/hamcore/DriverPackages/Neo6_Win8/x64/Neo6_x64_VPN58.inf @@ -1,114 +1,114 @@ -; VPN Client Device Driver for Windows 2000 and Greater -; -; Copyright (c) SoftEther Corporation. All Rights Reserved. -; http://www.softether.co.jp/ -; -; BUILD 9658 - -[Version] -Signature = "$Windows NT$" -Class = Net -ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} -Provider = %CompanyName% -DriverVer = 02/04/2018, 4.25.0.9658 -CatalogFile.NT = inf_VPN58.cat - -[Manufacturer] -%CompanyName% = SoftEther, NTamd64 - -[SourceDisksNames] -1=%DiskDescription%, "", , - -[SourceDisksFiles] -Neo_VPN58.sys = 1 - -[DestinationDirs] -DefaultDestDir = 12 -Neo.CopyFiles.Sys = 12 - -[Neo.CopyFiles.Sys] -Neo_VPN58.sys, , , 2 - -[SoftEther.NTamd64] -%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN58 - -[NeoAdapter.Install] -Characteristics = 0x1 -AddReg = Neo.Reg, NeoAdapter.Ndi -CopyFiles = Neo.CopyFiles.Sys -*IfType = 53 -*MediaType = 0 -*PhysicalMediaType = 0 - -[NeoAdapter.Install.Services] -AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% - -[NeoAdapter.Ndi] -HKR, , NetworkAddress, 0, %DefaultAddress% -HKR, Ndi, DeviceID, , "NeoAdapter_VPN58" -HKR, , DevLoader, , ndis -HKR, , DeviceVxDs, , Neo_VPN58.sys -HKR, NDIS, LogDriverName, , "Neo_VPN58" -HKR, NDIS, MajorNdisVersion, 1, 5 -HKR, NDIS, MinorNdisVersion, 1, 0 -HKR, Ndi\Interfaces, DefUpper, , "ndis5" -HKR, Ndi\Interfaces, UpperRange, , "ndis5" -HKR, Ndi\Interfaces, LowerRange, , "ethernet" -HKR, Ndi\Interfaces, DefLower, , "ethernet" -HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" -HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% -HKR, Ndi\Params\NetworkAddress, type, 0, "edit" -HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" -HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" -HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% -HKR, Ndi\Params\NetworkAddress, optional, 0, "0" -HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% -HKR, Ndi\Params\MaxSpeed, type, 0, "int" -HKR, Ndi\Params\MaxSpeed, default, 0, "100" -HKR, Ndi\Params\MaxSpeed, min, 0, "0" -HKR, Ndi\Params\MaxSpeed, max, 0, "2000" -HKR, Ndi\Params\MaxSpeed, step, 0, "1" -HKR, Ndi\Params\MaxSpeed, Base, 0, "10" -HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% -HKR, Ndi\Params\KeepLink, type, 0, "enum" -HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% -HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% -HKR, Ndi\Params\KeepLink, default, 0, "0" - - -[Neo.Service] -DisplayName = %Neo.Service.DispName% -Description = %Neo.Service.Desc% -ServiceType = 1 -StartType = 3 -ErrorControl = 1 -ServiceBinary = %12%\Neo_VPN58.sys -LoadOrderGroup = NDIS - -[Neo.Reg] -HKR, Ndi, Service, 0, Neo.Service.Name -HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" -HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" - -[Neo.EventLog] -HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN58.sys" -HKR, , TypesSupported, 0x00010001, 7 - -[Strings] -CompanyName = "SoftEther Corporation" -DiskDescription = "VPN Client Device Driver Install Disk" -Neo.Service.Name = "Neo_VPN58" -Neo.Service.DispName = "VPN Client Device Driver - VPN58" -Neo.Service.Desc = "VPN Client Adapter - VPN58" -NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN58" -Neo.EventLog.Name = "Neo" -NetworkAddress = "MAC Address" -DefaultAddress = "000001000001" -MaxSpeed = "Indicate Speed (Mbps)" -KeepLink = "Keep Link" -On = "On" -Off = "Off" - - -; Auto Generated 20180205_163610.772 - +; VPN Client Device Driver for Windows 2000 and Greater +; +; Copyright (c) SoftEther Corporation. All Rights Reserved. +; http://www.softether.co.jp/ +; +; BUILD 9658 + +[Version] +Signature = "$Windows NT$" +Class = Net +ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} +Provider = %CompanyName% +DriverVer = 02/04/2018, 4.25.0.9658 +CatalogFile.NT = inf_VPN58.cat + +[Manufacturer] +%CompanyName% = SoftEther, NTamd64 + +[SourceDisksNames] +1=%DiskDescription%, "", , + +[SourceDisksFiles] +Neo_VPN58.sys = 1 + +[DestinationDirs] +DefaultDestDir = 12 +Neo.CopyFiles.Sys = 12 + +[Neo.CopyFiles.Sys] +Neo_VPN58.sys, , , 2 + +[SoftEther.NTamd64] +%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN58 + +[NeoAdapter.Install] +Characteristics = 0x1 +AddReg = Neo.Reg, NeoAdapter.Ndi +CopyFiles = Neo.CopyFiles.Sys +*IfType = 53 +*MediaType = 0 +*PhysicalMediaType = 0 + +[NeoAdapter.Install.Services] +AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% + +[NeoAdapter.Ndi] +HKR, , NetworkAddress, 0, %DefaultAddress% +HKR, Ndi, DeviceID, , "NeoAdapter_VPN58" +HKR, , DevLoader, , ndis +HKR, , DeviceVxDs, , Neo_VPN58.sys +HKR, NDIS, LogDriverName, , "Neo_VPN58" +HKR, NDIS, MajorNdisVersion, 1, 5 +HKR, NDIS, MinorNdisVersion, 1, 0 +HKR, Ndi\Interfaces, DefUpper, , "ndis5" +HKR, Ndi\Interfaces, UpperRange, , "ndis5" +HKR, Ndi\Interfaces, LowerRange, , "ethernet" +HKR, Ndi\Interfaces, DefLower, , "ethernet" +HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" +HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% +HKR, Ndi\Params\NetworkAddress, type, 0, "edit" +HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" +HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" +HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% +HKR, Ndi\Params\NetworkAddress, optional, 0, "0" +HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% +HKR, Ndi\Params\MaxSpeed, type, 0, "int" +HKR, Ndi\Params\MaxSpeed, default, 0, "100" +HKR, Ndi\Params\MaxSpeed, min, 0, "0" +HKR, Ndi\Params\MaxSpeed, max, 0, "2000" +HKR, Ndi\Params\MaxSpeed, step, 0, "1" +HKR, Ndi\Params\MaxSpeed, Base, 0, "10" +HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% +HKR, Ndi\Params\KeepLink, type, 0, "enum" +HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% +HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% +HKR, Ndi\Params\KeepLink, default, 0, "0" + + +[Neo.Service] +DisplayName = %Neo.Service.DispName% +Description = %Neo.Service.Desc% +ServiceType = 1 +StartType = 3 +ErrorControl = 1 +ServiceBinary = %12%\Neo_VPN58.sys +LoadOrderGroup = NDIS + +[Neo.Reg] +HKR, Ndi, Service, 0, Neo.Service.Name +HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" +HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" + +[Neo.EventLog] +HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN58.sys" +HKR, , TypesSupported, 0x00010001, 7 + +[Strings] +CompanyName = "SoftEther Corporation" +DiskDescription = "VPN Client Device Driver Install Disk" +Neo.Service.Name = "Neo_VPN58" +Neo.Service.DispName = "VPN Client Device Driver - VPN58" +Neo.Service.Desc = "VPN Client Adapter - VPN58" +NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN58" +Neo.EventLog.Name = "Neo" +NetworkAddress = "MAC Address" +DefaultAddress = "000001000001" +MaxSpeed = "Indicate Speed (Mbps)" +KeepLink = "Keep Link" +On = "On" +Off = "Off" + + +; Auto Generated 20180205_163610.772 + diff --git a/src/bin/hamcore/DriverPackages/Neo6_Win8/x64/Neo6_x64_VPN59.inf b/src/bin/hamcore/DriverPackages/Neo6_Win8/x64/Neo6_x64_VPN59.inf index 75a48c71..0bc811bb 100644 --- a/src/bin/hamcore/DriverPackages/Neo6_Win8/x64/Neo6_x64_VPN59.inf +++ b/src/bin/hamcore/DriverPackages/Neo6_Win8/x64/Neo6_x64_VPN59.inf @@ -1,114 +1,114 @@ -; VPN Client Device Driver for Windows 2000 and Greater -; -; Copyright (c) SoftEther Corporation. All Rights Reserved. -; http://www.softether.co.jp/ -; -; BUILD 9658 - -[Version] -Signature = "$Windows NT$" -Class = Net -ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} -Provider = %CompanyName% -DriverVer = 02/04/2018, 4.25.0.9658 -CatalogFile.NT = inf_VPN59.cat - -[Manufacturer] -%CompanyName% = SoftEther, NTamd64 - -[SourceDisksNames] -1=%DiskDescription%, "", , - -[SourceDisksFiles] -Neo_VPN59.sys = 1 - -[DestinationDirs] -DefaultDestDir = 12 -Neo.CopyFiles.Sys = 12 - -[Neo.CopyFiles.Sys] -Neo_VPN59.sys, , , 2 - -[SoftEther.NTamd64] -%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN59 - -[NeoAdapter.Install] -Characteristics = 0x1 -AddReg = Neo.Reg, NeoAdapter.Ndi -CopyFiles = Neo.CopyFiles.Sys -*IfType = 53 -*MediaType = 0 -*PhysicalMediaType = 0 - -[NeoAdapter.Install.Services] -AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% - -[NeoAdapter.Ndi] -HKR, , NetworkAddress, 0, %DefaultAddress% -HKR, Ndi, DeviceID, , "NeoAdapter_VPN59" -HKR, , DevLoader, , ndis -HKR, , DeviceVxDs, , Neo_VPN59.sys -HKR, NDIS, LogDriverName, , "Neo_VPN59" -HKR, NDIS, MajorNdisVersion, 1, 5 -HKR, NDIS, MinorNdisVersion, 1, 0 -HKR, Ndi\Interfaces, DefUpper, , "ndis5" -HKR, Ndi\Interfaces, UpperRange, , "ndis5" -HKR, Ndi\Interfaces, LowerRange, , "ethernet" -HKR, Ndi\Interfaces, DefLower, , "ethernet" -HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" -HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% -HKR, Ndi\Params\NetworkAddress, type, 0, "edit" -HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" -HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" -HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% -HKR, Ndi\Params\NetworkAddress, optional, 0, "0" -HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% -HKR, Ndi\Params\MaxSpeed, type, 0, "int" -HKR, Ndi\Params\MaxSpeed, default, 0, "100" -HKR, Ndi\Params\MaxSpeed, min, 0, "0" -HKR, Ndi\Params\MaxSpeed, max, 0, "2000" -HKR, Ndi\Params\MaxSpeed, step, 0, "1" -HKR, Ndi\Params\MaxSpeed, Base, 0, "10" -HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% -HKR, Ndi\Params\KeepLink, type, 0, "enum" -HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% -HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% -HKR, Ndi\Params\KeepLink, default, 0, "0" - - -[Neo.Service] -DisplayName = %Neo.Service.DispName% -Description = %Neo.Service.Desc% -ServiceType = 1 -StartType = 3 -ErrorControl = 1 -ServiceBinary = %12%\Neo_VPN59.sys -LoadOrderGroup = NDIS - -[Neo.Reg] -HKR, Ndi, Service, 0, Neo.Service.Name -HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" -HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" - -[Neo.EventLog] -HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN59.sys" -HKR, , TypesSupported, 0x00010001, 7 - -[Strings] -CompanyName = "SoftEther Corporation" -DiskDescription = "VPN Client Device Driver Install Disk" -Neo.Service.Name = "Neo_VPN59" -Neo.Service.DispName = "VPN Client Device Driver - VPN59" -Neo.Service.Desc = "VPN Client Adapter - VPN59" -NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN59" -Neo.EventLog.Name = "Neo" -NetworkAddress = "MAC Address" -DefaultAddress = "000001000001" -MaxSpeed = "Indicate Speed (Mbps)" -KeepLink = "Keep Link" -On = "On" -Off = "Off" - - -; Auto Generated 20180205_163610.772 - +; VPN Client Device Driver for Windows 2000 and Greater +; +; Copyright (c) SoftEther Corporation. All Rights Reserved. +; http://www.softether.co.jp/ +; +; BUILD 9658 + +[Version] +Signature = "$Windows NT$" +Class = Net +ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} +Provider = %CompanyName% +DriverVer = 02/04/2018, 4.25.0.9658 +CatalogFile.NT = inf_VPN59.cat + +[Manufacturer] +%CompanyName% = SoftEther, NTamd64 + +[SourceDisksNames] +1=%DiskDescription%, "", , + +[SourceDisksFiles] +Neo_VPN59.sys = 1 + +[DestinationDirs] +DefaultDestDir = 12 +Neo.CopyFiles.Sys = 12 + +[Neo.CopyFiles.Sys] +Neo_VPN59.sys, , , 2 + +[SoftEther.NTamd64] +%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN59 + +[NeoAdapter.Install] +Characteristics = 0x1 +AddReg = Neo.Reg, NeoAdapter.Ndi +CopyFiles = Neo.CopyFiles.Sys +*IfType = 53 +*MediaType = 0 +*PhysicalMediaType = 0 + +[NeoAdapter.Install.Services] +AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% + +[NeoAdapter.Ndi] +HKR, , NetworkAddress, 0, %DefaultAddress% +HKR, Ndi, DeviceID, , "NeoAdapter_VPN59" +HKR, , DevLoader, , ndis +HKR, , DeviceVxDs, , Neo_VPN59.sys +HKR, NDIS, LogDriverName, , "Neo_VPN59" +HKR, NDIS, MajorNdisVersion, 1, 5 +HKR, NDIS, MinorNdisVersion, 1, 0 +HKR, Ndi\Interfaces, DefUpper, , "ndis5" +HKR, Ndi\Interfaces, UpperRange, , "ndis5" +HKR, Ndi\Interfaces, LowerRange, , "ethernet" +HKR, Ndi\Interfaces, DefLower, , "ethernet" +HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" +HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% +HKR, Ndi\Params\NetworkAddress, type, 0, "edit" +HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" +HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" +HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% +HKR, Ndi\Params\NetworkAddress, optional, 0, "0" +HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% +HKR, Ndi\Params\MaxSpeed, type, 0, "int" +HKR, Ndi\Params\MaxSpeed, default, 0, "100" +HKR, Ndi\Params\MaxSpeed, min, 0, "0" +HKR, Ndi\Params\MaxSpeed, max, 0, "2000" +HKR, Ndi\Params\MaxSpeed, step, 0, "1" +HKR, Ndi\Params\MaxSpeed, Base, 0, "10" +HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% +HKR, Ndi\Params\KeepLink, type, 0, "enum" +HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% +HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% +HKR, Ndi\Params\KeepLink, default, 0, "0" + + +[Neo.Service] +DisplayName = %Neo.Service.DispName% +Description = %Neo.Service.Desc% +ServiceType = 1 +StartType = 3 +ErrorControl = 1 +ServiceBinary = %12%\Neo_VPN59.sys +LoadOrderGroup = NDIS + +[Neo.Reg] +HKR, Ndi, Service, 0, Neo.Service.Name +HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" +HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" + +[Neo.EventLog] +HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN59.sys" +HKR, , TypesSupported, 0x00010001, 7 + +[Strings] +CompanyName = "SoftEther Corporation" +DiskDescription = "VPN Client Device Driver Install Disk" +Neo.Service.Name = "Neo_VPN59" +Neo.Service.DispName = "VPN Client Device Driver - VPN59" +Neo.Service.Desc = "VPN Client Adapter - VPN59" +NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN59" +Neo.EventLog.Name = "Neo" +NetworkAddress = "MAC Address" +DefaultAddress = "000001000001" +MaxSpeed = "Indicate Speed (Mbps)" +KeepLink = "Keep Link" +On = "On" +Off = "Off" + + +; Auto Generated 20180205_163610.772 + diff --git a/src/bin/hamcore/DriverPackages/Neo6_Win8/x64/Neo6_x64_VPN6.inf b/src/bin/hamcore/DriverPackages/Neo6_Win8/x64/Neo6_x64_VPN6.inf index 036af7f2..57884461 100644 --- a/src/bin/hamcore/DriverPackages/Neo6_Win8/x64/Neo6_x64_VPN6.inf +++ b/src/bin/hamcore/DriverPackages/Neo6_Win8/x64/Neo6_x64_VPN6.inf @@ -1,114 +1,114 @@ -; VPN Client Device Driver for Windows 2000 and Greater -; -; Copyright (c) SoftEther Corporation. All Rights Reserved. -; http://www.softether.co.jp/ -; -; BUILD 9658 - -[Version] -Signature = "$Windows NT$" -Class = Net -ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} -Provider = %CompanyName% -DriverVer = 02/04/2018, 4.25.0.9658 -CatalogFile.NT = inf_VPN6.cat - -[Manufacturer] -%CompanyName% = SoftEther, NTamd64 - -[SourceDisksNames] -1=%DiskDescription%, "", , - -[SourceDisksFiles] -Neo_VPN6.sys = 1 - -[DestinationDirs] -DefaultDestDir = 12 -Neo.CopyFiles.Sys = 12 - -[Neo.CopyFiles.Sys] -Neo_VPN6.sys, , , 2 - -[SoftEther.NTamd64] -%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN6 - -[NeoAdapter.Install] -Characteristics = 0x1 -AddReg = Neo.Reg, NeoAdapter.Ndi -CopyFiles = Neo.CopyFiles.Sys -*IfType = 53 -*MediaType = 0 -*PhysicalMediaType = 0 - -[NeoAdapter.Install.Services] -AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% - -[NeoAdapter.Ndi] -HKR, , NetworkAddress, 0, %DefaultAddress% -HKR, Ndi, DeviceID, , "NeoAdapter_VPN6" -HKR, , DevLoader, , ndis -HKR, , DeviceVxDs, , Neo_VPN6.sys -HKR, NDIS, LogDriverName, , "Neo_VPN6" -HKR, NDIS, MajorNdisVersion, 1, 5 -HKR, NDIS, MinorNdisVersion, 1, 0 -HKR, Ndi\Interfaces, DefUpper, , "ndis5" -HKR, Ndi\Interfaces, UpperRange, , "ndis5" -HKR, Ndi\Interfaces, LowerRange, , "ethernet" -HKR, Ndi\Interfaces, DefLower, , "ethernet" -HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" -HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% -HKR, Ndi\Params\NetworkAddress, type, 0, "edit" -HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" -HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" -HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% -HKR, Ndi\Params\NetworkAddress, optional, 0, "0" -HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% -HKR, Ndi\Params\MaxSpeed, type, 0, "int" -HKR, Ndi\Params\MaxSpeed, default, 0, "100" -HKR, Ndi\Params\MaxSpeed, min, 0, "0" -HKR, Ndi\Params\MaxSpeed, max, 0, "2000" -HKR, Ndi\Params\MaxSpeed, step, 0, "1" -HKR, Ndi\Params\MaxSpeed, Base, 0, "10" -HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% -HKR, Ndi\Params\KeepLink, type, 0, "enum" -HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% -HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% -HKR, Ndi\Params\KeepLink, default, 0, "0" - - -[Neo.Service] -DisplayName = %Neo.Service.DispName% -Description = %Neo.Service.Desc% -ServiceType = 1 -StartType = 3 -ErrorControl = 1 -ServiceBinary = %12%\Neo_VPN6.sys -LoadOrderGroup = NDIS - -[Neo.Reg] -HKR, Ndi, Service, 0, Neo.Service.Name -HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" -HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" - -[Neo.EventLog] -HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN6.sys" -HKR, , TypesSupported, 0x00010001, 7 - -[Strings] -CompanyName = "SoftEther Corporation" -DiskDescription = "VPN Client Device Driver Install Disk" -Neo.Service.Name = "Neo_VPN6" -Neo.Service.DispName = "VPN Client Device Driver - VPN6" -Neo.Service.Desc = "VPN Client Adapter - VPN6" -NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN6" -Neo.EventLog.Name = "Neo" -NetworkAddress = "MAC Address" -DefaultAddress = "000001000001" -MaxSpeed = "Indicate Speed (Mbps)" -KeepLink = "Keep Link" -On = "On" -Off = "Off" - - -; Auto Generated 20180205_163610.741 - +; VPN Client Device Driver for Windows 2000 and Greater +; +; Copyright (c) SoftEther Corporation. All Rights Reserved. +; http://www.softether.co.jp/ +; +; BUILD 9658 + +[Version] +Signature = "$Windows NT$" +Class = Net +ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} +Provider = %CompanyName% +DriverVer = 02/04/2018, 4.25.0.9658 +CatalogFile.NT = inf_VPN6.cat + +[Manufacturer] +%CompanyName% = SoftEther, NTamd64 + +[SourceDisksNames] +1=%DiskDescription%, "", , + +[SourceDisksFiles] +Neo_VPN6.sys = 1 + +[DestinationDirs] +DefaultDestDir = 12 +Neo.CopyFiles.Sys = 12 + +[Neo.CopyFiles.Sys] +Neo_VPN6.sys, , , 2 + +[SoftEther.NTamd64] +%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN6 + +[NeoAdapter.Install] +Characteristics = 0x1 +AddReg = Neo.Reg, NeoAdapter.Ndi +CopyFiles = Neo.CopyFiles.Sys +*IfType = 53 +*MediaType = 0 +*PhysicalMediaType = 0 + +[NeoAdapter.Install.Services] +AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% + +[NeoAdapter.Ndi] +HKR, , NetworkAddress, 0, %DefaultAddress% +HKR, Ndi, DeviceID, , "NeoAdapter_VPN6" +HKR, , DevLoader, , ndis +HKR, , DeviceVxDs, , Neo_VPN6.sys +HKR, NDIS, LogDriverName, , "Neo_VPN6" +HKR, NDIS, MajorNdisVersion, 1, 5 +HKR, NDIS, MinorNdisVersion, 1, 0 +HKR, Ndi\Interfaces, DefUpper, , "ndis5" +HKR, Ndi\Interfaces, UpperRange, , "ndis5" +HKR, Ndi\Interfaces, LowerRange, , "ethernet" +HKR, Ndi\Interfaces, DefLower, , "ethernet" +HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" +HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% +HKR, Ndi\Params\NetworkAddress, type, 0, "edit" +HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" +HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" +HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% +HKR, Ndi\Params\NetworkAddress, optional, 0, "0" +HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% +HKR, Ndi\Params\MaxSpeed, type, 0, "int" +HKR, Ndi\Params\MaxSpeed, default, 0, "100" +HKR, Ndi\Params\MaxSpeed, min, 0, "0" +HKR, Ndi\Params\MaxSpeed, max, 0, "2000" +HKR, Ndi\Params\MaxSpeed, step, 0, "1" +HKR, Ndi\Params\MaxSpeed, Base, 0, "10" +HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% +HKR, Ndi\Params\KeepLink, type, 0, "enum" +HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% +HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% +HKR, Ndi\Params\KeepLink, default, 0, "0" + + +[Neo.Service] +DisplayName = %Neo.Service.DispName% +Description = %Neo.Service.Desc% +ServiceType = 1 +StartType = 3 +ErrorControl = 1 +ServiceBinary = %12%\Neo_VPN6.sys +LoadOrderGroup = NDIS + +[Neo.Reg] +HKR, Ndi, Service, 0, Neo.Service.Name +HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" +HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" + +[Neo.EventLog] +HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN6.sys" +HKR, , TypesSupported, 0x00010001, 7 + +[Strings] +CompanyName = "SoftEther Corporation" +DiskDescription = "VPN Client Device Driver Install Disk" +Neo.Service.Name = "Neo_VPN6" +Neo.Service.DispName = "VPN Client Device Driver - VPN6" +Neo.Service.Desc = "VPN Client Adapter - VPN6" +NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN6" +Neo.EventLog.Name = "Neo" +NetworkAddress = "MAC Address" +DefaultAddress = "000001000001" +MaxSpeed = "Indicate Speed (Mbps)" +KeepLink = "Keep Link" +On = "On" +Off = "Off" + + +; Auto Generated 20180205_163610.741 + diff --git a/src/bin/hamcore/DriverPackages/Neo6_Win8/x64/Neo6_x64_VPN60.inf b/src/bin/hamcore/DriverPackages/Neo6_Win8/x64/Neo6_x64_VPN60.inf index f9c5b5d0..a76bd897 100644 --- a/src/bin/hamcore/DriverPackages/Neo6_Win8/x64/Neo6_x64_VPN60.inf +++ b/src/bin/hamcore/DriverPackages/Neo6_Win8/x64/Neo6_x64_VPN60.inf @@ -1,114 +1,114 @@ -; VPN Client Device Driver for Windows 2000 and Greater -; -; Copyright (c) SoftEther Corporation. All Rights Reserved. -; http://www.softether.co.jp/ -; -; BUILD 9658 - -[Version] -Signature = "$Windows NT$" -Class = Net -ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} -Provider = %CompanyName% -DriverVer = 02/04/2018, 4.25.0.9658 -CatalogFile.NT = inf_VPN60.cat - -[Manufacturer] -%CompanyName% = SoftEther, NTamd64 - -[SourceDisksNames] -1=%DiskDescription%, "", , - -[SourceDisksFiles] -Neo_VPN60.sys = 1 - -[DestinationDirs] -DefaultDestDir = 12 -Neo.CopyFiles.Sys = 12 - -[Neo.CopyFiles.Sys] -Neo_VPN60.sys, , , 2 - -[SoftEther.NTamd64] -%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN60 - -[NeoAdapter.Install] -Characteristics = 0x1 -AddReg = Neo.Reg, NeoAdapter.Ndi -CopyFiles = Neo.CopyFiles.Sys -*IfType = 53 -*MediaType = 0 -*PhysicalMediaType = 0 - -[NeoAdapter.Install.Services] -AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% - -[NeoAdapter.Ndi] -HKR, , NetworkAddress, 0, %DefaultAddress% -HKR, Ndi, DeviceID, , "NeoAdapter_VPN60" -HKR, , DevLoader, , ndis -HKR, , DeviceVxDs, , Neo_VPN60.sys -HKR, NDIS, LogDriverName, , "Neo_VPN60" -HKR, NDIS, MajorNdisVersion, 1, 5 -HKR, NDIS, MinorNdisVersion, 1, 0 -HKR, Ndi\Interfaces, DefUpper, , "ndis5" -HKR, Ndi\Interfaces, UpperRange, , "ndis5" -HKR, Ndi\Interfaces, LowerRange, , "ethernet" -HKR, Ndi\Interfaces, DefLower, , "ethernet" -HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" -HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% -HKR, Ndi\Params\NetworkAddress, type, 0, "edit" -HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" -HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" -HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% -HKR, Ndi\Params\NetworkAddress, optional, 0, "0" -HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% -HKR, Ndi\Params\MaxSpeed, type, 0, "int" -HKR, Ndi\Params\MaxSpeed, default, 0, "100" -HKR, Ndi\Params\MaxSpeed, min, 0, "0" -HKR, Ndi\Params\MaxSpeed, max, 0, "2000" -HKR, Ndi\Params\MaxSpeed, step, 0, "1" -HKR, Ndi\Params\MaxSpeed, Base, 0, "10" -HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% -HKR, Ndi\Params\KeepLink, type, 0, "enum" -HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% -HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% -HKR, Ndi\Params\KeepLink, default, 0, "0" - - -[Neo.Service] -DisplayName = %Neo.Service.DispName% -Description = %Neo.Service.Desc% -ServiceType = 1 -StartType = 3 -ErrorControl = 1 -ServiceBinary = %12%\Neo_VPN60.sys -LoadOrderGroup = NDIS - -[Neo.Reg] -HKR, Ndi, Service, 0, Neo.Service.Name -HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" -HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" - -[Neo.EventLog] -HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN60.sys" -HKR, , TypesSupported, 0x00010001, 7 - -[Strings] -CompanyName = "SoftEther Corporation" -DiskDescription = "VPN Client Device Driver Install Disk" -Neo.Service.Name = "Neo_VPN60" -Neo.Service.DispName = "VPN Client Device Driver - VPN60" -Neo.Service.Desc = "VPN Client Adapter - VPN60" -NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN60" -Neo.EventLog.Name = "Neo" -NetworkAddress = "MAC Address" -DefaultAddress = "000001000001" -MaxSpeed = "Indicate Speed (Mbps)" -KeepLink = "Keep Link" -On = "On" -Off = "Off" - - -; Auto Generated 20180205_163610.773 - +; VPN Client Device Driver for Windows 2000 and Greater +; +; Copyright (c) SoftEther Corporation. All Rights Reserved. +; http://www.softether.co.jp/ +; +; BUILD 9658 + +[Version] +Signature = "$Windows NT$" +Class = Net +ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} +Provider = %CompanyName% +DriverVer = 02/04/2018, 4.25.0.9658 +CatalogFile.NT = inf_VPN60.cat + +[Manufacturer] +%CompanyName% = SoftEther, NTamd64 + +[SourceDisksNames] +1=%DiskDescription%, "", , + +[SourceDisksFiles] +Neo_VPN60.sys = 1 + +[DestinationDirs] +DefaultDestDir = 12 +Neo.CopyFiles.Sys = 12 + +[Neo.CopyFiles.Sys] +Neo_VPN60.sys, , , 2 + +[SoftEther.NTamd64] +%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN60 + +[NeoAdapter.Install] +Characteristics = 0x1 +AddReg = Neo.Reg, NeoAdapter.Ndi +CopyFiles = Neo.CopyFiles.Sys +*IfType = 53 +*MediaType = 0 +*PhysicalMediaType = 0 + +[NeoAdapter.Install.Services] +AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% + +[NeoAdapter.Ndi] +HKR, , NetworkAddress, 0, %DefaultAddress% +HKR, Ndi, DeviceID, , "NeoAdapter_VPN60" +HKR, , DevLoader, , ndis +HKR, , DeviceVxDs, , Neo_VPN60.sys +HKR, NDIS, LogDriverName, , "Neo_VPN60" +HKR, NDIS, MajorNdisVersion, 1, 5 +HKR, NDIS, MinorNdisVersion, 1, 0 +HKR, Ndi\Interfaces, DefUpper, , "ndis5" +HKR, Ndi\Interfaces, UpperRange, , "ndis5" +HKR, Ndi\Interfaces, LowerRange, , "ethernet" +HKR, Ndi\Interfaces, DefLower, , "ethernet" +HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" +HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% +HKR, Ndi\Params\NetworkAddress, type, 0, "edit" +HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" +HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" +HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% +HKR, Ndi\Params\NetworkAddress, optional, 0, "0" +HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% +HKR, Ndi\Params\MaxSpeed, type, 0, "int" +HKR, Ndi\Params\MaxSpeed, default, 0, "100" +HKR, Ndi\Params\MaxSpeed, min, 0, "0" +HKR, Ndi\Params\MaxSpeed, max, 0, "2000" +HKR, Ndi\Params\MaxSpeed, step, 0, "1" +HKR, Ndi\Params\MaxSpeed, Base, 0, "10" +HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% +HKR, Ndi\Params\KeepLink, type, 0, "enum" +HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% +HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% +HKR, Ndi\Params\KeepLink, default, 0, "0" + + +[Neo.Service] +DisplayName = %Neo.Service.DispName% +Description = %Neo.Service.Desc% +ServiceType = 1 +StartType = 3 +ErrorControl = 1 +ServiceBinary = %12%\Neo_VPN60.sys +LoadOrderGroup = NDIS + +[Neo.Reg] +HKR, Ndi, Service, 0, Neo.Service.Name +HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" +HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" + +[Neo.EventLog] +HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN60.sys" +HKR, , TypesSupported, 0x00010001, 7 + +[Strings] +CompanyName = "SoftEther Corporation" +DiskDescription = "VPN Client Device Driver Install Disk" +Neo.Service.Name = "Neo_VPN60" +Neo.Service.DispName = "VPN Client Device Driver - VPN60" +Neo.Service.Desc = "VPN Client Adapter - VPN60" +NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN60" +Neo.EventLog.Name = "Neo" +NetworkAddress = "MAC Address" +DefaultAddress = "000001000001" +MaxSpeed = "Indicate Speed (Mbps)" +KeepLink = "Keep Link" +On = "On" +Off = "Off" + + +; Auto Generated 20180205_163610.773 + diff --git a/src/bin/hamcore/DriverPackages/Neo6_Win8/x64/Neo6_x64_VPN61.inf b/src/bin/hamcore/DriverPackages/Neo6_Win8/x64/Neo6_x64_VPN61.inf index b4693c98..dfdab8d2 100644 --- a/src/bin/hamcore/DriverPackages/Neo6_Win8/x64/Neo6_x64_VPN61.inf +++ b/src/bin/hamcore/DriverPackages/Neo6_Win8/x64/Neo6_x64_VPN61.inf @@ -1,114 +1,114 @@ -; VPN Client Device Driver for Windows 2000 and Greater -; -; Copyright (c) SoftEther Corporation. All Rights Reserved. -; http://www.softether.co.jp/ -; -; BUILD 9658 - -[Version] -Signature = "$Windows NT$" -Class = Net -ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} -Provider = %CompanyName% -DriverVer = 02/04/2018, 4.25.0.9658 -CatalogFile.NT = inf_VPN61.cat - -[Manufacturer] -%CompanyName% = SoftEther, NTamd64 - -[SourceDisksNames] -1=%DiskDescription%, "", , - -[SourceDisksFiles] -Neo_VPN61.sys = 1 - -[DestinationDirs] -DefaultDestDir = 12 -Neo.CopyFiles.Sys = 12 - -[Neo.CopyFiles.Sys] -Neo_VPN61.sys, , , 2 - -[SoftEther.NTamd64] -%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN61 - -[NeoAdapter.Install] -Characteristics = 0x1 -AddReg = Neo.Reg, NeoAdapter.Ndi -CopyFiles = Neo.CopyFiles.Sys -*IfType = 53 -*MediaType = 0 -*PhysicalMediaType = 0 - -[NeoAdapter.Install.Services] -AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% - -[NeoAdapter.Ndi] -HKR, , NetworkAddress, 0, %DefaultAddress% -HKR, Ndi, DeviceID, , "NeoAdapter_VPN61" -HKR, , DevLoader, , ndis -HKR, , DeviceVxDs, , Neo_VPN61.sys -HKR, NDIS, LogDriverName, , "Neo_VPN61" -HKR, NDIS, MajorNdisVersion, 1, 5 -HKR, NDIS, MinorNdisVersion, 1, 0 -HKR, Ndi\Interfaces, DefUpper, , "ndis5" -HKR, Ndi\Interfaces, UpperRange, , "ndis5" -HKR, Ndi\Interfaces, LowerRange, , "ethernet" -HKR, Ndi\Interfaces, DefLower, , "ethernet" -HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" -HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% -HKR, Ndi\Params\NetworkAddress, type, 0, "edit" -HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" -HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" -HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% -HKR, Ndi\Params\NetworkAddress, optional, 0, "0" -HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% -HKR, Ndi\Params\MaxSpeed, type, 0, "int" -HKR, Ndi\Params\MaxSpeed, default, 0, "100" -HKR, Ndi\Params\MaxSpeed, min, 0, "0" -HKR, Ndi\Params\MaxSpeed, max, 0, "2000" -HKR, Ndi\Params\MaxSpeed, step, 0, "1" -HKR, Ndi\Params\MaxSpeed, Base, 0, "10" -HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% -HKR, Ndi\Params\KeepLink, type, 0, "enum" -HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% -HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% -HKR, Ndi\Params\KeepLink, default, 0, "0" - - -[Neo.Service] -DisplayName = %Neo.Service.DispName% -Description = %Neo.Service.Desc% -ServiceType = 1 -StartType = 3 -ErrorControl = 1 -ServiceBinary = %12%\Neo_VPN61.sys -LoadOrderGroup = NDIS - -[Neo.Reg] -HKR, Ndi, Service, 0, Neo.Service.Name -HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" -HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" - -[Neo.EventLog] -HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN61.sys" -HKR, , TypesSupported, 0x00010001, 7 - -[Strings] -CompanyName = "SoftEther Corporation" -DiskDescription = "VPN Client Device Driver Install Disk" -Neo.Service.Name = "Neo_VPN61" -Neo.Service.DispName = "VPN Client Device Driver - VPN61" -Neo.Service.Desc = "VPN Client Adapter - VPN61" -NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN61" -Neo.EventLog.Name = "Neo" -NetworkAddress = "MAC Address" -DefaultAddress = "000001000001" -MaxSpeed = "Indicate Speed (Mbps)" -KeepLink = "Keep Link" -On = "On" -Off = "Off" - - -; Auto Generated 20180205_163610.773 - +; VPN Client Device Driver for Windows 2000 and Greater +; +; Copyright (c) SoftEther Corporation. All Rights Reserved. +; http://www.softether.co.jp/ +; +; BUILD 9658 + +[Version] +Signature = "$Windows NT$" +Class = Net +ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} +Provider = %CompanyName% +DriverVer = 02/04/2018, 4.25.0.9658 +CatalogFile.NT = inf_VPN61.cat + +[Manufacturer] +%CompanyName% = SoftEther, NTamd64 + +[SourceDisksNames] +1=%DiskDescription%, "", , + +[SourceDisksFiles] +Neo_VPN61.sys = 1 + +[DestinationDirs] +DefaultDestDir = 12 +Neo.CopyFiles.Sys = 12 + +[Neo.CopyFiles.Sys] +Neo_VPN61.sys, , , 2 + +[SoftEther.NTamd64] +%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN61 + +[NeoAdapter.Install] +Characteristics = 0x1 +AddReg = Neo.Reg, NeoAdapter.Ndi +CopyFiles = Neo.CopyFiles.Sys +*IfType = 53 +*MediaType = 0 +*PhysicalMediaType = 0 + +[NeoAdapter.Install.Services] +AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% + +[NeoAdapter.Ndi] +HKR, , NetworkAddress, 0, %DefaultAddress% +HKR, Ndi, DeviceID, , "NeoAdapter_VPN61" +HKR, , DevLoader, , ndis +HKR, , DeviceVxDs, , Neo_VPN61.sys +HKR, NDIS, LogDriverName, , "Neo_VPN61" +HKR, NDIS, MajorNdisVersion, 1, 5 +HKR, NDIS, MinorNdisVersion, 1, 0 +HKR, Ndi\Interfaces, DefUpper, , "ndis5" +HKR, Ndi\Interfaces, UpperRange, , "ndis5" +HKR, Ndi\Interfaces, LowerRange, , "ethernet" +HKR, Ndi\Interfaces, DefLower, , "ethernet" +HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" +HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% +HKR, Ndi\Params\NetworkAddress, type, 0, "edit" +HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" +HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" +HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% +HKR, Ndi\Params\NetworkAddress, optional, 0, "0" +HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% +HKR, Ndi\Params\MaxSpeed, type, 0, "int" +HKR, Ndi\Params\MaxSpeed, default, 0, "100" +HKR, Ndi\Params\MaxSpeed, min, 0, "0" +HKR, Ndi\Params\MaxSpeed, max, 0, "2000" +HKR, Ndi\Params\MaxSpeed, step, 0, "1" +HKR, Ndi\Params\MaxSpeed, Base, 0, "10" +HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% +HKR, Ndi\Params\KeepLink, type, 0, "enum" +HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% +HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% +HKR, Ndi\Params\KeepLink, default, 0, "0" + + +[Neo.Service] +DisplayName = %Neo.Service.DispName% +Description = %Neo.Service.Desc% +ServiceType = 1 +StartType = 3 +ErrorControl = 1 +ServiceBinary = %12%\Neo_VPN61.sys +LoadOrderGroup = NDIS + +[Neo.Reg] +HKR, Ndi, Service, 0, Neo.Service.Name +HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" +HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" + +[Neo.EventLog] +HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN61.sys" +HKR, , TypesSupported, 0x00010001, 7 + +[Strings] +CompanyName = "SoftEther Corporation" +DiskDescription = "VPN Client Device Driver Install Disk" +Neo.Service.Name = "Neo_VPN61" +Neo.Service.DispName = "VPN Client Device Driver - VPN61" +Neo.Service.Desc = "VPN Client Adapter - VPN61" +NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN61" +Neo.EventLog.Name = "Neo" +NetworkAddress = "MAC Address" +DefaultAddress = "000001000001" +MaxSpeed = "Indicate Speed (Mbps)" +KeepLink = "Keep Link" +On = "On" +Off = "Off" + + +; Auto Generated 20180205_163610.773 + diff --git a/src/bin/hamcore/DriverPackages/Neo6_Win8/x64/Neo6_x64_VPN62.inf b/src/bin/hamcore/DriverPackages/Neo6_Win8/x64/Neo6_x64_VPN62.inf index c12b853f..ec7ec5b8 100644 --- a/src/bin/hamcore/DriverPackages/Neo6_Win8/x64/Neo6_x64_VPN62.inf +++ b/src/bin/hamcore/DriverPackages/Neo6_Win8/x64/Neo6_x64_VPN62.inf @@ -1,114 +1,114 @@ -; VPN Client Device Driver for Windows 2000 and Greater -; -; Copyright (c) SoftEther Corporation. All Rights Reserved. -; http://www.softether.co.jp/ -; -; BUILD 9658 - -[Version] -Signature = "$Windows NT$" -Class = Net -ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} -Provider = %CompanyName% -DriverVer = 02/04/2018, 4.25.0.9658 -CatalogFile.NT = inf_VPN62.cat - -[Manufacturer] -%CompanyName% = SoftEther, NTamd64 - -[SourceDisksNames] -1=%DiskDescription%, "", , - -[SourceDisksFiles] -Neo_VPN62.sys = 1 - -[DestinationDirs] -DefaultDestDir = 12 -Neo.CopyFiles.Sys = 12 - -[Neo.CopyFiles.Sys] -Neo_VPN62.sys, , , 2 - -[SoftEther.NTamd64] -%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN62 - -[NeoAdapter.Install] -Characteristics = 0x1 -AddReg = Neo.Reg, NeoAdapter.Ndi -CopyFiles = Neo.CopyFiles.Sys -*IfType = 53 -*MediaType = 0 -*PhysicalMediaType = 0 - -[NeoAdapter.Install.Services] -AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% - -[NeoAdapter.Ndi] -HKR, , NetworkAddress, 0, %DefaultAddress% -HKR, Ndi, DeviceID, , "NeoAdapter_VPN62" -HKR, , DevLoader, , ndis -HKR, , DeviceVxDs, , Neo_VPN62.sys -HKR, NDIS, LogDriverName, , "Neo_VPN62" -HKR, NDIS, MajorNdisVersion, 1, 5 -HKR, NDIS, MinorNdisVersion, 1, 0 -HKR, Ndi\Interfaces, DefUpper, , "ndis5" -HKR, Ndi\Interfaces, UpperRange, , "ndis5" -HKR, Ndi\Interfaces, LowerRange, , "ethernet" -HKR, Ndi\Interfaces, DefLower, , "ethernet" -HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" -HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% -HKR, Ndi\Params\NetworkAddress, type, 0, "edit" -HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" -HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" -HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% -HKR, Ndi\Params\NetworkAddress, optional, 0, "0" -HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% -HKR, Ndi\Params\MaxSpeed, type, 0, "int" -HKR, Ndi\Params\MaxSpeed, default, 0, "100" -HKR, Ndi\Params\MaxSpeed, min, 0, "0" -HKR, Ndi\Params\MaxSpeed, max, 0, "2000" -HKR, Ndi\Params\MaxSpeed, step, 0, "1" -HKR, Ndi\Params\MaxSpeed, Base, 0, "10" -HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% -HKR, Ndi\Params\KeepLink, type, 0, "enum" -HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% -HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% -HKR, Ndi\Params\KeepLink, default, 0, "0" - - -[Neo.Service] -DisplayName = %Neo.Service.DispName% -Description = %Neo.Service.Desc% -ServiceType = 1 -StartType = 3 -ErrorControl = 1 -ServiceBinary = %12%\Neo_VPN62.sys -LoadOrderGroup = NDIS - -[Neo.Reg] -HKR, Ndi, Service, 0, Neo.Service.Name -HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" -HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" - -[Neo.EventLog] -HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN62.sys" -HKR, , TypesSupported, 0x00010001, 7 - -[Strings] -CompanyName = "SoftEther Corporation" -DiskDescription = "VPN Client Device Driver Install Disk" -Neo.Service.Name = "Neo_VPN62" -Neo.Service.DispName = "VPN Client Device Driver - VPN62" -Neo.Service.Desc = "VPN Client Adapter - VPN62" -NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN62" -Neo.EventLog.Name = "Neo" -NetworkAddress = "MAC Address" -DefaultAddress = "000001000001" -MaxSpeed = "Indicate Speed (Mbps)" -KeepLink = "Keep Link" -On = "On" -Off = "Off" - - -; Auto Generated 20180205_163610.774 - +; VPN Client Device Driver for Windows 2000 and Greater +; +; Copyright (c) SoftEther Corporation. All Rights Reserved. +; http://www.softether.co.jp/ +; +; BUILD 9658 + +[Version] +Signature = "$Windows NT$" +Class = Net +ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} +Provider = %CompanyName% +DriverVer = 02/04/2018, 4.25.0.9658 +CatalogFile.NT = inf_VPN62.cat + +[Manufacturer] +%CompanyName% = SoftEther, NTamd64 + +[SourceDisksNames] +1=%DiskDescription%, "", , + +[SourceDisksFiles] +Neo_VPN62.sys = 1 + +[DestinationDirs] +DefaultDestDir = 12 +Neo.CopyFiles.Sys = 12 + +[Neo.CopyFiles.Sys] +Neo_VPN62.sys, , , 2 + +[SoftEther.NTamd64] +%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN62 + +[NeoAdapter.Install] +Characteristics = 0x1 +AddReg = Neo.Reg, NeoAdapter.Ndi +CopyFiles = Neo.CopyFiles.Sys +*IfType = 53 +*MediaType = 0 +*PhysicalMediaType = 0 + +[NeoAdapter.Install.Services] +AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% + +[NeoAdapter.Ndi] +HKR, , NetworkAddress, 0, %DefaultAddress% +HKR, Ndi, DeviceID, , "NeoAdapter_VPN62" +HKR, , DevLoader, , ndis +HKR, , DeviceVxDs, , Neo_VPN62.sys +HKR, NDIS, LogDriverName, , "Neo_VPN62" +HKR, NDIS, MajorNdisVersion, 1, 5 +HKR, NDIS, MinorNdisVersion, 1, 0 +HKR, Ndi\Interfaces, DefUpper, , "ndis5" +HKR, Ndi\Interfaces, UpperRange, , "ndis5" +HKR, Ndi\Interfaces, LowerRange, , "ethernet" +HKR, Ndi\Interfaces, DefLower, , "ethernet" +HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" +HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% +HKR, Ndi\Params\NetworkAddress, type, 0, "edit" +HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" +HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" +HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% +HKR, Ndi\Params\NetworkAddress, optional, 0, "0" +HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% +HKR, Ndi\Params\MaxSpeed, type, 0, "int" +HKR, Ndi\Params\MaxSpeed, default, 0, "100" +HKR, Ndi\Params\MaxSpeed, min, 0, "0" +HKR, Ndi\Params\MaxSpeed, max, 0, "2000" +HKR, Ndi\Params\MaxSpeed, step, 0, "1" +HKR, Ndi\Params\MaxSpeed, Base, 0, "10" +HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% +HKR, Ndi\Params\KeepLink, type, 0, "enum" +HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% +HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% +HKR, Ndi\Params\KeepLink, default, 0, "0" + + +[Neo.Service] +DisplayName = %Neo.Service.DispName% +Description = %Neo.Service.Desc% +ServiceType = 1 +StartType = 3 +ErrorControl = 1 +ServiceBinary = %12%\Neo_VPN62.sys +LoadOrderGroup = NDIS + +[Neo.Reg] +HKR, Ndi, Service, 0, Neo.Service.Name +HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" +HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" + +[Neo.EventLog] +HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN62.sys" +HKR, , TypesSupported, 0x00010001, 7 + +[Strings] +CompanyName = "SoftEther Corporation" +DiskDescription = "VPN Client Device Driver Install Disk" +Neo.Service.Name = "Neo_VPN62" +Neo.Service.DispName = "VPN Client Device Driver - VPN62" +Neo.Service.Desc = "VPN Client Adapter - VPN62" +NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN62" +Neo.EventLog.Name = "Neo" +NetworkAddress = "MAC Address" +DefaultAddress = "000001000001" +MaxSpeed = "Indicate Speed (Mbps)" +KeepLink = "Keep Link" +On = "On" +Off = "Off" + + +; Auto Generated 20180205_163610.774 + diff --git a/src/bin/hamcore/DriverPackages/Neo6_Win8/x64/Neo6_x64_VPN63.inf b/src/bin/hamcore/DriverPackages/Neo6_Win8/x64/Neo6_x64_VPN63.inf index 83aa7c22..18421371 100644 --- a/src/bin/hamcore/DriverPackages/Neo6_Win8/x64/Neo6_x64_VPN63.inf +++ b/src/bin/hamcore/DriverPackages/Neo6_Win8/x64/Neo6_x64_VPN63.inf @@ -1,114 +1,114 @@ -; VPN Client Device Driver for Windows 2000 and Greater -; -; Copyright (c) SoftEther Corporation. All Rights Reserved. -; http://www.softether.co.jp/ -; -; BUILD 9658 - -[Version] -Signature = "$Windows NT$" -Class = Net -ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} -Provider = %CompanyName% -DriverVer = 02/04/2018, 4.25.0.9658 -CatalogFile.NT = inf_VPN63.cat - -[Manufacturer] -%CompanyName% = SoftEther, NTamd64 - -[SourceDisksNames] -1=%DiskDescription%, "", , - -[SourceDisksFiles] -Neo_VPN63.sys = 1 - -[DestinationDirs] -DefaultDestDir = 12 -Neo.CopyFiles.Sys = 12 - -[Neo.CopyFiles.Sys] -Neo_VPN63.sys, , , 2 - -[SoftEther.NTamd64] -%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN63 - -[NeoAdapter.Install] -Characteristics = 0x1 -AddReg = Neo.Reg, NeoAdapter.Ndi -CopyFiles = Neo.CopyFiles.Sys -*IfType = 53 -*MediaType = 0 -*PhysicalMediaType = 0 - -[NeoAdapter.Install.Services] -AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% - -[NeoAdapter.Ndi] -HKR, , NetworkAddress, 0, %DefaultAddress% -HKR, Ndi, DeviceID, , "NeoAdapter_VPN63" -HKR, , DevLoader, , ndis -HKR, , DeviceVxDs, , Neo_VPN63.sys -HKR, NDIS, LogDriverName, , "Neo_VPN63" -HKR, NDIS, MajorNdisVersion, 1, 5 -HKR, NDIS, MinorNdisVersion, 1, 0 -HKR, Ndi\Interfaces, DefUpper, , "ndis5" -HKR, Ndi\Interfaces, UpperRange, , "ndis5" -HKR, Ndi\Interfaces, LowerRange, , "ethernet" -HKR, Ndi\Interfaces, DefLower, , "ethernet" -HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" -HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% -HKR, Ndi\Params\NetworkAddress, type, 0, "edit" -HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" -HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" -HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% -HKR, Ndi\Params\NetworkAddress, optional, 0, "0" -HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% -HKR, Ndi\Params\MaxSpeed, type, 0, "int" -HKR, Ndi\Params\MaxSpeed, default, 0, "100" -HKR, Ndi\Params\MaxSpeed, min, 0, "0" -HKR, Ndi\Params\MaxSpeed, max, 0, "2000" -HKR, Ndi\Params\MaxSpeed, step, 0, "1" -HKR, Ndi\Params\MaxSpeed, Base, 0, "10" -HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% -HKR, Ndi\Params\KeepLink, type, 0, "enum" -HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% -HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% -HKR, Ndi\Params\KeepLink, default, 0, "0" - - -[Neo.Service] -DisplayName = %Neo.Service.DispName% -Description = %Neo.Service.Desc% -ServiceType = 1 -StartType = 3 -ErrorControl = 1 -ServiceBinary = %12%\Neo_VPN63.sys -LoadOrderGroup = NDIS - -[Neo.Reg] -HKR, Ndi, Service, 0, Neo.Service.Name -HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" -HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" - -[Neo.EventLog] -HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN63.sys" -HKR, , TypesSupported, 0x00010001, 7 - -[Strings] -CompanyName = "SoftEther Corporation" -DiskDescription = "VPN Client Device Driver Install Disk" -Neo.Service.Name = "Neo_VPN63" -Neo.Service.DispName = "VPN Client Device Driver - VPN63" -Neo.Service.Desc = "VPN Client Adapter - VPN63" -NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN63" -Neo.EventLog.Name = "Neo" -NetworkAddress = "MAC Address" -DefaultAddress = "000001000001" -MaxSpeed = "Indicate Speed (Mbps)" -KeepLink = "Keep Link" -On = "On" -Off = "Off" - - -; Auto Generated 20180205_163610.774 - +; VPN Client Device Driver for Windows 2000 and Greater +; +; Copyright (c) SoftEther Corporation. All Rights Reserved. +; http://www.softether.co.jp/ +; +; BUILD 9658 + +[Version] +Signature = "$Windows NT$" +Class = Net +ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} +Provider = %CompanyName% +DriverVer = 02/04/2018, 4.25.0.9658 +CatalogFile.NT = inf_VPN63.cat + +[Manufacturer] +%CompanyName% = SoftEther, NTamd64 + +[SourceDisksNames] +1=%DiskDescription%, "", , + +[SourceDisksFiles] +Neo_VPN63.sys = 1 + +[DestinationDirs] +DefaultDestDir = 12 +Neo.CopyFiles.Sys = 12 + +[Neo.CopyFiles.Sys] +Neo_VPN63.sys, , , 2 + +[SoftEther.NTamd64] +%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN63 + +[NeoAdapter.Install] +Characteristics = 0x1 +AddReg = Neo.Reg, NeoAdapter.Ndi +CopyFiles = Neo.CopyFiles.Sys +*IfType = 53 +*MediaType = 0 +*PhysicalMediaType = 0 + +[NeoAdapter.Install.Services] +AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% + +[NeoAdapter.Ndi] +HKR, , NetworkAddress, 0, %DefaultAddress% +HKR, Ndi, DeviceID, , "NeoAdapter_VPN63" +HKR, , DevLoader, , ndis +HKR, , DeviceVxDs, , Neo_VPN63.sys +HKR, NDIS, LogDriverName, , "Neo_VPN63" +HKR, NDIS, MajorNdisVersion, 1, 5 +HKR, NDIS, MinorNdisVersion, 1, 0 +HKR, Ndi\Interfaces, DefUpper, , "ndis5" +HKR, Ndi\Interfaces, UpperRange, , "ndis5" +HKR, Ndi\Interfaces, LowerRange, , "ethernet" +HKR, Ndi\Interfaces, DefLower, , "ethernet" +HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" +HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% +HKR, Ndi\Params\NetworkAddress, type, 0, "edit" +HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" +HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" +HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% +HKR, Ndi\Params\NetworkAddress, optional, 0, "0" +HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% +HKR, Ndi\Params\MaxSpeed, type, 0, "int" +HKR, Ndi\Params\MaxSpeed, default, 0, "100" +HKR, Ndi\Params\MaxSpeed, min, 0, "0" +HKR, Ndi\Params\MaxSpeed, max, 0, "2000" +HKR, Ndi\Params\MaxSpeed, step, 0, "1" +HKR, Ndi\Params\MaxSpeed, Base, 0, "10" +HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% +HKR, Ndi\Params\KeepLink, type, 0, "enum" +HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% +HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% +HKR, Ndi\Params\KeepLink, default, 0, "0" + + +[Neo.Service] +DisplayName = %Neo.Service.DispName% +Description = %Neo.Service.Desc% +ServiceType = 1 +StartType = 3 +ErrorControl = 1 +ServiceBinary = %12%\Neo_VPN63.sys +LoadOrderGroup = NDIS + +[Neo.Reg] +HKR, Ndi, Service, 0, Neo.Service.Name +HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" +HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" + +[Neo.EventLog] +HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN63.sys" +HKR, , TypesSupported, 0x00010001, 7 + +[Strings] +CompanyName = "SoftEther Corporation" +DiskDescription = "VPN Client Device Driver Install Disk" +Neo.Service.Name = "Neo_VPN63" +Neo.Service.DispName = "VPN Client Device Driver - VPN63" +Neo.Service.Desc = "VPN Client Adapter - VPN63" +NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN63" +Neo.EventLog.Name = "Neo" +NetworkAddress = "MAC Address" +DefaultAddress = "000001000001" +MaxSpeed = "Indicate Speed (Mbps)" +KeepLink = "Keep Link" +On = "On" +Off = "Off" + + +; Auto Generated 20180205_163610.774 + diff --git a/src/bin/hamcore/DriverPackages/Neo6_Win8/x64/Neo6_x64_VPN64.inf b/src/bin/hamcore/DriverPackages/Neo6_Win8/x64/Neo6_x64_VPN64.inf index 789b8988..9d81bf03 100644 --- a/src/bin/hamcore/DriverPackages/Neo6_Win8/x64/Neo6_x64_VPN64.inf +++ b/src/bin/hamcore/DriverPackages/Neo6_Win8/x64/Neo6_x64_VPN64.inf @@ -1,114 +1,114 @@ -; VPN Client Device Driver for Windows 2000 and Greater -; -; Copyright (c) SoftEther Corporation. All Rights Reserved. -; http://www.softether.co.jp/ -; -; BUILD 9658 - -[Version] -Signature = "$Windows NT$" -Class = Net -ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} -Provider = %CompanyName% -DriverVer = 02/04/2018, 4.25.0.9658 -CatalogFile.NT = inf_VPN64.cat - -[Manufacturer] -%CompanyName% = SoftEther, NTamd64 - -[SourceDisksNames] -1=%DiskDescription%, "", , - -[SourceDisksFiles] -Neo_VPN64.sys = 1 - -[DestinationDirs] -DefaultDestDir = 12 -Neo.CopyFiles.Sys = 12 - -[Neo.CopyFiles.Sys] -Neo_VPN64.sys, , , 2 - -[SoftEther.NTamd64] -%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN64 - -[NeoAdapter.Install] -Characteristics = 0x1 -AddReg = Neo.Reg, NeoAdapter.Ndi -CopyFiles = Neo.CopyFiles.Sys -*IfType = 53 -*MediaType = 0 -*PhysicalMediaType = 0 - -[NeoAdapter.Install.Services] -AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% - -[NeoAdapter.Ndi] -HKR, , NetworkAddress, 0, %DefaultAddress% -HKR, Ndi, DeviceID, , "NeoAdapter_VPN64" -HKR, , DevLoader, , ndis -HKR, , DeviceVxDs, , Neo_VPN64.sys -HKR, NDIS, LogDriverName, , "Neo_VPN64" -HKR, NDIS, MajorNdisVersion, 1, 5 -HKR, NDIS, MinorNdisVersion, 1, 0 -HKR, Ndi\Interfaces, DefUpper, , "ndis5" -HKR, Ndi\Interfaces, UpperRange, , "ndis5" -HKR, Ndi\Interfaces, LowerRange, , "ethernet" -HKR, Ndi\Interfaces, DefLower, , "ethernet" -HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" -HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% -HKR, Ndi\Params\NetworkAddress, type, 0, "edit" -HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" -HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" -HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% -HKR, Ndi\Params\NetworkAddress, optional, 0, "0" -HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% -HKR, Ndi\Params\MaxSpeed, type, 0, "int" -HKR, Ndi\Params\MaxSpeed, default, 0, "100" -HKR, Ndi\Params\MaxSpeed, min, 0, "0" -HKR, Ndi\Params\MaxSpeed, max, 0, "2000" -HKR, Ndi\Params\MaxSpeed, step, 0, "1" -HKR, Ndi\Params\MaxSpeed, Base, 0, "10" -HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% -HKR, Ndi\Params\KeepLink, type, 0, "enum" -HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% -HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% -HKR, Ndi\Params\KeepLink, default, 0, "0" - - -[Neo.Service] -DisplayName = %Neo.Service.DispName% -Description = %Neo.Service.Desc% -ServiceType = 1 -StartType = 3 -ErrorControl = 1 -ServiceBinary = %12%\Neo_VPN64.sys -LoadOrderGroup = NDIS - -[Neo.Reg] -HKR, Ndi, Service, 0, Neo.Service.Name -HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" -HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" - -[Neo.EventLog] -HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN64.sys" -HKR, , TypesSupported, 0x00010001, 7 - -[Strings] -CompanyName = "SoftEther Corporation" -DiskDescription = "VPN Client Device Driver Install Disk" -Neo.Service.Name = "Neo_VPN64" -Neo.Service.DispName = "VPN Client Device Driver - VPN64" -Neo.Service.Desc = "VPN Client Adapter - VPN64" -NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN64" -Neo.EventLog.Name = "Neo" -NetworkAddress = "MAC Address" -DefaultAddress = "000001000001" -MaxSpeed = "Indicate Speed (Mbps)" -KeepLink = "Keep Link" -On = "On" -Off = "Off" - - -; Auto Generated 20180205_163610.775 - +; VPN Client Device Driver for Windows 2000 and Greater +; +; Copyright (c) SoftEther Corporation. All Rights Reserved. +; http://www.softether.co.jp/ +; +; BUILD 9658 + +[Version] +Signature = "$Windows NT$" +Class = Net +ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} +Provider = %CompanyName% +DriverVer = 02/04/2018, 4.25.0.9658 +CatalogFile.NT = inf_VPN64.cat + +[Manufacturer] +%CompanyName% = SoftEther, NTamd64 + +[SourceDisksNames] +1=%DiskDescription%, "", , + +[SourceDisksFiles] +Neo_VPN64.sys = 1 + +[DestinationDirs] +DefaultDestDir = 12 +Neo.CopyFiles.Sys = 12 + +[Neo.CopyFiles.Sys] +Neo_VPN64.sys, , , 2 + +[SoftEther.NTamd64] +%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN64 + +[NeoAdapter.Install] +Characteristics = 0x1 +AddReg = Neo.Reg, NeoAdapter.Ndi +CopyFiles = Neo.CopyFiles.Sys +*IfType = 53 +*MediaType = 0 +*PhysicalMediaType = 0 + +[NeoAdapter.Install.Services] +AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% + +[NeoAdapter.Ndi] +HKR, , NetworkAddress, 0, %DefaultAddress% +HKR, Ndi, DeviceID, , "NeoAdapter_VPN64" +HKR, , DevLoader, , ndis +HKR, , DeviceVxDs, , Neo_VPN64.sys +HKR, NDIS, LogDriverName, , "Neo_VPN64" +HKR, NDIS, MajorNdisVersion, 1, 5 +HKR, NDIS, MinorNdisVersion, 1, 0 +HKR, Ndi\Interfaces, DefUpper, , "ndis5" +HKR, Ndi\Interfaces, UpperRange, , "ndis5" +HKR, Ndi\Interfaces, LowerRange, , "ethernet" +HKR, Ndi\Interfaces, DefLower, , "ethernet" +HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" +HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% +HKR, Ndi\Params\NetworkAddress, type, 0, "edit" +HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" +HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" +HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% +HKR, Ndi\Params\NetworkAddress, optional, 0, "0" +HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% +HKR, Ndi\Params\MaxSpeed, type, 0, "int" +HKR, Ndi\Params\MaxSpeed, default, 0, "100" +HKR, Ndi\Params\MaxSpeed, min, 0, "0" +HKR, Ndi\Params\MaxSpeed, max, 0, "2000" +HKR, Ndi\Params\MaxSpeed, step, 0, "1" +HKR, Ndi\Params\MaxSpeed, Base, 0, "10" +HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% +HKR, Ndi\Params\KeepLink, type, 0, "enum" +HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% +HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% +HKR, Ndi\Params\KeepLink, default, 0, "0" + + +[Neo.Service] +DisplayName = %Neo.Service.DispName% +Description = %Neo.Service.Desc% +ServiceType = 1 +StartType = 3 +ErrorControl = 1 +ServiceBinary = %12%\Neo_VPN64.sys +LoadOrderGroup = NDIS + +[Neo.Reg] +HKR, Ndi, Service, 0, Neo.Service.Name +HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" +HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" + +[Neo.EventLog] +HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN64.sys" +HKR, , TypesSupported, 0x00010001, 7 + +[Strings] +CompanyName = "SoftEther Corporation" +DiskDescription = "VPN Client Device Driver Install Disk" +Neo.Service.Name = "Neo_VPN64" +Neo.Service.DispName = "VPN Client Device Driver - VPN64" +Neo.Service.Desc = "VPN Client Adapter - VPN64" +NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN64" +Neo.EventLog.Name = "Neo" +NetworkAddress = "MAC Address" +DefaultAddress = "000001000001" +MaxSpeed = "Indicate Speed (Mbps)" +KeepLink = "Keep Link" +On = "On" +Off = "Off" + + +; Auto Generated 20180205_163610.775 + diff --git a/src/bin/hamcore/DriverPackages/Neo6_Win8/x64/Neo6_x64_VPN65.inf b/src/bin/hamcore/DriverPackages/Neo6_Win8/x64/Neo6_x64_VPN65.inf index 39ce407e..ff9033b3 100644 --- a/src/bin/hamcore/DriverPackages/Neo6_Win8/x64/Neo6_x64_VPN65.inf +++ b/src/bin/hamcore/DriverPackages/Neo6_Win8/x64/Neo6_x64_VPN65.inf @@ -1,114 +1,114 @@ -; VPN Client Device Driver for Windows 2000 and Greater -; -; Copyright (c) SoftEther Corporation. All Rights Reserved. -; http://www.softether.co.jp/ -; -; BUILD 9658 - -[Version] -Signature = "$Windows NT$" -Class = Net -ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} -Provider = %CompanyName% -DriverVer = 02/04/2018, 4.25.0.9658 -CatalogFile.NT = inf_VPN65.cat - -[Manufacturer] -%CompanyName% = SoftEther, NTamd64 - -[SourceDisksNames] -1=%DiskDescription%, "", , - -[SourceDisksFiles] -Neo_VPN65.sys = 1 - -[DestinationDirs] -DefaultDestDir = 12 -Neo.CopyFiles.Sys = 12 - -[Neo.CopyFiles.Sys] -Neo_VPN65.sys, , , 2 - -[SoftEther.NTamd64] -%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN65 - -[NeoAdapter.Install] -Characteristics = 0x1 -AddReg = Neo.Reg, NeoAdapter.Ndi -CopyFiles = Neo.CopyFiles.Sys -*IfType = 53 -*MediaType = 0 -*PhysicalMediaType = 0 - -[NeoAdapter.Install.Services] -AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% - -[NeoAdapter.Ndi] -HKR, , NetworkAddress, 0, %DefaultAddress% -HKR, Ndi, DeviceID, , "NeoAdapter_VPN65" -HKR, , DevLoader, , ndis -HKR, , DeviceVxDs, , Neo_VPN65.sys -HKR, NDIS, LogDriverName, , "Neo_VPN65" -HKR, NDIS, MajorNdisVersion, 1, 5 -HKR, NDIS, MinorNdisVersion, 1, 0 -HKR, Ndi\Interfaces, DefUpper, , "ndis5" -HKR, Ndi\Interfaces, UpperRange, , "ndis5" -HKR, Ndi\Interfaces, LowerRange, , "ethernet" -HKR, Ndi\Interfaces, DefLower, , "ethernet" -HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" -HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% -HKR, Ndi\Params\NetworkAddress, type, 0, "edit" -HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" -HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" -HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% -HKR, Ndi\Params\NetworkAddress, optional, 0, "0" -HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% -HKR, Ndi\Params\MaxSpeed, type, 0, "int" -HKR, Ndi\Params\MaxSpeed, default, 0, "100" -HKR, Ndi\Params\MaxSpeed, min, 0, "0" -HKR, Ndi\Params\MaxSpeed, max, 0, "2000" -HKR, Ndi\Params\MaxSpeed, step, 0, "1" -HKR, Ndi\Params\MaxSpeed, Base, 0, "10" -HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% -HKR, Ndi\Params\KeepLink, type, 0, "enum" -HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% -HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% -HKR, Ndi\Params\KeepLink, default, 0, "0" - - -[Neo.Service] -DisplayName = %Neo.Service.DispName% -Description = %Neo.Service.Desc% -ServiceType = 1 -StartType = 3 -ErrorControl = 1 -ServiceBinary = %12%\Neo_VPN65.sys -LoadOrderGroup = NDIS - -[Neo.Reg] -HKR, Ndi, Service, 0, Neo.Service.Name -HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" -HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" - -[Neo.EventLog] -HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN65.sys" -HKR, , TypesSupported, 0x00010001, 7 - -[Strings] -CompanyName = "SoftEther Corporation" -DiskDescription = "VPN Client Device Driver Install Disk" -Neo.Service.Name = "Neo_VPN65" -Neo.Service.DispName = "VPN Client Device Driver - VPN65" -Neo.Service.Desc = "VPN Client Adapter - VPN65" -NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN65" -Neo.EventLog.Name = "Neo" -NetworkAddress = "MAC Address" -DefaultAddress = "000001000001" -MaxSpeed = "Indicate Speed (Mbps)" -KeepLink = "Keep Link" -On = "On" -Off = "Off" - - -; Auto Generated 20180205_163610.775 - +; VPN Client Device Driver for Windows 2000 and Greater +; +; Copyright (c) SoftEther Corporation. All Rights Reserved. +; http://www.softether.co.jp/ +; +; BUILD 9658 + +[Version] +Signature = "$Windows NT$" +Class = Net +ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} +Provider = %CompanyName% +DriverVer = 02/04/2018, 4.25.0.9658 +CatalogFile.NT = inf_VPN65.cat + +[Manufacturer] +%CompanyName% = SoftEther, NTamd64 + +[SourceDisksNames] +1=%DiskDescription%, "", , + +[SourceDisksFiles] +Neo_VPN65.sys = 1 + +[DestinationDirs] +DefaultDestDir = 12 +Neo.CopyFiles.Sys = 12 + +[Neo.CopyFiles.Sys] +Neo_VPN65.sys, , , 2 + +[SoftEther.NTamd64] +%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN65 + +[NeoAdapter.Install] +Characteristics = 0x1 +AddReg = Neo.Reg, NeoAdapter.Ndi +CopyFiles = Neo.CopyFiles.Sys +*IfType = 53 +*MediaType = 0 +*PhysicalMediaType = 0 + +[NeoAdapter.Install.Services] +AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% + +[NeoAdapter.Ndi] +HKR, , NetworkAddress, 0, %DefaultAddress% +HKR, Ndi, DeviceID, , "NeoAdapter_VPN65" +HKR, , DevLoader, , ndis +HKR, , DeviceVxDs, , Neo_VPN65.sys +HKR, NDIS, LogDriverName, , "Neo_VPN65" +HKR, NDIS, MajorNdisVersion, 1, 5 +HKR, NDIS, MinorNdisVersion, 1, 0 +HKR, Ndi\Interfaces, DefUpper, , "ndis5" +HKR, Ndi\Interfaces, UpperRange, , "ndis5" +HKR, Ndi\Interfaces, LowerRange, , "ethernet" +HKR, Ndi\Interfaces, DefLower, , "ethernet" +HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" +HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% +HKR, Ndi\Params\NetworkAddress, type, 0, "edit" +HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" +HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" +HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% +HKR, Ndi\Params\NetworkAddress, optional, 0, "0" +HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% +HKR, Ndi\Params\MaxSpeed, type, 0, "int" +HKR, Ndi\Params\MaxSpeed, default, 0, "100" +HKR, Ndi\Params\MaxSpeed, min, 0, "0" +HKR, Ndi\Params\MaxSpeed, max, 0, "2000" +HKR, Ndi\Params\MaxSpeed, step, 0, "1" +HKR, Ndi\Params\MaxSpeed, Base, 0, "10" +HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% +HKR, Ndi\Params\KeepLink, type, 0, "enum" +HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% +HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% +HKR, Ndi\Params\KeepLink, default, 0, "0" + + +[Neo.Service] +DisplayName = %Neo.Service.DispName% +Description = %Neo.Service.Desc% +ServiceType = 1 +StartType = 3 +ErrorControl = 1 +ServiceBinary = %12%\Neo_VPN65.sys +LoadOrderGroup = NDIS + +[Neo.Reg] +HKR, Ndi, Service, 0, Neo.Service.Name +HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" +HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" + +[Neo.EventLog] +HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN65.sys" +HKR, , TypesSupported, 0x00010001, 7 + +[Strings] +CompanyName = "SoftEther Corporation" +DiskDescription = "VPN Client Device Driver Install Disk" +Neo.Service.Name = "Neo_VPN65" +Neo.Service.DispName = "VPN Client Device Driver - VPN65" +Neo.Service.Desc = "VPN Client Adapter - VPN65" +NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN65" +Neo.EventLog.Name = "Neo" +NetworkAddress = "MAC Address" +DefaultAddress = "000001000001" +MaxSpeed = "Indicate Speed (Mbps)" +KeepLink = "Keep Link" +On = "On" +Off = "Off" + + +; Auto Generated 20180205_163610.775 + diff --git a/src/bin/hamcore/DriverPackages/Neo6_Win8/x64/Neo6_x64_VPN66.inf b/src/bin/hamcore/DriverPackages/Neo6_Win8/x64/Neo6_x64_VPN66.inf index 11a24d8b..5239bdf3 100644 --- a/src/bin/hamcore/DriverPackages/Neo6_Win8/x64/Neo6_x64_VPN66.inf +++ b/src/bin/hamcore/DriverPackages/Neo6_Win8/x64/Neo6_x64_VPN66.inf @@ -1,114 +1,114 @@ -; VPN Client Device Driver for Windows 2000 and Greater -; -; Copyright (c) SoftEther Corporation. All Rights Reserved. -; http://www.softether.co.jp/ -; -; BUILD 9658 - -[Version] -Signature = "$Windows NT$" -Class = Net -ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} -Provider = %CompanyName% -DriverVer = 02/04/2018, 4.25.0.9658 -CatalogFile.NT = inf_VPN66.cat - -[Manufacturer] -%CompanyName% = SoftEther, NTamd64 - -[SourceDisksNames] -1=%DiskDescription%, "", , - -[SourceDisksFiles] -Neo_VPN66.sys = 1 - -[DestinationDirs] -DefaultDestDir = 12 -Neo.CopyFiles.Sys = 12 - -[Neo.CopyFiles.Sys] -Neo_VPN66.sys, , , 2 - -[SoftEther.NTamd64] -%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN66 - -[NeoAdapter.Install] -Characteristics = 0x1 -AddReg = Neo.Reg, NeoAdapter.Ndi -CopyFiles = Neo.CopyFiles.Sys -*IfType = 53 -*MediaType = 0 -*PhysicalMediaType = 0 - -[NeoAdapter.Install.Services] -AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% - -[NeoAdapter.Ndi] -HKR, , NetworkAddress, 0, %DefaultAddress% -HKR, Ndi, DeviceID, , "NeoAdapter_VPN66" -HKR, , DevLoader, , ndis -HKR, , DeviceVxDs, , Neo_VPN66.sys -HKR, NDIS, LogDriverName, , "Neo_VPN66" -HKR, NDIS, MajorNdisVersion, 1, 5 -HKR, NDIS, MinorNdisVersion, 1, 0 -HKR, Ndi\Interfaces, DefUpper, , "ndis5" -HKR, Ndi\Interfaces, UpperRange, , "ndis5" -HKR, Ndi\Interfaces, LowerRange, , "ethernet" -HKR, Ndi\Interfaces, DefLower, , "ethernet" -HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" -HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% -HKR, Ndi\Params\NetworkAddress, type, 0, "edit" -HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" -HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" -HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% -HKR, Ndi\Params\NetworkAddress, optional, 0, "0" -HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% -HKR, Ndi\Params\MaxSpeed, type, 0, "int" -HKR, Ndi\Params\MaxSpeed, default, 0, "100" -HKR, Ndi\Params\MaxSpeed, min, 0, "0" -HKR, Ndi\Params\MaxSpeed, max, 0, "2000" -HKR, Ndi\Params\MaxSpeed, step, 0, "1" -HKR, Ndi\Params\MaxSpeed, Base, 0, "10" -HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% -HKR, Ndi\Params\KeepLink, type, 0, "enum" -HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% -HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% -HKR, Ndi\Params\KeepLink, default, 0, "0" - - -[Neo.Service] -DisplayName = %Neo.Service.DispName% -Description = %Neo.Service.Desc% -ServiceType = 1 -StartType = 3 -ErrorControl = 1 -ServiceBinary = %12%\Neo_VPN66.sys -LoadOrderGroup = NDIS - -[Neo.Reg] -HKR, Ndi, Service, 0, Neo.Service.Name -HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" -HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" - -[Neo.EventLog] -HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN66.sys" -HKR, , TypesSupported, 0x00010001, 7 - -[Strings] -CompanyName = "SoftEther Corporation" -DiskDescription = "VPN Client Device Driver Install Disk" -Neo.Service.Name = "Neo_VPN66" -Neo.Service.DispName = "VPN Client Device Driver - VPN66" -Neo.Service.Desc = "VPN Client Adapter - VPN66" -NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN66" -Neo.EventLog.Name = "Neo" -NetworkAddress = "MAC Address" -DefaultAddress = "000001000001" -MaxSpeed = "Indicate Speed (Mbps)" -KeepLink = "Keep Link" -On = "On" -Off = "Off" - - -; Auto Generated 20180205_163610.776 - +; VPN Client Device Driver for Windows 2000 and Greater +; +; Copyright (c) SoftEther Corporation. All Rights Reserved. +; http://www.softether.co.jp/ +; +; BUILD 9658 + +[Version] +Signature = "$Windows NT$" +Class = Net +ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} +Provider = %CompanyName% +DriverVer = 02/04/2018, 4.25.0.9658 +CatalogFile.NT = inf_VPN66.cat + +[Manufacturer] +%CompanyName% = SoftEther, NTamd64 + +[SourceDisksNames] +1=%DiskDescription%, "", , + +[SourceDisksFiles] +Neo_VPN66.sys = 1 + +[DestinationDirs] +DefaultDestDir = 12 +Neo.CopyFiles.Sys = 12 + +[Neo.CopyFiles.Sys] +Neo_VPN66.sys, , , 2 + +[SoftEther.NTamd64] +%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN66 + +[NeoAdapter.Install] +Characteristics = 0x1 +AddReg = Neo.Reg, NeoAdapter.Ndi +CopyFiles = Neo.CopyFiles.Sys +*IfType = 53 +*MediaType = 0 +*PhysicalMediaType = 0 + +[NeoAdapter.Install.Services] +AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% + +[NeoAdapter.Ndi] +HKR, , NetworkAddress, 0, %DefaultAddress% +HKR, Ndi, DeviceID, , "NeoAdapter_VPN66" +HKR, , DevLoader, , ndis +HKR, , DeviceVxDs, , Neo_VPN66.sys +HKR, NDIS, LogDriverName, , "Neo_VPN66" +HKR, NDIS, MajorNdisVersion, 1, 5 +HKR, NDIS, MinorNdisVersion, 1, 0 +HKR, Ndi\Interfaces, DefUpper, , "ndis5" +HKR, Ndi\Interfaces, UpperRange, , "ndis5" +HKR, Ndi\Interfaces, LowerRange, , "ethernet" +HKR, Ndi\Interfaces, DefLower, , "ethernet" +HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" +HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% +HKR, Ndi\Params\NetworkAddress, type, 0, "edit" +HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" +HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" +HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% +HKR, Ndi\Params\NetworkAddress, optional, 0, "0" +HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% +HKR, Ndi\Params\MaxSpeed, type, 0, "int" +HKR, Ndi\Params\MaxSpeed, default, 0, "100" +HKR, Ndi\Params\MaxSpeed, min, 0, "0" +HKR, Ndi\Params\MaxSpeed, max, 0, "2000" +HKR, Ndi\Params\MaxSpeed, step, 0, "1" +HKR, Ndi\Params\MaxSpeed, Base, 0, "10" +HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% +HKR, Ndi\Params\KeepLink, type, 0, "enum" +HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% +HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% +HKR, Ndi\Params\KeepLink, default, 0, "0" + + +[Neo.Service] +DisplayName = %Neo.Service.DispName% +Description = %Neo.Service.Desc% +ServiceType = 1 +StartType = 3 +ErrorControl = 1 +ServiceBinary = %12%\Neo_VPN66.sys +LoadOrderGroup = NDIS + +[Neo.Reg] +HKR, Ndi, Service, 0, Neo.Service.Name +HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" +HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" + +[Neo.EventLog] +HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN66.sys" +HKR, , TypesSupported, 0x00010001, 7 + +[Strings] +CompanyName = "SoftEther Corporation" +DiskDescription = "VPN Client Device Driver Install Disk" +Neo.Service.Name = "Neo_VPN66" +Neo.Service.DispName = "VPN Client Device Driver - VPN66" +Neo.Service.Desc = "VPN Client Adapter - VPN66" +NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN66" +Neo.EventLog.Name = "Neo" +NetworkAddress = "MAC Address" +DefaultAddress = "000001000001" +MaxSpeed = "Indicate Speed (Mbps)" +KeepLink = "Keep Link" +On = "On" +Off = "Off" + + +; Auto Generated 20180205_163610.776 + diff --git a/src/bin/hamcore/DriverPackages/Neo6_Win8/x64/Neo6_x64_VPN67.inf b/src/bin/hamcore/DriverPackages/Neo6_Win8/x64/Neo6_x64_VPN67.inf index bb26f9be..adfa26cd 100644 --- a/src/bin/hamcore/DriverPackages/Neo6_Win8/x64/Neo6_x64_VPN67.inf +++ b/src/bin/hamcore/DriverPackages/Neo6_Win8/x64/Neo6_x64_VPN67.inf @@ -1,114 +1,114 @@ -; VPN Client Device Driver for Windows 2000 and Greater -; -; Copyright (c) SoftEther Corporation. All Rights Reserved. -; http://www.softether.co.jp/ -; -; BUILD 9658 - -[Version] -Signature = "$Windows NT$" -Class = Net -ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} -Provider = %CompanyName% -DriverVer = 02/04/2018, 4.25.0.9658 -CatalogFile.NT = inf_VPN67.cat - -[Manufacturer] -%CompanyName% = SoftEther, NTamd64 - -[SourceDisksNames] -1=%DiskDescription%, "", , - -[SourceDisksFiles] -Neo_VPN67.sys = 1 - -[DestinationDirs] -DefaultDestDir = 12 -Neo.CopyFiles.Sys = 12 - -[Neo.CopyFiles.Sys] -Neo_VPN67.sys, , , 2 - -[SoftEther.NTamd64] -%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN67 - -[NeoAdapter.Install] -Characteristics = 0x1 -AddReg = Neo.Reg, NeoAdapter.Ndi -CopyFiles = Neo.CopyFiles.Sys -*IfType = 53 -*MediaType = 0 -*PhysicalMediaType = 0 - -[NeoAdapter.Install.Services] -AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% - -[NeoAdapter.Ndi] -HKR, , NetworkAddress, 0, %DefaultAddress% -HKR, Ndi, DeviceID, , "NeoAdapter_VPN67" -HKR, , DevLoader, , ndis -HKR, , DeviceVxDs, , Neo_VPN67.sys -HKR, NDIS, LogDriverName, , "Neo_VPN67" -HKR, NDIS, MajorNdisVersion, 1, 5 -HKR, NDIS, MinorNdisVersion, 1, 0 -HKR, Ndi\Interfaces, DefUpper, , "ndis5" -HKR, Ndi\Interfaces, UpperRange, , "ndis5" -HKR, Ndi\Interfaces, LowerRange, , "ethernet" -HKR, Ndi\Interfaces, DefLower, , "ethernet" -HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" -HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% -HKR, Ndi\Params\NetworkAddress, type, 0, "edit" -HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" -HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" -HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% -HKR, Ndi\Params\NetworkAddress, optional, 0, "0" -HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% -HKR, Ndi\Params\MaxSpeed, type, 0, "int" -HKR, Ndi\Params\MaxSpeed, default, 0, "100" -HKR, Ndi\Params\MaxSpeed, min, 0, "0" -HKR, Ndi\Params\MaxSpeed, max, 0, "2000" -HKR, Ndi\Params\MaxSpeed, step, 0, "1" -HKR, Ndi\Params\MaxSpeed, Base, 0, "10" -HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% -HKR, Ndi\Params\KeepLink, type, 0, "enum" -HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% -HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% -HKR, Ndi\Params\KeepLink, default, 0, "0" - - -[Neo.Service] -DisplayName = %Neo.Service.DispName% -Description = %Neo.Service.Desc% -ServiceType = 1 -StartType = 3 -ErrorControl = 1 -ServiceBinary = %12%\Neo_VPN67.sys -LoadOrderGroup = NDIS - -[Neo.Reg] -HKR, Ndi, Service, 0, Neo.Service.Name -HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" -HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" - -[Neo.EventLog] -HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN67.sys" -HKR, , TypesSupported, 0x00010001, 7 - -[Strings] -CompanyName = "SoftEther Corporation" -DiskDescription = "VPN Client Device Driver Install Disk" -Neo.Service.Name = "Neo_VPN67" -Neo.Service.DispName = "VPN Client Device Driver - VPN67" -Neo.Service.Desc = "VPN Client Adapter - VPN67" -NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN67" -Neo.EventLog.Name = "Neo" -NetworkAddress = "MAC Address" -DefaultAddress = "000001000001" -MaxSpeed = "Indicate Speed (Mbps)" -KeepLink = "Keep Link" -On = "On" -Off = "Off" - - -; Auto Generated 20180205_163610.777 - +; VPN Client Device Driver for Windows 2000 and Greater +; +; Copyright (c) SoftEther Corporation. All Rights Reserved. +; http://www.softether.co.jp/ +; +; BUILD 9658 + +[Version] +Signature = "$Windows NT$" +Class = Net +ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} +Provider = %CompanyName% +DriverVer = 02/04/2018, 4.25.0.9658 +CatalogFile.NT = inf_VPN67.cat + +[Manufacturer] +%CompanyName% = SoftEther, NTamd64 + +[SourceDisksNames] +1=%DiskDescription%, "", , + +[SourceDisksFiles] +Neo_VPN67.sys = 1 + +[DestinationDirs] +DefaultDestDir = 12 +Neo.CopyFiles.Sys = 12 + +[Neo.CopyFiles.Sys] +Neo_VPN67.sys, , , 2 + +[SoftEther.NTamd64] +%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN67 + +[NeoAdapter.Install] +Characteristics = 0x1 +AddReg = Neo.Reg, NeoAdapter.Ndi +CopyFiles = Neo.CopyFiles.Sys +*IfType = 53 +*MediaType = 0 +*PhysicalMediaType = 0 + +[NeoAdapter.Install.Services] +AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% + +[NeoAdapter.Ndi] +HKR, , NetworkAddress, 0, %DefaultAddress% +HKR, Ndi, DeviceID, , "NeoAdapter_VPN67" +HKR, , DevLoader, , ndis +HKR, , DeviceVxDs, , Neo_VPN67.sys +HKR, NDIS, LogDriverName, , "Neo_VPN67" +HKR, NDIS, MajorNdisVersion, 1, 5 +HKR, NDIS, MinorNdisVersion, 1, 0 +HKR, Ndi\Interfaces, DefUpper, , "ndis5" +HKR, Ndi\Interfaces, UpperRange, , "ndis5" +HKR, Ndi\Interfaces, LowerRange, , "ethernet" +HKR, Ndi\Interfaces, DefLower, , "ethernet" +HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" +HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% +HKR, Ndi\Params\NetworkAddress, type, 0, "edit" +HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" +HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" +HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% +HKR, Ndi\Params\NetworkAddress, optional, 0, "0" +HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% +HKR, Ndi\Params\MaxSpeed, type, 0, "int" +HKR, Ndi\Params\MaxSpeed, default, 0, "100" +HKR, Ndi\Params\MaxSpeed, min, 0, "0" +HKR, Ndi\Params\MaxSpeed, max, 0, "2000" +HKR, Ndi\Params\MaxSpeed, step, 0, "1" +HKR, Ndi\Params\MaxSpeed, Base, 0, "10" +HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% +HKR, Ndi\Params\KeepLink, type, 0, "enum" +HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% +HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% +HKR, Ndi\Params\KeepLink, default, 0, "0" + + +[Neo.Service] +DisplayName = %Neo.Service.DispName% +Description = %Neo.Service.Desc% +ServiceType = 1 +StartType = 3 +ErrorControl = 1 +ServiceBinary = %12%\Neo_VPN67.sys +LoadOrderGroup = NDIS + +[Neo.Reg] +HKR, Ndi, Service, 0, Neo.Service.Name +HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" +HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" + +[Neo.EventLog] +HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN67.sys" +HKR, , TypesSupported, 0x00010001, 7 + +[Strings] +CompanyName = "SoftEther Corporation" +DiskDescription = "VPN Client Device Driver Install Disk" +Neo.Service.Name = "Neo_VPN67" +Neo.Service.DispName = "VPN Client Device Driver - VPN67" +Neo.Service.Desc = "VPN Client Adapter - VPN67" +NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN67" +Neo.EventLog.Name = "Neo" +NetworkAddress = "MAC Address" +DefaultAddress = "000001000001" +MaxSpeed = "Indicate Speed (Mbps)" +KeepLink = "Keep Link" +On = "On" +Off = "Off" + + +; Auto Generated 20180205_163610.777 + diff --git a/src/bin/hamcore/DriverPackages/Neo6_Win8/x64/Neo6_x64_VPN68.inf b/src/bin/hamcore/DriverPackages/Neo6_Win8/x64/Neo6_x64_VPN68.inf index 0067d344..55e96a7f 100644 --- a/src/bin/hamcore/DriverPackages/Neo6_Win8/x64/Neo6_x64_VPN68.inf +++ b/src/bin/hamcore/DriverPackages/Neo6_Win8/x64/Neo6_x64_VPN68.inf @@ -1,114 +1,114 @@ -; VPN Client Device Driver for Windows 2000 and Greater -; -; Copyright (c) SoftEther Corporation. All Rights Reserved. -; http://www.softether.co.jp/ -; -; BUILD 9658 - -[Version] -Signature = "$Windows NT$" -Class = Net -ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} -Provider = %CompanyName% -DriverVer = 02/04/2018, 4.25.0.9658 -CatalogFile.NT = inf_VPN68.cat - -[Manufacturer] -%CompanyName% = SoftEther, NTamd64 - -[SourceDisksNames] -1=%DiskDescription%, "", , - -[SourceDisksFiles] -Neo_VPN68.sys = 1 - -[DestinationDirs] -DefaultDestDir = 12 -Neo.CopyFiles.Sys = 12 - -[Neo.CopyFiles.Sys] -Neo_VPN68.sys, , , 2 - -[SoftEther.NTamd64] -%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN68 - -[NeoAdapter.Install] -Characteristics = 0x1 -AddReg = Neo.Reg, NeoAdapter.Ndi -CopyFiles = Neo.CopyFiles.Sys -*IfType = 53 -*MediaType = 0 -*PhysicalMediaType = 0 - -[NeoAdapter.Install.Services] -AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% - -[NeoAdapter.Ndi] -HKR, , NetworkAddress, 0, %DefaultAddress% -HKR, Ndi, DeviceID, , "NeoAdapter_VPN68" -HKR, , DevLoader, , ndis -HKR, , DeviceVxDs, , Neo_VPN68.sys -HKR, NDIS, LogDriverName, , "Neo_VPN68" -HKR, NDIS, MajorNdisVersion, 1, 5 -HKR, NDIS, MinorNdisVersion, 1, 0 -HKR, Ndi\Interfaces, DefUpper, , "ndis5" -HKR, Ndi\Interfaces, UpperRange, , "ndis5" -HKR, Ndi\Interfaces, LowerRange, , "ethernet" -HKR, Ndi\Interfaces, DefLower, , "ethernet" -HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" -HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% -HKR, Ndi\Params\NetworkAddress, type, 0, "edit" -HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" -HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" -HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% -HKR, Ndi\Params\NetworkAddress, optional, 0, "0" -HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% -HKR, Ndi\Params\MaxSpeed, type, 0, "int" -HKR, Ndi\Params\MaxSpeed, default, 0, "100" -HKR, Ndi\Params\MaxSpeed, min, 0, "0" -HKR, Ndi\Params\MaxSpeed, max, 0, "2000" -HKR, Ndi\Params\MaxSpeed, step, 0, "1" -HKR, Ndi\Params\MaxSpeed, Base, 0, "10" -HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% -HKR, Ndi\Params\KeepLink, type, 0, "enum" -HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% -HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% -HKR, Ndi\Params\KeepLink, default, 0, "0" - - -[Neo.Service] -DisplayName = %Neo.Service.DispName% -Description = %Neo.Service.Desc% -ServiceType = 1 -StartType = 3 -ErrorControl = 1 -ServiceBinary = %12%\Neo_VPN68.sys -LoadOrderGroup = NDIS - -[Neo.Reg] -HKR, Ndi, Service, 0, Neo.Service.Name -HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" -HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" - -[Neo.EventLog] -HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN68.sys" -HKR, , TypesSupported, 0x00010001, 7 - -[Strings] -CompanyName = "SoftEther Corporation" -DiskDescription = "VPN Client Device Driver Install Disk" -Neo.Service.Name = "Neo_VPN68" -Neo.Service.DispName = "VPN Client Device Driver - VPN68" -Neo.Service.Desc = "VPN Client Adapter - VPN68" -NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN68" -Neo.EventLog.Name = "Neo" -NetworkAddress = "MAC Address" -DefaultAddress = "000001000001" -MaxSpeed = "Indicate Speed (Mbps)" -KeepLink = "Keep Link" -On = "On" -Off = "Off" - - -; Auto Generated 20180205_163610.777 - +; VPN Client Device Driver for Windows 2000 and Greater +; +; Copyright (c) SoftEther Corporation. All Rights Reserved. +; http://www.softether.co.jp/ +; +; BUILD 9658 + +[Version] +Signature = "$Windows NT$" +Class = Net +ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} +Provider = %CompanyName% +DriverVer = 02/04/2018, 4.25.0.9658 +CatalogFile.NT = inf_VPN68.cat + +[Manufacturer] +%CompanyName% = SoftEther, NTamd64 + +[SourceDisksNames] +1=%DiskDescription%, "", , + +[SourceDisksFiles] +Neo_VPN68.sys = 1 + +[DestinationDirs] +DefaultDestDir = 12 +Neo.CopyFiles.Sys = 12 + +[Neo.CopyFiles.Sys] +Neo_VPN68.sys, , , 2 + +[SoftEther.NTamd64] +%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN68 + +[NeoAdapter.Install] +Characteristics = 0x1 +AddReg = Neo.Reg, NeoAdapter.Ndi +CopyFiles = Neo.CopyFiles.Sys +*IfType = 53 +*MediaType = 0 +*PhysicalMediaType = 0 + +[NeoAdapter.Install.Services] +AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% + +[NeoAdapter.Ndi] +HKR, , NetworkAddress, 0, %DefaultAddress% +HKR, Ndi, DeviceID, , "NeoAdapter_VPN68" +HKR, , DevLoader, , ndis +HKR, , DeviceVxDs, , Neo_VPN68.sys +HKR, NDIS, LogDriverName, , "Neo_VPN68" +HKR, NDIS, MajorNdisVersion, 1, 5 +HKR, NDIS, MinorNdisVersion, 1, 0 +HKR, Ndi\Interfaces, DefUpper, , "ndis5" +HKR, Ndi\Interfaces, UpperRange, , "ndis5" +HKR, Ndi\Interfaces, LowerRange, , "ethernet" +HKR, Ndi\Interfaces, DefLower, , "ethernet" +HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" +HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% +HKR, Ndi\Params\NetworkAddress, type, 0, "edit" +HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" +HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" +HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% +HKR, Ndi\Params\NetworkAddress, optional, 0, "0" +HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% +HKR, Ndi\Params\MaxSpeed, type, 0, "int" +HKR, Ndi\Params\MaxSpeed, default, 0, "100" +HKR, Ndi\Params\MaxSpeed, min, 0, "0" +HKR, Ndi\Params\MaxSpeed, max, 0, "2000" +HKR, Ndi\Params\MaxSpeed, step, 0, "1" +HKR, Ndi\Params\MaxSpeed, Base, 0, "10" +HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% +HKR, Ndi\Params\KeepLink, type, 0, "enum" +HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% +HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% +HKR, Ndi\Params\KeepLink, default, 0, "0" + + +[Neo.Service] +DisplayName = %Neo.Service.DispName% +Description = %Neo.Service.Desc% +ServiceType = 1 +StartType = 3 +ErrorControl = 1 +ServiceBinary = %12%\Neo_VPN68.sys +LoadOrderGroup = NDIS + +[Neo.Reg] +HKR, Ndi, Service, 0, Neo.Service.Name +HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" +HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" + +[Neo.EventLog] +HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN68.sys" +HKR, , TypesSupported, 0x00010001, 7 + +[Strings] +CompanyName = "SoftEther Corporation" +DiskDescription = "VPN Client Device Driver Install Disk" +Neo.Service.Name = "Neo_VPN68" +Neo.Service.DispName = "VPN Client Device Driver - VPN68" +Neo.Service.Desc = "VPN Client Adapter - VPN68" +NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN68" +Neo.EventLog.Name = "Neo" +NetworkAddress = "MAC Address" +DefaultAddress = "000001000001" +MaxSpeed = "Indicate Speed (Mbps)" +KeepLink = "Keep Link" +On = "On" +Off = "Off" + + +; Auto Generated 20180205_163610.777 + diff --git a/src/bin/hamcore/DriverPackages/Neo6_Win8/x64/Neo6_x64_VPN69.inf b/src/bin/hamcore/DriverPackages/Neo6_Win8/x64/Neo6_x64_VPN69.inf index 2d5e67c0..2105ae1a 100644 --- a/src/bin/hamcore/DriverPackages/Neo6_Win8/x64/Neo6_x64_VPN69.inf +++ b/src/bin/hamcore/DriverPackages/Neo6_Win8/x64/Neo6_x64_VPN69.inf @@ -1,114 +1,114 @@ -; VPN Client Device Driver for Windows 2000 and Greater -; -; Copyright (c) SoftEther Corporation. All Rights Reserved. -; http://www.softether.co.jp/ -; -; BUILD 9658 - -[Version] -Signature = "$Windows NT$" -Class = Net -ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} -Provider = %CompanyName% -DriverVer = 02/04/2018, 4.25.0.9658 -CatalogFile.NT = inf_VPN69.cat - -[Manufacturer] -%CompanyName% = SoftEther, NTamd64 - -[SourceDisksNames] -1=%DiskDescription%, "", , - -[SourceDisksFiles] -Neo_VPN69.sys = 1 - -[DestinationDirs] -DefaultDestDir = 12 -Neo.CopyFiles.Sys = 12 - -[Neo.CopyFiles.Sys] -Neo_VPN69.sys, , , 2 - -[SoftEther.NTamd64] -%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN69 - -[NeoAdapter.Install] -Characteristics = 0x1 -AddReg = Neo.Reg, NeoAdapter.Ndi -CopyFiles = Neo.CopyFiles.Sys -*IfType = 53 -*MediaType = 0 -*PhysicalMediaType = 0 - -[NeoAdapter.Install.Services] -AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% - -[NeoAdapter.Ndi] -HKR, , NetworkAddress, 0, %DefaultAddress% -HKR, Ndi, DeviceID, , "NeoAdapter_VPN69" -HKR, , DevLoader, , ndis -HKR, , DeviceVxDs, , Neo_VPN69.sys -HKR, NDIS, LogDriverName, , "Neo_VPN69" -HKR, NDIS, MajorNdisVersion, 1, 5 -HKR, NDIS, MinorNdisVersion, 1, 0 -HKR, Ndi\Interfaces, DefUpper, , "ndis5" -HKR, Ndi\Interfaces, UpperRange, , "ndis5" -HKR, Ndi\Interfaces, LowerRange, , "ethernet" -HKR, Ndi\Interfaces, DefLower, , "ethernet" -HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" -HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% -HKR, Ndi\Params\NetworkAddress, type, 0, "edit" -HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" -HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" -HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% -HKR, Ndi\Params\NetworkAddress, optional, 0, "0" -HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% -HKR, Ndi\Params\MaxSpeed, type, 0, "int" -HKR, Ndi\Params\MaxSpeed, default, 0, "100" -HKR, Ndi\Params\MaxSpeed, min, 0, "0" -HKR, Ndi\Params\MaxSpeed, max, 0, "2000" -HKR, Ndi\Params\MaxSpeed, step, 0, "1" -HKR, Ndi\Params\MaxSpeed, Base, 0, "10" -HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% -HKR, Ndi\Params\KeepLink, type, 0, "enum" -HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% -HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% -HKR, Ndi\Params\KeepLink, default, 0, "0" - - -[Neo.Service] -DisplayName = %Neo.Service.DispName% -Description = %Neo.Service.Desc% -ServiceType = 1 -StartType = 3 -ErrorControl = 1 -ServiceBinary = %12%\Neo_VPN69.sys -LoadOrderGroup = NDIS - -[Neo.Reg] -HKR, Ndi, Service, 0, Neo.Service.Name -HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" -HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" - -[Neo.EventLog] -HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN69.sys" -HKR, , TypesSupported, 0x00010001, 7 - -[Strings] -CompanyName = "SoftEther Corporation" -DiskDescription = "VPN Client Device Driver Install Disk" -Neo.Service.Name = "Neo_VPN69" -Neo.Service.DispName = "VPN Client Device Driver - VPN69" -Neo.Service.Desc = "VPN Client Adapter - VPN69" -NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN69" -Neo.EventLog.Name = "Neo" -NetworkAddress = "MAC Address" -DefaultAddress = "000001000001" -MaxSpeed = "Indicate Speed (Mbps)" -KeepLink = "Keep Link" -On = "On" -Off = "Off" - - -; Auto Generated 20180205_163610.778 - +; VPN Client Device Driver for Windows 2000 and Greater +; +; Copyright (c) SoftEther Corporation. All Rights Reserved. +; http://www.softether.co.jp/ +; +; BUILD 9658 + +[Version] +Signature = "$Windows NT$" +Class = Net +ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} +Provider = %CompanyName% +DriverVer = 02/04/2018, 4.25.0.9658 +CatalogFile.NT = inf_VPN69.cat + +[Manufacturer] +%CompanyName% = SoftEther, NTamd64 + +[SourceDisksNames] +1=%DiskDescription%, "", , + +[SourceDisksFiles] +Neo_VPN69.sys = 1 + +[DestinationDirs] +DefaultDestDir = 12 +Neo.CopyFiles.Sys = 12 + +[Neo.CopyFiles.Sys] +Neo_VPN69.sys, , , 2 + +[SoftEther.NTamd64] +%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN69 + +[NeoAdapter.Install] +Characteristics = 0x1 +AddReg = Neo.Reg, NeoAdapter.Ndi +CopyFiles = Neo.CopyFiles.Sys +*IfType = 53 +*MediaType = 0 +*PhysicalMediaType = 0 + +[NeoAdapter.Install.Services] +AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% + +[NeoAdapter.Ndi] +HKR, , NetworkAddress, 0, %DefaultAddress% +HKR, Ndi, DeviceID, , "NeoAdapter_VPN69" +HKR, , DevLoader, , ndis +HKR, , DeviceVxDs, , Neo_VPN69.sys +HKR, NDIS, LogDriverName, , "Neo_VPN69" +HKR, NDIS, MajorNdisVersion, 1, 5 +HKR, NDIS, MinorNdisVersion, 1, 0 +HKR, Ndi\Interfaces, DefUpper, , "ndis5" +HKR, Ndi\Interfaces, UpperRange, , "ndis5" +HKR, Ndi\Interfaces, LowerRange, , "ethernet" +HKR, Ndi\Interfaces, DefLower, , "ethernet" +HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" +HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% +HKR, Ndi\Params\NetworkAddress, type, 0, "edit" +HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" +HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" +HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% +HKR, Ndi\Params\NetworkAddress, optional, 0, "0" +HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% +HKR, Ndi\Params\MaxSpeed, type, 0, "int" +HKR, Ndi\Params\MaxSpeed, default, 0, "100" +HKR, Ndi\Params\MaxSpeed, min, 0, "0" +HKR, Ndi\Params\MaxSpeed, max, 0, "2000" +HKR, Ndi\Params\MaxSpeed, step, 0, "1" +HKR, Ndi\Params\MaxSpeed, Base, 0, "10" +HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% +HKR, Ndi\Params\KeepLink, type, 0, "enum" +HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% +HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% +HKR, Ndi\Params\KeepLink, default, 0, "0" + + +[Neo.Service] +DisplayName = %Neo.Service.DispName% +Description = %Neo.Service.Desc% +ServiceType = 1 +StartType = 3 +ErrorControl = 1 +ServiceBinary = %12%\Neo_VPN69.sys +LoadOrderGroup = NDIS + +[Neo.Reg] +HKR, Ndi, Service, 0, Neo.Service.Name +HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" +HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" + +[Neo.EventLog] +HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN69.sys" +HKR, , TypesSupported, 0x00010001, 7 + +[Strings] +CompanyName = "SoftEther Corporation" +DiskDescription = "VPN Client Device Driver Install Disk" +Neo.Service.Name = "Neo_VPN69" +Neo.Service.DispName = "VPN Client Device Driver - VPN69" +Neo.Service.Desc = "VPN Client Adapter - VPN69" +NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN69" +Neo.EventLog.Name = "Neo" +NetworkAddress = "MAC Address" +DefaultAddress = "000001000001" +MaxSpeed = "Indicate Speed (Mbps)" +KeepLink = "Keep Link" +On = "On" +Off = "Off" + + +; Auto Generated 20180205_163610.778 + diff --git a/src/bin/hamcore/DriverPackages/Neo6_Win8/x64/Neo6_x64_VPN7.inf b/src/bin/hamcore/DriverPackages/Neo6_Win8/x64/Neo6_x64_VPN7.inf index 3c1cf384..bbdfcf27 100644 --- a/src/bin/hamcore/DriverPackages/Neo6_Win8/x64/Neo6_x64_VPN7.inf +++ b/src/bin/hamcore/DriverPackages/Neo6_Win8/x64/Neo6_x64_VPN7.inf @@ -1,114 +1,114 @@ -; VPN Client Device Driver for Windows 2000 and Greater -; -; Copyright (c) SoftEther Corporation. All Rights Reserved. -; http://www.softether.co.jp/ -; -; BUILD 9658 - -[Version] -Signature = "$Windows NT$" -Class = Net -ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} -Provider = %CompanyName% -DriverVer = 02/04/2018, 4.25.0.9658 -CatalogFile.NT = inf_VPN7.cat - -[Manufacturer] -%CompanyName% = SoftEther, NTamd64 - -[SourceDisksNames] -1=%DiskDescription%, "", , - -[SourceDisksFiles] -Neo_VPN7.sys = 1 - -[DestinationDirs] -DefaultDestDir = 12 -Neo.CopyFiles.Sys = 12 - -[Neo.CopyFiles.Sys] -Neo_VPN7.sys, , , 2 - -[SoftEther.NTamd64] -%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN7 - -[NeoAdapter.Install] -Characteristics = 0x1 -AddReg = Neo.Reg, NeoAdapter.Ndi -CopyFiles = Neo.CopyFiles.Sys -*IfType = 53 -*MediaType = 0 -*PhysicalMediaType = 0 - -[NeoAdapter.Install.Services] -AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% - -[NeoAdapter.Ndi] -HKR, , NetworkAddress, 0, %DefaultAddress% -HKR, Ndi, DeviceID, , "NeoAdapter_VPN7" -HKR, , DevLoader, , ndis -HKR, , DeviceVxDs, , Neo_VPN7.sys -HKR, NDIS, LogDriverName, , "Neo_VPN7" -HKR, NDIS, MajorNdisVersion, 1, 5 -HKR, NDIS, MinorNdisVersion, 1, 0 -HKR, Ndi\Interfaces, DefUpper, , "ndis5" -HKR, Ndi\Interfaces, UpperRange, , "ndis5" -HKR, Ndi\Interfaces, LowerRange, , "ethernet" -HKR, Ndi\Interfaces, DefLower, , "ethernet" -HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" -HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% -HKR, Ndi\Params\NetworkAddress, type, 0, "edit" -HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" -HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" -HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% -HKR, Ndi\Params\NetworkAddress, optional, 0, "0" -HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% -HKR, Ndi\Params\MaxSpeed, type, 0, "int" -HKR, Ndi\Params\MaxSpeed, default, 0, "100" -HKR, Ndi\Params\MaxSpeed, min, 0, "0" -HKR, Ndi\Params\MaxSpeed, max, 0, "2000" -HKR, Ndi\Params\MaxSpeed, step, 0, "1" -HKR, Ndi\Params\MaxSpeed, Base, 0, "10" -HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% -HKR, Ndi\Params\KeepLink, type, 0, "enum" -HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% -HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% -HKR, Ndi\Params\KeepLink, default, 0, "0" - - -[Neo.Service] -DisplayName = %Neo.Service.DispName% -Description = %Neo.Service.Desc% -ServiceType = 1 -StartType = 3 -ErrorControl = 1 -ServiceBinary = %12%\Neo_VPN7.sys -LoadOrderGroup = NDIS - -[Neo.Reg] -HKR, Ndi, Service, 0, Neo.Service.Name -HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" -HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" - -[Neo.EventLog] -HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN7.sys" -HKR, , TypesSupported, 0x00010001, 7 - -[Strings] -CompanyName = "SoftEther Corporation" -DiskDescription = "VPN Client Device Driver Install Disk" -Neo.Service.Name = "Neo_VPN7" -Neo.Service.DispName = "VPN Client Device Driver - VPN7" -Neo.Service.Desc = "VPN Client Adapter - VPN7" -NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN7" -Neo.EventLog.Name = "Neo" -NetworkAddress = "MAC Address" -DefaultAddress = "000001000001" -MaxSpeed = "Indicate Speed (Mbps)" -KeepLink = "Keep Link" -On = "On" -Off = "Off" - - -; Auto Generated 20180205_163610.741 - +; VPN Client Device Driver for Windows 2000 and Greater +; +; Copyright (c) SoftEther Corporation. All Rights Reserved. +; http://www.softether.co.jp/ +; +; BUILD 9658 + +[Version] +Signature = "$Windows NT$" +Class = Net +ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} +Provider = %CompanyName% +DriverVer = 02/04/2018, 4.25.0.9658 +CatalogFile.NT = inf_VPN7.cat + +[Manufacturer] +%CompanyName% = SoftEther, NTamd64 + +[SourceDisksNames] +1=%DiskDescription%, "", , + +[SourceDisksFiles] +Neo_VPN7.sys = 1 + +[DestinationDirs] +DefaultDestDir = 12 +Neo.CopyFiles.Sys = 12 + +[Neo.CopyFiles.Sys] +Neo_VPN7.sys, , , 2 + +[SoftEther.NTamd64] +%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN7 + +[NeoAdapter.Install] +Characteristics = 0x1 +AddReg = Neo.Reg, NeoAdapter.Ndi +CopyFiles = Neo.CopyFiles.Sys +*IfType = 53 +*MediaType = 0 +*PhysicalMediaType = 0 + +[NeoAdapter.Install.Services] +AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% + +[NeoAdapter.Ndi] +HKR, , NetworkAddress, 0, %DefaultAddress% +HKR, Ndi, DeviceID, , "NeoAdapter_VPN7" +HKR, , DevLoader, , ndis +HKR, , DeviceVxDs, , Neo_VPN7.sys +HKR, NDIS, LogDriverName, , "Neo_VPN7" +HKR, NDIS, MajorNdisVersion, 1, 5 +HKR, NDIS, MinorNdisVersion, 1, 0 +HKR, Ndi\Interfaces, DefUpper, , "ndis5" +HKR, Ndi\Interfaces, UpperRange, , "ndis5" +HKR, Ndi\Interfaces, LowerRange, , "ethernet" +HKR, Ndi\Interfaces, DefLower, , "ethernet" +HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" +HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% +HKR, Ndi\Params\NetworkAddress, type, 0, "edit" +HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" +HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" +HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% +HKR, Ndi\Params\NetworkAddress, optional, 0, "0" +HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% +HKR, Ndi\Params\MaxSpeed, type, 0, "int" +HKR, Ndi\Params\MaxSpeed, default, 0, "100" +HKR, Ndi\Params\MaxSpeed, min, 0, "0" +HKR, Ndi\Params\MaxSpeed, max, 0, "2000" +HKR, Ndi\Params\MaxSpeed, step, 0, "1" +HKR, Ndi\Params\MaxSpeed, Base, 0, "10" +HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% +HKR, Ndi\Params\KeepLink, type, 0, "enum" +HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% +HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% +HKR, Ndi\Params\KeepLink, default, 0, "0" + + +[Neo.Service] +DisplayName = %Neo.Service.DispName% +Description = %Neo.Service.Desc% +ServiceType = 1 +StartType = 3 +ErrorControl = 1 +ServiceBinary = %12%\Neo_VPN7.sys +LoadOrderGroup = NDIS + +[Neo.Reg] +HKR, Ndi, Service, 0, Neo.Service.Name +HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" +HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" + +[Neo.EventLog] +HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN7.sys" +HKR, , TypesSupported, 0x00010001, 7 + +[Strings] +CompanyName = "SoftEther Corporation" +DiskDescription = "VPN Client Device Driver Install Disk" +Neo.Service.Name = "Neo_VPN7" +Neo.Service.DispName = "VPN Client Device Driver - VPN7" +Neo.Service.Desc = "VPN Client Adapter - VPN7" +NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN7" +Neo.EventLog.Name = "Neo" +NetworkAddress = "MAC Address" +DefaultAddress = "000001000001" +MaxSpeed = "Indicate Speed (Mbps)" +KeepLink = "Keep Link" +On = "On" +Off = "Off" + + +; Auto Generated 20180205_163610.741 + diff --git a/src/bin/hamcore/DriverPackages/Neo6_Win8/x64/Neo6_x64_VPN70.inf b/src/bin/hamcore/DriverPackages/Neo6_Win8/x64/Neo6_x64_VPN70.inf index 5d337aa6..0a38ec95 100644 --- a/src/bin/hamcore/DriverPackages/Neo6_Win8/x64/Neo6_x64_VPN70.inf +++ b/src/bin/hamcore/DriverPackages/Neo6_Win8/x64/Neo6_x64_VPN70.inf @@ -1,114 +1,114 @@ -; VPN Client Device Driver for Windows 2000 and Greater -; -; Copyright (c) SoftEther Corporation. All Rights Reserved. -; http://www.softether.co.jp/ -; -; BUILD 9658 - -[Version] -Signature = "$Windows NT$" -Class = Net -ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} -Provider = %CompanyName% -DriverVer = 02/04/2018, 4.25.0.9658 -CatalogFile.NT = inf_VPN70.cat - -[Manufacturer] -%CompanyName% = SoftEther, NTamd64 - -[SourceDisksNames] -1=%DiskDescription%, "", , - -[SourceDisksFiles] -Neo_VPN70.sys = 1 - -[DestinationDirs] -DefaultDestDir = 12 -Neo.CopyFiles.Sys = 12 - -[Neo.CopyFiles.Sys] -Neo_VPN70.sys, , , 2 - -[SoftEther.NTamd64] -%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN70 - -[NeoAdapter.Install] -Characteristics = 0x1 -AddReg = Neo.Reg, NeoAdapter.Ndi -CopyFiles = Neo.CopyFiles.Sys -*IfType = 53 -*MediaType = 0 -*PhysicalMediaType = 0 - -[NeoAdapter.Install.Services] -AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% - -[NeoAdapter.Ndi] -HKR, , NetworkAddress, 0, %DefaultAddress% -HKR, Ndi, DeviceID, , "NeoAdapter_VPN70" -HKR, , DevLoader, , ndis -HKR, , DeviceVxDs, , Neo_VPN70.sys -HKR, NDIS, LogDriverName, , "Neo_VPN70" -HKR, NDIS, MajorNdisVersion, 1, 5 -HKR, NDIS, MinorNdisVersion, 1, 0 -HKR, Ndi\Interfaces, DefUpper, , "ndis5" -HKR, Ndi\Interfaces, UpperRange, , "ndis5" -HKR, Ndi\Interfaces, LowerRange, , "ethernet" -HKR, Ndi\Interfaces, DefLower, , "ethernet" -HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" -HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% -HKR, Ndi\Params\NetworkAddress, type, 0, "edit" -HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" -HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" -HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% -HKR, Ndi\Params\NetworkAddress, optional, 0, "0" -HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% -HKR, Ndi\Params\MaxSpeed, type, 0, "int" -HKR, Ndi\Params\MaxSpeed, default, 0, "100" -HKR, Ndi\Params\MaxSpeed, min, 0, "0" -HKR, Ndi\Params\MaxSpeed, max, 0, "2000" -HKR, Ndi\Params\MaxSpeed, step, 0, "1" -HKR, Ndi\Params\MaxSpeed, Base, 0, "10" -HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% -HKR, Ndi\Params\KeepLink, type, 0, "enum" -HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% -HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% -HKR, Ndi\Params\KeepLink, default, 0, "0" - - -[Neo.Service] -DisplayName = %Neo.Service.DispName% -Description = %Neo.Service.Desc% -ServiceType = 1 -StartType = 3 -ErrorControl = 1 -ServiceBinary = %12%\Neo_VPN70.sys -LoadOrderGroup = NDIS - -[Neo.Reg] -HKR, Ndi, Service, 0, Neo.Service.Name -HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" -HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" - -[Neo.EventLog] -HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN70.sys" -HKR, , TypesSupported, 0x00010001, 7 - -[Strings] -CompanyName = "SoftEther Corporation" -DiskDescription = "VPN Client Device Driver Install Disk" -Neo.Service.Name = "Neo_VPN70" -Neo.Service.DispName = "VPN Client Device Driver - VPN70" -Neo.Service.Desc = "VPN Client Adapter - VPN70" -NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN70" -Neo.EventLog.Name = "Neo" -NetworkAddress = "MAC Address" -DefaultAddress = "000001000001" -MaxSpeed = "Indicate Speed (Mbps)" -KeepLink = "Keep Link" -On = "On" -Off = "Off" - - -; Auto Generated 20180205_163610.779 - +; VPN Client Device Driver for Windows 2000 and Greater +; +; Copyright (c) SoftEther Corporation. All Rights Reserved. +; http://www.softether.co.jp/ +; +; BUILD 9658 + +[Version] +Signature = "$Windows NT$" +Class = Net +ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} +Provider = %CompanyName% +DriverVer = 02/04/2018, 4.25.0.9658 +CatalogFile.NT = inf_VPN70.cat + +[Manufacturer] +%CompanyName% = SoftEther, NTamd64 + +[SourceDisksNames] +1=%DiskDescription%, "", , + +[SourceDisksFiles] +Neo_VPN70.sys = 1 + +[DestinationDirs] +DefaultDestDir = 12 +Neo.CopyFiles.Sys = 12 + +[Neo.CopyFiles.Sys] +Neo_VPN70.sys, , , 2 + +[SoftEther.NTamd64] +%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN70 + +[NeoAdapter.Install] +Characteristics = 0x1 +AddReg = Neo.Reg, NeoAdapter.Ndi +CopyFiles = Neo.CopyFiles.Sys +*IfType = 53 +*MediaType = 0 +*PhysicalMediaType = 0 + +[NeoAdapter.Install.Services] +AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% + +[NeoAdapter.Ndi] +HKR, , NetworkAddress, 0, %DefaultAddress% +HKR, Ndi, DeviceID, , "NeoAdapter_VPN70" +HKR, , DevLoader, , ndis +HKR, , DeviceVxDs, , Neo_VPN70.sys +HKR, NDIS, LogDriverName, , "Neo_VPN70" +HKR, NDIS, MajorNdisVersion, 1, 5 +HKR, NDIS, MinorNdisVersion, 1, 0 +HKR, Ndi\Interfaces, DefUpper, , "ndis5" +HKR, Ndi\Interfaces, UpperRange, , "ndis5" +HKR, Ndi\Interfaces, LowerRange, , "ethernet" +HKR, Ndi\Interfaces, DefLower, , "ethernet" +HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" +HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% +HKR, Ndi\Params\NetworkAddress, type, 0, "edit" +HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" +HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" +HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% +HKR, Ndi\Params\NetworkAddress, optional, 0, "0" +HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% +HKR, Ndi\Params\MaxSpeed, type, 0, "int" +HKR, Ndi\Params\MaxSpeed, default, 0, "100" +HKR, Ndi\Params\MaxSpeed, min, 0, "0" +HKR, Ndi\Params\MaxSpeed, max, 0, "2000" +HKR, Ndi\Params\MaxSpeed, step, 0, "1" +HKR, Ndi\Params\MaxSpeed, Base, 0, "10" +HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% +HKR, Ndi\Params\KeepLink, type, 0, "enum" +HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% +HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% +HKR, Ndi\Params\KeepLink, default, 0, "0" + + +[Neo.Service] +DisplayName = %Neo.Service.DispName% +Description = %Neo.Service.Desc% +ServiceType = 1 +StartType = 3 +ErrorControl = 1 +ServiceBinary = %12%\Neo_VPN70.sys +LoadOrderGroup = NDIS + +[Neo.Reg] +HKR, Ndi, Service, 0, Neo.Service.Name +HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" +HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" + +[Neo.EventLog] +HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN70.sys" +HKR, , TypesSupported, 0x00010001, 7 + +[Strings] +CompanyName = "SoftEther Corporation" +DiskDescription = "VPN Client Device Driver Install Disk" +Neo.Service.Name = "Neo_VPN70" +Neo.Service.DispName = "VPN Client Device Driver - VPN70" +Neo.Service.Desc = "VPN Client Adapter - VPN70" +NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN70" +Neo.EventLog.Name = "Neo" +NetworkAddress = "MAC Address" +DefaultAddress = "000001000001" +MaxSpeed = "Indicate Speed (Mbps)" +KeepLink = "Keep Link" +On = "On" +Off = "Off" + + +; Auto Generated 20180205_163610.779 + diff --git a/src/bin/hamcore/DriverPackages/Neo6_Win8/x64/Neo6_x64_VPN71.inf b/src/bin/hamcore/DriverPackages/Neo6_Win8/x64/Neo6_x64_VPN71.inf index 42d6661f..52145cb3 100644 --- a/src/bin/hamcore/DriverPackages/Neo6_Win8/x64/Neo6_x64_VPN71.inf +++ b/src/bin/hamcore/DriverPackages/Neo6_Win8/x64/Neo6_x64_VPN71.inf @@ -1,114 +1,114 @@ -; VPN Client Device Driver for Windows 2000 and Greater -; -; Copyright (c) SoftEther Corporation. All Rights Reserved. -; http://www.softether.co.jp/ -; -; BUILD 9658 - -[Version] -Signature = "$Windows NT$" -Class = Net -ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} -Provider = %CompanyName% -DriverVer = 02/04/2018, 4.25.0.9658 -CatalogFile.NT = inf_VPN71.cat - -[Manufacturer] -%CompanyName% = SoftEther, NTamd64 - -[SourceDisksNames] -1=%DiskDescription%, "", , - -[SourceDisksFiles] -Neo_VPN71.sys = 1 - -[DestinationDirs] -DefaultDestDir = 12 -Neo.CopyFiles.Sys = 12 - -[Neo.CopyFiles.Sys] -Neo_VPN71.sys, , , 2 - -[SoftEther.NTamd64] -%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN71 - -[NeoAdapter.Install] -Characteristics = 0x1 -AddReg = Neo.Reg, NeoAdapter.Ndi -CopyFiles = Neo.CopyFiles.Sys -*IfType = 53 -*MediaType = 0 -*PhysicalMediaType = 0 - -[NeoAdapter.Install.Services] -AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% - -[NeoAdapter.Ndi] -HKR, , NetworkAddress, 0, %DefaultAddress% -HKR, Ndi, DeviceID, , "NeoAdapter_VPN71" -HKR, , DevLoader, , ndis -HKR, , DeviceVxDs, , Neo_VPN71.sys -HKR, NDIS, LogDriverName, , "Neo_VPN71" -HKR, NDIS, MajorNdisVersion, 1, 5 -HKR, NDIS, MinorNdisVersion, 1, 0 -HKR, Ndi\Interfaces, DefUpper, , "ndis5" -HKR, Ndi\Interfaces, UpperRange, , "ndis5" -HKR, Ndi\Interfaces, LowerRange, , "ethernet" -HKR, Ndi\Interfaces, DefLower, , "ethernet" -HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" -HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% -HKR, Ndi\Params\NetworkAddress, type, 0, "edit" -HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" -HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" -HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% -HKR, Ndi\Params\NetworkAddress, optional, 0, "0" -HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% -HKR, Ndi\Params\MaxSpeed, type, 0, "int" -HKR, Ndi\Params\MaxSpeed, default, 0, "100" -HKR, Ndi\Params\MaxSpeed, min, 0, "0" -HKR, Ndi\Params\MaxSpeed, max, 0, "2000" -HKR, Ndi\Params\MaxSpeed, step, 0, "1" -HKR, Ndi\Params\MaxSpeed, Base, 0, "10" -HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% -HKR, Ndi\Params\KeepLink, type, 0, "enum" -HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% -HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% -HKR, Ndi\Params\KeepLink, default, 0, "0" - - -[Neo.Service] -DisplayName = %Neo.Service.DispName% -Description = %Neo.Service.Desc% -ServiceType = 1 -StartType = 3 -ErrorControl = 1 -ServiceBinary = %12%\Neo_VPN71.sys -LoadOrderGroup = NDIS - -[Neo.Reg] -HKR, Ndi, Service, 0, Neo.Service.Name -HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" -HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" - -[Neo.EventLog] -HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN71.sys" -HKR, , TypesSupported, 0x00010001, 7 - -[Strings] -CompanyName = "SoftEther Corporation" -DiskDescription = "VPN Client Device Driver Install Disk" -Neo.Service.Name = "Neo_VPN71" -Neo.Service.DispName = "VPN Client Device Driver - VPN71" -Neo.Service.Desc = "VPN Client Adapter - VPN71" -NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN71" -Neo.EventLog.Name = "Neo" -NetworkAddress = "MAC Address" -DefaultAddress = "000001000001" -MaxSpeed = "Indicate Speed (Mbps)" -KeepLink = "Keep Link" -On = "On" -Off = "Off" - - -; Auto Generated 20180205_163610.780 - +; VPN Client Device Driver for Windows 2000 and Greater +; +; Copyright (c) SoftEther Corporation. All Rights Reserved. +; http://www.softether.co.jp/ +; +; BUILD 9658 + +[Version] +Signature = "$Windows NT$" +Class = Net +ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} +Provider = %CompanyName% +DriverVer = 02/04/2018, 4.25.0.9658 +CatalogFile.NT = inf_VPN71.cat + +[Manufacturer] +%CompanyName% = SoftEther, NTamd64 + +[SourceDisksNames] +1=%DiskDescription%, "", , + +[SourceDisksFiles] +Neo_VPN71.sys = 1 + +[DestinationDirs] +DefaultDestDir = 12 +Neo.CopyFiles.Sys = 12 + +[Neo.CopyFiles.Sys] +Neo_VPN71.sys, , , 2 + +[SoftEther.NTamd64] +%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN71 + +[NeoAdapter.Install] +Characteristics = 0x1 +AddReg = Neo.Reg, NeoAdapter.Ndi +CopyFiles = Neo.CopyFiles.Sys +*IfType = 53 +*MediaType = 0 +*PhysicalMediaType = 0 + +[NeoAdapter.Install.Services] +AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% + +[NeoAdapter.Ndi] +HKR, , NetworkAddress, 0, %DefaultAddress% +HKR, Ndi, DeviceID, , "NeoAdapter_VPN71" +HKR, , DevLoader, , ndis +HKR, , DeviceVxDs, , Neo_VPN71.sys +HKR, NDIS, LogDriverName, , "Neo_VPN71" +HKR, NDIS, MajorNdisVersion, 1, 5 +HKR, NDIS, MinorNdisVersion, 1, 0 +HKR, Ndi\Interfaces, DefUpper, , "ndis5" +HKR, Ndi\Interfaces, UpperRange, , "ndis5" +HKR, Ndi\Interfaces, LowerRange, , "ethernet" +HKR, Ndi\Interfaces, DefLower, , "ethernet" +HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" +HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% +HKR, Ndi\Params\NetworkAddress, type, 0, "edit" +HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" +HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" +HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% +HKR, Ndi\Params\NetworkAddress, optional, 0, "0" +HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% +HKR, Ndi\Params\MaxSpeed, type, 0, "int" +HKR, Ndi\Params\MaxSpeed, default, 0, "100" +HKR, Ndi\Params\MaxSpeed, min, 0, "0" +HKR, Ndi\Params\MaxSpeed, max, 0, "2000" +HKR, Ndi\Params\MaxSpeed, step, 0, "1" +HKR, Ndi\Params\MaxSpeed, Base, 0, "10" +HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% +HKR, Ndi\Params\KeepLink, type, 0, "enum" +HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% +HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% +HKR, Ndi\Params\KeepLink, default, 0, "0" + + +[Neo.Service] +DisplayName = %Neo.Service.DispName% +Description = %Neo.Service.Desc% +ServiceType = 1 +StartType = 3 +ErrorControl = 1 +ServiceBinary = %12%\Neo_VPN71.sys +LoadOrderGroup = NDIS + +[Neo.Reg] +HKR, Ndi, Service, 0, Neo.Service.Name +HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" +HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" + +[Neo.EventLog] +HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN71.sys" +HKR, , TypesSupported, 0x00010001, 7 + +[Strings] +CompanyName = "SoftEther Corporation" +DiskDescription = "VPN Client Device Driver Install Disk" +Neo.Service.Name = "Neo_VPN71" +Neo.Service.DispName = "VPN Client Device Driver - VPN71" +Neo.Service.Desc = "VPN Client Adapter - VPN71" +NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN71" +Neo.EventLog.Name = "Neo" +NetworkAddress = "MAC Address" +DefaultAddress = "000001000001" +MaxSpeed = "Indicate Speed (Mbps)" +KeepLink = "Keep Link" +On = "On" +Off = "Off" + + +; Auto Generated 20180205_163610.780 + diff --git a/src/bin/hamcore/DriverPackages/Neo6_Win8/x64/Neo6_x64_VPN72.inf b/src/bin/hamcore/DriverPackages/Neo6_Win8/x64/Neo6_x64_VPN72.inf index 3754f098..fc576915 100644 --- a/src/bin/hamcore/DriverPackages/Neo6_Win8/x64/Neo6_x64_VPN72.inf +++ b/src/bin/hamcore/DriverPackages/Neo6_Win8/x64/Neo6_x64_VPN72.inf @@ -1,114 +1,114 @@ -; VPN Client Device Driver for Windows 2000 and Greater -; -; Copyright (c) SoftEther Corporation. All Rights Reserved. -; http://www.softether.co.jp/ -; -; BUILD 9658 - -[Version] -Signature = "$Windows NT$" -Class = Net -ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} -Provider = %CompanyName% -DriverVer = 02/04/2018, 4.25.0.9658 -CatalogFile.NT = inf_VPN72.cat - -[Manufacturer] -%CompanyName% = SoftEther, NTamd64 - -[SourceDisksNames] -1=%DiskDescription%, "", , - -[SourceDisksFiles] -Neo_VPN72.sys = 1 - -[DestinationDirs] -DefaultDestDir = 12 -Neo.CopyFiles.Sys = 12 - -[Neo.CopyFiles.Sys] -Neo_VPN72.sys, , , 2 - -[SoftEther.NTamd64] -%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN72 - -[NeoAdapter.Install] -Characteristics = 0x1 -AddReg = Neo.Reg, NeoAdapter.Ndi -CopyFiles = Neo.CopyFiles.Sys -*IfType = 53 -*MediaType = 0 -*PhysicalMediaType = 0 - -[NeoAdapter.Install.Services] -AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% - -[NeoAdapter.Ndi] -HKR, , NetworkAddress, 0, %DefaultAddress% -HKR, Ndi, DeviceID, , "NeoAdapter_VPN72" -HKR, , DevLoader, , ndis -HKR, , DeviceVxDs, , Neo_VPN72.sys -HKR, NDIS, LogDriverName, , "Neo_VPN72" -HKR, NDIS, MajorNdisVersion, 1, 5 -HKR, NDIS, MinorNdisVersion, 1, 0 -HKR, Ndi\Interfaces, DefUpper, , "ndis5" -HKR, Ndi\Interfaces, UpperRange, , "ndis5" -HKR, Ndi\Interfaces, LowerRange, , "ethernet" -HKR, Ndi\Interfaces, DefLower, , "ethernet" -HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" -HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% -HKR, Ndi\Params\NetworkAddress, type, 0, "edit" -HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" -HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" -HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% -HKR, Ndi\Params\NetworkAddress, optional, 0, "0" -HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% -HKR, Ndi\Params\MaxSpeed, type, 0, "int" -HKR, Ndi\Params\MaxSpeed, default, 0, "100" -HKR, Ndi\Params\MaxSpeed, min, 0, "0" -HKR, Ndi\Params\MaxSpeed, max, 0, "2000" -HKR, Ndi\Params\MaxSpeed, step, 0, "1" -HKR, Ndi\Params\MaxSpeed, Base, 0, "10" -HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% -HKR, Ndi\Params\KeepLink, type, 0, "enum" -HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% -HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% -HKR, Ndi\Params\KeepLink, default, 0, "0" - - -[Neo.Service] -DisplayName = %Neo.Service.DispName% -Description = %Neo.Service.Desc% -ServiceType = 1 -StartType = 3 -ErrorControl = 1 -ServiceBinary = %12%\Neo_VPN72.sys -LoadOrderGroup = NDIS - -[Neo.Reg] -HKR, Ndi, Service, 0, Neo.Service.Name -HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" -HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" - -[Neo.EventLog] -HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN72.sys" -HKR, , TypesSupported, 0x00010001, 7 - -[Strings] -CompanyName = "SoftEther Corporation" -DiskDescription = "VPN Client Device Driver Install Disk" -Neo.Service.Name = "Neo_VPN72" -Neo.Service.DispName = "VPN Client Device Driver - VPN72" -Neo.Service.Desc = "VPN Client Adapter - VPN72" -NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN72" -Neo.EventLog.Name = "Neo" -NetworkAddress = "MAC Address" -DefaultAddress = "000001000001" -MaxSpeed = "Indicate Speed (Mbps)" -KeepLink = "Keep Link" -On = "On" -Off = "Off" - - -; Auto Generated 20180205_163610.780 - +; VPN Client Device Driver for Windows 2000 and Greater +; +; Copyright (c) SoftEther Corporation. All Rights Reserved. +; http://www.softether.co.jp/ +; +; BUILD 9658 + +[Version] +Signature = "$Windows NT$" +Class = Net +ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} +Provider = %CompanyName% +DriverVer = 02/04/2018, 4.25.0.9658 +CatalogFile.NT = inf_VPN72.cat + +[Manufacturer] +%CompanyName% = SoftEther, NTamd64 + +[SourceDisksNames] +1=%DiskDescription%, "", , + +[SourceDisksFiles] +Neo_VPN72.sys = 1 + +[DestinationDirs] +DefaultDestDir = 12 +Neo.CopyFiles.Sys = 12 + +[Neo.CopyFiles.Sys] +Neo_VPN72.sys, , , 2 + +[SoftEther.NTamd64] +%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN72 + +[NeoAdapter.Install] +Characteristics = 0x1 +AddReg = Neo.Reg, NeoAdapter.Ndi +CopyFiles = Neo.CopyFiles.Sys +*IfType = 53 +*MediaType = 0 +*PhysicalMediaType = 0 + +[NeoAdapter.Install.Services] +AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% + +[NeoAdapter.Ndi] +HKR, , NetworkAddress, 0, %DefaultAddress% +HKR, Ndi, DeviceID, , "NeoAdapter_VPN72" +HKR, , DevLoader, , ndis +HKR, , DeviceVxDs, , Neo_VPN72.sys +HKR, NDIS, LogDriverName, , "Neo_VPN72" +HKR, NDIS, MajorNdisVersion, 1, 5 +HKR, NDIS, MinorNdisVersion, 1, 0 +HKR, Ndi\Interfaces, DefUpper, , "ndis5" +HKR, Ndi\Interfaces, UpperRange, , "ndis5" +HKR, Ndi\Interfaces, LowerRange, , "ethernet" +HKR, Ndi\Interfaces, DefLower, , "ethernet" +HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" +HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% +HKR, Ndi\Params\NetworkAddress, type, 0, "edit" +HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" +HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" +HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% +HKR, Ndi\Params\NetworkAddress, optional, 0, "0" +HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% +HKR, Ndi\Params\MaxSpeed, type, 0, "int" +HKR, Ndi\Params\MaxSpeed, default, 0, "100" +HKR, Ndi\Params\MaxSpeed, min, 0, "0" +HKR, Ndi\Params\MaxSpeed, max, 0, "2000" +HKR, Ndi\Params\MaxSpeed, step, 0, "1" +HKR, Ndi\Params\MaxSpeed, Base, 0, "10" +HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% +HKR, Ndi\Params\KeepLink, type, 0, "enum" +HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% +HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% +HKR, Ndi\Params\KeepLink, default, 0, "0" + + +[Neo.Service] +DisplayName = %Neo.Service.DispName% +Description = %Neo.Service.Desc% +ServiceType = 1 +StartType = 3 +ErrorControl = 1 +ServiceBinary = %12%\Neo_VPN72.sys +LoadOrderGroup = NDIS + +[Neo.Reg] +HKR, Ndi, Service, 0, Neo.Service.Name +HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" +HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" + +[Neo.EventLog] +HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN72.sys" +HKR, , TypesSupported, 0x00010001, 7 + +[Strings] +CompanyName = "SoftEther Corporation" +DiskDescription = "VPN Client Device Driver Install Disk" +Neo.Service.Name = "Neo_VPN72" +Neo.Service.DispName = "VPN Client Device Driver - VPN72" +Neo.Service.Desc = "VPN Client Adapter - VPN72" +NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN72" +Neo.EventLog.Name = "Neo" +NetworkAddress = "MAC Address" +DefaultAddress = "000001000001" +MaxSpeed = "Indicate Speed (Mbps)" +KeepLink = "Keep Link" +On = "On" +Off = "Off" + + +; Auto Generated 20180205_163610.780 + diff --git a/src/bin/hamcore/DriverPackages/Neo6_Win8/x64/Neo6_x64_VPN73.inf b/src/bin/hamcore/DriverPackages/Neo6_Win8/x64/Neo6_x64_VPN73.inf index 6a74da78..aa269748 100644 --- a/src/bin/hamcore/DriverPackages/Neo6_Win8/x64/Neo6_x64_VPN73.inf +++ b/src/bin/hamcore/DriverPackages/Neo6_Win8/x64/Neo6_x64_VPN73.inf @@ -1,114 +1,114 @@ -; VPN Client Device Driver for Windows 2000 and Greater -; -; Copyright (c) SoftEther Corporation. All Rights Reserved. -; http://www.softether.co.jp/ -; -; BUILD 9658 - -[Version] -Signature = "$Windows NT$" -Class = Net -ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} -Provider = %CompanyName% -DriverVer = 02/04/2018, 4.25.0.9658 -CatalogFile.NT = inf_VPN73.cat - -[Manufacturer] -%CompanyName% = SoftEther, NTamd64 - -[SourceDisksNames] -1=%DiskDescription%, "", , - -[SourceDisksFiles] -Neo_VPN73.sys = 1 - -[DestinationDirs] -DefaultDestDir = 12 -Neo.CopyFiles.Sys = 12 - -[Neo.CopyFiles.Sys] -Neo_VPN73.sys, , , 2 - -[SoftEther.NTamd64] -%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN73 - -[NeoAdapter.Install] -Characteristics = 0x1 -AddReg = Neo.Reg, NeoAdapter.Ndi -CopyFiles = Neo.CopyFiles.Sys -*IfType = 53 -*MediaType = 0 -*PhysicalMediaType = 0 - -[NeoAdapter.Install.Services] -AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% - -[NeoAdapter.Ndi] -HKR, , NetworkAddress, 0, %DefaultAddress% -HKR, Ndi, DeviceID, , "NeoAdapter_VPN73" -HKR, , DevLoader, , ndis -HKR, , DeviceVxDs, , Neo_VPN73.sys -HKR, NDIS, LogDriverName, , "Neo_VPN73" -HKR, NDIS, MajorNdisVersion, 1, 5 -HKR, NDIS, MinorNdisVersion, 1, 0 -HKR, Ndi\Interfaces, DefUpper, , "ndis5" -HKR, Ndi\Interfaces, UpperRange, , "ndis5" -HKR, Ndi\Interfaces, LowerRange, , "ethernet" -HKR, Ndi\Interfaces, DefLower, , "ethernet" -HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" -HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% -HKR, Ndi\Params\NetworkAddress, type, 0, "edit" -HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" -HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" -HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% -HKR, Ndi\Params\NetworkAddress, optional, 0, "0" -HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% -HKR, Ndi\Params\MaxSpeed, type, 0, "int" -HKR, Ndi\Params\MaxSpeed, default, 0, "100" -HKR, Ndi\Params\MaxSpeed, min, 0, "0" -HKR, Ndi\Params\MaxSpeed, max, 0, "2000" -HKR, Ndi\Params\MaxSpeed, step, 0, "1" -HKR, Ndi\Params\MaxSpeed, Base, 0, "10" -HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% -HKR, Ndi\Params\KeepLink, type, 0, "enum" -HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% -HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% -HKR, Ndi\Params\KeepLink, default, 0, "0" - - -[Neo.Service] -DisplayName = %Neo.Service.DispName% -Description = %Neo.Service.Desc% -ServiceType = 1 -StartType = 3 -ErrorControl = 1 -ServiceBinary = %12%\Neo_VPN73.sys -LoadOrderGroup = NDIS - -[Neo.Reg] -HKR, Ndi, Service, 0, Neo.Service.Name -HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" -HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" - -[Neo.EventLog] -HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN73.sys" -HKR, , TypesSupported, 0x00010001, 7 - -[Strings] -CompanyName = "SoftEther Corporation" -DiskDescription = "VPN Client Device Driver Install Disk" -Neo.Service.Name = "Neo_VPN73" -Neo.Service.DispName = "VPN Client Device Driver - VPN73" -Neo.Service.Desc = "VPN Client Adapter - VPN73" -NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN73" -Neo.EventLog.Name = "Neo" -NetworkAddress = "MAC Address" -DefaultAddress = "000001000001" -MaxSpeed = "Indicate Speed (Mbps)" -KeepLink = "Keep Link" -On = "On" -Off = "Off" - - -; Auto Generated 20180205_163610.781 - +; VPN Client Device Driver for Windows 2000 and Greater +; +; Copyright (c) SoftEther Corporation. All Rights Reserved. +; http://www.softether.co.jp/ +; +; BUILD 9658 + +[Version] +Signature = "$Windows NT$" +Class = Net +ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} +Provider = %CompanyName% +DriverVer = 02/04/2018, 4.25.0.9658 +CatalogFile.NT = inf_VPN73.cat + +[Manufacturer] +%CompanyName% = SoftEther, NTamd64 + +[SourceDisksNames] +1=%DiskDescription%, "", , + +[SourceDisksFiles] +Neo_VPN73.sys = 1 + +[DestinationDirs] +DefaultDestDir = 12 +Neo.CopyFiles.Sys = 12 + +[Neo.CopyFiles.Sys] +Neo_VPN73.sys, , , 2 + +[SoftEther.NTamd64] +%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN73 + +[NeoAdapter.Install] +Characteristics = 0x1 +AddReg = Neo.Reg, NeoAdapter.Ndi +CopyFiles = Neo.CopyFiles.Sys +*IfType = 53 +*MediaType = 0 +*PhysicalMediaType = 0 + +[NeoAdapter.Install.Services] +AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% + +[NeoAdapter.Ndi] +HKR, , NetworkAddress, 0, %DefaultAddress% +HKR, Ndi, DeviceID, , "NeoAdapter_VPN73" +HKR, , DevLoader, , ndis +HKR, , DeviceVxDs, , Neo_VPN73.sys +HKR, NDIS, LogDriverName, , "Neo_VPN73" +HKR, NDIS, MajorNdisVersion, 1, 5 +HKR, NDIS, MinorNdisVersion, 1, 0 +HKR, Ndi\Interfaces, DefUpper, , "ndis5" +HKR, Ndi\Interfaces, UpperRange, , "ndis5" +HKR, Ndi\Interfaces, LowerRange, , "ethernet" +HKR, Ndi\Interfaces, DefLower, , "ethernet" +HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" +HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% +HKR, Ndi\Params\NetworkAddress, type, 0, "edit" +HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" +HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" +HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% +HKR, Ndi\Params\NetworkAddress, optional, 0, "0" +HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% +HKR, Ndi\Params\MaxSpeed, type, 0, "int" +HKR, Ndi\Params\MaxSpeed, default, 0, "100" +HKR, Ndi\Params\MaxSpeed, min, 0, "0" +HKR, Ndi\Params\MaxSpeed, max, 0, "2000" +HKR, Ndi\Params\MaxSpeed, step, 0, "1" +HKR, Ndi\Params\MaxSpeed, Base, 0, "10" +HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% +HKR, Ndi\Params\KeepLink, type, 0, "enum" +HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% +HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% +HKR, Ndi\Params\KeepLink, default, 0, "0" + + +[Neo.Service] +DisplayName = %Neo.Service.DispName% +Description = %Neo.Service.Desc% +ServiceType = 1 +StartType = 3 +ErrorControl = 1 +ServiceBinary = %12%\Neo_VPN73.sys +LoadOrderGroup = NDIS + +[Neo.Reg] +HKR, Ndi, Service, 0, Neo.Service.Name +HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" +HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" + +[Neo.EventLog] +HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN73.sys" +HKR, , TypesSupported, 0x00010001, 7 + +[Strings] +CompanyName = "SoftEther Corporation" +DiskDescription = "VPN Client Device Driver Install Disk" +Neo.Service.Name = "Neo_VPN73" +Neo.Service.DispName = "VPN Client Device Driver - VPN73" +Neo.Service.Desc = "VPN Client Adapter - VPN73" +NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN73" +Neo.EventLog.Name = "Neo" +NetworkAddress = "MAC Address" +DefaultAddress = "000001000001" +MaxSpeed = "Indicate Speed (Mbps)" +KeepLink = "Keep Link" +On = "On" +Off = "Off" + + +; Auto Generated 20180205_163610.781 + diff --git a/src/bin/hamcore/DriverPackages/Neo6_Win8/x64/Neo6_x64_VPN74.inf b/src/bin/hamcore/DriverPackages/Neo6_Win8/x64/Neo6_x64_VPN74.inf index 53873097..c551f65b 100644 --- a/src/bin/hamcore/DriverPackages/Neo6_Win8/x64/Neo6_x64_VPN74.inf +++ b/src/bin/hamcore/DriverPackages/Neo6_Win8/x64/Neo6_x64_VPN74.inf @@ -1,114 +1,114 @@ -; VPN Client Device Driver for Windows 2000 and Greater -; -; Copyright (c) SoftEther Corporation. All Rights Reserved. -; http://www.softether.co.jp/ -; -; BUILD 9658 - -[Version] -Signature = "$Windows NT$" -Class = Net -ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} -Provider = %CompanyName% -DriverVer = 02/04/2018, 4.25.0.9658 -CatalogFile.NT = inf_VPN74.cat - -[Manufacturer] -%CompanyName% = SoftEther, NTamd64 - -[SourceDisksNames] -1=%DiskDescription%, "", , - -[SourceDisksFiles] -Neo_VPN74.sys = 1 - -[DestinationDirs] -DefaultDestDir = 12 -Neo.CopyFiles.Sys = 12 - -[Neo.CopyFiles.Sys] -Neo_VPN74.sys, , , 2 - -[SoftEther.NTamd64] -%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN74 - -[NeoAdapter.Install] -Characteristics = 0x1 -AddReg = Neo.Reg, NeoAdapter.Ndi -CopyFiles = Neo.CopyFiles.Sys -*IfType = 53 -*MediaType = 0 -*PhysicalMediaType = 0 - -[NeoAdapter.Install.Services] -AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% - -[NeoAdapter.Ndi] -HKR, , NetworkAddress, 0, %DefaultAddress% -HKR, Ndi, DeviceID, , "NeoAdapter_VPN74" -HKR, , DevLoader, , ndis -HKR, , DeviceVxDs, , Neo_VPN74.sys -HKR, NDIS, LogDriverName, , "Neo_VPN74" -HKR, NDIS, MajorNdisVersion, 1, 5 -HKR, NDIS, MinorNdisVersion, 1, 0 -HKR, Ndi\Interfaces, DefUpper, , "ndis5" -HKR, Ndi\Interfaces, UpperRange, , "ndis5" -HKR, Ndi\Interfaces, LowerRange, , "ethernet" -HKR, Ndi\Interfaces, DefLower, , "ethernet" -HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" -HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% -HKR, Ndi\Params\NetworkAddress, type, 0, "edit" -HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" -HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" -HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% -HKR, Ndi\Params\NetworkAddress, optional, 0, "0" -HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% -HKR, Ndi\Params\MaxSpeed, type, 0, "int" -HKR, Ndi\Params\MaxSpeed, default, 0, "100" -HKR, Ndi\Params\MaxSpeed, min, 0, "0" -HKR, Ndi\Params\MaxSpeed, max, 0, "2000" -HKR, Ndi\Params\MaxSpeed, step, 0, "1" -HKR, Ndi\Params\MaxSpeed, Base, 0, "10" -HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% -HKR, Ndi\Params\KeepLink, type, 0, "enum" -HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% -HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% -HKR, Ndi\Params\KeepLink, default, 0, "0" - - -[Neo.Service] -DisplayName = %Neo.Service.DispName% -Description = %Neo.Service.Desc% -ServiceType = 1 -StartType = 3 -ErrorControl = 1 -ServiceBinary = %12%\Neo_VPN74.sys -LoadOrderGroup = NDIS - -[Neo.Reg] -HKR, Ndi, Service, 0, Neo.Service.Name -HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" -HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" - -[Neo.EventLog] -HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN74.sys" -HKR, , TypesSupported, 0x00010001, 7 - -[Strings] -CompanyName = "SoftEther Corporation" -DiskDescription = "VPN Client Device Driver Install Disk" -Neo.Service.Name = "Neo_VPN74" -Neo.Service.DispName = "VPN Client Device Driver - VPN74" -Neo.Service.Desc = "VPN Client Adapter - VPN74" -NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN74" -Neo.EventLog.Name = "Neo" -NetworkAddress = "MAC Address" -DefaultAddress = "000001000001" -MaxSpeed = "Indicate Speed (Mbps)" -KeepLink = "Keep Link" -On = "On" -Off = "Off" - - -; Auto Generated 20180205_163610.781 - +; VPN Client Device Driver for Windows 2000 and Greater +; +; Copyright (c) SoftEther Corporation. All Rights Reserved. +; http://www.softether.co.jp/ +; +; BUILD 9658 + +[Version] +Signature = "$Windows NT$" +Class = Net +ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} +Provider = %CompanyName% +DriverVer = 02/04/2018, 4.25.0.9658 +CatalogFile.NT = inf_VPN74.cat + +[Manufacturer] +%CompanyName% = SoftEther, NTamd64 + +[SourceDisksNames] +1=%DiskDescription%, "", , + +[SourceDisksFiles] +Neo_VPN74.sys = 1 + +[DestinationDirs] +DefaultDestDir = 12 +Neo.CopyFiles.Sys = 12 + +[Neo.CopyFiles.Sys] +Neo_VPN74.sys, , , 2 + +[SoftEther.NTamd64] +%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN74 + +[NeoAdapter.Install] +Characteristics = 0x1 +AddReg = Neo.Reg, NeoAdapter.Ndi +CopyFiles = Neo.CopyFiles.Sys +*IfType = 53 +*MediaType = 0 +*PhysicalMediaType = 0 + +[NeoAdapter.Install.Services] +AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% + +[NeoAdapter.Ndi] +HKR, , NetworkAddress, 0, %DefaultAddress% +HKR, Ndi, DeviceID, , "NeoAdapter_VPN74" +HKR, , DevLoader, , ndis +HKR, , DeviceVxDs, , Neo_VPN74.sys +HKR, NDIS, LogDriverName, , "Neo_VPN74" +HKR, NDIS, MajorNdisVersion, 1, 5 +HKR, NDIS, MinorNdisVersion, 1, 0 +HKR, Ndi\Interfaces, DefUpper, , "ndis5" +HKR, Ndi\Interfaces, UpperRange, , "ndis5" +HKR, Ndi\Interfaces, LowerRange, , "ethernet" +HKR, Ndi\Interfaces, DefLower, , "ethernet" +HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" +HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% +HKR, Ndi\Params\NetworkAddress, type, 0, "edit" +HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" +HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" +HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% +HKR, Ndi\Params\NetworkAddress, optional, 0, "0" +HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% +HKR, Ndi\Params\MaxSpeed, type, 0, "int" +HKR, Ndi\Params\MaxSpeed, default, 0, "100" +HKR, Ndi\Params\MaxSpeed, min, 0, "0" +HKR, Ndi\Params\MaxSpeed, max, 0, "2000" +HKR, Ndi\Params\MaxSpeed, step, 0, "1" +HKR, Ndi\Params\MaxSpeed, Base, 0, "10" +HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% +HKR, Ndi\Params\KeepLink, type, 0, "enum" +HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% +HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% +HKR, Ndi\Params\KeepLink, default, 0, "0" + + +[Neo.Service] +DisplayName = %Neo.Service.DispName% +Description = %Neo.Service.Desc% +ServiceType = 1 +StartType = 3 +ErrorControl = 1 +ServiceBinary = %12%\Neo_VPN74.sys +LoadOrderGroup = NDIS + +[Neo.Reg] +HKR, Ndi, Service, 0, Neo.Service.Name +HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" +HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" + +[Neo.EventLog] +HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN74.sys" +HKR, , TypesSupported, 0x00010001, 7 + +[Strings] +CompanyName = "SoftEther Corporation" +DiskDescription = "VPN Client Device Driver Install Disk" +Neo.Service.Name = "Neo_VPN74" +Neo.Service.DispName = "VPN Client Device Driver - VPN74" +Neo.Service.Desc = "VPN Client Adapter - VPN74" +NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN74" +Neo.EventLog.Name = "Neo" +NetworkAddress = "MAC Address" +DefaultAddress = "000001000001" +MaxSpeed = "Indicate Speed (Mbps)" +KeepLink = "Keep Link" +On = "On" +Off = "Off" + + +; Auto Generated 20180205_163610.781 + diff --git a/src/bin/hamcore/DriverPackages/Neo6_Win8/x64/Neo6_x64_VPN75.inf b/src/bin/hamcore/DriverPackages/Neo6_Win8/x64/Neo6_x64_VPN75.inf index 7c2a446f..900254a6 100644 --- a/src/bin/hamcore/DriverPackages/Neo6_Win8/x64/Neo6_x64_VPN75.inf +++ b/src/bin/hamcore/DriverPackages/Neo6_Win8/x64/Neo6_x64_VPN75.inf @@ -1,114 +1,114 @@ -; VPN Client Device Driver for Windows 2000 and Greater -; -; Copyright (c) SoftEther Corporation. All Rights Reserved. -; http://www.softether.co.jp/ -; -; BUILD 9658 - -[Version] -Signature = "$Windows NT$" -Class = Net -ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} -Provider = %CompanyName% -DriverVer = 02/04/2018, 4.25.0.9658 -CatalogFile.NT = inf_VPN75.cat - -[Manufacturer] -%CompanyName% = SoftEther, NTamd64 - -[SourceDisksNames] -1=%DiskDescription%, "", , - -[SourceDisksFiles] -Neo_VPN75.sys = 1 - -[DestinationDirs] -DefaultDestDir = 12 -Neo.CopyFiles.Sys = 12 - -[Neo.CopyFiles.Sys] -Neo_VPN75.sys, , , 2 - -[SoftEther.NTamd64] -%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN75 - -[NeoAdapter.Install] -Characteristics = 0x1 -AddReg = Neo.Reg, NeoAdapter.Ndi -CopyFiles = Neo.CopyFiles.Sys -*IfType = 53 -*MediaType = 0 -*PhysicalMediaType = 0 - -[NeoAdapter.Install.Services] -AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% - -[NeoAdapter.Ndi] -HKR, , NetworkAddress, 0, %DefaultAddress% -HKR, Ndi, DeviceID, , "NeoAdapter_VPN75" -HKR, , DevLoader, , ndis -HKR, , DeviceVxDs, , Neo_VPN75.sys -HKR, NDIS, LogDriverName, , "Neo_VPN75" -HKR, NDIS, MajorNdisVersion, 1, 5 -HKR, NDIS, MinorNdisVersion, 1, 0 -HKR, Ndi\Interfaces, DefUpper, , "ndis5" -HKR, Ndi\Interfaces, UpperRange, , "ndis5" -HKR, Ndi\Interfaces, LowerRange, , "ethernet" -HKR, Ndi\Interfaces, DefLower, , "ethernet" -HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" -HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% -HKR, Ndi\Params\NetworkAddress, type, 0, "edit" -HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" -HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" -HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% -HKR, Ndi\Params\NetworkAddress, optional, 0, "0" -HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% -HKR, Ndi\Params\MaxSpeed, type, 0, "int" -HKR, Ndi\Params\MaxSpeed, default, 0, "100" -HKR, Ndi\Params\MaxSpeed, min, 0, "0" -HKR, Ndi\Params\MaxSpeed, max, 0, "2000" -HKR, Ndi\Params\MaxSpeed, step, 0, "1" -HKR, Ndi\Params\MaxSpeed, Base, 0, "10" -HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% -HKR, Ndi\Params\KeepLink, type, 0, "enum" -HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% -HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% -HKR, Ndi\Params\KeepLink, default, 0, "0" - - -[Neo.Service] -DisplayName = %Neo.Service.DispName% -Description = %Neo.Service.Desc% -ServiceType = 1 -StartType = 3 -ErrorControl = 1 -ServiceBinary = %12%\Neo_VPN75.sys -LoadOrderGroup = NDIS - -[Neo.Reg] -HKR, Ndi, Service, 0, Neo.Service.Name -HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" -HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" - -[Neo.EventLog] -HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN75.sys" -HKR, , TypesSupported, 0x00010001, 7 - -[Strings] -CompanyName = "SoftEther Corporation" -DiskDescription = "VPN Client Device Driver Install Disk" -Neo.Service.Name = "Neo_VPN75" -Neo.Service.DispName = "VPN Client Device Driver - VPN75" -Neo.Service.Desc = "VPN Client Adapter - VPN75" -NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN75" -Neo.EventLog.Name = "Neo" -NetworkAddress = "MAC Address" -DefaultAddress = "000001000001" -MaxSpeed = "Indicate Speed (Mbps)" -KeepLink = "Keep Link" -On = "On" -Off = "Off" - - -; Auto Generated 20180205_163610.782 - +; VPN Client Device Driver for Windows 2000 and Greater +; +; Copyright (c) SoftEther Corporation. All Rights Reserved. +; http://www.softether.co.jp/ +; +; BUILD 9658 + +[Version] +Signature = "$Windows NT$" +Class = Net +ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} +Provider = %CompanyName% +DriverVer = 02/04/2018, 4.25.0.9658 +CatalogFile.NT = inf_VPN75.cat + +[Manufacturer] +%CompanyName% = SoftEther, NTamd64 + +[SourceDisksNames] +1=%DiskDescription%, "", , + +[SourceDisksFiles] +Neo_VPN75.sys = 1 + +[DestinationDirs] +DefaultDestDir = 12 +Neo.CopyFiles.Sys = 12 + +[Neo.CopyFiles.Sys] +Neo_VPN75.sys, , , 2 + +[SoftEther.NTamd64] +%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN75 + +[NeoAdapter.Install] +Characteristics = 0x1 +AddReg = Neo.Reg, NeoAdapter.Ndi +CopyFiles = Neo.CopyFiles.Sys +*IfType = 53 +*MediaType = 0 +*PhysicalMediaType = 0 + +[NeoAdapter.Install.Services] +AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% + +[NeoAdapter.Ndi] +HKR, , NetworkAddress, 0, %DefaultAddress% +HKR, Ndi, DeviceID, , "NeoAdapter_VPN75" +HKR, , DevLoader, , ndis +HKR, , DeviceVxDs, , Neo_VPN75.sys +HKR, NDIS, LogDriverName, , "Neo_VPN75" +HKR, NDIS, MajorNdisVersion, 1, 5 +HKR, NDIS, MinorNdisVersion, 1, 0 +HKR, Ndi\Interfaces, DefUpper, , "ndis5" +HKR, Ndi\Interfaces, UpperRange, , "ndis5" +HKR, Ndi\Interfaces, LowerRange, , "ethernet" +HKR, Ndi\Interfaces, DefLower, , "ethernet" +HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" +HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% +HKR, Ndi\Params\NetworkAddress, type, 0, "edit" +HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" +HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" +HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% +HKR, Ndi\Params\NetworkAddress, optional, 0, "0" +HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% +HKR, Ndi\Params\MaxSpeed, type, 0, "int" +HKR, Ndi\Params\MaxSpeed, default, 0, "100" +HKR, Ndi\Params\MaxSpeed, min, 0, "0" +HKR, Ndi\Params\MaxSpeed, max, 0, "2000" +HKR, Ndi\Params\MaxSpeed, step, 0, "1" +HKR, Ndi\Params\MaxSpeed, Base, 0, "10" +HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% +HKR, Ndi\Params\KeepLink, type, 0, "enum" +HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% +HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% +HKR, Ndi\Params\KeepLink, default, 0, "0" + + +[Neo.Service] +DisplayName = %Neo.Service.DispName% +Description = %Neo.Service.Desc% +ServiceType = 1 +StartType = 3 +ErrorControl = 1 +ServiceBinary = %12%\Neo_VPN75.sys +LoadOrderGroup = NDIS + +[Neo.Reg] +HKR, Ndi, Service, 0, Neo.Service.Name +HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" +HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" + +[Neo.EventLog] +HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN75.sys" +HKR, , TypesSupported, 0x00010001, 7 + +[Strings] +CompanyName = "SoftEther Corporation" +DiskDescription = "VPN Client Device Driver Install Disk" +Neo.Service.Name = "Neo_VPN75" +Neo.Service.DispName = "VPN Client Device Driver - VPN75" +Neo.Service.Desc = "VPN Client Adapter - VPN75" +NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN75" +Neo.EventLog.Name = "Neo" +NetworkAddress = "MAC Address" +DefaultAddress = "000001000001" +MaxSpeed = "Indicate Speed (Mbps)" +KeepLink = "Keep Link" +On = "On" +Off = "Off" + + +; Auto Generated 20180205_163610.782 + diff --git a/src/bin/hamcore/DriverPackages/Neo6_Win8/x64/Neo6_x64_VPN76.inf b/src/bin/hamcore/DriverPackages/Neo6_Win8/x64/Neo6_x64_VPN76.inf index 6ca4a95e..2a963c68 100644 --- a/src/bin/hamcore/DriverPackages/Neo6_Win8/x64/Neo6_x64_VPN76.inf +++ b/src/bin/hamcore/DriverPackages/Neo6_Win8/x64/Neo6_x64_VPN76.inf @@ -1,114 +1,114 @@ -; VPN Client Device Driver for Windows 2000 and Greater -; -; Copyright (c) SoftEther Corporation. All Rights Reserved. -; http://www.softether.co.jp/ -; -; BUILD 9658 - -[Version] -Signature = "$Windows NT$" -Class = Net -ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} -Provider = %CompanyName% -DriverVer = 02/04/2018, 4.25.0.9658 -CatalogFile.NT = inf_VPN76.cat - -[Manufacturer] -%CompanyName% = SoftEther, NTamd64 - -[SourceDisksNames] -1=%DiskDescription%, "", , - -[SourceDisksFiles] -Neo_VPN76.sys = 1 - -[DestinationDirs] -DefaultDestDir = 12 -Neo.CopyFiles.Sys = 12 - -[Neo.CopyFiles.Sys] -Neo_VPN76.sys, , , 2 - -[SoftEther.NTamd64] -%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN76 - -[NeoAdapter.Install] -Characteristics = 0x1 -AddReg = Neo.Reg, NeoAdapter.Ndi -CopyFiles = Neo.CopyFiles.Sys -*IfType = 53 -*MediaType = 0 -*PhysicalMediaType = 0 - -[NeoAdapter.Install.Services] -AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% - -[NeoAdapter.Ndi] -HKR, , NetworkAddress, 0, %DefaultAddress% -HKR, Ndi, DeviceID, , "NeoAdapter_VPN76" -HKR, , DevLoader, , ndis -HKR, , DeviceVxDs, , Neo_VPN76.sys -HKR, NDIS, LogDriverName, , "Neo_VPN76" -HKR, NDIS, MajorNdisVersion, 1, 5 -HKR, NDIS, MinorNdisVersion, 1, 0 -HKR, Ndi\Interfaces, DefUpper, , "ndis5" -HKR, Ndi\Interfaces, UpperRange, , "ndis5" -HKR, Ndi\Interfaces, LowerRange, , "ethernet" -HKR, Ndi\Interfaces, DefLower, , "ethernet" -HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" -HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% -HKR, Ndi\Params\NetworkAddress, type, 0, "edit" -HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" -HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" -HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% -HKR, Ndi\Params\NetworkAddress, optional, 0, "0" -HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% -HKR, Ndi\Params\MaxSpeed, type, 0, "int" -HKR, Ndi\Params\MaxSpeed, default, 0, "100" -HKR, Ndi\Params\MaxSpeed, min, 0, "0" -HKR, Ndi\Params\MaxSpeed, max, 0, "2000" -HKR, Ndi\Params\MaxSpeed, step, 0, "1" -HKR, Ndi\Params\MaxSpeed, Base, 0, "10" -HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% -HKR, Ndi\Params\KeepLink, type, 0, "enum" -HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% -HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% -HKR, Ndi\Params\KeepLink, default, 0, "0" - - -[Neo.Service] -DisplayName = %Neo.Service.DispName% -Description = %Neo.Service.Desc% -ServiceType = 1 -StartType = 3 -ErrorControl = 1 -ServiceBinary = %12%\Neo_VPN76.sys -LoadOrderGroup = NDIS - -[Neo.Reg] -HKR, Ndi, Service, 0, Neo.Service.Name -HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" -HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" - -[Neo.EventLog] -HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN76.sys" -HKR, , TypesSupported, 0x00010001, 7 - -[Strings] -CompanyName = "SoftEther Corporation" -DiskDescription = "VPN Client Device Driver Install Disk" -Neo.Service.Name = "Neo_VPN76" -Neo.Service.DispName = "VPN Client Device Driver - VPN76" -Neo.Service.Desc = "VPN Client Adapter - VPN76" -NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN76" -Neo.EventLog.Name = "Neo" -NetworkAddress = "MAC Address" -DefaultAddress = "000001000001" -MaxSpeed = "Indicate Speed (Mbps)" -KeepLink = "Keep Link" -On = "On" -Off = "Off" - - -; Auto Generated 20180205_163610.783 - +; VPN Client Device Driver for Windows 2000 and Greater +; +; Copyright (c) SoftEther Corporation. All Rights Reserved. +; http://www.softether.co.jp/ +; +; BUILD 9658 + +[Version] +Signature = "$Windows NT$" +Class = Net +ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} +Provider = %CompanyName% +DriverVer = 02/04/2018, 4.25.0.9658 +CatalogFile.NT = inf_VPN76.cat + +[Manufacturer] +%CompanyName% = SoftEther, NTamd64 + +[SourceDisksNames] +1=%DiskDescription%, "", , + +[SourceDisksFiles] +Neo_VPN76.sys = 1 + +[DestinationDirs] +DefaultDestDir = 12 +Neo.CopyFiles.Sys = 12 + +[Neo.CopyFiles.Sys] +Neo_VPN76.sys, , , 2 + +[SoftEther.NTamd64] +%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN76 + +[NeoAdapter.Install] +Characteristics = 0x1 +AddReg = Neo.Reg, NeoAdapter.Ndi +CopyFiles = Neo.CopyFiles.Sys +*IfType = 53 +*MediaType = 0 +*PhysicalMediaType = 0 + +[NeoAdapter.Install.Services] +AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% + +[NeoAdapter.Ndi] +HKR, , NetworkAddress, 0, %DefaultAddress% +HKR, Ndi, DeviceID, , "NeoAdapter_VPN76" +HKR, , DevLoader, , ndis +HKR, , DeviceVxDs, , Neo_VPN76.sys +HKR, NDIS, LogDriverName, , "Neo_VPN76" +HKR, NDIS, MajorNdisVersion, 1, 5 +HKR, NDIS, MinorNdisVersion, 1, 0 +HKR, Ndi\Interfaces, DefUpper, , "ndis5" +HKR, Ndi\Interfaces, UpperRange, , "ndis5" +HKR, Ndi\Interfaces, LowerRange, , "ethernet" +HKR, Ndi\Interfaces, DefLower, , "ethernet" +HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" +HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% +HKR, Ndi\Params\NetworkAddress, type, 0, "edit" +HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" +HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" +HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% +HKR, Ndi\Params\NetworkAddress, optional, 0, "0" +HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% +HKR, Ndi\Params\MaxSpeed, type, 0, "int" +HKR, Ndi\Params\MaxSpeed, default, 0, "100" +HKR, Ndi\Params\MaxSpeed, min, 0, "0" +HKR, Ndi\Params\MaxSpeed, max, 0, "2000" +HKR, Ndi\Params\MaxSpeed, step, 0, "1" +HKR, Ndi\Params\MaxSpeed, Base, 0, "10" +HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% +HKR, Ndi\Params\KeepLink, type, 0, "enum" +HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% +HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% +HKR, Ndi\Params\KeepLink, default, 0, "0" + + +[Neo.Service] +DisplayName = %Neo.Service.DispName% +Description = %Neo.Service.Desc% +ServiceType = 1 +StartType = 3 +ErrorControl = 1 +ServiceBinary = %12%\Neo_VPN76.sys +LoadOrderGroup = NDIS + +[Neo.Reg] +HKR, Ndi, Service, 0, Neo.Service.Name +HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" +HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" + +[Neo.EventLog] +HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN76.sys" +HKR, , TypesSupported, 0x00010001, 7 + +[Strings] +CompanyName = "SoftEther Corporation" +DiskDescription = "VPN Client Device Driver Install Disk" +Neo.Service.Name = "Neo_VPN76" +Neo.Service.DispName = "VPN Client Device Driver - VPN76" +Neo.Service.Desc = "VPN Client Adapter - VPN76" +NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN76" +Neo.EventLog.Name = "Neo" +NetworkAddress = "MAC Address" +DefaultAddress = "000001000001" +MaxSpeed = "Indicate Speed (Mbps)" +KeepLink = "Keep Link" +On = "On" +Off = "Off" + + +; Auto Generated 20180205_163610.783 + diff --git a/src/bin/hamcore/DriverPackages/Neo6_Win8/x64/Neo6_x64_VPN77.inf b/src/bin/hamcore/DriverPackages/Neo6_Win8/x64/Neo6_x64_VPN77.inf index d7c36de2..9b5b299c 100644 --- a/src/bin/hamcore/DriverPackages/Neo6_Win8/x64/Neo6_x64_VPN77.inf +++ b/src/bin/hamcore/DriverPackages/Neo6_Win8/x64/Neo6_x64_VPN77.inf @@ -1,114 +1,114 @@ -; VPN Client Device Driver for Windows 2000 and Greater -; -; Copyright (c) SoftEther Corporation. All Rights Reserved. -; http://www.softether.co.jp/ -; -; BUILD 9658 - -[Version] -Signature = "$Windows NT$" -Class = Net -ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} -Provider = %CompanyName% -DriverVer = 02/04/2018, 4.25.0.9658 -CatalogFile.NT = inf_VPN77.cat - -[Manufacturer] -%CompanyName% = SoftEther, NTamd64 - -[SourceDisksNames] -1=%DiskDescription%, "", , - -[SourceDisksFiles] -Neo_VPN77.sys = 1 - -[DestinationDirs] -DefaultDestDir = 12 -Neo.CopyFiles.Sys = 12 - -[Neo.CopyFiles.Sys] -Neo_VPN77.sys, , , 2 - -[SoftEther.NTamd64] -%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN77 - -[NeoAdapter.Install] -Characteristics = 0x1 -AddReg = Neo.Reg, NeoAdapter.Ndi -CopyFiles = Neo.CopyFiles.Sys -*IfType = 53 -*MediaType = 0 -*PhysicalMediaType = 0 - -[NeoAdapter.Install.Services] -AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% - -[NeoAdapter.Ndi] -HKR, , NetworkAddress, 0, %DefaultAddress% -HKR, Ndi, DeviceID, , "NeoAdapter_VPN77" -HKR, , DevLoader, , ndis -HKR, , DeviceVxDs, , Neo_VPN77.sys -HKR, NDIS, LogDriverName, , "Neo_VPN77" -HKR, NDIS, MajorNdisVersion, 1, 5 -HKR, NDIS, MinorNdisVersion, 1, 0 -HKR, Ndi\Interfaces, DefUpper, , "ndis5" -HKR, Ndi\Interfaces, UpperRange, , "ndis5" -HKR, Ndi\Interfaces, LowerRange, , "ethernet" -HKR, Ndi\Interfaces, DefLower, , "ethernet" -HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" -HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% -HKR, Ndi\Params\NetworkAddress, type, 0, "edit" -HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" -HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" -HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% -HKR, Ndi\Params\NetworkAddress, optional, 0, "0" -HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% -HKR, Ndi\Params\MaxSpeed, type, 0, "int" -HKR, Ndi\Params\MaxSpeed, default, 0, "100" -HKR, Ndi\Params\MaxSpeed, min, 0, "0" -HKR, Ndi\Params\MaxSpeed, max, 0, "2000" -HKR, Ndi\Params\MaxSpeed, step, 0, "1" -HKR, Ndi\Params\MaxSpeed, Base, 0, "10" -HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% -HKR, Ndi\Params\KeepLink, type, 0, "enum" -HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% -HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% -HKR, Ndi\Params\KeepLink, default, 0, "0" - - -[Neo.Service] -DisplayName = %Neo.Service.DispName% -Description = %Neo.Service.Desc% -ServiceType = 1 -StartType = 3 -ErrorControl = 1 -ServiceBinary = %12%\Neo_VPN77.sys -LoadOrderGroup = NDIS - -[Neo.Reg] -HKR, Ndi, Service, 0, Neo.Service.Name -HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" -HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" - -[Neo.EventLog] -HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN77.sys" -HKR, , TypesSupported, 0x00010001, 7 - -[Strings] -CompanyName = "SoftEther Corporation" -DiskDescription = "VPN Client Device Driver Install Disk" -Neo.Service.Name = "Neo_VPN77" -Neo.Service.DispName = "VPN Client Device Driver - VPN77" -Neo.Service.Desc = "VPN Client Adapter - VPN77" -NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN77" -Neo.EventLog.Name = "Neo" -NetworkAddress = "MAC Address" -DefaultAddress = "000001000001" -MaxSpeed = "Indicate Speed (Mbps)" -KeepLink = "Keep Link" -On = "On" -Off = "Off" - - -; Auto Generated 20180205_163610.783 - +; VPN Client Device Driver for Windows 2000 and Greater +; +; Copyright (c) SoftEther Corporation. All Rights Reserved. +; http://www.softether.co.jp/ +; +; BUILD 9658 + +[Version] +Signature = "$Windows NT$" +Class = Net +ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} +Provider = %CompanyName% +DriverVer = 02/04/2018, 4.25.0.9658 +CatalogFile.NT = inf_VPN77.cat + +[Manufacturer] +%CompanyName% = SoftEther, NTamd64 + +[SourceDisksNames] +1=%DiskDescription%, "", , + +[SourceDisksFiles] +Neo_VPN77.sys = 1 + +[DestinationDirs] +DefaultDestDir = 12 +Neo.CopyFiles.Sys = 12 + +[Neo.CopyFiles.Sys] +Neo_VPN77.sys, , , 2 + +[SoftEther.NTamd64] +%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN77 + +[NeoAdapter.Install] +Characteristics = 0x1 +AddReg = Neo.Reg, NeoAdapter.Ndi +CopyFiles = Neo.CopyFiles.Sys +*IfType = 53 +*MediaType = 0 +*PhysicalMediaType = 0 + +[NeoAdapter.Install.Services] +AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% + +[NeoAdapter.Ndi] +HKR, , NetworkAddress, 0, %DefaultAddress% +HKR, Ndi, DeviceID, , "NeoAdapter_VPN77" +HKR, , DevLoader, , ndis +HKR, , DeviceVxDs, , Neo_VPN77.sys +HKR, NDIS, LogDriverName, , "Neo_VPN77" +HKR, NDIS, MajorNdisVersion, 1, 5 +HKR, NDIS, MinorNdisVersion, 1, 0 +HKR, Ndi\Interfaces, DefUpper, , "ndis5" +HKR, Ndi\Interfaces, UpperRange, , "ndis5" +HKR, Ndi\Interfaces, LowerRange, , "ethernet" +HKR, Ndi\Interfaces, DefLower, , "ethernet" +HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" +HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% +HKR, Ndi\Params\NetworkAddress, type, 0, "edit" +HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" +HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" +HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% +HKR, Ndi\Params\NetworkAddress, optional, 0, "0" +HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% +HKR, Ndi\Params\MaxSpeed, type, 0, "int" +HKR, Ndi\Params\MaxSpeed, default, 0, "100" +HKR, Ndi\Params\MaxSpeed, min, 0, "0" +HKR, Ndi\Params\MaxSpeed, max, 0, "2000" +HKR, Ndi\Params\MaxSpeed, step, 0, "1" +HKR, Ndi\Params\MaxSpeed, Base, 0, "10" +HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% +HKR, Ndi\Params\KeepLink, type, 0, "enum" +HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% +HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% +HKR, Ndi\Params\KeepLink, default, 0, "0" + + +[Neo.Service] +DisplayName = %Neo.Service.DispName% +Description = %Neo.Service.Desc% +ServiceType = 1 +StartType = 3 +ErrorControl = 1 +ServiceBinary = %12%\Neo_VPN77.sys +LoadOrderGroup = NDIS + +[Neo.Reg] +HKR, Ndi, Service, 0, Neo.Service.Name +HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" +HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" + +[Neo.EventLog] +HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN77.sys" +HKR, , TypesSupported, 0x00010001, 7 + +[Strings] +CompanyName = "SoftEther Corporation" +DiskDescription = "VPN Client Device Driver Install Disk" +Neo.Service.Name = "Neo_VPN77" +Neo.Service.DispName = "VPN Client Device Driver - VPN77" +Neo.Service.Desc = "VPN Client Adapter - VPN77" +NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN77" +Neo.EventLog.Name = "Neo" +NetworkAddress = "MAC Address" +DefaultAddress = "000001000001" +MaxSpeed = "Indicate Speed (Mbps)" +KeepLink = "Keep Link" +On = "On" +Off = "Off" + + +; Auto Generated 20180205_163610.783 + diff --git a/src/bin/hamcore/DriverPackages/Neo6_Win8/x64/Neo6_x64_VPN78.inf b/src/bin/hamcore/DriverPackages/Neo6_Win8/x64/Neo6_x64_VPN78.inf index 3ff756f9..564b07c7 100644 --- a/src/bin/hamcore/DriverPackages/Neo6_Win8/x64/Neo6_x64_VPN78.inf +++ b/src/bin/hamcore/DriverPackages/Neo6_Win8/x64/Neo6_x64_VPN78.inf @@ -1,114 +1,114 @@ -; VPN Client Device Driver for Windows 2000 and Greater -; -; Copyright (c) SoftEther Corporation. All Rights Reserved. -; http://www.softether.co.jp/ -; -; BUILD 9658 - -[Version] -Signature = "$Windows NT$" -Class = Net -ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} -Provider = %CompanyName% -DriverVer = 02/04/2018, 4.25.0.9658 -CatalogFile.NT = inf_VPN78.cat - -[Manufacturer] -%CompanyName% = SoftEther, NTamd64 - -[SourceDisksNames] -1=%DiskDescription%, "", , - -[SourceDisksFiles] -Neo_VPN78.sys = 1 - -[DestinationDirs] -DefaultDestDir = 12 -Neo.CopyFiles.Sys = 12 - -[Neo.CopyFiles.Sys] -Neo_VPN78.sys, , , 2 - -[SoftEther.NTamd64] -%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN78 - -[NeoAdapter.Install] -Characteristics = 0x1 -AddReg = Neo.Reg, NeoAdapter.Ndi -CopyFiles = Neo.CopyFiles.Sys -*IfType = 53 -*MediaType = 0 -*PhysicalMediaType = 0 - -[NeoAdapter.Install.Services] -AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% - -[NeoAdapter.Ndi] -HKR, , NetworkAddress, 0, %DefaultAddress% -HKR, Ndi, DeviceID, , "NeoAdapter_VPN78" -HKR, , DevLoader, , ndis -HKR, , DeviceVxDs, , Neo_VPN78.sys -HKR, NDIS, LogDriverName, , "Neo_VPN78" -HKR, NDIS, MajorNdisVersion, 1, 5 -HKR, NDIS, MinorNdisVersion, 1, 0 -HKR, Ndi\Interfaces, DefUpper, , "ndis5" -HKR, Ndi\Interfaces, UpperRange, , "ndis5" -HKR, Ndi\Interfaces, LowerRange, , "ethernet" -HKR, Ndi\Interfaces, DefLower, , "ethernet" -HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" -HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% -HKR, Ndi\Params\NetworkAddress, type, 0, "edit" -HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" -HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" -HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% -HKR, Ndi\Params\NetworkAddress, optional, 0, "0" -HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% -HKR, Ndi\Params\MaxSpeed, type, 0, "int" -HKR, Ndi\Params\MaxSpeed, default, 0, "100" -HKR, Ndi\Params\MaxSpeed, min, 0, "0" -HKR, Ndi\Params\MaxSpeed, max, 0, "2000" -HKR, Ndi\Params\MaxSpeed, step, 0, "1" -HKR, Ndi\Params\MaxSpeed, Base, 0, "10" -HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% -HKR, Ndi\Params\KeepLink, type, 0, "enum" -HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% -HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% -HKR, Ndi\Params\KeepLink, default, 0, "0" - - -[Neo.Service] -DisplayName = %Neo.Service.DispName% -Description = %Neo.Service.Desc% -ServiceType = 1 -StartType = 3 -ErrorControl = 1 -ServiceBinary = %12%\Neo_VPN78.sys -LoadOrderGroup = NDIS - -[Neo.Reg] -HKR, Ndi, Service, 0, Neo.Service.Name -HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" -HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" - -[Neo.EventLog] -HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN78.sys" -HKR, , TypesSupported, 0x00010001, 7 - -[Strings] -CompanyName = "SoftEther Corporation" -DiskDescription = "VPN Client Device Driver Install Disk" -Neo.Service.Name = "Neo_VPN78" -Neo.Service.DispName = "VPN Client Device Driver - VPN78" -Neo.Service.Desc = "VPN Client Adapter - VPN78" -NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN78" -Neo.EventLog.Name = "Neo" -NetworkAddress = "MAC Address" -DefaultAddress = "000001000001" -MaxSpeed = "Indicate Speed (Mbps)" -KeepLink = "Keep Link" -On = "On" -Off = "Off" - - -; Auto Generated 20180205_163610.784 - +; VPN Client Device Driver for Windows 2000 and Greater +; +; Copyright (c) SoftEther Corporation. All Rights Reserved. +; http://www.softether.co.jp/ +; +; BUILD 9658 + +[Version] +Signature = "$Windows NT$" +Class = Net +ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} +Provider = %CompanyName% +DriverVer = 02/04/2018, 4.25.0.9658 +CatalogFile.NT = inf_VPN78.cat + +[Manufacturer] +%CompanyName% = SoftEther, NTamd64 + +[SourceDisksNames] +1=%DiskDescription%, "", , + +[SourceDisksFiles] +Neo_VPN78.sys = 1 + +[DestinationDirs] +DefaultDestDir = 12 +Neo.CopyFiles.Sys = 12 + +[Neo.CopyFiles.Sys] +Neo_VPN78.sys, , , 2 + +[SoftEther.NTamd64] +%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN78 + +[NeoAdapter.Install] +Characteristics = 0x1 +AddReg = Neo.Reg, NeoAdapter.Ndi +CopyFiles = Neo.CopyFiles.Sys +*IfType = 53 +*MediaType = 0 +*PhysicalMediaType = 0 + +[NeoAdapter.Install.Services] +AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% + +[NeoAdapter.Ndi] +HKR, , NetworkAddress, 0, %DefaultAddress% +HKR, Ndi, DeviceID, , "NeoAdapter_VPN78" +HKR, , DevLoader, , ndis +HKR, , DeviceVxDs, , Neo_VPN78.sys +HKR, NDIS, LogDriverName, , "Neo_VPN78" +HKR, NDIS, MajorNdisVersion, 1, 5 +HKR, NDIS, MinorNdisVersion, 1, 0 +HKR, Ndi\Interfaces, DefUpper, , "ndis5" +HKR, Ndi\Interfaces, UpperRange, , "ndis5" +HKR, Ndi\Interfaces, LowerRange, , "ethernet" +HKR, Ndi\Interfaces, DefLower, , "ethernet" +HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" +HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% +HKR, Ndi\Params\NetworkAddress, type, 0, "edit" +HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" +HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" +HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% +HKR, Ndi\Params\NetworkAddress, optional, 0, "0" +HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% +HKR, Ndi\Params\MaxSpeed, type, 0, "int" +HKR, Ndi\Params\MaxSpeed, default, 0, "100" +HKR, Ndi\Params\MaxSpeed, min, 0, "0" +HKR, Ndi\Params\MaxSpeed, max, 0, "2000" +HKR, Ndi\Params\MaxSpeed, step, 0, "1" +HKR, Ndi\Params\MaxSpeed, Base, 0, "10" +HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% +HKR, Ndi\Params\KeepLink, type, 0, "enum" +HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% +HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% +HKR, Ndi\Params\KeepLink, default, 0, "0" + + +[Neo.Service] +DisplayName = %Neo.Service.DispName% +Description = %Neo.Service.Desc% +ServiceType = 1 +StartType = 3 +ErrorControl = 1 +ServiceBinary = %12%\Neo_VPN78.sys +LoadOrderGroup = NDIS + +[Neo.Reg] +HKR, Ndi, Service, 0, Neo.Service.Name +HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" +HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" + +[Neo.EventLog] +HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN78.sys" +HKR, , TypesSupported, 0x00010001, 7 + +[Strings] +CompanyName = "SoftEther Corporation" +DiskDescription = "VPN Client Device Driver Install Disk" +Neo.Service.Name = "Neo_VPN78" +Neo.Service.DispName = "VPN Client Device Driver - VPN78" +Neo.Service.Desc = "VPN Client Adapter - VPN78" +NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN78" +Neo.EventLog.Name = "Neo" +NetworkAddress = "MAC Address" +DefaultAddress = "000001000001" +MaxSpeed = "Indicate Speed (Mbps)" +KeepLink = "Keep Link" +On = "On" +Off = "Off" + + +; Auto Generated 20180205_163610.784 + diff --git a/src/bin/hamcore/DriverPackages/Neo6_Win8/x64/Neo6_x64_VPN79.inf b/src/bin/hamcore/DriverPackages/Neo6_Win8/x64/Neo6_x64_VPN79.inf index e1f2302c..a833dfc0 100644 --- a/src/bin/hamcore/DriverPackages/Neo6_Win8/x64/Neo6_x64_VPN79.inf +++ b/src/bin/hamcore/DriverPackages/Neo6_Win8/x64/Neo6_x64_VPN79.inf @@ -1,114 +1,114 @@ -; VPN Client Device Driver for Windows 2000 and Greater -; -; Copyright (c) SoftEther Corporation. All Rights Reserved. -; http://www.softether.co.jp/ -; -; BUILD 9658 - -[Version] -Signature = "$Windows NT$" -Class = Net -ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} -Provider = %CompanyName% -DriverVer = 02/04/2018, 4.25.0.9658 -CatalogFile.NT = inf_VPN79.cat - -[Manufacturer] -%CompanyName% = SoftEther, NTamd64 - -[SourceDisksNames] -1=%DiskDescription%, "", , - -[SourceDisksFiles] -Neo_VPN79.sys = 1 - -[DestinationDirs] -DefaultDestDir = 12 -Neo.CopyFiles.Sys = 12 - -[Neo.CopyFiles.Sys] -Neo_VPN79.sys, , , 2 - -[SoftEther.NTamd64] -%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN79 - -[NeoAdapter.Install] -Characteristics = 0x1 -AddReg = Neo.Reg, NeoAdapter.Ndi -CopyFiles = Neo.CopyFiles.Sys -*IfType = 53 -*MediaType = 0 -*PhysicalMediaType = 0 - -[NeoAdapter.Install.Services] -AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% - -[NeoAdapter.Ndi] -HKR, , NetworkAddress, 0, %DefaultAddress% -HKR, Ndi, DeviceID, , "NeoAdapter_VPN79" -HKR, , DevLoader, , ndis -HKR, , DeviceVxDs, , Neo_VPN79.sys -HKR, NDIS, LogDriverName, , "Neo_VPN79" -HKR, NDIS, MajorNdisVersion, 1, 5 -HKR, NDIS, MinorNdisVersion, 1, 0 -HKR, Ndi\Interfaces, DefUpper, , "ndis5" -HKR, Ndi\Interfaces, UpperRange, , "ndis5" -HKR, Ndi\Interfaces, LowerRange, , "ethernet" -HKR, Ndi\Interfaces, DefLower, , "ethernet" -HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" -HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% -HKR, Ndi\Params\NetworkAddress, type, 0, "edit" -HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" -HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" -HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% -HKR, Ndi\Params\NetworkAddress, optional, 0, "0" -HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% -HKR, Ndi\Params\MaxSpeed, type, 0, "int" -HKR, Ndi\Params\MaxSpeed, default, 0, "100" -HKR, Ndi\Params\MaxSpeed, min, 0, "0" -HKR, Ndi\Params\MaxSpeed, max, 0, "2000" -HKR, Ndi\Params\MaxSpeed, step, 0, "1" -HKR, Ndi\Params\MaxSpeed, Base, 0, "10" -HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% -HKR, Ndi\Params\KeepLink, type, 0, "enum" -HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% -HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% -HKR, Ndi\Params\KeepLink, default, 0, "0" - - -[Neo.Service] -DisplayName = %Neo.Service.DispName% -Description = %Neo.Service.Desc% -ServiceType = 1 -StartType = 3 -ErrorControl = 1 -ServiceBinary = %12%\Neo_VPN79.sys -LoadOrderGroup = NDIS - -[Neo.Reg] -HKR, Ndi, Service, 0, Neo.Service.Name -HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" -HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" - -[Neo.EventLog] -HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN79.sys" -HKR, , TypesSupported, 0x00010001, 7 - -[Strings] -CompanyName = "SoftEther Corporation" -DiskDescription = "VPN Client Device Driver Install Disk" -Neo.Service.Name = "Neo_VPN79" -Neo.Service.DispName = "VPN Client Device Driver - VPN79" -Neo.Service.Desc = "VPN Client Adapter - VPN79" -NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN79" -Neo.EventLog.Name = "Neo" -NetworkAddress = "MAC Address" -DefaultAddress = "000001000001" -MaxSpeed = "Indicate Speed (Mbps)" -KeepLink = "Keep Link" -On = "On" -Off = "Off" - - -; Auto Generated 20180205_163610.785 - +; VPN Client Device Driver for Windows 2000 and Greater +; +; Copyright (c) SoftEther Corporation. All Rights Reserved. +; http://www.softether.co.jp/ +; +; BUILD 9658 + +[Version] +Signature = "$Windows NT$" +Class = Net +ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} +Provider = %CompanyName% +DriverVer = 02/04/2018, 4.25.0.9658 +CatalogFile.NT = inf_VPN79.cat + +[Manufacturer] +%CompanyName% = SoftEther, NTamd64 + +[SourceDisksNames] +1=%DiskDescription%, "", , + +[SourceDisksFiles] +Neo_VPN79.sys = 1 + +[DestinationDirs] +DefaultDestDir = 12 +Neo.CopyFiles.Sys = 12 + +[Neo.CopyFiles.Sys] +Neo_VPN79.sys, , , 2 + +[SoftEther.NTamd64] +%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN79 + +[NeoAdapter.Install] +Characteristics = 0x1 +AddReg = Neo.Reg, NeoAdapter.Ndi +CopyFiles = Neo.CopyFiles.Sys +*IfType = 53 +*MediaType = 0 +*PhysicalMediaType = 0 + +[NeoAdapter.Install.Services] +AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% + +[NeoAdapter.Ndi] +HKR, , NetworkAddress, 0, %DefaultAddress% +HKR, Ndi, DeviceID, , "NeoAdapter_VPN79" +HKR, , DevLoader, , ndis +HKR, , DeviceVxDs, , Neo_VPN79.sys +HKR, NDIS, LogDriverName, , "Neo_VPN79" +HKR, NDIS, MajorNdisVersion, 1, 5 +HKR, NDIS, MinorNdisVersion, 1, 0 +HKR, Ndi\Interfaces, DefUpper, , "ndis5" +HKR, Ndi\Interfaces, UpperRange, , "ndis5" +HKR, Ndi\Interfaces, LowerRange, , "ethernet" +HKR, Ndi\Interfaces, DefLower, , "ethernet" +HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" +HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% +HKR, Ndi\Params\NetworkAddress, type, 0, "edit" +HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" +HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" +HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% +HKR, Ndi\Params\NetworkAddress, optional, 0, "0" +HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% +HKR, Ndi\Params\MaxSpeed, type, 0, "int" +HKR, Ndi\Params\MaxSpeed, default, 0, "100" +HKR, Ndi\Params\MaxSpeed, min, 0, "0" +HKR, Ndi\Params\MaxSpeed, max, 0, "2000" +HKR, Ndi\Params\MaxSpeed, step, 0, "1" +HKR, Ndi\Params\MaxSpeed, Base, 0, "10" +HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% +HKR, Ndi\Params\KeepLink, type, 0, "enum" +HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% +HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% +HKR, Ndi\Params\KeepLink, default, 0, "0" + + +[Neo.Service] +DisplayName = %Neo.Service.DispName% +Description = %Neo.Service.Desc% +ServiceType = 1 +StartType = 3 +ErrorControl = 1 +ServiceBinary = %12%\Neo_VPN79.sys +LoadOrderGroup = NDIS + +[Neo.Reg] +HKR, Ndi, Service, 0, Neo.Service.Name +HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" +HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" + +[Neo.EventLog] +HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN79.sys" +HKR, , TypesSupported, 0x00010001, 7 + +[Strings] +CompanyName = "SoftEther Corporation" +DiskDescription = "VPN Client Device Driver Install Disk" +Neo.Service.Name = "Neo_VPN79" +Neo.Service.DispName = "VPN Client Device Driver - VPN79" +Neo.Service.Desc = "VPN Client Adapter - VPN79" +NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN79" +Neo.EventLog.Name = "Neo" +NetworkAddress = "MAC Address" +DefaultAddress = "000001000001" +MaxSpeed = "Indicate Speed (Mbps)" +KeepLink = "Keep Link" +On = "On" +Off = "Off" + + +; Auto Generated 20180205_163610.785 + diff --git a/src/bin/hamcore/DriverPackages/Neo6_Win8/x64/Neo6_x64_VPN8.inf b/src/bin/hamcore/DriverPackages/Neo6_Win8/x64/Neo6_x64_VPN8.inf index e05b5607..efd10793 100644 --- a/src/bin/hamcore/DriverPackages/Neo6_Win8/x64/Neo6_x64_VPN8.inf +++ b/src/bin/hamcore/DriverPackages/Neo6_Win8/x64/Neo6_x64_VPN8.inf @@ -1,114 +1,114 @@ -; VPN Client Device Driver for Windows 2000 and Greater -; -; Copyright (c) SoftEther Corporation. All Rights Reserved. -; http://www.softether.co.jp/ -; -; BUILD 9658 - -[Version] -Signature = "$Windows NT$" -Class = Net -ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} -Provider = %CompanyName% -DriverVer = 02/04/2018, 4.25.0.9658 -CatalogFile.NT = inf_VPN8.cat - -[Manufacturer] -%CompanyName% = SoftEther, NTamd64 - -[SourceDisksNames] -1=%DiskDescription%, "", , - -[SourceDisksFiles] -Neo_VPN8.sys = 1 - -[DestinationDirs] -DefaultDestDir = 12 -Neo.CopyFiles.Sys = 12 - -[Neo.CopyFiles.Sys] -Neo_VPN8.sys, , , 2 - -[SoftEther.NTamd64] -%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN8 - -[NeoAdapter.Install] -Characteristics = 0x1 -AddReg = Neo.Reg, NeoAdapter.Ndi -CopyFiles = Neo.CopyFiles.Sys -*IfType = 53 -*MediaType = 0 -*PhysicalMediaType = 0 - -[NeoAdapter.Install.Services] -AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% - -[NeoAdapter.Ndi] -HKR, , NetworkAddress, 0, %DefaultAddress% -HKR, Ndi, DeviceID, , "NeoAdapter_VPN8" -HKR, , DevLoader, , ndis -HKR, , DeviceVxDs, , Neo_VPN8.sys -HKR, NDIS, LogDriverName, , "Neo_VPN8" -HKR, NDIS, MajorNdisVersion, 1, 5 -HKR, NDIS, MinorNdisVersion, 1, 0 -HKR, Ndi\Interfaces, DefUpper, , "ndis5" -HKR, Ndi\Interfaces, UpperRange, , "ndis5" -HKR, Ndi\Interfaces, LowerRange, , "ethernet" -HKR, Ndi\Interfaces, DefLower, , "ethernet" -HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" -HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% -HKR, Ndi\Params\NetworkAddress, type, 0, "edit" -HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" -HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" -HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% -HKR, Ndi\Params\NetworkAddress, optional, 0, "0" -HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% -HKR, Ndi\Params\MaxSpeed, type, 0, "int" -HKR, Ndi\Params\MaxSpeed, default, 0, "100" -HKR, Ndi\Params\MaxSpeed, min, 0, "0" -HKR, Ndi\Params\MaxSpeed, max, 0, "2000" -HKR, Ndi\Params\MaxSpeed, step, 0, "1" -HKR, Ndi\Params\MaxSpeed, Base, 0, "10" -HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% -HKR, Ndi\Params\KeepLink, type, 0, "enum" -HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% -HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% -HKR, Ndi\Params\KeepLink, default, 0, "0" - - -[Neo.Service] -DisplayName = %Neo.Service.DispName% -Description = %Neo.Service.Desc% -ServiceType = 1 -StartType = 3 -ErrorControl = 1 -ServiceBinary = %12%\Neo_VPN8.sys -LoadOrderGroup = NDIS - -[Neo.Reg] -HKR, Ndi, Service, 0, Neo.Service.Name -HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" -HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" - -[Neo.EventLog] -HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN8.sys" -HKR, , TypesSupported, 0x00010001, 7 - -[Strings] -CompanyName = "SoftEther Corporation" -DiskDescription = "VPN Client Device Driver Install Disk" -Neo.Service.Name = "Neo_VPN8" -Neo.Service.DispName = "VPN Client Device Driver - VPN8" -Neo.Service.Desc = "VPN Client Adapter - VPN8" -NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN8" -Neo.EventLog.Name = "Neo" -NetworkAddress = "MAC Address" -DefaultAddress = "000001000001" -MaxSpeed = "Indicate Speed (Mbps)" -KeepLink = "Keep Link" -On = "On" -Off = "Off" - - -; Auto Generated 20180205_163610.742 - +; VPN Client Device Driver for Windows 2000 and Greater +; +; Copyright (c) SoftEther Corporation. All Rights Reserved. +; http://www.softether.co.jp/ +; +; BUILD 9658 + +[Version] +Signature = "$Windows NT$" +Class = Net +ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} +Provider = %CompanyName% +DriverVer = 02/04/2018, 4.25.0.9658 +CatalogFile.NT = inf_VPN8.cat + +[Manufacturer] +%CompanyName% = SoftEther, NTamd64 + +[SourceDisksNames] +1=%DiskDescription%, "", , + +[SourceDisksFiles] +Neo_VPN8.sys = 1 + +[DestinationDirs] +DefaultDestDir = 12 +Neo.CopyFiles.Sys = 12 + +[Neo.CopyFiles.Sys] +Neo_VPN8.sys, , , 2 + +[SoftEther.NTamd64] +%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN8 + +[NeoAdapter.Install] +Characteristics = 0x1 +AddReg = Neo.Reg, NeoAdapter.Ndi +CopyFiles = Neo.CopyFiles.Sys +*IfType = 53 +*MediaType = 0 +*PhysicalMediaType = 0 + +[NeoAdapter.Install.Services] +AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% + +[NeoAdapter.Ndi] +HKR, , NetworkAddress, 0, %DefaultAddress% +HKR, Ndi, DeviceID, , "NeoAdapter_VPN8" +HKR, , DevLoader, , ndis +HKR, , DeviceVxDs, , Neo_VPN8.sys +HKR, NDIS, LogDriverName, , "Neo_VPN8" +HKR, NDIS, MajorNdisVersion, 1, 5 +HKR, NDIS, MinorNdisVersion, 1, 0 +HKR, Ndi\Interfaces, DefUpper, , "ndis5" +HKR, Ndi\Interfaces, UpperRange, , "ndis5" +HKR, Ndi\Interfaces, LowerRange, , "ethernet" +HKR, Ndi\Interfaces, DefLower, , "ethernet" +HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" +HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% +HKR, Ndi\Params\NetworkAddress, type, 0, "edit" +HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" +HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" +HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% +HKR, Ndi\Params\NetworkAddress, optional, 0, "0" +HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% +HKR, Ndi\Params\MaxSpeed, type, 0, "int" +HKR, Ndi\Params\MaxSpeed, default, 0, "100" +HKR, Ndi\Params\MaxSpeed, min, 0, "0" +HKR, Ndi\Params\MaxSpeed, max, 0, "2000" +HKR, Ndi\Params\MaxSpeed, step, 0, "1" +HKR, Ndi\Params\MaxSpeed, Base, 0, "10" +HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% +HKR, Ndi\Params\KeepLink, type, 0, "enum" +HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% +HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% +HKR, Ndi\Params\KeepLink, default, 0, "0" + + +[Neo.Service] +DisplayName = %Neo.Service.DispName% +Description = %Neo.Service.Desc% +ServiceType = 1 +StartType = 3 +ErrorControl = 1 +ServiceBinary = %12%\Neo_VPN8.sys +LoadOrderGroup = NDIS + +[Neo.Reg] +HKR, Ndi, Service, 0, Neo.Service.Name +HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" +HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" + +[Neo.EventLog] +HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN8.sys" +HKR, , TypesSupported, 0x00010001, 7 + +[Strings] +CompanyName = "SoftEther Corporation" +DiskDescription = "VPN Client Device Driver Install Disk" +Neo.Service.Name = "Neo_VPN8" +Neo.Service.DispName = "VPN Client Device Driver - VPN8" +Neo.Service.Desc = "VPN Client Adapter - VPN8" +NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN8" +Neo.EventLog.Name = "Neo" +NetworkAddress = "MAC Address" +DefaultAddress = "000001000001" +MaxSpeed = "Indicate Speed (Mbps)" +KeepLink = "Keep Link" +On = "On" +Off = "Off" + + +; Auto Generated 20180205_163610.742 + diff --git a/src/bin/hamcore/DriverPackages/Neo6_Win8/x64/Neo6_x64_VPN80.inf b/src/bin/hamcore/DriverPackages/Neo6_Win8/x64/Neo6_x64_VPN80.inf index be40e7ba..3e5432e2 100644 --- a/src/bin/hamcore/DriverPackages/Neo6_Win8/x64/Neo6_x64_VPN80.inf +++ b/src/bin/hamcore/DriverPackages/Neo6_Win8/x64/Neo6_x64_VPN80.inf @@ -1,114 +1,114 @@ -; VPN Client Device Driver for Windows 2000 and Greater -; -; Copyright (c) SoftEther Corporation. All Rights Reserved. -; http://www.softether.co.jp/ -; -; BUILD 9658 - -[Version] -Signature = "$Windows NT$" -Class = Net -ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} -Provider = %CompanyName% -DriverVer = 02/04/2018, 4.25.0.9658 -CatalogFile.NT = inf_VPN80.cat - -[Manufacturer] -%CompanyName% = SoftEther, NTamd64 - -[SourceDisksNames] -1=%DiskDescription%, "", , - -[SourceDisksFiles] -Neo_VPN80.sys = 1 - -[DestinationDirs] -DefaultDestDir = 12 -Neo.CopyFiles.Sys = 12 - -[Neo.CopyFiles.Sys] -Neo_VPN80.sys, , , 2 - -[SoftEther.NTamd64] -%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN80 - -[NeoAdapter.Install] -Characteristics = 0x1 -AddReg = Neo.Reg, NeoAdapter.Ndi -CopyFiles = Neo.CopyFiles.Sys -*IfType = 53 -*MediaType = 0 -*PhysicalMediaType = 0 - -[NeoAdapter.Install.Services] -AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% - -[NeoAdapter.Ndi] -HKR, , NetworkAddress, 0, %DefaultAddress% -HKR, Ndi, DeviceID, , "NeoAdapter_VPN80" -HKR, , DevLoader, , ndis -HKR, , DeviceVxDs, , Neo_VPN80.sys -HKR, NDIS, LogDriverName, , "Neo_VPN80" -HKR, NDIS, MajorNdisVersion, 1, 5 -HKR, NDIS, MinorNdisVersion, 1, 0 -HKR, Ndi\Interfaces, DefUpper, , "ndis5" -HKR, Ndi\Interfaces, UpperRange, , "ndis5" -HKR, Ndi\Interfaces, LowerRange, , "ethernet" -HKR, Ndi\Interfaces, DefLower, , "ethernet" -HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" -HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% -HKR, Ndi\Params\NetworkAddress, type, 0, "edit" -HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" -HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" -HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% -HKR, Ndi\Params\NetworkAddress, optional, 0, "0" -HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% -HKR, Ndi\Params\MaxSpeed, type, 0, "int" -HKR, Ndi\Params\MaxSpeed, default, 0, "100" -HKR, Ndi\Params\MaxSpeed, min, 0, "0" -HKR, Ndi\Params\MaxSpeed, max, 0, "2000" -HKR, Ndi\Params\MaxSpeed, step, 0, "1" -HKR, Ndi\Params\MaxSpeed, Base, 0, "10" -HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% -HKR, Ndi\Params\KeepLink, type, 0, "enum" -HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% -HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% -HKR, Ndi\Params\KeepLink, default, 0, "0" - - -[Neo.Service] -DisplayName = %Neo.Service.DispName% -Description = %Neo.Service.Desc% -ServiceType = 1 -StartType = 3 -ErrorControl = 1 -ServiceBinary = %12%\Neo_VPN80.sys -LoadOrderGroup = NDIS - -[Neo.Reg] -HKR, Ndi, Service, 0, Neo.Service.Name -HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" -HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" - -[Neo.EventLog] -HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN80.sys" -HKR, , TypesSupported, 0x00010001, 7 - -[Strings] -CompanyName = "SoftEther Corporation" -DiskDescription = "VPN Client Device Driver Install Disk" -Neo.Service.Name = "Neo_VPN80" -Neo.Service.DispName = "VPN Client Device Driver - VPN80" -Neo.Service.Desc = "VPN Client Adapter - VPN80" -NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN80" -Neo.EventLog.Name = "Neo" -NetworkAddress = "MAC Address" -DefaultAddress = "000001000001" -MaxSpeed = "Indicate Speed (Mbps)" -KeepLink = "Keep Link" -On = "On" -Off = "Off" - - -; Auto Generated 20180205_163610.786 - +; VPN Client Device Driver for Windows 2000 and Greater +; +; Copyright (c) SoftEther Corporation. All Rights Reserved. +; http://www.softether.co.jp/ +; +; BUILD 9658 + +[Version] +Signature = "$Windows NT$" +Class = Net +ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} +Provider = %CompanyName% +DriverVer = 02/04/2018, 4.25.0.9658 +CatalogFile.NT = inf_VPN80.cat + +[Manufacturer] +%CompanyName% = SoftEther, NTamd64 + +[SourceDisksNames] +1=%DiskDescription%, "", , + +[SourceDisksFiles] +Neo_VPN80.sys = 1 + +[DestinationDirs] +DefaultDestDir = 12 +Neo.CopyFiles.Sys = 12 + +[Neo.CopyFiles.Sys] +Neo_VPN80.sys, , , 2 + +[SoftEther.NTamd64] +%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN80 + +[NeoAdapter.Install] +Characteristics = 0x1 +AddReg = Neo.Reg, NeoAdapter.Ndi +CopyFiles = Neo.CopyFiles.Sys +*IfType = 53 +*MediaType = 0 +*PhysicalMediaType = 0 + +[NeoAdapter.Install.Services] +AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% + +[NeoAdapter.Ndi] +HKR, , NetworkAddress, 0, %DefaultAddress% +HKR, Ndi, DeviceID, , "NeoAdapter_VPN80" +HKR, , DevLoader, , ndis +HKR, , DeviceVxDs, , Neo_VPN80.sys +HKR, NDIS, LogDriverName, , "Neo_VPN80" +HKR, NDIS, MajorNdisVersion, 1, 5 +HKR, NDIS, MinorNdisVersion, 1, 0 +HKR, Ndi\Interfaces, DefUpper, , "ndis5" +HKR, Ndi\Interfaces, UpperRange, , "ndis5" +HKR, Ndi\Interfaces, LowerRange, , "ethernet" +HKR, Ndi\Interfaces, DefLower, , "ethernet" +HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" +HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% +HKR, Ndi\Params\NetworkAddress, type, 0, "edit" +HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" +HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" +HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% +HKR, Ndi\Params\NetworkAddress, optional, 0, "0" +HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% +HKR, Ndi\Params\MaxSpeed, type, 0, "int" +HKR, Ndi\Params\MaxSpeed, default, 0, "100" +HKR, Ndi\Params\MaxSpeed, min, 0, "0" +HKR, Ndi\Params\MaxSpeed, max, 0, "2000" +HKR, Ndi\Params\MaxSpeed, step, 0, "1" +HKR, Ndi\Params\MaxSpeed, Base, 0, "10" +HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% +HKR, Ndi\Params\KeepLink, type, 0, "enum" +HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% +HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% +HKR, Ndi\Params\KeepLink, default, 0, "0" + + +[Neo.Service] +DisplayName = %Neo.Service.DispName% +Description = %Neo.Service.Desc% +ServiceType = 1 +StartType = 3 +ErrorControl = 1 +ServiceBinary = %12%\Neo_VPN80.sys +LoadOrderGroup = NDIS + +[Neo.Reg] +HKR, Ndi, Service, 0, Neo.Service.Name +HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" +HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" + +[Neo.EventLog] +HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN80.sys" +HKR, , TypesSupported, 0x00010001, 7 + +[Strings] +CompanyName = "SoftEther Corporation" +DiskDescription = "VPN Client Device Driver Install Disk" +Neo.Service.Name = "Neo_VPN80" +Neo.Service.DispName = "VPN Client Device Driver - VPN80" +Neo.Service.Desc = "VPN Client Adapter - VPN80" +NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN80" +Neo.EventLog.Name = "Neo" +NetworkAddress = "MAC Address" +DefaultAddress = "000001000001" +MaxSpeed = "Indicate Speed (Mbps)" +KeepLink = "Keep Link" +On = "On" +Off = "Off" + + +; Auto Generated 20180205_163610.786 + diff --git a/src/bin/hamcore/DriverPackages/Neo6_Win8/x64/Neo6_x64_VPN81.inf b/src/bin/hamcore/DriverPackages/Neo6_Win8/x64/Neo6_x64_VPN81.inf index b79d2b88..d2752183 100644 --- a/src/bin/hamcore/DriverPackages/Neo6_Win8/x64/Neo6_x64_VPN81.inf +++ b/src/bin/hamcore/DriverPackages/Neo6_Win8/x64/Neo6_x64_VPN81.inf @@ -1,114 +1,114 @@ -; VPN Client Device Driver for Windows 2000 and Greater -; -; Copyright (c) SoftEther Corporation. All Rights Reserved. -; http://www.softether.co.jp/ -; -; BUILD 9658 - -[Version] -Signature = "$Windows NT$" -Class = Net -ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} -Provider = %CompanyName% -DriverVer = 02/04/2018, 4.25.0.9658 -CatalogFile.NT = inf_VPN81.cat - -[Manufacturer] -%CompanyName% = SoftEther, NTamd64 - -[SourceDisksNames] -1=%DiskDescription%, "", , - -[SourceDisksFiles] -Neo_VPN81.sys = 1 - -[DestinationDirs] -DefaultDestDir = 12 -Neo.CopyFiles.Sys = 12 - -[Neo.CopyFiles.Sys] -Neo_VPN81.sys, , , 2 - -[SoftEther.NTamd64] -%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN81 - -[NeoAdapter.Install] -Characteristics = 0x1 -AddReg = Neo.Reg, NeoAdapter.Ndi -CopyFiles = Neo.CopyFiles.Sys -*IfType = 53 -*MediaType = 0 -*PhysicalMediaType = 0 - -[NeoAdapter.Install.Services] -AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% - -[NeoAdapter.Ndi] -HKR, , NetworkAddress, 0, %DefaultAddress% -HKR, Ndi, DeviceID, , "NeoAdapter_VPN81" -HKR, , DevLoader, , ndis -HKR, , DeviceVxDs, , Neo_VPN81.sys -HKR, NDIS, LogDriverName, , "Neo_VPN81" -HKR, NDIS, MajorNdisVersion, 1, 5 -HKR, NDIS, MinorNdisVersion, 1, 0 -HKR, Ndi\Interfaces, DefUpper, , "ndis5" -HKR, Ndi\Interfaces, UpperRange, , "ndis5" -HKR, Ndi\Interfaces, LowerRange, , "ethernet" -HKR, Ndi\Interfaces, DefLower, , "ethernet" -HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" -HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% -HKR, Ndi\Params\NetworkAddress, type, 0, "edit" -HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" -HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" -HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% -HKR, Ndi\Params\NetworkAddress, optional, 0, "0" -HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% -HKR, Ndi\Params\MaxSpeed, type, 0, "int" -HKR, Ndi\Params\MaxSpeed, default, 0, "100" -HKR, Ndi\Params\MaxSpeed, min, 0, "0" -HKR, Ndi\Params\MaxSpeed, max, 0, "2000" -HKR, Ndi\Params\MaxSpeed, step, 0, "1" -HKR, Ndi\Params\MaxSpeed, Base, 0, "10" -HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% -HKR, Ndi\Params\KeepLink, type, 0, "enum" -HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% -HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% -HKR, Ndi\Params\KeepLink, default, 0, "0" - - -[Neo.Service] -DisplayName = %Neo.Service.DispName% -Description = %Neo.Service.Desc% -ServiceType = 1 -StartType = 3 -ErrorControl = 1 -ServiceBinary = %12%\Neo_VPN81.sys -LoadOrderGroup = NDIS - -[Neo.Reg] -HKR, Ndi, Service, 0, Neo.Service.Name -HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" -HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" - -[Neo.EventLog] -HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN81.sys" -HKR, , TypesSupported, 0x00010001, 7 - -[Strings] -CompanyName = "SoftEther Corporation" -DiskDescription = "VPN Client Device Driver Install Disk" -Neo.Service.Name = "Neo_VPN81" -Neo.Service.DispName = "VPN Client Device Driver - VPN81" -Neo.Service.Desc = "VPN Client Adapter - VPN81" -NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN81" -Neo.EventLog.Name = "Neo" -NetworkAddress = "MAC Address" -DefaultAddress = "000001000001" -MaxSpeed = "Indicate Speed (Mbps)" -KeepLink = "Keep Link" -On = "On" -Off = "Off" - - -; Auto Generated 20180205_163610.786 - +; VPN Client Device Driver for Windows 2000 and Greater +; +; Copyright (c) SoftEther Corporation. All Rights Reserved. +; http://www.softether.co.jp/ +; +; BUILD 9658 + +[Version] +Signature = "$Windows NT$" +Class = Net +ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} +Provider = %CompanyName% +DriverVer = 02/04/2018, 4.25.0.9658 +CatalogFile.NT = inf_VPN81.cat + +[Manufacturer] +%CompanyName% = SoftEther, NTamd64 + +[SourceDisksNames] +1=%DiskDescription%, "", , + +[SourceDisksFiles] +Neo_VPN81.sys = 1 + +[DestinationDirs] +DefaultDestDir = 12 +Neo.CopyFiles.Sys = 12 + +[Neo.CopyFiles.Sys] +Neo_VPN81.sys, , , 2 + +[SoftEther.NTamd64] +%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN81 + +[NeoAdapter.Install] +Characteristics = 0x1 +AddReg = Neo.Reg, NeoAdapter.Ndi +CopyFiles = Neo.CopyFiles.Sys +*IfType = 53 +*MediaType = 0 +*PhysicalMediaType = 0 + +[NeoAdapter.Install.Services] +AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% + +[NeoAdapter.Ndi] +HKR, , NetworkAddress, 0, %DefaultAddress% +HKR, Ndi, DeviceID, , "NeoAdapter_VPN81" +HKR, , DevLoader, , ndis +HKR, , DeviceVxDs, , Neo_VPN81.sys +HKR, NDIS, LogDriverName, , "Neo_VPN81" +HKR, NDIS, MajorNdisVersion, 1, 5 +HKR, NDIS, MinorNdisVersion, 1, 0 +HKR, Ndi\Interfaces, DefUpper, , "ndis5" +HKR, Ndi\Interfaces, UpperRange, , "ndis5" +HKR, Ndi\Interfaces, LowerRange, , "ethernet" +HKR, Ndi\Interfaces, DefLower, , "ethernet" +HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" +HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% +HKR, Ndi\Params\NetworkAddress, type, 0, "edit" +HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" +HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" +HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% +HKR, Ndi\Params\NetworkAddress, optional, 0, "0" +HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% +HKR, Ndi\Params\MaxSpeed, type, 0, "int" +HKR, Ndi\Params\MaxSpeed, default, 0, "100" +HKR, Ndi\Params\MaxSpeed, min, 0, "0" +HKR, Ndi\Params\MaxSpeed, max, 0, "2000" +HKR, Ndi\Params\MaxSpeed, step, 0, "1" +HKR, Ndi\Params\MaxSpeed, Base, 0, "10" +HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% +HKR, Ndi\Params\KeepLink, type, 0, "enum" +HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% +HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% +HKR, Ndi\Params\KeepLink, default, 0, "0" + + +[Neo.Service] +DisplayName = %Neo.Service.DispName% +Description = %Neo.Service.Desc% +ServiceType = 1 +StartType = 3 +ErrorControl = 1 +ServiceBinary = %12%\Neo_VPN81.sys +LoadOrderGroup = NDIS + +[Neo.Reg] +HKR, Ndi, Service, 0, Neo.Service.Name +HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" +HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" + +[Neo.EventLog] +HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN81.sys" +HKR, , TypesSupported, 0x00010001, 7 + +[Strings] +CompanyName = "SoftEther Corporation" +DiskDescription = "VPN Client Device Driver Install Disk" +Neo.Service.Name = "Neo_VPN81" +Neo.Service.DispName = "VPN Client Device Driver - VPN81" +Neo.Service.Desc = "VPN Client Adapter - VPN81" +NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN81" +Neo.EventLog.Name = "Neo" +NetworkAddress = "MAC Address" +DefaultAddress = "000001000001" +MaxSpeed = "Indicate Speed (Mbps)" +KeepLink = "Keep Link" +On = "On" +Off = "Off" + + +; Auto Generated 20180205_163610.786 + diff --git a/src/bin/hamcore/DriverPackages/Neo6_Win8/x64/Neo6_x64_VPN82.inf b/src/bin/hamcore/DriverPackages/Neo6_Win8/x64/Neo6_x64_VPN82.inf index 5ef9953b..e77ddbe9 100644 --- a/src/bin/hamcore/DriverPackages/Neo6_Win8/x64/Neo6_x64_VPN82.inf +++ b/src/bin/hamcore/DriverPackages/Neo6_Win8/x64/Neo6_x64_VPN82.inf @@ -1,114 +1,114 @@ -; VPN Client Device Driver for Windows 2000 and Greater -; -; Copyright (c) SoftEther Corporation. All Rights Reserved. -; http://www.softether.co.jp/ -; -; BUILD 9658 - -[Version] -Signature = "$Windows NT$" -Class = Net -ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} -Provider = %CompanyName% -DriverVer = 02/04/2018, 4.25.0.9658 -CatalogFile.NT = inf_VPN82.cat - -[Manufacturer] -%CompanyName% = SoftEther, NTamd64 - -[SourceDisksNames] -1=%DiskDescription%, "", , - -[SourceDisksFiles] -Neo_VPN82.sys = 1 - -[DestinationDirs] -DefaultDestDir = 12 -Neo.CopyFiles.Sys = 12 - -[Neo.CopyFiles.Sys] -Neo_VPN82.sys, , , 2 - -[SoftEther.NTamd64] -%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN82 - -[NeoAdapter.Install] -Characteristics = 0x1 -AddReg = Neo.Reg, NeoAdapter.Ndi -CopyFiles = Neo.CopyFiles.Sys -*IfType = 53 -*MediaType = 0 -*PhysicalMediaType = 0 - -[NeoAdapter.Install.Services] -AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% - -[NeoAdapter.Ndi] -HKR, , NetworkAddress, 0, %DefaultAddress% -HKR, Ndi, DeviceID, , "NeoAdapter_VPN82" -HKR, , DevLoader, , ndis -HKR, , DeviceVxDs, , Neo_VPN82.sys -HKR, NDIS, LogDriverName, , "Neo_VPN82" -HKR, NDIS, MajorNdisVersion, 1, 5 -HKR, NDIS, MinorNdisVersion, 1, 0 -HKR, Ndi\Interfaces, DefUpper, , "ndis5" -HKR, Ndi\Interfaces, UpperRange, , "ndis5" -HKR, Ndi\Interfaces, LowerRange, , "ethernet" -HKR, Ndi\Interfaces, DefLower, , "ethernet" -HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" -HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% -HKR, Ndi\Params\NetworkAddress, type, 0, "edit" -HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" -HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" -HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% -HKR, Ndi\Params\NetworkAddress, optional, 0, "0" -HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% -HKR, Ndi\Params\MaxSpeed, type, 0, "int" -HKR, Ndi\Params\MaxSpeed, default, 0, "100" -HKR, Ndi\Params\MaxSpeed, min, 0, "0" -HKR, Ndi\Params\MaxSpeed, max, 0, "2000" -HKR, Ndi\Params\MaxSpeed, step, 0, "1" -HKR, Ndi\Params\MaxSpeed, Base, 0, "10" -HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% -HKR, Ndi\Params\KeepLink, type, 0, "enum" -HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% -HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% -HKR, Ndi\Params\KeepLink, default, 0, "0" - - -[Neo.Service] -DisplayName = %Neo.Service.DispName% -Description = %Neo.Service.Desc% -ServiceType = 1 -StartType = 3 -ErrorControl = 1 -ServiceBinary = %12%\Neo_VPN82.sys -LoadOrderGroup = NDIS - -[Neo.Reg] -HKR, Ndi, Service, 0, Neo.Service.Name -HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" -HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" - -[Neo.EventLog] -HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN82.sys" -HKR, , TypesSupported, 0x00010001, 7 - -[Strings] -CompanyName = "SoftEther Corporation" -DiskDescription = "VPN Client Device Driver Install Disk" -Neo.Service.Name = "Neo_VPN82" -Neo.Service.DispName = "VPN Client Device Driver - VPN82" -Neo.Service.Desc = "VPN Client Adapter - VPN82" -NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN82" -Neo.EventLog.Name = "Neo" -NetworkAddress = "MAC Address" -DefaultAddress = "000001000001" -MaxSpeed = "Indicate Speed (Mbps)" -KeepLink = "Keep Link" -On = "On" -Off = "Off" - - -; Auto Generated 20180205_163610.787 - +; VPN Client Device Driver for Windows 2000 and Greater +; +; Copyright (c) SoftEther Corporation. All Rights Reserved. +; http://www.softether.co.jp/ +; +; BUILD 9658 + +[Version] +Signature = "$Windows NT$" +Class = Net +ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} +Provider = %CompanyName% +DriverVer = 02/04/2018, 4.25.0.9658 +CatalogFile.NT = inf_VPN82.cat + +[Manufacturer] +%CompanyName% = SoftEther, NTamd64 + +[SourceDisksNames] +1=%DiskDescription%, "", , + +[SourceDisksFiles] +Neo_VPN82.sys = 1 + +[DestinationDirs] +DefaultDestDir = 12 +Neo.CopyFiles.Sys = 12 + +[Neo.CopyFiles.Sys] +Neo_VPN82.sys, , , 2 + +[SoftEther.NTamd64] +%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN82 + +[NeoAdapter.Install] +Characteristics = 0x1 +AddReg = Neo.Reg, NeoAdapter.Ndi +CopyFiles = Neo.CopyFiles.Sys +*IfType = 53 +*MediaType = 0 +*PhysicalMediaType = 0 + +[NeoAdapter.Install.Services] +AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% + +[NeoAdapter.Ndi] +HKR, , NetworkAddress, 0, %DefaultAddress% +HKR, Ndi, DeviceID, , "NeoAdapter_VPN82" +HKR, , DevLoader, , ndis +HKR, , DeviceVxDs, , Neo_VPN82.sys +HKR, NDIS, LogDriverName, , "Neo_VPN82" +HKR, NDIS, MajorNdisVersion, 1, 5 +HKR, NDIS, MinorNdisVersion, 1, 0 +HKR, Ndi\Interfaces, DefUpper, , "ndis5" +HKR, Ndi\Interfaces, UpperRange, , "ndis5" +HKR, Ndi\Interfaces, LowerRange, , "ethernet" +HKR, Ndi\Interfaces, DefLower, , "ethernet" +HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" +HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% +HKR, Ndi\Params\NetworkAddress, type, 0, "edit" +HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" +HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" +HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% +HKR, Ndi\Params\NetworkAddress, optional, 0, "0" +HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% +HKR, Ndi\Params\MaxSpeed, type, 0, "int" +HKR, Ndi\Params\MaxSpeed, default, 0, "100" +HKR, Ndi\Params\MaxSpeed, min, 0, "0" +HKR, Ndi\Params\MaxSpeed, max, 0, "2000" +HKR, Ndi\Params\MaxSpeed, step, 0, "1" +HKR, Ndi\Params\MaxSpeed, Base, 0, "10" +HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% +HKR, Ndi\Params\KeepLink, type, 0, "enum" +HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% +HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% +HKR, Ndi\Params\KeepLink, default, 0, "0" + + +[Neo.Service] +DisplayName = %Neo.Service.DispName% +Description = %Neo.Service.Desc% +ServiceType = 1 +StartType = 3 +ErrorControl = 1 +ServiceBinary = %12%\Neo_VPN82.sys +LoadOrderGroup = NDIS + +[Neo.Reg] +HKR, Ndi, Service, 0, Neo.Service.Name +HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" +HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" + +[Neo.EventLog] +HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN82.sys" +HKR, , TypesSupported, 0x00010001, 7 + +[Strings] +CompanyName = "SoftEther Corporation" +DiskDescription = "VPN Client Device Driver Install Disk" +Neo.Service.Name = "Neo_VPN82" +Neo.Service.DispName = "VPN Client Device Driver - VPN82" +Neo.Service.Desc = "VPN Client Adapter - VPN82" +NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN82" +Neo.EventLog.Name = "Neo" +NetworkAddress = "MAC Address" +DefaultAddress = "000001000001" +MaxSpeed = "Indicate Speed (Mbps)" +KeepLink = "Keep Link" +On = "On" +Off = "Off" + + +; Auto Generated 20180205_163610.787 + diff --git a/src/bin/hamcore/DriverPackages/Neo6_Win8/x64/Neo6_x64_VPN83.inf b/src/bin/hamcore/DriverPackages/Neo6_Win8/x64/Neo6_x64_VPN83.inf index 938b4658..797fa780 100644 --- a/src/bin/hamcore/DriverPackages/Neo6_Win8/x64/Neo6_x64_VPN83.inf +++ b/src/bin/hamcore/DriverPackages/Neo6_Win8/x64/Neo6_x64_VPN83.inf @@ -1,114 +1,114 @@ -; VPN Client Device Driver for Windows 2000 and Greater -; -; Copyright (c) SoftEther Corporation. All Rights Reserved. -; http://www.softether.co.jp/ -; -; BUILD 9658 - -[Version] -Signature = "$Windows NT$" -Class = Net -ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} -Provider = %CompanyName% -DriverVer = 02/04/2018, 4.25.0.9658 -CatalogFile.NT = inf_VPN83.cat - -[Manufacturer] -%CompanyName% = SoftEther, NTamd64 - -[SourceDisksNames] -1=%DiskDescription%, "", , - -[SourceDisksFiles] -Neo_VPN83.sys = 1 - -[DestinationDirs] -DefaultDestDir = 12 -Neo.CopyFiles.Sys = 12 - -[Neo.CopyFiles.Sys] -Neo_VPN83.sys, , , 2 - -[SoftEther.NTamd64] -%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN83 - -[NeoAdapter.Install] -Characteristics = 0x1 -AddReg = Neo.Reg, NeoAdapter.Ndi -CopyFiles = Neo.CopyFiles.Sys -*IfType = 53 -*MediaType = 0 -*PhysicalMediaType = 0 - -[NeoAdapter.Install.Services] -AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% - -[NeoAdapter.Ndi] -HKR, , NetworkAddress, 0, %DefaultAddress% -HKR, Ndi, DeviceID, , "NeoAdapter_VPN83" -HKR, , DevLoader, , ndis -HKR, , DeviceVxDs, , Neo_VPN83.sys -HKR, NDIS, LogDriverName, , "Neo_VPN83" -HKR, NDIS, MajorNdisVersion, 1, 5 -HKR, NDIS, MinorNdisVersion, 1, 0 -HKR, Ndi\Interfaces, DefUpper, , "ndis5" -HKR, Ndi\Interfaces, UpperRange, , "ndis5" -HKR, Ndi\Interfaces, LowerRange, , "ethernet" -HKR, Ndi\Interfaces, DefLower, , "ethernet" -HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" -HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% -HKR, Ndi\Params\NetworkAddress, type, 0, "edit" -HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" -HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" -HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% -HKR, Ndi\Params\NetworkAddress, optional, 0, "0" -HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% -HKR, Ndi\Params\MaxSpeed, type, 0, "int" -HKR, Ndi\Params\MaxSpeed, default, 0, "100" -HKR, Ndi\Params\MaxSpeed, min, 0, "0" -HKR, Ndi\Params\MaxSpeed, max, 0, "2000" -HKR, Ndi\Params\MaxSpeed, step, 0, "1" -HKR, Ndi\Params\MaxSpeed, Base, 0, "10" -HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% -HKR, Ndi\Params\KeepLink, type, 0, "enum" -HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% -HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% -HKR, Ndi\Params\KeepLink, default, 0, "0" - - -[Neo.Service] -DisplayName = %Neo.Service.DispName% -Description = %Neo.Service.Desc% -ServiceType = 1 -StartType = 3 -ErrorControl = 1 -ServiceBinary = %12%\Neo_VPN83.sys -LoadOrderGroup = NDIS - -[Neo.Reg] -HKR, Ndi, Service, 0, Neo.Service.Name -HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" -HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" - -[Neo.EventLog] -HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN83.sys" -HKR, , TypesSupported, 0x00010001, 7 - -[Strings] -CompanyName = "SoftEther Corporation" -DiskDescription = "VPN Client Device Driver Install Disk" -Neo.Service.Name = "Neo_VPN83" -Neo.Service.DispName = "VPN Client Device Driver - VPN83" -Neo.Service.Desc = "VPN Client Adapter - VPN83" -NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN83" -Neo.EventLog.Name = "Neo" -NetworkAddress = "MAC Address" -DefaultAddress = "000001000001" -MaxSpeed = "Indicate Speed (Mbps)" -KeepLink = "Keep Link" -On = "On" -Off = "Off" - - -; Auto Generated 20180205_163610.787 - +; VPN Client Device Driver for Windows 2000 and Greater +; +; Copyright (c) SoftEther Corporation. All Rights Reserved. +; http://www.softether.co.jp/ +; +; BUILD 9658 + +[Version] +Signature = "$Windows NT$" +Class = Net +ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} +Provider = %CompanyName% +DriverVer = 02/04/2018, 4.25.0.9658 +CatalogFile.NT = inf_VPN83.cat + +[Manufacturer] +%CompanyName% = SoftEther, NTamd64 + +[SourceDisksNames] +1=%DiskDescription%, "", , + +[SourceDisksFiles] +Neo_VPN83.sys = 1 + +[DestinationDirs] +DefaultDestDir = 12 +Neo.CopyFiles.Sys = 12 + +[Neo.CopyFiles.Sys] +Neo_VPN83.sys, , , 2 + +[SoftEther.NTamd64] +%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN83 + +[NeoAdapter.Install] +Characteristics = 0x1 +AddReg = Neo.Reg, NeoAdapter.Ndi +CopyFiles = Neo.CopyFiles.Sys +*IfType = 53 +*MediaType = 0 +*PhysicalMediaType = 0 + +[NeoAdapter.Install.Services] +AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% + +[NeoAdapter.Ndi] +HKR, , NetworkAddress, 0, %DefaultAddress% +HKR, Ndi, DeviceID, , "NeoAdapter_VPN83" +HKR, , DevLoader, , ndis +HKR, , DeviceVxDs, , Neo_VPN83.sys +HKR, NDIS, LogDriverName, , "Neo_VPN83" +HKR, NDIS, MajorNdisVersion, 1, 5 +HKR, NDIS, MinorNdisVersion, 1, 0 +HKR, Ndi\Interfaces, DefUpper, , "ndis5" +HKR, Ndi\Interfaces, UpperRange, , "ndis5" +HKR, Ndi\Interfaces, LowerRange, , "ethernet" +HKR, Ndi\Interfaces, DefLower, , "ethernet" +HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" +HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% +HKR, Ndi\Params\NetworkAddress, type, 0, "edit" +HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" +HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" +HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% +HKR, Ndi\Params\NetworkAddress, optional, 0, "0" +HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% +HKR, Ndi\Params\MaxSpeed, type, 0, "int" +HKR, Ndi\Params\MaxSpeed, default, 0, "100" +HKR, Ndi\Params\MaxSpeed, min, 0, "0" +HKR, Ndi\Params\MaxSpeed, max, 0, "2000" +HKR, Ndi\Params\MaxSpeed, step, 0, "1" +HKR, Ndi\Params\MaxSpeed, Base, 0, "10" +HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% +HKR, Ndi\Params\KeepLink, type, 0, "enum" +HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% +HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% +HKR, Ndi\Params\KeepLink, default, 0, "0" + + +[Neo.Service] +DisplayName = %Neo.Service.DispName% +Description = %Neo.Service.Desc% +ServiceType = 1 +StartType = 3 +ErrorControl = 1 +ServiceBinary = %12%\Neo_VPN83.sys +LoadOrderGroup = NDIS + +[Neo.Reg] +HKR, Ndi, Service, 0, Neo.Service.Name +HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" +HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" + +[Neo.EventLog] +HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN83.sys" +HKR, , TypesSupported, 0x00010001, 7 + +[Strings] +CompanyName = "SoftEther Corporation" +DiskDescription = "VPN Client Device Driver Install Disk" +Neo.Service.Name = "Neo_VPN83" +Neo.Service.DispName = "VPN Client Device Driver - VPN83" +Neo.Service.Desc = "VPN Client Adapter - VPN83" +NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN83" +Neo.EventLog.Name = "Neo" +NetworkAddress = "MAC Address" +DefaultAddress = "000001000001" +MaxSpeed = "Indicate Speed (Mbps)" +KeepLink = "Keep Link" +On = "On" +Off = "Off" + + +; Auto Generated 20180205_163610.787 + diff --git a/src/bin/hamcore/DriverPackages/Neo6_Win8/x64/Neo6_x64_VPN84.inf b/src/bin/hamcore/DriverPackages/Neo6_Win8/x64/Neo6_x64_VPN84.inf index 0069c8e4..ca8a0a33 100644 --- a/src/bin/hamcore/DriverPackages/Neo6_Win8/x64/Neo6_x64_VPN84.inf +++ b/src/bin/hamcore/DriverPackages/Neo6_Win8/x64/Neo6_x64_VPN84.inf @@ -1,114 +1,114 @@ -; VPN Client Device Driver for Windows 2000 and Greater -; -; Copyright (c) SoftEther Corporation. All Rights Reserved. -; http://www.softether.co.jp/ -; -; BUILD 9658 - -[Version] -Signature = "$Windows NT$" -Class = Net -ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} -Provider = %CompanyName% -DriverVer = 02/04/2018, 4.25.0.9658 -CatalogFile.NT = inf_VPN84.cat - -[Manufacturer] -%CompanyName% = SoftEther, NTamd64 - -[SourceDisksNames] -1=%DiskDescription%, "", , - -[SourceDisksFiles] -Neo_VPN84.sys = 1 - -[DestinationDirs] -DefaultDestDir = 12 -Neo.CopyFiles.Sys = 12 - -[Neo.CopyFiles.Sys] -Neo_VPN84.sys, , , 2 - -[SoftEther.NTamd64] -%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN84 - -[NeoAdapter.Install] -Characteristics = 0x1 -AddReg = Neo.Reg, NeoAdapter.Ndi -CopyFiles = Neo.CopyFiles.Sys -*IfType = 53 -*MediaType = 0 -*PhysicalMediaType = 0 - -[NeoAdapter.Install.Services] -AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% - -[NeoAdapter.Ndi] -HKR, , NetworkAddress, 0, %DefaultAddress% -HKR, Ndi, DeviceID, , "NeoAdapter_VPN84" -HKR, , DevLoader, , ndis -HKR, , DeviceVxDs, , Neo_VPN84.sys -HKR, NDIS, LogDriverName, , "Neo_VPN84" -HKR, NDIS, MajorNdisVersion, 1, 5 -HKR, NDIS, MinorNdisVersion, 1, 0 -HKR, Ndi\Interfaces, DefUpper, , "ndis5" -HKR, Ndi\Interfaces, UpperRange, , "ndis5" -HKR, Ndi\Interfaces, LowerRange, , "ethernet" -HKR, Ndi\Interfaces, DefLower, , "ethernet" -HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" -HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% -HKR, Ndi\Params\NetworkAddress, type, 0, "edit" -HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" -HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" -HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% -HKR, Ndi\Params\NetworkAddress, optional, 0, "0" -HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% -HKR, Ndi\Params\MaxSpeed, type, 0, "int" -HKR, Ndi\Params\MaxSpeed, default, 0, "100" -HKR, Ndi\Params\MaxSpeed, min, 0, "0" -HKR, Ndi\Params\MaxSpeed, max, 0, "2000" -HKR, Ndi\Params\MaxSpeed, step, 0, "1" -HKR, Ndi\Params\MaxSpeed, Base, 0, "10" -HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% -HKR, Ndi\Params\KeepLink, type, 0, "enum" -HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% -HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% -HKR, Ndi\Params\KeepLink, default, 0, "0" - - -[Neo.Service] -DisplayName = %Neo.Service.DispName% -Description = %Neo.Service.Desc% -ServiceType = 1 -StartType = 3 -ErrorControl = 1 -ServiceBinary = %12%\Neo_VPN84.sys -LoadOrderGroup = NDIS - -[Neo.Reg] -HKR, Ndi, Service, 0, Neo.Service.Name -HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" -HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" - -[Neo.EventLog] -HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN84.sys" -HKR, , TypesSupported, 0x00010001, 7 - -[Strings] -CompanyName = "SoftEther Corporation" -DiskDescription = "VPN Client Device Driver Install Disk" -Neo.Service.Name = "Neo_VPN84" -Neo.Service.DispName = "VPN Client Device Driver - VPN84" -Neo.Service.Desc = "VPN Client Adapter - VPN84" -NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN84" -Neo.EventLog.Name = "Neo" -NetworkAddress = "MAC Address" -DefaultAddress = "000001000001" -MaxSpeed = "Indicate Speed (Mbps)" -KeepLink = "Keep Link" -On = "On" -Off = "Off" - - -; Auto Generated 20180205_163610.788 - +; VPN Client Device Driver for Windows 2000 and Greater +; +; Copyright (c) SoftEther Corporation. All Rights Reserved. +; http://www.softether.co.jp/ +; +; BUILD 9658 + +[Version] +Signature = "$Windows NT$" +Class = Net +ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} +Provider = %CompanyName% +DriverVer = 02/04/2018, 4.25.0.9658 +CatalogFile.NT = inf_VPN84.cat + +[Manufacturer] +%CompanyName% = SoftEther, NTamd64 + +[SourceDisksNames] +1=%DiskDescription%, "", , + +[SourceDisksFiles] +Neo_VPN84.sys = 1 + +[DestinationDirs] +DefaultDestDir = 12 +Neo.CopyFiles.Sys = 12 + +[Neo.CopyFiles.Sys] +Neo_VPN84.sys, , , 2 + +[SoftEther.NTamd64] +%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN84 + +[NeoAdapter.Install] +Characteristics = 0x1 +AddReg = Neo.Reg, NeoAdapter.Ndi +CopyFiles = Neo.CopyFiles.Sys +*IfType = 53 +*MediaType = 0 +*PhysicalMediaType = 0 + +[NeoAdapter.Install.Services] +AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% + +[NeoAdapter.Ndi] +HKR, , NetworkAddress, 0, %DefaultAddress% +HKR, Ndi, DeviceID, , "NeoAdapter_VPN84" +HKR, , DevLoader, , ndis +HKR, , DeviceVxDs, , Neo_VPN84.sys +HKR, NDIS, LogDriverName, , "Neo_VPN84" +HKR, NDIS, MajorNdisVersion, 1, 5 +HKR, NDIS, MinorNdisVersion, 1, 0 +HKR, Ndi\Interfaces, DefUpper, , "ndis5" +HKR, Ndi\Interfaces, UpperRange, , "ndis5" +HKR, Ndi\Interfaces, LowerRange, , "ethernet" +HKR, Ndi\Interfaces, DefLower, , "ethernet" +HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" +HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% +HKR, Ndi\Params\NetworkAddress, type, 0, "edit" +HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" +HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" +HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% +HKR, Ndi\Params\NetworkAddress, optional, 0, "0" +HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% +HKR, Ndi\Params\MaxSpeed, type, 0, "int" +HKR, Ndi\Params\MaxSpeed, default, 0, "100" +HKR, Ndi\Params\MaxSpeed, min, 0, "0" +HKR, Ndi\Params\MaxSpeed, max, 0, "2000" +HKR, Ndi\Params\MaxSpeed, step, 0, "1" +HKR, Ndi\Params\MaxSpeed, Base, 0, "10" +HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% +HKR, Ndi\Params\KeepLink, type, 0, "enum" +HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% +HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% +HKR, Ndi\Params\KeepLink, default, 0, "0" + + +[Neo.Service] +DisplayName = %Neo.Service.DispName% +Description = %Neo.Service.Desc% +ServiceType = 1 +StartType = 3 +ErrorControl = 1 +ServiceBinary = %12%\Neo_VPN84.sys +LoadOrderGroup = NDIS + +[Neo.Reg] +HKR, Ndi, Service, 0, Neo.Service.Name +HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" +HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" + +[Neo.EventLog] +HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN84.sys" +HKR, , TypesSupported, 0x00010001, 7 + +[Strings] +CompanyName = "SoftEther Corporation" +DiskDescription = "VPN Client Device Driver Install Disk" +Neo.Service.Name = "Neo_VPN84" +Neo.Service.DispName = "VPN Client Device Driver - VPN84" +Neo.Service.Desc = "VPN Client Adapter - VPN84" +NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN84" +Neo.EventLog.Name = "Neo" +NetworkAddress = "MAC Address" +DefaultAddress = "000001000001" +MaxSpeed = "Indicate Speed (Mbps)" +KeepLink = "Keep Link" +On = "On" +Off = "Off" + + +; Auto Generated 20180205_163610.788 + diff --git a/src/bin/hamcore/DriverPackages/Neo6_Win8/x64/Neo6_x64_VPN85.inf b/src/bin/hamcore/DriverPackages/Neo6_Win8/x64/Neo6_x64_VPN85.inf index 9cbb7ec4..e80cfeee 100644 --- a/src/bin/hamcore/DriverPackages/Neo6_Win8/x64/Neo6_x64_VPN85.inf +++ b/src/bin/hamcore/DriverPackages/Neo6_Win8/x64/Neo6_x64_VPN85.inf @@ -1,114 +1,114 @@ -; VPN Client Device Driver for Windows 2000 and Greater -; -; Copyright (c) SoftEther Corporation. All Rights Reserved. -; http://www.softether.co.jp/ -; -; BUILD 9658 - -[Version] -Signature = "$Windows NT$" -Class = Net -ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} -Provider = %CompanyName% -DriverVer = 02/04/2018, 4.25.0.9658 -CatalogFile.NT = inf_VPN85.cat - -[Manufacturer] -%CompanyName% = SoftEther, NTamd64 - -[SourceDisksNames] -1=%DiskDescription%, "", , - -[SourceDisksFiles] -Neo_VPN85.sys = 1 - -[DestinationDirs] -DefaultDestDir = 12 -Neo.CopyFiles.Sys = 12 - -[Neo.CopyFiles.Sys] -Neo_VPN85.sys, , , 2 - -[SoftEther.NTamd64] -%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN85 - -[NeoAdapter.Install] -Characteristics = 0x1 -AddReg = Neo.Reg, NeoAdapter.Ndi -CopyFiles = Neo.CopyFiles.Sys -*IfType = 53 -*MediaType = 0 -*PhysicalMediaType = 0 - -[NeoAdapter.Install.Services] -AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% - -[NeoAdapter.Ndi] -HKR, , NetworkAddress, 0, %DefaultAddress% -HKR, Ndi, DeviceID, , "NeoAdapter_VPN85" -HKR, , DevLoader, , ndis -HKR, , DeviceVxDs, , Neo_VPN85.sys -HKR, NDIS, LogDriverName, , "Neo_VPN85" -HKR, NDIS, MajorNdisVersion, 1, 5 -HKR, NDIS, MinorNdisVersion, 1, 0 -HKR, Ndi\Interfaces, DefUpper, , "ndis5" -HKR, Ndi\Interfaces, UpperRange, , "ndis5" -HKR, Ndi\Interfaces, LowerRange, , "ethernet" -HKR, Ndi\Interfaces, DefLower, , "ethernet" -HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" -HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% -HKR, Ndi\Params\NetworkAddress, type, 0, "edit" -HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" -HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" -HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% -HKR, Ndi\Params\NetworkAddress, optional, 0, "0" -HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% -HKR, Ndi\Params\MaxSpeed, type, 0, "int" -HKR, Ndi\Params\MaxSpeed, default, 0, "100" -HKR, Ndi\Params\MaxSpeed, min, 0, "0" -HKR, Ndi\Params\MaxSpeed, max, 0, "2000" -HKR, Ndi\Params\MaxSpeed, step, 0, "1" -HKR, Ndi\Params\MaxSpeed, Base, 0, "10" -HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% -HKR, Ndi\Params\KeepLink, type, 0, "enum" -HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% -HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% -HKR, Ndi\Params\KeepLink, default, 0, "0" - - -[Neo.Service] -DisplayName = %Neo.Service.DispName% -Description = %Neo.Service.Desc% -ServiceType = 1 -StartType = 3 -ErrorControl = 1 -ServiceBinary = %12%\Neo_VPN85.sys -LoadOrderGroup = NDIS - -[Neo.Reg] -HKR, Ndi, Service, 0, Neo.Service.Name -HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" -HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" - -[Neo.EventLog] -HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN85.sys" -HKR, , TypesSupported, 0x00010001, 7 - -[Strings] -CompanyName = "SoftEther Corporation" -DiskDescription = "VPN Client Device Driver Install Disk" -Neo.Service.Name = "Neo_VPN85" -Neo.Service.DispName = "VPN Client Device Driver - VPN85" -Neo.Service.Desc = "VPN Client Adapter - VPN85" -NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN85" -Neo.EventLog.Name = "Neo" -NetworkAddress = "MAC Address" -DefaultAddress = "000001000001" -MaxSpeed = "Indicate Speed (Mbps)" -KeepLink = "Keep Link" -On = "On" -Off = "Off" - - -; Auto Generated 20180205_163610.789 - +; VPN Client Device Driver for Windows 2000 and Greater +; +; Copyright (c) SoftEther Corporation. All Rights Reserved. +; http://www.softether.co.jp/ +; +; BUILD 9658 + +[Version] +Signature = "$Windows NT$" +Class = Net +ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} +Provider = %CompanyName% +DriverVer = 02/04/2018, 4.25.0.9658 +CatalogFile.NT = inf_VPN85.cat + +[Manufacturer] +%CompanyName% = SoftEther, NTamd64 + +[SourceDisksNames] +1=%DiskDescription%, "", , + +[SourceDisksFiles] +Neo_VPN85.sys = 1 + +[DestinationDirs] +DefaultDestDir = 12 +Neo.CopyFiles.Sys = 12 + +[Neo.CopyFiles.Sys] +Neo_VPN85.sys, , , 2 + +[SoftEther.NTamd64] +%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN85 + +[NeoAdapter.Install] +Characteristics = 0x1 +AddReg = Neo.Reg, NeoAdapter.Ndi +CopyFiles = Neo.CopyFiles.Sys +*IfType = 53 +*MediaType = 0 +*PhysicalMediaType = 0 + +[NeoAdapter.Install.Services] +AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% + +[NeoAdapter.Ndi] +HKR, , NetworkAddress, 0, %DefaultAddress% +HKR, Ndi, DeviceID, , "NeoAdapter_VPN85" +HKR, , DevLoader, , ndis +HKR, , DeviceVxDs, , Neo_VPN85.sys +HKR, NDIS, LogDriverName, , "Neo_VPN85" +HKR, NDIS, MajorNdisVersion, 1, 5 +HKR, NDIS, MinorNdisVersion, 1, 0 +HKR, Ndi\Interfaces, DefUpper, , "ndis5" +HKR, Ndi\Interfaces, UpperRange, , "ndis5" +HKR, Ndi\Interfaces, LowerRange, , "ethernet" +HKR, Ndi\Interfaces, DefLower, , "ethernet" +HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" +HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% +HKR, Ndi\Params\NetworkAddress, type, 0, "edit" +HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" +HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" +HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% +HKR, Ndi\Params\NetworkAddress, optional, 0, "0" +HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% +HKR, Ndi\Params\MaxSpeed, type, 0, "int" +HKR, Ndi\Params\MaxSpeed, default, 0, "100" +HKR, Ndi\Params\MaxSpeed, min, 0, "0" +HKR, Ndi\Params\MaxSpeed, max, 0, "2000" +HKR, Ndi\Params\MaxSpeed, step, 0, "1" +HKR, Ndi\Params\MaxSpeed, Base, 0, "10" +HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% +HKR, Ndi\Params\KeepLink, type, 0, "enum" +HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% +HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% +HKR, Ndi\Params\KeepLink, default, 0, "0" + + +[Neo.Service] +DisplayName = %Neo.Service.DispName% +Description = %Neo.Service.Desc% +ServiceType = 1 +StartType = 3 +ErrorControl = 1 +ServiceBinary = %12%\Neo_VPN85.sys +LoadOrderGroup = NDIS + +[Neo.Reg] +HKR, Ndi, Service, 0, Neo.Service.Name +HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" +HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" + +[Neo.EventLog] +HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN85.sys" +HKR, , TypesSupported, 0x00010001, 7 + +[Strings] +CompanyName = "SoftEther Corporation" +DiskDescription = "VPN Client Device Driver Install Disk" +Neo.Service.Name = "Neo_VPN85" +Neo.Service.DispName = "VPN Client Device Driver - VPN85" +Neo.Service.Desc = "VPN Client Adapter - VPN85" +NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN85" +Neo.EventLog.Name = "Neo" +NetworkAddress = "MAC Address" +DefaultAddress = "000001000001" +MaxSpeed = "Indicate Speed (Mbps)" +KeepLink = "Keep Link" +On = "On" +Off = "Off" + + +; Auto Generated 20180205_163610.789 + diff --git a/src/bin/hamcore/DriverPackages/Neo6_Win8/x64/Neo6_x64_VPN86.inf b/src/bin/hamcore/DriverPackages/Neo6_Win8/x64/Neo6_x64_VPN86.inf index 14026528..3f70d1f7 100644 --- a/src/bin/hamcore/DriverPackages/Neo6_Win8/x64/Neo6_x64_VPN86.inf +++ b/src/bin/hamcore/DriverPackages/Neo6_Win8/x64/Neo6_x64_VPN86.inf @@ -1,114 +1,114 @@ -; VPN Client Device Driver for Windows 2000 and Greater -; -; Copyright (c) SoftEther Corporation. All Rights Reserved. -; http://www.softether.co.jp/ -; -; BUILD 9658 - -[Version] -Signature = "$Windows NT$" -Class = Net -ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} -Provider = %CompanyName% -DriverVer = 02/04/2018, 4.25.0.9658 -CatalogFile.NT = inf_VPN86.cat - -[Manufacturer] -%CompanyName% = SoftEther, NTamd64 - -[SourceDisksNames] -1=%DiskDescription%, "", , - -[SourceDisksFiles] -Neo_VPN86.sys = 1 - -[DestinationDirs] -DefaultDestDir = 12 -Neo.CopyFiles.Sys = 12 - -[Neo.CopyFiles.Sys] -Neo_VPN86.sys, , , 2 - -[SoftEther.NTamd64] -%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN86 - -[NeoAdapter.Install] -Characteristics = 0x1 -AddReg = Neo.Reg, NeoAdapter.Ndi -CopyFiles = Neo.CopyFiles.Sys -*IfType = 53 -*MediaType = 0 -*PhysicalMediaType = 0 - -[NeoAdapter.Install.Services] -AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% - -[NeoAdapter.Ndi] -HKR, , NetworkAddress, 0, %DefaultAddress% -HKR, Ndi, DeviceID, , "NeoAdapter_VPN86" -HKR, , DevLoader, , ndis -HKR, , DeviceVxDs, , Neo_VPN86.sys -HKR, NDIS, LogDriverName, , "Neo_VPN86" -HKR, NDIS, MajorNdisVersion, 1, 5 -HKR, NDIS, MinorNdisVersion, 1, 0 -HKR, Ndi\Interfaces, DefUpper, , "ndis5" -HKR, Ndi\Interfaces, UpperRange, , "ndis5" -HKR, Ndi\Interfaces, LowerRange, , "ethernet" -HKR, Ndi\Interfaces, DefLower, , "ethernet" -HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" -HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% -HKR, Ndi\Params\NetworkAddress, type, 0, "edit" -HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" -HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" -HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% -HKR, Ndi\Params\NetworkAddress, optional, 0, "0" -HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% -HKR, Ndi\Params\MaxSpeed, type, 0, "int" -HKR, Ndi\Params\MaxSpeed, default, 0, "100" -HKR, Ndi\Params\MaxSpeed, min, 0, "0" -HKR, Ndi\Params\MaxSpeed, max, 0, "2000" -HKR, Ndi\Params\MaxSpeed, step, 0, "1" -HKR, Ndi\Params\MaxSpeed, Base, 0, "10" -HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% -HKR, Ndi\Params\KeepLink, type, 0, "enum" -HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% -HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% -HKR, Ndi\Params\KeepLink, default, 0, "0" - - -[Neo.Service] -DisplayName = %Neo.Service.DispName% -Description = %Neo.Service.Desc% -ServiceType = 1 -StartType = 3 -ErrorControl = 1 -ServiceBinary = %12%\Neo_VPN86.sys -LoadOrderGroup = NDIS - -[Neo.Reg] -HKR, Ndi, Service, 0, Neo.Service.Name -HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" -HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" - -[Neo.EventLog] -HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN86.sys" -HKR, , TypesSupported, 0x00010001, 7 - -[Strings] -CompanyName = "SoftEther Corporation" -DiskDescription = "VPN Client Device Driver Install Disk" -Neo.Service.Name = "Neo_VPN86" -Neo.Service.DispName = "VPN Client Device Driver - VPN86" -Neo.Service.Desc = "VPN Client Adapter - VPN86" -NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN86" -Neo.EventLog.Name = "Neo" -NetworkAddress = "MAC Address" -DefaultAddress = "000001000001" -MaxSpeed = "Indicate Speed (Mbps)" -KeepLink = "Keep Link" -On = "On" -Off = "Off" - - -; Auto Generated 20180205_163610.790 - +; VPN Client Device Driver for Windows 2000 and Greater +; +; Copyright (c) SoftEther Corporation. All Rights Reserved. +; http://www.softether.co.jp/ +; +; BUILD 9658 + +[Version] +Signature = "$Windows NT$" +Class = Net +ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} +Provider = %CompanyName% +DriverVer = 02/04/2018, 4.25.0.9658 +CatalogFile.NT = inf_VPN86.cat + +[Manufacturer] +%CompanyName% = SoftEther, NTamd64 + +[SourceDisksNames] +1=%DiskDescription%, "", , + +[SourceDisksFiles] +Neo_VPN86.sys = 1 + +[DestinationDirs] +DefaultDestDir = 12 +Neo.CopyFiles.Sys = 12 + +[Neo.CopyFiles.Sys] +Neo_VPN86.sys, , , 2 + +[SoftEther.NTamd64] +%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN86 + +[NeoAdapter.Install] +Characteristics = 0x1 +AddReg = Neo.Reg, NeoAdapter.Ndi +CopyFiles = Neo.CopyFiles.Sys +*IfType = 53 +*MediaType = 0 +*PhysicalMediaType = 0 + +[NeoAdapter.Install.Services] +AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% + +[NeoAdapter.Ndi] +HKR, , NetworkAddress, 0, %DefaultAddress% +HKR, Ndi, DeviceID, , "NeoAdapter_VPN86" +HKR, , DevLoader, , ndis +HKR, , DeviceVxDs, , Neo_VPN86.sys +HKR, NDIS, LogDriverName, , "Neo_VPN86" +HKR, NDIS, MajorNdisVersion, 1, 5 +HKR, NDIS, MinorNdisVersion, 1, 0 +HKR, Ndi\Interfaces, DefUpper, , "ndis5" +HKR, Ndi\Interfaces, UpperRange, , "ndis5" +HKR, Ndi\Interfaces, LowerRange, , "ethernet" +HKR, Ndi\Interfaces, DefLower, , "ethernet" +HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" +HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% +HKR, Ndi\Params\NetworkAddress, type, 0, "edit" +HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" +HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" +HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% +HKR, Ndi\Params\NetworkAddress, optional, 0, "0" +HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% +HKR, Ndi\Params\MaxSpeed, type, 0, "int" +HKR, Ndi\Params\MaxSpeed, default, 0, "100" +HKR, Ndi\Params\MaxSpeed, min, 0, "0" +HKR, Ndi\Params\MaxSpeed, max, 0, "2000" +HKR, Ndi\Params\MaxSpeed, step, 0, "1" +HKR, Ndi\Params\MaxSpeed, Base, 0, "10" +HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% +HKR, Ndi\Params\KeepLink, type, 0, "enum" +HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% +HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% +HKR, Ndi\Params\KeepLink, default, 0, "0" + + +[Neo.Service] +DisplayName = %Neo.Service.DispName% +Description = %Neo.Service.Desc% +ServiceType = 1 +StartType = 3 +ErrorControl = 1 +ServiceBinary = %12%\Neo_VPN86.sys +LoadOrderGroup = NDIS + +[Neo.Reg] +HKR, Ndi, Service, 0, Neo.Service.Name +HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" +HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" + +[Neo.EventLog] +HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN86.sys" +HKR, , TypesSupported, 0x00010001, 7 + +[Strings] +CompanyName = "SoftEther Corporation" +DiskDescription = "VPN Client Device Driver Install Disk" +Neo.Service.Name = "Neo_VPN86" +Neo.Service.DispName = "VPN Client Device Driver - VPN86" +Neo.Service.Desc = "VPN Client Adapter - VPN86" +NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN86" +Neo.EventLog.Name = "Neo" +NetworkAddress = "MAC Address" +DefaultAddress = "000001000001" +MaxSpeed = "Indicate Speed (Mbps)" +KeepLink = "Keep Link" +On = "On" +Off = "Off" + + +; Auto Generated 20180205_163610.790 + diff --git a/src/bin/hamcore/DriverPackages/Neo6_Win8/x64/Neo6_x64_VPN87.inf b/src/bin/hamcore/DriverPackages/Neo6_Win8/x64/Neo6_x64_VPN87.inf index 22aaf446..19deba0a 100644 --- a/src/bin/hamcore/DriverPackages/Neo6_Win8/x64/Neo6_x64_VPN87.inf +++ b/src/bin/hamcore/DriverPackages/Neo6_Win8/x64/Neo6_x64_VPN87.inf @@ -1,114 +1,114 @@ -; VPN Client Device Driver for Windows 2000 and Greater -; -; Copyright (c) SoftEther Corporation. All Rights Reserved. -; http://www.softether.co.jp/ -; -; BUILD 9658 - -[Version] -Signature = "$Windows NT$" -Class = Net -ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} -Provider = %CompanyName% -DriverVer = 02/04/2018, 4.25.0.9658 -CatalogFile.NT = inf_VPN87.cat - -[Manufacturer] -%CompanyName% = SoftEther, NTamd64 - -[SourceDisksNames] -1=%DiskDescription%, "", , - -[SourceDisksFiles] -Neo_VPN87.sys = 1 - -[DestinationDirs] -DefaultDestDir = 12 -Neo.CopyFiles.Sys = 12 - -[Neo.CopyFiles.Sys] -Neo_VPN87.sys, , , 2 - -[SoftEther.NTamd64] -%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN87 - -[NeoAdapter.Install] -Characteristics = 0x1 -AddReg = Neo.Reg, NeoAdapter.Ndi -CopyFiles = Neo.CopyFiles.Sys -*IfType = 53 -*MediaType = 0 -*PhysicalMediaType = 0 - -[NeoAdapter.Install.Services] -AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% - -[NeoAdapter.Ndi] -HKR, , NetworkAddress, 0, %DefaultAddress% -HKR, Ndi, DeviceID, , "NeoAdapter_VPN87" -HKR, , DevLoader, , ndis -HKR, , DeviceVxDs, , Neo_VPN87.sys -HKR, NDIS, LogDriverName, , "Neo_VPN87" -HKR, NDIS, MajorNdisVersion, 1, 5 -HKR, NDIS, MinorNdisVersion, 1, 0 -HKR, Ndi\Interfaces, DefUpper, , "ndis5" -HKR, Ndi\Interfaces, UpperRange, , "ndis5" -HKR, Ndi\Interfaces, LowerRange, , "ethernet" -HKR, Ndi\Interfaces, DefLower, , "ethernet" -HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" -HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% -HKR, Ndi\Params\NetworkAddress, type, 0, "edit" -HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" -HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" -HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% -HKR, Ndi\Params\NetworkAddress, optional, 0, "0" -HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% -HKR, Ndi\Params\MaxSpeed, type, 0, "int" -HKR, Ndi\Params\MaxSpeed, default, 0, "100" -HKR, Ndi\Params\MaxSpeed, min, 0, "0" -HKR, Ndi\Params\MaxSpeed, max, 0, "2000" -HKR, Ndi\Params\MaxSpeed, step, 0, "1" -HKR, Ndi\Params\MaxSpeed, Base, 0, "10" -HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% -HKR, Ndi\Params\KeepLink, type, 0, "enum" -HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% -HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% -HKR, Ndi\Params\KeepLink, default, 0, "0" - - -[Neo.Service] -DisplayName = %Neo.Service.DispName% -Description = %Neo.Service.Desc% -ServiceType = 1 -StartType = 3 -ErrorControl = 1 -ServiceBinary = %12%\Neo_VPN87.sys -LoadOrderGroup = NDIS - -[Neo.Reg] -HKR, Ndi, Service, 0, Neo.Service.Name -HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" -HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" - -[Neo.EventLog] -HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN87.sys" -HKR, , TypesSupported, 0x00010001, 7 - -[Strings] -CompanyName = "SoftEther Corporation" -DiskDescription = "VPN Client Device Driver Install Disk" -Neo.Service.Name = "Neo_VPN87" -Neo.Service.DispName = "VPN Client Device Driver - VPN87" -Neo.Service.Desc = "VPN Client Adapter - VPN87" -NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN87" -Neo.EventLog.Name = "Neo" -NetworkAddress = "MAC Address" -DefaultAddress = "000001000001" -MaxSpeed = "Indicate Speed (Mbps)" -KeepLink = "Keep Link" -On = "On" -Off = "Off" - - -; Auto Generated 20180205_163610.790 - +; VPN Client Device Driver for Windows 2000 and Greater +; +; Copyright (c) SoftEther Corporation. All Rights Reserved. +; http://www.softether.co.jp/ +; +; BUILD 9658 + +[Version] +Signature = "$Windows NT$" +Class = Net +ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} +Provider = %CompanyName% +DriverVer = 02/04/2018, 4.25.0.9658 +CatalogFile.NT = inf_VPN87.cat + +[Manufacturer] +%CompanyName% = SoftEther, NTamd64 + +[SourceDisksNames] +1=%DiskDescription%, "", , + +[SourceDisksFiles] +Neo_VPN87.sys = 1 + +[DestinationDirs] +DefaultDestDir = 12 +Neo.CopyFiles.Sys = 12 + +[Neo.CopyFiles.Sys] +Neo_VPN87.sys, , , 2 + +[SoftEther.NTamd64] +%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN87 + +[NeoAdapter.Install] +Characteristics = 0x1 +AddReg = Neo.Reg, NeoAdapter.Ndi +CopyFiles = Neo.CopyFiles.Sys +*IfType = 53 +*MediaType = 0 +*PhysicalMediaType = 0 + +[NeoAdapter.Install.Services] +AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% + +[NeoAdapter.Ndi] +HKR, , NetworkAddress, 0, %DefaultAddress% +HKR, Ndi, DeviceID, , "NeoAdapter_VPN87" +HKR, , DevLoader, , ndis +HKR, , DeviceVxDs, , Neo_VPN87.sys +HKR, NDIS, LogDriverName, , "Neo_VPN87" +HKR, NDIS, MajorNdisVersion, 1, 5 +HKR, NDIS, MinorNdisVersion, 1, 0 +HKR, Ndi\Interfaces, DefUpper, , "ndis5" +HKR, Ndi\Interfaces, UpperRange, , "ndis5" +HKR, Ndi\Interfaces, LowerRange, , "ethernet" +HKR, Ndi\Interfaces, DefLower, , "ethernet" +HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" +HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% +HKR, Ndi\Params\NetworkAddress, type, 0, "edit" +HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" +HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" +HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% +HKR, Ndi\Params\NetworkAddress, optional, 0, "0" +HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% +HKR, Ndi\Params\MaxSpeed, type, 0, "int" +HKR, Ndi\Params\MaxSpeed, default, 0, "100" +HKR, Ndi\Params\MaxSpeed, min, 0, "0" +HKR, Ndi\Params\MaxSpeed, max, 0, "2000" +HKR, Ndi\Params\MaxSpeed, step, 0, "1" +HKR, Ndi\Params\MaxSpeed, Base, 0, "10" +HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% +HKR, Ndi\Params\KeepLink, type, 0, "enum" +HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% +HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% +HKR, Ndi\Params\KeepLink, default, 0, "0" + + +[Neo.Service] +DisplayName = %Neo.Service.DispName% +Description = %Neo.Service.Desc% +ServiceType = 1 +StartType = 3 +ErrorControl = 1 +ServiceBinary = %12%\Neo_VPN87.sys +LoadOrderGroup = NDIS + +[Neo.Reg] +HKR, Ndi, Service, 0, Neo.Service.Name +HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" +HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" + +[Neo.EventLog] +HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN87.sys" +HKR, , TypesSupported, 0x00010001, 7 + +[Strings] +CompanyName = "SoftEther Corporation" +DiskDescription = "VPN Client Device Driver Install Disk" +Neo.Service.Name = "Neo_VPN87" +Neo.Service.DispName = "VPN Client Device Driver - VPN87" +Neo.Service.Desc = "VPN Client Adapter - VPN87" +NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN87" +Neo.EventLog.Name = "Neo" +NetworkAddress = "MAC Address" +DefaultAddress = "000001000001" +MaxSpeed = "Indicate Speed (Mbps)" +KeepLink = "Keep Link" +On = "On" +Off = "Off" + + +; Auto Generated 20180205_163610.790 + diff --git a/src/bin/hamcore/DriverPackages/Neo6_Win8/x64/Neo6_x64_VPN88.inf b/src/bin/hamcore/DriverPackages/Neo6_Win8/x64/Neo6_x64_VPN88.inf index 312006f2..e118a08d 100644 --- a/src/bin/hamcore/DriverPackages/Neo6_Win8/x64/Neo6_x64_VPN88.inf +++ b/src/bin/hamcore/DriverPackages/Neo6_Win8/x64/Neo6_x64_VPN88.inf @@ -1,114 +1,114 @@ -; VPN Client Device Driver for Windows 2000 and Greater -; -; Copyright (c) SoftEther Corporation. All Rights Reserved. -; http://www.softether.co.jp/ -; -; BUILD 9658 - -[Version] -Signature = "$Windows NT$" -Class = Net -ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} -Provider = %CompanyName% -DriverVer = 02/04/2018, 4.25.0.9658 -CatalogFile.NT = inf_VPN88.cat - -[Manufacturer] -%CompanyName% = SoftEther, NTamd64 - -[SourceDisksNames] -1=%DiskDescription%, "", , - -[SourceDisksFiles] -Neo_VPN88.sys = 1 - -[DestinationDirs] -DefaultDestDir = 12 -Neo.CopyFiles.Sys = 12 - -[Neo.CopyFiles.Sys] -Neo_VPN88.sys, , , 2 - -[SoftEther.NTamd64] -%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN88 - -[NeoAdapter.Install] -Characteristics = 0x1 -AddReg = Neo.Reg, NeoAdapter.Ndi -CopyFiles = Neo.CopyFiles.Sys -*IfType = 53 -*MediaType = 0 -*PhysicalMediaType = 0 - -[NeoAdapter.Install.Services] -AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% - -[NeoAdapter.Ndi] -HKR, , NetworkAddress, 0, %DefaultAddress% -HKR, Ndi, DeviceID, , "NeoAdapter_VPN88" -HKR, , DevLoader, , ndis -HKR, , DeviceVxDs, , Neo_VPN88.sys -HKR, NDIS, LogDriverName, , "Neo_VPN88" -HKR, NDIS, MajorNdisVersion, 1, 5 -HKR, NDIS, MinorNdisVersion, 1, 0 -HKR, Ndi\Interfaces, DefUpper, , "ndis5" -HKR, Ndi\Interfaces, UpperRange, , "ndis5" -HKR, Ndi\Interfaces, LowerRange, , "ethernet" -HKR, Ndi\Interfaces, DefLower, , "ethernet" -HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" -HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% -HKR, Ndi\Params\NetworkAddress, type, 0, "edit" -HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" -HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" -HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% -HKR, Ndi\Params\NetworkAddress, optional, 0, "0" -HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% -HKR, Ndi\Params\MaxSpeed, type, 0, "int" -HKR, Ndi\Params\MaxSpeed, default, 0, "100" -HKR, Ndi\Params\MaxSpeed, min, 0, "0" -HKR, Ndi\Params\MaxSpeed, max, 0, "2000" -HKR, Ndi\Params\MaxSpeed, step, 0, "1" -HKR, Ndi\Params\MaxSpeed, Base, 0, "10" -HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% -HKR, Ndi\Params\KeepLink, type, 0, "enum" -HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% -HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% -HKR, Ndi\Params\KeepLink, default, 0, "0" - - -[Neo.Service] -DisplayName = %Neo.Service.DispName% -Description = %Neo.Service.Desc% -ServiceType = 1 -StartType = 3 -ErrorControl = 1 -ServiceBinary = %12%\Neo_VPN88.sys -LoadOrderGroup = NDIS - -[Neo.Reg] -HKR, Ndi, Service, 0, Neo.Service.Name -HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" -HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" - -[Neo.EventLog] -HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN88.sys" -HKR, , TypesSupported, 0x00010001, 7 - -[Strings] -CompanyName = "SoftEther Corporation" -DiskDescription = "VPN Client Device Driver Install Disk" -Neo.Service.Name = "Neo_VPN88" -Neo.Service.DispName = "VPN Client Device Driver - VPN88" -Neo.Service.Desc = "VPN Client Adapter - VPN88" -NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN88" -Neo.EventLog.Name = "Neo" -NetworkAddress = "MAC Address" -DefaultAddress = "000001000001" -MaxSpeed = "Indicate Speed (Mbps)" -KeepLink = "Keep Link" -On = "On" -Off = "Off" - - -; Auto Generated 20180205_163610.791 - +; VPN Client Device Driver for Windows 2000 and Greater +; +; Copyright (c) SoftEther Corporation. All Rights Reserved. +; http://www.softether.co.jp/ +; +; BUILD 9658 + +[Version] +Signature = "$Windows NT$" +Class = Net +ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} +Provider = %CompanyName% +DriverVer = 02/04/2018, 4.25.0.9658 +CatalogFile.NT = inf_VPN88.cat + +[Manufacturer] +%CompanyName% = SoftEther, NTamd64 + +[SourceDisksNames] +1=%DiskDescription%, "", , + +[SourceDisksFiles] +Neo_VPN88.sys = 1 + +[DestinationDirs] +DefaultDestDir = 12 +Neo.CopyFiles.Sys = 12 + +[Neo.CopyFiles.Sys] +Neo_VPN88.sys, , , 2 + +[SoftEther.NTamd64] +%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN88 + +[NeoAdapter.Install] +Characteristics = 0x1 +AddReg = Neo.Reg, NeoAdapter.Ndi +CopyFiles = Neo.CopyFiles.Sys +*IfType = 53 +*MediaType = 0 +*PhysicalMediaType = 0 + +[NeoAdapter.Install.Services] +AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% + +[NeoAdapter.Ndi] +HKR, , NetworkAddress, 0, %DefaultAddress% +HKR, Ndi, DeviceID, , "NeoAdapter_VPN88" +HKR, , DevLoader, , ndis +HKR, , DeviceVxDs, , Neo_VPN88.sys +HKR, NDIS, LogDriverName, , "Neo_VPN88" +HKR, NDIS, MajorNdisVersion, 1, 5 +HKR, NDIS, MinorNdisVersion, 1, 0 +HKR, Ndi\Interfaces, DefUpper, , "ndis5" +HKR, Ndi\Interfaces, UpperRange, , "ndis5" +HKR, Ndi\Interfaces, LowerRange, , "ethernet" +HKR, Ndi\Interfaces, DefLower, , "ethernet" +HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" +HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% +HKR, Ndi\Params\NetworkAddress, type, 0, "edit" +HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" +HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" +HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% +HKR, Ndi\Params\NetworkAddress, optional, 0, "0" +HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% +HKR, Ndi\Params\MaxSpeed, type, 0, "int" +HKR, Ndi\Params\MaxSpeed, default, 0, "100" +HKR, Ndi\Params\MaxSpeed, min, 0, "0" +HKR, Ndi\Params\MaxSpeed, max, 0, "2000" +HKR, Ndi\Params\MaxSpeed, step, 0, "1" +HKR, Ndi\Params\MaxSpeed, Base, 0, "10" +HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% +HKR, Ndi\Params\KeepLink, type, 0, "enum" +HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% +HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% +HKR, Ndi\Params\KeepLink, default, 0, "0" + + +[Neo.Service] +DisplayName = %Neo.Service.DispName% +Description = %Neo.Service.Desc% +ServiceType = 1 +StartType = 3 +ErrorControl = 1 +ServiceBinary = %12%\Neo_VPN88.sys +LoadOrderGroup = NDIS + +[Neo.Reg] +HKR, Ndi, Service, 0, Neo.Service.Name +HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" +HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" + +[Neo.EventLog] +HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN88.sys" +HKR, , TypesSupported, 0x00010001, 7 + +[Strings] +CompanyName = "SoftEther Corporation" +DiskDescription = "VPN Client Device Driver Install Disk" +Neo.Service.Name = "Neo_VPN88" +Neo.Service.DispName = "VPN Client Device Driver - VPN88" +Neo.Service.Desc = "VPN Client Adapter - VPN88" +NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN88" +Neo.EventLog.Name = "Neo" +NetworkAddress = "MAC Address" +DefaultAddress = "000001000001" +MaxSpeed = "Indicate Speed (Mbps)" +KeepLink = "Keep Link" +On = "On" +Off = "Off" + + +; Auto Generated 20180205_163610.791 + diff --git a/src/bin/hamcore/DriverPackages/Neo6_Win8/x64/Neo6_x64_VPN89.inf b/src/bin/hamcore/DriverPackages/Neo6_Win8/x64/Neo6_x64_VPN89.inf index 324048f1..b30e65fa 100644 --- a/src/bin/hamcore/DriverPackages/Neo6_Win8/x64/Neo6_x64_VPN89.inf +++ b/src/bin/hamcore/DriverPackages/Neo6_Win8/x64/Neo6_x64_VPN89.inf @@ -1,114 +1,114 @@ -; VPN Client Device Driver for Windows 2000 and Greater -; -; Copyright (c) SoftEther Corporation. All Rights Reserved. -; http://www.softether.co.jp/ -; -; BUILD 9658 - -[Version] -Signature = "$Windows NT$" -Class = Net -ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} -Provider = %CompanyName% -DriverVer = 02/04/2018, 4.25.0.9658 -CatalogFile.NT = inf_VPN89.cat - -[Manufacturer] -%CompanyName% = SoftEther, NTamd64 - -[SourceDisksNames] -1=%DiskDescription%, "", , - -[SourceDisksFiles] -Neo_VPN89.sys = 1 - -[DestinationDirs] -DefaultDestDir = 12 -Neo.CopyFiles.Sys = 12 - -[Neo.CopyFiles.Sys] -Neo_VPN89.sys, , , 2 - -[SoftEther.NTamd64] -%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN89 - -[NeoAdapter.Install] -Characteristics = 0x1 -AddReg = Neo.Reg, NeoAdapter.Ndi -CopyFiles = Neo.CopyFiles.Sys -*IfType = 53 -*MediaType = 0 -*PhysicalMediaType = 0 - -[NeoAdapter.Install.Services] -AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% - -[NeoAdapter.Ndi] -HKR, , NetworkAddress, 0, %DefaultAddress% -HKR, Ndi, DeviceID, , "NeoAdapter_VPN89" -HKR, , DevLoader, , ndis -HKR, , DeviceVxDs, , Neo_VPN89.sys -HKR, NDIS, LogDriverName, , "Neo_VPN89" -HKR, NDIS, MajorNdisVersion, 1, 5 -HKR, NDIS, MinorNdisVersion, 1, 0 -HKR, Ndi\Interfaces, DefUpper, , "ndis5" -HKR, Ndi\Interfaces, UpperRange, , "ndis5" -HKR, Ndi\Interfaces, LowerRange, , "ethernet" -HKR, Ndi\Interfaces, DefLower, , "ethernet" -HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" -HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% -HKR, Ndi\Params\NetworkAddress, type, 0, "edit" -HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" -HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" -HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% -HKR, Ndi\Params\NetworkAddress, optional, 0, "0" -HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% -HKR, Ndi\Params\MaxSpeed, type, 0, "int" -HKR, Ndi\Params\MaxSpeed, default, 0, "100" -HKR, Ndi\Params\MaxSpeed, min, 0, "0" -HKR, Ndi\Params\MaxSpeed, max, 0, "2000" -HKR, Ndi\Params\MaxSpeed, step, 0, "1" -HKR, Ndi\Params\MaxSpeed, Base, 0, "10" -HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% -HKR, Ndi\Params\KeepLink, type, 0, "enum" -HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% -HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% -HKR, Ndi\Params\KeepLink, default, 0, "0" - - -[Neo.Service] -DisplayName = %Neo.Service.DispName% -Description = %Neo.Service.Desc% -ServiceType = 1 -StartType = 3 -ErrorControl = 1 -ServiceBinary = %12%\Neo_VPN89.sys -LoadOrderGroup = NDIS - -[Neo.Reg] -HKR, Ndi, Service, 0, Neo.Service.Name -HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" -HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" - -[Neo.EventLog] -HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN89.sys" -HKR, , TypesSupported, 0x00010001, 7 - -[Strings] -CompanyName = "SoftEther Corporation" -DiskDescription = "VPN Client Device Driver Install Disk" -Neo.Service.Name = "Neo_VPN89" -Neo.Service.DispName = "VPN Client Device Driver - VPN89" -Neo.Service.Desc = "VPN Client Adapter - VPN89" -NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN89" -Neo.EventLog.Name = "Neo" -NetworkAddress = "MAC Address" -DefaultAddress = "000001000001" -MaxSpeed = "Indicate Speed (Mbps)" -KeepLink = "Keep Link" -On = "On" -Off = "Off" - - -; Auto Generated 20180205_163610.792 - +; VPN Client Device Driver for Windows 2000 and Greater +; +; Copyright (c) SoftEther Corporation. All Rights Reserved. +; http://www.softether.co.jp/ +; +; BUILD 9658 + +[Version] +Signature = "$Windows NT$" +Class = Net +ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} +Provider = %CompanyName% +DriverVer = 02/04/2018, 4.25.0.9658 +CatalogFile.NT = inf_VPN89.cat + +[Manufacturer] +%CompanyName% = SoftEther, NTamd64 + +[SourceDisksNames] +1=%DiskDescription%, "", , + +[SourceDisksFiles] +Neo_VPN89.sys = 1 + +[DestinationDirs] +DefaultDestDir = 12 +Neo.CopyFiles.Sys = 12 + +[Neo.CopyFiles.Sys] +Neo_VPN89.sys, , , 2 + +[SoftEther.NTamd64] +%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN89 + +[NeoAdapter.Install] +Characteristics = 0x1 +AddReg = Neo.Reg, NeoAdapter.Ndi +CopyFiles = Neo.CopyFiles.Sys +*IfType = 53 +*MediaType = 0 +*PhysicalMediaType = 0 + +[NeoAdapter.Install.Services] +AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% + +[NeoAdapter.Ndi] +HKR, , NetworkAddress, 0, %DefaultAddress% +HKR, Ndi, DeviceID, , "NeoAdapter_VPN89" +HKR, , DevLoader, , ndis +HKR, , DeviceVxDs, , Neo_VPN89.sys +HKR, NDIS, LogDriverName, , "Neo_VPN89" +HKR, NDIS, MajorNdisVersion, 1, 5 +HKR, NDIS, MinorNdisVersion, 1, 0 +HKR, Ndi\Interfaces, DefUpper, , "ndis5" +HKR, Ndi\Interfaces, UpperRange, , "ndis5" +HKR, Ndi\Interfaces, LowerRange, , "ethernet" +HKR, Ndi\Interfaces, DefLower, , "ethernet" +HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" +HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% +HKR, Ndi\Params\NetworkAddress, type, 0, "edit" +HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" +HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" +HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% +HKR, Ndi\Params\NetworkAddress, optional, 0, "0" +HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% +HKR, Ndi\Params\MaxSpeed, type, 0, "int" +HKR, Ndi\Params\MaxSpeed, default, 0, "100" +HKR, Ndi\Params\MaxSpeed, min, 0, "0" +HKR, Ndi\Params\MaxSpeed, max, 0, "2000" +HKR, Ndi\Params\MaxSpeed, step, 0, "1" +HKR, Ndi\Params\MaxSpeed, Base, 0, "10" +HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% +HKR, Ndi\Params\KeepLink, type, 0, "enum" +HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% +HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% +HKR, Ndi\Params\KeepLink, default, 0, "0" + + +[Neo.Service] +DisplayName = %Neo.Service.DispName% +Description = %Neo.Service.Desc% +ServiceType = 1 +StartType = 3 +ErrorControl = 1 +ServiceBinary = %12%\Neo_VPN89.sys +LoadOrderGroup = NDIS + +[Neo.Reg] +HKR, Ndi, Service, 0, Neo.Service.Name +HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" +HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" + +[Neo.EventLog] +HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN89.sys" +HKR, , TypesSupported, 0x00010001, 7 + +[Strings] +CompanyName = "SoftEther Corporation" +DiskDescription = "VPN Client Device Driver Install Disk" +Neo.Service.Name = "Neo_VPN89" +Neo.Service.DispName = "VPN Client Device Driver - VPN89" +Neo.Service.Desc = "VPN Client Adapter - VPN89" +NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN89" +Neo.EventLog.Name = "Neo" +NetworkAddress = "MAC Address" +DefaultAddress = "000001000001" +MaxSpeed = "Indicate Speed (Mbps)" +KeepLink = "Keep Link" +On = "On" +Off = "Off" + + +; Auto Generated 20180205_163610.792 + diff --git a/src/bin/hamcore/DriverPackages/Neo6_Win8/x64/Neo6_x64_VPN9.inf b/src/bin/hamcore/DriverPackages/Neo6_Win8/x64/Neo6_x64_VPN9.inf index 8a0434c2..0e36a069 100644 --- a/src/bin/hamcore/DriverPackages/Neo6_Win8/x64/Neo6_x64_VPN9.inf +++ b/src/bin/hamcore/DriverPackages/Neo6_Win8/x64/Neo6_x64_VPN9.inf @@ -1,114 +1,114 @@ -; VPN Client Device Driver for Windows 2000 and Greater -; -; Copyright (c) SoftEther Corporation. All Rights Reserved. -; http://www.softether.co.jp/ -; -; BUILD 9658 - -[Version] -Signature = "$Windows NT$" -Class = Net -ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} -Provider = %CompanyName% -DriverVer = 02/04/2018, 4.25.0.9658 -CatalogFile.NT = inf_VPN9.cat - -[Manufacturer] -%CompanyName% = SoftEther, NTamd64 - -[SourceDisksNames] -1=%DiskDescription%, "", , - -[SourceDisksFiles] -Neo_VPN9.sys = 1 - -[DestinationDirs] -DefaultDestDir = 12 -Neo.CopyFiles.Sys = 12 - -[Neo.CopyFiles.Sys] -Neo_VPN9.sys, , , 2 - -[SoftEther.NTamd64] -%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN9 - -[NeoAdapter.Install] -Characteristics = 0x1 -AddReg = Neo.Reg, NeoAdapter.Ndi -CopyFiles = Neo.CopyFiles.Sys -*IfType = 53 -*MediaType = 0 -*PhysicalMediaType = 0 - -[NeoAdapter.Install.Services] -AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% - -[NeoAdapter.Ndi] -HKR, , NetworkAddress, 0, %DefaultAddress% -HKR, Ndi, DeviceID, , "NeoAdapter_VPN9" -HKR, , DevLoader, , ndis -HKR, , DeviceVxDs, , Neo_VPN9.sys -HKR, NDIS, LogDriverName, , "Neo_VPN9" -HKR, NDIS, MajorNdisVersion, 1, 5 -HKR, NDIS, MinorNdisVersion, 1, 0 -HKR, Ndi\Interfaces, DefUpper, , "ndis5" -HKR, Ndi\Interfaces, UpperRange, , "ndis5" -HKR, Ndi\Interfaces, LowerRange, , "ethernet" -HKR, Ndi\Interfaces, DefLower, , "ethernet" -HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" -HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% -HKR, Ndi\Params\NetworkAddress, type, 0, "edit" -HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" -HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" -HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% -HKR, Ndi\Params\NetworkAddress, optional, 0, "0" -HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% -HKR, Ndi\Params\MaxSpeed, type, 0, "int" -HKR, Ndi\Params\MaxSpeed, default, 0, "100" -HKR, Ndi\Params\MaxSpeed, min, 0, "0" -HKR, Ndi\Params\MaxSpeed, max, 0, "2000" -HKR, Ndi\Params\MaxSpeed, step, 0, "1" -HKR, Ndi\Params\MaxSpeed, Base, 0, "10" -HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% -HKR, Ndi\Params\KeepLink, type, 0, "enum" -HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% -HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% -HKR, Ndi\Params\KeepLink, default, 0, "0" - - -[Neo.Service] -DisplayName = %Neo.Service.DispName% -Description = %Neo.Service.Desc% -ServiceType = 1 -StartType = 3 -ErrorControl = 1 -ServiceBinary = %12%\Neo_VPN9.sys -LoadOrderGroup = NDIS - -[Neo.Reg] -HKR, Ndi, Service, 0, Neo.Service.Name -HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" -HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" - -[Neo.EventLog] -HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN9.sys" -HKR, , TypesSupported, 0x00010001, 7 - -[Strings] -CompanyName = "SoftEther Corporation" -DiskDescription = "VPN Client Device Driver Install Disk" -Neo.Service.Name = "Neo_VPN9" -Neo.Service.DispName = "VPN Client Device Driver - VPN9" -Neo.Service.Desc = "VPN Client Adapter - VPN9" -NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN9" -Neo.EventLog.Name = "Neo" -NetworkAddress = "MAC Address" -DefaultAddress = "000001000001" -MaxSpeed = "Indicate Speed (Mbps)" -KeepLink = "Keep Link" -On = "On" -Off = "Off" - - -; Auto Generated 20180205_163610.742 - +; VPN Client Device Driver for Windows 2000 and Greater +; +; Copyright (c) SoftEther Corporation. All Rights Reserved. +; http://www.softether.co.jp/ +; +; BUILD 9658 + +[Version] +Signature = "$Windows NT$" +Class = Net +ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} +Provider = %CompanyName% +DriverVer = 02/04/2018, 4.25.0.9658 +CatalogFile.NT = inf_VPN9.cat + +[Manufacturer] +%CompanyName% = SoftEther, NTamd64 + +[SourceDisksNames] +1=%DiskDescription%, "", , + +[SourceDisksFiles] +Neo_VPN9.sys = 1 + +[DestinationDirs] +DefaultDestDir = 12 +Neo.CopyFiles.Sys = 12 + +[Neo.CopyFiles.Sys] +Neo_VPN9.sys, , , 2 + +[SoftEther.NTamd64] +%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN9 + +[NeoAdapter.Install] +Characteristics = 0x1 +AddReg = Neo.Reg, NeoAdapter.Ndi +CopyFiles = Neo.CopyFiles.Sys +*IfType = 53 +*MediaType = 0 +*PhysicalMediaType = 0 + +[NeoAdapter.Install.Services] +AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% + +[NeoAdapter.Ndi] +HKR, , NetworkAddress, 0, %DefaultAddress% +HKR, Ndi, DeviceID, , "NeoAdapter_VPN9" +HKR, , DevLoader, , ndis +HKR, , DeviceVxDs, , Neo_VPN9.sys +HKR, NDIS, LogDriverName, , "Neo_VPN9" +HKR, NDIS, MajorNdisVersion, 1, 5 +HKR, NDIS, MinorNdisVersion, 1, 0 +HKR, Ndi\Interfaces, DefUpper, , "ndis5" +HKR, Ndi\Interfaces, UpperRange, , "ndis5" +HKR, Ndi\Interfaces, LowerRange, , "ethernet" +HKR, Ndi\Interfaces, DefLower, , "ethernet" +HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" +HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% +HKR, Ndi\Params\NetworkAddress, type, 0, "edit" +HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" +HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" +HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% +HKR, Ndi\Params\NetworkAddress, optional, 0, "0" +HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% +HKR, Ndi\Params\MaxSpeed, type, 0, "int" +HKR, Ndi\Params\MaxSpeed, default, 0, "100" +HKR, Ndi\Params\MaxSpeed, min, 0, "0" +HKR, Ndi\Params\MaxSpeed, max, 0, "2000" +HKR, Ndi\Params\MaxSpeed, step, 0, "1" +HKR, Ndi\Params\MaxSpeed, Base, 0, "10" +HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% +HKR, Ndi\Params\KeepLink, type, 0, "enum" +HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% +HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% +HKR, Ndi\Params\KeepLink, default, 0, "0" + + +[Neo.Service] +DisplayName = %Neo.Service.DispName% +Description = %Neo.Service.Desc% +ServiceType = 1 +StartType = 3 +ErrorControl = 1 +ServiceBinary = %12%\Neo_VPN9.sys +LoadOrderGroup = NDIS + +[Neo.Reg] +HKR, Ndi, Service, 0, Neo.Service.Name +HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" +HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" + +[Neo.EventLog] +HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN9.sys" +HKR, , TypesSupported, 0x00010001, 7 + +[Strings] +CompanyName = "SoftEther Corporation" +DiskDescription = "VPN Client Device Driver Install Disk" +Neo.Service.Name = "Neo_VPN9" +Neo.Service.DispName = "VPN Client Device Driver - VPN9" +Neo.Service.Desc = "VPN Client Adapter - VPN9" +NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN9" +Neo.EventLog.Name = "Neo" +NetworkAddress = "MAC Address" +DefaultAddress = "000001000001" +MaxSpeed = "Indicate Speed (Mbps)" +KeepLink = "Keep Link" +On = "On" +Off = "Off" + + +; Auto Generated 20180205_163610.742 + diff --git a/src/bin/hamcore/DriverPackages/Neo6_Win8/x64/Neo6_x64_VPN90.inf b/src/bin/hamcore/DriverPackages/Neo6_Win8/x64/Neo6_x64_VPN90.inf index 61ec2804..580a6460 100644 --- a/src/bin/hamcore/DriverPackages/Neo6_Win8/x64/Neo6_x64_VPN90.inf +++ b/src/bin/hamcore/DriverPackages/Neo6_Win8/x64/Neo6_x64_VPN90.inf @@ -1,114 +1,114 @@ -; VPN Client Device Driver for Windows 2000 and Greater -; -; Copyright (c) SoftEther Corporation. All Rights Reserved. -; http://www.softether.co.jp/ -; -; BUILD 9658 - -[Version] -Signature = "$Windows NT$" -Class = Net -ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} -Provider = %CompanyName% -DriverVer = 02/04/2018, 4.25.0.9658 -CatalogFile.NT = inf_VPN90.cat - -[Manufacturer] -%CompanyName% = SoftEther, NTamd64 - -[SourceDisksNames] -1=%DiskDescription%, "", , - -[SourceDisksFiles] -Neo_VPN90.sys = 1 - -[DestinationDirs] -DefaultDestDir = 12 -Neo.CopyFiles.Sys = 12 - -[Neo.CopyFiles.Sys] -Neo_VPN90.sys, , , 2 - -[SoftEther.NTamd64] -%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN90 - -[NeoAdapter.Install] -Characteristics = 0x1 -AddReg = Neo.Reg, NeoAdapter.Ndi -CopyFiles = Neo.CopyFiles.Sys -*IfType = 53 -*MediaType = 0 -*PhysicalMediaType = 0 - -[NeoAdapter.Install.Services] -AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% - -[NeoAdapter.Ndi] -HKR, , NetworkAddress, 0, %DefaultAddress% -HKR, Ndi, DeviceID, , "NeoAdapter_VPN90" -HKR, , DevLoader, , ndis -HKR, , DeviceVxDs, , Neo_VPN90.sys -HKR, NDIS, LogDriverName, , "Neo_VPN90" -HKR, NDIS, MajorNdisVersion, 1, 5 -HKR, NDIS, MinorNdisVersion, 1, 0 -HKR, Ndi\Interfaces, DefUpper, , "ndis5" -HKR, Ndi\Interfaces, UpperRange, , "ndis5" -HKR, Ndi\Interfaces, LowerRange, , "ethernet" -HKR, Ndi\Interfaces, DefLower, , "ethernet" -HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" -HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% -HKR, Ndi\Params\NetworkAddress, type, 0, "edit" -HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" -HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" -HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% -HKR, Ndi\Params\NetworkAddress, optional, 0, "0" -HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% -HKR, Ndi\Params\MaxSpeed, type, 0, "int" -HKR, Ndi\Params\MaxSpeed, default, 0, "100" -HKR, Ndi\Params\MaxSpeed, min, 0, "0" -HKR, Ndi\Params\MaxSpeed, max, 0, "2000" -HKR, Ndi\Params\MaxSpeed, step, 0, "1" -HKR, Ndi\Params\MaxSpeed, Base, 0, "10" -HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% -HKR, Ndi\Params\KeepLink, type, 0, "enum" -HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% -HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% -HKR, Ndi\Params\KeepLink, default, 0, "0" - - -[Neo.Service] -DisplayName = %Neo.Service.DispName% -Description = %Neo.Service.Desc% -ServiceType = 1 -StartType = 3 -ErrorControl = 1 -ServiceBinary = %12%\Neo_VPN90.sys -LoadOrderGroup = NDIS - -[Neo.Reg] -HKR, Ndi, Service, 0, Neo.Service.Name -HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" -HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" - -[Neo.EventLog] -HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN90.sys" -HKR, , TypesSupported, 0x00010001, 7 - -[Strings] -CompanyName = "SoftEther Corporation" -DiskDescription = "VPN Client Device Driver Install Disk" -Neo.Service.Name = "Neo_VPN90" -Neo.Service.DispName = "VPN Client Device Driver - VPN90" -Neo.Service.Desc = "VPN Client Adapter - VPN90" -NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN90" -Neo.EventLog.Name = "Neo" -NetworkAddress = "MAC Address" -DefaultAddress = "000001000001" -MaxSpeed = "Indicate Speed (Mbps)" -KeepLink = "Keep Link" -On = "On" -Off = "Off" - - -; Auto Generated 20180205_163610.792 - +; VPN Client Device Driver for Windows 2000 and Greater +; +; Copyright (c) SoftEther Corporation. All Rights Reserved. +; http://www.softether.co.jp/ +; +; BUILD 9658 + +[Version] +Signature = "$Windows NT$" +Class = Net +ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} +Provider = %CompanyName% +DriverVer = 02/04/2018, 4.25.0.9658 +CatalogFile.NT = inf_VPN90.cat + +[Manufacturer] +%CompanyName% = SoftEther, NTamd64 + +[SourceDisksNames] +1=%DiskDescription%, "", , + +[SourceDisksFiles] +Neo_VPN90.sys = 1 + +[DestinationDirs] +DefaultDestDir = 12 +Neo.CopyFiles.Sys = 12 + +[Neo.CopyFiles.Sys] +Neo_VPN90.sys, , , 2 + +[SoftEther.NTamd64] +%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN90 + +[NeoAdapter.Install] +Characteristics = 0x1 +AddReg = Neo.Reg, NeoAdapter.Ndi +CopyFiles = Neo.CopyFiles.Sys +*IfType = 53 +*MediaType = 0 +*PhysicalMediaType = 0 + +[NeoAdapter.Install.Services] +AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% + +[NeoAdapter.Ndi] +HKR, , NetworkAddress, 0, %DefaultAddress% +HKR, Ndi, DeviceID, , "NeoAdapter_VPN90" +HKR, , DevLoader, , ndis +HKR, , DeviceVxDs, , Neo_VPN90.sys +HKR, NDIS, LogDriverName, , "Neo_VPN90" +HKR, NDIS, MajorNdisVersion, 1, 5 +HKR, NDIS, MinorNdisVersion, 1, 0 +HKR, Ndi\Interfaces, DefUpper, , "ndis5" +HKR, Ndi\Interfaces, UpperRange, , "ndis5" +HKR, Ndi\Interfaces, LowerRange, , "ethernet" +HKR, Ndi\Interfaces, DefLower, , "ethernet" +HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" +HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% +HKR, Ndi\Params\NetworkAddress, type, 0, "edit" +HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" +HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" +HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% +HKR, Ndi\Params\NetworkAddress, optional, 0, "0" +HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% +HKR, Ndi\Params\MaxSpeed, type, 0, "int" +HKR, Ndi\Params\MaxSpeed, default, 0, "100" +HKR, Ndi\Params\MaxSpeed, min, 0, "0" +HKR, Ndi\Params\MaxSpeed, max, 0, "2000" +HKR, Ndi\Params\MaxSpeed, step, 0, "1" +HKR, Ndi\Params\MaxSpeed, Base, 0, "10" +HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% +HKR, Ndi\Params\KeepLink, type, 0, "enum" +HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% +HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% +HKR, Ndi\Params\KeepLink, default, 0, "0" + + +[Neo.Service] +DisplayName = %Neo.Service.DispName% +Description = %Neo.Service.Desc% +ServiceType = 1 +StartType = 3 +ErrorControl = 1 +ServiceBinary = %12%\Neo_VPN90.sys +LoadOrderGroup = NDIS + +[Neo.Reg] +HKR, Ndi, Service, 0, Neo.Service.Name +HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" +HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" + +[Neo.EventLog] +HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN90.sys" +HKR, , TypesSupported, 0x00010001, 7 + +[Strings] +CompanyName = "SoftEther Corporation" +DiskDescription = "VPN Client Device Driver Install Disk" +Neo.Service.Name = "Neo_VPN90" +Neo.Service.DispName = "VPN Client Device Driver - VPN90" +Neo.Service.Desc = "VPN Client Adapter - VPN90" +NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN90" +Neo.EventLog.Name = "Neo" +NetworkAddress = "MAC Address" +DefaultAddress = "000001000001" +MaxSpeed = "Indicate Speed (Mbps)" +KeepLink = "Keep Link" +On = "On" +Off = "Off" + + +; Auto Generated 20180205_163610.792 + diff --git a/src/bin/hamcore/DriverPackages/Neo6_Win8/x64/Neo6_x64_VPN91.inf b/src/bin/hamcore/DriverPackages/Neo6_Win8/x64/Neo6_x64_VPN91.inf index f625751e..0e0ca0d9 100644 --- a/src/bin/hamcore/DriverPackages/Neo6_Win8/x64/Neo6_x64_VPN91.inf +++ b/src/bin/hamcore/DriverPackages/Neo6_Win8/x64/Neo6_x64_VPN91.inf @@ -1,114 +1,114 @@ -; VPN Client Device Driver for Windows 2000 and Greater -; -; Copyright (c) SoftEther Corporation. All Rights Reserved. -; http://www.softether.co.jp/ -; -; BUILD 9658 - -[Version] -Signature = "$Windows NT$" -Class = Net -ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} -Provider = %CompanyName% -DriverVer = 02/04/2018, 4.25.0.9658 -CatalogFile.NT = inf_VPN91.cat - -[Manufacturer] -%CompanyName% = SoftEther, NTamd64 - -[SourceDisksNames] -1=%DiskDescription%, "", , - -[SourceDisksFiles] -Neo_VPN91.sys = 1 - -[DestinationDirs] -DefaultDestDir = 12 -Neo.CopyFiles.Sys = 12 - -[Neo.CopyFiles.Sys] -Neo_VPN91.sys, , , 2 - -[SoftEther.NTamd64] -%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN91 - -[NeoAdapter.Install] -Characteristics = 0x1 -AddReg = Neo.Reg, NeoAdapter.Ndi -CopyFiles = Neo.CopyFiles.Sys -*IfType = 53 -*MediaType = 0 -*PhysicalMediaType = 0 - -[NeoAdapter.Install.Services] -AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% - -[NeoAdapter.Ndi] -HKR, , NetworkAddress, 0, %DefaultAddress% -HKR, Ndi, DeviceID, , "NeoAdapter_VPN91" -HKR, , DevLoader, , ndis -HKR, , DeviceVxDs, , Neo_VPN91.sys -HKR, NDIS, LogDriverName, , "Neo_VPN91" -HKR, NDIS, MajorNdisVersion, 1, 5 -HKR, NDIS, MinorNdisVersion, 1, 0 -HKR, Ndi\Interfaces, DefUpper, , "ndis5" -HKR, Ndi\Interfaces, UpperRange, , "ndis5" -HKR, Ndi\Interfaces, LowerRange, , "ethernet" -HKR, Ndi\Interfaces, DefLower, , "ethernet" -HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" -HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% -HKR, Ndi\Params\NetworkAddress, type, 0, "edit" -HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" -HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" -HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% -HKR, Ndi\Params\NetworkAddress, optional, 0, "0" -HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% -HKR, Ndi\Params\MaxSpeed, type, 0, "int" -HKR, Ndi\Params\MaxSpeed, default, 0, "100" -HKR, Ndi\Params\MaxSpeed, min, 0, "0" -HKR, Ndi\Params\MaxSpeed, max, 0, "2000" -HKR, Ndi\Params\MaxSpeed, step, 0, "1" -HKR, Ndi\Params\MaxSpeed, Base, 0, "10" -HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% -HKR, Ndi\Params\KeepLink, type, 0, "enum" -HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% -HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% -HKR, Ndi\Params\KeepLink, default, 0, "0" - - -[Neo.Service] -DisplayName = %Neo.Service.DispName% -Description = %Neo.Service.Desc% -ServiceType = 1 -StartType = 3 -ErrorControl = 1 -ServiceBinary = %12%\Neo_VPN91.sys -LoadOrderGroup = NDIS - -[Neo.Reg] -HKR, Ndi, Service, 0, Neo.Service.Name -HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" -HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" - -[Neo.EventLog] -HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN91.sys" -HKR, , TypesSupported, 0x00010001, 7 - -[Strings] -CompanyName = "SoftEther Corporation" -DiskDescription = "VPN Client Device Driver Install Disk" -Neo.Service.Name = "Neo_VPN91" -Neo.Service.DispName = "VPN Client Device Driver - VPN91" -Neo.Service.Desc = "VPN Client Adapter - VPN91" -NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN91" -Neo.EventLog.Name = "Neo" -NetworkAddress = "MAC Address" -DefaultAddress = "000001000001" -MaxSpeed = "Indicate Speed (Mbps)" -KeepLink = "Keep Link" -On = "On" -Off = "Off" - - -; Auto Generated 20180205_163610.793 - +; VPN Client Device Driver for Windows 2000 and Greater +; +; Copyright (c) SoftEther Corporation. All Rights Reserved. +; http://www.softether.co.jp/ +; +; BUILD 9658 + +[Version] +Signature = "$Windows NT$" +Class = Net +ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} +Provider = %CompanyName% +DriverVer = 02/04/2018, 4.25.0.9658 +CatalogFile.NT = inf_VPN91.cat + +[Manufacturer] +%CompanyName% = SoftEther, NTamd64 + +[SourceDisksNames] +1=%DiskDescription%, "", , + +[SourceDisksFiles] +Neo_VPN91.sys = 1 + +[DestinationDirs] +DefaultDestDir = 12 +Neo.CopyFiles.Sys = 12 + +[Neo.CopyFiles.Sys] +Neo_VPN91.sys, , , 2 + +[SoftEther.NTamd64] +%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN91 + +[NeoAdapter.Install] +Characteristics = 0x1 +AddReg = Neo.Reg, NeoAdapter.Ndi +CopyFiles = Neo.CopyFiles.Sys +*IfType = 53 +*MediaType = 0 +*PhysicalMediaType = 0 + +[NeoAdapter.Install.Services] +AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% + +[NeoAdapter.Ndi] +HKR, , NetworkAddress, 0, %DefaultAddress% +HKR, Ndi, DeviceID, , "NeoAdapter_VPN91" +HKR, , DevLoader, , ndis +HKR, , DeviceVxDs, , Neo_VPN91.sys +HKR, NDIS, LogDriverName, , "Neo_VPN91" +HKR, NDIS, MajorNdisVersion, 1, 5 +HKR, NDIS, MinorNdisVersion, 1, 0 +HKR, Ndi\Interfaces, DefUpper, , "ndis5" +HKR, Ndi\Interfaces, UpperRange, , "ndis5" +HKR, Ndi\Interfaces, LowerRange, , "ethernet" +HKR, Ndi\Interfaces, DefLower, , "ethernet" +HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" +HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% +HKR, Ndi\Params\NetworkAddress, type, 0, "edit" +HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" +HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" +HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% +HKR, Ndi\Params\NetworkAddress, optional, 0, "0" +HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% +HKR, Ndi\Params\MaxSpeed, type, 0, "int" +HKR, Ndi\Params\MaxSpeed, default, 0, "100" +HKR, Ndi\Params\MaxSpeed, min, 0, "0" +HKR, Ndi\Params\MaxSpeed, max, 0, "2000" +HKR, Ndi\Params\MaxSpeed, step, 0, "1" +HKR, Ndi\Params\MaxSpeed, Base, 0, "10" +HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% +HKR, Ndi\Params\KeepLink, type, 0, "enum" +HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% +HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% +HKR, Ndi\Params\KeepLink, default, 0, "0" + + +[Neo.Service] +DisplayName = %Neo.Service.DispName% +Description = %Neo.Service.Desc% +ServiceType = 1 +StartType = 3 +ErrorControl = 1 +ServiceBinary = %12%\Neo_VPN91.sys +LoadOrderGroup = NDIS + +[Neo.Reg] +HKR, Ndi, Service, 0, Neo.Service.Name +HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" +HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" + +[Neo.EventLog] +HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN91.sys" +HKR, , TypesSupported, 0x00010001, 7 + +[Strings] +CompanyName = "SoftEther Corporation" +DiskDescription = "VPN Client Device Driver Install Disk" +Neo.Service.Name = "Neo_VPN91" +Neo.Service.DispName = "VPN Client Device Driver - VPN91" +Neo.Service.Desc = "VPN Client Adapter - VPN91" +NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN91" +Neo.EventLog.Name = "Neo" +NetworkAddress = "MAC Address" +DefaultAddress = "000001000001" +MaxSpeed = "Indicate Speed (Mbps)" +KeepLink = "Keep Link" +On = "On" +Off = "Off" + + +; Auto Generated 20180205_163610.793 + diff --git a/src/bin/hamcore/DriverPackages/Neo6_Win8/x64/Neo6_x64_VPN92.inf b/src/bin/hamcore/DriverPackages/Neo6_Win8/x64/Neo6_x64_VPN92.inf index ef1d4bd0..07392082 100644 --- a/src/bin/hamcore/DriverPackages/Neo6_Win8/x64/Neo6_x64_VPN92.inf +++ b/src/bin/hamcore/DriverPackages/Neo6_Win8/x64/Neo6_x64_VPN92.inf @@ -1,114 +1,114 @@ -; VPN Client Device Driver for Windows 2000 and Greater -; -; Copyright (c) SoftEther Corporation. All Rights Reserved. -; http://www.softether.co.jp/ -; -; BUILD 9658 - -[Version] -Signature = "$Windows NT$" -Class = Net -ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} -Provider = %CompanyName% -DriverVer = 02/04/2018, 4.25.0.9658 -CatalogFile.NT = inf_VPN92.cat - -[Manufacturer] -%CompanyName% = SoftEther, NTamd64 - -[SourceDisksNames] -1=%DiskDescription%, "", , - -[SourceDisksFiles] -Neo_VPN92.sys = 1 - -[DestinationDirs] -DefaultDestDir = 12 -Neo.CopyFiles.Sys = 12 - -[Neo.CopyFiles.Sys] -Neo_VPN92.sys, , , 2 - -[SoftEther.NTamd64] -%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN92 - -[NeoAdapter.Install] -Characteristics = 0x1 -AddReg = Neo.Reg, NeoAdapter.Ndi -CopyFiles = Neo.CopyFiles.Sys -*IfType = 53 -*MediaType = 0 -*PhysicalMediaType = 0 - -[NeoAdapter.Install.Services] -AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% - -[NeoAdapter.Ndi] -HKR, , NetworkAddress, 0, %DefaultAddress% -HKR, Ndi, DeviceID, , "NeoAdapter_VPN92" -HKR, , DevLoader, , ndis -HKR, , DeviceVxDs, , Neo_VPN92.sys -HKR, NDIS, LogDriverName, , "Neo_VPN92" -HKR, NDIS, MajorNdisVersion, 1, 5 -HKR, NDIS, MinorNdisVersion, 1, 0 -HKR, Ndi\Interfaces, DefUpper, , "ndis5" -HKR, Ndi\Interfaces, UpperRange, , "ndis5" -HKR, Ndi\Interfaces, LowerRange, , "ethernet" -HKR, Ndi\Interfaces, DefLower, , "ethernet" -HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" -HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% -HKR, Ndi\Params\NetworkAddress, type, 0, "edit" -HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" -HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" -HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% -HKR, Ndi\Params\NetworkAddress, optional, 0, "0" -HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% -HKR, Ndi\Params\MaxSpeed, type, 0, "int" -HKR, Ndi\Params\MaxSpeed, default, 0, "100" -HKR, Ndi\Params\MaxSpeed, min, 0, "0" -HKR, Ndi\Params\MaxSpeed, max, 0, "2000" -HKR, Ndi\Params\MaxSpeed, step, 0, "1" -HKR, Ndi\Params\MaxSpeed, Base, 0, "10" -HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% -HKR, Ndi\Params\KeepLink, type, 0, "enum" -HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% -HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% -HKR, Ndi\Params\KeepLink, default, 0, "0" - - -[Neo.Service] -DisplayName = %Neo.Service.DispName% -Description = %Neo.Service.Desc% -ServiceType = 1 -StartType = 3 -ErrorControl = 1 -ServiceBinary = %12%\Neo_VPN92.sys -LoadOrderGroup = NDIS - -[Neo.Reg] -HKR, Ndi, Service, 0, Neo.Service.Name -HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" -HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" - -[Neo.EventLog] -HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN92.sys" -HKR, , TypesSupported, 0x00010001, 7 - -[Strings] -CompanyName = "SoftEther Corporation" -DiskDescription = "VPN Client Device Driver Install Disk" -Neo.Service.Name = "Neo_VPN92" -Neo.Service.DispName = "VPN Client Device Driver - VPN92" -Neo.Service.Desc = "VPN Client Adapter - VPN92" -NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN92" -Neo.EventLog.Name = "Neo" -NetworkAddress = "MAC Address" -DefaultAddress = "000001000001" -MaxSpeed = "Indicate Speed (Mbps)" -KeepLink = "Keep Link" -On = "On" -Off = "Off" - - -; Auto Generated 20180205_163610.794 - +; VPN Client Device Driver for Windows 2000 and Greater +; +; Copyright (c) SoftEther Corporation. All Rights Reserved. +; http://www.softether.co.jp/ +; +; BUILD 9658 + +[Version] +Signature = "$Windows NT$" +Class = Net +ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} +Provider = %CompanyName% +DriverVer = 02/04/2018, 4.25.0.9658 +CatalogFile.NT = inf_VPN92.cat + +[Manufacturer] +%CompanyName% = SoftEther, NTamd64 + +[SourceDisksNames] +1=%DiskDescription%, "", , + +[SourceDisksFiles] +Neo_VPN92.sys = 1 + +[DestinationDirs] +DefaultDestDir = 12 +Neo.CopyFiles.Sys = 12 + +[Neo.CopyFiles.Sys] +Neo_VPN92.sys, , , 2 + +[SoftEther.NTamd64] +%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN92 + +[NeoAdapter.Install] +Characteristics = 0x1 +AddReg = Neo.Reg, NeoAdapter.Ndi +CopyFiles = Neo.CopyFiles.Sys +*IfType = 53 +*MediaType = 0 +*PhysicalMediaType = 0 + +[NeoAdapter.Install.Services] +AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% + +[NeoAdapter.Ndi] +HKR, , NetworkAddress, 0, %DefaultAddress% +HKR, Ndi, DeviceID, , "NeoAdapter_VPN92" +HKR, , DevLoader, , ndis +HKR, , DeviceVxDs, , Neo_VPN92.sys +HKR, NDIS, LogDriverName, , "Neo_VPN92" +HKR, NDIS, MajorNdisVersion, 1, 5 +HKR, NDIS, MinorNdisVersion, 1, 0 +HKR, Ndi\Interfaces, DefUpper, , "ndis5" +HKR, Ndi\Interfaces, UpperRange, , "ndis5" +HKR, Ndi\Interfaces, LowerRange, , "ethernet" +HKR, Ndi\Interfaces, DefLower, , "ethernet" +HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" +HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% +HKR, Ndi\Params\NetworkAddress, type, 0, "edit" +HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" +HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" +HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% +HKR, Ndi\Params\NetworkAddress, optional, 0, "0" +HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% +HKR, Ndi\Params\MaxSpeed, type, 0, "int" +HKR, Ndi\Params\MaxSpeed, default, 0, "100" +HKR, Ndi\Params\MaxSpeed, min, 0, "0" +HKR, Ndi\Params\MaxSpeed, max, 0, "2000" +HKR, Ndi\Params\MaxSpeed, step, 0, "1" +HKR, Ndi\Params\MaxSpeed, Base, 0, "10" +HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% +HKR, Ndi\Params\KeepLink, type, 0, "enum" +HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% +HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% +HKR, Ndi\Params\KeepLink, default, 0, "0" + + +[Neo.Service] +DisplayName = %Neo.Service.DispName% +Description = %Neo.Service.Desc% +ServiceType = 1 +StartType = 3 +ErrorControl = 1 +ServiceBinary = %12%\Neo_VPN92.sys +LoadOrderGroup = NDIS + +[Neo.Reg] +HKR, Ndi, Service, 0, Neo.Service.Name +HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" +HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" + +[Neo.EventLog] +HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN92.sys" +HKR, , TypesSupported, 0x00010001, 7 + +[Strings] +CompanyName = "SoftEther Corporation" +DiskDescription = "VPN Client Device Driver Install Disk" +Neo.Service.Name = "Neo_VPN92" +Neo.Service.DispName = "VPN Client Device Driver - VPN92" +Neo.Service.Desc = "VPN Client Adapter - VPN92" +NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN92" +Neo.EventLog.Name = "Neo" +NetworkAddress = "MAC Address" +DefaultAddress = "000001000001" +MaxSpeed = "Indicate Speed (Mbps)" +KeepLink = "Keep Link" +On = "On" +Off = "Off" + + +; Auto Generated 20180205_163610.794 + diff --git a/src/bin/hamcore/DriverPackages/Neo6_Win8/x64/Neo6_x64_VPN93.inf b/src/bin/hamcore/DriverPackages/Neo6_Win8/x64/Neo6_x64_VPN93.inf index 7ae42310..782aec6c 100644 --- a/src/bin/hamcore/DriverPackages/Neo6_Win8/x64/Neo6_x64_VPN93.inf +++ b/src/bin/hamcore/DriverPackages/Neo6_Win8/x64/Neo6_x64_VPN93.inf @@ -1,114 +1,114 @@ -; VPN Client Device Driver for Windows 2000 and Greater -; -; Copyright (c) SoftEther Corporation. All Rights Reserved. -; http://www.softether.co.jp/ -; -; BUILD 9658 - -[Version] -Signature = "$Windows NT$" -Class = Net -ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} -Provider = %CompanyName% -DriverVer = 02/04/2018, 4.25.0.9658 -CatalogFile.NT = inf_VPN93.cat - -[Manufacturer] -%CompanyName% = SoftEther, NTamd64 - -[SourceDisksNames] -1=%DiskDescription%, "", , - -[SourceDisksFiles] -Neo_VPN93.sys = 1 - -[DestinationDirs] -DefaultDestDir = 12 -Neo.CopyFiles.Sys = 12 - -[Neo.CopyFiles.Sys] -Neo_VPN93.sys, , , 2 - -[SoftEther.NTamd64] -%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN93 - -[NeoAdapter.Install] -Characteristics = 0x1 -AddReg = Neo.Reg, NeoAdapter.Ndi -CopyFiles = Neo.CopyFiles.Sys -*IfType = 53 -*MediaType = 0 -*PhysicalMediaType = 0 - -[NeoAdapter.Install.Services] -AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% - -[NeoAdapter.Ndi] -HKR, , NetworkAddress, 0, %DefaultAddress% -HKR, Ndi, DeviceID, , "NeoAdapter_VPN93" -HKR, , DevLoader, , ndis -HKR, , DeviceVxDs, , Neo_VPN93.sys -HKR, NDIS, LogDriverName, , "Neo_VPN93" -HKR, NDIS, MajorNdisVersion, 1, 5 -HKR, NDIS, MinorNdisVersion, 1, 0 -HKR, Ndi\Interfaces, DefUpper, , "ndis5" -HKR, Ndi\Interfaces, UpperRange, , "ndis5" -HKR, Ndi\Interfaces, LowerRange, , "ethernet" -HKR, Ndi\Interfaces, DefLower, , "ethernet" -HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" -HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% -HKR, Ndi\Params\NetworkAddress, type, 0, "edit" -HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" -HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" -HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% -HKR, Ndi\Params\NetworkAddress, optional, 0, "0" -HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% -HKR, Ndi\Params\MaxSpeed, type, 0, "int" -HKR, Ndi\Params\MaxSpeed, default, 0, "100" -HKR, Ndi\Params\MaxSpeed, min, 0, "0" -HKR, Ndi\Params\MaxSpeed, max, 0, "2000" -HKR, Ndi\Params\MaxSpeed, step, 0, "1" -HKR, Ndi\Params\MaxSpeed, Base, 0, "10" -HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% -HKR, Ndi\Params\KeepLink, type, 0, "enum" -HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% -HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% -HKR, Ndi\Params\KeepLink, default, 0, "0" - - -[Neo.Service] -DisplayName = %Neo.Service.DispName% -Description = %Neo.Service.Desc% -ServiceType = 1 -StartType = 3 -ErrorControl = 1 -ServiceBinary = %12%\Neo_VPN93.sys -LoadOrderGroup = NDIS - -[Neo.Reg] -HKR, Ndi, Service, 0, Neo.Service.Name -HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" -HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" - -[Neo.EventLog] -HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN93.sys" -HKR, , TypesSupported, 0x00010001, 7 - -[Strings] -CompanyName = "SoftEther Corporation" -DiskDescription = "VPN Client Device Driver Install Disk" -Neo.Service.Name = "Neo_VPN93" -Neo.Service.DispName = "VPN Client Device Driver - VPN93" -Neo.Service.Desc = "VPN Client Adapter - VPN93" -NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN93" -Neo.EventLog.Name = "Neo" -NetworkAddress = "MAC Address" -DefaultAddress = "000001000001" -MaxSpeed = "Indicate Speed (Mbps)" -KeepLink = "Keep Link" -On = "On" -Off = "Off" - - -; Auto Generated 20180205_163610.794 - +; VPN Client Device Driver for Windows 2000 and Greater +; +; Copyright (c) SoftEther Corporation. All Rights Reserved. +; http://www.softether.co.jp/ +; +; BUILD 9658 + +[Version] +Signature = "$Windows NT$" +Class = Net +ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} +Provider = %CompanyName% +DriverVer = 02/04/2018, 4.25.0.9658 +CatalogFile.NT = inf_VPN93.cat + +[Manufacturer] +%CompanyName% = SoftEther, NTamd64 + +[SourceDisksNames] +1=%DiskDescription%, "", , + +[SourceDisksFiles] +Neo_VPN93.sys = 1 + +[DestinationDirs] +DefaultDestDir = 12 +Neo.CopyFiles.Sys = 12 + +[Neo.CopyFiles.Sys] +Neo_VPN93.sys, , , 2 + +[SoftEther.NTamd64] +%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN93 + +[NeoAdapter.Install] +Characteristics = 0x1 +AddReg = Neo.Reg, NeoAdapter.Ndi +CopyFiles = Neo.CopyFiles.Sys +*IfType = 53 +*MediaType = 0 +*PhysicalMediaType = 0 + +[NeoAdapter.Install.Services] +AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% + +[NeoAdapter.Ndi] +HKR, , NetworkAddress, 0, %DefaultAddress% +HKR, Ndi, DeviceID, , "NeoAdapter_VPN93" +HKR, , DevLoader, , ndis +HKR, , DeviceVxDs, , Neo_VPN93.sys +HKR, NDIS, LogDriverName, , "Neo_VPN93" +HKR, NDIS, MajorNdisVersion, 1, 5 +HKR, NDIS, MinorNdisVersion, 1, 0 +HKR, Ndi\Interfaces, DefUpper, , "ndis5" +HKR, Ndi\Interfaces, UpperRange, , "ndis5" +HKR, Ndi\Interfaces, LowerRange, , "ethernet" +HKR, Ndi\Interfaces, DefLower, , "ethernet" +HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" +HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% +HKR, Ndi\Params\NetworkAddress, type, 0, "edit" +HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" +HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" +HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% +HKR, Ndi\Params\NetworkAddress, optional, 0, "0" +HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% +HKR, Ndi\Params\MaxSpeed, type, 0, "int" +HKR, Ndi\Params\MaxSpeed, default, 0, "100" +HKR, Ndi\Params\MaxSpeed, min, 0, "0" +HKR, Ndi\Params\MaxSpeed, max, 0, "2000" +HKR, Ndi\Params\MaxSpeed, step, 0, "1" +HKR, Ndi\Params\MaxSpeed, Base, 0, "10" +HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% +HKR, Ndi\Params\KeepLink, type, 0, "enum" +HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% +HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% +HKR, Ndi\Params\KeepLink, default, 0, "0" + + +[Neo.Service] +DisplayName = %Neo.Service.DispName% +Description = %Neo.Service.Desc% +ServiceType = 1 +StartType = 3 +ErrorControl = 1 +ServiceBinary = %12%\Neo_VPN93.sys +LoadOrderGroup = NDIS + +[Neo.Reg] +HKR, Ndi, Service, 0, Neo.Service.Name +HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" +HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" + +[Neo.EventLog] +HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN93.sys" +HKR, , TypesSupported, 0x00010001, 7 + +[Strings] +CompanyName = "SoftEther Corporation" +DiskDescription = "VPN Client Device Driver Install Disk" +Neo.Service.Name = "Neo_VPN93" +Neo.Service.DispName = "VPN Client Device Driver - VPN93" +Neo.Service.Desc = "VPN Client Adapter - VPN93" +NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN93" +Neo.EventLog.Name = "Neo" +NetworkAddress = "MAC Address" +DefaultAddress = "000001000001" +MaxSpeed = "Indicate Speed (Mbps)" +KeepLink = "Keep Link" +On = "On" +Off = "Off" + + +; Auto Generated 20180205_163610.794 + diff --git a/src/bin/hamcore/DriverPackages/Neo6_Win8/x64/Neo6_x64_VPN94.inf b/src/bin/hamcore/DriverPackages/Neo6_Win8/x64/Neo6_x64_VPN94.inf index 843e2783..3e21d907 100644 --- a/src/bin/hamcore/DriverPackages/Neo6_Win8/x64/Neo6_x64_VPN94.inf +++ b/src/bin/hamcore/DriverPackages/Neo6_Win8/x64/Neo6_x64_VPN94.inf @@ -1,114 +1,114 @@ -; VPN Client Device Driver for Windows 2000 and Greater -; -; Copyright (c) SoftEther Corporation. All Rights Reserved. -; http://www.softether.co.jp/ -; -; BUILD 9658 - -[Version] -Signature = "$Windows NT$" -Class = Net -ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} -Provider = %CompanyName% -DriverVer = 02/04/2018, 4.25.0.9658 -CatalogFile.NT = inf_VPN94.cat - -[Manufacturer] -%CompanyName% = SoftEther, NTamd64 - -[SourceDisksNames] -1=%DiskDescription%, "", , - -[SourceDisksFiles] -Neo_VPN94.sys = 1 - -[DestinationDirs] -DefaultDestDir = 12 -Neo.CopyFiles.Sys = 12 - -[Neo.CopyFiles.Sys] -Neo_VPN94.sys, , , 2 - -[SoftEther.NTamd64] -%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN94 - -[NeoAdapter.Install] -Characteristics = 0x1 -AddReg = Neo.Reg, NeoAdapter.Ndi -CopyFiles = Neo.CopyFiles.Sys -*IfType = 53 -*MediaType = 0 -*PhysicalMediaType = 0 - -[NeoAdapter.Install.Services] -AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% - -[NeoAdapter.Ndi] -HKR, , NetworkAddress, 0, %DefaultAddress% -HKR, Ndi, DeviceID, , "NeoAdapter_VPN94" -HKR, , DevLoader, , ndis -HKR, , DeviceVxDs, , Neo_VPN94.sys -HKR, NDIS, LogDriverName, , "Neo_VPN94" -HKR, NDIS, MajorNdisVersion, 1, 5 -HKR, NDIS, MinorNdisVersion, 1, 0 -HKR, Ndi\Interfaces, DefUpper, , "ndis5" -HKR, Ndi\Interfaces, UpperRange, , "ndis5" -HKR, Ndi\Interfaces, LowerRange, , "ethernet" -HKR, Ndi\Interfaces, DefLower, , "ethernet" -HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" -HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% -HKR, Ndi\Params\NetworkAddress, type, 0, "edit" -HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" -HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" -HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% -HKR, Ndi\Params\NetworkAddress, optional, 0, "0" -HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% -HKR, Ndi\Params\MaxSpeed, type, 0, "int" -HKR, Ndi\Params\MaxSpeed, default, 0, "100" -HKR, Ndi\Params\MaxSpeed, min, 0, "0" -HKR, Ndi\Params\MaxSpeed, max, 0, "2000" -HKR, Ndi\Params\MaxSpeed, step, 0, "1" -HKR, Ndi\Params\MaxSpeed, Base, 0, "10" -HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% -HKR, Ndi\Params\KeepLink, type, 0, "enum" -HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% -HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% -HKR, Ndi\Params\KeepLink, default, 0, "0" - - -[Neo.Service] -DisplayName = %Neo.Service.DispName% -Description = %Neo.Service.Desc% -ServiceType = 1 -StartType = 3 -ErrorControl = 1 -ServiceBinary = %12%\Neo_VPN94.sys -LoadOrderGroup = NDIS - -[Neo.Reg] -HKR, Ndi, Service, 0, Neo.Service.Name -HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" -HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" - -[Neo.EventLog] -HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN94.sys" -HKR, , TypesSupported, 0x00010001, 7 - -[Strings] -CompanyName = "SoftEther Corporation" -DiskDescription = "VPN Client Device Driver Install Disk" -Neo.Service.Name = "Neo_VPN94" -Neo.Service.DispName = "VPN Client Device Driver - VPN94" -Neo.Service.Desc = "VPN Client Adapter - VPN94" -NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN94" -Neo.EventLog.Name = "Neo" -NetworkAddress = "MAC Address" -DefaultAddress = "000001000001" -MaxSpeed = "Indicate Speed (Mbps)" -KeepLink = "Keep Link" -On = "On" -Off = "Off" - - -; Auto Generated 20180205_163610.795 - +; VPN Client Device Driver for Windows 2000 and Greater +; +; Copyright (c) SoftEther Corporation. All Rights Reserved. +; http://www.softether.co.jp/ +; +; BUILD 9658 + +[Version] +Signature = "$Windows NT$" +Class = Net +ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} +Provider = %CompanyName% +DriverVer = 02/04/2018, 4.25.0.9658 +CatalogFile.NT = inf_VPN94.cat + +[Manufacturer] +%CompanyName% = SoftEther, NTamd64 + +[SourceDisksNames] +1=%DiskDescription%, "", , + +[SourceDisksFiles] +Neo_VPN94.sys = 1 + +[DestinationDirs] +DefaultDestDir = 12 +Neo.CopyFiles.Sys = 12 + +[Neo.CopyFiles.Sys] +Neo_VPN94.sys, , , 2 + +[SoftEther.NTamd64] +%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN94 + +[NeoAdapter.Install] +Characteristics = 0x1 +AddReg = Neo.Reg, NeoAdapter.Ndi +CopyFiles = Neo.CopyFiles.Sys +*IfType = 53 +*MediaType = 0 +*PhysicalMediaType = 0 + +[NeoAdapter.Install.Services] +AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% + +[NeoAdapter.Ndi] +HKR, , NetworkAddress, 0, %DefaultAddress% +HKR, Ndi, DeviceID, , "NeoAdapter_VPN94" +HKR, , DevLoader, , ndis +HKR, , DeviceVxDs, , Neo_VPN94.sys +HKR, NDIS, LogDriverName, , "Neo_VPN94" +HKR, NDIS, MajorNdisVersion, 1, 5 +HKR, NDIS, MinorNdisVersion, 1, 0 +HKR, Ndi\Interfaces, DefUpper, , "ndis5" +HKR, Ndi\Interfaces, UpperRange, , "ndis5" +HKR, Ndi\Interfaces, LowerRange, , "ethernet" +HKR, Ndi\Interfaces, DefLower, , "ethernet" +HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" +HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% +HKR, Ndi\Params\NetworkAddress, type, 0, "edit" +HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" +HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" +HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% +HKR, Ndi\Params\NetworkAddress, optional, 0, "0" +HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% +HKR, Ndi\Params\MaxSpeed, type, 0, "int" +HKR, Ndi\Params\MaxSpeed, default, 0, "100" +HKR, Ndi\Params\MaxSpeed, min, 0, "0" +HKR, Ndi\Params\MaxSpeed, max, 0, "2000" +HKR, Ndi\Params\MaxSpeed, step, 0, "1" +HKR, Ndi\Params\MaxSpeed, Base, 0, "10" +HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% +HKR, Ndi\Params\KeepLink, type, 0, "enum" +HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% +HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% +HKR, Ndi\Params\KeepLink, default, 0, "0" + + +[Neo.Service] +DisplayName = %Neo.Service.DispName% +Description = %Neo.Service.Desc% +ServiceType = 1 +StartType = 3 +ErrorControl = 1 +ServiceBinary = %12%\Neo_VPN94.sys +LoadOrderGroup = NDIS + +[Neo.Reg] +HKR, Ndi, Service, 0, Neo.Service.Name +HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" +HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" + +[Neo.EventLog] +HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN94.sys" +HKR, , TypesSupported, 0x00010001, 7 + +[Strings] +CompanyName = "SoftEther Corporation" +DiskDescription = "VPN Client Device Driver Install Disk" +Neo.Service.Name = "Neo_VPN94" +Neo.Service.DispName = "VPN Client Device Driver - VPN94" +Neo.Service.Desc = "VPN Client Adapter - VPN94" +NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN94" +Neo.EventLog.Name = "Neo" +NetworkAddress = "MAC Address" +DefaultAddress = "000001000001" +MaxSpeed = "Indicate Speed (Mbps)" +KeepLink = "Keep Link" +On = "On" +Off = "Off" + + +; Auto Generated 20180205_163610.795 + diff --git a/src/bin/hamcore/DriverPackages/Neo6_Win8/x64/Neo6_x64_VPN95.inf b/src/bin/hamcore/DriverPackages/Neo6_Win8/x64/Neo6_x64_VPN95.inf index f44c6b59..1967cc02 100644 --- a/src/bin/hamcore/DriverPackages/Neo6_Win8/x64/Neo6_x64_VPN95.inf +++ b/src/bin/hamcore/DriverPackages/Neo6_Win8/x64/Neo6_x64_VPN95.inf @@ -1,114 +1,114 @@ -; VPN Client Device Driver for Windows 2000 and Greater -; -; Copyright (c) SoftEther Corporation. All Rights Reserved. -; http://www.softether.co.jp/ -; -; BUILD 9658 - -[Version] -Signature = "$Windows NT$" -Class = Net -ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} -Provider = %CompanyName% -DriverVer = 02/04/2018, 4.25.0.9658 -CatalogFile.NT = inf_VPN95.cat - -[Manufacturer] -%CompanyName% = SoftEther, NTamd64 - -[SourceDisksNames] -1=%DiskDescription%, "", , - -[SourceDisksFiles] -Neo_VPN95.sys = 1 - -[DestinationDirs] -DefaultDestDir = 12 -Neo.CopyFiles.Sys = 12 - -[Neo.CopyFiles.Sys] -Neo_VPN95.sys, , , 2 - -[SoftEther.NTamd64] -%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN95 - -[NeoAdapter.Install] -Characteristics = 0x1 -AddReg = Neo.Reg, NeoAdapter.Ndi -CopyFiles = Neo.CopyFiles.Sys -*IfType = 53 -*MediaType = 0 -*PhysicalMediaType = 0 - -[NeoAdapter.Install.Services] -AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% - -[NeoAdapter.Ndi] -HKR, , NetworkAddress, 0, %DefaultAddress% -HKR, Ndi, DeviceID, , "NeoAdapter_VPN95" -HKR, , DevLoader, , ndis -HKR, , DeviceVxDs, , Neo_VPN95.sys -HKR, NDIS, LogDriverName, , "Neo_VPN95" -HKR, NDIS, MajorNdisVersion, 1, 5 -HKR, NDIS, MinorNdisVersion, 1, 0 -HKR, Ndi\Interfaces, DefUpper, , "ndis5" -HKR, Ndi\Interfaces, UpperRange, , "ndis5" -HKR, Ndi\Interfaces, LowerRange, , "ethernet" -HKR, Ndi\Interfaces, DefLower, , "ethernet" -HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" -HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% -HKR, Ndi\Params\NetworkAddress, type, 0, "edit" -HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" -HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" -HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% -HKR, Ndi\Params\NetworkAddress, optional, 0, "0" -HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% -HKR, Ndi\Params\MaxSpeed, type, 0, "int" -HKR, Ndi\Params\MaxSpeed, default, 0, "100" -HKR, Ndi\Params\MaxSpeed, min, 0, "0" -HKR, Ndi\Params\MaxSpeed, max, 0, "2000" -HKR, Ndi\Params\MaxSpeed, step, 0, "1" -HKR, Ndi\Params\MaxSpeed, Base, 0, "10" -HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% -HKR, Ndi\Params\KeepLink, type, 0, "enum" -HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% -HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% -HKR, Ndi\Params\KeepLink, default, 0, "0" - - -[Neo.Service] -DisplayName = %Neo.Service.DispName% -Description = %Neo.Service.Desc% -ServiceType = 1 -StartType = 3 -ErrorControl = 1 -ServiceBinary = %12%\Neo_VPN95.sys -LoadOrderGroup = NDIS - -[Neo.Reg] -HKR, Ndi, Service, 0, Neo.Service.Name -HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" -HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" - -[Neo.EventLog] -HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN95.sys" -HKR, , TypesSupported, 0x00010001, 7 - -[Strings] -CompanyName = "SoftEther Corporation" -DiskDescription = "VPN Client Device Driver Install Disk" -Neo.Service.Name = "Neo_VPN95" -Neo.Service.DispName = "VPN Client Device Driver - VPN95" -Neo.Service.Desc = "VPN Client Adapter - VPN95" -NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN95" -Neo.EventLog.Name = "Neo" -NetworkAddress = "MAC Address" -DefaultAddress = "000001000001" -MaxSpeed = "Indicate Speed (Mbps)" -KeepLink = "Keep Link" -On = "On" -Off = "Off" - - -; Auto Generated 20180205_163610.796 - +; VPN Client Device Driver for Windows 2000 and Greater +; +; Copyright (c) SoftEther Corporation. All Rights Reserved. +; http://www.softether.co.jp/ +; +; BUILD 9658 + +[Version] +Signature = "$Windows NT$" +Class = Net +ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} +Provider = %CompanyName% +DriverVer = 02/04/2018, 4.25.0.9658 +CatalogFile.NT = inf_VPN95.cat + +[Manufacturer] +%CompanyName% = SoftEther, NTamd64 + +[SourceDisksNames] +1=%DiskDescription%, "", , + +[SourceDisksFiles] +Neo_VPN95.sys = 1 + +[DestinationDirs] +DefaultDestDir = 12 +Neo.CopyFiles.Sys = 12 + +[Neo.CopyFiles.Sys] +Neo_VPN95.sys, , , 2 + +[SoftEther.NTamd64] +%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN95 + +[NeoAdapter.Install] +Characteristics = 0x1 +AddReg = Neo.Reg, NeoAdapter.Ndi +CopyFiles = Neo.CopyFiles.Sys +*IfType = 53 +*MediaType = 0 +*PhysicalMediaType = 0 + +[NeoAdapter.Install.Services] +AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% + +[NeoAdapter.Ndi] +HKR, , NetworkAddress, 0, %DefaultAddress% +HKR, Ndi, DeviceID, , "NeoAdapter_VPN95" +HKR, , DevLoader, , ndis +HKR, , DeviceVxDs, , Neo_VPN95.sys +HKR, NDIS, LogDriverName, , "Neo_VPN95" +HKR, NDIS, MajorNdisVersion, 1, 5 +HKR, NDIS, MinorNdisVersion, 1, 0 +HKR, Ndi\Interfaces, DefUpper, , "ndis5" +HKR, Ndi\Interfaces, UpperRange, , "ndis5" +HKR, Ndi\Interfaces, LowerRange, , "ethernet" +HKR, Ndi\Interfaces, DefLower, , "ethernet" +HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" +HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% +HKR, Ndi\Params\NetworkAddress, type, 0, "edit" +HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" +HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" +HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% +HKR, Ndi\Params\NetworkAddress, optional, 0, "0" +HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% +HKR, Ndi\Params\MaxSpeed, type, 0, "int" +HKR, Ndi\Params\MaxSpeed, default, 0, "100" +HKR, Ndi\Params\MaxSpeed, min, 0, "0" +HKR, Ndi\Params\MaxSpeed, max, 0, "2000" +HKR, Ndi\Params\MaxSpeed, step, 0, "1" +HKR, Ndi\Params\MaxSpeed, Base, 0, "10" +HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% +HKR, Ndi\Params\KeepLink, type, 0, "enum" +HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% +HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% +HKR, Ndi\Params\KeepLink, default, 0, "0" + + +[Neo.Service] +DisplayName = %Neo.Service.DispName% +Description = %Neo.Service.Desc% +ServiceType = 1 +StartType = 3 +ErrorControl = 1 +ServiceBinary = %12%\Neo_VPN95.sys +LoadOrderGroup = NDIS + +[Neo.Reg] +HKR, Ndi, Service, 0, Neo.Service.Name +HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" +HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" + +[Neo.EventLog] +HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN95.sys" +HKR, , TypesSupported, 0x00010001, 7 + +[Strings] +CompanyName = "SoftEther Corporation" +DiskDescription = "VPN Client Device Driver Install Disk" +Neo.Service.Name = "Neo_VPN95" +Neo.Service.DispName = "VPN Client Device Driver - VPN95" +Neo.Service.Desc = "VPN Client Adapter - VPN95" +NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN95" +Neo.EventLog.Name = "Neo" +NetworkAddress = "MAC Address" +DefaultAddress = "000001000001" +MaxSpeed = "Indicate Speed (Mbps)" +KeepLink = "Keep Link" +On = "On" +Off = "Off" + + +; Auto Generated 20180205_163610.796 + diff --git a/src/bin/hamcore/DriverPackages/Neo6_Win8/x64/Neo6_x64_VPN96.inf b/src/bin/hamcore/DriverPackages/Neo6_Win8/x64/Neo6_x64_VPN96.inf index 768fd2d2..db198881 100644 --- a/src/bin/hamcore/DriverPackages/Neo6_Win8/x64/Neo6_x64_VPN96.inf +++ b/src/bin/hamcore/DriverPackages/Neo6_Win8/x64/Neo6_x64_VPN96.inf @@ -1,114 +1,114 @@ -; VPN Client Device Driver for Windows 2000 and Greater -; -; Copyright (c) SoftEther Corporation. All Rights Reserved. -; http://www.softether.co.jp/ -; -; BUILD 9658 - -[Version] -Signature = "$Windows NT$" -Class = Net -ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} -Provider = %CompanyName% -DriverVer = 02/04/2018, 4.25.0.9658 -CatalogFile.NT = inf_VPN96.cat - -[Manufacturer] -%CompanyName% = SoftEther, NTamd64 - -[SourceDisksNames] -1=%DiskDescription%, "", , - -[SourceDisksFiles] -Neo_VPN96.sys = 1 - -[DestinationDirs] -DefaultDestDir = 12 -Neo.CopyFiles.Sys = 12 - -[Neo.CopyFiles.Sys] -Neo_VPN96.sys, , , 2 - -[SoftEther.NTamd64] -%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN96 - -[NeoAdapter.Install] -Characteristics = 0x1 -AddReg = Neo.Reg, NeoAdapter.Ndi -CopyFiles = Neo.CopyFiles.Sys -*IfType = 53 -*MediaType = 0 -*PhysicalMediaType = 0 - -[NeoAdapter.Install.Services] -AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% - -[NeoAdapter.Ndi] -HKR, , NetworkAddress, 0, %DefaultAddress% -HKR, Ndi, DeviceID, , "NeoAdapter_VPN96" -HKR, , DevLoader, , ndis -HKR, , DeviceVxDs, , Neo_VPN96.sys -HKR, NDIS, LogDriverName, , "Neo_VPN96" -HKR, NDIS, MajorNdisVersion, 1, 5 -HKR, NDIS, MinorNdisVersion, 1, 0 -HKR, Ndi\Interfaces, DefUpper, , "ndis5" -HKR, Ndi\Interfaces, UpperRange, , "ndis5" -HKR, Ndi\Interfaces, LowerRange, , "ethernet" -HKR, Ndi\Interfaces, DefLower, , "ethernet" -HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" -HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% -HKR, Ndi\Params\NetworkAddress, type, 0, "edit" -HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" -HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" -HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% -HKR, Ndi\Params\NetworkAddress, optional, 0, "0" -HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% -HKR, Ndi\Params\MaxSpeed, type, 0, "int" -HKR, Ndi\Params\MaxSpeed, default, 0, "100" -HKR, Ndi\Params\MaxSpeed, min, 0, "0" -HKR, Ndi\Params\MaxSpeed, max, 0, "2000" -HKR, Ndi\Params\MaxSpeed, step, 0, "1" -HKR, Ndi\Params\MaxSpeed, Base, 0, "10" -HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% -HKR, Ndi\Params\KeepLink, type, 0, "enum" -HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% -HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% -HKR, Ndi\Params\KeepLink, default, 0, "0" - - -[Neo.Service] -DisplayName = %Neo.Service.DispName% -Description = %Neo.Service.Desc% -ServiceType = 1 -StartType = 3 -ErrorControl = 1 -ServiceBinary = %12%\Neo_VPN96.sys -LoadOrderGroup = NDIS - -[Neo.Reg] -HKR, Ndi, Service, 0, Neo.Service.Name -HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" -HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" - -[Neo.EventLog] -HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN96.sys" -HKR, , TypesSupported, 0x00010001, 7 - -[Strings] -CompanyName = "SoftEther Corporation" -DiskDescription = "VPN Client Device Driver Install Disk" -Neo.Service.Name = "Neo_VPN96" -Neo.Service.DispName = "VPN Client Device Driver - VPN96" -Neo.Service.Desc = "VPN Client Adapter - VPN96" -NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN96" -Neo.EventLog.Name = "Neo" -NetworkAddress = "MAC Address" -DefaultAddress = "000001000001" -MaxSpeed = "Indicate Speed (Mbps)" -KeepLink = "Keep Link" -On = "On" -Off = "Off" - - -; Auto Generated 20180205_163610.796 - +; VPN Client Device Driver for Windows 2000 and Greater +; +; Copyright (c) SoftEther Corporation. All Rights Reserved. +; http://www.softether.co.jp/ +; +; BUILD 9658 + +[Version] +Signature = "$Windows NT$" +Class = Net +ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} +Provider = %CompanyName% +DriverVer = 02/04/2018, 4.25.0.9658 +CatalogFile.NT = inf_VPN96.cat + +[Manufacturer] +%CompanyName% = SoftEther, NTamd64 + +[SourceDisksNames] +1=%DiskDescription%, "", , + +[SourceDisksFiles] +Neo_VPN96.sys = 1 + +[DestinationDirs] +DefaultDestDir = 12 +Neo.CopyFiles.Sys = 12 + +[Neo.CopyFiles.Sys] +Neo_VPN96.sys, , , 2 + +[SoftEther.NTamd64] +%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN96 + +[NeoAdapter.Install] +Characteristics = 0x1 +AddReg = Neo.Reg, NeoAdapter.Ndi +CopyFiles = Neo.CopyFiles.Sys +*IfType = 53 +*MediaType = 0 +*PhysicalMediaType = 0 + +[NeoAdapter.Install.Services] +AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% + +[NeoAdapter.Ndi] +HKR, , NetworkAddress, 0, %DefaultAddress% +HKR, Ndi, DeviceID, , "NeoAdapter_VPN96" +HKR, , DevLoader, , ndis +HKR, , DeviceVxDs, , Neo_VPN96.sys +HKR, NDIS, LogDriverName, , "Neo_VPN96" +HKR, NDIS, MajorNdisVersion, 1, 5 +HKR, NDIS, MinorNdisVersion, 1, 0 +HKR, Ndi\Interfaces, DefUpper, , "ndis5" +HKR, Ndi\Interfaces, UpperRange, , "ndis5" +HKR, Ndi\Interfaces, LowerRange, , "ethernet" +HKR, Ndi\Interfaces, DefLower, , "ethernet" +HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" +HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% +HKR, Ndi\Params\NetworkAddress, type, 0, "edit" +HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" +HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" +HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% +HKR, Ndi\Params\NetworkAddress, optional, 0, "0" +HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% +HKR, Ndi\Params\MaxSpeed, type, 0, "int" +HKR, Ndi\Params\MaxSpeed, default, 0, "100" +HKR, Ndi\Params\MaxSpeed, min, 0, "0" +HKR, Ndi\Params\MaxSpeed, max, 0, "2000" +HKR, Ndi\Params\MaxSpeed, step, 0, "1" +HKR, Ndi\Params\MaxSpeed, Base, 0, "10" +HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% +HKR, Ndi\Params\KeepLink, type, 0, "enum" +HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% +HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% +HKR, Ndi\Params\KeepLink, default, 0, "0" + + +[Neo.Service] +DisplayName = %Neo.Service.DispName% +Description = %Neo.Service.Desc% +ServiceType = 1 +StartType = 3 +ErrorControl = 1 +ServiceBinary = %12%\Neo_VPN96.sys +LoadOrderGroup = NDIS + +[Neo.Reg] +HKR, Ndi, Service, 0, Neo.Service.Name +HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" +HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" + +[Neo.EventLog] +HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN96.sys" +HKR, , TypesSupported, 0x00010001, 7 + +[Strings] +CompanyName = "SoftEther Corporation" +DiskDescription = "VPN Client Device Driver Install Disk" +Neo.Service.Name = "Neo_VPN96" +Neo.Service.DispName = "VPN Client Device Driver - VPN96" +Neo.Service.Desc = "VPN Client Adapter - VPN96" +NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN96" +Neo.EventLog.Name = "Neo" +NetworkAddress = "MAC Address" +DefaultAddress = "000001000001" +MaxSpeed = "Indicate Speed (Mbps)" +KeepLink = "Keep Link" +On = "On" +Off = "Off" + + +; Auto Generated 20180205_163610.796 + diff --git a/src/bin/hamcore/DriverPackages/Neo6_Win8/x64/Neo6_x64_VPN97.inf b/src/bin/hamcore/DriverPackages/Neo6_Win8/x64/Neo6_x64_VPN97.inf index 60b111f3..4c80edfe 100644 --- a/src/bin/hamcore/DriverPackages/Neo6_Win8/x64/Neo6_x64_VPN97.inf +++ b/src/bin/hamcore/DriverPackages/Neo6_Win8/x64/Neo6_x64_VPN97.inf @@ -1,114 +1,114 @@ -; VPN Client Device Driver for Windows 2000 and Greater -; -; Copyright (c) SoftEther Corporation. All Rights Reserved. -; http://www.softether.co.jp/ -; -; BUILD 9658 - -[Version] -Signature = "$Windows NT$" -Class = Net -ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} -Provider = %CompanyName% -DriverVer = 02/04/2018, 4.25.0.9658 -CatalogFile.NT = inf_VPN97.cat - -[Manufacturer] -%CompanyName% = SoftEther, NTamd64 - -[SourceDisksNames] -1=%DiskDescription%, "", , - -[SourceDisksFiles] -Neo_VPN97.sys = 1 - -[DestinationDirs] -DefaultDestDir = 12 -Neo.CopyFiles.Sys = 12 - -[Neo.CopyFiles.Sys] -Neo_VPN97.sys, , , 2 - -[SoftEther.NTamd64] -%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN97 - -[NeoAdapter.Install] -Characteristics = 0x1 -AddReg = Neo.Reg, NeoAdapter.Ndi -CopyFiles = Neo.CopyFiles.Sys -*IfType = 53 -*MediaType = 0 -*PhysicalMediaType = 0 - -[NeoAdapter.Install.Services] -AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% - -[NeoAdapter.Ndi] -HKR, , NetworkAddress, 0, %DefaultAddress% -HKR, Ndi, DeviceID, , "NeoAdapter_VPN97" -HKR, , DevLoader, , ndis -HKR, , DeviceVxDs, , Neo_VPN97.sys -HKR, NDIS, LogDriverName, , "Neo_VPN97" -HKR, NDIS, MajorNdisVersion, 1, 5 -HKR, NDIS, MinorNdisVersion, 1, 0 -HKR, Ndi\Interfaces, DefUpper, , "ndis5" -HKR, Ndi\Interfaces, UpperRange, , "ndis5" -HKR, Ndi\Interfaces, LowerRange, , "ethernet" -HKR, Ndi\Interfaces, DefLower, , "ethernet" -HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" -HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% -HKR, Ndi\Params\NetworkAddress, type, 0, "edit" -HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" -HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" -HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% -HKR, Ndi\Params\NetworkAddress, optional, 0, "0" -HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% -HKR, Ndi\Params\MaxSpeed, type, 0, "int" -HKR, Ndi\Params\MaxSpeed, default, 0, "100" -HKR, Ndi\Params\MaxSpeed, min, 0, "0" -HKR, Ndi\Params\MaxSpeed, max, 0, "2000" -HKR, Ndi\Params\MaxSpeed, step, 0, "1" -HKR, Ndi\Params\MaxSpeed, Base, 0, "10" -HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% -HKR, Ndi\Params\KeepLink, type, 0, "enum" -HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% -HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% -HKR, Ndi\Params\KeepLink, default, 0, "0" - - -[Neo.Service] -DisplayName = %Neo.Service.DispName% -Description = %Neo.Service.Desc% -ServiceType = 1 -StartType = 3 -ErrorControl = 1 -ServiceBinary = %12%\Neo_VPN97.sys -LoadOrderGroup = NDIS - -[Neo.Reg] -HKR, Ndi, Service, 0, Neo.Service.Name -HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" -HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" - -[Neo.EventLog] -HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN97.sys" -HKR, , TypesSupported, 0x00010001, 7 - -[Strings] -CompanyName = "SoftEther Corporation" -DiskDescription = "VPN Client Device Driver Install Disk" -Neo.Service.Name = "Neo_VPN97" -Neo.Service.DispName = "VPN Client Device Driver - VPN97" -Neo.Service.Desc = "VPN Client Adapter - VPN97" -NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN97" -Neo.EventLog.Name = "Neo" -NetworkAddress = "MAC Address" -DefaultAddress = "000001000001" -MaxSpeed = "Indicate Speed (Mbps)" -KeepLink = "Keep Link" -On = "On" -Off = "Off" - - -; Auto Generated 20180205_163610.797 - +; VPN Client Device Driver for Windows 2000 and Greater +; +; Copyright (c) SoftEther Corporation. All Rights Reserved. +; http://www.softether.co.jp/ +; +; BUILD 9658 + +[Version] +Signature = "$Windows NT$" +Class = Net +ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} +Provider = %CompanyName% +DriverVer = 02/04/2018, 4.25.0.9658 +CatalogFile.NT = inf_VPN97.cat + +[Manufacturer] +%CompanyName% = SoftEther, NTamd64 + +[SourceDisksNames] +1=%DiskDescription%, "", , + +[SourceDisksFiles] +Neo_VPN97.sys = 1 + +[DestinationDirs] +DefaultDestDir = 12 +Neo.CopyFiles.Sys = 12 + +[Neo.CopyFiles.Sys] +Neo_VPN97.sys, , , 2 + +[SoftEther.NTamd64] +%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN97 + +[NeoAdapter.Install] +Characteristics = 0x1 +AddReg = Neo.Reg, NeoAdapter.Ndi +CopyFiles = Neo.CopyFiles.Sys +*IfType = 53 +*MediaType = 0 +*PhysicalMediaType = 0 + +[NeoAdapter.Install.Services] +AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% + +[NeoAdapter.Ndi] +HKR, , NetworkAddress, 0, %DefaultAddress% +HKR, Ndi, DeviceID, , "NeoAdapter_VPN97" +HKR, , DevLoader, , ndis +HKR, , DeviceVxDs, , Neo_VPN97.sys +HKR, NDIS, LogDriverName, , "Neo_VPN97" +HKR, NDIS, MajorNdisVersion, 1, 5 +HKR, NDIS, MinorNdisVersion, 1, 0 +HKR, Ndi\Interfaces, DefUpper, , "ndis5" +HKR, Ndi\Interfaces, UpperRange, , "ndis5" +HKR, Ndi\Interfaces, LowerRange, , "ethernet" +HKR, Ndi\Interfaces, DefLower, , "ethernet" +HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" +HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% +HKR, Ndi\Params\NetworkAddress, type, 0, "edit" +HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" +HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" +HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% +HKR, Ndi\Params\NetworkAddress, optional, 0, "0" +HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% +HKR, Ndi\Params\MaxSpeed, type, 0, "int" +HKR, Ndi\Params\MaxSpeed, default, 0, "100" +HKR, Ndi\Params\MaxSpeed, min, 0, "0" +HKR, Ndi\Params\MaxSpeed, max, 0, "2000" +HKR, Ndi\Params\MaxSpeed, step, 0, "1" +HKR, Ndi\Params\MaxSpeed, Base, 0, "10" +HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% +HKR, Ndi\Params\KeepLink, type, 0, "enum" +HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% +HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% +HKR, Ndi\Params\KeepLink, default, 0, "0" + + +[Neo.Service] +DisplayName = %Neo.Service.DispName% +Description = %Neo.Service.Desc% +ServiceType = 1 +StartType = 3 +ErrorControl = 1 +ServiceBinary = %12%\Neo_VPN97.sys +LoadOrderGroup = NDIS + +[Neo.Reg] +HKR, Ndi, Service, 0, Neo.Service.Name +HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" +HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" + +[Neo.EventLog] +HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN97.sys" +HKR, , TypesSupported, 0x00010001, 7 + +[Strings] +CompanyName = "SoftEther Corporation" +DiskDescription = "VPN Client Device Driver Install Disk" +Neo.Service.Name = "Neo_VPN97" +Neo.Service.DispName = "VPN Client Device Driver - VPN97" +Neo.Service.Desc = "VPN Client Adapter - VPN97" +NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN97" +Neo.EventLog.Name = "Neo" +NetworkAddress = "MAC Address" +DefaultAddress = "000001000001" +MaxSpeed = "Indicate Speed (Mbps)" +KeepLink = "Keep Link" +On = "On" +Off = "Off" + + +; Auto Generated 20180205_163610.797 + diff --git a/src/bin/hamcore/DriverPackages/Neo6_Win8/x64/Neo6_x64_VPN98.inf b/src/bin/hamcore/DriverPackages/Neo6_Win8/x64/Neo6_x64_VPN98.inf index 58a82d79..a7bb1abe 100644 --- a/src/bin/hamcore/DriverPackages/Neo6_Win8/x64/Neo6_x64_VPN98.inf +++ b/src/bin/hamcore/DriverPackages/Neo6_Win8/x64/Neo6_x64_VPN98.inf @@ -1,114 +1,114 @@ -; VPN Client Device Driver for Windows 2000 and Greater -; -; Copyright (c) SoftEther Corporation. All Rights Reserved. -; http://www.softether.co.jp/ -; -; BUILD 9658 - -[Version] -Signature = "$Windows NT$" -Class = Net -ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} -Provider = %CompanyName% -DriverVer = 02/04/2018, 4.25.0.9658 -CatalogFile.NT = inf_VPN98.cat - -[Manufacturer] -%CompanyName% = SoftEther, NTamd64 - -[SourceDisksNames] -1=%DiskDescription%, "", , - -[SourceDisksFiles] -Neo_VPN98.sys = 1 - -[DestinationDirs] -DefaultDestDir = 12 -Neo.CopyFiles.Sys = 12 - -[Neo.CopyFiles.Sys] -Neo_VPN98.sys, , , 2 - -[SoftEther.NTamd64] -%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN98 - -[NeoAdapter.Install] -Characteristics = 0x1 -AddReg = Neo.Reg, NeoAdapter.Ndi -CopyFiles = Neo.CopyFiles.Sys -*IfType = 53 -*MediaType = 0 -*PhysicalMediaType = 0 - -[NeoAdapter.Install.Services] -AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% - -[NeoAdapter.Ndi] -HKR, , NetworkAddress, 0, %DefaultAddress% -HKR, Ndi, DeviceID, , "NeoAdapter_VPN98" -HKR, , DevLoader, , ndis -HKR, , DeviceVxDs, , Neo_VPN98.sys -HKR, NDIS, LogDriverName, , "Neo_VPN98" -HKR, NDIS, MajorNdisVersion, 1, 5 -HKR, NDIS, MinorNdisVersion, 1, 0 -HKR, Ndi\Interfaces, DefUpper, , "ndis5" -HKR, Ndi\Interfaces, UpperRange, , "ndis5" -HKR, Ndi\Interfaces, LowerRange, , "ethernet" -HKR, Ndi\Interfaces, DefLower, , "ethernet" -HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" -HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% -HKR, Ndi\Params\NetworkAddress, type, 0, "edit" -HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" -HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" -HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% -HKR, Ndi\Params\NetworkAddress, optional, 0, "0" -HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% -HKR, Ndi\Params\MaxSpeed, type, 0, "int" -HKR, Ndi\Params\MaxSpeed, default, 0, "100" -HKR, Ndi\Params\MaxSpeed, min, 0, "0" -HKR, Ndi\Params\MaxSpeed, max, 0, "2000" -HKR, Ndi\Params\MaxSpeed, step, 0, "1" -HKR, Ndi\Params\MaxSpeed, Base, 0, "10" -HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% -HKR, Ndi\Params\KeepLink, type, 0, "enum" -HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% -HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% -HKR, Ndi\Params\KeepLink, default, 0, "0" - - -[Neo.Service] -DisplayName = %Neo.Service.DispName% -Description = %Neo.Service.Desc% -ServiceType = 1 -StartType = 3 -ErrorControl = 1 -ServiceBinary = %12%\Neo_VPN98.sys -LoadOrderGroup = NDIS - -[Neo.Reg] -HKR, Ndi, Service, 0, Neo.Service.Name -HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" -HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" - -[Neo.EventLog] -HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN98.sys" -HKR, , TypesSupported, 0x00010001, 7 - -[Strings] -CompanyName = "SoftEther Corporation" -DiskDescription = "VPN Client Device Driver Install Disk" -Neo.Service.Name = "Neo_VPN98" -Neo.Service.DispName = "VPN Client Device Driver - VPN98" -Neo.Service.Desc = "VPN Client Adapter - VPN98" -NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN98" -Neo.EventLog.Name = "Neo" -NetworkAddress = "MAC Address" -DefaultAddress = "000001000001" -MaxSpeed = "Indicate Speed (Mbps)" -KeepLink = "Keep Link" -On = "On" -Off = "Off" - - -; Auto Generated 20180205_163610.798 - +; VPN Client Device Driver for Windows 2000 and Greater +; +; Copyright (c) SoftEther Corporation. All Rights Reserved. +; http://www.softether.co.jp/ +; +; BUILD 9658 + +[Version] +Signature = "$Windows NT$" +Class = Net +ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} +Provider = %CompanyName% +DriverVer = 02/04/2018, 4.25.0.9658 +CatalogFile.NT = inf_VPN98.cat + +[Manufacturer] +%CompanyName% = SoftEther, NTamd64 + +[SourceDisksNames] +1=%DiskDescription%, "", , + +[SourceDisksFiles] +Neo_VPN98.sys = 1 + +[DestinationDirs] +DefaultDestDir = 12 +Neo.CopyFiles.Sys = 12 + +[Neo.CopyFiles.Sys] +Neo_VPN98.sys, , , 2 + +[SoftEther.NTamd64] +%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN98 + +[NeoAdapter.Install] +Characteristics = 0x1 +AddReg = Neo.Reg, NeoAdapter.Ndi +CopyFiles = Neo.CopyFiles.Sys +*IfType = 53 +*MediaType = 0 +*PhysicalMediaType = 0 + +[NeoAdapter.Install.Services] +AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% + +[NeoAdapter.Ndi] +HKR, , NetworkAddress, 0, %DefaultAddress% +HKR, Ndi, DeviceID, , "NeoAdapter_VPN98" +HKR, , DevLoader, , ndis +HKR, , DeviceVxDs, , Neo_VPN98.sys +HKR, NDIS, LogDriverName, , "Neo_VPN98" +HKR, NDIS, MajorNdisVersion, 1, 5 +HKR, NDIS, MinorNdisVersion, 1, 0 +HKR, Ndi\Interfaces, DefUpper, , "ndis5" +HKR, Ndi\Interfaces, UpperRange, , "ndis5" +HKR, Ndi\Interfaces, LowerRange, , "ethernet" +HKR, Ndi\Interfaces, DefLower, , "ethernet" +HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" +HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% +HKR, Ndi\Params\NetworkAddress, type, 0, "edit" +HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" +HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" +HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% +HKR, Ndi\Params\NetworkAddress, optional, 0, "0" +HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% +HKR, Ndi\Params\MaxSpeed, type, 0, "int" +HKR, Ndi\Params\MaxSpeed, default, 0, "100" +HKR, Ndi\Params\MaxSpeed, min, 0, "0" +HKR, Ndi\Params\MaxSpeed, max, 0, "2000" +HKR, Ndi\Params\MaxSpeed, step, 0, "1" +HKR, Ndi\Params\MaxSpeed, Base, 0, "10" +HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% +HKR, Ndi\Params\KeepLink, type, 0, "enum" +HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% +HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% +HKR, Ndi\Params\KeepLink, default, 0, "0" + + +[Neo.Service] +DisplayName = %Neo.Service.DispName% +Description = %Neo.Service.Desc% +ServiceType = 1 +StartType = 3 +ErrorControl = 1 +ServiceBinary = %12%\Neo_VPN98.sys +LoadOrderGroup = NDIS + +[Neo.Reg] +HKR, Ndi, Service, 0, Neo.Service.Name +HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" +HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" + +[Neo.EventLog] +HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN98.sys" +HKR, , TypesSupported, 0x00010001, 7 + +[Strings] +CompanyName = "SoftEther Corporation" +DiskDescription = "VPN Client Device Driver Install Disk" +Neo.Service.Name = "Neo_VPN98" +Neo.Service.DispName = "VPN Client Device Driver - VPN98" +Neo.Service.Desc = "VPN Client Adapter - VPN98" +NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN98" +Neo.EventLog.Name = "Neo" +NetworkAddress = "MAC Address" +DefaultAddress = "000001000001" +MaxSpeed = "Indicate Speed (Mbps)" +KeepLink = "Keep Link" +On = "On" +Off = "Off" + + +; Auto Generated 20180205_163610.798 + diff --git a/src/bin/hamcore/DriverPackages/Neo6_Win8/x64/Neo6_x64_VPN99.inf b/src/bin/hamcore/DriverPackages/Neo6_Win8/x64/Neo6_x64_VPN99.inf index b389b353..097275ae 100644 --- a/src/bin/hamcore/DriverPackages/Neo6_Win8/x64/Neo6_x64_VPN99.inf +++ b/src/bin/hamcore/DriverPackages/Neo6_Win8/x64/Neo6_x64_VPN99.inf @@ -1,114 +1,114 @@ -; VPN Client Device Driver for Windows 2000 and Greater -; -; Copyright (c) SoftEther Corporation. All Rights Reserved. -; http://www.softether.co.jp/ -; -; BUILD 9658 - -[Version] -Signature = "$Windows NT$" -Class = Net -ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} -Provider = %CompanyName% -DriverVer = 02/04/2018, 4.25.0.9658 -CatalogFile.NT = inf_VPN99.cat - -[Manufacturer] -%CompanyName% = SoftEther, NTamd64 - -[SourceDisksNames] -1=%DiskDescription%, "", , - -[SourceDisksFiles] -Neo_VPN99.sys = 1 - -[DestinationDirs] -DefaultDestDir = 12 -Neo.CopyFiles.Sys = 12 - -[Neo.CopyFiles.Sys] -Neo_VPN99.sys, , , 2 - -[SoftEther.NTamd64] -%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN99 - -[NeoAdapter.Install] -Characteristics = 0x1 -AddReg = Neo.Reg, NeoAdapter.Ndi -CopyFiles = Neo.CopyFiles.Sys -*IfType = 53 -*MediaType = 0 -*PhysicalMediaType = 0 - -[NeoAdapter.Install.Services] -AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% - -[NeoAdapter.Ndi] -HKR, , NetworkAddress, 0, %DefaultAddress% -HKR, Ndi, DeviceID, , "NeoAdapter_VPN99" -HKR, , DevLoader, , ndis -HKR, , DeviceVxDs, , Neo_VPN99.sys -HKR, NDIS, LogDriverName, , "Neo_VPN99" -HKR, NDIS, MajorNdisVersion, 1, 5 -HKR, NDIS, MinorNdisVersion, 1, 0 -HKR, Ndi\Interfaces, DefUpper, , "ndis5" -HKR, Ndi\Interfaces, UpperRange, , "ndis5" -HKR, Ndi\Interfaces, LowerRange, , "ethernet" -HKR, Ndi\Interfaces, DefLower, , "ethernet" -HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" -HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% -HKR, Ndi\Params\NetworkAddress, type, 0, "edit" -HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" -HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" -HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% -HKR, Ndi\Params\NetworkAddress, optional, 0, "0" -HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% -HKR, Ndi\Params\MaxSpeed, type, 0, "int" -HKR, Ndi\Params\MaxSpeed, default, 0, "100" -HKR, Ndi\Params\MaxSpeed, min, 0, "0" -HKR, Ndi\Params\MaxSpeed, max, 0, "2000" -HKR, Ndi\Params\MaxSpeed, step, 0, "1" -HKR, Ndi\Params\MaxSpeed, Base, 0, "10" -HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% -HKR, Ndi\Params\KeepLink, type, 0, "enum" -HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% -HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% -HKR, Ndi\Params\KeepLink, default, 0, "0" - - -[Neo.Service] -DisplayName = %Neo.Service.DispName% -Description = %Neo.Service.Desc% -ServiceType = 1 -StartType = 3 -ErrorControl = 1 -ServiceBinary = %12%\Neo_VPN99.sys -LoadOrderGroup = NDIS - -[Neo.Reg] -HKR, Ndi, Service, 0, Neo.Service.Name -HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" -HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" - -[Neo.EventLog] -HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN99.sys" -HKR, , TypesSupported, 0x00010001, 7 - -[Strings] -CompanyName = "SoftEther Corporation" -DiskDescription = "VPN Client Device Driver Install Disk" -Neo.Service.Name = "Neo_VPN99" -Neo.Service.DispName = "VPN Client Device Driver - VPN99" -Neo.Service.Desc = "VPN Client Adapter - VPN99" -NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN99" -Neo.EventLog.Name = "Neo" -NetworkAddress = "MAC Address" -DefaultAddress = "000001000001" -MaxSpeed = "Indicate Speed (Mbps)" -KeepLink = "Keep Link" -On = "On" -Off = "Off" - - -; Auto Generated 20180205_163610.799 - +; VPN Client Device Driver for Windows 2000 and Greater +; +; Copyright (c) SoftEther Corporation. All Rights Reserved. +; http://www.softether.co.jp/ +; +; BUILD 9658 + +[Version] +Signature = "$Windows NT$" +Class = Net +ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} +Provider = %CompanyName% +DriverVer = 02/04/2018, 4.25.0.9658 +CatalogFile.NT = inf_VPN99.cat + +[Manufacturer] +%CompanyName% = SoftEther, NTamd64 + +[SourceDisksNames] +1=%DiskDescription%, "", , + +[SourceDisksFiles] +Neo_VPN99.sys = 1 + +[DestinationDirs] +DefaultDestDir = 12 +Neo.CopyFiles.Sys = 12 + +[Neo.CopyFiles.Sys] +Neo_VPN99.sys, , , 2 + +[SoftEther.NTamd64] +%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN99 + +[NeoAdapter.Install] +Characteristics = 0x1 +AddReg = Neo.Reg, NeoAdapter.Ndi +CopyFiles = Neo.CopyFiles.Sys +*IfType = 53 +*MediaType = 0 +*PhysicalMediaType = 0 + +[NeoAdapter.Install.Services] +AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% + +[NeoAdapter.Ndi] +HKR, , NetworkAddress, 0, %DefaultAddress% +HKR, Ndi, DeviceID, , "NeoAdapter_VPN99" +HKR, , DevLoader, , ndis +HKR, , DeviceVxDs, , Neo_VPN99.sys +HKR, NDIS, LogDriverName, , "Neo_VPN99" +HKR, NDIS, MajorNdisVersion, 1, 5 +HKR, NDIS, MinorNdisVersion, 1, 0 +HKR, Ndi\Interfaces, DefUpper, , "ndis5" +HKR, Ndi\Interfaces, UpperRange, , "ndis5" +HKR, Ndi\Interfaces, LowerRange, , "ethernet" +HKR, Ndi\Interfaces, DefLower, , "ethernet" +HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" +HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% +HKR, Ndi\Params\NetworkAddress, type, 0, "edit" +HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" +HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" +HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% +HKR, Ndi\Params\NetworkAddress, optional, 0, "0" +HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% +HKR, Ndi\Params\MaxSpeed, type, 0, "int" +HKR, Ndi\Params\MaxSpeed, default, 0, "100" +HKR, Ndi\Params\MaxSpeed, min, 0, "0" +HKR, Ndi\Params\MaxSpeed, max, 0, "2000" +HKR, Ndi\Params\MaxSpeed, step, 0, "1" +HKR, Ndi\Params\MaxSpeed, Base, 0, "10" +HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% +HKR, Ndi\Params\KeepLink, type, 0, "enum" +HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% +HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% +HKR, Ndi\Params\KeepLink, default, 0, "0" + + +[Neo.Service] +DisplayName = %Neo.Service.DispName% +Description = %Neo.Service.Desc% +ServiceType = 1 +StartType = 3 +ErrorControl = 1 +ServiceBinary = %12%\Neo_VPN99.sys +LoadOrderGroup = NDIS + +[Neo.Reg] +HKR, Ndi, Service, 0, Neo.Service.Name +HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" +HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" + +[Neo.EventLog] +HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN99.sys" +HKR, , TypesSupported, 0x00010001, 7 + +[Strings] +CompanyName = "SoftEther Corporation" +DiskDescription = "VPN Client Device Driver Install Disk" +Neo.Service.Name = "Neo_VPN99" +Neo.Service.DispName = "VPN Client Device Driver - VPN99" +Neo.Service.Desc = "VPN Client Adapter - VPN99" +NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN99" +Neo.EventLog.Name = "Neo" +NetworkAddress = "MAC Address" +DefaultAddress = "000001000001" +MaxSpeed = "Indicate Speed (Mbps)" +KeepLink = "Keep Link" +On = "On" +Off = "Off" + + +; Auto Generated 20180205_163610.799 + diff --git a/src/bin/hamcore/DriverPackages/Neo6_Win8/x86/Neo6_x86_VPN.inf b/src/bin/hamcore/DriverPackages/Neo6_Win8/x86/Neo6_x86_VPN.inf index 243aaa2a..dcb73267 100644 --- a/src/bin/hamcore/DriverPackages/Neo6_Win8/x86/Neo6_x86_VPN.inf +++ b/src/bin/hamcore/DriverPackages/Neo6_Win8/x86/Neo6_x86_VPN.inf @@ -1,114 +1,114 @@ -; VPN Client Device Driver for Windows 2000 and Greater -; -; Copyright (c) SoftEther Corporation. All Rights Reserved. -; http://www.softether.co.jp/ -; -; BUILD 9658 - -[Version] -Signature = "$Windows NT$" -Class = Net -ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} -Provider = %CompanyName% -DriverVer = 02/04/2018, 4.25.0.9658 -CatalogFile.NT = inf_VPN.cat - -[Manufacturer] -%CompanyName% = SoftEther - -[SourceDisksNames] -1=%DiskDescription%, "", , - -[SourceDisksFiles] -Neo_VPN.sys = 1 - -[DestinationDirs] -DefaultDestDir = 12 -Neo.CopyFiles.Sys = 12 - -[Neo.CopyFiles.Sys] -Neo_VPN.sys, , , 2 - -[SoftEther] -%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN - -[NeoAdapter.Install] -Characteristics = 0x1 -AddReg = Neo.Reg, NeoAdapter.Ndi -CopyFiles = Neo.CopyFiles.Sys -*IfType = 53 -*MediaType = 0 -*PhysicalMediaType = 0 - -[NeoAdapter.Install.Services] -AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% - -[NeoAdapter.Ndi] -HKR, , NetworkAddress, 0, %DefaultAddress% -HKR, Ndi, DeviceID, , "NeoAdapter_VPN" -HKR, , DevLoader, , ndis -HKR, , DeviceVxDs, , Neo_VPN.sys -HKR, NDIS, LogDriverName, , "Neo_VPN" -HKR, NDIS, MajorNdisVersion, 1, 5 -HKR, NDIS, MinorNdisVersion, 1, 0 -HKR, Ndi\Interfaces, DefUpper, , "ndis5" -HKR, Ndi\Interfaces, UpperRange, , "ndis5" -HKR, Ndi\Interfaces, LowerRange, , "ethernet" -HKR, Ndi\Interfaces, DefLower, , "ethernet" -HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" -HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% -HKR, Ndi\Params\NetworkAddress, type, 0, "edit" -HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" -HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" -HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% -HKR, Ndi\Params\NetworkAddress, optional, 0, "0" -HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% -HKR, Ndi\Params\MaxSpeed, type, 0, "int" -HKR, Ndi\Params\MaxSpeed, default, 0, "100" -HKR, Ndi\Params\MaxSpeed, min, 0, "0" -HKR, Ndi\Params\MaxSpeed, max, 0, "2000" -HKR, Ndi\Params\MaxSpeed, step, 0, "1" -HKR, Ndi\Params\MaxSpeed, Base, 0, "10" -HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% -HKR, Ndi\Params\KeepLink, type, 0, "enum" -HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% -HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% -HKR, Ndi\Params\KeepLink, default, 0, "0" - - -[Neo.Service] -DisplayName = %Neo.Service.DispName% -Description = %Neo.Service.Desc% -ServiceType = 1 -StartType = 3 -ErrorControl = 1 -ServiceBinary = %12%\Neo_VPN.sys -LoadOrderGroup = NDIS - -[Neo.Reg] -HKR, Ndi, Service, 0, Neo.Service.Name -HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" -HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" - -[Neo.EventLog] -HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN.sys" -HKR, , TypesSupported, 0x00010001, 7 - -[Strings] -CompanyName = "SoftEther Corporation" -DiskDescription = "VPN Client Device Driver Install Disk" -Neo.Service.Name = "Neo_VPN" -Neo.Service.DispName = "VPN Client Device Driver - VPN" -Neo.Service.Desc = "VPN Client Adapter - VPN" -NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN" -Neo.EventLog.Name = "Neo" -NetworkAddress = "MAC Address" -DefaultAddress = "000001000001" -MaxSpeed = "Indicate Speed (Mbps)" -KeepLink = "Keep Link" -On = "On" -Off = "Off" - - -; Auto Generated 20180205_163608.747 - +; VPN Client Device Driver for Windows 2000 and Greater +; +; Copyright (c) SoftEther Corporation. All Rights Reserved. +; http://www.softether.co.jp/ +; +; BUILD 9658 + +[Version] +Signature = "$Windows NT$" +Class = Net +ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} +Provider = %CompanyName% +DriverVer = 02/04/2018, 4.25.0.9658 +CatalogFile.NT = inf_VPN.cat + +[Manufacturer] +%CompanyName% = SoftEther + +[SourceDisksNames] +1=%DiskDescription%, "", , + +[SourceDisksFiles] +Neo_VPN.sys = 1 + +[DestinationDirs] +DefaultDestDir = 12 +Neo.CopyFiles.Sys = 12 + +[Neo.CopyFiles.Sys] +Neo_VPN.sys, , , 2 + +[SoftEther] +%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN + +[NeoAdapter.Install] +Characteristics = 0x1 +AddReg = Neo.Reg, NeoAdapter.Ndi +CopyFiles = Neo.CopyFiles.Sys +*IfType = 53 +*MediaType = 0 +*PhysicalMediaType = 0 + +[NeoAdapter.Install.Services] +AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% + +[NeoAdapter.Ndi] +HKR, , NetworkAddress, 0, %DefaultAddress% +HKR, Ndi, DeviceID, , "NeoAdapter_VPN" +HKR, , DevLoader, , ndis +HKR, , DeviceVxDs, , Neo_VPN.sys +HKR, NDIS, LogDriverName, , "Neo_VPN" +HKR, NDIS, MajorNdisVersion, 1, 5 +HKR, NDIS, MinorNdisVersion, 1, 0 +HKR, Ndi\Interfaces, DefUpper, , "ndis5" +HKR, Ndi\Interfaces, UpperRange, , "ndis5" +HKR, Ndi\Interfaces, LowerRange, , "ethernet" +HKR, Ndi\Interfaces, DefLower, , "ethernet" +HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" +HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% +HKR, Ndi\Params\NetworkAddress, type, 0, "edit" +HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" +HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" +HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% +HKR, Ndi\Params\NetworkAddress, optional, 0, "0" +HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% +HKR, Ndi\Params\MaxSpeed, type, 0, "int" +HKR, Ndi\Params\MaxSpeed, default, 0, "100" +HKR, Ndi\Params\MaxSpeed, min, 0, "0" +HKR, Ndi\Params\MaxSpeed, max, 0, "2000" +HKR, Ndi\Params\MaxSpeed, step, 0, "1" +HKR, Ndi\Params\MaxSpeed, Base, 0, "10" +HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% +HKR, Ndi\Params\KeepLink, type, 0, "enum" +HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% +HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% +HKR, Ndi\Params\KeepLink, default, 0, "0" + + +[Neo.Service] +DisplayName = %Neo.Service.DispName% +Description = %Neo.Service.Desc% +ServiceType = 1 +StartType = 3 +ErrorControl = 1 +ServiceBinary = %12%\Neo_VPN.sys +LoadOrderGroup = NDIS + +[Neo.Reg] +HKR, Ndi, Service, 0, Neo.Service.Name +HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" +HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" + +[Neo.EventLog] +HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN.sys" +HKR, , TypesSupported, 0x00010001, 7 + +[Strings] +CompanyName = "SoftEther Corporation" +DiskDescription = "VPN Client Device Driver Install Disk" +Neo.Service.Name = "Neo_VPN" +Neo.Service.DispName = "VPN Client Device Driver - VPN" +Neo.Service.Desc = "VPN Client Adapter - VPN" +NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN" +Neo.EventLog.Name = "Neo" +NetworkAddress = "MAC Address" +DefaultAddress = "000001000001" +MaxSpeed = "Indicate Speed (Mbps)" +KeepLink = "Keep Link" +On = "On" +Off = "Off" + + +; Auto Generated 20180205_163608.747 + diff --git a/src/bin/hamcore/DriverPackages/Neo6_Win8/x86/Neo6_x86_VPN10.inf b/src/bin/hamcore/DriverPackages/Neo6_Win8/x86/Neo6_x86_VPN10.inf index 01e1983e..356f291e 100644 --- a/src/bin/hamcore/DriverPackages/Neo6_Win8/x86/Neo6_x86_VPN10.inf +++ b/src/bin/hamcore/DriverPackages/Neo6_Win8/x86/Neo6_x86_VPN10.inf @@ -1,114 +1,114 @@ -; VPN Client Device Driver for Windows 2000 and Greater -; -; Copyright (c) SoftEther Corporation. All Rights Reserved. -; http://www.softether.co.jp/ -; -; BUILD 9658 - -[Version] -Signature = "$Windows NT$" -Class = Net -ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} -Provider = %CompanyName% -DriverVer = 02/04/2018, 4.25.0.9658 -CatalogFile.NT = inf_VPN10.cat - -[Manufacturer] -%CompanyName% = SoftEther - -[SourceDisksNames] -1=%DiskDescription%, "", , - -[SourceDisksFiles] -Neo_VPN10.sys = 1 - -[DestinationDirs] -DefaultDestDir = 12 -Neo.CopyFiles.Sys = 12 - -[Neo.CopyFiles.Sys] -Neo_VPN10.sys, , , 2 - -[SoftEther] -%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN10 - -[NeoAdapter.Install] -Characteristics = 0x1 -AddReg = Neo.Reg, NeoAdapter.Ndi -CopyFiles = Neo.CopyFiles.Sys -*IfType = 53 -*MediaType = 0 -*PhysicalMediaType = 0 - -[NeoAdapter.Install.Services] -AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% - -[NeoAdapter.Ndi] -HKR, , NetworkAddress, 0, %DefaultAddress% -HKR, Ndi, DeviceID, , "NeoAdapter_VPN10" -HKR, , DevLoader, , ndis -HKR, , DeviceVxDs, , Neo_VPN10.sys -HKR, NDIS, LogDriverName, , "Neo_VPN10" -HKR, NDIS, MajorNdisVersion, 1, 5 -HKR, NDIS, MinorNdisVersion, 1, 0 -HKR, Ndi\Interfaces, DefUpper, , "ndis5" -HKR, Ndi\Interfaces, UpperRange, , "ndis5" -HKR, Ndi\Interfaces, LowerRange, , "ethernet" -HKR, Ndi\Interfaces, DefLower, , "ethernet" -HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" -HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% -HKR, Ndi\Params\NetworkAddress, type, 0, "edit" -HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" -HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" -HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% -HKR, Ndi\Params\NetworkAddress, optional, 0, "0" -HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% -HKR, Ndi\Params\MaxSpeed, type, 0, "int" -HKR, Ndi\Params\MaxSpeed, default, 0, "100" -HKR, Ndi\Params\MaxSpeed, min, 0, "0" -HKR, Ndi\Params\MaxSpeed, max, 0, "2000" -HKR, Ndi\Params\MaxSpeed, step, 0, "1" -HKR, Ndi\Params\MaxSpeed, Base, 0, "10" -HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% -HKR, Ndi\Params\KeepLink, type, 0, "enum" -HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% -HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% -HKR, Ndi\Params\KeepLink, default, 0, "0" - - -[Neo.Service] -DisplayName = %Neo.Service.DispName% -Description = %Neo.Service.Desc% -ServiceType = 1 -StartType = 3 -ErrorControl = 1 -ServiceBinary = %12%\Neo_VPN10.sys -LoadOrderGroup = NDIS - -[Neo.Reg] -HKR, Ndi, Service, 0, Neo.Service.Name -HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" -HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" - -[Neo.EventLog] -HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN10.sys" -HKR, , TypesSupported, 0x00010001, 7 - -[Strings] -CompanyName = "SoftEther Corporation" -DiskDescription = "VPN Client Device Driver Install Disk" -Neo.Service.Name = "Neo_VPN10" -Neo.Service.DispName = "VPN Client Device Driver - VPN10" -Neo.Service.Desc = "VPN Client Adapter - VPN10" -NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN10" -Neo.EventLog.Name = "Neo" -NetworkAddress = "MAC Address" -DefaultAddress = "000001000001" -MaxSpeed = "Indicate Speed (Mbps)" -KeepLink = "Keep Link" -On = "On" -Off = "Off" - - -; Auto Generated 20180205_163608.757 - +; VPN Client Device Driver for Windows 2000 and Greater +; +; Copyright (c) SoftEther Corporation. All Rights Reserved. +; http://www.softether.co.jp/ +; +; BUILD 9658 + +[Version] +Signature = "$Windows NT$" +Class = Net +ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} +Provider = %CompanyName% +DriverVer = 02/04/2018, 4.25.0.9658 +CatalogFile.NT = inf_VPN10.cat + +[Manufacturer] +%CompanyName% = SoftEther + +[SourceDisksNames] +1=%DiskDescription%, "", , + +[SourceDisksFiles] +Neo_VPN10.sys = 1 + +[DestinationDirs] +DefaultDestDir = 12 +Neo.CopyFiles.Sys = 12 + +[Neo.CopyFiles.Sys] +Neo_VPN10.sys, , , 2 + +[SoftEther] +%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN10 + +[NeoAdapter.Install] +Characteristics = 0x1 +AddReg = Neo.Reg, NeoAdapter.Ndi +CopyFiles = Neo.CopyFiles.Sys +*IfType = 53 +*MediaType = 0 +*PhysicalMediaType = 0 + +[NeoAdapter.Install.Services] +AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% + +[NeoAdapter.Ndi] +HKR, , NetworkAddress, 0, %DefaultAddress% +HKR, Ndi, DeviceID, , "NeoAdapter_VPN10" +HKR, , DevLoader, , ndis +HKR, , DeviceVxDs, , Neo_VPN10.sys +HKR, NDIS, LogDriverName, , "Neo_VPN10" +HKR, NDIS, MajorNdisVersion, 1, 5 +HKR, NDIS, MinorNdisVersion, 1, 0 +HKR, Ndi\Interfaces, DefUpper, , "ndis5" +HKR, Ndi\Interfaces, UpperRange, , "ndis5" +HKR, Ndi\Interfaces, LowerRange, , "ethernet" +HKR, Ndi\Interfaces, DefLower, , "ethernet" +HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" +HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% +HKR, Ndi\Params\NetworkAddress, type, 0, "edit" +HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" +HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" +HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% +HKR, Ndi\Params\NetworkAddress, optional, 0, "0" +HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% +HKR, Ndi\Params\MaxSpeed, type, 0, "int" +HKR, Ndi\Params\MaxSpeed, default, 0, "100" +HKR, Ndi\Params\MaxSpeed, min, 0, "0" +HKR, Ndi\Params\MaxSpeed, max, 0, "2000" +HKR, Ndi\Params\MaxSpeed, step, 0, "1" +HKR, Ndi\Params\MaxSpeed, Base, 0, "10" +HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% +HKR, Ndi\Params\KeepLink, type, 0, "enum" +HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% +HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% +HKR, Ndi\Params\KeepLink, default, 0, "0" + + +[Neo.Service] +DisplayName = %Neo.Service.DispName% +Description = %Neo.Service.Desc% +ServiceType = 1 +StartType = 3 +ErrorControl = 1 +ServiceBinary = %12%\Neo_VPN10.sys +LoadOrderGroup = NDIS + +[Neo.Reg] +HKR, Ndi, Service, 0, Neo.Service.Name +HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" +HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" + +[Neo.EventLog] +HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN10.sys" +HKR, , TypesSupported, 0x00010001, 7 + +[Strings] +CompanyName = "SoftEther Corporation" +DiskDescription = "VPN Client Device Driver Install Disk" +Neo.Service.Name = "Neo_VPN10" +Neo.Service.DispName = "VPN Client Device Driver - VPN10" +Neo.Service.Desc = "VPN Client Adapter - VPN10" +NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN10" +Neo.EventLog.Name = "Neo" +NetworkAddress = "MAC Address" +DefaultAddress = "000001000001" +MaxSpeed = "Indicate Speed (Mbps)" +KeepLink = "Keep Link" +On = "On" +Off = "Off" + + +; Auto Generated 20180205_163608.757 + diff --git a/src/bin/hamcore/DriverPackages/Neo6_Win8/x86/Neo6_x86_VPN100.inf b/src/bin/hamcore/DriverPackages/Neo6_Win8/x86/Neo6_x86_VPN100.inf index 364d5426..2a73d9d9 100644 --- a/src/bin/hamcore/DriverPackages/Neo6_Win8/x86/Neo6_x86_VPN100.inf +++ b/src/bin/hamcore/DriverPackages/Neo6_Win8/x86/Neo6_x86_VPN100.inf @@ -1,114 +1,114 @@ -; VPN Client Device Driver for Windows 2000 and Greater -; -; Copyright (c) SoftEther Corporation. All Rights Reserved. -; http://www.softether.co.jp/ -; -; BUILD 9658 - -[Version] -Signature = "$Windows NT$" -Class = Net -ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} -Provider = %CompanyName% -DriverVer = 02/04/2018, 4.25.0.9658 -CatalogFile.NT = inf_VPN100.cat - -[Manufacturer] -%CompanyName% = SoftEther - -[SourceDisksNames] -1=%DiskDescription%, "", , - -[SourceDisksFiles] -Neo_VPN100.sys = 1 - -[DestinationDirs] -DefaultDestDir = 12 -Neo.CopyFiles.Sys = 12 - -[Neo.CopyFiles.Sys] -Neo_VPN100.sys, , , 2 - -[SoftEther] -%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN100 - -[NeoAdapter.Install] -Characteristics = 0x1 -AddReg = Neo.Reg, NeoAdapter.Ndi -CopyFiles = Neo.CopyFiles.Sys -*IfType = 53 -*MediaType = 0 -*PhysicalMediaType = 0 - -[NeoAdapter.Install.Services] -AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% - -[NeoAdapter.Ndi] -HKR, , NetworkAddress, 0, %DefaultAddress% -HKR, Ndi, DeviceID, , "NeoAdapter_VPN100" -HKR, , DevLoader, , ndis -HKR, , DeviceVxDs, , Neo_VPN100.sys -HKR, NDIS, LogDriverName, , "Neo_VPN100" -HKR, NDIS, MajorNdisVersion, 1, 5 -HKR, NDIS, MinorNdisVersion, 1, 0 -HKR, Ndi\Interfaces, DefUpper, , "ndis5" -HKR, Ndi\Interfaces, UpperRange, , "ndis5" -HKR, Ndi\Interfaces, LowerRange, , "ethernet" -HKR, Ndi\Interfaces, DefLower, , "ethernet" -HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" -HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% -HKR, Ndi\Params\NetworkAddress, type, 0, "edit" -HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" -HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" -HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% -HKR, Ndi\Params\NetworkAddress, optional, 0, "0" -HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% -HKR, Ndi\Params\MaxSpeed, type, 0, "int" -HKR, Ndi\Params\MaxSpeed, default, 0, "100" -HKR, Ndi\Params\MaxSpeed, min, 0, "0" -HKR, Ndi\Params\MaxSpeed, max, 0, "2000" -HKR, Ndi\Params\MaxSpeed, step, 0, "1" -HKR, Ndi\Params\MaxSpeed, Base, 0, "10" -HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% -HKR, Ndi\Params\KeepLink, type, 0, "enum" -HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% -HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% -HKR, Ndi\Params\KeepLink, default, 0, "0" - - -[Neo.Service] -DisplayName = %Neo.Service.DispName% -Description = %Neo.Service.Desc% -ServiceType = 1 -StartType = 3 -ErrorControl = 1 -ServiceBinary = %12%\Neo_VPN100.sys -LoadOrderGroup = NDIS - -[Neo.Reg] -HKR, Ndi, Service, 0, Neo.Service.Name -HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" -HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" - -[Neo.EventLog] -HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN100.sys" -HKR, , TypesSupported, 0x00010001, 7 - -[Strings] -CompanyName = "SoftEther Corporation" -DiskDescription = "VPN Client Device Driver Install Disk" -Neo.Service.Name = "Neo_VPN100" -Neo.Service.DispName = "VPN Client Device Driver - VPN100" -Neo.Service.Desc = "VPN Client Adapter - VPN100" -NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN100" -Neo.EventLog.Name = "Neo" -NetworkAddress = "MAC Address" -DefaultAddress = "000001000001" -MaxSpeed = "Indicate Speed (Mbps)" -KeepLink = "Keep Link" -On = "On" -Off = "Off" - - -; Auto Generated 20180205_163608.854 - +; VPN Client Device Driver for Windows 2000 and Greater +; +; Copyright (c) SoftEther Corporation. All Rights Reserved. +; http://www.softether.co.jp/ +; +; BUILD 9658 + +[Version] +Signature = "$Windows NT$" +Class = Net +ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} +Provider = %CompanyName% +DriverVer = 02/04/2018, 4.25.0.9658 +CatalogFile.NT = inf_VPN100.cat + +[Manufacturer] +%CompanyName% = SoftEther + +[SourceDisksNames] +1=%DiskDescription%, "", , + +[SourceDisksFiles] +Neo_VPN100.sys = 1 + +[DestinationDirs] +DefaultDestDir = 12 +Neo.CopyFiles.Sys = 12 + +[Neo.CopyFiles.Sys] +Neo_VPN100.sys, , , 2 + +[SoftEther] +%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN100 + +[NeoAdapter.Install] +Characteristics = 0x1 +AddReg = Neo.Reg, NeoAdapter.Ndi +CopyFiles = Neo.CopyFiles.Sys +*IfType = 53 +*MediaType = 0 +*PhysicalMediaType = 0 + +[NeoAdapter.Install.Services] +AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% + +[NeoAdapter.Ndi] +HKR, , NetworkAddress, 0, %DefaultAddress% +HKR, Ndi, DeviceID, , "NeoAdapter_VPN100" +HKR, , DevLoader, , ndis +HKR, , DeviceVxDs, , Neo_VPN100.sys +HKR, NDIS, LogDriverName, , "Neo_VPN100" +HKR, NDIS, MajorNdisVersion, 1, 5 +HKR, NDIS, MinorNdisVersion, 1, 0 +HKR, Ndi\Interfaces, DefUpper, , "ndis5" +HKR, Ndi\Interfaces, UpperRange, , "ndis5" +HKR, Ndi\Interfaces, LowerRange, , "ethernet" +HKR, Ndi\Interfaces, DefLower, , "ethernet" +HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" +HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% +HKR, Ndi\Params\NetworkAddress, type, 0, "edit" +HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" +HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" +HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% +HKR, Ndi\Params\NetworkAddress, optional, 0, "0" +HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% +HKR, Ndi\Params\MaxSpeed, type, 0, "int" +HKR, Ndi\Params\MaxSpeed, default, 0, "100" +HKR, Ndi\Params\MaxSpeed, min, 0, "0" +HKR, Ndi\Params\MaxSpeed, max, 0, "2000" +HKR, Ndi\Params\MaxSpeed, step, 0, "1" +HKR, Ndi\Params\MaxSpeed, Base, 0, "10" +HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% +HKR, Ndi\Params\KeepLink, type, 0, "enum" +HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% +HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% +HKR, Ndi\Params\KeepLink, default, 0, "0" + + +[Neo.Service] +DisplayName = %Neo.Service.DispName% +Description = %Neo.Service.Desc% +ServiceType = 1 +StartType = 3 +ErrorControl = 1 +ServiceBinary = %12%\Neo_VPN100.sys +LoadOrderGroup = NDIS + +[Neo.Reg] +HKR, Ndi, Service, 0, Neo.Service.Name +HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" +HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" + +[Neo.EventLog] +HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN100.sys" +HKR, , TypesSupported, 0x00010001, 7 + +[Strings] +CompanyName = "SoftEther Corporation" +DiskDescription = "VPN Client Device Driver Install Disk" +Neo.Service.Name = "Neo_VPN100" +Neo.Service.DispName = "VPN Client Device Driver - VPN100" +Neo.Service.Desc = "VPN Client Adapter - VPN100" +NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN100" +Neo.EventLog.Name = "Neo" +NetworkAddress = "MAC Address" +DefaultAddress = "000001000001" +MaxSpeed = "Indicate Speed (Mbps)" +KeepLink = "Keep Link" +On = "On" +Off = "Off" + + +; Auto Generated 20180205_163608.854 + diff --git a/src/bin/hamcore/DriverPackages/Neo6_Win8/x86/Neo6_x86_VPN101.inf b/src/bin/hamcore/DriverPackages/Neo6_Win8/x86/Neo6_x86_VPN101.inf index 62315530..f81f2a57 100644 --- a/src/bin/hamcore/DriverPackages/Neo6_Win8/x86/Neo6_x86_VPN101.inf +++ b/src/bin/hamcore/DriverPackages/Neo6_Win8/x86/Neo6_x86_VPN101.inf @@ -1,114 +1,114 @@ -; VPN Client Device Driver for Windows 2000 and Greater -; -; Copyright (c) SoftEther Corporation. All Rights Reserved. -; http://www.softether.co.jp/ -; -; BUILD 9658 - -[Version] -Signature = "$Windows NT$" -Class = Net -ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} -Provider = %CompanyName% -DriverVer = 02/04/2018, 4.25.0.9658 -CatalogFile.NT = inf_VPN101.cat - -[Manufacturer] -%CompanyName% = SoftEther - -[SourceDisksNames] -1=%DiskDescription%, "", , - -[SourceDisksFiles] -Neo_VPN101.sys = 1 - -[DestinationDirs] -DefaultDestDir = 12 -Neo.CopyFiles.Sys = 12 - -[Neo.CopyFiles.Sys] -Neo_VPN101.sys, , , 2 - -[SoftEther] -%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN101 - -[NeoAdapter.Install] -Characteristics = 0x1 -AddReg = Neo.Reg, NeoAdapter.Ndi -CopyFiles = Neo.CopyFiles.Sys -*IfType = 53 -*MediaType = 0 -*PhysicalMediaType = 0 - -[NeoAdapter.Install.Services] -AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% - -[NeoAdapter.Ndi] -HKR, , NetworkAddress, 0, %DefaultAddress% -HKR, Ndi, DeviceID, , "NeoAdapter_VPN101" -HKR, , DevLoader, , ndis -HKR, , DeviceVxDs, , Neo_VPN101.sys -HKR, NDIS, LogDriverName, , "Neo_VPN101" -HKR, NDIS, MajorNdisVersion, 1, 5 -HKR, NDIS, MinorNdisVersion, 1, 0 -HKR, Ndi\Interfaces, DefUpper, , "ndis5" -HKR, Ndi\Interfaces, UpperRange, , "ndis5" -HKR, Ndi\Interfaces, LowerRange, , "ethernet" -HKR, Ndi\Interfaces, DefLower, , "ethernet" -HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" -HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% -HKR, Ndi\Params\NetworkAddress, type, 0, "edit" -HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" -HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" -HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% -HKR, Ndi\Params\NetworkAddress, optional, 0, "0" -HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% -HKR, Ndi\Params\MaxSpeed, type, 0, "int" -HKR, Ndi\Params\MaxSpeed, default, 0, "100" -HKR, Ndi\Params\MaxSpeed, min, 0, "0" -HKR, Ndi\Params\MaxSpeed, max, 0, "2000" -HKR, Ndi\Params\MaxSpeed, step, 0, "1" -HKR, Ndi\Params\MaxSpeed, Base, 0, "10" -HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% -HKR, Ndi\Params\KeepLink, type, 0, "enum" -HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% -HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% -HKR, Ndi\Params\KeepLink, default, 0, "0" - - -[Neo.Service] -DisplayName = %Neo.Service.DispName% -Description = %Neo.Service.Desc% -ServiceType = 1 -StartType = 3 -ErrorControl = 1 -ServiceBinary = %12%\Neo_VPN101.sys -LoadOrderGroup = NDIS - -[Neo.Reg] -HKR, Ndi, Service, 0, Neo.Service.Name -HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" -HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" - -[Neo.EventLog] -HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN101.sys" -HKR, , TypesSupported, 0x00010001, 7 - -[Strings] -CompanyName = "SoftEther Corporation" -DiskDescription = "VPN Client Device Driver Install Disk" -Neo.Service.Name = "Neo_VPN101" -Neo.Service.DispName = "VPN Client Device Driver - VPN101" -Neo.Service.Desc = "VPN Client Adapter - VPN101" -NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN101" -Neo.EventLog.Name = "Neo" -NetworkAddress = "MAC Address" -DefaultAddress = "000001000001" -MaxSpeed = "Indicate Speed (Mbps)" -KeepLink = "Keep Link" -On = "On" -Off = "Off" - - -; Auto Generated 20180205_163608.855 - +; VPN Client Device Driver for Windows 2000 and Greater +; +; Copyright (c) SoftEther Corporation. All Rights Reserved. +; http://www.softether.co.jp/ +; +; BUILD 9658 + +[Version] +Signature = "$Windows NT$" +Class = Net +ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} +Provider = %CompanyName% +DriverVer = 02/04/2018, 4.25.0.9658 +CatalogFile.NT = inf_VPN101.cat + +[Manufacturer] +%CompanyName% = SoftEther + +[SourceDisksNames] +1=%DiskDescription%, "", , + +[SourceDisksFiles] +Neo_VPN101.sys = 1 + +[DestinationDirs] +DefaultDestDir = 12 +Neo.CopyFiles.Sys = 12 + +[Neo.CopyFiles.Sys] +Neo_VPN101.sys, , , 2 + +[SoftEther] +%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN101 + +[NeoAdapter.Install] +Characteristics = 0x1 +AddReg = Neo.Reg, NeoAdapter.Ndi +CopyFiles = Neo.CopyFiles.Sys +*IfType = 53 +*MediaType = 0 +*PhysicalMediaType = 0 + +[NeoAdapter.Install.Services] +AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% + +[NeoAdapter.Ndi] +HKR, , NetworkAddress, 0, %DefaultAddress% +HKR, Ndi, DeviceID, , "NeoAdapter_VPN101" +HKR, , DevLoader, , ndis +HKR, , DeviceVxDs, , Neo_VPN101.sys +HKR, NDIS, LogDriverName, , "Neo_VPN101" +HKR, NDIS, MajorNdisVersion, 1, 5 +HKR, NDIS, MinorNdisVersion, 1, 0 +HKR, Ndi\Interfaces, DefUpper, , "ndis5" +HKR, Ndi\Interfaces, UpperRange, , "ndis5" +HKR, Ndi\Interfaces, LowerRange, , "ethernet" +HKR, Ndi\Interfaces, DefLower, , "ethernet" +HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" +HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% +HKR, Ndi\Params\NetworkAddress, type, 0, "edit" +HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" +HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" +HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% +HKR, Ndi\Params\NetworkAddress, optional, 0, "0" +HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% +HKR, Ndi\Params\MaxSpeed, type, 0, "int" +HKR, Ndi\Params\MaxSpeed, default, 0, "100" +HKR, Ndi\Params\MaxSpeed, min, 0, "0" +HKR, Ndi\Params\MaxSpeed, max, 0, "2000" +HKR, Ndi\Params\MaxSpeed, step, 0, "1" +HKR, Ndi\Params\MaxSpeed, Base, 0, "10" +HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% +HKR, Ndi\Params\KeepLink, type, 0, "enum" +HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% +HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% +HKR, Ndi\Params\KeepLink, default, 0, "0" + + +[Neo.Service] +DisplayName = %Neo.Service.DispName% +Description = %Neo.Service.Desc% +ServiceType = 1 +StartType = 3 +ErrorControl = 1 +ServiceBinary = %12%\Neo_VPN101.sys +LoadOrderGroup = NDIS + +[Neo.Reg] +HKR, Ndi, Service, 0, Neo.Service.Name +HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" +HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" + +[Neo.EventLog] +HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN101.sys" +HKR, , TypesSupported, 0x00010001, 7 + +[Strings] +CompanyName = "SoftEther Corporation" +DiskDescription = "VPN Client Device Driver Install Disk" +Neo.Service.Name = "Neo_VPN101" +Neo.Service.DispName = "VPN Client Device Driver - VPN101" +Neo.Service.Desc = "VPN Client Adapter - VPN101" +NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN101" +Neo.EventLog.Name = "Neo" +NetworkAddress = "MAC Address" +DefaultAddress = "000001000001" +MaxSpeed = "Indicate Speed (Mbps)" +KeepLink = "Keep Link" +On = "On" +Off = "Off" + + +; Auto Generated 20180205_163608.855 + diff --git a/src/bin/hamcore/DriverPackages/Neo6_Win8/x86/Neo6_x86_VPN102.inf b/src/bin/hamcore/DriverPackages/Neo6_Win8/x86/Neo6_x86_VPN102.inf index 41f1e305..66634d9b 100644 --- a/src/bin/hamcore/DriverPackages/Neo6_Win8/x86/Neo6_x86_VPN102.inf +++ b/src/bin/hamcore/DriverPackages/Neo6_Win8/x86/Neo6_x86_VPN102.inf @@ -1,114 +1,114 @@ -; VPN Client Device Driver for Windows 2000 and Greater -; -; Copyright (c) SoftEther Corporation. All Rights Reserved. -; http://www.softether.co.jp/ -; -; BUILD 9658 - -[Version] -Signature = "$Windows NT$" -Class = Net -ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} -Provider = %CompanyName% -DriverVer = 02/04/2018, 4.25.0.9658 -CatalogFile.NT = inf_VPN102.cat - -[Manufacturer] -%CompanyName% = SoftEther - -[SourceDisksNames] -1=%DiskDescription%, "", , - -[SourceDisksFiles] -Neo_VPN102.sys = 1 - -[DestinationDirs] -DefaultDestDir = 12 -Neo.CopyFiles.Sys = 12 - -[Neo.CopyFiles.Sys] -Neo_VPN102.sys, , , 2 - -[SoftEther] -%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN102 - -[NeoAdapter.Install] -Characteristics = 0x1 -AddReg = Neo.Reg, NeoAdapter.Ndi -CopyFiles = Neo.CopyFiles.Sys -*IfType = 53 -*MediaType = 0 -*PhysicalMediaType = 0 - -[NeoAdapter.Install.Services] -AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% - -[NeoAdapter.Ndi] -HKR, , NetworkAddress, 0, %DefaultAddress% -HKR, Ndi, DeviceID, , "NeoAdapter_VPN102" -HKR, , DevLoader, , ndis -HKR, , DeviceVxDs, , Neo_VPN102.sys -HKR, NDIS, LogDriverName, , "Neo_VPN102" -HKR, NDIS, MajorNdisVersion, 1, 5 -HKR, NDIS, MinorNdisVersion, 1, 0 -HKR, Ndi\Interfaces, DefUpper, , "ndis5" -HKR, Ndi\Interfaces, UpperRange, , "ndis5" -HKR, Ndi\Interfaces, LowerRange, , "ethernet" -HKR, Ndi\Interfaces, DefLower, , "ethernet" -HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" -HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% -HKR, Ndi\Params\NetworkAddress, type, 0, "edit" -HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" -HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" -HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% -HKR, Ndi\Params\NetworkAddress, optional, 0, "0" -HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% -HKR, Ndi\Params\MaxSpeed, type, 0, "int" -HKR, Ndi\Params\MaxSpeed, default, 0, "100" -HKR, Ndi\Params\MaxSpeed, min, 0, "0" -HKR, Ndi\Params\MaxSpeed, max, 0, "2000" -HKR, Ndi\Params\MaxSpeed, step, 0, "1" -HKR, Ndi\Params\MaxSpeed, Base, 0, "10" -HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% -HKR, Ndi\Params\KeepLink, type, 0, "enum" -HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% -HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% -HKR, Ndi\Params\KeepLink, default, 0, "0" - - -[Neo.Service] -DisplayName = %Neo.Service.DispName% -Description = %Neo.Service.Desc% -ServiceType = 1 -StartType = 3 -ErrorControl = 1 -ServiceBinary = %12%\Neo_VPN102.sys -LoadOrderGroup = NDIS - -[Neo.Reg] -HKR, Ndi, Service, 0, Neo.Service.Name -HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" -HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" - -[Neo.EventLog] -HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN102.sys" -HKR, , TypesSupported, 0x00010001, 7 - -[Strings] -CompanyName = "SoftEther Corporation" -DiskDescription = "VPN Client Device Driver Install Disk" -Neo.Service.Name = "Neo_VPN102" -Neo.Service.DispName = "VPN Client Device Driver - VPN102" -Neo.Service.Desc = "VPN Client Adapter - VPN102" -NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN102" -Neo.EventLog.Name = "Neo" -NetworkAddress = "MAC Address" -DefaultAddress = "000001000001" -MaxSpeed = "Indicate Speed (Mbps)" -KeepLink = "Keep Link" -On = "On" -Off = "Off" - - -; Auto Generated 20180205_163608.856 - +; VPN Client Device Driver for Windows 2000 and Greater +; +; Copyright (c) SoftEther Corporation. All Rights Reserved. +; http://www.softether.co.jp/ +; +; BUILD 9658 + +[Version] +Signature = "$Windows NT$" +Class = Net +ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} +Provider = %CompanyName% +DriverVer = 02/04/2018, 4.25.0.9658 +CatalogFile.NT = inf_VPN102.cat + +[Manufacturer] +%CompanyName% = SoftEther + +[SourceDisksNames] +1=%DiskDescription%, "", , + +[SourceDisksFiles] +Neo_VPN102.sys = 1 + +[DestinationDirs] +DefaultDestDir = 12 +Neo.CopyFiles.Sys = 12 + +[Neo.CopyFiles.Sys] +Neo_VPN102.sys, , , 2 + +[SoftEther] +%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN102 + +[NeoAdapter.Install] +Characteristics = 0x1 +AddReg = Neo.Reg, NeoAdapter.Ndi +CopyFiles = Neo.CopyFiles.Sys +*IfType = 53 +*MediaType = 0 +*PhysicalMediaType = 0 + +[NeoAdapter.Install.Services] +AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% + +[NeoAdapter.Ndi] +HKR, , NetworkAddress, 0, %DefaultAddress% +HKR, Ndi, DeviceID, , "NeoAdapter_VPN102" +HKR, , DevLoader, , ndis +HKR, , DeviceVxDs, , Neo_VPN102.sys +HKR, NDIS, LogDriverName, , "Neo_VPN102" +HKR, NDIS, MajorNdisVersion, 1, 5 +HKR, NDIS, MinorNdisVersion, 1, 0 +HKR, Ndi\Interfaces, DefUpper, , "ndis5" +HKR, Ndi\Interfaces, UpperRange, , "ndis5" +HKR, Ndi\Interfaces, LowerRange, , "ethernet" +HKR, Ndi\Interfaces, DefLower, , "ethernet" +HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" +HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% +HKR, Ndi\Params\NetworkAddress, type, 0, "edit" +HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" +HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" +HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% +HKR, Ndi\Params\NetworkAddress, optional, 0, "0" +HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% +HKR, Ndi\Params\MaxSpeed, type, 0, "int" +HKR, Ndi\Params\MaxSpeed, default, 0, "100" +HKR, Ndi\Params\MaxSpeed, min, 0, "0" +HKR, Ndi\Params\MaxSpeed, max, 0, "2000" +HKR, Ndi\Params\MaxSpeed, step, 0, "1" +HKR, Ndi\Params\MaxSpeed, Base, 0, "10" +HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% +HKR, Ndi\Params\KeepLink, type, 0, "enum" +HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% +HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% +HKR, Ndi\Params\KeepLink, default, 0, "0" + + +[Neo.Service] +DisplayName = %Neo.Service.DispName% +Description = %Neo.Service.Desc% +ServiceType = 1 +StartType = 3 +ErrorControl = 1 +ServiceBinary = %12%\Neo_VPN102.sys +LoadOrderGroup = NDIS + +[Neo.Reg] +HKR, Ndi, Service, 0, Neo.Service.Name +HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" +HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" + +[Neo.EventLog] +HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN102.sys" +HKR, , TypesSupported, 0x00010001, 7 + +[Strings] +CompanyName = "SoftEther Corporation" +DiskDescription = "VPN Client Device Driver Install Disk" +Neo.Service.Name = "Neo_VPN102" +Neo.Service.DispName = "VPN Client Device Driver - VPN102" +Neo.Service.Desc = "VPN Client Adapter - VPN102" +NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN102" +Neo.EventLog.Name = "Neo" +NetworkAddress = "MAC Address" +DefaultAddress = "000001000001" +MaxSpeed = "Indicate Speed (Mbps)" +KeepLink = "Keep Link" +On = "On" +Off = "Off" + + +; Auto Generated 20180205_163608.856 + diff --git a/src/bin/hamcore/DriverPackages/Neo6_Win8/x86/Neo6_x86_VPN103.inf b/src/bin/hamcore/DriverPackages/Neo6_Win8/x86/Neo6_x86_VPN103.inf index e33b3380..8a610ff9 100644 --- a/src/bin/hamcore/DriverPackages/Neo6_Win8/x86/Neo6_x86_VPN103.inf +++ b/src/bin/hamcore/DriverPackages/Neo6_Win8/x86/Neo6_x86_VPN103.inf @@ -1,114 +1,114 @@ -; VPN Client Device Driver for Windows 2000 and Greater -; -; Copyright (c) SoftEther Corporation. All Rights Reserved. -; http://www.softether.co.jp/ -; -; BUILD 9658 - -[Version] -Signature = "$Windows NT$" -Class = Net -ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} -Provider = %CompanyName% -DriverVer = 02/04/2018, 4.25.0.9658 -CatalogFile.NT = inf_VPN103.cat - -[Manufacturer] -%CompanyName% = SoftEther - -[SourceDisksNames] -1=%DiskDescription%, "", , - -[SourceDisksFiles] -Neo_VPN103.sys = 1 - -[DestinationDirs] -DefaultDestDir = 12 -Neo.CopyFiles.Sys = 12 - -[Neo.CopyFiles.Sys] -Neo_VPN103.sys, , , 2 - -[SoftEther] -%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN103 - -[NeoAdapter.Install] -Characteristics = 0x1 -AddReg = Neo.Reg, NeoAdapter.Ndi -CopyFiles = Neo.CopyFiles.Sys -*IfType = 53 -*MediaType = 0 -*PhysicalMediaType = 0 - -[NeoAdapter.Install.Services] -AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% - -[NeoAdapter.Ndi] -HKR, , NetworkAddress, 0, %DefaultAddress% -HKR, Ndi, DeviceID, , "NeoAdapter_VPN103" -HKR, , DevLoader, , ndis -HKR, , DeviceVxDs, , Neo_VPN103.sys -HKR, NDIS, LogDriverName, , "Neo_VPN103" -HKR, NDIS, MajorNdisVersion, 1, 5 -HKR, NDIS, MinorNdisVersion, 1, 0 -HKR, Ndi\Interfaces, DefUpper, , "ndis5" -HKR, Ndi\Interfaces, UpperRange, , "ndis5" -HKR, Ndi\Interfaces, LowerRange, , "ethernet" -HKR, Ndi\Interfaces, DefLower, , "ethernet" -HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" -HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% -HKR, Ndi\Params\NetworkAddress, type, 0, "edit" -HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" -HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" -HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% -HKR, Ndi\Params\NetworkAddress, optional, 0, "0" -HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% -HKR, Ndi\Params\MaxSpeed, type, 0, "int" -HKR, Ndi\Params\MaxSpeed, default, 0, "100" -HKR, Ndi\Params\MaxSpeed, min, 0, "0" -HKR, Ndi\Params\MaxSpeed, max, 0, "2000" -HKR, Ndi\Params\MaxSpeed, step, 0, "1" -HKR, Ndi\Params\MaxSpeed, Base, 0, "10" -HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% -HKR, Ndi\Params\KeepLink, type, 0, "enum" -HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% -HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% -HKR, Ndi\Params\KeepLink, default, 0, "0" - - -[Neo.Service] -DisplayName = %Neo.Service.DispName% -Description = %Neo.Service.Desc% -ServiceType = 1 -StartType = 3 -ErrorControl = 1 -ServiceBinary = %12%\Neo_VPN103.sys -LoadOrderGroup = NDIS - -[Neo.Reg] -HKR, Ndi, Service, 0, Neo.Service.Name -HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" -HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" - -[Neo.EventLog] -HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN103.sys" -HKR, , TypesSupported, 0x00010001, 7 - -[Strings] -CompanyName = "SoftEther Corporation" -DiskDescription = "VPN Client Device Driver Install Disk" -Neo.Service.Name = "Neo_VPN103" -Neo.Service.DispName = "VPN Client Device Driver - VPN103" -Neo.Service.Desc = "VPN Client Adapter - VPN103" -NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN103" -Neo.EventLog.Name = "Neo" -NetworkAddress = "MAC Address" -DefaultAddress = "000001000001" -MaxSpeed = "Indicate Speed (Mbps)" -KeepLink = "Keep Link" -On = "On" -Off = "Off" - - -; Auto Generated 20180205_163608.857 - +; VPN Client Device Driver for Windows 2000 and Greater +; +; Copyright (c) SoftEther Corporation. All Rights Reserved. +; http://www.softether.co.jp/ +; +; BUILD 9658 + +[Version] +Signature = "$Windows NT$" +Class = Net +ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} +Provider = %CompanyName% +DriverVer = 02/04/2018, 4.25.0.9658 +CatalogFile.NT = inf_VPN103.cat + +[Manufacturer] +%CompanyName% = SoftEther + +[SourceDisksNames] +1=%DiskDescription%, "", , + +[SourceDisksFiles] +Neo_VPN103.sys = 1 + +[DestinationDirs] +DefaultDestDir = 12 +Neo.CopyFiles.Sys = 12 + +[Neo.CopyFiles.Sys] +Neo_VPN103.sys, , , 2 + +[SoftEther] +%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN103 + +[NeoAdapter.Install] +Characteristics = 0x1 +AddReg = Neo.Reg, NeoAdapter.Ndi +CopyFiles = Neo.CopyFiles.Sys +*IfType = 53 +*MediaType = 0 +*PhysicalMediaType = 0 + +[NeoAdapter.Install.Services] +AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% + +[NeoAdapter.Ndi] +HKR, , NetworkAddress, 0, %DefaultAddress% +HKR, Ndi, DeviceID, , "NeoAdapter_VPN103" +HKR, , DevLoader, , ndis +HKR, , DeviceVxDs, , Neo_VPN103.sys +HKR, NDIS, LogDriverName, , "Neo_VPN103" +HKR, NDIS, MajorNdisVersion, 1, 5 +HKR, NDIS, MinorNdisVersion, 1, 0 +HKR, Ndi\Interfaces, DefUpper, , "ndis5" +HKR, Ndi\Interfaces, UpperRange, , "ndis5" +HKR, Ndi\Interfaces, LowerRange, , "ethernet" +HKR, Ndi\Interfaces, DefLower, , "ethernet" +HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" +HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% +HKR, Ndi\Params\NetworkAddress, type, 0, "edit" +HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" +HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" +HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% +HKR, Ndi\Params\NetworkAddress, optional, 0, "0" +HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% +HKR, Ndi\Params\MaxSpeed, type, 0, "int" +HKR, Ndi\Params\MaxSpeed, default, 0, "100" +HKR, Ndi\Params\MaxSpeed, min, 0, "0" +HKR, Ndi\Params\MaxSpeed, max, 0, "2000" +HKR, Ndi\Params\MaxSpeed, step, 0, "1" +HKR, Ndi\Params\MaxSpeed, Base, 0, "10" +HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% +HKR, Ndi\Params\KeepLink, type, 0, "enum" +HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% +HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% +HKR, Ndi\Params\KeepLink, default, 0, "0" + + +[Neo.Service] +DisplayName = %Neo.Service.DispName% +Description = %Neo.Service.Desc% +ServiceType = 1 +StartType = 3 +ErrorControl = 1 +ServiceBinary = %12%\Neo_VPN103.sys +LoadOrderGroup = NDIS + +[Neo.Reg] +HKR, Ndi, Service, 0, Neo.Service.Name +HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" +HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" + +[Neo.EventLog] +HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN103.sys" +HKR, , TypesSupported, 0x00010001, 7 + +[Strings] +CompanyName = "SoftEther Corporation" +DiskDescription = "VPN Client Device Driver Install Disk" +Neo.Service.Name = "Neo_VPN103" +Neo.Service.DispName = "VPN Client Device Driver - VPN103" +Neo.Service.Desc = "VPN Client Adapter - VPN103" +NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN103" +Neo.EventLog.Name = "Neo" +NetworkAddress = "MAC Address" +DefaultAddress = "000001000001" +MaxSpeed = "Indicate Speed (Mbps)" +KeepLink = "Keep Link" +On = "On" +Off = "Off" + + +; Auto Generated 20180205_163608.857 + diff --git a/src/bin/hamcore/DriverPackages/Neo6_Win8/x86/Neo6_x86_VPN104.inf b/src/bin/hamcore/DriverPackages/Neo6_Win8/x86/Neo6_x86_VPN104.inf index 5d72d90d..d371a7c0 100644 --- a/src/bin/hamcore/DriverPackages/Neo6_Win8/x86/Neo6_x86_VPN104.inf +++ b/src/bin/hamcore/DriverPackages/Neo6_Win8/x86/Neo6_x86_VPN104.inf @@ -1,114 +1,114 @@ -; VPN Client Device Driver for Windows 2000 and Greater -; -; Copyright (c) SoftEther Corporation. All Rights Reserved. -; http://www.softether.co.jp/ -; -; BUILD 9658 - -[Version] -Signature = "$Windows NT$" -Class = Net -ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} -Provider = %CompanyName% -DriverVer = 02/04/2018, 4.25.0.9658 -CatalogFile.NT = inf_VPN104.cat - -[Manufacturer] -%CompanyName% = SoftEther - -[SourceDisksNames] -1=%DiskDescription%, "", , - -[SourceDisksFiles] -Neo_VPN104.sys = 1 - -[DestinationDirs] -DefaultDestDir = 12 -Neo.CopyFiles.Sys = 12 - -[Neo.CopyFiles.Sys] -Neo_VPN104.sys, , , 2 - -[SoftEther] -%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN104 - -[NeoAdapter.Install] -Characteristics = 0x1 -AddReg = Neo.Reg, NeoAdapter.Ndi -CopyFiles = Neo.CopyFiles.Sys -*IfType = 53 -*MediaType = 0 -*PhysicalMediaType = 0 - -[NeoAdapter.Install.Services] -AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% - -[NeoAdapter.Ndi] -HKR, , NetworkAddress, 0, %DefaultAddress% -HKR, Ndi, DeviceID, , "NeoAdapter_VPN104" -HKR, , DevLoader, , ndis -HKR, , DeviceVxDs, , Neo_VPN104.sys -HKR, NDIS, LogDriverName, , "Neo_VPN104" -HKR, NDIS, MajorNdisVersion, 1, 5 -HKR, NDIS, MinorNdisVersion, 1, 0 -HKR, Ndi\Interfaces, DefUpper, , "ndis5" -HKR, Ndi\Interfaces, UpperRange, , "ndis5" -HKR, Ndi\Interfaces, LowerRange, , "ethernet" -HKR, Ndi\Interfaces, DefLower, , "ethernet" -HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" -HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% -HKR, Ndi\Params\NetworkAddress, type, 0, "edit" -HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" -HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" -HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% -HKR, Ndi\Params\NetworkAddress, optional, 0, "0" -HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% -HKR, Ndi\Params\MaxSpeed, type, 0, "int" -HKR, Ndi\Params\MaxSpeed, default, 0, "100" -HKR, Ndi\Params\MaxSpeed, min, 0, "0" -HKR, Ndi\Params\MaxSpeed, max, 0, "2000" -HKR, Ndi\Params\MaxSpeed, step, 0, "1" -HKR, Ndi\Params\MaxSpeed, Base, 0, "10" -HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% -HKR, Ndi\Params\KeepLink, type, 0, "enum" -HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% -HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% -HKR, Ndi\Params\KeepLink, default, 0, "0" - - -[Neo.Service] -DisplayName = %Neo.Service.DispName% -Description = %Neo.Service.Desc% -ServiceType = 1 -StartType = 3 -ErrorControl = 1 -ServiceBinary = %12%\Neo_VPN104.sys -LoadOrderGroup = NDIS - -[Neo.Reg] -HKR, Ndi, Service, 0, Neo.Service.Name -HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" -HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" - -[Neo.EventLog] -HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN104.sys" -HKR, , TypesSupported, 0x00010001, 7 - -[Strings] -CompanyName = "SoftEther Corporation" -DiskDescription = "VPN Client Device Driver Install Disk" -Neo.Service.Name = "Neo_VPN104" -Neo.Service.DispName = "VPN Client Device Driver - VPN104" -Neo.Service.Desc = "VPN Client Adapter - VPN104" -NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN104" -Neo.EventLog.Name = "Neo" -NetworkAddress = "MAC Address" -DefaultAddress = "000001000001" -MaxSpeed = "Indicate Speed (Mbps)" -KeepLink = "Keep Link" -On = "On" -Off = "Off" - - -; Auto Generated 20180205_163608.858 - +; VPN Client Device Driver for Windows 2000 and Greater +; +; Copyright (c) SoftEther Corporation. All Rights Reserved. +; http://www.softether.co.jp/ +; +; BUILD 9658 + +[Version] +Signature = "$Windows NT$" +Class = Net +ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} +Provider = %CompanyName% +DriverVer = 02/04/2018, 4.25.0.9658 +CatalogFile.NT = inf_VPN104.cat + +[Manufacturer] +%CompanyName% = SoftEther + +[SourceDisksNames] +1=%DiskDescription%, "", , + +[SourceDisksFiles] +Neo_VPN104.sys = 1 + +[DestinationDirs] +DefaultDestDir = 12 +Neo.CopyFiles.Sys = 12 + +[Neo.CopyFiles.Sys] +Neo_VPN104.sys, , , 2 + +[SoftEther] +%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN104 + +[NeoAdapter.Install] +Characteristics = 0x1 +AddReg = Neo.Reg, NeoAdapter.Ndi +CopyFiles = Neo.CopyFiles.Sys +*IfType = 53 +*MediaType = 0 +*PhysicalMediaType = 0 + +[NeoAdapter.Install.Services] +AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% + +[NeoAdapter.Ndi] +HKR, , NetworkAddress, 0, %DefaultAddress% +HKR, Ndi, DeviceID, , "NeoAdapter_VPN104" +HKR, , DevLoader, , ndis +HKR, , DeviceVxDs, , Neo_VPN104.sys +HKR, NDIS, LogDriverName, , "Neo_VPN104" +HKR, NDIS, MajorNdisVersion, 1, 5 +HKR, NDIS, MinorNdisVersion, 1, 0 +HKR, Ndi\Interfaces, DefUpper, , "ndis5" +HKR, Ndi\Interfaces, UpperRange, , "ndis5" +HKR, Ndi\Interfaces, LowerRange, , "ethernet" +HKR, Ndi\Interfaces, DefLower, , "ethernet" +HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" +HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% +HKR, Ndi\Params\NetworkAddress, type, 0, "edit" +HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" +HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" +HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% +HKR, Ndi\Params\NetworkAddress, optional, 0, "0" +HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% +HKR, Ndi\Params\MaxSpeed, type, 0, "int" +HKR, Ndi\Params\MaxSpeed, default, 0, "100" +HKR, Ndi\Params\MaxSpeed, min, 0, "0" +HKR, Ndi\Params\MaxSpeed, max, 0, "2000" +HKR, Ndi\Params\MaxSpeed, step, 0, "1" +HKR, Ndi\Params\MaxSpeed, Base, 0, "10" +HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% +HKR, Ndi\Params\KeepLink, type, 0, "enum" +HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% +HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% +HKR, Ndi\Params\KeepLink, default, 0, "0" + + +[Neo.Service] +DisplayName = %Neo.Service.DispName% +Description = %Neo.Service.Desc% +ServiceType = 1 +StartType = 3 +ErrorControl = 1 +ServiceBinary = %12%\Neo_VPN104.sys +LoadOrderGroup = NDIS + +[Neo.Reg] +HKR, Ndi, Service, 0, Neo.Service.Name +HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" +HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" + +[Neo.EventLog] +HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN104.sys" +HKR, , TypesSupported, 0x00010001, 7 + +[Strings] +CompanyName = "SoftEther Corporation" +DiskDescription = "VPN Client Device Driver Install Disk" +Neo.Service.Name = "Neo_VPN104" +Neo.Service.DispName = "VPN Client Device Driver - VPN104" +Neo.Service.Desc = "VPN Client Adapter - VPN104" +NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN104" +Neo.EventLog.Name = "Neo" +NetworkAddress = "MAC Address" +DefaultAddress = "000001000001" +MaxSpeed = "Indicate Speed (Mbps)" +KeepLink = "Keep Link" +On = "On" +Off = "Off" + + +; Auto Generated 20180205_163608.858 + diff --git a/src/bin/hamcore/DriverPackages/Neo6_Win8/x86/Neo6_x86_VPN105.inf b/src/bin/hamcore/DriverPackages/Neo6_Win8/x86/Neo6_x86_VPN105.inf index b9c1e9ee..4b54caef 100644 --- a/src/bin/hamcore/DriverPackages/Neo6_Win8/x86/Neo6_x86_VPN105.inf +++ b/src/bin/hamcore/DriverPackages/Neo6_Win8/x86/Neo6_x86_VPN105.inf @@ -1,114 +1,114 @@ -; VPN Client Device Driver for Windows 2000 and Greater -; -; Copyright (c) SoftEther Corporation. All Rights Reserved. -; http://www.softether.co.jp/ -; -; BUILD 9658 - -[Version] -Signature = "$Windows NT$" -Class = Net -ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} -Provider = %CompanyName% -DriverVer = 02/04/2018, 4.25.0.9658 -CatalogFile.NT = inf_VPN105.cat - -[Manufacturer] -%CompanyName% = SoftEther - -[SourceDisksNames] -1=%DiskDescription%, "", , - -[SourceDisksFiles] -Neo_VPN105.sys = 1 - -[DestinationDirs] -DefaultDestDir = 12 -Neo.CopyFiles.Sys = 12 - -[Neo.CopyFiles.Sys] -Neo_VPN105.sys, , , 2 - -[SoftEther] -%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN105 - -[NeoAdapter.Install] -Characteristics = 0x1 -AddReg = Neo.Reg, NeoAdapter.Ndi -CopyFiles = Neo.CopyFiles.Sys -*IfType = 53 -*MediaType = 0 -*PhysicalMediaType = 0 - -[NeoAdapter.Install.Services] -AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% - -[NeoAdapter.Ndi] -HKR, , NetworkAddress, 0, %DefaultAddress% -HKR, Ndi, DeviceID, , "NeoAdapter_VPN105" -HKR, , DevLoader, , ndis -HKR, , DeviceVxDs, , Neo_VPN105.sys -HKR, NDIS, LogDriverName, , "Neo_VPN105" -HKR, NDIS, MajorNdisVersion, 1, 5 -HKR, NDIS, MinorNdisVersion, 1, 0 -HKR, Ndi\Interfaces, DefUpper, , "ndis5" -HKR, Ndi\Interfaces, UpperRange, , "ndis5" -HKR, Ndi\Interfaces, LowerRange, , "ethernet" -HKR, Ndi\Interfaces, DefLower, , "ethernet" -HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" -HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% -HKR, Ndi\Params\NetworkAddress, type, 0, "edit" -HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" -HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" -HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% -HKR, Ndi\Params\NetworkAddress, optional, 0, "0" -HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% -HKR, Ndi\Params\MaxSpeed, type, 0, "int" -HKR, Ndi\Params\MaxSpeed, default, 0, "100" -HKR, Ndi\Params\MaxSpeed, min, 0, "0" -HKR, Ndi\Params\MaxSpeed, max, 0, "2000" -HKR, Ndi\Params\MaxSpeed, step, 0, "1" -HKR, Ndi\Params\MaxSpeed, Base, 0, "10" -HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% -HKR, Ndi\Params\KeepLink, type, 0, "enum" -HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% -HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% -HKR, Ndi\Params\KeepLink, default, 0, "0" - - -[Neo.Service] -DisplayName = %Neo.Service.DispName% -Description = %Neo.Service.Desc% -ServiceType = 1 -StartType = 3 -ErrorControl = 1 -ServiceBinary = %12%\Neo_VPN105.sys -LoadOrderGroup = NDIS - -[Neo.Reg] -HKR, Ndi, Service, 0, Neo.Service.Name -HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" -HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" - -[Neo.EventLog] -HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN105.sys" -HKR, , TypesSupported, 0x00010001, 7 - -[Strings] -CompanyName = "SoftEther Corporation" -DiskDescription = "VPN Client Device Driver Install Disk" -Neo.Service.Name = "Neo_VPN105" -Neo.Service.DispName = "VPN Client Device Driver - VPN105" -Neo.Service.Desc = "VPN Client Adapter - VPN105" -NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN105" -Neo.EventLog.Name = "Neo" -NetworkAddress = "MAC Address" -DefaultAddress = "000001000001" -MaxSpeed = "Indicate Speed (Mbps)" -KeepLink = "Keep Link" -On = "On" -Off = "Off" - - -; Auto Generated 20180205_163608.859 - +; VPN Client Device Driver for Windows 2000 and Greater +; +; Copyright (c) SoftEther Corporation. All Rights Reserved. +; http://www.softether.co.jp/ +; +; BUILD 9658 + +[Version] +Signature = "$Windows NT$" +Class = Net +ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} +Provider = %CompanyName% +DriverVer = 02/04/2018, 4.25.0.9658 +CatalogFile.NT = inf_VPN105.cat + +[Manufacturer] +%CompanyName% = SoftEther + +[SourceDisksNames] +1=%DiskDescription%, "", , + +[SourceDisksFiles] +Neo_VPN105.sys = 1 + +[DestinationDirs] +DefaultDestDir = 12 +Neo.CopyFiles.Sys = 12 + +[Neo.CopyFiles.Sys] +Neo_VPN105.sys, , , 2 + +[SoftEther] +%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN105 + +[NeoAdapter.Install] +Characteristics = 0x1 +AddReg = Neo.Reg, NeoAdapter.Ndi +CopyFiles = Neo.CopyFiles.Sys +*IfType = 53 +*MediaType = 0 +*PhysicalMediaType = 0 + +[NeoAdapter.Install.Services] +AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% + +[NeoAdapter.Ndi] +HKR, , NetworkAddress, 0, %DefaultAddress% +HKR, Ndi, DeviceID, , "NeoAdapter_VPN105" +HKR, , DevLoader, , ndis +HKR, , DeviceVxDs, , Neo_VPN105.sys +HKR, NDIS, LogDriverName, , "Neo_VPN105" +HKR, NDIS, MajorNdisVersion, 1, 5 +HKR, NDIS, MinorNdisVersion, 1, 0 +HKR, Ndi\Interfaces, DefUpper, , "ndis5" +HKR, Ndi\Interfaces, UpperRange, , "ndis5" +HKR, Ndi\Interfaces, LowerRange, , "ethernet" +HKR, Ndi\Interfaces, DefLower, , "ethernet" +HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" +HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% +HKR, Ndi\Params\NetworkAddress, type, 0, "edit" +HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" +HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" +HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% +HKR, Ndi\Params\NetworkAddress, optional, 0, "0" +HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% +HKR, Ndi\Params\MaxSpeed, type, 0, "int" +HKR, Ndi\Params\MaxSpeed, default, 0, "100" +HKR, Ndi\Params\MaxSpeed, min, 0, "0" +HKR, Ndi\Params\MaxSpeed, max, 0, "2000" +HKR, Ndi\Params\MaxSpeed, step, 0, "1" +HKR, Ndi\Params\MaxSpeed, Base, 0, "10" +HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% +HKR, Ndi\Params\KeepLink, type, 0, "enum" +HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% +HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% +HKR, Ndi\Params\KeepLink, default, 0, "0" + + +[Neo.Service] +DisplayName = %Neo.Service.DispName% +Description = %Neo.Service.Desc% +ServiceType = 1 +StartType = 3 +ErrorControl = 1 +ServiceBinary = %12%\Neo_VPN105.sys +LoadOrderGroup = NDIS + +[Neo.Reg] +HKR, Ndi, Service, 0, Neo.Service.Name +HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" +HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" + +[Neo.EventLog] +HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN105.sys" +HKR, , TypesSupported, 0x00010001, 7 + +[Strings] +CompanyName = "SoftEther Corporation" +DiskDescription = "VPN Client Device Driver Install Disk" +Neo.Service.Name = "Neo_VPN105" +Neo.Service.DispName = "VPN Client Device Driver - VPN105" +Neo.Service.Desc = "VPN Client Adapter - VPN105" +NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN105" +Neo.EventLog.Name = "Neo" +NetworkAddress = "MAC Address" +DefaultAddress = "000001000001" +MaxSpeed = "Indicate Speed (Mbps)" +KeepLink = "Keep Link" +On = "On" +Off = "Off" + + +; Auto Generated 20180205_163608.859 + diff --git a/src/bin/hamcore/DriverPackages/Neo6_Win8/x86/Neo6_x86_VPN106.inf b/src/bin/hamcore/DriverPackages/Neo6_Win8/x86/Neo6_x86_VPN106.inf index 100ea012..016cca3b 100644 --- a/src/bin/hamcore/DriverPackages/Neo6_Win8/x86/Neo6_x86_VPN106.inf +++ b/src/bin/hamcore/DriverPackages/Neo6_Win8/x86/Neo6_x86_VPN106.inf @@ -1,114 +1,114 @@ -; VPN Client Device Driver for Windows 2000 and Greater -; -; Copyright (c) SoftEther Corporation. All Rights Reserved. -; http://www.softether.co.jp/ -; -; BUILD 9658 - -[Version] -Signature = "$Windows NT$" -Class = Net -ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} -Provider = %CompanyName% -DriverVer = 02/04/2018, 4.25.0.9658 -CatalogFile.NT = inf_VPN106.cat - -[Manufacturer] -%CompanyName% = SoftEther - -[SourceDisksNames] -1=%DiskDescription%, "", , - -[SourceDisksFiles] -Neo_VPN106.sys = 1 - -[DestinationDirs] -DefaultDestDir = 12 -Neo.CopyFiles.Sys = 12 - -[Neo.CopyFiles.Sys] -Neo_VPN106.sys, , , 2 - -[SoftEther] -%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN106 - -[NeoAdapter.Install] -Characteristics = 0x1 -AddReg = Neo.Reg, NeoAdapter.Ndi -CopyFiles = Neo.CopyFiles.Sys -*IfType = 53 -*MediaType = 0 -*PhysicalMediaType = 0 - -[NeoAdapter.Install.Services] -AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% - -[NeoAdapter.Ndi] -HKR, , NetworkAddress, 0, %DefaultAddress% -HKR, Ndi, DeviceID, , "NeoAdapter_VPN106" -HKR, , DevLoader, , ndis -HKR, , DeviceVxDs, , Neo_VPN106.sys -HKR, NDIS, LogDriverName, , "Neo_VPN106" -HKR, NDIS, MajorNdisVersion, 1, 5 -HKR, NDIS, MinorNdisVersion, 1, 0 -HKR, Ndi\Interfaces, DefUpper, , "ndis5" -HKR, Ndi\Interfaces, UpperRange, , "ndis5" -HKR, Ndi\Interfaces, LowerRange, , "ethernet" -HKR, Ndi\Interfaces, DefLower, , "ethernet" -HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" -HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% -HKR, Ndi\Params\NetworkAddress, type, 0, "edit" -HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" -HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" -HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% -HKR, Ndi\Params\NetworkAddress, optional, 0, "0" -HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% -HKR, Ndi\Params\MaxSpeed, type, 0, "int" -HKR, Ndi\Params\MaxSpeed, default, 0, "100" -HKR, Ndi\Params\MaxSpeed, min, 0, "0" -HKR, Ndi\Params\MaxSpeed, max, 0, "2000" -HKR, Ndi\Params\MaxSpeed, step, 0, "1" -HKR, Ndi\Params\MaxSpeed, Base, 0, "10" -HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% -HKR, Ndi\Params\KeepLink, type, 0, "enum" -HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% -HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% -HKR, Ndi\Params\KeepLink, default, 0, "0" - - -[Neo.Service] -DisplayName = %Neo.Service.DispName% -Description = %Neo.Service.Desc% -ServiceType = 1 -StartType = 3 -ErrorControl = 1 -ServiceBinary = %12%\Neo_VPN106.sys -LoadOrderGroup = NDIS - -[Neo.Reg] -HKR, Ndi, Service, 0, Neo.Service.Name -HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" -HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" - -[Neo.EventLog] -HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN106.sys" -HKR, , TypesSupported, 0x00010001, 7 - -[Strings] -CompanyName = "SoftEther Corporation" -DiskDescription = "VPN Client Device Driver Install Disk" -Neo.Service.Name = "Neo_VPN106" -Neo.Service.DispName = "VPN Client Device Driver - VPN106" -Neo.Service.Desc = "VPN Client Adapter - VPN106" -NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN106" -Neo.EventLog.Name = "Neo" -NetworkAddress = "MAC Address" -DefaultAddress = "000001000001" -MaxSpeed = "Indicate Speed (Mbps)" -KeepLink = "Keep Link" -On = "On" -Off = "Off" - - -; Auto Generated 20180205_163608.860 - +; VPN Client Device Driver for Windows 2000 and Greater +; +; Copyright (c) SoftEther Corporation. All Rights Reserved. +; http://www.softether.co.jp/ +; +; BUILD 9658 + +[Version] +Signature = "$Windows NT$" +Class = Net +ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} +Provider = %CompanyName% +DriverVer = 02/04/2018, 4.25.0.9658 +CatalogFile.NT = inf_VPN106.cat + +[Manufacturer] +%CompanyName% = SoftEther + +[SourceDisksNames] +1=%DiskDescription%, "", , + +[SourceDisksFiles] +Neo_VPN106.sys = 1 + +[DestinationDirs] +DefaultDestDir = 12 +Neo.CopyFiles.Sys = 12 + +[Neo.CopyFiles.Sys] +Neo_VPN106.sys, , , 2 + +[SoftEther] +%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN106 + +[NeoAdapter.Install] +Characteristics = 0x1 +AddReg = Neo.Reg, NeoAdapter.Ndi +CopyFiles = Neo.CopyFiles.Sys +*IfType = 53 +*MediaType = 0 +*PhysicalMediaType = 0 + +[NeoAdapter.Install.Services] +AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% + +[NeoAdapter.Ndi] +HKR, , NetworkAddress, 0, %DefaultAddress% +HKR, Ndi, DeviceID, , "NeoAdapter_VPN106" +HKR, , DevLoader, , ndis +HKR, , DeviceVxDs, , Neo_VPN106.sys +HKR, NDIS, LogDriverName, , "Neo_VPN106" +HKR, NDIS, MajorNdisVersion, 1, 5 +HKR, NDIS, MinorNdisVersion, 1, 0 +HKR, Ndi\Interfaces, DefUpper, , "ndis5" +HKR, Ndi\Interfaces, UpperRange, , "ndis5" +HKR, Ndi\Interfaces, LowerRange, , "ethernet" +HKR, Ndi\Interfaces, DefLower, , "ethernet" +HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" +HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% +HKR, Ndi\Params\NetworkAddress, type, 0, "edit" +HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" +HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" +HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% +HKR, Ndi\Params\NetworkAddress, optional, 0, "0" +HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% +HKR, Ndi\Params\MaxSpeed, type, 0, "int" +HKR, Ndi\Params\MaxSpeed, default, 0, "100" +HKR, Ndi\Params\MaxSpeed, min, 0, "0" +HKR, Ndi\Params\MaxSpeed, max, 0, "2000" +HKR, Ndi\Params\MaxSpeed, step, 0, "1" +HKR, Ndi\Params\MaxSpeed, Base, 0, "10" +HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% +HKR, Ndi\Params\KeepLink, type, 0, "enum" +HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% +HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% +HKR, Ndi\Params\KeepLink, default, 0, "0" + + +[Neo.Service] +DisplayName = %Neo.Service.DispName% +Description = %Neo.Service.Desc% +ServiceType = 1 +StartType = 3 +ErrorControl = 1 +ServiceBinary = %12%\Neo_VPN106.sys +LoadOrderGroup = NDIS + +[Neo.Reg] +HKR, Ndi, Service, 0, Neo.Service.Name +HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" +HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" + +[Neo.EventLog] +HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN106.sys" +HKR, , TypesSupported, 0x00010001, 7 + +[Strings] +CompanyName = "SoftEther Corporation" +DiskDescription = "VPN Client Device Driver Install Disk" +Neo.Service.Name = "Neo_VPN106" +Neo.Service.DispName = "VPN Client Device Driver - VPN106" +Neo.Service.Desc = "VPN Client Adapter - VPN106" +NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN106" +Neo.EventLog.Name = "Neo" +NetworkAddress = "MAC Address" +DefaultAddress = "000001000001" +MaxSpeed = "Indicate Speed (Mbps)" +KeepLink = "Keep Link" +On = "On" +Off = "Off" + + +; Auto Generated 20180205_163608.860 + diff --git a/src/bin/hamcore/DriverPackages/Neo6_Win8/x86/Neo6_x86_VPN107.inf b/src/bin/hamcore/DriverPackages/Neo6_Win8/x86/Neo6_x86_VPN107.inf index bc2cf7a3..fa16a273 100644 --- a/src/bin/hamcore/DriverPackages/Neo6_Win8/x86/Neo6_x86_VPN107.inf +++ b/src/bin/hamcore/DriverPackages/Neo6_Win8/x86/Neo6_x86_VPN107.inf @@ -1,114 +1,114 @@ -; VPN Client Device Driver for Windows 2000 and Greater -; -; Copyright (c) SoftEther Corporation. All Rights Reserved. -; http://www.softether.co.jp/ -; -; BUILD 9658 - -[Version] -Signature = "$Windows NT$" -Class = Net -ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} -Provider = %CompanyName% -DriverVer = 02/04/2018, 4.25.0.9658 -CatalogFile.NT = inf_VPN107.cat - -[Manufacturer] -%CompanyName% = SoftEther - -[SourceDisksNames] -1=%DiskDescription%, "", , - -[SourceDisksFiles] -Neo_VPN107.sys = 1 - -[DestinationDirs] -DefaultDestDir = 12 -Neo.CopyFiles.Sys = 12 - -[Neo.CopyFiles.Sys] -Neo_VPN107.sys, , , 2 - -[SoftEther] -%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN107 - -[NeoAdapter.Install] -Characteristics = 0x1 -AddReg = Neo.Reg, NeoAdapter.Ndi -CopyFiles = Neo.CopyFiles.Sys -*IfType = 53 -*MediaType = 0 -*PhysicalMediaType = 0 - -[NeoAdapter.Install.Services] -AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% - -[NeoAdapter.Ndi] -HKR, , NetworkAddress, 0, %DefaultAddress% -HKR, Ndi, DeviceID, , "NeoAdapter_VPN107" -HKR, , DevLoader, , ndis -HKR, , DeviceVxDs, , Neo_VPN107.sys -HKR, NDIS, LogDriverName, , "Neo_VPN107" -HKR, NDIS, MajorNdisVersion, 1, 5 -HKR, NDIS, MinorNdisVersion, 1, 0 -HKR, Ndi\Interfaces, DefUpper, , "ndis5" -HKR, Ndi\Interfaces, UpperRange, , "ndis5" -HKR, Ndi\Interfaces, LowerRange, , "ethernet" -HKR, Ndi\Interfaces, DefLower, , "ethernet" -HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" -HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% -HKR, Ndi\Params\NetworkAddress, type, 0, "edit" -HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" -HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" -HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% -HKR, Ndi\Params\NetworkAddress, optional, 0, "0" -HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% -HKR, Ndi\Params\MaxSpeed, type, 0, "int" -HKR, Ndi\Params\MaxSpeed, default, 0, "100" -HKR, Ndi\Params\MaxSpeed, min, 0, "0" -HKR, Ndi\Params\MaxSpeed, max, 0, "2000" -HKR, Ndi\Params\MaxSpeed, step, 0, "1" -HKR, Ndi\Params\MaxSpeed, Base, 0, "10" -HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% -HKR, Ndi\Params\KeepLink, type, 0, "enum" -HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% -HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% -HKR, Ndi\Params\KeepLink, default, 0, "0" - - -[Neo.Service] -DisplayName = %Neo.Service.DispName% -Description = %Neo.Service.Desc% -ServiceType = 1 -StartType = 3 -ErrorControl = 1 -ServiceBinary = %12%\Neo_VPN107.sys -LoadOrderGroup = NDIS - -[Neo.Reg] -HKR, Ndi, Service, 0, Neo.Service.Name -HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" -HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" - -[Neo.EventLog] -HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN107.sys" -HKR, , TypesSupported, 0x00010001, 7 - -[Strings] -CompanyName = "SoftEther Corporation" -DiskDescription = "VPN Client Device Driver Install Disk" -Neo.Service.Name = "Neo_VPN107" -Neo.Service.DispName = "VPN Client Device Driver - VPN107" -Neo.Service.Desc = "VPN Client Adapter - VPN107" -NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN107" -Neo.EventLog.Name = "Neo" -NetworkAddress = "MAC Address" -DefaultAddress = "000001000001" -MaxSpeed = "Indicate Speed (Mbps)" -KeepLink = "Keep Link" -On = "On" -Off = "Off" - - -; Auto Generated 20180205_163608.861 - +; VPN Client Device Driver for Windows 2000 and Greater +; +; Copyright (c) SoftEther Corporation. All Rights Reserved. +; http://www.softether.co.jp/ +; +; BUILD 9658 + +[Version] +Signature = "$Windows NT$" +Class = Net +ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} +Provider = %CompanyName% +DriverVer = 02/04/2018, 4.25.0.9658 +CatalogFile.NT = inf_VPN107.cat + +[Manufacturer] +%CompanyName% = SoftEther + +[SourceDisksNames] +1=%DiskDescription%, "", , + +[SourceDisksFiles] +Neo_VPN107.sys = 1 + +[DestinationDirs] +DefaultDestDir = 12 +Neo.CopyFiles.Sys = 12 + +[Neo.CopyFiles.Sys] +Neo_VPN107.sys, , , 2 + +[SoftEther] +%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN107 + +[NeoAdapter.Install] +Characteristics = 0x1 +AddReg = Neo.Reg, NeoAdapter.Ndi +CopyFiles = Neo.CopyFiles.Sys +*IfType = 53 +*MediaType = 0 +*PhysicalMediaType = 0 + +[NeoAdapter.Install.Services] +AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% + +[NeoAdapter.Ndi] +HKR, , NetworkAddress, 0, %DefaultAddress% +HKR, Ndi, DeviceID, , "NeoAdapter_VPN107" +HKR, , DevLoader, , ndis +HKR, , DeviceVxDs, , Neo_VPN107.sys +HKR, NDIS, LogDriverName, , "Neo_VPN107" +HKR, NDIS, MajorNdisVersion, 1, 5 +HKR, NDIS, MinorNdisVersion, 1, 0 +HKR, Ndi\Interfaces, DefUpper, , "ndis5" +HKR, Ndi\Interfaces, UpperRange, , "ndis5" +HKR, Ndi\Interfaces, LowerRange, , "ethernet" +HKR, Ndi\Interfaces, DefLower, , "ethernet" +HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" +HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% +HKR, Ndi\Params\NetworkAddress, type, 0, "edit" +HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" +HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" +HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% +HKR, Ndi\Params\NetworkAddress, optional, 0, "0" +HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% +HKR, Ndi\Params\MaxSpeed, type, 0, "int" +HKR, Ndi\Params\MaxSpeed, default, 0, "100" +HKR, Ndi\Params\MaxSpeed, min, 0, "0" +HKR, Ndi\Params\MaxSpeed, max, 0, "2000" +HKR, Ndi\Params\MaxSpeed, step, 0, "1" +HKR, Ndi\Params\MaxSpeed, Base, 0, "10" +HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% +HKR, Ndi\Params\KeepLink, type, 0, "enum" +HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% +HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% +HKR, Ndi\Params\KeepLink, default, 0, "0" + + +[Neo.Service] +DisplayName = %Neo.Service.DispName% +Description = %Neo.Service.Desc% +ServiceType = 1 +StartType = 3 +ErrorControl = 1 +ServiceBinary = %12%\Neo_VPN107.sys +LoadOrderGroup = NDIS + +[Neo.Reg] +HKR, Ndi, Service, 0, Neo.Service.Name +HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" +HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" + +[Neo.EventLog] +HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN107.sys" +HKR, , TypesSupported, 0x00010001, 7 + +[Strings] +CompanyName = "SoftEther Corporation" +DiskDescription = "VPN Client Device Driver Install Disk" +Neo.Service.Name = "Neo_VPN107" +Neo.Service.DispName = "VPN Client Device Driver - VPN107" +Neo.Service.Desc = "VPN Client Adapter - VPN107" +NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN107" +Neo.EventLog.Name = "Neo" +NetworkAddress = "MAC Address" +DefaultAddress = "000001000001" +MaxSpeed = "Indicate Speed (Mbps)" +KeepLink = "Keep Link" +On = "On" +Off = "Off" + + +; Auto Generated 20180205_163608.861 + diff --git a/src/bin/hamcore/DriverPackages/Neo6_Win8/x86/Neo6_x86_VPN108.inf b/src/bin/hamcore/DriverPackages/Neo6_Win8/x86/Neo6_x86_VPN108.inf index 79e0bfa1..16add094 100644 --- a/src/bin/hamcore/DriverPackages/Neo6_Win8/x86/Neo6_x86_VPN108.inf +++ b/src/bin/hamcore/DriverPackages/Neo6_Win8/x86/Neo6_x86_VPN108.inf @@ -1,114 +1,114 @@ -; VPN Client Device Driver for Windows 2000 and Greater -; -; Copyright (c) SoftEther Corporation. All Rights Reserved. -; http://www.softether.co.jp/ -; -; BUILD 9658 - -[Version] -Signature = "$Windows NT$" -Class = Net -ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} -Provider = %CompanyName% -DriverVer = 02/04/2018, 4.25.0.9658 -CatalogFile.NT = inf_VPN108.cat - -[Manufacturer] -%CompanyName% = SoftEther - -[SourceDisksNames] -1=%DiskDescription%, "", , - -[SourceDisksFiles] -Neo_VPN108.sys = 1 - -[DestinationDirs] -DefaultDestDir = 12 -Neo.CopyFiles.Sys = 12 - -[Neo.CopyFiles.Sys] -Neo_VPN108.sys, , , 2 - -[SoftEther] -%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN108 - -[NeoAdapter.Install] -Characteristics = 0x1 -AddReg = Neo.Reg, NeoAdapter.Ndi -CopyFiles = Neo.CopyFiles.Sys -*IfType = 53 -*MediaType = 0 -*PhysicalMediaType = 0 - -[NeoAdapter.Install.Services] -AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% - -[NeoAdapter.Ndi] -HKR, , NetworkAddress, 0, %DefaultAddress% -HKR, Ndi, DeviceID, , "NeoAdapter_VPN108" -HKR, , DevLoader, , ndis -HKR, , DeviceVxDs, , Neo_VPN108.sys -HKR, NDIS, LogDriverName, , "Neo_VPN108" -HKR, NDIS, MajorNdisVersion, 1, 5 -HKR, NDIS, MinorNdisVersion, 1, 0 -HKR, Ndi\Interfaces, DefUpper, , "ndis5" -HKR, Ndi\Interfaces, UpperRange, , "ndis5" -HKR, Ndi\Interfaces, LowerRange, , "ethernet" -HKR, Ndi\Interfaces, DefLower, , "ethernet" -HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" -HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% -HKR, Ndi\Params\NetworkAddress, type, 0, "edit" -HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" -HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" -HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% -HKR, Ndi\Params\NetworkAddress, optional, 0, "0" -HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% -HKR, Ndi\Params\MaxSpeed, type, 0, "int" -HKR, Ndi\Params\MaxSpeed, default, 0, "100" -HKR, Ndi\Params\MaxSpeed, min, 0, "0" -HKR, Ndi\Params\MaxSpeed, max, 0, "2000" -HKR, Ndi\Params\MaxSpeed, step, 0, "1" -HKR, Ndi\Params\MaxSpeed, Base, 0, "10" -HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% -HKR, Ndi\Params\KeepLink, type, 0, "enum" -HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% -HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% -HKR, Ndi\Params\KeepLink, default, 0, "0" - - -[Neo.Service] -DisplayName = %Neo.Service.DispName% -Description = %Neo.Service.Desc% -ServiceType = 1 -StartType = 3 -ErrorControl = 1 -ServiceBinary = %12%\Neo_VPN108.sys -LoadOrderGroup = NDIS - -[Neo.Reg] -HKR, Ndi, Service, 0, Neo.Service.Name -HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" -HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" - -[Neo.EventLog] -HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN108.sys" -HKR, , TypesSupported, 0x00010001, 7 - -[Strings] -CompanyName = "SoftEther Corporation" -DiskDescription = "VPN Client Device Driver Install Disk" -Neo.Service.Name = "Neo_VPN108" -Neo.Service.DispName = "VPN Client Device Driver - VPN108" -Neo.Service.Desc = "VPN Client Adapter - VPN108" -NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN108" -Neo.EventLog.Name = "Neo" -NetworkAddress = "MAC Address" -DefaultAddress = "000001000001" -MaxSpeed = "Indicate Speed (Mbps)" -KeepLink = "Keep Link" -On = "On" -Off = "Off" - - -; Auto Generated 20180205_163608.862 - +; VPN Client Device Driver for Windows 2000 and Greater +; +; Copyright (c) SoftEther Corporation. All Rights Reserved. +; http://www.softether.co.jp/ +; +; BUILD 9658 + +[Version] +Signature = "$Windows NT$" +Class = Net +ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} +Provider = %CompanyName% +DriverVer = 02/04/2018, 4.25.0.9658 +CatalogFile.NT = inf_VPN108.cat + +[Manufacturer] +%CompanyName% = SoftEther + +[SourceDisksNames] +1=%DiskDescription%, "", , + +[SourceDisksFiles] +Neo_VPN108.sys = 1 + +[DestinationDirs] +DefaultDestDir = 12 +Neo.CopyFiles.Sys = 12 + +[Neo.CopyFiles.Sys] +Neo_VPN108.sys, , , 2 + +[SoftEther] +%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN108 + +[NeoAdapter.Install] +Characteristics = 0x1 +AddReg = Neo.Reg, NeoAdapter.Ndi +CopyFiles = Neo.CopyFiles.Sys +*IfType = 53 +*MediaType = 0 +*PhysicalMediaType = 0 + +[NeoAdapter.Install.Services] +AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% + +[NeoAdapter.Ndi] +HKR, , NetworkAddress, 0, %DefaultAddress% +HKR, Ndi, DeviceID, , "NeoAdapter_VPN108" +HKR, , DevLoader, , ndis +HKR, , DeviceVxDs, , Neo_VPN108.sys +HKR, NDIS, LogDriverName, , "Neo_VPN108" +HKR, NDIS, MajorNdisVersion, 1, 5 +HKR, NDIS, MinorNdisVersion, 1, 0 +HKR, Ndi\Interfaces, DefUpper, , "ndis5" +HKR, Ndi\Interfaces, UpperRange, , "ndis5" +HKR, Ndi\Interfaces, LowerRange, , "ethernet" +HKR, Ndi\Interfaces, DefLower, , "ethernet" +HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" +HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% +HKR, Ndi\Params\NetworkAddress, type, 0, "edit" +HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" +HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" +HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% +HKR, Ndi\Params\NetworkAddress, optional, 0, "0" +HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% +HKR, Ndi\Params\MaxSpeed, type, 0, "int" +HKR, Ndi\Params\MaxSpeed, default, 0, "100" +HKR, Ndi\Params\MaxSpeed, min, 0, "0" +HKR, Ndi\Params\MaxSpeed, max, 0, "2000" +HKR, Ndi\Params\MaxSpeed, step, 0, "1" +HKR, Ndi\Params\MaxSpeed, Base, 0, "10" +HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% +HKR, Ndi\Params\KeepLink, type, 0, "enum" +HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% +HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% +HKR, Ndi\Params\KeepLink, default, 0, "0" + + +[Neo.Service] +DisplayName = %Neo.Service.DispName% +Description = %Neo.Service.Desc% +ServiceType = 1 +StartType = 3 +ErrorControl = 1 +ServiceBinary = %12%\Neo_VPN108.sys +LoadOrderGroup = NDIS + +[Neo.Reg] +HKR, Ndi, Service, 0, Neo.Service.Name +HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" +HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" + +[Neo.EventLog] +HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN108.sys" +HKR, , TypesSupported, 0x00010001, 7 + +[Strings] +CompanyName = "SoftEther Corporation" +DiskDescription = "VPN Client Device Driver Install Disk" +Neo.Service.Name = "Neo_VPN108" +Neo.Service.DispName = "VPN Client Device Driver - VPN108" +Neo.Service.Desc = "VPN Client Adapter - VPN108" +NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN108" +Neo.EventLog.Name = "Neo" +NetworkAddress = "MAC Address" +DefaultAddress = "000001000001" +MaxSpeed = "Indicate Speed (Mbps)" +KeepLink = "Keep Link" +On = "On" +Off = "Off" + + +; Auto Generated 20180205_163608.862 + diff --git a/src/bin/hamcore/DriverPackages/Neo6_Win8/x86/Neo6_x86_VPN109.inf b/src/bin/hamcore/DriverPackages/Neo6_Win8/x86/Neo6_x86_VPN109.inf index 1a83aefd..7563bbf0 100644 --- a/src/bin/hamcore/DriverPackages/Neo6_Win8/x86/Neo6_x86_VPN109.inf +++ b/src/bin/hamcore/DriverPackages/Neo6_Win8/x86/Neo6_x86_VPN109.inf @@ -1,114 +1,114 @@ -; VPN Client Device Driver for Windows 2000 and Greater -; -; Copyright (c) SoftEther Corporation. All Rights Reserved. -; http://www.softether.co.jp/ -; -; BUILD 9658 - -[Version] -Signature = "$Windows NT$" -Class = Net -ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} -Provider = %CompanyName% -DriverVer = 02/04/2018, 4.25.0.9658 -CatalogFile.NT = inf_VPN109.cat - -[Manufacturer] -%CompanyName% = SoftEther - -[SourceDisksNames] -1=%DiskDescription%, "", , - -[SourceDisksFiles] -Neo_VPN109.sys = 1 - -[DestinationDirs] -DefaultDestDir = 12 -Neo.CopyFiles.Sys = 12 - -[Neo.CopyFiles.Sys] -Neo_VPN109.sys, , , 2 - -[SoftEther] -%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN109 - -[NeoAdapter.Install] -Characteristics = 0x1 -AddReg = Neo.Reg, NeoAdapter.Ndi -CopyFiles = Neo.CopyFiles.Sys -*IfType = 53 -*MediaType = 0 -*PhysicalMediaType = 0 - -[NeoAdapter.Install.Services] -AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% - -[NeoAdapter.Ndi] -HKR, , NetworkAddress, 0, %DefaultAddress% -HKR, Ndi, DeviceID, , "NeoAdapter_VPN109" -HKR, , DevLoader, , ndis -HKR, , DeviceVxDs, , Neo_VPN109.sys -HKR, NDIS, LogDriverName, , "Neo_VPN109" -HKR, NDIS, MajorNdisVersion, 1, 5 -HKR, NDIS, MinorNdisVersion, 1, 0 -HKR, Ndi\Interfaces, DefUpper, , "ndis5" -HKR, Ndi\Interfaces, UpperRange, , "ndis5" -HKR, Ndi\Interfaces, LowerRange, , "ethernet" -HKR, Ndi\Interfaces, DefLower, , "ethernet" -HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" -HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% -HKR, Ndi\Params\NetworkAddress, type, 0, "edit" -HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" -HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" -HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% -HKR, Ndi\Params\NetworkAddress, optional, 0, "0" -HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% -HKR, Ndi\Params\MaxSpeed, type, 0, "int" -HKR, Ndi\Params\MaxSpeed, default, 0, "100" -HKR, Ndi\Params\MaxSpeed, min, 0, "0" -HKR, Ndi\Params\MaxSpeed, max, 0, "2000" -HKR, Ndi\Params\MaxSpeed, step, 0, "1" -HKR, Ndi\Params\MaxSpeed, Base, 0, "10" -HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% -HKR, Ndi\Params\KeepLink, type, 0, "enum" -HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% -HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% -HKR, Ndi\Params\KeepLink, default, 0, "0" - - -[Neo.Service] -DisplayName = %Neo.Service.DispName% -Description = %Neo.Service.Desc% -ServiceType = 1 -StartType = 3 -ErrorControl = 1 -ServiceBinary = %12%\Neo_VPN109.sys -LoadOrderGroup = NDIS - -[Neo.Reg] -HKR, Ndi, Service, 0, Neo.Service.Name -HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" -HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" - -[Neo.EventLog] -HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN109.sys" -HKR, , TypesSupported, 0x00010001, 7 - -[Strings] -CompanyName = "SoftEther Corporation" -DiskDescription = "VPN Client Device Driver Install Disk" -Neo.Service.Name = "Neo_VPN109" -Neo.Service.DispName = "VPN Client Device Driver - VPN109" -Neo.Service.Desc = "VPN Client Adapter - VPN109" -NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN109" -Neo.EventLog.Name = "Neo" -NetworkAddress = "MAC Address" -DefaultAddress = "000001000001" -MaxSpeed = "Indicate Speed (Mbps)" -KeepLink = "Keep Link" -On = "On" -Off = "Off" - - -; Auto Generated 20180205_163608.870 - +; VPN Client Device Driver for Windows 2000 and Greater +; +; Copyright (c) SoftEther Corporation. All Rights Reserved. +; http://www.softether.co.jp/ +; +; BUILD 9658 + +[Version] +Signature = "$Windows NT$" +Class = Net +ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} +Provider = %CompanyName% +DriverVer = 02/04/2018, 4.25.0.9658 +CatalogFile.NT = inf_VPN109.cat + +[Manufacturer] +%CompanyName% = SoftEther + +[SourceDisksNames] +1=%DiskDescription%, "", , + +[SourceDisksFiles] +Neo_VPN109.sys = 1 + +[DestinationDirs] +DefaultDestDir = 12 +Neo.CopyFiles.Sys = 12 + +[Neo.CopyFiles.Sys] +Neo_VPN109.sys, , , 2 + +[SoftEther] +%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN109 + +[NeoAdapter.Install] +Characteristics = 0x1 +AddReg = Neo.Reg, NeoAdapter.Ndi +CopyFiles = Neo.CopyFiles.Sys +*IfType = 53 +*MediaType = 0 +*PhysicalMediaType = 0 + +[NeoAdapter.Install.Services] +AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% + +[NeoAdapter.Ndi] +HKR, , NetworkAddress, 0, %DefaultAddress% +HKR, Ndi, DeviceID, , "NeoAdapter_VPN109" +HKR, , DevLoader, , ndis +HKR, , DeviceVxDs, , Neo_VPN109.sys +HKR, NDIS, LogDriverName, , "Neo_VPN109" +HKR, NDIS, MajorNdisVersion, 1, 5 +HKR, NDIS, MinorNdisVersion, 1, 0 +HKR, Ndi\Interfaces, DefUpper, , "ndis5" +HKR, Ndi\Interfaces, UpperRange, , "ndis5" +HKR, Ndi\Interfaces, LowerRange, , "ethernet" +HKR, Ndi\Interfaces, DefLower, , "ethernet" +HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" +HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% +HKR, Ndi\Params\NetworkAddress, type, 0, "edit" +HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" +HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" +HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% +HKR, Ndi\Params\NetworkAddress, optional, 0, "0" +HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% +HKR, Ndi\Params\MaxSpeed, type, 0, "int" +HKR, Ndi\Params\MaxSpeed, default, 0, "100" +HKR, Ndi\Params\MaxSpeed, min, 0, "0" +HKR, Ndi\Params\MaxSpeed, max, 0, "2000" +HKR, Ndi\Params\MaxSpeed, step, 0, "1" +HKR, Ndi\Params\MaxSpeed, Base, 0, "10" +HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% +HKR, Ndi\Params\KeepLink, type, 0, "enum" +HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% +HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% +HKR, Ndi\Params\KeepLink, default, 0, "0" + + +[Neo.Service] +DisplayName = %Neo.Service.DispName% +Description = %Neo.Service.Desc% +ServiceType = 1 +StartType = 3 +ErrorControl = 1 +ServiceBinary = %12%\Neo_VPN109.sys +LoadOrderGroup = NDIS + +[Neo.Reg] +HKR, Ndi, Service, 0, Neo.Service.Name +HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" +HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" + +[Neo.EventLog] +HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN109.sys" +HKR, , TypesSupported, 0x00010001, 7 + +[Strings] +CompanyName = "SoftEther Corporation" +DiskDescription = "VPN Client Device Driver Install Disk" +Neo.Service.Name = "Neo_VPN109" +Neo.Service.DispName = "VPN Client Device Driver - VPN109" +Neo.Service.Desc = "VPN Client Adapter - VPN109" +NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN109" +Neo.EventLog.Name = "Neo" +NetworkAddress = "MAC Address" +DefaultAddress = "000001000001" +MaxSpeed = "Indicate Speed (Mbps)" +KeepLink = "Keep Link" +On = "On" +Off = "Off" + + +; Auto Generated 20180205_163608.870 + diff --git a/src/bin/hamcore/DriverPackages/Neo6_Win8/x86/Neo6_x86_VPN11.inf b/src/bin/hamcore/DriverPackages/Neo6_Win8/x86/Neo6_x86_VPN11.inf index 86e3ef33..026d4a1b 100644 --- a/src/bin/hamcore/DriverPackages/Neo6_Win8/x86/Neo6_x86_VPN11.inf +++ b/src/bin/hamcore/DriverPackages/Neo6_Win8/x86/Neo6_x86_VPN11.inf @@ -1,114 +1,114 @@ -; VPN Client Device Driver for Windows 2000 and Greater -; -; Copyright (c) SoftEther Corporation. All Rights Reserved. -; http://www.softether.co.jp/ -; -; BUILD 9658 - -[Version] -Signature = "$Windows NT$" -Class = Net -ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} -Provider = %CompanyName% -DriverVer = 02/04/2018, 4.25.0.9658 -CatalogFile.NT = inf_VPN11.cat - -[Manufacturer] -%CompanyName% = SoftEther - -[SourceDisksNames] -1=%DiskDescription%, "", , - -[SourceDisksFiles] -Neo_VPN11.sys = 1 - -[DestinationDirs] -DefaultDestDir = 12 -Neo.CopyFiles.Sys = 12 - -[Neo.CopyFiles.Sys] -Neo_VPN11.sys, , , 2 - -[SoftEther] -%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN11 - -[NeoAdapter.Install] -Characteristics = 0x1 -AddReg = Neo.Reg, NeoAdapter.Ndi -CopyFiles = Neo.CopyFiles.Sys -*IfType = 53 -*MediaType = 0 -*PhysicalMediaType = 0 - -[NeoAdapter.Install.Services] -AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% - -[NeoAdapter.Ndi] -HKR, , NetworkAddress, 0, %DefaultAddress% -HKR, Ndi, DeviceID, , "NeoAdapter_VPN11" -HKR, , DevLoader, , ndis -HKR, , DeviceVxDs, , Neo_VPN11.sys -HKR, NDIS, LogDriverName, , "Neo_VPN11" -HKR, NDIS, MajorNdisVersion, 1, 5 -HKR, NDIS, MinorNdisVersion, 1, 0 -HKR, Ndi\Interfaces, DefUpper, , "ndis5" -HKR, Ndi\Interfaces, UpperRange, , "ndis5" -HKR, Ndi\Interfaces, LowerRange, , "ethernet" -HKR, Ndi\Interfaces, DefLower, , "ethernet" -HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" -HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% -HKR, Ndi\Params\NetworkAddress, type, 0, "edit" -HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" -HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" -HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% -HKR, Ndi\Params\NetworkAddress, optional, 0, "0" -HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% -HKR, Ndi\Params\MaxSpeed, type, 0, "int" -HKR, Ndi\Params\MaxSpeed, default, 0, "100" -HKR, Ndi\Params\MaxSpeed, min, 0, "0" -HKR, Ndi\Params\MaxSpeed, max, 0, "2000" -HKR, Ndi\Params\MaxSpeed, step, 0, "1" -HKR, Ndi\Params\MaxSpeed, Base, 0, "10" -HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% -HKR, Ndi\Params\KeepLink, type, 0, "enum" -HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% -HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% -HKR, Ndi\Params\KeepLink, default, 0, "0" - - -[Neo.Service] -DisplayName = %Neo.Service.DispName% -Description = %Neo.Service.Desc% -ServiceType = 1 -StartType = 3 -ErrorControl = 1 -ServiceBinary = %12%\Neo_VPN11.sys -LoadOrderGroup = NDIS - -[Neo.Reg] -HKR, Ndi, Service, 0, Neo.Service.Name -HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" -HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" - -[Neo.EventLog] -HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN11.sys" -HKR, , TypesSupported, 0x00010001, 7 - -[Strings] -CompanyName = "SoftEther Corporation" -DiskDescription = "VPN Client Device Driver Install Disk" -Neo.Service.Name = "Neo_VPN11" -Neo.Service.DispName = "VPN Client Device Driver - VPN11" -Neo.Service.Desc = "VPN Client Adapter - VPN11" -NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN11" -Neo.EventLog.Name = "Neo" -NetworkAddress = "MAC Address" -DefaultAddress = "000001000001" -MaxSpeed = "Indicate Speed (Mbps)" -KeepLink = "Keep Link" -On = "On" -Off = "Off" - - -; Auto Generated 20180205_163608.758 - +; VPN Client Device Driver for Windows 2000 and Greater +; +; Copyright (c) SoftEther Corporation. All Rights Reserved. +; http://www.softether.co.jp/ +; +; BUILD 9658 + +[Version] +Signature = "$Windows NT$" +Class = Net +ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} +Provider = %CompanyName% +DriverVer = 02/04/2018, 4.25.0.9658 +CatalogFile.NT = inf_VPN11.cat + +[Manufacturer] +%CompanyName% = SoftEther + +[SourceDisksNames] +1=%DiskDescription%, "", , + +[SourceDisksFiles] +Neo_VPN11.sys = 1 + +[DestinationDirs] +DefaultDestDir = 12 +Neo.CopyFiles.Sys = 12 + +[Neo.CopyFiles.Sys] +Neo_VPN11.sys, , , 2 + +[SoftEther] +%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN11 + +[NeoAdapter.Install] +Characteristics = 0x1 +AddReg = Neo.Reg, NeoAdapter.Ndi +CopyFiles = Neo.CopyFiles.Sys +*IfType = 53 +*MediaType = 0 +*PhysicalMediaType = 0 + +[NeoAdapter.Install.Services] +AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% + +[NeoAdapter.Ndi] +HKR, , NetworkAddress, 0, %DefaultAddress% +HKR, Ndi, DeviceID, , "NeoAdapter_VPN11" +HKR, , DevLoader, , ndis +HKR, , DeviceVxDs, , Neo_VPN11.sys +HKR, NDIS, LogDriverName, , "Neo_VPN11" +HKR, NDIS, MajorNdisVersion, 1, 5 +HKR, NDIS, MinorNdisVersion, 1, 0 +HKR, Ndi\Interfaces, DefUpper, , "ndis5" +HKR, Ndi\Interfaces, UpperRange, , "ndis5" +HKR, Ndi\Interfaces, LowerRange, , "ethernet" +HKR, Ndi\Interfaces, DefLower, , "ethernet" +HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" +HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% +HKR, Ndi\Params\NetworkAddress, type, 0, "edit" +HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" +HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" +HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% +HKR, Ndi\Params\NetworkAddress, optional, 0, "0" +HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% +HKR, Ndi\Params\MaxSpeed, type, 0, "int" +HKR, Ndi\Params\MaxSpeed, default, 0, "100" +HKR, Ndi\Params\MaxSpeed, min, 0, "0" +HKR, Ndi\Params\MaxSpeed, max, 0, "2000" +HKR, Ndi\Params\MaxSpeed, step, 0, "1" +HKR, Ndi\Params\MaxSpeed, Base, 0, "10" +HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% +HKR, Ndi\Params\KeepLink, type, 0, "enum" +HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% +HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% +HKR, Ndi\Params\KeepLink, default, 0, "0" + + +[Neo.Service] +DisplayName = %Neo.Service.DispName% +Description = %Neo.Service.Desc% +ServiceType = 1 +StartType = 3 +ErrorControl = 1 +ServiceBinary = %12%\Neo_VPN11.sys +LoadOrderGroup = NDIS + +[Neo.Reg] +HKR, Ndi, Service, 0, Neo.Service.Name +HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" +HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" + +[Neo.EventLog] +HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN11.sys" +HKR, , TypesSupported, 0x00010001, 7 + +[Strings] +CompanyName = "SoftEther Corporation" +DiskDescription = "VPN Client Device Driver Install Disk" +Neo.Service.Name = "Neo_VPN11" +Neo.Service.DispName = "VPN Client Device Driver - VPN11" +Neo.Service.Desc = "VPN Client Adapter - VPN11" +NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN11" +Neo.EventLog.Name = "Neo" +NetworkAddress = "MAC Address" +DefaultAddress = "000001000001" +MaxSpeed = "Indicate Speed (Mbps)" +KeepLink = "Keep Link" +On = "On" +Off = "Off" + + +; Auto Generated 20180205_163608.758 + diff --git a/src/bin/hamcore/DriverPackages/Neo6_Win8/x86/Neo6_x86_VPN110.inf b/src/bin/hamcore/DriverPackages/Neo6_Win8/x86/Neo6_x86_VPN110.inf index 8fba9709..3e3bf057 100644 --- a/src/bin/hamcore/DriverPackages/Neo6_Win8/x86/Neo6_x86_VPN110.inf +++ b/src/bin/hamcore/DriverPackages/Neo6_Win8/x86/Neo6_x86_VPN110.inf @@ -1,114 +1,114 @@ -; VPN Client Device Driver for Windows 2000 and Greater -; -; Copyright (c) SoftEther Corporation. All Rights Reserved. -; http://www.softether.co.jp/ -; -; BUILD 9658 - -[Version] -Signature = "$Windows NT$" -Class = Net -ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} -Provider = %CompanyName% -DriverVer = 02/04/2018, 4.25.0.9658 -CatalogFile.NT = inf_VPN110.cat - -[Manufacturer] -%CompanyName% = SoftEther - -[SourceDisksNames] -1=%DiskDescription%, "", , - -[SourceDisksFiles] -Neo_VPN110.sys = 1 - -[DestinationDirs] -DefaultDestDir = 12 -Neo.CopyFiles.Sys = 12 - -[Neo.CopyFiles.Sys] -Neo_VPN110.sys, , , 2 - -[SoftEther] -%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN110 - -[NeoAdapter.Install] -Characteristics = 0x1 -AddReg = Neo.Reg, NeoAdapter.Ndi -CopyFiles = Neo.CopyFiles.Sys -*IfType = 53 -*MediaType = 0 -*PhysicalMediaType = 0 - -[NeoAdapter.Install.Services] -AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% - -[NeoAdapter.Ndi] -HKR, , NetworkAddress, 0, %DefaultAddress% -HKR, Ndi, DeviceID, , "NeoAdapter_VPN110" -HKR, , DevLoader, , ndis -HKR, , DeviceVxDs, , Neo_VPN110.sys -HKR, NDIS, LogDriverName, , "Neo_VPN110" -HKR, NDIS, MajorNdisVersion, 1, 5 -HKR, NDIS, MinorNdisVersion, 1, 0 -HKR, Ndi\Interfaces, DefUpper, , "ndis5" -HKR, Ndi\Interfaces, UpperRange, , "ndis5" -HKR, Ndi\Interfaces, LowerRange, , "ethernet" -HKR, Ndi\Interfaces, DefLower, , "ethernet" -HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" -HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% -HKR, Ndi\Params\NetworkAddress, type, 0, "edit" -HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" -HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" -HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% -HKR, Ndi\Params\NetworkAddress, optional, 0, "0" -HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% -HKR, Ndi\Params\MaxSpeed, type, 0, "int" -HKR, Ndi\Params\MaxSpeed, default, 0, "100" -HKR, Ndi\Params\MaxSpeed, min, 0, "0" -HKR, Ndi\Params\MaxSpeed, max, 0, "2000" -HKR, Ndi\Params\MaxSpeed, step, 0, "1" -HKR, Ndi\Params\MaxSpeed, Base, 0, "10" -HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% -HKR, Ndi\Params\KeepLink, type, 0, "enum" -HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% -HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% -HKR, Ndi\Params\KeepLink, default, 0, "0" - - -[Neo.Service] -DisplayName = %Neo.Service.DispName% -Description = %Neo.Service.Desc% -ServiceType = 1 -StartType = 3 -ErrorControl = 1 -ServiceBinary = %12%\Neo_VPN110.sys -LoadOrderGroup = NDIS - -[Neo.Reg] -HKR, Ndi, Service, 0, Neo.Service.Name -HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" -HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" - -[Neo.EventLog] -HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN110.sys" -HKR, , TypesSupported, 0x00010001, 7 - -[Strings] -CompanyName = "SoftEther Corporation" -DiskDescription = "VPN Client Device Driver Install Disk" -Neo.Service.Name = "Neo_VPN110" -Neo.Service.DispName = "VPN Client Device Driver - VPN110" -Neo.Service.Desc = "VPN Client Adapter - VPN110" -NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN110" -Neo.EventLog.Name = "Neo" -NetworkAddress = "MAC Address" -DefaultAddress = "000001000001" -MaxSpeed = "Indicate Speed (Mbps)" -KeepLink = "Keep Link" -On = "On" -Off = "Off" - - -; Auto Generated 20180205_163608.872 - +; VPN Client Device Driver for Windows 2000 and Greater +; +; Copyright (c) SoftEther Corporation. All Rights Reserved. +; http://www.softether.co.jp/ +; +; BUILD 9658 + +[Version] +Signature = "$Windows NT$" +Class = Net +ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} +Provider = %CompanyName% +DriverVer = 02/04/2018, 4.25.0.9658 +CatalogFile.NT = inf_VPN110.cat + +[Manufacturer] +%CompanyName% = SoftEther + +[SourceDisksNames] +1=%DiskDescription%, "", , + +[SourceDisksFiles] +Neo_VPN110.sys = 1 + +[DestinationDirs] +DefaultDestDir = 12 +Neo.CopyFiles.Sys = 12 + +[Neo.CopyFiles.Sys] +Neo_VPN110.sys, , , 2 + +[SoftEther] +%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN110 + +[NeoAdapter.Install] +Characteristics = 0x1 +AddReg = Neo.Reg, NeoAdapter.Ndi +CopyFiles = Neo.CopyFiles.Sys +*IfType = 53 +*MediaType = 0 +*PhysicalMediaType = 0 + +[NeoAdapter.Install.Services] +AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% + +[NeoAdapter.Ndi] +HKR, , NetworkAddress, 0, %DefaultAddress% +HKR, Ndi, DeviceID, , "NeoAdapter_VPN110" +HKR, , DevLoader, , ndis +HKR, , DeviceVxDs, , Neo_VPN110.sys +HKR, NDIS, LogDriverName, , "Neo_VPN110" +HKR, NDIS, MajorNdisVersion, 1, 5 +HKR, NDIS, MinorNdisVersion, 1, 0 +HKR, Ndi\Interfaces, DefUpper, , "ndis5" +HKR, Ndi\Interfaces, UpperRange, , "ndis5" +HKR, Ndi\Interfaces, LowerRange, , "ethernet" +HKR, Ndi\Interfaces, DefLower, , "ethernet" +HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" +HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% +HKR, Ndi\Params\NetworkAddress, type, 0, "edit" +HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" +HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" +HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% +HKR, Ndi\Params\NetworkAddress, optional, 0, "0" +HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% +HKR, Ndi\Params\MaxSpeed, type, 0, "int" +HKR, Ndi\Params\MaxSpeed, default, 0, "100" +HKR, Ndi\Params\MaxSpeed, min, 0, "0" +HKR, Ndi\Params\MaxSpeed, max, 0, "2000" +HKR, Ndi\Params\MaxSpeed, step, 0, "1" +HKR, Ndi\Params\MaxSpeed, Base, 0, "10" +HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% +HKR, Ndi\Params\KeepLink, type, 0, "enum" +HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% +HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% +HKR, Ndi\Params\KeepLink, default, 0, "0" + + +[Neo.Service] +DisplayName = %Neo.Service.DispName% +Description = %Neo.Service.Desc% +ServiceType = 1 +StartType = 3 +ErrorControl = 1 +ServiceBinary = %12%\Neo_VPN110.sys +LoadOrderGroup = NDIS + +[Neo.Reg] +HKR, Ndi, Service, 0, Neo.Service.Name +HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" +HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" + +[Neo.EventLog] +HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN110.sys" +HKR, , TypesSupported, 0x00010001, 7 + +[Strings] +CompanyName = "SoftEther Corporation" +DiskDescription = "VPN Client Device Driver Install Disk" +Neo.Service.Name = "Neo_VPN110" +Neo.Service.DispName = "VPN Client Device Driver - VPN110" +Neo.Service.Desc = "VPN Client Adapter - VPN110" +NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN110" +Neo.EventLog.Name = "Neo" +NetworkAddress = "MAC Address" +DefaultAddress = "000001000001" +MaxSpeed = "Indicate Speed (Mbps)" +KeepLink = "Keep Link" +On = "On" +Off = "Off" + + +; Auto Generated 20180205_163608.872 + diff --git a/src/bin/hamcore/DriverPackages/Neo6_Win8/x86/Neo6_x86_VPN111.inf b/src/bin/hamcore/DriverPackages/Neo6_Win8/x86/Neo6_x86_VPN111.inf index c42326bb..be00c80e 100644 --- a/src/bin/hamcore/DriverPackages/Neo6_Win8/x86/Neo6_x86_VPN111.inf +++ b/src/bin/hamcore/DriverPackages/Neo6_Win8/x86/Neo6_x86_VPN111.inf @@ -1,114 +1,114 @@ -; VPN Client Device Driver for Windows 2000 and Greater -; -; Copyright (c) SoftEther Corporation. All Rights Reserved. -; http://www.softether.co.jp/ -; -; BUILD 9658 - -[Version] -Signature = "$Windows NT$" -Class = Net -ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} -Provider = %CompanyName% -DriverVer = 02/04/2018, 4.25.0.9658 -CatalogFile.NT = inf_VPN111.cat - -[Manufacturer] -%CompanyName% = SoftEther - -[SourceDisksNames] -1=%DiskDescription%, "", , - -[SourceDisksFiles] -Neo_VPN111.sys = 1 - -[DestinationDirs] -DefaultDestDir = 12 -Neo.CopyFiles.Sys = 12 - -[Neo.CopyFiles.Sys] -Neo_VPN111.sys, , , 2 - -[SoftEther] -%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN111 - -[NeoAdapter.Install] -Characteristics = 0x1 -AddReg = Neo.Reg, NeoAdapter.Ndi -CopyFiles = Neo.CopyFiles.Sys -*IfType = 53 -*MediaType = 0 -*PhysicalMediaType = 0 - -[NeoAdapter.Install.Services] -AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% - -[NeoAdapter.Ndi] -HKR, , NetworkAddress, 0, %DefaultAddress% -HKR, Ndi, DeviceID, , "NeoAdapter_VPN111" -HKR, , DevLoader, , ndis -HKR, , DeviceVxDs, , Neo_VPN111.sys -HKR, NDIS, LogDriverName, , "Neo_VPN111" -HKR, NDIS, MajorNdisVersion, 1, 5 -HKR, NDIS, MinorNdisVersion, 1, 0 -HKR, Ndi\Interfaces, DefUpper, , "ndis5" -HKR, Ndi\Interfaces, UpperRange, , "ndis5" -HKR, Ndi\Interfaces, LowerRange, , "ethernet" -HKR, Ndi\Interfaces, DefLower, , "ethernet" -HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" -HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% -HKR, Ndi\Params\NetworkAddress, type, 0, "edit" -HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" -HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" -HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% -HKR, Ndi\Params\NetworkAddress, optional, 0, "0" -HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% -HKR, Ndi\Params\MaxSpeed, type, 0, "int" -HKR, Ndi\Params\MaxSpeed, default, 0, "100" -HKR, Ndi\Params\MaxSpeed, min, 0, "0" -HKR, Ndi\Params\MaxSpeed, max, 0, "2000" -HKR, Ndi\Params\MaxSpeed, step, 0, "1" -HKR, Ndi\Params\MaxSpeed, Base, 0, "10" -HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% -HKR, Ndi\Params\KeepLink, type, 0, "enum" -HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% -HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% -HKR, Ndi\Params\KeepLink, default, 0, "0" - - -[Neo.Service] -DisplayName = %Neo.Service.DispName% -Description = %Neo.Service.Desc% -ServiceType = 1 -StartType = 3 -ErrorControl = 1 -ServiceBinary = %12%\Neo_VPN111.sys -LoadOrderGroup = NDIS - -[Neo.Reg] -HKR, Ndi, Service, 0, Neo.Service.Name -HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" -HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" - -[Neo.EventLog] -HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN111.sys" -HKR, , TypesSupported, 0x00010001, 7 - -[Strings] -CompanyName = "SoftEther Corporation" -DiskDescription = "VPN Client Device Driver Install Disk" -Neo.Service.Name = "Neo_VPN111" -Neo.Service.DispName = "VPN Client Device Driver - VPN111" -Neo.Service.Desc = "VPN Client Adapter - VPN111" -NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN111" -Neo.EventLog.Name = "Neo" -NetworkAddress = "MAC Address" -DefaultAddress = "000001000001" -MaxSpeed = "Indicate Speed (Mbps)" -KeepLink = "Keep Link" -On = "On" -Off = "Off" - - -; Auto Generated 20180205_163608.873 - +; VPN Client Device Driver for Windows 2000 and Greater +; +; Copyright (c) SoftEther Corporation. All Rights Reserved. +; http://www.softether.co.jp/ +; +; BUILD 9658 + +[Version] +Signature = "$Windows NT$" +Class = Net +ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} +Provider = %CompanyName% +DriverVer = 02/04/2018, 4.25.0.9658 +CatalogFile.NT = inf_VPN111.cat + +[Manufacturer] +%CompanyName% = SoftEther + +[SourceDisksNames] +1=%DiskDescription%, "", , + +[SourceDisksFiles] +Neo_VPN111.sys = 1 + +[DestinationDirs] +DefaultDestDir = 12 +Neo.CopyFiles.Sys = 12 + +[Neo.CopyFiles.Sys] +Neo_VPN111.sys, , , 2 + +[SoftEther] +%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN111 + +[NeoAdapter.Install] +Characteristics = 0x1 +AddReg = Neo.Reg, NeoAdapter.Ndi +CopyFiles = Neo.CopyFiles.Sys +*IfType = 53 +*MediaType = 0 +*PhysicalMediaType = 0 + +[NeoAdapter.Install.Services] +AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% + +[NeoAdapter.Ndi] +HKR, , NetworkAddress, 0, %DefaultAddress% +HKR, Ndi, DeviceID, , "NeoAdapter_VPN111" +HKR, , DevLoader, , ndis +HKR, , DeviceVxDs, , Neo_VPN111.sys +HKR, NDIS, LogDriverName, , "Neo_VPN111" +HKR, NDIS, MajorNdisVersion, 1, 5 +HKR, NDIS, MinorNdisVersion, 1, 0 +HKR, Ndi\Interfaces, DefUpper, , "ndis5" +HKR, Ndi\Interfaces, UpperRange, , "ndis5" +HKR, Ndi\Interfaces, LowerRange, , "ethernet" +HKR, Ndi\Interfaces, DefLower, , "ethernet" +HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" +HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% +HKR, Ndi\Params\NetworkAddress, type, 0, "edit" +HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" +HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" +HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% +HKR, Ndi\Params\NetworkAddress, optional, 0, "0" +HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% +HKR, Ndi\Params\MaxSpeed, type, 0, "int" +HKR, Ndi\Params\MaxSpeed, default, 0, "100" +HKR, Ndi\Params\MaxSpeed, min, 0, "0" +HKR, Ndi\Params\MaxSpeed, max, 0, "2000" +HKR, Ndi\Params\MaxSpeed, step, 0, "1" +HKR, Ndi\Params\MaxSpeed, Base, 0, "10" +HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% +HKR, Ndi\Params\KeepLink, type, 0, "enum" +HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% +HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% +HKR, Ndi\Params\KeepLink, default, 0, "0" + + +[Neo.Service] +DisplayName = %Neo.Service.DispName% +Description = %Neo.Service.Desc% +ServiceType = 1 +StartType = 3 +ErrorControl = 1 +ServiceBinary = %12%\Neo_VPN111.sys +LoadOrderGroup = NDIS + +[Neo.Reg] +HKR, Ndi, Service, 0, Neo.Service.Name +HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" +HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" + +[Neo.EventLog] +HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN111.sys" +HKR, , TypesSupported, 0x00010001, 7 + +[Strings] +CompanyName = "SoftEther Corporation" +DiskDescription = "VPN Client Device Driver Install Disk" +Neo.Service.Name = "Neo_VPN111" +Neo.Service.DispName = "VPN Client Device Driver - VPN111" +Neo.Service.Desc = "VPN Client Adapter - VPN111" +NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN111" +Neo.EventLog.Name = "Neo" +NetworkAddress = "MAC Address" +DefaultAddress = "000001000001" +MaxSpeed = "Indicate Speed (Mbps)" +KeepLink = "Keep Link" +On = "On" +Off = "Off" + + +; Auto Generated 20180205_163608.873 + diff --git a/src/bin/hamcore/DriverPackages/Neo6_Win8/x86/Neo6_x86_VPN112.inf b/src/bin/hamcore/DriverPackages/Neo6_Win8/x86/Neo6_x86_VPN112.inf index 54d000a8..9e0f6e7d 100644 --- a/src/bin/hamcore/DriverPackages/Neo6_Win8/x86/Neo6_x86_VPN112.inf +++ b/src/bin/hamcore/DriverPackages/Neo6_Win8/x86/Neo6_x86_VPN112.inf @@ -1,114 +1,114 @@ -; VPN Client Device Driver for Windows 2000 and Greater -; -; Copyright (c) SoftEther Corporation. All Rights Reserved. -; http://www.softether.co.jp/ -; -; BUILD 9658 - -[Version] -Signature = "$Windows NT$" -Class = Net -ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} -Provider = %CompanyName% -DriverVer = 02/04/2018, 4.25.0.9658 -CatalogFile.NT = inf_VPN112.cat - -[Manufacturer] -%CompanyName% = SoftEther - -[SourceDisksNames] -1=%DiskDescription%, "", , - -[SourceDisksFiles] -Neo_VPN112.sys = 1 - -[DestinationDirs] -DefaultDestDir = 12 -Neo.CopyFiles.Sys = 12 - -[Neo.CopyFiles.Sys] -Neo_VPN112.sys, , , 2 - -[SoftEther] -%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN112 - -[NeoAdapter.Install] -Characteristics = 0x1 -AddReg = Neo.Reg, NeoAdapter.Ndi -CopyFiles = Neo.CopyFiles.Sys -*IfType = 53 -*MediaType = 0 -*PhysicalMediaType = 0 - -[NeoAdapter.Install.Services] -AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% - -[NeoAdapter.Ndi] -HKR, , NetworkAddress, 0, %DefaultAddress% -HKR, Ndi, DeviceID, , "NeoAdapter_VPN112" -HKR, , DevLoader, , ndis -HKR, , DeviceVxDs, , Neo_VPN112.sys -HKR, NDIS, LogDriverName, , "Neo_VPN112" -HKR, NDIS, MajorNdisVersion, 1, 5 -HKR, NDIS, MinorNdisVersion, 1, 0 -HKR, Ndi\Interfaces, DefUpper, , "ndis5" -HKR, Ndi\Interfaces, UpperRange, , "ndis5" -HKR, Ndi\Interfaces, LowerRange, , "ethernet" -HKR, Ndi\Interfaces, DefLower, , "ethernet" -HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" -HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% -HKR, Ndi\Params\NetworkAddress, type, 0, "edit" -HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" -HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" -HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% -HKR, Ndi\Params\NetworkAddress, optional, 0, "0" -HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% -HKR, Ndi\Params\MaxSpeed, type, 0, "int" -HKR, Ndi\Params\MaxSpeed, default, 0, "100" -HKR, Ndi\Params\MaxSpeed, min, 0, "0" -HKR, Ndi\Params\MaxSpeed, max, 0, "2000" -HKR, Ndi\Params\MaxSpeed, step, 0, "1" -HKR, Ndi\Params\MaxSpeed, Base, 0, "10" -HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% -HKR, Ndi\Params\KeepLink, type, 0, "enum" -HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% -HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% -HKR, Ndi\Params\KeepLink, default, 0, "0" - - -[Neo.Service] -DisplayName = %Neo.Service.DispName% -Description = %Neo.Service.Desc% -ServiceType = 1 -StartType = 3 -ErrorControl = 1 -ServiceBinary = %12%\Neo_VPN112.sys -LoadOrderGroup = NDIS - -[Neo.Reg] -HKR, Ndi, Service, 0, Neo.Service.Name -HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" -HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" - -[Neo.EventLog] -HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN112.sys" -HKR, , TypesSupported, 0x00010001, 7 - -[Strings] -CompanyName = "SoftEther Corporation" -DiskDescription = "VPN Client Device Driver Install Disk" -Neo.Service.Name = "Neo_VPN112" -Neo.Service.DispName = "VPN Client Device Driver - VPN112" -Neo.Service.Desc = "VPN Client Adapter - VPN112" -NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN112" -Neo.EventLog.Name = "Neo" -NetworkAddress = "MAC Address" -DefaultAddress = "000001000001" -MaxSpeed = "Indicate Speed (Mbps)" -KeepLink = "Keep Link" -On = "On" -Off = "Off" - - -; Auto Generated 20180205_163608.874 - +; VPN Client Device Driver for Windows 2000 and Greater +; +; Copyright (c) SoftEther Corporation. All Rights Reserved. +; http://www.softether.co.jp/ +; +; BUILD 9658 + +[Version] +Signature = "$Windows NT$" +Class = Net +ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} +Provider = %CompanyName% +DriverVer = 02/04/2018, 4.25.0.9658 +CatalogFile.NT = inf_VPN112.cat + +[Manufacturer] +%CompanyName% = SoftEther + +[SourceDisksNames] +1=%DiskDescription%, "", , + +[SourceDisksFiles] +Neo_VPN112.sys = 1 + +[DestinationDirs] +DefaultDestDir = 12 +Neo.CopyFiles.Sys = 12 + +[Neo.CopyFiles.Sys] +Neo_VPN112.sys, , , 2 + +[SoftEther] +%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN112 + +[NeoAdapter.Install] +Characteristics = 0x1 +AddReg = Neo.Reg, NeoAdapter.Ndi +CopyFiles = Neo.CopyFiles.Sys +*IfType = 53 +*MediaType = 0 +*PhysicalMediaType = 0 + +[NeoAdapter.Install.Services] +AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% + +[NeoAdapter.Ndi] +HKR, , NetworkAddress, 0, %DefaultAddress% +HKR, Ndi, DeviceID, , "NeoAdapter_VPN112" +HKR, , DevLoader, , ndis +HKR, , DeviceVxDs, , Neo_VPN112.sys +HKR, NDIS, LogDriverName, , "Neo_VPN112" +HKR, NDIS, MajorNdisVersion, 1, 5 +HKR, NDIS, MinorNdisVersion, 1, 0 +HKR, Ndi\Interfaces, DefUpper, , "ndis5" +HKR, Ndi\Interfaces, UpperRange, , "ndis5" +HKR, Ndi\Interfaces, LowerRange, , "ethernet" +HKR, Ndi\Interfaces, DefLower, , "ethernet" +HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" +HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% +HKR, Ndi\Params\NetworkAddress, type, 0, "edit" +HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" +HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" +HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% +HKR, Ndi\Params\NetworkAddress, optional, 0, "0" +HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% +HKR, Ndi\Params\MaxSpeed, type, 0, "int" +HKR, Ndi\Params\MaxSpeed, default, 0, "100" +HKR, Ndi\Params\MaxSpeed, min, 0, "0" +HKR, Ndi\Params\MaxSpeed, max, 0, "2000" +HKR, Ndi\Params\MaxSpeed, step, 0, "1" +HKR, Ndi\Params\MaxSpeed, Base, 0, "10" +HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% +HKR, Ndi\Params\KeepLink, type, 0, "enum" +HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% +HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% +HKR, Ndi\Params\KeepLink, default, 0, "0" + + +[Neo.Service] +DisplayName = %Neo.Service.DispName% +Description = %Neo.Service.Desc% +ServiceType = 1 +StartType = 3 +ErrorControl = 1 +ServiceBinary = %12%\Neo_VPN112.sys +LoadOrderGroup = NDIS + +[Neo.Reg] +HKR, Ndi, Service, 0, Neo.Service.Name +HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" +HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" + +[Neo.EventLog] +HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN112.sys" +HKR, , TypesSupported, 0x00010001, 7 + +[Strings] +CompanyName = "SoftEther Corporation" +DiskDescription = "VPN Client Device Driver Install Disk" +Neo.Service.Name = "Neo_VPN112" +Neo.Service.DispName = "VPN Client Device Driver - VPN112" +Neo.Service.Desc = "VPN Client Adapter - VPN112" +NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN112" +Neo.EventLog.Name = "Neo" +NetworkAddress = "MAC Address" +DefaultAddress = "000001000001" +MaxSpeed = "Indicate Speed (Mbps)" +KeepLink = "Keep Link" +On = "On" +Off = "Off" + + +; Auto Generated 20180205_163608.874 + diff --git a/src/bin/hamcore/DriverPackages/Neo6_Win8/x86/Neo6_x86_VPN113.inf b/src/bin/hamcore/DriverPackages/Neo6_Win8/x86/Neo6_x86_VPN113.inf index a16d7999..315ec56a 100644 --- a/src/bin/hamcore/DriverPackages/Neo6_Win8/x86/Neo6_x86_VPN113.inf +++ b/src/bin/hamcore/DriverPackages/Neo6_Win8/x86/Neo6_x86_VPN113.inf @@ -1,114 +1,114 @@ -; VPN Client Device Driver for Windows 2000 and Greater -; -; Copyright (c) SoftEther Corporation. All Rights Reserved. -; http://www.softether.co.jp/ -; -; BUILD 9658 - -[Version] -Signature = "$Windows NT$" -Class = Net -ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} -Provider = %CompanyName% -DriverVer = 02/04/2018, 4.25.0.9658 -CatalogFile.NT = inf_VPN113.cat - -[Manufacturer] -%CompanyName% = SoftEther - -[SourceDisksNames] -1=%DiskDescription%, "", , - -[SourceDisksFiles] -Neo_VPN113.sys = 1 - -[DestinationDirs] -DefaultDestDir = 12 -Neo.CopyFiles.Sys = 12 - -[Neo.CopyFiles.Sys] -Neo_VPN113.sys, , , 2 - -[SoftEther] -%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN113 - -[NeoAdapter.Install] -Characteristics = 0x1 -AddReg = Neo.Reg, NeoAdapter.Ndi -CopyFiles = Neo.CopyFiles.Sys -*IfType = 53 -*MediaType = 0 -*PhysicalMediaType = 0 - -[NeoAdapter.Install.Services] -AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% - -[NeoAdapter.Ndi] -HKR, , NetworkAddress, 0, %DefaultAddress% -HKR, Ndi, DeviceID, , "NeoAdapter_VPN113" -HKR, , DevLoader, , ndis -HKR, , DeviceVxDs, , Neo_VPN113.sys -HKR, NDIS, LogDriverName, , "Neo_VPN113" -HKR, NDIS, MajorNdisVersion, 1, 5 -HKR, NDIS, MinorNdisVersion, 1, 0 -HKR, Ndi\Interfaces, DefUpper, , "ndis5" -HKR, Ndi\Interfaces, UpperRange, , "ndis5" -HKR, Ndi\Interfaces, LowerRange, , "ethernet" -HKR, Ndi\Interfaces, DefLower, , "ethernet" -HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" -HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% -HKR, Ndi\Params\NetworkAddress, type, 0, "edit" -HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" -HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" -HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% -HKR, Ndi\Params\NetworkAddress, optional, 0, "0" -HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% -HKR, Ndi\Params\MaxSpeed, type, 0, "int" -HKR, Ndi\Params\MaxSpeed, default, 0, "100" -HKR, Ndi\Params\MaxSpeed, min, 0, "0" -HKR, Ndi\Params\MaxSpeed, max, 0, "2000" -HKR, Ndi\Params\MaxSpeed, step, 0, "1" -HKR, Ndi\Params\MaxSpeed, Base, 0, "10" -HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% -HKR, Ndi\Params\KeepLink, type, 0, "enum" -HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% -HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% -HKR, Ndi\Params\KeepLink, default, 0, "0" - - -[Neo.Service] -DisplayName = %Neo.Service.DispName% -Description = %Neo.Service.Desc% -ServiceType = 1 -StartType = 3 -ErrorControl = 1 -ServiceBinary = %12%\Neo_VPN113.sys -LoadOrderGroup = NDIS - -[Neo.Reg] -HKR, Ndi, Service, 0, Neo.Service.Name -HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" -HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" - -[Neo.EventLog] -HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN113.sys" -HKR, , TypesSupported, 0x00010001, 7 - -[Strings] -CompanyName = "SoftEther Corporation" -DiskDescription = "VPN Client Device Driver Install Disk" -Neo.Service.Name = "Neo_VPN113" -Neo.Service.DispName = "VPN Client Device Driver - VPN113" -Neo.Service.Desc = "VPN Client Adapter - VPN113" -NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN113" -Neo.EventLog.Name = "Neo" -NetworkAddress = "MAC Address" -DefaultAddress = "000001000001" -MaxSpeed = "Indicate Speed (Mbps)" -KeepLink = "Keep Link" -On = "On" -Off = "Off" - - -; Auto Generated 20180205_163608.875 - +; VPN Client Device Driver for Windows 2000 and Greater +; +; Copyright (c) SoftEther Corporation. All Rights Reserved. +; http://www.softether.co.jp/ +; +; BUILD 9658 + +[Version] +Signature = "$Windows NT$" +Class = Net +ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} +Provider = %CompanyName% +DriverVer = 02/04/2018, 4.25.0.9658 +CatalogFile.NT = inf_VPN113.cat + +[Manufacturer] +%CompanyName% = SoftEther + +[SourceDisksNames] +1=%DiskDescription%, "", , + +[SourceDisksFiles] +Neo_VPN113.sys = 1 + +[DestinationDirs] +DefaultDestDir = 12 +Neo.CopyFiles.Sys = 12 + +[Neo.CopyFiles.Sys] +Neo_VPN113.sys, , , 2 + +[SoftEther] +%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN113 + +[NeoAdapter.Install] +Characteristics = 0x1 +AddReg = Neo.Reg, NeoAdapter.Ndi +CopyFiles = Neo.CopyFiles.Sys +*IfType = 53 +*MediaType = 0 +*PhysicalMediaType = 0 + +[NeoAdapter.Install.Services] +AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% + +[NeoAdapter.Ndi] +HKR, , NetworkAddress, 0, %DefaultAddress% +HKR, Ndi, DeviceID, , "NeoAdapter_VPN113" +HKR, , DevLoader, , ndis +HKR, , DeviceVxDs, , Neo_VPN113.sys +HKR, NDIS, LogDriverName, , "Neo_VPN113" +HKR, NDIS, MajorNdisVersion, 1, 5 +HKR, NDIS, MinorNdisVersion, 1, 0 +HKR, Ndi\Interfaces, DefUpper, , "ndis5" +HKR, Ndi\Interfaces, UpperRange, , "ndis5" +HKR, Ndi\Interfaces, LowerRange, , "ethernet" +HKR, Ndi\Interfaces, DefLower, , "ethernet" +HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" +HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% +HKR, Ndi\Params\NetworkAddress, type, 0, "edit" +HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" +HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" +HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% +HKR, Ndi\Params\NetworkAddress, optional, 0, "0" +HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% +HKR, Ndi\Params\MaxSpeed, type, 0, "int" +HKR, Ndi\Params\MaxSpeed, default, 0, "100" +HKR, Ndi\Params\MaxSpeed, min, 0, "0" +HKR, Ndi\Params\MaxSpeed, max, 0, "2000" +HKR, Ndi\Params\MaxSpeed, step, 0, "1" +HKR, Ndi\Params\MaxSpeed, Base, 0, "10" +HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% +HKR, Ndi\Params\KeepLink, type, 0, "enum" +HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% +HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% +HKR, Ndi\Params\KeepLink, default, 0, "0" + + +[Neo.Service] +DisplayName = %Neo.Service.DispName% +Description = %Neo.Service.Desc% +ServiceType = 1 +StartType = 3 +ErrorControl = 1 +ServiceBinary = %12%\Neo_VPN113.sys +LoadOrderGroup = NDIS + +[Neo.Reg] +HKR, Ndi, Service, 0, Neo.Service.Name +HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" +HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" + +[Neo.EventLog] +HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN113.sys" +HKR, , TypesSupported, 0x00010001, 7 + +[Strings] +CompanyName = "SoftEther Corporation" +DiskDescription = "VPN Client Device Driver Install Disk" +Neo.Service.Name = "Neo_VPN113" +Neo.Service.DispName = "VPN Client Device Driver - VPN113" +Neo.Service.Desc = "VPN Client Adapter - VPN113" +NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN113" +Neo.EventLog.Name = "Neo" +NetworkAddress = "MAC Address" +DefaultAddress = "000001000001" +MaxSpeed = "Indicate Speed (Mbps)" +KeepLink = "Keep Link" +On = "On" +Off = "Off" + + +; Auto Generated 20180205_163608.875 + diff --git a/src/bin/hamcore/DriverPackages/Neo6_Win8/x86/Neo6_x86_VPN114.inf b/src/bin/hamcore/DriverPackages/Neo6_Win8/x86/Neo6_x86_VPN114.inf index 72a97855..72881957 100644 --- a/src/bin/hamcore/DriverPackages/Neo6_Win8/x86/Neo6_x86_VPN114.inf +++ b/src/bin/hamcore/DriverPackages/Neo6_Win8/x86/Neo6_x86_VPN114.inf @@ -1,114 +1,114 @@ -; VPN Client Device Driver for Windows 2000 and Greater -; -; Copyright (c) SoftEther Corporation. All Rights Reserved. -; http://www.softether.co.jp/ -; -; BUILD 9658 - -[Version] -Signature = "$Windows NT$" -Class = Net -ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} -Provider = %CompanyName% -DriverVer = 02/04/2018, 4.25.0.9658 -CatalogFile.NT = inf_VPN114.cat - -[Manufacturer] -%CompanyName% = SoftEther - -[SourceDisksNames] -1=%DiskDescription%, "", , - -[SourceDisksFiles] -Neo_VPN114.sys = 1 - -[DestinationDirs] -DefaultDestDir = 12 -Neo.CopyFiles.Sys = 12 - -[Neo.CopyFiles.Sys] -Neo_VPN114.sys, , , 2 - -[SoftEther] -%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN114 - -[NeoAdapter.Install] -Characteristics = 0x1 -AddReg = Neo.Reg, NeoAdapter.Ndi -CopyFiles = Neo.CopyFiles.Sys -*IfType = 53 -*MediaType = 0 -*PhysicalMediaType = 0 - -[NeoAdapter.Install.Services] -AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% - -[NeoAdapter.Ndi] -HKR, , NetworkAddress, 0, %DefaultAddress% -HKR, Ndi, DeviceID, , "NeoAdapter_VPN114" -HKR, , DevLoader, , ndis -HKR, , DeviceVxDs, , Neo_VPN114.sys -HKR, NDIS, LogDriverName, , "Neo_VPN114" -HKR, NDIS, MajorNdisVersion, 1, 5 -HKR, NDIS, MinorNdisVersion, 1, 0 -HKR, Ndi\Interfaces, DefUpper, , "ndis5" -HKR, Ndi\Interfaces, UpperRange, , "ndis5" -HKR, Ndi\Interfaces, LowerRange, , "ethernet" -HKR, Ndi\Interfaces, DefLower, , "ethernet" -HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" -HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% -HKR, Ndi\Params\NetworkAddress, type, 0, "edit" -HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" -HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" -HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% -HKR, Ndi\Params\NetworkAddress, optional, 0, "0" -HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% -HKR, Ndi\Params\MaxSpeed, type, 0, "int" -HKR, Ndi\Params\MaxSpeed, default, 0, "100" -HKR, Ndi\Params\MaxSpeed, min, 0, "0" -HKR, Ndi\Params\MaxSpeed, max, 0, "2000" -HKR, Ndi\Params\MaxSpeed, step, 0, "1" -HKR, Ndi\Params\MaxSpeed, Base, 0, "10" -HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% -HKR, Ndi\Params\KeepLink, type, 0, "enum" -HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% -HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% -HKR, Ndi\Params\KeepLink, default, 0, "0" - - -[Neo.Service] -DisplayName = %Neo.Service.DispName% -Description = %Neo.Service.Desc% -ServiceType = 1 -StartType = 3 -ErrorControl = 1 -ServiceBinary = %12%\Neo_VPN114.sys -LoadOrderGroup = NDIS - -[Neo.Reg] -HKR, Ndi, Service, 0, Neo.Service.Name -HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" -HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" - -[Neo.EventLog] -HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN114.sys" -HKR, , TypesSupported, 0x00010001, 7 - -[Strings] -CompanyName = "SoftEther Corporation" -DiskDescription = "VPN Client Device Driver Install Disk" -Neo.Service.Name = "Neo_VPN114" -Neo.Service.DispName = "VPN Client Device Driver - VPN114" -Neo.Service.Desc = "VPN Client Adapter - VPN114" -NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN114" -Neo.EventLog.Name = "Neo" -NetworkAddress = "MAC Address" -DefaultAddress = "000001000001" -MaxSpeed = "Indicate Speed (Mbps)" -KeepLink = "Keep Link" -On = "On" -Off = "Off" - - -; Auto Generated 20180205_163608.875 - +; VPN Client Device Driver for Windows 2000 and Greater +; +; Copyright (c) SoftEther Corporation. All Rights Reserved. +; http://www.softether.co.jp/ +; +; BUILD 9658 + +[Version] +Signature = "$Windows NT$" +Class = Net +ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} +Provider = %CompanyName% +DriverVer = 02/04/2018, 4.25.0.9658 +CatalogFile.NT = inf_VPN114.cat + +[Manufacturer] +%CompanyName% = SoftEther + +[SourceDisksNames] +1=%DiskDescription%, "", , + +[SourceDisksFiles] +Neo_VPN114.sys = 1 + +[DestinationDirs] +DefaultDestDir = 12 +Neo.CopyFiles.Sys = 12 + +[Neo.CopyFiles.Sys] +Neo_VPN114.sys, , , 2 + +[SoftEther] +%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN114 + +[NeoAdapter.Install] +Characteristics = 0x1 +AddReg = Neo.Reg, NeoAdapter.Ndi +CopyFiles = Neo.CopyFiles.Sys +*IfType = 53 +*MediaType = 0 +*PhysicalMediaType = 0 + +[NeoAdapter.Install.Services] +AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% + +[NeoAdapter.Ndi] +HKR, , NetworkAddress, 0, %DefaultAddress% +HKR, Ndi, DeviceID, , "NeoAdapter_VPN114" +HKR, , DevLoader, , ndis +HKR, , DeviceVxDs, , Neo_VPN114.sys +HKR, NDIS, LogDriverName, , "Neo_VPN114" +HKR, NDIS, MajorNdisVersion, 1, 5 +HKR, NDIS, MinorNdisVersion, 1, 0 +HKR, Ndi\Interfaces, DefUpper, , "ndis5" +HKR, Ndi\Interfaces, UpperRange, , "ndis5" +HKR, Ndi\Interfaces, LowerRange, , "ethernet" +HKR, Ndi\Interfaces, DefLower, , "ethernet" +HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" +HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% +HKR, Ndi\Params\NetworkAddress, type, 0, "edit" +HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" +HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" +HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% +HKR, Ndi\Params\NetworkAddress, optional, 0, "0" +HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% +HKR, Ndi\Params\MaxSpeed, type, 0, "int" +HKR, Ndi\Params\MaxSpeed, default, 0, "100" +HKR, Ndi\Params\MaxSpeed, min, 0, "0" +HKR, Ndi\Params\MaxSpeed, max, 0, "2000" +HKR, Ndi\Params\MaxSpeed, step, 0, "1" +HKR, Ndi\Params\MaxSpeed, Base, 0, "10" +HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% +HKR, Ndi\Params\KeepLink, type, 0, "enum" +HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% +HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% +HKR, Ndi\Params\KeepLink, default, 0, "0" + + +[Neo.Service] +DisplayName = %Neo.Service.DispName% +Description = %Neo.Service.Desc% +ServiceType = 1 +StartType = 3 +ErrorControl = 1 +ServiceBinary = %12%\Neo_VPN114.sys +LoadOrderGroup = NDIS + +[Neo.Reg] +HKR, Ndi, Service, 0, Neo.Service.Name +HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" +HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" + +[Neo.EventLog] +HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN114.sys" +HKR, , TypesSupported, 0x00010001, 7 + +[Strings] +CompanyName = "SoftEther Corporation" +DiskDescription = "VPN Client Device Driver Install Disk" +Neo.Service.Name = "Neo_VPN114" +Neo.Service.DispName = "VPN Client Device Driver - VPN114" +Neo.Service.Desc = "VPN Client Adapter - VPN114" +NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN114" +Neo.EventLog.Name = "Neo" +NetworkAddress = "MAC Address" +DefaultAddress = "000001000001" +MaxSpeed = "Indicate Speed (Mbps)" +KeepLink = "Keep Link" +On = "On" +Off = "Off" + + +; Auto Generated 20180205_163608.875 + diff --git a/src/bin/hamcore/DriverPackages/Neo6_Win8/x86/Neo6_x86_VPN115.inf b/src/bin/hamcore/DriverPackages/Neo6_Win8/x86/Neo6_x86_VPN115.inf index f5170779..53e5a034 100644 --- a/src/bin/hamcore/DriverPackages/Neo6_Win8/x86/Neo6_x86_VPN115.inf +++ b/src/bin/hamcore/DriverPackages/Neo6_Win8/x86/Neo6_x86_VPN115.inf @@ -1,114 +1,114 @@ -; VPN Client Device Driver for Windows 2000 and Greater -; -; Copyright (c) SoftEther Corporation. All Rights Reserved. -; http://www.softether.co.jp/ -; -; BUILD 9658 - -[Version] -Signature = "$Windows NT$" -Class = Net -ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} -Provider = %CompanyName% -DriverVer = 02/04/2018, 4.25.0.9658 -CatalogFile.NT = inf_VPN115.cat - -[Manufacturer] -%CompanyName% = SoftEther - -[SourceDisksNames] -1=%DiskDescription%, "", , - -[SourceDisksFiles] -Neo_VPN115.sys = 1 - -[DestinationDirs] -DefaultDestDir = 12 -Neo.CopyFiles.Sys = 12 - -[Neo.CopyFiles.Sys] -Neo_VPN115.sys, , , 2 - -[SoftEther] -%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN115 - -[NeoAdapter.Install] -Characteristics = 0x1 -AddReg = Neo.Reg, NeoAdapter.Ndi -CopyFiles = Neo.CopyFiles.Sys -*IfType = 53 -*MediaType = 0 -*PhysicalMediaType = 0 - -[NeoAdapter.Install.Services] -AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% - -[NeoAdapter.Ndi] -HKR, , NetworkAddress, 0, %DefaultAddress% -HKR, Ndi, DeviceID, , "NeoAdapter_VPN115" -HKR, , DevLoader, , ndis -HKR, , DeviceVxDs, , Neo_VPN115.sys -HKR, NDIS, LogDriverName, , "Neo_VPN115" -HKR, NDIS, MajorNdisVersion, 1, 5 -HKR, NDIS, MinorNdisVersion, 1, 0 -HKR, Ndi\Interfaces, DefUpper, , "ndis5" -HKR, Ndi\Interfaces, UpperRange, , "ndis5" -HKR, Ndi\Interfaces, LowerRange, , "ethernet" -HKR, Ndi\Interfaces, DefLower, , "ethernet" -HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" -HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% -HKR, Ndi\Params\NetworkAddress, type, 0, "edit" -HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" -HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" -HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% -HKR, Ndi\Params\NetworkAddress, optional, 0, "0" -HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% -HKR, Ndi\Params\MaxSpeed, type, 0, "int" -HKR, Ndi\Params\MaxSpeed, default, 0, "100" -HKR, Ndi\Params\MaxSpeed, min, 0, "0" -HKR, Ndi\Params\MaxSpeed, max, 0, "2000" -HKR, Ndi\Params\MaxSpeed, step, 0, "1" -HKR, Ndi\Params\MaxSpeed, Base, 0, "10" -HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% -HKR, Ndi\Params\KeepLink, type, 0, "enum" -HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% -HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% -HKR, Ndi\Params\KeepLink, default, 0, "0" - - -[Neo.Service] -DisplayName = %Neo.Service.DispName% -Description = %Neo.Service.Desc% -ServiceType = 1 -StartType = 3 -ErrorControl = 1 -ServiceBinary = %12%\Neo_VPN115.sys -LoadOrderGroup = NDIS - -[Neo.Reg] -HKR, Ndi, Service, 0, Neo.Service.Name -HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" -HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" - -[Neo.EventLog] -HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN115.sys" -HKR, , TypesSupported, 0x00010001, 7 - -[Strings] -CompanyName = "SoftEther Corporation" -DiskDescription = "VPN Client Device Driver Install Disk" -Neo.Service.Name = "Neo_VPN115" -Neo.Service.DispName = "VPN Client Device Driver - VPN115" -Neo.Service.Desc = "VPN Client Adapter - VPN115" -NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN115" -Neo.EventLog.Name = "Neo" -NetworkAddress = "MAC Address" -DefaultAddress = "000001000001" -MaxSpeed = "Indicate Speed (Mbps)" -KeepLink = "Keep Link" -On = "On" -Off = "Off" - - -; Auto Generated 20180205_163608.876 - +; VPN Client Device Driver for Windows 2000 and Greater +; +; Copyright (c) SoftEther Corporation. All Rights Reserved. +; http://www.softether.co.jp/ +; +; BUILD 9658 + +[Version] +Signature = "$Windows NT$" +Class = Net +ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} +Provider = %CompanyName% +DriverVer = 02/04/2018, 4.25.0.9658 +CatalogFile.NT = inf_VPN115.cat + +[Manufacturer] +%CompanyName% = SoftEther + +[SourceDisksNames] +1=%DiskDescription%, "", , + +[SourceDisksFiles] +Neo_VPN115.sys = 1 + +[DestinationDirs] +DefaultDestDir = 12 +Neo.CopyFiles.Sys = 12 + +[Neo.CopyFiles.Sys] +Neo_VPN115.sys, , , 2 + +[SoftEther] +%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN115 + +[NeoAdapter.Install] +Characteristics = 0x1 +AddReg = Neo.Reg, NeoAdapter.Ndi +CopyFiles = Neo.CopyFiles.Sys +*IfType = 53 +*MediaType = 0 +*PhysicalMediaType = 0 + +[NeoAdapter.Install.Services] +AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% + +[NeoAdapter.Ndi] +HKR, , NetworkAddress, 0, %DefaultAddress% +HKR, Ndi, DeviceID, , "NeoAdapter_VPN115" +HKR, , DevLoader, , ndis +HKR, , DeviceVxDs, , Neo_VPN115.sys +HKR, NDIS, LogDriverName, , "Neo_VPN115" +HKR, NDIS, MajorNdisVersion, 1, 5 +HKR, NDIS, MinorNdisVersion, 1, 0 +HKR, Ndi\Interfaces, DefUpper, , "ndis5" +HKR, Ndi\Interfaces, UpperRange, , "ndis5" +HKR, Ndi\Interfaces, LowerRange, , "ethernet" +HKR, Ndi\Interfaces, DefLower, , "ethernet" +HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" +HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% +HKR, Ndi\Params\NetworkAddress, type, 0, "edit" +HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" +HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" +HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% +HKR, Ndi\Params\NetworkAddress, optional, 0, "0" +HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% +HKR, Ndi\Params\MaxSpeed, type, 0, "int" +HKR, Ndi\Params\MaxSpeed, default, 0, "100" +HKR, Ndi\Params\MaxSpeed, min, 0, "0" +HKR, Ndi\Params\MaxSpeed, max, 0, "2000" +HKR, Ndi\Params\MaxSpeed, step, 0, "1" +HKR, Ndi\Params\MaxSpeed, Base, 0, "10" +HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% +HKR, Ndi\Params\KeepLink, type, 0, "enum" +HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% +HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% +HKR, Ndi\Params\KeepLink, default, 0, "0" + + +[Neo.Service] +DisplayName = %Neo.Service.DispName% +Description = %Neo.Service.Desc% +ServiceType = 1 +StartType = 3 +ErrorControl = 1 +ServiceBinary = %12%\Neo_VPN115.sys +LoadOrderGroup = NDIS + +[Neo.Reg] +HKR, Ndi, Service, 0, Neo.Service.Name +HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" +HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" + +[Neo.EventLog] +HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN115.sys" +HKR, , TypesSupported, 0x00010001, 7 + +[Strings] +CompanyName = "SoftEther Corporation" +DiskDescription = "VPN Client Device Driver Install Disk" +Neo.Service.Name = "Neo_VPN115" +Neo.Service.DispName = "VPN Client Device Driver - VPN115" +Neo.Service.Desc = "VPN Client Adapter - VPN115" +NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN115" +Neo.EventLog.Name = "Neo" +NetworkAddress = "MAC Address" +DefaultAddress = "000001000001" +MaxSpeed = "Indicate Speed (Mbps)" +KeepLink = "Keep Link" +On = "On" +Off = "Off" + + +; Auto Generated 20180205_163608.876 + diff --git a/src/bin/hamcore/DriverPackages/Neo6_Win8/x86/Neo6_x86_VPN116.inf b/src/bin/hamcore/DriverPackages/Neo6_Win8/x86/Neo6_x86_VPN116.inf index 1271b758..6f4b474c 100644 --- a/src/bin/hamcore/DriverPackages/Neo6_Win8/x86/Neo6_x86_VPN116.inf +++ b/src/bin/hamcore/DriverPackages/Neo6_Win8/x86/Neo6_x86_VPN116.inf @@ -1,114 +1,114 @@ -; VPN Client Device Driver for Windows 2000 and Greater -; -; Copyright (c) SoftEther Corporation. All Rights Reserved. -; http://www.softether.co.jp/ -; -; BUILD 9658 - -[Version] -Signature = "$Windows NT$" -Class = Net -ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} -Provider = %CompanyName% -DriverVer = 02/04/2018, 4.25.0.9658 -CatalogFile.NT = inf_VPN116.cat - -[Manufacturer] -%CompanyName% = SoftEther - -[SourceDisksNames] -1=%DiskDescription%, "", , - -[SourceDisksFiles] -Neo_VPN116.sys = 1 - -[DestinationDirs] -DefaultDestDir = 12 -Neo.CopyFiles.Sys = 12 - -[Neo.CopyFiles.Sys] -Neo_VPN116.sys, , , 2 - -[SoftEther] -%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN116 - -[NeoAdapter.Install] -Characteristics = 0x1 -AddReg = Neo.Reg, NeoAdapter.Ndi -CopyFiles = Neo.CopyFiles.Sys -*IfType = 53 -*MediaType = 0 -*PhysicalMediaType = 0 - -[NeoAdapter.Install.Services] -AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% - -[NeoAdapter.Ndi] -HKR, , NetworkAddress, 0, %DefaultAddress% -HKR, Ndi, DeviceID, , "NeoAdapter_VPN116" -HKR, , DevLoader, , ndis -HKR, , DeviceVxDs, , Neo_VPN116.sys -HKR, NDIS, LogDriverName, , "Neo_VPN116" -HKR, NDIS, MajorNdisVersion, 1, 5 -HKR, NDIS, MinorNdisVersion, 1, 0 -HKR, Ndi\Interfaces, DefUpper, , "ndis5" -HKR, Ndi\Interfaces, UpperRange, , "ndis5" -HKR, Ndi\Interfaces, LowerRange, , "ethernet" -HKR, Ndi\Interfaces, DefLower, , "ethernet" -HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" -HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% -HKR, Ndi\Params\NetworkAddress, type, 0, "edit" -HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" -HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" -HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% -HKR, Ndi\Params\NetworkAddress, optional, 0, "0" -HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% -HKR, Ndi\Params\MaxSpeed, type, 0, "int" -HKR, Ndi\Params\MaxSpeed, default, 0, "100" -HKR, Ndi\Params\MaxSpeed, min, 0, "0" -HKR, Ndi\Params\MaxSpeed, max, 0, "2000" -HKR, Ndi\Params\MaxSpeed, step, 0, "1" -HKR, Ndi\Params\MaxSpeed, Base, 0, "10" -HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% -HKR, Ndi\Params\KeepLink, type, 0, "enum" -HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% -HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% -HKR, Ndi\Params\KeepLink, default, 0, "0" - - -[Neo.Service] -DisplayName = %Neo.Service.DispName% -Description = %Neo.Service.Desc% -ServiceType = 1 -StartType = 3 -ErrorControl = 1 -ServiceBinary = %12%\Neo_VPN116.sys -LoadOrderGroup = NDIS - -[Neo.Reg] -HKR, Ndi, Service, 0, Neo.Service.Name -HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" -HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" - -[Neo.EventLog] -HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN116.sys" -HKR, , TypesSupported, 0x00010001, 7 - -[Strings] -CompanyName = "SoftEther Corporation" -DiskDescription = "VPN Client Device Driver Install Disk" -Neo.Service.Name = "Neo_VPN116" -Neo.Service.DispName = "VPN Client Device Driver - VPN116" -Neo.Service.Desc = "VPN Client Adapter - VPN116" -NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN116" -Neo.EventLog.Name = "Neo" -NetworkAddress = "MAC Address" -DefaultAddress = "000001000001" -MaxSpeed = "Indicate Speed (Mbps)" -KeepLink = "Keep Link" -On = "On" -Off = "Off" - - -; Auto Generated 20180205_163608.877 - +; VPN Client Device Driver for Windows 2000 and Greater +; +; Copyright (c) SoftEther Corporation. All Rights Reserved. +; http://www.softether.co.jp/ +; +; BUILD 9658 + +[Version] +Signature = "$Windows NT$" +Class = Net +ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} +Provider = %CompanyName% +DriverVer = 02/04/2018, 4.25.0.9658 +CatalogFile.NT = inf_VPN116.cat + +[Manufacturer] +%CompanyName% = SoftEther + +[SourceDisksNames] +1=%DiskDescription%, "", , + +[SourceDisksFiles] +Neo_VPN116.sys = 1 + +[DestinationDirs] +DefaultDestDir = 12 +Neo.CopyFiles.Sys = 12 + +[Neo.CopyFiles.Sys] +Neo_VPN116.sys, , , 2 + +[SoftEther] +%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN116 + +[NeoAdapter.Install] +Characteristics = 0x1 +AddReg = Neo.Reg, NeoAdapter.Ndi +CopyFiles = Neo.CopyFiles.Sys +*IfType = 53 +*MediaType = 0 +*PhysicalMediaType = 0 + +[NeoAdapter.Install.Services] +AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% + +[NeoAdapter.Ndi] +HKR, , NetworkAddress, 0, %DefaultAddress% +HKR, Ndi, DeviceID, , "NeoAdapter_VPN116" +HKR, , DevLoader, , ndis +HKR, , DeviceVxDs, , Neo_VPN116.sys +HKR, NDIS, LogDriverName, , "Neo_VPN116" +HKR, NDIS, MajorNdisVersion, 1, 5 +HKR, NDIS, MinorNdisVersion, 1, 0 +HKR, Ndi\Interfaces, DefUpper, , "ndis5" +HKR, Ndi\Interfaces, UpperRange, , "ndis5" +HKR, Ndi\Interfaces, LowerRange, , "ethernet" +HKR, Ndi\Interfaces, DefLower, , "ethernet" +HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" +HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% +HKR, Ndi\Params\NetworkAddress, type, 0, "edit" +HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" +HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" +HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% +HKR, Ndi\Params\NetworkAddress, optional, 0, "0" +HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% +HKR, Ndi\Params\MaxSpeed, type, 0, "int" +HKR, Ndi\Params\MaxSpeed, default, 0, "100" +HKR, Ndi\Params\MaxSpeed, min, 0, "0" +HKR, Ndi\Params\MaxSpeed, max, 0, "2000" +HKR, Ndi\Params\MaxSpeed, step, 0, "1" +HKR, Ndi\Params\MaxSpeed, Base, 0, "10" +HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% +HKR, Ndi\Params\KeepLink, type, 0, "enum" +HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% +HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% +HKR, Ndi\Params\KeepLink, default, 0, "0" + + +[Neo.Service] +DisplayName = %Neo.Service.DispName% +Description = %Neo.Service.Desc% +ServiceType = 1 +StartType = 3 +ErrorControl = 1 +ServiceBinary = %12%\Neo_VPN116.sys +LoadOrderGroup = NDIS + +[Neo.Reg] +HKR, Ndi, Service, 0, Neo.Service.Name +HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" +HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" + +[Neo.EventLog] +HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN116.sys" +HKR, , TypesSupported, 0x00010001, 7 + +[Strings] +CompanyName = "SoftEther Corporation" +DiskDescription = "VPN Client Device Driver Install Disk" +Neo.Service.Name = "Neo_VPN116" +Neo.Service.DispName = "VPN Client Device Driver - VPN116" +Neo.Service.Desc = "VPN Client Adapter - VPN116" +NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN116" +Neo.EventLog.Name = "Neo" +NetworkAddress = "MAC Address" +DefaultAddress = "000001000001" +MaxSpeed = "Indicate Speed (Mbps)" +KeepLink = "Keep Link" +On = "On" +Off = "Off" + + +; Auto Generated 20180205_163608.877 + diff --git a/src/bin/hamcore/DriverPackages/Neo6_Win8/x86/Neo6_x86_VPN117.inf b/src/bin/hamcore/DriverPackages/Neo6_Win8/x86/Neo6_x86_VPN117.inf index 7bdb64e9..27b33498 100644 --- a/src/bin/hamcore/DriverPackages/Neo6_Win8/x86/Neo6_x86_VPN117.inf +++ b/src/bin/hamcore/DriverPackages/Neo6_Win8/x86/Neo6_x86_VPN117.inf @@ -1,114 +1,114 @@ -; VPN Client Device Driver for Windows 2000 and Greater -; -; Copyright (c) SoftEther Corporation. All Rights Reserved. -; http://www.softether.co.jp/ -; -; BUILD 9658 - -[Version] -Signature = "$Windows NT$" -Class = Net -ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} -Provider = %CompanyName% -DriverVer = 02/04/2018, 4.25.0.9658 -CatalogFile.NT = inf_VPN117.cat - -[Manufacturer] -%CompanyName% = SoftEther - -[SourceDisksNames] -1=%DiskDescription%, "", , - -[SourceDisksFiles] -Neo_VPN117.sys = 1 - -[DestinationDirs] -DefaultDestDir = 12 -Neo.CopyFiles.Sys = 12 - -[Neo.CopyFiles.Sys] -Neo_VPN117.sys, , , 2 - -[SoftEther] -%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN117 - -[NeoAdapter.Install] -Characteristics = 0x1 -AddReg = Neo.Reg, NeoAdapter.Ndi -CopyFiles = Neo.CopyFiles.Sys -*IfType = 53 -*MediaType = 0 -*PhysicalMediaType = 0 - -[NeoAdapter.Install.Services] -AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% - -[NeoAdapter.Ndi] -HKR, , NetworkAddress, 0, %DefaultAddress% -HKR, Ndi, DeviceID, , "NeoAdapter_VPN117" -HKR, , DevLoader, , ndis -HKR, , DeviceVxDs, , Neo_VPN117.sys -HKR, NDIS, LogDriverName, , "Neo_VPN117" -HKR, NDIS, MajorNdisVersion, 1, 5 -HKR, NDIS, MinorNdisVersion, 1, 0 -HKR, Ndi\Interfaces, DefUpper, , "ndis5" -HKR, Ndi\Interfaces, UpperRange, , "ndis5" -HKR, Ndi\Interfaces, LowerRange, , "ethernet" -HKR, Ndi\Interfaces, DefLower, , "ethernet" -HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" -HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% -HKR, Ndi\Params\NetworkAddress, type, 0, "edit" -HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" -HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" -HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% -HKR, Ndi\Params\NetworkAddress, optional, 0, "0" -HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% -HKR, Ndi\Params\MaxSpeed, type, 0, "int" -HKR, Ndi\Params\MaxSpeed, default, 0, "100" -HKR, Ndi\Params\MaxSpeed, min, 0, "0" -HKR, Ndi\Params\MaxSpeed, max, 0, "2000" -HKR, Ndi\Params\MaxSpeed, step, 0, "1" -HKR, Ndi\Params\MaxSpeed, Base, 0, "10" -HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% -HKR, Ndi\Params\KeepLink, type, 0, "enum" -HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% -HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% -HKR, Ndi\Params\KeepLink, default, 0, "0" - - -[Neo.Service] -DisplayName = %Neo.Service.DispName% -Description = %Neo.Service.Desc% -ServiceType = 1 -StartType = 3 -ErrorControl = 1 -ServiceBinary = %12%\Neo_VPN117.sys -LoadOrderGroup = NDIS - -[Neo.Reg] -HKR, Ndi, Service, 0, Neo.Service.Name -HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" -HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" - -[Neo.EventLog] -HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN117.sys" -HKR, , TypesSupported, 0x00010001, 7 - -[Strings] -CompanyName = "SoftEther Corporation" -DiskDescription = "VPN Client Device Driver Install Disk" -Neo.Service.Name = "Neo_VPN117" -Neo.Service.DispName = "VPN Client Device Driver - VPN117" -Neo.Service.Desc = "VPN Client Adapter - VPN117" -NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN117" -Neo.EventLog.Name = "Neo" -NetworkAddress = "MAC Address" -DefaultAddress = "000001000001" -MaxSpeed = "Indicate Speed (Mbps)" -KeepLink = "Keep Link" -On = "On" -Off = "Off" - - -; Auto Generated 20180205_163608.879 - +; VPN Client Device Driver for Windows 2000 and Greater +; +; Copyright (c) SoftEther Corporation. All Rights Reserved. +; http://www.softether.co.jp/ +; +; BUILD 9658 + +[Version] +Signature = "$Windows NT$" +Class = Net +ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} +Provider = %CompanyName% +DriverVer = 02/04/2018, 4.25.0.9658 +CatalogFile.NT = inf_VPN117.cat + +[Manufacturer] +%CompanyName% = SoftEther + +[SourceDisksNames] +1=%DiskDescription%, "", , + +[SourceDisksFiles] +Neo_VPN117.sys = 1 + +[DestinationDirs] +DefaultDestDir = 12 +Neo.CopyFiles.Sys = 12 + +[Neo.CopyFiles.Sys] +Neo_VPN117.sys, , , 2 + +[SoftEther] +%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN117 + +[NeoAdapter.Install] +Characteristics = 0x1 +AddReg = Neo.Reg, NeoAdapter.Ndi +CopyFiles = Neo.CopyFiles.Sys +*IfType = 53 +*MediaType = 0 +*PhysicalMediaType = 0 + +[NeoAdapter.Install.Services] +AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% + +[NeoAdapter.Ndi] +HKR, , NetworkAddress, 0, %DefaultAddress% +HKR, Ndi, DeviceID, , "NeoAdapter_VPN117" +HKR, , DevLoader, , ndis +HKR, , DeviceVxDs, , Neo_VPN117.sys +HKR, NDIS, LogDriverName, , "Neo_VPN117" +HKR, NDIS, MajorNdisVersion, 1, 5 +HKR, NDIS, MinorNdisVersion, 1, 0 +HKR, Ndi\Interfaces, DefUpper, , "ndis5" +HKR, Ndi\Interfaces, UpperRange, , "ndis5" +HKR, Ndi\Interfaces, LowerRange, , "ethernet" +HKR, Ndi\Interfaces, DefLower, , "ethernet" +HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" +HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% +HKR, Ndi\Params\NetworkAddress, type, 0, "edit" +HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" +HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" +HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% +HKR, Ndi\Params\NetworkAddress, optional, 0, "0" +HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% +HKR, Ndi\Params\MaxSpeed, type, 0, "int" +HKR, Ndi\Params\MaxSpeed, default, 0, "100" +HKR, Ndi\Params\MaxSpeed, min, 0, "0" +HKR, Ndi\Params\MaxSpeed, max, 0, "2000" +HKR, Ndi\Params\MaxSpeed, step, 0, "1" +HKR, Ndi\Params\MaxSpeed, Base, 0, "10" +HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% +HKR, Ndi\Params\KeepLink, type, 0, "enum" +HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% +HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% +HKR, Ndi\Params\KeepLink, default, 0, "0" + + +[Neo.Service] +DisplayName = %Neo.Service.DispName% +Description = %Neo.Service.Desc% +ServiceType = 1 +StartType = 3 +ErrorControl = 1 +ServiceBinary = %12%\Neo_VPN117.sys +LoadOrderGroup = NDIS + +[Neo.Reg] +HKR, Ndi, Service, 0, Neo.Service.Name +HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" +HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" + +[Neo.EventLog] +HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN117.sys" +HKR, , TypesSupported, 0x00010001, 7 + +[Strings] +CompanyName = "SoftEther Corporation" +DiskDescription = "VPN Client Device Driver Install Disk" +Neo.Service.Name = "Neo_VPN117" +Neo.Service.DispName = "VPN Client Device Driver - VPN117" +Neo.Service.Desc = "VPN Client Adapter - VPN117" +NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN117" +Neo.EventLog.Name = "Neo" +NetworkAddress = "MAC Address" +DefaultAddress = "000001000001" +MaxSpeed = "Indicate Speed (Mbps)" +KeepLink = "Keep Link" +On = "On" +Off = "Off" + + +; Auto Generated 20180205_163608.879 + diff --git a/src/bin/hamcore/DriverPackages/Neo6_Win8/x86/Neo6_x86_VPN118.inf b/src/bin/hamcore/DriverPackages/Neo6_Win8/x86/Neo6_x86_VPN118.inf index 73e6b482..05329497 100644 --- a/src/bin/hamcore/DriverPackages/Neo6_Win8/x86/Neo6_x86_VPN118.inf +++ b/src/bin/hamcore/DriverPackages/Neo6_Win8/x86/Neo6_x86_VPN118.inf @@ -1,114 +1,114 @@ -; VPN Client Device Driver for Windows 2000 and Greater -; -; Copyright (c) SoftEther Corporation. All Rights Reserved. -; http://www.softether.co.jp/ -; -; BUILD 9658 - -[Version] -Signature = "$Windows NT$" -Class = Net -ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} -Provider = %CompanyName% -DriverVer = 02/04/2018, 4.25.0.9658 -CatalogFile.NT = inf_VPN118.cat - -[Manufacturer] -%CompanyName% = SoftEther - -[SourceDisksNames] -1=%DiskDescription%, "", , - -[SourceDisksFiles] -Neo_VPN118.sys = 1 - -[DestinationDirs] -DefaultDestDir = 12 -Neo.CopyFiles.Sys = 12 - -[Neo.CopyFiles.Sys] -Neo_VPN118.sys, , , 2 - -[SoftEther] -%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN118 - -[NeoAdapter.Install] -Characteristics = 0x1 -AddReg = Neo.Reg, NeoAdapter.Ndi -CopyFiles = Neo.CopyFiles.Sys -*IfType = 53 -*MediaType = 0 -*PhysicalMediaType = 0 - -[NeoAdapter.Install.Services] -AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% - -[NeoAdapter.Ndi] -HKR, , NetworkAddress, 0, %DefaultAddress% -HKR, Ndi, DeviceID, , "NeoAdapter_VPN118" -HKR, , DevLoader, , ndis -HKR, , DeviceVxDs, , Neo_VPN118.sys -HKR, NDIS, LogDriverName, , "Neo_VPN118" -HKR, NDIS, MajorNdisVersion, 1, 5 -HKR, NDIS, MinorNdisVersion, 1, 0 -HKR, Ndi\Interfaces, DefUpper, , "ndis5" -HKR, Ndi\Interfaces, UpperRange, , "ndis5" -HKR, Ndi\Interfaces, LowerRange, , "ethernet" -HKR, Ndi\Interfaces, DefLower, , "ethernet" -HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" -HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% -HKR, Ndi\Params\NetworkAddress, type, 0, "edit" -HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" -HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" -HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% -HKR, Ndi\Params\NetworkAddress, optional, 0, "0" -HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% -HKR, Ndi\Params\MaxSpeed, type, 0, "int" -HKR, Ndi\Params\MaxSpeed, default, 0, "100" -HKR, Ndi\Params\MaxSpeed, min, 0, "0" -HKR, Ndi\Params\MaxSpeed, max, 0, "2000" -HKR, Ndi\Params\MaxSpeed, step, 0, "1" -HKR, Ndi\Params\MaxSpeed, Base, 0, "10" -HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% -HKR, Ndi\Params\KeepLink, type, 0, "enum" -HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% -HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% -HKR, Ndi\Params\KeepLink, default, 0, "0" - - -[Neo.Service] -DisplayName = %Neo.Service.DispName% -Description = %Neo.Service.Desc% -ServiceType = 1 -StartType = 3 -ErrorControl = 1 -ServiceBinary = %12%\Neo_VPN118.sys -LoadOrderGroup = NDIS - -[Neo.Reg] -HKR, Ndi, Service, 0, Neo.Service.Name -HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" -HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" - -[Neo.EventLog] -HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN118.sys" -HKR, , TypesSupported, 0x00010001, 7 - -[Strings] -CompanyName = "SoftEther Corporation" -DiskDescription = "VPN Client Device Driver Install Disk" -Neo.Service.Name = "Neo_VPN118" -Neo.Service.DispName = "VPN Client Device Driver - VPN118" -Neo.Service.Desc = "VPN Client Adapter - VPN118" -NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN118" -Neo.EventLog.Name = "Neo" -NetworkAddress = "MAC Address" -DefaultAddress = "000001000001" -MaxSpeed = "Indicate Speed (Mbps)" -KeepLink = "Keep Link" -On = "On" -Off = "Off" - - -; Auto Generated 20180205_163608.880 - +; VPN Client Device Driver for Windows 2000 and Greater +; +; Copyright (c) SoftEther Corporation. All Rights Reserved. +; http://www.softether.co.jp/ +; +; BUILD 9658 + +[Version] +Signature = "$Windows NT$" +Class = Net +ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} +Provider = %CompanyName% +DriverVer = 02/04/2018, 4.25.0.9658 +CatalogFile.NT = inf_VPN118.cat + +[Manufacturer] +%CompanyName% = SoftEther + +[SourceDisksNames] +1=%DiskDescription%, "", , + +[SourceDisksFiles] +Neo_VPN118.sys = 1 + +[DestinationDirs] +DefaultDestDir = 12 +Neo.CopyFiles.Sys = 12 + +[Neo.CopyFiles.Sys] +Neo_VPN118.sys, , , 2 + +[SoftEther] +%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN118 + +[NeoAdapter.Install] +Characteristics = 0x1 +AddReg = Neo.Reg, NeoAdapter.Ndi +CopyFiles = Neo.CopyFiles.Sys +*IfType = 53 +*MediaType = 0 +*PhysicalMediaType = 0 + +[NeoAdapter.Install.Services] +AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% + +[NeoAdapter.Ndi] +HKR, , NetworkAddress, 0, %DefaultAddress% +HKR, Ndi, DeviceID, , "NeoAdapter_VPN118" +HKR, , DevLoader, , ndis +HKR, , DeviceVxDs, , Neo_VPN118.sys +HKR, NDIS, LogDriverName, , "Neo_VPN118" +HKR, NDIS, MajorNdisVersion, 1, 5 +HKR, NDIS, MinorNdisVersion, 1, 0 +HKR, Ndi\Interfaces, DefUpper, , "ndis5" +HKR, Ndi\Interfaces, UpperRange, , "ndis5" +HKR, Ndi\Interfaces, LowerRange, , "ethernet" +HKR, Ndi\Interfaces, DefLower, , "ethernet" +HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" +HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% +HKR, Ndi\Params\NetworkAddress, type, 0, "edit" +HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" +HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" +HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% +HKR, Ndi\Params\NetworkAddress, optional, 0, "0" +HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% +HKR, Ndi\Params\MaxSpeed, type, 0, "int" +HKR, Ndi\Params\MaxSpeed, default, 0, "100" +HKR, Ndi\Params\MaxSpeed, min, 0, "0" +HKR, Ndi\Params\MaxSpeed, max, 0, "2000" +HKR, Ndi\Params\MaxSpeed, step, 0, "1" +HKR, Ndi\Params\MaxSpeed, Base, 0, "10" +HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% +HKR, Ndi\Params\KeepLink, type, 0, "enum" +HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% +HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% +HKR, Ndi\Params\KeepLink, default, 0, "0" + + +[Neo.Service] +DisplayName = %Neo.Service.DispName% +Description = %Neo.Service.Desc% +ServiceType = 1 +StartType = 3 +ErrorControl = 1 +ServiceBinary = %12%\Neo_VPN118.sys +LoadOrderGroup = NDIS + +[Neo.Reg] +HKR, Ndi, Service, 0, Neo.Service.Name +HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" +HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" + +[Neo.EventLog] +HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN118.sys" +HKR, , TypesSupported, 0x00010001, 7 + +[Strings] +CompanyName = "SoftEther Corporation" +DiskDescription = "VPN Client Device Driver Install Disk" +Neo.Service.Name = "Neo_VPN118" +Neo.Service.DispName = "VPN Client Device Driver - VPN118" +Neo.Service.Desc = "VPN Client Adapter - VPN118" +NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN118" +Neo.EventLog.Name = "Neo" +NetworkAddress = "MAC Address" +DefaultAddress = "000001000001" +MaxSpeed = "Indicate Speed (Mbps)" +KeepLink = "Keep Link" +On = "On" +Off = "Off" + + +; Auto Generated 20180205_163608.880 + diff --git a/src/bin/hamcore/DriverPackages/Neo6_Win8/x86/Neo6_x86_VPN119.inf b/src/bin/hamcore/DriverPackages/Neo6_Win8/x86/Neo6_x86_VPN119.inf index f9dde792..a9220880 100644 --- a/src/bin/hamcore/DriverPackages/Neo6_Win8/x86/Neo6_x86_VPN119.inf +++ b/src/bin/hamcore/DriverPackages/Neo6_Win8/x86/Neo6_x86_VPN119.inf @@ -1,114 +1,114 @@ -; VPN Client Device Driver for Windows 2000 and Greater -; -; Copyright (c) SoftEther Corporation. All Rights Reserved. -; http://www.softether.co.jp/ -; -; BUILD 9658 - -[Version] -Signature = "$Windows NT$" -Class = Net -ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} -Provider = %CompanyName% -DriverVer = 02/04/2018, 4.25.0.9658 -CatalogFile.NT = inf_VPN119.cat - -[Manufacturer] -%CompanyName% = SoftEther - -[SourceDisksNames] -1=%DiskDescription%, "", , - -[SourceDisksFiles] -Neo_VPN119.sys = 1 - -[DestinationDirs] -DefaultDestDir = 12 -Neo.CopyFiles.Sys = 12 - -[Neo.CopyFiles.Sys] -Neo_VPN119.sys, , , 2 - -[SoftEther] -%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN119 - -[NeoAdapter.Install] -Characteristics = 0x1 -AddReg = Neo.Reg, NeoAdapter.Ndi -CopyFiles = Neo.CopyFiles.Sys -*IfType = 53 -*MediaType = 0 -*PhysicalMediaType = 0 - -[NeoAdapter.Install.Services] -AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% - -[NeoAdapter.Ndi] -HKR, , NetworkAddress, 0, %DefaultAddress% -HKR, Ndi, DeviceID, , "NeoAdapter_VPN119" -HKR, , DevLoader, , ndis -HKR, , DeviceVxDs, , Neo_VPN119.sys -HKR, NDIS, LogDriverName, , "Neo_VPN119" -HKR, NDIS, MajorNdisVersion, 1, 5 -HKR, NDIS, MinorNdisVersion, 1, 0 -HKR, Ndi\Interfaces, DefUpper, , "ndis5" -HKR, Ndi\Interfaces, UpperRange, , "ndis5" -HKR, Ndi\Interfaces, LowerRange, , "ethernet" -HKR, Ndi\Interfaces, DefLower, , "ethernet" -HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" -HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% -HKR, Ndi\Params\NetworkAddress, type, 0, "edit" -HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" -HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" -HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% -HKR, Ndi\Params\NetworkAddress, optional, 0, "0" -HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% -HKR, Ndi\Params\MaxSpeed, type, 0, "int" -HKR, Ndi\Params\MaxSpeed, default, 0, "100" -HKR, Ndi\Params\MaxSpeed, min, 0, "0" -HKR, Ndi\Params\MaxSpeed, max, 0, "2000" -HKR, Ndi\Params\MaxSpeed, step, 0, "1" -HKR, Ndi\Params\MaxSpeed, Base, 0, "10" -HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% -HKR, Ndi\Params\KeepLink, type, 0, "enum" -HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% -HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% -HKR, Ndi\Params\KeepLink, default, 0, "0" - - -[Neo.Service] -DisplayName = %Neo.Service.DispName% -Description = %Neo.Service.Desc% -ServiceType = 1 -StartType = 3 -ErrorControl = 1 -ServiceBinary = %12%\Neo_VPN119.sys -LoadOrderGroup = NDIS - -[Neo.Reg] -HKR, Ndi, Service, 0, Neo.Service.Name -HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" -HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" - -[Neo.EventLog] -HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN119.sys" -HKR, , TypesSupported, 0x00010001, 7 - -[Strings] -CompanyName = "SoftEther Corporation" -DiskDescription = "VPN Client Device Driver Install Disk" -Neo.Service.Name = "Neo_VPN119" -Neo.Service.DispName = "VPN Client Device Driver - VPN119" -Neo.Service.Desc = "VPN Client Adapter - VPN119" -NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN119" -Neo.EventLog.Name = "Neo" -NetworkAddress = "MAC Address" -DefaultAddress = "000001000001" -MaxSpeed = "Indicate Speed (Mbps)" -KeepLink = "Keep Link" -On = "On" -Off = "Off" - - -; Auto Generated 20180205_163608.881 - +; VPN Client Device Driver for Windows 2000 and Greater +; +; Copyright (c) SoftEther Corporation. All Rights Reserved. +; http://www.softether.co.jp/ +; +; BUILD 9658 + +[Version] +Signature = "$Windows NT$" +Class = Net +ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} +Provider = %CompanyName% +DriverVer = 02/04/2018, 4.25.0.9658 +CatalogFile.NT = inf_VPN119.cat + +[Manufacturer] +%CompanyName% = SoftEther + +[SourceDisksNames] +1=%DiskDescription%, "", , + +[SourceDisksFiles] +Neo_VPN119.sys = 1 + +[DestinationDirs] +DefaultDestDir = 12 +Neo.CopyFiles.Sys = 12 + +[Neo.CopyFiles.Sys] +Neo_VPN119.sys, , , 2 + +[SoftEther] +%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN119 + +[NeoAdapter.Install] +Characteristics = 0x1 +AddReg = Neo.Reg, NeoAdapter.Ndi +CopyFiles = Neo.CopyFiles.Sys +*IfType = 53 +*MediaType = 0 +*PhysicalMediaType = 0 + +[NeoAdapter.Install.Services] +AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% + +[NeoAdapter.Ndi] +HKR, , NetworkAddress, 0, %DefaultAddress% +HKR, Ndi, DeviceID, , "NeoAdapter_VPN119" +HKR, , DevLoader, , ndis +HKR, , DeviceVxDs, , Neo_VPN119.sys +HKR, NDIS, LogDriverName, , "Neo_VPN119" +HKR, NDIS, MajorNdisVersion, 1, 5 +HKR, NDIS, MinorNdisVersion, 1, 0 +HKR, Ndi\Interfaces, DefUpper, , "ndis5" +HKR, Ndi\Interfaces, UpperRange, , "ndis5" +HKR, Ndi\Interfaces, LowerRange, , "ethernet" +HKR, Ndi\Interfaces, DefLower, , "ethernet" +HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" +HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% +HKR, Ndi\Params\NetworkAddress, type, 0, "edit" +HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" +HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" +HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% +HKR, Ndi\Params\NetworkAddress, optional, 0, "0" +HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% +HKR, Ndi\Params\MaxSpeed, type, 0, "int" +HKR, Ndi\Params\MaxSpeed, default, 0, "100" +HKR, Ndi\Params\MaxSpeed, min, 0, "0" +HKR, Ndi\Params\MaxSpeed, max, 0, "2000" +HKR, Ndi\Params\MaxSpeed, step, 0, "1" +HKR, Ndi\Params\MaxSpeed, Base, 0, "10" +HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% +HKR, Ndi\Params\KeepLink, type, 0, "enum" +HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% +HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% +HKR, Ndi\Params\KeepLink, default, 0, "0" + + +[Neo.Service] +DisplayName = %Neo.Service.DispName% +Description = %Neo.Service.Desc% +ServiceType = 1 +StartType = 3 +ErrorControl = 1 +ServiceBinary = %12%\Neo_VPN119.sys +LoadOrderGroup = NDIS + +[Neo.Reg] +HKR, Ndi, Service, 0, Neo.Service.Name +HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" +HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" + +[Neo.EventLog] +HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN119.sys" +HKR, , TypesSupported, 0x00010001, 7 + +[Strings] +CompanyName = "SoftEther Corporation" +DiskDescription = "VPN Client Device Driver Install Disk" +Neo.Service.Name = "Neo_VPN119" +Neo.Service.DispName = "VPN Client Device Driver - VPN119" +Neo.Service.Desc = "VPN Client Adapter - VPN119" +NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN119" +Neo.EventLog.Name = "Neo" +NetworkAddress = "MAC Address" +DefaultAddress = "000001000001" +MaxSpeed = "Indicate Speed (Mbps)" +KeepLink = "Keep Link" +On = "On" +Off = "Off" + + +; Auto Generated 20180205_163608.881 + diff --git a/src/bin/hamcore/DriverPackages/Neo6_Win8/x86/Neo6_x86_VPN12.inf b/src/bin/hamcore/DriverPackages/Neo6_Win8/x86/Neo6_x86_VPN12.inf index d0a78ab7..d211109f 100644 --- a/src/bin/hamcore/DriverPackages/Neo6_Win8/x86/Neo6_x86_VPN12.inf +++ b/src/bin/hamcore/DriverPackages/Neo6_Win8/x86/Neo6_x86_VPN12.inf @@ -1,114 +1,114 @@ -; VPN Client Device Driver for Windows 2000 and Greater -; -; Copyright (c) SoftEther Corporation. All Rights Reserved. -; http://www.softether.co.jp/ -; -; BUILD 9658 - -[Version] -Signature = "$Windows NT$" -Class = Net -ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} -Provider = %CompanyName% -DriverVer = 02/04/2018, 4.25.0.9658 -CatalogFile.NT = inf_VPN12.cat - -[Manufacturer] -%CompanyName% = SoftEther - -[SourceDisksNames] -1=%DiskDescription%, "", , - -[SourceDisksFiles] -Neo_VPN12.sys = 1 - -[DestinationDirs] -DefaultDestDir = 12 -Neo.CopyFiles.Sys = 12 - -[Neo.CopyFiles.Sys] -Neo_VPN12.sys, , , 2 - -[SoftEther] -%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN12 - -[NeoAdapter.Install] -Characteristics = 0x1 -AddReg = Neo.Reg, NeoAdapter.Ndi -CopyFiles = Neo.CopyFiles.Sys -*IfType = 53 -*MediaType = 0 -*PhysicalMediaType = 0 - -[NeoAdapter.Install.Services] -AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% - -[NeoAdapter.Ndi] -HKR, , NetworkAddress, 0, %DefaultAddress% -HKR, Ndi, DeviceID, , "NeoAdapter_VPN12" -HKR, , DevLoader, , ndis -HKR, , DeviceVxDs, , Neo_VPN12.sys -HKR, NDIS, LogDriverName, , "Neo_VPN12" -HKR, NDIS, MajorNdisVersion, 1, 5 -HKR, NDIS, MinorNdisVersion, 1, 0 -HKR, Ndi\Interfaces, DefUpper, , "ndis5" -HKR, Ndi\Interfaces, UpperRange, , "ndis5" -HKR, Ndi\Interfaces, LowerRange, , "ethernet" -HKR, Ndi\Interfaces, DefLower, , "ethernet" -HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" -HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% -HKR, Ndi\Params\NetworkAddress, type, 0, "edit" -HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" -HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" -HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% -HKR, Ndi\Params\NetworkAddress, optional, 0, "0" -HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% -HKR, Ndi\Params\MaxSpeed, type, 0, "int" -HKR, Ndi\Params\MaxSpeed, default, 0, "100" -HKR, Ndi\Params\MaxSpeed, min, 0, "0" -HKR, Ndi\Params\MaxSpeed, max, 0, "2000" -HKR, Ndi\Params\MaxSpeed, step, 0, "1" -HKR, Ndi\Params\MaxSpeed, Base, 0, "10" -HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% -HKR, Ndi\Params\KeepLink, type, 0, "enum" -HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% -HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% -HKR, Ndi\Params\KeepLink, default, 0, "0" - - -[Neo.Service] -DisplayName = %Neo.Service.DispName% -Description = %Neo.Service.Desc% -ServiceType = 1 -StartType = 3 -ErrorControl = 1 -ServiceBinary = %12%\Neo_VPN12.sys -LoadOrderGroup = NDIS - -[Neo.Reg] -HKR, Ndi, Service, 0, Neo.Service.Name -HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" -HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" - -[Neo.EventLog] -HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN12.sys" -HKR, , TypesSupported, 0x00010001, 7 - -[Strings] -CompanyName = "SoftEther Corporation" -DiskDescription = "VPN Client Device Driver Install Disk" -Neo.Service.Name = "Neo_VPN12" -Neo.Service.DispName = "VPN Client Device Driver - VPN12" -Neo.Service.Desc = "VPN Client Adapter - VPN12" -NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN12" -Neo.EventLog.Name = "Neo" -NetworkAddress = "MAC Address" -DefaultAddress = "000001000001" -MaxSpeed = "Indicate Speed (Mbps)" -KeepLink = "Keep Link" -On = "On" -Off = "Off" - - -; Auto Generated 20180205_163608.759 - +; VPN Client Device Driver for Windows 2000 and Greater +; +; Copyright (c) SoftEther Corporation. All Rights Reserved. +; http://www.softether.co.jp/ +; +; BUILD 9658 + +[Version] +Signature = "$Windows NT$" +Class = Net +ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} +Provider = %CompanyName% +DriverVer = 02/04/2018, 4.25.0.9658 +CatalogFile.NT = inf_VPN12.cat + +[Manufacturer] +%CompanyName% = SoftEther + +[SourceDisksNames] +1=%DiskDescription%, "", , + +[SourceDisksFiles] +Neo_VPN12.sys = 1 + +[DestinationDirs] +DefaultDestDir = 12 +Neo.CopyFiles.Sys = 12 + +[Neo.CopyFiles.Sys] +Neo_VPN12.sys, , , 2 + +[SoftEther] +%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN12 + +[NeoAdapter.Install] +Characteristics = 0x1 +AddReg = Neo.Reg, NeoAdapter.Ndi +CopyFiles = Neo.CopyFiles.Sys +*IfType = 53 +*MediaType = 0 +*PhysicalMediaType = 0 + +[NeoAdapter.Install.Services] +AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% + +[NeoAdapter.Ndi] +HKR, , NetworkAddress, 0, %DefaultAddress% +HKR, Ndi, DeviceID, , "NeoAdapter_VPN12" +HKR, , DevLoader, , ndis +HKR, , DeviceVxDs, , Neo_VPN12.sys +HKR, NDIS, LogDriverName, , "Neo_VPN12" +HKR, NDIS, MajorNdisVersion, 1, 5 +HKR, NDIS, MinorNdisVersion, 1, 0 +HKR, Ndi\Interfaces, DefUpper, , "ndis5" +HKR, Ndi\Interfaces, UpperRange, , "ndis5" +HKR, Ndi\Interfaces, LowerRange, , "ethernet" +HKR, Ndi\Interfaces, DefLower, , "ethernet" +HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" +HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% +HKR, Ndi\Params\NetworkAddress, type, 0, "edit" +HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" +HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" +HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% +HKR, Ndi\Params\NetworkAddress, optional, 0, "0" +HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% +HKR, Ndi\Params\MaxSpeed, type, 0, "int" +HKR, Ndi\Params\MaxSpeed, default, 0, "100" +HKR, Ndi\Params\MaxSpeed, min, 0, "0" +HKR, Ndi\Params\MaxSpeed, max, 0, "2000" +HKR, Ndi\Params\MaxSpeed, step, 0, "1" +HKR, Ndi\Params\MaxSpeed, Base, 0, "10" +HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% +HKR, Ndi\Params\KeepLink, type, 0, "enum" +HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% +HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% +HKR, Ndi\Params\KeepLink, default, 0, "0" + + +[Neo.Service] +DisplayName = %Neo.Service.DispName% +Description = %Neo.Service.Desc% +ServiceType = 1 +StartType = 3 +ErrorControl = 1 +ServiceBinary = %12%\Neo_VPN12.sys +LoadOrderGroup = NDIS + +[Neo.Reg] +HKR, Ndi, Service, 0, Neo.Service.Name +HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" +HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" + +[Neo.EventLog] +HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN12.sys" +HKR, , TypesSupported, 0x00010001, 7 + +[Strings] +CompanyName = "SoftEther Corporation" +DiskDescription = "VPN Client Device Driver Install Disk" +Neo.Service.Name = "Neo_VPN12" +Neo.Service.DispName = "VPN Client Device Driver - VPN12" +Neo.Service.Desc = "VPN Client Adapter - VPN12" +NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN12" +Neo.EventLog.Name = "Neo" +NetworkAddress = "MAC Address" +DefaultAddress = "000001000001" +MaxSpeed = "Indicate Speed (Mbps)" +KeepLink = "Keep Link" +On = "On" +Off = "Off" + + +; Auto Generated 20180205_163608.759 + diff --git a/src/bin/hamcore/DriverPackages/Neo6_Win8/x86/Neo6_x86_VPN120.inf b/src/bin/hamcore/DriverPackages/Neo6_Win8/x86/Neo6_x86_VPN120.inf index 5eda5b0d..259535c2 100644 --- a/src/bin/hamcore/DriverPackages/Neo6_Win8/x86/Neo6_x86_VPN120.inf +++ b/src/bin/hamcore/DriverPackages/Neo6_Win8/x86/Neo6_x86_VPN120.inf @@ -1,114 +1,114 @@ -; VPN Client Device Driver for Windows 2000 and Greater -; -; Copyright (c) SoftEther Corporation. All Rights Reserved. -; http://www.softether.co.jp/ -; -; BUILD 9658 - -[Version] -Signature = "$Windows NT$" -Class = Net -ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} -Provider = %CompanyName% -DriverVer = 02/04/2018, 4.25.0.9658 -CatalogFile.NT = inf_VPN120.cat - -[Manufacturer] -%CompanyName% = SoftEther - -[SourceDisksNames] -1=%DiskDescription%, "", , - -[SourceDisksFiles] -Neo_VPN120.sys = 1 - -[DestinationDirs] -DefaultDestDir = 12 -Neo.CopyFiles.Sys = 12 - -[Neo.CopyFiles.Sys] -Neo_VPN120.sys, , , 2 - -[SoftEther] -%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN120 - -[NeoAdapter.Install] -Characteristics = 0x1 -AddReg = Neo.Reg, NeoAdapter.Ndi -CopyFiles = Neo.CopyFiles.Sys -*IfType = 53 -*MediaType = 0 -*PhysicalMediaType = 0 - -[NeoAdapter.Install.Services] -AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% - -[NeoAdapter.Ndi] -HKR, , NetworkAddress, 0, %DefaultAddress% -HKR, Ndi, DeviceID, , "NeoAdapter_VPN120" -HKR, , DevLoader, , ndis -HKR, , DeviceVxDs, , Neo_VPN120.sys -HKR, NDIS, LogDriverName, , "Neo_VPN120" -HKR, NDIS, MajorNdisVersion, 1, 5 -HKR, NDIS, MinorNdisVersion, 1, 0 -HKR, Ndi\Interfaces, DefUpper, , "ndis5" -HKR, Ndi\Interfaces, UpperRange, , "ndis5" -HKR, Ndi\Interfaces, LowerRange, , "ethernet" -HKR, Ndi\Interfaces, DefLower, , "ethernet" -HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" -HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% -HKR, Ndi\Params\NetworkAddress, type, 0, "edit" -HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" -HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" -HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% -HKR, Ndi\Params\NetworkAddress, optional, 0, "0" -HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% -HKR, Ndi\Params\MaxSpeed, type, 0, "int" -HKR, Ndi\Params\MaxSpeed, default, 0, "100" -HKR, Ndi\Params\MaxSpeed, min, 0, "0" -HKR, Ndi\Params\MaxSpeed, max, 0, "2000" -HKR, Ndi\Params\MaxSpeed, step, 0, "1" -HKR, Ndi\Params\MaxSpeed, Base, 0, "10" -HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% -HKR, Ndi\Params\KeepLink, type, 0, "enum" -HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% -HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% -HKR, Ndi\Params\KeepLink, default, 0, "0" - - -[Neo.Service] -DisplayName = %Neo.Service.DispName% -Description = %Neo.Service.Desc% -ServiceType = 1 -StartType = 3 -ErrorControl = 1 -ServiceBinary = %12%\Neo_VPN120.sys -LoadOrderGroup = NDIS - -[Neo.Reg] -HKR, Ndi, Service, 0, Neo.Service.Name -HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" -HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" - -[Neo.EventLog] -HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN120.sys" -HKR, , TypesSupported, 0x00010001, 7 - -[Strings] -CompanyName = "SoftEther Corporation" -DiskDescription = "VPN Client Device Driver Install Disk" -Neo.Service.Name = "Neo_VPN120" -Neo.Service.DispName = "VPN Client Device Driver - VPN120" -Neo.Service.Desc = "VPN Client Adapter - VPN120" -NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN120" -Neo.EventLog.Name = "Neo" -NetworkAddress = "MAC Address" -DefaultAddress = "000001000001" -MaxSpeed = "Indicate Speed (Mbps)" -KeepLink = "Keep Link" -On = "On" -Off = "Off" - - -; Auto Generated 20180205_163608.882 - +; VPN Client Device Driver for Windows 2000 and Greater +; +; Copyright (c) SoftEther Corporation. All Rights Reserved. +; http://www.softether.co.jp/ +; +; BUILD 9658 + +[Version] +Signature = "$Windows NT$" +Class = Net +ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} +Provider = %CompanyName% +DriverVer = 02/04/2018, 4.25.0.9658 +CatalogFile.NT = inf_VPN120.cat + +[Manufacturer] +%CompanyName% = SoftEther + +[SourceDisksNames] +1=%DiskDescription%, "", , + +[SourceDisksFiles] +Neo_VPN120.sys = 1 + +[DestinationDirs] +DefaultDestDir = 12 +Neo.CopyFiles.Sys = 12 + +[Neo.CopyFiles.Sys] +Neo_VPN120.sys, , , 2 + +[SoftEther] +%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN120 + +[NeoAdapter.Install] +Characteristics = 0x1 +AddReg = Neo.Reg, NeoAdapter.Ndi +CopyFiles = Neo.CopyFiles.Sys +*IfType = 53 +*MediaType = 0 +*PhysicalMediaType = 0 + +[NeoAdapter.Install.Services] +AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% + +[NeoAdapter.Ndi] +HKR, , NetworkAddress, 0, %DefaultAddress% +HKR, Ndi, DeviceID, , "NeoAdapter_VPN120" +HKR, , DevLoader, , ndis +HKR, , DeviceVxDs, , Neo_VPN120.sys +HKR, NDIS, LogDriverName, , "Neo_VPN120" +HKR, NDIS, MajorNdisVersion, 1, 5 +HKR, NDIS, MinorNdisVersion, 1, 0 +HKR, Ndi\Interfaces, DefUpper, , "ndis5" +HKR, Ndi\Interfaces, UpperRange, , "ndis5" +HKR, Ndi\Interfaces, LowerRange, , "ethernet" +HKR, Ndi\Interfaces, DefLower, , "ethernet" +HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" +HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% +HKR, Ndi\Params\NetworkAddress, type, 0, "edit" +HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" +HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" +HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% +HKR, Ndi\Params\NetworkAddress, optional, 0, "0" +HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% +HKR, Ndi\Params\MaxSpeed, type, 0, "int" +HKR, Ndi\Params\MaxSpeed, default, 0, "100" +HKR, Ndi\Params\MaxSpeed, min, 0, "0" +HKR, Ndi\Params\MaxSpeed, max, 0, "2000" +HKR, Ndi\Params\MaxSpeed, step, 0, "1" +HKR, Ndi\Params\MaxSpeed, Base, 0, "10" +HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% +HKR, Ndi\Params\KeepLink, type, 0, "enum" +HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% +HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% +HKR, Ndi\Params\KeepLink, default, 0, "0" + + +[Neo.Service] +DisplayName = %Neo.Service.DispName% +Description = %Neo.Service.Desc% +ServiceType = 1 +StartType = 3 +ErrorControl = 1 +ServiceBinary = %12%\Neo_VPN120.sys +LoadOrderGroup = NDIS + +[Neo.Reg] +HKR, Ndi, Service, 0, Neo.Service.Name +HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" +HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" + +[Neo.EventLog] +HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN120.sys" +HKR, , TypesSupported, 0x00010001, 7 + +[Strings] +CompanyName = "SoftEther Corporation" +DiskDescription = "VPN Client Device Driver Install Disk" +Neo.Service.Name = "Neo_VPN120" +Neo.Service.DispName = "VPN Client Device Driver - VPN120" +Neo.Service.Desc = "VPN Client Adapter - VPN120" +NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN120" +Neo.EventLog.Name = "Neo" +NetworkAddress = "MAC Address" +DefaultAddress = "000001000001" +MaxSpeed = "Indicate Speed (Mbps)" +KeepLink = "Keep Link" +On = "On" +Off = "Off" + + +; Auto Generated 20180205_163608.882 + diff --git a/src/bin/hamcore/DriverPackages/Neo6_Win8/x86/Neo6_x86_VPN121.inf b/src/bin/hamcore/DriverPackages/Neo6_Win8/x86/Neo6_x86_VPN121.inf index a0e2d485..98f95013 100644 --- a/src/bin/hamcore/DriverPackages/Neo6_Win8/x86/Neo6_x86_VPN121.inf +++ b/src/bin/hamcore/DriverPackages/Neo6_Win8/x86/Neo6_x86_VPN121.inf @@ -1,114 +1,114 @@ -; VPN Client Device Driver for Windows 2000 and Greater -; -; Copyright (c) SoftEther Corporation. All Rights Reserved. -; http://www.softether.co.jp/ -; -; BUILD 9658 - -[Version] -Signature = "$Windows NT$" -Class = Net -ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} -Provider = %CompanyName% -DriverVer = 02/04/2018, 4.25.0.9658 -CatalogFile.NT = inf_VPN121.cat - -[Manufacturer] -%CompanyName% = SoftEther - -[SourceDisksNames] -1=%DiskDescription%, "", , - -[SourceDisksFiles] -Neo_VPN121.sys = 1 - -[DestinationDirs] -DefaultDestDir = 12 -Neo.CopyFiles.Sys = 12 - -[Neo.CopyFiles.Sys] -Neo_VPN121.sys, , , 2 - -[SoftEther] -%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN121 - -[NeoAdapter.Install] -Characteristics = 0x1 -AddReg = Neo.Reg, NeoAdapter.Ndi -CopyFiles = Neo.CopyFiles.Sys -*IfType = 53 -*MediaType = 0 -*PhysicalMediaType = 0 - -[NeoAdapter.Install.Services] -AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% - -[NeoAdapter.Ndi] -HKR, , NetworkAddress, 0, %DefaultAddress% -HKR, Ndi, DeviceID, , "NeoAdapter_VPN121" -HKR, , DevLoader, , ndis -HKR, , DeviceVxDs, , Neo_VPN121.sys -HKR, NDIS, LogDriverName, , "Neo_VPN121" -HKR, NDIS, MajorNdisVersion, 1, 5 -HKR, NDIS, MinorNdisVersion, 1, 0 -HKR, Ndi\Interfaces, DefUpper, , "ndis5" -HKR, Ndi\Interfaces, UpperRange, , "ndis5" -HKR, Ndi\Interfaces, LowerRange, , "ethernet" -HKR, Ndi\Interfaces, DefLower, , "ethernet" -HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" -HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% -HKR, Ndi\Params\NetworkAddress, type, 0, "edit" -HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" -HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" -HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% -HKR, Ndi\Params\NetworkAddress, optional, 0, "0" -HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% -HKR, Ndi\Params\MaxSpeed, type, 0, "int" -HKR, Ndi\Params\MaxSpeed, default, 0, "100" -HKR, Ndi\Params\MaxSpeed, min, 0, "0" -HKR, Ndi\Params\MaxSpeed, max, 0, "2000" -HKR, Ndi\Params\MaxSpeed, step, 0, "1" -HKR, Ndi\Params\MaxSpeed, Base, 0, "10" -HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% -HKR, Ndi\Params\KeepLink, type, 0, "enum" -HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% -HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% -HKR, Ndi\Params\KeepLink, default, 0, "0" - - -[Neo.Service] -DisplayName = %Neo.Service.DispName% -Description = %Neo.Service.Desc% -ServiceType = 1 -StartType = 3 -ErrorControl = 1 -ServiceBinary = %12%\Neo_VPN121.sys -LoadOrderGroup = NDIS - -[Neo.Reg] -HKR, Ndi, Service, 0, Neo.Service.Name -HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" -HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" - -[Neo.EventLog] -HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN121.sys" -HKR, , TypesSupported, 0x00010001, 7 - -[Strings] -CompanyName = "SoftEther Corporation" -DiskDescription = "VPN Client Device Driver Install Disk" -Neo.Service.Name = "Neo_VPN121" -Neo.Service.DispName = "VPN Client Device Driver - VPN121" -Neo.Service.Desc = "VPN Client Adapter - VPN121" -NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN121" -Neo.EventLog.Name = "Neo" -NetworkAddress = "MAC Address" -DefaultAddress = "000001000001" -MaxSpeed = "Indicate Speed (Mbps)" -KeepLink = "Keep Link" -On = "On" -Off = "Off" - - -; Auto Generated 20180205_163608.883 - +; VPN Client Device Driver for Windows 2000 and Greater +; +; Copyright (c) SoftEther Corporation. All Rights Reserved. +; http://www.softether.co.jp/ +; +; BUILD 9658 + +[Version] +Signature = "$Windows NT$" +Class = Net +ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} +Provider = %CompanyName% +DriverVer = 02/04/2018, 4.25.0.9658 +CatalogFile.NT = inf_VPN121.cat + +[Manufacturer] +%CompanyName% = SoftEther + +[SourceDisksNames] +1=%DiskDescription%, "", , + +[SourceDisksFiles] +Neo_VPN121.sys = 1 + +[DestinationDirs] +DefaultDestDir = 12 +Neo.CopyFiles.Sys = 12 + +[Neo.CopyFiles.Sys] +Neo_VPN121.sys, , , 2 + +[SoftEther] +%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN121 + +[NeoAdapter.Install] +Characteristics = 0x1 +AddReg = Neo.Reg, NeoAdapter.Ndi +CopyFiles = Neo.CopyFiles.Sys +*IfType = 53 +*MediaType = 0 +*PhysicalMediaType = 0 + +[NeoAdapter.Install.Services] +AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% + +[NeoAdapter.Ndi] +HKR, , NetworkAddress, 0, %DefaultAddress% +HKR, Ndi, DeviceID, , "NeoAdapter_VPN121" +HKR, , DevLoader, , ndis +HKR, , DeviceVxDs, , Neo_VPN121.sys +HKR, NDIS, LogDriverName, , "Neo_VPN121" +HKR, NDIS, MajorNdisVersion, 1, 5 +HKR, NDIS, MinorNdisVersion, 1, 0 +HKR, Ndi\Interfaces, DefUpper, , "ndis5" +HKR, Ndi\Interfaces, UpperRange, , "ndis5" +HKR, Ndi\Interfaces, LowerRange, , "ethernet" +HKR, Ndi\Interfaces, DefLower, , "ethernet" +HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" +HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% +HKR, Ndi\Params\NetworkAddress, type, 0, "edit" +HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" +HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" +HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% +HKR, Ndi\Params\NetworkAddress, optional, 0, "0" +HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% +HKR, Ndi\Params\MaxSpeed, type, 0, "int" +HKR, Ndi\Params\MaxSpeed, default, 0, "100" +HKR, Ndi\Params\MaxSpeed, min, 0, "0" +HKR, Ndi\Params\MaxSpeed, max, 0, "2000" +HKR, Ndi\Params\MaxSpeed, step, 0, "1" +HKR, Ndi\Params\MaxSpeed, Base, 0, "10" +HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% +HKR, Ndi\Params\KeepLink, type, 0, "enum" +HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% +HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% +HKR, Ndi\Params\KeepLink, default, 0, "0" + + +[Neo.Service] +DisplayName = %Neo.Service.DispName% +Description = %Neo.Service.Desc% +ServiceType = 1 +StartType = 3 +ErrorControl = 1 +ServiceBinary = %12%\Neo_VPN121.sys +LoadOrderGroup = NDIS + +[Neo.Reg] +HKR, Ndi, Service, 0, Neo.Service.Name +HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" +HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" + +[Neo.EventLog] +HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN121.sys" +HKR, , TypesSupported, 0x00010001, 7 + +[Strings] +CompanyName = "SoftEther Corporation" +DiskDescription = "VPN Client Device Driver Install Disk" +Neo.Service.Name = "Neo_VPN121" +Neo.Service.DispName = "VPN Client Device Driver - VPN121" +Neo.Service.Desc = "VPN Client Adapter - VPN121" +NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN121" +Neo.EventLog.Name = "Neo" +NetworkAddress = "MAC Address" +DefaultAddress = "000001000001" +MaxSpeed = "Indicate Speed (Mbps)" +KeepLink = "Keep Link" +On = "On" +Off = "Off" + + +; Auto Generated 20180205_163608.883 + diff --git a/src/bin/hamcore/DriverPackages/Neo6_Win8/x86/Neo6_x86_VPN122.inf b/src/bin/hamcore/DriverPackages/Neo6_Win8/x86/Neo6_x86_VPN122.inf index 5dddf660..7b464f3a 100644 --- a/src/bin/hamcore/DriverPackages/Neo6_Win8/x86/Neo6_x86_VPN122.inf +++ b/src/bin/hamcore/DriverPackages/Neo6_Win8/x86/Neo6_x86_VPN122.inf @@ -1,114 +1,114 @@ -; VPN Client Device Driver for Windows 2000 and Greater -; -; Copyright (c) SoftEther Corporation. All Rights Reserved. -; http://www.softether.co.jp/ -; -; BUILD 9658 - -[Version] -Signature = "$Windows NT$" -Class = Net -ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} -Provider = %CompanyName% -DriverVer = 02/04/2018, 4.25.0.9658 -CatalogFile.NT = inf_VPN122.cat - -[Manufacturer] -%CompanyName% = SoftEther - -[SourceDisksNames] -1=%DiskDescription%, "", , - -[SourceDisksFiles] -Neo_VPN122.sys = 1 - -[DestinationDirs] -DefaultDestDir = 12 -Neo.CopyFiles.Sys = 12 - -[Neo.CopyFiles.Sys] -Neo_VPN122.sys, , , 2 - -[SoftEther] -%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN122 - -[NeoAdapter.Install] -Characteristics = 0x1 -AddReg = Neo.Reg, NeoAdapter.Ndi -CopyFiles = Neo.CopyFiles.Sys -*IfType = 53 -*MediaType = 0 -*PhysicalMediaType = 0 - -[NeoAdapter.Install.Services] -AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% - -[NeoAdapter.Ndi] -HKR, , NetworkAddress, 0, %DefaultAddress% -HKR, Ndi, DeviceID, , "NeoAdapter_VPN122" -HKR, , DevLoader, , ndis -HKR, , DeviceVxDs, , Neo_VPN122.sys -HKR, NDIS, LogDriverName, , "Neo_VPN122" -HKR, NDIS, MajorNdisVersion, 1, 5 -HKR, NDIS, MinorNdisVersion, 1, 0 -HKR, Ndi\Interfaces, DefUpper, , "ndis5" -HKR, Ndi\Interfaces, UpperRange, , "ndis5" -HKR, Ndi\Interfaces, LowerRange, , "ethernet" -HKR, Ndi\Interfaces, DefLower, , "ethernet" -HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" -HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% -HKR, Ndi\Params\NetworkAddress, type, 0, "edit" -HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" -HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" -HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% -HKR, Ndi\Params\NetworkAddress, optional, 0, "0" -HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% -HKR, Ndi\Params\MaxSpeed, type, 0, "int" -HKR, Ndi\Params\MaxSpeed, default, 0, "100" -HKR, Ndi\Params\MaxSpeed, min, 0, "0" -HKR, Ndi\Params\MaxSpeed, max, 0, "2000" -HKR, Ndi\Params\MaxSpeed, step, 0, "1" -HKR, Ndi\Params\MaxSpeed, Base, 0, "10" -HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% -HKR, Ndi\Params\KeepLink, type, 0, "enum" -HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% -HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% -HKR, Ndi\Params\KeepLink, default, 0, "0" - - -[Neo.Service] -DisplayName = %Neo.Service.DispName% -Description = %Neo.Service.Desc% -ServiceType = 1 -StartType = 3 -ErrorControl = 1 -ServiceBinary = %12%\Neo_VPN122.sys -LoadOrderGroup = NDIS - -[Neo.Reg] -HKR, Ndi, Service, 0, Neo.Service.Name -HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" -HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" - -[Neo.EventLog] -HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN122.sys" -HKR, , TypesSupported, 0x00010001, 7 - -[Strings] -CompanyName = "SoftEther Corporation" -DiskDescription = "VPN Client Device Driver Install Disk" -Neo.Service.Name = "Neo_VPN122" -Neo.Service.DispName = "VPN Client Device Driver - VPN122" -Neo.Service.Desc = "VPN Client Adapter - VPN122" -NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN122" -Neo.EventLog.Name = "Neo" -NetworkAddress = "MAC Address" -DefaultAddress = "000001000001" -MaxSpeed = "Indicate Speed (Mbps)" -KeepLink = "Keep Link" -On = "On" -Off = "Off" - - -; Auto Generated 20180205_163608.884 - +; VPN Client Device Driver for Windows 2000 and Greater +; +; Copyright (c) SoftEther Corporation. All Rights Reserved. +; http://www.softether.co.jp/ +; +; BUILD 9658 + +[Version] +Signature = "$Windows NT$" +Class = Net +ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} +Provider = %CompanyName% +DriverVer = 02/04/2018, 4.25.0.9658 +CatalogFile.NT = inf_VPN122.cat + +[Manufacturer] +%CompanyName% = SoftEther + +[SourceDisksNames] +1=%DiskDescription%, "", , + +[SourceDisksFiles] +Neo_VPN122.sys = 1 + +[DestinationDirs] +DefaultDestDir = 12 +Neo.CopyFiles.Sys = 12 + +[Neo.CopyFiles.Sys] +Neo_VPN122.sys, , , 2 + +[SoftEther] +%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN122 + +[NeoAdapter.Install] +Characteristics = 0x1 +AddReg = Neo.Reg, NeoAdapter.Ndi +CopyFiles = Neo.CopyFiles.Sys +*IfType = 53 +*MediaType = 0 +*PhysicalMediaType = 0 + +[NeoAdapter.Install.Services] +AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% + +[NeoAdapter.Ndi] +HKR, , NetworkAddress, 0, %DefaultAddress% +HKR, Ndi, DeviceID, , "NeoAdapter_VPN122" +HKR, , DevLoader, , ndis +HKR, , DeviceVxDs, , Neo_VPN122.sys +HKR, NDIS, LogDriverName, , "Neo_VPN122" +HKR, NDIS, MajorNdisVersion, 1, 5 +HKR, NDIS, MinorNdisVersion, 1, 0 +HKR, Ndi\Interfaces, DefUpper, , "ndis5" +HKR, Ndi\Interfaces, UpperRange, , "ndis5" +HKR, Ndi\Interfaces, LowerRange, , "ethernet" +HKR, Ndi\Interfaces, DefLower, , "ethernet" +HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" +HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% +HKR, Ndi\Params\NetworkAddress, type, 0, "edit" +HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" +HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" +HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% +HKR, Ndi\Params\NetworkAddress, optional, 0, "0" +HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% +HKR, Ndi\Params\MaxSpeed, type, 0, "int" +HKR, Ndi\Params\MaxSpeed, default, 0, "100" +HKR, Ndi\Params\MaxSpeed, min, 0, "0" +HKR, Ndi\Params\MaxSpeed, max, 0, "2000" +HKR, Ndi\Params\MaxSpeed, step, 0, "1" +HKR, Ndi\Params\MaxSpeed, Base, 0, "10" +HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% +HKR, Ndi\Params\KeepLink, type, 0, "enum" +HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% +HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% +HKR, Ndi\Params\KeepLink, default, 0, "0" + + +[Neo.Service] +DisplayName = %Neo.Service.DispName% +Description = %Neo.Service.Desc% +ServiceType = 1 +StartType = 3 +ErrorControl = 1 +ServiceBinary = %12%\Neo_VPN122.sys +LoadOrderGroup = NDIS + +[Neo.Reg] +HKR, Ndi, Service, 0, Neo.Service.Name +HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" +HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" + +[Neo.EventLog] +HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN122.sys" +HKR, , TypesSupported, 0x00010001, 7 + +[Strings] +CompanyName = "SoftEther Corporation" +DiskDescription = "VPN Client Device Driver Install Disk" +Neo.Service.Name = "Neo_VPN122" +Neo.Service.DispName = "VPN Client Device Driver - VPN122" +Neo.Service.Desc = "VPN Client Adapter - VPN122" +NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN122" +Neo.EventLog.Name = "Neo" +NetworkAddress = "MAC Address" +DefaultAddress = "000001000001" +MaxSpeed = "Indicate Speed (Mbps)" +KeepLink = "Keep Link" +On = "On" +Off = "Off" + + +; Auto Generated 20180205_163608.884 + diff --git a/src/bin/hamcore/DriverPackages/Neo6_Win8/x86/Neo6_x86_VPN123.inf b/src/bin/hamcore/DriverPackages/Neo6_Win8/x86/Neo6_x86_VPN123.inf index 12421a54..574aa4f9 100644 --- a/src/bin/hamcore/DriverPackages/Neo6_Win8/x86/Neo6_x86_VPN123.inf +++ b/src/bin/hamcore/DriverPackages/Neo6_Win8/x86/Neo6_x86_VPN123.inf @@ -1,114 +1,114 @@ -; VPN Client Device Driver for Windows 2000 and Greater -; -; Copyright (c) SoftEther Corporation. All Rights Reserved. -; http://www.softether.co.jp/ -; -; BUILD 9658 - -[Version] -Signature = "$Windows NT$" -Class = Net -ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} -Provider = %CompanyName% -DriverVer = 02/04/2018, 4.25.0.9658 -CatalogFile.NT = inf_VPN123.cat - -[Manufacturer] -%CompanyName% = SoftEther - -[SourceDisksNames] -1=%DiskDescription%, "", , - -[SourceDisksFiles] -Neo_VPN123.sys = 1 - -[DestinationDirs] -DefaultDestDir = 12 -Neo.CopyFiles.Sys = 12 - -[Neo.CopyFiles.Sys] -Neo_VPN123.sys, , , 2 - -[SoftEther] -%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN123 - -[NeoAdapter.Install] -Characteristics = 0x1 -AddReg = Neo.Reg, NeoAdapter.Ndi -CopyFiles = Neo.CopyFiles.Sys -*IfType = 53 -*MediaType = 0 -*PhysicalMediaType = 0 - -[NeoAdapter.Install.Services] -AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% - -[NeoAdapter.Ndi] -HKR, , NetworkAddress, 0, %DefaultAddress% -HKR, Ndi, DeviceID, , "NeoAdapter_VPN123" -HKR, , DevLoader, , ndis -HKR, , DeviceVxDs, , Neo_VPN123.sys -HKR, NDIS, LogDriverName, , "Neo_VPN123" -HKR, NDIS, MajorNdisVersion, 1, 5 -HKR, NDIS, MinorNdisVersion, 1, 0 -HKR, Ndi\Interfaces, DefUpper, , "ndis5" -HKR, Ndi\Interfaces, UpperRange, , "ndis5" -HKR, Ndi\Interfaces, LowerRange, , "ethernet" -HKR, Ndi\Interfaces, DefLower, , "ethernet" -HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" -HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% -HKR, Ndi\Params\NetworkAddress, type, 0, "edit" -HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" -HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" -HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% -HKR, Ndi\Params\NetworkAddress, optional, 0, "0" -HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% -HKR, Ndi\Params\MaxSpeed, type, 0, "int" -HKR, Ndi\Params\MaxSpeed, default, 0, "100" -HKR, Ndi\Params\MaxSpeed, min, 0, "0" -HKR, Ndi\Params\MaxSpeed, max, 0, "2000" -HKR, Ndi\Params\MaxSpeed, step, 0, "1" -HKR, Ndi\Params\MaxSpeed, Base, 0, "10" -HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% -HKR, Ndi\Params\KeepLink, type, 0, "enum" -HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% -HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% -HKR, Ndi\Params\KeepLink, default, 0, "0" - - -[Neo.Service] -DisplayName = %Neo.Service.DispName% -Description = %Neo.Service.Desc% -ServiceType = 1 -StartType = 3 -ErrorControl = 1 -ServiceBinary = %12%\Neo_VPN123.sys -LoadOrderGroup = NDIS - -[Neo.Reg] -HKR, Ndi, Service, 0, Neo.Service.Name -HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" -HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" - -[Neo.EventLog] -HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN123.sys" -HKR, , TypesSupported, 0x00010001, 7 - -[Strings] -CompanyName = "SoftEther Corporation" -DiskDescription = "VPN Client Device Driver Install Disk" -Neo.Service.Name = "Neo_VPN123" -Neo.Service.DispName = "VPN Client Device Driver - VPN123" -Neo.Service.Desc = "VPN Client Adapter - VPN123" -NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN123" -Neo.EventLog.Name = "Neo" -NetworkAddress = "MAC Address" -DefaultAddress = "000001000001" -MaxSpeed = "Indicate Speed (Mbps)" -KeepLink = "Keep Link" -On = "On" -Off = "Off" - - -; Auto Generated 20180205_163608.885 - +; VPN Client Device Driver for Windows 2000 and Greater +; +; Copyright (c) SoftEther Corporation. All Rights Reserved. +; http://www.softether.co.jp/ +; +; BUILD 9658 + +[Version] +Signature = "$Windows NT$" +Class = Net +ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} +Provider = %CompanyName% +DriverVer = 02/04/2018, 4.25.0.9658 +CatalogFile.NT = inf_VPN123.cat + +[Manufacturer] +%CompanyName% = SoftEther + +[SourceDisksNames] +1=%DiskDescription%, "", , + +[SourceDisksFiles] +Neo_VPN123.sys = 1 + +[DestinationDirs] +DefaultDestDir = 12 +Neo.CopyFiles.Sys = 12 + +[Neo.CopyFiles.Sys] +Neo_VPN123.sys, , , 2 + +[SoftEther] +%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN123 + +[NeoAdapter.Install] +Characteristics = 0x1 +AddReg = Neo.Reg, NeoAdapter.Ndi +CopyFiles = Neo.CopyFiles.Sys +*IfType = 53 +*MediaType = 0 +*PhysicalMediaType = 0 + +[NeoAdapter.Install.Services] +AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% + +[NeoAdapter.Ndi] +HKR, , NetworkAddress, 0, %DefaultAddress% +HKR, Ndi, DeviceID, , "NeoAdapter_VPN123" +HKR, , DevLoader, , ndis +HKR, , DeviceVxDs, , Neo_VPN123.sys +HKR, NDIS, LogDriverName, , "Neo_VPN123" +HKR, NDIS, MajorNdisVersion, 1, 5 +HKR, NDIS, MinorNdisVersion, 1, 0 +HKR, Ndi\Interfaces, DefUpper, , "ndis5" +HKR, Ndi\Interfaces, UpperRange, , "ndis5" +HKR, Ndi\Interfaces, LowerRange, , "ethernet" +HKR, Ndi\Interfaces, DefLower, , "ethernet" +HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" +HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% +HKR, Ndi\Params\NetworkAddress, type, 0, "edit" +HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" +HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" +HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% +HKR, Ndi\Params\NetworkAddress, optional, 0, "0" +HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% +HKR, Ndi\Params\MaxSpeed, type, 0, "int" +HKR, Ndi\Params\MaxSpeed, default, 0, "100" +HKR, Ndi\Params\MaxSpeed, min, 0, "0" +HKR, Ndi\Params\MaxSpeed, max, 0, "2000" +HKR, Ndi\Params\MaxSpeed, step, 0, "1" +HKR, Ndi\Params\MaxSpeed, Base, 0, "10" +HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% +HKR, Ndi\Params\KeepLink, type, 0, "enum" +HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% +HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% +HKR, Ndi\Params\KeepLink, default, 0, "0" + + +[Neo.Service] +DisplayName = %Neo.Service.DispName% +Description = %Neo.Service.Desc% +ServiceType = 1 +StartType = 3 +ErrorControl = 1 +ServiceBinary = %12%\Neo_VPN123.sys +LoadOrderGroup = NDIS + +[Neo.Reg] +HKR, Ndi, Service, 0, Neo.Service.Name +HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" +HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" + +[Neo.EventLog] +HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN123.sys" +HKR, , TypesSupported, 0x00010001, 7 + +[Strings] +CompanyName = "SoftEther Corporation" +DiskDescription = "VPN Client Device Driver Install Disk" +Neo.Service.Name = "Neo_VPN123" +Neo.Service.DispName = "VPN Client Device Driver - VPN123" +Neo.Service.Desc = "VPN Client Adapter - VPN123" +NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN123" +Neo.EventLog.Name = "Neo" +NetworkAddress = "MAC Address" +DefaultAddress = "000001000001" +MaxSpeed = "Indicate Speed (Mbps)" +KeepLink = "Keep Link" +On = "On" +Off = "Off" + + +; Auto Generated 20180205_163608.885 + diff --git a/src/bin/hamcore/DriverPackages/Neo6_Win8/x86/Neo6_x86_VPN124.inf b/src/bin/hamcore/DriverPackages/Neo6_Win8/x86/Neo6_x86_VPN124.inf index e2f8bbea..51b16253 100644 --- a/src/bin/hamcore/DriverPackages/Neo6_Win8/x86/Neo6_x86_VPN124.inf +++ b/src/bin/hamcore/DriverPackages/Neo6_Win8/x86/Neo6_x86_VPN124.inf @@ -1,114 +1,114 @@ -; VPN Client Device Driver for Windows 2000 and Greater -; -; Copyright (c) SoftEther Corporation. All Rights Reserved. -; http://www.softether.co.jp/ -; -; BUILD 9658 - -[Version] -Signature = "$Windows NT$" -Class = Net -ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} -Provider = %CompanyName% -DriverVer = 02/04/2018, 4.25.0.9658 -CatalogFile.NT = inf_VPN124.cat - -[Manufacturer] -%CompanyName% = SoftEther - -[SourceDisksNames] -1=%DiskDescription%, "", , - -[SourceDisksFiles] -Neo_VPN124.sys = 1 - -[DestinationDirs] -DefaultDestDir = 12 -Neo.CopyFiles.Sys = 12 - -[Neo.CopyFiles.Sys] -Neo_VPN124.sys, , , 2 - -[SoftEther] -%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN124 - -[NeoAdapter.Install] -Characteristics = 0x1 -AddReg = Neo.Reg, NeoAdapter.Ndi -CopyFiles = Neo.CopyFiles.Sys -*IfType = 53 -*MediaType = 0 -*PhysicalMediaType = 0 - -[NeoAdapter.Install.Services] -AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% - -[NeoAdapter.Ndi] -HKR, , NetworkAddress, 0, %DefaultAddress% -HKR, Ndi, DeviceID, , "NeoAdapter_VPN124" -HKR, , DevLoader, , ndis -HKR, , DeviceVxDs, , Neo_VPN124.sys -HKR, NDIS, LogDriverName, , "Neo_VPN124" -HKR, NDIS, MajorNdisVersion, 1, 5 -HKR, NDIS, MinorNdisVersion, 1, 0 -HKR, Ndi\Interfaces, DefUpper, , "ndis5" -HKR, Ndi\Interfaces, UpperRange, , "ndis5" -HKR, Ndi\Interfaces, LowerRange, , "ethernet" -HKR, Ndi\Interfaces, DefLower, , "ethernet" -HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" -HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% -HKR, Ndi\Params\NetworkAddress, type, 0, "edit" -HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" -HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" -HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% -HKR, Ndi\Params\NetworkAddress, optional, 0, "0" -HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% -HKR, Ndi\Params\MaxSpeed, type, 0, "int" -HKR, Ndi\Params\MaxSpeed, default, 0, "100" -HKR, Ndi\Params\MaxSpeed, min, 0, "0" -HKR, Ndi\Params\MaxSpeed, max, 0, "2000" -HKR, Ndi\Params\MaxSpeed, step, 0, "1" -HKR, Ndi\Params\MaxSpeed, Base, 0, "10" -HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% -HKR, Ndi\Params\KeepLink, type, 0, "enum" -HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% -HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% -HKR, Ndi\Params\KeepLink, default, 0, "0" - - -[Neo.Service] -DisplayName = %Neo.Service.DispName% -Description = %Neo.Service.Desc% -ServiceType = 1 -StartType = 3 -ErrorControl = 1 -ServiceBinary = %12%\Neo_VPN124.sys -LoadOrderGroup = NDIS - -[Neo.Reg] -HKR, Ndi, Service, 0, Neo.Service.Name -HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" -HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" - -[Neo.EventLog] -HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN124.sys" -HKR, , TypesSupported, 0x00010001, 7 - -[Strings] -CompanyName = "SoftEther Corporation" -DiskDescription = "VPN Client Device Driver Install Disk" -Neo.Service.Name = "Neo_VPN124" -Neo.Service.DispName = "VPN Client Device Driver - VPN124" -Neo.Service.Desc = "VPN Client Adapter - VPN124" -NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN124" -Neo.EventLog.Name = "Neo" -NetworkAddress = "MAC Address" -DefaultAddress = "000001000001" -MaxSpeed = "Indicate Speed (Mbps)" -KeepLink = "Keep Link" -On = "On" -Off = "Off" - - -; Auto Generated 20180205_163608.885 - +; VPN Client Device Driver for Windows 2000 and Greater +; +; Copyright (c) SoftEther Corporation. All Rights Reserved. +; http://www.softether.co.jp/ +; +; BUILD 9658 + +[Version] +Signature = "$Windows NT$" +Class = Net +ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} +Provider = %CompanyName% +DriverVer = 02/04/2018, 4.25.0.9658 +CatalogFile.NT = inf_VPN124.cat + +[Manufacturer] +%CompanyName% = SoftEther + +[SourceDisksNames] +1=%DiskDescription%, "", , + +[SourceDisksFiles] +Neo_VPN124.sys = 1 + +[DestinationDirs] +DefaultDestDir = 12 +Neo.CopyFiles.Sys = 12 + +[Neo.CopyFiles.Sys] +Neo_VPN124.sys, , , 2 + +[SoftEther] +%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN124 + +[NeoAdapter.Install] +Characteristics = 0x1 +AddReg = Neo.Reg, NeoAdapter.Ndi +CopyFiles = Neo.CopyFiles.Sys +*IfType = 53 +*MediaType = 0 +*PhysicalMediaType = 0 + +[NeoAdapter.Install.Services] +AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% + +[NeoAdapter.Ndi] +HKR, , NetworkAddress, 0, %DefaultAddress% +HKR, Ndi, DeviceID, , "NeoAdapter_VPN124" +HKR, , DevLoader, , ndis +HKR, , DeviceVxDs, , Neo_VPN124.sys +HKR, NDIS, LogDriverName, , "Neo_VPN124" +HKR, NDIS, MajorNdisVersion, 1, 5 +HKR, NDIS, MinorNdisVersion, 1, 0 +HKR, Ndi\Interfaces, DefUpper, , "ndis5" +HKR, Ndi\Interfaces, UpperRange, , "ndis5" +HKR, Ndi\Interfaces, LowerRange, , "ethernet" +HKR, Ndi\Interfaces, DefLower, , "ethernet" +HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" +HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% +HKR, Ndi\Params\NetworkAddress, type, 0, "edit" +HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" +HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" +HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% +HKR, Ndi\Params\NetworkAddress, optional, 0, "0" +HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% +HKR, Ndi\Params\MaxSpeed, type, 0, "int" +HKR, Ndi\Params\MaxSpeed, default, 0, "100" +HKR, Ndi\Params\MaxSpeed, min, 0, "0" +HKR, Ndi\Params\MaxSpeed, max, 0, "2000" +HKR, Ndi\Params\MaxSpeed, step, 0, "1" +HKR, Ndi\Params\MaxSpeed, Base, 0, "10" +HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% +HKR, Ndi\Params\KeepLink, type, 0, "enum" +HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% +HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% +HKR, Ndi\Params\KeepLink, default, 0, "0" + + +[Neo.Service] +DisplayName = %Neo.Service.DispName% +Description = %Neo.Service.Desc% +ServiceType = 1 +StartType = 3 +ErrorControl = 1 +ServiceBinary = %12%\Neo_VPN124.sys +LoadOrderGroup = NDIS + +[Neo.Reg] +HKR, Ndi, Service, 0, Neo.Service.Name +HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" +HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" + +[Neo.EventLog] +HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN124.sys" +HKR, , TypesSupported, 0x00010001, 7 + +[Strings] +CompanyName = "SoftEther Corporation" +DiskDescription = "VPN Client Device Driver Install Disk" +Neo.Service.Name = "Neo_VPN124" +Neo.Service.DispName = "VPN Client Device Driver - VPN124" +Neo.Service.Desc = "VPN Client Adapter - VPN124" +NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN124" +Neo.EventLog.Name = "Neo" +NetworkAddress = "MAC Address" +DefaultAddress = "000001000001" +MaxSpeed = "Indicate Speed (Mbps)" +KeepLink = "Keep Link" +On = "On" +Off = "Off" + + +; Auto Generated 20180205_163608.885 + diff --git a/src/bin/hamcore/DriverPackages/Neo6_Win8/x86/Neo6_x86_VPN125.inf b/src/bin/hamcore/DriverPackages/Neo6_Win8/x86/Neo6_x86_VPN125.inf index f771a16c..b4bd0956 100644 --- a/src/bin/hamcore/DriverPackages/Neo6_Win8/x86/Neo6_x86_VPN125.inf +++ b/src/bin/hamcore/DriverPackages/Neo6_Win8/x86/Neo6_x86_VPN125.inf @@ -1,114 +1,114 @@ -; VPN Client Device Driver for Windows 2000 and Greater -; -; Copyright (c) SoftEther Corporation. All Rights Reserved. -; http://www.softether.co.jp/ -; -; BUILD 9658 - -[Version] -Signature = "$Windows NT$" -Class = Net -ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} -Provider = %CompanyName% -DriverVer = 02/04/2018, 4.25.0.9658 -CatalogFile.NT = inf_VPN125.cat - -[Manufacturer] -%CompanyName% = SoftEther - -[SourceDisksNames] -1=%DiskDescription%, "", , - -[SourceDisksFiles] -Neo_VPN125.sys = 1 - -[DestinationDirs] -DefaultDestDir = 12 -Neo.CopyFiles.Sys = 12 - -[Neo.CopyFiles.Sys] -Neo_VPN125.sys, , , 2 - -[SoftEther] -%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN125 - -[NeoAdapter.Install] -Characteristics = 0x1 -AddReg = Neo.Reg, NeoAdapter.Ndi -CopyFiles = Neo.CopyFiles.Sys -*IfType = 53 -*MediaType = 0 -*PhysicalMediaType = 0 - -[NeoAdapter.Install.Services] -AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% - -[NeoAdapter.Ndi] -HKR, , NetworkAddress, 0, %DefaultAddress% -HKR, Ndi, DeviceID, , "NeoAdapter_VPN125" -HKR, , DevLoader, , ndis -HKR, , DeviceVxDs, , Neo_VPN125.sys -HKR, NDIS, LogDriverName, , "Neo_VPN125" -HKR, NDIS, MajorNdisVersion, 1, 5 -HKR, NDIS, MinorNdisVersion, 1, 0 -HKR, Ndi\Interfaces, DefUpper, , "ndis5" -HKR, Ndi\Interfaces, UpperRange, , "ndis5" -HKR, Ndi\Interfaces, LowerRange, , "ethernet" -HKR, Ndi\Interfaces, DefLower, , "ethernet" -HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" -HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% -HKR, Ndi\Params\NetworkAddress, type, 0, "edit" -HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" -HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" -HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% -HKR, Ndi\Params\NetworkAddress, optional, 0, "0" -HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% -HKR, Ndi\Params\MaxSpeed, type, 0, "int" -HKR, Ndi\Params\MaxSpeed, default, 0, "100" -HKR, Ndi\Params\MaxSpeed, min, 0, "0" -HKR, Ndi\Params\MaxSpeed, max, 0, "2000" -HKR, Ndi\Params\MaxSpeed, step, 0, "1" -HKR, Ndi\Params\MaxSpeed, Base, 0, "10" -HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% -HKR, Ndi\Params\KeepLink, type, 0, "enum" -HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% -HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% -HKR, Ndi\Params\KeepLink, default, 0, "0" - - -[Neo.Service] -DisplayName = %Neo.Service.DispName% -Description = %Neo.Service.Desc% -ServiceType = 1 -StartType = 3 -ErrorControl = 1 -ServiceBinary = %12%\Neo_VPN125.sys -LoadOrderGroup = NDIS - -[Neo.Reg] -HKR, Ndi, Service, 0, Neo.Service.Name -HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" -HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" - -[Neo.EventLog] -HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN125.sys" -HKR, , TypesSupported, 0x00010001, 7 - -[Strings] -CompanyName = "SoftEther Corporation" -DiskDescription = "VPN Client Device Driver Install Disk" -Neo.Service.Name = "Neo_VPN125" -Neo.Service.DispName = "VPN Client Device Driver - VPN125" -Neo.Service.Desc = "VPN Client Adapter - VPN125" -NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN125" -Neo.EventLog.Name = "Neo" -NetworkAddress = "MAC Address" -DefaultAddress = "000001000001" -MaxSpeed = "Indicate Speed (Mbps)" -KeepLink = "Keep Link" -On = "On" -Off = "Off" - - -; Auto Generated 20180205_163608.886 - +; VPN Client Device Driver for Windows 2000 and Greater +; +; Copyright (c) SoftEther Corporation. All Rights Reserved. +; http://www.softether.co.jp/ +; +; BUILD 9658 + +[Version] +Signature = "$Windows NT$" +Class = Net +ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} +Provider = %CompanyName% +DriverVer = 02/04/2018, 4.25.0.9658 +CatalogFile.NT = inf_VPN125.cat + +[Manufacturer] +%CompanyName% = SoftEther + +[SourceDisksNames] +1=%DiskDescription%, "", , + +[SourceDisksFiles] +Neo_VPN125.sys = 1 + +[DestinationDirs] +DefaultDestDir = 12 +Neo.CopyFiles.Sys = 12 + +[Neo.CopyFiles.Sys] +Neo_VPN125.sys, , , 2 + +[SoftEther] +%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN125 + +[NeoAdapter.Install] +Characteristics = 0x1 +AddReg = Neo.Reg, NeoAdapter.Ndi +CopyFiles = Neo.CopyFiles.Sys +*IfType = 53 +*MediaType = 0 +*PhysicalMediaType = 0 + +[NeoAdapter.Install.Services] +AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% + +[NeoAdapter.Ndi] +HKR, , NetworkAddress, 0, %DefaultAddress% +HKR, Ndi, DeviceID, , "NeoAdapter_VPN125" +HKR, , DevLoader, , ndis +HKR, , DeviceVxDs, , Neo_VPN125.sys +HKR, NDIS, LogDriverName, , "Neo_VPN125" +HKR, NDIS, MajorNdisVersion, 1, 5 +HKR, NDIS, MinorNdisVersion, 1, 0 +HKR, Ndi\Interfaces, DefUpper, , "ndis5" +HKR, Ndi\Interfaces, UpperRange, , "ndis5" +HKR, Ndi\Interfaces, LowerRange, , "ethernet" +HKR, Ndi\Interfaces, DefLower, , "ethernet" +HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" +HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% +HKR, Ndi\Params\NetworkAddress, type, 0, "edit" +HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" +HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" +HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% +HKR, Ndi\Params\NetworkAddress, optional, 0, "0" +HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% +HKR, Ndi\Params\MaxSpeed, type, 0, "int" +HKR, Ndi\Params\MaxSpeed, default, 0, "100" +HKR, Ndi\Params\MaxSpeed, min, 0, "0" +HKR, Ndi\Params\MaxSpeed, max, 0, "2000" +HKR, Ndi\Params\MaxSpeed, step, 0, "1" +HKR, Ndi\Params\MaxSpeed, Base, 0, "10" +HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% +HKR, Ndi\Params\KeepLink, type, 0, "enum" +HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% +HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% +HKR, Ndi\Params\KeepLink, default, 0, "0" + + +[Neo.Service] +DisplayName = %Neo.Service.DispName% +Description = %Neo.Service.Desc% +ServiceType = 1 +StartType = 3 +ErrorControl = 1 +ServiceBinary = %12%\Neo_VPN125.sys +LoadOrderGroup = NDIS + +[Neo.Reg] +HKR, Ndi, Service, 0, Neo.Service.Name +HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" +HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" + +[Neo.EventLog] +HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN125.sys" +HKR, , TypesSupported, 0x00010001, 7 + +[Strings] +CompanyName = "SoftEther Corporation" +DiskDescription = "VPN Client Device Driver Install Disk" +Neo.Service.Name = "Neo_VPN125" +Neo.Service.DispName = "VPN Client Device Driver - VPN125" +Neo.Service.Desc = "VPN Client Adapter - VPN125" +NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN125" +Neo.EventLog.Name = "Neo" +NetworkAddress = "MAC Address" +DefaultAddress = "000001000001" +MaxSpeed = "Indicate Speed (Mbps)" +KeepLink = "Keep Link" +On = "On" +Off = "Off" + + +; Auto Generated 20180205_163608.886 + diff --git a/src/bin/hamcore/DriverPackages/Neo6_Win8/x86/Neo6_x86_VPN126.inf b/src/bin/hamcore/DriverPackages/Neo6_Win8/x86/Neo6_x86_VPN126.inf index 2b59e480..61625cf2 100644 --- a/src/bin/hamcore/DriverPackages/Neo6_Win8/x86/Neo6_x86_VPN126.inf +++ b/src/bin/hamcore/DriverPackages/Neo6_Win8/x86/Neo6_x86_VPN126.inf @@ -1,114 +1,114 @@ -; VPN Client Device Driver for Windows 2000 and Greater -; -; Copyright (c) SoftEther Corporation. All Rights Reserved. -; http://www.softether.co.jp/ -; -; BUILD 9658 - -[Version] -Signature = "$Windows NT$" -Class = Net -ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} -Provider = %CompanyName% -DriverVer = 02/04/2018, 4.25.0.9658 -CatalogFile.NT = inf_VPN126.cat - -[Manufacturer] -%CompanyName% = SoftEther - -[SourceDisksNames] -1=%DiskDescription%, "", , - -[SourceDisksFiles] -Neo_VPN126.sys = 1 - -[DestinationDirs] -DefaultDestDir = 12 -Neo.CopyFiles.Sys = 12 - -[Neo.CopyFiles.Sys] -Neo_VPN126.sys, , , 2 - -[SoftEther] -%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN126 - -[NeoAdapter.Install] -Characteristics = 0x1 -AddReg = Neo.Reg, NeoAdapter.Ndi -CopyFiles = Neo.CopyFiles.Sys -*IfType = 53 -*MediaType = 0 -*PhysicalMediaType = 0 - -[NeoAdapter.Install.Services] -AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% - -[NeoAdapter.Ndi] -HKR, , NetworkAddress, 0, %DefaultAddress% -HKR, Ndi, DeviceID, , "NeoAdapter_VPN126" -HKR, , DevLoader, , ndis -HKR, , DeviceVxDs, , Neo_VPN126.sys -HKR, NDIS, LogDriverName, , "Neo_VPN126" -HKR, NDIS, MajorNdisVersion, 1, 5 -HKR, NDIS, MinorNdisVersion, 1, 0 -HKR, Ndi\Interfaces, DefUpper, , "ndis5" -HKR, Ndi\Interfaces, UpperRange, , "ndis5" -HKR, Ndi\Interfaces, LowerRange, , "ethernet" -HKR, Ndi\Interfaces, DefLower, , "ethernet" -HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" -HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% -HKR, Ndi\Params\NetworkAddress, type, 0, "edit" -HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" -HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" -HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% -HKR, Ndi\Params\NetworkAddress, optional, 0, "0" -HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% -HKR, Ndi\Params\MaxSpeed, type, 0, "int" -HKR, Ndi\Params\MaxSpeed, default, 0, "100" -HKR, Ndi\Params\MaxSpeed, min, 0, "0" -HKR, Ndi\Params\MaxSpeed, max, 0, "2000" -HKR, Ndi\Params\MaxSpeed, step, 0, "1" -HKR, Ndi\Params\MaxSpeed, Base, 0, "10" -HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% -HKR, Ndi\Params\KeepLink, type, 0, "enum" -HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% -HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% -HKR, Ndi\Params\KeepLink, default, 0, "0" - - -[Neo.Service] -DisplayName = %Neo.Service.DispName% -Description = %Neo.Service.Desc% -ServiceType = 1 -StartType = 3 -ErrorControl = 1 -ServiceBinary = %12%\Neo_VPN126.sys -LoadOrderGroup = NDIS - -[Neo.Reg] -HKR, Ndi, Service, 0, Neo.Service.Name -HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" -HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" - -[Neo.EventLog] -HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN126.sys" -HKR, , TypesSupported, 0x00010001, 7 - -[Strings] -CompanyName = "SoftEther Corporation" -DiskDescription = "VPN Client Device Driver Install Disk" -Neo.Service.Name = "Neo_VPN126" -Neo.Service.DispName = "VPN Client Device Driver - VPN126" -Neo.Service.Desc = "VPN Client Adapter - VPN126" -NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN126" -Neo.EventLog.Name = "Neo" -NetworkAddress = "MAC Address" -DefaultAddress = "000001000001" -MaxSpeed = "Indicate Speed (Mbps)" -KeepLink = "Keep Link" -On = "On" -Off = "Off" - - -; Auto Generated 20180205_163608.887 - +; VPN Client Device Driver for Windows 2000 and Greater +; +; Copyright (c) SoftEther Corporation. All Rights Reserved. +; http://www.softether.co.jp/ +; +; BUILD 9658 + +[Version] +Signature = "$Windows NT$" +Class = Net +ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} +Provider = %CompanyName% +DriverVer = 02/04/2018, 4.25.0.9658 +CatalogFile.NT = inf_VPN126.cat + +[Manufacturer] +%CompanyName% = SoftEther + +[SourceDisksNames] +1=%DiskDescription%, "", , + +[SourceDisksFiles] +Neo_VPN126.sys = 1 + +[DestinationDirs] +DefaultDestDir = 12 +Neo.CopyFiles.Sys = 12 + +[Neo.CopyFiles.Sys] +Neo_VPN126.sys, , , 2 + +[SoftEther] +%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN126 + +[NeoAdapter.Install] +Characteristics = 0x1 +AddReg = Neo.Reg, NeoAdapter.Ndi +CopyFiles = Neo.CopyFiles.Sys +*IfType = 53 +*MediaType = 0 +*PhysicalMediaType = 0 + +[NeoAdapter.Install.Services] +AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% + +[NeoAdapter.Ndi] +HKR, , NetworkAddress, 0, %DefaultAddress% +HKR, Ndi, DeviceID, , "NeoAdapter_VPN126" +HKR, , DevLoader, , ndis +HKR, , DeviceVxDs, , Neo_VPN126.sys +HKR, NDIS, LogDriverName, , "Neo_VPN126" +HKR, NDIS, MajorNdisVersion, 1, 5 +HKR, NDIS, MinorNdisVersion, 1, 0 +HKR, Ndi\Interfaces, DefUpper, , "ndis5" +HKR, Ndi\Interfaces, UpperRange, , "ndis5" +HKR, Ndi\Interfaces, LowerRange, , "ethernet" +HKR, Ndi\Interfaces, DefLower, , "ethernet" +HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" +HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% +HKR, Ndi\Params\NetworkAddress, type, 0, "edit" +HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" +HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" +HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% +HKR, Ndi\Params\NetworkAddress, optional, 0, "0" +HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% +HKR, Ndi\Params\MaxSpeed, type, 0, "int" +HKR, Ndi\Params\MaxSpeed, default, 0, "100" +HKR, Ndi\Params\MaxSpeed, min, 0, "0" +HKR, Ndi\Params\MaxSpeed, max, 0, "2000" +HKR, Ndi\Params\MaxSpeed, step, 0, "1" +HKR, Ndi\Params\MaxSpeed, Base, 0, "10" +HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% +HKR, Ndi\Params\KeepLink, type, 0, "enum" +HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% +HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% +HKR, Ndi\Params\KeepLink, default, 0, "0" + + +[Neo.Service] +DisplayName = %Neo.Service.DispName% +Description = %Neo.Service.Desc% +ServiceType = 1 +StartType = 3 +ErrorControl = 1 +ServiceBinary = %12%\Neo_VPN126.sys +LoadOrderGroup = NDIS + +[Neo.Reg] +HKR, Ndi, Service, 0, Neo.Service.Name +HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" +HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" + +[Neo.EventLog] +HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN126.sys" +HKR, , TypesSupported, 0x00010001, 7 + +[Strings] +CompanyName = "SoftEther Corporation" +DiskDescription = "VPN Client Device Driver Install Disk" +Neo.Service.Name = "Neo_VPN126" +Neo.Service.DispName = "VPN Client Device Driver - VPN126" +Neo.Service.Desc = "VPN Client Adapter - VPN126" +NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN126" +Neo.EventLog.Name = "Neo" +NetworkAddress = "MAC Address" +DefaultAddress = "000001000001" +MaxSpeed = "Indicate Speed (Mbps)" +KeepLink = "Keep Link" +On = "On" +Off = "Off" + + +; Auto Generated 20180205_163608.887 + diff --git a/src/bin/hamcore/DriverPackages/Neo6_Win8/x86/Neo6_x86_VPN127.inf b/src/bin/hamcore/DriverPackages/Neo6_Win8/x86/Neo6_x86_VPN127.inf index 2faec80b..8d7ca339 100644 --- a/src/bin/hamcore/DriverPackages/Neo6_Win8/x86/Neo6_x86_VPN127.inf +++ b/src/bin/hamcore/DriverPackages/Neo6_Win8/x86/Neo6_x86_VPN127.inf @@ -1,114 +1,114 @@ -; VPN Client Device Driver for Windows 2000 and Greater -; -; Copyright (c) SoftEther Corporation. All Rights Reserved. -; http://www.softether.co.jp/ -; -; BUILD 9658 - -[Version] -Signature = "$Windows NT$" -Class = Net -ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} -Provider = %CompanyName% -DriverVer = 02/04/2018, 4.25.0.9658 -CatalogFile.NT = inf_VPN127.cat - -[Manufacturer] -%CompanyName% = SoftEther - -[SourceDisksNames] -1=%DiskDescription%, "", , - -[SourceDisksFiles] -Neo_VPN127.sys = 1 - -[DestinationDirs] -DefaultDestDir = 12 -Neo.CopyFiles.Sys = 12 - -[Neo.CopyFiles.Sys] -Neo_VPN127.sys, , , 2 - -[SoftEther] -%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN127 - -[NeoAdapter.Install] -Characteristics = 0x1 -AddReg = Neo.Reg, NeoAdapter.Ndi -CopyFiles = Neo.CopyFiles.Sys -*IfType = 53 -*MediaType = 0 -*PhysicalMediaType = 0 - -[NeoAdapter.Install.Services] -AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% - -[NeoAdapter.Ndi] -HKR, , NetworkAddress, 0, %DefaultAddress% -HKR, Ndi, DeviceID, , "NeoAdapter_VPN127" -HKR, , DevLoader, , ndis -HKR, , DeviceVxDs, , Neo_VPN127.sys -HKR, NDIS, LogDriverName, , "Neo_VPN127" -HKR, NDIS, MajorNdisVersion, 1, 5 -HKR, NDIS, MinorNdisVersion, 1, 0 -HKR, Ndi\Interfaces, DefUpper, , "ndis5" -HKR, Ndi\Interfaces, UpperRange, , "ndis5" -HKR, Ndi\Interfaces, LowerRange, , "ethernet" -HKR, Ndi\Interfaces, DefLower, , "ethernet" -HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" -HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% -HKR, Ndi\Params\NetworkAddress, type, 0, "edit" -HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" -HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" -HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% -HKR, Ndi\Params\NetworkAddress, optional, 0, "0" -HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% -HKR, Ndi\Params\MaxSpeed, type, 0, "int" -HKR, Ndi\Params\MaxSpeed, default, 0, "100" -HKR, Ndi\Params\MaxSpeed, min, 0, "0" -HKR, Ndi\Params\MaxSpeed, max, 0, "2000" -HKR, Ndi\Params\MaxSpeed, step, 0, "1" -HKR, Ndi\Params\MaxSpeed, Base, 0, "10" -HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% -HKR, Ndi\Params\KeepLink, type, 0, "enum" -HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% -HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% -HKR, Ndi\Params\KeepLink, default, 0, "0" - - -[Neo.Service] -DisplayName = %Neo.Service.DispName% -Description = %Neo.Service.Desc% -ServiceType = 1 -StartType = 3 -ErrorControl = 1 -ServiceBinary = %12%\Neo_VPN127.sys -LoadOrderGroup = NDIS - -[Neo.Reg] -HKR, Ndi, Service, 0, Neo.Service.Name -HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" -HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" - -[Neo.EventLog] -HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN127.sys" -HKR, , TypesSupported, 0x00010001, 7 - -[Strings] -CompanyName = "SoftEther Corporation" -DiskDescription = "VPN Client Device Driver Install Disk" -Neo.Service.Name = "Neo_VPN127" -Neo.Service.DispName = "VPN Client Device Driver - VPN127" -Neo.Service.Desc = "VPN Client Adapter - VPN127" -NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN127" -Neo.EventLog.Name = "Neo" -NetworkAddress = "MAC Address" -DefaultAddress = "000001000001" -MaxSpeed = "Indicate Speed (Mbps)" -KeepLink = "Keep Link" -On = "On" -Off = "Off" - - -; Auto Generated 20180205_163608.887 - +; VPN Client Device Driver for Windows 2000 and Greater +; +; Copyright (c) SoftEther Corporation. All Rights Reserved. +; http://www.softether.co.jp/ +; +; BUILD 9658 + +[Version] +Signature = "$Windows NT$" +Class = Net +ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} +Provider = %CompanyName% +DriverVer = 02/04/2018, 4.25.0.9658 +CatalogFile.NT = inf_VPN127.cat + +[Manufacturer] +%CompanyName% = SoftEther + +[SourceDisksNames] +1=%DiskDescription%, "", , + +[SourceDisksFiles] +Neo_VPN127.sys = 1 + +[DestinationDirs] +DefaultDestDir = 12 +Neo.CopyFiles.Sys = 12 + +[Neo.CopyFiles.Sys] +Neo_VPN127.sys, , , 2 + +[SoftEther] +%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN127 + +[NeoAdapter.Install] +Characteristics = 0x1 +AddReg = Neo.Reg, NeoAdapter.Ndi +CopyFiles = Neo.CopyFiles.Sys +*IfType = 53 +*MediaType = 0 +*PhysicalMediaType = 0 + +[NeoAdapter.Install.Services] +AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% + +[NeoAdapter.Ndi] +HKR, , NetworkAddress, 0, %DefaultAddress% +HKR, Ndi, DeviceID, , "NeoAdapter_VPN127" +HKR, , DevLoader, , ndis +HKR, , DeviceVxDs, , Neo_VPN127.sys +HKR, NDIS, LogDriverName, , "Neo_VPN127" +HKR, NDIS, MajorNdisVersion, 1, 5 +HKR, NDIS, MinorNdisVersion, 1, 0 +HKR, Ndi\Interfaces, DefUpper, , "ndis5" +HKR, Ndi\Interfaces, UpperRange, , "ndis5" +HKR, Ndi\Interfaces, LowerRange, , "ethernet" +HKR, Ndi\Interfaces, DefLower, , "ethernet" +HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" +HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% +HKR, Ndi\Params\NetworkAddress, type, 0, "edit" +HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" +HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" +HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% +HKR, Ndi\Params\NetworkAddress, optional, 0, "0" +HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% +HKR, Ndi\Params\MaxSpeed, type, 0, "int" +HKR, Ndi\Params\MaxSpeed, default, 0, "100" +HKR, Ndi\Params\MaxSpeed, min, 0, "0" +HKR, Ndi\Params\MaxSpeed, max, 0, "2000" +HKR, Ndi\Params\MaxSpeed, step, 0, "1" +HKR, Ndi\Params\MaxSpeed, Base, 0, "10" +HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% +HKR, Ndi\Params\KeepLink, type, 0, "enum" +HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% +HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% +HKR, Ndi\Params\KeepLink, default, 0, "0" + + +[Neo.Service] +DisplayName = %Neo.Service.DispName% +Description = %Neo.Service.Desc% +ServiceType = 1 +StartType = 3 +ErrorControl = 1 +ServiceBinary = %12%\Neo_VPN127.sys +LoadOrderGroup = NDIS + +[Neo.Reg] +HKR, Ndi, Service, 0, Neo.Service.Name +HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" +HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" + +[Neo.EventLog] +HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN127.sys" +HKR, , TypesSupported, 0x00010001, 7 + +[Strings] +CompanyName = "SoftEther Corporation" +DiskDescription = "VPN Client Device Driver Install Disk" +Neo.Service.Name = "Neo_VPN127" +Neo.Service.DispName = "VPN Client Device Driver - VPN127" +Neo.Service.Desc = "VPN Client Adapter - VPN127" +NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN127" +Neo.EventLog.Name = "Neo" +NetworkAddress = "MAC Address" +DefaultAddress = "000001000001" +MaxSpeed = "Indicate Speed (Mbps)" +KeepLink = "Keep Link" +On = "On" +Off = "Off" + + +; Auto Generated 20180205_163608.887 + diff --git a/src/bin/hamcore/DriverPackages/Neo6_Win8/x86/Neo6_x86_VPN13.inf b/src/bin/hamcore/DriverPackages/Neo6_Win8/x86/Neo6_x86_VPN13.inf index ef1ccf09..7c0ac619 100644 --- a/src/bin/hamcore/DriverPackages/Neo6_Win8/x86/Neo6_x86_VPN13.inf +++ b/src/bin/hamcore/DriverPackages/Neo6_Win8/x86/Neo6_x86_VPN13.inf @@ -1,114 +1,114 @@ -; VPN Client Device Driver for Windows 2000 and Greater -; -; Copyright (c) SoftEther Corporation. All Rights Reserved. -; http://www.softether.co.jp/ -; -; BUILD 9658 - -[Version] -Signature = "$Windows NT$" -Class = Net -ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} -Provider = %CompanyName% -DriverVer = 02/04/2018, 4.25.0.9658 -CatalogFile.NT = inf_VPN13.cat - -[Manufacturer] -%CompanyName% = SoftEther - -[SourceDisksNames] -1=%DiskDescription%, "", , - -[SourceDisksFiles] -Neo_VPN13.sys = 1 - -[DestinationDirs] -DefaultDestDir = 12 -Neo.CopyFiles.Sys = 12 - -[Neo.CopyFiles.Sys] -Neo_VPN13.sys, , , 2 - -[SoftEther] -%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN13 - -[NeoAdapter.Install] -Characteristics = 0x1 -AddReg = Neo.Reg, NeoAdapter.Ndi -CopyFiles = Neo.CopyFiles.Sys -*IfType = 53 -*MediaType = 0 -*PhysicalMediaType = 0 - -[NeoAdapter.Install.Services] -AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% - -[NeoAdapter.Ndi] -HKR, , NetworkAddress, 0, %DefaultAddress% -HKR, Ndi, DeviceID, , "NeoAdapter_VPN13" -HKR, , DevLoader, , ndis -HKR, , DeviceVxDs, , Neo_VPN13.sys -HKR, NDIS, LogDriverName, , "Neo_VPN13" -HKR, NDIS, MajorNdisVersion, 1, 5 -HKR, NDIS, MinorNdisVersion, 1, 0 -HKR, Ndi\Interfaces, DefUpper, , "ndis5" -HKR, Ndi\Interfaces, UpperRange, , "ndis5" -HKR, Ndi\Interfaces, LowerRange, , "ethernet" -HKR, Ndi\Interfaces, DefLower, , "ethernet" -HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" -HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% -HKR, Ndi\Params\NetworkAddress, type, 0, "edit" -HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" -HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" -HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% -HKR, Ndi\Params\NetworkAddress, optional, 0, "0" -HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% -HKR, Ndi\Params\MaxSpeed, type, 0, "int" -HKR, Ndi\Params\MaxSpeed, default, 0, "100" -HKR, Ndi\Params\MaxSpeed, min, 0, "0" -HKR, Ndi\Params\MaxSpeed, max, 0, "2000" -HKR, Ndi\Params\MaxSpeed, step, 0, "1" -HKR, Ndi\Params\MaxSpeed, Base, 0, "10" -HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% -HKR, Ndi\Params\KeepLink, type, 0, "enum" -HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% -HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% -HKR, Ndi\Params\KeepLink, default, 0, "0" - - -[Neo.Service] -DisplayName = %Neo.Service.DispName% -Description = %Neo.Service.Desc% -ServiceType = 1 -StartType = 3 -ErrorControl = 1 -ServiceBinary = %12%\Neo_VPN13.sys -LoadOrderGroup = NDIS - -[Neo.Reg] -HKR, Ndi, Service, 0, Neo.Service.Name -HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" -HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" - -[Neo.EventLog] -HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN13.sys" -HKR, , TypesSupported, 0x00010001, 7 - -[Strings] -CompanyName = "SoftEther Corporation" -DiskDescription = "VPN Client Device Driver Install Disk" -Neo.Service.Name = "Neo_VPN13" -Neo.Service.DispName = "VPN Client Device Driver - VPN13" -Neo.Service.Desc = "VPN Client Adapter - VPN13" -NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN13" -Neo.EventLog.Name = "Neo" -NetworkAddress = "MAC Address" -DefaultAddress = "000001000001" -MaxSpeed = "Indicate Speed (Mbps)" -KeepLink = "Keep Link" -On = "On" -Off = "Off" - - -; Auto Generated 20180205_163608.759 - +; VPN Client Device Driver for Windows 2000 and Greater +; +; Copyright (c) SoftEther Corporation. All Rights Reserved. +; http://www.softether.co.jp/ +; +; BUILD 9658 + +[Version] +Signature = "$Windows NT$" +Class = Net +ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} +Provider = %CompanyName% +DriverVer = 02/04/2018, 4.25.0.9658 +CatalogFile.NT = inf_VPN13.cat + +[Manufacturer] +%CompanyName% = SoftEther + +[SourceDisksNames] +1=%DiskDescription%, "", , + +[SourceDisksFiles] +Neo_VPN13.sys = 1 + +[DestinationDirs] +DefaultDestDir = 12 +Neo.CopyFiles.Sys = 12 + +[Neo.CopyFiles.Sys] +Neo_VPN13.sys, , , 2 + +[SoftEther] +%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN13 + +[NeoAdapter.Install] +Characteristics = 0x1 +AddReg = Neo.Reg, NeoAdapter.Ndi +CopyFiles = Neo.CopyFiles.Sys +*IfType = 53 +*MediaType = 0 +*PhysicalMediaType = 0 + +[NeoAdapter.Install.Services] +AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% + +[NeoAdapter.Ndi] +HKR, , NetworkAddress, 0, %DefaultAddress% +HKR, Ndi, DeviceID, , "NeoAdapter_VPN13" +HKR, , DevLoader, , ndis +HKR, , DeviceVxDs, , Neo_VPN13.sys +HKR, NDIS, LogDriverName, , "Neo_VPN13" +HKR, NDIS, MajorNdisVersion, 1, 5 +HKR, NDIS, MinorNdisVersion, 1, 0 +HKR, Ndi\Interfaces, DefUpper, , "ndis5" +HKR, Ndi\Interfaces, UpperRange, , "ndis5" +HKR, Ndi\Interfaces, LowerRange, , "ethernet" +HKR, Ndi\Interfaces, DefLower, , "ethernet" +HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" +HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% +HKR, Ndi\Params\NetworkAddress, type, 0, "edit" +HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" +HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" +HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% +HKR, Ndi\Params\NetworkAddress, optional, 0, "0" +HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% +HKR, Ndi\Params\MaxSpeed, type, 0, "int" +HKR, Ndi\Params\MaxSpeed, default, 0, "100" +HKR, Ndi\Params\MaxSpeed, min, 0, "0" +HKR, Ndi\Params\MaxSpeed, max, 0, "2000" +HKR, Ndi\Params\MaxSpeed, step, 0, "1" +HKR, Ndi\Params\MaxSpeed, Base, 0, "10" +HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% +HKR, Ndi\Params\KeepLink, type, 0, "enum" +HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% +HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% +HKR, Ndi\Params\KeepLink, default, 0, "0" + + +[Neo.Service] +DisplayName = %Neo.Service.DispName% +Description = %Neo.Service.Desc% +ServiceType = 1 +StartType = 3 +ErrorControl = 1 +ServiceBinary = %12%\Neo_VPN13.sys +LoadOrderGroup = NDIS + +[Neo.Reg] +HKR, Ndi, Service, 0, Neo.Service.Name +HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" +HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" + +[Neo.EventLog] +HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN13.sys" +HKR, , TypesSupported, 0x00010001, 7 + +[Strings] +CompanyName = "SoftEther Corporation" +DiskDescription = "VPN Client Device Driver Install Disk" +Neo.Service.Name = "Neo_VPN13" +Neo.Service.DispName = "VPN Client Device Driver - VPN13" +Neo.Service.Desc = "VPN Client Adapter - VPN13" +NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN13" +Neo.EventLog.Name = "Neo" +NetworkAddress = "MAC Address" +DefaultAddress = "000001000001" +MaxSpeed = "Indicate Speed (Mbps)" +KeepLink = "Keep Link" +On = "On" +Off = "Off" + + +; Auto Generated 20180205_163608.759 + diff --git a/src/bin/hamcore/DriverPackages/Neo6_Win8/x86/Neo6_x86_VPN14.inf b/src/bin/hamcore/DriverPackages/Neo6_Win8/x86/Neo6_x86_VPN14.inf index ec399f6f..5acdc65b 100644 --- a/src/bin/hamcore/DriverPackages/Neo6_Win8/x86/Neo6_x86_VPN14.inf +++ b/src/bin/hamcore/DriverPackages/Neo6_Win8/x86/Neo6_x86_VPN14.inf @@ -1,114 +1,114 @@ -; VPN Client Device Driver for Windows 2000 and Greater -; -; Copyright (c) SoftEther Corporation. All Rights Reserved. -; http://www.softether.co.jp/ -; -; BUILD 9658 - -[Version] -Signature = "$Windows NT$" -Class = Net -ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} -Provider = %CompanyName% -DriverVer = 02/04/2018, 4.25.0.9658 -CatalogFile.NT = inf_VPN14.cat - -[Manufacturer] -%CompanyName% = SoftEther - -[SourceDisksNames] -1=%DiskDescription%, "", , - -[SourceDisksFiles] -Neo_VPN14.sys = 1 - -[DestinationDirs] -DefaultDestDir = 12 -Neo.CopyFiles.Sys = 12 - -[Neo.CopyFiles.Sys] -Neo_VPN14.sys, , , 2 - -[SoftEther] -%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN14 - -[NeoAdapter.Install] -Characteristics = 0x1 -AddReg = Neo.Reg, NeoAdapter.Ndi -CopyFiles = Neo.CopyFiles.Sys -*IfType = 53 -*MediaType = 0 -*PhysicalMediaType = 0 - -[NeoAdapter.Install.Services] -AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% - -[NeoAdapter.Ndi] -HKR, , NetworkAddress, 0, %DefaultAddress% -HKR, Ndi, DeviceID, , "NeoAdapter_VPN14" -HKR, , DevLoader, , ndis -HKR, , DeviceVxDs, , Neo_VPN14.sys -HKR, NDIS, LogDriverName, , "Neo_VPN14" -HKR, NDIS, MajorNdisVersion, 1, 5 -HKR, NDIS, MinorNdisVersion, 1, 0 -HKR, Ndi\Interfaces, DefUpper, , "ndis5" -HKR, Ndi\Interfaces, UpperRange, , "ndis5" -HKR, Ndi\Interfaces, LowerRange, , "ethernet" -HKR, Ndi\Interfaces, DefLower, , "ethernet" -HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" -HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% -HKR, Ndi\Params\NetworkAddress, type, 0, "edit" -HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" -HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" -HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% -HKR, Ndi\Params\NetworkAddress, optional, 0, "0" -HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% -HKR, Ndi\Params\MaxSpeed, type, 0, "int" -HKR, Ndi\Params\MaxSpeed, default, 0, "100" -HKR, Ndi\Params\MaxSpeed, min, 0, "0" -HKR, Ndi\Params\MaxSpeed, max, 0, "2000" -HKR, Ndi\Params\MaxSpeed, step, 0, "1" -HKR, Ndi\Params\MaxSpeed, Base, 0, "10" -HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% -HKR, Ndi\Params\KeepLink, type, 0, "enum" -HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% -HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% -HKR, Ndi\Params\KeepLink, default, 0, "0" - - -[Neo.Service] -DisplayName = %Neo.Service.DispName% -Description = %Neo.Service.Desc% -ServiceType = 1 -StartType = 3 -ErrorControl = 1 -ServiceBinary = %12%\Neo_VPN14.sys -LoadOrderGroup = NDIS - -[Neo.Reg] -HKR, Ndi, Service, 0, Neo.Service.Name -HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" -HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" - -[Neo.EventLog] -HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN14.sys" -HKR, , TypesSupported, 0x00010001, 7 - -[Strings] -CompanyName = "SoftEther Corporation" -DiskDescription = "VPN Client Device Driver Install Disk" -Neo.Service.Name = "Neo_VPN14" -Neo.Service.DispName = "VPN Client Device Driver - VPN14" -Neo.Service.Desc = "VPN Client Adapter - VPN14" -NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN14" -Neo.EventLog.Name = "Neo" -NetworkAddress = "MAC Address" -DefaultAddress = "000001000001" -MaxSpeed = "Indicate Speed (Mbps)" -KeepLink = "Keep Link" -On = "On" -Off = "Off" - - -; Auto Generated 20180205_163608.760 - +; VPN Client Device Driver for Windows 2000 and Greater +; +; Copyright (c) SoftEther Corporation. All Rights Reserved. +; http://www.softether.co.jp/ +; +; BUILD 9658 + +[Version] +Signature = "$Windows NT$" +Class = Net +ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} +Provider = %CompanyName% +DriverVer = 02/04/2018, 4.25.0.9658 +CatalogFile.NT = inf_VPN14.cat + +[Manufacturer] +%CompanyName% = SoftEther + +[SourceDisksNames] +1=%DiskDescription%, "", , + +[SourceDisksFiles] +Neo_VPN14.sys = 1 + +[DestinationDirs] +DefaultDestDir = 12 +Neo.CopyFiles.Sys = 12 + +[Neo.CopyFiles.Sys] +Neo_VPN14.sys, , , 2 + +[SoftEther] +%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN14 + +[NeoAdapter.Install] +Characteristics = 0x1 +AddReg = Neo.Reg, NeoAdapter.Ndi +CopyFiles = Neo.CopyFiles.Sys +*IfType = 53 +*MediaType = 0 +*PhysicalMediaType = 0 + +[NeoAdapter.Install.Services] +AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% + +[NeoAdapter.Ndi] +HKR, , NetworkAddress, 0, %DefaultAddress% +HKR, Ndi, DeviceID, , "NeoAdapter_VPN14" +HKR, , DevLoader, , ndis +HKR, , DeviceVxDs, , Neo_VPN14.sys +HKR, NDIS, LogDriverName, , "Neo_VPN14" +HKR, NDIS, MajorNdisVersion, 1, 5 +HKR, NDIS, MinorNdisVersion, 1, 0 +HKR, Ndi\Interfaces, DefUpper, , "ndis5" +HKR, Ndi\Interfaces, UpperRange, , "ndis5" +HKR, Ndi\Interfaces, LowerRange, , "ethernet" +HKR, Ndi\Interfaces, DefLower, , "ethernet" +HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" +HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% +HKR, Ndi\Params\NetworkAddress, type, 0, "edit" +HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" +HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" +HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% +HKR, Ndi\Params\NetworkAddress, optional, 0, "0" +HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% +HKR, Ndi\Params\MaxSpeed, type, 0, "int" +HKR, Ndi\Params\MaxSpeed, default, 0, "100" +HKR, Ndi\Params\MaxSpeed, min, 0, "0" +HKR, Ndi\Params\MaxSpeed, max, 0, "2000" +HKR, Ndi\Params\MaxSpeed, step, 0, "1" +HKR, Ndi\Params\MaxSpeed, Base, 0, "10" +HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% +HKR, Ndi\Params\KeepLink, type, 0, "enum" +HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% +HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% +HKR, Ndi\Params\KeepLink, default, 0, "0" + + +[Neo.Service] +DisplayName = %Neo.Service.DispName% +Description = %Neo.Service.Desc% +ServiceType = 1 +StartType = 3 +ErrorControl = 1 +ServiceBinary = %12%\Neo_VPN14.sys +LoadOrderGroup = NDIS + +[Neo.Reg] +HKR, Ndi, Service, 0, Neo.Service.Name +HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" +HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" + +[Neo.EventLog] +HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN14.sys" +HKR, , TypesSupported, 0x00010001, 7 + +[Strings] +CompanyName = "SoftEther Corporation" +DiskDescription = "VPN Client Device Driver Install Disk" +Neo.Service.Name = "Neo_VPN14" +Neo.Service.DispName = "VPN Client Device Driver - VPN14" +Neo.Service.Desc = "VPN Client Adapter - VPN14" +NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN14" +Neo.EventLog.Name = "Neo" +NetworkAddress = "MAC Address" +DefaultAddress = "000001000001" +MaxSpeed = "Indicate Speed (Mbps)" +KeepLink = "Keep Link" +On = "On" +Off = "Off" + + +; Auto Generated 20180205_163608.760 + diff --git a/src/bin/hamcore/DriverPackages/Neo6_Win8/x86/Neo6_x86_VPN15.inf b/src/bin/hamcore/DriverPackages/Neo6_Win8/x86/Neo6_x86_VPN15.inf index e634de81..15a6c0bd 100644 --- a/src/bin/hamcore/DriverPackages/Neo6_Win8/x86/Neo6_x86_VPN15.inf +++ b/src/bin/hamcore/DriverPackages/Neo6_Win8/x86/Neo6_x86_VPN15.inf @@ -1,114 +1,114 @@ -; VPN Client Device Driver for Windows 2000 and Greater -; -; Copyright (c) SoftEther Corporation. All Rights Reserved. -; http://www.softether.co.jp/ -; -; BUILD 9658 - -[Version] -Signature = "$Windows NT$" -Class = Net -ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} -Provider = %CompanyName% -DriverVer = 02/04/2018, 4.25.0.9658 -CatalogFile.NT = inf_VPN15.cat - -[Manufacturer] -%CompanyName% = SoftEther - -[SourceDisksNames] -1=%DiskDescription%, "", , - -[SourceDisksFiles] -Neo_VPN15.sys = 1 - -[DestinationDirs] -DefaultDestDir = 12 -Neo.CopyFiles.Sys = 12 - -[Neo.CopyFiles.Sys] -Neo_VPN15.sys, , , 2 - -[SoftEther] -%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN15 - -[NeoAdapter.Install] -Characteristics = 0x1 -AddReg = Neo.Reg, NeoAdapter.Ndi -CopyFiles = Neo.CopyFiles.Sys -*IfType = 53 -*MediaType = 0 -*PhysicalMediaType = 0 - -[NeoAdapter.Install.Services] -AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% - -[NeoAdapter.Ndi] -HKR, , NetworkAddress, 0, %DefaultAddress% -HKR, Ndi, DeviceID, , "NeoAdapter_VPN15" -HKR, , DevLoader, , ndis -HKR, , DeviceVxDs, , Neo_VPN15.sys -HKR, NDIS, LogDriverName, , "Neo_VPN15" -HKR, NDIS, MajorNdisVersion, 1, 5 -HKR, NDIS, MinorNdisVersion, 1, 0 -HKR, Ndi\Interfaces, DefUpper, , "ndis5" -HKR, Ndi\Interfaces, UpperRange, , "ndis5" -HKR, Ndi\Interfaces, LowerRange, , "ethernet" -HKR, Ndi\Interfaces, DefLower, , "ethernet" -HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" -HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% -HKR, Ndi\Params\NetworkAddress, type, 0, "edit" -HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" -HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" -HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% -HKR, Ndi\Params\NetworkAddress, optional, 0, "0" -HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% -HKR, Ndi\Params\MaxSpeed, type, 0, "int" -HKR, Ndi\Params\MaxSpeed, default, 0, "100" -HKR, Ndi\Params\MaxSpeed, min, 0, "0" -HKR, Ndi\Params\MaxSpeed, max, 0, "2000" -HKR, Ndi\Params\MaxSpeed, step, 0, "1" -HKR, Ndi\Params\MaxSpeed, Base, 0, "10" -HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% -HKR, Ndi\Params\KeepLink, type, 0, "enum" -HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% -HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% -HKR, Ndi\Params\KeepLink, default, 0, "0" - - -[Neo.Service] -DisplayName = %Neo.Service.DispName% -Description = %Neo.Service.Desc% -ServiceType = 1 -StartType = 3 -ErrorControl = 1 -ServiceBinary = %12%\Neo_VPN15.sys -LoadOrderGroup = NDIS - -[Neo.Reg] -HKR, Ndi, Service, 0, Neo.Service.Name -HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" -HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" - -[Neo.EventLog] -HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN15.sys" -HKR, , TypesSupported, 0x00010001, 7 - -[Strings] -CompanyName = "SoftEther Corporation" -DiskDescription = "VPN Client Device Driver Install Disk" -Neo.Service.Name = "Neo_VPN15" -Neo.Service.DispName = "VPN Client Device Driver - VPN15" -Neo.Service.Desc = "VPN Client Adapter - VPN15" -NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN15" -Neo.EventLog.Name = "Neo" -NetworkAddress = "MAC Address" -DefaultAddress = "000001000001" -MaxSpeed = "Indicate Speed (Mbps)" -KeepLink = "Keep Link" -On = "On" -Off = "Off" - - -; Auto Generated 20180205_163608.761 - +; VPN Client Device Driver for Windows 2000 and Greater +; +; Copyright (c) SoftEther Corporation. All Rights Reserved. +; http://www.softether.co.jp/ +; +; BUILD 9658 + +[Version] +Signature = "$Windows NT$" +Class = Net +ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} +Provider = %CompanyName% +DriverVer = 02/04/2018, 4.25.0.9658 +CatalogFile.NT = inf_VPN15.cat + +[Manufacturer] +%CompanyName% = SoftEther + +[SourceDisksNames] +1=%DiskDescription%, "", , + +[SourceDisksFiles] +Neo_VPN15.sys = 1 + +[DestinationDirs] +DefaultDestDir = 12 +Neo.CopyFiles.Sys = 12 + +[Neo.CopyFiles.Sys] +Neo_VPN15.sys, , , 2 + +[SoftEther] +%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN15 + +[NeoAdapter.Install] +Characteristics = 0x1 +AddReg = Neo.Reg, NeoAdapter.Ndi +CopyFiles = Neo.CopyFiles.Sys +*IfType = 53 +*MediaType = 0 +*PhysicalMediaType = 0 + +[NeoAdapter.Install.Services] +AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% + +[NeoAdapter.Ndi] +HKR, , NetworkAddress, 0, %DefaultAddress% +HKR, Ndi, DeviceID, , "NeoAdapter_VPN15" +HKR, , DevLoader, , ndis +HKR, , DeviceVxDs, , Neo_VPN15.sys +HKR, NDIS, LogDriverName, , "Neo_VPN15" +HKR, NDIS, MajorNdisVersion, 1, 5 +HKR, NDIS, MinorNdisVersion, 1, 0 +HKR, Ndi\Interfaces, DefUpper, , "ndis5" +HKR, Ndi\Interfaces, UpperRange, , "ndis5" +HKR, Ndi\Interfaces, LowerRange, , "ethernet" +HKR, Ndi\Interfaces, DefLower, , "ethernet" +HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" +HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% +HKR, Ndi\Params\NetworkAddress, type, 0, "edit" +HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" +HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" +HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% +HKR, Ndi\Params\NetworkAddress, optional, 0, "0" +HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% +HKR, Ndi\Params\MaxSpeed, type, 0, "int" +HKR, Ndi\Params\MaxSpeed, default, 0, "100" +HKR, Ndi\Params\MaxSpeed, min, 0, "0" +HKR, Ndi\Params\MaxSpeed, max, 0, "2000" +HKR, Ndi\Params\MaxSpeed, step, 0, "1" +HKR, Ndi\Params\MaxSpeed, Base, 0, "10" +HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% +HKR, Ndi\Params\KeepLink, type, 0, "enum" +HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% +HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% +HKR, Ndi\Params\KeepLink, default, 0, "0" + + +[Neo.Service] +DisplayName = %Neo.Service.DispName% +Description = %Neo.Service.Desc% +ServiceType = 1 +StartType = 3 +ErrorControl = 1 +ServiceBinary = %12%\Neo_VPN15.sys +LoadOrderGroup = NDIS + +[Neo.Reg] +HKR, Ndi, Service, 0, Neo.Service.Name +HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" +HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" + +[Neo.EventLog] +HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN15.sys" +HKR, , TypesSupported, 0x00010001, 7 + +[Strings] +CompanyName = "SoftEther Corporation" +DiskDescription = "VPN Client Device Driver Install Disk" +Neo.Service.Name = "Neo_VPN15" +Neo.Service.DispName = "VPN Client Device Driver - VPN15" +Neo.Service.Desc = "VPN Client Adapter - VPN15" +NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN15" +Neo.EventLog.Name = "Neo" +NetworkAddress = "MAC Address" +DefaultAddress = "000001000001" +MaxSpeed = "Indicate Speed (Mbps)" +KeepLink = "Keep Link" +On = "On" +Off = "Off" + + +; Auto Generated 20180205_163608.761 + diff --git a/src/bin/hamcore/DriverPackages/Neo6_Win8/x86/Neo6_x86_VPN16.inf b/src/bin/hamcore/DriverPackages/Neo6_Win8/x86/Neo6_x86_VPN16.inf index 22074611..df7b7514 100644 --- a/src/bin/hamcore/DriverPackages/Neo6_Win8/x86/Neo6_x86_VPN16.inf +++ b/src/bin/hamcore/DriverPackages/Neo6_Win8/x86/Neo6_x86_VPN16.inf @@ -1,114 +1,114 @@ -; VPN Client Device Driver for Windows 2000 and Greater -; -; Copyright (c) SoftEther Corporation. All Rights Reserved. -; http://www.softether.co.jp/ -; -; BUILD 9658 - -[Version] -Signature = "$Windows NT$" -Class = Net -ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} -Provider = %CompanyName% -DriverVer = 02/04/2018, 4.25.0.9658 -CatalogFile.NT = inf_VPN16.cat - -[Manufacturer] -%CompanyName% = SoftEther - -[SourceDisksNames] -1=%DiskDescription%, "", , - -[SourceDisksFiles] -Neo_VPN16.sys = 1 - -[DestinationDirs] -DefaultDestDir = 12 -Neo.CopyFiles.Sys = 12 - -[Neo.CopyFiles.Sys] -Neo_VPN16.sys, , , 2 - -[SoftEther] -%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN16 - -[NeoAdapter.Install] -Characteristics = 0x1 -AddReg = Neo.Reg, NeoAdapter.Ndi -CopyFiles = Neo.CopyFiles.Sys -*IfType = 53 -*MediaType = 0 -*PhysicalMediaType = 0 - -[NeoAdapter.Install.Services] -AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% - -[NeoAdapter.Ndi] -HKR, , NetworkAddress, 0, %DefaultAddress% -HKR, Ndi, DeviceID, , "NeoAdapter_VPN16" -HKR, , DevLoader, , ndis -HKR, , DeviceVxDs, , Neo_VPN16.sys -HKR, NDIS, LogDriverName, , "Neo_VPN16" -HKR, NDIS, MajorNdisVersion, 1, 5 -HKR, NDIS, MinorNdisVersion, 1, 0 -HKR, Ndi\Interfaces, DefUpper, , "ndis5" -HKR, Ndi\Interfaces, UpperRange, , "ndis5" -HKR, Ndi\Interfaces, LowerRange, , "ethernet" -HKR, Ndi\Interfaces, DefLower, , "ethernet" -HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" -HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% -HKR, Ndi\Params\NetworkAddress, type, 0, "edit" -HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" -HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" -HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% -HKR, Ndi\Params\NetworkAddress, optional, 0, "0" -HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% -HKR, Ndi\Params\MaxSpeed, type, 0, "int" -HKR, Ndi\Params\MaxSpeed, default, 0, "100" -HKR, Ndi\Params\MaxSpeed, min, 0, "0" -HKR, Ndi\Params\MaxSpeed, max, 0, "2000" -HKR, Ndi\Params\MaxSpeed, step, 0, "1" -HKR, Ndi\Params\MaxSpeed, Base, 0, "10" -HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% -HKR, Ndi\Params\KeepLink, type, 0, "enum" -HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% -HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% -HKR, Ndi\Params\KeepLink, default, 0, "0" - - -[Neo.Service] -DisplayName = %Neo.Service.DispName% -Description = %Neo.Service.Desc% -ServiceType = 1 -StartType = 3 -ErrorControl = 1 -ServiceBinary = %12%\Neo_VPN16.sys -LoadOrderGroup = NDIS - -[Neo.Reg] -HKR, Ndi, Service, 0, Neo.Service.Name -HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" -HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" - -[Neo.EventLog] -HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN16.sys" -HKR, , TypesSupported, 0x00010001, 7 - -[Strings] -CompanyName = "SoftEther Corporation" -DiskDescription = "VPN Client Device Driver Install Disk" -Neo.Service.Name = "Neo_VPN16" -Neo.Service.DispName = "VPN Client Device Driver - VPN16" -Neo.Service.Desc = "VPN Client Adapter - VPN16" -NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN16" -Neo.EventLog.Name = "Neo" -NetworkAddress = "MAC Address" -DefaultAddress = "000001000001" -MaxSpeed = "Indicate Speed (Mbps)" -KeepLink = "Keep Link" -On = "On" -Off = "Off" - - -; Auto Generated 20180205_163608.761 - +; VPN Client Device Driver for Windows 2000 and Greater +; +; Copyright (c) SoftEther Corporation. All Rights Reserved. +; http://www.softether.co.jp/ +; +; BUILD 9658 + +[Version] +Signature = "$Windows NT$" +Class = Net +ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} +Provider = %CompanyName% +DriverVer = 02/04/2018, 4.25.0.9658 +CatalogFile.NT = inf_VPN16.cat + +[Manufacturer] +%CompanyName% = SoftEther + +[SourceDisksNames] +1=%DiskDescription%, "", , + +[SourceDisksFiles] +Neo_VPN16.sys = 1 + +[DestinationDirs] +DefaultDestDir = 12 +Neo.CopyFiles.Sys = 12 + +[Neo.CopyFiles.Sys] +Neo_VPN16.sys, , , 2 + +[SoftEther] +%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN16 + +[NeoAdapter.Install] +Characteristics = 0x1 +AddReg = Neo.Reg, NeoAdapter.Ndi +CopyFiles = Neo.CopyFiles.Sys +*IfType = 53 +*MediaType = 0 +*PhysicalMediaType = 0 + +[NeoAdapter.Install.Services] +AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% + +[NeoAdapter.Ndi] +HKR, , NetworkAddress, 0, %DefaultAddress% +HKR, Ndi, DeviceID, , "NeoAdapter_VPN16" +HKR, , DevLoader, , ndis +HKR, , DeviceVxDs, , Neo_VPN16.sys +HKR, NDIS, LogDriverName, , "Neo_VPN16" +HKR, NDIS, MajorNdisVersion, 1, 5 +HKR, NDIS, MinorNdisVersion, 1, 0 +HKR, Ndi\Interfaces, DefUpper, , "ndis5" +HKR, Ndi\Interfaces, UpperRange, , "ndis5" +HKR, Ndi\Interfaces, LowerRange, , "ethernet" +HKR, Ndi\Interfaces, DefLower, , "ethernet" +HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" +HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% +HKR, Ndi\Params\NetworkAddress, type, 0, "edit" +HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" +HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" +HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% +HKR, Ndi\Params\NetworkAddress, optional, 0, "0" +HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% +HKR, Ndi\Params\MaxSpeed, type, 0, "int" +HKR, Ndi\Params\MaxSpeed, default, 0, "100" +HKR, Ndi\Params\MaxSpeed, min, 0, "0" +HKR, Ndi\Params\MaxSpeed, max, 0, "2000" +HKR, Ndi\Params\MaxSpeed, step, 0, "1" +HKR, Ndi\Params\MaxSpeed, Base, 0, "10" +HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% +HKR, Ndi\Params\KeepLink, type, 0, "enum" +HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% +HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% +HKR, Ndi\Params\KeepLink, default, 0, "0" + + +[Neo.Service] +DisplayName = %Neo.Service.DispName% +Description = %Neo.Service.Desc% +ServiceType = 1 +StartType = 3 +ErrorControl = 1 +ServiceBinary = %12%\Neo_VPN16.sys +LoadOrderGroup = NDIS + +[Neo.Reg] +HKR, Ndi, Service, 0, Neo.Service.Name +HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" +HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" + +[Neo.EventLog] +HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN16.sys" +HKR, , TypesSupported, 0x00010001, 7 + +[Strings] +CompanyName = "SoftEther Corporation" +DiskDescription = "VPN Client Device Driver Install Disk" +Neo.Service.Name = "Neo_VPN16" +Neo.Service.DispName = "VPN Client Device Driver - VPN16" +Neo.Service.Desc = "VPN Client Adapter - VPN16" +NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN16" +Neo.EventLog.Name = "Neo" +NetworkAddress = "MAC Address" +DefaultAddress = "000001000001" +MaxSpeed = "Indicate Speed (Mbps)" +KeepLink = "Keep Link" +On = "On" +Off = "Off" + + +; Auto Generated 20180205_163608.761 + diff --git a/src/bin/hamcore/DriverPackages/Neo6_Win8/x86/Neo6_x86_VPN17.inf b/src/bin/hamcore/DriverPackages/Neo6_Win8/x86/Neo6_x86_VPN17.inf index 4e383e58..8da31474 100644 --- a/src/bin/hamcore/DriverPackages/Neo6_Win8/x86/Neo6_x86_VPN17.inf +++ b/src/bin/hamcore/DriverPackages/Neo6_Win8/x86/Neo6_x86_VPN17.inf @@ -1,114 +1,114 @@ -; VPN Client Device Driver for Windows 2000 and Greater -; -; Copyright (c) SoftEther Corporation. All Rights Reserved. -; http://www.softether.co.jp/ -; -; BUILD 9658 - -[Version] -Signature = "$Windows NT$" -Class = Net -ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} -Provider = %CompanyName% -DriverVer = 02/04/2018, 4.25.0.9658 -CatalogFile.NT = inf_VPN17.cat - -[Manufacturer] -%CompanyName% = SoftEther - -[SourceDisksNames] -1=%DiskDescription%, "", , - -[SourceDisksFiles] -Neo_VPN17.sys = 1 - -[DestinationDirs] -DefaultDestDir = 12 -Neo.CopyFiles.Sys = 12 - -[Neo.CopyFiles.Sys] -Neo_VPN17.sys, , , 2 - -[SoftEther] -%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN17 - -[NeoAdapter.Install] -Characteristics = 0x1 -AddReg = Neo.Reg, NeoAdapter.Ndi -CopyFiles = Neo.CopyFiles.Sys -*IfType = 53 -*MediaType = 0 -*PhysicalMediaType = 0 - -[NeoAdapter.Install.Services] -AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% - -[NeoAdapter.Ndi] -HKR, , NetworkAddress, 0, %DefaultAddress% -HKR, Ndi, DeviceID, , "NeoAdapter_VPN17" -HKR, , DevLoader, , ndis -HKR, , DeviceVxDs, , Neo_VPN17.sys -HKR, NDIS, LogDriverName, , "Neo_VPN17" -HKR, NDIS, MajorNdisVersion, 1, 5 -HKR, NDIS, MinorNdisVersion, 1, 0 -HKR, Ndi\Interfaces, DefUpper, , "ndis5" -HKR, Ndi\Interfaces, UpperRange, , "ndis5" -HKR, Ndi\Interfaces, LowerRange, , "ethernet" -HKR, Ndi\Interfaces, DefLower, , "ethernet" -HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" -HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% -HKR, Ndi\Params\NetworkAddress, type, 0, "edit" -HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" -HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" -HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% -HKR, Ndi\Params\NetworkAddress, optional, 0, "0" -HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% -HKR, Ndi\Params\MaxSpeed, type, 0, "int" -HKR, Ndi\Params\MaxSpeed, default, 0, "100" -HKR, Ndi\Params\MaxSpeed, min, 0, "0" -HKR, Ndi\Params\MaxSpeed, max, 0, "2000" -HKR, Ndi\Params\MaxSpeed, step, 0, "1" -HKR, Ndi\Params\MaxSpeed, Base, 0, "10" -HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% -HKR, Ndi\Params\KeepLink, type, 0, "enum" -HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% -HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% -HKR, Ndi\Params\KeepLink, default, 0, "0" - - -[Neo.Service] -DisplayName = %Neo.Service.DispName% -Description = %Neo.Service.Desc% -ServiceType = 1 -StartType = 3 -ErrorControl = 1 -ServiceBinary = %12%\Neo_VPN17.sys -LoadOrderGroup = NDIS - -[Neo.Reg] -HKR, Ndi, Service, 0, Neo.Service.Name -HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" -HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" - -[Neo.EventLog] -HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN17.sys" -HKR, , TypesSupported, 0x00010001, 7 - -[Strings] -CompanyName = "SoftEther Corporation" -DiskDescription = "VPN Client Device Driver Install Disk" -Neo.Service.Name = "Neo_VPN17" -Neo.Service.DispName = "VPN Client Device Driver - VPN17" -Neo.Service.Desc = "VPN Client Adapter - VPN17" -NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN17" -Neo.EventLog.Name = "Neo" -NetworkAddress = "MAC Address" -DefaultAddress = "000001000001" -MaxSpeed = "Indicate Speed (Mbps)" -KeepLink = "Keep Link" -On = "On" -Off = "Off" - - -; Auto Generated 20180205_163608.762 - +; VPN Client Device Driver for Windows 2000 and Greater +; +; Copyright (c) SoftEther Corporation. All Rights Reserved. +; http://www.softether.co.jp/ +; +; BUILD 9658 + +[Version] +Signature = "$Windows NT$" +Class = Net +ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} +Provider = %CompanyName% +DriverVer = 02/04/2018, 4.25.0.9658 +CatalogFile.NT = inf_VPN17.cat + +[Manufacturer] +%CompanyName% = SoftEther + +[SourceDisksNames] +1=%DiskDescription%, "", , + +[SourceDisksFiles] +Neo_VPN17.sys = 1 + +[DestinationDirs] +DefaultDestDir = 12 +Neo.CopyFiles.Sys = 12 + +[Neo.CopyFiles.Sys] +Neo_VPN17.sys, , , 2 + +[SoftEther] +%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN17 + +[NeoAdapter.Install] +Characteristics = 0x1 +AddReg = Neo.Reg, NeoAdapter.Ndi +CopyFiles = Neo.CopyFiles.Sys +*IfType = 53 +*MediaType = 0 +*PhysicalMediaType = 0 + +[NeoAdapter.Install.Services] +AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% + +[NeoAdapter.Ndi] +HKR, , NetworkAddress, 0, %DefaultAddress% +HKR, Ndi, DeviceID, , "NeoAdapter_VPN17" +HKR, , DevLoader, , ndis +HKR, , DeviceVxDs, , Neo_VPN17.sys +HKR, NDIS, LogDriverName, , "Neo_VPN17" +HKR, NDIS, MajorNdisVersion, 1, 5 +HKR, NDIS, MinorNdisVersion, 1, 0 +HKR, Ndi\Interfaces, DefUpper, , "ndis5" +HKR, Ndi\Interfaces, UpperRange, , "ndis5" +HKR, Ndi\Interfaces, LowerRange, , "ethernet" +HKR, Ndi\Interfaces, DefLower, , "ethernet" +HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" +HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% +HKR, Ndi\Params\NetworkAddress, type, 0, "edit" +HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" +HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" +HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% +HKR, Ndi\Params\NetworkAddress, optional, 0, "0" +HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% +HKR, Ndi\Params\MaxSpeed, type, 0, "int" +HKR, Ndi\Params\MaxSpeed, default, 0, "100" +HKR, Ndi\Params\MaxSpeed, min, 0, "0" +HKR, Ndi\Params\MaxSpeed, max, 0, "2000" +HKR, Ndi\Params\MaxSpeed, step, 0, "1" +HKR, Ndi\Params\MaxSpeed, Base, 0, "10" +HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% +HKR, Ndi\Params\KeepLink, type, 0, "enum" +HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% +HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% +HKR, Ndi\Params\KeepLink, default, 0, "0" + + +[Neo.Service] +DisplayName = %Neo.Service.DispName% +Description = %Neo.Service.Desc% +ServiceType = 1 +StartType = 3 +ErrorControl = 1 +ServiceBinary = %12%\Neo_VPN17.sys +LoadOrderGroup = NDIS + +[Neo.Reg] +HKR, Ndi, Service, 0, Neo.Service.Name +HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" +HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" + +[Neo.EventLog] +HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN17.sys" +HKR, , TypesSupported, 0x00010001, 7 + +[Strings] +CompanyName = "SoftEther Corporation" +DiskDescription = "VPN Client Device Driver Install Disk" +Neo.Service.Name = "Neo_VPN17" +Neo.Service.DispName = "VPN Client Device Driver - VPN17" +Neo.Service.Desc = "VPN Client Adapter - VPN17" +NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN17" +Neo.EventLog.Name = "Neo" +NetworkAddress = "MAC Address" +DefaultAddress = "000001000001" +MaxSpeed = "Indicate Speed (Mbps)" +KeepLink = "Keep Link" +On = "On" +Off = "Off" + + +; Auto Generated 20180205_163608.762 + diff --git a/src/bin/hamcore/DriverPackages/Neo6_Win8/x86/Neo6_x86_VPN18.inf b/src/bin/hamcore/DriverPackages/Neo6_Win8/x86/Neo6_x86_VPN18.inf index 79995b2b..cd9bcb50 100644 --- a/src/bin/hamcore/DriverPackages/Neo6_Win8/x86/Neo6_x86_VPN18.inf +++ b/src/bin/hamcore/DriverPackages/Neo6_Win8/x86/Neo6_x86_VPN18.inf @@ -1,114 +1,114 @@ -; VPN Client Device Driver for Windows 2000 and Greater -; -; Copyright (c) SoftEther Corporation. All Rights Reserved. -; http://www.softether.co.jp/ -; -; BUILD 9658 - -[Version] -Signature = "$Windows NT$" -Class = Net -ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} -Provider = %CompanyName% -DriverVer = 02/04/2018, 4.25.0.9658 -CatalogFile.NT = inf_VPN18.cat - -[Manufacturer] -%CompanyName% = SoftEther - -[SourceDisksNames] -1=%DiskDescription%, "", , - -[SourceDisksFiles] -Neo_VPN18.sys = 1 - -[DestinationDirs] -DefaultDestDir = 12 -Neo.CopyFiles.Sys = 12 - -[Neo.CopyFiles.Sys] -Neo_VPN18.sys, , , 2 - -[SoftEther] -%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN18 - -[NeoAdapter.Install] -Characteristics = 0x1 -AddReg = Neo.Reg, NeoAdapter.Ndi -CopyFiles = Neo.CopyFiles.Sys -*IfType = 53 -*MediaType = 0 -*PhysicalMediaType = 0 - -[NeoAdapter.Install.Services] -AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% - -[NeoAdapter.Ndi] -HKR, , NetworkAddress, 0, %DefaultAddress% -HKR, Ndi, DeviceID, , "NeoAdapter_VPN18" -HKR, , DevLoader, , ndis -HKR, , DeviceVxDs, , Neo_VPN18.sys -HKR, NDIS, LogDriverName, , "Neo_VPN18" -HKR, NDIS, MajorNdisVersion, 1, 5 -HKR, NDIS, MinorNdisVersion, 1, 0 -HKR, Ndi\Interfaces, DefUpper, , "ndis5" -HKR, Ndi\Interfaces, UpperRange, , "ndis5" -HKR, Ndi\Interfaces, LowerRange, , "ethernet" -HKR, Ndi\Interfaces, DefLower, , "ethernet" -HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" -HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% -HKR, Ndi\Params\NetworkAddress, type, 0, "edit" -HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" -HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" -HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% -HKR, Ndi\Params\NetworkAddress, optional, 0, "0" -HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% -HKR, Ndi\Params\MaxSpeed, type, 0, "int" -HKR, Ndi\Params\MaxSpeed, default, 0, "100" -HKR, Ndi\Params\MaxSpeed, min, 0, "0" -HKR, Ndi\Params\MaxSpeed, max, 0, "2000" -HKR, Ndi\Params\MaxSpeed, step, 0, "1" -HKR, Ndi\Params\MaxSpeed, Base, 0, "10" -HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% -HKR, Ndi\Params\KeepLink, type, 0, "enum" -HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% -HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% -HKR, Ndi\Params\KeepLink, default, 0, "0" - - -[Neo.Service] -DisplayName = %Neo.Service.DispName% -Description = %Neo.Service.Desc% -ServiceType = 1 -StartType = 3 -ErrorControl = 1 -ServiceBinary = %12%\Neo_VPN18.sys -LoadOrderGroup = NDIS - -[Neo.Reg] -HKR, Ndi, Service, 0, Neo.Service.Name -HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" -HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" - -[Neo.EventLog] -HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN18.sys" -HKR, , TypesSupported, 0x00010001, 7 - -[Strings] -CompanyName = "SoftEther Corporation" -DiskDescription = "VPN Client Device Driver Install Disk" -Neo.Service.Name = "Neo_VPN18" -Neo.Service.DispName = "VPN Client Device Driver - VPN18" -Neo.Service.Desc = "VPN Client Adapter - VPN18" -NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN18" -Neo.EventLog.Name = "Neo" -NetworkAddress = "MAC Address" -DefaultAddress = "000001000001" -MaxSpeed = "Indicate Speed (Mbps)" -KeepLink = "Keep Link" -On = "On" -Off = "Off" - - -; Auto Generated 20180205_163608.763 - +; VPN Client Device Driver for Windows 2000 and Greater +; +; Copyright (c) SoftEther Corporation. All Rights Reserved. +; http://www.softether.co.jp/ +; +; BUILD 9658 + +[Version] +Signature = "$Windows NT$" +Class = Net +ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} +Provider = %CompanyName% +DriverVer = 02/04/2018, 4.25.0.9658 +CatalogFile.NT = inf_VPN18.cat + +[Manufacturer] +%CompanyName% = SoftEther + +[SourceDisksNames] +1=%DiskDescription%, "", , + +[SourceDisksFiles] +Neo_VPN18.sys = 1 + +[DestinationDirs] +DefaultDestDir = 12 +Neo.CopyFiles.Sys = 12 + +[Neo.CopyFiles.Sys] +Neo_VPN18.sys, , , 2 + +[SoftEther] +%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN18 + +[NeoAdapter.Install] +Characteristics = 0x1 +AddReg = Neo.Reg, NeoAdapter.Ndi +CopyFiles = Neo.CopyFiles.Sys +*IfType = 53 +*MediaType = 0 +*PhysicalMediaType = 0 + +[NeoAdapter.Install.Services] +AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% + +[NeoAdapter.Ndi] +HKR, , NetworkAddress, 0, %DefaultAddress% +HKR, Ndi, DeviceID, , "NeoAdapter_VPN18" +HKR, , DevLoader, , ndis +HKR, , DeviceVxDs, , Neo_VPN18.sys +HKR, NDIS, LogDriverName, , "Neo_VPN18" +HKR, NDIS, MajorNdisVersion, 1, 5 +HKR, NDIS, MinorNdisVersion, 1, 0 +HKR, Ndi\Interfaces, DefUpper, , "ndis5" +HKR, Ndi\Interfaces, UpperRange, , "ndis5" +HKR, Ndi\Interfaces, LowerRange, , "ethernet" +HKR, Ndi\Interfaces, DefLower, , "ethernet" +HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" +HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% +HKR, Ndi\Params\NetworkAddress, type, 0, "edit" +HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" +HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" +HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% +HKR, Ndi\Params\NetworkAddress, optional, 0, "0" +HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% +HKR, Ndi\Params\MaxSpeed, type, 0, "int" +HKR, Ndi\Params\MaxSpeed, default, 0, "100" +HKR, Ndi\Params\MaxSpeed, min, 0, "0" +HKR, Ndi\Params\MaxSpeed, max, 0, "2000" +HKR, Ndi\Params\MaxSpeed, step, 0, "1" +HKR, Ndi\Params\MaxSpeed, Base, 0, "10" +HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% +HKR, Ndi\Params\KeepLink, type, 0, "enum" +HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% +HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% +HKR, Ndi\Params\KeepLink, default, 0, "0" + + +[Neo.Service] +DisplayName = %Neo.Service.DispName% +Description = %Neo.Service.Desc% +ServiceType = 1 +StartType = 3 +ErrorControl = 1 +ServiceBinary = %12%\Neo_VPN18.sys +LoadOrderGroup = NDIS + +[Neo.Reg] +HKR, Ndi, Service, 0, Neo.Service.Name +HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" +HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" + +[Neo.EventLog] +HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN18.sys" +HKR, , TypesSupported, 0x00010001, 7 + +[Strings] +CompanyName = "SoftEther Corporation" +DiskDescription = "VPN Client Device Driver Install Disk" +Neo.Service.Name = "Neo_VPN18" +Neo.Service.DispName = "VPN Client Device Driver - VPN18" +Neo.Service.Desc = "VPN Client Adapter - VPN18" +NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN18" +Neo.EventLog.Name = "Neo" +NetworkAddress = "MAC Address" +DefaultAddress = "000001000001" +MaxSpeed = "Indicate Speed (Mbps)" +KeepLink = "Keep Link" +On = "On" +Off = "Off" + + +; Auto Generated 20180205_163608.763 + diff --git a/src/bin/hamcore/DriverPackages/Neo6_Win8/x86/Neo6_x86_VPN19.inf b/src/bin/hamcore/DriverPackages/Neo6_Win8/x86/Neo6_x86_VPN19.inf index 350c8ee6..eeec02ac 100644 --- a/src/bin/hamcore/DriverPackages/Neo6_Win8/x86/Neo6_x86_VPN19.inf +++ b/src/bin/hamcore/DriverPackages/Neo6_Win8/x86/Neo6_x86_VPN19.inf @@ -1,114 +1,114 @@ -; VPN Client Device Driver for Windows 2000 and Greater -; -; Copyright (c) SoftEther Corporation. All Rights Reserved. -; http://www.softether.co.jp/ -; -; BUILD 9658 - -[Version] -Signature = "$Windows NT$" -Class = Net -ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} -Provider = %CompanyName% -DriverVer = 02/04/2018, 4.25.0.9658 -CatalogFile.NT = inf_VPN19.cat - -[Manufacturer] -%CompanyName% = SoftEther - -[SourceDisksNames] -1=%DiskDescription%, "", , - -[SourceDisksFiles] -Neo_VPN19.sys = 1 - -[DestinationDirs] -DefaultDestDir = 12 -Neo.CopyFiles.Sys = 12 - -[Neo.CopyFiles.Sys] -Neo_VPN19.sys, , , 2 - -[SoftEther] -%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN19 - -[NeoAdapter.Install] -Characteristics = 0x1 -AddReg = Neo.Reg, NeoAdapter.Ndi -CopyFiles = Neo.CopyFiles.Sys -*IfType = 53 -*MediaType = 0 -*PhysicalMediaType = 0 - -[NeoAdapter.Install.Services] -AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% - -[NeoAdapter.Ndi] -HKR, , NetworkAddress, 0, %DefaultAddress% -HKR, Ndi, DeviceID, , "NeoAdapter_VPN19" -HKR, , DevLoader, , ndis -HKR, , DeviceVxDs, , Neo_VPN19.sys -HKR, NDIS, LogDriverName, , "Neo_VPN19" -HKR, NDIS, MajorNdisVersion, 1, 5 -HKR, NDIS, MinorNdisVersion, 1, 0 -HKR, Ndi\Interfaces, DefUpper, , "ndis5" -HKR, Ndi\Interfaces, UpperRange, , "ndis5" -HKR, Ndi\Interfaces, LowerRange, , "ethernet" -HKR, Ndi\Interfaces, DefLower, , "ethernet" -HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" -HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% -HKR, Ndi\Params\NetworkAddress, type, 0, "edit" -HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" -HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" -HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% -HKR, Ndi\Params\NetworkAddress, optional, 0, "0" -HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% -HKR, Ndi\Params\MaxSpeed, type, 0, "int" -HKR, Ndi\Params\MaxSpeed, default, 0, "100" -HKR, Ndi\Params\MaxSpeed, min, 0, "0" -HKR, Ndi\Params\MaxSpeed, max, 0, "2000" -HKR, Ndi\Params\MaxSpeed, step, 0, "1" -HKR, Ndi\Params\MaxSpeed, Base, 0, "10" -HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% -HKR, Ndi\Params\KeepLink, type, 0, "enum" -HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% -HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% -HKR, Ndi\Params\KeepLink, default, 0, "0" - - -[Neo.Service] -DisplayName = %Neo.Service.DispName% -Description = %Neo.Service.Desc% -ServiceType = 1 -StartType = 3 -ErrorControl = 1 -ServiceBinary = %12%\Neo_VPN19.sys -LoadOrderGroup = NDIS - -[Neo.Reg] -HKR, Ndi, Service, 0, Neo.Service.Name -HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" -HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" - -[Neo.EventLog] -HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN19.sys" -HKR, , TypesSupported, 0x00010001, 7 - -[Strings] -CompanyName = "SoftEther Corporation" -DiskDescription = "VPN Client Device Driver Install Disk" -Neo.Service.Name = "Neo_VPN19" -Neo.Service.DispName = "VPN Client Device Driver - VPN19" -Neo.Service.Desc = "VPN Client Adapter - VPN19" -NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN19" -Neo.EventLog.Name = "Neo" -NetworkAddress = "MAC Address" -DefaultAddress = "000001000001" -MaxSpeed = "Indicate Speed (Mbps)" -KeepLink = "Keep Link" -On = "On" -Off = "Off" - - -; Auto Generated 20180205_163608.764 - +; VPN Client Device Driver for Windows 2000 and Greater +; +; Copyright (c) SoftEther Corporation. All Rights Reserved. +; http://www.softether.co.jp/ +; +; BUILD 9658 + +[Version] +Signature = "$Windows NT$" +Class = Net +ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} +Provider = %CompanyName% +DriverVer = 02/04/2018, 4.25.0.9658 +CatalogFile.NT = inf_VPN19.cat + +[Manufacturer] +%CompanyName% = SoftEther + +[SourceDisksNames] +1=%DiskDescription%, "", , + +[SourceDisksFiles] +Neo_VPN19.sys = 1 + +[DestinationDirs] +DefaultDestDir = 12 +Neo.CopyFiles.Sys = 12 + +[Neo.CopyFiles.Sys] +Neo_VPN19.sys, , , 2 + +[SoftEther] +%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN19 + +[NeoAdapter.Install] +Characteristics = 0x1 +AddReg = Neo.Reg, NeoAdapter.Ndi +CopyFiles = Neo.CopyFiles.Sys +*IfType = 53 +*MediaType = 0 +*PhysicalMediaType = 0 + +[NeoAdapter.Install.Services] +AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% + +[NeoAdapter.Ndi] +HKR, , NetworkAddress, 0, %DefaultAddress% +HKR, Ndi, DeviceID, , "NeoAdapter_VPN19" +HKR, , DevLoader, , ndis +HKR, , DeviceVxDs, , Neo_VPN19.sys +HKR, NDIS, LogDriverName, , "Neo_VPN19" +HKR, NDIS, MajorNdisVersion, 1, 5 +HKR, NDIS, MinorNdisVersion, 1, 0 +HKR, Ndi\Interfaces, DefUpper, , "ndis5" +HKR, Ndi\Interfaces, UpperRange, , "ndis5" +HKR, Ndi\Interfaces, LowerRange, , "ethernet" +HKR, Ndi\Interfaces, DefLower, , "ethernet" +HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" +HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% +HKR, Ndi\Params\NetworkAddress, type, 0, "edit" +HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" +HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" +HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% +HKR, Ndi\Params\NetworkAddress, optional, 0, "0" +HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% +HKR, Ndi\Params\MaxSpeed, type, 0, "int" +HKR, Ndi\Params\MaxSpeed, default, 0, "100" +HKR, Ndi\Params\MaxSpeed, min, 0, "0" +HKR, Ndi\Params\MaxSpeed, max, 0, "2000" +HKR, Ndi\Params\MaxSpeed, step, 0, "1" +HKR, Ndi\Params\MaxSpeed, Base, 0, "10" +HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% +HKR, Ndi\Params\KeepLink, type, 0, "enum" +HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% +HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% +HKR, Ndi\Params\KeepLink, default, 0, "0" + + +[Neo.Service] +DisplayName = %Neo.Service.DispName% +Description = %Neo.Service.Desc% +ServiceType = 1 +StartType = 3 +ErrorControl = 1 +ServiceBinary = %12%\Neo_VPN19.sys +LoadOrderGroup = NDIS + +[Neo.Reg] +HKR, Ndi, Service, 0, Neo.Service.Name +HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" +HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" + +[Neo.EventLog] +HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN19.sys" +HKR, , TypesSupported, 0x00010001, 7 + +[Strings] +CompanyName = "SoftEther Corporation" +DiskDescription = "VPN Client Device Driver Install Disk" +Neo.Service.Name = "Neo_VPN19" +Neo.Service.DispName = "VPN Client Device Driver - VPN19" +Neo.Service.Desc = "VPN Client Adapter - VPN19" +NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN19" +Neo.EventLog.Name = "Neo" +NetworkAddress = "MAC Address" +DefaultAddress = "000001000001" +MaxSpeed = "Indicate Speed (Mbps)" +KeepLink = "Keep Link" +On = "On" +Off = "Off" + + +; Auto Generated 20180205_163608.764 + diff --git a/src/bin/hamcore/DriverPackages/Neo6_Win8/x86/Neo6_x86_VPN2.inf b/src/bin/hamcore/DriverPackages/Neo6_Win8/x86/Neo6_x86_VPN2.inf index 0a058810..7126f4c9 100644 --- a/src/bin/hamcore/DriverPackages/Neo6_Win8/x86/Neo6_x86_VPN2.inf +++ b/src/bin/hamcore/DriverPackages/Neo6_Win8/x86/Neo6_x86_VPN2.inf @@ -1,114 +1,114 @@ -; VPN Client Device Driver for Windows 2000 and Greater -; -; Copyright (c) SoftEther Corporation. All Rights Reserved. -; http://www.softether.co.jp/ -; -; BUILD 9658 - -[Version] -Signature = "$Windows NT$" -Class = Net -ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} -Provider = %CompanyName% -DriverVer = 02/04/2018, 4.25.0.9658 -CatalogFile.NT = inf_VPN2.cat - -[Manufacturer] -%CompanyName% = SoftEther - -[SourceDisksNames] -1=%DiskDescription%, "", , - -[SourceDisksFiles] -Neo_VPN2.sys = 1 - -[DestinationDirs] -DefaultDestDir = 12 -Neo.CopyFiles.Sys = 12 - -[Neo.CopyFiles.Sys] -Neo_VPN2.sys, , , 2 - -[SoftEther] -%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN2 - -[NeoAdapter.Install] -Characteristics = 0x1 -AddReg = Neo.Reg, NeoAdapter.Ndi -CopyFiles = Neo.CopyFiles.Sys -*IfType = 53 -*MediaType = 0 -*PhysicalMediaType = 0 - -[NeoAdapter.Install.Services] -AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% - -[NeoAdapter.Ndi] -HKR, , NetworkAddress, 0, %DefaultAddress% -HKR, Ndi, DeviceID, , "NeoAdapter_VPN2" -HKR, , DevLoader, , ndis -HKR, , DeviceVxDs, , Neo_VPN2.sys -HKR, NDIS, LogDriverName, , "Neo_VPN2" -HKR, NDIS, MajorNdisVersion, 1, 5 -HKR, NDIS, MinorNdisVersion, 1, 0 -HKR, Ndi\Interfaces, DefUpper, , "ndis5" -HKR, Ndi\Interfaces, UpperRange, , "ndis5" -HKR, Ndi\Interfaces, LowerRange, , "ethernet" -HKR, Ndi\Interfaces, DefLower, , "ethernet" -HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" -HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% -HKR, Ndi\Params\NetworkAddress, type, 0, "edit" -HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" -HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" -HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% -HKR, Ndi\Params\NetworkAddress, optional, 0, "0" -HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% -HKR, Ndi\Params\MaxSpeed, type, 0, "int" -HKR, Ndi\Params\MaxSpeed, default, 0, "100" -HKR, Ndi\Params\MaxSpeed, min, 0, "0" -HKR, Ndi\Params\MaxSpeed, max, 0, "2000" -HKR, Ndi\Params\MaxSpeed, step, 0, "1" -HKR, Ndi\Params\MaxSpeed, Base, 0, "10" -HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% -HKR, Ndi\Params\KeepLink, type, 0, "enum" -HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% -HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% -HKR, Ndi\Params\KeepLink, default, 0, "0" - - -[Neo.Service] -DisplayName = %Neo.Service.DispName% -Description = %Neo.Service.Desc% -ServiceType = 1 -StartType = 3 -ErrorControl = 1 -ServiceBinary = %12%\Neo_VPN2.sys -LoadOrderGroup = NDIS - -[Neo.Reg] -HKR, Ndi, Service, 0, Neo.Service.Name -HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" -HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" - -[Neo.EventLog] -HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN2.sys" -HKR, , TypesSupported, 0x00010001, 7 - -[Strings] -CompanyName = "SoftEther Corporation" -DiskDescription = "VPN Client Device Driver Install Disk" -Neo.Service.Name = "Neo_VPN2" -Neo.Service.DispName = "VPN Client Device Driver - VPN2" -Neo.Service.Desc = "VPN Client Adapter - VPN2" -NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN2" -Neo.EventLog.Name = "Neo" -NetworkAddress = "MAC Address" -DefaultAddress = "000001000001" -MaxSpeed = "Indicate Speed (Mbps)" -KeepLink = "Keep Link" -On = "On" -Off = "Off" - - -; Auto Generated 20180205_163608.748 - +; VPN Client Device Driver for Windows 2000 and Greater +; +; Copyright (c) SoftEther Corporation. All Rights Reserved. +; http://www.softether.co.jp/ +; +; BUILD 9658 + +[Version] +Signature = "$Windows NT$" +Class = Net +ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} +Provider = %CompanyName% +DriverVer = 02/04/2018, 4.25.0.9658 +CatalogFile.NT = inf_VPN2.cat + +[Manufacturer] +%CompanyName% = SoftEther + +[SourceDisksNames] +1=%DiskDescription%, "", , + +[SourceDisksFiles] +Neo_VPN2.sys = 1 + +[DestinationDirs] +DefaultDestDir = 12 +Neo.CopyFiles.Sys = 12 + +[Neo.CopyFiles.Sys] +Neo_VPN2.sys, , , 2 + +[SoftEther] +%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN2 + +[NeoAdapter.Install] +Characteristics = 0x1 +AddReg = Neo.Reg, NeoAdapter.Ndi +CopyFiles = Neo.CopyFiles.Sys +*IfType = 53 +*MediaType = 0 +*PhysicalMediaType = 0 + +[NeoAdapter.Install.Services] +AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% + +[NeoAdapter.Ndi] +HKR, , NetworkAddress, 0, %DefaultAddress% +HKR, Ndi, DeviceID, , "NeoAdapter_VPN2" +HKR, , DevLoader, , ndis +HKR, , DeviceVxDs, , Neo_VPN2.sys +HKR, NDIS, LogDriverName, , "Neo_VPN2" +HKR, NDIS, MajorNdisVersion, 1, 5 +HKR, NDIS, MinorNdisVersion, 1, 0 +HKR, Ndi\Interfaces, DefUpper, , "ndis5" +HKR, Ndi\Interfaces, UpperRange, , "ndis5" +HKR, Ndi\Interfaces, LowerRange, , "ethernet" +HKR, Ndi\Interfaces, DefLower, , "ethernet" +HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" +HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% +HKR, Ndi\Params\NetworkAddress, type, 0, "edit" +HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" +HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" +HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% +HKR, Ndi\Params\NetworkAddress, optional, 0, "0" +HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% +HKR, Ndi\Params\MaxSpeed, type, 0, "int" +HKR, Ndi\Params\MaxSpeed, default, 0, "100" +HKR, Ndi\Params\MaxSpeed, min, 0, "0" +HKR, Ndi\Params\MaxSpeed, max, 0, "2000" +HKR, Ndi\Params\MaxSpeed, step, 0, "1" +HKR, Ndi\Params\MaxSpeed, Base, 0, "10" +HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% +HKR, Ndi\Params\KeepLink, type, 0, "enum" +HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% +HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% +HKR, Ndi\Params\KeepLink, default, 0, "0" + + +[Neo.Service] +DisplayName = %Neo.Service.DispName% +Description = %Neo.Service.Desc% +ServiceType = 1 +StartType = 3 +ErrorControl = 1 +ServiceBinary = %12%\Neo_VPN2.sys +LoadOrderGroup = NDIS + +[Neo.Reg] +HKR, Ndi, Service, 0, Neo.Service.Name +HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" +HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" + +[Neo.EventLog] +HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN2.sys" +HKR, , TypesSupported, 0x00010001, 7 + +[Strings] +CompanyName = "SoftEther Corporation" +DiskDescription = "VPN Client Device Driver Install Disk" +Neo.Service.Name = "Neo_VPN2" +Neo.Service.DispName = "VPN Client Device Driver - VPN2" +Neo.Service.Desc = "VPN Client Adapter - VPN2" +NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN2" +Neo.EventLog.Name = "Neo" +NetworkAddress = "MAC Address" +DefaultAddress = "000001000001" +MaxSpeed = "Indicate Speed (Mbps)" +KeepLink = "Keep Link" +On = "On" +Off = "Off" + + +; Auto Generated 20180205_163608.748 + diff --git a/src/bin/hamcore/DriverPackages/Neo6_Win8/x86/Neo6_x86_VPN20.inf b/src/bin/hamcore/DriverPackages/Neo6_Win8/x86/Neo6_x86_VPN20.inf index b823d011..5ef87af6 100644 --- a/src/bin/hamcore/DriverPackages/Neo6_Win8/x86/Neo6_x86_VPN20.inf +++ b/src/bin/hamcore/DriverPackages/Neo6_Win8/x86/Neo6_x86_VPN20.inf @@ -1,114 +1,114 @@ -; VPN Client Device Driver for Windows 2000 and Greater -; -; Copyright (c) SoftEther Corporation. All Rights Reserved. -; http://www.softether.co.jp/ -; -; BUILD 9658 - -[Version] -Signature = "$Windows NT$" -Class = Net -ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} -Provider = %CompanyName% -DriverVer = 02/04/2018, 4.25.0.9658 -CatalogFile.NT = inf_VPN20.cat - -[Manufacturer] -%CompanyName% = SoftEther - -[SourceDisksNames] -1=%DiskDescription%, "", , - -[SourceDisksFiles] -Neo_VPN20.sys = 1 - -[DestinationDirs] -DefaultDestDir = 12 -Neo.CopyFiles.Sys = 12 - -[Neo.CopyFiles.Sys] -Neo_VPN20.sys, , , 2 - -[SoftEther] -%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN20 - -[NeoAdapter.Install] -Characteristics = 0x1 -AddReg = Neo.Reg, NeoAdapter.Ndi -CopyFiles = Neo.CopyFiles.Sys -*IfType = 53 -*MediaType = 0 -*PhysicalMediaType = 0 - -[NeoAdapter.Install.Services] -AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% - -[NeoAdapter.Ndi] -HKR, , NetworkAddress, 0, %DefaultAddress% -HKR, Ndi, DeviceID, , "NeoAdapter_VPN20" -HKR, , DevLoader, , ndis -HKR, , DeviceVxDs, , Neo_VPN20.sys -HKR, NDIS, LogDriverName, , "Neo_VPN20" -HKR, NDIS, MajorNdisVersion, 1, 5 -HKR, NDIS, MinorNdisVersion, 1, 0 -HKR, Ndi\Interfaces, DefUpper, , "ndis5" -HKR, Ndi\Interfaces, UpperRange, , "ndis5" -HKR, Ndi\Interfaces, LowerRange, , "ethernet" -HKR, Ndi\Interfaces, DefLower, , "ethernet" -HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" -HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% -HKR, Ndi\Params\NetworkAddress, type, 0, "edit" -HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" -HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" -HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% -HKR, Ndi\Params\NetworkAddress, optional, 0, "0" -HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% -HKR, Ndi\Params\MaxSpeed, type, 0, "int" -HKR, Ndi\Params\MaxSpeed, default, 0, "100" -HKR, Ndi\Params\MaxSpeed, min, 0, "0" -HKR, Ndi\Params\MaxSpeed, max, 0, "2000" -HKR, Ndi\Params\MaxSpeed, step, 0, "1" -HKR, Ndi\Params\MaxSpeed, Base, 0, "10" -HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% -HKR, Ndi\Params\KeepLink, type, 0, "enum" -HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% -HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% -HKR, Ndi\Params\KeepLink, default, 0, "0" - - -[Neo.Service] -DisplayName = %Neo.Service.DispName% -Description = %Neo.Service.Desc% -ServiceType = 1 -StartType = 3 -ErrorControl = 1 -ServiceBinary = %12%\Neo_VPN20.sys -LoadOrderGroup = NDIS - -[Neo.Reg] -HKR, Ndi, Service, 0, Neo.Service.Name -HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" -HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" - -[Neo.EventLog] -HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN20.sys" -HKR, , TypesSupported, 0x00010001, 7 - -[Strings] -CompanyName = "SoftEther Corporation" -DiskDescription = "VPN Client Device Driver Install Disk" -Neo.Service.Name = "Neo_VPN20" -Neo.Service.DispName = "VPN Client Device Driver - VPN20" -Neo.Service.Desc = "VPN Client Adapter - VPN20" -NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN20" -Neo.EventLog.Name = "Neo" -NetworkAddress = "MAC Address" -DefaultAddress = "000001000001" -MaxSpeed = "Indicate Speed (Mbps)" -KeepLink = "Keep Link" -On = "On" -Off = "Off" - - -; Auto Generated 20180205_163608.765 - +; VPN Client Device Driver for Windows 2000 and Greater +; +; Copyright (c) SoftEther Corporation. All Rights Reserved. +; http://www.softether.co.jp/ +; +; BUILD 9658 + +[Version] +Signature = "$Windows NT$" +Class = Net +ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} +Provider = %CompanyName% +DriverVer = 02/04/2018, 4.25.0.9658 +CatalogFile.NT = inf_VPN20.cat + +[Manufacturer] +%CompanyName% = SoftEther + +[SourceDisksNames] +1=%DiskDescription%, "", , + +[SourceDisksFiles] +Neo_VPN20.sys = 1 + +[DestinationDirs] +DefaultDestDir = 12 +Neo.CopyFiles.Sys = 12 + +[Neo.CopyFiles.Sys] +Neo_VPN20.sys, , , 2 + +[SoftEther] +%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN20 + +[NeoAdapter.Install] +Characteristics = 0x1 +AddReg = Neo.Reg, NeoAdapter.Ndi +CopyFiles = Neo.CopyFiles.Sys +*IfType = 53 +*MediaType = 0 +*PhysicalMediaType = 0 + +[NeoAdapter.Install.Services] +AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% + +[NeoAdapter.Ndi] +HKR, , NetworkAddress, 0, %DefaultAddress% +HKR, Ndi, DeviceID, , "NeoAdapter_VPN20" +HKR, , DevLoader, , ndis +HKR, , DeviceVxDs, , Neo_VPN20.sys +HKR, NDIS, LogDriverName, , "Neo_VPN20" +HKR, NDIS, MajorNdisVersion, 1, 5 +HKR, NDIS, MinorNdisVersion, 1, 0 +HKR, Ndi\Interfaces, DefUpper, , "ndis5" +HKR, Ndi\Interfaces, UpperRange, , "ndis5" +HKR, Ndi\Interfaces, LowerRange, , "ethernet" +HKR, Ndi\Interfaces, DefLower, , "ethernet" +HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" +HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% +HKR, Ndi\Params\NetworkAddress, type, 0, "edit" +HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" +HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" +HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% +HKR, Ndi\Params\NetworkAddress, optional, 0, "0" +HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% +HKR, Ndi\Params\MaxSpeed, type, 0, "int" +HKR, Ndi\Params\MaxSpeed, default, 0, "100" +HKR, Ndi\Params\MaxSpeed, min, 0, "0" +HKR, Ndi\Params\MaxSpeed, max, 0, "2000" +HKR, Ndi\Params\MaxSpeed, step, 0, "1" +HKR, Ndi\Params\MaxSpeed, Base, 0, "10" +HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% +HKR, Ndi\Params\KeepLink, type, 0, "enum" +HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% +HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% +HKR, Ndi\Params\KeepLink, default, 0, "0" + + +[Neo.Service] +DisplayName = %Neo.Service.DispName% +Description = %Neo.Service.Desc% +ServiceType = 1 +StartType = 3 +ErrorControl = 1 +ServiceBinary = %12%\Neo_VPN20.sys +LoadOrderGroup = NDIS + +[Neo.Reg] +HKR, Ndi, Service, 0, Neo.Service.Name +HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" +HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" + +[Neo.EventLog] +HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN20.sys" +HKR, , TypesSupported, 0x00010001, 7 + +[Strings] +CompanyName = "SoftEther Corporation" +DiskDescription = "VPN Client Device Driver Install Disk" +Neo.Service.Name = "Neo_VPN20" +Neo.Service.DispName = "VPN Client Device Driver - VPN20" +Neo.Service.Desc = "VPN Client Adapter - VPN20" +NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN20" +Neo.EventLog.Name = "Neo" +NetworkAddress = "MAC Address" +DefaultAddress = "000001000001" +MaxSpeed = "Indicate Speed (Mbps)" +KeepLink = "Keep Link" +On = "On" +Off = "Off" + + +; Auto Generated 20180205_163608.765 + diff --git a/src/bin/hamcore/DriverPackages/Neo6_Win8/x86/Neo6_x86_VPN21.inf b/src/bin/hamcore/DriverPackages/Neo6_Win8/x86/Neo6_x86_VPN21.inf index 94ec2df8..4bb01676 100644 --- a/src/bin/hamcore/DriverPackages/Neo6_Win8/x86/Neo6_x86_VPN21.inf +++ b/src/bin/hamcore/DriverPackages/Neo6_Win8/x86/Neo6_x86_VPN21.inf @@ -1,114 +1,114 @@ -; VPN Client Device Driver for Windows 2000 and Greater -; -; Copyright (c) SoftEther Corporation. All Rights Reserved. -; http://www.softether.co.jp/ -; -; BUILD 9658 - -[Version] -Signature = "$Windows NT$" -Class = Net -ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} -Provider = %CompanyName% -DriverVer = 02/04/2018, 4.25.0.9658 -CatalogFile.NT = inf_VPN21.cat - -[Manufacturer] -%CompanyName% = SoftEther - -[SourceDisksNames] -1=%DiskDescription%, "", , - -[SourceDisksFiles] -Neo_VPN21.sys = 1 - -[DestinationDirs] -DefaultDestDir = 12 -Neo.CopyFiles.Sys = 12 - -[Neo.CopyFiles.Sys] -Neo_VPN21.sys, , , 2 - -[SoftEther] -%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN21 - -[NeoAdapter.Install] -Characteristics = 0x1 -AddReg = Neo.Reg, NeoAdapter.Ndi -CopyFiles = Neo.CopyFiles.Sys -*IfType = 53 -*MediaType = 0 -*PhysicalMediaType = 0 - -[NeoAdapter.Install.Services] -AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% - -[NeoAdapter.Ndi] -HKR, , NetworkAddress, 0, %DefaultAddress% -HKR, Ndi, DeviceID, , "NeoAdapter_VPN21" -HKR, , DevLoader, , ndis -HKR, , DeviceVxDs, , Neo_VPN21.sys -HKR, NDIS, LogDriverName, , "Neo_VPN21" -HKR, NDIS, MajorNdisVersion, 1, 5 -HKR, NDIS, MinorNdisVersion, 1, 0 -HKR, Ndi\Interfaces, DefUpper, , "ndis5" -HKR, Ndi\Interfaces, UpperRange, , "ndis5" -HKR, Ndi\Interfaces, LowerRange, , "ethernet" -HKR, Ndi\Interfaces, DefLower, , "ethernet" -HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" -HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% -HKR, Ndi\Params\NetworkAddress, type, 0, "edit" -HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" -HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" -HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% -HKR, Ndi\Params\NetworkAddress, optional, 0, "0" -HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% -HKR, Ndi\Params\MaxSpeed, type, 0, "int" -HKR, Ndi\Params\MaxSpeed, default, 0, "100" -HKR, Ndi\Params\MaxSpeed, min, 0, "0" -HKR, Ndi\Params\MaxSpeed, max, 0, "2000" -HKR, Ndi\Params\MaxSpeed, step, 0, "1" -HKR, Ndi\Params\MaxSpeed, Base, 0, "10" -HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% -HKR, Ndi\Params\KeepLink, type, 0, "enum" -HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% -HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% -HKR, Ndi\Params\KeepLink, default, 0, "0" - - -[Neo.Service] -DisplayName = %Neo.Service.DispName% -Description = %Neo.Service.Desc% -ServiceType = 1 -StartType = 3 -ErrorControl = 1 -ServiceBinary = %12%\Neo_VPN21.sys -LoadOrderGroup = NDIS - -[Neo.Reg] -HKR, Ndi, Service, 0, Neo.Service.Name -HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" -HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" - -[Neo.EventLog] -HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN21.sys" -HKR, , TypesSupported, 0x00010001, 7 - -[Strings] -CompanyName = "SoftEther Corporation" -DiskDescription = "VPN Client Device Driver Install Disk" -Neo.Service.Name = "Neo_VPN21" -Neo.Service.DispName = "VPN Client Device Driver - VPN21" -Neo.Service.Desc = "VPN Client Adapter - VPN21" -NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN21" -Neo.EventLog.Name = "Neo" -NetworkAddress = "MAC Address" -DefaultAddress = "000001000001" -MaxSpeed = "Indicate Speed (Mbps)" -KeepLink = "Keep Link" -On = "On" -Off = "Off" - - -; Auto Generated 20180205_163608.766 - +; VPN Client Device Driver for Windows 2000 and Greater +; +; Copyright (c) SoftEther Corporation. All Rights Reserved. +; http://www.softether.co.jp/ +; +; BUILD 9658 + +[Version] +Signature = "$Windows NT$" +Class = Net +ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} +Provider = %CompanyName% +DriverVer = 02/04/2018, 4.25.0.9658 +CatalogFile.NT = inf_VPN21.cat + +[Manufacturer] +%CompanyName% = SoftEther + +[SourceDisksNames] +1=%DiskDescription%, "", , + +[SourceDisksFiles] +Neo_VPN21.sys = 1 + +[DestinationDirs] +DefaultDestDir = 12 +Neo.CopyFiles.Sys = 12 + +[Neo.CopyFiles.Sys] +Neo_VPN21.sys, , , 2 + +[SoftEther] +%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN21 + +[NeoAdapter.Install] +Characteristics = 0x1 +AddReg = Neo.Reg, NeoAdapter.Ndi +CopyFiles = Neo.CopyFiles.Sys +*IfType = 53 +*MediaType = 0 +*PhysicalMediaType = 0 + +[NeoAdapter.Install.Services] +AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% + +[NeoAdapter.Ndi] +HKR, , NetworkAddress, 0, %DefaultAddress% +HKR, Ndi, DeviceID, , "NeoAdapter_VPN21" +HKR, , DevLoader, , ndis +HKR, , DeviceVxDs, , Neo_VPN21.sys +HKR, NDIS, LogDriverName, , "Neo_VPN21" +HKR, NDIS, MajorNdisVersion, 1, 5 +HKR, NDIS, MinorNdisVersion, 1, 0 +HKR, Ndi\Interfaces, DefUpper, , "ndis5" +HKR, Ndi\Interfaces, UpperRange, , "ndis5" +HKR, Ndi\Interfaces, LowerRange, , "ethernet" +HKR, Ndi\Interfaces, DefLower, , "ethernet" +HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" +HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% +HKR, Ndi\Params\NetworkAddress, type, 0, "edit" +HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" +HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" +HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% +HKR, Ndi\Params\NetworkAddress, optional, 0, "0" +HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% +HKR, Ndi\Params\MaxSpeed, type, 0, "int" +HKR, Ndi\Params\MaxSpeed, default, 0, "100" +HKR, Ndi\Params\MaxSpeed, min, 0, "0" +HKR, Ndi\Params\MaxSpeed, max, 0, "2000" +HKR, Ndi\Params\MaxSpeed, step, 0, "1" +HKR, Ndi\Params\MaxSpeed, Base, 0, "10" +HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% +HKR, Ndi\Params\KeepLink, type, 0, "enum" +HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% +HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% +HKR, Ndi\Params\KeepLink, default, 0, "0" + + +[Neo.Service] +DisplayName = %Neo.Service.DispName% +Description = %Neo.Service.Desc% +ServiceType = 1 +StartType = 3 +ErrorControl = 1 +ServiceBinary = %12%\Neo_VPN21.sys +LoadOrderGroup = NDIS + +[Neo.Reg] +HKR, Ndi, Service, 0, Neo.Service.Name +HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" +HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" + +[Neo.EventLog] +HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN21.sys" +HKR, , TypesSupported, 0x00010001, 7 + +[Strings] +CompanyName = "SoftEther Corporation" +DiskDescription = "VPN Client Device Driver Install Disk" +Neo.Service.Name = "Neo_VPN21" +Neo.Service.DispName = "VPN Client Device Driver - VPN21" +Neo.Service.Desc = "VPN Client Adapter - VPN21" +NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN21" +Neo.EventLog.Name = "Neo" +NetworkAddress = "MAC Address" +DefaultAddress = "000001000001" +MaxSpeed = "Indicate Speed (Mbps)" +KeepLink = "Keep Link" +On = "On" +Off = "Off" + + +; Auto Generated 20180205_163608.766 + diff --git a/src/bin/hamcore/DriverPackages/Neo6_Win8/x86/Neo6_x86_VPN22.inf b/src/bin/hamcore/DriverPackages/Neo6_Win8/x86/Neo6_x86_VPN22.inf index d1bff2bd..e49e9583 100644 --- a/src/bin/hamcore/DriverPackages/Neo6_Win8/x86/Neo6_x86_VPN22.inf +++ b/src/bin/hamcore/DriverPackages/Neo6_Win8/x86/Neo6_x86_VPN22.inf @@ -1,114 +1,114 @@ -; VPN Client Device Driver for Windows 2000 and Greater -; -; Copyright (c) SoftEther Corporation. All Rights Reserved. -; http://www.softether.co.jp/ -; -; BUILD 9658 - -[Version] -Signature = "$Windows NT$" -Class = Net -ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} -Provider = %CompanyName% -DriverVer = 02/04/2018, 4.25.0.9658 -CatalogFile.NT = inf_VPN22.cat - -[Manufacturer] -%CompanyName% = SoftEther - -[SourceDisksNames] -1=%DiskDescription%, "", , - -[SourceDisksFiles] -Neo_VPN22.sys = 1 - -[DestinationDirs] -DefaultDestDir = 12 -Neo.CopyFiles.Sys = 12 - -[Neo.CopyFiles.Sys] -Neo_VPN22.sys, , , 2 - -[SoftEther] -%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN22 - -[NeoAdapter.Install] -Characteristics = 0x1 -AddReg = Neo.Reg, NeoAdapter.Ndi -CopyFiles = Neo.CopyFiles.Sys -*IfType = 53 -*MediaType = 0 -*PhysicalMediaType = 0 - -[NeoAdapter.Install.Services] -AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% - -[NeoAdapter.Ndi] -HKR, , NetworkAddress, 0, %DefaultAddress% -HKR, Ndi, DeviceID, , "NeoAdapter_VPN22" -HKR, , DevLoader, , ndis -HKR, , DeviceVxDs, , Neo_VPN22.sys -HKR, NDIS, LogDriverName, , "Neo_VPN22" -HKR, NDIS, MajorNdisVersion, 1, 5 -HKR, NDIS, MinorNdisVersion, 1, 0 -HKR, Ndi\Interfaces, DefUpper, , "ndis5" -HKR, Ndi\Interfaces, UpperRange, , "ndis5" -HKR, Ndi\Interfaces, LowerRange, , "ethernet" -HKR, Ndi\Interfaces, DefLower, , "ethernet" -HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" -HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% -HKR, Ndi\Params\NetworkAddress, type, 0, "edit" -HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" -HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" -HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% -HKR, Ndi\Params\NetworkAddress, optional, 0, "0" -HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% -HKR, Ndi\Params\MaxSpeed, type, 0, "int" -HKR, Ndi\Params\MaxSpeed, default, 0, "100" -HKR, Ndi\Params\MaxSpeed, min, 0, "0" -HKR, Ndi\Params\MaxSpeed, max, 0, "2000" -HKR, Ndi\Params\MaxSpeed, step, 0, "1" -HKR, Ndi\Params\MaxSpeed, Base, 0, "10" -HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% -HKR, Ndi\Params\KeepLink, type, 0, "enum" -HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% -HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% -HKR, Ndi\Params\KeepLink, default, 0, "0" - - -[Neo.Service] -DisplayName = %Neo.Service.DispName% -Description = %Neo.Service.Desc% -ServiceType = 1 -StartType = 3 -ErrorControl = 1 -ServiceBinary = %12%\Neo_VPN22.sys -LoadOrderGroup = NDIS - -[Neo.Reg] -HKR, Ndi, Service, 0, Neo.Service.Name -HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" -HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" - -[Neo.EventLog] -HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN22.sys" -HKR, , TypesSupported, 0x00010001, 7 - -[Strings] -CompanyName = "SoftEther Corporation" -DiskDescription = "VPN Client Device Driver Install Disk" -Neo.Service.Name = "Neo_VPN22" -Neo.Service.DispName = "VPN Client Device Driver - VPN22" -Neo.Service.Desc = "VPN Client Adapter - VPN22" -NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN22" -Neo.EventLog.Name = "Neo" -NetworkAddress = "MAC Address" -DefaultAddress = "000001000001" -MaxSpeed = "Indicate Speed (Mbps)" -KeepLink = "Keep Link" -On = "On" -Off = "Off" - - -; Auto Generated 20180205_163608.766 - +; VPN Client Device Driver for Windows 2000 and Greater +; +; Copyright (c) SoftEther Corporation. All Rights Reserved. +; http://www.softether.co.jp/ +; +; BUILD 9658 + +[Version] +Signature = "$Windows NT$" +Class = Net +ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} +Provider = %CompanyName% +DriverVer = 02/04/2018, 4.25.0.9658 +CatalogFile.NT = inf_VPN22.cat + +[Manufacturer] +%CompanyName% = SoftEther + +[SourceDisksNames] +1=%DiskDescription%, "", , + +[SourceDisksFiles] +Neo_VPN22.sys = 1 + +[DestinationDirs] +DefaultDestDir = 12 +Neo.CopyFiles.Sys = 12 + +[Neo.CopyFiles.Sys] +Neo_VPN22.sys, , , 2 + +[SoftEther] +%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN22 + +[NeoAdapter.Install] +Characteristics = 0x1 +AddReg = Neo.Reg, NeoAdapter.Ndi +CopyFiles = Neo.CopyFiles.Sys +*IfType = 53 +*MediaType = 0 +*PhysicalMediaType = 0 + +[NeoAdapter.Install.Services] +AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% + +[NeoAdapter.Ndi] +HKR, , NetworkAddress, 0, %DefaultAddress% +HKR, Ndi, DeviceID, , "NeoAdapter_VPN22" +HKR, , DevLoader, , ndis +HKR, , DeviceVxDs, , Neo_VPN22.sys +HKR, NDIS, LogDriverName, , "Neo_VPN22" +HKR, NDIS, MajorNdisVersion, 1, 5 +HKR, NDIS, MinorNdisVersion, 1, 0 +HKR, Ndi\Interfaces, DefUpper, , "ndis5" +HKR, Ndi\Interfaces, UpperRange, , "ndis5" +HKR, Ndi\Interfaces, LowerRange, , "ethernet" +HKR, Ndi\Interfaces, DefLower, , "ethernet" +HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" +HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% +HKR, Ndi\Params\NetworkAddress, type, 0, "edit" +HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" +HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" +HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% +HKR, Ndi\Params\NetworkAddress, optional, 0, "0" +HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% +HKR, Ndi\Params\MaxSpeed, type, 0, "int" +HKR, Ndi\Params\MaxSpeed, default, 0, "100" +HKR, Ndi\Params\MaxSpeed, min, 0, "0" +HKR, Ndi\Params\MaxSpeed, max, 0, "2000" +HKR, Ndi\Params\MaxSpeed, step, 0, "1" +HKR, Ndi\Params\MaxSpeed, Base, 0, "10" +HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% +HKR, Ndi\Params\KeepLink, type, 0, "enum" +HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% +HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% +HKR, Ndi\Params\KeepLink, default, 0, "0" + + +[Neo.Service] +DisplayName = %Neo.Service.DispName% +Description = %Neo.Service.Desc% +ServiceType = 1 +StartType = 3 +ErrorControl = 1 +ServiceBinary = %12%\Neo_VPN22.sys +LoadOrderGroup = NDIS + +[Neo.Reg] +HKR, Ndi, Service, 0, Neo.Service.Name +HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" +HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" + +[Neo.EventLog] +HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN22.sys" +HKR, , TypesSupported, 0x00010001, 7 + +[Strings] +CompanyName = "SoftEther Corporation" +DiskDescription = "VPN Client Device Driver Install Disk" +Neo.Service.Name = "Neo_VPN22" +Neo.Service.DispName = "VPN Client Device Driver - VPN22" +Neo.Service.Desc = "VPN Client Adapter - VPN22" +NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN22" +Neo.EventLog.Name = "Neo" +NetworkAddress = "MAC Address" +DefaultAddress = "000001000001" +MaxSpeed = "Indicate Speed (Mbps)" +KeepLink = "Keep Link" +On = "On" +Off = "Off" + + +; Auto Generated 20180205_163608.766 + diff --git a/src/bin/hamcore/DriverPackages/Neo6_Win8/x86/Neo6_x86_VPN23.inf b/src/bin/hamcore/DriverPackages/Neo6_Win8/x86/Neo6_x86_VPN23.inf index c5ef2210..b0ceb09d 100644 --- a/src/bin/hamcore/DriverPackages/Neo6_Win8/x86/Neo6_x86_VPN23.inf +++ b/src/bin/hamcore/DriverPackages/Neo6_Win8/x86/Neo6_x86_VPN23.inf @@ -1,114 +1,114 @@ -; VPN Client Device Driver for Windows 2000 and Greater -; -; Copyright (c) SoftEther Corporation. All Rights Reserved. -; http://www.softether.co.jp/ -; -; BUILD 9658 - -[Version] -Signature = "$Windows NT$" -Class = Net -ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} -Provider = %CompanyName% -DriverVer = 02/04/2018, 4.25.0.9658 -CatalogFile.NT = inf_VPN23.cat - -[Manufacturer] -%CompanyName% = SoftEther - -[SourceDisksNames] -1=%DiskDescription%, "", , - -[SourceDisksFiles] -Neo_VPN23.sys = 1 - -[DestinationDirs] -DefaultDestDir = 12 -Neo.CopyFiles.Sys = 12 - -[Neo.CopyFiles.Sys] -Neo_VPN23.sys, , , 2 - -[SoftEther] -%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN23 - -[NeoAdapter.Install] -Characteristics = 0x1 -AddReg = Neo.Reg, NeoAdapter.Ndi -CopyFiles = Neo.CopyFiles.Sys -*IfType = 53 -*MediaType = 0 -*PhysicalMediaType = 0 - -[NeoAdapter.Install.Services] -AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% - -[NeoAdapter.Ndi] -HKR, , NetworkAddress, 0, %DefaultAddress% -HKR, Ndi, DeviceID, , "NeoAdapter_VPN23" -HKR, , DevLoader, , ndis -HKR, , DeviceVxDs, , Neo_VPN23.sys -HKR, NDIS, LogDriverName, , "Neo_VPN23" -HKR, NDIS, MajorNdisVersion, 1, 5 -HKR, NDIS, MinorNdisVersion, 1, 0 -HKR, Ndi\Interfaces, DefUpper, , "ndis5" -HKR, Ndi\Interfaces, UpperRange, , "ndis5" -HKR, Ndi\Interfaces, LowerRange, , "ethernet" -HKR, Ndi\Interfaces, DefLower, , "ethernet" -HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" -HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% -HKR, Ndi\Params\NetworkAddress, type, 0, "edit" -HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" -HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" -HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% -HKR, Ndi\Params\NetworkAddress, optional, 0, "0" -HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% -HKR, Ndi\Params\MaxSpeed, type, 0, "int" -HKR, Ndi\Params\MaxSpeed, default, 0, "100" -HKR, Ndi\Params\MaxSpeed, min, 0, "0" -HKR, Ndi\Params\MaxSpeed, max, 0, "2000" -HKR, Ndi\Params\MaxSpeed, step, 0, "1" -HKR, Ndi\Params\MaxSpeed, Base, 0, "10" -HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% -HKR, Ndi\Params\KeepLink, type, 0, "enum" -HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% -HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% -HKR, Ndi\Params\KeepLink, default, 0, "0" - - -[Neo.Service] -DisplayName = %Neo.Service.DispName% -Description = %Neo.Service.Desc% -ServiceType = 1 -StartType = 3 -ErrorControl = 1 -ServiceBinary = %12%\Neo_VPN23.sys -LoadOrderGroup = NDIS - -[Neo.Reg] -HKR, Ndi, Service, 0, Neo.Service.Name -HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" -HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" - -[Neo.EventLog] -HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN23.sys" -HKR, , TypesSupported, 0x00010001, 7 - -[Strings] -CompanyName = "SoftEther Corporation" -DiskDescription = "VPN Client Device Driver Install Disk" -Neo.Service.Name = "Neo_VPN23" -Neo.Service.DispName = "VPN Client Device Driver - VPN23" -Neo.Service.Desc = "VPN Client Adapter - VPN23" -NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN23" -Neo.EventLog.Name = "Neo" -NetworkAddress = "MAC Address" -DefaultAddress = "000001000001" -MaxSpeed = "Indicate Speed (Mbps)" -KeepLink = "Keep Link" -On = "On" -Off = "Off" - - -; Auto Generated 20180205_163608.767 - +; VPN Client Device Driver for Windows 2000 and Greater +; +; Copyright (c) SoftEther Corporation. All Rights Reserved. +; http://www.softether.co.jp/ +; +; BUILD 9658 + +[Version] +Signature = "$Windows NT$" +Class = Net +ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} +Provider = %CompanyName% +DriverVer = 02/04/2018, 4.25.0.9658 +CatalogFile.NT = inf_VPN23.cat + +[Manufacturer] +%CompanyName% = SoftEther + +[SourceDisksNames] +1=%DiskDescription%, "", , + +[SourceDisksFiles] +Neo_VPN23.sys = 1 + +[DestinationDirs] +DefaultDestDir = 12 +Neo.CopyFiles.Sys = 12 + +[Neo.CopyFiles.Sys] +Neo_VPN23.sys, , , 2 + +[SoftEther] +%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN23 + +[NeoAdapter.Install] +Characteristics = 0x1 +AddReg = Neo.Reg, NeoAdapter.Ndi +CopyFiles = Neo.CopyFiles.Sys +*IfType = 53 +*MediaType = 0 +*PhysicalMediaType = 0 + +[NeoAdapter.Install.Services] +AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% + +[NeoAdapter.Ndi] +HKR, , NetworkAddress, 0, %DefaultAddress% +HKR, Ndi, DeviceID, , "NeoAdapter_VPN23" +HKR, , DevLoader, , ndis +HKR, , DeviceVxDs, , Neo_VPN23.sys +HKR, NDIS, LogDriverName, , "Neo_VPN23" +HKR, NDIS, MajorNdisVersion, 1, 5 +HKR, NDIS, MinorNdisVersion, 1, 0 +HKR, Ndi\Interfaces, DefUpper, , "ndis5" +HKR, Ndi\Interfaces, UpperRange, , "ndis5" +HKR, Ndi\Interfaces, LowerRange, , "ethernet" +HKR, Ndi\Interfaces, DefLower, , "ethernet" +HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" +HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% +HKR, Ndi\Params\NetworkAddress, type, 0, "edit" +HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" +HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" +HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% +HKR, Ndi\Params\NetworkAddress, optional, 0, "0" +HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% +HKR, Ndi\Params\MaxSpeed, type, 0, "int" +HKR, Ndi\Params\MaxSpeed, default, 0, "100" +HKR, Ndi\Params\MaxSpeed, min, 0, "0" +HKR, Ndi\Params\MaxSpeed, max, 0, "2000" +HKR, Ndi\Params\MaxSpeed, step, 0, "1" +HKR, Ndi\Params\MaxSpeed, Base, 0, "10" +HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% +HKR, Ndi\Params\KeepLink, type, 0, "enum" +HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% +HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% +HKR, Ndi\Params\KeepLink, default, 0, "0" + + +[Neo.Service] +DisplayName = %Neo.Service.DispName% +Description = %Neo.Service.Desc% +ServiceType = 1 +StartType = 3 +ErrorControl = 1 +ServiceBinary = %12%\Neo_VPN23.sys +LoadOrderGroup = NDIS + +[Neo.Reg] +HKR, Ndi, Service, 0, Neo.Service.Name +HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" +HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" + +[Neo.EventLog] +HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN23.sys" +HKR, , TypesSupported, 0x00010001, 7 + +[Strings] +CompanyName = "SoftEther Corporation" +DiskDescription = "VPN Client Device Driver Install Disk" +Neo.Service.Name = "Neo_VPN23" +Neo.Service.DispName = "VPN Client Device Driver - VPN23" +Neo.Service.Desc = "VPN Client Adapter - VPN23" +NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN23" +Neo.EventLog.Name = "Neo" +NetworkAddress = "MAC Address" +DefaultAddress = "000001000001" +MaxSpeed = "Indicate Speed (Mbps)" +KeepLink = "Keep Link" +On = "On" +Off = "Off" + + +; Auto Generated 20180205_163608.767 + diff --git a/src/bin/hamcore/DriverPackages/Neo6_Win8/x86/Neo6_x86_VPN24.inf b/src/bin/hamcore/DriverPackages/Neo6_Win8/x86/Neo6_x86_VPN24.inf index af89dc66..2f3a30ec 100644 --- a/src/bin/hamcore/DriverPackages/Neo6_Win8/x86/Neo6_x86_VPN24.inf +++ b/src/bin/hamcore/DriverPackages/Neo6_Win8/x86/Neo6_x86_VPN24.inf @@ -1,114 +1,114 @@ -; VPN Client Device Driver for Windows 2000 and Greater -; -; Copyright (c) SoftEther Corporation. All Rights Reserved. -; http://www.softether.co.jp/ -; -; BUILD 9658 - -[Version] -Signature = "$Windows NT$" -Class = Net -ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} -Provider = %CompanyName% -DriverVer = 02/04/2018, 4.25.0.9658 -CatalogFile.NT = inf_VPN24.cat - -[Manufacturer] -%CompanyName% = SoftEther - -[SourceDisksNames] -1=%DiskDescription%, "", , - -[SourceDisksFiles] -Neo_VPN24.sys = 1 - -[DestinationDirs] -DefaultDestDir = 12 -Neo.CopyFiles.Sys = 12 - -[Neo.CopyFiles.Sys] -Neo_VPN24.sys, , , 2 - -[SoftEther] -%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN24 - -[NeoAdapter.Install] -Characteristics = 0x1 -AddReg = Neo.Reg, NeoAdapter.Ndi -CopyFiles = Neo.CopyFiles.Sys -*IfType = 53 -*MediaType = 0 -*PhysicalMediaType = 0 - -[NeoAdapter.Install.Services] -AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% - -[NeoAdapter.Ndi] -HKR, , NetworkAddress, 0, %DefaultAddress% -HKR, Ndi, DeviceID, , "NeoAdapter_VPN24" -HKR, , DevLoader, , ndis -HKR, , DeviceVxDs, , Neo_VPN24.sys -HKR, NDIS, LogDriverName, , "Neo_VPN24" -HKR, NDIS, MajorNdisVersion, 1, 5 -HKR, NDIS, MinorNdisVersion, 1, 0 -HKR, Ndi\Interfaces, DefUpper, , "ndis5" -HKR, Ndi\Interfaces, UpperRange, , "ndis5" -HKR, Ndi\Interfaces, LowerRange, , "ethernet" -HKR, Ndi\Interfaces, DefLower, , "ethernet" -HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" -HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% -HKR, Ndi\Params\NetworkAddress, type, 0, "edit" -HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" -HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" -HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% -HKR, Ndi\Params\NetworkAddress, optional, 0, "0" -HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% -HKR, Ndi\Params\MaxSpeed, type, 0, "int" -HKR, Ndi\Params\MaxSpeed, default, 0, "100" -HKR, Ndi\Params\MaxSpeed, min, 0, "0" -HKR, Ndi\Params\MaxSpeed, max, 0, "2000" -HKR, Ndi\Params\MaxSpeed, step, 0, "1" -HKR, Ndi\Params\MaxSpeed, Base, 0, "10" -HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% -HKR, Ndi\Params\KeepLink, type, 0, "enum" -HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% -HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% -HKR, Ndi\Params\KeepLink, default, 0, "0" - - -[Neo.Service] -DisplayName = %Neo.Service.DispName% -Description = %Neo.Service.Desc% -ServiceType = 1 -StartType = 3 -ErrorControl = 1 -ServiceBinary = %12%\Neo_VPN24.sys -LoadOrderGroup = NDIS - -[Neo.Reg] -HKR, Ndi, Service, 0, Neo.Service.Name -HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" -HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" - -[Neo.EventLog] -HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN24.sys" -HKR, , TypesSupported, 0x00010001, 7 - -[Strings] -CompanyName = "SoftEther Corporation" -DiskDescription = "VPN Client Device Driver Install Disk" -Neo.Service.Name = "Neo_VPN24" -Neo.Service.DispName = "VPN Client Device Driver - VPN24" -Neo.Service.Desc = "VPN Client Adapter - VPN24" -NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN24" -Neo.EventLog.Name = "Neo" -NetworkAddress = "MAC Address" -DefaultAddress = "000001000001" -MaxSpeed = "Indicate Speed (Mbps)" -KeepLink = "Keep Link" -On = "On" -Off = "Off" - - -; Auto Generated 20180205_163608.768 - +; VPN Client Device Driver for Windows 2000 and Greater +; +; Copyright (c) SoftEther Corporation. All Rights Reserved. +; http://www.softether.co.jp/ +; +; BUILD 9658 + +[Version] +Signature = "$Windows NT$" +Class = Net +ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} +Provider = %CompanyName% +DriverVer = 02/04/2018, 4.25.0.9658 +CatalogFile.NT = inf_VPN24.cat + +[Manufacturer] +%CompanyName% = SoftEther + +[SourceDisksNames] +1=%DiskDescription%, "", , + +[SourceDisksFiles] +Neo_VPN24.sys = 1 + +[DestinationDirs] +DefaultDestDir = 12 +Neo.CopyFiles.Sys = 12 + +[Neo.CopyFiles.Sys] +Neo_VPN24.sys, , , 2 + +[SoftEther] +%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN24 + +[NeoAdapter.Install] +Characteristics = 0x1 +AddReg = Neo.Reg, NeoAdapter.Ndi +CopyFiles = Neo.CopyFiles.Sys +*IfType = 53 +*MediaType = 0 +*PhysicalMediaType = 0 + +[NeoAdapter.Install.Services] +AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% + +[NeoAdapter.Ndi] +HKR, , NetworkAddress, 0, %DefaultAddress% +HKR, Ndi, DeviceID, , "NeoAdapter_VPN24" +HKR, , DevLoader, , ndis +HKR, , DeviceVxDs, , Neo_VPN24.sys +HKR, NDIS, LogDriverName, , "Neo_VPN24" +HKR, NDIS, MajorNdisVersion, 1, 5 +HKR, NDIS, MinorNdisVersion, 1, 0 +HKR, Ndi\Interfaces, DefUpper, , "ndis5" +HKR, Ndi\Interfaces, UpperRange, , "ndis5" +HKR, Ndi\Interfaces, LowerRange, , "ethernet" +HKR, Ndi\Interfaces, DefLower, , "ethernet" +HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" +HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% +HKR, Ndi\Params\NetworkAddress, type, 0, "edit" +HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" +HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" +HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% +HKR, Ndi\Params\NetworkAddress, optional, 0, "0" +HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% +HKR, Ndi\Params\MaxSpeed, type, 0, "int" +HKR, Ndi\Params\MaxSpeed, default, 0, "100" +HKR, Ndi\Params\MaxSpeed, min, 0, "0" +HKR, Ndi\Params\MaxSpeed, max, 0, "2000" +HKR, Ndi\Params\MaxSpeed, step, 0, "1" +HKR, Ndi\Params\MaxSpeed, Base, 0, "10" +HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% +HKR, Ndi\Params\KeepLink, type, 0, "enum" +HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% +HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% +HKR, Ndi\Params\KeepLink, default, 0, "0" + + +[Neo.Service] +DisplayName = %Neo.Service.DispName% +Description = %Neo.Service.Desc% +ServiceType = 1 +StartType = 3 +ErrorControl = 1 +ServiceBinary = %12%\Neo_VPN24.sys +LoadOrderGroup = NDIS + +[Neo.Reg] +HKR, Ndi, Service, 0, Neo.Service.Name +HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" +HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" + +[Neo.EventLog] +HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN24.sys" +HKR, , TypesSupported, 0x00010001, 7 + +[Strings] +CompanyName = "SoftEther Corporation" +DiskDescription = "VPN Client Device Driver Install Disk" +Neo.Service.Name = "Neo_VPN24" +Neo.Service.DispName = "VPN Client Device Driver - VPN24" +Neo.Service.Desc = "VPN Client Adapter - VPN24" +NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN24" +Neo.EventLog.Name = "Neo" +NetworkAddress = "MAC Address" +DefaultAddress = "000001000001" +MaxSpeed = "Indicate Speed (Mbps)" +KeepLink = "Keep Link" +On = "On" +Off = "Off" + + +; Auto Generated 20180205_163608.768 + diff --git a/src/bin/hamcore/DriverPackages/Neo6_Win8/x86/Neo6_x86_VPN25.inf b/src/bin/hamcore/DriverPackages/Neo6_Win8/x86/Neo6_x86_VPN25.inf index 8cc8ad41..7948128c 100644 --- a/src/bin/hamcore/DriverPackages/Neo6_Win8/x86/Neo6_x86_VPN25.inf +++ b/src/bin/hamcore/DriverPackages/Neo6_Win8/x86/Neo6_x86_VPN25.inf @@ -1,114 +1,114 @@ -; VPN Client Device Driver for Windows 2000 and Greater -; -; Copyright (c) SoftEther Corporation. All Rights Reserved. -; http://www.softether.co.jp/ -; -; BUILD 9658 - -[Version] -Signature = "$Windows NT$" -Class = Net -ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} -Provider = %CompanyName% -DriverVer = 02/04/2018, 4.25.0.9658 -CatalogFile.NT = inf_VPN25.cat - -[Manufacturer] -%CompanyName% = SoftEther - -[SourceDisksNames] -1=%DiskDescription%, "", , - -[SourceDisksFiles] -Neo_VPN25.sys = 1 - -[DestinationDirs] -DefaultDestDir = 12 -Neo.CopyFiles.Sys = 12 - -[Neo.CopyFiles.Sys] -Neo_VPN25.sys, , , 2 - -[SoftEther] -%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN25 - -[NeoAdapter.Install] -Characteristics = 0x1 -AddReg = Neo.Reg, NeoAdapter.Ndi -CopyFiles = Neo.CopyFiles.Sys -*IfType = 53 -*MediaType = 0 -*PhysicalMediaType = 0 - -[NeoAdapter.Install.Services] -AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% - -[NeoAdapter.Ndi] -HKR, , NetworkAddress, 0, %DefaultAddress% -HKR, Ndi, DeviceID, , "NeoAdapter_VPN25" -HKR, , DevLoader, , ndis -HKR, , DeviceVxDs, , Neo_VPN25.sys -HKR, NDIS, LogDriverName, , "Neo_VPN25" -HKR, NDIS, MajorNdisVersion, 1, 5 -HKR, NDIS, MinorNdisVersion, 1, 0 -HKR, Ndi\Interfaces, DefUpper, , "ndis5" -HKR, Ndi\Interfaces, UpperRange, , "ndis5" -HKR, Ndi\Interfaces, LowerRange, , "ethernet" -HKR, Ndi\Interfaces, DefLower, , "ethernet" -HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" -HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% -HKR, Ndi\Params\NetworkAddress, type, 0, "edit" -HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" -HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" -HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% -HKR, Ndi\Params\NetworkAddress, optional, 0, "0" -HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% -HKR, Ndi\Params\MaxSpeed, type, 0, "int" -HKR, Ndi\Params\MaxSpeed, default, 0, "100" -HKR, Ndi\Params\MaxSpeed, min, 0, "0" -HKR, Ndi\Params\MaxSpeed, max, 0, "2000" -HKR, Ndi\Params\MaxSpeed, step, 0, "1" -HKR, Ndi\Params\MaxSpeed, Base, 0, "10" -HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% -HKR, Ndi\Params\KeepLink, type, 0, "enum" -HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% -HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% -HKR, Ndi\Params\KeepLink, default, 0, "0" - - -[Neo.Service] -DisplayName = %Neo.Service.DispName% -Description = %Neo.Service.Desc% -ServiceType = 1 -StartType = 3 -ErrorControl = 1 -ServiceBinary = %12%\Neo_VPN25.sys -LoadOrderGroup = NDIS - -[Neo.Reg] -HKR, Ndi, Service, 0, Neo.Service.Name -HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" -HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" - -[Neo.EventLog] -HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN25.sys" -HKR, , TypesSupported, 0x00010001, 7 - -[Strings] -CompanyName = "SoftEther Corporation" -DiskDescription = "VPN Client Device Driver Install Disk" -Neo.Service.Name = "Neo_VPN25" -Neo.Service.DispName = "VPN Client Device Driver - VPN25" -Neo.Service.Desc = "VPN Client Adapter - VPN25" -NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN25" -Neo.EventLog.Name = "Neo" -NetworkAddress = "MAC Address" -DefaultAddress = "000001000001" -MaxSpeed = "Indicate Speed (Mbps)" -KeepLink = "Keep Link" -On = "On" -Off = "Off" - - -; Auto Generated 20180205_163608.769 - +; VPN Client Device Driver for Windows 2000 and Greater +; +; Copyright (c) SoftEther Corporation. All Rights Reserved. +; http://www.softether.co.jp/ +; +; BUILD 9658 + +[Version] +Signature = "$Windows NT$" +Class = Net +ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} +Provider = %CompanyName% +DriverVer = 02/04/2018, 4.25.0.9658 +CatalogFile.NT = inf_VPN25.cat + +[Manufacturer] +%CompanyName% = SoftEther + +[SourceDisksNames] +1=%DiskDescription%, "", , + +[SourceDisksFiles] +Neo_VPN25.sys = 1 + +[DestinationDirs] +DefaultDestDir = 12 +Neo.CopyFiles.Sys = 12 + +[Neo.CopyFiles.Sys] +Neo_VPN25.sys, , , 2 + +[SoftEther] +%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN25 + +[NeoAdapter.Install] +Characteristics = 0x1 +AddReg = Neo.Reg, NeoAdapter.Ndi +CopyFiles = Neo.CopyFiles.Sys +*IfType = 53 +*MediaType = 0 +*PhysicalMediaType = 0 + +[NeoAdapter.Install.Services] +AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% + +[NeoAdapter.Ndi] +HKR, , NetworkAddress, 0, %DefaultAddress% +HKR, Ndi, DeviceID, , "NeoAdapter_VPN25" +HKR, , DevLoader, , ndis +HKR, , DeviceVxDs, , Neo_VPN25.sys +HKR, NDIS, LogDriverName, , "Neo_VPN25" +HKR, NDIS, MajorNdisVersion, 1, 5 +HKR, NDIS, MinorNdisVersion, 1, 0 +HKR, Ndi\Interfaces, DefUpper, , "ndis5" +HKR, Ndi\Interfaces, UpperRange, , "ndis5" +HKR, Ndi\Interfaces, LowerRange, , "ethernet" +HKR, Ndi\Interfaces, DefLower, , "ethernet" +HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" +HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% +HKR, Ndi\Params\NetworkAddress, type, 0, "edit" +HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" +HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" +HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% +HKR, Ndi\Params\NetworkAddress, optional, 0, "0" +HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% +HKR, Ndi\Params\MaxSpeed, type, 0, "int" +HKR, Ndi\Params\MaxSpeed, default, 0, "100" +HKR, Ndi\Params\MaxSpeed, min, 0, "0" +HKR, Ndi\Params\MaxSpeed, max, 0, "2000" +HKR, Ndi\Params\MaxSpeed, step, 0, "1" +HKR, Ndi\Params\MaxSpeed, Base, 0, "10" +HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% +HKR, Ndi\Params\KeepLink, type, 0, "enum" +HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% +HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% +HKR, Ndi\Params\KeepLink, default, 0, "0" + + +[Neo.Service] +DisplayName = %Neo.Service.DispName% +Description = %Neo.Service.Desc% +ServiceType = 1 +StartType = 3 +ErrorControl = 1 +ServiceBinary = %12%\Neo_VPN25.sys +LoadOrderGroup = NDIS + +[Neo.Reg] +HKR, Ndi, Service, 0, Neo.Service.Name +HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" +HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" + +[Neo.EventLog] +HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN25.sys" +HKR, , TypesSupported, 0x00010001, 7 + +[Strings] +CompanyName = "SoftEther Corporation" +DiskDescription = "VPN Client Device Driver Install Disk" +Neo.Service.Name = "Neo_VPN25" +Neo.Service.DispName = "VPN Client Device Driver - VPN25" +Neo.Service.Desc = "VPN Client Adapter - VPN25" +NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN25" +Neo.EventLog.Name = "Neo" +NetworkAddress = "MAC Address" +DefaultAddress = "000001000001" +MaxSpeed = "Indicate Speed (Mbps)" +KeepLink = "Keep Link" +On = "On" +Off = "Off" + + +; Auto Generated 20180205_163608.769 + diff --git a/src/bin/hamcore/DriverPackages/Neo6_Win8/x86/Neo6_x86_VPN26.inf b/src/bin/hamcore/DriverPackages/Neo6_Win8/x86/Neo6_x86_VPN26.inf index 092183c8..9cf362e5 100644 --- a/src/bin/hamcore/DriverPackages/Neo6_Win8/x86/Neo6_x86_VPN26.inf +++ b/src/bin/hamcore/DriverPackages/Neo6_Win8/x86/Neo6_x86_VPN26.inf @@ -1,114 +1,114 @@ -; VPN Client Device Driver for Windows 2000 and Greater -; -; Copyright (c) SoftEther Corporation. All Rights Reserved. -; http://www.softether.co.jp/ -; -; BUILD 9658 - -[Version] -Signature = "$Windows NT$" -Class = Net -ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} -Provider = %CompanyName% -DriverVer = 02/04/2018, 4.25.0.9658 -CatalogFile.NT = inf_VPN26.cat - -[Manufacturer] -%CompanyName% = SoftEther - -[SourceDisksNames] -1=%DiskDescription%, "", , - -[SourceDisksFiles] -Neo_VPN26.sys = 1 - -[DestinationDirs] -DefaultDestDir = 12 -Neo.CopyFiles.Sys = 12 - -[Neo.CopyFiles.Sys] -Neo_VPN26.sys, , , 2 - -[SoftEther] -%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN26 - -[NeoAdapter.Install] -Characteristics = 0x1 -AddReg = Neo.Reg, NeoAdapter.Ndi -CopyFiles = Neo.CopyFiles.Sys -*IfType = 53 -*MediaType = 0 -*PhysicalMediaType = 0 - -[NeoAdapter.Install.Services] -AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% - -[NeoAdapter.Ndi] -HKR, , NetworkAddress, 0, %DefaultAddress% -HKR, Ndi, DeviceID, , "NeoAdapter_VPN26" -HKR, , DevLoader, , ndis -HKR, , DeviceVxDs, , Neo_VPN26.sys -HKR, NDIS, LogDriverName, , "Neo_VPN26" -HKR, NDIS, MajorNdisVersion, 1, 5 -HKR, NDIS, MinorNdisVersion, 1, 0 -HKR, Ndi\Interfaces, DefUpper, , "ndis5" -HKR, Ndi\Interfaces, UpperRange, , "ndis5" -HKR, Ndi\Interfaces, LowerRange, , "ethernet" -HKR, Ndi\Interfaces, DefLower, , "ethernet" -HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" -HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% -HKR, Ndi\Params\NetworkAddress, type, 0, "edit" -HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" -HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" -HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% -HKR, Ndi\Params\NetworkAddress, optional, 0, "0" -HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% -HKR, Ndi\Params\MaxSpeed, type, 0, "int" -HKR, Ndi\Params\MaxSpeed, default, 0, "100" -HKR, Ndi\Params\MaxSpeed, min, 0, "0" -HKR, Ndi\Params\MaxSpeed, max, 0, "2000" -HKR, Ndi\Params\MaxSpeed, step, 0, "1" -HKR, Ndi\Params\MaxSpeed, Base, 0, "10" -HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% -HKR, Ndi\Params\KeepLink, type, 0, "enum" -HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% -HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% -HKR, Ndi\Params\KeepLink, default, 0, "0" - - -[Neo.Service] -DisplayName = %Neo.Service.DispName% -Description = %Neo.Service.Desc% -ServiceType = 1 -StartType = 3 -ErrorControl = 1 -ServiceBinary = %12%\Neo_VPN26.sys -LoadOrderGroup = NDIS - -[Neo.Reg] -HKR, Ndi, Service, 0, Neo.Service.Name -HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" -HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" - -[Neo.EventLog] -HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN26.sys" -HKR, , TypesSupported, 0x00010001, 7 - -[Strings] -CompanyName = "SoftEther Corporation" -DiskDescription = "VPN Client Device Driver Install Disk" -Neo.Service.Name = "Neo_VPN26" -Neo.Service.DispName = "VPN Client Device Driver - VPN26" -Neo.Service.Desc = "VPN Client Adapter - VPN26" -NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN26" -Neo.EventLog.Name = "Neo" -NetworkAddress = "MAC Address" -DefaultAddress = "000001000001" -MaxSpeed = "Indicate Speed (Mbps)" -KeepLink = "Keep Link" -On = "On" -Off = "Off" - - -; Auto Generated 20180205_163608.769 - +; VPN Client Device Driver for Windows 2000 and Greater +; +; Copyright (c) SoftEther Corporation. All Rights Reserved. +; http://www.softether.co.jp/ +; +; BUILD 9658 + +[Version] +Signature = "$Windows NT$" +Class = Net +ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} +Provider = %CompanyName% +DriverVer = 02/04/2018, 4.25.0.9658 +CatalogFile.NT = inf_VPN26.cat + +[Manufacturer] +%CompanyName% = SoftEther + +[SourceDisksNames] +1=%DiskDescription%, "", , + +[SourceDisksFiles] +Neo_VPN26.sys = 1 + +[DestinationDirs] +DefaultDestDir = 12 +Neo.CopyFiles.Sys = 12 + +[Neo.CopyFiles.Sys] +Neo_VPN26.sys, , , 2 + +[SoftEther] +%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN26 + +[NeoAdapter.Install] +Characteristics = 0x1 +AddReg = Neo.Reg, NeoAdapter.Ndi +CopyFiles = Neo.CopyFiles.Sys +*IfType = 53 +*MediaType = 0 +*PhysicalMediaType = 0 + +[NeoAdapter.Install.Services] +AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% + +[NeoAdapter.Ndi] +HKR, , NetworkAddress, 0, %DefaultAddress% +HKR, Ndi, DeviceID, , "NeoAdapter_VPN26" +HKR, , DevLoader, , ndis +HKR, , DeviceVxDs, , Neo_VPN26.sys +HKR, NDIS, LogDriverName, , "Neo_VPN26" +HKR, NDIS, MajorNdisVersion, 1, 5 +HKR, NDIS, MinorNdisVersion, 1, 0 +HKR, Ndi\Interfaces, DefUpper, , "ndis5" +HKR, Ndi\Interfaces, UpperRange, , "ndis5" +HKR, Ndi\Interfaces, LowerRange, , "ethernet" +HKR, Ndi\Interfaces, DefLower, , "ethernet" +HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" +HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% +HKR, Ndi\Params\NetworkAddress, type, 0, "edit" +HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" +HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" +HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% +HKR, Ndi\Params\NetworkAddress, optional, 0, "0" +HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% +HKR, Ndi\Params\MaxSpeed, type, 0, "int" +HKR, Ndi\Params\MaxSpeed, default, 0, "100" +HKR, Ndi\Params\MaxSpeed, min, 0, "0" +HKR, Ndi\Params\MaxSpeed, max, 0, "2000" +HKR, Ndi\Params\MaxSpeed, step, 0, "1" +HKR, Ndi\Params\MaxSpeed, Base, 0, "10" +HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% +HKR, Ndi\Params\KeepLink, type, 0, "enum" +HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% +HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% +HKR, Ndi\Params\KeepLink, default, 0, "0" + + +[Neo.Service] +DisplayName = %Neo.Service.DispName% +Description = %Neo.Service.Desc% +ServiceType = 1 +StartType = 3 +ErrorControl = 1 +ServiceBinary = %12%\Neo_VPN26.sys +LoadOrderGroup = NDIS + +[Neo.Reg] +HKR, Ndi, Service, 0, Neo.Service.Name +HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" +HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" + +[Neo.EventLog] +HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN26.sys" +HKR, , TypesSupported, 0x00010001, 7 + +[Strings] +CompanyName = "SoftEther Corporation" +DiskDescription = "VPN Client Device Driver Install Disk" +Neo.Service.Name = "Neo_VPN26" +Neo.Service.DispName = "VPN Client Device Driver - VPN26" +Neo.Service.Desc = "VPN Client Adapter - VPN26" +NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN26" +Neo.EventLog.Name = "Neo" +NetworkAddress = "MAC Address" +DefaultAddress = "000001000001" +MaxSpeed = "Indicate Speed (Mbps)" +KeepLink = "Keep Link" +On = "On" +Off = "Off" + + +; Auto Generated 20180205_163608.769 + diff --git a/src/bin/hamcore/DriverPackages/Neo6_Win8/x86/Neo6_x86_VPN27.inf b/src/bin/hamcore/DriverPackages/Neo6_Win8/x86/Neo6_x86_VPN27.inf index 7f1f67ea..e0bf5b0d 100644 --- a/src/bin/hamcore/DriverPackages/Neo6_Win8/x86/Neo6_x86_VPN27.inf +++ b/src/bin/hamcore/DriverPackages/Neo6_Win8/x86/Neo6_x86_VPN27.inf @@ -1,114 +1,114 @@ -; VPN Client Device Driver for Windows 2000 and Greater -; -; Copyright (c) SoftEther Corporation. All Rights Reserved. -; http://www.softether.co.jp/ -; -; BUILD 9658 - -[Version] -Signature = "$Windows NT$" -Class = Net -ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} -Provider = %CompanyName% -DriverVer = 02/04/2018, 4.25.0.9658 -CatalogFile.NT = inf_VPN27.cat - -[Manufacturer] -%CompanyName% = SoftEther - -[SourceDisksNames] -1=%DiskDescription%, "", , - -[SourceDisksFiles] -Neo_VPN27.sys = 1 - -[DestinationDirs] -DefaultDestDir = 12 -Neo.CopyFiles.Sys = 12 - -[Neo.CopyFiles.Sys] -Neo_VPN27.sys, , , 2 - -[SoftEther] -%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN27 - -[NeoAdapter.Install] -Characteristics = 0x1 -AddReg = Neo.Reg, NeoAdapter.Ndi -CopyFiles = Neo.CopyFiles.Sys -*IfType = 53 -*MediaType = 0 -*PhysicalMediaType = 0 - -[NeoAdapter.Install.Services] -AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% - -[NeoAdapter.Ndi] -HKR, , NetworkAddress, 0, %DefaultAddress% -HKR, Ndi, DeviceID, , "NeoAdapter_VPN27" -HKR, , DevLoader, , ndis -HKR, , DeviceVxDs, , Neo_VPN27.sys -HKR, NDIS, LogDriverName, , "Neo_VPN27" -HKR, NDIS, MajorNdisVersion, 1, 5 -HKR, NDIS, MinorNdisVersion, 1, 0 -HKR, Ndi\Interfaces, DefUpper, , "ndis5" -HKR, Ndi\Interfaces, UpperRange, , "ndis5" -HKR, Ndi\Interfaces, LowerRange, , "ethernet" -HKR, Ndi\Interfaces, DefLower, , "ethernet" -HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" -HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% -HKR, Ndi\Params\NetworkAddress, type, 0, "edit" -HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" -HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" -HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% -HKR, Ndi\Params\NetworkAddress, optional, 0, "0" -HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% -HKR, Ndi\Params\MaxSpeed, type, 0, "int" -HKR, Ndi\Params\MaxSpeed, default, 0, "100" -HKR, Ndi\Params\MaxSpeed, min, 0, "0" -HKR, Ndi\Params\MaxSpeed, max, 0, "2000" -HKR, Ndi\Params\MaxSpeed, step, 0, "1" -HKR, Ndi\Params\MaxSpeed, Base, 0, "10" -HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% -HKR, Ndi\Params\KeepLink, type, 0, "enum" -HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% -HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% -HKR, Ndi\Params\KeepLink, default, 0, "0" - - -[Neo.Service] -DisplayName = %Neo.Service.DispName% -Description = %Neo.Service.Desc% -ServiceType = 1 -StartType = 3 -ErrorControl = 1 -ServiceBinary = %12%\Neo_VPN27.sys -LoadOrderGroup = NDIS - -[Neo.Reg] -HKR, Ndi, Service, 0, Neo.Service.Name -HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" -HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" - -[Neo.EventLog] -HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN27.sys" -HKR, , TypesSupported, 0x00010001, 7 - -[Strings] -CompanyName = "SoftEther Corporation" -DiskDescription = "VPN Client Device Driver Install Disk" -Neo.Service.Name = "Neo_VPN27" -Neo.Service.DispName = "VPN Client Device Driver - VPN27" -Neo.Service.Desc = "VPN Client Adapter - VPN27" -NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN27" -Neo.EventLog.Name = "Neo" -NetworkAddress = "MAC Address" -DefaultAddress = "000001000001" -MaxSpeed = "Indicate Speed (Mbps)" -KeepLink = "Keep Link" -On = "On" -Off = "Off" - - -; Auto Generated 20180205_163608.770 - +; VPN Client Device Driver for Windows 2000 and Greater +; +; Copyright (c) SoftEther Corporation. All Rights Reserved. +; http://www.softether.co.jp/ +; +; BUILD 9658 + +[Version] +Signature = "$Windows NT$" +Class = Net +ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} +Provider = %CompanyName% +DriverVer = 02/04/2018, 4.25.0.9658 +CatalogFile.NT = inf_VPN27.cat + +[Manufacturer] +%CompanyName% = SoftEther + +[SourceDisksNames] +1=%DiskDescription%, "", , + +[SourceDisksFiles] +Neo_VPN27.sys = 1 + +[DestinationDirs] +DefaultDestDir = 12 +Neo.CopyFiles.Sys = 12 + +[Neo.CopyFiles.Sys] +Neo_VPN27.sys, , , 2 + +[SoftEther] +%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN27 + +[NeoAdapter.Install] +Characteristics = 0x1 +AddReg = Neo.Reg, NeoAdapter.Ndi +CopyFiles = Neo.CopyFiles.Sys +*IfType = 53 +*MediaType = 0 +*PhysicalMediaType = 0 + +[NeoAdapter.Install.Services] +AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% + +[NeoAdapter.Ndi] +HKR, , NetworkAddress, 0, %DefaultAddress% +HKR, Ndi, DeviceID, , "NeoAdapter_VPN27" +HKR, , DevLoader, , ndis +HKR, , DeviceVxDs, , Neo_VPN27.sys +HKR, NDIS, LogDriverName, , "Neo_VPN27" +HKR, NDIS, MajorNdisVersion, 1, 5 +HKR, NDIS, MinorNdisVersion, 1, 0 +HKR, Ndi\Interfaces, DefUpper, , "ndis5" +HKR, Ndi\Interfaces, UpperRange, , "ndis5" +HKR, Ndi\Interfaces, LowerRange, , "ethernet" +HKR, Ndi\Interfaces, DefLower, , "ethernet" +HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" +HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% +HKR, Ndi\Params\NetworkAddress, type, 0, "edit" +HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" +HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" +HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% +HKR, Ndi\Params\NetworkAddress, optional, 0, "0" +HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% +HKR, Ndi\Params\MaxSpeed, type, 0, "int" +HKR, Ndi\Params\MaxSpeed, default, 0, "100" +HKR, Ndi\Params\MaxSpeed, min, 0, "0" +HKR, Ndi\Params\MaxSpeed, max, 0, "2000" +HKR, Ndi\Params\MaxSpeed, step, 0, "1" +HKR, Ndi\Params\MaxSpeed, Base, 0, "10" +HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% +HKR, Ndi\Params\KeepLink, type, 0, "enum" +HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% +HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% +HKR, Ndi\Params\KeepLink, default, 0, "0" + + +[Neo.Service] +DisplayName = %Neo.Service.DispName% +Description = %Neo.Service.Desc% +ServiceType = 1 +StartType = 3 +ErrorControl = 1 +ServiceBinary = %12%\Neo_VPN27.sys +LoadOrderGroup = NDIS + +[Neo.Reg] +HKR, Ndi, Service, 0, Neo.Service.Name +HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" +HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" + +[Neo.EventLog] +HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN27.sys" +HKR, , TypesSupported, 0x00010001, 7 + +[Strings] +CompanyName = "SoftEther Corporation" +DiskDescription = "VPN Client Device Driver Install Disk" +Neo.Service.Name = "Neo_VPN27" +Neo.Service.DispName = "VPN Client Device Driver - VPN27" +Neo.Service.Desc = "VPN Client Adapter - VPN27" +NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN27" +Neo.EventLog.Name = "Neo" +NetworkAddress = "MAC Address" +DefaultAddress = "000001000001" +MaxSpeed = "Indicate Speed (Mbps)" +KeepLink = "Keep Link" +On = "On" +Off = "Off" + + +; Auto Generated 20180205_163608.770 + diff --git a/src/bin/hamcore/DriverPackages/Neo6_Win8/x86/Neo6_x86_VPN28.inf b/src/bin/hamcore/DriverPackages/Neo6_Win8/x86/Neo6_x86_VPN28.inf index 98b81614..b988ccab 100644 --- a/src/bin/hamcore/DriverPackages/Neo6_Win8/x86/Neo6_x86_VPN28.inf +++ b/src/bin/hamcore/DriverPackages/Neo6_Win8/x86/Neo6_x86_VPN28.inf @@ -1,114 +1,114 @@ -; VPN Client Device Driver for Windows 2000 and Greater -; -; Copyright (c) SoftEther Corporation. All Rights Reserved. -; http://www.softether.co.jp/ -; -; BUILD 9658 - -[Version] -Signature = "$Windows NT$" -Class = Net -ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} -Provider = %CompanyName% -DriverVer = 02/04/2018, 4.25.0.9658 -CatalogFile.NT = inf_VPN28.cat - -[Manufacturer] -%CompanyName% = SoftEther - -[SourceDisksNames] -1=%DiskDescription%, "", , - -[SourceDisksFiles] -Neo_VPN28.sys = 1 - -[DestinationDirs] -DefaultDestDir = 12 -Neo.CopyFiles.Sys = 12 - -[Neo.CopyFiles.Sys] -Neo_VPN28.sys, , , 2 - -[SoftEther] -%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN28 - -[NeoAdapter.Install] -Characteristics = 0x1 -AddReg = Neo.Reg, NeoAdapter.Ndi -CopyFiles = Neo.CopyFiles.Sys -*IfType = 53 -*MediaType = 0 -*PhysicalMediaType = 0 - -[NeoAdapter.Install.Services] -AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% - -[NeoAdapter.Ndi] -HKR, , NetworkAddress, 0, %DefaultAddress% -HKR, Ndi, DeviceID, , "NeoAdapter_VPN28" -HKR, , DevLoader, , ndis -HKR, , DeviceVxDs, , Neo_VPN28.sys -HKR, NDIS, LogDriverName, , "Neo_VPN28" -HKR, NDIS, MajorNdisVersion, 1, 5 -HKR, NDIS, MinorNdisVersion, 1, 0 -HKR, Ndi\Interfaces, DefUpper, , "ndis5" -HKR, Ndi\Interfaces, UpperRange, , "ndis5" -HKR, Ndi\Interfaces, LowerRange, , "ethernet" -HKR, Ndi\Interfaces, DefLower, , "ethernet" -HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" -HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% -HKR, Ndi\Params\NetworkAddress, type, 0, "edit" -HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" -HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" -HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% -HKR, Ndi\Params\NetworkAddress, optional, 0, "0" -HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% -HKR, Ndi\Params\MaxSpeed, type, 0, "int" -HKR, Ndi\Params\MaxSpeed, default, 0, "100" -HKR, Ndi\Params\MaxSpeed, min, 0, "0" -HKR, Ndi\Params\MaxSpeed, max, 0, "2000" -HKR, Ndi\Params\MaxSpeed, step, 0, "1" -HKR, Ndi\Params\MaxSpeed, Base, 0, "10" -HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% -HKR, Ndi\Params\KeepLink, type, 0, "enum" -HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% -HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% -HKR, Ndi\Params\KeepLink, default, 0, "0" - - -[Neo.Service] -DisplayName = %Neo.Service.DispName% -Description = %Neo.Service.Desc% -ServiceType = 1 -StartType = 3 -ErrorControl = 1 -ServiceBinary = %12%\Neo_VPN28.sys -LoadOrderGroup = NDIS - -[Neo.Reg] -HKR, Ndi, Service, 0, Neo.Service.Name -HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" -HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" - -[Neo.EventLog] -HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN28.sys" -HKR, , TypesSupported, 0x00010001, 7 - -[Strings] -CompanyName = "SoftEther Corporation" -DiskDescription = "VPN Client Device Driver Install Disk" -Neo.Service.Name = "Neo_VPN28" -Neo.Service.DispName = "VPN Client Device Driver - VPN28" -Neo.Service.Desc = "VPN Client Adapter - VPN28" -NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN28" -Neo.EventLog.Name = "Neo" -NetworkAddress = "MAC Address" -DefaultAddress = "000001000001" -MaxSpeed = "Indicate Speed (Mbps)" -KeepLink = "Keep Link" -On = "On" -Off = "Off" - - -; Auto Generated 20180205_163608.771 - +; VPN Client Device Driver for Windows 2000 and Greater +; +; Copyright (c) SoftEther Corporation. All Rights Reserved. +; http://www.softether.co.jp/ +; +; BUILD 9658 + +[Version] +Signature = "$Windows NT$" +Class = Net +ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} +Provider = %CompanyName% +DriverVer = 02/04/2018, 4.25.0.9658 +CatalogFile.NT = inf_VPN28.cat + +[Manufacturer] +%CompanyName% = SoftEther + +[SourceDisksNames] +1=%DiskDescription%, "", , + +[SourceDisksFiles] +Neo_VPN28.sys = 1 + +[DestinationDirs] +DefaultDestDir = 12 +Neo.CopyFiles.Sys = 12 + +[Neo.CopyFiles.Sys] +Neo_VPN28.sys, , , 2 + +[SoftEther] +%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN28 + +[NeoAdapter.Install] +Characteristics = 0x1 +AddReg = Neo.Reg, NeoAdapter.Ndi +CopyFiles = Neo.CopyFiles.Sys +*IfType = 53 +*MediaType = 0 +*PhysicalMediaType = 0 + +[NeoAdapter.Install.Services] +AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% + +[NeoAdapter.Ndi] +HKR, , NetworkAddress, 0, %DefaultAddress% +HKR, Ndi, DeviceID, , "NeoAdapter_VPN28" +HKR, , DevLoader, , ndis +HKR, , DeviceVxDs, , Neo_VPN28.sys +HKR, NDIS, LogDriverName, , "Neo_VPN28" +HKR, NDIS, MajorNdisVersion, 1, 5 +HKR, NDIS, MinorNdisVersion, 1, 0 +HKR, Ndi\Interfaces, DefUpper, , "ndis5" +HKR, Ndi\Interfaces, UpperRange, , "ndis5" +HKR, Ndi\Interfaces, LowerRange, , "ethernet" +HKR, Ndi\Interfaces, DefLower, , "ethernet" +HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" +HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% +HKR, Ndi\Params\NetworkAddress, type, 0, "edit" +HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" +HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" +HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% +HKR, Ndi\Params\NetworkAddress, optional, 0, "0" +HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% +HKR, Ndi\Params\MaxSpeed, type, 0, "int" +HKR, Ndi\Params\MaxSpeed, default, 0, "100" +HKR, Ndi\Params\MaxSpeed, min, 0, "0" +HKR, Ndi\Params\MaxSpeed, max, 0, "2000" +HKR, Ndi\Params\MaxSpeed, step, 0, "1" +HKR, Ndi\Params\MaxSpeed, Base, 0, "10" +HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% +HKR, Ndi\Params\KeepLink, type, 0, "enum" +HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% +HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% +HKR, Ndi\Params\KeepLink, default, 0, "0" + + +[Neo.Service] +DisplayName = %Neo.Service.DispName% +Description = %Neo.Service.Desc% +ServiceType = 1 +StartType = 3 +ErrorControl = 1 +ServiceBinary = %12%\Neo_VPN28.sys +LoadOrderGroup = NDIS + +[Neo.Reg] +HKR, Ndi, Service, 0, Neo.Service.Name +HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" +HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" + +[Neo.EventLog] +HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN28.sys" +HKR, , TypesSupported, 0x00010001, 7 + +[Strings] +CompanyName = "SoftEther Corporation" +DiskDescription = "VPN Client Device Driver Install Disk" +Neo.Service.Name = "Neo_VPN28" +Neo.Service.DispName = "VPN Client Device Driver - VPN28" +Neo.Service.Desc = "VPN Client Adapter - VPN28" +NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN28" +Neo.EventLog.Name = "Neo" +NetworkAddress = "MAC Address" +DefaultAddress = "000001000001" +MaxSpeed = "Indicate Speed (Mbps)" +KeepLink = "Keep Link" +On = "On" +Off = "Off" + + +; Auto Generated 20180205_163608.771 + diff --git a/src/bin/hamcore/DriverPackages/Neo6_Win8/x86/Neo6_x86_VPN29.inf b/src/bin/hamcore/DriverPackages/Neo6_Win8/x86/Neo6_x86_VPN29.inf index bf4846f2..f7573cbc 100644 --- a/src/bin/hamcore/DriverPackages/Neo6_Win8/x86/Neo6_x86_VPN29.inf +++ b/src/bin/hamcore/DriverPackages/Neo6_Win8/x86/Neo6_x86_VPN29.inf @@ -1,114 +1,114 @@ -; VPN Client Device Driver for Windows 2000 and Greater -; -; Copyright (c) SoftEther Corporation. All Rights Reserved. -; http://www.softether.co.jp/ -; -; BUILD 9658 - -[Version] -Signature = "$Windows NT$" -Class = Net -ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} -Provider = %CompanyName% -DriverVer = 02/04/2018, 4.25.0.9658 -CatalogFile.NT = inf_VPN29.cat - -[Manufacturer] -%CompanyName% = SoftEther - -[SourceDisksNames] -1=%DiskDescription%, "", , - -[SourceDisksFiles] -Neo_VPN29.sys = 1 - -[DestinationDirs] -DefaultDestDir = 12 -Neo.CopyFiles.Sys = 12 - -[Neo.CopyFiles.Sys] -Neo_VPN29.sys, , , 2 - -[SoftEther] -%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN29 - -[NeoAdapter.Install] -Characteristics = 0x1 -AddReg = Neo.Reg, NeoAdapter.Ndi -CopyFiles = Neo.CopyFiles.Sys -*IfType = 53 -*MediaType = 0 -*PhysicalMediaType = 0 - -[NeoAdapter.Install.Services] -AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% - -[NeoAdapter.Ndi] -HKR, , NetworkAddress, 0, %DefaultAddress% -HKR, Ndi, DeviceID, , "NeoAdapter_VPN29" -HKR, , DevLoader, , ndis -HKR, , DeviceVxDs, , Neo_VPN29.sys -HKR, NDIS, LogDriverName, , "Neo_VPN29" -HKR, NDIS, MajorNdisVersion, 1, 5 -HKR, NDIS, MinorNdisVersion, 1, 0 -HKR, Ndi\Interfaces, DefUpper, , "ndis5" -HKR, Ndi\Interfaces, UpperRange, , "ndis5" -HKR, Ndi\Interfaces, LowerRange, , "ethernet" -HKR, Ndi\Interfaces, DefLower, , "ethernet" -HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" -HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% -HKR, Ndi\Params\NetworkAddress, type, 0, "edit" -HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" -HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" -HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% -HKR, Ndi\Params\NetworkAddress, optional, 0, "0" -HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% -HKR, Ndi\Params\MaxSpeed, type, 0, "int" -HKR, Ndi\Params\MaxSpeed, default, 0, "100" -HKR, Ndi\Params\MaxSpeed, min, 0, "0" -HKR, Ndi\Params\MaxSpeed, max, 0, "2000" -HKR, Ndi\Params\MaxSpeed, step, 0, "1" -HKR, Ndi\Params\MaxSpeed, Base, 0, "10" -HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% -HKR, Ndi\Params\KeepLink, type, 0, "enum" -HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% -HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% -HKR, Ndi\Params\KeepLink, default, 0, "0" - - -[Neo.Service] -DisplayName = %Neo.Service.DispName% -Description = %Neo.Service.Desc% -ServiceType = 1 -StartType = 3 -ErrorControl = 1 -ServiceBinary = %12%\Neo_VPN29.sys -LoadOrderGroup = NDIS - -[Neo.Reg] -HKR, Ndi, Service, 0, Neo.Service.Name -HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" -HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" - -[Neo.EventLog] -HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN29.sys" -HKR, , TypesSupported, 0x00010001, 7 - -[Strings] -CompanyName = "SoftEther Corporation" -DiskDescription = "VPN Client Device Driver Install Disk" -Neo.Service.Name = "Neo_VPN29" -Neo.Service.DispName = "VPN Client Device Driver - VPN29" -Neo.Service.Desc = "VPN Client Adapter - VPN29" -NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN29" -Neo.EventLog.Name = "Neo" -NetworkAddress = "MAC Address" -DefaultAddress = "000001000001" -MaxSpeed = "Indicate Speed (Mbps)" -KeepLink = "Keep Link" -On = "On" -Off = "Off" - - -; Auto Generated 20180205_163608.771 - +; VPN Client Device Driver for Windows 2000 and Greater +; +; Copyright (c) SoftEther Corporation. All Rights Reserved. +; http://www.softether.co.jp/ +; +; BUILD 9658 + +[Version] +Signature = "$Windows NT$" +Class = Net +ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} +Provider = %CompanyName% +DriverVer = 02/04/2018, 4.25.0.9658 +CatalogFile.NT = inf_VPN29.cat + +[Manufacturer] +%CompanyName% = SoftEther + +[SourceDisksNames] +1=%DiskDescription%, "", , + +[SourceDisksFiles] +Neo_VPN29.sys = 1 + +[DestinationDirs] +DefaultDestDir = 12 +Neo.CopyFiles.Sys = 12 + +[Neo.CopyFiles.Sys] +Neo_VPN29.sys, , , 2 + +[SoftEther] +%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN29 + +[NeoAdapter.Install] +Characteristics = 0x1 +AddReg = Neo.Reg, NeoAdapter.Ndi +CopyFiles = Neo.CopyFiles.Sys +*IfType = 53 +*MediaType = 0 +*PhysicalMediaType = 0 + +[NeoAdapter.Install.Services] +AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% + +[NeoAdapter.Ndi] +HKR, , NetworkAddress, 0, %DefaultAddress% +HKR, Ndi, DeviceID, , "NeoAdapter_VPN29" +HKR, , DevLoader, , ndis +HKR, , DeviceVxDs, , Neo_VPN29.sys +HKR, NDIS, LogDriverName, , "Neo_VPN29" +HKR, NDIS, MajorNdisVersion, 1, 5 +HKR, NDIS, MinorNdisVersion, 1, 0 +HKR, Ndi\Interfaces, DefUpper, , "ndis5" +HKR, Ndi\Interfaces, UpperRange, , "ndis5" +HKR, Ndi\Interfaces, LowerRange, , "ethernet" +HKR, Ndi\Interfaces, DefLower, , "ethernet" +HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" +HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% +HKR, Ndi\Params\NetworkAddress, type, 0, "edit" +HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" +HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" +HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% +HKR, Ndi\Params\NetworkAddress, optional, 0, "0" +HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% +HKR, Ndi\Params\MaxSpeed, type, 0, "int" +HKR, Ndi\Params\MaxSpeed, default, 0, "100" +HKR, Ndi\Params\MaxSpeed, min, 0, "0" +HKR, Ndi\Params\MaxSpeed, max, 0, "2000" +HKR, Ndi\Params\MaxSpeed, step, 0, "1" +HKR, Ndi\Params\MaxSpeed, Base, 0, "10" +HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% +HKR, Ndi\Params\KeepLink, type, 0, "enum" +HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% +HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% +HKR, Ndi\Params\KeepLink, default, 0, "0" + + +[Neo.Service] +DisplayName = %Neo.Service.DispName% +Description = %Neo.Service.Desc% +ServiceType = 1 +StartType = 3 +ErrorControl = 1 +ServiceBinary = %12%\Neo_VPN29.sys +LoadOrderGroup = NDIS + +[Neo.Reg] +HKR, Ndi, Service, 0, Neo.Service.Name +HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" +HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" + +[Neo.EventLog] +HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN29.sys" +HKR, , TypesSupported, 0x00010001, 7 + +[Strings] +CompanyName = "SoftEther Corporation" +DiskDescription = "VPN Client Device Driver Install Disk" +Neo.Service.Name = "Neo_VPN29" +Neo.Service.DispName = "VPN Client Device Driver - VPN29" +Neo.Service.Desc = "VPN Client Adapter - VPN29" +NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN29" +Neo.EventLog.Name = "Neo" +NetworkAddress = "MAC Address" +DefaultAddress = "000001000001" +MaxSpeed = "Indicate Speed (Mbps)" +KeepLink = "Keep Link" +On = "On" +Off = "Off" + + +; Auto Generated 20180205_163608.771 + diff --git a/src/bin/hamcore/DriverPackages/Neo6_Win8/x86/Neo6_x86_VPN3.inf b/src/bin/hamcore/DriverPackages/Neo6_Win8/x86/Neo6_x86_VPN3.inf index 8879a5e3..69cc3815 100644 --- a/src/bin/hamcore/DriverPackages/Neo6_Win8/x86/Neo6_x86_VPN3.inf +++ b/src/bin/hamcore/DriverPackages/Neo6_Win8/x86/Neo6_x86_VPN3.inf @@ -1,114 +1,114 @@ -; VPN Client Device Driver for Windows 2000 and Greater -; -; Copyright (c) SoftEther Corporation. All Rights Reserved. -; http://www.softether.co.jp/ -; -; BUILD 9658 - -[Version] -Signature = "$Windows NT$" -Class = Net -ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} -Provider = %CompanyName% -DriverVer = 02/04/2018, 4.25.0.9658 -CatalogFile.NT = inf_VPN3.cat - -[Manufacturer] -%CompanyName% = SoftEther - -[SourceDisksNames] -1=%DiskDescription%, "", , - -[SourceDisksFiles] -Neo_VPN3.sys = 1 - -[DestinationDirs] -DefaultDestDir = 12 -Neo.CopyFiles.Sys = 12 - -[Neo.CopyFiles.Sys] -Neo_VPN3.sys, , , 2 - -[SoftEther] -%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN3 - -[NeoAdapter.Install] -Characteristics = 0x1 -AddReg = Neo.Reg, NeoAdapter.Ndi -CopyFiles = Neo.CopyFiles.Sys -*IfType = 53 -*MediaType = 0 -*PhysicalMediaType = 0 - -[NeoAdapter.Install.Services] -AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% - -[NeoAdapter.Ndi] -HKR, , NetworkAddress, 0, %DefaultAddress% -HKR, Ndi, DeviceID, , "NeoAdapter_VPN3" -HKR, , DevLoader, , ndis -HKR, , DeviceVxDs, , Neo_VPN3.sys -HKR, NDIS, LogDriverName, , "Neo_VPN3" -HKR, NDIS, MajorNdisVersion, 1, 5 -HKR, NDIS, MinorNdisVersion, 1, 0 -HKR, Ndi\Interfaces, DefUpper, , "ndis5" -HKR, Ndi\Interfaces, UpperRange, , "ndis5" -HKR, Ndi\Interfaces, LowerRange, , "ethernet" -HKR, Ndi\Interfaces, DefLower, , "ethernet" -HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" -HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% -HKR, Ndi\Params\NetworkAddress, type, 0, "edit" -HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" -HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" -HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% -HKR, Ndi\Params\NetworkAddress, optional, 0, "0" -HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% -HKR, Ndi\Params\MaxSpeed, type, 0, "int" -HKR, Ndi\Params\MaxSpeed, default, 0, "100" -HKR, Ndi\Params\MaxSpeed, min, 0, "0" -HKR, Ndi\Params\MaxSpeed, max, 0, "2000" -HKR, Ndi\Params\MaxSpeed, step, 0, "1" -HKR, Ndi\Params\MaxSpeed, Base, 0, "10" -HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% -HKR, Ndi\Params\KeepLink, type, 0, "enum" -HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% -HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% -HKR, Ndi\Params\KeepLink, default, 0, "0" - - -[Neo.Service] -DisplayName = %Neo.Service.DispName% -Description = %Neo.Service.Desc% -ServiceType = 1 -StartType = 3 -ErrorControl = 1 -ServiceBinary = %12%\Neo_VPN3.sys -LoadOrderGroup = NDIS - -[Neo.Reg] -HKR, Ndi, Service, 0, Neo.Service.Name -HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" -HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" - -[Neo.EventLog] -HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN3.sys" -HKR, , TypesSupported, 0x00010001, 7 - -[Strings] -CompanyName = "SoftEther Corporation" -DiskDescription = "VPN Client Device Driver Install Disk" -Neo.Service.Name = "Neo_VPN3" -Neo.Service.DispName = "VPN Client Device Driver - VPN3" -Neo.Service.Desc = "VPN Client Adapter - VPN3" -NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN3" -Neo.EventLog.Name = "Neo" -NetworkAddress = "MAC Address" -DefaultAddress = "000001000001" -MaxSpeed = "Indicate Speed (Mbps)" -KeepLink = "Keep Link" -On = "On" -Off = "Off" - - -; Auto Generated 20180205_163608.748 - +; VPN Client Device Driver for Windows 2000 and Greater +; +; Copyright (c) SoftEther Corporation. All Rights Reserved. +; http://www.softether.co.jp/ +; +; BUILD 9658 + +[Version] +Signature = "$Windows NT$" +Class = Net +ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} +Provider = %CompanyName% +DriverVer = 02/04/2018, 4.25.0.9658 +CatalogFile.NT = inf_VPN3.cat + +[Manufacturer] +%CompanyName% = SoftEther + +[SourceDisksNames] +1=%DiskDescription%, "", , + +[SourceDisksFiles] +Neo_VPN3.sys = 1 + +[DestinationDirs] +DefaultDestDir = 12 +Neo.CopyFiles.Sys = 12 + +[Neo.CopyFiles.Sys] +Neo_VPN3.sys, , , 2 + +[SoftEther] +%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN3 + +[NeoAdapter.Install] +Characteristics = 0x1 +AddReg = Neo.Reg, NeoAdapter.Ndi +CopyFiles = Neo.CopyFiles.Sys +*IfType = 53 +*MediaType = 0 +*PhysicalMediaType = 0 + +[NeoAdapter.Install.Services] +AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% + +[NeoAdapter.Ndi] +HKR, , NetworkAddress, 0, %DefaultAddress% +HKR, Ndi, DeviceID, , "NeoAdapter_VPN3" +HKR, , DevLoader, , ndis +HKR, , DeviceVxDs, , Neo_VPN3.sys +HKR, NDIS, LogDriverName, , "Neo_VPN3" +HKR, NDIS, MajorNdisVersion, 1, 5 +HKR, NDIS, MinorNdisVersion, 1, 0 +HKR, Ndi\Interfaces, DefUpper, , "ndis5" +HKR, Ndi\Interfaces, UpperRange, , "ndis5" +HKR, Ndi\Interfaces, LowerRange, , "ethernet" +HKR, Ndi\Interfaces, DefLower, , "ethernet" +HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" +HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% +HKR, Ndi\Params\NetworkAddress, type, 0, "edit" +HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" +HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" +HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% +HKR, Ndi\Params\NetworkAddress, optional, 0, "0" +HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% +HKR, Ndi\Params\MaxSpeed, type, 0, "int" +HKR, Ndi\Params\MaxSpeed, default, 0, "100" +HKR, Ndi\Params\MaxSpeed, min, 0, "0" +HKR, Ndi\Params\MaxSpeed, max, 0, "2000" +HKR, Ndi\Params\MaxSpeed, step, 0, "1" +HKR, Ndi\Params\MaxSpeed, Base, 0, "10" +HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% +HKR, Ndi\Params\KeepLink, type, 0, "enum" +HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% +HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% +HKR, Ndi\Params\KeepLink, default, 0, "0" + + +[Neo.Service] +DisplayName = %Neo.Service.DispName% +Description = %Neo.Service.Desc% +ServiceType = 1 +StartType = 3 +ErrorControl = 1 +ServiceBinary = %12%\Neo_VPN3.sys +LoadOrderGroup = NDIS + +[Neo.Reg] +HKR, Ndi, Service, 0, Neo.Service.Name +HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" +HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" + +[Neo.EventLog] +HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN3.sys" +HKR, , TypesSupported, 0x00010001, 7 + +[Strings] +CompanyName = "SoftEther Corporation" +DiskDescription = "VPN Client Device Driver Install Disk" +Neo.Service.Name = "Neo_VPN3" +Neo.Service.DispName = "VPN Client Device Driver - VPN3" +Neo.Service.Desc = "VPN Client Adapter - VPN3" +NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN3" +Neo.EventLog.Name = "Neo" +NetworkAddress = "MAC Address" +DefaultAddress = "000001000001" +MaxSpeed = "Indicate Speed (Mbps)" +KeepLink = "Keep Link" +On = "On" +Off = "Off" + + +; Auto Generated 20180205_163608.748 + diff --git a/src/bin/hamcore/DriverPackages/Neo6_Win8/x86/Neo6_x86_VPN30.inf b/src/bin/hamcore/DriverPackages/Neo6_Win8/x86/Neo6_x86_VPN30.inf index b99e1797..687db1bd 100644 --- a/src/bin/hamcore/DriverPackages/Neo6_Win8/x86/Neo6_x86_VPN30.inf +++ b/src/bin/hamcore/DriverPackages/Neo6_Win8/x86/Neo6_x86_VPN30.inf @@ -1,114 +1,114 @@ -; VPN Client Device Driver for Windows 2000 and Greater -; -; Copyright (c) SoftEther Corporation. All Rights Reserved. -; http://www.softether.co.jp/ -; -; BUILD 9658 - -[Version] -Signature = "$Windows NT$" -Class = Net -ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} -Provider = %CompanyName% -DriverVer = 02/04/2018, 4.25.0.9658 -CatalogFile.NT = inf_VPN30.cat - -[Manufacturer] -%CompanyName% = SoftEther - -[SourceDisksNames] -1=%DiskDescription%, "", , - -[SourceDisksFiles] -Neo_VPN30.sys = 1 - -[DestinationDirs] -DefaultDestDir = 12 -Neo.CopyFiles.Sys = 12 - -[Neo.CopyFiles.Sys] -Neo_VPN30.sys, , , 2 - -[SoftEther] -%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN30 - -[NeoAdapter.Install] -Characteristics = 0x1 -AddReg = Neo.Reg, NeoAdapter.Ndi -CopyFiles = Neo.CopyFiles.Sys -*IfType = 53 -*MediaType = 0 -*PhysicalMediaType = 0 - -[NeoAdapter.Install.Services] -AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% - -[NeoAdapter.Ndi] -HKR, , NetworkAddress, 0, %DefaultAddress% -HKR, Ndi, DeviceID, , "NeoAdapter_VPN30" -HKR, , DevLoader, , ndis -HKR, , DeviceVxDs, , Neo_VPN30.sys -HKR, NDIS, LogDriverName, , "Neo_VPN30" -HKR, NDIS, MajorNdisVersion, 1, 5 -HKR, NDIS, MinorNdisVersion, 1, 0 -HKR, Ndi\Interfaces, DefUpper, , "ndis5" -HKR, Ndi\Interfaces, UpperRange, , "ndis5" -HKR, Ndi\Interfaces, LowerRange, , "ethernet" -HKR, Ndi\Interfaces, DefLower, , "ethernet" -HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" -HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% -HKR, Ndi\Params\NetworkAddress, type, 0, "edit" -HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" -HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" -HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% -HKR, Ndi\Params\NetworkAddress, optional, 0, "0" -HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% -HKR, Ndi\Params\MaxSpeed, type, 0, "int" -HKR, Ndi\Params\MaxSpeed, default, 0, "100" -HKR, Ndi\Params\MaxSpeed, min, 0, "0" -HKR, Ndi\Params\MaxSpeed, max, 0, "2000" -HKR, Ndi\Params\MaxSpeed, step, 0, "1" -HKR, Ndi\Params\MaxSpeed, Base, 0, "10" -HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% -HKR, Ndi\Params\KeepLink, type, 0, "enum" -HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% -HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% -HKR, Ndi\Params\KeepLink, default, 0, "0" - - -[Neo.Service] -DisplayName = %Neo.Service.DispName% -Description = %Neo.Service.Desc% -ServiceType = 1 -StartType = 3 -ErrorControl = 1 -ServiceBinary = %12%\Neo_VPN30.sys -LoadOrderGroup = NDIS - -[Neo.Reg] -HKR, Ndi, Service, 0, Neo.Service.Name -HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" -HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" - -[Neo.EventLog] -HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN30.sys" -HKR, , TypesSupported, 0x00010001, 7 - -[Strings] -CompanyName = "SoftEther Corporation" -DiskDescription = "VPN Client Device Driver Install Disk" -Neo.Service.Name = "Neo_VPN30" -Neo.Service.DispName = "VPN Client Device Driver - VPN30" -Neo.Service.Desc = "VPN Client Adapter - VPN30" -NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN30" -Neo.EventLog.Name = "Neo" -NetworkAddress = "MAC Address" -DefaultAddress = "000001000001" -MaxSpeed = "Indicate Speed (Mbps)" -KeepLink = "Keep Link" -On = "On" -Off = "Off" - - -; Auto Generated 20180205_163608.772 - +; VPN Client Device Driver for Windows 2000 and Greater +; +; Copyright (c) SoftEther Corporation. All Rights Reserved. +; http://www.softether.co.jp/ +; +; BUILD 9658 + +[Version] +Signature = "$Windows NT$" +Class = Net +ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} +Provider = %CompanyName% +DriverVer = 02/04/2018, 4.25.0.9658 +CatalogFile.NT = inf_VPN30.cat + +[Manufacturer] +%CompanyName% = SoftEther + +[SourceDisksNames] +1=%DiskDescription%, "", , + +[SourceDisksFiles] +Neo_VPN30.sys = 1 + +[DestinationDirs] +DefaultDestDir = 12 +Neo.CopyFiles.Sys = 12 + +[Neo.CopyFiles.Sys] +Neo_VPN30.sys, , , 2 + +[SoftEther] +%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN30 + +[NeoAdapter.Install] +Characteristics = 0x1 +AddReg = Neo.Reg, NeoAdapter.Ndi +CopyFiles = Neo.CopyFiles.Sys +*IfType = 53 +*MediaType = 0 +*PhysicalMediaType = 0 + +[NeoAdapter.Install.Services] +AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% + +[NeoAdapter.Ndi] +HKR, , NetworkAddress, 0, %DefaultAddress% +HKR, Ndi, DeviceID, , "NeoAdapter_VPN30" +HKR, , DevLoader, , ndis +HKR, , DeviceVxDs, , Neo_VPN30.sys +HKR, NDIS, LogDriverName, , "Neo_VPN30" +HKR, NDIS, MajorNdisVersion, 1, 5 +HKR, NDIS, MinorNdisVersion, 1, 0 +HKR, Ndi\Interfaces, DefUpper, , "ndis5" +HKR, Ndi\Interfaces, UpperRange, , "ndis5" +HKR, Ndi\Interfaces, LowerRange, , "ethernet" +HKR, Ndi\Interfaces, DefLower, , "ethernet" +HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" +HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% +HKR, Ndi\Params\NetworkAddress, type, 0, "edit" +HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" +HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" +HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% +HKR, Ndi\Params\NetworkAddress, optional, 0, "0" +HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% +HKR, Ndi\Params\MaxSpeed, type, 0, "int" +HKR, Ndi\Params\MaxSpeed, default, 0, "100" +HKR, Ndi\Params\MaxSpeed, min, 0, "0" +HKR, Ndi\Params\MaxSpeed, max, 0, "2000" +HKR, Ndi\Params\MaxSpeed, step, 0, "1" +HKR, Ndi\Params\MaxSpeed, Base, 0, "10" +HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% +HKR, Ndi\Params\KeepLink, type, 0, "enum" +HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% +HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% +HKR, Ndi\Params\KeepLink, default, 0, "0" + + +[Neo.Service] +DisplayName = %Neo.Service.DispName% +Description = %Neo.Service.Desc% +ServiceType = 1 +StartType = 3 +ErrorControl = 1 +ServiceBinary = %12%\Neo_VPN30.sys +LoadOrderGroup = NDIS + +[Neo.Reg] +HKR, Ndi, Service, 0, Neo.Service.Name +HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" +HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" + +[Neo.EventLog] +HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN30.sys" +HKR, , TypesSupported, 0x00010001, 7 + +[Strings] +CompanyName = "SoftEther Corporation" +DiskDescription = "VPN Client Device Driver Install Disk" +Neo.Service.Name = "Neo_VPN30" +Neo.Service.DispName = "VPN Client Device Driver - VPN30" +Neo.Service.Desc = "VPN Client Adapter - VPN30" +NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN30" +Neo.EventLog.Name = "Neo" +NetworkAddress = "MAC Address" +DefaultAddress = "000001000001" +MaxSpeed = "Indicate Speed (Mbps)" +KeepLink = "Keep Link" +On = "On" +Off = "Off" + + +; Auto Generated 20180205_163608.772 + diff --git a/src/bin/hamcore/DriverPackages/Neo6_Win8/x86/Neo6_x86_VPN31.inf b/src/bin/hamcore/DriverPackages/Neo6_Win8/x86/Neo6_x86_VPN31.inf index c0a467a1..fcc1911a 100644 --- a/src/bin/hamcore/DriverPackages/Neo6_Win8/x86/Neo6_x86_VPN31.inf +++ b/src/bin/hamcore/DriverPackages/Neo6_Win8/x86/Neo6_x86_VPN31.inf @@ -1,114 +1,114 @@ -; VPN Client Device Driver for Windows 2000 and Greater -; -; Copyright (c) SoftEther Corporation. All Rights Reserved. -; http://www.softether.co.jp/ -; -; BUILD 9658 - -[Version] -Signature = "$Windows NT$" -Class = Net -ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} -Provider = %CompanyName% -DriverVer = 02/04/2018, 4.25.0.9658 -CatalogFile.NT = inf_VPN31.cat - -[Manufacturer] -%CompanyName% = SoftEther - -[SourceDisksNames] -1=%DiskDescription%, "", , - -[SourceDisksFiles] -Neo_VPN31.sys = 1 - -[DestinationDirs] -DefaultDestDir = 12 -Neo.CopyFiles.Sys = 12 - -[Neo.CopyFiles.Sys] -Neo_VPN31.sys, , , 2 - -[SoftEther] -%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN31 - -[NeoAdapter.Install] -Characteristics = 0x1 -AddReg = Neo.Reg, NeoAdapter.Ndi -CopyFiles = Neo.CopyFiles.Sys -*IfType = 53 -*MediaType = 0 -*PhysicalMediaType = 0 - -[NeoAdapter.Install.Services] -AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% - -[NeoAdapter.Ndi] -HKR, , NetworkAddress, 0, %DefaultAddress% -HKR, Ndi, DeviceID, , "NeoAdapter_VPN31" -HKR, , DevLoader, , ndis -HKR, , DeviceVxDs, , Neo_VPN31.sys -HKR, NDIS, LogDriverName, , "Neo_VPN31" -HKR, NDIS, MajorNdisVersion, 1, 5 -HKR, NDIS, MinorNdisVersion, 1, 0 -HKR, Ndi\Interfaces, DefUpper, , "ndis5" -HKR, Ndi\Interfaces, UpperRange, , "ndis5" -HKR, Ndi\Interfaces, LowerRange, , "ethernet" -HKR, Ndi\Interfaces, DefLower, , "ethernet" -HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" -HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% -HKR, Ndi\Params\NetworkAddress, type, 0, "edit" -HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" -HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" -HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% -HKR, Ndi\Params\NetworkAddress, optional, 0, "0" -HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% -HKR, Ndi\Params\MaxSpeed, type, 0, "int" -HKR, Ndi\Params\MaxSpeed, default, 0, "100" -HKR, Ndi\Params\MaxSpeed, min, 0, "0" -HKR, Ndi\Params\MaxSpeed, max, 0, "2000" -HKR, Ndi\Params\MaxSpeed, step, 0, "1" -HKR, Ndi\Params\MaxSpeed, Base, 0, "10" -HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% -HKR, Ndi\Params\KeepLink, type, 0, "enum" -HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% -HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% -HKR, Ndi\Params\KeepLink, default, 0, "0" - - -[Neo.Service] -DisplayName = %Neo.Service.DispName% -Description = %Neo.Service.Desc% -ServiceType = 1 -StartType = 3 -ErrorControl = 1 -ServiceBinary = %12%\Neo_VPN31.sys -LoadOrderGroup = NDIS - -[Neo.Reg] -HKR, Ndi, Service, 0, Neo.Service.Name -HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" -HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" - -[Neo.EventLog] -HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN31.sys" -HKR, , TypesSupported, 0x00010001, 7 - -[Strings] -CompanyName = "SoftEther Corporation" -DiskDescription = "VPN Client Device Driver Install Disk" -Neo.Service.Name = "Neo_VPN31" -Neo.Service.DispName = "VPN Client Device Driver - VPN31" -Neo.Service.Desc = "VPN Client Adapter - VPN31" -NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN31" -Neo.EventLog.Name = "Neo" -NetworkAddress = "MAC Address" -DefaultAddress = "000001000001" -MaxSpeed = "Indicate Speed (Mbps)" -KeepLink = "Keep Link" -On = "On" -Off = "Off" - - -; Auto Generated 20180205_163608.772 - +; VPN Client Device Driver for Windows 2000 and Greater +; +; Copyright (c) SoftEther Corporation. All Rights Reserved. +; http://www.softether.co.jp/ +; +; BUILD 9658 + +[Version] +Signature = "$Windows NT$" +Class = Net +ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} +Provider = %CompanyName% +DriverVer = 02/04/2018, 4.25.0.9658 +CatalogFile.NT = inf_VPN31.cat + +[Manufacturer] +%CompanyName% = SoftEther + +[SourceDisksNames] +1=%DiskDescription%, "", , + +[SourceDisksFiles] +Neo_VPN31.sys = 1 + +[DestinationDirs] +DefaultDestDir = 12 +Neo.CopyFiles.Sys = 12 + +[Neo.CopyFiles.Sys] +Neo_VPN31.sys, , , 2 + +[SoftEther] +%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN31 + +[NeoAdapter.Install] +Characteristics = 0x1 +AddReg = Neo.Reg, NeoAdapter.Ndi +CopyFiles = Neo.CopyFiles.Sys +*IfType = 53 +*MediaType = 0 +*PhysicalMediaType = 0 + +[NeoAdapter.Install.Services] +AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% + +[NeoAdapter.Ndi] +HKR, , NetworkAddress, 0, %DefaultAddress% +HKR, Ndi, DeviceID, , "NeoAdapter_VPN31" +HKR, , DevLoader, , ndis +HKR, , DeviceVxDs, , Neo_VPN31.sys +HKR, NDIS, LogDriverName, , "Neo_VPN31" +HKR, NDIS, MajorNdisVersion, 1, 5 +HKR, NDIS, MinorNdisVersion, 1, 0 +HKR, Ndi\Interfaces, DefUpper, , "ndis5" +HKR, Ndi\Interfaces, UpperRange, , "ndis5" +HKR, Ndi\Interfaces, LowerRange, , "ethernet" +HKR, Ndi\Interfaces, DefLower, , "ethernet" +HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" +HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% +HKR, Ndi\Params\NetworkAddress, type, 0, "edit" +HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" +HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" +HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% +HKR, Ndi\Params\NetworkAddress, optional, 0, "0" +HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% +HKR, Ndi\Params\MaxSpeed, type, 0, "int" +HKR, Ndi\Params\MaxSpeed, default, 0, "100" +HKR, Ndi\Params\MaxSpeed, min, 0, "0" +HKR, Ndi\Params\MaxSpeed, max, 0, "2000" +HKR, Ndi\Params\MaxSpeed, step, 0, "1" +HKR, Ndi\Params\MaxSpeed, Base, 0, "10" +HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% +HKR, Ndi\Params\KeepLink, type, 0, "enum" +HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% +HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% +HKR, Ndi\Params\KeepLink, default, 0, "0" + + +[Neo.Service] +DisplayName = %Neo.Service.DispName% +Description = %Neo.Service.Desc% +ServiceType = 1 +StartType = 3 +ErrorControl = 1 +ServiceBinary = %12%\Neo_VPN31.sys +LoadOrderGroup = NDIS + +[Neo.Reg] +HKR, Ndi, Service, 0, Neo.Service.Name +HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" +HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" + +[Neo.EventLog] +HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN31.sys" +HKR, , TypesSupported, 0x00010001, 7 + +[Strings] +CompanyName = "SoftEther Corporation" +DiskDescription = "VPN Client Device Driver Install Disk" +Neo.Service.Name = "Neo_VPN31" +Neo.Service.DispName = "VPN Client Device Driver - VPN31" +Neo.Service.Desc = "VPN Client Adapter - VPN31" +NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN31" +Neo.EventLog.Name = "Neo" +NetworkAddress = "MAC Address" +DefaultAddress = "000001000001" +MaxSpeed = "Indicate Speed (Mbps)" +KeepLink = "Keep Link" +On = "On" +Off = "Off" + + +; Auto Generated 20180205_163608.772 + diff --git a/src/bin/hamcore/DriverPackages/Neo6_Win8/x86/Neo6_x86_VPN32.inf b/src/bin/hamcore/DriverPackages/Neo6_Win8/x86/Neo6_x86_VPN32.inf index 8b72d019..70566691 100644 --- a/src/bin/hamcore/DriverPackages/Neo6_Win8/x86/Neo6_x86_VPN32.inf +++ b/src/bin/hamcore/DriverPackages/Neo6_Win8/x86/Neo6_x86_VPN32.inf @@ -1,114 +1,114 @@ -; VPN Client Device Driver for Windows 2000 and Greater -; -; Copyright (c) SoftEther Corporation. All Rights Reserved. -; http://www.softether.co.jp/ -; -; BUILD 9658 - -[Version] -Signature = "$Windows NT$" -Class = Net -ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} -Provider = %CompanyName% -DriverVer = 02/04/2018, 4.25.0.9658 -CatalogFile.NT = inf_VPN32.cat - -[Manufacturer] -%CompanyName% = SoftEther - -[SourceDisksNames] -1=%DiskDescription%, "", , - -[SourceDisksFiles] -Neo_VPN32.sys = 1 - -[DestinationDirs] -DefaultDestDir = 12 -Neo.CopyFiles.Sys = 12 - -[Neo.CopyFiles.Sys] -Neo_VPN32.sys, , , 2 - -[SoftEther] -%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN32 - -[NeoAdapter.Install] -Characteristics = 0x1 -AddReg = Neo.Reg, NeoAdapter.Ndi -CopyFiles = Neo.CopyFiles.Sys -*IfType = 53 -*MediaType = 0 -*PhysicalMediaType = 0 - -[NeoAdapter.Install.Services] -AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% - -[NeoAdapter.Ndi] -HKR, , NetworkAddress, 0, %DefaultAddress% -HKR, Ndi, DeviceID, , "NeoAdapter_VPN32" -HKR, , DevLoader, , ndis -HKR, , DeviceVxDs, , Neo_VPN32.sys -HKR, NDIS, LogDriverName, , "Neo_VPN32" -HKR, NDIS, MajorNdisVersion, 1, 5 -HKR, NDIS, MinorNdisVersion, 1, 0 -HKR, Ndi\Interfaces, DefUpper, , "ndis5" -HKR, Ndi\Interfaces, UpperRange, , "ndis5" -HKR, Ndi\Interfaces, LowerRange, , "ethernet" -HKR, Ndi\Interfaces, DefLower, , "ethernet" -HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" -HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% -HKR, Ndi\Params\NetworkAddress, type, 0, "edit" -HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" -HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" -HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% -HKR, Ndi\Params\NetworkAddress, optional, 0, "0" -HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% -HKR, Ndi\Params\MaxSpeed, type, 0, "int" -HKR, Ndi\Params\MaxSpeed, default, 0, "100" -HKR, Ndi\Params\MaxSpeed, min, 0, "0" -HKR, Ndi\Params\MaxSpeed, max, 0, "2000" -HKR, Ndi\Params\MaxSpeed, step, 0, "1" -HKR, Ndi\Params\MaxSpeed, Base, 0, "10" -HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% -HKR, Ndi\Params\KeepLink, type, 0, "enum" -HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% -HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% -HKR, Ndi\Params\KeepLink, default, 0, "0" - - -[Neo.Service] -DisplayName = %Neo.Service.DispName% -Description = %Neo.Service.Desc% -ServiceType = 1 -StartType = 3 -ErrorControl = 1 -ServiceBinary = %12%\Neo_VPN32.sys -LoadOrderGroup = NDIS - -[Neo.Reg] -HKR, Ndi, Service, 0, Neo.Service.Name -HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" -HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" - -[Neo.EventLog] -HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN32.sys" -HKR, , TypesSupported, 0x00010001, 7 - -[Strings] -CompanyName = "SoftEther Corporation" -DiskDescription = "VPN Client Device Driver Install Disk" -Neo.Service.Name = "Neo_VPN32" -Neo.Service.DispName = "VPN Client Device Driver - VPN32" -Neo.Service.Desc = "VPN Client Adapter - VPN32" -NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN32" -Neo.EventLog.Name = "Neo" -NetworkAddress = "MAC Address" -DefaultAddress = "000001000001" -MaxSpeed = "Indicate Speed (Mbps)" -KeepLink = "Keep Link" -On = "On" -Off = "Off" - - -; Auto Generated 20180205_163608.775 - +; VPN Client Device Driver for Windows 2000 and Greater +; +; Copyright (c) SoftEther Corporation. All Rights Reserved. +; http://www.softether.co.jp/ +; +; BUILD 9658 + +[Version] +Signature = "$Windows NT$" +Class = Net +ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} +Provider = %CompanyName% +DriverVer = 02/04/2018, 4.25.0.9658 +CatalogFile.NT = inf_VPN32.cat + +[Manufacturer] +%CompanyName% = SoftEther + +[SourceDisksNames] +1=%DiskDescription%, "", , + +[SourceDisksFiles] +Neo_VPN32.sys = 1 + +[DestinationDirs] +DefaultDestDir = 12 +Neo.CopyFiles.Sys = 12 + +[Neo.CopyFiles.Sys] +Neo_VPN32.sys, , , 2 + +[SoftEther] +%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN32 + +[NeoAdapter.Install] +Characteristics = 0x1 +AddReg = Neo.Reg, NeoAdapter.Ndi +CopyFiles = Neo.CopyFiles.Sys +*IfType = 53 +*MediaType = 0 +*PhysicalMediaType = 0 + +[NeoAdapter.Install.Services] +AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% + +[NeoAdapter.Ndi] +HKR, , NetworkAddress, 0, %DefaultAddress% +HKR, Ndi, DeviceID, , "NeoAdapter_VPN32" +HKR, , DevLoader, , ndis +HKR, , DeviceVxDs, , Neo_VPN32.sys +HKR, NDIS, LogDriverName, , "Neo_VPN32" +HKR, NDIS, MajorNdisVersion, 1, 5 +HKR, NDIS, MinorNdisVersion, 1, 0 +HKR, Ndi\Interfaces, DefUpper, , "ndis5" +HKR, Ndi\Interfaces, UpperRange, , "ndis5" +HKR, Ndi\Interfaces, LowerRange, , "ethernet" +HKR, Ndi\Interfaces, DefLower, , "ethernet" +HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" +HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% +HKR, Ndi\Params\NetworkAddress, type, 0, "edit" +HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" +HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" +HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% +HKR, Ndi\Params\NetworkAddress, optional, 0, "0" +HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% +HKR, Ndi\Params\MaxSpeed, type, 0, "int" +HKR, Ndi\Params\MaxSpeed, default, 0, "100" +HKR, Ndi\Params\MaxSpeed, min, 0, "0" +HKR, Ndi\Params\MaxSpeed, max, 0, "2000" +HKR, Ndi\Params\MaxSpeed, step, 0, "1" +HKR, Ndi\Params\MaxSpeed, Base, 0, "10" +HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% +HKR, Ndi\Params\KeepLink, type, 0, "enum" +HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% +HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% +HKR, Ndi\Params\KeepLink, default, 0, "0" + + +[Neo.Service] +DisplayName = %Neo.Service.DispName% +Description = %Neo.Service.Desc% +ServiceType = 1 +StartType = 3 +ErrorControl = 1 +ServiceBinary = %12%\Neo_VPN32.sys +LoadOrderGroup = NDIS + +[Neo.Reg] +HKR, Ndi, Service, 0, Neo.Service.Name +HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" +HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" + +[Neo.EventLog] +HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN32.sys" +HKR, , TypesSupported, 0x00010001, 7 + +[Strings] +CompanyName = "SoftEther Corporation" +DiskDescription = "VPN Client Device Driver Install Disk" +Neo.Service.Name = "Neo_VPN32" +Neo.Service.DispName = "VPN Client Device Driver - VPN32" +Neo.Service.Desc = "VPN Client Adapter - VPN32" +NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN32" +Neo.EventLog.Name = "Neo" +NetworkAddress = "MAC Address" +DefaultAddress = "000001000001" +MaxSpeed = "Indicate Speed (Mbps)" +KeepLink = "Keep Link" +On = "On" +Off = "Off" + + +; Auto Generated 20180205_163608.775 + diff --git a/src/bin/hamcore/DriverPackages/Neo6_Win8/x86/Neo6_x86_VPN33.inf b/src/bin/hamcore/DriverPackages/Neo6_Win8/x86/Neo6_x86_VPN33.inf index 34b8940a..adc9e19e 100644 --- a/src/bin/hamcore/DriverPackages/Neo6_Win8/x86/Neo6_x86_VPN33.inf +++ b/src/bin/hamcore/DriverPackages/Neo6_Win8/x86/Neo6_x86_VPN33.inf @@ -1,114 +1,114 @@ -; VPN Client Device Driver for Windows 2000 and Greater -; -; Copyright (c) SoftEther Corporation. All Rights Reserved. -; http://www.softether.co.jp/ -; -; BUILD 9658 - -[Version] -Signature = "$Windows NT$" -Class = Net -ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} -Provider = %CompanyName% -DriverVer = 02/04/2018, 4.25.0.9658 -CatalogFile.NT = inf_VPN33.cat - -[Manufacturer] -%CompanyName% = SoftEther - -[SourceDisksNames] -1=%DiskDescription%, "", , - -[SourceDisksFiles] -Neo_VPN33.sys = 1 - -[DestinationDirs] -DefaultDestDir = 12 -Neo.CopyFiles.Sys = 12 - -[Neo.CopyFiles.Sys] -Neo_VPN33.sys, , , 2 - -[SoftEther] -%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN33 - -[NeoAdapter.Install] -Characteristics = 0x1 -AddReg = Neo.Reg, NeoAdapter.Ndi -CopyFiles = Neo.CopyFiles.Sys -*IfType = 53 -*MediaType = 0 -*PhysicalMediaType = 0 - -[NeoAdapter.Install.Services] -AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% - -[NeoAdapter.Ndi] -HKR, , NetworkAddress, 0, %DefaultAddress% -HKR, Ndi, DeviceID, , "NeoAdapter_VPN33" -HKR, , DevLoader, , ndis -HKR, , DeviceVxDs, , Neo_VPN33.sys -HKR, NDIS, LogDriverName, , "Neo_VPN33" -HKR, NDIS, MajorNdisVersion, 1, 5 -HKR, NDIS, MinorNdisVersion, 1, 0 -HKR, Ndi\Interfaces, DefUpper, , "ndis5" -HKR, Ndi\Interfaces, UpperRange, , "ndis5" -HKR, Ndi\Interfaces, LowerRange, , "ethernet" -HKR, Ndi\Interfaces, DefLower, , "ethernet" -HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" -HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% -HKR, Ndi\Params\NetworkAddress, type, 0, "edit" -HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" -HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" -HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% -HKR, Ndi\Params\NetworkAddress, optional, 0, "0" -HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% -HKR, Ndi\Params\MaxSpeed, type, 0, "int" -HKR, Ndi\Params\MaxSpeed, default, 0, "100" -HKR, Ndi\Params\MaxSpeed, min, 0, "0" -HKR, Ndi\Params\MaxSpeed, max, 0, "2000" -HKR, Ndi\Params\MaxSpeed, step, 0, "1" -HKR, Ndi\Params\MaxSpeed, Base, 0, "10" -HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% -HKR, Ndi\Params\KeepLink, type, 0, "enum" -HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% -HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% -HKR, Ndi\Params\KeepLink, default, 0, "0" - - -[Neo.Service] -DisplayName = %Neo.Service.DispName% -Description = %Neo.Service.Desc% -ServiceType = 1 -StartType = 3 -ErrorControl = 1 -ServiceBinary = %12%\Neo_VPN33.sys -LoadOrderGroup = NDIS - -[Neo.Reg] -HKR, Ndi, Service, 0, Neo.Service.Name -HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" -HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" - -[Neo.EventLog] -HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN33.sys" -HKR, , TypesSupported, 0x00010001, 7 - -[Strings] -CompanyName = "SoftEther Corporation" -DiskDescription = "VPN Client Device Driver Install Disk" -Neo.Service.Name = "Neo_VPN33" -Neo.Service.DispName = "VPN Client Device Driver - VPN33" -Neo.Service.Desc = "VPN Client Adapter - VPN33" -NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN33" -Neo.EventLog.Name = "Neo" -NetworkAddress = "MAC Address" -DefaultAddress = "000001000001" -MaxSpeed = "Indicate Speed (Mbps)" -KeepLink = "Keep Link" -On = "On" -Off = "Off" - - -; Auto Generated 20180205_163608.776 - +; VPN Client Device Driver for Windows 2000 and Greater +; +; Copyright (c) SoftEther Corporation. All Rights Reserved. +; http://www.softether.co.jp/ +; +; BUILD 9658 + +[Version] +Signature = "$Windows NT$" +Class = Net +ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} +Provider = %CompanyName% +DriverVer = 02/04/2018, 4.25.0.9658 +CatalogFile.NT = inf_VPN33.cat + +[Manufacturer] +%CompanyName% = SoftEther + +[SourceDisksNames] +1=%DiskDescription%, "", , + +[SourceDisksFiles] +Neo_VPN33.sys = 1 + +[DestinationDirs] +DefaultDestDir = 12 +Neo.CopyFiles.Sys = 12 + +[Neo.CopyFiles.Sys] +Neo_VPN33.sys, , , 2 + +[SoftEther] +%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN33 + +[NeoAdapter.Install] +Characteristics = 0x1 +AddReg = Neo.Reg, NeoAdapter.Ndi +CopyFiles = Neo.CopyFiles.Sys +*IfType = 53 +*MediaType = 0 +*PhysicalMediaType = 0 + +[NeoAdapter.Install.Services] +AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% + +[NeoAdapter.Ndi] +HKR, , NetworkAddress, 0, %DefaultAddress% +HKR, Ndi, DeviceID, , "NeoAdapter_VPN33" +HKR, , DevLoader, , ndis +HKR, , DeviceVxDs, , Neo_VPN33.sys +HKR, NDIS, LogDriverName, , "Neo_VPN33" +HKR, NDIS, MajorNdisVersion, 1, 5 +HKR, NDIS, MinorNdisVersion, 1, 0 +HKR, Ndi\Interfaces, DefUpper, , "ndis5" +HKR, Ndi\Interfaces, UpperRange, , "ndis5" +HKR, Ndi\Interfaces, LowerRange, , "ethernet" +HKR, Ndi\Interfaces, DefLower, , "ethernet" +HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" +HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% +HKR, Ndi\Params\NetworkAddress, type, 0, "edit" +HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" +HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" +HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% +HKR, Ndi\Params\NetworkAddress, optional, 0, "0" +HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% +HKR, Ndi\Params\MaxSpeed, type, 0, "int" +HKR, Ndi\Params\MaxSpeed, default, 0, "100" +HKR, Ndi\Params\MaxSpeed, min, 0, "0" +HKR, Ndi\Params\MaxSpeed, max, 0, "2000" +HKR, Ndi\Params\MaxSpeed, step, 0, "1" +HKR, Ndi\Params\MaxSpeed, Base, 0, "10" +HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% +HKR, Ndi\Params\KeepLink, type, 0, "enum" +HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% +HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% +HKR, Ndi\Params\KeepLink, default, 0, "0" + + +[Neo.Service] +DisplayName = %Neo.Service.DispName% +Description = %Neo.Service.Desc% +ServiceType = 1 +StartType = 3 +ErrorControl = 1 +ServiceBinary = %12%\Neo_VPN33.sys +LoadOrderGroup = NDIS + +[Neo.Reg] +HKR, Ndi, Service, 0, Neo.Service.Name +HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" +HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" + +[Neo.EventLog] +HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN33.sys" +HKR, , TypesSupported, 0x00010001, 7 + +[Strings] +CompanyName = "SoftEther Corporation" +DiskDescription = "VPN Client Device Driver Install Disk" +Neo.Service.Name = "Neo_VPN33" +Neo.Service.DispName = "VPN Client Device Driver - VPN33" +Neo.Service.Desc = "VPN Client Adapter - VPN33" +NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN33" +Neo.EventLog.Name = "Neo" +NetworkAddress = "MAC Address" +DefaultAddress = "000001000001" +MaxSpeed = "Indicate Speed (Mbps)" +KeepLink = "Keep Link" +On = "On" +Off = "Off" + + +; Auto Generated 20180205_163608.776 + diff --git a/src/bin/hamcore/DriverPackages/Neo6_Win8/x86/Neo6_x86_VPN34.inf b/src/bin/hamcore/DriverPackages/Neo6_Win8/x86/Neo6_x86_VPN34.inf index afe8297f..c0574759 100644 --- a/src/bin/hamcore/DriverPackages/Neo6_Win8/x86/Neo6_x86_VPN34.inf +++ b/src/bin/hamcore/DriverPackages/Neo6_Win8/x86/Neo6_x86_VPN34.inf @@ -1,114 +1,114 @@ -; VPN Client Device Driver for Windows 2000 and Greater -; -; Copyright (c) SoftEther Corporation. All Rights Reserved. -; http://www.softether.co.jp/ -; -; BUILD 9658 - -[Version] -Signature = "$Windows NT$" -Class = Net -ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} -Provider = %CompanyName% -DriverVer = 02/04/2018, 4.25.0.9658 -CatalogFile.NT = inf_VPN34.cat - -[Manufacturer] -%CompanyName% = SoftEther - -[SourceDisksNames] -1=%DiskDescription%, "", , - -[SourceDisksFiles] -Neo_VPN34.sys = 1 - -[DestinationDirs] -DefaultDestDir = 12 -Neo.CopyFiles.Sys = 12 - -[Neo.CopyFiles.Sys] -Neo_VPN34.sys, , , 2 - -[SoftEther] -%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN34 - -[NeoAdapter.Install] -Characteristics = 0x1 -AddReg = Neo.Reg, NeoAdapter.Ndi -CopyFiles = Neo.CopyFiles.Sys -*IfType = 53 -*MediaType = 0 -*PhysicalMediaType = 0 - -[NeoAdapter.Install.Services] -AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% - -[NeoAdapter.Ndi] -HKR, , NetworkAddress, 0, %DefaultAddress% -HKR, Ndi, DeviceID, , "NeoAdapter_VPN34" -HKR, , DevLoader, , ndis -HKR, , DeviceVxDs, , Neo_VPN34.sys -HKR, NDIS, LogDriverName, , "Neo_VPN34" -HKR, NDIS, MajorNdisVersion, 1, 5 -HKR, NDIS, MinorNdisVersion, 1, 0 -HKR, Ndi\Interfaces, DefUpper, , "ndis5" -HKR, Ndi\Interfaces, UpperRange, , "ndis5" -HKR, Ndi\Interfaces, LowerRange, , "ethernet" -HKR, Ndi\Interfaces, DefLower, , "ethernet" -HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" -HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% -HKR, Ndi\Params\NetworkAddress, type, 0, "edit" -HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" -HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" -HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% -HKR, Ndi\Params\NetworkAddress, optional, 0, "0" -HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% -HKR, Ndi\Params\MaxSpeed, type, 0, "int" -HKR, Ndi\Params\MaxSpeed, default, 0, "100" -HKR, Ndi\Params\MaxSpeed, min, 0, "0" -HKR, Ndi\Params\MaxSpeed, max, 0, "2000" -HKR, Ndi\Params\MaxSpeed, step, 0, "1" -HKR, Ndi\Params\MaxSpeed, Base, 0, "10" -HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% -HKR, Ndi\Params\KeepLink, type, 0, "enum" -HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% -HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% -HKR, Ndi\Params\KeepLink, default, 0, "0" - - -[Neo.Service] -DisplayName = %Neo.Service.DispName% -Description = %Neo.Service.Desc% -ServiceType = 1 -StartType = 3 -ErrorControl = 1 -ServiceBinary = %12%\Neo_VPN34.sys -LoadOrderGroup = NDIS - -[Neo.Reg] -HKR, Ndi, Service, 0, Neo.Service.Name -HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" -HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" - -[Neo.EventLog] -HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN34.sys" -HKR, , TypesSupported, 0x00010001, 7 - -[Strings] -CompanyName = "SoftEther Corporation" -DiskDescription = "VPN Client Device Driver Install Disk" -Neo.Service.Name = "Neo_VPN34" -Neo.Service.DispName = "VPN Client Device Driver - VPN34" -Neo.Service.Desc = "VPN Client Adapter - VPN34" -NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN34" -Neo.EventLog.Name = "Neo" -NetworkAddress = "MAC Address" -DefaultAddress = "000001000001" -MaxSpeed = "Indicate Speed (Mbps)" -KeepLink = "Keep Link" -On = "On" -Off = "Off" - - -; Auto Generated 20180205_163608.777 - +; VPN Client Device Driver for Windows 2000 and Greater +; +; Copyright (c) SoftEther Corporation. All Rights Reserved. +; http://www.softether.co.jp/ +; +; BUILD 9658 + +[Version] +Signature = "$Windows NT$" +Class = Net +ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} +Provider = %CompanyName% +DriverVer = 02/04/2018, 4.25.0.9658 +CatalogFile.NT = inf_VPN34.cat + +[Manufacturer] +%CompanyName% = SoftEther + +[SourceDisksNames] +1=%DiskDescription%, "", , + +[SourceDisksFiles] +Neo_VPN34.sys = 1 + +[DestinationDirs] +DefaultDestDir = 12 +Neo.CopyFiles.Sys = 12 + +[Neo.CopyFiles.Sys] +Neo_VPN34.sys, , , 2 + +[SoftEther] +%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN34 + +[NeoAdapter.Install] +Characteristics = 0x1 +AddReg = Neo.Reg, NeoAdapter.Ndi +CopyFiles = Neo.CopyFiles.Sys +*IfType = 53 +*MediaType = 0 +*PhysicalMediaType = 0 + +[NeoAdapter.Install.Services] +AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% + +[NeoAdapter.Ndi] +HKR, , NetworkAddress, 0, %DefaultAddress% +HKR, Ndi, DeviceID, , "NeoAdapter_VPN34" +HKR, , DevLoader, , ndis +HKR, , DeviceVxDs, , Neo_VPN34.sys +HKR, NDIS, LogDriverName, , "Neo_VPN34" +HKR, NDIS, MajorNdisVersion, 1, 5 +HKR, NDIS, MinorNdisVersion, 1, 0 +HKR, Ndi\Interfaces, DefUpper, , "ndis5" +HKR, Ndi\Interfaces, UpperRange, , "ndis5" +HKR, Ndi\Interfaces, LowerRange, , "ethernet" +HKR, Ndi\Interfaces, DefLower, , "ethernet" +HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" +HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% +HKR, Ndi\Params\NetworkAddress, type, 0, "edit" +HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" +HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" +HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% +HKR, Ndi\Params\NetworkAddress, optional, 0, "0" +HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% +HKR, Ndi\Params\MaxSpeed, type, 0, "int" +HKR, Ndi\Params\MaxSpeed, default, 0, "100" +HKR, Ndi\Params\MaxSpeed, min, 0, "0" +HKR, Ndi\Params\MaxSpeed, max, 0, "2000" +HKR, Ndi\Params\MaxSpeed, step, 0, "1" +HKR, Ndi\Params\MaxSpeed, Base, 0, "10" +HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% +HKR, Ndi\Params\KeepLink, type, 0, "enum" +HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% +HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% +HKR, Ndi\Params\KeepLink, default, 0, "0" + + +[Neo.Service] +DisplayName = %Neo.Service.DispName% +Description = %Neo.Service.Desc% +ServiceType = 1 +StartType = 3 +ErrorControl = 1 +ServiceBinary = %12%\Neo_VPN34.sys +LoadOrderGroup = NDIS + +[Neo.Reg] +HKR, Ndi, Service, 0, Neo.Service.Name +HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" +HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" + +[Neo.EventLog] +HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN34.sys" +HKR, , TypesSupported, 0x00010001, 7 + +[Strings] +CompanyName = "SoftEther Corporation" +DiskDescription = "VPN Client Device Driver Install Disk" +Neo.Service.Name = "Neo_VPN34" +Neo.Service.DispName = "VPN Client Device Driver - VPN34" +Neo.Service.Desc = "VPN Client Adapter - VPN34" +NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN34" +Neo.EventLog.Name = "Neo" +NetworkAddress = "MAC Address" +DefaultAddress = "000001000001" +MaxSpeed = "Indicate Speed (Mbps)" +KeepLink = "Keep Link" +On = "On" +Off = "Off" + + +; Auto Generated 20180205_163608.777 + diff --git a/src/bin/hamcore/DriverPackages/Neo6_Win8/x86/Neo6_x86_VPN35.inf b/src/bin/hamcore/DriverPackages/Neo6_Win8/x86/Neo6_x86_VPN35.inf index 79055156..c287cc0e 100644 --- a/src/bin/hamcore/DriverPackages/Neo6_Win8/x86/Neo6_x86_VPN35.inf +++ b/src/bin/hamcore/DriverPackages/Neo6_Win8/x86/Neo6_x86_VPN35.inf @@ -1,114 +1,114 @@ -; VPN Client Device Driver for Windows 2000 and Greater -; -; Copyright (c) SoftEther Corporation. All Rights Reserved. -; http://www.softether.co.jp/ -; -; BUILD 9658 - -[Version] -Signature = "$Windows NT$" -Class = Net -ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} -Provider = %CompanyName% -DriverVer = 02/04/2018, 4.25.0.9658 -CatalogFile.NT = inf_VPN35.cat - -[Manufacturer] -%CompanyName% = SoftEther - -[SourceDisksNames] -1=%DiskDescription%, "", , - -[SourceDisksFiles] -Neo_VPN35.sys = 1 - -[DestinationDirs] -DefaultDestDir = 12 -Neo.CopyFiles.Sys = 12 - -[Neo.CopyFiles.Sys] -Neo_VPN35.sys, , , 2 - -[SoftEther] -%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN35 - -[NeoAdapter.Install] -Characteristics = 0x1 -AddReg = Neo.Reg, NeoAdapter.Ndi -CopyFiles = Neo.CopyFiles.Sys -*IfType = 53 -*MediaType = 0 -*PhysicalMediaType = 0 - -[NeoAdapter.Install.Services] -AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% - -[NeoAdapter.Ndi] -HKR, , NetworkAddress, 0, %DefaultAddress% -HKR, Ndi, DeviceID, , "NeoAdapter_VPN35" -HKR, , DevLoader, , ndis -HKR, , DeviceVxDs, , Neo_VPN35.sys -HKR, NDIS, LogDriverName, , "Neo_VPN35" -HKR, NDIS, MajorNdisVersion, 1, 5 -HKR, NDIS, MinorNdisVersion, 1, 0 -HKR, Ndi\Interfaces, DefUpper, , "ndis5" -HKR, Ndi\Interfaces, UpperRange, , "ndis5" -HKR, Ndi\Interfaces, LowerRange, , "ethernet" -HKR, Ndi\Interfaces, DefLower, , "ethernet" -HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" -HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% -HKR, Ndi\Params\NetworkAddress, type, 0, "edit" -HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" -HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" -HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% -HKR, Ndi\Params\NetworkAddress, optional, 0, "0" -HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% -HKR, Ndi\Params\MaxSpeed, type, 0, "int" -HKR, Ndi\Params\MaxSpeed, default, 0, "100" -HKR, Ndi\Params\MaxSpeed, min, 0, "0" -HKR, Ndi\Params\MaxSpeed, max, 0, "2000" -HKR, Ndi\Params\MaxSpeed, step, 0, "1" -HKR, Ndi\Params\MaxSpeed, Base, 0, "10" -HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% -HKR, Ndi\Params\KeepLink, type, 0, "enum" -HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% -HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% -HKR, Ndi\Params\KeepLink, default, 0, "0" - - -[Neo.Service] -DisplayName = %Neo.Service.DispName% -Description = %Neo.Service.Desc% -ServiceType = 1 -StartType = 3 -ErrorControl = 1 -ServiceBinary = %12%\Neo_VPN35.sys -LoadOrderGroup = NDIS - -[Neo.Reg] -HKR, Ndi, Service, 0, Neo.Service.Name -HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" -HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" - -[Neo.EventLog] -HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN35.sys" -HKR, , TypesSupported, 0x00010001, 7 - -[Strings] -CompanyName = "SoftEther Corporation" -DiskDescription = "VPN Client Device Driver Install Disk" -Neo.Service.Name = "Neo_VPN35" -Neo.Service.DispName = "VPN Client Device Driver - VPN35" -Neo.Service.Desc = "VPN Client Adapter - VPN35" -NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN35" -Neo.EventLog.Name = "Neo" -NetworkAddress = "MAC Address" -DefaultAddress = "000001000001" -MaxSpeed = "Indicate Speed (Mbps)" -KeepLink = "Keep Link" -On = "On" -Off = "Off" - - -; Auto Generated 20180205_163608.778 - +; VPN Client Device Driver for Windows 2000 and Greater +; +; Copyright (c) SoftEther Corporation. All Rights Reserved. +; http://www.softether.co.jp/ +; +; BUILD 9658 + +[Version] +Signature = "$Windows NT$" +Class = Net +ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} +Provider = %CompanyName% +DriverVer = 02/04/2018, 4.25.0.9658 +CatalogFile.NT = inf_VPN35.cat + +[Manufacturer] +%CompanyName% = SoftEther + +[SourceDisksNames] +1=%DiskDescription%, "", , + +[SourceDisksFiles] +Neo_VPN35.sys = 1 + +[DestinationDirs] +DefaultDestDir = 12 +Neo.CopyFiles.Sys = 12 + +[Neo.CopyFiles.Sys] +Neo_VPN35.sys, , , 2 + +[SoftEther] +%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN35 + +[NeoAdapter.Install] +Characteristics = 0x1 +AddReg = Neo.Reg, NeoAdapter.Ndi +CopyFiles = Neo.CopyFiles.Sys +*IfType = 53 +*MediaType = 0 +*PhysicalMediaType = 0 + +[NeoAdapter.Install.Services] +AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% + +[NeoAdapter.Ndi] +HKR, , NetworkAddress, 0, %DefaultAddress% +HKR, Ndi, DeviceID, , "NeoAdapter_VPN35" +HKR, , DevLoader, , ndis +HKR, , DeviceVxDs, , Neo_VPN35.sys +HKR, NDIS, LogDriverName, , "Neo_VPN35" +HKR, NDIS, MajorNdisVersion, 1, 5 +HKR, NDIS, MinorNdisVersion, 1, 0 +HKR, Ndi\Interfaces, DefUpper, , "ndis5" +HKR, Ndi\Interfaces, UpperRange, , "ndis5" +HKR, Ndi\Interfaces, LowerRange, , "ethernet" +HKR, Ndi\Interfaces, DefLower, , "ethernet" +HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" +HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% +HKR, Ndi\Params\NetworkAddress, type, 0, "edit" +HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" +HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" +HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% +HKR, Ndi\Params\NetworkAddress, optional, 0, "0" +HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% +HKR, Ndi\Params\MaxSpeed, type, 0, "int" +HKR, Ndi\Params\MaxSpeed, default, 0, "100" +HKR, Ndi\Params\MaxSpeed, min, 0, "0" +HKR, Ndi\Params\MaxSpeed, max, 0, "2000" +HKR, Ndi\Params\MaxSpeed, step, 0, "1" +HKR, Ndi\Params\MaxSpeed, Base, 0, "10" +HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% +HKR, Ndi\Params\KeepLink, type, 0, "enum" +HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% +HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% +HKR, Ndi\Params\KeepLink, default, 0, "0" + + +[Neo.Service] +DisplayName = %Neo.Service.DispName% +Description = %Neo.Service.Desc% +ServiceType = 1 +StartType = 3 +ErrorControl = 1 +ServiceBinary = %12%\Neo_VPN35.sys +LoadOrderGroup = NDIS + +[Neo.Reg] +HKR, Ndi, Service, 0, Neo.Service.Name +HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" +HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" + +[Neo.EventLog] +HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN35.sys" +HKR, , TypesSupported, 0x00010001, 7 + +[Strings] +CompanyName = "SoftEther Corporation" +DiskDescription = "VPN Client Device Driver Install Disk" +Neo.Service.Name = "Neo_VPN35" +Neo.Service.DispName = "VPN Client Device Driver - VPN35" +Neo.Service.Desc = "VPN Client Adapter - VPN35" +NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN35" +Neo.EventLog.Name = "Neo" +NetworkAddress = "MAC Address" +DefaultAddress = "000001000001" +MaxSpeed = "Indicate Speed (Mbps)" +KeepLink = "Keep Link" +On = "On" +Off = "Off" + + +; Auto Generated 20180205_163608.778 + diff --git a/src/bin/hamcore/DriverPackages/Neo6_Win8/x86/Neo6_x86_VPN36.inf b/src/bin/hamcore/DriverPackages/Neo6_Win8/x86/Neo6_x86_VPN36.inf index 805d51bd..d5462e49 100644 --- a/src/bin/hamcore/DriverPackages/Neo6_Win8/x86/Neo6_x86_VPN36.inf +++ b/src/bin/hamcore/DriverPackages/Neo6_Win8/x86/Neo6_x86_VPN36.inf @@ -1,114 +1,114 @@ -; VPN Client Device Driver for Windows 2000 and Greater -; -; Copyright (c) SoftEther Corporation. All Rights Reserved. -; http://www.softether.co.jp/ -; -; BUILD 9658 - -[Version] -Signature = "$Windows NT$" -Class = Net -ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} -Provider = %CompanyName% -DriverVer = 02/04/2018, 4.25.0.9658 -CatalogFile.NT = inf_VPN36.cat - -[Manufacturer] -%CompanyName% = SoftEther - -[SourceDisksNames] -1=%DiskDescription%, "", , - -[SourceDisksFiles] -Neo_VPN36.sys = 1 - -[DestinationDirs] -DefaultDestDir = 12 -Neo.CopyFiles.Sys = 12 - -[Neo.CopyFiles.Sys] -Neo_VPN36.sys, , , 2 - -[SoftEther] -%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN36 - -[NeoAdapter.Install] -Characteristics = 0x1 -AddReg = Neo.Reg, NeoAdapter.Ndi -CopyFiles = Neo.CopyFiles.Sys -*IfType = 53 -*MediaType = 0 -*PhysicalMediaType = 0 - -[NeoAdapter.Install.Services] -AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% - -[NeoAdapter.Ndi] -HKR, , NetworkAddress, 0, %DefaultAddress% -HKR, Ndi, DeviceID, , "NeoAdapter_VPN36" -HKR, , DevLoader, , ndis -HKR, , DeviceVxDs, , Neo_VPN36.sys -HKR, NDIS, LogDriverName, , "Neo_VPN36" -HKR, NDIS, MajorNdisVersion, 1, 5 -HKR, NDIS, MinorNdisVersion, 1, 0 -HKR, Ndi\Interfaces, DefUpper, , "ndis5" -HKR, Ndi\Interfaces, UpperRange, , "ndis5" -HKR, Ndi\Interfaces, LowerRange, , "ethernet" -HKR, Ndi\Interfaces, DefLower, , "ethernet" -HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" -HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% -HKR, Ndi\Params\NetworkAddress, type, 0, "edit" -HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" -HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" -HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% -HKR, Ndi\Params\NetworkAddress, optional, 0, "0" -HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% -HKR, Ndi\Params\MaxSpeed, type, 0, "int" -HKR, Ndi\Params\MaxSpeed, default, 0, "100" -HKR, Ndi\Params\MaxSpeed, min, 0, "0" -HKR, Ndi\Params\MaxSpeed, max, 0, "2000" -HKR, Ndi\Params\MaxSpeed, step, 0, "1" -HKR, Ndi\Params\MaxSpeed, Base, 0, "10" -HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% -HKR, Ndi\Params\KeepLink, type, 0, "enum" -HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% -HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% -HKR, Ndi\Params\KeepLink, default, 0, "0" - - -[Neo.Service] -DisplayName = %Neo.Service.DispName% -Description = %Neo.Service.Desc% -ServiceType = 1 -StartType = 3 -ErrorControl = 1 -ServiceBinary = %12%\Neo_VPN36.sys -LoadOrderGroup = NDIS - -[Neo.Reg] -HKR, Ndi, Service, 0, Neo.Service.Name -HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" -HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" - -[Neo.EventLog] -HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN36.sys" -HKR, , TypesSupported, 0x00010001, 7 - -[Strings] -CompanyName = "SoftEther Corporation" -DiskDescription = "VPN Client Device Driver Install Disk" -Neo.Service.Name = "Neo_VPN36" -Neo.Service.DispName = "VPN Client Device Driver - VPN36" -Neo.Service.Desc = "VPN Client Adapter - VPN36" -NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN36" -Neo.EventLog.Name = "Neo" -NetworkAddress = "MAC Address" -DefaultAddress = "000001000001" -MaxSpeed = "Indicate Speed (Mbps)" -KeepLink = "Keep Link" -On = "On" -Off = "Off" - - -; Auto Generated 20180205_163608.783 - +; VPN Client Device Driver for Windows 2000 and Greater +; +; Copyright (c) SoftEther Corporation. All Rights Reserved. +; http://www.softether.co.jp/ +; +; BUILD 9658 + +[Version] +Signature = "$Windows NT$" +Class = Net +ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} +Provider = %CompanyName% +DriverVer = 02/04/2018, 4.25.0.9658 +CatalogFile.NT = inf_VPN36.cat + +[Manufacturer] +%CompanyName% = SoftEther + +[SourceDisksNames] +1=%DiskDescription%, "", , + +[SourceDisksFiles] +Neo_VPN36.sys = 1 + +[DestinationDirs] +DefaultDestDir = 12 +Neo.CopyFiles.Sys = 12 + +[Neo.CopyFiles.Sys] +Neo_VPN36.sys, , , 2 + +[SoftEther] +%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN36 + +[NeoAdapter.Install] +Characteristics = 0x1 +AddReg = Neo.Reg, NeoAdapter.Ndi +CopyFiles = Neo.CopyFiles.Sys +*IfType = 53 +*MediaType = 0 +*PhysicalMediaType = 0 + +[NeoAdapter.Install.Services] +AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% + +[NeoAdapter.Ndi] +HKR, , NetworkAddress, 0, %DefaultAddress% +HKR, Ndi, DeviceID, , "NeoAdapter_VPN36" +HKR, , DevLoader, , ndis +HKR, , DeviceVxDs, , Neo_VPN36.sys +HKR, NDIS, LogDriverName, , "Neo_VPN36" +HKR, NDIS, MajorNdisVersion, 1, 5 +HKR, NDIS, MinorNdisVersion, 1, 0 +HKR, Ndi\Interfaces, DefUpper, , "ndis5" +HKR, Ndi\Interfaces, UpperRange, , "ndis5" +HKR, Ndi\Interfaces, LowerRange, , "ethernet" +HKR, Ndi\Interfaces, DefLower, , "ethernet" +HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" +HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% +HKR, Ndi\Params\NetworkAddress, type, 0, "edit" +HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" +HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" +HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% +HKR, Ndi\Params\NetworkAddress, optional, 0, "0" +HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% +HKR, Ndi\Params\MaxSpeed, type, 0, "int" +HKR, Ndi\Params\MaxSpeed, default, 0, "100" +HKR, Ndi\Params\MaxSpeed, min, 0, "0" +HKR, Ndi\Params\MaxSpeed, max, 0, "2000" +HKR, Ndi\Params\MaxSpeed, step, 0, "1" +HKR, Ndi\Params\MaxSpeed, Base, 0, "10" +HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% +HKR, Ndi\Params\KeepLink, type, 0, "enum" +HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% +HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% +HKR, Ndi\Params\KeepLink, default, 0, "0" + + +[Neo.Service] +DisplayName = %Neo.Service.DispName% +Description = %Neo.Service.Desc% +ServiceType = 1 +StartType = 3 +ErrorControl = 1 +ServiceBinary = %12%\Neo_VPN36.sys +LoadOrderGroup = NDIS + +[Neo.Reg] +HKR, Ndi, Service, 0, Neo.Service.Name +HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" +HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" + +[Neo.EventLog] +HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN36.sys" +HKR, , TypesSupported, 0x00010001, 7 + +[Strings] +CompanyName = "SoftEther Corporation" +DiskDescription = "VPN Client Device Driver Install Disk" +Neo.Service.Name = "Neo_VPN36" +Neo.Service.DispName = "VPN Client Device Driver - VPN36" +Neo.Service.Desc = "VPN Client Adapter - VPN36" +NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN36" +Neo.EventLog.Name = "Neo" +NetworkAddress = "MAC Address" +DefaultAddress = "000001000001" +MaxSpeed = "Indicate Speed (Mbps)" +KeepLink = "Keep Link" +On = "On" +Off = "Off" + + +; Auto Generated 20180205_163608.783 + diff --git a/src/bin/hamcore/DriverPackages/Neo6_Win8/x86/Neo6_x86_VPN37.inf b/src/bin/hamcore/DriverPackages/Neo6_Win8/x86/Neo6_x86_VPN37.inf index 4e467120..1d9a916f 100644 --- a/src/bin/hamcore/DriverPackages/Neo6_Win8/x86/Neo6_x86_VPN37.inf +++ b/src/bin/hamcore/DriverPackages/Neo6_Win8/x86/Neo6_x86_VPN37.inf @@ -1,114 +1,114 @@ -; VPN Client Device Driver for Windows 2000 and Greater -; -; Copyright (c) SoftEther Corporation. All Rights Reserved. -; http://www.softether.co.jp/ -; -; BUILD 9658 - -[Version] -Signature = "$Windows NT$" -Class = Net -ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} -Provider = %CompanyName% -DriverVer = 02/04/2018, 4.25.0.9658 -CatalogFile.NT = inf_VPN37.cat - -[Manufacturer] -%CompanyName% = SoftEther - -[SourceDisksNames] -1=%DiskDescription%, "", , - -[SourceDisksFiles] -Neo_VPN37.sys = 1 - -[DestinationDirs] -DefaultDestDir = 12 -Neo.CopyFiles.Sys = 12 - -[Neo.CopyFiles.Sys] -Neo_VPN37.sys, , , 2 - -[SoftEther] -%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN37 - -[NeoAdapter.Install] -Characteristics = 0x1 -AddReg = Neo.Reg, NeoAdapter.Ndi -CopyFiles = Neo.CopyFiles.Sys -*IfType = 53 -*MediaType = 0 -*PhysicalMediaType = 0 - -[NeoAdapter.Install.Services] -AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% - -[NeoAdapter.Ndi] -HKR, , NetworkAddress, 0, %DefaultAddress% -HKR, Ndi, DeviceID, , "NeoAdapter_VPN37" -HKR, , DevLoader, , ndis -HKR, , DeviceVxDs, , Neo_VPN37.sys -HKR, NDIS, LogDriverName, , "Neo_VPN37" -HKR, NDIS, MajorNdisVersion, 1, 5 -HKR, NDIS, MinorNdisVersion, 1, 0 -HKR, Ndi\Interfaces, DefUpper, , "ndis5" -HKR, Ndi\Interfaces, UpperRange, , "ndis5" -HKR, Ndi\Interfaces, LowerRange, , "ethernet" -HKR, Ndi\Interfaces, DefLower, , "ethernet" -HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" -HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% -HKR, Ndi\Params\NetworkAddress, type, 0, "edit" -HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" -HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" -HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% -HKR, Ndi\Params\NetworkAddress, optional, 0, "0" -HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% -HKR, Ndi\Params\MaxSpeed, type, 0, "int" -HKR, Ndi\Params\MaxSpeed, default, 0, "100" -HKR, Ndi\Params\MaxSpeed, min, 0, "0" -HKR, Ndi\Params\MaxSpeed, max, 0, "2000" -HKR, Ndi\Params\MaxSpeed, step, 0, "1" -HKR, Ndi\Params\MaxSpeed, Base, 0, "10" -HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% -HKR, Ndi\Params\KeepLink, type, 0, "enum" -HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% -HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% -HKR, Ndi\Params\KeepLink, default, 0, "0" - - -[Neo.Service] -DisplayName = %Neo.Service.DispName% -Description = %Neo.Service.Desc% -ServiceType = 1 -StartType = 3 -ErrorControl = 1 -ServiceBinary = %12%\Neo_VPN37.sys -LoadOrderGroup = NDIS - -[Neo.Reg] -HKR, Ndi, Service, 0, Neo.Service.Name -HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" -HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" - -[Neo.EventLog] -HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN37.sys" -HKR, , TypesSupported, 0x00010001, 7 - -[Strings] -CompanyName = "SoftEther Corporation" -DiskDescription = "VPN Client Device Driver Install Disk" -Neo.Service.Name = "Neo_VPN37" -Neo.Service.DispName = "VPN Client Device Driver - VPN37" -Neo.Service.Desc = "VPN Client Adapter - VPN37" -NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN37" -Neo.EventLog.Name = "Neo" -NetworkAddress = "MAC Address" -DefaultAddress = "000001000001" -MaxSpeed = "Indicate Speed (Mbps)" -KeepLink = "Keep Link" -On = "On" -Off = "Off" - - -; Auto Generated 20180205_163608.784 - +; VPN Client Device Driver for Windows 2000 and Greater +; +; Copyright (c) SoftEther Corporation. All Rights Reserved. +; http://www.softether.co.jp/ +; +; BUILD 9658 + +[Version] +Signature = "$Windows NT$" +Class = Net +ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} +Provider = %CompanyName% +DriverVer = 02/04/2018, 4.25.0.9658 +CatalogFile.NT = inf_VPN37.cat + +[Manufacturer] +%CompanyName% = SoftEther + +[SourceDisksNames] +1=%DiskDescription%, "", , + +[SourceDisksFiles] +Neo_VPN37.sys = 1 + +[DestinationDirs] +DefaultDestDir = 12 +Neo.CopyFiles.Sys = 12 + +[Neo.CopyFiles.Sys] +Neo_VPN37.sys, , , 2 + +[SoftEther] +%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN37 + +[NeoAdapter.Install] +Characteristics = 0x1 +AddReg = Neo.Reg, NeoAdapter.Ndi +CopyFiles = Neo.CopyFiles.Sys +*IfType = 53 +*MediaType = 0 +*PhysicalMediaType = 0 + +[NeoAdapter.Install.Services] +AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% + +[NeoAdapter.Ndi] +HKR, , NetworkAddress, 0, %DefaultAddress% +HKR, Ndi, DeviceID, , "NeoAdapter_VPN37" +HKR, , DevLoader, , ndis +HKR, , DeviceVxDs, , Neo_VPN37.sys +HKR, NDIS, LogDriverName, , "Neo_VPN37" +HKR, NDIS, MajorNdisVersion, 1, 5 +HKR, NDIS, MinorNdisVersion, 1, 0 +HKR, Ndi\Interfaces, DefUpper, , "ndis5" +HKR, Ndi\Interfaces, UpperRange, , "ndis5" +HKR, Ndi\Interfaces, LowerRange, , "ethernet" +HKR, Ndi\Interfaces, DefLower, , "ethernet" +HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" +HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% +HKR, Ndi\Params\NetworkAddress, type, 0, "edit" +HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" +HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" +HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% +HKR, Ndi\Params\NetworkAddress, optional, 0, "0" +HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% +HKR, Ndi\Params\MaxSpeed, type, 0, "int" +HKR, Ndi\Params\MaxSpeed, default, 0, "100" +HKR, Ndi\Params\MaxSpeed, min, 0, "0" +HKR, Ndi\Params\MaxSpeed, max, 0, "2000" +HKR, Ndi\Params\MaxSpeed, step, 0, "1" +HKR, Ndi\Params\MaxSpeed, Base, 0, "10" +HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% +HKR, Ndi\Params\KeepLink, type, 0, "enum" +HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% +HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% +HKR, Ndi\Params\KeepLink, default, 0, "0" + + +[Neo.Service] +DisplayName = %Neo.Service.DispName% +Description = %Neo.Service.Desc% +ServiceType = 1 +StartType = 3 +ErrorControl = 1 +ServiceBinary = %12%\Neo_VPN37.sys +LoadOrderGroup = NDIS + +[Neo.Reg] +HKR, Ndi, Service, 0, Neo.Service.Name +HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" +HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" + +[Neo.EventLog] +HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN37.sys" +HKR, , TypesSupported, 0x00010001, 7 + +[Strings] +CompanyName = "SoftEther Corporation" +DiskDescription = "VPN Client Device Driver Install Disk" +Neo.Service.Name = "Neo_VPN37" +Neo.Service.DispName = "VPN Client Device Driver - VPN37" +Neo.Service.Desc = "VPN Client Adapter - VPN37" +NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN37" +Neo.EventLog.Name = "Neo" +NetworkAddress = "MAC Address" +DefaultAddress = "000001000001" +MaxSpeed = "Indicate Speed (Mbps)" +KeepLink = "Keep Link" +On = "On" +Off = "Off" + + +; Auto Generated 20180205_163608.784 + diff --git a/src/bin/hamcore/DriverPackages/Neo6_Win8/x86/Neo6_x86_VPN38.inf b/src/bin/hamcore/DriverPackages/Neo6_Win8/x86/Neo6_x86_VPN38.inf index 4711a340..bd701650 100644 --- a/src/bin/hamcore/DriverPackages/Neo6_Win8/x86/Neo6_x86_VPN38.inf +++ b/src/bin/hamcore/DriverPackages/Neo6_Win8/x86/Neo6_x86_VPN38.inf @@ -1,114 +1,114 @@ -; VPN Client Device Driver for Windows 2000 and Greater -; -; Copyright (c) SoftEther Corporation. All Rights Reserved. -; http://www.softether.co.jp/ -; -; BUILD 9658 - -[Version] -Signature = "$Windows NT$" -Class = Net -ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} -Provider = %CompanyName% -DriverVer = 02/04/2018, 4.25.0.9658 -CatalogFile.NT = inf_VPN38.cat - -[Manufacturer] -%CompanyName% = SoftEther - -[SourceDisksNames] -1=%DiskDescription%, "", , - -[SourceDisksFiles] -Neo_VPN38.sys = 1 - -[DestinationDirs] -DefaultDestDir = 12 -Neo.CopyFiles.Sys = 12 - -[Neo.CopyFiles.Sys] -Neo_VPN38.sys, , , 2 - -[SoftEther] -%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN38 - -[NeoAdapter.Install] -Characteristics = 0x1 -AddReg = Neo.Reg, NeoAdapter.Ndi -CopyFiles = Neo.CopyFiles.Sys -*IfType = 53 -*MediaType = 0 -*PhysicalMediaType = 0 - -[NeoAdapter.Install.Services] -AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% - -[NeoAdapter.Ndi] -HKR, , NetworkAddress, 0, %DefaultAddress% -HKR, Ndi, DeviceID, , "NeoAdapter_VPN38" -HKR, , DevLoader, , ndis -HKR, , DeviceVxDs, , Neo_VPN38.sys -HKR, NDIS, LogDriverName, , "Neo_VPN38" -HKR, NDIS, MajorNdisVersion, 1, 5 -HKR, NDIS, MinorNdisVersion, 1, 0 -HKR, Ndi\Interfaces, DefUpper, , "ndis5" -HKR, Ndi\Interfaces, UpperRange, , "ndis5" -HKR, Ndi\Interfaces, LowerRange, , "ethernet" -HKR, Ndi\Interfaces, DefLower, , "ethernet" -HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" -HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% -HKR, Ndi\Params\NetworkAddress, type, 0, "edit" -HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" -HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" -HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% -HKR, Ndi\Params\NetworkAddress, optional, 0, "0" -HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% -HKR, Ndi\Params\MaxSpeed, type, 0, "int" -HKR, Ndi\Params\MaxSpeed, default, 0, "100" -HKR, Ndi\Params\MaxSpeed, min, 0, "0" -HKR, Ndi\Params\MaxSpeed, max, 0, "2000" -HKR, Ndi\Params\MaxSpeed, step, 0, "1" -HKR, Ndi\Params\MaxSpeed, Base, 0, "10" -HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% -HKR, Ndi\Params\KeepLink, type, 0, "enum" -HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% -HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% -HKR, Ndi\Params\KeepLink, default, 0, "0" - - -[Neo.Service] -DisplayName = %Neo.Service.DispName% -Description = %Neo.Service.Desc% -ServiceType = 1 -StartType = 3 -ErrorControl = 1 -ServiceBinary = %12%\Neo_VPN38.sys -LoadOrderGroup = NDIS - -[Neo.Reg] -HKR, Ndi, Service, 0, Neo.Service.Name -HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" -HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" - -[Neo.EventLog] -HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN38.sys" -HKR, , TypesSupported, 0x00010001, 7 - -[Strings] -CompanyName = "SoftEther Corporation" -DiskDescription = "VPN Client Device Driver Install Disk" -Neo.Service.Name = "Neo_VPN38" -Neo.Service.DispName = "VPN Client Device Driver - VPN38" -Neo.Service.Desc = "VPN Client Adapter - VPN38" -NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN38" -Neo.EventLog.Name = "Neo" -NetworkAddress = "MAC Address" -DefaultAddress = "000001000001" -MaxSpeed = "Indicate Speed (Mbps)" -KeepLink = "Keep Link" -On = "On" -Off = "Off" - - -; Auto Generated 20180205_163608.784 - +; VPN Client Device Driver for Windows 2000 and Greater +; +; Copyright (c) SoftEther Corporation. All Rights Reserved. +; http://www.softether.co.jp/ +; +; BUILD 9658 + +[Version] +Signature = "$Windows NT$" +Class = Net +ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} +Provider = %CompanyName% +DriverVer = 02/04/2018, 4.25.0.9658 +CatalogFile.NT = inf_VPN38.cat + +[Manufacturer] +%CompanyName% = SoftEther + +[SourceDisksNames] +1=%DiskDescription%, "", , + +[SourceDisksFiles] +Neo_VPN38.sys = 1 + +[DestinationDirs] +DefaultDestDir = 12 +Neo.CopyFiles.Sys = 12 + +[Neo.CopyFiles.Sys] +Neo_VPN38.sys, , , 2 + +[SoftEther] +%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN38 + +[NeoAdapter.Install] +Characteristics = 0x1 +AddReg = Neo.Reg, NeoAdapter.Ndi +CopyFiles = Neo.CopyFiles.Sys +*IfType = 53 +*MediaType = 0 +*PhysicalMediaType = 0 + +[NeoAdapter.Install.Services] +AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% + +[NeoAdapter.Ndi] +HKR, , NetworkAddress, 0, %DefaultAddress% +HKR, Ndi, DeviceID, , "NeoAdapter_VPN38" +HKR, , DevLoader, , ndis +HKR, , DeviceVxDs, , Neo_VPN38.sys +HKR, NDIS, LogDriverName, , "Neo_VPN38" +HKR, NDIS, MajorNdisVersion, 1, 5 +HKR, NDIS, MinorNdisVersion, 1, 0 +HKR, Ndi\Interfaces, DefUpper, , "ndis5" +HKR, Ndi\Interfaces, UpperRange, , "ndis5" +HKR, Ndi\Interfaces, LowerRange, , "ethernet" +HKR, Ndi\Interfaces, DefLower, , "ethernet" +HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" +HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% +HKR, Ndi\Params\NetworkAddress, type, 0, "edit" +HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" +HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" +HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% +HKR, Ndi\Params\NetworkAddress, optional, 0, "0" +HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% +HKR, Ndi\Params\MaxSpeed, type, 0, "int" +HKR, Ndi\Params\MaxSpeed, default, 0, "100" +HKR, Ndi\Params\MaxSpeed, min, 0, "0" +HKR, Ndi\Params\MaxSpeed, max, 0, "2000" +HKR, Ndi\Params\MaxSpeed, step, 0, "1" +HKR, Ndi\Params\MaxSpeed, Base, 0, "10" +HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% +HKR, Ndi\Params\KeepLink, type, 0, "enum" +HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% +HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% +HKR, Ndi\Params\KeepLink, default, 0, "0" + + +[Neo.Service] +DisplayName = %Neo.Service.DispName% +Description = %Neo.Service.Desc% +ServiceType = 1 +StartType = 3 +ErrorControl = 1 +ServiceBinary = %12%\Neo_VPN38.sys +LoadOrderGroup = NDIS + +[Neo.Reg] +HKR, Ndi, Service, 0, Neo.Service.Name +HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" +HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" + +[Neo.EventLog] +HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN38.sys" +HKR, , TypesSupported, 0x00010001, 7 + +[Strings] +CompanyName = "SoftEther Corporation" +DiskDescription = "VPN Client Device Driver Install Disk" +Neo.Service.Name = "Neo_VPN38" +Neo.Service.DispName = "VPN Client Device Driver - VPN38" +Neo.Service.Desc = "VPN Client Adapter - VPN38" +NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN38" +Neo.EventLog.Name = "Neo" +NetworkAddress = "MAC Address" +DefaultAddress = "000001000001" +MaxSpeed = "Indicate Speed (Mbps)" +KeepLink = "Keep Link" +On = "On" +Off = "Off" + + +; Auto Generated 20180205_163608.784 + diff --git a/src/bin/hamcore/DriverPackages/Neo6_Win8/x86/Neo6_x86_VPN39.inf b/src/bin/hamcore/DriverPackages/Neo6_Win8/x86/Neo6_x86_VPN39.inf index aa295b0b..0afd38d4 100644 --- a/src/bin/hamcore/DriverPackages/Neo6_Win8/x86/Neo6_x86_VPN39.inf +++ b/src/bin/hamcore/DriverPackages/Neo6_Win8/x86/Neo6_x86_VPN39.inf @@ -1,114 +1,114 @@ -; VPN Client Device Driver for Windows 2000 and Greater -; -; Copyright (c) SoftEther Corporation. All Rights Reserved. -; http://www.softether.co.jp/ -; -; BUILD 9658 - -[Version] -Signature = "$Windows NT$" -Class = Net -ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} -Provider = %CompanyName% -DriverVer = 02/04/2018, 4.25.0.9658 -CatalogFile.NT = inf_VPN39.cat - -[Manufacturer] -%CompanyName% = SoftEther - -[SourceDisksNames] -1=%DiskDescription%, "", , - -[SourceDisksFiles] -Neo_VPN39.sys = 1 - -[DestinationDirs] -DefaultDestDir = 12 -Neo.CopyFiles.Sys = 12 - -[Neo.CopyFiles.Sys] -Neo_VPN39.sys, , , 2 - -[SoftEther] -%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN39 - -[NeoAdapter.Install] -Characteristics = 0x1 -AddReg = Neo.Reg, NeoAdapter.Ndi -CopyFiles = Neo.CopyFiles.Sys -*IfType = 53 -*MediaType = 0 -*PhysicalMediaType = 0 - -[NeoAdapter.Install.Services] -AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% - -[NeoAdapter.Ndi] -HKR, , NetworkAddress, 0, %DefaultAddress% -HKR, Ndi, DeviceID, , "NeoAdapter_VPN39" -HKR, , DevLoader, , ndis -HKR, , DeviceVxDs, , Neo_VPN39.sys -HKR, NDIS, LogDriverName, , "Neo_VPN39" -HKR, NDIS, MajorNdisVersion, 1, 5 -HKR, NDIS, MinorNdisVersion, 1, 0 -HKR, Ndi\Interfaces, DefUpper, , "ndis5" -HKR, Ndi\Interfaces, UpperRange, , "ndis5" -HKR, Ndi\Interfaces, LowerRange, , "ethernet" -HKR, Ndi\Interfaces, DefLower, , "ethernet" -HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" -HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% -HKR, Ndi\Params\NetworkAddress, type, 0, "edit" -HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" -HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" -HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% -HKR, Ndi\Params\NetworkAddress, optional, 0, "0" -HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% -HKR, Ndi\Params\MaxSpeed, type, 0, "int" -HKR, Ndi\Params\MaxSpeed, default, 0, "100" -HKR, Ndi\Params\MaxSpeed, min, 0, "0" -HKR, Ndi\Params\MaxSpeed, max, 0, "2000" -HKR, Ndi\Params\MaxSpeed, step, 0, "1" -HKR, Ndi\Params\MaxSpeed, Base, 0, "10" -HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% -HKR, Ndi\Params\KeepLink, type, 0, "enum" -HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% -HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% -HKR, Ndi\Params\KeepLink, default, 0, "0" - - -[Neo.Service] -DisplayName = %Neo.Service.DispName% -Description = %Neo.Service.Desc% -ServiceType = 1 -StartType = 3 -ErrorControl = 1 -ServiceBinary = %12%\Neo_VPN39.sys -LoadOrderGroup = NDIS - -[Neo.Reg] -HKR, Ndi, Service, 0, Neo.Service.Name -HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" -HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" - -[Neo.EventLog] -HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN39.sys" -HKR, , TypesSupported, 0x00010001, 7 - -[Strings] -CompanyName = "SoftEther Corporation" -DiskDescription = "VPN Client Device Driver Install Disk" -Neo.Service.Name = "Neo_VPN39" -Neo.Service.DispName = "VPN Client Device Driver - VPN39" -Neo.Service.Desc = "VPN Client Adapter - VPN39" -NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN39" -Neo.EventLog.Name = "Neo" -NetworkAddress = "MAC Address" -DefaultAddress = "000001000001" -MaxSpeed = "Indicate Speed (Mbps)" -KeepLink = "Keep Link" -On = "On" -Off = "Off" - - -; Auto Generated 20180205_163608.785 - +; VPN Client Device Driver for Windows 2000 and Greater +; +; Copyright (c) SoftEther Corporation. All Rights Reserved. +; http://www.softether.co.jp/ +; +; BUILD 9658 + +[Version] +Signature = "$Windows NT$" +Class = Net +ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} +Provider = %CompanyName% +DriverVer = 02/04/2018, 4.25.0.9658 +CatalogFile.NT = inf_VPN39.cat + +[Manufacturer] +%CompanyName% = SoftEther + +[SourceDisksNames] +1=%DiskDescription%, "", , + +[SourceDisksFiles] +Neo_VPN39.sys = 1 + +[DestinationDirs] +DefaultDestDir = 12 +Neo.CopyFiles.Sys = 12 + +[Neo.CopyFiles.Sys] +Neo_VPN39.sys, , , 2 + +[SoftEther] +%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN39 + +[NeoAdapter.Install] +Characteristics = 0x1 +AddReg = Neo.Reg, NeoAdapter.Ndi +CopyFiles = Neo.CopyFiles.Sys +*IfType = 53 +*MediaType = 0 +*PhysicalMediaType = 0 + +[NeoAdapter.Install.Services] +AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% + +[NeoAdapter.Ndi] +HKR, , NetworkAddress, 0, %DefaultAddress% +HKR, Ndi, DeviceID, , "NeoAdapter_VPN39" +HKR, , DevLoader, , ndis +HKR, , DeviceVxDs, , Neo_VPN39.sys +HKR, NDIS, LogDriverName, , "Neo_VPN39" +HKR, NDIS, MajorNdisVersion, 1, 5 +HKR, NDIS, MinorNdisVersion, 1, 0 +HKR, Ndi\Interfaces, DefUpper, , "ndis5" +HKR, Ndi\Interfaces, UpperRange, , "ndis5" +HKR, Ndi\Interfaces, LowerRange, , "ethernet" +HKR, Ndi\Interfaces, DefLower, , "ethernet" +HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" +HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% +HKR, Ndi\Params\NetworkAddress, type, 0, "edit" +HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" +HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" +HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% +HKR, Ndi\Params\NetworkAddress, optional, 0, "0" +HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% +HKR, Ndi\Params\MaxSpeed, type, 0, "int" +HKR, Ndi\Params\MaxSpeed, default, 0, "100" +HKR, Ndi\Params\MaxSpeed, min, 0, "0" +HKR, Ndi\Params\MaxSpeed, max, 0, "2000" +HKR, Ndi\Params\MaxSpeed, step, 0, "1" +HKR, Ndi\Params\MaxSpeed, Base, 0, "10" +HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% +HKR, Ndi\Params\KeepLink, type, 0, "enum" +HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% +HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% +HKR, Ndi\Params\KeepLink, default, 0, "0" + + +[Neo.Service] +DisplayName = %Neo.Service.DispName% +Description = %Neo.Service.Desc% +ServiceType = 1 +StartType = 3 +ErrorControl = 1 +ServiceBinary = %12%\Neo_VPN39.sys +LoadOrderGroup = NDIS + +[Neo.Reg] +HKR, Ndi, Service, 0, Neo.Service.Name +HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" +HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" + +[Neo.EventLog] +HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN39.sys" +HKR, , TypesSupported, 0x00010001, 7 + +[Strings] +CompanyName = "SoftEther Corporation" +DiskDescription = "VPN Client Device Driver Install Disk" +Neo.Service.Name = "Neo_VPN39" +Neo.Service.DispName = "VPN Client Device Driver - VPN39" +Neo.Service.Desc = "VPN Client Adapter - VPN39" +NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN39" +Neo.EventLog.Name = "Neo" +NetworkAddress = "MAC Address" +DefaultAddress = "000001000001" +MaxSpeed = "Indicate Speed (Mbps)" +KeepLink = "Keep Link" +On = "On" +Off = "Off" + + +; Auto Generated 20180205_163608.785 + diff --git a/src/bin/hamcore/DriverPackages/Neo6_Win8/x86/Neo6_x86_VPN4.inf b/src/bin/hamcore/DriverPackages/Neo6_Win8/x86/Neo6_x86_VPN4.inf index 3406e054..fcdbff86 100644 --- a/src/bin/hamcore/DriverPackages/Neo6_Win8/x86/Neo6_x86_VPN4.inf +++ b/src/bin/hamcore/DriverPackages/Neo6_Win8/x86/Neo6_x86_VPN4.inf @@ -1,114 +1,114 @@ -; VPN Client Device Driver for Windows 2000 and Greater -; -; Copyright (c) SoftEther Corporation. All Rights Reserved. -; http://www.softether.co.jp/ -; -; BUILD 9658 - -[Version] -Signature = "$Windows NT$" -Class = Net -ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} -Provider = %CompanyName% -DriverVer = 02/04/2018, 4.25.0.9658 -CatalogFile.NT = inf_VPN4.cat - -[Manufacturer] -%CompanyName% = SoftEther - -[SourceDisksNames] -1=%DiskDescription%, "", , - -[SourceDisksFiles] -Neo_VPN4.sys = 1 - -[DestinationDirs] -DefaultDestDir = 12 -Neo.CopyFiles.Sys = 12 - -[Neo.CopyFiles.Sys] -Neo_VPN4.sys, , , 2 - -[SoftEther] -%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN4 - -[NeoAdapter.Install] -Characteristics = 0x1 -AddReg = Neo.Reg, NeoAdapter.Ndi -CopyFiles = Neo.CopyFiles.Sys -*IfType = 53 -*MediaType = 0 -*PhysicalMediaType = 0 - -[NeoAdapter.Install.Services] -AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% - -[NeoAdapter.Ndi] -HKR, , NetworkAddress, 0, %DefaultAddress% -HKR, Ndi, DeviceID, , "NeoAdapter_VPN4" -HKR, , DevLoader, , ndis -HKR, , DeviceVxDs, , Neo_VPN4.sys -HKR, NDIS, LogDriverName, , "Neo_VPN4" -HKR, NDIS, MajorNdisVersion, 1, 5 -HKR, NDIS, MinorNdisVersion, 1, 0 -HKR, Ndi\Interfaces, DefUpper, , "ndis5" -HKR, Ndi\Interfaces, UpperRange, , "ndis5" -HKR, Ndi\Interfaces, LowerRange, , "ethernet" -HKR, Ndi\Interfaces, DefLower, , "ethernet" -HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" -HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% -HKR, Ndi\Params\NetworkAddress, type, 0, "edit" -HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" -HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" -HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% -HKR, Ndi\Params\NetworkAddress, optional, 0, "0" -HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% -HKR, Ndi\Params\MaxSpeed, type, 0, "int" -HKR, Ndi\Params\MaxSpeed, default, 0, "100" -HKR, Ndi\Params\MaxSpeed, min, 0, "0" -HKR, Ndi\Params\MaxSpeed, max, 0, "2000" -HKR, Ndi\Params\MaxSpeed, step, 0, "1" -HKR, Ndi\Params\MaxSpeed, Base, 0, "10" -HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% -HKR, Ndi\Params\KeepLink, type, 0, "enum" -HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% -HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% -HKR, Ndi\Params\KeepLink, default, 0, "0" - - -[Neo.Service] -DisplayName = %Neo.Service.DispName% -Description = %Neo.Service.Desc% -ServiceType = 1 -StartType = 3 -ErrorControl = 1 -ServiceBinary = %12%\Neo_VPN4.sys -LoadOrderGroup = NDIS - -[Neo.Reg] -HKR, Ndi, Service, 0, Neo.Service.Name -HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" -HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" - -[Neo.EventLog] -HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN4.sys" -HKR, , TypesSupported, 0x00010001, 7 - -[Strings] -CompanyName = "SoftEther Corporation" -DiskDescription = "VPN Client Device Driver Install Disk" -Neo.Service.Name = "Neo_VPN4" -Neo.Service.DispName = "VPN Client Device Driver - VPN4" -Neo.Service.Desc = "VPN Client Adapter - VPN4" -NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN4" -Neo.EventLog.Name = "Neo" -NetworkAddress = "MAC Address" -DefaultAddress = "000001000001" -MaxSpeed = "Indicate Speed (Mbps)" -KeepLink = "Keep Link" -On = "On" -Off = "Off" - - -; Auto Generated 20180205_163608.753 - +; VPN Client Device Driver for Windows 2000 and Greater +; +; Copyright (c) SoftEther Corporation. All Rights Reserved. +; http://www.softether.co.jp/ +; +; BUILD 9658 + +[Version] +Signature = "$Windows NT$" +Class = Net +ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} +Provider = %CompanyName% +DriverVer = 02/04/2018, 4.25.0.9658 +CatalogFile.NT = inf_VPN4.cat + +[Manufacturer] +%CompanyName% = SoftEther + +[SourceDisksNames] +1=%DiskDescription%, "", , + +[SourceDisksFiles] +Neo_VPN4.sys = 1 + +[DestinationDirs] +DefaultDestDir = 12 +Neo.CopyFiles.Sys = 12 + +[Neo.CopyFiles.Sys] +Neo_VPN4.sys, , , 2 + +[SoftEther] +%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN4 + +[NeoAdapter.Install] +Characteristics = 0x1 +AddReg = Neo.Reg, NeoAdapter.Ndi +CopyFiles = Neo.CopyFiles.Sys +*IfType = 53 +*MediaType = 0 +*PhysicalMediaType = 0 + +[NeoAdapter.Install.Services] +AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% + +[NeoAdapter.Ndi] +HKR, , NetworkAddress, 0, %DefaultAddress% +HKR, Ndi, DeviceID, , "NeoAdapter_VPN4" +HKR, , DevLoader, , ndis +HKR, , DeviceVxDs, , Neo_VPN4.sys +HKR, NDIS, LogDriverName, , "Neo_VPN4" +HKR, NDIS, MajorNdisVersion, 1, 5 +HKR, NDIS, MinorNdisVersion, 1, 0 +HKR, Ndi\Interfaces, DefUpper, , "ndis5" +HKR, Ndi\Interfaces, UpperRange, , "ndis5" +HKR, Ndi\Interfaces, LowerRange, , "ethernet" +HKR, Ndi\Interfaces, DefLower, , "ethernet" +HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" +HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% +HKR, Ndi\Params\NetworkAddress, type, 0, "edit" +HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" +HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" +HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% +HKR, Ndi\Params\NetworkAddress, optional, 0, "0" +HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% +HKR, Ndi\Params\MaxSpeed, type, 0, "int" +HKR, Ndi\Params\MaxSpeed, default, 0, "100" +HKR, Ndi\Params\MaxSpeed, min, 0, "0" +HKR, Ndi\Params\MaxSpeed, max, 0, "2000" +HKR, Ndi\Params\MaxSpeed, step, 0, "1" +HKR, Ndi\Params\MaxSpeed, Base, 0, "10" +HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% +HKR, Ndi\Params\KeepLink, type, 0, "enum" +HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% +HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% +HKR, Ndi\Params\KeepLink, default, 0, "0" + + +[Neo.Service] +DisplayName = %Neo.Service.DispName% +Description = %Neo.Service.Desc% +ServiceType = 1 +StartType = 3 +ErrorControl = 1 +ServiceBinary = %12%\Neo_VPN4.sys +LoadOrderGroup = NDIS + +[Neo.Reg] +HKR, Ndi, Service, 0, Neo.Service.Name +HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" +HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" + +[Neo.EventLog] +HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN4.sys" +HKR, , TypesSupported, 0x00010001, 7 + +[Strings] +CompanyName = "SoftEther Corporation" +DiskDescription = "VPN Client Device Driver Install Disk" +Neo.Service.Name = "Neo_VPN4" +Neo.Service.DispName = "VPN Client Device Driver - VPN4" +Neo.Service.Desc = "VPN Client Adapter - VPN4" +NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN4" +Neo.EventLog.Name = "Neo" +NetworkAddress = "MAC Address" +DefaultAddress = "000001000001" +MaxSpeed = "Indicate Speed (Mbps)" +KeepLink = "Keep Link" +On = "On" +Off = "Off" + + +; Auto Generated 20180205_163608.753 + diff --git a/src/bin/hamcore/DriverPackages/Neo6_Win8/x86/Neo6_x86_VPN40.inf b/src/bin/hamcore/DriverPackages/Neo6_Win8/x86/Neo6_x86_VPN40.inf index 754eb27f..ae7d8428 100644 --- a/src/bin/hamcore/DriverPackages/Neo6_Win8/x86/Neo6_x86_VPN40.inf +++ b/src/bin/hamcore/DriverPackages/Neo6_Win8/x86/Neo6_x86_VPN40.inf @@ -1,114 +1,114 @@ -; VPN Client Device Driver for Windows 2000 and Greater -; -; Copyright (c) SoftEther Corporation. All Rights Reserved. -; http://www.softether.co.jp/ -; -; BUILD 9658 - -[Version] -Signature = "$Windows NT$" -Class = Net -ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} -Provider = %CompanyName% -DriverVer = 02/04/2018, 4.25.0.9658 -CatalogFile.NT = inf_VPN40.cat - -[Manufacturer] -%CompanyName% = SoftEther - -[SourceDisksNames] -1=%DiskDescription%, "", , - -[SourceDisksFiles] -Neo_VPN40.sys = 1 - -[DestinationDirs] -DefaultDestDir = 12 -Neo.CopyFiles.Sys = 12 - -[Neo.CopyFiles.Sys] -Neo_VPN40.sys, , , 2 - -[SoftEther] -%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN40 - -[NeoAdapter.Install] -Characteristics = 0x1 -AddReg = Neo.Reg, NeoAdapter.Ndi -CopyFiles = Neo.CopyFiles.Sys -*IfType = 53 -*MediaType = 0 -*PhysicalMediaType = 0 - -[NeoAdapter.Install.Services] -AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% - -[NeoAdapter.Ndi] -HKR, , NetworkAddress, 0, %DefaultAddress% -HKR, Ndi, DeviceID, , "NeoAdapter_VPN40" -HKR, , DevLoader, , ndis -HKR, , DeviceVxDs, , Neo_VPN40.sys -HKR, NDIS, LogDriverName, , "Neo_VPN40" -HKR, NDIS, MajorNdisVersion, 1, 5 -HKR, NDIS, MinorNdisVersion, 1, 0 -HKR, Ndi\Interfaces, DefUpper, , "ndis5" -HKR, Ndi\Interfaces, UpperRange, , "ndis5" -HKR, Ndi\Interfaces, LowerRange, , "ethernet" -HKR, Ndi\Interfaces, DefLower, , "ethernet" -HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" -HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% -HKR, Ndi\Params\NetworkAddress, type, 0, "edit" -HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" -HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" -HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% -HKR, Ndi\Params\NetworkAddress, optional, 0, "0" -HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% -HKR, Ndi\Params\MaxSpeed, type, 0, "int" -HKR, Ndi\Params\MaxSpeed, default, 0, "100" -HKR, Ndi\Params\MaxSpeed, min, 0, "0" -HKR, Ndi\Params\MaxSpeed, max, 0, "2000" -HKR, Ndi\Params\MaxSpeed, step, 0, "1" -HKR, Ndi\Params\MaxSpeed, Base, 0, "10" -HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% -HKR, Ndi\Params\KeepLink, type, 0, "enum" -HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% -HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% -HKR, Ndi\Params\KeepLink, default, 0, "0" - - -[Neo.Service] -DisplayName = %Neo.Service.DispName% -Description = %Neo.Service.Desc% -ServiceType = 1 -StartType = 3 -ErrorControl = 1 -ServiceBinary = %12%\Neo_VPN40.sys -LoadOrderGroup = NDIS - -[Neo.Reg] -HKR, Ndi, Service, 0, Neo.Service.Name -HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" -HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" - -[Neo.EventLog] -HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN40.sys" -HKR, , TypesSupported, 0x00010001, 7 - -[Strings] -CompanyName = "SoftEther Corporation" -DiskDescription = "VPN Client Device Driver Install Disk" -Neo.Service.Name = "Neo_VPN40" -Neo.Service.DispName = "VPN Client Device Driver - VPN40" -Neo.Service.Desc = "VPN Client Adapter - VPN40" -NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN40" -Neo.EventLog.Name = "Neo" -NetworkAddress = "MAC Address" -DefaultAddress = "000001000001" -MaxSpeed = "Indicate Speed (Mbps)" -KeepLink = "Keep Link" -On = "On" -Off = "Off" - - -; Auto Generated 20180205_163608.786 - +; VPN Client Device Driver for Windows 2000 and Greater +; +; Copyright (c) SoftEther Corporation. All Rights Reserved. +; http://www.softether.co.jp/ +; +; BUILD 9658 + +[Version] +Signature = "$Windows NT$" +Class = Net +ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} +Provider = %CompanyName% +DriverVer = 02/04/2018, 4.25.0.9658 +CatalogFile.NT = inf_VPN40.cat + +[Manufacturer] +%CompanyName% = SoftEther + +[SourceDisksNames] +1=%DiskDescription%, "", , + +[SourceDisksFiles] +Neo_VPN40.sys = 1 + +[DestinationDirs] +DefaultDestDir = 12 +Neo.CopyFiles.Sys = 12 + +[Neo.CopyFiles.Sys] +Neo_VPN40.sys, , , 2 + +[SoftEther] +%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN40 + +[NeoAdapter.Install] +Characteristics = 0x1 +AddReg = Neo.Reg, NeoAdapter.Ndi +CopyFiles = Neo.CopyFiles.Sys +*IfType = 53 +*MediaType = 0 +*PhysicalMediaType = 0 + +[NeoAdapter.Install.Services] +AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% + +[NeoAdapter.Ndi] +HKR, , NetworkAddress, 0, %DefaultAddress% +HKR, Ndi, DeviceID, , "NeoAdapter_VPN40" +HKR, , DevLoader, , ndis +HKR, , DeviceVxDs, , Neo_VPN40.sys +HKR, NDIS, LogDriverName, , "Neo_VPN40" +HKR, NDIS, MajorNdisVersion, 1, 5 +HKR, NDIS, MinorNdisVersion, 1, 0 +HKR, Ndi\Interfaces, DefUpper, , "ndis5" +HKR, Ndi\Interfaces, UpperRange, , "ndis5" +HKR, Ndi\Interfaces, LowerRange, , "ethernet" +HKR, Ndi\Interfaces, DefLower, , "ethernet" +HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" +HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% +HKR, Ndi\Params\NetworkAddress, type, 0, "edit" +HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" +HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" +HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% +HKR, Ndi\Params\NetworkAddress, optional, 0, "0" +HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% +HKR, Ndi\Params\MaxSpeed, type, 0, "int" +HKR, Ndi\Params\MaxSpeed, default, 0, "100" +HKR, Ndi\Params\MaxSpeed, min, 0, "0" +HKR, Ndi\Params\MaxSpeed, max, 0, "2000" +HKR, Ndi\Params\MaxSpeed, step, 0, "1" +HKR, Ndi\Params\MaxSpeed, Base, 0, "10" +HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% +HKR, Ndi\Params\KeepLink, type, 0, "enum" +HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% +HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% +HKR, Ndi\Params\KeepLink, default, 0, "0" + + +[Neo.Service] +DisplayName = %Neo.Service.DispName% +Description = %Neo.Service.Desc% +ServiceType = 1 +StartType = 3 +ErrorControl = 1 +ServiceBinary = %12%\Neo_VPN40.sys +LoadOrderGroup = NDIS + +[Neo.Reg] +HKR, Ndi, Service, 0, Neo.Service.Name +HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" +HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" + +[Neo.EventLog] +HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN40.sys" +HKR, , TypesSupported, 0x00010001, 7 + +[Strings] +CompanyName = "SoftEther Corporation" +DiskDescription = "VPN Client Device Driver Install Disk" +Neo.Service.Name = "Neo_VPN40" +Neo.Service.DispName = "VPN Client Device Driver - VPN40" +Neo.Service.Desc = "VPN Client Adapter - VPN40" +NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN40" +Neo.EventLog.Name = "Neo" +NetworkAddress = "MAC Address" +DefaultAddress = "000001000001" +MaxSpeed = "Indicate Speed (Mbps)" +KeepLink = "Keep Link" +On = "On" +Off = "Off" + + +; Auto Generated 20180205_163608.786 + diff --git a/src/bin/hamcore/DriverPackages/Neo6_Win8/x86/Neo6_x86_VPN41.inf b/src/bin/hamcore/DriverPackages/Neo6_Win8/x86/Neo6_x86_VPN41.inf index 3dd1b22b..fc00d924 100644 --- a/src/bin/hamcore/DriverPackages/Neo6_Win8/x86/Neo6_x86_VPN41.inf +++ b/src/bin/hamcore/DriverPackages/Neo6_Win8/x86/Neo6_x86_VPN41.inf @@ -1,114 +1,114 @@ -; VPN Client Device Driver for Windows 2000 and Greater -; -; Copyright (c) SoftEther Corporation. All Rights Reserved. -; http://www.softether.co.jp/ -; -; BUILD 9658 - -[Version] -Signature = "$Windows NT$" -Class = Net -ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} -Provider = %CompanyName% -DriverVer = 02/04/2018, 4.25.0.9658 -CatalogFile.NT = inf_VPN41.cat - -[Manufacturer] -%CompanyName% = SoftEther - -[SourceDisksNames] -1=%DiskDescription%, "", , - -[SourceDisksFiles] -Neo_VPN41.sys = 1 - -[DestinationDirs] -DefaultDestDir = 12 -Neo.CopyFiles.Sys = 12 - -[Neo.CopyFiles.Sys] -Neo_VPN41.sys, , , 2 - -[SoftEther] -%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN41 - -[NeoAdapter.Install] -Characteristics = 0x1 -AddReg = Neo.Reg, NeoAdapter.Ndi -CopyFiles = Neo.CopyFiles.Sys -*IfType = 53 -*MediaType = 0 -*PhysicalMediaType = 0 - -[NeoAdapter.Install.Services] -AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% - -[NeoAdapter.Ndi] -HKR, , NetworkAddress, 0, %DefaultAddress% -HKR, Ndi, DeviceID, , "NeoAdapter_VPN41" -HKR, , DevLoader, , ndis -HKR, , DeviceVxDs, , Neo_VPN41.sys -HKR, NDIS, LogDriverName, , "Neo_VPN41" -HKR, NDIS, MajorNdisVersion, 1, 5 -HKR, NDIS, MinorNdisVersion, 1, 0 -HKR, Ndi\Interfaces, DefUpper, , "ndis5" -HKR, Ndi\Interfaces, UpperRange, , "ndis5" -HKR, Ndi\Interfaces, LowerRange, , "ethernet" -HKR, Ndi\Interfaces, DefLower, , "ethernet" -HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" -HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% -HKR, Ndi\Params\NetworkAddress, type, 0, "edit" -HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" -HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" -HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% -HKR, Ndi\Params\NetworkAddress, optional, 0, "0" -HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% -HKR, Ndi\Params\MaxSpeed, type, 0, "int" -HKR, Ndi\Params\MaxSpeed, default, 0, "100" -HKR, Ndi\Params\MaxSpeed, min, 0, "0" -HKR, Ndi\Params\MaxSpeed, max, 0, "2000" -HKR, Ndi\Params\MaxSpeed, step, 0, "1" -HKR, Ndi\Params\MaxSpeed, Base, 0, "10" -HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% -HKR, Ndi\Params\KeepLink, type, 0, "enum" -HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% -HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% -HKR, Ndi\Params\KeepLink, default, 0, "0" - - -[Neo.Service] -DisplayName = %Neo.Service.DispName% -Description = %Neo.Service.Desc% -ServiceType = 1 -StartType = 3 -ErrorControl = 1 -ServiceBinary = %12%\Neo_VPN41.sys -LoadOrderGroup = NDIS - -[Neo.Reg] -HKR, Ndi, Service, 0, Neo.Service.Name -HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" -HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" - -[Neo.EventLog] -HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN41.sys" -HKR, , TypesSupported, 0x00010001, 7 - -[Strings] -CompanyName = "SoftEther Corporation" -DiskDescription = "VPN Client Device Driver Install Disk" -Neo.Service.Name = "Neo_VPN41" -Neo.Service.DispName = "VPN Client Device Driver - VPN41" -Neo.Service.Desc = "VPN Client Adapter - VPN41" -NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN41" -Neo.EventLog.Name = "Neo" -NetworkAddress = "MAC Address" -DefaultAddress = "000001000001" -MaxSpeed = "Indicate Speed (Mbps)" -KeepLink = "Keep Link" -On = "On" -Off = "Off" - - -; Auto Generated 20180205_163608.786 - +; VPN Client Device Driver for Windows 2000 and Greater +; +; Copyright (c) SoftEther Corporation. All Rights Reserved. +; http://www.softether.co.jp/ +; +; BUILD 9658 + +[Version] +Signature = "$Windows NT$" +Class = Net +ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} +Provider = %CompanyName% +DriverVer = 02/04/2018, 4.25.0.9658 +CatalogFile.NT = inf_VPN41.cat + +[Manufacturer] +%CompanyName% = SoftEther + +[SourceDisksNames] +1=%DiskDescription%, "", , + +[SourceDisksFiles] +Neo_VPN41.sys = 1 + +[DestinationDirs] +DefaultDestDir = 12 +Neo.CopyFiles.Sys = 12 + +[Neo.CopyFiles.Sys] +Neo_VPN41.sys, , , 2 + +[SoftEther] +%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN41 + +[NeoAdapter.Install] +Characteristics = 0x1 +AddReg = Neo.Reg, NeoAdapter.Ndi +CopyFiles = Neo.CopyFiles.Sys +*IfType = 53 +*MediaType = 0 +*PhysicalMediaType = 0 + +[NeoAdapter.Install.Services] +AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% + +[NeoAdapter.Ndi] +HKR, , NetworkAddress, 0, %DefaultAddress% +HKR, Ndi, DeviceID, , "NeoAdapter_VPN41" +HKR, , DevLoader, , ndis +HKR, , DeviceVxDs, , Neo_VPN41.sys +HKR, NDIS, LogDriverName, , "Neo_VPN41" +HKR, NDIS, MajorNdisVersion, 1, 5 +HKR, NDIS, MinorNdisVersion, 1, 0 +HKR, Ndi\Interfaces, DefUpper, , "ndis5" +HKR, Ndi\Interfaces, UpperRange, , "ndis5" +HKR, Ndi\Interfaces, LowerRange, , "ethernet" +HKR, Ndi\Interfaces, DefLower, , "ethernet" +HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" +HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% +HKR, Ndi\Params\NetworkAddress, type, 0, "edit" +HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" +HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" +HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% +HKR, Ndi\Params\NetworkAddress, optional, 0, "0" +HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% +HKR, Ndi\Params\MaxSpeed, type, 0, "int" +HKR, Ndi\Params\MaxSpeed, default, 0, "100" +HKR, Ndi\Params\MaxSpeed, min, 0, "0" +HKR, Ndi\Params\MaxSpeed, max, 0, "2000" +HKR, Ndi\Params\MaxSpeed, step, 0, "1" +HKR, Ndi\Params\MaxSpeed, Base, 0, "10" +HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% +HKR, Ndi\Params\KeepLink, type, 0, "enum" +HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% +HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% +HKR, Ndi\Params\KeepLink, default, 0, "0" + + +[Neo.Service] +DisplayName = %Neo.Service.DispName% +Description = %Neo.Service.Desc% +ServiceType = 1 +StartType = 3 +ErrorControl = 1 +ServiceBinary = %12%\Neo_VPN41.sys +LoadOrderGroup = NDIS + +[Neo.Reg] +HKR, Ndi, Service, 0, Neo.Service.Name +HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" +HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" + +[Neo.EventLog] +HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN41.sys" +HKR, , TypesSupported, 0x00010001, 7 + +[Strings] +CompanyName = "SoftEther Corporation" +DiskDescription = "VPN Client Device Driver Install Disk" +Neo.Service.Name = "Neo_VPN41" +Neo.Service.DispName = "VPN Client Device Driver - VPN41" +Neo.Service.Desc = "VPN Client Adapter - VPN41" +NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN41" +Neo.EventLog.Name = "Neo" +NetworkAddress = "MAC Address" +DefaultAddress = "000001000001" +MaxSpeed = "Indicate Speed (Mbps)" +KeepLink = "Keep Link" +On = "On" +Off = "Off" + + +; Auto Generated 20180205_163608.786 + diff --git a/src/bin/hamcore/DriverPackages/Neo6_Win8/x86/Neo6_x86_VPN42.inf b/src/bin/hamcore/DriverPackages/Neo6_Win8/x86/Neo6_x86_VPN42.inf index 6677958c..65f65be4 100644 --- a/src/bin/hamcore/DriverPackages/Neo6_Win8/x86/Neo6_x86_VPN42.inf +++ b/src/bin/hamcore/DriverPackages/Neo6_Win8/x86/Neo6_x86_VPN42.inf @@ -1,114 +1,114 @@ -; VPN Client Device Driver for Windows 2000 and Greater -; -; Copyright (c) SoftEther Corporation. All Rights Reserved. -; http://www.softether.co.jp/ -; -; BUILD 9658 - -[Version] -Signature = "$Windows NT$" -Class = Net -ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} -Provider = %CompanyName% -DriverVer = 02/04/2018, 4.25.0.9658 -CatalogFile.NT = inf_VPN42.cat - -[Manufacturer] -%CompanyName% = SoftEther - -[SourceDisksNames] -1=%DiskDescription%, "", , - -[SourceDisksFiles] -Neo_VPN42.sys = 1 - -[DestinationDirs] -DefaultDestDir = 12 -Neo.CopyFiles.Sys = 12 - -[Neo.CopyFiles.Sys] -Neo_VPN42.sys, , , 2 - -[SoftEther] -%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN42 - -[NeoAdapter.Install] -Characteristics = 0x1 -AddReg = Neo.Reg, NeoAdapter.Ndi -CopyFiles = Neo.CopyFiles.Sys -*IfType = 53 -*MediaType = 0 -*PhysicalMediaType = 0 - -[NeoAdapter.Install.Services] -AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% - -[NeoAdapter.Ndi] -HKR, , NetworkAddress, 0, %DefaultAddress% -HKR, Ndi, DeviceID, , "NeoAdapter_VPN42" -HKR, , DevLoader, , ndis -HKR, , DeviceVxDs, , Neo_VPN42.sys -HKR, NDIS, LogDriverName, , "Neo_VPN42" -HKR, NDIS, MajorNdisVersion, 1, 5 -HKR, NDIS, MinorNdisVersion, 1, 0 -HKR, Ndi\Interfaces, DefUpper, , "ndis5" -HKR, Ndi\Interfaces, UpperRange, , "ndis5" -HKR, Ndi\Interfaces, LowerRange, , "ethernet" -HKR, Ndi\Interfaces, DefLower, , "ethernet" -HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" -HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% -HKR, Ndi\Params\NetworkAddress, type, 0, "edit" -HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" -HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" -HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% -HKR, Ndi\Params\NetworkAddress, optional, 0, "0" -HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% -HKR, Ndi\Params\MaxSpeed, type, 0, "int" -HKR, Ndi\Params\MaxSpeed, default, 0, "100" -HKR, Ndi\Params\MaxSpeed, min, 0, "0" -HKR, Ndi\Params\MaxSpeed, max, 0, "2000" -HKR, Ndi\Params\MaxSpeed, step, 0, "1" -HKR, Ndi\Params\MaxSpeed, Base, 0, "10" -HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% -HKR, Ndi\Params\KeepLink, type, 0, "enum" -HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% -HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% -HKR, Ndi\Params\KeepLink, default, 0, "0" - - -[Neo.Service] -DisplayName = %Neo.Service.DispName% -Description = %Neo.Service.Desc% -ServiceType = 1 -StartType = 3 -ErrorControl = 1 -ServiceBinary = %12%\Neo_VPN42.sys -LoadOrderGroup = NDIS - -[Neo.Reg] -HKR, Ndi, Service, 0, Neo.Service.Name -HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" -HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" - -[Neo.EventLog] -HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN42.sys" -HKR, , TypesSupported, 0x00010001, 7 - -[Strings] -CompanyName = "SoftEther Corporation" -DiskDescription = "VPN Client Device Driver Install Disk" -Neo.Service.Name = "Neo_VPN42" -Neo.Service.DispName = "VPN Client Device Driver - VPN42" -Neo.Service.Desc = "VPN Client Adapter - VPN42" -NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN42" -Neo.EventLog.Name = "Neo" -NetworkAddress = "MAC Address" -DefaultAddress = "000001000001" -MaxSpeed = "Indicate Speed (Mbps)" -KeepLink = "Keep Link" -On = "On" -Off = "Off" - - -; Auto Generated 20180205_163608.787 - +; VPN Client Device Driver for Windows 2000 and Greater +; +; Copyright (c) SoftEther Corporation. All Rights Reserved. +; http://www.softether.co.jp/ +; +; BUILD 9658 + +[Version] +Signature = "$Windows NT$" +Class = Net +ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} +Provider = %CompanyName% +DriverVer = 02/04/2018, 4.25.0.9658 +CatalogFile.NT = inf_VPN42.cat + +[Manufacturer] +%CompanyName% = SoftEther + +[SourceDisksNames] +1=%DiskDescription%, "", , + +[SourceDisksFiles] +Neo_VPN42.sys = 1 + +[DestinationDirs] +DefaultDestDir = 12 +Neo.CopyFiles.Sys = 12 + +[Neo.CopyFiles.Sys] +Neo_VPN42.sys, , , 2 + +[SoftEther] +%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN42 + +[NeoAdapter.Install] +Characteristics = 0x1 +AddReg = Neo.Reg, NeoAdapter.Ndi +CopyFiles = Neo.CopyFiles.Sys +*IfType = 53 +*MediaType = 0 +*PhysicalMediaType = 0 + +[NeoAdapter.Install.Services] +AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% + +[NeoAdapter.Ndi] +HKR, , NetworkAddress, 0, %DefaultAddress% +HKR, Ndi, DeviceID, , "NeoAdapter_VPN42" +HKR, , DevLoader, , ndis +HKR, , DeviceVxDs, , Neo_VPN42.sys +HKR, NDIS, LogDriverName, , "Neo_VPN42" +HKR, NDIS, MajorNdisVersion, 1, 5 +HKR, NDIS, MinorNdisVersion, 1, 0 +HKR, Ndi\Interfaces, DefUpper, , "ndis5" +HKR, Ndi\Interfaces, UpperRange, , "ndis5" +HKR, Ndi\Interfaces, LowerRange, , "ethernet" +HKR, Ndi\Interfaces, DefLower, , "ethernet" +HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" +HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% +HKR, Ndi\Params\NetworkAddress, type, 0, "edit" +HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" +HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" +HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% +HKR, Ndi\Params\NetworkAddress, optional, 0, "0" +HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% +HKR, Ndi\Params\MaxSpeed, type, 0, "int" +HKR, Ndi\Params\MaxSpeed, default, 0, "100" +HKR, Ndi\Params\MaxSpeed, min, 0, "0" +HKR, Ndi\Params\MaxSpeed, max, 0, "2000" +HKR, Ndi\Params\MaxSpeed, step, 0, "1" +HKR, Ndi\Params\MaxSpeed, Base, 0, "10" +HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% +HKR, Ndi\Params\KeepLink, type, 0, "enum" +HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% +HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% +HKR, Ndi\Params\KeepLink, default, 0, "0" + + +[Neo.Service] +DisplayName = %Neo.Service.DispName% +Description = %Neo.Service.Desc% +ServiceType = 1 +StartType = 3 +ErrorControl = 1 +ServiceBinary = %12%\Neo_VPN42.sys +LoadOrderGroup = NDIS + +[Neo.Reg] +HKR, Ndi, Service, 0, Neo.Service.Name +HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" +HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" + +[Neo.EventLog] +HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN42.sys" +HKR, , TypesSupported, 0x00010001, 7 + +[Strings] +CompanyName = "SoftEther Corporation" +DiskDescription = "VPN Client Device Driver Install Disk" +Neo.Service.Name = "Neo_VPN42" +Neo.Service.DispName = "VPN Client Device Driver - VPN42" +Neo.Service.Desc = "VPN Client Adapter - VPN42" +NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN42" +Neo.EventLog.Name = "Neo" +NetworkAddress = "MAC Address" +DefaultAddress = "000001000001" +MaxSpeed = "Indicate Speed (Mbps)" +KeepLink = "Keep Link" +On = "On" +Off = "Off" + + +; Auto Generated 20180205_163608.787 + diff --git a/src/bin/hamcore/DriverPackages/Neo6_Win8/x86/Neo6_x86_VPN43.inf b/src/bin/hamcore/DriverPackages/Neo6_Win8/x86/Neo6_x86_VPN43.inf index 445c8736..03c65150 100644 --- a/src/bin/hamcore/DriverPackages/Neo6_Win8/x86/Neo6_x86_VPN43.inf +++ b/src/bin/hamcore/DriverPackages/Neo6_Win8/x86/Neo6_x86_VPN43.inf @@ -1,114 +1,114 @@ -; VPN Client Device Driver for Windows 2000 and Greater -; -; Copyright (c) SoftEther Corporation. All Rights Reserved. -; http://www.softether.co.jp/ -; -; BUILD 9658 - -[Version] -Signature = "$Windows NT$" -Class = Net -ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} -Provider = %CompanyName% -DriverVer = 02/04/2018, 4.25.0.9658 -CatalogFile.NT = inf_VPN43.cat - -[Manufacturer] -%CompanyName% = SoftEther - -[SourceDisksNames] -1=%DiskDescription%, "", , - -[SourceDisksFiles] -Neo_VPN43.sys = 1 - -[DestinationDirs] -DefaultDestDir = 12 -Neo.CopyFiles.Sys = 12 - -[Neo.CopyFiles.Sys] -Neo_VPN43.sys, , , 2 - -[SoftEther] -%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN43 - -[NeoAdapter.Install] -Characteristics = 0x1 -AddReg = Neo.Reg, NeoAdapter.Ndi -CopyFiles = Neo.CopyFiles.Sys -*IfType = 53 -*MediaType = 0 -*PhysicalMediaType = 0 - -[NeoAdapter.Install.Services] -AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% - -[NeoAdapter.Ndi] -HKR, , NetworkAddress, 0, %DefaultAddress% -HKR, Ndi, DeviceID, , "NeoAdapter_VPN43" -HKR, , DevLoader, , ndis -HKR, , DeviceVxDs, , Neo_VPN43.sys -HKR, NDIS, LogDriverName, , "Neo_VPN43" -HKR, NDIS, MajorNdisVersion, 1, 5 -HKR, NDIS, MinorNdisVersion, 1, 0 -HKR, Ndi\Interfaces, DefUpper, , "ndis5" -HKR, Ndi\Interfaces, UpperRange, , "ndis5" -HKR, Ndi\Interfaces, LowerRange, , "ethernet" -HKR, Ndi\Interfaces, DefLower, , "ethernet" -HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" -HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% -HKR, Ndi\Params\NetworkAddress, type, 0, "edit" -HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" -HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" -HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% -HKR, Ndi\Params\NetworkAddress, optional, 0, "0" -HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% -HKR, Ndi\Params\MaxSpeed, type, 0, "int" -HKR, Ndi\Params\MaxSpeed, default, 0, "100" -HKR, Ndi\Params\MaxSpeed, min, 0, "0" -HKR, Ndi\Params\MaxSpeed, max, 0, "2000" -HKR, Ndi\Params\MaxSpeed, step, 0, "1" -HKR, Ndi\Params\MaxSpeed, Base, 0, "10" -HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% -HKR, Ndi\Params\KeepLink, type, 0, "enum" -HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% -HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% -HKR, Ndi\Params\KeepLink, default, 0, "0" - - -[Neo.Service] -DisplayName = %Neo.Service.DispName% -Description = %Neo.Service.Desc% -ServiceType = 1 -StartType = 3 -ErrorControl = 1 -ServiceBinary = %12%\Neo_VPN43.sys -LoadOrderGroup = NDIS - -[Neo.Reg] -HKR, Ndi, Service, 0, Neo.Service.Name -HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" -HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" - -[Neo.EventLog] -HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN43.sys" -HKR, , TypesSupported, 0x00010001, 7 - -[Strings] -CompanyName = "SoftEther Corporation" -DiskDescription = "VPN Client Device Driver Install Disk" -Neo.Service.Name = "Neo_VPN43" -Neo.Service.DispName = "VPN Client Device Driver - VPN43" -Neo.Service.Desc = "VPN Client Adapter - VPN43" -NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN43" -Neo.EventLog.Name = "Neo" -NetworkAddress = "MAC Address" -DefaultAddress = "000001000001" -MaxSpeed = "Indicate Speed (Mbps)" -KeepLink = "Keep Link" -On = "On" -Off = "Off" - - -; Auto Generated 20180205_163608.788 - +; VPN Client Device Driver for Windows 2000 and Greater +; +; Copyright (c) SoftEther Corporation. All Rights Reserved. +; http://www.softether.co.jp/ +; +; BUILD 9658 + +[Version] +Signature = "$Windows NT$" +Class = Net +ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} +Provider = %CompanyName% +DriverVer = 02/04/2018, 4.25.0.9658 +CatalogFile.NT = inf_VPN43.cat + +[Manufacturer] +%CompanyName% = SoftEther + +[SourceDisksNames] +1=%DiskDescription%, "", , + +[SourceDisksFiles] +Neo_VPN43.sys = 1 + +[DestinationDirs] +DefaultDestDir = 12 +Neo.CopyFiles.Sys = 12 + +[Neo.CopyFiles.Sys] +Neo_VPN43.sys, , , 2 + +[SoftEther] +%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN43 + +[NeoAdapter.Install] +Characteristics = 0x1 +AddReg = Neo.Reg, NeoAdapter.Ndi +CopyFiles = Neo.CopyFiles.Sys +*IfType = 53 +*MediaType = 0 +*PhysicalMediaType = 0 + +[NeoAdapter.Install.Services] +AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% + +[NeoAdapter.Ndi] +HKR, , NetworkAddress, 0, %DefaultAddress% +HKR, Ndi, DeviceID, , "NeoAdapter_VPN43" +HKR, , DevLoader, , ndis +HKR, , DeviceVxDs, , Neo_VPN43.sys +HKR, NDIS, LogDriverName, , "Neo_VPN43" +HKR, NDIS, MajorNdisVersion, 1, 5 +HKR, NDIS, MinorNdisVersion, 1, 0 +HKR, Ndi\Interfaces, DefUpper, , "ndis5" +HKR, Ndi\Interfaces, UpperRange, , "ndis5" +HKR, Ndi\Interfaces, LowerRange, , "ethernet" +HKR, Ndi\Interfaces, DefLower, , "ethernet" +HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" +HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% +HKR, Ndi\Params\NetworkAddress, type, 0, "edit" +HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" +HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" +HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% +HKR, Ndi\Params\NetworkAddress, optional, 0, "0" +HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% +HKR, Ndi\Params\MaxSpeed, type, 0, "int" +HKR, Ndi\Params\MaxSpeed, default, 0, "100" +HKR, Ndi\Params\MaxSpeed, min, 0, "0" +HKR, Ndi\Params\MaxSpeed, max, 0, "2000" +HKR, Ndi\Params\MaxSpeed, step, 0, "1" +HKR, Ndi\Params\MaxSpeed, Base, 0, "10" +HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% +HKR, Ndi\Params\KeepLink, type, 0, "enum" +HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% +HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% +HKR, Ndi\Params\KeepLink, default, 0, "0" + + +[Neo.Service] +DisplayName = %Neo.Service.DispName% +Description = %Neo.Service.Desc% +ServiceType = 1 +StartType = 3 +ErrorControl = 1 +ServiceBinary = %12%\Neo_VPN43.sys +LoadOrderGroup = NDIS + +[Neo.Reg] +HKR, Ndi, Service, 0, Neo.Service.Name +HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" +HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" + +[Neo.EventLog] +HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN43.sys" +HKR, , TypesSupported, 0x00010001, 7 + +[Strings] +CompanyName = "SoftEther Corporation" +DiskDescription = "VPN Client Device Driver Install Disk" +Neo.Service.Name = "Neo_VPN43" +Neo.Service.DispName = "VPN Client Device Driver - VPN43" +Neo.Service.Desc = "VPN Client Adapter - VPN43" +NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN43" +Neo.EventLog.Name = "Neo" +NetworkAddress = "MAC Address" +DefaultAddress = "000001000001" +MaxSpeed = "Indicate Speed (Mbps)" +KeepLink = "Keep Link" +On = "On" +Off = "Off" + + +; Auto Generated 20180205_163608.788 + diff --git a/src/bin/hamcore/DriverPackages/Neo6_Win8/x86/Neo6_x86_VPN44.inf b/src/bin/hamcore/DriverPackages/Neo6_Win8/x86/Neo6_x86_VPN44.inf index 32cdfa3a..de5dac71 100644 --- a/src/bin/hamcore/DriverPackages/Neo6_Win8/x86/Neo6_x86_VPN44.inf +++ b/src/bin/hamcore/DriverPackages/Neo6_Win8/x86/Neo6_x86_VPN44.inf @@ -1,114 +1,114 @@ -; VPN Client Device Driver for Windows 2000 and Greater -; -; Copyright (c) SoftEther Corporation. All Rights Reserved. -; http://www.softether.co.jp/ -; -; BUILD 9658 - -[Version] -Signature = "$Windows NT$" -Class = Net -ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} -Provider = %CompanyName% -DriverVer = 02/04/2018, 4.25.0.9658 -CatalogFile.NT = inf_VPN44.cat - -[Manufacturer] -%CompanyName% = SoftEther - -[SourceDisksNames] -1=%DiskDescription%, "", , - -[SourceDisksFiles] -Neo_VPN44.sys = 1 - -[DestinationDirs] -DefaultDestDir = 12 -Neo.CopyFiles.Sys = 12 - -[Neo.CopyFiles.Sys] -Neo_VPN44.sys, , , 2 - -[SoftEther] -%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN44 - -[NeoAdapter.Install] -Characteristics = 0x1 -AddReg = Neo.Reg, NeoAdapter.Ndi -CopyFiles = Neo.CopyFiles.Sys -*IfType = 53 -*MediaType = 0 -*PhysicalMediaType = 0 - -[NeoAdapter.Install.Services] -AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% - -[NeoAdapter.Ndi] -HKR, , NetworkAddress, 0, %DefaultAddress% -HKR, Ndi, DeviceID, , "NeoAdapter_VPN44" -HKR, , DevLoader, , ndis -HKR, , DeviceVxDs, , Neo_VPN44.sys -HKR, NDIS, LogDriverName, , "Neo_VPN44" -HKR, NDIS, MajorNdisVersion, 1, 5 -HKR, NDIS, MinorNdisVersion, 1, 0 -HKR, Ndi\Interfaces, DefUpper, , "ndis5" -HKR, Ndi\Interfaces, UpperRange, , "ndis5" -HKR, Ndi\Interfaces, LowerRange, , "ethernet" -HKR, Ndi\Interfaces, DefLower, , "ethernet" -HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" -HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% -HKR, Ndi\Params\NetworkAddress, type, 0, "edit" -HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" -HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" -HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% -HKR, Ndi\Params\NetworkAddress, optional, 0, "0" -HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% -HKR, Ndi\Params\MaxSpeed, type, 0, "int" -HKR, Ndi\Params\MaxSpeed, default, 0, "100" -HKR, Ndi\Params\MaxSpeed, min, 0, "0" -HKR, Ndi\Params\MaxSpeed, max, 0, "2000" -HKR, Ndi\Params\MaxSpeed, step, 0, "1" -HKR, Ndi\Params\MaxSpeed, Base, 0, "10" -HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% -HKR, Ndi\Params\KeepLink, type, 0, "enum" -HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% -HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% -HKR, Ndi\Params\KeepLink, default, 0, "0" - - -[Neo.Service] -DisplayName = %Neo.Service.DispName% -Description = %Neo.Service.Desc% -ServiceType = 1 -StartType = 3 -ErrorControl = 1 -ServiceBinary = %12%\Neo_VPN44.sys -LoadOrderGroup = NDIS - -[Neo.Reg] -HKR, Ndi, Service, 0, Neo.Service.Name -HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" -HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" - -[Neo.EventLog] -HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN44.sys" -HKR, , TypesSupported, 0x00010001, 7 - -[Strings] -CompanyName = "SoftEther Corporation" -DiskDescription = "VPN Client Device Driver Install Disk" -Neo.Service.Name = "Neo_VPN44" -Neo.Service.DispName = "VPN Client Device Driver - VPN44" -Neo.Service.Desc = "VPN Client Adapter - VPN44" -NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN44" -Neo.EventLog.Name = "Neo" -NetworkAddress = "MAC Address" -DefaultAddress = "000001000001" -MaxSpeed = "Indicate Speed (Mbps)" -KeepLink = "Keep Link" -On = "On" -Off = "Off" - - -; Auto Generated 20180205_163608.789 - +; VPN Client Device Driver for Windows 2000 and Greater +; +; Copyright (c) SoftEther Corporation. All Rights Reserved. +; http://www.softether.co.jp/ +; +; BUILD 9658 + +[Version] +Signature = "$Windows NT$" +Class = Net +ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} +Provider = %CompanyName% +DriverVer = 02/04/2018, 4.25.0.9658 +CatalogFile.NT = inf_VPN44.cat + +[Manufacturer] +%CompanyName% = SoftEther + +[SourceDisksNames] +1=%DiskDescription%, "", , + +[SourceDisksFiles] +Neo_VPN44.sys = 1 + +[DestinationDirs] +DefaultDestDir = 12 +Neo.CopyFiles.Sys = 12 + +[Neo.CopyFiles.Sys] +Neo_VPN44.sys, , , 2 + +[SoftEther] +%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN44 + +[NeoAdapter.Install] +Characteristics = 0x1 +AddReg = Neo.Reg, NeoAdapter.Ndi +CopyFiles = Neo.CopyFiles.Sys +*IfType = 53 +*MediaType = 0 +*PhysicalMediaType = 0 + +[NeoAdapter.Install.Services] +AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% + +[NeoAdapter.Ndi] +HKR, , NetworkAddress, 0, %DefaultAddress% +HKR, Ndi, DeviceID, , "NeoAdapter_VPN44" +HKR, , DevLoader, , ndis +HKR, , DeviceVxDs, , Neo_VPN44.sys +HKR, NDIS, LogDriverName, , "Neo_VPN44" +HKR, NDIS, MajorNdisVersion, 1, 5 +HKR, NDIS, MinorNdisVersion, 1, 0 +HKR, Ndi\Interfaces, DefUpper, , "ndis5" +HKR, Ndi\Interfaces, UpperRange, , "ndis5" +HKR, Ndi\Interfaces, LowerRange, , "ethernet" +HKR, Ndi\Interfaces, DefLower, , "ethernet" +HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" +HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% +HKR, Ndi\Params\NetworkAddress, type, 0, "edit" +HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" +HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" +HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% +HKR, Ndi\Params\NetworkAddress, optional, 0, "0" +HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% +HKR, Ndi\Params\MaxSpeed, type, 0, "int" +HKR, Ndi\Params\MaxSpeed, default, 0, "100" +HKR, Ndi\Params\MaxSpeed, min, 0, "0" +HKR, Ndi\Params\MaxSpeed, max, 0, "2000" +HKR, Ndi\Params\MaxSpeed, step, 0, "1" +HKR, Ndi\Params\MaxSpeed, Base, 0, "10" +HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% +HKR, Ndi\Params\KeepLink, type, 0, "enum" +HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% +HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% +HKR, Ndi\Params\KeepLink, default, 0, "0" + + +[Neo.Service] +DisplayName = %Neo.Service.DispName% +Description = %Neo.Service.Desc% +ServiceType = 1 +StartType = 3 +ErrorControl = 1 +ServiceBinary = %12%\Neo_VPN44.sys +LoadOrderGroup = NDIS + +[Neo.Reg] +HKR, Ndi, Service, 0, Neo.Service.Name +HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" +HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" + +[Neo.EventLog] +HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN44.sys" +HKR, , TypesSupported, 0x00010001, 7 + +[Strings] +CompanyName = "SoftEther Corporation" +DiskDescription = "VPN Client Device Driver Install Disk" +Neo.Service.Name = "Neo_VPN44" +Neo.Service.DispName = "VPN Client Device Driver - VPN44" +Neo.Service.Desc = "VPN Client Adapter - VPN44" +NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN44" +Neo.EventLog.Name = "Neo" +NetworkAddress = "MAC Address" +DefaultAddress = "000001000001" +MaxSpeed = "Indicate Speed (Mbps)" +KeepLink = "Keep Link" +On = "On" +Off = "Off" + + +; Auto Generated 20180205_163608.789 + diff --git a/src/bin/hamcore/DriverPackages/Neo6_Win8/x86/Neo6_x86_VPN45.inf b/src/bin/hamcore/DriverPackages/Neo6_Win8/x86/Neo6_x86_VPN45.inf index d249a37d..c982b006 100644 --- a/src/bin/hamcore/DriverPackages/Neo6_Win8/x86/Neo6_x86_VPN45.inf +++ b/src/bin/hamcore/DriverPackages/Neo6_Win8/x86/Neo6_x86_VPN45.inf @@ -1,114 +1,114 @@ -; VPN Client Device Driver for Windows 2000 and Greater -; -; Copyright (c) SoftEther Corporation. All Rights Reserved. -; http://www.softether.co.jp/ -; -; BUILD 9658 - -[Version] -Signature = "$Windows NT$" -Class = Net -ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} -Provider = %CompanyName% -DriverVer = 02/04/2018, 4.25.0.9658 -CatalogFile.NT = inf_VPN45.cat - -[Manufacturer] -%CompanyName% = SoftEther - -[SourceDisksNames] -1=%DiskDescription%, "", , - -[SourceDisksFiles] -Neo_VPN45.sys = 1 - -[DestinationDirs] -DefaultDestDir = 12 -Neo.CopyFiles.Sys = 12 - -[Neo.CopyFiles.Sys] -Neo_VPN45.sys, , , 2 - -[SoftEther] -%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN45 - -[NeoAdapter.Install] -Characteristics = 0x1 -AddReg = Neo.Reg, NeoAdapter.Ndi -CopyFiles = Neo.CopyFiles.Sys -*IfType = 53 -*MediaType = 0 -*PhysicalMediaType = 0 - -[NeoAdapter.Install.Services] -AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% - -[NeoAdapter.Ndi] -HKR, , NetworkAddress, 0, %DefaultAddress% -HKR, Ndi, DeviceID, , "NeoAdapter_VPN45" -HKR, , DevLoader, , ndis -HKR, , DeviceVxDs, , Neo_VPN45.sys -HKR, NDIS, LogDriverName, , "Neo_VPN45" -HKR, NDIS, MajorNdisVersion, 1, 5 -HKR, NDIS, MinorNdisVersion, 1, 0 -HKR, Ndi\Interfaces, DefUpper, , "ndis5" -HKR, Ndi\Interfaces, UpperRange, , "ndis5" -HKR, Ndi\Interfaces, LowerRange, , "ethernet" -HKR, Ndi\Interfaces, DefLower, , "ethernet" -HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" -HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% -HKR, Ndi\Params\NetworkAddress, type, 0, "edit" -HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" -HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" -HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% -HKR, Ndi\Params\NetworkAddress, optional, 0, "0" -HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% -HKR, Ndi\Params\MaxSpeed, type, 0, "int" -HKR, Ndi\Params\MaxSpeed, default, 0, "100" -HKR, Ndi\Params\MaxSpeed, min, 0, "0" -HKR, Ndi\Params\MaxSpeed, max, 0, "2000" -HKR, Ndi\Params\MaxSpeed, step, 0, "1" -HKR, Ndi\Params\MaxSpeed, Base, 0, "10" -HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% -HKR, Ndi\Params\KeepLink, type, 0, "enum" -HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% -HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% -HKR, Ndi\Params\KeepLink, default, 0, "0" - - -[Neo.Service] -DisplayName = %Neo.Service.DispName% -Description = %Neo.Service.Desc% -ServiceType = 1 -StartType = 3 -ErrorControl = 1 -ServiceBinary = %12%\Neo_VPN45.sys -LoadOrderGroup = NDIS - -[Neo.Reg] -HKR, Ndi, Service, 0, Neo.Service.Name -HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" -HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" - -[Neo.EventLog] -HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN45.sys" -HKR, , TypesSupported, 0x00010001, 7 - -[Strings] -CompanyName = "SoftEther Corporation" -DiskDescription = "VPN Client Device Driver Install Disk" -Neo.Service.Name = "Neo_VPN45" -Neo.Service.DispName = "VPN Client Device Driver - VPN45" -Neo.Service.Desc = "VPN Client Adapter - VPN45" -NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN45" -Neo.EventLog.Name = "Neo" -NetworkAddress = "MAC Address" -DefaultAddress = "000001000001" -MaxSpeed = "Indicate Speed (Mbps)" -KeepLink = "Keep Link" -On = "On" -Off = "Off" - - -; Auto Generated 20180205_163608.790 - +; VPN Client Device Driver for Windows 2000 and Greater +; +; Copyright (c) SoftEther Corporation. All Rights Reserved. +; http://www.softether.co.jp/ +; +; BUILD 9658 + +[Version] +Signature = "$Windows NT$" +Class = Net +ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} +Provider = %CompanyName% +DriverVer = 02/04/2018, 4.25.0.9658 +CatalogFile.NT = inf_VPN45.cat + +[Manufacturer] +%CompanyName% = SoftEther + +[SourceDisksNames] +1=%DiskDescription%, "", , + +[SourceDisksFiles] +Neo_VPN45.sys = 1 + +[DestinationDirs] +DefaultDestDir = 12 +Neo.CopyFiles.Sys = 12 + +[Neo.CopyFiles.Sys] +Neo_VPN45.sys, , , 2 + +[SoftEther] +%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN45 + +[NeoAdapter.Install] +Characteristics = 0x1 +AddReg = Neo.Reg, NeoAdapter.Ndi +CopyFiles = Neo.CopyFiles.Sys +*IfType = 53 +*MediaType = 0 +*PhysicalMediaType = 0 + +[NeoAdapter.Install.Services] +AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% + +[NeoAdapter.Ndi] +HKR, , NetworkAddress, 0, %DefaultAddress% +HKR, Ndi, DeviceID, , "NeoAdapter_VPN45" +HKR, , DevLoader, , ndis +HKR, , DeviceVxDs, , Neo_VPN45.sys +HKR, NDIS, LogDriverName, , "Neo_VPN45" +HKR, NDIS, MajorNdisVersion, 1, 5 +HKR, NDIS, MinorNdisVersion, 1, 0 +HKR, Ndi\Interfaces, DefUpper, , "ndis5" +HKR, Ndi\Interfaces, UpperRange, , "ndis5" +HKR, Ndi\Interfaces, LowerRange, , "ethernet" +HKR, Ndi\Interfaces, DefLower, , "ethernet" +HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" +HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% +HKR, Ndi\Params\NetworkAddress, type, 0, "edit" +HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" +HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" +HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% +HKR, Ndi\Params\NetworkAddress, optional, 0, "0" +HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% +HKR, Ndi\Params\MaxSpeed, type, 0, "int" +HKR, Ndi\Params\MaxSpeed, default, 0, "100" +HKR, Ndi\Params\MaxSpeed, min, 0, "0" +HKR, Ndi\Params\MaxSpeed, max, 0, "2000" +HKR, Ndi\Params\MaxSpeed, step, 0, "1" +HKR, Ndi\Params\MaxSpeed, Base, 0, "10" +HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% +HKR, Ndi\Params\KeepLink, type, 0, "enum" +HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% +HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% +HKR, Ndi\Params\KeepLink, default, 0, "0" + + +[Neo.Service] +DisplayName = %Neo.Service.DispName% +Description = %Neo.Service.Desc% +ServiceType = 1 +StartType = 3 +ErrorControl = 1 +ServiceBinary = %12%\Neo_VPN45.sys +LoadOrderGroup = NDIS + +[Neo.Reg] +HKR, Ndi, Service, 0, Neo.Service.Name +HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" +HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" + +[Neo.EventLog] +HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN45.sys" +HKR, , TypesSupported, 0x00010001, 7 + +[Strings] +CompanyName = "SoftEther Corporation" +DiskDescription = "VPN Client Device Driver Install Disk" +Neo.Service.Name = "Neo_VPN45" +Neo.Service.DispName = "VPN Client Device Driver - VPN45" +Neo.Service.Desc = "VPN Client Adapter - VPN45" +NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN45" +Neo.EventLog.Name = "Neo" +NetworkAddress = "MAC Address" +DefaultAddress = "000001000001" +MaxSpeed = "Indicate Speed (Mbps)" +KeepLink = "Keep Link" +On = "On" +Off = "Off" + + +; Auto Generated 20180205_163608.790 + diff --git a/src/bin/hamcore/DriverPackages/Neo6_Win8/x86/Neo6_x86_VPN46.inf b/src/bin/hamcore/DriverPackages/Neo6_Win8/x86/Neo6_x86_VPN46.inf index ad2f3c95..1d5b2aa4 100644 --- a/src/bin/hamcore/DriverPackages/Neo6_Win8/x86/Neo6_x86_VPN46.inf +++ b/src/bin/hamcore/DriverPackages/Neo6_Win8/x86/Neo6_x86_VPN46.inf @@ -1,114 +1,114 @@ -; VPN Client Device Driver for Windows 2000 and Greater -; -; Copyright (c) SoftEther Corporation. All Rights Reserved. -; http://www.softether.co.jp/ -; -; BUILD 9658 - -[Version] -Signature = "$Windows NT$" -Class = Net -ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} -Provider = %CompanyName% -DriverVer = 02/04/2018, 4.25.0.9658 -CatalogFile.NT = inf_VPN46.cat - -[Manufacturer] -%CompanyName% = SoftEther - -[SourceDisksNames] -1=%DiskDescription%, "", , - -[SourceDisksFiles] -Neo_VPN46.sys = 1 - -[DestinationDirs] -DefaultDestDir = 12 -Neo.CopyFiles.Sys = 12 - -[Neo.CopyFiles.Sys] -Neo_VPN46.sys, , , 2 - -[SoftEther] -%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN46 - -[NeoAdapter.Install] -Characteristics = 0x1 -AddReg = Neo.Reg, NeoAdapter.Ndi -CopyFiles = Neo.CopyFiles.Sys -*IfType = 53 -*MediaType = 0 -*PhysicalMediaType = 0 - -[NeoAdapter.Install.Services] -AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% - -[NeoAdapter.Ndi] -HKR, , NetworkAddress, 0, %DefaultAddress% -HKR, Ndi, DeviceID, , "NeoAdapter_VPN46" -HKR, , DevLoader, , ndis -HKR, , DeviceVxDs, , Neo_VPN46.sys -HKR, NDIS, LogDriverName, , "Neo_VPN46" -HKR, NDIS, MajorNdisVersion, 1, 5 -HKR, NDIS, MinorNdisVersion, 1, 0 -HKR, Ndi\Interfaces, DefUpper, , "ndis5" -HKR, Ndi\Interfaces, UpperRange, , "ndis5" -HKR, Ndi\Interfaces, LowerRange, , "ethernet" -HKR, Ndi\Interfaces, DefLower, , "ethernet" -HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" -HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% -HKR, Ndi\Params\NetworkAddress, type, 0, "edit" -HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" -HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" -HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% -HKR, Ndi\Params\NetworkAddress, optional, 0, "0" -HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% -HKR, Ndi\Params\MaxSpeed, type, 0, "int" -HKR, Ndi\Params\MaxSpeed, default, 0, "100" -HKR, Ndi\Params\MaxSpeed, min, 0, "0" -HKR, Ndi\Params\MaxSpeed, max, 0, "2000" -HKR, Ndi\Params\MaxSpeed, step, 0, "1" -HKR, Ndi\Params\MaxSpeed, Base, 0, "10" -HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% -HKR, Ndi\Params\KeepLink, type, 0, "enum" -HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% -HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% -HKR, Ndi\Params\KeepLink, default, 0, "0" - - -[Neo.Service] -DisplayName = %Neo.Service.DispName% -Description = %Neo.Service.Desc% -ServiceType = 1 -StartType = 3 -ErrorControl = 1 -ServiceBinary = %12%\Neo_VPN46.sys -LoadOrderGroup = NDIS - -[Neo.Reg] -HKR, Ndi, Service, 0, Neo.Service.Name -HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" -HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" - -[Neo.EventLog] -HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN46.sys" -HKR, , TypesSupported, 0x00010001, 7 - -[Strings] -CompanyName = "SoftEther Corporation" -DiskDescription = "VPN Client Device Driver Install Disk" -Neo.Service.Name = "Neo_VPN46" -Neo.Service.DispName = "VPN Client Device Driver - VPN46" -Neo.Service.Desc = "VPN Client Adapter - VPN46" -NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN46" -Neo.EventLog.Name = "Neo" -NetworkAddress = "MAC Address" -DefaultAddress = "000001000001" -MaxSpeed = "Indicate Speed (Mbps)" -KeepLink = "Keep Link" -On = "On" -Off = "Off" - - -; Auto Generated 20180205_163608.790 - +; VPN Client Device Driver for Windows 2000 and Greater +; +; Copyright (c) SoftEther Corporation. All Rights Reserved. +; http://www.softether.co.jp/ +; +; BUILD 9658 + +[Version] +Signature = "$Windows NT$" +Class = Net +ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} +Provider = %CompanyName% +DriverVer = 02/04/2018, 4.25.0.9658 +CatalogFile.NT = inf_VPN46.cat + +[Manufacturer] +%CompanyName% = SoftEther + +[SourceDisksNames] +1=%DiskDescription%, "", , + +[SourceDisksFiles] +Neo_VPN46.sys = 1 + +[DestinationDirs] +DefaultDestDir = 12 +Neo.CopyFiles.Sys = 12 + +[Neo.CopyFiles.Sys] +Neo_VPN46.sys, , , 2 + +[SoftEther] +%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN46 + +[NeoAdapter.Install] +Characteristics = 0x1 +AddReg = Neo.Reg, NeoAdapter.Ndi +CopyFiles = Neo.CopyFiles.Sys +*IfType = 53 +*MediaType = 0 +*PhysicalMediaType = 0 + +[NeoAdapter.Install.Services] +AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% + +[NeoAdapter.Ndi] +HKR, , NetworkAddress, 0, %DefaultAddress% +HKR, Ndi, DeviceID, , "NeoAdapter_VPN46" +HKR, , DevLoader, , ndis +HKR, , DeviceVxDs, , Neo_VPN46.sys +HKR, NDIS, LogDriverName, , "Neo_VPN46" +HKR, NDIS, MajorNdisVersion, 1, 5 +HKR, NDIS, MinorNdisVersion, 1, 0 +HKR, Ndi\Interfaces, DefUpper, , "ndis5" +HKR, Ndi\Interfaces, UpperRange, , "ndis5" +HKR, Ndi\Interfaces, LowerRange, , "ethernet" +HKR, Ndi\Interfaces, DefLower, , "ethernet" +HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" +HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% +HKR, Ndi\Params\NetworkAddress, type, 0, "edit" +HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" +HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" +HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% +HKR, Ndi\Params\NetworkAddress, optional, 0, "0" +HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% +HKR, Ndi\Params\MaxSpeed, type, 0, "int" +HKR, Ndi\Params\MaxSpeed, default, 0, "100" +HKR, Ndi\Params\MaxSpeed, min, 0, "0" +HKR, Ndi\Params\MaxSpeed, max, 0, "2000" +HKR, Ndi\Params\MaxSpeed, step, 0, "1" +HKR, Ndi\Params\MaxSpeed, Base, 0, "10" +HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% +HKR, Ndi\Params\KeepLink, type, 0, "enum" +HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% +HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% +HKR, Ndi\Params\KeepLink, default, 0, "0" + + +[Neo.Service] +DisplayName = %Neo.Service.DispName% +Description = %Neo.Service.Desc% +ServiceType = 1 +StartType = 3 +ErrorControl = 1 +ServiceBinary = %12%\Neo_VPN46.sys +LoadOrderGroup = NDIS + +[Neo.Reg] +HKR, Ndi, Service, 0, Neo.Service.Name +HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" +HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" + +[Neo.EventLog] +HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN46.sys" +HKR, , TypesSupported, 0x00010001, 7 + +[Strings] +CompanyName = "SoftEther Corporation" +DiskDescription = "VPN Client Device Driver Install Disk" +Neo.Service.Name = "Neo_VPN46" +Neo.Service.DispName = "VPN Client Device Driver - VPN46" +Neo.Service.Desc = "VPN Client Adapter - VPN46" +NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN46" +Neo.EventLog.Name = "Neo" +NetworkAddress = "MAC Address" +DefaultAddress = "000001000001" +MaxSpeed = "Indicate Speed (Mbps)" +KeepLink = "Keep Link" +On = "On" +Off = "Off" + + +; Auto Generated 20180205_163608.790 + diff --git a/src/bin/hamcore/DriverPackages/Neo6_Win8/x86/Neo6_x86_VPN47.inf b/src/bin/hamcore/DriverPackages/Neo6_Win8/x86/Neo6_x86_VPN47.inf index 020c95ec..9d2eecf5 100644 --- a/src/bin/hamcore/DriverPackages/Neo6_Win8/x86/Neo6_x86_VPN47.inf +++ b/src/bin/hamcore/DriverPackages/Neo6_Win8/x86/Neo6_x86_VPN47.inf @@ -1,114 +1,114 @@ -; VPN Client Device Driver for Windows 2000 and Greater -; -; Copyright (c) SoftEther Corporation. All Rights Reserved. -; http://www.softether.co.jp/ -; -; BUILD 9658 - -[Version] -Signature = "$Windows NT$" -Class = Net -ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} -Provider = %CompanyName% -DriverVer = 02/04/2018, 4.25.0.9658 -CatalogFile.NT = inf_VPN47.cat - -[Manufacturer] -%CompanyName% = SoftEther - -[SourceDisksNames] -1=%DiskDescription%, "", , - -[SourceDisksFiles] -Neo_VPN47.sys = 1 - -[DestinationDirs] -DefaultDestDir = 12 -Neo.CopyFiles.Sys = 12 - -[Neo.CopyFiles.Sys] -Neo_VPN47.sys, , , 2 - -[SoftEther] -%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN47 - -[NeoAdapter.Install] -Characteristics = 0x1 -AddReg = Neo.Reg, NeoAdapter.Ndi -CopyFiles = Neo.CopyFiles.Sys -*IfType = 53 -*MediaType = 0 -*PhysicalMediaType = 0 - -[NeoAdapter.Install.Services] -AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% - -[NeoAdapter.Ndi] -HKR, , NetworkAddress, 0, %DefaultAddress% -HKR, Ndi, DeviceID, , "NeoAdapter_VPN47" -HKR, , DevLoader, , ndis -HKR, , DeviceVxDs, , Neo_VPN47.sys -HKR, NDIS, LogDriverName, , "Neo_VPN47" -HKR, NDIS, MajorNdisVersion, 1, 5 -HKR, NDIS, MinorNdisVersion, 1, 0 -HKR, Ndi\Interfaces, DefUpper, , "ndis5" -HKR, Ndi\Interfaces, UpperRange, , "ndis5" -HKR, Ndi\Interfaces, LowerRange, , "ethernet" -HKR, Ndi\Interfaces, DefLower, , "ethernet" -HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" -HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% -HKR, Ndi\Params\NetworkAddress, type, 0, "edit" -HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" -HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" -HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% -HKR, Ndi\Params\NetworkAddress, optional, 0, "0" -HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% -HKR, Ndi\Params\MaxSpeed, type, 0, "int" -HKR, Ndi\Params\MaxSpeed, default, 0, "100" -HKR, Ndi\Params\MaxSpeed, min, 0, "0" -HKR, Ndi\Params\MaxSpeed, max, 0, "2000" -HKR, Ndi\Params\MaxSpeed, step, 0, "1" -HKR, Ndi\Params\MaxSpeed, Base, 0, "10" -HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% -HKR, Ndi\Params\KeepLink, type, 0, "enum" -HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% -HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% -HKR, Ndi\Params\KeepLink, default, 0, "0" - - -[Neo.Service] -DisplayName = %Neo.Service.DispName% -Description = %Neo.Service.Desc% -ServiceType = 1 -StartType = 3 -ErrorControl = 1 -ServiceBinary = %12%\Neo_VPN47.sys -LoadOrderGroup = NDIS - -[Neo.Reg] -HKR, Ndi, Service, 0, Neo.Service.Name -HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" -HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" - -[Neo.EventLog] -HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN47.sys" -HKR, , TypesSupported, 0x00010001, 7 - -[Strings] -CompanyName = "SoftEther Corporation" -DiskDescription = "VPN Client Device Driver Install Disk" -Neo.Service.Name = "Neo_VPN47" -Neo.Service.DispName = "VPN Client Device Driver - VPN47" -Neo.Service.Desc = "VPN Client Adapter - VPN47" -NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN47" -Neo.EventLog.Name = "Neo" -NetworkAddress = "MAC Address" -DefaultAddress = "000001000001" -MaxSpeed = "Indicate Speed (Mbps)" -KeepLink = "Keep Link" -On = "On" -Off = "Off" - - -; Auto Generated 20180205_163608.791 - +; VPN Client Device Driver for Windows 2000 and Greater +; +; Copyright (c) SoftEther Corporation. All Rights Reserved. +; http://www.softether.co.jp/ +; +; BUILD 9658 + +[Version] +Signature = "$Windows NT$" +Class = Net +ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} +Provider = %CompanyName% +DriverVer = 02/04/2018, 4.25.0.9658 +CatalogFile.NT = inf_VPN47.cat + +[Manufacturer] +%CompanyName% = SoftEther + +[SourceDisksNames] +1=%DiskDescription%, "", , + +[SourceDisksFiles] +Neo_VPN47.sys = 1 + +[DestinationDirs] +DefaultDestDir = 12 +Neo.CopyFiles.Sys = 12 + +[Neo.CopyFiles.Sys] +Neo_VPN47.sys, , , 2 + +[SoftEther] +%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN47 + +[NeoAdapter.Install] +Characteristics = 0x1 +AddReg = Neo.Reg, NeoAdapter.Ndi +CopyFiles = Neo.CopyFiles.Sys +*IfType = 53 +*MediaType = 0 +*PhysicalMediaType = 0 + +[NeoAdapter.Install.Services] +AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% + +[NeoAdapter.Ndi] +HKR, , NetworkAddress, 0, %DefaultAddress% +HKR, Ndi, DeviceID, , "NeoAdapter_VPN47" +HKR, , DevLoader, , ndis +HKR, , DeviceVxDs, , Neo_VPN47.sys +HKR, NDIS, LogDriverName, , "Neo_VPN47" +HKR, NDIS, MajorNdisVersion, 1, 5 +HKR, NDIS, MinorNdisVersion, 1, 0 +HKR, Ndi\Interfaces, DefUpper, , "ndis5" +HKR, Ndi\Interfaces, UpperRange, , "ndis5" +HKR, Ndi\Interfaces, LowerRange, , "ethernet" +HKR, Ndi\Interfaces, DefLower, , "ethernet" +HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" +HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% +HKR, Ndi\Params\NetworkAddress, type, 0, "edit" +HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" +HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" +HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% +HKR, Ndi\Params\NetworkAddress, optional, 0, "0" +HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% +HKR, Ndi\Params\MaxSpeed, type, 0, "int" +HKR, Ndi\Params\MaxSpeed, default, 0, "100" +HKR, Ndi\Params\MaxSpeed, min, 0, "0" +HKR, Ndi\Params\MaxSpeed, max, 0, "2000" +HKR, Ndi\Params\MaxSpeed, step, 0, "1" +HKR, Ndi\Params\MaxSpeed, Base, 0, "10" +HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% +HKR, Ndi\Params\KeepLink, type, 0, "enum" +HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% +HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% +HKR, Ndi\Params\KeepLink, default, 0, "0" + + +[Neo.Service] +DisplayName = %Neo.Service.DispName% +Description = %Neo.Service.Desc% +ServiceType = 1 +StartType = 3 +ErrorControl = 1 +ServiceBinary = %12%\Neo_VPN47.sys +LoadOrderGroup = NDIS + +[Neo.Reg] +HKR, Ndi, Service, 0, Neo.Service.Name +HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" +HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" + +[Neo.EventLog] +HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN47.sys" +HKR, , TypesSupported, 0x00010001, 7 + +[Strings] +CompanyName = "SoftEther Corporation" +DiskDescription = "VPN Client Device Driver Install Disk" +Neo.Service.Name = "Neo_VPN47" +Neo.Service.DispName = "VPN Client Device Driver - VPN47" +Neo.Service.Desc = "VPN Client Adapter - VPN47" +NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN47" +Neo.EventLog.Name = "Neo" +NetworkAddress = "MAC Address" +DefaultAddress = "000001000001" +MaxSpeed = "Indicate Speed (Mbps)" +KeepLink = "Keep Link" +On = "On" +Off = "Off" + + +; Auto Generated 20180205_163608.791 + diff --git a/src/bin/hamcore/DriverPackages/Neo6_Win8/x86/Neo6_x86_VPN48.inf b/src/bin/hamcore/DriverPackages/Neo6_Win8/x86/Neo6_x86_VPN48.inf index 63618193..e86f8515 100644 --- a/src/bin/hamcore/DriverPackages/Neo6_Win8/x86/Neo6_x86_VPN48.inf +++ b/src/bin/hamcore/DriverPackages/Neo6_Win8/x86/Neo6_x86_VPN48.inf @@ -1,114 +1,114 @@ -; VPN Client Device Driver for Windows 2000 and Greater -; -; Copyright (c) SoftEther Corporation. All Rights Reserved. -; http://www.softether.co.jp/ -; -; BUILD 9658 - -[Version] -Signature = "$Windows NT$" -Class = Net -ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} -Provider = %CompanyName% -DriverVer = 02/04/2018, 4.25.0.9658 -CatalogFile.NT = inf_VPN48.cat - -[Manufacturer] -%CompanyName% = SoftEther - -[SourceDisksNames] -1=%DiskDescription%, "", , - -[SourceDisksFiles] -Neo_VPN48.sys = 1 - -[DestinationDirs] -DefaultDestDir = 12 -Neo.CopyFiles.Sys = 12 - -[Neo.CopyFiles.Sys] -Neo_VPN48.sys, , , 2 - -[SoftEther] -%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN48 - -[NeoAdapter.Install] -Characteristics = 0x1 -AddReg = Neo.Reg, NeoAdapter.Ndi -CopyFiles = Neo.CopyFiles.Sys -*IfType = 53 -*MediaType = 0 -*PhysicalMediaType = 0 - -[NeoAdapter.Install.Services] -AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% - -[NeoAdapter.Ndi] -HKR, , NetworkAddress, 0, %DefaultAddress% -HKR, Ndi, DeviceID, , "NeoAdapter_VPN48" -HKR, , DevLoader, , ndis -HKR, , DeviceVxDs, , Neo_VPN48.sys -HKR, NDIS, LogDriverName, , "Neo_VPN48" -HKR, NDIS, MajorNdisVersion, 1, 5 -HKR, NDIS, MinorNdisVersion, 1, 0 -HKR, Ndi\Interfaces, DefUpper, , "ndis5" -HKR, Ndi\Interfaces, UpperRange, , "ndis5" -HKR, Ndi\Interfaces, LowerRange, , "ethernet" -HKR, Ndi\Interfaces, DefLower, , "ethernet" -HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" -HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% -HKR, Ndi\Params\NetworkAddress, type, 0, "edit" -HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" -HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" -HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% -HKR, Ndi\Params\NetworkAddress, optional, 0, "0" -HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% -HKR, Ndi\Params\MaxSpeed, type, 0, "int" -HKR, Ndi\Params\MaxSpeed, default, 0, "100" -HKR, Ndi\Params\MaxSpeed, min, 0, "0" -HKR, Ndi\Params\MaxSpeed, max, 0, "2000" -HKR, Ndi\Params\MaxSpeed, step, 0, "1" -HKR, Ndi\Params\MaxSpeed, Base, 0, "10" -HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% -HKR, Ndi\Params\KeepLink, type, 0, "enum" -HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% -HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% -HKR, Ndi\Params\KeepLink, default, 0, "0" - - -[Neo.Service] -DisplayName = %Neo.Service.DispName% -Description = %Neo.Service.Desc% -ServiceType = 1 -StartType = 3 -ErrorControl = 1 -ServiceBinary = %12%\Neo_VPN48.sys -LoadOrderGroup = NDIS - -[Neo.Reg] -HKR, Ndi, Service, 0, Neo.Service.Name -HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" -HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" - -[Neo.EventLog] -HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN48.sys" -HKR, , TypesSupported, 0x00010001, 7 - -[Strings] -CompanyName = "SoftEther Corporation" -DiskDescription = "VPN Client Device Driver Install Disk" -Neo.Service.Name = "Neo_VPN48" -Neo.Service.DispName = "VPN Client Device Driver - VPN48" -Neo.Service.Desc = "VPN Client Adapter - VPN48" -NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN48" -Neo.EventLog.Name = "Neo" -NetworkAddress = "MAC Address" -DefaultAddress = "000001000001" -MaxSpeed = "Indicate Speed (Mbps)" -KeepLink = "Keep Link" -On = "On" -Off = "Off" - - -; Auto Generated 20180205_163608.792 - +; VPN Client Device Driver for Windows 2000 and Greater +; +; Copyright (c) SoftEther Corporation. All Rights Reserved. +; http://www.softether.co.jp/ +; +; BUILD 9658 + +[Version] +Signature = "$Windows NT$" +Class = Net +ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} +Provider = %CompanyName% +DriverVer = 02/04/2018, 4.25.0.9658 +CatalogFile.NT = inf_VPN48.cat + +[Manufacturer] +%CompanyName% = SoftEther + +[SourceDisksNames] +1=%DiskDescription%, "", , + +[SourceDisksFiles] +Neo_VPN48.sys = 1 + +[DestinationDirs] +DefaultDestDir = 12 +Neo.CopyFiles.Sys = 12 + +[Neo.CopyFiles.Sys] +Neo_VPN48.sys, , , 2 + +[SoftEther] +%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN48 + +[NeoAdapter.Install] +Characteristics = 0x1 +AddReg = Neo.Reg, NeoAdapter.Ndi +CopyFiles = Neo.CopyFiles.Sys +*IfType = 53 +*MediaType = 0 +*PhysicalMediaType = 0 + +[NeoAdapter.Install.Services] +AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% + +[NeoAdapter.Ndi] +HKR, , NetworkAddress, 0, %DefaultAddress% +HKR, Ndi, DeviceID, , "NeoAdapter_VPN48" +HKR, , DevLoader, , ndis +HKR, , DeviceVxDs, , Neo_VPN48.sys +HKR, NDIS, LogDriverName, , "Neo_VPN48" +HKR, NDIS, MajorNdisVersion, 1, 5 +HKR, NDIS, MinorNdisVersion, 1, 0 +HKR, Ndi\Interfaces, DefUpper, , "ndis5" +HKR, Ndi\Interfaces, UpperRange, , "ndis5" +HKR, Ndi\Interfaces, LowerRange, , "ethernet" +HKR, Ndi\Interfaces, DefLower, , "ethernet" +HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" +HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% +HKR, Ndi\Params\NetworkAddress, type, 0, "edit" +HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" +HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" +HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% +HKR, Ndi\Params\NetworkAddress, optional, 0, "0" +HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% +HKR, Ndi\Params\MaxSpeed, type, 0, "int" +HKR, Ndi\Params\MaxSpeed, default, 0, "100" +HKR, Ndi\Params\MaxSpeed, min, 0, "0" +HKR, Ndi\Params\MaxSpeed, max, 0, "2000" +HKR, Ndi\Params\MaxSpeed, step, 0, "1" +HKR, Ndi\Params\MaxSpeed, Base, 0, "10" +HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% +HKR, Ndi\Params\KeepLink, type, 0, "enum" +HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% +HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% +HKR, Ndi\Params\KeepLink, default, 0, "0" + + +[Neo.Service] +DisplayName = %Neo.Service.DispName% +Description = %Neo.Service.Desc% +ServiceType = 1 +StartType = 3 +ErrorControl = 1 +ServiceBinary = %12%\Neo_VPN48.sys +LoadOrderGroup = NDIS + +[Neo.Reg] +HKR, Ndi, Service, 0, Neo.Service.Name +HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" +HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" + +[Neo.EventLog] +HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN48.sys" +HKR, , TypesSupported, 0x00010001, 7 + +[Strings] +CompanyName = "SoftEther Corporation" +DiskDescription = "VPN Client Device Driver Install Disk" +Neo.Service.Name = "Neo_VPN48" +Neo.Service.DispName = "VPN Client Device Driver - VPN48" +Neo.Service.Desc = "VPN Client Adapter - VPN48" +NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN48" +Neo.EventLog.Name = "Neo" +NetworkAddress = "MAC Address" +DefaultAddress = "000001000001" +MaxSpeed = "Indicate Speed (Mbps)" +KeepLink = "Keep Link" +On = "On" +Off = "Off" + + +; Auto Generated 20180205_163608.792 + diff --git a/src/bin/hamcore/DriverPackages/Neo6_Win8/x86/Neo6_x86_VPN49.inf b/src/bin/hamcore/DriverPackages/Neo6_Win8/x86/Neo6_x86_VPN49.inf index 1af88f2e..72732bbe 100644 --- a/src/bin/hamcore/DriverPackages/Neo6_Win8/x86/Neo6_x86_VPN49.inf +++ b/src/bin/hamcore/DriverPackages/Neo6_Win8/x86/Neo6_x86_VPN49.inf @@ -1,114 +1,114 @@ -; VPN Client Device Driver for Windows 2000 and Greater -; -; Copyright (c) SoftEther Corporation. All Rights Reserved. -; http://www.softether.co.jp/ -; -; BUILD 9658 - -[Version] -Signature = "$Windows NT$" -Class = Net -ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} -Provider = %CompanyName% -DriverVer = 02/04/2018, 4.25.0.9658 -CatalogFile.NT = inf_VPN49.cat - -[Manufacturer] -%CompanyName% = SoftEther - -[SourceDisksNames] -1=%DiskDescription%, "", , - -[SourceDisksFiles] -Neo_VPN49.sys = 1 - -[DestinationDirs] -DefaultDestDir = 12 -Neo.CopyFiles.Sys = 12 - -[Neo.CopyFiles.Sys] -Neo_VPN49.sys, , , 2 - -[SoftEther] -%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN49 - -[NeoAdapter.Install] -Characteristics = 0x1 -AddReg = Neo.Reg, NeoAdapter.Ndi -CopyFiles = Neo.CopyFiles.Sys -*IfType = 53 -*MediaType = 0 -*PhysicalMediaType = 0 - -[NeoAdapter.Install.Services] -AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% - -[NeoAdapter.Ndi] -HKR, , NetworkAddress, 0, %DefaultAddress% -HKR, Ndi, DeviceID, , "NeoAdapter_VPN49" -HKR, , DevLoader, , ndis -HKR, , DeviceVxDs, , Neo_VPN49.sys -HKR, NDIS, LogDriverName, , "Neo_VPN49" -HKR, NDIS, MajorNdisVersion, 1, 5 -HKR, NDIS, MinorNdisVersion, 1, 0 -HKR, Ndi\Interfaces, DefUpper, , "ndis5" -HKR, Ndi\Interfaces, UpperRange, , "ndis5" -HKR, Ndi\Interfaces, LowerRange, , "ethernet" -HKR, Ndi\Interfaces, DefLower, , "ethernet" -HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" -HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% -HKR, Ndi\Params\NetworkAddress, type, 0, "edit" -HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" -HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" -HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% -HKR, Ndi\Params\NetworkAddress, optional, 0, "0" -HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% -HKR, Ndi\Params\MaxSpeed, type, 0, "int" -HKR, Ndi\Params\MaxSpeed, default, 0, "100" -HKR, Ndi\Params\MaxSpeed, min, 0, "0" -HKR, Ndi\Params\MaxSpeed, max, 0, "2000" -HKR, Ndi\Params\MaxSpeed, step, 0, "1" -HKR, Ndi\Params\MaxSpeed, Base, 0, "10" -HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% -HKR, Ndi\Params\KeepLink, type, 0, "enum" -HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% -HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% -HKR, Ndi\Params\KeepLink, default, 0, "0" - - -[Neo.Service] -DisplayName = %Neo.Service.DispName% -Description = %Neo.Service.Desc% -ServiceType = 1 -StartType = 3 -ErrorControl = 1 -ServiceBinary = %12%\Neo_VPN49.sys -LoadOrderGroup = NDIS - -[Neo.Reg] -HKR, Ndi, Service, 0, Neo.Service.Name -HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" -HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" - -[Neo.EventLog] -HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN49.sys" -HKR, , TypesSupported, 0x00010001, 7 - -[Strings] -CompanyName = "SoftEther Corporation" -DiskDescription = "VPN Client Device Driver Install Disk" -Neo.Service.Name = "Neo_VPN49" -Neo.Service.DispName = "VPN Client Device Driver - VPN49" -Neo.Service.Desc = "VPN Client Adapter - VPN49" -NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN49" -Neo.EventLog.Name = "Neo" -NetworkAddress = "MAC Address" -DefaultAddress = "000001000001" -MaxSpeed = "Indicate Speed (Mbps)" -KeepLink = "Keep Link" -On = "On" -Off = "Off" - - -; Auto Generated 20180205_163608.792 - +; VPN Client Device Driver for Windows 2000 and Greater +; +; Copyright (c) SoftEther Corporation. All Rights Reserved. +; http://www.softether.co.jp/ +; +; BUILD 9658 + +[Version] +Signature = "$Windows NT$" +Class = Net +ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} +Provider = %CompanyName% +DriverVer = 02/04/2018, 4.25.0.9658 +CatalogFile.NT = inf_VPN49.cat + +[Manufacturer] +%CompanyName% = SoftEther + +[SourceDisksNames] +1=%DiskDescription%, "", , + +[SourceDisksFiles] +Neo_VPN49.sys = 1 + +[DestinationDirs] +DefaultDestDir = 12 +Neo.CopyFiles.Sys = 12 + +[Neo.CopyFiles.Sys] +Neo_VPN49.sys, , , 2 + +[SoftEther] +%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN49 + +[NeoAdapter.Install] +Characteristics = 0x1 +AddReg = Neo.Reg, NeoAdapter.Ndi +CopyFiles = Neo.CopyFiles.Sys +*IfType = 53 +*MediaType = 0 +*PhysicalMediaType = 0 + +[NeoAdapter.Install.Services] +AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% + +[NeoAdapter.Ndi] +HKR, , NetworkAddress, 0, %DefaultAddress% +HKR, Ndi, DeviceID, , "NeoAdapter_VPN49" +HKR, , DevLoader, , ndis +HKR, , DeviceVxDs, , Neo_VPN49.sys +HKR, NDIS, LogDriverName, , "Neo_VPN49" +HKR, NDIS, MajorNdisVersion, 1, 5 +HKR, NDIS, MinorNdisVersion, 1, 0 +HKR, Ndi\Interfaces, DefUpper, , "ndis5" +HKR, Ndi\Interfaces, UpperRange, , "ndis5" +HKR, Ndi\Interfaces, LowerRange, , "ethernet" +HKR, Ndi\Interfaces, DefLower, , "ethernet" +HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" +HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% +HKR, Ndi\Params\NetworkAddress, type, 0, "edit" +HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" +HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" +HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% +HKR, Ndi\Params\NetworkAddress, optional, 0, "0" +HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% +HKR, Ndi\Params\MaxSpeed, type, 0, "int" +HKR, Ndi\Params\MaxSpeed, default, 0, "100" +HKR, Ndi\Params\MaxSpeed, min, 0, "0" +HKR, Ndi\Params\MaxSpeed, max, 0, "2000" +HKR, Ndi\Params\MaxSpeed, step, 0, "1" +HKR, Ndi\Params\MaxSpeed, Base, 0, "10" +HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% +HKR, Ndi\Params\KeepLink, type, 0, "enum" +HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% +HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% +HKR, Ndi\Params\KeepLink, default, 0, "0" + + +[Neo.Service] +DisplayName = %Neo.Service.DispName% +Description = %Neo.Service.Desc% +ServiceType = 1 +StartType = 3 +ErrorControl = 1 +ServiceBinary = %12%\Neo_VPN49.sys +LoadOrderGroup = NDIS + +[Neo.Reg] +HKR, Ndi, Service, 0, Neo.Service.Name +HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" +HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" + +[Neo.EventLog] +HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN49.sys" +HKR, , TypesSupported, 0x00010001, 7 + +[Strings] +CompanyName = "SoftEther Corporation" +DiskDescription = "VPN Client Device Driver Install Disk" +Neo.Service.Name = "Neo_VPN49" +Neo.Service.DispName = "VPN Client Device Driver - VPN49" +Neo.Service.Desc = "VPN Client Adapter - VPN49" +NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN49" +Neo.EventLog.Name = "Neo" +NetworkAddress = "MAC Address" +DefaultAddress = "000001000001" +MaxSpeed = "Indicate Speed (Mbps)" +KeepLink = "Keep Link" +On = "On" +Off = "Off" + + +; Auto Generated 20180205_163608.792 + diff --git a/src/bin/hamcore/DriverPackages/Neo6_Win8/x86/Neo6_x86_VPN5.inf b/src/bin/hamcore/DriverPackages/Neo6_Win8/x86/Neo6_x86_VPN5.inf index d748a19a..af12054e 100644 --- a/src/bin/hamcore/DriverPackages/Neo6_Win8/x86/Neo6_x86_VPN5.inf +++ b/src/bin/hamcore/DriverPackages/Neo6_Win8/x86/Neo6_x86_VPN5.inf @@ -1,114 +1,114 @@ -; VPN Client Device Driver for Windows 2000 and Greater -; -; Copyright (c) SoftEther Corporation. All Rights Reserved. -; http://www.softether.co.jp/ -; -; BUILD 9658 - -[Version] -Signature = "$Windows NT$" -Class = Net -ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} -Provider = %CompanyName% -DriverVer = 02/04/2018, 4.25.0.9658 -CatalogFile.NT = inf_VPN5.cat - -[Manufacturer] -%CompanyName% = SoftEther - -[SourceDisksNames] -1=%DiskDescription%, "", , - -[SourceDisksFiles] -Neo_VPN5.sys = 1 - -[DestinationDirs] -DefaultDestDir = 12 -Neo.CopyFiles.Sys = 12 - -[Neo.CopyFiles.Sys] -Neo_VPN5.sys, , , 2 - -[SoftEther] -%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN5 - -[NeoAdapter.Install] -Characteristics = 0x1 -AddReg = Neo.Reg, NeoAdapter.Ndi -CopyFiles = Neo.CopyFiles.Sys -*IfType = 53 -*MediaType = 0 -*PhysicalMediaType = 0 - -[NeoAdapter.Install.Services] -AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% - -[NeoAdapter.Ndi] -HKR, , NetworkAddress, 0, %DefaultAddress% -HKR, Ndi, DeviceID, , "NeoAdapter_VPN5" -HKR, , DevLoader, , ndis -HKR, , DeviceVxDs, , Neo_VPN5.sys -HKR, NDIS, LogDriverName, , "Neo_VPN5" -HKR, NDIS, MajorNdisVersion, 1, 5 -HKR, NDIS, MinorNdisVersion, 1, 0 -HKR, Ndi\Interfaces, DefUpper, , "ndis5" -HKR, Ndi\Interfaces, UpperRange, , "ndis5" -HKR, Ndi\Interfaces, LowerRange, , "ethernet" -HKR, Ndi\Interfaces, DefLower, , "ethernet" -HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" -HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% -HKR, Ndi\Params\NetworkAddress, type, 0, "edit" -HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" -HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" -HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% -HKR, Ndi\Params\NetworkAddress, optional, 0, "0" -HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% -HKR, Ndi\Params\MaxSpeed, type, 0, "int" -HKR, Ndi\Params\MaxSpeed, default, 0, "100" -HKR, Ndi\Params\MaxSpeed, min, 0, "0" -HKR, Ndi\Params\MaxSpeed, max, 0, "2000" -HKR, Ndi\Params\MaxSpeed, step, 0, "1" -HKR, Ndi\Params\MaxSpeed, Base, 0, "10" -HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% -HKR, Ndi\Params\KeepLink, type, 0, "enum" -HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% -HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% -HKR, Ndi\Params\KeepLink, default, 0, "0" - - -[Neo.Service] -DisplayName = %Neo.Service.DispName% -Description = %Neo.Service.Desc% -ServiceType = 1 -StartType = 3 -ErrorControl = 1 -ServiceBinary = %12%\Neo_VPN5.sys -LoadOrderGroup = NDIS - -[Neo.Reg] -HKR, Ndi, Service, 0, Neo.Service.Name -HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" -HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" - -[Neo.EventLog] -HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN5.sys" -HKR, , TypesSupported, 0x00010001, 7 - -[Strings] -CompanyName = "SoftEther Corporation" -DiskDescription = "VPN Client Device Driver Install Disk" -Neo.Service.Name = "Neo_VPN5" -Neo.Service.DispName = "VPN Client Device Driver - VPN5" -Neo.Service.Desc = "VPN Client Adapter - VPN5" -NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN5" -Neo.EventLog.Name = "Neo" -NetworkAddress = "MAC Address" -DefaultAddress = "000001000001" -MaxSpeed = "Indicate Speed (Mbps)" -KeepLink = "Keep Link" -On = "On" -Off = "Off" - - -; Auto Generated 20180205_163608.754 - +; VPN Client Device Driver for Windows 2000 and Greater +; +; Copyright (c) SoftEther Corporation. All Rights Reserved. +; http://www.softether.co.jp/ +; +; BUILD 9658 + +[Version] +Signature = "$Windows NT$" +Class = Net +ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} +Provider = %CompanyName% +DriverVer = 02/04/2018, 4.25.0.9658 +CatalogFile.NT = inf_VPN5.cat + +[Manufacturer] +%CompanyName% = SoftEther + +[SourceDisksNames] +1=%DiskDescription%, "", , + +[SourceDisksFiles] +Neo_VPN5.sys = 1 + +[DestinationDirs] +DefaultDestDir = 12 +Neo.CopyFiles.Sys = 12 + +[Neo.CopyFiles.Sys] +Neo_VPN5.sys, , , 2 + +[SoftEther] +%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN5 + +[NeoAdapter.Install] +Characteristics = 0x1 +AddReg = Neo.Reg, NeoAdapter.Ndi +CopyFiles = Neo.CopyFiles.Sys +*IfType = 53 +*MediaType = 0 +*PhysicalMediaType = 0 + +[NeoAdapter.Install.Services] +AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% + +[NeoAdapter.Ndi] +HKR, , NetworkAddress, 0, %DefaultAddress% +HKR, Ndi, DeviceID, , "NeoAdapter_VPN5" +HKR, , DevLoader, , ndis +HKR, , DeviceVxDs, , Neo_VPN5.sys +HKR, NDIS, LogDriverName, , "Neo_VPN5" +HKR, NDIS, MajorNdisVersion, 1, 5 +HKR, NDIS, MinorNdisVersion, 1, 0 +HKR, Ndi\Interfaces, DefUpper, , "ndis5" +HKR, Ndi\Interfaces, UpperRange, , "ndis5" +HKR, Ndi\Interfaces, LowerRange, , "ethernet" +HKR, Ndi\Interfaces, DefLower, , "ethernet" +HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" +HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% +HKR, Ndi\Params\NetworkAddress, type, 0, "edit" +HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" +HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" +HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% +HKR, Ndi\Params\NetworkAddress, optional, 0, "0" +HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% +HKR, Ndi\Params\MaxSpeed, type, 0, "int" +HKR, Ndi\Params\MaxSpeed, default, 0, "100" +HKR, Ndi\Params\MaxSpeed, min, 0, "0" +HKR, Ndi\Params\MaxSpeed, max, 0, "2000" +HKR, Ndi\Params\MaxSpeed, step, 0, "1" +HKR, Ndi\Params\MaxSpeed, Base, 0, "10" +HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% +HKR, Ndi\Params\KeepLink, type, 0, "enum" +HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% +HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% +HKR, Ndi\Params\KeepLink, default, 0, "0" + + +[Neo.Service] +DisplayName = %Neo.Service.DispName% +Description = %Neo.Service.Desc% +ServiceType = 1 +StartType = 3 +ErrorControl = 1 +ServiceBinary = %12%\Neo_VPN5.sys +LoadOrderGroup = NDIS + +[Neo.Reg] +HKR, Ndi, Service, 0, Neo.Service.Name +HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" +HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" + +[Neo.EventLog] +HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN5.sys" +HKR, , TypesSupported, 0x00010001, 7 + +[Strings] +CompanyName = "SoftEther Corporation" +DiskDescription = "VPN Client Device Driver Install Disk" +Neo.Service.Name = "Neo_VPN5" +Neo.Service.DispName = "VPN Client Device Driver - VPN5" +Neo.Service.Desc = "VPN Client Adapter - VPN5" +NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN5" +Neo.EventLog.Name = "Neo" +NetworkAddress = "MAC Address" +DefaultAddress = "000001000001" +MaxSpeed = "Indicate Speed (Mbps)" +KeepLink = "Keep Link" +On = "On" +Off = "Off" + + +; Auto Generated 20180205_163608.754 + diff --git a/src/bin/hamcore/DriverPackages/Neo6_Win8/x86/Neo6_x86_VPN50.inf b/src/bin/hamcore/DriverPackages/Neo6_Win8/x86/Neo6_x86_VPN50.inf index b033295d..30e7e982 100644 --- a/src/bin/hamcore/DriverPackages/Neo6_Win8/x86/Neo6_x86_VPN50.inf +++ b/src/bin/hamcore/DriverPackages/Neo6_Win8/x86/Neo6_x86_VPN50.inf @@ -1,114 +1,114 @@ -; VPN Client Device Driver for Windows 2000 and Greater -; -; Copyright (c) SoftEther Corporation. All Rights Reserved. -; http://www.softether.co.jp/ -; -; BUILD 9658 - -[Version] -Signature = "$Windows NT$" -Class = Net -ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} -Provider = %CompanyName% -DriverVer = 02/04/2018, 4.25.0.9658 -CatalogFile.NT = inf_VPN50.cat - -[Manufacturer] -%CompanyName% = SoftEther - -[SourceDisksNames] -1=%DiskDescription%, "", , - -[SourceDisksFiles] -Neo_VPN50.sys = 1 - -[DestinationDirs] -DefaultDestDir = 12 -Neo.CopyFiles.Sys = 12 - -[Neo.CopyFiles.Sys] -Neo_VPN50.sys, , , 2 - -[SoftEther] -%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN50 - -[NeoAdapter.Install] -Characteristics = 0x1 -AddReg = Neo.Reg, NeoAdapter.Ndi -CopyFiles = Neo.CopyFiles.Sys -*IfType = 53 -*MediaType = 0 -*PhysicalMediaType = 0 - -[NeoAdapter.Install.Services] -AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% - -[NeoAdapter.Ndi] -HKR, , NetworkAddress, 0, %DefaultAddress% -HKR, Ndi, DeviceID, , "NeoAdapter_VPN50" -HKR, , DevLoader, , ndis -HKR, , DeviceVxDs, , Neo_VPN50.sys -HKR, NDIS, LogDriverName, , "Neo_VPN50" -HKR, NDIS, MajorNdisVersion, 1, 5 -HKR, NDIS, MinorNdisVersion, 1, 0 -HKR, Ndi\Interfaces, DefUpper, , "ndis5" -HKR, Ndi\Interfaces, UpperRange, , "ndis5" -HKR, Ndi\Interfaces, LowerRange, , "ethernet" -HKR, Ndi\Interfaces, DefLower, , "ethernet" -HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" -HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% -HKR, Ndi\Params\NetworkAddress, type, 0, "edit" -HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" -HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" -HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% -HKR, Ndi\Params\NetworkAddress, optional, 0, "0" -HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% -HKR, Ndi\Params\MaxSpeed, type, 0, "int" -HKR, Ndi\Params\MaxSpeed, default, 0, "100" -HKR, Ndi\Params\MaxSpeed, min, 0, "0" -HKR, Ndi\Params\MaxSpeed, max, 0, "2000" -HKR, Ndi\Params\MaxSpeed, step, 0, "1" -HKR, Ndi\Params\MaxSpeed, Base, 0, "10" -HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% -HKR, Ndi\Params\KeepLink, type, 0, "enum" -HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% -HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% -HKR, Ndi\Params\KeepLink, default, 0, "0" - - -[Neo.Service] -DisplayName = %Neo.Service.DispName% -Description = %Neo.Service.Desc% -ServiceType = 1 -StartType = 3 -ErrorControl = 1 -ServiceBinary = %12%\Neo_VPN50.sys -LoadOrderGroup = NDIS - -[Neo.Reg] -HKR, Ndi, Service, 0, Neo.Service.Name -HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" -HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" - -[Neo.EventLog] -HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN50.sys" -HKR, , TypesSupported, 0x00010001, 7 - -[Strings] -CompanyName = "SoftEther Corporation" -DiskDescription = "VPN Client Device Driver Install Disk" -Neo.Service.Name = "Neo_VPN50" -Neo.Service.DispName = "VPN Client Device Driver - VPN50" -Neo.Service.Desc = "VPN Client Adapter - VPN50" -NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN50" -Neo.EventLog.Name = "Neo" -NetworkAddress = "MAC Address" -DefaultAddress = "000001000001" -MaxSpeed = "Indicate Speed (Mbps)" -KeepLink = "Keep Link" -On = "On" -Off = "Off" - - -; Auto Generated 20180205_163608.793 - +; VPN Client Device Driver for Windows 2000 and Greater +; +; Copyright (c) SoftEther Corporation. All Rights Reserved. +; http://www.softether.co.jp/ +; +; BUILD 9658 + +[Version] +Signature = "$Windows NT$" +Class = Net +ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} +Provider = %CompanyName% +DriverVer = 02/04/2018, 4.25.0.9658 +CatalogFile.NT = inf_VPN50.cat + +[Manufacturer] +%CompanyName% = SoftEther + +[SourceDisksNames] +1=%DiskDescription%, "", , + +[SourceDisksFiles] +Neo_VPN50.sys = 1 + +[DestinationDirs] +DefaultDestDir = 12 +Neo.CopyFiles.Sys = 12 + +[Neo.CopyFiles.Sys] +Neo_VPN50.sys, , , 2 + +[SoftEther] +%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN50 + +[NeoAdapter.Install] +Characteristics = 0x1 +AddReg = Neo.Reg, NeoAdapter.Ndi +CopyFiles = Neo.CopyFiles.Sys +*IfType = 53 +*MediaType = 0 +*PhysicalMediaType = 0 + +[NeoAdapter.Install.Services] +AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% + +[NeoAdapter.Ndi] +HKR, , NetworkAddress, 0, %DefaultAddress% +HKR, Ndi, DeviceID, , "NeoAdapter_VPN50" +HKR, , DevLoader, , ndis +HKR, , DeviceVxDs, , Neo_VPN50.sys +HKR, NDIS, LogDriverName, , "Neo_VPN50" +HKR, NDIS, MajorNdisVersion, 1, 5 +HKR, NDIS, MinorNdisVersion, 1, 0 +HKR, Ndi\Interfaces, DefUpper, , "ndis5" +HKR, Ndi\Interfaces, UpperRange, , "ndis5" +HKR, Ndi\Interfaces, LowerRange, , "ethernet" +HKR, Ndi\Interfaces, DefLower, , "ethernet" +HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" +HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% +HKR, Ndi\Params\NetworkAddress, type, 0, "edit" +HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" +HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" +HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% +HKR, Ndi\Params\NetworkAddress, optional, 0, "0" +HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% +HKR, Ndi\Params\MaxSpeed, type, 0, "int" +HKR, Ndi\Params\MaxSpeed, default, 0, "100" +HKR, Ndi\Params\MaxSpeed, min, 0, "0" +HKR, Ndi\Params\MaxSpeed, max, 0, "2000" +HKR, Ndi\Params\MaxSpeed, step, 0, "1" +HKR, Ndi\Params\MaxSpeed, Base, 0, "10" +HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% +HKR, Ndi\Params\KeepLink, type, 0, "enum" +HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% +HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% +HKR, Ndi\Params\KeepLink, default, 0, "0" + + +[Neo.Service] +DisplayName = %Neo.Service.DispName% +Description = %Neo.Service.Desc% +ServiceType = 1 +StartType = 3 +ErrorControl = 1 +ServiceBinary = %12%\Neo_VPN50.sys +LoadOrderGroup = NDIS + +[Neo.Reg] +HKR, Ndi, Service, 0, Neo.Service.Name +HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" +HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" + +[Neo.EventLog] +HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN50.sys" +HKR, , TypesSupported, 0x00010001, 7 + +[Strings] +CompanyName = "SoftEther Corporation" +DiskDescription = "VPN Client Device Driver Install Disk" +Neo.Service.Name = "Neo_VPN50" +Neo.Service.DispName = "VPN Client Device Driver - VPN50" +Neo.Service.Desc = "VPN Client Adapter - VPN50" +NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN50" +Neo.EventLog.Name = "Neo" +NetworkAddress = "MAC Address" +DefaultAddress = "000001000001" +MaxSpeed = "Indicate Speed (Mbps)" +KeepLink = "Keep Link" +On = "On" +Off = "Off" + + +; Auto Generated 20180205_163608.793 + diff --git a/src/bin/hamcore/DriverPackages/Neo6_Win8/x86/Neo6_x86_VPN51.inf b/src/bin/hamcore/DriverPackages/Neo6_Win8/x86/Neo6_x86_VPN51.inf index 56e8ada6..ec8f49c8 100644 --- a/src/bin/hamcore/DriverPackages/Neo6_Win8/x86/Neo6_x86_VPN51.inf +++ b/src/bin/hamcore/DriverPackages/Neo6_Win8/x86/Neo6_x86_VPN51.inf @@ -1,114 +1,114 @@ -; VPN Client Device Driver for Windows 2000 and Greater -; -; Copyright (c) SoftEther Corporation. All Rights Reserved. -; http://www.softether.co.jp/ -; -; BUILD 9658 - -[Version] -Signature = "$Windows NT$" -Class = Net -ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} -Provider = %CompanyName% -DriverVer = 02/04/2018, 4.25.0.9658 -CatalogFile.NT = inf_VPN51.cat - -[Manufacturer] -%CompanyName% = SoftEther - -[SourceDisksNames] -1=%DiskDescription%, "", , - -[SourceDisksFiles] -Neo_VPN51.sys = 1 - -[DestinationDirs] -DefaultDestDir = 12 -Neo.CopyFiles.Sys = 12 - -[Neo.CopyFiles.Sys] -Neo_VPN51.sys, , , 2 - -[SoftEther] -%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN51 - -[NeoAdapter.Install] -Characteristics = 0x1 -AddReg = Neo.Reg, NeoAdapter.Ndi -CopyFiles = Neo.CopyFiles.Sys -*IfType = 53 -*MediaType = 0 -*PhysicalMediaType = 0 - -[NeoAdapter.Install.Services] -AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% - -[NeoAdapter.Ndi] -HKR, , NetworkAddress, 0, %DefaultAddress% -HKR, Ndi, DeviceID, , "NeoAdapter_VPN51" -HKR, , DevLoader, , ndis -HKR, , DeviceVxDs, , Neo_VPN51.sys -HKR, NDIS, LogDriverName, , "Neo_VPN51" -HKR, NDIS, MajorNdisVersion, 1, 5 -HKR, NDIS, MinorNdisVersion, 1, 0 -HKR, Ndi\Interfaces, DefUpper, , "ndis5" -HKR, Ndi\Interfaces, UpperRange, , "ndis5" -HKR, Ndi\Interfaces, LowerRange, , "ethernet" -HKR, Ndi\Interfaces, DefLower, , "ethernet" -HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" -HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% -HKR, Ndi\Params\NetworkAddress, type, 0, "edit" -HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" -HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" -HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% -HKR, Ndi\Params\NetworkAddress, optional, 0, "0" -HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% -HKR, Ndi\Params\MaxSpeed, type, 0, "int" -HKR, Ndi\Params\MaxSpeed, default, 0, "100" -HKR, Ndi\Params\MaxSpeed, min, 0, "0" -HKR, Ndi\Params\MaxSpeed, max, 0, "2000" -HKR, Ndi\Params\MaxSpeed, step, 0, "1" -HKR, Ndi\Params\MaxSpeed, Base, 0, "10" -HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% -HKR, Ndi\Params\KeepLink, type, 0, "enum" -HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% -HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% -HKR, Ndi\Params\KeepLink, default, 0, "0" - - -[Neo.Service] -DisplayName = %Neo.Service.DispName% -Description = %Neo.Service.Desc% -ServiceType = 1 -StartType = 3 -ErrorControl = 1 -ServiceBinary = %12%\Neo_VPN51.sys -LoadOrderGroup = NDIS - -[Neo.Reg] -HKR, Ndi, Service, 0, Neo.Service.Name -HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" -HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" - -[Neo.EventLog] -HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN51.sys" -HKR, , TypesSupported, 0x00010001, 7 - -[Strings] -CompanyName = "SoftEther Corporation" -DiskDescription = "VPN Client Device Driver Install Disk" -Neo.Service.Name = "Neo_VPN51" -Neo.Service.DispName = "VPN Client Device Driver - VPN51" -Neo.Service.Desc = "VPN Client Adapter - VPN51" -NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN51" -Neo.EventLog.Name = "Neo" -NetworkAddress = "MAC Address" -DefaultAddress = "000001000001" -MaxSpeed = "Indicate Speed (Mbps)" -KeepLink = "Keep Link" -On = "On" -Off = "Off" - - -; Auto Generated 20180205_163608.794 - +; VPN Client Device Driver for Windows 2000 and Greater +; +; Copyright (c) SoftEther Corporation. All Rights Reserved. +; http://www.softether.co.jp/ +; +; BUILD 9658 + +[Version] +Signature = "$Windows NT$" +Class = Net +ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} +Provider = %CompanyName% +DriverVer = 02/04/2018, 4.25.0.9658 +CatalogFile.NT = inf_VPN51.cat + +[Manufacturer] +%CompanyName% = SoftEther + +[SourceDisksNames] +1=%DiskDescription%, "", , + +[SourceDisksFiles] +Neo_VPN51.sys = 1 + +[DestinationDirs] +DefaultDestDir = 12 +Neo.CopyFiles.Sys = 12 + +[Neo.CopyFiles.Sys] +Neo_VPN51.sys, , , 2 + +[SoftEther] +%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN51 + +[NeoAdapter.Install] +Characteristics = 0x1 +AddReg = Neo.Reg, NeoAdapter.Ndi +CopyFiles = Neo.CopyFiles.Sys +*IfType = 53 +*MediaType = 0 +*PhysicalMediaType = 0 + +[NeoAdapter.Install.Services] +AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% + +[NeoAdapter.Ndi] +HKR, , NetworkAddress, 0, %DefaultAddress% +HKR, Ndi, DeviceID, , "NeoAdapter_VPN51" +HKR, , DevLoader, , ndis +HKR, , DeviceVxDs, , Neo_VPN51.sys +HKR, NDIS, LogDriverName, , "Neo_VPN51" +HKR, NDIS, MajorNdisVersion, 1, 5 +HKR, NDIS, MinorNdisVersion, 1, 0 +HKR, Ndi\Interfaces, DefUpper, , "ndis5" +HKR, Ndi\Interfaces, UpperRange, , "ndis5" +HKR, Ndi\Interfaces, LowerRange, , "ethernet" +HKR, Ndi\Interfaces, DefLower, , "ethernet" +HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" +HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% +HKR, Ndi\Params\NetworkAddress, type, 0, "edit" +HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" +HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" +HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% +HKR, Ndi\Params\NetworkAddress, optional, 0, "0" +HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% +HKR, Ndi\Params\MaxSpeed, type, 0, "int" +HKR, Ndi\Params\MaxSpeed, default, 0, "100" +HKR, Ndi\Params\MaxSpeed, min, 0, "0" +HKR, Ndi\Params\MaxSpeed, max, 0, "2000" +HKR, Ndi\Params\MaxSpeed, step, 0, "1" +HKR, Ndi\Params\MaxSpeed, Base, 0, "10" +HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% +HKR, Ndi\Params\KeepLink, type, 0, "enum" +HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% +HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% +HKR, Ndi\Params\KeepLink, default, 0, "0" + + +[Neo.Service] +DisplayName = %Neo.Service.DispName% +Description = %Neo.Service.Desc% +ServiceType = 1 +StartType = 3 +ErrorControl = 1 +ServiceBinary = %12%\Neo_VPN51.sys +LoadOrderGroup = NDIS + +[Neo.Reg] +HKR, Ndi, Service, 0, Neo.Service.Name +HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" +HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" + +[Neo.EventLog] +HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN51.sys" +HKR, , TypesSupported, 0x00010001, 7 + +[Strings] +CompanyName = "SoftEther Corporation" +DiskDescription = "VPN Client Device Driver Install Disk" +Neo.Service.Name = "Neo_VPN51" +Neo.Service.DispName = "VPN Client Device Driver - VPN51" +Neo.Service.Desc = "VPN Client Adapter - VPN51" +NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN51" +Neo.EventLog.Name = "Neo" +NetworkAddress = "MAC Address" +DefaultAddress = "000001000001" +MaxSpeed = "Indicate Speed (Mbps)" +KeepLink = "Keep Link" +On = "On" +Off = "Off" + + +; Auto Generated 20180205_163608.794 + diff --git a/src/bin/hamcore/DriverPackages/Neo6_Win8/x86/Neo6_x86_VPN52.inf b/src/bin/hamcore/DriverPackages/Neo6_Win8/x86/Neo6_x86_VPN52.inf index b6ce5256..31d59325 100644 --- a/src/bin/hamcore/DriverPackages/Neo6_Win8/x86/Neo6_x86_VPN52.inf +++ b/src/bin/hamcore/DriverPackages/Neo6_Win8/x86/Neo6_x86_VPN52.inf @@ -1,114 +1,114 @@ -; VPN Client Device Driver for Windows 2000 and Greater -; -; Copyright (c) SoftEther Corporation. All Rights Reserved. -; http://www.softether.co.jp/ -; -; BUILD 9658 - -[Version] -Signature = "$Windows NT$" -Class = Net -ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} -Provider = %CompanyName% -DriverVer = 02/04/2018, 4.25.0.9658 -CatalogFile.NT = inf_VPN52.cat - -[Manufacturer] -%CompanyName% = SoftEther - -[SourceDisksNames] -1=%DiskDescription%, "", , - -[SourceDisksFiles] -Neo_VPN52.sys = 1 - -[DestinationDirs] -DefaultDestDir = 12 -Neo.CopyFiles.Sys = 12 - -[Neo.CopyFiles.Sys] -Neo_VPN52.sys, , , 2 - -[SoftEther] -%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN52 - -[NeoAdapter.Install] -Characteristics = 0x1 -AddReg = Neo.Reg, NeoAdapter.Ndi -CopyFiles = Neo.CopyFiles.Sys -*IfType = 53 -*MediaType = 0 -*PhysicalMediaType = 0 - -[NeoAdapter.Install.Services] -AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% - -[NeoAdapter.Ndi] -HKR, , NetworkAddress, 0, %DefaultAddress% -HKR, Ndi, DeviceID, , "NeoAdapter_VPN52" -HKR, , DevLoader, , ndis -HKR, , DeviceVxDs, , Neo_VPN52.sys -HKR, NDIS, LogDriverName, , "Neo_VPN52" -HKR, NDIS, MajorNdisVersion, 1, 5 -HKR, NDIS, MinorNdisVersion, 1, 0 -HKR, Ndi\Interfaces, DefUpper, , "ndis5" -HKR, Ndi\Interfaces, UpperRange, , "ndis5" -HKR, Ndi\Interfaces, LowerRange, , "ethernet" -HKR, Ndi\Interfaces, DefLower, , "ethernet" -HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" -HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% -HKR, Ndi\Params\NetworkAddress, type, 0, "edit" -HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" -HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" -HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% -HKR, Ndi\Params\NetworkAddress, optional, 0, "0" -HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% -HKR, Ndi\Params\MaxSpeed, type, 0, "int" -HKR, Ndi\Params\MaxSpeed, default, 0, "100" -HKR, Ndi\Params\MaxSpeed, min, 0, "0" -HKR, Ndi\Params\MaxSpeed, max, 0, "2000" -HKR, Ndi\Params\MaxSpeed, step, 0, "1" -HKR, Ndi\Params\MaxSpeed, Base, 0, "10" -HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% -HKR, Ndi\Params\KeepLink, type, 0, "enum" -HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% -HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% -HKR, Ndi\Params\KeepLink, default, 0, "0" - - -[Neo.Service] -DisplayName = %Neo.Service.DispName% -Description = %Neo.Service.Desc% -ServiceType = 1 -StartType = 3 -ErrorControl = 1 -ServiceBinary = %12%\Neo_VPN52.sys -LoadOrderGroup = NDIS - -[Neo.Reg] -HKR, Ndi, Service, 0, Neo.Service.Name -HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" -HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" - -[Neo.EventLog] -HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN52.sys" -HKR, , TypesSupported, 0x00010001, 7 - -[Strings] -CompanyName = "SoftEther Corporation" -DiskDescription = "VPN Client Device Driver Install Disk" -Neo.Service.Name = "Neo_VPN52" -Neo.Service.DispName = "VPN Client Device Driver - VPN52" -Neo.Service.Desc = "VPN Client Adapter - VPN52" -NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN52" -Neo.EventLog.Name = "Neo" -NetworkAddress = "MAC Address" -DefaultAddress = "000001000001" -MaxSpeed = "Indicate Speed (Mbps)" -KeepLink = "Keep Link" -On = "On" -Off = "Off" - - -; Auto Generated 20180205_163608.794 - +; VPN Client Device Driver for Windows 2000 and Greater +; +; Copyright (c) SoftEther Corporation. All Rights Reserved. +; http://www.softether.co.jp/ +; +; BUILD 9658 + +[Version] +Signature = "$Windows NT$" +Class = Net +ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} +Provider = %CompanyName% +DriverVer = 02/04/2018, 4.25.0.9658 +CatalogFile.NT = inf_VPN52.cat + +[Manufacturer] +%CompanyName% = SoftEther + +[SourceDisksNames] +1=%DiskDescription%, "", , + +[SourceDisksFiles] +Neo_VPN52.sys = 1 + +[DestinationDirs] +DefaultDestDir = 12 +Neo.CopyFiles.Sys = 12 + +[Neo.CopyFiles.Sys] +Neo_VPN52.sys, , , 2 + +[SoftEther] +%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN52 + +[NeoAdapter.Install] +Characteristics = 0x1 +AddReg = Neo.Reg, NeoAdapter.Ndi +CopyFiles = Neo.CopyFiles.Sys +*IfType = 53 +*MediaType = 0 +*PhysicalMediaType = 0 + +[NeoAdapter.Install.Services] +AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% + +[NeoAdapter.Ndi] +HKR, , NetworkAddress, 0, %DefaultAddress% +HKR, Ndi, DeviceID, , "NeoAdapter_VPN52" +HKR, , DevLoader, , ndis +HKR, , DeviceVxDs, , Neo_VPN52.sys +HKR, NDIS, LogDriverName, , "Neo_VPN52" +HKR, NDIS, MajorNdisVersion, 1, 5 +HKR, NDIS, MinorNdisVersion, 1, 0 +HKR, Ndi\Interfaces, DefUpper, , "ndis5" +HKR, Ndi\Interfaces, UpperRange, , "ndis5" +HKR, Ndi\Interfaces, LowerRange, , "ethernet" +HKR, Ndi\Interfaces, DefLower, , "ethernet" +HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" +HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% +HKR, Ndi\Params\NetworkAddress, type, 0, "edit" +HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" +HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" +HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% +HKR, Ndi\Params\NetworkAddress, optional, 0, "0" +HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% +HKR, Ndi\Params\MaxSpeed, type, 0, "int" +HKR, Ndi\Params\MaxSpeed, default, 0, "100" +HKR, Ndi\Params\MaxSpeed, min, 0, "0" +HKR, Ndi\Params\MaxSpeed, max, 0, "2000" +HKR, Ndi\Params\MaxSpeed, step, 0, "1" +HKR, Ndi\Params\MaxSpeed, Base, 0, "10" +HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% +HKR, Ndi\Params\KeepLink, type, 0, "enum" +HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% +HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% +HKR, Ndi\Params\KeepLink, default, 0, "0" + + +[Neo.Service] +DisplayName = %Neo.Service.DispName% +Description = %Neo.Service.Desc% +ServiceType = 1 +StartType = 3 +ErrorControl = 1 +ServiceBinary = %12%\Neo_VPN52.sys +LoadOrderGroup = NDIS + +[Neo.Reg] +HKR, Ndi, Service, 0, Neo.Service.Name +HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" +HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" + +[Neo.EventLog] +HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN52.sys" +HKR, , TypesSupported, 0x00010001, 7 + +[Strings] +CompanyName = "SoftEther Corporation" +DiskDescription = "VPN Client Device Driver Install Disk" +Neo.Service.Name = "Neo_VPN52" +Neo.Service.DispName = "VPN Client Device Driver - VPN52" +Neo.Service.Desc = "VPN Client Adapter - VPN52" +NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN52" +Neo.EventLog.Name = "Neo" +NetworkAddress = "MAC Address" +DefaultAddress = "000001000001" +MaxSpeed = "Indicate Speed (Mbps)" +KeepLink = "Keep Link" +On = "On" +Off = "Off" + + +; Auto Generated 20180205_163608.794 + diff --git a/src/bin/hamcore/DriverPackages/Neo6_Win8/x86/Neo6_x86_VPN53.inf b/src/bin/hamcore/DriverPackages/Neo6_Win8/x86/Neo6_x86_VPN53.inf index f62cbfb9..be9c9c11 100644 --- a/src/bin/hamcore/DriverPackages/Neo6_Win8/x86/Neo6_x86_VPN53.inf +++ b/src/bin/hamcore/DriverPackages/Neo6_Win8/x86/Neo6_x86_VPN53.inf @@ -1,114 +1,114 @@ -; VPN Client Device Driver for Windows 2000 and Greater -; -; Copyright (c) SoftEther Corporation. All Rights Reserved. -; http://www.softether.co.jp/ -; -; BUILD 9658 - -[Version] -Signature = "$Windows NT$" -Class = Net -ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} -Provider = %CompanyName% -DriverVer = 02/04/2018, 4.25.0.9658 -CatalogFile.NT = inf_VPN53.cat - -[Manufacturer] -%CompanyName% = SoftEther - -[SourceDisksNames] -1=%DiskDescription%, "", , - -[SourceDisksFiles] -Neo_VPN53.sys = 1 - -[DestinationDirs] -DefaultDestDir = 12 -Neo.CopyFiles.Sys = 12 - -[Neo.CopyFiles.Sys] -Neo_VPN53.sys, , , 2 - -[SoftEther] -%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN53 - -[NeoAdapter.Install] -Characteristics = 0x1 -AddReg = Neo.Reg, NeoAdapter.Ndi -CopyFiles = Neo.CopyFiles.Sys -*IfType = 53 -*MediaType = 0 -*PhysicalMediaType = 0 - -[NeoAdapter.Install.Services] -AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% - -[NeoAdapter.Ndi] -HKR, , NetworkAddress, 0, %DefaultAddress% -HKR, Ndi, DeviceID, , "NeoAdapter_VPN53" -HKR, , DevLoader, , ndis -HKR, , DeviceVxDs, , Neo_VPN53.sys -HKR, NDIS, LogDriverName, , "Neo_VPN53" -HKR, NDIS, MajorNdisVersion, 1, 5 -HKR, NDIS, MinorNdisVersion, 1, 0 -HKR, Ndi\Interfaces, DefUpper, , "ndis5" -HKR, Ndi\Interfaces, UpperRange, , "ndis5" -HKR, Ndi\Interfaces, LowerRange, , "ethernet" -HKR, Ndi\Interfaces, DefLower, , "ethernet" -HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" -HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% -HKR, Ndi\Params\NetworkAddress, type, 0, "edit" -HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" -HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" -HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% -HKR, Ndi\Params\NetworkAddress, optional, 0, "0" -HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% -HKR, Ndi\Params\MaxSpeed, type, 0, "int" -HKR, Ndi\Params\MaxSpeed, default, 0, "100" -HKR, Ndi\Params\MaxSpeed, min, 0, "0" -HKR, Ndi\Params\MaxSpeed, max, 0, "2000" -HKR, Ndi\Params\MaxSpeed, step, 0, "1" -HKR, Ndi\Params\MaxSpeed, Base, 0, "10" -HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% -HKR, Ndi\Params\KeepLink, type, 0, "enum" -HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% -HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% -HKR, Ndi\Params\KeepLink, default, 0, "0" - - -[Neo.Service] -DisplayName = %Neo.Service.DispName% -Description = %Neo.Service.Desc% -ServiceType = 1 -StartType = 3 -ErrorControl = 1 -ServiceBinary = %12%\Neo_VPN53.sys -LoadOrderGroup = NDIS - -[Neo.Reg] -HKR, Ndi, Service, 0, Neo.Service.Name -HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" -HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" - -[Neo.EventLog] -HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN53.sys" -HKR, , TypesSupported, 0x00010001, 7 - -[Strings] -CompanyName = "SoftEther Corporation" -DiskDescription = "VPN Client Device Driver Install Disk" -Neo.Service.Name = "Neo_VPN53" -Neo.Service.DispName = "VPN Client Device Driver - VPN53" -Neo.Service.Desc = "VPN Client Adapter - VPN53" -NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN53" -Neo.EventLog.Name = "Neo" -NetworkAddress = "MAC Address" -DefaultAddress = "000001000001" -MaxSpeed = "Indicate Speed (Mbps)" -KeepLink = "Keep Link" -On = "On" -Off = "Off" - - -; Auto Generated 20180205_163608.795 - +; VPN Client Device Driver for Windows 2000 and Greater +; +; Copyright (c) SoftEther Corporation. All Rights Reserved. +; http://www.softether.co.jp/ +; +; BUILD 9658 + +[Version] +Signature = "$Windows NT$" +Class = Net +ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} +Provider = %CompanyName% +DriverVer = 02/04/2018, 4.25.0.9658 +CatalogFile.NT = inf_VPN53.cat + +[Manufacturer] +%CompanyName% = SoftEther + +[SourceDisksNames] +1=%DiskDescription%, "", , + +[SourceDisksFiles] +Neo_VPN53.sys = 1 + +[DestinationDirs] +DefaultDestDir = 12 +Neo.CopyFiles.Sys = 12 + +[Neo.CopyFiles.Sys] +Neo_VPN53.sys, , , 2 + +[SoftEther] +%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN53 + +[NeoAdapter.Install] +Characteristics = 0x1 +AddReg = Neo.Reg, NeoAdapter.Ndi +CopyFiles = Neo.CopyFiles.Sys +*IfType = 53 +*MediaType = 0 +*PhysicalMediaType = 0 + +[NeoAdapter.Install.Services] +AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% + +[NeoAdapter.Ndi] +HKR, , NetworkAddress, 0, %DefaultAddress% +HKR, Ndi, DeviceID, , "NeoAdapter_VPN53" +HKR, , DevLoader, , ndis +HKR, , DeviceVxDs, , Neo_VPN53.sys +HKR, NDIS, LogDriverName, , "Neo_VPN53" +HKR, NDIS, MajorNdisVersion, 1, 5 +HKR, NDIS, MinorNdisVersion, 1, 0 +HKR, Ndi\Interfaces, DefUpper, , "ndis5" +HKR, Ndi\Interfaces, UpperRange, , "ndis5" +HKR, Ndi\Interfaces, LowerRange, , "ethernet" +HKR, Ndi\Interfaces, DefLower, , "ethernet" +HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" +HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% +HKR, Ndi\Params\NetworkAddress, type, 0, "edit" +HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" +HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" +HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% +HKR, Ndi\Params\NetworkAddress, optional, 0, "0" +HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% +HKR, Ndi\Params\MaxSpeed, type, 0, "int" +HKR, Ndi\Params\MaxSpeed, default, 0, "100" +HKR, Ndi\Params\MaxSpeed, min, 0, "0" +HKR, Ndi\Params\MaxSpeed, max, 0, "2000" +HKR, Ndi\Params\MaxSpeed, step, 0, "1" +HKR, Ndi\Params\MaxSpeed, Base, 0, "10" +HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% +HKR, Ndi\Params\KeepLink, type, 0, "enum" +HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% +HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% +HKR, Ndi\Params\KeepLink, default, 0, "0" + + +[Neo.Service] +DisplayName = %Neo.Service.DispName% +Description = %Neo.Service.Desc% +ServiceType = 1 +StartType = 3 +ErrorControl = 1 +ServiceBinary = %12%\Neo_VPN53.sys +LoadOrderGroup = NDIS + +[Neo.Reg] +HKR, Ndi, Service, 0, Neo.Service.Name +HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" +HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" + +[Neo.EventLog] +HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN53.sys" +HKR, , TypesSupported, 0x00010001, 7 + +[Strings] +CompanyName = "SoftEther Corporation" +DiskDescription = "VPN Client Device Driver Install Disk" +Neo.Service.Name = "Neo_VPN53" +Neo.Service.DispName = "VPN Client Device Driver - VPN53" +Neo.Service.Desc = "VPN Client Adapter - VPN53" +NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN53" +Neo.EventLog.Name = "Neo" +NetworkAddress = "MAC Address" +DefaultAddress = "000001000001" +MaxSpeed = "Indicate Speed (Mbps)" +KeepLink = "Keep Link" +On = "On" +Off = "Off" + + +; Auto Generated 20180205_163608.795 + diff --git a/src/bin/hamcore/DriverPackages/Neo6_Win8/x86/Neo6_x86_VPN54.inf b/src/bin/hamcore/DriverPackages/Neo6_Win8/x86/Neo6_x86_VPN54.inf index 18a66a6c..f995e21d 100644 --- a/src/bin/hamcore/DriverPackages/Neo6_Win8/x86/Neo6_x86_VPN54.inf +++ b/src/bin/hamcore/DriverPackages/Neo6_Win8/x86/Neo6_x86_VPN54.inf @@ -1,114 +1,114 @@ -; VPN Client Device Driver for Windows 2000 and Greater -; -; Copyright (c) SoftEther Corporation. All Rights Reserved. -; http://www.softether.co.jp/ -; -; BUILD 9658 - -[Version] -Signature = "$Windows NT$" -Class = Net -ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} -Provider = %CompanyName% -DriverVer = 02/04/2018, 4.25.0.9658 -CatalogFile.NT = inf_VPN54.cat - -[Manufacturer] -%CompanyName% = SoftEther - -[SourceDisksNames] -1=%DiskDescription%, "", , - -[SourceDisksFiles] -Neo_VPN54.sys = 1 - -[DestinationDirs] -DefaultDestDir = 12 -Neo.CopyFiles.Sys = 12 - -[Neo.CopyFiles.Sys] -Neo_VPN54.sys, , , 2 - -[SoftEther] -%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN54 - -[NeoAdapter.Install] -Characteristics = 0x1 -AddReg = Neo.Reg, NeoAdapter.Ndi -CopyFiles = Neo.CopyFiles.Sys -*IfType = 53 -*MediaType = 0 -*PhysicalMediaType = 0 - -[NeoAdapter.Install.Services] -AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% - -[NeoAdapter.Ndi] -HKR, , NetworkAddress, 0, %DefaultAddress% -HKR, Ndi, DeviceID, , "NeoAdapter_VPN54" -HKR, , DevLoader, , ndis -HKR, , DeviceVxDs, , Neo_VPN54.sys -HKR, NDIS, LogDriverName, , "Neo_VPN54" -HKR, NDIS, MajorNdisVersion, 1, 5 -HKR, NDIS, MinorNdisVersion, 1, 0 -HKR, Ndi\Interfaces, DefUpper, , "ndis5" -HKR, Ndi\Interfaces, UpperRange, , "ndis5" -HKR, Ndi\Interfaces, LowerRange, , "ethernet" -HKR, Ndi\Interfaces, DefLower, , "ethernet" -HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" -HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% -HKR, Ndi\Params\NetworkAddress, type, 0, "edit" -HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" -HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" -HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% -HKR, Ndi\Params\NetworkAddress, optional, 0, "0" -HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% -HKR, Ndi\Params\MaxSpeed, type, 0, "int" -HKR, Ndi\Params\MaxSpeed, default, 0, "100" -HKR, Ndi\Params\MaxSpeed, min, 0, "0" -HKR, Ndi\Params\MaxSpeed, max, 0, "2000" -HKR, Ndi\Params\MaxSpeed, step, 0, "1" -HKR, Ndi\Params\MaxSpeed, Base, 0, "10" -HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% -HKR, Ndi\Params\KeepLink, type, 0, "enum" -HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% -HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% -HKR, Ndi\Params\KeepLink, default, 0, "0" - - -[Neo.Service] -DisplayName = %Neo.Service.DispName% -Description = %Neo.Service.Desc% -ServiceType = 1 -StartType = 3 -ErrorControl = 1 -ServiceBinary = %12%\Neo_VPN54.sys -LoadOrderGroup = NDIS - -[Neo.Reg] -HKR, Ndi, Service, 0, Neo.Service.Name -HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" -HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" - -[Neo.EventLog] -HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN54.sys" -HKR, , TypesSupported, 0x00010001, 7 - -[Strings] -CompanyName = "SoftEther Corporation" -DiskDescription = "VPN Client Device Driver Install Disk" -Neo.Service.Name = "Neo_VPN54" -Neo.Service.DispName = "VPN Client Device Driver - VPN54" -Neo.Service.Desc = "VPN Client Adapter - VPN54" -NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN54" -Neo.EventLog.Name = "Neo" -NetworkAddress = "MAC Address" -DefaultAddress = "000001000001" -MaxSpeed = "Indicate Speed (Mbps)" -KeepLink = "Keep Link" -On = "On" -Off = "Off" - - -; Auto Generated 20180205_163608.796 - +; VPN Client Device Driver for Windows 2000 and Greater +; +; Copyright (c) SoftEther Corporation. All Rights Reserved. +; http://www.softether.co.jp/ +; +; BUILD 9658 + +[Version] +Signature = "$Windows NT$" +Class = Net +ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} +Provider = %CompanyName% +DriverVer = 02/04/2018, 4.25.0.9658 +CatalogFile.NT = inf_VPN54.cat + +[Manufacturer] +%CompanyName% = SoftEther + +[SourceDisksNames] +1=%DiskDescription%, "", , + +[SourceDisksFiles] +Neo_VPN54.sys = 1 + +[DestinationDirs] +DefaultDestDir = 12 +Neo.CopyFiles.Sys = 12 + +[Neo.CopyFiles.Sys] +Neo_VPN54.sys, , , 2 + +[SoftEther] +%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN54 + +[NeoAdapter.Install] +Characteristics = 0x1 +AddReg = Neo.Reg, NeoAdapter.Ndi +CopyFiles = Neo.CopyFiles.Sys +*IfType = 53 +*MediaType = 0 +*PhysicalMediaType = 0 + +[NeoAdapter.Install.Services] +AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% + +[NeoAdapter.Ndi] +HKR, , NetworkAddress, 0, %DefaultAddress% +HKR, Ndi, DeviceID, , "NeoAdapter_VPN54" +HKR, , DevLoader, , ndis +HKR, , DeviceVxDs, , Neo_VPN54.sys +HKR, NDIS, LogDriverName, , "Neo_VPN54" +HKR, NDIS, MajorNdisVersion, 1, 5 +HKR, NDIS, MinorNdisVersion, 1, 0 +HKR, Ndi\Interfaces, DefUpper, , "ndis5" +HKR, Ndi\Interfaces, UpperRange, , "ndis5" +HKR, Ndi\Interfaces, LowerRange, , "ethernet" +HKR, Ndi\Interfaces, DefLower, , "ethernet" +HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" +HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% +HKR, Ndi\Params\NetworkAddress, type, 0, "edit" +HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" +HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" +HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% +HKR, Ndi\Params\NetworkAddress, optional, 0, "0" +HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% +HKR, Ndi\Params\MaxSpeed, type, 0, "int" +HKR, Ndi\Params\MaxSpeed, default, 0, "100" +HKR, Ndi\Params\MaxSpeed, min, 0, "0" +HKR, Ndi\Params\MaxSpeed, max, 0, "2000" +HKR, Ndi\Params\MaxSpeed, step, 0, "1" +HKR, Ndi\Params\MaxSpeed, Base, 0, "10" +HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% +HKR, Ndi\Params\KeepLink, type, 0, "enum" +HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% +HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% +HKR, Ndi\Params\KeepLink, default, 0, "0" + + +[Neo.Service] +DisplayName = %Neo.Service.DispName% +Description = %Neo.Service.Desc% +ServiceType = 1 +StartType = 3 +ErrorControl = 1 +ServiceBinary = %12%\Neo_VPN54.sys +LoadOrderGroup = NDIS + +[Neo.Reg] +HKR, Ndi, Service, 0, Neo.Service.Name +HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" +HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" + +[Neo.EventLog] +HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN54.sys" +HKR, , TypesSupported, 0x00010001, 7 + +[Strings] +CompanyName = "SoftEther Corporation" +DiskDescription = "VPN Client Device Driver Install Disk" +Neo.Service.Name = "Neo_VPN54" +Neo.Service.DispName = "VPN Client Device Driver - VPN54" +Neo.Service.Desc = "VPN Client Adapter - VPN54" +NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN54" +Neo.EventLog.Name = "Neo" +NetworkAddress = "MAC Address" +DefaultAddress = "000001000001" +MaxSpeed = "Indicate Speed (Mbps)" +KeepLink = "Keep Link" +On = "On" +Off = "Off" + + +; Auto Generated 20180205_163608.796 + diff --git a/src/bin/hamcore/DriverPackages/Neo6_Win8/x86/Neo6_x86_VPN55.inf b/src/bin/hamcore/DriverPackages/Neo6_Win8/x86/Neo6_x86_VPN55.inf index 522a0a4b..8f1d1030 100644 --- a/src/bin/hamcore/DriverPackages/Neo6_Win8/x86/Neo6_x86_VPN55.inf +++ b/src/bin/hamcore/DriverPackages/Neo6_Win8/x86/Neo6_x86_VPN55.inf @@ -1,114 +1,114 @@ -; VPN Client Device Driver for Windows 2000 and Greater -; -; Copyright (c) SoftEther Corporation. All Rights Reserved. -; http://www.softether.co.jp/ -; -; BUILD 9658 - -[Version] -Signature = "$Windows NT$" -Class = Net -ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} -Provider = %CompanyName% -DriverVer = 02/04/2018, 4.25.0.9658 -CatalogFile.NT = inf_VPN55.cat - -[Manufacturer] -%CompanyName% = SoftEther - -[SourceDisksNames] -1=%DiskDescription%, "", , - -[SourceDisksFiles] -Neo_VPN55.sys = 1 - -[DestinationDirs] -DefaultDestDir = 12 -Neo.CopyFiles.Sys = 12 - -[Neo.CopyFiles.Sys] -Neo_VPN55.sys, , , 2 - -[SoftEther] -%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN55 - -[NeoAdapter.Install] -Characteristics = 0x1 -AddReg = Neo.Reg, NeoAdapter.Ndi -CopyFiles = Neo.CopyFiles.Sys -*IfType = 53 -*MediaType = 0 -*PhysicalMediaType = 0 - -[NeoAdapter.Install.Services] -AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% - -[NeoAdapter.Ndi] -HKR, , NetworkAddress, 0, %DefaultAddress% -HKR, Ndi, DeviceID, , "NeoAdapter_VPN55" -HKR, , DevLoader, , ndis -HKR, , DeviceVxDs, , Neo_VPN55.sys -HKR, NDIS, LogDriverName, , "Neo_VPN55" -HKR, NDIS, MajorNdisVersion, 1, 5 -HKR, NDIS, MinorNdisVersion, 1, 0 -HKR, Ndi\Interfaces, DefUpper, , "ndis5" -HKR, Ndi\Interfaces, UpperRange, , "ndis5" -HKR, Ndi\Interfaces, LowerRange, , "ethernet" -HKR, Ndi\Interfaces, DefLower, , "ethernet" -HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" -HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% -HKR, Ndi\Params\NetworkAddress, type, 0, "edit" -HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" -HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" -HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% -HKR, Ndi\Params\NetworkAddress, optional, 0, "0" -HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% -HKR, Ndi\Params\MaxSpeed, type, 0, "int" -HKR, Ndi\Params\MaxSpeed, default, 0, "100" -HKR, Ndi\Params\MaxSpeed, min, 0, "0" -HKR, Ndi\Params\MaxSpeed, max, 0, "2000" -HKR, Ndi\Params\MaxSpeed, step, 0, "1" -HKR, Ndi\Params\MaxSpeed, Base, 0, "10" -HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% -HKR, Ndi\Params\KeepLink, type, 0, "enum" -HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% -HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% -HKR, Ndi\Params\KeepLink, default, 0, "0" - - -[Neo.Service] -DisplayName = %Neo.Service.DispName% -Description = %Neo.Service.Desc% -ServiceType = 1 -StartType = 3 -ErrorControl = 1 -ServiceBinary = %12%\Neo_VPN55.sys -LoadOrderGroup = NDIS - -[Neo.Reg] -HKR, Ndi, Service, 0, Neo.Service.Name -HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" -HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" - -[Neo.EventLog] -HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN55.sys" -HKR, , TypesSupported, 0x00010001, 7 - -[Strings] -CompanyName = "SoftEther Corporation" -DiskDescription = "VPN Client Device Driver Install Disk" -Neo.Service.Name = "Neo_VPN55" -Neo.Service.DispName = "VPN Client Device Driver - VPN55" -Neo.Service.Desc = "VPN Client Adapter - VPN55" -NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN55" -Neo.EventLog.Name = "Neo" -NetworkAddress = "MAC Address" -DefaultAddress = "000001000001" -MaxSpeed = "Indicate Speed (Mbps)" -KeepLink = "Keep Link" -On = "On" -Off = "Off" - - -; Auto Generated 20180205_163608.796 - +; VPN Client Device Driver for Windows 2000 and Greater +; +; Copyright (c) SoftEther Corporation. All Rights Reserved. +; http://www.softether.co.jp/ +; +; BUILD 9658 + +[Version] +Signature = "$Windows NT$" +Class = Net +ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} +Provider = %CompanyName% +DriverVer = 02/04/2018, 4.25.0.9658 +CatalogFile.NT = inf_VPN55.cat + +[Manufacturer] +%CompanyName% = SoftEther + +[SourceDisksNames] +1=%DiskDescription%, "", , + +[SourceDisksFiles] +Neo_VPN55.sys = 1 + +[DestinationDirs] +DefaultDestDir = 12 +Neo.CopyFiles.Sys = 12 + +[Neo.CopyFiles.Sys] +Neo_VPN55.sys, , , 2 + +[SoftEther] +%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN55 + +[NeoAdapter.Install] +Characteristics = 0x1 +AddReg = Neo.Reg, NeoAdapter.Ndi +CopyFiles = Neo.CopyFiles.Sys +*IfType = 53 +*MediaType = 0 +*PhysicalMediaType = 0 + +[NeoAdapter.Install.Services] +AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% + +[NeoAdapter.Ndi] +HKR, , NetworkAddress, 0, %DefaultAddress% +HKR, Ndi, DeviceID, , "NeoAdapter_VPN55" +HKR, , DevLoader, , ndis +HKR, , DeviceVxDs, , Neo_VPN55.sys +HKR, NDIS, LogDriverName, , "Neo_VPN55" +HKR, NDIS, MajorNdisVersion, 1, 5 +HKR, NDIS, MinorNdisVersion, 1, 0 +HKR, Ndi\Interfaces, DefUpper, , "ndis5" +HKR, Ndi\Interfaces, UpperRange, , "ndis5" +HKR, Ndi\Interfaces, LowerRange, , "ethernet" +HKR, Ndi\Interfaces, DefLower, , "ethernet" +HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" +HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% +HKR, Ndi\Params\NetworkAddress, type, 0, "edit" +HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" +HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" +HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% +HKR, Ndi\Params\NetworkAddress, optional, 0, "0" +HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% +HKR, Ndi\Params\MaxSpeed, type, 0, "int" +HKR, Ndi\Params\MaxSpeed, default, 0, "100" +HKR, Ndi\Params\MaxSpeed, min, 0, "0" +HKR, Ndi\Params\MaxSpeed, max, 0, "2000" +HKR, Ndi\Params\MaxSpeed, step, 0, "1" +HKR, Ndi\Params\MaxSpeed, Base, 0, "10" +HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% +HKR, Ndi\Params\KeepLink, type, 0, "enum" +HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% +HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% +HKR, Ndi\Params\KeepLink, default, 0, "0" + + +[Neo.Service] +DisplayName = %Neo.Service.DispName% +Description = %Neo.Service.Desc% +ServiceType = 1 +StartType = 3 +ErrorControl = 1 +ServiceBinary = %12%\Neo_VPN55.sys +LoadOrderGroup = NDIS + +[Neo.Reg] +HKR, Ndi, Service, 0, Neo.Service.Name +HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" +HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" + +[Neo.EventLog] +HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN55.sys" +HKR, , TypesSupported, 0x00010001, 7 + +[Strings] +CompanyName = "SoftEther Corporation" +DiskDescription = "VPN Client Device Driver Install Disk" +Neo.Service.Name = "Neo_VPN55" +Neo.Service.DispName = "VPN Client Device Driver - VPN55" +Neo.Service.Desc = "VPN Client Adapter - VPN55" +NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN55" +Neo.EventLog.Name = "Neo" +NetworkAddress = "MAC Address" +DefaultAddress = "000001000001" +MaxSpeed = "Indicate Speed (Mbps)" +KeepLink = "Keep Link" +On = "On" +Off = "Off" + + +; Auto Generated 20180205_163608.796 + diff --git a/src/bin/hamcore/DriverPackages/Neo6_Win8/x86/Neo6_x86_VPN56.inf b/src/bin/hamcore/DriverPackages/Neo6_Win8/x86/Neo6_x86_VPN56.inf index 43b2f81c..3690796b 100644 --- a/src/bin/hamcore/DriverPackages/Neo6_Win8/x86/Neo6_x86_VPN56.inf +++ b/src/bin/hamcore/DriverPackages/Neo6_Win8/x86/Neo6_x86_VPN56.inf @@ -1,114 +1,114 @@ -; VPN Client Device Driver for Windows 2000 and Greater -; -; Copyright (c) SoftEther Corporation. All Rights Reserved. -; http://www.softether.co.jp/ -; -; BUILD 9658 - -[Version] -Signature = "$Windows NT$" -Class = Net -ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} -Provider = %CompanyName% -DriverVer = 02/04/2018, 4.25.0.9658 -CatalogFile.NT = inf_VPN56.cat - -[Manufacturer] -%CompanyName% = SoftEther - -[SourceDisksNames] -1=%DiskDescription%, "", , - -[SourceDisksFiles] -Neo_VPN56.sys = 1 - -[DestinationDirs] -DefaultDestDir = 12 -Neo.CopyFiles.Sys = 12 - -[Neo.CopyFiles.Sys] -Neo_VPN56.sys, , , 2 - -[SoftEther] -%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN56 - -[NeoAdapter.Install] -Characteristics = 0x1 -AddReg = Neo.Reg, NeoAdapter.Ndi -CopyFiles = Neo.CopyFiles.Sys -*IfType = 53 -*MediaType = 0 -*PhysicalMediaType = 0 - -[NeoAdapter.Install.Services] -AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% - -[NeoAdapter.Ndi] -HKR, , NetworkAddress, 0, %DefaultAddress% -HKR, Ndi, DeviceID, , "NeoAdapter_VPN56" -HKR, , DevLoader, , ndis -HKR, , DeviceVxDs, , Neo_VPN56.sys -HKR, NDIS, LogDriverName, , "Neo_VPN56" -HKR, NDIS, MajorNdisVersion, 1, 5 -HKR, NDIS, MinorNdisVersion, 1, 0 -HKR, Ndi\Interfaces, DefUpper, , "ndis5" -HKR, Ndi\Interfaces, UpperRange, , "ndis5" -HKR, Ndi\Interfaces, LowerRange, , "ethernet" -HKR, Ndi\Interfaces, DefLower, , "ethernet" -HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" -HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% -HKR, Ndi\Params\NetworkAddress, type, 0, "edit" -HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" -HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" -HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% -HKR, Ndi\Params\NetworkAddress, optional, 0, "0" -HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% -HKR, Ndi\Params\MaxSpeed, type, 0, "int" -HKR, Ndi\Params\MaxSpeed, default, 0, "100" -HKR, Ndi\Params\MaxSpeed, min, 0, "0" -HKR, Ndi\Params\MaxSpeed, max, 0, "2000" -HKR, Ndi\Params\MaxSpeed, step, 0, "1" -HKR, Ndi\Params\MaxSpeed, Base, 0, "10" -HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% -HKR, Ndi\Params\KeepLink, type, 0, "enum" -HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% -HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% -HKR, Ndi\Params\KeepLink, default, 0, "0" - - -[Neo.Service] -DisplayName = %Neo.Service.DispName% -Description = %Neo.Service.Desc% -ServiceType = 1 -StartType = 3 -ErrorControl = 1 -ServiceBinary = %12%\Neo_VPN56.sys -LoadOrderGroup = NDIS - -[Neo.Reg] -HKR, Ndi, Service, 0, Neo.Service.Name -HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" -HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" - -[Neo.EventLog] -HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN56.sys" -HKR, , TypesSupported, 0x00010001, 7 - -[Strings] -CompanyName = "SoftEther Corporation" -DiskDescription = "VPN Client Device Driver Install Disk" -Neo.Service.Name = "Neo_VPN56" -Neo.Service.DispName = "VPN Client Device Driver - VPN56" -Neo.Service.Desc = "VPN Client Adapter - VPN56" -NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN56" -Neo.EventLog.Name = "Neo" -NetworkAddress = "MAC Address" -DefaultAddress = "000001000001" -MaxSpeed = "Indicate Speed (Mbps)" -KeepLink = "Keep Link" -On = "On" -Off = "Off" - - -; Auto Generated 20180205_163608.797 - +; VPN Client Device Driver for Windows 2000 and Greater +; +; Copyright (c) SoftEther Corporation. All Rights Reserved. +; http://www.softether.co.jp/ +; +; BUILD 9658 + +[Version] +Signature = "$Windows NT$" +Class = Net +ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} +Provider = %CompanyName% +DriverVer = 02/04/2018, 4.25.0.9658 +CatalogFile.NT = inf_VPN56.cat + +[Manufacturer] +%CompanyName% = SoftEther + +[SourceDisksNames] +1=%DiskDescription%, "", , + +[SourceDisksFiles] +Neo_VPN56.sys = 1 + +[DestinationDirs] +DefaultDestDir = 12 +Neo.CopyFiles.Sys = 12 + +[Neo.CopyFiles.Sys] +Neo_VPN56.sys, , , 2 + +[SoftEther] +%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN56 + +[NeoAdapter.Install] +Characteristics = 0x1 +AddReg = Neo.Reg, NeoAdapter.Ndi +CopyFiles = Neo.CopyFiles.Sys +*IfType = 53 +*MediaType = 0 +*PhysicalMediaType = 0 + +[NeoAdapter.Install.Services] +AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% + +[NeoAdapter.Ndi] +HKR, , NetworkAddress, 0, %DefaultAddress% +HKR, Ndi, DeviceID, , "NeoAdapter_VPN56" +HKR, , DevLoader, , ndis +HKR, , DeviceVxDs, , Neo_VPN56.sys +HKR, NDIS, LogDriverName, , "Neo_VPN56" +HKR, NDIS, MajorNdisVersion, 1, 5 +HKR, NDIS, MinorNdisVersion, 1, 0 +HKR, Ndi\Interfaces, DefUpper, , "ndis5" +HKR, Ndi\Interfaces, UpperRange, , "ndis5" +HKR, Ndi\Interfaces, LowerRange, , "ethernet" +HKR, Ndi\Interfaces, DefLower, , "ethernet" +HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" +HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% +HKR, Ndi\Params\NetworkAddress, type, 0, "edit" +HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" +HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" +HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% +HKR, Ndi\Params\NetworkAddress, optional, 0, "0" +HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% +HKR, Ndi\Params\MaxSpeed, type, 0, "int" +HKR, Ndi\Params\MaxSpeed, default, 0, "100" +HKR, Ndi\Params\MaxSpeed, min, 0, "0" +HKR, Ndi\Params\MaxSpeed, max, 0, "2000" +HKR, Ndi\Params\MaxSpeed, step, 0, "1" +HKR, Ndi\Params\MaxSpeed, Base, 0, "10" +HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% +HKR, Ndi\Params\KeepLink, type, 0, "enum" +HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% +HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% +HKR, Ndi\Params\KeepLink, default, 0, "0" + + +[Neo.Service] +DisplayName = %Neo.Service.DispName% +Description = %Neo.Service.Desc% +ServiceType = 1 +StartType = 3 +ErrorControl = 1 +ServiceBinary = %12%\Neo_VPN56.sys +LoadOrderGroup = NDIS + +[Neo.Reg] +HKR, Ndi, Service, 0, Neo.Service.Name +HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" +HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" + +[Neo.EventLog] +HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN56.sys" +HKR, , TypesSupported, 0x00010001, 7 + +[Strings] +CompanyName = "SoftEther Corporation" +DiskDescription = "VPN Client Device Driver Install Disk" +Neo.Service.Name = "Neo_VPN56" +Neo.Service.DispName = "VPN Client Device Driver - VPN56" +Neo.Service.Desc = "VPN Client Adapter - VPN56" +NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN56" +Neo.EventLog.Name = "Neo" +NetworkAddress = "MAC Address" +DefaultAddress = "000001000001" +MaxSpeed = "Indicate Speed (Mbps)" +KeepLink = "Keep Link" +On = "On" +Off = "Off" + + +; Auto Generated 20180205_163608.797 + diff --git a/src/bin/hamcore/DriverPackages/Neo6_Win8/x86/Neo6_x86_VPN57.inf b/src/bin/hamcore/DriverPackages/Neo6_Win8/x86/Neo6_x86_VPN57.inf index e02d5d09..ed78599b 100644 --- a/src/bin/hamcore/DriverPackages/Neo6_Win8/x86/Neo6_x86_VPN57.inf +++ b/src/bin/hamcore/DriverPackages/Neo6_Win8/x86/Neo6_x86_VPN57.inf @@ -1,114 +1,114 @@ -; VPN Client Device Driver for Windows 2000 and Greater -; -; Copyright (c) SoftEther Corporation. All Rights Reserved. -; http://www.softether.co.jp/ -; -; BUILD 9658 - -[Version] -Signature = "$Windows NT$" -Class = Net -ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} -Provider = %CompanyName% -DriverVer = 02/04/2018, 4.25.0.9658 -CatalogFile.NT = inf_VPN57.cat - -[Manufacturer] -%CompanyName% = SoftEther - -[SourceDisksNames] -1=%DiskDescription%, "", , - -[SourceDisksFiles] -Neo_VPN57.sys = 1 - -[DestinationDirs] -DefaultDestDir = 12 -Neo.CopyFiles.Sys = 12 - -[Neo.CopyFiles.Sys] -Neo_VPN57.sys, , , 2 - -[SoftEther] -%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN57 - -[NeoAdapter.Install] -Characteristics = 0x1 -AddReg = Neo.Reg, NeoAdapter.Ndi -CopyFiles = Neo.CopyFiles.Sys -*IfType = 53 -*MediaType = 0 -*PhysicalMediaType = 0 - -[NeoAdapter.Install.Services] -AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% - -[NeoAdapter.Ndi] -HKR, , NetworkAddress, 0, %DefaultAddress% -HKR, Ndi, DeviceID, , "NeoAdapter_VPN57" -HKR, , DevLoader, , ndis -HKR, , DeviceVxDs, , Neo_VPN57.sys -HKR, NDIS, LogDriverName, , "Neo_VPN57" -HKR, NDIS, MajorNdisVersion, 1, 5 -HKR, NDIS, MinorNdisVersion, 1, 0 -HKR, Ndi\Interfaces, DefUpper, , "ndis5" -HKR, Ndi\Interfaces, UpperRange, , "ndis5" -HKR, Ndi\Interfaces, LowerRange, , "ethernet" -HKR, Ndi\Interfaces, DefLower, , "ethernet" -HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" -HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% -HKR, Ndi\Params\NetworkAddress, type, 0, "edit" -HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" -HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" -HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% -HKR, Ndi\Params\NetworkAddress, optional, 0, "0" -HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% -HKR, Ndi\Params\MaxSpeed, type, 0, "int" -HKR, Ndi\Params\MaxSpeed, default, 0, "100" -HKR, Ndi\Params\MaxSpeed, min, 0, "0" -HKR, Ndi\Params\MaxSpeed, max, 0, "2000" -HKR, Ndi\Params\MaxSpeed, step, 0, "1" -HKR, Ndi\Params\MaxSpeed, Base, 0, "10" -HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% -HKR, Ndi\Params\KeepLink, type, 0, "enum" -HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% -HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% -HKR, Ndi\Params\KeepLink, default, 0, "0" - - -[Neo.Service] -DisplayName = %Neo.Service.DispName% -Description = %Neo.Service.Desc% -ServiceType = 1 -StartType = 3 -ErrorControl = 1 -ServiceBinary = %12%\Neo_VPN57.sys -LoadOrderGroup = NDIS - -[Neo.Reg] -HKR, Ndi, Service, 0, Neo.Service.Name -HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" -HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" - -[Neo.EventLog] -HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN57.sys" -HKR, , TypesSupported, 0x00010001, 7 - -[Strings] -CompanyName = "SoftEther Corporation" -DiskDescription = "VPN Client Device Driver Install Disk" -Neo.Service.Name = "Neo_VPN57" -Neo.Service.DispName = "VPN Client Device Driver - VPN57" -Neo.Service.Desc = "VPN Client Adapter - VPN57" -NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN57" -Neo.EventLog.Name = "Neo" -NetworkAddress = "MAC Address" -DefaultAddress = "000001000001" -MaxSpeed = "Indicate Speed (Mbps)" -KeepLink = "Keep Link" -On = "On" -Off = "Off" - - -; Auto Generated 20180205_163608.798 - +; VPN Client Device Driver for Windows 2000 and Greater +; +; Copyright (c) SoftEther Corporation. All Rights Reserved. +; http://www.softether.co.jp/ +; +; BUILD 9658 + +[Version] +Signature = "$Windows NT$" +Class = Net +ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} +Provider = %CompanyName% +DriverVer = 02/04/2018, 4.25.0.9658 +CatalogFile.NT = inf_VPN57.cat + +[Manufacturer] +%CompanyName% = SoftEther + +[SourceDisksNames] +1=%DiskDescription%, "", , + +[SourceDisksFiles] +Neo_VPN57.sys = 1 + +[DestinationDirs] +DefaultDestDir = 12 +Neo.CopyFiles.Sys = 12 + +[Neo.CopyFiles.Sys] +Neo_VPN57.sys, , , 2 + +[SoftEther] +%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN57 + +[NeoAdapter.Install] +Characteristics = 0x1 +AddReg = Neo.Reg, NeoAdapter.Ndi +CopyFiles = Neo.CopyFiles.Sys +*IfType = 53 +*MediaType = 0 +*PhysicalMediaType = 0 + +[NeoAdapter.Install.Services] +AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% + +[NeoAdapter.Ndi] +HKR, , NetworkAddress, 0, %DefaultAddress% +HKR, Ndi, DeviceID, , "NeoAdapter_VPN57" +HKR, , DevLoader, , ndis +HKR, , DeviceVxDs, , Neo_VPN57.sys +HKR, NDIS, LogDriverName, , "Neo_VPN57" +HKR, NDIS, MajorNdisVersion, 1, 5 +HKR, NDIS, MinorNdisVersion, 1, 0 +HKR, Ndi\Interfaces, DefUpper, , "ndis5" +HKR, Ndi\Interfaces, UpperRange, , "ndis5" +HKR, Ndi\Interfaces, LowerRange, , "ethernet" +HKR, Ndi\Interfaces, DefLower, , "ethernet" +HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" +HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% +HKR, Ndi\Params\NetworkAddress, type, 0, "edit" +HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" +HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" +HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% +HKR, Ndi\Params\NetworkAddress, optional, 0, "0" +HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% +HKR, Ndi\Params\MaxSpeed, type, 0, "int" +HKR, Ndi\Params\MaxSpeed, default, 0, "100" +HKR, Ndi\Params\MaxSpeed, min, 0, "0" +HKR, Ndi\Params\MaxSpeed, max, 0, "2000" +HKR, Ndi\Params\MaxSpeed, step, 0, "1" +HKR, Ndi\Params\MaxSpeed, Base, 0, "10" +HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% +HKR, Ndi\Params\KeepLink, type, 0, "enum" +HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% +HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% +HKR, Ndi\Params\KeepLink, default, 0, "0" + + +[Neo.Service] +DisplayName = %Neo.Service.DispName% +Description = %Neo.Service.Desc% +ServiceType = 1 +StartType = 3 +ErrorControl = 1 +ServiceBinary = %12%\Neo_VPN57.sys +LoadOrderGroup = NDIS + +[Neo.Reg] +HKR, Ndi, Service, 0, Neo.Service.Name +HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" +HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" + +[Neo.EventLog] +HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN57.sys" +HKR, , TypesSupported, 0x00010001, 7 + +[Strings] +CompanyName = "SoftEther Corporation" +DiskDescription = "VPN Client Device Driver Install Disk" +Neo.Service.Name = "Neo_VPN57" +Neo.Service.DispName = "VPN Client Device Driver - VPN57" +Neo.Service.Desc = "VPN Client Adapter - VPN57" +NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN57" +Neo.EventLog.Name = "Neo" +NetworkAddress = "MAC Address" +DefaultAddress = "000001000001" +MaxSpeed = "Indicate Speed (Mbps)" +KeepLink = "Keep Link" +On = "On" +Off = "Off" + + +; Auto Generated 20180205_163608.798 + diff --git a/src/bin/hamcore/DriverPackages/Neo6_Win8/x86/Neo6_x86_VPN58.inf b/src/bin/hamcore/DriverPackages/Neo6_Win8/x86/Neo6_x86_VPN58.inf index 72fc40cb..2ca15863 100644 --- a/src/bin/hamcore/DriverPackages/Neo6_Win8/x86/Neo6_x86_VPN58.inf +++ b/src/bin/hamcore/DriverPackages/Neo6_Win8/x86/Neo6_x86_VPN58.inf @@ -1,114 +1,114 @@ -; VPN Client Device Driver for Windows 2000 and Greater -; -; Copyright (c) SoftEther Corporation. All Rights Reserved. -; http://www.softether.co.jp/ -; -; BUILD 9658 - -[Version] -Signature = "$Windows NT$" -Class = Net -ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} -Provider = %CompanyName% -DriverVer = 02/04/2018, 4.25.0.9658 -CatalogFile.NT = inf_VPN58.cat - -[Manufacturer] -%CompanyName% = SoftEther - -[SourceDisksNames] -1=%DiskDescription%, "", , - -[SourceDisksFiles] -Neo_VPN58.sys = 1 - -[DestinationDirs] -DefaultDestDir = 12 -Neo.CopyFiles.Sys = 12 - -[Neo.CopyFiles.Sys] -Neo_VPN58.sys, , , 2 - -[SoftEther] -%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN58 - -[NeoAdapter.Install] -Characteristics = 0x1 -AddReg = Neo.Reg, NeoAdapter.Ndi -CopyFiles = Neo.CopyFiles.Sys -*IfType = 53 -*MediaType = 0 -*PhysicalMediaType = 0 - -[NeoAdapter.Install.Services] -AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% - -[NeoAdapter.Ndi] -HKR, , NetworkAddress, 0, %DefaultAddress% -HKR, Ndi, DeviceID, , "NeoAdapter_VPN58" -HKR, , DevLoader, , ndis -HKR, , DeviceVxDs, , Neo_VPN58.sys -HKR, NDIS, LogDriverName, , "Neo_VPN58" -HKR, NDIS, MajorNdisVersion, 1, 5 -HKR, NDIS, MinorNdisVersion, 1, 0 -HKR, Ndi\Interfaces, DefUpper, , "ndis5" -HKR, Ndi\Interfaces, UpperRange, , "ndis5" -HKR, Ndi\Interfaces, LowerRange, , "ethernet" -HKR, Ndi\Interfaces, DefLower, , "ethernet" -HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" -HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% -HKR, Ndi\Params\NetworkAddress, type, 0, "edit" -HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" -HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" -HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% -HKR, Ndi\Params\NetworkAddress, optional, 0, "0" -HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% -HKR, Ndi\Params\MaxSpeed, type, 0, "int" -HKR, Ndi\Params\MaxSpeed, default, 0, "100" -HKR, Ndi\Params\MaxSpeed, min, 0, "0" -HKR, Ndi\Params\MaxSpeed, max, 0, "2000" -HKR, Ndi\Params\MaxSpeed, step, 0, "1" -HKR, Ndi\Params\MaxSpeed, Base, 0, "10" -HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% -HKR, Ndi\Params\KeepLink, type, 0, "enum" -HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% -HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% -HKR, Ndi\Params\KeepLink, default, 0, "0" - - -[Neo.Service] -DisplayName = %Neo.Service.DispName% -Description = %Neo.Service.Desc% -ServiceType = 1 -StartType = 3 -ErrorControl = 1 -ServiceBinary = %12%\Neo_VPN58.sys -LoadOrderGroup = NDIS - -[Neo.Reg] -HKR, Ndi, Service, 0, Neo.Service.Name -HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" -HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" - -[Neo.EventLog] -HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN58.sys" -HKR, , TypesSupported, 0x00010001, 7 - -[Strings] -CompanyName = "SoftEther Corporation" -DiskDescription = "VPN Client Device Driver Install Disk" -Neo.Service.Name = "Neo_VPN58" -Neo.Service.DispName = "VPN Client Device Driver - VPN58" -Neo.Service.Desc = "VPN Client Adapter - VPN58" -NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN58" -Neo.EventLog.Name = "Neo" -NetworkAddress = "MAC Address" -DefaultAddress = "000001000001" -MaxSpeed = "Indicate Speed (Mbps)" -KeepLink = "Keep Link" -On = "On" -Off = "Off" - - -; Auto Generated 20180205_163608.798 - +; VPN Client Device Driver for Windows 2000 and Greater +; +; Copyright (c) SoftEther Corporation. All Rights Reserved. +; http://www.softether.co.jp/ +; +; BUILD 9658 + +[Version] +Signature = "$Windows NT$" +Class = Net +ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} +Provider = %CompanyName% +DriverVer = 02/04/2018, 4.25.0.9658 +CatalogFile.NT = inf_VPN58.cat + +[Manufacturer] +%CompanyName% = SoftEther + +[SourceDisksNames] +1=%DiskDescription%, "", , + +[SourceDisksFiles] +Neo_VPN58.sys = 1 + +[DestinationDirs] +DefaultDestDir = 12 +Neo.CopyFiles.Sys = 12 + +[Neo.CopyFiles.Sys] +Neo_VPN58.sys, , , 2 + +[SoftEther] +%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN58 + +[NeoAdapter.Install] +Characteristics = 0x1 +AddReg = Neo.Reg, NeoAdapter.Ndi +CopyFiles = Neo.CopyFiles.Sys +*IfType = 53 +*MediaType = 0 +*PhysicalMediaType = 0 + +[NeoAdapter.Install.Services] +AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% + +[NeoAdapter.Ndi] +HKR, , NetworkAddress, 0, %DefaultAddress% +HKR, Ndi, DeviceID, , "NeoAdapter_VPN58" +HKR, , DevLoader, , ndis +HKR, , DeviceVxDs, , Neo_VPN58.sys +HKR, NDIS, LogDriverName, , "Neo_VPN58" +HKR, NDIS, MajorNdisVersion, 1, 5 +HKR, NDIS, MinorNdisVersion, 1, 0 +HKR, Ndi\Interfaces, DefUpper, , "ndis5" +HKR, Ndi\Interfaces, UpperRange, , "ndis5" +HKR, Ndi\Interfaces, LowerRange, , "ethernet" +HKR, Ndi\Interfaces, DefLower, , "ethernet" +HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" +HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% +HKR, Ndi\Params\NetworkAddress, type, 0, "edit" +HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" +HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" +HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% +HKR, Ndi\Params\NetworkAddress, optional, 0, "0" +HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% +HKR, Ndi\Params\MaxSpeed, type, 0, "int" +HKR, Ndi\Params\MaxSpeed, default, 0, "100" +HKR, Ndi\Params\MaxSpeed, min, 0, "0" +HKR, Ndi\Params\MaxSpeed, max, 0, "2000" +HKR, Ndi\Params\MaxSpeed, step, 0, "1" +HKR, Ndi\Params\MaxSpeed, Base, 0, "10" +HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% +HKR, Ndi\Params\KeepLink, type, 0, "enum" +HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% +HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% +HKR, Ndi\Params\KeepLink, default, 0, "0" + + +[Neo.Service] +DisplayName = %Neo.Service.DispName% +Description = %Neo.Service.Desc% +ServiceType = 1 +StartType = 3 +ErrorControl = 1 +ServiceBinary = %12%\Neo_VPN58.sys +LoadOrderGroup = NDIS + +[Neo.Reg] +HKR, Ndi, Service, 0, Neo.Service.Name +HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" +HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" + +[Neo.EventLog] +HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN58.sys" +HKR, , TypesSupported, 0x00010001, 7 + +[Strings] +CompanyName = "SoftEther Corporation" +DiskDescription = "VPN Client Device Driver Install Disk" +Neo.Service.Name = "Neo_VPN58" +Neo.Service.DispName = "VPN Client Device Driver - VPN58" +Neo.Service.Desc = "VPN Client Adapter - VPN58" +NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN58" +Neo.EventLog.Name = "Neo" +NetworkAddress = "MAC Address" +DefaultAddress = "000001000001" +MaxSpeed = "Indicate Speed (Mbps)" +KeepLink = "Keep Link" +On = "On" +Off = "Off" + + +; Auto Generated 20180205_163608.798 + diff --git a/src/bin/hamcore/DriverPackages/Neo6_Win8/x86/Neo6_x86_VPN59.inf b/src/bin/hamcore/DriverPackages/Neo6_Win8/x86/Neo6_x86_VPN59.inf index 58b50d3f..d43fb47f 100644 --- a/src/bin/hamcore/DriverPackages/Neo6_Win8/x86/Neo6_x86_VPN59.inf +++ b/src/bin/hamcore/DriverPackages/Neo6_Win8/x86/Neo6_x86_VPN59.inf @@ -1,114 +1,114 @@ -; VPN Client Device Driver for Windows 2000 and Greater -; -; Copyright (c) SoftEther Corporation. All Rights Reserved. -; http://www.softether.co.jp/ -; -; BUILD 9658 - -[Version] -Signature = "$Windows NT$" -Class = Net -ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} -Provider = %CompanyName% -DriverVer = 02/04/2018, 4.25.0.9658 -CatalogFile.NT = inf_VPN59.cat - -[Manufacturer] -%CompanyName% = SoftEther - -[SourceDisksNames] -1=%DiskDescription%, "", , - -[SourceDisksFiles] -Neo_VPN59.sys = 1 - -[DestinationDirs] -DefaultDestDir = 12 -Neo.CopyFiles.Sys = 12 - -[Neo.CopyFiles.Sys] -Neo_VPN59.sys, , , 2 - -[SoftEther] -%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN59 - -[NeoAdapter.Install] -Characteristics = 0x1 -AddReg = Neo.Reg, NeoAdapter.Ndi -CopyFiles = Neo.CopyFiles.Sys -*IfType = 53 -*MediaType = 0 -*PhysicalMediaType = 0 - -[NeoAdapter.Install.Services] -AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% - -[NeoAdapter.Ndi] -HKR, , NetworkAddress, 0, %DefaultAddress% -HKR, Ndi, DeviceID, , "NeoAdapter_VPN59" -HKR, , DevLoader, , ndis -HKR, , DeviceVxDs, , Neo_VPN59.sys -HKR, NDIS, LogDriverName, , "Neo_VPN59" -HKR, NDIS, MajorNdisVersion, 1, 5 -HKR, NDIS, MinorNdisVersion, 1, 0 -HKR, Ndi\Interfaces, DefUpper, , "ndis5" -HKR, Ndi\Interfaces, UpperRange, , "ndis5" -HKR, Ndi\Interfaces, LowerRange, , "ethernet" -HKR, Ndi\Interfaces, DefLower, , "ethernet" -HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" -HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% -HKR, Ndi\Params\NetworkAddress, type, 0, "edit" -HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" -HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" -HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% -HKR, Ndi\Params\NetworkAddress, optional, 0, "0" -HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% -HKR, Ndi\Params\MaxSpeed, type, 0, "int" -HKR, Ndi\Params\MaxSpeed, default, 0, "100" -HKR, Ndi\Params\MaxSpeed, min, 0, "0" -HKR, Ndi\Params\MaxSpeed, max, 0, "2000" -HKR, Ndi\Params\MaxSpeed, step, 0, "1" -HKR, Ndi\Params\MaxSpeed, Base, 0, "10" -HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% -HKR, Ndi\Params\KeepLink, type, 0, "enum" -HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% -HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% -HKR, Ndi\Params\KeepLink, default, 0, "0" - - -[Neo.Service] -DisplayName = %Neo.Service.DispName% -Description = %Neo.Service.Desc% -ServiceType = 1 -StartType = 3 -ErrorControl = 1 -ServiceBinary = %12%\Neo_VPN59.sys -LoadOrderGroup = NDIS - -[Neo.Reg] -HKR, Ndi, Service, 0, Neo.Service.Name -HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" -HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" - -[Neo.EventLog] -HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN59.sys" -HKR, , TypesSupported, 0x00010001, 7 - -[Strings] -CompanyName = "SoftEther Corporation" -DiskDescription = "VPN Client Device Driver Install Disk" -Neo.Service.Name = "Neo_VPN59" -Neo.Service.DispName = "VPN Client Device Driver - VPN59" -Neo.Service.Desc = "VPN Client Adapter - VPN59" -NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN59" -Neo.EventLog.Name = "Neo" -NetworkAddress = "MAC Address" -DefaultAddress = "000001000001" -MaxSpeed = "Indicate Speed (Mbps)" -KeepLink = "Keep Link" -On = "On" -Off = "Off" - - -; Auto Generated 20180205_163608.799 - +; VPN Client Device Driver for Windows 2000 and Greater +; +; Copyright (c) SoftEther Corporation. All Rights Reserved. +; http://www.softether.co.jp/ +; +; BUILD 9658 + +[Version] +Signature = "$Windows NT$" +Class = Net +ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} +Provider = %CompanyName% +DriverVer = 02/04/2018, 4.25.0.9658 +CatalogFile.NT = inf_VPN59.cat + +[Manufacturer] +%CompanyName% = SoftEther + +[SourceDisksNames] +1=%DiskDescription%, "", , + +[SourceDisksFiles] +Neo_VPN59.sys = 1 + +[DestinationDirs] +DefaultDestDir = 12 +Neo.CopyFiles.Sys = 12 + +[Neo.CopyFiles.Sys] +Neo_VPN59.sys, , , 2 + +[SoftEther] +%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN59 + +[NeoAdapter.Install] +Characteristics = 0x1 +AddReg = Neo.Reg, NeoAdapter.Ndi +CopyFiles = Neo.CopyFiles.Sys +*IfType = 53 +*MediaType = 0 +*PhysicalMediaType = 0 + +[NeoAdapter.Install.Services] +AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% + +[NeoAdapter.Ndi] +HKR, , NetworkAddress, 0, %DefaultAddress% +HKR, Ndi, DeviceID, , "NeoAdapter_VPN59" +HKR, , DevLoader, , ndis +HKR, , DeviceVxDs, , Neo_VPN59.sys +HKR, NDIS, LogDriverName, , "Neo_VPN59" +HKR, NDIS, MajorNdisVersion, 1, 5 +HKR, NDIS, MinorNdisVersion, 1, 0 +HKR, Ndi\Interfaces, DefUpper, , "ndis5" +HKR, Ndi\Interfaces, UpperRange, , "ndis5" +HKR, Ndi\Interfaces, LowerRange, , "ethernet" +HKR, Ndi\Interfaces, DefLower, , "ethernet" +HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" +HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% +HKR, Ndi\Params\NetworkAddress, type, 0, "edit" +HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" +HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" +HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% +HKR, Ndi\Params\NetworkAddress, optional, 0, "0" +HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% +HKR, Ndi\Params\MaxSpeed, type, 0, "int" +HKR, Ndi\Params\MaxSpeed, default, 0, "100" +HKR, Ndi\Params\MaxSpeed, min, 0, "0" +HKR, Ndi\Params\MaxSpeed, max, 0, "2000" +HKR, Ndi\Params\MaxSpeed, step, 0, "1" +HKR, Ndi\Params\MaxSpeed, Base, 0, "10" +HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% +HKR, Ndi\Params\KeepLink, type, 0, "enum" +HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% +HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% +HKR, Ndi\Params\KeepLink, default, 0, "0" + + +[Neo.Service] +DisplayName = %Neo.Service.DispName% +Description = %Neo.Service.Desc% +ServiceType = 1 +StartType = 3 +ErrorControl = 1 +ServiceBinary = %12%\Neo_VPN59.sys +LoadOrderGroup = NDIS + +[Neo.Reg] +HKR, Ndi, Service, 0, Neo.Service.Name +HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" +HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" + +[Neo.EventLog] +HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN59.sys" +HKR, , TypesSupported, 0x00010001, 7 + +[Strings] +CompanyName = "SoftEther Corporation" +DiskDescription = "VPN Client Device Driver Install Disk" +Neo.Service.Name = "Neo_VPN59" +Neo.Service.DispName = "VPN Client Device Driver - VPN59" +Neo.Service.Desc = "VPN Client Adapter - VPN59" +NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN59" +Neo.EventLog.Name = "Neo" +NetworkAddress = "MAC Address" +DefaultAddress = "000001000001" +MaxSpeed = "Indicate Speed (Mbps)" +KeepLink = "Keep Link" +On = "On" +Off = "Off" + + +; Auto Generated 20180205_163608.799 + diff --git a/src/bin/hamcore/DriverPackages/Neo6_Win8/x86/Neo6_x86_VPN6.inf b/src/bin/hamcore/DriverPackages/Neo6_Win8/x86/Neo6_x86_VPN6.inf index a3484f2f..7ea13447 100644 --- a/src/bin/hamcore/DriverPackages/Neo6_Win8/x86/Neo6_x86_VPN6.inf +++ b/src/bin/hamcore/DriverPackages/Neo6_Win8/x86/Neo6_x86_VPN6.inf @@ -1,114 +1,114 @@ -; VPN Client Device Driver for Windows 2000 and Greater -; -; Copyright (c) SoftEther Corporation. All Rights Reserved. -; http://www.softether.co.jp/ -; -; BUILD 9658 - -[Version] -Signature = "$Windows NT$" -Class = Net -ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} -Provider = %CompanyName% -DriverVer = 02/04/2018, 4.25.0.9658 -CatalogFile.NT = inf_VPN6.cat - -[Manufacturer] -%CompanyName% = SoftEther - -[SourceDisksNames] -1=%DiskDescription%, "", , - -[SourceDisksFiles] -Neo_VPN6.sys = 1 - -[DestinationDirs] -DefaultDestDir = 12 -Neo.CopyFiles.Sys = 12 - -[Neo.CopyFiles.Sys] -Neo_VPN6.sys, , , 2 - -[SoftEther] -%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN6 - -[NeoAdapter.Install] -Characteristics = 0x1 -AddReg = Neo.Reg, NeoAdapter.Ndi -CopyFiles = Neo.CopyFiles.Sys -*IfType = 53 -*MediaType = 0 -*PhysicalMediaType = 0 - -[NeoAdapter.Install.Services] -AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% - -[NeoAdapter.Ndi] -HKR, , NetworkAddress, 0, %DefaultAddress% -HKR, Ndi, DeviceID, , "NeoAdapter_VPN6" -HKR, , DevLoader, , ndis -HKR, , DeviceVxDs, , Neo_VPN6.sys -HKR, NDIS, LogDriverName, , "Neo_VPN6" -HKR, NDIS, MajorNdisVersion, 1, 5 -HKR, NDIS, MinorNdisVersion, 1, 0 -HKR, Ndi\Interfaces, DefUpper, , "ndis5" -HKR, Ndi\Interfaces, UpperRange, , "ndis5" -HKR, Ndi\Interfaces, LowerRange, , "ethernet" -HKR, Ndi\Interfaces, DefLower, , "ethernet" -HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" -HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% -HKR, Ndi\Params\NetworkAddress, type, 0, "edit" -HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" -HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" -HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% -HKR, Ndi\Params\NetworkAddress, optional, 0, "0" -HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% -HKR, Ndi\Params\MaxSpeed, type, 0, "int" -HKR, Ndi\Params\MaxSpeed, default, 0, "100" -HKR, Ndi\Params\MaxSpeed, min, 0, "0" -HKR, Ndi\Params\MaxSpeed, max, 0, "2000" -HKR, Ndi\Params\MaxSpeed, step, 0, "1" -HKR, Ndi\Params\MaxSpeed, Base, 0, "10" -HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% -HKR, Ndi\Params\KeepLink, type, 0, "enum" -HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% -HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% -HKR, Ndi\Params\KeepLink, default, 0, "0" - - -[Neo.Service] -DisplayName = %Neo.Service.DispName% -Description = %Neo.Service.Desc% -ServiceType = 1 -StartType = 3 -ErrorControl = 1 -ServiceBinary = %12%\Neo_VPN6.sys -LoadOrderGroup = NDIS - -[Neo.Reg] -HKR, Ndi, Service, 0, Neo.Service.Name -HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" -HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" - -[Neo.EventLog] -HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN6.sys" -HKR, , TypesSupported, 0x00010001, 7 - -[Strings] -CompanyName = "SoftEther Corporation" -DiskDescription = "VPN Client Device Driver Install Disk" -Neo.Service.Name = "Neo_VPN6" -Neo.Service.DispName = "VPN Client Device Driver - VPN6" -Neo.Service.Desc = "VPN Client Adapter - VPN6" -NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN6" -Neo.EventLog.Name = "Neo" -NetworkAddress = "MAC Address" -DefaultAddress = "000001000001" -MaxSpeed = "Indicate Speed (Mbps)" -KeepLink = "Keep Link" -On = "On" -Off = "Off" - - -; Auto Generated 20180205_163608.754 - +; VPN Client Device Driver for Windows 2000 and Greater +; +; Copyright (c) SoftEther Corporation. All Rights Reserved. +; http://www.softether.co.jp/ +; +; BUILD 9658 + +[Version] +Signature = "$Windows NT$" +Class = Net +ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} +Provider = %CompanyName% +DriverVer = 02/04/2018, 4.25.0.9658 +CatalogFile.NT = inf_VPN6.cat + +[Manufacturer] +%CompanyName% = SoftEther + +[SourceDisksNames] +1=%DiskDescription%, "", , + +[SourceDisksFiles] +Neo_VPN6.sys = 1 + +[DestinationDirs] +DefaultDestDir = 12 +Neo.CopyFiles.Sys = 12 + +[Neo.CopyFiles.Sys] +Neo_VPN6.sys, , , 2 + +[SoftEther] +%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN6 + +[NeoAdapter.Install] +Characteristics = 0x1 +AddReg = Neo.Reg, NeoAdapter.Ndi +CopyFiles = Neo.CopyFiles.Sys +*IfType = 53 +*MediaType = 0 +*PhysicalMediaType = 0 + +[NeoAdapter.Install.Services] +AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% + +[NeoAdapter.Ndi] +HKR, , NetworkAddress, 0, %DefaultAddress% +HKR, Ndi, DeviceID, , "NeoAdapter_VPN6" +HKR, , DevLoader, , ndis +HKR, , DeviceVxDs, , Neo_VPN6.sys +HKR, NDIS, LogDriverName, , "Neo_VPN6" +HKR, NDIS, MajorNdisVersion, 1, 5 +HKR, NDIS, MinorNdisVersion, 1, 0 +HKR, Ndi\Interfaces, DefUpper, , "ndis5" +HKR, Ndi\Interfaces, UpperRange, , "ndis5" +HKR, Ndi\Interfaces, LowerRange, , "ethernet" +HKR, Ndi\Interfaces, DefLower, , "ethernet" +HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" +HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% +HKR, Ndi\Params\NetworkAddress, type, 0, "edit" +HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" +HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" +HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% +HKR, Ndi\Params\NetworkAddress, optional, 0, "0" +HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% +HKR, Ndi\Params\MaxSpeed, type, 0, "int" +HKR, Ndi\Params\MaxSpeed, default, 0, "100" +HKR, Ndi\Params\MaxSpeed, min, 0, "0" +HKR, Ndi\Params\MaxSpeed, max, 0, "2000" +HKR, Ndi\Params\MaxSpeed, step, 0, "1" +HKR, Ndi\Params\MaxSpeed, Base, 0, "10" +HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% +HKR, Ndi\Params\KeepLink, type, 0, "enum" +HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% +HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% +HKR, Ndi\Params\KeepLink, default, 0, "0" + + +[Neo.Service] +DisplayName = %Neo.Service.DispName% +Description = %Neo.Service.Desc% +ServiceType = 1 +StartType = 3 +ErrorControl = 1 +ServiceBinary = %12%\Neo_VPN6.sys +LoadOrderGroup = NDIS + +[Neo.Reg] +HKR, Ndi, Service, 0, Neo.Service.Name +HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" +HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" + +[Neo.EventLog] +HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN6.sys" +HKR, , TypesSupported, 0x00010001, 7 + +[Strings] +CompanyName = "SoftEther Corporation" +DiskDescription = "VPN Client Device Driver Install Disk" +Neo.Service.Name = "Neo_VPN6" +Neo.Service.DispName = "VPN Client Device Driver - VPN6" +Neo.Service.Desc = "VPN Client Adapter - VPN6" +NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN6" +Neo.EventLog.Name = "Neo" +NetworkAddress = "MAC Address" +DefaultAddress = "000001000001" +MaxSpeed = "Indicate Speed (Mbps)" +KeepLink = "Keep Link" +On = "On" +Off = "Off" + + +; Auto Generated 20180205_163608.754 + diff --git a/src/bin/hamcore/DriverPackages/Neo6_Win8/x86/Neo6_x86_VPN60.inf b/src/bin/hamcore/DriverPackages/Neo6_Win8/x86/Neo6_x86_VPN60.inf index fc2c2d30..284f064b 100644 --- a/src/bin/hamcore/DriverPackages/Neo6_Win8/x86/Neo6_x86_VPN60.inf +++ b/src/bin/hamcore/DriverPackages/Neo6_Win8/x86/Neo6_x86_VPN60.inf @@ -1,114 +1,114 @@ -; VPN Client Device Driver for Windows 2000 and Greater -; -; Copyright (c) SoftEther Corporation. All Rights Reserved. -; http://www.softether.co.jp/ -; -; BUILD 9658 - -[Version] -Signature = "$Windows NT$" -Class = Net -ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} -Provider = %CompanyName% -DriverVer = 02/04/2018, 4.25.0.9658 -CatalogFile.NT = inf_VPN60.cat - -[Manufacturer] -%CompanyName% = SoftEther - -[SourceDisksNames] -1=%DiskDescription%, "", , - -[SourceDisksFiles] -Neo_VPN60.sys = 1 - -[DestinationDirs] -DefaultDestDir = 12 -Neo.CopyFiles.Sys = 12 - -[Neo.CopyFiles.Sys] -Neo_VPN60.sys, , , 2 - -[SoftEther] -%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN60 - -[NeoAdapter.Install] -Characteristics = 0x1 -AddReg = Neo.Reg, NeoAdapter.Ndi -CopyFiles = Neo.CopyFiles.Sys -*IfType = 53 -*MediaType = 0 -*PhysicalMediaType = 0 - -[NeoAdapter.Install.Services] -AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% - -[NeoAdapter.Ndi] -HKR, , NetworkAddress, 0, %DefaultAddress% -HKR, Ndi, DeviceID, , "NeoAdapter_VPN60" -HKR, , DevLoader, , ndis -HKR, , DeviceVxDs, , Neo_VPN60.sys -HKR, NDIS, LogDriverName, , "Neo_VPN60" -HKR, NDIS, MajorNdisVersion, 1, 5 -HKR, NDIS, MinorNdisVersion, 1, 0 -HKR, Ndi\Interfaces, DefUpper, , "ndis5" -HKR, Ndi\Interfaces, UpperRange, , "ndis5" -HKR, Ndi\Interfaces, LowerRange, , "ethernet" -HKR, Ndi\Interfaces, DefLower, , "ethernet" -HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" -HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% -HKR, Ndi\Params\NetworkAddress, type, 0, "edit" -HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" -HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" -HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% -HKR, Ndi\Params\NetworkAddress, optional, 0, "0" -HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% -HKR, Ndi\Params\MaxSpeed, type, 0, "int" -HKR, Ndi\Params\MaxSpeed, default, 0, "100" -HKR, Ndi\Params\MaxSpeed, min, 0, "0" -HKR, Ndi\Params\MaxSpeed, max, 0, "2000" -HKR, Ndi\Params\MaxSpeed, step, 0, "1" -HKR, Ndi\Params\MaxSpeed, Base, 0, "10" -HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% -HKR, Ndi\Params\KeepLink, type, 0, "enum" -HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% -HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% -HKR, Ndi\Params\KeepLink, default, 0, "0" - - -[Neo.Service] -DisplayName = %Neo.Service.DispName% -Description = %Neo.Service.Desc% -ServiceType = 1 -StartType = 3 -ErrorControl = 1 -ServiceBinary = %12%\Neo_VPN60.sys -LoadOrderGroup = NDIS - -[Neo.Reg] -HKR, Ndi, Service, 0, Neo.Service.Name -HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" -HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" - -[Neo.EventLog] -HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN60.sys" -HKR, , TypesSupported, 0x00010001, 7 - -[Strings] -CompanyName = "SoftEther Corporation" -DiskDescription = "VPN Client Device Driver Install Disk" -Neo.Service.Name = "Neo_VPN60" -Neo.Service.DispName = "VPN Client Device Driver - VPN60" -Neo.Service.Desc = "VPN Client Adapter - VPN60" -NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN60" -Neo.EventLog.Name = "Neo" -NetworkAddress = "MAC Address" -DefaultAddress = "000001000001" -MaxSpeed = "Indicate Speed (Mbps)" -KeepLink = "Keep Link" -On = "On" -Off = "Off" - - -; Auto Generated 20180205_163608.800 - +; VPN Client Device Driver for Windows 2000 and Greater +; +; Copyright (c) SoftEther Corporation. All Rights Reserved. +; http://www.softether.co.jp/ +; +; BUILD 9658 + +[Version] +Signature = "$Windows NT$" +Class = Net +ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} +Provider = %CompanyName% +DriverVer = 02/04/2018, 4.25.0.9658 +CatalogFile.NT = inf_VPN60.cat + +[Manufacturer] +%CompanyName% = SoftEther + +[SourceDisksNames] +1=%DiskDescription%, "", , + +[SourceDisksFiles] +Neo_VPN60.sys = 1 + +[DestinationDirs] +DefaultDestDir = 12 +Neo.CopyFiles.Sys = 12 + +[Neo.CopyFiles.Sys] +Neo_VPN60.sys, , , 2 + +[SoftEther] +%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN60 + +[NeoAdapter.Install] +Characteristics = 0x1 +AddReg = Neo.Reg, NeoAdapter.Ndi +CopyFiles = Neo.CopyFiles.Sys +*IfType = 53 +*MediaType = 0 +*PhysicalMediaType = 0 + +[NeoAdapter.Install.Services] +AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% + +[NeoAdapter.Ndi] +HKR, , NetworkAddress, 0, %DefaultAddress% +HKR, Ndi, DeviceID, , "NeoAdapter_VPN60" +HKR, , DevLoader, , ndis +HKR, , DeviceVxDs, , Neo_VPN60.sys +HKR, NDIS, LogDriverName, , "Neo_VPN60" +HKR, NDIS, MajorNdisVersion, 1, 5 +HKR, NDIS, MinorNdisVersion, 1, 0 +HKR, Ndi\Interfaces, DefUpper, , "ndis5" +HKR, Ndi\Interfaces, UpperRange, , "ndis5" +HKR, Ndi\Interfaces, LowerRange, , "ethernet" +HKR, Ndi\Interfaces, DefLower, , "ethernet" +HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" +HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% +HKR, Ndi\Params\NetworkAddress, type, 0, "edit" +HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" +HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" +HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% +HKR, Ndi\Params\NetworkAddress, optional, 0, "0" +HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% +HKR, Ndi\Params\MaxSpeed, type, 0, "int" +HKR, Ndi\Params\MaxSpeed, default, 0, "100" +HKR, Ndi\Params\MaxSpeed, min, 0, "0" +HKR, Ndi\Params\MaxSpeed, max, 0, "2000" +HKR, Ndi\Params\MaxSpeed, step, 0, "1" +HKR, Ndi\Params\MaxSpeed, Base, 0, "10" +HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% +HKR, Ndi\Params\KeepLink, type, 0, "enum" +HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% +HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% +HKR, Ndi\Params\KeepLink, default, 0, "0" + + +[Neo.Service] +DisplayName = %Neo.Service.DispName% +Description = %Neo.Service.Desc% +ServiceType = 1 +StartType = 3 +ErrorControl = 1 +ServiceBinary = %12%\Neo_VPN60.sys +LoadOrderGroup = NDIS + +[Neo.Reg] +HKR, Ndi, Service, 0, Neo.Service.Name +HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" +HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" + +[Neo.EventLog] +HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN60.sys" +HKR, , TypesSupported, 0x00010001, 7 + +[Strings] +CompanyName = "SoftEther Corporation" +DiskDescription = "VPN Client Device Driver Install Disk" +Neo.Service.Name = "Neo_VPN60" +Neo.Service.DispName = "VPN Client Device Driver - VPN60" +Neo.Service.Desc = "VPN Client Adapter - VPN60" +NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN60" +Neo.EventLog.Name = "Neo" +NetworkAddress = "MAC Address" +DefaultAddress = "000001000001" +MaxSpeed = "Indicate Speed (Mbps)" +KeepLink = "Keep Link" +On = "On" +Off = "Off" + + +; Auto Generated 20180205_163608.800 + diff --git a/src/bin/hamcore/DriverPackages/Neo6_Win8/x86/Neo6_x86_VPN61.inf b/src/bin/hamcore/DriverPackages/Neo6_Win8/x86/Neo6_x86_VPN61.inf index 76b10ae8..fa35b0d3 100644 --- a/src/bin/hamcore/DriverPackages/Neo6_Win8/x86/Neo6_x86_VPN61.inf +++ b/src/bin/hamcore/DriverPackages/Neo6_Win8/x86/Neo6_x86_VPN61.inf @@ -1,114 +1,114 @@ -; VPN Client Device Driver for Windows 2000 and Greater -; -; Copyright (c) SoftEther Corporation. All Rights Reserved. -; http://www.softether.co.jp/ -; -; BUILD 9658 - -[Version] -Signature = "$Windows NT$" -Class = Net -ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} -Provider = %CompanyName% -DriverVer = 02/04/2018, 4.25.0.9658 -CatalogFile.NT = inf_VPN61.cat - -[Manufacturer] -%CompanyName% = SoftEther - -[SourceDisksNames] -1=%DiskDescription%, "", , - -[SourceDisksFiles] -Neo_VPN61.sys = 1 - -[DestinationDirs] -DefaultDestDir = 12 -Neo.CopyFiles.Sys = 12 - -[Neo.CopyFiles.Sys] -Neo_VPN61.sys, , , 2 - -[SoftEther] -%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN61 - -[NeoAdapter.Install] -Characteristics = 0x1 -AddReg = Neo.Reg, NeoAdapter.Ndi -CopyFiles = Neo.CopyFiles.Sys -*IfType = 53 -*MediaType = 0 -*PhysicalMediaType = 0 - -[NeoAdapter.Install.Services] -AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% - -[NeoAdapter.Ndi] -HKR, , NetworkAddress, 0, %DefaultAddress% -HKR, Ndi, DeviceID, , "NeoAdapter_VPN61" -HKR, , DevLoader, , ndis -HKR, , DeviceVxDs, , Neo_VPN61.sys -HKR, NDIS, LogDriverName, , "Neo_VPN61" -HKR, NDIS, MajorNdisVersion, 1, 5 -HKR, NDIS, MinorNdisVersion, 1, 0 -HKR, Ndi\Interfaces, DefUpper, , "ndis5" -HKR, Ndi\Interfaces, UpperRange, , "ndis5" -HKR, Ndi\Interfaces, LowerRange, , "ethernet" -HKR, Ndi\Interfaces, DefLower, , "ethernet" -HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" -HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% -HKR, Ndi\Params\NetworkAddress, type, 0, "edit" -HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" -HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" -HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% -HKR, Ndi\Params\NetworkAddress, optional, 0, "0" -HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% -HKR, Ndi\Params\MaxSpeed, type, 0, "int" -HKR, Ndi\Params\MaxSpeed, default, 0, "100" -HKR, Ndi\Params\MaxSpeed, min, 0, "0" -HKR, Ndi\Params\MaxSpeed, max, 0, "2000" -HKR, Ndi\Params\MaxSpeed, step, 0, "1" -HKR, Ndi\Params\MaxSpeed, Base, 0, "10" -HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% -HKR, Ndi\Params\KeepLink, type, 0, "enum" -HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% -HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% -HKR, Ndi\Params\KeepLink, default, 0, "0" - - -[Neo.Service] -DisplayName = %Neo.Service.DispName% -Description = %Neo.Service.Desc% -ServiceType = 1 -StartType = 3 -ErrorControl = 1 -ServiceBinary = %12%\Neo_VPN61.sys -LoadOrderGroup = NDIS - -[Neo.Reg] -HKR, Ndi, Service, 0, Neo.Service.Name -HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" -HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" - -[Neo.EventLog] -HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN61.sys" -HKR, , TypesSupported, 0x00010001, 7 - -[Strings] -CompanyName = "SoftEther Corporation" -DiskDescription = "VPN Client Device Driver Install Disk" -Neo.Service.Name = "Neo_VPN61" -Neo.Service.DispName = "VPN Client Device Driver - VPN61" -Neo.Service.Desc = "VPN Client Adapter - VPN61" -NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN61" -Neo.EventLog.Name = "Neo" -NetworkAddress = "MAC Address" -DefaultAddress = "000001000001" -MaxSpeed = "Indicate Speed (Mbps)" -KeepLink = "Keep Link" -On = "On" -Off = "Off" - - -; Auto Generated 20180205_163608.801 - +; VPN Client Device Driver for Windows 2000 and Greater +; +; Copyright (c) SoftEther Corporation. All Rights Reserved. +; http://www.softether.co.jp/ +; +; BUILD 9658 + +[Version] +Signature = "$Windows NT$" +Class = Net +ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} +Provider = %CompanyName% +DriverVer = 02/04/2018, 4.25.0.9658 +CatalogFile.NT = inf_VPN61.cat + +[Manufacturer] +%CompanyName% = SoftEther + +[SourceDisksNames] +1=%DiskDescription%, "", , + +[SourceDisksFiles] +Neo_VPN61.sys = 1 + +[DestinationDirs] +DefaultDestDir = 12 +Neo.CopyFiles.Sys = 12 + +[Neo.CopyFiles.Sys] +Neo_VPN61.sys, , , 2 + +[SoftEther] +%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN61 + +[NeoAdapter.Install] +Characteristics = 0x1 +AddReg = Neo.Reg, NeoAdapter.Ndi +CopyFiles = Neo.CopyFiles.Sys +*IfType = 53 +*MediaType = 0 +*PhysicalMediaType = 0 + +[NeoAdapter.Install.Services] +AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% + +[NeoAdapter.Ndi] +HKR, , NetworkAddress, 0, %DefaultAddress% +HKR, Ndi, DeviceID, , "NeoAdapter_VPN61" +HKR, , DevLoader, , ndis +HKR, , DeviceVxDs, , Neo_VPN61.sys +HKR, NDIS, LogDriverName, , "Neo_VPN61" +HKR, NDIS, MajorNdisVersion, 1, 5 +HKR, NDIS, MinorNdisVersion, 1, 0 +HKR, Ndi\Interfaces, DefUpper, , "ndis5" +HKR, Ndi\Interfaces, UpperRange, , "ndis5" +HKR, Ndi\Interfaces, LowerRange, , "ethernet" +HKR, Ndi\Interfaces, DefLower, , "ethernet" +HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" +HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% +HKR, Ndi\Params\NetworkAddress, type, 0, "edit" +HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" +HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" +HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% +HKR, Ndi\Params\NetworkAddress, optional, 0, "0" +HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% +HKR, Ndi\Params\MaxSpeed, type, 0, "int" +HKR, Ndi\Params\MaxSpeed, default, 0, "100" +HKR, Ndi\Params\MaxSpeed, min, 0, "0" +HKR, Ndi\Params\MaxSpeed, max, 0, "2000" +HKR, Ndi\Params\MaxSpeed, step, 0, "1" +HKR, Ndi\Params\MaxSpeed, Base, 0, "10" +HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% +HKR, Ndi\Params\KeepLink, type, 0, "enum" +HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% +HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% +HKR, Ndi\Params\KeepLink, default, 0, "0" + + +[Neo.Service] +DisplayName = %Neo.Service.DispName% +Description = %Neo.Service.Desc% +ServiceType = 1 +StartType = 3 +ErrorControl = 1 +ServiceBinary = %12%\Neo_VPN61.sys +LoadOrderGroup = NDIS + +[Neo.Reg] +HKR, Ndi, Service, 0, Neo.Service.Name +HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" +HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" + +[Neo.EventLog] +HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN61.sys" +HKR, , TypesSupported, 0x00010001, 7 + +[Strings] +CompanyName = "SoftEther Corporation" +DiskDescription = "VPN Client Device Driver Install Disk" +Neo.Service.Name = "Neo_VPN61" +Neo.Service.DispName = "VPN Client Device Driver - VPN61" +Neo.Service.Desc = "VPN Client Adapter - VPN61" +NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN61" +Neo.EventLog.Name = "Neo" +NetworkAddress = "MAC Address" +DefaultAddress = "000001000001" +MaxSpeed = "Indicate Speed (Mbps)" +KeepLink = "Keep Link" +On = "On" +Off = "Off" + + +; Auto Generated 20180205_163608.801 + diff --git a/src/bin/hamcore/DriverPackages/Neo6_Win8/x86/Neo6_x86_VPN62.inf b/src/bin/hamcore/DriverPackages/Neo6_Win8/x86/Neo6_x86_VPN62.inf index 21fe8794..a7cabeef 100644 --- a/src/bin/hamcore/DriverPackages/Neo6_Win8/x86/Neo6_x86_VPN62.inf +++ b/src/bin/hamcore/DriverPackages/Neo6_Win8/x86/Neo6_x86_VPN62.inf @@ -1,114 +1,114 @@ -; VPN Client Device Driver for Windows 2000 and Greater -; -; Copyright (c) SoftEther Corporation. All Rights Reserved. -; http://www.softether.co.jp/ -; -; BUILD 9658 - -[Version] -Signature = "$Windows NT$" -Class = Net -ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} -Provider = %CompanyName% -DriverVer = 02/04/2018, 4.25.0.9658 -CatalogFile.NT = inf_VPN62.cat - -[Manufacturer] -%CompanyName% = SoftEther - -[SourceDisksNames] -1=%DiskDescription%, "", , - -[SourceDisksFiles] -Neo_VPN62.sys = 1 - -[DestinationDirs] -DefaultDestDir = 12 -Neo.CopyFiles.Sys = 12 - -[Neo.CopyFiles.Sys] -Neo_VPN62.sys, , , 2 - -[SoftEther] -%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN62 - -[NeoAdapter.Install] -Characteristics = 0x1 -AddReg = Neo.Reg, NeoAdapter.Ndi -CopyFiles = Neo.CopyFiles.Sys -*IfType = 53 -*MediaType = 0 -*PhysicalMediaType = 0 - -[NeoAdapter.Install.Services] -AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% - -[NeoAdapter.Ndi] -HKR, , NetworkAddress, 0, %DefaultAddress% -HKR, Ndi, DeviceID, , "NeoAdapter_VPN62" -HKR, , DevLoader, , ndis -HKR, , DeviceVxDs, , Neo_VPN62.sys -HKR, NDIS, LogDriverName, , "Neo_VPN62" -HKR, NDIS, MajorNdisVersion, 1, 5 -HKR, NDIS, MinorNdisVersion, 1, 0 -HKR, Ndi\Interfaces, DefUpper, , "ndis5" -HKR, Ndi\Interfaces, UpperRange, , "ndis5" -HKR, Ndi\Interfaces, LowerRange, , "ethernet" -HKR, Ndi\Interfaces, DefLower, , "ethernet" -HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" -HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% -HKR, Ndi\Params\NetworkAddress, type, 0, "edit" -HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" -HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" -HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% -HKR, Ndi\Params\NetworkAddress, optional, 0, "0" -HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% -HKR, Ndi\Params\MaxSpeed, type, 0, "int" -HKR, Ndi\Params\MaxSpeed, default, 0, "100" -HKR, Ndi\Params\MaxSpeed, min, 0, "0" -HKR, Ndi\Params\MaxSpeed, max, 0, "2000" -HKR, Ndi\Params\MaxSpeed, step, 0, "1" -HKR, Ndi\Params\MaxSpeed, Base, 0, "10" -HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% -HKR, Ndi\Params\KeepLink, type, 0, "enum" -HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% -HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% -HKR, Ndi\Params\KeepLink, default, 0, "0" - - -[Neo.Service] -DisplayName = %Neo.Service.DispName% -Description = %Neo.Service.Desc% -ServiceType = 1 -StartType = 3 -ErrorControl = 1 -ServiceBinary = %12%\Neo_VPN62.sys -LoadOrderGroup = NDIS - -[Neo.Reg] -HKR, Ndi, Service, 0, Neo.Service.Name -HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" -HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" - -[Neo.EventLog] -HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN62.sys" -HKR, , TypesSupported, 0x00010001, 7 - -[Strings] -CompanyName = "SoftEther Corporation" -DiskDescription = "VPN Client Device Driver Install Disk" -Neo.Service.Name = "Neo_VPN62" -Neo.Service.DispName = "VPN Client Device Driver - VPN62" -Neo.Service.Desc = "VPN Client Adapter - VPN62" -NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN62" -Neo.EventLog.Name = "Neo" -NetworkAddress = "MAC Address" -DefaultAddress = "000001000001" -MaxSpeed = "Indicate Speed (Mbps)" -KeepLink = "Keep Link" -On = "On" -Off = "Off" - - -; Auto Generated 20180205_163608.801 - +; VPN Client Device Driver for Windows 2000 and Greater +; +; Copyright (c) SoftEther Corporation. All Rights Reserved. +; http://www.softether.co.jp/ +; +; BUILD 9658 + +[Version] +Signature = "$Windows NT$" +Class = Net +ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} +Provider = %CompanyName% +DriverVer = 02/04/2018, 4.25.0.9658 +CatalogFile.NT = inf_VPN62.cat + +[Manufacturer] +%CompanyName% = SoftEther + +[SourceDisksNames] +1=%DiskDescription%, "", , + +[SourceDisksFiles] +Neo_VPN62.sys = 1 + +[DestinationDirs] +DefaultDestDir = 12 +Neo.CopyFiles.Sys = 12 + +[Neo.CopyFiles.Sys] +Neo_VPN62.sys, , , 2 + +[SoftEther] +%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN62 + +[NeoAdapter.Install] +Characteristics = 0x1 +AddReg = Neo.Reg, NeoAdapter.Ndi +CopyFiles = Neo.CopyFiles.Sys +*IfType = 53 +*MediaType = 0 +*PhysicalMediaType = 0 + +[NeoAdapter.Install.Services] +AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% + +[NeoAdapter.Ndi] +HKR, , NetworkAddress, 0, %DefaultAddress% +HKR, Ndi, DeviceID, , "NeoAdapter_VPN62" +HKR, , DevLoader, , ndis +HKR, , DeviceVxDs, , Neo_VPN62.sys +HKR, NDIS, LogDriverName, , "Neo_VPN62" +HKR, NDIS, MajorNdisVersion, 1, 5 +HKR, NDIS, MinorNdisVersion, 1, 0 +HKR, Ndi\Interfaces, DefUpper, , "ndis5" +HKR, Ndi\Interfaces, UpperRange, , "ndis5" +HKR, Ndi\Interfaces, LowerRange, , "ethernet" +HKR, Ndi\Interfaces, DefLower, , "ethernet" +HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" +HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% +HKR, Ndi\Params\NetworkAddress, type, 0, "edit" +HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" +HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" +HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% +HKR, Ndi\Params\NetworkAddress, optional, 0, "0" +HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% +HKR, Ndi\Params\MaxSpeed, type, 0, "int" +HKR, Ndi\Params\MaxSpeed, default, 0, "100" +HKR, Ndi\Params\MaxSpeed, min, 0, "0" +HKR, Ndi\Params\MaxSpeed, max, 0, "2000" +HKR, Ndi\Params\MaxSpeed, step, 0, "1" +HKR, Ndi\Params\MaxSpeed, Base, 0, "10" +HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% +HKR, Ndi\Params\KeepLink, type, 0, "enum" +HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% +HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% +HKR, Ndi\Params\KeepLink, default, 0, "0" + + +[Neo.Service] +DisplayName = %Neo.Service.DispName% +Description = %Neo.Service.Desc% +ServiceType = 1 +StartType = 3 +ErrorControl = 1 +ServiceBinary = %12%\Neo_VPN62.sys +LoadOrderGroup = NDIS + +[Neo.Reg] +HKR, Ndi, Service, 0, Neo.Service.Name +HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" +HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" + +[Neo.EventLog] +HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN62.sys" +HKR, , TypesSupported, 0x00010001, 7 + +[Strings] +CompanyName = "SoftEther Corporation" +DiskDescription = "VPN Client Device Driver Install Disk" +Neo.Service.Name = "Neo_VPN62" +Neo.Service.DispName = "VPN Client Device Driver - VPN62" +Neo.Service.Desc = "VPN Client Adapter - VPN62" +NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN62" +Neo.EventLog.Name = "Neo" +NetworkAddress = "MAC Address" +DefaultAddress = "000001000001" +MaxSpeed = "Indicate Speed (Mbps)" +KeepLink = "Keep Link" +On = "On" +Off = "Off" + + +; Auto Generated 20180205_163608.801 + diff --git a/src/bin/hamcore/DriverPackages/Neo6_Win8/x86/Neo6_x86_VPN63.inf b/src/bin/hamcore/DriverPackages/Neo6_Win8/x86/Neo6_x86_VPN63.inf index e0f1104f..bcd8e02a 100644 --- a/src/bin/hamcore/DriverPackages/Neo6_Win8/x86/Neo6_x86_VPN63.inf +++ b/src/bin/hamcore/DriverPackages/Neo6_Win8/x86/Neo6_x86_VPN63.inf @@ -1,114 +1,114 @@ -; VPN Client Device Driver for Windows 2000 and Greater -; -; Copyright (c) SoftEther Corporation. All Rights Reserved. -; http://www.softether.co.jp/ -; -; BUILD 9658 - -[Version] -Signature = "$Windows NT$" -Class = Net -ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} -Provider = %CompanyName% -DriverVer = 02/04/2018, 4.25.0.9658 -CatalogFile.NT = inf_VPN63.cat - -[Manufacturer] -%CompanyName% = SoftEther - -[SourceDisksNames] -1=%DiskDescription%, "", , - -[SourceDisksFiles] -Neo_VPN63.sys = 1 - -[DestinationDirs] -DefaultDestDir = 12 -Neo.CopyFiles.Sys = 12 - -[Neo.CopyFiles.Sys] -Neo_VPN63.sys, , , 2 - -[SoftEther] -%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN63 - -[NeoAdapter.Install] -Characteristics = 0x1 -AddReg = Neo.Reg, NeoAdapter.Ndi -CopyFiles = Neo.CopyFiles.Sys -*IfType = 53 -*MediaType = 0 -*PhysicalMediaType = 0 - -[NeoAdapter.Install.Services] -AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% - -[NeoAdapter.Ndi] -HKR, , NetworkAddress, 0, %DefaultAddress% -HKR, Ndi, DeviceID, , "NeoAdapter_VPN63" -HKR, , DevLoader, , ndis -HKR, , DeviceVxDs, , Neo_VPN63.sys -HKR, NDIS, LogDriverName, , "Neo_VPN63" -HKR, NDIS, MajorNdisVersion, 1, 5 -HKR, NDIS, MinorNdisVersion, 1, 0 -HKR, Ndi\Interfaces, DefUpper, , "ndis5" -HKR, Ndi\Interfaces, UpperRange, , "ndis5" -HKR, Ndi\Interfaces, LowerRange, , "ethernet" -HKR, Ndi\Interfaces, DefLower, , "ethernet" -HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" -HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% -HKR, Ndi\Params\NetworkAddress, type, 0, "edit" -HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" -HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" -HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% -HKR, Ndi\Params\NetworkAddress, optional, 0, "0" -HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% -HKR, Ndi\Params\MaxSpeed, type, 0, "int" -HKR, Ndi\Params\MaxSpeed, default, 0, "100" -HKR, Ndi\Params\MaxSpeed, min, 0, "0" -HKR, Ndi\Params\MaxSpeed, max, 0, "2000" -HKR, Ndi\Params\MaxSpeed, step, 0, "1" -HKR, Ndi\Params\MaxSpeed, Base, 0, "10" -HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% -HKR, Ndi\Params\KeepLink, type, 0, "enum" -HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% -HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% -HKR, Ndi\Params\KeepLink, default, 0, "0" - - -[Neo.Service] -DisplayName = %Neo.Service.DispName% -Description = %Neo.Service.Desc% -ServiceType = 1 -StartType = 3 -ErrorControl = 1 -ServiceBinary = %12%\Neo_VPN63.sys -LoadOrderGroup = NDIS - -[Neo.Reg] -HKR, Ndi, Service, 0, Neo.Service.Name -HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" -HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" - -[Neo.EventLog] -HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN63.sys" -HKR, , TypesSupported, 0x00010001, 7 - -[Strings] -CompanyName = "SoftEther Corporation" -DiskDescription = "VPN Client Device Driver Install Disk" -Neo.Service.Name = "Neo_VPN63" -Neo.Service.DispName = "VPN Client Device Driver - VPN63" -Neo.Service.Desc = "VPN Client Adapter - VPN63" -NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN63" -Neo.EventLog.Name = "Neo" -NetworkAddress = "MAC Address" -DefaultAddress = "000001000001" -MaxSpeed = "Indicate Speed (Mbps)" -KeepLink = "Keep Link" -On = "On" -Off = "Off" - - -; Auto Generated 20180205_163608.802 - +; VPN Client Device Driver for Windows 2000 and Greater +; +; Copyright (c) SoftEther Corporation. All Rights Reserved. +; http://www.softether.co.jp/ +; +; BUILD 9658 + +[Version] +Signature = "$Windows NT$" +Class = Net +ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} +Provider = %CompanyName% +DriverVer = 02/04/2018, 4.25.0.9658 +CatalogFile.NT = inf_VPN63.cat + +[Manufacturer] +%CompanyName% = SoftEther + +[SourceDisksNames] +1=%DiskDescription%, "", , + +[SourceDisksFiles] +Neo_VPN63.sys = 1 + +[DestinationDirs] +DefaultDestDir = 12 +Neo.CopyFiles.Sys = 12 + +[Neo.CopyFiles.Sys] +Neo_VPN63.sys, , , 2 + +[SoftEther] +%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN63 + +[NeoAdapter.Install] +Characteristics = 0x1 +AddReg = Neo.Reg, NeoAdapter.Ndi +CopyFiles = Neo.CopyFiles.Sys +*IfType = 53 +*MediaType = 0 +*PhysicalMediaType = 0 + +[NeoAdapter.Install.Services] +AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% + +[NeoAdapter.Ndi] +HKR, , NetworkAddress, 0, %DefaultAddress% +HKR, Ndi, DeviceID, , "NeoAdapter_VPN63" +HKR, , DevLoader, , ndis +HKR, , DeviceVxDs, , Neo_VPN63.sys +HKR, NDIS, LogDriverName, , "Neo_VPN63" +HKR, NDIS, MajorNdisVersion, 1, 5 +HKR, NDIS, MinorNdisVersion, 1, 0 +HKR, Ndi\Interfaces, DefUpper, , "ndis5" +HKR, Ndi\Interfaces, UpperRange, , "ndis5" +HKR, Ndi\Interfaces, LowerRange, , "ethernet" +HKR, Ndi\Interfaces, DefLower, , "ethernet" +HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" +HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% +HKR, Ndi\Params\NetworkAddress, type, 0, "edit" +HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" +HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" +HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% +HKR, Ndi\Params\NetworkAddress, optional, 0, "0" +HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% +HKR, Ndi\Params\MaxSpeed, type, 0, "int" +HKR, Ndi\Params\MaxSpeed, default, 0, "100" +HKR, Ndi\Params\MaxSpeed, min, 0, "0" +HKR, Ndi\Params\MaxSpeed, max, 0, "2000" +HKR, Ndi\Params\MaxSpeed, step, 0, "1" +HKR, Ndi\Params\MaxSpeed, Base, 0, "10" +HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% +HKR, Ndi\Params\KeepLink, type, 0, "enum" +HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% +HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% +HKR, Ndi\Params\KeepLink, default, 0, "0" + + +[Neo.Service] +DisplayName = %Neo.Service.DispName% +Description = %Neo.Service.Desc% +ServiceType = 1 +StartType = 3 +ErrorControl = 1 +ServiceBinary = %12%\Neo_VPN63.sys +LoadOrderGroup = NDIS + +[Neo.Reg] +HKR, Ndi, Service, 0, Neo.Service.Name +HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" +HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" + +[Neo.EventLog] +HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN63.sys" +HKR, , TypesSupported, 0x00010001, 7 + +[Strings] +CompanyName = "SoftEther Corporation" +DiskDescription = "VPN Client Device Driver Install Disk" +Neo.Service.Name = "Neo_VPN63" +Neo.Service.DispName = "VPN Client Device Driver - VPN63" +Neo.Service.Desc = "VPN Client Adapter - VPN63" +NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN63" +Neo.EventLog.Name = "Neo" +NetworkAddress = "MAC Address" +DefaultAddress = "000001000001" +MaxSpeed = "Indicate Speed (Mbps)" +KeepLink = "Keep Link" +On = "On" +Off = "Off" + + +; Auto Generated 20180205_163608.802 + diff --git a/src/bin/hamcore/DriverPackages/Neo6_Win8/x86/Neo6_x86_VPN64.inf b/src/bin/hamcore/DriverPackages/Neo6_Win8/x86/Neo6_x86_VPN64.inf index 3729bc7a..bcdf7f77 100644 --- a/src/bin/hamcore/DriverPackages/Neo6_Win8/x86/Neo6_x86_VPN64.inf +++ b/src/bin/hamcore/DriverPackages/Neo6_Win8/x86/Neo6_x86_VPN64.inf @@ -1,114 +1,114 @@ -; VPN Client Device Driver for Windows 2000 and Greater -; -; Copyright (c) SoftEther Corporation. All Rights Reserved. -; http://www.softether.co.jp/ -; -; BUILD 9658 - -[Version] -Signature = "$Windows NT$" -Class = Net -ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} -Provider = %CompanyName% -DriverVer = 02/04/2018, 4.25.0.9658 -CatalogFile.NT = inf_VPN64.cat - -[Manufacturer] -%CompanyName% = SoftEther - -[SourceDisksNames] -1=%DiskDescription%, "", , - -[SourceDisksFiles] -Neo_VPN64.sys = 1 - -[DestinationDirs] -DefaultDestDir = 12 -Neo.CopyFiles.Sys = 12 - -[Neo.CopyFiles.Sys] -Neo_VPN64.sys, , , 2 - -[SoftEther] -%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN64 - -[NeoAdapter.Install] -Characteristics = 0x1 -AddReg = Neo.Reg, NeoAdapter.Ndi -CopyFiles = Neo.CopyFiles.Sys -*IfType = 53 -*MediaType = 0 -*PhysicalMediaType = 0 - -[NeoAdapter.Install.Services] -AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% - -[NeoAdapter.Ndi] -HKR, , NetworkAddress, 0, %DefaultAddress% -HKR, Ndi, DeviceID, , "NeoAdapter_VPN64" -HKR, , DevLoader, , ndis -HKR, , DeviceVxDs, , Neo_VPN64.sys -HKR, NDIS, LogDriverName, , "Neo_VPN64" -HKR, NDIS, MajorNdisVersion, 1, 5 -HKR, NDIS, MinorNdisVersion, 1, 0 -HKR, Ndi\Interfaces, DefUpper, , "ndis5" -HKR, Ndi\Interfaces, UpperRange, , "ndis5" -HKR, Ndi\Interfaces, LowerRange, , "ethernet" -HKR, Ndi\Interfaces, DefLower, , "ethernet" -HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" -HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% -HKR, Ndi\Params\NetworkAddress, type, 0, "edit" -HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" -HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" -HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% -HKR, Ndi\Params\NetworkAddress, optional, 0, "0" -HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% -HKR, Ndi\Params\MaxSpeed, type, 0, "int" -HKR, Ndi\Params\MaxSpeed, default, 0, "100" -HKR, Ndi\Params\MaxSpeed, min, 0, "0" -HKR, Ndi\Params\MaxSpeed, max, 0, "2000" -HKR, Ndi\Params\MaxSpeed, step, 0, "1" -HKR, Ndi\Params\MaxSpeed, Base, 0, "10" -HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% -HKR, Ndi\Params\KeepLink, type, 0, "enum" -HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% -HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% -HKR, Ndi\Params\KeepLink, default, 0, "0" - - -[Neo.Service] -DisplayName = %Neo.Service.DispName% -Description = %Neo.Service.Desc% -ServiceType = 1 -StartType = 3 -ErrorControl = 1 -ServiceBinary = %12%\Neo_VPN64.sys -LoadOrderGroup = NDIS - -[Neo.Reg] -HKR, Ndi, Service, 0, Neo.Service.Name -HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" -HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" - -[Neo.EventLog] -HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN64.sys" -HKR, , TypesSupported, 0x00010001, 7 - -[Strings] -CompanyName = "SoftEther Corporation" -DiskDescription = "VPN Client Device Driver Install Disk" -Neo.Service.Name = "Neo_VPN64" -Neo.Service.DispName = "VPN Client Device Driver - VPN64" -Neo.Service.Desc = "VPN Client Adapter - VPN64" -NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN64" -Neo.EventLog.Name = "Neo" -NetworkAddress = "MAC Address" -DefaultAddress = "000001000001" -MaxSpeed = "Indicate Speed (Mbps)" -KeepLink = "Keep Link" -On = "On" -Off = "Off" - - -; Auto Generated 20180205_163608.803 - +; VPN Client Device Driver for Windows 2000 and Greater +; +; Copyright (c) SoftEther Corporation. All Rights Reserved. +; http://www.softether.co.jp/ +; +; BUILD 9658 + +[Version] +Signature = "$Windows NT$" +Class = Net +ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} +Provider = %CompanyName% +DriverVer = 02/04/2018, 4.25.0.9658 +CatalogFile.NT = inf_VPN64.cat + +[Manufacturer] +%CompanyName% = SoftEther + +[SourceDisksNames] +1=%DiskDescription%, "", , + +[SourceDisksFiles] +Neo_VPN64.sys = 1 + +[DestinationDirs] +DefaultDestDir = 12 +Neo.CopyFiles.Sys = 12 + +[Neo.CopyFiles.Sys] +Neo_VPN64.sys, , , 2 + +[SoftEther] +%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN64 + +[NeoAdapter.Install] +Characteristics = 0x1 +AddReg = Neo.Reg, NeoAdapter.Ndi +CopyFiles = Neo.CopyFiles.Sys +*IfType = 53 +*MediaType = 0 +*PhysicalMediaType = 0 + +[NeoAdapter.Install.Services] +AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% + +[NeoAdapter.Ndi] +HKR, , NetworkAddress, 0, %DefaultAddress% +HKR, Ndi, DeviceID, , "NeoAdapter_VPN64" +HKR, , DevLoader, , ndis +HKR, , DeviceVxDs, , Neo_VPN64.sys +HKR, NDIS, LogDriverName, , "Neo_VPN64" +HKR, NDIS, MajorNdisVersion, 1, 5 +HKR, NDIS, MinorNdisVersion, 1, 0 +HKR, Ndi\Interfaces, DefUpper, , "ndis5" +HKR, Ndi\Interfaces, UpperRange, , "ndis5" +HKR, Ndi\Interfaces, LowerRange, , "ethernet" +HKR, Ndi\Interfaces, DefLower, , "ethernet" +HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" +HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% +HKR, Ndi\Params\NetworkAddress, type, 0, "edit" +HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" +HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" +HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% +HKR, Ndi\Params\NetworkAddress, optional, 0, "0" +HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% +HKR, Ndi\Params\MaxSpeed, type, 0, "int" +HKR, Ndi\Params\MaxSpeed, default, 0, "100" +HKR, Ndi\Params\MaxSpeed, min, 0, "0" +HKR, Ndi\Params\MaxSpeed, max, 0, "2000" +HKR, Ndi\Params\MaxSpeed, step, 0, "1" +HKR, Ndi\Params\MaxSpeed, Base, 0, "10" +HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% +HKR, Ndi\Params\KeepLink, type, 0, "enum" +HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% +HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% +HKR, Ndi\Params\KeepLink, default, 0, "0" + + +[Neo.Service] +DisplayName = %Neo.Service.DispName% +Description = %Neo.Service.Desc% +ServiceType = 1 +StartType = 3 +ErrorControl = 1 +ServiceBinary = %12%\Neo_VPN64.sys +LoadOrderGroup = NDIS + +[Neo.Reg] +HKR, Ndi, Service, 0, Neo.Service.Name +HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" +HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" + +[Neo.EventLog] +HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN64.sys" +HKR, , TypesSupported, 0x00010001, 7 + +[Strings] +CompanyName = "SoftEther Corporation" +DiskDescription = "VPN Client Device Driver Install Disk" +Neo.Service.Name = "Neo_VPN64" +Neo.Service.DispName = "VPN Client Device Driver - VPN64" +Neo.Service.Desc = "VPN Client Adapter - VPN64" +NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN64" +Neo.EventLog.Name = "Neo" +NetworkAddress = "MAC Address" +DefaultAddress = "000001000001" +MaxSpeed = "Indicate Speed (Mbps)" +KeepLink = "Keep Link" +On = "On" +Off = "Off" + + +; Auto Generated 20180205_163608.803 + diff --git a/src/bin/hamcore/DriverPackages/Neo6_Win8/x86/Neo6_x86_VPN65.inf b/src/bin/hamcore/DriverPackages/Neo6_Win8/x86/Neo6_x86_VPN65.inf index 3fd498fd..84f0dd19 100644 --- a/src/bin/hamcore/DriverPackages/Neo6_Win8/x86/Neo6_x86_VPN65.inf +++ b/src/bin/hamcore/DriverPackages/Neo6_Win8/x86/Neo6_x86_VPN65.inf @@ -1,114 +1,114 @@ -; VPN Client Device Driver for Windows 2000 and Greater -; -; Copyright (c) SoftEther Corporation. All Rights Reserved. -; http://www.softether.co.jp/ -; -; BUILD 9658 - -[Version] -Signature = "$Windows NT$" -Class = Net -ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} -Provider = %CompanyName% -DriverVer = 02/04/2018, 4.25.0.9658 -CatalogFile.NT = inf_VPN65.cat - -[Manufacturer] -%CompanyName% = SoftEther - -[SourceDisksNames] -1=%DiskDescription%, "", , - -[SourceDisksFiles] -Neo_VPN65.sys = 1 - -[DestinationDirs] -DefaultDestDir = 12 -Neo.CopyFiles.Sys = 12 - -[Neo.CopyFiles.Sys] -Neo_VPN65.sys, , , 2 - -[SoftEther] -%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN65 - -[NeoAdapter.Install] -Characteristics = 0x1 -AddReg = Neo.Reg, NeoAdapter.Ndi -CopyFiles = Neo.CopyFiles.Sys -*IfType = 53 -*MediaType = 0 -*PhysicalMediaType = 0 - -[NeoAdapter.Install.Services] -AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% - -[NeoAdapter.Ndi] -HKR, , NetworkAddress, 0, %DefaultAddress% -HKR, Ndi, DeviceID, , "NeoAdapter_VPN65" -HKR, , DevLoader, , ndis -HKR, , DeviceVxDs, , Neo_VPN65.sys -HKR, NDIS, LogDriverName, , "Neo_VPN65" -HKR, NDIS, MajorNdisVersion, 1, 5 -HKR, NDIS, MinorNdisVersion, 1, 0 -HKR, Ndi\Interfaces, DefUpper, , "ndis5" -HKR, Ndi\Interfaces, UpperRange, , "ndis5" -HKR, Ndi\Interfaces, LowerRange, , "ethernet" -HKR, Ndi\Interfaces, DefLower, , "ethernet" -HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" -HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% -HKR, Ndi\Params\NetworkAddress, type, 0, "edit" -HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" -HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" -HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% -HKR, Ndi\Params\NetworkAddress, optional, 0, "0" -HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% -HKR, Ndi\Params\MaxSpeed, type, 0, "int" -HKR, Ndi\Params\MaxSpeed, default, 0, "100" -HKR, Ndi\Params\MaxSpeed, min, 0, "0" -HKR, Ndi\Params\MaxSpeed, max, 0, "2000" -HKR, Ndi\Params\MaxSpeed, step, 0, "1" -HKR, Ndi\Params\MaxSpeed, Base, 0, "10" -HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% -HKR, Ndi\Params\KeepLink, type, 0, "enum" -HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% -HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% -HKR, Ndi\Params\KeepLink, default, 0, "0" - - -[Neo.Service] -DisplayName = %Neo.Service.DispName% -Description = %Neo.Service.Desc% -ServiceType = 1 -StartType = 3 -ErrorControl = 1 -ServiceBinary = %12%\Neo_VPN65.sys -LoadOrderGroup = NDIS - -[Neo.Reg] -HKR, Ndi, Service, 0, Neo.Service.Name -HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" -HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" - -[Neo.EventLog] -HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN65.sys" -HKR, , TypesSupported, 0x00010001, 7 - -[Strings] -CompanyName = "SoftEther Corporation" -DiskDescription = "VPN Client Device Driver Install Disk" -Neo.Service.Name = "Neo_VPN65" -Neo.Service.DispName = "VPN Client Device Driver - VPN65" -Neo.Service.Desc = "VPN Client Adapter - VPN65" -NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN65" -Neo.EventLog.Name = "Neo" -NetworkAddress = "MAC Address" -DefaultAddress = "000001000001" -MaxSpeed = "Indicate Speed (Mbps)" -KeepLink = "Keep Link" -On = "On" -Off = "Off" - - -; Auto Generated 20180205_163608.811 - +; VPN Client Device Driver for Windows 2000 and Greater +; +; Copyright (c) SoftEther Corporation. All Rights Reserved. +; http://www.softether.co.jp/ +; +; BUILD 9658 + +[Version] +Signature = "$Windows NT$" +Class = Net +ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} +Provider = %CompanyName% +DriverVer = 02/04/2018, 4.25.0.9658 +CatalogFile.NT = inf_VPN65.cat + +[Manufacturer] +%CompanyName% = SoftEther + +[SourceDisksNames] +1=%DiskDescription%, "", , + +[SourceDisksFiles] +Neo_VPN65.sys = 1 + +[DestinationDirs] +DefaultDestDir = 12 +Neo.CopyFiles.Sys = 12 + +[Neo.CopyFiles.Sys] +Neo_VPN65.sys, , , 2 + +[SoftEther] +%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN65 + +[NeoAdapter.Install] +Characteristics = 0x1 +AddReg = Neo.Reg, NeoAdapter.Ndi +CopyFiles = Neo.CopyFiles.Sys +*IfType = 53 +*MediaType = 0 +*PhysicalMediaType = 0 + +[NeoAdapter.Install.Services] +AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% + +[NeoAdapter.Ndi] +HKR, , NetworkAddress, 0, %DefaultAddress% +HKR, Ndi, DeviceID, , "NeoAdapter_VPN65" +HKR, , DevLoader, , ndis +HKR, , DeviceVxDs, , Neo_VPN65.sys +HKR, NDIS, LogDriverName, , "Neo_VPN65" +HKR, NDIS, MajorNdisVersion, 1, 5 +HKR, NDIS, MinorNdisVersion, 1, 0 +HKR, Ndi\Interfaces, DefUpper, , "ndis5" +HKR, Ndi\Interfaces, UpperRange, , "ndis5" +HKR, Ndi\Interfaces, LowerRange, , "ethernet" +HKR, Ndi\Interfaces, DefLower, , "ethernet" +HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" +HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% +HKR, Ndi\Params\NetworkAddress, type, 0, "edit" +HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" +HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" +HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% +HKR, Ndi\Params\NetworkAddress, optional, 0, "0" +HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% +HKR, Ndi\Params\MaxSpeed, type, 0, "int" +HKR, Ndi\Params\MaxSpeed, default, 0, "100" +HKR, Ndi\Params\MaxSpeed, min, 0, "0" +HKR, Ndi\Params\MaxSpeed, max, 0, "2000" +HKR, Ndi\Params\MaxSpeed, step, 0, "1" +HKR, Ndi\Params\MaxSpeed, Base, 0, "10" +HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% +HKR, Ndi\Params\KeepLink, type, 0, "enum" +HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% +HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% +HKR, Ndi\Params\KeepLink, default, 0, "0" + + +[Neo.Service] +DisplayName = %Neo.Service.DispName% +Description = %Neo.Service.Desc% +ServiceType = 1 +StartType = 3 +ErrorControl = 1 +ServiceBinary = %12%\Neo_VPN65.sys +LoadOrderGroup = NDIS + +[Neo.Reg] +HKR, Ndi, Service, 0, Neo.Service.Name +HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" +HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" + +[Neo.EventLog] +HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN65.sys" +HKR, , TypesSupported, 0x00010001, 7 + +[Strings] +CompanyName = "SoftEther Corporation" +DiskDescription = "VPN Client Device Driver Install Disk" +Neo.Service.Name = "Neo_VPN65" +Neo.Service.DispName = "VPN Client Device Driver - VPN65" +Neo.Service.Desc = "VPN Client Adapter - VPN65" +NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN65" +Neo.EventLog.Name = "Neo" +NetworkAddress = "MAC Address" +DefaultAddress = "000001000001" +MaxSpeed = "Indicate Speed (Mbps)" +KeepLink = "Keep Link" +On = "On" +Off = "Off" + + +; Auto Generated 20180205_163608.811 + diff --git a/src/bin/hamcore/DriverPackages/Neo6_Win8/x86/Neo6_x86_VPN66.inf b/src/bin/hamcore/DriverPackages/Neo6_Win8/x86/Neo6_x86_VPN66.inf index cd6eedc2..2c2f0899 100644 --- a/src/bin/hamcore/DriverPackages/Neo6_Win8/x86/Neo6_x86_VPN66.inf +++ b/src/bin/hamcore/DriverPackages/Neo6_Win8/x86/Neo6_x86_VPN66.inf @@ -1,114 +1,114 @@ -; VPN Client Device Driver for Windows 2000 and Greater -; -; Copyright (c) SoftEther Corporation. All Rights Reserved. -; http://www.softether.co.jp/ -; -; BUILD 9658 - -[Version] -Signature = "$Windows NT$" -Class = Net -ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} -Provider = %CompanyName% -DriverVer = 02/04/2018, 4.25.0.9658 -CatalogFile.NT = inf_VPN66.cat - -[Manufacturer] -%CompanyName% = SoftEther - -[SourceDisksNames] -1=%DiskDescription%, "", , - -[SourceDisksFiles] -Neo_VPN66.sys = 1 - -[DestinationDirs] -DefaultDestDir = 12 -Neo.CopyFiles.Sys = 12 - -[Neo.CopyFiles.Sys] -Neo_VPN66.sys, , , 2 - -[SoftEther] -%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN66 - -[NeoAdapter.Install] -Characteristics = 0x1 -AddReg = Neo.Reg, NeoAdapter.Ndi -CopyFiles = Neo.CopyFiles.Sys -*IfType = 53 -*MediaType = 0 -*PhysicalMediaType = 0 - -[NeoAdapter.Install.Services] -AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% - -[NeoAdapter.Ndi] -HKR, , NetworkAddress, 0, %DefaultAddress% -HKR, Ndi, DeviceID, , "NeoAdapter_VPN66" -HKR, , DevLoader, , ndis -HKR, , DeviceVxDs, , Neo_VPN66.sys -HKR, NDIS, LogDriverName, , "Neo_VPN66" -HKR, NDIS, MajorNdisVersion, 1, 5 -HKR, NDIS, MinorNdisVersion, 1, 0 -HKR, Ndi\Interfaces, DefUpper, , "ndis5" -HKR, Ndi\Interfaces, UpperRange, , "ndis5" -HKR, Ndi\Interfaces, LowerRange, , "ethernet" -HKR, Ndi\Interfaces, DefLower, , "ethernet" -HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" -HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% -HKR, Ndi\Params\NetworkAddress, type, 0, "edit" -HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" -HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" -HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% -HKR, Ndi\Params\NetworkAddress, optional, 0, "0" -HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% -HKR, Ndi\Params\MaxSpeed, type, 0, "int" -HKR, Ndi\Params\MaxSpeed, default, 0, "100" -HKR, Ndi\Params\MaxSpeed, min, 0, "0" -HKR, Ndi\Params\MaxSpeed, max, 0, "2000" -HKR, Ndi\Params\MaxSpeed, step, 0, "1" -HKR, Ndi\Params\MaxSpeed, Base, 0, "10" -HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% -HKR, Ndi\Params\KeepLink, type, 0, "enum" -HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% -HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% -HKR, Ndi\Params\KeepLink, default, 0, "0" - - -[Neo.Service] -DisplayName = %Neo.Service.DispName% -Description = %Neo.Service.Desc% -ServiceType = 1 -StartType = 3 -ErrorControl = 1 -ServiceBinary = %12%\Neo_VPN66.sys -LoadOrderGroup = NDIS - -[Neo.Reg] -HKR, Ndi, Service, 0, Neo.Service.Name -HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" -HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" - -[Neo.EventLog] -HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN66.sys" -HKR, , TypesSupported, 0x00010001, 7 - -[Strings] -CompanyName = "SoftEther Corporation" -DiskDescription = "VPN Client Device Driver Install Disk" -Neo.Service.Name = "Neo_VPN66" -Neo.Service.DispName = "VPN Client Device Driver - VPN66" -Neo.Service.Desc = "VPN Client Adapter - VPN66" -NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN66" -Neo.EventLog.Name = "Neo" -NetworkAddress = "MAC Address" -DefaultAddress = "000001000001" -MaxSpeed = "Indicate Speed (Mbps)" -KeepLink = "Keep Link" -On = "On" -Off = "Off" - - -; Auto Generated 20180205_163608.812 - +; VPN Client Device Driver for Windows 2000 and Greater +; +; Copyright (c) SoftEther Corporation. All Rights Reserved. +; http://www.softether.co.jp/ +; +; BUILD 9658 + +[Version] +Signature = "$Windows NT$" +Class = Net +ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} +Provider = %CompanyName% +DriverVer = 02/04/2018, 4.25.0.9658 +CatalogFile.NT = inf_VPN66.cat + +[Manufacturer] +%CompanyName% = SoftEther + +[SourceDisksNames] +1=%DiskDescription%, "", , + +[SourceDisksFiles] +Neo_VPN66.sys = 1 + +[DestinationDirs] +DefaultDestDir = 12 +Neo.CopyFiles.Sys = 12 + +[Neo.CopyFiles.Sys] +Neo_VPN66.sys, , , 2 + +[SoftEther] +%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN66 + +[NeoAdapter.Install] +Characteristics = 0x1 +AddReg = Neo.Reg, NeoAdapter.Ndi +CopyFiles = Neo.CopyFiles.Sys +*IfType = 53 +*MediaType = 0 +*PhysicalMediaType = 0 + +[NeoAdapter.Install.Services] +AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% + +[NeoAdapter.Ndi] +HKR, , NetworkAddress, 0, %DefaultAddress% +HKR, Ndi, DeviceID, , "NeoAdapter_VPN66" +HKR, , DevLoader, , ndis +HKR, , DeviceVxDs, , Neo_VPN66.sys +HKR, NDIS, LogDriverName, , "Neo_VPN66" +HKR, NDIS, MajorNdisVersion, 1, 5 +HKR, NDIS, MinorNdisVersion, 1, 0 +HKR, Ndi\Interfaces, DefUpper, , "ndis5" +HKR, Ndi\Interfaces, UpperRange, , "ndis5" +HKR, Ndi\Interfaces, LowerRange, , "ethernet" +HKR, Ndi\Interfaces, DefLower, , "ethernet" +HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" +HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% +HKR, Ndi\Params\NetworkAddress, type, 0, "edit" +HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" +HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" +HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% +HKR, Ndi\Params\NetworkAddress, optional, 0, "0" +HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% +HKR, Ndi\Params\MaxSpeed, type, 0, "int" +HKR, Ndi\Params\MaxSpeed, default, 0, "100" +HKR, Ndi\Params\MaxSpeed, min, 0, "0" +HKR, Ndi\Params\MaxSpeed, max, 0, "2000" +HKR, Ndi\Params\MaxSpeed, step, 0, "1" +HKR, Ndi\Params\MaxSpeed, Base, 0, "10" +HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% +HKR, Ndi\Params\KeepLink, type, 0, "enum" +HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% +HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% +HKR, Ndi\Params\KeepLink, default, 0, "0" + + +[Neo.Service] +DisplayName = %Neo.Service.DispName% +Description = %Neo.Service.Desc% +ServiceType = 1 +StartType = 3 +ErrorControl = 1 +ServiceBinary = %12%\Neo_VPN66.sys +LoadOrderGroup = NDIS + +[Neo.Reg] +HKR, Ndi, Service, 0, Neo.Service.Name +HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" +HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" + +[Neo.EventLog] +HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN66.sys" +HKR, , TypesSupported, 0x00010001, 7 + +[Strings] +CompanyName = "SoftEther Corporation" +DiskDescription = "VPN Client Device Driver Install Disk" +Neo.Service.Name = "Neo_VPN66" +Neo.Service.DispName = "VPN Client Device Driver - VPN66" +Neo.Service.Desc = "VPN Client Adapter - VPN66" +NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN66" +Neo.EventLog.Name = "Neo" +NetworkAddress = "MAC Address" +DefaultAddress = "000001000001" +MaxSpeed = "Indicate Speed (Mbps)" +KeepLink = "Keep Link" +On = "On" +Off = "Off" + + +; Auto Generated 20180205_163608.812 + diff --git a/src/bin/hamcore/DriverPackages/Neo6_Win8/x86/Neo6_x86_VPN67.inf b/src/bin/hamcore/DriverPackages/Neo6_Win8/x86/Neo6_x86_VPN67.inf index 8cfb40d7..982a08be 100644 --- a/src/bin/hamcore/DriverPackages/Neo6_Win8/x86/Neo6_x86_VPN67.inf +++ b/src/bin/hamcore/DriverPackages/Neo6_Win8/x86/Neo6_x86_VPN67.inf @@ -1,114 +1,114 @@ -; VPN Client Device Driver for Windows 2000 and Greater -; -; Copyright (c) SoftEther Corporation. All Rights Reserved. -; http://www.softether.co.jp/ -; -; BUILD 9658 - -[Version] -Signature = "$Windows NT$" -Class = Net -ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} -Provider = %CompanyName% -DriverVer = 02/04/2018, 4.25.0.9658 -CatalogFile.NT = inf_VPN67.cat - -[Manufacturer] -%CompanyName% = SoftEther - -[SourceDisksNames] -1=%DiskDescription%, "", , - -[SourceDisksFiles] -Neo_VPN67.sys = 1 - -[DestinationDirs] -DefaultDestDir = 12 -Neo.CopyFiles.Sys = 12 - -[Neo.CopyFiles.Sys] -Neo_VPN67.sys, , , 2 - -[SoftEther] -%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN67 - -[NeoAdapter.Install] -Characteristics = 0x1 -AddReg = Neo.Reg, NeoAdapter.Ndi -CopyFiles = Neo.CopyFiles.Sys -*IfType = 53 -*MediaType = 0 -*PhysicalMediaType = 0 - -[NeoAdapter.Install.Services] -AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% - -[NeoAdapter.Ndi] -HKR, , NetworkAddress, 0, %DefaultAddress% -HKR, Ndi, DeviceID, , "NeoAdapter_VPN67" -HKR, , DevLoader, , ndis -HKR, , DeviceVxDs, , Neo_VPN67.sys -HKR, NDIS, LogDriverName, , "Neo_VPN67" -HKR, NDIS, MajorNdisVersion, 1, 5 -HKR, NDIS, MinorNdisVersion, 1, 0 -HKR, Ndi\Interfaces, DefUpper, , "ndis5" -HKR, Ndi\Interfaces, UpperRange, , "ndis5" -HKR, Ndi\Interfaces, LowerRange, , "ethernet" -HKR, Ndi\Interfaces, DefLower, , "ethernet" -HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" -HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% -HKR, Ndi\Params\NetworkAddress, type, 0, "edit" -HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" -HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" -HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% -HKR, Ndi\Params\NetworkAddress, optional, 0, "0" -HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% -HKR, Ndi\Params\MaxSpeed, type, 0, "int" -HKR, Ndi\Params\MaxSpeed, default, 0, "100" -HKR, Ndi\Params\MaxSpeed, min, 0, "0" -HKR, Ndi\Params\MaxSpeed, max, 0, "2000" -HKR, Ndi\Params\MaxSpeed, step, 0, "1" -HKR, Ndi\Params\MaxSpeed, Base, 0, "10" -HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% -HKR, Ndi\Params\KeepLink, type, 0, "enum" -HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% -HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% -HKR, Ndi\Params\KeepLink, default, 0, "0" - - -[Neo.Service] -DisplayName = %Neo.Service.DispName% -Description = %Neo.Service.Desc% -ServiceType = 1 -StartType = 3 -ErrorControl = 1 -ServiceBinary = %12%\Neo_VPN67.sys -LoadOrderGroup = NDIS - -[Neo.Reg] -HKR, Ndi, Service, 0, Neo.Service.Name -HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" -HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" - -[Neo.EventLog] -HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN67.sys" -HKR, , TypesSupported, 0x00010001, 7 - -[Strings] -CompanyName = "SoftEther Corporation" -DiskDescription = "VPN Client Device Driver Install Disk" -Neo.Service.Name = "Neo_VPN67" -Neo.Service.DispName = "VPN Client Device Driver - VPN67" -Neo.Service.Desc = "VPN Client Adapter - VPN67" -NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN67" -Neo.EventLog.Name = "Neo" -NetworkAddress = "MAC Address" -DefaultAddress = "000001000001" -MaxSpeed = "Indicate Speed (Mbps)" -KeepLink = "Keep Link" -On = "On" -Off = "Off" - - -; Auto Generated 20180205_163608.820 - +; VPN Client Device Driver for Windows 2000 and Greater +; +; Copyright (c) SoftEther Corporation. All Rights Reserved. +; http://www.softether.co.jp/ +; +; BUILD 9658 + +[Version] +Signature = "$Windows NT$" +Class = Net +ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} +Provider = %CompanyName% +DriverVer = 02/04/2018, 4.25.0.9658 +CatalogFile.NT = inf_VPN67.cat + +[Manufacturer] +%CompanyName% = SoftEther + +[SourceDisksNames] +1=%DiskDescription%, "", , + +[SourceDisksFiles] +Neo_VPN67.sys = 1 + +[DestinationDirs] +DefaultDestDir = 12 +Neo.CopyFiles.Sys = 12 + +[Neo.CopyFiles.Sys] +Neo_VPN67.sys, , , 2 + +[SoftEther] +%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN67 + +[NeoAdapter.Install] +Characteristics = 0x1 +AddReg = Neo.Reg, NeoAdapter.Ndi +CopyFiles = Neo.CopyFiles.Sys +*IfType = 53 +*MediaType = 0 +*PhysicalMediaType = 0 + +[NeoAdapter.Install.Services] +AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% + +[NeoAdapter.Ndi] +HKR, , NetworkAddress, 0, %DefaultAddress% +HKR, Ndi, DeviceID, , "NeoAdapter_VPN67" +HKR, , DevLoader, , ndis +HKR, , DeviceVxDs, , Neo_VPN67.sys +HKR, NDIS, LogDriverName, , "Neo_VPN67" +HKR, NDIS, MajorNdisVersion, 1, 5 +HKR, NDIS, MinorNdisVersion, 1, 0 +HKR, Ndi\Interfaces, DefUpper, , "ndis5" +HKR, Ndi\Interfaces, UpperRange, , "ndis5" +HKR, Ndi\Interfaces, LowerRange, , "ethernet" +HKR, Ndi\Interfaces, DefLower, , "ethernet" +HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" +HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% +HKR, Ndi\Params\NetworkAddress, type, 0, "edit" +HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" +HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" +HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% +HKR, Ndi\Params\NetworkAddress, optional, 0, "0" +HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% +HKR, Ndi\Params\MaxSpeed, type, 0, "int" +HKR, Ndi\Params\MaxSpeed, default, 0, "100" +HKR, Ndi\Params\MaxSpeed, min, 0, "0" +HKR, Ndi\Params\MaxSpeed, max, 0, "2000" +HKR, Ndi\Params\MaxSpeed, step, 0, "1" +HKR, Ndi\Params\MaxSpeed, Base, 0, "10" +HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% +HKR, Ndi\Params\KeepLink, type, 0, "enum" +HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% +HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% +HKR, Ndi\Params\KeepLink, default, 0, "0" + + +[Neo.Service] +DisplayName = %Neo.Service.DispName% +Description = %Neo.Service.Desc% +ServiceType = 1 +StartType = 3 +ErrorControl = 1 +ServiceBinary = %12%\Neo_VPN67.sys +LoadOrderGroup = NDIS + +[Neo.Reg] +HKR, Ndi, Service, 0, Neo.Service.Name +HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" +HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" + +[Neo.EventLog] +HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN67.sys" +HKR, , TypesSupported, 0x00010001, 7 + +[Strings] +CompanyName = "SoftEther Corporation" +DiskDescription = "VPN Client Device Driver Install Disk" +Neo.Service.Name = "Neo_VPN67" +Neo.Service.DispName = "VPN Client Device Driver - VPN67" +Neo.Service.Desc = "VPN Client Adapter - VPN67" +NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN67" +Neo.EventLog.Name = "Neo" +NetworkAddress = "MAC Address" +DefaultAddress = "000001000001" +MaxSpeed = "Indicate Speed (Mbps)" +KeepLink = "Keep Link" +On = "On" +Off = "Off" + + +; Auto Generated 20180205_163608.820 + diff --git a/src/bin/hamcore/DriverPackages/Neo6_Win8/x86/Neo6_x86_VPN68.inf b/src/bin/hamcore/DriverPackages/Neo6_Win8/x86/Neo6_x86_VPN68.inf index aeddc38d..4a77016d 100644 --- a/src/bin/hamcore/DriverPackages/Neo6_Win8/x86/Neo6_x86_VPN68.inf +++ b/src/bin/hamcore/DriverPackages/Neo6_Win8/x86/Neo6_x86_VPN68.inf @@ -1,114 +1,114 @@ -; VPN Client Device Driver for Windows 2000 and Greater -; -; Copyright (c) SoftEther Corporation. All Rights Reserved. -; http://www.softether.co.jp/ -; -; BUILD 9658 - -[Version] -Signature = "$Windows NT$" -Class = Net -ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} -Provider = %CompanyName% -DriverVer = 02/04/2018, 4.25.0.9658 -CatalogFile.NT = inf_VPN68.cat - -[Manufacturer] -%CompanyName% = SoftEther - -[SourceDisksNames] -1=%DiskDescription%, "", , - -[SourceDisksFiles] -Neo_VPN68.sys = 1 - -[DestinationDirs] -DefaultDestDir = 12 -Neo.CopyFiles.Sys = 12 - -[Neo.CopyFiles.Sys] -Neo_VPN68.sys, , , 2 - -[SoftEther] -%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN68 - -[NeoAdapter.Install] -Characteristics = 0x1 -AddReg = Neo.Reg, NeoAdapter.Ndi -CopyFiles = Neo.CopyFiles.Sys -*IfType = 53 -*MediaType = 0 -*PhysicalMediaType = 0 - -[NeoAdapter.Install.Services] -AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% - -[NeoAdapter.Ndi] -HKR, , NetworkAddress, 0, %DefaultAddress% -HKR, Ndi, DeviceID, , "NeoAdapter_VPN68" -HKR, , DevLoader, , ndis -HKR, , DeviceVxDs, , Neo_VPN68.sys -HKR, NDIS, LogDriverName, , "Neo_VPN68" -HKR, NDIS, MajorNdisVersion, 1, 5 -HKR, NDIS, MinorNdisVersion, 1, 0 -HKR, Ndi\Interfaces, DefUpper, , "ndis5" -HKR, Ndi\Interfaces, UpperRange, , "ndis5" -HKR, Ndi\Interfaces, LowerRange, , "ethernet" -HKR, Ndi\Interfaces, DefLower, , "ethernet" -HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" -HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% -HKR, Ndi\Params\NetworkAddress, type, 0, "edit" -HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" -HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" -HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% -HKR, Ndi\Params\NetworkAddress, optional, 0, "0" -HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% -HKR, Ndi\Params\MaxSpeed, type, 0, "int" -HKR, Ndi\Params\MaxSpeed, default, 0, "100" -HKR, Ndi\Params\MaxSpeed, min, 0, "0" -HKR, Ndi\Params\MaxSpeed, max, 0, "2000" -HKR, Ndi\Params\MaxSpeed, step, 0, "1" -HKR, Ndi\Params\MaxSpeed, Base, 0, "10" -HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% -HKR, Ndi\Params\KeepLink, type, 0, "enum" -HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% -HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% -HKR, Ndi\Params\KeepLink, default, 0, "0" - - -[Neo.Service] -DisplayName = %Neo.Service.DispName% -Description = %Neo.Service.Desc% -ServiceType = 1 -StartType = 3 -ErrorControl = 1 -ServiceBinary = %12%\Neo_VPN68.sys -LoadOrderGroup = NDIS - -[Neo.Reg] -HKR, Ndi, Service, 0, Neo.Service.Name -HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" -HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" - -[Neo.EventLog] -HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN68.sys" -HKR, , TypesSupported, 0x00010001, 7 - -[Strings] -CompanyName = "SoftEther Corporation" -DiskDescription = "VPN Client Device Driver Install Disk" -Neo.Service.Name = "Neo_VPN68" -Neo.Service.DispName = "VPN Client Device Driver - VPN68" -Neo.Service.Desc = "VPN Client Adapter - VPN68" -NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN68" -Neo.EventLog.Name = "Neo" -NetworkAddress = "MAC Address" -DefaultAddress = "000001000001" -MaxSpeed = "Indicate Speed (Mbps)" -KeepLink = "Keep Link" -On = "On" -Off = "Off" - - -; Auto Generated 20180205_163608.821 - +; VPN Client Device Driver for Windows 2000 and Greater +; +; Copyright (c) SoftEther Corporation. All Rights Reserved. +; http://www.softether.co.jp/ +; +; BUILD 9658 + +[Version] +Signature = "$Windows NT$" +Class = Net +ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} +Provider = %CompanyName% +DriverVer = 02/04/2018, 4.25.0.9658 +CatalogFile.NT = inf_VPN68.cat + +[Manufacturer] +%CompanyName% = SoftEther + +[SourceDisksNames] +1=%DiskDescription%, "", , + +[SourceDisksFiles] +Neo_VPN68.sys = 1 + +[DestinationDirs] +DefaultDestDir = 12 +Neo.CopyFiles.Sys = 12 + +[Neo.CopyFiles.Sys] +Neo_VPN68.sys, , , 2 + +[SoftEther] +%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN68 + +[NeoAdapter.Install] +Characteristics = 0x1 +AddReg = Neo.Reg, NeoAdapter.Ndi +CopyFiles = Neo.CopyFiles.Sys +*IfType = 53 +*MediaType = 0 +*PhysicalMediaType = 0 + +[NeoAdapter.Install.Services] +AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% + +[NeoAdapter.Ndi] +HKR, , NetworkAddress, 0, %DefaultAddress% +HKR, Ndi, DeviceID, , "NeoAdapter_VPN68" +HKR, , DevLoader, , ndis +HKR, , DeviceVxDs, , Neo_VPN68.sys +HKR, NDIS, LogDriverName, , "Neo_VPN68" +HKR, NDIS, MajorNdisVersion, 1, 5 +HKR, NDIS, MinorNdisVersion, 1, 0 +HKR, Ndi\Interfaces, DefUpper, , "ndis5" +HKR, Ndi\Interfaces, UpperRange, , "ndis5" +HKR, Ndi\Interfaces, LowerRange, , "ethernet" +HKR, Ndi\Interfaces, DefLower, , "ethernet" +HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" +HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% +HKR, Ndi\Params\NetworkAddress, type, 0, "edit" +HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" +HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" +HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% +HKR, Ndi\Params\NetworkAddress, optional, 0, "0" +HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% +HKR, Ndi\Params\MaxSpeed, type, 0, "int" +HKR, Ndi\Params\MaxSpeed, default, 0, "100" +HKR, Ndi\Params\MaxSpeed, min, 0, "0" +HKR, Ndi\Params\MaxSpeed, max, 0, "2000" +HKR, Ndi\Params\MaxSpeed, step, 0, "1" +HKR, Ndi\Params\MaxSpeed, Base, 0, "10" +HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% +HKR, Ndi\Params\KeepLink, type, 0, "enum" +HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% +HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% +HKR, Ndi\Params\KeepLink, default, 0, "0" + + +[Neo.Service] +DisplayName = %Neo.Service.DispName% +Description = %Neo.Service.Desc% +ServiceType = 1 +StartType = 3 +ErrorControl = 1 +ServiceBinary = %12%\Neo_VPN68.sys +LoadOrderGroup = NDIS + +[Neo.Reg] +HKR, Ndi, Service, 0, Neo.Service.Name +HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" +HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" + +[Neo.EventLog] +HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN68.sys" +HKR, , TypesSupported, 0x00010001, 7 + +[Strings] +CompanyName = "SoftEther Corporation" +DiskDescription = "VPN Client Device Driver Install Disk" +Neo.Service.Name = "Neo_VPN68" +Neo.Service.DispName = "VPN Client Device Driver - VPN68" +Neo.Service.Desc = "VPN Client Adapter - VPN68" +NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN68" +Neo.EventLog.Name = "Neo" +NetworkAddress = "MAC Address" +DefaultAddress = "000001000001" +MaxSpeed = "Indicate Speed (Mbps)" +KeepLink = "Keep Link" +On = "On" +Off = "Off" + + +; Auto Generated 20180205_163608.821 + diff --git a/src/bin/hamcore/DriverPackages/Neo6_Win8/x86/Neo6_x86_VPN69.inf b/src/bin/hamcore/DriverPackages/Neo6_Win8/x86/Neo6_x86_VPN69.inf index 66359f85..bdff367d 100644 --- a/src/bin/hamcore/DriverPackages/Neo6_Win8/x86/Neo6_x86_VPN69.inf +++ b/src/bin/hamcore/DriverPackages/Neo6_Win8/x86/Neo6_x86_VPN69.inf @@ -1,114 +1,114 @@ -; VPN Client Device Driver for Windows 2000 and Greater -; -; Copyright (c) SoftEther Corporation. All Rights Reserved. -; http://www.softether.co.jp/ -; -; BUILD 9658 - -[Version] -Signature = "$Windows NT$" -Class = Net -ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} -Provider = %CompanyName% -DriverVer = 02/04/2018, 4.25.0.9658 -CatalogFile.NT = inf_VPN69.cat - -[Manufacturer] -%CompanyName% = SoftEther - -[SourceDisksNames] -1=%DiskDescription%, "", , - -[SourceDisksFiles] -Neo_VPN69.sys = 1 - -[DestinationDirs] -DefaultDestDir = 12 -Neo.CopyFiles.Sys = 12 - -[Neo.CopyFiles.Sys] -Neo_VPN69.sys, , , 2 - -[SoftEther] -%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN69 - -[NeoAdapter.Install] -Characteristics = 0x1 -AddReg = Neo.Reg, NeoAdapter.Ndi -CopyFiles = Neo.CopyFiles.Sys -*IfType = 53 -*MediaType = 0 -*PhysicalMediaType = 0 - -[NeoAdapter.Install.Services] -AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% - -[NeoAdapter.Ndi] -HKR, , NetworkAddress, 0, %DefaultAddress% -HKR, Ndi, DeviceID, , "NeoAdapter_VPN69" -HKR, , DevLoader, , ndis -HKR, , DeviceVxDs, , Neo_VPN69.sys -HKR, NDIS, LogDriverName, , "Neo_VPN69" -HKR, NDIS, MajorNdisVersion, 1, 5 -HKR, NDIS, MinorNdisVersion, 1, 0 -HKR, Ndi\Interfaces, DefUpper, , "ndis5" -HKR, Ndi\Interfaces, UpperRange, , "ndis5" -HKR, Ndi\Interfaces, LowerRange, , "ethernet" -HKR, Ndi\Interfaces, DefLower, , "ethernet" -HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" -HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% -HKR, Ndi\Params\NetworkAddress, type, 0, "edit" -HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" -HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" -HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% -HKR, Ndi\Params\NetworkAddress, optional, 0, "0" -HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% -HKR, Ndi\Params\MaxSpeed, type, 0, "int" -HKR, Ndi\Params\MaxSpeed, default, 0, "100" -HKR, Ndi\Params\MaxSpeed, min, 0, "0" -HKR, Ndi\Params\MaxSpeed, max, 0, "2000" -HKR, Ndi\Params\MaxSpeed, step, 0, "1" -HKR, Ndi\Params\MaxSpeed, Base, 0, "10" -HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% -HKR, Ndi\Params\KeepLink, type, 0, "enum" -HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% -HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% -HKR, Ndi\Params\KeepLink, default, 0, "0" - - -[Neo.Service] -DisplayName = %Neo.Service.DispName% -Description = %Neo.Service.Desc% -ServiceType = 1 -StartType = 3 -ErrorControl = 1 -ServiceBinary = %12%\Neo_VPN69.sys -LoadOrderGroup = NDIS - -[Neo.Reg] -HKR, Ndi, Service, 0, Neo.Service.Name -HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" -HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" - -[Neo.EventLog] -HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN69.sys" -HKR, , TypesSupported, 0x00010001, 7 - -[Strings] -CompanyName = "SoftEther Corporation" -DiskDescription = "VPN Client Device Driver Install Disk" -Neo.Service.Name = "Neo_VPN69" -Neo.Service.DispName = "VPN Client Device Driver - VPN69" -Neo.Service.Desc = "VPN Client Adapter - VPN69" -NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN69" -Neo.EventLog.Name = "Neo" -NetworkAddress = "MAC Address" -DefaultAddress = "000001000001" -MaxSpeed = "Indicate Speed (Mbps)" -KeepLink = "Keep Link" -On = "On" -Off = "Off" - - -; Auto Generated 20180205_163608.822 - +; VPN Client Device Driver for Windows 2000 and Greater +; +; Copyright (c) SoftEther Corporation. All Rights Reserved. +; http://www.softether.co.jp/ +; +; BUILD 9658 + +[Version] +Signature = "$Windows NT$" +Class = Net +ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} +Provider = %CompanyName% +DriverVer = 02/04/2018, 4.25.0.9658 +CatalogFile.NT = inf_VPN69.cat + +[Manufacturer] +%CompanyName% = SoftEther + +[SourceDisksNames] +1=%DiskDescription%, "", , + +[SourceDisksFiles] +Neo_VPN69.sys = 1 + +[DestinationDirs] +DefaultDestDir = 12 +Neo.CopyFiles.Sys = 12 + +[Neo.CopyFiles.Sys] +Neo_VPN69.sys, , , 2 + +[SoftEther] +%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN69 + +[NeoAdapter.Install] +Characteristics = 0x1 +AddReg = Neo.Reg, NeoAdapter.Ndi +CopyFiles = Neo.CopyFiles.Sys +*IfType = 53 +*MediaType = 0 +*PhysicalMediaType = 0 + +[NeoAdapter.Install.Services] +AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% + +[NeoAdapter.Ndi] +HKR, , NetworkAddress, 0, %DefaultAddress% +HKR, Ndi, DeviceID, , "NeoAdapter_VPN69" +HKR, , DevLoader, , ndis +HKR, , DeviceVxDs, , Neo_VPN69.sys +HKR, NDIS, LogDriverName, , "Neo_VPN69" +HKR, NDIS, MajorNdisVersion, 1, 5 +HKR, NDIS, MinorNdisVersion, 1, 0 +HKR, Ndi\Interfaces, DefUpper, , "ndis5" +HKR, Ndi\Interfaces, UpperRange, , "ndis5" +HKR, Ndi\Interfaces, LowerRange, , "ethernet" +HKR, Ndi\Interfaces, DefLower, , "ethernet" +HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" +HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% +HKR, Ndi\Params\NetworkAddress, type, 0, "edit" +HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" +HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" +HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% +HKR, Ndi\Params\NetworkAddress, optional, 0, "0" +HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% +HKR, Ndi\Params\MaxSpeed, type, 0, "int" +HKR, Ndi\Params\MaxSpeed, default, 0, "100" +HKR, Ndi\Params\MaxSpeed, min, 0, "0" +HKR, Ndi\Params\MaxSpeed, max, 0, "2000" +HKR, Ndi\Params\MaxSpeed, step, 0, "1" +HKR, Ndi\Params\MaxSpeed, Base, 0, "10" +HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% +HKR, Ndi\Params\KeepLink, type, 0, "enum" +HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% +HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% +HKR, Ndi\Params\KeepLink, default, 0, "0" + + +[Neo.Service] +DisplayName = %Neo.Service.DispName% +Description = %Neo.Service.Desc% +ServiceType = 1 +StartType = 3 +ErrorControl = 1 +ServiceBinary = %12%\Neo_VPN69.sys +LoadOrderGroup = NDIS + +[Neo.Reg] +HKR, Ndi, Service, 0, Neo.Service.Name +HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" +HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" + +[Neo.EventLog] +HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN69.sys" +HKR, , TypesSupported, 0x00010001, 7 + +[Strings] +CompanyName = "SoftEther Corporation" +DiskDescription = "VPN Client Device Driver Install Disk" +Neo.Service.Name = "Neo_VPN69" +Neo.Service.DispName = "VPN Client Device Driver - VPN69" +Neo.Service.Desc = "VPN Client Adapter - VPN69" +NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN69" +Neo.EventLog.Name = "Neo" +NetworkAddress = "MAC Address" +DefaultAddress = "000001000001" +MaxSpeed = "Indicate Speed (Mbps)" +KeepLink = "Keep Link" +On = "On" +Off = "Off" + + +; Auto Generated 20180205_163608.822 + diff --git a/src/bin/hamcore/DriverPackages/Neo6_Win8/x86/Neo6_x86_VPN7.inf b/src/bin/hamcore/DriverPackages/Neo6_Win8/x86/Neo6_x86_VPN7.inf index ff6bd79b..53e4945e 100644 --- a/src/bin/hamcore/DriverPackages/Neo6_Win8/x86/Neo6_x86_VPN7.inf +++ b/src/bin/hamcore/DriverPackages/Neo6_Win8/x86/Neo6_x86_VPN7.inf @@ -1,114 +1,114 @@ -; VPN Client Device Driver for Windows 2000 and Greater -; -; Copyright (c) SoftEther Corporation. All Rights Reserved. -; http://www.softether.co.jp/ -; -; BUILD 9658 - -[Version] -Signature = "$Windows NT$" -Class = Net -ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} -Provider = %CompanyName% -DriverVer = 02/04/2018, 4.25.0.9658 -CatalogFile.NT = inf_VPN7.cat - -[Manufacturer] -%CompanyName% = SoftEther - -[SourceDisksNames] -1=%DiskDescription%, "", , - -[SourceDisksFiles] -Neo_VPN7.sys = 1 - -[DestinationDirs] -DefaultDestDir = 12 -Neo.CopyFiles.Sys = 12 - -[Neo.CopyFiles.Sys] -Neo_VPN7.sys, , , 2 - -[SoftEther] -%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN7 - -[NeoAdapter.Install] -Characteristics = 0x1 -AddReg = Neo.Reg, NeoAdapter.Ndi -CopyFiles = Neo.CopyFiles.Sys -*IfType = 53 -*MediaType = 0 -*PhysicalMediaType = 0 - -[NeoAdapter.Install.Services] -AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% - -[NeoAdapter.Ndi] -HKR, , NetworkAddress, 0, %DefaultAddress% -HKR, Ndi, DeviceID, , "NeoAdapter_VPN7" -HKR, , DevLoader, , ndis -HKR, , DeviceVxDs, , Neo_VPN7.sys -HKR, NDIS, LogDriverName, , "Neo_VPN7" -HKR, NDIS, MajorNdisVersion, 1, 5 -HKR, NDIS, MinorNdisVersion, 1, 0 -HKR, Ndi\Interfaces, DefUpper, , "ndis5" -HKR, Ndi\Interfaces, UpperRange, , "ndis5" -HKR, Ndi\Interfaces, LowerRange, , "ethernet" -HKR, Ndi\Interfaces, DefLower, , "ethernet" -HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" -HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% -HKR, Ndi\Params\NetworkAddress, type, 0, "edit" -HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" -HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" -HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% -HKR, Ndi\Params\NetworkAddress, optional, 0, "0" -HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% -HKR, Ndi\Params\MaxSpeed, type, 0, "int" -HKR, Ndi\Params\MaxSpeed, default, 0, "100" -HKR, Ndi\Params\MaxSpeed, min, 0, "0" -HKR, Ndi\Params\MaxSpeed, max, 0, "2000" -HKR, Ndi\Params\MaxSpeed, step, 0, "1" -HKR, Ndi\Params\MaxSpeed, Base, 0, "10" -HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% -HKR, Ndi\Params\KeepLink, type, 0, "enum" -HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% -HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% -HKR, Ndi\Params\KeepLink, default, 0, "0" - - -[Neo.Service] -DisplayName = %Neo.Service.DispName% -Description = %Neo.Service.Desc% -ServiceType = 1 -StartType = 3 -ErrorControl = 1 -ServiceBinary = %12%\Neo_VPN7.sys -LoadOrderGroup = NDIS - -[Neo.Reg] -HKR, Ndi, Service, 0, Neo.Service.Name -HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" -HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" - -[Neo.EventLog] -HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN7.sys" -HKR, , TypesSupported, 0x00010001, 7 - -[Strings] -CompanyName = "SoftEther Corporation" -DiskDescription = "VPN Client Device Driver Install Disk" -Neo.Service.Name = "Neo_VPN7" -Neo.Service.DispName = "VPN Client Device Driver - VPN7" -Neo.Service.Desc = "VPN Client Adapter - VPN7" -NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN7" -Neo.EventLog.Name = "Neo" -NetworkAddress = "MAC Address" -DefaultAddress = "000001000001" -MaxSpeed = "Indicate Speed (Mbps)" -KeepLink = "Keep Link" -On = "On" -Off = "Off" - - -; Auto Generated 20180205_163608.755 - +; VPN Client Device Driver for Windows 2000 and Greater +; +; Copyright (c) SoftEther Corporation. All Rights Reserved. +; http://www.softether.co.jp/ +; +; BUILD 9658 + +[Version] +Signature = "$Windows NT$" +Class = Net +ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} +Provider = %CompanyName% +DriverVer = 02/04/2018, 4.25.0.9658 +CatalogFile.NT = inf_VPN7.cat + +[Manufacturer] +%CompanyName% = SoftEther + +[SourceDisksNames] +1=%DiskDescription%, "", , + +[SourceDisksFiles] +Neo_VPN7.sys = 1 + +[DestinationDirs] +DefaultDestDir = 12 +Neo.CopyFiles.Sys = 12 + +[Neo.CopyFiles.Sys] +Neo_VPN7.sys, , , 2 + +[SoftEther] +%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN7 + +[NeoAdapter.Install] +Characteristics = 0x1 +AddReg = Neo.Reg, NeoAdapter.Ndi +CopyFiles = Neo.CopyFiles.Sys +*IfType = 53 +*MediaType = 0 +*PhysicalMediaType = 0 + +[NeoAdapter.Install.Services] +AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% + +[NeoAdapter.Ndi] +HKR, , NetworkAddress, 0, %DefaultAddress% +HKR, Ndi, DeviceID, , "NeoAdapter_VPN7" +HKR, , DevLoader, , ndis +HKR, , DeviceVxDs, , Neo_VPN7.sys +HKR, NDIS, LogDriverName, , "Neo_VPN7" +HKR, NDIS, MajorNdisVersion, 1, 5 +HKR, NDIS, MinorNdisVersion, 1, 0 +HKR, Ndi\Interfaces, DefUpper, , "ndis5" +HKR, Ndi\Interfaces, UpperRange, , "ndis5" +HKR, Ndi\Interfaces, LowerRange, , "ethernet" +HKR, Ndi\Interfaces, DefLower, , "ethernet" +HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" +HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% +HKR, Ndi\Params\NetworkAddress, type, 0, "edit" +HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" +HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" +HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% +HKR, Ndi\Params\NetworkAddress, optional, 0, "0" +HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% +HKR, Ndi\Params\MaxSpeed, type, 0, "int" +HKR, Ndi\Params\MaxSpeed, default, 0, "100" +HKR, Ndi\Params\MaxSpeed, min, 0, "0" +HKR, Ndi\Params\MaxSpeed, max, 0, "2000" +HKR, Ndi\Params\MaxSpeed, step, 0, "1" +HKR, Ndi\Params\MaxSpeed, Base, 0, "10" +HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% +HKR, Ndi\Params\KeepLink, type, 0, "enum" +HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% +HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% +HKR, Ndi\Params\KeepLink, default, 0, "0" + + +[Neo.Service] +DisplayName = %Neo.Service.DispName% +Description = %Neo.Service.Desc% +ServiceType = 1 +StartType = 3 +ErrorControl = 1 +ServiceBinary = %12%\Neo_VPN7.sys +LoadOrderGroup = NDIS + +[Neo.Reg] +HKR, Ndi, Service, 0, Neo.Service.Name +HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" +HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" + +[Neo.EventLog] +HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN7.sys" +HKR, , TypesSupported, 0x00010001, 7 + +[Strings] +CompanyName = "SoftEther Corporation" +DiskDescription = "VPN Client Device Driver Install Disk" +Neo.Service.Name = "Neo_VPN7" +Neo.Service.DispName = "VPN Client Device Driver - VPN7" +Neo.Service.Desc = "VPN Client Adapter - VPN7" +NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN7" +Neo.EventLog.Name = "Neo" +NetworkAddress = "MAC Address" +DefaultAddress = "000001000001" +MaxSpeed = "Indicate Speed (Mbps)" +KeepLink = "Keep Link" +On = "On" +Off = "Off" + + +; Auto Generated 20180205_163608.755 + diff --git a/src/bin/hamcore/DriverPackages/Neo6_Win8/x86/Neo6_x86_VPN70.inf b/src/bin/hamcore/DriverPackages/Neo6_Win8/x86/Neo6_x86_VPN70.inf index 931d5a08..22bb0008 100644 --- a/src/bin/hamcore/DriverPackages/Neo6_Win8/x86/Neo6_x86_VPN70.inf +++ b/src/bin/hamcore/DriverPackages/Neo6_Win8/x86/Neo6_x86_VPN70.inf @@ -1,114 +1,114 @@ -; VPN Client Device Driver for Windows 2000 and Greater -; -; Copyright (c) SoftEther Corporation. All Rights Reserved. -; http://www.softether.co.jp/ -; -; BUILD 9658 - -[Version] -Signature = "$Windows NT$" -Class = Net -ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} -Provider = %CompanyName% -DriverVer = 02/04/2018, 4.25.0.9658 -CatalogFile.NT = inf_VPN70.cat - -[Manufacturer] -%CompanyName% = SoftEther - -[SourceDisksNames] -1=%DiskDescription%, "", , - -[SourceDisksFiles] -Neo_VPN70.sys = 1 - -[DestinationDirs] -DefaultDestDir = 12 -Neo.CopyFiles.Sys = 12 - -[Neo.CopyFiles.Sys] -Neo_VPN70.sys, , , 2 - -[SoftEther] -%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN70 - -[NeoAdapter.Install] -Characteristics = 0x1 -AddReg = Neo.Reg, NeoAdapter.Ndi -CopyFiles = Neo.CopyFiles.Sys -*IfType = 53 -*MediaType = 0 -*PhysicalMediaType = 0 - -[NeoAdapter.Install.Services] -AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% - -[NeoAdapter.Ndi] -HKR, , NetworkAddress, 0, %DefaultAddress% -HKR, Ndi, DeviceID, , "NeoAdapter_VPN70" -HKR, , DevLoader, , ndis -HKR, , DeviceVxDs, , Neo_VPN70.sys -HKR, NDIS, LogDriverName, , "Neo_VPN70" -HKR, NDIS, MajorNdisVersion, 1, 5 -HKR, NDIS, MinorNdisVersion, 1, 0 -HKR, Ndi\Interfaces, DefUpper, , "ndis5" -HKR, Ndi\Interfaces, UpperRange, , "ndis5" -HKR, Ndi\Interfaces, LowerRange, , "ethernet" -HKR, Ndi\Interfaces, DefLower, , "ethernet" -HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" -HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% -HKR, Ndi\Params\NetworkAddress, type, 0, "edit" -HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" -HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" -HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% -HKR, Ndi\Params\NetworkAddress, optional, 0, "0" -HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% -HKR, Ndi\Params\MaxSpeed, type, 0, "int" -HKR, Ndi\Params\MaxSpeed, default, 0, "100" -HKR, Ndi\Params\MaxSpeed, min, 0, "0" -HKR, Ndi\Params\MaxSpeed, max, 0, "2000" -HKR, Ndi\Params\MaxSpeed, step, 0, "1" -HKR, Ndi\Params\MaxSpeed, Base, 0, "10" -HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% -HKR, Ndi\Params\KeepLink, type, 0, "enum" -HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% -HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% -HKR, Ndi\Params\KeepLink, default, 0, "0" - - -[Neo.Service] -DisplayName = %Neo.Service.DispName% -Description = %Neo.Service.Desc% -ServiceType = 1 -StartType = 3 -ErrorControl = 1 -ServiceBinary = %12%\Neo_VPN70.sys -LoadOrderGroup = NDIS - -[Neo.Reg] -HKR, Ndi, Service, 0, Neo.Service.Name -HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" -HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" - -[Neo.EventLog] -HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN70.sys" -HKR, , TypesSupported, 0x00010001, 7 - -[Strings] -CompanyName = "SoftEther Corporation" -DiskDescription = "VPN Client Device Driver Install Disk" -Neo.Service.Name = "Neo_VPN70" -Neo.Service.DispName = "VPN Client Device Driver - VPN70" -Neo.Service.Desc = "VPN Client Adapter - VPN70" -NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN70" -Neo.EventLog.Name = "Neo" -NetworkAddress = "MAC Address" -DefaultAddress = "000001000001" -MaxSpeed = "Indicate Speed (Mbps)" -KeepLink = "Keep Link" -On = "On" -Off = "Off" - - -; Auto Generated 20180205_163608.823 - +; VPN Client Device Driver for Windows 2000 and Greater +; +; Copyright (c) SoftEther Corporation. All Rights Reserved. +; http://www.softether.co.jp/ +; +; BUILD 9658 + +[Version] +Signature = "$Windows NT$" +Class = Net +ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} +Provider = %CompanyName% +DriverVer = 02/04/2018, 4.25.0.9658 +CatalogFile.NT = inf_VPN70.cat + +[Manufacturer] +%CompanyName% = SoftEther + +[SourceDisksNames] +1=%DiskDescription%, "", , + +[SourceDisksFiles] +Neo_VPN70.sys = 1 + +[DestinationDirs] +DefaultDestDir = 12 +Neo.CopyFiles.Sys = 12 + +[Neo.CopyFiles.Sys] +Neo_VPN70.sys, , , 2 + +[SoftEther] +%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN70 + +[NeoAdapter.Install] +Characteristics = 0x1 +AddReg = Neo.Reg, NeoAdapter.Ndi +CopyFiles = Neo.CopyFiles.Sys +*IfType = 53 +*MediaType = 0 +*PhysicalMediaType = 0 + +[NeoAdapter.Install.Services] +AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% + +[NeoAdapter.Ndi] +HKR, , NetworkAddress, 0, %DefaultAddress% +HKR, Ndi, DeviceID, , "NeoAdapter_VPN70" +HKR, , DevLoader, , ndis +HKR, , DeviceVxDs, , Neo_VPN70.sys +HKR, NDIS, LogDriverName, , "Neo_VPN70" +HKR, NDIS, MajorNdisVersion, 1, 5 +HKR, NDIS, MinorNdisVersion, 1, 0 +HKR, Ndi\Interfaces, DefUpper, , "ndis5" +HKR, Ndi\Interfaces, UpperRange, , "ndis5" +HKR, Ndi\Interfaces, LowerRange, , "ethernet" +HKR, Ndi\Interfaces, DefLower, , "ethernet" +HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" +HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% +HKR, Ndi\Params\NetworkAddress, type, 0, "edit" +HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" +HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" +HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% +HKR, Ndi\Params\NetworkAddress, optional, 0, "0" +HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% +HKR, Ndi\Params\MaxSpeed, type, 0, "int" +HKR, Ndi\Params\MaxSpeed, default, 0, "100" +HKR, Ndi\Params\MaxSpeed, min, 0, "0" +HKR, Ndi\Params\MaxSpeed, max, 0, "2000" +HKR, Ndi\Params\MaxSpeed, step, 0, "1" +HKR, Ndi\Params\MaxSpeed, Base, 0, "10" +HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% +HKR, Ndi\Params\KeepLink, type, 0, "enum" +HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% +HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% +HKR, Ndi\Params\KeepLink, default, 0, "0" + + +[Neo.Service] +DisplayName = %Neo.Service.DispName% +Description = %Neo.Service.Desc% +ServiceType = 1 +StartType = 3 +ErrorControl = 1 +ServiceBinary = %12%\Neo_VPN70.sys +LoadOrderGroup = NDIS + +[Neo.Reg] +HKR, Ndi, Service, 0, Neo.Service.Name +HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" +HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" + +[Neo.EventLog] +HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN70.sys" +HKR, , TypesSupported, 0x00010001, 7 + +[Strings] +CompanyName = "SoftEther Corporation" +DiskDescription = "VPN Client Device Driver Install Disk" +Neo.Service.Name = "Neo_VPN70" +Neo.Service.DispName = "VPN Client Device Driver - VPN70" +Neo.Service.Desc = "VPN Client Adapter - VPN70" +NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN70" +Neo.EventLog.Name = "Neo" +NetworkAddress = "MAC Address" +DefaultAddress = "000001000001" +MaxSpeed = "Indicate Speed (Mbps)" +KeepLink = "Keep Link" +On = "On" +Off = "Off" + + +; Auto Generated 20180205_163608.823 + diff --git a/src/bin/hamcore/DriverPackages/Neo6_Win8/x86/Neo6_x86_VPN71.inf b/src/bin/hamcore/DriverPackages/Neo6_Win8/x86/Neo6_x86_VPN71.inf index 662d5816..7d7f415b 100644 --- a/src/bin/hamcore/DriverPackages/Neo6_Win8/x86/Neo6_x86_VPN71.inf +++ b/src/bin/hamcore/DriverPackages/Neo6_Win8/x86/Neo6_x86_VPN71.inf @@ -1,114 +1,114 @@ -; VPN Client Device Driver for Windows 2000 and Greater -; -; Copyright (c) SoftEther Corporation. All Rights Reserved. -; http://www.softether.co.jp/ -; -; BUILD 9658 - -[Version] -Signature = "$Windows NT$" -Class = Net -ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} -Provider = %CompanyName% -DriverVer = 02/04/2018, 4.25.0.9658 -CatalogFile.NT = inf_VPN71.cat - -[Manufacturer] -%CompanyName% = SoftEther - -[SourceDisksNames] -1=%DiskDescription%, "", , - -[SourceDisksFiles] -Neo_VPN71.sys = 1 - -[DestinationDirs] -DefaultDestDir = 12 -Neo.CopyFiles.Sys = 12 - -[Neo.CopyFiles.Sys] -Neo_VPN71.sys, , , 2 - -[SoftEther] -%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN71 - -[NeoAdapter.Install] -Characteristics = 0x1 -AddReg = Neo.Reg, NeoAdapter.Ndi -CopyFiles = Neo.CopyFiles.Sys -*IfType = 53 -*MediaType = 0 -*PhysicalMediaType = 0 - -[NeoAdapter.Install.Services] -AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% - -[NeoAdapter.Ndi] -HKR, , NetworkAddress, 0, %DefaultAddress% -HKR, Ndi, DeviceID, , "NeoAdapter_VPN71" -HKR, , DevLoader, , ndis -HKR, , DeviceVxDs, , Neo_VPN71.sys -HKR, NDIS, LogDriverName, , "Neo_VPN71" -HKR, NDIS, MajorNdisVersion, 1, 5 -HKR, NDIS, MinorNdisVersion, 1, 0 -HKR, Ndi\Interfaces, DefUpper, , "ndis5" -HKR, Ndi\Interfaces, UpperRange, , "ndis5" -HKR, Ndi\Interfaces, LowerRange, , "ethernet" -HKR, Ndi\Interfaces, DefLower, , "ethernet" -HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" -HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% -HKR, Ndi\Params\NetworkAddress, type, 0, "edit" -HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" -HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" -HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% -HKR, Ndi\Params\NetworkAddress, optional, 0, "0" -HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% -HKR, Ndi\Params\MaxSpeed, type, 0, "int" -HKR, Ndi\Params\MaxSpeed, default, 0, "100" -HKR, Ndi\Params\MaxSpeed, min, 0, "0" -HKR, Ndi\Params\MaxSpeed, max, 0, "2000" -HKR, Ndi\Params\MaxSpeed, step, 0, "1" -HKR, Ndi\Params\MaxSpeed, Base, 0, "10" -HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% -HKR, Ndi\Params\KeepLink, type, 0, "enum" -HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% -HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% -HKR, Ndi\Params\KeepLink, default, 0, "0" - - -[Neo.Service] -DisplayName = %Neo.Service.DispName% -Description = %Neo.Service.Desc% -ServiceType = 1 -StartType = 3 -ErrorControl = 1 -ServiceBinary = %12%\Neo_VPN71.sys -LoadOrderGroup = NDIS - -[Neo.Reg] -HKR, Ndi, Service, 0, Neo.Service.Name -HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" -HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" - -[Neo.EventLog] -HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN71.sys" -HKR, , TypesSupported, 0x00010001, 7 - -[Strings] -CompanyName = "SoftEther Corporation" -DiskDescription = "VPN Client Device Driver Install Disk" -Neo.Service.Name = "Neo_VPN71" -Neo.Service.DispName = "VPN Client Device Driver - VPN71" -Neo.Service.Desc = "VPN Client Adapter - VPN71" -NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN71" -Neo.EventLog.Name = "Neo" -NetworkAddress = "MAC Address" -DefaultAddress = "000001000001" -MaxSpeed = "Indicate Speed (Mbps)" -KeepLink = "Keep Link" -On = "On" -Off = "Off" - - -; Auto Generated 20180205_163608.826 - +; VPN Client Device Driver for Windows 2000 and Greater +; +; Copyright (c) SoftEther Corporation. All Rights Reserved. +; http://www.softether.co.jp/ +; +; BUILD 9658 + +[Version] +Signature = "$Windows NT$" +Class = Net +ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} +Provider = %CompanyName% +DriverVer = 02/04/2018, 4.25.0.9658 +CatalogFile.NT = inf_VPN71.cat + +[Manufacturer] +%CompanyName% = SoftEther + +[SourceDisksNames] +1=%DiskDescription%, "", , + +[SourceDisksFiles] +Neo_VPN71.sys = 1 + +[DestinationDirs] +DefaultDestDir = 12 +Neo.CopyFiles.Sys = 12 + +[Neo.CopyFiles.Sys] +Neo_VPN71.sys, , , 2 + +[SoftEther] +%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN71 + +[NeoAdapter.Install] +Characteristics = 0x1 +AddReg = Neo.Reg, NeoAdapter.Ndi +CopyFiles = Neo.CopyFiles.Sys +*IfType = 53 +*MediaType = 0 +*PhysicalMediaType = 0 + +[NeoAdapter.Install.Services] +AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% + +[NeoAdapter.Ndi] +HKR, , NetworkAddress, 0, %DefaultAddress% +HKR, Ndi, DeviceID, , "NeoAdapter_VPN71" +HKR, , DevLoader, , ndis +HKR, , DeviceVxDs, , Neo_VPN71.sys +HKR, NDIS, LogDriverName, , "Neo_VPN71" +HKR, NDIS, MajorNdisVersion, 1, 5 +HKR, NDIS, MinorNdisVersion, 1, 0 +HKR, Ndi\Interfaces, DefUpper, , "ndis5" +HKR, Ndi\Interfaces, UpperRange, , "ndis5" +HKR, Ndi\Interfaces, LowerRange, , "ethernet" +HKR, Ndi\Interfaces, DefLower, , "ethernet" +HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" +HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% +HKR, Ndi\Params\NetworkAddress, type, 0, "edit" +HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" +HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" +HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% +HKR, Ndi\Params\NetworkAddress, optional, 0, "0" +HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% +HKR, Ndi\Params\MaxSpeed, type, 0, "int" +HKR, Ndi\Params\MaxSpeed, default, 0, "100" +HKR, Ndi\Params\MaxSpeed, min, 0, "0" +HKR, Ndi\Params\MaxSpeed, max, 0, "2000" +HKR, Ndi\Params\MaxSpeed, step, 0, "1" +HKR, Ndi\Params\MaxSpeed, Base, 0, "10" +HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% +HKR, Ndi\Params\KeepLink, type, 0, "enum" +HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% +HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% +HKR, Ndi\Params\KeepLink, default, 0, "0" + + +[Neo.Service] +DisplayName = %Neo.Service.DispName% +Description = %Neo.Service.Desc% +ServiceType = 1 +StartType = 3 +ErrorControl = 1 +ServiceBinary = %12%\Neo_VPN71.sys +LoadOrderGroup = NDIS + +[Neo.Reg] +HKR, Ndi, Service, 0, Neo.Service.Name +HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" +HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" + +[Neo.EventLog] +HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN71.sys" +HKR, , TypesSupported, 0x00010001, 7 + +[Strings] +CompanyName = "SoftEther Corporation" +DiskDescription = "VPN Client Device Driver Install Disk" +Neo.Service.Name = "Neo_VPN71" +Neo.Service.DispName = "VPN Client Device Driver - VPN71" +Neo.Service.Desc = "VPN Client Adapter - VPN71" +NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN71" +Neo.EventLog.Name = "Neo" +NetworkAddress = "MAC Address" +DefaultAddress = "000001000001" +MaxSpeed = "Indicate Speed (Mbps)" +KeepLink = "Keep Link" +On = "On" +Off = "Off" + + +; Auto Generated 20180205_163608.826 + diff --git a/src/bin/hamcore/DriverPackages/Neo6_Win8/x86/Neo6_x86_VPN72.inf b/src/bin/hamcore/DriverPackages/Neo6_Win8/x86/Neo6_x86_VPN72.inf index 61293a26..71c0fb7b 100644 --- a/src/bin/hamcore/DriverPackages/Neo6_Win8/x86/Neo6_x86_VPN72.inf +++ b/src/bin/hamcore/DriverPackages/Neo6_Win8/x86/Neo6_x86_VPN72.inf @@ -1,114 +1,114 @@ -; VPN Client Device Driver for Windows 2000 and Greater -; -; Copyright (c) SoftEther Corporation. All Rights Reserved. -; http://www.softether.co.jp/ -; -; BUILD 9658 - -[Version] -Signature = "$Windows NT$" -Class = Net -ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} -Provider = %CompanyName% -DriverVer = 02/04/2018, 4.25.0.9658 -CatalogFile.NT = inf_VPN72.cat - -[Manufacturer] -%CompanyName% = SoftEther - -[SourceDisksNames] -1=%DiskDescription%, "", , - -[SourceDisksFiles] -Neo_VPN72.sys = 1 - -[DestinationDirs] -DefaultDestDir = 12 -Neo.CopyFiles.Sys = 12 - -[Neo.CopyFiles.Sys] -Neo_VPN72.sys, , , 2 - -[SoftEther] -%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN72 - -[NeoAdapter.Install] -Characteristics = 0x1 -AddReg = Neo.Reg, NeoAdapter.Ndi -CopyFiles = Neo.CopyFiles.Sys -*IfType = 53 -*MediaType = 0 -*PhysicalMediaType = 0 - -[NeoAdapter.Install.Services] -AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% - -[NeoAdapter.Ndi] -HKR, , NetworkAddress, 0, %DefaultAddress% -HKR, Ndi, DeviceID, , "NeoAdapter_VPN72" -HKR, , DevLoader, , ndis -HKR, , DeviceVxDs, , Neo_VPN72.sys -HKR, NDIS, LogDriverName, , "Neo_VPN72" -HKR, NDIS, MajorNdisVersion, 1, 5 -HKR, NDIS, MinorNdisVersion, 1, 0 -HKR, Ndi\Interfaces, DefUpper, , "ndis5" -HKR, Ndi\Interfaces, UpperRange, , "ndis5" -HKR, Ndi\Interfaces, LowerRange, , "ethernet" -HKR, Ndi\Interfaces, DefLower, , "ethernet" -HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" -HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% -HKR, Ndi\Params\NetworkAddress, type, 0, "edit" -HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" -HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" -HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% -HKR, Ndi\Params\NetworkAddress, optional, 0, "0" -HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% -HKR, Ndi\Params\MaxSpeed, type, 0, "int" -HKR, Ndi\Params\MaxSpeed, default, 0, "100" -HKR, Ndi\Params\MaxSpeed, min, 0, "0" -HKR, Ndi\Params\MaxSpeed, max, 0, "2000" -HKR, Ndi\Params\MaxSpeed, step, 0, "1" -HKR, Ndi\Params\MaxSpeed, Base, 0, "10" -HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% -HKR, Ndi\Params\KeepLink, type, 0, "enum" -HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% -HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% -HKR, Ndi\Params\KeepLink, default, 0, "0" - - -[Neo.Service] -DisplayName = %Neo.Service.DispName% -Description = %Neo.Service.Desc% -ServiceType = 1 -StartType = 3 -ErrorControl = 1 -ServiceBinary = %12%\Neo_VPN72.sys -LoadOrderGroup = NDIS - -[Neo.Reg] -HKR, Ndi, Service, 0, Neo.Service.Name -HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" -HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" - -[Neo.EventLog] -HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN72.sys" -HKR, , TypesSupported, 0x00010001, 7 - -[Strings] -CompanyName = "SoftEther Corporation" -DiskDescription = "VPN Client Device Driver Install Disk" -Neo.Service.Name = "Neo_VPN72" -Neo.Service.DispName = "VPN Client Device Driver - VPN72" -Neo.Service.Desc = "VPN Client Adapter - VPN72" -NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN72" -Neo.EventLog.Name = "Neo" -NetworkAddress = "MAC Address" -DefaultAddress = "000001000001" -MaxSpeed = "Indicate Speed (Mbps)" -KeepLink = "Keep Link" -On = "On" -Off = "Off" - - -; Auto Generated 20180205_163608.827 - +; VPN Client Device Driver for Windows 2000 and Greater +; +; Copyright (c) SoftEther Corporation. All Rights Reserved. +; http://www.softether.co.jp/ +; +; BUILD 9658 + +[Version] +Signature = "$Windows NT$" +Class = Net +ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} +Provider = %CompanyName% +DriverVer = 02/04/2018, 4.25.0.9658 +CatalogFile.NT = inf_VPN72.cat + +[Manufacturer] +%CompanyName% = SoftEther + +[SourceDisksNames] +1=%DiskDescription%, "", , + +[SourceDisksFiles] +Neo_VPN72.sys = 1 + +[DestinationDirs] +DefaultDestDir = 12 +Neo.CopyFiles.Sys = 12 + +[Neo.CopyFiles.Sys] +Neo_VPN72.sys, , , 2 + +[SoftEther] +%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN72 + +[NeoAdapter.Install] +Characteristics = 0x1 +AddReg = Neo.Reg, NeoAdapter.Ndi +CopyFiles = Neo.CopyFiles.Sys +*IfType = 53 +*MediaType = 0 +*PhysicalMediaType = 0 + +[NeoAdapter.Install.Services] +AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% + +[NeoAdapter.Ndi] +HKR, , NetworkAddress, 0, %DefaultAddress% +HKR, Ndi, DeviceID, , "NeoAdapter_VPN72" +HKR, , DevLoader, , ndis +HKR, , DeviceVxDs, , Neo_VPN72.sys +HKR, NDIS, LogDriverName, , "Neo_VPN72" +HKR, NDIS, MajorNdisVersion, 1, 5 +HKR, NDIS, MinorNdisVersion, 1, 0 +HKR, Ndi\Interfaces, DefUpper, , "ndis5" +HKR, Ndi\Interfaces, UpperRange, , "ndis5" +HKR, Ndi\Interfaces, LowerRange, , "ethernet" +HKR, Ndi\Interfaces, DefLower, , "ethernet" +HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" +HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% +HKR, Ndi\Params\NetworkAddress, type, 0, "edit" +HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" +HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" +HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% +HKR, Ndi\Params\NetworkAddress, optional, 0, "0" +HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% +HKR, Ndi\Params\MaxSpeed, type, 0, "int" +HKR, Ndi\Params\MaxSpeed, default, 0, "100" +HKR, Ndi\Params\MaxSpeed, min, 0, "0" +HKR, Ndi\Params\MaxSpeed, max, 0, "2000" +HKR, Ndi\Params\MaxSpeed, step, 0, "1" +HKR, Ndi\Params\MaxSpeed, Base, 0, "10" +HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% +HKR, Ndi\Params\KeepLink, type, 0, "enum" +HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% +HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% +HKR, Ndi\Params\KeepLink, default, 0, "0" + + +[Neo.Service] +DisplayName = %Neo.Service.DispName% +Description = %Neo.Service.Desc% +ServiceType = 1 +StartType = 3 +ErrorControl = 1 +ServiceBinary = %12%\Neo_VPN72.sys +LoadOrderGroup = NDIS + +[Neo.Reg] +HKR, Ndi, Service, 0, Neo.Service.Name +HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" +HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" + +[Neo.EventLog] +HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN72.sys" +HKR, , TypesSupported, 0x00010001, 7 + +[Strings] +CompanyName = "SoftEther Corporation" +DiskDescription = "VPN Client Device Driver Install Disk" +Neo.Service.Name = "Neo_VPN72" +Neo.Service.DispName = "VPN Client Device Driver - VPN72" +Neo.Service.Desc = "VPN Client Adapter - VPN72" +NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN72" +Neo.EventLog.Name = "Neo" +NetworkAddress = "MAC Address" +DefaultAddress = "000001000001" +MaxSpeed = "Indicate Speed (Mbps)" +KeepLink = "Keep Link" +On = "On" +Off = "Off" + + +; Auto Generated 20180205_163608.827 + diff --git a/src/bin/hamcore/DriverPackages/Neo6_Win8/x86/Neo6_x86_VPN73.inf b/src/bin/hamcore/DriverPackages/Neo6_Win8/x86/Neo6_x86_VPN73.inf index 795b7f5c..ec42c5c2 100644 --- a/src/bin/hamcore/DriverPackages/Neo6_Win8/x86/Neo6_x86_VPN73.inf +++ b/src/bin/hamcore/DriverPackages/Neo6_Win8/x86/Neo6_x86_VPN73.inf @@ -1,114 +1,114 @@ -; VPN Client Device Driver for Windows 2000 and Greater -; -; Copyright (c) SoftEther Corporation. All Rights Reserved. -; http://www.softether.co.jp/ -; -; BUILD 9658 - -[Version] -Signature = "$Windows NT$" -Class = Net -ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} -Provider = %CompanyName% -DriverVer = 02/04/2018, 4.25.0.9658 -CatalogFile.NT = inf_VPN73.cat - -[Manufacturer] -%CompanyName% = SoftEther - -[SourceDisksNames] -1=%DiskDescription%, "", , - -[SourceDisksFiles] -Neo_VPN73.sys = 1 - -[DestinationDirs] -DefaultDestDir = 12 -Neo.CopyFiles.Sys = 12 - -[Neo.CopyFiles.Sys] -Neo_VPN73.sys, , , 2 - -[SoftEther] -%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN73 - -[NeoAdapter.Install] -Characteristics = 0x1 -AddReg = Neo.Reg, NeoAdapter.Ndi -CopyFiles = Neo.CopyFiles.Sys -*IfType = 53 -*MediaType = 0 -*PhysicalMediaType = 0 - -[NeoAdapter.Install.Services] -AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% - -[NeoAdapter.Ndi] -HKR, , NetworkAddress, 0, %DefaultAddress% -HKR, Ndi, DeviceID, , "NeoAdapter_VPN73" -HKR, , DevLoader, , ndis -HKR, , DeviceVxDs, , Neo_VPN73.sys -HKR, NDIS, LogDriverName, , "Neo_VPN73" -HKR, NDIS, MajorNdisVersion, 1, 5 -HKR, NDIS, MinorNdisVersion, 1, 0 -HKR, Ndi\Interfaces, DefUpper, , "ndis5" -HKR, Ndi\Interfaces, UpperRange, , "ndis5" -HKR, Ndi\Interfaces, LowerRange, , "ethernet" -HKR, Ndi\Interfaces, DefLower, , "ethernet" -HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" -HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% -HKR, Ndi\Params\NetworkAddress, type, 0, "edit" -HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" -HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" -HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% -HKR, Ndi\Params\NetworkAddress, optional, 0, "0" -HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% -HKR, Ndi\Params\MaxSpeed, type, 0, "int" -HKR, Ndi\Params\MaxSpeed, default, 0, "100" -HKR, Ndi\Params\MaxSpeed, min, 0, "0" -HKR, Ndi\Params\MaxSpeed, max, 0, "2000" -HKR, Ndi\Params\MaxSpeed, step, 0, "1" -HKR, Ndi\Params\MaxSpeed, Base, 0, "10" -HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% -HKR, Ndi\Params\KeepLink, type, 0, "enum" -HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% -HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% -HKR, Ndi\Params\KeepLink, default, 0, "0" - - -[Neo.Service] -DisplayName = %Neo.Service.DispName% -Description = %Neo.Service.Desc% -ServiceType = 1 -StartType = 3 -ErrorControl = 1 -ServiceBinary = %12%\Neo_VPN73.sys -LoadOrderGroup = NDIS - -[Neo.Reg] -HKR, Ndi, Service, 0, Neo.Service.Name -HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" -HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" - -[Neo.EventLog] -HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN73.sys" -HKR, , TypesSupported, 0x00010001, 7 - -[Strings] -CompanyName = "SoftEther Corporation" -DiskDescription = "VPN Client Device Driver Install Disk" -Neo.Service.Name = "Neo_VPN73" -Neo.Service.DispName = "VPN Client Device Driver - VPN73" -Neo.Service.Desc = "VPN Client Adapter - VPN73" -NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN73" -Neo.EventLog.Name = "Neo" -NetworkAddress = "MAC Address" -DefaultAddress = "000001000001" -MaxSpeed = "Indicate Speed (Mbps)" -KeepLink = "Keep Link" -On = "On" -Off = "Off" - - -; Auto Generated 20180205_163608.828 - +; VPN Client Device Driver for Windows 2000 and Greater +; +; Copyright (c) SoftEther Corporation. All Rights Reserved. +; http://www.softether.co.jp/ +; +; BUILD 9658 + +[Version] +Signature = "$Windows NT$" +Class = Net +ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} +Provider = %CompanyName% +DriverVer = 02/04/2018, 4.25.0.9658 +CatalogFile.NT = inf_VPN73.cat + +[Manufacturer] +%CompanyName% = SoftEther + +[SourceDisksNames] +1=%DiskDescription%, "", , + +[SourceDisksFiles] +Neo_VPN73.sys = 1 + +[DestinationDirs] +DefaultDestDir = 12 +Neo.CopyFiles.Sys = 12 + +[Neo.CopyFiles.Sys] +Neo_VPN73.sys, , , 2 + +[SoftEther] +%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN73 + +[NeoAdapter.Install] +Characteristics = 0x1 +AddReg = Neo.Reg, NeoAdapter.Ndi +CopyFiles = Neo.CopyFiles.Sys +*IfType = 53 +*MediaType = 0 +*PhysicalMediaType = 0 + +[NeoAdapter.Install.Services] +AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% + +[NeoAdapter.Ndi] +HKR, , NetworkAddress, 0, %DefaultAddress% +HKR, Ndi, DeviceID, , "NeoAdapter_VPN73" +HKR, , DevLoader, , ndis +HKR, , DeviceVxDs, , Neo_VPN73.sys +HKR, NDIS, LogDriverName, , "Neo_VPN73" +HKR, NDIS, MajorNdisVersion, 1, 5 +HKR, NDIS, MinorNdisVersion, 1, 0 +HKR, Ndi\Interfaces, DefUpper, , "ndis5" +HKR, Ndi\Interfaces, UpperRange, , "ndis5" +HKR, Ndi\Interfaces, LowerRange, , "ethernet" +HKR, Ndi\Interfaces, DefLower, , "ethernet" +HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" +HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% +HKR, Ndi\Params\NetworkAddress, type, 0, "edit" +HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" +HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" +HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% +HKR, Ndi\Params\NetworkAddress, optional, 0, "0" +HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% +HKR, Ndi\Params\MaxSpeed, type, 0, "int" +HKR, Ndi\Params\MaxSpeed, default, 0, "100" +HKR, Ndi\Params\MaxSpeed, min, 0, "0" +HKR, Ndi\Params\MaxSpeed, max, 0, "2000" +HKR, Ndi\Params\MaxSpeed, step, 0, "1" +HKR, Ndi\Params\MaxSpeed, Base, 0, "10" +HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% +HKR, Ndi\Params\KeepLink, type, 0, "enum" +HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% +HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% +HKR, Ndi\Params\KeepLink, default, 0, "0" + + +[Neo.Service] +DisplayName = %Neo.Service.DispName% +Description = %Neo.Service.Desc% +ServiceType = 1 +StartType = 3 +ErrorControl = 1 +ServiceBinary = %12%\Neo_VPN73.sys +LoadOrderGroup = NDIS + +[Neo.Reg] +HKR, Ndi, Service, 0, Neo.Service.Name +HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" +HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" + +[Neo.EventLog] +HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN73.sys" +HKR, , TypesSupported, 0x00010001, 7 + +[Strings] +CompanyName = "SoftEther Corporation" +DiskDescription = "VPN Client Device Driver Install Disk" +Neo.Service.Name = "Neo_VPN73" +Neo.Service.DispName = "VPN Client Device Driver - VPN73" +Neo.Service.Desc = "VPN Client Adapter - VPN73" +NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN73" +Neo.EventLog.Name = "Neo" +NetworkAddress = "MAC Address" +DefaultAddress = "000001000001" +MaxSpeed = "Indicate Speed (Mbps)" +KeepLink = "Keep Link" +On = "On" +Off = "Off" + + +; Auto Generated 20180205_163608.828 + diff --git a/src/bin/hamcore/DriverPackages/Neo6_Win8/x86/Neo6_x86_VPN74.inf b/src/bin/hamcore/DriverPackages/Neo6_Win8/x86/Neo6_x86_VPN74.inf index 9eedf561..aefd6431 100644 --- a/src/bin/hamcore/DriverPackages/Neo6_Win8/x86/Neo6_x86_VPN74.inf +++ b/src/bin/hamcore/DriverPackages/Neo6_Win8/x86/Neo6_x86_VPN74.inf @@ -1,114 +1,114 @@ -; VPN Client Device Driver for Windows 2000 and Greater -; -; Copyright (c) SoftEther Corporation. All Rights Reserved. -; http://www.softether.co.jp/ -; -; BUILD 9658 - -[Version] -Signature = "$Windows NT$" -Class = Net -ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} -Provider = %CompanyName% -DriverVer = 02/04/2018, 4.25.0.9658 -CatalogFile.NT = inf_VPN74.cat - -[Manufacturer] -%CompanyName% = SoftEther - -[SourceDisksNames] -1=%DiskDescription%, "", , - -[SourceDisksFiles] -Neo_VPN74.sys = 1 - -[DestinationDirs] -DefaultDestDir = 12 -Neo.CopyFiles.Sys = 12 - -[Neo.CopyFiles.Sys] -Neo_VPN74.sys, , , 2 - -[SoftEther] -%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN74 - -[NeoAdapter.Install] -Characteristics = 0x1 -AddReg = Neo.Reg, NeoAdapter.Ndi -CopyFiles = Neo.CopyFiles.Sys -*IfType = 53 -*MediaType = 0 -*PhysicalMediaType = 0 - -[NeoAdapter.Install.Services] -AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% - -[NeoAdapter.Ndi] -HKR, , NetworkAddress, 0, %DefaultAddress% -HKR, Ndi, DeviceID, , "NeoAdapter_VPN74" -HKR, , DevLoader, , ndis -HKR, , DeviceVxDs, , Neo_VPN74.sys -HKR, NDIS, LogDriverName, , "Neo_VPN74" -HKR, NDIS, MajorNdisVersion, 1, 5 -HKR, NDIS, MinorNdisVersion, 1, 0 -HKR, Ndi\Interfaces, DefUpper, , "ndis5" -HKR, Ndi\Interfaces, UpperRange, , "ndis5" -HKR, Ndi\Interfaces, LowerRange, , "ethernet" -HKR, Ndi\Interfaces, DefLower, , "ethernet" -HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" -HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% -HKR, Ndi\Params\NetworkAddress, type, 0, "edit" -HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" -HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" -HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% -HKR, Ndi\Params\NetworkAddress, optional, 0, "0" -HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% -HKR, Ndi\Params\MaxSpeed, type, 0, "int" -HKR, Ndi\Params\MaxSpeed, default, 0, "100" -HKR, Ndi\Params\MaxSpeed, min, 0, "0" -HKR, Ndi\Params\MaxSpeed, max, 0, "2000" -HKR, Ndi\Params\MaxSpeed, step, 0, "1" -HKR, Ndi\Params\MaxSpeed, Base, 0, "10" -HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% -HKR, Ndi\Params\KeepLink, type, 0, "enum" -HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% -HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% -HKR, Ndi\Params\KeepLink, default, 0, "0" - - -[Neo.Service] -DisplayName = %Neo.Service.DispName% -Description = %Neo.Service.Desc% -ServiceType = 1 -StartType = 3 -ErrorControl = 1 -ServiceBinary = %12%\Neo_VPN74.sys -LoadOrderGroup = NDIS - -[Neo.Reg] -HKR, Ndi, Service, 0, Neo.Service.Name -HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" -HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" - -[Neo.EventLog] -HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN74.sys" -HKR, , TypesSupported, 0x00010001, 7 - -[Strings] -CompanyName = "SoftEther Corporation" -DiskDescription = "VPN Client Device Driver Install Disk" -Neo.Service.Name = "Neo_VPN74" -Neo.Service.DispName = "VPN Client Device Driver - VPN74" -Neo.Service.Desc = "VPN Client Adapter - VPN74" -NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN74" -Neo.EventLog.Name = "Neo" -NetworkAddress = "MAC Address" -DefaultAddress = "000001000001" -MaxSpeed = "Indicate Speed (Mbps)" -KeepLink = "Keep Link" -On = "On" -Off = "Off" - - -; Auto Generated 20180205_163608.829 - +; VPN Client Device Driver for Windows 2000 and Greater +; +; Copyright (c) SoftEther Corporation. All Rights Reserved. +; http://www.softether.co.jp/ +; +; BUILD 9658 + +[Version] +Signature = "$Windows NT$" +Class = Net +ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} +Provider = %CompanyName% +DriverVer = 02/04/2018, 4.25.0.9658 +CatalogFile.NT = inf_VPN74.cat + +[Manufacturer] +%CompanyName% = SoftEther + +[SourceDisksNames] +1=%DiskDescription%, "", , + +[SourceDisksFiles] +Neo_VPN74.sys = 1 + +[DestinationDirs] +DefaultDestDir = 12 +Neo.CopyFiles.Sys = 12 + +[Neo.CopyFiles.Sys] +Neo_VPN74.sys, , , 2 + +[SoftEther] +%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN74 + +[NeoAdapter.Install] +Characteristics = 0x1 +AddReg = Neo.Reg, NeoAdapter.Ndi +CopyFiles = Neo.CopyFiles.Sys +*IfType = 53 +*MediaType = 0 +*PhysicalMediaType = 0 + +[NeoAdapter.Install.Services] +AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% + +[NeoAdapter.Ndi] +HKR, , NetworkAddress, 0, %DefaultAddress% +HKR, Ndi, DeviceID, , "NeoAdapter_VPN74" +HKR, , DevLoader, , ndis +HKR, , DeviceVxDs, , Neo_VPN74.sys +HKR, NDIS, LogDriverName, , "Neo_VPN74" +HKR, NDIS, MajorNdisVersion, 1, 5 +HKR, NDIS, MinorNdisVersion, 1, 0 +HKR, Ndi\Interfaces, DefUpper, , "ndis5" +HKR, Ndi\Interfaces, UpperRange, , "ndis5" +HKR, Ndi\Interfaces, LowerRange, , "ethernet" +HKR, Ndi\Interfaces, DefLower, , "ethernet" +HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" +HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% +HKR, Ndi\Params\NetworkAddress, type, 0, "edit" +HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" +HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" +HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% +HKR, Ndi\Params\NetworkAddress, optional, 0, "0" +HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% +HKR, Ndi\Params\MaxSpeed, type, 0, "int" +HKR, Ndi\Params\MaxSpeed, default, 0, "100" +HKR, Ndi\Params\MaxSpeed, min, 0, "0" +HKR, Ndi\Params\MaxSpeed, max, 0, "2000" +HKR, Ndi\Params\MaxSpeed, step, 0, "1" +HKR, Ndi\Params\MaxSpeed, Base, 0, "10" +HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% +HKR, Ndi\Params\KeepLink, type, 0, "enum" +HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% +HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% +HKR, Ndi\Params\KeepLink, default, 0, "0" + + +[Neo.Service] +DisplayName = %Neo.Service.DispName% +Description = %Neo.Service.Desc% +ServiceType = 1 +StartType = 3 +ErrorControl = 1 +ServiceBinary = %12%\Neo_VPN74.sys +LoadOrderGroup = NDIS + +[Neo.Reg] +HKR, Ndi, Service, 0, Neo.Service.Name +HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" +HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" + +[Neo.EventLog] +HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN74.sys" +HKR, , TypesSupported, 0x00010001, 7 + +[Strings] +CompanyName = "SoftEther Corporation" +DiskDescription = "VPN Client Device Driver Install Disk" +Neo.Service.Name = "Neo_VPN74" +Neo.Service.DispName = "VPN Client Device Driver - VPN74" +Neo.Service.Desc = "VPN Client Adapter - VPN74" +NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN74" +Neo.EventLog.Name = "Neo" +NetworkAddress = "MAC Address" +DefaultAddress = "000001000001" +MaxSpeed = "Indicate Speed (Mbps)" +KeepLink = "Keep Link" +On = "On" +Off = "Off" + + +; Auto Generated 20180205_163608.829 + diff --git a/src/bin/hamcore/DriverPackages/Neo6_Win8/x86/Neo6_x86_VPN75.inf b/src/bin/hamcore/DriverPackages/Neo6_Win8/x86/Neo6_x86_VPN75.inf index 96318e7d..1d171d0c 100644 --- a/src/bin/hamcore/DriverPackages/Neo6_Win8/x86/Neo6_x86_VPN75.inf +++ b/src/bin/hamcore/DriverPackages/Neo6_Win8/x86/Neo6_x86_VPN75.inf @@ -1,114 +1,114 @@ -; VPN Client Device Driver for Windows 2000 and Greater -; -; Copyright (c) SoftEther Corporation. All Rights Reserved. -; http://www.softether.co.jp/ -; -; BUILD 9658 - -[Version] -Signature = "$Windows NT$" -Class = Net -ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} -Provider = %CompanyName% -DriverVer = 02/04/2018, 4.25.0.9658 -CatalogFile.NT = inf_VPN75.cat - -[Manufacturer] -%CompanyName% = SoftEther - -[SourceDisksNames] -1=%DiskDescription%, "", , - -[SourceDisksFiles] -Neo_VPN75.sys = 1 - -[DestinationDirs] -DefaultDestDir = 12 -Neo.CopyFiles.Sys = 12 - -[Neo.CopyFiles.Sys] -Neo_VPN75.sys, , , 2 - -[SoftEther] -%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN75 - -[NeoAdapter.Install] -Characteristics = 0x1 -AddReg = Neo.Reg, NeoAdapter.Ndi -CopyFiles = Neo.CopyFiles.Sys -*IfType = 53 -*MediaType = 0 -*PhysicalMediaType = 0 - -[NeoAdapter.Install.Services] -AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% - -[NeoAdapter.Ndi] -HKR, , NetworkAddress, 0, %DefaultAddress% -HKR, Ndi, DeviceID, , "NeoAdapter_VPN75" -HKR, , DevLoader, , ndis -HKR, , DeviceVxDs, , Neo_VPN75.sys -HKR, NDIS, LogDriverName, , "Neo_VPN75" -HKR, NDIS, MajorNdisVersion, 1, 5 -HKR, NDIS, MinorNdisVersion, 1, 0 -HKR, Ndi\Interfaces, DefUpper, , "ndis5" -HKR, Ndi\Interfaces, UpperRange, , "ndis5" -HKR, Ndi\Interfaces, LowerRange, , "ethernet" -HKR, Ndi\Interfaces, DefLower, , "ethernet" -HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" -HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% -HKR, Ndi\Params\NetworkAddress, type, 0, "edit" -HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" -HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" -HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% -HKR, Ndi\Params\NetworkAddress, optional, 0, "0" -HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% -HKR, Ndi\Params\MaxSpeed, type, 0, "int" -HKR, Ndi\Params\MaxSpeed, default, 0, "100" -HKR, Ndi\Params\MaxSpeed, min, 0, "0" -HKR, Ndi\Params\MaxSpeed, max, 0, "2000" -HKR, Ndi\Params\MaxSpeed, step, 0, "1" -HKR, Ndi\Params\MaxSpeed, Base, 0, "10" -HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% -HKR, Ndi\Params\KeepLink, type, 0, "enum" -HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% -HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% -HKR, Ndi\Params\KeepLink, default, 0, "0" - - -[Neo.Service] -DisplayName = %Neo.Service.DispName% -Description = %Neo.Service.Desc% -ServiceType = 1 -StartType = 3 -ErrorControl = 1 -ServiceBinary = %12%\Neo_VPN75.sys -LoadOrderGroup = NDIS - -[Neo.Reg] -HKR, Ndi, Service, 0, Neo.Service.Name -HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" -HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" - -[Neo.EventLog] -HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN75.sys" -HKR, , TypesSupported, 0x00010001, 7 - -[Strings] -CompanyName = "SoftEther Corporation" -DiskDescription = "VPN Client Device Driver Install Disk" -Neo.Service.Name = "Neo_VPN75" -Neo.Service.DispName = "VPN Client Device Driver - VPN75" -Neo.Service.Desc = "VPN Client Adapter - VPN75" -NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN75" -Neo.EventLog.Name = "Neo" -NetworkAddress = "MAC Address" -DefaultAddress = "000001000001" -MaxSpeed = "Indicate Speed (Mbps)" -KeepLink = "Keep Link" -On = "On" -Off = "Off" - - -; Auto Generated 20180205_163608.830 - +; VPN Client Device Driver for Windows 2000 and Greater +; +; Copyright (c) SoftEther Corporation. All Rights Reserved. +; http://www.softether.co.jp/ +; +; BUILD 9658 + +[Version] +Signature = "$Windows NT$" +Class = Net +ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} +Provider = %CompanyName% +DriverVer = 02/04/2018, 4.25.0.9658 +CatalogFile.NT = inf_VPN75.cat + +[Manufacturer] +%CompanyName% = SoftEther + +[SourceDisksNames] +1=%DiskDescription%, "", , + +[SourceDisksFiles] +Neo_VPN75.sys = 1 + +[DestinationDirs] +DefaultDestDir = 12 +Neo.CopyFiles.Sys = 12 + +[Neo.CopyFiles.Sys] +Neo_VPN75.sys, , , 2 + +[SoftEther] +%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN75 + +[NeoAdapter.Install] +Characteristics = 0x1 +AddReg = Neo.Reg, NeoAdapter.Ndi +CopyFiles = Neo.CopyFiles.Sys +*IfType = 53 +*MediaType = 0 +*PhysicalMediaType = 0 + +[NeoAdapter.Install.Services] +AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% + +[NeoAdapter.Ndi] +HKR, , NetworkAddress, 0, %DefaultAddress% +HKR, Ndi, DeviceID, , "NeoAdapter_VPN75" +HKR, , DevLoader, , ndis +HKR, , DeviceVxDs, , Neo_VPN75.sys +HKR, NDIS, LogDriverName, , "Neo_VPN75" +HKR, NDIS, MajorNdisVersion, 1, 5 +HKR, NDIS, MinorNdisVersion, 1, 0 +HKR, Ndi\Interfaces, DefUpper, , "ndis5" +HKR, Ndi\Interfaces, UpperRange, , "ndis5" +HKR, Ndi\Interfaces, LowerRange, , "ethernet" +HKR, Ndi\Interfaces, DefLower, , "ethernet" +HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" +HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% +HKR, Ndi\Params\NetworkAddress, type, 0, "edit" +HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" +HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" +HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% +HKR, Ndi\Params\NetworkAddress, optional, 0, "0" +HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% +HKR, Ndi\Params\MaxSpeed, type, 0, "int" +HKR, Ndi\Params\MaxSpeed, default, 0, "100" +HKR, Ndi\Params\MaxSpeed, min, 0, "0" +HKR, Ndi\Params\MaxSpeed, max, 0, "2000" +HKR, Ndi\Params\MaxSpeed, step, 0, "1" +HKR, Ndi\Params\MaxSpeed, Base, 0, "10" +HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% +HKR, Ndi\Params\KeepLink, type, 0, "enum" +HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% +HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% +HKR, Ndi\Params\KeepLink, default, 0, "0" + + +[Neo.Service] +DisplayName = %Neo.Service.DispName% +Description = %Neo.Service.Desc% +ServiceType = 1 +StartType = 3 +ErrorControl = 1 +ServiceBinary = %12%\Neo_VPN75.sys +LoadOrderGroup = NDIS + +[Neo.Reg] +HKR, Ndi, Service, 0, Neo.Service.Name +HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" +HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" + +[Neo.EventLog] +HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN75.sys" +HKR, , TypesSupported, 0x00010001, 7 + +[Strings] +CompanyName = "SoftEther Corporation" +DiskDescription = "VPN Client Device Driver Install Disk" +Neo.Service.Name = "Neo_VPN75" +Neo.Service.DispName = "VPN Client Device Driver - VPN75" +Neo.Service.Desc = "VPN Client Adapter - VPN75" +NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN75" +Neo.EventLog.Name = "Neo" +NetworkAddress = "MAC Address" +DefaultAddress = "000001000001" +MaxSpeed = "Indicate Speed (Mbps)" +KeepLink = "Keep Link" +On = "On" +Off = "Off" + + +; Auto Generated 20180205_163608.830 + diff --git a/src/bin/hamcore/DriverPackages/Neo6_Win8/x86/Neo6_x86_VPN76.inf b/src/bin/hamcore/DriverPackages/Neo6_Win8/x86/Neo6_x86_VPN76.inf index 55be1cf3..3ced6b14 100644 --- a/src/bin/hamcore/DriverPackages/Neo6_Win8/x86/Neo6_x86_VPN76.inf +++ b/src/bin/hamcore/DriverPackages/Neo6_Win8/x86/Neo6_x86_VPN76.inf @@ -1,114 +1,114 @@ -; VPN Client Device Driver for Windows 2000 and Greater -; -; Copyright (c) SoftEther Corporation. All Rights Reserved. -; http://www.softether.co.jp/ -; -; BUILD 9658 - -[Version] -Signature = "$Windows NT$" -Class = Net -ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} -Provider = %CompanyName% -DriverVer = 02/04/2018, 4.25.0.9658 -CatalogFile.NT = inf_VPN76.cat - -[Manufacturer] -%CompanyName% = SoftEther - -[SourceDisksNames] -1=%DiskDescription%, "", , - -[SourceDisksFiles] -Neo_VPN76.sys = 1 - -[DestinationDirs] -DefaultDestDir = 12 -Neo.CopyFiles.Sys = 12 - -[Neo.CopyFiles.Sys] -Neo_VPN76.sys, , , 2 - -[SoftEther] -%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN76 - -[NeoAdapter.Install] -Characteristics = 0x1 -AddReg = Neo.Reg, NeoAdapter.Ndi -CopyFiles = Neo.CopyFiles.Sys -*IfType = 53 -*MediaType = 0 -*PhysicalMediaType = 0 - -[NeoAdapter.Install.Services] -AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% - -[NeoAdapter.Ndi] -HKR, , NetworkAddress, 0, %DefaultAddress% -HKR, Ndi, DeviceID, , "NeoAdapter_VPN76" -HKR, , DevLoader, , ndis -HKR, , DeviceVxDs, , Neo_VPN76.sys -HKR, NDIS, LogDriverName, , "Neo_VPN76" -HKR, NDIS, MajorNdisVersion, 1, 5 -HKR, NDIS, MinorNdisVersion, 1, 0 -HKR, Ndi\Interfaces, DefUpper, , "ndis5" -HKR, Ndi\Interfaces, UpperRange, , "ndis5" -HKR, Ndi\Interfaces, LowerRange, , "ethernet" -HKR, Ndi\Interfaces, DefLower, , "ethernet" -HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" -HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% -HKR, Ndi\Params\NetworkAddress, type, 0, "edit" -HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" -HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" -HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% -HKR, Ndi\Params\NetworkAddress, optional, 0, "0" -HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% -HKR, Ndi\Params\MaxSpeed, type, 0, "int" -HKR, Ndi\Params\MaxSpeed, default, 0, "100" -HKR, Ndi\Params\MaxSpeed, min, 0, "0" -HKR, Ndi\Params\MaxSpeed, max, 0, "2000" -HKR, Ndi\Params\MaxSpeed, step, 0, "1" -HKR, Ndi\Params\MaxSpeed, Base, 0, "10" -HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% -HKR, Ndi\Params\KeepLink, type, 0, "enum" -HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% -HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% -HKR, Ndi\Params\KeepLink, default, 0, "0" - - -[Neo.Service] -DisplayName = %Neo.Service.DispName% -Description = %Neo.Service.Desc% -ServiceType = 1 -StartType = 3 -ErrorControl = 1 -ServiceBinary = %12%\Neo_VPN76.sys -LoadOrderGroup = NDIS - -[Neo.Reg] -HKR, Ndi, Service, 0, Neo.Service.Name -HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" -HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" - -[Neo.EventLog] -HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN76.sys" -HKR, , TypesSupported, 0x00010001, 7 - -[Strings] -CompanyName = "SoftEther Corporation" -DiskDescription = "VPN Client Device Driver Install Disk" -Neo.Service.Name = "Neo_VPN76" -Neo.Service.DispName = "VPN Client Device Driver - VPN76" -Neo.Service.Desc = "VPN Client Adapter - VPN76" -NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN76" -Neo.EventLog.Name = "Neo" -NetworkAddress = "MAC Address" -DefaultAddress = "000001000001" -MaxSpeed = "Indicate Speed (Mbps)" -KeepLink = "Keep Link" -On = "On" -Off = "Off" - - -; Auto Generated 20180205_163608.831 - +; VPN Client Device Driver for Windows 2000 and Greater +; +; Copyright (c) SoftEther Corporation. All Rights Reserved. +; http://www.softether.co.jp/ +; +; BUILD 9658 + +[Version] +Signature = "$Windows NT$" +Class = Net +ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} +Provider = %CompanyName% +DriverVer = 02/04/2018, 4.25.0.9658 +CatalogFile.NT = inf_VPN76.cat + +[Manufacturer] +%CompanyName% = SoftEther + +[SourceDisksNames] +1=%DiskDescription%, "", , + +[SourceDisksFiles] +Neo_VPN76.sys = 1 + +[DestinationDirs] +DefaultDestDir = 12 +Neo.CopyFiles.Sys = 12 + +[Neo.CopyFiles.Sys] +Neo_VPN76.sys, , , 2 + +[SoftEther] +%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN76 + +[NeoAdapter.Install] +Characteristics = 0x1 +AddReg = Neo.Reg, NeoAdapter.Ndi +CopyFiles = Neo.CopyFiles.Sys +*IfType = 53 +*MediaType = 0 +*PhysicalMediaType = 0 + +[NeoAdapter.Install.Services] +AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% + +[NeoAdapter.Ndi] +HKR, , NetworkAddress, 0, %DefaultAddress% +HKR, Ndi, DeviceID, , "NeoAdapter_VPN76" +HKR, , DevLoader, , ndis +HKR, , DeviceVxDs, , Neo_VPN76.sys +HKR, NDIS, LogDriverName, , "Neo_VPN76" +HKR, NDIS, MajorNdisVersion, 1, 5 +HKR, NDIS, MinorNdisVersion, 1, 0 +HKR, Ndi\Interfaces, DefUpper, , "ndis5" +HKR, Ndi\Interfaces, UpperRange, , "ndis5" +HKR, Ndi\Interfaces, LowerRange, , "ethernet" +HKR, Ndi\Interfaces, DefLower, , "ethernet" +HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" +HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% +HKR, Ndi\Params\NetworkAddress, type, 0, "edit" +HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" +HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" +HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% +HKR, Ndi\Params\NetworkAddress, optional, 0, "0" +HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% +HKR, Ndi\Params\MaxSpeed, type, 0, "int" +HKR, Ndi\Params\MaxSpeed, default, 0, "100" +HKR, Ndi\Params\MaxSpeed, min, 0, "0" +HKR, Ndi\Params\MaxSpeed, max, 0, "2000" +HKR, Ndi\Params\MaxSpeed, step, 0, "1" +HKR, Ndi\Params\MaxSpeed, Base, 0, "10" +HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% +HKR, Ndi\Params\KeepLink, type, 0, "enum" +HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% +HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% +HKR, Ndi\Params\KeepLink, default, 0, "0" + + +[Neo.Service] +DisplayName = %Neo.Service.DispName% +Description = %Neo.Service.Desc% +ServiceType = 1 +StartType = 3 +ErrorControl = 1 +ServiceBinary = %12%\Neo_VPN76.sys +LoadOrderGroup = NDIS + +[Neo.Reg] +HKR, Ndi, Service, 0, Neo.Service.Name +HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" +HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" + +[Neo.EventLog] +HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN76.sys" +HKR, , TypesSupported, 0x00010001, 7 + +[Strings] +CompanyName = "SoftEther Corporation" +DiskDescription = "VPN Client Device Driver Install Disk" +Neo.Service.Name = "Neo_VPN76" +Neo.Service.DispName = "VPN Client Device Driver - VPN76" +Neo.Service.Desc = "VPN Client Adapter - VPN76" +NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN76" +Neo.EventLog.Name = "Neo" +NetworkAddress = "MAC Address" +DefaultAddress = "000001000001" +MaxSpeed = "Indicate Speed (Mbps)" +KeepLink = "Keep Link" +On = "On" +Off = "Off" + + +; Auto Generated 20180205_163608.831 + diff --git a/src/bin/hamcore/DriverPackages/Neo6_Win8/x86/Neo6_x86_VPN77.inf b/src/bin/hamcore/DriverPackages/Neo6_Win8/x86/Neo6_x86_VPN77.inf index 5b51736f..8d754545 100644 --- a/src/bin/hamcore/DriverPackages/Neo6_Win8/x86/Neo6_x86_VPN77.inf +++ b/src/bin/hamcore/DriverPackages/Neo6_Win8/x86/Neo6_x86_VPN77.inf @@ -1,114 +1,114 @@ -; VPN Client Device Driver for Windows 2000 and Greater -; -; Copyright (c) SoftEther Corporation. All Rights Reserved. -; http://www.softether.co.jp/ -; -; BUILD 9658 - -[Version] -Signature = "$Windows NT$" -Class = Net -ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} -Provider = %CompanyName% -DriverVer = 02/04/2018, 4.25.0.9658 -CatalogFile.NT = inf_VPN77.cat - -[Manufacturer] -%CompanyName% = SoftEther - -[SourceDisksNames] -1=%DiskDescription%, "", , - -[SourceDisksFiles] -Neo_VPN77.sys = 1 - -[DestinationDirs] -DefaultDestDir = 12 -Neo.CopyFiles.Sys = 12 - -[Neo.CopyFiles.Sys] -Neo_VPN77.sys, , , 2 - -[SoftEther] -%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN77 - -[NeoAdapter.Install] -Characteristics = 0x1 -AddReg = Neo.Reg, NeoAdapter.Ndi -CopyFiles = Neo.CopyFiles.Sys -*IfType = 53 -*MediaType = 0 -*PhysicalMediaType = 0 - -[NeoAdapter.Install.Services] -AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% - -[NeoAdapter.Ndi] -HKR, , NetworkAddress, 0, %DefaultAddress% -HKR, Ndi, DeviceID, , "NeoAdapter_VPN77" -HKR, , DevLoader, , ndis -HKR, , DeviceVxDs, , Neo_VPN77.sys -HKR, NDIS, LogDriverName, , "Neo_VPN77" -HKR, NDIS, MajorNdisVersion, 1, 5 -HKR, NDIS, MinorNdisVersion, 1, 0 -HKR, Ndi\Interfaces, DefUpper, , "ndis5" -HKR, Ndi\Interfaces, UpperRange, , "ndis5" -HKR, Ndi\Interfaces, LowerRange, , "ethernet" -HKR, Ndi\Interfaces, DefLower, , "ethernet" -HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" -HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% -HKR, Ndi\Params\NetworkAddress, type, 0, "edit" -HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" -HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" -HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% -HKR, Ndi\Params\NetworkAddress, optional, 0, "0" -HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% -HKR, Ndi\Params\MaxSpeed, type, 0, "int" -HKR, Ndi\Params\MaxSpeed, default, 0, "100" -HKR, Ndi\Params\MaxSpeed, min, 0, "0" -HKR, Ndi\Params\MaxSpeed, max, 0, "2000" -HKR, Ndi\Params\MaxSpeed, step, 0, "1" -HKR, Ndi\Params\MaxSpeed, Base, 0, "10" -HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% -HKR, Ndi\Params\KeepLink, type, 0, "enum" -HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% -HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% -HKR, Ndi\Params\KeepLink, default, 0, "0" - - -[Neo.Service] -DisplayName = %Neo.Service.DispName% -Description = %Neo.Service.Desc% -ServiceType = 1 -StartType = 3 -ErrorControl = 1 -ServiceBinary = %12%\Neo_VPN77.sys -LoadOrderGroup = NDIS - -[Neo.Reg] -HKR, Ndi, Service, 0, Neo.Service.Name -HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" -HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" - -[Neo.EventLog] -HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN77.sys" -HKR, , TypesSupported, 0x00010001, 7 - -[Strings] -CompanyName = "SoftEther Corporation" -DiskDescription = "VPN Client Device Driver Install Disk" -Neo.Service.Name = "Neo_VPN77" -Neo.Service.DispName = "VPN Client Device Driver - VPN77" -Neo.Service.Desc = "VPN Client Adapter - VPN77" -NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN77" -Neo.EventLog.Name = "Neo" -NetworkAddress = "MAC Address" -DefaultAddress = "000001000001" -MaxSpeed = "Indicate Speed (Mbps)" -KeepLink = "Keep Link" -On = "On" -Off = "Off" - - -; Auto Generated 20180205_163608.832 - +; VPN Client Device Driver for Windows 2000 and Greater +; +; Copyright (c) SoftEther Corporation. All Rights Reserved. +; http://www.softether.co.jp/ +; +; BUILD 9658 + +[Version] +Signature = "$Windows NT$" +Class = Net +ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} +Provider = %CompanyName% +DriverVer = 02/04/2018, 4.25.0.9658 +CatalogFile.NT = inf_VPN77.cat + +[Manufacturer] +%CompanyName% = SoftEther + +[SourceDisksNames] +1=%DiskDescription%, "", , + +[SourceDisksFiles] +Neo_VPN77.sys = 1 + +[DestinationDirs] +DefaultDestDir = 12 +Neo.CopyFiles.Sys = 12 + +[Neo.CopyFiles.Sys] +Neo_VPN77.sys, , , 2 + +[SoftEther] +%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN77 + +[NeoAdapter.Install] +Characteristics = 0x1 +AddReg = Neo.Reg, NeoAdapter.Ndi +CopyFiles = Neo.CopyFiles.Sys +*IfType = 53 +*MediaType = 0 +*PhysicalMediaType = 0 + +[NeoAdapter.Install.Services] +AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% + +[NeoAdapter.Ndi] +HKR, , NetworkAddress, 0, %DefaultAddress% +HKR, Ndi, DeviceID, , "NeoAdapter_VPN77" +HKR, , DevLoader, , ndis +HKR, , DeviceVxDs, , Neo_VPN77.sys +HKR, NDIS, LogDriverName, , "Neo_VPN77" +HKR, NDIS, MajorNdisVersion, 1, 5 +HKR, NDIS, MinorNdisVersion, 1, 0 +HKR, Ndi\Interfaces, DefUpper, , "ndis5" +HKR, Ndi\Interfaces, UpperRange, , "ndis5" +HKR, Ndi\Interfaces, LowerRange, , "ethernet" +HKR, Ndi\Interfaces, DefLower, , "ethernet" +HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" +HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% +HKR, Ndi\Params\NetworkAddress, type, 0, "edit" +HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" +HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" +HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% +HKR, Ndi\Params\NetworkAddress, optional, 0, "0" +HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% +HKR, Ndi\Params\MaxSpeed, type, 0, "int" +HKR, Ndi\Params\MaxSpeed, default, 0, "100" +HKR, Ndi\Params\MaxSpeed, min, 0, "0" +HKR, Ndi\Params\MaxSpeed, max, 0, "2000" +HKR, Ndi\Params\MaxSpeed, step, 0, "1" +HKR, Ndi\Params\MaxSpeed, Base, 0, "10" +HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% +HKR, Ndi\Params\KeepLink, type, 0, "enum" +HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% +HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% +HKR, Ndi\Params\KeepLink, default, 0, "0" + + +[Neo.Service] +DisplayName = %Neo.Service.DispName% +Description = %Neo.Service.Desc% +ServiceType = 1 +StartType = 3 +ErrorControl = 1 +ServiceBinary = %12%\Neo_VPN77.sys +LoadOrderGroup = NDIS + +[Neo.Reg] +HKR, Ndi, Service, 0, Neo.Service.Name +HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" +HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" + +[Neo.EventLog] +HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN77.sys" +HKR, , TypesSupported, 0x00010001, 7 + +[Strings] +CompanyName = "SoftEther Corporation" +DiskDescription = "VPN Client Device Driver Install Disk" +Neo.Service.Name = "Neo_VPN77" +Neo.Service.DispName = "VPN Client Device Driver - VPN77" +Neo.Service.Desc = "VPN Client Adapter - VPN77" +NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN77" +Neo.EventLog.Name = "Neo" +NetworkAddress = "MAC Address" +DefaultAddress = "000001000001" +MaxSpeed = "Indicate Speed (Mbps)" +KeepLink = "Keep Link" +On = "On" +Off = "Off" + + +; Auto Generated 20180205_163608.832 + diff --git a/src/bin/hamcore/DriverPackages/Neo6_Win8/x86/Neo6_x86_VPN78.inf b/src/bin/hamcore/DriverPackages/Neo6_Win8/x86/Neo6_x86_VPN78.inf index 19652f8f..5267fd36 100644 --- a/src/bin/hamcore/DriverPackages/Neo6_Win8/x86/Neo6_x86_VPN78.inf +++ b/src/bin/hamcore/DriverPackages/Neo6_Win8/x86/Neo6_x86_VPN78.inf @@ -1,114 +1,114 @@ -; VPN Client Device Driver for Windows 2000 and Greater -; -; Copyright (c) SoftEther Corporation. All Rights Reserved. -; http://www.softether.co.jp/ -; -; BUILD 9658 - -[Version] -Signature = "$Windows NT$" -Class = Net -ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} -Provider = %CompanyName% -DriverVer = 02/04/2018, 4.25.0.9658 -CatalogFile.NT = inf_VPN78.cat - -[Manufacturer] -%CompanyName% = SoftEther - -[SourceDisksNames] -1=%DiskDescription%, "", , - -[SourceDisksFiles] -Neo_VPN78.sys = 1 - -[DestinationDirs] -DefaultDestDir = 12 -Neo.CopyFiles.Sys = 12 - -[Neo.CopyFiles.Sys] -Neo_VPN78.sys, , , 2 - -[SoftEther] -%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN78 - -[NeoAdapter.Install] -Characteristics = 0x1 -AddReg = Neo.Reg, NeoAdapter.Ndi -CopyFiles = Neo.CopyFiles.Sys -*IfType = 53 -*MediaType = 0 -*PhysicalMediaType = 0 - -[NeoAdapter.Install.Services] -AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% - -[NeoAdapter.Ndi] -HKR, , NetworkAddress, 0, %DefaultAddress% -HKR, Ndi, DeviceID, , "NeoAdapter_VPN78" -HKR, , DevLoader, , ndis -HKR, , DeviceVxDs, , Neo_VPN78.sys -HKR, NDIS, LogDriverName, , "Neo_VPN78" -HKR, NDIS, MajorNdisVersion, 1, 5 -HKR, NDIS, MinorNdisVersion, 1, 0 -HKR, Ndi\Interfaces, DefUpper, , "ndis5" -HKR, Ndi\Interfaces, UpperRange, , "ndis5" -HKR, Ndi\Interfaces, LowerRange, , "ethernet" -HKR, Ndi\Interfaces, DefLower, , "ethernet" -HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" -HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% -HKR, Ndi\Params\NetworkAddress, type, 0, "edit" -HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" -HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" -HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% -HKR, Ndi\Params\NetworkAddress, optional, 0, "0" -HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% -HKR, Ndi\Params\MaxSpeed, type, 0, "int" -HKR, Ndi\Params\MaxSpeed, default, 0, "100" -HKR, Ndi\Params\MaxSpeed, min, 0, "0" -HKR, Ndi\Params\MaxSpeed, max, 0, "2000" -HKR, Ndi\Params\MaxSpeed, step, 0, "1" -HKR, Ndi\Params\MaxSpeed, Base, 0, "10" -HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% -HKR, Ndi\Params\KeepLink, type, 0, "enum" -HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% -HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% -HKR, Ndi\Params\KeepLink, default, 0, "0" - - -[Neo.Service] -DisplayName = %Neo.Service.DispName% -Description = %Neo.Service.Desc% -ServiceType = 1 -StartType = 3 -ErrorControl = 1 -ServiceBinary = %12%\Neo_VPN78.sys -LoadOrderGroup = NDIS - -[Neo.Reg] -HKR, Ndi, Service, 0, Neo.Service.Name -HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" -HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" - -[Neo.EventLog] -HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN78.sys" -HKR, , TypesSupported, 0x00010001, 7 - -[Strings] -CompanyName = "SoftEther Corporation" -DiskDescription = "VPN Client Device Driver Install Disk" -Neo.Service.Name = "Neo_VPN78" -Neo.Service.DispName = "VPN Client Device Driver - VPN78" -Neo.Service.Desc = "VPN Client Adapter - VPN78" -NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN78" -Neo.EventLog.Name = "Neo" -NetworkAddress = "MAC Address" -DefaultAddress = "000001000001" -MaxSpeed = "Indicate Speed (Mbps)" -KeepLink = "Keep Link" -On = "On" -Off = "Off" - - -; Auto Generated 20180205_163608.834 - +; VPN Client Device Driver for Windows 2000 and Greater +; +; Copyright (c) SoftEther Corporation. All Rights Reserved. +; http://www.softether.co.jp/ +; +; BUILD 9658 + +[Version] +Signature = "$Windows NT$" +Class = Net +ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} +Provider = %CompanyName% +DriverVer = 02/04/2018, 4.25.0.9658 +CatalogFile.NT = inf_VPN78.cat + +[Manufacturer] +%CompanyName% = SoftEther + +[SourceDisksNames] +1=%DiskDescription%, "", , + +[SourceDisksFiles] +Neo_VPN78.sys = 1 + +[DestinationDirs] +DefaultDestDir = 12 +Neo.CopyFiles.Sys = 12 + +[Neo.CopyFiles.Sys] +Neo_VPN78.sys, , , 2 + +[SoftEther] +%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN78 + +[NeoAdapter.Install] +Characteristics = 0x1 +AddReg = Neo.Reg, NeoAdapter.Ndi +CopyFiles = Neo.CopyFiles.Sys +*IfType = 53 +*MediaType = 0 +*PhysicalMediaType = 0 + +[NeoAdapter.Install.Services] +AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% + +[NeoAdapter.Ndi] +HKR, , NetworkAddress, 0, %DefaultAddress% +HKR, Ndi, DeviceID, , "NeoAdapter_VPN78" +HKR, , DevLoader, , ndis +HKR, , DeviceVxDs, , Neo_VPN78.sys +HKR, NDIS, LogDriverName, , "Neo_VPN78" +HKR, NDIS, MajorNdisVersion, 1, 5 +HKR, NDIS, MinorNdisVersion, 1, 0 +HKR, Ndi\Interfaces, DefUpper, , "ndis5" +HKR, Ndi\Interfaces, UpperRange, , "ndis5" +HKR, Ndi\Interfaces, LowerRange, , "ethernet" +HKR, Ndi\Interfaces, DefLower, , "ethernet" +HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" +HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% +HKR, Ndi\Params\NetworkAddress, type, 0, "edit" +HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" +HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" +HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% +HKR, Ndi\Params\NetworkAddress, optional, 0, "0" +HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% +HKR, Ndi\Params\MaxSpeed, type, 0, "int" +HKR, Ndi\Params\MaxSpeed, default, 0, "100" +HKR, Ndi\Params\MaxSpeed, min, 0, "0" +HKR, Ndi\Params\MaxSpeed, max, 0, "2000" +HKR, Ndi\Params\MaxSpeed, step, 0, "1" +HKR, Ndi\Params\MaxSpeed, Base, 0, "10" +HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% +HKR, Ndi\Params\KeepLink, type, 0, "enum" +HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% +HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% +HKR, Ndi\Params\KeepLink, default, 0, "0" + + +[Neo.Service] +DisplayName = %Neo.Service.DispName% +Description = %Neo.Service.Desc% +ServiceType = 1 +StartType = 3 +ErrorControl = 1 +ServiceBinary = %12%\Neo_VPN78.sys +LoadOrderGroup = NDIS + +[Neo.Reg] +HKR, Ndi, Service, 0, Neo.Service.Name +HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" +HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" + +[Neo.EventLog] +HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN78.sys" +HKR, , TypesSupported, 0x00010001, 7 + +[Strings] +CompanyName = "SoftEther Corporation" +DiskDescription = "VPN Client Device Driver Install Disk" +Neo.Service.Name = "Neo_VPN78" +Neo.Service.DispName = "VPN Client Device Driver - VPN78" +Neo.Service.Desc = "VPN Client Adapter - VPN78" +NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN78" +Neo.EventLog.Name = "Neo" +NetworkAddress = "MAC Address" +DefaultAddress = "000001000001" +MaxSpeed = "Indicate Speed (Mbps)" +KeepLink = "Keep Link" +On = "On" +Off = "Off" + + +; Auto Generated 20180205_163608.834 + diff --git a/src/bin/hamcore/DriverPackages/Neo6_Win8/x86/Neo6_x86_VPN79.inf b/src/bin/hamcore/DriverPackages/Neo6_Win8/x86/Neo6_x86_VPN79.inf index 94af64b2..a3144fc6 100644 --- a/src/bin/hamcore/DriverPackages/Neo6_Win8/x86/Neo6_x86_VPN79.inf +++ b/src/bin/hamcore/DriverPackages/Neo6_Win8/x86/Neo6_x86_VPN79.inf @@ -1,114 +1,114 @@ -; VPN Client Device Driver for Windows 2000 and Greater -; -; Copyright (c) SoftEther Corporation. All Rights Reserved. -; http://www.softether.co.jp/ -; -; BUILD 9658 - -[Version] -Signature = "$Windows NT$" -Class = Net -ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} -Provider = %CompanyName% -DriverVer = 02/04/2018, 4.25.0.9658 -CatalogFile.NT = inf_VPN79.cat - -[Manufacturer] -%CompanyName% = SoftEther - -[SourceDisksNames] -1=%DiskDescription%, "", , - -[SourceDisksFiles] -Neo_VPN79.sys = 1 - -[DestinationDirs] -DefaultDestDir = 12 -Neo.CopyFiles.Sys = 12 - -[Neo.CopyFiles.Sys] -Neo_VPN79.sys, , , 2 - -[SoftEther] -%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN79 - -[NeoAdapter.Install] -Characteristics = 0x1 -AddReg = Neo.Reg, NeoAdapter.Ndi -CopyFiles = Neo.CopyFiles.Sys -*IfType = 53 -*MediaType = 0 -*PhysicalMediaType = 0 - -[NeoAdapter.Install.Services] -AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% - -[NeoAdapter.Ndi] -HKR, , NetworkAddress, 0, %DefaultAddress% -HKR, Ndi, DeviceID, , "NeoAdapter_VPN79" -HKR, , DevLoader, , ndis -HKR, , DeviceVxDs, , Neo_VPN79.sys -HKR, NDIS, LogDriverName, , "Neo_VPN79" -HKR, NDIS, MajorNdisVersion, 1, 5 -HKR, NDIS, MinorNdisVersion, 1, 0 -HKR, Ndi\Interfaces, DefUpper, , "ndis5" -HKR, Ndi\Interfaces, UpperRange, , "ndis5" -HKR, Ndi\Interfaces, LowerRange, , "ethernet" -HKR, Ndi\Interfaces, DefLower, , "ethernet" -HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" -HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% -HKR, Ndi\Params\NetworkAddress, type, 0, "edit" -HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" -HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" -HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% -HKR, Ndi\Params\NetworkAddress, optional, 0, "0" -HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% -HKR, Ndi\Params\MaxSpeed, type, 0, "int" -HKR, Ndi\Params\MaxSpeed, default, 0, "100" -HKR, Ndi\Params\MaxSpeed, min, 0, "0" -HKR, Ndi\Params\MaxSpeed, max, 0, "2000" -HKR, Ndi\Params\MaxSpeed, step, 0, "1" -HKR, Ndi\Params\MaxSpeed, Base, 0, "10" -HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% -HKR, Ndi\Params\KeepLink, type, 0, "enum" -HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% -HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% -HKR, Ndi\Params\KeepLink, default, 0, "0" - - -[Neo.Service] -DisplayName = %Neo.Service.DispName% -Description = %Neo.Service.Desc% -ServiceType = 1 -StartType = 3 -ErrorControl = 1 -ServiceBinary = %12%\Neo_VPN79.sys -LoadOrderGroup = NDIS - -[Neo.Reg] -HKR, Ndi, Service, 0, Neo.Service.Name -HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" -HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" - -[Neo.EventLog] -HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN79.sys" -HKR, , TypesSupported, 0x00010001, 7 - -[Strings] -CompanyName = "SoftEther Corporation" -DiskDescription = "VPN Client Device Driver Install Disk" -Neo.Service.Name = "Neo_VPN79" -Neo.Service.DispName = "VPN Client Device Driver - VPN79" -Neo.Service.Desc = "VPN Client Adapter - VPN79" -NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN79" -Neo.EventLog.Name = "Neo" -NetworkAddress = "MAC Address" -DefaultAddress = "000001000001" -MaxSpeed = "Indicate Speed (Mbps)" -KeepLink = "Keep Link" -On = "On" -Off = "Off" - - -; Auto Generated 20180205_163608.835 - +; VPN Client Device Driver for Windows 2000 and Greater +; +; Copyright (c) SoftEther Corporation. All Rights Reserved. +; http://www.softether.co.jp/ +; +; BUILD 9658 + +[Version] +Signature = "$Windows NT$" +Class = Net +ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} +Provider = %CompanyName% +DriverVer = 02/04/2018, 4.25.0.9658 +CatalogFile.NT = inf_VPN79.cat + +[Manufacturer] +%CompanyName% = SoftEther + +[SourceDisksNames] +1=%DiskDescription%, "", , + +[SourceDisksFiles] +Neo_VPN79.sys = 1 + +[DestinationDirs] +DefaultDestDir = 12 +Neo.CopyFiles.Sys = 12 + +[Neo.CopyFiles.Sys] +Neo_VPN79.sys, , , 2 + +[SoftEther] +%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN79 + +[NeoAdapter.Install] +Characteristics = 0x1 +AddReg = Neo.Reg, NeoAdapter.Ndi +CopyFiles = Neo.CopyFiles.Sys +*IfType = 53 +*MediaType = 0 +*PhysicalMediaType = 0 + +[NeoAdapter.Install.Services] +AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% + +[NeoAdapter.Ndi] +HKR, , NetworkAddress, 0, %DefaultAddress% +HKR, Ndi, DeviceID, , "NeoAdapter_VPN79" +HKR, , DevLoader, , ndis +HKR, , DeviceVxDs, , Neo_VPN79.sys +HKR, NDIS, LogDriverName, , "Neo_VPN79" +HKR, NDIS, MajorNdisVersion, 1, 5 +HKR, NDIS, MinorNdisVersion, 1, 0 +HKR, Ndi\Interfaces, DefUpper, , "ndis5" +HKR, Ndi\Interfaces, UpperRange, , "ndis5" +HKR, Ndi\Interfaces, LowerRange, , "ethernet" +HKR, Ndi\Interfaces, DefLower, , "ethernet" +HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" +HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% +HKR, Ndi\Params\NetworkAddress, type, 0, "edit" +HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" +HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" +HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% +HKR, Ndi\Params\NetworkAddress, optional, 0, "0" +HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% +HKR, Ndi\Params\MaxSpeed, type, 0, "int" +HKR, Ndi\Params\MaxSpeed, default, 0, "100" +HKR, Ndi\Params\MaxSpeed, min, 0, "0" +HKR, Ndi\Params\MaxSpeed, max, 0, "2000" +HKR, Ndi\Params\MaxSpeed, step, 0, "1" +HKR, Ndi\Params\MaxSpeed, Base, 0, "10" +HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% +HKR, Ndi\Params\KeepLink, type, 0, "enum" +HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% +HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% +HKR, Ndi\Params\KeepLink, default, 0, "0" + + +[Neo.Service] +DisplayName = %Neo.Service.DispName% +Description = %Neo.Service.Desc% +ServiceType = 1 +StartType = 3 +ErrorControl = 1 +ServiceBinary = %12%\Neo_VPN79.sys +LoadOrderGroup = NDIS + +[Neo.Reg] +HKR, Ndi, Service, 0, Neo.Service.Name +HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" +HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" + +[Neo.EventLog] +HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN79.sys" +HKR, , TypesSupported, 0x00010001, 7 + +[Strings] +CompanyName = "SoftEther Corporation" +DiskDescription = "VPN Client Device Driver Install Disk" +Neo.Service.Name = "Neo_VPN79" +Neo.Service.DispName = "VPN Client Device Driver - VPN79" +Neo.Service.Desc = "VPN Client Adapter - VPN79" +NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN79" +Neo.EventLog.Name = "Neo" +NetworkAddress = "MAC Address" +DefaultAddress = "000001000001" +MaxSpeed = "Indicate Speed (Mbps)" +KeepLink = "Keep Link" +On = "On" +Off = "Off" + + +; Auto Generated 20180205_163608.835 + diff --git a/src/bin/hamcore/DriverPackages/Neo6_Win8/x86/Neo6_x86_VPN8.inf b/src/bin/hamcore/DriverPackages/Neo6_Win8/x86/Neo6_x86_VPN8.inf index 3ea0853c..f1fe6781 100644 --- a/src/bin/hamcore/DriverPackages/Neo6_Win8/x86/Neo6_x86_VPN8.inf +++ b/src/bin/hamcore/DriverPackages/Neo6_Win8/x86/Neo6_x86_VPN8.inf @@ -1,114 +1,114 @@ -; VPN Client Device Driver for Windows 2000 and Greater -; -; Copyright (c) SoftEther Corporation. All Rights Reserved. -; http://www.softether.co.jp/ -; -; BUILD 9658 - -[Version] -Signature = "$Windows NT$" -Class = Net -ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} -Provider = %CompanyName% -DriverVer = 02/04/2018, 4.25.0.9658 -CatalogFile.NT = inf_VPN8.cat - -[Manufacturer] -%CompanyName% = SoftEther - -[SourceDisksNames] -1=%DiskDescription%, "", , - -[SourceDisksFiles] -Neo_VPN8.sys = 1 - -[DestinationDirs] -DefaultDestDir = 12 -Neo.CopyFiles.Sys = 12 - -[Neo.CopyFiles.Sys] -Neo_VPN8.sys, , , 2 - -[SoftEther] -%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN8 - -[NeoAdapter.Install] -Characteristics = 0x1 -AddReg = Neo.Reg, NeoAdapter.Ndi -CopyFiles = Neo.CopyFiles.Sys -*IfType = 53 -*MediaType = 0 -*PhysicalMediaType = 0 - -[NeoAdapter.Install.Services] -AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% - -[NeoAdapter.Ndi] -HKR, , NetworkAddress, 0, %DefaultAddress% -HKR, Ndi, DeviceID, , "NeoAdapter_VPN8" -HKR, , DevLoader, , ndis -HKR, , DeviceVxDs, , Neo_VPN8.sys -HKR, NDIS, LogDriverName, , "Neo_VPN8" -HKR, NDIS, MajorNdisVersion, 1, 5 -HKR, NDIS, MinorNdisVersion, 1, 0 -HKR, Ndi\Interfaces, DefUpper, , "ndis5" -HKR, Ndi\Interfaces, UpperRange, , "ndis5" -HKR, Ndi\Interfaces, LowerRange, , "ethernet" -HKR, Ndi\Interfaces, DefLower, , "ethernet" -HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" -HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% -HKR, Ndi\Params\NetworkAddress, type, 0, "edit" -HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" -HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" -HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% -HKR, Ndi\Params\NetworkAddress, optional, 0, "0" -HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% -HKR, Ndi\Params\MaxSpeed, type, 0, "int" -HKR, Ndi\Params\MaxSpeed, default, 0, "100" -HKR, Ndi\Params\MaxSpeed, min, 0, "0" -HKR, Ndi\Params\MaxSpeed, max, 0, "2000" -HKR, Ndi\Params\MaxSpeed, step, 0, "1" -HKR, Ndi\Params\MaxSpeed, Base, 0, "10" -HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% -HKR, Ndi\Params\KeepLink, type, 0, "enum" -HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% -HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% -HKR, Ndi\Params\KeepLink, default, 0, "0" - - -[Neo.Service] -DisplayName = %Neo.Service.DispName% -Description = %Neo.Service.Desc% -ServiceType = 1 -StartType = 3 -ErrorControl = 1 -ServiceBinary = %12%\Neo_VPN8.sys -LoadOrderGroup = NDIS - -[Neo.Reg] -HKR, Ndi, Service, 0, Neo.Service.Name -HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" -HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" - -[Neo.EventLog] -HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN8.sys" -HKR, , TypesSupported, 0x00010001, 7 - -[Strings] -CompanyName = "SoftEther Corporation" -DiskDescription = "VPN Client Device Driver Install Disk" -Neo.Service.Name = "Neo_VPN8" -Neo.Service.DispName = "VPN Client Device Driver - VPN8" -Neo.Service.Desc = "VPN Client Adapter - VPN8" -NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN8" -Neo.EventLog.Name = "Neo" -NetworkAddress = "MAC Address" -DefaultAddress = "000001000001" -MaxSpeed = "Indicate Speed (Mbps)" -KeepLink = "Keep Link" -On = "On" -Off = "Off" - - -; Auto Generated 20180205_163608.756 - +; VPN Client Device Driver for Windows 2000 and Greater +; +; Copyright (c) SoftEther Corporation. All Rights Reserved. +; http://www.softether.co.jp/ +; +; BUILD 9658 + +[Version] +Signature = "$Windows NT$" +Class = Net +ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} +Provider = %CompanyName% +DriverVer = 02/04/2018, 4.25.0.9658 +CatalogFile.NT = inf_VPN8.cat + +[Manufacturer] +%CompanyName% = SoftEther + +[SourceDisksNames] +1=%DiskDescription%, "", , + +[SourceDisksFiles] +Neo_VPN8.sys = 1 + +[DestinationDirs] +DefaultDestDir = 12 +Neo.CopyFiles.Sys = 12 + +[Neo.CopyFiles.Sys] +Neo_VPN8.sys, , , 2 + +[SoftEther] +%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN8 + +[NeoAdapter.Install] +Characteristics = 0x1 +AddReg = Neo.Reg, NeoAdapter.Ndi +CopyFiles = Neo.CopyFiles.Sys +*IfType = 53 +*MediaType = 0 +*PhysicalMediaType = 0 + +[NeoAdapter.Install.Services] +AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% + +[NeoAdapter.Ndi] +HKR, , NetworkAddress, 0, %DefaultAddress% +HKR, Ndi, DeviceID, , "NeoAdapter_VPN8" +HKR, , DevLoader, , ndis +HKR, , DeviceVxDs, , Neo_VPN8.sys +HKR, NDIS, LogDriverName, , "Neo_VPN8" +HKR, NDIS, MajorNdisVersion, 1, 5 +HKR, NDIS, MinorNdisVersion, 1, 0 +HKR, Ndi\Interfaces, DefUpper, , "ndis5" +HKR, Ndi\Interfaces, UpperRange, , "ndis5" +HKR, Ndi\Interfaces, LowerRange, , "ethernet" +HKR, Ndi\Interfaces, DefLower, , "ethernet" +HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" +HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% +HKR, Ndi\Params\NetworkAddress, type, 0, "edit" +HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" +HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" +HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% +HKR, Ndi\Params\NetworkAddress, optional, 0, "0" +HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% +HKR, Ndi\Params\MaxSpeed, type, 0, "int" +HKR, Ndi\Params\MaxSpeed, default, 0, "100" +HKR, Ndi\Params\MaxSpeed, min, 0, "0" +HKR, Ndi\Params\MaxSpeed, max, 0, "2000" +HKR, Ndi\Params\MaxSpeed, step, 0, "1" +HKR, Ndi\Params\MaxSpeed, Base, 0, "10" +HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% +HKR, Ndi\Params\KeepLink, type, 0, "enum" +HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% +HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% +HKR, Ndi\Params\KeepLink, default, 0, "0" + + +[Neo.Service] +DisplayName = %Neo.Service.DispName% +Description = %Neo.Service.Desc% +ServiceType = 1 +StartType = 3 +ErrorControl = 1 +ServiceBinary = %12%\Neo_VPN8.sys +LoadOrderGroup = NDIS + +[Neo.Reg] +HKR, Ndi, Service, 0, Neo.Service.Name +HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" +HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" + +[Neo.EventLog] +HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN8.sys" +HKR, , TypesSupported, 0x00010001, 7 + +[Strings] +CompanyName = "SoftEther Corporation" +DiskDescription = "VPN Client Device Driver Install Disk" +Neo.Service.Name = "Neo_VPN8" +Neo.Service.DispName = "VPN Client Device Driver - VPN8" +Neo.Service.Desc = "VPN Client Adapter - VPN8" +NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN8" +Neo.EventLog.Name = "Neo" +NetworkAddress = "MAC Address" +DefaultAddress = "000001000001" +MaxSpeed = "Indicate Speed (Mbps)" +KeepLink = "Keep Link" +On = "On" +Off = "Off" + + +; Auto Generated 20180205_163608.756 + diff --git a/src/bin/hamcore/DriverPackages/Neo6_Win8/x86/Neo6_x86_VPN80.inf b/src/bin/hamcore/DriverPackages/Neo6_Win8/x86/Neo6_x86_VPN80.inf index 2f972756..f896b490 100644 --- a/src/bin/hamcore/DriverPackages/Neo6_Win8/x86/Neo6_x86_VPN80.inf +++ b/src/bin/hamcore/DriverPackages/Neo6_Win8/x86/Neo6_x86_VPN80.inf @@ -1,114 +1,114 @@ -; VPN Client Device Driver for Windows 2000 and Greater -; -; Copyright (c) SoftEther Corporation. All Rights Reserved. -; http://www.softether.co.jp/ -; -; BUILD 9658 - -[Version] -Signature = "$Windows NT$" -Class = Net -ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} -Provider = %CompanyName% -DriverVer = 02/04/2018, 4.25.0.9658 -CatalogFile.NT = inf_VPN80.cat - -[Manufacturer] -%CompanyName% = SoftEther - -[SourceDisksNames] -1=%DiskDescription%, "", , - -[SourceDisksFiles] -Neo_VPN80.sys = 1 - -[DestinationDirs] -DefaultDestDir = 12 -Neo.CopyFiles.Sys = 12 - -[Neo.CopyFiles.Sys] -Neo_VPN80.sys, , , 2 - -[SoftEther] -%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN80 - -[NeoAdapter.Install] -Characteristics = 0x1 -AddReg = Neo.Reg, NeoAdapter.Ndi -CopyFiles = Neo.CopyFiles.Sys -*IfType = 53 -*MediaType = 0 -*PhysicalMediaType = 0 - -[NeoAdapter.Install.Services] -AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% - -[NeoAdapter.Ndi] -HKR, , NetworkAddress, 0, %DefaultAddress% -HKR, Ndi, DeviceID, , "NeoAdapter_VPN80" -HKR, , DevLoader, , ndis -HKR, , DeviceVxDs, , Neo_VPN80.sys -HKR, NDIS, LogDriverName, , "Neo_VPN80" -HKR, NDIS, MajorNdisVersion, 1, 5 -HKR, NDIS, MinorNdisVersion, 1, 0 -HKR, Ndi\Interfaces, DefUpper, , "ndis5" -HKR, Ndi\Interfaces, UpperRange, , "ndis5" -HKR, Ndi\Interfaces, LowerRange, , "ethernet" -HKR, Ndi\Interfaces, DefLower, , "ethernet" -HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" -HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% -HKR, Ndi\Params\NetworkAddress, type, 0, "edit" -HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" -HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" -HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% -HKR, Ndi\Params\NetworkAddress, optional, 0, "0" -HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% -HKR, Ndi\Params\MaxSpeed, type, 0, "int" -HKR, Ndi\Params\MaxSpeed, default, 0, "100" -HKR, Ndi\Params\MaxSpeed, min, 0, "0" -HKR, Ndi\Params\MaxSpeed, max, 0, "2000" -HKR, Ndi\Params\MaxSpeed, step, 0, "1" -HKR, Ndi\Params\MaxSpeed, Base, 0, "10" -HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% -HKR, Ndi\Params\KeepLink, type, 0, "enum" -HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% -HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% -HKR, Ndi\Params\KeepLink, default, 0, "0" - - -[Neo.Service] -DisplayName = %Neo.Service.DispName% -Description = %Neo.Service.Desc% -ServiceType = 1 -StartType = 3 -ErrorControl = 1 -ServiceBinary = %12%\Neo_VPN80.sys -LoadOrderGroup = NDIS - -[Neo.Reg] -HKR, Ndi, Service, 0, Neo.Service.Name -HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" -HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" - -[Neo.EventLog] -HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN80.sys" -HKR, , TypesSupported, 0x00010001, 7 - -[Strings] -CompanyName = "SoftEther Corporation" -DiskDescription = "VPN Client Device Driver Install Disk" -Neo.Service.Name = "Neo_VPN80" -Neo.Service.DispName = "VPN Client Device Driver - VPN80" -Neo.Service.Desc = "VPN Client Adapter - VPN80" -NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN80" -Neo.EventLog.Name = "Neo" -NetworkAddress = "MAC Address" -DefaultAddress = "000001000001" -MaxSpeed = "Indicate Speed (Mbps)" -KeepLink = "Keep Link" -On = "On" -Off = "Off" - - -; Auto Generated 20180205_163608.836 - +; VPN Client Device Driver for Windows 2000 and Greater +; +; Copyright (c) SoftEther Corporation. All Rights Reserved. +; http://www.softether.co.jp/ +; +; BUILD 9658 + +[Version] +Signature = "$Windows NT$" +Class = Net +ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} +Provider = %CompanyName% +DriverVer = 02/04/2018, 4.25.0.9658 +CatalogFile.NT = inf_VPN80.cat + +[Manufacturer] +%CompanyName% = SoftEther + +[SourceDisksNames] +1=%DiskDescription%, "", , + +[SourceDisksFiles] +Neo_VPN80.sys = 1 + +[DestinationDirs] +DefaultDestDir = 12 +Neo.CopyFiles.Sys = 12 + +[Neo.CopyFiles.Sys] +Neo_VPN80.sys, , , 2 + +[SoftEther] +%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN80 + +[NeoAdapter.Install] +Characteristics = 0x1 +AddReg = Neo.Reg, NeoAdapter.Ndi +CopyFiles = Neo.CopyFiles.Sys +*IfType = 53 +*MediaType = 0 +*PhysicalMediaType = 0 + +[NeoAdapter.Install.Services] +AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% + +[NeoAdapter.Ndi] +HKR, , NetworkAddress, 0, %DefaultAddress% +HKR, Ndi, DeviceID, , "NeoAdapter_VPN80" +HKR, , DevLoader, , ndis +HKR, , DeviceVxDs, , Neo_VPN80.sys +HKR, NDIS, LogDriverName, , "Neo_VPN80" +HKR, NDIS, MajorNdisVersion, 1, 5 +HKR, NDIS, MinorNdisVersion, 1, 0 +HKR, Ndi\Interfaces, DefUpper, , "ndis5" +HKR, Ndi\Interfaces, UpperRange, , "ndis5" +HKR, Ndi\Interfaces, LowerRange, , "ethernet" +HKR, Ndi\Interfaces, DefLower, , "ethernet" +HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" +HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% +HKR, Ndi\Params\NetworkAddress, type, 0, "edit" +HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" +HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" +HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% +HKR, Ndi\Params\NetworkAddress, optional, 0, "0" +HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% +HKR, Ndi\Params\MaxSpeed, type, 0, "int" +HKR, Ndi\Params\MaxSpeed, default, 0, "100" +HKR, Ndi\Params\MaxSpeed, min, 0, "0" +HKR, Ndi\Params\MaxSpeed, max, 0, "2000" +HKR, Ndi\Params\MaxSpeed, step, 0, "1" +HKR, Ndi\Params\MaxSpeed, Base, 0, "10" +HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% +HKR, Ndi\Params\KeepLink, type, 0, "enum" +HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% +HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% +HKR, Ndi\Params\KeepLink, default, 0, "0" + + +[Neo.Service] +DisplayName = %Neo.Service.DispName% +Description = %Neo.Service.Desc% +ServiceType = 1 +StartType = 3 +ErrorControl = 1 +ServiceBinary = %12%\Neo_VPN80.sys +LoadOrderGroup = NDIS + +[Neo.Reg] +HKR, Ndi, Service, 0, Neo.Service.Name +HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" +HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" + +[Neo.EventLog] +HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN80.sys" +HKR, , TypesSupported, 0x00010001, 7 + +[Strings] +CompanyName = "SoftEther Corporation" +DiskDescription = "VPN Client Device Driver Install Disk" +Neo.Service.Name = "Neo_VPN80" +Neo.Service.DispName = "VPN Client Device Driver - VPN80" +Neo.Service.Desc = "VPN Client Adapter - VPN80" +NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN80" +Neo.EventLog.Name = "Neo" +NetworkAddress = "MAC Address" +DefaultAddress = "000001000001" +MaxSpeed = "Indicate Speed (Mbps)" +KeepLink = "Keep Link" +On = "On" +Off = "Off" + + +; Auto Generated 20180205_163608.836 + diff --git a/src/bin/hamcore/DriverPackages/Neo6_Win8/x86/Neo6_x86_VPN81.inf b/src/bin/hamcore/DriverPackages/Neo6_Win8/x86/Neo6_x86_VPN81.inf index 2823eb05..25e42679 100644 --- a/src/bin/hamcore/DriverPackages/Neo6_Win8/x86/Neo6_x86_VPN81.inf +++ b/src/bin/hamcore/DriverPackages/Neo6_Win8/x86/Neo6_x86_VPN81.inf @@ -1,114 +1,114 @@ -; VPN Client Device Driver for Windows 2000 and Greater -; -; Copyright (c) SoftEther Corporation. All Rights Reserved. -; http://www.softether.co.jp/ -; -; BUILD 9658 - -[Version] -Signature = "$Windows NT$" -Class = Net -ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} -Provider = %CompanyName% -DriverVer = 02/04/2018, 4.25.0.9658 -CatalogFile.NT = inf_VPN81.cat - -[Manufacturer] -%CompanyName% = SoftEther - -[SourceDisksNames] -1=%DiskDescription%, "", , - -[SourceDisksFiles] -Neo_VPN81.sys = 1 - -[DestinationDirs] -DefaultDestDir = 12 -Neo.CopyFiles.Sys = 12 - -[Neo.CopyFiles.Sys] -Neo_VPN81.sys, , , 2 - -[SoftEther] -%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN81 - -[NeoAdapter.Install] -Characteristics = 0x1 -AddReg = Neo.Reg, NeoAdapter.Ndi -CopyFiles = Neo.CopyFiles.Sys -*IfType = 53 -*MediaType = 0 -*PhysicalMediaType = 0 - -[NeoAdapter.Install.Services] -AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% - -[NeoAdapter.Ndi] -HKR, , NetworkAddress, 0, %DefaultAddress% -HKR, Ndi, DeviceID, , "NeoAdapter_VPN81" -HKR, , DevLoader, , ndis -HKR, , DeviceVxDs, , Neo_VPN81.sys -HKR, NDIS, LogDriverName, , "Neo_VPN81" -HKR, NDIS, MajorNdisVersion, 1, 5 -HKR, NDIS, MinorNdisVersion, 1, 0 -HKR, Ndi\Interfaces, DefUpper, , "ndis5" -HKR, Ndi\Interfaces, UpperRange, , "ndis5" -HKR, Ndi\Interfaces, LowerRange, , "ethernet" -HKR, Ndi\Interfaces, DefLower, , "ethernet" -HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" -HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% -HKR, Ndi\Params\NetworkAddress, type, 0, "edit" -HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" -HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" -HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% -HKR, Ndi\Params\NetworkAddress, optional, 0, "0" -HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% -HKR, Ndi\Params\MaxSpeed, type, 0, "int" -HKR, Ndi\Params\MaxSpeed, default, 0, "100" -HKR, Ndi\Params\MaxSpeed, min, 0, "0" -HKR, Ndi\Params\MaxSpeed, max, 0, "2000" -HKR, Ndi\Params\MaxSpeed, step, 0, "1" -HKR, Ndi\Params\MaxSpeed, Base, 0, "10" -HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% -HKR, Ndi\Params\KeepLink, type, 0, "enum" -HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% -HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% -HKR, Ndi\Params\KeepLink, default, 0, "0" - - -[Neo.Service] -DisplayName = %Neo.Service.DispName% -Description = %Neo.Service.Desc% -ServiceType = 1 -StartType = 3 -ErrorControl = 1 -ServiceBinary = %12%\Neo_VPN81.sys -LoadOrderGroup = NDIS - -[Neo.Reg] -HKR, Ndi, Service, 0, Neo.Service.Name -HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" -HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" - -[Neo.EventLog] -HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN81.sys" -HKR, , TypesSupported, 0x00010001, 7 - -[Strings] -CompanyName = "SoftEther Corporation" -DiskDescription = "VPN Client Device Driver Install Disk" -Neo.Service.Name = "Neo_VPN81" -Neo.Service.DispName = "VPN Client Device Driver - VPN81" -Neo.Service.Desc = "VPN Client Adapter - VPN81" -NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN81" -Neo.EventLog.Name = "Neo" -NetworkAddress = "MAC Address" -DefaultAddress = "000001000001" -MaxSpeed = "Indicate Speed (Mbps)" -KeepLink = "Keep Link" -On = "On" -Off = "Off" - - -; Auto Generated 20180205_163608.837 - +; VPN Client Device Driver for Windows 2000 and Greater +; +; Copyright (c) SoftEther Corporation. All Rights Reserved. +; http://www.softether.co.jp/ +; +; BUILD 9658 + +[Version] +Signature = "$Windows NT$" +Class = Net +ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} +Provider = %CompanyName% +DriverVer = 02/04/2018, 4.25.0.9658 +CatalogFile.NT = inf_VPN81.cat + +[Manufacturer] +%CompanyName% = SoftEther + +[SourceDisksNames] +1=%DiskDescription%, "", , + +[SourceDisksFiles] +Neo_VPN81.sys = 1 + +[DestinationDirs] +DefaultDestDir = 12 +Neo.CopyFiles.Sys = 12 + +[Neo.CopyFiles.Sys] +Neo_VPN81.sys, , , 2 + +[SoftEther] +%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN81 + +[NeoAdapter.Install] +Characteristics = 0x1 +AddReg = Neo.Reg, NeoAdapter.Ndi +CopyFiles = Neo.CopyFiles.Sys +*IfType = 53 +*MediaType = 0 +*PhysicalMediaType = 0 + +[NeoAdapter.Install.Services] +AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% + +[NeoAdapter.Ndi] +HKR, , NetworkAddress, 0, %DefaultAddress% +HKR, Ndi, DeviceID, , "NeoAdapter_VPN81" +HKR, , DevLoader, , ndis +HKR, , DeviceVxDs, , Neo_VPN81.sys +HKR, NDIS, LogDriverName, , "Neo_VPN81" +HKR, NDIS, MajorNdisVersion, 1, 5 +HKR, NDIS, MinorNdisVersion, 1, 0 +HKR, Ndi\Interfaces, DefUpper, , "ndis5" +HKR, Ndi\Interfaces, UpperRange, , "ndis5" +HKR, Ndi\Interfaces, LowerRange, , "ethernet" +HKR, Ndi\Interfaces, DefLower, , "ethernet" +HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" +HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% +HKR, Ndi\Params\NetworkAddress, type, 0, "edit" +HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" +HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" +HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% +HKR, Ndi\Params\NetworkAddress, optional, 0, "0" +HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% +HKR, Ndi\Params\MaxSpeed, type, 0, "int" +HKR, Ndi\Params\MaxSpeed, default, 0, "100" +HKR, Ndi\Params\MaxSpeed, min, 0, "0" +HKR, Ndi\Params\MaxSpeed, max, 0, "2000" +HKR, Ndi\Params\MaxSpeed, step, 0, "1" +HKR, Ndi\Params\MaxSpeed, Base, 0, "10" +HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% +HKR, Ndi\Params\KeepLink, type, 0, "enum" +HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% +HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% +HKR, Ndi\Params\KeepLink, default, 0, "0" + + +[Neo.Service] +DisplayName = %Neo.Service.DispName% +Description = %Neo.Service.Desc% +ServiceType = 1 +StartType = 3 +ErrorControl = 1 +ServiceBinary = %12%\Neo_VPN81.sys +LoadOrderGroup = NDIS + +[Neo.Reg] +HKR, Ndi, Service, 0, Neo.Service.Name +HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" +HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" + +[Neo.EventLog] +HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN81.sys" +HKR, , TypesSupported, 0x00010001, 7 + +[Strings] +CompanyName = "SoftEther Corporation" +DiskDescription = "VPN Client Device Driver Install Disk" +Neo.Service.Name = "Neo_VPN81" +Neo.Service.DispName = "VPN Client Device Driver - VPN81" +Neo.Service.Desc = "VPN Client Adapter - VPN81" +NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN81" +Neo.EventLog.Name = "Neo" +NetworkAddress = "MAC Address" +DefaultAddress = "000001000001" +MaxSpeed = "Indicate Speed (Mbps)" +KeepLink = "Keep Link" +On = "On" +Off = "Off" + + +; Auto Generated 20180205_163608.837 + diff --git a/src/bin/hamcore/DriverPackages/Neo6_Win8/x86/Neo6_x86_VPN82.inf b/src/bin/hamcore/DriverPackages/Neo6_Win8/x86/Neo6_x86_VPN82.inf index f32776b0..a167a9dc 100644 --- a/src/bin/hamcore/DriverPackages/Neo6_Win8/x86/Neo6_x86_VPN82.inf +++ b/src/bin/hamcore/DriverPackages/Neo6_Win8/x86/Neo6_x86_VPN82.inf @@ -1,114 +1,114 @@ -; VPN Client Device Driver for Windows 2000 and Greater -; -; Copyright (c) SoftEther Corporation. All Rights Reserved. -; http://www.softether.co.jp/ -; -; BUILD 9658 - -[Version] -Signature = "$Windows NT$" -Class = Net -ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} -Provider = %CompanyName% -DriverVer = 02/04/2018, 4.25.0.9658 -CatalogFile.NT = inf_VPN82.cat - -[Manufacturer] -%CompanyName% = SoftEther - -[SourceDisksNames] -1=%DiskDescription%, "", , - -[SourceDisksFiles] -Neo_VPN82.sys = 1 - -[DestinationDirs] -DefaultDestDir = 12 -Neo.CopyFiles.Sys = 12 - -[Neo.CopyFiles.Sys] -Neo_VPN82.sys, , , 2 - -[SoftEther] -%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN82 - -[NeoAdapter.Install] -Characteristics = 0x1 -AddReg = Neo.Reg, NeoAdapter.Ndi -CopyFiles = Neo.CopyFiles.Sys -*IfType = 53 -*MediaType = 0 -*PhysicalMediaType = 0 - -[NeoAdapter.Install.Services] -AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% - -[NeoAdapter.Ndi] -HKR, , NetworkAddress, 0, %DefaultAddress% -HKR, Ndi, DeviceID, , "NeoAdapter_VPN82" -HKR, , DevLoader, , ndis -HKR, , DeviceVxDs, , Neo_VPN82.sys -HKR, NDIS, LogDriverName, , "Neo_VPN82" -HKR, NDIS, MajorNdisVersion, 1, 5 -HKR, NDIS, MinorNdisVersion, 1, 0 -HKR, Ndi\Interfaces, DefUpper, , "ndis5" -HKR, Ndi\Interfaces, UpperRange, , "ndis5" -HKR, Ndi\Interfaces, LowerRange, , "ethernet" -HKR, Ndi\Interfaces, DefLower, , "ethernet" -HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" -HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% -HKR, Ndi\Params\NetworkAddress, type, 0, "edit" -HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" -HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" -HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% -HKR, Ndi\Params\NetworkAddress, optional, 0, "0" -HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% -HKR, Ndi\Params\MaxSpeed, type, 0, "int" -HKR, Ndi\Params\MaxSpeed, default, 0, "100" -HKR, Ndi\Params\MaxSpeed, min, 0, "0" -HKR, Ndi\Params\MaxSpeed, max, 0, "2000" -HKR, Ndi\Params\MaxSpeed, step, 0, "1" -HKR, Ndi\Params\MaxSpeed, Base, 0, "10" -HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% -HKR, Ndi\Params\KeepLink, type, 0, "enum" -HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% -HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% -HKR, Ndi\Params\KeepLink, default, 0, "0" - - -[Neo.Service] -DisplayName = %Neo.Service.DispName% -Description = %Neo.Service.Desc% -ServiceType = 1 -StartType = 3 -ErrorControl = 1 -ServiceBinary = %12%\Neo_VPN82.sys -LoadOrderGroup = NDIS - -[Neo.Reg] -HKR, Ndi, Service, 0, Neo.Service.Name -HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" -HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" - -[Neo.EventLog] -HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN82.sys" -HKR, , TypesSupported, 0x00010001, 7 - -[Strings] -CompanyName = "SoftEther Corporation" -DiskDescription = "VPN Client Device Driver Install Disk" -Neo.Service.Name = "Neo_VPN82" -Neo.Service.DispName = "VPN Client Device Driver - VPN82" -Neo.Service.Desc = "VPN Client Adapter - VPN82" -NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN82" -Neo.EventLog.Name = "Neo" -NetworkAddress = "MAC Address" -DefaultAddress = "000001000001" -MaxSpeed = "Indicate Speed (Mbps)" -KeepLink = "Keep Link" -On = "On" -Off = "Off" - - -; Auto Generated 20180205_163608.839 - +; VPN Client Device Driver for Windows 2000 and Greater +; +; Copyright (c) SoftEther Corporation. All Rights Reserved. +; http://www.softether.co.jp/ +; +; BUILD 9658 + +[Version] +Signature = "$Windows NT$" +Class = Net +ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} +Provider = %CompanyName% +DriverVer = 02/04/2018, 4.25.0.9658 +CatalogFile.NT = inf_VPN82.cat + +[Manufacturer] +%CompanyName% = SoftEther + +[SourceDisksNames] +1=%DiskDescription%, "", , + +[SourceDisksFiles] +Neo_VPN82.sys = 1 + +[DestinationDirs] +DefaultDestDir = 12 +Neo.CopyFiles.Sys = 12 + +[Neo.CopyFiles.Sys] +Neo_VPN82.sys, , , 2 + +[SoftEther] +%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN82 + +[NeoAdapter.Install] +Characteristics = 0x1 +AddReg = Neo.Reg, NeoAdapter.Ndi +CopyFiles = Neo.CopyFiles.Sys +*IfType = 53 +*MediaType = 0 +*PhysicalMediaType = 0 + +[NeoAdapter.Install.Services] +AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% + +[NeoAdapter.Ndi] +HKR, , NetworkAddress, 0, %DefaultAddress% +HKR, Ndi, DeviceID, , "NeoAdapter_VPN82" +HKR, , DevLoader, , ndis +HKR, , DeviceVxDs, , Neo_VPN82.sys +HKR, NDIS, LogDriverName, , "Neo_VPN82" +HKR, NDIS, MajorNdisVersion, 1, 5 +HKR, NDIS, MinorNdisVersion, 1, 0 +HKR, Ndi\Interfaces, DefUpper, , "ndis5" +HKR, Ndi\Interfaces, UpperRange, , "ndis5" +HKR, Ndi\Interfaces, LowerRange, , "ethernet" +HKR, Ndi\Interfaces, DefLower, , "ethernet" +HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" +HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% +HKR, Ndi\Params\NetworkAddress, type, 0, "edit" +HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" +HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" +HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% +HKR, Ndi\Params\NetworkAddress, optional, 0, "0" +HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% +HKR, Ndi\Params\MaxSpeed, type, 0, "int" +HKR, Ndi\Params\MaxSpeed, default, 0, "100" +HKR, Ndi\Params\MaxSpeed, min, 0, "0" +HKR, Ndi\Params\MaxSpeed, max, 0, "2000" +HKR, Ndi\Params\MaxSpeed, step, 0, "1" +HKR, Ndi\Params\MaxSpeed, Base, 0, "10" +HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% +HKR, Ndi\Params\KeepLink, type, 0, "enum" +HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% +HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% +HKR, Ndi\Params\KeepLink, default, 0, "0" + + +[Neo.Service] +DisplayName = %Neo.Service.DispName% +Description = %Neo.Service.Desc% +ServiceType = 1 +StartType = 3 +ErrorControl = 1 +ServiceBinary = %12%\Neo_VPN82.sys +LoadOrderGroup = NDIS + +[Neo.Reg] +HKR, Ndi, Service, 0, Neo.Service.Name +HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" +HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" + +[Neo.EventLog] +HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN82.sys" +HKR, , TypesSupported, 0x00010001, 7 + +[Strings] +CompanyName = "SoftEther Corporation" +DiskDescription = "VPN Client Device Driver Install Disk" +Neo.Service.Name = "Neo_VPN82" +Neo.Service.DispName = "VPN Client Device Driver - VPN82" +Neo.Service.Desc = "VPN Client Adapter - VPN82" +NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN82" +Neo.EventLog.Name = "Neo" +NetworkAddress = "MAC Address" +DefaultAddress = "000001000001" +MaxSpeed = "Indicate Speed (Mbps)" +KeepLink = "Keep Link" +On = "On" +Off = "Off" + + +; Auto Generated 20180205_163608.839 + diff --git a/src/bin/hamcore/DriverPackages/Neo6_Win8/x86/Neo6_x86_VPN83.inf b/src/bin/hamcore/DriverPackages/Neo6_Win8/x86/Neo6_x86_VPN83.inf index 488dd7ca..3537bead 100644 --- a/src/bin/hamcore/DriverPackages/Neo6_Win8/x86/Neo6_x86_VPN83.inf +++ b/src/bin/hamcore/DriverPackages/Neo6_Win8/x86/Neo6_x86_VPN83.inf @@ -1,114 +1,114 @@ -; VPN Client Device Driver for Windows 2000 and Greater -; -; Copyright (c) SoftEther Corporation. All Rights Reserved. -; http://www.softether.co.jp/ -; -; BUILD 9658 - -[Version] -Signature = "$Windows NT$" -Class = Net -ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} -Provider = %CompanyName% -DriverVer = 02/04/2018, 4.25.0.9658 -CatalogFile.NT = inf_VPN83.cat - -[Manufacturer] -%CompanyName% = SoftEther - -[SourceDisksNames] -1=%DiskDescription%, "", , - -[SourceDisksFiles] -Neo_VPN83.sys = 1 - -[DestinationDirs] -DefaultDestDir = 12 -Neo.CopyFiles.Sys = 12 - -[Neo.CopyFiles.Sys] -Neo_VPN83.sys, , , 2 - -[SoftEther] -%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN83 - -[NeoAdapter.Install] -Characteristics = 0x1 -AddReg = Neo.Reg, NeoAdapter.Ndi -CopyFiles = Neo.CopyFiles.Sys -*IfType = 53 -*MediaType = 0 -*PhysicalMediaType = 0 - -[NeoAdapter.Install.Services] -AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% - -[NeoAdapter.Ndi] -HKR, , NetworkAddress, 0, %DefaultAddress% -HKR, Ndi, DeviceID, , "NeoAdapter_VPN83" -HKR, , DevLoader, , ndis -HKR, , DeviceVxDs, , Neo_VPN83.sys -HKR, NDIS, LogDriverName, , "Neo_VPN83" -HKR, NDIS, MajorNdisVersion, 1, 5 -HKR, NDIS, MinorNdisVersion, 1, 0 -HKR, Ndi\Interfaces, DefUpper, , "ndis5" -HKR, Ndi\Interfaces, UpperRange, , "ndis5" -HKR, Ndi\Interfaces, LowerRange, , "ethernet" -HKR, Ndi\Interfaces, DefLower, , "ethernet" -HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" -HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% -HKR, Ndi\Params\NetworkAddress, type, 0, "edit" -HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" -HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" -HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% -HKR, Ndi\Params\NetworkAddress, optional, 0, "0" -HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% -HKR, Ndi\Params\MaxSpeed, type, 0, "int" -HKR, Ndi\Params\MaxSpeed, default, 0, "100" -HKR, Ndi\Params\MaxSpeed, min, 0, "0" -HKR, Ndi\Params\MaxSpeed, max, 0, "2000" -HKR, Ndi\Params\MaxSpeed, step, 0, "1" -HKR, Ndi\Params\MaxSpeed, Base, 0, "10" -HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% -HKR, Ndi\Params\KeepLink, type, 0, "enum" -HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% -HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% -HKR, Ndi\Params\KeepLink, default, 0, "0" - - -[Neo.Service] -DisplayName = %Neo.Service.DispName% -Description = %Neo.Service.Desc% -ServiceType = 1 -StartType = 3 -ErrorControl = 1 -ServiceBinary = %12%\Neo_VPN83.sys -LoadOrderGroup = NDIS - -[Neo.Reg] -HKR, Ndi, Service, 0, Neo.Service.Name -HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" -HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" - -[Neo.EventLog] -HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN83.sys" -HKR, , TypesSupported, 0x00010001, 7 - -[Strings] -CompanyName = "SoftEther Corporation" -DiskDescription = "VPN Client Device Driver Install Disk" -Neo.Service.Name = "Neo_VPN83" -Neo.Service.DispName = "VPN Client Device Driver - VPN83" -Neo.Service.Desc = "VPN Client Adapter - VPN83" -NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN83" -Neo.EventLog.Name = "Neo" -NetworkAddress = "MAC Address" -DefaultAddress = "000001000001" -MaxSpeed = "Indicate Speed (Mbps)" -KeepLink = "Keep Link" -On = "On" -Off = "Off" - - -; Auto Generated 20180205_163608.840 - +; VPN Client Device Driver for Windows 2000 and Greater +; +; Copyright (c) SoftEther Corporation. All Rights Reserved. +; http://www.softether.co.jp/ +; +; BUILD 9658 + +[Version] +Signature = "$Windows NT$" +Class = Net +ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} +Provider = %CompanyName% +DriverVer = 02/04/2018, 4.25.0.9658 +CatalogFile.NT = inf_VPN83.cat + +[Manufacturer] +%CompanyName% = SoftEther + +[SourceDisksNames] +1=%DiskDescription%, "", , + +[SourceDisksFiles] +Neo_VPN83.sys = 1 + +[DestinationDirs] +DefaultDestDir = 12 +Neo.CopyFiles.Sys = 12 + +[Neo.CopyFiles.Sys] +Neo_VPN83.sys, , , 2 + +[SoftEther] +%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN83 + +[NeoAdapter.Install] +Characteristics = 0x1 +AddReg = Neo.Reg, NeoAdapter.Ndi +CopyFiles = Neo.CopyFiles.Sys +*IfType = 53 +*MediaType = 0 +*PhysicalMediaType = 0 + +[NeoAdapter.Install.Services] +AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% + +[NeoAdapter.Ndi] +HKR, , NetworkAddress, 0, %DefaultAddress% +HKR, Ndi, DeviceID, , "NeoAdapter_VPN83" +HKR, , DevLoader, , ndis +HKR, , DeviceVxDs, , Neo_VPN83.sys +HKR, NDIS, LogDriverName, , "Neo_VPN83" +HKR, NDIS, MajorNdisVersion, 1, 5 +HKR, NDIS, MinorNdisVersion, 1, 0 +HKR, Ndi\Interfaces, DefUpper, , "ndis5" +HKR, Ndi\Interfaces, UpperRange, , "ndis5" +HKR, Ndi\Interfaces, LowerRange, , "ethernet" +HKR, Ndi\Interfaces, DefLower, , "ethernet" +HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" +HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% +HKR, Ndi\Params\NetworkAddress, type, 0, "edit" +HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" +HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" +HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% +HKR, Ndi\Params\NetworkAddress, optional, 0, "0" +HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% +HKR, Ndi\Params\MaxSpeed, type, 0, "int" +HKR, Ndi\Params\MaxSpeed, default, 0, "100" +HKR, Ndi\Params\MaxSpeed, min, 0, "0" +HKR, Ndi\Params\MaxSpeed, max, 0, "2000" +HKR, Ndi\Params\MaxSpeed, step, 0, "1" +HKR, Ndi\Params\MaxSpeed, Base, 0, "10" +HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% +HKR, Ndi\Params\KeepLink, type, 0, "enum" +HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% +HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% +HKR, Ndi\Params\KeepLink, default, 0, "0" + + +[Neo.Service] +DisplayName = %Neo.Service.DispName% +Description = %Neo.Service.Desc% +ServiceType = 1 +StartType = 3 +ErrorControl = 1 +ServiceBinary = %12%\Neo_VPN83.sys +LoadOrderGroup = NDIS + +[Neo.Reg] +HKR, Ndi, Service, 0, Neo.Service.Name +HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" +HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" + +[Neo.EventLog] +HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN83.sys" +HKR, , TypesSupported, 0x00010001, 7 + +[Strings] +CompanyName = "SoftEther Corporation" +DiskDescription = "VPN Client Device Driver Install Disk" +Neo.Service.Name = "Neo_VPN83" +Neo.Service.DispName = "VPN Client Device Driver - VPN83" +Neo.Service.Desc = "VPN Client Adapter - VPN83" +NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN83" +Neo.EventLog.Name = "Neo" +NetworkAddress = "MAC Address" +DefaultAddress = "000001000001" +MaxSpeed = "Indicate Speed (Mbps)" +KeepLink = "Keep Link" +On = "On" +Off = "Off" + + +; Auto Generated 20180205_163608.840 + diff --git a/src/bin/hamcore/DriverPackages/Neo6_Win8/x86/Neo6_x86_VPN84.inf b/src/bin/hamcore/DriverPackages/Neo6_Win8/x86/Neo6_x86_VPN84.inf index 24d38b10..23e7db7f 100644 --- a/src/bin/hamcore/DriverPackages/Neo6_Win8/x86/Neo6_x86_VPN84.inf +++ b/src/bin/hamcore/DriverPackages/Neo6_Win8/x86/Neo6_x86_VPN84.inf @@ -1,114 +1,114 @@ -; VPN Client Device Driver for Windows 2000 and Greater -; -; Copyright (c) SoftEther Corporation. All Rights Reserved. -; http://www.softether.co.jp/ -; -; BUILD 9658 - -[Version] -Signature = "$Windows NT$" -Class = Net -ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} -Provider = %CompanyName% -DriverVer = 02/04/2018, 4.25.0.9658 -CatalogFile.NT = inf_VPN84.cat - -[Manufacturer] -%CompanyName% = SoftEther - -[SourceDisksNames] -1=%DiskDescription%, "", , - -[SourceDisksFiles] -Neo_VPN84.sys = 1 - -[DestinationDirs] -DefaultDestDir = 12 -Neo.CopyFiles.Sys = 12 - -[Neo.CopyFiles.Sys] -Neo_VPN84.sys, , , 2 - -[SoftEther] -%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN84 - -[NeoAdapter.Install] -Characteristics = 0x1 -AddReg = Neo.Reg, NeoAdapter.Ndi -CopyFiles = Neo.CopyFiles.Sys -*IfType = 53 -*MediaType = 0 -*PhysicalMediaType = 0 - -[NeoAdapter.Install.Services] -AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% - -[NeoAdapter.Ndi] -HKR, , NetworkAddress, 0, %DefaultAddress% -HKR, Ndi, DeviceID, , "NeoAdapter_VPN84" -HKR, , DevLoader, , ndis -HKR, , DeviceVxDs, , Neo_VPN84.sys -HKR, NDIS, LogDriverName, , "Neo_VPN84" -HKR, NDIS, MajorNdisVersion, 1, 5 -HKR, NDIS, MinorNdisVersion, 1, 0 -HKR, Ndi\Interfaces, DefUpper, , "ndis5" -HKR, Ndi\Interfaces, UpperRange, , "ndis5" -HKR, Ndi\Interfaces, LowerRange, , "ethernet" -HKR, Ndi\Interfaces, DefLower, , "ethernet" -HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" -HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% -HKR, Ndi\Params\NetworkAddress, type, 0, "edit" -HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" -HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" -HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% -HKR, Ndi\Params\NetworkAddress, optional, 0, "0" -HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% -HKR, Ndi\Params\MaxSpeed, type, 0, "int" -HKR, Ndi\Params\MaxSpeed, default, 0, "100" -HKR, Ndi\Params\MaxSpeed, min, 0, "0" -HKR, Ndi\Params\MaxSpeed, max, 0, "2000" -HKR, Ndi\Params\MaxSpeed, step, 0, "1" -HKR, Ndi\Params\MaxSpeed, Base, 0, "10" -HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% -HKR, Ndi\Params\KeepLink, type, 0, "enum" -HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% -HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% -HKR, Ndi\Params\KeepLink, default, 0, "0" - - -[Neo.Service] -DisplayName = %Neo.Service.DispName% -Description = %Neo.Service.Desc% -ServiceType = 1 -StartType = 3 -ErrorControl = 1 -ServiceBinary = %12%\Neo_VPN84.sys -LoadOrderGroup = NDIS - -[Neo.Reg] -HKR, Ndi, Service, 0, Neo.Service.Name -HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" -HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" - -[Neo.EventLog] -HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN84.sys" -HKR, , TypesSupported, 0x00010001, 7 - -[Strings] -CompanyName = "SoftEther Corporation" -DiskDescription = "VPN Client Device Driver Install Disk" -Neo.Service.Name = "Neo_VPN84" -Neo.Service.DispName = "VPN Client Device Driver - VPN84" -Neo.Service.Desc = "VPN Client Adapter - VPN84" -NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN84" -Neo.EventLog.Name = "Neo" -NetworkAddress = "MAC Address" -DefaultAddress = "000001000001" -MaxSpeed = "Indicate Speed (Mbps)" -KeepLink = "Keep Link" -On = "On" -Off = "Off" - - -; Auto Generated 20180205_163608.841 - +; VPN Client Device Driver for Windows 2000 and Greater +; +; Copyright (c) SoftEther Corporation. All Rights Reserved. +; http://www.softether.co.jp/ +; +; BUILD 9658 + +[Version] +Signature = "$Windows NT$" +Class = Net +ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} +Provider = %CompanyName% +DriverVer = 02/04/2018, 4.25.0.9658 +CatalogFile.NT = inf_VPN84.cat + +[Manufacturer] +%CompanyName% = SoftEther + +[SourceDisksNames] +1=%DiskDescription%, "", , + +[SourceDisksFiles] +Neo_VPN84.sys = 1 + +[DestinationDirs] +DefaultDestDir = 12 +Neo.CopyFiles.Sys = 12 + +[Neo.CopyFiles.Sys] +Neo_VPN84.sys, , , 2 + +[SoftEther] +%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN84 + +[NeoAdapter.Install] +Characteristics = 0x1 +AddReg = Neo.Reg, NeoAdapter.Ndi +CopyFiles = Neo.CopyFiles.Sys +*IfType = 53 +*MediaType = 0 +*PhysicalMediaType = 0 + +[NeoAdapter.Install.Services] +AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% + +[NeoAdapter.Ndi] +HKR, , NetworkAddress, 0, %DefaultAddress% +HKR, Ndi, DeviceID, , "NeoAdapter_VPN84" +HKR, , DevLoader, , ndis +HKR, , DeviceVxDs, , Neo_VPN84.sys +HKR, NDIS, LogDriverName, , "Neo_VPN84" +HKR, NDIS, MajorNdisVersion, 1, 5 +HKR, NDIS, MinorNdisVersion, 1, 0 +HKR, Ndi\Interfaces, DefUpper, , "ndis5" +HKR, Ndi\Interfaces, UpperRange, , "ndis5" +HKR, Ndi\Interfaces, LowerRange, , "ethernet" +HKR, Ndi\Interfaces, DefLower, , "ethernet" +HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" +HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% +HKR, Ndi\Params\NetworkAddress, type, 0, "edit" +HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" +HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" +HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% +HKR, Ndi\Params\NetworkAddress, optional, 0, "0" +HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% +HKR, Ndi\Params\MaxSpeed, type, 0, "int" +HKR, Ndi\Params\MaxSpeed, default, 0, "100" +HKR, Ndi\Params\MaxSpeed, min, 0, "0" +HKR, Ndi\Params\MaxSpeed, max, 0, "2000" +HKR, Ndi\Params\MaxSpeed, step, 0, "1" +HKR, Ndi\Params\MaxSpeed, Base, 0, "10" +HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% +HKR, Ndi\Params\KeepLink, type, 0, "enum" +HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% +HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% +HKR, Ndi\Params\KeepLink, default, 0, "0" + + +[Neo.Service] +DisplayName = %Neo.Service.DispName% +Description = %Neo.Service.Desc% +ServiceType = 1 +StartType = 3 +ErrorControl = 1 +ServiceBinary = %12%\Neo_VPN84.sys +LoadOrderGroup = NDIS + +[Neo.Reg] +HKR, Ndi, Service, 0, Neo.Service.Name +HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" +HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" + +[Neo.EventLog] +HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN84.sys" +HKR, , TypesSupported, 0x00010001, 7 + +[Strings] +CompanyName = "SoftEther Corporation" +DiskDescription = "VPN Client Device Driver Install Disk" +Neo.Service.Name = "Neo_VPN84" +Neo.Service.DispName = "VPN Client Device Driver - VPN84" +Neo.Service.Desc = "VPN Client Adapter - VPN84" +NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN84" +Neo.EventLog.Name = "Neo" +NetworkAddress = "MAC Address" +DefaultAddress = "000001000001" +MaxSpeed = "Indicate Speed (Mbps)" +KeepLink = "Keep Link" +On = "On" +Off = "Off" + + +; Auto Generated 20180205_163608.841 + diff --git a/src/bin/hamcore/DriverPackages/Neo6_Win8/x86/Neo6_x86_VPN85.inf b/src/bin/hamcore/DriverPackages/Neo6_Win8/x86/Neo6_x86_VPN85.inf index c3a2bb0f..77bbdd15 100644 --- a/src/bin/hamcore/DriverPackages/Neo6_Win8/x86/Neo6_x86_VPN85.inf +++ b/src/bin/hamcore/DriverPackages/Neo6_Win8/x86/Neo6_x86_VPN85.inf @@ -1,114 +1,114 @@ -; VPN Client Device Driver for Windows 2000 and Greater -; -; Copyright (c) SoftEther Corporation. All Rights Reserved. -; http://www.softether.co.jp/ -; -; BUILD 9658 - -[Version] -Signature = "$Windows NT$" -Class = Net -ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} -Provider = %CompanyName% -DriverVer = 02/04/2018, 4.25.0.9658 -CatalogFile.NT = inf_VPN85.cat - -[Manufacturer] -%CompanyName% = SoftEther - -[SourceDisksNames] -1=%DiskDescription%, "", , - -[SourceDisksFiles] -Neo_VPN85.sys = 1 - -[DestinationDirs] -DefaultDestDir = 12 -Neo.CopyFiles.Sys = 12 - -[Neo.CopyFiles.Sys] -Neo_VPN85.sys, , , 2 - -[SoftEther] -%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN85 - -[NeoAdapter.Install] -Characteristics = 0x1 -AddReg = Neo.Reg, NeoAdapter.Ndi -CopyFiles = Neo.CopyFiles.Sys -*IfType = 53 -*MediaType = 0 -*PhysicalMediaType = 0 - -[NeoAdapter.Install.Services] -AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% - -[NeoAdapter.Ndi] -HKR, , NetworkAddress, 0, %DefaultAddress% -HKR, Ndi, DeviceID, , "NeoAdapter_VPN85" -HKR, , DevLoader, , ndis -HKR, , DeviceVxDs, , Neo_VPN85.sys -HKR, NDIS, LogDriverName, , "Neo_VPN85" -HKR, NDIS, MajorNdisVersion, 1, 5 -HKR, NDIS, MinorNdisVersion, 1, 0 -HKR, Ndi\Interfaces, DefUpper, , "ndis5" -HKR, Ndi\Interfaces, UpperRange, , "ndis5" -HKR, Ndi\Interfaces, LowerRange, , "ethernet" -HKR, Ndi\Interfaces, DefLower, , "ethernet" -HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" -HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% -HKR, Ndi\Params\NetworkAddress, type, 0, "edit" -HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" -HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" -HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% -HKR, Ndi\Params\NetworkAddress, optional, 0, "0" -HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% -HKR, Ndi\Params\MaxSpeed, type, 0, "int" -HKR, Ndi\Params\MaxSpeed, default, 0, "100" -HKR, Ndi\Params\MaxSpeed, min, 0, "0" -HKR, Ndi\Params\MaxSpeed, max, 0, "2000" -HKR, Ndi\Params\MaxSpeed, step, 0, "1" -HKR, Ndi\Params\MaxSpeed, Base, 0, "10" -HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% -HKR, Ndi\Params\KeepLink, type, 0, "enum" -HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% -HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% -HKR, Ndi\Params\KeepLink, default, 0, "0" - - -[Neo.Service] -DisplayName = %Neo.Service.DispName% -Description = %Neo.Service.Desc% -ServiceType = 1 -StartType = 3 -ErrorControl = 1 -ServiceBinary = %12%\Neo_VPN85.sys -LoadOrderGroup = NDIS - -[Neo.Reg] -HKR, Ndi, Service, 0, Neo.Service.Name -HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" -HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" - -[Neo.EventLog] -HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN85.sys" -HKR, , TypesSupported, 0x00010001, 7 - -[Strings] -CompanyName = "SoftEther Corporation" -DiskDescription = "VPN Client Device Driver Install Disk" -Neo.Service.Name = "Neo_VPN85" -Neo.Service.DispName = "VPN Client Device Driver - VPN85" -Neo.Service.Desc = "VPN Client Adapter - VPN85" -NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN85" -Neo.EventLog.Name = "Neo" -NetworkAddress = "MAC Address" -DefaultAddress = "000001000001" -MaxSpeed = "Indicate Speed (Mbps)" -KeepLink = "Keep Link" -On = "On" -Off = "Off" - - -; Auto Generated 20180205_163608.842 - +; VPN Client Device Driver for Windows 2000 and Greater +; +; Copyright (c) SoftEther Corporation. All Rights Reserved. +; http://www.softether.co.jp/ +; +; BUILD 9658 + +[Version] +Signature = "$Windows NT$" +Class = Net +ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} +Provider = %CompanyName% +DriverVer = 02/04/2018, 4.25.0.9658 +CatalogFile.NT = inf_VPN85.cat + +[Manufacturer] +%CompanyName% = SoftEther + +[SourceDisksNames] +1=%DiskDescription%, "", , + +[SourceDisksFiles] +Neo_VPN85.sys = 1 + +[DestinationDirs] +DefaultDestDir = 12 +Neo.CopyFiles.Sys = 12 + +[Neo.CopyFiles.Sys] +Neo_VPN85.sys, , , 2 + +[SoftEther] +%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN85 + +[NeoAdapter.Install] +Characteristics = 0x1 +AddReg = Neo.Reg, NeoAdapter.Ndi +CopyFiles = Neo.CopyFiles.Sys +*IfType = 53 +*MediaType = 0 +*PhysicalMediaType = 0 + +[NeoAdapter.Install.Services] +AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% + +[NeoAdapter.Ndi] +HKR, , NetworkAddress, 0, %DefaultAddress% +HKR, Ndi, DeviceID, , "NeoAdapter_VPN85" +HKR, , DevLoader, , ndis +HKR, , DeviceVxDs, , Neo_VPN85.sys +HKR, NDIS, LogDriverName, , "Neo_VPN85" +HKR, NDIS, MajorNdisVersion, 1, 5 +HKR, NDIS, MinorNdisVersion, 1, 0 +HKR, Ndi\Interfaces, DefUpper, , "ndis5" +HKR, Ndi\Interfaces, UpperRange, , "ndis5" +HKR, Ndi\Interfaces, LowerRange, , "ethernet" +HKR, Ndi\Interfaces, DefLower, , "ethernet" +HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" +HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% +HKR, Ndi\Params\NetworkAddress, type, 0, "edit" +HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" +HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" +HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% +HKR, Ndi\Params\NetworkAddress, optional, 0, "0" +HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% +HKR, Ndi\Params\MaxSpeed, type, 0, "int" +HKR, Ndi\Params\MaxSpeed, default, 0, "100" +HKR, Ndi\Params\MaxSpeed, min, 0, "0" +HKR, Ndi\Params\MaxSpeed, max, 0, "2000" +HKR, Ndi\Params\MaxSpeed, step, 0, "1" +HKR, Ndi\Params\MaxSpeed, Base, 0, "10" +HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% +HKR, Ndi\Params\KeepLink, type, 0, "enum" +HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% +HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% +HKR, Ndi\Params\KeepLink, default, 0, "0" + + +[Neo.Service] +DisplayName = %Neo.Service.DispName% +Description = %Neo.Service.Desc% +ServiceType = 1 +StartType = 3 +ErrorControl = 1 +ServiceBinary = %12%\Neo_VPN85.sys +LoadOrderGroup = NDIS + +[Neo.Reg] +HKR, Ndi, Service, 0, Neo.Service.Name +HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" +HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" + +[Neo.EventLog] +HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN85.sys" +HKR, , TypesSupported, 0x00010001, 7 + +[Strings] +CompanyName = "SoftEther Corporation" +DiskDescription = "VPN Client Device Driver Install Disk" +Neo.Service.Name = "Neo_VPN85" +Neo.Service.DispName = "VPN Client Device Driver - VPN85" +Neo.Service.Desc = "VPN Client Adapter - VPN85" +NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN85" +Neo.EventLog.Name = "Neo" +NetworkAddress = "MAC Address" +DefaultAddress = "000001000001" +MaxSpeed = "Indicate Speed (Mbps)" +KeepLink = "Keep Link" +On = "On" +Off = "Off" + + +; Auto Generated 20180205_163608.842 + diff --git a/src/bin/hamcore/DriverPackages/Neo6_Win8/x86/Neo6_x86_VPN86.inf b/src/bin/hamcore/DriverPackages/Neo6_Win8/x86/Neo6_x86_VPN86.inf index 24668852..25abbff3 100644 --- a/src/bin/hamcore/DriverPackages/Neo6_Win8/x86/Neo6_x86_VPN86.inf +++ b/src/bin/hamcore/DriverPackages/Neo6_Win8/x86/Neo6_x86_VPN86.inf @@ -1,114 +1,114 @@ -; VPN Client Device Driver for Windows 2000 and Greater -; -; Copyright (c) SoftEther Corporation. All Rights Reserved. -; http://www.softether.co.jp/ -; -; BUILD 9658 - -[Version] -Signature = "$Windows NT$" -Class = Net -ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} -Provider = %CompanyName% -DriverVer = 02/04/2018, 4.25.0.9658 -CatalogFile.NT = inf_VPN86.cat - -[Manufacturer] -%CompanyName% = SoftEther - -[SourceDisksNames] -1=%DiskDescription%, "", , - -[SourceDisksFiles] -Neo_VPN86.sys = 1 - -[DestinationDirs] -DefaultDestDir = 12 -Neo.CopyFiles.Sys = 12 - -[Neo.CopyFiles.Sys] -Neo_VPN86.sys, , , 2 - -[SoftEther] -%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN86 - -[NeoAdapter.Install] -Characteristics = 0x1 -AddReg = Neo.Reg, NeoAdapter.Ndi -CopyFiles = Neo.CopyFiles.Sys -*IfType = 53 -*MediaType = 0 -*PhysicalMediaType = 0 - -[NeoAdapter.Install.Services] -AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% - -[NeoAdapter.Ndi] -HKR, , NetworkAddress, 0, %DefaultAddress% -HKR, Ndi, DeviceID, , "NeoAdapter_VPN86" -HKR, , DevLoader, , ndis -HKR, , DeviceVxDs, , Neo_VPN86.sys -HKR, NDIS, LogDriverName, , "Neo_VPN86" -HKR, NDIS, MajorNdisVersion, 1, 5 -HKR, NDIS, MinorNdisVersion, 1, 0 -HKR, Ndi\Interfaces, DefUpper, , "ndis5" -HKR, Ndi\Interfaces, UpperRange, , "ndis5" -HKR, Ndi\Interfaces, LowerRange, , "ethernet" -HKR, Ndi\Interfaces, DefLower, , "ethernet" -HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" -HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% -HKR, Ndi\Params\NetworkAddress, type, 0, "edit" -HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" -HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" -HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% -HKR, Ndi\Params\NetworkAddress, optional, 0, "0" -HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% -HKR, Ndi\Params\MaxSpeed, type, 0, "int" -HKR, Ndi\Params\MaxSpeed, default, 0, "100" -HKR, Ndi\Params\MaxSpeed, min, 0, "0" -HKR, Ndi\Params\MaxSpeed, max, 0, "2000" -HKR, Ndi\Params\MaxSpeed, step, 0, "1" -HKR, Ndi\Params\MaxSpeed, Base, 0, "10" -HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% -HKR, Ndi\Params\KeepLink, type, 0, "enum" -HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% -HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% -HKR, Ndi\Params\KeepLink, default, 0, "0" - - -[Neo.Service] -DisplayName = %Neo.Service.DispName% -Description = %Neo.Service.Desc% -ServiceType = 1 -StartType = 3 -ErrorControl = 1 -ServiceBinary = %12%\Neo_VPN86.sys -LoadOrderGroup = NDIS - -[Neo.Reg] -HKR, Ndi, Service, 0, Neo.Service.Name -HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" -HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" - -[Neo.EventLog] -HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN86.sys" -HKR, , TypesSupported, 0x00010001, 7 - -[Strings] -CompanyName = "SoftEther Corporation" -DiskDescription = "VPN Client Device Driver Install Disk" -Neo.Service.Name = "Neo_VPN86" -Neo.Service.DispName = "VPN Client Device Driver - VPN86" -Neo.Service.Desc = "VPN Client Adapter - VPN86" -NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN86" -Neo.EventLog.Name = "Neo" -NetworkAddress = "MAC Address" -DefaultAddress = "000001000001" -MaxSpeed = "Indicate Speed (Mbps)" -KeepLink = "Keep Link" -On = "On" -Off = "Off" - - -; Auto Generated 20180205_163608.843 - +; VPN Client Device Driver for Windows 2000 and Greater +; +; Copyright (c) SoftEther Corporation. All Rights Reserved. +; http://www.softether.co.jp/ +; +; BUILD 9658 + +[Version] +Signature = "$Windows NT$" +Class = Net +ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} +Provider = %CompanyName% +DriverVer = 02/04/2018, 4.25.0.9658 +CatalogFile.NT = inf_VPN86.cat + +[Manufacturer] +%CompanyName% = SoftEther + +[SourceDisksNames] +1=%DiskDescription%, "", , + +[SourceDisksFiles] +Neo_VPN86.sys = 1 + +[DestinationDirs] +DefaultDestDir = 12 +Neo.CopyFiles.Sys = 12 + +[Neo.CopyFiles.Sys] +Neo_VPN86.sys, , , 2 + +[SoftEther] +%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN86 + +[NeoAdapter.Install] +Characteristics = 0x1 +AddReg = Neo.Reg, NeoAdapter.Ndi +CopyFiles = Neo.CopyFiles.Sys +*IfType = 53 +*MediaType = 0 +*PhysicalMediaType = 0 + +[NeoAdapter.Install.Services] +AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% + +[NeoAdapter.Ndi] +HKR, , NetworkAddress, 0, %DefaultAddress% +HKR, Ndi, DeviceID, , "NeoAdapter_VPN86" +HKR, , DevLoader, , ndis +HKR, , DeviceVxDs, , Neo_VPN86.sys +HKR, NDIS, LogDriverName, , "Neo_VPN86" +HKR, NDIS, MajorNdisVersion, 1, 5 +HKR, NDIS, MinorNdisVersion, 1, 0 +HKR, Ndi\Interfaces, DefUpper, , "ndis5" +HKR, Ndi\Interfaces, UpperRange, , "ndis5" +HKR, Ndi\Interfaces, LowerRange, , "ethernet" +HKR, Ndi\Interfaces, DefLower, , "ethernet" +HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" +HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% +HKR, Ndi\Params\NetworkAddress, type, 0, "edit" +HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" +HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" +HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% +HKR, Ndi\Params\NetworkAddress, optional, 0, "0" +HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% +HKR, Ndi\Params\MaxSpeed, type, 0, "int" +HKR, Ndi\Params\MaxSpeed, default, 0, "100" +HKR, Ndi\Params\MaxSpeed, min, 0, "0" +HKR, Ndi\Params\MaxSpeed, max, 0, "2000" +HKR, Ndi\Params\MaxSpeed, step, 0, "1" +HKR, Ndi\Params\MaxSpeed, Base, 0, "10" +HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% +HKR, Ndi\Params\KeepLink, type, 0, "enum" +HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% +HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% +HKR, Ndi\Params\KeepLink, default, 0, "0" + + +[Neo.Service] +DisplayName = %Neo.Service.DispName% +Description = %Neo.Service.Desc% +ServiceType = 1 +StartType = 3 +ErrorControl = 1 +ServiceBinary = %12%\Neo_VPN86.sys +LoadOrderGroup = NDIS + +[Neo.Reg] +HKR, Ndi, Service, 0, Neo.Service.Name +HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" +HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" + +[Neo.EventLog] +HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN86.sys" +HKR, , TypesSupported, 0x00010001, 7 + +[Strings] +CompanyName = "SoftEther Corporation" +DiskDescription = "VPN Client Device Driver Install Disk" +Neo.Service.Name = "Neo_VPN86" +Neo.Service.DispName = "VPN Client Device Driver - VPN86" +Neo.Service.Desc = "VPN Client Adapter - VPN86" +NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN86" +Neo.EventLog.Name = "Neo" +NetworkAddress = "MAC Address" +DefaultAddress = "000001000001" +MaxSpeed = "Indicate Speed (Mbps)" +KeepLink = "Keep Link" +On = "On" +Off = "Off" + + +; Auto Generated 20180205_163608.843 + diff --git a/src/bin/hamcore/DriverPackages/Neo6_Win8/x86/Neo6_x86_VPN87.inf b/src/bin/hamcore/DriverPackages/Neo6_Win8/x86/Neo6_x86_VPN87.inf index c130126a..88cb644d 100644 --- a/src/bin/hamcore/DriverPackages/Neo6_Win8/x86/Neo6_x86_VPN87.inf +++ b/src/bin/hamcore/DriverPackages/Neo6_Win8/x86/Neo6_x86_VPN87.inf @@ -1,114 +1,114 @@ -; VPN Client Device Driver for Windows 2000 and Greater -; -; Copyright (c) SoftEther Corporation. All Rights Reserved. -; http://www.softether.co.jp/ -; -; BUILD 9658 - -[Version] -Signature = "$Windows NT$" -Class = Net -ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} -Provider = %CompanyName% -DriverVer = 02/04/2018, 4.25.0.9658 -CatalogFile.NT = inf_VPN87.cat - -[Manufacturer] -%CompanyName% = SoftEther - -[SourceDisksNames] -1=%DiskDescription%, "", , - -[SourceDisksFiles] -Neo_VPN87.sys = 1 - -[DestinationDirs] -DefaultDestDir = 12 -Neo.CopyFiles.Sys = 12 - -[Neo.CopyFiles.Sys] -Neo_VPN87.sys, , , 2 - -[SoftEther] -%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN87 - -[NeoAdapter.Install] -Characteristics = 0x1 -AddReg = Neo.Reg, NeoAdapter.Ndi -CopyFiles = Neo.CopyFiles.Sys -*IfType = 53 -*MediaType = 0 -*PhysicalMediaType = 0 - -[NeoAdapter.Install.Services] -AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% - -[NeoAdapter.Ndi] -HKR, , NetworkAddress, 0, %DefaultAddress% -HKR, Ndi, DeviceID, , "NeoAdapter_VPN87" -HKR, , DevLoader, , ndis -HKR, , DeviceVxDs, , Neo_VPN87.sys -HKR, NDIS, LogDriverName, , "Neo_VPN87" -HKR, NDIS, MajorNdisVersion, 1, 5 -HKR, NDIS, MinorNdisVersion, 1, 0 -HKR, Ndi\Interfaces, DefUpper, , "ndis5" -HKR, Ndi\Interfaces, UpperRange, , "ndis5" -HKR, Ndi\Interfaces, LowerRange, , "ethernet" -HKR, Ndi\Interfaces, DefLower, , "ethernet" -HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" -HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% -HKR, Ndi\Params\NetworkAddress, type, 0, "edit" -HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" -HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" -HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% -HKR, Ndi\Params\NetworkAddress, optional, 0, "0" -HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% -HKR, Ndi\Params\MaxSpeed, type, 0, "int" -HKR, Ndi\Params\MaxSpeed, default, 0, "100" -HKR, Ndi\Params\MaxSpeed, min, 0, "0" -HKR, Ndi\Params\MaxSpeed, max, 0, "2000" -HKR, Ndi\Params\MaxSpeed, step, 0, "1" -HKR, Ndi\Params\MaxSpeed, Base, 0, "10" -HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% -HKR, Ndi\Params\KeepLink, type, 0, "enum" -HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% -HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% -HKR, Ndi\Params\KeepLink, default, 0, "0" - - -[Neo.Service] -DisplayName = %Neo.Service.DispName% -Description = %Neo.Service.Desc% -ServiceType = 1 -StartType = 3 -ErrorControl = 1 -ServiceBinary = %12%\Neo_VPN87.sys -LoadOrderGroup = NDIS - -[Neo.Reg] -HKR, Ndi, Service, 0, Neo.Service.Name -HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" -HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" - -[Neo.EventLog] -HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN87.sys" -HKR, , TypesSupported, 0x00010001, 7 - -[Strings] -CompanyName = "SoftEther Corporation" -DiskDescription = "VPN Client Device Driver Install Disk" -Neo.Service.Name = "Neo_VPN87" -Neo.Service.DispName = "VPN Client Device Driver - VPN87" -Neo.Service.Desc = "VPN Client Adapter - VPN87" -NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN87" -Neo.EventLog.Name = "Neo" -NetworkAddress = "MAC Address" -DefaultAddress = "000001000001" -MaxSpeed = "Indicate Speed (Mbps)" -KeepLink = "Keep Link" -On = "On" -Off = "Off" - - -; Auto Generated 20180205_163608.844 - +; VPN Client Device Driver for Windows 2000 and Greater +; +; Copyright (c) SoftEther Corporation. All Rights Reserved. +; http://www.softether.co.jp/ +; +; BUILD 9658 + +[Version] +Signature = "$Windows NT$" +Class = Net +ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} +Provider = %CompanyName% +DriverVer = 02/04/2018, 4.25.0.9658 +CatalogFile.NT = inf_VPN87.cat + +[Manufacturer] +%CompanyName% = SoftEther + +[SourceDisksNames] +1=%DiskDescription%, "", , + +[SourceDisksFiles] +Neo_VPN87.sys = 1 + +[DestinationDirs] +DefaultDestDir = 12 +Neo.CopyFiles.Sys = 12 + +[Neo.CopyFiles.Sys] +Neo_VPN87.sys, , , 2 + +[SoftEther] +%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN87 + +[NeoAdapter.Install] +Characteristics = 0x1 +AddReg = Neo.Reg, NeoAdapter.Ndi +CopyFiles = Neo.CopyFiles.Sys +*IfType = 53 +*MediaType = 0 +*PhysicalMediaType = 0 + +[NeoAdapter.Install.Services] +AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% + +[NeoAdapter.Ndi] +HKR, , NetworkAddress, 0, %DefaultAddress% +HKR, Ndi, DeviceID, , "NeoAdapter_VPN87" +HKR, , DevLoader, , ndis +HKR, , DeviceVxDs, , Neo_VPN87.sys +HKR, NDIS, LogDriverName, , "Neo_VPN87" +HKR, NDIS, MajorNdisVersion, 1, 5 +HKR, NDIS, MinorNdisVersion, 1, 0 +HKR, Ndi\Interfaces, DefUpper, , "ndis5" +HKR, Ndi\Interfaces, UpperRange, , "ndis5" +HKR, Ndi\Interfaces, LowerRange, , "ethernet" +HKR, Ndi\Interfaces, DefLower, , "ethernet" +HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" +HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% +HKR, Ndi\Params\NetworkAddress, type, 0, "edit" +HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" +HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" +HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% +HKR, Ndi\Params\NetworkAddress, optional, 0, "0" +HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% +HKR, Ndi\Params\MaxSpeed, type, 0, "int" +HKR, Ndi\Params\MaxSpeed, default, 0, "100" +HKR, Ndi\Params\MaxSpeed, min, 0, "0" +HKR, Ndi\Params\MaxSpeed, max, 0, "2000" +HKR, Ndi\Params\MaxSpeed, step, 0, "1" +HKR, Ndi\Params\MaxSpeed, Base, 0, "10" +HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% +HKR, Ndi\Params\KeepLink, type, 0, "enum" +HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% +HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% +HKR, Ndi\Params\KeepLink, default, 0, "0" + + +[Neo.Service] +DisplayName = %Neo.Service.DispName% +Description = %Neo.Service.Desc% +ServiceType = 1 +StartType = 3 +ErrorControl = 1 +ServiceBinary = %12%\Neo_VPN87.sys +LoadOrderGroup = NDIS + +[Neo.Reg] +HKR, Ndi, Service, 0, Neo.Service.Name +HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" +HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" + +[Neo.EventLog] +HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN87.sys" +HKR, , TypesSupported, 0x00010001, 7 + +[Strings] +CompanyName = "SoftEther Corporation" +DiskDescription = "VPN Client Device Driver Install Disk" +Neo.Service.Name = "Neo_VPN87" +Neo.Service.DispName = "VPN Client Device Driver - VPN87" +Neo.Service.Desc = "VPN Client Adapter - VPN87" +NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN87" +Neo.EventLog.Name = "Neo" +NetworkAddress = "MAC Address" +DefaultAddress = "000001000001" +MaxSpeed = "Indicate Speed (Mbps)" +KeepLink = "Keep Link" +On = "On" +Off = "Off" + + +; Auto Generated 20180205_163608.844 + diff --git a/src/bin/hamcore/DriverPackages/Neo6_Win8/x86/Neo6_x86_VPN88.inf b/src/bin/hamcore/DriverPackages/Neo6_Win8/x86/Neo6_x86_VPN88.inf index 1d3f4b9f..fa8bb25c 100644 --- a/src/bin/hamcore/DriverPackages/Neo6_Win8/x86/Neo6_x86_VPN88.inf +++ b/src/bin/hamcore/DriverPackages/Neo6_Win8/x86/Neo6_x86_VPN88.inf @@ -1,114 +1,114 @@ -; VPN Client Device Driver for Windows 2000 and Greater -; -; Copyright (c) SoftEther Corporation. All Rights Reserved. -; http://www.softether.co.jp/ -; -; BUILD 9658 - -[Version] -Signature = "$Windows NT$" -Class = Net -ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} -Provider = %CompanyName% -DriverVer = 02/04/2018, 4.25.0.9658 -CatalogFile.NT = inf_VPN88.cat - -[Manufacturer] -%CompanyName% = SoftEther - -[SourceDisksNames] -1=%DiskDescription%, "", , - -[SourceDisksFiles] -Neo_VPN88.sys = 1 - -[DestinationDirs] -DefaultDestDir = 12 -Neo.CopyFiles.Sys = 12 - -[Neo.CopyFiles.Sys] -Neo_VPN88.sys, , , 2 - -[SoftEther] -%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN88 - -[NeoAdapter.Install] -Characteristics = 0x1 -AddReg = Neo.Reg, NeoAdapter.Ndi -CopyFiles = Neo.CopyFiles.Sys -*IfType = 53 -*MediaType = 0 -*PhysicalMediaType = 0 - -[NeoAdapter.Install.Services] -AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% - -[NeoAdapter.Ndi] -HKR, , NetworkAddress, 0, %DefaultAddress% -HKR, Ndi, DeviceID, , "NeoAdapter_VPN88" -HKR, , DevLoader, , ndis -HKR, , DeviceVxDs, , Neo_VPN88.sys -HKR, NDIS, LogDriverName, , "Neo_VPN88" -HKR, NDIS, MajorNdisVersion, 1, 5 -HKR, NDIS, MinorNdisVersion, 1, 0 -HKR, Ndi\Interfaces, DefUpper, , "ndis5" -HKR, Ndi\Interfaces, UpperRange, , "ndis5" -HKR, Ndi\Interfaces, LowerRange, , "ethernet" -HKR, Ndi\Interfaces, DefLower, , "ethernet" -HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" -HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% -HKR, Ndi\Params\NetworkAddress, type, 0, "edit" -HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" -HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" -HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% -HKR, Ndi\Params\NetworkAddress, optional, 0, "0" -HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% -HKR, Ndi\Params\MaxSpeed, type, 0, "int" -HKR, Ndi\Params\MaxSpeed, default, 0, "100" -HKR, Ndi\Params\MaxSpeed, min, 0, "0" -HKR, Ndi\Params\MaxSpeed, max, 0, "2000" -HKR, Ndi\Params\MaxSpeed, step, 0, "1" -HKR, Ndi\Params\MaxSpeed, Base, 0, "10" -HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% -HKR, Ndi\Params\KeepLink, type, 0, "enum" -HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% -HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% -HKR, Ndi\Params\KeepLink, default, 0, "0" - - -[Neo.Service] -DisplayName = %Neo.Service.DispName% -Description = %Neo.Service.Desc% -ServiceType = 1 -StartType = 3 -ErrorControl = 1 -ServiceBinary = %12%\Neo_VPN88.sys -LoadOrderGroup = NDIS - -[Neo.Reg] -HKR, Ndi, Service, 0, Neo.Service.Name -HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" -HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" - -[Neo.EventLog] -HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN88.sys" -HKR, , TypesSupported, 0x00010001, 7 - -[Strings] -CompanyName = "SoftEther Corporation" -DiskDescription = "VPN Client Device Driver Install Disk" -Neo.Service.Name = "Neo_VPN88" -Neo.Service.DispName = "VPN Client Device Driver - VPN88" -Neo.Service.Desc = "VPN Client Adapter - VPN88" -NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN88" -Neo.EventLog.Name = "Neo" -NetworkAddress = "MAC Address" -DefaultAddress = "000001000001" -MaxSpeed = "Indicate Speed (Mbps)" -KeepLink = "Keep Link" -On = "On" -Off = "Off" - - -; Auto Generated 20180205_163608.845 - +; VPN Client Device Driver for Windows 2000 and Greater +; +; Copyright (c) SoftEther Corporation. All Rights Reserved. +; http://www.softether.co.jp/ +; +; BUILD 9658 + +[Version] +Signature = "$Windows NT$" +Class = Net +ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} +Provider = %CompanyName% +DriverVer = 02/04/2018, 4.25.0.9658 +CatalogFile.NT = inf_VPN88.cat + +[Manufacturer] +%CompanyName% = SoftEther + +[SourceDisksNames] +1=%DiskDescription%, "", , + +[SourceDisksFiles] +Neo_VPN88.sys = 1 + +[DestinationDirs] +DefaultDestDir = 12 +Neo.CopyFiles.Sys = 12 + +[Neo.CopyFiles.Sys] +Neo_VPN88.sys, , , 2 + +[SoftEther] +%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN88 + +[NeoAdapter.Install] +Characteristics = 0x1 +AddReg = Neo.Reg, NeoAdapter.Ndi +CopyFiles = Neo.CopyFiles.Sys +*IfType = 53 +*MediaType = 0 +*PhysicalMediaType = 0 + +[NeoAdapter.Install.Services] +AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% + +[NeoAdapter.Ndi] +HKR, , NetworkAddress, 0, %DefaultAddress% +HKR, Ndi, DeviceID, , "NeoAdapter_VPN88" +HKR, , DevLoader, , ndis +HKR, , DeviceVxDs, , Neo_VPN88.sys +HKR, NDIS, LogDriverName, , "Neo_VPN88" +HKR, NDIS, MajorNdisVersion, 1, 5 +HKR, NDIS, MinorNdisVersion, 1, 0 +HKR, Ndi\Interfaces, DefUpper, , "ndis5" +HKR, Ndi\Interfaces, UpperRange, , "ndis5" +HKR, Ndi\Interfaces, LowerRange, , "ethernet" +HKR, Ndi\Interfaces, DefLower, , "ethernet" +HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" +HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% +HKR, Ndi\Params\NetworkAddress, type, 0, "edit" +HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" +HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" +HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% +HKR, Ndi\Params\NetworkAddress, optional, 0, "0" +HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% +HKR, Ndi\Params\MaxSpeed, type, 0, "int" +HKR, Ndi\Params\MaxSpeed, default, 0, "100" +HKR, Ndi\Params\MaxSpeed, min, 0, "0" +HKR, Ndi\Params\MaxSpeed, max, 0, "2000" +HKR, Ndi\Params\MaxSpeed, step, 0, "1" +HKR, Ndi\Params\MaxSpeed, Base, 0, "10" +HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% +HKR, Ndi\Params\KeepLink, type, 0, "enum" +HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% +HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% +HKR, Ndi\Params\KeepLink, default, 0, "0" + + +[Neo.Service] +DisplayName = %Neo.Service.DispName% +Description = %Neo.Service.Desc% +ServiceType = 1 +StartType = 3 +ErrorControl = 1 +ServiceBinary = %12%\Neo_VPN88.sys +LoadOrderGroup = NDIS + +[Neo.Reg] +HKR, Ndi, Service, 0, Neo.Service.Name +HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" +HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" + +[Neo.EventLog] +HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN88.sys" +HKR, , TypesSupported, 0x00010001, 7 + +[Strings] +CompanyName = "SoftEther Corporation" +DiskDescription = "VPN Client Device Driver Install Disk" +Neo.Service.Name = "Neo_VPN88" +Neo.Service.DispName = "VPN Client Device Driver - VPN88" +Neo.Service.Desc = "VPN Client Adapter - VPN88" +NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN88" +Neo.EventLog.Name = "Neo" +NetworkAddress = "MAC Address" +DefaultAddress = "000001000001" +MaxSpeed = "Indicate Speed (Mbps)" +KeepLink = "Keep Link" +On = "On" +Off = "Off" + + +; Auto Generated 20180205_163608.845 + diff --git a/src/bin/hamcore/DriverPackages/Neo6_Win8/x86/Neo6_x86_VPN89.inf b/src/bin/hamcore/DriverPackages/Neo6_Win8/x86/Neo6_x86_VPN89.inf index 33f60b9b..41708bc9 100644 --- a/src/bin/hamcore/DriverPackages/Neo6_Win8/x86/Neo6_x86_VPN89.inf +++ b/src/bin/hamcore/DriverPackages/Neo6_Win8/x86/Neo6_x86_VPN89.inf @@ -1,114 +1,114 @@ -; VPN Client Device Driver for Windows 2000 and Greater -; -; Copyright (c) SoftEther Corporation. All Rights Reserved. -; http://www.softether.co.jp/ -; -; BUILD 9658 - -[Version] -Signature = "$Windows NT$" -Class = Net -ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} -Provider = %CompanyName% -DriverVer = 02/04/2018, 4.25.0.9658 -CatalogFile.NT = inf_VPN89.cat - -[Manufacturer] -%CompanyName% = SoftEther - -[SourceDisksNames] -1=%DiskDescription%, "", , - -[SourceDisksFiles] -Neo_VPN89.sys = 1 - -[DestinationDirs] -DefaultDestDir = 12 -Neo.CopyFiles.Sys = 12 - -[Neo.CopyFiles.Sys] -Neo_VPN89.sys, , , 2 - -[SoftEther] -%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN89 - -[NeoAdapter.Install] -Characteristics = 0x1 -AddReg = Neo.Reg, NeoAdapter.Ndi -CopyFiles = Neo.CopyFiles.Sys -*IfType = 53 -*MediaType = 0 -*PhysicalMediaType = 0 - -[NeoAdapter.Install.Services] -AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% - -[NeoAdapter.Ndi] -HKR, , NetworkAddress, 0, %DefaultAddress% -HKR, Ndi, DeviceID, , "NeoAdapter_VPN89" -HKR, , DevLoader, , ndis -HKR, , DeviceVxDs, , Neo_VPN89.sys -HKR, NDIS, LogDriverName, , "Neo_VPN89" -HKR, NDIS, MajorNdisVersion, 1, 5 -HKR, NDIS, MinorNdisVersion, 1, 0 -HKR, Ndi\Interfaces, DefUpper, , "ndis5" -HKR, Ndi\Interfaces, UpperRange, , "ndis5" -HKR, Ndi\Interfaces, LowerRange, , "ethernet" -HKR, Ndi\Interfaces, DefLower, , "ethernet" -HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" -HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% -HKR, Ndi\Params\NetworkAddress, type, 0, "edit" -HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" -HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" -HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% -HKR, Ndi\Params\NetworkAddress, optional, 0, "0" -HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% -HKR, Ndi\Params\MaxSpeed, type, 0, "int" -HKR, Ndi\Params\MaxSpeed, default, 0, "100" -HKR, Ndi\Params\MaxSpeed, min, 0, "0" -HKR, Ndi\Params\MaxSpeed, max, 0, "2000" -HKR, Ndi\Params\MaxSpeed, step, 0, "1" -HKR, Ndi\Params\MaxSpeed, Base, 0, "10" -HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% -HKR, Ndi\Params\KeepLink, type, 0, "enum" -HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% -HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% -HKR, Ndi\Params\KeepLink, default, 0, "0" - - -[Neo.Service] -DisplayName = %Neo.Service.DispName% -Description = %Neo.Service.Desc% -ServiceType = 1 -StartType = 3 -ErrorControl = 1 -ServiceBinary = %12%\Neo_VPN89.sys -LoadOrderGroup = NDIS - -[Neo.Reg] -HKR, Ndi, Service, 0, Neo.Service.Name -HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" -HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" - -[Neo.EventLog] -HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN89.sys" -HKR, , TypesSupported, 0x00010001, 7 - -[Strings] -CompanyName = "SoftEther Corporation" -DiskDescription = "VPN Client Device Driver Install Disk" -Neo.Service.Name = "Neo_VPN89" -Neo.Service.DispName = "VPN Client Device Driver - VPN89" -Neo.Service.Desc = "VPN Client Adapter - VPN89" -NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN89" -Neo.EventLog.Name = "Neo" -NetworkAddress = "MAC Address" -DefaultAddress = "000001000001" -MaxSpeed = "Indicate Speed (Mbps)" -KeepLink = "Keep Link" -On = "On" -Off = "Off" - - -; Auto Generated 20180205_163608.846 - +; VPN Client Device Driver for Windows 2000 and Greater +; +; Copyright (c) SoftEther Corporation. All Rights Reserved. +; http://www.softether.co.jp/ +; +; BUILD 9658 + +[Version] +Signature = "$Windows NT$" +Class = Net +ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} +Provider = %CompanyName% +DriverVer = 02/04/2018, 4.25.0.9658 +CatalogFile.NT = inf_VPN89.cat + +[Manufacturer] +%CompanyName% = SoftEther + +[SourceDisksNames] +1=%DiskDescription%, "", , + +[SourceDisksFiles] +Neo_VPN89.sys = 1 + +[DestinationDirs] +DefaultDestDir = 12 +Neo.CopyFiles.Sys = 12 + +[Neo.CopyFiles.Sys] +Neo_VPN89.sys, , , 2 + +[SoftEther] +%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN89 + +[NeoAdapter.Install] +Characteristics = 0x1 +AddReg = Neo.Reg, NeoAdapter.Ndi +CopyFiles = Neo.CopyFiles.Sys +*IfType = 53 +*MediaType = 0 +*PhysicalMediaType = 0 + +[NeoAdapter.Install.Services] +AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% + +[NeoAdapter.Ndi] +HKR, , NetworkAddress, 0, %DefaultAddress% +HKR, Ndi, DeviceID, , "NeoAdapter_VPN89" +HKR, , DevLoader, , ndis +HKR, , DeviceVxDs, , Neo_VPN89.sys +HKR, NDIS, LogDriverName, , "Neo_VPN89" +HKR, NDIS, MajorNdisVersion, 1, 5 +HKR, NDIS, MinorNdisVersion, 1, 0 +HKR, Ndi\Interfaces, DefUpper, , "ndis5" +HKR, Ndi\Interfaces, UpperRange, , "ndis5" +HKR, Ndi\Interfaces, LowerRange, , "ethernet" +HKR, Ndi\Interfaces, DefLower, , "ethernet" +HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" +HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% +HKR, Ndi\Params\NetworkAddress, type, 0, "edit" +HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" +HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" +HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% +HKR, Ndi\Params\NetworkAddress, optional, 0, "0" +HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% +HKR, Ndi\Params\MaxSpeed, type, 0, "int" +HKR, Ndi\Params\MaxSpeed, default, 0, "100" +HKR, Ndi\Params\MaxSpeed, min, 0, "0" +HKR, Ndi\Params\MaxSpeed, max, 0, "2000" +HKR, Ndi\Params\MaxSpeed, step, 0, "1" +HKR, Ndi\Params\MaxSpeed, Base, 0, "10" +HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% +HKR, Ndi\Params\KeepLink, type, 0, "enum" +HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% +HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% +HKR, Ndi\Params\KeepLink, default, 0, "0" + + +[Neo.Service] +DisplayName = %Neo.Service.DispName% +Description = %Neo.Service.Desc% +ServiceType = 1 +StartType = 3 +ErrorControl = 1 +ServiceBinary = %12%\Neo_VPN89.sys +LoadOrderGroup = NDIS + +[Neo.Reg] +HKR, Ndi, Service, 0, Neo.Service.Name +HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" +HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" + +[Neo.EventLog] +HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN89.sys" +HKR, , TypesSupported, 0x00010001, 7 + +[Strings] +CompanyName = "SoftEther Corporation" +DiskDescription = "VPN Client Device Driver Install Disk" +Neo.Service.Name = "Neo_VPN89" +Neo.Service.DispName = "VPN Client Device Driver - VPN89" +Neo.Service.Desc = "VPN Client Adapter - VPN89" +NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN89" +Neo.EventLog.Name = "Neo" +NetworkAddress = "MAC Address" +DefaultAddress = "000001000001" +MaxSpeed = "Indicate Speed (Mbps)" +KeepLink = "Keep Link" +On = "On" +Off = "Off" + + +; Auto Generated 20180205_163608.846 + diff --git a/src/bin/hamcore/DriverPackages/Neo6_Win8/x86/Neo6_x86_VPN9.inf b/src/bin/hamcore/DriverPackages/Neo6_Win8/x86/Neo6_x86_VPN9.inf index 024c6b0e..d343d946 100644 --- a/src/bin/hamcore/DriverPackages/Neo6_Win8/x86/Neo6_x86_VPN9.inf +++ b/src/bin/hamcore/DriverPackages/Neo6_Win8/x86/Neo6_x86_VPN9.inf @@ -1,114 +1,114 @@ -; VPN Client Device Driver for Windows 2000 and Greater -; -; Copyright (c) SoftEther Corporation. All Rights Reserved. -; http://www.softether.co.jp/ -; -; BUILD 9658 - -[Version] -Signature = "$Windows NT$" -Class = Net -ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} -Provider = %CompanyName% -DriverVer = 02/04/2018, 4.25.0.9658 -CatalogFile.NT = inf_VPN9.cat - -[Manufacturer] -%CompanyName% = SoftEther - -[SourceDisksNames] -1=%DiskDescription%, "", , - -[SourceDisksFiles] -Neo_VPN9.sys = 1 - -[DestinationDirs] -DefaultDestDir = 12 -Neo.CopyFiles.Sys = 12 - -[Neo.CopyFiles.Sys] -Neo_VPN9.sys, , , 2 - -[SoftEther] -%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN9 - -[NeoAdapter.Install] -Characteristics = 0x1 -AddReg = Neo.Reg, NeoAdapter.Ndi -CopyFiles = Neo.CopyFiles.Sys -*IfType = 53 -*MediaType = 0 -*PhysicalMediaType = 0 - -[NeoAdapter.Install.Services] -AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% - -[NeoAdapter.Ndi] -HKR, , NetworkAddress, 0, %DefaultAddress% -HKR, Ndi, DeviceID, , "NeoAdapter_VPN9" -HKR, , DevLoader, , ndis -HKR, , DeviceVxDs, , Neo_VPN9.sys -HKR, NDIS, LogDriverName, , "Neo_VPN9" -HKR, NDIS, MajorNdisVersion, 1, 5 -HKR, NDIS, MinorNdisVersion, 1, 0 -HKR, Ndi\Interfaces, DefUpper, , "ndis5" -HKR, Ndi\Interfaces, UpperRange, , "ndis5" -HKR, Ndi\Interfaces, LowerRange, , "ethernet" -HKR, Ndi\Interfaces, DefLower, , "ethernet" -HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" -HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% -HKR, Ndi\Params\NetworkAddress, type, 0, "edit" -HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" -HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" -HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% -HKR, Ndi\Params\NetworkAddress, optional, 0, "0" -HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% -HKR, Ndi\Params\MaxSpeed, type, 0, "int" -HKR, Ndi\Params\MaxSpeed, default, 0, "100" -HKR, Ndi\Params\MaxSpeed, min, 0, "0" -HKR, Ndi\Params\MaxSpeed, max, 0, "2000" -HKR, Ndi\Params\MaxSpeed, step, 0, "1" -HKR, Ndi\Params\MaxSpeed, Base, 0, "10" -HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% -HKR, Ndi\Params\KeepLink, type, 0, "enum" -HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% -HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% -HKR, Ndi\Params\KeepLink, default, 0, "0" - - -[Neo.Service] -DisplayName = %Neo.Service.DispName% -Description = %Neo.Service.Desc% -ServiceType = 1 -StartType = 3 -ErrorControl = 1 -ServiceBinary = %12%\Neo_VPN9.sys -LoadOrderGroup = NDIS - -[Neo.Reg] -HKR, Ndi, Service, 0, Neo.Service.Name -HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" -HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" - -[Neo.EventLog] -HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN9.sys" -HKR, , TypesSupported, 0x00010001, 7 - -[Strings] -CompanyName = "SoftEther Corporation" -DiskDescription = "VPN Client Device Driver Install Disk" -Neo.Service.Name = "Neo_VPN9" -Neo.Service.DispName = "VPN Client Device Driver - VPN9" -Neo.Service.Desc = "VPN Client Adapter - VPN9" -NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN9" -Neo.EventLog.Name = "Neo" -NetworkAddress = "MAC Address" -DefaultAddress = "000001000001" -MaxSpeed = "Indicate Speed (Mbps)" -KeepLink = "Keep Link" -On = "On" -Off = "Off" - - -; Auto Generated 20180205_163608.757 - +; VPN Client Device Driver for Windows 2000 and Greater +; +; Copyright (c) SoftEther Corporation. All Rights Reserved. +; http://www.softether.co.jp/ +; +; BUILD 9658 + +[Version] +Signature = "$Windows NT$" +Class = Net +ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} +Provider = %CompanyName% +DriverVer = 02/04/2018, 4.25.0.9658 +CatalogFile.NT = inf_VPN9.cat + +[Manufacturer] +%CompanyName% = SoftEther + +[SourceDisksNames] +1=%DiskDescription%, "", , + +[SourceDisksFiles] +Neo_VPN9.sys = 1 + +[DestinationDirs] +DefaultDestDir = 12 +Neo.CopyFiles.Sys = 12 + +[Neo.CopyFiles.Sys] +Neo_VPN9.sys, , , 2 + +[SoftEther] +%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN9 + +[NeoAdapter.Install] +Characteristics = 0x1 +AddReg = Neo.Reg, NeoAdapter.Ndi +CopyFiles = Neo.CopyFiles.Sys +*IfType = 53 +*MediaType = 0 +*PhysicalMediaType = 0 + +[NeoAdapter.Install.Services] +AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% + +[NeoAdapter.Ndi] +HKR, , NetworkAddress, 0, %DefaultAddress% +HKR, Ndi, DeviceID, , "NeoAdapter_VPN9" +HKR, , DevLoader, , ndis +HKR, , DeviceVxDs, , Neo_VPN9.sys +HKR, NDIS, LogDriverName, , "Neo_VPN9" +HKR, NDIS, MajorNdisVersion, 1, 5 +HKR, NDIS, MinorNdisVersion, 1, 0 +HKR, Ndi\Interfaces, DefUpper, , "ndis5" +HKR, Ndi\Interfaces, UpperRange, , "ndis5" +HKR, Ndi\Interfaces, LowerRange, , "ethernet" +HKR, Ndi\Interfaces, DefLower, , "ethernet" +HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" +HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% +HKR, Ndi\Params\NetworkAddress, type, 0, "edit" +HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" +HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" +HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% +HKR, Ndi\Params\NetworkAddress, optional, 0, "0" +HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% +HKR, Ndi\Params\MaxSpeed, type, 0, "int" +HKR, Ndi\Params\MaxSpeed, default, 0, "100" +HKR, Ndi\Params\MaxSpeed, min, 0, "0" +HKR, Ndi\Params\MaxSpeed, max, 0, "2000" +HKR, Ndi\Params\MaxSpeed, step, 0, "1" +HKR, Ndi\Params\MaxSpeed, Base, 0, "10" +HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% +HKR, Ndi\Params\KeepLink, type, 0, "enum" +HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% +HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% +HKR, Ndi\Params\KeepLink, default, 0, "0" + + +[Neo.Service] +DisplayName = %Neo.Service.DispName% +Description = %Neo.Service.Desc% +ServiceType = 1 +StartType = 3 +ErrorControl = 1 +ServiceBinary = %12%\Neo_VPN9.sys +LoadOrderGroup = NDIS + +[Neo.Reg] +HKR, Ndi, Service, 0, Neo.Service.Name +HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" +HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" + +[Neo.EventLog] +HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN9.sys" +HKR, , TypesSupported, 0x00010001, 7 + +[Strings] +CompanyName = "SoftEther Corporation" +DiskDescription = "VPN Client Device Driver Install Disk" +Neo.Service.Name = "Neo_VPN9" +Neo.Service.DispName = "VPN Client Device Driver - VPN9" +Neo.Service.Desc = "VPN Client Adapter - VPN9" +NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN9" +Neo.EventLog.Name = "Neo" +NetworkAddress = "MAC Address" +DefaultAddress = "000001000001" +MaxSpeed = "Indicate Speed (Mbps)" +KeepLink = "Keep Link" +On = "On" +Off = "Off" + + +; Auto Generated 20180205_163608.757 + diff --git a/src/bin/hamcore/DriverPackages/Neo6_Win8/x86/Neo6_x86_VPN90.inf b/src/bin/hamcore/DriverPackages/Neo6_Win8/x86/Neo6_x86_VPN90.inf index 194726a5..90f3b459 100644 --- a/src/bin/hamcore/DriverPackages/Neo6_Win8/x86/Neo6_x86_VPN90.inf +++ b/src/bin/hamcore/DriverPackages/Neo6_Win8/x86/Neo6_x86_VPN90.inf @@ -1,114 +1,114 @@ -; VPN Client Device Driver for Windows 2000 and Greater -; -; Copyright (c) SoftEther Corporation. All Rights Reserved. -; http://www.softether.co.jp/ -; -; BUILD 9658 - -[Version] -Signature = "$Windows NT$" -Class = Net -ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} -Provider = %CompanyName% -DriverVer = 02/04/2018, 4.25.0.9658 -CatalogFile.NT = inf_VPN90.cat - -[Manufacturer] -%CompanyName% = SoftEther - -[SourceDisksNames] -1=%DiskDescription%, "", , - -[SourceDisksFiles] -Neo_VPN90.sys = 1 - -[DestinationDirs] -DefaultDestDir = 12 -Neo.CopyFiles.Sys = 12 - -[Neo.CopyFiles.Sys] -Neo_VPN90.sys, , , 2 - -[SoftEther] -%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN90 - -[NeoAdapter.Install] -Characteristics = 0x1 -AddReg = Neo.Reg, NeoAdapter.Ndi -CopyFiles = Neo.CopyFiles.Sys -*IfType = 53 -*MediaType = 0 -*PhysicalMediaType = 0 - -[NeoAdapter.Install.Services] -AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% - -[NeoAdapter.Ndi] -HKR, , NetworkAddress, 0, %DefaultAddress% -HKR, Ndi, DeviceID, , "NeoAdapter_VPN90" -HKR, , DevLoader, , ndis -HKR, , DeviceVxDs, , Neo_VPN90.sys -HKR, NDIS, LogDriverName, , "Neo_VPN90" -HKR, NDIS, MajorNdisVersion, 1, 5 -HKR, NDIS, MinorNdisVersion, 1, 0 -HKR, Ndi\Interfaces, DefUpper, , "ndis5" -HKR, Ndi\Interfaces, UpperRange, , "ndis5" -HKR, Ndi\Interfaces, LowerRange, , "ethernet" -HKR, Ndi\Interfaces, DefLower, , "ethernet" -HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" -HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% -HKR, Ndi\Params\NetworkAddress, type, 0, "edit" -HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" -HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" -HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% -HKR, Ndi\Params\NetworkAddress, optional, 0, "0" -HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% -HKR, Ndi\Params\MaxSpeed, type, 0, "int" -HKR, Ndi\Params\MaxSpeed, default, 0, "100" -HKR, Ndi\Params\MaxSpeed, min, 0, "0" -HKR, Ndi\Params\MaxSpeed, max, 0, "2000" -HKR, Ndi\Params\MaxSpeed, step, 0, "1" -HKR, Ndi\Params\MaxSpeed, Base, 0, "10" -HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% -HKR, Ndi\Params\KeepLink, type, 0, "enum" -HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% -HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% -HKR, Ndi\Params\KeepLink, default, 0, "0" - - -[Neo.Service] -DisplayName = %Neo.Service.DispName% -Description = %Neo.Service.Desc% -ServiceType = 1 -StartType = 3 -ErrorControl = 1 -ServiceBinary = %12%\Neo_VPN90.sys -LoadOrderGroup = NDIS - -[Neo.Reg] -HKR, Ndi, Service, 0, Neo.Service.Name -HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" -HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" - -[Neo.EventLog] -HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN90.sys" -HKR, , TypesSupported, 0x00010001, 7 - -[Strings] -CompanyName = "SoftEther Corporation" -DiskDescription = "VPN Client Device Driver Install Disk" -Neo.Service.Name = "Neo_VPN90" -Neo.Service.DispName = "VPN Client Device Driver - VPN90" -Neo.Service.Desc = "VPN Client Adapter - VPN90" -NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN90" -Neo.EventLog.Name = "Neo" -NetworkAddress = "MAC Address" -DefaultAddress = "000001000001" -MaxSpeed = "Indicate Speed (Mbps)" -KeepLink = "Keep Link" -On = "On" -Off = "Off" - - -; Auto Generated 20180205_163608.847 - +; VPN Client Device Driver for Windows 2000 and Greater +; +; Copyright (c) SoftEther Corporation. All Rights Reserved. +; http://www.softether.co.jp/ +; +; BUILD 9658 + +[Version] +Signature = "$Windows NT$" +Class = Net +ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} +Provider = %CompanyName% +DriverVer = 02/04/2018, 4.25.0.9658 +CatalogFile.NT = inf_VPN90.cat + +[Manufacturer] +%CompanyName% = SoftEther + +[SourceDisksNames] +1=%DiskDescription%, "", , + +[SourceDisksFiles] +Neo_VPN90.sys = 1 + +[DestinationDirs] +DefaultDestDir = 12 +Neo.CopyFiles.Sys = 12 + +[Neo.CopyFiles.Sys] +Neo_VPN90.sys, , , 2 + +[SoftEther] +%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN90 + +[NeoAdapter.Install] +Characteristics = 0x1 +AddReg = Neo.Reg, NeoAdapter.Ndi +CopyFiles = Neo.CopyFiles.Sys +*IfType = 53 +*MediaType = 0 +*PhysicalMediaType = 0 + +[NeoAdapter.Install.Services] +AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% + +[NeoAdapter.Ndi] +HKR, , NetworkAddress, 0, %DefaultAddress% +HKR, Ndi, DeviceID, , "NeoAdapter_VPN90" +HKR, , DevLoader, , ndis +HKR, , DeviceVxDs, , Neo_VPN90.sys +HKR, NDIS, LogDriverName, , "Neo_VPN90" +HKR, NDIS, MajorNdisVersion, 1, 5 +HKR, NDIS, MinorNdisVersion, 1, 0 +HKR, Ndi\Interfaces, DefUpper, , "ndis5" +HKR, Ndi\Interfaces, UpperRange, , "ndis5" +HKR, Ndi\Interfaces, LowerRange, , "ethernet" +HKR, Ndi\Interfaces, DefLower, , "ethernet" +HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" +HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% +HKR, Ndi\Params\NetworkAddress, type, 0, "edit" +HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" +HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" +HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% +HKR, Ndi\Params\NetworkAddress, optional, 0, "0" +HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% +HKR, Ndi\Params\MaxSpeed, type, 0, "int" +HKR, Ndi\Params\MaxSpeed, default, 0, "100" +HKR, Ndi\Params\MaxSpeed, min, 0, "0" +HKR, Ndi\Params\MaxSpeed, max, 0, "2000" +HKR, Ndi\Params\MaxSpeed, step, 0, "1" +HKR, Ndi\Params\MaxSpeed, Base, 0, "10" +HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% +HKR, Ndi\Params\KeepLink, type, 0, "enum" +HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% +HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% +HKR, Ndi\Params\KeepLink, default, 0, "0" + + +[Neo.Service] +DisplayName = %Neo.Service.DispName% +Description = %Neo.Service.Desc% +ServiceType = 1 +StartType = 3 +ErrorControl = 1 +ServiceBinary = %12%\Neo_VPN90.sys +LoadOrderGroup = NDIS + +[Neo.Reg] +HKR, Ndi, Service, 0, Neo.Service.Name +HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" +HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" + +[Neo.EventLog] +HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN90.sys" +HKR, , TypesSupported, 0x00010001, 7 + +[Strings] +CompanyName = "SoftEther Corporation" +DiskDescription = "VPN Client Device Driver Install Disk" +Neo.Service.Name = "Neo_VPN90" +Neo.Service.DispName = "VPN Client Device Driver - VPN90" +Neo.Service.Desc = "VPN Client Adapter - VPN90" +NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN90" +Neo.EventLog.Name = "Neo" +NetworkAddress = "MAC Address" +DefaultAddress = "000001000001" +MaxSpeed = "Indicate Speed (Mbps)" +KeepLink = "Keep Link" +On = "On" +Off = "Off" + + +; Auto Generated 20180205_163608.847 + diff --git a/src/bin/hamcore/DriverPackages/Neo6_Win8/x86/Neo6_x86_VPN91.inf b/src/bin/hamcore/DriverPackages/Neo6_Win8/x86/Neo6_x86_VPN91.inf index d3c59b8e..e9d9b4a6 100644 --- a/src/bin/hamcore/DriverPackages/Neo6_Win8/x86/Neo6_x86_VPN91.inf +++ b/src/bin/hamcore/DriverPackages/Neo6_Win8/x86/Neo6_x86_VPN91.inf @@ -1,114 +1,114 @@ -; VPN Client Device Driver for Windows 2000 and Greater -; -; Copyright (c) SoftEther Corporation. All Rights Reserved. -; http://www.softether.co.jp/ -; -; BUILD 9658 - -[Version] -Signature = "$Windows NT$" -Class = Net -ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} -Provider = %CompanyName% -DriverVer = 02/04/2018, 4.25.0.9658 -CatalogFile.NT = inf_VPN91.cat - -[Manufacturer] -%CompanyName% = SoftEther - -[SourceDisksNames] -1=%DiskDescription%, "", , - -[SourceDisksFiles] -Neo_VPN91.sys = 1 - -[DestinationDirs] -DefaultDestDir = 12 -Neo.CopyFiles.Sys = 12 - -[Neo.CopyFiles.Sys] -Neo_VPN91.sys, , , 2 - -[SoftEther] -%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN91 - -[NeoAdapter.Install] -Characteristics = 0x1 -AddReg = Neo.Reg, NeoAdapter.Ndi -CopyFiles = Neo.CopyFiles.Sys -*IfType = 53 -*MediaType = 0 -*PhysicalMediaType = 0 - -[NeoAdapter.Install.Services] -AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% - -[NeoAdapter.Ndi] -HKR, , NetworkAddress, 0, %DefaultAddress% -HKR, Ndi, DeviceID, , "NeoAdapter_VPN91" -HKR, , DevLoader, , ndis -HKR, , DeviceVxDs, , Neo_VPN91.sys -HKR, NDIS, LogDriverName, , "Neo_VPN91" -HKR, NDIS, MajorNdisVersion, 1, 5 -HKR, NDIS, MinorNdisVersion, 1, 0 -HKR, Ndi\Interfaces, DefUpper, , "ndis5" -HKR, Ndi\Interfaces, UpperRange, , "ndis5" -HKR, Ndi\Interfaces, LowerRange, , "ethernet" -HKR, Ndi\Interfaces, DefLower, , "ethernet" -HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" -HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% -HKR, Ndi\Params\NetworkAddress, type, 0, "edit" -HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" -HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" -HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% -HKR, Ndi\Params\NetworkAddress, optional, 0, "0" -HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% -HKR, Ndi\Params\MaxSpeed, type, 0, "int" -HKR, Ndi\Params\MaxSpeed, default, 0, "100" -HKR, Ndi\Params\MaxSpeed, min, 0, "0" -HKR, Ndi\Params\MaxSpeed, max, 0, "2000" -HKR, Ndi\Params\MaxSpeed, step, 0, "1" -HKR, Ndi\Params\MaxSpeed, Base, 0, "10" -HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% -HKR, Ndi\Params\KeepLink, type, 0, "enum" -HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% -HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% -HKR, Ndi\Params\KeepLink, default, 0, "0" - - -[Neo.Service] -DisplayName = %Neo.Service.DispName% -Description = %Neo.Service.Desc% -ServiceType = 1 -StartType = 3 -ErrorControl = 1 -ServiceBinary = %12%\Neo_VPN91.sys -LoadOrderGroup = NDIS - -[Neo.Reg] -HKR, Ndi, Service, 0, Neo.Service.Name -HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" -HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" - -[Neo.EventLog] -HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN91.sys" -HKR, , TypesSupported, 0x00010001, 7 - -[Strings] -CompanyName = "SoftEther Corporation" -DiskDescription = "VPN Client Device Driver Install Disk" -Neo.Service.Name = "Neo_VPN91" -Neo.Service.DispName = "VPN Client Device Driver - VPN91" -Neo.Service.Desc = "VPN Client Adapter - VPN91" -NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN91" -Neo.EventLog.Name = "Neo" -NetworkAddress = "MAC Address" -DefaultAddress = "000001000001" -MaxSpeed = "Indicate Speed (Mbps)" -KeepLink = "Keep Link" -On = "On" -Off = "Off" - - -; Auto Generated 20180205_163608.847 - +; VPN Client Device Driver for Windows 2000 and Greater +; +; Copyright (c) SoftEther Corporation. All Rights Reserved. +; http://www.softether.co.jp/ +; +; BUILD 9658 + +[Version] +Signature = "$Windows NT$" +Class = Net +ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} +Provider = %CompanyName% +DriverVer = 02/04/2018, 4.25.0.9658 +CatalogFile.NT = inf_VPN91.cat + +[Manufacturer] +%CompanyName% = SoftEther + +[SourceDisksNames] +1=%DiskDescription%, "", , + +[SourceDisksFiles] +Neo_VPN91.sys = 1 + +[DestinationDirs] +DefaultDestDir = 12 +Neo.CopyFiles.Sys = 12 + +[Neo.CopyFiles.Sys] +Neo_VPN91.sys, , , 2 + +[SoftEther] +%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN91 + +[NeoAdapter.Install] +Characteristics = 0x1 +AddReg = Neo.Reg, NeoAdapter.Ndi +CopyFiles = Neo.CopyFiles.Sys +*IfType = 53 +*MediaType = 0 +*PhysicalMediaType = 0 + +[NeoAdapter.Install.Services] +AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% + +[NeoAdapter.Ndi] +HKR, , NetworkAddress, 0, %DefaultAddress% +HKR, Ndi, DeviceID, , "NeoAdapter_VPN91" +HKR, , DevLoader, , ndis +HKR, , DeviceVxDs, , Neo_VPN91.sys +HKR, NDIS, LogDriverName, , "Neo_VPN91" +HKR, NDIS, MajorNdisVersion, 1, 5 +HKR, NDIS, MinorNdisVersion, 1, 0 +HKR, Ndi\Interfaces, DefUpper, , "ndis5" +HKR, Ndi\Interfaces, UpperRange, , "ndis5" +HKR, Ndi\Interfaces, LowerRange, , "ethernet" +HKR, Ndi\Interfaces, DefLower, , "ethernet" +HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" +HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% +HKR, Ndi\Params\NetworkAddress, type, 0, "edit" +HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" +HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" +HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% +HKR, Ndi\Params\NetworkAddress, optional, 0, "0" +HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% +HKR, Ndi\Params\MaxSpeed, type, 0, "int" +HKR, Ndi\Params\MaxSpeed, default, 0, "100" +HKR, Ndi\Params\MaxSpeed, min, 0, "0" +HKR, Ndi\Params\MaxSpeed, max, 0, "2000" +HKR, Ndi\Params\MaxSpeed, step, 0, "1" +HKR, Ndi\Params\MaxSpeed, Base, 0, "10" +HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% +HKR, Ndi\Params\KeepLink, type, 0, "enum" +HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% +HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% +HKR, Ndi\Params\KeepLink, default, 0, "0" + + +[Neo.Service] +DisplayName = %Neo.Service.DispName% +Description = %Neo.Service.Desc% +ServiceType = 1 +StartType = 3 +ErrorControl = 1 +ServiceBinary = %12%\Neo_VPN91.sys +LoadOrderGroup = NDIS + +[Neo.Reg] +HKR, Ndi, Service, 0, Neo.Service.Name +HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" +HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" + +[Neo.EventLog] +HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN91.sys" +HKR, , TypesSupported, 0x00010001, 7 + +[Strings] +CompanyName = "SoftEther Corporation" +DiskDescription = "VPN Client Device Driver Install Disk" +Neo.Service.Name = "Neo_VPN91" +Neo.Service.DispName = "VPN Client Device Driver - VPN91" +Neo.Service.Desc = "VPN Client Adapter - VPN91" +NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN91" +Neo.EventLog.Name = "Neo" +NetworkAddress = "MAC Address" +DefaultAddress = "000001000001" +MaxSpeed = "Indicate Speed (Mbps)" +KeepLink = "Keep Link" +On = "On" +Off = "Off" + + +; Auto Generated 20180205_163608.847 + diff --git a/src/bin/hamcore/DriverPackages/Neo6_Win8/x86/Neo6_x86_VPN92.inf b/src/bin/hamcore/DriverPackages/Neo6_Win8/x86/Neo6_x86_VPN92.inf index 49259bdd..b985c58e 100644 --- a/src/bin/hamcore/DriverPackages/Neo6_Win8/x86/Neo6_x86_VPN92.inf +++ b/src/bin/hamcore/DriverPackages/Neo6_Win8/x86/Neo6_x86_VPN92.inf @@ -1,114 +1,114 @@ -; VPN Client Device Driver for Windows 2000 and Greater -; -; Copyright (c) SoftEther Corporation. All Rights Reserved. -; http://www.softether.co.jp/ -; -; BUILD 9658 - -[Version] -Signature = "$Windows NT$" -Class = Net -ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} -Provider = %CompanyName% -DriverVer = 02/04/2018, 4.25.0.9658 -CatalogFile.NT = inf_VPN92.cat - -[Manufacturer] -%CompanyName% = SoftEther - -[SourceDisksNames] -1=%DiskDescription%, "", , - -[SourceDisksFiles] -Neo_VPN92.sys = 1 - -[DestinationDirs] -DefaultDestDir = 12 -Neo.CopyFiles.Sys = 12 - -[Neo.CopyFiles.Sys] -Neo_VPN92.sys, , , 2 - -[SoftEther] -%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN92 - -[NeoAdapter.Install] -Characteristics = 0x1 -AddReg = Neo.Reg, NeoAdapter.Ndi -CopyFiles = Neo.CopyFiles.Sys -*IfType = 53 -*MediaType = 0 -*PhysicalMediaType = 0 - -[NeoAdapter.Install.Services] -AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% - -[NeoAdapter.Ndi] -HKR, , NetworkAddress, 0, %DefaultAddress% -HKR, Ndi, DeviceID, , "NeoAdapter_VPN92" -HKR, , DevLoader, , ndis -HKR, , DeviceVxDs, , Neo_VPN92.sys -HKR, NDIS, LogDriverName, , "Neo_VPN92" -HKR, NDIS, MajorNdisVersion, 1, 5 -HKR, NDIS, MinorNdisVersion, 1, 0 -HKR, Ndi\Interfaces, DefUpper, , "ndis5" -HKR, Ndi\Interfaces, UpperRange, , "ndis5" -HKR, Ndi\Interfaces, LowerRange, , "ethernet" -HKR, Ndi\Interfaces, DefLower, , "ethernet" -HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" -HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% -HKR, Ndi\Params\NetworkAddress, type, 0, "edit" -HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" -HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" -HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% -HKR, Ndi\Params\NetworkAddress, optional, 0, "0" -HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% -HKR, Ndi\Params\MaxSpeed, type, 0, "int" -HKR, Ndi\Params\MaxSpeed, default, 0, "100" -HKR, Ndi\Params\MaxSpeed, min, 0, "0" -HKR, Ndi\Params\MaxSpeed, max, 0, "2000" -HKR, Ndi\Params\MaxSpeed, step, 0, "1" -HKR, Ndi\Params\MaxSpeed, Base, 0, "10" -HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% -HKR, Ndi\Params\KeepLink, type, 0, "enum" -HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% -HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% -HKR, Ndi\Params\KeepLink, default, 0, "0" - - -[Neo.Service] -DisplayName = %Neo.Service.DispName% -Description = %Neo.Service.Desc% -ServiceType = 1 -StartType = 3 -ErrorControl = 1 -ServiceBinary = %12%\Neo_VPN92.sys -LoadOrderGroup = NDIS - -[Neo.Reg] -HKR, Ndi, Service, 0, Neo.Service.Name -HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" -HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" - -[Neo.EventLog] -HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN92.sys" -HKR, , TypesSupported, 0x00010001, 7 - -[Strings] -CompanyName = "SoftEther Corporation" -DiskDescription = "VPN Client Device Driver Install Disk" -Neo.Service.Name = "Neo_VPN92" -Neo.Service.DispName = "VPN Client Device Driver - VPN92" -Neo.Service.Desc = "VPN Client Adapter - VPN92" -NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN92" -Neo.EventLog.Name = "Neo" -NetworkAddress = "MAC Address" -DefaultAddress = "000001000001" -MaxSpeed = "Indicate Speed (Mbps)" -KeepLink = "Keep Link" -On = "On" -Off = "Off" - - -; Auto Generated 20180205_163608.848 - +; VPN Client Device Driver for Windows 2000 and Greater +; +; Copyright (c) SoftEther Corporation. All Rights Reserved. +; http://www.softether.co.jp/ +; +; BUILD 9658 + +[Version] +Signature = "$Windows NT$" +Class = Net +ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} +Provider = %CompanyName% +DriverVer = 02/04/2018, 4.25.0.9658 +CatalogFile.NT = inf_VPN92.cat + +[Manufacturer] +%CompanyName% = SoftEther + +[SourceDisksNames] +1=%DiskDescription%, "", , + +[SourceDisksFiles] +Neo_VPN92.sys = 1 + +[DestinationDirs] +DefaultDestDir = 12 +Neo.CopyFiles.Sys = 12 + +[Neo.CopyFiles.Sys] +Neo_VPN92.sys, , , 2 + +[SoftEther] +%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN92 + +[NeoAdapter.Install] +Characteristics = 0x1 +AddReg = Neo.Reg, NeoAdapter.Ndi +CopyFiles = Neo.CopyFiles.Sys +*IfType = 53 +*MediaType = 0 +*PhysicalMediaType = 0 + +[NeoAdapter.Install.Services] +AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% + +[NeoAdapter.Ndi] +HKR, , NetworkAddress, 0, %DefaultAddress% +HKR, Ndi, DeviceID, , "NeoAdapter_VPN92" +HKR, , DevLoader, , ndis +HKR, , DeviceVxDs, , Neo_VPN92.sys +HKR, NDIS, LogDriverName, , "Neo_VPN92" +HKR, NDIS, MajorNdisVersion, 1, 5 +HKR, NDIS, MinorNdisVersion, 1, 0 +HKR, Ndi\Interfaces, DefUpper, , "ndis5" +HKR, Ndi\Interfaces, UpperRange, , "ndis5" +HKR, Ndi\Interfaces, LowerRange, , "ethernet" +HKR, Ndi\Interfaces, DefLower, , "ethernet" +HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" +HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% +HKR, Ndi\Params\NetworkAddress, type, 0, "edit" +HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" +HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" +HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% +HKR, Ndi\Params\NetworkAddress, optional, 0, "0" +HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% +HKR, Ndi\Params\MaxSpeed, type, 0, "int" +HKR, Ndi\Params\MaxSpeed, default, 0, "100" +HKR, Ndi\Params\MaxSpeed, min, 0, "0" +HKR, Ndi\Params\MaxSpeed, max, 0, "2000" +HKR, Ndi\Params\MaxSpeed, step, 0, "1" +HKR, Ndi\Params\MaxSpeed, Base, 0, "10" +HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% +HKR, Ndi\Params\KeepLink, type, 0, "enum" +HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% +HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% +HKR, Ndi\Params\KeepLink, default, 0, "0" + + +[Neo.Service] +DisplayName = %Neo.Service.DispName% +Description = %Neo.Service.Desc% +ServiceType = 1 +StartType = 3 +ErrorControl = 1 +ServiceBinary = %12%\Neo_VPN92.sys +LoadOrderGroup = NDIS + +[Neo.Reg] +HKR, Ndi, Service, 0, Neo.Service.Name +HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" +HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" + +[Neo.EventLog] +HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN92.sys" +HKR, , TypesSupported, 0x00010001, 7 + +[Strings] +CompanyName = "SoftEther Corporation" +DiskDescription = "VPN Client Device Driver Install Disk" +Neo.Service.Name = "Neo_VPN92" +Neo.Service.DispName = "VPN Client Device Driver - VPN92" +Neo.Service.Desc = "VPN Client Adapter - VPN92" +NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN92" +Neo.EventLog.Name = "Neo" +NetworkAddress = "MAC Address" +DefaultAddress = "000001000001" +MaxSpeed = "Indicate Speed (Mbps)" +KeepLink = "Keep Link" +On = "On" +Off = "Off" + + +; Auto Generated 20180205_163608.848 + diff --git a/src/bin/hamcore/DriverPackages/Neo6_Win8/x86/Neo6_x86_VPN93.inf b/src/bin/hamcore/DriverPackages/Neo6_Win8/x86/Neo6_x86_VPN93.inf index 986ef473..8f5d1654 100644 --- a/src/bin/hamcore/DriverPackages/Neo6_Win8/x86/Neo6_x86_VPN93.inf +++ b/src/bin/hamcore/DriverPackages/Neo6_Win8/x86/Neo6_x86_VPN93.inf @@ -1,114 +1,114 @@ -; VPN Client Device Driver for Windows 2000 and Greater -; -; Copyright (c) SoftEther Corporation. All Rights Reserved. -; http://www.softether.co.jp/ -; -; BUILD 9658 - -[Version] -Signature = "$Windows NT$" -Class = Net -ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} -Provider = %CompanyName% -DriverVer = 02/04/2018, 4.25.0.9658 -CatalogFile.NT = inf_VPN93.cat - -[Manufacturer] -%CompanyName% = SoftEther - -[SourceDisksNames] -1=%DiskDescription%, "", , - -[SourceDisksFiles] -Neo_VPN93.sys = 1 - -[DestinationDirs] -DefaultDestDir = 12 -Neo.CopyFiles.Sys = 12 - -[Neo.CopyFiles.Sys] -Neo_VPN93.sys, , , 2 - -[SoftEther] -%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN93 - -[NeoAdapter.Install] -Characteristics = 0x1 -AddReg = Neo.Reg, NeoAdapter.Ndi -CopyFiles = Neo.CopyFiles.Sys -*IfType = 53 -*MediaType = 0 -*PhysicalMediaType = 0 - -[NeoAdapter.Install.Services] -AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% - -[NeoAdapter.Ndi] -HKR, , NetworkAddress, 0, %DefaultAddress% -HKR, Ndi, DeviceID, , "NeoAdapter_VPN93" -HKR, , DevLoader, , ndis -HKR, , DeviceVxDs, , Neo_VPN93.sys -HKR, NDIS, LogDriverName, , "Neo_VPN93" -HKR, NDIS, MajorNdisVersion, 1, 5 -HKR, NDIS, MinorNdisVersion, 1, 0 -HKR, Ndi\Interfaces, DefUpper, , "ndis5" -HKR, Ndi\Interfaces, UpperRange, , "ndis5" -HKR, Ndi\Interfaces, LowerRange, , "ethernet" -HKR, Ndi\Interfaces, DefLower, , "ethernet" -HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" -HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% -HKR, Ndi\Params\NetworkAddress, type, 0, "edit" -HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" -HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" -HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% -HKR, Ndi\Params\NetworkAddress, optional, 0, "0" -HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% -HKR, Ndi\Params\MaxSpeed, type, 0, "int" -HKR, Ndi\Params\MaxSpeed, default, 0, "100" -HKR, Ndi\Params\MaxSpeed, min, 0, "0" -HKR, Ndi\Params\MaxSpeed, max, 0, "2000" -HKR, Ndi\Params\MaxSpeed, step, 0, "1" -HKR, Ndi\Params\MaxSpeed, Base, 0, "10" -HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% -HKR, Ndi\Params\KeepLink, type, 0, "enum" -HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% -HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% -HKR, Ndi\Params\KeepLink, default, 0, "0" - - -[Neo.Service] -DisplayName = %Neo.Service.DispName% -Description = %Neo.Service.Desc% -ServiceType = 1 -StartType = 3 -ErrorControl = 1 -ServiceBinary = %12%\Neo_VPN93.sys -LoadOrderGroup = NDIS - -[Neo.Reg] -HKR, Ndi, Service, 0, Neo.Service.Name -HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" -HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" - -[Neo.EventLog] -HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN93.sys" -HKR, , TypesSupported, 0x00010001, 7 - -[Strings] -CompanyName = "SoftEther Corporation" -DiskDescription = "VPN Client Device Driver Install Disk" -Neo.Service.Name = "Neo_VPN93" -Neo.Service.DispName = "VPN Client Device Driver - VPN93" -Neo.Service.Desc = "VPN Client Adapter - VPN93" -NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN93" -Neo.EventLog.Name = "Neo" -NetworkAddress = "MAC Address" -DefaultAddress = "000001000001" -MaxSpeed = "Indicate Speed (Mbps)" -KeepLink = "Keep Link" -On = "On" -Off = "Off" - - -; Auto Generated 20180205_163608.849 - +; VPN Client Device Driver for Windows 2000 and Greater +; +; Copyright (c) SoftEther Corporation. All Rights Reserved. +; http://www.softether.co.jp/ +; +; BUILD 9658 + +[Version] +Signature = "$Windows NT$" +Class = Net +ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} +Provider = %CompanyName% +DriverVer = 02/04/2018, 4.25.0.9658 +CatalogFile.NT = inf_VPN93.cat + +[Manufacturer] +%CompanyName% = SoftEther + +[SourceDisksNames] +1=%DiskDescription%, "", , + +[SourceDisksFiles] +Neo_VPN93.sys = 1 + +[DestinationDirs] +DefaultDestDir = 12 +Neo.CopyFiles.Sys = 12 + +[Neo.CopyFiles.Sys] +Neo_VPN93.sys, , , 2 + +[SoftEther] +%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN93 + +[NeoAdapter.Install] +Characteristics = 0x1 +AddReg = Neo.Reg, NeoAdapter.Ndi +CopyFiles = Neo.CopyFiles.Sys +*IfType = 53 +*MediaType = 0 +*PhysicalMediaType = 0 + +[NeoAdapter.Install.Services] +AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% + +[NeoAdapter.Ndi] +HKR, , NetworkAddress, 0, %DefaultAddress% +HKR, Ndi, DeviceID, , "NeoAdapter_VPN93" +HKR, , DevLoader, , ndis +HKR, , DeviceVxDs, , Neo_VPN93.sys +HKR, NDIS, LogDriverName, , "Neo_VPN93" +HKR, NDIS, MajorNdisVersion, 1, 5 +HKR, NDIS, MinorNdisVersion, 1, 0 +HKR, Ndi\Interfaces, DefUpper, , "ndis5" +HKR, Ndi\Interfaces, UpperRange, , "ndis5" +HKR, Ndi\Interfaces, LowerRange, , "ethernet" +HKR, Ndi\Interfaces, DefLower, , "ethernet" +HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" +HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% +HKR, Ndi\Params\NetworkAddress, type, 0, "edit" +HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" +HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" +HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% +HKR, Ndi\Params\NetworkAddress, optional, 0, "0" +HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% +HKR, Ndi\Params\MaxSpeed, type, 0, "int" +HKR, Ndi\Params\MaxSpeed, default, 0, "100" +HKR, Ndi\Params\MaxSpeed, min, 0, "0" +HKR, Ndi\Params\MaxSpeed, max, 0, "2000" +HKR, Ndi\Params\MaxSpeed, step, 0, "1" +HKR, Ndi\Params\MaxSpeed, Base, 0, "10" +HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% +HKR, Ndi\Params\KeepLink, type, 0, "enum" +HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% +HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% +HKR, Ndi\Params\KeepLink, default, 0, "0" + + +[Neo.Service] +DisplayName = %Neo.Service.DispName% +Description = %Neo.Service.Desc% +ServiceType = 1 +StartType = 3 +ErrorControl = 1 +ServiceBinary = %12%\Neo_VPN93.sys +LoadOrderGroup = NDIS + +[Neo.Reg] +HKR, Ndi, Service, 0, Neo.Service.Name +HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" +HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" + +[Neo.EventLog] +HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN93.sys" +HKR, , TypesSupported, 0x00010001, 7 + +[Strings] +CompanyName = "SoftEther Corporation" +DiskDescription = "VPN Client Device Driver Install Disk" +Neo.Service.Name = "Neo_VPN93" +Neo.Service.DispName = "VPN Client Device Driver - VPN93" +Neo.Service.Desc = "VPN Client Adapter - VPN93" +NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN93" +Neo.EventLog.Name = "Neo" +NetworkAddress = "MAC Address" +DefaultAddress = "000001000001" +MaxSpeed = "Indicate Speed (Mbps)" +KeepLink = "Keep Link" +On = "On" +Off = "Off" + + +; Auto Generated 20180205_163608.849 + diff --git a/src/bin/hamcore/DriverPackages/Neo6_Win8/x86/Neo6_x86_VPN94.inf b/src/bin/hamcore/DriverPackages/Neo6_Win8/x86/Neo6_x86_VPN94.inf index fb486df0..bb8c1e6f 100644 --- a/src/bin/hamcore/DriverPackages/Neo6_Win8/x86/Neo6_x86_VPN94.inf +++ b/src/bin/hamcore/DriverPackages/Neo6_Win8/x86/Neo6_x86_VPN94.inf @@ -1,114 +1,114 @@ -; VPN Client Device Driver for Windows 2000 and Greater -; -; Copyright (c) SoftEther Corporation. All Rights Reserved. -; http://www.softether.co.jp/ -; -; BUILD 9658 - -[Version] -Signature = "$Windows NT$" -Class = Net -ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} -Provider = %CompanyName% -DriverVer = 02/04/2018, 4.25.0.9658 -CatalogFile.NT = inf_VPN94.cat - -[Manufacturer] -%CompanyName% = SoftEther - -[SourceDisksNames] -1=%DiskDescription%, "", , - -[SourceDisksFiles] -Neo_VPN94.sys = 1 - -[DestinationDirs] -DefaultDestDir = 12 -Neo.CopyFiles.Sys = 12 - -[Neo.CopyFiles.Sys] -Neo_VPN94.sys, , , 2 - -[SoftEther] -%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN94 - -[NeoAdapter.Install] -Characteristics = 0x1 -AddReg = Neo.Reg, NeoAdapter.Ndi -CopyFiles = Neo.CopyFiles.Sys -*IfType = 53 -*MediaType = 0 -*PhysicalMediaType = 0 - -[NeoAdapter.Install.Services] -AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% - -[NeoAdapter.Ndi] -HKR, , NetworkAddress, 0, %DefaultAddress% -HKR, Ndi, DeviceID, , "NeoAdapter_VPN94" -HKR, , DevLoader, , ndis -HKR, , DeviceVxDs, , Neo_VPN94.sys -HKR, NDIS, LogDriverName, , "Neo_VPN94" -HKR, NDIS, MajorNdisVersion, 1, 5 -HKR, NDIS, MinorNdisVersion, 1, 0 -HKR, Ndi\Interfaces, DefUpper, , "ndis5" -HKR, Ndi\Interfaces, UpperRange, , "ndis5" -HKR, Ndi\Interfaces, LowerRange, , "ethernet" -HKR, Ndi\Interfaces, DefLower, , "ethernet" -HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" -HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% -HKR, Ndi\Params\NetworkAddress, type, 0, "edit" -HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" -HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" -HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% -HKR, Ndi\Params\NetworkAddress, optional, 0, "0" -HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% -HKR, Ndi\Params\MaxSpeed, type, 0, "int" -HKR, Ndi\Params\MaxSpeed, default, 0, "100" -HKR, Ndi\Params\MaxSpeed, min, 0, "0" -HKR, Ndi\Params\MaxSpeed, max, 0, "2000" -HKR, Ndi\Params\MaxSpeed, step, 0, "1" -HKR, Ndi\Params\MaxSpeed, Base, 0, "10" -HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% -HKR, Ndi\Params\KeepLink, type, 0, "enum" -HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% -HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% -HKR, Ndi\Params\KeepLink, default, 0, "0" - - -[Neo.Service] -DisplayName = %Neo.Service.DispName% -Description = %Neo.Service.Desc% -ServiceType = 1 -StartType = 3 -ErrorControl = 1 -ServiceBinary = %12%\Neo_VPN94.sys -LoadOrderGroup = NDIS - -[Neo.Reg] -HKR, Ndi, Service, 0, Neo.Service.Name -HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" -HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" - -[Neo.EventLog] -HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN94.sys" -HKR, , TypesSupported, 0x00010001, 7 - -[Strings] -CompanyName = "SoftEther Corporation" -DiskDescription = "VPN Client Device Driver Install Disk" -Neo.Service.Name = "Neo_VPN94" -Neo.Service.DispName = "VPN Client Device Driver - VPN94" -Neo.Service.Desc = "VPN Client Adapter - VPN94" -NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN94" -Neo.EventLog.Name = "Neo" -NetworkAddress = "MAC Address" -DefaultAddress = "000001000001" -MaxSpeed = "Indicate Speed (Mbps)" -KeepLink = "Keep Link" -On = "On" -Off = "Off" - - -; Auto Generated 20180205_163608.850 - +; VPN Client Device Driver for Windows 2000 and Greater +; +; Copyright (c) SoftEther Corporation. All Rights Reserved. +; http://www.softether.co.jp/ +; +; BUILD 9658 + +[Version] +Signature = "$Windows NT$" +Class = Net +ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} +Provider = %CompanyName% +DriverVer = 02/04/2018, 4.25.0.9658 +CatalogFile.NT = inf_VPN94.cat + +[Manufacturer] +%CompanyName% = SoftEther + +[SourceDisksNames] +1=%DiskDescription%, "", , + +[SourceDisksFiles] +Neo_VPN94.sys = 1 + +[DestinationDirs] +DefaultDestDir = 12 +Neo.CopyFiles.Sys = 12 + +[Neo.CopyFiles.Sys] +Neo_VPN94.sys, , , 2 + +[SoftEther] +%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN94 + +[NeoAdapter.Install] +Characteristics = 0x1 +AddReg = Neo.Reg, NeoAdapter.Ndi +CopyFiles = Neo.CopyFiles.Sys +*IfType = 53 +*MediaType = 0 +*PhysicalMediaType = 0 + +[NeoAdapter.Install.Services] +AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% + +[NeoAdapter.Ndi] +HKR, , NetworkAddress, 0, %DefaultAddress% +HKR, Ndi, DeviceID, , "NeoAdapter_VPN94" +HKR, , DevLoader, , ndis +HKR, , DeviceVxDs, , Neo_VPN94.sys +HKR, NDIS, LogDriverName, , "Neo_VPN94" +HKR, NDIS, MajorNdisVersion, 1, 5 +HKR, NDIS, MinorNdisVersion, 1, 0 +HKR, Ndi\Interfaces, DefUpper, , "ndis5" +HKR, Ndi\Interfaces, UpperRange, , "ndis5" +HKR, Ndi\Interfaces, LowerRange, , "ethernet" +HKR, Ndi\Interfaces, DefLower, , "ethernet" +HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" +HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% +HKR, Ndi\Params\NetworkAddress, type, 0, "edit" +HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" +HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" +HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% +HKR, Ndi\Params\NetworkAddress, optional, 0, "0" +HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% +HKR, Ndi\Params\MaxSpeed, type, 0, "int" +HKR, Ndi\Params\MaxSpeed, default, 0, "100" +HKR, Ndi\Params\MaxSpeed, min, 0, "0" +HKR, Ndi\Params\MaxSpeed, max, 0, "2000" +HKR, Ndi\Params\MaxSpeed, step, 0, "1" +HKR, Ndi\Params\MaxSpeed, Base, 0, "10" +HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% +HKR, Ndi\Params\KeepLink, type, 0, "enum" +HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% +HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% +HKR, Ndi\Params\KeepLink, default, 0, "0" + + +[Neo.Service] +DisplayName = %Neo.Service.DispName% +Description = %Neo.Service.Desc% +ServiceType = 1 +StartType = 3 +ErrorControl = 1 +ServiceBinary = %12%\Neo_VPN94.sys +LoadOrderGroup = NDIS + +[Neo.Reg] +HKR, Ndi, Service, 0, Neo.Service.Name +HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" +HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" + +[Neo.EventLog] +HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN94.sys" +HKR, , TypesSupported, 0x00010001, 7 + +[Strings] +CompanyName = "SoftEther Corporation" +DiskDescription = "VPN Client Device Driver Install Disk" +Neo.Service.Name = "Neo_VPN94" +Neo.Service.DispName = "VPN Client Device Driver - VPN94" +Neo.Service.Desc = "VPN Client Adapter - VPN94" +NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN94" +Neo.EventLog.Name = "Neo" +NetworkAddress = "MAC Address" +DefaultAddress = "000001000001" +MaxSpeed = "Indicate Speed (Mbps)" +KeepLink = "Keep Link" +On = "On" +Off = "Off" + + +; Auto Generated 20180205_163608.850 + diff --git a/src/bin/hamcore/DriverPackages/Neo6_Win8/x86/Neo6_x86_VPN95.inf b/src/bin/hamcore/DriverPackages/Neo6_Win8/x86/Neo6_x86_VPN95.inf index b6a11b58..1b6a592f 100644 --- a/src/bin/hamcore/DriverPackages/Neo6_Win8/x86/Neo6_x86_VPN95.inf +++ b/src/bin/hamcore/DriverPackages/Neo6_Win8/x86/Neo6_x86_VPN95.inf @@ -1,114 +1,114 @@ -; VPN Client Device Driver for Windows 2000 and Greater -; -; Copyright (c) SoftEther Corporation. All Rights Reserved. -; http://www.softether.co.jp/ -; -; BUILD 9658 - -[Version] -Signature = "$Windows NT$" -Class = Net -ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} -Provider = %CompanyName% -DriverVer = 02/04/2018, 4.25.0.9658 -CatalogFile.NT = inf_VPN95.cat - -[Manufacturer] -%CompanyName% = SoftEther - -[SourceDisksNames] -1=%DiskDescription%, "", , - -[SourceDisksFiles] -Neo_VPN95.sys = 1 - -[DestinationDirs] -DefaultDestDir = 12 -Neo.CopyFiles.Sys = 12 - -[Neo.CopyFiles.Sys] -Neo_VPN95.sys, , , 2 - -[SoftEther] -%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN95 - -[NeoAdapter.Install] -Characteristics = 0x1 -AddReg = Neo.Reg, NeoAdapter.Ndi -CopyFiles = Neo.CopyFiles.Sys -*IfType = 53 -*MediaType = 0 -*PhysicalMediaType = 0 - -[NeoAdapter.Install.Services] -AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% - -[NeoAdapter.Ndi] -HKR, , NetworkAddress, 0, %DefaultAddress% -HKR, Ndi, DeviceID, , "NeoAdapter_VPN95" -HKR, , DevLoader, , ndis -HKR, , DeviceVxDs, , Neo_VPN95.sys -HKR, NDIS, LogDriverName, , "Neo_VPN95" -HKR, NDIS, MajorNdisVersion, 1, 5 -HKR, NDIS, MinorNdisVersion, 1, 0 -HKR, Ndi\Interfaces, DefUpper, , "ndis5" -HKR, Ndi\Interfaces, UpperRange, , "ndis5" -HKR, Ndi\Interfaces, LowerRange, , "ethernet" -HKR, Ndi\Interfaces, DefLower, , "ethernet" -HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" -HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% -HKR, Ndi\Params\NetworkAddress, type, 0, "edit" -HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" -HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" -HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% -HKR, Ndi\Params\NetworkAddress, optional, 0, "0" -HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% -HKR, Ndi\Params\MaxSpeed, type, 0, "int" -HKR, Ndi\Params\MaxSpeed, default, 0, "100" -HKR, Ndi\Params\MaxSpeed, min, 0, "0" -HKR, Ndi\Params\MaxSpeed, max, 0, "2000" -HKR, Ndi\Params\MaxSpeed, step, 0, "1" -HKR, Ndi\Params\MaxSpeed, Base, 0, "10" -HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% -HKR, Ndi\Params\KeepLink, type, 0, "enum" -HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% -HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% -HKR, Ndi\Params\KeepLink, default, 0, "0" - - -[Neo.Service] -DisplayName = %Neo.Service.DispName% -Description = %Neo.Service.Desc% -ServiceType = 1 -StartType = 3 -ErrorControl = 1 -ServiceBinary = %12%\Neo_VPN95.sys -LoadOrderGroup = NDIS - -[Neo.Reg] -HKR, Ndi, Service, 0, Neo.Service.Name -HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" -HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" - -[Neo.EventLog] -HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN95.sys" -HKR, , TypesSupported, 0x00010001, 7 - -[Strings] -CompanyName = "SoftEther Corporation" -DiskDescription = "VPN Client Device Driver Install Disk" -Neo.Service.Name = "Neo_VPN95" -Neo.Service.DispName = "VPN Client Device Driver - VPN95" -Neo.Service.Desc = "VPN Client Adapter - VPN95" -NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN95" -Neo.EventLog.Name = "Neo" -NetworkAddress = "MAC Address" -DefaultAddress = "000001000001" -MaxSpeed = "Indicate Speed (Mbps)" -KeepLink = "Keep Link" -On = "On" -Off = "Off" - - -; Auto Generated 20180205_163608.850 - +; VPN Client Device Driver for Windows 2000 and Greater +; +; Copyright (c) SoftEther Corporation. All Rights Reserved. +; http://www.softether.co.jp/ +; +; BUILD 9658 + +[Version] +Signature = "$Windows NT$" +Class = Net +ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} +Provider = %CompanyName% +DriverVer = 02/04/2018, 4.25.0.9658 +CatalogFile.NT = inf_VPN95.cat + +[Manufacturer] +%CompanyName% = SoftEther + +[SourceDisksNames] +1=%DiskDescription%, "", , + +[SourceDisksFiles] +Neo_VPN95.sys = 1 + +[DestinationDirs] +DefaultDestDir = 12 +Neo.CopyFiles.Sys = 12 + +[Neo.CopyFiles.Sys] +Neo_VPN95.sys, , , 2 + +[SoftEther] +%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN95 + +[NeoAdapter.Install] +Characteristics = 0x1 +AddReg = Neo.Reg, NeoAdapter.Ndi +CopyFiles = Neo.CopyFiles.Sys +*IfType = 53 +*MediaType = 0 +*PhysicalMediaType = 0 + +[NeoAdapter.Install.Services] +AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% + +[NeoAdapter.Ndi] +HKR, , NetworkAddress, 0, %DefaultAddress% +HKR, Ndi, DeviceID, , "NeoAdapter_VPN95" +HKR, , DevLoader, , ndis +HKR, , DeviceVxDs, , Neo_VPN95.sys +HKR, NDIS, LogDriverName, , "Neo_VPN95" +HKR, NDIS, MajorNdisVersion, 1, 5 +HKR, NDIS, MinorNdisVersion, 1, 0 +HKR, Ndi\Interfaces, DefUpper, , "ndis5" +HKR, Ndi\Interfaces, UpperRange, , "ndis5" +HKR, Ndi\Interfaces, LowerRange, , "ethernet" +HKR, Ndi\Interfaces, DefLower, , "ethernet" +HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" +HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% +HKR, Ndi\Params\NetworkAddress, type, 0, "edit" +HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" +HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" +HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% +HKR, Ndi\Params\NetworkAddress, optional, 0, "0" +HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% +HKR, Ndi\Params\MaxSpeed, type, 0, "int" +HKR, Ndi\Params\MaxSpeed, default, 0, "100" +HKR, Ndi\Params\MaxSpeed, min, 0, "0" +HKR, Ndi\Params\MaxSpeed, max, 0, "2000" +HKR, Ndi\Params\MaxSpeed, step, 0, "1" +HKR, Ndi\Params\MaxSpeed, Base, 0, "10" +HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% +HKR, Ndi\Params\KeepLink, type, 0, "enum" +HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% +HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% +HKR, Ndi\Params\KeepLink, default, 0, "0" + + +[Neo.Service] +DisplayName = %Neo.Service.DispName% +Description = %Neo.Service.Desc% +ServiceType = 1 +StartType = 3 +ErrorControl = 1 +ServiceBinary = %12%\Neo_VPN95.sys +LoadOrderGroup = NDIS + +[Neo.Reg] +HKR, Ndi, Service, 0, Neo.Service.Name +HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" +HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" + +[Neo.EventLog] +HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN95.sys" +HKR, , TypesSupported, 0x00010001, 7 + +[Strings] +CompanyName = "SoftEther Corporation" +DiskDescription = "VPN Client Device Driver Install Disk" +Neo.Service.Name = "Neo_VPN95" +Neo.Service.DispName = "VPN Client Device Driver - VPN95" +Neo.Service.Desc = "VPN Client Adapter - VPN95" +NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN95" +Neo.EventLog.Name = "Neo" +NetworkAddress = "MAC Address" +DefaultAddress = "000001000001" +MaxSpeed = "Indicate Speed (Mbps)" +KeepLink = "Keep Link" +On = "On" +Off = "Off" + + +; Auto Generated 20180205_163608.850 + diff --git a/src/bin/hamcore/DriverPackages/Neo6_Win8/x86/Neo6_x86_VPN96.inf b/src/bin/hamcore/DriverPackages/Neo6_Win8/x86/Neo6_x86_VPN96.inf index 954187df..0f5a9f9b 100644 --- a/src/bin/hamcore/DriverPackages/Neo6_Win8/x86/Neo6_x86_VPN96.inf +++ b/src/bin/hamcore/DriverPackages/Neo6_Win8/x86/Neo6_x86_VPN96.inf @@ -1,114 +1,114 @@ -; VPN Client Device Driver for Windows 2000 and Greater -; -; Copyright (c) SoftEther Corporation. All Rights Reserved. -; http://www.softether.co.jp/ -; -; BUILD 9658 - -[Version] -Signature = "$Windows NT$" -Class = Net -ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} -Provider = %CompanyName% -DriverVer = 02/04/2018, 4.25.0.9658 -CatalogFile.NT = inf_VPN96.cat - -[Manufacturer] -%CompanyName% = SoftEther - -[SourceDisksNames] -1=%DiskDescription%, "", , - -[SourceDisksFiles] -Neo_VPN96.sys = 1 - -[DestinationDirs] -DefaultDestDir = 12 -Neo.CopyFiles.Sys = 12 - -[Neo.CopyFiles.Sys] -Neo_VPN96.sys, , , 2 - -[SoftEther] -%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN96 - -[NeoAdapter.Install] -Characteristics = 0x1 -AddReg = Neo.Reg, NeoAdapter.Ndi -CopyFiles = Neo.CopyFiles.Sys -*IfType = 53 -*MediaType = 0 -*PhysicalMediaType = 0 - -[NeoAdapter.Install.Services] -AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% - -[NeoAdapter.Ndi] -HKR, , NetworkAddress, 0, %DefaultAddress% -HKR, Ndi, DeviceID, , "NeoAdapter_VPN96" -HKR, , DevLoader, , ndis -HKR, , DeviceVxDs, , Neo_VPN96.sys -HKR, NDIS, LogDriverName, , "Neo_VPN96" -HKR, NDIS, MajorNdisVersion, 1, 5 -HKR, NDIS, MinorNdisVersion, 1, 0 -HKR, Ndi\Interfaces, DefUpper, , "ndis5" -HKR, Ndi\Interfaces, UpperRange, , "ndis5" -HKR, Ndi\Interfaces, LowerRange, , "ethernet" -HKR, Ndi\Interfaces, DefLower, , "ethernet" -HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" -HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% -HKR, Ndi\Params\NetworkAddress, type, 0, "edit" -HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" -HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" -HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% -HKR, Ndi\Params\NetworkAddress, optional, 0, "0" -HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% -HKR, Ndi\Params\MaxSpeed, type, 0, "int" -HKR, Ndi\Params\MaxSpeed, default, 0, "100" -HKR, Ndi\Params\MaxSpeed, min, 0, "0" -HKR, Ndi\Params\MaxSpeed, max, 0, "2000" -HKR, Ndi\Params\MaxSpeed, step, 0, "1" -HKR, Ndi\Params\MaxSpeed, Base, 0, "10" -HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% -HKR, Ndi\Params\KeepLink, type, 0, "enum" -HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% -HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% -HKR, Ndi\Params\KeepLink, default, 0, "0" - - -[Neo.Service] -DisplayName = %Neo.Service.DispName% -Description = %Neo.Service.Desc% -ServiceType = 1 -StartType = 3 -ErrorControl = 1 -ServiceBinary = %12%\Neo_VPN96.sys -LoadOrderGroup = NDIS - -[Neo.Reg] -HKR, Ndi, Service, 0, Neo.Service.Name -HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" -HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" - -[Neo.EventLog] -HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN96.sys" -HKR, , TypesSupported, 0x00010001, 7 - -[Strings] -CompanyName = "SoftEther Corporation" -DiskDescription = "VPN Client Device Driver Install Disk" -Neo.Service.Name = "Neo_VPN96" -Neo.Service.DispName = "VPN Client Device Driver - VPN96" -Neo.Service.Desc = "VPN Client Adapter - VPN96" -NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN96" -Neo.EventLog.Name = "Neo" -NetworkAddress = "MAC Address" -DefaultAddress = "000001000001" -MaxSpeed = "Indicate Speed (Mbps)" -KeepLink = "Keep Link" -On = "On" -Off = "Off" - - -; Auto Generated 20180205_163608.851 - +; VPN Client Device Driver for Windows 2000 and Greater +; +; Copyright (c) SoftEther Corporation. All Rights Reserved. +; http://www.softether.co.jp/ +; +; BUILD 9658 + +[Version] +Signature = "$Windows NT$" +Class = Net +ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} +Provider = %CompanyName% +DriverVer = 02/04/2018, 4.25.0.9658 +CatalogFile.NT = inf_VPN96.cat + +[Manufacturer] +%CompanyName% = SoftEther + +[SourceDisksNames] +1=%DiskDescription%, "", , + +[SourceDisksFiles] +Neo_VPN96.sys = 1 + +[DestinationDirs] +DefaultDestDir = 12 +Neo.CopyFiles.Sys = 12 + +[Neo.CopyFiles.Sys] +Neo_VPN96.sys, , , 2 + +[SoftEther] +%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN96 + +[NeoAdapter.Install] +Characteristics = 0x1 +AddReg = Neo.Reg, NeoAdapter.Ndi +CopyFiles = Neo.CopyFiles.Sys +*IfType = 53 +*MediaType = 0 +*PhysicalMediaType = 0 + +[NeoAdapter.Install.Services] +AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% + +[NeoAdapter.Ndi] +HKR, , NetworkAddress, 0, %DefaultAddress% +HKR, Ndi, DeviceID, , "NeoAdapter_VPN96" +HKR, , DevLoader, , ndis +HKR, , DeviceVxDs, , Neo_VPN96.sys +HKR, NDIS, LogDriverName, , "Neo_VPN96" +HKR, NDIS, MajorNdisVersion, 1, 5 +HKR, NDIS, MinorNdisVersion, 1, 0 +HKR, Ndi\Interfaces, DefUpper, , "ndis5" +HKR, Ndi\Interfaces, UpperRange, , "ndis5" +HKR, Ndi\Interfaces, LowerRange, , "ethernet" +HKR, Ndi\Interfaces, DefLower, , "ethernet" +HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" +HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% +HKR, Ndi\Params\NetworkAddress, type, 0, "edit" +HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" +HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" +HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% +HKR, Ndi\Params\NetworkAddress, optional, 0, "0" +HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% +HKR, Ndi\Params\MaxSpeed, type, 0, "int" +HKR, Ndi\Params\MaxSpeed, default, 0, "100" +HKR, Ndi\Params\MaxSpeed, min, 0, "0" +HKR, Ndi\Params\MaxSpeed, max, 0, "2000" +HKR, Ndi\Params\MaxSpeed, step, 0, "1" +HKR, Ndi\Params\MaxSpeed, Base, 0, "10" +HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% +HKR, Ndi\Params\KeepLink, type, 0, "enum" +HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% +HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% +HKR, Ndi\Params\KeepLink, default, 0, "0" + + +[Neo.Service] +DisplayName = %Neo.Service.DispName% +Description = %Neo.Service.Desc% +ServiceType = 1 +StartType = 3 +ErrorControl = 1 +ServiceBinary = %12%\Neo_VPN96.sys +LoadOrderGroup = NDIS + +[Neo.Reg] +HKR, Ndi, Service, 0, Neo.Service.Name +HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" +HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" + +[Neo.EventLog] +HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN96.sys" +HKR, , TypesSupported, 0x00010001, 7 + +[Strings] +CompanyName = "SoftEther Corporation" +DiskDescription = "VPN Client Device Driver Install Disk" +Neo.Service.Name = "Neo_VPN96" +Neo.Service.DispName = "VPN Client Device Driver - VPN96" +Neo.Service.Desc = "VPN Client Adapter - VPN96" +NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN96" +Neo.EventLog.Name = "Neo" +NetworkAddress = "MAC Address" +DefaultAddress = "000001000001" +MaxSpeed = "Indicate Speed (Mbps)" +KeepLink = "Keep Link" +On = "On" +Off = "Off" + + +; Auto Generated 20180205_163608.851 + diff --git a/src/bin/hamcore/DriverPackages/Neo6_Win8/x86/Neo6_x86_VPN97.inf b/src/bin/hamcore/DriverPackages/Neo6_Win8/x86/Neo6_x86_VPN97.inf index 08994bb9..498b8c0b 100644 --- a/src/bin/hamcore/DriverPackages/Neo6_Win8/x86/Neo6_x86_VPN97.inf +++ b/src/bin/hamcore/DriverPackages/Neo6_Win8/x86/Neo6_x86_VPN97.inf @@ -1,114 +1,114 @@ -; VPN Client Device Driver for Windows 2000 and Greater -; -; Copyright (c) SoftEther Corporation. All Rights Reserved. -; http://www.softether.co.jp/ -; -; BUILD 9658 - -[Version] -Signature = "$Windows NT$" -Class = Net -ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} -Provider = %CompanyName% -DriverVer = 02/04/2018, 4.25.0.9658 -CatalogFile.NT = inf_VPN97.cat - -[Manufacturer] -%CompanyName% = SoftEther - -[SourceDisksNames] -1=%DiskDescription%, "", , - -[SourceDisksFiles] -Neo_VPN97.sys = 1 - -[DestinationDirs] -DefaultDestDir = 12 -Neo.CopyFiles.Sys = 12 - -[Neo.CopyFiles.Sys] -Neo_VPN97.sys, , , 2 - -[SoftEther] -%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN97 - -[NeoAdapter.Install] -Characteristics = 0x1 -AddReg = Neo.Reg, NeoAdapter.Ndi -CopyFiles = Neo.CopyFiles.Sys -*IfType = 53 -*MediaType = 0 -*PhysicalMediaType = 0 - -[NeoAdapter.Install.Services] -AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% - -[NeoAdapter.Ndi] -HKR, , NetworkAddress, 0, %DefaultAddress% -HKR, Ndi, DeviceID, , "NeoAdapter_VPN97" -HKR, , DevLoader, , ndis -HKR, , DeviceVxDs, , Neo_VPN97.sys -HKR, NDIS, LogDriverName, , "Neo_VPN97" -HKR, NDIS, MajorNdisVersion, 1, 5 -HKR, NDIS, MinorNdisVersion, 1, 0 -HKR, Ndi\Interfaces, DefUpper, , "ndis5" -HKR, Ndi\Interfaces, UpperRange, , "ndis5" -HKR, Ndi\Interfaces, LowerRange, , "ethernet" -HKR, Ndi\Interfaces, DefLower, , "ethernet" -HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" -HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% -HKR, Ndi\Params\NetworkAddress, type, 0, "edit" -HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" -HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" -HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% -HKR, Ndi\Params\NetworkAddress, optional, 0, "0" -HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% -HKR, Ndi\Params\MaxSpeed, type, 0, "int" -HKR, Ndi\Params\MaxSpeed, default, 0, "100" -HKR, Ndi\Params\MaxSpeed, min, 0, "0" -HKR, Ndi\Params\MaxSpeed, max, 0, "2000" -HKR, Ndi\Params\MaxSpeed, step, 0, "1" -HKR, Ndi\Params\MaxSpeed, Base, 0, "10" -HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% -HKR, Ndi\Params\KeepLink, type, 0, "enum" -HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% -HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% -HKR, Ndi\Params\KeepLink, default, 0, "0" - - -[Neo.Service] -DisplayName = %Neo.Service.DispName% -Description = %Neo.Service.Desc% -ServiceType = 1 -StartType = 3 -ErrorControl = 1 -ServiceBinary = %12%\Neo_VPN97.sys -LoadOrderGroup = NDIS - -[Neo.Reg] -HKR, Ndi, Service, 0, Neo.Service.Name -HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" -HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" - -[Neo.EventLog] -HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN97.sys" -HKR, , TypesSupported, 0x00010001, 7 - -[Strings] -CompanyName = "SoftEther Corporation" -DiskDescription = "VPN Client Device Driver Install Disk" -Neo.Service.Name = "Neo_VPN97" -Neo.Service.DispName = "VPN Client Device Driver - VPN97" -Neo.Service.Desc = "VPN Client Adapter - VPN97" -NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN97" -Neo.EventLog.Name = "Neo" -NetworkAddress = "MAC Address" -DefaultAddress = "000001000001" -MaxSpeed = "Indicate Speed (Mbps)" -KeepLink = "Keep Link" -On = "On" -Off = "Off" - - -; Auto Generated 20180205_163608.852 - +; VPN Client Device Driver for Windows 2000 and Greater +; +; Copyright (c) SoftEther Corporation. All Rights Reserved. +; http://www.softether.co.jp/ +; +; BUILD 9658 + +[Version] +Signature = "$Windows NT$" +Class = Net +ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} +Provider = %CompanyName% +DriverVer = 02/04/2018, 4.25.0.9658 +CatalogFile.NT = inf_VPN97.cat + +[Manufacturer] +%CompanyName% = SoftEther + +[SourceDisksNames] +1=%DiskDescription%, "", , + +[SourceDisksFiles] +Neo_VPN97.sys = 1 + +[DestinationDirs] +DefaultDestDir = 12 +Neo.CopyFiles.Sys = 12 + +[Neo.CopyFiles.Sys] +Neo_VPN97.sys, , , 2 + +[SoftEther] +%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN97 + +[NeoAdapter.Install] +Characteristics = 0x1 +AddReg = Neo.Reg, NeoAdapter.Ndi +CopyFiles = Neo.CopyFiles.Sys +*IfType = 53 +*MediaType = 0 +*PhysicalMediaType = 0 + +[NeoAdapter.Install.Services] +AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% + +[NeoAdapter.Ndi] +HKR, , NetworkAddress, 0, %DefaultAddress% +HKR, Ndi, DeviceID, , "NeoAdapter_VPN97" +HKR, , DevLoader, , ndis +HKR, , DeviceVxDs, , Neo_VPN97.sys +HKR, NDIS, LogDriverName, , "Neo_VPN97" +HKR, NDIS, MajorNdisVersion, 1, 5 +HKR, NDIS, MinorNdisVersion, 1, 0 +HKR, Ndi\Interfaces, DefUpper, , "ndis5" +HKR, Ndi\Interfaces, UpperRange, , "ndis5" +HKR, Ndi\Interfaces, LowerRange, , "ethernet" +HKR, Ndi\Interfaces, DefLower, , "ethernet" +HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" +HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% +HKR, Ndi\Params\NetworkAddress, type, 0, "edit" +HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" +HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" +HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% +HKR, Ndi\Params\NetworkAddress, optional, 0, "0" +HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% +HKR, Ndi\Params\MaxSpeed, type, 0, "int" +HKR, Ndi\Params\MaxSpeed, default, 0, "100" +HKR, Ndi\Params\MaxSpeed, min, 0, "0" +HKR, Ndi\Params\MaxSpeed, max, 0, "2000" +HKR, Ndi\Params\MaxSpeed, step, 0, "1" +HKR, Ndi\Params\MaxSpeed, Base, 0, "10" +HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% +HKR, Ndi\Params\KeepLink, type, 0, "enum" +HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% +HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% +HKR, Ndi\Params\KeepLink, default, 0, "0" + + +[Neo.Service] +DisplayName = %Neo.Service.DispName% +Description = %Neo.Service.Desc% +ServiceType = 1 +StartType = 3 +ErrorControl = 1 +ServiceBinary = %12%\Neo_VPN97.sys +LoadOrderGroup = NDIS + +[Neo.Reg] +HKR, Ndi, Service, 0, Neo.Service.Name +HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" +HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" + +[Neo.EventLog] +HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN97.sys" +HKR, , TypesSupported, 0x00010001, 7 + +[Strings] +CompanyName = "SoftEther Corporation" +DiskDescription = "VPN Client Device Driver Install Disk" +Neo.Service.Name = "Neo_VPN97" +Neo.Service.DispName = "VPN Client Device Driver - VPN97" +Neo.Service.Desc = "VPN Client Adapter - VPN97" +NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN97" +Neo.EventLog.Name = "Neo" +NetworkAddress = "MAC Address" +DefaultAddress = "000001000001" +MaxSpeed = "Indicate Speed (Mbps)" +KeepLink = "Keep Link" +On = "On" +Off = "Off" + + +; Auto Generated 20180205_163608.852 + diff --git a/src/bin/hamcore/DriverPackages/Neo6_Win8/x86/Neo6_x86_VPN98.inf b/src/bin/hamcore/DriverPackages/Neo6_Win8/x86/Neo6_x86_VPN98.inf index 6cf2a838..d16aebb7 100644 --- a/src/bin/hamcore/DriverPackages/Neo6_Win8/x86/Neo6_x86_VPN98.inf +++ b/src/bin/hamcore/DriverPackages/Neo6_Win8/x86/Neo6_x86_VPN98.inf @@ -1,114 +1,114 @@ -; VPN Client Device Driver for Windows 2000 and Greater -; -; Copyright (c) SoftEther Corporation. All Rights Reserved. -; http://www.softether.co.jp/ -; -; BUILD 9658 - -[Version] -Signature = "$Windows NT$" -Class = Net -ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} -Provider = %CompanyName% -DriverVer = 02/04/2018, 4.25.0.9658 -CatalogFile.NT = inf_VPN98.cat - -[Manufacturer] -%CompanyName% = SoftEther - -[SourceDisksNames] -1=%DiskDescription%, "", , - -[SourceDisksFiles] -Neo_VPN98.sys = 1 - -[DestinationDirs] -DefaultDestDir = 12 -Neo.CopyFiles.Sys = 12 - -[Neo.CopyFiles.Sys] -Neo_VPN98.sys, , , 2 - -[SoftEther] -%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN98 - -[NeoAdapter.Install] -Characteristics = 0x1 -AddReg = Neo.Reg, NeoAdapter.Ndi -CopyFiles = Neo.CopyFiles.Sys -*IfType = 53 -*MediaType = 0 -*PhysicalMediaType = 0 - -[NeoAdapter.Install.Services] -AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% - -[NeoAdapter.Ndi] -HKR, , NetworkAddress, 0, %DefaultAddress% -HKR, Ndi, DeviceID, , "NeoAdapter_VPN98" -HKR, , DevLoader, , ndis -HKR, , DeviceVxDs, , Neo_VPN98.sys -HKR, NDIS, LogDriverName, , "Neo_VPN98" -HKR, NDIS, MajorNdisVersion, 1, 5 -HKR, NDIS, MinorNdisVersion, 1, 0 -HKR, Ndi\Interfaces, DefUpper, , "ndis5" -HKR, Ndi\Interfaces, UpperRange, , "ndis5" -HKR, Ndi\Interfaces, LowerRange, , "ethernet" -HKR, Ndi\Interfaces, DefLower, , "ethernet" -HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" -HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% -HKR, Ndi\Params\NetworkAddress, type, 0, "edit" -HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" -HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" -HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% -HKR, Ndi\Params\NetworkAddress, optional, 0, "0" -HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% -HKR, Ndi\Params\MaxSpeed, type, 0, "int" -HKR, Ndi\Params\MaxSpeed, default, 0, "100" -HKR, Ndi\Params\MaxSpeed, min, 0, "0" -HKR, Ndi\Params\MaxSpeed, max, 0, "2000" -HKR, Ndi\Params\MaxSpeed, step, 0, "1" -HKR, Ndi\Params\MaxSpeed, Base, 0, "10" -HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% -HKR, Ndi\Params\KeepLink, type, 0, "enum" -HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% -HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% -HKR, Ndi\Params\KeepLink, default, 0, "0" - - -[Neo.Service] -DisplayName = %Neo.Service.DispName% -Description = %Neo.Service.Desc% -ServiceType = 1 -StartType = 3 -ErrorControl = 1 -ServiceBinary = %12%\Neo_VPN98.sys -LoadOrderGroup = NDIS - -[Neo.Reg] -HKR, Ndi, Service, 0, Neo.Service.Name -HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" -HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" - -[Neo.EventLog] -HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN98.sys" -HKR, , TypesSupported, 0x00010001, 7 - -[Strings] -CompanyName = "SoftEther Corporation" -DiskDescription = "VPN Client Device Driver Install Disk" -Neo.Service.Name = "Neo_VPN98" -Neo.Service.DispName = "VPN Client Device Driver - VPN98" -Neo.Service.Desc = "VPN Client Adapter - VPN98" -NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN98" -Neo.EventLog.Name = "Neo" -NetworkAddress = "MAC Address" -DefaultAddress = "000001000001" -MaxSpeed = "Indicate Speed (Mbps)" -KeepLink = "Keep Link" -On = "On" -Off = "Off" - - -; Auto Generated 20180205_163608.853 - +; VPN Client Device Driver for Windows 2000 and Greater +; +; Copyright (c) SoftEther Corporation. All Rights Reserved. +; http://www.softether.co.jp/ +; +; BUILD 9658 + +[Version] +Signature = "$Windows NT$" +Class = Net +ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} +Provider = %CompanyName% +DriverVer = 02/04/2018, 4.25.0.9658 +CatalogFile.NT = inf_VPN98.cat + +[Manufacturer] +%CompanyName% = SoftEther + +[SourceDisksNames] +1=%DiskDescription%, "", , + +[SourceDisksFiles] +Neo_VPN98.sys = 1 + +[DestinationDirs] +DefaultDestDir = 12 +Neo.CopyFiles.Sys = 12 + +[Neo.CopyFiles.Sys] +Neo_VPN98.sys, , , 2 + +[SoftEther] +%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN98 + +[NeoAdapter.Install] +Characteristics = 0x1 +AddReg = Neo.Reg, NeoAdapter.Ndi +CopyFiles = Neo.CopyFiles.Sys +*IfType = 53 +*MediaType = 0 +*PhysicalMediaType = 0 + +[NeoAdapter.Install.Services] +AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% + +[NeoAdapter.Ndi] +HKR, , NetworkAddress, 0, %DefaultAddress% +HKR, Ndi, DeviceID, , "NeoAdapter_VPN98" +HKR, , DevLoader, , ndis +HKR, , DeviceVxDs, , Neo_VPN98.sys +HKR, NDIS, LogDriverName, , "Neo_VPN98" +HKR, NDIS, MajorNdisVersion, 1, 5 +HKR, NDIS, MinorNdisVersion, 1, 0 +HKR, Ndi\Interfaces, DefUpper, , "ndis5" +HKR, Ndi\Interfaces, UpperRange, , "ndis5" +HKR, Ndi\Interfaces, LowerRange, , "ethernet" +HKR, Ndi\Interfaces, DefLower, , "ethernet" +HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" +HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% +HKR, Ndi\Params\NetworkAddress, type, 0, "edit" +HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" +HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" +HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% +HKR, Ndi\Params\NetworkAddress, optional, 0, "0" +HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% +HKR, Ndi\Params\MaxSpeed, type, 0, "int" +HKR, Ndi\Params\MaxSpeed, default, 0, "100" +HKR, Ndi\Params\MaxSpeed, min, 0, "0" +HKR, Ndi\Params\MaxSpeed, max, 0, "2000" +HKR, Ndi\Params\MaxSpeed, step, 0, "1" +HKR, Ndi\Params\MaxSpeed, Base, 0, "10" +HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% +HKR, Ndi\Params\KeepLink, type, 0, "enum" +HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% +HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% +HKR, Ndi\Params\KeepLink, default, 0, "0" + + +[Neo.Service] +DisplayName = %Neo.Service.DispName% +Description = %Neo.Service.Desc% +ServiceType = 1 +StartType = 3 +ErrorControl = 1 +ServiceBinary = %12%\Neo_VPN98.sys +LoadOrderGroup = NDIS + +[Neo.Reg] +HKR, Ndi, Service, 0, Neo.Service.Name +HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" +HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" + +[Neo.EventLog] +HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN98.sys" +HKR, , TypesSupported, 0x00010001, 7 + +[Strings] +CompanyName = "SoftEther Corporation" +DiskDescription = "VPN Client Device Driver Install Disk" +Neo.Service.Name = "Neo_VPN98" +Neo.Service.DispName = "VPN Client Device Driver - VPN98" +Neo.Service.Desc = "VPN Client Adapter - VPN98" +NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN98" +Neo.EventLog.Name = "Neo" +NetworkAddress = "MAC Address" +DefaultAddress = "000001000001" +MaxSpeed = "Indicate Speed (Mbps)" +KeepLink = "Keep Link" +On = "On" +Off = "Off" + + +; Auto Generated 20180205_163608.853 + diff --git a/src/bin/hamcore/DriverPackages/Neo6_Win8/x86/Neo6_x86_VPN99.inf b/src/bin/hamcore/DriverPackages/Neo6_Win8/x86/Neo6_x86_VPN99.inf index 86f8b665..4f9bc89b 100644 --- a/src/bin/hamcore/DriverPackages/Neo6_Win8/x86/Neo6_x86_VPN99.inf +++ b/src/bin/hamcore/DriverPackages/Neo6_Win8/x86/Neo6_x86_VPN99.inf @@ -1,114 +1,114 @@ -; VPN Client Device Driver for Windows 2000 and Greater -; -; Copyright (c) SoftEther Corporation. All Rights Reserved. -; http://www.softether.co.jp/ -; -; BUILD 9658 - -[Version] -Signature = "$Windows NT$" -Class = Net -ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} -Provider = %CompanyName% -DriverVer = 02/04/2018, 4.25.0.9658 -CatalogFile.NT = inf_VPN99.cat - -[Manufacturer] -%CompanyName% = SoftEther - -[SourceDisksNames] -1=%DiskDescription%, "", , - -[SourceDisksFiles] -Neo_VPN99.sys = 1 - -[DestinationDirs] -DefaultDestDir = 12 -Neo.CopyFiles.Sys = 12 - -[Neo.CopyFiles.Sys] -Neo_VPN99.sys, , , 2 - -[SoftEther] -%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN99 - -[NeoAdapter.Install] -Characteristics = 0x1 -AddReg = Neo.Reg, NeoAdapter.Ndi -CopyFiles = Neo.CopyFiles.Sys -*IfType = 53 -*MediaType = 0 -*PhysicalMediaType = 0 - -[NeoAdapter.Install.Services] -AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% - -[NeoAdapter.Ndi] -HKR, , NetworkAddress, 0, %DefaultAddress% -HKR, Ndi, DeviceID, , "NeoAdapter_VPN99" -HKR, , DevLoader, , ndis -HKR, , DeviceVxDs, , Neo_VPN99.sys -HKR, NDIS, LogDriverName, , "Neo_VPN99" -HKR, NDIS, MajorNdisVersion, 1, 5 -HKR, NDIS, MinorNdisVersion, 1, 0 -HKR, Ndi\Interfaces, DefUpper, , "ndis5" -HKR, Ndi\Interfaces, UpperRange, , "ndis5" -HKR, Ndi\Interfaces, LowerRange, , "ethernet" -HKR, Ndi\Interfaces, DefLower, , "ethernet" -HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" -HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% -HKR, Ndi\Params\NetworkAddress, type, 0, "edit" -HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" -HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" -HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% -HKR, Ndi\Params\NetworkAddress, optional, 0, "0" -HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% -HKR, Ndi\Params\MaxSpeed, type, 0, "int" -HKR, Ndi\Params\MaxSpeed, default, 0, "100" -HKR, Ndi\Params\MaxSpeed, min, 0, "0" -HKR, Ndi\Params\MaxSpeed, max, 0, "2000" -HKR, Ndi\Params\MaxSpeed, step, 0, "1" -HKR, Ndi\Params\MaxSpeed, Base, 0, "10" -HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% -HKR, Ndi\Params\KeepLink, type, 0, "enum" -HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% -HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% -HKR, Ndi\Params\KeepLink, default, 0, "0" - - -[Neo.Service] -DisplayName = %Neo.Service.DispName% -Description = %Neo.Service.Desc% -ServiceType = 1 -StartType = 3 -ErrorControl = 1 -ServiceBinary = %12%\Neo_VPN99.sys -LoadOrderGroup = NDIS - -[Neo.Reg] -HKR, Ndi, Service, 0, Neo.Service.Name -HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" -HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" - -[Neo.EventLog] -HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN99.sys" -HKR, , TypesSupported, 0x00010001, 7 - -[Strings] -CompanyName = "SoftEther Corporation" -DiskDescription = "VPN Client Device Driver Install Disk" -Neo.Service.Name = "Neo_VPN99" -Neo.Service.DispName = "VPN Client Device Driver - VPN99" -Neo.Service.Desc = "VPN Client Adapter - VPN99" -NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN99" -Neo.EventLog.Name = "Neo" -NetworkAddress = "MAC Address" -DefaultAddress = "000001000001" -MaxSpeed = "Indicate Speed (Mbps)" -KeepLink = "Keep Link" -On = "On" -Off = "Off" - - -; Auto Generated 20180205_163608.853 - +; VPN Client Device Driver for Windows 2000 and Greater +; +; Copyright (c) SoftEther Corporation. All Rights Reserved. +; http://www.softether.co.jp/ +; +; BUILD 9658 + +[Version] +Signature = "$Windows NT$" +Class = Net +ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} +Provider = %CompanyName% +DriverVer = 02/04/2018, 4.25.0.9658 +CatalogFile.NT = inf_VPN99.cat + +[Manufacturer] +%CompanyName% = SoftEther + +[SourceDisksNames] +1=%DiskDescription%, "", , + +[SourceDisksFiles] +Neo_VPN99.sys = 1 + +[DestinationDirs] +DefaultDestDir = 12 +Neo.CopyFiles.Sys = 12 + +[Neo.CopyFiles.Sys] +Neo_VPN99.sys, , , 2 + +[SoftEther] +%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_VPN99 + +[NeoAdapter.Install] +Characteristics = 0x1 +AddReg = Neo.Reg, NeoAdapter.Ndi +CopyFiles = Neo.CopyFiles.Sys +*IfType = 53 +*MediaType = 0 +*PhysicalMediaType = 0 + +[NeoAdapter.Install.Services] +AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% + +[NeoAdapter.Ndi] +HKR, , NetworkAddress, 0, %DefaultAddress% +HKR, Ndi, DeviceID, , "NeoAdapter_VPN99" +HKR, , DevLoader, , ndis +HKR, , DeviceVxDs, , Neo_VPN99.sys +HKR, NDIS, LogDriverName, , "Neo_VPN99" +HKR, NDIS, MajorNdisVersion, 1, 5 +HKR, NDIS, MinorNdisVersion, 1, 0 +HKR, Ndi\Interfaces, DefUpper, , "ndis5" +HKR, Ndi\Interfaces, UpperRange, , "ndis5" +HKR, Ndi\Interfaces, LowerRange, , "ethernet" +HKR, Ndi\Interfaces, DefLower, , "ethernet" +HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" +HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% +HKR, Ndi\Params\NetworkAddress, type, 0, "edit" +HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" +HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" +HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% +HKR, Ndi\Params\NetworkAddress, optional, 0, "0" +HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% +HKR, Ndi\Params\MaxSpeed, type, 0, "int" +HKR, Ndi\Params\MaxSpeed, default, 0, "100" +HKR, Ndi\Params\MaxSpeed, min, 0, "0" +HKR, Ndi\Params\MaxSpeed, max, 0, "2000" +HKR, Ndi\Params\MaxSpeed, step, 0, "1" +HKR, Ndi\Params\MaxSpeed, Base, 0, "10" +HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% +HKR, Ndi\Params\KeepLink, type, 0, "enum" +HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% +HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% +HKR, Ndi\Params\KeepLink, default, 0, "0" + + +[Neo.Service] +DisplayName = %Neo.Service.DispName% +Description = %Neo.Service.Desc% +ServiceType = 1 +StartType = 3 +ErrorControl = 1 +ServiceBinary = %12%\Neo_VPN99.sys +LoadOrderGroup = NDIS + +[Neo.Reg] +HKR, Ndi, Service, 0, Neo.Service.Name +HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" +HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" + +[Neo.EventLog] +HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\Neo_VPN99.sys" +HKR, , TypesSupported, 0x00010001, 7 + +[Strings] +CompanyName = "SoftEther Corporation" +DiskDescription = "VPN Client Device Driver Install Disk" +Neo.Service.Name = "Neo_VPN99" +Neo.Service.DispName = "VPN Client Device Driver - VPN99" +Neo.Service.Desc = "VPN Client Adapter - VPN99" +NeoAdapter.DeviceDesc = "VPN Client Adapter - VPN99" +Neo.EventLog.Name = "Neo" +NetworkAddress = "MAC Address" +DefaultAddress = "000001000001" +MaxSpeed = "Indicate Speed (Mbps)" +KeepLink = "Keep Link" +On = "On" +Off = "Off" + + +; Auto Generated 20180205_163608.853 + diff --git a/src/bin/hamcore/DriverPackages/Neo9x/x86/Neo9x_x86.inf b/src/bin/hamcore/DriverPackages/Neo9x/x86/Neo9x_x86.inf index 381513ca..0b3a11c6 100644 --- a/src/bin/hamcore/DriverPackages/Neo9x/x86/Neo9x_x86.inf +++ b/src/bin/hamcore/DriverPackages/Neo9x/x86/Neo9x_x86.inf @@ -1,116 +1,116 @@ -; VPN Client Device Driver for Windows 98 Second Edition / Windows Millennium Edition -; -; Copyright (c) SoftEther Corporation. All Rights Reserved. -; http://www.softether.co.jp/ -; -; BUILD 9658 - -[Version] -Signature = "$Windows NT$" -Class = Net -ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} -Provider = %CompanyName% -DriverVer = 02/04/2018, 4.25.0.9658 - -[Manufacturer] -%CompanyName% = SoftEther - -[SourceDisksNames] -1=%DiskDescription%, "", , - -[SourceDisksFiles] -$TAG_SYS_NAME$ = 1 - -[DestinationDirs] -DefaultDestDir = 11 -Neo.CopyFiles.Sys = 11 - -[Neo.CopyFiles.Sys] -$TAG_SYS_NAME$, , , 2 - -[SoftEther] -%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_$TAG_INSTANCE_NAME$ - -[NeoAdapter.Install] -Characteristics = 0x1 -AddReg = Neo.Reg, NeoAdapter.Ndi -CopyFiles = Neo.CopyFiles.Sys - -[NeoAdapter.Install.Services] -AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% - -[NeoAdapter.Ndi] -HKR, , MediaType, 0, 1 -HKR, , AdapterType, 0, 5 -HKR, , BusType, 0, 5 -HKR, , NetworkAddress, 0, %DefaultAddress% -HKR, , DriverVersion, 0, "3.0.0.6631" -HKR, , NeoVersion, 0, "3.0.0.6631" -HKR, , DevLoader, , "*ndis" -HKR, , DeviceVxDs, , "$TAG_SYS_NAME$" -HKR, , MatchingDeviceId, , "NeoAdapter_$TAG_INSTANCE_NAME$" -HKR, , EnumPropPages, 0, "netdi.dll,EnumPropPages" -HKR, NDIS, LogDriverName, , "Neo_$TAG_INSTANCE_NAME$" -HKR, NDIS, MajorNdisVersion, 1, 03 -HKR, NDIS, MinorNdisVersion, 1, 0A -HKR, Ndi, DeviceID, , "NeoAdapter_$TAG_INSTANCE_NAME$" -HKR, Ndi\Interfaces, DefUpper, , "ndis3" -HKR, Ndi\Interfaces, UpperRange, , "ndis3" -HKR, Ndi\Interfaces, LowerRange, , "ethernet" -HKR, Ndi\Interfaces, DefLower, , "ethernet" -HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" -HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% -HKR, Ndi\Params\NetworkAddress, type, 0, "edit" -HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" -HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" -HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% -HKR, Ndi\Params\NetworkAddress, optional, 0, "0" -HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% -HKR, Ndi\Params\MaxSpeed, type, 0, "int" -HKR, Ndi\Params\MaxSpeed, default, 0, "100" -HKR, Ndi\Params\MaxSpeed, min, 0, "0" -HKR, Ndi\Params\MaxSpeed, max, 0, "1000" -HKR, Ndi\Params\MaxSpeed, step, 0, "1" -HKR, Ndi\Params\MaxSpeed, Base, 0, "10" -HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% -HKR, Ndi\Params\KeepLink, type, 0, "enum" -HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% -HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% -HKR, Ndi\Params\KeepLink, default, 0, "0" - - -[Neo.Service] -DisplayName = %Neo.Service.DispName% -Description = %Neo.Service.Desc% -ServiceType = 1 -StartType = 3 -ErrorControl = 1 -ServiceBinary = %11%\$TAG_SYS_NAME$ -LoadOrderGroup = NDIS - -[Neo.Reg] -HKR, Ndi, Service, 0, Neo.Service.Name -HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" -HKR, Ndi\Interfaces, UpperRange, 0, "ndis3" - -[Neo.EventLog] -HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\$TAG_SYS_NAME$" -HKR, , TypesSupported, 0x00010001, 7 - -[Strings] -CompanyName = "SoftEther Corporation" -DiskDescription = "VPN Client Device Driver Install Disk" -Neo.Service.Name = "Neo_$TAG_INSTANCE_NAME$" -Neo.Service.DispName = "VPN Client Device Driver - $TAG_INSTANCE_NAME$" -Neo.Service.Desc = "VPN Client Adapter - $TAG_INSTANCE_NAME$" -NeoAdapter.DeviceDesc = "VPN Client Adapter - $TAG_INSTANCE_NAME$" -Neo.EventLog.Name = "Neo" -NetworkAddress = "MAC Address" -DefaultAddress = "$TAG_MAC_ADDRESS$" -MaxSpeed = "Indicate Speed (Mbps)" -KeepLink = "Keep Link" -On = "On" -Off = "Off" - -; Auto Generated 20180205_163608.732 - +; VPN Client Device Driver for Windows 98 Second Edition / Windows Millennium Edition +; +; Copyright (c) SoftEther Corporation. All Rights Reserved. +; http://www.softether.co.jp/ +; +; BUILD 9658 + +[Version] +Signature = "$Windows NT$" +Class = Net +ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} +Provider = %CompanyName% +DriverVer = 02/04/2018, 4.25.0.9658 + +[Manufacturer] +%CompanyName% = SoftEther + +[SourceDisksNames] +1=%DiskDescription%, "", , + +[SourceDisksFiles] +$TAG_SYS_NAME$ = 1 + +[DestinationDirs] +DefaultDestDir = 11 +Neo.CopyFiles.Sys = 11 + +[Neo.CopyFiles.Sys] +$TAG_SYS_NAME$, , , 2 + +[SoftEther] +%NeoAdapter.DeviceDesc% = NeoAdapter.Install, NeoAdapter_$TAG_INSTANCE_NAME$ + +[NeoAdapter.Install] +Characteristics = 0x1 +AddReg = Neo.Reg, NeoAdapter.Ndi +CopyFiles = Neo.CopyFiles.Sys + +[NeoAdapter.Install.Services] +AddService = %Neo.Service.Name%, 2, Neo.Service, Neo.EventLog, , %Neo, EventLog.Name% + +[NeoAdapter.Ndi] +HKR, , MediaType, 0, 1 +HKR, , AdapterType, 0, 5 +HKR, , BusType, 0, 5 +HKR, , NetworkAddress, 0, %DefaultAddress% +HKR, , DriverVersion, 0, "3.0.0.6631" +HKR, , NeoVersion, 0, "3.0.0.6631" +HKR, , DevLoader, , "*ndis" +HKR, , DeviceVxDs, , "$TAG_SYS_NAME$" +HKR, , MatchingDeviceId, , "NeoAdapter_$TAG_INSTANCE_NAME$" +HKR, , EnumPropPages, 0, "netdi.dll,EnumPropPages" +HKR, NDIS, LogDriverName, , "Neo_$TAG_INSTANCE_NAME$" +HKR, NDIS, MajorNdisVersion, 1, 03 +HKR, NDIS, MinorNdisVersion, 1, 0A +HKR, Ndi, DeviceID, , "NeoAdapter_$TAG_INSTANCE_NAME$" +HKR, Ndi\Interfaces, DefUpper, , "ndis3" +HKR, Ndi\Interfaces, UpperRange, , "ndis3" +HKR, Ndi\Interfaces, LowerRange, , "ethernet" +HKR, Ndi\Interfaces, DefLower, , "ethernet" +HKR, Ndi\Install, ndis5, , "Neo.CopyFiles.Sys" +HKR, Ndi\Params\NetworkAddress, ParamDesc, 0, %NetworkAddress% +HKR, Ndi\Params\NetworkAddress, type, 0, "edit" +HKR, Ndi\Params\NetworkAddress, LimitText, 0, "12" +HKR, Ndi\Params\NetworkAddress, UpperCase, 0, "1" +HKR, Ndi\Params\NetworkAddress, default, 0, %DefaultAddress% +HKR, Ndi\Params\NetworkAddress, optional, 0, "0" +HKR, Ndi\Params\MaxSpeed, ParamDesc, 0, %MaxSpeed% +HKR, Ndi\Params\MaxSpeed, type, 0, "int" +HKR, Ndi\Params\MaxSpeed, default, 0, "100" +HKR, Ndi\Params\MaxSpeed, min, 0, "0" +HKR, Ndi\Params\MaxSpeed, max, 0, "1000" +HKR, Ndi\Params\MaxSpeed, step, 0, "1" +HKR, Ndi\Params\MaxSpeed, Base, 0, "10" +HKR, Ndi\Params\KeepLink, ParamDesc, 0, %KeepLink% +HKR, Ndi\Params\KeepLink, type, 0, "enum" +HKR, Ndi\Params\KeepLink\enum, "1", 0, %On% +HKR, Ndi\Params\KeepLink\enum, "0", 0, %Off% +HKR, Ndi\Params\KeepLink, default, 0, "0" + + +[Neo.Service] +DisplayName = %Neo.Service.DispName% +Description = %Neo.Service.Desc% +ServiceType = 1 +StartType = 3 +ErrorControl = 1 +ServiceBinary = %11%\$TAG_SYS_NAME$ +LoadOrderGroup = NDIS + +[Neo.Reg] +HKR, Ndi, Service, 0, Neo.Service.Name +HKR, Ndi\Interfaces, LowerRange, 0, "ethernet" +HKR, Ndi\Interfaces, UpperRange, 0, "ndis3" + +[Neo.EventLog] +HKR, , EventMessageFile, 0x00020000, "%11%\IoLogMsg.dll;%12%\$TAG_SYS_NAME$" +HKR, , TypesSupported, 0x00010001, 7 + +[Strings] +CompanyName = "SoftEther Corporation" +DiskDescription = "VPN Client Device Driver Install Disk" +Neo.Service.Name = "Neo_$TAG_INSTANCE_NAME$" +Neo.Service.DispName = "VPN Client Device Driver - $TAG_INSTANCE_NAME$" +Neo.Service.Desc = "VPN Client Adapter - $TAG_INSTANCE_NAME$" +NeoAdapter.DeviceDesc = "VPN Client Adapter - $TAG_INSTANCE_NAME$" +Neo.EventLog.Name = "Neo" +NetworkAddress = "MAC Address" +DefaultAddress = "$TAG_MAC_ADDRESS$" +MaxSpeed = "Indicate Speed (Mbps)" +KeepLink = "Keep Link" +On = "On" +Off = "Off" + +; Auto Generated 20180205_163608.732 + diff --git a/src/bin/hamcore/DriverPackages/SeLow_Win10/x64/SeLow_x64.inf b/src/bin/hamcore/DriverPackages/SeLow_Win10/x64/SeLow_x64.inf index 9106e4fe..59e1db1e 100644 --- a/src/bin/hamcore/DriverPackages/SeLow_Win10/x64/SeLow_x64.inf +++ b/src/bin/hamcore/DriverPackages/SeLow_Win10/x64/SeLow_x64.inf @@ -1,68 +1,68 @@ -; SeLow - SoftEther Lightweight Ethernet Low Driver -; -; Copyright (c) SoftEther Corporation. All Rights Reserved. -; http://www.softether.co.jp/ -; -; BUILD 9658 - -[Version] -Signature = "$Windows NT$" -Class = NetTrans -ClassGUID = {4D36E975-E325-11CE-BFC1-08002BE10318} -Provider = %CompanyName% -DriverVer = 02/04/2018, 4.25.0.9658 -CatalogFile.NT = SeLow_Win10_x64.cat - -[Manufacturer] -%CompanyName% = SoftEther, NTamd64 - -[SoftEther.NTamd64] -%SeLow_DisplayName% = SeLow_Install, SeLow - -[SeLow_Install] -Characteristics = 0x4080 -AddReg = SeLow_Install_Ndi -CopyFiles = SeLow_CopyFiles - -[SeLow_Install_Ndi] -HKR, Ndi, Service, , "SeLow" -HKR, Ndi, HelpText, , %SeLow_Description% -HKR, Ndi\Interfaces, UpperRange, , noupper -HKR, Ndi\Interfaces, LowerRange, , "ndis5,ndis4" - -[SeLow_Install.Services] -AddService = SeLow, , SeLow_Service_Install - -[SeLow_Service_Install] -DisplayName = %SeLow_DisplayName% -Description = %SeLow_Description% -ServiceType = 1 -StartType = 1 -ErrorControl = 1 -ServiceBinary = %12%\SeLow_x64.sys -LoadOrderGroup = PNP_TDI - -[SeLow_Install.Remove.Services] -DelService = SeLow, 0x200 - -[SourceDisksNames] -1 = %DiskDescription%, "", , - -[SourceDisksFiles] -SeLow_x64.sys = 1 - -[DestinationDirs] -SeLow_CopyFiles = 12 - -[SeLow_CopyFiles] -SeLow_x64.sys, , , 2 - -[Strings] -CompanyName = "SoftEther Corporation" -DiskDescription = "SoftEther Lightweight Network Protocol Install Disk" -SeLow_DisplayName = "SoftEther Lightweight Network Protocol" -SeLow_Description = "A lightweight helper kernel-mode module for PacketiX VPN / SoftEther VPN." - - -; Auto Generated 20180205_163634.337 - +; SeLow - SoftEther Lightweight Ethernet Low Driver +; +; Copyright (c) SoftEther Corporation. All Rights Reserved. +; http://www.softether.co.jp/ +; +; BUILD 9658 + +[Version] +Signature = "$Windows NT$" +Class = NetTrans +ClassGUID = {4D36E975-E325-11CE-BFC1-08002BE10318} +Provider = %CompanyName% +DriverVer = 02/04/2018, 4.25.0.9658 +CatalogFile.NT = SeLow_Win10_x64.cat + +[Manufacturer] +%CompanyName% = SoftEther, NTamd64 + +[SoftEther.NTamd64] +%SeLow_DisplayName% = SeLow_Install, SeLow + +[SeLow_Install] +Characteristics = 0x4080 +AddReg = SeLow_Install_Ndi +CopyFiles = SeLow_CopyFiles + +[SeLow_Install_Ndi] +HKR, Ndi, Service, , "SeLow" +HKR, Ndi, HelpText, , %SeLow_Description% +HKR, Ndi\Interfaces, UpperRange, , noupper +HKR, Ndi\Interfaces, LowerRange, , "ndis5,ndis4" + +[SeLow_Install.Services] +AddService = SeLow, , SeLow_Service_Install + +[SeLow_Service_Install] +DisplayName = %SeLow_DisplayName% +Description = %SeLow_Description% +ServiceType = 1 +StartType = 1 +ErrorControl = 1 +ServiceBinary = %12%\SeLow_x64.sys +LoadOrderGroup = PNP_TDI + +[SeLow_Install.Remove.Services] +DelService = SeLow, 0x200 + +[SourceDisksNames] +1 = %DiskDescription%, "", , + +[SourceDisksFiles] +SeLow_x64.sys = 1 + +[DestinationDirs] +SeLow_CopyFiles = 12 + +[SeLow_CopyFiles] +SeLow_x64.sys, , , 2 + +[Strings] +CompanyName = "SoftEther Corporation" +DiskDescription = "SoftEther Lightweight Network Protocol Install Disk" +SeLow_DisplayName = "SoftEther Lightweight Network Protocol" +SeLow_Description = "A lightweight helper kernel-mode module for PacketiX VPN / SoftEther VPN." + + +; Auto Generated 20180205_163634.337 + diff --git a/src/bin/hamcore/DriverPackages/SeLow_Win10/x86/SeLow_x86.inf b/src/bin/hamcore/DriverPackages/SeLow_Win10/x86/SeLow_x86.inf index 9a94f733..77b41daa 100644 --- a/src/bin/hamcore/DriverPackages/SeLow_Win10/x86/SeLow_x86.inf +++ b/src/bin/hamcore/DriverPackages/SeLow_Win10/x86/SeLow_x86.inf @@ -1,68 +1,68 @@ -; SeLow - SoftEther Lightweight Ethernet Low Driver -; -; Copyright (c) SoftEther Corporation. All Rights Reserved. -; http://www.softether.co.jp/ -; -; BUILD 9658 - -[Version] -Signature = "$Windows NT$" -Class = NetTrans -ClassGUID = {4D36E975-E325-11CE-BFC1-08002BE10318} -Provider = %CompanyName% -DriverVer = 02/04/2018, 4.25.0.9658 -CatalogFile.NT = SeLow_Win10_x86.cat - -[Manufacturer] -%CompanyName% = SoftEther, NTx86 - -[SoftEther.NTx86] -%SeLow_DisplayName% = SeLow_Install, SeLow - -[SeLow_Install] -Characteristics = 0x4080 -AddReg = SeLow_Install_Ndi -CopyFiles = SeLow_CopyFiles - -[SeLow_Install_Ndi] -HKR, Ndi, Service, , "SeLow" -HKR, Ndi, HelpText, , %SeLow_Description% -HKR, Ndi\Interfaces, UpperRange, , noupper -HKR, Ndi\Interfaces, LowerRange, , "ndis5,ndis4" - -[SeLow_Install.Services] -AddService = SeLow, , SeLow_Service_Install - -[SeLow_Service_Install] -DisplayName = %SeLow_DisplayName% -Description = %SeLow_Description% -ServiceType = 1 -StartType = 1 -ErrorControl = 1 -ServiceBinary = %12%\SeLow_x86.sys -LoadOrderGroup = PNP_TDI - -[SeLow_Install.Remove.Services] -DelService = SeLow, 0x200 - -[SourceDisksNames] -1 = %DiskDescription%, "", , - -[SourceDisksFiles] -SeLow_x86.sys = 1 - -[DestinationDirs] -SeLow_CopyFiles = 12 - -[SeLow_CopyFiles] -SeLow_x86.sys, , , 2 - -[Strings] -CompanyName = "SoftEther Corporation" -DiskDescription = "SoftEther Lightweight Network Protocol Install Disk" -SeLow_DisplayName = "SoftEther Lightweight Network Protocol" -SeLow_Description = "A lightweight helper kernel-mode module for PacketiX VPN / SoftEther VPN." - - -; Auto Generated 20180205_163633.619 - +; SeLow - SoftEther Lightweight Ethernet Low Driver +; +; Copyright (c) SoftEther Corporation. All Rights Reserved. +; http://www.softether.co.jp/ +; +; BUILD 9658 + +[Version] +Signature = "$Windows NT$" +Class = NetTrans +ClassGUID = {4D36E975-E325-11CE-BFC1-08002BE10318} +Provider = %CompanyName% +DriverVer = 02/04/2018, 4.25.0.9658 +CatalogFile.NT = SeLow_Win10_x86.cat + +[Manufacturer] +%CompanyName% = SoftEther, NTx86 + +[SoftEther.NTx86] +%SeLow_DisplayName% = SeLow_Install, SeLow + +[SeLow_Install] +Characteristics = 0x4080 +AddReg = SeLow_Install_Ndi +CopyFiles = SeLow_CopyFiles + +[SeLow_Install_Ndi] +HKR, Ndi, Service, , "SeLow" +HKR, Ndi, HelpText, , %SeLow_Description% +HKR, Ndi\Interfaces, UpperRange, , noupper +HKR, Ndi\Interfaces, LowerRange, , "ndis5,ndis4" + +[SeLow_Install.Services] +AddService = SeLow, , SeLow_Service_Install + +[SeLow_Service_Install] +DisplayName = %SeLow_DisplayName% +Description = %SeLow_Description% +ServiceType = 1 +StartType = 1 +ErrorControl = 1 +ServiceBinary = %12%\SeLow_x86.sys +LoadOrderGroup = PNP_TDI + +[SeLow_Install.Remove.Services] +DelService = SeLow, 0x200 + +[SourceDisksNames] +1 = %DiskDescription%, "", , + +[SourceDisksFiles] +SeLow_x86.sys = 1 + +[DestinationDirs] +SeLow_CopyFiles = 12 + +[SeLow_CopyFiles] +SeLow_x86.sys, , , 2 + +[Strings] +CompanyName = "SoftEther Corporation" +DiskDescription = "SoftEther Lightweight Network Protocol Install Disk" +SeLow_DisplayName = "SoftEther Lightweight Network Protocol" +SeLow_Description = "A lightweight helper kernel-mode module for PacketiX VPN / SoftEther VPN." + + +; Auto Generated 20180205_163633.619 + diff --git a/src/bin/hamcore/DriverPackages/SeLow_Win8/x64/SeLow_x64.inf b/src/bin/hamcore/DriverPackages/SeLow_Win8/x64/SeLow_x64.inf index c5e7cb9e..2e59f81d 100644 --- a/src/bin/hamcore/DriverPackages/SeLow_Win8/x64/SeLow_x64.inf +++ b/src/bin/hamcore/DriverPackages/SeLow_Win8/x64/SeLow_x64.inf @@ -1,68 +1,68 @@ -; SeLow - SoftEther Lightweight Ethernet Low Driver -; -; Copyright (c) SoftEther Corporation. All Rights Reserved. -; http://www.softether.co.jp/ -; -; BUILD 9658 - -[Version] -Signature = "$Windows NT$" -Class = NetTrans -ClassGUID = {4D36E975-E325-11CE-BFC1-08002BE10318} -Provider = %CompanyName% -DriverVer = 02/04/2018, 4.25.0.9658 -CatalogFile.NT = SeLow_Win8_x64.cat - -[Manufacturer] -%CompanyName% = SoftEther, NTamd64 - -[SoftEther.NTamd64] -%SeLow_DisplayName% = SeLow_Install, SeLow - -[SeLow_Install] -Characteristics = 0x4080 -AddReg = SeLow_Install_Ndi -CopyFiles = SeLow_CopyFiles - -[SeLow_Install_Ndi] -HKR, Ndi, Service, , "SeLow" -HKR, Ndi, HelpText, , %SeLow_Description% -HKR, Ndi\Interfaces, UpperRange, , noupper -HKR, Ndi\Interfaces, LowerRange, , "ndis5,ndis4" - -[SeLow_Install.Services] -AddService = SeLow, , SeLow_Service_Install - -[SeLow_Service_Install] -DisplayName = %SeLow_DisplayName% -Description = %SeLow_Description% -ServiceType = 1 -StartType = 1 -ErrorControl = 1 -ServiceBinary = %12%\SeLow_x64.sys -LoadOrderGroup = PNP_TDI - -[SeLow_Install.Remove.Services] -DelService = SeLow, 0x200 - -[SourceDisksNames] -1 = %DiskDescription%, "", , - -[SourceDisksFiles] -SeLow_x64.sys = 1 - -[DestinationDirs] -SeLow_CopyFiles = 12 - -[SeLow_CopyFiles] -SeLow_x64.sys, , , 2 - -[Strings] -CompanyName = "SoftEther Corporation" -DiskDescription = "SoftEther Lightweight Network Protocol Install Disk" -SeLow_DisplayName = "SoftEther Lightweight Network Protocol" -SeLow_Description = "A lightweight helper kernel-mode module for PacketiX VPN / SoftEther VPN." - - -; Auto Generated 20180205_163631.931 - +; SeLow - SoftEther Lightweight Ethernet Low Driver +; +; Copyright (c) SoftEther Corporation. All Rights Reserved. +; http://www.softether.co.jp/ +; +; BUILD 9658 + +[Version] +Signature = "$Windows NT$" +Class = NetTrans +ClassGUID = {4D36E975-E325-11CE-BFC1-08002BE10318} +Provider = %CompanyName% +DriverVer = 02/04/2018, 4.25.0.9658 +CatalogFile.NT = SeLow_Win8_x64.cat + +[Manufacturer] +%CompanyName% = SoftEther, NTamd64 + +[SoftEther.NTamd64] +%SeLow_DisplayName% = SeLow_Install, SeLow + +[SeLow_Install] +Characteristics = 0x4080 +AddReg = SeLow_Install_Ndi +CopyFiles = SeLow_CopyFiles + +[SeLow_Install_Ndi] +HKR, Ndi, Service, , "SeLow" +HKR, Ndi, HelpText, , %SeLow_Description% +HKR, Ndi\Interfaces, UpperRange, , noupper +HKR, Ndi\Interfaces, LowerRange, , "ndis5,ndis4" + +[SeLow_Install.Services] +AddService = SeLow, , SeLow_Service_Install + +[SeLow_Service_Install] +DisplayName = %SeLow_DisplayName% +Description = %SeLow_Description% +ServiceType = 1 +StartType = 1 +ErrorControl = 1 +ServiceBinary = %12%\SeLow_x64.sys +LoadOrderGroup = PNP_TDI + +[SeLow_Install.Remove.Services] +DelService = SeLow, 0x200 + +[SourceDisksNames] +1 = %DiskDescription%, "", , + +[SourceDisksFiles] +SeLow_x64.sys = 1 + +[DestinationDirs] +SeLow_CopyFiles = 12 + +[SeLow_CopyFiles] +SeLow_x64.sys, , , 2 + +[Strings] +CompanyName = "SoftEther Corporation" +DiskDescription = "SoftEther Lightweight Network Protocol Install Disk" +SeLow_DisplayName = "SoftEther Lightweight Network Protocol" +SeLow_Description = "A lightweight helper kernel-mode module for PacketiX VPN / SoftEther VPN." + + +; Auto Generated 20180205_163631.931 + diff --git a/src/bin/hamcore/DriverPackages/SeLow_Win8/x86/SeLow_x86.inf b/src/bin/hamcore/DriverPackages/SeLow_Win8/x86/SeLow_x86.inf index 2b136909..f7d27923 100644 --- a/src/bin/hamcore/DriverPackages/SeLow_Win8/x86/SeLow_x86.inf +++ b/src/bin/hamcore/DriverPackages/SeLow_Win8/x86/SeLow_x86.inf @@ -1,68 +1,68 @@ -; SeLow - SoftEther Lightweight Ethernet Low Driver -; -; Copyright (c) SoftEther Corporation. All Rights Reserved. -; http://www.softether.co.jp/ -; -; BUILD 9658 - -[Version] -Signature = "$Windows NT$" -Class = NetTrans -ClassGUID = {4D36E975-E325-11CE-BFC1-08002BE10318} -Provider = %CompanyName% -DriverVer = 02/04/2018, 4.25.0.9658 -CatalogFile.NT = SeLow_Win8_x86.cat - -[Manufacturer] -%CompanyName% = SoftEther, NTx86 - -[SoftEther.NTx86] -%SeLow_DisplayName% = SeLow_Install, SeLow - -[SeLow_Install] -Characteristics = 0x4080 -AddReg = SeLow_Install_Ndi -CopyFiles = SeLow_CopyFiles - -[SeLow_Install_Ndi] -HKR, Ndi, Service, , "SeLow" -HKR, Ndi, HelpText, , %SeLow_Description% -HKR, Ndi\Interfaces, UpperRange, , noupper -HKR, Ndi\Interfaces, LowerRange, , "ndis5,ndis4" - -[SeLow_Install.Services] -AddService = SeLow, , SeLow_Service_Install - -[SeLow_Service_Install] -DisplayName = %SeLow_DisplayName% -Description = %SeLow_Description% -ServiceType = 1 -StartType = 1 -ErrorControl = 1 -ServiceBinary = %12%\SeLow_x86.sys -LoadOrderGroup = PNP_TDI - -[SeLow_Install.Remove.Services] -DelService = SeLow, 0x200 - -[SourceDisksNames] -1 = %DiskDescription%, "", , - -[SourceDisksFiles] -SeLow_x86.sys = 1 - -[DestinationDirs] -SeLow_CopyFiles = 12 - -[SeLow_CopyFiles] -SeLow_x86.sys, , , 2 - -[Strings] -CompanyName = "SoftEther Corporation" -DiskDescription = "SoftEther Lightweight Network Protocol Install Disk" -SeLow_DisplayName = "SoftEther Lightweight Network Protocol" -SeLow_Description = "A lightweight helper kernel-mode module for PacketiX VPN / SoftEther VPN." - - -; Auto Generated 20180205_163630.455 - +; SeLow - SoftEther Lightweight Ethernet Low Driver +; +; Copyright (c) SoftEther Corporation. All Rights Reserved. +; http://www.softether.co.jp/ +; +; BUILD 9658 + +[Version] +Signature = "$Windows NT$" +Class = NetTrans +ClassGUID = {4D36E975-E325-11CE-BFC1-08002BE10318} +Provider = %CompanyName% +DriverVer = 02/04/2018, 4.25.0.9658 +CatalogFile.NT = SeLow_Win8_x86.cat + +[Manufacturer] +%CompanyName% = SoftEther, NTx86 + +[SoftEther.NTx86] +%SeLow_DisplayName% = SeLow_Install, SeLow + +[SeLow_Install] +Characteristics = 0x4080 +AddReg = SeLow_Install_Ndi +CopyFiles = SeLow_CopyFiles + +[SeLow_Install_Ndi] +HKR, Ndi, Service, , "SeLow" +HKR, Ndi, HelpText, , %SeLow_Description% +HKR, Ndi\Interfaces, UpperRange, , noupper +HKR, Ndi\Interfaces, LowerRange, , "ndis5,ndis4" + +[SeLow_Install.Services] +AddService = SeLow, , SeLow_Service_Install + +[SeLow_Service_Install] +DisplayName = %SeLow_DisplayName% +Description = %SeLow_Description% +ServiceType = 1 +StartType = 1 +ErrorControl = 1 +ServiceBinary = %12%\SeLow_x86.sys +LoadOrderGroup = PNP_TDI + +[SeLow_Install.Remove.Services] +DelService = SeLow, 0x200 + +[SourceDisksNames] +1 = %DiskDescription%, "", , + +[SourceDisksFiles] +SeLow_x86.sys = 1 + +[DestinationDirs] +SeLow_CopyFiles = 12 + +[SeLow_CopyFiles] +SeLow_x86.sys, , , 2 + +[Strings] +CompanyName = "SoftEther Corporation" +DiskDescription = "SoftEther Lightweight Network Protocol Install Disk" +SeLow_DisplayName = "SoftEther Lightweight Network Protocol" +SeLow_Description = "A lightweight helper kernel-mode module for PacketiX VPN / SoftEther VPN." + + +; Auto Generated 20180205_163630.455 + diff --git a/src/bin/hamcore/DriverPackages/Wfp/x64/pxwfp_x64.inf b/src/bin/hamcore/DriverPackages/Wfp/x64/pxwfp_x64.inf index 697f1575..eb631971 100644 --- a/src/bin/hamcore/DriverPackages/Wfp/x64/pxwfp_x64.inf +++ b/src/bin/hamcore/DriverPackages/Wfp/x64/pxwfp_x64.inf @@ -1,52 +1,52 @@ -; pxwfp - Windows Filtering Platform Callout Driver for Capturing IPsec Packets -; -; Copyright (c) SoftEther Corporation. All Rights Reserved. -; http://www.softether.co.jp/ -; -; BUILD 9658 - -[Version] -Signature = "$Windows NT$" -Class = WFPCALLOUTS -ClassGuid = {57465043-616C-6C6F-7574-5F636C617373} -Provider = "SoftEther Corporation" -DriverVer = 02/04/2018, 4.25.0.9658 -CatalogFile.NT = pxwfp_x64.cat - -[SourceDisksNames] -1 = "SoftEther VPN IPsec WFP Callout Driver Install Disk" - -[SourceDisksFiles] -pxwfp_x64.sys = 1 - -[DestinationDirs] -DefaultDestDir = 12 -pxwfp.DriverFiles = 12 - -[DefaultInstall] -OptionDesc = "SoftEther VPN IPsec WFP Callout Driver" -CopyFiles = pxwfp.DriverFiles - -[DefaultInstall.Services] -AddService = pxwfp,,pxwfp.Service - -[DefaultUninstall] -DelFiles = pxwfp.DriverFiles - -[DefaultUninstall.Services] -DelService = pxwfp,0x200 - -[pxwfp.DriverFiles] -pxwfp_x64.sys,,,0x00000040 - -[pxwfp.Service] -DisplayName = "SoftEther VPN IPsec WFP Callout Driver" -Description = "SoftEther VPN IPsec WFP Callout Driver" -ServiceType = 1 -StartType = 3 -ErrorControl = 1 -ServiceBinary = %12%\pxwfp_x64.sys - - -; Auto Generated 20180205_163636.909 - +; pxwfp - Windows Filtering Platform Callout Driver for Capturing IPsec Packets +; +; Copyright (c) SoftEther Corporation. All Rights Reserved. +; http://www.softether.co.jp/ +; +; BUILD 9658 + +[Version] +Signature = "$Windows NT$" +Class = WFPCALLOUTS +ClassGuid = {57465043-616C-6C6F-7574-5F636C617373} +Provider = "SoftEther Corporation" +DriverVer = 02/04/2018, 4.25.0.9658 +CatalogFile.NT = pxwfp_x64.cat + +[SourceDisksNames] +1 = "SoftEther VPN IPsec WFP Callout Driver Install Disk" + +[SourceDisksFiles] +pxwfp_x64.sys = 1 + +[DestinationDirs] +DefaultDestDir = 12 +pxwfp.DriverFiles = 12 + +[DefaultInstall] +OptionDesc = "SoftEther VPN IPsec WFP Callout Driver" +CopyFiles = pxwfp.DriverFiles + +[DefaultInstall.Services] +AddService = pxwfp,,pxwfp.Service + +[DefaultUninstall] +DelFiles = pxwfp.DriverFiles + +[DefaultUninstall.Services] +DelService = pxwfp,0x200 + +[pxwfp.DriverFiles] +pxwfp_x64.sys,,,0x00000040 + +[pxwfp.Service] +DisplayName = "SoftEther VPN IPsec WFP Callout Driver" +Description = "SoftEther VPN IPsec WFP Callout Driver" +ServiceType = 1 +StartType = 3 +ErrorControl = 1 +ServiceBinary = %12%\pxwfp_x64.sys + + +; Auto Generated 20180205_163636.909 + diff --git a/src/bin/hamcore/DriverPackages/Wfp/x86/pxwfp_x86.inf b/src/bin/hamcore/DriverPackages/Wfp/x86/pxwfp_x86.inf index b3b1a32d..7684b93d 100644 --- a/src/bin/hamcore/DriverPackages/Wfp/x86/pxwfp_x86.inf +++ b/src/bin/hamcore/DriverPackages/Wfp/x86/pxwfp_x86.inf @@ -1,52 +1,52 @@ -; pxwfp - Windows Filtering Platform Callout Driver for Capturing IPsec Packets -; -; Copyright (c) SoftEther Corporation. All Rights Reserved. -; http://www.softether.co.jp/ -; -; BUILD 9658 - -[Version] -Signature = "$Windows NT$" -Class = WFPCALLOUTS -ClassGuid = {57465043-616C-6C6F-7574-5F636C617373} -Provider = "SoftEther Corporation" -DriverVer = 02/04/2018, 4.25.0.9658 -CatalogFile.NT = pxwfp_x86.cat - -[SourceDisksNames] -1 = "SoftEther VPN IPsec WFP Callout Driver Install Disk" - -[SourceDisksFiles] -pxwfp_x86.sys = 1 - -[DestinationDirs] -DefaultDestDir = 12 -pxwfp.DriverFiles = 12 - -[DefaultInstall] -OptionDesc = "SoftEther VPN IPsec WFP Callout Driver" -CopyFiles = pxwfp.DriverFiles - -[DefaultInstall.Services] -AddService = pxwfp,,pxwfp.Service - -[DefaultUninstall] -DelFiles = pxwfp.DriverFiles - -[DefaultUninstall.Services] -DelService = pxwfp,0x200 - -[pxwfp.DriverFiles] -pxwfp_x86.sys,,,0x00000040 - -[pxwfp.Service] -DisplayName = "SoftEther VPN IPsec WFP Callout Driver" -Description = "SoftEther VPN IPsec WFP Callout Driver" -ServiceType = 1 -StartType = 3 -ErrorControl = 1 -ServiceBinary = %12%\pxwfp_x86.sys - - -; Auto Generated 20180205_163635.140 - +; pxwfp - Windows Filtering Platform Callout Driver for Capturing IPsec Packets +; +; Copyright (c) SoftEther Corporation. All Rights Reserved. +; http://www.softether.co.jp/ +; +; BUILD 9658 + +[Version] +Signature = "$Windows NT$" +Class = WFPCALLOUTS +ClassGuid = {57465043-616C-6C6F-7574-5F636C617373} +Provider = "SoftEther Corporation" +DriverVer = 02/04/2018, 4.25.0.9658 +CatalogFile.NT = pxwfp_x86.cat + +[SourceDisksNames] +1 = "SoftEther VPN IPsec WFP Callout Driver Install Disk" + +[SourceDisksFiles] +pxwfp_x86.sys = 1 + +[DestinationDirs] +DefaultDestDir = 12 +pxwfp.DriverFiles = 12 + +[DefaultInstall] +OptionDesc = "SoftEther VPN IPsec WFP Callout Driver" +CopyFiles = pxwfp.DriverFiles + +[DefaultInstall.Services] +AddService = pxwfp,,pxwfp.Service + +[DefaultUninstall] +DelFiles = pxwfp.DriverFiles + +[DefaultUninstall.Services] +DelService = pxwfp,0x200 + +[pxwfp.DriverFiles] +pxwfp_x86.sys,,,0x00000040 + +[pxwfp.Service] +DisplayName = "SoftEther VPN IPsec WFP Callout Driver" +Description = "SoftEther VPN IPsec WFP Callout Driver" +ServiceType = 1 +StartType = 3 +ErrorControl = 1 +ServiceBinary = %12%\pxwfp_x86.sys + + +; Auto Generated 20180205_163635.140 + diff --git a/src/bin/hamcore/DriverPackages/Wfp_Win10/x64/pxwfp_x64.inf b/src/bin/hamcore/DriverPackages/Wfp_Win10/x64/pxwfp_x64.inf index a05a3247..48db65d0 100644 --- a/src/bin/hamcore/DriverPackages/Wfp_Win10/x64/pxwfp_x64.inf +++ b/src/bin/hamcore/DriverPackages/Wfp_Win10/x64/pxwfp_x64.inf @@ -1,52 +1,52 @@ -; pxwfp - Windows Filtering Platform Callout Driver for Capturing IPsec Packets -; -; Copyright (c) SoftEther Corporation. All Rights Reserved. -; http://www.softether.co.jp/ -; -; BUILD 9658 - -[Version] -Signature = "$Windows NT$" -Class = WFPCALLOUTS -ClassGuid = {57465043-616C-6C6F-7574-5F636C617373} -Provider = "SoftEther Corporation" -DriverVer = 02/04/2018, 4.25.0.9658 -CatalogFile.NT = pxwfp_Win10_x64.cat - -[SourceDisksNames] -1 = "SoftEther VPN IPsec WFP Callout Driver Install Disk" - -[SourceDisksFiles] -pxwfp_x64.sys = 1 - -[DestinationDirs] -DefaultDestDir = 12 -pxwfp.DriverFiles = 12 - -[DefaultInstall] -OptionDesc = "SoftEther VPN IPsec WFP Callout Driver" -CopyFiles = pxwfp.DriverFiles - -[DefaultInstall.Services] -AddService = pxwfp,,pxwfp.Service - -[DefaultUninstall] -DelFiles = pxwfp.DriverFiles - -[DefaultUninstall.Services] -DelService = pxwfp,0x200 - -[pxwfp.DriverFiles] -pxwfp_x64.sys,,,0x00000040 - -[pxwfp.Service] -DisplayName = "SoftEther VPN IPsec WFP Callout Driver" -Description = "SoftEther VPN IPsec WFP Callout Driver" -ServiceType = 1 -StartType = 3 -ErrorControl = 1 -ServiceBinary = %12%\pxwfp_x64.sys - - -; Auto Generated 20180205_163639.512 - +; pxwfp - Windows Filtering Platform Callout Driver for Capturing IPsec Packets +; +; Copyright (c) SoftEther Corporation. All Rights Reserved. +; http://www.softether.co.jp/ +; +; BUILD 9658 + +[Version] +Signature = "$Windows NT$" +Class = WFPCALLOUTS +ClassGuid = {57465043-616C-6C6F-7574-5F636C617373} +Provider = "SoftEther Corporation" +DriverVer = 02/04/2018, 4.25.0.9658 +CatalogFile.NT = pxwfp_Win10_x64.cat + +[SourceDisksNames] +1 = "SoftEther VPN IPsec WFP Callout Driver Install Disk" + +[SourceDisksFiles] +pxwfp_x64.sys = 1 + +[DestinationDirs] +DefaultDestDir = 12 +pxwfp.DriverFiles = 12 + +[DefaultInstall] +OptionDesc = "SoftEther VPN IPsec WFP Callout Driver" +CopyFiles = pxwfp.DriverFiles + +[DefaultInstall.Services] +AddService = pxwfp,,pxwfp.Service + +[DefaultUninstall] +DelFiles = pxwfp.DriverFiles + +[DefaultUninstall.Services] +DelService = pxwfp,0x200 + +[pxwfp.DriverFiles] +pxwfp_x64.sys,,,0x00000040 + +[pxwfp.Service] +DisplayName = "SoftEther VPN IPsec WFP Callout Driver" +Description = "SoftEther VPN IPsec WFP Callout Driver" +ServiceType = 1 +StartType = 3 +ErrorControl = 1 +ServiceBinary = %12%\pxwfp_x64.sys + + +; Auto Generated 20180205_163639.512 + diff --git a/src/bin/hamcore/DriverPackages/Wfp_Win10/x86/pxwfp_x86.inf b/src/bin/hamcore/DriverPackages/Wfp_Win10/x86/pxwfp_x86.inf index 71101f23..5b69c494 100644 --- a/src/bin/hamcore/DriverPackages/Wfp_Win10/x86/pxwfp_x86.inf +++ b/src/bin/hamcore/DriverPackages/Wfp_Win10/x86/pxwfp_x86.inf @@ -1,52 +1,52 @@ -; pxwfp - Windows Filtering Platform Callout Driver for Capturing IPsec Packets -; -; Copyright (c) SoftEther Corporation. All Rights Reserved. -; http://www.softether.co.jp/ -; -; BUILD 9658 - -[Version] -Signature = "$Windows NT$" -Class = WFPCALLOUTS -ClassGuid = {57465043-616C-6C6F-7574-5F636C617373} -Provider = "SoftEther Corporation" -DriverVer = 02/04/2018, 4.25.0.9658 -CatalogFile.NT = pxwfp_Win10_x86.cat - -[SourceDisksNames] -1 = "SoftEther VPN IPsec WFP Callout Driver Install Disk" - -[SourceDisksFiles] -pxwfp_x86.sys = 1 - -[DestinationDirs] -DefaultDestDir = 12 -pxwfp.DriverFiles = 12 - -[DefaultInstall] -OptionDesc = "SoftEther VPN IPsec WFP Callout Driver" -CopyFiles = pxwfp.DriverFiles - -[DefaultInstall.Services] -AddService = pxwfp,,pxwfp.Service - -[DefaultUninstall] -DelFiles = pxwfp.DriverFiles - -[DefaultUninstall.Services] -DelService = pxwfp,0x200 - -[pxwfp.DriverFiles] -pxwfp_x86.sys,,,0x00000040 - -[pxwfp.Service] -DisplayName = "SoftEther VPN IPsec WFP Callout Driver" -Description = "SoftEther VPN IPsec WFP Callout Driver" -ServiceType = 1 -StartType = 3 -ErrorControl = 1 -ServiceBinary = %12%\pxwfp_x86.sys - - -; Auto Generated 20180205_163638.570 - +; pxwfp - Windows Filtering Platform Callout Driver for Capturing IPsec Packets +; +; Copyright (c) SoftEther Corporation. All Rights Reserved. +; http://www.softether.co.jp/ +; +; BUILD 9658 + +[Version] +Signature = "$Windows NT$" +Class = WFPCALLOUTS +ClassGuid = {57465043-616C-6C6F-7574-5F636C617373} +Provider = "SoftEther Corporation" +DriverVer = 02/04/2018, 4.25.0.9658 +CatalogFile.NT = pxwfp_Win10_x86.cat + +[SourceDisksNames] +1 = "SoftEther VPN IPsec WFP Callout Driver Install Disk" + +[SourceDisksFiles] +pxwfp_x86.sys = 1 + +[DestinationDirs] +DefaultDestDir = 12 +pxwfp.DriverFiles = 12 + +[DefaultInstall] +OptionDesc = "SoftEther VPN IPsec WFP Callout Driver" +CopyFiles = pxwfp.DriverFiles + +[DefaultInstall.Services] +AddService = pxwfp,,pxwfp.Service + +[DefaultUninstall] +DelFiles = pxwfp.DriverFiles + +[DefaultUninstall.Services] +DelService = pxwfp,0x200 + +[pxwfp.DriverFiles] +pxwfp_x86.sys,,,0x00000040 + +[pxwfp.Service] +DisplayName = "SoftEther VPN IPsec WFP Callout Driver" +Description = "SoftEther VPN IPsec WFP Callout Driver" +ServiceType = 1 +StartType = 3 +ErrorControl = 1 +ServiceBinary = %12%\pxwfp_x86.sys + + +; Auto Generated 20180205_163638.570 + diff --git a/src/bin/hamcore/SOURCES_OF_BINARY_FILES.TXT b/src/bin/hamcore/SOURCES_OF_BINARY_FILES.TXT index a46f7688..4d531ce5 100644 --- a/src/bin/hamcore/SOURCES_OF_BINARY_FILES.TXT +++ b/src/bin/hamcore/SOURCES_OF_BINARY_FILES.TXT @@ -1,110 +1,110 @@ -All binary files on the 'hamcore' directory are free software under -the Apache License, Version 2.0. (Except WinPcap binaries.) - -Some geeks should be interested in how to rebuild .sys (driver) files on -this directory. This text file helps such crazy geeks. - - -How to rebuild these '.sys' files? ----------------------------------- - -Windows Vista or later version of Windows requires all device drivers to be -signed by Authenticode digital certificate. Therefore, SoftEther VPN Project -publishes all necessary binary files in the 'hamcore' directory with -'already-signed' format by the certificate of SoftEther VPN Project. - -That is the reason why the all .sys files (device drivers) are already built -and digitally signed by SoftEther VPN Project on the time of release of -the source code. - -However, the entire source code of all the .sys files are contained on the -source code tree as follows: - -- pxwfp_x86.sys and pxwfp_x64.sys - You can build these files from the source code on the 'Wfp' directory. - -- see.sys and see_x64.sys - You can build these files from the source code on the 'See' directory. - -- SeLow_x86.sys and SeLow_x64.sys - You can build these files from the source code on the 'SeLow' directory. - -- vpn_driver.sys, vpn_driver_x64.sys and vpn_driver_9x.sys - You can build these files from the source code on the 'Neo' directory. - -- vpn_driver6.sys and vpn_driver6_x64.sys - You can build these files from the source code on the 'Neo6' directory. - -It is recommended to build these files on the 'SEVPN.sln' Visual Studio 2008 -solution file. - -Note that rebuilding these files require Windows Driver Kits. -Loading the re-built .sys files requires your Authenticode certificate file -if the operating system is Windows Vista or later. - - - -How to rebuild these 'vpn16.exe' files? ---------------------------------------- - -The vpn16.exe binary is the 16-bit Driver Install Utility for Windows 9x. -You can build this file from the 'vpn16' directory. However, you need -Visual C++ 16-bit edition and Windows 98 DDK to rebuild this 'vpn16.exe'. - - -'winpcap_installer.exe' and 'winpcap_installer_win9x.exe' ---------------------------------------------------------- -They are WinPcap binaries from http://www.winpcap.org/. -The WinPcap license is at http://www.winpcap.org/misc/copyright.htm page. - - -License -------- -THE APACHE LICENSE, VERSION 2.0 APPLY ON ALL SOFTETHER VPN PROGRAMS WHICH -ARE DEVELOPED BY SOFTETHER VPN PROJECT. - - -Disclaimer ----------- -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL -THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. - -THIS SOFTWARE IS DEVELOPED IN JAPAN, AND DISTRIBUTED FROM JAPAN, UNDER -JAPANESE LAWS. YOU MUST AGREE IN ADVANCE TO USE, COPY, MODIFY, MERGE, PUBLISH, -DISTRIBUTE, SUBLICENSE, AND/OR SELL COPIES OF THIS SOFTWARE, THAT ANY JURIDICAL -DISPUTES WHICH ARE CONCERNED TO THIS SOFTWARE OR ITS CONTENTS, AGAINST US -(SOFTETHER PROJECT, SOFTETHER CORPORATION, DAIYUU NOBORI OR OTHER SUPPLIERS), -OR ANY JURIDICAL DISPUTES AGAINST US WHICH ARE CAUSED BY ANY KIND OF USING, -COPYING, MODIFYING, MERGING, PUBLISHING, DISTRIBUTING, SUBLICENSING, AND/OR -SELLING COPIES OF THIS SOFTWARE SHALL BE REGARDED AS BE CONSTRUED AND -CONTROLLED BY JAPANESE LAWS, AND YOU MUST FURTHER CONSENT TO EXCLUSIVE -JURISDICTION AND VENUE IN THE COURTS SITTING IN TOKYO, JAPAN. YOU MUST WAIVE -ALL DEFENSES OF LACK OF PERSONAL JURISDICTION AND FORUM NON CONVENIENS. -PROCESS MAY BE SERVED ON EITHER PARTY IN THE MANNER AUTHORIZED BY APPLICABLE -LAW OR COURT RULE. - -USE ONLY IN JAPAN. DO NOT USE THIS SOFTWARE IN ANOTHER COUNTRY UNLESS -YOU HAVE A CONFIRMATION THAT THIS SOFTWARE DOES NOT VIOLATE ANY -CRIMINAL LAWS OR CIVIL RIGHTS IN THAT PARTICULAR COUNTRY. USING THIS -SOFTWARE IN OTHER COUNTRIES IS COMPLETELY AT YOUR OWN RISK. THE -SOFTETHER VPN PROJECT HAS DEVELOPED AND DISTRIBUTED THIS SOFTWARE TO -COMPLY ONLY WITH THE JAPANESE LAWS AND EXISTING CIVIL RIGHTS INCLUDING -PATENTS WHICH ARE SUBJECTS APPLY IN JAPAN. OTHER COUNTRIES' LAWS OR -CIVIL RIGHTS ARE NONE OF OUR CONCERNS NOR RESPONSIBILITIES. WE HAVE -NEVER INVESTIGATED ANY CRIMINAL REGULATIONS, CIVIL LAWS OR -INTELLECTUAL PROPERTY RIGHTS INCLUDING PATENTS IN ANY OF OTHER 200+ -COUNTRIES AND TERRITORIES. BY NATURE, THERE ARE 200+ REGIONS IN THE -WORLD, WITH DIFFERENT LAWS. IT IS IMPOSSIBLE TO VERIFY EVERY -COUNTRIES' LAWS, REGULATIONS AND CIVIL RIGHTS TO MAKE THE SOFTWARE -COMPLY WITH ALL COUNTRIES' LAWS BY THE PROJECT. EVEN IF YOU WILL BE -SUED BY A PRIVATE ENTITY OR BE DAMAGED BY A PUBLIC SERVANT IN YOUR -COUNTRY, THE DEVELOPERS OF THIS SOFTWARE WILL NEVER BE LIABLE TO -RECOVER OR COMPENSATE SUCH DAMAGES, CRIMINAL OR CIVIL -RESPONSIBILITIES. NOTE THAT THIS LINE IS NOT LICENSE RESTRICTION BUT -JUST A STATEMENT FOR WARNING AND DISCLAIMER. - +All binary files on the 'hamcore' directory are free software under +the Apache License, Version 2.0. (Except WinPcap binaries.) + +Some geeks should be interested in how to rebuild .sys (driver) files on +this directory. This text file helps such crazy geeks. + + +How to rebuild these '.sys' files? +---------------------------------- + +Windows Vista or later version of Windows requires all device drivers to be +signed by Authenticode digital certificate. Therefore, SoftEther VPN Project +publishes all necessary binary files in the 'hamcore' directory with +'already-signed' format by the certificate of SoftEther VPN Project. + +That is the reason why the all .sys files (device drivers) are already built +and digitally signed by SoftEther VPN Project on the time of release of +the source code. + +However, the entire source code of all the .sys files are contained on the +source code tree as follows: + +- pxwfp_x86.sys and pxwfp_x64.sys + You can build these files from the source code on the 'Wfp' directory. + +- see.sys and see_x64.sys + You can build these files from the source code on the 'See' directory. + +- SeLow_x86.sys and SeLow_x64.sys + You can build these files from the source code on the 'SeLow' directory. + +- vpn_driver.sys, vpn_driver_x64.sys and vpn_driver_9x.sys + You can build these files from the source code on the 'Neo' directory. + +- vpn_driver6.sys and vpn_driver6_x64.sys + You can build these files from the source code on the 'Neo6' directory. + +It is recommended to build these files on the 'SEVPN.sln' Visual Studio 2008 +solution file. + +Note that rebuilding these files require Windows Driver Kits. +Loading the re-built .sys files requires your Authenticode certificate file +if the operating system is Windows Vista or later. + + + +How to rebuild these 'vpn16.exe' files? +--------------------------------------- + +The vpn16.exe binary is the 16-bit Driver Install Utility for Windows 9x. +You can build this file from the 'vpn16' directory. However, you need +Visual C++ 16-bit edition and Windows 98 DDK to rebuild this 'vpn16.exe'. + + +'winpcap_installer.exe' and 'winpcap_installer_win9x.exe' +--------------------------------------------------------- +They are WinPcap binaries from http://www.winpcap.org/. +The WinPcap license is at http://www.winpcap.org/misc/copyright.htm page. + + +License +------- +THE APACHE LICENSE, VERSION 2.0 APPLY ON ALL SOFTETHER VPN PROGRAMS WHICH +ARE DEVELOPED BY SOFTETHER VPN PROJECT. + + +Disclaimer +---------- +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL +THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. + +THIS SOFTWARE IS DEVELOPED IN JAPAN, AND DISTRIBUTED FROM JAPAN, UNDER +JAPANESE LAWS. YOU MUST AGREE IN ADVANCE TO USE, COPY, MODIFY, MERGE, PUBLISH, +DISTRIBUTE, SUBLICENSE, AND/OR SELL COPIES OF THIS SOFTWARE, THAT ANY JURIDICAL +DISPUTES WHICH ARE CONCERNED TO THIS SOFTWARE OR ITS CONTENTS, AGAINST US +(SOFTETHER PROJECT, SOFTETHER CORPORATION, DAIYUU NOBORI OR OTHER SUPPLIERS), +OR ANY JURIDICAL DISPUTES AGAINST US WHICH ARE CAUSED BY ANY KIND OF USING, +COPYING, MODIFYING, MERGING, PUBLISHING, DISTRIBUTING, SUBLICENSING, AND/OR +SELLING COPIES OF THIS SOFTWARE SHALL BE REGARDED AS BE CONSTRUED AND +CONTROLLED BY JAPANESE LAWS, AND YOU MUST FURTHER CONSENT TO EXCLUSIVE +JURISDICTION AND VENUE IN THE COURTS SITTING IN TOKYO, JAPAN. YOU MUST WAIVE +ALL DEFENSES OF LACK OF PERSONAL JURISDICTION AND FORUM NON CONVENIENS. +PROCESS MAY BE SERVED ON EITHER PARTY IN THE MANNER AUTHORIZED BY APPLICABLE +LAW OR COURT RULE. + +USE ONLY IN JAPAN. DO NOT USE THIS SOFTWARE IN ANOTHER COUNTRY UNLESS +YOU HAVE A CONFIRMATION THAT THIS SOFTWARE DOES NOT VIOLATE ANY +CRIMINAL LAWS OR CIVIL RIGHTS IN THAT PARTICULAR COUNTRY. USING THIS +SOFTWARE IN OTHER COUNTRIES IS COMPLETELY AT YOUR OWN RISK. THE +SOFTETHER VPN PROJECT HAS DEVELOPED AND DISTRIBUTED THIS SOFTWARE TO +COMPLY ONLY WITH THE JAPANESE LAWS AND EXISTING CIVIL RIGHTS INCLUDING +PATENTS WHICH ARE SUBJECTS APPLY IN JAPAN. OTHER COUNTRIES' LAWS OR +CIVIL RIGHTS ARE NONE OF OUR CONCERNS NOR RESPONSIBILITIES. WE HAVE +NEVER INVESTIGATED ANY CRIMINAL REGULATIONS, CIVIL LAWS OR +INTELLECTUAL PROPERTY RIGHTS INCLUDING PATENTS IN ANY OF OTHER 200+ +COUNTRIES AND TERRITORIES. BY NATURE, THERE ARE 200+ REGIONS IN THE +WORLD, WITH DIFFERENT LAWS. IT IS IMPOSSIBLE TO VERIFY EVERY +COUNTRIES' LAWS, REGULATIONS AND CIVIL RIGHTS TO MAKE THE SOFTWARE +COMPLY WITH ALL COUNTRIES' LAWS BY THE PROJECT. EVEN IF YOU WILL BE +SUED BY A PRIVATE ENTITY OR BE DAMAGED BY A PUBLIC SERVANT IN YOUR +COUNTRY, THE DEVELOPERS OF THIS SOFTWARE WILL NEVER BE LIABLE TO +RECOVER OR COMPENSATE SUCH DAMAGES, CRIMINAL OR CIVIL +RESPONSIBILITIES. NOTE THAT THIS LINE IS NOT LICENSE RESTRICTION BUT +JUST A STATEMENT FOR WARNING AND DISCLAIMER. + diff --git a/src/bin/hamcore/backup_dir_readme.txt b/src/bin/hamcore/backup_dir_readme.txt index b9c5bd7f..6de6cfe7 100644 --- a/src/bin/hamcore/backup_dir_readme.txt +++ b/src/bin/hamcore/backup_dir_readme.txt @@ -1,10 +1,10 @@ -====================================================================== - - About Backup Folder - -====================================================================== - -Here are auto backups of configuration files. - -You can delete there files to make free space on the disk drive. - +====================================================================== + + About Backup Folder + +====================================================================== + +Here are auto backups of configuration files. + +You can delete there files to make free space on the disk drive. + diff --git a/src/bin/hamcore/empty.config b/src/bin/hamcore/empty.config index 0ae49aa2..9edba188 100644 --- a/src/bin/hamcore/empty.config +++ b/src/bin/hamcore/empty.config @@ -1,3 +1,3 @@ -# VPN Default Empty Config File - - +# VPN Default Empty Config File + + diff --git a/src/bin/hamcore/eula.txt b/src/bin/hamcore/eula.txt index a7dec475..6916bbe1 100644 --- a/src/bin/hamcore/eula.txt +++ b/src/bin/hamcore/eula.txt @@ -1,25 +1,25 @@ -Copyright (c) all contributors on SoftEther VPN project in GitHub. -Copyright (c) Daiyuu Nobori, SoftEther Project at University of Tsukuba, and SoftEther Corporation. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and limitations under the License. - - -DISCLAIMER -========== - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -THIS SOFTWARE IS DEVELOPED IN JAPAN, AND DISTRIBUTED FROM JAPAN, UNDER JAPANESE LAWS. YOU MUST AGREE IN ADVANCE TO USE, COPY, MODIFY, MERGE, PUBLISH, DISTRIBUTE, SUBLICENSE, AND/OR SELL COPIES OF THIS SOFTWARE, THAT ANY JURIDICAL DISPUTES WHICH ARE CONCERNED TO THIS SOFTWARE OR ITS CONTENTS, AGAINST US (SOFTETHER PROJECT, SOFTETHER CORPORATION, DAIYUU NOBORI OR OTHER SUPPLIERS), OR ANY JURIDICAL DISPUTES AGAINST US WHICH ARE CAUSED BY ANY KIND OF USING, COPYING, MODIFYING, MERGING, PUBLISHING, DISTRIBUTING, SUBLICENSING, AND/OR SELLING COPIES OF THIS SOFTWARE SHALL BE REGARDED AS BE CONSTRUED AND CONTROLLED BY JAPANESE LAWS, AND YOU MUST FURTHER CONSENT TO EXCLUSIVE JURISDICTION AND VENUE IN THE COURTS SITTING IN TOKYO, JAPAN. YOU MUST WAIVE ALL DEFENSES OF LACK OF PERSONAL JURISDICTION AND FORUM NON CONVENIENS. PROCESS MAY BE SERVED ON EITHER PARTY IN THE MANNER AUTHORIZED BY APPLICABLE LAW OR COURT RULE. - -USE ONLY IN JAPAN. DO NOT USE THIS SOFTWARE IN ANOTHER COUNTRY UNLESS YOU HAVE A CONFIRMATION THAT THIS SOFTWARE DOES NOT VIOLATE ANY CRIMINAL LAWS OR CIVIL RIGHTS IN THAT PARTICULAR COUNTRY. USING THIS SOFTWARE IN OTHER COUNTRIES IS COMPLETELY AT YOUR OWN RISK. THE SOFTETHER VPN PROJECT HAS DEVELOPED AND DISTRIBUTED THIS SOFTWARE TO COMPLY ONLY WITH THE JAPANESE LAWS AND EXISTING CIVIL RIGHTS INCLUDING PATENTS WHICH ARE SUBJECTS APPLY IN JAPAN. OTHER COUNTRIES' LAWS OR CIVIL RIGHTS ARE NONE OF OUR CONCERNS NOR RESPONSIBILITIES. WE HAVE NEVER INVESTIGATED ANY CRIMINAL REGULATIONS, CIVIL LAWS OR INTELLECTUAL PROPERTY RIGHTS INCLUDING PATENTS IN ANY OF OTHER 200+ COUNTRIES AND TERRITORIES. BY NATURE, THERE ARE 200+ REGIONS IN THE WORLD, WITH DIFFERENT LAWS. IT IS IMPOSSIBLE TO VERIFY EVERY COUNTRIES' LAWS, REGULATIONS AND CIVIL RIGHTS TO MAKE THE SOFTWARE COMPLY WITH ALL COUNTRIES' LAWS BY THE PROJECT. EVEN IF YOU WILL BE SUED BY A PRIVATE ENTITY OR BE DAMAGED BY A PUBLIC SERVANT IN YOUR COUNTRY, THE DEVELOPERS OF THIS SOFTWARE WILL NEVER BE LIABLE TO RECOVER OR COMPENSATE SUCH DAMAGES, CRIMINAL OR CIVIL -RESPONSIBILITIES. NOTE THAT THIS LINE IS NOT LICENSE RESTRICTION BUT JUST A STATEMENT FOR WARNING AND DISCLAIMER. - -READ AND UNDERSTAND THE 'src/WARNING.TXT' FILE BEFORE USING THIS SOFTWARE. SOME SOFTWARE PROGRAMS FROM THIRD PARTIES ARE INCLUDED ON THIS SOFTWARE WITH LICENSE CONDITIONS WHICH ARE DESCRIBED ON THE 'src/THIRD_PARTY.TXT' FILE. - +Copyright (c) all contributors on SoftEther VPN project in GitHub. +Copyright (c) Daiyuu Nobori, SoftEther Project at University of Tsukuba, and SoftEther Corporation. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and limitations under the License. + + +DISCLAIMER +========== + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +THIS SOFTWARE IS DEVELOPED IN JAPAN, AND DISTRIBUTED FROM JAPAN, UNDER JAPANESE LAWS. YOU MUST AGREE IN ADVANCE TO USE, COPY, MODIFY, MERGE, PUBLISH, DISTRIBUTE, SUBLICENSE, AND/OR SELL COPIES OF THIS SOFTWARE, THAT ANY JURIDICAL DISPUTES WHICH ARE CONCERNED TO THIS SOFTWARE OR ITS CONTENTS, AGAINST US (SOFTETHER PROJECT, SOFTETHER CORPORATION, DAIYUU NOBORI OR OTHER SUPPLIERS), OR ANY JURIDICAL DISPUTES AGAINST US WHICH ARE CAUSED BY ANY KIND OF USING, COPYING, MODIFYING, MERGING, PUBLISHING, DISTRIBUTING, SUBLICENSING, AND/OR SELLING COPIES OF THIS SOFTWARE SHALL BE REGARDED AS BE CONSTRUED AND CONTROLLED BY JAPANESE LAWS, AND YOU MUST FURTHER CONSENT TO EXCLUSIVE JURISDICTION AND VENUE IN THE COURTS SITTING IN TOKYO, JAPAN. YOU MUST WAIVE ALL DEFENSES OF LACK OF PERSONAL JURISDICTION AND FORUM NON CONVENIENS. PROCESS MAY BE SERVED ON EITHER PARTY IN THE MANNER AUTHORIZED BY APPLICABLE LAW OR COURT RULE. + +USE ONLY IN JAPAN. DO NOT USE THIS SOFTWARE IN ANOTHER COUNTRY UNLESS YOU HAVE A CONFIRMATION THAT THIS SOFTWARE DOES NOT VIOLATE ANY CRIMINAL LAWS OR CIVIL RIGHTS IN THAT PARTICULAR COUNTRY. USING THIS SOFTWARE IN OTHER COUNTRIES IS COMPLETELY AT YOUR OWN RISK. THE SOFTETHER VPN PROJECT HAS DEVELOPED AND DISTRIBUTED THIS SOFTWARE TO COMPLY ONLY WITH THE JAPANESE LAWS AND EXISTING CIVIL RIGHTS INCLUDING PATENTS WHICH ARE SUBJECTS APPLY IN JAPAN. OTHER COUNTRIES' LAWS OR CIVIL RIGHTS ARE NONE OF OUR CONCERNS NOR RESPONSIBILITIES. WE HAVE NEVER INVESTIGATED ANY CRIMINAL REGULATIONS, CIVIL LAWS OR INTELLECTUAL PROPERTY RIGHTS INCLUDING PATENTS IN ANY OF OTHER 200+ COUNTRIES AND TERRITORIES. BY NATURE, THERE ARE 200+ REGIONS IN THE WORLD, WITH DIFFERENT LAWS. IT IS IMPOSSIBLE TO VERIFY EVERY COUNTRIES' LAWS, REGULATIONS AND CIVIL RIGHTS TO MAKE THE SOFTWARE COMPLY WITH ALL COUNTRIES' LAWS BY THE PROJECT. EVEN IF YOU WILL BE SUED BY A PRIVATE ENTITY OR BE DAMAGED BY A PUBLIC SERVANT IN YOUR COUNTRY, THE DEVELOPERS OF THIS SOFTWARE WILL NEVER BE LIABLE TO RECOVER OR COMPENSATE SUCH DAMAGES, CRIMINAL OR CIVIL +RESPONSIBILITIES. NOTE THAT THIS LINE IS NOT LICENSE RESTRICTION BUT JUST A STATEMENT FOR WARNING AND DISCLAIMER. + +READ AND UNDERSTAND THE 'src/WARNING.TXT' FILE BEFORE USING THIS SOFTWARE. SOME SOFTWARE PROGRAMS FROM THIRD PARTIES ARE INCLUDED ON THIS SOFTWARE WITH LICENSE CONDITIONS WHICH ARE DESCRIBED ON THE 'src/THIRD_PARTY.TXT' FILE. + diff --git a/src/bin/hamcore/lang.config b/src/bin/hamcore/lang.config index aae41653..65ae567e 100644 --- a/src/bin/hamcore/lang.config +++ b/src/bin/hamcore/lang.config @@ -1,17 +1,17 @@ -# PacketiX VPN / SoftEther VPN Language Setting File -# -# Specify your preferred Language ID on this setting file. -# The text messages will be displayed in the specified language. -# -# Please note that you must restart a program to apply the modification of -# this setting-file. -# -# Only one line is acceptable. Any other lines are ignored. -# -# The change of this file will effect after the next execution of a program. -# -# Note for UNIX / Linux Users: -# You have to set the LANG environment variable if you want to display -# non-English characters. If no LANG environment is set, any multi-byte -# characters (i.e. Japanese or Chinese) will not be displayed correctly. -# +# PacketiX VPN / SoftEther VPN Language Setting File +# +# Specify your preferred Language ID on this setting file. +# The text messages will be displayed in the specified language. +# +# Please note that you must restart a program to apply the modification of +# this setting-file. +# +# Only one line is acceptable. Any other lines are ignored. +# +# The change of this file will effect after the next execution of a program. +# +# Note for UNIX / Linux Users: +# You have to set the LANG environment variable if you want to display +# non-English characters. If no LANG environment is set, any multi-byte +# characters (i.e. Japanese or Chinese) will not be displayed correctly. +# diff --git a/src/bin/hamcore/languages.txt b/src/bin/hamcore/languages.txt index 71b7a4e3..5cf2b854 100644 --- a/src/bin/hamcore/languages.txt +++ b/src/bin/hamcore/languages.txt @@ -1,11 +1,11 @@ -# PacketiX VPN / SoftEther VPN Language List File -# Copyright (c) SoftEther Corporation. All Rights Reserved - -# 番号 識別子 英語表記 ローカル表記 Windowsロケール番号 UNIXロケール文字一覧 -0 ja Japanese 日本語 1041 ja,jp,sjis,shift_jis,euc -1 en English English 1033 en,us,c -2 cn Simplified_Chinese 简体中文 2052,4100,3076,5124 cn,hkg,mac,sg,chi -3 tw Traditional_Chinese 繁體中文 1028 tw,zh-tw -4 ko Korean 한국어 949 ko,kr,euc_kr,cp949,euckr -5 ru Russian Русский 1049 ru -6 pt_br Portuguese-Brazil Português-Brasil 1046 pt_br +# PacketiX VPN / SoftEther VPN Language List File +# Copyright (c) SoftEther Corporation. All Rights Reserved + +# 番号 識別子 英語表記 ローカル表記 Windowsロケール番号 UNIXロケール文字一覧 +0 ja Japanese 日本語 1041 ja,jp,sjis,shift_jis,euc +1 en English English 1033 en,us,c +2 cn Simplified_Chinese 简体中文 2052,4100,3076,5124 cn,hkg,mac,sg,chi +3 tw Traditional_Chinese 繁體中文 1028 tw,zh-tw +4 ko Korean 한국어 949 ko,kr,euc_kr,cp949,euckr +5 ru Russian Русский 1049 ru +6 pt_br Portuguese-Brazil Português-Brasil 1046 pt_br diff --git a/src/bin/hamcore/languages_wine.txt b/src/bin/hamcore/languages_wine.txt index b7b2a24a..524369d6 100644 --- a/src/bin/hamcore/languages_wine.txt +++ b/src/bin/hamcore/languages_wine.txt @@ -1,6 +1,6 @@ -# PacketiX VPN / SoftEther VPN Language List File -# Copyright (c) SoftEther Corporation. All Rights Reserved - -# 番号 識別子 英語表記 ローカル表記 Windowsロケール番号 UNIXロケール文字一覧 -1 en English English 1033 en,us,c - +# PacketiX VPN / SoftEther VPN Language List File +# Copyright (c) SoftEther Corporation. All Rights Reserved + +# 番号 識別子 英語表記 ローカル表記 Windowsロケール番号 UNIXロケール文字一覧 +1 en English English 1033 en,us,c + diff --git a/src/bin/hamcore/legal.txt b/src/bin/hamcore/legal.txt index 6646cfc5..9de0b00f 100644 --- a/src/bin/hamcore/legal.txt +++ b/src/bin/hamcore/legal.txt @@ -1,294 +1,294 @@ -BitVisor(R) VPN Client Module (IPsec Driver): -Copyright (c) 2007, 2008 University of Tsukuba. -Copyright (C) 2007, 2008 National Institute of Information and Communications Technology. -All rights reserved. - -Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: - -1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. -2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. -3. Neither the name of the University of Tsukuba nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -------------------- - -Microsoft(R) C Runtime Library: -(c) 2007 Microsoft Corporation. All Rights Reserved. - -------------------- - -RSA Security Inc. PKCS #11 Cryptographic Token Interface (Cryptoki): - -License to copy and use this software is granted provided that it is identified as "RSA Security Inc. PKCS #11 Cryptographic Token Interface (Cryptoki)" in all material mentioning or referencing this software. - -License is also granted to make and use derivative works provided that such works are identified as "derived from the RSA Security Inc. PKCS #11 Cryptographic Token Interface (Cryptoki)" in all material mentioning or referencing the derived work. - -RSA Security Inc. makes no representations concerning either the merchantability of this software or the suitability of this software for any particular purpose. It is provided "as is" without express or implied warranty of any kind. - -------------------- - -WinPcap: -Copyright (c) 2001 - 2003 NetGroup, Politecnico di Torino (Italy) -All rights reserved. - -Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: - -1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. -2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. -3. Neither the name of the Politecnico di Torino nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -------------------- - -libedit: -Copyright (c) 1992, 1993 The Regents of the University of California. All rights reserved. - -This code is derived from software contributed to Berkeley by Christos Zoulas of Cornell University. - -Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: -1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. -2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. -3. Neither the name of the University nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -------------------- - -libiconv: - - GNU LIBRARY GENERAL PUBLIC LICENSE - Version 2, June 1991 - - Copyright (C) 1991 Free Software Foundation, Inc. - 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA - Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. - -[This is the first released version of the library GPL. It is - numbered 2 because it goes with version 2 of the ordinary GPL.] - - Preamble - - The licenses for most software are designed to take away your freedom to share and change it. By contrast, the GNU General Public Licenses are intended to guarantee your freedom to share and change free software--to make sure the software is free for all its users. - - This license, the Library General Public License, applies to some specially designated Free Software Foundation software, and to any other libraries whose authors decide to use it. You can use it for your libraries, too. - - When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for -this service if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs; and that you know you can do these things. - - To protect your rights, we need to make restrictions that forbid anyone to deny you these rights or to ask you to surrender the rights. These restrictions translate to certain responsibilities for you if you distribute copies of the library, or if you modify it. - - For example, if you distribute copies of the library, whether gratis or for a fee, you must give the recipients all the rights that we gave you. You must make sure that they, too, receive or can get the source -code. If you link a program with the library, you must provide complete object files to the recipients so that they can relink them with the library, after making changes to the library and recompiling it. And you must show them these terms so they know their rights. - - Our method of protecting your rights has two steps: (1) copyright the library, and (2) offer you this license which gives you legal permission to copy, distribute and/or modify the library. - - Also, for each distributor's protection, we want to make certain that everyone understands that there is no warranty for this free library. If the library is modified by someone else and passed on, we want its recipients to know that what they have is not the original version, so that any problems introduced by others will not reflect on the original authors' reputations. - - Finally, any free program is threatened constantly by software patents. We wish to avoid the danger that companies distributing free software will individually obtain patent licenses, thus in effect transforming the program into proprietary software. To prevent this, we have made it clear that any patent must be licensed for everyone's free use or not licensed at all. - - Most GNU software, including some libraries, is covered by the ordinary GNU General Public License, which was designed for utility programs. This license, the GNU Library General Public License, applies to certain designated libraries. This license is quite different from the ordinary one; be sure to read it in full, and don't assume that anything in it is the same as in the ordinary license. - - The reason we have a separate public license for some libraries is that they blur the distinction we usually make between modifying or adding to a program and simply using it. Linking a program with a library, without changing the library, is in some sense simply using the library, and is analogous to running a utility program or application program. However, in a textual and legal sense, the linked executable is a combined work, a derivative of the original library, and the ordinary General Public License treats it as such. - - Because of this blurred distinction, using the ordinary General Public License for libraries did not effectively promote software sharing, because most developers did not use the libraries. We concluded that weaker conditions might promote sharing better. - - However, unrestricted linking of non-free programs would deprive the users of those programs of all benefit from the free status of the libraries themselves. This Library General Public License is intended to -permit developers of non-free programs to use free libraries, while preserving your freedom as a user of such programs to change the free libraries that are incorporated in them. (We have not seen how to achieve this as regards changes in header files, but we have achieved it as regards changes in the actual functions of the Library.) The hope is that this will lead to faster development of free libraries. - - The precise terms and conditions for copying, distribution and modification follow. Pay close attention to the difference between a "work based on the library" and a "work that uses the library". The former contains code derived from the library, while the latter only works together with the library. - - Note that it is possible for a library to be covered by the ordinary General Public License rather than by this special one. - - GNU LIBRARY GENERAL PUBLIC LICENSE - TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION - - 0. This License Agreement applies to any software library which contains a notice placed by the copyright holder or other authorized party saying it may be distributed under the terms of this Library -General Public License (also called "this License"). Each licensee is addressed as "you". - - A "library" means a collection of software functions and/or data prepared so as to be conveniently linked with application programs (which use some of those functions and data) to form executables. - - The "Library", below, refers to any such software library or work which has been distributed under these terms. A "work based on the Library" means either the Library or any derivative work under copyright law: that is to say, a work containing the Library or a portion of it, either verbatim or with modifications and/or translated straightforwardly into another language. (Hereinafter, translation is included without limitation in the term "modification".) - - "Source code" for a work means the preferred form of the work for making modifications to it. For a library, complete source code means all the source code for all modules it contains, plus any associated interface definition files, plus the scripts used to control compilation and installation of the library. - - Activities other than copying, distribution and modification are not covered by this License; they are outside its scope. The act of running a program using the Library is not restricted, and output from such a program is covered only if its contents constitute a work based on the Library (independent of the use of the Library in a tool for writing it). Whether that is true depends on what the Library does and what the program that uses the Library does. - - 1. You may copy and distribute verbatim copies of the Library's complete source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice and disclaimer of warranty; keep intact all the notices that refer to this License and to the absence of any warranty; and distribute a copy of this License along with the Library. - - You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee. - - 2. You may modify your copy or copies of the Library or any portion of it, thus forming a work based on the Library, and copy and distribute such modifications or work under the terms of Section 1 above, provided that you also meet all of these conditions: - - a) The modified work must itself be a software library. - - b) You must cause the files modified to carry prominent notices stating that you changed the files and the date of any change. - - c) You must cause the whole of the work to be licensed at no charge to all third parties under the terms of this License. - - d) If a facility in the modified Library refers to a function or a table of data to be supplied by an application program that uses the facility, other than as an argument passed when the facility is invoked, then you must make a good faith effort to ensure that, in the event an application does not supply such function or table, the facility still operates, and performs whatever part of its purpose remains meaningful. - - (For example, a function in a library to compute square roots has a purpose that is entirely well-defined independent of the application. Therefore, Subsection 2d requires that any application-supplied function or table used by this function must be optional: if the application does not supply it, the square root function must still compute square roots.) - -These requirements apply to the modified work as a whole. If identifiable sections of that work are not derived from the Library, and can be reasonably considered independent and separate works in themselves, then this License, and its terms, do not apply to those sections when you distribute them as separate works. But when you distribute the same sections as part of a whole which is a work based on the Library, the distribution of the whole must be on the terms of this License, whose permissions for other licensees extend to the entire whole, and thus to each and every part regardless of who wrote it. - -Thus, it is not the intent of this section to claim rights or contest your rights to work written entirely by you; rather, the intent is to exercise the right to control the distribution of derivative or collective works based on the Library. - -In addition, mere aggregation of another work not based on the Library with the Library (or with a work based on the Library) on a volume of a storage or distribution medium does not bring the other work under the scope of this License. - - 3. You may opt to apply the terms of the ordinary GNU General Public -License instead of this License to a given copy of the Library. To do this, you must alter all the notices that refer to this License, so that they refer to the ordinary GNU General Public License, version 2, instead of to this License. (If a newer version than version 2 of the ordinary GNU General Public License has appeared, then you can specify that version instead if you wish.) Do not make any other change in these notices. - - Once this change is made in a given copy, it is irreversible for that copy, so the ordinary GNU General Public License applies to all subsequent copies and derivative works made from that copy. - - This option is useful when you wish to copy part of the code of the Library into a program that is not a library. - - 4. You may copy and distribute the Library (or a portion or derivative of it, under Section 2) in object code or executable form under the terms of Sections 1 and 2 above provided that you accompany it with the complete corresponding machine-readable source code, which must be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange. - - If distribution of object code is made by offering access to copy from a designated place, then offering equivalent access to copy the source code from the same place satisfies the requirement to distribute the source code, even though third parties are not compelled to copy the source along with the object code. - - 5. A program that contains no derivative of any portion of the Library, but is designed to work with the Library by being compiled or linked with it, is called a "work that uses the Library". Such a work, in isolation, is not a derivative work of the Library, and therefore falls outside the scope of this License. - - However, linking a "work that uses the Library" with the Library creates an executable that is a derivative of the Library (because it contains portions of the Library), rather than a "work that uses the library". The executable is therefore covered by this License. -Section 6 states terms for distribution of such executables. - - When a "work that uses the Library" uses material from a header file that is part of the Library, the object code for the work may be a derivative work of the Library even though the source code is not. -Whether this is true is especially significant if the work can be linked without the Library, or if the work is itself a library. The threshold for this to be true is not precisely defined by law. - - If such an object file uses only numerical parameters, data structure layouts and accessors, and small macros and small inline functions (ten lines or less in length), then the use of the object file is unrestricted, regardless of whether it is legally a derivative work. (Executables containing this object code plus portions of the Library will still fall under Section 6.) - - Otherwise, if the work is a derivative of the Library, you may distribute the object code for the work under the terms of Section 6. Any executables containing that work also fall under Section 6, whether or not they are linked directly with the Library itself. - - 6. As an exception to the Sections above, you may also compile or link a "work that uses the Library" with the Library to produce a work containing portions of the Library, and distribute that work under terms of your choice, provided that the terms permit modification of the work for the customer's own use and reverse engineering for debugging such modifications. - - You must give prominent notice with each copy of the work that the Library is used in it and that the Library and its use are covered by this License. You must supply a copy of this License. If the work during execution displays copyright notices, you must include the copyright notice for the Library among them, as well as a reference directing the user to the copy of this License. Also, you must do one of these things: - - a) Accompany the work with the complete corresponding machine-readable source code for the Library including whatever changes were used in the work (which must be distributed under Sections 1 and 2 above) ; and, if the work is an executable linked with the Library, with the complete machine-readable "work that uses the Library", as object code and/or source code, so that the user can modify the Library and then relink to produce a modified executable containing the modified Library. (It is understood that the user who changes the contents of definitions files in the Library will not necessarily be able to recompile the application to use the modified definitions.) - - b) Accompany the work with a written offer, valid for at least three years, to give the same user the materials specified in Subsection 6a, above, for a charge no more than the cost of performing this distribution. - - c) If distribution of the work is made by offering access to copy from a designated place, offer equivalent access to copy the above specified materials from the same place. - - d) Verify that the user has already received a copy of these materials or that you have already sent this user a copy. - - For an executable, the required form of the "work that uses the Library" must include any data and utility programs needed for reproducing the executable from it. However, as a special exception, the source code distributed need not include anything that is normally distributed (in either source or binary form) with the major components (compiler, kernel, and so on) of the operating system on which the executable runs, unless that component itself accompanies the executable. - - It may happen that this requirement contradicts the license restrictions of other proprietary libraries that do not normally accompany the operating system. Such a contradiction means you cannot use both them and the Library together in an executable that you distribute. - - 7. You may place library facilities that are a work based on the Library side-by-side in a single library together with other library facilities not covered by this License, and distribute such a combined library, provided that the separate distribution of the work based on the Library and of the other library facilities is otherwise permitted, and provided that you do these two things: - - a) Accompany the combined library with a copy of the same work based on the Library, uncombined with any other library facilities. This must be distributed under the terms of the Sections above. - - b) Give prominent notice with the combined library of the fact that part of it is a work based on the Library, and explaining where to find the accompanying uncombined form of the same work. - - 8. You may not copy, modify, sublicense, link with, or distribute the Library except as expressly provided under this License. Any attempt otherwise to copy, modify, sublicense, link with, or distribute the Library is void, and will automatically terminate your rights under this License. However, parties who have received copies, or rights, from you under this License will not have their licenses terminated so long as such parties remain in full compliance. - - 9. You are not required to accept this License, since you have not signed it. However, nothing else grants you permission to modify or distribute the Library or its derivative works. These actions are prohibited by law if you do not accept this License. Therefore, by modifying or distributing the Library (or any work based on the Library), you indicate your acceptance of this License to do so, and all its terms and conditions for copying, distributing or modifying the Library or works based on it. - - 10. Each time you redistribute the Library (or any work based on the Library), the recipient automatically receives a license from the original licensor to copy, distribute, link with or modify the Library subject to these terms and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted herein. You are not responsible for enforcing compliance by third parties to this License. - - 11. If, as a consequence of a court judgment or allegation of patent infringement or for any other reason (not limited to patent issues), conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot distribute so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not distribute the Library at all. For example, if a patent license would not permit royalty-free redistribution of the Library by all those who receive copies directly or indirectly through you, then the only way you could satisfy both it and this License would be to refrain entirely from distribution of the Library. - -If any portion of this section is held invalid or unenforceable under any particular circumstance, the balance of the section is intended to apply, and the section as a whole is intended to apply in other circumstances. - -It is not the purpose of this section to induce you to infringe any patents or other property right claims or to contest validity of any such claims; this section has the sole purpose of protecting the integrity of the free software distribution system which is implemented by public license practices. Many people have made generous contributions to the wide range of software distributed through that system in reliance on consistent application of that system; it is up to the author/donor to decide if he or she is willing to distribute software through any other system and a licensee cannot impose that choice. - -This section is intended to make thoroughly clear what is believed to be a consequence of the rest of this License. - - 12. If the distribution and/or use of the Library is restricted in certain countries either by patents or by copyrighted interfaces, the original copyright holder who places the Library under this License may add an explicit geographical distribution limitation excluding those countries, so that distribution is permitted only in or among countries not thus excluded. In such case, this License incorporates the limitation as if written in the body of this License. - - 13. The Free Software Foundation may publish revised and/or new versions of the Library General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. - -Each version is given a distinguishing version number. If the Library specifies a version number of this License which applies to it and "any later version", you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation. If the Library does not specify a license version number, you may choose any version ever published by the Free Software Foundation. - - 14. If you wish to incorporate parts of the Library into other free programs whose distribution conditions are incompatible with these, write to the author to ask for permission. For software which is copyrighted by the Free Software Foundation, write to the Free Software Foundation; we sometimes make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally. - - NO WARRANTY - - 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. - - 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. - - END OF TERMS AND CONDITIONS - -------------------- - -ncurses: -Copyright (c) 1998-2005,2006 Free Software Foundation, Inc. - -Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, distribute with modifications, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name(s) of the above copyright holders shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization. - -------------------- - -OpenSSL: -OpenSSL License -Copyright (c) 1998-2011 The OpenSSL Project. All rights reserved. - -Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: - -1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. - -2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. - -3. All advertising materials mentioning features or use of this software must display the following acknowledgment: "This product includes software developed by the OpenSSL Project for use in the OpenSSL Toolkit. (http://www.openssl.org/)" - -4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to endorse or promote products derived from this software without prior written permission. For written permission, please contact openssl-core@openssl.org. - -5. Products derived from this software may not be called "OpenSSL" nor may "OpenSSL" appear in their names without prior written permission of the OpenSSL Project. - -6. Redistributions of any form whatsoever must retain the following acknowledgment: "This product includes software developed by the OpenSSL Project for use in the OpenSSL Toolkit (http://www.openssl.org/)" - -THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -This product includes cryptographic software written by Eric Young (eay@cryptsoft.com). This product includes software written by Tim Hudson (tjh@cryptsoft.com). - -Original SSLeay License -Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) All rights reserved. - -This package is an SSL implementation written by Eric Young (eay@cryptsoft.com). The implementation was written so as to conform with Netscapes SSL. - -This library is free for commercial and non-commercial use as long as the following conditions are adhered to. The following conditions apply to all code found in this distribution, be it the RC4, RSA, lhash, DES, etc., code; not just the SSL code. The SSL documentation included with this distribution is covered by the same copyright terms except that the holder is Tim Hudson (tjh@cryptsoft.com). - -Copyright remains Eric Young's, and as such any Copyright notices in the code are not to be removed. If this package is used in a product, Eric Young should be given attribution as the author of the parts of the library used. This can be in the form of a textual message at program startup or in documentation (online or textual) provided with the package. - -Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: -1. Redistributions of source code must retain the copyright notice, this list of conditions and the following disclaimer. -2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. -3. All advertising materials mentioning features or use of this software must display the following acknowledgement: "This product includes cryptographic software written by Eric Young (eay@cryptsoft.com)" The word 'cryptographic' can be left out if the rouines from the library being used are not cryptographic related :-). -4. If you include any Windows specific code (or a derivative thereof) from the apps directory (application code) you must include an acknowledgement: "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" - -THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -The licence and distribution terms for any publically available version or derivative of this code cannot be changed. i.e. this code cannot simply be copied and put under another distribution licence [including the GNU Public Licence.] - -------------------- - -zlib: -Acknowledgments: - The deflate format used by zlib was defined by Phil Katz. The deflate and zlib specifications were written by L. Peter Deutsch. Thanks to all the people who reported problems and suggested various improvements in zlib; they are too numerous to cite here. - -Copyright notice: - (C) 1995-2004 Jean-loup Gailly and Mark Adler - - This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software. - - Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: - - 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. - 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. - 3. This notice may not be removed or altered from any source distribution. - - Jean-loup Gailly Mark Adler - jloup@gzip.org madler@alumni.caltech.edu - -If you use the zlib library in a product, we would appreciate *not* receiving lengthy legal documents to sign. The sources are provided for free but without warranty of any kind. The library has been entirely written by Jean-loup Gailly and Mark Adler; it does not include third-party code. - -If you redistribute modified sources, we would appreciate that you include in the file ChangeLog history information documenting your changes. Please read the FAQ for more information on the distribution of modified source versions. +BitVisor(R) VPN Client Module (IPsec Driver): +Copyright (c) 2007, 2008 University of Tsukuba. +Copyright (C) 2007, 2008 National Institute of Information and Communications Technology. +All rights reserved. + +Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: + +1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. +2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. +3. Neither the name of the University of Tsukuba nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +------------------- + +Microsoft(R) C Runtime Library: +(c) 2007 Microsoft Corporation. All Rights Reserved. + +------------------- + +RSA Security Inc. PKCS #11 Cryptographic Token Interface (Cryptoki): + +License to copy and use this software is granted provided that it is identified as "RSA Security Inc. PKCS #11 Cryptographic Token Interface (Cryptoki)" in all material mentioning or referencing this software. + +License is also granted to make and use derivative works provided that such works are identified as "derived from the RSA Security Inc. PKCS #11 Cryptographic Token Interface (Cryptoki)" in all material mentioning or referencing the derived work. + +RSA Security Inc. makes no representations concerning either the merchantability of this software or the suitability of this software for any particular purpose. It is provided "as is" without express or implied warranty of any kind. + +------------------- + +WinPcap: +Copyright (c) 2001 - 2003 NetGroup, Politecnico di Torino (Italy) +All rights reserved. + +Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: + +1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. +2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. +3. Neither the name of the Politecnico di Torino nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +------------------- + +libedit: +Copyright (c) 1992, 1993 The Regents of the University of California. All rights reserved. + +This code is derived from software contributed to Berkeley by Christos Zoulas of Cornell University. + +Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: +1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. +2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. +3. Neither the name of the University nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +------------------- + +libiconv: + + GNU LIBRARY GENERAL PUBLIC LICENSE + Version 2, June 1991 + + Copyright (C) 1991 Free Software Foundation, Inc. + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA + Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. + +[This is the first released version of the library GPL. It is + numbered 2 because it goes with version 2 of the ordinary GPL.] + + Preamble + + The licenses for most software are designed to take away your freedom to share and change it. By contrast, the GNU General Public Licenses are intended to guarantee your freedom to share and change free software--to make sure the software is free for all its users. + + This license, the Library General Public License, applies to some specially designated Free Software Foundation software, and to any other libraries whose authors decide to use it. You can use it for your libraries, too. + + When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for +this service if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs; and that you know you can do these things. + + To protect your rights, we need to make restrictions that forbid anyone to deny you these rights or to ask you to surrender the rights. These restrictions translate to certain responsibilities for you if you distribute copies of the library, or if you modify it. + + For example, if you distribute copies of the library, whether gratis or for a fee, you must give the recipients all the rights that we gave you. You must make sure that they, too, receive or can get the source +code. If you link a program with the library, you must provide complete object files to the recipients so that they can relink them with the library, after making changes to the library and recompiling it. And you must show them these terms so they know their rights. + + Our method of protecting your rights has two steps: (1) copyright the library, and (2) offer you this license which gives you legal permission to copy, distribute and/or modify the library. + + Also, for each distributor's protection, we want to make certain that everyone understands that there is no warranty for this free library. If the library is modified by someone else and passed on, we want its recipients to know that what they have is not the original version, so that any problems introduced by others will not reflect on the original authors' reputations. + + Finally, any free program is threatened constantly by software patents. We wish to avoid the danger that companies distributing free software will individually obtain patent licenses, thus in effect transforming the program into proprietary software. To prevent this, we have made it clear that any patent must be licensed for everyone's free use or not licensed at all. + + Most GNU software, including some libraries, is covered by the ordinary GNU General Public License, which was designed for utility programs. This license, the GNU Library General Public License, applies to certain designated libraries. This license is quite different from the ordinary one; be sure to read it in full, and don't assume that anything in it is the same as in the ordinary license. + + The reason we have a separate public license for some libraries is that they blur the distinction we usually make between modifying or adding to a program and simply using it. Linking a program with a library, without changing the library, is in some sense simply using the library, and is analogous to running a utility program or application program. However, in a textual and legal sense, the linked executable is a combined work, a derivative of the original library, and the ordinary General Public License treats it as such. + + Because of this blurred distinction, using the ordinary General Public License for libraries did not effectively promote software sharing, because most developers did not use the libraries. We concluded that weaker conditions might promote sharing better. + + However, unrestricted linking of non-free programs would deprive the users of those programs of all benefit from the free status of the libraries themselves. This Library General Public License is intended to +permit developers of non-free programs to use free libraries, while preserving your freedom as a user of such programs to change the free libraries that are incorporated in them. (We have not seen how to achieve this as regards changes in header files, but we have achieved it as regards changes in the actual functions of the Library.) The hope is that this will lead to faster development of free libraries. + + The precise terms and conditions for copying, distribution and modification follow. Pay close attention to the difference between a "work based on the library" and a "work that uses the library". The former contains code derived from the library, while the latter only works together with the library. + + Note that it is possible for a library to be covered by the ordinary General Public License rather than by this special one. + + GNU LIBRARY GENERAL PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. This License Agreement applies to any software library which contains a notice placed by the copyright holder or other authorized party saying it may be distributed under the terms of this Library +General Public License (also called "this License"). Each licensee is addressed as "you". + + A "library" means a collection of software functions and/or data prepared so as to be conveniently linked with application programs (which use some of those functions and data) to form executables. + + The "Library", below, refers to any such software library or work which has been distributed under these terms. A "work based on the Library" means either the Library or any derivative work under copyright law: that is to say, a work containing the Library or a portion of it, either verbatim or with modifications and/or translated straightforwardly into another language. (Hereinafter, translation is included without limitation in the term "modification".) + + "Source code" for a work means the preferred form of the work for making modifications to it. For a library, complete source code means all the source code for all modules it contains, plus any associated interface definition files, plus the scripts used to control compilation and installation of the library. + + Activities other than copying, distribution and modification are not covered by this License; they are outside its scope. The act of running a program using the Library is not restricted, and output from such a program is covered only if its contents constitute a work based on the Library (independent of the use of the Library in a tool for writing it). Whether that is true depends on what the Library does and what the program that uses the Library does. + + 1. You may copy and distribute verbatim copies of the Library's complete source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice and disclaimer of warranty; keep intact all the notices that refer to this License and to the absence of any warranty; and distribute a copy of this License along with the Library. + + You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee. + + 2. You may modify your copy or copies of the Library or any portion of it, thus forming a work based on the Library, and copy and distribute such modifications or work under the terms of Section 1 above, provided that you also meet all of these conditions: + + a) The modified work must itself be a software library. + + b) You must cause the files modified to carry prominent notices stating that you changed the files and the date of any change. + + c) You must cause the whole of the work to be licensed at no charge to all third parties under the terms of this License. + + d) If a facility in the modified Library refers to a function or a table of data to be supplied by an application program that uses the facility, other than as an argument passed when the facility is invoked, then you must make a good faith effort to ensure that, in the event an application does not supply such function or table, the facility still operates, and performs whatever part of its purpose remains meaningful. + + (For example, a function in a library to compute square roots has a purpose that is entirely well-defined independent of the application. Therefore, Subsection 2d requires that any application-supplied function or table used by this function must be optional: if the application does not supply it, the square root function must still compute square roots.) + +These requirements apply to the modified work as a whole. If identifiable sections of that work are not derived from the Library, and can be reasonably considered independent and separate works in themselves, then this License, and its terms, do not apply to those sections when you distribute them as separate works. But when you distribute the same sections as part of a whole which is a work based on the Library, the distribution of the whole must be on the terms of this License, whose permissions for other licensees extend to the entire whole, and thus to each and every part regardless of who wrote it. + +Thus, it is not the intent of this section to claim rights or contest your rights to work written entirely by you; rather, the intent is to exercise the right to control the distribution of derivative or collective works based on the Library. + +In addition, mere aggregation of another work not based on the Library with the Library (or with a work based on the Library) on a volume of a storage or distribution medium does not bring the other work under the scope of this License. + + 3. You may opt to apply the terms of the ordinary GNU General Public +License instead of this License to a given copy of the Library. To do this, you must alter all the notices that refer to this License, so that they refer to the ordinary GNU General Public License, version 2, instead of to this License. (If a newer version than version 2 of the ordinary GNU General Public License has appeared, then you can specify that version instead if you wish.) Do not make any other change in these notices. + + Once this change is made in a given copy, it is irreversible for that copy, so the ordinary GNU General Public License applies to all subsequent copies and derivative works made from that copy. + + This option is useful when you wish to copy part of the code of the Library into a program that is not a library. + + 4. You may copy and distribute the Library (or a portion or derivative of it, under Section 2) in object code or executable form under the terms of Sections 1 and 2 above provided that you accompany it with the complete corresponding machine-readable source code, which must be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange. + + If distribution of object code is made by offering access to copy from a designated place, then offering equivalent access to copy the source code from the same place satisfies the requirement to distribute the source code, even though third parties are not compelled to copy the source along with the object code. + + 5. A program that contains no derivative of any portion of the Library, but is designed to work with the Library by being compiled or linked with it, is called a "work that uses the Library". Such a work, in isolation, is not a derivative work of the Library, and therefore falls outside the scope of this License. + + However, linking a "work that uses the Library" with the Library creates an executable that is a derivative of the Library (because it contains portions of the Library), rather than a "work that uses the library". The executable is therefore covered by this License. +Section 6 states terms for distribution of such executables. + + When a "work that uses the Library" uses material from a header file that is part of the Library, the object code for the work may be a derivative work of the Library even though the source code is not. +Whether this is true is especially significant if the work can be linked without the Library, or if the work is itself a library. The threshold for this to be true is not precisely defined by law. + + If such an object file uses only numerical parameters, data structure layouts and accessors, and small macros and small inline functions (ten lines or less in length), then the use of the object file is unrestricted, regardless of whether it is legally a derivative work. (Executables containing this object code plus portions of the Library will still fall under Section 6.) + + Otherwise, if the work is a derivative of the Library, you may distribute the object code for the work under the terms of Section 6. Any executables containing that work also fall under Section 6, whether or not they are linked directly with the Library itself. + + 6. As an exception to the Sections above, you may also compile or link a "work that uses the Library" with the Library to produce a work containing portions of the Library, and distribute that work under terms of your choice, provided that the terms permit modification of the work for the customer's own use and reverse engineering for debugging such modifications. + + You must give prominent notice with each copy of the work that the Library is used in it and that the Library and its use are covered by this License. You must supply a copy of this License. If the work during execution displays copyright notices, you must include the copyright notice for the Library among them, as well as a reference directing the user to the copy of this License. Also, you must do one of these things: + + a) Accompany the work with the complete corresponding machine-readable source code for the Library including whatever changes were used in the work (which must be distributed under Sections 1 and 2 above) ; and, if the work is an executable linked with the Library, with the complete machine-readable "work that uses the Library", as object code and/or source code, so that the user can modify the Library and then relink to produce a modified executable containing the modified Library. (It is understood that the user who changes the contents of definitions files in the Library will not necessarily be able to recompile the application to use the modified definitions.) + + b) Accompany the work with a written offer, valid for at least three years, to give the same user the materials specified in Subsection 6a, above, for a charge no more than the cost of performing this distribution. + + c) If distribution of the work is made by offering access to copy from a designated place, offer equivalent access to copy the above specified materials from the same place. + + d) Verify that the user has already received a copy of these materials or that you have already sent this user a copy. + + For an executable, the required form of the "work that uses the Library" must include any data and utility programs needed for reproducing the executable from it. However, as a special exception, the source code distributed need not include anything that is normally distributed (in either source or binary form) with the major components (compiler, kernel, and so on) of the operating system on which the executable runs, unless that component itself accompanies the executable. + + It may happen that this requirement contradicts the license restrictions of other proprietary libraries that do not normally accompany the operating system. Such a contradiction means you cannot use both them and the Library together in an executable that you distribute. + + 7. You may place library facilities that are a work based on the Library side-by-side in a single library together with other library facilities not covered by this License, and distribute such a combined library, provided that the separate distribution of the work based on the Library and of the other library facilities is otherwise permitted, and provided that you do these two things: + + a) Accompany the combined library with a copy of the same work based on the Library, uncombined with any other library facilities. This must be distributed under the terms of the Sections above. + + b) Give prominent notice with the combined library of the fact that part of it is a work based on the Library, and explaining where to find the accompanying uncombined form of the same work. + + 8. You may not copy, modify, sublicense, link with, or distribute the Library except as expressly provided under this License. Any attempt otherwise to copy, modify, sublicense, link with, or distribute the Library is void, and will automatically terminate your rights under this License. However, parties who have received copies, or rights, from you under this License will not have their licenses terminated so long as such parties remain in full compliance. + + 9. You are not required to accept this License, since you have not signed it. However, nothing else grants you permission to modify or distribute the Library or its derivative works. These actions are prohibited by law if you do not accept this License. Therefore, by modifying or distributing the Library (or any work based on the Library), you indicate your acceptance of this License to do so, and all its terms and conditions for copying, distributing or modifying the Library or works based on it. + + 10. Each time you redistribute the Library (or any work based on the Library), the recipient automatically receives a license from the original licensor to copy, distribute, link with or modify the Library subject to these terms and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted herein. You are not responsible for enforcing compliance by third parties to this License. + + 11. If, as a consequence of a court judgment or allegation of patent infringement or for any other reason (not limited to patent issues), conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot distribute so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not distribute the Library at all. For example, if a patent license would not permit royalty-free redistribution of the Library by all those who receive copies directly or indirectly through you, then the only way you could satisfy both it and this License would be to refrain entirely from distribution of the Library. + +If any portion of this section is held invalid or unenforceable under any particular circumstance, the balance of the section is intended to apply, and the section as a whole is intended to apply in other circumstances. + +It is not the purpose of this section to induce you to infringe any patents or other property right claims or to contest validity of any such claims; this section has the sole purpose of protecting the integrity of the free software distribution system which is implemented by public license practices. Many people have made generous contributions to the wide range of software distributed through that system in reliance on consistent application of that system; it is up to the author/donor to decide if he or she is willing to distribute software through any other system and a licensee cannot impose that choice. + +This section is intended to make thoroughly clear what is believed to be a consequence of the rest of this License. + + 12. If the distribution and/or use of the Library is restricted in certain countries either by patents or by copyrighted interfaces, the original copyright holder who places the Library under this License may add an explicit geographical distribution limitation excluding those countries, so that distribution is permitted only in or among countries not thus excluded. In such case, this License incorporates the limitation as if written in the body of this License. + + 13. The Free Software Foundation may publish revised and/or new versions of the Library General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. + +Each version is given a distinguishing version number. If the Library specifies a version number of this License which applies to it and "any later version", you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation. If the Library does not specify a license version number, you may choose any version ever published by the Free Software Foundation. + + 14. If you wish to incorporate parts of the Library into other free programs whose distribution conditions are incompatible with these, write to the author to ask for permission. For software which is copyrighted by the Free Software Foundation, write to the Free Software Foundation; we sometimes make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally. + + NO WARRANTY + + 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. + + END OF TERMS AND CONDITIONS + +------------------- + +ncurses: +Copyright (c) 1998-2005,2006 Free Software Foundation, Inc. + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, distribute with modifications, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name(s) of the above copyright holders shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization. + +------------------- + +OpenSSL: +OpenSSL License +Copyright (c) 1998-2011 The OpenSSL Project. All rights reserved. + +Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: + +1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. + +2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. + +3. All advertising materials mentioning features or use of this software must display the following acknowledgment: "This product includes software developed by the OpenSSL Project for use in the OpenSSL Toolkit. (http://www.openssl.org/)" + +4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to endorse or promote products derived from this software without prior written permission. For written permission, please contact openssl-core@openssl.org. + +5. Products derived from this software may not be called "OpenSSL" nor may "OpenSSL" appear in their names without prior written permission of the OpenSSL Project. + +6. Redistributions of any form whatsoever must retain the following acknowledgment: "This product includes software developed by the OpenSSL Project for use in the OpenSSL Toolkit (http://www.openssl.org/)" + +THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +This product includes cryptographic software written by Eric Young (eay@cryptsoft.com). This product includes software written by Tim Hudson (tjh@cryptsoft.com). + +Original SSLeay License +Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) All rights reserved. + +This package is an SSL implementation written by Eric Young (eay@cryptsoft.com). The implementation was written so as to conform with Netscapes SSL. + +This library is free for commercial and non-commercial use as long as the following conditions are adhered to. The following conditions apply to all code found in this distribution, be it the RC4, RSA, lhash, DES, etc., code; not just the SSL code. The SSL documentation included with this distribution is covered by the same copyright terms except that the holder is Tim Hudson (tjh@cryptsoft.com). + +Copyright remains Eric Young's, and as such any Copyright notices in the code are not to be removed. If this package is used in a product, Eric Young should be given attribution as the author of the parts of the library used. This can be in the form of a textual message at program startup or in documentation (online or textual) provided with the package. + +Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: +1. Redistributions of source code must retain the copyright notice, this list of conditions and the following disclaimer. +2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. +3. All advertising materials mentioning features or use of this software must display the following acknowledgement: "This product includes cryptographic software written by Eric Young (eay@cryptsoft.com)" The word 'cryptographic' can be left out if the rouines from the library being used are not cryptographic related :-). +4. If you include any Windows specific code (or a derivative thereof) from the apps directory (application code) you must include an acknowledgement: "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" + +THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +The licence and distribution terms for any publically available version or derivative of this code cannot be changed. i.e. this code cannot simply be copied and put under another distribution licence [including the GNU Public Licence.] + +------------------- + +zlib: +Acknowledgments: + The deflate format used by zlib was defined by Phil Katz. The deflate and zlib specifications were written by L. Peter Deutsch. Thanks to all the people who reported problems and suggested various improvements in zlib; they are too numerous to cite here. + +Copyright notice: + (C) 1995-2004 Jean-loup Gailly and Mark Adler + + This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. + + Jean-loup Gailly Mark Adler + jloup@gzip.org madler@alumni.caltech.edu + +If you use the zlib library in a product, we would appreciate *not* receiving lengthy legal documents to sign. The sources are provided for free but without warranty of any kind. The library has been entirely written by Jean-loup Gailly and Mark Adler; it does not include third-party code. + +If you redistribute modified sources, we would appreciate that you include in the file ChangeLog history information documenting your changes. Please read the FAQ for more information on the distribution of modified source versions. diff --git a/src/bin/hamcore/openvpn_readme.txt b/src/bin/hamcore/openvpn_readme.txt index 350c8cb7..63afa5b8 100644 --- a/src/bin/hamcore/openvpn_readme.txt +++ b/src/bin/hamcore/openvpn_readme.txt @@ -1,292 +1,292 @@ -====================================================================== - - How to Use the Auto-Generated OpenVPN Configuration Samples - OpenVPN 用の自動生成された設定サンプルファイルの使い方 - 如何使用自动生成的 OpenVPN 配置案例 - -====================================================================== - -This document is written in English, Japanese and Simplified-Chinese. -このドキュメントは英語、日本語、中国語 (簡体字) で記載されています。 -本文档是英语,日语和简体中文。 - - -***************************** -*** *** -*** English *** -*** *** -***************************** - - -How to Use the Auto-Generated OpenVPN Configuration Samples -<< !! READ IT CAREFULLY BEFORE YOU USE !! >> - - -* 1. About Files -When you open the ZIP archive, the following files with the -structured-directory will be expanded. -Extract there files including sub-directory structure toward any destination -directory, and use parts according to your necessary. - -< The Configuration File for L3 (IP Routing) > - openvpn_remote_access_l3.ovpn - -< The Configuration File for L2 (Ethernet Bridging) > - openvpn_site_to_site_bridge_l2.ovpn - -The extension ".ovpn" means a configuration file. You can specify the -configuration file into OpenVPN to initiate a VPN connection. - - -* 2. How Different between L3 and L2? -Use L3 (IP Routing) if you want to install OpenVPN on the normal computer (for -example, a lap top PC), and make it connect to PacketiX VPN Server or SoftEther -VPN Server for the purpose of establishing a "Remote-Access VPN Connection" . -In this case, the IP address will be assigned on the virtual network adapter -of OpenVPN automatically when the OpenVPN will connect to the Virtual HUB on -the VPN Server successfully and request an IP address and other network -parameters (e.g. DNS server address). - -In other hand, if you want to build a "Site-to-Site VPN Connection" , -use L2 (Ethernet Bridging) for OpenVPN on the computer which is set up on the -remote place for bridging. No IP-specific treatment will be done. All Ethernet -packets (MAC frames) will exchanged transparently between two or more sites. -Any computers or network equipments (e.g. routers) will be able to communicate -to other sites mutually. - -VPN Server will treat a virtual VPN session from L3-mode OpenVPN as -a "VPN Client" session. -VPN Server will treat a virtual VPN session from L2-mode OpenVPN as -a "VPN Bridge" session. - - -* 3. How to Specify the Username and Password? -The prompt of username and password will be shown when you try to use this -configuration. You have to enter the same username and password which has -already been defined on the Virtual HUB of VPN Server. - -Please note that you have to create an user on the Virtual HUB in advance. - -If there are two or more Virtual HUBs on the VPN Server, you have to specify -the username as: - - "Username@Virtual-HUB-Name" - -or: - - "Virtual-HUB-Name\Username" - -to choose which Virtual HUB to be connected. You can also choose which -Virtual HUB should be elected as a "Default HUB" when the specification of -the name of Virtual HUB will be omitted. - -Please be advised that you can make OpenVPN to enter the username and password -automatically without showing a prompt. How to do it is described on the -OpenVPN manual. - - -* 4. About Protocol and Port Number -Both TCP and UDP are available to connect to the VPN Server by OpenVPN. - -If you use TCP, the port number is same as any of the "TCP Listener Port" on -the VPN Server which is originally defined in order to accept inbound -TCP-based VPN Client session. - -If you use UDP, the port number must be one of UDP ports which are defined on -the VPN Server configuration in advance. Do not confuse between TCP and UDP -since they are not concerned mutually. - -You can also specify the proxy-server address if the connection should be -relayed by the proxy-server. Specify it on the configuration file. - - -* 5. Closing -OpenVPN is independent software from PacketiX VPN / SoftEther VPN. -It is an open-source application which was developer by third-party. -Refer to http://openvpn.net/ if you need more how to use OpenVPN. - - - -***************************** -*** *** -*** Japanese (日本語) *** -*** *** -***************************** - -OpenVPN 用の自動生成された設定サンプルファイルの使い方 -<< !! 使用前に必ずお読みください !! >> - - -* 1. ファイル構成 -ZIP ファイルを開くと、以下のようなディレクトリ構造のファイルが出力されます。 -これらのファイルをすべてサブフォルダごと任意のディレクトリに展開し、必要な -ファイルをお使いください。 - -< L3 (IP ルーティング) 用の接続設定 > - openvpn_remote_access_l3.ovpn - -< L2 (Ethernet ブリッジ) 用の接続設定 > - openvpn_site_to_site_bridge_l2.ovpn - -拡張子が .ovpn のファイルが接続設定の本体です。このファイルを OpenVPN -プログラムに指定して OpenVPN 接続を始動してください。 - - -* 2. L3 と L2 の違い -普通のコンピュータ (ラップトップ PC など) に OpenVPN をインストールし、 -そのコンピュータを PacketiX VPN Server / SoftEther VPN Server に -リモートアクセス VPN 接続する場合は、L3 (IP ルーティング) 用の接続設定 -を使用してください。この場合は、接続先の仮想 HUB に接続を試行し、 -仮想 HUB のセグメントからアクセスすることができる DHCP サーバーから -IP アドレスの取得を試み、取得に成功した IP アドレスや DNS サーバーなど -のネットワーク情報がクライアント PC の仮想 LAN カードに自動的に割当てられ -ます。 - -一方、拠点間接続 VPN を構築する場合は、遠隔拠点に設置する VPN ブリッジ用 -のコンピュータ上で動作させる OpenVPN には L2 (Ethernet ブリッジ) 用の -接続設定を使用してください。この場合は、IP に特化した処理は一切行われま -せん。すべての Ethernet パケット (MAC フレーム) が拠点間で相互に透過的に -交換されることになります。両方の拠点の Ethernet セグメントに接続されている -すべてのコンピュータやルータなどの通信機器同士は自由に通信することができる -ようになります。 - -L3 モードで接続する場合は、VPN Server はその接続を「VPN Client」ソフトウェア -からの接続と同一のものと見なした振る舞いをします。 - -L2 モードで接続する場合は、VPN Server はその接続を「VPN Bridge」ソフトウェア -からの接続と同一のものと見なした振る舞いをします。 - - -* 3. 接続時に指定するべきユーザー名とパスワードについて -このサンプル設定ファイルを用いて VPN Server に接続しようとすると、 -ユーザー名とパスワードの入力が要求されます。ここで入力すべきユーザー名と -パスワードは、接続先の VPN Server の仮想 HUB に登録されているユーザー名と -パスワードと同一のものです。 - -OpenVPN の接続を受付けるためには、あらかじめ仮想 HUB にユーザーを登録して -おく必要があります。 - -なお、VPN Server に 2 個以上の仮想 HUB が設置されている場合は、ユーザー名 -の指定方法として、 - - "ユーザー名@仮想 HUB 名" - -あるいは - - "仮想 HUB 名\ユーザー名" - -のように指定してください。 -この場合において、仮想 HUB 名を省略した場合に標準で選択されるべきデフォルト -の仮想 HUB をあらかじめ VPN Server 側の設定において指定しておくことも可能です。 - -ユーザー名とパスワードの入力を毎回行うことが困難な場合は、代わりに -設定ファイルおよび外部テキストファイルにユーザー名とパスワードを記載して自動的 -に入力させるようにすることもできます。そのための方法は OpenVPN のマニュアルを -参照してください。 - - -* 4. プロトコルやポート番号について -接続先の VPN Server に対して通信を行うためのプロトコルには TCP と UDP があり、 -どちらも利用可能です。 - -TCP を利用する場合は、ポート番号は VPN Server が正規の VPN Client ソフトウェア -に対してサービスを提供するための TCP リスナポートと同一です。もしリスナポート -が複数定義されている場合は、いずれのリスナポートにも OpenVPN プロトコルで接続 -できます。 - -UDP を利用する場合は、ポート番号はあらかじめ VPN Server 側で指定されている -UDP ポート番号を指定する必要があります。TCP と UDP のポート番号は互いに無関係 -ですので、混乱しないようにしてください。 - -TCP を利用する場合でプロキシサーバーを利用する場合は、そのための設定を設定 -ファイルに追加する必要があります。 - - -* 5. 最後に -OpenVPN は PacketiX VPN / SoftEther VPN とは独立した、サードパーティによって -開発されたオープンソースのプログラムです。OpenVPN の使い方については、 -http://openvpn.net/ を参照してください。 - - - -***************************** -*** *** -*** Chinese (简体中文) *** -*** *** -***************************** - -如何使用自动生成的 OpenVPN 配置案例 -<< !! 使用前请仔细阅读 !! >> - - -* 1. 关于文件 -当您打开 ZIP 压缩包, 以下文件结构目录将被展现。 -解压缩这些文件, 包括子目录结构到任何目的地目录, 并使用你需要的部分。 - -< The Configuration File for L3 (IP Routing) > - openvpn_remote_access_l3.ovpn - -< The Configuration File for L2 (Ethernet Bridging) > - openvpn_site_to_site_bridge_l2.ovpn - -扩展名 ".ovpn" 表示一个配置文件。您可以指定配置文件到 OpenVPN 来发起一个 -VPN 连接。 - - -* 2. L3 和 L2 之间有什么不同 ? -如果你想在普通电脑上安装 OpenVPN (例如, 笔记本电脑), 使用 L3 (IP 路由) -并使其连接到 PacketiX VPN 服务器或 SoftEther VPN 服务器以建立 "远程访问 -VPN 连接" 的目的。 -在这种情况下, 当 OpenVPN 成功连接到 VPN 服务器的虚拟 HUB 并请求一个 IP -地址和其他网络参数 (如 DNS 服务器地址) 时, -IP 地址将被自动分配到 OpenVPN 的虚拟网卡上。 - -另一方面, 如果你想建立一个 "站点到站点的 VPN 连接" , 在远程地点要建立桥接的 -那台电脑上使用 OpenVPN L2 (以太网桥)。 -不需要进行具体的 IP 操作。所有的以太网数据包 (MAC 帧) 将在两个或多个站点之 -间透明地交换。 -任何电脑或网络设备 (如路由器) 能够与其他站点相互通信。 - -VPN 服务器将把 OpenVPN L3 模式的虚拟 VPN 会话当作一个 "VPN 客户端" 会话。 -VPN 服务器将把 OpenVPN L2 模式的虚拟 VPN 会话当作一个 "VPN桥" 会话。 - - -* 3. 如何指定用户名和密码 ? -当您尝试使用此配置时, 会出现输入用户名和密码的提示。 -您应输入已在 VPN 服务器的虚拟 HUB 上定义好的、相同的用户名和密码。 - -请注意, 您必须提前在虚拟 HUB 上创建一个用户。 - -如果在 VPN 服务器上有两个或多个虚拟 HUB, 你应指定用户名为: - - "Username@Virtual-HUB-Name" - -或: - - "Virtual-HUB-Name\Username" - -选择要连接的虚拟 HUB。当虚拟 HUB 的名称参数被省略时, 您也可以选择作为 -"默认 HUB" 的虚拟 HUB。 - -请注意, 您可以使 OpenVPN 自动输入用户名和密码, 而不显示提示信息。 -如何做到这一点, 在 OpenVPN 手册中有描述。 - - -* 4. 关于协议和端口号 -通过 OpenVPN,TCP 和 UDP 都可以连接到 VPN 服务器。 - -如果您使用 TCP, 端口号与为了接受入站的、基于 TCP 的、VPN 客户端会话而在 -VPN 服务器上最初定义好的任一 "TCP 侦听端口" 相同。 - -如果您使用 UDP, 端口号必须是预先在 VPN 服务器配置时定义好的 UDP 端口之一。 -不要混淆 TCP 和 UDP, 因为它们是互不相关的。 - -如果连接需要通过代理服务器中转, 您还可以指定代理服务器地址。在配置文件中 -指定。 - - -* 5. 结束 -OpenVPN 对于 PacketiX VPN / SoftEther VPN 是一个独立软件。 -它是一个开源应用程序, 由第三方开发。 -如果你想知道如何使用 OpenVPN 的更多信息, 请参考 http://openvpn.net/ 。 - +====================================================================== + + How to Use the Auto-Generated OpenVPN Configuration Samples + OpenVPN 用の自動生成された設定サンプルファイルの使い方 + 如何使用自动生成的 OpenVPN 配置案例 + +====================================================================== + +This document is written in English, Japanese and Simplified-Chinese. +このドキュメントは英語、日本語、中国語 (簡体字) で記載されています。 +本文档是英语,日语和简体中文。 + + +***************************** +*** *** +*** English *** +*** *** +***************************** + + +How to Use the Auto-Generated OpenVPN Configuration Samples +<< !! READ IT CAREFULLY BEFORE YOU USE !! >> + + +* 1. About Files +When you open the ZIP archive, the following files with the +structured-directory will be expanded. +Extract there files including sub-directory structure toward any destination +directory, and use parts according to your necessary. + +< The Configuration File for L3 (IP Routing) > + openvpn_remote_access_l3.ovpn + +< The Configuration File for L2 (Ethernet Bridging) > + openvpn_site_to_site_bridge_l2.ovpn + +The extension ".ovpn" means a configuration file. You can specify the +configuration file into OpenVPN to initiate a VPN connection. + + +* 2. How Different between L3 and L2? +Use L3 (IP Routing) if you want to install OpenVPN on the normal computer (for +example, a lap top PC), and make it connect to PacketiX VPN Server or SoftEther +VPN Server for the purpose of establishing a "Remote-Access VPN Connection" . +In this case, the IP address will be assigned on the virtual network adapter +of OpenVPN automatically when the OpenVPN will connect to the Virtual HUB on +the VPN Server successfully and request an IP address and other network +parameters (e.g. DNS server address). + +In other hand, if you want to build a "Site-to-Site VPN Connection" , +use L2 (Ethernet Bridging) for OpenVPN on the computer which is set up on the +remote place for bridging. No IP-specific treatment will be done. All Ethernet +packets (MAC frames) will exchanged transparently between two or more sites. +Any computers or network equipments (e.g. routers) will be able to communicate +to other sites mutually. + +VPN Server will treat a virtual VPN session from L3-mode OpenVPN as +a "VPN Client" session. +VPN Server will treat a virtual VPN session from L2-mode OpenVPN as +a "VPN Bridge" session. + + +* 3. How to Specify the Username and Password? +The prompt of username and password will be shown when you try to use this +configuration. You have to enter the same username and password which has +already been defined on the Virtual HUB of VPN Server. + +Please note that you have to create an user on the Virtual HUB in advance. + +If there are two or more Virtual HUBs on the VPN Server, you have to specify +the username as: + + "Username@Virtual-HUB-Name" + +or: + + "Virtual-HUB-Name\Username" + +to choose which Virtual HUB to be connected. You can also choose which +Virtual HUB should be elected as a "Default HUB" when the specification of +the name of Virtual HUB will be omitted. + +Please be advised that you can make OpenVPN to enter the username and password +automatically without showing a prompt. How to do it is described on the +OpenVPN manual. + + +* 4. About Protocol and Port Number +Both TCP and UDP are available to connect to the VPN Server by OpenVPN. + +If you use TCP, the port number is same as any of the "TCP Listener Port" on +the VPN Server which is originally defined in order to accept inbound +TCP-based VPN Client session. + +If you use UDP, the port number must be one of UDP ports which are defined on +the VPN Server configuration in advance. Do not confuse between TCP and UDP +since they are not concerned mutually. + +You can also specify the proxy-server address if the connection should be +relayed by the proxy-server. Specify it on the configuration file. + + +* 5. Closing +OpenVPN is independent software from PacketiX VPN / SoftEther VPN. +It is an open-source application which was developer by third-party. +Refer to http://openvpn.net/ if you need more how to use OpenVPN. + + + +***************************** +*** *** +*** Japanese (日本語) *** +*** *** +***************************** + +OpenVPN 用の自動生成された設定サンプルファイルの使い方 +<< !! 使用前に必ずお読みください !! >> + + +* 1. ファイル構成 +ZIP ファイルを開くと、以下のようなディレクトリ構造のファイルが出力されます。 +これらのファイルをすべてサブフォルダごと任意のディレクトリに展開し、必要な +ファイルをお使いください。 + +< L3 (IP ルーティング) 用の接続設定 > + openvpn_remote_access_l3.ovpn + +< L2 (Ethernet ブリッジ) 用の接続設定 > + openvpn_site_to_site_bridge_l2.ovpn + +拡張子が .ovpn のファイルが接続設定の本体です。このファイルを OpenVPN +プログラムに指定して OpenVPN 接続を始動してください。 + + +* 2. L3 と L2 の違い +普通のコンピュータ (ラップトップ PC など) に OpenVPN をインストールし、 +そのコンピュータを PacketiX VPN Server / SoftEther VPN Server に +リモートアクセス VPN 接続する場合は、L3 (IP ルーティング) 用の接続設定 +を使用してください。この場合は、接続先の仮想 HUB に接続を試行し、 +仮想 HUB のセグメントからアクセスすることができる DHCP サーバーから +IP アドレスの取得を試み、取得に成功した IP アドレスや DNS サーバーなど +のネットワーク情報がクライアント PC の仮想 LAN カードに自動的に割当てられ +ます。 + +一方、拠点間接続 VPN を構築する場合は、遠隔拠点に設置する VPN ブリッジ用 +のコンピュータ上で動作させる OpenVPN には L2 (Ethernet ブリッジ) 用の +接続設定を使用してください。この場合は、IP に特化した処理は一切行われま +せん。すべての Ethernet パケット (MAC フレーム) が拠点間で相互に透過的に +交換されることになります。両方の拠点の Ethernet セグメントに接続されている +すべてのコンピュータやルータなどの通信機器同士は自由に通信することができる +ようになります。 + +L3 モードで接続する場合は、VPN Server はその接続を「VPN Client」ソフトウェア +からの接続と同一のものと見なした振る舞いをします。 + +L2 モードで接続する場合は、VPN Server はその接続を「VPN Bridge」ソフトウェア +からの接続と同一のものと見なした振る舞いをします。 + + +* 3. 接続時に指定するべきユーザー名とパスワードについて +このサンプル設定ファイルを用いて VPN Server に接続しようとすると、 +ユーザー名とパスワードの入力が要求されます。ここで入力すべきユーザー名と +パスワードは、接続先の VPN Server の仮想 HUB に登録されているユーザー名と +パスワードと同一のものです。 + +OpenVPN の接続を受付けるためには、あらかじめ仮想 HUB にユーザーを登録して +おく必要があります。 + +なお、VPN Server に 2 個以上の仮想 HUB が設置されている場合は、ユーザー名 +の指定方法として、 + + "ユーザー名@仮想 HUB 名" + +あるいは + + "仮想 HUB 名\ユーザー名" + +のように指定してください。 +この場合において、仮想 HUB 名を省略した場合に標準で選択されるべきデフォルト +の仮想 HUB をあらかじめ VPN Server 側の設定において指定しておくことも可能です。 + +ユーザー名とパスワードの入力を毎回行うことが困難な場合は、代わりに +設定ファイルおよび外部テキストファイルにユーザー名とパスワードを記載して自動的 +に入力させるようにすることもできます。そのための方法は OpenVPN のマニュアルを +参照してください。 + + +* 4. プロトコルやポート番号について +接続先の VPN Server に対して通信を行うためのプロトコルには TCP と UDP があり、 +どちらも利用可能です。 + +TCP を利用する場合は、ポート番号は VPN Server が正規の VPN Client ソフトウェア +に対してサービスを提供するための TCP リスナポートと同一です。もしリスナポート +が複数定義されている場合は、いずれのリスナポートにも OpenVPN プロトコルで接続 +できます。 + +UDP を利用する場合は、ポート番号はあらかじめ VPN Server 側で指定されている +UDP ポート番号を指定する必要があります。TCP と UDP のポート番号は互いに無関係 +ですので、混乱しないようにしてください。 + +TCP を利用する場合でプロキシサーバーを利用する場合は、そのための設定を設定 +ファイルに追加する必要があります。 + + +* 5. 最後に +OpenVPN は PacketiX VPN / SoftEther VPN とは独立した、サードパーティによって +開発されたオープンソースのプログラムです。OpenVPN の使い方については、 +http://openvpn.net/ を参照してください。 + + + +***************************** +*** *** +*** Chinese (简体中文) *** +*** *** +***************************** + +如何使用自动生成的 OpenVPN 配置案例 +<< !! 使用前请仔细阅读 !! >> + + +* 1. 关于文件 +当您打开 ZIP 压缩包, 以下文件结构目录将被展现。 +解压缩这些文件, 包括子目录结构到任何目的地目录, 并使用你需要的部分。 + +< The Configuration File for L3 (IP Routing) > + openvpn_remote_access_l3.ovpn + +< The Configuration File for L2 (Ethernet Bridging) > + openvpn_site_to_site_bridge_l2.ovpn + +扩展名 ".ovpn" 表示一个配置文件。您可以指定配置文件到 OpenVPN 来发起一个 +VPN 连接。 + + +* 2. L3 和 L2 之间有什么不同 ? +如果你想在普通电脑上安装 OpenVPN (例如, 笔记本电脑), 使用 L3 (IP 路由) +并使其连接到 PacketiX VPN 服务器或 SoftEther VPN 服务器以建立 "远程访问 +VPN 连接" 的目的。 +在这种情况下, 当 OpenVPN 成功连接到 VPN 服务器的虚拟 HUB 并请求一个 IP +地址和其他网络参数 (如 DNS 服务器地址) 时, +IP 地址将被自动分配到 OpenVPN 的虚拟网卡上。 + +另一方面, 如果你想建立一个 "站点到站点的 VPN 连接" , 在远程地点要建立桥接的 +那台电脑上使用 OpenVPN L2 (以太网桥)。 +不需要进行具体的 IP 操作。所有的以太网数据包 (MAC 帧) 将在两个或多个站点之 +间透明地交换。 +任何电脑或网络设备 (如路由器) 能够与其他站点相互通信。 + +VPN 服务器将把 OpenVPN L3 模式的虚拟 VPN 会话当作一个 "VPN 客户端" 会话。 +VPN 服务器将把 OpenVPN L2 模式的虚拟 VPN 会话当作一个 "VPN桥" 会话。 + + +* 3. 如何指定用户名和密码 ? +当您尝试使用此配置时, 会出现输入用户名和密码的提示。 +您应输入已在 VPN 服务器的虚拟 HUB 上定义好的、相同的用户名和密码。 + +请注意, 您必须提前在虚拟 HUB 上创建一个用户。 + +如果在 VPN 服务器上有两个或多个虚拟 HUB, 你应指定用户名为: + + "Username@Virtual-HUB-Name" + +或: + + "Virtual-HUB-Name\Username" + +选择要连接的虚拟 HUB。当虚拟 HUB 的名称参数被省略时, 您也可以选择作为 +"默认 HUB" 的虚拟 HUB。 + +请注意, 您可以使 OpenVPN 自动输入用户名和密码, 而不显示提示信息。 +如何做到这一点, 在 OpenVPN 手册中有描述。 + + +* 4. 关于协议和端口号 +通过 OpenVPN,TCP 和 UDP 都可以连接到 VPN 服务器。 + +如果您使用 TCP, 端口号与为了接受入站的、基于 TCP 的、VPN 客户端会话而在 +VPN 服务器上最初定义好的任一 "TCP 侦听端口" 相同。 + +如果您使用 UDP, 端口号必须是预先在 VPN 服务器配置时定义好的 UDP 端口之一。 +不要混淆 TCP 和 UDP, 因为它们是互不相关的。 + +如果连接需要通过代理服务器中转, 您还可以指定代理服务器地址。在配置文件中 +指定。 + + +* 5. 结束 +OpenVPN 对于 PacketiX VPN / SoftEther VPN 是一个独立软件。 +它是一个开源应用程序, 由第三方开发。 +如果你想知道如何使用 OpenVPN 的更多信息, 请参考 http://openvpn.net/ 。 + diff --git a/src/bin/hamcore/strtable_cn.stb b/src/bin/hamcore/strtable_cn.stb index 58126745..f6573f06 100644 --- a/src/bin/hamcore/strtable_cn.stb +++ b/src/bin/hamcore/strtable_cn.stb @@ -1,7315 +1,7315 @@ -# Copyright (c) all contributors on SoftEther VPN project in GitHub. -# Copyright (c) Daiyuu Nobori, SoftEther Project at University of Tsukuba, and SoftEther Corporation. -# -# https://www.softether.org/ -# -# Contributors: -# - YF (https://github.com/yfdyh000) - - -########################################################################### -# # -# 软件内的消息等的字符串数据 # -# (对话框资源字符串以外) # -# # -########################################################################### - - - -# 环境参数 -DEFAULT_FONT SimSun -DEFAULT_FONT_HIGHDPI Microsoft YaHei -DEFAULT_FONT_2 SimSun -DEFAULT_FONT_SIZE 9 -DEFAULT_LOCALE 年 月 日 点 分 秒 星期日 星期一 星期二 星期三 星期四 星期五 星期六 天 小时 分 秒 (无) - - -# 语言 -# (0: 日语, 1: 英语, 2: 中文) -LANG 2 -LANGSTR Simplified_Chinese - -STRTABLE_ID SE_VPN_20121007 - -CM_JAPANESE_ONLY_OLD_STARTUP %s\\SoftEther VPN Client 2.0 タスクトレイ.lnk - - -# 软件信息 -PRODUCT_NAME_VPN_CLI SoftEther VPN Client Developer Edition -PRODUCT_NAME_VPN_CMGR SoftEther VPN Client Developer Edition 管理器 -PRODUCT_NAME_VPN_SVR SoftEther VPN Server Developer Edition -PRODUCT_NAME_VPN_BRIDGE SoftEther VPN Bridge Developer Edition -PRODUCT_NAME_VPN_SMGR SoftEther VPN Server Developer Edition 管理器 -PRODUCT_NAME_ELOGSVC SoftEther EtherLogger Developer Edition -PRODUCT_NAME_ELOGMGR SoftEther EtherLogger Developer Edition 管理器 - - -# BRANDED_C_TO_S Branded_VPN -# BRANDED_C_FROM_S Branded_VPN - -# CLIENT_ID 123 - -# Family Name for Software Update Check -PRODUCT_FAMILY_NAME SoftEtherDev - -# 产品信息 -SE_COMPANY_URL https://selinks.org/?se -SE_VPNAZURE_URL https://selinks.org/?vpnazure - -# 共通字符串 -COMMON_UNKNOWN (未知) - - -# 协议错误字符串 -ERR_UNKNOWN 发生未知的错误。 -ERR_0 没有任何错误。 -ERR_1 服务器连接失败。请检查网络连接,确保目标服务器地址和端口正确。 -ERR_2 协议错误。目标服务器返回错误。 -ERR_3 连接中断。 -ERR_4 协议错误。 -ERR_5 非 SoftEther VPN 软件客户端已连接到该端口。 -ERR_6 命令被用户取消。 -ERR_7 服务器拒绝指定的认证方式。 -ERR_8 指定的虚拟 HUB 在该服务器上不存在。 -ERR_9 用户身份验证失败。 -ERR_10 指定的虚拟 HUB 目前已停止。等待一段时间,然后重新连接。 -ERR_11 VPN 会话已删除。可能是从客户端到 VPN 服务器的连接被断开或管理员中断了此会话。 -ERR_12 访问被拒绝。 -ERR_13 VPN 通信会话超时。有可能是从客户端连接到 VPN 服务器的连接已断开。 -ERR_14 协议号无效。 -ERR_15 过多的 TCP/IP 连接。 -ERR_16 连接到目标服务器或虚拟 HUB 的会话太多。 -ERR_17 连接到代理服务器失败。 -ERR_18 代理服务器错误。 -ERR_19 代理服务器用户身份验证失败。 -ERR_20 由同一用户发起的连接会话过多。其他用户可能被作为同一用户连接到虚拟 HUB。 -ERR_21 VPN Server 的软件许可发生错误。请与 VPN 服务器的管理员联系。 -ERR_22 无法访问虚拟网络适配器的设备驱动程序。检查虚拟网络适配器安装并确保它不是禁用。 -ERR_23 发生内部错误。 -ERR_24 访问智能卡或 USB 硬件令牌设备失败。 -ERR_25 PIN 码错误。 -ERR_26 在智能卡或 USB 硬件令牌设备上找不到指定的证书。 -ERR_27 在智能卡或 USB 硬件令牌设备上找不到指定的密钥。 -ERR_28 对智能卡或 USB 硬件令牌设备的写操作失败。 -ERR_29 找不到对象。 -ERR_30 指定名称的虚拟网络适配器已存在。请指定一个不同的名称。 -ERR_31 虚拟网络适配器的设备驱动程序安装失败。 -ERR_32 您不能使用虚拟网络适配器设备的指定名称。 -ERR_33 不支持的。 -ERR_34 指定名称的 VPN 连接设置已存在。 -ERR_35 指定的 VPN 连接设置当前已连接。 -ERR_36 指定的 VPN 连接设置不存在。 -ERR_37 指定的 VPN 连接设置未连接。 -ERR_38 无效的参数。 -ERR_39 智能卡或 USB 硬件令牌设备错误。 -ERR_40 智能卡或 USB 硬件令牌认证被选中,但要进行认证的设备没有被选中。请从连接管理器的“智能卡” 菜单进行选择。 -ERR_41 至少有一个 VPN 连接设置正在被指定的虚拟网络适配器使用。\r\n请删除当前正在使用指定虚拟网络适配器的 VPN 连接设置,或为此 VPN 连接设置指定另一个虚拟网络适配器。 -ERR_42 找不到指定的 VPN 连接设置所使用的虚拟网络适配器。\r\n确保此虚拟网络适配器存在。另外,请确保虚拟网络适配器设备没有被禁用。\r\n\r\n如果你解决不了此问题,可以更改 VPN 连接设置使用的虚拟网络适配器,或者创建一个新的同名虚拟网络适配器。 -ERR_43 由指定的 VPN 连接设置使用的虚拟网络适配器当前被另一个 VPN 连接设置所占用。\r\n如果有另一个 VPN 连接设置正在使用同一个虚拟网络适配器,需断开 VPN 连接设置。 -ERR_44 由指定的 VPN 连接设置使用的虚拟网络适配器已禁用。\r\n在使用此 VPN 连接设置前,请启用虚拟网络适配器。 -ERR_45 指定值无效。 -ERR_46 连接目标不是群集控制器。 -ERR_47 尝试连接。 -ERR_48 连接群集控制器失败。 -ERR_49 群集控制器无法分配一个新的会话到群集上。 -ERR_50 无法管理群集成员服务器的虚拟 HUB。 -ERR_51 用于连接的用户密码是空的,所以远程连接被禁止。如果使用空密码,只允许连接本地主机 (127.0.0.1) 的 VPN 服务器。 -ERR_52 没有足够的权限。 -ERR_53 找不到指定的监听器。 -ERR_54 指定监听端口号已经存在。 -ERR_55 这不是一个群集成员服务器。 -ERR_56 不支持指定的加密算法名。 -ERR_57 具有指定名称的虚拟 HUB 已经存在于服务器上。 -ERR_58 已存在过多虚拟 HUB。请删除过期的虚拟 HUB 以释放资源,供新的虚拟 HUB 使用。 -ERR_59 具有指定名称的级联已经存在。 -ERR_60 群集的服务器上不能创建级联。 -ERR_61 指定的级联处于脱机状态。 -ERR_62 访问列表过多。 -ERR_63 用户过多。 -ERR_64 组过多。 -ERR_65 指定的组不存在。 -ERR_66 虚拟 HUB 上已存在指定名称的用户。 -ERR_67 虚拟 HUB 上已存在指定名称的群。 -ERR_68 具有指定名称的用户在服务器上已存在,但身份验证类型不是密码验证。无法更改密码。 -ERR_69 用户名或旧密码输入不正确。请注意密码有大小写区分。 -ERR_70 埼玉。 -ERR_71 因应日本经济产业省命令,SoftEther 暂停当前配发。 -ERR_72 因应 IPA 命令,SoftEther 暂停当前配发。 -ERR_73 无法断开级联会话。要删除会话,请停止级联。 -ERR_74 VPN Server 的连接设置未完成。请先完成 VPN 连接设置。 -ERR_75 虚拟专用网 VPN Server 连接已经开始。 -ERR_76 未连接到 VPN Server。 -ERR_77 指定的 X509 证书文件不包含 RSA 1024 bit,1536 bit,2048 bit,3072 bit 位或 4096 bit 的公共密钥。SoftEther VPN 软件仅支持 RSA 1024 bit,1536 bit,2048 bit,3072 bit 位或 4096 bit 证书。 -ERR_78 无法断开 SecureNAT 会话。要删除会话,请停止 SecureNAT 功能。 -ERR_79 无法在群集环境中启用 SecureNAT。 -ERR_80 SecureNAT 未开始工作。 -ERR_81 至 VPN Server 的 VPN 连接会话被网络管理员安装的防火墙设备中断。请联络网络管理员以获取进一步信息。 -ERR_82 无法断开本地网桥会话。要删除会话,请停止本地网桥。 -ERR_83 本地网桥未开始工作。 -ERR_84 目标 VPN Server 无法使用本地网桥。参考在线帮助或其他文档以获取在指定 VPN Server 上使用本地网桥的设置方法。 -ERR_85 无法信任目标服务器提供的证书。始终验证服务器证书在 VPN 连接设置中被启用。请注册一个可信任的根证书或注册一个单独的证书。 -ERR_86 目标服务器的产品代码不正确。无法从此客户端连接。 -ERR_87 客户端和服务端软件版本不同。请更新软件。 -ERR_88 无法添加捕获设备。很可能同一捕获设备已经注册。 -ERR_89 无法从该客户端连接到目标服务器。一个特殊客户端软件是必需的。 -ERR_90 指定捕获设备未注册。 -ERR_91 无法断开虚拟 3 层交换机会话。要删除会话,请停止虚拟 3 层交换机。 -ERR_92 具有指定名称的虚拟 3 层交换机已存在。指定一个不同的名称。 -ERR_93 找不到指定的虚拟 3 层交换机。 -ERR_94 指定的名称无效。检查名称是否有不能使用的字符 -ERR_95 无法添加虚拟 3 层接口。Please check that the parameters are valid. Also please make sure that the Virtual Layer 3 switch is stopped. Adding or deleting interfaces are unable when the Virtual Layer 3 switch is running. -ERR_96 无法删除虚拟 3 层接口。Please check that the parameters are valid. Also please make sure that the Virtual Layer 3 switch is stopped. Adding or deleting interfaces are unable when the Virtual Layer 3 switch is running. -ERR_97 与指定虚拟 3 层交换接口的目标虚拟 HUB 连接的虚拟 3 层接口已在虚拟 3 层交换机中存在。不能在同一个虚拟 3 层交换机中定义超过一个连接到同一个虚拟 HUB 的虚拟 3 层接口。 -ERR_98 无法添加路由表项。Please check that the parameters are valid. Also please make sure that the Virtual Layer 3 switch is stopped. Adding or deleting routing table entries are unable when the Virtual Layer 3 switch is running. -ERR_99 无法删除路由表项。Please check that the parameters are valid. Also please make sure that the Virtual Layer 3 switch is stopped. Adding or deleting routing table entries are unable when the Virtual Layer 3 switch is running. -ERR_100 指定的路由表项已存在。 -ERR_101 客户端和服务器的时钟彼此不同步。检查时间设置。 -ERR_102 无法启动此虚拟 3 层交换机。 要启动虚拟 3 层交换机,必须在虚拟 3 层交换机定义至少一个虚拟接口。 -ERR_103 目标 VPN Server 没有足够的客户端连接许可证。请与服务器管理员联系。 -ERR_104 目标 VPN Server 没有足够的网桥许可证。请与服务器管理员联系。 -ERR_105 由于目前的技术问题,目标 VPN Server 没有收到连接。请稍候,或与 VPN Server 管理员联系,要求进行服务器日志文件检查。 -ERR_106 目标 VPN Server 的证书已过期。请与 VPN Server 管理员联系。 -ERR_107 监测模式要求了一个连接。但是,连接用户的安全策略不允许监察模式。 -ERR_108 网桥 / 路由模式要求了一个连接。但是,连接用户的安全策略不允许网桥 / 路由模式。 -ERR_109 一个来自客户端 IP 地址的连接被虚拟 HUB 的源 IP 限制列表拒绝。 -ERR_110 项目数过多。 -ERR_111 内存不足。 -ERR_112 指定的对象已存在。指定的对象已存在。 -ERR_113 发生致命的错误。很可能是该程序的操作无法继续。 -ERR_114 目标 VPN Server 已检测到软件许可证错误。连接被拒绝。请与 VPN Server 管理员联系。 -ERR_115 通过 Internet 连接到 SoftEther 公司提供的一个重要服务器的目标 VPN Server 无法验证许可证。请稍候,或与 VPN Server 管理员联系,要求检查服务器日志文件和检查服务器本身的 Internet 连接状态。 -ERR_116 客户端的软件许可证错误。连接被拒绝。 -ERR_117 命令或文件名不正确 -ERR_118 许可证密钥不正确 -ERR_119 VPN Server 上没有注册有效的产品许可证。请与 VPN Server 管理员联系。 -ERR_120 VPN Server 作为群集运行所需要的许可证未注册。请与 VPN Server 的管理员。 -ERR_121 VPN 连接设置已使用“Web 安装程序创建工具包”或“简单安装程序创建工具包”安装。目标服务器版本不支持支持 SoftEther VPN 的 2.0 管理包。请与系统管理员或安装程序创建者联系。 -ERR_122 与 VPN Server SDK for .NET,它只能连接到 SoftEther VPN Server 版本,支持 SoftEther VPN 的 2.0 管理包。 VPN Server 的目标不是一个版本,支持 SoftEther VPN 的 2.0 管理包。与系统管理员联系。 -ERR_123 试用版软件在目标服务器上已过期。联系服务器的系统管理员以下载新的测试版或从 http://www.softether.com/ 下载完整版本。 - -# ----- 不完全翻訳ここから ----- -ERR_124 至 VPN Server 的 VPN 连接在服务器端被拒绝。 -ERR_125 至 VPN Server 的 VPN 连接在客户端被拒绝。 -ERR_126 因为一段时期已经过去,安全策略强制执行自动断开了 VPN 会话。如果你想继续,请再次连接。 -ERR_127 VPN Server 需要特殊版本的 VPN Client 软件。请咨询您的管理员。 -ERR_128 注册用户对象的数量超过了 VPN Server 上产品许可证允许的最大数量。您不能再添加用户对象了,除非你删除旧的用户或升级到产品的更高版本。 -ERR_129 认购合同在 VPN Server 的、这个版本的、发布日期前已经到期。客户在此认购合同期内被授权使用 VPN Server的版本,。客户应延长认购期。客户也能“降级” VPN Server 的版本,至认购结束前发布的老版本。如果您想降级版本,旧版本在 http://www.softether.com/ -# ----- 不完全翻訳ここまで ----- -ERR_130 试用许可证密钥恐怕不能频繁地被相同的客户获取。请考虑购买的正式版。 -ERR_131 几个在同一 IP 地址的 VPN Server。您可以指定目标服务器的私有 IP 地址或具体的主机名,如“全球 IP 地址或主机名/192.168.x.x”。如果服务器端使用 NAT,配置 NAT 为打开、转发或转让相应的端口。 -ERR_132 动态 DNS 服务的密钥与他人重复。密钥将被自动重置。 -ERR_133 指定的动态 DNS 主机名已被使用。请更改主机名。 -ERR_134 指定的动态 DNS 主机名有一个无效的字符。请更改主机名。 -ERR_135 指定的动态 DNS 主机名的长度太长。主机名必须等于或少于 31 个字母。 -ERR_136 未指定动态 DNS 主机名。 -ERR_137 指定的动态 DNS 主机名的长度太长。主机名必须是等于或大于 3 个字母。 -ERR_138 在虚拟 HUB 上指定的用户的密码、在使用 MS-CHAP v2 验证之前,必须重置。请让 VPN Server 的管理员,通过 4.0 或更高版本的 VPN Server 管理器或 vpncmd 重设密码。或者,您自己可以通过 VPN Client 更改密码。 -ERR_139 动态 DNS 服务器的连接被中断。 -ERR_140 无法初始化 ICMP(PING)协议。 VPN Server 的进程可能以普通用户权限在运行。在这种情况下, VPN Server 作为系统服务运行。 (在 Linux / UNIX,以 root 权限运行)。 -ERR_141 无法打开 DNS 端口 53。请确认没有其他的 DNS 服务器程序(例如,BIND 或 Microsoft DNS 服务器)在同一台计算机上。如果有冲突的服务,停止他们。或在 Linux/ UNIX 的 root 权限运行 VPN Server 的进程。 -ERR_142 OpenVPN Server 功能未启用。 -ERR_143 证书验证功能和外部服务器验证功能尚未在 SoftEther VPN 的开源版本上实施。可以选择匿名身份验证或密码验证来代替。 -ERR_144 不可接受的操作。使用 VPN Gate 控制面板更改 VPN Gate 中继服务器设置。 -ERR_145 不可接受的操作。使用 VPN Gate 实用工具修改 VPN Gate 公共 VPN 中继服务器的连接设置。 -ERR_146 VPN Gate 服务运行在 VPN 客户端程序内。在此屏幕上,你不能停止 VPN Gate 服务。使用 VPN 客户端管理器来启用或禁用 VPN Gate 服务。 -ERR_147 不支持此功能。它尚未在 SoftEther VPN 的开源版本上实施。 -ERR_148 VPN 连接被中断,因为该系统被暂停。 - - -#关于许可证 -LICENSE_INFO_URL https://selinks.org/?new_license -LICENSE_SUPPORT_URL https://selinks.org/?q=license_info&id=%s -LICENSE_STATUS_OK 有效 -LICENSE_STATUS_EXPIRED 已过期 -LICENSE_STATUS_ID_DIFF 服务器 ID 不一致 -LICENSE_STATUS_DUP 重复 -LICENSE_STATUS_INSUFFICIENT 需要其他许可证 -LICENSE_STATUS_COMPETITION 与其他许可证的竞争 -LICENSE_STATUS_NONSENSE 当前版本无意义 -LICENSE_STATUS_CPU CPU 类型不兼容 -LICENSE_STATUS_OTHERERROR 未知错误 - - -#关于TCP最优化 -TCPOPT_NOT_SUPPORTED TCP 通讯设定最优化实用程序,这个操作系统不能使用。 -TCPOPT_NOT_ADMIN 没有管理权限的用户不能使用 TCP 协议优化工具。 - - -# Windows Vista / Windows 7 / Windows 8 优化 -VISTA_MMCSS_MSG 你想优化 Windows Vista / Windows 7 / Windows 8 / Windows 10 用于使用 VPN 进行多媒体文件的播放吗? (如: 视频、音频和流媒体) -VISTA_MMCSS_MSG_2 Windows Vista / Windows 7 / Windows 8 / Windows 10 的 VPN 优化已经完成。\r\n你想进行远程优化配置吗? -VISTA_MMCSS_MSG_3 您不能在当前环境下进行优化。 -VISTA_MMCSS_MSG_4 您必须具有管理员权限才可使用此功能。\r\n请注意,在 Windows Vista / Windows 7 / Windows 8 / Windows 10 中,您应该使用“以管理员身份运行”执行程序。 -VISTA_MMCSS_MSG_5 优化完成。 -VISTA_MMCSS_MSG_6 优化配置被删除。 - - -# 关于PKCS 实用程序 -PKCS_UTIL_TITLE PKCS#12 写入实用程序 -PKCS_UTIL_SAVEDLG_TITLE 选择你要写入到 USB 令牌中的 PKCS#12 文件 -PKCS_UTIL_READ_ERROR 无法读取文件: "%s"。 -PKCS_UTIL_WRITE_OK_MSG 文件 %s 已写入到 USB 硬件令牌中。 -PKCS_UTIL_DELETE_OK_MSG PKCS#12 证书数据已从 USB 硬件令牌中删除。 -PKCS_UTIL_SECA_FILENAME seca_p12 -PKCS_MAKE_SURE 写入 USB 令牌的 PKCS#12 证书数据将被删除。\r\n一旦数据被删除,将无法恢复。\r\r\n\r\r\n你想继续吗? -PKCS_UTIL_BAD_FILE 指定的文件不能识别为 PKCS#12 文件。 - - -# 关于共通对话框 -DLG_ALL_FILES 所有文件(*.*)|*.* -DLG_CERT_FILES X509 证书文件 (*.CER;*.CRT)|*.cer;*.crt|所有文件 (*.*)|*.* -DLG_KEY_FILTER 密钥文件 (*.KEY;*.PEM)|*.key;*.pem|所有文件 (*.*)|*.* -DLG_PKCS12_FILTER PKCS#12 文件(*.P12;*.PFX)|*.p12;*.pfx|所有文件 (*.*)|*.* -DLG_CERT_OR_P12_FILTER X509 证书或 PKCS#12 文件(*.CER;*.CRT;*.P12;*.PFX)|*.cer;*.crt;*.p12;*.pfx|X509 证书文件(*.CER;*.CRT)|*.cer;*.crt|PKCS#12 文件(*.P12;*.PFX)|*.p12;*.pfx|所有文件 (*.*)|*.* -DLG_CONFIG_FILES 设置文件 (*.CONFIG)|*.config|所有文件 (*.*)|*.* -DLG_KEY_OR_P12_FILTER 密钥文件或 PKCS#12 文件 (*.KEY;*.PEM;*.P12;*.PFX)|*.key;*.pem;*.p12;*.pfx|密钥文件 (*.KEY;*.PEM)|*.key;*.pem|PKCS#12 文件(*.P12;*.PFX)|*.p12;*.pfx|所有文件 (*.*)|*.* -DLG_ZIP_FILER ZIP 文件(*.ZIP)|*.zip|所有文件(*.*)|*.* -DLG_OPEN_CERT 请选择证书文件 -DLG_OPEN_KEY 请选择密钥文件 -DLG_OPEN_KEY_WITH_CERT 请选择相应的密钥文件 -DLG_OPEN_FILE_ERROR 无法读取指定文件 "%S"。 -DLG_OPEN_FILE_ERROR_W 无法读取指定文件 "%s"。 -DLG_BAD_P12 文件 "%S" 不是有效的 PKCS#12 证书文件。 -DLG_BAD_P12_W 文件 "%s" 不是有效的 PKCS#12 证书文件。 -DLG_BAD_X509 文件 "%S" 不是有效的 X509 证书文件。 -DLG_BAD_X509_W 文件 "%s" 不是有效的 X509 证书文件。 -DLG_BAD_KEY 文件 "%S" 不是有效的 RSA 密钥文件。 -DLG_BAD_KEY_W 文件 "%s" 不是有效的 RSA 密钥文件。 -DLG_BAD_SIGNATURE 密钥无法与指定证书中的公钥相对应。\r\n请提供可对应的密钥。 -DLG_SAVE_CERT 请指定保存证书的文件名 -DLG_SAVE_KEY 请指定保存密钥的文件名 -DLG_SAVE_P12 请指定保存证书和密钥的文件名 -DLG_SAVE_FILE 文件保存为 -DLG_SAVE_OPENVPN_CONFIG 指定一个文件名保存 ZIP 文件,包含 OpenVPN 的设置 -DLG_CERT_SAVE_OK 证书保存成功。 -DLG_CERT_SAVE_ERROR 证书无法保存。 -DLG_KEY_SAVE_OK 密钥保存成功。 -DLG_KEY_SAVE_ERROR 密钥无法保存。 -DLG_KEY_PAIR_SAVE_OK 证书和密钥保存成功。 -DLG_KEY_PAIR_SAVE_ERROR 无法保存的证书和个人密钥。 -DLG_REBOOT_INFO 计算机将被在 %u 秒后重新启动。 -DLG_REBOOT_INFO_2 重新启动... -DLG_REBOOT_ERROR 计算机重新启动失败。\r\n\r\n请手动重新启动计算机。 -DLG_SAVE_CONFIG 指定一个文件名保存配置 -DLG_OPEN_CONFIG 指定配置文件导入 -DLG_STRING_DEFTITLE 输入字符串 -DLG_STRING_DEFINFO 请输入字符串。 -DLG_ABOUT_LEGAL 法律公告 -DLG_ABOUT_AUTHORS 作者名单 -DLG_UPDATE_DATE \ (Released on %S) -DLG_UPDATE_HINT 按确定查看网页浏览器最新更新的信息。\r\n\r\n您必须手动下载并安装更新。如果你想在其他电脑上更新软件,您必须登录到计算机通过远程桌面或 SSH 进行下载和更新。 - - -# 关于竞争进程 -BAD_PROCESS_TITLE 有关 %S 的警告 -BAD_PROCESS_MESSAGE 在此计算机上运行的软件 "%S" 会产生问题。\r\n\r\n"%S" 问题可能会导致 VPN 通信不稳定和错误。\r\n\r\n如果由于 VPN 与 "%S" 的共同使用而导致 VPN 不稳定,请停止或卸载 "%S"。(请注意,在某些情况下,由于软件的性质,即使你停止该软件,但问题仍会保留在计算机上。) \r\n - - -# 关于硬件令牌 -SEC_SMART_CARD 智能卡 -SEC_USB_TOKEN USB 令牌 -SEC_INIT_MSG_1 将智能卡插入智能卡阅读器中,并输入 PIN 码。 -SEC_INIT_MSG_2 将 USB 硬件令牌与计算机的 USB 端口相连,输入 PIN 码。 -SEC_OPENING 开启设备... -SEC_CLOSING 关闭设备... -SEC_OPEN_SESSION 开启安全会话... -SEC_CLOSE_SESSION 关闭安全会话... -SEC_LOGIN 登录令牌... -SEC_LOGOUT 登出令牌... -SEC_INIT_BATCH 启动批处理... -SEC_READ_DATA 读取数据... -SEC_WRITE_DATA 写入数据... -SEC_READ_CERT 读取证书... -SEC_WRITE_CERT 写入证书... -SEC_DELETE 删除对象... -SEC_SIGN 密匙处理数字签名... -SEC_WRITE_KEY 写入密匙... -SEC_ENUM 枚举对象... -SEC_FINISHED 操作完成。 -SEC_ERROR_INVALID_ID 指定的安全设备 (设备 %u) 无效。 -SEC_ERROR_OPEN_DEVICE 无法打开设备 %S,请确保该设备连接到计算机上。 -SEC_ERROR_OPEN_DEVICEEX 无法打开设备 %S,请确保该设备连接到计算机上。\r\n\r\n如果使用公钥基础设施 (PKI) 特殊客户端软件,则需要在“PKI 实用工具” (从“开始”菜单选择) 中,选择智能卡设备。 -SEC_ERROR_OPEN_SESSION 无法在设备 %S 中启动安全会话。请确保选择正确的设备。 -SEC_ERROR_LOGIN 输入的 PIN 码错误。 -SEC_ERROR_NOT_FOUND_1 智能卡中不存在指定的对象。确保插入正确的智能卡。 -SEC_ERROR_NOT_FOUND_2 USB 硬件令牌中不存在指定的对象。确保连接正确的 USB 硬件令牌。 -SEC_ERROR_SIGN_1 智能卡中不存在密钥或数字签名操作失败。确保插入正确的智能卡。 -SEC_ERROR_SIGN_2 USB 硬件令牌中不存在密钥或数字签名操作失败。确保连接正确的 USB 硬件令牌。 -SEC_ERROR_WRITE_1 无法在智能卡中写入对象。智能卡中可能没有足够的存储空间。 -SEC_ERROR_WRITE_2 无法在 USB 硬件令牌中写入对象。USB 硬件令牌中可能没有足够的存储空间。 -SEC_ERROR_ENUM 对令牌中的存储对象枚举失败。 -SEC_ERROR_DELETE 对指定对象删除失败。可能指定对象在内存中不存在。 -SEC_COLUMN1 设备名称 -SEC_COLUMN2 种类 -SEC_COLUMN3 制造商 -SEC_COLUMN4 DLL 名 -SEC_INVALID_ID 指定的智能卡设备不存在。请重新选择智能卡种类。 -SEC_MGR_COLUMN1 名称 -SEC_MGR_COLUMN2 种类 -SEC_MGR_COLUMN3 私有 -SEC_TYPE_DATA 数据 -SEC_TYPE_CERT 证书 -SEC_TYPE_KEY 密钥 -SEC_TYPE_PUB 公钥 -SEC_YES 是 -SEC_NO 否 -SEC_NONE 无 -SEC_IMPORT_DATA 选择你想导入的数据 -SEC_IMPORT_CERT 选择你要导入的证书 -SEC_IMPORT_KEY 选择你要导入的密钥 -SEC_READ_FAILED 选择你要导入的证书。 -SEC_DATA_TOO_BIG 指定数据太大。大于 %u 个字节的数据无法写入智能卡。 -SEC_OBJECT_NAME_TITLE 插入对象的名称 -SEC_OBJECT_NAME_INFO 指定写入新智能卡的对象名称。您可以指定不包括字母数字字符双字节字符和特殊对象的名称。\r\n警告: 如果卡上已有同一类型相同名称的对象,该对象将被覆盖。 -SEC_DELETE_MSG 选定的对象将从智能卡中删除。\r\n你要这样做吗? -SEC_OBJECT_IMPORT_OK 对象被写入智能卡。 -SEC_OBJECT_EXPORT_OK 从智能卡中读取的数据已被保存。 -SEC_NEW_CERT_IMPORT_OK 新创建的证书已被写入智能卡。 -SEC_CURRENT_DEVICE 当前选中设备 %S。 -SEC_CURRENT_NO_DEVICE 选择要使用的智能卡。 -SEC_NO_SECURE_DEVICE 系统中没有安装与 SoftEther VPN 兼容的智能卡或硬件安全口令设备。\r\n\r\n要使用智能卡或硬件口令,需要在 Windows 中安装 PKCS#11 兼容设备驱动。并且, SoftEther VPN 需要支持此设备类型。\r\n请确定已安装系统兼容设备驱动。\r\n请在 SoftEther 有限公司网站上查阅 SoftEther VPN 兼容设备列表。而且,将软件更新到最新版本也有助于增大设备兼容范围。 -SEC_PIN_DEVICE_OPEN_ERR 无法连接设备 "%S"。请确保硬件正确连接。 -SEC_PIN_CURRENT_BAD 当前的 PIN 码是不正确的。 -SEC_PIN_CHANGE_FAILED 更改 PIN 码失败。 -SEC_PIN_OK PIN 码已变更。 - - -# TCP 连接会话 -CONNECTDLG_CAPTION 连接中... -CONNECTDLG_MESSAGE 连接到服务器 "%S" (TCP 端口: %u)... -CONNECTDLG_CANCELING 取消连接。请稍候... - - -# NIC 信息会话 -NICINFO_1 已连接到 VPN 服务器。 -NICINFO_1_1 在 VPN 上的 DHCP 服务器请求一个 IP 地址。 -NICINFO_1_2 决定在 VPN 中使用的 IP 地址。 - -NICINFO_2 VPN 会话已建立。 -NICINFO_2_1 分配的 IP 地址是 %S。 - -NICINFO_3 VPN 会话已建立。 -NICINFO_3_1 该 IP 地址是 %S 已可以使用。 - - -#关于登录时密码输入对话框 -PW_RETRYCOUNT 如果没有输入,%u 秒后自动重新连接... -PW_LOGIN_DLG_TITLE 登录 -PW_TYPE_0 匿名身份验证 -PW_TYPE_1 标准密码验证 -PW_TYPE_2 RADIUS 或 NT 域验证 -PW_TYPE_3 客户端证书认证 -PW_TYPE_4 智能卡身份验证 -PW_TYPE_5 Openssl Engine Authentication - -PW_MSG_PROXY 代理服务器 %S 用户身份验证失败。请重新输入正确的用户名和密码。 -PW_TYPE_PROXY 代理服务器认证 - - -#关于 VPN 连接状态 -STATUS_1 初始化中... -STATUS_2 通过代理服务器 %S 连接到 VPN Server "%S"... -STATUS_3 在代理服务器 %S 上进行用户身份验证... -STATUS_4 连接到 VPN Server "%S" ... -STATUS_5 验证服务器证书... -STATUS_6 用户身份验证... -STATUS_7 建立 VPN 会话... -STATUS_8 连接到群集 VPN Server ... -STATUS_9 VPN 会话已建立。 - - -#关于证书对话 -CERT_NOT_FOUND 没有在可信任证书列表上找到经证书颁发机构颁发的证书。 -CERT_ROOT 这是一个根证书 (自签名的证书)。 -CERT_LV_C1 区域 -CERT_LV_C2 值 -CERT_SERIAL 序列号 -CERT_ISSUER 发行者 -CERT_SUBJECT 主题 -CERT_NOT_BEFORE 有效期自 -CERT_NOT_AFTER 有效期至 -CERT_BITS 数位 -CERT_PUBLIC_KEY 公钥 -CERT_DIGEST_MD5 摘要 (MD5) -CERT_DIGEST_SHA1 摘要 (SHA-1) -CERT_NO_SERIAL 没有序列号 -CERT_BITS_FORMAT %u bits - - -#关于证书认证对话框 -CC_DANGEROUS_MSG 之前保存的与此服务器(%S)建立 VPN 连接的服务器证书,与服务器提供的当前服务器证书不匹配。\r\n以前的摘要值(MD5): %S\r\n以前的摘要值(SHA1): %S\r\ni当前的摘要值(MD5): %S\r\n当前摘要值(SHA-1): %S\r\n\r\n可能是服务器管理员在 VPN Server 端更改了证书。然而,也有可能是中间人攻击,如发生欺骗攻击。\r\n强烈建议您向您向您想连接的 VPN Server 管理员进行详细信息咨询。 -CC_WARNING_MSG 您是否想让您当前连接使用的证书,在下次连接到 %s 自动信任吗?\r\n\r\n摘要值(SHA-1): %S\r\n摘要值(MD5): %S\r\n\r\n如对此服务器证书的真实性有疑问,请通过一稳妥而安全的渠道,与服务器所有者进行联系,并列举上述摘要值以进行确认。\r\n\r\n单击“是”,则下次连接时,若服务器提供相同证书则自动信任。\r\n单击“否”,则下次连接到此服务器时,再次显示此警告。\r\n单击“取消”,返回安全警告窗口。\r\n\r\n注意: 此设置可按逐个账户情况进行修改。您可以使用 VPN Client 客户端管理器内的账户属性进行设置。 - - -# 关于 Windows 版本的错误 -WINVER_TITLE 有关 Windows 版本的警告 -WINVER_ERROR_FORMAT Windows %s 的版本和补丁包是“%S”。\r\n\r\Windows %s 最新支持的版本和补丁包如下:\r\n%S \r\n因为 Windows 在 %s 的版本比%s支持 Windows 的版本还要新,可能会发生意想不到的麻烦或兼容问题。\r\n为了避免出现问题,建议以获取并安装 %s 最新的更新\r\n可以继续使用当前未更新的版本,但不建议这样做。\r\n\r\n如果你是管理员,你可以免费下载 %s 的最新更新补丁,从 http://selinks.org/ 网站。\r\n\r\n如果您不是管理员,你应该将此消息通知 VPN Server 的管理员。\r\n\r\n----- MSG%04u%02u -----\r\n\r\n -WINVER_ERROR_VPNSERVER 在目标计算机上的 VPN Server -WINVER_ERROR_VPNBRIDGE 在目标计算机上的 VPN Bridge -WINVER_ERROR_VPNCLIENT 在本地计算机上的 VPN Client -WINVER_ERROR_PC_LOCAL 此本地计算机 -WINVER_ERROR_PC_REMOTE 远程服务器 - - -# 开源版本的警告 -OSS_MSG 欢迎来到 SoftEther VPN 服务器学术版 !\r\n\r\n此 VPN 服务器作为日本筑波大学的一个学术研究由免费软件开发的,且由,开源 SoftEther 项目 (http://www.softether.org/) 为公众利益免费发布的。\r\n\r\nSoftEther VPN 软件是作为筑波大学和 SoftEther 公司之间的联合研究合同的一部分而发布给公众的。SoftEther VPN 软件的开发和发布仅为学术研究目的。因此,对 SoftEther VPN 软件不提供支持服务,即使它包含错误或漏洞。用户将对使用 SoftEther VPN 的结果承担责任。 SoftEther VPN 的开发者和发行者都将永远不会为任何后果或损失承担责任。\r\n\r\n在您同意上述启示后,使用 SoftEther VPN 服务器享受 VPN 通信。\r\n\r\n对于 SoftEther VPN 的更多细节,请参阅 http://www.softether.org/。\r\n\r\n - - -# NAT Traversal warning -NATT_MSG ** 使用 NAT 穿透 (UDP 打洞) - 它可能是不稳定的 **\r\n\r\n此 VPN 客户端通过使用 NAT 穿透 (UDP 打洞) 技术连接到 VPN 服务器 '%S'。\r\n\r\nNAT 穿透允许位于 NAT 盒后面的 VPN 服务器接受来自 NAT 盒中的、没有任何端口映射设置的 VPN 客户端的 VPN 连接。\r\n\r\n然而,基于 NAT 穿透的 VPN 会话有时会变得不稳定,因为 NAT 穿透使用的是基于 UDP 的协议。例如,如果在 VPN 服务器和 VPN 客户端之间有一个不好的 NAT 盒子, VPN 隧道每 5 分钟断开一次。一些大规模 NAT 网关使用便宜的互联网服务供应商,有时会造成 NAT 穿透的同样问题。这是路由器或互联网服务供应商的问题。这不是 SoftEther VPN 软件的问题。\r\n\r\n为了解决这个不稳定的隧道问题,您应该直接连接到 VPN 服务器的 TCP 监听端口,而不是使用 NAT 穿透功能。要使用 TCP 直接连接到 VPN 服务器, VPN 服务器的监听端口必须通过在 NAT 盒的端口映射设置暴露到互联网上。请询问 NAT 盒的管理员或参阅 NAT 盒的手册在 NAT 盒上添加端口映射设置。\r\n\r\n如果此消息仍是 VPN 服务器暴露了一个 TCP 端口到互联网后,检查 VPN 客户端连接设置屏幕上的 "禁用 NAT-T" 复选框。\r\n\r\n -NATT_MSG2 ** 使用 NAT 穿透 (UDP 打洞) - 它可能是不稳定的 **\r\n\r\n此 VPN 客户端通过使用 NAT 穿透 (UDP 打洞) 技术连接到 VPN 服务器 '%S'。\r\n\r\nNAT 穿透允许位于 NAT 盒后面的 VPN 服务器接受来自 NAT 盒中的、没有任何端口映射设置的 VPN 客户端的 VPN 连接。\r\n\r\n然而,基于 NAT 穿透的 VPN 会话有时会变得不稳定,因为 NAT 穿透使用的是基于 UDP 的协议。例如,如果在 VPN 服务器和 VPN 客户端之间有一个不好的 NAT 盒子, VPN 隧道每 5 分钟断开一次。一些大规模 NAT 网关使用便宜的互联网服务供应商,有时会造成 NAT 穿透的同样问题。这是路由器或互联网服务供应商的问题。这不是 SoftEther VPN 软件的问题。\r\n\r\n为了解决这个不稳定的隧道问题,您应该直接连接到 VPN 服务器的 TCP 监听端口,而不是使用 NAT 穿透功能。要使用 TCP 直接连接到 VPN 服务器, VPN 服务器的监听端口必须通过在 NAT 盒的端口映射设置暴露到互联网上。请询问 NAT 盒的管理员或参阅 NAT 盒的手册在 NAT 盒上添加端口映射设置。\r\n\r\n如果此消息仍是 VPN 服务器暴露了一个 TCP 端口到互联网后,检查 VPN 客户端连接设置屏幕上的 "禁用 NAT-T" 复选框、而你的 VPN 客户端升级到 Build 9428 或更高版本。\r\n\r\n - - - - -#虚拟 HUB 管理选项 -HUB_AO_CLICK 选择一个项目,查看这里的描述。 -HUB_AO_UNKNOWN 该项目的描述没有被发现。请参阅文件,或从该项目的名称推测项目的意思和目的。 -HUB_AO_allow_hub_admin_change_option 这是一个特殊项目。如果你启用(设置为1)这个选项,那么不但 VPN Server 的全球管理员,而且虚拟 HUB 的管理员,都将被他自己准予修改虚拟 HUB 管理选项。 -HUB_AO_deny_hub_admin_change_ext_option 如果你启用(设置为1)这个选项,虚拟 HUB 的管理员将被禁止修改在虚拟 HUB 扩展选项上的任何值,那么只有 VPN Server 的全球管理员可以对其进行修改。 -HUB_AO_no_delay_jitter_packet_loss 如果您将此选项设置为非零值,在访问列表条目中的延迟、时基误差和数据包丢失的所有参数将被忽略,即使这些参数是在管理员添加新的访问列表条目时设置的。因此,延迟、时基误差和数据包丢失的生成函数实际中将被禁用。由于延迟生成函数有时会让 CPU 和 RAM 产生高负载量,由多个用户共享的一个虚拟 HUB 上应该启用此选项。 -HUB_AO_max_users 如果您将此选项设置为非零值,在虚拟 HUB 上用户对象注册的最大数量将被限制在这个值,那么用户对象的数量如果大于这个值则不能被添加。 -HUB_AO_max_multilogins_per_user 如果您将此选项设置为非零值,每一个单独的用户对象的 VPN 会话的最大数量将被限制在这个值,那么单独用户对象的 VPN 会话的数量如果大于这个值则不能被建立。 -HUB_AO_max_groups 如果您将此选项设置为非零值,那么在虚拟 HUB 上的组对象的最大数量将被限制在这个值,更多的组将不被允许注册。 -HUB_AO_max_accesslists 如果您将此选项设置为非零值,那么在虚拟 HUB 上的访问列表条目的最大数量将被限制在这个值,更多条目将不被允许注册。 -HUB_AO_max_sessions_client_bridge_apply 只有当该值被设置为非零值,max_sessions_client 和 max_sessions_bridge 值将被应用。 -HUB_AO_max_sessions 如果您将此选项设置为非零值,那么 VPN 会话的最大数量将被限制在这个值。 -HUB_AO_max_sessions_client 如果您将此选项设置为非零值,那么 VPN Client 会话的最大数量将被限制在这个值。没有更多的 VPN Client 会话将被允许建立。此选项只有当 max_sessions_client_bridge_apply 选项被设置为非零值时有效。 -HUB_AO_max_sessions_bridge 如果您将此选项设置为非零值,那么 VPN Bridge 会话的最大数量将被限制在这个值。没有更多的 VPN Bridge 会话将被允许建立。此选项只有当 max_sessions_client_bridge_apply 选项被设置为非零值时有效。 -HUB_AO_max_bitrates_download 如果您将此选项设置为非零值,那么在虚拟 HUB 上的所有 VPN 会话将被强制有一个安全策略设置,即“下载带宽”值被设置为这个值。这将限制每个 VPN 会话的下载通信速度。例如,如果该值设置为 1000000,然后在虚拟 HUB 上的每个 VPN 会话的下载带宽将被限制为1Mbps。 -HUB_AO_max_bitrates_upload 如果您将此选项设置为非零值,那么在虚拟 HUB 上的所有 VPN 会话将被强制有一个安全策略设置,即“下载带宽”值被设置为这个值。这将限制每个 VPN 会话的上传通信速度。例如,如果该值设置为 1000000,然后在虚拟 HUB 上的每个 VPN 会话的上传带宽将被限制为1Mbps。 -HUB_AO_deny_empty_password 如果您将此选项设置为非零值,没有用户对象能够有一个空密码。一个空密码的用户将被禁止连接 VPN 会话。 (例外:从本地的 VPN 连接将被允许,即使密码为空)。 -HUB_AO_deny_bridge 如果您将此选项设置为非零值,那么任何在网桥模式下的 VPN 会话将不会被准许建立,不管用户现有的安全策略的设置。为了桥接的目的,没有人能够连接到虚拟 HUB 。 -HUB_AO_deny_routing 如果您将此选项设置为非零值,那么任何在路由模式下的 VPN 会话将不会被准许建立,不管用户现有的安全策略的设置。为了路由的目的,没有人能够连接到虚拟 HUB 。 -HUB_AO_deny_qos 如果您将此选项设置为非零值,那么每一个 VPN 会话将被强制执行禁用 QoS 功能,不管用户现有的安全策略的设置。 -HUB_AO_deny_change_user_password 如果您将此选项设置为非零值,那么在虚拟 HUB 上的任何用户将被禁止通过 VPN Client 的密码更改功能修改其密码。 -HUB_AO_no_change_users 如果您将此选项设置为非零值,那么虚拟 HUB 的管理员将被禁止添加、编辑或删除用户。 -HUB_AO_no_change_groups 如果您将此选项设置为非零值,那么虚拟 HUB 的管理员将被禁止添加、编辑或删除组。 -HUB_AO_no_securenat 如果您将此选项设置为非零值,那么虚拟 HUB 的管理员将被禁止启用或禁用 SecureNAT 功能。 -HUB_AO_no_securenat_enablenat 如果您将此选项设置为非零值,那么虚拟 HUB 的管理员将被禁止启用或禁用在 SecureNAT 功能中的虚拟 NAT 功能。 -HUB_AO_no_securenat_enabledhcp 如果您将此选项设置为非零值,那么虚拟 HUB 的管理员将被禁止启用或禁用在 SecureNAT 功能中的虚拟 USB 功能。 -HUB_AO_no_cascade 如果您将此选项设置为非零值,那么虚拟 HUB 的管理员将被禁止添加、编辑、删除或更改级联连接的在线状态。 -HUB_AO_no_online 如果您将此选项设置为非零值,那么虚拟 HUB 的管理员将被禁止更改离线的虚拟 HUB 为在线状态。 -HUB_AO_no_offline 如果您将此选项设置为非零值,那么虚拟 HUB 的管理员将被禁止更改在线的虚拟 HUB 为离线状态。 -HUB_AO_no_change_log_config 如果您将此选项设置为非零值,那么虚拟 HUB 的管理员将被禁止更改日志功能的设置。 -HUB_AO_no_disconnect_session 如果您将此选项设置为非零值,那么虚拟 HUB 的管理员将被禁止断开一个特定的 VPN 会话。 -HUB_AO_no_delete_iptable 如果您将此选项设置为非零值,那么虚拟 HUB 的管理员将被禁止从 IP 地址表数据库中删除一个特定的 IP 地址。 -HUB_AO_no_delete_mactable 如果您将此选项设置为非零值,那么虚拟 HUB 的管理员将被禁止从 MAC 地址表数据库中删除一个特定的 MAC 地址。 -HUB_AO_no_enum_session 如果您将此选项设置为非零值,那么虚拟 HUB 的管理员将被禁止列举在虚拟 HUB 上的会话。 -HUB_AO_no_query_session 如果您将此选项设置为非零值,那么虚拟 HUB 的管理员将被禁止指定会话,并获得会话的信息。 -HUB_AO_no_change_admin_password 如果您将此选项设置为非零值,那么虚拟 HUB 的管理员将被禁止更改虚拟 HUB 的管理员密码。 -HUB_AO_no_change_log_switch_type 如果您将此选项设置为非零值,那么虚拟 HUB 的管理员将被禁止更改在虚拟 HUB 日志功能设置中的日志转换设置。 -HUB_AO_no_change_access_list 如果您将此选项设置为非零值,那么虚拟 HUB 的管理员将被禁止修改虚拟 HUB 的访问列表。 -HUB_AO_no_change_access_control_list 如果您将此选项设置为非零值,那么虚拟 HUB 的管理员将被禁止修改虚拟 HUB 的源 IP 地址限制列表。 -HUB_AO_no_change_cert_list 如果您将此选项设置为非零值,那么虚拟 HUB 的管理员将被禁止修改虚拟 HUB 的可信证书授权列表。 -HUB_AO_no_change_crl_list 如果您将此选项设置为非零值,那么虚拟 HUB 的管理员将被禁止修改虚拟 HUB 的证书取消列表。 -HUB_AO_no_read_log_file 如果您将此选项设置为非零值,那么虚拟 HUB 的管理员将被禁止远程列举或下载虚拟 HUB 的日志文件。 -HUB_AO_no_change_msg 如果您将此选项设置为非零值,那么虚拟 HUB 的管理员将被禁止更改当一个 VPN Client 连接到虚拟 HUB 时应该被显示的消息。 -HUB_AO_no_access_list_include_file 如果您将此选项设置为非零值,那么虚拟 HUB 的管理员将被禁止指定“包括:”或“排除:”指令作为在虚拟 HUB 上的访问列表条目的源或目标用户字段。 - - -# 虚拟 HUB 扩展选项 -HUB_AO_NoAddressPollingIPv4 如果您将此选项设置为非零值,那么虚拟 HUB 将不执行在 HUB 上的 IPv4 地址表和 MAC 地址表的维护,通过每 5 秒发送 ARP 数据包,以检查 IPv4 设备保持活跃状态。其结果,一个特定的期间(从 1 至 10 分钟)过去以后,在没有通信活动通过虚拟 HUB 的情况下,即使仍然活跃着,在 IPv4 地址表和 MAC 地址表中的 IPv4 设备可能会被删除。此选项可以消除大量的广播数据包,但一些 IPv4 相关的安全策略将无法有效工作。 -HUB_AO_NoAddressPollingIPv6 如果您将此选项设置为非零值,那么虚拟 HUB 将不执行在 HUB 上的 IPv6 地址表和 MAC 地址表的维护,通过每 5 秒发送 ICMPv6 数据包,以检查 IPv6 设备保持活跃状态。其结果,一个特定的期间(从 1 至 10 分钟)过去以后,在没有通信活动通过虚拟 HUB 的情况下,即使仍然活跃着,在 IPv6 地址表和 MAC 地址表中的 IPv6 设备可能会被删除。此选项可以消除大量的广播数据包,但一些 IPv6 相关的安全策略将无法有效工作。 -HUB_AO_NoIpTable 如果您将此选项设置为非零值,那么虚拟 HUB 将不会创建和维护内部 IP 地址表。此选项可以消除 CPU 和 RAM 的使用量,但一些 IP 相关的安全策略将无法有效工作。 -HUB_AO_NoMacAddressLog 如果您将此选项设置为非零值,那么这表明任何一个新的 MAC 地址注册到虚拟 HUB 上 MAC 地址表的日志,将不会被记录到安全日志中。 -HUB_AO_ManageOnlyPrivateIP 如果您将此选项设置为非零值,那么虚拟 HUB 的 IPv4 地址表将只包含私有 IPv4 地址。由于这个原因,私有 IPv4 地址是:10.0.0.0 /8,172.16.0.0/12,192.168.0.0/16 和 169.254.0.0/16。任何其他的 IPv4 地址将不会被添加到表内。 -HUB_AO_ManageOnlyLocalUnicastIPv6 如果您将此选项设置为非零值,那么虚拟 HUB 的 IPv6 地址表将只包含本地单播 IPv6 地址。由于这个原因,私有 IPv6 地址是:fe80:: / 10。任何其他的 IPv6 地址将不会被添加到表内。 -HUB_AO_DisableIPParsing 如果您将此选项设置为非零值,那么虚拟 HUB 将禁用在所有以太网数据包里的 IP 包头的内部解析函数。此选项可以消除 CPU 和 RAM 的使用量,但是虚拟 HUB 将不会执行内部 IP 地址表的建设和维护,一些 IP 相关的安全策略将无法有效工作。 -HUB_AO_YieldAfterStorePacket 如果您将此选项设置为非零值,那么在数据包的存储-转发进程后,虚拟 HUB 设置 CPU 为空闲状态。这可能导致了良好的效果,使数据包的延迟更短,但是线程关联转换的计数将增加,性能可能下降。 -HUB_AO_FilterPPPoE 如果您将此选项设置为非零值,那么虚拟 HUB 丢弃所有的 PPPoE(PPP over Ethernet)数据包。当建立两个或多个局域网之间的网桥时,方便分开每个站点的 PPPoE 网段。 -HUB_AO_FilterOSPF 如果您将此选项设置为非零值,那么虚拟 HUB 丢弃所有 OSPF (Open Shortest Path First) 数据包。 -HUB_AO_FilterIPv4 如果您将此选项设置为非零值,那么虚拟 HUB 丢弃所有的 IPv4 和 ARP 数据包。 -HUB_AO_FilterIPv6 如果您将此选项设置为非零值,那么虚拟 HUB 丢弃所有的 IPv6 数据包。 -HUB_AO_FilterNonIP 如果您将此选项设置为非零值,那么虚拟 HUB 丢弃所有非 IP 数据包(非 IPv4、ARP 或 IPv6 数据包)。顺便说一句,任何通过虚拟 HUB 的带标签的 VLAN 将被视为非IP数据包。 -HUB_AO_FilterBPDU 如果您将此选项设置为非零值,那么虚拟 HUB 丢弃所有 BPDU (Bridge Protocol Data Unit) 数据包。 -HUB_AO_NoIPv6DefaultRouterInRAWhenIPv6 如果您将此选项设置为非零值,那么虚拟 HUB 上的所有的 VPN 会话将会启用“无在IPv6 RA(物理IPv6)上的默认路由器”安全策略。当 VPN Client / VPN Bridge 和 VPN Server 之间的物理通信协议是IPv6时,任何在路由生命周期为非零值的IPv6 RA(路由器广告)数据包将设置为零值。这有效的避免了通过 VPN Client 尝试使用远端的IPv6路由器作为其本地IPv6路由器而导致的IPv6路由混乱的可怕行为。 -HUB_AO_NoLookBPDUBridgeId 如果您将此选项设置为非零值,那么虚拟 HUB 将忽略在一个 BPDU (Bridge Protocol Data Unit) 数据包里的源 MAC 地址字段。这个值是非常先进的。请不要修改它,除非你是超特殊的计算机网络专家。 -HUB_AO_NoManageVlanId 如果您将此选项设置为非零值,那么虚拟 HUB 将不会使用在 MAC 地址表中的 VLAN ID。任何有标签的VLAN数据包中的 VLAN ID 将被忽略。 -HUB_AO_VlanTypeId 以十进制指定的 VLAN 标签的以太网类型 ID (TPID)。默认值是 33024 (十六进制 0x8100)。此值是非常先进的。请不要修改它,除非你是超特殊的计算机网络专家。 -HUB_AO_FixForDLinkBPDU 如果您将此选项设置为非零值,FixForDLinkBPDU 选项将启动。此值是非常先进的。请不要修改它,除非你是超特殊的计算机网络专家。 -HUB_AO_NoIPv4PacketLog 如果您将此选项设置为非零值,那么经过虚拟 HUB 的 IPv4 数据包将不被记录。 -HUB_AO_NoIPv6PacketLog 如果您将此选项设置为非零值,那么经过虚拟 HUB 的 IPv6 数据包将不被记录。 -HUB_AO_NoSpinLockForPacketDelay 如果您将此选项设置为非零值,当数据包延迟生成函数应用于数据包时,那么 VPN Server 将不使用自旋锁机制来模仿数据包的延迟。相反,操作系统的计时器中断将被采纳。这会降低 CPU 的时间,但产生延迟的解析度将会恶化。 -HUB_AO_BroadcastStormDetectionThreshold 指定临界值每秒检测广播风暴。当从一个特定 VPN 会话的广播数据包数量超过了这个临界值时,数据包将被视为广播风暴,会被过滤。默认值(零值)为 32。 -HUB_AO_ClientMinimumRequiredBuild 如果您将此选项设置为非零值,那么虚拟 HUB 将拒绝从版本号低于这个值的、VPN Client 的任何访问。 -HUB_AO_RequiredClientId 如果您将此选项设置为非零值,那么虚拟 HUB 将拒绝从没有嵌入“客户端ID”值在软件中的、VPN Client 的任何访问。 -HUB_AO_AdjustTcpMssValue 如果您将此选项设置为非零值,那么虚拟 HUB 将调整所有 TCP/IP 数据包的包头的 MSS(最大报文段长度)值,且不超过此值。 -HUB_AO_DisableAdjustTcpMss 如果您将此选项设置为非零值,那么虚拟 HUB 上的 MSS (最大报文段长度)选项将被禁用。即使 AdjustTcpMssValue 选项是指定的,或一个 VPN 会话是由 IPsec / L2TP / EtherIP / L2TPv3 服务器功能创建的,MSS 的调节将被禁用。 -HUB_AO_NoDhcpPacketLogOutsideHub 如果您将此选项设置为非零值,那么虚拟 HUB 将不记录非关联的 DHCP 数据包的数据包日志。“非关联 DHCP 数据包”是在虚拟 HUB 上不受任何 VPN 会话约束的 DHCP 数据包。 -HUB_AO_DisableHttpParsing 如果您将此选项设置为非零值,那么虚拟 HUB 不会在所有 HTTP 数据包进行解析 HTTP 包头。这会降低 CPU 和 RAM 的使用,但是 HTTP 访问日志将不会被记录。 -HUB_AO_DisableUdpAcceleration 如果您将此选项设置为非零值,那么所有 UDP 加速功能在虚拟 HUB 的所有 VPN 会话将被禁用。 -HUB_AO_DisableUdpFilterForLocalBridgeNic 如果您将此选项设置为非零值,那么虚拟 HUB 禁用故障预防过滤功能,来过滤可能会导致网络不稳定的 DHCP 数据包。默认情况下,本地桥接口有时会尝试从远端 DHCP 服务器获取一个 IP 地址,但是这样的行为在路由表中会无限循环。过滤功能可避免这样的问题。此选项可以禁用过滤功能。 -HUB_AO_ApplyIPv4AccessListOnArpPacket 如果您将此选项设置为非零值,那么 IPv4 访问列表条目将不仅被应用在 IPv4 数据包,而且还在 ARP 数据包。这样方便过滤不必要的、可能会带来麻烦的 ARP 数据包。 -HUB_AO_RemoveDefGwOnDhcpForLocalhost 如果您将此选项设置为非零值,当本地主机上的一个 VPN Client 连接到虚拟 HUB ,并试图从虚拟 HUB 网段的 DHCP 服务器获取一个 IP 地址,相应的 DHCP 响应数据包将被丢弃。它可以防止意想不到的数据包路由的无限循环。 -HUB_AO_SecureNAT_MaxTcpSessionsPerIp 如果您将此选项设置为非零值,那么每个 IP 状态的 TCP 连接数(不是 SYN_SENT)将被限制为此值。 -HUB_AO_SecureNAT_MaxTcpSynSentPerIp 如果您将此选项设置为非零值,那么每个 IP 状态的 TCP 连接数(是 SYN_SENT)将被限制为此值。 -HUB_AO_SecureNAT_MaxUdpSessionsPerIp 如果您将此选项设置为非零值,那么每个 IP 状态的 UDP 会话数将被限制为此值。 -HUB_AO_SecureNAT_MaxDnsSessionsPerIp 如果您将此选项设置为非零值,那么每个非 SYN_SENT 状态 IP 的 DNS 会话数将被限制为此值。 -HUB_AO_SecureNAT_MaxIcmpSessionsPerIp 如果您将此选项设置为非零值,那么每个非 SYN_SENT 状态 IP 的 ICMP 会话数将被限制为此值。 -HUB_AO_AccessListIncludeFileCacheLifetime 指定以秒为周期保存外部用户列表文件的缓存,此文件是以“include:”或“exclude:”格式作为它的用户名的、访问列表条目。 -HUB_AO_DisableKernelModeSecureNAT 如果您将此选项设置为非零值,那么在 SecureNAT 功能上的内核模式 NAT 功能将被禁用。内核模式 NAT 是加速SecureNAT 虚拟 NAT 功能表现的一个功能。内核模式 NAT 只有当 VPN 服务器进程以系统权限(即根,系统或管理员情况下)正在运行时,可以工作。如果内核模式 NAT 引起一些错误的操作,使用此选项来禁用它。 -HUB_AO_DisableUserModeSecureNAT 如果您将此选项设置为非零值,那么在 SecureNAT 功能上的用户模式 NAT 功能将被禁用。用户模式 NAT 是一个使 NAT 可以作为普通用户权限运行的功能。 -HUB_AO_DisableCheckMacOnLocalBridge 如果您将此选项设置为非零值,那么 MAC 地址重复检查在本地桥功能上将被禁用。一些网络适配器有反射传出的数据包向虚拟 HUB 的问题。虚拟 HUB 自动检测这样的重复,并丢弃它们。启用此标志来禁用检测,并丢弃。 -HUB_AO_DisableCorrectIpOffloadChecksum 如果您将此选项设置为非零值,那么在本地桥功能上检查和纠正 IP 校验和值。有些有 IP、TCP 或 UDP 包头的校验和卸载引擎的网络适配器,以不完整的校验和值传输数据包。这样的数据包不能被接收端正确对待。所以本地桥检测到这样的数据包,并纠正了它的校验和字段。启用此标志来禁用这种纠正。 -HUB_AO_BroadcastLimiterStrictMode If you set this option to non-zero value, then the broadcast-storm detection algorithm will compare either source or destination IP address of each packet. If any of the two fields matches, the packet will be recorded on the short-term history of broadcast-storm detection state machine. -HUB_AO_MaxLoggedPacketsPerMinute Maximum number of logging target packets per minute. -HUB_AO_DoNotSaveHeavySecurityLogs Do not take heavy security log. -HUB_AO_DropBroadcastsInPrivacyFilterMode Drop broadcasting packets if the both source and destination session is PrivacyFilter mode. -HUB_AO_DropArpInPrivacyFilterMode Drop ARP packets if the both source and destination session is PrivacyFilter mode. -HUB_AO_SuppressClientUpdateNotification Suppress the update notification screen on the VPN Client. -HUB_AO_FloodingSendQueueBufferQuota Specify the quota limitation value (in bytes) of the sending queue buffer size which the flooding operation on the Virtual Hub can consume. The quota value is applied on the total length of sending queues of all active VPN sessions. Specify '0' to disable the quota. This option is effective to solve the out-of-memory problem on the network where there are many flooding packets. -HUB_AO_AssignVLanIdByRadiusAttribute Enable the VLAN ID dynamic assignment function. Each VPN session will be assigned its own VLAN ID by the RADIUS attribute value when the user is authenticated by the external RADIUS server unless the user object has a VLAN ID security policy. The RADIUS attribute with the name "Tunnel-Pvt-Group-ID" (ID = 81) will be used as the VLAN ID. The data type must be STRING. -HUB_AO_DenyAllRadiusLoginWithNoVlanAssign If you set this option to non-zero value, then all users, which RADIUS server returns no "Tunnel-Pvt-Group-ID" (ID = 81) value, will be denied to connect to the Virtual Hub. (Only if the values of AssignVLanIdByRadiusAttribute is non-zero value.) -HUB_AO_SecureNAT_RandomizeAssignIp If you set this option to non-zero value, then the Virtual DHCP Server of the SecureNAT function will choose an unused IP address randomly from the DHCP pool while the default behavior is to choose the first unused IP address. -HUB_AO_DetectDormantSessionInterval If you set this option to non-zero value, then the Virtual Hub will treat the VPN sessions, which have transmitted no packets for the last specified intervals (in seconds), as Dormant Sessions. The Virtual Hub will not flood packets, which should be flood, to any Dormant Sessions. -HUB_AO_NoPhysicalIPOnPacketLog If you set this option to non-zero value, then the physical IP addresses of VPN clients of either the source VPN session or the destination VPN session will not be recorded on the packet log file. -HUB_AO_UseHubNameAsDhcpUserClassOption If you set this option to non-zero value, then the Virtual Hub Name will be added to a DHCP request to an external DHCP server as the "User-Class" option. This allows to use separate pools of IP addresses for each Virtual Hub. (For only L2TP/IPsec and OpenVPN sessions.) -HUB_AO_UseHubNameAsRadiusNasId If you set this option to non-zero value, then the NAS-Identifier RADIUS attribute will be set to a name of the Virtual Hub. This allows to determine on RADIUS server whether access to the Virtual Hub should be granted or denied. - - - -#关于失败连接对话框 -ERRDLG_ERRMSG 错误(错误代码 %u) :\r\n\r\n%s\r\n -ERRDLG_RETRYCOUNT %u 秒后将自动进行重新连接... -ERRDLG_INFORMATION 点击“重试”,重新进行连接。 -ERRDLG_RETRY_INFO_1 你想重试吗? (%u 重试 / %u 总重试) -ERRDLG_RETRY_INFO_2 你想重试吗? (%u 重试 / 总无限重试) -ERRDLG_DISCONNECTED_MSG VPN Server "%S" 连接已被切断 -ERRDLG_DEVICE_ERROR 与 VPN Server 的连接被中断,因为虚拟网络适配器 (设备名称: %S) 已停止。\r\n\r\n错误代码 %u: %s - - -# 关于协议 -PROTO_DIRECT_TCP 直接的 TCP/IP 连接 -PROTO_HTTP_PROXY 通过 HTTP 代理服务器连接 -PROTO_SOCKS_PROXY 通过 SOCKS4 代理服务器连接 -PROTO_SOCKS5_PROXY 通过 SOCKS5 代理服务器连接 -PROTO_SSH 通过 SSH 服务器连接 -PROTO_UNKNOWN 未知协议 - - - -# 关于caps(控制字符) -CAPS_YES 是 -CAPS_NO 否 -# (标题) -CT_i_max_packet_size 最大的以太网数据包大小 -CT_i_max_hubs 最大虚拟 HUB 数 -CT_i_max_user_creation 整个 VPN Server 的最大用户数 -CT_i_max_sessions 最大总会话数 -CT_i_max_clients 最大客户端会话数 -CT_i_max_bridges 最大网桥会话数 -CT_i_max_users_per_hub 每虚拟 HUB 最大用户容量 -CT_i_max_groups_per_hub 每虚拟 HUB 最大群容量 -CT_i_max_access_lists 每虚拟 HUB 最大访问列表容量 -CT_i_max_mac_tables 每虚拟 HUB 最大 MAC 地址容量 -CT_i_max_ip_tables 每虚拟 HUB 最大 IP 地址容量 -CT_i_max_secnat_tables 每虚拟 HUB 最大 SecureNAT 容量 -CT_i_max_l3_sw 最大虚拟 3 层交换机数 -CT_i_max_l3_if 每虚拟 3 层交换机最大虚拟接口容量 -CT_i_max_l3_table 每虚拟 3 层交换机最大路由表容量 -CT_b_bridge 作为 VPN Bridge 软件工作 -CT_b_standalone 独立模式 -CT_b_cluster_controller 群集控制器模式 -CT_b_cluster_member 群集成员模式 -CT_b_vpn_client_connect 接受 VPN Client / Bridge 的连接 -CT_b_local_bridge 支持本地网桥 -CT_b_must_install_pcap 未安装数据包捕获驱动 -CT_b_tap_supported 支持 tun/tap 设备 (仅在 Linux) -CT_b_support_config_hub 支持更改虚拟 HUB 设置 -CT_b_support_securenat 支持 SecureNAT -CT_b_virtual_nat_disabled 虚拟 NAT 无效 (仅 DHCP 有效) -CT_b_support_cascade 支持级联连接 -CT_b_support_cascade_cert 支持级联连接服务器认证 -CT_b_support_config_log 支持更改保存日志设置 -CT_b_support_autodelete 支持自动删除日志文件 -CT_b_support_radius 支持外部认证服务器 -CT_b_support_config_rw 支持 Config 文件的远程读写 -CT_b_support_hub_admin_option 支持虚拟 HUB 管理选项 -CT_b_support_cascade_client_cert 支持级联连接客户证书 -CT_b_support_hide_hub 支持虚拟 HUB 枚举设定 -CT_b_support_cluster_admin 支持对所有群集模式的综合管理 -CT_b_support_cluster 支持部分群集模式的运行 -CT_b_support_cluster_controller 作为群集控制器操作 -CT_b_support_layer3 支持虚拟 3 层交换机 -CT_b_support_crl 支持虚拟 HUB 特定证书吊销列表 -CT_b_support_ac 支持特有的虚拟 HUB 源 IP 地址限制列表 -CT_b_support_read_log 支持日志文件的下载 -CT_b_support_rename_cascade 支持级联连接名的变更 -CT_b_support_license 支持许可证管理 -CT_b_support_limit_multilogin 支持对同一用户多个登录的限制 -CT_b_support_qos 支持 VoIP / QoS 功能 -CT_b_support_syslog 支持系统日志发送功能 -CT_b_cluster_hub_type_fixed 固定群集虚拟 HUB 种类 -CT_b_beta_version 测试版 (预发布版本) -CT_b_support_check_mac 支持在访问列表中指定 MAC 地址 -CT_b_support_check_tcp_state 支持检测 TCP 连接的状态过滤 -CT_b_support_network_connection_name 支持获取网络友好名称 -CT_b_support_radius_retry_interval_and_several_servers 在 RADIUS 身份验证里支持重试间隔和多个服务器 -CT_b_support_vlan 在 MAC 地址表里支持带标签的 VLAN ID -CT_b_support_hub_ext_options 支持虚拟 HUB 扩展选项 -CT_b_support_policy_ver_3 支持安全策略 3.0 版本 -CT_b_support_ipv6_acl 支持 IPv6 访问列表 -CT_b_support_ex_acl 支持访问列表延时、时基误差和数据包丢失 -CT_b_support_acl_group 支持访问列表通过组名调节 -CT_b_support_ipv6_ac 支持 IPv6 IP 访问控制列表 -CT_b_support_eth_vlan 支持带标记的 VLAN 数据包透明支持工具 -CT_b_support_msg 支持今日消息功能 -CT_b_vpn3 支持 3.0 的功能 -CT_b_vpn4 支持 4.0 的功能 -CT_b_support_ipsec 支持 IPsec / L2TP / EtherIP / L2TPv3 服务器功能 -CT_b_support_sstp 支持 MS-SSTP VPN Server 功能 -CT_b_support_udp_acceleration 支持 UDP 加速功能 -CT_b_support_openvpn 支持 OpenVPN Server 功能 -CT_b_support_ddns 支持动态 DNS 客户端功能 -CT_b_support_ddns_proxy 支持 DDNS 通过代理服务器 -CT_b_support_special_listener 支持 VPN over ICMP 和 VPN over DNS -CT_b_support_redirect_url_acl 支持访问列表 HTTP URL 改道 -CT_b_is_in_vm 虚拟机上运行 -CT_b_support_azure 支持 VPN Azure -CT_b_support_aes_ni 支持 CPU AES 加密加速功能 (AES-NI) -CT_b_using_selow_driver 支持 SoftEther Lightweight Kernel-mode Ethernet Driver -CT_b_support_vgs 支持 VPN Gate 服务的服务器功能 -CT_b_support_vgs_in_client VPN Gate 服务的服务器功能 (VPN 客户端集成) -CT_b_is_softether SoftEther VPN 的免费或开源版 -CT_b_suppport_push_route 静态路由表推送功能 -CT_b_suppport_push_route_config 静态路由表推送功能 (可配置) - - -#相关策略 -POL_TITLE_STR 策略名 -POL_VALUE_STR 现在值 -POL_TYPE_BOOL 开 / 关 -POL_TYPE_INT 整数 -POL_BOOL_ENABLE 有效 -POL_BOOL_DISABLE - -POL_BOOL_DISABLE_EX - -POL_INT_ZERO - -POL_INT_COUNT %u 个 -POL_INT_SEC %u 秒 -POL_INT_BPS %u bps -POL_INT_VLAN %u - -# Ver 2.0 -POL_0 允许访问 -POL_EX_0 用户定义的这项策略的权限,使 VPN 连接到 VPN Server。 -POL_1 DHCP 数据包过滤器 (IPv4) -POL_EX_1 此策略定义的所有会话中的 IPv4 的 DHCP 数据包将被过滤。 -POL_2 禁止 DHCP 服务器运行 (IPv4) -POL_EX_2 连接到有此策略设置的会话的计算机,将无法成为 DHCP 服务器,也无法对 DHCP 用户分配 IPv4 / DNS 信息。 -POL_3 强制 DHCP 分配 IP 地址 (IPv4) -POL_EX_3 有此策略设置的会话的计算机,只能使用虚拟网络侧的 DHCP 服务器提供的 IPv4 地址。 -POL_4 拒绝网桥运行 -POL_EX_4 网桥模式的连接被有此策略设置的用户会话拒绝。即使当以太网网桥在客户端被配置的情况下,通信将是不可能的。 -POL_5 拒绝路由操作 (IPv4) -POL_EX_5 有此策略设置的会话将拒绝 IPv4 路由。即便 IP 路由器运行在客户端,通讯仍将无法建立。 -POL_6 拒绝 MAC 地址复制 -POL_EX_6 有此策略设置的会话无法使用正在被不同会话的计算机占用的重复 MAC 地址。 -POL_7 拒绝 IP 地址复制 (IPv4) -POL_EX_7 有此策略设置的会话无法使用正在被不同会话的计算机占用的重复 IPv4 地址。 -POL_8 拒绝非的 ARP / 非 DHCP / 非 ICMPv6 广播 -POL_EX_8 有此策略设置的会话不允许在虚拟网络上有 ARP 协议,DHCP 协议、ICMPv6 协议广播数据包的发送和接收 -POL_9 隐私过滤器模式 -POL_EX_9 有隐私过滤器模式策略设置的会话间的全部通信将被过滤。 -POL_10 拒绝作为 TCP/IP 服务器运行 (IPv4) -POL_EX_10 有此会话策略设置的计算机无法收听和接受 IPv4 TCP/IP 连接。 -POL_11 无限制的广播数量 -POL_EX_11 有此会话策略设置的计算机,如果在虚拟网络上发送超过一般情况的广播数据包量,系统将不做自动限制。 -POL_12 允许监测模式 -POL_EX_12 有此策略设置的用户允许连接到监测模式下的虚拟 HUB 上。监测模式下的会话可以监听(tap)所有流经此虚拟 HUB 的数据包。 -POL_13 最大的 TCP 连接数 -POL_EX_13 对有此策略设置的会话,它设置了物理 TCP 连接的最大数目,包括在一个物理 VPN 会话中。 -POL_14 超时期限 -POL_EX_14 对有此策略设置的会话,当 VPN Server 和 VPN Client 之间发生通信问题时,此设置在中断一个会话前等待超时期限 (以秒为单位)。 -POL_15 最大 MAC 地址数 -POL_EX_15 对有此策略设置的会话,设置每会话最大 MAC 地址数。 -POL_16 最大 IP 地址数 (IPv4) -POL_EX_16 对有此策略设置的会话,指定单个会话可注册的 IPv4 地址数。 -POL_17 上传带宽 -POL_EX_17 对有此策略设置的会话,限制虚拟路由器上由外至内的数据流量带宽。 -POL_18 下载带宽 -POL_EX_18 对有此策略设置的会话,限制虚拟路由器上由内至外的数据流量带宽。 -POL_19 拒绝更改密码 -POL_EX_19 有此密码验证策略设置的用户将无法在 VPN Client 管理器上进行密码的更换。 -POL_20 最大多重登录数 -POL_EX_20 有此策略设置的用户无法进行多于设置数的并发登录数。 网桥模式会话不适用于此策略。此安全策略仅在 VPN Server 3.0 或以上版本,或具有多重登录限制功能的 VPN Server 2.0 版上有效。 -POL_21 禁止 VoIP / QoS 功能 -POL_EX_21 有此策略设置的用户,无法在 VPN 连接会话中使用VoIP / QoS功能。此安全策略仅在 VPN Server 3.0 或以上版本,或具有 VoIP / QoS 功能的 VPN Server 2.0 版上有效。 - -# ----- 不完全翻訳ここから ----- -# Ver 3.0 -POL_22 过滤 RS/RA 数据包(IPv6) -POL_EX_22 此策略定义的会话中消息类型为 133(路由器请求)或 134(路由器通告)的所有 ICMPv6 数据包将被过滤。因此,IPv6 客户端将无法使用 IPv6 地址前缀自动检测和 IPv6 默认网关自动检测。 -POL_23 过滤 RA 数据包(IPv6) -POL_EX_23 此策略定义的会话中消息类型为 134(路由器通告)的所有 ICMPv6 数据包将被过滤。因此,恶意用户将不能在网络中传播非法的 IPv6 地址前缀或默认网关广告。 -POL_24 过滤 DHCP 数据包(IPv6) -POL_EX_24 此策略定义的所有会话中的 IPv6 的 DHCP 数据包将被过滤。 -POL_25 不允许 DHCP 服务器运行(IPv6) -POL_EX_25 连接到有此策略设置的会话的计算机将不允许成为 DHCP 服务器,也无法对 DHCP 用户分配 IPv6 地址 / DNS 信息。 -POL_26 拒绝路由操作 (IPv6) -POL_EX_26 有此策略设置的会话将拒绝 IPv6 路由。即便 IP 路由器运行在客户端,通讯仍将无法建立。 -POL_27 拒绝 IP 地址复制 (IPv6) -POL_EX_27 有此策略设置的会话无法使用正在被不同会话的计算机占用的复制的 IPv6 地址。 -POL_28 拒绝作为 TCP/IP 服务器运行 (IPv6) -POL_EX_28 有此策略设置会话的计算机不能收听或接受 IPv6 TCP/IP连接。 -POL_29 最大 IP 地址数 (IPv6) -POL_EX_29 对有此策略设置的会话,指定单个会话可注册的 IPv6 地址数。 -POL_30 VPN Client 不接受密码保存 -POL_EX_30 对有此策略设置的用户,用户在客户端将不再能够保存密码。用户每次连接 VPN 时均需要输入密码。这将提高安全性。如果启用此策略, VPN Client 2.0 版本将被拒绝连接。 -POL_31 VPN Client 自动断开 -POL_EX_31 对有此策略设置的用户,在特定的一段时间过去后,用户的 VPN 会话将被自动断开。这种情况下将不执行自动重新连接。这将防止大量不活跃的 VPN 会话。如果启用此策略, VPN Client 2.0 版将被拒绝连接。 -POL_32 过滤所有 IPv4 数据包 -POL_EX_32 对定义此策略会话的所有 IPv4 和 ARP 据包将被过滤。 -POL_33 过滤所有 IPv6 数据包 -POL_EX_33 对定义此策略会话的所有 IPv6 数据包将被拦截。 -POL_34 过滤所有非 IP 数据包 -POL_EX_34 对定义此策略的所有非 IP 数据包将被过滤。“非 IP 数据包”意思是不是IPv4, ARP, 也不是 IPv6 的数据包。所有通过虚拟 HUB 的带标签的 VLAN 数据包将被认为是非 IP 数据包。 -POL_35 在 IPv6 RA 上的非默认路由器 -POL_EX_35 对定义此策略的所有 VPN 会话中,任何 IPv6 RA(路由器通告)路由器的寿命为非零值的数据包将设置为零值。这可以有效避免 VPN Client 尝试使用远端的 IPv6 路由器作为其本地 IPv6 路由器而造成 IPv6 路由混乱的可怕行为。 -POL_36 在 IPv6 RA 无默认路由器(物理 IPv6) -POL_EX_36 对定义此策略的所有 VPN 会话(只有当 VPN Client / VPN Bridge 和 VPN Server 之间的物理通信协议是 IPv6 时),任何 IPv6 RA(路由器通告)路由器的寿命为非零值的数据包将设置为零值。这可以有效避免 VPN Client 尝试使用远端的 IPv6 路由器作为其本地 IPv6 路由器而造成 IPv6 路由混乱的可怕行为。 -POL_37 VLAN ID (IEEE802.1Q) -POL_EX_37 您可以指定 VLAN ID 的安全策略。所有的 VPN 会话定义了此策略,所有从用户到虚拟 HUB 的以太网数据包将被插入一个带 VLAN ID 的 VLAN 标签(IEEE 802.1Q)。用户还可以收到具有相同的 VLAN ID 的 VLAN 标签的数据包。(接收过程会自动删除 VLAN 标签)。带有任何其他 VLAN ID 或非 VLAN 数据包的以太网数据包将不会收到。所有没有这个策略定义的 VPN 会话可以发送/接收任何类型的以太网数据包,不管 VLAN 标签,VLAN标签也不会被自动插入或删除。通过虚拟 HUB 的任何带标签的 VLAN 数据包将被视为非 IP 数据包。因此,带标签的 VLAN 数据包不受制于 IPv4/IPv6 安全策略,访问列表也不受其他 IPv4/IPv6 特定的深入处理。 -# ----- 不完全翻訳ここまで ----- - - -# 关于远程连接对话框 -REMOTE_DEF_CAPTION 远程连接 -REMOTE_DEF_TITLE 指定你要进行远程连接的计算机。 - - -#关于客户通知服务 -CN_TITLE SoftEther VPN Client Developer Edition - - -# 关于连接管理器 -CM_TITLE SoftEther VPN Client Developer Edition 管理器 -CM_PW_LOCALMACHINE 本地计算机 -CM_NO_REMOTE VPN Client 服务运行在 %s 上,不允许远程连接。 -CM_CONNECT_FAILED 无法连接到 %s 上的 VPN Client 服务。\r\n确认 VPN 服务已开启并正常运行。 -CM_BAD_PASSWORD 密码错误。请重新输入密码。密码大小写敏感。 -CM_NUM_CONN_COUNT VPN 连接中: %u 账户 -CM_CONN_NO 未连接 -CM_PRODUCT_NAME SoftEther VPN Client Build %u -CM_ACCOUNT_COLUMN_1 VPN 连接设置名称 -CM_ACCOUNT_COLUMN_2 状态 -CM_ACCOUNT_COLUMN_3 VPN Server 主机名(地址) -CM_ACCOUNT_COLUMN_3_2 虚拟 HUB 名称 -CM_ACCOUNT_COLUMN_4 虚拟网络适配器名 -CM_VLAN_COLUMN_1 虚拟网络适配器名 -CM_VLAN_COLUMN_2 状态 -CM_VLAN_COLUMN_3 MAC 地址 -CM_VLAN_COLUMN_4 版本 -CM_ACCOUNT_OFFLINE 离线 -CM_ACCOUNT_ONLINE 已连接 -CM_ACCOUNT_CONNECTING 连接中 -CM_VLAN_ENABLED 已启用 -CM_VLAN_DISABLED 已禁用 -CM_DELETE_ACCOUNT_MSG VPN 连接设置 "%s" 将删除,你确定吗? -CM_ST_ACCOUNT_NAME VPN 连接设置名称 -CM_ST_CONNECTED 会话状态 -CM_ST_CONNECTED_TRUE 连接完成 (会话建立) -CM_ST_CONNECTED_FALSE 尝试连接 -CM_ST_CONNECTING 开始连接 VPN 服务器 -CM_ST_NEGOTIATION 协商中 -CM_ST_AUTH 验证用户身份 -CM_ST_ESTABLISHED 连接已建立 -CM_ST_RETRY 重试 -CM_ST_IDLE 空闲状态 -CM_ST_SERVER_NAME 服务器名 -CM_ST_SERVER_PORT 端口号 -CM_ST_PORT_TCP TCP 端口 %u -CM_ST_SERVER_P_NAME 服务端产品名称 -CM_ST_SERVER_P_VER 服务端版本 -CM_ST_SERVER_P_BUILD 服务端内部标号 -CM_ST_START_TIME 连接开始时间 -CM_ST_FIRST_ESTAB_TIME 首次会话建立时间 -CM_ST_NONE - -CM_ST_CURR_ESTAB_TIME 当前会话建立时间 -CM_ST_NUM_ESTABLISHED 已建立的会话数 -CM_ST_NUM_STR %u 次 -CM_ST_HALF_CONNECTION 半双工 TCP 连接模式 -CM_ST_HALF_TRUE 是 (半双工模式) -CM_ST_HALF_FALSE 否 (全双工模式) -CM_ST_QOS VoIP / QoS 功能 -CM_ST_QOS_TRUE 已启用 -CM_ST_QOS_FALSE 已禁用 -CM_ST_NUM_TCP TCP 连接数 -CM_ST_NUM_TCP_UPLOAD 上行传输 TCP 连接数 -CM_ST_NUM_TCP_DOWNLOAD 下行传输 TCP 连接数 -CM_ST_MAX_TCP TCP 连接数最大值 -CM_ST_VLAN_ID VLAN ID -CM_ST_NO_VLAN - -CM_ST_USE_ENCRYPT 加密 -CM_ST_USE_ENCRYPT_TRUE 已启用 (算法: %S) -CM_ST_USE_ENCRYPT_TRUE2 已启用 -CM_ST_USE_ENCRYPT_FALSE 已禁用 (不加密) -CM_ST_USE_COMPRESS 使用压缩 -CM_ST_UDP_ACCEL_ENABLED 支持 UDP 加速 -CM_ST_UDP_ACCEL_USING UDP 加速已激活 -CM_ST_RUDP TCP over UDP (NAT 穿透) -CM_ST_UNDERLAY_PROTOCOL 物理底层协议 -CM_ST_COMPRESS_TRUE 是 (%u %%) -CM_ST_COMPRESS_FALSE 否 (不压缩) -CM_ST_SESSION_NAME 会话名 -CM_ST_CONNECTION_NAME 连接名 -CM_ST_SESSION_KEY 会话密钥 (160 位) -CM_ST_BRIDGE_MODE 网桥 / 路由模式 -CM_ST_MONITOR_MODE 监测模式 -CM_ST_YES 是 -CM_ST_NO 否 -CM_ST_SEND_SIZE 输出数据量 -CM_ST_RECV_SIZE 输入数据量 - -CM_ST_SEND_UCAST_NUM 传出单播数据包 -CM_ST_SEND_UCAST_SIZE 传出单播总量 -CM_ST_SEND_BCAST_NUM 传出广播数据包 -CM_ST_SEND_BCAST_SIZE 传出广播总量 - -CM_ST_RECV_UCAST_NUM 传入单播数据包 -CM_ST_RECV_UCAST_SIZE 传入单播总量 -CM_ST_RECV_BCAST_NUM 传入广播数据包 -CM_ST_RECV_BCAST_SIZE 传入广播总量 - -CM_ST_NUM_PACKET_STR %S 数据包 -CM_ST_SIZE_BYTE_STR %S 字节 - -CM_NEW_ICON 添加新的 VPN 连接 -CM_VGC_ICON VPN Gate 公共 VPN 中继服务器 -CM_VGC_LINK VPN Gate 学术试验 Web 网站 -CM_ST_TITLE %s 的连接状态 -CM_ST_COLUMN_1 项目 -CM_ST_COLUMN_2 状态 -CM_NEW_ACCOUNT_NAME_1 新的 VPN 连接 -CM_NEW_ACCOUNT_NAME_2 新的 VPN 连接 (%u) -CM_ACCOUNT_TITLE_1 新的 VPN 连接设置属性 -CM_ACCOUNT_TITLE_2 %s 的属性 -CM_SERVER_CERT_1 指定特定证书登录(&R) -CM_SERVER_CERT_2 指定特定证书删除(&D) -CM_CLIENT_CERT_1 指定客户端证书(&C) -CM_CLIENT_CERT_2 删除客户端证书(&C) -CM_CERT_INFO 发行对象: %s\r\n发行人: %s\r\n有效期限: %s -CM_NO_CERT 您必须指定一个客户端证书用于用户身份验证。 -CM_NO_SECURE 指定智能卡内的客户证书和个人密码,以用于用户身份验证。 -CM_CERT_SECURE_INFO 证书: "%S"\r\n密钥: "%S" -CM_SELECT_SECURE_DEVICE 选择智能卡(&P) -CM_SELECT_CERT_INCARD 指定证书及密钥(&V) -CM_VIEW_CLIENT_CERT 查看客户端证书(&V) -CM_NO_VLAN 在你创建一个新的 VPN 连接设置前,需要创建一个虚拟网络适配器。\r\n\r\n你想创建一个虚拟网络适配器吗? -CM_NO_VLAN_2 在连接到 VPN Server 前,你需要创建一个虚拟网络适配器。\r\n\r\n你想创建一个虚拟网络适配器吗? -CM_VLAN_REMOTE_ERROR 无法远程创建虚拟网络适配器。\r\n请在有 VPN Client 服务的本地计算机上启动 VPN Client 管理器,安装虚拟网络适配器。 -CM_9X_VLAN_INSTALL 一个新的虚拟网络适配器现在将被创建。\r\n\r\n创建虚拟网络适配器后,需要重新启动 Windows 系统。\n在虚拟网络适配器安装进行中,可能会要求你插入 Windows CD-ROM 安装盘。关闭除 VPN Client 管理器程序以外的当前所有的运行程序,准备好 Windows 安装盘,单击“确定”。\r\n单击确定将开始虚拟网络适配器的安装。安装完成后,Windows 将自动重启。 -CM_9X_VLAN_ME_MESSAGE 虚拟网络适配器已创建。在单击“确定”后,计算机将自动重新启动。\r\n\r\n计算机重新启动后,可能会出现安装新设备向导。\r\n如果该向导出现,单击每一个屏幕上的“下一步“,直到安装完成。 -CM_9X_VLAN_UNINSTALL 若要删除虚拟网络适配器,请从网络属性中删除。 \r\n\r\n你想要显示网络属性窗口吗? -CM_PORT_1 8888 (PX-VPN 端口) -CM_PORT_2 443 (HTTPS 端口) -CM_PORT_3 992 (telnets 端口) -CM_PORT_4 5555 (SE-VPN 端口) -CM_RETRY_INTERVAL_ERROR 当 VPN 连接断开时,设置重新连接间隔(至少 5 秒)。 -CM_DELETE_CLIENT_CERT 这将删除已经设置的客户端证书。你确定要删除吗? -CM_DELETE_SERVER_CERT 这将删除已经设置的服务端特定证书。你确定要删除吗? -CM_SET_STARTUP VPN 连接设置 "%s" 当前设置为启动连接设置。\r\n当下次重新启动计算机后,账户将被自动连接。\r\n(如果你使用的是 Windows,在用户登录到 Windows 前,自动连接将在后台模式下启动。) -CM_REMOVE_STARTUP 你希望删除 VPN 设置 "%s" 的启动连接属性吗? -CM_NO_DISCONNECT_SPAN 请设置 TCP 连接的使用寿命。 -CM_HALF_MSG 当使用半双工模式时,设置的 TCP 连接数至少是2个。 -CM_TOO_SMALL_INTERVAL 设置建立一个 TCP 连接的时间间隔至少是 1 秒钟 -CM_DELETE_VLAN 这将删除虚拟网络适配器 "%s"。你确定删除吗? -CM_COPY_NAME_1 复件 %s -CM_COPY_NAME_2 复件 (%u) %s -CM_IMPORT_NAME_1 %s -CM_IMPORT_NAME_2 %s (%u) -CM_CERT_COLUMN_1 发给 -CM_CERT_COLUMN_2 发行人 -CM_CERT_COLUMN_3 有效期限 -CM_CERT_DELETE_MSG 从列表中删除此证书? -CM_PASSWORD_SET 设定的密码。 -CM_PASSWORD_REMOVE 设置的密码被删除。 -CM_UNDER_CONSTRUCTION 未完成的。 -CM_CURRENT_ACTIVE VPN 连接设置 "%s" 的设定已经保存,但这个 VPN 连接设置当前正在线,新的设置直到下一次连接才能适用。 -CM_DISCONNECT_ALL 这将断开所有的 %u 个 VPN 连接设置的当前连接。\r\n你确定要这样做吗? -CM_HTTPS_MSG 您已经选择通过 HTTP 代理服务器进行连接。\r\n\r\n平常的 HTTP 代理服务器不允许访问您所选择的 TCP 端口。\r\n当 VPN Client 通过 HTTP 代理服务器连接到 VPN Server 时,可能会通过使用 HTTPS (HTTP over SSL) 通信进行连接。\r\n在此情况下,建议您指定 443 (HTTPS 端口) 最为目标 VPN Server 的端口号。\r\n(如果您指定了一个其它端口号,可能会无法通过 HTTP 代理服务器进行连接。\r\n确定目标 VPN Server 已启用 443 端口。) \r\n\r\n如果需要详细信息,请与您计划在连接中经过的 HTTP 代理服务器的系统管理员或网络管理员联系。\r\n\r\n您是否确定改变目标 VPN Server 端口号为 443 (HTTPS 端口)? -CM_REMOTE_WARNING 您正在禁用远程管理。\r\n\r\n当前 VPN Client 管理器正连接到远程计算机 "%S" 并正在控制它的 VPN Client 服务。\r\n如果禁用远程管理,将无法继续远程连接计算机 "%S" 并通过 VPN Client 管理器对 VPN Client 服务进行控制。\r\n\r\n是否确认禁用远程管理? -CM_KEEP_INTERVAL_MSG 设置“数据包发送间隔” 为 %u 到 %u 秒。 -CM_REMOTE_TITLE 可以使用 VPN Client 管理器连接另一台计算机并远程管理它的 VPN Client 服务。\r\n(注意: 远程计算机必须允许远程管理。) -CM_DESKTOP_LOCAL_PC 本地计算机 -CM_DESKTOP_REMOTE_PC 计算机 %S -CM_DESKTOP_MSG_LOCAL_TS 终端服务 (远程桌面) 功能 -CM_DESKTOP_MSG_LOCAL_SW 切换用户功能 -CM_DESKTOP_MSG_LOCAL_1 目前,%s 安装在这台计算机上,提供了允许多用户登录的环境。在此情况下,VPN Client 显示的进展状态信息,错误信息和其它信息将被显示在“控制台会话”中。 -CM_DESKTOP_MSG_LOCAL_21 “会话 ID: 0,用户 %s”在这台计算机被分配为控制台进程。但是由于您已经在进程 %u 上开启 VPN Client 管理器,因此无法显示 VPN Client 上进度状态或错误等信息。 -CM_DESKTOP_MSG_LOCAL_22 目前这台计算机上的控制台会话“会话ID: 0”没有被登录。并且因为您在会话 %u 上启动了 VPN Client 管理器,因此无法显示 VPN Client 上进度状态或错误等信息。 -CM_DESKTOP_MSG_LOCAL_31 建议当此计算机的控制台会话 (会话ID: 0,用户 %s) 显示时,在此会话中启动 VPN Client 服务器并启动 VPN 连接设置“%s”。由此您将可以启动连接进程,但要承担无法检查进度状态或错误信息的风险。 -CM_DESKTOP_MSG_LOCAL_32 建议您先注销,然后再从本地登入。运行 VPN Client 管理器会话,并启动 VPN 连接设置“%s”。由此您将可以启动连接进程,但要承担无法检查进度状态或错误信息的风险。 -CM_DESKTOP_MSG_REMOTE_1 由于您在远程连接到计算机 %S 上的 VPN Client 时执行的动作,您将无法看到 VPN Client 显示的诸如进程状态或错误信息。 -CM_DESKTOP_MSG_REMOTE_2 要检查所有 VPN Client 显示的进程状态,错误和其他信息,您必须从计算机 %S 本地登入并显示控制会话 (桌面)。 -CM_DESKTOP_MSG_REMOTE_3 建议您直接从本地 (%S) 登入。运行 VPN Client 管理器会话,并启动 VPN 连接设置“%s”。由此您将可以启动连接进程,但要承担无法检查进度状态或错误信息的风险。 -CM_STOP_INST_VLAN_1 要想在此计算机上安装虚拟网络适配器,您必须在“控制台会话”下启动 VPN Client 管理器。\r\n\r\n目前,此计算机上已安装 %s,且用户已登入远程会话 (会话ID: %u) 而不是控制台进程。\r\n若要安装虚拟网络适配器,必须在控制台会话 (会话ID: %u,用户 %s 已登录) 下启动 VPN Client 管理器。\r\n\r\n首先使用切换用户功能从本地登入到计算机,或在远程桌面使用 “/console” 论据功能,或切换计算机的本地控制台设备,之后启动 VPN Client 管理器,并安装虚拟网络适配器。 -CM_STOP_INST_VLAN_2 要想在此计算机上安装虚拟网络适配器,您必须在“控制台会话”下启动 VPN Client 管理器。\r\n\r\n目前,此计算机上已安装 %s,且用户已登入远程会话 (会话ID: %u) 而不是控制台进程。\r\n若要安装虚拟网络适配器,必须在“控制台会话”下启动 VPN Client 管理器。\r\n(目前用户并未登入到控制台会话 (会话ID: 0)。) \r\n\r\n首先使用切换用户功能从本地登入到计算机,或在远程桌面使用 “/console” 论据功能,或切换计算机的本地控制台设备,之后启动 VPN Client 管理器,并安装虚拟网络适配器。 -CM_SHORTCUT_DESKTOP_MSG 若要使用 VPN 连接设置快捷方式启动连接,您必须在“控制台会话”下运行快捷方式文件。\r\n\r\n目前用户作为远程会话 (会话ID: %u) 登入而不是控制台会话。 -CM_HTTP_PROXY_WARNING 已选择“通过 HTTP 代理服务器连接”。\r\n\r\n一般情况下,HTTP 服务器只允许两种 TCP 端口作为连接到目标服务器的端口号: HTTP 协议 (TCP 端口号 80) 和 HTTPS 协议 (TCP 端口号 443)。\r\n(同样,也有的代理服务器提供更宽泛的 TCP 端口供连接使用。) \r\n\r\n当通过一台禁用除 HTTP 端口或 HTTPS 端口的 HTTP 代理服务器建立 VPN 连接时,您必须指定 443 (HTTPS 协议) 作为目标 VPN Server 的端口号。\r\n\r\n要检查您当前使用的 HTTP 代理服务器是否允许 80 或 443 意外的端口,请与 HTTP 代理服务器的管理员联系。\r\n\r\n目前 %d 指定为目标 VPN Server 的端口号。您是否要更改端口号为 443 (HTTPS 协议) ?\r\n(您所连接的 VPN Server 的 443 端口必须被设为监听状态并且空闲。) \r\n如果您无法确定,请与系统管理员或网络管理员联系。 -CM_HTTP_HEADER_COLUMN_0 Name -CM_HTTP_HEADER_COLUMN_1 Value -CM_PASSWORD_CHANGED 密码已更改。 -CM_ACCOUNT_SETTING_FILE VPN 连接设置文件 (*.VPN)|*.vpn|所有文件 (*.*)|*.* -CM_ACCOUNT_SAVE_TITLE 输入要导出的 VPN 连接设置文件的文件名 -CM_ACCOUNT_OPEN_TITLE 选择要导入的 VPN 连接设置文件 -CM_ACCOUNT_FILE_BANNER # VPN Client 连接设置文件\r\n# \r\n# 此文件是使用 VPN Client 管理器导出的。\r\n# 此文件内容可使用文本编辑器进行编辑。\r\n# 当此文件通过使用客户端连接管理器导入后可以立即被使用。\r\n\r\n -CM_FAILED_TO_OPEN_FILE 无法打开文件。 -CM_FAILED_TO_SAVE_FILE 无法保存文件。 -CM_ACCOUNT_PARSE_FAILED 无法从指定文件装载 VPN 连接设置。\r\n请检查文件内容。 -CM_ACCOUNT_MSG_SENSITIVE 此 VPN 连接设置有用户名和密码。\r\n您想从导出的设置文件中删除这些敏感信息吗?\r\n\r\n单击“是”以删除敏感信息。\r\n在这种情况下,当他正试图连接到 VPN Server 时,用户需要输入用户名和密码。\r\n\r\n单击“否”将敏感信息留在文件内。 -CM_SHORTCUT_FILE 快捷方式文件|*.lnk -CM_SHORTCUT_SAVE_TITLE 输入快捷方式文件名。 -CM_SHORTCUT_UNSUPPORTED 该连接的快捷方式的功能不支持此 VPN Client 的版本。\r\n更新到新版本。 -CM_SHORTCUT_COMMENT 使用 VPN 连接设置“%s”以连接到 VPN Server。 -CM_SHORTCUT_ERROR 创建快捷方式失败。 -CM_VPN_FILE_CLICKED 你要导入的 VPN 连接文件? -CM_VPN_FILE_IMPORT_NG 无法导入 VPN 连接设置文件。由于 VPN Client 设置已被锁定。 -CM_VLAN_INSTALLING 请稍候... -CM_SECURE_MUST_LOCAL 因为目前您对远程计算机进行连接并管理 VPN Client,因此无法修改智能卡设置。 -CM_DETAIL_MODE_LINK_STR 使用级联,则“通过网桥,路由模式连接”始终启用。 -CM_TRAY_INITING VPN Client 管理器 (Developer Edition) -CM_TRAY_NOT_CONNECTED VPN Client 管理器 (Developer Edition)\r\n未连接 -CM_TRAY_CONNECTED_0 VPN Client 管理器 (Developer Edition)\r\n主动连接到%u个服务器,并尝试连接到 %u 个服务器 -CM_TRAY_CONNECTED_1 VPN Client 管理器 (Developer Edition)\r\n尝试连接到%u个服务器 -CM_TRAY_CONNECTED_2 VPN Client 管理器 (Developer Edition)\r\n的 %u 个服务器中的连接 -CM_TRAY_MENU_1_SHOW 显示 VPN Client 管理器(&S) -CM_TRAY_MENU_1_HIDE 关闭 VPN Client 管理器(&O) -CM_TRAY_MENU_2_QUIT 退出 VPN Client 管理器程序(&X) -CM_TRAY_MENU_CONNECT 启动 VPN 连接(&C) -CM_TRAY_MENU_DISCONNECT 断开 VPN 连接(&D) -CM_TRAY_MENU_STATUS 查看 VPN 连接状态(&I) -CM_TRAY_MENU_DISCONNECT_ALL 断开所有的 VPN 连接(&A) -CM_TRAY_MENU_NEW 创建一个新的连接设置(&N) -CM_TRAY_MENU_RECENT 近使用的 VPN Server(&Y) -CM_TRAY_MENU_TRAFFIC 网格和通信速度测试工具(&R) -CM_TRAY_MENU_NETIF 查看网络设备的状态(&D) -CM_TRAY_MENU_ABOUT 关于 VPN Client 管理器(&A) -CM_TRAY_MENU_SETTING 变更运行模式(&M) -CM_TRAY_MENU_CANCEL 关闭此菜单 -CM_EXIT_MESSAGE 是否退出 VPN Client 管理器程序? -CM_IMPORT_MESSAGE 从文件 "%S" 安装 VPN 连接设置 "%s"。 -CM_VLAN_CREATING 创建一个新的 Windows VPN 虚拟网络适配器。\r\n\r\n这个过程可能会花费几秒或超过 1 分钟。 \r\n请稍候...\r\n\r\n(在虚拟网络适配器安装过程中,请不要执行其他操作。) -CM_SETTING_PASSWORD 该设置已被锁定。要取消这些锁定设置,您必须输入密码。 -CM_EASY_MODE_NOT_ON_REMOTE 无法连接,因为远程计算机上的 VPN Client 在简易模式下运行。 -CM_EASY_CONNECT_BUTTON_1 启动 VPN 连接 -CM_EASY_CONNECT_BUTTON_2 断开(&D) -CM_EASY_ACCOUNT_WARNING 因为设置已锁定,您只能更改“代理服务器设定”,“用户验证”和“已使用的虚拟网络适配器”。 -CM_EASY_INFO_1 选择一个 VPN 连接。 -CM_EASY_INFO_2 单击“开始 VPN 连接”启动一个 VPN 连接。 -CM_EASY_INFO_3 VPN 连接是活跃的。您可以通过点击“断开”终止连接。 -CM_EXT_VOICE_MSG 扩展语音向导的部分内容运行不正常。\r\n扩展语音向导是否打开? -CM_EASY_TITLE VPN Client 简易连接管理器 -CM_EASY_CONNECTED VPN 连接完成。 -CM_EASY_CONNECTING 建立 VPN 连接中... -CM_PROXY_FROM_IE 当前 Internet Explorer 代理设置已加载。 -CM_TRAY_ICON_RESTORE 托盘图标已被清除。\r\n\r\n要恢复该图标,请启动 VPN Client 管理器并在查看菜单点击“显示托盘图标”。 -CM_WOULDYOULOAD_IE_PROXY 目前,这台计算机的 Internet Explorer 配置使用代理服务器"%S"。\r\n您想在新的 VPN 连接设置中应用当前代理设置吗?\r\n\r\n点击“是”使用Internet Explorer 的代理设置。\r\n点击“否”使用直接连接至 VPN Server(不是代理服务器)。\r\n此设置可以在连接设置的属性窗口、在今后的任何时间进行修改。 -CM_MSG_TITLE VPN Server "%S" (虚拟 HUB: "%S") -CM_JUMPLIST_RCCONNECT 最近使用的连接设置 -CM_VPNGATE_MESSAGE 在 VPN Gate 学术项目网站上有一个公共 VPN 中继服务器列表。\r\n互联网上的任何人都可以建立 VPN 连接至任一列表上的 VPN 服务器。无需用户注册。\r\n\r\nVPN Gate 不是 SoftEther VPN 的一部分。\r\n此图标只提供了一个超链接到 http://www.vpngate.net/。\r\n\r\n安装带有 SoftEther VPN Client 的 VPN Gate Client 插件。它可用简单的配置连接到 VPN Gate 的一个公共 VPN 中继服务器。\r\n\r\n你想访问 http://www.vpngate.net/ (设在日本筑波大学) ? -CM_VLAN_REINSTALL_MSG After reinstalling the Virtual Network Adapter driver, the current Virtual Network Adapter's MAC address will change. Also, all TCP/IP settings within the Virtual Network Adapter will reset.\r\n\r\nIn case the reinstalled Virtual Network Adapter fails to work, delete it and create a new one. If it still doesn't work properly, please create a new Virtual Network Adapter with a different name. - - -# VPN Gate Service -VGC_COLUMN_0 DDNS 唯一主机名 -VGC_COLUMN_1 IP 地址 (主机名) -VGC_COLUMN_2 国家/地区 -VGC_COLUMN_3 运行时间 -VGC_COLUMN_4 VPN 会话 -VGC_COLUMN_5 线路速度 -VGC_COLUMN_6 Ping (Google, SE) -VGC_COLUMN_7 SSL-VPN (TCP) -VGC_COLUMN_8 UDP 支持 -VGC_COLUMN_9 日志策略 -VGC_COLUMN_10 累积转移 -VGC_COLUMN_11 累计用户 -VGC_COLUMN_12 操作员的名字 -VGC_COLUMN_13 操作员的消息 -VGC_COLUMN_14 总分 - -VGC_LOG_PERMANENT 永久的 -VGC_LOG_2WEEKS 两周 -VGC_LOG_NONE 无日志 - -VGC_UPTIME_MIN %u 分钟 -VGC_UPTIME_HOUR %u 小时 -VGC_UPTIME_DAY %u 天 -VGC_NUM_VPN %u 会话 -VGC_NUM_LOGIN %S 登录次数 - -VGC_UDP_AVAILABLE UDP OK - -VGC_LIST_STR_OK 在这个地球上的 %S 公共 VPN 中继服务器 ! (更新于 %S) -VGC_LIST_STR_OK_2 %S 服务器 (更新于 %S) - 服务器列表更新失败。如果再次失败,请下载最新的 VPN Gate Client。 -VGC_LIST_STR_NG 服务器列表更新失败。如果再次失败,请下载最新的 VPN Gate Client。 -VGC_PROXY_MSG 如果您使用的是代理服务器,您可能无法使用不支持 TCP 443 端口、从这样的代理委托网络、作为 "SSL-VPN 连接" 的 VPN 中继服务器。 -VGC_PROXY_TITLE 代理服务器用户的注意事项 - -VGS_NO_HUB_YET 为了设置消息,首先你得提交启用 VPN Gate 服务。在启用该服务后,重新打开此窗口,并设置消息。 - -VGC_TITLE VPN Gate 插件消息 - -VGC_VER_DIFF VPN Gate 客户端插件的版本与 SoftEther VPN 客户端相异。\r\n\r\n- 当前的 VPN Gate 插件: Build %u\r\n- 当前的 SoftEther VPN 客户端: Build %u\r\n\r\n推荐下载并安装 VPN Gate 插件 Build %u,否则可能出现通信错误或列表更新出错。VPN 服务器列表更新失败多次,请更新 VPN Gate 插件版本。\r\n\r\n最新的 VPN Gate 插件可用于 http://www.vpngate.net/。\r\n(如果您无法直接访问上述网站,请使用镜像站点。)\r\n\r\n)\r\n\r\n - -VGS_STOP VPN Gate 服务将在您点击 确定 按钮后停止。\r\n\r\n在 VPN Gate 服务被停止后,这台计算机将不会接受新的 VPN 连接请求,但是,仍然活跃的 VPN 会话可能会残留。\r\n (这类 VPN 会话有时在枚举中不可见。) \r\n\r\n要想彻底终止所有仍然活跃的 VPN 会话,重启 SoftEther VPN Server 或者 SoftEther VPN Client 服务,或者重新启动这台计算机。 - -VGS_START This will activate the VPN Gate Relay Service function.\r\n\r\nVPN Gate Relay Service function must be activated by your own risk.\r\nSome countries prohibit using of encrypted VPN by laws.\r\nFor more details about VPN Gate Relay Service please visit http://www.vpngate.net/en/join.aspx.\r\n\r\nThe VPN Gate Academic Experiment Service is operated as a research project at the graduate school on University of Tsukuba, Japan. The service is governed under the Japanese laws. Other countries' laws are none of our concerns nor responsibilities.\r\n\r\nBy nature, there are almost 200 countries in the World, with different laws. It is impossible to verify every countries' laws and regulations and make the software comply with all countries' laws in advance to release the software. If a user uses VPN Gate service in a specific country, and damaged by public servants of the authority, the developer of either the service or software will never be liable to recover or compensate such damages or criminal responsibilities.\r\nBy using this software and service, the user must observe all concerned laws and rules with user's own responsibility. The user will be completely liable to any damages and responsibilities which are results of using this software and service, regardless of either inside or outside of Japan's territory.\r\nIf you don't agree nor understand the above warnings, do not use any of VPN Gate Academic Experiment Service functions. - - - -#关于服务 (Win32) -SVC_HELP “%s (%S) 的命令行参数”\r\n\r\n此程序 (%s) 是一个后台任务运行进程。通过指定以下命令行参数启动程序。\r\n\r\n\r\n/install …… 在 Windows 安装 %s 服务 (服务名: %S)。之后服务自动启动。\r\n\r\n/uninstall …… 从 Windows 卸载 %s 服务 (服务名: %S)。\r\n\r\n/start …… 启动 %s 服务 (服务名: %S)。\r\n\r\n/stop …… 停止 %s 服务 (服务名: %S)。\r\n\r\n/test …… 启动 %s 程序的测试模式。(调试用) \r\n\r\n/usermode … 启动 %s 程序的用户模式。(如果可用)\r\n\r\n/usermode_showtray …… 用户模式下启动时,显示任务栏图标。(若之前设为隐藏)\r\n\r\n/usermode_hidetray …… 用户模式下启动时,隐藏任务栏图标。\r\n\r\n\r\n注意: 除 /test 和 /usermode 之外的命令仅在 Windows NT / 2000 / XP / Server 2003 / Vista / Server 2008 / 7 / Server 2008 R2 下有效。 -SVC_NT_ONLY 命令相关的服务仅在 Windows NT / 2000 / XP / Server 2003 / Vista / Server 2008 / 7 / Server 2008 R2 下有效。\r\nWindows 98 / Me下无效。 -SVC_ALREADY_INSTALLED "%s" 服务 (服务名: %S) 已经安装在这台计算机上。你想卸载并重新安装吗? -SVC_INSTALL_OK "%s" 服务 (服务名: %S) 已成功安装完毕。\r\n\r\n(执行路径: %s)\r\n\r\n服务启动完成。 -SVC_INSTALL_FAILED "%s" 服务 (服务名: %S) 安装失败 -SVC_INSTALL_FAILED_2 "%s" 服务 (服务名: %S) 已成功安装完毕。\r\n\r\n(执行路径: %s)\r\n\r\n尝试启动失败。 -SVC_NOT_INSTALLED "%s" 服务 (服务名: %S) 没有安装在此计算机上。请使用命令行参数 /install 进行安装。 -SVC_START_OK "%s" 服务 (服务名: %S) 成功启动。 -SVC_START_FAILED "%s" 服务 (服务名: %S) 无法启动。 -SVR_ALREADY_START "%s" 服务 (服务名: %S) 已启动。 -SVC_STOP_OK "%s" 服务 (服务名: %S) 被停止。 -SVC_STOP_FAILED 停止 "%s" 服务 (服务名: %S) 失败。 -SVC_ALREADY_STOP "%s" 服务 (服务名: %S) 已被停止。 -SVC_UNINSTALL_OK "%s" 服务 (服务名: %S) 已卸载。 -SVC_UNINSTALL_FAILED "%s" 服务 (服务名: %S) 无法卸载。 -SVC_NOT_FOUND 字符串表中找不到服务 %S 的信息。 -SVC_NOT_ADMIN 要安装 / 卸载 / 启动 / 停止服务,您必须在此计算机上有管理员权限。\r\n\r\n如果您在此计算机上有管理员账户,请登出后作为管理员再登入。\r\n如果您不了解管理员账户,请与系统管理员联系。 -SVC_TEST_MSG 服务 "%s" 在测试模式下启动。\r\n\r\n单击“确定”退出服务。 -SVC_TRAY_TOOLTIP %S (用户模式) -SVC_TEST_MUTEX 可执行文件 %s 已经运行。 -SVC_USERMODE_MUTEX %s 的另一个进程已经运行。 -SVC_SERVICE_MUTEX 由于服务 %S 有已启动的进程 %s,因此服务无法启动 -SVC_USERMODE_MENU_1 隐藏任务栏图标(&H) -SVC_USERMODE_MENU_2 退出 %s (&X) -SVC_HIDE_TRAY_MSG 启动 %S 用户模式时将隐藏任务栏图标。\r\n从下次 %S 启动开始,图标将不会在任务栏显示。\r\n退出进程的菜单也将被隐藏。\r\n\r\n如果要在 Windows98 / Me 下退出进程,使用 Ctrl + Alt + Del 组合键然后选择结束进程。\r\n当使用其他操作系统,请使用任务管理器。\r\n\r\n要再次显示任务栏图标,在用户模式下次启动时,使用 /usermode_showtray 选项。 - - -#关于服务 (UNIX) -UNIX_SVC_HELP %S service program\nCopyright (c) all contributors on SoftEther VPN project in GitHub.\nCopyright (c) Daiyuu Nobori, SoftEther Project at University of Tsukuba, and SoftEther Corporation.\nAll Rights Reserved.\n\n%S command usage:\n %S start - Start the %S service.\n %S stop - Stop the %S service if the service has been already started.\n\n -UNIX_SVC_STARTED The %S service has been started.\n -UNIX_SVC_STOPPING Stopping the %S service ...\n -UNIX_SVC_STOPPED %S service has been stopped.\n -UNIX_SVC_STOP_FAILED Stopping %S service was failed.\n -UNIX_SVC_ALREADY_START %S service has been already started.\nRun the "%S stop" command to stop this service.\n -UNIX_SVC_NOT_STARTED %S service has not yet been started.\nRun the "%S start" to start this service.\n -UNIX_SVC_ERROR_FORK Failed to create child process for the %S service.\n -UNIX_SVC_NONROOT \nWarning: The current user context is non-root. It is recommended to run the VPN service by the root user. Although the VPN service may run under non-root users, some privilege-required functions (e.g. the local bridge function) need the root privilege.\n - - -# 服务定义 (SoftEther VPN Client) -SVC_VPNCLIENT_NAME vpnclient -SVC_VPNCLIENT_TITLE SoftEther VPN Client -SVC_VPNCLIENT_DESCRIPT 它为 SoftEther VPN Client 管理虚拟网络适配器设备驱动和连接服务。当服务停止时,此计算机将无法使用 SoftEther VPN Client 连接到 SoftEther VPN Server。 - - -# 服务定义 (SoftEther VPN Server) -SVC_VPNSERVER_NAME vpnserver -SVC_VPNSERVER_TITLE SoftEther VPN Server -SVC_VPNSERVER_DESCRIPT 它管理 SoftEther VPN Server 服务进程。SoftEther VPN Server 通过 TCP/IP 协议提供高性能 SoftEther VPN Server 功能。当此服务被停止时,此计算机上的 SoftEther VPN Client 也将停止,且 SoftEther VPN Client 将无法与此计算机建立 VPN 连接。 - - -# 服务定义 (SoftEther VPN Bridge) -SVC_VPNBRIDGE_NAME vpnbridge -SVC_VPNBRIDGE_TITLE SoftEther VPN Bridge -SVC_VPNBRIDGE_DESCRIPT 它管理 SoftEther VPN Bridge 服务进程。SoftEther VPN Bridge 提供此计算机连接的网络与远程 SoftEther VPN Server 之间的连接。当此服务被停止时,此计算机上的 SoftEther VPN Bridge 也将停止,且无法再通过网桥连接进行通信。 - - -# 服务定义 (SoftEther VPN Client) -SVC_SEVPNCLIENTDEV_NAME sevpnclientdev -SVC_SEVPNCLIENTDEV_TITLE SoftEther VPN Client Developer Edition -SVC_SEVPNCLIENTDEV_DESCRIPT 它为 SoftEther VPN Client 管理虚拟网络适配器设备驱动和连接服务。当服务停止时,此计算机将无法使用 SoftEther VPN Client 连接到 SoftEther VPN Server。 - - -# 服务定义 (SoftEther VPN Server) -SVC_SEVPNSERVERDEV_NAME sevpnserverdev -SVC_SEVPNSERVERDEV_TITLE SoftEther VPN Server Developer Edition -SVC_SEVPNSERVERDEV_DESCRIPT 它管理 SoftEther VPN Server 服务进程。SoftEther VPN Server 通过 TCP/IP 协议提供高性能 SoftEther VPN Server 功能。当此服务被停止时,此计算机上的 SoftEther VPN Client 也将停止,且 SoftEther VPN Client 将无法与此计算机建立 VPN 连接。 - - -# 服务定义 (SoftEther VPN Bridge) -SVC_SEVPNBRIDGEDEV_NAME sevpnbridgedev -SVC_SEVPNBRIDGEDEV_TITLE SoftEther VPN Bridge Developer Edition -SVC_SEVPNBRIDGEDEV_DESCRIPT 它管理 SoftEther VPN Bridge 服务进程。SoftEther VPN Bridge 提供此计算机连接的网络与远程 SoftEther VPN Server 之间的连接。当此服务被停止时,此计算机上的 SoftEther VPN Bridge 也将停止,且无法再通过网桥连接进行通信。 - - -# 服务定义 (SoftEther VPN User-mode Router) -SVC_VPNROUTER_NAME vpnrouter -SVC_VPNROUTER_TITLE SoftEther VPN Router Developer Edition -SVC_VPNROUTER_DESCRIPT 这是用来管理 SoftEther VPN 路由器(服务模式)的服务器进程。 SoftEther VPN 的路由器是一个程序,它提供了一个虚拟 NAT 和 DHCP 服务器,在用户模式下运行,通过使用简单的操作,它可以建立一个在虚拟 IP 网络和一个物理 IP 网络之间的安全连接。如果此服务被停止,在这台电脑上的 SoftEther VPN 路由器将停止, SoftEther VPN Client 将无法在这台电脑上使用路由服务。 - - -# サービス定義 (EtherLogger) -SVC_ELOGSVC_NAME elogsvc -SVC_ELOGSVC_TITLE SoftEther EtherLogger Developer Edition -SVC_ELOGSVC_DESCRIPT SoftEther EtherLogger 是一个捕捉从局域网卡连接到电脑上数据流的服务,保存由管理员指定类型的数据包的包头日志,所有数据以文本文件格式。 - - -#关于 SoftEther VPN Server 管理器 -SM_TITLE SoftEther VPN Server 管理器 Developer Edition -SM_LOCALHOST 本地主机 (此服务器) -SM_SERVER_BRIDGE_TITLE 管理 VPN Bridge "%S" -SM_S_VHUB_BRIDGE 当使用 VPN Bridge 时,管理虚拟 HUB“BRIDGE”运行 VPN Bridge 的管理。 -SM_DISCONNECTED 管理连接已断开。 -SM_MIKAN 未完成。 -SM_MAIN_COLUMN_1 设置名称 -SM_MAIN_COLUMN_2 VPN Server 主机名(地址) -SM_MAIN_COLUMN_3 操作模式 -SM_MODE_SERVER 整个 VPN Server -SM_MODE_HUB %S -SM_EDIT_CAPTION_1 新的连接设置 -SM_EDIT_CAPTION_2 %s 的编辑 -SM_SETTING_EXISTS 与连接设置 "%s" 同名的连接设置已经注册。请指定一个不同的名称。 -SM_SETTING_DELETE_MSG 是否确定删除连接设置 "%s"? -SM_PASSWORD_TYPE_STR 管理连接用密码 -SM_HUB_COLUMN_1 虚拟 HUB 名 -SM_HUB_COLUMN_2 状态 -SM_HUB_COLUMN_3 类型 -SM_HUB_COLUMN_4 用户 -SM_HUB_COLUMN_5 组 -SM_HUB_COLUMN_6 会话 -SM_HUB_COLUMN_7 MAC 表 -SM_HUB_COLUMN_8 IP 表 -SM_HUB_COLUMN_9 登录次数 -SM_HUB_COLUMN_10 最后登录时间 -SM_HUB_COLUMN_11 最后通信时间 -SM_HUB_ONLINE 在线 -SM_HUB_OFFLINE 离线 -SM_HUB_STANDALONE 独立 -SM_HUB_STATIC 静态虚拟 HUB -SM_HUB_DYNAMIC 动态虚拟 HUB -SM_SERVER_STANDALONE 独立服务器 -SM_FARM_CONTROLLER 群集控制器 -SM_FARM_MEMBER 群集成员服务器 -SM_INFORMATION 最新信息 -SM_HUB_STATUS_CAPTION 虚拟 HUB "%s" 状态 -SM_HUB_STATUS_HUBNAME 虚拟 HUB 名称 -SM_HUB_STATUS_ONLINE 状态 -SM_HUB_TYPE 类型 -SM_HUB_NUM_SESSIONS 会话数 -SM_HUB_NUM_SESSIONS_CLIENT 会话数 (客户端) -SM_HUB_NUM_SESSIONS_BRIDGE 会话数 (网桥) -SM_HUB_NUM_ACCESSES 访问列表 -SM_HUB_NUM_USERS 用户数 -SM_HUB_NUM_GROUPS 组数 -SM_HUB_NUM_MAC_TABLES MAC 表数 -SM_HUB_NUM_IP_TABLES IP 表数 -SM_HUB_SECURE_NAT SecureNAT 机能 -SM_HUB_SECURE_NAT_YES 有效 -SM_HUB_SECURE_NAT_NO 无效 -SM_HUB_NUM_LOGIN 登录次数 -SM_HUB_LAST_LOGIN_TIME 最后登录时间 -SM_HUB_LAST_COMM_TIME 最后通信时间 -SM_HUB_CREATED_TIME 创建日期 -SM_STATUS_COLUMN_1 项目 -SM_STATUS_COLUMN_2 值 - -SM_ST_SEND_UCAST_NUM 发送单播数据包 -SM_ST_SEND_UCAST_SIZE 发送单播总量 -SM_ST_SEND_BCAST_NUM 发送广播数据包 -SM_ST_SEND_BCAST_SIZE 发送广播总量 - -SM_ST_RECV_UCAST_NUM 接收单播数据包 -SM_ST_RECV_UCAST_SIZE 接收单播总量 -SM_ST_RECV_BCAST_NUM 接收广播数据包 -SM_ST_RECV_BCAST_SIZE 接收广播总量 - -SM_ST_NUM_PACKET_STR %S 数据包 -SM_ST_SIZE_BYTE_STR %S 字节 - -CM_EDIT_HUB_1 新的虚拟 HUB -CM_EDIT_HUB_2 %S 的属性 - -CM_EDIT_HUB_STANDALONE 当前,服务器正以独立模式运行。而该虚拟 HUB 作为一个独立的 HUB 运行。 -CM_EDIT_HUB_TYPE_FIXED 当前,服务器正以群集模式运行。如果虚拟 HUB 处于这种模式,动态变化将无法进行。 -CM_EDIT_HUB_CREATED 一个新的虚拟 HUB "%S" 已经建立 -CM_OFFLINE_MSG 你想切换 "%s" 到离线状态?\r\n\r\n如果您切换虚拟 HUB 至离线状态,当前连接到虚拟 HUB 上的所有会话将无法连接。 -CM_DELETE_HUB_MSG 你想删除"%S"吗?\r\n\r\n如果你删除虚拟 HUB,当前连接到虚拟 HUB 的所有会话将被断开,新的会话将无法连接。\r\n这还将删除所有 HUB 设置,用户对象,组对象,证书和级联连接。\r\n\r\n一旦你将虚拟 HUB 删除,将无法恢复。\r\n你确定要删除吗? -CM_HUB_DELETED_MSG 虚拟 HUB "%S" 被删除。 -CM_LISTENER_COLUMN_1 端口号 -CM_LISTENER_COLUMN_2 状态 -CM_LISTENER_TCP_PORT TCP %u -CM_LISTENER_ONLINE 监听中 -CM_LISTENER_OFFLINE 停止中 -CM_LISTENER_ERROR 错误 -CM_DELETE_LISTENER_MSG 监听器 (TCP 端口 %u) 将删除。从现在起,将无法连接到该端口。\r\n你确定要这样做吗? -CM_STOP_LISTENER_MSG 监听器 (TCP 端口 %u) 将停止。监听器将无法连接到该端口直到重新启动静听器。\r\n\r\n你确定吗? -CM_CLOSE_BUTTON 关闭 -CM_CERT_SET_MSG 设置了新的服务器证书。\r\n\r\nIf you are using OpenVPN protocols, please mind that you may have to update the inline certificate data in the OpenVPN configuration file. -CM_SHORTCUT_DISCONNECT 已经连接到指定的目标。 \r\n\r\n你想断开吗? - - - -SM_SERVER_STATUS 服务器状态 -SM_ST_SERVER_TYPE 服务器类型 -SM_ST_NUM_TCP 活跃 TCP 插口数 -SM_ST_NUM_TCP_LOCAL 活跃 TCP 插口数 (此服务器) -SM_ST_NUM_TCP_REMOTE 活跃 TCP 插口数 (其他成员服务器) -SM_ST_NUM_HUB_TOTAL 虚拟 HUB 数 -SM_ST_NUM_HUB_STATIC 静态虚拟 HUB 数 -SM_ST_NUM_HUB_DYNAMIC 动态虚拟 HUB 数 -SM_ST_NUM_SESSION_TOTAL 会话数 -SM_ST_NUM_SESSION_LOCAL 会话数 (此服务器) -SM_ST_NUM_SESSION_REMOTE 会话数 (其他成员服务器) -SM_ST_NUM_MAC_TABLE MAC 地址表数 -SM_ST_NUM_IP_TABLE IP 地址表数 -SM_ST_NUM_USERS 用户数 -SM_ST_NUM_GROUPS 组数 -SM_ST_CLIENT_LICENSE 使用客户端连接许可证数 (此服务器) -SM_ST_BRIDGE_LICENSE 使用网桥连接许可证数 (此服务器) -SM_ST_CLIENT_LICENSE_EX 使用客户端连接许可证数 (整个群) -SM_ST_BRIDGE_LICENSE_EX 使用网桥连接许可证数 (整个群) -SM_ST_START_TIME 服务器启动时间 -SM_ST_CURRENT_TIME 当前时间 -SM_ST_CURRENT_TICK 64 位高精度逻辑系统时钟 -SM_ST_TOTAL_MEMORY 总逻辑内存空间 -SM_ST_USED_MEMORY 已用逻辑内存空间 -SM_ST_FREE_MEMORY 可用逻辑内存空间 -SM_ST_TOTAL_PHYS 总物理内存空间 -SM_ST_USED_PHYS 已用的物理内存空间 -SM_ST_FREE_PHYS 可用物理内存空间 -SM_ST_RAM_SIZE_KB %S 字节 -SM_INFO_TITLE VPN Server 版本信息 -SM_INFO_PRODUCT_NAME 产品名称 -SM_INFO_VERSION 版本 -SM_INFO_BUILD 内部标号 -SM_INFO_HOSTNAME 主机名称 -SM_OS_SYSTEM_NAME 操作系统类型 -SM_OS_PRODUCT_NAME 操作系统产品名称 -SM_OS_SERVICE_PACK 服务包 -SM_OS_SP_TAG Service Pack %u -SM_OS_VENDER_NAME 操作系统制造商 -SM_OS_VERSION 操作系统版本 -SM_OS_KERNEL_NAME 操作系统内核分类 -SM_OS_KERNEL_VERSION 操作系统内核版本 -SM_CONNECTION_TYPE_0 客户端 -SM_CONNECTION_TYPE_1 初始化中 -SM_CONNECTION_TYPE_2 登录 -SM_CONNECTION_TYPE_3 追加连接 -SM_CONNECTION_TYPE_4 群集 RPC -SM_CONNECTION_TYPE_5 管理用 RPC -SM_CONNECTION_TYPE_6 HUB 枚举 RPC -SM_CONNECTION_TYPE_7 更改密码 -SM_CONNECTION_TYPE_8 MS-SSTP 连接 -SM_CONNECTION_TYPE_9 OpenVPN 连接 -SM_CONN_COLUMN_1 连接名称 -SM_CONN_COLUMN_2 连接源 -SM_CONN_COLUMN_3 连接开始 -SM_CONN_COLUMN_4 类型 -SM_HOSTNAME_AND_PORT %S:%u -SM_CONN_DISCONNECT_MSG 连接 %s 将断开。\r\n你确定要这么做吗? -SM_CONNINFO_CAPTION 连接 %s 的信息 -SM_CONNINFO_NAME 连接名称 -SM_CONNINFO_TYPE 连接类型 -SM_CONNINFO_HOSTNAME 客户端主机名称 -SM_CONNINFO_IP 客户端 IP 地址 -SM_CONNINFO_PORT 客户端口号 (TCP) -SM_CONNINFO_TIME 连接开始 -SM_CONNINFO_SERVER_STR 服务端产品名 -SM_CONNINFO_SERVER_VER 服务端版本 -SM_CONNINFO_SERVER_BUILD 服务端内部标号 -SM_CONNINFO_CLIENT_STR 客户端产品名 -SM_CONNINFO_CLIENT_VER 客户端版本 -SM_CONNINFO_CLIENT_BUILD 客户端内部标号 -SM_FARM_REBOOT_MSG 你将要更改群集配置。\r\n\r\n当你更改群集配置时,所有当前为管理而进行的会话和连接 (包括此管理连接) 将断开,服务端程序将重新启动。\r\n当服务端用户较多的时候,重新启动需要用一分钟的时间。\r\n\r\n单击“确定”自动断开与服务器的连接。要继续管理,你需要重新连接到服务器。 -SM_FM_COLUMN_1 类型 -SM_FM_COLUMN_2 连接开始时间 -SM_FM_COLUMN_3 主机名称 -SM_FM_COLUMN_4 点 -SM_FM_COLUMN_5 会话数 -SM_FM_COLUMN_6 TCP 连接数 -SM_FM_COLUMN_7 运行 HUB 数 -SM_FM_COLUMN_8 使用客户端连接许可证 -SM_FM_COLUMN_9 使用网桥连接许可证 -SM_FM_CONTROLLER 控制器 -SM_FM_MEMBER 成员 -SM_FMINFO_TYPE 服务器类型 -SM_FMINFO_CONNECT_TIME 连接建立时间 -SM_FMINFO_IP IP 地址 -SM_FMINFO_HOSTNAME 主机名称 -SM_FMINFO_POINT 点 -SM_FMINFO_WEIGHT 性能标准比 -SM_FMINFO_NUM_PORT 公共端口数 -SM_FMINFO_PORT %u 个公共端口 (TCP/IP) -SM_FMINFO_NUM_HUB 运行虚拟 HUB 数 -SM_FMINFO_HUB %u 个虚拟 HUB -SM_FMINFO_HUB_TAG_1 %S (动态) -SM_FMINFO_HUB_TAG_2 %S (静态) -SM_FMINFO_NUM_SESSION 会话数 -SM_FMINFO_NUN_CONNECTION TCP 连接数 -SM_FMINFO_CAPTION 群集成员服务器状态 -SM_FC_STATUS_CAPTION 群集控制器连接状态 -SM_FC_IP 控制器的 IP 地址 -SM_FC_PORT 控制器的 TCP/IP 端口 -SM_FC_STATUS 连接状态 -SM_FC_ONLINE 在线 -SM_FC_OFFLINE 离线 -SM_FC_LAST_ERROR 最后发生的错误 -SM_FC_ERROR_TAG %s (错误代码: %u) -SM_FC_START_TIME 连接开始时间 -SM_FC_FIRST_TIME 第一个连接建立时间 -SM_FC_CURRENT_TIME 当前连接建立时间 -SM_FC_NUM_TRY 尝试连接数 -SM_FC_NUM_CONNECTED 成功连接数 -SM_FC_NUM_FAILED 失败的连接数 -SM_FC_NOT_CONNECTED (未连接) -SM_CHANGE_PASSWORD_1 您输入的密码不匹配。请在“确认”栏输入与“密码”栏相同的密码。 -SM_CHANGE_PASSWORD_2 您输入了一个空密码。是否继续? -SM_CHANGE_PASSWORD_3 密码已更改。 -SM_USER_COLUMN_1 用户名 -SM_USER_COLUMN_2 全名 -SM_USER_COLUMN_3 所属组 -SM_USER_COLUMN_4 描述 -SM_USER_COLUMN_5 认证方法 -SM_USER_COLUMN_6 登录回数 -SM_USER_COLUMN_7 上次登录时间 -SM_AUTHTYPE_0 匿名身份验证 -SM_AUTHTYPE_1 密码验证 -SM_AUTHTYPE_2 特定证书认证 -SM_AUTHTYPE_3 签名证书认证 -SM_AUTHTYPE_4 RADIUS 身份验证 -SM_AUTHTYPE_5 NT 域认证 -SM_NO_GROUP - -SM_USER_DELETE_MSG 这将删除用户 "%s"。您是否确认要这样做? -SM_EDIT_USER_CAPTION_1 创建新用户 -SM_EDIT_USER_CAPTION_2 用户 %S 属性 -SM_EDIT_USER_CERT_INFO 用户使用“特定证书认证”将根据是否 SSL 客户端证书与用户事先设置的证书完整匹配而被允许或拒绝连接。 -SM_EDIT_USER_POL_DLG 用户 %S 的安全策略 -SM_POLICY_DEF_CAPTION 安全策略 -SM_LIMIT_STR 指定一个在 %u 与 %u 之间的整数。 -SM_POLICY_INIT_TITLE 从左边的列表中选择一个策略项目。 -SM_USER_CREATE_OK 用户 %S 已创建。 -SM_USERINFO_CAPTION 用户 "%S" 的信息 -SM_USERINFO_NAME 用户名 -SM_USERINFO_GROUP 组名 -SM_USERINFO_CREATE 创建日期 -SM_USERINFO_UPDATE 更新日期 -SM_USERINFO_EXPIRE 有效期限 -SM_USERINFO_NUMLOGIN 登录数 -SM_GROUPLIST_NAME 组名 -SM_GROUPLIST_REALNAME 全名 -SM_GROUPLIST_NOTE 描述 -SM_GROUPLIST_NUMUSERS 用户数 -SM_EDIT_GROUP_CAPTION_1 创建新组 -SM_EDIT_GROUP_CAPTION_2 组 %S 属性 -SM_GROUP_CREATED 组 %S 已创建。 -SM_GROUP_DELETE_MSG 您是否确定删除组 "%S" ? -SM_GROUP_POLICY_CAPTION 组 %S 的安全策略 -SM_GROUP_MEMBER_STR (仅显示属于组 %S 的用户) -SM_SELECT_GROUP 选择(&S) -SM_SELECT_NO_GROUP 无(&N) -SM_SELECT_ALT_GROUP 选择一个组(&G)... -SM_ACCESS_COLUMN_0 ID -SM_ACCESS_COLUMN_1 行为 -SM_ACCESS_COLUMN_2 状态 -SM_ACCESS_COLUMN_3 优先级 -SM_ACCESS_COLUMN_4 备注 -SM_ACCESS_COLUMN_5 目录 -SM_ACCESS_COLUMN_6 唯一 ID -SM_ACCESS_PASS 通过 -SM_ACCESS_DISCARD 舍弃 -SM_ACCESS_ENABLE 有效 -SM_ACCESS_DISABLE 无效 -SM_ACCESS_PROTO_1 所有 IPv4 / IPv6 协议 -SM_ACCESS_PROTO_2 6 (TCP/IP 协议) -SM_ACCESS_PROTO_3 17 (UDP/IP 协议) -SM_ACCESS_PROTO_4 1 (ICMPv4 协议) -SM_ACCESS_PROTO_5 58 (ICMPv6 协议) -SM_ACCESS_PROTO_6 指定 IP 协议号 -SM_SELECT_USER 选择(&S) -SM_SELECT_NO 不要选择(&N) -SM_PLEASE_SELECT 选择用户。 -SM_LINK_COLUMN_1 连接设置名 -SM_LINK_COLUMN_2 状态 -SM_LINK_COLUMN_3 建立时间 -SM_LINK_COLUMN_4 目标 VPN Server -SM_LINK_COLUMN_5 目标虚拟 HUB -SM_LINK_STATUS_OFFLINE 离线 (已停止) -SM_LINK_STATUS_ERROR 错误 %u:%s -SM_LINK_STATUS_ONLINE 在线 (已建立) -SM_LINK_POLICY_GROUP 级联连接设置 -SM_LINK_POLICY_CAPTION 安全策略设置适用于级联会话 -SM_LINK_CONNECTING 连接处理中 -SM_LINK_SAVE_ONLINE 级联连接设置 "%s" 被改变,但因为级联连接当前正在线,此设置在下次连接建立前不会生效。 -SM_LINK_DELETE_MSG 是否确定删除级联连接 "%s" ? -SM_LINK_OFFLINE_MSG 目前级联 "%s" 是活跃的。是否要断开连接? -SM_LINK_STATUS_CAPTION 级联连接 "%s" 的连接状态 -SM_LOG_SWITCH_0 无切换 -SM_LOG_SWITCH_1 每秒切换 -SM_LOG_SWITCH_2 每分钟切换 -SM_LOG_SWITCH_3 每小时切换 -SM_LOG_SWITCH_4 每天切换 -SM_LOG_SWITCH_5 每月切换 -SM_SESS_DISCONNECT_MSG 是否确定断开会话 "%S" ? -SM_SESS_COLUMN_1 会话名 -SM_SESS_COLUMN_2 位置 -SM_SESS_COLUMN_3 用户名 -SM_SESS_COLUMN_4 源主机名称 -SM_SESS_COLUMN_5 TCP 连接 -SM_SESS_COLUMN_6 传输字节 -SM_SESS_COLUMN_7 传输数据包 -SM_SESS_COLUMN_8 VLAN ID -SM_SESS_NORMAL 本地会话 -SM_SESS_LOCAL 本地会话 -SM_SESS_LOCAL_2 %S 上 -SM_SESS_REMOTE %S 上 -SM_SESS_LINK 级联连接 -SM_SESS_LINK_HOSTNAME 虚拟主机 -SM_SESS_LINK_TCP 无 -SM_SESS_SNAT SecureNAT 会话 -SM_SESS_SNAT_HOSTNAME 虚拟主机 -SM_SESS_SNAT_TCP 无 -SM_SESS_BRIDGE 本地网桥会话 -SM_SESS_BRIDGE_HOSTNAME 以太网桥 -SM_SESS_LAYER3_HOSTNAME 虚拟 3 层交换机 -SM_SESS_BRIDGE_TCP 无 -SM_SESS_STATUS_CAPTION "%S" VPN 会话的状态 -SM_SESS_STATUS_USERNAME 用户名 (认证) -SM_SESS_STATUS_REALUSER 用户名 (数据库) -SM_SESS_STATUS_GROUPNAME 用户組名 -SM_CLIENT_IP 客户端 IP 地址 -SM_CLIENT_HOSTNAME 客户端名称 -SM_NODE_CLIENT_NAME 客户端产品名称 (报告的) -SM_NODE_CLIENT_VER 客户端版本 (报告的) -SM_NODE_CLIENT_BUILD 客户端内部标号 (报告的) -SM_NODE_SERVER_NAME 服务端产品名 (报告的) -SM_NODE_SERVER_VER 服务端版本 (报告的) -SM_NODE_SERVER_BUILD 服务端内部标号 (报告的) -SM_NODE_CLIENT_OS_NAME 客户端操作系统名称 (报告的) -SM_NODE_CLIENT_OS_VER 客户端操作系统版本 (报告的) -SM_NODE_CLIENT_OS_PID 客户端操作系统产品编号 (报告的) -SM_NODE_CLIENT_HOST 客户端主机名 (报告的) -SM_NODE_CLIENT_IP 客户端 IP 地址 (报告的) -SM_NODE_CLIENT_PORT 客户端端口 (报告的) -SM_NODE_SERVER_HOST 服务器主机名称 (报告的) -SM_NODE_SERVER_IP 服务器 IP 地址 (报告的) -SM_NODE_SERVER_PORT 服务器端口 (报告的) -SM_NODE_PROXY_HOSTNAME 代理主机名称 (报告的) -SM_NODE_PROXY_IP 代理 IP 地址 (报告的) -SM_NODE_PROXY_PORT 代理端口 (报告的) -SM_MAC_COLUMN_1 会话名 -SM_MAC_COLUMN_2 MAC 地址 -SM_MAC_COLUMN_3 创建时间 -SM_MAC_COLUMN_4 更新时间 -SM_MAC_COLUMN_5 位置 -SM_MAC_COLUMN_1A VLAN ID -SM_SESSION_FILTER \ (仅显示属于会话 %S 的项) -SM_IP_COLUMN_1 会话名 -SM_IP_COLUMN_2 IP 地址 -SM_IP_COLUMN_3 创建时间 -SM_IP_COLUMN_4 更新时间 -SM_IP_COLUMN_5 位置 -SM_MAC_IP_DHCP %S (DHCP) -SM_MACIP_LOCAL 在此服务器上 -SM_MACIP_SERVER %S 上 -SM_SNAT_STATUS SecureNAT 运行状态 -SM_SNAT_NUM_SESSION %u 个会话 -SM_SNAT_NUM_CLIENT %u 个客户端 -SM_SNAT_IS_KERNEL 内核模式 NAT 功能是活跃的 -SM_SNAT_IS_RAW Raw IP mode NAT 功能是活跃的 -SM_BRIDGE_TOO_OLD_VER 当前连接的 VPN Server 版本不支持本地网桥功能。\r\n请更新到最新版本。 -SM_BRIDGE_UNSUPPORTED 当前连接的 VPN Server 运行的操作系统无法使用本地网桥功能。请参阅 VPN Server 在线文档以获得支持本地网桥功能的操作系统列表。 -SM_BRIDGE_WPCAP_REMOTE 为在此 VPN Server 上使用本地网桥功能,您必须安装 WinPcap 软件。WinPcap 软件当前没有在服务器上安装。\r\n\r\n要进行 WinPcap 软件的安装,您必须在运行 VPN Server 的服务器上启动 SoftEther VPN Server 管理器,然后连接到本机 (您自己计算机的位置),打开本地网桥功能设置窗口。\r\n首先退出此管理会话,然后在此服务器上启动 SoftEther VPN Server 管理器之后,连接到本机并继续设置进程。 -SM_BRIDGE_WPCAP_ROOT 为在此 VPN Server 上使用本地网桥功能,您必须安装 WinPcap 软件。\r\n\r\n若要继续安装,您必须以管理员身份登录到此计算机上。\r\n以管理员身份登陆,然后再次启动 SoftEther VPN Server 管理器。 -SM_BRIDGE_WPCAP_INSTALL 为在此 VPN Server 上使用本地网桥功能,您必须安装 WinPcap 软件。WinPcap 软件当前没有在服务器上安装。\r\n\r\nWinPcap 是一个与 VPN Server 捆绑在一起的免费软件。\r\n\r\n请问您是否开始安装 WinPcap ? -SM_BRIDGE_WPCAP_REBOOT1 WinPcap 安装完成后,您在使用本地网桥功能之前必须重新启动计算机。\r\n\r\n在您手动重启计算机并启动 VPN Server 后,配置本地网桥功能的设置。 -SM_BRIDGE_WPCAP_REBOOT2 WinPcap 安装完成后,您在使用本地网桥功能之前必须重新启动计算机。\r\n\r\n重新启动 SoftEther VPN Server 会花费一点时间,但所有当前正连接到 VPN Server 的会话将被切断\r\n此管理会话也将被切断,所以您将需要重新连接。\r\n\r\n您是否要重启 SoftEther VPN Server 服务? -SM_BRIDGE_RESOURCE 无法加载 WinPcap 的驱动程序。 -SM_BRIDGE_COLUMN_1 编号 -SM_BRIDGE_COLUMN_2 虚拟 HUB 名称 -SM_BRIDGE_COLUMN_3 网络适配器或 tap 设备名称 -SM_BRIDGE_COLUMN_4 状态 -SM_BRIDGE_OFFLINE 离线 -SM_BRIDGE_ONLINE 运行中 -SM_BRIDGE_ERROR 错误 -SM_BRIDGE_OK 已添加本地网桥连接定义。 -SM_BRIDGE_DELETE 您确定要从虚拟 HUB "%s" 到设备 "%s" 中删除本地网桥吗? -SM_BRIDGE_DELETE_OK 本地桥被删除。 -SM_BRIDGE_INTEL 当一个网桥到物理网络适配器的新的网桥连接建立时,在某些情况下 (取决于网络适配器类型),可能无法在虚拟网络上通过网络适配器的网桥连接进行 TCP/IP 通信。\r\n(这种现象被确认发生在 Intel 和 Broadcom 网络适配器上。)\r\n\r\n\r\n如果遇到这个问题,可以通过重启 VPN Server / Bridge 运行的计算机来补救。通常情况下通信在计算机重启后可以正常进行。\r\n\r\n\r\n此外,很多无线网络适配器在混杂模式下不会响应范松数据包请求,而导致无法使用本地网桥。如果发生这种情况,请尝试使用常规有线网络适配器来代替无线网络适配器。 -SM_BRIDGE_VPN 你要连接到本地网桥 "%S"。\r\n\r\n通常情况下,网桥被建立在虚拟 HUB 与特理网卡之间。建立一个到虚拟网络适配器的本地桥是不常见的。\r\n请确保这是你的意图。\r\n\r\n你真的要继续吗? -SM_BRIDGE_INFO_1 为网桥目标选择以太网设备 (网络适配器) -SM_BRIDGE_INFO_2 输入新创建的 tap 设备的名称 -SM_CONFIG_SAVED 配置文件被保存。 -SM_CONFIG_SAVE_FAILED 无法保存配置文件。 -SM_CONFIG_OPEN_FAILED 无法打开指定的文件。 -SM_CONFIG_CONFIRM 这将在 VPN Server 应用指定的配置文件。VPN Server 将自动重启并将装载新的配置文件。当前连接到此 VPN Server 上的用户连接将被中断。此管理会话也将被切断,您将需要重新连接到服务器。\r\n\r\n您要继续吗? -SM_CONFIG_WRITE_OK 在服务端的配置文件被覆盖。 -SM_AO_COLUMN_1 项目 -SM_AO_COLUMN_2 值 -SM_TRUE_OR_FALSE 此项目设置为 0 (false) 或 1 (true)。 -SM_AO_SET_OK 虚拟 HUB 管理员选项已设定。 -SM_EXT_OPTION_SET_OK 虚拟 HUB 扩展选项已设定。 -SM_PASSWORD_MSG 目前此 VPN Server 没有设定管理员密码。建议设定密码。\r\n\r\n您是否要设定一个服务端管理员密码? -SM_L3_SW_COLUMN1 虚拟 3 层交换机名称 -SM_L3_SW_COLUMN2 运行状态 -SM_L3_SW_COLUMN3 接口数 -SM_L3_SW_COLUMN4 路由表数 -SM_L3_SW_ST_F_F 停止 -SM_L3_SW_ST_T_F 启动 (错误) -SM_L3_SW_ST_T_T 开始 (运行) -SM_L3_SW_DEL_MSG 是否确定删除虚拟 3 层交换机 "%S" ? -SM_L3_SW_IF_COLUMN1 IP 地址 -SM_L3_SW_IF_COLUMN2 子网掩码 -SM_L3_SW_IF_COLUMN3 虚拟 HUB 名称 -SM_L3_SW_TABLE_COLUMN1 网络地址 -SM_L3_SW_TABLE_COLUMN2 子网掩码 -SM_L3_SW_TABLE_COLUMN3 网关地址 -SM_L3_SW_TABLE_COLUMN4 公制 -SM_SECURE_NAT_MSG 您是否确定启用 SecureNAT ?\r\n\r\n如果您启用 SecureNAT,带虚拟NAT功能的虚拟路由器将被创建,在虚拟 HUB 中有一个 IP 地址。此虚拟路由器将互相影响,作为一台计算机或多台连接到虚拟网络的计算机组成的路由器。\r\n\r\n在虚拟NAT中的 SecureNAT 启用任何计算机连接到虚拟 HUB,通过 SecureNAT 建立与外部网络的通信。\r\n因此,当 SecureNAT 运行在此 VPN Server 时,无需使用本地客户端连接这台计算机的虚拟 HUB。\r\n\r\n\r\n此外,请注意如果在从虚拟 HUB 二层网段可以到达的一个地点,已有一个 DHCP 服务器,单击“SecureNAT 配置”禁用 DHCP 服务器功能,否则将有 DHCP 冲突。\r\n\r\n而且,您可以禁用 NAT 功能,只使用 DHCP 服务器,如果你想的话。 -SM_CRL_COLUMN_1 证书摘要 -SM_CRL_DELETE_MSG 这将删除选定的项目。你想这样做? -SM_CRL_EMPTY_MSG 没有项目被选择。\r\n如果您在证书吊销项目中进行追加,所有证书将被判断为非法,且所有证书认证模式下的客户端连接将被拒绝。\r\n\r\n您是否确认? -SM_AC_COLUMN_1 ID -SM_AC_COLUMN_2 优先级 -SM_AC_COLUMN_3 行为 -SM_AC_COLUMN_4 目录 -SM_AC_PASS 允许 -SM_AC_DENY 拒绝 -SM_LOG_FILE_COLUMN_1 日志文件的名称 -SM_LOG_FILE_COLUMN_2 文件大小 -SM_LOG_FILE_COLUMN_3 更新日期 -SM_LOG_FILE_COLUMN_4 位置 -SM_READ_LOG_FILE_INFO_1 请等待,直到处理完毕... -SM_READ_LOG_FILE_INFO_2 %S 处理中,%S 已完成 -SM_READ_LOG_FILE_ERROR 文件没有成功下载。 -SM_READ_SAVE_DLG_TITLE 指定日志文件的保存目标文件名 -SM_READ_SAVE_DLG_FILTER 日志文件 (*.log)|*.log|所有文件(*.*)|*.* -SM_READ_SAVE_FAILED 无法保存日志文件。 -SM_READ_SAVE_TMP_FAILED 无法写入临时文件 "%S"。 -SM_READ_SAVE_OPEN_ERROR 无法打开临时文件 "%S"。 \r\n\r\n可能 .LOG 文件扩展名是不是在 Windows 分配的文件类型。 -SM_LICENSE_COLUMN_1 编号 -SM_LICENSE_COLUMN_2 许可证密钥 -SM_LICENSE_COLUMN_3 许可证类型名 -SM_LICENSE_COLUMN_4 状态 -SM_LICENSE_COLUMN_5 有效期 -SM_LICENSE_COLUMN_6 许可证编号 -SM_LICENSE_COLUMN_7 许可证类型 ID -SM_LICENSE_COLUMN_8 服务器 ID -SM_LICENSE_COLUMN_9 序列号 -SM_LICENSE_INFINITE 无限 -SM_LICENSE_NO_EXPIRES 没有到期 -SM_LICENSE_STATUS_EDITION 产品版本 -SM_LICENSE_STATUS_RELEASE VPN Server 的发布日期 -SM_LICENSE_STATUS_SYSTEM_ID 当前服务端 ID -SM_LICENSE_STATUS_EXPIRES 目前产品许可的有效期 -# ----- 不完全翻訳ここから ----- -SM_LICENSE_STATUS_SUBSCRIPTION 认购合同的状态 -SM_LICENSE_STATUS_SUBSCRIPTION_NONEED 无需认购 (在这个版本不需要认购密钥) -SM_LICENSE_STATUS_SUBSCRIPTION_NONE 无密钥(需要添加认购密钥) -SM_LICENSE_STATUS_SUBSCRIPTION_VALID 在认购期内 [直至 %s] -SM_LICENSE_STATUS_SUBSCRIPTION_EXPIRED 认购已过期 [在%s] -SM_LICENSE_STATUS_SUBSCRIPTION_BUILD 版本允许当前合同 -SM_LICENSE_STATUS_SUBSCRIPTION_BUILD_STR 免费升级到 %s 以前发布的所有将来版本。 -SM_LICENSE_STATUS_ENTERPRISE 企业功能的可用性 -SM_LICENSE_STATUS_ENTERPRISE_YES 是 (可用的) -SM_LICENSE_STATUS_ENTERPRISE_NO 否 (不可用) -SM_LICENSE_NUM_USER 允许用户对象创建 -# ----- 不完全翻訳ここまで ----- -SM_LICENSE_NUM_CLIENT 允许并发客户端 -SM_LICENSE_NUM_BRIDGE 允许并发 Bridge -SM_NO_LICENSE_COLUMN 注意: -SM_NO_LICENSE 因为没有产品许可证注册,此 VPN Server 通信功能无法运行。 -SM_LICENSE_DELETE_MSG 你确定要从 VPN Server 删除选定的许可证吗? -SM_SYSLOG_0 禁用系统日志发送功能 -SM_SYSLOG_1 经由 Syslog 发送服务器端日志 -SM_SYSLOG_2 经由 Syslog 发送服务器端和虚拟 HUB 安全日志 -SM_SYSLOG_3 经由 Syslog 发送服务器端,虚拟 HUB 安全和数据包日志 -SM_SETUP_INFO_1 点击“下一步”开始安装。如果你想通出安装并手动配置所有设置,请单击“关闭“”。 -SM_SETUP_INFO_2 单击“关闭“,通过你自己手动配置 VPN Server 的设置。 -SM_SETUP_BRIDGE_ONLY 您当前连接到 VPN Bridge ,您只能为“多点 VPN ”在每个站点创建 VPN Bridge。 -SM_SETUP_BRIDGE_EDGE 每个站点的 VPN Bridge(&E) -SM_SETUP_WARNING 当前 VPN Server 或 VPN Bridge 的设置将被初始化。\r\n您是否确定? -SM_SETUP_SELECT 选择以太网设备建立桥接 -SM_SETUP_NO_LICENSE_KEY 目前此 SoftEther VPN Server 上没有注册任何一个许可证。\r\n\r\n如果要作为 VPN Server 运行 SoftEther VPN Server,您必须输入一个许可证密钥。\r\n您是否要打开许可证管理器窗口? ?\r\n\r\n(作为试用版使用 VPN Server ,您必须从 SoftEther VPN Project 的网站获取试用密钥。\r\n点击“是”并点击获取或延长许可证按钮获取一个试用密钥。 - -# ----- 不完全翻訳ここから ----- -SM_HUBEXT_OPTION_TITLE 虚拟 HUB 扩展选项 -SM_HUBEXT_OPTION_STATIC1 虚拟 HUB 扩展选项允许您配置这个虚拟 HUB 的详细参数。 -SM_HUBEXT_OPTION_STATIC2 标准,VPN Server 全部管理者及,虚拟 HUB 管理者的双方都,能编辑虚拟 HUB 高级选项。但,如果虚拟 HUB 管理选择的 deny_hub_admin_change_ext_option 默认情况下,VPN 服务器的全局管理员和各虚拟 HUB 的管理员都可以修改虚拟 HUB 扩展选项。\r\n但是,如果在虚拟 HUB 管理选项中 deny_hub_admin_change_ext_option 被设置为 1,各虚拟 HUB 的管理员就无法修改虚拟 HUB 扩展选项了 (只能查看)。 -SM_VLAN_COLUMN_0 网络适配器名称 -SM_VLAN_COLUMN_1 驱动程序种类 -SM_VLAN_COLUMN_2 驱动程序文件名 -SM_VLAN_COLUMN_3 VLAN 透明设置 -SM_VLAN_COLUMN_4 全球唯一标识符(GUID) -SM_VLAN_COLUMN_5 设备实例 ID -SM_VLAN_YES 启用 -SM_VLAN_NO 未启用 -SM_VLAN_MSG_1 Windows 注册表配置允许网络适配器“%S”发送/接收带标签的 VLAN 数据包。\r\n\r\n然而,有些网络适配器,需要额外的设置,在本地计算机的 Windows“设备管理器”的属性里设置参数来启用巨型帧(大于 1,512 字节的以太网帧)。如果你未启用巨型帧,一些大型 VLAN 数据包将被漏掉。在大型 VLAN 数据包总是消失的情况下,请启用巨型帧。(例如,设置最大容量为 4088 字节)。Windows 设备管理器将帮您配置。\r\n\r\n此 VLAN 的透明设置已被写入到 Windows 注册表中,但是不能保证 VLAN 数据包可以被有效地传送。\r\n如果 VLAN 标记的数据包在此配置后传输失败,请参阅网络适配器“%S”的手册进行手动的、充分的配置。此外,“%S”可能不支持 VLAN 透明设置。在这种情况下,这样的网络适配器不能被用来传输 VLAN 帧。使用其他产品。\r\n\r\n要应用此设置,运行 VPN Server 的 Windows 必须重新启动。不要忘了重新启动它。 - -SM_VLAN_MSG_2 在网络适配器“%S”上启用了 VLAN 透明功能的 Windows 注册表参数已从注册表中删除。\r\n\r\n如果你上次做过巨型帧启用设置,手动撤消这个变化。\r\n\r\n要应用此设置,运行 VPN Server 的 Windows 必须重新启动。不要忘了重新启动它。 - -SM_VLAN_NOTHING 支持 VLAN 透明设置工具的电脑上“%S”没有网络适配器。\r\n\r\n但是,某些网络适配器在默认情况下能够发送 VLAN 标记的数据包,或通过由供应商提供的特定配置实用程序被配置为执行 VLAN 标记的数据包。\r\通过使用这样的网络适配器,你必须自己手动配置这些设置。 -# ----- 不完全翻訳ここまで ----- -SM_SERVER_ADMIN_MSG VPN Server / Bridge "%S" -SM_ETHERIP_COLUMN_0 ISAKMP Phase 1 ID -SM_ETHERIP_COLUMN_1 虚拟 HUB 名 -SM_ETHERIP_COLUMN_2 用户名 -SM_ETHERIP_ADD_OK 一个新的 EtherIP / L2TPv3 客户端设置已注册。 -SM_IPSEC_SETUP_QUESTION 此 VPN Server 已具有支持兼容 IPsec / L2TP / EtherIP / L2TPv3 协议的 VPN Client 或 VPN 路由器的新功能。 \r\n\r\n您可以允许 VPN Server 接受从智能手机,如 iPhone,iPad,Android,或在 Mac OS X 或 Windows 上的标准 VPN Client 的连接。\r\n\r\n您要设置 IPsec 吗?\r\n(您还可以在以后任何时间通过单击“IPSEC / L2TP设置”按钮来配置 IPsec 设置。) -SM_OPENVPN_CONFIG_SAVE_OK 包含 OpenVPN 设置文件的 ZIP 文件“%s”。\r\n\r\n打开 ZIP 文件提取 OpenVPN 的样本配置文件,可以立即轻松地使用。\r\n您可能需要修改一点配置文件。\r\n\r\n对于详细信息,请阅读 ZIP 文件中的'readme.txt'文件。\r\n\r\n您现在想要打开这个 ZIP 文件吗? -SM_OPENVPN_CONFIG_SAVE_NG 无法保存 ZIP 文件'%s'。 -SM_OPENVPN_CONFIG_OPEN_NG 无法打开 ZIP 文件'%s'。请手动打开此文件。 -SM_DDNS_IPV4_ERROR 无法通过 IPv4 到达 DDNS 服务器。 -SM_DDNS_IPV6_ERROR 无法通过 IPv6 到达 DDNS 服务器。 -SM_DDNS_FQDN_EMPTY (无) -SM_DDNS_OK_MSG 动态 DNS 主机名:%S%S\r\n\r\n您可以通过指定以上 DNS 主机名访问下面的 IP 地址。\r\n\r\nIPv4 地址:%s \r\nIPv6 地址:%s\r\n\r\n您也可以指定下列主机名的特殊形式来指定 IPv4 或 IPv6 作为明确地址类型。\r\n\r\n针对 IPv4 的主机名%S.v4%S \r\n针对 IPv6 的主机名:%S.v6%S。 -SM_DDNS_OK_TITLE 动态 DNS 功能 -SM_DDNS_OK_MSG2 动态 DNS 主机名被更改为'%S'。\r\n\r\n单击提示读取更多的信息。 -SM_DDNS_KEY_TITLE 动态 DNS 密钥 -SM_DDNS_KEY_MSG 动态 DNS 密钥: %s\r\n\r\n此密钥与当前的 DDNS 名称相关联。如果你的 VPN 服务器电脑损坏,丢失了密钥,当前的 DDNS 名称将被永远占用,且其他 VPN 服务器将无法使用相同的名称。\r\n如果你想继续使用相同的名称,请在互联网服务上、或另一台电脑上、或在便笺纸上保留密钥。\r\n当在新的 VPN 服务器设置密钥时,编辑 VPN 服务器的配置文件。请在 "declare DDnsClient" 指令下,用跟随 "byte Key" 的值替换​字符串的密钥。\r\n请不要同时在两个或多个 VPN 服务器上设置相同的密钥。 -SM_DDNS_KEY_ERR 无法读取 DNS 密钥。 -SM_IPSEC_PSK_TOO_LONG 预共享密钥(PSK)有 10 个或更多的字母。\r\n\r\n据报道谷歌安卓的几个版本有一个 10 个或更多字母作为预共享密钥的严重故障。\r\n因此 9 个或少于 9 个字母被推荐作为预共享密钥。\r\n\r\n您要尝试其他预共享密钥吗? -SM_ADVANCED_REDIRECT_URL_HINT_TITLE 如何使用高级 HTTP 重定向功能 -SM_ADVANCED_REDIRECT_URL_HINT 高级 HTTP 重定向(为专家)\r\n\r\n此字符串“”是一个占位符。它可以嵌入重定向的 URL 中。\r\n\r\n嵌入 URL 示例:\r\nhttp://www.google.com/search?q=|secret\r\n\r\n当客户端将被重定向,重定向的实际 URL 目的地将被取代如下。\r\n\r\n用户名|会话ID|IP 地址|日期和时间|哈希值\r\n\r\n替换后示例:zurukko|SID-ZURUKKO-123|219.117.219.154|20131117100354|99707160AFE7A454042B2C47B064112D652452D7\r\n\r\n各字段的详情描述如下。\r\n\r\n用户名:当前 VPN 会话的用户名将被放置。\r\n\r\n会话ID:VPN 会话的会话 ID 将被放置\r\n\r\n日期和时间:14 位数字将以'YYYYMMDDHHMMSS’格式放置(时区是 UTC)\r\n\r\n哈希值:代表 20 个字节二进制数据的一个 40 字符的十六进制字符串。二进制数据是 SHA-1 哈希函数至临时字符串的结果。在重定向 URL 中“|”符号后,临时字符串是上述字段的位阵列加上秘密字符串的结合。(在上面的例子中,“秘密”是秘密字符串)。如果在 URL 中没有“|”符号,没有哈希值将被添加。\r\n\r\n哈希值的目的:秘密字符串如密钥般有效。感谢密钥。在重定向 URL 中接收重定向查询字符串的 CGI 程序,可以验证包含在 URL 中参数的完整性。\r\n -SM_ADVANCED_REDIRECT_URL_MSG URL 必须以“http://”或“https://”开始 -SM_DISABLE_DDNS_HINT_CAPTION 禁用动态 DNS 功能 -SM_DISABLE_DDNS_HINT 需要修改 VPN Server 的配置文件以禁用动态 DNS 功能。\r\n\r\n“declare root”指令下具有“declare DDnsClient”指令。在该指令中,你可以将“bool Disable”从false切换到 true,并重新启动 VPN Server ,然后动态 DNS 功能将被禁用。\r\n -SM_REGENERATE_CERT_MSG VPN Server 的证书被替换为新的。\r\n\r\n这会影响到被配置验证 VPN Server 证书的所有 VPN Client。\r\n您要继续吗? -SM_DDNS_SERVER_CERT_MSG DDNS 主机名更改为“%S”。\r\n\r\n如果您计划使用 Microsoft SSTP VPN 连接到 VPN Server ,从 Windows Vista 或 Windows 更高版本指定 DDNS 主机名为 VPN Server 的目标,由于安全原因, VPN Server 的目标主机名必须与 VPN Server 证书的 CN(Common Name)字段完全匹配。\r\n\r\n您要重新生成的服务器证书,以匹配 CN 值到“%S”吗?\r\n(单击“否”继续使用当前的服务器证书)。 -SM_DDNS_SERVER_CERT_OK VPN Server 的 SSL 证书现在已再次生成。\r\n\r\n当你让Microsoft SSTP VPN Client 连接到 VPN Server 时,你应该指定当前的 DDNS 主机名“%S”作为目标服务器的主机名。\r\n你也必须事先在 Windows 的“受信任的根证书”列表中添加这个 VPN Server 的证书。\r\n(要安装根证书到 Windows 中,在“证书“的小程序里打开 MMC,并导航到“本地计算机”。之后,你可以导入证书到的受信任的根证书列表。\r\详细说明请参考 Microsoft 的文档。)\r\n\ṛ\n您要以 X.509 格式保存新的 SSL 证书作为一个文件吗? -SM_SETUP_STEP_SECURENAT 此 VPN Server / Bridge 可能以用户模式或受其他限制正在运行,虚拟 HUB 和物理网络适配器不能桥接在一起。相反,SecureNAT 功能允许 VPN Client 与物理网络中的其他计算机进行通信。在SecureNAT功能是默认启用的。您可以配置或禁用它。 -SM_SETUP_STEP_SECURENAT_TITLE 第3步。网桥虚拟 HUB 和物理网络 -SM_UPDATE_CHECK_TITLE_VPNSERVER %S VPN Server (在主机'%S'上) -SM_UPDATE_CHECK_TITLE_VPNBRIDGE %S VPN Bridge (在主机'%S'上) -SM_FACTORY_DEFAULT_WARNING 这将在 VPN Server / Bridge 上执行出厂复位设置。\r\n当前 VPN Server / Bridge 配置将被清除,将立即应用初始设置。\r\n在做出厂复位设置前,建议您备份当前配置。\r\n\r\n按 确定 执行出厂复位设置。 VPN Server / Bridge 将重新启动。当前的管理连接将被断开,所以请重新连接到 VPN Server / Bridge。\r\n\r\n按 "取消" 取消操作。 -SM_FACTORY_DEFAULT_PERFORMED 在服务器上正在执行出厂复位操作。\r\n\r\n按“确定”退出当前 VPN Server 管理器的会话“。\r\n退出后,请重新启动 VPN Server 管理器并再次连接到 VPN Server。\r\n然后你会看到 VPN Server 复位。 -SM_AZURE_STATUS_CONNECTED 状态: 已连接 -SM_AZURE_STATUS_NOT_CONNECTED 状态: 没有连接 -SM_NO_BRIDGE_NICS 无物理网络适配器、适合本地桥在 VPN 服务器计算机上被发现。\r\n为了创建一个本地桥,你必须在计算机上至少安装一个物理网络适配器。\r\n您不能为本地桥使用 Wi-Fi 适配器或 3G 适配器。\r\n请安装一个兼容有线以太网的物理网络适配器。\r\n\r\n如果最近安装的网络适配器没有出现,重新启动计算机。\r\n\r\n如果本地桥无论如何不能使用,你可以使用“SecureNAT 功能”代替。\r\n\r\n如果你有一定的原因使用不同寻常的网络适配器(即 Wi-Fi 网络连接适配器,3G 适配器或虚拟适配器),设置“ShowAllInterfaces”变量在“LocalBridgeList”指令为“true”,然后重启VPN服务器。然后,这些设备将出现在名单上。(仅限于高级 Windows 用户)。\r\n\r\nIf this error occurs after you upgraded Windows, please re-install SoftEther VPN Server or SoftEther VPN Bridge> -SM_CERT_MESSAGE The current SSL self-signed root certificate on this VPN Server is in the old format.\r\n\r\nSome versions of OpenVPN Connect for Android have a bug to misinterpret SSL certificates in the old format. It might cause the connection problem from OpenVPN Connect for Android to this VPN Server.\r\n\r\nIf you are planning to use OpenVPN Connect for Android as a VPN client, it is recommended to regenerate the SSL server certificate.\r\n\r\nDo you want to regenerate the server certificate now? -SM_CERT_MESSAGE_CLI --- Caution ---\r\n\r\nThe current SSL self-signed root certificate on this VPN Server is in the old format.\r\n\r\nSome versions of OpenVPN Connect for Android have a bug to misinterpret SSL certificates in the old format. It might cause the connection problem from OpenVPN Connect for Android to this VPN Server.\r\n\r\nIf you are planning to use OpenVPN Connect for Android as a VPN client, it is recommended to regenerate the SSL server certificate.\r\n\r\nTo regenerate and update the server certificate, execute the "ServerCertRegenerate" command after updating the VPN Server to the latest version. -SM_CERT_NEED_ROOT The specified SSL certificate is a sub-certificate which was issued by a CA (Certificate Authority).\r\n\r\nIf you are planning to support either Microsoft SSTP or OpenVPN protocol on this VPN server, you have to install the root certificate and all intermediate certificates (if exists) on this VPN Server.\r\n\r\nTo install these certificates, copy the root certificate and all intermediate certificate files (in the X.509 format) into the "chain_certs" subdirectory on the directory which is VPN Server has been installed on.\r\n\r\nIf you don't know how to obtain root and intermediate certificate files for your certificate authority (CA), please refer to the CA's web site or contact technical support staffs of the CA. - - -#关于 User-mode 路由器管理工具 -NM_TITLE 删除 -NM_CONNECT_TITLE 删除 -NM_STATUS_TAG 连接状态: %s -NM_OFFLINE 您没有连接到任何 VPN Server -NM_CONNECTING 正在连接 VPN 服务器 -NM_CONNECTED 已连接到 VPN 服务器 "%S" -NM_CONNECT_ERROR 错误号 %u (%s) -NM_ACCOUNT_TITLE 删除 -NM_STATUS 用户模式路由器状态 -NM_STATUS_CONNECT 连接状态 -NM_STATUS_TCP NAT TCP/IP 会话数 -NM_STATUS_UDP NAT UDP/IP 会话数 -NM_STATUS_ICMP NAT ICMP 会话数 -NM_STATUS_DNS NAT DNS 会话数 -NM_STATUS_DHCP 已分配的 DHCP 客户端 -NM_INFO 用户模式路由器信息 -NM_INFO_PRODUCT_NAME 产品名称 -NM_INFO_VERSION_STR 版本信息 -NM_INFO_BUILD_INFO 构建信息 -NM_INFO_HOSTNAME 主机名 -NM_NAT_ID ID -NM_NAT_PROTOCOL 协议 -NM_NAT_SRC_HOST 源主机 -NM_NAT_SRC_PORT 源端口 -NM_NAT_DST_HOST 目标主机 -NM_NAT_DST_PORT 目标端口 -NM_NAT_CREATED 会话生成时间 -NM_NAT_LAST_COMM 最后通信时间 -NM_NAT_SIZE 接收 / 发送大小 -NM_NAT_TCP_STATUS TCP 连接状态 -NM_NAT_PROTO_TCP TCP/IP -NM_NAT_PROTO_UDP UDP/IP -NM_NAT_PROTO_DNS DNS -NM_NAT_PROTO_ICMP ICMP -NAT_TCP_CONNECTING 连接中 -NAT_TCP_SEND_RESET 断开中 -NAT_TCP_CONNECTED 已连接 -NAT_TCP_ESTABLISHED 运行中 -NAT_TCP_WAIT_DISCONNECT 断开中 -DHCP_DHCP_ID ID -DHCP_LEASED_TIME 租期开始时间 -DHCP_EXPIRE_TIME 租期到期时间 -DHCP_MAC_ADDRESS MAC 地址 -DHCP_IP_ADDRESS 分配的 IP -DHCP_HOSTNAME 客户端主机名 -NM_PASSWORD_MSG 管理员密码设定完成。 -NM_PUSH_ROUTE_WARNING 静态路由表中指定的文本可能有语法错误。 - - -#关于版本信息 -ABOUT_CAPTION 关于 %s -BETA_EXPIRES 因为目前安装的 SoftEther VPN 软件是测试版,您无法在完整版的更新测试版发布后继续使用此测试版。\r\n请访问 http://selinks.org/ 以获取 SoftEther VPN 软件的最新版本。 - - -#关于日志保存 -# (通用日志) -L_YES 是 -L_NO 否 -L_LINE ------------------------------------------------------ - -# (服务端日志) -LS_START_UTF8 Log Messages are written with UTF-8 Encoding Format. -LS_START_1 SoftEther VPN Server 已启动。 -LS_START_2 %S %S -LS_START_3 %S -LS_END_1 SoftEther VPN Server 引擎已成功关闭。 -LS_END_2 服务端引擎关闭进程已启动。 -LS_STOP_ALL_LISTENER 将停止所有 TCP 监听器。 -LS_STOP_ALL_LISTENER_2 已停止所有 TCP 监听器。 -LS_STOP_ALL_HUB 正在停止所有虚拟 HUB。 -LS_STOP_ALL_HUB_2 已停止所有虚拟 HUB。 -LS_STOP_CEDAR 正在关闭 Cedar 通信模块。 -LS_STOP_CEDAR_2 已关闭 Cedar 通信模块。 -LS_STOP_FARM_MEMBER 正在断开到群集控制器的连接。 -LS_STOP_FARM_MEMBER_2 已断开到群集控制器的连接。 -LS_STOP_FARM_CONTROL 正在停止群集控制器。 -LS_STOP_FARM_CONTROL_2 已停止群集控制器。 -LS_ENUM_ETHERNET_1 枚举以太网设备。 -LS_ENUM_ETHERNET_2 设备 %u: "%S" -LS_LOAD_CONFIG_1 正在装载配置文件。 -LS_LOAD_CONFIG_2 已装载配置文件。 -LS_LOAD_CONFIG_3 配置文件不存在,请尝试使用初始设置。 -LS_INIT_SAVE_THREAD 开始自动保存后台任务。自动保存间隔为 %u 秒。您可以在配置文件中通过修改 AutoSaveConfigSpan 参数来修改自动保存间隔。 -LS_BAD_CONFIG 配置文件内容非法。加载进程被终止。 -LS_LISTENER_START_1 正在启动 TCP 监听器 (端口 %u)。 -LS_LISTENER_START_2 已启动 TCP 监听器 (端口 %u)。现在开始监听客户端连接。 -LS_LISTENER_START_3 无法为 TCP 监听器 (端口 %u) 设置端口为监听状态。请隔一段时间再尝试,直到成功。 -LS_LISTENER_ACCEPT 在 TCP 监听器(端口 %u)上,客户端 (IP 地址 %S,主机名 "%S",端口号 %u) 的连接已建立。 -LS_LISTENER_DISCONNECT 与客户端 (IP 地址 %S,端口号 %u) 的连接已断开。 -LS_LISTENER_DOS 已检测到 TCP 监听器上有 DoS 攻击(端口号 %u)。连接源 IP 地址是%S,端口号是%u。现在将强制断开此连接。 -LS_LISTENER_MAXUEC TCP 监听器是临时暂停接受新的、向内的连接,因为未决的 TCP 连接的数量超过了 %u 个。(当前值=%u) -LS_LISTENER_STOP_1 正在停止 TCP 监听器(端口 %u) -LS_LISTENER_STOP_2 已停止 TCP 监听器(端口 %u) -LS_HUB_START 虚拟 HUB "%S" 已启动。 -LS_HUB_STOP 虚拟 HUB "%S" 已关闭。 -LS_HUB_MAC 虚拟 HUB "%S" 的 MAC 地址是 "%S"。 -LS_NODE_INFO_TAG 客户端产品名:"%S",客户端版本:%u,客户端构建号:%u,服务端产品名:"%S",服务端版本:%u,服务端构建号:%u,客户端操作系统名:"%S",客户端操作系统版本:"%S",客户端产品 ID:"%S",客户端主机名:"%S",客户端 IP 地址:"%S",客户端端口号:%u,服务端主机名:"%S",服务端 IP 地址:"%S",服务端端口号:%u,代理主机名:"%S",代理 IP 地址:"%S",代理端口号:%u,虚拟 HUB 名:"%S",客户端唯一 ID: "%S" -LS_CONNECTION_START_1 客户端 (IP 地址:%S,主机名:"%S",端口号:%u) 的连接 "%S" 已建立。 -LS_CONNECTION_END_1 连接 "%S" 已结束。 -LS_SSL_START 连接 "%S" 的 SSL 通信已启动。加密算法名为 "%S"。 -LS_CONNECTION_ERROR 连接 "%S"因原因 "%s" (代码 %u)已终止。 -LS_FARMMEMBER_NOT_ADMIN 连接 "%S": 服务端是群集成员,但客户端在非管理员 (%S) 用户情况下,尝试直接与虚拟 HUB "%S" 连接。客户端用户名为 "%S"。访问被拒绝。 -LS_HUB_NOT_FOUND 连接 "%S": 客户端正在尝试连接的虚拟 HUB "%S" 在服务端上不存在。 -LS_IP_DENIED 连接 "%S": 基于虚拟 HUB 上定义的源 IP 访问限制列表,客户端的源 IP 地址 "%S" 被拒绝。 -LS_LICENSE_ERROR 连接 "%S": 因为发生许可证相关错误,客户端无法连接到服务端。 -LS_BETA_EXPIRES SoftEther VPN Server 测试版已过期。测试版使用期限已到。请从 http://selinks.org/ 下载新的测试版或完整版。 -LS_TICKET_1 新的客户端鉴权票证已发布为群集成员 "%S"。虚拟机 HUB "%S",用户名 "%S" ("%S"),会话名 "%S",票证 "%S"。 -LS_TICKET_2 新的客户端鉴权票证已从群集控制器接收。虚拟机 HUB "%S",用户名 "%S" ("%S"),会话名 "%S",票证 "%S",有效期限 %u 秒。 -LS_ENUM_HUB 连接 "%S": 此服务端上已枚举 %u 个虚拟 HUB 服务器。 -LS_FARM_ACCEPT_1 连接 "%S": 此服务端接收到一个群集控制器连接请求,但此服务端并不是群集控制器。 -LS_FARM_ACCEPT_2 连接 "%S": 此服务端接收到一个群集控制器连接请求,但认证密码错误,拒绝连接。 -LS_FARM_ACCEPT_3 连接 "%S": 此服务端接收到一个群集控制器连接请求。认证成功。 -LS_FARM_SERV_START 到群集成员的连接已建立。IP 地址 %S,主机名 "%S"。 -LS_FARM_SERV_END 到群集成员 "%S" 的连接已删除。 -LS_FARM_CONNECT_1 到群集成员 "%S" 的连接已启动。 -LS_FARM_CONNECT_2 到群集成员 "%S" 的连接被拒绝。错误: %s (代码 %u) -LS_FARM_CONNECT_3 到群集成员 "%S" 的 TCP 连接失败。请间隔 %u 秒后再度尝试连接,直到连接成功。 -LS_FARM_DISCONNECT 到群集控制器的连接已停止。 -LS_FARM_START 已连接到群集控制器。已开始群集成员操作。VPN Server 是不是在时间许可的产品注册,VPN Client 试图连接。 -LS_LICENSE_NOT_VPNSERVER 连接 "%S": 许可证错误。VPN Client 尝试连接未注册产品许可证的 VPN Server。 -LS_LICENSE_NOT_VPNCLUSTER 连接 "%S": 许可证错误。此 VPN Server 上注册的许可证是禁止使用当前群集功能的类型,且一个 VPN Client 已尝试在群集模式下连接。您必须重启 VPN Server。 -LS_LICENSE_VIOLATION 连接 "%S": VPN Server 发生违反许可证错误,不接受连接。 -LS_LICENSE_VIOLATION_DETECTED 发现许可证违反错误,一个不同的 VPN Server 与此服务端具有相同的服务端ID "%I64u"。可能是在群集中有两个或以上 VPN Server 正在使用相同的许可证。请检查每一个 VPN Server 的许可证信息。 -LS_API_AUTH_OK HTTPS API client "%r:%u" (%S): Administration mode: "%S": The embedded HTTPS web server accepted the successful login. Username: "%S", Method: "%S", Path: "%S" -LS_API_AUTH_ERROR HTTPS API client "%r:%u" (%S): The embedded HTTPS web server refused a login attempt. Username: "%S", Method: "%S", Path: "%S" -LS_API_RPC_CALL HTTPS API client "%r:%u" (%S): The client called a JSON-API. Method: "%S", Returned error code: %u (0 = success), Returned error message: "%s" - - -# (Proto log) -LP_PREFIX_SESSION [%s] %r:%u -> %r:%u (%s): -LP_SESSION_CREATED Session created. -LP_SESSION_DELETED Session deleted. - - -# (OpenVPN Logs) -LO_PREFIX_RAW OpenVPN 模块: -LO_PREFIX_SESSION OpenVPN 会话%u (%r:%u -> %r:%u): -LO_PREFIX_CHANNEL OpenVPN 会话%u (%r:%u -> %r:%u) 通道 %u: -LO_NEW_CHANNEL 已创创建一个新通道。 -LO_CHANNEL_ESTABLISHED_NEWKEY 通道已建立。(触发器: Re-key完成。) -LO_OPTION_STR_RECV 接收到的选项字符串:"%S" -LO_CLIENT_CERT Client certificate received (subject: CN="%s"), will use certificate authentication. -LO_CLIENT_UNVERIFIED_CERT Client certificate was provided but did not pass verification (error="%S"), will use password authentication. -LO_CLIENT_NO_CERT Client certificate is not provided, will use password authentication. -LO_OPTION_STR_SEND 发送选项字符串:"%S" -LO_INITIATE_REKEY re-keying 进程已开始。 -LO_CHANNEL_ESTABLISHED 该通道成为已建立的状态。 -LO_PUSH_REPLY 完整字符串回答:"%S" -LO_CHANNEL_FAILED 无法连接通道。 -LO_CHANNEL_DISCONNECTED_BY_HUB 此 OpenVPN 的通道被终止,因为虚拟 HUB 管理员断开了此 VPN 会话。 - - -# (IPsec 日志) -LI_PREFIX_RAW IPsec 模块: -LI_PREFIX_CLIENT IPsec 客户端 %u (%S:%u -> %S:%u): -LI_PREFIX_IKE IPsec IKE 会话 (IKE SA) %u (客户端: %u) (%S:%u -> %S:%u): -LI_PREFIX_IPSEC IPsec ESP 会话 (IPsec SA) %u (客户端: %u) (%S:%u -> %S:%u): -LI_START IPsec 2.0 版 (ISAKMP/IKEv1) 处理模块已开启。 -LI_STOPPING IPsec 2.0 版 (ISAKMP/IKEv1) 处理模块现在正在关闭。 -LI_STOP IPsec 2.0 版 (ISAKMP/IKEv1) 处理模块已正常关闭。 -LI_NUM_IPSEC_SA 在关机时刻, 余下的 IPsec SA 数量是 %u。 -LI_NUM_IKE_SA 在关机时刻, 余下的 IKE SA 数量是 %u。 -LI_NUM_IKE_CLIENTS 在关机时刻, 余下的 IKE 客户端数量是 %u。 -LI_L2TP_SERVER_STARTED L2TP 服务器模块已开启。 -LI_ETHERIP_SERVER_STARTED EtherIP 服务器模块已开启。EtherIP 会话 ID: %u -LI_DELETE_IKE_CLIENT IPsec 客户端对象被删除。 -LI_DELETE_IKE_SA IKE SA 对象被删除。 -LI_DELETE_IPSEC_SA IPsec SA 对象被删除。 -LI_START_QM_FROM_SERVER 快速模式协商阶段是从服务器端调用。 -LI_START_QM_FROM_CLIENT 快速模式协商阶段是从客户端调用。 -LI_QM_DH_ERROR Diffie-Hellman 算法的计算失败。 -LI_NEW_IKE_CLIENT 新的 IPsec 客户端对象已创建。 -LI_NEW_IKE_SA 新的 IKE SA 对象 (%s) 已创建。发起 Cookie: 0x%I64X, 响应 Cookie: 0x%I64X, DH 组: %S, 哈希算法: %S, 加密算法: %S, 加密密钥大小:%u 位, 寿命:%u kbytes 或 %u 秒。 -LI_TAG_MAINMODE 主模式 -LI_TAG_AGGRESSIVE 积极模式 -LI_NEW_IPSEC_SA 新的 IPsec SA (方向:%s) 已创建。SPI: 为 0x%X, DH 组:%S, 哈希算法: %S, 加密算法: %S, 加密密钥大小: %u 位, 寿命: %u kbytes 或 %u 秒。 -LI_TAG_SERVER_TO_CLIENT 服务器 -> 客户端 -LI_TAG_CLIENT_TO_SERVER 客户端 -> 服务器 -LI_IPSEC_SA_SPI_SET 不固定的 SPI 已修改。SPI 的新值为: 0x%X -LI_IPSEC_SA_ESTABLISHED 服务器和客户端之间的 IPsec SA 已建立。 -LI_IKE_SA_ESTABLISHED 服务器和客户端之间的 IKE SA 已建立。 -LI_IPSEC_NO_TRANSFORM 在从客户端的候选人里, 没有建立 IPsec SA 的适当转换被发现。 -LI_IKE_NO_TRANSFORM 在从客户端的候选人里, 没有建立 IKE SA 的适当转换被发现。 -LI_IKE_NO_NAT_T 此客户端与 IPSec NAT Traversal (在 IKE NAT Traversal 的 RFC 3947 协商, 或 draft-ietf-ietf-ipsec-nat-t-ike) 不兼容, 因此服务器无法接受 VPN 连接。 -LI_SET_CLIENT_ID 客户端呈现的客户 ID 是 "%S". -LI_CLIENT_MERGE 此客户端 (客户端 %u) 与客户端 %u 是相同的, 因此客户端对象与客户端 %u 是相结合的。 -LI_CLIENT_UPDATE 此客户端的端口号信息是更新的。 - - -# (EtherIP日志) -LE_PREFIX EtherIP / L2TPv3 会话 %u (%S:%u - >%S:%u): -LE_START_MODULE EtherIP / L2TPv3 模块已开启。 -LE_STOP EtherIP / L2TPv3 模块已关闭。 -LE_NO_SETTING 错误: 没有与客户端 ID "%S" 相对应的 EtherIP / L2TPv3 设置。你必须预先在 VPN Server 上注册一个 EtherIP / L2TPv3 设置。 -LE_START_IPC 在 EtherIP / L2TPv3 模块和虚拟 HUB "%S" 之间的内部连接过程。用户名是 "%S" 。IPv4 TCP MSS (最大网段尺寸) 的值是 %u 字节。 -LE_IPC_CONNECT_ERROR 从 EtherIP / L2TPv3 模块到虚拟 HUB "%S" 的连接失败。错误: %u: %s -LE_IPC_CONNECT_OK 从 EtherIP / L2TPv3 模块到虚拟 HUB "%S" 的连接建立成功。 -LE_RECONNECT 由于 EtherIP / L2TPv3 设置已被修改, 现在内部连接是断开的, 将会自动重新连接。 - - -# (PPP 日志) -LP_PREFIX %S%SPPP 会话 [%S:%u]: -LP_CONNECTED 开始新的 PPP 会话 (上层协议: %S)。PPP 客户端 IP 地址:%S (主机名: "%S"), PPP 客户端端口: %u, PPP 服务器 IP 地址:%S, PPP 服务器端口:%u, 客户端软件: "%S" ,IPv4 TCP MSS (最大网段尺寸): %u 字节 -LP_DISCONNECTED PPP 会话已断开。 -LP_PAP_REJECTED VPN 客户端拒绝使用 "PAP" (Password Authentication Protocol、明文密码验证方法) 作为认证协议。您必须在 VPN 客户端设置上开启 PAP。 -LP_PAP_MSCHAPV2_REJECTED VPN 客户端拒绝使用 "PAP" (Password Authentication Protocol, 明文密码验证方法) 和 MS-CHAP v2 协议。您必须在 VPN 客户端设置上开启 PAP 或 MS-CHAP v2。 -LP_DISCONNECTED_ABNORMAL PPP 协议错误或 PPP 会话中断。 -LP_NEXT_PROTOCOL_IS_NOT_PAP 收到无效的协议 (协议号:0x%x)。在这种情况下, 只有 PAP (密码验证协议) 控制数据可以被接受。 -LP_PAP_FAILED "PAP" (密码验证协议, 明文密码验证方法) 在用户验证过程中失败。 -LP_MSCHAPV2_FAILED "MS-CHAP v2" (Microsoft Challenge and Response Protocol Version 2.0) 在用户验证过程中失败。 -LP_NEXT_PROTOCOL_IS_NOT_IPCP 收到无效协议 (协议号:0x%x)。在这种情况下, 只有 IPCP (IP 配置协议) 控制数据可以被接受。 -LP_DATA_TIMEOUT PPP 数据传输超时发生。PPP 客户端可能会从网络上断开。 -LP_CONTROL_TIMEOUT PPP 控制通讯超时发生。PPP 客户端没有响应。 -LP_VPN_SESSION_TERMINATED 因为 VPN 会话已被系统管理员断开, PPP 会话断开。 -LP_UPPER_PROTOCOL_DISCONNECTED 因为上层协议 "%S" 断开, PPP 会话断开。 -LP_NORMAL_TERMINATE 由于 VPN 客户端的请求, PPP 会话断开。 -LP_IP_ADDRESS_NOT_DETERMIND 虽然 VPN 客户端的 IP 地址是不固定的, VPN 客户端尝试发送数据。 -LP_DHCP_REQUEST_TRYING 请求 DHCP 服务器分配 IP 地址。 -LP_DHCP_REQUEST_OK IP 地址从 DHCP 服务器被分配。客户端 IP 地址: %S, 子网掩码: %S, 默认网关: %S, 域名: "%S", DNS 服务器 1: %S, DNS 服务器 2: %S, WINS 服务器 1: %S, WINS 服务器 2: %S, DHCP 服务器 IP 地址:%S, 租赁寿命: %u 秒 -LP_DHCP_REQUEST_NG 向 DHCP 服务器请求 IP 地址失败。要接受 PPP 连接, DHCP 服务器必须在现有网络上。确保任何一个在虚拟 HUB 的以太网段的 DHCP 服务器是可用的。 -LP_DHCP_INFORM_TRYING 请求 DHCP 服务器获取网络信息, 如子网掩码和默认网关。 -LP_DHCP_INFORM_OK IP 网络信息从 DHCP 服务器获取。子网掩码: %S, 默认网关:%S, 域名: "%S", DNS 服务器 1: %S, DNS 服务器 2: %S, WINS 服务器 1: %S, WINS 服务器 2: %S, DHCP 服务器 IP 地址: %S -LP_DHCP_INFORM_NG 向 DHCP 服务器请求一个 IP 网络信息失败。要接受 PPP 连接, DHCP 服务器必须在现有网络上。确保任何一个在虚拟 HUB 的以太网段的 DHCP 服务器是可用的。 -LP_SET_IPV4_PARAM 在 VPN 客户端的 IP 地址和其他 IP 网络信息已建立。客户端 IP 地址: %S, 子网掩码: %S, 默认网关: %S, DNS 服务器 1: %S, DNS 服务器 2: %S, WINS 服务器 1: %S, WINS 服务器 2: %S - - -# (虚拟 HUB 日志) -LH_ONLINE 虚拟 HUB 现在在线。 -LH_OFFLINE 虚拟 HUB 现在离线。 -LH_CONNECT_CLIENT 连接 "%S" (IP 地址 %S,主机名 %S,端口号 %u,客户端名 "%S",版本 %S,内部编号 %u) 正尝试连接到虚拟 HUB。提供的认证类型是 "%s",用户名是 "%S"。 -LH_AUTH_UNKNOWN 未知的认证类型 -LH_AUTH_ANONYMOUS 匿名身份验证 -LH_AUTH_PASSWORD 密码验证 -LH_AUTH_PLAIN_PASSWORD 外部服务器身份验证 -LH_AUTH_CERT 证书验证 -LH_AUTH_TICKET 票证验证 -LH_AUTH_OPENVPN_CERT OpenVPN certificate authentication -LH_AUTH_RADIUS_NOT_SUPPORT 连接 "%S": 用户 "%S" 身份验证方法 RADIUS 或 Active Directory (NT 域),但 VPN Server 是 "%S",因为 RADIUS 或 Active Directory (NT 域)不能使用。连接被拒绝。 -LH_AUTH_RADIUS_NOT_SUPPORT_ON_OPEN_SOURCE "%S" 的连接方法: 用户 "%S" 的身份验证方法被指定为 RADIUS 身份验证或 Active Directory 身份验证 (NT 域验证)。然而,这样一个外部用户身份验证功能尚未在 SoftEther VPN 的开源版本上实施。该连接将被拒绝。 -LH_AUTH_CERT_NOT_SUPPORT_ON_OPEN_SOURCE "%S" 的连接方法: 用户 "%S" 的身份验证方法被指定为证书认证。然而,证书验证功能尚未在 SoftEther VPN 的开源版本上实施。该连接将被拒绝。 -LH_AUTH_OK 连接 "%S": 成功认证为用户 "%S"。 -LH_AUTH_OK_CERT 虚拟 HUB 的安全账户管理器已经从 VPN Client 接收到如下证书,且接受了其内容作为当用户 "%S" 登录时的证书: %s -LH_AUTH_NG_CERT 虚拟 HUB 的安全账户管理器已经从 VPN Client 接收到如下证书,但拒绝了其内容作为当用户 "%S" 登录时的证书,因为此证书的内容匹配虚拟 HUB 中注册的废止内容列表: %s -LH_AUTH_NG Connection "%S": User authentication failed. The user name that has been provided was "%S", from %S. -LH_LOCAL_ONLY 连接 "%S": 远程登录拒绝,因为用户 "%S" 的密码为空。 -LH_POLICY_ACCESS_NG 连接 "%S": 由于安全策略,用户 "%S" 拒绝访问。 -LH_USER_EXPIRES 连接 "%S": 由于有效期限已过,用户 "%S" 拒绝访问。 -LH_CLIENT_VERSION_OLD 连接 "%S": 客户端版本号为 %u。为了允许这个连接,客户端版本号至少应为 %u 或以上。 -LH_CLIENT_ID_REQUIRED 连接 "%S": 客户已经从客户端发送的 ID 是 %u。然而,此虚拟 HUB 的 RequiredClientId 值设置为 %u。 -LH_FARM_SELECT_1 连接 "%S": 群集控制器正在确定此客户端的目标群集成员。 -LH_FARM_SELECT_2 连接 "%S": 群集控制器确定目标群集成员服务器失败。 -LH_FARM_SELECT_3 连接 "%S": 当前 VPN Server 被确定作为目标群集成员服务器。请继续接收连接。 -LH_FARM_SELECT_4 连接 "%S": 服务端 "%S" 被确定作为目标群集成员服务器。正在指示客户端重新连接到此服务端。 -LH_MAX_SESSION 连接 "%S": 虚拟 HUB 设置的最大会话数 (%u) 已到达。无法创建新会话。 -LH_MAX_SESSION_CLIENT 连接 "%S": 虚拟 HUB 设置的最大客户端会话数 (%u) 已到达。无法创建新会话。 -LH_MAX_SESSION_BRIDGE 连接 "%S": 虚拟 HUB 设置的最大网桥会话数 (%u) 已到达。无法创建新会话。 -LH_MAX_SESSION_2 连接 "%S": 可被 VPN Server 管理的的最大会话数 (%u) 已到达。无法创建新会话。 -LH_NEW_SESSION 连接 "%S": 已创建新会话 "%S"。(IP 地址:%S,端口号:%u,物理底层协议:"%S") -LH_SET_SESSION 会话 "%S": 已设置参数。最大 TCP 连接数:%u,使用的加密:%s,使用的压缩:%s,使用的半双工通信:%s,超时:%u 秒。 -LH_NODE_INFO 会话 "%S": VPN Client 详细信息: (%s) -LH_VLAN_ID 会话 "%S": Assigned VLAN ID: %u -LH_INVALID_SIGNATURE 会话 "%S": 已连接的客户端发送了非法协议数据。无法与客户端建立一般通信。请首先检查客户端到服务端之间的连接和网络线缆问题,然后再检查是否安装有特殊传输数据包重写设备。 -LH_END_SESSION 会话 "%S": 会话已结束。统计信息如下: 总输出数据大小: %I64u 字节,总输入数据大小: %I64u 字节。 -LH_BCAST_STORM 会话 "%S": 检测到大量广播数据包。您可能会按照策略废弃数据包。源 MAC 地址是 %S,源 IP 地址是 %S,目标 IP 地址是 %S。广播数据包量大于等于 %u 每秒 (注意此信息是对部分数据包进行刻板的分析,结果可能不正确)。 -LH_DHCP_FORCE 会话 "%S": 数据包被废弃,因为它尝试使用非 DHCP 服务器分配的 IP 地址 %S。 -LH_MAC_LIMIT 会话 "%S": 试图分配一个新 MAC 地址 "%S",但是 %u 个 MAC 地址已被分配在此服务上。根据安全策略,此会话被允许拥有最多 %u 个 MAC 地址。数据包被废弃。 -LH_BRIDGE_LIMIT 会话 "%S": 试图分配一个新 MAC 地址 "%S",但是 %u 个 MAC 地址已被分配在此服务上。根据安全策略,此会话被禁止网桥,因此只允许拥有不超过 %u 个 MAC 地址。数据包被废弃。 -LH_MAC_REGIST 会话 "%S": 已分配新的 MAC 地址"%S"。 -LH_MAC_REGIST_VLAN 会话 "%S": 已分配新的 MAC 地址"%S" (VLAN ID: %u)。 -LH_IP_LIMIT 会话 "%S": 试图分配一个新 IP 地址 "%S",但是 %u 个 IP 地址已被分配在此服务上。根据安全策略,此会话被允许拥有最多 %u 个 IP 地址。数据包被废弃。 -LH_ROUTING_LIMIT 会话 "%S": 试图分配一个新 IP 地址 "%S",但是 %u 个 IP 地址已被分配在此服务上。根据安全策略,此会话被禁止路由,因此只允许拥有不超过 %u 个 IP 地址。数据包被废弃。 -LH_IP_CONFLICT 会话 "%S": 试图分配一个新 IP 地址 "%S",但是此 IP 地址已经被另一个会话 "%S": ( MAC 地址:"%S")所使用。此会话的安全策略禁止复制其它会话使用的 IP 地址。数据包被废弃。详细信息:CreatedTime=%I64u, UpdatedTime=%I64u, DhcpAllocated=%u, Now=%I64u -LH_NO_SERVER 会话 "%S": 一个 TCP/IP 连接请求 (从 %S:%u 到 %S:%u) 被建立到此会话,但因为安全策略禁止作为服务端运行,数据包被废弃。 -LH_NO_DHCP 会话 "%S": 此会话上的主机 %S 发送了一个作为 DHCP 服务器为主机 %S 在其他会话上分配 IP 地址的数据包,但此会话的安全策略禁止作为 DHCP 服务器运行。数据包被废弃。 -LH_REGIST_DHCP 会话 "%S": 此会话上的主机 "%S" (%S) 的 DHCP 服务器,为令一个会话 "%S" 上的主机 "%S",分配了新的 IP 地址 %S。 -LH_BRIDGE_1 会话 "%S": 已启动本地网桥连接到物理以太网接口 "%S"。 -LH_BRIDGE_2 会话 "%S": 因为与物理以太网接口 "%S" 的通信建立失败,停止本地网桥。 -LH_SET_MTU 会话 "%S": 物理以太网接口 "%S" 的 MTU 为 %u。发送和接收有 %u 字节的以太网数据包是必要的。MTU 现已更改为 %u。 -LH_SET_MTU_ERROR 会话 "%S": 错误: 物理以太网接口"%S" 的 MTU 为 %u。发送和接收有 %u 字节的以太网数据包是必要的。然而,改变 MTU 到%u失败。此物理以太网接口或设备驱动程序可能无法处理一个大于 1,514 字节(有效载荷大小:1,500 字节)的以太网数据包。在这样的情况下,大于 1,514 字节的、带标记的 VLAN 数据包不能被发送。你应该将当前物理以太网适配器替换为支持巨型帧的另一个。您也可以尝试更新设备驱动程序。另一种可能的方法是在操作系统或设备驱动程序设置里启用巨型帧。 -LH_START_BRIDGE 已启动本地网桥连接 "%S"。已创建网桥会话 "%S"。 -LH_STOP_BRIDGE 已停止本地网桥连接 "%S"。 -LH_LINK_START 已建立级联连接 "%s"。已建立级联会话 "%S"。 -LH_LINK_STOP 已停止级联连接 "%s"。 -LH_NAT_START 已启动 SecureNAT。已创建 SecureNAT 会话 "%S"。 -LH_NAT_STOP 已停止 SecureNAT。 -LH_NAT_TCP_SUCCEED 已成功连接到 TCP 会话 %u: 主机 "%S (%S)",端口 %u。 -LH_NAT_TCP_FAILED 连接到 TCP 会话 %u: 主机 "%S",端口 %u 失败。 -LH_NAT_TCP_DELETED 已删除 TCP 会话 %u。 -LH_NAT_TCP_CREATED 已创建 TCP 会话 %u。连接源 %S:%u,连接目标 %S:%u -LH_NAT_UDP_DELETED 已删除 UDP 会话 %u。 -LH_NAT_UDP_CREATED 已创建 UDP 会话 %u。连接源 %S:%u,连接目标 %S:%u -LH_NAT_DHCP_CREATED 已建立 DHCP 项 %u。MAC 地址: %S,IP 地址: %S,主机名: %S,有效期限: %u 秒 -LH_CHANGE_PASSWORD_1 连接到虚拟 HUB 的连接 "%S" (IP 地址 %S) 在改变密码模式。 -LH_CHANGE_PASSWORD_2 连接 "%S": 改变密码失败。指定用户 "%S" 不存在。 -LH_CHANGE_PASSWORD_3 连接 "%S": 改变密码失败。用户 "%S" 的认证类型不是密码认证。 -LH_CHANGE_PASSWORD_4 连接 "%S": 改变密码失败。用户 "%S" 的旧密码错误。 -LH_CHANGE_PASSWORD_5 连接 "%S": 用户 "%S" 的密码修改成功。 -LH_CONNECT_1 正在启动级联连接 "%s": 连接次数 %u。 -LH_CONNECT_2 级联连接 "%s" 已建立。会话名: "%S" -LH_CONNECT_ERROR 级联连接 "%s" 的已断开或连接失败。原因: %s (代码 %u) -LH_POLICY_MONITOR_MODE 连接 "%S": 因为“监测模式”打开监测模式并试图连接到虚拟 HUB 的请求被用户的安全策略禁止,连接被拒绝。 -LH_POLICY_BRIDGE_MODE 连接 "%S": 因为桥接和路由操作打开桥接或路由并试图连接到虚拟 HUB 的请求被用户的安全策略禁止,连接被拒绝。 -LH_NOT_ENOUGH_CLIENT_LICENSE 连接 "%S": 此连接试图使用“客户端连接模式”连接到 VPN Server,但因为此操作会导致整个服务端上的客户端连接数超过已注册的客户端许可证数,因此不可能再接收更多连接。当前连接许可证数不足时,您必须断开已存在的客户端连接,或增加许可证数。在服务端目前目前 %u 个已注册的客户端连接许可证和 %u 个连接。 -LH_NOT_ENOUGH_BRIDGE_LICENSE 连接 "%S": 此连接试图使用“桥接模式”连接到 VPN Server,但因为此操作会导致整个服务端上的桥接数超过已注册的桥接许可证数,因此不可能再接收更多连接。当前连接许可证数不足时,您必须断开已存在的客户端连接,或增加许可证数。在服务端目前目前 %u 个已注册的桥接许可证和 %u 个连接。 -LH_TOO_MANY_MULTILOGINS 连接 "%S": 用户 "%S" 尝试登录,但此用户的安全策略限制了最大多重登录到 %u 个会话。目前此用户登录了 %u 个会话,因此无法建立新的 VPN 连接。 -LH_TOO_MANY_MULTILOGINS2 连接“%S”:用户“%S”登录尝试,但 VPN Server 的这个版本,允许多个并发 VPN 会话的最大数量达到每用户 %u 会话。目前这个用户的多个并发的 VPN 会话的数量是 %u,所以大于多个并发的 VPN 会话是不被允许的。如果你想每用户支持更多的多个并发 VPN 会话,请考虑升级到专业版或 VPN Server 的更高版本。 -LH_PACKET_LOG_NO_LOG 此 VPN Server 的版本不支持数据包日志功能。无 IP 地址或无 TCP / UDP 包头的数据将被记录。在你升级 VPN Server 版升级到专业版或更高版本后,各种数据包日志将被记录在这个文件中。 -LH_PACKET_LOG_NO_LOG_OSS VPN 服务器是开源或免费的版本。尚未实施 IP 地址或 TCP / UDP 包头数据记录功能。这里不记录 IP 地址,也不记录 TCP / UDP 包头数据。 -LH_NO_RADIUS_SETTING 用户“%S”被配置为使用 RADIUS 身份验证。然而,没有 RADIUS 身份验证设置。用户不能进行身份验证。 -LH_KERNEL_MODE_START 据检测,SecureNAT 的内核模式 NAT 可以在接口 "%S" 上运行。内核模式 NAT 开始。 TCP、UDP 和 ICMP NAT 处理将执行与高性能通过以下内核模式。内核模式 NAT 参数:IP 地址="%r",子网掩码="%r",默认网关="%r",广播地址="%r",虚拟 MAC 地址:"%S",DHCP 服务器地址:"%r",DNS服务器地址:"%r" -LH_KERNEL_MODE_STOP SecureNAT 接口“%S”的内核模式 NAT 已停止。 - - -# (日志管理) -LA_CONNECTED_1 连接 "%S" 使用服务端管理员模式连接。 -LA_CONNECTED_2 连接 "%S" 使用虚拟 HUB 管理员模式连接。虚拟 HUB 名为 "%S"。 -LA_IP_DENIED 连接 "%S" 试图使用管理员模式从一个被 adminip.txt 禁止的 IP 地址连接。断开中。 -LA_ERROR 连接 "%S" 无法使用管理员模式登录。%s (错误码 %u) -LA_OK 连接 "%S" 成功使用管理员模式登录。 -LA_RPC_START 连接 "%S" 为管理员模式成功创建了一个远程程序呼叫会话 "%S"。 -LA_TAG_1 管理模式 "%S": -LA_TAG_2 管理模式 "%S" (虚拟 HUB "%S"): -LA_CREATE_LISTENER 已建立新 TCP 监听器 (端口号 %u)。 -LA_DELETE_LISTENER 已删除 TCP 监听器 (端口号 %u)。 -LA_ENABLE_LISTENER 已启用 TCP 监听器 (端口号 %u)。 -LA_DISABLE_LISTENER 已禁用 TCP 监听器 (端口号 %u)。 -LA_SET_PORTS_UDP UDP ports have been set: %s. -LA_SET_PROTO_OPTIONS %s options have been set. -LA_SET_SERVER_PASSWORD 服务端管理员密码设置完成。 -LA_SET_FARM_SETTING 群集设置变更完成。 -LA_SET_SERVER_CERT 服务端证书设定完成。 -LA_REGENERATE_SERVER_CERT 服务器证书再次生成。新 CN:"%S" -LA_SET_SERVER_CIPHER 服务端的新加密算法名设定完成。新加密算法为 "%S"。 -LA_CREATE_HUB 已创建新虚拟 HUB "%S"。 -LA_SET_HUB 已变更虚拟 HUB 设置。 -LA_DELETE_HUB 已删除虚拟 HUB "%S"。 -LA_SET_HUB_RADIUS 已变更虚拟 HUB 外部 RADIUS 认证服务器设置。 -LA_DISCONNECT_CONN 连接到服务端的客户端连接 "%S" 已被强制断开。 -LA_SET_HUB_ONLINE 虚拟 HUB 现在在线。 -LA_SET_HUB_OFFLINE 虚拟 HUB 现在离线。 -LA_SET_SNAT_OPTION 已设置 SecureNAT 选项。 -LA_ENABLE_SNAT 已启动 SecureNAT 功能。 -LA_DISABLE_SNAT 已禁用 SecureNAT 功能。 -LA_SET_HUB_LOG 已变更日志保存设置。 -LA_ADD_CA 已注册信任的根证书。 -LA_DELETE_CA 已删除信任的根证书。 -LA_CREATE_LINK 已添加级联连接 "%s"。 -LA_SET_LINK 已变更级联连接 "%s" 设置。 -LA_SET_LINK_ONLINE 级联连接 "%s" 现在在线。 -LA_SET_LINK_OFFLINE 级联连接 "%s" 现在离线。 -LA_DELETE_LINK 已删除级联连接 "%s"。 -LA_RENAME_LINK 级联连接 "%s" 名称已更改 "%s"。 -LA_ADD_ACCESS 已添加访问列表。 -LA_DELETE_ACCESS 已删除访问列表。 -LA_SET_ACCESS_LIST 已更新访问列表。完成 %u 个访问列表项设定。 -LA_SET_AC_LIST 已更新源 IP 地址限制列表。已设定 %u 个规则项目。 -LA_CREATE_USER 已创建用户 "%S"。 -LA_SET_USER 已更新用户 "%S" 的设置。 -LA_DELETE_USER 已删除用户 "%S"。 -LA_CREATE_GROUP 已创建组 "%S"。 -LA_SET_GROUP 已更新组 "%S" 的设置。 -LA_DELETE_GROUP 已删除组 "%S"。 -LA_DELETE_SESSION 会话 "%S" 被强制断开。 -LA_SET_KEEP 已更新服务端的 Internet 连接维持设置。 -LA_SET_SYSLOG 已更新服务端的 syslog 发送功能设置。 -LA_DELETE_BRIDGE 已删除本地桥接定义 "%S" --> "%S"。 -LA_ADD_BRIDGE 已添加本地桥接定义 "%S" --> "%S"。 -LA_REBOOT_SERVER 请重新启动 VPN Server。 -LA_GET_CONFIG 已读取配置文件。 -LA_SET_CONFIG 已写入配置文件。VPN Server 重启中。 -LA_SET_HUB_ADMIN_OPTION 已设定虚拟 HUB "%S" 的管理选项。 -LA_SET_HUB_EXT_OPTION 已设定虚拟 HUB %S" 的虚拟 HUB 扩展选项。 -LA_ADD_L3_SW 虚拟 3 层交换机 "%S" 已在服务端上创建。 -LA_DEL_L3_SW 虚拟 3 层交换机 "%S" 已从服务端上删除。 -LA_START_L3_SW 已启动虚拟 3 层交换机 "%S"。 -LA_STOP_L3_SW 已停止虚拟 3 层交换机 "%S"。 -LA_ADD_L3_IF 虚拟 HUB "%S" 的虚拟接口已被添加到虚拟 3 层交换机 "%S"。 -LA_DEL_L3_IF 虚拟 HUB "%S" 的虚拟接口已从虚拟 3 层交换机 "%S" 中删除。 -LA_ADD_L3_TABLE 网络 "%S" 的路由表已被添加到虚拟 3 层交换机 "%S"。 -LA_DEL_L3_TABLE 网络 "%S" 的路由表已从虚拟 3 层交换机 "%S" 中删除。 -LA_ADD_CRL 证书被添加到证书无效列表。 -LA_DEL_CRL 证书已在证书无效列表中被编辑。 -LA_SET_CRL 已编辑无效证书列表的已注册的注册项目。 -LA_READ_LOG_FILE 已下载服务端 "%S" (日志文件 "%S") 上的日志文件。 -LA_ADD_LICENSE_KEY 已注册新的许可证密钥 "%S"。 -LA_DEL_LICENSE_KEY 已删除现存许可证 (%u 号)。 -LA_SET_IPSEC_CONFIG IPsec 服务器设置是更新的。 -LA_ADD_ETHERIP_ID EtherIP / L2TPv3 服务器设置 (ID="%S") 已添加。 -LA_DEL_ETHERIP_ID EtherIP / L2TPv3 服务器 (ID="%S") 设置已删除。 - -LA_SET_OVPN_SSTP_CONFIG OpenVPN 和 MS-SSTP VPN Server 设置已更新。 -LA_DDNS_HOSTNAME_CHANGED 动态 DNS 功能的主机名已更改为 "%S". -LA_SET_SPECIAL_LISTENER 特殊监听器启用/禁用状态已变更。 - - -# (客户端日志) -LC_START_1 已启动 SoftEther VPN Client 引擎。 -LC_START_2 %S %S -LC_START_3 %S -LC_END 已关闭 SoftEther VPN Client 引擎。 -LC_LOAD_CONFIG_1 加载配置文件。 -LC_LOAD_CONFIG_2 配置文件已已加载。 -LC_LOAD_CONFIG_3 配置文件不存在。请应用初始设置。 -LC_NEW_ACCOUNT 已建立新 VPN 连接设置 "%s"。 -LC_DELETE_ACCOUNT 已删除 VPN 连接设置 "%s"。 -LC_RENAME_ACCOUNT 已变更 VPN 连接设置名 "%s" 为 "%s"。 -LC_CONNECT 已开始 VPN 连接设置 "%s" 的连接处理。 -LC_CONNECT_1 VPN 连接设置 "%s": 第 %u 次连接操作开始。 -LC_CONNECT_2 VPN 连接设置 "%s": 连接完成。会话名: "%S"。 -LC_CONNECT_ERROR VPN 连接设置 "%s": 连接断开或连接失败。原因: %s (代码 %u) -LC_DISCONNECT VPN 连接设置 "%s" 断开中。 -LC_CREATE_VLAN 已创建虚拟网络适配器 "%S"。 -LC_UPDATE_VLAN 已重装虚拟网络适配器 "%S" 驱动。 -LC_DELETE_VLAN 已删除虚拟网络适配器 "%S"。 -LC_SET_PASSWORD 连接到客户端服务的密码设置已变更。 -LC_TAP_NOT_FOUND 无法找到 tun/tap 的 Mac OS X 驱动。请安装 tun/tap 驱动。 - -#(删除日志) -LE_START 正在监控目录 "%S"。如果可用磁盘空间变得小于 %S,此目录和其子目录下的日志文件和配置文件的备份文件将按照从旧到新的顺序被自动删除。决定何时开始删除的可用磁盘空间大小,可以在配置文件的“AutoDeleteCheckDiskFreeSpaceMin”项目中修改。 -LE_DELETE 可用磁盘空间已小于 %S,因此旧文件 "%S" 被自动删除。决定何时开始删除的可用磁盘空间大小,可以在配置文件的“AutoDeleteCheckDiskFreeSpaceMin”项目中修改。 -LE_NOT_ENOUGH_FREE <<警告>> 如果可用磁盘空间小于 %S,将不能自动删除日志文件和配置文件的旧备份文件。我们建议您即刻从次计算机上手动删除不必要的文件来恢复可用磁盘空间。当可用磁盘空间过小时,计算机运行将被变得不稳定。 - -# (三层交换机日志) -L3_SWITCH_START 已启动虚拟 3 层交换机 "%S"。直到此交换机上所有注册接口的虚拟 HUB 都在线后,它才开始工作。 -L3_SWITCH_ONLINE 虚拟 3 层交换机 "%S" 所有接口的虚拟 HUB 在线,且虚拟 3 层交换机已开始虚拟 3 层交换工作。 -L3_SWITCH_OFFLINE 虚拟 3 层交换机 "%S" 上至少有一个接口的虚拟 HUB 停止工作,则虚拟 3 层交换机停止工作。 -L3_SWITCH_STOP 虚拟 3 层交换机 "%S" 终止。 - - -#关于Microsoft.c -MS_VIRTUAL 专有的虚拟/内部接口 -MS_ETHERNET 以太网接口 -MS_TOKENRING 令牌环接口 -MS_FDDI FDDI 接口 -MS_PPP PPP (拨号或 VPN) -MS_LOOPBACK 环回接口 -MS_SLIP SLIP 接口 -MS_WLAN 无线网络适配器 -MS_OTHER 未知其它接口 -MS_NON_OPERATIONAL 无效 -MS_UNREACHABLE 未连接 -MS_DISCONNECTED 未连接 -MS_CONNECTING 连接中 -MS_CONNECTED 已连接 -MS_OPERATIONAL 已连接 - - -# 关于网络实用工具 -UT_SM_COLUMN_1 项目名 -UT_SM_COLUMN_2 值 -UT_SM_ST_TITLE 网络适配器的名称 -UT_SM_ST_GUID 全球唯一标识符(GUID) -UT_SM_ST_TYPE 类型 -UT_SM_ST_TYPE2 有线网络适配器 -UT_SM_ST_STATUS 状态 -UT_SM_ST_MTU MTU -UT_SM_ST_SPEED 链接速度 -UT_SM_ST_ADDRESS 物理地址 -UT_SM_ST_RECV_BYTES 接收的字节数 -UT_SM_ST_RECV_BCASTS 接收广播数据包数 -UT_SM_ST_RECV_UNICASTS 接收单播包数 -UT_SM_ST_SEND_BYTES 发送字节数 -UT_SM_ST_SEND_BCASTS 发送广播数据包数 -UT_SM_ST_SEND_UNICASTS 发送单播包数 -UT_SM_ST_IP IP 地址 %u -UT_SM_ST_SUBNET 子网掩码 %u -UT_SM_ST_GATEWAY 网关 %u -UT_SM_ST_DHCP DHCP 服务器 -UT_SM_ST_DHCP_1 租赁开始日期 -UT_SM_ST_DHCP_2 租赁到期日期 -UT_SM_ST_WINS_1 WINS 服务器 1 -UT_SM_ST_WINS_2 WINS 服务器 2 - - -# 关于以太网记录器管理器 -EM_TITLE SoftEther 以太网记录器管理器 -EM_REMOTE_TITLE 您可以连接并管理 SoftEther 以太网记录器服务。\r\n输入以太网记录器服务进行管理的计算机上运行的主机名和 IP 地址。您也可以通过使用“:”(冒号)连接端口号。 -EM_MAIN_COLUMN_1 网络适配器名 -EM_MAIN_COLUMN_2 状态 -EM_MAIN_OK 操作中 -EM_MAIN_ERROR 错误 -EM_ADD_NEW 添加新捕获的设备 -EM_ADD_EDIT 编辑捕捉设置 -EM_DELETE_CONFIRM 您确定您要删除捕捉设置 "%S" 吗? -EM_NO_LICENSE_COLUMN 注意: -EM_NO_LICENSE 因为甚至没有一个产品许可证被注册,此 SoftEther 以太网记录器将无法操作。 - -EM_UNSUPPORTED 禁用在此操作系统上正在运行的 SoftEther 以太网记录器。对于 SoftEther 以太网记录器可以使用的列表,请参阅 SoftEther 以太网记录器的在线文档。 -EM_WPCAP_REMOTE 为了使用 SoftEther 以太网记录器,你需要安装WinPcap软件。WinPcap 软件目前在服务器计算机上没有安装。\r\n\r\n要继续安装 WinPcap 软件,你必须开启正在运行 VPN Server 的那台服务器计算机上的 SoftEther 以太网记录器管理器,然后再连接到本地主机(您自己的计算机的位置),会显示本地桥功能设置窗口。 \r\n要继续,首先退出管理会话,然后,在服务器计算机上启动 SoftEther 以太网记录器管理器之后,连接到本地主机,并继续设置过程。 -EM_WPCAP_ROOT 为了使用 SoftEther 以太网记录器,你需要安装WinPcap软件。 \r\n\r\n要继续安装,您必须具有管理员权限作为用户登录到这台计算机。\r\n作为管理员登录,重新启动 SoftEther VPN Server 管理器。 -EM_WPCAP_INSTALL 为了使用 SoftEther 以太网记录器,你需要安装WinPcap软件。WinPcap 软件目前在服务器计算机上没有安装。 \r\n\r\nWinPcap 是一个易于安装的免费软件,与 VPN Server 捆绑在一起。\r\n\r\n您要开始安装 WinPcap 吗? -EM_WPCAP_REBOOT1 在 WinPcap 安装完成后,在使用 SoftEther 以太网记录器前,你必须重新启动计算机。\r\n\r\n在您手动重新启动计算机和 SoftEther 以太网记录器后,重新配置设置。 -EM_WPCAP_REBOOT2 在 WinPcap 安装后,你必须重新启动 SoftEther 以太网记录器服务。 \r\n\r\n它仅需要很短的时间重新启动 SoftEther 以太网记录器服务,但是所有当前连接到 SoftEther 以太网记录器的管理会话将被断开。 \r\n此管理会话也将被断开,因此您需要重新连接并继续。\r\n\r\n您是要重新启动 SoftEther 以太网记录器服务吗? -EM_RESOURCE 无法读取 WinPcap 驱动 - - -########################################################################### -# # -# 在软件框中的字符串数据 # -# # -########################################################################### - - -PREFIX D_SECURE -CAPTION %s - %S 的访问 -S_TITLE %S 的访问 -S_DEVICE_INFO 设备名称: %S\r\n制造商: %S -IDS_STATIC1 设备信息 -S_WARNING 要小心输入 PIN 码,因为如果你错误地输入了几次,设备将被锁定。 -IDOK 确定(&O) -IDCANCEL 取消 -S_PIN_CODE &PIN 码: - - -PREFIX D_PKCSUTIL -CAPTION PKCS#12 写入工具 -S_TITLE ePass 1000 USB 令牌 PKCS#12 写入工具 -STATIC1 通过使用此工具,您可以将您选择的 PKCS#12 文件(证书文件)写入 ePass 1000 USB 硬件安全令牌。\r\n\r\n写入证书文件的 USB 可以用于 SoftEther VPN 的身份验证。 -STATIC2 写入 PKCS#12 文件 -STATIC3 要将一个现有的 PKCS#12 文件写入 USB 令牌,单击“写入”。\r\n注意: 如果 USB 令牌中已经存储了 SoftEther VPN 的 PKCS#12 证书,则已存储的文件将被覆盖。 -B_WRITE 写入(&W) -STATIC4 从 USB 令牌擦除 PKCS#12 证书。 -STATIC5 您可以从已存储 SoftEther VPN PKCS#12 证书的 USB 令牌擦除证书数据。 -B_ERASE 擦除(&E) -IDCANCEL 退出工具(&X) -S_COPYRIGHT Copyright (c) SoftEther VPN Project.\r\nAll Rights Reserved. - - -PREFIX D_PASSPHRASE -CAPTION 私人密钥密码 -STATIC1 此私人密钥被密码保护。\r\n\r\n输入密码方可读取密钥。 -STATIC2 密码(&P): -IDOK 确定(&O) -IDCANCEL 取消 - - -PREFIX D_NM_CONNECT -CAPTION 连接到 SoftEther VPN 用户模式路由器 -S_TITLE 正在连接 %S ... - - -PREFIX D_PASSWORD -CAPTION 登录到 %S -S_TITLE 请输入您的用户名和密码以登录到服务端 "%S"。确定您选择了正确的认证类型。 -STATIC1 输入用户信息(&R): -STATIC2 账户类型(&T): -STATIC3 用户名(&N): -STATIC4 密码(&P): -R_NO_SAVE_PASSWORD 不保存密码(&D): -S_COUNTDOWN %u 秒后自动重连... -IDOK 确定(&O) -IDCANCEL 连接取消 - - -PREFIX D_STATUS -CAPTION 正在连接 %s ... -S_STATUS 初始化中... -IDCANCEL 取消 - - -PREFIX D_CERT -CAPTION 证书 -S_TITLE 此证书的信息如下。 -STATIC1 此证书的基本信息: -STATIC2 发给: -STATIC3 发行人: -STATIC4 有效期限: -STATIC5 此证书的高级信息: -STATIC6 签署此证书的当局的证书: -S_PARENT 签署此证书的证书当局的证书已在可信证书列表上注册。 -S_PARENT_BUTTON_STR 查看证书(&V) -IDCANCEL 确定(&O) -B_SAVE 保存文件(&S) - - -PREFIX D_CHECKCERT -CAPTION 安全警告 - %s -S_TITLE 你正在连接到的目标 VPN Server “%S”的连接是加密的,但由服务器提供的服务器证书的可信度是未知的。 -STATIC1 关于服务器证书 -STATIC2 正在 VPN Server 和 VPN Client 之间建立加密通道(SSL 会话)。检查服务器证书可以验证服务器的可靠性。 -S_MSG1 目标 VPN Server "%S" 提供的服务端证书如下。 -STATIC3 发给: -STATIC4 发行人: -STATIC5 有效期限: -B_SHOW 查看证书(&S) -STATIC6 摘要(MD5): -STATIC7 摘要(SHA-1): -IDOK 恢复连接(&R) -IDCANCEL 取消连接(&C) -STATIC8 此证书可能有问题,例如它不是有可信签发单位签发,或证书已过期。 -STATIC9 请确认此证书内容,并决定是否连接到此 VPN Server。单击“取消连接”来中止连接。 - - -PREFIX D_CONNECTERROR -CAPTION 连接错误 - %s -S_TITLE 连接到 VPN Server "%S" 时发生错误。 -S_COUNTDOWN %u 秒后自动重连... -IDOK 重试(&R) -IDCANCEL 连接取消 -R_HIDE 下次连接时隐藏此窗口(&H) - - -PREFIX D_CM_LOGIN -CAPTION 输入密码 - VPN Client 管理器 -S_TITLE 您必须输入客户端管理密码来使用运行在 %s 上的 VPN Client。输入客户端管理密码。 -STATIC1 密码(&P): -STATIC2 输入客户端管理密码: -IDOK 确定(&O) -IDCANCEL 取消 - - -PREFIX D_CONNECTION_STATUS -S_TITLE %s VPN 会话的状态 (实时) -B_POLICY 安全策略(&P)... -B_SERVER_CERT 服务端证书(&S) -B_CLIENT_CERT 客户端证书(&C) -IDCANCEL 关闭(&C) - - -PREFIX D_CM_POLICY -CAPTION 安全策略列表 -S_TITLE 为当前会话 %s 定义的安全策略 -IDCANCEL 关闭(&C) - - -PREFIX D_CM_ACCOUNT -STATIC1 请为 VPN Server 配置 VPN 连接设置。 -S_ACCOUNT_NAME 连接设置名(&N): -STATIC2 目标 VPN Server (&B): -STATIC3 指定目标 VPN Server 上的主机名或 IP 地址,端口号和虚拟 HUB 名。 -STATIC4 主机名(&H): -STATIC5 端口号(&P): -STATIC6 (TCP 端口) -STATIC7 虚拟 HUB 名(&V): -STATIC8 中继代理服务器(&X): -STATIC9 您可以通过代理服务器连接到 VPN Server。 -STATIC10 代理类型(&T): -R_DIRECT_TCP 直接 TCP/IP 连接(无代理)(&D) -R_HTTPS 通过 HTTP 代理服务器连接(&T) -R_SOCKS 通过 SOCKS4 代理服务器连接(&S) -R_SOCKS5 通过 SOCKS5 代理服务器连接(&S) -B_PROXY_CONFIG 代理服务器设置(&R) -STATIC11 服务端证书验证选项(&F): -R_CHECK_CERT 总是验证服务端证书(&C) -B_TRUST 管理可信发证机关证书列表(&C) -B_SERVER_CERT 指定特定证书(&S) -B_VIEW_SERVER_CERT 查看特定证书(&V) -S_VLAN_GROUP 使用虚拟网络适配器(&L): -S_POLICY_1 您可以配置将应用到级联虚拟 HUB 侧的安全策略。 -B_POLICY 安全策略(&L) -STATIC12 用户认证设置(&A): -STATIC13 认证类型(&T): -S_USERNAME 用户名(&U): -S_PASSWORD 密码(&Y): -S_CERT_INFO 您必须为用户认证指定一个客户端证书。 -STATIC14 通信的高级设置(&E): -R_RETRY 断开后自动重连(&Z) -S_RETRY_NUM_1 重连次数(&C): -S_RETRY_NUM_2 次 -S_RETRY_SPAN_1 重连间隔(&K): -S_RETRY_SPAN_2 秒 -R_INFINITE 无限重连(总是保持 VPN 在线) (&I) -B_DETAIL 高级设置(&D)... -IDOK 确定(&O) -IDCANCEL 取消 -B_CHANGE_PASSWORD 变更密码(&P) -S_CHANGE_PASSWORD 您可以在 VPN Server 上更改用户密码。 -R_HIDE 隐藏和错误窗口(&D) -R_HIDE2 隐藏 IP 地址屏幕(&O) -STATIC15 请设置连接到 VPN Server 时需要的用户认证信息。 -B_REGIST_CLIENT_CERT 指定客户端证书(&C) -B_IE 导入I&E代理服务器设置 -R_DISABLE_NATT 禁用 NAT-T - - -PREFIX D_CM_PROXY -CAPTION 代理服务器连接设置 -STATIC1 输入中继代理服务器 (HTTP 代理或 SOCKS 代理) 的主机名,IP 地址,端口,如果需要,请输入用户名和密码。 -STATIC2 主机名(&H): -STATIC3 端口(&A): -STATIC4 用户名(&U): -STATIC5 密码(&P): -B_HTTP_HEADER Custom HTTP header values -IDOK 确定(&O) -IDCANCEL 取消 -STATIC6 (可选) -STATIC7 (可选) - - -PREFIX D_CM_PROXY_HTTP_HEADER -CAPTION Custom Proxy HTTP Header Values -B_NEW New -B_DELETE Delete -B_CLEAR Clear -IDOK &OK -IDCANCEL Cancel - - -PREFIX D_CM_DETAIL -CAPTION 高级设置 -STATIC1 为系统管理员,和在网络,通信协议,安全方面有一定了解的用户提供了可选择的设置。可以由此来自定义 VPN 通信协议设置。为系统管理员和专家在网络、通信协议和安全方面提供可选设置。自定义 VPN 协议的通信设置。 -STATIC2 VPN 通信的最优化(&T): -STATIC3 使用多个物理 TCP 连接聚合为一个逻辑 VPN 连接,以提高通信吞吐量。 -STATIC4 TCP 连接数(&N): -STATIC5 连接数 -STATIC6 ※ 注意: 建议宽带线路开 8 个连接,低速线路开 1 个连接 (例如拨号)。 -STATIC7 高级设置: -STATIC8 建立间隔(&S): -STATIC9 秒 -R_USE_DISCONNECT 设置每个 TCP 的连接寿命(&A) -STATIC10 寿命(&P): -STATIC11 秒 -STATIC12 当使用两个或以上 TCP 连接时,可以使用 "半双工模式"。半双工模式下固定了每个 TCP 连接的数据方向。例如,当使用 8 个 TCP 连接建立一个 VPN 时,VPN 隧道的物理结构将被固定为: 4 个 TCP 连接专用于上行方向,其余 4 个连接专用于下行方向。 -R_USE_HALF_CONNECTION 使用半双工模式(&H) -STATIC13 加密和压缩(&C): -STATIC14 通常 VPN 会话为安全起见会被加密。您也可以禁用加密以提高吞吐量。请注意,在禁用加密的情况下,数据在网络上是以明文方式传输的。 -R_USE_ENCRYPT 使用 SSL 加密 VPN 会话(&E) -STATIC15 您可以使用数据压缩以节省 VPN 的通信带宽。当使用较慢的连接如拨号或移动连接时,启用此选项。 -R_DISABLE_UDP 禁用 UDP 加速功能功能(&P) -R_USE_COMPRESS 使用数据压缩(&U) -STATIC16 连接模式设置(&M): -S_MODE 您可以指定如下连接模式。(供网络管理员选择) -R_BRIDGE 网桥/路由器模式(&B) -R_MONITOR 监控模式(&D) -STATIC17 其它配置(&G): -R_NO_ROUTING 不要调整路由表(&R) -STATIC18 除非你得到系统管理员的同意或者你有网络和安全方面的专业知识,否则请保持此对话框的默认设置。 -STATIC19 VoIP / QoS 功能可以处理高优先级数据包,如 IP 电话数据包 (VoIP) 可以被更快的传输。 -R_DISABLE_QOS 禁用 VoIP / &QoS 功能 -IDOK 确定(&O) -IDCANCEL 取消 -S_UDPACCEL 您可以使用数据压缩以节省 VPN 通信带宽。当使用慢速连接时,如拨号或移动连接,启用此选项。 - - -PREFIX D_CM_NEW_VLAN -CAPTION 创建新虚拟网络适配器 -S_INFO 一个新虚拟网络适配器将被被创建到系统中。\r\n您可以为此虚拟网络适配器指定最长不超过 %u 个字母和数字的名称。 -STATIC1 虚拟网络适配器名(&N): -IDOK 确定(&O) -IDCANCEL 取消 -S_WIN8 请注明 "VPN" 或 "VPN2" 直到 "VPN127" 作为新的虚拟网络适配器的名称 (最多 127 个适配器可以被创建)。 - - -PREFIX D_CM_TRUST -CAPTION 管理信任的证书签发机构的列表 -STATIC1 您可以在这里管理认证授权(CA)证书列表。\r\n\r\n当连接到 VPN Server 时,您可以使用在此注册的 CA 证书来验证服务端证书。 -B_IMPORT 添加(&A) -B_EXPORT 导出(&E) -IDOK 查看证书(&V) -IDCANCEL 关闭(&C) -B_DELETE 删除(&D) - - -PREFIX D_CM_PASSWORD -CAPTION 设置密码 - VPN Client 管理器 -S_TITLE 您可以设置密码来限制此 SoftEther VPN Client 服务。\r\n设置密码后,在下次使用 VPN Client 连接管理器到 SoftEther VPN Client 服务时,您将被被要求输入密码。 -STATIC1 设置客户端管理密码: -R_USE_PASSWORD 使用密码(&U) -R_REMOTE_ONLY 仅在远程操作时需要密码(&R) -IDC_STATIC1 密码(&P): -IDC_STATIC2 确定(&E): -IDOK 确定(&O) -IDCANCEL 取消 - - -PREFIX D_CM_CONFIG -CAPTION 可选设置 -STATIC1 您可以更改 VPN Client 的设置 -STATIC2 远程管理(&E) -STATIC3 您可以通过使用 VPN Client 管理器远程模式从另一台计算机上远程管理 VPN Client 服务程序。 -R_ALLOW_REMOTE_CONFIG 允许 VPN Client 服务的远程管理(&R) -S_WARNING 建议您在允许远程管理时设置密码。在菜单里选择“工具” >“设置密码”来设置密码。 -STATIC4 在通讯闲置一段时间后自动断开互联网连接的环境下,可以通过向互联网上任意主机发送假数据包的方式来保持互联网连接。 -R_USE_KEEP_CONNECT 使用保持 Internet 连接功能(&K) -S_HOSTNAME 主机名(&H): -S_PORT 端口号(&P): -S_INTERVAL 数据包发送间隔(&I): -S_INTERVAL2 秒每数据包 -S_PROTOCOL 协议(&O): -R_TCP TCP/IP 协议(&T) -R_UDP UDP/IP 协议(&U) -S_INFO 发送的保持互联网连接的数据包大小随机,无个人信息被发送。 -IDOK 确定(&O) -IDCANCEL 取消 -STATIC5 其它配置(&O) -R_ALPHA 用户界面透明(&A) -STATIC6 ※注意:透明设置将在连接管理器重启后生效。 -STATIC7 保持互联网连接功能(&K) - - -PREFIX D_ABOUT -S_INFO1 SoftEther VPN %u.0 Developer Edition (Ver %u.%02u, Build %u) -S_INFO2 Licensed under the Apache License, Version 2.0.\r\nCopyright (c) 2012-%u all contributors on SoftEther VPN project in GitHub. All Rights Reserved.\r\nWeb Site: http://www.softether.org/\r\n%S -S_INFO3 This product includes the following software components:\r\nBitVisor: Copyright (c) 2007, 2008 University of Tsukuba. Copyright (C) 2007, 2008 National Institute of Information and Communications Technology. All rights reserved. / Microsoft(R) C Runtime Library: (c) 2007 Microsoft Corporation. All Rights Reserved. / PKCS #11 Cryptographic Token Interface (Cryptoki): Copyright (c) RSA Security Inc. / WinPcap: Copyright (c) 2001 - 2003 NetGroup, Politecnico di Torino (Italy). All rights reserved. / libedit: Copyright (c) 1992, 1993 The Regents of the University of California. All rights reserved. / libiconv: Copyright (C) 2007 Free Software Foundation, Inc. / ncurses: Copyright (c) 1998-2005, 2006 Free Software Foundation, Inc. / OpenSSL: Copyright (c) 1998-2011 The OpenSSL Project. All rights reserved. This product includes software developed by the OpenSSL Project for use in the OpenSSL Toolkit (http://www.openssl.org/). This product includes cryptographic software written by Eric Young (eay@cryptsoft.com). / zlib: (C) 1995-2004 Jean-loup Gailly and Mark Adler. / Special Thanks to: Software Laboratory, Academic Computing Communication Center, Industrial Liaison and Cooperative Research Center and Professor Yasushi Shinjo in University of Tsukuba, Japan. -S_INFO4 此 VPN 服务器作为的一个学术研究且由 (http://www.softether.org/) 为公众利益免费发布的。本软件是日本筑波大学 SoftEther 项目下开发的免费软件,无任何担保。开发人员、版权所有者或分销商在任何情况下对于使用本软件的任何索赔、损害赔偿或其他情况不承担责任。\r\n\r\nSoftEther VPN 是日本政府的研究和开发项目的一项工作,由日本的经济、贸易和工业部资助,由信息化推进机构管理。 -IDCANCEL 确定(&O) -B_WEB 访问 SoftEther VPN 和网站 (&W)... -B_EULA 最终用户许可 -B_IMPORTANT 重要启事 -B_LEGAL 法律启事 -B_UPDATE_CONFIG 配置更新 -B_AUTHORS 作者名单 - - -PREFIX D_REMOTE -STATIC1 指定目标计算机主机名或 IP 地址(&S): -R_LOCAL 连接到本地计算机 (此窗口中显示的计算机) (&L) -S_HOSTNAME 计算机名(&C): -IDOK 确定(&O) -IDCANCEL 取消 - - -PREFIX D_CM_DESKTOP -CAPTION 连接 - %s -S_TITLE VPN 连接设置 "%s" 的连接进程启动中。 -S_WARNING VPN Client 会将连接到 VPN Server 过程中的连接状态和错误信息输出到 %s 的“控制台进程”窗口。 -S_INFO 可以继续连接吗? -IDOK 继续(&C) -IDCANCEL 取消 - - -PREFIX D_CM_CHANGE_PASSWORD -CAPTION 更改密码 -S_TITLE 您可以更改服务端 %S 上注册的用户密码。 -STATIC1 更改密码(&P) -STATIC2 虚拟 HUB 名(&H): -STATIC3 用户名(&U): -STATIC4 旧密码(&O): -STATIC5 新密码(&N): -STATIC6 确认新密码(&C): -IDOK 确定(&O) -IDCANCEL 取消 -S_STATIC ※注意: 如果认证类型是 RADIUS 或 NT 域认证,您不能更改用户密码。 - - -PREFIX D_SM_MAIN -CAPTION SoftEther VPN Server 管理器 Developer Edition -STATIC1 SoftEther VPN Server 连接设置(&S): -STATIC2 VPN Server 或 VPN Bridge 的连接设置被定义如下。双击该项以连接到服务端。\r\n要添加新连接,单击“新设置”。 -B_NEW_SETTING 新设置(&N) -B_EDIT_SETTING 编辑设置(&E) -B_DELETE 删除设置(&D) -IDOK 连接(&C) -B_SECURE_MANAGER 智能卡管理器(&S)... -B_SELECT_SECURE 选择智能卡(&M)... -B_ABOUT 版本信息(&A)... -IDCANCEL 退出 SoftEther VPN Server 管理器(&X) -B_CERT_TOOL 制作证书 - - - -PREFIX D_SM_EDIT_SETTING -STATIC1 请配置要管理的 VPN Server 或 VPN Bridge 的连接设置 -STATIC2 设置名(&N): -STATIC3 目标 VPN Server (&B): -STATIC4 指定目标 VPN Server 的主机名或 IP 地址、端口号和虚拟 HUB。 -STATIC5 主机名(&H): -R_LOCALHOST 连接到本地主机(localhost)(&L) -STATIC6 端口号(&P): -STATIC7 (TCP 端口) -STATIC8 中继代理服务器(&X): -STATIC9 您可以通过代理服务器连接到 VPN Server。 -STATIC10 代理类型(&T): -R_DIRECT_TCP 直接 TCP/IP 连接 (无代理) (&D) -R_HTTPS 通过 HTTP 代理服务器连接(&T) -R_SOCKS 通过 SOCKS4 代理服务器连接(&O) -R_SOCKS5 通过 SOCKS4 代理服务器连接(&O) -B_PROXY_CONFIG 代理服务器设置(&R) -STATIC11 选择管理模式并输入密码(&M) -STATIC12 您可以使用服务端管理模式或虚拟 HUB 管理模式连接到 VPN Server。\r\n\r\n服务器管理模式允许您管理整个 VPN Server 和所有虚拟 HUB 。\r\n\r\n虚拟 HUB 管理模式允许您只能管理您拥有权限的一个虚拟 HUB 。 -R_SERVER_ADMIN 服务端管理模式(&S) -R_HUB_ADMIN 虚拟 HUB 管理模式(&U) -S_HUBNAME 虚拟 HUB 名(&V): -STATIC13 请输入密码连接管理模式。 -S_PASSWORD 密码(&P): -R_NO_SAVE 不保存管理密码(&S) -IDOK 确定(&O) -IDCANCEL 取消 - - -PREFIX D_SM_SERVER -CAPTION %s - SoftEther VPN Server 管理器 -S_TITLE 管理 VPN Server "%S" -S_VHUB_BRIDGE 通过此 VPN Server 托管的虚拟 HUB (&Z): -IDOK 管理虚拟 HUB (&A) -B_ONLINE 在线(&O) -B_OFFLINE 离线(&F) -B_HUB_STATUS 查看状态(&S) -B_CREATE 创建虚拟 HUB (&C) -B_EDIT 属性(&E) -B_DELETE 删除(&D) -STATIC1 管理监听器(&L) -STATIC2 监听器列表 (TCP/IP 端口) (&I): -B_CREATE_LISTENER 创建(&R) -B_DELETE_LISTENER 删除(&T) -B_START 开始(&G) -B_STOP 停止(&P) -S_UDP Multiple UDP ports can be specified by splitting them with a space or a comma. Leave empty to disable the UDP listener. -B_APPLY Apply -STATIC3 VPN Server 和网络信息和设置(&N) -B_SSL 加密与网络(&E) -B_STATUS 查看服务器状态(&V) -B_INFO 关于此 VPN Server 的信息 -B_LICENSE 添加 / 删除许可证(&L) -B_FARM 群集配置(&M) -B_FARM_STATUS 群集状态(&Z) -B_CONNECTION 显示 TCP/IP \r\n连接列表(&Y) -B_BRIDGE 本地网桥设置(&B) -B_L3 3 层交换机设置(&3) -B_CONFIG 编辑设置(&D) -B_REFRESH 刷新(&H) -IDCANCEL 关闭(&X) -S_BETA 测试版 (预发行) -B_IPSEC IPsec / L&2TP 设置 -B_DDNS 动态 DNS 设置 -S_DDNS 当前 DDNS 主机名: -B_OPENVPN OpenVPN / MS-SSTP 设置 -B_AZURE VPN Azure 设置 -S_AZURE VPN Azure 主机名: -B_VPNGATE VPN Gate 设置 - - -PREFIX D_SM_STATUS -IDOK 刷新(&H) -IDCANCEL 关闭(&X) - - -PREFIX D_SM_EDIT_HUB -STATIC1 虚拟 HUB 名(&N): -STATIC2 安全设置(&S): -S_BOLD 管理此虚拟 HUB 的密码 -STATIC3 密码(&P): -STATIC4 确定(&C): -R_NO_ENUM 不要向匿名用户枚举 (&U) -STATIC5 虚拟 HUB 选项(&I): -R_LIMIT_MAX_SESSION 最大 VPN 会话数限制(&L) -S_MAX_SESSION_1 最大会话数(&X): -S_MAX_SESSION_2 会话 -STATIC6 (不计算本地桥、虚拟 NAT 或级联产生的服务端虚拟会话数) -STATIC7 虚拟 HUB 状态(&J): -STATIC8 设置虚拟 HUB 状态。 -R_ONLINE 在线(&E) -R_OFFLINE 离线(&F) -STATIC9 设置群集(&M): -S_FARM_INFO 选择群集内虚拟 HUB 类型。 -R_STATIC 静态虚拟 HUB (&A) -R_DYNAMIC 动态虚拟 HUB (&D) -S_AO_1 虚拟 HUB 管理选项(&Y): -S_AO_3 显示并编辑虚拟 HUB 管理选项。 -B_ADMINOPTION 虚拟 HUB 管理选项(&K) -S_ACL_3 源 IP 访问限制列表(&R): -S_ACL 根据客户端计算机的 IP 地址允许或拒绝到此虚拟 HUB 的 VPN 连接。 -B_ACL IP 访问控制列表(&T) -IDOK 确定(&O) -IDCANCEL 取消 -STATIC10 您可以在虚拟 HUB 扩展选项列表中配置更高级的设置。 -B_EXTOPTION 编辑虚拟 HUB 扩展选项列表(&X) -S_MSG_1 当客户端连接时,显示信息。 -S_MSG_2 当 VPN Client 连接到这个虚拟 HUB 时,显示在屏幕上一个用户信息。 -B_MSG 信息设置(&M) - - -PREFIX D_SM_CREATE_LISTENER -CAPTION 创建监听器 -STATIC1 您可以为 VPN Server 添加一个 TCP/IP 端口号,来接收从客户端来的连接。\r\n\r\n请指定要添加的端口号。 -STATIC2 如果端口号已经被其它服务端程序使用,则新监听器的状态将被被更改为错误状态。\r\n\r\n此时,请停止打开相同端口的其他程序。 -STATIC3 端口号(&P): -IDOK 确定(&O) -IDCANCEL 取消 -STATIC4 (TCP/IP 端口) - - -PREFIX D_SM_SSL -CAPTION 加密和网络设置 -STATIC1 您可以查看或更改此 VPN Server 上与加密、通信和安全相关的设置。 -STATIC2 加密算法设置(&A): -STATIC3 指定与此 VPN Server 和 VPN Client 连接中使用的 SSL 加密算法名。此加密算法必须与 SSL 版本 3 相兼容。 -STATIC4 加密算法名(&C): -STATIC6 服务端证书设置(&C): -STATIC7 指定 X509 证书和私钥提交给这台服务器的客户端。 -B_IMPORT 导入(&I) -B_EXPORT 导出(&X) -B_VIEW 查看(&V) -B_REGENERATE 新的 -STATIC8 保持互联网连接活跃着(&K): -STATIC9 在闲置一段时间后自动断线的环境下,可以通过向互联网上任意主机发送假数据包的方式来保持互联网连接。 -STATIC10 服务器证书: -R_USE_KEEP_CONNECT 使用并保持互联网的连接(&K) -S_HOSTNAME 主机名(&H): -S_PORT 端口号(&P): -S_INTERVAL 发送间隔(&I): -S_INTERVAL2 秒 -S_PROTOCOL 协议(&O): -R_TCP TCP/IP 协议(&T) -R_UDP UDP/IP 协议(&U) -S_INFO 发送并保持互联网连接的数据包大小随机,无个人信息被发送。 -STATIC11 管理员密码(&W): -S_INFO4 您可以修改所有虚拟 HUB 和整个 VPN Server 的管理员密码。 -B_PASSWORD 更改管理员密码(&P) -IDOK 确定(&O) -IDCANCEL 取消 -IDCANCEL2 取消 -STATIC12 syslog 发送功能: -STATIC13 您可以通过使用 syslog 协议传输整个 VPN Server / Bridge 日志,虚拟 HUB 管理日志或虚拟 HUB 数据包日志,而不是写入本地磁盘。 -STATIC14 syslog 服务端主机名(&S): -STATIC15 端口号(&O): -S_OVER_FUNCS VPN over ICMP / DNS 服务器功能 -S_INFO5 您可以建立一个仅用 ICMP 或 DNS 数据包的 VPN ,即使有防火墙或路由器阻止 TCP/IP 通讯。 -B_SPECIALLISTENER VPN over ICMP / DNS 设置 -B_UPDATE_CONFIG 更新通知设置...(&U) - -PREFIX D_SM_SAVE_KEY_PAIR -CAPTION 保存证书和密钥 -STATIC1 请选择保存证书和密钥的方法。 -STATIC2 保存方法(&V): -R_X509_AND_KEY 保存为 X509 证书 (.CER) 和密钥文件 (.KEY) (&X) -R_PKCS12 保存为 PKCS#12 文件 (.P12) (&P) -R_SECURE 写入智能卡(&S) -STATIC3 切割成两个文件保存: 一个标准 Base 64 编码证书文件和一个密钥文件。 -STATIC4 保存为 PKCS#12 (Public Key Cryptography Standard #12) 文件。\r\n您可以将证书和密钥保存到一个 PKCS#12 文件中。 -STATIC5 当智能卡连接到此计算机时,您可以向智能卡中写入证书和密钥。 -B_SELECT 选择要使用的智能卡(&S)... -S_PASS3 密钥保护(&R) -S_PASS4 当保存密钥时,您可以设置一个密码来加密。您当加载它时,你将被要求输入密码。 -R_USE_PASS 设置密码(&A) -S_PASS1 密码(&S): -S_PASS2 确定(&E): -IDOK 确定(&O) -IDCANCEL 取消 -B_SECURE_MANAGER 智能卡管理器(&M)... - - -PREFIX D_SM_CONNECTION -CAPTION 连接列表 -S_TITLE 服务端 %S 有如下活跃的连接。注意,不包括作为 VPN 会话已建立的连接。 -IDOK 显示连接信息(&I) -B_DISCONNECT 断开(&D) -B_REFRESH 刷新(&H) -IDCANCEL 关闭(&X) - - -PREFIX D_SM_FARM -CAPTION 群集配置 -S_TITLE 您可以变更 VPN Server "%S" 的群集功能配置。 -STATIC1 群集功能可以实现负载均衡和故障平衡保护来捆绑多个 VPN Server。 -STATIC2 当前模式: -STATIC3 群集设置(&T): -R_STANDALONE 独立服务端(非群集) (&S) -R_CONTROLLER 群集控制器(&C) -R_MEMBER 群集成员服务器(&M) -STATIC4 群集成员服务器配置参数(&O): -S_IP_1 公网 IP 地址(&I): -S_IP_2 (当公网 IP 地址省略时,将会使用连接群集控制器时使用的网络接口 IP 地址。) -S_PORT_1 公网端口列表(&P): -S_PORT_2 (多个端口号用空格或逗号分隔。) -S_CONTROLLER 控制器的主机名或 IP 地址(&H): -S_CONTROLLER_PORT 控制器的\r\n端口号(&R): -S_PORT_3 (TCP 端口) -S_PASSWORD 管理密码(&P): -STATIC5 当您修改群集配置时,VPN Server 的服务自动重启。此时,所有当前正在连接的会话和管理相关的连接将被断开。 -IDOK 确定(&O) -IDCANCEL 取消 -S_1 群机内的标准比例(&W): -S_2 (标准: 100) -R_CONTROLLER_ONLY 仅控制器功能 (本身没有 VPN 会话) - - -PREFIX D_SM_FARM_MEMBER -CAPTION 群集成员列表 -S_TITLE 当前下列群集成员服务端连接到群集控制器 %S。 -IDOK 群集成员服务端信息(&I) -B_REFRESH 刷新(&H) -IDCANCEL 关闭(&X) -B_CERT 查看服务端证书(&C) - - -PREFIX D_SM_CHANGE_PASSWORD -CAPTION 更改 %S 的管理员密码 -S_TITLE 更改服务端 %S 的管理员密码。输入密码后请单击“确定”。 -STATIC1 新密码(&P): -STATIC2 确认密码(&C): -IDOK 确定(&O) -IDCANCEL 取消 - - -PREFIX D_SM_HUB -CAPTION 管理虚拟 HUB - %S -S_TITLE 虚拟 HUB "%S" -STATIC1 管理安全数据库(&D): -B_USER 管理用户(&U) -S_USER 添加,删除或编辑用户账户。 -B_GROUP 管理组(&G) -S_GROUP 添加,删除或编辑组。 -B_ACCESS 管理访问列表(&A) -S_ACCESS 添加或删除访问列表 (数据包过滤规则)。 -STATIC2 虚拟 HUB 设置(&N) -B_PROPERTY 虚拟 HUB 属性(&P) -S_PROPERTY 配置此 HUB -B_RADIUS 认证服务端设置(&E) -S_RADIUS 使用外部 RADIUS 认证服务器作为用户认证。 -B_LINK 管理级联连接(&C) -S_LINK 在本地或远程 VPN Server 上建立到 HUB 的级联连接。 -STATIC3 此虚拟 HUB 当前状态(&R): -B_REFRESH 刷新(&H) -STATIC4 其它设置(&O) -B_LOG 日志保存设置(&L) -B_LOG_FILE 日志文件列表(&Q) -S_LOG 配置日志保存功能的设置。 -B_CA 可信的 CA 证书(&T) -B_CRL 无效证书(&K) -S_CA 管理可信的 CA 证书。 -B_SNAT 虚拟 NAT 和虚拟 DHCP 服务器(&V) -S_SNAT SecureNAT 在此虚拟 HUB 上可用。您可以运行虚拟 NAT 和虚拟 DHCP。 -STATIC5 VPN 会话管理(&I): -B_SESSION 管理会话(&S) -IDCANCEL 关闭(&X) - - -PREFIX D_SM_USER -CAPTION 管理用户 -S_TITLE 虚拟 HUB "%S" 有如下用户。 -IDOK 编辑(&E) -B_CREATE 新建(&C) -B_DELETE 移除(&D) -B_REFRESH 刷新(&H) -IDCANCEL 关闭(&X) -B_STATUS 查看用户信息(&V) - - -PREFIX D_SM_EDIT_USER -IDC_STATIC1 用户名(&U): -IDC_STATIC3 全名(&F): -IDC_STATIC4 说明(&N): -IDC_STATIC5 组名\r\n(可选): -B_GROUP 浏览组(&J)... -R_EXPIRES 设置此账户有效期限(&S) -IDC_STATIC6 验证类型(&A): -S_RADIUS_3 RADIUS 或 NT 域认证设置 -S_RADIUS_1 通过密码的登录尝试通过外部 RADIUS 服务端,Windows NT 域控制器或 Active Directory 控制器被验证。 -R_SET_RADIUS_USERNAME 指定认证服务器的用户名(&K) -S_RADIUS_2 认证服务端上的用户名(&W): -S_POLICY_1 安全策略 -R_POLICY 设置安全策略(&Y) -B_POLICY 安全策略 -S_PASSWORD_1 密码认证设置 -S_PASSWORD_2 密码(&P): -S_PASSWORD_3 确认密码(&C): -S_USER_CERT_1 特定证书认证设置 -B_LOAD_CERT 指定证书(&E) -B_VIEW_CERT 查看证书(&V) -B_CREATE 创建证书(&W) -S_ROOT_CERT_1 已签名证书认证设置 -S_ROOT_CERT_2 验证客户端证书是否已签名是基于一份由虚拟 HUB 信任的 CA 证书。 -R_CN 证书的 Common Name (CN) 限制值(&B) -R_SERIAL 证书序列号的限制值(&L) -S_ROOT_CERT_3 ※ 注意: 请输入十六进制数值。(例如: 0155ABCDEF) -S_HINT 提示:使用用户名“*”(星号)定义一个用户对象,以接受不符合任何已注册的、明确的、用户对象的登录尝试。这样一个特殊的用户将使用外部用户认证服务器验证登录。 -IDOK 确定(&O) -IDCANCEL 取消 - - -PREFIX D_SM_POLICY -STATIC1 已选择策略(&P): -S_BOLD 此策略的描述(&C): -S_BOLD2 当前值(&V): -R_ENABLE 启用此策略(&E) -R_DISABLE 禁用此策略(&D) -R_DEFINE 定义此策略(&F) -IDOK 确定(&O) -IDCANCEL 取消 - - -PREFIX D_SM_GROUP -CAPTION 管理组 -S_TITLE 虚拟 HUB "%S" 有如下组 -B_CREATE 新建(&C) -IDOK 编辑(&E) -B_DELETE 移除(&R) -B_REFRESH 刷新(&R) -B_USER 成员列表(&M) -IDCANCEL 关闭(&X) - - -PREFIX D_SM_EDIT_GROUP -IDC_STATIC1 组名称(&G): -IDC_STATIC3 全名(&F): -IDC_STATIC4 说明(&N): -S_POLICY_1 安全策略 -R_POLICY 设置此组的安全策略(&Y) -B_POLICY 安全策略(&M) -S_POLICY_2 组统计信息 -IDOK 确定(&O) -IDCANCEL 取消 - - -PREFIX D_SM_ACCESS_LIST -CAPTION 访问列表 -S_TITLE 虚拟 HUB "%S" 有如下访问列表(数据包过滤规则)。 -B_ADD 新建(IPv&4) -B_ADD_V6 新建(IPv&6) -IDOK 编辑(&E) -B_DELETE 删除(&D) -B_SAVE 保存(&S) -IDCANCEL 取消(&C) -STATIC1 较高权限的项目出现在列表的上方。 -STATIC2 注意: 与访问列表项目不匹配的 IP 数据包可以通行。 -B_CLONE 克隆 -B_ENABLE 启用 -B_DISABLE 禁用 - -PREFIX D_SM_EDIT_ACCESS -CAPTION 编辑访问列表项目 -STATIC1 配置访问列表设置。此处定义的访问列表将被应用于所有穿过虚拟 HUB 的 IP 数据包。 -STATIC2 基础设置 -STATIC3 备忘(&N): -STATIC4 行为(&A): -R_PASS 通过(&P) -R_DISCARD 废弃(&D) -STATIC5 优先级(&R): -STATIC6 (较小值有更高优先权。) -STATIC7 IP 包头的过滤选项 -S_ACCESS_SRC_ALL 源 IP 地址: -R_SRC_ALL 应用到所有源地址 -S_SRC_IP_1 IPv4 地址: -S_SRC_IP_2 子网掩码: -S_SRC_IP_3 (255.255.255.255: 意为单个主机) -S_SRC_IP_1_V6 IPv6 地址: -S_SRC_IP_3_V6 (例如: "ffff:ff00::" 或 "/24"。"/128" 仅指该唯一主机) -S_ACCESS_DST_ALL 目标 IP 地址: -R_DST_ALL 应用到所有目标地址 -S_IP_DST_1 IPv4 地址: -S_IP_DST_2 子网掩码: -S_IP_DST_3 (255.255.255.255: 仅指特定主机) -S_IP_DST_1_V6 IPv6 地址: -S_IP_DST_3_V6 (例如: "ffff:ff00::" 或 "/24"。"/128" 指该唯一主机:) -STATIC9 协议类型: -STATIC10 TCP 包头和 UDP 包头的过滤选项 -S_TCP_1 最小值 -S_TCP_2 最大值 -S_TCP_3 源端口号: -S_TCP_5 目标端口号: -S_TCP_7 空白端口号字段匹配任何端口。当已指定的最小值但没指定最大值时,将应用于只符合最小值的数据包。 -STATIC11 用户/用户組过滤器选项 -STATIC11_OLD 用户过滤器选项 -STATIC12 此访问列表仅应用于具体的用户 / 用户組发出或接收的数据包。 -STATIC12_OLD 此访问列表仅应用于具体的用户发出或接收的数据包。 -STATIC13 源名称: -B_USER1 浏览... -STATIC14 目标名称: -B_USER2 浏览... -STATIC15 若不指定用户还是組,请保留这些字段为空白。 -STATIC15_OLD 若无法指定用户名称,请保持本栏目空白。 -IDOK 确定(&O) -IDCANCEL 取消 -S_PROTOID 指定 IP 协议: -STATIC16 MAC 包头的过滤选项: -S_CHECK_SRC_MAC 源 MAC 地址: -R_CHECK_SRC_MAC 应用到任一源地址 -S_SRC_MAC MAC 地址: -S_SRC_MAC_MASK 掩码: -S_CHECK_DST_MAC 目标 MAC 地址: -R_CHECK_DST_MAC 应用于任一目标地址 -B_SIMULATION 延迟和丢包(&D)... -S_DST_MAC MAC 地址: -S_DST_MAC_MASK 掩码: -S_MAC_NOTE 您可以使用带有两种分隔符'-',或 ':',或不带分隔符的十六进制数字。\r\n(FF-FF-FF-FF-FF-FF 意为指定的主机) -R_CHECK_TCP_STATE 验证 TCP 连接状态(仅 TCP 数据包) -R_ESTABLISHED 已建立的数据包 -R_UNESTABLISHED 未建立的数据包 -R_REDIRECT 重定向 HTTP 请求至特定 URL -B_REDIRECT 设置 URL 重定向至 - -PREFIX D_SM_RADIUS -CAPTION 认证服务器设置 -S_TITLE 使用外部的 RADIUS 服务器来验证到虚拟 HUB “%S”的登录尝试。指定一个外部 RADIUS 服务器来验证用户名和密码。 -STATIC1 RADIUS 服务端设置(&F): -R_USE_RADIUS 使用 RADIUS 认证(&U) -S_RADIUS_1 RADIUS 服务端主机名或 IP 地址(&S): -S_RADIUS_2 端口(&P): -S_RADIUS3 (UDP 端口) -S_RADIUS_4 共享秘密(&E): -S_RADIUS_5 确认共享秘密(&C): -S_RADIUS_6 RADIUS 服务器必须接受从 VPN Server 的 IP 地址来的请求。而且,必须启用密码认证协议(PAP)。 -S_RADIUS_7 毫秒 (大于 %u, 小于%u) -S_RADIUS_8 重试间隔(&R): -S_RADIUS_9 (使用“,”或“;”来分开多个主机名) -STATIC2 当使用 Windows NT 域控制器或 Windows Server Active Directory 控制器作为外部认证服务器时,您必须设置 VPN Server 的计算机加入到域中。使用 NT 域认证,在此不需要进行配置。 -IDOK 确定(&O) -IDCANCEL 取消 - - -PREFIX D_SM_LINK -CAPTION %S 上的级联连接 -STATIC1 级联连接可以在 2 层以太网将本虚拟 HUB 与另外一台位于本地或者远程 VPN Server 上的虚拟 HUB 建立链接。 -STATIC2 级联连接使用前 -STATIC3 级联连接实现了在多个虚拟 HUB 间的二层桥接。但如果连接配置不正确,可能会无意中创建一个无限循环。当使用级联连接功能时,请小心设计网络拓扑。 -B_CREATE 新建(&C) -B_EDIT 编辑(&E) -B_ONLINE 在线(&N) -B_OFFLINE 离线(&F) -IDOK 状态(&S) -B_DELETE 删除(&D) -B_RENAME 重命名(&A) -B_REFRESH 刷新(&R) -IDCANCEL 关闭(&X) - - -PREFIX D_SM_LOG -CAPTION 日志保存设置 -S_TITLE 您可以保存虚拟 HUB "%S"的安全日志 (如用户登录记录) 和所有经过虚拟 HUB 的数据包的数据包日志。 -STATIC1 安全日志(&S): -B_SEC 保存安全日志(&E) -S_SEC 日志文件切换周期(&W): -STATIC2 数据包日志(&P): -B_PACKET 保存数据包日志(&E) -S_PACKET 日志文件切换周期(&W): -S_PACKET_0 TCP 连接: -B_PACKET_0_0 不保存 -B_PACKET_0_1 仅包头 -B_PACKET_0_2 包头和有效载荷 -S_PACKET_1 TCP 数据包: -B_PACKET_1_0 不保存 -B_PACKET_1_1 仅包头 -B_PACKET_1_2 包头和有效载荷 -S_PACKET_2 DHCP 数据包: -B_PACKET_2_0 不保存 -B_PACKET_2_1 仅包头 -B_PACKET_2_2 包头和有效载荷 -S_PACKET_3 UDP 数据包: -B_PACKET_3_0 不保存 -B_PACKET_3_1 仅包头 -B_PACKET_3_2 包头和有效载荷 -S_PACKET_4 ICMP 数据包: -B_PACKET_4_0 不保存 -B_PACKET_4_1 仅包头 -B_PACKET_4_2 包头和有效载荷 -S_PACKET_5 IP 数据包: -B_PACKET_5_0 不保存 -B_PACKET_5_1 仅包头 -B_PACKET_5_2 包头和有效载荷 -S_PACKET_6 ARP 数据包: -B_PACKET_6_0 不保存 -B_PACKET_6_1 仅包头 -B_PACKET_6_2 包头和有效载荷 -S_PACKET_7 以太网\r\n数据包: -B_PACKET_7_0 不保存 -B_PACKET_7_1 仅包头 -B_PACKET_7_2 包头和有效载荷 -IDOK 确定(&O) -IDCANCEL 取消 -STATIC3 保存大量数据包日志会给 CPU 和硬盘带来很大的负担,会导致 HUB 和整个 VPN Server 的性能下降。启用日志记录仅保存必要的数据包。 - -PREFIX D_SM_CA -CAPTION 管理可信的 CA 证书 -STATIC1 您可以管理被此虚拟 HUB 信任的证书签发机构(CA)的证书列表。\r\n\r\n当一个 VPN Client 以已签字的证书认证模式连接时,列在此处的 CA 证书列表用于验证证书。 -B_IMPORT 添加(&A) -IDOK 查看证书(&V) -IDCANCEL 关闭(&C) -B_DELETE 删除(&D) - - -PREFIX D_SM_SESSION -CAPTION 管理会话- %S -S_TITLE 虚拟 HUB "%S"当前有以下 VPN 会话。 -STATIC1 会话操作 -IDOK 会话信息(&I) -B_DISCONNECT 断开(&D) -B_REFRESH 刷新(&H) -B_SESSION_MAC_TABLE 已选会话的 MAC 表(&M) -B_SESSION_IP_TABLE 已选会话的 IP 表(&P) -STATIC2 其它管理任务 -B_MAC_TABLE MAC 地址表列表(&A) -B_IP_TABLE IP 地址表列表(&B) -IDCANCEL 关闭(&X) -S_FARM_INFO_2 此处显示的会话是当前群集上的所有会话。要管理其他群集成员服务端上的会话,您必须以管理员身份连接到那些服务器上。 - - -PREFIX D_SM_MAC -CAPTION MAC 地址表 -S_TITLE 虚拟 HUB "%S" 上的 MAC 地址表数据库有如下条目。 -B_DELETE 删除选定条目(&D) -B_REFRESH 刷新(&H) -IDCANCEL 关闭(&X) - - -PREFIX D_SM_IP -CAPTION IP 地址表 -S_TITLE 虚拟 HUB "%S" 上的 IP 地址表数据库有如下条目。 -B_DELETE 删除选定条目(&D) -B_REFRESH 刷新(&H) -IDCANCEL 关闭(&X) - - -PREFIX D_SM_CREATE_CERT -CAPTION 创建新证书 -STATIC1 您可以轻松地创建自己或其他证书签署的证书。 -STATIC2 证书类型(&T): -R_ROOT_CERT 根证书 (自签名证书) (&R) -R_SIGNED_CERT 其他证书签名的证书(&S) -S_LOAD_1 签名用证书和密钥(&C): -B_LOAD 载入证书和密钥(&L) -S_LOAD_2 单击“载入证书和密钥”来指定使用一个新证书签名的 X509 证书和 RSA 密钥。 -S_LOAD_3 通用名称(CN): -S_LOAD_4 所属机构(O): -S_LOAD_5 组织单位(OU): -S_LOAD_6 国家(C): -S_LOAD_7 省(ST): -S_LOAD_8 地点(L): -S_LOAD_11 序列号(&S):\r\n(十六进制) -S_LOAD_9 有效期至(&E): -S_LOAD_10 天 -STATIC3 当管理大量证书和认证认证机构时,请使用免费软件,如 OpenSSL,或商业 CA(证书认证机购)软件。 -IDOK 确定(&O) -IDCANCEL 取消 -S_LOAD_12 密码强度(&N): - - -PREFIX D_NM_LOGIN -CAPTION deleted -S_TITLE deleted -STATIC1 deleted -STATIC2 deleted -IDOK deleted -IDCANCEL deleted - - -PREFIX D_SPEEDMETER -CAPTION 网络设备状态 -STATIC1 选择网络适配器: -STATIC2 实时状态(&R) -STATIC3 刷新(&R) - - -PREFIX D_NM_MAIN -CAPTION deleted -STATIC1 deleted -STATIC2 deleted -B_SETTING VPN Server 的连接设置(&S) -B_CONNECT 连接(&C) -B_DISCONNECT 断开(&D) -STATIC3 用户模式路由器的操作设置 -STATIC4 您可以在 SoftEther VPN 用户模式路由器的虚拟网络上设置操作。 -B_OPTION 用户模式路由器的操作设置(&O) -STATIC5 用户模式路由器的操作状态 -STATIC6 显示 SoftEther VPN 用户模式路由器的当前操作状态 -B_NAT 虚拟NAT状态(&N) -B_DHCP 虚拟 DHCP 服务器状态(&H) -B_STATUS 用户模式路由器状态(&R) -B_INFO 用户模式路由器信息(&I) -B_PASSWORD 管理密码设置(&P) -B_REFRESH 刷新(&E) -B_ABOUT 关于(&A) -IDCANCEL 退出(&X) - - -PREFIX D_NM_OPTION -CAPTION SecureNAT 配置 -S_TITLE 设置 SecureNAT 虚拟主机如何在虚拟 HUB "%S" 的虚拟网络上进行操作。 -STATIC1 虚拟主机网络接口设置: -STATIC2 MAC 地址(&M): -STATIC3 IP 地址(&P): -STATIC4 子网掩码(&S): -STATIC5 虚拟 NAT 设置: -R_USE_NAT 使用虚拟 NAT 功能(&A): -STATIC6 M&TU 值: -STATIC7 字节 -STATIC8 TCP 会话超时(&C): -STATIC9 秒 -STATIC10 UDP 会话超时(&U): -STATIC11 秒 -R_SAVE_LOG 保存 NAT 或 DHCP 服务器运行记录到日志文件(&L) -STATIC12 虚拟 DHCP 服务器设置: -R_USE_DHCP 使用虚拟 DHCP 服务器功能(&N) -STATIC13 分配 IP 地址(&D): -STATIC14 至 -STATIC15 。 -STATIC16 子网掩码(&B): -STATIC17 租赁期限(&E): -STATIC18 秒 -STATIC19 应用到客户端的选项 (可选): -STATIC20 默认网关\r\n地址(&F): -STATIC21 DNS 服务器地址 1 (&V): -STATIC22 域名(&W): -STATIC23 DNS 服务器地址 2 (&V): -IDOK 确定(&O) -IDCANCEL 取消 -S_1 静态路由表推功能 (拆分隧道) -S_2 推送静态路由表至 VPN 客户端。 -B_PUSH 编辑该静态路由表以推送 - - -PREFIX D_NM_NAT -CAPTION 虚拟 NAT 路由上的 NAT 会话表 -S_TITLE 有如下 TCP 或 UDP NAT 表项在 SecureNAT 的虚拟 NAT 路由上。 -B_REFRESH 刷新(&H) -IDCANCEL 关闭(&X) - - -PREFIX D_NM_DHCP -CAPTION 虚拟 DHCP 服务器上的 IP 租赁表 -S_TITLE SecureNAT 虚拟 DHCP 服务器已分配以下 IP 地址到客户端。 -B_REFRESH 刷新(&H) -IDCANCEL 关闭(&X) - - -PREFIX D_NM_CHANGE_PASSWORD -CAPTION 变更 %S 的管理员密码 -S_TITLE 您可以变更 SoftEther VPN 用户模式路由(%S) 的管理员密码。输入新密码后请单击“确定”。 -STATIC1 新密码(&P): -STATIC2 确认输入(&C): -IDOK 确定(&O) -IDCANCEL 取消 - - -PREFIX D_SM_SNAT -CAPTION 虚拟 NAT 和虚拟 DHCP 功能 (SecureNAT) 设置 -S_TITLE SecureNAT 使你在虚拟 HUB "%S" 的虚拟网络上可以运行一个虚拟 NAT 路由器(IP 伪装)和 DHCP 服务器功能。 -STATIC1 SecureNAT 警告 -S_WARNING SecureNAT 功能建议仅系统管理员或熟悉网络知识的人员使用。 -S_WARNING2 如果您正确使用 SecureNAT,VPN 可以实现安全的远程访问。但是如果使用方式不正确,可能会将整个网络暴露在危险下。任何对网络没有足够了解,或没有网络管理员的允许,请一定不要启用 SecureNAT。请参阅 VPN Server 的手册或在线文档来获取 SecureNAT 功能的详细解释。 -STATIC2 启用 / 禁用和变更 SecureNAT 设置 -STATIC3 您可以启用 / 禁用和变更此虚拟 HUB 上的 SecureNAT 设置。 -B_ENABLE 启用 SecureNAT (&E) -B_DISABLE 禁用 SecureNAT (&D) -B_CONFIG SecureNAT 配置(&C) -STATIC4 ※注意: 当禁用一个运行中的 SecureNAT 时,所有通过 SecureNAT 连接的活跃的 TCP 和 UDP 会话将被终止。 -STATIC5 查看当前 SecureNAT 状态 -STATIC6 您可以查看当前 SecureNAT 运行状态。 -B_NAT 虚拟 NAT 路由器状态(&N) -B_DHCP 虚拟 DHCP 服务器状态(&H) -B_STATUS 查看 SecureNAT 运行状态(&S) -S_TSUKUBA2 SecureNAT 使用了 登大遊 于 2004 年在筑波大学第三学群信息学系“特别信息研讨 I”开发的技术。 -IDCANCEL 关闭(&X) - - -PREFIX D_SM_BRIDGE -CAPTION 本地网桥设置 -STATIC1 本地网桥可以建立一个二层桥接来连接本 VPN Server 上的虚拟 HUB 和一个物理以太网设备(网络适配器)。;\r\n也可以创建一个 tap 设备(虚拟网络接口)并与虚拟 HUB 间建立一个桥接。(Tap 仅支持 Linux 版) -B_DELETE 删除本地网桥(&D) -STATIC2 新建&新建本地网桥定义(&N): -STATIC3 选择要桥接的虚拟 HUB -STATIC4 虚拟 HUB (&H): -STATIC5 要创建的类型(&T): -R_BRIDGE 现存物理网络适配器的桥接(&P) -R_TAP 新 tap 设备的桥接(&T) -S_ETH_1 &LAN 适配器: -S_TAP_1 新 tap 设备名称(&D): -S_TAP_2 (11 个字符以内) -STATIC6 ※注意: 可以使用任何操作系统的网络适配器建立桥接,但在高负载环境中,你应该为桥接准备一个专用的网络适配器。 -IDOK 创建本地桥(&A) -STATIC7 如果无法显示一个新安装到系统的网路适配器,重启电脑,并重新打开此窗口。 -IDCANCEL 关闭(&X) -B_VLAN VLAN 透明设置工具(&G) - - -PREFIX D_WIN9X_REBOOT -CAPTION VPN Client - 安装虚拟网络适配器 -STATIC1 VPN Client 虚拟网络适配器已安装。\r\n需要关闭 Windows并重启计算机。\r\n\r\n计算机将会自动重启。如果计算机没有重启,请手动启动计算机。 - - -PREFIX D_EM_MAIN -CAPTION SoftEther 以太网记录器管理器 -STATIC1 SoftEther 以太网记录器是一个服务,可以捕捉流经计算机上网络适配器的数据。而且,可以数据包包头保存为管理员指定类型的日志文件,所有数据保存为文本文件。\r\n\r\n目前,下列捕捉设备正在运行中。 -B_PASSWORD 管理员密码(&P) -B_LICENSE 许可证(&L) -B_ADD 添加(&A) -IDOK 编辑(&E) -B_DELETE 删除(&D) -IDCANCEL 关闭(&X) - - -PREFIX D_EM_ADD -STATIC1 用于捕获的网络适配器名称(&L): -R_PROMISCUOUS 捕获时不要使用混杂模式(&N) -STATIC2 数据包日志 (&P) : -S_PACKET 日志文件切换周期 (&W) : -S_PACKET_0 TCP 连接日志: -B_PACKET_0_0 没有保存 -B_PACKET_0_1 仅标头信息 -B_PACKET_0_2 数据包所有内容 -S_PACKET_1 TCP 数据包日志: -B_PACKET_1_0 没有保存 -B_PACKET_1_1 仅标头信息 -B_PACKET_1_2 数据包所有内容 -S_PACKET_2 DHCP 数据包日志: -B_PACKET_2_0 没有保存 -B_PACKET_2_1 仅标头信息 -B_PACKET_2_2 数据包所有内容 -S_PACKET_3 UDP 数据包日志: -B_PACKET_3_0 没有保存 -B_PACKET_3_1 仅标头信息 -B_PACKET_3_2 数据包所有内容 -S_PACKET_4 ICMP 数据包日志: -B_PACKET_4_0 没有保存 -B_PACKET_4_1 仅标头信息 -B_PACKET_4_2 数据包所有内容 -S_PACKET_5 IP 数据包日志: -B_PACKET_5_0 没有保存 -B_PACKET_5_1 仅标头信息 -B_PACKET_5_2 数据包所有内容 -S_PACKET_6 ARP 数据包日志: -B_PACKET_6_0 没有保存 -B_PACKET_6_1 仅标头信息 -B_PACKET_6_2 数据包所有内容 -S_PACKET_7 以太网\r\n数据包日志: -B_PACKET_7_0 没有保存 -B_PACKET_7_1 仅标头信息 -B_PACKET_7_2 数据包所有内容 -IDOK 确定(&O) -IDCANCEL 取消 -STATIC3 保存大量数据包日志会给CPU和硬盘带来沉重负担,并且可能导致系统整体性能下降。请配置设置以使必须的日志被保存。 - - -PREFIX D_EM_PASSWORD -CAPTION 变更管理员密码 -S_TITLE 您可以变更管理员密码。输入后请点击“确定”。 -STATIC1 新密码 (&P) : -STATIC2 确认 (&C) : -IDOK 确定(&O) -IDCANCEL Cancel - - -PREFIX D_EM_LICENSE -CAPTION 添加或删除许可证 -STATIC1 要使用 SoftEther 以太网记录器,您必须获取一个有效地许可证并注册许可证密钥。使用此窗口,您可以注册一个新的许可证密钥,删除一个已注册的许可证密钥,显示当前许可证列表和许可证模式。 -S_BOLD 当前已注册许可证列表 (&L) : -B_OBTAIN 获取许可证 (&O) -STATIC2 点击“获取许可证” 来显示介绍如何获取许可证的网站。 -B_ADD 注册新许可证密钥 -B_DEL 删除 (&D) -IDOK 许可证相关信息 (&I) -STATIC3 选择一个许可证,点击“许可证相关信息” 来连接到SoftEther有限公司网站 (softether.com),来查询被选许可证的相关注册信息。 -S_BOLD2 当前 SoftEther 以太网记录器许可证模式 (&M) : -IDCANCEL 关闭 (&X) - - -PREFIX D_EM_LICENSE_ADD -CAPTION 注册新许可证密钥 -S_INFO 您可以注册一个 SoftEther 以太网记录器产品许可证密钥。 -STATIC1 许可证密钥由36个字母数字字符和连字符组成。它是证明许可证所有权的关键代码。\r\n\r\n当此软件收到一个许可证证书时,许可证密钥就被打印到此许可证证书上了。如果此许可证是在线购买的,则许可证密钥可以通过email提供,并在购买页面显示。许可证密钥也可能通过其他方式送达。如果您不知道许可证密钥位置,请向许可证出售者询问。 -STATIC2 请输入正确的许可证密钥 (&I) : -STATIC3 每组6字,分组输入许可证密钥。您不需要输入连字符。也可以复制&&粘贴许可证密钥。 -B_INFO2 此软件有世界范围的著作权保护。消费者只可以在许可证允许范围内复制和使用此软件。警告: 使用非法获得的许可证密钥,或在多台服务器上使用一个许可证,或以非认证的方式获得许可证,会导致民事或刑事处罚。 -IDOK 注册 (&R) -IDCANCEL 取消 - -PREFIX D_EM_REMOTE -STATIC1 指定目标计算机的主机名或 IP 地址 (&S) : -R_LOCAL 连接到本地计算机 (显示在此窗口的计算机) (&L) -S_HOSTNAME 计算机名称 (&C) : -IDOK 确定(&O) -IDCANCEL 取消 -B_ABOUT 版本信息 - -PREFIX D_SM_CONFIG -CAPTION 编辑配置文件 -IDC_INFO VPN Server“%S”的当前配置如下。\r\n您可以编辑此配置文件的内容并应用到 VPN Server。 -B_EXPORT 保存到文件 (&S) -B_IMPORT 导入文件并应用 (&I) -IDCANCEL 关闭 (&C) -STATIC1 您可以使用任一文本编辑器编辑配置文件。当把已编辑的配置文件应用到 VPN Server 时, VPN Server 将自动重启,并根据新的配置文件开始。如果应用一个无效的配置文件,程序会报错,并且当前设置内容可能会丢失,所以请谨慎编辑配置文件。 -B_FACTORY 恢复出厂默认值 - -PREFIX D_SM_ADMIN_OPTION -CAPTION 虚拟 HUB 管理选项 -S_INFO 当前已为虚拟 HUB "%S" 设置如下管理选项。 -B_ADD 添加值(&A) -B_EDIT 编辑值(&E) -B_DELETE 删除值(&D) -STATIC1 虚拟 HUB 管理选项的目的是给在虚拟 HUB 管理模式的管理员设置的限制。 -IDOK 保存(&S) -IDCANCEL 取消 -STATIC2 只有整个 VPN Server 的管理员可以编辑虚拟 HUB 管理选项。个别虚拟 HUB 的管理员只能查看但不能修改管理选项。\r\n然而,如果 allow_hub_admin_change_option 被设为"1",那么虚拟 HUB 管理员就可以编辑管理选项。 -S_BOLD 描述: - - -# ----- 不完全翻訳ここから ----- -PREFIX D_SM_MSG -CAPTION 设置消息 -S_MSG_2 当一个 VPN Client 接入到虚拟 HUB "%S" 时,您可以设置消息显示在一个用户的屏幕上。要显示一个消息,输入你想要显示的消息。 -C_USEMSG 显示消息(&M) -STATIC1 关于消息显示功能 -S_INFO VPN Client 必须是 3.0 或更高版本。\r\n\r\n指定以“http://”开头的一行作为打开默认网站浏览器的消息,而不是直接显示一条消息。 -IDOK 确定(&O) -IDCANCEL 取消 - - -PREFIX D_NICINFO -CAPTION 虚拟网络适配器 "%S" 状态 -IDCANCEL 关闭(&C) - - -PREFIX D_SM_VLAN -CAPTION VLAN 透明设置工具 -STATIC1 有些网络适配器默认不能传输标记的 VLAN 透明数据包(IEEE802.1Q)。\r\n\r\n如果你使用这样一个网络适配器来桥接到虚拟 HUB 并需要交换带 VLAN 标签的以太网数据包,您必须配置网络适配器,使其能够处理 VLAN 透明数据包。 -B_ENABLE 配置已选网络适配器为 VLAN 透明(&C) -B_DISABLE 撤消该配置(&U) -STATIC2 关于 VLAN 透明设置工具 -S_WARNING 该工具可以在英特尔,Broadcom 和 Marvell 的网络适配器中开启或关闭标记 VLAN 数据包的透明度。(Windows 仅使用供应商提供的驱动)。此工具可以启用或禁用在 Intel,Broadcom 或 Marvell 网络适配器中标记的 VLAN 数据包的透明度。(仅使用供应商提供的 Windows 驱动程序)。 -S_WARNING2 本工具仅支持上述列表中的网络适配器。其他网络适配器不能用此工具配置。。但是未在此列表的其他网络适配器有可能默认支持或使用一些配置支持已标记的 VLAN 数据包。。\r\n\r\n这样的网络适配器必须由系统管理员登录 Windows 配置。 -IDCANCEL 退出(&X) - - -PREFIX D_SM_SIMULATION -CAPTION 延迟 / 丢包功能 -STATIC1 通过这个虚拟 HUB 传输时,此功能可以生成符合此访问列表条目条件的数据包的延迟、时基误差和数据包丢失。\r\n\r\n此功能方便在桌面或实验室模拟低质的和慢速的互联网、广域网或无线连接。例如,你可以用它来评估和测试 IP 电话(VoIP)。 -STATIC2 产生如下延迟、时基误差和数据包丢失: -C_DELAY 产生延迟(&D) -S_DELAY 延迟周期(0 - 10000) : -S_DELAY2 毫秒 (msecs) -C_JITTER 产生时基误差(波动)(&J) -S_JITTER 时基误差比率 (0 - 100) : -S_JITTER2 百分比(%) -C_LOSS 产生数据包丢失(&L) -S_LOSS 数据包丢失比率(0 - 100) : -S_LOSS2 百分比(%) -IDOK 确定(&O) -IDCANCEL 取消 -# ----- 不完全翻訳ここまで ----- - - -PREFIX D_SM_AO_VALUE -CAPTION 名称和值 -STATIC1 名称(&N): -STATIC2 值(&V): -STATIC3 (整数值) -IDOK 确定(&O) -IDCANCEL 取消 - - -PREFIX D_SM_L3 -CAPTION 虚拟 3 层交换设置 -STATIC1 您可以定义在此 VPN Server 上运行的两个或多个虚拟 HUB 间的虚拟 3 层交换,来实现不同 IP 网络之间的路由。 -STATIC2 虚拟 3 层交换功能仅提供给网络管理员或数值网络和 IP 路由人员使用。如果您要使用常规 VPN 功能,您不需要使用虚拟 3 层交换功能。\r\n\r\n如果使用虚拟 3 层交换功能,使用者必须有足够的 IP 路由知识。 -STATIC3 关于虚拟 3 层交换功能注意事项 -S_BOLD 已定义的虚拟 3 层交换(&S): -B_ADD 新建(&N) -B_START 开始(&S) -B_STOP 停止(&T) -IDOK 编辑(&E) -B_DELETE 删除(&D) -IDCANCEL 关闭(&C) - - -PREFIX D_SM_L3_ADD -CAPTION 新虚拟 3 层交换 -STATIC1 创新建一个新的虚拟 3 层交换,为输入一个交换机名称。\r\n\r\n此虚拟 3 层交换不能与此 VPN Server 上的其它虚拟 3 层交换有重复的名字。 -STATIC2 名字(&N): -IDOK 确定(&O) -IDCANCEL 取消 - - -PREFIX D_SM_L3_SW -CAPTION 编辑虚拟 3 层交换 "%S" -STATIC1 您可以为一个虚拟 3 层交换定义多个虚拟接口和路由表。 -STATIC2 当虚拟 HUB 运行时,一个虚拟接口被关联到虚拟 HUB 上,并作为一个单独的 IP 主机运行。当多个虚拟接口分别属于不同虚拟 HUB 定义的不同 IP 网络时,IP 路由将会自动在这些接口之间使用。\r\n也可以手动设置路由表和其他详细设置。 -S_BOLD1 虚拟接口(&I): -B_ADD_IF 新虚拟接口(&A) -B_DEL_IF 删除虚拟接口(&E) -S_BOLD2 路由表(&T): -B_ADD_TABLE 添加路由表项(&D) -B_DEL_TABLE 删除路由表项(&L) -B_START 开始(&S) -B_STOP 停止(&T) -IDCANCEL 关闭(&C) - - -PREFIX D_SM_L3_SW_IF -CAPTION 添加虚拟接口 -STATIC1 对虚拟 3 层交换机添加新的虚拟接口。\r\n\r\n您必须定义虚拟接口属于的 IP 网络和接口本身的 IP 地址。\r\n请选择或输入该接口要连接的虚拟 HUB 名称。 -STATIC2 虚拟 HUB 连接(&A): -STATIC3 请选择或输入虚拟接口连接的虚拟 HUB 名称。 -STATIC4 虚拟 HUB (&H): -STATIC5 虚拟接口的 IP 地址和子网掩码: -STATIC6 虚拟接口必须在虚拟 HUB 中有一个 IP 地址。您也必须指定此 IP 地址从属的 IP 网络的子网掩码。\r\n\r\n通过虚拟 3 层交换连接到多个虚拟 HUB 的路由是基于此处指定的 IP 地址运行的。 -S_SRC_IP_1 IP 地址(&I): -S_SRC_IP_2 子网掩码(&S): -IDOK 确定(&O) -IDCANCEL 取消 - - -PREFIX D_SM_L3_SW_TABLE -CAPTION 新路由表项 -STATIC1 在虚拟 3 层交换机的路由表增加一个新的路由表项。\r\n\r\n如果 IP 数据包的目标 IP 地址不属于任何有着虚拟接口的 IP 网络,虚拟 3 层交换机的 IP 路由引擎将参考路由表并且执行路由。 -STATIC2 路由表项的定义: -STATIC3 虚拟接口必须在虚拟 HUB 中有一个 IP 地址。您也必须指定此 IP 地址从属的 IP 网络的子网掩码。\r\n\r\n通过多个虚拟 HUB IP 网空间的虚拟 3 层交换机是基于此处指定的 IP 地址运行的。 -S_SRC_IP_1 网络地址(&N): -S_SRC_IP_2 子网掩码(&S): -S_SRC_IP_3 网关地址(&G): -S_SRC_IP_4 公制值(&M): -STATIC4 ※注意: 指定默认网关,指定网络地址和子网掩码都是“0.0.0.0“。 -IDOK 确定(&O) -IDCANCEL 取消 - - -PREFIX D_CM_SELECT_SECURE -CAPTION 选择智能卡 -STATIC1 选择智能卡设备使用。\r\n\r\n智能卡的种类已列在目前使用电脑驱动的列表中并支持 VPN 软件。\r\n如果现在使用的智能卡种类未显示在此列表中,可以通过升级 VPN 软件到新的版本来实现。\r\n\r\n注: 如果在安装后,驱动没有立即显示出来,重启 Windows。 -IDOK 确定(&O) -IDCANCEL 取消 - - -PREFIX D_CM_SECURE_MANAGER -CAPTION 智能卡管理器 -S_INFO 当前智能卡:\r\n\r\n%S -B_BOLD 智能卡上存储的对象: -B_REFRESH 更新对象列表(&R) -B_IMPORT 导入卡内(&I)... -B_EXPORT 从卡中导出(&E)... -B_DELETE 从卡中删除(&D) -B_NEW_CERT 将新证书和密钥写入卡内(&N)... -B_PIN 更改 PIN 码(&C)... -IDCANCEL 关闭 - - -PREFIX D_CM_SECURE_TYPE -CAPTION 选择对象类型 -STATIC 选择你要导入的对象类型 -R_CERT 证书(&C) -R_KEY 密钥(&K) -R_DATA 数据(&D) -IDOK 确定(&O) -IDCANCEL 取消 - - -PREFIX D_STRING -CAPTION VPN 软件 -IDOK 确定(&O) -IDCANCEL 取消 - - -PREFIX D_SM_SELECT_KEYPAIR -CAPTION 指定智能卡证书 -S_INFO 当前选定的智能卡:\r\n\r\n%S -B_BOLD1 选择智能卡证书: -IDOK 确定(&O) -IDCANCEL 取消 -B_BOLD2 选择相应的密钥: - - -PREFIX D_CM_LOAD_X -CAPTION 加载证书 -STATIC1 选择加载证书的方式 -R_FROM_FILE 从文件中加载证书(&F) -R_FROM_SECURE 从智能卡中加载证书(&S) -S_FILE 您可以从存储证书数据的文件中 (扩展名: .cer, .crt, .p12, .pfx) 加载证书。 -S_CERT 如果智能卡与计算机连接,您可以从智能卡中加载证书。 -B_SELECT 选择要使用的智能卡(&S)... -IDOK 确定(&O) -IDCANCEL 取消 - - -PREFIX D_CM_SECURE_PIN -CAPTION 更改 PIN 码 -STATIC1 您可以更改智能卡的 PIN码 (个人识别号码)。\r\n\r\n更改 PIN 码,您需要输入当前的 PIN 码和 2 次新的 PIN 码。 -STATIC2 当前的 PIN 码(&C): -STATIC3 新的 PIN 码(&N): -STATIC4 确认新的 PIN 码(&E): -STATIC5 注意 -STATIC6 如果您错误地输入几次密码,智能卡将不能使用。 -STATIC7 请插入智能卡并且点击“OK”。 -IDOK 确定(&O) -IDCANCEL 取消 - - -PREFIX D_SM_CRL -CAPTION 废止证书列表 -STATIC1 您可以在虚拟 HUB 上管理证书废止列表。\r\n\r\n通过添加证书到证书废止列表,提供这些证书的客户端将被拒绝连接到使用证书认证模式的此虚拟 HUB。 -B_ADD 添加(&A) -IDOK 编辑(&E) -IDCANCEL 关闭(&C) -B_DELETE 删除(&D) - - -PREFIX D_SM_EDIT_CRL -CAPTION 废止证书 -STATIC1 您可以在废止列表中设置条目的内容。\r\n\r\n当一个用户以证书认证模式连接一个虚拟 HUB 时,并且该证书与证书废止列表中定义的一个或多个的内容相匹配,这个用户将被拒绝连接。 -S_BOLD 匹配项目所有字段的证书将被禁用。 -STATIC2 证书内容: -R_CN 通用名称 (CN): -R_O 所属机构 (O): -R_OU 组织单位 (OU): -R_C 国家 (C): -R_ST 省 (ST): -R_L 地点 (L): -STATIC3 证书属性值: -R_SERI 序列号 (十六进制): -R_MD5_HASH MD5 摘要值 (以十六进制,128位): -R_SHA1_HASH SHA-1 摘要值 (以十六进制,160位): -STATIC4 摘要值(哈希值)可以精确地识别特定的证书。如果你指定了一个 MD5 或 SHA-1 摘要值,你不需要指定其他项目。 -STATIC5 从证书文件的输入值 -STATIC6 如果您要禁用一个证书文件,您可以正确地指定证书,并通过输入那个文件将其添加到无效清单。单击“加载证书”,指定证书文件的内容将被自动输入。 -B_LOAD 加载证书(&L)... -IDOK 确定(&O) -IDCANCEL 取消 - - -PREFIX D_SM_AC_LIST -CAPTION 源 IP 地址限制列表 -S_TITLE 根据客户端计算机的 IP 地址,允许或拒绝到此虚拟 HUB "%S" 的 VPN 连接,您可以设置以下规则来允许或拒绝连接。 -B_ADD 新规则(&A) -IDOK 编辑规则(&E) -B_DELETE 删除规则(&D) -B_SAVE 保存(&S) -IDCANCEL 取消(&C) -STATIC1 较高权限的项目列在列表的上方。 -STATIC2 如果客户端的 IP 地址不匹配列表中的任何项目,VPN 连接到此虚拟 HUB 将被允许。 - - -PREFIX D_SM_AC -CAPTION 编辑源 IP 地址限制列表的规则条目 -STATIC1 在 IP 地址访问控制列表中定义一个规则。当客户端试图连接到虚拟 HUB 时,这里设置的值将用于决定是否允许或拒绝从 VPN Client 的连接。 -STATIC2 规则的定义 -STATIC3 当客户端的 IP 地址与下面相匹配时应用此规则: -R_SINGLE 单一 IP 地址(&S) -R_MASKED 多个 IP 地址(通过 IP 地址和掩码指定) (&M) : -STATIC4 地址(&A): -S_MASK 网络掩码(&K): -STATIC5 行为 -R_PASS 允许 (&P) -R_DENY 拒绝 (&D) -STATIC6 其他 -STATIC7 优先级(&R): -STATIC8 (整数: 优先级越高数量越小) -STATIC9 IP 协议版本: -IDOK 确定(&O) -IDCANCEL 取消 - - -PREFIX D_SM_LOG_FILE -CAPTION 日志文件列表 -STATIC1 您可以下载存储在服务器上的日志文件。整个 VPN Server 的管理员允许下载所有虚拟 HUB 日志和服务器日志记录。虚拟 HUB 管理员允许下载其管理的虚拟 HUB 日志文件。 -IDOK 下载(&D) -B_REFRESH 更新(&R) -IDCANCEL 关闭 - - -PREFIX D_SM_READ_LOG_FILE -CAPTION 下载文件 -S_INFO2 VPN Server "%S" 文件下载中。\r\n请稍候... -IDCANCEL 停止下载(&S) - - -PREFIX D_SM_SAVE_LOG -CAPTION 下载的日志文件 -S_INFO 文件 "%S" 已完成下载。\r\n\r\n您可以打开或保存这个文件。 -IDOK 打开(&O) -B_SAVE 保存(&S) -IDCANCEL 取消 - - -PREFIX D_TCP -CAPTION TCP 协议优化工具 -STATIC1 通过优化 Windows TCP/IP 设置,就有可能增加这台计算机的网络通信吞吐量。通过使用这个 TCP 协议优化工具,您可以轻松地配置最佳优化参数的设置。 -STATIC2 Windows 的当前 TCP/IP 设置参数如下。通过改变这些值可以优化 TCP/IP 设置。通过使用该实用程序,以后您随时可以重置此值或恢复以前的设置。 -STATIC3 TCP/IP 通信设置: -STATIC4 TCP 接收窗口与尺寸(&S): -R_RECV_DISABLE 使用操作系统和默认值(&D) -R_RECV_ENABLE 设置值如下(&E) -S_RECV 字节 -B_RECV 默认值(&C) -STATIC5 TCP 发送窗口尺寸(&R): -R_SEND_DISABLE 使用操作系统和默认值(&I) -R_SEND_ENABLE 设置值如下(&N) -S_SEND 字节 -B_SEND 默认值(&O) -IDOK 确定(&O) -IDCANCEL 取消 -STATIC6 Windows 重启后,上述更改生效。更改设置后,您不必立即重启计算机,但直到重启后,TCP/IP 优化设置才会生效。 -B_DELETE 不用此工具管理 - - -PREFIX D_TCP_MSG -CAPTION TCP 协议优化 -STATIC1 通过 Windows 优化 TCP/IP 设置,有可能增加这台电脑的网络通信吞吐量。您想优化通信设置吗?\r\n\r\n您可以在未来随时启动 TCP 协议优化工具,优化通信设置或恢复到他们以前的值。 -STATIC2 当 TCP/IP 设置被更改,Windows 重启后,更改生效。更改设置后,您不必立即重启计算机,但直到重启后,TCP/IP 优化设置才会生效。 -R_OPTIMIZE 自动优化通讯设置(&A) -R_MANUAL 使用 TCP 协议优化工具手动优化(&M) -R_NO 不要优化(&D) -IDOK 下一步(&N) > -IDOK3 < 上一步(&B) - - -PREFIX D_CM_PKCSEULA -CAPTION 请注意使用智能卡驱动程度 -S_INFO_1 您正在试图访问 "%S" 软件的智能卡。 -S_INFO_2 当使用 "%S" 软件时,如果有这个软件和智能卡的使用条件,那么您在使用前必须同意这些使用条件。\r\n\r\n若需详情请联系 "%S" 软件和智能卡的供应商。 -S_INFO_3 您是否同意上述条件,并希望使用 "%S" 软件和访问指定的智能卡? -IDOK 是(&Y) -IDCANCEL 否(&N) - - -PREFIX D_CM_TRAFFIC -CAPTION 网络通信速度测试工具 -STATIC1 网络流量速度测试工具在两台计算机之间连接 TCP/IP 尽可能大的吞吐量进行数据包传输,以测量实际网络流量可用速度。此工具不仅限于 VPN 使用,还可以用于物理网络。 -STATIC2 使用此工具来测量当前网络带宽容量。请注意,由于两端点 CPU 性能、当前正在运行的其他程序和网络使用率的波动,获取的值有时会低于实际的网络处理能力。 -S_1 配置 -S_3 这台电脑的作用是哪一个? -R_SERVER 测试服务器(&S) -R_CLIENT 测试客户端(&C) -S_4 激活测试服务器,指定侦听端口号。\r\n使用它作为测试客户端,指定目标测试服务器的主机名或 IP 地址和端口号。如果有必要,配置以下可选设置。 -S_5 目标测试服务器主机名称(&H): -S_6 端口号(&P): -S_7 (TCP 端口) -S_8 在客户端配置如下选项。 -S_9 数据通信方向 -R_DOWNLOAD 下载 (输入: 从服务器到客户端) (&D) -R_UPLOAD 上传 (输出: 从客户端到服务器) (&U) -R_FULL 下载和上传 (全双工模式: 进与出同时进行) (&F) -S_10 高级设置 -S_11 同时并行的 TCP 连接数(&N): -S_12 测量周期 (&A): -S_13 秒 -R_ETHERNET 纠正第二层吞吐量假设以太网(&E) -R_DOUBLE 中继设备模式(&B) -S_14 连接 -IDOK 运行(&R) -IDCANCEL 取消 -S_15 您还可以从 vpncmd 命令行管理工具运行此工具。 (非 Windows 操作系统也适用)。 - - -PREFIX D_CM_TRAFFIC_RUN -CAPTION 网络通讯速度测试工具 -S_INFO 网络通讯速度测试工具正在运行。操作状态如下。 -STATIC1 要中止网络通讯速度测试工具,单击“退出”。 -IDCANCEL 退出(&X) - - -PREFIX D_CM_TRAFFIC_RESULT -CAPTION 通讯流量测量结果 -STATIC1 通讯流量测量已完成。结果如下。 -IDCANCEL 关闭(&C) - - -PREFIX D_SM_LICENSE -CAPTION 添加或删除许可证 -STATIC1 使用 SoftEther VPN Server 必须取得有效的许可证并注册许可证密钥。你可以注册一个新的许可证密钥,删除已注册的许可证密钥并在此显示当前许可证列表和 VPN Server 的许可证模式。 -S_BOLD 当前已注册的许可证密钥(&L): -B_OBTAIN 获取或延长许可证(&O) -STATIC2 点击“获取或延长许可证”以访问将提供有关如何获取许可证说明的网站。 -B_ADD 添加一个许可证密钥(&A) -B_DEL 删除(&D) -IDOK 许可证相关信息(&I) -STATIC3 选择一个许可证,点击“许可证相关信息”来连接到 SoftEther 有限公司网站 (softether.com),来查询被选许可证的相关注册信息。 -S_BOLD2 当前许可和 SoftEther VPN Server 模式(&M): -IDCANCEL 退出(&X) - - -PREFIX D_SM_LICENSE_ADD -CAPTION 添加许可证密钥 -S_INFO 您可以注册一个 SoftEther VPN Server 产品许可证或连接许可证。 -STATIC1 许可证密钥长度为 36 字母数字字符和破折号组合 ( '-' )。他们是证明一个许可证所有权的关键代码。\r\n\r\n当许可证证书与此软件一起收到时,许可证密钥印在此授权证书上。如果本软件的许可证是网上购买的,许可证密钥是由电子邮件或购买许可证的网站提供的。许可证密钥也可以通过一些其他方法写下来。如果你不知道的许可证密钥写在哪里,问卖给你许可证的供应商。 -STATIC2 请准确输入许可证密钥(&I): -STATIC3 分组输入许可证密钥,每组6位。您不需要输入破折号。您也可以复制 && 粘贴许可证密钥。 -B_INFO2 此软件受世界范围的版权法保护。消费者只可以在许可证允许范围内复制和使用此软件。使用非法获得的许可证密钥,或在多台服务器上使用一个许可证,或以非认证的方式获得许可证,会导致民事或刑事处罚。 -IDOK 注册(&R) -IDCANCEL 取消 - - -PREFIX D_FREEINFO -CAPTION SoftEther VPN Server 的免费版 -S_INFO_1 感谢您试用 SoftEther VPN Server 免费版。 -S_INFO_2 SoftEther VPN Server 运行在目标服务器 "%S" 上是免费版供个人使用。\r\n当使用免费版时,您可以使用所有的 SoftEther VPN Server 的功能,但用户协议禁止以下的使用。 -S_INFO_3 通过 VPN Server 的商业目的旅行的通迅中使用。 -S_INFO_4 请注意,如果软件基于上述禁止使用的情况下被使用,这样就违反了 SoftEther VPN Server 用户协议。一旦你取得了 SoftEther VPN Server 的定期产品许可证,上述限制即可解除。关于常规产品版本的详细信息,请访问 www.softether.com。\r\n如果该服务器在上述描述的情况下被使用,请通过我们的网站 www.softether.com 联系我们。请注意: 当连接到 VPN Server 的免费版,此窗口将出现。当使用除免费版以外的其他们版本时,此窗口不出现。\n\n注意: 除了这个通知窗口,免费版软件和产品版软件之间没有任何差别。 -B_HIDE 下次隐藏此窗口(&H) -IDCANCEL 确定(&O) - - -PREFIX D_CM_SETTING -CAPTION 切换 SoftEther VPN Client 工作模式 -STATIC1 您可以使用 SoftEther VPN Client 的“标准模式”或“简单模式”。要切换到另一种模式,勾选下面相应的复选框。 -R_NORMAL 标准模式(&N) -R_EASY 简单模式(&E) -STATIC2 当使用“标准模式”时,您可以进行 SoftEther VPN Client 软件提供的所有操作。我们建议一般用户和系统管理员使用此模式。 -STATIC3 “简单模式”只允许最常用的操作,如连接到 VPN Server。我们建议初级用户使用这种模式。 -STATIC4 通过使用设置锁,您可以通过使用一个在 SoftEther VPN Client 注册的连接设置连接到一个 VPN Server ,但这样做,您无法变更连接设置的参数、创建一个新的连接设置或者删除一个连接设置。 -R_LOCK 启用设置锁(&L) -S_PASSWORD1 您可以指定一个密码。下次禁用设置锁时将被要注输入该密码。 -S_PASSWORD2 密码(&P): -S_PASSWORD3 确认(&C): -IDOK 确定(&O) -IDCANCEL 取消 -S_VGS2 您可以配置 VPN Gate 学术服务设置。 -B_VGS VPN 和门户服务设置 (&G)... - - -PREFIX D_CM_EASY -CAPTION SoftEther VPN Client 简易管理器 (Developer Edition) -B_MODE 切换运行模式(&M) -IDCANCEL 关闭(&C) -B_STATUS 查看连接模式(&S) -B_VGC VPN Gate 学术项目 - - -PREFIX D_SM_SETUP -CAPTION SoftEther VPN Server / Bridge 简单安装 (Developer Edition) -S_TITLE SoftEther VPN Server / Bridge 简单安装 (Developer Edition) -IDC_STATIC_1 通过使用此安装,您可以为以下使用和目的轻松地安装 SoftEther VPN Server 或 VPN Bridge。退出安装后,您可以使用 VPN Server 管理器自由配置更高级的设置。 -S_BOLD 选择你要构建的 VPN Server 类型。可以一起选择多种类型。 -C_REMOTE 远程访问 VPN Server (&R) -S_REMOTE_1 远程访问 VPN Server 允许 VPN Client 计算机远程访问现有的以太网段,如公司局域网。\n\n连接到 VPN Server 的任何 VPN Client 都能访问到网络,就像他们直接的、物理的连接到网络一样。 -C_SITE 站点到站点 VPN Server 或 VPN Bridge(&S) -S_SITE_1 站点到站点 VPN 是一种连接两个或多个远程以太网的 VPN 配置。\r\n每个站点连在一起,并且在二层成为同一网段。这使得每个站点的所有计算机像是在同一网络中一样可以相互通信。 -S_SITE_2 选择这个 VPN Server 的作用: -C_CENTER 从其他站点接受连接 VPN Server (中心) (&C) -C_EDGE 每个站点(站点端)的 VPN Server 或 VPN Bridge (&E) -C_OTHER VPN 的其他高级配置 -S_OTHER 如果你计划构建具有高级功能的 VPN 系统,如群集功能和虚拟 3 层交换功能,请选择本项。 -IDOK 下一步(&N) -IDCANCEL 关闭(&C) - - -PREFIX D_SM_SETUP_HUB -CAPTION 简单安装-决定虚拟 HUB 名称 -IDC_STATIC_1 您必须至少在 VPN Server 上创建一个虚拟 HUB。以您喜欢的名字命名新的虚拟 HUB。 -IDC_STATIC_2 虚拟 HUB 名(&N): -IDOK 确定(&O) -IDCANCEL 取消 - - -PREFIX D_SM_SETUP_STEP -CAPTION VPN 简单安装任务 -IDC_STATIC_1 为了完成 VPN Server / VPN Bridge 的安装,您必须完成以下任务。 -S_1_1 步骤 1. 创建一个用户来接受 VPN 连接。 -S_1_2 当此 VPN Server 接受远程访问 VPN ,或接受从其他站点来的连接成为中央站点到站点 VPN Server 时,创建用户接受 VPN 连接。 -B_USER 创建用户 -S_2_1 步骤 2. 定义一个到目标 VPN Server 的连接 -S_2_2 当此 VPN Server 被安装在一个站点到站点 VPN 的特定的站点(端) 上时,您必须制定接受连接的中心 VPN Server 的地址,并建立到中央 VPN Server 的连接。 -B_CASCADE 配置连接设置(&C) -S_3_1 3. 设置本地网桥 -S_3_2 对于站点到站点 VPN ,使用本地桥功能连接 VPN 的虚拟以太网段与本地端的物理以太网段之间的网桥。 选择可以提供桥接到 VPN 的现有以太网设备(网络适配器)。 -IDCANCEL 关闭(&C) -IDC_STATIC_8 一旦必须的设置配置完毕,单击“关闭”。VPN Server / VPN Bridge 的高级管理工具将会出现。然后您可以配置你希望的任何高级设置。 -B_SECURENAT 配置 SecureNAT - - -PREFIX D_CPU64_WARNING -CAPTION SoftEther VPN 64 位版本信息 -S_BOLD 当前安装的 SoftEther VPN 软件是 32 位版本,但正在运行的 Windows 操作系统是 64 位版本。 -S_INFO 您可以在 Windows 64 位版本上运行 SoftEther VPN 软件 32 位版本,但这将运行 Windows 的 32 位模拟器,并导致性能降低。\r\n也有一些功能不支持的可能性。 我们强烈建议您当在 64 位 Windows 运行它时,安装并使用 SoftEther VPN 软件的 64 位版本。\r\n您可以从 http://selinks.org/ 下载 SoftEther VPN 软件的 64 位版本。此对话框将在 30 秒后自动关闭。 -IDOK 确定(&O) - - -PREFIX D_ONCEMSG -CAPTION TITLE -C_DONTSHOWAGAIN 不再显示此消息(&D) -IDCANCEL 确定(&O) - - -PREFIX D_CONNECT -IDCANCEL 取消 - - -PREFIX D_SM_IPSEC -CAPTION IPsec / L2TP / EtherIP / L2TPv3 设置 -S_TITLE IPsec / L2TP / EtherIP / L2TPv3 服务器设置 -S_3 在 VPN Server 上的虚拟 HUB 可以接受从兼容 L2TP 的个人电脑, Mac OS X 和智能手机的远程访问 VPN 连接, 也可以接受 EtherIP / L2TPv3 站点到站点的 VPN 连接。 -S01 L2TP 服务器 (远程访问 VPN Server 功能) -S02 从智能手机诸如 iPhone, iPad 和 Android, 还有从Mac OS X 和 Windows 内建的 VPN 客户端的 VPN 连接都是可以接受的。 -R_L2TP_OVER_IPSEC 启用 L2TP 服务器功能 (L2TP over IP&sec) -S03 使来自 iPhone, iPad, Android, Windows 和 Mac OS X 的 VPN 连接可以接受。 -R_L2TP_RAW 启用 L2TP 服务器功能 (没加密的 RAW L2TP)(&L) -S04 支持使用 L2TP 而无 IPSec 加密的特殊 VPN 客户端。 -S_1 默认虚拟 HUB 以防遗漏用户名上的 HUB 名称 (&H): -S_2 用户应指定他们的用户名, 如 "用户名@目标虚拟 HUB 名" 连接到此 L2TP 服务器。\r\n如果虚拟 HUB 的名称被遗漏, 以下 HUB 将作为目标被使用。 -S05 EtherIP / L2TPv3 服务器功能 (站点到站点 VPN 连接) -S06 兼容 EtherIP / L2TPv3 over IPsec 的路由器产品 可以连接到 VPN Server 上的虚拟 HUB, 并建立 2 层 (以太网) 桥接。 -R_ETHERIP 启用 EtherIP / L2TPv3 over IPsec 服务器功能(&E) -B_DETAIL EtherIP / L2TPv3 详细设置(&D) -S07 IPsec 通用设置(&C) -S_PSK IPsec 预共享密钥(&P): -S_PSK2 IPsec 预共享密钥也被称为 "PSKs" 或 "秘钥"。用 8 个 ASCII 字符指定, 并让所有的 VPN 用户都知道。 -IDOK 确定(&O) -IDCANCEL 取消 - - -PREFIX D_SM_ETHERIP -CAPTION EtherIP / L2TPv3 服务器详细设置 -S_TITLE EtherIP / L2TPv3 服务器详细设置 -S01 兼容EtherIP / L2TPv3 over IPsec 的路由器产品 可以连接到 VPN Server 上的虚拟 HUB , 并建立 2 层 (以太网) 桥接。例如,思科路由器,NEC IX 系列和 IIJ SEIL 路由器作为兼容的 VPN 路由器, 推荐使用。 -S02 为了接受 EtherIP / L2TPv3 协议, 定义适当的 EtherIP / L2TPv3 客户端设置, 以事先确定 EtherIP / L2TPv3 兼容路由器的客户端站点。EtherIP / L2TPv3 客户端设置必须有相应的 IPSec Phase 1 ID。 -S_BOLD 在 IPSec Phase 1 ID 和虚拟 HUB 之间的通信表(&T): -B_ADD 添加(&A) -IDOK 编辑(&E) -B_DELETE 删除(&D) -IDCANCEL 退出(&X) - - -PREFIX D_SM_ETHERIP_ID -CAPTION EtherIP / L2TPv3 over IPsec 客户端设置 -S01 以下虚拟 HUB 连接设置将仅应用于 当 EtherIP / L2TPv3 over IPsec 客户端试图连接一个与下面指定值完全相同的 ISAKMP (IKE) Phase 1 ID 的 VPN Server 时。 -S02 ISAKMP Phase 1 ID(&I): -S03 虚拟 HUB(&H): -S04 用户名(&U): -S05 密码(&P): -S06 注意: 用户名和密码必须与在虚拟 HUB 注册时完全相同。EtherIP / L2TPv3 用户将被视为以上述用户信息的身份连接虚拟 HUB。 -IDOK 确定(&O) -IDCANCEL 取消 -S07 (ID 必须与 EtherIP / L2TPv3 客户端的配置 ID 完全相同。如果 EtherIP / L2TPv3 客户端使用 IP 地址作为 Phsae 1 ID, 您可以指定 IP 地址并且字符也可以做为 ID。您可以指定 “*” (星号)作为通配符来匹配任何不匹配其他明确规则的客户端。 - -PREFIX D_SM_OPENVPN -CAPTION OpenVPN / MS-SSTP 设置 -S_TITLE OpenVPN / MS-SSTP VPN 克隆 Server 功能设置 -S_1 本 VPN Server 具有 OpenVPN 技术责任有限公司的 OpenVPN 软件产品的克隆功能。\r\n\r\n任何 OpenVPN Client 都可以连接到此 VPN Server。 -R_OPENVPN 启用 OpenVPN 克隆 Server 功能(&O) -S_TOOL OpenVPN Client 的示例文件生成工具 -S_TOOL2 创建一个 OpenVPN Client 配置是一项艰难的工作。您可以使用此工具来生成一个合适的 OpenVPN Client 配置文件。生成的配置示例文件可马上应用。本来,OpenVPN Client 会要求客户手写一个很难的配置文件。这个工具就可以帮助您创建一个有用的配置样本。您所需要为 OpenVPN Client 生成的配置文件就是点击以下按钮。 -B_CONFIG 为 OpenVPN Client 生成配置样本文件(&C) -S_2 Microsoft SSTP VPN 克隆服务器功能 -S_3 该 VPN Server 有微软公司的 Windows Server 2008 / 2012 内建的 MS-SSTP VPN Server 的克隆功能。\r\n在 Windows Vista / 7 / 8 / RT / 10 中内建的 MS-SSTP 客户端能连接此 VPN Client。 -R_SSTP 开启 &MS-SSTP VPN 克隆 Server 功能 -S_SSTP VPN Server 端 SSL 证书的 CN (通用名)值必须与该客户端指定的主机名吻合,并且该证书必须在该客户端的可信列表中。详细内容请参考微软的文档。 -S_4 指定用户名连接到虚拟 HUB 的方式,和通过使用克隆服务器进行默认 HUB 的选择规则,与 IPsec 服务器功能是一样的。 -B_IPSEC IPsec 服务器配置(&P) -S_13 OpenVPN 克隆服务器功能 -IDOK 确定(&O) -IDCANCEL 取消 - - -PREFIX D_SM_DDNS -CAPTION 动态 DNS 功能 -S_TITLE 动态 DNS 功能 -S_BOLD 此 VPN Server 有内建的动态 DNS 功能 -S_1 此动态 DNS 为该 VPN Server 分派了一个唯一的永久的 DNS 主机名。您可以用此主机名来指定本 VPN Server 来设置 VPN Client 和 VPN Bridge 。您不需要注册并持有一个域名。 -S_22 同时,如果你的 ISP 分派给你一个动态(不固定) IP 地址,相应的动态 DNS 主机名的 IP 地址也会自动改变。它使您在仅使用一个动态的 IP 地址的情况下保持 VPN Server 的运行。\r\n因此,你不再需要每月花钱以保持静态全球 IP 地址。 -S_3 另外,本 VPN Server 版本支持'NAT 穿透'功能。如果 VPN Server 在 NAT 内,并且被分配了一个私有 IP 地址,则您可以完全不用事先对 NAT 进行任何特殊设置,而从因特网端连接该 VPN Server。 -S_4 当前状态(&S) -S_STATUS3 分配的动态 DNS 主机名 (&H): -B_HINT 提示 -S_STATUS4 全球 IPv4 地址(&4): -S_STATUS5 全球 IPv6 地址(&6): -S_5 修改设置: -S_STATUS6 改变动态 DNS 主机名(&C): -S_STATUS7 主机名只能是字母数字和破折号“-”。至少 3 位。\r\n您可以随时更换名字。 -IDOK 设置上述主机名(&A) -B_RESTORE 恢复(&R) -S_2 如果您没有连接到 IPv6 网络,“ 全球 IPv6 地址“将会显示一个错误。\r\n少数国家或地区可能会禁止动态 DNS 服务。 -IDCANCEL 退出(&X) -B_DISABLE 禁用动态 DNS 功能(&D) -B_PROXY 通过代理服务器连接(&P)... -S_STATUS8 DNS 钥: -B_HINT2 提示 - - -PREFIX D_SM_SPECIALLISTENER -CAPTION VPN over ICMP / DNS 功能设置 -S_TITLE VPN over ICMP / DNS 功能 -S_1 VPN over ICMP / DNS 功能 -S_2 即使有防火墙或者屏蔽 TCP/IP 连接的路由器,您也可以只用 ICMP 或者 DNS 数据包建立一个 VPN。您需要事先启用如下功能。 -R_OVER_ICMP 启用 VPN over ICMP 服务器功能(&I) -R_OVER_DNS 启用 VPN over DNS 服务器功能(使用 UDP 53 号端口)(&D) -IDOK 确定(&O) -IDCANCEL 取消 -S_3 要求 VPN Client / VPN Bridge 内部版本 4.0 或更高。 -S_4 注意:仅在紧急情况下使用此功能。它是当防火墙或者路由器配置错误屏蔽 TCP/IP,但是却没有屏蔽 ICMP 或者 DNS 时,使用是有帮助的。它不是为长期稳定使用。 - -PREFIX D_SM_REDIRECT -CAPTION HTTP URL 重定向设置 -S_1 下面指定的 URL 将被强制回复给客户端,作为通过此虚拟 HUB 匹配此访问列表条目条件的 TCP 连接请求数据包的回应。\r\n\r\n要使用此设置,当网页浏览器试图访问特定的 IP 地址时,您可以强行让 VPN Client 计算机的网络浏览器显示该指定网站。 -S_2 指定一个 URL,重定向到 -S_BOLD2 该 URL 重定向到(&U): -S_3 例子: -S_4 单一 URL 重定向: -S_5 高级 URL 重定向: -B_HINT 高级 URL 重定向功能的用途(&U) -S_6 标题 -S_BOLD 该功能适用于 TCP/IP 专家管理员。阅读如下说明并小心设置。 -S_7 在数据包的目标会话匹配访问列表条目的目标用户名或组名的情况下,重定向规则无效。 -S_8 如果匹配条件,非 TCP 数据包重定向规则被忽略,。 -S_9 该重定向规则总是对 HTTP 重定向信息回应。(对 80 端口无限制)。如果您只想应用于 80 端口,在访问列表条目的条件中,将目标端口设为 80 即可。 -S_10 如果这个规则重定向的结果是,客户端试图连接这个已重新定向的 URL,并且这个新的请求又与该规则吻合,则重定向结果将会再次回复这个新的请求。这样就会形成一个无穷的重定向循环。 -IDOK 确定(&O) -IDCANCEL 取消 -S_11 高级重定向功能可以向重新定向的 CGI 提供 VPN 会话信息。 - -PREFIX D_SW_WELCOME -CAPTION D_SW_WELCOME -S_WELCOME SoftEther VPN 在日本筑波大学开发的免费软件。具有终极兼容许多设备的高性能 VPN。支持 Windows、Mac、智能手机、平板电脑 (iPhone、iPad、安卓、Windows RT) 和思科或其他 VPN 路由器。SoftEther VPN 也接受 OpenVPN 和 MS-SSTP VPN 客户端。 -S_TITLE 非常强大的开源免费 VPN 软件。 - -PREFIX D_SW_MODE -CAPTION D_SW_MODE -R_SYSTEM 系统模式(推荐的)(&S) -R_USER 用户模式(&U) -S_1 正常安装本 VPN 软件。要求管理员权限。 -S_USER 以普通用户权限安装本 VPN 软件。不需要管理员权限。有些诸如本地桥功能是不能使用的。只有在"%s"用户登入 Windows 时,才会运行本软件. -S_2 SoftEther VPN 可以有两种方法安装。\r\n\r\n通常请选择系统模式。\r\n\r\n如果您由于一些原因不能使用管理员权限,您可以选择用户模式来继续安装。 - - -PREFIX D_SW_NOT_ADMIN -CAPTION D_SW_NOT_ADMIN -S_INFO 登入 Windows 的"%s"用户不具有管理员权限。\r\n\r\n退出登入 Windows,用有管理员权限的用户名重新登入,如果想继续安装,请重启安装向导。 -S_INFO6 点击完成,退出安装向导。 -S_INFO2 如果您不能使用管理员权限,您可以选择用户模式安装。\r\n要以用户模式安装,点击返回。 - - -PREFIX D_SW_COMPONENTS -CAPTION D_SW_COMPONENTS - - -PREFIX D_SW_EULA -CAPTION D_SW_EULA -S_1 请您仔细阅读最终用户许可协议。 -B_AGREE 我同意最终用户许可协议。 - - -PREFIX D_SW_WARNING -CAPTION D_SW_WARNING -S_1 SoftEther VPN 软件有超乎想象的、强大的通信能力。请在使用前仔细阅读重要注意事项。 - - -PREFIX D_SW_DIR -CAPTION D_SW_DIR -S_INFO 请指定安装 %s 的目录. -R_CUSTOM 指定目录(&S) -S_DEST 目录(&D): -B_BROWSE 浏览...(&B)... -R_SHOWCUSTOM 为网络专家使用的高级安装选项(&A) -R_FOR_SYSTEM 在本电脑的 Windows 系统上安装(&W) -R_FOR_USER 在用户 "%s" 的环境只上安装 -S_WARNING 注意:这是不推荐的。用户"%s"退出 Windows 后,%s 将停止。本地桥功能和 L2TP/IPsec 功能 (支持 Mac 和智能手机)也不能再使用了。 - - -PREFIX D_SW_READY -CAPTION D_SW_READY -S_INFO %s 安装已就绪。 -S_INFO7 点击继续执行安装。 - - -PREFIX D_SW_PERFORM -CAPTION D_SW_PERFORM -S_INFO %s 安装正在进行。\r\n请耐心等待... -S_INFO8 SoftEther VPN 是日本政府的研究和开发项目的一项工作,由日本的经济、贸易和工业部资助,由信息化推进机构管理。 - - -PREFIX D_SW_ERROR -CAPTION D_SW_ERROR -S_INFO 出现错误,%s 安装中止。\r\n\r\n如果你想继续,请重启安装向导。 - - -PREFIX D_SW_FINISH -CAPTION D_SW_FINISH -S_INFO %s 安装过程已成功完成。 -S_INFO8 SoftEther VPN 是日本政府的研究和开发项目的一项工作,由日本的经济、贸易和工业部资助,由信息化推进机构管理。 - - -PREFIX D_SW_UNINST1 -CAPTION D_SW_UNINST1 -S_WELCOME 安装向导可以从电脑中卸载 %s。\r\n\r\n若想开始卸载,点击下一步 -S_TITLE %s 卸载向导 - - -PREFIX D_SW_EASY1 -CAPTION D_SW_EASY1 -S_WELCOME 在一个企业里为许多计算机安装和设置 VPN Client 是很辛苦的工作。 -S_TITLE 什么是 SoftEther VPN Client 简单安装程序? -S_WELCOME2 简单安装程序创建器是为公司管理员使用的一个工具。您可以通过使用简单安装程序创建器用嵌入的某个具体 VPN 连接设置来创建一个 VPN Client 安装程序。个人用户还可以开发此工具。 -S_WELCOME3 通过使用文件服务器或者 e-mail,可以将一个已创建的简单安装程序分发给公司的员工。如果用户运行简单安装程序, VPN Client 会被安装、 VPN 连接设置会被导入完成,并且 VPN 连接也会自动启动。 - - -PREFIX D_SW_EASY2 -CAPTION D_SW_EASY2 -S_BOLD1 指定一个嵌入 VPN 连接设置文件(.vpn)。 -S_1 请指定一个 VPN 连接设置文件 (.vpn)来嵌入到简单安装程序。您可以在 VPN Client 管理工具中,在目标连接设置的右击菜单中通过单击输出 VPN 连接设置来输出设置文件。 -S_18 连接设置(&S): -B_BROWSE_SETTING 浏览...(&B) -B_DELETE_SENSITIVE 在连接设置文件中删除用户名和密码(&E) -S_BOLD2 指定一个要生成的 EXE 文件名 -S_3 这工具将会输出一个包含简单安装工具的 EXE 文件(可执行文件)。请指定要生成的输出文件名。 -S_19 保存为(&A): -B_BROWSE_OUT 浏览...(&B) -B_EASYMODE 安装时将 VPN Client 管理器设置成简单模式(&E) - - -PREFIX D_SW_WEB1 -CAPTION D_SW_WEB1 -S_WELCOME 您可以创建一个 SoftEther VPN Client Web 安装工具,并且将它上传到公司的 Web 服务器。用户打开网页就能自动安装 SoftEther VPN Client,您也可以设置自动输入和快速启动一个已内建的 VPN 连接设置。 -S_TITLE SoftEther VPN Web 安装工具是什么? -S_WELCOME2 已生成的 Web 安装工具可以当做 HTML 文件放在内联网 Web 服务器上。如果一个公司员工连接到该 HTML 文件的 URL 上这个 SoftEther VPN Client 安装工具就会被执行。 -S_WELCOME3 使用 ActiveX 控制。支持在 Windows 2000 或更高版本上的 Internet Explorer 5.0 或更高版本的浏览器。不支持其他浏览器或更低级的操作系统(如 Windows 98) 。 - - -PREFIX D_SW_WEB2 -CAPTION D_SW_WEB2 -S_BOLD1 指定一个要嵌入的 VPN 连接设置文件(.vpn file) -S_1 请指定一个要嵌入到 Web 安装工具上的 VPN 连接文件(.vpn) 。您可以在 VPN Client 管理器上,通过在目标连接设置的右击菜单中点击输出 VPN 连接设置来输出设置文件。 -S_18 连接设置(&S): -B_BROWSE_SETTING 浏览…(&B) -B_DELETE_SENSITIVE 在连接设置文件中删除用户名和密码(&E) -S_BOLD2 指定一个要生成的输出文件名 -S_3 这个工具会输出一个 ZIP 文件 (档案文件),该文件包含 HTML 文件和一个应该放置在 Web 服务器上的 CAB 文件。请指定生成的输出文件名。 -S_19 保存为(&A): -B_BROWSE_OUT 浏览…(&B) -B_EASYMODE 当安装时,将 VPN Client 管理器设置成简单模式(&E) - - -PREFIX D_UPDATE_NOTICE -CAPTION 升级 %s -IDOK 显示升级的信息(&S) -B_CONFIG 设定升级(&C) -IDCANCEL 不要再显示此信息(&D) -S_INFO 已有 %s 的最新版本。您现在可以下载和升级。 -S_PRODUCT 软件: -S_CURRENT 目前的版本: -S_CURRENT_STR Ver %u.%02u.%04u%s -S_LATEST 最新版本: -S_LATEST_STR Ver %S%s - - -PREFIX D_UPDATE_CONFIG -CAPTION 升级提示的配置 -S_INFO 当新版本将要发布时,请定期查询 %s 的新版本和弹出提示窗口。\r\n\r\nHTTPS 数据包将会用在本电脑和位于日本驻波的 SoftEther 升级服务器之间,用于查询有无升级信息。个人信息不会外泄。 -S_TITLE %s 升级以及提示设置 -S_ENABLE 启用升级查询(&E) -S_DISABLE 禁用升级查询(&D) -IDCANCEL 关闭(&C) - - -PREFIX D_SM_VMBRIDGE -CAPTION 虚拟机本地桥说明 -S_TITLE 在虚拟机上使用本地接功能 -S_1 据检测,VPN 服务器可能运行在 VM(虚拟机)上,如 VMware 或 Hyper-V。请仔细阅读下面的说明。如果你不使用虚拟机,请忽略此消息。 -S_2 一些虚拟机默认禁止网络适配器的“混杂模式”(Promiscuous Mode / MAC Address Spoofing)。\r\n\r\n如果混杂模式 (Promiscuous Mode / MAC Address Spoofing) 被管理禁用,在 VPN 服务器的虚拟 HUB 与物理电脑上的物理网络适配器之间的本地桥功能不能很好地工作。通过使用虚拟机的配置工具,你应该允许混杂模式 (Promiscuous Mode / MAC Address Spoofing)。\r\n\r\n有关详细信息,请参阅您的 VM 文件。如果它是一个共享的虚拟机,且由其他人管理,请向管理员请求允许使用你的虚拟机的混杂模式 (Promiscuous Mode / MAC Address Spoofing)。 -S_BOLD 说明 -IDCANCEL 确定(&O) - - -PREFIX D_SM_AZURE -CAPTION VPN Azure 服务设置 -S_TITLE VPN Azure 云 VPN 服务(免费) -S_1 VPN Azure 可以更容易地建立一个 VPN 会话,从你家里的计算机到你办公室的计算机。当一个 VPN 连接建立了,您可以访问您公司专用网络上的任何其他服务器。 -S_2 在办公室的计算机(VPN 服务器)上,你并不需要一个全球 IP 地址。它可以在防火墙或 NAT 后面工作。无需网络管理员的配置。您可以在您的家用电脑使用 Windows 内置的 SSTP VPN 客户端。 -S_3 VPN Azure 是一个云 VPN 服务由 SoftEther 公司经营。 VPN Azure 是免费的,可提供给任何人。按右边的按钮可以查看详细信息和如何使用的说明。 -B_BOLD VPN Azure 设置 -R_ENABLE 启用 VPN Azure(&E) -R_DISABLE 禁用 VPN Azure(&D) -S_HOSTNAME_BORDER 当前 VPN Azure 主机名 -S_HOSTNAME_INFO VPN Azure 主机名与动态 DNS 主机名相同,但改变的域名后缀为“vpnazure.net”。 -B_CHANGE 变更主机名(&H) -B_WEB 如何使用 VPN Azure\r\n(访问网络) -IDCANCEL 确定(&O) - - -PREFIX D_SM_PROXY -CAPTION 通过代理服务器连接 -STATIC9 您可以通过代理服务器连接 -STATIC10 代表类型: -R_DIRECT_TCP 直接 TCP/IP 连接(无代理)(&D) -R_HTTPS 通过 HTTP 代理服务器连接(&T) -R_SOCKS 通过 SOCKS4 代理服务器连接(&K) -R_SOCKS5 通过 SOCKS5 代理服务器连接(&K) -B_PROXY_CONFIG 代理服务器设置(&R) -IDOK 确定(&O) -IDCANCEL 取消 - - -PREFIX D_VGC_LIST -CAPTION SoftEther VPN 客户端的 VPN Gate 学术试验项目插件 -S_TITLE VPN Gate 公共 VPN 中继服务器 -S_INFO1 通过使用 VPN 连接经由全世界志愿者提供的公共 VPN 服务器获得自由访问互联网。绕过您的本地故障防火墙的数据包拦截,并安全地隐藏你的 IP 地址。 -IDOK 连接到 VPN 服务器(&C) -B_PROXY 代理设置(&P) -S_VLAN 虚拟网络适配器: -B_WEB VPN Gate 学术\r\n官方网站 -B_REFRESH 刷新列表(&R) -S_REFRESH 刷新列表... -S_RESEARCH 日本筑波大学的一个学术项目 -S_INFO9 带有更快线路速度值 (Mbps) 和较小 Ping 结果的 VPN 服务器让你更加舒适。如果你使用国外的 VPN 服务器,您可以浏览从您所在国家无法访问的网站。 - - -PREFIX D_VGC_PROTOCOL -CAPTION 选择 VPN 协议来连接 -S_TITLE 公共 VPN 中继服务器 "%S" (%S) 支持 TCP 和 UDP 作为 VPN 协议。 -S_INFO 选择偏爱的 VPN 协议来使用以连接 VPN 服务器 "%S" (%S)。一般情况下,TCP 协议很容易通过防火墙。只有当 TCP 失败时,再尝试使用 UDP 协议。 -R_TCP 使用 &TCP 协议 (Ethernet over HTTPS VPN) (推荐) -R_UDP 使用 &UDP 协议 (Ethernet over UDP VPN) -IDOK 确定(&O) -IDCANCEL 取消 - - -PREFIX D_VGS_CONFIG -CAPTION VPN Gate 服务控制面板 -R_ENABLE 启用 VPN Gate 中继服务和作为志愿者加入 VPN Gate 研究(&E)。 -S_TITLE 加入 VPN Gate 的学术研究项目吗? -S_INFO1 VPN Gate 是一个以 "分布式的公共 VPN 中继服务器" 技术为研究的学术实验,日本筑波大学研究生院运作的。VPN Gate 客户端用户可以连接到 VPN Gate 公共 VPN 中继服务器上运行的服务,并通过 VPN 中继服务器享受无限制的上网。 -S_INFO9 当一个 VPN Gate 客户端用户访问互联网上的服务器,源 IP 地址将被替换为中继公共 VPN 服务器的 IP 地址。因此,VPN Gate 客户端用户将能够顺利地浏览海外网站,即使用户的本地防火墙因未知原因发生故障,无法通过这样的访问。 -S_WARNING 如果您选中上述复选框,然后按确定,VPN Gate 中继服务将在这台电脑上激活。结果,任何 VPN Gate 客户端将能够通过 VPN Gate 中继服务对互联网进行通信。它是安全的,即使你的计算机是专用网络 (如企业网),因为任何私有 IP 地址的访问不会被允许经由 VPN Gate 中继服务通过。 -B_OPTION VPN Gate 服务选项设置(&O)... -IDOK 确定(&O) -IDCANCEL 取消 -B_WEB 浏览 http://www.vpngate.net/ ... - - -PREFIX D_VGS_OPTION -CAPTION VPN Gate 服务选项 -S_TITLE VPN Gate 服务选项 -S_1 这台计算机将成为一个公共 VPN 服务器。请填写运营商的服务器信息。这些信息将被公布在 www.vpngate.net 的名单上和其他相关服务。联系地址也将被用于从 VPN Gate 学术项目运营商的联系。 -S_2 运营商: -S_3 服务器的运营商(&O): -S_19 (最多 64 个字母) -S_20 不良内容举报地址\r\n(e-mail 地址等) (&A): -S_21 (最多 64 个字母) -S_22 给用户的消息(&M):\r\n(最多 128 个字母) -S_23 该消息将显示在 VPN Gate 服务器的列表中。输入一个令人愉快的消息,让用户感到高兴。 -S_24 VPN 设置: -R_LOG 保存 VPN 数据包日志 (推荐) (&S) -R_2WEEKS 两周后自动删除或存档数据包日志编码 (推荐) (&T) -R_PERMANENT 使数据包日志永久占用磁盘空间 (&P) -R_L2TP 启用 L2TP/IPSec VPN 服务器功能 (推荐) (&L) -S_25 允许 Mac OS X、iPhone、iPad 和 Android 客户端进行 VPN 连接。 -B_MESSAGE 在 VPN 客户端和屏幕上弹出您的广告消息(&S)... -IDOK 确定(&O) -IDCANCEL 取消 - - -PREFIX D_VGS_WARNING -CAPTION 在连接 VPN Gate 学术实验前的注意事项 -S1 VPN Gate 学术实验服务是作为日本筑波大学研究生院的一个研究项目运营的。该服务受制于日本法律。其他国家的法律不受我们关注也不承担责任。 -S2 从本质上讲,在世界上有近 200 个国家,都有不同的法律。不可能在软件发布前去验证每一个国家的法律和法规,并使我们的软件符合所有国家的法律。如果用户在一个特定的国家使用 VPN Gate 服务,损坏公务人员的权力,服务或软件的开发者将永远不会负责恢复或补偿等损害或刑事责任。 -S3 通过使用本软件和服务,用户有自己的义务必须遵守所有相关的法律和规则。用户将完全承担任何损失和使用本软件及服务导致的责任,无论日本领土以内还是以外。 -S4 如果你不同意也不理解上述警告,不要使用任何 VPN Gate 学术实验服务功能。 -S5 注: VPN Gate 仅仅是学术目的的一个研究项目。VPN Gate 是作为 SoftEther VPN 的一个插件被开发的。然而,VPN Gate 的每一部分都是在筑波大学的这一研究项目被开发的。VPN Gate 的任何部分都不是 SoftEther 公司开发的。VPN Gate 研究项目不是由 SoftEther 公司引导、经营,推广和保证的。 -R_NEVER 请不要再次显示此消息(&S) -B_WEB 访问 VPN Gate 和网站 ... -IDOK 同意(&A) -IDCANCEL 不同意(&D) -S_BOLD 注意! 不要在 VPN 通讯禁止的国家使用 VPN Gate 服务。 - - -PREFIX D_NM_PUSH -CAPTION 编辑该静态路由表以推送 -S1 这个虚拟 DHCP 服务器可以推送带 DHCP 应答消息的无类静态路由 (RFC 3442) 至 VPN 客户端。 -S2 VPN 客户端是否能够识别无类静态路由 (RFC 3442) 取决于目标 VPN 客户端软件。SoftEther VPN 客户端和 OpenVPN 客户端都支持无类静态路由。在 L2TP/IPSec 和 MS-SSTP 协议上,兼容性取决于客户端软件的实施。 -S3 如果你清除了虚拟 DHCP 服务器选项的默认网关字段,您就可以实现拆分隧道。在客户端一侧,为了使用拆分隧道, L2TP/IPSec 和 MS-SSTP 客户端需要配置为不创建默认网关。 -S4 您还可以通过现有的外部 DHCP 服务器推送无类静态路由 (RFC 3442)。在这种情况下,在 SecureNAT 禁用虚拟 DHCP 服务器功能,在这一屏幕上你不需要设置无类路由。 -S5 编辑该静态路由表以推送 -S6 例如: 192.168.5.0/255.255.255.0/192.168.4.254, 10.0.0.0/255.0.0.0/192.168.4.253\r\n\r\n用逗号或空格字符来拆分多条目 (最多 64 条目)。\r\n每个条目必须以 "IP 网络地址 / 子网掩码 / 网关 IP 地址" 的格式来指定。 -S7 请参阅 RFC3442 以了解无类路由。 -IDOK 确定(&O) -IDCANCEL 取消 - - - - -########################################################################### -# # -#软件菜单的字符串数据 # -# # -########################################################################### - - -# 连接管理器菜单 -PREFIX CM_MENU -#“连接” 菜单 -CMD_TOP_CONNECT 连接(&C) -CMD_CONNECT 连接(&O)\tEnter -CMD_STATUS 查看状态(&S)...\tCtrl+S -CMD_DISCONNECT 断开(&I)\tCtrl+D -CMD_DISCONNECT_ALL 断开所有(&A)\tCtrl+I -CMD_NEW 新 VPN 连接设置(&N)...\tCtrl+N -CMD_CLONE 复制(&C)\tCtrl+C -CMD_SHORTCUT 创建 VPN 连接快捷方式(&H)... -CMD_EXPORT_ACCOUNT 导出 VPN 连接设置(&X)... -CMD_IMPORT_ACCOUNT 导入 VPN 连接设置(&P)... -CMD_STARTUP 启动连接设置(&T)\tCtrl+T -CMD_NOSTARTUP 移除连接设置(&E) -CMD_RECENT 最近的 VPN Server(&V) -CMD_RENAME 重命名(&M)\tF2 -CMD_DELETE 删除(&D)\tDel -CMD_PROPERTY 属性(&R)...\tAlt+Enter -CMD_EXIT 关闭连接管理器(&O)\tAlt+F4 -CMD_QUIT 退出连接管理器程序(&X)\tAlt+Q -#“编辑” 菜单 -CMD_TOP_EDIT 编辑(&E) -CMD_SELECT_ALL 全选(&A)\tCtrl+A -CMD_SWITCH_SELECT 切换选择(&I) -#“查看”菜单 -CMD_TOP_VIEW 查看(&V) -CMD_STATUSBAR 显示状态栏(&S) -CMD_VISTASTYLE Windows Vista / 7 / 8 / 10 风格(&T) -CMD_SHOWPORT 在连接列表中显示端口(&P) -CMD_TRAYICON 显示任务托盘上的图标(&T) -CMD_ICON 图标(&I) -CMD_DETAIL 详细(&D) -CMD_GRID 显示边框(&G) -CMD_REFRESH 刷新(&R)\tF5 -#“虚拟局域网” 菜单 -CMD_TOP_VLAN 虚拟适配器(&L) -CMD_NEW_VLAN 新建虚拟网络适配器(&C)...\tCtrl+L -CMD_ENABLE_VLAN 启用虚拟网络适配器(&E)\tCtrl+E -CMD_DISABLE_VLAN 禁用虚拟网络适配器(&S)\tCtrl+B -CMD_DELETE_VLAN 删除虚拟网络适配器(&D)\tDel -CMD_REINSTALL 重新安装驱动程序(&U)...\tCtrl+U -CMD_WINNET 打开&Windows网络连接...\tCtrl+W -#“连接” 菜单 -CMD_TOP_SECURE 智能卡(&S) -CMD_SECURE_MANAGER 智能卡管理器(&M)...\tCtrl+G -CMD_SECURE_SELECT 选择一个智能卡使用(&S)... -#“工具” 菜单 -CMD_TOP_TOOL 工具(&T) -CMD_PASSWORD 设置密码(&P)...\tCtrl+P -CMD_TRUST 管理信任的 CA 证书列表(&T)\tCtrl+R -CMD_NETIF 网络设备状态(&N)... -CMD_TCPIP TCP 协议优化工具(&O)... -CMD_MMCSS Windows Vista / 7 / 8 / 10 的优化(&V)... -CMD_TRAFFIC 网络通信速度测试工具(&R)...\tCtrl+Q -CMD_CM_SETTING 切换运行模式(&M)... -CMD_LANGUAGE 语言设置(&L) -CMD_OPTION 选项(&O)...\tCtrl+O -#“语音”菜单 -CMD_TOP_VOICE 语音(&O) -CMD_VOIDE_NONE 关闭语音指南(&D) -CMD_VOICE_NORMAL 正常语音指南(&N) -CMD_VOICE_ODD 扩展语音指南(&O) -#“帮助”菜单 -CMD_TOP_HELP 帮助(&H) -CMD_ABOUT 关于(&A)... - - - - - - - - - - - - - - - - - -########################################################################### -# # -# 命令提示符字符串数据 # -# # -########################################################################### - -PREFIX NULL - -# 控制台系统总览 -CON_INFILE_ERROR 错误: 无法打开指定的输入文件 "%s"。 -CON_OUTFILE_ERROR 错误: 无法创建指定的输出文件 "%s"。 -CON_INFILE_START 在文件 "%s" 中写入命令将被使用代替键盘输入。 -CON_OUTFILE_START 该消息输出到控制台将被保存在文件 "%s"。 -CON_USER_CANCEL [EOF] -CON_UNKNOWN_CMD "%S": 命令未找到。\n您可以使用 "HELP" 命令来查看一个可用的命令列表。 -CON_AMBIGUOUS_CMD "%S": 命令名称是模糊的。 -CON_AMBIGUOUS_CMD_1 指定的命令名称匹配以下多个命令: -CON_AMBIGUOUS_CMD_2 请更严格地重新指定命令名称。 -CON_INVALID_PARAM 参数 "/%S" 已被指定。使用命令 "%S" 时,不可能指定此参数。输入 "%S /HELP" 来看被使用的参数清单。 -CON_AMBIGUOUS_PARAM "/%S": 参数名称是不明确的。 -CON_AMBIGUOUS_PARAM_1 指定的参数名称符合以下,被指定的做为命令 "%S" 参数的参数: -CON_AMBIGUOUS_PARAM_2 请更严格地重新指定参数名称。 - - -# 不明命令 -CMD_UNKNOWM 没有这个命令的说明。 -CMD_UNKNOWN_HELP 没有这个命令的详细描述。如果您想了解更多有关此命令的详细资料,请参阅手册或在线文档。 -CMD_UNKNOWN_ARGS 没有命令执行的例子。 -CMD_UNKNOWN_PARAM 没有这个参数的说明。 - - -# 控制台系统内使用的字符串 -CMD_HELP_1 您可以使用下面的 %u 命令: -CMD_HELP_2 参考每个命令的使用,输入 "命令名称 ?" 来查看帮助。 -CMD_EVAL_MIN_MAX 您必须指定从 %u 到 %u 的整数。 -CMD_PROMPT 输入一个值: -CMD_EVAL_NOT_EMPTY 规格不能为空白。 -CMD_EVAL_SAFE 该字符串包含不可用的字符。 -CMD_EVAL_INT 您必须指定一个不小于 1 的整数。 -CMD_HELP_TITLE 关于命令 "%S" 的帮助 -CMD_HELP_DESCRIPTION [目的] -CMD_HELP_USAGE [使用方法] -CMD_HELP_HELP [说明] -CMD_HELP_ARGS [参数] -CMD_PROMPT_PORT 输入端口号: -CMD_EVAL_PORT 端口号无效。指定一个范围是 1 到 65535 的端口号。 -CMD_CT_STD_COLUMN_1 项目 -CMD_CT_STD_COLUMN_2 价值 -CMD_CT_STD_COLUMN_3 说明 -CMD_PARSE_IP_SUBNET_ERROR_1_6 指定 "IPv6 地址/子网掩码" 格式。\n通过用冒号来分开这十六位进制的数值来指定 IPv6 地址,如如“ 2001:200:0:1::”。对于子网掩码,您可以指定用冒号分开的十六位进制数值,如 “ffff:ffff:ffff:ffff::”,或者您也可以用十进制数值指定子网掩码的比特长度,如 64。\n要指定一个独立主机,指定子网掩码为“ ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff”或 “128”。\n(例)\n2001:200:0:1::/64\n2001:200:0:1::/ffff:ffff:ffff:ffff::\n2001:200:0:1::5/12\n\n -CMD_PARSE_IP_SUBNET_ERROR_1 指定 "IPv4 地址/子网掩码" 格式。\n通过用小数点来分隔十进制数值来指定 IPv4 地址,如 “192.168.0.1”。对于子网掩码,您可以通过使用小数点分隔十进制数值来来指定,如 “255.255.255.0”,或者您也可以通过使用十进制数值来指定子网掩码的比特长度如 24。\n要指定一个独立主机,您可以指定子网掩码为 255.255.255.255 或 32\n(例)\n192.168.0.1/24\n192.168.0.1/255.255.255.0\n192.168.0.5/255.255.255.255\n\n -CMD_PARSE_IP_SUBNET_ERROR_2 指定的 IP 地址不是网络地址。 -CMD_PARSE_IP_SUBNET_ERROR_3 指定的 IP 地址不是网络地址前缀。 -CMD_EVAL_DATE_TIME_FAILED 日期和时间规格无效。\n日期和时间必须为相同的格式如 "2005/10/08 19:30:00",指定 6 个整数代表年/月/日 小时:分钟:秒,用斜线,空格和冒号分隔。年指定为 4 位数。 -CMD_PARSE_IP_MASK_ERROR_1_6 指定 "IPv6 地址/掩码" 格式。\n通过用冒号来分隔十六进制的数值来指定 IPv6 地址,如 “2001:200:0:1::”。对于掩码,您可以指定由冒号分隔的十六进制的数值,如 ffff:ffff:ffff:ffff::,或者您也可以用十进制数值来指定掩码的比特长度如 64。\n要指定一个独立主机,指定掩码为 “ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff ”或“128”。\n(例) \n2001:200:0:1::/64\n2001:200:0:1::/ffff:ffff:ffff:ffff::\n2001:200:0:1::5/12\n\n -CMD_PARSE_IP_MASK_ERROR_1 指定 "IPv4 地址/掩码" 格式。\n通过用小数点来分隔十进制数值来指定 IPv4 地址,如“192.168.0.1”。对于掩码,您可以指定用小数点分隔的十进制数值,如 “255.255.255.0”,或者您也可以用十进制值指定掩码的比特长度,如 24。\n要指定一个独立主机,指定掩码为 255.255.255.255 或 32\n(例) \n 192.168.0.1/24\n 192.168.0.1/255.255.255.0\n192.168.0.5/255.255.255.255\n\n - - - -# 通用信息 -CMD_MSG_INVALID_HOSTNAME 指定的主机名无效。 -CMD_MSG_OK 命令成功完成。 -CMD_MSG_ALLOW 允许 -CMD_MSG_DENY 拒绝 -CMD_MSG_INFINITE 无限 -CMD_MSG_ENABLE 启用 -CMD_MSG_DISABLE 禁用 -CMD_MSG_LOAD_CERT_FAILED 无法读取指定的 X.509 证书文件。 -CMD_MSG_SAVE_CERT_FAILED 无法写入 X.509 证书文件。 -CMD_ACCOUNT_COLUMN_NAME VPN 连接设置名称 -CMD_ACCOUNT_COLUMN_HOSTNAME 目标 VPN Server 主机名 -CMD_ACCOUNT_COLUMN_PORT 目标 VPN Server 端口号 -CMD_ACCOUNT_COLUMN_HUBNAME 目标 VPN Server 虚拟 HUB 名称 -CMD_ACCOUNT_COLUMN_PROXY_TYPE 代理服务器类型 -CMD_ACCOUNT_COLUMN_PROXY_HOSTNAME 代理服务器主机名 -CMD_ACCOUNT_COLUMN_PROXY_PORT 代理服务器的端口号 -CMD_ACCOUNT_COLUMN_PROXY_USERNAME 代理服务器的用户名 -CMD_ACCOUNT_COLUMN_SERVER_CERT_USE 验证服务器证书 -CMD_ACCOUNT_COLUMN_SERVER_CERT_NAME 注册的服务器个人证书 -CMD_ACCOUNT_COLUMN_RETRY_ON_SERVER_CERT Retry on Untrusted Server Certificate -CMD_ACCOUNT_COLUMN_DEVICE_NAME 用于连接的设备名 -CMD_ACCOUNT_COLUMN_AUTH_TYPE 验证类型 -CMD_ACCOUNT_COLUMN_AUTH_USERNAME 用户名 -CMD_ACCOUNT_COLUMN_AUTH_CERT_NAME 客户端验证使用证书 -CMD_ACCOUNT_COLUMN_NUMTCP VPN 通信中使用的 TCP 的连接数 -CMD_ACCOUNT_COLUMN_TCP_INTERVAL 建立每个 TCP 连接的间隔 -CMD_ACCOUNT_COLUMN_TCP_TTL 每个 TCP 连接的连接周期 -CMD_ACCOUNT_COLUMN_TCP_HALF 使用半双工模式 -CMD_ACCOUNT_COLUMN_ENCRYPT 通过 SSL 加密 -CMD_ACCOUNT_COLUMN_COMPRESS 数据压缩 -CMD_ACCOUNT_COLUMN_BRIDGE_ROUTER 通过网桥 / 路由模式连接 -CMD_ACCOUNT_COLUMN_MONITOR 通过监测模式连接 -CMD_ACCOUNT_COLUMN_NO_TRACKING 不要调整路由表 -CMD_ACCOUNT_COLUMN_QOS_DISABLE 不要使用 QoS 控制功能 -CMD_ACCOUNT_COLUMN_DISABLEUDP Disable UDP Acceleration - - -# Debugging Information Collecting Tool -CMD_DEBUG_SOFTNAME 调试信息采集工具 -CMD_DEBUG_PRINT 调试信息采集工具\r\n\r\n -CMD_DEBUG_NOT_2000 要求 Windows 2000 或更高版本。 -CMD_DEBUG_NOT_ADMIN 您必须以管理员身份登录 Windows 执行此命令。 -CMD_DEBUG_UAC_FAILED 无法获得管理员权限。 -CMD_DEBUG_SAVE_TITLE 指定保存文件的目标路径 -CMD_DEBUG_OK 一个调试信息文件被保存为 "%s"。\r\n\r\n发送此文件到你的支持人员。\r\n在发送给支持人员以前,您必须验证此文件的内容。\r\n如果有一些你不想透露给其他工作人员的机密信息,你有责任移除这个文件中的机密信息。\r\n\r\n如果你忽略了包含在此文件中的机密信息,并且你同意将整个文件发送给支持人员,这意味着你已经同意透露文件中的全部内容给支持人员。 -CMD_DEBUG_NG 无法保存调试信息为 "%s"。 - - -# 测试命令 -CMD_TEST 执行测试运行。 -CMD_TEST_HELP 这是一个测试命令。执行测试运行。随着测试命令,您可以指定许多参数。您可以省略参数的个数。 -CMD_TEST_ARGS Test [/A1:a_str] [/A2:b_str] [/A3:int_value] -CMD_TEST_A1 指定参数格 A1。这可以被省略。 -CMD_TEST_A2 指定参数 A2。如果忽略,当命令执行时,提示将显示输入参数 A2。规格不能是空白。 -CMD_TEST_A3 指定一个数值。您必须指定一个范围是 1 到 100 之间的整数。指定的整数超出此范围,将导致错误信息显示。 -CMD_TEST_EVAL_A2 参数 A2 的规格不能是空白。 -CMD_IP_EVAL_FAILED IP 地址指定不正确。 -CMD_HOSTPORT_EVAL_FAILED 主机名和端口号规格无效。\n请使用指定的主机名格式:端口号 或 IP 地址:端口号。 -CMD_PORTLIST_EVAL_FAILED 端口号列表规格无效。\n列表必须至少有一个端口号设置,也可以设置多个端口号。当指定多个端口号时,使用逗号隔开,如 "443,992,8888"。 -CMD_PROTOCOL_EVAL_FAILED 协议指定不正确。可以为协议指定 ip, tcp, udp, icmpv4, icmpv6 或协议数字 (0 到 255)。 -CMD_PORT_RANGE_EVAL_FAILED 端口号或端口号范围指定不正确。如果仅指定一个端口号,必须使用一个整数来指定端口号。如果指定多个端口,开始端口号和结束端口号加一个连字符来指定,如 "80-443"。 -CMD_TCP_CONNECTION_STATE_EVAL_FAILED TCP 连接状态规格无效。\n指定 "已设立" 或 "未设立",并且在选择协议时指定 TCP。 -CMD_MAC_ADDRESS_AND_MASK_EVAL_FAILED MAC 地址和掩码规格无效。\n使用有分隔符('-' 或 ':')的十六进制数字,和没有分隔符。一个例子是 "00-AC-84-EA-33-BC/FF-FF-FF-FF-FF-FF"。 -CMD_EXEC_MSG_NAME %S 命令 - %s -CMD_ID ID -CMD_FILE_NOT_FOUND 找不到指定的文件 "%s"。 -CMD_FILE_NAME_EMPTY 文件名没有被指定。 -CMD_SAVECERTPATH 保存 X.509 证书到文件名: -CMD_SAVECERT_FAILED 无法保存证书文件。 -CMD_SAVEKEYPATH 保存密钥到文件名: -CMD_SAVEKEY_FAILED 无法保存密钥文件。 -CMD_SAVEFILE_FAILED 无法保存文件。 -CMD_LOADFILE_FAILED 无法打开文件。 -CMD_LOADCERTPATH 从……文件名读取 X.509 证书: -CMD_LOADCERT_FAILED 无法读取证书文件。 -CMD_LOADKEYPATH 从文件名……读取私钥: -CMD_LOADKEY_FAILED 无法读取密钥文件。 -CMD_LOADKEY_ENCRYPTED_1 指定的密钥文件被密码保护。 -CMD_LOADKEY_ENCRYPTED_2 请输入密码: -CMD_LOADKEY_ENCRYPTED_3 密码不正确。 -CMD_KEYPAIR_FAILED X.509 证书和私钥的组合指定不正确。证书和与该证书对应的私钥是必需的。 -CMD_CERT_NOT_EXISTS 证书未登记。 -CMD_NO_SETTINGS - -CMD_DISCONNECTED_MSG \n---Error---\n\n与您正管理的主机通信会话被中断了。从现在开始,如果您运行任何命令将出现错误。\n\n为了重新连接到您管理的主机,首先输入 "EXIT" 的离本开提示,然后重新连接。\n\n - - -# VPN CMD 命令 -CMD_VPNCMD SoftEther VPN Developer Edition 命令行管理工具 -CMD_VPNCMD_HELP “vpncmd ”程序是一个允许您通过使用命令行来管理 SoftEther VPN 软件的实用工具。通过使用 vpncmd,您可以连接到运行在本地或远程计算机的 VPN Client,VPN Server 或 VPN Bridge 并管理它们。此外,通过使用 VPN 工具模式,您可以调用网络传输速度测试工具和证书创建功能。即使不连接到 VPN Server 或 VPN Client,vpncmd 也是可以使用的。\n当使用 vpncmd 时,如果文件名是通过使用 /IN 和 /OUT 参数指定的,该命令就可以根据一个文件被批量执行。该文件列举了可执行命令的文件和执行结果可以被写入文件中。通常,vpncmd 启动后命令提示符会出现,但是,当用 /IN 参数指定一个输入文件时,在输入文件的所有行执行完成后,该程序将自动终止。此外,当指定 /CMD 参数来执行一个命令时,在命令执行完成后,程序将自动终止。您不能同时刻指定 /IN 参数和 /CMD 参数。vpncmd 程序的终止代码将是最后执行命令的错误代码 (在成功执行的情况下是 0)。在 Windows 环境下,当具有管理员权限的用户一次或多次启动 vpncmd 时,有可能只需输入 "vpncmd" 到 Windows 命令提示符或 [运行...] Windows 启动 vpncmd。为了在 UNIX 系统下得到同样的结果,您可以手动设置,PATH 环境是可变的。 -CMD_VPNCMD_ARGS vpncmd [host:port] [/CLIENT|/SERVER|/TOOLS] [/HUB:hub] [/ADMINHUB:adminhub] [/PASSWORD:password] [/IN:infile] [/OUT:outfile] [/CMD commands...] -CMD_VPNCMD_[host:port] 通过指定格式的参数 [主机名:端口号],可自动连接到主机。如果这是没有指定的,会出现一个提示让输入连接目的地。当连接到一个 VPN Client,您不能指定一个端口号。 -CMD_VPNCMD_CLIENT 连接到 VPN 客户做管理。您不能指定它与 /SERVER 一起做。 -CMD_VPNCMD_SERVER 连接到 VPN Server 或 VPN Bridge 做管理。您不能指定它与 /CLIENT 一起做。 -CMD_VPNCMD_TOOLS 启用 VPN 工具命令。 VPN 工具包括简单证书创建工具 (MakeCert 命令) 和网络传输速度测试工具 (SpeedTest 命令)。 -CMD_VPNCMD_HUB 当通过 “虚拟 HUB 管理模式”连接到 VPN Server 时,这就指定了该虚拟 HUB 名称为 "hub"。如果您指定主机名而不是 / HUB 参数,连接将通过 “服务器管理模式”进行。 -CMD_VPNCMD_ADMINHUB 在连接到 VPN Server 后,这将指定自动选择的虚拟 HUB "adminhub" 的名称。如果已经指定 /HUB 的参数,虚拟 HUB 将被自动选定,则本指定就没有必要了。 -CMD_VPNCMD_PASSWORD 当连接时,如果需要管理员密码,指定密码 "password"。当没有指定密码时,提示输入密码会被显示。 -CMD_VPNCMD_IN 这将指定的文本文件 "infile",其中包含连接完成后自动执行的命令列表。如果指定 /IN 参数,在文件中所有命令文件都执行完毕后,vpncmd 程序将自动终止。如果该文件包含多字节字符,编码必须是 Unicode (UTF-8)。这不能与 /CMD 一起被指定 (如 /CMD 是指定的,/IN 将被忽略)。 -CMD_VPNCMD_OUT 您可以指定文本文件 "outfile" 写所有的字符串,如屏幕上的提示,信息,错误和执行结果。请注意,如果指定的文件已经存在,现有文件的内容将被覆盖。输出字符串将用 Unicode (UTF-8) 编码被记录。 -CMD_VPNCMD_CMD 如果可选命令 "commands..." 包含在 /CMD 命令之后,连接完成后此命令将被执行,此后 vpncmd 程序将终止。不能与 /IN 一起指定 (如果与 /IN 一起指定,/IN 将被忽略)。在所有其他 vpncmd 参数之后指定 /CMD 参数。 -CMD_VPNCMD_CSV 您可以通过指定本选项启用 CSV 输出。每个命令的结果将会以 CSV 形式打印。用其他程序处理结果是有用的。 -CMD_VPNCMD_CS_1 通过使用 vpncmd 程序,可以取得以下成果。\n\n1. VPN Server 或 VPN Bridge 的管理。\n2. VPN Client 的管理。\n3. 使用 VPN 工具 (证书创建和网络传输速度测试工具)\n\n -CMD_VPNCMD_CS_2 选择 1, 2 或 3: -CMD_VPNCMD_HOST_1 指定的主机名或目标 VPN Server 或 VPN Bridge 正在 运行的计算机 IP 地址。\n通过以 "主机名:端口号" 格式指定,您还可以指定端口号。\n(当没有指定端口号时,使用 443。)\n如果不输入任何内容并按下回车键,将连接到端口号为 443 的本地主机 (这台电脑)。 -CMD_VPNCMD_HOST_2 指定的主机名或正在运行的目标 VPN Client 计算机的 IP 地址。\n如果不输入任何内容并且按下回车键,将连接到本地主机 (这台电脑)。 -CMD_VPNCMD_HOST_3 目标 IP 地址的主机名: -CMD_VPNCMD_HUB_1 如果通过虚拟 HUB 管理模式连接到服务器,请输入虚拟 HUB 的名称。\n如果通过服务器管理模式连接,无须输入任何内容请按回车键。\n -CMD_VPNCMD_HUB_2 指定虚拟 HUB 名称: -CMD_VPNCMD_ABOUT SoftEther VPN 命令行管理工具 (vpncmd 命令)\nDeveloper Edition\n%S\n%S\nCopyright (c) all contributors on SoftEther VPN project in GitHub.\nCopyright (c) Daiyuu Nobori, SoftEther Project at University of Tsukuba, and SoftEther Corporation.\nAll rights reserved.\n -CMD_VPNCMD_PASSWORD_1 访问被拒绝。可能是密码不正确,或者是您以不正确的管理模式连接。您可以尝试再次输入密码。要取消,请按 Ctrl + D。 -CMD_VPNCMD_PASSWORD_2 密码: -CMD_VPNCMD_ERROR 发生错误。(错误代码: %u)\n%s -CMD_VPNCMD_SERVER_CONNECTED 与服务器 "%S" 的连接已建立 (端口 %u)。 -CMD_VPNCMD_SERVER_CONNECTED_1 您有整个 VPN Server 的管理员权限。 -CMD_VPNCMD_SERVER_CONNECTED_2 您在 VPN Server 上有虚拟 HUB "%S" 的管理员权限。 -CMD_VPNCMD_CLIENT_NO_REMODE 目标 VPN Client 服务器不允许来自远程计算机的依法行政的连接。启动的计算机上运行的 VPN Client 并连接到本地主机的命令行管理工具或 VPN 客户经理。 -CMD_VPNCMD_PWPROMPT_0 请输入密码。要取消,请按下 Ctrl + D 键。 -CMD_VPNCMD_PWPROMPT_1 密码 : -CMD_VPNCMD_PWPROMPT_2 确认输入: -CMD_VPNCMD_PWPROMPT_3 密码和确认密码不匹配。请再输入密码和确认密码。 -CMD_VPNCMD_CLIENT_CONNECTED 连接到 VPN Client "%S"。 -CMD_VPNCMD_TOOLS_CONNECTED VPN 工具已推出。通过输入 "HELP",您可以查看可使用的命令列表。 - - - - -####################################################### -# # -# VPN Server 的管理命令如下 # -# # -####################################################### - - - -# About 命令 -CMD_About 显示版本信息 -CMD_About_HELP 这显示了此命令行管理工具的版本信息。版本信息中包括了 vpncmd 版本号,内部标号和内部标号信息。 -CMD_About_ARGS About - - -# ServerInfoGet 命令 -CMD_ServerInfoGet 获取服务器信息 -CMD_ServerInfoGet_Help 这使您可以获取当前连接的 VPN Server 或 VPN Bridge 的服务器信息。服务器信息中包括版本号,内部标号和内部标号信息。您还可以获取当前服务器运行模式的信息和服务器上运行的操作系统信息。 -CMD_ServerInfoGet_Args ServerInfoGet - - -# ServerStatusGet 命令 -CMD_ServerStatusGet 获取当前服务器状态 -CMD_ServerStatusGet_Help 这使您可以实时获取当前连接的 VPN Server 或 VPN Bridge 的现状。您可以得到关于数据通信和服务器上存在的不同类型对象数量的统计资料。您可以得到当前计算机所使用的操作系统内存多少的信息。 -CMD_ServerStatusGet_Args ServerStatusGet - - -# ListenerCreate 命令 -CMD_ListenerCreate 创建新的 TCP 监听器 -CMD_ListenerCreate_Help 这使您可以在服务器上创建一个新的 TCP 监听器。通过建立 TCP 监听器,服务器开始在指定的 TCP/IP 端口连接监听。\n已创建的 TCP 监听器可以被 ListenerDelete 命令删除。\n您还可以得到一个当前使用 ListenerList 命令登记的 TCP 侦听器列表。\n要执行这个命令,您必须有 VPN Server 管理员权限。 -CMD_ListenerCreate_Args ListenerCreate [port] -CMD_ListenerCreate_[port] 使用一个整数,指定新添加的 TCP/IP 监听端口号。您也可以使用一个已经被其他程序使用的端口号; 但 VPN Server 将无法使用,直到该程序结束了在端口的使用。指定一个范围从 1 到 65535 的端口号。 -CMD_ListenerCreate_PortPrompt 新增 TCP/IP 监听器端口号: - - -# ListenerDelete 命令 -CMD_ListenerDelete 删除 TCP 监听器 -CMD_ListenerDelete_Help 这允许您删除一个在服务器上已注册的 TCP 侦听器。当 TCP 监听器在运行状态,当运行停止时,监听器将被自动删除。\n您还可以得到一个当前使用 ListenerList 命令登记的 TCP 监听器列表。\n为了执行这个命令,您必须有 VPN Server 管理员权限。 -CMD_ListenerDelete_Args ListenerDelete [port] -CMD_ListenerDelete_[port] 使用一个整数,指定要删除的 TCP/IP 监听器端口号。 -CMD_ListenerDelete_PortPrompt TCP/IP 侦听器端口号: - - -# ListenerList 命令 -CMD_ListenerList 获取 TCP 监听器列表 -CMD_ListenerList_Help 这使您可以获取的 TCP 侦听器列表当前服务器上注册。您可以获取有关各种 TCP 监听器的运行状态或错误的信息。\n执行这个命令,您必须有 VPN Server 管理员权限。 -CMD_ListenerList_Args 监听器列表 -CMD_ListenerList_Column1 TCP 端口 -CMD_ListenerList_Column2 状态 - - -# ListenerEnable 命令 -CMD_ListenerEnable 开始 TCP 监听器运行 -CMD_ListenerEnable_Help 这将启动在当前服务器上注册的停止 TCP 监听器的运行。\n您还可以得到一个当前使用 ListenerList 命令注册的 TCP 监听器列表。\n为了执行这个命令,您必须有 VPN Server 管理员权限。 -CMD_ListenerEnable_Args ListenerEnable [port] -CMD_ListenerEnable_[port] 使用一个整数,指定要启动的 TCP/IP 监听器端口号。 -CMD_ListenerEnable_PortPrompt 启动 TCP/IP 监听器端口号: - - -# ListenerDisable 命令 -CMD_ListenerDisable 停止 TCP 监听器运行 -CMD_ListenerDisable_Help 这将停止在当前服务器上注册的 TCP 监侦听器的运行。\n您还可以得到一个当前使用 ListenerList 命令注册的 TCP 监听器列表。\n为了执行这个命令,您必须有 VPN Server 管理员权限。 -CMD_ListenerDisable_Args ListenerDisable [port] -CMD_ListenerDisable_[port] 使用一个整数,指定要停止的 TCP/IP 监听器端口号。 -CMD_ListenerDisable_PortPrompt 启动 TCP/IP 监听器端口号: - - -# PortsUDPSet command -CMD_PortsUDPSet Sets the UDP ports that the server should listen on -CMD_PortsUDPSet_Help This command can be used to specify a single or multiple UDP ports the server should listen on. \nYou can specify a port that is used by another process, however the server will not be able to use it until the port becomes free. \nSpecify a port number that is within the range of 1 to 65535. \nYou can list the ports that are currently set with the PortsUDPGet command. \nTo execute this command, you must have VPN Server administrator privileges. -CMD_PortsUDPSet_Args PortsUDPSet [ports] -CMD_PortsUDPSet_[ports] Multiple UDP ports can be specified by splitting them with a space or a comma, for example: "443, 992, 1194, 5555". \nSpecify "0" to disable the UDP listener. \n\nPorts: - - -# PortsUDPGet command -CMD_PortsUDPGet Lists the UDP ports that the server is listening on -CMD_PortsUDPGet_Help This command can be used to retrieve the UDP ports the server is listening on. \nYou can set the ports with the PortsUDPSet command. -CMD_PortsUDPGet_Args PortsUDPGet -CMD_PortsUDPGet_Ports UDP ports - - -# ProtoOptionsSet 命令 -CMD_ProtoOptionsSet Sets an option's value for the specified protocol -CMD_ProtoOptionsSet_Help This command can be used to change an option's value for a specific protocol. \nYou can retrieve the options using the ProtoOptionsGet command. \nTo execute this command, you must have VPN Server administrator privileges. -CMD_ProtoOptionsSet_Args ProtoOptionsSet [protocol] [/NAME:option_name] [/VALUE:string/true/false] -CMD_ProtoOptionsSet_[protocol] Protocol name. -CMD_ProtoOptionsSet_NAME Option name. -CMD_ProtoOptionsSet_VALUE Option value. Make sure to write a value that is accepted by the specified protocol! -CMD_ProtoOptionsSet_Prompt_[protocol] Protocol: -CMD_ProtoOptionsSet_Prompt_NAME Option: -CMD_ProtoOptionsSet_Prompt_VALUE Value: - - -# ProtoOptionsGet 命令 -CMD_ProtoOptionsGet Lists the options for the specified protocol -CMD_ProtoOptionsGet_Help This command can be used to retrieve the options for a specific protocol. \nDetailed info (e.g. value type) will be shown. \nYou can change an option's value with the ProtoOptionsSet command. -CMD_ProtoOptionsGet_Args ProtoOptionsGet [protocol] -CMD_ProtoOptionsGet_[protocol] Protocol name. -CMD_ProtoOptionsGet_Prompt_[protocol] Protocol: -CMD_ProtoOptionsGet_Column_Name Name -CMD_ProtoOptionsGet_Column_Type Type -CMD_ProtoOptionsGet_Column_Value Value -CMD_ProtoOptionsGet_Column_Description Description - - -# ProtoOptions -CMD_ProtoOptions_Description_OpenVPN_DefaultClientOption When OpenVPN is compiled without OCC code, it doesn't send the options string to the server. The original OpenVPN server still works, because the configuration is static. SoftEther VPN is heuristic and wants to support as many different configurations as possible. This option allows to define the string that is sent to clients built without OCC code, so that they can successfully connect. -CMD_ProtoOptions_Description_OpenVPN_Obfuscation This may help an OpenVPN client bypass firewalls that are aware of the protocol and block it. The same XOR mask has to be applied client-side, otherwise it will not be able to connect with certain obfuscation methods! -CMD_ProtoOptions_Description_OpenVPN_ObfuscationMask Mask used to XOR the bytes in the packet (used for certain obfuscation modes). -CMD_ProtoOptions_Description_OpenVPN_PushDummyIPv4AddressOnL2Mode There's a bug that manifests under certain circumstances on Linux. It causes the OpenVPN client to disconnect unless the TAP device is UP. This option tells the server to push a dummy IPv4 address (RFC7600) to the client, so that the TAP adapter is forced to be UP. - - -# ServerPasswordSet 命令 -CMD_ServerPasswordSet 设置 VPN Server 管理员密码 -CMD_ServerPasswordSet_Help 这将设置 VPN Server 管理员密码。您可以指定密码为一个参数。如果密码没有指定,将显示提示输入密码和密码确认。如果指定密码为一个参数,这个密码将在屏幕上显示瞬间,这构成了风险。我们建议尽可能避免指定这个参数,使用密码提示输入密码。\n为了执行这个命令,您必须有 VPN Server 管理员权限。 -CMD_ServerPasswordSet_Args ServerPasswordSet [password] -CMD_ServerPasswordSet_[password] 指定一个新的密码设置。 - - -# ClusterSettingGet 命令 -CMD_ClusterSettingGet 获取当前 VPN Server 群集配置 -CMD_ClusterSettingGet_Help 你可以用它来获取当前 VPN Server 的群集配置。\n为了执行这个命令,您必须有 VPN Server 管理员权限。 -CMD_ClusterSettingGet_Args ClusterSettingGet -CMD_ClusterSettingGet_Current 当前配置 -CMD_ClusterSettingGet_None (没有设置) -CMD_ClusterSettingGet_PublicIp 公网 IP 地址 -CMD_ClusterSettingGet_PublicPorts 公共端口列表 -CMD_ClusterSettingGet_Controller 目标控制器 -CMD_ClusterSettingGet_ControllerOnly 仅限控制器功能 -CMD_ClusterSettingGet_Weight 群集性能标准 - - -# ClusterSettingStandalone 命令 -CMD_ClusterSettingStandalone 设置为独立的 VPN Server 类型 -CMD_ClusterSettingStandalone_Help 使用此设置 VPN Server 类型为 [独立服务器]。独立服务器指 VPN Server 在当前状态下不属于任何群集。当 VPN Server 安装后,默认情况下为独立的服务器模式。除非你有特别的计划来配置群集,我们建议 VPN Server 以独立模式运行。\n为了执行这个命令,您必须有 VPN Server 管理员权限。\n还有,当这个命令执行时,VPN Server 会自动重新启动。\n此命令不能在 VPN Bridge 上运行。 -CMD_ClusterSettingStandalone_Args ClusterSettingStandalone - - -# ClusterSettingController 命令 -CMD_ClusterSettingController 设置 VPN Server 类型为群集控制器 -CMD_ClusterSettingController_Help 使用此设置 VPN Server 类型为 [群集控制器]。群集控制器是一个群集的所有成员服务器的中央电脑,群集环境是由多个 VPN Server 构成。一个群集需要一台电脑成为这个角色。在同一群集配置里的其他群集成员服务器,是通过连接到群信控制器作为群集成员开始运行的。 \n为了执行这个命令,您必须有 VPN Server 管理员权限。\n还有,当这个命令执行时刻,VPN Server 会自动重新启动。\n此命令不能在 VPN Bridge 上运行。 -CMD_ClusterSettingController_Args ClusterSettingController [/WEIGHT:weight] [/ONLY:yes|no] -CMD_ClusterSettingController_WEIGHT 这设置了这个 VPN Server 的性能标准比值。这是在群集负载平衡中执行的标准值。一般而言,这个值是 100。例如,仅设置一台机器为 200,而其他成员机器为 100,在负载平衡期间,将调节这台机器收到其他成员两倍的连接数。指定 1 或更高的值。如果此参数未指定,将使用 100。 -CMD_ClusterSettingController_ONLY 通过在这里指定 "yes",VPN Server 在群集里仅作为一个控制器运行,并总是分配一般 VPN Client 连接给到自身以外的成员。此功能用于高负载的环境。如果此参数未指定,"no" 将被使用。 - - -# ClusterSettingMember 命令 -CMD_ClusterSettingMember VPN Server 类型设置为群集成员 -CMD_ClusterSettingMember_Help 使用此设置 VPN Server 类型,[群集成员服务器]。一个群集成员服务器是成员的计算机属于群集配置由多个 VPN Server 与另一个中心现有群集控制器。集群成员可以根据需要任意添加到群集。\n在设置为群集成员服务器的 VPN Server,群集控制器管理员要为控制器的 IP 地址和端口号使用,需要知道公共 IP 地址和公共端口号 (必要时本 VPN Server) 和密码。\n要执行这个命令,您必须拥有 VPN Server 管理员权限。\n另外,在执行此命令,VPN Server 会自动重新启动。\n此命令不能运行的 VPN Bridge。 -CMD_ClusterSettingMember_Args ClusterSettingMember [server:port] [/IP:ip] [/PORTS:ports] [/PASSWORD:password] [/WEIGHT:weight] -CMD_ClusterSettingMember_[server:port] 按照 [主机名:端口号] 的形式,设定目的地群集控制器的主机名,IP 地址,端口号等。 -CMD_ClusterSettingMember_IP 指定该服务器的公用 IP 地址。如果不指定公用 IP 地址,请设定 "/IP:none"。当 IP 地址没有指定,将自动使用的网络接口的 IP 地址连接到群集控制器。 -CMD_ClusterSettingMember_PORTS 指定服务器的公开端口一览。该清单必须至少有一个公共端口号设置,也可以设置多个公共端口号。当指定多个端口号,例如 "/PORTS:443,992,8888" 中间用逗号分开。 -CMD_ClusterSettingMember_PASSWORD 指定连接到目标控制器的密码。它与目标控制器管理密码是相同的。 -CMD_ClusterSettingMember_WEIGHT 这设定了一个表现这个 VPN Server 的标准比率值。这是负载平衡集群中执行的标准值。一般而言,这个值是 100。例如,只有一台机器是 200,而其他成员是 100 个单位,将规范这台机器得到像其他许多成员期间两次连接负载平衡。指定 1 或更高的值。如果此参数未指定,将使用 100。 -CMD_ClusterSettingMember_Prompt_IP_1 指定一个公用 IP 地址。\n如果你不指定,请按回车键,不需要输入任何东西。 -CMD_ClusterSettingMember_Prompt_IP_2 公共 IP 地址: -CMD_ClusterSettingMember_Prompt_PORT_1 请指定一个公共端口号的列表。\n有 2 个或以上指定端口号,如例用逗号分隔: "443,992,8888"。 -CMD_ClusterSettingMember_Prompt_PORT_2 公共端口号: -CMD_ClusterSettingMember_Prompt_HOST_1 目标控制器的主机名和端口号: - - -# ClusterMemberList 命令 -CMD_ClusterMemberList 获得群集成员名单 -CMD_ClusterMemberList_Help 使用此命令时,VPN Server 作为群集控制器操作获得对相同的群集群集成员服务器,包括群集控制器本身的列表。\n若需每个成员,下面的信息也被列入。 [类型],[连线开始],[主机名],[点],[会期号码],[TCP 连接数],[虚拟的作业站数目],[使用客户端连接许可证],[使用大桥连接许可证]。\n此命令不能运行在 VPN Bridge。 -CMD_ClusterMemberList_Args ClusterMemberList - - -# ClusterMemberInfoGet 命令 -CMD_ClusterMemberInfoGet 会员信息的获取 -CMD_ClusterMemberInfoGet_Help 当 VPN Server 作为群集控制器操作,您就可以通过指定的集的成员服务器 ID 获得在群集成员的信息。\n您可以得到有关指定群集成员服务器上的以下信息: ]服务器类型]、],[已建立连接的时间],[IP 地址],[主机名],[点],[公共端口列表],[操作中的虚拟 HUB],[第一虚拟 HUB],[会话数],[TCP 连接数]。\n此命令不能运行在 VPN Bridge。 -CMD_ClusterMemberInfoGet_Args ClusterMemberInfoGet [id] -CMD_ClusterMemberInfoGet_[id] 指定想获信息的取群集成员的 ID。ID 地址可以在 ClusterMemberList 中获得。 -CMD_ClusterMemberInfoGet_PROMPT_ID 拟获取信息的群集成员 ID: - - -# ClusterMemberCertGet 命令 -CMD_ClusterMemberCertGet 获得群集成员证书 -CMD_ClusterMemberCertGet_Help 当 VPN Server 作为群集控制器操作,您就可以通过指定的群集这些成员服务器的 ID 的群集成员服务器获取公共 X.509 证书。您可以保存为 X.509 格式文件。\n此命令不能在 VPN Bridge 中运行。 -CMD_ClusterMemberCertGet_Args ClusterMemberCertGet [id] [/SAVECERT:cert] -CMD_ClusterMemberCertGet_[id] 指定获取证书所需的群集的成员的 ID。此 ID 可以群集成员使用 ClusterMemberList 中获得。 -CMD_ClusterMemberCertGet_SAVECERT 指定路径以保存您获得的证书。证书被保存为 X.509 格式。 -CMD_ClusterMemberCertGet_PROMPT_ID 获取证书的集群会员 ID: - -# ClusterConnectionStatusGet 命令 -CMD_ClusterConnectionStatusGet 获得群集控制器的连接状态的信息 -CMD_ClusterConnectionStatusGet_Help 使用此命令时,VPN Server 作为群集控制器操作来获得连接状态的群集控制器。\n您可以得到以下信息: [控制器 IP 地址],[端口号],[连接状态],[连线开始时间],[第一个连接成立时间],[当前连接成立时间],[的连接尝试次数],[成功连接次数],[连接失败次数]。\n此命令不能运行在 VPN Bridge。 -CMD_ClusterConnectionStatusGet_Args ClusterConnectionStatusGet - - -# Debug 命令 -CMD_Debug 执行调试命令 -CMD_Debug_Help 在运行的 VPN Server / Bridge 进程上运行调试命令。\n此命令在支持人员请求这么做时执行。\n错误使用此命令,很可能造成 VPN Server / Bridge 运行崩溃。 -CMD_Debug_Args Debug [id] [/ARG:arg] -CMD_Debug_[id] 指定一个调试命令序号。 -CMD_Debug_ARG 指定一个字符串传递给调试命令。如果该字符串包含空格,并且整个命令都包含在" "内。 -CMD_Debug_Msg1 发送调试命令... -CMD_Debug_Msg2 调试命令已执行。\n结果: \"%S\" - -# Crash 命令 -CMD_Crash 出现一个错误的 VPN Server / Bridge 强行终止该进程。 -CMD_Crash_Help 此命令会在 VPN Server / Bridge 的进程中产生一个严重的错误(内存访问冲突),从而会导致进程崩溃。于是,在服务模式下的 VPN Server / Bridge 将会终止并重启。如果 VPN Server 在用户模式下运行,进程将不会自动重启。\n本命令适用于:当 VPN Server / Bridge 处于一个不可恢复的错误或者进程无限循环时。此命令将断开所有 VPN Server / Bridge 上的 VPN 会话。所有在 VPN Server / Bridge 内存中未保存的设置将会丢失。\n在运行此命令前,运行"Flush" 命令来把不稳定的数据保存在配置文件中。\n要执行此命令,您必须具有 VPN Server / Bridge 的管理员权限。 -CMD_Crash_Args Crash [yes] -CMD_Crash_[yes] 确认请输入 "yes" -CMD_Crash_Msg 发送崩溃命令给 VPN Server。VPN Server 将会立即崩溃,所以您不可能收到本命令的结果值。此刻以后,vpncmd 将会自动断开 VPN Server 的连接。 -CMD_Crash_Confirm 您确定要使 VPN Server 崩溃?\n如果确定请键入 "yes": -CMD_Crash_Aborted 崩溃命令中止。 - - -# Flush 命令 -CMD_Flush 保存 VPN Server / Bridge 全部不稳定数据到配置文件。 -CMD_Flush_Help 通常,不稳定设置数据会保存在 VPN Server / Bridge 的内存中。它定期以 vpn_server.config 或者 vpn_bridge.config 刷新硬盘。默认周期是 300 秒(5 分钟)。(周期长度可以在配置文件中,通过修改 AutoSaveConfigSpan 进行改变。)数据会在正常关闭 VPN Server / Bridge 时保存。\n执行 Flush 命令使 VPN Server / Bridge 立即保存设置至文件。此设置数据将被保存在服务器计算机的磁盘驱动中。在您没有足够时间正常关闭服务器进程的情况下,使用 Flush 命令。\n执行此命令,您必须有 VPN Server 管理员权限。\n执行此命令,您必须有 VPN Server / Bridge 的管理员权限。 -CMD_Flush_Args Flush -CMD_Flush_Msg1 从内存到磁盘写入不稳定数据...\n -CMD_Flush_Msg2 保存成功。文件大小是 %S 字节。\n - - -# ServerCertGet 命令 -CMD_ServerCertGet 获得 VPN Server 的 SSL 证书 -CMD_ServerCertGet_Help VPN Server,取得连接客户机所需的 SSL 证书。证书可以保存为 X.509 的格式。 -CMD_ServerCertGet_Args ServerCertGet [cert] -CMD_ServerCertGet_[cert] 获得的证书指定文件保存路径,以 X.509 的形式保存。 - - -# ServerKeyGet 命令 -CMD_ServerKeyGet 获取 VPN Server SSL 证书的密钥 -CMD_ServerKeyGet_Help VPN Server,为已连接客户提供获得证书的密钥。密钥可以存储为 Base 64 的编码文件。 \n为了运行此命令,VPN Server 需要管理员的权限。 -CMD_ServerKeyGet_Args ServerKeyGet [key] -CMD_ServerKeyGet_[key] 指定文件的路径名来存储已获得的密钥。将密钥存储为 Base 64 编码。 - - -# ServerCertSet 命令 -CMD_ServerCertSet VPN Server 的 SSL 证书和密钥的设置 -CMD_ServerCertSet_Help 设置已连接 VPN Server 的客户端所需的 SSL 证书,以及跟证书相对应的密钥。证书为 X.509 格式,密钥为 Base 64 编码格式。\n为了运行此命令,需要有 VPN Server 管理员权限。 -CMD_ServerCertSet_Args ServerCertSet [/LOADCERT:cert] [/LOADKEY:key] -CMD_ServerCertSet_LOADCERT 指定要使用的 X.509 格式的证书文件。 -CMD_ServerCertSet_LOADKEY 指定格式为 Base 64 编码并且与证书对应的密钥文件。 - - -# ServerCipherGet 命令 -CMD_ServerCipherGet 获取 VPN 通信中使用的加密程序 -CMD_ServerCipherGet_Help 您可以获取 VPN Server 和客户端之间进行通信时使用的 SSL 加密,电子签名等,以及在 VPN Server 上的程序列表。 -CMD_ServerCipherGet_Args ServerCipherGet -CMD_ServerCipherGet_SERVER VPN Server 正在使用的加密程序: -CMD_ServerCipherGet_CIPHERS 可以使用的加密程序一览表: - -# ServerCipherSet 命令 -CMD_ServerCipherSet 设置 VPN 通讯中使用的加密程序, -CMD_ServerCipherSet_Help 您可以设置 VPN Server 和客户端在通讯中应用的 SSL 加密连接,电子签名等应用程序。\n如果您指定程序的名称,以后和 VPN Server 连接的 VPN Client,VPN Bridge 之间的将应用指定程序,数据将被加密。\n运行此命令,需要 VPN Server 管理员的权限。 -CMD_ServerCipherSet_Args ServerCipherSet [name] -CMD_ServerCipherSet_[name] 指定设置加密和数字签名的程序。可以使用的程序一览,可以从 ServerCipherGet 指令中获取。 -CMD_ServerCipherSet_PROMPT_NAME 指定的加密程序的名称: - -# KeepEnable 命令 -CMD_KeepEnable 启动 Internet 保持连接功能 -CMD_KeepEnable_Help 启动 [互联网保持连接功能]。启动此功能后,如果一段时间没有通信数据,导致连接将被断开时,会自动发送数据包到任何服务器,互联网服务器一定的间隔,从而可以保持连接。\n目标主机名等,可以通过 KeepSet 指令来设置。\nVPN Server 或 VPN Bridge 运行此命令时,您必须具有管理员的权限。 -CMD_KeepEnable_Args KeepEnable - - -# KeepDisable 命令 -CMD_KeepDisable 禁用保持互联网连接功能 -CMD_KeepDisable_Help 解除 [保持互联网连接功能]。\nVPN Server 或 VPN Bridge 运行此命令,您必须具有管理员权限。 -CMD_KeepDisable_Args KeepDisable - - -# KeepSet 命令 -CMD_KeepSet 设置 Internet 保持连接功能 -CMD_KeepSet_Help 设置 [保持互联网连接功能] 的目标主机名。 如果一段时间没有任何通信数据,连接将被断开时,使用 [保持互联网连接功能 ] 可以,设定时间向 Internet 上的任何服务器发送数据包,从而可以保持您的 Internet 连接。\n在此功能中,可以设置目标 [主机名],[端口号],[数据包发送时间间隔],以及 [协议]。\n发送的数据包为随机内容,不会讲计算机和个人的识别信息发送。\n保持 Internet 连接功能,可以通过 KeepEnable 命令,或使用命令 KeepDisable,实现启用 / 禁用。不可以用 KeepSet 来改变启用 / 禁用的状态。 \nVPN Server 或 VPN Bridge 运行此命令,您必须具有管理员权限。 -CMD_KeepSet_Args KeepSet [/HOST:host:port] [/PROTOCOL:tcp|udp] [/INTERVAL:interval] -CMD_KeepSet_HOST 用 [主机:端口] 的格式,来设定目标主机名或 IP 地址和端口号。 -CMD_KeepSet_PROTOCOL 设定 tcp 或 udp。 -CMD_KeepSet_INTERVAL 以秒为单位设定发送数据包之间的间隔时间。 -CMD_KeepSet_PROMPT_HOST 设定目标主机名或 IP 地址和端口号: -CMD_KeepSet_PROMPT_PROTOCOL tcp 或 udp: -CMD_KeepSet_PROMPT_INTERVAL 发送数据包时间间隔 (秒): -CMD_KeepSet_EVAL_TCP_UDP 设定 "tcp" 或 "udp"。 - -# KeepGet 命令 -CMD_KeepGet 获取保持互联网连接的功能 -CMD_KeepGet_Help 获取 [保持互联网连接功能] 的当前设置。可以得到 [主机名],[端口],[数据包发送时间间隔],和 [协议],还包括当前 [保持互联网连接功能] 是否启用的当前状态。 -CMD_KeepGet_Args KeepGet -CMD_KeepGet_COLUMN_1 主机名 -CMD_KeepGet_COLUMN_2 端口号 -CMD_KeepGet_COLUMN_3 数据包发送时间间隔 (秒) -CMD_KeepGet_COLUMN_4 协议 -CMD_KeepGet_COLUMN_5 当前状态 - - -# SyslogEnable 命令 -CMD_SyslogEnable 设置发送系统日志功能 -CMD_SyslogEnable_Help 使用 syslog 发送系统日志的使用方法和服务器的设置。 -CMD_SyslogEnable_Args SyslogEnable [1|2|3] [/HOST:host:port] -CMD_SyslogEnable_[1|2|3] 使用 syslog 功能 1 - 3 来进行设置。\n1: 发送 syslog 服务器日志。\n2: 发送服务器和虚拟 HUB 安全系统日志。\n3: 服务器,虚拟 HUB 安全和数据包发送系统日志记录枢纽。 -CMD_SyslogEnable_HOST 按照 [主机:端口] 的形式,设定系统日志服务器主机名或 IP 地址和端口号。如果省略端口号使用 514。 -CMD_SyslogEnable_MINMAX 设置 syslog 发送功能 1 - 3。 -CMD_SyslogEnable_Prompt_123 系统日志传输功能 (1 - 3): -CMD_SyslogEnable_Prompt_HOST 指定发送日志的服务器: - - -# SyslogDisable 命令 -CMD_SyslogDisable 禁用发送系统日志的功能 -CMD_SyslogDisable_Help 解除系统日志的传送功能。 -CMD_SyslogDisable_Args SyslogDisable - - -# SyslogGet 命令 -CMD_SyslogGet 取得发送系统日志的功能 -CMD_SyslogGet_Help 获取 syslog 发送功能的当前设置。您可以设置系统日志功能的使用方法,可以获取 syslog 服务器的主机名和端口号。 -CMD_SyslogGet_Args SyslogGet -CMD_SyslogGet_COLUMN_1 设置系统日志发送功能 -CMD_SyslogGet_COLUMN_2 发送系统日志服务器主机名 -CMD_SyslogGet_COLUMN_3 syslog 服务器端口号 - - -# ConnectionList 命令 -CMD_ConnectionList 获取与 VPN Server 相连的 TCP 连接一览 -CMD_ConnectionList_Help 现在,先获取与 VPN Server 连接的 TCP/IP 一览表。但是,VPN 会话作为 TCP/IP 连接不显示。VPN 会话建立的 TCP/IP 连接一览表,何以运用 SessionList 命令获得。\n可以获取 [连接名称], [原始连接], [连接时间] 和 [类型]。\n要运行此命令,VPN Server 需要管理员权限。 -CMD_ConnectionList_Args ConnectionList - - -# ConnectionList 命令 -CMD_ConnectionGet 获取连接到 VPN Server 的 TCP 信息一览表 -CMD_ConnectionGet_Help 获取与 VPN Server 连接的 TCP/IP 连接的详细信息。\n可以获得 [连接名],[连接种类],[连接主机名],[连接主机 IP],[联机主机端口 TCP],[连接时间],[服务器品牌],[服务器版本],[服务器铭牌号],[客户机品牌],[客户机版本],[客户机铭牌号] 等信息。 \n要运行此命令,需要管理员权限。 -CMD_ConnectionGet_Args ConnectionGet [name] -CMD_ConnectionGet_[name] 指定希望获取信息的连接名称。所有连接的一览表,可以通过 ConnectionList 命令获得。 -CMD_ConnectionGet_PROMPT_NAME 用以获取信息的连接名称: - -# ConnectionDisconnect 命令 -CMD_ConnectionDisconnect 断开 VPN Server 和 TCP 的连接 -CMD_ConnectionDisconnect_Help 强制切断 VPN Server 和指定的 TCP/IP 的连接。\n运行此命令,需要管理员权限。 -CMD_ConnectionDisconnect_Args ConnectionDisconnect [name] -CMD_ConnectionDisconnect_[name] 选定希望切断的连接。连接的名称可以从 ConnectionList 命令中获得。 -CMD_ConnectionDisconnect_PROMPT_NAME 断开连接的名称: - - -# BridgeDeviceList 命令 -CMD_BridgeDeviceList 获取可以在当地的网桥上使用的 LAN 卡一览 -CMD_BridgeDeviceList_Help 使用当地网桥连接,获取目标桥中可以使用的设备 (LAN 卡) 列表。\n在此显示的设备名字,BridgeCreate 命令都可以使用。\n为了运行此命令,需要管理员权限。 -CMD_BridgeDeviceList_Args BridgeDeviceList - - -# BridgeList 命令 -CMD_BridgeList 获得当地网桥连接列表 -CMD_BridgeList_Help 获取当地定义的网桥连接列表。\n可以获取当地网桥连接的虚拟 HUB 名称,目标太网桥连接器件 (LAN 卡) 的名称,或可以获取设备的名称和工作状态。 -CMD_BridgeList_Args BridgeList - - -# BridgeCreate 命令 -CMD_BridgeCreate 创建本地的网桥连接 -CMD_BridgeCreate_Help 在 VPN Server 上创建新的本地网桥连接的。\n当您使用一个本地的网桥,这个虚拟 HUB 和物理以太网设备 (LAN 卡在两层) 之间可以创建网桥连接。\n在系统中创建 tap 设备 (虚拟网络接口),可以与虚拟 HUB 建立连接 (tap 设备仅支持 Linux)。\n目的地以太网桥设备 (LAN 卡) 可以连接到您的任何运行的 LAN 卡,但是高负荷环境的网桥,建议您准备专用的 LAN 卡。\n要运行此命令,需要管理员权限。 -CMD_BridgeCreate_Args BridgeCreate [hubname] [/DEVICE:device_name] [/TAP:yes|no] -CMD_BridgeCreate_[hubname] 选定虚拟 HUB 的网桥。虚拟 HUB 列表,可以通过 HubList 命令获得。但是,没有必要一定要选定目前正在运行的虚拟 HUB,即使选定目前没有工作,或不存在的虚拟名称的 HUB,当它真正工作时,它与虚拟本地网桥就会建立连接。 -CMD_BridgeCreate_DEVICE 设定目标以太网桥设备 (LAN 卡) 的名称,或 tap 设备的名称。以太网设备名单,可以通过运行 BridgeDeviceList 命令得到。 -CMD_BridgeCreate_TAP 网桥连接局域网,不使用 LAN 卡,而是使用 tap 设备时,选定 yes,如果您使用的设备指定 (只支持 Linux)。如果省略,默认为 no。 -CMD_BridgeCreate_PROMPT_HUBNAME 网桥虚拟 HUB 名称: -CMD_BridgeCreate_PROMPT_DEVICE 目标网桥的设备名称: -CMD_BridgeCreate_PROMPT_TAP 你想使用 tap 设备吗 (yes/no): - - -# BridgeDelete 命令 -CMD_BridgeDelete 删除本地网桥连接 -CMD_BridgeDelete_Help 删除现有的当地网桥连接。当地网桥梁连接的列表,可以通过 BridgeDeviceList 命令得到。\n运行此命令,需要服务器管理员权限。 -CMD_BridgeDelete_Args BridgeDelete [hubname] [/DEVICE:device_name] -CMD_BridgeDelete_[hubname] 选定被删除的当地网桥的虚拟 HUB。 -CMD_BridgeDelete_DEVICE 选定被删除的当地的网桥的设备名 (LAN 卡的名称或 tap 设备的名称)。 -CMD_BridgeDelete_PROMPT_HUBNAME 删除虚拟网桥 HUB 的名称: -CMD_BridgeDelete_PROMPT_DEVICE 删除网桥的设备名: - - -# Caps 命令 -CMD_Caps 获得服务器的功能性能一览表 -CMD_Caps_Help 取得现在正在连接使用的 VPN Server 的功能和性能的清单。\nVPN Server 的功能和性能取决于服务器的版本。指令清单中的指令也可能因为对方的服务器的功能,而无法工作。因此此命令需调查目标服务器的功能。\n如果 VPN Server 的版本比命令行管理工具的版本新,存在不掌握的指令时,其内部的字符串 (变量名),但可能原原本本的表示出来。 -CMD_Caps_Args Caps - - -# Reboot 命令 -CMD_Reboot VPN Server 服务重新启动 -CMD_Reboot_Help VPN Server 重新启动该服务。\nVPN Server 重新启动服务,目前连接的会话和 TCP 连接都将被切断,直道建立新的连接。\n此命令,VPN Server,只是重新启动服务程序,而不是重新启动计算机。这种管理的连接也会断开,如果需要请重新建立连接。\n此外,/RESETCONFIG:yes 指定参数,并对 VPN Server 的系统内容 (.config) 进行初始化。\n要运行此命令,VPN Server需要管理员权限。 -CMD_Reboot_Args Reboot [/RESETCONFIG:yes|no] -CMD_Reboot_RESETCONFIG 选定 yes,对当前的 VPN Server 的系统内容 (.config) 初始化。请谨慎设置此参数。 - - -# ConfigGet 命令 -CMD_ConfigGet 获取 VPN Server 当前系统配置 -CMD_ConfigGet_Help 获取 VPN Server 当前 (.config 文件) 系统结构化文本保存的文本文件,你可以检索到 VPN Server 执行这个指令的瞬间状态。\n系统内容的文件,如果不指定参数,会在屏幕上直接显示。如果您指定参数保存,会保存为一个指定的文件名。\n配置文件可以使用普通的文本编辑器编辑。编辑好的文件要写入 VPN Server,需执行 ConfigSet 命令。\n要运行此命令,VPN Server 需要管理员权限。 -CMD_ConfigGet_Args ConfigGet [path] -CMD_ConfigGet_[path] 如果你想保存配置文件,请指定文件名。如果没有指定,配置的内容将以画面形式显示在屏幕上。如果配置是多字字符的,请转变成 Unicode (UTF-8) 编码存储。 -CMD_ConfigGet_FILENAME Config 名称: "%S", 大小: %u -CMD_ConfigGet_FILE_SAVE_FAILED 无法创建指定的文件。 - - -# ConfigSet 命令 -CMD_ConfigSet 往 VPN Server 上写入系统配置内容 -CMD_ConfigSet_Help 往 VPN Server 上写入系统配置内容。这样,您选定的系统配置内容会适用于 VPN Server,VPN Server 程序会自动重启,新的系统配同配置开始工作。\n对系统管理者来说,要记录所有的系统配置的文件是比较困难的。因此建议使用 ConfigGet 命令,先获取当前的 VPN Server 的系统配置内容保存成文件,再将此文件加以编辑,然后用 ConfigSet 命令写入 VPN Server。\n这个操作,需要对 VPN Server 充分的了解,如果写入了不正确的系统配置信息,系统将发生错误,甚至可能丢失现在的设置内容。请务必小心操作。\n执行这个命令,需要 VPN Server 的管理员权限。 -CMD_ConfigSet_Args ConfigSet [path] -CMD_ConfigSet_[path] 指定配置文件的名称。如果文件有多种文字,请先变化成 Unicode (UTF-8) 格式。 -CMD_ConfigSet_PROMPT_PATH 将配置上传到服务器上的文件路径名称: -CMD_ConfigSet_FILE_LOAD_FAILED 无法加载指定的文件。 - - -# RouterList 命令 -CMD_RouterList 获取虚拟 3 层交换机列表 -CMD_RouterList_Help 在 VPN Server 上获取 3 层虚拟交换机的清单。获取虚拟 3 层交换机的 [交换机名称],[工作状态],[接口数量],[路由数目] 等信息。\n要运行此命令,需要 VPN Server 管理员权限。\n此外,此命令不能在 VPN Bridge 中运行。 -CMD_RouterList_Args RouterList - - -# RouterAdd 命令 -CMD_RouterAdd 定义一个新的虚拟 3 层交换机 -CMD_RouterAdd_Help 在 VPN Server 上定义一个新的 3 层虚拟交换机。\n要运行此命令,需要 VPN Server 管理员权限。\n此外,此命令不能在 VPN Bridge 中运行。\n\n[虚拟 3 层交换机功能的说明]\n在这个虚拟 VPN Server 上运行的多个虚拟 HUB 之间,可以通过定义的虚拟 3 层交换机,实现不同 IP 地址之间的路由。\n\n[虚拟 3 层交换机功能的注意事项]\n虚拟 3 层交换机功能是基于对网络和 IP 路由熟悉的人或者是网络管理员使用的。如果您使用正常的 VPN 功能,您没有必要使用虚拟 3 层交换机。\n如果您使用虚拟 3 层交换机的功能,请您务必要十分熟悉 IP 路由方面的知识,并十分清楚您的设置将对网络产生的影响。 -CMD_RouterAdd_Args RouterAdd [name] -CMD_RouterAdd_[name] 创建一个新的虚拟 3 层交换机的名称。新创建的名称与现有的名称是不能相同。 -CMD_RouterAdd_PROMPT_NAME 要创建的虚拟 3 层交换机的名称: - - -# RouterDelete 命令 -CMD_RouterDelete 删除虚拟 3 层交换机 -CMD_RouterDelete_Help 删除在 VPN Server 上已定义的 3 层虚拟交换机。如果选定的虚拟 3 层交换机正在运行,它将停止工作,然后自动删除。\n获取虚拟 3 层交换机的清单,可以使用 RouterList 命令。\n要运行此命令,需要 VPN Server 管理员权限。\n此外,此命令不能在 VPN Bridge 中运行。 -CMD_RouterDelete_Args RouterDelete [name] -CMD_RouterDelete_[name] 选定想要删除的虚拟 3 层交换机的名称。 -CMD_RouterDelete_PROMPT_NAME 想要删除的虚拟 3 层交换机的名称: - - -# RouterStart 命令 -CMD_RouterStart 开始运行虚拟 3 层交换机 -CMD_RouterStart_Help VPN Server 上已经存在的虚拟 3 层交换机,如果处于停止工作工作状态,将开始运行。\n获取当前的虚拟 3 层交换机清单,可以执行 RouterList 命令。\n要运行此命令,需要 VPN Server 管理员权限。\n此外,此命令不能在 VPN Bridge 运行。\n\n[虚拟 3 层交换机功能的说明]\n在这个虚拟 VPN Server 上运行的多个虚拟 HUB 之间,可以通过定义的虚拟 3 层交换机,实现不同 IP 地址之间的路由。\n\n[虚拟 3 层交换机功能的注意事项]\n虚拟 3 层交换机功能是基于对网络和 IP 路由熟悉的人或者是网络管理员使用的。如果您使用正常的 VPN 功能,您没有必要使用虚拟 3 层交换机。\n如果您使用虚拟 3 层交换机的功能,请您务必要十分熟悉 IP 路由方面的知识,并十分清楚您的设置将对网络产生的影响。 -CMD_RouterStart_Args RouterStart [name] -CMD_RouterStart_[name] 选定即将启动的虚拟 3 层交换机的名称。 -CMD_RouterStart_PROMPT_NAME 即将启动的虚拟 3 层交换机的名称: - - -# RouterStop 命令 -CMD_RouterStop 停止虚拟 3 层交换机的运行 -CMD_RouterStop_Help 在 VPN Server 上已定义的虚拟 3 层交换机,如果正在运行,它将停止运行。\n想要获取现有的虚拟 3 层交换机清单,可以运行 RouterList 命令。\n要运行此命令,需要 VPN Server 管理员权限。 -CMD_RouterStop_Args RouterStop [name] -CMD_RouterStop_[name] 选定想要停止运行的虚拟 3 层交换机的名称。 -CMD_RouterStop_PROMPT_NAME 想要停止运行的虚拟 3 层交换机名称: - - -# RouterIfList 命令 -CMD_RouterIfList 获取在虚拟 3 层交换机中注册的远程接口的清单 -CMD_RouterIfList_Help 如果在指定的虚拟 3 层交换机上有已经定义的虚拟远程接口,您将会获取一个虚拟接口列表。\n在一个虚拟 3 层交换机上,您可以定义多个虚拟接口和路由表。\n虚拟接口与虚拟 HUB 相互关联,当虚拟 HUB 运行时,虚拟接口就像一个虚拟 IP 主机在工作。相对于多个 IP 虚拟 HUB,如果定义分属不同网络的多个远程接口时,IP 路由会自动运行。\n要运行此命令,需要 VPN Server 管理员权限。\n此外,此命令不能在 VPN Bridge 中运行。 -CMD_RouterIfList_Args RouterIfList [name] -CMD_RouterIfList_[name] 选定虚拟 3 层交换机的名称。 -CMD_RouterIfList_PROMPT_NAME 虚拟 3 层交换机的名称: - - -# RouterIfAdd 命令 -CMD_RouterIfAdd 在虚拟 3 层交换机上添加一个虚拟远程接口 -CMD_RouterIfAdd_Help 指定的 3 层虚拟交换机,为它添加一个在同一个 VPN Server 上运行的虚拟 HUB 的连接虚拟接口。\n一个指定的 3 层虚拟交换机,您可以定义多个虚拟接口和路由表。\n虚拟接口与虚拟 HUB 相互关联,当虚拟 HUB 运行时,虚拟接口就像一个虚拟 IP 主机在工作。相对于多个 IP 虚拟 HUB,如果定义分属不同网络的多个远程接口时,IP 路由会自动运行。\n虚拟接口的 IP 网络空间,虚拟接口的 IP 地址必须被定义。\n虚拟接口必须制定目标连接的虚拟 HUB 的名称。\n指定虚拟 HUB 时,也可选定当前不存在的虚拟 HUB。\n虚拟接口必须在虚拟 HUB 内有一个 IP 地址。此外,还需指定属于该 IP 地址的 IP 网络的子网掩码。\n设置虚拟 HUB 内几个虚拟空间通过交换机的路由网,需在指定的 IP 地址操作。\n要运行此命令,需要 VPN Server 管理员权限。\n此外,此命令不能在 VPN Bridge 中运行。 \n要运行此命令,操作对象的虚拟 3 层交换机必须关闭。如果正在运行中,可用 RouterStop 命令让其停止。 -CMD_RouterIfAdd_Args RouterIfAdd [name] [/HUB:hub] [/IP:ip/mask] -CMD_RouterIfAdd_[name] 指定虚拟 3 层交换机的名称。 -CMD_RouterIfAdd_HUB 指定新建虚拟接口拟连接的虚拟 HUB 名称。虚拟 HUB 名单,可以通过 HubList 命令获取。但是,目前正在运行的虚拟 HUB 没有必要指定。如果指定了目前没有工作,或不存在的虚拟 HUB,当它开始虚拟工作时,虚拟 3 层交换机将被激活。 -CMD_RouterIfAdd_IP 按照 [IP 地址/子网掩码] 的格式,设定新添加的接口的的 IP 地址和子网掩码。IP 地址为 192.168.0.1,10 进制,以点区分。子网掩码 255.255.255.0 以点区分,10 进制,也可以设定为如 24 这样的字节数用 10 进制来表示。 -CMD_RouterIfAdd_PROMPT_NAME 虚拟 3 层交换机的名称: -CMD_RouterIfAdd_PROMPT_HUB 虚拟接口连接到虚拟 HUB 名称: -CMD_RouterIfAdd_PROMPT_IP IP 地址/子网掩码: - - -# RouterIfDel 命令 -CMD_RouterIfDel 删除虚拟 3 层交换机的虚拟远程接口 -CMD_RouterIfDel_Help 删除在指定虚拟交换机中已定义的虚拟接口。\n对当前定义的虚拟接口列表,可以通过 RouterIfList 命令得到。\n要运行此命令,需要 VPN Server 管理员权限。\n此外,此命令不能在 VPN Bridge 中运行。\n要运行此命令,虚拟 3 层转化及必须在停止状态。如果不是,可以通过 RouterStop 指令使其停止。 -CMD_RouterIfDel_Args RouterIfDel [name] [/HUB:hub] -CMD_RouterIfDel_[name] 指定虚拟 3 层交换机的名称。 -CMD_RouterIfDel_HUB 指定虚拟接口所连接的虚拟 HUB 的名称。 - - -# RouterTableList 命令 -CMD_RouterTableList 获取虚拟 3 层交换机的路由列表 -CMD_RouterTableList_Help 在指定的虚拟 3 层交换机中,如果有路由表已定义,可以获取一个路由表的列表。\n虚拟 3 层交换机的IP 路由引擎,当 IP 数据包的 IP 地址不属于任一个虚拟接口时,将参照这个路由表。\n要运行此命令,VPN Server 需要管理员权限。\n此外,此命令不能在 VPN Bridge 中运行。 -CMD_RouterTableList_Args RouterTableList [name] -CMD_RouterTableList_[name] 指定虚拟 3 层交换机的名称。 -CMD_RouterTableList_PROMPT_NAME 虚拟 3 层交换机的名称: - - -# RouterTableAdd 命令 -CMD_RouterTableAdd 添加一个路由表项到虚拟 3 层交换机 -CMD_RouterTableAdd_Help 指定新的虚拟 3 层交换机的路由表并添加一个新的路由表项。\n虚拟 3 层交换机操作 IP 路由引擎时,IP 数据包的目的 IP 地址不属于任何 IP 接口时,可以参照路由表进行操作。\n向虚拟 3 层交换机中添加的路由表项内容必须指定。作为网关,在虚拟 3 层交换机的虚拟接口中,有至少一个属于同一 IP 网络的 IP 地址相同。\n要运行此命令,VPN Server 需要管理员权限。\n此外,此命令不能在 VPN Bridge 中运行。\n要运行此命令虚拟 3 层交换机必须处于停止噢国内工作状态。如果不在停止状态,可以执行 RouterStop 命令令其处于暂停。 -CMD_RouterTableAdd_Args RouterTableAdd [name] [/NETWORK:ip/mask] [/GATEWAY:gwip] [/METRIC:metric] -CMD_RouterTableAdd_[name] 指定虚拟 3 层交换机的名称。 -CMD_RouterTableAdd_NETWORK 按照 [IP 地址/子网掩码] 的格式,设置新添加的路由表的网络地址和子网掩码。网络地址,如 192.168.0.1 的格式,由点分隔,10 进位制。子网掩码如 255.255.255.0,用点分隔,10 进位制,或者像 24 这样从开头 10 进位设定字节数。位长度可为十进制数指定的分隔十进制数字。 如 0.0.0.0/0.0.0.0 将格式设定好,默认为根。 -CMD_RouterTableAdd_GATEWAY 指定网关的 IP 地址。 -CMD_RouterTableAdd_METRIC 指定度量的值。请使用一个以上的整数。 -CMD_RouterTableAdd_PROMPT_NAME 虚拟 3 层交换机的名称: -CMD_RouterTableAdd_PROMPT_NETWORK 网络地址/子网掩码: -CMD_RouterTableAdd_PROMPT_GATEWAY 网关: -CMD_RouterTableAdd_PROMPT_METRIC 公制值: - - -# RouterTableDel 命令 -CMD_RouterTableDel 删除虚拟 3 层交换机的路由表项 -CMD_RouterTableDel_Help 指定在虚拟 3 层交换机上已定义的路由表项,进行删除。\n已定义的路由表项名单,可通过 RouterTableList 命令获取。\n要运行此命令,需要 VPN Server 管理员权限。\n此外,此命令不能在 VPN Bridge 中运行。\n要运行此命令要求虚拟 3 层转换机处于停止状态。如果没有处于停止状态,可以执行 RouterStop 命令,让其暂停。 -CMD_RouterTableDel_Args RouterTableDel [name] [/NETWORK:ip/mask] [/GATEWAY:gwip] [/METRIC:metric] -CMD_RouterTableDel_[name] 指定虚拟 3 层交换机的名称。 -CMD_RouterTableDel_NETWORK 按照 [IP 地址/子网掩码] 的格式,选定拟删除的路由表项的网络地址。 -CMD_RouterTableDel_GATEWAY 指定网关的 IP 地址。 -CMD_RouterTableDel_METRIC 指定度量的值。请使用一以上整数。 - - -# LogFileList 命令 -CMD_LogFileList 获取日志文件列表 -CMD_LogFileList_Help 您可以将保存在 VPN Server 上,并有服务器输出的日志文件显示成一个输出列表。通过指定一个文件名,运用 LogFileGet 命令,可以下载该日志文件的内容。\n如果 VPN Server 在管理模式下,所有的虚拟 HUB 的数据包日志,安全日志,VPN Server 日志允许您查看或下载。\n如果虚拟 HUB 在管理模式下,并处于连接状态,可以查看或下载该数据包日志和安全日志。 -CMD_LogFileList_Args LogFileList -CMD_LogFileList_START 正在获取一个日志文件的列表。这可能需要一些时间。请稍候... -CMD_LogFileList_NUM_LOGS 共有 %u 个日志文件。 - - -# LogFileGet 命令 -CMD_LogFileGet 日志文件下载 -CMD_LogFileGet_Help 下载 VPN Server 上存储的日志文件。要下载日志文件,先用 LogFileList 命令获取日志文件列表,然后您就可以执行 LogFileGet 命令来下载。如果与 VPN Server 连接并处于管理模式,所有的虚拟 HUB 的数据包日志,安全日志,VPN Server 允许您查看或下载。如果正在连接的虚拟 HUB 处于管理模式,HUB 管理的虚拟数据包日志,安全日志可查阅,也可以下载。\n如果您指定一个作为参数作为文件名,下载的日志文件将被保存为这个文件名。如果你不指定文件将显示在屏幕上。\n日志文件的大小有可能非常巨大的,所以一定要小心。 -CMD_LogFileGet_Args LogFileGet [name] [/SERVER:server] [/SAVEPATH:savepath] -CMD_LogFileGet_[name] 选定要下载的日志文件名。运行 LogFileList 命令,可以得到一个日志文件的名称列表。 -CMD_LogFileGet_SERVER 如果您要从群集控制器中下载,请指定保存日志文件的服务器名称。运行 LogFileGet 指令可以获得指定服务器。 -CMD_LogFileGet_SAVEPATH 如果你想保存下载的日志文件,请指定文件名。如果没有指定,将显示在屏幕上。 -CMD_LogFileGet_PROMPT_NAME 下载的日志文件名: -CMD_LogFileGet_START 正在下载日志文件。这可能需要一些时间。请稍候... -CMD_LogFileGet_FAILED 下载失败。 -CMD_LogFileGet_SAVE_FAILED 无法写入指定的文件。 -CMD_LogFileGet_FILESIZE 日志文件的大小: %u - - -# HubCreate 命令 -CMD_HubCreate 创建新的虚拟 HUB -CMD_HubCreate_Help 在 VPN Server 上创建一个新的虚拟 HUB。\n创建的虚拟 HUB 将立即开始工作。\n当 VPN Server,在一个群集中运行,此命令仅对群集控制器有效。新的虚拟 HUB,将作为一个动态的虚拟 HUB。应用 HubSetStatic 命令也可将虚拟 HUB 改为静态的。要想获取已经存储在 VPN Server 上的 HUB,可以运行 HubList 命令获得列表。\n要运行此命令,需要 VPN Server 管理员权限。\n此外,此命令在 VPN Bridge 和群集管理服务器中不起作用。\n在群集上创建虚拟群集控制器 HUB 时,请运行 HubCreateStatic 或者 HubCreateDynamic 命令。(对群集控制器操作时,HubCreate 和 HubCreateDynamic就有相同的功能)。 -CMD_HubCreate_Args HubCreate [name] [/PASSWORD:password] -CMD_HubCreate_[name] 指定新创建的枢纽虚拟名称。 -CMD_HubCreate_PASSWORD 如果您设置的虚拟 HUB 需要密码,请指定管理员密码。否则,会提示您输入。 -CMD_HubCreate_PROMPT_NAME 新创建的虚拟 HUB 的名字: - - -# HubCreateDynamic 命令 -CMD_HubCreateDynamic 创建一个新的动态虚拟 HUB (集群) -CMD_HubCreateDynamic_Help 在 VPN Server 上创建新的动态虚拟 HUB。\n创建的虚拟 HUB 将立即开始工作。\nVPN Server,在一个群集中运行时,此命令仅对群集控制器有效。新的虚拟 HUB,将作为一个虚拟的动态 HUB。运行 HubSetStatic 命令可以将虚拟 HUB 可以改为静态的。运行 HubList 命令可以获取当前虚拟 HUB 的列表。\n要运行此命令,VPN Server 需要管理员权限。\n此外,此命令在 VPN Bridge,群集管理器,独立的服务器在 VPN Server 工作时不起作用。 -CMD_HubCreateDynamic_Args HubCreateDynamic [name] [/PASSWORD:password] -CMD_HubCreateDynamic_[name] 指定新创建的虚拟 HUB 的名称。 -CMD_HubCreateDynamic_PASSWORD 如果您设置虚拟 HUB 管理密码,请指定管理员密码。否则,会提示您输入。 - - -# HubCreateStatic 命令 -CMD_HubCreateStatic 新创建一个静态虚拟 HUB (集群用) -CMD_HubCreateStatic_Help 在 VPN Server 上创建一个新的静态虚拟 HUB。\n创建的虚拟 HUB 将立即开始工作。\nVPN Server 在一个群集中运行时,此命令仅对群集控制器有效。新创建的虚拟 HUB,为一个虚拟的动态 HUB。运行 HubSetStatic 命令可以将虚拟 HUB 改为静态的。如果想得到已经保存在 VPN Server 上的 HUB 列表,可以运行 HubList 命令。\n要运行此命令,VPN Server 需要管理员权限。\n此外,此命令在 VPN Bridge,群集管理器,独立的服务器在 VPN Server 工作时不起作用。 -CMD_HubCreateStatic_Args HubCreateStatic [name] [/PASSWORD:password] -CMD_HubCreateStatic_[name] 指定新创建的虚拟 HUB 的名称。 -CMD_HubCreateStatic_PASSWORD 如果您设置虚拟 HUB 管理密码,请指定管理员密码。否则,会提示您输入。 - - -# HubDelete 命令 -CMD_HubDelete 删除虚拟 HUB -CMD_HubDelete_Help 删除 VPN Server 上现有的虚拟 HUB。\n当您删除虚拟 HUB 后,所有的程序连接将断开,新的程序将不能与它连接。\n虚拟 HUB 的所有的设置,用户选项,组选项,证书设置和级联将被删除。\n虚拟 HUB 被删除后,将不能恢复。\n运行此命令,需要 VPN Server 管理员权限。\n此外,此命令在 VPN Bridge,群集管理器,独立的服务器在 VPN Server 工作时不起作用。 -CMD_HubDelete_Args HubDelete [name] -CMD_HubDelete_[name] 定要删除的虚拟 HUB 名称。 -CMD_HubDelete_PROMPT_NAME 删除的虚拟 HUB 名称: - - -# HubSetStatic 命令 -CMD_HubSetStatic 将虚拟 HUB 的类型变为静态虚拟型 -CMD_HubSetStatic_Help 使用 VPN Server 运行在群集上时,将虚拟 HUB 类型设定为静态虚拟 HUB。当虚拟 HUB 类型改变时,所有的程序连接将被暂时中断。 \n当作为静态虚拟 HUB 工作时,所有的群集成员的服务器上,将生成该名称的虚拟 HUB。每个尝试连接这个虚拟 HUB 的用户,基于各自服务器的负荷状况,确定与这个群集某个成员的连接。\n静态虚拟 HUB,举例说,一个企业从互联网上访问局域网,允许数千或数以万计的用户远程访问 VPN Server。\n要执行这个命令,您必须有 VPN Server 管理员权限。\n此外,此命令在 VPN Bridge,群集管理器,独立的服务器在 VPN Server 工作时不起作用。\n此命令不能用于比 5190 更新的服务器。 -CMD_HubSetStatic_Args HubSetStatic [name] -CMD_HubSetStatic_[name] 选定拟变更成静态虚拟 HUB 的名称。 -CMD_HubChange_PROMPT_NAME 变更设置的虚拟 HUB 名称: - - -# HubSetDynamic 命令 -CMD_HubSetDynamic 将虚拟 HUB 的类型变为动态虚拟型 -CMD_HubSetDynamic_Help 使用 VPN Server 运行在群集上时,将虚拟 HUB 类型变更为动态。当虚拟 HUB 类型改变时,所有的程序连接会暂时被中断。\n当该虚拟 HUB 上没有任何成员时,虚拟 HUB 在任何群集上都不存在。当第一个客户端试图连接到动态的虚拟 HUB 时,负荷最低的服务器启动,托管虚拟 HUB。当第二个和随后的客户端试图连接到同一个虚拟 HUB,它们会自动连接到服务器托管的虚拟 HUB。当所有的客户都从一个特定的动态虚拟 HUB 断开,服务器上将不存在任何实体。\n动态虚拟 HUB 的应用很广泛,例如,公司内部每个部门定应一个虚拟 HUB,让员工可以连接到自己所属的虚拟枢纽部门来操作,从而实现集中管理。\n要执行这个命令,您必须有 VPN Server 管理员权限。\n此外,此命令在 VPN Bridge,群集管理器,独立的服务器在 VPN Server 工作时不起作用。\n此命令不能用于比 5190 更新的服务器。 -CMD_HubSetDynamic_Args HubSetDynamic [name] -CMD_HubSetDynamic_[name] 指定拟转变为动态虚拟 HUB 的名称。 - - -# HubList 命令 -CMD_HubList 获取一个虚拟 HUB 列表 -CMD_HubList_Help 在 VPN Server 中获得虚拟 HUB 的清单。对于每一个虚拟 HUB,可以获得 [虚拟 HUB 名称],[状态],[类型],[用户数量],[群数量],[访问数量],[MAC 目录的数量],[IP 目录数],[登陆次数],[上次登录],[最终通信时间]。\n但是,如果处于连接状态的虚拟 HUB 在管理模式下,对于匿名用户如果设定为不列举虚拟 HUB,则虚拟 HUB 不会被显示。如果您连接到服务器的管理模式,则所有的虚拟 HUB 会显示清单。\n如果你连接到群集控制器以外的其他群集成员,VPN Server 只显示虚拟 HUB 的托管虚拟主机。如果您连接到群集控制器来管理群集,所有虚拟 HUB 将显示。 -CMD_HubList_Args HubList - - -# Hub 命令 -CMD_Hub 选择拟管理的虚拟 HUB -CMD_Hub_Help 选择拟管理的虚拟 HUB。在 VPN Server 中,对目标虚拟 HUB 实行配置管理之前,需要用选择命令选定虚拟 HUB。\n当正在连接的 VPN Server 处于管理虚拟 HUB 模式时,您可以选定拟管理的一个虚拟 HUB,而不可以选择其他的虚拟 HUB。与正在连接的 VPN Server 处于服务器管理模式,可以对所有的虚拟 HUB 进行管理。\n获取当前的虚拟 HUB 列表,可以执行 HubList 命令。\n在 VPN Bridge 中,只可以选择名字中带 "BRIDGE" 的虚拟 HUB。 -CMD_Hub_Args Hub [name] -CMD_Hub_[name] 选定拟管理的虚拟 HUB 的名称。如果您没有指定参数,目标虚拟 HUB 的选定将被清除。 -CMD_Hub_Unselected 取消已经选定的虚拟 HUB。 -CMD_Hub_Selected 选择虚拟 HUB "%S"。 -CMD_Hub_Select_Failed /ADMINHUB 在虚拟 HUB 中想要选择 "%S" 发生了以下的错误。 -CMD_Hub_Not_Selected 在运行此命令之前,运用 HUB 管理命令选择目标管理虚拟 HUB。 - - -# Online 命令 -CMD_Online 虚拟 HUB 的联机 -CMD_Online_Help 如果您正在管理的虚拟 HUB 处于脱机状态,请设置成联机。处于脱机状态的虚拟 HUB,不会接受来自 VPN Client 连接。将虚拟 HUB 设定成联网状态,从而可以接受用户的虚拟连接并提供服务。\n此命令,在 VPN Bridge 中不会运行。\n此命令在 VPN Server 中的虚拟集群 HUB 中不能运行。 -CMD_Online_Args Online - - -# Offline 命令 -CMD_Offline 虚拟 HUB 脱机 -CMD_Offline_Help 如果您正在管理的虚拟 HUB 在线,设置成脱机。虚拟 HUB 如果有连接程序,将全部断开。虚拟 HUB 处于脱机状态,不会接受来自 VPN Client 连接。\n此命令,在 VPN Bridge 中不会运行。\n此命令在 VPN Server 中的虚拟集群 HUB 中不能运行。 -CMD_Offline_Args Offline - - -# SetMaxSession 命令 -CMD_SetMaxSession 设定虚拟 HUB 的最大同时在线用户数量 -CMD_SetMaxSession_Help 设定现在正在管理的虚拟 HUB 的最大同时在线客户数量。当超过这个数量时,如果从 VPN Client 和 VPN Bridge 连接的时候,超过了最大并发会话数,更多的客户将无法连接。最大同时在线客户数的限制不包括本地的网桥,虚拟的 NAT,级联连接等生成连接不包括在内。\n设置同时在线最大数目,可以通过运行 OptionsGet 命令获得。\n此命令,在 VPN Bridge 中不会运行。\n此命令在集群虚拟 HUB 中不能运行。 -CMD_SetMaxSession_Args SetMaxSession [max_session] -CMD_SetMaxSession_[max_session] 设置最大同时在线客户数,使用整数。当您指定为 0 时,客户数没有限制。 -CMD_SetMaxSession_Prompt 最大同时在线客户数: - - -# SetHubPassword 命令 -CMD_SetHubPassword 设置虚拟 HUB 的管理密码 -CMD_SetHubPassword_Help 设置目前正在管理的虚拟 HUB 的管理密码。虚拟 HUB,如果设置了管理密码,您可以应用管理密码,虚拟 HUB,VPN Server 的公用事业,虚拟 HUB 连接,您可以通过指定一个连接密码在虚拟 HUB 的管理模式下实现连接。此外,通过 VPN Client 和 VPN Bridge,用户名用 "Administrator" 通过管理员密码,也可以实现连接。\n此命令,不能在 VPN Bridge 中运行。\n此命令在集群虚拟 HUB 中不能运行。 -CMD_SetHubPassword_Args SetHubPassword [password] -CMD_SetHubPassword_[password] 设定密码。如果您不指定将被提示输入密码。 - - -# SetEnumAllow 命令 -CMD_SetEnumAllow 设定虚拟 HUB 允许向匿名用户显示。 -CMD_SetEnumAllow_Help 变更虚拟 HUB 的控制选项,对于匿名用户,允许虚拟 HUB 显示。当您设置了此选项,VPN Client 的用户,在 VPN Server 只需输入地址即可显示虚拟 HUB。虚拟 HUB 一创建成功,即可显示。此外,如果执行 SetEnumDeny 命令,可以禁止向匿名用户显示。虚拟 HUB 是在统计创建时设定允许显示与否。\n此命令,在 VPN Bridge 中不会运行。\n此命令在集群虚拟 HUB 中不能运行。 -CMD_SetEnumAllow_Args SetEnumAllow - - -# SetEnumDeny 命令 -CMD_SetEnumDeny 设定虚拟 HUB 禁止向匿名用户显示。 -CMD_SetEnumDeny_Help 变更虚拟 HUB 的控制选项,对于匿名用户,禁止虚拟 HUB 显示。当您设置了此选项,VPN Client 的用户,在 VPN Server 输入检索虚拟 HUB,虚拟 HUB 也不会显示。此外,如果执行 SetEnumAllow 命令,可以允许向匿名用户显示。虚拟 HUB 是在统计创建时设定允许显示与否。\n此命令,在 VPN Bridge 中不会运行。\n此命令在集群虚拟 HUB 中不能运行。 -CMD_SetEnumDeny_Args SetEnumDeny - - -# OptionsGet 命令 -CMD_OptionsGet 获得虚拟 HUB 的设置选项 -CMD_OptionsGet_Help 获取虚拟 HUB 的选项设置清单。虚拟 HUB 允许 / 禁止显示设置,最大的同时在线数量,在线 / 离线状态,和集群虚拟环境中 HUB 的类型。\n此命令对于一个虚拟集群 HUB 不能运行。 -CMD_OptionsGet_Args OptionsGet -CMD_OptionsGet_TITLE 虚拟 HUB "%S" 设置选项列表 -CMD_OptionsGet_ENUM 对于匿名用户的虚拟 HUB 的显示 -CMD_OptionsGet_MAXSESSIONS 最大同时在线客户数 -CMD_OptionsGet_STATUS 状态 -CMD_OptionsGet_TYPE 虚拟 HUB 的类型 - - - -# RadiusServerSet 命令 -CMD_RadiusServerSet 使用在用户认证中使用的 RADIUS 服务器设置 -CMD_RadiusServerSet_Help 接受用户当前以 RADIUS 服务器认证模式管理虚拟 HUB ,你需指定外部 RADIUS 服务器,以确认用户名和密码(您可以指定多个主机名,并将它们用逗号或者分号隔开)。\nRadius 服务器必须设置为接受来自 VPN Server IP 地址的请求。此外,密码认证协议(PAP)的认证必须被启用。\n此命令不能在 VPN Bridge 上运行。\n此命令在 VPN Server 以集群运行的虚拟 HUB 上不能运行。 -CMD_RadiusServerSet_Args RadiusServerSet [server_name:port] [/SECRET:secret] [/RETRY_INTERVAL:interval] -CMD_RadiusServerSet_[server_name:port] 用 [主机名:端口号] 的格式,指定 RADIUS 服务器的主机名,IP 地址和 UDP 端口号。如果省略端口号则用 1812。您可以指定多个主机名,并将它们用逗号或者分号隔开。 -CMD_RadiusServerSet_SECRET 设置与 RADIUS 服务器之间的通信 (密码)。 -CMD_RadiusServerSet_RETRY_INTERVAL 用毫秒指定重试间隔。 -CMD_RadiusServerSet_Prompt_Host 使用 RADIUS 服务器的主机名和端口号: -CMD_RadiusServerSet_Prompt_Secret 共享秘密: -CMD_RadiusServerSet_Prompt_RetryInterval 重试间隔 (毫秒): -CMD_RadiusServerSet_EVAL_NUMINTERVAL 重试间隔为 500 毫秒到 10000 毫秒。 - - -# RadiusServerDelete 命令 -CMD_RadiusServerDelete 删除应用于用户认证的 RADIUS 服务器设置 -CMD_RadiusServerDelete_Help 目前,正在管理的虚拟 HUB,用户以 RADIUS 服务器认证模式连接时,删除外部 RADIUS 服务器设定,使服务器不能验证。目前 RADIUS 服务器的设置,可以运行 RadiusServerGet 命令获得。\n此命令,虚拟 VPN Bridge 中不能运行。\n此命令在集群虚拟 HUB 中不能运行。 -CMD_RadiusServerDelete_Args RadiusServerDelete - - -# RadiusServerGet 命令 -CMD_RadiusServerGet 获取用于用户认证的 RADIUS 服务器设置 -CMD_RadiusServerGet_Help 用户使用 RADIUS 服务器身份验证模式连接到现在管理的虚拟 HUB,您可以获取 RADIUS 服务器的当前设置。\n此命令,在虚拟 VPN Bridge 中不能运行。\n此命令在集群虚拟 HUB 中不能运行。 -CMD_RadiusServerGet_Args RadiusServerGet -CMD_RadiusServerGet_STATUS RADIUS 服务器的使用 -CMD_RadiusServerGet_HOST RADIUS 服务器主机名或 IP 地址 -CMD_RadiusServerGet_PORT RADIUS 服务器的端口号 -CMD_RadiusServerGet_SECRET 共享秘密 -CMD_RadiusServerGet_RetryInterval 重试间隔 (毫秒) - - -# StatusGet 命令 -CMD_StatusGet 获取虚拟 HUB 的当前状况 -CMD_StatusGet_Help 获取正在管理的虚拟 HUB 的当前状况,可以获得虚拟 HUB 的种类,连接数量,各种目标数,登陆次数,最后一次登陆时间,最终连接时间,通信的统计数据等。 -CMD_StatusGet_Args StatusGet - - -# LogGet 命令 -CMD_LogGet 获取虚拟 HUB 日志的保存设定 -CMD_LogGet_Help 获取虚拟 HUB 日志的保存设置。获取安全日志和数据包日志的保存设定,保存对象等信息。 -CMD_LogGet_Args LogGet -CMD_Log_SecurityLog 保存安全日志 -CMD_Log_PacketLog 保存数据包日志 -CMD_Log_SwitchType 日志文件的替换周期 -CMD_Log_0 TCP 连接日志 -CMD_Log_1 TCP 数据包日志 -CMD_Log_2 DHCP 日志 -CMD_Log_3 UDP 日志 -CMD_Log_4 ICMP 日志 -CMD_Log_5 IP 日志 -CMD_Log_6 ARP 日志 -CMD_Log_7 以太网日志 - - -# LogEnable 命令 -CMD_LogEnable 启用安全日志或数据包日志 -CMD_LogEnable_Help 启用现在正在管理的 HUB 的安全日志或数据包日志。\n当前的设置,可以通过 LogGet 命令获得。 -CMD_LogEnable_Args LogEnable [security|packet] -CMD_LogEnable_[security|packet] 选择启用日志文件的类型。选定 "security" 或 "packet"。 -CMD_LogEnable_Prompt 选择安全或数据包: -CMD_LogEnable_Prompt_Error 选择不正确。 - - -# LogDisable 命令 -CMD_LogDisable 禁用安全日志或数据包日志 -CMD_LogDisable_Help 禁止使用现在正在管理的 HUB 的安全日志或数据包日志。\n当前的设置,可以通过 LogGet 命令获得。 -CMD_LogDisable_Args LogDisable [security|packet] -CMD_LogDisable_[security|packet] 选择禁用日志文件的类型。选定 "security" 或 "packet"。 - - -# LogSwitchSet 命令 -CMD_LogSwitchSet 设定替换日志文件的周期 -CMD_LogSwitchSet_Help 设定现在管理的虚拟 HUB 所保存的安全日志或数据包日志文件的替换周期。替换日志文件的时间是可以设定为 1 秒,1 分钟,1 小时,每天,每月,您也可以设定为不替换。\n当前的设置,可以通过 LogGet 命令获得。 -CMD_LogSwitchSet_Args LogSwitchSet [security|packet] [/SWITCH:sec|min|hour|day|month|none] -CMD_LogSwitchSet_[security|packet] 选择变更设定的日志文件的类型。 选定 "security" 或 "packet"。 -CMD_LogSwitchSet_SWITCH 设置替换周期。从 sec,min,hour,day,month,none 中选择。 -CMD_LogSwitchSet_Prompt 从 sec,min,hour,day,month,none 中选择: - - -# LogPacketSaveType 命令 -CMD_LogPacketSaveType 设置保存为数据包日志文件的数据包种类及保存。 -CMD_LogPacketSaveType_Help 逐项设定保存在在管理的虚拟 HUB 上的,数据包保存内容和数据包的类型。数据包类型包括,[TCP 连接日志],[TCP 数据包日志],[DHCP 数据包记录],[UDP 数据包日志],[ICMP 数据包日志],[IP 数据包日志],[ARP 数据包日志],[以太网数据包日志] 等。\n要想获取当前的设置,可以运行 LogGet 命令。 -CMD_LogPacketSaveType_Args LogPacketSaveType [/TYPE:tcpconn|tcpdata|dhcp|udp|icmp|ip|arp|ether] [/SAVE:none|header|full] -CMD_LogPacketSaveType_TYPE 保存内容对应的数据包类型,从 tcpconn,tcpdata,dhcp,udp,icmp,ip,arp,ether 中选定。 -CMD_LogPacketSaveType_SAVE 设定日志文件的保存内容。从下列选定:\nnone: 不保存\nheader: 仅保存标题\nfull: 所有数据包 -CMD_LogPacketSaveType_Prompt_TYPE 选定 tcpconn, tcpdata, dhcp, udp, icmp, ip, arp, ether: -CMD_LogPacketSaveType_Prompt_SAVE 选定 none, header, full: - - -# CAList 命令 -CMD_CAList 获取可以信任的机构颁发证书的列表 -CMD_CAList_Help 管理可以信任的机构颁发的证书。VPN Client 如果用认证模式连接时,可以用保存的证书来验证其提供的证书。\n此命令,在虚拟 VPN Bridge 中不能运行。\n此命令在集群虚拟 HUB 中不能运行。 -CMD_CAList_Args CAList -CMD_CAList_COLUMN_ID ID - - -# CAAdd 命令 -CMD_CAAdd 添加可以信任的机构颁发的证书 -CMD_CAAdd_Help 在虚拟 HUB 管理的可信任的证书颁发机构的证书列表中,添加一个新的证书。如果客户端使用签名认证模式连接,管理中的证书将用来识别客户的证书。\n要取得当前的证书列表,可以执行 CAList 命令。\n要添加一个证书,必须将证书保存为 X.509 格式保存。\n此命令,在虚拟 VPN Bridge 中不能运行。\n此命令在集群虚拟 HUB 中不能运行。 -CMD_CAAdd_Args CAAdd [path] -CMD_CAAdd_[path] 指定注册 X.509 证书的文件名。 -CMD_CAAdd_PROMPT_PATH 注册 X.509 证书文件的名称: - - -# CADelete 命令 -CMD_CADelete 删除可以信任的机构颁发的证书 -CMD_CADelete_Help 从正在管理的可信任机构颁发的证书列表中,删除现有的证书。\n如果要获取当前的证书列表,可以执行 CAList 命令。\n此命令,在虚拟 VPN Bridge 中不能运行。\n此命令在集群虚拟 HUB 中不能运行。 -CMD_CADelete_Args CADelete [id] -CMD_CADelete_[id] 指定拟删除的证书的 ID。 -CMD_CADelete_PROMPT_ID 拟删除证书的 ID: - - -# CAGet 命令 -CMD_CAGet 获得可信任机构颁发的证书。 -CMD_CAGet_Help 获取虚拟 HUB 目前管理的可信任机构颁布的证书的列表,并将其保存为 X.509 的文件格式。\n此命令,在虚拟 VPN Bridge 中不能运行。\n此命令在集群虚拟 HUB 中不能运行。 -CMD_CAGet_Args CAGet [id] [/SAVECERT:path] -CMD_CAGet_[id] 制定获得证书的 ID。 -CMD_CAGet_SAVECERT 指定文件名以保存获取的证书。 -CMD_CAGet_PROMPT_ID 获得证书 ID: -CMD_CAGet_PROMPT_SAVECERT 保存文件名: - - -# CascadeList 命令 -CMD_CascadeList 获取级联接续列表 -CMD_CascadeList_Help 获取当前虚拟 HUB 上登记的级联名单。\n如果您使用虚拟 HUB 级联同一台或另一个虚拟机上的 HUB,这两个层可以级联。\n\n[使用级联的警告]\n如果您使用级联多个虚拟 HUB 可以构成 2 层的网桥,如果连接方法错误可能会将连接做成绳状。所以使用级联功能,一定要精心设计。\n此命令在集群虚拟 HUB 中不能运行。 -CMD_CascadeList_Args CascadeList - - -# CascadeCreate 命令 -CMD_CascadeCreate 创建一个新的级联接续 -CMD_CascadeCreate_Help 在当前虚拟 HUB 上创建一个新的级联接续。\n如果您使用虚拟 HUB 级联同一个或者另一个虚拟 HUB,可以建立级联接续。\n要创建一个级联,作为初始参数,需设定级联的名称,连接的服务器,目标 HUB 的名称和用户名。创建一个新的级联时,用户身份验证类型被初始化为 [匿名认证],代理服务器和服务器证书验证未设置。要更改这些设置,请在创建一个级联之后用 "Cascade" 命名的指令来执行。\n\n[使用级联的警告]\n如果您使用级联多个虚拟 HUB 可以构成 2 层的网桥,如果连接方法错误可能会将连接做成绳状。所以使用级联功能,一定要精心设计。\n此命令在集群虚拟 HUB 中不能运行。 -CMD_CascadeCreate_Args CascadeCreate [name] [/SERVER:hostname:port] [/HUB:hubname] [/USERNAME:username] -CMD_CascadeCreate_[name] 指定新创建级联的名称。 -CMD_CascadeCreate_SERVER 按照 [主机名:端口号] 的格式,设置 VPN Server 的主机名和端口号,您也可以指定 IP 地址。 -CMD_CascadeCreate_HUB 选定目标 VPN Server 内的虚拟 HUB。 -CMD_CascadeCreate_USERNAME 设定连接到 VPN Server 时所须的用户名认证名称。 -CMD_CascadeCreate_Prompt_Name 级联接续的名称: -CMD_CascadeCreate_Prompt_Server 目标 VPN Server 的主机名和端口号: -CMD_CascadeCreate_Prompt_Hub 目标虚拟 HUB 名称: -CMD_CascadeCreate_Prompt_Username 连接使用的用户名: - - -# CascadeSet 命令 -CMD_CascadeSet 对级联连接方的设定 -CMD_CascadeSet_Help 对于虚拟 HUB 目前管理的已经连接的级联,设置连接方的 VPN 主机名和端口号,虚拟 HUB 名,用户名等。\n此命令在集群虚拟 HUB 中不能运行。 -CMD_CascadeSet_Args CascadeSet [name] [/SERVER:hostname:port] [/HUB:hubname] -CMD_CascadeSet_[name] 指定级联名称来改变设置。 -CMD_CascadeSet_SERVER 按照 [主机名:端口号] 的格式,设置连接方 VPN Server 的主机名和端口号。您也可以指定 IP 地址。 -CMD_CascadeSet_HUB 设置连接方 VPN Server 内的虚拟 HUB。 - - -# CascadeGet 命令 -CMD_CascadeGet 获取级联连接的设置 -CMD_CascadeGet_Help 获取当前在虚拟 HUB 上注册的级联的连接设置。\n另外,要改变级联的连接设置,可以在您创建一个级联后使用 "Cascade" 开头的命令。\n此命令在集群虚拟 HUB 中不能运行。 -CMD_CascadeGet_Args CascadeGet [name] -CMD_CascadeGet_[name] 指定级联获取它的连接设置。 -CMD_CascadeGet_Policy [级联连接的安全策略设置值] - -# CascadeDelete 命令 -CMD_CascadeDelete 删除级联连接 -CMD_CascadeDelete_Help 删除目前在虚拟 HUB 中注册的级联连接。如果选定的级联连接处于联机状态,则先断开连接,然后删除。\n此命令在集群虚拟 HUB 中不能运行。 -CMD_CascadeDelete_Args CascadeDelete [name] -CMD_CascadeDelete_[name] 指定您想删除的级联连接的名称。 - - -# CascadeUsernameSet 命令 -CMD_CascadeUsernameSet 设置级联连接的用户名 -CMD_CascadeUsernameSet_Help 选定已在虚拟 HUB 上注册的级联,设定其用户名,当连接到 VPN Server 时,用此用户名来进行身份验证。\n此外,您可以指定用户身份验证的种类,或可以指定所需的参数。如果您想更改这些设置,可以运行 CascadeAnonymousSet,CascadePasswordSet,CascadeCertSet 等命令。\n此命令在集群虚拟 HUB 中不能运行。 -CMD_CascadeUsernameSet_Args CascadeUsernameSet [name] [/USERNAME:username] -CMD_CascadeUsernameSet_[name] 指定级联名称来改变设置。 -CMD_CascadeUsernameSet_USERNAME 级联连接到 VPN Server 时,指定用户名要求用户进行身份验证。 -CMD_CascadeUsername_Notice 连接身份验证,是在密码验证中设置的。用户名变更之后,需要用 CascadePasswordSet 指令重新设置密码。 - - -# CascadeAnonymousSet 命令 -CMD_CascadeAnonymousSet 将级联连接的用户认证类型设置为匿名身份验证 -CMD_CascadeAnonymousSet_Help 选定虚拟 HUB 中已经注册的级联,将级联连接到 VPN Server 所需的用户身份验证方法设定为匿名身份验证。\n此命令在集群虚拟 HUB 中不能运行。 -CMD_CascadeAnonymousSet_Args CascadeAnonymousSet [name] -CMD_CascadeAnonymousSet_[name] 指定级联名称来改变设置。 - - -# CascadePasswordSet 命令 -CMD_CascadePasswordSet 将级联连接时所需的用户验证设置为密码验证 -CMD_CascadePasswordSet_Help 选定虚拟 HUB 中已经注册的级联,将级联连接到 VPN Server 所需的用户身份验证方法设定为密码验证。密码验证的种类指定为,[标准密码验证] 和 [RADIUS 或 NT域身份验证]。\n此命令在集群虚拟 HUB 中不能运行。 -CMD_CascadePasswordSet_Args CascadePasswordSet [name] [/PASSWORD:password] [/TYPE:standard|radius] -CMD_CascadePasswordSet_[name] 指定级联名称来改变设置。 -CMD_CascadePasswordSet_PASSWORD 指定密码验证所使用的密码。否则,会提示您输入密码。 -CMD_CascadePasswordSet_TYPE 密码验证的类型,指定为 "standard" (标准密码验证),或 "radius" (radius 或 NT 域身份验证)。 -CMD_CascadePasswordSet_Prompt_Type 指定 standard 或者 radius: -CMD_CascadePasswordSet_Type_Invalid 指定 standard 或者 radius 时出错。 - - -# CascadeCertSet 命令 -CMD_CascadeCertSet 将级联连接时所需的用户验证设置为客户证书验证 -CMD_CascadeCertSet_Help 选定虚拟 HUB 中已经注册的级联,将级联连接到 VPN Server 所需的用户身份验证方法设定为客户证书验证。证书应为 X.509 证书文件格式,并且用变换为 Base 64 密钥文件编码。\n此命令在集群虚拟 HUB 中不能运行。 -CMD_CascadeCertSet_Args CascadeCertSet [name] [/LOADCERT:cert] [/LOADKEY:key] -CMD_CascadeCertSet_[name] 指定级联名称来改变设置。 -CMD_CascadeCertSet_LOADCERT 选定 X.509 证书名称用来进行证书认证。 -CMD_CascadeCertSet_LOADKEY 选定与证书对应的 Base 64 编码的密钥文件。 - - -# CascadeCertGet 命令 -CMD_CascadeCertGet 获取级联连接所需的客户端证书 -CMD_CascadeCertGet_Help 指定当前在虚拟 HUB 上已注册的级联接续,如果您使用客户端证书身份验证,请获取证书,保存为 X.509 格式。\n此命令在集群虚拟 HUB 中不能运行。 -CMD_CascadeCertGet_Args CascadeCertGet [name] [/SAVECERT:cert] -CMD_CascadeCertGet_[name] 指定级联名称获取设置。 -CMD_CascadeCertGet_SAVECERT 获取证书指定文件名保存为 X.509 格式。 -CMD_CascadeCertSet_Not_Auth_Cert 指定的级联连接设置的认证方式不是证书认证模式。 -CMD_CascadeCertSet_Cert_Not_Exists 证书没有存储在所指定的级联连接设置中。 - - -# CascadeEncryptEnable 命令 -CMD_CascadeEncryptEnable 启用级联通信时加密 -CMD_CascadeEncryptEnable_Help 指定已经在当前虚拟 HUB 注册的级联连接,当此连接和 VPN Server 之间通信时,设置通信内容为 SSL 加密。\n通常情况下,和 VPN Server 的通信进行 SSL 加密,以防止窃听和篡改信息。您还可以禁用加密。如果您禁用加密,通信的流速将提高,传输数据以明文传输到网络上。\n此命令在集群虚拟 HUB 中不能运行。 -CMD_CascadeEncryptEnable_Args CascadeEncryptEnable [name] -CMD_CascadeEncryptEnable_[name] 指定级联名称来改变设置。 - - -# CascadeEncryptDisable 命令 -CMD_CascadeEncryptDisable 级联连接通信时,禁用加密 -CMD_CascadeEncryptDisable_Help 指定已经在当前虚拟 HUB 注册的级联连接,当此连接和 VPN Server 之间通信时,设置通信内容为禁止加密。\n通常情况下,和 VPN Server 的通信进行 SSL 加密,以防止窃听和篡改信息。您还可以禁用加密。如果您禁用加密,通信的流速将提高,传输数据以明文传输到网络上。\n此命令在集群虚拟 HUB 中不能运行。 -CMD_CascadeEncryptDisable_Args CascadeEncryptDisable [name] -CMD_CascadeEncryptDisable_[name] 指定级联名称来改变设置。 - - -# CascadeCompressEnable 命令 -CMD_CascadeCompressEnable 启用级联通信是数据压缩功能 -CMD_CascadeCompressEnable_Help 指定已经在当前虚拟 HUB 注册的级联连接,当此连接和 VPN Server 之间通信时,设置通信内容为压缩内容。\n压缩量最大可以达到 80% 。但是,实行压缩,会给客户端和服务器双方的 CPU 造成很高的负荷。如果网络速度在 10 Mbps 以上,实施压缩后会减少传输流量,可能会适得其反。\n此命令在集群虚拟 HUB 中不能运行。 -CMD_CascadeCompressEnable_Args CascadeCompressEnable [name] -CMD_CascadeCompressEnable_[name] 指定级联名称来改变设置。 - - -# CascadeCompressDisable 命令 -CMD_CascadeCompressDisable 级联通信是数据禁止压缩功能 -CMD_CascadeCompressDisable_Help 指定已经在当前虚拟 HUB 注册的级联连接,当此连接和 VPN Server 之间通信时,设置通信内容为禁止压缩。\n此命令在集群虚拟 HUB 中不能运行。 -CMD_CascadeCompressDisable_Args CascadeCompressDisable [name] -CMD_CascadeCompressDisable_[name] 指定级联名称来改变设置。 - - -# CascadeHttpHeader* commands -CMD_CascadeHttpHeader_Prompt_Name Value name (part before the colon): -CMD_CascadeHttpHeader_Prompt_Data Value data (part after the colon): - - -# CascadeHttpHeaderAdd command -CMD_CascadeHttpHeaderAdd Add a custom value in the HTTP header sent to the proxy server -CMD_CascadeHttpHeaderAdd_Help Use this to add a custom value in the HTTP header sent to the proxy server. A custom HTTP header can be used to bypass certain restrictions imposed on the network or to avoid speed limitations applied by the QoS. -CMD_CascadeHttpHeaderAdd_Args CascadeHttpHeaderAdd [name] [/NAME:name] [/DATA:data] -CMD_CascadeHttpHeaderAdd_[name] Specify the name of the Cascade Connection whose setting you want to change. -CMD_CascadeHttpHeaderAdd_NAME Specify the name of the custom value (the part before the colon character). -CMD_CascadeHttpHeaderAdd_DATA Specify the data of the custom value (the part after the colon character). - - -# CascadeHttpHeaderDelete command -CMD_CascadeHttpHeaderDelete Delete a custom value in the HTTP header sent to the proxy server -CMD_CascadeHttpHeaderDelete_Help Use this to delete a custom value in the HTTP header sent to the proxy server. A custom HTTP header can be used to bypass certain restrictions imposed on the network or to avoid speed limitations applied by the QoS. -CMD_CascadeHttpHeaderDelete_Args CascadeHttpHeaderDelete [name] [/NAME:name] -CMD_CascadeHttpHeaderDelete_[name] Specify the name of the Cascade Connection whose setting you want to change. -CMD_CascadeHttpHeaderDelete_NAME Specify the name of the custom value (the part before the colon character). - - -# CascadeHttpHeaderGet command -CMD_CascadeHttpHeaderGet Get the list of custom values in the HTTP header sent to the proxy server -CMD_CascadeHttpHeaderGet_Help Use this to get the list of custom values in the HTTP header sent to the proxy server. A custom HTTP header can be used to bypass certain restrictions imposed on the network or to avoid speed limitations applied by the QoS. -CMD_CascadeHttpHeaderGet_Args CascadeHttpHeaderGet [name] -CMD_CascadeHttpHeaderGet_[name] Specify the name of the Cascade Connection whose setting you want to get. - - -# CascadeProxyNone 命令 -CMD_CascadeProxyNone 将级联的连接方法设置为直接与 TCP/IP 连接 -CMD_CascadeProxyNone_Help 指定已经在当前虚拟 HUB 注册的级联连接,当此连接和 VPN Server 之间通信时,设置连接方法为 [直接与 TCP/IP 连接],而不通过代理服务器。\n此命令在集群虚拟 HUB 中不能运行。 -CMD_CascadeProxyNone_Args CascadeProxyNone [name] -CMD_CascadeProxyNone_[name] 指定级联名称来改变设置。 - - -# CascadeProxyHttp 命令 -CMD_CascadeProxyHttp 将级联连接方法设定为通过 HTTP 代理服务器 -CMD_CascadeProxyHttp_Help 指定已经在当前虚拟 HUB 注册的级联连接,当此连接和 VPN Server 之间通信时,设置连接方法为,[通过 HTTP 代理服务器连接],然后设置要通过的 HTTP 代理服务器的主机名和端口号,用户名和密码 (如果需要)。\n使用的 HTTP 代理服务器,必须有适合 HTTPS 通信的连接方式。\n此命令在集群虚拟 HUB 中不能运行。 -CMD_CascadeProxyHttp_Args CascadeProxyHttp [name] [/SERVER:hostname:port] [/USERNAME:username] [/PASSWORD:password] -CMD_CascadeProxyHttp_[name] 指定级联名称来改变设置。 -CMD_CascadeProxyHttp_SERVER [主机:端口的形式],通过指定的 HTTP 代理服务器的主机名或 IP 地址和端口号。 -CMD_CascadeProxyHttp_USERNAME 如果连接到 HTTP 代理服务器时需要用户验证,则指定用户名。同时设定密码和参数。 如果没有设定用户名和密码 D参数,则不需要设置用户身份验证。 -CMD_CascadeProxyHttp_PASSWORD 如果连接到 HTTP 代理服务器时需要用户验证,则指定密码。/USERNAME,参数等同时设定。 -CMD_CascadeProxyHttp_Prompt_Server 代理服务器主机名和端口号: - - -# CascadeProxySocks 命令 -CMD_CascadeProxySocks 将级联连接方法设定为通过 SOCKS4 代理服务器 -CMD_CascadeProxySocks_Help 指定已经在当前虚拟 HUB 注册的级联连接,当此连接和 VPN Server 之间通信时,设置连接方法为 [通过 SOCKS4 代理服务器],设置 SOCKS4 代理服务器的主机名和端口号,用户名和密码 (如果需要)。\n此命令在集群虚拟 HUB 中不能运行。 -CMD_CascadeProxySocks_Args CascadeProxySocks [name] [/SERVER:hostname:port] [/USERNAME:username] [/PASSWORD:password] -CMD_CascadeProxySocks_[name] 指定级联名称来改变设置。 -CMD_CascadeProxySocks_SERVER 按照 [主机名:端口号] 的格式,设定代理服务器主机名或 IP 地址和端口号。 -CMD_CascadeProxySocks_USERNAME 如果连接到 SOCKS4 代理服务器时需要用户验证,则指定用户名。同时设定密码和参数。如果没有设定用户名和密码参数,则不需要设置用户身份验证。 -CMD_CascadeProxySocks_PASSWORD 如果连接到 SOCKS4 代理服务器时需要用户验证,则指定密码。/USERNAME,参数等同时设定。 - - -# CascadeProxySocks5 命令 -CMD_CascadeProxySocks5 将级联连接方法设定为通过 SOCKS5 代理服务器 -CMD_CascadeProxySocks5_Help 指定已经在当前虚拟 HUB 注册的级联连接,当此连接和 VPN Server 之间通信时,设置连接方法为 [通过 SOCKS5 代理服务器],设置 SOCKS5 代理服务器的主机名和端口号,用户名和密码 (如果需要)。\n此命令在集群虚拟 HUB 中不能运行。 -CMD_CascadeProxySocks5_Args CascadeProxySocks5 [name] [/SERVER:hostname:port] [/USERNAME:username] [/PASSWORD:password] -CMD_CascadeProxySocks5_[name] 指定级联名称来改变设置。 -CMD_CascadeProxySocks5_SERVER 按照 [主机名:端口号] 的格式,设定代理服务器主机名或 IP 地址和端口号。 -CMD_CascadeProxySocks5_USERNAME 如果连接到 SOCKS5 代理服务器时需要用户验证,则指定用户名。同时设定密码和参数。如果没有设定用户名和密码参数,则不需要设置用户身份验证。 -CMD_CascadeProxySocks5_PASSWORD 如果连接到 SOCKS5 代理服务器时需要用户验证,则指定密码。/USERNAME,参数等同时设定。 - - -# CascadeServerCertEnable 命令 -CMD_CascadeServerCertEnable 启用级联服务器证书验证选项 -CMD_CascadeServerCertEnable_Help 指定已经在当前虚拟 HUB 注册的级联连接,当此连接和 VPN Server 之间通信时,验证目标连接的 VPN 的服务器提供的 SSL 证书是否可以信任。\n如果启用此选项,需要将在目标服务器的证书事先通过 CascadeServerCertSet 指令设置到级联的连接设置中,或者在虚拟 HUB 的可信任证书列表中,运行 CAAdd 指令,将有服务器的 SSL 证书署名的路线证书添加进去。\n当启用服务器证书验证选项时,如果 VPN Server 提供的证书不可信,连接将断开,并重试。\n此命令在集群虚拟 HUB 中不能运行。 -CMD_CascadeServerCertEnable_Args CascadeServerCertEnable [name] -CMD_CascadeServerCertEnable_[name] 指定级联名称来改变设置。 - - -# CascadeServerCertDisable 命令 -CMD_CascadeServerCertDisable 禁用级联服务器证书验证选项 -CMD_CascadeServerCertDisable_Help 指定已经在当前虚拟 HUB 注册的级联连接,当此连接和 VPN Server 之间通信时,对于连接方提供的 SSL 证书,不需要检查是否可以信任。\n此命令在集群虚拟 HUB 中不能运行。 -CMD_CascadeServerCertDisable_Args CascadeServerCertDisable [name] -CMD_CascadeServerCertDisable_[name] 指定级联名称来改变设置。 - - -# CascadeServerCertSet 命令 -CMD_CascadeServerCertSet 设置级联连接的服务器特定证书 -CMD_CascadeServerCertSet_Help 指定已经在当前虚拟 HUB 注册的级联连接,当此连接和 VPN Server 之间通信时,事先将连接方提供的 SSL 证书注册。\n如果启用此选项,需要将在目标服务器的证书事先通过指令设置到级联的连接设置中,或者在虚拟 HUB 的可信任证书列表中,运行 CAAdd 指令,将有服务器的 SSL 证书署名的路线证书添加进去。\n当启用服务器证书验证选项时,如果 VPN Server 提供的证书不可信,连接将断开,并重试。\n此命令在集群虚拟 HUB 中不能运行。 -CMD_CascadeServerCertSet_Args CascadeServerCertSet [name] [/LOADCERT:cert] -CMD_CascadeServerCertSet_[name] 指定级联名称来改变设置。 -CMD_CascadeServerCertSet_LOADCERT 设定文件名保存服务器固有的 X.509 格式的证书。 - - -# CascadeServerCertDelete 命令 -CMD_CascadeServerCertDelete 删除级联服务器固有的证书 -CMD_CascadeServerCertDelete_Help 选定当前虚拟 HUB 中已注册的级联,如果已经注册了服务器证书,将其删除。\n此命令在集群虚拟 HUB 中不能运行。 -CMD_CascadeServerCertDelete_Args CascadeServerCertDelete [name] -CMD_CascadeServerCertDelete_[name] 指定级联名称来改变设置。 - - -# CascadeServerCertGet 命令 -CMD_CascadeServerCertGet 获取级联连接服务器的固有证书 -CMD_CascadeServerCertGet_Help 选定在当前虚拟 HUB 上已注册的级联,如果此级联中已经注册了服务器固有证书,则获得该证书,并保存为 X.509 格式。\n此命令在集群虚拟 HUB 中不能运行。 -CMD_CascadeServerCertGet_Args CascadeServerCertGet [name] [/SAVECERT:path] -CMD_CascadeServerCertGet_[name] 指定级联名称来改变设置。 -CMD_CascadeServerCertGet_SAVECERT 指定名称以 X.509 格式保存服务器的固有证书。 - - -# CascadeDetailSet 命令 -CMD_CascadeDetailSet 级联通信的高级设置 -CMD_CascadeDetailSet_Help 选定在当前虚拟 HUB 上已注册的级联,设置级联和 VPN Server 连接通信时使用的 VPN 自定义的通信协议。\n此命令在集群虚拟 HUB 中不能运行。 -CMD_CascadeDetailSet_Args CascadeDetailSet [name] [/MAXTCP:max_connection] [/INTERVAL:interval] [/TTL:disconnect_span] [/HALF:yes|no] [/NOQOS:yes|no] -CMD_CascadeDetailSet_[name] 指定级联名称来改变设置。 -CMD_CascadeDetailSet_MAXTCP VPN 通信中使用的 TCP 连接的数量,用从 1 到 32 的整数来指定。和 VPN Server 之间的 VPN 数据传输,可以通过使用多个 TCP 连接,提高通信速度。\n注意: 如果您使用高速连接到大约使用 8 根,如果是缓慢的拨号服务器,请使用一根。 -CMD_CascadeDetailSet_INTERVAL 如果使用多个 TCP 连接进行 VPN 通信时,请设定各个 TCP 连接之间确立连接秒数。默认值为 1 秒。 -CMD_CascadeDetailSet_TTL 如果您设置每个 TCP 连接的寿命,从连接到断开用秒表示。0 表示寿命未设置。 -CMD_CascadeDetailSet_HALF 如果启动半双工模式选择 "yes"。使用两根以上的 VPN 连接进行 TCP 通信时,可以使用 "半双工模式"。启动半双工模式后,每个 TCP 可以固定一半连接实现单方向的数据传输。例如,使用 8 根 TCP 连接建立 VPN 通信,使用半双工模式后,会有 4 路 TCP 连接上船数据,剩下的 4 路负责下载数据。 -CMD_CascadeDetailSet_NOQOS 禁用 VoIP/ QoS 对应功能选择 "yes"。通常选择 "no"。 -CMD_CascadeDetailSet_Eval_MaxTcp TCP 连接请在 1-32 之间选定。 -CMD_CascadeDetailSet_Eval_Interval TCP 连接之间建立连接的间隔请选定为 1 秒以上。 -CMD_CascadeDetailSet_Prompt_MaxTcp 在 VPN 通信中使用的 TCP 连接数: -CMD_CascadeDetailSet_Prompt_Interval TCP 连接之间建立连接的间隔: -CMD_CascadeDetailSet_Prompt_TTL 每一个 TCP 连接的寿命 (如为 0 则表示没有) : -CMD_CascadeDetailSet_Prompt_HALF 使用半双工模式 (yes/no): - - -# CascadePolicySet 命令 -CMD_CascadePolicySet 设置级联连接的安全协议 -CMD_CascadePolicySet_Help 选定当前虚拟 HUB 上已经注册的级联连接,设置级联连接建立时所适用的安全协议。\n虚拟 HUB 和别的 VPN Server 进行级联连接时,连接方的虚拟 HUB 中将产生新的级联,运行此命令可以设置级联的安全协议。\n此命令在集群虚拟 HUB 中不能运行。 -CMD_CascadePolicySet_Args [name] [/NAME:policy_name] [/VALUE:num|yes|no] -CMD_CascadePolicySet_[name] 指定级联名称来改变设置。 -CMD_CascadePolicySet_NAME 选定要更改设置的协议名称。变更协议的名称和可变更的值,可通过运行 PolicyList 命令获得列表。 -CMD_CascadePolicySet_VALUE 设定协议的新值,如果协议是数值,请设定为一个整数。如果是选择型,请选 yes 或 no。 设定的值可以通过运行PolicyList命令来获得。 -CMD_CascadePolicySet_PROMPT_POLNAME 更改值得协议的名称: -CMD_CascadePolicySet_PROMPT_POLVALUE 设置新值: -CMD_CascadePolicySet_Invalid_Name 指定的协议名称 "%S" 是无效的。\n请运行 PolicyList 命令,您可以获取设置协议的清单。 -CMD_CascadePolicySet_Invalid_Name_For_Cascade 指定协议 "%S" 在设置级联的安全协议时不可用。 -CMD_CascadePolicySet_Invalid_Range 协议 "%S" 请在 %s 范围内选定。 - - -# PolicyList 命令 -CMD_PolicyList 查看安全协议和可以设置的值得列表 -CMD_PolicyList_Help 显示 VPN Server 中的用户,群,级联的安全协议的项目名称,说明,以及可以设定的值的清单。\n不指定任何参数的前提下运行 PolicyList 命令,你可以获得被支持的安全协议的名称和说明。\n如果用 PolicyList 指令指定名称,您可以获得关于这个协议的详细说明,及值的类型和值的范围。 -CMD_PolicyList_Args PolicyList [name] -CMD_PolicyList_[name] 选定想要显示的协议名称。如果没有指定,所有的名称和安全协议及其说明将被列表的支持。 -CMD_PolicyList_Invalid_Name 无效的安全协议名称。 -CMD_PolicyList_Column_1 协议名称 -CMD_PolicyList_Column_2 协议的简单解释 -CMD_PolicyList_Column_3 设置值 -CMD_PolicyList_Help_1 策略名称 -CMD_PolicyList_Help_2 协议的简单说明 -CMD_PolicyList_Help_3 [可以设定的值的范围] -CMD_PolicyList_Help_4 默认值 -CMD_PolicyList_Help_5 [协议的详细说明 -CMD_PolicyList_Range_Bool 是 (Yes) 或 否 (No) -CMD_PolicyList_Range_Int_1 %s 以上或 %s 以下 (0 不能设定) -CMD_PolicyList_Range_Int_2 %s 以上或 %s 以下 (但是,没有指定为 0 则没有设置) - - -# CascadeStatusGet 命令 -CMD_CascadeStatusGet 获取级联的当前状态 -CMD_CascadeStatusGet_Help 选定在当前虚拟 HUB 上注册的级联,如果此级联处于连线状态,您将可以获得它的连接状态和其他信息。\n此命令在集群虚拟 HUB 中不能运行。 -CMD_CascadeStatusGet_Args CascadeStatusGet [name] -CMD_CascadeStatusGet_[name] 指定级联名称,以获取信息。 - - -# CascadeRename 命令 -CMD_CascadeRename 更改级联的名称 -CMD_CascadeRename_Help 选定在当前虚拟 HUB 上注册的级联,改变它的连接名称。\n此命令在集群虚拟 HUB 中不能运行。 -CMD_CascadeRename_Args CascadeRename [name] [/NEW:new_name] -CMD_CascadeRename_[name] 指定要变更的级联的当前名称。 -CMD_CascadeRename_NEW 指定变更后的新名称。 -CMD_CascadeRename_PROMPT_OLD 目前的名称: -CMD_CascadeRename_PROMPT_NEW 新名称: - - - -# CascadeOnline 命令 -CMD_CascadeOnline 设置级联接续的在线状态 -CMD_CascadeOnline_Help 选定在当前虚拟 HUB 上注册的级联,将级联的连接状态设定为连接。级联成功连接后,可以通过连接设定连接到 VPN Server。处于在线状态的级联,除非运行 CascadeOffline 脱机命令,则 VPN Server 始终保持连接。\n此命令在集群虚拟 HUB 中不能运行。 -CMD_CascadeOnline_Args CascadeOnline [name] -CMD_CascadeOnline_[name] 指定级联名称设定为联机状态。 - - -# CascadeOffline 命令 -CMD_CascadeOffline 将级联设置为脱机状态 -CMD_CascadeOffline_Help 选定在当前虚拟 HUB 上注册的级联,将级联的连接状态设定为脱机。处于脱机状态的级联,除非运行 CascadeOnline 命令使它连线,否则无法连接到 VPN Server。\n此命令在集群虚拟 HUB 中不能运行。 -CMD_CascadeOffline_Args CascadeOffline [name] -CMD_CascadeOffline_[name] 指定级联名称设置到脱机状态。 - - -# AccessAdd 命令 -CMD_AccessAdd 添加规则到允许访问列表 (IPv4) -CMD_AccessAdd_Help 在当前虚拟 HUB 的访问列表中,添加新的规则。\n访问列表指的是虚拟 HUB 中,对流动的数据包进行筛选的规则,访问列表中可以登录多条规则,每条规则可以定义优先顺序。所有的数据包,按照最初适用的条件,或是通过或是销毁。不符合任何规则的数据包则将被默许通过。您也可以使用AccessAddEx 命令,来生成延迟、时基误差和数据包丢失。\n此命令,在 VPN Bridge 中不会运行。\n此命令在集群虚拟 HUB 中不能运行。 -CMD_AccessAdd_Args AccessAdd [pass|discard] [/MEMO:memo] [/PRIORITY:priority] [/SRCUSERNAME:username] [/DESTUSERNAME:username] [/SRCMAC:mac/mask] [/DESTMAC:mac/mask] [/SRCIP:ip/mask] [/DESTIP:ip/mask] [/PROTOCOL:tcp|udp|icmpv4|icmpv6|ip|num] [/SRCPORT:start-end] [/DESTPORT:start-end] [/TCPSTATE:established|unestablished] -CMD_AccessAdd_[pass|discard] 确定数据包跟规则条件一致时的处理。当您指定 pass 意为通过,指定 discard,意为销毁。 -CMD_AccessAdd_MEMO 选定规则的解释 (备忘录)。 -CMD_AccessAdd_PRIORITY 用 1 以上的整数指定优先顺序。数字越小优先级越高。 -CMD_AccessAdd_SRCIP 作为规则条件制定一个源 IPv4 地址。用点把十进制数值分开的 IP 地址/掩码[格式指定一个 IPv4 地址,例如 192.168.0.1 掩码例如 255.255.255.0 为十进制,以点分隔,或者像 24 这样从开始设定字节长度,以十进位。如果设定为 0.0.0.0/0.0.0.0 则显示所有主机。 -CMD_AccessAdd_DESTIP 作为规则的条件必须制定目标 IPv4 地址:用 [IP 地址/掩码]格式制定方法同指定 /SRCIP 参数类似。 -CMD_AccessAdd_PROTOCOL 根据规则的条件,需指定协议类型。IP 协议号或者输入一个十进制数,或者 "tcp" (TCP/IP 协议,第 6 号),"udp" (UDP/IP 协议,第 17 号),"icmpv4" (ICMPv4 协议,第 1 号),"icmpv6" (ICMPv6 协议,第 58 号),"ip" (所有的 IP 协议,0 号) 来指定所有 IP 协议中的关键字。如果选定所有的 IP 协议,则选 0。 -CMD_AccessAdd_SRCPORT 协议 TCP/IP 或 UDP/IP 的情况下,作为规则需指定源端口号。其他的协议不需要。如果该参数没有指定,则选定所有端口。设定方法,例如 "1-1024" (第 1 到 1024),"23" (只选第 23 只)。 -CMD_AccessAdd_DESTPORT 协议 TCP/IP 或 UDP/IP 的情况下,作为规则需指定源端口号。其他的协议不需要。制定方法同指定 /SRCPORT 参数一样。 -CMD_AccessAdd_SRCUSERNAME 作为此规则的条件,只有被指定的用户 / 用户組发送的数据包,才适用与此规则。在这种情况下,需指定用户名 / 用户組名。 -CMD_AccessAdd_DESTUSERNAME 作为此规则的条件,只有被指定的用户 / 用户組接受的数据包,才适用与此规则。在这种情况下,需指定用户名 / 用户組名。 -CMD_AccessAdd_SRCMAC 作为规则的条件,指定发送原 MAC 地址。MAC 地址像例子 (00-AC-84-EA-33-BC/FF-FF-FF-FF-FF-00) 一样地 '-' 或 '/' 断开十六进制数写。段落文字能省略。 -CMD_AccessAdd_DESTMAC 作为规则的条件,指定地址 MAC 地址。指定方法,/SRCMAC 参数同样。 -CMD_AccessAdd_TCPSTATE 作为规则的条件,指定 TCP 连接的状态。 Established 或指定 Unestablished。 -CMD_AccessAdd_Prompt_TYPE 通过或破坏: -CMD_AccessAdd_Prompt_MEMO 规则的解释 (备忘录): -CMD_AccessAdd_Prompt_PRIORITY 规则的优先顺序: -CMD_AccessAdd_Eval_PRIORITY 请用 1 以上的整数指定优先顺序。 -CMD_AccessAdd_Prompt_SRCIP 发信方的源 IP 地址 (0.0.0.0/0 则代表所有): -CMD_AccessAdd_Prompt_DESTIP 收信方的源 IP 地址 (0.0.0.0/0 则代表所有): -CMD_AccessAdd_Prompt_PROTOCOL 协议号码或协议名称 (tcp/udp/icmpv4/icmpv6/ip): -CMD_AccessAdd_Prompt_SRCPORT 源端口范围 (仅限 tcp/udp): -CMD_AccessAdd_Prompt_DESTPORT 目标端口号范围 (仅限 tcp/udp): -CMD_AccessAdd_Prompt_SRCUSERNAME 发送用户名 (若无指定代表全部): -CMD_AccessAdd_Prompt_DESTUSERNAME 接收用户名 (若无指定代表全部): -CMD_AccessAdd_Prompt_SRCMAC 由于发送原 MAC 地址和面罩 (无指定全部): -CMD_AccessAdd_Prompt_DESTMAC 由于地址 MAC 地址和面罩 (无指定全部): -CMD_AccessAdd_Prompt_TCPSTATE TCP 连接的状态 (Established/Unestablished): - - -# AccessAddEx 命令 -CMD_AccessAddEx 添加扩展访问列表规则 (IPv4:延迟、时基误差/数据包丢失产生) -CMD_AccessAddEx_Help 在当前管理的虚拟 HUB 的访问列表中,使用此命令添加新的规则。当数据包经由虚拟 HUB 通过时,你可以设置产生延迟、时基误差和数据包丢失。\n访问列表是一组文件规则被应用到流过虚拟 HUB 的数据包。您可以在一个访问列表中注册多个规则,你也可以定义每个规则的优先级。检查所有的数据包的规则所指定的条件,在访问列表中注册的规则,由第一个匹配的规则根据规定的操作,它们要么通过要么被丢弃。不匹配任何规则的数据包暗中允许通过。您也可以使用 AccessAddEx 的命令来生成延迟、时基误差和数据包丢失。\n此命令不能在 VPN Bridge 上运行。\n在以成员服务器群集上运行的 VPN Server 的虚拟 HUB 上,您不能执行此命令。 -CMD_AccessAddEx_Args AccessAddEx [pass|discard] [/MEMO:memo] [/PRIORITY:priority] [/SRCUSERNAME:username] [/DESTUSERNAME:username] [/SRCMAC:mac/mask] [/DESTMAC:mac/mask] [/SRCIP:ip/mask] [/DESTIP:ip/mask] [/PROTOCOL:tcp|udp|icmpv4|icmpv6|ip|num] [/SRCPORT:start-end] [/DESTPORT:start-end] [/SRCUSERNAME:username] [/DESTUSERNAME:username] [/TCPSTATE:established|unestablished] [/DELAY:delay_millisec] [/JITTER:jitter_percent] [/LOSS:loss_percent] [/REDIRECTURL:url] -CMD_AccessAddEx_[pass|discard] 当一个数据包匹配此规则条件时,该操作就已决定了。当通过被指定时,则数据包允许通过;当丢弃被指定时,数据包被丢弃。如果动作是通过,延迟、时基误差和数据包丢失的设置被应用。 -CMD_AccessAddEx_MEMO 指定此规则的描述 (备忘录)。 -CMD_AccessAddEx_PRIORITY 指定 1 或以上的整数作为此规则的优先级。数字越小优先级越高。 -CMD_AccessAddEx_SRCIP 指定一个源 IPv4 地址作为一个规则条件。用点把十进制数值分开的 [IP 地址/掩码] 格式指定一个 IPv4 地址,例如: 192.168.0.1。对于掩码,您或者可以指定由点分开的十进制数值,例如 255.255.255.0 也可以指定从标头用十进制数值的比特长度,如 24。 如果您指定: 0.0.0.0/0.0.0.0 这表示所有主机。 -CMD_AccessAddEx_DESTIP 用 [IP 地址/掩码] 格式指定一个目的 IPv4 地址作为一个规则条件指定方法同指定 /SRCPORT 参数一样。 -CMD_AccessAddEx_PROTOCOL 指定一个协议类型作为一个规则条件。使用十进制数值输入 IP 协议号,或者指定关键字中的一个 "tcp" (TCP/IP 协议,第 6 号),"udp" (UDP/IP 协议,第 17 号),"icmpv4" (ICMPv4 协议,第 1 号),"icmpv6" (ICMPv6 协议,第 58 号)或者, "ip" (所有的 IP 协议,0 号)。指定数字 0,则规则会应用到全部 IP 协议。 -CMD_AccessAddEx_SRCPORT 如果已指定的协议是 TCP/IP 或 UDP/IP 的话,指定端口号的目的地作为规则条件。其他的协议会被忽略。如果该参数没有指定,那么规则会应用到所有端口号。当指定时,请使用如下方法: "1-1024" (第 1 到 1024),"23" (仅限 23)。 -CMD_AccessAddEx_DESTPORT 如果已指定的协议是 TCP/IP 或 UDP/IP 的话,指定目的端口号的目的地作为规则条件。其他协议将被忽略。指定方法同指定 /SRCPORT 参数一样。 -CMD_AccessAddEx_SRCUSERNAME 您可以将此规则仅用于作为规则条件被指定了用户名的用户会话发送的数据包。在这种情况下,请指定该用户名。 -CMD_AccessAddEx_DESTUSERNAME 您可以将此规则仅用于作为规则条件被指定了用户名的用户会话接收的数据包。在这种情况下,请指定该用户名。 -CMD_AccessAddEx_SRCMAC 指定目标 MAC 地址作为一个规则。用'-' 或 '/'分隔符和十六进制数字,如 (00-AC-84-EA-33-BC/FF-FF-FF-FF-FF-00) 来指定 MAC 地址。分隔符可跳过。 -CMD_AccessAddEx_DESTMAC 指定目标 MAC 地址作为一个规则。指定方法同指定 /SRCPORT 参数一样。 -CMD_AccessAddEx_TCPSTATE 指定 TCP 连接状态作为一个规则。使用 Established (已建立的)或 Unestablished(未建立的)。 -CMD_AccessAddEx_DELAY 当数据包通过时,设置此数值来生成延迟。以毫秒来指定延迟的时间段。指定 0,意为不会生成延迟。延迟最多为 10000 毫秒、 -CMD_AccessAddEx_JITTER 当数据包通过时,设置此数值来生成时基误差。用 0% 到 100% 之内的范围来指定时基误差波动的频率。指定 0,意为不会生成时基误差。 -CMD_AccessAddEx_LOSS 当数据包通过时,设置此数值来生成数据包丢失。用 0% 到 100% 之内的范围来指定丢包的频率。指定 0,意为不会生成丢包。 -CMD_AccessAddEx_REDIRECTURL The specified URL will be mandatory replied to the client as a response for TCP connecting request packets which matches the conditions of this access list entry via this Virtual Hub. To use this setting, you can enforce the web browser of the VPN Client computer to show the specified web site when that web browser tries to access the specific IP address. -CMD_AccessAddEx_Prompt_DELAY 生成延迟 (毫秒: 0 - 10000): -CMD_AccessAddEx_Prompt_JITTER 生成时基误差的波动(百分比: 0 - 100): -CMD_AccessAddEx_Prompt_LOSS 丢包率 (百分比: 0 - 100): -CMD_AccessAddEx_Eval_DELAY 最大延迟为 10000 -CMD_AccessAddEx_Eval_JITTER 最大时基误差的波动为 100 -CMD_AccessAddEx_Eval_LOSS 最大丢包率为 100 - - -# AccessAdd6 命令 -CMD_AccessAdd6 添加访问列表规则 (IPv6) -CMD_AccessAdd6_Help 在当前管理的虚拟 HUB 的访问列表中,使用此命令添加新的规则。\n访问列表是一组文件规则被应用到流过虚拟 HUB 的数据包。您可以在一个访问列表中注册多个规则,你也可以定义每个规则的优先级。检查所有的数据包的规则所指定的条件,在访问列表中注册的规则,由第一个匹配的规则根据规定的操作,它们要么通过要么被丢弃。不匹配任何规则的数据包暗中允许通过。您也可以使用 AccessAddEx6 的命令来生成延迟、时基误差和数据包丢失。 \n此命令不能在 VPN Bridge 上运行。 \n在以成员服务器群集上运行的 VPN Server 的虚拟 HUB 上,您不能执行此命令。 -CMD_AccessAdd6_Args AccessAdd6 [pass|discard] [/MEMO:memo] [/PRIORITY:priority] [/SRCUSERNAME:username] [/DESTUSERNAME:username] [/SRCMAC:mac/mask] [/DESTMAC:mac/mask] [/SRCIP:ip/mask] [/DESTIP:ip/mask] [/PROTOCOL:tcp|udp|icmpv4|icmpv6|ip|num] [/SRCPORT:start-end] [/DESTPORT:start-end] [/TCPSTATE: established|unestablished] -CMD_AccessAdd6_[pass|discard] 当一个数据包匹配此规则条件时,该操作就已决定了。当通过被指定时,则数据包允许通过;当丢弃被指定时,数据包被丢弃。 -CMD_AccessAdd6_MEMO 指定此规则的描述。 (备忘录)。 -CMD_AccessAdd6_PRIORITY 指定1或以上的整数作为此规的优先级。数字越小优先级越高。 -CMD_AccessAdd6_SRCIP 指定一个源 IPv6 地址作为一个规则条件。使用冒号分割十六进制数字的 [IP 地址/掩码] 格式来指定 IPv6 地址。例如 2001:200:0:1:: 对于掩码来讲,您或者可以使用冒号分隔十六位数值的格式,例如 ffff:ffff:ffff:ffff:: 或者您也可以通过用标头的十进制数值像 128,来指定比特长度。如果您要指定 "::/0",意为所有主机。 -CMD_AccessAdd6_DESTIP 用 [IP 地址/掩码] 格式指定一个目标 IPv6 地址作为一个规则条件。制定方法同指定/SRCIP参数类似。 -CMD_AccessAdd6_PROTOCOL 指定一个协议类型来作为一个规则条件。输入十进制数值的 IP 协议号或者指定一个关键字 "tcp" (TCP/IP 协议,第 6 号),"udp" (UDP/IP 协议,第 17 号),"icmpv4" (ICMPv4 协议,第 1 号),"icmpv6" (ICMPv6 协议,第 58 号),"ip" (所有的 IP 协议,0 号)。指定]0[,则规则会应用于所有IP协议。 -CMD_AccessAdd6_SRCPORT 如果指定的协议是 TCP/IP 或 UDP/IP,则指定源端口号作为规则条件。其他协议将被忽略。如果该参数没有指定,规则将会应用到所有端口号。指定时,请使用如下方法 "1-1024" (第 1 到 1024),"23" (仅是第 23 )。 -CMD_AccessAdd6_DESTPORT 如果指定的协议是 TCP/IP 或 UDP/IP,则指定目标端口号作为规则条件。其他协议将被忽略。指定方法同指定 /SRCPORT 参数一样。 -CMD_AccessAdd6_SRCUSERNAME 您可以将此规则仅用于作为规则条件被指定了用户名的用户会话发送的数据包。在这种情况下,请指定该用户名。 -CMD_AccessAdd6_DESTUSERNAME 您可以将此规则仅用于作为规则条件被指定了用户名的用户会话接收的数据包。在这种情况下,请指定该用户名。 -CMD_AccessAdd6_SRCMAC 指定目的 MAC 地址作为规则。用分隔符 "-" 或者 ":" 和十六进制的数字,如 00-AC-84-EA-33-BC/FF-FF-FF-FF-FF-00 来指定 MAC 地址。分隔符可以跳过。 -CMD_AccessAdd6_DESTMAC 指定目标 MAC 地址作为一个规则。方法与指定 /SRCMAC 参数同样。 -CMD_AccessAdd6_TCPSTATE 指定 TCP 连接状态作为一个规则。使用 Established 或 Unestablished。 -CMD_AccessAdd6_Prompt_TYPE 通过或丢弃: -CMD_AccessAdd6_Prompt_MEMO 规则描述 (备忘录): -CMD_AccessAdd6_Prompt_PRIORITY 规则优先级: -CMD_AccessAdd6_Eval_PRIORITY 请用 1 或以上的整数指定优先顺序。 -CMD_AccessAdd6_Prompt_SRCIP 源 IPv6 地址 (::/0 则代表所有): -CMD_AccessAdd6_Prompt_DESTIP 目标 IPv6 地址 (::/0 则代表所有): -CMD_AccessAdd6_Prompt_PROTOCOL 协议号或协议名称 (tcp/udp/icmpv4/icmpv6/ip): -CMD_AccessAdd6_Prompt_SRCPORT 源端口号范围 (仅限 tcp/udp): -CMD_AccessAdd6_Prompt_DESTPORT 目标端口号范围 (仅限 tcp/udp): -CMD_AccessAdd6_Prompt_SRCUSERNAME 源用户名 (若无指定代表全部): -CMD_AccessAdd6_Prompt_DESTUSERNAME 目的用户名 (若无指定代表全部): -CMD_AccessAdd6_Prompt_SRCMAC 源 MAC 地址和掩码 (若无指定代表全部): -CMD_AccessAdd6_Prompt_DESTMAC 目标 MAC 地址和掩码 (若无指定代表全部): -CMD_AccessAdd6_Prompt_TCPSTATE TCP 连接的状态 (Established/Unestablished): - - -# AccessAddEx6 命令 -CMD_AccessAddEx6 添加扩展访问列表规则 (IPv6,生成延迟,时基误差/数据包丢失) -CMD_AccessAddEx6_Help 在当前管理的虚拟 HUB 的访问列表中,使用此命令添加新的规则。当数据包经由虚拟 HUB 通过时,你可以设置产生延迟、时基误差和数据包丢失。\n访问列表是一组文件规则被应用到流过虚拟 HUB 的数据包。您可以在一个访问列表中注册多个规则,你也可以定义每个规则的优先级。检查所有的数据包的规则所指定的条件,在访问列表中注册的规则,由第一个匹配的规则根据规定的操作,它们要么通过要么被丢弃。不匹配任何规则的数据包暗中允许通过。您也可以使用 AccessAddEx6 的命令来生成延迟、时基误差和数据包丢失。 \n此命令不能在 VPN Bridge 上运行。 \n在以成员服务器群集上运行的 VPN Server 的虚拟 HUB 上,您不能执行此命令。 -CMD_AccessAddEx6_Args AccessAddEx6 [pass|discard] [/MEMO:memo] [/PRIORITY:priority] [/SRCUSERNAME:username] [/DESTUSERNAME:username] [/SRCMAC:mac/mask] [/DESTMAC:mac/mask] [/SRCIP:ip/mask] [/DESTIP:ip/mask] [/PROTOCOL:tcp|udp|icmpv4|icmpv6|ip|num] [/SRCPORT:start-end] [/DESTPORT:start-end] [/TCPSTATE: established|unestablished] [/DELAY:delay_millisec] [/JITTER:jitter_percent] [/LOSS:loss_percent] [/REDIRECTURL:url] -CMD_AccessAddEx6_[pass|discard] 如果通过,会产生延迟,抖动和丢包。当一个数据包匹配此规则条件时,该操作就已决定了。当通过被指定时,则数据包允许通过;当丢弃被指定时,数据包被丢弃。如果动作是通过,延迟、时基误差和数据包丢失的设置被应用。 -CMD_AccessAddEx6_MEMO 指定此规则的描述(备忘录)。 -CMD_AccessAddEx6_PRIORITY 指定1或以上的整数作为此规则的优先级。数字越小优先级越高。 -CMD_AccessAddEx6_SRCIP 指定一个源 IPv6 地址作为一个规则条件。指定一个源 IPv6 地址作为一个规则条件。对于掩码来讲,您或者可以使用冒号分隔十六位数值的格式,例如 "ffff:ffff:ffff:ffff::" 或者您也可以通过用标头的十进制数值像 "64",来指定比特长度。如果您要指定 "::/0",意为所有主机。 -CMD_AccessAddEx6_DESTIP 用 [IP 地址/掩码] 格式指定一个目标 IPv6 地址作为一个规则条件。指定方法同指定 /SRCIP 参数类似。 -CMD_AccessAddEx6_PROTOCOL 指定一个协议类型来作为一个规则条件。输入十进制数值的IP 协议号或者指定一个关键字 "tcp" (TCP/IP 协议,第 6 号),"udp" (UDP/IP 协议,第 17 号),"icmpv4" (ICMPv4 协议,第 1 号),"icmpv6" (ICMPv6 协议,第 58 号),"ip" (所有的 IP 协议,0 号)。指定 0,则规则会应用于所有 IP 协议。 -CMD_AccessAddEx6_SRCPORT 如果已指定的协议是 TCP/IP 或 UDP/IP 的话,指定端口号的目的地作为规则条件。其他的协议会被忽略。如果该参数没有指定,那么规则会应用到所有端口号。当指定时,请使用如下方法: "1-1024" (第 1 到 1024),"23" (仅限 23)。 -CMD_AccessAddEx6_DESTPORT 如果指定的协议是 TCP/IP 或 UDP/IP 的话,则指定目标端口号作为规则条件。其他协议会被忽略。如果该参数没有指定,指定方法同指定 /SRCPORT 参数一样。 -CMD_AccessAddEx6_SRCUSERNAME 您可以将此规则仅用于作为规则条件被指定了用户名的用户会话发送的数据包。在这种情况下,请指定该用户名。 -CMD_AccessAddEx6_DESTUSERNAME 您可以将此规则仅用于作为规则条件被指定了用户名的用户会话接收的数据包。在这种情况下,请指定该用户名。 -CMD_AccessAddEx6_SRCMAC 指定目标 MAC 地址作为规则。用分隔符]-[或者]:[和十六进制的数字,如 "00-AC-84-EA-33-BC/FF-FF-FF-FF-FF-00" 来指定 MAC 地址。分隔符可以跳过。 -CMD_AccessAddEx6_DESTMAC 指定目标 MAC 地址作为一个规则。方法与指定 /SRCMAC 参数同样。 -CMD_AccessAddEx6_TCPSTATE 指定 TCP连接状态作为一个规则。使用已建立的(Established) 或未建立的(Unestablished)。 -CMD_AccessAddEx6_DELAY 当数据包通过时,设置本数值来产生延迟。以毫秒为单位来指定延迟周期。指定0,意为不产生延迟。延迟最大为 10000 毫秒。 -CMD_AccessAddEx6_JITTER 当数据包通过时,设置本数值来产生时基误差。当数据包通过时,设置此数值来生成时基误差。用 0% 到 100% 之内的范围来指定时基误差波动的频率。指定 0,意为不会生成时基误差。 -CMD_AccessAddEx6_LOSS 当数据包通过时,设置本数值来产生数据包丢失。指定 0% 至 100% 来作为丢包的比率范围。指定 0,意为无丢包生成。 -CMD_AccessAddEx6_REDIRECTURL The specified URL will be mandatory replied to the client as a response for TCP connecting request packets which matches the conditions of this access list entry via this Virtual Hub. To use this setting, you can enforce the web browser of the VPN Client computer to show the specified web site when that web browser tries to access the specific IP address. -CMD_AccessAddEx6_Prompt_DELAY 生成延迟 (毫秒: 0 - 10000): -CMD_AccessAddEx6_Prompt_JITTER 生成时基误差的波动 (百分比: 0 - 100): -CMD_AccessAddEx6_Prompt_LOSS 丢包率 (百分比: 0 - 100): -CMD_AccessAddEx6_Eval_DELAY 最大延迟为 10000 -CMD_AccessAddEx6_Eval_JITTER 最大时基误差波动为 100 -CMD_AccessAddEx6_Eval_LOSS 最大丢包率为 100 - - -# AccessList 命令 -CMD_AccessList 获取访问列表规则 -CMD_AccessList_Help 获取当前虚拟 HUB 的访问列表中注册的数据包筛选规则一览表。\n访问列表,即是虚拟 HUB 内对流动的数据包进行筛选的规则的集合,访问列表中可以登录多条规则,每条规则可以定义优先顺序。通过包过滤规则适用英寸访问列表可以注册一个以上的规则可以定义一个优先考虑每一条规则。所有的数据包,按照最初适用的条件,或是通过或是销毁。不符合任何规则的数据包则将被默许通过。\n此命令,在 VPN Bridge 中不会运行。\n此命令在集群虚拟 HUB 中不能运行。 -CMD_AccessList_Args AccessList - - -# AccessDelete 命令 -CMD_AccessDelete 从访问列表中删除规则 -CMD_AccessDelete_Help 从当前虚拟 HUB 中注册的访问列表中,选定数据包过滤规则并加以删除。\n要删除规则,需要指定该规则 ID。ID 可以运行 AccessList 获得。\n另外不删除而是暂时禁用的规则执行 AccessDisable 命令。\n此命令,在 VPN Bridge 中不会运行。\n此命令在集群虚拟 HUB 中不能运行。 -CMD_AccessDelete_Args AccessDelete [id] -CMD_AccessDelete_[id] 指定要删除的规则的 ID 或唯一 ID。 -CMD_Access_Prompt_ID 访问列表规则 ID 或唯一 ID: - - -# AccessEnable 命令 -CMD_AccessEnable 启用访问列表规则功能 -CMD_AccessEnable_Help 从当前虚拟 HUB 中注册的访问列表中,选定数据包筛选规则并激活。激活的规则用于数据包筛选。\n要启用该规则,必须指定它的 ID。您可以使用 AccessList 命令获取 ID。\n此命令,在 VPN Bridge 中不会运行。\n此命令在集群虚拟 HUB 中不能运行。 -CMD_AccessEnable_Args AccessEnable [id] -CMD_AccessEnable_[id] 指定规则的 ID 并激活。 - - -# AccessDisable 命令 -CMD_AccessDisable 禁用访问列表规则 -CMD_AccessDisable_Help 从当前虚拟 HUB 中注册的访问列表中,选定数据包筛选规则并禁用。被禁用的筛选规则将不会被用于数据包筛选。\n要禁用的规则,规则必须指定的 ID。\n要禁用该规则,必须指定它的 ID。您可以使用 AccessList 命令获取 ID。\n此命令,在 VPN Bridge 中不会运行。\n此命令在集群虚拟 HUB 中不能运行。 -CMD_AccessDisable_Args AccessDisable [id] -CMD_AccessDisable_[id] 指定规则的 ID 并禁用。 - - -# UserList 命令 -CMD_UserList 获取用户列表 -CMD_UserList_Help 获取当前虚拟 HUB 中注册的安全帐户数据库信息中的用户清单。\n此命令,在 VPN Bridge 中不会运行。\n此命令在集群虚拟 HUB 中不能运行。 -CMD_UserList_Args UserList - - -# UserCreate 命令 -CMD_UserCreate 创建用户 -CMD_UserCreate_Help 在当前虚拟 HUB 中注册的安全帐户数据库中创建一个新用户。\n当您创建一个用户,根据用户信息的认证,VPN Client 可以连接到这个虚拟 HUB。\n如果您使用 UserCreate 命令创建一个用户,用户身份验证方法是验证密码,注册为一个随机字符串作为密码分配。因此,用户不能直接连接到虚拟 HUB。在创建用户后,则必须运用 UserPasswordSet 命令,设定指定用户的密码。或者使用 UserAnonymousSet 命令,UserCertSet 命令,UserSignedSet 命令,UserRadiusSet 命令,UserNTLMSet 命令来改变用户身份验证方式。\n除非真有用户名为 "*" (星号),否则当客户登陆时提供的用户名与已有用户名不一致的情况下,将自动登录为 RADIUS 服务器,或者 NT 控制器来验证。\n如果要更改用户信息,可以执行 UserSet 命令。\n此命令,在 VPN Bridge 中不会运行。\n此命令在集群虚拟 HUB 中不能运行。 -CMD_UserCreate_Args UserCreate [name] [/GROUP:group] [/REALNAME:realname] [/NOTE:note] -CMD_UserCreate_[name] 指定新创建用户的用户名。 -CMD_UserCreate_GROUP 如果让用户加入一个用户组,请指定组名。如果你让用户不属于任何组,则设定为 /GROUP:none。 -CMD_UserCreate_REALNAME 指定用户的全名。如果不指定,请选 /REALNAME:none。 -CMD_UserCreate_NOTE 指定该用户的说明。否则,选择 /NOTE:none。 -CMD_UserCreate_Prompt_NAME 用户名: -CMD_UserCreate_Prompt_GROUP 加入群组名称: -CMD_UserCreate_Prompt_REALNAME 用户全名: -CMD_UserCreate_Prompt_NOTE 用户描述: - - -# UserSet 命令 -CMD_UserSet 更改用户信息 -CMD_UserSet_Help 变更当前虚拟 HUB 中的安全帐户数据库中注册的客户信息。\n可以更改的信息,即使创建新用户所需要的 "组名称","全名" 和 "描述" 这三个项目。\n要获得用户的名单,请使用 UserList 命令。\n此命令,在 VPN Bridge 中不会运行。\n此命令在集群虚拟 HUB 中不能运行。 -CMD_UserSet_Args UserSet [name] [/GROUP:group] [/REALNAME:realname] [/NOTE:note] -CMD_UserSet_[name] 指定用户名更改设置。 -CMD_UserSet_GROUP 如果让用户加入一个用户组,请指定组名。如果你让用户不属于任何组,则设定为 /GROUP:none。 -CMD_UserSet_REALNAME 指定用户的全名。如果不指定,请选 /REALNAME:none。 -CMD_UserSet_NOTE 指定该用户的说明。否则,选择 /NOTE:none - - -# UserDelete 命令 -CMD_UserDelete 删除用户 -CMD_UserDelete_Help 删除在虚拟 HUB 中的安全帐户数据库中注册的用户。当你删除一个用户,该用户将无法连接到虚拟 HUB。\n如果您使用 UserPolicySet 命令,即使不删除也可暂时禁止用户登录。\n要获得用户的名单,请使用 UserList 命令。\n此命令,在 VPN Bridge 中不会运行。\n此命令在集群虚拟 HUB 中不能运行。 -CMD_UserDelete_Args UserDelete [name] -CMD_UserDelete_[name] 指定用户名将其删除。 - - -# UserGet 命令 -CMD_UserGet 获取用户信息 -CMD_UserGet_Help 获取在虚拟 HUB 中的安全帐户数据库中注册用户的登录信息。\n这个指令可以得到的信息有 "用户名","全名","描述","组的成员","有效期","安全协议","身份验证方法",以及验证参数。\n要获得用户的名单,请使用 UserList 命令。\n此命令,在 VPN Bridge 中不会运行。\n此命令在集群虚拟 HUB 中不能运行。 -CMD_UserGet_Args UserGet [name] -CMD_UserGet_[name] 指定的用户名来获取信息。 -CMD_UserGet_Column_Name 用户名 -CMD_UserGet_Column_RealName 全名 -CMD_UserGet_Column_Note 描述 -CMD_UserGet_Column_Group 组名称 -CMD_UserGet_Column_Expires 有效期 -CMD_UserGet_Column_AuthType 验证方法 -CMD_UserGet_Column_UserCert 已注册的用户固有的证书 -CMD_UserGet_Column_RadiusAlias 外部认证服务器验证用户名 -CMD_UserGet_Column_RootCert_CN 证书的 CN 值得限定 -CMD_UserGet_Column_RootCert_SERIAL 证书的序列号的限定 -CMD_UserGet_Policy 该用户设定的安全协议 - - -# UserAnonymousSet 命令 -CMD_UserAnonymousSet 将用户身份验证方法设置为匿名验证 -CMD_UserAnonymousSet_Help 在虚拟 HUB 中的安全帐户数据库中注册用户的验证方法设定为 "匿名验证"。"匿名验证" 的用户连接到 VPN Client HUB 时,不会有任何用户认证即可以连接到 HUB。匿名身份验证设置适合那些公开的谁都可以连接的 VPN Server。\n要获得用户的名单,请使用 UserList 命令。\n此命令,在 VPN Bridge 中不会运行。\n此命令在集群虚拟 HUB 中不能运行。 -CMD_UserAnonymousSet_Args UserAnonymousSet [name] -CMD_UserAnonymousSet_[name] 指定用户名更改设置。 - - -# UserPasswordSet 命令 -CMD_UserPasswordSet 将用户身份验证方法设置为密码验证,并设定密码 -CMD_UserPasswordSet_Help 在虚拟 HUB 中的安全帐户数据库中注册用户的验证方法设定为 "密码验证" 所谓 "密码验证" 即所有安全帐户数据库中的用户都设置密码注册。当此用户连接虚拟 HUB 时,会提示输入密码,如果一致,则允许连接。\n事实上,由于用户的密码是经过处理以后保存的,因此即使分析原始材料,也不会分析出密码。\n要获得用户的名单,请使用 UserList 命令。\n此命令,在 VPN Bridge 中不会运行。\n此命令在集群虚拟 HUB 中不能运行。 -CMD_UserPasswordSet_Args UserPasswordSet [name] [/PASSWORD:password] -CMD_UserPasswordSet_[name] 指定用户名更改设置。 -CMD_UserPasswordSet_PASSWORD 指定用户的密码设置。如果您不指定此参数将被提示输入密码。 - - -# UserCertSet 命令 -CMD_UserCertSet 将用户身份验证方法设置为固有证书验证,并设定证书 -CMD_UserCertSet_Help 在虚拟 HUB 中的安全帐户数据库中注册用户的验证方法设定为 "固有证书验证" 所谓 "固有证书验证" 即所有安全帐户数据库中的用户都注册一个 X.509 证书。当此用户连接虚拟 HUB 时,提供的固有证书与登记证书一致,或持有对应证书的密钥,允许是通过验证实现连接。\n要获得用户的名单,请使用 UserList 命令。\n此命令,在 VPN Bridge 中不会运行。\n此命令在集群虚拟 HUB 中不能运行。 -CMD_UserCertSet_Args UserCertSet [name] [/LOADCERT:cert] -CMD_UserCertSet_[name] 指定的用户名更改设置。 -CMD_UserCertSet_LOADCERT 指定 X.509 证书文件名,这顶用户证书。 - - -# UserCertGet 命令 -CMD_UserCertGet 获取注册固有证书认证用户的证书 -CMD_UserCertGet_Help 在虚拟 HUB 中的安全帐户数据库中注册用户的 "固有证书认证" 的用户,取得用户的 X.509 证书,并保存。\n如果用户未指定 "固有证书认证",则会发生错误。\n要获得用户的名单,请使用 UserList 命令。\n此命令,在 VPN Bridge 中不会运行。\n此命令在集群虚拟 HUB 中不能运行。 -CMD_UserCertGet_Args UserCertGet [name] [/SAVECERT:cert] -CMD_UserCertGet_[name] 指定的用户名来检索信息。 -CMD_UserCertGet_SAVECERT 指定文件名来保存获取的用户的 X.509 证书。 -CMD_UserCertGet_Not_Cert 或者非固定证书认证,或者为设定为固有证书验证。 - - -# UserSignedSet 命令 -CMD_UserSignedSet 将用户身份验证方法设置为已签名证明书认证 -CMD_UserSignedSet_Help 将已注册在目前管理的虚拟 HUB 的安全帐户数据库的用户认证方法设定为已签名认证书认证。用户以已签名证明书认证的用户名链接虚拟 HUB 时,用户所提交的证明书会被验证是否为虚拟 HUB 认可的证明机构的证明书一览中任意证明书的签名,且客户是否持有与证书相应的密钥,用 RSA 算法验证可以链接的认证法。/n还可以设定成已注册用户希望的证明书的通用名 (CN) 及编号,只有通过了上述验证的证明书的内容与设定值一致的情况下才能许可链接。/n要取得目前注册用户一览,请使用用户名单指令。\n此指令,虚拟专用桥不能运行。 \n此指令令在群集内作为群集成员服务器操作的 VPN Server 的虚拟 HUB 上不能运行。 -CMD_UserSignedSet_Args UserSignedSet [name] [/CN:cn] [/SERIAL:serial] -CMD_UserSignedSet_[name] 指定更改设定的用户名 -CMD_UserSignedSet_CN 如果指定此参数,在验证了用户提交的证明书是否由可信赖的证明机构签名后,该证明书的通用名 (CN) 的值,与根据此参数设定的值相比较,只有取得一致的情况下才允许链接。指定 "none" 的情况下不进行确认。 -CMD_UserSignedSet_SERIAL 如果指定此参数,在验证了用户提交的证明书是否由可信赖的证明机构签名后,该证明书的序列号的值,与根据此参数设定的值相比较,只有取得一致的情况下才允许链接。指定 "none" 的情况下不进行确认。 -CMD_UserSignedSet_Prompt_CN 限定通用名 (CN) 的值 -CMD_UserSignedSet_Prompt_SERIAL 限定编号的值 - - -# UserRadiusSet 命令 -CMD_UserRadiusSet 将用户的认证方法设定为半径认证 -CMD_UserRadiusSet_Help 将在目前管理的虚拟 HUB 的安全帐户数据库上注册的用户认证方法设置为 "半径认证"。用户以被半径认证设置的用户名连接虚拟 HUB 时,用户名和用户输入的密码被发送到半径服务器,半径服务器检查用户名和密码后,如过该认证成功,用户被允许 VPN 连接。\n要使用半径认证,需要事先使用 RadiusServerSet 指令把要使用的半径服务器设置为虚拟 HUB。\n要获得目前注册的用户列表,请使用 UserList 指令。\n此指令,虚拟专用桥不能运行。\n此指令令在群集内作为群集成员服务器操作的 VPN Server 的虚拟 HUB 上不能运行。 -CMD_UserRadiusSet_Args UserRadiusSet [name] [/ALIAS:alias_name] -CMD_UserRadiusSet_[name] 指定更改设定的用户名 -CMD_UserRadiusSet_ALIAS 如果此参数被设置,可以使对半径服务器发送的用户名与虚拟 HUB 上的用户名是不同的。如果没有设置,请指定为 /ALIAS:none (使用虚拟 HUB 上的用户名)。用户名是 "*" 的情况下 /ALIAS 参数被忽略。关于 "*" 用户的描述,输入 UserCreate /HELP 可显示。 -CMD_UserRadiusSet_Prompt_ALIAS 验证用别名 (可选) - - -# UserNTLMSet 命令 -CMD_UserNTLMSet 用户身份验证方法设置为 NT 域认证 -CMD_UserNTLMSet_Help 将在目前管理的虚拟 HUB 的安全帐户数据库上注册的用户认证方法设置为 "NT 域验证"。用户以被 NT 域认证设置的用户名连接虚拟 HUB 时,用户名和用户输入的密码被发送到 Windows NT / 2000 / Server 2003 / Server 2008 域控制器或 Active Directory 服务器,认证服务器检查用户名和密码后,如果认证成功后,该用户的 VPN 连接被允许。要使用 NT 域认证,VPN Server 不要在连接到该域的 Windows NT 4.0,Windows 2000,Windows XP,Windows Server 2003 和 Windows Server 2008 的任何操作系统上运行。详情,请与 VPN Server 管理员咨询。\n要获得目前注册的用户列表,请使用 UserList 指令。\n此指令,虚拟专用桥不能运行。\n此指令令在群集内作为群集成员服务器操作的 VPN Server 的虚拟 HUB 上不能运行。 -CMD_UserNTLMSet_Args UserNTLMSet [name] [/ALIAS:alias_name] -CMD_UserNTLMSet_[name] 指定更改设定的用户名 -CMD_UserNTLMSet_ALIAS 如果此参数被设置,可以使对 NT 域或 Active Directory 发送的用户名与虚拟 HUB 上的用户名不同。如果没有设置,请指定 /ALIAS:none (使用虚拟 HUB 上的用户名)。用户名是 "*" 的情况下 /ALIAS 参数被忽略。关于 "*" 用户的描述,输入 UserCreate /HELP 可显示。 - - -# UserPolicyRemove 命令 -CMD_UserPolicyRemove 删除用户的安全策略 -CMD_UserPolicyRemove_Help 删除在目前管理的虚拟 HUB 的安全帐户数据库上已注册的用户设置的安全策略设置。被删除安全策略设置的用户,适用该用户所属的组的安全策略设置。如果不属于任何组,或改组没有设置安全策略,则遵从默认值 (允许访问: 启用,TCP连接数最大值: 32 个,超时时间: 20 秒)。\n要获得目前注册的用户列表,请使用 UserList 命令。\n此指令,虚拟专用桥不能运行。 \n此指令令在群集内作为群集成员服务器操作的 VPN Server 的虚拟 HUB 上不能运行。 -CMD_UserPolicyRemove_Args UserPolicyRemove [name] -CMD_UserPolicyRemove_[name] 指定更改设定的用户名 - - -# UserPolicySet 命令 -CMD_UserPolicySet 设置用户的安全策略 -CMD_UserPolicySet_Help 变更在目前管理的虚拟 HUB 的安全帐户数据库上已注册的用户设置的安全策略内容。\n当用户未设置安全策略时,设置新的默认安全策略后,更改被指定的值。\n要获得当前已注册的用户列表,请使用 UserList 指令。\n此指令,虚拟专用桥不能运行。\n此指令令在群集内作为群集成员服务器操作的 VPN Server 的虚拟 HUB 上不能运行。 -CMD_UserPolicySet_Args UserPolicySet [name] [/NAME:policy_name] [/VALUE:num|yes|no] -CMD_UserPolicySet_[name] 指定更改设定的用户名 -CMD_UserPolicySet_NAME 指定要变更值的策略的名称。您可以使用 PolicyList 命令显示策略名称和可设定值的列表。 -CMD_UserPolicySet_VALUE 指定策略的新值。如果其策略是数值型,指定整数。如果是布尔型,指定 "yes" 或 "no"。可以设定的类型和值,可以使用 PolicyList 指令显示。 - - -# UserExpiresSet 命令 -CMD_UserExpiresSet 设置用户的有效期限 -CMD_UserExpiresSet_Help 设置在目前管理的虚拟 HUB 安全帐户数据库中注册的用户的有效期限。有效期限到期的用户不能连接虚拟 HUB。\n要获得当前已注册的用户列表,请使用 UserList 指令。\n此指令,虚拟专用桥不能运行。\n此指令令在群集内作为群集成员服务器操作的 VPN Server 的虚拟 HUB 上不能运行。 -CMD_UserExpiresSet_Args UserExpiresSet [name] [/EXPIRES:expires] -CMD_UserExpiresSet_[name] 指定更改设定的用户名 -CMD_UserExpiresSet_EXPIRES 指定用户有效期限的日期和时间。如 "2005/10/08 19:30:00",以 6 个整数指定年,月,日,时,分,秒,用斜线或冒号分隔。年指定为 4 位数。如果把空格加入到值中,需要把整个值用 "" 围住。可以指定本地时间 (计算机上的命令行管理工具运行的标准时间)。如果指定 /EXPIRES:none,可以解除有效期限。 -CMD_UserExpiresSet_Prompt_EXPIRES 用户的有效期限 (没有指定,即没有期限): - - -# GroupList 命令 -CMD_GroupList 获取组列表 -CMD_GroupList_Help 获取在目前管理的虚拟 HUB 的安全帐户数据库中注册的组列表。\n此命令用 VPN Bridge 不能运行。\n此命令在群集内作为群集成员服务器操作的 VPN Server 的虚拟 HUB 上不能运行。 -CMD_GroupList_Args GroupList - - -# GroupCreate 命令 -CMD_GroupCreate 创建组 -CMD_GroupCreate_Help 在目前管理的虚拟 HUB 安全帐户数据库内建立新组。\n在组内可以登记多个用户。要在组内注册用户,使用 GroupJoin 命令。\n此命令用 VPN Bridge 不能运行。\n此命令在群集内作为群集成员服务器操作的 VPN Server 的虚拟 HUB 上不能运行。 -CMD_GroupCreate_Args GroupCreate [name] [/REALNAME:realname] [/NOTE:note] -CMD_GroupCreate_[name] 指定要创建的组名。 -CMD_GroupCreate_REALNAME 指定该组的全名。例如,如果组对应于实际的部分或部门名称,指定其名称。如果不指定的情况下,请指定 /REALNAME:none。 -CMD_GroupCreate_NOTE 指定组的描述。如果不指定的情况下,请指定 /NOTE:none。 -CMD_GroupCreate_Prompt_NAME 组名称: -CMD_GroupCreate_Prompt_REALNAME 组的全名: -CMD_GroupCreate_Prompt_NOTE 组描述: - - -# GroupSet 命令 -CMD_GroupSet 设置组信息 -CMD_GroupSet_Help 设置在目前管理的虚拟 HUB 安全帐户数据库中注册的组信息。\n要获取当前已注册的组列表,请使用 GroupList 命令。\n此命令用 VPN Bridge 不能运行。\n此命令在群集内作为群集成员服务器操作的 VPN Server 的虚拟 HUB 上不能运行。 -CMD_GroupSet_Args GroupSet [name] [/REALNAME:realname] [/NOTE:note] -CMD_GroupSet_[name] 指定变更设定的组名。 -CMD_GroupSet_REALNAME 指定该组的全名。例如,如果组对应于实际的部分或部门名称,指定其名称。如果不指定的情况下,请指定 /REALNAME:none。 -CMD_GroupSet_NOTE 指定组的描述。如果不指定的情况下,请指定 /NOTE:none。 - - -# GroupDelete 命令 -CMD_GroupDelete 删除组 -CMD_GroupDelete_Help 删除目前管理的虚拟 HUB 安全帐户数据库中注册的组。\n一旦删除组,该组所属的所有用户将成为未分配的。\n要获取当前已注册的组列表,请使用 GroupList 命令。\n此命令不能运行的 VPN Bridge。\n您不能执行这个虚拟的 VPN 作为在群集成员服务器操作系统服务器花鼓命令。 -CMD_GroupDelete_Args GroupDelete [name] -CMD_GroupDelete_[name] 指定删除的组名。 - - -# GroupGet 命令 -CMD_GroupGet 获得组信息和所属用户列表 -CMD_GroupGet_Help 获取目前管理的虚拟 HUB 安全帐户数据库中注册的组信息和属于改组的用户列表。\n要获取当前已注册的组列表,请使用 GroupList 命令。\n此命令用 VPN Bridge 不能运行。\n此命令在群集内作为群集成员服务器操作的 VPN Server 的虚拟 HUB 上不能运行。 -CMD_GroupGet_Args GroupGet [name] -CMD_GroupGet_[name] 指定获得信息的组名。 -CMD_GroupGet_Column_NAME 组名 -CMD_GroupGet_Column_REALNAME 全名 -CMD_GroupGet_Column_NOTE 描述 -CMD_GroupGet_Column_POLICY 这个组所设定的安全测略 -CMD_GroupGet_Column_MEMBERS 属于这个组的用户名列表 - - -# GroupJoin 命令 -CMD_GroupJoin 用户添加到组 -CMD_GroupJoin_Help 在目前管理的虚拟 HUB 的安全帐户数据库注册的组内,添加安全帐户数据库内的用户。\n目前注册的用户和组的列表,可使用 UserList 命令和 GroupList 命令获取。\n此命令用 VPN Bridge 不能运行。\n此命令在群集内作为群集成员服务器操作的 VPN Server 的虚拟 HUB 上不能运行。 -CMD_GroupJoin_Args GroupJoin [name] [/USERNAME:username] -CMD_GroupJoin_[name] 指定要添加用户的组名。 -CMD_GroupJoin_USERNAME 指定往以 name 指定了的组添加的用户名。 -CMD_GroupJoin_Prompt_USERNAME 要加入组的用户名: - - -# GroupUnjoin 命令 -CMD_GroupUnjoin 从组内删除用户 -CMD_GroupUnjoin_Help 从目前管理的虚拟 HUB 安全帐户数据库注册的组中,删除指定用户。用户一旦从组中被删除,该用户成为未分配。\n要获取当前组的用户列表,使用 GroupGet 命令。\n要获取当前已注册的组列表,使用 GroupList 命令。\n此命令用 VPN Bridge 不能运行。\n此命令在群集内作为群集成员服务器操作的 VPN Server 的虚拟 HUB 上不能运行。 -CMD_GroupUnjoin_Args GroupUnjoin [name] -CMD_GroupUnjoin_[name] 指定要从组内删除的用户名。 -CMD_GroupUnjoin_Prompt_name 要从组内删除的用户名: - - -# GroupPolicyRemove 命令 -CMD_GroupPolicyRemove 删除组的安全策略 -CMD_GroupPolicyRemove_Help 对在目前管理的虚拟 HUB 的安全帐户数据胡中注册的组,删除其被设置的安全策略的设置。对所属的组及用户本身没有被设置安全策略的用户,遵照默认值 (允许访问: 启用,TCP 连接数的最大值: 32 个,超时时间: 20 秒)。\n要获得当前已注册的组列表,使用 GroupList 命令。\n此命令用 VPN Bridge 不能运行。\n此命令在群集内作为群集成员服务器操作的 VPN Server 的虚拟 HUB 上不能运行。 -CMD_GroupPolicyRemove_Args GroupPolicyRemove [name] -CMD_GroupPolicyRemove_[name] 指定变更设定的组名。 - - -# GroupPolicySet 命令 -CMD_GroupPolicySet 设置组的安全策略 -CMD_GroupPolicySet_Help 对在目前管理的虚拟 HUB 的安全帐户数据胡中注册的组,更改其被设置的安全策略的设置。\n如组尚未设置安全策略,新的默认安全策略设置后,更改被指定的值。\n要获得当前已注册的组列表,使用 GroupList 命令。\n此命令用 VPN Bridge 不能运行。\n此命令在群集内作为群集成员服务器操作的 VPN Server 的虚拟 HUB 上不能运行。 -CMD_GroupPolicySet_Args GroupPolicySet [name] [/NAME:policy_name] [/VALUE:num|yes|no] -CMD_GroupPolicySet_[name] 指定变更设定的组名。 -CMD_GroupPolicySet_NAME 指定要更改其值的策略名称。您可以使用 PolicyList 命令显示的策略名称和可以设置值的列表。 -CMD_GroupPolicySet_VALUE 指定一个新的策略值。如果策略是数值型的情况下,指定一个整数。如果是布尔型的情况下,指定 "yes" 或 "no"。可以设定类型和值,可以使用 PolicyList 指令显示。 - - -# SessionList 命令 -CMD_SessionList 获取连接会话的列表 -CMD_SessionList_Help 获取目前管理的与虚拟 HUB 连接中的的会话列表。在会话列表中,以下信息将显示为每个连接: [会话名称],[会话场所],[用户名],[连接源主机名称],[TCP 连接],[传输字节数] 和 [传输数据包数]。\n如果当前连接的 VPN Server 是群集控制器,管理的虚拟 HUB 是静态的虚拟 HUB,可以得到连接其所有的集群成员的该虚拟 HUB 的会话列表的结合。\n在其他情况下,只能获取与目前管理的 VPN Server 实际连接着的会话列表。 -CMD_SessionList_Args SessionList - - -# SessionGet 命令 -CMD_SessionGet 获取会话信息 -CMD_SessionGet_Help 指定与当目前管理的虚拟 HUB 连接着的会话,并获得其会话信息。会话信息包括以下内容: 连接源主机名和用户名,版本信息,时间信息,TCP 连接数,通讯参数,会话密钥,输入输出的数据统计资料,和其他客户端和服务器信息等。\n要获得当前连接的会话列表,请使用 SessionList 命令。 -CMD_SessionGet_Args SessionGet [name] -CMD_SessionGet_[name] 指定要获取信息的会话名称。 -CMD_SessionGet_Prompt_NAME 会话名称: - - -# SessionDisconnect 命令 -CMD_SessionDisconnect 断开会话 -CMD_SessionDisconnect_Help 指定连接到目前管理的虚拟 HUB 的会话,管理员权限以强制断开其会话。\n但是,终端的客户端的设置为通信断开后的自动启动重新连接会话的情况下,可能客户端会重新连接。\n要获得当前连接会话列表,请使用 SessionList 命令。 -CMD_SessionDisconnect_Args SessionDisconnect [name] -CMD_SessionDisconnect_[name] 指定要断开的会话名称。 - - -# MacTable 命令 -CMD_MacTable 获取 MAC 地址表数据库 -CMD_MacTable_Help 获取当前管理的虚拟 HUB 保持的 MAC 地址表的数据库。\nMAC 地址表数据库是虚拟 HUB 需要进行交换以太网帧的平台,虚拟 HUB 基于 MAC 地址表的数据库,决定各个以太网帧排序目标会话。MAC 地址数据库自动分析创建虚拟 HUB 流动的通信内容。\n指定的会话名称,可以得到与该会话有关的 MAC 地址表项。 -CMD_MacTable_Args MacTable [session_name] -CMD_MacTable_[session_name] 如果指定作为参数的会话名称,可以只显示与该会话相关联的 MAC 地址表项。如果不指定,则显示所有的项。 - - -# MacDelete 命令 -CMD_MacDelete 删除 MAC 地址表项 -CMD_MacDelete_Help 操作目前管理的虚拟 HUB 保持的 MAC 地址表数据库,从数据库中删除指定的 MAC 地址项。\n要获取目前的 MAC 地址表数据库的内容,请使用 MacTable 命令。 -CMD_MacDelete_Args MacDelete [id] -CMD_MacDelete_[id] 指定要删除的 MAC 地址表项的 ID。 -CMD_MacDelete_Prompt 要删除的 ID: - - -# IpTable 命令 -CMD_IpTable 获取 IP 地址表数据库 -CMD_IpTable_Help 目前管理的虚拟 HUB 保持的 IP 地址表的数据库。\nIP 地址表数据库是一个自动分析生成通信内容的平台,为使虚拟 HUB 能够掌握哪个会话使用的是哪个 IP 地址,这是经常被使用的虚拟 HUB 安全策略的引擎。\n指定的会话名称,可以获取与该会话相关联的 IP 地址表项。 -CMD_IpTable_Args IpTable [session_name] -CMD_IpTable_[session_name] 指定作为参数的会话名称,可以只显示与该会话相关联的 IP 地址表项。如果不指定,则显示所有的项。 - - -# IpDelete 命令 -CMD_IpDelete 删除 IP 地址表项 -CMD_IpDelete_Help 操作目前管理的虚拟 HUB 保持的 IP 地址表数据库,从数据库中删除指定的 IP 地址项。\n要获取目前的 IP 地址表数据库的内容,请使用 IpTable 命令。 -CMD_IpDelete_Args IpDelete [id] -CMD_IpDelete_[id] 指定要删除的 IP 地址表项的 ID。 - - -# SecureNatEnable 命令 -CMD_SecureNatEnable 启用虚拟 NAT 和 DHCP 服务器功能 (安全网络功能) -CMD_SecureNatEnable_Help 使在目前管理的虚拟 HUB 内启动并运行虚拟 NAT 和 DHCP 服务器功能 (安全网络功能)。执行此指令前,必须先使用 SecureNatHostGet 指令,NatGet 指令和 DhcpGet 指令检查当前虚拟 NAT 功能和 DHCP 服务器的设置内容。\n一旦启用安全网络的功能,可以在虚拟 HUB 的虚拟网络上使 NAT 路由器 (IP 伪装) 和 DHCP 服务器功能虚拟性的运行。\n\n[有关安全网络功能的警告]\n安全网络的功能是面向系统管理员和对具备有关网络的丰富知识的人的功能。\n如果正确使用安全网络功能,可能实现通过 VPN 的安全的远程访问。但是如果错误地使用,可能使整个网络处于危险状态。如果不具备全面的的网络知识,没有得到网络管理员许可的情况下,请禁用安全网络功能。关于安全网络功能的详细说明,请参阅 VPN Server 的手册和在线文档。\n此命令在群集内作为群集成员服务器操作的 VPN Server 的虚拟 HUB 上不能运行。 -CMD_SecureNatEnable_Args SecureNatEnable - - -# SecureNatDisable 命令 -CMD_SecureNatDisable 禁用虚拟 NAT 和 DHCP 服务器功能 (安全网络功能) -CMD_SecureNatDisable_Help 在当前管理的虚拟 HUB 内禁用虚拟 NAT 和 DHCP 服务器功能 (安全网络功能)。一旦执行该命令,虚拟 NAT 功能立即停止,虚拟 DHCP 服务器功能则删除持有的 DHCP 租赁数据并停止该服务。\n该指令在作为进群操作的 VPN Server 的虚拟服务器上不能执行。 -CMD_SecureNatDisable_Args SecureNatDisable - - -# SecureNatStatusGet 命令 -CMD_SecureNatStatusGet 获取虚拟 NAT 和 DHCP 服务器功能 (安全网络功能) 的工作状态 -CMD_SecureNatStatusGet_Help 如果在目前管理的虚拟 HUB 内操作虚拟 NAT 和 DHCP 服务器功能 (安全网络功能),获得其操作状态。 \n该指令在作为进群操作的 VPN Server 的虚拟服务器上不能执行。 -CMD_SecureNatStatusGet_Args SecureNatStatusGet - - -# SecureNatHostGet 命令 -CMD_SecureNatHostGet 获取安全网络功能的虚拟主机的网络接口设置 -CMD_SecureNatHostGet_Help 在当前管理的虚拟 HUB 内获取虚拟 NAT 和 DHCP 服务器功能 (安全网络功能) 中的虚拟主机的网络接口设置。\n安全网络功能有一枚在虚拟 HUB 内二级市场中的虚拟 LAN 卡,它被赋予了 MAC 地址和 IP 地址。这样,连接到同一个二级市场的其他主机,能够如存在于网络的真实 IP 主机般与安全网络的虚拟主机通信。\n\n[有关安全网络功能的警告]\n安全网络的功能是面向系统管理员和对具备有关网络的丰富知识的人的功能。\n如果正确使用安全网络功能,可能实现通过 VPN 的安全的远程访问。但是如果错误地使用,可能使整个网络处于危险状态。如果不具备全面的的网络知识,没有得到网络管理员许可的情况下,请禁用安全网络功能。关于安全网络功能的详细说明,请参阅 VPN Server 的手册和在线文档。\n此命令在群集内作为群集成员服务器操作的 VPN Server 的虚拟 HUB 上不能运行。 -CMD_SecureNatHostGet_Args SecureNatHostGet -CMD_SecureNatHostGet_Column_MAC MAC 地址 -CMD_SecureNatHostGet_Column_IP IP 地址 -CMD_SecureNatHostGet_Column_MASK 子网掩码 -CMD_SecureNatHostGet_Column_LOG 保存 NAT 和 DHCP 操作日志 - - -# SecureNatHostSet 命令 -CMD_SecureNatHostSet 更改安全网络功能的虚拟主机的网络接口设置 -CMD_SecureNatHostSet_Help 当前管理的虚拟 HUB 内,更改和保存虚拟 NAT 和 DHCP 服务器功能 (安全网络功能) 的设置项目中的虚拟主机网络接口设置。\n安全网络功能有一枚在虚拟 HUB 内二级市场中的虚拟 LAN 卡,它被赋予了 MAC 地址和 IP 地址。这样,连接到同一个二级市场的其他主机,能够如存在于网络的真实 IP 主机般与安全网络的虚拟主机通信。\n\n[有关安全网络功能的警告]\n安全网络的功能是面向系统管理员和对具备有关网络的丰富知识的人的功能。\n如果正确使用安全网络功能,可能实现通过 VPN 的安全的远程访问。但是如果错误地使用,可能使整个网络处于危险状态。如果不具备全面的的网络知识,没有得到网络管理员许可的情况下,请禁用安全网络功能。关于安全网络功能的详细说明,请参阅 VPN Server 的手册和在线文档。\n此命令在群集内作为群集成员服务器操作的 VPN Server 的虚拟 HUB 上不能运行。 -CMD_SecureNatHostSet_Args SecureNatHostSet [/MAC:mac] [/IP:ip] [/MASK:mask] -CMD_SecureNatHostSet_MAC 指定分配到虚拟接口的 MAC 地址。MAC 地址用诸如 "00-AC-01-23-45-67" 的字符串指定。一但指定 /MAC:none,则不更改将当前的设置。 -CMD_SecureNatHostSet_IP 指定分配到虚拟接口的 IP 地址。一但指定 /IP:none,则不更改将当前的设置。 -CMD_SecureNatHostSet_MASK 指定分配到虚拟接口的子网掩码。一但指定 /MASK:none,则不更改将当前的设置。 -CMD_SecureNatHostSet_Prompt_MAC MAC 地址: -CMD_SecureNatHostSet_Prompt_IP IP 地址: -CMD_SecureNatHostSet_Prompt_MASK 子网掩码: - - -# NatGet 命令 -CMD_NatGet 获得安全网络功能的虚拟 NAT 功能的设置 -CMD_NatGet_Help 在当前管理的虚拟 HUB 内,获得虚拟 NAT 和 DHCP 服务器功能 (安全网络功能) 的设置项目中的虚 NAT 设置。\n该指令在作为进群操作的 VPN Server 的虚拟服务器上不能执行。 -CMD_NatGet_Args NatGet -CMD_NatGet_Column_USE 使用虚拟 NAT 功能 -CMD_NetGet_Column_MTU MTU 值 -CMD_NatGet_Column_TCP TCP 会话超时 (秒) -CMD_NatGet_Column_UDP UDP 会话超时 (秒) - - -# NatEnable 命令 -CMD_NatEnable 启用安全网络功能的虚拟 NAT 功能 -CMD_NatEnable_Help 在目前管理的虚拟 HUB 内启用虚拟 NAT 功能。\n如果使用此指令启动虚拟 NAT 功能,但 SecureNAT 功能没有工作时,则虚拟的 NAT 不工作。要启动 SecureNAT 功能的工作,使用 SecureNatEnable 命令。\n该指令在作为进群操作的 VPN Server 的虚拟服务器上不能执行。 -CMD_NatEnable_Args NatEnable - - -# NatDisable 命令 -CMD_NatDisable 禁用安全网络功能的虚拟 NAT 功能 -CMD_NatDisable_Help 在目前管理的虚拟 HUB 内禁用虚拟 NAT 功能。\n该指令在作为进群操作的 VPN Server 的虚拟服务器上不能执行。 -CMD_NatDisable_Args NatDisable - - -# NatSet 命令 -CMD_NatSet 更改安全网络功能的虚拟 NAT 功能的设置 -CMD_NatSet_Help 更改目前管理的虚拟 HUB 内的虚拟的 NAT 设置。虚拟的 NAT 设置的内容包括: MTU 值,TCP 会话超时,UDP 会话超时。\n该指令在作为进群操作的 VPN Server 的虚拟服务器上不能执行。 -CMD_NatSet_Args NatSet [/MTU:mtu] [/TCPTIMEOUT:tcp_timeout] [/UDPTIMEOUT:udp_timeout] [/LOG:yes|no] -CMD_NatSet_MTU 用字节数单位的整数设置 MTU (最大可转让单位的大小)。此值是不包括虚拟 NAT 发送的以太网帧的 MAC 头最大有效载荷长度,默认值是 1500 字节。 -CMD_NatSet_TCPTIMEOUT 设置虚拟 NAT 中转 TCP 会话时如果持续多少秒非通信状态即超时并丢弃会话。 -CMD_NatSet_UDPTIMEOUT 设置虚拟 NAT 中转 UDP 会话时如果持续多少秒非通信状态即超时并丢弃会话。 -CMD_NatSet_LOG 指定是否将虚拟 NAT 的操作保存在虚拟 HUB 安全日志。指定 "yes" 即保存它,指定 "no" 即不保存。 -CMD_NatSet_Prompt_MTU MTU 值: -CMD_NatSet_Prompt_TCPTIMEOUT TCP 会话超时 (秒): -CMD_NatSet_Prompt_UDPTIMEOUT UDP 会话超时 (秒): -CMD_NatSet_Prompt_LOG 保存日志 (yes/no): -CMD_NatSet_Eval_MTU 请在从 %d 到 %d 之间设定 MTU 值。 -CMD_NatSet_Eval_TCP 请在从 %d 到 %d 之间设定 TCP 会话超时秒数。 -CMD_NatSet_Eval_UDP 请在从 %d 到 %d 之间设定 UDP 会话超时秒数。 - - -# NatTable 命令 -CMD_NatTable 获得安全网络功能的虚拟 NAT 功能会话表 -CMD_NatTable_Help 虚拟 NAT 功能在目前管理的虚拟 HUB 内运作时,经由虚拟 NAT 获取目前通信中的 TCP 及 UDP 会话表 (NAT 表)。\n该指令在作为进群操作的 VPN Server 的虚拟服务器上不能执行。 -CMD_NatTable_Args NatTable - - -# DhcpGet 命令 -CMD_DhcpGet 获得安全网络功能的虚拟 DHCP 服务器功能的设置 -CMD_DhcpGet_Help 在当前管理的虚拟 HUB 内获取虚拟 NAT 和 DHCP 服务器功能 (安全网络功能) 的设置项目中的虚拟 DHCP 服务器设置。\n该指令在作为进群操作的 VPN Server 的虚拟服务器上不能执行。 -CMD_DhcpGet_Args DhcpGet -CMD_DhcpGet_Column_Log NAT 和 DHCP 的操作日志记录 -CMD_DhcpGet_Column_USE 使用虚拟 DHCP 功能 -CMD_DhcpGet_Column_IP1 分发地址范围的开始 -CMD_DhcpGet_Column_IP2 分发地址范围的结束 -CMD_DhcpGet_Column_MASK 子网掩码 -CMD_DhcpGet_Column_LEASE 租赁期限 (秒) -CMD_DhcpGet_Column_GW 默认网关地址 -CMD_DhcpGet_Column_DNS DNS 服务器地址 1 -CMD_DhcpGet_Column_DNS2 DNS 服务器地址 2 -CMD_DhcpGet_Column_DOMAIN 域名 -CMD_DhcpGet_Column_PUSHROUTE 静态路由表推送 - - -# DhcpEnable 命令 -CMD_DhcpEnable 启动安全网络功能的虚拟 DHCP 服务器功能 -CMD_DhcpEnable_Help 在当前管理的虚拟 HUB 内启动虚拟 DHCP 服务器功能。如果使用此指令启动虚拟 DHCP 服务器功能但 SecureNAT 功能不工作的情况下,则虚拟 DHCP 服务器不工作。要启动 SecureNAT 功能,使用 SecureNatEnable 指令。\n该指令在作为进群操作的 VPN Server 的虚拟服务器上不能执行。 -CMD_DhcpEnable_Args DhcpEnable - - -# DhcpDisable 命令 -CMD_DhcpDisable 禁用安全网络功能的虚拟 DHCP 服务器功能 -CMD_DhcpDisable_Help 在目前管理的虚拟 HUB 内禁用 DHCP 服务器。\n该指令在作为进群操作的 VPN Server 的虚拟服务器上不能执行。 -CMD_DhcpDisable_Args DhcpDisable - - -# DhcpSet 命令 -CMD_DhcpSet 更改安全网络功能的虚拟 DHCP 服务器功能的设置 -CMD_DhcpSet_Help 在现在管理的虚拟 HUB 内,更改虚拟 DHCP 服务器的设置。虚拟 DHCP 服务器设置包括: 分配 IP 地址范围,子网掩码,出租期限,及分配给客户端的选项值。\n该指令在作为进群操作的 VPN Server 的虚拟服务器上不能执行。 -CMD_DhcpSet_Args DhcpSet [/START:start_ip] [/END:end_ip] [/MASK:subnetmask] [/EXPIRE:sec] [/GW:gwip] [/DNS:dns] [/DNS2:dns2] [/DOMAIN:domain] [/LOG:yes|no] [/PUSHROUTE:"routing_table"] -CMD_DhcpSet_START 指定地址范围的开始点,以分发给客户。(例如: 192.168.30.10) -CMD_DhcpSet_END 指定地址范围的结束点,以分发给客户。(例如: 192.168.30.200) -CMD_DhcpSet_MASK 指定对客户指定的子网掩码。(例如: 255.255.255.0) -CMD_DhcpSet_EXPIRE 以秒为单位对客户指定租赁 IP 地址时的有效期限 -CMD_DhcpSet_GW 指定要通知给客户端的默认网关的 IP 地址。如果要与安全网络功能的虚拟 NAT 功能一起启动并使用时,可以指定安全网络的虚拟主机的 IP 地址。如果指定 "0" 或 "none",则不将默认网关通知客户。 -CMD_DhcpSet_DNS 指定被通知到客户端的主 DNS 服务器的 IP 地址。当 SecureNAT 功能的虚拟 NAT 功能已经启用并正在运行时,您可以为此指定一个 SecureNAT 虚拟主机 IP 地址。如果您指定的是 0 或者 none,那么客户端就不会被 DNS 服务器地址通知。 -CMD_DhcpSet_DNS2 指定被通知到客户端的次要 DNS 服务器 IP 地址。当 SecureNAT 功能的虚拟 NAT 功能已经启用并正在运行时,您可以为此指定一个 SecureNAT 虚拟主机 IP 地址。如果您指定的是 0 或者 none,那么客户端就不会被 DNS 服务器地址通知。 -CMD_DhcpSet_DOMAIN 指定域名通知客户。如果指定 none,该域名不通知客户。 -CMD_DhcpSet_LOG 指定是否将虚拟 DHCP 服务器运行保存为安全日志。指定 "yes" 则保存。此值与虚拟 NAT 功能的日志保存设置是联动的。 -CMD_DhcpSet_PUSHROUTE 指定静态路由表推送。\n例如: "192.168.5.0/255.255.255.0/192.168.4.254, 10.0.0.0/255.0.0.0/192.168.4.253"\n用逗号或空格字符来拆分多条目 (最多 64 条目)。每个条目必须以 "IP 网络地址/子网掩码/网关 IP 地址" 的格式来指定。 \n这个虚拟 DHCP 服务器可以推送带DHCP应答消息的无类静态路由 (RFC 3442) 至 VPN 客户端。\nVPN 客户端是否能够识别无类静态路由 (RFC 3442) 取决于目标VPN客户端软件。SoftEther VPN 客户端和 OpenVPN 客户端都支持无类静态路由。在 L2TP/IPSec 和 MS-SSTP 协议上,兼容性取决于客户端软件的实施。如果你清除了虚拟 DHCP 服务器选项的默认网关字段,您就可以实现拆分隧道。在客户端一侧,为了使用拆分隧道,L2TP/IPSec 和 MS-SSTP 客户端需要配置为不创建默认网关。\n您还可以通过现有的外部 DHCP 服务器推送无类静态路由 (RFC 3442)。在这种情况下,在 SecureNAT 禁用虚拟 DHCP 服务器功能,在这一屏幕上你不需要设置无类路由。\n请参阅 RFC 3442 以了解无类路由。 -CMD_DhcpSet_Prompt_START 分发地址范围的开始: -CMD_DhcpSet_Prompt_END 分发地址范围的结束: -CMD_DhcpSet_Prompt_MASK 子网掩码: -CMD_DhcpSet_Prompt_EXPIRE 租赁期限 (补): -CMD_DhcpSet_Prompt_GW 默认网关 (可以不设定): -CMD_DhcpSet_Prompt_DNS DNS 服务器 1 (可以不设定): -CMD_DhcpSet_Prompt_DNS2 DNS 服务器 2 (可以不设定): -CMD_DhcpSet_Prompt_DOMAIN 域名: - - -# DhcpTable 命令 -CMD_DhcpTable 获取安全网络功能的虚拟 DHCP 服务器租约表格 -CMD_DhcpTable_Help 在目前管理的虚拟 HUB 内操作 DHCP 服务器功能时,获取分配到 DHCP 服务器持有的客户端的 IP 地址租约表。\n该指令在作为进群操作的 VPN Server 的虚拟服务器上不能执行。 -CMD_DhcpTable_Args DhcpTable - - -# AdminOptionList 命令 -CMD_AdminOptionList 获取虚拟 HUB 管理选项列表 -CMD_AdminOptionList_Help 获取目前管理的虚拟 HUB 设置的虚拟 HUB 管理选项列表。\nVPN Server 的管理员委托各个虚拟 HUB 的管理员对虚拟 HUB 进行管理时,为限制其设置范围,使用虚拟 HUB 管理选项。\n能够对虚拟 HUB 管理选项进行添加,编辑,删除的,只有掌握着此 VPN Server 全部管理权限的管理员。虚拟 HUB 的管理员可以显示管理选项,但不能更改。\n然而,allow_hub_admin_change_option 设置为 1 时,虚拟 HUB 的管理员也可以编辑管理选项。\n此命令用 VPN Bridge 不能运行。\n此命令在群集内作为群集成员服务器操作的 VPN Server 的虚拟 HUB 上不能运行。 -CMD_AdminOptionList_Args AdminOptionList - - -# AdminOptionSet 命令 -CMD_AdminOptionSet 设置虚拟 HUB 管理选项的价值 -CMD_AdminOptionSet_Help 变更目前管理的虚拟 HUB 设置的虚拟 HUB 管理选项的值。\nVPN Server 的管理员委托各个虚拟 HUB 的管理员对虚拟 HUB 进行管理时,为限制其设置范围,使用虚拟 HUB 管理选项。\n能够对虚拟 HUB 管理选项进行添加,编辑,删除的,只有掌握着此 VPN Server 全部管理权限的管理员。虚拟 HUB 的管理员可以显示管理选项,但不能更改。\n然而,allow_hub_admin_change_option 设置为 1 时,虚拟 HUB 的管理员也可以编辑管理选项。\n此命令用 VPN Bridge 不能运行。\n此命令在群集内作为群集成员服务器操作的 VPN Server 的虚拟 HUB 上不能运行。 -CMD_AdminOptionSet_Args AdminOptionSet [name] [/VALUE:value] -CMD_AdminOptionSet_[name] 指定更改值的管理选项名。以 AdminOptionList 指令可以获取名单。 -CMD_AdminOptionSet_VALUE 以整数指定要设定的值。 -CMD_AdminOptionSet_Prompt_name 要更改值的管理选项名称: -CMD_AdminOptionSet_Prompt_VALUE 设定值 (整数): - - -# ExtOptionList 命令 -CMD_ExtOptionList 获取虚拟 HUB 扩展选项列表 -CMD_ExtOptionList_Help 获取目前管理的虚拟 HUB 设置的虚拟 HUB 扩展选项列表。\n虚拟 HUB 扩展选项使你可以对虚拟 HUB 进行更多的配置。\默认情况下,VPN Server 的全球管理员和个人虚拟 HUB 的管理员都可以修改虚拟 HUB 扩展选项。\n但是,如果虚拟 HUB 管理选项 deny_hub_admin_change_ext_option 被设置为 1,个人虚拟 HUB 管理员就不能修改虚拟 HUB 扩展选项。\n此命令不能在 VPN Bridge 上运行。\n以集群成员运行的 VPN Server 的虚拟 HUB 不能执行此命令。 -CMD_ExtOptionList_Args ExtOptionList - - -# ExtOptionSet 命令 -CMD_ExtOptionSet 设置虚拟 HUB 扩展选项的值 -CMD_ExtOptionSet_Help 使用此命令在当前管理的虚拟 HUB 的虚拟 HUB 扩展选项列表设置一个值。\n虚拟 HUB 扩展选项使你可以对虚拟 HUB 进行更多的配置。\默认情况下,VPN Server 的全球管理员和个人虚拟 HUB 的管理员都可以修改虚拟 HUB 扩展选项。\n但是,如果虚拟 HUB 管理选项 deny_hub_admin_change_ext_option 被设置为 1,个人虚拟 HUB 管理员就不能修改虚拟 HUB 扩展选项。\n此命令不能在 VPN Bridge 上运行。 \n以集群成员运行的 VPN Server 的虚拟 HUB 不能执行此命令。 -CMD_ExtOptionSet_Args ExtOptionSet [name] [/VALUE:value] -CMD_ExtOptionSet_[name] 指定您要更改其值的虚拟 HUB 扩展选项的名称。使用 ExtOptionList 命令,你可以得到一个名称列表。 -CMD_ExtOptionSet_VALUE 以整数指定要设定的值。 -CMD_ExtOptionSet_Prompt_name 要更改值的扩展选项名称: -CMD_ExtOptionSet_Prompt_VALUE 设定值 (整数): - - -# CrlList 命令 -CMD_CrlList 获取无效证书名单列表 -CMD_CrlList_Help 获取目前管理的虚拟 HUB 设置的无效证书名单列表。\n一旦证书注册到无效证书列表内,提交了其证书的客户,将不能用证书认证模式连接虚拟 HUB。\n通常情况下,因为泄漏密钥或证书持有人的权限失效时,将该证书作为无效证书注册到虚拟 HUB,而 VPN 客户欲使用该证书连接虚拟 HUB 时会被拒绝用户认证,这种情况下该功能被使用。\n此命令用 VPN Bridge 不能运行。\n此命令在群集内作为群集成员服务器操作的 VPN Server 的虚拟 HUB 上不能运行。 -CMD_CrlList_Args CrlList - - -# CrlAdd 命令 -CMD_CrlAdd 添加无效的证书 -CMD_CrlAdd_Help 在目前管理的虚拟 HUB 设置的无效的证书名单中添加新的无效证书的定义。\n用此指令的参数指定要注册到无效证书列表中的内容。用户用证书认证模式连接到虚拟 HUB 时,如果其证书与无效证书列表中注册的一条以上的内容一致,将拒绝该用户的连接。\n与此指令指定的参数定义的所有条件相一致的证书,会被判断为无效。\n可以设置该项目为:[名称 (CN)],[所属机构 (O)],[组织单位 (OU)],[国家 (C)],[州 (ST)],[现地 (L)],[序号 (十六进制)],[MD5 摘要值 (十六进制,128 位)],[SHA-1 摘要值 (十六进制,160位)]。摘要值 (哈希值) 的指定,是将证明书指定为事实上的唯一。通常情况下,如果输入 MD5 或 SHA-1摘要值,就不用输入其他项目。\n此命令用 VPN Bridge 不能运行。\n此命令在群集内作为群集成员服务器操作的 VPN Server 的虚拟 HUB 上不能运行。 -CMD_CrlAdd_Args CrlAdd [/SERIAL:serial] [/MD5:md5] [/SHA1:sha1] [/CN:cn] [/O:o] [/OU:ou] [/C:c] [/ST:st] [/L:l] -CMD_CrlAdd_SERIAL 作为条件,在设定证书的序列号 (16 进制) 时,以此此参数指定其值。 -CMD_CrlAdd_MD5 作为条件,在设定证书的 MD5 摘要值 (十六进制,128 位) 时,以此参数指定其值。如果不指定 16 进制 32 个字符 (16 字节) 的参数,则被忽略。 -CMD_CrlAdd_SHA1 作为条件,在设定证书的 SHA-1 摘要值的条件 (十六进制,160 位) 时,以此参数指定其值。如不指定十六进制 40 个字符 (20 字节) 的参数,则被忽略。 -CMD_CrlAdd_CN 作为条件,指定证书的名称 (CN) 时,以此参数设定其值。 -CMD_CrlAdd_O 作为条件,指定证书的所属机构 (O) 时,以此参数设定其值。 -CMD_CrlAdd_OU 作为条件,指定证书的组织单位 (OU) 时,以此参数设定其值。 -CMD_CrlAdd_C 作为条件,指定证书的国家 (C) 时,以此参数设定其值。 -CMD_CrlAdd_ST 作为条件,指定证书的州 (ST) 时,以此参数设定其值。 -CMD_CrlAdd_L 作为条件,指定证书的当地 (L) 时,以此参数设定其值。 - - -# CrlDel 命令 -CMD_CrlDel 删除无效的证书 -CMD_CrlDel_Help 从目前管理的虚拟 HUB设置的无效证书名单中指定并删除无效证书的定义。\n目前注册的无效证书的定义列表,可用 CrlList 指令获取。\n该指令虚拟专用桥不能运行。 \n该指令在作为进群操作的 VPN Server 的虚拟服务器上不能执行。 -CMD_CrlDel_Args CrlDel [id] -CMD_CrlDel_[id] 指定要删除的无效的证书的定义中的 ID。 -CMD_CrlDel_Prompt_ID 删除 ID: - - -# CrlGet 命令 -CMD_CrlGet 获取无效的证书 -CMD_CrlGet_Help 从目前管理的虚拟 HUB 设置的无效证书名单中指定无效证书的定义,获取其定义的内容。\n目前注册的无效证书的定义列表,可用 CrlList 指令获取。\n该指令虚拟专用桥不能运行。\n该指令在作为进群操作的 VPN Server 的虚拟服务器上不能执行。 -CMD_CrlGet_Args CrlGet [id] -CMD_CrlGet_[id] 指定要获取的无效的证书的定义中的 ID。 -CMD_CrlGet_Prompt_ID 获取 ID: -CMD_CrlGet_CN 名 (CN) -CMD_CrlGet_O 所属机构 (O) -CMD_CrlGet_OU 组织单位 (OU) -CMD_CrlGet_C 国家 (C) -CMD_CrlGet_ST 州 (ST) -CMD_CrlGet_L 本地 (L) -CMD_CrlGet_SERI 序列号 (十六进制) -CMD_CrlGet_MD5_HASH MD5 摘要值 (以十六进制,128 位) -CMD_CrlGet_SHA1_HASH SHA-1 摘要值 (以十六进制,160 位) - - -# AcList 命令 -CMD_AcList 获取源 IP 地址访问限制列表的规则项目列表 -CMD_AcList_Help 用本命令来获取目前管理的虚拟 HUB 上设置的源 IP 地址限制列表规则的列表。\n根据客户端电脑的源 IP 地址,您可以允许或拒绝对该虚拟 HUB 的 VPN 连接。可以定义多个规则,设置每个规则的优先顺序。优先顺序按照从高到低顺序,根据最先与 IP 地址匹配的规则运行,允许或拒绝从客户端的连接。\n该命令在 VPN Bridge 上不能运行。\n以集群成员运行的 VPN Server 的虚拟 HUB 不能执行此命令。 -CMD_AcList_Args AcList - - -# AcAdd 命令 -CMD_AcAdd 添加规则到 IP 地址限制列表(IPv4) -CMD_AcAdd_Help 在目前管理的虚拟 HUB 设置的 IP 地址限制列表中添加新规则。\n当 VPN Client 试图连接虚拟 HUB 时,在此设置的项目决定允许或拒绝来自该客户端的连接。\n你可以指定规则项目的内容相匹配的客户端 IP 地址,或者 IP 地址和子网掩码。如果只指定 IP 地址,仅指定一台与该规则相匹配的计算机;如果指定 IP 网络掩码地址和子网掩码地址,该规则匹配的子网范围内的所有计算机均被指定。\n可以设置规则的优先顺序。以大于 1 的整数指定优先顺序,值越小则优先顺序越高。\n要获取目前注册的源 IP 地址限制列表,使用 AcList 命令。\n该命令在 VPN Bridge 上不能运行。\n以集群成员运行的 VPN Server 的虚拟 HUB 不能执行此命令。 -CMD_AcAdd_Args AcAdd [allow|deny] [/PRIORITY:priority] [/IP:ip/mask] -CMD_AcAdd_[allow|deny] 设定允许 ("allow") 或拒绝 ("deny") 与规则相一致的来自客户端的连接。 -CMD_AcAdd_PRIORITY 以大于 1 的整数指定该规则的优先顺序。其值越小则优先顺序越高。 -CMD_AcAdd_IP 以 "IP 地址/掩码" 的形式指定客户端 IPv4 地址范围。IPv4 地址为 "192.168.0.1" 那样的,指定为用点分隔的十进制数。掩码为 "255.255.255.0" 那样的,指定为用点分隔的十进制数,可以用十进制数指定 24 位从头开始的比特长度,可作为十进制 10 款规定。要指定一个单独的 IPv4 主机,指定掩码为 "32" 或者 "255.255.255.255" -CMD_AcAdd_Prompt_AD allow 或 deny: -CMD_AcAdd_Prompt_PRIORITY 优先顺序: -CMD_AcAdd_Prompt_IP IPv4 地址/掩码: -CMD_AcAdd_Eval_PRIORITY 优先级请指定 1 或以上的数字。 - - -# AcAdd6 命令 -CMD_AcAdd6 添加规则到源 IP 地址访问限制列表(IPv6) -CMD_AcAdd6_Help 在目前管理的虚拟 HUB 设置的 IP 地址限制列表中添加新规则。\n当 VPN Client 试图连接虚拟 HUB 时,在此设置的项目决定允许或拒绝来自该客户端的连接。\n你可以指定规则项目的内容相匹配的客户端 IP 地址,或者 IP 地址和子网掩码。如果只指定 IP 地址,仅指定一台与该规则相匹配的计算机;如果指定 IP 网络掩码地址和子网掩码地址,该规则匹配的子网范围内的所有计算机均被指定。\n可以设置规则的优先顺序。以大于 1 的整数指定优先顺序,值越小则优先顺序越高。\n要获取目前注册的源 IP 地址限制列表,使用 AcList 命令。\n该命令在 VPN Bridge 上不能运行。\n以集群成员运行的 VPN Server 的虚拟 HUB 不能执行此命令。 -CMD_AcAdd6_Args AcAdd6 [allow|deny] [/PRIORITY:priority] [/IP:ip/mask] -CMD_AcAdd6_[allow|deny] 设定允许 ("allow") 或拒绝 ("deny") 与规则相一致的来自客户端的连接。 -CMD_AcAdd6_PRIORITY 以大于 1 的整数指定该规则的优先顺序。其值越小则优先顺序越高。 -CMD_AcAdd6_IP 以 [IP 地址/掩码] 的形式指定客户端 IPv6 地址范围。IPv6 地址为 2001:200:0:1:: 那样的,指定由冒号分隔的十六进制数。掩码为 ffff:ffff:ffff:ffff:: 那样的,指定由冒号分隔的十六进制数,可以用十进制数指定 64 位从头开始的比特长度,可作为十进制 10 款规定。如果设定为 "::/128" 则显示单一的主机。 -CMD_AcAdd6_Prompt_AD allow 或 deny: -CMD_AcAdd6_Prompt_PRIORITY 优先顺序: -CMD_AcAdd6_Prompt_IP IPv6 地址/掩码: -CMD_AcAdd6_Eval_PRIORITY 优先级请指定 1 或以上的数字。 - - -# AcDel 命令 -CMD_AcDel 源 IP 地址限制列表内的删除规则 -CMD_AcDel_Help 使用本命令删除目前管理的虚拟 HUB 设置的 IP 地址限制列表的规则。\n要获取目前注册的 IP 访问控制列表的规则列表,使用AcList命令。\n该指令虚拟专用桥不能运行。\n该命令在 VPN Bridge 上不能运行。\n以集群成员运行的 VPN Server 的虚拟 HUB 不能执行此命令。 -CMD_AcDel_Args AcDel [id] -CMD_AcDel_[id] 指定要删除的源 IP 地址限制列表内的规则的 ID。 -CMD_AcDel_Prompt_ID 要删除的规则的 ID: - - -# LicenseAdd 命令 -CMD_LicenseAdd 注册新的许可证密钥 -CMD_LicenseAdd_Help 在 SoftEther VPN Server 注册新的许可证密钥。\n要使用 SoftEther VPN Server,需获取有效的许可证,并注册许可证密钥。许可证密钥是由 36 个字母数字字符和连字符 ( '-' ) 组成的,以证明许可证所有权的密钥的代码。\n一起获得本软件及许可证证书时,许可证密钥会被印刷在许可证证书上。如果在线购买本软件的许可证时,许可证密钥会在购买时的网页画面或邮件中记载。此外,许可证密钥还可能其他以方法被记载。如有不明,请咨询许可证的销售方。\n\n要获取目前注册的许可证列表,使用 LicenseList 指令。\n要显示目前 VPN Server 的许可证状态,使用 LicenseStatus 指令。\n要运行此指令,需要 VPN Server 的管理员权限。\n该指令虚拟专用桥不能运行。 -CMD_LicenseAdd_Args LicenseAdd [key] -CMD_LicenseAdd_[key] 指定要注册的许可证密钥。36 位字母数字,6 个一组以连字符分隔,进行指定。 -CMD_LicenseAdd_Prompt_Key 许可证密钥: - - -# LicenseDel 命令 -CMD_LicenseDel 删除已注册许可 -CMD_LicenseDel_Help 从 SoftEther VPN Server 上目前注册的许可证名单中删除指定的许可证。\n\n要获得目前注册的许可证名单,使用 LicenseList 指令。\n要显示目前的 VPN Server 的许可证状态,使用 LicenseStatus 指令。\n要运行此指令,需要 VPN Server 管理员权限。\n此指令,虚拟专用桥不能运行。 -CMD_LicenseDel_Args LicenseDel [id] -CMD_LicenseDel_[id] 指定要删除的的许可证的号码。 -CMD_LicenseDel_Prompt_ID 删除许可证号码: - - -# LicenseList 命令 -CMD_LicenseList 获得已注册许可证的列表 -CMD_LicenseList_Help 在 SoftEther VPN Server 上显示目前注册许可证的许可证密钥,许可证类型,状态,有效期限,许可证 ID,许可证类型 ID,服务器 ID 和编号 ID 的列表。\n\n要显示目前的 VPN Server 的许可证状态,使用 LicenseStatus 指令。\n要运行此指令,需要 VPN Server 管理员权限。\n此命令,虚拟专用桥不能运行。 -CMD_LicenseList_Args LicenseList - - -# LicenseStatus 命令 -CMD_LicenseStatus 获取目前的 VPN Server 状态 -CMD_LicenseStatus_Help 获取并显示当前 SoftEther VPN Server 的许可证状态。 \n显示 SoftEther VPN Server 目前产品版本名称,服务器 ID,产品许可证的有效期限,及可以利用的客户端连接许可证数和桥连接许可证数。\n\n要运行此指令,需要 VPN Server 管理员权限。\n此指令,虚拟专用桥不能运行。 -CMD_LicenseStatus_Args LicenseStatus - -# SoftEther VPN 4.0 添加的 命令 -# IPsecEnable 命令 -CMD_IPsecEnable 启用或禁用 IPsec VPN Server 功能 -CMD_IPsecEnable_Help 在 SoftEther VPN Server 上启用或禁用IPsec VPN Server 功能。\n如果您禁用了此功能,VPN Server 上的虚拟 HUB 将会接受从 L2TP 兼容的 PC,Mac OS X 和智能手机的远程 VPN 连接,同时也会接受 EtherIP 站点到站点的 VPN 连接。从智能手机上的 VPN 连接,如iPhone、iPad 和 Android, 和从 Mac OS X 和 Windows 上的本地 VPN Client 的连接也都会接受。\n\n要执行此命令,您必须具有 VPN Server 管理员权限。\n该命令在 VPN Bridge 上不能运行。\n以集群成员运行的 VPN Server 的虚拟 HUB 不能执行此命令。 -CMD_IPsecEnable_Args IPsecEnable [/L2TP:yes|no] [/L2TPRAW:yes|no] [/ETHERIP:yes|no] [/PSK:pre-shared-key] [/DEFAULTHUB:default_hub] -CMD_IPsecEnable_L2TP 启用或禁用 L2TP over IPsec 服务器功能。要接受来自 iPhone, iPad, Android, Windows 或者 Mac OS X 的 VPN 连接,请启用本选项。 -CMD_IPsecEnable_L2TPRAW 启用或禁用 L2TP 服务器功能 (未加密的原始 L2TP).要接受特殊 VPN 客服端,请启用本选项。 -CMD_IPsecEnable_ETHERIP 启用或禁用 EtherIP / L2TPv3 over IPsec服务器功能(为站点到站点 VPN Server 功能). 兼容 EtherIP over IPsec 的路由器产品就可以连接到 VPN Server 上的虚拟 HUB ,并建成二层(以太网)网桥。 -CMD_IPsecEnable_PSK 指定 IPsec 预共享密钥。IPsec 预共享密钥通常称为 "PSK" 或者"秘钥"。指定一个 8 位或者小于 8 位的密钥,并且将它分配给要连接到该 VPN Server 的用户。请注意:Google Android 4.0 有一个漏洞 bug,当预共享密钥是 10 位或以上时,会引发意外行为。介于这种情况,预共享密钥应该是 9 位或小于 9 位。 -CMD_IPsecEnable_DEFAULTHUB 为防止遗漏用户名上的 HUB 名,请指定默认的虚拟 HUB。用户应该指定他们的用户名,如 "用户名@目标虚拟 HUB 名" 来连接此 L2TP 服务器。如果指定的虚拟 HUB 被遗漏,那么上述HUB将会作为目标被使用。 -CMD_IPsecEnable_Prompt_L2TP 启用 L2TP over IPsec 服务器功能(yes / no): -CMD_IPsecEnable_Prompt_L2TPRAW 启用原始 L2TP 服务器功能(yes / no): -CMD_IPsecEnable_Prompt_ETHERIP 启用 EtherIP / L2TPv3 over IPsec服务器功能(yes / no): -CMD_IPsecEnable_Prompt_PSK IPsec 的预共享密钥(推荐:最多 9 位) -CMD_IPsecEnable_Prompt_DEFAULTHUB 为避免在用户名中遗漏 HUB,请默认虚拟 HUB 。 - - -# IPsecGet 命令 -CMD_IPsecGet 获得当前IPsec VPN Server 设置 -CMD_IPsecGet_Help 获得并显示在 SoftEther VPN Server 上的当前 IPsec VPN Server 设置。\n\n要执行此命令,您必须具有 VPN Server 管理员权限。\n该命令在 VPN Bridge 上不能运行。\n以集群成员运行的 VPN Server 的虚拟 HUB 不能执行此命令。 -CMD_IPsecGet_Args IPsecGet -CMD_IPsecGet_PRINT_L2TP L2TP over IPsec 服务器功能已启用 -CMD_IPsecGet_PRINT_L2TPRAW 原始 L2TP 服务器功能已启用 -CMD_IPsecGet_PRINT_ETHERIP EtherIP / L2TPv3 over IPsec 服务器功能已启用 -CMD_IPsecGet_PRINT_PSK IPsec 预共享密钥字符串 -CMD_IPsecGet_PRINT_DEFAULTHUB 默认虚拟 HUB 名 - - -# EtherIpClientAdd 命令 -CMD_EtherIpClientAdd 添加新的 EtherIP / L2TPv3 over IPsec 客户端设置来接受 EtherIP / L2TPv3 客户端设备 -CMD_EtherIpClientAdd_Help 添加一个新的设置条目启用 EtherIP / L2TPv3 over IPsec 服务器功能来接受客户端设备。\n为了能够通过EtherIP / L2TPv3 over IPsec 服务器功能接受来自路由器的连接,您需要定义两者之间的关系表。这两者分别是表示客户端兼容EtherIP / L2TPv3 over IPsec 路由器的IPsec Phase 1 字符串和目标虚拟 HUB 的名称。\n在您使用 EtherIpClientAdd 命令添加了一个连接定义后,这个定义的连接设置将会被应用到, EtherIP / L2TPv3 over IPsec 客户端设备的接入请求会话中。\n用户名和密码条目必须要在虚拟 HUB 上注册。一个 EtherIP / L2TPv3 客户端会被认为它使用如上的用户信息的身份连接到虚拟 HUB 。n\n为执行此命令,您必须具有 VPN Server 管理员权限。\n该命令在 VPN Bridge 上不能运行。\n以集群成员运行的 VPN Server 的虚拟 HUB 不能执行此命令。 -CMD_EtherIpClientAdd_Args EtherIpClientAdd [ID] [/HUB:hubname] [/USERNAME:username] [/PASSWORD:password] -CMD_EtherIpClientAdd_[ID] 指定一个 ISAKMP Phase 1 ID。这个 ID 必须与 EtherIP / L2TPv3 客户端的ID配置完全相同。如果. EtherIP 客户端用 IP 地址作为Phase 1 ID,您可以指定像 ID 的字符类似的 IP 地址。如果您指定 '*' (星号),它将会是一个与任一不符合其他具体规则的客户端相符合的通配符。 -CMD_EtherIpClientAdd_HUB 指定要连接的虚拟 HUB 名称。 -CMD_EtherIpClientAdd_USERNAME 指定连接到目的虚拟 HUB 的用户名。 -CMD_EtherIpClientAdd_PASSWORD 指定连接到目的虚拟 HUB 的密码。 -CMD_EtherIpClientAdd_Prompt_ID ISAKMP Phase 1 ID ('*' 是通配符): -CMD_EtherIpClientAdd_Prompt_HUB 虚拟 HUB 名 -CMD_EtherIpClientAdd_Prompt_USERNAME 登录虚拟 HUB 的用户名 -CMD_EtherIpClientAdd_Prompt_PASSWORD 登录虚拟 HUB 的密码 - - -# EtherIpClientDelete 命令 -CMD_EtherIpClientDelete 删除一个 EtherIP / L2TPv3 over IPsec 客户端设置 -CMD_EtherIpClientDelete_Help 本命令删除一个通过使用 EtherIP / L2TPv3 over IPsec 功能来接受 VPN Client 的条目。\n\n要执行此命令,您必须具有 VPN Server 管理员权限。\n该命令在 VPN Bridge 上不能运行。\n以集群成员运行的 VPN Server 的虚拟 HUB 不能执行此命令。 -CMD_EtherIpClientDelete_Args EtherIpClientDelete [ID] -CMD_EtherIpClientDelete_[ID] 指定一个要删除的 ISAKMP Phase 1 ID -CMD_EtherIpClientDelete_Prompt_ID ISAKMP Phase 1 ID: - - -# EtherIpClientList 命令 -CMD_EtherIpClientList 获得当前 EtherIP / L2TPv3 客户端设备条目定义列表 -CMD_EtherIpClientList_Help 这个命令会获得和显示通过 EtherIP / L2TPv3 over IPsec 功能来接受 VPN Client 条目的列表。\n\n要执行此命令,您必须具有 VPN Server 管理员权限。\n该命令在 VPN Bridge 上不能运行。\n以集群成员运行的 VPN Server 的虚拟 HUB 不能执行此命令。 -CMD_EtherIpClientList_Args EtherIpClientList - - -# OpenVpnMakeConfig 命令 -CMD_OpenVpnMakeConfig 生成 OpenVPN Client 样本设置文件 -CMD_OpenVpnMakeConfig_Help 原来,OpenVPN Client 会要求用户手写很难的配置文件。本工具可以帮助您创建一个有用的配置样本。你所需要生成的 OpenVPN Client 配置文件就是运行此命令。\n\n要执行此命令,您必须具有 VPN Server 管理员权限。\n该命令在 VPN Bridge 上不能运行。\n以集群成员运行的 VPN Server 的虚拟 HUB 不能执行此命令。 -CMD_OpenVpnMakeConfig_Args OpenVpnMakeConfig [ZIP_FileName] -CMD_OpenVpnMakeConfig_[ZIP_FileName] 指定以 ZIP 压缩格式保存的输出文件。如果没指定文件后缀,那么".zip" 后缀就会被添加在文件名上。 -CMD_OpenVpnMakeConfig_Prompt_ZIP 设置文件夹的输出文件名。(ZIP 压缩文件): -CMD_OpenVpnMakeConfig_OK 样本设置文件被保存为 "%s"。您可以解压此文件以获取设置文件。\n -CMD_OpenVpnMakeConfig_ERROR 本样本设置文件不能保存为 "%s"。该文件名无效。\n - - -# ServerCertRegenerate 命令 -CMD_ServerCertRegenerate 生成一个新的带有指定 CN (Common Name) 的自签名证书,并且在 VPN Server 上注册。 -CMD_ServerCertRegenerate_Help 您可以使用此命令,将当前 VPN Server 上的证书替换成一个新的、有 CN (Common Name) 值字段的、自签字证书。n\n此命令在您想使用 Microsoft SSTP VPN 克隆服务器功能时很方便。因为在 VPN Server 上 SSL 证书的 CN 值必须要与 SSTP VPN Client 指定的主机名吻合。\n\n本命令会删除 VPN Server 上现有的 SSL 证书。这要求事先使用 ServerKeyGet 命令备份当前的 SSL 证书和密钥。\n\n要执行此命令,您必须具有 VPN Server 管理员权限。\n该命令在 VPN Bridge 上不能运行。\n以集群成员运行的 VPN Server 的虚拟 HUB 不能执行此命令。 -CMD_ServerCertRegenerate_Args ServerCertRegenerate [CN] -CMD_ServerCertRegenerate_[CN] 指定一个新证书要使用的 Common Name(CN) -CMD_ServerCertRegenerate_Prompt_CN Common Name(CN)值: - - -# VpnOverIcmpDnsEnable 命令 -CMD_VpnOverIcmpDnsEnable 启用/禁用 VPN over ICMP / VPN over DNS服务器功能 -CMD_VpnOverIcmpDnsEnable_Help 即使有防火墙或者有屏蔽TCP/IP通信的路由器,您也可以只用 ICMP 或者 DNS 数据包建立一个 VPN 。您需要事先启用如下功能。\n\n注意:本功能仅在紧急情况下使用。它在有防火墙或者路由器被错误配置屏蔽 TCP/IP 时,并且 ICMP 和 DNS 都没有被屏蔽的情况下可使用。它不是为长期稳定使用的。\n\n要执行此命令,您必须具有 VPN Server 管理员权限。\n该命令在 VPN Bridge 上不能运行。 -CMD_VpnOverIcmpDnsEnable_Args VpnOverIcmpDnsEnable [/ICMP:yes|no] [/DNS:yes|no] -CMD_VpnOverIcmpDnsEnable_ICMP 指定 "yes",启用 VPN over ICMP 服务器。指定 "no",禁用。 -CMD_VpnOverIcmpDnsEnable_DNS 指定 "yes",启用 VPN over DNS服务器。指定 "no",禁用。 -CMD_VpnOverIcmpDnsEnable_Prompt_ICMP 启用 VPN over ICMP服务器 (yes/no): -CMD_VpnOverIcmpDnsEnable_Prompt_DNS 启用 VPN over DNS服务器 (yes/no): - -# VpnOverIcmpDnsGet 命令 -CMD_VpnOverIcmpDnsGet 获取 VPN over ICMP / VPN over DNS 功能的当前设置 -CMD_VpnOverIcmpDnsGet_Help 获得并显示 VPN over ICMP / VPN over DNS 功能的当前状态。\n\n要执行此命令,您必须具有 VPN Server 管理员权限。\n该命令在 VPN Bridge 上不能运行。 -CMD_VpnOverIcmpDnsGet_Args VpnOverIcmpDnsGet -CMD_VpnOverIcmpDnsGet_PRINT_ICMP VPN over ICMP 服务器已开启 -CMD_VpnOverIcmpDnsGet_PRINT_DNS VPN over DNS 服务器已禁用 - - -# DynamicDnsGetStatus 命令 -CMD_DynamicDnsGetStatus 显示动态 DNS 功能的当前状态 -CMD_DynamicDnsGetStatus_Help 获得并显示动态 DNS 功能的当前状态。\n\n动态 DNS 会为本 VPN Server 分配一个唯一的和永久的 DNS 主机名。您可以在设置 VPN Client 和 VPN Bridge 时使用该主机名指定的 VPN Server。您不必注册并且保存域名。\n同时,如果您的 ISP 分派给您一个动态(不稳定) IP 地址,您的动态 DNS 主机名相应的 IP 地址也将会自动改变。它使您只用动态 IP 地址就可以保持 VPN Server 的运行。\r\n因此,您再也不需要为了维持静态全球 IP 地址,每月花费费用了。\n[注意]\n要禁止动态 DNS 功能,修改 VPN Server 和配置文件。\r\n\r\n"declare root" 指令有"declare DDnsClient"指令。在本指令中,那你可以从错误到正确切换"bool disable",并重启 VPN Server ,这样,动态 DNS 功能就禁用了。\n\n要执行此命令,您必须具有 VPN Server 管理员权限。\n该命令在 VPN Bridge 上不能运行。 -CMD_DynamicDnsGetStatus_Args DynamicDnsGetStatus -CMD_DynamicDnsGetStatus_PRINT_FQDN 分配的动态 DNS 主机名 (FQDN) -CMD_DynamicDnsGetStatus_PRINT_HOSTNAME 分配的动态 DNS 主机名 (主机名) -CMD_DynamicDnsGetStatus_PRINT_SUFFIX DNS 后缀 -CMD_DynamicDnsGetStatus_PRINT_IPv4 全球 IPv4 地址 -CMD_DynamicDnsGetStatus_PRINT_IPv6 全球 IPv6 地址 - - -# DynamicDnsSetHostname 命令 -CMD_DynamicDnsSetHostname 设置动态 DNS 主机名 -CMD_DynamicDnsSetHostname_Help 您可以用本命令更改动态 DNS 功能分配的主机名。当前分配的主机名可以通过使用 DynamicDnsGetStatus 命令来显示。\n\n动态 DNS 为 VPN Server 分配了一个唯一的和永久的 DNS 主机名。您可以在设置 VPN Client 和 VPN Bridge 时使用该主机名指定的 VPN Server。您不必注册并且保存域名。\n同时,如果您的 ISP 分派给您一个动态(不稳定) IP 地址,您的动态 DNS 主机名相应的 IP 地址也将会自动改变。它使您只用动态 IP 地址就可以保持 VPN Server 的运行。\r\n因此,您再也不需要为了维持静态全球 IP 地址,每月花费费用了。\n[注意]\n要禁止动态 DNS 功能,修改 VPN Server 和配置文件。\r\n\r\n"declare root" 指令有"declare DDnsClient"指令。在本指令中,那你可以从错误到正确切换"bool disable",并重启 VPN Server,这样,动态 DNS 功能就禁用了。\n\n要执行此命令,您必须具有 VPN Server 管理员权限。\n该命令在 VPN Bridge 上不能运行。 -CMD_DynamicDnsSetHostname_Args DynamicDnsSetHostname [hostname] -CMD_DynamicDnsSetHostname_[hostname] 指定新的主机名,主机名长度最短3个字母,最长为 31 个字母。仅限数字和字母。 -CMD_DynamicDnsSetHostname_Prompt_hostname Dynamic 动态 DNS 主机名 (3 – 31 个字母): - - -# VpnAzureGetStatus command -CMD_VpnAzureGetStatus 显示 VPN Azure 功能的当前状态 -CMD_VpnAzureGetStatus_Help 获取和显示 VPN Azure 功能的当前状态。\n\nVPN Azure 可以更容易地从你家里的计算机到你办公室的计算机建立一个VPN会话。当一个 VPN 连接建立了,您可以访问您公司专用网络上的任何其他服务器。在办公室的计算机(VPN 服务器)上,你并不需要一个全球 IP 地址。它可以在防火墙或 NAT 后面工作。无需网络管理员的配置。您可以在您的家用电脑使用 Windows 内置的 SSTP VPN 客户端。\nVPN Azure 是一个云 VPN 服务由 SoftEther 公司经营。VPN Azure 是免费的,可提供给任何人。访问 http://www.vpnazure.net/ 查看详细信息和如何使用的说明。\n\nVPN Azure 主机名与动态 DNS 设置的主机名相同,但改变的域名后缀为“vpnazure.net”。要改变主机名使用 DynamicDnsSetHostname 命令。\n\n要执行此命令,你必须具有VPN 服务器管理员权限。\n此命令不能在 VPN 网桥上运行。\n以集群成员运行的 VPN 服务器的虚拟 HUB 不能执行此命令。 -CMD_VpnAzureGetStatus_Args VpnAzureGetStatus -CMD_VpnAzureGetStatus_PRINT_ENABLED VPN Azure 功能已启用 -CMD_VpnAzureGetStatus_PRINT_CONNECTED 至 VPN Azure 云服务器的连接建立 -CMD_VpnAzureGetStatus_PRINT_HOSTNAME 在 VPN Azure 服务上的本 VPN 服务器的主机名 - - -# VpnAzureSetStatus command -CMD_VpnAzureSetEnable 启用/禁用 VPN Azure 功能 -CMD_VpnAzureSetEnable_Help 启用或禁用 VPN Azure 功能。\n\nVPN Azure 可以更容易地从你家里的计算机到你办公室的计算机建立一个 VPN 会话。当一个 VPN 连接建立了,您可以访问您公司专用网络上的任何其他服务器。\n在办公室的计算机(VPN 服务器)上,你并不需要一个全球 IP 地址。它可以在防火墙或 NAT 后面工作。无需网络管理员的配置。您可以在您的家用电脑使用 Windows 内置的 SSTP VPN 客户端。\nVPN Azure 是一个云 VPN 服务由 SoftEther 公司经营。VPN Azure 是免费的,可提供给任何人。访问 http://www.vpnazure.net/ 查看详细信息和如何使用的说明。\n\nVPN Azure 主机名与动态 DNS 设置的主机名相同,但改变的域名后缀为“vpnazure.net”。要改变主机名使用 DynamicDnsSetHostname 命令。\n\n要执行此命令,你必须具有 VPN 服务器管理员权限。\n此命令不能在 VPN 网桥上运行。\n以集群成员运行的 VPN 服务器的虚拟 HUB 不能执行此命令。 -CMD_VpnAzureSetEnable_Args VpnAzureSetEnable [yes|no] -CMD_VpnAzureSetEnable_[yes|no] 指定“yes”,启用 VPN Azure。“no”禁用它。 -CMD_VpnAzureSetEnable_PROMPT 启用 VPN Azure (yes/no): - - - -####################################################### -# # -#在这里往下是 VPN Client 用的管理命令 # -# # -####################################################### - - -# VersionGet 命令 -CMD_VersionGet 获取 VPN 客户服务的版本信息 -CMD_VersionGet_Help 获取目前管理的 VPN 客户服务程序的版本信息。 -CMD_VersionGet_Args VersionGet -CMD_VersionGet_1 产品名 -CMD_VersionGet_2 版本信息 -CMD_VersionGet_3 建设信息 -CMD_VersionGet_4 进程 ID -CMD_VersionGet_5 操作系统类型 - - -# PasswordSet 命令 -CMD_PasswordSet 为连接到 VPN 客户服务的密码的设定 -CMD_PasswordSet_Help 对 VPN Client 服务,从命令行管理工具及 VPN Client 经理来进行连接控制时,可以要求输入密码。使用此指令,可以设置要求输入的密码。\n以只对从远程 (本地主机以外的电脑) 进行操作时要求其输入密码。 -CMD_PasswordSet_Args PasswordSet [password] [/REMOTEONLY:yes|no] -CMD_PasswordSet_[password] 指定要设置的密码。如指定为 "none",可以删除密码的设置。 -CMD_PasswordSet_REMOTEONLY 如果指定 "yes",只对从远程 (本地主机以外的电脑) 进行操作时要求其输入密码,从本地主机连接时,不要求密码。如果省略此参数,则视为 "no"。 - - -# PasswordGet 命令 -CMD_PasswordGet 获取为连接到 VPN 客户服务的密码的设定 -CMD_PasswordGet_Help 对 VPN Client 服务,从命令行管理工具及 VPN Client 经理来进行连接控制时,获取是否要求输入密码的设置。\n而且,对于要求密码的情况下,获取是否设置只对从远程 (本地主机以外的电脑) 进行操作的情况要求输入密码。 -CMD_PasswordGet_Args PasswordGet -CMD_PasswordGet_1 设置密码 -CMD_PasswordGet_2 只需要远程连接时使用密码 - - -# CertList 命令 -CMD_CertList 获取信任的证明机构的证书列表 -CMD_CertList_Help VPN Client 管理信用的证明机构的证书列表。已注册的证明机构证书的注册列表,用来进行连接 VPN Server 时的验证服务器证书。 -CMD_CertList_Args CertList - - -# CertAdd 命令 -CMD_CertAdd 添加信任的证明机构的证书 -CMD_CertAdd_Help 向 VPN Client 信任的证明机构的证书列表添加新证书。已注册的证明机构证书的注册列表,用来进行连接 VPN Server 时的验证服务器证书。\n要获取当前的证书列表,使用 CertList 指令。\n要添加证书,该证书需要保存为 X.509 格式的文件。 -CMD_CertAdd_Args CertAdd [path] -CMD_CertAdd_[path] 指定要注册的 X.509 证书的文件名。 - - -# CertDelete 命令 -CMD_CertDelete 删除信任的证明机构的证书 -CMD_CertDelete_Help 从 VPN Client 信任的证明机构的证书列表中删除现有的证书。\n要获取当前的证书列表,使用 CertList 命令。 -CMD_CertDelete_Args CertDelete [id] -CMD_CertDelete_[id] 指定要删除的证书的 ID。 - - -# CertGet 命令 -CMD_CertGet 获得新任的证明机构的证书 -CMD_CertGet_Help 获取 VPN Client 信任的证明机构的证书列表中的现有证书,以 X.509 格式文件保存。 -CMD_CertGet_Args CertGet [id] [/SAVECERT:path] -CMD_CertGet_[id] 指定要获取的证书 ID。 -CMD_CertGet_SAVECERT 指定获取到的证书的保存文件名。 - - -# SecureList 命令 -CMD_SecureList 获取可用的智能卡种类列表 -CMD_SecureList_Help VPN Client 显示的被支持的智能卡类型的列表。\n智能卡类型的列表,目前的计算机上被安装驱动程序,且显示以 VPN 软件支持的设备列表。\n\n如果没有显示目前使用的智能卡型,或许可以通过更新 VPN 软件至新的版本来使用。 -CMD_SecureList_Args SecureList - - -# SecureSelect 命令 -CMD_SecureSelect 选择要使用的智能卡种类 -CMD_SecureSelect_Help 选择 VPN 客户使用的智能卡类型。\n可以使用的智能卡种类列表,可用 SecureList 指令获取。 -CMD_SecureSelect_Args SecureSelect [id] -CMD_SecureSelect_[id] 指定智能卡种类的 ID。 -CMD_SecureSelect_PROMPT_ID 使用的智能卡种类的 ID: - - -# SecureGet 命令 -CMD_SecureGet 获取使用的智能卡种类的 ID -CMD_SecureGet_Help 获取为当前 VPN 客户的使用而设置的智能卡种类的 ID。通过基于此 ID 上的 SecureList 指令的结果,可以获取当前选择的智能卡类型。\n如果当前的智能卡没有被选择,ID 显示是 0。 -CMD_SecureGet_Args SecureGet -CMD_SecureGet_Print 当前选择的智能卡 ID 是 %u。 -CMD_SecureGet_NoPrint 智能卡目前没有被选择。 - - -# NicCreate 命令 -CMD_NicCreate 新的虚拟 LAN 卡的创建 -CMD_NicCreate_Help 将新的虚拟 LAN 卡添加到系统。可以对虚拟 LAN 卡任意命名。\n然而,给虚拟 LAN 卡命名时只能使用英文字母数字,Windows 2000 以上的系统最大可设置 31 个字符,Windows 98,98 SE 和 ME 系统最大可设置 4 个字符。\n调用了 NicCreate 指令时,VPN Client 运行的操作系统,将被安装新的虚拟 LAN 卡设备驱动程序。\n在此情况下,操作系统可能会显示对话框,确认是否要安装设备驱动程序。 -CMD_NicCreate_Args NicCreate [name] -CMD_NicCreate_[name] 指定虚拟 LAN 卡名。 -CMD_NicCreate_PROMPT_NAME 虚拟 LAN 卡名: - - -# NicDelete 命令 -CMD_NicDelete 删除虚拟 LAN 卡 -CMD_NicDelete_Help 从系统中删除现有的虚拟 LAN 卡。\n当从系统中删除虚拟 LAN 卡,使用此虚拟 LAN 卡的连接将被中断。\n而且,位使用被删除的虚拟 LAN 卡而设置的连接设置,自动更改设置为使用别的虚拟 LAN 卡。\n当 VPN 客户运行 Windows 2000 以上的操纵系统时,此指令可以被使用。 -CMD_NicDelete_Args NicDelete [name] -CMD_NicDelete_[name] 指定的虚拟 LAN 卡名 - - -# NicUpgrade 命令 -CMD_NicUpgrade 升级虚拟 LAN 卡设备驱动 -CMD_NicUpgrade_Help 如果现有的虚拟 LAN 卡的设备驱动程序版本太旧,在当前正在运行的 VPN Client 升级到同包附带的最新的设备驱动程序。即使不进行升级,也要重新安装设备驱动程序。\n操作系统可能会显示对话框,确认是否要安装设备驱动程序。\n此指令,在 VPN Client 正运行 Windows 2000 以上的操作系统时能够使用。 -CMD_NicUpgrade_Args NicUpgrade [name] -CMD_NicUpgrade_[name] 指定的虚拟 LAN 卡名 - - -# NicGetSetting 命令 -CMD_NicGetSetting 获取虚拟 LAN 卡的设置 -CMD_NicGetSetting_Help 获取现有的虚拟 LAN 卡的 MAC 地址设置。\n当 VPN 客户运行 Windows 2000 以上的操纵系统时,此指令可以被使用。 -CMD_NicGetSetting_Args NicGetSetting [name] -CMD_NicGetSetting_[name] 指定虚拟 LAN 卡名 -CMD_NicGetSetting_1 设备名称 -CMD_NicGetSetting_2 状态 -CMD_NicGetSetting_3 MAC 地址 -CMD_NicGetSetting_4 版本 -CMD_NicGetSetting_5 驱动程序文件名 -CMD_NicGetSetting_6 GUID - - -# NicSetSetting 命令 -CMD_NicSetSetting 更改虚拟 LAN 卡设置 -CMD_NicSetSetting_Help 更改现有的虚拟 LAN 卡的 MAC 地址设置。一旦启动该指令,目前运行中的虚拟 LAN 卡设备驱动将被重新启动。\n当 VPN 客户运行 Windows 2000 以上的操纵系统时,此指令可以被使用。 -CMD_NicSetSetting_Args NicSetSetting [name] [/MAC:mac] -CMD_NicSetSetting_[name] 指定虚拟 LAN 卡名 -CMD_NicSetSetting_MAC 指定要设置的 MAC 地址。\nMAC 地址请用 6 字节十六进制字符串指定。\n例如: 00:AC:01:23:45:67 或 00-AC-01-23-45-67 -CMD_NicSetSetting_PROMPT_MAC 配置 MAC 地址: - - -# NicEnable 命令 -CMD_NicEnable 启用虚拟 LAN 卡 -CMD_NicEnable_Help 启动现有的被禁用的虚拟 LAN 卡。\n当 VPN 客户运行 Windows 2000 以上的操纵系统时,此指令可以被使用。 -CMD_NicEnable_Args NicEnable [name] -CMD_NicEnable_[name] 指定虚拟 LAN 卡的名称。 - - -# NicDisable 命令 -CMD_NicDisable 禁用虚拟 LAN 卡 -CMD_NicDisable_Help 禁用现有的正使用的虚拟 LAN 卡。\n当 VPN 客户运行 Windows 2000 以上的操纵系统时,此指令可以被使用。 -CMD_NicDisable_Args NicDisable [name] -CMD_NicDisable_[name] 指定虚拟 LAN 卡的名称。 - - -# NicList 命令 -CMD_NicList 获取虚拟 LAN 卡列表 -CMD_NicList_Help 获取在当前系统注册的虚拟 LAN 卡列表 -CMD_NicList_Args NicList - - -# AccountList 命令 -CMD_AccountList 获取连接设置列表 -CMD_AccountList_Help 获取登录到 VPN Client 的连接设置列表 -CMD_AccountList_Args AccountList - - -# AccountCreate 命令 -CMD_AccountCreate 创建新的连接设置 -CMD_AccountCreate_Help 在 VPN Client 创建新的连接设置。\n要创建连接设置,作为初始参数需要指定加在连接设置名称和连接终端的服务器,及连接终端的虚拟 HUB,用户名上使用的虚拟 LAN 卡名。创建了新的连接设置时,用户认证的类型被初始设置为 [匿名认证],代理服务器的设置和服务器证书的检查选项不被设置。若要更改这些设置和其他的详细设置,创建连接设置后,使用以 "Account" 名字开始的其他指令。 -CMD_AccountCreate_Args AccountCreate [name] [/SERVER:hostname:port] [/HUB:hubname] [/USERNAME:username] [/NICNAME:nicname] -CMD_AccountCreate_[name] 指定要创建的连接设置名 -CMD_AccountCreate_SERVER 以 [主机名:端口号] 的形式指定终端 VPN Server 的主机名,端口号。可以通过 IP 地址进行指定。 -CMD_AccountCreate_HUB 在终端 VPN Server 上指定虚拟 HUB。 -CMD_AccountCreate_USERNAME 指定在连接到终端 VPN Server 时用于用户认证的用户名。 -CMD_AccountCreate_NICNAME 指定用于连接的虚拟 LAN 卡名。 -CMD_AccountCreate_Prompt_Name 连接设置名: -CMD_AccountCreate_Prompt_Server 终端 VPN Server 主机名和端口号: -CMD_AccountCreate_Prompt_Hub 终端虚拟 HUB 名称: -CMD_AccountCreate_Prompt_Username 连接用户名: -CMD_AccountCreate_Prompt_Nicname 使用虚拟 LAN 卡名称: - - -# AccountSet 命令 -CMD_AccountSet 设定连接设置连接终端 -CMD_AccountSet_Help 设置注册在 VPN 客户的连接设置的终端 VPN Server 主机名和端口号,虚拟 HUB 名,及用于连接的用户名,加在其上使用的虚拟 LAN 卡名。 -CMD_AccountSet_Args AccountSet [name] [/SERVER:hostname:port] [/HUB:hubname] -CMD_AccountSet_[name] 指定要更改设置的连接设置名。 -CMD_AccountSet_SERVER 以 [主机名:端口号] 的形式指定终端 VPN Server 的主机名,端口号。可以通过 IP 地址进行指定。 -CMD_AccountSet_HUB 指定终端的 VPN Server 上的虚拟 HUB。 - - -# AccountGet 命令 -CMD_AccountGet 取得连接设置的设置 -CMD_AccountGet_Help 获取注册到 VPN Client 的连接设置的连接设置内容。\n而且,要改变连接设置的连接设置内容,在创建连接设置后使用其他的以 "Account" 名开始的的指令。 -CMD_AccountGet_Args AccountGet [name] -CMD_AccountGet_[name] 指定要获取的连接设置名。 - - -# AccountDelete 命令 -CMD_AccountDelete 删除连接设置 -CMD_AccountDelete_Help 删除注册到 VPN Client 的连接设置。如果指定的连接设置处于在线状态,将会自动断开连接并删除。 -CMD_AccountDelete_Args AccountDelete [name] -CMD_AccountDelete_[name] 指定要删除的连接设置名。 - - -# AccountUsernameSet 命令 -CMD_AccountUsernameSet 设置用于连接的连接设置的用户名 -CMD_AccountUsernameSet_Help 指定注册到 VPN Client 的连接设置,且其连接设置连接到 VPN Server 上时,指定需要进行用户认证的用户名。\n而且,在一些情况下有必要指定用户认证的种类和需要的参数。要更改这些信息,可以使用如下指令: AccountAnonymousSet, AccountPasswordSet, AccountCertSet 和 AccountSecureCertSet。 -CMD_AccountUsernameSet_Args AccountUsernameSet [name] [/USERNAME:username] -CMD_AccountUsernameSet_[name] 指定更改设置的连接设置名。 -CMD_AccountUsernameSet_USERNAME 指定连接设置连接到 VPN Server 上时需要进行用户认证的用户名。 -CMD_AccountUsername_Notice 这种连接设置的认证方法,目前被设置为密码认证。更改用户名后,必须使用 AccountPasswordSet 指令重新设定。 - - -# AccountAnonymousSet 命令 -CMD_AccountAnonymousSet 设定连接设置的用户认证种类为匿名认证 -CMD_AccountAnonymousSet_Help 指定注册到 VPN Client 的连接设置,把其连接设置连接到 VPN Server 上时的用户认证方法,设置为 [匿名认证]。 -CMD_AccountAnonymousSet_Args AccountAnonymousSet [name] -CMD_AccountAnonymousSet_[name] 指定更改设置的连接设置名。 - - -# AccountPasswordSet 命令 -CMD_AccountPasswordSet 设定连接设置的用户证类型为密码认证 -CMD_AccountPasswordSet_Help 指定注册到 VPN Client 的连接设置,把其连接设置连接到 VPN Server 上时的用户认证方法,设置为 [密码认证]。指定 [标准密码认证] 和 [RADIUS 或 NT 域认证] 作为密码认证种类。 -CMD_AccountPasswordSet_Args AccountPasswordSet [name] [/PASSWORD:password] [/TYPE:standard|radius] -CMD_AccountPasswordSet_[name] 指定更改设置的连接设置名。 -CMD_AccountPasswordSet_PASSWORD 指定密码认证使用的密码。如果不指定,将显示输入密码的提示。 -CMD_AccountPasswordSet_TYPE 作为密码认证类型,指定 "standard" (标准密码认证) 或 "radius" (RADIUS 或 NT 域认证) 的二者之一。 -CMD_AccountPasswordSet_Prompt_Type 指定 standard 或 radius: -CMD_AccountPasswordSet_Type_Invalid standard 或 radius 的指定是不正确的。 - - -# AccountCertSet 命令 -CMD_AccountCertSet 设置连接设置的用户认证类型为用户证书认证 -CMD_AccountCertSet_Help 指定注册到 VPN Client 的连接设置,把其连接设置连接到 VPN Server 上时的用户认证方法,设置为 [用户证书认证]。作为该证书,必须指定证书文件为 X.509 格式且私钥文件是 Base 64 编码。 -CMD_AccountCertSet_Args AccountCertSet [name] [/LOADCERT:cert] [/LOADKEY:key] -CMD_AccountCertSet_[name] 指定要更改设置的连接设置名 -CMD_AccountCertSet_LOADCERT 指定以证书认证提交的 X.509 格式证书的文件名。 -CMD_AccountCertSet_LOADKEY 指定以对应证书的 Base 64 格式的编码私钥文件名。 - - -# AccountCertGet 命令 -CMD_AccountCertGet 获取用于连接设置的客户端证书 -CMD_AccountCertGet_Help 当指定注册到 VPN Client 的连接设置,其连接设置使用使用客户证书认证时,获取作为客户证书提出的证书,并保存该证书文件为 X.509 格式。 -CMD_AccountCertGet_Args AccountCertGet [name] [/SAVECERT:cert] -CMD_AccountCertGet_[name] 指定要获取设置的连接设置名。 -CMD_AccountCertGet_SAVECERT 指定以 X.509 格式保存获取的证书的文件名。 - - -# AccountEncryptEnable 命令 -CMD_AccountEncryptEnable 启用连接设置进行通信的加密 -CMD_AccountEncryptEnable_Help 当指定注册到 VPN Client 的连接设置,且其连接设置与 VPN Server 间进行 VPN 连接通信时,将与 VPN Server 间的通信内容以 SSL 设置为加密。\n通常,将与 VPN Server 间的通信以 SSL 加密,是防止信息的窃听和篡改。也可以禁用加密。当禁用加密时,通信量将扩大但是通信数据将以纯文本格式在网络上传输。 -CMD_AccountEncryptEnable_Args AccountEncryptEnable [name] -CMD_AccountEncryptEnable_[name] 指定要更改设置的连接设置名。 - - -# AccountEncryptDisable 命令 -CMD_AccountEncryptDisable 禁用连接设置进行通信时的加密 -CMD_AccountEncryptDisable_Help 当指定注册到 VPN Client 的连接设置,且其连接设置与 VPN Server 间进行 VPN 连接通信时,将与 VPN Server 间的通信内容以 SSL 设置为不加密。\n通常,将与 VPN Server 间的通信以 SSL 加密,是防止信息的窃听和篡改。也可以禁用加密。当禁用加密时,通信量将扩大但是通信数据将以纯文本格式在网络上传输。 -CMD_AccountEncryptDisable_Args AccountEncryptDisable [name] -CMD_AccountEncryptDisable_[name] 指定要更改设置的连接设置名。 - - -# AccountCompressEnable 命令 -CMD_AccountCompressEnable 启用连接设置进行通信时的数据压缩 -CMD_AccountCompressEnable_Help 当指定注册到 VPN Client 的连接设置,且其连接设置与 VPN Server 间进行 VPN 连接通信时,将与 VPN Server 间的通信内容设置为压缩。\n最大可以进行约 80% 的压缩。但是,压缩会使客户端及服务器双方的 CPU 产生较高的负荷。当线路速度为约 10 Mbps 以上时,压缩可能会降低吞吐量,产生反面效果。 -CMD_AccountCompressEnable_Args AccountCompressEnable [name] -CMD_AccountCompressEnable_[name] 指定要更改设置的连接设置名。 - - -# AccountCompressDisable 命令 -CMD_AccountCompressDisable 禁用连接设置进行通信时的数据压缩 -CMD_AccountCompressDisable_Help 当指定注册到 VPN Client 的连接设置,且其连接设置与 VPN Server 间进行 VPN 连接通信时,将与 VPN Server 间的通信内容设置为不压缩。 -CMD_AccountCompressDisable_Args AccountCompressDisable [name] -CMD_AccountCompressDisable_[name] 指定要更改设置的连接设置名。 - - -# AccountHttpHeader* commands -CMD_AccountHttpHeader_Prompt_Name Value name (part before the colon): -CMD_AccountHttpHeader_Prompt_Data Value data (part after the colon): - - -# AccountHttpHeaderAdd command -CMD_AccountHttpHeaderAdd Add a custom value in the HTTP header sent to the proxy server -CMD_AccountHttpHeaderAdd_Help Use this to add a custom value in the HTTP header sent to the proxy server. A custom HTTP header can be used to bypass certain restrictions imposed on the network or to avoid speed limitations applied by the QoS. -CMD_AccountHttpHeaderAdd_Args AccountHttpHeaderAdd [name] [/NAME:name] [/DATA:data] -CMD_AccountHttpHeaderAdd_[name] Specify the name of the VPN Connection Setting whose setting you want to change. -CMD_AccountHttpHeaderAdd_NAME Specify the name of the custom value (the part before the colon character). -CMD_AccountHttpHeaderAdd_DATA Specify the data of the custom value (the part after the colon character). - - -# AccountHttpHeaderDelete command -CMD_AccountHttpHeaderDelete Delete a custom value in the HTTP header sent to the proxy server -CMD_AccountHttpHeaderDelete_Help Use this to delete a custom value in the HTTP header sent to the proxy server. A custom HTTP header can be used to bypass certain restrictions imposed on the network or to avoid speed limitations applied by the QoS. -CMD_AccountHttpHeaderDelete_Args AccountHttpHeaderDelete [name] [/NAME:name] -CMD_AccountHttpHeaderDelete_[name] Specify the name of the VPN Connection Setting whose setting you want to change. -CMD_AccountHttpHeaderDelete_NAME Specify the name of the custom value (the part before the colon character). - - -# AccountHttpHeaderGet command -CMD_AccountHttpHeaderGet Get the list of custom values in the HTTP header sent to the proxy server -CMD_AccountHttpHeaderGet_Help Use this to get the list of custom values in the HTTP header sent to the proxy server. A custom HTTP header can be used to bypass certain restrictions imposed on the network or to avoid speed limitations applied by the QoS. -CMD_AccountHttpHeaderGet_Args AccountHttpHeaderGet [name] -CMD_AccountHttpHeaderGet_[name] Specify the name of the VPN Connection Setting whose setting you want to get. - - -# AccountProxyNone 命令 -CMD_AccountProxyNone 将连接设置的连接方法直接设置为 TCP/IP 连接 -CMD_AccountProxyNone_Help 当指定注册到 VPN Client 的连接设置,将其连接设置与 VPN Server 间进行 VPN 连接时使用的连接方法设置为 [直接 TCP/IP连接],不通过代理服务器。 -CMD_AccountProxyNone_Args AccountProxyNone [name] -CMD_AccountProxyNone_[name] 指定要更改设置的连接设置名。 - - -# AccountProxyHttp 命令 -CMD_AccountProxyHttp 将连接设置的连接方法设置为通过 HTTP 代理服务器连接 -CMD_AccountProxyHttp_Help 当指定注册到 VPN Client 的连接设置,将其连接设置与 VPN Server 间进行 VPN 连接时使用的连接方法设置为 [通过 HTTP 代理服务器连接],指定将通过的 HTTP 代理服务器的主机名和端口号,用户名和密码 (如果需要)。\n通过 HTTP 代理服务器,必须对应因进行 HTTPS 通信的 CONNECT 方法。 -CMD_AccountProxyHttp_Args AccountProxyHttp [name] [/SERVER:hostname:port] [/USERNAME:username] [/PASSWORD:password] -CMD_AccountProxyHttp_[name] 指定要更改设置的连接设置名。 -CMD_AccountProxyHttp_SERVER 以 [主机名:端口号] 的形式,指定通过 HTTP 代理服务器的主机名或 IP 地址和端口号。 -CMD_AccountProxyHttp_USERNAME 如果因为连接通过 HTTP 代理服务器而需要用户认证时,指定用户名。与此同时也指定 /PASSWORD 参数。/USERNAME 和 /PASSWORD 参数没有被指定时,不设置用户身份验证数据。 -CMD_AccountProxyHttp_PASSWORD 如果因为连接通过 HTTP 代理服务器而需要用户认证时,指定密码。与 /USERNAME 参数一起指定。 -CMD_AccountProxyHttp_Prompt_Server 代理服务器主机名和端口号: - - -# AccountProxySocks 命令 -CMD_AccountProxySocks 将连接设置的连接方法设置为通过 SOCKS4 代理服务器连接 -CMD_AccountProxySocks_Help 当指定注册到 VPN Client 的连接设置,将其连接设置与 VPN Server 间进行 VPN 连接时使用的连接方法设置为 [通过 SOCKS4 服务器连接],并指定要通过的 SOCKS4 代理服务器的主机名和端口号,用户名和密码 (如果需要)。 -CMD_AccountProxySocks_Args AccountProxySocks [name] [/SERVER:hostname:port] [/USERNAME:username] [/PASSWORD:password] -CMD_AccountProxySocks_[name] 指定要更改设置的连接设置名。 -CMD_AccountProxySocks_SERVER 以 [主机名:端口号] 形式,指定要通过的 SOCKS4 代理服务器主机名或 IP 地址和端口号。 -CMD_AccountProxySocks_USERNAME 如果因为连接通过 SOCKS4 代理服务器而需要用户认证时,指定用户名。与此同时也指定 /PASSWORD 参数。/USERNAME 和 /PASSWORD 参数没有被指定时,不设置用户身份验证数据。 -CMD_AccountProxySocks_PASSWORD 如果因为连接通过 SOCKS4 代理服务器而需要用户认证时,指定密码。与 /USERNAME 参数一起指定。 - - -# AccountProxySocks5 命令 -CMD_AccountProxySocks5 将连接设置的连接方法设置为通过 SOCKS5 代理服务器连接 -CMD_AccountProxySocks5_Help 当指定注册到 VPN Client 的连接设置,将其连接设置与 VPN Server 间进行 VPN 连接时使用的连接方法设置为 [通过 SOCKS5 服务器连接],并指定要通过的 SOCKS5 代理服务器的主机名和端口号,用户名和密码 (如果需要)。 -CMD_AccountProxySocks5_Args AccountProxySocks5 [name] [/SERVER:hostname:port] [/USERNAME:username] [/PASSWORD:password] -CMD_AccountProxySocks5_[name] 指定要更改设置的连接设置名。 -CMD_AccountProxySocks5_SERVER 以 [主机名:端口号] 形式,指定要通过的 SOCKS5 代理服务器主机名或 IP 地址和端口号。 -CMD_AccountProxySocks5_USERNAME 如果因为连接通过 SOCKS5 代理服务器而需要用户认证时,指定用户名。与此同时也指定 /PASSWORD 参数。/USERNAME 和 /PASSWORD 参数没有被指定时,不设置用户身份验证数据。 -CMD_AccountProxySocks5_PASSWORD 如果因为连接通过 SOCKS5 代理服务器而需要用户认证时,指定密码。与 /USERNAME 参数一起指定。 - - -# AccountServerCertEnable 命令 -CMD_AccountServerCertEnable 启用连接设置服务器证书验证选项 -CMD_AccountServerCertEnable_Help 指定注册到 VPN Client 的连接设置,其连接设置连接到 VPN Server 时,启动检查连接终端的 VPN Server 提交的 SSL 证书是否可信的选项。\n如果启用此选项,可以预先将连接目标服务器的 SSL 证书以 AccountServerCertSet 指令保存在连接设置的设置内,或建议将服务器的 SSL 证书签名了的根证书,以 CertAdd 指令注册到虚拟 HUB 信任的证明机构的证书列表中。如果没有注册,初次连接时可能会显示确认信息。\n验证连接设置的服务器证书的选项处于启动状态,连接了的 VPN Server 的证书不可信时,立即解除连接,反复重试。 -CMD_AccountServerCertEnable_Args AccountServerCertEnable [name] -CMD_AccountServerCertEnable_[name] 指定要更改设置的连接设置名。 - - -# AccountServerCertDisable 命令 -CMD_AccountServerCertDisable 禁用连接设置服务器证书验证选项 -CMD_AccountServerCertDisable_Help 指定注册到 VPN Client 的连接设置,其连接设置与 VPN Server 连接时,禁止检验由目标 VPN Server 提供的 SSL 证明书是否可信的选项。 -CMD_AccountServerCertDisable_Args AccountServerCertDisable [name] -CMD_AccountServerCertDisable_[name] 指定要更改设置的连接设置名。 - - -# AccountRetryOnServerCertEnable command -CMD_AccountRetryOnServerCertEnable Enable VPN connection retry if server certificate is untrusted -CMD_AccountRetryOnServerCertEnable_Help When a VPN Connection Setting registered on the VPN Client is specified and that VPN Connection Setting connects to a VPN Server, use this to enable the option to retry connection if Server certificate cannot be trusted. -CMD_AccountRetryOnServerCertEnable_Args AccountRetryOnServerCertEnable [name] -CMD_AccountRetryOnServerCertEnable_[name] Specify the name of the VPN Connection Setting whose setting you want to change. - - -# AccountRetryOnServerCertDisable command -CMD_AccountRetryOnServerCertDisable Disable VPN connection retry if server certificate is invalid -CMD_AccountRetryOnServerCertDisable_Help When a VPN Connection Setting registered on the VPN Client is specified and that VPN Connection Setting connects to a VPN Server, use this to disable the option to retry connection if Server certificate cannot be trusted. -CMD_AccountRetryOnServerCertDisable_Args AccountRetryOnServerCertDisable [name] -CMD_AccountRetryOnServerCertDisable_[name] Specify the name of the VPN Connection Setting whose setting you want to change. - - -# AccountServerCertSet 命令 -CMD_AccountServerCertSet 设置连接设置的服务器固有证明书 -CMD_AccountServerCertSet_Help 指定注册到 VPN Client 的连接设置,其连接设置连接到 VPN Server 时,预先注册与连接目标的 VPN Server 提交的 SSL 证书相同的证书。\n如果启动了连接设置的服务器证书验证选项,可以预先将连接目标服务器的 SSL 证书以此指令保存在连接设置的设置内,或需要将服务器的 SSL 证书签名了的根证书,以 CAAdd 指令注册到虚拟 HUB 信任的证明机构的证书列表中。\n验证连接设置的服务器证书的选项处于启动状态,连接了的 VPN Server 的证书不可信时,立即解除连接,反复重试。 -CMD_AccountServerCertSet_Args AccountServerCertSet [name] [/LOADCERT:cert] -CMD_AccountServerCertSet_[name] 指定要更改设置的连接设置名。 -CMD_AccountServerCertSet_LOADCERT 指定以 X.509 证书格式保存的设置服务器固有证书的证书文件名。 - - -# AccountServerCertDelete 命令 -CMD_AccountServerCertDelete 删除连接设置的服务器固有证书 -CMD_AccountServerCertDelete_Help 指定注册到到 VPN Client 的连接设置,且其连接设置注册了服务器固有证书时,删除证书。 -CMD_AccountServerCertDelete_Args AccountServerCertDelete [name] -CMD_AccountServerCertDelete_[name] 指定要更改设置的连接设置名。 - - -# AccountServerCertGet 命令 -CMD_AccountServerCertGet 获取连接设置的服务器固有证明书 -CMD_AccountServerCertGet_Help 指定注册到到 VPN Client 的连接设置,且其连接设置注册了服务器固有证书时,获取该证书并以 X.509 格式保存证明书文件。 -CMD_AccountServerCertGet_Args AccountServerCertGet [name] [/SAVECERT:path] -CMD_AccountServerCertGet_[name] 指定要更改设置的连接设置名。 -CMD_AccountServerCertGet_SAVECERT 指定以 X.509 证书格式保存的服务器固有证书的证书文件名。 - - -# AccountDetailSet 命令 -CMD_AccountDetailSet 设置接续设置的高级通信设置 -CMD_AccountDetailSet_Help 指定注册到 VPN Client 的连接设置,并定制其连接设置与 VPN Server 通信时使用的 VPN 协议的通信设置。 -CMD_AccountDetailSet_Args AccountDetailSet [name] [/MAXTCP:max_connection] [/INTERVAL:additional_interval] [/TTL:disconnect_span] [/HALF:yes|no] [/BRIDGE:yes|no] [/MONITOR:yes|no] [/NOTRACK:yes|no] [/NOQOS:yes|no] -CMD_AccountDetailSet_[name] 指定要更改设置的连接设置名。 -CMD_AccountDetailSet_MAXTCP VPN 通信使用的 TCP 连接数,指定从 1 到 32 的整数。在与 VPN Server 之间的 VPN 通信会话上的数据传送,通过使用多个 TCP 连接,可以提高通信速度。\n注意: 如果连接服务器的线路是高速线路时,建议 8 个左右,如果是拨号等低速线路时,建议 1 个。 -CMD_AccountDetailSet_INTERVAL 建立多个 TCP 连接进行 VPN 通信时,以秒为单位指定每个 TCP 连接的建立间隔。规定值为 1 秒。 -CMD_AccountDetailSet_TTL 如果设置的每个 TCP 连接的寿命时,从 TCP 连接的建立到断开的寿命以秒数来指定。如果指定 "0",则寿命未被设置。 -CMD_AccountDetailSet_HALF 要启动半双工模式,指定 "yes"。将两个以上的 TCP 连接捆绑,进行 VPN 通信时,可以使用 "半双工模式"。启动半双工模式,能够自动将各 TCP 连接的数据传输方向固定各一半。例如,使用 8 个 TCP 连接建立了 VPN 会话时,启动半双工模式,则固定 4 个 TCP 连接为上传方向专用,剩下 4 个 TCP 连接为下载方向专用,进行通信。 -CMD_AccountDetailSet_BRIDGE 与 VPN Server 以 "桥 / 路由器模式" 连接时,指定 "yes"。使用桥/路由器模式连接时,VPN Client 的虚拟 LAN 卡方将能够与其他网络进行桥或路由。然而,如果用于连接的用户的安全策略禁用桥或路由时,则连接失败。 -CMD_AccountDetailSet_MONITOR 与 VPN Server 以 "监控模式" 连接时,指定 "yes"。如果使用监测模式连接时,可以接收虚拟 HUB 内传送的所有的数据包。然而,用于连接的用户安全策略不允许监视模式时,则连接失败。 -CMD_AccountDetailSet_NOTRACK 指定 "yes",禁用路由器表项调节器。通常情况下,指定 "no"。 -CMD_AccountDetailSet_NOQOS 禁用 VoIP / QoS 功能时指定 "yes"。通常指定 "no"。 -CMD_AccountDetailSet_Eval_MaxTcp TCP 连接数请在 1 - 32 号之间指定。 -CMD_AccountDetailSet_Eval_Interval TCP 连接的建立间隔请指定 1 秒以上。 -CMD_AccountDetailSet_Prompt_MaxTcp 用于 VPN 通信的 TCP 连接数: -CMD_AccountDetailSet_Prompt_Interval 各 TCP 连接的建立间隔: -CMD_AccountDetailSet_Prompt_TTL 各 TCP 连接的寿命 (不带: 0): -CMD_AccountDetailSet_Prompt_HALF 启用半双工模式 (yes/no): -CMD_AccountDetailSet_Prompt_BRIDGE 启用桥/路由器模式 (yes/no): -CMD_AccountDetailSet_Prompt_MONITOR 启用监控模式 (yes/no): -CMD_AccountDetailSet_Prompt_NOTRACK 禁用路由表项调节器 (yes/no): -CMD_AccountDetailSet_Prompt_NOQOS 禁用 QoS 控制功能 (yes/no): -CMD_AccountDetailSet_DISABLEUDP Specify "yes" when disabling UDP acceleration function. Normally "no" is specified. -CMD_AccountDetailSet_Prompt_DISABLEUDP Disable UDP Acceleration Function (yes/no): - - -# AccountRename 命令 -CMD_AccountRename 更改连接设置名称 -CMD_AccountRename_Help 指定在 VPN Client 注册的连接设置,更改其连接设置名称。 -CMD_AccountRename_Args AccountRename [name] [/NEW:new_name] -CMD_AccountRename_[name] 指定要更改名称的连接设置的当前名称。 -CMD_AccountRename_NEW 指定变更后的新名称。 -CMD_AccountRename_PROMPT_OLD 目前的名称: -CMD_AccountRename_PROMPT_NEW 新名称: - - -# AccountConnect 命令 -CMD_AccountConnect 使用连接设置,开始连接 VPN Server -CMD_AccountConnect_Help 指定注册到 VPN Client 的连接设置,并启动连接设置连接到 VPN Server 上。处于正在连接中或已连接状态的连接设置,将一直连接 VPN Server,或不断尝试连接 VPN Server,直到使用 AccountDisconnect 指令断开连接。(但是,如果使用 AccountRetrySet 指令指定了重试次数时,连接尝试将在达到被指定次数时中断。) -CMD_AccountConnect_Args AccountConnect [name] -CMD_AccountConnect_[name] 指定要启动的连接设置名。 - - -# AccountDisconnect 命令 -CMD_AccountDisconnect 断开连接中的连接设置 -CMD_AccountDisconnect_Help 指定注册到 VPN Client 的连接设置,其连接设置处于连接处理中或已连接的状态时,立即将其断开。 -CMD_AccountDisconnect_Args AccountDisconnect [name] -CMD_AccountDisconnect_[name] 指定要断开的连接设置名。 - - -# AccountStatusGet 命令 -CMD_AccountStatusGet 获取当前连接设置的状态 -CMD_AccountStatusGet_Help 指定注册到 VPN Client 的连接设置,且该连接设置当前已连接时,获取其连接状态和和其他信息。 -CMD_AccountStatusGet_Args AccountStatusGet [name] -CMD_AccountStatusGet_[name] 指定要获取信息的连接设置名。 - - -# AccountNicSet 命令 -CMD_AccountNicSet 设置连接设置时使用的虚拟 LAN 卡 -CMD_AccountNicSet_Help 更改注册到 VPN 客户上的现有的连接设置用于连接 VPN Server 的虚拟 LAN 卡名。 -CMD_AccountNicSet_Args AccountNicSet [name] [/NICNAME:nicname] -CMD_AccountNicSet_[name] 指定要更改设置的连接设置名。 -CMD_AccountNicSet_NICNAME 指定连接 VPN Server 时使用的虚拟 LAN 卡名。 - - -# AccountStatusShow 命令 -CMD_AccountStatusShow 设置成在连接到 VPN Server 时显示连接状态和错误的画面 -CMD_AccountStatusShow_Help 指定注册到 VPN Client 的连接设置且用其连接设置连接到 VPN Server 时,设置在计算机上显示连接状态和错误画面。 -CMD_AccountStatusShow_Args AccountStatusShow [name] -CMD_AccountStatusShow_[name] 指定要更改设置的连接设置名。 - - -# AccountStatusHide 命令 -CMD_AccountStatusHide 设置成在连接到 VPN Server 时不显示连接状态和错误的画面 -CMD_AccountStatusHide_Help 指定注册到 VPN Client 的连接设置且用其连接设置连接到 VPN Server 时,设置在计算机上不显示连接状态和错误画面。 -CMD_AccountStatusHide_Args AccountStatusHide [name] -CMD_AccountStatusHide_[name] 指定要更改设置的连接设置名。 - - -# AccountSecureCertSet 命令 -CMD_AccountSecureCertSet 将连接设置的用户认证类型设置为智能卡认证 -CMD_AccountSecureCertSet_Help 指定注册到 VPN Client 的连设置,将其连接设置连接到 VPN Server 时的用户认证方法设置为 [智能卡认证]。此外,必须指定存储在智能卡上的证书对象名和密钥对象名。 -CMD_AccountSecureCertSet_Args AccountSecureCertSet [name] [/CERTNAME:cert] [/KEYNAME:key] -CMD_AccountSecureCertSet_[name] 指定要更改设置的连接设置名。 -CMD_AccountSecureCertSet_CERTNAME 指定存储在智能卡中的证书对象名。 -CMD_AccountSecureCertSet_KEYNAME 指定存储在智能卡中的密钥对象名。 -CMD_AccountSecureCertSet_PROMPT_CERTNAME 智能卡证书对象名: -CMD_AccountSecureCertSet_PROMPT_KEYNAME 智能卡私匙对象名: - - -# PcAccountOpensslEngineCertSet -CMD_AccountOpensslCertSet_PROMPT_KEYNAME Specify the openssl engine specific key name: -CMD_AccountOpensslCertSet_PROMPT_ENGINENAME Specify the openssl engine name: - - -# AccountRetrySet 命令 -CMD_AccountRetrySet 设置连接设置的连接失败或断开时建立重新连接的次数和间隔 -CMD_AccountRetrySet_Help 指定注册到 VPN Client 的连接设置,且其连接设置试图连接到 VPN Server 时,还有连接中的与 VPN Server 的通信被断开或连接失败时,指定连接的重试次数和连接重试的间隔。\n而且,如果用户认证类型为 [智能卡认证] 时,不管连接重试次数如何设置,都将不进行连接重试。 -CMD_AccountRetrySet_Args AccountRetrySet [name] [/NUM:num_retry] [/INTERVAL:retry_interval] -CMD_AccountRetrySet_[name] 指定要更改设置的连接设置名。 -CMD_AccountRetrySet_NUM 指定连续进行重新连接的次数。 如指定 "999",重试次数为无限次 (永久连接)。如指定 "0",不进行重新连接。 -CMD_AccountRetrySet_INTERVAL 重新进行连接时,设置距离上次断开或连接失败后需多少秒开始重新连接处理。 -CMD_AccountRetrySet_PROMPT_NUM 重新连接次数 ("999" 为无限次): -CMD_AccountRetrySet_PROMPT_INTERVAL 重新连接间隔 (秒): -CMD_AccountRetrySet_EVAL_INTERVAL 请指定 5 秒以上的重新连接间隔。 - - -# AccountStartupSet 命令 -CMD_AccountStartupSet 设定连接设置的启动连接 -CMD_AccountStartupSet_Help 指定注册到 VPN Client 的连接设置,并将其设定为启动连接。设置为启动连接的连接设置,在 VPN Client 服务运行的同时将自动启动连接程序。 -CMD_AccountStartupSet_Args AccountStartupSet [name] -CMD_AccountStartupSet_[name] 指定要更改设置的连接设置名。 - - -# AccountStartupRemove 命令 -CMD_AccountStartupRemove 解除连接设置的启动连接 -CMD_AccountStartupRemove_Help 指定注册到 VPN Client 的连接设置,并把其连接设置设置为当前启动连接时,解除启动连接设置。 -CMD_AccountStartupRemove_Args AccountStartupRemove [name] -CMD_AccountStartupRemove_[name] 指定要更改设置的连接设置名。 - - -# AccountExport 命令 -CMD_AccountExport 导出连接设置 -CMD_AccountExport_Help 指定注册到 VPN Client 的连接设置,将其连接设置的内容作为文本文件导出。因为而后要导入被导出的连接设置,可以复制连接设置的内容。而且,因为以文本文件保存,可以用一般的文本编辑器进行编辑。\n导出目标文件,以 UTF-8 格式的文本文件保存。还有,如果在文件名称上添加 .vpn 的扩展名,因为能与 Windows 版 VPN Client 连接员产生关联,会很方便。 -CMD_AccountExport_Args AccountExport [name] [/SAVEPATH:savepath] -CMD_AccountExport_[name] 指定导出连接设置的连接设置名。 -CMD_AccountExport_SAVEPATH 指定保存目标文件名 -CMD_AccountExport_PROMPT_SAVEPATH 保存目标文件名 (推荐扩展 .vpn): - - -# AccountImport 命令 -CMD_AccountImport 导入连接设置 -CMD_AccountImport_Help 导入由 AccountExport 指令导出的连接设置文件,添加到 VPN 客户。 -CMD_AccountImport_Args AccountImport [path] -CMD_AccountImport_[path] 指定导入源文件名。 -CMD_AccountImport_PROMPT_PATH 导入源文件名: -CMD_AccountImport_FAILED_PARSE 不能正确解析指定的文件。请检查该文件是否已正确导出。 -CMD_AccountImport_OK 连接设置 "%s" 已导入。 - - - -# RemoteEnable 命令 -CMD_RemoteEnable 允许 VPN 客户服务的远程管理 -CMD_RemoteEnable_Help 对 VPN Client 服务,从本地主机以外的远程计算机上,允许通过命令行管理设施或 VPN Client 管理器员进行连接和管理。 -CMD_RemoteEnable_Args RemoteEnable - - -# RemoteDisable 命令 -CMD_RemoteDisable 禁止 VPN 客户服务的远程管理 -CMD_RemoteDisable_Help 对 VPN Client 服务,从本地主机以外的远程计算机上,禁止通过命令行管理设施或 VPN Client 管理器员进行连接和管理。 -CMD_RemoteDisable_Args RemoteDisable - - - - - - -################################################### -# # -# 下面这是VPN工具用的指令 # -# # -################################################### - - -# MakeCert 命令 -CMD_MakeCert 创建新的 X.509 证书和密钥 (1024 位) -CMD_MakeCert_Help 创建新的 X.509 证书和密钥,将其保存为一个文件。\n证书公共密钥和秘密密钥的生成算法使用 RSA 1024 位。\n作为证书类型,可以创建由根证书 (自签名证书) 和其他证书签名的某个证书。要创建由其他证书签名的证书,需要与用于签名的证书 (X.509格式文件) 相对应的密钥文件 (Base 64 编码)。\n\n创建的证书可以指定名称 (CN),所属机构 (O),组织单位 (OU),国家 (C),州 (ST),当地 (L),序列号,有效期限。\n创建的证书以 X.509 格式的文件,密钥文件以 RSA 1024 位的 Base 64 编码文件,被分别保存。\n\nMakeCert 指令是一个工具,它提供创建证书所需的最低功能。如果想创建一个真正的证书,建议使用 OpenSSL 等免费软件和出售的 CA (认证机构) 软件。\n\n※注意: 此指令可以从 SoftEther VPN 命令行管理工具调用。虽然目前以管理模式连接到 VPN Server 和 VPN Client 时可以运行,但要实际运行 RSA 演算,生成证书数据的,是运行此指令的计算机,和以管理模式连接的链接目标计算机没有任何关系。 -CMD_MakeCert_Args MakeCert [/CN:cn] [/O:o] [/OU:ou] [/C:c] [/ST:st] [/L:l] [/SERIAL:serial] [/EXPIRES:expires] [/SIGNCERT:signcert] [/SIGNKEY:signkey] [/SAVECERT:savecert] [/SAVEKEY:savekey] -CMD_MakeCert_CN 指定创建证书的名称 (CN) 项目。还可以指定 none。 -CMD_MakeCert_O 指定创建证书的所属机构 (O) 项目。还可以指定 none。 -CMD_MakeCert_OU 指定创建证书的组织单位 (OU) 项目。还可以指定 none。 -CMD_MakeCert_C 指定创建证书的国家 (C) 项目。还可以指定 none。 -CMD_MakeCert_ST 指定创建证书的州 (ST) 项目。还可以指定 none。 -CMD_MakeCert_L 指定创建证书的当地 (L) 项目。还可以指定 none。 -CMD_MakeCert_SERIAL 指定创建证书的序列号项目。以 16 进制指定。还可以指定 none。 -CMD_MakeCert_EXPIRES 指定创建证书的有效期限。如果指定 none 或 0,将被使用 3650 天 (约 10 年)。最大可以指定 10950 天 (约 30 年)。 -CMD_MakeCert_SIGNCERT 根据现有的证书对要创建的证书签名时,指定用来签名的 X.509 形式的证书文件名。如果省略参数,将作为根证书而创建没有签名的新证书。 -CMD_MakeCert_SIGNKEY 指定与 /SIGNCERT 指定的证书相应的密钥 (RSA,Base 64 的编码) -CMD_MakeCert_SAVECERT 指定文件名以保存创建的证书。该证书以包含 RSA 形式的 1024 位公开密钥的 X.509 文件格式被保存。 -CMD_MakeCert_SAVEKEY 指定文件名保存对应创建的证书的密钥。该密钥以 RSA 形式的 1024 位密钥文件被保存。 -CMD_MakeCert_PROMPT_CN 创建证书的名称 (CN): -CMD_MakeCert_PROMPT_O 创建证书的所属机构 (O): -CMD_MakeCert_PROMPT_OU 创建证书的组织单位 (OU): -CMD_MakeCert_PROMPT_C 创建证书的国家 (C): -CMD_MakeCert_PROMPT_ST 创建证书的州 (ST): -CMD_MakeCert_PROMPT_L 创建证书的当地 (L): -CMD_MakeCert_PROMPT_SERIAL 创建证书的序列号 (十六进制): -CMD_MakeCert_PROMPT_EXPIRES 创建证书的有效期限 (日): -CMD_MakeCert_PROMPT_SAVECERT 保存已创建证书的文件名: -CMD_MakeCert_PROMPT_SAVEKEY 保存已创建密钥的文件名: -CMD_MakeCert_EVAL_EXPIRES 请指定有效期限为 %u 以上 %u 以下。 -CMD_MakeCert_ERROR_SIGNKEY 无法读取以 /SIGNCERT 和 /SIGNKEY 指定的证明书和密钥或组合不正确。 -CMD_MakeCert_ERROR_GEN_FAILED 无法生成证书和私钥。 - - -# MakeCert2048 命令 -CMD_MakeCert2048 创建新的 X.509 证书和密钥 (2048 位) -CMD_MakeCert2048_Help 创建新的 X.509 证书和密钥,将其保存为一个文件。\n证书公共密钥和秘密密钥的生成算法使用 RSA 1024 位。\n作为证书类型,可以创建由根证书 (自签名证书) 和其他证书签名的某个证书。要创建由其他证书签名的证书,需要与用于签名的证书 (X.509 格式文件) 相对应的密钥文件 (Base 64 编码)。\n\n创建的证书可以指定名称 (CN),所属机构 (O),组织单位 (OU),国家 (C),州 (ST),当地 (L),序列号,有效期限。\n创建的证书以 X.509 格式的文件,密钥文件以 RSA 2048 位的 Base 64 编码文件,被分别保存。\n\nMakeCert 指令是一个工具,它提供创建证书所需的最低功能。如果想创建一个真正的证书,建议使用 OpenSSL 等免费软件和出售的 CA (认证机构) 软件。\n\n※注意: 此指令可以从 SoftEther VPN 命令行管理工具调用。虽然目前以管理模式连接到 VPN Server 和 VPN Client 时可以运行,但要实际运行 RSA 演算,生成证书数据的,是运行此指令的计算机,和以管理模式连接的链接目标计算机没有任何关系。 -CMD_MakeCert2048_Args MakeCert2048 [/CN:cn] [/O:o] [/OU:ou] [/C:c] [/ST:st] [/L:l] [/SERIAL:serial] [/EXPIRES:expires] [/SIGNCERT:signcert] [/SIGNKEY:signkey] [/SAVECERT:savecert] [/SAVEKEY:savekey] -CMD_MakeCert2048_CN 指定创建证书的名称 (CN) 项目。还可以指定 none。 -CMD_MakeCert2048_O 指定创建证书的所属机构 (O) 项目。还可以指定 none。 -CMD_MakeCert2048_OU 指定创建证书的组织单位 (OU) 项目。还可以指定 none。 -CMD_MakeCert2048_C 指定创建证书的国家 (C) 项目。还可以指定 none。 -CMD_MakeCert2048_ST 指定创建证书的州 (ST) 项目。还可以指定 none。 -CMD_MakeCert2048_L 指定创建证书的当地 (L) 项目。还可以指定 none。 -CMD_MakeCert2048_SERIAL 指定创建证书的序列号项目。以 16 进制指定。还可以指定 none。 -CMD_MakeCert2048_EXPIRES 指定创建证书的有效期限。如果指定 none 或 0,将被使用 3650 天 (约 10 年)。最大可以指定 10950 天 (约 30 年)。 -CMD_MakeCert2048_SIGNCERT 根据现有的证书对要创建的证书签名时,指定用来签名的 X.509 形式的证书文件名。如果省略参数,将作为根证书而创建没有签名的新证书。 -CMD_MakeCert2048_SIGNKEY 指定与 /SIGNCERT 指定的证书相应的密钥 (RSA,Base 64 的编码) -CMD_MakeCert2048_SAVECERT 指定文件名以保存创建的证书。该证书以包含 RSA 形式的 2048 位公开密钥的 X.509 文件格式被保存。 -CMD_MakeCert2048_SAVEKEY 指定文件名保存对应创建的证书的密钥。该密钥以 RSA 形式的 2048 位密钥文件被保存。 - - -# TrafficClient 命令 -CMD_TrafficClient 在用户模式下,运行网络流量速度测试工具 -CMD_TrafficClient_Help 运行通信吞吐量测量工具的客户端程序。\n通信吞吐量测量工具,作为 TrafficClient 和 TrafficServer 两个指令使用,可以测量在 IP 网络上连接的 2 台计算机之间可传送的通信吞吐量。在另一台计算机上使用 TrafficServer 指令使通信吞吐量测量工具服务器处于待机状态,用 TrafficClient 指令指定并连接其服务器的主机名或 IP 地址和端口号,测量通信速度。\n同时建立多个连接,计算各连接最大限度传送流数据的结果,及在指定时间内能够实际传送的数据的比特数,以此为依据计算通信吞吐量的平均值 (bps),用此方法进行通信速度的测量。通常,用一个 TCP 连接时,由于 TCP 算法的限制,大多数时候只能用比实际的网络吞吐量慢的速度通信。因此,建议测量同时建立多个 TCP 连接进行通信的结果。用此方法测量的吞吐量,以实际上作为 TCP 流到达接收方的数据的比特长度来计算,因此途中产生的数据包丢失和数据包损坏不包括在实际到达的数据包中,因而能够计算出纯粹的网络最大通信带宽的近似值。\n用作为测量结构的,在 TCP 内被传输的 TCP 流的大小,来计算在网络上实际传输的数据量的近似值,将其除以时间,计算出比特每秒 (bps)。假定计算的物理网络类型为以太网 (IEEE802.3) ,MAC 帧有效载荷的大小是 1,500 比特 (TCP 的 MSS 是 1,460 比特)。如果指定 /RAW 选项,不会对 TCP/IP 头和 MAC 头的数据量进行更正计算。\n\n※注意: 此指令可以从 SoftEther VPN 命令行管理工具调用。虽然目前以管理模式连接到 VPN Server 和 VPN Client 时可以运行,但要实际进行通信,测量吞吐量的,是运行此指令的计算机,与以管理模式连接的连接目标计算机没有任何关系。 -CMD_TrafficClient_Args TrafficClient [host:port] [/NUMTCP:numtcp] [/TYPE:download|upload|full] [/SPAN:span] [/DOUBLE:yes|no] [/RAW:yes|no] -CMD_TrafficClient_[host:port] 指定通信吞吐量测量服务器 (TrafficServer) 待机时的主机名,或 IP 地址和端口号。如果省略端口号,9821 将被使用。 -CMD_TrafficClient_NUMTCP 指定同时在客户端和服务器进行数据传输的 TCP 连接数量。如果省略,32 将被使用。 -CMD_TrafficClient_TYPE 指定进行吞吐量测量时的数据传输流方向。指定下列选项之一: "download","upload" 或 "full"。指定 "download",则数据从服务器端向客户端传送。指定 "upload",则数据从客户端向服务器端传送。指定 "full",数据将双向传送。当指定 "full" 时,NUMTCP 的值必须指定是 2 以上的偶数 (同时被连接的 TCP 连接中一半用于下载的方向,而另一半用于上传的方向)。如果省略此参数,将使用 "full"。 -CMD_TrafficClient_SPAN 以秒为单位指定为测量吞吐量而进行数据传输时间。如果省略此参数,"15秒" 将被使用。 -CMD_TrafficClient_DOUBLE 指定 "yes" 时,测量结果的吞吐量将显示为 2 倍。在中途有网络设备等,测量其其网络设备的输入输出合计的吞吐量能力时,此选项被使用。 -CMD_TrafficClient_RAW 通过指定 "yes",计算将不校正 TCP/IP 头和 MAC 头的数据量。 -CMD_TrafficClient_EVAL_NUMTCP TCP 连接的数量请在 32 以下指定。 -CMD_TrafficClient_PROMPT_HOST 测量服务器名称和端口号 (如果省略 9821): -CMD_TrafficClient_ERROR_NUMTCP 当数据的流向是 "full" (双向) 时,须将 TCP 连接数 (/NUMTCP) 指定为偶数值。 -CMD_TrafficClient_ERROR_HOSTPORT 指定的主机名或端口号不正确。 - - -# TrafficServer 命令 -CMD_TrafficServer 在服务器模式下,运行网络流量速度测试工具 -CMD_TrafficServer_Help 运行通信吞吐量测量工具的服务器程序。\n通信吞吐量测量工具,作为 TrafficClient 和 TrafficServer 两个指令使用,可以测量在 IP 网络上连接的 2 台计算机之间可传送的通信吞吐量。\n要使此计算机上的 TCP 端口处于待机状态,等待从另一台计算机的 TrafficClient 连接,启动 TrafficServer 指令并指定端口号。\n关于通信吞吐量测量工具的详细情况,输入 "TrafficClient ?" 将显示。\n\n※注意: 此指令可以从 SoftEther VPN 命令行管理工具调用。虽然目前以管理模式连接 VPN Server 和 VPN Client 时可以运行,但要进行实际通信并测量吞吐量的,是运行此指令的计算机,与用管理模式连接终端的计算机没有任何关系。 -CMD_TrafficServer_Args TrafficServer [port] [/NOHUP:yes|no] -CMD_TrafficServer_[port] 以整数指定等待连接的端口号。被指定的端口,如果已经由另一个程序在使用,或不能打开该端口时,将发生错误。 -CMD_TrafficServer_NOHUP When "yes" is specified, the server process never stops without regard to any input from the console. It is convenient when you want to run the TrafficServer endlessly. - - -# 关于 TrafficClient / TrafficServer 的内部信息字符串 -TT_LISTEN_FAILED 不能使 TCP 端口 %u 处于待机状态。该端口可能正被其他的程序使用或打开此端口的权限。 -TTS_LISTEN_STOP 关闭了待机端口。 -TTS_ENTER_TO_EXIT \n----------------------------------------\n在服务器模式下开启的网络流量速度测试工具。\n\n按下 Enter 键,停止服务器程序。\n----------------------------------------\n\n -TTS_INIT 运行服务器程序... -TTS_LISTEN_STARTED 启动了服务器程序。将 IPv4 的 TCP 端口 %u 处于待机状态,等待从客户端的连接。 -TTS_LISTEN_STARTED_V6 将 IPv6 的 TCP 端口 %u 处于待机状态,等待从客户端的连接。 -TTS_LISTEN_FAILED_V6 无法打开 IPv6 TCP 端口 %u。另一个应用程序可能正在使用同一个 IPv6 TCP 端口,或者没有安装 IPv6 协议栈在操作系统上。 -TTS_STOP_INIT 停止服务器程序... -TTS_STOP_FINISHED 停止服务器程序完成了。 -TTS_ACCEPTED 连接 %u: 从客户端 %S 的端口 %u 被连接了。 -TTS_DISCONNECTED 连接 %u 个 (%S) 被中断了。 -TTS_DISCONNECT 连接 %u (%S) 中断了。 -TTC_INIT 客户端程序启动... -TTC_FREE 客户端程序终止了。 -TTC_CONNECT_START 服务器 %S (端口 %u) 的连接将启动。%u 个 TCP 连接将实现连接。 -TTC_CONNECT_FAILED %u 个 TCP 连接接续失败。 -TTC_CONNECT_NOT_SERVER 除 TrafficServer 外其他程序在终端 TCP 端口运行,流量不能测量。 -TTC_CONNECT_OK %u 个 TCP 连接数已连接。 -TTC_CONNECT_OK_2 \ 数据传输方向: %s -TTC_ERROR_ABORTED 与服务器的 TCP 连接初始化失败。测量将停止。 -TTC_SUMMARY_BAR ------------------------------------------------------- -TTC_SUMMARY_TITLE 网络传输速度测试工具客户端设置参数。 -TTC_SUMMARY_HOST 终端主机名 -TTC_SUMMARY_PORT 终端 TCP 端口号 -TTC_SUMMARY_NUMTCP 建立的 TCP 连接数 -TTC_SUMMARY_TYPE 数据传输方向 -TTC_SUMMARY_SPAN 数据传输时间 -TTC_SUMMARY_ETHER 以太网帧数据校正 -TTC_SUMMARY_DOUBLE 中继器输入输出力合计速度的测量 -TTC_TYPE_DOWNLOAD 下载 (服务器 -> 客户端) -TTC_TYPE_UPLOAD 上传 (客户端 -> 服务器) -TTC_TYPE_FULL 双向 (服务器 <--> 客户端) -TTC_SPAN_STR %.1f 秒 -TTC_COMM_START 所有连接已经建立,数据传输开始。\n测量开始时间: %s\n预计完成时间: %s\n\n测量进行中。请稍后。\n(测量进行中,请不要使用其他应用程序。)\n\n -TTC_COMM_END 因为过了 %.1f 秒以上,数据通信将终止。\n\n -TTC_COMM_USER_CANCEL 由于用户取消,数据通信将终止。\n\n -TTC_COMM_DISCONNECTED TCP 连接 %u 已被断开。 -TTC_STOPPING 停止通信吞吐量测量工具客户端操作... -TTC_ENTER_TO_EXIT \n----------------------------------------\n在客户模式下开启网络传输速度测试工具。\n\n按下Enter键停止客户端程序。\n----------------------------------------\n\n -TTC_RES_TITLE \n\n网络传输速度测试工具 \n\n -TTC_RES_COLUMN_1 项目名称 -TTC_RES_COLUMN_2 正常查看 -TTC_RES_COLUMN_3 简化查看 -TTC_RES_SPAN 检测时的使用时间 -TTC_RES_ETHER 以太网帧数据校正 -TTC_RES_BYTES_DOWNLOAD 下载通信数据量 -TTC_RES_BYTES_UPLOAD 上载通信数据量 -TTC_RES_BYTES_TOTAL 总通信数据量 -TTC_RES_DOUBLE 中继器输入输出总吞吐量计算 -TTC_RES_BPS_DOWNLOAD 下载方向的平均吞吐量 -TTC_RES_BPS_UPLOAD 上传方向的平均吞吐量 -TTC_RES_BPS_TOTAL 总平均吞吐量 - - -# Check 命令 -CMD_Check 检测 SoftEther VPN 是否能正常运行 -CMD_Check_Help 正在运行 vpncmd 的计算机上,正检测 SoftEther VPN Server / Bridge 的运行平台是否适合。\n通过了这一检查的系统,SoftEther VPN 软件有较高的可能性进行正常运行。此外,无法通过此检查的系统,如果使用了 SoftEther VPN 软件可能会发生一些问题。 -CMD_Check_Args Check - - -# 关于系统 checker -# (包含着一部分奇怪的字符串,不过,是检测字符编码变换用的) -CHECK_TITLE ---------------------------------------------------\nSoftEther VPN 运行环境检查工具\nDeveloper Edition\n\nCopyright (c) all contributors on SoftEther VPN project in GitHub.\nCopyright (c) Daiyuu Nobori, SoftEther Project at University of Tsukuba, and SoftEther Corporation.\nAll Rights Reserved.\n\n -CHECK_NOTE 如果运行了此运行环境检测工具的系统通过了测试,SoftEther VPN 软件有较高的运行可能性。检测可能需要一定的时间。请稍候...\n\n -CHECK_EXEC_TAG '%s' 的检测中...\n -CHECK_PASS [合格] ○ -CHECK_FAIL [不合格] × -CHECK_RESULT_1 全部检测通过,说明 SoftEther VPN Server / Bridge 在此系统上正常运行的可能性很高。 -CHECK_RESULT_2 一部分的检测结果是不合格。请确认系统的运行环境。如果在这个系统上实行 SoftEther VPN Server / Bridge,有发生问题的可能性。 -CHECK_TEST_123456789 123456789 - - -CHECK_PROC_KERNEL 内核系统 -CHECK_PROC_MEMORY 存储器操作系统 -CHECK_PROC_STRINGS ANSI / Unicode 字符串处理系统 -CHECK_PROC_FILESYSTEM 文件系统 -CHECK_PROC_THREAD 线程处理系统 -CHECK_PROC_NETWORK 网络系统 - - -###################################################### -# # -# 安装向导(SW)字符串 # -# # -###################################################### - -SW_TITLE SoftEther VPN Developer Edition 安装向导 (版本 %S) -SW_EXIT_CONFIRM SoftEther VPN 的安装未完成。\r\n\r\n您确定要退出吗? -SW_UNINSTALL_CONFIRM 开启%s卸载程序。\r\n\r\n您确定要继续吗? - - -SW_COMPONENT_VPNSERVER_TITLE SoftEther VPN Server -SW_COMPONENT_VPNSERVER_DESCRIPTION 把它安装在服务器计算机上作为 VPN 的中心站点。管理工具也会同时安装。 - -SW_COMPONENT_VPNCLIENT_TITLE SoftEther VPN Client -SW_COMPONENT_VPNCLIENT_DESCRIPTION 安装它在 VPN Client 电脑上。VPN Client 台电脑将能连接到中心 VPN Server 了。管理工具也会同时安装。 - -SW_COMPONENT_VPNBRIDGE_TITLE SoftEther VPN Bridge -SW_COMPONENT_VPNBRIDGE_DESCRIPTION 安装它在每个站点的电脑上。每个 VPN Bridge 将会建立一个通向中心 VPN Server 的 VPN 连接。管理工具也会同时安装。 - -SW_COMPONENT_VPNSMGR_TITLE SoftEther VPN Server 管理工具 (仅限管理工具) -SW_COMPONENT_VPNSMGR_DESCRIPTION 安装的只有 VPN Server 管理工具。不会安装 VPN Server 服务程序。您可以在 Windows, Linux, Mac OS X, Solaris, FreeBSD 的系统上使用此 VPN Server 管理工具进行连接和管理远程的 VPN Server / Bridge 端。 - -SW_COMPONENT_VPNCMGR_TITLE SoftEther VPN Client 管理工具(仅限管理工具) -SW_COMPONENT_VPNCMGR_DESCRIPTION 安装的只有 VPN Client 管理工具。不会安装 VPN Client 服务程序。您可以在 Windows 或 Linux 的系统上使用此 VPN Client 管理工具进行连接和管理远程的 VPN Client 。 - -SW_WELCOME_TITLE 欢迎来到 SoftEther VPN Developer Edition 安装向导 -SW_MODE_TITLE 选择一个安装模式 -SW_NOT_ADMIN_TITLE 没有足够权限 -SW_COMPONENTS_TITLE 选择安装一个软件部分 -SW_EULA_TITLE 最终用户许可协议 -SW_WARNING_TITLE 重要信息 -SW_DIR_TITLE 安装目录 -SW_READY_TITLE 准备安装l -SW_PERFORM_TITLE 安装正在进行中 -SW_ERROR_TITLE 安装结果 -SW_FINISH_TITLE 安装结束 -SW_UNINST1_TITLE 卸载程序r -SW_LANG1_TITLE SoftEther VPN : 配置显示语言 -SW_EASY1_TITLE 欢迎来到 SoftEther VPN Client 简单安装程序创建工具 -SW_EASY2_TITLE 指定文件夹 -SW_WEB1_TITLE 欢迎来到 SoftEther VPN Client Web安装程序创建工具 -SW_WEB2_TITLE 指定文件夹 - -SW_UNINSTALLINFO_URL http://selinks.org/ -SW_UNINSTALLINFO_PUBLISHER SoftEther VPN Project - -SW_KB3033929_REQUIRED 在 Windows 7 以及 Windows Server 2008 R2系统上, SoftEther VPN 的一些功能需要安全更新程序KB3033929。\r\n\r\n如果 KB3033929 未在你的系统中安装, 在安装SoftEther VPN 前请从 Windows Update 或 Microsoft 网站上下载安装该更新程序。 - - -SW_COMPONENTS_ABOUT_TAG 关于 %s -SW_COMPONENTS_REQUIRE_ADMIN 安装需要管理员权限 -SW_COMPONENTS_REQUIRE_ADMIN_TEXT 您需要一个有管理权限的用户来重启本安装向导,并以系统模式安装 %s。以系统模式安装,请点击后退。 -SW_DIR_SELECT 请指定安装目录 -SW_DIR_MORE_THAN_110 目录名太长。\r\n最多指定 110 个字母. -SW_DIR_WRITE_ERROR 无法创建指定的目录 "%s",或在目录中写入文件失败。\r\n\r\n指定另外一个目录。 -SW_DIR_DST_IS_SAME_TO_SRC 指定的目录 "%s" 与源目录相同。 -SW_DIR_IS_NOT_HDD 指定的目录 "%s" 不在本地硬盘驱动上。\r\n\r\n要 "%s" 在系统模式下安装,您必须指定一个在本地硬盘驱动上的目录。 -SW_DIR_IS_NOT_FULLPATH 目录 "%s" 不是全路径格式。\r\n\r\n请指定一个全路径目录。 -SW_DIR_DST_IS_OTHER_PRODUCT 指定的目录已经有另一个部分已安装。\r\n\r\n请指定另外一个目录。 -SW_DIR_DST_IS_NEWER 本软件的更新版本已经安装到指定目录。\r\n\r\n您不必安装本版本。 -SW_DIR_DST_IS_NEWER_2 本软件的更新版本已经安装到指定目录。\r\n\r\n本安装程序将导入和应用已嵌入在简单安装工具中的 VPN 连接设置。程序文件不会被覆盖。 -SW_DIR_DST_IS_BROKEN 无法读取指定目录下的文件 "%s"。\r\n\r\n请指定另外一个目录。 -SW_DIR_DST_IS_SYSTEM_MODE 同样的软件已经在指定目录中以系统模式安装。\r\n\r\n请指定另外一个目录。 -SW_DIR_DST_IS_USER_MODE 同样的软件已经在指定目录中以用户模式安装。\r\n\r\n请指定另外一个目录。 -SW_SYSTEM_MODE_ALREADY_INSTALLED 本软件 "%s" 以系统模式被安装在这台电脑上。\r\n\r\n同样的软件以用户模式和系统模式安装在同一台电脑上会发生冲突。\r\n\r\n您确定要以用户模式继续进行安装? - -SW_SETUPLOG_CORRUPTED "setuplog.dat" 文件已被破坏。 -SW_MSI_UNINSTALL_FAILED 之前的版本 %s (产品号: "%S")已安装。 Windows安装工具卸载旧版本失败。\r\n\r\n请您手动卸载并且重启本安装工具。 -SW_MSI_UNINSTALL_REBOOT_REQUIRED Windows 安装工具已经卸载旧版本 %s。请重启电脑。\r\n\r\n点击结束按钮并且手动重启电脑,然后在电脑重启后,重启本安装工具。 -SW_NOTICE_VPNSERVER_IS_INSTALLED SoftEther VPN Bridge 端作为软件一部分来安装。但是,本电脑已经安装了 SoftEther VPN Server。\r\n\r\n通常,您不需要在同一台电脑上同时安装 SoftEther VPN Server 端和 SoftEther VPN Bridge 端。\r\n如果您同时安装了这两个软件,那么有些冲突就会发生,例如端口号重复。\r\n如果您想把 SoftEther VPN Server 端替换成 SoftEther VPN Bridge 端,您应该退出本安装工具,卸载 SoftEther VPN Server 端,并在卸载成功后重启本安装工具。\r\n\r\n您确定要继续 SoftEther VPN Bridge 端的安装吗? -SW_NOTICE_VPNBRIDGE_IS_INSTALLED SoftEther VPN Server 端被选为一个部分来安装。但是,本电脑已安装 SoftEther VPN Bridge 端。通常,您不需要在同一台电脑上同时安装 SoftEther VPN Server 端和 SoftEther VPN Bridge 端。\r\n如果您同时安装了这两个软件,那么有些冲突就会发生,例如端口号重复。\r\n如果您想把 SoftEther VPN Bridge 替换成 SoftEther VPN Server 端,您应该退出本安装工具,卸载 SoftEther VPN Bridge,并在卸载成功后重启本安装工具。\r\n\r\n您确定要继续 SoftEther VPN Server 端的安装吗? -SW_OS_FAILED 本操作系统不支持%s. -SW_LANG_NOT_CHANGED %s的语言设置没有改变。 -SW_LANG_LIST_LOAD_FAILED 载入可用语言列表失败。 -SW_LANG_OK 显示语言 %s 修改成功。\r\n如果目前 %s程序正在运行,请退出并重启,以改变显示语言。如果显示语言依然未改变,请重启 Windows。\r\n -SW_LANG_OK_SERVICE 记录服务程序的日志文件的语言会在重启后修改。 -SW_LANG_OK_VPNCMGR \r\n在退出和重启 VPN Client 管理器之后,其显示设置将会改变。 (包括任务托盘的彻底终止) -SW_CHILD_PROCESS_ERROR 子进程执行失败。 -SW_EXE_FILTER Windows 可执行文件 (*.EXE)|*.exe|All Files (*.*)|*.* -SW_PERFORM_MSG_EASY_INFO 编辑 VPN Client 简单安装工具 -SW_EASY_FINISHED_MSG VPN Client 简单安装工具创建成功。\r\n本安装工具保存为如下文件名。\r\n\r\n%s\r\n\r\n您可以在公司里分配以上的文件。 -SW_EASY_ERROR_MSG VPN Client 简单安装工具创建失败。 -SW_OTHER_INSTANCE_EXISTS 另外一个 SoftEther VPN 安装向导正在运行中\r\n\r\n您可以在那个向导退出后,继续运行此向导。 -SW_PERFORM_MSG_WEB_INFO 编译 VPN Client Web安装工具 -SW_WEB_ERROR_MSG VPN Client Web 安装工具创建失败。 -SW_INSTALLER_CACHE_IS_NOT_SIGNED 目前已安装 SoftEther VPN Client 的这台电脑没有安 SoftEther 公司签署 Authenticode 数字证书的数字签名包。\r\n它有可能是从一个客户定制的安装工具上安装的(例如:简单安装程序生成器制造的一个安装程序。)\r\n\r\n如果您继续创建 Web 安装工具,当下载的时候,会在用户界面上出现一个警示信息。\r\n为避免出现警示信息,您需要取消本创建向导,从 SoftEther 公司官网下载最新版本的 SoftEther VPN Client,重新安装并开启本 Web 安装工具创建器向导。\r\n\r\n你确定要继续创建一个 Web 安装工具吗? -SW_FILE_NOT_FOUNT 没有找到文件 "%s" -SW_WEB_FINISHED Web安装工具已创建,并保存为 "%s"。\r\n\r\n请将 ZIP 文件解压缩,并将解压后的文件上传到 Web 服务器,编辑一个HTML文件和一个 inf 文件来适当替换URL。\r\n\r\n部署 Web 安装程序的解释说明在ZIP文件中描述。 - -SW_VG_CONFIRM_MSG 您想用 SoftEther VPN 客户端安装并激活 VPN Gate P2P 中继功能的插件吗 ?\r\n\r\n本插件可以规避官方防火墙的限制实现通信的稳定性。同时 VPN Gate 的通信经常会消耗一定的网络带宽。所以不推荐在移动连接上使用 VPN Gate。\r\n\r\n请注意,一些国家和地区有规定禁止加密通信绕过官方防火墙。在这种情况下,请您不要在您的计算机上使用 VPN Gate 功能。VPN Gate 主要在日本使用。VPN Gate 仅仅是一个学术研究项目。VPN Gate 受日本法律管辖。使用此软件和服务期间,请您遵守本国相关的法律法规,这是您自己的责任。您将完全承担使用此软件和服务造成的任何损失和责任,不管在日本境内还是境外。 - - - - -SW_PERFORM_MSG_INIT_TASKS 准备任务... -SW_PERFORM_MSG_COPY_PREPARE 准备复制文件... -SW_PERFORM_MSG_WRITE_ERROR 写入目标文件 "%s" 失败。\r\n\r\n可能有另外一个项目正在使用该文件。\r\n如果程序或者服务%s正在运行,请关闭,并点击重试。 -SW_PERFORM_MSG_COPY_FILE 正在复制 "%s" ... -SW_PERFORM_MSG_SET_SECURITY 在 "%s" 设置安全系统 -SW_PERFORM_MSG_PLUGIN 插件安装中... -SW_PERFORM_MSG_STOP_SVC 停止 "%s" 的服务 -SW_PERFORM_MSG_WAIT_FOR_FILE_UNLOCK 文件 "%s" 被一个正在运行的程序锁定。正等待解锁... -SW_PERFORM_MSG_INSTALL_SVC 安装 %s 服务... -SW_PERFORM_MSG_START_SVC 开始 %s 服务... -SW_PERFORM_MSG_CREATE_LINKS 创建快捷方式文件夹... -SW_PERFORM_MSG_DELETE_LINKS 删除快捷方式文件夹... -SW_PERFORM_MSG_DELETE_OLD_LINKS 删除旧的快捷方式文件夹... -SW_PERFORM_MSG_REGISTER_UNINSTALL 在控制面板注册卸载信息... -SW_PERFORM_MSG_IMPORTING_ACCOUNT 在简单安装工具中的导入嵌入的 VPN 连接设置... -SW_PERFORM_MSG_DELETE_SETUP_INFO 删除安装信息和日志... -SW_PERFORM_MSG_WRITE_LOG 写入一个设置日志... -SW_PERFORM_MSG_COPY_ERROR 复制文件 "%s" 失败。 -SW_PERFORM_MSG_CREATE_LINK_ERROR 创建快捷方式文件 "%s" 失败。\r\n\r\n您要重试吗? -SW_PERFORM_MSG_WRITE_LOG_ERROR 安装日志文件 "%s" 创建中。\r\n\r\n您要重试吗? -SW_PERFORM_MSG_STOP_SVC_ERROR 关闭 "%s" 服务(内部名: "%S")失败。 -SW_PERFORM_MSG_START_SVC_ERROR 开启 "%s" 服务(内部名: "%S")失败。 -SW_PERFORM_MSG_SVC_UNINSTALL_FAILED 卸载 "%s" 服务(内部名: "%S")失败。 -SW_PERFORM_MSG_SVC_INSTALL_FAILED 安装 "%s" 服务(内部名: "%S")失败。 -SW_PERFORM_MSG_SVC_USERMODE_EXEC_FAILED 开启用户模式 %s 服务失败。 -SW_PERFORM_MSG_UPDATING 系统设置更新中... -SW_PERFORM_MSG_DELETE_NIC 移除虚拟网络适配器... -SW_PERFORM_MSG_FINISHED 安装进程结束。 -SW_PERFORM_MSG_UNINSTALL_MSI Windows 安装工具正在卸载旧版本 %s... -SW_PERFORM_MSG_UPDATE_LANG_CONFIG 修改语言设置... - -SW_PERFORM_MSG_INIT_UNINST 正准备卸载... -SW_PERFORM_MSG_DELETE_PREPARE 正准备删除文件... -SW_PERFORM_MSG_DELETE_ERROR 删除文件 "%s" 失败。\r\n\r\n可能有另外一个程序正在使用该文件。\r\n如果程序或服务 %s 正在运行,请关闭,并点击重试。 -SW_PERFORM_MSG_UNINSTALL_SVC 服务 "%s" 卸载中... -SW_PERFORM_MSG_DELETE 正在删除服务 "%s" ... -SW_PERFORM_MSG_EASY_INIT 创建简单安装工具... -SW_PERFORM_MSG_WEB_INIT 创建 Web 安装工具... -SW_PERFORM_MSG_INSTALL_SELOW 一个系统还原点创建中并安装必要成分。这可能需要一段时间... - - - -SW_TAG_USERNAME \ (用户模式) -SW_DIRNAME_CONFIG_TOOLS 配置工具 -SW_DIRNAME_ADMIN_TOOLS 管理工具 -SW_DIRNAME_LANGUAGE_TOOLS 语言设置 - -SW_RUN_TEXT_VPNSMGR 开启 SoftEther VPN Server 管理工具 -SW_RUN_TEXT_VPNCMGR 开启 SoftEther VPN Client 管理工具. - -SW_NIC_UNINSTALL SoftEther VPN 客户端的虚拟网络适配器已在系统上创建。\r\n你要删除这些虚拟网络适配器? - -# --- Do not translate this section !!! stay them in English !!! --- -SW_TAG_USERNAME_ENGLISH \ (User-Mode) -SW_LINK_NAME_VPNSERVER_SVC SoftEther VPN Server Developer User-mode Service -SW_LINK_NAME_VPNBRIDGE_SVC SoftEther VPN Bridge Developer User-mode Service -SW_LONG_VPNSERVER SoftEther VPN Server Developer Edition -SW_LONG_VPNCLIENT SoftEther VPN Client Developer Edition -SW_LONG_VPNBRIDGE SoftEther VPN Bridge Developer Edition -SW_LONG_VPNSMGR SoftEther VPN Server Manager Developer Edition -SW_LONG_VPNCMGR SoftEther VPN Client Manager Developer Edition -SW_LANG_SET_FAILED Failed to write the new language setting on lang.config file. -# --- end of "Do not translate this section" --- - - -# 快捷方式文件名 -SW_LINK_NAME_VPNSMGR_SHORT SoftEther VPN Server 管理工具 (Dev) -SW_LINK_NAME_VPNSMGR_SHORT_UM SE-VPN Server Manager (Dev User) -SW_LINK_NAME_VPNSMGR_SHORT_TOOLSONLY SE-VPN Server Manager (Dev Tools) -SW_LINK_NAME_VPNSMGR_SHORT_TOOLSONLY_UM SE-VPN Server Manager (Dev User Tools) -SW_LINK_NAME_VPNSMGR_FULL SoftEther VPN Server 管理工具 Developer Edition -SW_LINK_NAME_VPNSMGR_COMMENT 您在一个远程计算机上可以管理 SoftEther VPN Server 或者 SoftEther VPN Bridge 端。 - -SW_LINK_NAME_VPNCMGR_SHORT SoftEther VPN Client 管理工具 (Dev) -SW_LINK_NAME_VPNCMGR_FULL SoftEther VPN Client 管理工具 Developer Edition -SW_LINK_NAME_VPNCMGR_COMMENT 您可以通过使用 SoftEther VPN Client 连接到 VPN Server。 - -SW_LINK_NAME_VPNCMGRTOOLS_SHORT SoftEther VPN Client 远程管理工具 (Dev) -SW_LINK_NAME_VPNCMGRTOOLS_SHORT_UM SE-VPN Client Remote Manager (Dev User) -SW_LINK_NAME_VPNCMGRTOOLS_FULL SoftEther VPN Client 远程管理工具 Developer Edition - -SW_LINK_NAME_VPNCMGR2_FULL 管理远程电脑上的 SoftEther VPN Client -SW_LINK_NAME_VPNCMGR2_COMMENT 您可以建立一个远程连接来管理远程电脑上的 SoftEther VPN Client 。 - -SW_LINK_NAME_VPNCMGRTRAY_FULL SoftEther VPN Client Manager Developer Edition Startup -SW_LINK_NAME_VPNCMGRTRAY_COMMENT 在任务栏的通知区域注册一个 SoftEther VPN Client Developer Edition图标。 - -SW_LINK_NAME_EASYINSTALLER 简单安装工具创建工具 -SW_LINK_NAME_EASYINSTALLER_COMMENT 为公司系统管理员创建 SoftEther VPN Client 简单安装工具的工具,有自动快速启动到指定目标 VPN 连接的功能。 - -SW_LINK_NAME_WEBINSTALLER Web安装工具创建工具 -SW_LINK_NAME_WEBINSTALLER_COMMENT 为公司系统管理员创建 SoftEther VPN Client Web安装工具(ActiveX 安装工具)的工具,有自动快速启动到指定目标 VPN 连接的功能。 - - -SW_LINK_NAME_VPNCMD SoftEther VPN 命令行实用工具(vpncmd) -SW_LINK_NAME_VPNCMD_COMMENT 用 vpncmd 在命令行界面管理 SoftEther VPN Server , SoftEther VPN Bridge 端和 SoftEther VPN Client 。 -SW_LINK_NAME_TRAFFIC 网络传输速度测量工具 -SW_LINK_NAME_TRAFFIC_COMMENT 工具执行用 TCP/IP 连接的两台电脑之间的数据包传输,会用尽量大的吞吐量,从而测量出精确的网络可用传输速度。本工具不仅限于 VPN,也可以用在物理网络中。 -SW_LINK_NAME_TCP TCP/IP 优化实用工具 -SW_LINK_NAME_TCP_COMMENT TCP/IP 优化实用工具可以调节 Windows 的 TCP/IP 参数,以提高本电脑的网络通信吞吐量。 -SW_LINK_NAME_SERVICES 服务正在本电脑运行 -SW_LINK_NAME_SERVICES_COMMENT 开始,结束和配置 Windows 服务。您可以开启和关闭 SoftEther VPN 服务。 -SW_LINK_NAME_VPNSERVER_SVC_COMMENT 使用用户模式开启 SoftEther VPN Server 服务。 -SW_LINK_NAME_VPNBRIDGE_SVC_COMMENT 使用用户模式开启 SoftEther VPN Bridge 服务。 - -SW_LINK_NAME_UNINSTALL 卸载 %s -SW_LINK_NAME_UNINSTALL_COMMENT 在本电脑中卸载 %s -SW_LINK_NAME_LANGUAGE 配置显示语言 -SW_LINK_NAME_LANGUAGE_COMMENT 修改 %s 的显示语言设置。 - -SW_LINK_NAME_DEBUG 调试信息采集工具 -SW_LINK_NAME_DEBUG_COMMENT 采集 SoftEther VPN 的调试信息。仅在您的支持人员要求你这样做时使用此工具。 - - +# Copyright (c) all contributors on SoftEther VPN project in GitHub. +# Copyright (c) Daiyuu Nobori, SoftEther Project at University of Tsukuba, and SoftEther Corporation. +# +# https://www.softether.org/ +# +# Contributors: +# - YF (https://github.com/yfdyh000) + + +########################################################################### +# # +# 软件内的消息等的字符串数据 # +# (对话框资源字符串以外) # +# # +########################################################################### + + + +# 环境参数 +DEFAULT_FONT SimSun +DEFAULT_FONT_HIGHDPI Microsoft YaHei +DEFAULT_FONT_2 SimSun +DEFAULT_FONT_SIZE 9 +DEFAULT_LOCALE 年 月 日 点 分 秒 星期日 星期一 星期二 星期三 星期四 星期五 星期六 天 小时 分 秒 (无) + + +# 语言 +# (0: 日语, 1: 英语, 2: 中文) +LANG 2 +LANGSTR Simplified_Chinese + +STRTABLE_ID SE_VPN_20121007 + +CM_JAPANESE_ONLY_OLD_STARTUP %s\\SoftEther VPN Client 2.0 タスクトレイ.lnk + + +# 软件信息 +PRODUCT_NAME_VPN_CLI SoftEther VPN Client Developer Edition +PRODUCT_NAME_VPN_CMGR SoftEther VPN Client Developer Edition 管理器 +PRODUCT_NAME_VPN_SVR SoftEther VPN Server Developer Edition +PRODUCT_NAME_VPN_BRIDGE SoftEther VPN Bridge Developer Edition +PRODUCT_NAME_VPN_SMGR SoftEther VPN Server Developer Edition 管理器 +PRODUCT_NAME_ELOGSVC SoftEther EtherLogger Developer Edition +PRODUCT_NAME_ELOGMGR SoftEther EtherLogger Developer Edition 管理器 + + +# BRANDED_C_TO_S Branded_VPN +# BRANDED_C_FROM_S Branded_VPN + +# CLIENT_ID 123 + +# Family Name for Software Update Check +PRODUCT_FAMILY_NAME SoftEtherDev + +# 产品信息 +SE_COMPANY_URL https://selinks.org/?se +SE_VPNAZURE_URL https://selinks.org/?vpnazure + +# 共通字符串 +COMMON_UNKNOWN (未知) + + +# 协议错误字符串 +ERR_UNKNOWN 发生未知的错误。 +ERR_0 没有任何错误。 +ERR_1 服务器连接失败。请检查网络连接,确保目标服务器地址和端口正确。 +ERR_2 协议错误。目标服务器返回错误。 +ERR_3 连接中断。 +ERR_4 协议错误。 +ERR_5 非 SoftEther VPN 软件客户端已连接到该端口。 +ERR_6 命令被用户取消。 +ERR_7 服务器拒绝指定的认证方式。 +ERR_8 指定的虚拟 HUB 在该服务器上不存在。 +ERR_9 用户身份验证失败。 +ERR_10 指定的虚拟 HUB 目前已停止。等待一段时间,然后重新连接。 +ERR_11 VPN 会话已删除。可能是从客户端到 VPN 服务器的连接被断开或管理员中断了此会话。 +ERR_12 访问被拒绝。 +ERR_13 VPN 通信会话超时。有可能是从客户端连接到 VPN 服务器的连接已断开。 +ERR_14 协议号无效。 +ERR_15 过多的 TCP/IP 连接。 +ERR_16 连接到目标服务器或虚拟 HUB 的会话太多。 +ERR_17 连接到代理服务器失败。 +ERR_18 代理服务器错误。 +ERR_19 代理服务器用户身份验证失败。 +ERR_20 由同一用户发起的连接会话过多。其他用户可能被作为同一用户连接到虚拟 HUB。 +ERR_21 VPN Server 的软件许可发生错误。请与 VPN 服务器的管理员联系。 +ERR_22 无法访问虚拟网络适配器的设备驱动程序。检查虚拟网络适配器安装并确保它不是禁用。 +ERR_23 发生内部错误。 +ERR_24 访问智能卡或 USB 硬件令牌设备失败。 +ERR_25 PIN 码错误。 +ERR_26 在智能卡或 USB 硬件令牌设备上找不到指定的证书。 +ERR_27 在智能卡或 USB 硬件令牌设备上找不到指定的密钥。 +ERR_28 对智能卡或 USB 硬件令牌设备的写操作失败。 +ERR_29 找不到对象。 +ERR_30 指定名称的虚拟网络适配器已存在。请指定一个不同的名称。 +ERR_31 虚拟网络适配器的设备驱动程序安装失败。 +ERR_32 您不能使用虚拟网络适配器设备的指定名称。 +ERR_33 不支持的。 +ERR_34 指定名称的 VPN 连接设置已存在。 +ERR_35 指定的 VPN 连接设置当前已连接。 +ERR_36 指定的 VPN 连接设置不存在。 +ERR_37 指定的 VPN 连接设置未连接。 +ERR_38 无效的参数。 +ERR_39 智能卡或 USB 硬件令牌设备错误。 +ERR_40 智能卡或 USB 硬件令牌认证被选中,但要进行认证的设备没有被选中。请从连接管理器的“智能卡” 菜单进行选择。 +ERR_41 至少有一个 VPN 连接设置正在被指定的虚拟网络适配器使用。\r\n请删除当前正在使用指定虚拟网络适配器的 VPN 连接设置,或为此 VPN 连接设置指定另一个虚拟网络适配器。 +ERR_42 找不到指定的 VPN 连接设置所使用的虚拟网络适配器。\r\n确保此虚拟网络适配器存在。另外,请确保虚拟网络适配器设备没有被禁用。\r\n\r\n如果你解决不了此问题,可以更改 VPN 连接设置使用的虚拟网络适配器,或者创建一个新的同名虚拟网络适配器。 +ERR_43 由指定的 VPN 连接设置使用的虚拟网络适配器当前被另一个 VPN 连接设置所占用。\r\n如果有另一个 VPN 连接设置正在使用同一个虚拟网络适配器,需断开 VPN 连接设置。 +ERR_44 由指定的 VPN 连接设置使用的虚拟网络适配器已禁用。\r\n在使用此 VPN 连接设置前,请启用虚拟网络适配器。 +ERR_45 指定值无效。 +ERR_46 连接目标不是群集控制器。 +ERR_47 尝试连接。 +ERR_48 连接群集控制器失败。 +ERR_49 群集控制器无法分配一个新的会话到群集上。 +ERR_50 无法管理群集成员服务器的虚拟 HUB。 +ERR_51 用于连接的用户密码是空的,所以远程连接被禁止。如果使用空密码,只允许连接本地主机 (127.0.0.1) 的 VPN 服务器。 +ERR_52 没有足够的权限。 +ERR_53 找不到指定的监听器。 +ERR_54 指定监听端口号已经存在。 +ERR_55 这不是一个群集成员服务器。 +ERR_56 不支持指定的加密算法名。 +ERR_57 具有指定名称的虚拟 HUB 已经存在于服务器上。 +ERR_58 已存在过多虚拟 HUB。请删除过期的虚拟 HUB 以释放资源,供新的虚拟 HUB 使用。 +ERR_59 具有指定名称的级联已经存在。 +ERR_60 群集的服务器上不能创建级联。 +ERR_61 指定的级联处于脱机状态。 +ERR_62 访问列表过多。 +ERR_63 用户过多。 +ERR_64 组过多。 +ERR_65 指定的组不存在。 +ERR_66 虚拟 HUB 上已存在指定名称的用户。 +ERR_67 虚拟 HUB 上已存在指定名称的群。 +ERR_68 具有指定名称的用户在服务器上已存在,但身份验证类型不是密码验证。无法更改密码。 +ERR_69 用户名或旧密码输入不正确。请注意密码有大小写区分。 +ERR_70 埼玉。 +ERR_71 因应日本经济产业省命令,SoftEther 暂停当前配发。 +ERR_72 因应 IPA 命令,SoftEther 暂停当前配发。 +ERR_73 无法断开级联会话。要删除会话,请停止级联。 +ERR_74 VPN Server 的连接设置未完成。请先完成 VPN 连接设置。 +ERR_75 虚拟专用网 VPN Server 连接已经开始。 +ERR_76 未连接到 VPN Server。 +ERR_77 指定的 X509 证书文件不包含 RSA 1024 bit,1536 bit,2048 bit,3072 bit 位或 4096 bit 的公共密钥。SoftEther VPN 软件仅支持 RSA 1024 bit,1536 bit,2048 bit,3072 bit 位或 4096 bit 证书。 +ERR_78 无法断开 SecureNAT 会话。要删除会话,请停止 SecureNAT 功能。 +ERR_79 无法在群集环境中启用 SecureNAT。 +ERR_80 SecureNAT 未开始工作。 +ERR_81 至 VPN Server 的 VPN 连接会话被网络管理员安装的防火墙设备中断。请联络网络管理员以获取进一步信息。 +ERR_82 无法断开本地网桥会话。要删除会话,请停止本地网桥。 +ERR_83 本地网桥未开始工作。 +ERR_84 目标 VPN Server 无法使用本地网桥。参考在线帮助或其他文档以获取在指定 VPN Server 上使用本地网桥的设置方法。 +ERR_85 无法信任目标服务器提供的证书。始终验证服务器证书在 VPN 连接设置中被启用。请注册一个可信任的根证书或注册一个单独的证书。 +ERR_86 目标服务器的产品代码不正确。无法从此客户端连接。 +ERR_87 客户端和服务端软件版本不同。请更新软件。 +ERR_88 无法添加捕获设备。很可能同一捕获设备已经注册。 +ERR_89 无法从该客户端连接到目标服务器。一个特殊客户端软件是必需的。 +ERR_90 指定捕获设备未注册。 +ERR_91 无法断开虚拟 3 层交换机会话。要删除会话,请停止虚拟 3 层交换机。 +ERR_92 具有指定名称的虚拟 3 层交换机已存在。指定一个不同的名称。 +ERR_93 找不到指定的虚拟 3 层交换机。 +ERR_94 指定的名称无效。检查名称是否有不能使用的字符 +ERR_95 无法添加虚拟 3 层接口。Please check that the parameters are valid. Also please make sure that the Virtual Layer 3 switch is stopped. Adding or deleting interfaces are unable when the Virtual Layer 3 switch is running. +ERR_96 无法删除虚拟 3 层接口。Please check that the parameters are valid. Also please make sure that the Virtual Layer 3 switch is stopped. Adding or deleting interfaces are unable when the Virtual Layer 3 switch is running. +ERR_97 与指定虚拟 3 层交换接口的目标虚拟 HUB 连接的虚拟 3 层接口已在虚拟 3 层交换机中存在。不能在同一个虚拟 3 层交换机中定义超过一个连接到同一个虚拟 HUB 的虚拟 3 层接口。 +ERR_98 无法添加路由表项。Please check that the parameters are valid. Also please make sure that the Virtual Layer 3 switch is stopped. Adding or deleting routing table entries are unable when the Virtual Layer 3 switch is running. +ERR_99 无法删除路由表项。Please check that the parameters are valid. Also please make sure that the Virtual Layer 3 switch is stopped. Adding or deleting routing table entries are unable when the Virtual Layer 3 switch is running. +ERR_100 指定的路由表项已存在。 +ERR_101 客户端和服务器的时钟彼此不同步。检查时间设置。 +ERR_102 无法启动此虚拟 3 层交换机。 要启动虚拟 3 层交换机,必须在虚拟 3 层交换机定义至少一个虚拟接口。 +ERR_103 目标 VPN Server 没有足够的客户端连接许可证。请与服务器管理员联系。 +ERR_104 目标 VPN Server 没有足够的网桥许可证。请与服务器管理员联系。 +ERR_105 由于目前的技术问题,目标 VPN Server 没有收到连接。请稍候,或与 VPN Server 管理员联系,要求进行服务器日志文件检查。 +ERR_106 目标 VPN Server 的证书已过期。请与 VPN Server 管理员联系。 +ERR_107 监测模式要求了一个连接。但是,连接用户的安全策略不允许监察模式。 +ERR_108 网桥 / 路由模式要求了一个连接。但是,连接用户的安全策略不允许网桥 / 路由模式。 +ERR_109 一个来自客户端 IP 地址的连接被虚拟 HUB 的源 IP 限制列表拒绝。 +ERR_110 项目数过多。 +ERR_111 内存不足。 +ERR_112 指定的对象已存在。指定的对象已存在。 +ERR_113 发生致命的错误。很可能是该程序的操作无法继续。 +ERR_114 目标 VPN Server 已检测到软件许可证错误。连接被拒绝。请与 VPN Server 管理员联系。 +ERR_115 通过 Internet 连接到 SoftEther 公司提供的一个重要服务器的目标 VPN Server 无法验证许可证。请稍候,或与 VPN Server 管理员联系,要求检查服务器日志文件和检查服务器本身的 Internet 连接状态。 +ERR_116 客户端的软件许可证错误。连接被拒绝。 +ERR_117 命令或文件名不正确 +ERR_118 许可证密钥不正确 +ERR_119 VPN Server 上没有注册有效的产品许可证。请与 VPN Server 管理员联系。 +ERR_120 VPN Server 作为群集运行所需要的许可证未注册。请与 VPN Server 的管理员。 +ERR_121 VPN 连接设置已使用“Web 安装程序创建工具包”或“简单安装程序创建工具包”安装。目标服务器版本不支持支持 SoftEther VPN 的 2.0 管理包。请与系统管理员或安装程序创建者联系。 +ERR_122 与 VPN Server SDK for .NET,它只能连接到 SoftEther VPN Server 版本,支持 SoftEther VPN 的 2.0 管理包。 VPN Server 的目标不是一个版本,支持 SoftEther VPN 的 2.0 管理包。与系统管理员联系。 +ERR_123 试用版软件在目标服务器上已过期。联系服务器的系统管理员以下载新的测试版或从 http://www.softether.com/ 下载完整版本。 + +# ----- 不完全翻訳ここから ----- +ERR_124 至 VPN Server 的 VPN 连接在服务器端被拒绝。 +ERR_125 至 VPN Server 的 VPN 连接在客户端被拒绝。 +ERR_126 因为一段时期已经过去,安全策略强制执行自动断开了 VPN 会话。如果你想继续,请再次连接。 +ERR_127 VPN Server 需要特殊版本的 VPN Client 软件。请咨询您的管理员。 +ERR_128 注册用户对象的数量超过了 VPN Server 上产品许可证允许的最大数量。您不能再添加用户对象了,除非你删除旧的用户或升级到产品的更高版本。 +ERR_129 认购合同在 VPN Server 的、这个版本的、发布日期前已经到期。客户在此认购合同期内被授权使用 VPN Server的版本,。客户应延长认购期。客户也能“降级” VPN Server 的版本,至认购结束前发布的老版本。如果您想降级版本,旧版本在 http://www.softether.com/ +# ----- 不完全翻訳ここまで ----- +ERR_130 试用许可证密钥恐怕不能频繁地被相同的客户获取。请考虑购买的正式版。 +ERR_131 几个在同一 IP 地址的 VPN Server。您可以指定目标服务器的私有 IP 地址或具体的主机名,如“全球 IP 地址或主机名/192.168.x.x”。如果服务器端使用 NAT,配置 NAT 为打开、转发或转让相应的端口。 +ERR_132 动态 DNS 服务的密钥与他人重复。密钥将被自动重置。 +ERR_133 指定的动态 DNS 主机名已被使用。请更改主机名。 +ERR_134 指定的动态 DNS 主机名有一个无效的字符。请更改主机名。 +ERR_135 指定的动态 DNS 主机名的长度太长。主机名必须等于或少于 31 个字母。 +ERR_136 未指定动态 DNS 主机名。 +ERR_137 指定的动态 DNS 主机名的长度太长。主机名必须是等于或大于 3 个字母。 +ERR_138 在虚拟 HUB 上指定的用户的密码、在使用 MS-CHAP v2 验证之前,必须重置。请让 VPN Server 的管理员,通过 4.0 或更高版本的 VPN Server 管理器或 vpncmd 重设密码。或者,您自己可以通过 VPN Client 更改密码。 +ERR_139 动态 DNS 服务器的连接被中断。 +ERR_140 无法初始化 ICMP(PING)协议。 VPN Server 的进程可能以普通用户权限在运行。在这种情况下, VPN Server 作为系统服务运行。 (在 Linux / UNIX,以 root 权限运行)。 +ERR_141 无法打开 DNS 端口 53。请确认没有其他的 DNS 服务器程序(例如,BIND 或 Microsoft DNS 服务器)在同一台计算机上。如果有冲突的服务,停止他们。或在 Linux/ UNIX 的 root 权限运行 VPN Server 的进程。 +ERR_142 OpenVPN Server 功能未启用。 +ERR_143 证书验证功能和外部服务器验证功能尚未在 SoftEther VPN 的开源版本上实施。可以选择匿名身份验证或密码验证来代替。 +ERR_144 不可接受的操作。使用 VPN Gate 控制面板更改 VPN Gate 中继服务器设置。 +ERR_145 不可接受的操作。使用 VPN Gate 实用工具修改 VPN Gate 公共 VPN 中继服务器的连接设置。 +ERR_146 VPN Gate 服务运行在 VPN 客户端程序内。在此屏幕上,你不能停止 VPN Gate 服务。使用 VPN 客户端管理器来启用或禁用 VPN Gate 服务。 +ERR_147 不支持此功能。它尚未在 SoftEther VPN 的开源版本上实施。 +ERR_148 VPN 连接被中断,因为该系统被暂停。 + + +#关于许可证 +LICENSE_INFO_URL https://selinks.org/?new_license +LICENSE_SUPPORT_URL https://selinks.org/?q=license_info&id=%s +LICENSE_STATUS_OK 有效 +LICENSE_STATUS_EXPIRED 已过期 +LICENSE_STATUS_ID_DIFF 服务器 ID 不一致 +LICENSE_STATUS_DUP 重复 +LICENSE_STATUS_INSUFFICIENT 需要其他许可证 +LICENSE_STATUS_COMPETITION 与其他许可证的竞争 +LICENSE_STATUS_NONSENSE 当前版本无意义 +LICENSE_STATUS_CPU CPU 类型不兼容 +LICENSE_STATUS_OTHERERROR 未知错误 + + +#关于TCP最优化 +TCPOPT_NOT_SUPPORTED TCP 通讯设定最优化实用程序,这个操作系统不能使用。 +TCPOPT_NOT_ADMIN 没有管理权限的用户不能使用 TCP 协议优化工具。 + + +# Windows Vista / Windows 7 / Windows 8 优化 +VISTA_MMCSS_MSG 你想优化 Windows Vista / Windows 7 / Windows 8 / Windows 10 用于使用 VPN 进行多媒体文件的播放吗? (如: 视频、音频和流媒体) +VISTA_MMCSS_MSG_2 Windows Vista / Windows 7 / Windows 8 / Windows 10 的 VPN 优化已经完成。\r\n你想进行远程优化配置吗? +VISTA_MMCSS_MSG_3 您不能在当前环境下进行优化。 +VISTA_MMCSS_MSG_4 您必须具有管理员权限才可使用此功能。\r\n请注意,在 Windows Vista / Windows 7 / Windows 8 / Windows 10 中,您应该使用“以管理员身份运行”执行程序。 +VISTA_MMCSS_MSG_5 优化完成。 +VISTA_MMCSS_MSG_6 优化配置被删除。 + + +# 关于PKCS 实用程序 +PKCS_UTIL_TITLE PKCS#12 写入实用程序 +PKCS_UTIL_SAVEDLG_TITLE 选择你要写入到 USB 令牌中的 PKCS#12 文件 +PKCS_UTIL_READ_ERROR 无法读取文件: "%s"。 +PKCS_UTIL_WRITE_OK_MSG 文件 %s 已写入到 USB 硬件令牌中。 +PKCS_UTIL_DELETE_OK_MSG PKCS#12 证书数据已从 USB 硬件令牌中删除。 +PKCS_UTIL_SECA_FILENAME seca_p12 +PKCS_MAKE_SURE 写入 USB 令牌的 PKCS#12 证书数据将被删除。\r\n一旦数据被删除,将无法恢复。\r\r\n\r\r\n你想继续吗? +PKCS_UTIL_BAD_FILE 指定的文件不能识别为 PKCS#12 文件。 + + +# 关于共通对话框 +DLG_ALL_FILES 所有文件(*.*)|*.* +DLG_CERT_FILES X509 证书文件 (*.CER;*.CRT)|*.cer;*.crt|所有文件 (*.*)|*.* +DLG_KEY_FILTER 密钥文件 (*.KEY;*.PEM)|*.key;*.pem|所有文件 (*.*)|*.* +DLG_PKCS12_FILTER PKCS#12 文件(*.P12;*.PFX)|*.p12;*.pfx|所有文件 (*.*)|*.* +DLG_CERT_OR_P12_FILTER X509 证书或 PKCS#12 文件(*.CER;*.CRT;*.P12;*.PFX)|*.cer;*.crt;*.p12;*.pfx|X509 证书文件(*.CER;*.CRT)|*.cer;*.crt|PKCS#12 文件(*.P12;*.PFX)|*.p12;*.pfx|所有文件 (*.*)|*.* +DLG_CONFIG_FILES 设置文件 (*.CONFIG)|*.config|所有文件 (*.*)|*.* +DLG_KEY_OR_P12_FILTER 密钥文件或 PKCS#12 文件 (*.KEY;*.PEM;*.P12;*.PFX)|*.key;*.pem;*.p12;*.pfx|密钥文件 (*.KEY;*.PEM)|*.key;*.pem|PKCS#12 文件(*.P12;*.PFX)|*.p12;*.pfx|所有文件 (*.*)|*.* +DLG_ZIP_FILER ZIP 文件(*.ZIP)|*.zip|所有文件(*.*)|*.* +DLG_OPEN_CERT 请选择证书文件 +DLG_OPEN_KEY 请选择密钥文件 +DLG_OPEN_KEY_WITH_CERT 请选择相应的密钥文件 +DLG_OPEN_FILE_ERROR 无法读取指定文件 "%S"。 +DLG_OPEN_FILE_ERROR_W 无法读取指定文件 "%s"。 +DLG_BAD_P12 文件 "%S" 不是有效的 PKCS#12 证书文件。 +DLG_BAD_P12_W 文件 "%s" 不是有效的 PKCS#12 证书文件。 +DLG_BAD_X509 文件 "%S" 不是有效的 X509 证书文件。 +DLG_BAD_X509_W 文件 "%s" 不是有效的 X509 证书文件。 +DLG_BAD_KEY 文件 "%S" 不是有效的 RSA 密钥文件。 +DLG_BAD_KEY_W 文件 "%s" 不是有效的 RSA 密钥文件。 +DLG_BAD_SIGNATURE 密钥无法与指定证书中的公钥相对应。\r\n请提供可对应的密钥。 +DLG_SAVE_CERT 请指定保存证书的文件名 +DLG_SAVE_KEY 请指定保存密钥的文件名 +DLG_SAVE_P12 请指定保存证书和密钥的文件名 +DLG_SAVE_FILE 文件保存为 +DLG_SAVE_OPENVPN_CONFIG 指定一个文件名保存 ZIP 文件,包含 OpenVPN 的设置 +DLG_CERT_SAVE_OK 证书保存成功。 +DLG_CERT_SAVE_ERROR 证书无法保存。 +DLG_KEY_SAVE_OK 密钥保存成功。 +DLG_KEY_SAVE_ERROR 密钥无法保存。 +DLG_KEY_PAIR_SAVE_OK 证书和密钥保存成功。 +DLG_KEY_PAIR_SAVE_ERROR 无法保存的证书和个人密钥。 +DLG_REBOOT_INFO 计算机将被在 %u 秒后重新启动。 +DLG_REBOOT_INFO_2 重新启动... +DLG_REBOOT_ERROR 计算机重新启动失败。\r\n\r\n请手动重新启动计算机。 +DLG_SAVE_CONFIG 指定一个文件名保存配置 +DLG_OPEN_CONFIG 指定配置文件导入 +DLG_STRING_DEFTITLE 输入字符串 +DLG_STRING_DEFINFO 请输入字符串。 +DLG_ABOUT_LEGAL 法律公告 +DLG_ABOUT_AUTHORS 作者名单 +DLG_UPDATE_DATE \ (Released on %S) +DLG_UPDATE_HINT 按确定查看网页浏览器最新更新的信息。\r\n\r\n您必须手动下载并安装更新。如果你想在其他电脑上更新软件,您必须登录到计算机通过远程桌面或 SSH 进行下载和更新。 + + +# 关于竞争进程 +BAD_PROCESS_TITLE 有关 %S 的警告 +BAD_PROCESS_MESSAGE 在此计算机上运行的软件 "%S" 会产生问题。\r\n\r\n"%S" 问题可能会导致 VPN 通信不稳定和错误。\r\n\r\n如果由于 VPN 与 "%S" 的共同使用而导致 VPN 不稳定,请停止或卸载 "%S"。(请注意,在某些情况下,由于软件的性质,即使你停止该软件,但问题仍会保留在计算机上。) \r\n + + +# 关于硬件令牌 +SEC_SMART_CARD 智能卡 +SEC_USB_TOKEN USB 令牌 +SEC_INIT_MSG_1 将智能卡插入智能卡阅读器中,并输入 PIN 码。 +SEC_INIT_MSG_2 将 USB 硬件令牌与计算机的 USB 端口相连,输入 PIN 码。 +SEC_OPENING 开启设备... +SEC_CLOSING 关闭设备... +SEC_OPEN_SESSION 开启安全会话... +SEC_CLOSE_SESSION 关闭安全会话... +SEC_LOGIN 登录令牌... +SEC_LOGOUT 登出令牌... +SEC_INIT_BATCH 启动批处理... +SEC_READ_DATA 读取数据... +SEC_WRITE_DATA 写入数据... +SEC_READ_CERT 读取证书... +SEC_WRITE_CERT 写入证书... +SEC_DELETE 删除对象... +SEC_SIGN 密匙处理数字签名... +SEC_WRITE_KEY 写入密匙... +SEC_ENUM 枚举对象... +SEC_FINISHED 操作完成。 +SEC_ERROR_INVALID_ID 指定的安全设备 (设备 %u) 无效。 +SEC_ERROR_OPEN_DEVICE 无法打开设备 %S,请确保该设备连接到计算机上。 +SEC_ERROR_OPEN_DEVICEEX 无法打开设备 %S,请确保该设备连接到计算机上。\r\n\r\n如果使用公钥基础设施 (PKI) 特殊客户端软件,则需要在“PKI 实用工具” (从“开始”菜单选择) 中,选择智能卡设备。 +SEC_ERROR_OPEN_SESSION 无法在设备 %S 中启动安全会话。请确保选择正确的设备。 +SEC_ERROR_LOGIN 输入的 PIN 码错误。 +SEC_ERROR_NOT_FOUND_1 智能卡中不存在指定的对象。确保插入正确的智能卡。 +SEC_ERROR_NOT_FOUND_2 USB 硬件令牌中不存在指定的对象。确保连接正确的 USB 硬件令牌。 +SEC_ERROR_SIGN_1 智能卡中不存在密钥或数字签名操作失败。确保插入正确的智能卡。 +SEC_ERROR_SIGN_2 USB 硬件令牌中不存在密钥或数字签名操作失败。确保连接正确的 USB 硬件令牌。 +SEC_ERROR_WRITE_1 无法在智能卡中写入对象。智能卡中可能没有足够的存储空间。 +SEC_ERROR_WRITE_2 无法在 USB 硬件令牌中写入对象。USB 硬件令牌中可能没有足够的存储空间。 +SEC_ERROR_ENUM 对令牌中的存储对象枚举失败。 +SEC_ERROR_DELETE 对指定对象删除失败。可能指定对象在内存中不存在。 +SEC_COLUMN1 设备名称 +SEC_COLUMN2 种类 +SEC_COLUMN3 制造商 +SEC_COLUMN4 DLL 名 +SEC_INVALID_ID 指定的智能卡设备不存在。请重新选择智能卡种类。 +SEC_MGR_COLUMN1 名称 +SEC_MGR_COLUMN2 种类 +SEC_MGR_COLUMN3 私有 +SEC_TYPE_DATA 数据 +SEC_TYPE_CERT 证书 +SEC_TYPE_KEY 密钥 +SEC_TYPE_PUB 公钥 +SEC_YES 是 +SEC_NO 否 +SEC_NONE 无 +SEC_IMPORT_DATA 选择你想导入的数据 +SEC_IMPORT_CERT 选择你要导入的证书 +SEC_IMPORT_KEY 选择你要导入的密钥 +SEC_READ_FAILED 选择你要导入的证书。 +SEC_DATA_TOO_BIG 指定数据太大。大于 %u 个字节的数据无法写入智能卡。 +SEC_OBJECT_NAME_TITLE 插入对象的名称 +SEC_OBJECT_NAME_INFO 指定写入新智能卡的对象名称。您可以指定不包括字母数字字符双字节字符和特殊对象的名称。\r\n警告: 如果卡上已有同一类型相同名称的对象,该对象将被覆盖。 +SEC_DELETE_MSG 选定的对象将从智能卡中删除。\r\n你要这样做吗? +SEC_OBJECT_IMPORT_OK 对象被写入智能卡。 +SEC_OBJECT_EXPORT_OK 从智能卡中读取的数据已被保存。 +SEC_NEW_CERT_IMPORT_OK 新创建的证书已被写入智能卡。 +SEC_CURRENT_DEVICE 当前选中设备 %S。 +SEC_CURRENT_NO_DEVICE 选择要使用的智能卡。 +SEC_NO_SECURE_DEVICE 系统中没有安装与 SoftEther VPN 兼容的智能卡或硬件安全口令设备。\r\n\r\n要使用智能卡或硬件口令,需要在 Windows 中安装 PKCS#11 兼容设备驱动。并且, SoftEther VPN 需要支持此设备类型。\r\n请确定已安装系统兼容设备驱动。\r\n请在 SoftEther 有限公司网站上查阅 SoftEther VPN 兼容设备列表。而且,将软件更新到最新版本也有助于增大设备兼容范围。 +SEC_PIN_DEVICE_OPEN_ERR 无法连接设备 "%S"。请确保硬件正确连接。 +SEC_PIN_CURRENT_BAD 当前的 PIN 码是不正确的。 +SEC_PIN_CHANGE_FAILED 更改 PIN 码失败。 +SEC_PIN_OK PIN 码已变更。 + + +# TCP 连接会话 +CONNECTDLG_CAPTION 连接中... +CONNECTDLG_MESSAGE 连接到服务器 "%S" (TCP 端口: %u)... +CONNECTDLG_CANCELING 取消连接。请稍候... + + +# NIC 信息会话 +NICINFO_1 已连接到 VPN 服务器。 +NICINFO_1_1 在 VPN 上的 DHCP 服务器请求一个 IP 地址。 +NICINFO_1_2 决定在 VPN 中使用的 IP 地址。 + +NICINFO_2 VPN 会话已建立。 +NICINFO_2_1 分配的 IP 地址是 %S。 + +NICINFO_3 VPN 会话已建立。 +NICINFO_3_1 该 IP 地址是 %S 已可以使用。 + + +#关于登录时密码输入对话框 +PW_RETRYCOUNT 如果没有输入,%u 秒后自动重新连接... +PW_LOGIN_DLG_TITLE 登录 +PW_TYPE_0 匿名身份验证 +PW_TYPE_1 标准密码验证 +PW_TYPE_2 RADIUS 或 NT 域验证 +PW_TYPE_3 客户端证书认证 +PW_TYPE_4 智能卡身份验证 +PW_TYPE_5 Openssl Engine Authentication + +PW_MSG_PROXY 代理服务器 %S 用户身份验证失败。请重新输入正确的用户名和密码。 +PW_TYPE_PROXY 代理服务器认证 + + +#关于 VPN 连接状态 +STATUS_1 初始化中... +STATUS_2 通过代理服务器 %S 连接到 VPN Server "%S"... +STATUS_3 在代理服务器 %S 上进行用户身份验证... +STATUS_4 连接到 VPN Server "%S" ... +STATUS_5 验证服务器证书... +STATUS_6 用户身份验证... +STATUS_7 建立 VPN 会话... +STATUS_8 连接到群集 VPN Server ... +STATUS_9 VPN 会话已建立。 + + +#关于证书对话 +CERT_NOT_FOUND 没有在可信任证书列表上找到经证书颁发机构颁发的证书。 +CERT_ROOT 这是一个根证书 (自签名的证书)。 +CERT_LV_C1 区域 +CERT_LV_C2 值 +CERT_SERIAL 序列号 +CERT_ISSUER 发行者 +CERT_SUBJECT 主题 +CERT_NOT_BEFORE 有效期自 +CERT_NOT_AFTER 有效期至 +CERT_BITS 数位 +CERT_PUBLIC_KEY 公钥 +CERT_DIGEST_MD5 摘要 (MD5) +CERT_DIGEST_SHA1 摘要 (SHA-1) +CERT_NO_SERIAL 没有序列号 +CERT_BITS_FORMAT %u bits + + +#关于证书认证对话框 +CC_DANGEROUS_MSG 之前保存的与此服务器(%S)建立 VPN 连接的服务器证书,与服务器提供的当前服务器证书不匹配。\r\n以前的摘要值(MD5): %S\r\n以前的摘要值(SHA1): %S\r\ni当前的摘要值(MD5): %S\r\n当前摘要值(SHA-1): %S\r\n\r\n可能是服务器管理员在 VPN Server 端更改了证书。然而,也有可能是中间人攻击,如发生欺骗攻击。\r\n强烈建议您向您向您想连接的 VPN Server 管理员进行详细信息咨询。 +CC_WARNING_MSG 您是否想让您当前连接使用的证书,在下次连接到 %s 自动信任吗?\r\n\r\n摘要值(SHA-1): %S\r\n摘要值(MD5): %S\r\n\r\n如对此服务器证书的真实性有疑问,请通过一稳妥而安全的渠道,与服务器所有者进行联系,并列举上述摘要值以进行确认。\r\n\r\n单击“是”,则下次连接时,若服务器提供相同证书则自动信任。\r\n单击“否”,则下次连接到此服务器时,再次显示此警告。\r\n单击“取消”,返回安全警告窗口。\r\n\r\n注意: 此设置可按逐个账户情况进行修改。您可以使用 VPN Client 客户端管理器内的账户属性进行设置。 + + +# 关于 Windows 版本的错误 +WINVER_TITLE 有关 Windows 版本的警告 +WINVER_ERROR_FORMAT Windows %s 的版本和补丁包是“%S”。\r\n\r\Windows %s 最新支持的版本和补丁包如下:\r\n%S \r\n因为 Windows 在 %s 的版本比%s支持 Windows 的版本还要新,可能会发生意想不到的麻烦或兼容问题。\r\n为了避免出现问题,建议以获取并安装 %s 最新的更新\r\n可以继续使用当前未更新的版本,但不建议这样做。\r\n\r\n如果你是管理员,你可以免费下载 %s 的最新更新补丁,从 http://selinks.org/ 网站。\r\n\r\n如果您不是管理员,你应该将此消息通知 VPN Server 的管理员。\r\n\r\n----- MSG%04u%02u -----\r\n\r\n +WINVER_ERROR_VPNSERVER 在目标计算机上的 VPN Server +WINVER_ERROR_VPNBRIDGE 在目标计算机上的 VPN Bridge +WINVER_ERROR_VPNCLIENT 在本地计算机上的 VPN Client +WINVER_ERROR_PC_LOCAL 此本地计算机 +WINVER_ERROR_PC_REMOTE 远程服务器 + + +# 开源版本的警告 +OSS_MSG 欢迎来到 SoftEther VPN 服务器学术版 !\r\n\r\n此 VPN 服务器作为日本筑波大学的一个学术研究由免费软件开发的,且由,开源 SoftEther 项目 (http://www.softether.org/) 为公众利益免费发布的。\r\n\r\nSoftEther VPN 软件是作为筑波大学和 SoftEther 公司之间的联合研究合同的一部分而发布给公众的。SoftEther VPN 软件的开发和发布仅为学术研究目的。因此,对 SoftEther VPN 软件不提供支持服务,即使它包含错误或漏洞。用户将对使用 SoftEther VPN 的结果承担责任。 SoftEther VPN 的开发者和发行者都将永远不会为任何后果或损失承担责任。\r\n\r\n在您同意上述启示后,使用 SoftEther VPN 服务器享受 VPN 通信。\r\n\r\n对于 SoftEther VPN 的更多细节,请参阅 http://www.softether.org/。\r\n\r\n + + +# NAT Traversal warning +NATT_MSG ** 使用 NAT 穿透 (UDP 打洞) - 它可能是不稳定的 **\r\n\r\n此 VPN 客户端通过使用 NAT 穿透 (UDP 打洞) 技术连接到 VPN 服务器 '%S'。\r\n\r\nNAT 穿透允许位于 NAT 盒后面的 VPN 服务器接受来自 NAT 盒中的、没有任何端口映射设置的 VPN 客户端的 VPN 连接。\r\n\r\n然而,基于 NAT 穿透的 VPN 会话有时会变得不稳定,因为 NAT 穿透使用的是基于 UDP 的协议。例如,如果在 VPN 服务器和 VPN 客户端之间有一个不好的 NAT 盒子, VPN 隧道每 5 分钟断开一次。一些大规模 NAT 网关使用便宜的互联网服务供应商,有时会造成 NAT 穿透的同样问题。这是路由器或互联网服务供应商的问题。这不是 SoftEther VPN 软件的问题。\r\n\r\n为了解决这个不稳定的隧道问题,您应该直接连接到 VPN 服务器的 TCP 监听端口,而不是使用 NAT 穿透功能。要使用 TCP 直接连接到 VPN 服务器, VPN 服务器的监听端口必须通过在 NAT 盒的端口映射设置暴露到互联网上。请询问 NAT 盒的管理员或参阅 NAT 盒的手册在 NAT 盒上添加端口映射设置。\r\n\r\n如果此消息仍是 VPN 服务器暴露了一个 TCP 端口到互联网后,检查 VPN 客户端连接设置屏幕上的 "禁用 NAT-T" 复选框。\r\n\r\n +NATT_MSG2 ** 使用 NAT 穿透 (UDP 打洞) - 它可能是不稳定的 **\r\n\r\n此 VPN 客户端通过使用 NAT 穿透 (UDP 打洞) 技术连接到 VPN 服务器 '%S'。\r\n\r\nNAT 穿透允许位于 NAT 盒后面的 VPN 服务器接受来自 NAT 盒中的、没有任何端口映射设置的 VPN 客户端的 VPN 连接。\r\n\r\n然而,基于 NAT 穿透的 VPN 会话有时会变得不稳定,因为 NAT 穿透使用的是基于 UDP 的协议。例如,如果在 VPN 服务器和 VPN 客户端之间有一个不好的 NAT 盒子, VPN 隧道每 5 分钟断开一次。一些大规模 NAT 网关使用便宜的互联网服务供应商,有时会造成 NAT 穿透的同样问题。这是路由器或互联网服务供应商的问题。这不是 SoftEther VPN 软件的问题。\r\n\r\n为了解决这个不稳定的隧道问题,您应该直接连接到 VPN 服务器的 TCP 监听端口,而不是使用 NAT 穿透功能。要使用 TCP 直接连接到 VPN 服务器, VPN 服务器的监听端口必须通过在 NAT 盒的端口映射设置暴露到互联网上。请询问 NAT 盒的管理员或参阅 NAT 盒的手册在 NAT 盒上添加端口映射设置。\r\n\r\n如果此消息仍是 VPN 服务器暴露了一个 TCP 端口到互联网后,检查 VPN 客户端连接设置屏幕上的 "禁用 NAT-T" 复选框、而你的 VPN 客户端升级到 Build 9428 或更高版本。\r\n\r\n + + + + +#虚拟 HUB 管理选项 +HUB_AO_CLICK 选择一个项目,查看这里的描述。 +HUB_AO_UNKNOWN 该项目的描述没有被发现。请参阅文件,或从该项目的名称推测项目的意思和目的。 +HUB_AO_allow_hub_admin_change_option 这是一个特殊项目。如果你启用(设置为1)这个选项,那么不但 VPN Server 的全球管理员,而且虚拟 HUB 的管理员,都将被他自己准予修改虚拟 HUB 管理选项。 +HUB_AO_deny_hub_admin_change_ext_option 如果你启用(设置为1)这个选项,虚拟 HUB 的管理员将被禁止修改在虚拟 HUB 扩展选项上的任何值,那么只有 VPN Server 的全球管理员可以对其进行修改。 +HUB_AO_no_delay_jitter_packet_loss 如果您将此选项设置为非零值,在访问列表条目中的延迟、时基误差和数据包丢失的所有参数将被忽略,即使这些参数是在管理员添加新的访问列表条目时设置的。因此,延迟、时基误差和数据包丢失的生成函数实际中将被禁用。由于延迟生成函数有时会让 CPU 和 RAM 产生高负载量,由多个用户共享的一个虚拟 HUB 上应该启用此选项。 +HUB_AO_max_users 如果您将此选项设置为非零值,在虚拟 HUB 上用户对象注册的最大数量将被限制在这个值,那么用户对象的数量如果大于这个值则不能被添加。 +HUB_AO_max_multilogins_per_user 如果您将此选项设置为非零值,每一个单独的用户对象的 VPN 会话的最大数量将被限制在这个值,那么单独用户对象的 VPN 会话的数量如果大于这个值则不能被建立。 +HUB_AO_max_groups 如果您将此选项设置为非零值,那么在虚拟 HUB 上的组对象的最大数量将被限制在这个值,更多的组将不被允许注册。 +HUB_AO_max_accesslists 如果您将此选项设置为非零值,那么在虚拟 HUB 上的访问列表条目的最大数量将被限制在这个值,更多条目将不被允许注册。 +HUB_AO_max_sessions_client_bridge_apply 只有当该值被设置为非零值,max_sessions_client 和 max_sessions_bridge 值将被应用。 +HUB_AO_max_sessions 如果您将此选项设置为非零值,那么 VPN 会话的最大数量将被限制在这个值。 +HUB_AO_max_sessions_client 如果您将此选项设置为非零值,那么 VPN Client 会话的最大数量将被限制在这个值。没有更多的 VPN Client 会话将被允许建立。此选项只有当 max_sessions_client_bridge_apply 选项被设置为非零值时有效。 +HUB_AO_max_sessions_bridge 如果您将此选项设置为非零值,那么 VPN Bridge 会话的最大数量将被限制在这个值。没有更多的 VPN Bridge 会话将被允许建立。此选项只有当 max_sessions_client_bridge_apply 选项被设置为非零值时有效。 +HUB_AO_max_bitrates_download 如果您将此选项设置为非零值,那么在虚拟 HUB 上的所有 VPN 会话将被强制有一个安全策略设置,即“下载带宽”值被设置为这个值。这将限制每个 VPN 会话的下载通信速度。例如,如果该值设置为 1000000,然后在虚拟 HUB 上的每个 VPN 会话的下载带宽将被限制为1Mbps。 +HUB_AO_max_bitrates_upload 如果您将此选项设置为非零值,那么在虚拟 HUB 上的所有 VPN 会话将被强制有一个安全策略设置,即“下载带宽”值被设置为这个值。这将限制每个 VPN 会话的上传通信速度。例如,如果该值设置为 1000000,然后在虚拟 HUB 上的每个 VPN 会话的上传带宽将被限制为1Mbps。 +HUB_AO_deny_empty_password 如果您将此选项设置为非零值,没有用户对象能够有一个空密码。一个空密码的用户将被禁止连接 VPN 会话。 (例外:从本地的 VPN 连接将被允许,即使密码为空)。 +HUB_AO_deny_bridge 如果您将此选项设置为非零值,那么任何在网桥模式下的 VPN 会话将不会被准许建立,不管用户现有的安全策略的设置。为了桥接的目的,没有人能够连接到虚拟 HUB 。 +HUB_AO_deny_routing 如果您将此选项设置为非零值,那么任何在路由模式下的 VPN 会话将不会被准许建立,不管用户现有的安全策略的设置。为了路由的目的,没有人能够连接到虚拟 HUB 。 +HUB_AO_deny_qos 如果您将此选项设置为非零值,那么每一个 VPN 会话将被强制执行禁用 QoS 功能,不管用户现有的安全策略的设置。 +HUB_AO_deny_change_user_password 如果您将此选项设置为非零值,那么在虚拟 HUB 上的任何用户将被禁止通过 VPN Client 的密码更改功能修改其密码。 +HUB_AO_no_change_users 如果您将此选项设置为非零值,那么虚拟 HUB 的管理员将被禁止添加、编辑或删除用户。 +HUB_AO_no_change_groups 如果您将此选项设置为非零值,那么虚拟 HUB 的管理员将被禁止添加、编辑或删除组。 +HUB_AO_no_securenat 如果您将此选项设置为非零值,那么虚拟 HUB 的管理员将被禁止启用或禁用 SecureNAT 功能。 +HUB_AO_no_securenat_enablenat 如果您将此选项设置为非零值,那么虚拟 HUB 的管理员将被禁止启用或禁用在 SecureNAT 功能中的虚拟 NAT 功能。 +HUB_AO_no_securenat_enabledhcp 如果您将此选项设置为非零值,那么虚拟 HUB 的管理员将被禁止启用或禁用在 SecureNAT 功能中的虚拟 USB 功能。 +HUB_AO_no_cascade 如果您将此选项设置为非零值,那么虚拟 HUB 的管理员将被禁止添加、编辑、删除或更改级联连接的在线状态。 +HUB_AO_no_online 如果您将此选项设置为非零值,那么虚拟 HUB 的管理员将被禁止更改离线的虚拟 HUB 为在线状态。 +HUB_AO_no_offline 如果您将此选项设置为非零值,那么虚拟 HUB 的管理员将被禁止更改在线的虚拟 HUB 为离线状态。 +HUB_AO_no_change_log_config 如果您将此选项设置为非零值,那么虚拟 HUB 的管理员将被禁止更改日志功能的设置。 +HUB_AO_no_disconnect_session 如果您将此选项设置为非零值,那么虚拟 HUB 的管理员将被禁止断开一个特定的 VPN 会话。 +HUB_AO_no_delete_iptable 如果您将此选项设置为非零值,那么虚拟 HUB 的管理员将被禁止从 IP 地址表数据库中删除一个特定的 IP 地址。 +HUB_AO_no_delete_mactable 如果您将此选项设置为非零值,那么虚拟 HUB 的管理员将被禁止从 MAC 地址表数据库中删除一个特定的 MAC 地址。 +HUB_AO_no_enum_session 如果您将此选项设置为非零值,那么虚拟 HUB 的管理员将被禁止列举在虚拟 HUB 上的会话。 +HUB_AO_no_query_session 如果您将此选项设置为非零值,那么虚拟 HUB 的管理员将被禁止指定会话,并获得会话的信息。 +HUB_AO_no_change_admin_password 如果您将此选项设置为非零值,那么虚拟 HUB 的管理员将被禁止更改虚拟 HUB 的管理员密码。 +HUB_AO_no_change_log_switch_type 如果您将此选项设置为非零值,那么虚拟 HUB 的管理员将被禁止更改在虚拟 HUB 日志功能设置中的日志转换设置。 +HUB_AO_no_change_access_list 如果您将此选项设置为非零值,那么虚拟 HUB 的管理员将被禁止修改虚拟 HUB 的访问列表。 +HUB_AO_no_change_access_control_list 如果您将此选项设置为非零值,那么虚拟 HUB 的管理员将被禁止修改虚拟 HUB 的源 IP 地址限制列表。 +HUB_AO_no_change_cert_list 如果您将此选项设置为非零值,那么虚拟 HUB 的管理员将被禁止修改虚拟 HUB 的可信证书授权列表。 +HUB_AO_no_change_crl_list 如果您将此选项设置为非零值,那么虚拟 HUB 的管理员将被禁止修改虚拟 HUB 的证书取消列表。 +HUB_AO_no_read_log_file 如果您将此选项设置为非零值,那么虚拟 HUB 的管理员将被禁止远程列举或下载虚拟 HUB 的日志文件。 +HUB_AO_no_change_msg 如果您将此选项设置为非零值,那么虚拟 HUB 的管理员将被禁止更改当一个 VPN Client 连接到虚拟 HUB 时应该被显示的消息。 +HUB_AO_no_access_list_include_file 如果您将此选项设置为非零值,那么虚拟 HUB 的管理员将被禁止指定“包括:”或“排除:”指令作为在虚拟 HUB 上的访问列表条目的源或目标用户字段。 + + +# 虚拟 HUB 扩展选项 +HUB_AO_NoAddressPollingIPv4 如果您将此选项设置为非零值,那么虚拟 HUB 将不执行在 HUB 上的 IPv4 地址表和 MAC 地址表的维护,通过每 5 秒发送 ARP 数据包,以检查 IPv4 设备保持活跃状态。其结果,一个特定的期间(从 1 至 10 分钟)过去以后,在没有通信活动通过虚拟 HUB 的情况下,即使仍然活跃着,在 IPv4 地址表和 MAC 地址表中的 IPv4 设备可能会被删除。此选项可以消除大量的广播数据包,但一些 IPv4 相关的安全策略将无法有效工作。 +HUB_AO_NoAddressPollingIPv6 如果您将此选项设置为非零值,那么虚拟 HUB 将不执行在 HUB 上的 IPv6 地址表和 MAC 地址表的维护,通过每 5 秒发送 ICMPv6 数据包,以检查 IPv6 设备保持活跃状态。其结果,一个特定的期间(从 1 至 10 分钟)过去以后,在没有通信活动通过虚拟 HUB 的情况下,即使仍然活跃着,在 IPv6 地址表和 MAC 地址表中的 IPv6 设备可能会被删除。此选项可以消除大量的广播数据包,但一些 IPv6 相关的安全策略将无法有效工作。 +HUB_AO_NoIpTable 如果您将此选项设置为非零值,那么虚拟 HUB 将不会创建和维护内部 IP 地址表。此选项可以消除 CPU 和 RAM 的使用量,但一些 IP 相关的安全策略将无法有效工作。 +HUB_AO_NoMacAddressLog 如果您将此选项设置为非零值,那么这表明任何一个新的 MAC 地址注册到虚拟 HUB 上 MAC 地址表的日志,将不会被记录到安全日志中。 +HUB_AO_ManageOnlyPrivateIP 如果您将此选项设置为非零值,那么虚拟 HUB 的 IPv4 地址表将只包含私有 IPv4 地址。由于这个原因,私有 IPv4 地址是:10.0.0.0 /8,172.16.0.0/12,192.168.0.0/16 和 169.254.0.0/16。任何其他的 IPv4 地址将不会被添加到表内。 +HUB_AO_ManageOnlyLocalUnicastIPv6 如果您将此选项设置为非零值,那么虚拟 HUB 的 IPv6 地址表将只包含本地单播 IPv6 地址。由于这个原因,私有 IPv6 地址是:fe80:: / 10。任何其他的 IPv6 地址将不会被添加到表内。 +HUB_AO_DisableIPParsing 如果您将此选项设置为非零值,那么虚拟 HUB 将禁用在所有以太网数据包里的 IP 包头的内部解析函数。此选项可以消除 CPU 和 RAM 的使用量,但是虚拟 HUB 将不会执行内部 IP 地址表的建设和维护,一些 IP 相关的安全策略将无法有效工作。 +HUB_AO_YieldAfterStorePacket 如果您将此选项设置为非零值,那么在数据包的存储-转发进程后,虚拟 HUB 设置 CPU 为空闲状态。这可能导致了良好的效果,使数据包的延迟更短,但是线程关联转换的计数将增加,性能可能下降。 +HUB_AO_FilterPPPoE 如果您将此选项设置为非零值,那么虚拟 HUB 丢弃所有的 PPPoE(PPP over Ethernet)数据包。当建立两个或多个局域网之间的网桥时,方便分开每个站点的 PPPoE 网段。 +HUB_AO_FilterOSPF 如果您将此选项设置为非零值,那么虚拟 HUB 丢弃所有 OSPF (Open Shortest Path First) 数据包。 +HUB_AO_FilterIPv4 如果您将此选项设置为非零值,那么虚拟 HUB 丢弃所有的 IPv4 和 ARP 数据包。 +HUB_AO_FilterIPv6 如果您将此选项设置为非零值,那么虚拟 HUB 丢弃所有的 IPv6 数据包。 +HUB_AO_FilterNonIP 如果您将此选项设置为非零值,那么虚拟 HUB 丢弃所有非 IP 数据包(非 IPv4、ARP 或 IPv6 数据包)。顺便说一句,任何通过虚拟 HUB 的带标签的 VLAN 将被视为非IP数据包。 +HUB_AO_FilterBPDU 如果您将此选项设置为非零值,那么虚拟 HUB 丢弃所有 BPDU (Bridge Protocol Data Unit) 数据包。 +HUB_AO_NoIPv6DefaultRouterInRAWhenIPv6 如果您将此选项设置为非零值,那么虚拟 HUB 上的所有的 VPN 会话将会启用“无在IPv6 RA(物理IPv6)上的默认路由器”安全策略。当 VPN Client / VPN Bridge 和 VPN Server 之间的物理通信协议是IPv6时,任何在路由生命周期为非零值的IPv6 RA(路由器广告)数据包将设置为零值。这有效的避免了通过 VPN Client 尝试使用远端的IPv6路由器作为其本地IPv6路由器而导致的IPv6路由混乱的可怕行为。 +HUB_AO_NoLookBPDUBridgeId 如果您将此选项设置为非零值,那么虚拟 HUB 将忽略在一个 BPDU (Bridge Protocol Data Unit) 数据包里的源 MAC 地址字段。这个值是非常先进的。请不要修改它,除非你是超特殊的计算机网络专家。 +HUB_AO_NoManageVlanId 如果您将此选项设置为非零值,那么虚拟 HUB 将不会使用在 MAC 地址表中的 VLAN ID。任何有标签的VLAN数据包中的 VLAN ID 将被忽略。 +HUB_AO_VlanTypeId 以十进制指定的 VLAN 标签的以太网类型 ID (TPID)。默认值是 33024 (十六进制 0x8100)。此值是非常先进的。请不要修改它,除非你是超特殊的计算机网络专家。 +HUB_AO_FixForDLinkBPDU 如果您将此选项设置为非零值,FixForDLinkBPDU 选项将启动。此值是非常先进的。请不要修改它,除非你是超特殊的计算机网络专家。 +HUB_AO_NoIPv4PacketLog 如果您将此选项设置为非零值,那么经过虚拟 HUB 的 IPv4 数据包将不被记录。 +HUB_AO_NoIPv6PacketLog 如果您将此选项设置为非零值,那么经过虚拟 HUB 的 IPv6 数据包将不被记录。 +HUB_AO_NoSpinLockForPacketDelay 如果您将此选项设置为非零值,当数据包延迟生成函数应用于数据包时,那么 VPN Server 将不使用自旋锁机制来模仿数据包的延迟。相反,操作系统的计时器中断将被采纳。这会降低 CPU 的时间,但产生延迟的解析度将会恶化。 +HUB_AO_BroadcastStormDetectionThreshold 指定临界值每秒检测广播风暴。当从一个特定 VPN 会话的广播数据包数量超过了这个临界值时,数据包将被视为广播风暴,会被过滤。默认值(零值)为 32。 +HUB_AO_ClientMinimumRequiredBuild 如果您将此选项设置为非零值,那么虚拟 HUB 将拒绝从版本号低于这个值的、VPN Client 的任何访问。 +HUB_AO_RequiredClientId 如果您将此选项设置为非零值,那么虚拟 HUB 将拒绝从没有嵌入“客户端ID”值在软件中的、VPN Client 的任何访问。 +HUB_AO_AdjustTcpMssValue 如果您将此选项设置为非零值,那么虚拟 HUB 将调整所有 TCP/IP 数据包的包头的 MSS(最大报文段长度)值,且不超过此值。 +HUB_AO_DisableAdjustTcpMss 如果您将此选项设置为非零值,那么虚拟 HUB 上的 MSS (最大报文段长度)选项将被禁用。即使 AdjustTcpMssValue 选项是指定的,或一个 VPN 会话是由 IPsec / L2TP / EtherIP / L2TPv3 服务器功能创建的,MSS 的调节将被禁用。 +HUB_AO_NoDhcpPacketLogOutsideHub 如果您将此选项设置为非零值,那么虚拟 HUB 将不记录非关联的 DHCP 数据包的数据包日志。“非关联 DHCP 数据包”是在虚拟 HUB 上不受任何 VPN 会话约束的 DHCP 数据包。 +HUB_AO_DisableHttpParsing 如果您将此选项设置为非零值,那么虚拟 HUB 不会在所有 HTTP 数据包进行解析 HTTP 包头。这会降低 CPU 和 RAM 的使用,但是 HTTP 访问日志将不会被记录。 +HUB_AO_DisableUdpAcceleration 如果您将此选项设置为非零值,那么所有 UDP 加速功能在虚拟 HUB 的所有 VPN 会话将被禁用。 +HUB_AO_DisableUdpFilterForLocalBridgeNic 如果您将此选项设置为非零值,那么虚拟 HUB 禁用故障预防过滤功能,来过滤可能会导致网络不稳定的 DHCP 数据包。默认情况下,本地桥接口有时会尝试从远端 DHCP 服务器获取一个 IP 地址,但是这样的行为在路由表中会无限循环。过滤功能可避免这样的问题。此选项可以禁用过滤功能。 +HUB_AO_ApplyIPv4AccessListOnArpPacket 如果您将此选项设置为非零值,那么 IPv4 访问列表条目将不仅被应用在 IPv4 数据包,而且还在 ARP 数据包。这样方便过滤不必要的、可能会带来麻烦的 ARP 数据包。 +HUB_AO_RemoveDefGwOnDhcpForLocalhost 如果您将此选项设置为非零值,当本地主机上的一个 VPN Client 连接到虚拟 HUB ,并试图从虚拟 HUB 网段的 DHCP 服务器获取一个 IP 地址,相应的 DHCP 响应数据包将被丢弃。它可以防止意想不到的数据包路由的无限循环。 +HUB_AO_SecureNAT_MaxTcpSessionsPerIp 如果您将此选项设置为非零值,那么每个 IP 状态的 TCP 连接数(不是 SYN_SENT)将被限制为此值。 +HUB_AO_SecureNAT_MaxTcpSynSentPerIp 如果您将此选项设置为非零值,那么每个 IP 状态的 TCP 连接数(是 SYN_SENT)将被限制为此值。 +HUB_AO_SecureNAT_MaxUdpSessionsPerIp 如果您将此选项设置为非零值,那么每个 IP 状态的 UDP 会话数将被限制为此值。 +HUB_AO_SecureNAT_MaxDnsSessionsPerIp 如果您将此选项设置为非零值,那么每个非 SYN_SENT 状态 IP 的 DNS 会话数将被限制为此值。 +HUB_AO_SecureNAT_MaxIcmpSessionsPerIp 如果您将此选项设置为非零值,那么每个非 SYN_SENT 状态 IP 的 ICMP 会话数将被限制为此值。 +HUB_AO_AccessListIncludeFileCacheLifetime 指定以秒为周期保存外部用户列表文件的缓存,此文件是以“include:”或“exclude:”格式作为它的用户名的、访问列表条目。 +HUB_AO_DisableKernelModeSecureNAT 如果您将此选项设置为非零值,那么在 SecureNAT 功能上的内核模式 NAT 功能将被禁用。内核模式 NAT 是加速SecureNAT 虚拟 NAT 功能表现的一个功能。内核模式 NAT 只有当 VPN 服务器进程以系统权限(即根,系统或管理员情况下)正在运行时,可以工作。如果内核模式 NAT 引起一些错误的操作,使用此选项来禁用它。 +HUB_AO_DisableUserModeSecureNAT 如果您将此选项设置为非零值,那么在 SecureNAT 功能上的用户模式 NAT 功能将被禁用。用户模式 NAT 是一个使 NAT 可以作为普通用户权限运行的功能。 +HUB_AO_DisableCheckMacOnLocalBridge 如果您将此选项设置为非零值,那么 MAC 地址重复检查在本地桥功能上将被禁用。一些网络适配器有反射传出的数据包向虚拟 HUB 的问题。虚拟 HUB 自动检测这样的重复,并丢弃它们。启用此标志来禁用检测,并丢弃。 +HUB_AO_DisableCorrectIpOffloadChecksum 如果您将此选项设置为非零值,那么在本地桥功能上检查和纠正 IP 校验和值。有些有 IP、TCP 或 UDP 包头的校验和卸载引擎的网络适配器,以不完整的校验和值传输数据包。这样的数据包不能被接收端正确对待。所以本地桥检测到这样的数据包,并纠正了它的校验和字段。启用此标志来禁用这种纠正。 +HUB_AO_BroadcastLimiterStrictMode If you set this option to non-zero value, then the broadcast-storm detection algorithm will compare either source or destination IP address of each packet. If any of the two fields matches, the packet will be recorded on the short-term history of broadcast-storm detection state machine. +HUB_AO_MaxLoggedPacketsPerMinute Maximum number of logging target packets per minute. +HUB_AO_DoNotSaveHeavySecurityLogs Do not take heavy security log. +HUB_AO_DropBroadcastsInPrivacyFilterMode Drop broadcasting packets if the both source and destination session is PrivacyFilter mode. +HUB_AO_DropArpInPrivacyFilterMode Drop ARP packets if the both source and destination session is PrivacyFilter mode. +HUB_AO_SuppressClientUpdateNotification Suppress the update notification screen on the VPN Client. +HUB_AO_FloodingSendQueueBufferQuota Specify the quota limitation value (in bytes) of the sending queue buffer size which the flooding operation on the Virtual Hub can consume. The quota value is applied on the total length of sending queues of all active VPN sessions. Specify '0' to disable the quota. This option is effective to solve the out-of-memory problem on the network where there are many flooding packets. +HUB_AO_AssignVLanIdByRadiusAttribute Enable the VLAN ID dynamic assignment function. Each VPN session will be assigned its own VLAN ID by the RADIUS attribute value when the user is authenticated by the external RADIUS server unless the user object has a VLAN ID security policy. The RADIUS attribute with the name "Tunnel-Pvt-Group-ID" (ID = 81) will be used as the VLAN ID. The data type must be STRING. +HUB_AO_DenyAllRadiusLoginWithNoVlanAssign If you set this option to non-zero value, then all users, which RADIUS server returns no "Tunnel-Pvt-Group-ID" (ID = 81) value, will be denied to connect to the Virtual Hub. (Only if the values of AssignVLanIdByRadiusAttribute is non-zero value.) +HUB_AO_SecureNAT_RandomizeAssignIp If you set this option to non-zero value, then the Virtual DHCP Server of the SecureNAT function will choose an unused IP address randomly from the DHCP pool while the default behavior is to choose the first unused IP address. +HUB_AO_DetectDormantSessionInterval If you set this option to non-zero value, then the Virtual Hub will treat the VPN sessions, which have transmitted no packets for the last specified intervals (in seconds), as Dormant Sessions. The Virtual Hub will not flood packets, which should be flood, to any Dormant Sessions. +HUB_AO_NoPhysicalIPOnPacketLog If you set this option to non-zero value, then the physical IP addresses of VPN clients of either the source VPN session or the destination VPN session will not be recorded on the packet log file. +HUB_AO_UseHubNameAsDhcpUserClassOption If you set this option to non-zero value, then the Virtual Hub Name will be added to a DHCP request to an external DHCP server as the "User-Class" option. This allows to use separate pools of IP addresses for each Virtual Hub. (For only L2TP/IPsec and OpenVPN sessions.) +HUB_AO_UseHubNameAsRadiusNasId If you set this option to non-zero value, then the NAS-Identifier RADIUS attribute will be set to a name of the Virtual Hub. This allows to determine on RADIUS server whether access to the Virtual Hub should be granted or denied. + + + +#关于失败连接对话框 +ERRDLG_ERRMSG 错误(错误代码 %u) :\r\n\r\n%s\r\n +ERRDLG_RETRYCOUNT %u 秒后将自动进行重新连接... +ERRDLG_INFORMATION 点击“重试”,重新进行连接。 +ERRDLG_RETRY_INFO_1 你想重试吗? (%u 重试 / %u 总重试) +ERRDLG_RETRY_INFO_2 你想重试吗? (%u 重试 / 总无限重试) +ERRDLG_DISCONNECTED_MSG VPN Server "%S" 连接已被切断 +ERRDLG_DEVICE_ERROR 与 VPN Server 的连接被中断,因为虚拟网络适配器 (设备名称: %S) 已停止。\r\n\r\n错误代码 %u: %s + + +# 关于协议 +PROTO_DIRECT_TCP 直接的 TCP/IP 连接 +PROTO_HTTP_PROXY 通过 HTTP 代理服务器连接 +PROTO_SOCKS_PROXY 通过 SOCKS4 代理服务器连接 +PROTO_SOCKS5_PROXY 通过 SOCKS5 代理服务器连接 +PROTO_SSH 通过 SSH 服务器连接 +PROTO_UNKNOWN 未知协议 + + + +# 关于caps(控制字符) +CAPS_YES 是 +CAPS_NO 否 +# (标题) +CT_i_max_packet_size 最大的以太网数据包大小 +CT_i_max_hubs 最大虚拟 HUB 数 +CT_i_max_user_creation 整个 VPN Server 的最大用户数 +CT_i_max_sessions 最大总会话数 +CT_i_max_clients 最大客户端会话数 +CT_i_max_bridges 最大网桥会话数 +CT_i_max_users_per_hub 每虚拟 HUB 最大用户容量 +CT_i_max_groups_per_hub 每虚拟 HUB 最大群容量 +CT_i_max_access_lists 每虚拟 HUB 最大访问列表容量 +CT_i_max_mac_tables 每虚拟 HUB 最大 MAC 地址容量 +CT_i_max_ip_tables 每虚拟 HUB 最大 IP 地址容量 +CT_i_max_secnat_tables 每虚拟 HUB 最大 SecureNAT 容量 +CT_i_max_l3_sw 最大虚拟 3 层交换机数 +CT_i_max_l3_if 每虚拟 3 层交换机最大虚拟接口容量 +CT_i_max_l3_table 每虚拟 3 层交换机最大路由表容量 +CT_b_bridge 作为 VPN Bridge 软件工作 +CT_b_standalone 独立模式 +CT_b_cluster_controller 群集控制器模式 +CT_b_cluster_member 群集成员模式 +CT_b_vpn_client_connect 接受 VPN Client / Bridge 的连接 +CT_b_local_bridge 支持本地网桥 +CT_b_must_install_pcap 未安装数据包捕获驱动 +CT_b_tap_supported 支持 tun/tap 设备 (仅在 Linux) +CT_b_support_config_hub 支持更改虚拟 HUB 设置 +CT_b_support_securenat 支持 SecureNAT +CT_b_virtual_nat_disabled 虚拟 NAT 无效 (仅 DHCP 有效) +CT_b_support_cascade 支持级联连接 +CT_b_support_cascade_cert 支持级联连接服务器认证 +CT_b_support_config_log 支持更改保存日志设置 +CT_b_support_autodelete 支持自动删除日志文件 +CT_b_support_radius 支持外部认证服务器 +CT_b_support_config_rw 支持 Config 文件的远程读写 +CT_b_support_hub_admin_option 支持虚拟 HUB 管理选项 +CT_b_support_cascade_client_cert 支持级联连接客户证书 +CT_b_support_hide_hub 支持虚拟 HUB 枚举设定 +CT_b_support_cluster_admin 支持对所有群集模式的综合管理 +CT_b_support_cluster 支持部分群集模式的运行 +CT_b_support_cluster_controller 作为群集控制器操作 +CT_b_support_layer3 支持虚拟 3 层交换机 +CT_b_support_crl 支持虚拟 HUB 特定证书吊销列表 +CT_b_support_ac 支持特有的虚拟 HUB 源 IP 地址限制列表 +CT_b_support_read_log 支持日志文件的下载 +CT_b_support_rename_cascade 支持级联连接名的变更 +CT_b_support_license 支持许可证管理 +CT_b_support_limit_multilogin 支持对同一用户多个登录的限制 +CT_b_support_qos 支持 VoIP / QoS 功能 +CT_b_support_syslog 支持系统日志发送功能 +CT_b_cluster_hub_type_fixed 固定群集虚拟 HUB 种类 +CT_b_beta_version 测试版 (预发布版本) +CT_b_support_check_mac 支持在访问列表中指定 MAC 地址 +CT_b_support_check_tcp_state 支持检测 TCP 连接的状态过滤 +CT_b_support_network_connection_name 支持获取网络友好名称 +CT_b_support_radius_retry_interval_and_several_servers 在 RADIUS 身份验证里支持重试间隔和多个服务器 +CT_b_support_vlan 在 MAC 地址表里支持带标签的 VLAN ID +CT_b_support_hub_ext_options 支持虚拟 HUB 扩展选项 +CT_b_support_policy_ver_3 支持安全策略 3.0 版本 +CT_b_support_ipv6_acl 支持 IPv6 访问列表 +CT_b_support_ex_acl 支持访问列表延时、时基误差和数据包丢失 +CT_b_support_acl_group 支持访问列表通过组名调节 +CT_b_support_ipv6_ac 支持 IPv6 IP 访问控制列表 +CT_b_support_eth_vlan 支持带标记的 VLAN 数据包透明支持工具 +CT_b_support_msg 支持今日消息功能 +CT_b_vpn3 支持 3.0 的功能 +CT_b_vpn4 支持 4.0 的功能 +CT_b_support_ipsec 支持 IPsec / L2TP / EtherIP / L2TPv3 服务器功能 +CT_b_support_sstp 支持 MS-SSTP VPN Server 功能 +CT_b_support_udp_acceleration 支持 UDP 加速功能 +CT_b_support_openvpn 支持 OpenVPN Server 功能 +CT_b_support_ddns 支持动态 DNS 客户端功能 +CT_b_support_ddns_proxy 支持 DDNS 通过代理服务器 +CT_b_support_special_listener 支持 VPN over ICMP 和 VPN over DNS +CT_b_support_redirect_url_acl 支持访问列表 HTTP URL 改道 +CT_b_is_in_vm 虚拟机上运行 +CT_b_support_azure 支持 VPN Azure +CT_b_support_aes_ni 支持 CPU AES 加密加速功能 (AES-NI) +CT_b_using_selow_driver 支持 SoftEther Lightweight Kernel-mode Ethernet Driver +CT_b_support_vgs 支持 VPN Gate 服务的服务器功能 +CT_b_support_vgs_in_client VPN Gate 服务的服务器功能 (VPN 客户端集成) +CT_b_is_softether SoftEther VPN 的免费或开源版 +CT_b_suppport_push_route 静态路由表推送功能 +CT_b_suppport_push_route_config 静态路由表推送功能 (可配置) + + +#相关策略 +POL_TITLE_STR 策略名 +POL_VALUE_STR 现在值 +POL_TYPE_BOOL 开 / 关 +POL_TYPE_INT 整数 +POL_BOOL_ENABLE 有效 +POL_BOOL_DISABLE - +POL_BOOL_DISABLE_EX - +POL_INT_ZERO - +POL_INT_COUNT %u 个 +POL_INT_SEC %u 秒 +POL_INT_BPS %u bps +POL_INT_VLAN %u + +# Ver 2.0 +POL_0 允许访问 +POL_EX_0 用户定义的这项策略的权限,使 VPN 连接到 VPN Server。 +POL_1 DHCP 数据包过滤器 (IPv4) +POL_EX_1 此策略定义的所有会话中的 IPv4 的 DHCP 数据包将被过滤。 +POL_2 禁止 DHCP 服务器运行 (IPv4) +POL_EX_2 连接到有此策略设置的会话的计算机,将无法成为 DHCP 服务器,也无法对 DHCP 用户分配 IPv4 / DNS 信息。 +POL_3 强制 DHCP 分配 IP 地址 (IPv4) +POL_EX_3 有此策略设置的会话的计算机,只能使用虚拟网络侧的 DHCP 服务器提供的 IPv4 地址。 +POL_4 拒绝网桥运行 +POL_EX_4 网桥模式的连接被有此策略设置的用户会话拒绝。即使当以太网网桥在客户端被配置的情况下,通信将是不可能的。 +POL_5 拒绝路由操作 (IPv4) +POL_EX_5 有此策略设置的会话将拒绝 IPv4 路由。即便 IP 路由器运行在客户端,通讯仍将无法建立。 +POL_6 拒绝 MAC 地址复制 +POL_EX_6 有此策略设置的会话无法使用正在被不同会话的计算机占用的重复 MAC 地址。 +POL_7 拒绝 IP 地址复制 (IPv4) +POL_EX_7 有此策略设置的会话无法使用正在被不同会话的计算机占用的重复 IPv4 地址。 +POL_8 拒绝非的 ARP / 非 DHCP / 非 ICMPv6 广播 +POL_EX_8 有此策略设置的会话不允许在虚拟网络上有 ARP 协议,DHCP 协议、ICMPv6 协议广播数据包的发送和接收 +POL_9 隐私过滤器模式 +POL_EX_9 有隐私过滤器模式策略设置的会话间的全部通信将被过滤。 +POL_10 拒绝作为 TCP/IP 服务器运行 (IPv4) +POL_EX_10 有此会话策略设置的计算机无法收听和接受 IPv4 TCP/IP 连接。 +POL_11 无限制的广播数量 +POL_EX_11 有此会话策略设置的计算机,如果在虚拟网络上发送超过一般情况的广播数据包量,系统将不做自动限制。 +POL_12 允许监测模式 +POL_EX_12 有此策略设置的用户允许连接到监测模式下的虚拟 HUB 上。监测模式下的会话可以监听(tap)所有流经此虚拟 HUB 的数据包。 +POL_13 最大的 TCP 连接数 +POL_EX_13 对有此策略设置的会话,它设置了物理 TCP 连接的最大数目,包括在一个物理 VPN 会话中。 +POL_14 超时期限 +POL_EX_14 对有此策略设置的会话,当 VPN Server 和 VPN Client 之间发生通信问题时,此设置在中断一个会话前等待超时期限 (以秒为单位)。 +POL_15 最大 MAC 地址数 +POL_EX_15 对有此策略设置的会话,设置每会话最大 MAC 地址数。 +POL_16 最大 IP 地址数 (IPv4) +POL_EX_16 对有此策略设置的会话,指定单个会话可注册的 IPv4 地址数。 +POL_17 上传带宽 +POL_EX_17 对有此策略设置的会话,限制虚拟路由器上由外至内的数据流量带宽。 +POL_18 下载带宽 +POL_EX_18 对有此策略设置的会话,限制虚拟路由器上由内至外的数据流量带宽。 +POL_19 拒绝更改密码 +POL_EX_19 有此密码验证策略设置的用户将无法在 VPN Client 管理器上进行密码的更换。 +POL_20 最大多重登录数 +POL_EX_20 有此策略设置的用户无法进行多于设置数的并发登录数。 网桥模式会话不适用于此策略。此安全策略仅在 VPN Server 3.0 或以上版本,或具有多重登录限制功能的 VPN Server 2.0 版上有效。 +POL_21 禁止 VoIP / QoS 功能 +POL_EX_21 有此策略设置的用户,无法在 VPN 连接会话中使用VoIP / QoS功能。此安全策略仅在 VPN Server 3.0 或以上版本,或具有 VoIP / QoS 功能的 VPN Server 2.0 版上有效。 + +# ----- 不完全翻訳ここから ----- +# Ver 3.0 +POL_22 过滤 RS/RA 数据包(IPv6) +POL_EX_22 此策略定义的会话中消息类型为 133(路由器请求)或 134(路由器通告)的所有 ICMPv6 数据包将被过滤。因此,IPv6 客户端将无法使用 IPv6 地址前缀自动检测和 IPv6 默认网关自动检测。 +POL_23 过滤 RA 数据包(IPv6) +POL_EX_23 此策略定义的会话中消息类型为 134(路由器通告)的所有 ICMPv6 数据包将被过滤。因此,恶意用户将不能在网络中传播非法的 IPv6 地址前缀或默认网关广告。 +POL_24 过滤 DHCP 数据包(IPv6) +POL_EX_24 此策略定义的所有会话中的 IPv6 的 DHCP 数据包将被过滤。 +POL_25 不允许 DHCP 服务器运行(IPv6) +POL_EX_25 连接到有此策略设置的会话的计算机将不允许成为 DHCP 服务器,也无法对 DHCP 用户分配 IPv6 地址 / DNS 信息。 +POL_26 拒绝路由操作 (IPv6) +POL_EX_26 有此策略设置的会话将拒绝 IPv6 路由。即便 IP 路由器运行在客户端,通讯仍将无法建立。 +POL_27 拒绝 IP 地址复制 (IPv6) +POL_EX_27 有此策略设置的会话无法使用正在被不同会话的计算机占用的复制的 IPv6 地址。 +POL_28 拒绝作为 TCP/IP 服务器运行 (IPv6) +POL_EX_28 有此策略设置会话的计算机不能收听或接受 IPv6 TCP/IP连接。 +POL_29 最大 IP 地址数 (IPv6) +POL_EX_29 对有此策略设置的会话,指定单个会话可注册的 IPv6 地址数。 +POL_30 VPN Client 不接受密码保存 +POL_EX_30 对有此策略设置的用户,用户在客户端将不再能够保存密码。用户每次连接 VPN 时均需要输入密码。这将提高安全性。如果启用此策略, VPN Client 2.0 版本将被拒绝连接。 +POL_31 VPN Client 自动断开 +POL_EX_31 对有此策略设置的用户,在特定的一段时间过去后,用户的 VPN 会话将被自动断开。这种情况下将不执行自动重新连接。这将防止大量不活跃的 VPN 会话。如果启用此策略, VPN Client 2.0 版将被拒绝连接。 +POL_32 过滤所有 IPv4 数据包 +POL_EX_32 对定义此策略会话的所有 IPv4 和 ARP 据包将被过滤。 +POL_33 过滤所有 IPv6 数据包 +POL_EX_33 对定义此策略会话的所有 IPv6 数据包将被拦截。 +POL_34 过滤所有非 IP 数据包 +POL_EX_34 对定义此策略的所有非 IP 数据包将被过滤。“非 IP 数据包”意思是不是IPv4, ARP, 也不是 IPv6 的数据包。所有通过虚拟 HUB 的带标签的 VLAN 数据包将被认为是非 IP 数据包。 +POL_35 在 IPv6 RA 上的非默认路由器 +POL_EX_35 对定义此策略的所有 VPN 会话中,任何 IPv6 RA(路由器通告)路由器的寿命为非零值的数据包将设置为零值。这可以有效避免 VPN Client 尝试使用远端的 IPv6 路由器作为其本地 IPv6 路由器而造成 IPv6 路由混乱的可怕行为。 +POL_36 在 IPv6 RA 无默认路由器(物理 IPv6) +POL_EX_36 对定义此策略的所有 VPN 会话(只有当 VPN Client / VPN Bridge 和 VPN Server 之间的物理通信协议是 IPv6 时),任何 IPv6 RA(路由器通告)路由器的寿命为非零值的数据包将设置为零值。这可以有效避免 VPN Client 尝试使用远端的 IPv6 路由器作为其本地 IPv6 路由器而造成 IPv6 路由混乱的可怕行为。 +POL_37 VLAN ID (IEEE802.1Q) +POL_EX_37 您可以指定 VLAN ID 的安全策略。所有的 VPN 会话定义了此策略,所有从用户到虚拟 HUB 的以太网数据包将被插入一个带 VLAN ID 的 VLAN 标签(IEEE 802.1Q)。用户还可以收到具有相同的 VLAN ID 的 VLAN 标签的数据包。(接收过程会自动删除 VLAN 标签)。带有任何其他 VLAN ID 或非 VLAN 数据包的以太网数据包将不会收到。所有没有这个策略定义的 VPN 会话可以发送/接收任何类型的以太网数据包,不管 VLAN 标签,VLAN标签也不会被自动插入或删除。通过虚拟 HUB 的任何带标签的 VLAN 数据包将被视为非 IP 数据包。因此,带标签的 VLAN 数据包不受制于 IPv4/IPv6 安全策略,访问列表也不受其他 IPv4/IPv6 特定的深入处理。 +# ----- 不完全翻訳ここまで ----- + + +# 关于远程连接对话框 +REMOTE_DEF_CAPTION 远程连接 +REMOTE_DEF_TITLE 指定你要进行远程连接的计算机。 + + +#关于客户通知服务 +CN_TITLE SoftEther VPN Client Developer Edition + + +# 关于连接管理器 +CM_TITLE SoftEther VPN Client Developer Edition 管理器 +CM_PW_LOCALMACHINE 本地计算机 +CM_NO_REMOTE VPN Client 服务运行在 %s 上,不允许远程连接。 +CM_CONNECT_FAILED 无法连接到 %s 上的 VPN Client 服务。\r\n确认 VPN 服务已开启并正常运行。 +CM_BAD_PASSWORD 密码错误。请重新输入密码。密码大小写敏感。 +CM_NUM_CONN_COUNT VPN 连接中: %u 账户 +CM_CONN_NO 未连接 +CM_PRODUCT_NAME SoftEther VPN Client Build %u +CM_ACCOUNT_COLUMN_1 VPN 连接设置名称 +CM_ACCOUNT_COLUMN_2 状态 +CM_ACCOUNT_COLUMN_3 VPN Server 主机名(地址) +CM_ACCOUNT_COLUMN_3_2 虚拟 HUB 名称 +CM_ACCOUNT_COLUMN_4 虚拟网络适配器名 +CM_VLAN_COLUMN_1 虚拟网络适配器名 +CM_VLAN_COLUMN_2 状态 +CM_VLAN_COLUMN_3 MAC 地址 +CM_VLAN_COLUMN_4 版本 +CM_ACCOUNT_OFFLINE 离线 +CM_ACCOUNT_ONLINE 已连接 +CM_ACCOUNT_CONNECTING 连接中 +CM_VLAN_ENABLED 已启用 +CM_VLAN_DISABLED 已禁用 +CM_DELETE_ACCOUNT_MSG VPN 连接设置 "%s" 将删除,你确定吗? +CM_ST_ACCOUNT_NAME VPN 连接设置名称 +CM_ST_CONNECTED 会话状态 +CM_ST_CONNECTED_TRUE 连接完成 (会话建立) +CM_ST_CONNECTED_FALSE 尝试连接 +CM_ST_CONNECTING 开始连接 VPN 服务器 +CM_ST_NEGOTIATION 协商中 +CM_ST_AUTH 验证用户身份 +CM_ST_ESTABLISHED 连接已建立 +CM_ST_RETRY 重试 +CM_ST_IDLE 空闲状态 +CM_ST_SERVER_NAME 服务器名 +CM_ST_SERVER_PORT 端口号 +CM_ST_PORT_TCP TCP 端口 %u +CM_ST_SERVER_P_NAME 服务端产品名称 +CM_ST_SERVER_P_VER 服务端版本 +CM_ST_SERVER_P_BUILD 服务端内部标号 +CM_ST_START_TIME 连接开始时间 +CM_ST_FIRST_ESTAB_TIME 首次会话建立时间 +CM_ST_NONE - +CM_ST_CURR_ESTAB_TIME 当前会话建立时间 +CM_ST_NUM_ESTABLISHED 已建立的会话数 +CM_ST_NUM_STR %u 次 +CM_ST_HALF_CONNECTION 半双工 TCP 连接模式 +CM_ST_HALF_TRUE 是 (半双工模式) +CM_ST_HALF_FALSE 否 (全双工模式) +CM_ST_QOS VoIP / QoS 功能 +CM_ST_QOS_TRUE 已启用 +CM_ST_QOS_FALSE 已禁用 +CM_ST_NUM_TCP TCP 连接数 +CM_ST_NUM_TCP_UPLOAD 上行传输 TCP 连接数 +CM_ST_NUM_TCP_DOWNLOAD 下行传输 TCP 连接数 +CM_ST_MAX_TCP TCP 连接数最大值 +CM_ST_VLAN_ID VLAN ID +CM_ST_NO_VLAN - +CM_ST_USE_ENCRYPT 加密 +CM_ST_USE_ENCRYPT_TRUE 已启用 (算法: %S) +CM_ST_USE_ENCRYPT_TRUE2 已启用 +CM_ST_USE_ENCRYPT_FALSE 已禁用 (不加密) +CM_ST_USE_COMPRESS 使用压缩 +CM_ST_UDP_ACCEL_ENABLED 支持 UDP 加速 +CM_ST_UDP_ACCEL_USING UDP 加速已激活 +CM_ST_RUDP TCP over UDP (NAT 穿透) +CM_ST_UNDERLAY_PROTOCOL 物理底层协议 +CM_ST_COMPRESS_TRUE 是 (%u %%) +CM_ST_COMPRESS_FALSE 否 (不压缩) +CM_ST_SESSION_NAME 会话名 +CM_ST_CONNECTION_NAME 连接名 +CM_ST_SESSION_KEY 会话密钥 (160 位) +CM_ST_BRIDGE_MODE 网桥 / 路由模式 +CM_ST_MONITOR_MODE 监测模式 +CM_ST_YES 是 +CM_ST_NO 否 +CM_ST_SEND_SIZE 输出数据量 +CM_ST_RECV_SIZE 输入数据量 + +CM_ST_SEND_UCAST_NUM 传出单播数据包 +CM_ST_SEND_UCAST_SIZE 传出单播总量 +CM_ST_SEND_BCAST_NUM 传出广播数据包 +CM_ST_SEND_BCAST_SIZE 传出广播总量 + +CM_ST_RECV_UCAST_NUM 传入单播数据包 +CM_ST_RECV_UCAST_SIZE 传入单播总量 +CM_ST_RECV_BCAST_NUM 传入广播数据包 +CM_ST_RECV_BCAST_SIZE 传入广播总量 + +CM_ST_NUM_PACKET_STR %S 数据包 +CM_ST_SIZE_BYTE_STR %S 字节 + +CM_NEW_ICON 添加新的 VPN 连接 +CM_VGC_ICON VPN Gate 公共 VPN 中继服务器 +CM_VGC_LINK VPN Gate 学术试验 Web 网站 +CM_ST_TITLE %s 的连接状态 +CM_ST_COLUMN_1 项目 +CM_ST_COLUMN_2 状态 +CM_NEW_ACCOUNT_NAME_1 新的 VPN 连接 +CM_NEW_ACCOUNT_NAME_2 新的 VPN 连接 (%u) +CM_ACCOUNT_TITLE_1 新的 VPN 连接设置属性 +CM_ACCOUNT_TITLE_2 %s 的属性 +CM_SERVER_CERT_1 指定特定证书登录(&R) +CM_SERVER_CERT_2 指定特定证书删除(&D) +CM_CLIENT_CERT_1 指定客户端证书(&C) +CM_CLIENT_CERT_2 删除客户端证书(&C) +CM_CERT_INFO 发行对象: %s\r\n发行人: %s\r\n有效期限: %s +CM_NO_CERT 您必须指定一个客户端证书用于用户身份验证。 +CM_NO_SECURE 指定智能卡内的客户证书和个人密码,以用于用户身份验证。 +CM_CERT_SECURE_INFO 证书: "%S"\r\n密钥: "%S" +CM_SELECT_SECURE_DEVICE 选择智能卡(&P) +CM_SELECT_CERT_INCARD 指定证书及密钥(&V) +CM_VIEW_CLIENT_CERT 查看客户端证书(&V) +CM_NO_VLAN 在你创建一个新的 VPN 连接设置前,需要创建一个虚拟网络适配器。\r\n\r\n你想创建一个虚拟网络适配器吗? +CM_NO_VLAN_2 在连接到 VPN Server 前,你需要创建一个虚拟网络适配器。\r\n\r\n你想创建一个虚拟网络适配器吗? +CM_VLAN_REMOTE_ERROR 无法远程创建虚拟网络适配器。\r\n请在有 VPN Client 服务的本地计算机上启动 VPN Client 管理器,安装虚拟网络适配器。 +CM_9X_VLAN_INSTALL 一个新的虚拟网络适配器现在将被创建。\r\n\r\n创建虚拟网络适配器后,需要重新启动 Windows 系统。\n在虚拟网络适配器安装进行中,可能会要求你插入 Windows CD-ROM 安装盘。关闭除 VPN Client 管理器程序以外的当前所有的运行程序,准备好 Windows 安装盘,单击“确定”。\r\n单击确定将开始虚拟网络适配器的安装。安装完成后,Windows 将自动重启。 +CM_9X_VLAN_ME_MESSAGE 虚拟网络适配器已创建。在单击“确定”后,计算机将自动重新启动。\r\n\r\n计算机重新启动后,可能会出现安装新设备向导。\r\n如果该向导出现,单击每一个屏幕上的“下一步“,直到安装完成。 +CM_9X_VLAN_UNINSTALL 若要删除虚拟网络适配器,请从网络属性中删除。 \r\n\r\n你想要显示网络属性窗口吗? +CM_PORT_1 8888 (PX-VPN 端口) +CM_PORT_2 443 (HTTPS 端口) +CM_PORT_3 992 (telnets 端口) +CM_PORT_4 5555 (SE-VPN 端口) +CM_RETRY_INTERVAL_ERROR 当 VPN 连接断开时,设置重新连接间隔(至少 5 秒)。 +CM_DELETE_CLIENT_CERT 这将删除已经设置的客户端证书。你确定要删除吗? +CM_DELETE_SERVER_CERT 这将删除已经设置的服务端特定证书。你确定要删除吗? +CM_SET_STARTUP VPN 连接设置 "%s" 当前设置为启动连接设置。\r\n当下次重新启动计算机后,账户将被自动连接。\r\n(如果你使用的是 Windows,在用户登录到 Windows 前,自动连接将在后台模式下启动。) +CM_REMOVE_STARTUP 你希望删除 VPN 设置 "%s" 的启动连接属性吗? +CM_NO_DISCONNECT_SPAN 请设置 TCP 连接的使用寿命。 +CM_HALF_MSG 当使用半双工模式时,设置的 TCP 连接数至少是2个。 +CM_TOO_SMALL_INTERVAL 设置建立一个 TCP 连接的时间间隔至少是 1 秒钟 +CM_DELETE_VLAN 这将删除虚拟网络适配器 "%s"。你确定删除吗? +CM_COPY_NAME_1 复件 %s +CM_COPY_NAME_2 复件 (%u) %s +CM_IMPORT_NAME_1 %s +CM_IMPORT_NAME_2 %s (%u) +CM_CERT_COLUMN_1 发给 +CM_CERT_COLUMN_2 发行人 +CM_CERT_COLUMN_3 有效期限 +CM_CERT_DELETE_MSG 从列表中删除此证书? +CM_PASSWORD_SET 设定的密码。 +CM_PASSWORD_REMOVE 设置的密码被删除。 +CM_UNDER_CONSTRUCTION 未完成的。 +CM_CURRENT_ACTIVE VPN 连接设置 "%s" 的设定已经保存,但这个 VPN 连接设置当前正在线,新的设置直到下一次连接才能适用。 +CM_DISCONNECT_ALL 这将断开所有的 %u 个 VPN 连接设置的当前连接。\r\n你确定要这样做吗? +CM_HTTPS_MSG 您已经选择通过 HTTP 代理服务器进行连接。\r\n\r\n平常的 HTTP 代理服务器不允许访问您所选择的 TCP 端口。\r\n当 VPN Client 通过 HTTP 代理服务器连接到 VPN Server 时,可能会通过使用 HTTPS (HTTP over SSL) 通信进行连接。\r\n在此情况下,建议您指定 443 (HTTPS 端口) 最为目标 VPN Server 的端口号。\r\n(如果您指定了一个其它端口号,可能会无法通过 HTTP 代理服务器进行连接。\r\n确定目标 VPN Server 已启用 443 端口。) \r\n\r\n如果需要详细信息,请与您计划在连接中经过的 HTTP 代理服务器的系统管理员或网络管理员联系。\r\n\r\n您是否确定改变目标 VPN Server 端口号为 443 (HTTPS 端口)? +CM_REMOTE_WARNING 您正在禁用远程管理。\r\n\r\n当前 VPN Client 管理器正连接到远程计算机 "%S" 并正在控制它的 VPN Client 服务。\r\n如果禁用远程管理,将无法继续远程连接计算机 "%S" 并通过 VPN Client 管理器对 VPN Client 服务进行控制。\r\n\r\n是否确认禁用远程管理? +CM_KEEP_INTERVAL_MSG 设置“数据包发送间隔” 为 %u 到 %u 秒。 +CM_REMOTE_TITLE 可以使用 VPN Client 管理器连接另一台计算机并远程管理它的 VPN Client 服务。\r\n(注意: 远程计算机必须允许远程管理。) +CM_DESKTOP_LOCAL_PC 本地计算机 +CM_DESKTOP_REMOTE_PC 计算机 %S +CM_DESKTOP_MSG_LOCAL_TS 终端服务 (远程桌面) 功能 +CM_DESKTOP_MSG_LOCAL_SW 切换用户功能 +CM_DESKTOP_MSG_LOCAL_1 目前,%s 安装在这台计算机上,提供了允许多用户登录的环境。在此情况下,VPN Client 显示的进展状态信息,错误信息和其它信息将被显示在“控制台会话”中。 +CM_DESKTOP_MSG_LOCAL_21 “会话 ID: 0,用户 %s”在这台计算机被分配为控制台进程。但是由于您已经在进程 %u 上开启 VPN Client 管理器,因此无法显示 VPN Client 上进度状态或错误等信息。 +CM_DESKTOP_MSG_LOCAL_22 目前这台计算机上的控制台会话“会话ID: 0”没有被登录。并且因为您在会话 %u 上启动了 VPN Client 管理器,因此无法显示 VPN Client 上进度状态或错误等信息。 +CM_DESKTOP_MSG_LOCAL_31 建议当此计算机的控制台会话 (会话ID: 0,用户 %s) 显示时,在此会话中启动 VPN Client 服务器并启动 VPN 连接设置“%s”。由此您将可以启动连接进程,但要承担无法检查进度状态或错误信息的风险。 +CM_DESKTOP_MSG_LOCAL_32 建议您先注销,然后再从本地登入。运行 VPN Client 管理器会话,并启动 VPN 连接设置“%s”。由此您将可以启动连接进程,但要承担无法检查进度状态或错误信息的风险。 +CM_DESKTOP_MSG_REMOTE_1 由于您在远程连接到计算机 %S 上的 VPN Client 时执行的动作,您将无法看到 VPN Client 显示的诸如进程状态或错误信息。 +CM_DESKTOP_MSG_REMOTE_2 要检查所有 VPN Client 显示的进程状态,错误和其他信息,您必须从计算机 %S 本地登入并显示控制会话 (桌面)。 +CM_DESKTOP_MSG_REMOTE_3 建议您直接从本地 (%S) 登入。运行 VPN Client 管理器会话,并启动 VPN 连接设置“%s”。由此您将可以启动连接进程,但要承担无法检查进度状态或错误信息的风险。 +CM_STOP_INST_VLAN_1 要想在此计算机上安装虚拟网络适配器,您必须在“控制台会话”下启动 VPN Client 管理器。\r\n\r\n目前,此计算机上已安装 %s,且用户已登入远程会话 (会话ID: %u) 而不是控制台进程。\r\n若要安装虚拟网络适配器,必须在控制台会话 (会话ID: %u,用户 %s 已登录) 下启动 VPN Client 管理器。\r\n\r\n首先使用切换用户功能从本地登入到计算机,或在远程桌面使用 “/console” 论据功能,或切换计算机的本地控制台设备,之后启动 VPN Client 管理器,并安装虚拟网络适配器。 +CM_STOP_INST_VLAN_2 要想在此计算机上安装虚拟网络适配器,您必须在“控制台会话”下启动 VPN Client 管理器。\r\n\r\n目前,此计算机上已安装 %s,且用户已登入远程会话 (会话ID: %u) 而不是控制台进程。\r\n若要安装虚拟网络适配器,必须在“控制台会话”下启动 VPN Client 管理器。\r\n(目前用户并未登入到控制台会话 (会话ID: 0)。) \r\n\r\n首先使用切换用户功能从本地登入到计算机,或在远程桌面使用 “/console” 论据功能,或切换计算机的本地控制台设备,之后启动 VPN Client 管理器,并安装虚拟网络适配器。 +CM_SHORTCUT_DESKTOP_MSG 若要使用 VPN 连接设置快捷方式启动连接,您必须在“控制台会话”下运行快捷方式文件。\r\n\r\n目前用户作为远程会话 (会话ID: %u) 登入而不是控制台会话。 +CM_HTTP_PROXY_WARNING 已选择“通过 HTTP 代理服务器连接”。\r\n\r\n一般情况下,HTTP 服务器只允许两种 TCP 端口作为连接到目标服务器的端口号: HTTP 协议 (TCP 端口号 80) 和 HTTPS 协议 (TCP 端口号 443)。\r\n(同样,也有的代理服务器提供更宽泛的 TCP 端口供连接使用。) \r\n\r\n当通过一台禁用除 HTTP 端口或 HTTPS 端口的 HTTP 代理服务器建立 VPN 连接时,您必须指定 443 (HTTPS 协议) 作为目标 VPN Server 的端口号。\r\n\r\n要检查您当前使用的 HTTP 代理服务器是否允许 80 或 443 意外的端口,请与 HTTP 代理服务器的管理员联系。\r\n\r\n目前 %d 指定为目标 VPN Server 的端口号。您是否要更改端口号为 443 (HTTPS 协议) ?\r\n(您所连接的 VPN Server 的 443 端口必须被设为监听状态并且空闲。) \r\n如果您无法确定,请与系统管理员或网络管理员联系。 +CM_HTTP_HEADER_COLUMN_0 Name +CM_HTTP_HEADER_COLUMN_1 Value +CM_PASSWORD_CHANGED 密码已更改。 +CM_ACCOUNT_SETTING_FILE VPN 连接设置文件 (*.VPN)|*.vpn|所有文件 (*.*)|*.* +CM_ACCOUNT_SAVE_TITLE 输入要导出的 VPN 连接设置文件的文件名 +CM_ACCOUNT_OPEN_TITLE 选择要导入的 VPN 连接设置文件 +CM_ACCOUNT_FILE_BANNER # VPN Client 连接设置文件\r\n# \r\n# 此文件是使用 VPN Client 管理器导出的。\r\n# 此文件内容可使用文本编辑器进行编辑。\r\n# 当此文件通过使用客户端连接管理器导入后可以立即被使用。\r\n\r\n +CM_FAILED_TO_OPEN_FILE 无法打开文件。 +CM_FAILED_TO_SAVE_FILE 无法保存文件。 +CM_ACCOUNT_PARSE_FAILED 无法从指定文件装载 VPN 连接设置。\r\n请检查文件内容。 +CM_ACCOUNT_MSG_SENSITIVE 此 VPN 连接设置有用户名和密码。\r\n您想从导出的设置文件中删除这些敏感信息吗?\r\n\r\n单击“是”以删除敏感信息。\r\n在这种情况下,当他正试图连接到 VPN Server 时,用户需要输入用户名和密码。\r\n\r\n单击“否”将敏感信息留在文件内。 +CM_SHORTCUT_FILE 快捷方式文件|*.lnk +CM_SHORTCUT_SAVE_TITLE 输入快捷方式文件名。 +CM_SHORTCUT_UNSUPPORTED 该连接的快捷方式的功能不支持此 VPN Client 的版本。\r\n更新到新版本。 +CM_SHORTCUT_COMMENT 使用 VPN 连接设置“%s”以连接到 VPN Server。 +CM_SHORTCUT_ERROR 创建快捷方式失败。 +CM_VPN_FILE_CLICKED 你要导入的 VPN 连接文件? +CM_VPN_FILE_IMPORT_NG 无法导入 VPN 连接设置文件。由于 VPN Client 设置已被锁定。 +CM_VLAN_INSTALLING 请稍候... +CM_SECURE_MUST_LOCAL 因为目前您对远程计算机进行连接并管理 VPN Client,因此无法修改智能卡设置。 +CM_DETAIL_MODE_LINK_STR 使用级联,则“通过网桥,路由模式连接”始终启用。 +CM_TRAY_INITING VPN Client 管理器 (Developer Edition) +CM_TRAY_NOT_CONNECTED VPN Client 管理器 (Developer Edition)\r\n未连接 +CM_TRAY_CONNECTED_0 VPN Client 管理器 (Developer Edition)\r\n主动连接到%u个服务器,并尝试连接到 %u 个服务器 +CM_TRAY_CONNECTED_1 VPN Client 管理器 (Developer Edition)\r\n尝试连接到%u个服务器 +CM_TRAY_CONNECTED_2 VPN Client 管理器 (Developer Edition)\r\n的 %u 个服务器中的连接 +CM_TRAY_MENU_1_SHOW 显示 VPN Client 管理器(&S) +CM_TRAY_MENU_1_HIDE 关闭 VPN Client 管理器(&O) +CM_TRAY_MENU_2_QUIT 退出 VPN Client 管理器程序(&X) +CM_TRAY_MENU_CONNECT 启动 VPN 连接(&C) +CM_TRAY_MENU_DISCONNECT 断开 VPN 连接(&D) +CM_TRAY_MENU_STATUS 查看 VPN 连接状态(&I) +CM_TRAY_MENU_DISCONNECT_ALL 断开所有的 VPN 连接(&A) +CM_TRAY_MENU_NEW 创建一个新的连接设置(&N) +CM_TRAY_MENU_RECENT 近使用的 VPN Server(&Y) +CM_TRAY_MENU_TRAFFIC 网格和通信速度测试工具(&R) +CM_TRAY_MENU_NETIF 查看网络设备的状态(&D) +CM_TRAY_MENU_ABOUT 关于 VPN Client 管理器(&A) +CM_TRAY_MENU_SETTING 变更运行模式(&M) +CM_TRAY_MENU_CANCEL 关闭此菜单 +CM_EXIT_MESSAGE 是否退出 VPN Client 管理器程序? +CM_IMPORT_MESSAGE 从文件 "%S" 安装 VPN 连接设置 "%s"。 +CM_VLAN_CREATING 创建一个新的 Windows VPN 虚拟网络适配器。\r\n\r\n这个过程可能会花费几秒或超过 1 分钟。 \r\n请稍候...\r\n\r\n(在虚拟网络适配器安装过程中,请不要执行其他操作。) +CM_SETTING_PASSWORD 该设置已被锁定。要取消这些锁定设置,您必须输入密码。 +CM_EASY_MODE_NOT_ON_REMOTE 无法连接,因为远程计算机上的 VPN Client 在简易模式下运行。 +CM_EASY_CONNECT_BUTTON_1 启动 VPN 连接 +CM_EASY_CONNECT_BUTTON_2 断开(&D) +CM_EASY_ACCOUNT_WARNING 因为设置已锁定,您只能更改“代理服务器设定”,“用户验证”和“已使用的虚拟网络适配器”。 +CM_EASY_INFO_1 选择一个 VPN 连接。 +CM_EASY_INFO_2 单击“开始 VPN 连接”启动一个 VPN 连接。 +CM_EASY_INFO_3 VPN 连接是活跃的。您可以通过点击“断开”终止连接。 +CM_EXT_VOICE_MSG 扩展语音向导的部分内容运行不正常。\r\n扩展语音向导是否打开? +CM_EASY_TITLE VPN Client 简易连接管理器 +CM_EASY_CONNECTED VPN 连接完成。 +CM_EASY_CONNECTING 建立 VPN 连接中... +CM_PROXY_FROM_IE 当前 Internet Explorer 代理设置已加载。 +CM_TRAY_ICON_RESTORE 托盘图标已被清除。\r\n\r\n要恢复该图标,请启动 VPN Client 管理器并在查看菜单点击“显示托盘图标”。 +CM_WOULDYOULOAD_IE_PROXY 目前,这台计算机的 Internet Explorer 配置使用代理服务器"%S"。\r\n您想在新的 VPN 连接设置中应用当前代理设置吗?\r\n\r\n点击“是”使用Internet Explorer 的代理设置。\r\n点击“否”使用直接连接至 VPN Server(不是代理服务器)。\r\n此设置可以在连接设置的属性窗口、在今后的任何时间进行修改。 +CM_MSG_TITLE VPN Server "%S" (虚拟 HUB: "%S") +CM_JUMPLIST_RCCONNECT 最近使用的连接设置 +CM_VPNGATE_MESSAGE 在 VPN Gate 学术项目网站上有一个公共 VPN 中继服务器列表。\r\n互联网上的任何人都可以建立 VPN 连接至任一列表上的 VPN 服务器。无需用户注册。\r\n\r\nVPN Gate 不是 SoftEther VPN 的一部分。\r\n此图标只提供了一个超链接到 http://www.vpngate.net/。\r\n\r\n安装带有 SoftEther VPN Client 的 VPN Gate Client 插件。它可用简单的配置连接到 VPN Gate 的一个公共 VPN 中继服务器。\r\n\r\n你想访问 http://www.vpngate.net/ (设在日本筑波大学) ? +CM_VLAN_REINSTALL_MSG After reinstalling the Virtual Network Adapter driver, the current Virtual Network Adapter's MAC address will change. Also, all TCP/IP settings within the Virtual Network Adapter will reset.\r\n\r\nIn case the reinstalled Virtual Network Adapter fails to work, delete it and create a new one. If it still doesn't work properly, please create a new Virtual Network Adapter with a different name. + + +# VPN Gate Service +VGC_COLUMN_0 DDNS 唯一主机名 +VGC_COLUMN_1 IP 地址 (主机名) +VGC_COLUMN_2 国家/地区 +VGC_COLUMN_3 运行时间 +VGC_COLUMN_4 VPN 会话 +VGC_COLUMN_5 线路速度 +VGC_COLUMN_6 Ping (Google, SE) +VGC_COLUMN_7 SSL-VPN (TCP) +VGC_COLUMN_8 UDP 支持 +VGC_COLUMN_9 日志策略 +VGC_COLUMN_10 累积转移 +VGC_COLUMN_11 累计用户 +VGC_COLUMN_12 操作员的名字 +VGC_COLUMN_13 操作员的消息 +VGC_COLUMN_14 总分 + +VGC_LOG_PERMANENT 永久的 +VGC_LOG_2WEEKS 两周 +VGC_LOG_NONE 无日志 + +VGC_UPTIME_MIN %u 分钟 +VGC_UPTIME_HOUR %u 小时 +VGC_UPTIME_DAY %u 天 +VGC_NUM_VPN %u 会话 +VGC_NUM_LOGIN %S 登录次数 + +VGC_UDP_AVAILABLE UDP OK + +VGC_LIST_STR_OK 在这个地球上的 %S 公共 VPN 中继服务器 ! (更新于 %S) +VGC_LIST_STR_OK_2 %S 服务器 (更新于 %S) - 服务器列表更新失败。如果再次失败,请下载最新的 VPN Gate Client。 +VGC_LIST_STR_NG 服务器列表更新失败。如果再次失败,请下载最新的 VPN Gate Client。 +VGC_PROXY_MSG 如果您使用的是代理服务器,您可能无法使用不支持 TCP 443 端口、从这样的代理委托网络、作为 "SSL-VPN 连接" 的 VPN 中继服务器。 +VGC_PROXY_TITLE 代理服务器用户的注意事项 + +VGS_NO_HUB_YET 为了设置消息,首先你得提交启用 VPN Gate 服务。在启用该服务后,重新打开此窗口,并设置消息。 + +VGC_TITLE VPN Gate 插件消息 + +VGC_VER_DIFF VPN Gate 客户端插件的版本与 SoftEther VPN 客户端相异。\r\n\r\n- 当前的 VPN Gate 插件: Build %u\r\n- 当前的 SoftEther VPN 客户端: Build %u\r\n\r\n推荐下载并安装 VPN Gate 插件 Build %u,否则可能出现通信错误或列表更新出错。VPN 服务器列表更新失败多次,请更新 VPN Gate 插件版本。\r\n\r\n最新的 VPN Gate 插件可用于 http://www.vpngate.net/。\r\n(如果您无法直接访问上述网站,请使用镜像站点。)\r\n\r\n)\r\n\r\n + +VGS_STOP VPN Gate 服务将在您点击 确定 按钮后停止。\r\n\r\n在 VPN Gate 服务被停止后,这台计算机将不会接受新的 VPN 连接请求,但是,仍然活跃的 VPN 会话可能会残留。\r\n (这类 VPN 会话有时在枚举中不可见。) \r\n\r\n要想彻底终止所有仍然活跃的 VPN 会话,重启 SoftEther VPN Server 或者 SoftEther VPN Client 服务,或者重新启动这台计算机。 + +VGS_START This will activate the VPN Gate Relay Service function.\r\n\r\nVPN Gate Relay Service function must be activated by your own risk.\r\nSome countries prohibit using of encrypted VPN by laws.\r\nFor more details about VPN Gate Relay Service please visit http://www.vpngate.net/en/join.aspx.\r\n\r\nThe VPN Gate Academic Experiment Service is operated as a research project at the graduate school on University of Tsukuba, Japan. The service is governed under the Japanese laws. Other countries' laws are none of our concerns nor responsibilities.\r\n\r\nBy nature, there are almost 200 countries in the World, with different laws. It is impossible to verify every countries' laws and regulations and make the software comply with all countries' laws in advance to release the software. If a user uses VPN Gate service in a specific country, and damaged by public servants of the authority, the developer of either the service or software will never be liable to recover or compensate such damages or criminal responsibilities.\r\nBy using this software and service, the user must observe all concerned laws and rules with user's own responsibility. The user will be completely liable to any damages and responsibilities which are results of using this software and service, regardless of either inside or outside of Japan's territory.\r\nIf you don't agree nor understand the above warnings, do not use any of VPN Gate Academic Experiment Service functions. + + + +#关于服务 (Win32) +SVC_HELP “%s (%S) 的命令行参数”\r\n\r\n此程序 (%s) 是一个后台任务运行进程。通过指定以下命令行参数启动程序。\r\n\r\n\r\n/install …… 在 Windows 安装 %s 服务 (服务名: %S)。之后服务自动启动。\r\n\r\n/uninstall …… 从 Windows 卸载 %s 服务 (服务名: %S)。\r\n\r\n/start …… 启动 %s 服务 (服务名: %S)。\r\n\r\n/stop …… 停止 %s 服务 (服务名: %S)。\r\n\r\n/test …… 启动 %s 程序的测试模式。(调试用) \r\n\r\n/usermode … 启动 %s 程序的用户模式。(如果可用)\r\n\r\n/usermode_showtray …… 用户模式下启动时,显示任务栏图标。(若之前设为隐藏)\r\n\r\n/usermode_hidetray …… 用户模式下启动时,隐藏任务栏图标。\r\n\r\n\r\n注意: 除 /test 和 /usermode 之外的命令仅在 Windows NT / 2000 / XP / Server 2003 / Vista / Server 2008 / 7 / Server 2008 R2 下有效。 +SVC_NT_ONLY 命令相关的服务仅在 Windows NT / 2000 / XP / Server 2003 / Vista / Server 2008 / 7 / Server 2008 R2 下有效。\r\nWindows 98 / Me下无效。 +SVC_ALREADY_INSTALLED "%s" 服务 (服务名: %S) 已经安装在这台计算机上。你想卸载并重新安装吗? +SVC_INSTALL_OK "%s" 服务 (服务名: %S) 已成功安装完毕。\r\n\r\n(执行路径: %s)\r\n\r\n服务启动完成。 +SVC_INSTALL_FAILED "%s" 服务 (服务名: %S) 安装失败 +SVC_INSTALL_FAILED_2 "%s" 服务 (服务名: %S) 已成功安装完毕。\r\n\r\n(执行路径: %s)\r\n\r\n尝试启动失败。 +SVC_NOT_INSTALLED "%s" 服务 (服务名: %S) 没有安装在此计算机上。请使用命令行参数 /install 进行安装。 +SVC_START_OK "%s" 服务 (服务名: %S) 成功启动。 +SVC_START_FAILED "%s" 服务 (服务名: %S) 无法启动。 +SVR_ALREADY_START "%s" 服务 (服务名: %S) 已启动。 +SVC_STOP_OK "%s" 服务 (服务名: %S) 被停止。 +SVC_STOP_FAILED 停止 "%s" 服务 (服务名: %S) 失败。 +SVC_ALREADY_STOP "%s" 服务 (服务名: %S) 已被停止。 +SVC_UNINSTALL_OK "%s" 服务 (服务名: %S) 已卸载。 +SVC_UNINSTALL_FAILED "%s" 服务 (服务名: %S) 无法卸载。 +SVC_NOT_FOUND 字符串表中找不到服务 %S 的信息。 +SVC_NOT_ADMIN 要安装 / 卸载 / 启动 / 停止服务,您必须在此计算机上有管理员权限。\r\n\r\n如果您在此计算机上有管理员账户,请登出后作为管理员再登入。\r\n如果您不了解管理员账户,请与系统管理员联系。 +SVC_TEST_MSG 服务 "%s" 在测试模式下启动。\r\n\r\n单击“确定”退出服务。 +SVC_TRAY_TOOLTIP %S (用户模式) +SVC_TEST_MUTEX 可执行文件 %s 已经运行。 +SVC_USERMODE_MUTEX %s 的另一个进程已经运行。 +SVC_SERVICE_MUTEX 由于服务 %S 有已启动的进程 %s,因此服务无法启动 +SVC_USERMODE_MENU_1 隐藏任务栏图标(&H) +SVC_USERMODE_MENU_2 退出 %s (&X) +SVC_HIDE_TRAY_MSG 启动 %S 用户模式时将隐藏任务栏图标。\r\n从下次 %S 启动开始,图标将不会在任务栏显示。\r\n退出进程的菜单也将被隐藏。\r\n\r\n如果要在 Windows98 / Me 下退出进程,使用 Ctrl + Alt + Del 组合键然后选择结束进程。\r\n当使用其他操作系统,请使用任务管理器。\r\n\r\n要再次显示任务栏图标,在用户模式下次启动时,使用 /usermode_showtray 选项。 + + +#关于服务 (UNIX) +UNIX_SVC_HELP %S service program\nCopyright (c) all contributors on SoftEther VPN project in GitHub.\nCopyright (c) Daiyuu Nobori, SoftEther Project at University of Tsukuba, and SoftEther Corporation.\nAll Rights Reserved.\n\n%S command usage:\n %S start - Start the %S service.\n %S stop - Stop the %S service if the service has been already started.\n\n +UNIX_SVC_STARTED The %S service has been started.\n +UNIX_SVC_STOPPING Stopping the %S service ...\n +UNIX_SVC_STOPPED %S service has been stopped.\n +UNIX_SVC_STOP_FAILED Stopping %S service was failed.\n +UNIX_SVC_ALREADY_START %S service has been already started.\nRun the "%S stop" command to stop this service.\n +UNIX_SVC_NOT_STARTED %S service has not yet been started.\nRun the "%S start" to start this service.\n +UNIX_SVC_ERROR_FORK Failed to create child process for the %S service.\n +UNIX_SVC_NONROOT \nWarning: The current user context is non-root. It is recommended to run the VPN service by the root user. Although the VPN service may run under non-root users, some privilege-required functions (e.g. the local bridge function) need the root privilege.\n + + +# 服务定义 (SoftEther VPN Client) +SVC_VPNCLIENT_NAME vpnclient +SVC_VPNCLIENT_TITLE SoftEther VPN Client +SVC_VPNCLIENT_DESCRIPT 它为 SoftEther VPN Client 管理虚拟网络适配器设备驱动和连接服务。当服务停止时,此计算机将无法使用 SoftEther VPN Client 连接到 SoftEther VPN Server。 + + +# 服务定义 (SoftEther VPN Server) +SVC_VPNSERVER_NAME vpnserver +SVC_VPNSERVER_TITLE SoftEther VPN Server +SVC_VPNSERVER_DESCRIPT 它管理 SoftEther VPN Server 服务进程。SoftEther VPN Server 通过 TCP/IP 协议提供高性能 SoftEther VPN Server 功能。当此服务被停止时,此计算机上的 SoftEther VPN Client 也将停止,且 SoftEther VPN Client 将无法与此计算机建立 VPN 连接。 + + +# 服务定义 (SoftEther VPN Bridge) +SVC_VPNBRIDGE_NAME vpnbridge +SVC_VPNBRIDGE_TITLE SoftEther VPN Bridge +SVC_VPNBRIDGE_DESCRIPT 它管理 SoftEther VPN Bridge 服务进程。SoftEther VPN Bridge 提供此计算机连接的网络与远程 SoftEther VPN Server 之间的连接。当此服务被停止时,此计算机上的 SoftEther VPN Bridge 也将停止,且无法再通过网桥连接进行通信。 + + +# 服务定义 (SoftEther VPN Client) +SVC_SEVPNCLIENTDEV_NAME sevpnclientdev +SVC_SEVPNCLIENTDEV_TITLE SoftEther VPN Client Developer Edition +SVC_SEVPNCLIENTDEV_DESCRIPT 它为 SoftEther VPN Client 管理虚拟网络适配器设备驱动和连接服务。当服务停止时,此计算机将无法使用 SoftEther VPN Client 连接到 SoftEther VPN Server。 + + +# 服务定义 (SoftEther VPN Server) +SVC_SEVPNSERVERDEV_NAME sevpnserverdev +SVC_SEVPNSERVERDEV_TITLE SoftEther VPN Server Developer Edition +SVC_SEVPNSERVERDEV_DESCRIPT 它管理 SoftEther VPN Server 服务进程。SoftEther VPN Server 通过 TCP/IP 协议提供高性能 SoftEther VPN Server 功能。当此服务被停止时,此计算机上的 SoftEther VPN Client 也将停止,且 SoftEther VPN Client 将无法与此计算机建立 VPN 连接。 + + +# 服务定义 (SoftEther VPN Bridge) +SVC_SEVPNBRIDGEDEV_NAME sevpnbridgedev +SVC_SEVPNBRIDGEDEV_TITLE SoftEther VPN Bridge Developer Edition +SVC_SEVPNBRIDGEDEV_DESCRIPT 它管理 SoftEther VPN Bridge 服务进程。SoftEther VPN Bridge 提供此计算机连接的网络与远程 SoftEther VPN Server 之间的连接。当此服务被停止时,此计算机上的 SoftEther VPN Bridge 也将停止,且无法再通过网桥连接进行通信。 + + +# 服务定义 (SoftEther VPN User-mode Router) +SVC_VPNROUTER_NAME vpnrouter +SVC_VPNROUTER_TITLE SoftEther VPN Router Developer Edition +SVC_VPNROUTER_DESCRIPT 这是用来管理 SoftEther VPN 路由器(服务模式)的服务器进程。 SoftEther VPN 的路由器是一个程序,它提供了一个虚拟 NAT 和 DHCP 服务器,在用户模式下运行,通过使用简单的操作,它可以建立一个在虚拟 IP 网络和一个物理 IP 网络之间的安全连接。如果此服务被停止,在这台电脑上的 SoftEther VPN 路由器将停止, SoftEther VPN Client 将无法在这台电脑上使用路由服务。 + + +# サービス定義 (EtherLogger) +SVC_ELOGSVC_NAME elogsvc +SVC_ELOGSVC_TITLE SoftEther EtherLogger Developer Edition +SVC_ELOGSVC_DESCRIPT SoftEther EtherLogger 是一个捕捉从局域网卡连接到电脑上数据流的服务,保存由管理员指定类型的数据包的包头日志,所有数据以文本文件格式。 + + +#关于 SoftEther VPN Server 管理器 +SM_TITLE SoftEther VPN Server 管理器 Developer Edition +SM_LOCALHOST 本地主机 (此服务器) +SM_SERVER_BRIDGE_TITLE 管理 VPN Bridge "%S" +SM_S_VHUB_BRIDGE 当使用 VPN Bridge 时,管理虚拟 HUB“BRIDGE”运行 VPN Bridge 的管理。 +SM_DISCONNECTED 管理连接已断开。 +SM_MIKAN 未完成。 +SM_MAIN_COLUMN_1 设置名称 +SM_MAIN_COLUMN_2 VPN Server 主机名(地址) +SM_MAIN_COLUMN_3 操作模式 +SM_MODE_SERVER 整个 VPN Server +SM_MODE_HUB %S +SM_EDIT_CAPTION_1 新的连接设置 +SM_EDIT_CAPTION_2 %s 的编辑 +SM_SETTING_EXISTS 与连接设置 "%s" 同名的连接设置已经注册。请指定一个不同的名称。 +SM_SETTING_DELETE_MSG 是否确定删除连接设置 "%s"? +SM_PASSWORD_TYPE_STR 管理连接用密码 +SM_HUB_COLUMN_1 虚拟 HUB 名 +SM_HUB_COLUMN_2 状态 +SM_HUB_COLUMN_3 类型 +SM_HUB_COLUMN_4 用户 +SM_HUB_COLUMN_5 组 +SM_HUB_COLUMN_6 会话 +SM_HUB_COLUMN_7 MAC 表 +SM_HUB_COLUMN_8 IP 表 +SM_HUB_COLUMN_9 登录次数 +SM_HUB_COLUMN_10 最后登录时间 +SM_HUB_COLUMN_11 最后通信时间 +SM_HUB_ONLINE 在线 +SM_HUB_OFFLINE 离线 +SM_HUB_STANDALONE 独立 +SM_HUB_STATIC 静态虚拟 HUB +SM_HUB_DYNAMIC 动态虚拟 HUB +SM_SERVER_STANDALONE 独立服务器 +SM_FARM_CONTROLLER 群集控制器 +SM_FARM_MEMBER 群集成员服务器 +SM_INFORMATION 最新信息 +SM_HUB_STATUS_CAPTION 虚拟 HUB "%s" 状态 +SM_HUB_STATUS_HUBNAME 虚拟 HUB 名称 +SM_HUB_STATUS_ONLINE 状态 +SM_HUB_TYPE 类型 +SM_HUB_NUM_SESSIONS 会话数 +SM_HUB_NUM_SESSIONS_CLIENT 会话数 (客户端) +SM_HUB_NUM_SESSIONS_BRIDGE 会话数 (网桥) +SM_HUB_NUM_ACCESSES 访问列表 +SM_HUB_NUM_USERS 用户数 +SM_HUB_NUM_GROUPS 组数 +SM_HUB_NUM_MAC_TABLES MAC 表数 +SM_HUB_NUM_IP_TABLES IP 表数 +SM_HUB_SECURE_NAT SecureNAT 机能 +SM_HUB_SECURE_NAT_YES 有效 +SM_HUB_SECURE_NAT_NO 无效 +SM_HUB_NUM_LOGIN 登录次数 +SM_HUB_LAST_LOGIN_TIME 最后登录时间 +SM_HUB_LAST_COMM_TIME 最后通信时间 +SM_HUB_CREATED_TIME 创建日期 +SM_STATUS_COLUMN_1 项目 +SM_STATUS_COLUMN_2 值 + +SM_ST_SEND_UCAST_NUM 发送单播数据包 +SM_ST_SEND_UCAST_SIZE 发送单播总量 +SM_ST_SEND_BCAST_NUM 发送广播数据包 +SM_ST_SEND_BCAST_SIZE 发送广播总量 + +SM_ST_RECV_UCAST_NUM 接收单播数据包 +SM_ST_RECV_UCAST_SIZE 接收单播总量 +SM_ST_RECV_BCAST_NUM 接收广播数据包 +SM_ST_RECV_BCAST_SIZE 接收广播总量 + +SM_ST_NUM_PACKET_STR %S 数据包 +SM_ST_SIZE_BYTE_STR %S 字节 + +CM_EDIT_HUB_1 新的虚拟 HUB +CM_EDIT_HUB_2 %S 的属性 + +CM_EDIT_HUB_STANDALONE 当前,服务器正以独立模式运行。而该虚拟 HUB 作为一个独立的 HUB 运行。 +CM_EDIT_HUB_TYPE_FIXED 当前,服务器正以群集模式运行。如果虚拟 HUB 处于这种模式,动态变化将无法进行。 +CM_EDIT_HUB_CREATED 一个新的虚拟 HUB "%S" 已经建立 +CM_OFFLINE_MSG 你想切换 "%s" 到离线状态?\r\n\r\n如果您切换虚拟 HUB 至离线状态,当前连接到虚拟 HUB 上的所有会话将无法连接。 +CM_DELETE_HUB_MSG 你想删除"%S"吗?\r\n\r\n如果你删除虚拟 HUB,当前连接到虚拟 HUB 的所有会话将被断开,新的会话将无法连接。\r\n这还将删除所有 HUB 设置,用户对象,组对象,证书和级联连接。\r\n\r\n一旦你将虚拟 HUB 删除,将无法恢复。\r\n你确定要删除吗? +CM_HUB_DELETED_MSG 虚拟 HUB "%S" 被删除。 +CM_LISTENER_COLUMN_1 端口号 +CM_LISTENER_COLUMN_2 状态 +CM_LISTENER_TCP_PORT TCP %u +CM_LISTENER_ONLINE 监听中 +CM_LISTENER_OFFLINE 停止中 +CM_LISTENER_ERROR 错误 +CM_DELETE_LISTENER_MSG 监听器 (TCP 端口 %u) 将删除。从现在起,将无法连接到该端口。\r\n你确定要这样做吗? +CM_STOP_LISTENER_MSG 监听器 (TCP 端口 %u) 将停止。监听器将无法连接到该端口直到重新启动静听器。\r\n\r\n你确定吗? +CM_CLOSE_BUTTON 关闭 +CM_CERT_SET_MSG 设置了新的服务器证书。\r\n\r\nIf you are using OpenVPN protocols, please mind that you may have to update the inline certificate data in the OpenVPN configuration file. +CM_SHORTCUT_DISCONNECT 已经连接到指定的目标。 \r\n\r\n你想断开吗? + + + +SM_SERVER_STATUS 服务器状态 +SM_ST_SERVER_TYPE 服务器类型 +SM_ST_NUM_TCP 活跃 TCP 插口数 +SM_ST_NUM_TCP_LOCAL 活跃 TCP 插口数 (此服务器) +SM_ST_NUM_TCP_REMOTE 活跃 TCP 插口数 (其他成员服务器) +SM_ST_NUM_HUB_TOTAL 虚拟 HUB 数 +SM_ST_NUM_HUB_STATIC 静态虚拟 HUB 数 +SM_ST_NUM_HUB_DYNAMIC 动态虚拟 HUB 数 +SM_ST_NUM_SESSION_TOTAL 会话数 +SM_ST_NUM_SESSION_LOCAL 会话数 (此服务器) +SM_ST_NUM_SESSION_REMOTE 会话数 (其他成员服务器) +SM_ST_NUM_MAC_TABLE MAC 地址表数 +SM_ST_NUM_IP_TABLE IP 地址表数 +SM_ST_NUM_USERS 用户数 +SM_ST_NUM_GROUPS 组数 +SM_ST_CLIENT_LICENSE 使用客户端连接许可证数 (此服务器) +SM_ST_BRIDGE_LICENSE 使用网桥连接许可证数 (此服务器) +SM_ST_CLIENT_LICENSE_EX 使用客户端连接许可证数 (整个群) +SM_ST_BRIDGE_LICENSE_EX 使用网桥连接许可证数 (整个群) +SM_ST_START_TIME 服务器启动时间 +SM_ST_CURRENT_TIME 当前时间 +SM_ST_CURRENT_TICK 64 位高精度逻辑系统时钟 +SM_ST_TOTAL_MEMORY 总逻辑内存空间 +SM_ST_USED_MEMORY 已用逻辑内存空间 +SM_ST_FREE_MEMORY 可用逻辑内存空间 +SM_ST_TOTAL_PHYS 总物理内存空间 +SM_ST_USED_PHYS 已用的物理内存空间 +SM_ST_FREE_PHYS 可用物理内存空间 +SM_ST_RAM_SIZE_KB %S 字节 +SM_INFO_TITLE VPN Server 版本信息 +SM_INFO_PRODUCT_NAME 产品名称 +SM_INFO_VERSION 版本 +SM_INFO_BUILD 内部标号 +SM_INFO_HOSTNAME 主机名称 +SM_OS_SYSTEM_NAME 操作系统类型 +SM_OS_PRODUCT_NAME 操作系统产品名称 +SM_OS_SERVICE_PACK 服务包 +SM_OS_SP_TAG Service Pack %u +SM_OS_VENDER_NAME 操作系统制造商 +SM_OS_VERSION 操作系统版本 +SM_OS_KERNEL_NAME 操作系统内核分类 +SM_OS_KERNEL_VERSION 操作系统内核版本 +SM_CONNECTION_TYPE_0 客户端 +SM_CONNECTION_TYPE_1 初始化中 +SM_CONNECTION_TYPE_2 登录 +SM_CONNECTION_TYPE_3 追加连接 +SM_CONNECTION_TYPE_4 群集 RPC +SM_CONNECTION_TYPE_5 管理用 RPC +SM_CONNECTION_TYPE_6 HUB 枚举 RPC +SM_CONNECTION_TYPE_7 更改密码 +SM_CONNECTION_TYPE_8 MS-SSTP 连接 +SM_CONNECTION_TYPE_9 OpenVPN 连接 +SM_CONN_COLUMN_1 连接名称 +SM_CONN_COLUMN_2 连接源 +SM_CONN_COLUMN_3 连接开始 +SM_CONN_COLUMN_4 类型 +SM_HOSTNAME_AND_PORT %S:%u +SM_CONN_DISCONNECT_MSG 连接 %s 将断开。\r\n你确定要这么做吗? +SM_CONNINFO_CAPTION 连接 %s 的信息 +SM_CONNINFO_NAME 连接名称 +SM_CONNINFO_TYPE 连接类型 +SM_CONNINFO_HOSTNAME 客户端主机名称 +SM_CONNINFO_IP 客户端 IP 地址 +SM_CONNINFO_PORT 客户端口号 (TCP) +SM_CONNINFO_TIME 连接开始 +SM_CONNINFO_SERVER_STR 服务端产品名 +SM_CONNINFO_SERVER_VER 服务端版本 +SM_CONNINFO_SERVER_BUILD 服务端内部标号 +SM_CONNINFO_CLIENT_STR 客户端产品名 +SM_CONNINFO_CLIENT_VER 客户端版本 +SM_CONNINFO_CLIENT_BUILD 客户端内部标号 +SM_FARM_REBOOT_MSG 你将要更改群集配置。\r\n\r\n当你更改群集配置时,所有当前为管理而进行的会话和连接 (包括此管理连接) 将断开,服务端程序将重新启动。\r\n当服务端用户较多的时候,重新启动需要用一分钟的时间。\r\n\r\n单击“确定”自动断开与服务器的连接。要继续管理,你需要重新连接到服务器。 +SM_FM_COLUMN_1 类型 +SM_FM_COLUMN_2 连接开始时间 +SM_FM_COLUMN_3 主机名称 +SM_FM_COLUMN_4 点 +SM_FM_COLUMN_5 会话数 +SM_FM_COLUMN_6 TCP 连接数 +SM_FM_COLUMN_7 运行 HUB 数 +SM_FM_COLUMN_8 使用客户端连接许可证 +SM_FM_COLUMN_9 使用网桥连接许可证 +SM_FM_CONTROLLER 控制器 +SM_FM_MEMBER 成员 +SM_FMINFO_TYPE 服务器类型 +SM_FMINFO_CONNECT_TIME 连接建立时间 +SM_FMINFO_IP IP 地址 +SM_FMINFO_HOSTNAME 主机名称 +SM_FMINFO_POINT 点 +SM_FMINFO_WEIGHT 性能标准比 +SM_FMINFO_NUM_PORT 公共端口数 +SM_FMINFO_PORT %u 个公共端口 (TCP/IP) +SM_FMINFO_NUM_HUB 运行虚拟 HUB 数 +SM_FMINFO_HUB %u 个虚拟 HUB +SM_FMINFO_HUB_TAG_1 %S (动态) +SM_FMINFO_HUB_TAG_2 %S (静态) +SM_FMINFO_NUM_SESSION 会话数 +SM_FMINFO_NUN_CONNECTION TCP 连接数 +SM_FMINFO_CAPTION 群集成员服务器状态 +SM_FC_STATUS_CAPTION 群集控制器连接状态 +SM_FC_IP 控制器的 IP 地址 +SM_FC_PORT 控制器的 TCP/IP 端口 +SM_FC_STATUS 连接状态 +SM_FC_ONLINE 在线 +SM_FC_OFFLINE 离线 +SM_FC_LAST_ERROR 最后发生的错误 +SM_FC_ERROR_TAG %s (错误代码: %u) +SM_FC_START_TIME 连接开始时间 +SM_FC_FIRST_TIME 第一个连接建立时间 +SM_FC_CURRENT_TIME 当前连接建立时间 +SM_FC_NUM_TRY 尝试连接数 +SM_FC_NUM_CONNECTED 成功连接数 +SM_FC_NUM_FAILED 失败的连接数 +SM_FC_NOT_CONNECTED (未连接) +SM_CHANGE_PASSWORD_1 您输入的密码不匹配。请在“确认”栏输入与“密码”栏相同的密码。 +SM_CHANGE_PASSWORD_2 您输入了一个空密码。是否继续? +SM_CHANGE_PASSWORD_3 密码已更改。 +SM_USER_COLUMN_1 用户名 +SM_USER_COLUMN_2 全名 +SM_USER_COLUMN_3 所属组 +SM_USER_COLUMN_4 描述 +SM_USER_COLUMN_5 认证方法 +SM_USER_COLUMN_6 登录回数 +SM_USER_COLUMN_7 上次登录时间 +SM_AUTHTYPE_0 匿名身份验证 +SM_AUTHTYPE_1 密码验证 +SM_AUTHTYPE_2 特定证书认证 +SM_AUTHTYPE_3 签名证书认证 +SM_AUTHTYPE_4 RADIUS 身份验证 +SM_AUTHTYPE_5 NT 域认证 +SM_NO_GROUP - +SM_USER_DELETE_MSG 这将删除用户 "%s"。您是否确认要这样做? +SM_EDIT_USER_CAPTION_1 创建新用户 +SM_EDIT_USER_CAPTION_2 用户 %S 属性 +SM_EDIT_USER_CERT_INFO 用户使用“特定证书认证”将根据是否 SSL 客户端证书与用户事先设置的证书完整匹配而被允许或拒绝连接。 +SM_EDIT_USER_POL_DLG 用户 %S 的安全策略 +SM_POLICY_DEF_CAPTION 安全策略 +SM_LIMIT_STR 指定一个在 %u 与 %u 之间的整数。 +SM_POLICY_INIT_TITLE 从左边的列表中选择一个策略项目。 +SM_USER_CREATE_OK 用户 %S 已创建。 +SM_USERINFO_CAPTION 用户 "%S" 的信息 +SM_USERINFO_NAME 用户名 +SM_USERINFO_GROUP 组名 +SM_USERINFO_CREATE 创建日期 +SM_USERINFO_UPDATE 更新日期 +SM_USERINFO_EXPIRE 有效期限 +SM_USERINFO_NUMLOGIN 登录数 +SM_GROUPLIST_NAME 组名 +SM_GROUPLIST_REALNAME 全名 +SM_GROUPLIST_NOTE 描述 +SM_GROUPLIST_NUMUSERS 用户数 +SM_EDIT_GROUP_CAPTION_1 创建新组 +SM_EDIT_GROUP_CAPTION_2 组 %S 属性 +SM_GROUP_CREATED 组 %S 已创建。 +SM_GROUP_DELETE_MSG 您是否确定删除组 "%S" ? +SM_GROUP_POLICY_CAPTION 组 %S 的安全策略 +SM_GROUP_MEMBER_STR (仅显示属于组 %S 的用户) +SM_SELECT_GROUP 选择(&S) +SM_SELECT_NO_GROUP 无(&N) +SM_SELECT_ALT_GROUP 选择一个组(&G)... +SM_ACCESS_COLUMN_0 ID +SM_ACCESS_COLUMN_1 行为 +SM_ACCESS_COLUMN_2 状态 +SM_ACCESS_COLUMN_3 优先级 +SM_ACCESS_COLUMN_4 备注 +SM_ACCESS_COLUMN_5 目录 +SM_ACCESS_COLUMN_6 唯一 ID +SM_ACCESS_PASS 通过 +SM_ACCESS_DISCARD 舍弃 +SM_ACCESS_ENABLE 有效 +SM_ACCESS_DISABLE 无效 +SM_ACCESS_PROTO_1 所有 IPv4 / IPv6 协议 +SM_ACCESS_PROTO_2 6 (TCP/IP 协议) +SM_ACCESS_PROTO_3 17 (UDP/IP 协议) +SM_ACCESS_PROTO_4 1 (ICMPv4 协议) +SM_ACCESS_PROTO_5 58 (ICMPv6 协议) +SM_ACCESS_PROTO_6 指定 IP 协议号 +SM_SELECT_USER 选择(&S) +SM_SELECT_NO 不要选择(&N) +SM_PLEASE_SELECT 选择用户。 +SM_LINK_COLUMN_1 连接设置名 +SM_LINK_COLUMN_2 状态 +SM_LINK_COLUMN_3 建立时间 +SM_LINK_COLUMN_4 目标 VPN Server +SM_LINK_COLUMN_5 目标虚拟 HUB +SM_LINK_STATUS_OFFLINE 离线 (已停止) +SM_LINK_STATUS_ERROR 错误 %u:%s +SM_LINK_STATUS_ONLINE 在线 (已建立) +SM_LINK_POLICY_GROUP 级联连接设置 +SM_LINK_POLICY_CAPTION 安全策略设置适用于级联会话 +SM_LINK_CONNECTING 连接处理中 +SM_LINK_SAVE_ONLINE 级联连接设置 "%s" 被改变,但因为级联连接当前正在线,此设置在下次连接建立前不会生效。 +SM_LINK_DELETE_MSG 是否确定删除级联连接 "%s" ? +SM_LINK_OFFLINE_MSG 目前级联 "%s" 是活跃的。是否要断开连接? +SM_LINK_STATUS_CAPTION 级联连接 "%s" 的连接状态 +SM_LOG_SWITCH_0 无切换 +SM_LOG_SWITCH_1 每秒切换 +SM_LOG_SWITCH_2 每分钟切换 +SM_LOG_SWITCH_3 每小时切换 +SM_LOG_SWITCH_4 每天切换 +SM_LOG_SWITCH_5 每月切换 +SM_SESS_DISCONNECT_MSG 是否确定断开会话 "%S" ? +SM_SESS_COLUMN_1 会话名 +SM_SESS_COLUMN_2 位置 +SM_SESS_COLUMN_3 用户名 +SM_SESS_COLUMN_4 源主机名称 +SM_SESS_COLUMN_5 TCP 连接 +SM_SESS_COLUMN_6 传输字节 +SM_SESS_COLUMN_7 传输数据包 +SM_SESS_COLUMN_8 VLAN ID +SM_SESS_NORMAL 本地会话 +SM_SESS_LOCAL 本地会话 +SM_SESS_LOCAL_2 %S 上 +SM_SESS_REMOTE %S 上 +SM_SESS_LINK 级联连接 +SM_SESS_LINK_HOSTNAME 虚拟主机 +SM_SESS_LINK_TCP 无 +SM_SESS_SNAT SecureNAT 会话 +SM_SESS_SNAT_HOSTNAME 虚拟主机 +SM_SESS_SNAT_TCP 无 +SM_SESS_BRIDGE 本地网桥会话 +SM_SESS_BRIDGE_HOSTNAME 以太网桥 +SM_SESS_LAYER3_HOSTNAME 虚拟 3 层交换机 +SM_SESS_BRIDGE_TCP 无 +SM_SESS_STATUS_CAPTION "%S" VPN 会话的状态 +SM_SESS_STATUS_USERNAME 用户名 (认证) +SM_SESS_STATUS_REALUSER 用户名 (数据库) +SM_SESS_STATUS_GROUPNAME 用户組名 +SM_CLIENT_IP 客户端 IP 地址 +SM_CLIENT_HOSTNAME 客户端名称 +SM_NODE_CLIENT_NAME 客户端产品名称 (报告的) +SM_NODE_CLIENT_VER 客户端版本 (报告的) +SM_NODE_CLIENT_BUILD 客户端内部标号 (报告的) +SM_NODE_SERVER_NAME 服务端产品名 (报告的) +SM_NODE_SERVER_VER 服务端版本 (报告的) +SM_NODE_SERVER_BUILD 服务端内部标号 (报告的) +SM_NODE_CLIENT_OS_NAME 客户端操作系统名称 (报告的) +SM_NODE_CLIENT_OS_VER 客户端操作系统版本 (报告的) +SM_NODE_CLIENT_OS_PID 客户端操作系统产品编号 (报告的) +SM_NODE_CLIENT_HOST 客户端主机名 (报告的) +SM_NODE_CLIENT_IP 客户端 IP 地址 (报告的) +SM_NODE_CLIENT_PORT 客户端端口 (报告的) +SM_NODE_SERVER_HOST 服务器主机名称 (报告的) +SM_NODE_SERVER_IP 服务器 IP 地址 (报告的) +SM_NODE_SERVER_PORT 服务器端口 (报告的) +SM_NODE_PROXY_HOSTNAME 代理主机名称 (报告的) +SM_NODE_PROXY_IP 代理 IP 地址 (报告的) +SM_NODE_PROXY_PORT 代理端口 (报告的) +SM_MAC_COLUMN_1 会话名 +SM_MAC_COLUMN_2 MAC 地址 +SM_MAC_COLUMN_3 创建时间 +SM_MAC_COLUMN_4 更新时间 +SM_MAC_COLUMN_5 位置 +SM_MAC_COLUMN_1A VLAN ID +SM_SESSION_FILTER \ (仅显示属于会话 %S 的项) +SM_IP_COLUMN_1 会话名 +SM_IP_COLUMN_2 IP 地址 +SM_IP_COLUMN_3 创建时间 +SM_IP_COLUMN_4 更新时间 +SM_IP_COLUMN_5 位置 +SM_MAC_IP_DHCP %S (DHCP) +SM_MACIP_LOCAL 在此服务器上 +SM_MACIP_SERVER %S 上 +SM_SNAT_STATUS SecureNAT 运行状态 +SM_SNAT_NUM_SESSION %u 个会话 +SM_SNAT_NUM_CLIENT %u 个客户端 +SM_SNAT_IS_KERNEL 内核模式 NAT 功能是活跃的 +SM_SNAT_IS_RAW Raw IP mode NAT 功能是活跃的 +SM_BRIDGE_TOO_OLD_VER 当前连接的 VPN Server 版本不支持本地网桥功能。\r\n请更新到最新版本。 +SM_BRIDGE_UNSUPPORTED 当前连接的 VPN Server 运行的操作系统无法使用本地网桥功能。请参阅 VPN Server 在线文档以获得支持本地网桥功能的操作系统列表。 +SM_BRIDGE_WPCAP_REMOTE 为在此 VPN Server 上使用本地网桥功能,您必须安装 WinPcap 软件。WinPcap 软件当前没有在服务器上安装。\r\n\r\n要进行 WinPcap 软件的安装,您必须在运行 VPN Server 的服务器上启动 SoftEther VPN Server 管理器,然后连接到本机 (您自己计算机的位置),打开本地网桥功能设置窗口。\r\n首先退出此管理会话,然后在此服务器上启动 SoftEther VPN Server 管理器之后,连接到本机并继续设置进程。 +SM_BRIDGE_WPCAP_ROOT 为在此 VPN Server 上使用本地网桥功能,您必须安装 WinPcap 软件。\r\n\r\n若要继续安装,您必须以管理员身份登录到此计算机上。\r\n以管理员身份登陆,然后再次启动 SoftEther VPN Server 管理器。 +SM_BRIDGE_WPCAP_INSTALL 为在此 VPN Server 上使用本地网桥功能,您必须安装 WinPcap 软件。WinPcap 软件当前没有在服务器上安装。\r\n\r\nWinPcap 是一个与 VPN Server 捆绑在一起的免费软件。\r\n\r\n请问您是否开始安装 WinPcap ? +SM_BRIDGE_WPCAP_REBOOT1 WinPcap 安装完成后,您在使用本地网桥功能之前必须重新启动计算机。\r\n\r\n在您手动重启计算机并启动 VPN Server 后,配置本地网桥功能的设置。 +SM_BRIDGE_WPCAP_REBOOT2 WinPcap 安装完成后,您在使用本地网桥功能之前必须重新启动计算机。\r\n\r\n重新启动 SoftEther VPN Server 会花费一点时间,但所有当前正连接到 VPN Server 的会话将被切断\r\n此管理会话也将被切断,所以您将需要重新连接。\r\n\r\n您是否要重启 SoftEther VPN Server 服务? +SM_BRIDGE_RESOURCE 无法加载 WinPcap 的驱动程序。 +SM_BRIDGE_COLUMN_1 编号 +SM_BRIDGE_COLUMN_2 虚拟 HUB 名称 +SM_BRIDGE_COLUMN_3 网络适配器或 tap 设备名称 +SM_BRIDGE_COLUMN_4 状态 +SM_BRIDGE_OFFLINE 离线 +SM_BRIDGE_ONLINE 运行中 +SM_BRIDGE_ERROR 错误 +SM_BRIDGE_OK 已添加本地网桥连接定义。 +SM_BRIDGE_DELETE 您确定要从虚拟 HUB "%s" 到设备 "%s" 中删除本地网桥吗? +SM_BRIDGE_DELETE_OK 本地桥被删除。 +SM_BRIDGE_INTEL 当一个网桥到物理网络适配器的新的网桥连接建立时,在某些情况下 (取决于网络适配器类型),可能无法在虚拟网络上通过网络适配器的网桥连接进行 TCP/IP 通信。\r\n(这种现象被确认发生在 Intel 和 Broadcom 网络适配器上。)\r\n\r\n\r\n如果遇到这个问题,可以通过重启 VPN Server / Bridge 运行的计算机来补救。通常情况下通信在计算机重启后可以正常进行。\r\n\r\n\r\n此外,很多无线网络适配器在混杂模式下不会响应范松数据包请求,而导致无法使用本地网桥。如果发生这种情况,请尝试使用常规有线网络适配器来代替无线网络适配器。 +SM_BRIDGE_VPN 你要连接到本地网桥 "%S"。\r\n\r\n通常情况下,网桥被建立在虚拟 HUB 与特理网卡之间。建立一个到虚拟网络适配器的本地桥是不常见的。\r\n请确保这是你的意图。\r\n\r\n你真的要继续吗? +SM_BRIDGE_INFO_1 为网桥目标选择以太网设备 (网络适配器) +SM_BRIDGE_INFO_2 输入新创建的 tap 设备的名称 +SM_CONFIG_SAVED 配置文件被保存。 +SM_CONFIG_SAVE_FAILED 无法保存配置文件。 +SM_CONFIG_OPEN_FAILED 无法打开指定的文件。 +SM_CONFIG_CONFIRM 这将在 VPN Server 应用指定的配置文件。VPN Server 将自动重启并将装载新的配置文件。当前连接到此 VPN Server 上的用户连接将被中断。此管理会话也将被切断,您将需要重新连接到服务器。\r\n\r\n您要继续吗? +SM_CONFIG_WRITE_OK 在服务端的配置文件被覆盖。 +SM_AO_COLUMN_1 项目 +SM_AO_COLUMN_2 值 +SM_TRUE_OR_FALSE 此项目设置为 0 (false) 或 1 (true)。 +SM_AO_SET_OK 虚拟 HUB 管理员选项已设定。 +SM_EXT_OPTION_SET_OK 虚拟 HUB 扩展选项已设定。 +SM_PASSWORD_MSG 目前此 VPN Server 没有设定管理员密码。建议设定密码。\r\n\r\n您是否要设定一个服务端管理员密码? +SM_L3_SW_COLUMN1 虚拟 3 层交换机名称 +SM_L3_SW_COLUMN2 运行状态 +SM_L3_SW_COLUMN3 接口数 +SM_L3_SW_COLUMN4 路由表数 +SM_L3_SW_ST_F_F 停止 +SM_L3_SW_ST_T_F 启动 (错误) +SM_L3_SW_ST_T_T 开始 (运行) +SM_L3_SW_DEL_MSG 是否确定删除虚拟 3 层交换机 "%S" ? +SM_L3_SW_IF_COLUMN1 IP 地址 +SM_L3_SW_IF_COLUMN2 子网掩码 +SM_L3_SW_IF_COLUMN3 虚拟 HUB 名称 +SM_L3_SW_TABLE_COLUMN1 网络地址 +SM_L3_SW_TABLE_COLUMN2 子网掩码 +SM_L3_SW_TABLE_COLUMN3 网关地址 +SM_L3_SW_TABLE_COLUMN4 公制 +SM_SECURE_NAT_MSG 您是否确定启用 SecureNAT ?\r\n\r\n如果您启用 SecureNAT,带虚拟NAT功能的虚拟路由器将被创建,在虚拟 HUB 中有一个 IP 地址。此虚拟路由器将互相影响,作为一台计算机或多台连接到虚拟网络的计算机组成的路由器。\r\n\r\n在虚拟NAT中的 SecureNAT 启用任何计算机连接到虚拟 HUB,通过 SecureNAT 建立与外部网络的通信。\r\n因此,当 SecureNAT 运行在此 VPN Server 时,无需使用本地客户端连接这台计算机的虚拟 HUB。\r\n\r\n\r\n此外,请注意如果在从虚拟 HUB 二层网段可以到达的一个地点,已有一个 DHCP 服务器,单击“SecureNAT 配置”禁用 DHCP 服务器功能,否则将有 DHCP 冲突。\r\n\r\n而且,您可以禁用 NAT 功能,只使用 DHCP 服务器,如果你想的话。 +SM_CRL_COLUMN_1 证书摘要 +SM_CRL_DELETE_MSG 这将删除选定的项目。你想这样做? +SM_CRL_EMPTY_MSG 没有项目被选择。\r\n如果您在证书吊销项目中进行追加,所有证书将被判断为非法,且所有证书认证模式下的客户端连接将被拒绝。\r\n\r\n您是否确认? +SM_AC_COLUMN_1 ID +SM_AC_COLUMN_2 优先级 +SM_AC_COLUMN_3 行为 +SM_AC_COLUMN_4 目录 +SM_AC_PASS 允许 +SM_AC_DENY 拒绝 +SM_LOG_FILE_COLUMN_1 日志文件的名称 +SM_LOG_FILE_COLUMN_2 文件大小 +SM_LOG_FILE_COLUMN_3 更新日期 +SM_LOG_FILE_COLUMN_4 位置 +SM_READ_LOG_FILE_INFO_1 请等待,直到处理完毕... +SM_READ_LOG_FILE_INFO_2 %S 处理中,%S 已完成 +SM_READ_LOG_FILE_ERROR 文件没有成功下载。 +SM_READ_SAVE_DLG_TITLE 指定日志文件的保存目标文件名 +SM_READ_SAVE_DLG_FILTER 日志文件 (*.log)|*.log|所有文件(*.*)|*.* +SM_READ_SAVE_FAILED 无法保存日志文件。 +SM_READ_SAVE_TMP_FAILED 无法写入临时文件 "%S"。 +SM_READ_SAVE_OPEN_ERROR 无法打开临时文件 "%S"。 \r\n\r\n可能 .LOG 文件扩展名是不是在 Windows 分配的文件类型。 +SM_LICENSE_COLUMN_1 编号 +SM_LICENSE_COLUMN_2 许可证密钥 +SM_LICENSE_COLUMN_3 许可证类型名 +SM_LICENSE_COLUMN_4 状态 +SM_LICENSE_COLUMN_5 有效期 +SM_LICENSE_COLUMN_6 许可证编号 +SM_LICENSE_COLUMN_7 许可证类型 ID +SM_LICENSE_COLUMN_8 服务器 ID +SM_LICENSE_COLUMN_9 序列号 +SM_LICENSE_INFINITE 无限 +SM_LICENSE_NO_EXPIRES 没有到期 +SM_LICENSE_STATUS_EDITION 产品版本 +SM_LICENSE_STATUS_RELEASE VPN Server 的发布日期 +SM_LICENSE_STATUS_SYSTEM_ID 当前服务端 ID +SM_LICENSE_STATUS_EXPIRES 目前产品许可的有效期 +# ----- 不完全翻訳ここから ----- +SM_LICENSE_STATUS_SUBSCRIPTION 认购合同的状态 +SM_LICENSE_STATUS_SUBSCRIPTION_NONEED 无需认购 (在这个版本不需要认购密钥) +SM_LICENSE_STATUS_SUBSCRIPTION_NONE 无密钥(需要添加认购密钥) +SM_LICENSE_STATUS_SUBSCRIPTION_VALID 在认购期内 [直至 %s] +SM_LICENSE_STATUS_SUBSCRIPTION_EXPIRED 认购已过期 [在%s] +SM_LICENSE_STATUS_SUBSCRIPTION_BUILD 版本允许当前合同 +SM_LICENSE_STATUS_SUBSCRIPTION_BUILD_STR 免费升级到 %s 以前发布的所有将来版本。 +SM_LICENSE_STATUS_ENTERPRISE 企业功能的可用性 +SM_LICENSE_STATUS_ENTERPRISE_YES 是 (可用的) +SM_LICENSE_STATUS_ENTERPRISE_NO 否 (不可用) +SM_LICENSE_NUM_USER 允许用户对象创建 +# ----- 不完全翻訳ここまで ----- +SM_LICENSE_NUM_CLIENT 允许并发客户端 +SM_LICENSE_NUM_BRIDGE 允许并发 Bridge +SM_NO_LICENSE_COLUMN 注意: +SM_NO_LICENSE 因为没有产品许可证注册,此 VPN Server 通信功能无法运行。 +SM_LICENSE_DELETE_MSG 你确定要从 VPN Server 删除选定的许可证吗? +SM_SYSLOG_0 禁用系统日志发送功能 +SM_SYSLOG_1 经由 Syslog 发送服务器端日志 +SM_SYSLOG_2 经由 Syslog 发送服务器端和虚拟 HUB 安全日志 +SM_SYSLOG_3 经由 Syslog 发送服务器端,虚拟 HUB 安全和数据包日志 +SM_SETUP_INFO_1 点击“下一步”开始安装。如果你想通出安装并手动配置所有设置,请单击“关闭“”。 +SM_SETUP_INFO_2 单击“关闭“,通过你自己手动配置 VPN Server 的设置。 +SM_SETUP_BRIDGE_ONLY 您当前连接到 VPN Bridge ,您只能为“多点 VPN ”在每个站点创建 VPN Bridge。 +SM_SETUP_BRIDGE_EDGE 每个站点的 VPN Bridge(&E) +SM_SETUP_WARNING 当前 VPN Server 或 VPN Bridge 的设置将被初始化。\r\n您是否确定? +SM_SETUP_SELECT 选择以太网设备建立桥接 +SM_SETUP_NO_LICENSE_KEY 目前此 SoftEther VPN Server 上没有注册任何一个许可证。\r\n\r\n如果要作为 VPN Server 运行 SoftEther VPN Server,您必须输入一个许可证密钥。\r\n您是否要打开许可证管理器窗口? ?\r\n\r\n(作为试用版使用 VPN Server ,您必须从 SoftEther VPN Project 的网站获取试用密钥。\r\n点击“是”并点击获取或延长许可证按钮获取一个试用密钥。 + +# ----- 不完全翻訳ここから ----- +SM_HUBEXT_OPTION_TITLE 虚拟 HUB 扩展选项 +SM_HUBEXT_OPTION_STATIC1 虚拟 HUB 扩展选项允许您配置这个虚拟 HUB 的详细参数。 +SM_HUBEXT_OPTION_STATIC2 标准,VPN Server 全部管理者及,虚拟 HUB 管理者的双方都,能编辑虚拟 HUB 高级选项。但,如果虚拟 HUB 管理选择的 deny_hub_admin_change_ext_option 默认情况下,VPN 服务器的全局管理员和各虚拟 HUB 的管理员都可以修改虚拟 HUB 扩展选项。\r\n但是,如果在虚拟 HUB 管理选项中 deny_hub_admin_change_ext_option 被设置为 1,各虚拟 HUB 的管理员就无法修改虚拟 HUB 扩展选项了 (只能查看)。 +SM_VLAN_COLUMN_0 网络适配器名称 +SM_VLAN_COLUMN_1 驱动程序种类 +SM_VLAN_COLUMN_2 驱动程序文件名 +SM_VLAN_COLUMN_3 VLAN 透明设置 +SM_VLAN_COLUMN_4 全球唯一标识符(GUID) +SM_VLAN_COLUMN_5 设备实例 ID +SM_VLAN_YES 启用 +SM_VLAN_NO 未启用 +SM_VLAN_MSG_1 Windows 注册表配置允许网络适配器“%S”发送/接收带标签的 VLAN 数据包。\r\n\r\n然而,有些网络适配器,需要额外的设置,在本地计算机的 Windows“设备管理器”的属性里设置参数来启用巨型帧(大于 1,512 字节的以太网帧)。如果你未启用巨型帧,一些大型 VLAN 数据包将被漏掉。在大型 VLAN 数据包总是消失的情况下,请启用巨型帧。(例如,设置最大容量为 4088 字节)。Windows 设备管理器将帮您配置。\r\n\r\n此 VLAN 的透明设置已被写入到 Windows 注册表中,但是不能保证 VLAN 数据包可以被有效地传送。\r\n如果 VLAN 标记的数据包在此配置后传输失败,请参阅网络适配器“%S”的手册进行手动的、充分的配置。此外,“%S”可能不支持 VLAN 透明设置。在这种情况下,这样的网络适配器不能被用来传输 VLAN 帧。使用其他产品。\r\n\r\n要应用此设置,运行 VPN Server 的 Windows 必须重新启动。不要忘了重新启动它。 + +SM_VLAN_MSG_2 在网络适配器“%S”上启用了 VLAN 透明功能的 Windows 注册表参数已从注册表中删除。\r\n\r\n如果你上次做过巨型帧启用设置,手动撤消这个变化。\r\n\r\n要应用此设置,运行 VPN Server 的 Windows 必须重新启动。不要忘了重新启动它。 + +SM_VLAN_NOTHING 支持 VLAN 透明设置工具的电脑上“%S”没有网络适配器。\r\n\r\n但是,某些网络适配器在默认情况下能够发送 VLAN 标记的数据包,或通过由供应商提供的特定配置实用程序被配置为执行 VLAN 标记的数据包。\r\通过使用这样的网络适配器,你必须自己手动配置这些设置。 +# ----- 不完全翻訳ここまで ----- +SM_SERVER_ADMIN_MSG VPN Server / Bridge "%S" +SM_ETHERIP_COLUMN_0 ISAKMP Phase 1 ID +SM_ETHERIP_COLUMN_1 虚拟 HUB 名 +SM_ETHERIP_COLUMN_2 用户名 +SM_ETHERIP_ADD_OK 一个新的 EtherIP / L2TPv3 客户端设置已注册。 +SM_IPSEC_SETUP_QUESTION 此 VPN Server 已具有支持兼容 IPsec / L2TP / EtherIP / L2TPv3 协议的 VPN Client 或 VPN 路由器的新功能。 \r\n\r\n您可以允许 VPN Server 接受从智能手机,如 iPhone,iPad,Android,或在 Mac OS X 或 Windows 上的标准 VPN Client 的连接。\r\n\r\n您要设置 IPsec 吗?\r\n(您还可以在以后任何时间通过单击“IPSEC / L2TP设置”按钮来配置 IPsec 设置。) +SM_OPENVPN_CONFIG_SAVE_OK 包含 OpenVPN 设置文件的 ZIP 文件“%s”。\r\n\r\n打开 ZIP 文件提取 OpenVPN 的样本配置文件,可以立即轻松地使用。\r\n您可能需要修改一点配置文件。\r\n\r\n对于详细信息,请阅读 ZIP 文件中的'readme.txt'文件。\r\n\r\n您现在想要打开这个 ZIP 文件吗? +SM_OPENVPN_CONFIG_SAVE_NG 无法保存 ZIP 文件'%s'。 +SM_OPENVPN_CONFIG_OPEN_NG 无法打开 ZIP 文件'%s'。请手动打开此文件。 +SM_DDNS_IPV4_ERROR 无法通过 IPv4 到达 DDNS 服务器。 +SM_DDNS_IPV6_ERROR 无法通过 IPv6 到达 DDNS 服务器。 +SM_DDNS_FQDN_EMPTY (无) +SM_DDNS_OK_MSG 动态 DNS 主机名:%S%S\r\n\r\n您可以通过指定以上 DNS 主机名访问下面的 IP 地址。\r\n\r\nIPv4 地址:%s \r\nIPv6 地址:%s\r\n\r\n您也可以指定下列主机名的特殊形式来指定 IPv4 或 IPv6 作为明确地址类型。\r\n\r\n针对 IPv4 的主机名%S.v4%S \r\n针对 IPv6 的主机名:%S.v6%S。 +SM_DDNS_OK_TITLE 动态 DNS 功能 +SM_DDNS_OK_MSG2 动态 DNS 主机名被更改为'%S'。\r\n\r\n单击提示读取更多的信息。 +SM_DDNS_KEY_TITLE 动态 DNS 密钥 +SM_DDNS_KEY_MSG 动态 DNS 密钥: %s\r\n\r\n此密钥与当前的 DDNS 名称相关联。如果你的 VPN 服务器电脑损坏,丢失了密钥,当前的 DDNS 名称将被永远占用,且其他 VPN 服务器将无法使用相同的名称。\r\n如果你想继续使用相同的名称,请在互联网服务上、或另一台电脑上、或在便笺纸上保留密钥。\r\n当在新的 VPN 服务器设置密钥时,编辑 VPN 服务器的配置文件。请在 "declare DDnsClient" 指令下,用跟随 "byte Key" 的值替换​字符串的密钥。\r\n请不要同时在两个或多个 VPN 服务器上设置相同的密钥。 +SM_DDNS_KEY_ERR 无法读取 DNS 密钥。 +SM_IPSEC_PSK_TOO_LONG 预共享密钥(PSK)有 10 个或更多的字母。\r\n\r\n据报道谷歌安卓的几个版本有一个 10 个或更多字母作为预共享密钥的严重故障。\r\n因此 9 个或少于 9 个字母被推荐作为预共享密钥。\r\n\r\n您要尝试其他预共享密钥吗? +SM_ADVANCED_REDIRECT_URL_HINT_TITLE 如何使用高级 HTTP 重定向功能 +SM_ADVANCED_REDIRECT_URL_HINT 高级 HTTP 重定向(为专家)\r\n\r\n此字符串“”是一个占位符。它可以嵌入重定向的 URL 中。\r\n\r\n嵌入 URL 示例:\r\nhttp://www.google.com/search?q=|secret\r\n\r\n当客户端将被重定向,重定向的实际 URL 目的地将被取代如下。\r\n\r\n用户名|会话ID|IP 地址|日期和时间|哈希值\r\n\r\n替换后示例:zurukko|SID-ZURUKKO-123|219.117.219.154|20131117100354|99707160AFE7A454042B2C47B064112D652452D7\r\n\r\n各字段的详情描述如下。\r\n\r\n用户名:当前 VPN 会话的用户名将被放置。\r\n\r\n会话ID:VPN 会话的会话 ID 将被放置\r\n\r\n日期和时间:14 位数字将以'YYYYMMDDHHMMSS’格式放置(时区是 UTC)\r\n\r\n哈希值:代表 20 个字节二进制数据的一个 40 字符的十六进制字符串。二进制数据是 SHA-1 哈希函数至临时字符串的结果。在重定向 URL 中“|”符号后,临时字符串是上述字段的位阵列加上秘密字符串的结合。(在上面的例子中,“秘密”是秘密字符串)。如果在 URL 中没有“|”符号,没有哈希值将被添加。\r\n\r\n哈希值的目的:秘密字符串如密钥般有效。感谢密钥。在重定向 URL 中接收重定向查询字符串的 CGI 程序,可以验证包含在 URL 中参数的完整性。\r\n +SM_ADVANCED_REDIRECT_URL_MSG URL 必须以“http://”或“https://”开始 +SM_DISABLE_DDNS_HINT_CAPTION 禁用动态 DNS 功能 +SM_DISABLE_DDNS_HINT 需要修改 VPN Server 的配置文件以禁用动态 DNS 功能。\r\n\r\n“declare root”指令下具有“declare DDnsClient”指令。在该指令中,你可以将“bool Disable”从false切换到 true,并重新启动 VPN Server ,然后动态 DNS 功能将被禁用。\r\n +SM_REGENERATE_CERT_MSG VPN Server 的证书被替换为新的。\r\n\r\n这会影响到被配置验证 VPN Server 证书的所有 VPN Client。\r\n您要继续吗? +SM_DDNS_SERVER_CERT_MSG DDNS 主机名更改为“%S”。\r\n\r\n如果您计划使用 Microsoft SSTP VPN 连接到 VPN Server ,从 Windows Vista 或 Windows 更高版本指定 DDNS 主机名为 VPN Server 的目标,由于安全原因, VPN Server 的目标主机名必须与 VPN Server 证书的 CN(Common Name)字段完全匹配。\r\n\r\n您要重新生成的服务器证书,以匹配 CN 值到“%S”吗?\r\n(单击“否”继续使用当前的服务器证书)。 +SM_DDNS_SERVER_CERT_OK VPN Server 的 SSL 证书现在已再次生成。\r\n\r\n当你让Microsoft SSTP VPN Client 连接到 VPN Server 时,你应该指定当前的 DDNS 主机名“%S”作为目标服务器的主机名。\r\n你也必须事先在 Windows 的“受信任的根证书”列表中添加这个 VPN Server 的证书。\r\n(要安装根证书到 Windows 中,在“证书“的小程序里打开 MMC,并导航到“本地计算机”。之后,你可以导入证书到的受信任的根证书列表。\r\详细说明请参考 Microsoft 的文档。)\r\n\ṛ\n您要以 X.509 格式保存新的 SSL 证书作为一个文件吗? +SM_SETUP_STEP_SECURENAT 此 VPN Server / Bridge 可能以用户模式或受其他限制正在运行,虚拟 HUB 和物理网络适配器不能桥接在一起。相反,SecureNAT 功能允许 VPN Client 与物理网络中的其他计算机进行通信。在SecureNAT功能是默认启用的。您可以配置或禁用它。 +SM_SETUP_STEP_SECURENAT_TITLE 第3步。网桥虚拟 HUB 和物理网络 +SM_UPDATE_CHECK_TITLE_VPNSERVER %S VPN Server (在主机'%S'上) +SM_UPDATE_CHECK_TITLE_VPNBRIDGE %S VPN Bridge (在主机'%S'上) +SM_FACTORY_DEFAULT_WARNING 这将在 VPN Server / Bridge 上执行出厂复位设置。\r\n当前 VPN Server / Bridge 配置将被清除,将立即应用初始设置。\r\n在做出厂复位设置前,建议您备份当前配置。\r\n\r\n按 确定 执行出厂复位设置。 VPN Server / Bridge 将重新启动。当前的管理连接将被断开,所以请重新连接到 VPN Server / Bridge。\r\n\r\n按 "取消" 取消操作。 +SM_FACTORY_DEFAULT_PERFORMED 在服务器上正在执行出厂复位操作。\r\n\r\n按“确定”退出当前 VPN Server 管理器的会话“。\r\n退出后,请重新启动 VPN Server 管理器并再次连接到 VPN Server。\r\n然后你会看到 VPN Server 复位。 +SM_AZURE_STATUS_CONNECTED 状态: 已连接 +SM_AZURE_STATUS_NOT_CONNECTED 状态: 没有连接 +SM_NO_BRIDGE_NICS 无物理网络适配器、适合本地桥在 VPN 服务器计算机上被发现。\r\n为了创建一个本地桥,你必须在计算机上至少安装一个物理网络适配器。\r\n您不能为本地桥使用 Wi-Fi 适配器或 3G 适配器。\r\n请安装一个兼容有线以太网的物理网络适配器。\r\n\r\n如果最近安装的网络适配器没有出现,重新启动计算机。\r\n\r\n如果本地桥无论如何不能使用,你可以使用“SecureNAT 功能”代替。\r\n\r\n如果你有一定的原因使用不同寻常的网络适配器(即 Wi-Fi 网络连接适配器,3G 适配器或虚拟适配器),设置“ShowAllInterfaces”变量在“LocalBridgeList”指令为“true”,然后重启VPN服务器。然后,这些设备将出现在名单上。(仅限于高级 Windows 用户)。\r\n\r\nIf this error occurs after you upgraded Windows, please re-install SoftEther VPN Server or SoftEther VPN Bridge> +SM_CERT_MESSAGE The current SSL self-signed root certificate on this VPN Server is in the old format.\r\n\r\nSome versions of OpenVPN Connect for Android have a bug to misinterpret SSL certificates in the old format. It might cause the connection problem from OpenVPN Connect for Android to this VPN Server.\r\n\r\nIf you are planning to use OpenVPN Connect for Android as a VPN client, it is recommended to regenerate the SSL server certificate.\r\n\r\nDo you want to regenerate the server certificate now? +SM_CERT_MESSAGE_CLI --- Caution ---\r\n\r\nThe current SSL self-signed root certificate on this VPN Server is in the old format.\r\n\r\nSome versions of OpenVPN Connect for Android have a bug to misinterpret SSL certificates in the old format. It might cause the connection problem from OpenVPN Connect for Android to this VPN Server.\r\n\r\nIf you are planning to use OpenVPN Connect for Android as a VPN client, it is recommended to regenerate the SSL server certificate.\r\n\r\nTo regenerate and update the server certificate, execute the "ServerCertRegenerate" command after updating the VPN Server to the latest version. +SM_CERT_NEED_ROOT The specified SSL certificate is a sub-certificate which was issued by a CA (Certificate Authority).\r\n\r\nIf you are planning to support either Microsoft SSTP or OpenVPN protocol on this VPN server, you have to install the root certificate and all intermediate certificates (if exists) on this VPN Server.\r\n\r\nTo install these certificates, copy the root certificate and all intermediate certificate files (in the X.509 format) into the "chain_certs" subdirectory on the directory which is VPN Server has been installed on.\r\n\r\nIf you don't know how to obtain root and intermediate certificate files for your certificate authority (CA), please refer to the CA's web site or contact technical support staffs of the CA. + + +#关于 User-mode 路由器管理工具 +NM_TITLE 删除 +NM_CONNECT_TITLE 删除 +NM_STATUS_TAG 连接状态: %s +NM_OFFLINE 您没有连接到任何 VPN Server +NM_CONNECTING 正在连接 VPN 服务器 +NM_CONNECTED 已连接到 VPN 服务器 "%S" +NM_CONNECT_ERROR 错误号 %u (%s) +NM_ACCOUNT_TITLE 删除 +NM_STATUS 用户模式路由器状态 +NM_STATUS_CONNECT 连接状态 +NM_STATUS_TCP NAT TCP/IP 会话数 +NM_STATUS_UDP NAT UDP/IP 会话数 +NM_STATUS_ICMP NAT ICMP 会话数 +NM_STATUS_DNS NAT DNS 会话数 +NM_STATUS_DHCP 已分配的 DHCP 客户端 +NM_INFO 用户模式路由器信息 +NM_INFO_PRODUCT_NAME 产品名称 +NM_INFO_VERSION_STR 版本信息 +NM_INFO_BUILD_INFO 构建信息 +NM_INFO_HOSTNAME 主机名 +NM_NAT_ID ID +NM_NAT_PROTOCOL 协议 +NM_NAT_SRC_HOST 源主机 +NM_NAT_SRC_PORT 源端口 +NM_NAT_DST_HOST 目标主机 +NM_NAT_DST_PORT 目标端口 +NM_NAT_CREATED 会话生成时间 +NM_NAT_LAST_COMM 最后通信时间 +NM_NAT_SIZE 接收 / 发送大小 +NM_NAT_TCP_STATUS TCP 连接状态 +NM_NAT_PROTO_TCP TCP/IP +NM_NAT_PROTO_UDP UDP/IP +NM_NAT_PROTO_DNS DNS +NM_NAT_PROTO_ICMP ICMP +NAT_TCP_CONNECTING 连接中 +NAT_TCP_SEND_RESET 断开中 +NAT_TCP_CONNECTED 已连接 +NAT_TCP_ESTABLISHED 运行中 +NAT_TCP_WAIT_DISCONNECT 断开中 +DHCP_DHCP_ID ID +DHCP_LEASED_TIME 租期开始时间 +DHCP_EXPIRE_TIME 租期到期时间 +DHCP_MAC_ADDRESS MAC 地址 +DHCP_IP_ADDRESS 分配的 IP +DHCP_HOSTNAME 客户端主机名 +NM_PASSWORD_MSG 管理员密码设定完成。 +NM_PUSH_ROUTE_WARNING 静态路由表中指定的文本可能有语法错误。 + + +#关于版本信息 +ABOUT_CAPTION 关于 %s +BETA_EXPIRES 因为目前安装的 SoftEther VPN 软件是测试版,您无法在完整版的更新测试版发布后继续使用此测试版。\r\n请访问 http://selinks.org/ 以获取 SoftEther VPN 软件的最新版本。 + + +#关于日志保存 +# (通用日志) +L_YES 是 +L_NO 否 +L_LINE ------------------------------------------------------ + +# (服务端日志) +LS_START_UTF8 Log Messages are written with UTF-8 Encoding Format. +LS_START_1 SoftEther VPN Server 已启动。 +LS_START_2 %S %S +LS_START_3 %S +LS_END_1 SoftEther VPN Server 引擎已成功关闭。 +LS_END_2 服务端引擎关闭进程已启动。 +LS_STOP_ALL_LISTENER 将停止所有 TCP 监听器。 +LS_STOP_ALL_LISTENER_2 已停止所有 TCP 监听器。 +LS_STOP_ALL_HUB 正在停止所有虚拟 HUB。 +LS_STOP_ALL_HUB_2 已停止所有虚拟 HUB。 +LS_STOP_CEDAR 正在关闭 Cedar 通信模块。 +LS_STOP_CEDAR_2 已关闭 Cedar 通信模块。 +LS_STOP_FARM_MEMBER 正在断开到群集控制器的连接。 +LS_STOP_FARM_MEMBER_2 已断开到群集控制器的连接。 +LS_STOP_FARM_CONTROL 正在停止群集控制器。 +LS_STOP_FARM_CONTROL_2 已停止群集控制器。 +LS_ENUM_ETHERNET_1 枚举以太网设备。 +LS_ENUM_ETHERNET_2 设备 %u: "%S" +LS_LOAD_CONFIG_1 正在装载配置文件。 +LS_LOAD_CONFIG_2 已装载配置文件。 +LS_LOAD_CONFIG_3 配置文件不存在,请尝试使用初始设置。 +LS_INIT_SAVE_THREAD 开始自动保存后台任务。自动保存间隔为 %u 秒。您可以在配置文件中通过修改 AutoSaveConfigSpan 参数来修改自动保存间隔。 +LS_BAD_CONFIG 配置文件内容非法。加载进程被终止。 +LS_LISTENER_START_1 正在启动 TCP 监听器 (端口 %u)。 +LS_LISTENER_START_2 已启动 TCP 监听器 (端口 %u)。现在开始监听客户端连接。 +LS_LISTENER_START_3 无法为 TCP 监听器 (端口 %u) 设置端口为监听状态。请隔一段时间再尝试,直到成功。 +LS_LISTENER_ACCEPT 在 TCP 监听器(端口 %u)上,客户端 (IP 地址 %S,主机名 "%S",端口号 %u) 的连接已建立。 +LS_LISTENER_DISCONNECT 与客户端 (IP 地址 %S,端口号 %u) 的连接已断开。 +LS_LISTENER_DOS 已检测到 TCP 监听器上有 DoS 攻击(端口号 %u)。连接源 IP 地址是%S,端口号是%u。现在将强制断开此连接。 +LS_LISTENER_MAXUEC TCP 监听器是临时暂停接受新的、向内的连接,因为未决的 TCP 连接的数量超过了 %u 个。(当前值=%u) +LS_LISTENER_STOP_1 正在停止 TCP 监听器(端口 %u) +LS_LISTENER_STOP_2 已停止 TCP 监听器(端口 %u) +LS_HUB_START 虚拟 HUB "%S" 已启动。 +LS_HUB_STOP 虚拟 HUB "%S" 已关闭。 +LS_HUB_MAC 虚拟 HUB "%S" 的 MAC 地址是 "%S"。 +LS_NODE_INFO_TAG 客户端产品名:"%S",客户端版本:%u,客户端构建号:%u,服务端产品名:"%S",服务端版本:%u,服务端构建号:%u,客户端操作系统名:"%S",客户端操作系统版本:"%S",客户端产品 ID:"%S",客户端主机名:"%S",客户端 IP 地址:"%S",客户端端口号:%u,服务端主机名:"%S",服务端 IP 地址:"%S",服务端端口号:%u,代理主机名:"%S",代理 IP 地址:"%S",代理端口号:%u,虚拟 HUB 名:"%S",客户端唯一 ID: "%S" +LS_CONNECTION_START_1 客户端 (IP 地址:%S,主机名:"%S",端口号:%u) 的连接 "%S" 已建立。 +LS_CONNECTION_END_1 连接 "%S" 已结束。 +LS_SSL_START 连接 "%S" 的 SSL 通信已启动。加密算法名为 "%S"。 +LS_CONNECTION_ERROR 连接 "%S"因原因 "%s" (代码 %u)已终止。 +LS_FARMMEMBER_NOT_ADMIN 连接 "%S": 服务端是群集成员,但客户端在非管理员 (%S) 用户情况下,尝试直接与虚拟 HUB "%S" 连接。客户端用户名为 "%S"。访问被拒绝。 +LS_HUB_NOT_FOUND 连接 "%S": 客户端正在尝试连接的虚拟 HUB "%S" 在服务端上不存在。 +LS_IP_DENIED 连接 "%S": 基于虚拟 HUB 上定义的源 IP 访问限制列表,客户端的源 IP 地址 "%S" 被拒绝。 +LS_LICENSE_ERROR 连接 "%S": 因为发生许可证相关错误,客户端无法连接到服务端。 +LS_BETA_EXPIRES SoftEther VPN Server 测试版已过期。测试版使用期限已到。请从 http://selinks.org/ 下载新的测试版或完整版。 +LS_TICKET_1 新的客户端鉴权票证已发布为群集成员 "%S"。虚拟机 HUB "%S",用户名 "%S" ("%S"),会话名 "%S",票证 "%S"。 +LS_TICKET_2 新的客户端鉴权票证已从群集控制器接收。虚拟机 HUB "%S",用户名 "%S" ("%S"),会话名 "%S",票证 "%S",有效期限 %u 秒。 +LS_ENUM_HUB 连接 "%S": 此服务端上已枚举 %u 个虚拟 HUB 服务器。 +LS_FARM_ACCEPT_1 连接 "%S": 此服务端接收到一个群集控制器连接请求,但此服务端并不是群集控制器。 +LS_FARM_ACCEPT_2 连接 "%S": 此服务端接收到一个群集控制器连接请求,但认证密码错误,拒绝连接。 +LS_FARM_ACCEPT_3 连接 "%S": 此服务端接收到一个群集控制器连接请求。认证成功。 +LS_FARM_SERV_START 到群集成员的连接已建立。IP 地址 %S,主机名 "%S"。 +LS_FARM_SERV_END 到群集成员 "%S" 的连接已删除。 +LS_FARM_CONNECT_1 到群集成员 "%S" 的连接已启动。 +LS_FARM_CONNECT_2 到群集成员 "%S" 的连接被拒绝。错误: %s (代码 %u) +LS_FARM_CONNECT_3 到群集成员 "%S" 的 TCP 连接失败。请间隔 %u 秒后再度尝试连接,直到连接成功。 +LS_FARM_DISCONNECT 到群集控制器的连接已停止。 +LS_FARM_START 已连接到群集控制器。已开始群集成员操作。VPN Server 是不是在时间许可的产品注册,VPN Client 试图连接。 +LS_LICENSE_NOT_VPNSERVER 连接 "%S": 许可证错误。VPN Client 尝试连接未注册产品许可证的 VPN Server。 +LS_LICENSE_NOT_VPNCLUSTER 连接 "%S": 许可证错误。此 VPN Server 上注册的许可证是禁止使用当前群集功能的类型,且一个 VPN Client 已尝试在群集模式下连接。您必须重启 VPN Server。 +LS_LICENSE_VIOLATION 连接 "%S": VPN Server 发生违反许可证错误,不接受连接。 +LS_LICENSE_VIOLATION_DETECTED 发现许可证违反错误,一个不同的 VPN Server 与此服务端具有相同的服务端ID "%I64u"。可能是在群集中有两个或以上 VPN Server 正在使用相同的许可证。请检查每一个 VPN Server 的许可证信息。 +LS_API_AUTH_OK HTTPS API client "%r:%u" (%S): Administration mode: "%S": The embedded HTTPS web server accepted the successful login. Username: "%S", Method: "%S", Path: "%S" +LS_API_AUTH_ERROR HTTPS API client "%r:%u" (%S): The embedded HTTPS web server refused a login attempt. Username: "%S", Method: "%S", Path: "%S" +LS_API_RPC_CALL HTTPS API client "%r:%u" (%S): The client called a JSON-API. Method: "%S", Returned error code: %u (0 = success), Returned error message: "%s" + + +# (Proto log) +LP_PREFIX_SESSION [%s] %r:%u -> %r:%u (%s): +LP_SESSION_CREATED Session created. +LP_SESSION_DELETED Session deleted. + + +# (OpenVPN Logs) +LO_PREFIX_RAW OpenVPN 模块: +LO_PREFIX_SESSION OpenVPN 会话%u (%r:%u -> %r:%u): +LO_PREFIX_CHANNEL OpenVPN 会话%u (%r:%u -> %r:%u) 通道 %u: +LO_NEW_CHANNEL 已创创建一个新通道。 +LO_CHANNEL_ESTABLISHED_NEWKEY 通道已建立。(触发器: Re-key完成。) +LO_OPTION_STR_RECV 接收到的选项字符串:"%S" +LO_CLIENT_CERT Client certificate received (subject: CN="%s"), will use certificate authentication. +LO_CLIENT_UNVERIFIED_CERT Client certificate was provided but did not pass verification (error="%S"), will use password authentication. +LO_CLIENT_NO_CERT Client certificate is not provided, will use password authentication. +LO_OPTION_STR_SEND 发送选项字符串:"%S" +LO_INITIATE_REKEY re-keying 进程已开始。 +LO_CHANNEL_ESTABLISHED 该通道成为已建立的状态。 +LO_PUSH_REPLY 完整字符串回答:"%S" +LO_CHANNEL_FAILED 无法连接通道。 +LO_CHANNEL_DISCONNECTED_BY_HUB 此 OpenVPN 的通道被终止,因为虚拟 HUB 管理员断开了此 VPN 会话。 + + +# (IPsec 日志) +LI_PREFIX_RAW IPsec 模块: +LI_PREFIX_CLIENT IPsec 客户端 %u (%S:%u -> %S:%u): +LI_PREFIX_IKE IPsec IKE 会话 (IKE SA) %u (客户端: %u) (%S:%u -> %S:%u): +LI_PREFIX_IPSEC IPsec ESP 会话 (IPsec SA) %u (客户端: %u) (%S:%u -> %S:%u): +LI_START IPsec 2.0 版 (ISAKMP/IKEv1) 处理模块已开启。 +LI_STOPPING IPsec 2.0 版 (ISAKMP/IKEv1) 处理模块现在正在关闭。 +LI_STOP IPsec 2.0 版 (ISAKMP/IKEv1) 处理模块已正常关闭。 +LI_NUM_IPSEC_SA 在关机时刻, 余下的 IPsec SA 数量是 %u。 +LI_NUM_IKE_SA 在关机时刻, 余下的 IKE SA 数量是 %u。 +LI_NUM_IKE_CLIENTS 在关机时刻, 余下的 IKE 客户端数量是 %u。 +LI_L2TP_SERVER_STARTED L2TP 服务器模块已开启。 +LI_ETHERIP_SERVER_STARTED EtherIP 服务器模块已开启。EtherIP 会话 ID: %u +LI_DELETE_IKE_CLIENT IPsec 客户端对象被删除。 +LI_DELETE_IKE_SA IKE SA 对象被删除。 +LI_DELETE_IPSEC_SA IPsec SA 对象被删除。 +LI_START_QM_FROM_SERVER 快速模式协商阶段是从服务器端调用。 +LI_START_QM_FROM_CLIENT 快速模式协商阶段是从客户端调用。 +LI_QM_DH_ERROR Diffie-Hellman 算法的计算失败。 +LI_NEW_IKE_CLIENT 新的 IPsec 客户端对象已创建。 +LI_NEW_IKE_SA 新的 IKE SA 对象 (%s) 已创建。发起 Cookie: 0x%I64X, 响应 Cookie: 0x%I64X, DH 组: %S, 哈希算法: %S, 加密算法: %S, 加密密钥大小:%u 位, 寿命:%u kbytes 或 %u 秒。 +LI_TAG_MAINMODE 主模式 +LI_TAG_AGGRESSIVE 积极模式 +LI_NEW_IPSEC_SA 新的 IPsec SA (方向:%s) 已创建。SPI: 为 0x%X, DH 组:%S, 哈希算法: %S, 加密算法: %S, 加密密钥大小: %u 位, 寿命: %u kbytes 或 %u 秒。 +LI_TAG_SERVER_TO_CLIENT 服务器 -> 客户端 +LI_TAG_CLIENT_TO_SERVER 客户端 -> 服务器 +LI_IPSEC_SA_SPI_SET 不固定的 SPI 已修改。SPI 的新值为: 0x%X +LI_IPSEC_SA_ESTABLISHED 服务器和客户端之间的 IPsec SA 已建立。 +LI_IKE_SA_ESTABLISHED 服务器和客户端之间的 IKE SA 已建立。 +LI_IPSEC_NO_TRANSFORM 在从客户端的候选人里, 没有建立 IPsec SA 的适当转换被发现。 +LI_IKE_NO_TRANSFORM 在从客户端的候选人里, 没有建立 IKE SA 的适当转换被发现。 +LI_IKE_NO_NAT_T 此客户端与 IPSec NAT Traversal (在 IKE NAT Traversal 的 RFC 3947 协商, 或 draft-ietf-ietf-ipsec-nat-t-ike) 不兼容, 因此服务器无法接受 VPN 连接。 +LI_SET_CLIENT_ID 客户端呈现的客户 ID 是 "%S". +LI_CLIENT_MERGE 此客户端 (客户端 %u) 与客户端 %u 是相同的, 因此客户端对象与客户端 %u 是相结合的。 +LI_CLIENT_UPDATE 此客户端的端口号信息是更新的。 + + +# (EtherIP日志) +LE_PREFIX EtherIP / L2TPv3 会话 %u (%S:%u - >%S:%u): +LE_START_MODULE EtherIP / L2TPv3 模块已开启。 +LE_STOP EtherIP / L2TPv3 模块已关闭。 +LE_NO_SETTING 错误: 没有与客户端 ID "%S" 相对应的 EtherIP / L2TPv3 设置。你必须预先在 VPN Server 上注册一个 EtherIP / L2TPv3 设置。 +LE_START_IPC 在 EtherIP / L2TPv3 模块和虚拟 HUB "%S" 之间的内部连接过程。用户名是 "%S" 。IPv4 TCP MSS (最大网段尺寸) 的值是 %u 字节。 +LE_IPC_CONNECT_ERROR 从 EtherIP / L2TPv3 模块到虚拟 HUB "%S" 的连接失败。错误: %u: %s +LE_IPC_CONNECT_OK 从 EtherIP / L2TPv3 模块到虚拟 HUB "%S" 的连接建立成功。 +LE_RECONNECT 由于 EtherIP / L2TPv3 设置已被修改, 现在内部连接是断开的, 将会自动重新连接。 + + +# (PPP 日志) +LP_PREFIX %S%SPPP 会话 [%S:%u]: +LP_CONNECTED 开始新的 PPP 会话 (上层协议: %S)。PPP 客户端 IP 地址:%S (主机名: "%S"), PPP 客户端端口: %u, PPP 服务器 IP 地址:%S, PPP 服务器端口:%u, 客户端软件: "%S" ,IPv4 TCP MSS (最大网段尺寸): %u 字节 +LP_DISCONNECTED PPP 会话已断开。 +LP_PAP_REJECTED VPN 客户端拒绝使用 "PAP" (Password Authentication Protocol、明文密码验证方法) 作为认证协议。您必须在 VPN 客户端设置上开启 PAP。 +LP_PAP_MSCHAPV2_REJECTED VPN 客户端拒绝使用 "PAP" (Password Authentication Protocol, 明文密码验证方法) 和 MS-CHAP v2 协议。您必须在 VPN 客户端设置上开启 PAP 或 MS-CHAP v2。 +LP_DISCONNECTED_ABNORMAL PPP 协议错误或 PPP 会话中断。 +LP_NEXT_PROTOCOL_IS_NOT_PAP 收到无效的协议 (协议号:0x%x)。在这种情况下, 只有 PAP (密码验证协议) 控制数据可以被接受。 +LP_PAP_FAILED "PAP" (密码验证协议, 明文密码验证方法) 在用户验证过程中失败。 +LP_MSCHAPV2_FAILED "MS-CHAP v2" (Microsoft Challenge and Response Protocol Version 2.0) 在用户验证过程中失败。 +LP_NEXT_PROTOCOL_IS_NOT_IPCP 收到无效协议 (协议号:0x%x)。在这种情况下, 只有 IPCP (IP 配置协议) 控制数据可以被接受。 +LP_DATA_TIMEOUT PPP 数据传输超时发生。PPP 客户端可能会从网络上断开。 +LP_CONTROL_TIMEOUT PPP 控制通讯超时发生。PPP 客户端没有响应。 +LP_VPN_SESSION_TERMINATED 因为 VPN 会话已被系统管理员断开, PPP 会话断开。 +LP_UPPER_PROTOCOL_DISCONNECTED 因为上层协议 "%S" 断开, PPP 会话断开。 +LP_NORMAL_TERMINATE 由于 VPN 客户端的请求, PPP 会话断开。 +LP_IP_ADDRESS_NOT_DETERMIND 虽然 VPN 客户端的 IP 地址是不固定的, VPN 客户端尝试发送数据。 +LP_DHCP_REQUEST_TRYING 请求 DHCP 服务器分配 IP 地址。 +LP_DHCP_REQUEST_OK IP 地址从 DHCP 服务器被分配。客户端 IP 地址: %S, 子网掩码: %S, 默认网关: %S, 域名: "%S", DNS 服务器 1: %S, DNS 服务器 2: %S, WINS 服务器 1: %S, WINS 服务器 2: %S, DHCP 服务器 IP 地址:%S, 租赁寿命: %u 秒 +LP_DHCP_REQUEST_NG 向 DHCP 服务器请求 IP 地址失败。要接受 PPP 连接, DHCP 服务器必须在现有网络上。确保任何一个在虚拟 HUB 的以太网段的 DHCP 服务器是可用的。 +LP_DHCP_INFORM_TRYING 请求 DHCP 服务器获取网络信息, 如子网掩码和默认网关。 +LP_DHCP_INFORM_OK IP 网络信息从 DHCP 服务器获取。子网掩码: %S, 默认网关:%S, 域名: "%S", DNS 服务器 1: %S, DNS 服务器 2: %S, WINS 服务器 1: %S, WINS 服务器 2: %S, DHCP 服务器 IP 地址: %S +LP_DHCP_INFORM_NG 向 DHCP 服务器请求一个 IP 网络信息失败。要接受 PPP 连接, DHCP 服务器必须在现有网络上。确保任何一个在虚拟 HUB 的以太网段的 DHCP 服务器是可用的。 +LP_SET_IPV4_PARAM 在 VPN 客户端的 IP 地址和其他 IP 网络信息已建立。客户端 IP 地址: %S, 子网掩码: %S, 默认网关: %S, DNS 服务器 1: %S, DNS 服务器 2: %S, WINS 服务器 1: %S, WINS 服务器 2: %S + + +# (虚拟 HUB 日志) +LH_ONLINE 虚拟 HUB 现在在线。 +LH_OFFLINE 虚拟 HUB 现在离线。 +LH_CONNECT_CLIENT 连接 "%S" (IP 地址 %S,主机名 %S,端口号 %u,客户端名 "%S",版本 %S,内部编号 %u) 正尝试连接到虚拟 HUB。提供的认证类型是 "%s",用户名是 "%S"。 +LH_AUTH_UNKNOWN 未知的认证类型 +LH_AUTH_ANONYMOUS 匿名身份验证 +LH_AUTH_PASSWORD 密码验证 +LH_AUTH_PLAIN_PASSWORD 外部服务器身份验证 +LH_AUTH_CERT 证书验证 +LH_AUTH_TICKET 票证验证 +LH_AUTH_OPENVPN_CERT OpenVPN certificate authentication +LH_AUTH_RADIUS_NOT_SUPPORT 连接 "%S": 用户 "%S" 身份验证方法 RADIUS 或 Active Directory (NT 域),但 VPN Server 是 "%S",因为 RADIUS 或 Active Directory (NT 域)不能使用。连接被拒绝。 +LH_AUTH_RADIUS_NOT_SUPPORT_ON_OPEN_SOURCE "%S" 的连接方法: 用户 "%S" 的身份验证方法被指定为 RADIUS 身份验证或 Active Directory 身份验证 (NT 域验证)。然而,这样一个外部用户身份验证功能尚未在 SoftEther VPN 的开源版本上实施。该连接将被拒绝。 +LH_AUTH_CERT_NOT_SUPPORT_ON_OPEN_SOURCE "%S" 的连接方法: 用户 "%S" 的身份验证方法被指定为证书认证。然而,证书验证功能尚未在 SoftEther VPN 的开源版本上实施。该连接将被拒绝。 +LH_AUTH_OK 连接 "%S": 成功认证为用户 "%S"。 +LH_AUTH_OK_CERT 虚拟 HUB 的安全账户管理器已经从 VPN Client 接收到如下证书,且接受了其内容作为当用户 "%S" 登录时的证书: %s +LH_AUTH_NG_CERT 虚拟 HUB 的安全账户管理器已经从 VPN Client 接收到如下证书,但拒绝了其内容作为当用户 "%S" 登录时的证书,因为此证书的内容匹配虚拟 HUB 中注册的废止内容列表: %s +LH_AUTH_NG Connection "%S": User authentication failed. The user name that has been provided was "%S", from %S. +LH_LOCAL_ONLY 连接 "%S": 远程登录拒绝,因为用户 "%S" 的密码为空。 +LH_POLICY_ACCESS_NG 连接 "%S": 由于安全策略,用户 "%S" 拒绝访问。 +LH_USER_EXPIRES 连接 "%S": 由于有效期限已过,用户 "%S" 拒绝访问。 +LH_CLIENT_VERSION_OLD 连接 "%S": 客户端版本号为 %u。为了允许这个连接,客户端版本号至少应为 %u 或以上。 +LH_CLIENT_ID_REQUIRED 连接 "%S": 客户已经从客户端发送的 ID 是 %u。然而,此虚拟 HUB 的 RequiredClientId 值设置为 %u。 +LH_FARM_SELECT_1 连接 "%S": 群集控制器正在确定此客户端的目标群集成员。 +LH_FARM_SELECT_2 连接 "%S": 群集控制器确定目标群集成员服务器失败。 +LH_FARM_SELECT_3 连接 "%S": 当前 VPN Server 被确定作为目标群集成员服务器。请继续接收连接。 +LH_FARM_SELECT_4 连接 "%S": 服务端 "%S" 被确定作为目标群集成员服务器。正在指示客户端重新连接到此服务端。 +LH_MAX_SESSION 连接 "%S": 虚拟 HUB 设置的最大会话数 (%u) 已到达。无法创建新会话。 +LH_MAX_SESSION_CLIENT 连接 "%S": 虚拟 HUB 设置的最大客户端会话数 (%u) 已到达。无法创建新会话。 +LH_MAX_SESSION_BRIDGE 连接 "%S": 虚拟 HUB 设置的最大网桥会话数 (%u) 已到达。无法创建新会话。 +LH_MAX_SESSION_2 连接 "%S": 可被 VPN Server 管理的的最大会话数 (%u) 已到达。无法创建新会话。 +LH_NEW_SESSION 连接 "%S": 已创建新会话 "%S"。(IP 地址:%S,端口号:%u,物理底层协议:"%S") +LH_SET_SESSION 会话 "%S": 已设置参数。最大 TCP 连接数:%u,使用的加密:%s,使用的压缩:%s,使用的半双工通信:%s,超时:%u 秒。 +LH_NODE_INFO 会话 "%S": VPN Client 详细信息: (%s) +LH_VLAN_ID 会话 "%S": Assigned VLAN ID: %u +LH_INVALID_SIGNATURE 会话 "%S": 已连接的客户端发送了非法协议数据。无法与客户端建立一般通信。请首先检查客户端到服务端之间的连接和网络线缆问题,然后再检查是否安装有特殊传输数据包重写设备。 +LH_END_SESSION 会话 "%S": 会话已结束。统计信息如下: 总输出数据大小: %I64u 字节,总输入数据大小: %I64u 字节。 +LH_BCAST_STORM 会话 "%S": 检测到大量广播数据包。您可能会按照策略废弃数据包。源 MAC 地址是 %S,源 IP 地址是 %S,目标 IP 地址是 %S。广播数据包量大于等于 %u 每秒 (注意此信息是对部分数据包进行刻板的分析,结果可能不正确)。 +LH_DHCP_FORCE 会话 "%S": 数据包被废弃,因为它尝试使用非 DHCP 服务器分配的 IP 地址 %S。 +LH_MAC_LIMIT 会话 "%S": 试图分配一个新 MAC 地址 "%S",但是 %u 个 MAC 地址已被分配在此服务上。根据安全策略,此会话被允许拥有最多 %u 个 MAC 地址。数据包被废弃。 +LH_BRIDGE_LIMIT 会话 "%S": 试图分配一个新 MAC 地址 "%S",但是 %u 个 MAC 地址已被分配在此服务上。根据安全策略,此会话被禁止网桥,因此只允许拥有不超过 %u 个 MAC 地址。数据包被废弃。 +LH_MAC_REGIST 会话 "%S": 已分配新的 MAC 地址"%S"。 +LH_MAC_REGIST_VLAN 会话 "%S": 已分配新的 MAC 地址"%S" (VLAN ID: %u)。 +LH_IP_LIMIT 会话 "%S": 试图分配一个新 IP 地址 "%S",但是 %u 个 IP 地址已被分配在此服务上。根据安全策略,此会话被允许拥有最多 %u 个 IP 地址。数据包被废弃。 +LH_ROUTING_LIMIT 会话 "%S": 试图分配一个新 IP 地址 "%S",但是 %u 个 IP 地址已被分配在此服务上。根据安全策略,此会话被禁止路由,因此只允许拥有不超过 %u 个 IP 地址。数据包被废弃。 +LH_IP_CONFLICT 会话 "%S": 试图分配一个新 IP 地址 "%S",但是此 IP 地址已经被另一个会话 "%S": ( MAC 地址:"%S")所使用。此会话的安全策略禁止复制其它会话使用的 IP 地址。数据包被废弃。详细信息:CreatedTime=%I64u, UpdatedTime=%I64u, DhcpAllocated=%u, Now=%I64u +LH_NO_SERVER 会话 "%S": 一个 TCP/IP 连接请求 (从 %S:%u 到 %S:%u) 被建立到此会话,但因为安全策略禁止作为服务端运行,数据包被废弃。 +LH_NO_DHCP 会话 "%S": 此会话上的主机 %S 发送了一个作为 DHCP 服务器为主机 %S 在其他会话上分配 IP 地址的数据包,但此会话的安全策略禁止作为 DHCP 服务器运行。数据包被废弃。 +LH_REGIST_DHCP 会话 "%S": 此会话上的主机 "%S" (%S) 的 DHCP 服务器,为令一个会话 "%S" 上的主机 "%S",分配了新的 IP 地址 %S。 +LH_BRIDGE_1 会话 "%S": 已启动本地网桥连接到物理以太网接口 "%S"。 +LH_BRIDGE_2 会话 "%S": 因为与物理以太网接口 "%S" 的通信建立失败,停止本地网桥。 +LH_SET_MTU 会话 "%S": 物理以太网接口 "%S" 的 MTU 为 %u。发送和接收有 %u 字节的以太网数据包是必要的。MTU 现已更改为 %u。 +LH_SET_MTU_ERROR 会话 "%S": 错误: 物理以太网接口"%S" 的 MTU 为 %u。发送和接收有 %u 字节的以太网数据包是必要的。然而,改变 MTU 到%u失败。此物理以太网接口或设备驱动程序可能无法处理一个大于 1,514 字节(有效载荷大小:1,500 字节)的以太网数据包。在这样的情况下,大于 1,514 字节的、带标记的 VLAN 数据包不能被发送。你应该将当前物理以太网适配器替换为支持巨型帧的另一个。您也可以尝试更新设备驱动程序。另一种可能的方法是在操作系统或设备驱动程序设置里启用巨型帧。 +LH_START_BRIDGE 已启动本地网桥连接 "%S"。已创建网桥会话 "%S"。 +LH_STOP_BRIDGE 已停止本地网桥连接 "%S"。 +LH_LINK_START 已建立级联连接 "%s"。已建立级联会话 "%S"。 +LH_LINK_STOP 已停止级联连接 "%s"。 +LH_NAT_START 已启动 SecureNAT。已创建 SecureNAT 会话 "%S"。 +LH_NAT_STOP 已停止 SecureNAT。 +LH_NAT_TCP_SUCCEED 已成功连接到 TCP 会话 %u: 主机 "%S (%S)",端口 %u。 +LH_NAT_TCP_FAILED 连接到 TCP 会话 %u: 主机 "%S",端口 %u 失败。 +LH_NAT_TCP_DELETED 已删除 TCP 会话 %u。 +LH_NAT_TCP_CREATED 已创建 TCP 会话 %u。连接源 %S:%u,连接目标 %S:%u +LH_NAT_UDP_DELETED 已删除 UDP 会话 %u。 +LH_NAT_UDP_CREATED 已创建 UDP 会话 %u。连接源 %S:%u,连接目标 %S:%u +LH_NAT_DHCP_CREATED 已建立 DHCP 项 %u。MAC 地址: %S,IP 地址: %S,主机名: %S,有效期限: %u 秒 +LH_CHANGE_PASSWORD_1 连接到虚拟 HUB 的连接 "%S" (IP 地址 %S) 在改变密码模式。 +LH_CHANGE_PASSWORD_2 连接 "%S": 改变密码失败。指定用户 "%S" 不存在。 +LH_CHANGE_PASSWORD_3 连接 "%S": 改变密码失败。用户 "%S" 的认证类型不是密码认证。 +LH_CHANGE_PASSWORD_4 连接 "%S": 改变密码失败。用户 "%S" 的旧密码错误。 +LH_CHANGE_PASSWORD_5 连接 "%S": 用户 "%S" 的密码修改成功。 +LH_CONNECT_1 正在启动级联连接 "%s": 连接次数 %u。 +LH_CONNECT_2 级联连接 "%s" 已建立。会话名: "%S" +LH_CONNECT_ERROR 级联连接 "%s" 的已断开或连接失败。原因: %s (代码 %u) +LH_POLICY_MONITOR_MODE 连接 "%S": 因为“监测模式”打开监测模式并试图连接到虚拟 HUB 的请求被用户的安全策略禁止,连接被拒绝。 +LH_POLICY_BRIDGE_MODE 连接 "%S": 因为桥接和路由操作打开桥接或路由并试图连接到虚拟 HUB 的请求被用户的安全策略禁止,连接被拒绝。 +LH_NOT_ENOUGH_CLIENT_LICENSE 连接 "%S": 此连接试图使用“客户端连接模式”连接到 VPN Server,但因为此操作会导致整个服务端上的客户端连接数超过已注册的客户端许可证数,因此不可能再接收更多连接。当前连接许可证数不足时,您必须断开已存在的客户端连接,或增加许可证数。在服务端目前目前 %u 个已注册的客户端连接许可证和 %u 个连接。 +LH_NOT_ENOUGH_BRIDGE_LICENSE 连接 "%S": 此连接试图使用“桥接模式”连接到 VPN Server,但因为此操作会导致整个服务端上的桥接数超过已注册的桥接许可证数,因此不可能再接收更多连接。当前连接许可证数不足时,您必须断开已存在的客户端连接,或增加许可证数。在服务端目前目前 %u 个已注册的桥接许可证和 %u 个连接。 +LH_TOO_MANY_MULTILOGINS 连接 "%S": 用户 "%S" 尝试登录,但此用户的安全策略限制了最大多重登录到 %u 个会话。目前此用户登录了 %u 个会话,因此无法建立新的 VPN 连接。 +LH_TOO_MANY_MULTILOGINS2 连接“%S”:用户“%S”登录尝试,但 VPN Server 的这个版本,允许多个并发 VPN 会话的最大数量达到每用户 %u 会话。目前这个用户的多个并发的 VPN 会话的数量是 %u,所以大于多个并发的 VPN 会话是不被允许的。如果你想每用户支持更多的多个并发 VPN 会话,请考虑升级到专业版或 VPN Server 的更高版本。 +LH_PACKET_LOG_NO_LOG 此 VPN Server 的版本不支持数据包日志功能。无 IP 地址或无 TCP / UDP 包头的数据将被记录。在你升级 VPN Server 版升级到专业版或更高版本后,各种数据包日志将被记录在这个文件中。 +LH_PACKET_LOG_NO_LOG_OSS VPN 服务器是开源或免费的版本。尚未实施 IP 地址或 TCP / UDP 包头数据记录功能。这里不记录 IP 地址,也不记录 TCP / UDP 包头数据。 +LH_NO_RADIUS_SETTING 用户“%S”被配置为使用 RADIUS 身份验证。然而,没有 RADIUS 身份验证设置。用户不能进行身份验证。 +LH_KERNEL_MODE_START 据检测,SecureNAT 的内核模式 NAT 可以在接口 "%S" 上运行。内核模式 NAT 开始。 TCP、UDP 和 ICMP NAT 处理将执行与高性能通过以下内核模式。内核模式 NAT 参数:IP 地址="%r",子网掩码="%r",默认网关="%r",广播地址="%r",虚拟 MAC 地址:"%S",DHCP 服务器地址:"%r",DNS服务器地址:"%r" +LH_KERNEL_MODE_STOP SecureNAT 接口“%S”的内核模式 NAT 已停止。 + + +# (日志管理) +LA_CONNECTED_1 连接 "%S" 使用服务端管理员模式连接。 +LA_CONNECTED_2 连接 "%S" 使用虚拟 HUB 管理员模式连接。虚拟 HUB 名为 "%S"。 +LA_IP_DENIED 连接 "%S" 试图使用管理员模式从一个被 adminip.txt 禁止的 IP 地址连接。断开中。 +LA_ERROR 连接 "%S" 无法使用管理员模式登录。%s (错误码 %u) +LA_OK 连接 "%S" 成功使用管理员模式登录。 +LA_RPC_START 连接 "%S" 为管理员模式成功创建了一个远程程序呼叫会话 "%S"。 +LA_TAG_1 管理模式 "%S": +LA_TAG_2 管理模式 "%S" (虚拟 HUB "%S"): +LA_CREATE_LISTENER 已建立新 TCP 监听器 (端口号 %u)。 +LA_DELETE_LISTENER 已删除 TCP 监听器 (端口号 %u)。 +LA_ENABLE_LISTENER 已启用 TCP 监听器 (端口号 %u)。 +LA_DISABLE_LISTENER 已禁用 TCP 监听器 (端口号 %u)。 +LA_SET_PORTS_UDP UDP ports have been set: %s. +LA_SET_PROTO_OPTIONS %s options have been set. +LA_SET_SERVER_PASSWORD 服务端管理员密码设置完成。 +LA_SET_FARM_SETTING 群集设置变更完成。 +LA_SET_SERVER_CERT 服务端证书设定完成。 +LA_REGENERATE_SERVER_CERT 服务器证书再次生成。新 CN:"%S" +LA_SET_SERVER_CIPHER 服务端的新加密算法名设定完成。新加密算法为 "%S"。 +LA_CREATE_HUB 已创建新虚拟 HUB "%S"。 +LA_SET_HUB 已变更虚拟 HUB 设置。 +LA_DELETE_HUB 已删除虚拟 HUB "%S"。 +LA_SET_HUB_RADIUS 已变更虚拟 HUB 外部 RADIUS 认证服务器设置。 +LA_DISCONNECT_CONN 连接到服务端的客户端连接 "%S" 已被强制断开。 +LA_SET_HUB_ONLINE 虚拟 HUB 现在在线。 +LA_SET_HUB_OFFLINE 虚拟 HUB 现在离线。 +LA_SET_SNAT_OPTION 已设置 SecureNAT 选项。 +LA_ENABLE_SNAT 已启动 SecureNAT 功能。 +LA_DISABLE_SNAT 已禁用 SecureNAT 功能。 +LA_SET_HUB_LOG 已变更日志保存设置。 +LA_ADD_CA 已注册信任的根证书。 +LA_DELETE_CA 已删除信任的根证书。 +LA_CREATE_LINK 已添加级联连接 "%s"。 +LA_SET_LINK 已变更级联连接 "%s" 设置。 +LA_SET_LINK_ONLINE 级联连接 "%s" 现在在线。 +LA_SET_LINK_OFFLINE 级联连接 "%s" 现在离线。 +LA_DELETE_LINK 已删除级联连接 "%s"。 +LA_RENAME_LINK 级联连接 "%s" 名称已更改 "%s"。 +LA_ADD_ACCESS 已添加访问列表。 +LA_DELETE_ACCESS 已删除访问列表。 +LA_SET_ACCESS_LIST 已更新访问列表。完成 %u 个访问列表项设定。 +LA_SET_AC_LIST 已更新源 IP 地址限制列表。已设定 %u 个规则项目。 +LA_CREATE_USER 已创建用户 "%S"。 +LA_SET_USER 已更新用户 "%S" 的设置。 +LA_DELETE_USER 已删除用户 "%S"。 +LA_CREATE_GROUP 已创建组 "%S"。 +LA_SET_GROUP 已更新组 "%S" 的设置。 +LA_DELETE_GROUP 已删除组 "%S"。 +LA_DELETE_SESSION 会话 "%S" 被强制断开。 +LA_SET_KEEP 已更新服务端的 Internet 连接维持设置。 +LA_SET_SYSLOG 已更新服务端的 syslog 发送功能设置。 +LA_DELETE_BRIDGE 已删除本地桥接定义 "%S" --> "%S"。 +LA_ADD_BRIDGE 已添加本地桥接定义 "%S" --> "%S"。 +LA_REBOOT_SERVER 请重新启动 VPN Server。 +LA_GET_CONFIG 已读取配置文件。 +LA_SET_CONFIG 已写入配置文件。VPN Server 重启中。 +LA_SET_HUB_ADMIN_OPTION 已设定虚拟 HUB "%S" 的管理选项。 +LA_SET_HUB_EXT_OPTION 已设定虚拟 HUB %S" 的虚拟 HUB 扩展选项。 +LA_ADD_L3_SW 虚拟 3 层交换机 "%S" 已在服务端上创建。 +LA_DEL_L3_SW 虚拟 3 层交换机 "%S" 已从服务端上删除。 +LA_START_L3_SW 已启动虚拟 3 层交换机 "%S"。 +LA_STOP_L3_SW 已停止虚拟 3 层交换机 "%S"。 +LA_ADD_L3_IF 虚拟 HUB "%S" 的虚拟接口已被添加到虚拟 3 层交换机 "%S"。 +LA_DEL_L3_IF 虚拟 HUB "%S" 的虚拟接口已从虚拟 3 层交换机 "%S" 中删除。 +LA_ADD_L3_TABLE 网络 "%S" 的路由表已被添加到虚拟 3 层交换机 "%S"。 +LA_DEL_L3_TABLE 网络 "%S" 的路由表已从虚拟 3 层交换机 "%S" 中删除。 +LA_ADD_CRL 证书被添加到证书无效列表。 +LA_DEL_CRL 证书已在证书无效列表中被编辑。 +LA_SET_CRL 已编辑无效证书列表的已注册的注册项目。 +LA_READ_LOG_FILE 已下载服务端 "%S" (日志文件 "%S") 上的日志文件。 +LA_ADD_LICENSE_KEY 已注册新的许可证密钥 "%S"。 +LA_DEL_LICENSE_KEY 已删除现存许可证 (%u 号)。 +LA_SET_IPSEC_CONFIG IPsec 服务器设置是更新的。 +LA_ADD_ETHERIP_ID EtherIP / L2TPv3 服务器设置 (ID="%S") 已添加。 +LA_DEL_ETHERIP_ID EtherIP / L2TPv3 服务器 (ID="%S") 设置已删除。 + +LA_SET_OVPN_SSTP_CONFIG OpenVPN 和 MS-SSTP VPN Server 设置已更新。 +LA_DDNS_HOSTNAME_CHANGED 动态 DNS 功能的主机名已更改为 "%S". +LA_SET_SPECIAL_LISTENER 特殊监听器启用/禁用状态已变更。 + + +# (客户端日志) +LC_START_1 已启动 SoftEther VPN Client 引擎。 +LC_START_2 %S %S +LC_START_3 %S +LC_END 已关闭 SoftEther VPN Client 引擎。 +LC_LOAD_CONFIG_1 加载配置文件。 +LC_LOAD_CONFIG_2 配置文件已已加载。 +LC_LOAD_CONFIG_3 配置文件不存在。请应用初始设置。 +LC_NEW_ACCOUNT 已建立新 VPN 连接设置 "%s"。 +LC_DELETE_ACCOUNT 已删除 VPN 连接设置 "%s"。 +LC_RENAME_ACCOUNT 已变更 VPN 连接设置名 "%s" 为 "%s"。 +LC_CONNECT 已开始 VPN 连接设置 "%s" 的连接处理。 +LC_CONNECT_1 VPN 连接设置 "%s": 第 %u 次连接操作开始。 +LC_CONNECT_2 VPN 连接设置 "%s": 连接完成。会话名: "%S"。 +LC_CONNECT_ERROR VPN 连接设置 "%s": 连接断开或连接失败。原因: %s (代码 %u) +LC_DISCONNECT VPN 连接设置 "%s" 断开中。 +LC_CREATE_VLAN 已创建虚拟网络适配器 "%S"。 +LC_UPDATE_VLAN 已重装虚拟网络适配器 "%S" 驱动。 +LC_DELETE_VLAN 已删除虚拟网络适配器 "%S"。 +LC_SET_PASSWORD 连接到客户端服务的密码设置已变更。 +LC_TAP_NOT_FOUND 无法找到 tun/tap 的 Mac OS X 驱动。请安装 tun/tap 驱动。 + +#(删除日志) +LE_START 正在监控目录 "%S"。如果可用磁盘空间变得小于 %S,此目录和其子目录下的日志文件和配置文件的备份文件将按照从旧到新的顺序被自动删除。决定何时开始删除的可用磁盘空间大小,可以在配置文件的“AutoDeleteCheckDiskFreeSpaceMin”项目中修改。 +LE_DELETE 可用磁盘空间已小于 %S,因此旧文件 "%S" 被自动删除。决定何时开始删除的可用磁盘空间大小,可以在配置文件的“AutoDeleteCheckDiskFreeSpaceMin”项目中修改。 +LE_NOT_ENOUGH_FREE <<警告>> 如果可用磁盘空间小于 %S,将不能自动删除日志文件和配置文件的旧备份文件。我们建议您即刻从次计算机上手动删除不必要的文件来恢复可用磁盘空间。当可用磁盘空间过小时,计算机运行将被变得不稳定。 + +# (三层交换机日志) +L3_SWITCH_START 已启动虚拟 3 层交换机 "%S"。直到此交换机上所有注册接口的虚拟 HUB 都在线后,它才开始工作。 +L3_SWITCH_ONLINE 虚拟 3 层交换机 "%S" 所有接口的虚拟 HUB 在线,且虚拟 3 层交换机已开始虚拟 3 层交换工作。 +L3_SWITCH_OFFLINE 虚拟 3 层交换机 "%S" 上至少有一个接口的虚拟 HUB 停止工作,则虚拟 3 层交换机停止工作。 +L3_SWITCH_STOP 虚拟 3 层交换机 "%S" 终止。 + + +#关于Microsoft.c +MS_VIRTUAL 专有的虚拟/内部接口 +MS_ETHERNET 以太网接口 +MS_TOKENRING 令牌环接口 +MS_FDDI FDDI 接口 +MS_PPP PPP (拨号或 VPN) +MS_LOOPBACK 环回接口 +MS_SLIP SLIP 接口 +MS_WLAN 无线网络适配器 +MS_OTHER 未知其它接口 +MS_NON_OPERATIONAL 无效 +MS_UNREACHABLE 未连接 +MS_DISCONNECTED 未连接 +MS_CONNECTING 连接中 +MS_CONNECTED 已连接 +MS_OPERATIONAL 已连接 + + +# 关于网络实用工具 +UT_SM_COLUMN_1 项目名 +UT_SM_COLUMN_2 值 +UT_SM_ST_TITLE 网络适配器的名称 +UT_SM_ST_GUID 全球唯一标识符(GUID) +UT_SM_ST_TYPE 类型 +UT_SM_ST_TYPE2 有线网络适配器 +UT_SM_ST_STATUS 状态 +UT_SM_ST_MTU MTU +UT_SM_ST_SPEED 链接速度 +UT_SM_ST_ADDRESS 物理地址 +UT_SM_ST_RECV_BYTES 接收的字节数 +UT_SM_ST_RECV_BCASTS 接收广播数据包数 +UT_SM_ST_RECV_UNICASTS 接收单播包数 +UT_SM_ST_SEND_BYTES 发送字节数 +UT_SM_ST_SEND_BCASTS 发送广播数据包数 +UT_SM_ST_SEND_UNICASTS 发送单播包数 +UT_SM_ST_IP IP 地址 %u +UT_SM_ST_SUBNET 子网掩码 %u +UT_SM_ST_GATEWAY 网关 %u +UT_SM_ST_DHCP DHCP 服务器 +UT_SM_ST_DHCP_1 租赁开始日期 +UT_SM_ST_DHCP_2 租赁到期日期 +UT_SM_ST_WINS_1 WINS 服务器 1 +UT_SM_ST_WINS_2 WINS 服务器 2 + + +# 关于以太网记录器管理器 +EM_TITLE SoftEther 以太网记录器管理器 +EM_REMOTE_TITLE 您可以连接并管理 SoftEther 以太网记录器服务。\r\n输入以太网记录器服务进行管理的计算机上运行的主机名和 IP 地址。您也可以通过使用“:”(冒号)连接端口号。 +EM_MAIN_COLUMN_1 网络适配器名 +EM_MAIN_COLUMN_2 状态 +EM_MAIN_OK 操作中 +EM_MAIN_ERROR 错误 +EM_ADD_NEW 添加新捕获的设备 +EM_ADD_EDIT 编辑捕捉设置 +EM_DELETE_CONFIRM 您确定您要删除捕捉设置 "%S" 吗? +EM_NO_LICENSE_COLUMN 注意: +EM_NO_LICENSE 因为甚至没有一个产品许可证被注册,此 SoftEther 以太网记录器将无法操作。 + +EM_UNSUPPORTED 禁用在此操作系统上正在运行的 SoftEther 以太网记录器。对于 SoftEther 以太网记录器可以使用的列表,请参阅 SoftEther 以太网记录器的在线文档。 +EM_WPCAP_REMOTE 为了使用 SoftEther 以太网记录器,你需要安装WinPcap软件。WinPcap 软件目前在服务器计算机上没有安装。\r\n\r\n要继续安装 WinPcap 软件,你必须开启正在运行 VPN Server 的那台服务器计算机上的 SoftEther 以太网记录器管理器,然后再连接到本地主机(您自己的计算机的位置),会显示本地桥功能设置窗口。 \r\n要继续,首先退出管理会话,然后,在服务器计算机上启动 SoftEther 以太网记录器管理器之后,连接到本地主机,并继续设置过程。 +EM_WPCAP_ROOT 为了使用 SoftEther 以太网记录器,你需要安装WinPcap软件。 \r\n\r\n要继续安装,您必须具有管理员权限作为用户登录到这台计算机。\r\n作为管理员登录,重新启动 SoftEther VPN Server 管理器。 +EM_WPCAP_INSTALL 为了使用 SoftEther 以太网记录器,你需要安装WinPcap软件。WinPcap 软件目前在服务器计算机上没有安装。 \r\n\r\nWinPcap 是一个易于安装的免费软件,与 VPN Server 捆绑在一起。\r\n\r\n您要开始安装 WinPcap 吗? +EM_WPCAP_REBOOT1 在 WinPcap 安装完成后,在使用 SoftEther 以太网记录器前,你必须重新启动计算机。\r\n\r\n在您手动重新启动计算机和 SoftEther 以太网记录器后,重新配置设置。 +EM_WPCAP_REBOOT2 在 WinPcap 安装后,你必须重新启动 SoftEther 以太网记录器服务。 \r\n\r\n它仅需要很短的时间重新启动 SoftEther 以太网记录器服务,但是所有当前连接到 SoftEther 以太网记录器的管理会话将被断开。 \r\n此管理会话也将被断开,因此您需要重新连接并继续。\r\n\r\n您是要重新启动 SoftEther 以太网记录器服务吗? +EM_RESOURCE 无法读取 WinPcap 驱动 + + +########################################################################### +# # +# 在软件框中的字符串数据 # +# # +########################################################################### + + +PREFIX D_SECURE +CAPTION %s - %S 的访问 +S_TITLE %S 的访问 +S_DEVICE_INFO 设备名称: %S\r\n制造商: %S +IDS_STATIC1 设备信息 +S_WARNING 要小心输入 PIN 码,因为如果你错误地输入了几次,设备将被锁定。 +IDOK 确定(&O) +IDCANCEL 取消 +S_PIN_CODE &PIN 码: + + +PREFIX D_PKCSUTIL +CAPTION PKCS#12 写入工具 +S_TITLE ePass 1000 USB 令牌 PKCS#12 写入工具 +STATIC1 通过使用此工具,您可以将您选择的 PKCS#12 文件(证书文件)写入 ePass 1000 USB 硬件安全令牌。\r\n\r\n写入证书文件的 USB 可以用于 SoftEther VPN 的身份验证。 +STATIC2 写入 PKCS#12 文件 +STATIC3 要将一个现有的 PKCS#12 文件写入 USB 令牌,单击“写入”。\r\n注意: 如果 USB 令牌中已经存储了 SoftEther VPN 的 PKCS#12 证书,则已存储的文件将被覆盖。 +B_WRITE 写入(&W) +STATIC4 从 USB 令牌擦除 PKCS#12 证书。 +STATIC5 您可以从已存储 SoftEther VPN PKCS#12 证书的 USB 令牌擦除证书数据。 +B_ERASE 擦除(&E) +IDCANCEL 退出工具(&X) +S_COPYRIGHT Copyright (c) SoftEther VPN Project.\r\nAll Rights Reserved. + + +PREFIX D_PASSPHRASE +CAPTION 私人密钥密码 +STATIC1 此私人密钥被密码保护。\r\n\r\n输入密码方可读取密钥。 +STATIC2 密码(&P): +IDOK 确定(&O) +IDCANCEL 取消 + + +PREFIX D_NM_CONNECT +CAPTION 连接到 SoftEther VPN 用户模式路由器 +S_TITLE 正在连接 %S ... + + +PREFIX D_PASSWORD +CAPTION 登录到 %S +S_TITLE 请输入您的用户名和密码以登录到服务端 "%S"。确定您选择了正确的认证类型。 +STATIC1 输入用户信息(&R): +STATIC2 账户类型(&T): +STATIC3 用户名(&N): +STATIC4 密码(&P): +R_NO_SAVE_PASSWORD 不保存密码(&D): +S_COUNTDOWN %u 秒后自动重连... +IDOK 确定(&O) +IDCANCEL 连接取消 + + +PREFIX D_STATUS +CAPTION 正在连接 %s ... +S_STATUS 初始化中... +IDCANCEL 取消 + + +PREFIX D_CERT +CAPTION 证书 +S_TITLE 此证书的信息如下。 +STATIC1 此证书的基本信息: +STATIC2 发给: +STATIC3 发行人: +STATIC4 有效期限: +STATIC5 此证书的高级信息: +STATIC6 签署此证书的当局的证书: +S_PARENT 签署此证书的证书当局的证书已在可信证书列表上注册。 +S_PARENT_BUTTON_STR 查看证书(&V) +IDCANCEL 确定(&O) +B_SAVE 保存文件(&S) + + +PREFIX D_CHECKCERT +CAPTION 安全警告 - %s +S_TITLE 你正在连接到的目标 VPN Server “%S”的连接是加密的,但由服务器提供的服务器证书的可信度是未知的。 +STATIC1 关于服务器证书 +STATIC2 正在 VPN Server 和 VPN Client 之间建立加密通道(SSL 会话)。检查服务器证书可以验证服务器的可靠性。 +S_MSG1 目标 VPN Server "%S" 提供的服务端证书如下。 +STATIC3 发给: +STATIC4 发行人: +STATIC5 有效期限: +B_SHOW 查看证书(&S) +STATIC6 摘要(MD5): +STATIC7 摘要(SHA-1): +IDOK 恢复连接(&R) +IDCANCEL 取消连接(&C) +STATIC8 此证书可能有问题,例如它不是有可信签发单位签发,或证书已过期。 +STATIC9 请确认此证书内容,并决定是否连接到此 VPN Server。单击“取消连接”来中止连接。 + + +PREFIX D_CONNECTERROR +CAPTION 连接错误 - %s +S_TITLE 连接到 VPN Server "%S" 时发生错误。 +S_COUNTDOWN %u 秒后自动重连... +IDOK 重试(&R) +IDCANCEL 连接取消 +R_HIDE 下次连接时隐藏此窗口(&H) + + +PREFIX D_CM_LOGIN +CAPTION 输入密码 - VPN Client 管理器 +S_TITLE 您必须输入客户端管理密码来使用运行在 %s 上的 VPN Client。输入客户端管理密码。 +STATIC1 密码(&P): +STATIC2 输入客户端管理密码: +IDOK 确定(&O) +IDCANCEL 取消 + + +PREFIX D_CONNECTION_STATUS +S_TITLE %s VPN 会话的状态 (实时) +B_POLICY 安全策略(&P)... +B_SERVER_CERT 服务端证书(&S) +B_CLIENT_CERT 客户端证书(&C) +IDCANCEL 关闭(&C) + + +PREFIX D_CM_POLICY +CAPTION 安全策略列表 +S_TITLE 为当前会话 %s 定义的安全策略 +IDCANCEL 关闭(&C) + + +PREFIX D_CM_ACCOUNT +STATIC1 请为 VPN Server 配置 VPN 连接设置。 +S_ACCOUNT_NAME 连接设置名(&N): +STATIC2 目标 VPN Server (&B): +STATIC3 指定目标 VPN Server 上的主机名或 IP 地址,端口号和虚拟 HUB 名。 +STATIC4 主机名(&H): +STATIC5 端口号(&P): +STATIC6 (TCP 端口) +STATIC7 虚拟 HUB 名(&V): +STATIC8 中继代理服务器(&X): +STATIC9 您可以通过代理服务器连接到 VPN Server。 +STATIC10 代理类型(&T): +R_DIRECT_TCP 直接 TCP/IP 连接(无代理)(&D) +R_HTTPS 通过 HTTP 代理服务器连接(&T) +R_SOCKS 通过 SOCKS4 代理服务器连接(&S) +R_SOCKS5 通过 SOCKS5 代理服务器连接(&S) +B_PROXY_CONFIG 代理服务器设置(&R) +STATIC11 服务端证书验证选项(&F): +R_CHECK_CERT 总是验证服务端证书(&C) +B_TRUST 管理可信发证机关证书列表(&C) +B_SERVER_CERT 指定特定证书(&S) +B_VIEW_SERVER_CERT 查看特定证书(&V) +S_VLAN_GROUP 使用虚拟网络适配器(&L): +S_POLICY_1 您可以配置将应用到级联虚拟 HUB 侧的安全策略。 +B_POLICY 安全策略(&L) +STATIC12 用户认证设置(&A): +STATIC13 认证类型(&T): +S_USERNAME 用户名(&U): +S_PASSWORD 密码(&Y): +S_CERT_INFO 您必须为用户认证指定一个客户端证书。 +STATIC14 通信的高级设置(&E): +R_RETRY 断开后自动重连(&Z) +S_RETRY_NUM_1 重连次数(&C): +S_RETRY_NUM_2 次 +S_RETRY_SPAN_1 重连间隔(&K): +S_RETRY_SPAN_2 秒 +R_INFINITE 无限重连(总是保持 VPN 在线) (&I) +B_DETAIL 高级设置(&D)... +IDOK 确定(&O) +IDCANCEL 取消 +B_CHANGE_PASSWORD 变更密码(&P) +S_CHANGE_PASSWORD 您可以在 VPN Server 上更改用户密码。 +R_HIDE 隐藏和错误窗口(&D) +R_HIDE2 隐藏 IP 地址屏幕(&O) +STATIC15 请设置连接到 VPN Server 时需要的用户认证信息。 +B_REGIST_CLIENT_CERT 指定客户端证书(&C) +B_IE 导入I&E代理服务器设置 +R_DISABLE_NATT 禁用 NAT-T + + +PREFIX D_CM_PROXY +CAPTION 代理服务器连接设置 +STATIC1 输入中继代理服务器 (HTTP 代理或 SOCKS 代理) 的主机名,IP 地址,端口,如果需要,请输入用户名和密码。 +STATIC2 主机名(&H): +STATIC3 端口(&A): +STATIC4 用户名(&U): +STATIC5 密码(&P): +B_HTTP_HEADER Custom HTTP header values +IDOK 确定(&O) +IDCANCEL 取消 +STATIC6 (可选) +STATIC7 (可选) + + +PREFIX D_CM_PROXY_HTTP_HEADER +CAPTION Custom Proxy HTTP Header Values +B_NEW New +B_DELETE Delete +B_CLEAR Clear +IDOK &OK +IDCANCEL Cancel + + +PREFIX D_CM_DETAIL +CAPTION 高级设置 +STATIC1 为系统管理员,和在网络,通信协议,安全方面有一定了解的用户提供了可选择的设置。可以由此来自定义 VPN 通信协议设置。为系统管理员和专家在网络、通信协议和安全方面提供可选设置。自定义 VPN 协议的通信设置。 +STATIC2 VPN 通信的最优化(&T): +STATIC3 使用多个物理 TCP 连接聚合为一个逻辑 VPN 连接,以提高通信吞吐量。 +STATIC4 TCP 连接数(&N): +STATIC5 连接数 +STATIC6 ※ 注意: 建议宽带线路开 8 个连接,低速线路开 1 个连接 (例如拨号)。 +STATIC7 高级设置: +STATIC8 建立间隔(&S): +STATIC9 秒 +R_USE_DISCONNECT 设置每个 TCP 的连接寿命(&A) +STATIC10 寿命(&P): +STATIC11 秒 +STATIC12 当使用两个或以上 TCP 连接时,可以使用 "半双工模式"。半双工模式下固定了每个 TCP 连接的数据方向。例如,当使用 8 个 TCP 连接建立一个 VPN 时,VPN 隧道的物理结构将被固定为: 4 个 TCP 连接专用于上行方向,其余 4 个连接专用于下行方向。 +R_USE_HALF_CONNECTION 使用半双工模式(&H) +STATIC13 加密和压缩(&C): +STATIC14 通常 VPN 会话为安全起见会被加密。您也可以禁用加密以提高吞吐量。请注意,在禁用加密的情况下,数据在网络上是以明文方式传输的。 +R_USE_ENCRYPT 使用 SSL 加密 VPN 会话(&E) +STATIC15 您可以使用数据压缩以节省 VPN 的通信带宽。当使用较慢的连接如拨号或移动连接时,启用此选项。 +R_DISABLE_UDP 禁用 UDP 加速功能功能(&P) +R_USE_COMPRESS 使用数据压缩(&U) +STATIC16 连接模式设置(&M): +S_MODE 您可以指定如下连接模式。(供网络管理员选择) +R_BRIDGE 网桥/路由器模式(&B) +R_MONITOR 监控模式(&D) +STATIC17 其它配置(&G): +R_NO_ROUTING 不要调整路由表(&R) +STATIC18 除非你得到系统管理员的同意或者你有网络和安全方面的专业知识,否则请保持此对话框的默认设置。 +STATIC19 VoIP / QoS 功能可以处理高优先级数据包,如 IP 电话数据包 (VoIP) 可以被更快的传输。 +R_DISABLE_QOS 禁用 VoIP / &QoS 功能 +IDOK 确定(&O) +IDCANCEL 取消 +S_UDPACCEL 您可以使用数据压缩以节省 VPN 通信带宽。当使用慢速连接时,如拨号或移动连接,启用此选项。 + + +PREFIX D_CM_NEW_VLAN +CAPTION 创建新虚拟网络适配器 +S_INFO 一个新虚拟网络适配器将被被创建到系统中。\r\n您可以为此虚拟网络适配器指定最长不超过 %u 个字母和数字的名称。 +STATIC1 虚拟网络适配器名(&N): +IDOK 确定(&O) +IDCANCEL 取消 +S_WIN8 请注明 "VPN" 或 "VPN2" 直到 "VPN127" 作为新的虚拟网络适配器的名称 (最多 127 个适配器可以被创建)。 + + +PREFIX D_CM_TRUST +CAPTION 管理信任的证书签发机构的列表 +STATIC1 您可以在这里管理认证授权(CA)证书列表。\r\n\r\n当连接到 VPN Server 时,您可以使用在此注册的 CA 证书来验证服务端证书。 +B_IMPORT 添加(&A) +B_EXPORT 导出(&E) +IDOK 查看证书(&V) +IDCANCEL 关闭(&C) +B_DELETE 删除(&D) + + +PREFIX D_CM_PASSWORD +CAPTION 设置密码 - VPN Client 管理器 +S_TITLE 您可以设置密码来限制此 SoftEther VPN Client 服务。\r\n设置密码后,在下次使用 VPN Client 连接管理器到 SoftEther VPN Client 服务时,您将被被要求输入密码。 +STATIC1 设置客户端管理密码: +R_USE_PASSWORD 使用密码(&U) +R_REMOTE_ONLY 仅在远程操作时需要密码(&R) +IDC_STATIC1 密码(&P): +IDC_STATIC2 确定(&E): +IDOK 确定(&O) +IDCANCEL 取消 + + +PREFIX D_CM_CONFIG +CAPTION 可选设置 +STATIC1 您可以更改 VPN Client 的设置 +STATIC2 远程管理(&E) +STATIC3 您可以通过使用 VPN Client 管理器远程模式从另一台计算机上远程管理 VPN Client 服务程序。 +R_ALLOW_REMOTE_CONFIG 允许 VPN Client 服务的远程管理(&R) +S_WARNING 建议您在允许远程管理时设置密码。在菜单里选择“工具” >“设置密码”来设置密码。 +STATIC4 在通讯闲置一段时间后自动断开互联网连接的环境下,可以通过向互联网上任意主机发送假数据包的方式来保持互联网连接。 +R_USE_KEEP_CONNECT 使用保持 Internet 连接功能(&K) +S_HOSTNAME 主机名(&H): +S_PORT 端口号(&P): +S_INTERVAL 数据包发送间隔(&I): +S_INTERVAL2 秒每数据包 +S_PROTOCOL 协议(&O): +R_TCP TCP/IP 协议(&T) +R_UDP UDP/IP 协议(&U) +S_INFO 发送的保持互联网连接的数据包大小随机,无个人信息被发送。 +IDOK 确定(&O) +IDCANCEL 取消 +STATIC5 其它配置(&O) +R_ALPHA 用户界面透明(&A) +STATIC6 ※注意:透明设置将在连接管理器重启后生效。 +STATIC7 保持互联网连接功能(&K) + + +PREFIX D_ABOUT +S_INFO1 SoftEther VPN %u.0 Developer Edition (Ver %u.%02u, Build %u) +S_INFO2 Licensed under the Apache License, Version 2.0.\r\nCopyright (c) 2012-%u all contributors on SoftEther VPN project in GitHub. All Rights Reserved.\r\nWeb Site: http://www.softether.org/\r\n%S +S_INFO3 This product includes the following software components:\r\nBitVisor: Copyright (c) 2007, 2008 University of Tsukuba. Copyright (C) 2007, 2008 National Institute of Information and Communications Technology. All rights reserved. / Microsoft(R) C Runtime Library: (c) 2007 Microsoft Corporation. All Rights Reserved. / PKCS #11 Cryptographic Token Interface (Cryptoki): Copyright (c) RSA Security Inc. / WinPcap: Copyright (c) 2001 - 2003 NetGroup, Politecnico di Torino (Italy). All rights reserved. / libedit: Copyright (c) 1992, 1993 The Regents of the University of California. All rights reserved. / libiconv: Copyright (C) 2007 Free Software Foundation, Inc. / ncurses: Copyright (c) 1998-2005, 2006 Free Software Foundation, Inc. / OpenSSL: Copyright (c) 1998-2011 The OpenSSL Project. All rights reserved. This product includes software developed by the OpenSSL Project for use in the OpenSSL Toolkit (http://www.openssl.org/). This product includes cryptographic software written by Eric Young (eay@cryptsoft.com). / zlib: (C) 1995-2004 Jean-loup Gailly and Mark Adler. / Special Thanks to: Software Laboratory, Academic Computing Communication Center, Industrial Liaison and Cooperative Research Center and Professor Yasushi Shinjo in University of Tsukuba, Japan. +S_INFO4 此 VPN 服务器作为的一个学术研究且由 (http://www.softether.org/) 为公众利益免费发布的。本软件是日本筑波大学 SoftEther 项目下开发的免费软件,无任何担保。开发人员、版权所有者或分销商在任何情况下对于使用本软件的任何索赔、损害赔偿或其他情况不承担责任。\r\n\r\nSoftEther VPN 是日本政府的研究和开发项目的一项工作,由日本的经济、贸易和工业部资助,由信息化推进机构管理。 +IDCANCEL 确定(&O) +B_WEB 访问 SoftEther VPN 和网站 (&W)... +B_EULA 最终用户许可 +B_IMPORTANT 重要启事 +B_LEGAL 法律启事 +B_UPDATE_CONFIG 配置更新 +B_AUTHORS 作者名单 + + +PREFIX D_REMOTE +STATIC1 指定目标计算机主机名或 IP 地址(&S): +R_LOCAL 连接到本地计算机 (此窗口中显示的计算机) (&L) +S_HOSTNAME 计算机名(&C): +IDOK 确定(&O) +IDCANCEL 取消 + + +PREFIX D_CM_DESKTOP +CAPTION 连接 - %s +S_TITLE VPN 连接设置 "%s" 的连接进程启动中。 +S_WARNING VPN Client 会将连接到 VPN Server 过程中的连接状态和错误信息输出到 %s 的“控制台进程”窗口。 +S_INFO 可以继续连接吗? +IDOK 继续(&C) +IDCANCEL 取消 + + +PREFIX D_CM_CHANGE_PASSWORD +CAPTION 更改密码 +S_TITLE 您可以更改服务端 %S 上注册的用户密码。 +STATIC1 更改密码(&P) +STATIC2 虚拟 HUB 名(&H): +STATIC3 用户名(&U): +STATIC4 旧密码(&O): +STATIC5 新密码(&N): +STATIC6 确认新密码(&C): +IDOK 确定(&O) +IDCANCEL 取消 +S_STATIC ※注意: 如果认证类型是 RADIUS 或 NT 域认证,您不能更改用户密码。 + + +PREFIX D_SM_MAIN +CAPTION SoftEther VPN Server 管理器 Developer Edition +STATIC1 SoftEther VPN Server 连接设置(&S): +STATIC2 VPN Server 或 VPN Bridge 的连接设置被定义如下。双击该项以连接到服务端。\r\n要添加新连接,单击“新设置”。 +B_NEW_SETTING 新设置(&N) +B_EDIT_SETTING 编辑设置(&E) +B_DELETE 删除设置(&D) +IDOK 连接(&C) +B_SECURE_MANAGER 智能卡管理器(&S)... +B_SELECT_SECURE 选择智能卡(&M)... +B_ABOUT 版本信息(&A)... +IDCANCEL 退出 SoftEther VPN Server 管理器(&X) +B_CERT_TOOL 制作证书 + + + +PREFIX D_SM_EDIT_SETTING +STATIC1 请配置要管理的 VPN Server 或 VPN Bridge 的连接设置 +STATIC2 设置名(&N): +STATIC3 目标 VPN Server (&B): +STATIC4 指定目标 VPN Server 的主机名或 IP 地址、端口号和虚拟 HUB。 +STATIC5 主机名(&H): +R_LOCALHOST 连接到本地主机(localhost)(&L) +STATIC6 端口号(&P): +STATIC7 (TCP 端口) +STATIC8 中继代理服务器(&X): +STATIC9 您可以通过代理服务器连接到 VPN Server。 +STATIC10 代理类型(&T): +R_DIRECT_TCP 直接 TCP/IP 连接 (无代理) (&D) +R_HTTPS 通过 HTTP 代理服务器连接(&T) +R_SOCKS 通过 SOCKS4 代理服务器连接(&O) +R_SOCKS5 通过 SOCKS4 代理服务器连接(&O) +B_PROXY_CONFIG 代理服务器设置(&R) +STATIC11 选择管理模式并输入密码(&M) +STATIC12 您可以使用服务端管理模式或虚拟 HUB 管理模式连接到 VPN Server。\r\n\r\n服务器管理模式允许您管理整个 VPN Server 和所有虚拟 HUB 。\r\n\r\n虚拟 HUB 管理模式允许您只能管理您拥有权限的一个虚拟 HUB 。 +R_SERVER_ADMIN 服务端管理模式(&S) +R_HUB_ADMIN 虚拟 HUB 管理模式(&U) +S_HUBNAME 虚拟 HUB 名(&V): +STATIC13 请输入密码连接管理模式。 +S_PASSWORD 密码(&P): +R_NO_SAVE 不保存管理密码(&S) +IDOK 确定(&O) +IDCANCEL 取消 + + +PREFIX D_SM_SERVER +CAPTION %s - SoftEther VPN Server 管理器 +S_TITLE 管理 VPN Server "%S" +S_VHUB_BRIDGE 通过此 VPN Server 托管的虚拟 HUB (&Z): +IDOK 管理虚拟 HUB (&A) +B_ONLINE 在线(&O) +B_OFFLINE 离线(&F) +B_HUB_STATUS 查看状态(&S) +B_CREATE 创建虚拟 HUB (&C) +B_EDIT 属性(&E) +B_DELETE 删除(&D) +STATIC1 管理监听器(&L) +STATIC2 监听器列表 (TCP/IP 端口) (&I): +B_CREATE_LISTENER 创建(&R) +B_DELETE_LISTENER 删除(&T) +B_START 开始(&G) +B_STOP 停止(&P) +S_UDP Multiple UDP ports can be specified by splitting them with a space or a comma. Leave empty to disable the UDP listener. +B_APPLY Apply +STATIC3 VPN Server 和网络信息和设置(&N) +B_SSL 加密与网络(&E) +B_STATUS 查看服务器状态(&V) +B_INFO 关于此 VPN Server 的信息 +B_LICENSE 添加 / 删除许可证(&L) +B_FARM 群集配置(&M) +B_FARM_STATUS 群集状态(&Z) +B_CONNECTION 显示 TCP/IP \r\n连接列表(&Y) +B_BRIDGE 本地网桥设置(&B) +B_L3 3 层交换机设置(&3) +B_CONFIG 编辑设置(&D) +B_REFRESH 刷新(&H) +IDCANCEL 关闭(&X) +S_BETA 测试版 (预发行) +B_IPSEC IPsec / L&2TP 设置 +B_DDNS 动态 DNS 设置 +S_DDNS 当前 DDNS 主机名: +B_OPENVPN OpenVPN / MS-SSTP 设置 +B_AZURE VPN Azure 设置 +S_AZURE VPN Azure 主机名: +B_VPNGATE VPN Gate 设置 + + +PREFIX D_SM_STATUS +IDOK 刷新(&H) +IDCANCEL 关闭(&X) + + +PREFIX D_SM_EDIT_HUB +STATIC1 虚拟 HUB 名(&N): +STATIC2 安全设置(&S): +S_BOLD 管理此虚拟 HUB 的密码 +STATIC3 密码(&P): +STATIC4 确定(&C): +R_NO_ENUM 不要向匿名用户枚举 (&U) +STATIC5 虚拟 HUB 选项(&I): +R_LIMIT_MAX_SESSION 最大 VPN 会话数限制(&L) +S_MAX_SESSION_1 最大会话数(&X): +S_MAX_SESSION_2 会话 +STATIC6 (不计算本地桥、虚拟 NAT 或级联产生的服务端虚拟会话数) +STATIC7 虚拟 HUB 状态(&J): +STATIC8 设置虚拟 HUB 状态。 +R_ONLINE 在线(&E) +R_OFFLINE 离线(&F) +STATIC9 设置群集(&M): +S_FARM_INFO 选择群集内虚拟 HUB 类型。 +R_STATIC 静态虚拟 HUB (&A) +R_DYNAMIC 动态虚拟 HUB (&D) +S_AO_1 虚拟 HUB 管理选项(&Y): +S_AO_3 显示并编辑虚拟 HUB 管理选项。 +B_ADMINOPTION 虚拟 HUB 管理选项(&K) +S_ACL_3 源 IP 访问限制列表(&R): +S_ACL 根据客户端计算机的 IP 地址允许或拒绝到此虚拟 HUB 的 VPN 连接。 +B_ACL IP 访问控制列表(&T) +IDOK 确定(&O) +IDCANCEL 取消 +STATIC10 您可以在虚拟 HUB 扩展选项列表中配置更高级的设置。 +B_EXTOPTION 编辑虚拟 HUB 扩展选项列表(&X) +S_MSG_1 当客户端连接时,显示信息。 +S_MSG_2 当 VPN Client 连接到这个虚拟 HUB 时,显示在屏幕上一个用户信息。 +B_MSG 信息设置(&M) + + +PREFIX D_SM_CREATE_LISTENER +CAPTION 创建监听器 +STATIC1 您可以为 VPN Server 添加一个 TCP/IP 端口号,来接收从客户端来的连接。\r\n\r\n请指定要添加的端口号。 +STATIC2 如果端口号已经被其它服务端程序使用,则新监听器的状态将被被更改为错误状态。\r\n\r\n此时,请停止打开相同端口的其他程序。 +STATIC3 端口号(&P): +IDOK 确定(&O) +IDCANCEL 取消 +STATIC4 (TCP/IP 端口) + + +PREFIX D_SM_SSL +CAPTION 加密和网络设置 +STATIC1 您可以查看或更改此 VPN Server 上与加密、通信和安全相关的设置。 +STATIC2 加密算法设置(&A): +STATIC3 指定与此 VPN Server 和 VPN Client 连接中使用的 SSL 加密算法名。此加密算法必须与 SSL 版本 3 相兼容。 +STATIC4 加密算法名(&C): +STATIC6 服务端证书设置(&C): +STATIC7 指定 X509 证书和私钥提交给这台服务器的客户端。 +B_IMPORT 导入(&I) +B_EXPORT 导出(&X) +B_VIEW 查看(&V) +B_REGENERATE 新的 +STATIC8 保持互联网连接活跃着(&K): +STATIC9 在闲置一段时间后自动断线的环境下,可以通过向互联网上任意主机发送假数据包的方式来保持互联网连接。 +STATIC10 服务器证书: +R_USE_KEEP_CONNECT 使用并保持互联网的连接(&K) +S_HOSTNAME 主机名(&H): +S_PORT 端口号(&P): +S_INTERVAL 发送间隔(&I): +S_INTERVAL2 秒 +S_PROTOCOL 协议(&O): +R_TCP TCP/IP 协议(&T) +R_UDP UDP/IP 协议(&U) +S_INFO 发送并保持互联网连接的数据包大小随机,无个人信息被发送。 +STATIC11 管理员密码(&W): +S_INFO4 您可以修改所有虚拟 HUB 和整个 VPN Server 的管理员密码。 +B_PASSWORD 更改管理员密码(&P) +IDOK 确定(&O) +IDCANCEL 取消 +IDCANCEL2 取消 +STATIC12 syslog 发送功能: +STATIC13 您可以通过使用 syslog 协议传输整个 VPN Server / Bridge 日志,虚拟 HUB 管理日志或虚拟 HUB 数据包日志,而不是写入本地磁盘。 +STATIC14 syslog 服务端主机名(&S): +STATIC15 端口号(&O): +S_OVER_FUNCS VPN over ICMP / DNS 服务器功能 +S_INFO5 您可以建立一个仅用 ICMP 或 DNS 数据包的 VPN ,即使有防火墙或路由器阻止 TCP/IP 通讯。 +B_SPECIALLISTENER VPN over ICMP / DNS 设置 +B_UPDATE_CONFIG 更新通知设置...(&U) + +PREFIX D_SM_SAVE_KEY_PAIR +CAPTION 保存证书和密钥 +STATIC1 请选择保存证书和密钥的方法。 +STATIC2 保存方法(&V): +R_X509_AND_KEY 保存为 X509 证书 (.CER) 和密钥文件 (.KEY) (&X) +R_PKCS12 保存为 PKCS#12 文件 (.P12) (&P) +R_SECURE 写入智能卡(&S) +STATIC3 切割成两个文件保存: 一个标准 Base 64 编码证书文件和一个密钥文件。 +STATIC4 保存为 PKCS#12 (Public Key Cryptography Standard #12) 文件。\r\n您可以将证书和密钥保存到一个 PKCS#12 文件中。 +STATIC5 当智能卡连接到此计算机时,您可以向智能卡中写入证书和密钥。 +B_SELECT 选择要使用的智能卡(&S)... +S_PASS3 密钥保护(&R) +S_PASS4 当保存密钥时,您可以设置一个密码来加密。您当加载它时,你将被要求输入密码。 +R_USE_PASS 设置密码(&A) +S_PASS1 密码(&S): +S_PASS2 确定(&E): +IDOK 确定(&O) +IDCANCEL 取消 +B_SECURE_MANAGER 智能卡管理器(&M)... + + +PREFIX D_SM_CONNECTION +CAPTION 连接列表 +S_TITLE 服务端 %S 有如下活跃的连接。注意,不包括作为 VPN 会话已建立的连接。 +IDOK 显示连接信息(&I) +B_DISCONNECT 断开(&D) +B_REFRESH 刷新(&H) +IDCANCEL 关闭(&X) + + +PREFIX D_SM_FARM +CAPTION 群集配置 +S_TITLE 您可以变更 VPN Server "%S" 的群集功能配置。 +STATIC1 群集功能可以实现负载均衡和故障平衡保护来捆绑多个 VPN Server。 +STATIC2 当前模式: +STATIC3 群集设置(&T): +R_STANDALONE 独立服务端(非群集) (&S) +R_CONTROLLER 群集控制器(&C) +R_MEMBER 群集成员服务器(&M) +STATIC4 群集成员服务器配置参数(&O): +S_IP_1 公网 IP 地址(&I): +S_IP_2 (当公网 IP 地址省略时,将会使用连接群集控制器时使用的网络接口 IP 地址。) +S_PORT_1 公网端口列表(&P): +S_PORT_2 (多个端口号用空格或逗号分隔。) +S_CONTROLLER 控制器的主机名或 IP 地址(&H): +S_CONTROLLER_PORT 控制器的\r\n端口号(&R): +S_PORT_3 (TCP 端口) +S_PASSWORD 管理密码(&P): +STATIC5 当您修改群集配置时,VPN Server 的服务自动重启。此时,所有当前正在连接的会话和管理相关的连接将被断开。 +IDOK 确定(&O) +IDCANCEL 取消 +S_1 群机内的标准比例(&W): +S_2 (标准: 100) +R_CONTROLLER_ONLY 仅控制器功能 (本身没有 VPN 会话) + + +PREFIX D_SM_FARM_MEMBER +CAPTION 群集成员列表 +S_TITLE 当前下列群集成员服务端连接到群集控制器 %S。 +IDOK 群集成员服务端信息(&I) +B_REFRESH 刷新(&H) +IDCANCEL 关闭(&X) +B_CERT 查看服务端证书(&C) + + +PREFIX D_SM_CHANGE_PASSWORD +CAPTION 更改 %S 的管理员密码 +S_TITLE 更改服务端 %S 的管理员密码。输入密码后请单击“确定”。 +STATIC1 新密码(&P): +STATIC2 确认密码(&C): +IDOK 确定(&O) +IDCANCEL 取消 + + +PREFIX D_SM_HUB +CAPTION 管理虚拟 HUB - %S +S_TITLE 虚拟 HUB "%S" +STATIC1 管理安全数据库(&D): +B_USER 管理用户(&U) +S_USER 添加,删除或编辑用户账户。 +B_GROUP 管理组(&G) +S_GROUP 添加,删除或编辑组。 +B_ACCESS 管理访问列表(&A) +S_ACCESS 添加或删除访问列表 (数据包过滤规则)。 +STATIC2 虚拟 HUB 设置(&N) +B_PROPERTY 虚拟 HUB 属性(&P) +S_PROPERTY 配置此 HUB +B_RADIUS 认证服务端设置(&E) +S_RADIUS 使用外部 RADIUS 认证服务器作为用户认证。 +B_LINK 管理级联连接(&C) +S_LINK 在本地或远程 VPN Server 上建立到 HUB 的级联连接。 +STATIC3 此虚拟 HUB 当前状态(&R): +B_REFRESH 刷新(&H) +STATIC4 其它设置(&O) +B_LOG 日志保存设置(&L) +B_LOG_FILE 日志文件列表(&Q) +S_LOG 配置日志保存功能的设置。 +B_CA 可信的 CA 证书(&T) +B_CRL 无效证书(&K) +S_CA 管理可信的 CA 证书。 +B_SNAT 虚拟 NAT 和虚拟 DHCP 服务器(&V) +S_SNAT SecureNAT 在此虚拟 HUB 上可用。您可以运行虚拟 NAT 和虚拟 DHCP。 +STATIC5 VPN 会话管理(&I): +B_SESSION 管理会话(&S) +IDCANCEL 关闭(&X) + + +PREFIX D_SM_USER +CAPTION 管理用户 +S_TITLE 虚拟 HUB "%S" 有如下用户。 +IDOK 编辑(&E) +B_CREATE 新建(&C) +B_DELETE 移除(&D) +B_REFRESH 刷新(&H) +IDCANCEL 关闭(&X) +B_STATUS 查看用户信息(&V) + + +PREFIX D_SM_EDIT_USER +IDC_STATIC1 用户名(&U): +IDC_STATIC3 全名(&F): +IDC_STATIC4 说明(&N): +IDC_STATIC5 组名\r\n(可选): +B_GROUP 浏览组(&J)... +R_EXPIRES 设置此账户有效期限(&S) +IDC_STATIC6 验证类型(&A): +S_RADIUS_3 RADIUS 或 NT 域认证设置 +S_RADIUS_1 通过密码的登录尝试通过外部 RADIUS 服务端,Windows NT 域控制器或 Active Directory 控制器被验证。 +R_SET_RADIUS_USERNAME 指定认证服务器的用户名(&K) +S_RADIUS_2 认证服务端上的用户名(&W): +S_POLICY_1 安全策略 +R_POLICY 设置安全策略(&Y) +B_POLICY 安全策略 +S_PASSWORD_1 密码认证设置 +S_PASSWORD_2 密码(&P): +S_PASSWORD_3 确认密码(&C): +S_USER_CERT_1 特定证书认证设置 +B_LOAD_CERT 指定证书(&E) +B_VIEW_CERT 查看证书(&V) +B_CREATE 创建证书(&W) +S_ROOT_CERT_1 已签名证书认证设置 +S_ROOT_CERT_2 验证客户端证书是否已签名是基于一份由虚拟 HUB 信任的 CA 证书。 +R_CN 证书的 Common Name (CN) 限制值(&B) +R_SERIAL 证书序列号的限制值(&L) +S_ROOT_CERT_3 ※ 注意: 请输入十六进制数值。(例如: 0155ABCDEF) +S_HINT 提示:使用用户名“*”(星号)定义一个用户对象,以接受不符合任何已注册的、明确的、用户对象的登录尝试。这样一个特殊的用户将使用外部用户认证服务器验证登录。 +IDOK 确定(&O) +IDCANCEL 取消 + + +PREFIX D_SM_POLICY +STATIC1 已选择策略(&P): +S_BOLD 此策略的描述(&C): +S_BOLD2 当前值(&V): +R_ENABLE 启用此策略(&E) +R_DISABLE 禁用此策略(&D) +R_DEFINE 定义此策略(&F) +IDOK 确定(&O) +IDCANCEL 取消 + + +PREFIX D_SM_GROUP +CAPTION 管理组 +S_TITLE 虚拟 HUB "%S" 有如下组 +B_CREATE 新建(&C) +IDOK 编辑(&E) +B_DELETE 移除(&R) +B_REFRESH 刷新(&R) +B_USER 成员列表(&M) +IDCANCEL 关闭(&X) + + +PREFIX D_SM_EDIT_GROUP +IDC_STATIC1 组名称(&G): +IDC_STATIC3 全名(&F): +IDC_STATIC4 说明(&N): +S_POLICY_1 安全策略 +R_POLICY 设置此组的安全策略(&Y) +B_POLICY 安全策略(&M) +S_POLICY_2 组统计信息 +IDOK 确定(&O) +IDCANCEL 取消 + + +PREFIX D_SM_ACCESS_LIST +CAPTION 访问列表 +S_TITLE 虚拟 HUB "%S" 有如下访问列表(数据包过滤规则)。 +B_ADD 新建(IPv&4) +B_ADD_V6 新建(IPv&6) +IDOK 编辑(&E) +B_DELETE 删除(&D) +B_SAVE 保存(&S) +IDCANCEL 取消(&C) +STATIC1 较高权限的项目出现在列表的上方。 +STATIC2 注意: 与访问列表项目不匹配的 IP 数据包可以通行。 +B_CLONE 克隆 +B_ENABLE 启用 +B_DISABLE 禁用 + +PREFIX D_SM_EDIT_ACCESS +CAPTION 编辑访问列表项目 +STATIC1 配置访问列表设置。此处定义的访问列表将被应用于所有穿过虚拟 HUB 的 IP 数据包。 +STATIC2 基础设置 +STATIC3 备忘(&N): +STATIC4 行为(&A): +R_PASS 通过(&P) +R_DISCARD 废弃(&D) +STATIC5 优先级(&R): +STATIC6 (较小值有更高优先权。) +STATIC7 IP 包头的过滤选项 +S_ACCESS_SRC_ALL 源 IP 地址: +R_SRC_ALL 应用到所有源地址 +S_SRC_IP_1 IPv4 地址: +S_SRC_IP_2 子网掩码: +S_SRC_IP_3 (255.255.255.255: 意为单个主机) +S_SRC_IP_1_V6 IPv6 地址: +S_SRC_IP_3_V6 (例如: "ffff:ff00::" 或 "/24"。"/128" 仅指该唯一主机) +S_ACCESS_DST_ALL 目标 IP 地址: +R_DST_ALL 应用到所有目标地址 +S_IP_DST_1 IPv4 地址: +S_IP_DST_2 子网掩码: +S_IP_DST_3 (255.255.255.255: 仅指特定主机) +S_IP_DST_1_V6 IPv6 地址: +S_IP_DST_3_V6 (例如: "ffff:ff00::" 或 "/24"。"/128" 指该唯一主机:) +STATIC9 协议类型: +STATIC10 TCP 包头和 UDP 包头的过滤选项 +S_TCP_1 最小值 +S_TCP_2 最大值 +S_TCP_3 源端口号: +S_TCP_5 目标端口号: +S_TCP_7 空白端口号字段匹配任何端口。当已指定的最小值但没指定最大值时,将应用于只符合最小值的数据包。 +STATIC11 用户/用户組过滤器选项 +STATIC11_OLD 用户过滤器选项 +STATIC12 此访问列表仅应用于具体的用户 / 用户組发出或接收的数据包。 +STATIC12_OLD 此访问列表仅应用于具体的用户发出或接收的数据包。 +STATIC13 源名称: +B_USER1 浏览... +STATIC14 目标名称: +B_USER2 浏览... +STATIC15 若不指定用户还是組,请保留这些字段为空白。 +STATIC15_OLD 若无法指定用户名称,请保持本栏目空白。 +IDOK 确定(&O) +IDCANCEL 取消 +S_PROTOID 指定 IP 协议: +STATIC16 MAC 包头的过滤选项: +S_CHECK_SRC_MAC 源 MAC 地址: +R_CHECK_SRC_MAC 应用到任一源地址 +S_SRC_MAC MAC 地址: +S_SRC_MAC_MASK 掩码: +S_CHECK_DST_MAC 目标 MAC 地址: +R_CHECK_DST_MAC 应用于任一目标地址 +B_SIMULATION 延迟和丢包(&D)... +S_DST_MAC MAC 地址: +S_DST_MAC_MASK 掩码: +S_MAC_NOTE 您可以使用带有两种分隔符'-',或 ':',或不带分隔符的十六进制数字。\r\n(FF-FF-FF-FF-FF-FF 意为指定的主机) +R_CHECK_TCP_STATE 验证 TCP 连接状态(仅 TCP 数据包) +R_ESTABLISHED 已建立的数据包 +R_UNESTABLISHED 未建立的数据包 +R_REDIRECT 重定向 HTTP 请求至特定 URL +B_REDIRECT 设置 URL 重定向至 + +PREFIX D_SM_RADIUS +CAPTION 认证服务器设置 +S_TITLE 使用外部的 RADIUS 服务器来验证到虚拟 HUB “%S”的登录尝试。指定一个外部 RADIUS 服务器来验证用户名和密码。 +STATIC1 RADIUS 服务端设置(&F): +R_USE_RADIUS 使用 RADIUS 认证(&U) +S_RADIUS_1 RADIUS 服务端主机名或 IP 地址(&S): +S_RADIUS_2 端口(&P): +S_RADIUS3 (UDP 端口) +S_RADIUS_4 共享秘密(&E): +S_RADIUS_5 确认共享秘密(&C): +S_RADIUS_6 RADIUS 服务器必须接受从 VPN Server 的 IP 地址来的请求。而且,必须启用密码认证协议(PAP)。 +S_RADIUS_7 毫秒 (大于 %u, 小于%u) +S_RADIUS_8 重试间隔(&R): +S_RADIUS_9 (使用“,”或“;”来分开多个主机名) +STATIC2 当使用 Windows NT 域控制器或 Windows Server Active Directory 控制器作为外部认证服务器时,您必须设置 VPN Server 的计算机加入到域中。使用 NT 域认证,在此不需要进行配置。 +IDOK 确定(&O) +IDCANCEL 取消 + + +PREFIX D_SM_LINK +CAPTION %S 上的级联连接 +STATIC1 级联连接可以在 2 层以太网将本虚拟 HUB 与另外一台位于本地或者远程 VPN Server 上的虚拟 HUB 建立链接。 +STATIC2 级联连接使用前 +STATIC3 级联连接实现了在多个虚拟 HUB 间的二层桥接。但如果连接配置不正确,可能会无意中创建一个无限循环。当使用级联连接功能时,请小心设计网络拓扑。 +B_CREATE 新建(&C) +B_EDIT 编辑(&E) +B_ONLINE 在线(&N) +B_OFFLINE 离线(&F) +IDOK 状态(&S) +B_DELETE 删除(&D) +B_RENAME 重命名(&A) +B_REFRESH 刷新(&R) +IDCANCEL 关闭(&X) + + +PREFIX D_SM_LOG +CAPTION 日志保存设置 +S_TITLE 您可以保存虚拟 HUB "%S"的安全日志 (如用户登录记录) 和所有经过虚拟 HUB 的数据包的数据包日志。 +STATIC1 安全日志(&S): +B_SEC 保存安全日志(&E) +S_SEC 日志文件切换周期(&W): +STATIC2 数据包日志(&P): +B_PACKET 保存数据包日志(&E) +S_PACKET 日志文件切换周期(&W): +S_PACKET_0 TCP 连接: +B_PACKET_0_0 不保存 +B_PACKET_0_1 仅包头 +B_PACKET_0_2 包头和有效载荷 +S_PACKET_1 TCP 数据包: +B_PACKET_1_0 不保存 +B_PACKET_1_1 仅包头 +B_PACKET_1_2 包头和有效载荷 +S_PACKET_2 DHCP 数据包: +B_PACKET_2_0 不保存 +B_PACKET_2_1 仅包头 +B_PACKET_2_2 包头和有效载荷 +S_PACKET_3 UDP 数据包: +B_PACKET_3_0 不保存 +B_PACKET_3_1 仅包头 +B_PACKET_3_2 包头和有效载荷 +S_PACKET_4 ICMP 数据包: +B_PACKET_4_0 不保存 +B_PACKET_4_1 仅包头 +B_PACKET_4_2 包头和有效载荷 +S_PACKET_5 IP 数据包: +B_PACKET_5_0 不保存 +B_PACKET_5_1 仅包头 +B_PACKET_5_2 包头和有效载荷 +S_PACKET_6 ARP 数据包: +B_PACKET_6_0 不保存 +B_PACKET_6_1 仅包头 +B_PACKET_6_2 包头和有效载荷 +S_PACKET_7 以太网\r\n数据包: +B_PACKET_7_0 不保存 +B_PACKET_7_1 仅包头 +B_PACKET_7_2 包头和有效载荷 +IDOK 确定(&O) +IDCANCEL 取消 +STATIC3 保存大量数据包日志会给 CPU 和硬盘带来很大的负担,会导致 HUB 和整个 VPN Server 的性能下降。启用日志记录仅保存必要的数据包。 + +PREFIX D_SM_CA +CAPTION 管理可信的 CA 证书 +STATIC1 您可以管理被此虚拟 HUB 信任的证书签发机构(CA)的证书列表。\r\n\r\n当一个 VPN Client 以已签字的证书认证模式连接时,列在此处的 CA 证书列表用于验证证书。 +B_IMPORT 添加(&A) +IDOK 查看证书(&V) +IDCANCEL 关闭(&C) +B_DELETE 删除(&D) + + +PREFIX D_SM_SESSION +CAPTION 管理会话- %S +S_TITLE 虚拟 HUB "%S"当前有以下 VPN 会话。 +STATIC1 会话操作 +IDOK 会话信息(&I) +B_DISCONNECT 断开(&D) +B_REFRESH 刷新(&H) +B_SESSION_MAC_TABLE 已选会话的 MAC 表(&M) +B_SESSION_IP_TABLE 已选会话的 IP 表(&P) +STATIC2 其它管理任务 +B_MAC_TABLE MAC 地址表列表(&A) +B_IP_TABLE IP 地址表列表(&B) +IDCANCEL 关闭(&X) +S_FARM_INFO_2 此处显示的会话是当前群集上的所有会话。要管理其他群集成员服务端上的会话,您必须以管理员身份连接到那些服务器上。 + + +PREFIX D_SM_MAC +CAPTION MAC 地址表 +S_TITLE 虚拟 HUB "%S" 上的 MAC 地址表数据库有如下条目。 +B_DELETE 删除选定条目(&D) +B_REFRESH 刷新(&H) +IDCANCEL 关闭(&X) + + +PREFIX D_SM_IP +CAPTION IP 地址表 +S_TITLE 虚拟 HUB "%S" 上的 IP 地址表数据库有如下条目。 +B_DELETE 删除选定条目(&D) +B_REFRESH 刷新(&H) +IDCANCEL 关闭(&X) + + +PREFIX D_SM_CREATE_CERT +CAPTION 创建新证书 +STATIC1 您可以轻松地创建自己或其他证书签署的证书。 +STATIC2 证书类型(&T): +R_ROOT_CERT 根证书 (自签名证书) (&R) +R_SIGNED_CERT 其他证书签名的证书(&S) +S_LOAD_1 签名用证书和密钥(&C): +B_LOAD 载入证书和密钥(&L) +S_LOAD_2 单击“载入证书和密钥”来指定使用一个新证书签名的 X509 证书和 RSA 密钥。 +S_LOAD_3 通用名称(CN): +S_LOAD_4 所属机构(O): +S_LOAD_5 组织单位(OU): +S_LOAD_6 国家(C): +S_LOAD_7 省(ST): +S_LOAD_8 地点(L): +S_LOAD_11 序列号(&S):\r\n(十六进制) +S_LOAD_9 有效期至(&E): +S_LOAD_10 天 +STATIC3 当管理大量证书和认证认证机构时,请使用免费软件,如 OpenSSL,或商业 CA(证书认证机购)软件。 +IDOK 确定(&O) +IDCANCEL 取消 +S_LOAD_12 密码强度(&N): + + +PREFIX D_NM_LOGIN +CAPTION deleted +S_TITLE deleted +STATIC1 deleted +STATIC2 deleted +IDOK deleted +IDCANCEL deleted + + +PREFIX D_SPEEDMETER +CAPTION 网络设备状态 +STATIC1 选择网络适配器: +STATIC2 实时状态(&R) +STATIC3 刷新(&R) + + +PREFIX D_NM_MAIN +CAPTION deleted +STATIC1 deleted +STATIC2 deleted +B_SETTING VPN Server 的连接设置(&S) +B_CONNECT 连接(&C) +B_DISCONNECT 断开(&D) +STATIC3 用户模式路由器的操作设置 +STATIC4 您可以在 SoftEther VPN 用户模式路由器的虚拟网络上设置操作。 +B_OPTION 用户模式路由器的操作设置(&O) +STATIC5 用户模式路由器的操作状态 +STATIC6 显示 SoftEther VPN 用户模式路由器的当前操作状态 +B_NAT 虚拟NAT状态(&N) +B_DHCP 虚拟 DHCP 服务器状态(&H) +B_STATUS 用户模式路由器状态(&R) +B_INFO 用户模式路由器信息(&I) +B_PASSWORD 管理密码设置(&P) +B_REFRESH 刷新(&E) +B_ABOUT 关于(&A) +IDCANCEL 退出(&X) + + +PREFIX D_NM_OPTION +CAPTION SecureNAT 配置 +S_TITLE 设置 SecureNAT 虚拟主机如何在虚拟 HUB "%S" 的虚拟网络上进行操作。 +STATIC1 虚拟主机网络接口设置: +STATIC2 MAC 地址(&M): +STATIC3 IP 地址(&P): +STATIC4 子网掩码(&S): +STATIC5 虚拟 NAT 设置: +R_USE_NAT 使用虚拟 NAT 功能(&A): +STATIC6 M&TU 值: +STATIC7 字节 +STATIC8 TCP 会话超时(&C): +STATIC9 秒 +STATIC10 UDP 会话超时(&U): +STATIC11 秒 +R_SAVE_LOG 保存 NAT 或 DHCP 服务器运行记录到日志文件(&L) +STATIC12 虚拟 DHCP 服务器设置: +R_USE_DHCP 使用虚拟 DHCP 服务器功能(&N) +STATIC13 分配 IP 地址(&D): +STATIC14 至 +STATIC15 。 +STATIC16 子网掩码(&B): +STATIC17 租赁期限(&E): +STATIC18 秒 +STATIC19 应用到客户端的选项 (可选): +STATIC20 默认网关\r\n地址(&F): +STATIC21 DNS 服务器地址 1 (&V): +STATIC22 域名(&W): +STATIC23 DNS 服务器地址 2 (&V): +IDOK 确定(&O) +IDCANCEL 取消 +S_1 静态路由表推功能 (拆分隧道) +S_2 推送静态路由表至 VPN 客户端。 +B_PUSH 编辑该静态路由表以推送 + + +PREFIX D_NM_NAT +CAPTION 虚拟 NAT 路由上的 NAT 会话表 +S_TITLE 有如下 TCP 或 UDP NAT 表项在 SecureNAT 的虚拟 NAT 路由上。 +B_REFRESH 刷新(&H) +IDCANCEL 关闭(&X) + + +PREFIX D_NM_DHCP +CAPTION 虚拟 DHCP 服务器上的 IP 租赁表 +S_TITLE SecureNAT 虚拟 DHCP 服务器已分配以下 IP 地址到客户端。 +B_REFRESH 刷新(&H) +IDCANCEL 关闭(&X) + + +PREFIX D_NM_CHANGE_PASSWORD +CAPTION 变更 %S 的管理员密码 +S_TITLE 您可以变更 SoftEther VPN 用户模式路由(%S) 的管理员密码。输入新密码后请单击“确定”。 +STATIC1 新密码(&P): +STATIC2 确认输入(&C): +IDOK 确定(&O) +IDCANCEL 取消 + + +PREFIX D_SM_SNAT +CAPTION 虚拟 NAT 和虚拟 DHCP 功能 (SecureNAT) 设置 +S_TITLE SecureNAT 使你在虚拟 HUB "%S" 的虚拟网络上可以运行一个虚拟 NAT 路由器(IP 伪装)和 DHCP 服务器功能。 +STATIC1 SecureNAT 警告 +S_WARNING SecureNAT 功能建议仅系统管理员或熟悉网络知识的人员使用。 +S_WARNING2 如果您正确使用 SecureNAT,VPN 可以实现安全的远程访问。但是如果使用方式不正确,可能会将整个网络暴露在危险下。任何对网络没有足够了解,或没有网络管理员的允许,请一定不要启用 SecureNAT。请参阅 VPN Server 的手册或在线文档来获取 SecureNAT 功能的详细解释。 +STATIC2 启用 / 禁用和变更 SecureNAT 设置 +STATIC3 您可以启用 / 禁用和变更此虚拟 HUB 上的 SecureNAT 设置。 +B_ENABLE 启用 SecureNAT (&E) +B_DISABLE 禁用 SecureNAT (&D) +B_CONFIG SecureNAT 配置(&C) +STATIC4 ※注意: 当禁用一个运行中的 SecureNAT 时,所有通过 SecureNAT 连接的活跃的 TCP 和 UDP 会话将被终止。 +STATIC5 查看当前 SecureNAT 状态 +STATIC6 您可以查看当前 SecureNAT 运行状态。 +B_NAT 虚拟 NAT 路由器状态(&N) +B_DHCP 虚拟 DHCP 服务器状态(&H) +B_STATUS 查看 SecureNAT 运行状态(&S) +S_TSUKUBA2 SecureNAT 使用了 登大遊 于 2004 年在筑波大学第三学群信息学系“特别信息研讨 I”开发的技术。 +IDCANCEL 关闭(&X) + + +PREFIX D_SM_BRIDGE +CAPTION 本地网桥设置 +STATIC1 本地网桥可以建立一个二层桥接来连接本 VPN Server 上的虚拟 HUB 和一个物理以太网设备(网络适配器)。;\r\n也可以创建一个 tap 设备(虚拟网络接口)并与虚拟 HUB 间建立一个桥接。(Tap 仅支持 Linux 版) +B_DELETE 删除本地网桥(&D) +STATIC2 新建&新建本地网桥定义(&N): +STATIC3 选择要桥接的虚拟 HUB +STATIC4 虚拟 HUB (&H): +STATIC5 要创建的类型(&T): +R_BRIDGE 现存物理网络适配器的桥接(&P) +R_TAP 新 tap 设备的桥接(&T) +S_ETH_1 &LAN 适配器: +S_TAP_1 新 tap 设备名称(&D): +S_TAP_2 (11 个字符以内) +STATIC6 ※注意: 可以使用任何操作系统的网络适配器建立桥接,但在高负载环境中,你应该为桥接准备一个专用的网络适配器。 +IDOK 创建本地桥(&A) +STATIC7 如果无法显示一个新安装到系统的网路适配器,重启电脑,并重新打开此窗口。 +IDCANCEL 关闭(&X) +B_VLAN VLAN 透明设置工具(&G) + + +PREFIX D_WIN9X_REBOOT +CAPTION VPN Client - 安装虚拟网络适配器 +STATIC1 VPN Client 虚拟网络适配器已安装。\r\n需要关闭 Windows并重启计算机。\r\n\r\n计算机将会自动重启。如果计算机没有重启,请手动启动计算机。 + + +PREFIX D_EM_MAIN +CAPTION SoftEther 以太网记录器管理器 +STATIC1 SoftEther 以太网记录器是一个服务,可以捕捉流经计算机上网络适配器的数据。而且,可以数据包包头保存为管理员指定类型的日志文件,所有数据保存为文本文件。\r\n\r\n目前,下列捕捉设备正在运行中。 +B_PASSWORD 管理员密码(&P) +B_LICENSE 许可证(&L) +B_ADD 添加(&A) +IDOK 编辑(&E) +B_DELETE 删除(&D) +IDCANCEL 关闭(&X) + + +PREFIX D_EM_ADD +STATIC1 用于捕获的网络适配器名称(&L): +R_PROMISCUOUS 捕获时不要使用混杂模式(&N) +STATIC2 数据包日志 (&P) : +S_PACKET 日志文件切换周期 (&W) : +S_PACKET_0 TCP 连接日志: +B_PACKET_0_0 没有保存 +B_PACKET_0_1 仅标头信息 +B_PACKET_0_2 数据包所有内容 +S_PACKET_1 TCP 数据包日志: +B_PACKET_1_0 没有保存 +B_PACKET_1_1 仅标头信息 +B_PACKET_1_2 数据包所有内容 +S_PACKET_2 DHCP 数据包日志: +B_PACKET_2_0 没有保存 +B_PACKET_2_1 仅标头信息 +B_PACKET_2_2 数据包所有内容 +S_PACKET_3 UDP 数据包日志: +B_PACKET_3_0 没有保存 +B_PACKET_3_1 仅标头信息 +B_PACKET_3_2 数据包所有内容 +S_PACKET_4 ICMP 数据包日志: +B_PACKET_4_0 没有保存 +B_PACKET_4_1 仅标头信息 +B_PACKET_4_2 数据包所有内容 +S_PACKET_5 IP 数据包日志: +B_PACKET_5_0 没有保存 +B_PACKET_5_1 仅标头信息 +B_PACKET_5_2 数据包所有内容 +S_PACKET_6 ARP 数据包日志: +B_PACKET_6_0 没有保存 +B_PACKET_6_1 仅标头信息 +B_PACKET_6_2 数据包所有内容 +S_PACKET_7 以太网\r\n数据包日志: +B_PACKET_7_0 没有保存 +B_PACKET_7_1 仅标头信息 +B_PACKET_7_2 数据包所有内容 +IDOK 确定(&O) +IDCANCEL 取消 +STATIC3 保存大量数据包日志会给CPU和硬盘带来沉重负担,并且可能导致系统整体性能下降。请配置设置以使必须的日志被保存。 + + +PREFIX D_EM_PASSWORD +CAPTION 变更管理员密码 +S_TITLE 您可以变更管理员密码。输入后请点击“确定”。 +STATIC1 新密码 (&P) : +STATIC2 确认 (&C) : +IDOK 确定(&O) +IDCANCEL Cancel + + +PREFIX D_EM_LICENSE +CAPTION 添加或删除许可证 +STATIC1 要使用 SoftEther 以太网记录器,您必须获取一个有效地许可证并注册许可证密钥。使用此窗口,您可以注册一个新的许可证密钥,删除一个已注册的许可证密钥,显示当前许可证列表和许可证模式。 +S_BOLD 当前已注册许可证列表 (&L) : +B_OBTAIN 获取许可证 (&O) +STATIC2 点击“获取许可证” 来显示介绍如何获取许可证的网站。 +B_ADD 注册新许可证密钥 +B_DEL 删除 (&D) +IDOK 许可证相关信息 (&I) +STATIC3 选择一个许可证,点击“许可证相关信息” 来连接到SoftEther有限公司网站 (softether.com),来查询被选许可证的相关注册信息。 +S_BOLD2 当前 SoftEther 以太网记录器许可证模式 (&M) : +IDCANCEL 关闭 (&X) + + +PREFIX D_EM_LICENSE_ADD +CAPTION 注册新许可证密钥 +S_INFO 您可以注册一个 SoftEther 以太网记录器产品许可证密钥。 +STATIC1 许可证密钥由36个字母数字字符和连字符组成。它是证明许可证所有权的关键代码。\r\n\r\n当此软件收到一个许可证证书时,许可证密钥就被打印到此许可证证书上了。如果此许可证是在线购买的,则许可证密钥可以通过email提供,并在购买页面显示。许可证密钥也可能通过其他方式送达。如果您不知道许可证密钥位置,请向许可证出售者询问。 +STATIC2 请输入正确的许可证密钥 (&I) : +STATIC3 每组6字,分组输入许可证密钥。您不需要输入连字符。也可以复制&&粘贴许可证密钥。 +B_INFO2 此软件有世界范围的著作权保护。消费者只可以在许可证允许范围内复制和使用此软件。警告: 使用非法获得的许可证密钥,或在多台服务器上使用一个许可证,或以非认证的方式获得许可证,会导致民事或刑事处罚。 +IDOK 注册 (&R) +IDCANCEL 取消 + +PREFIX D_EM_REMOTE +STATIC1 指定目标计算机的主机名或 IP 地址 (&S) : +R_LOCAL 连接到本地计算机 (显示在此窗口的计算机) (&L) +S_HOSTNAME 计算机名称 (&C) : +IDOK 确定(&O) +IDCANCEL 取消 +B_ABOUT 版本信息 + +PREFIX D_SM_CONFIG +CAPTION 编辑配置文件 +IDC_INFO VPN Server“%S”的当前配置如下。\r\n您可以编辑此配置文件的内容并应用到 VPN Server。 +B_EXPORT 保存到文件 (&S) +B_IMPORT 导入文件并应用 (&I) +IDCANCEL 关闭 (&C) +STATIC1 您可以使用任一文本编辑器编辑配置文件。当把已编辑的配置文件应用到 VPN Server 时, VPN Server 将自动重启,并根据新的配置文件开始。如果应用一个无效的配置文件,程序会报错,并且当前设置内容可能会丢失,所以请谨慎编辑配置文件。 +B_FACTORY 恢复出厂默认值 + +PREFIX D_SM_ADMIN_OPTION +CAPTION 虚拟 HUB 管理选项 +S_INFO 当前已为虚拟 HUB "%S" 设置如下管理选项。 +B_ADD 添加值(&A) +B_EDIT 编辑值(&E) +B_DELETE 删除值(&D) +STATIC1 虚拟 HUB 管理选项的目的是给在虚拟 HUB 管理模式的管理员设置的限制。 +IDOK 保存(&S) +IDCANCEL 取消 +STATIC2 只有整个 VPN Server 的管理员可以编辑虚拟 HUB 管理选项。个别虚拟 HUB 的管理员只能查看但不能修改管理选项。\r\n然而,如果 allow_hub_admin_change_option 被设为"1",那么虚拟 HUB 管理员就可以编辑管理选项。 +S_BOLD 描述: + + +# ----- 不完全翻訳ここから ----- +PREFIX D_SM_MSG +CAPTION 设置消息 +S_MSG_2 当一个 VPN Client 接入到虚拟 HUB "%S" 时,您可以设置消息显示在一个用户的屏幕上。要显示一个消息,输入你想要显示的消息。 +C_USEMSG 显示消息(&M) +STATIC1 关于消息显示功能 +S_INFO VPN Client 必须是 3.0 或更高版本。\r\n\r\n指定以“http://”开头的一行作为打开默认网站浏览器的消息,而不是直接显示一条消息。 +IDOK 确定(&O) +IDCANCEL 取消 + + +PREFIX D_NICINFO +CAPTION 虚拟网络适配器 "%S" 状态 +IDCANCEL 关闭(&C) + + +PREFIX D_SM_VLAN +CAPTION VLAN 透明设置工具 +STATIC1 有些网络适配器默认不能传输标记的 VLAN 透明数据包(IEEE802.1Q)。\r\n\r\n如果你使用这样一个网络适配器来桥接到虚拟 HUB 并需要交换带 VLAN 标签的以太网数据包,您必须配置网络适配器,使其能够处理 VLAN 透明数据包。 +B_ENABLE 配置已选网络适配器为 VLAN 透明(&C) +B_DISABLE 撤消该配置(&U) +STATIC2 关于 VLAN 透明设置工具 +S_WARNING 该工具可以在英特尔,Broadcom 和 Marvell 的网络适配器中开启或关闭标记 VLAN 数据包的透明度。(Windows 仅使用供应商提供的驱动)。此工具可以启用或禁用在 Intel,Broadcom 或 Marvell 网络适配器中标记的 VLAN 数据包的透明度。(仅使用供应商提供的 Windows 驱动程序)。 +S_WARNING2 本工具仅支持上述列表中的网络适配器。其他网络适配器不能用此工具配置。。但是未在此列表的其他网络适配器有可能默认支持或使用一些配置支持已标记的 VLAN 数据包。。\r\n\r\n这样的网络适配器必须由系统管理员登录 Windows 配置。 +IDCANCEL 退出(&X) + + +PREFIX D_SM_SIMULATION +CAPTION 延迟 / 丢包功能 +STATIC1 通过这个虚拟 HUB 传输时,此功能可以生成符合此访问列表条目条件的数据包的延迟、时基误差和数据包丢失。\r\n\r\n此功能方便在桌面或实验室模拟低质的和慢速的互联网、广域网或无线连接。例如,你可以用它来评估和测试 IP 电话(VoIP)。 +STATIC2 产生如下延迟、时基误差和数据包丢失: +C_DELAY 产生延迟(&D) +S_DELAY 延迟周期(0 - 10000) : +S_DELAY2 毫秒 (msecs) +C_JITTER 产生时基误差(波动)(&J) +S_JITTER 时基误差比率 (0 - 100) : +S_JITTER2 百分比(%) +C_LOSS 产生数据包丢失(&L) +S_LOSS 数据包丢失比率(0 - 100) : +S_LOSS2 百分比(%) +IDOK 确定(&O) +IDCANCEL 取消 +# ----- 不完全翻訳ここまで ----- + + +PREFIX D_SM_AO_VALUE +CAPTION 名称和值 +STATIC1 名称(&N): +STATIC2 值(&V): +STATIC3 (整数值) +IDOK 确定(&O) +IDCANCEL 取消 + + +PREFIX D_SM_L3 +CAPTION 虚拟 3 层交换设置 +STATIC1 您可以定义在此 VPN Server 上运行的两个或多个虚拟 HUB 间的虚拟 3 层交换,来实现不同 IP 网络之间的路由。 +STATIC2 虚拟 3 层交换功能仅提供给网络管理员或数值网络和 IP 路由人员使用。如果您要使用常规 VPN 功能,您不需要使用虚拟 3 层交换功能。\r\n\r\n如果使用虚拟 3 层交换功能,使用者必须有足够的 IP 路由知识。 +STATIC3 关于虚拟 3 层交换功能注意事项 +S_BOLD 已定义的虚拟 3 层交换(&S): +B_ADD 新建(&N) +B_START 开始(&S) +B_STOP 停止(&T) +IDOK 编辑(&E) +B_DELETE 删除(&D) +IDCANCEL 关闭(&C) + + +PREFIX D_SM_L3_ADD +CAPTION 新虚拟 3 层交换 +STATIC1 创新建一个新的虚拟 3 层交换,为输入一个交换机名称。\r\n\r\n此虚拟 3 层交换不能与此 VPN Server 上的其它虚拟 3 层交换有重复的名字。 +STATIC2 名字(&N): +IDOK 确定(&O) +IDCANCEL 取消 + + +PREFIX D_SM_L3_SW +CAPTION 编辑虚拟 3 层交换 "%S" +STATIC1 您可以为一个虚拟 3 层交换定义多个虚拟接口和路由表。 +STATIC2 当虚拟 HUB 运行时,一个虚拟接口被关联到虚拟 HUB 上,并作为一个单独的 IP 主机运行。当多个虚拟接口分别属于不同虚拟 HUB 定义的不同 IP 网络时,IP 路由将会自动在这些接口之间使用。\r\n也可以手动设置路由表和其他详细设置。 +S_BOLD1 虚拟接口(&I): +B_ADD_IF 新虚拟接口(&A) +B_DEL_IF 删除虚拟接口(&E) +S_BOLD2 路由表(&T): +B_ADD_TABLE 添加路由表项(&D) +B_DEL_TABLE 删除路由表项(&L) +B_START 开始(&S) +B_STOP 停止(&T) +IDCANCEL 关闭(&C) + + +PREFIX D_SM_L3_SW_IF +CAPTION 添加虚拟接口 +STATIC1 对虚拟 3 层交换机添加新的虚拟接口。\r\n\r\n您必须定义虚拟接口属于的 IP 网络和接口本身的 IP 地址。\r\n请选择或输入该接口要连接的虚拟 HUB 名称。 +STATIC2 虚拟 HUB 连接(&A): +STATIC3 请选择或输入虚拟接口连接的虚拟 HUB 名称。 +STATIC4 虚拟 HUB (&H): +STATIC5 虚拟接口的 IP 地址和子网掩码: +STATIC6 虚拟接口必须在虚拟 HUB 中有一个 IP 地址。您也必须指定此 IP 地址从属的 IP 网络的子网掩码。\r\n\r\n通过虚拟 3 层交换连接到多个虚拟 HUB 的路由是基于此处指定的 IP 地址运行的。 +S_SRC_IP_1 IP 地址(&I): +S_SRC_IP_2 子网掩码(&S): +IDOK 确定(&O) +IDCANCEL 取消 + + +PREFIX D_SM_L3_SW_TABLE +CAPTION 新路由表项 +STATIC1 在虚拟 3 层交换机的路由表增加一个新的路由表项。\r\n\r\n如果 IP 数据包的目标 IP 地址不属于任何有着虚拟接口的 IP 网络,虚拟 3 层交换机的 IP 路由引擎将参考路由表并且执行路由。 +STATIC2 路由表项的定义: +STATIC3 虚拟接口必须在虚拟 HUB 中有一个 IP 地址。您也必须指定此 IP 地址从属的 IP 网络的子网掩码。\r\n\r\n通过多个虚拟 HUB IP 网空间的虚拟 3 层交换机是基于此处指定的 IP 地址运行的。 +S_SRC_IP_1 网络地址(&N): +S_SRC_IP_2 子网掩码(&S): +S_SRC_IP_3 网关地址(&G): +S_SRC_IP_4 公制值(&M): +STATIC4 ※注意: 指定默认网关,指定网络地址和子网掩码都是“0.0.0.0“。 +IDOK 确定(&O) +IDCANCEL 取消 + + +PREFIX D_CM_SELECT_SECURE +CAPTION 选择智能卡 +STATIC1 选择智能卡设备使用。\r\n\r\n智能卡的种类已列在目前使用电脑驱动的列表中并支持 VPN 软件。\r\n如果现在使用的智能卡种类未显示在此列表中,可以通过升级 VPN 软件到新的版本来实现。\r\n\r\n注: 如果在安装后,驱动没有立即显示出来,重启 Windows。 +IDOK 确定(&O) +IDCANCEL 取消 + + +PREFIX D_CM_SECURE_MANAGER +CAPTION 智能卡管理器 +S_INFO 当前智能卡:\r\n\r\n%S +B_BOLD 智能卡上存储的对象: +B_REFRESH 更新对象列表(&R) +B_IMPORT 导入卡内(&I)... +B_EXPORT 从卡中导出(&E)... +B_DELETE 从卡中删除(&D) +B_NEW_CERT 将新证书和密钥写入卡内(&N)... +B_PIN 更改 PIN 码(&C)... +IDCANCEL 关闭 + + +PREFIX D_CM_SECURE_TYPE +CAPTION 选择对象类型 +STATIC 选择你要导入的对象类型 +R_CERT 证书(&C) +R_KEY 密钥(&K) +R_DATA 数据(&D) +IDOK 确定(&O) +IDCANCEL 取消 + + +PREFIX D_STRING +CAPTION VPN 软件 +IDOK 确定(&O) +IDCANCEL 取消 + + +PREFIX D_SM_SELECT_KEYPAIR +CAPTION 指定智能卡证书 +S_INFO 当前选定的智能卡:\r\n\r\n%S +B_BOLD1 选择智能卡证书: +IDOK 确定(&O) +IDCANCEL 取消 +B_BOLD2 选择相应的密钥: + + +PREFIX D_CM_LOAD_X +CAPTION 加载证书 +STATIC1 选择加载证书的方式 +R_FROM_FILE 从文件中加载证书(&F) +R_FROM_SECURE 从智能卡中加载证书(&S) +S_FILE 您可以从存储证书数据的文件中 (扩展名: .cer, .crt, .p12, .pfx) 加载证书。 +S_CERT 如果智能卡与计算机连接,您可以从智能卡中加载证书。 +B_SELECT 选择要使用的智能卡(&S)... +IDOK 确定(&O) +IDCANCEL 取消 + + +PREFIX D_CM_SECURE_PIN +CAPTION 更改 PIN 码 +STATIC1 您可以更改智能卡的 PIN码 (个人识别号码)。\r\n\r\n更改 PIN 码,您需要输入当前的 PIN 码和 2 次新的 PIN 码。 +STATIC2 当前的 PIN 码(&C): +STATIC3 新的 PIN 码(&N): +STATIC4 确认新的 PIN 码(&E): +STATIC5 注意 +STATIC6 如果您错误地输入几次密码,智能卡将不能使用。 +STATIC7 请插入智能卡并且点击“OK”。 +IDOK 确定(&O) +IDCANCEL 取消 + + +PREFIX D_SM_CRL +CAPTION 废止证书列表 +STATIC1 您可以在虚拟 HUB 上管理证书废止列表。\r\n\r\n通过添加证书到证书废止列表,提供这些证书的客户端将被拒绝连接到使用证书认证模式的此虚拟 HUB。 +B_ADD 添加(&A) +IDOK 编辑(&E) +IDCANCEL 关闭(&C) +B_DELETE 删除(&D) + + +PREFIX D_SM_EDIT_CRL +CAPTION 废止证书 +STATIC1 您可以在废止列表中设置条目的内容。\r\n\r\n当一个用户以证书认证模式连接一个虚拟 HUB 时,并且该证书与证书废止列表中定义的一个或多个的内容相匹配,这个用户将被拒绝连接。 +S_BOLD 匹配项目所有字段的证书将被禁用。 +STATIC2 证书内容: +R_CN 通用名称 (CN): +R_O 所属机构 (O): +R_OU 组织单位 (OU): +R_C 国家 (C): +R_ST 省 (ST): +R_L 地点 (L): +STATIC3 证书属性值: +R_SERI 序列号 (十六进制): +R_MD5_HASH MD5 摘要值 (以十六进制,128位): +R_SHA1_HASH SHA-1 摘要值 (以十六进制,160位): +STATIC4 摘要值(哈希值)可以精确地识别特定的证书。如果你指定了一个 MD5 或 SHA-1 摘要值,你不需要指定其他项目。 +STATIC5 从证书文件的输入值 +STATIC6 如果您要禁用一个证书文件,您可以正确地指定证书,并通过输入那个文件将其添加到无效清单。单击“加载证书”,指定证书文件的内容将被自动输入。 +B_LOAD 加载证书(&L)... +IDOK 确定(&O) +IDCANCEL 取消 + + +PREFIX D_SM_AC_LIST +CAPTION 源 IP 地址限制列表 +S_TITLE 根据客户端计算机的 IP 地址,允许或拒绝到此虚拟 HUB "%S" 的 VPN 连接,您可以设置以下规则来允许或拒绝连接。 +B_ADD 新规则(&A) +IDOK 编辑规则(&E) +B_DELETE 删除规则(&D) +B_SAVE 保存(&S) +IDCANCEL 取消(&C) +STATIC1 较高权限的项目列在列表的上方。 +STATIC2 如果客户端的 IP 地址不匹配列表中的任何项目,VPN 连接到此虚拟 HUB 将被允许。 + + +PREFIX D_SM_AC +CAPTION 编辑源 IP 地址限制列表的规则条目 +STATIC1 在 IP 地址访问控制列表中定义一个规则。当客户端试图连接到虚拟 HUB 时,这里设置的值将用于决定是否允许或拒绝从 VPN Client 的连接。 +STATIC2 规则的定义 +STATIC3 当客户端的 IP 地址与下面相匹配时应用此规则: +R_SINGLE 单一 IP 地址(&S) +R_MASKED 多个 IP 地址(通过 IP 地址和掩码指定) (&M) : +STATIC4 地址(&A): +S_MASK 网络掩码(&K): +STATIC5 行为 +R_PASS 允许 (&P) +R_DENY 拒绝 (&D) +STATIC6 其他 +STATIC7 优先级(&R): +STATIC8 (整数: 优先级越高数量越小) +STATIC9 IP 协议版本: +IDOK 确定(&O) +IDCANCEL 取消 + + +PREFIX D_SM_LOG_FILE +CAPTION 日志文件列表 +STATIC1 您可以下载存储在服务器上的日志文件。整个 VPN Server 的管理员允许下载所有虚拟 HUB 日志和服务器日志记录。虚拟 HUB 管理员允许下载其管理的虚拟 HUB 日志文件。 +IDOK 下载(&D) +B_REFRESH 更新(&R) +IDCANCEL 关闭 + + +PREFIX D_SM_READ_LOG_FILE +CAPTION 下载文件 +S_INFO2 VPN Server "%S" 文件下载中。\r\n请稍候... +IDCANCEL 停止下载(&S) + + +PREFIX D_SM_SAVE_LOG +CAPTION 下载的日志文件 +S_INFO 文件 "%S" 已完成下载。\r\n\r\n您可以打开或保存这个文件。 +IDOK 打开(&O) +B_SAVE 保存(&S) +IDCANCEL 取消 + + +PREFIX D_TCP +CAPTION TCP 协议优化工具 +STATIC1 通过优化 Windows TCP/IP 设置,就有可能增加这台计算机的网络通信吞吐量。通过使用这个 TCP 协议优化工具,您可以轻松地配置最佳优化参数的设置。 +STATIC2 Windows 的当前 TCP/IP 设置参数如下。通过改变这些值可以优化 TCP/IP 设置。通过使用该实用程序,以后您随时可以重置此值或恢复以前的设置。 +STATIC3 TCP/IP 通信设置: +STATIC4 TCP 接收窗口与尺寸(&S): +R_RECV_DISABLE 使用操作系统和默认值(&D) +R_RECV_ENABLE 设置值如下(&E) +S_RECV 字节 +B_RECV 默认值(&C) +STATIC5 TCP 发送窗口尺寸(&R): +R_SEND_DISABLE 使用操作系统和默认值(&I) +R_SEND_ENABLE 设置值如下(&N) +S_SEND 字节 +B_SEND 默认值(&O) +IDOK 确定(&O) +IDCANCEL 取消 +STATIC6 Windows 重启后,上述更改生效。更改设置后,您不必立即重启计算机,但直到重启后,TCP/IP 优化设置才会生效。 +B_DELETE 不用此工具管理 + + +PREFIX D_TCP_MSG +CAPTION TCP 协议优化 +STATIC1 通过 Windows 优化 TCP/IP 设置,有可能增加这台电脑的网络通信吞吐量。您想优化通信设置吗?\r\n\r\n您可以在未来随时启动 TCP 协议优化工具,优化通信设置或恢复到他们以前的值。 +STATIC2 当 TCP/IP 设置被更改,Windows 重启后,更改生效。更改设置后,您不必立即重启计算机,但直到重启后,TCP/IP 优化设置才会生效。 +R_OPTIMIZE 自动优化通讯设置(&A) +R_MANUAL 使用 TCP 协议优化工具手动优化(&M) +R_NO 不要优化(&D) +IDOK 下一步(&N) > +IDOK3 < 上一步(&B) + + +PREFIX D_CM_PKCSEULA +CAPTION 请注意使用智能卡驱动程度 +S_INFO_1 您正在试图访问 "%S" 软件的智能卡。 +S_INFO_2 当使用 "%S" 软件时,如果有这个软件和智能卡的使用条件,那么您在使用前必须同意这些使用条件。\r\n\r\n若需详情请联系 "%S" 软件和智能卡的供应商。 +S_INFO_3 您是否同意上述条件,并希望使用 "%S" 软件和访问指定的智能卡? +IDOK 是(&Y) +IDCANCEL 否(&N) + + +PREFIX D_CM_TRAFFIC +CAPTION 网络通信速度测试工具 +STATIC1 网络流量速度测试工具在两台计算机之间连接 TCP/IP 尽可能大的吞吐量进行数据包传输,以测量实际网络流量可用速度。此工具不仅限于 VPN 使用,还可以用于物理网络。 +STATIC2 使用此工具来测量当前网络带宽容量。请注意,由于两端点 CPU 性能、当前正在运行的其他程序和网络使用率的波动,获取的值有时会低于实际的网络处理能力。 +S_1 配置 +S_3 这台电脑的作用是哪一个? +R_SERVER 测试服务器(&S) +R_CLIENT 测试客户端(&C) +S_4 激活测试服务器,指定侦听端口号。\r\n使用它作为测试客户端,指定目标测试服务器的主机名或 IP 地址和端口号。如果有必要,配置以下可选设置。 +S_5 目标测试服务器主机名称(&H): +S_6 端口号(&P): +S_7 (TCP 端口) +S_8 在客户端配置如下选项。 +S_9 数据通信方向 +R_DOWNLOAD 下载 (输入: 从服务器到客户端) (&D) +R_UPLOAD 上传 (输出: 从客户端到服务器) (&U) +R_FULL 下载和上传 (全双工模式: 进与出同时进行) (&F) +S_10 高级设置 +S_11 同时并行的 TCP 连接数(&N): +S_12 测量周期 (&A): +S_13 秒 +R_ETHERNET 纠正第二层吞吐量假设以太网(&E) +R_DOUBLE 中继设备模式(&B) +S_14 连接 +IDOK 运行(&R) +IDCANCEL 取消 +S_15 您还可以从 vpncmd 命令行管理工具运行此工具。 (非 Windows 操作系统也适用)。 + + +PREFIX D_CM_TRAFFIC_RUN +CAPTION 网络通讯速度测试工具 +S_INFO 网络通讯速度测试工具正在运行。操作状态如下。 +STATIC1 要中止网络通讯速度测试工具,单击“退出”。 +IDCANCEL 退出(&X) + + +PREFIX D_CM_TRAFFIC_RESULT +CAPTION 通讯流量测量结果 +STATIC1 通讯流量测量已完成。结果如下。 +IDCANCEL 关闭(&C) + + +PREFIX D_SM_LICENSE +CAPTION 添加或删除许可证 +STATIC1 使用 SoftEther VPN Server 必须取得有效的许可证并注册许可证密钥。你可以注册一个新的许可证密钥,删除已注册的许可证密钥并在此显示当前许可证列表和 VPN Server 的许可证模式。 +S_BOLD 当前已注册的许可证密钥(&L): +B_OBTAIN 获取或延长许可证(&O) +STATIC2 点击“获取或延长许可证”以访问将提供有关如何获取许可证说明的网站。 +B_ADD 添加一个许可证密钥(&A) +B_DEL 删除(&D) +IDOK 许可证相关信息(&I) +STATIC3 选择一个许可证,点击“许可证相关信息”来连接到 SoftEther 有限公司网站 (softether.com),来查询被选许可证的相关注册信息。 +S_BOLD2 当前许可和 SoftEther VPN Server 模式(&M): +IDCANCEL 退出(&X) + + +PREFIX D_SM_LICENSE_ADD +CAPTION 添加许可证密钥 +S_INFO 您可以注册一个 SoftEther VPN Server 产品许可证或连接许可证。 +STATIC1 许可证密钥长度为 36 字母数字字符和破折号组合 ( '-' )。他们是证明一个许可证所有权的关键代码。\r\n\r\n当许可证证书与此软件一起收到时,许可证密钥印在此授权证书上。如果本软件的许可证是网上购买的,许可证密钥是由电子邮件或购买许可证的网站提供的。许可证密钥也可以通过一些其他方法写下来。如果你不知道的许可证密钥写在哪里,问卖给你许可证的供应商。 +STATIC2 请准确输入许可证密钥(&I): +STATIC3 分组输入许可证密钥,每组6位。您不需要输入破折号。您也可以复制 && 粘贴许可证密钥。 +B_INFO2 此软件受世界范围的版权法保护。消费者只可以在许可证允许范围内复制和使用此软件。使用非法获得的许可证密钥,或在多台服务器上使用一个许可证,或以非认证的方式获得许可证,会导致民事或刑事处罚。 +IDOK 注册(&R) +IDCANCEL 取消 + + +PREFIX D_FREEINFO +CAPTION SoftEther VPN Server 的免费版 +S_INFO_1 感谢您试用 SoftEther VPN Server 免费版。 +S_INFO_2 SoftEther VPN Server 运行在目标服务器 "%S" 上是免费版供个人使用。\r\n当使用免费版时,您可以使用所有的 SoftEther VPN Server 的功能,但用户协议禁止以下的使用。 +S_INFO_3 通过 VPN Server 的商业目的旅行的通迅中使用。 +S_INFO_4 请注意,如果软件基于上述禁止使用的情况下被使用,这样就违反了 SoftEther VPN Server 用户协议。一旦你取得了 SoftEther VPN Server 的定期产品许可证,上述限制即可解除。关于常规产品版本的详细信息,请访问 www.softether.com。\r\n如果该服务器在上述描述的情况下被使用,请通过我们的网站 www.softether.com 联系我们。请注意: 当连接到 VPN Server 的免费版,此窗口将出现。当使用除免费版以外的其他们版本时,此窗口不出现。\n\n注意: 除了这个通知窗口,免费版软件和产品版软件之间没有任何差别。 +B_HIDE 下次隐藏此窗口(&H) +IDCANCEL 确定(&O) + + +PREFIX D_CM_SETTING +CAPTION 切换 SoftEther VPN Client 工作模式 +STATIC1 您可以使用 SoftEther VPN Client 的“标准模式”或“简单模式”。要切换到另一种模式,勾选下面相应的复选框。 +R_NORMAL 标准模式(&N) +R_EASY 简单模式(&E) +STATIC2 当使用“标准模式”时,您可以进行 SoftEther VPN Client 软件提供的所有操作。我们建议一般用户和系统管理员使用此模式。 +STATIC3 “简单模式”只允许最常用的操作,如连接到 VPN Server。我们建议初级用户使用这种模式。 +STATIC4 通过使用设置锁,您可以通过使用一个在 SoftEther VPN Client 注册的连接设置连接到一个 VPN Server ,但这样做,您无法变更连接设置的参数、创建一个新的连接设置或者删除一个连接设置。 +R_LOCK 启用设置锁(&L) +S_PASSWORD1 您可以指定一个密码。下次禁用设置锁时将被要注输入该密码。 +S_PASSWORD2 密码(&P): +S_PASSWORD3 确认(&C): +IDOK 确定(&O) +IDCANCEL 取消 +S_VGS2 您可以配置 VPN Gate 学术服务设置。 +B_VGS VPN 和门户服务设置 (&G)... + + +PREFIX D_CM_EASY +CAPTION SoftEther VPN Client 简易管理器 (Developer Edition) +B_MODE 切换运行模式(&M) +IDCANCEL 关闭(&C) +B_STATUS 查看连接模式(&S) +B_VGC VPN Gate 学术项目 + + +PREFIX D_SM_SETUP +CAPTION SoftEther VPN Server / Bridge 简单安装 (Developer Edition) +S_TITLE SoftEther VPN Server / Bridge 简单安装 (Developer Edition) +IDC_STATIC_1 通过使用此安装,您可以为以下使用和目的轻松地安装 SoftEther VPN Server 或 VPN Bridge。退出安装后,您可以使用 VPN Server 管理器自由配置更高级的设置。 +S_BOLD 选择你要构建的 VPN Server 类型。可以一起选择多种类型。 +C_REMOTE 远程访问 VPN Server (&R) +S_REMOTE_1 远程访问 VPN Server 允许 VPN Client 计算机远程访问现有的以太网段,如公司局域网。\n\n连接到 VPN Server 的任何 VPN Client 都能访问到网络,就像他们直接的、物理的连接到网络一样。 +C_SITE 站点到站点 VPN Server 或 VPN Bridge(&S) +S_SITE_1 站点到站点 VPN 是一种连接两个或多个远程以太网的 VPN 配置。\r\n每个站点连在一起,并且在二层成为同一网段。这使得每个站点的所有计算机像是在同一网络中一样可以相互通信。 +S_SITE_2 选择这个 VPN Server 的作用: +C_CENTER 从其他站点接受连接 VPN Server (中心) (&C) +C_EDGE 每个站点(站点端)的 VPN Server 或 VPN Bridge (&E) +C_OTHER VPN 的其他高级配置 +S_OTHER 如果你计划构建具有高级功能的 VPN 系统,如群集功能和虚拟 3 层交换功能,请选择本项。 +IDOK 下一步(&N) +IDCANCEL 关闭(&C) + + +PREFIX D_SM_SETUP_HUB +CAPTION 简单安装-决定虚拟 HUB 名称 +IDC_STATIC_1 您必须至少在 VPN Server 上创建一个虚拟 HUB。以您喜欢的名字命名新的虚拟 HUB。 +IDC_STATIC_2 虚拟 HUB 名(&N): +IDOK 确定(&O) +IDCANCEL 取消 + + +PREFIX D_SM_SETUP_STEP +CAPTION VPN 简单安装任务 +IDC_STATIC_1 为了完成 VPN Server / VPN Bridge 的安装,您必须完成以下任务。 +S_1_1 步骤 1. 创建一个用户来接受 VPN 连接。 +S_1_2 当此 VPN Server 接受远程访问 VPN ,或接受从其他站点来的连接成为中央站点到站点 VPN Server 时,创建用户接受 VPN 连接。 +B_USER 创建用户 +S_2_1 步骤 2. 定义一个到目标 VPN Server 的连接 +S_2_2 当此 VPN Server 被安装在一个站点到站点 VPN 的特定的站点(端) 上时,您必须制定接受连接的中心 VPN Server 的地址,并建立到中央 VPN Server 的连接。 +B_CASCADE 配置连接设置(&C) +S_3_1 3. 设置本地网桥 +S_3_2 对于站点到站点 VPN ,使用本地桥功能连接 VPN 的虚拟以太网段与本地端的物理以太网段之间的网桥。 选择可以提供桥接到 VPN 的现有以太网设备(网络适配器)。 +IDCANCEL 关闭(&C) +IDC_STATIC_8 一旦必须的设置配置完毕,单击“关闭”。VPN Server / VPN Bridge 的高级管理工具将会出现。然后您可以配置你希望的任何高级设置。 +B_SECURENAT 配置 SecureNAT + + +PREFIX D_CPU64_WARNING +CAPTION SoftEther VPN 64 位版本信息 +S_BOLD 当前安装的 SoftEther VPN 软件是 32 位版本,但正在运行的 Windows 操作系统是 64 位版本。 +S_INFO 您可以在 Windows 64 位版本上运行 SoftEther VPN 软件 32 位版本,但这将运行 Windows 的 32 位模拟器,并导致性能降低。\r\n也有一些功能不支持的可能性。 我们强烈建议您当在 64 位 Windows 运行它时,安装并使用 SoftEther VPN 软件的 64 位版本。\r\n您可以从 http://selinks.org/ 下载 SoftEther VPN 软件的 64 位版本。此对话框将在 30 秒后自动关闭。 +IDOK 确定(&O) + + +PREFIX D_ONCEMSG +CAPTION TITLE +C_DONTSHOWAGAIN 不再显示此消息(&D) +IDCANCEL 确定(&O) + + +PREFIX D_CONNECT +IDCANCEL 取消 + + +PREFIX D_SM_IPSEC +CAPTION IPsec / L2TP / EtherIP / L2TPv3 设置 +S_TITLE IPsec / L2TP / EtherIP / L2TPv3 服务器设置 +S_3 在 VPN Server 上的虚拟 HUB 可以接受从兼容 L2TP 的个人电脑, Mac OS X 和智能手机的远程访问 VPN 连接, 也可以接受 EtherIP / L2TPv3 站点到站点的 VPN 连接。 +S01 L2TP 服务器 (远程访问 VPN Server 功能) +S02 从智能手机诸如 iPhone, iPad 和 Android, 还有从Mac OS X 和 Windows 内建的 VPN 客户端的 VPN 连接都是可以接受的。 +R_L2TP_OVER_IPSEC 启用 L2TP 服务器功能 (L2TP over IP&sec) +S03 使来自 iPhone, iPad, Android, Windows 和 Mac OS X 的 VPN 连接可以接受。 +R_L2TP_RAW 启用 L2TP 服务器功能 (没加密的 RAW L2TP)(&L) +S04 支持使用 L2TP 而无 IPSec 加密的特殊 VPN 客户端。 +S_1 默认虚拟 HUB 以防遗漏用户名上的 HUB 名称 (&H): +S_2 用户应指定他们的用户名, 如 "用户名@目标虚拟 HUB 名" 连接到此 L2TP 服务器。\r\n如果虚拟 HUB 的名称被遗漏, 以下 HUB 将作为目标被使用。 +S05 EtherIP / L2TPv3 服务器功能 (站点到站点 VPN 连接) +S06 兼容 EtherIP / L2TPv3 over IPsec 的路由器产品 可以连接到 VPN Server 上的虚拟 HUB, 并建立 2 层 (以太网) 桥接。 +R_ETHERIP 启用 EtherIP / L2TPv3 over IPsec 服务器功能(&E) +B_DETAIL EtherIP / L2TPv3 详细设置(&D) +S07 IPsec 通用设置(&C) +S_PSK IPsec 预共享密钥(&P): +S_PSK2 IPsec 预共享密钥也被称为 "PSKs" 或 "秘钥"。用 8 个 ASCII 字符指定, 并让所有的 VPN 用户都知道。 +IDOK 确定(&O) +IDCANCEL 取消 + + +PREFIX D_SM_ETHERIP +CAPTION EtherIP / L2TPv3 服务器详细设置 +S_TITLE EtherIP / L2TPv3 服务器详细设置 +S01 兼容EtherIP / L2TPv3 over IPsec 的路由器产品 可以连接到 VPN Server 上的虚拟 HUB , 并建立 2 层 (以太网) 桥接。例如,思科路由器,NEC IX 系列和 IIJ SEIL 路由器作为兼容的 VPN 路由器, 推荐使用。 +S02 为了接受 EtherIP / L2TPv3 协议, 定义适当的 EtherIP / L2TPv3 客户端设置, 以事先确定 EtherIP / L2TPv3 兼容路由器的客户端站点。EtherIP / L2TPv3 客户端设置必须有相应的 IPSec Phase 1 ID。 +S_BOLD 在 IPSec Phase 1 ID 和虚拟 HUB 之间的通信表(&T): +B_ADD 添加(&A) +IDOK 编辑(&E) +B_DELETE 删除(&D) +IDCANCEL 退出(&X) + + +PREFIX D_SM_ETHERIP_ID +CAPTION EtherIP / L2TPv3 over IPsec 客户端设置 +S01 以下虚拟 HUB 连接设置将仅应用于 当 EtherIP / L2TPv3 over IPsec 客户端试图连接一个与下面指定值完全相同的 ISAKMP (IKE) Phase 1 ID 的 VPN Server 时。 +S02 ISAKMP Phase 1 ID(&I): +S03 虚拟 HUB(&H): +S04 用户名(&U): +S05 密码(&P): +S06 注意: 用户名和密码必须与在虚拟 HUB 注册时完全相同。EtherIP / L2TPv3 用户将被视为以上述用户信息的身份连接虚拟 HUB。 +IDOK 确定(&O) +IDCANCEL 取消 +S07 (ID 必须与 EtherIP / L2TPv3 客户端的配置 ID 完全相同。如果 EtherIP / L2TPv3 客户端使用 IP 地址作为 Phsae 1 ID, 您可以指定 IP 地址并且字符也可以做为 ID。您可以指定 “*” (星号)作为通配符来匹配任何不匹配其他明确规则的客户端。 + +PREFIX D_SM_OPENVPN +CAPTION OpenVPN / MS-SSTP 设置 +S_TITLE OpenVPN / MS-SSTP VPN 克隆 Server 功能设置 +S_1 本 VPN Server 具有 OpenVPN 技术责任有限公司的 OpenVPN 软件产品的克隆功能。\r\n\r\n任何 OpenVPN Client 都可以连接到此 VPN Server。 +R_OPENVPN 启用 OpenVPN 克隆 Server 功能(&O) +S_TOOL OpenVPN Client 的示例文件生成工具 +S_TOOL2 创建一个 OpenVPN Client 配置是一项艰难的工作。您可以使用此工具来生成一个合适的 OpenVPN Client 配置文件。生成的配置示例文件可马上应用。本来,OpenVPN Client 会要求客户手写一个很难的配置文件。这个工具就可以帮助您创建一个有用的配置样本。您所需要为 OpenVPN Client 生成的配置文件就是点击以下按钮。 +B_CONFIG 为 OpenVPN Client 生成配置样本文件(&C) +S_2 Microsoft SSTP VPN 克隆服务器功能 +S_3 该 VPN Server 有微软公司的 Windows Server 2008 / 2012 内建的 MS-SSTP VPN Server 的克隆功能。\r\n在 Windows Vista / 7 / 8 / RT / 10 中内建的 MS-SSTP 客户端能连接此 VPN Client。 +R_SSTP 开启 &MS-SSTP VPN 克隆 Server 功能 +S_SSTP VPN Server 端 SSL 证书的 CN (通用名)值必须与该客户端指定的主机名吻合,并且该证书必须在该客户端的可信列表中。详细内容请参考微软的文档。 +S_4 指定用户名连接到虚拟 HUB 的方式,和通过使用克隆服务器进行默认 HUB 的选择规则,与 IPsec 服务器功能是一样的。 +B_IPSEC IPsec 服务器配置(&P) +S_13 OpenVPN 克隆服务器功能 +IDOK 确定(&O) +IDCANCEL 取消 + + +PREFIX D_SM_DDNS +CAPTION 动态 DNS 功能 +S_TITLE 动态 DNS 功能 +S_BOLD 此 VPN Server 有内建的动态 DNS 功能 +S_1 此动态 DNS 为该 VPN Server 分派了一个唯一的永久的 DNS 主机名。您可以用此主机名来指定本 VPN Server 来设置 VPN Client 和 VPN Bridge 。您不需要注册并持有一个域名。 +S_22 同时,如果你的 ISP 分派给你一个动态(不固定) IP 地址,相应的动态 DNS 主机名的 IP 地址也会自动改变。它使您在仅使用一个动态的 IP 地址的情况下保持 VPN Server 的运行。\r\n因此,你不再需要每月花钱以保持静态全球 IP 地址。 +S_3 另外,本 VPN Server 版本支持'NAT 穿透'功能。如果 VPN Server 在 NAT 内,并且被分配了一个私有 IP 地址,则您可以完全不用事先对 NAT 进行任何特殊设置,而从因特网端连接该 VPN Server。 +S_4 当前状态(&S) +S_STATUS3 分配的动态 DNS 主机名 (&H): +B_HINT 提示 +S_STATUS4 全球 IPv4 地址(&4): +S_STATUS5 全球 IPv6 地址(&6): +S_5 修改设置: +S_STATUS6 改变动态 DNS 主机名(&C): +S_STATUS7 主机名只能是字母数字和破折号“-”。至少 3 位。\r\n您可以随时更换名字。 +IDOK 设置上述主机名(&A) +B_RESTORE 恢复(&R) +S_2 如果您没有连接到 IPv6 网络,“ 全球 IPv6 地址“将会显示一个错误。\r\n少数国家或地区可能会禁止动态 DNS 服务。 +IDCANCEL 退出(&X) +B_DISABLE 禁用动态 DNS 功能(&D) +B_PROXY 通过代理服务器连接(&P)... +S_STATUS8 DNS 钥: +B_HINT2 提示 + + +PREFIX D_SM_SPECIALLISTENER +CAPTION VPN over ICMP / DNS 功能设置 +S_TITLE VPN over ICMP / DNS 功能 +S_1 VPN over ICMP / DNS 功能 +S_2 即使有防火墙或者屏蔽 TCP/IP 连接的路由器,您也可以只用 ICMP 或者 DNS 数据包建立一个 VPN。您需要事先启用如下功能。 +R_OVER_ICMP 启用 VPN over ICMP 服务器功能(&I) +R_OVER_DNS 启用 VPN over DNS 服务器功能(使用 UDP 53 号端口)(&D) +IDOK 确定(&O) +IDCANCEL 取消 +S_3 要求 VPN Client / VPN Bridge 内部版本 4.0 或更高。 +S_4 注意:仅在紧急情况下使用此功能。它是当防火墙或者路由器配置错误屏蔽 TCP/IP,但是却没有屏蔽 ICMP 或者 DNS 时,使用是有帮助的。它不是为长期稳定使用。 + +PREFIX D_SM_REDIRECT +CAPTION HTTP URL 重定向设置 +S_1 下面指定的 URL 将被强制回复给客户端,作为通过此虚拟 HUB 匹配此访问列表条目条件的 TCP 连接请求数据包的回应。\r\n\r\n要使用此设置,当网页浏览器试图访问特定的 IP 地址时,您可以强行让 VPN Client 计算机的网络浏览器显示该指定网站。 +S_2 指定一个 URL,重定向到 +S_BOLD2 该 URL 重定向到(&U): +S_3 例子: +S_4 单一 URL 重定向: +S_5 高级 URL 重定向: +B_HINT 高级 URL 重定向功能的用途(&U) +S_6 标题 +S_BOLD 该功能适用于 TCP/IP 专家管理员。阅读如下说明并小心设置。 +S_7 在数据包的目标会话匹配访问列表条目的目标用户名或组名的情况下,重定向规则无效。 +S_8 如果匹配条件,非 TCP 数据包重定向规则被忽略,。 +S_9 该重定向规则总是对 HTTP 重定向信息回应。(对 80 端口无限制)。如果您只想应用于 80 端口,在访问列表条目的条件中,将目标端口设为 80 即可。 +S_10 如果这个规则重定向的结果是,客户端试图连接这个已重新定向的 URL,并且这个新的请求又与该规则吻合,则重定向结果将会再次回复这个新的请求。这样就会形成一个无穷的重定向循环。 +IDOK 确定(&O) +IDCANCEL 取消 +S_11 高级重定向功能可以向重新定向的 CGI 提供 VPN 会话信息。 + +PREFIX D_SW_WELCOME +CAPTION D_SW_WELCOME +S_WELCOME SoftEther VPN 在日本筑波大学开发的免费软件。具有终极兼容许多设备的高性能 VPN。支持 Windows、Mac、智能手机、平板电脑 (iPhone、iPad、安卓、Windows RT) 和思科或其他 VPN 路由器。SoftEther VPN 也接受 OpenVPN 和 MS-SSTP VPN 客户端。 +S_TITLE 非常强大的开源免费 VPN 软件。 + +PREFIX D_SW_MODE +CAPTION D_SW_MODE +R_SYSTEM 系统模式(推荐的)(&S) +R_USER 用户模式(&U) +S_1 正常安装本 VPN 软件。要求管理员权限。 +S_USER 以普通用户权限安装本 VPN 软件。不需要管理员权限。有些诸如本地桥功能是不能使用的。只有在"%s"用户登入 Windows 时,才会运行本软件. +S_2 SoftEther VPN 可以有两种方法安装。\r\n\r\n通常请选择系统模式。\r\n\r\n如果您由于一些原因不能使用管理员权限,您可以选择用户模式来继续安装。 + + +PREFIX D_SW_NOT_ADMIN +CAPTION D_SW_NOT_ADMIN +S_INFO 登入 Windows 的"%s"用户不具有管理员权限。\r\n\r\n退出登入 Windows,用有管理员权限的用户名重新登入,如果想继续安装,请重启安装向导。 +S_INFO6 点击完成,退出安装向导。 +S_INFO2 如果您不能使用管理员权限,您可以选择用户模式安装。\r\n要以用户模式安装,点击返回。 + + +PREFIX D_SW_COMPONENTS +CAPTION D_SW_COMPONENTS + + +PREFIX D_SW_EULA +CAPTION D_SW_EULA +S_1 请您仔细阅读最终用户许可协议。 +B_AGREE 我同意最终用户许可协议。 + + +PREFIX D_SW_WARNING +CAPTION D_SW_WARNING +S_1 SoftEther VPN 软件有超乎想象的、强大的通信能力。请在使用前仔细阅读重要注意事项。 + + +PREFIX D_SW_DIR +CAPTION D_SW_DIR +S_INFO 请指定安装 %s 的目录. +R_CUSTOM 指定目录(&S) +S_DEST 目录(&D): +B_BROWSE 浏览...(&B)... +R_SHOWCUSTOM 为网络专家使用的高级安装选项(&A) +R_FOR_SYSTEM 在本电脑的 Windows 系统上安装(&W) +R_FOR_USER 在用户 "%s" 的环境只上安装 +S_WARNING 注意:这是不推荐的。用户"%s"退出 Windows 后,%s 将停止。本地桥功能和 L2TP/IPsec 功能 (支持 Mac 和智能手机)也不能再使用了。 + + +PREFIX D_SW_READY +CAPTION D_SW_READY +S_INFO %s 安装已就绪。 +S_INFO7 点击继续执行安装。 + + +PREFIX D_SW_PERFORM +CAPTION D_SW_PERFORM +S_INFO %s 安装正在进行。\r\n请耐心等待... +S_INFO8 SoftEther VPN 是日本政府的研究和开发项目的一项工作,由日本的经济、贸易和工业部资助,由信息化推进机构管理。 + + +PREFIX D_SW_ERROR +CAPTION D_SW_ERROR +S_INFO 出现错误,%s 安装中止。\r\n\r\n如果你想继续,请重启安装向导。 + + +PREFIX D_SW_FINISH +CAPTION D_SW_FINISH +S_INFO %s 安装过程已成功完成。 +S_INFO8 SoftEther VPN 是日本政府的研究和开发项目的一项工作,由日本的经济、贸易和工业部资助,由信息化推进机构管理。 + + +PREFIX D_SW_UNINST1 +CAPTION D_SW_UNINST1 +S_WELCOME 安装向导可以从电脑中卸载 %s。\r\n\r\n若想开始卸载,点击下一步 +S_TITLE %s 卸载向导 + + +PREFIX D_SW_EASY1 +CAPTION D_SW_EASY1 +S_WELCOME 在一个企业里为许多计算机安装和设置 VPN Client 是很辛苦的工作。 +S_TITLE 什么是 SoftEther VPN Client 简单安装程序? +S_WELCOME2 简单安装程序创建器是为公司管理员使用的一个工具。您可以通过使用简单安装程序创建器用嵌入的某个具体 VPN 连接设置来创建一个 VPN Client 安装程序。个人用户还可以开发此工具。 +S_WELCOME3 通过使用文件服务器或者 e-mail,可以将一个已创建的简单安装程序分发给公司的员工。如果用户运行简单安装程序, VPN Client 会被安装、 VPN 连接设置会被导入完成,并且 VPN 连接也会自动启动。 + + +PREFIX D_SW_EASY2 +CAPTION D_SW_EASY2 +S_BOLD1 指定一个嵌入 VPN 连接设置文件(.vpn)。 +S_1 请指定一个 VPN 连接设置文件 (.vpn)来嵌入到简单安装程序。您可以在 VPN Client 管理工具中,在目标连接设置的右击菜单中通过单击输出 VPN 连接设置来输出设置文件。 +S_18 连接设置(&S): +B_BROWSE_SETTING 浏览...(&B) +B_DELETE_SENSITIVE 在连接设置文件中删除用户名和密码(&E) +S_BOLD2 指定一个要生成的 EXE 文件名 +S_3 这工具将会输出一个包含简单安装工具的 EXE 文件(可执行文件)。请指定要生成的输出文件名。 +S_19 保存为(&A): +B_BROWSE_OUT 浏览...(&B) +B_EASYMODE 安装时将 VPN Client 管理器设置成简单模式(&E) + + +PREFIX D_SW_WEB1 +CAPTION D_SW_WEB1 +S_WELCOME 您可以创建一个 SoftEther VPN Client Web 安装工具,并且将它上传到公司的 Web 服务器。用户打开网页就能自动安装 SoftEther VPN Client,您也可以设置自动输入和快速启动一个已内建的 VPN 连接设置。 +S_TITLE SoftEther VPN Web 安装工具是什么? +S_WELCOME2 已生成的 Web 安装工具可以当做 HTML 文件放在内联网 Web 服务器上。如果一个公司员工连接到该 HTML 文件的 URL 上这个 SoftEther VPN Client 安装工具就会被执行。 +S_WELCOME3 使用 ActiveX 控制。支持在 Windows 2000 或更高版本上的 Internet Explorer 5.0 或更高版本的浏览器。不支持其他浏览器或更低级的操作系统(如 Windows 98) 。 + + +PREFIX D_SW_WEB2 +CAPTION D_SW_WEB2 +S_BOLD1 指定一个要嵌入的 VPN 连接设置文件(.vpn file) +S_1 请指定一个要嵌入到 Web 安装工具上的 VPN 连接文件(.vpn) 。您可以在 VPN Client 管理器上,通过在目标连接设置的右击菜单中点击输出 VPN 连接设置来输出设置文件。 +S_18 连接设置(&S): +B_BROWSE_SETTING 浏览…(&B) +B_DELETE_SENSITIVE 在连接设置文件中删除用户名和密码(&E) +S_BOLD2 指定一个要生成的输出文件名 +S_3 这个工具会输出一个 ZIP 文件 (档案文件),该文件包含 HTML 文件和一个应该放置在 Web 服务器上的 CAB 文件。请指定生成的输出文件名。 +S_19 保存为(&A): +B_BROWSE_OUT 浏览…(&B) +B_EASYMODE 当安装时,将 VPN Client 管理器设置成简单模式(&E) + + +PREFIX D_UPDATE_NOTICE +CAPTION 升级 %s +IDOK 显示升级的信息(&S) +B_CONFIG 设定升级(&C) +IDCANCEL 不要再显示此信息(&D) +S_INFO 已有 %s 的最新版本。您现在可以下载和升级。 +S_PRODUCT 软件: +S_CURRENT 目前的版本: +S_CURRENT_STR Ver %u.%02u.%04u%s +S_LATEST 最新版本: +S_LATEST_STR Ver %S%s + + +PREFIX D_UPDATE_CONFIG +CAPTION 升级提示的配置 +S_INFO 当新版本将要发布时,请定期查询 %s 的新版本和弹出提示窗口。\r\n\r\nHTTPS 数据包将会用在本电脑和位于日本驻波的 SoftEther 升级服务器之间,用于查询有无升级信息。个人信息不会外泄。 +S_TITLE %s 升级以及提示设置 +S_ENABLE 启用升级查询(&E) +S_DISABLE 禁用升级查询(&D) +IDCANCEL 关闭(&C) + + +PREFIX D_SM_VMBRIDGE +CAPTION 虚拟机本地桥说明 +S_TITLE 在虚拟机上使用本地接功能 +S_1 据检测,VPN 服务器可能运行在 VM(虚拟机)上,如 VMware 或 Hyper-V。请仔细阅读下面的说明。如果你不使用虚拟机,请忽略此消息。 +S_2 一些虚拟机默认禁止网络适配器的“混杂模式”(Promiscuous Mode / MAC Address Spoofing)。\r\n\r\n如果混杂模式 (Promiscuous Mode / MAC Address Spoofing) 被管理禁用,在 VPN 服务器的虚拟 HUB 与物理电脑上的物理网络适配器之间的本地桥功能不能很好地工作。通过使用虚拟机的配置工具,你应该允许混杂模式 (Promiscuous Mode / MAC Address Spoofing)。\r\n\r\n有关详细信息,请参阅您的 VM 文件。如果它是一个共享的虚拟机,且由其他人管理,请向管理员请求允许使用你的虚拟机的混杂模式 (Promiscuous Mode / MAC Address Spoofing)。 +S_BOLD 说明 +IDCANCEL 确定(&O) + + +PREFIX D_SM_AZURE +CAPTION VPN Azure 服务设置 +S_TITLE VPN Azure 云 VPN 服务(免费) +S_1 VPN Azure 可以更容易地建立一个 VPN 会话,从你家里的计算机到你办公室的计算机。当一个 VPN 连接建立了,您可以访问您公司专用网络上的任何其他服务器。 +S_2 在办公室的计算机(VPN 服务器)上,你并不需要一个全球 IP 地址。它可以在防火墙或 NAT 后面工作。无需网络管理员的配置。您可以在您的家用电脑使用 Windows 内置的 SSTP VPN 客户端。 +S_3 VPN Azure 是一个云 VPN 服务由 SoftEther 公司经营。 VPN Azure 是免费的,可提供给任何人。按右边的按钮可以查看详细信息和如何使用的说明。 +B_BOLD VPN Azure 设置 +R_ENABLE 启用 VPN Azure(&E) +R_DISABLE 禁用 VPN Azure(&D) +S_HOSTNAME_BORDER 当前 VPN Azure 主机名 +S_HOSTNAME_INFO VPN Azure 主机名与动态 DNS 主机名相同,但改变的域名后缀为“vpnazure.net”。 +B_CHANGE 变更主机名(&H) +B_WEB 如何使用 VPN Azure\r\n(访问网络) +IDCANCEL 确定(&O) + + +PREFIX D_SM_PROXY +CAPTION 通过代理服务器连接 +STATIC9 您可以通过代理服务器连接 +STATIC10 代表类型: +R_DIRECT_TCP 直接 TCP/IP 连接(无代理)(&D) +R_HTTPS 通过 HTTP 代理服务器连接(&T) +R_SOCKS 通过 SOCKS4 代理服务器连接(&K) +R_SOCKS5 通过 SOCKS5 代理服务器连接(&K) +B_PROXY_CONFIG 代理服务器设置(&R) +IDOK 确定(&O) +IDCANCEL 取消 + + +PREFIX D_VGC_LIST +CAPTION SoftEther VPN 客户端的 VPN Gate 学术试验项目插件 +S_TITLE VPN Gate 公共 VPN 中继服务器 +S_INFO1 通过使用 VPN 连接经由全世界志愿者提供的公共 VPN 服务器获得自由访问互联网。绕过您的本地故障防火墙的数据包拦截,并安全地隐藏你的 IP 地址。 +IDOK 连接到 VPN 服务器(&C) +B_PROXY 代理设置(&P) +S_VLAN 虚拟网络适配器: +B_WEB VPN Gate 学术\r\n官方网站 +B_REFRESH 刷新列表(&R) +S_REFRESH 刷新列表... +S_RESEARCH 日本筑波大学的一个学术项目 +S_INFO9 带有更快线路速度值 (Mbps) 和较小 Ping 结果的 VPN 服务器让你更加舒适。如果你使用国外的 VPN 服务器,您可以浏览从您所在国家无法访问的网站。 + + +PREFIX D_VGC_PROTOCOL +CAPTION 选择 VPN 协议来连接 +S_TITLE 公共 VPN 中继服务器 "%S" (%S) 支持 TCP 和 UDP 作为 VPN 协议。 +S_INFO 选择偏爱的 VPN 协议来使用以连接 VPN 服务器 "%S" (%S)。一般情况下,TCP 协议很容易通过防火墙。只有当 TCP 失败时,再尝试使用 UDP 协议。 +R_TCP 使用 &TCP 协议 (Ethernet over HTTPS VPN) (推荐) +R_UDP 使用 &UDP 协议 (Ethernet over UDP VPN) +IDOK 确定(&O) +IDCANCEL 取消 + + +PREFIX D_VGS_CONFIG +CAPTION VPN Gate 服务控制面板 +R_ENABLE 启用 VPN Gate 中继服务和作为志愿者加入 VPN Gate 研究(&E)。 +S_TITLE 加入 VPN Gate 的学术研究项目吗? +S_INFO1 VPN Gate 是一个以 "分布式的公共 VPN 中继服务器" 技术为研究的学术实验,日本筑波大学研究生院运作的。VPN Gate 客户端用户可以连接到 VPN Gate 公共 VPN 中继服务器上运行的服务,并通过 VPN 中继服务器享受无限制的上网。 +S_INFO9 当一个 VPN Gate 客户端用户访问互联网上的服务器,源 IP 地址将被替换为中继公共 VPN 服务器的 IP 地址。因此,VPN Gate 客户端用户将能够顺利地浏览海外网站,即使用户的本地防火墙因未知原因发生故障,无法通过这样的访问。 +S_WARNING 如果您选中上述复选框,然后按确定,VPN Gate 中继服务将在这台电脑上激活。结果,任何 VPN Gate 客户端将能够通过 VPN Gate 中继服务对互联网进行通信。它是安全的,即使你的计算机是专用网络 (如企业网),因为任何私有 IP 地址的访问不会被允许经由 VPN Gate 中继服务通过。 +B_OPTION VPN Gate 服务选项设置(&O)... +IDOK 确定(&O) +IDCANCEL 取消 +B_WEB 浏览 http://www.vpngate.net/ ... + + +PREFIX D_VGS_OPTION +CAPTION VPN Gate 服务选项 +S_TITLE VPN Gate 服务选项 +S_1 这台计算机将成为一个公共 VPN 服务器。请填写运营商的服务器信息。这些信息将被公布在 www.vpngate.net 的名单上和其他相关服务。联系地址也将被用于从 VPN Gate 学术项目运营商的联系。 +S_2 运营商: +S_3 服务器的运营商(&O): +S_19 (最多 64 个字母) +S_20 不良内容举报地址\r\n(e-mail 地址等) (&A): +S_21 (最多 64 个字母) +S_22 给用户的消息(&M):\r\n(最多 128 个字母) +S_23 该消息将显示在 VPN Gate 服务器的列表中。输入一个令人愉快的消息,让用户感到高兴。 +S_24 VPN 设置: +R_LOG 保存 VPN 数据包日志 (推荐) (&S) +R_2WEEKS 两周后自动删除或存档数据包日志编码 (推荐) (&T) +R_PERMANENT 使数据包日志永久占用磁盘空间 (&P) +R_L2TP 启用 L2TP/IPSec VPN 服务器功能 (推荐) (&L) +S_25 允许 Mac OS X、iPhone、iPad 和 Android 客户端进行 VPN 连接。 +B_MESSAGE 在 VPN 客户端和屏幕上弹出您的广告消息(&S)... +IDOK 确定(&O) +IDCANCEL 取消 + + +PREFIX D_VGS_WARNING +CAPTION 在连接 VPN Gate 学术实验前的注意事项 +S1 VPN Gate 学术实验服务是作为日本筑波大学研究生院的一个研究项目运营的。该服务受制于日本法律。其他国家的法律不受我们关注也不承担责任。 +S2 从本质上讲,在世界上有近 200 个国家,都有不同的法律。不可能在软件发布前去验证每一个国家的法律和法规,并使我们的软件符合所有国家的法律。如果用户在一个特定的国家使用 VPN Gate 服务,损坏公务人员的权力,服务或软件的开发者将永远不会负责恢复或补偿等损害或刑事责任。 +S3 通过使用本软件和服务,用户有自己的义务必须遵守所有相关的法律和规则。用户将完全承担任何损失和使用本软件及服务导致的责任,无论日本领土以内还是以外。 +S4 如果你不同意也不理解上述警告,不要使用任何 VPN Gate 学术实验服务功能。 +S5 注: VPN Gate 仅仅是学术目的的一个研究项目。VPN Gate 是作为 SoftEther VPN 的一个插件被开发的。然而,VPN Gate 的每一部分都是在筑波大学的这一研究项目被开发的。VPN Gate 的任何部分都不是 SoftEther 公司开发的。VPN Gate 研究项目不是由 SoftEther 公司引导、经营,推广和保证的。 +R_NEVER 请不要再次显示此消息(&S) +B_WEB 访问 VPN Gate 和网站 ... +IDOK 同意(&A) +IDCANCEL 不同意(&D) +S_BOLD 注意! 不要在 VPN 通讯禁止的国家使用 VPN Gate 服务。 + + +PREFIX D_NM_PUSH +CAPTION 编辑该静态路由表以推送 +S1 这个虚拟 DHCP 服务器可以推送带 DHCP 应答消息的无类静态路由 (RFC 3442) 至 VPN 客户端。 +S2 VPN 客户端是否能够识别无类静态路由 (RFC 3442) 取决于目标 VPN 客户端软件。SoftEther VPN 客户端和 OpenVPN 客户端都支持无类静态路由。在 L2TP/IPSec 和 MS-SSTP 协议上,兼容性取决于客户端软件的实施。 +S3 如果你清除了虚拟 DHCP 服务器选项的默认网关字段,您就可以实现拆分隧道。在客户端一侧,为了使用拆分隧道, L2TP/IPSec 和 MS-SSTP 客户端需要配置为不创建默认网关。 +S4 您还可以通过现有的外部 DHCP 服务器推送无类静态路由 (RFC 3442)。在这种情况下,在 SecureNAT 禁用虚拟 DHCP 服务器功能,在这一屏幕上你不需要设置无类路由。 +S5 编辑该静态路由表以推送 +S6 例如: 192.168.5.0/255.255.255.0/192.168.4.254, 10.0.0.0/255.0.0.0/192.168.4.253\r\n\r\n用逗号或空格字符来拆分多条目 (最多 64 条目)。\r\n每个条目必须以 "IP 网络地址 / 子网掩码 / 网关 IP 地址" 的格式来指定。 +S7 请参阅 RFC3442 以了解无类路由。 +IDOK 确定(&O) +IDCANCEL 取消 + + + + +########################################################################### +# # +#软件菜单的字符串数据 # +# # +########################################################################### + + +# 连接管理器菜单 +PREFIX CM_MENU +#“连接” 菜单 +CMD_TOP_CONNECT 连接(&C) +CMD_CONNECT 连接(&O)\tEnter +CMD_STATUS 查看状态(&S)...\tCtrl+S +CMD_DISCONNECT 断开(&I)\tCtrl+D +CMD_DISCONNECT_ALL 断开所有(&A)\tCtrl+I +CMD_NEW 新 VPN 连接设置(&N)...\tCtrl+N +CMD_CLONE 复制(&C)\tCtrl+C +CMD_SHORTCUT 创建 VPN 连接快捷方式(&H)... +CMD_EXPORT_ACCOUNT 导出 VPN 连接设置(&X)... +CMD_IMPORT_ACCOUNT 导入 VPN 连接设置(&P)... +CMD_STARTUP 启动连接设置(&T)\tCtrl+T +CMD_NOSTARTUP 移除连接设置(&E) +CMD_RECENT 最近的 VPN Server(&V) +CMD_RENAME 重命名(&M)\tF2 +CMD_DELETE 删除(&D)\tDel +CMD_PROPERTY 属性(&R)...\tAlt+Enter +CMD_EXIT 关闭连接管理器(&O)\tAlt+F4 +CMD_QUIT 退出连接管理器程序(&X)\tAlt+Q +#“编辑” 菜单 +CMD_TOP_EDIT 编辑(&E) +CMD_SELECT_ALL 全选(&A)\tCtrl+A +CMD_SWITCH_SELECT 切换选择(&I) +#“查看”菜单 +CMD_TOP_VIEW 查看(&V) +CMD_STATUSBAR 显示状态栏(&S) +CMD_VISTASTYLE Windows Vista / 7 / 8 / 10 风格(&T) +CMD_SHOWPORT 在连接列表中显示端口(&P) +CMD_TRAYICON 显示任务托盘上的图标(&T) +CMD_ICON 图标(&I) +CMD_DETAIL 详细(&D) +CMD_GRID 显示边框(&G) +CMD_REFRESH 刷新(&R)\tF5 +#“虚拟局域网” 菜单 +CMD_TOP_VLAN 虚拟适配器(&L) +CMD_NEW_VLAN 新建虚拟网络适配器(&C)...\tCtrl+L +CMD_ENABLE_VLAN 启用虚拟网络适配器(&E)\tCtrl+E +CMD_DISABLE_VLAN 禁用虚拟网络适配器(&S)\tCtrl+B +CMD_DELETE_VLAN 删除虚拟网络适配器(&D)\tDel +CMD_REINSTALL 重新安装驱动程序(&U)...\tCtrl+U +CMD_WINNET 打开&Windows网络连接...\tCtrl+W +#“连接” 菜单 +CMD_TOP_SECURE 智能卡(&S) +CMD_SECURE_MANAGER 智能卡管理器(&M)...\tCtrl+G +CMD_SECURE_SELECT 选择一个智能卡使用(&S)... +#“工具” 菜单 +CMD_TOP_TOOL 工具(&T) +CMD_PASSWORD 设置密码(&P)...\tCtrl+P +CMD_TRUST 管理信任的 CA 证书列表(&T)\tCtrl+R +CMD_NETIF 网络设备状态(&N)... +CMD_TCPIP TCP 协议优化工具(&O)... +CMD_MMCSS Windows Vista / 7 / 8 / 10 的优化(&V)... +CMD_TRAFFIC 网络通信速度测试工具(&R)...\tCtrl+Q +CMD_CM_SETTING 切换运行模式(&M)... +CMD_LANGUAGE 语言设置(&L) +CMD_OPTION 选项(&O)...\tCtrl+O +#“语音”菜单 +CMD_TOP_VOICE 语音(&O) +CMD_VOIDE_NONE 关闭语音指南(&D) +CMD_VOICE_NORMAL 正常语音指南(&N) +CMD_VOICE_ODD 扩展语音指南(&O) +#“帮助”菜单 +CMD_TOP_HELP 帮助(&H) +CMD_ABOUT 关于(&A)... + + + + + + + + + + + + + + + + + +########################################################################### +# # +# 命令提示符字符串数据 # +# # +########################################################################### + +PREFIX NULL + +# 控制台系统总览 +CON_INFILE_ERROR 错误: 无法打开指定的输入文件 "%s"。 +CON_OUTFILE_ERROR 错误: 无法创建指定的输出文件 "%s"。 +CON_INFILE_START 在文件 "%s" 中写入命令将被使用代替键盘输入。 +CON_OUTFILE_START 该消息输出到控制台将被保存在文件 "%s"。 +CON_USER_CANCEL [EOF] +CON_UNKNOWN_CMD "%S": 命令未找到。\n您可以使用 "HELP" 命令来查看一个可用的命令列表。 +CON_AMBIGUOUS_CMD "%S": 命令名称是模糊的。 +CON_AMBIGUOUS_CMD_1 指定的命令名称匹配以下多个命令: +CON_AMBIGUOUS_CMD_2 请更严格地重新指定命令名称。 +CON_INVALID_PARAM 参数 "/%S" 已被指定。使用命令 "%S" 时,不可能指定此参数。输入 "%S /HELP" 来看被使用的参数清单。 +CON_AMBIGUOUS_PARAM "/%S": 参数名称是不明确的。 +CON_AMBIGUOUS_PARAM_1 指定的参数名称符合以下,被指定的做为命令 "%S" 参数的参数: +CON_AMBIGUOUS_PARAM_2 请更严格地重新指定参数名称。 + + +# 不明命令 +CMD_UNKNOWM 没有这个命令的说明。 +CMD_UNKNOWN_HELP 没有这个命令的详细描述。如果您想了解更多有关此命令的详细资料,请参阅手册或在线文档。 +CMD_UNKNOWN_ARGS 没有命令执行的例子。 +CMD_UNKNOWN_PARAM 没有这个参数的说明。 + + +# 控制台系统内使用的字符串 +CMD_HELP_1 您可以使用下面的 %u 命令: +CMD_HELP_2 参考每个命令的使用,输入 "命令名称 ?" 来查看帮助。 +CMD_EVAL_MIN_MAX 您必须指定从 %u 到 %u 的整数。 +CMD_PROMPT 输入一个值: +CMD_EVAL_NOT_EMPTY 规格不能为空白。 +CMD_EVAL_SAFE 该字符串包含不可用的字符。 +CMD_EVAL_INT 您必须指定一个不小于 1 的整数。 +CMD_HELP_TITLE 关于命令 "%S" 的帮助 +CMD_HELP_DESCRIPTION [目的] +CMD_HELP_USAGE [使用方法] +CMD_HELP_HELP [说明] +CMD_HELP_ARGS [参数] +CMD_PROMPT_PORT 输入端口号: +CMD_EVAL_PORT 端口号无效。指定一个范围是 1 到 65535 的端口号。 +CMD_CT_STD_COLUMN_1 项目 +CMD_CT_STD_COLUMN_2 价值 +CMD_CT_STD_COLUMN_3 说明 +CMD_PARSE_IP_SUBNET_ERROR_1_6 指定 "IPv6 地址/子网掩码" 格式。\n通过用冒号来分开这十六位进制的数值来指定 IPv6 地址,如如“ 2001:200:0:1::”。对于子网掩码,您可以指定用冒号分开的十六位进制数值,如 “ffff:ffff:ffff:ffff::”,或者您也可以用十进制数值指定子网掩码的比特长度,如 64。\n要指定一个独立主机,指定子网掩码为“ ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff”或 “128”。\n(例)\n2001:200:0:1::/64\n2001:200:0:1::/ffff:ffff:ffff:ffff::\n2001:200:0:1::5/12\n\n +CMD_PARSE_IP_SUBNET_ERROR_1 指定 "IPv4 地址/子网掩码" 格式。\n通过用小数点来分隔十进制数值来指定 IPv4 地址,如 “192.168.0.1”。对于子网掩码,您可以通过使用小数点分隔十进制数值来来指定,如 “255.255.255.0”,或者您也可以通过使用十进制数值来指定子网掩码的比特长度如 24。\n要指定一个独立主机,您可以指定子网掩码为 255.255.255.255 或 32\n(例)\n192.168.0.1/24\n192.168.0.1/255.255.255.0\n192.168.0.5/255.255.255.255\n\n +CMD_PARSE_IP_SUBNET_ERROR_2 指定的 IP 地址不是网络地址。 +CMD_PARSE_IP_SUBNET_ERROR_3 指定的 IP 地址不是网络地址前缀。 +CMD_EVAL_DATE_TIME_FAILED 日期和时间规格无效。\n日期和时间必须为相同的格式如 "2005/10/08 19:30:00",指定 6 个整数代表年/月/日 小时:分钟:秒,用斜线,空格和冒号分隔。年指定为 4 位数。 +CMD_PARSE_IP_MASK_ERROR_1_6 指定 "IPv6 地址/掩码" 格式。\n通过用冒号来分隔十六进制的数值来指定 IPv6 地址,如 “2001:200:0:1::”。对于掩码,您可以指定由冒号分隔的十六进制的数值,如 ffff:ffff:ffff:ffff::,或者您也可以用十进制数值来指定掩码的比特长度如 64。\n要指定一个独立主机,指定掩码为 “ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff ”或“128”。\n(例) \n2001:200:0:1::/64\n2001:200:0:1::/ffff:ffff:ffff:ffff::\n2001:200:0:1::5/12\n\n +CMD_PARSE_IP_MASK_ERROR_1 指定 "IPv4 地址/掩码" 格式。\n通过用小数点来分隔十进制数值来指定 IPv4 地址,如“192.168.0.1”。对于掩码,您可以指定用小数点分隔的十进制数值,如 “255.255.255.0”,或者您也可以用十进制值指定掩码的比特长度,如 24。\n要指定一个独立主机,指定掩码为 255.255.255.255 或 32\n(例) \n 192.168.0.1/24\n 192.168.0.1/255.255.255.0\n192.168.0.5/255.255.255.255\n\n + + + +# 通用信息 +CMD_MSG_INVALID_HOSTNAME 指定的主机名无效。 +CMD_MSG_OK 命令成功完成。 +CMD_MSG_ALLOW 允许 +CMD_MSG_DENY 拒绝 +CMD_MSG_INFINITE 无限 +CMD_MSG_ENABLE 启用 +CMD_MSG_DISABLE 禁用 +CMD_MSG_LOAD_CERT_FAILED 无法读取指定的 X.509 证书文件。 +CMD_MSG_SAVE_CERT_FAILED 无法写入 X.509 证书文件。 +CMD_ACCOUNT_COLUMN_NAME VPN 连接设置名称 +CMD_ACCOUNT_COLUMN_HOSTNAME 目标 VPN Server 主机名 +CMD_ACCOUNT_COLUMN_PORT 目标 VPN Server 端口号 +CMD_ACCOUNT_COLUMN_HUBNAME 目标 VPN Server 虚拟 HUB 名称 +CMD_ACCOUNT_COLUMN_PROXY_TYPE 代理服务器类型 +CMD_ACCOUNT_COLUMN_PROXY_HOSTNAME 代理服务器主机名 +CMD_ACCOUNT_COLUMN_PROXY_PORT 代理服务器的端口号 +CMD_ACCOUNT_COLUMN_PROXY_USERNAME 代理服务器的用户名 +CMD_ACCOUNT_COLUMN_SERVER_CERT_USE 验证服务器证书 +CMD_ACCOUNT_COLUMN_SERVER_CERT_NAME 注册的服务器个人证书 +CMD_ACCOUNT_COLUMN_RETRY_ON_SERVER_CERT Retry on Untrusted Server Certificate +CMD_ACCOUNT_COLUMN_DEVICE_NAME 用于连接的设备名 +CMD_ACCOUNT_COLUMN_AUTH_TYPE 验证类型 +CMD_ACCOUNT_COLUMN_AUTH_USERNAME 用户名 +CMD_ACCOUNT_COLUMN_AUTH_CERT_NAME 客户端验证使用证书 +CMD_ACCOUNT_COLUMN_NUMTCP VPN 通信中使用的 TCP 的连接数 +CMD_ACCOUNT_COLUMN_TCP_INTERVAL 建立每个 TCP 连接的间隔 +CMD_ACCOUNT_COLUMN_TCP_TTL 每个 TCP 连接的连接周期 +CMD_ACCOUNT_COLUMN_TCP_HALF 使用半双工模式 +CMD_ACCOUNT_COLUMN_ENCRYPT 通过 SSL 加密 +CMD_ACCOUNT_COLUMN_COMPRESS 数据压缩 +CMD_ACCOUNT_COLUMN_BRIDGE_ROUTER 通过网桥 / 路由模式连接 +CMD_ACCOUNT_COLUMN_MONITOR 通过监测模式连接 +CMD_ACCOUNT_COLUMN_NO_TRACKING 不要调整路由表 +CMD_ACCOUNT_COLUMN_QOS_DISABLE 不要使用 QoS 控制功能 +CMD_ACCOUNT_COLUMN_DISABLEUDP Disable UDP Acceleration + + +# Debugging Information Collecting Tool +CMD_DEBUG_SOFTNAME 调试信息采集工具 +CMD_DEBUG_PRINT 调试信息采集工具\r\n\r\n +CMD_DEBUG_NOT_2000 要求 Windows 2000 或更高版本。 +CMD_DEBUG_NOT_ADMIN 您必须以管理员身份登录 Windows 执行此命令。 +CMD_DEBUG_UAC_FAILED 无法获得管理员权限。 +CMD_DEBUG_SAVE_TITLE 指定保存文件的目标路径 +CMD_DEBUG_OK 一个调试信息文件被保存为 "%s"。\r\n\r\n发送此文件到你的支持人员。\r\n在发送给支持人员以前,您必须验证此文件的内容。\r\n如果有一些你不想透露给其他工作人员的机密信息,你有责任移除这个文件中的机密信息。\r\n\r\n如果你忽略了包含在此文件中的机密信息,并且你同意将整个文件发送给支持人员,这意味着你已经同意透露文件中的全部内容给支持人员。 +CMD_DEBUG_NG 无法保存调试信息为 "%s"。 + + +# 测试命令 +CMD_TEST 执行测试运行。 +CMD_TEST_HELP 这是一个测试命令。执行测试运行。随着测试命令,您可以指定许多参数。您可以省略参数的个数。 +CMD_TEST_ARGS Test [/A1:a_str] [/A2:b_str] [/A3:int_value] +CMD_TEST_A1 指定参数格 A1。这可以被省略。 +CMD_TEST_A2 指定参数 A2。如果忽略,当命令执行时,提示将显示输入参数 A2。规格不能是空白。 +CMD_TEST_A3 指定一个数值。您必须指定一个范围是 1 到 100 之间的整数。指定的整数超出此范围,将导致错误信息显示。 +CMD_TEST_EVAL_A2 参数 A2 的规格不能是空白。 +CMD_IP_EVAL_FAILED IP 地址指定不正确。 +CMD_HOSTPORT_EVAL_FAILED 主机名和端口号规格无效。\n请使用指定的主机名格式:端口号 或 IP 地址:端口号。 +CMD_PORTLIST_EVAL_FAILED 端口号列表规格无效。\n列表必须至少有一个端口号设置,也可以设置多个端口号。当指定多个端口号时,使用逗号隔开,如 "443,992,8888"。 +CMD_PROTOCOL_EVAL_FAILED 协议指定不正确。可以为协议指定 ip, tcp, udp, icmpv4, icmpv6 或协议数字 (0 到 255)。 +CMD_PORT_RANGE_EVAL_FAILED 端口号或端口号范围指定不正确。如果仅指定一个端口号,必须使用一个整数来指定端口号。如果指定多个端口,开始端口号和结束端口号加一个连字符来指定,如 "80-443"。 +CMD_TCP_CONNECTION_STATE_EVAL_FAILED TCP 连接状态规格无效。\n指定 "已设立" 或 "未设立",并且在选择协议时指定 TCP。 +CMD_MAC_ADDRESS_AND_MASK_EVAL_FAILED MAC 地址和掩码规格无效。\n使用有分隔符('-' 或 ':')的十六进制数字,和没有分隔符。一个例子是 "00-AC-84-EA-33-BC/FF-FF-FF-FF-FF-FF"。 +CMD_EXEC_MSG_NAME %S 命令 - %s +CMD_ID ID +CMD_FILE_NOT_FOUND 找不到指定的文件 "%s"。 +CMD_FILE_NAME_EMPTY 文件名没有被指定。 +CMD_SAVECERTPATH 保存 X.509 证书到文件名: +CMD_SAVECERT_FAILED 无法保存证书文件。 +CMD_SAVEKEYPATH 保存密钥到文件名: +CMD_SAVEKEY_FAILED 无法保存密钥文件。 +CMD_SAVEFILE_FAILED 无法保存文件。 +CMD_LOADFILE_FAILED 无法打开文件。 +CMD_LOADCERTPATH 从……文件名读取 X.509 证书: +CMD_LOADCERT_FAILED 无法读取证书文件。 +CMD_LOADKEYPATH 从文件名……读取私钥: +CMD_LOADKEY_FAILED 无法读取密钥文件。 +CMD_LOADKEY_ENCRYPTED_1 指定的密钥文件被密码保护。 +CMD_LOADKEY_ENCRYPTED_2 请输入密码: +CMD_LOADKEY_ENCRYPTED_3 密码不正确。 +CMD_KEYPAIR_FAILED X.509 证书和私钥的组合指定不正确。证书和与该证书对应的私钥是必需的。 +CMD_CERT_NOT_EXISTS 证书未登记。 +CMD_NO_SETTINGS - +CMD_DISCONNECTED_MSG \n---Error---\n\n与您正管理的主机通信会话被中断了。从现在开始,如果您运行任何命令将出现错误。\n\n为了重新连接到您管理的主机,首先输入 "EXIT" 的离本开提示,然后重新连接。\n\n + + +# VPN CMD 命令 +CMD_VPNCMD SoftEther VPN Developer Edition 命令行管理工具 +CMD_VPNCMD_HELP “vpncmd ”程序是一个允许您通过使用命令行来管理 SoftEther VPN 软件的实用工具。通过使用 vpncmd,您可以连接到运行在本地或远程计算机的 VPN Client,VPN Server 或 VPN Bridge 并管理它们。此外,通过使用 VPN 工具模式,您可以调用网络传输速度测试工具和证书创建功能。即使不连接到 VPN Server 或 VPN Client,vpncmd 也是可以使用的。\n当使用 vpncmd 时,如果文件名是通过使用 /IN 和 /OUT 参数指定的,该命令就可以根据一个文件被批量执行。该文件列举了可执行命令的文件和执行结果可以被写入文件中。通常,vpncmd 启动后命令提示符会出现,但是,当用 /IN 参数指定一个输入文件时,在输入文件的所有行执行完成后,该程序将自动终止。此外,当指定 /CMD 参数来执行一个命令时,在命令执行完成后,程序将自动终止。您不能同时刻指定 /IN 参数和 /CMD 参数。vpncmd 程序的终止代码将是最后执行命令的错误代码 (在成功执行的情况下是 0)。在 Windows 环境下,当具有管理员权限的用户一次或多次启动 vpncmd 时,有可能只需输入 "vpncmd" 到 Windows 命令提示符或 [运行...] Windows 启动 vpncmd。为了在 UNIX 系统下得到同样的结果,您可以手动设置,PATH 环境是可变的。 +CMD_VPNCMD_ARGS vpncmd [host:port] [/CLIENT|/SERVER|/TOOLS] [/HUB:hub] [/ADMINHUB:adminhub] [/PASSWORD:password] [/IN:infile] [/OUT:outfile] [/CMD commands...] +CMD_VPNCMD_[host:port] 通过指定格式的参数 [主机名:端口号],可自动连接到主机。如果这是没有指定的,会出现一个提示让输入连接目的地。当连接到一个 VPN Client,您不能指定一个端口号。 +CMD_VPNCMD_CLIENT 连接到 VPN 客户做管理。您不能指定它与 /SERVER 一起做。 +CMD_VPNCMD_SERVER 连接到 VPN Server 或 VPN Bridge 做管理。您不能指定它与 /CLIENT 一起做。 +CMD_VPNCMD_TOOLS 启用 VPN 工具命令。 VPN 工具包括简单证书创建工具 (MakeCert 命令) 和网络传输速度测试工具 (SpeedTest 命令)。 +CMD_VPNCMD_HUB 当通过 “虚拟 HUB 管理模式”连接到 VPN Server 时,这就指定了该虚拟 HUB 名称为 "hub"。如果您指定主机名而不是 / HUB 参数,连接将通过 “服务器管理模式”进行。 +CMD_VPNCMD_ADMINHUB 在连接到 VPN Server 后,这将指定自动选择的虚拟 HUB "adminhub" 的名称。如果已经指定 /HUB 的参数,虚拟 HUB 将被自动选定,则本指定就没有必要了。 +CMD_VPNCMD_PASSWORD 当连接时,如果需要管理员密码,指定密码 "password"。当没有指定密码时,提示输入密码会被显示。 +CMD_VPNCMD_IN 这将指定的文本文件 "infile",其中包含连接完成后自动执行的命令列表。如果指定 /IN 参数,在文件中所有命令文件都执行完毕后,vpncmd 程序将自动终止。如果该文件包含多字节字符,编码必须是 Unicode (UTF-8)。这不能与 /CMD 一起被指定 (如 /CMD 是指定的,/IN 将被忽略)。 +CMD_VPNCMD_OUT 您可以指定文本文件 "outfile" 写所有的字符串,如屏幕上的提示,信息,错误和执行结果。请注意,如果指定的文件已经存在,现有文件的内容将被覆盖。输出字符串将用 Unicode (UTF-8) 编码被记录。 +CMD_VPNCMD_CMD 如果可选命令 "commands..." 包含在 /CMD 命令之后,连接完成后此命令将被执行,此后 vpncmd 程序将终止。不能与 /IN 一起指定 (如果与 /IN 一起指定,/IN 将被忽略)。在所有其他 vpncmd 参数之后指定 /CMD 参数。 +CMD_VPNCMD_CSV 您可以通过指定本选项启用 CSV 输出。每个命令的结果将会以 CSV 形式打印。用其他程序处理结果是有用的。 +CMD_VPNCMD_CS_1 通过使用 vpncmd 程序,可以取得以下成果。\n\n1. VPN Server 或 VPN Bridge 的管理。\n2. VPN Client 的管理。\n3. 使用 VPN 工具 (证书创建和网络传输速度测试工具)\n\n +CMD_VPNCMD_CS_2 选择 1, 2 或 3: +CMD_VPNCMD_HOST_1 指定的主机名或目标 VPN Server 或 VPN Bridge 正在 运行的计算机 IP 地址。\n通过以 "主机名:端口号" 格式指定,您还可以指定端口号。\n(当没有指定端口号时,使用 443。)\n如果不输入任何内容并按下回车键,将连接到端口号为 443 的本地主机 (这台电脑)。 +CMD_VPNCMD_HOST_2 指定的主机名或正在运行的目标 VPN Client 计算机的 IP 地址。\n如果不输入任何内容并且按下回车键,将连接到本地主机 (这台电脑)。 +CMD_VPNCMD_HOST_3 目标 IP 地址的主机名: +CMD_VPNCMD_HUB_1 如果通过虚拟 HUB 管理模式连接到服务器,请输入虚拟 HUB 的名称。\n如果通过服务器管理模式连接,无须输入任何内容请按回车键。\n +CMD_VPNCMD_HUB_2 指定虚拟 HUB 名称: +CMD_VPNCMD_ABOUT SoftEther VPN 命令行管理工具 (vpncmd 命令)\nDeveloper Edition\n%S\n%S\nCopyright (c) all contributors on SoftEther VPN project in GitHub.\nCopyright (c) Daiyuu Nobori, SoftEther Project at University of Tsukuba, and SoftEther Corporation.\nAll rights reserved.\n +CMD_VPNCMD_PASSWORD_1 访问被拒绝。可能是密码不正确,或者是您以不正确的管理模式连接。您可以尝试再次输入密码。要取消,请按 Ctrl + D。 +CMD_VPNCMD_PASSWORD_2 密码: +CMD_VPNCMD_ERROR 发生错误。(错误代码: %u)\n%s +CMD_VPNCMD_SERVER_CONNECTED 与服务器 "%S" 的连接已建立 (端口 %u)。 +CMD_VPNCMD_SERVER_CONNECTED_1 您有整个 VPN Server 的管理员权限。 +CMD_VPNCMD_SERVER_CONNECTED_2 您在 VPN Server 上有虚拟 HUB "%S" 的管理员权限。 +CMD_VPNCMD_CLIENT_NO_REMODE 目标 VPN Client 服务器不允许来自远程计算机的依法行政的连接。启动的计算机上运行的 VPN Client 并连接到本地主机的命令行管理工具或 VPN 客户经理。 +CMD_VPNCMD_PWPROMPT_0 请输入密码。要取消,请按下 Ctrl + D 键。 +CMD_VPNCMD_PWPROMPT_1 密码 : +CMD_VPNCMD_PWPROMPT_2 确认输入: +CMD_VPNCMD_PWPROMPT_3 密码和确认密码不匹配。请再输入密码和确认密码。 +CMD_VPNCMD_CLIENT_CONNECTED 连接到 VPN Client "%S"。 +CMD_VPNCMD_TOOLS_CONNECTED VPN 工具已推出。通过输入 "HELP",您可以查看可使用的命令列表。 + + + + +####################################################### +# # +# VPN Server 的管理命令如下 # +# # +####################################################### + + + +# About 命令 +CMD_About 显示版本信息 +CMD_About_HELP 这显示了此命令行管理工具的版本信息。版本信息中包括了 vpncmd 版本号,内部标号和内部标号信息。 +CMD_About_ARGS About + + +# ServerInfoGet 命令 +CMD_ServerInfoGet 获取服务器信息 +CMD_ServerInfoGet_Help 这使您可以获取当前连接的 VPN Server 或 VPN Bridge 的服务器信息。服务器信息中包括版本号,内部标号和内部标号信息。您还可以获取当前服务器运行模式的信息和服务器上运行的操作系统信息。 +CMD_ServerInfoGet_Args ServerInfoGet + + +# ServerStatusGet 命令 +CMD_ServerStatusGet 获取当前服务器状态 +CMD_ServerStatusGet_Help 这使您可以实时获取当前连接的 VPN Server 或 VPN Bridge 的现状。您可以得到关于数据通信和服务器上存在的不同类型对象数量的统计资料。您可以得到当前计算机所使用的操作系统内存多少的信息。 +CMD_ServerStatusGet_Args ServerStatusGet + + +# ListenerCreate 命令 +CMD_ListenerCreate 创建新的 TCP 监听器 +CMD_ListenerCreate_Help 这使您可以在服务器上创建一个新的 TCP 监听器。通过建立 TCP 监听器,服务器开始在指定的 TCP/IP 端口连接监听。\n已创建的 TCP 监听器可以被 ListenerDelete 命令删除。\n您还可以得到一个当前使用 ListenerList 命令登记的 TCP 侦听器列表。\n要执行这个命令,您必须有 VPN Server 管理员权限。 +CMD_ListenerCreate_Args ListenerCreate [port] +CMD_ListenerCreate_[port] 使用一个整数,指定新添加的 TCP/IP 监听端口号。您也可以使用一个已经被其他程序使用的端口号; 但 VPN Server 将无法使用,直到该程序结束了在端口的使用。指定一个范围从 1 到 65535 的端口号。 +CMD_ListenerCreate_PortPrompt 新增 TCP/IP 监听器端口号: + + +# ListenerDelete 命令 +CMD_ListenerDelete 删除 TCP 监听器 +CMD_ListenerDelete_Help 这允许您删除一个在服务器上已注册的 TCP 侦听器。当 TCP 监听器在运行状态,当运行停止时,监听器将被自动删除。\n您还可以得到一个当前使用 ListenerList 命令登记的 TCP 监听器列表。\n为了执行这个命令,您必须有 VPN Server 管理员权限。 +CMD_ListenerDelete_Args ListenerDelete [port] +CMD_ListenerDelete_[port] 使用一个整数,指定要删除的 TCP/IP 监听器端口号。 +CMD_ListenerDelete_PortPrompt TCP/IP 侦听器端口号: + + +# ListenerList 命令 +CMD_ListenerList 获取 TCP 监听器列表 +CMD_ListenerList_Help 这使您可以获取的 TCP 侦听器列表当前服务器上注册。您可以获取有关各种 TCP 监听器的运行状态或错误的信息。\n执行这个命令,您必须有 VPN Server 管理员权限。 +CMD_ListenerList_Args 监听器列表 +CMD_ListenerList_Column1 TCP 端口 +CMD_ListenerList_Column2 状态 + + +# ListenerEnable 命令 +CMD_ListenerEnable 开始 TCP 监听器运行 +CMD_ListenerEnable_Help 这将启动在当前服务器上注册的停止 TCP 监听器的运行。\n您还可以得到一个当前使用 ListenerList 命令注册的 TCP 监听器列表。\n为了执行这个命令,您必须有 VPN Server 管理员权限。 +CMD_ListenerEnable_Args ListenerEnable [port] +CMD_ListenerEnable_[port] 使用一个整数,指定要启动的 TCP/IP 监听器端口号。 +CMD_ListenerEnable_PortPrompt 启动 TCP/IP 监听器端口号: + + +# ListenerDisable 命令 +CMD_ListenerDisable 停止 TCP 监听器运行 +CMD_ListenerDisable_Help 这将停止在当前服务器上注册的 TCP 监侦听器的运行。\n您还可以得到一个当前使用 ListenerList 命令注册的 TCP 监听器列表。\n为了执行这个命令,您必须有 VPN Server 管理员权限。 +CMD_ListenerDisable_Args ListenerDisable [port] +CMD_ListenerDisable_[port] 使用一个整数,指定要停止的 TCP/IP 监听器端口号。 +CMD_ListenerDisable_PortPrompt 启动 TCP/IP 监听器端口号: + + +# PortsUDPSet command +CMD_PortsUDPSet Sets the UDP ports that the server should listen on +CMD_PortsUDPSet_Help This command can be used to specify a single or multiple UDP ports the server should listen on. \nYou can specify a port that is used by another process, however the server will not be able to use it until the port becomes free. \nSpecify a port number that is within the range of 1 to 65535. \nYou can list the ports that are currently set with the PortsUDPGet command. \nTo execute this command, you must have VPN Server administrator privileges. +CMD_PortsUDPSet_Args PortsUDPSet [ports] +CMD_PortsUDPSet_[ports] Multiple UDP ports can be specified by splitting them with a space or a comma, for example: "443, 992, 1194, 5555". \nSpecify "0" to disable the UDP listener. \n\nPorts: + + +# PortsUDPGet command +CMD_PortsUDPGet Lists the UDP ports that the server is listening on +CMD_PortsUDPGet_Help This command can be used to retrieve the UDP ports the server is listening on. \nYou can set the ports with the PortsUDPSet command. +CMD_PortsUDPGet_Args PortsUDPGet +CMD_PortsUDPGet_Ports UDP ports + + +# ProtoOptionsSet 命令 +CMD_ProtoOptionsSet Sets an option's value for the specified protocol +CMD_ProtoOptionsSet_Help This command can be used to change an option's value for a specific protocol. \nYou can retrieve the options using the ProtoOptionsGet command. \nTo execute this command, you must have VPN Server administrator privileges. +CMD_ProtoOptionsSet_Args ProtoOptionsSet [protocol] [/NAME:option_name] [/VALUE:string/true/false] +CMD_ProtoOptionsSet_[protocol] Protocol name. +CMD_ProtoOptionsSet_NAME Option name. +CMD_ProtoOptionsSet_VALUE Option value. Make sure to write a value that is accepted by the specified protocol! +CMD_ProtoOptionsSet_Prompt_[protocol] Protocol: +CMD_ProtoOptionsSet_Prompt_NAME Option: +CMD_ProtoOptionsSet_Prompt_VALUE Value: + + +# ProtoOptionsGet 命令 +CMD_ProtoOptionsGet Lists the options for the specified protocol +CMD_ProtoOptionsGet_Help This command can be used to retrieve the options for a specific protocol. \nDetailed info (e.g. value type) will be shown. \nYou can change an option's value with the ProtoOptionsSet command. +CMD_ProtoOptionsGet_Args ProtoOptionsGet [protocol] +CMD_ProtoOptionsGet_[protocol] Protocol name. +CMD_ProtoOptionsGet_Prompt_[protocol] Protocol: +CMD_ProtoOptionsGet_Column_Name Name +CMD_ProtoOptionsGet_Column_Type Type +CMD_ProtoOptionsGet_Column_Value Value +CMD_ProtoOptionsGet_Column_Description Description + + +# ProtoOptions +CMD_ProtoOptions_Description_OpenVPN_DefaultClientOption When OpenVPN is compiled without OCC code, it doesn't send the options string to the server. The original OpenVPN server still works, because the configuration is static. SoftEther VPN is heuristic and wants to support as many different configurations as possible. This option allows to define the string that is sent to clients built without OCC code, so that they can successfully connect. +CMD_ProtoOptions_Description_OpenVPN_Obfuscation This may help an OpenVPN client bypass firewalls that are aware of the protocol and block it. The same XOR mask has to be applied client-side, otherwise it will not be able to connect with certain obfuscation methods! +CMD_ProtoOptions_Description_OpenVPN_ObfuscationMask Mask used to XOR the bytes in the packet (used for certain obfuscation modes). +CMD_ProtoOptions_Description_OpenVPN_PushDummyIPv4AddressOnL2Mode There's a bug that manifests under certain circumstances on Linux. It causes the OpenVPN client to disconnect unless the TAP device is UP. This option tells the server to push a dummy IPv4 address (RFC7600) to the client, so that the TAP adapter is forced to be UP. + + +# ServerPasswordSet 命令 +CMD_ServerPasswordSet 设置 VPN Server 管理员密码 +CMD_ServerPasswordSet_Help 这将设置 VPN Server 管理员密码。您可以指定密码为一个参数。如果密码没有指定,将显示提示输入密码和密码确认。如果指定密码为一个参数,这个密码将在屏幕上显示瞬间,这构成了风险。我们建议尽可能避免指定这个参数,使用密码提示输入密码。\n为了执行这个命令,您必须有 VPN Server 管理员权限。 +CMD_ServerPasswordSet_Args ServerPasswordSet [password] +CMD_ServerPasswordSet_[password] 指定一个新的密码设置。 + + +# ClusterSettingGet 命令 +CMD_ClusterSettingGet 获取当前 VPN Server 群集配置 +CMD_ClusterSettingGet_Help 你可以用它来获取当前 VPN Server 的群集配置。\n为了执行这个命令,您必须有 VPN Server 管理员权限。 +CMD_ClusterSettingGet_Args ClusterSettingGet +CMD_ClusterSettingGet_Current 当前配置 +CMD_ClusterSettingGet_None (没有设置) +CMD_ClusterSettingGet_PublicIp 公网 IP 地址 +CMD_ClusterSettingGet_PublicPorts 公共端口列表 +CMD_ClusterSettingGet_Controller 目标控制器 +CMD_ClusterSettingGet_ControllerOnly 仅限控制器功能 +CMD_ClusterSettingGet_Weight 群集性能标准 + + +# ClusterSettingStandalone 命令 +CMD_ClusterSettingStandalone 设置为独立的 VPN Server 类型 +CMD_ClusterSettingStandalone_Help 使用此设置 VPN Server 类型为 [独立服务器]。独立服务器指 VPN Server 在当前状态下不属于任何群集。当 VPN Server 安装后,默认情况下为独立的服务器模式。除非你有特别的计划来配置群集,我们建议 VPN Server 以独立模式运行。\n为了执行这个命令,您必须有 VPN Server 管理员权限。\n还有,当这个命令执行时,VPN Server 会自动重新启动。\n此命令不能在 VPN Bridge 上运行。 +CMD_ClusterSettingStandalone_Args ClusterSettingStandalone + + +# ClusterSettingController 命令 +CMD_ClusterSettingController 设置 VPN Server 类型为群集控制器 +CMD_ClusterSettingController_Help 使用此设置 VPN Server 类型为 [群集控制器]。群集控制器是一个群集的所有成员服务器的中央电脑,群集环境是由多个 VPN Server 构成。一个群集需要一台电脑成为这个角色。在同一群集配置里的其他群集成员服务器,是通过连接到群信控制器作为群集成员开始运行的。 \n为了执行这个命令,您必须有 VPN Server 管理员权限。\n还有,当这个命令执行时刻,VPN Server 会自动重新启动。\n此命令不能在 VPN Bridge 上运行。 +CMD_ClusterSettingController_Args ClusterSettingController [/WEIGHT:weight] [/ONLY:yes|no] +CMD_ClusterSettingController_WEIGHT 这设置了这个 VPN Server 的性能标准比值。这是在群集负载平衡中执行的标准值。一般而言,这个值是 100。例如,仅设置一台机器为 200,而其他成员机器为 100,在负载平衡期间,将调节这台机器收到其他成员两倍的连接数。指定 1 或更高的值。如果此参数未指定,将使用 100。 +CMD_ClusterSettingController_ONLY 通过在这里指定 "yes",VPN Server 在群集里仅作为一个控制器运行,并总是分配一般 VPN Client 连接给到自身以外的成员。此功能用于高负载的环境。如果此参数未指定,"no" 将被使用。 + + +# ClusterSettingMember 命令 +CMD_ClusterSettingMember VPN Server 类型设置为群集成员 +CMD_ClusterSettingMember_Help 使用此设置 VPN Server 类型,[群集成员服务器]。一个群集成员服务器是成员的计算机属于群集配置由多个 VPN Server 与另一个中心现有群集控制器。集群成员可以根据需要任意添加到群集。\n在设置为群集成员服务器的 VPN Server,群集控制器管理员要为控制器的 IP 地址和端口号使用,需要知道公共 IP 地址和公共端口号 (必要时本 VPN Server) 和密码。\n要执行这个命令,您必须拥有 VPN Server 管理员权限。\n另外,在执行此命令,VPN Server 会自动重新启动。\n此命令不能运行的 VPN Bridge。 +CMD_ClusterSettingMember_Args ClusterSettingMember [server:port] [/IP:ip] [/PORTS:ports] [/PASSWORD:password] [/WEIGHT:weight] +CMD_ClusterSettingMember_[server:port] 按照 [主机名:端口号] 的形式,设定目的地群集控制器的主机名,IP 地址,端口号等。 +CMD_ClusterSettingMember_IP 指定该服务器的公用 IP 地址。如果不指定公用 IP 地址,请设定 "/IP:none"。当 IP 地址没有指定,将自动使用的网络接口的 IP 地址连接到群集控制器。 +CMD_ClusterSettingMember_PORTS 指定服务器的公开端口一览。该清单必须至少有一个公共端口号设置,也可以设置多个公共端口号。当指定多个端口号,例如 "/PORTS:443,992,8888" 中间用逗号分开。 +CMD_ClusterSettingMember_PASSWORD 指定连接到目标控制器的密码。它与目标控制器管理密码是相同的。 +CMD_ClusterSettingMember_WEIGHT 这设定了一个表现这个 VPN Server 的标准比率值。这是负载平衡集群中执行的标准值。一般而言,这个值是 100。例如,只有一台机器是 200,而其他成员是 100 个单位,将规范这台机器得到像其他许多成员期间两次连接负载平衡。指定 1 或更高的值。如果此参数未指定,将使用 100。 +CMD_ClusterSettingMember_Prompt_IP_1 指定一个公用 IP 地址。\n如果你不指定,请按回车键,不需要输入任何东西。 +CMD_ClusterSettingMember_Prompt_IP_2 公共 IP 地址: +CMD_ClusterSettingMember_Prompt_PORT_1 请指定一个公共端口号的列表。\n有 2 个或以上指定端口号,如例用逗号分隔: "443,992,8888"。 +CMD_ClusterSettingMember_Prompt_PORT_2 公共端口号: +CMD_ClusterSettingMember_Prompt_HOST_1 目标控制器的主机名和端口号: + + +# ClusterMemberList 命令 +CMD_ClusterMemberList 获得群集成员名单 +CMD_ClusterMemberList_Help 使用此命令时,VPN Server 作为群集控制器操作获得对相同的群集群集成员服务器,包括群集控制器本身的列表。\n若需每个成员,下面的信息也被列入。 [类型],[连线开始],[主机名],[点],[会期号码],[TCP 连接数],[虚拟的作业站数目],[使用客户端连接许可证],[使用大桥连接许可证]。\n此命令不能运行在 VPN Bridge。 +CMD_ClusterMemberList_Args ClusterMemberList + + +# ClusterMemberInfoGet 命令 +CMD_ClusterMemberInfoGet 会员信息的获取 +CMD_ClusterMemberInfoGet_Help 当 VPN Server 作为群集控制器操作,您就可以通过指定的集的成员服务器 ID 获得在群集成员的信息。\n您可以得到有关指定群集成员服务器上的以下信息: ]服务器类型]、],[已建立连接的时间],[IP 地址],[主机名],[点],[公共端口列表],[操作中的虚拟 HUB],[第一虚拟 HUB],[会话数],[TCP 连接数]。\n此命令不能运行在 VPN Bridge。 +CMD_ClusterMemberInfoGet_Args ClusterMemberInfoGet [id] +CMD_ClusterMemberInfoGet_[id] 指定想获信息的取群集成员的 ID。ID 地址可以在 ClusterMemberList 中获得。 +CMD_ClusterMemberInfoGet_PROMPT_ID 拟获取信息的群集成员 ID: + + +# ClusterMemberCertGet 命令 +CMD_ClusterMemberCertGet 获得群集成员证书 +CMD_ClusterMemberCertGet_Help 当 VPN Server 作为群集控制器操作,您就可以通过指定的群集这些成员服务器的 ID 的群集成员服务器获取公共 X.509 证书。您可以保存为 X.509 格式文件。\n此命令不能在 VPN Bridge 中运行。 +CMD_ClusterMemberCertGet_Args ClusterMemberCertGet [id] [/SAVECERT:cert] +CMD_ClusterMemberCertGet_[id] 指定获取证书所需的群集的成员的 ID。此 ID 可以群集成员使用 ClusterMemberList 中获得。 +CMD_ClusterMemberCertGet_SAVECERT 指定路径以保存您获得的证书。证书被保存为 X.509 格式。 +CMD_ClusterMemberCertGet_PROMPT_ID 获取证书的集群会员 ID: + +# ClusterConnectionStatusGet 命令 +CMD_ClusterConnectionStatusGet 获得群集控制器的连接状态的信息 +CMD_ClusterConnectionStatusGet_Help 使用此命令时,VPN Server 作为群集控制器操作来获得连接状态的群集控制器。\n您可以得到以下信息: [控制器 IP 地址],[端口号],[连接状态],[连线开始时间],[第一个连接成立时间],[当前连接成立时间],[的连接尝试次数],[成功连接次数],[连接失败次数]。\n此命令不能运行在 VPN Bridge。 +CMD_ClusterConnectionStatusGet_Args ClusterConnectionStatusGet + + +# Debug 命令 +CMD_Debug 执行调试命令 +CMD_Debug_Help 在运行的 VPN Server / Bridge 进程上运行调试命令。\n此命令在支持人员请求这么做时执行。\n错误使用此命令,很可能造成 VPN Server / Bridge 运行崩溃。 +CMD_Debug_Args Debug [id] [/ARG:arg] +CMD_Debug_[id] 指定一个调试命令序号。 +CMD_Debug_ARG 指定一个字符串传递给调试命令。如果该字符串包含空格,并且整个命令都包含在" "内。 +CMD_Debug_Msg1 发送调试命令... +CMD_Debug_Msg2 调试命令已执行。\n结果: \"%S\" + +# Crash 命令 +CMD_Crash 出现一个错误的 VPN Server / Bridge 强行终止该进程。 +CMD_Crash_Help 此命令会在 VPN Server / Bridge 的进程中产生一个严重的错误(内存访问冲突),从而会导致进程崩溃。于是,在服务模式下的 VPN Server / Bridge 将会终止并重启。如果 VPN Server 在用户模式下运行,进程将不会自动重启。\n本命令适用于:当 VPN Server / Bridge 处于一个不可恢复的错误或者进程无限循环时。此命令将断开所有 VPN Server / Bridge 上的 VPN 会话。所有在 VPN Server / Bridge 内存中未保存的设置将会丢失。\n在运行此命令前,运行"Flush" 命令来把不稳定的数据保存在配置文件中。\n要执行此命令,您必须具有 VPN Server / Bridge 的管理员权限。 +CMD_Crash_Args Crash [yes] +CMD_Crash_[yes] 确认请输入 "yes" +CMD_Crash_Msg 发送崩溃命令给 VPN Server。VPN Server 将会立即崩溃,所以您不可能收到本命令的结果值。此刻以后,vpncmd 将会自动断开 VPN Server 的连接。 +CMD_Crash_Confirm 您确定要使 VPN Server 崩溃?\n如果确定请键入 "yes": +CMD_Crash_Aborted 崩溃命令中止。 + + +# Flush 命令 +CMD_Flush 保存 VPN Server / Bridge 全部不稳定数据到配置文件。 +CMD_Flush_Help 通常,不稳定设置数据会保存在 VPN Server / Bridge 的内存中。它定期以 vpn_server.config 或者 vpn_bridge.config 刷新硬盘。默认周期是 300 秒(5 分钟)。(周期长度可以在配置文件中,通过修改 AutoSaveConfigSpan 进行改变。)数据会在正常关闭 VPN Server / Bridge 时保存。\n执行 Flush 命令使 VPN Server / Bridge 立即保存设置至文件。此设置数据将被保存在服务器计算机的磁盘驱动中。在您没有足够时间正常关闭服务器进程的情况下,使用 Flush 命令。\n执行此命令,您必须有 VPN Server 管理员权限。\n执行此命令,您必须有 VPN Server / Bridge 的管理员权限。 +CMD_Flush_Args Flush +CMD_Flush_Msg1 从内存到磁盘写入不稳定数据...\n +CMD_Flush_Msg2 保存成功。文件大小是 %S 字节。\n + + +# ServerCertGet 命令 +CMD_ServerCertGet 获得 VPN Server 的 SSL 证书 +CMD_ServerCertGet_Help VPN Server,取得连接客户机所需的 SSL 证书。证书可以保存为 X.509 的格式。 +CMD_ServerCertGet_Args ServerCertGet [cert] +CMD_ServerCertGet_[cert] 获得的证书指定文件保存路径,以 X.509 的形式保存。 + + +# ServerKeyGet 命令 +CMD_ServerKeyGet 获取 VPN Server SSL 证书的密钥 +CMD_ServerKeyGet_Help VPN Server,为已连接客户提供获得证书的密钥。密钥可以存储为 Base 64 的编码文件。 \n为了运行此命令,VPN Server 需要管理员的权限。 +CMD_ServerKeyGet_Args ServerKeyGet [key] +CMD_ServerKeyGet_[key] 指定文件的路径名来存储已获得的密钥。将密钥存储为 Base 64 编码。 + + +# ServerCertSet 命令 +CMD_ServerCertSet VPN Server 的 SSL 证书和密钥的设置 +CMD_ServerCertSet_Help 设置已连接 VPN Server 的客户端所需的 SSL 证书,以及跟证书相对应的密钥。证书为 X.509 格式,密钥为 Base 64 编码格式。\n为了运行此命令,需要有 VPN Server 管理员权限。 +CMD_ServerCertSet_Args ServerCertSet [/LOADCERT:cert] [/LOADKEY:key] +CMD_ServerCertSet_LOADCERT 指定要使用的 X.509 格式的证书文件。 +CMD_ServerCertSet_LOADKEY 指定格式为 Base 64 编码并且与证书对应的密钥文件。 + + +# ServerCipherGet 命令 +CMD_ServerCipherGet 获取 VPN 通信中使用的加密程序 +CMD_ServerCipherGet_Help 您可以获取 VPN Server 和客户端之间进行通信时使用的 SSL 加密,电子签名等,以及在 VPN Server 上的程序列表。 +CMD_ServerCipherGet_Args ServerCipherGet +CMD_ServerCipherGet_SERVER VPN Server 正在使用的加密程序: +CMD_ServerCipherGet_CIPHERS 可以使用的加密程序一览表: + +# ServerCipherSet 命令 +CMD_ServerCipherSet 设置 VPN 通讯中使用的加密程序, +CMD_ServerCipherSet_Help 您可以设置 VPN Server 和客户端在通讯中应用的 SSL 加密连接,电子签名等应用程序。\n如果您指定程序的名称,以后和 VPN Server 连接的 VPN Client,VPN Bridge 之间的将应用指定程序,数据将被加密。\n运行此命令,需要 VPN Server 管理员的权限。 +CMD_ServerCipherSet_Args ServerCipherSet [name] +CMD_ServerCipherSet_[name] 指定设置加密和数字签名的程序。可以使用的程序一览,可以从 ServerCipherGet 指令中获取。 +CMD_ServerCipherSet_PROMPT_NAME 指定的加密程序的名称: + +# KeepEnable 命令 +CMD_KeepEnable 启动 Internet 保持连接功能 +CMD_KeepEnable_Help 启动 [互联网保持连接功能]。启动此功能后,如果一段时间没有通信数据,导致连接将被断开时,会自动发送数据包到任何服务器,互联网服务器一定的间隔,从而可以保持连接。\n目标主机名等,可以通过 KeepSet 指令来设置。\nVPN Server 或 VPN Bridge 运行此命令时,您必须具有管理员的权限。 +CMD_KeepEnable_Args KeepEnable + + +# KeepDisable 命令 +CMD_KeepDisable 禁用保持互联网连接功能 +CMD_KeepDisable_Help 解除 [保持互联网连接功能]。\nVPN Server 或 VPN Bridge 运行此命令,您必须具有管理员权限。 +CMD_KeepDisable_Args KeepDisable + + +# KeepSet 命令 +CMD_KeepSet 设置 Internet 保持连接功能 +CMD_KeepSet_Help 设置 [保持互联网连接功能] 的目标主机名。 如果一段时间没有任何通信数据,连接将被断开时,使用 [保持互联网连接功能 ] 可以,设定时间向 Internet 上的任何服务器发送数据包,从而可以保持您的 Internet 连接。\n在此功能中,可以设置目标 [主机名],[端口号],[数据包发送时间间隔],以及 [协议]。\n发送的数据包为随机内容,不会讲计算机和个人的识别信息发送。\n保持 Internet 连接功能,可以通过 KeepEnable 命令,或使用命令 KeepDisable,实现启用 / 禁用。不可以用 KeepSet 来改变启用 / 禁用的状态。 \nVPN Server 或 VPN Bridge 运行此命令,您必须具有管理员权限。 +CMD_KeepSet_Args KeepSet [/HOST:host:port] [/PROTOCOL:tcp|udp] [/INTERVAL:interval] +CMD_KeepSet_HOST 用 [主机:端口] 的格式,来设定目标主机名或 IP 地址和端口号。 +CMD_KeepSet_PROTOCOL 设定 tcp 或 udp。 +CMD_KeepSet_INTERVAL 以秒为单位设定发送数据包之间的间隔时间。 +CMD_KeepSet_PROMPT_HOST 设定目标主机名或 IP 地址和端口号: +CMD_KeepSet_PROMPT_PROTOCOL tcp 或 udp: +CMD_KeepSet_PROMPT_INTERVAL 发送数据包时间间隔 (秒): +CMD_KeepSet_EVAL_TCP_UDP 设定 "tcp" 或 "udp"。 + +# KeepGet 命令 +CMD_KeepGet 获取保持互联网连接的功能 +CMD_KeepGet_Help 获取 [保持互联网连接功能] 的当前设置。可以得到 [主机名],[端口],[数据包发送时间间隔],和 [协议],还包括当前 [保持互联网连接功能] 是否启用的当前状态。 +CMD_KeepGet_Args KeepGet +CMD_KeepGet_COLUMN_1 主机名 +CMD_KeepGet_COLUMN_2 端口号 +CMD_KeepGet_COLUMN_3 数据包发送时间间隔 (秒) +CMD_KeepGet_COLUMN_4 协议 +CMD_KeepGet_COLUMN_5 当前状态 + + +# SyslogEnable 命令 +CMD_SyslogEnable 设置发送系统日志功能 +CMD_SyslogEnable_Help 使用 syslog 发送系统日志的使用方法和服务器的设置。 +CMD_SyslogEnable_Args SyslogEnable [1|2|3] [/HOST:host:port] +CMD_SyslogEnable_[1|2|3] 使用 syslog 功能 1 - 3 来进行设置。\n1: 发送 syslog 服务器日志。\n2: 发送服务器和虚拟 HUB 安全系统日志。\n3: 服务器,虚拟 HUB 安全和数据包发送系统日志记录枢纽。 +CMD_SyslogEnable_HOST 按照 [主机:端口] 的形式,设定系统日志服务器主机名或 IP 地址和端口号。如果省略端口号使用 514。 +CMD_SyslogEnable_MINMAX 设置 syslog 发送功能 1 - 3。 +CMD_SyslogEnable_Prompt_123 系统日志传输功能 (1 - 3): +CMD_SyslogEnable_Prompt_HOST 指定发送日志的服务器: + + +# SyslogDisable 命令 +CMD_SyslogDisable 禁用发送系统日志的功能 +CMD_SyslogDisable_Help 解除系统日志的传送功能。 +CMD_SyslogDisable_Args SyslogDisable + + +# SyslogGet 命令 +CMD_SyslogGet 取得发送系统日志的功能 +CMD_SyslogGet_Help 获取 syslog 发送功能的当前设置。您可以设置系统日志功能的使用方法,可以获取 syslog 服务器的主机名和端口号。 +CMD_SyslogGet_Args SyslogGet +CMD_SyslogGet_COLUMN_1 设置系统日志发送功能 +CMD_SyslogGet_COLUMN_2 发送系统日志服务器主机名 +CMD_SyslogGet_COLUMN_3 syslog 服务器端口号 + + +# ConnectionList 命令 +CMD_ConnectionList 获取与 VPN Server 相连的 TCP 连接一览 +CMD_ConnectionList_Help 现在,先获取与 VPN Server 连接的 TCP/IP 一览表。但是,VPN 会话作为 TCP/IP 连接不显示。VPN 会话建立的 TCP/IP 连接一览表,何以运用 SessionList 命令获得。\n可以获取 [连接名称], [原始连接], [连接时间] 和 [类型]。\n要运行此命令,VPN Server 需要管理员权限。 +CMD_ConnectionList_Args ConnectionList + + +# ConnectionList 命令 +CMD_ConnectionGet 获取连接到 VPN Server 的 TCP 信息一览表 +CMD_ConnectionGet_Help 获取与 VPN Server 连接的 TCP/IP 连接的详细信息。\n可以获得 [连接名],[连接种类],[连接主机名],[连接主机 IP],[联机主机端口 TCP],[连接时间],[服务器品牌],[服务器版本],[服务器铭牌号],[客户机品牌],[客户机版本],[客户机铭牌号] 等信息。 \n要运行此命令,需要管理员权限。 +CMD_ConnectionGet_Args ConnectionGet [name] +CMD_ConnectionGet_[name] 指定希望获取信息的连接名称。所有连接的一览表,可以通过 ConnectionList 命令获得。 +CMD_ConnectionGet_PROMPT_NAME 用以获取信息的连接名称: + +# ConnectionDisconnect 命令 +CMD_ConnectionDisconnect 断开 VPN Server 和 TCP 的连接 +CMD_ConnectionDisconnect_Help 强制切断 VPN Server 和指定的 TCP/IP 的连接。\n运行此命令,需要管理员权限。 +CMD_ConnectionDisconnect_Args ConnectionDisconnect [name] +CMD_ConnectionDisconnect_[name] 选定希望切断的连接。连接的名称可以从 ConnectionList 命令中获得。 +CMD_ConnectionDisconnect_PROMPT_NAME 断开连接的名称: + + +# BridgeDeviceList 命令 +CMD_BridgeDeviceList 获取可以在当地的网桥上使用的 LAN 卡一览 +CMD_BridgeDeviceList_Help 使用当地网桥连接,获取目标桥中可以使用的设备 (LAN 卡) 列表。\n在此显示的设备名字,BridgeCreate 命令都可以使用。\n为了运行此命令,需要管理员权限。 +CMD_BridgeDeviceList_Args BridgeDeviceList + + +# BridgeList 命令 +CMD_BridgeList 获得当地网桥连接列表 +CMD_BridgeList_Help 获取当地定义的网桥连接列表。\n可以获取当地网桥连接的虚拟 HUB 名称,目标太网桥连接器件 (LAN 卡) 的名称,或可以获取设备的名称和工作状态。 +CMD_BridgeList_Args BridgeList + + +# BridgeCreate 命令 +CMD_BridgeCreate 创建本地的网桥连接 +CMD_BridgeCreate_Help 在 VPN Server 上创建新的本地网桥连接的。\n当您使用一个本地的网桥,这个虚拟 HUB 和物理以太网设备 (LAN 卡在两层) 之间可以创建网桥连接。\n在系统中创建 tap 设备 (虚拟网络接口),可以与虚拟 HUB 建立连接 (tap 设备仅支持 Linux)。\n目的地以太网桥设备 (LAN 卡) 可以连接到您的任何运行的 LAN 卡,但是高负荷环境的网桥,建议您准备专用的 LAN 卡。\n要运行此命令,需要管理员权限。 +CMD_BridgeCreate_Args BridgeCreate [hubname] [/DEVICE:device_name] [/TAP:yes|no] +CMD_BridgeCreate_[hubname] 选定虚拟 HUB 的网桥。虚拟 HUB 列表,可以通过 HubList 命令获得。但是,没有必要一定要选定目前正在运行的虚拟 HUB,即使选定目前没有工作,或不存在的虚拟名称的 HUB,当它真正工作时,它与虚拟本地网桥就会建立连接。 +CMD_BridgeCreate_DEVICE 设定目标以太网桥设备 (LAN 卡) 的名称,或 tap 设备的名称。以太网设备名单,可以通过运行 BridgeDeviceList 命令得到。 +CMD_BridgeCreate_TAP 网桥连接局域网,不使用 LAN 卡,而是使用 tap 设备时,选定 yes,如果您使用的设备指定 (只支持 Linux)。如果省略,默认为 no。 +CMD_BridgeCreate_PROMPT_HUBNAME 网桥虚拟 HUB 名称: +CMD_BridgeCreate_PROMPT_DEVICE 目标网桥的设备名称: +CMD_BridgeCreate_PROMPT_TAP 你想使用 tap 设备吗 (yes/no): + + +# BridgeDelete 命令 +CMD_BridgeDelete 删除本地网桥连接 +CMD_BridgeDelete_Help 删除现有的当地网桥连接。当地网桥梁连接的列表,可以通过 BridgeDeviceList 命令得到。\n运行此命令,需要服务器管理员权限。 +CMD_BridgeDelete_Args BridgeDelete [hubname] [/DEVICE:device_name] +CMD_BridgeDelete_[hubname] 选定被删除的当地网桥的虚拟 HUB。 +CMD_BridgeDelete_DEVICE 选定被删除的当地的网桥的设备名 (LAN 卡的名称或 tap 设备的名称)。 +CMD_BridgeDelete_PROMPT_HUBNAME 删除虚拟网桥 HUB 的名称: +CMD_BridgeDelete_PROMPT_DEVICE 删除网桥的设备名: + + +# Caps 命令 +CMD_Caps 获得服务器的功能性能一览表 +CMD_Caps_Help 取得现在正在连接使用的 VPN Server 的功能和性能的清单。\nVPN Server 的功能和性能取决于服务器的版本。指令清单中的指令也可能因为对方的服务器的功能,而无法工作。因此此命令需调查目标服务器的功能。\n如果 VPN Server 的版本比命令行管理工具的版本新,存在不掌握的指令时,其内部的字符串 (变量名),但可能原原本本的表示出来。 +CMD_Caps_Args Caps + + +# Reboot 命令 +CMD_Reboot VPN Server 服务重新启动 +CMD_Reboot_Help VPN Server 重新启动该服务。\nVPN Server 重新启动服务,目前连接的会话和 TCP 连接都将被切断,直道建立新的连接。\n此命令,VPN Server,只是重新启动服务程序,而不是重新启动计算机。这种管理的连接也会断开,如果需要请重新建立连接。\n此外,/RESETCONFIG:yes 指定参数,并对 VPN Server 的系统内容 (.config) 进行初始化。\n要运行此命令,VPN Server需要管理员权限。 +CMD_Reboot_Args Reboot [/RESETCONFIG:yes|no] +CMD_Reboot_RESETCONFIG 选定 yes,对当前的 VPN Server 的系统内容 (.config) 初始化。请谨慎设置此参数。 + + +# ConfigGet 命令 +CMD_ConfigGet 获取 VPN Server 当前系统配置 +CMD_ConfigGet_Help 获取 VPN Server 当前 (.config 文件) 系统结构化文本保存的文本文件,你可以检索到 VPN Server 执行这个指令的瞬间状态。\n系统内容的文件,如果不指定参数,会在屏幕上直接显示。如果您指定参数保存,会保存为一个指定的文件名。\n配置文件可以使用普通的文本编辑器编辑。编辑好的文件要写入 VPN Server,需执行 ConfigSet 命令。\n要运行此命令,VPN Server 需要管理员权限。 +CMD_ConfigGet_Args ConfigGet [path] +CMD_ConfigGet_[path] 如果你想保存配置文件,请指定文件名。如果没有指定,配置的内容将以画面形式显示在屏幕上。如果配置是多字字符的,请转变成 Unicode (UTF-8) 编码存储。 +CMD_ConfigGet_FILENAME Config 名称: "%S", 大小: %u +CMD_ConfigGet_FILE_SAVE_FAILED 无法创建指定的文件。 + + +# ConfigSet 命令 +CMD_ConfigSet 往 VPN Server 上写入系统配置内容 +CMD_ConfigSet_Help 往 VPN Server 上写入系统配置内容。这样,您选定的系统配置内容会适用于 VPN Server,VPN Server 程序会自动重启,新的系统配同配置开始工作。\n对系统管理者来说,要记录所有的系统配置的文件是比较困难的。因此建议使用 ConfigGet 命令,先获取当前的 VPN Server 的系统配置内容保存成文件,再将此文件加以编辑,然后用 ConfigSet 命令写入 VPN Server。\n这个操作,需要对 VPN Server 充分的了解,如果写入了不正确的系统配置信息,系统将发生错误,甚至可能丢失现在的设置内容。请务必小心操作。\n执行这个命令,需要 VPN Server 的管理员权限。 +CMD_ConfigSet_Args ConfigSet [path] +CMD_ConfigSet_[path] 指定配置文件的名称。如果文件有多种文字,请先变化成 Unicode (UTF-8) 格式。 +CMD_ConfigSet_PROMPT_PATH 将配置上传到服务器上的文件路径名称: +CMD_ConfigSet_FILE_LOAD_FAILED 无法加载指定的文件。 + + +# RouterList 命令 +CMD_RouterList 获取虚拟 3 层交换机列表 +CMD_RouterList_Help 在 VPN Server 上获取 3 层虚拟交换机的清单。获取虚拟 3 层交换机的 [交换机名称],[工作状态],[接口数量],[路由数目] 等信息。\n要运行此命令,需要 VPN Server 管理员权限。\n此外,此命令不能在 VPN Bridge 中运行。 +CMD_RouterList_Args RouterList + + +# RouterAdd 命令 +CMD_RouterAdd 定义一个新的虚拟 3 层交换机 +CMD_RouterAdd_Help 在 VPN Server 上定义一个新的 3 层虚拟交换机。\n要运行此命令,需要 VPN Server 管理员权限。\n此外,此命令不能在 VPN Bridge 中运行。\n\n[虚拟 3 层交换机功能的说明]\n在这个虚拟 VPN Server 上运行的多个虚拟 HUB 之间,可以通过定义的虚拟 3 层交换机,实现不同 IP 地址之间的路由。\n\n[虚拟 3 层交换机功能的注意事项]\n虚拟 3 层交换机功能是基于对网络和 IP 路由熟悉的人或者是网络管理员使用的。如果您使用正常的 VPN 功能,您没有必要使用虚拟 3 层交换机。\n如果您使用虚拟 3 层交换机的功能,请您务必要十分熟悉 IP 路由方面的知识,并十分清楚您的设置将对网络产生的影响。 +CMD_RouterAdd_Args RouterAdd [name] +CMD_RouterAdd_[name] 创建一个新的虚拟 3 层交换机的名称。新创建的名称与现有的名称是不能相同。 +CMD_RouterAdd_PROMPT_NAME 要创建的虚拟 3 层交换机的名称: + + +# RouterDelete 命令 +CMD_RouterDelete 删除虚拟 3 层交换机 +CMD_RouterDelete_Help 删除在 VPN Server 上已定义的 3 层虚拟交换机。如果选定的虚拟 3 层交换机正在运行,它将停止工作,然后自动删除。\n获取虚拟 3 层交换机的清单,可以使用 RouterList 命令。\n要运行此命令,需要 VPN Server 管理员权限。\n此外,此命令不能在 VPN Bridge 中运行。 +CMD_RouterDelete_Args RouterDelete [name] +CMD_RouterDelete_[name] 选定想要删除的虚拟 3 层交换机的名称。 +CMD_RouterDelete_PROMPT_NAME 想要删除的虚拟 3 层交换机的名称: + + +# RouterStart 命令 +CMD_RouterStart 开始运行虚拟 3 层交换机 +CMD_RouterStart_Help VPN Server 上已经存在的虚拟 3 层交换机,如果处于停止工作工作状态,将开始运行。\n获取当前的虚拟 3 层交换机清单,可以执行 RouterList 命令。\n要运行此命令,需要 VPN Server 管理员权限。\n此外,此命令不能在 VPN Bridge 运行。\n\n[虚拟 3 层交换机功能的说明]\n在这个虚拟 VPN Server 上运行的多个虚拟 HUB 之间,可以通过定义的虚拟 3 层交换机,实现不同 IP 地址之间的路由。\n\n[虚拟 3 层交换机功能的注意事项]\n虚拟 3 层交换机功能是基于对网络和 IP 路由熟悉的人或者是网络管理员使用的。如果您使用正常的 VPN 功能,您没有必要使用虚拟 3 层交换机。\n如果您使用虚拟 3 层交换机的功能,请您务必要十分熟悉 IP 路由方面的知识,并十分清楚您的设置将对网络产生的影响。 +CMD_RouterStart_Args RouterStart [name] +CMD_RouterStart_[name] 选定即将启动的虚拟 3 层交换机的名称。 +CMD_RouterStart_PROMPT_NAME 即将启动的虚拟 3 层交换机的名称: + + +# RouterStop 命令 +CMD_RouterStop 停止虚拟 3 层交换机的运行 +CMD_RouterStop_Help 在 VPN Server 上已定义的虚拟 3 层交换机,如果正在运行,它将停止运行。\n想要获取现有的虚拟 3 层交换机清单,可以运行 RouterList 命令。\n要运行此命令,需要 VPN Server 管理员权限。 +CMD_RouterStop_Args RouterStop [name] +CMD_RouterStop_[name] 选定想要停止运行的虚拟 3 层交换机的名称。 +CMD_RouterStop_PROMPT_NAME 想要停止运行的虚拟 3 层交换机名称: + + +# RouterIfList 命令 +CMD_RouterIfList 获取在虚拟 3 层交换机中注册的远程接口的清单 +CMD_RouterIfList_Help 如果在指定的虚拟 3 层交换机上有已经定义的虚拟远程接口,您将会获取一个虚拟接口列表。\n在一个虚拟 3 层交换机上,您可以定义多个虚拟接口和路由表。\n虚拟接口与虚拟 HUB 相互关联,当虚拟 HUB 运行时,虚拟接口就像一个虚拟 IP 主机在工作。相对于多个 IP 虚拟 HUB,如果定义分属不同网络的多个远程接口时,IP 路由会自动运行。\n要运行此命令,需要 VPN Server 管理员权限。\n此外,此命令不能在 VPN Bridge 中运行。 +CMD_RouterIfList_Args RouterIfList [name] +CMD_RouterIfList_[name] 选定虚拟 3 层交换机的名称。 +CMD_RouterIfList_PROMPT_NAME 虚拟 3 层交换机的名称: + + +# RouterIfAdd 命令 +CMD_RouterIfAdd 在虚拟 3 层交换机上添加一个虚拟远程接口 +CMD_RouterIfAdd_Help 指定的 3 层虚拟交换机,为它添加一个在同一个 VPN Server 上运行的虚拟 HUB 的连接虚拟接口。\n一个指定的 3 层虚拟交换机,您可以定义多个虚拟接口和路由表。\n虚拟接口与虚拟 HUB 相互关联,当虚拟 HUB 运行时,虚拟接口就像一个虚拟 IP 主机在工作。相对于多个 IP 虚拟 HUB,如果定义分属不同网络的多个远程接口时,IP 路由会自动运行。\n虚拟接口的 IP 网络空间,虚拟接口的 IP 地址必须被定义。\n虚拟接口必须制定目标连接的虚拟 HUB 的名称。\n指定虚拟 HUB 时,也可选定当前不存在的虚拟 HUB。\n虚拟接口必须在虚拟 HUB 内有一个 IP 地址。此外,还需指定属于该 IP 地址的 IP 网络的子网掩码。\n设置虚拟 HUB 内几个虚拟空间通过交换机的路由网,需在指定的 IP 地址操作。\n要运行此命令,需要 VPN Server 管理员权限。\n此外,此命令不能在 VPN Bridge 中运行。 \n要运行此命令,操作对象的虚拟 3 层交换机必须关闭。如果正在运行中,可用 RouterStop 命令让其停止。 +CMD_RouterIfAdd_Args RouterIfAdd [name] [/HUB:hub] [/IP:ip/mask] +CMD_RouterIfAdd_[name] 指定虚拟 3 层交换机的名称。 +CMD_RouterIfAdd_HUB 指定新建虚拟接口拟连接的虚拟 HUB 名称。虚拟 HUB 名单,可以通过 HubList 命令获取。但是,目前正在运行的虚拟 HUB 没有必要指定。如果指定了目前没有工作,或不存在的虚拟 HUB,当它开始虚拟工作时,虚拟 3 层交换机将被激活。 +CMD_RouterIfAdd_IP 按照 [IP 地址/子网掩码] 的格式,设定新添加的接口的的 IP 地址和子网掩码。IP 地址为 192.168.0.1,10 进制,以点区分。子网掩码 255.255.255.0 以点区分,10 进制,也可以设定为如 24 这样的字节数用 10 进制来表示。 +CMD_RouterIfAdd_PROMPT_NAME 虚拟 3 层交换机的名称: +CMD_RouterIfAdd_PROMPT_HUB 虚拟接口连接到虚拟 HUB 名称: +CMD_RouterIfAdd_PROMPT_IP IP 地址/子网掩码: + + +# RouterIfDel 命令 +CMD_RouterIfDel 删除虚拟 3 层交换机的虚拟远程接口 +CMD_RouterIfDel_Help 删除在指定虚拟交换机中已定义的虚拟接口。\n对当前定义的虚拟接口列表,可以通过 RouterIfList 命令得到。\n要运行此命令,需要 VPN Server 管理员权限。\n此外,此命令不能在 VPN Bridge 中运行。\n要运行此命令,虚拟 3 层转化及必须在停止状态。如果不是,可以通过 RouterStop 指令使其停止。 +CMD_RouterIfDel_Args RouterIfDel [name] [/HUB:hub] +CMD_RouterIfDel_[name] 指定虚拟 3 层交换机的名称。 +CMD_RouterIfDel_HUB 指定虚拟接口所连接的虚拟 HUB 的名称。 + + +# RouterTableList 命令 +CMD_RouterTableList 获取虚拟 3 层交换机的路由列表 +CMD_RouterTableList_Help 在指定的虚拟 3 层交换机中,如果有路由表已定义,可以获取一个路由表的列表。\n虚拟 3 层交换机的IP 路由引擎,当 IP 数据包的 IP 地址不属于任一个虚拟接口时,将参照这个路由表。\n要运行此命令,VPN Server 需要管理员权限。\n此外,此命令不能在 VPN Bridge 中运行。 +CMD_RouterTableList_Args RouterTableList [name] +CMD_RouterTableList_[name] 指定虚拟 3 层交换机的名称。 +CMD_RouterTableList_PROMPT_NAME 虚拟 3 层交换机的名称: + + +# RouterTableAdd 命令 +CMD_RouterTableAdd 添加一个路由表项到虚拟 3 层交换机 +CMD_RouterTableAdd_Help 指定新的虚拟 3 层交换机的路由表并添加一个新的路由表项。\n虚拟 3 层交换机操作 IP 路由引擎时,IP 数据包的目的 IP 地址不属于任何 IP 接口时,可以参照路由表进行操作。\n向虚拟 3 层交换机中添加的路由表项内容必须指定。作为网关,在虚拟 3 层交换机的虚拟接口中,有至少一个属于同一 IP 网络的 IP 地址相同。\n要运行此命令,VPN Server 需要管理员权限。\n此外,此命令不能在 VPN Bridge 中运行。\n要运行此命令虚拟 3 层交换机必须处于停止噢国内工作状态。如果不在停止状态,可以执行 RouterStop 命令令其处于暂停。 +CMD_RouterTableAdd_Args RouterTableAdd [name] [/NETWORK:ip/mask] [/GATEWAY:gwip] [/METRIC:metric] +CMD_RouterTableAdd_[name] 指定虚拟 3 层交换机的名称。 +CMD_RouterTableAdd_NETWORK 按照 [IP 地址/子网掩码] 的格式,设置新添加的路由表的网络地址和子网掩码。网络地址,如 192.168.0.1 的格式,由点分隔,10 进位制。子网掩码如 255.255.255.0,用点分隔,10 进位制,或者像 24 这样从开头 10 进位设定字节数。位长度可为十进制数指定的分隔十进制数字。 如 0.0.0.0/0.0.0.0 将格式设定好,默认为根。 +CMD_RouterTableAdd_GATEWAY 指定网关的 IP 地址。 +CMD_RouterTableAdd_METRIC 指定度量的值。请使用一个以上的整数。 +CMD_RouterTableAdd_PROMPT_NAME 虚拟 3 层交换机的名称: +CMD_RouterTableAdd_PROMPT_NETWORK 网络地址/子网掩码: +CMD_RouterTableAdd_PROMPT_GATEWAY 网关: +CMD_RouterTableAdd_PROMPT_METRIC 公制值: + + +# RouterTableDel 命令 +CMD_RouterTableDel 删除虚拟 3 层交换机的路由表项 +CMD_RouterTableDel_Help 指定在虚拟 3 层交换机上已定义的路由表项,进行删除。\n已定义的路由表项名单,可通过 RouterTableList 命令获取。\n要运行此命令,需要 VPN Server 管理员权限。\n此外,此命令不能在 VPN Bridge 中运行。\n要运行此命令要求虚拟 3 层转换机处于停止状态。如果没有处于停止状态,可以执行 RouterStop 命令,让其暂停。 +CMD_RouterTableDel_Args RouterTableDel [name] [/NETWORK:ip/mask] [/GATEWAY:gwip] [/METRIC:metric] +CMD_RouterTableDel_[name] 指定虚拟 3 层交换机的名称。 +CMD_RouterTableDel_NETWORK 按照 [IP 地址/子网掩码] 的格式,选定拟删除的路由表项的网络地址。 +CMD_RouterTableDel_GATEWAY 指定网关的 IP 地址。 +CMD_RouterTableDel_METRIC 指定度量的值。请使用一以上整数。 + + +# LogFileList 命令 +CMD_LogFileList 获取日志文件列表 +CMD_LogFileList_Help 您可以将保存在 VPN Server 上,并有服务器输出的日志文件显示成一个输出列表。通过指定一个文件名,运用 LogFileGet 命令,可以下载该日志文件的内容。\n如果 VPN Server 在管理模式下,所有的虚拟 HUB 的数据包日志,安全日志,VPN Server 日志允许您查看或下载。\n如果虚拟 HUB 在管理模式下,并处于连接状态,可以查看或下载该数据包日志和安全日志。 +CMD_LogFileList_Args LogFileList +CMD_LogFileList_START 正在获取一个日志文件的列表。这可能需要一些时间。请稍候... +CMD_LogFileList_NUM_LOGS 共有 %u 个日志文件。 + + +# LogFileGet 命令 +CMD_LogFileGet 日志文件下载 +CMD_LogFileGet_Help 下载 VPN Server 上存储的日志文件。要下载日志文件,先用 LogFileList 命令获取日志文件列表,然后您就可以执行 LogFileGet 命令来下载。如果与 VPN Server 连接并处于管理模式,所有的虚拟 HUB 的数据包日志,安全日志,VPN Server 允许您查看或下载。如果正在连接的虚拟 HUB 处于管理模式,HUB 管理的虚拟数据包日志,安全日志可查阅,也可以下载。\n如果您指定一个作为参数作为文件名,下载的日志文件将被保存为这个文件名。如果你不指定文件将显示在屏幕上。\n日志文件的大小有可能非常巨大的,所以一定要小心。 +CMD_LogFileGet_Args LogFileGet [name] [/SERVER:server] [/SAVEPATH:savepath] +CMD_LogFileGet_[name] 选定要下载的日志文件名。运行 LogFileList 命令,可以得到一个日志文件的名称列表。 +CMD_LogFileGet_SERVER 如果您要从群集控制器中下载,请指定保存日志文件的服务器名称。运行 LogFileGet 指令可以获得指定服务器。 +CMD_LogFileGet_SAVEPATH 如果你想保存下载的日志文件,请指定文件名。如果没有指定,将显示在屏幕上。 +CMD_LogFileGet_PROMPT_NAME 下载的日志文件名: +CMD_LogFileGet_START 正在下载日志文件。这可能需要一些时间。请稍候... +CMD_LogFileGet_FAILED 下载失败。 +CMD_LogFileGet_SAVE_FAILED 无法写入指定的文件。 +CMD_LogFileGet_FILESIZE 日志文件的大小: %u + + +# HubCreate 命令 +CMD_HubCreate 创建新的虚拟 HUB +CMD_HubCreate_Help 在 VPN Server 上创建一个新的虚拟 HUB。\n创建的虚拟 HUB 将立即开始工作。\n当 VPN Server,在一个群集中运行,此命令仅对群集控制器有效。新的虚拟 HUB,将作为一个动态的虚拟 HUB。应用 HubSetStatic 命令也可将虚拟 HUB 改为静态的。要想获取已经存储在 VPN Server 上的 HUB,可以运行 HubList 命令获得列表。\n要运行此命令,需要 VPN Server 管理员权限。\n此外,此命令在 VPN Bridge 和群集管理服务器中不起作用。\n在群集上创建虚拟群集控制器 HUB 时,请运行 HubCreateStatic 或者 HubCreateDynamic 命令。(对群集控制器操作时,HubCreate 和 HubCreateDynamic就有相同的功能)。 +CMD_HubCreate_Args HubCreate [name] [/PASSWORD:password] +CMD_HubCreate_[name] 指定新创建的枢纽虚拟名称。 +CMD_HubCreate_PASSWORD 如果您设置的虚拟 HUB 需要密码,请指定管理员密码。否则,会提示您输入。 +CMD_HubCreate_PROMPT_NAME 新创建的虚拟 HUB 的名字: + + +# HubCreateDynamic 命令 +CMD_HubCreateDynamic 创建一个新的动态虚拟 HUB (集群) +CMD_HubCreateDynamic_Help 在 VPN Server 上创建新的动态虚拟 HUB。\n创建的虚拟 HUB 将立即开始工作。\nVPN Server,在一个群集中运行时,此命令仅对群集控制器有效。新的虚拟 HUB,将作为一个虚拟的动态 HUB。运行 HubSetStatic 命令可以将虚拟 HUB 可以改为静态的。运行 HubList 命令可以获取当前虚拟 HUB 的列表。\n要运行此命令,VPN Server 需要管理员权限。\n此外,此命令在 VPN Bridge,群集管理器,独立的服务器在 VPN Server 工作时不起作用。 +CMD_HubCreateDynamic_Args HubCreateDynamic [name] [/PASSWORD:password] +CMD_HubCreateDynamic_[name] 指定新创建的虚拟 HUB 的名称。 +CMD_HubCreateDynamic_PASSWORD 如果您设置虚拟 HUB 管理密码,请指定管理员密码。否则,会提示您输入。 + + +# HubCreateStatic 命令 +CMD_HubCreateStatic 新创建一个静态虚拟 HUB (集群用) +CMD_HubCreateStatic_Help 在 VPN Server 上创建一个新的静态虚拟 HUB。\n创建的虚拟 HUB 将立即开始工作。\nVPN Server 在一个群集中运行时,此命令仅对群集控制器有效。新创建的虚拟 HUB,为一个虚拟的动态 HUB。运行 HubSetStatic 命令可以将虚拟 HUB 改为静态的。如果想得到已经保存在 VPN Server 上的 HUB 列表,可以运行 HubList 命令。\n要运行此命令,VPN Server 需要管理员权限。\n此外,此命令在 VPN Bridge,群集管理器,独立的服务器在 VPN Server 工作时不起作用。 +CMD_HubCreateStatic_Args HubCreateStatic [name] [/PASSWORD:password] +CMD_HubCreateStatic_[name] 指定新创建的虚拟 HUB 的名称。 +CMD_HubCreateStatic_PASSWORD 如果您设置虚拟 HUB 管理密码,请指定管理员密码。否则,会提示您输入。 + + +# HubDelete 命令 +CMD_HubDelete 删除虚拟 HUB +CMD_HubDelete_Help 删除 VPN Server 上现有的虚拟 HUB。\n当您删除虚拟 HUB 后,所有的程序连接将断开,新的程序将不能与它连接。\n虚拟 HUB 的所有的设置,用户选项,组选项,证书设置和级联将被删除。\n虚拟 HUB 被删除后,将不能恢复。\n运行此命令,需要 VPN Server 管理员权限。\n此外,此命令在 VPN Bridge,群集管理器,独立的服务器在 VPN Server 工作时不起作用。 +CMD_HubDelete_Args HubDelete [name] +CMD_HubDelete_[name] 定要删除的虚拟 HUB 名称。 +CMD_HubDelete_PROMPT_NAME 删除的虚拟 HUB 名称: + + +# HubSetStatic 命令 +CMD_HubSetStatic 将虚拟 HUB 的类型变为静态虚拟型 +CMD_HubSetStatic_Help 使用 VPN Server 运行在群集上时,将虚拟 HUB 类型设定为静态虚拟 HUB。当虚拟 HUB 类型改变时,所有的程序连接将被暂时中断。 \n当作为静态虚拟 HUB 工作时,所有的群集成员的服务器上,将生成该名称的虚拟 HUB。每个尝试连接这个虚拟 HUB 的用户,基于各自服务器的负荷状况,确定与这个群集某个成员的连接。\n静态虚拟 HUB,举例说,一个企业从互联网上访问局域网,允许数千或数以万计的用户远程访问 VPN Server。\n要执行这个命令,您必须有 VPN Server 管理员权限。\n此外,此命令在 VPN Bridge,群集管理器,独立的服务器在 VPN Server 工作时不起作用。\n此命令不能用于比 5190 更新的服务器。 +CMD_HubSetStatic_Args HubSetStatic [name] +CMD_HubSetStatic_[name] 选定拟变更成静态虚拟 HUB 的名称。 +CMD_HubChange_PROMPT_NAME 变更设置的虚拟 HUB 名称: + + +# HubSetDynamic 命令 +CMD_HubSetDynamic 将虚拟 HUB 的类型变为动态虚拟型 +CMD_HubSetDynamic_Help 使用 VPN Server 运行在群集上时,将虚拟 HUB 类型变更为动态。当虚拟 HUB 类型改变时,所有的程序连接会暂时被中断。\n当该虚拟 HUB 上没有任何成员时,虚拟 HUB 在任何群集上都不存在。当第一个客户端试图连接到动态的虚拟 HUB 时,负荷最低的服务器启动,托管虚拟 HUB。当第二个和随后的客户端试图连接到同一个虚拟 HUB,它们会自动连接到服务器托管的虚拟 HUB。当所有的客户都从一个特定的动态虚拟 HUB 断开,服务器上将不存在任何实体。\n动态虚拟 HUB 的应用很广泛,例如,公司内部每个部门定应一个虚拟 HUB,让员工可以连接到自己所属的虚拟枢纽部门来操作,从而实现集中管理。\n要执行这个命令,您必须有 VPN Server 管理员权限。\n此外,此命令在 VPN Bridge,群集管理器,独立的服务器在 VPN Server 工作时不起作用。\n此命令不能用于比 5190 更新的服务器。 +CMD_HubSetDynamic_Args HubSetDynamic [name] +CMD_HubSetDynamic_[name] 指定拟转变为动态虚拟 HUB 的名称。 + + +# HubList 命令 +CMD_HubList 获取一个虚拟 HUB 列表 +CMD_HubList_Help 在 VPN Server 中获得虚拟 HUB 的清单。对于每一个虚拟 HUB,可以获得 [虚拟 HUB 名称],[状态],[类型],[用户数量],[群数量],[访问数量],[MAC 目录的数量],[IP 目录数],[登陆次数],[上次登录],[最终通信时间]。\n但是,如果处于连接状态的虚拟 HUB 在管理模式下,对于匿名用户如果设定为不列举虚拟 HUB,则虚拟 HUB 不会被显示。如果您连接到服务器的管理模式,则所有的虚拟 HUB 会显示清单。\n如果你连接到群集控制器以外的其他群集成员,VPN Server 只显示虚拟 HUB 的托管虚拟主机。如果您连接到群集控制器来管理群集,所有虚拟 HUB 将显示。 +CMD_HubList_Args HubList + + +# Hub 命令 +CMD_Hub 选择拟管理的虚拟 HUB +CMD_Hub_Help 选择拟管理的虚拟 HUB。在 VPN Server 中,对目标虚拟 HUB 实行配置管理之前,需要用选择命令选定虚拟 HUB。\n当正在连接的 VPN Server 处于管理虚拟 HUB 模式时,您可以选定拟管理的一个虚拟 HUB,而不可以选择其他的虚拟 HUB。与正在连接的 VPN Server 处于服务器管理模式,可以对所有的虚拟 HUB 进行管理。\n获取当前的虚拟 HUB 列表,可以执行 HubList 命令。\n在 VPN Bridge 中,只可以选择名字中带 "BRIDGE" 的虚拟 HUB。 +CMD_Hub_Args Hub [name] +CMD_Hub_[name] 选定拟管理的虚拟 HUB 的名称。如果您没有指定参数,目标虚拟 HUB 的选定将被清除。 +CMD_Hub_Unselected 取消已经选定的虚拟 HUB。 +CMD_Hub_Selected 选择虚拟 HUB "%S"。 +CMD_Hub_Select_Failed /ADMINHUB 在虚拟 HUB 中想要选择 "%S" 发生了以下的错误。 +CMD_Hub_Not_Selected 在运行此命令之前,运用 HUB 管理命令选择目标管理虚拟 HUB。 + + +# Online 命令 +CMD_Online 虚拟 HUB 的联机 +CMD_Online_Help 如果您正在管理的虚拟 HUB 处于脱机状态,请设置成联机。处于脱机状态的虚拟 HUB,不会接受来自 VPN Client 连接。将虚拟 HUB 设定成联网状态,从而可以接受用户的虚拟连接并提供服务。\n此命令,在 VPN Bridge 中不会运行。\n此命令在 VPN Server 中的虚拟集群 HUB 中不能运行。 +CMD_Online_Args Online + + +# Offline 命令 +CMD_Offline 虚拟 HUB 脱机 +CMD_Offline_Help 如果您正在管理的虚拟 HUB 在线,设置成脱机。虚拟 HUB 如果有连接程序,将全部断开。虚拟 HUB 处于脱机状态,不会接受来自 VPN Client 连接。\n此命令,在 VPN Bridge 中不会运行。\n此命令在 VPN Server 中的虚拟集群 HUB 中不能运行。 +CMD_Offline_Args Offline + + +# SetMaxSession 命令 +CMD_SetMaxSession 设定虚拟 HUB 的最大同时在线用户数量 +CMD_SetMaxSession_Help 设定现在正在管理的虚拟 HUB 的最大同时在线客户数量。当超过这个数量时,如果从 VPN Client 和 VPN Bridge 连接的时候,超过了最大并发会话数,更多的客户将无法连接。最大同时在线客户数的限制不包括本地的网桥,虚拟的 NAT,级联连接等生成连接不包括在内。\n设置同时在线最大数目,可以通过运行 OptionsGet 命令获得。\n此命令,在 VPN Bridge 中不会运行。\n此命令在集群虚拟 HUB 中不能运行。 +CMD_SetMaxSession_Args SetMaxSession [max_session] +CMD_SetMaxSession_[max_session] 设置最大同时在线客户数,使用整数。当您指定为 0 时,客户数没有限制。 +CMD_SetMaxSession_Prompt 最大同时在线客户数: + + +# SetHubPassword 命令 +CMD_SetHubPassword 设置虚拟 HUB 的管理密码 +CMD_SetHubPassword_Help 设置目前正在管理的虚拟 HUB 的管理密码。虚拟 HUB,如果设置了管理密码,您可以应用管理密码,虚拟 HUB,VPN Server 的公用事业,虚拟 HUB 连接,您可以通过指定一个连接密码在虚拟 HUB 的管理模式下实现连接。此外,通过 VPN Client 和 VPN Bridge,用户名用 "Administrator" 通过管理员密码,也可以实现连接。\n此命令,不能在 VPN Bridge 中运行。\n此命令在集群虚拟 HUB 中不能运行。 +CMD_SetHubPassword_Args SetHubPassword [password] +CMD_SetHubPassword_[password] 设定密码。如果您不指定将被提示输入密码。 + + +# SetEnumAllow 命令 +CMD_SetEnumAllow 设定虚拟 HUB 允许向匿名用户显示。 +CMD_SetEnumAllow_Help 变更虚拟 HUB 的控制选项,对于匿名用户,允许虚拟 HUB 显示。当您设置了此选项,VPN Client 的用户,在 VPN Server 只需输入地址即可显示虚拟 HUB。虚拟 HUB 一创建成功,即可显示。此外,如果执行 SetEnumDeny 命令,可以禁止向匿名用户显示。虚拟 HUB 是在统计创建时设定允许显示与否。\n此命令,在 VPN Bridge 中不会运行。\n此命令在集群虚拟 HUB 中不能运行。 +CMD_SetEnumAllow_Args SetEnumAllow + + +# SetEnumDeny 命令 +CMD_SetEnumDeny 设定虚拟 HUB 禁止向匿名用户显示。 +CMD_SetEnumDeny_Help 变更虚拟 HUB 的控制选项,对于匿名用户,禁止虚拟 HUB 显示。当您设置了此选项,VPN Client 的用户,在 VPN Server 输入检索虚拟 HUB,虚拟 HUB 也不会显示。此外,如果执行 SetEnumAllow 命令,可以允许向匿名用户显示。虚拟 HUB 是在统计创建时设定允许显示与否。\n此命令,在 VPN Bridge 中不会运行。\n此命令在集群虚拟 HUB 中不能运行。 +CMD_SetEnumDeny_Args SetEnumDeny + + +# OptionsGet 命令 +CMD_OptionsGet 获得虚拟 HUB 的设置选项 +CMD_OptionsGet_Help 获取虚拟 HUB 的选项设置清单。虚拟 HUB 允许 / 禁止显示设置,最大的同时在线数量,在线 / 离线状态,和集群虚拟环境中 HUB 的类型。\n此命令对于一个虚拟集群 HUB 不能运行。 +CMD_OptionsGet_Args OptionsGet +CMD_OptionsGet_TITLE 虚拟 HUB "%S" 设置选项列表 +CMD_OptionsGet_ENUM 对于匿名用户的虚拟 HUB 的显示 +CMD_OptionsGet_MAXSESSIONS 最大同时在线客户数 +CMD_OptionsGet_STATUS 状态 +CMD_OptionsGet_TYPE 虚拟 HUB 的类型 + + + +# RadiusServerSet 命令 +CMD_RadiusServerSet 使用在用户认证中使用的 RADIUS 服务器设置 +CMD_RadiusServerSet_Help 接受用户当前以 RADIUS 服务器认证模式管理虚拟 HUB ,你需指定外部 RADIUS 服务器,以确认用户名和密码(您可以指定多个主机名,并将它们用逗号或者分号隔开)。\nRadius 服务器必须设置为接受来自 VPN Server IP 地址的请求。此外,密码认证协议(PAP)的认证必须被启用。\n此命令不能在 VPN Bridge 上运行。\n此命令在 VPN Server 以集群运行的虚拟 HUB 上不能运行。 +CMD_RadiusServerSet_Args RadiusServerSet [server_name:port] [/SECRET:secret] [/RETRY_INTERVAL:interval] +CMD_RadiusServerSet_[server_name:port] 用 [主机名:端口号] 的格式,指定 RADIUS 服务器的主机名,IP 地址和 UDP 端口号。如果省略端口号则用 1812。您可以指定多个主机名,并将它们用逗号或者分号隔开。 +CMD_RadiusServerSet_SECRET 设置与 RADIUS 服务器之间的通信 (密码)。 +CMD_RadiusServerSet_RETRY_INTERVAL 用毫秒指定重试间隔。 +CMD_RadiusServerSet_Prompt_Host 使用 RADIUS 服务器的主机名和端口号: +CMD_RadiusServerSet_Prompt_Secret 共享秘密: +CMD_RadiusServerSet_Prompt_RetryInterval 重试间隔 (毫秒): +CMD_RadiusServerSet_EVAL_NUMINTERVAL 重试间隔为 500 毫秒到 10000 毫秒。 + + +# RadiusServerDelete 命令 +CMD_RadiusServerDelete 删除应用于用户认证的 RADIUS 服务器设置 +CMD_RadiusServerDelete_Help 目前,正在管理的虚拟 HUB,用户以 RADIUS 服务器认证模式连接时,删除外部 RADIUS 服务器设定,使服务器不能验证。目前 RADIUS 服务器的设置,可以运行 RadiusServerGet 命令获得。\n此命令,虚拟 VPN Bridge 中不能运行。\n此命令在集群虚拟 HUB 中不能运行。 +CMD_RadiusServerDelete_Args RadiusServerDelete + + +# RadiusServerGet 命令 +CMD_RadiusServerGet 获取用于用户认证的 RADIUS 服务器设置 +CMD_RadiusServerGet_Help 用户使用 RADIUS 服务器身份验证模式连接到现在管理的虚拟 HUB,您可以获取 RADIUS 服务器的当前设置。\n此命令,在虚拟 VPN Bridge 中不能运行。\n此命令在集群虚拟 HUB 中不能运行。 +CMD_RadiusServerGet_Args RadiusServerGet +CMD_RadiusServerGet_STATUS RADIUS 服务器的使用 +CMD_RadiusServerGet_HOST RADIUS 服务器主机名或 IP 地址 +CMD_RadiusServerGet_PORT RADIUS 服务器的端口号 +CMD_RadiusServerGet_SECRET 共享秘密 +CMD_RadiusServerGet_RetryInterval 重试间隔 (毫秒) + + +# StatusGet 命令 +CMD_StatusGet 获取虚拟 HUB 的当前状况 +CMD_StatusGet_Help 获取正在管理的虚拟 HUB 的当前状况,可以获得虚拟 HUB 的种类,连接数量,各种目标数,登陆次数,最后一次登陆时间,最终连接时间,通信的统计数据等。 +CMD_StatusGet_Args StatusGet + + +# LogGet 命令 +CMD_LogGet 获取虚拟 HUB 日志的保存设定 +CMD_LogGet_Help 获取虚拟 HUB 日志的保存设置。获取安全日志和数据包日志的保存设定,保存对象等信息。 +CMD_LogGet_Args LogGet +CMD_Log_SecurityLog 保存安全日志 +CMD_Log_PacketLog 保存数据包日志 +CMD_Log_SwitchType 日志文件的替换周期 +CMD_Log_0 TCP 连接日志 +CMD_Log_1 TCP 数据包日志 +CMD_Log_2 DHCP 日志 +CMD_Log_3 UDP 日志 +CMD_Log_4 ICMP 日志 +CMD_Log_5 IP 日志 +CMD_Log_6 ARP 日志 +CMD_Log_7 以太网日志 + + +# LogEnable 命令 +CMD_LogEnable 启用安全日志或数据包日志 +CMD_LogEnable_Help 启用现在正在管理的 HUB 的安全日志或数据包日志。\n当前的设置,可以通过 LogGet 命令获得。 +CMD_LogEnable_Args LogEnable [security|packet] +CMD_LogEnable_[security|packet] 选择启用日志文件的类型。选定 "security" 或 "packet"。 +CMD_LogEnable_Prompt 选择安全或数据包: +CMD_LogEnable_Prompt_Error 选择不正确。 + + +# LogDisable 命令 +CMD_LogDisable 禁用安全日志或数据包日志 +CMD_LogDisable_Help 禁止使用现在正在管理的 HUB 的安全日志或数据包日志。\n当前的设置,可以通过 LogGet 命令获得。 +CMD_LogDisable_Args LogDisable [security|packet] +CMD_LogDisable_[security|packet] 选择禁用日志文件的类型。选定 "security" 或 "packet"。 + + +# LogSwitchSet 命令 +CMD_LogSwitchSet 设定替换日志文件的周期 +CMD_LogSwitchSet_Help 设定现在管理的虚拟 HUB 所保存的安全日志或数据包日志文件的替换周期。替换日志文件的时间是可以设定为 1 秒,1 分钟,1 小时,每天,每月,您也可以设定为不替换。\n当前的设置,可以通过 LogGet 命令获得。 +CMD_LogSwitchSet_Args LogSwitchSet [security|packet] [/SWITCH:sec|min|hour|day|month|none] +CMD_LogSwitchSet_[security|packet] 选择变更设定的日志文件的类型。 选定 "security" 或 "packet"。 +CMD_LogSwitchSet_SWITCH 设置替换周期。从 sec,min,hour,day,month,none 中选择。 +CMD_LogSwitchSet_Prompt 从 sec,min,hour,day,month,none 中选择: + + +# LogPacketSaveType 命令 +CMD_LogPacketSaveType 设置保存为数据包日志文件的数据包种类及保存。 +CMD_LogPacketSaveType_Help 逐项设定保存在在管理的虚拟 HUB 上的,数据包保存内容和数据包的类型。数据包类型包括,[TCP 连接日志],[TCP 数据包日志],[DHCP 数据包记录],[UDP 数据包日志],[ICMP 数据包日志],[IP 数据包日志],[ARP 数据包日志],[以太网数据包日志] 等。\n要想获取当前的设置,可以运行 LogGet 命令。 +CMD_LogPacketSaveType_Args LogPacketSaveType [/TYPE:tcpconn|tcpdata|dhcp|udp|icmp|ip|arp|ether] [/SAVE:none|header|full] +CMD_LogPacketSaveType_TYPE 保存内容对应的数据包类型,从 tcpconn,tcpdata,dhcp,udp,icmp,ip,arp,ether 中选定。 +CMD_LogPacketSaveType_SAVE 设定日志文件的保存内容。从下列选定:\nnone: 不保存\nheader: 仅保存标题\nfull: 所有数据包 +CMD_LogPacketSaveType_Prompt_TYPE 选定 tcpconn, tcpdata, dhcp, udp, icmp, ip, arp, ether: +CMD_LogPacketSaveType_Prompt_SAVE 选定 none, header, full: + + +# CAList 命令 +CMD_CAList 获取可以信任的机构颁发证书的列表 +CMD_CAList_Help 管理可以信任的机构颁发的证书。VPN Client 如果用认证模式连接时,可以用保存的证书来验证其提供的证书。\n此命令,在虚拟 VPN Bridge 中不能运行。\n此命令在集群虚拟 HUB 中不能运行。 +CMD_CAList_Args CAList +CMD_CAList_COLUMN_ID ID + + +# CAAdd 命令 +CMD_CAAdd 添加可以信任的机构颁发的证书 +CMD_CAAdd_Help 在虚拟 HUB 管理的可信任的证书颁发机构的证书列表中,添加一个新的证书。如果客户端使用签名认证模式连接,管理中的证书将用来识别客户的证书。\n要取得当前的证书列表,可以执行 CAList 命令。\n要添加一个证书,必须将证书保存为 X.509 格式保存。\n此命令,在虚拟 VPN Bridge 中不能运行。\n此命令在集群虚拟 HUB 中不能运行。 +CMD_CAAdd_Args CAAdd [path] +CMD_CAAdd_[path] 指定注册 X.509 证书的文件名。 +CMD_CAAdd_PROMPT_PATH 注册 X.509 证书文件的名称: + + +# CADelete 命令 +CMD_CADelete 删除可以信任的机构颁发的证书 +CMD_CADelete_Help 从正在管理的可信任机构颁发的证书列表中,删除现有的证书。\n如果要获取当前的证书列表,可以执行 CAList 命令。\n此命令,在虚拟 VPN Bridge 中不能运行。\n此命令在集群虚拟 HUB 中不能运行。 +CMD_CADelete_Args CADelete [id] +CMD_CADelete_[id] 指定拟删除的证书的 ID。 +CMD_CADelete_PROMPT_ID 拟删除证书的 ID: + + +# CAGet 命令 +CMD_CAGet 获得可信任机构颁发的证书。 +CMD_CAGet_Help 获取虚拟 HUB 目前管理的可信任机构颁布的证书的列表,并将其保存为 X.509 的文件格式。\n此命令,在虚拟 VPN Bridge 中不能运行。\n此命令在集群虚拟 HUB 中不能运行。 +CMD_CAGet_Args CAGet [id] [/SAVECERT:path] +CMD_CAGet_[id] 制定获得证书的 ID。 +CMD_CAGet_SAVECERT 指定文件名以保存获取的证书。 +CMD_CAGet_PROMPT_ID 获得证书 ID: +CMD_CAGet_PROMPT_SAVECERT 保存文件名: + + +# CascadeList 命令 +CMD_CascadeList 获取级联接续列表 +CMD_CascadeList_Help 获取当前虚拟 HUB 上登记的级联名单。\n如果您使用虚拟 HUB 级联同一台或另一个虚拟机上的 HUB,这两个层可以级联。\n\n[使用级联的警告]\n如果您使用级联多个虚拟 HUB 可以构成 2 层的网桥,如果连接方法错误可能会将连接做成绳状。所以使用级联功能,一定要精心设计。\n此命令在集群虚拟 HUB 中不能运行。 +CMD_CascadeList_Args CascadeList + + +# CascadeCreate 命令 +CMD_CascadeCreate 创建一个新的级联接续 +CMD_CascadeCreate_Help 在当前虚拟 HUB 上创建一个新的级联接续。\n如果您使用虚拟 HUB 级联同一个或者另一个虚拟 HUB,可以建立级联接续。\n要创建一个级联,作为初始参数,需设定级联的名称,连接的服务器,目标 HUB 的名称和用户名。创建一个新的级联时,用户身份验证类型被初始化为 [匿名认证],代理服务器和服务器证书验证未设置。要更改这些设置,请在创建一个级联之后用 "Cascade" 命名的指令来执行。\n\n[使用级联的警告]\n如果您使用级联多个虚拟 HUB 可以构成 2 层的网桥,如果连接方法错误可能会将连接做成绳状。所以使用级联功能,一定要精心设计。\n此命令在集群虚拟 HUB 中不能运行。 +CMD_CascadeCreate_Args CascadeCreate [name] [/SERVER:hostname:port] [/HUB:hubname] [/USERNAME:username] +CMD_CascadeCreate_[name] 指定新创建级联的名称。 +CMD_CascadeCreate_SERVER 按照 [主机名:端口号] 的格式,设置 VPN Server 的主机名和端口号,您也可以指定 IP 地址。 +CMD_CascadeCreate_HUB 选定目标 VPN Server 内的虚拟 HUB。 +CMD_CascadeCreate_USERNAME 设定连接到 VPN Server 时所须的用户名认证名称。 +CMD_CascadeCreate_Prompt_Name 级联接续的名称: +CMD_CascadeCreate_Prompt_Server 目标 VPN Server 的主机名和端口号: +CMD_CascadeCreate_Prompt_Hub 目标虚拟 HUB 名称: +CMD_CascadeCreate_Prompt_Username 连接使用的用户名: + + +# CascadeSet 命令 +CMD_CascadeSet 对级联连接方的设定 +CMD_CascadeSet_Help 对于虚拟 HUB 目前管理的已经连接的级联,设置连接方的 VPN 主机名和端口号,虚拟 HUB 名,用户名等。\n此命令在集群虚拟 HUB 中不能运行。 +CMD_CascadeSet_Args CascadeSet [name] [/SERVER:hostname:port] [/HUB:hubname] +CMD_CascadeSet_[name] 指定级联名称来改变设置。 +CMD_CascadeSet_SERVER 按照 [主机名:端口号] 的格式,设置连接方 VPN Server 的主机名和端口号。您也可以指定 IP 地址。 +CMD_CascadeSet_HUB 设置连接方 VPN Server 内的虚拟 HUB。 + + +# CascadeGet 命令 +CMD_CascadeGet 获取级联连接的设置 +CMD_CascadeGet_Help 获取当前在虚拟 HUB 上注册的级联的连接设置。\n另外,要改变级联的连接设置,可以在您创建一个级联后使用 "Cascade" 开头的命令。\n此命令在集群虚拟 HUB 中不能运行。 +CMD_CascadeGet_Args CascadeGet [name] +CMD_CascadeGet_[name] 指定级联获取它的连接设置。 +CMD_CascadeGet_Policy [级联连接的安全策略设置值] + +# CascadeDelete 命令 +CMD_CascadeDelete 删除级联连接 +CMD_CascadeDelete_Help 删除目前在虚拟 HUB 中注册的级联连接。如果选定的级联连接处于联机状态,则先断开连接,然后删除。\n此命令在集群虚拟 HUB 中不能运行。 +CMD_CascadeDelete_Args CascadeDelete [name] +CMD_CascadeDelete_[name] 指定您想删除的级联连接的名称。 + + +# CascadeUsernameSet 命令 +CMD_CascadeUsernameSet 设置级联连接的用户名 +CMD_CascadeUsernameSet_Help 选定已在虚拟 HUB 上注册的级联,设定其用户名,当连接到 VPN Server 时,用此用户名来进行身份验证。\n此外,您可以指定用户身份验证的种类,或可以指定所需的参数。如果您想更改这些设置,可以运行 CascadeAnonymousSet,CascadePasswordSet,CascadeCertSet 等命令。\n此命令在集群虚拟 HUB 中不能运行。 +CMD_CascadeUsernameSet_Args CascadeUsernameSet [name] [/USERNAME:username] +CMD_CascadeUsernameSet_[name] 指定级联名称来改变设置。 +CMD_CascadeUsernameSet_USERNAME 级联连接到 VPN Server 时,指定用户名要求用户进行身份验证。 +CMD_CascadeUsername_Notice 连接身份验证,是在密码验证中设置的。用户名变更之后,需要用 CascadePasswordSet 指令重新设置密码。 + + +# CascadeAnonymousSet 命令 +CMD_CascadeAnonymousSet 将级联连接的用户认证类型设置为匿名身份验证 +CMD_CascadeAnonymousSet_Help 选定虚拟 HUB 中已经注册的级联,将级联连接到 VPN Server 所需的用户身份验证方法设定为匿名身份验证。\n此命令在集群虚拟 HUB 中不能运行。 +CMD_CascadeAnonymousSet_Args CascadeAnonymousSet [name] +CMD_CascadeAnonymousSet_[name] 指定级联名称来改变设置。 + + +# CascadePasswordSet 命令 +CMD_CascadePasswordSet 将级联连接时所需的用户验证设置为密码验证 +CMD_CascadePasswordSet_Help 选定虚拟 HUB 中已经注册的级联,将级联连接到 VPN Server 所需的用户身份验证方法设定为密码验证。密码验证的种类指定为,[标准密码验证] 和 [RADIUS 或 NT域身份验证]。\n此命令在集群虚拟 HUB 中不能运行。 +CMD_CascadePasswordSet_Args CascadePasswordSet [name] [/PASSWORD:password] [/TYPE:standard|radius] +CMD_CascadePasswordSet_[name] 指定级联名称来改变设置。 +CMD_CascadePasswordSet_PASSWORD 指定密码验证所使用的密码。否则,会提示您输入密码。 +CMD_CascadePasswordSet_TYPE 密码验证的类型,指定为 "standard" (标准密码验证),或 "radius" (radius 或 NT 域身份验证)。 +CMD_CascadePasswordSet_Prompt_Type 指定 standard 或者 radius: +CMD_CascadePasswordSet_Type_Invalid 指定 standard 或者 radius 时出错。 + + +# CascadeCertSet 命令 +CMD_CascadeCertSet 将级联连接时所需的用户验证设置为客户证书验证 +CMD_CascadeCertSet_Help 选定虚拟 HUB 中已经注册的级联,将级联连接到 VPN Server 所需的用户身份验证方法设定为客户证书验证。证书应为 X.509 证书文件格式,并且用变换为 Base 64 密钥文件编码。\n此命令在集群虚拟 HUB 中不能运行。 +CMD_CascadeCertSet_Args CascadeCertSet [name] [/LOADCERT:cert] [/LOADKEY:key] +CMD_CascadeCertSet_[name] 指定级联名称来改变设置。 +CMD_CascadeCertSet_LOADCERT 选定 X.509 证书名称用来进行证书认证。 +CMD_CascadeCertSet_LOADKEY 选定与证书对应的 Base 64 编码的密钥文件。 + + +# CascadeCertGet 命令 +CMD_CascadeCertGet 获取级联连接所需的客户端证书 +CMD_CascadeCertGet_Help 指定当前在虚拟 HUB 上已注册的级联接续,如果您使用客户端证书身份验证,请获取证书,保存为 X.509 格式。\n此命令在集群虚拟 HUB 中不能运行。 +CMD_CascadeCertGet_Args CascadeCertGet [name] [/SAVECERT:cert] +CMD_CascadeCertGet_[name] 指定级联名称获取设置。 +CMD_CascadeCertGet_SAVECERT 获取证书指定文件名保存为 X.509 格式。 +CMD_CascadeCertSet_Not_Auth_Cert 指定的级联连接设置的认证方式不是证书认证模式。 +CMD_CascadeCertSet_Cert_Not_Exists 证书没有存储在所指定的级联连接设置中。 + + +# CascadeEncryptEnable 命令 +CMD_CascadeEncryptEnable 启用级联通信时加密 +CMD_CascadeEncryptEnable_Help 指定已经在当前虚拟 HUB 注册的级联连接,当此连接和 VPN Server 之间通信时,设置通信内容为 SSL 加密。\n通常情况下,和 VPN Server 的通信进行 SSL 加密,以防止窃听和篡改信息。您还可以禁用加密。如果您禁用加密,通信的流速将提高,传输数据以明文传输到网络上。\n此命令在集群虚拟 HUB 中不能运行。 +CMD_CascadeEncryptEnable_Args CascadeEncryptEnable [name] +CMD_CascadeEncryptEnable_[name] 指定级联名称来改变设置。 + + +# CascadeEncryptDisable 命令 +CMD_CascadeEncryptDisable 级联连接通信时,禁用加密 +CMD_CascadeEncryptDisable_Help 指定已经在当前虚拟 HUB 注册的级联连接,当此连接和 VPN Server 之间通信时,设置通信内容为禁止加密。\n通常情况下,和 VPN Server 的通信进行 SSL 加密,以防止窃听和篡改信息。您还可以禁用加密。如果您禁用加密,通信的流速将提高,传输数据以明文传输到网络上。\n此命令在集群虚拟 HUB 中不能运行。 +CMD_CascadeEncryptDisable_Args CascadeEncryptDisable [name] +CMD_CascadeEncryptDisable_[name] 指定级联名称来改变设置。 + + +# CascadeCompressEnable 命令 +CMD_CascadeCompressEnable 启用级联通信是数据压缩功能 +CMD_CascadeCompressEnable_Help 指定已经在当前虚拟 HUB 注册的级联连接,当此连接和 VPN Server 之间通信时,设置通信内容为压缩内容。\n压缩量最大可以达到 80% 。但是,实行压缩,会给客户端和服务器双方的 CPU 造成很高的负荷。如果网络速度在 10 Mbps 以上,实施压缩后会减少传输流量,可能会适得其反。\n此命令在集群虚拟 HUB 中不能运行。 +CMD_CascadeCompressEnable_Args CascadeCompressEnable [name] +CMD_CascadeCompressEnable_[name] 指定级联名称来改变设置。 + + +# CascadeCompressDisable 命令 +CMD_CascadeCompressDisable 级联通信是数据禁止压缩功能 +CMD_CascadeCompressDisable_Help 指定已经在当前虚拟 HUB 注册的级联连接,当此连接和 VPN Server 之间通信时,设置通信内容为禁止压缩。\n此命令在集群虚拟 HUB 中不能运行。 +CMD_CascadeCompressDisable_Args CascadeCompressDisable [name] +CMD_CascadeCompressDisable_[name] 指定级联名称来改变设置。 + + +# CascadeHttpHeader* commands +CMD_CascadeHttpHeader_Prompt_Name Value name (part before the colon): +CMD_CascadeHttpHeader_Prompt_Data Value data (part after the colon): + + +# CascadeHttpHeaderAdd command +CMD_CascadeHttpHeaderAdd Add a custom value in the HTTP header sent to the proxy server +CMD_CascadeHttpHeaderAdd_Help Use this to add a custom value in the HTTP header sent to the proxy server. A custom HTTP header can be used to bypass certain restrictions imposed on the network or to avoid speed limitations applied by the QoS. +CMD_CascadeHttpHeaderAdd_Args CascadeHttpHeaderAdd [name] [/NAME:name] [/DATA:data] +CMD_CascadeHttpHeaderAdd_[name] Specify the name of the Cascade Connection whose setting you want to change. +CMD_CascadeHttpHeaderAdd_NAME Specify the name of the custom value (the part before the colon character). +CMD_CascadeHttpHeaderAdd_DATA Specify the data of the custom value (the part after the colon character). + + +# CascadeHttpHeaderDelete command +CMD_CascadeHttpHeaderDelete Delete a custom value in the HTTP header sent to the proxy server +CMD_CascadeHttpHeaderDelete_Help Use this to delete a custom value in the HTTP header sent to the proxy server. A custom HTTP header can be used to bypass certain restrictions imposed on the network or to avoid speed limitations applied by the QoS. +CMD_CascadeHttpHeaderDelete_Args CascadeHttpHeaderDelete [name] [/NAME:name] +CMD_CascadeHttpHeaderDelete_[name] Specify the name of the Cascade Connection whose setting you want to change. +CMD_CascadeHttpHeaderDelete_NAME Specify the name of the custom value (the part before the colon character). + + +# CascadeHttpHeaderGet command +CMD_CascadeHttpHeaderGet Get the list of custom values in the HTTP header sent to the proxy server +CMD_CascadeHttpHeaderGet_Help Use this to get the list of custom values in the HTTP header sent to the proxy server. A custom HTTP header can be used to bypass certain restrictions imposed on the network or to avoid speed limitations applied by the QoS. +CMD_CascadeHttpHeaderGet_Args CascadeHttpHeaderGet [name] +CMD_CascadeHttpHeaderGet_[name] Specify the name of the Cascade Connection whose setting you want to get. + + +# CascadeProxyNone 命令 +CMD_CascadeProxyNone 将级联的连接方法设置为直接与 TCP/IP 连接 +CMD_CascadeProxyNone_Help 指定已经在当前虚拟 HUB 注册的级联连接,当此连接和 VPN Server 之间通信时,设置连接方法为 [直接与 TCP/IP 连接],而不通过代理服务器。\n此命令在集群虚拟 HUB 中不能运行。 +CMD_CascadeProxyNone_Args CascadeProxyNone [name] +CMD_CascadeProxyNone_[name] 指定级联名称来改变设置。 + + +# CascadeProxyHttp 命令 +CMD_CascadeProxyHttp 将级联连接方法设定为通过 HTTP 代理服务器 +CMD_CascadeProxyHttp_Help 指定已经在当前虚拟 HUB 注册的级联连接,当此连接和 VPN Server 之间通信时,设置连接方法为,[通过 HTTP 代理服务器连接],然后设置要通过的 HTTP 代理服务器的主机名和端口号,用户名和密码 (如果需要)。\n使用的 HTTP 代理服务器,必须有适合 HTTPS 通信的连接方式。\n此命令在集群虚拟 HUB 中不能运行。 +CMD_CascadeProxyHttp_Args CascadeProxyHttp [name] [/SERVER:hostname:port] [/USERNAME:username] [/PASSWORD:password] +CMD_CascadeProxyHttp_[name] 指定级联名称来改变设置。 +CMD_CascadeProxyHttp_SERVER [主机:端口的形式],通过指定的 HTTP 代理服务器的主机名或 IP 地址和端口号。 +CMD_CascadeProxyHttp_USERNAME 如果连接到 HTTP 代理服务器时需要用户验证,则指定用户名。同时设定密码和参数。 如果没有设定用户名和密码 D参数,则不需要设置用户身份验证。 +CMD_CascadeProxyHttp_PASSWORD 如果连接到 HTTP 代理服务器时需要用户验证,则指定密码。/USERNAME,参数等同时设定。 +CMD_CascadeProxyHttp_Prompt_Server 代理服务器主机名和端口号: + + +# CascadeProxySocks 命令 +CMD_CascadeProxySocks 将级联连接方法设定为通过 SOCKS4 代理服务器 +CMD_CascadeProxySocks_Help 指定已经在当前虚拟 HUB 注册的级联连接,当此连接和 VPN Server 之间通信时,设置连接方法为 [通过 SOCKS4 代理服务器],设置 SOCKS4 代理服务器的主机名和端口号,用户名和密码 (如果需要)。\n此命令在集群虚拟 HUB 中不能运行。 +CMD_CascadeProxySocks_Args CascadeProxySocks [name] [/SERVER:hostname:port] [/USERNAME:username] [/PASSWORD:password] +CMD_CascadeProxySocks_[name] 指定级联名称来改变设置。 +CMD_CascadeProxySocks_SERVER 按照 [主机名:端口号] 的格式,设定代理服务器主机名或 IP 地址和端口号。 +CMD_CascadeProxySocks_USERNAME 如果连接到 SOCKS4 代理服务器时需要用户验证,则指定用户名。同时设定密码和参数。如果没有设定用户名和密码参数,则不需要设置用户身份验证。 +CMD_CascadeProxySocks_PASSWORD 如果连接到 SOCKS4 代理服务器时需要用户验证,则指定密码。/USERNAME,参数等同时设定。 + + +# CascadeProxySocks5 命令 +CMD_CascadeProxySocks5 将级联连接方法设定为通过 SOCKS5 代理服务器 +CMD_CascadeProxySocks5_Help 指定已经在当前虚拟 HUB 注册的级联连接,当此连接和 VPN Server 之间通信时,设置连接方法为 [通过 SOCKS5 代理服务器],设置 SOCKS5 代理服务器的主机名和端口号,用户名和密码 (如果需要)。\n此命令在集群虚拟 HUB 中不能运行。 +CMD_CascadeProxySocks5_Args CascadeProxySocks5 [name] [/SERVER:hostname:port] [/USERNAME:username] [/PASSWORD:password] +CMD_CascadeProxySocks5_[name] 指定级联名称来改变设置。 +CMD_CascadeProxySocks5_SERVER 按照 [主机名:端口号] 的格式,设定代理服务器主机名或 IP 地址和端口号。 +CMD_CascadeProxySocks5_USERNAME 如果连接到 SOCKS5 代理服务器时需要用户验证,则指定用户名。同时设定密码和参数。如果没有设定用户名和密码参数,则不需要设置用户身份验证。 +CMD_CascadeProxySocks5_PASSWORD 如果连接到 SOCKS5 代理服务器时需要用户验证,则指定密码。/USERNAME,参数等同时设定。 + + +# CascadeServerCertEnable 命令 +CMD_CascadeServerCertEnable 启用级联服务器证书验证选项 +CMD_CascadeServerCertEnable_Help 指定已经在当前虚拟 HUB 注册的级联连接,当此连接和 VPN Server 之间通信时,验证目标连接的 VPN 的服务器提供的 SSL 证书是否可以信任。\n如果启用此选项,需要将在目标服务器的证书事先通过 CascadeServerCertSet 指令设置到级联的连接设置中,或者在虚拟 HUB 的可信任证书列表中,运行 CAAdd 指令,将有服务器的 SSL 证书署名的路线证书添加进去。\n当启用服务器证书验证选项时,如果 VPN Server 提供的证书不可信,连接将断开,并重试。\n此命令在集群虚拟 HUB 中不能运行。 +CMD_CascadeServerCertEnable_Args CascadeServerCertEnable [name] +CMD_CascadeServerCertEnable_[name] 指定级联名称来改变设置。 + + +# CascadeServerCertDisable 命令 +CMD_CascadeServerCertDisable 禁用级联服务器证书验证选项 +CMD_CascadeServerCertDisable_Help 指定已经在当前虚拟 HUB 注册的级联连接,当此连接和 VPN Server 之间通信时,对于连接方提供的 SSL 证书,不需要检查是否可以信任。\n此命令在集群虚拟 HUB 中不能运行。 +CMD_CascadeServerCertDisable_Args CascadeServerCertDisable [name] +CMD_CascadeServerCertDisable_[name] 指定级联名称来改变设置。 + + +# CascadeServerCertSet 命令 +CMD_CascadeServerCertSet 设置级联连接的服务器特定证书 +CMD_CascadeServerCertSet_Help 指定已经在当前虚拟 HUB 注册的级联连接,当此连接和 VPN Server 之间通信时,事先将连接方提供的 SSL 证书注册。\n如果启用此选项,需要将在目标服务器的证书事先通过指令设置到级联的连接设置中,或者在虚拟 HUB 的可信任证书列表中,运行 CAAdd 指令,将有服务器的 SSL 证书署名的路线证书添加进去。\n当启用服务器证书验证选项时,如果 VPN Server 提供的证书不可信,连接将断开,并重试。\n此命令在集群虚拟 HUB 中不能运行。 +CMD_CascadeServerCertSet_Args CascadeServerCertSet [name] [/LOADCERT:cert] +CMD_CascadeServerCertSet_[name] 指定级联名称来改变设置。 +CMD_CascadeServerCertSet_LOADCERT 设定文件名保存服务器固有的 X.509 格式的证书。 + + +# CascadeServerCertDelete 命令 +CMD_CascadeServerCertDelete 删除级联服务器固有的证书 +CMD_CascadeServerCertDelete_Help 选定当前虚拟 HUB 中已注册的级联,如果已经注册了服务器证书,将其删除。\n此命令在集群虚拟 HUB 中不能运行。 +CMD_CascadeServerCertDelete_Args CascadeServerCertDelete [name] +CMD_CascadeServerCertDelete_[name] 指定级联名称来改变设置。 + + +# CascadeServerCertGet 命令 +CMD_CascadeServerCertGet 获取级联连接服务器的固有证书 +CMD_CascadeServerCertGet_Help 选定在当前虚拟 HUB 上已注册的级联,如果此级联中已经注册了服务器固有证书,则获得该证书,并保存为 X.509 格式。\n此命令在集群虚拟 HUB 中不能运行。 +CMD_CascadeServerCertGet_Args CascadeServerCertGet [name] [/SAVECERT:path] +CMD_CascadeServerCertGet_[name] 指定级联名称来改变设置。 +CMD_CascadeServerCertGet_SAVECERT 指定名称以 X.509 格式保存服务器的固有证书。 + + +# CascadeDetailSet 命令 +CMD_CascadeDetailSet 级联通信的高级设置 +CMD_CascadeDetailSet_Help 选定在当前虚拟 HUB 上已注册的级联,设置级联和 VPN Server 连接通信时使用的 VPN 自定义的通信协议。\n此命令在集群虚拟 HUB 中不能运行。 +CMD_CascadeDetailSet_Args CascadeDetailSet [name] [/MAXTCP:max_connection] [/INTERVAL:interval] [/TTL:disconnect_span] [/HALF:yes|no] [/NOQOS:yes|no] +CMD_CascadeDetailSet_[name] 指定级联名称来改变设置。 +CMD_CascadeDetailSet_MAXTCP VPN 通信中使用的 TCP 连接的数量,用从 1 到 32 的整数来指定。和 VPN Server 之间的 VPN 数据传输,可以通过使用多个 TCP 连接,提高通信速度。\n注意: 如果您使用高速连接到大约使用 8 根,如果是缓慢的拨号服务器,请使用一根。 +CMD_CascadeDetailSet_INTERVAL 如果使用多个 TCP 连接进行 VPN 通信时,请设定各个 TCP 连接之间确立连接秒数。默认值为 1 秒。 +CMD_CascadeDetailSet_TTL 如果您设置每个 TCP 连接的寿命,从连接到断开用秒表示。0 表示寿命未设置。 +CMD_CascadeDetailSet_HALF 如果启动半双工模式选择 "yes"。使用两根以上的 VPN 连接进行 TCP 通信时,可以使用 "半双工模式"。启动半双工模式后,每个 TCP 可以固定一半连接实现单方向的数据传输。例如,使用 8 根 TCP 连接建立 VPN 通信,使用半双工模式后,会有 4 路 TCP 连接上船数据,剩下的 4 路负责下载数据。 +CMD_CascadeDetailSet_NOQOS 禁用 VoIP/ QoS 对应功能选择 "yes"。通常选择 "no"。 +CMD_CascadeDetailSet_Eval_MaxTcp TCP 连接请在 1-32 之间选定。 +CMD_CascadeDetailSet_Eval_Interval TCP 连接之间建立连接的间隔请选定为 1 秒以上。 +CMD_CascadeDetailSet_Prompt_MaxTcp 在 VPN 通信中使用的 TCP 连接数: +CMD_CascadeDetailSet_Prompt_Interval TCP 连接之间建立连接的间隔: +CMD_CascadeDetailSet_Prompt_TTL 每一个 TCP 连接的寿命 (如为 0 则表示没有) : +CMD_CascadeDetailSet_Prompt_HALF 使用半双工模式 (yes/no): + + +# CascadePolicySet 命令 +CMD_CascadePolicySet 设置级联连接的安全协议 +CMD_CascadePolicySet_Help 选定当前虚拟 HUB 上已经注册的级联连接,设置级联连接建立时所适用的安全协议。\n虚拟 HUB 和别的 VPN Server 进行级联连接时,连接方的虚拟 HUB 中将产生新的级联,运行此命令可以设置级联的安全协议。\n此命令在集群虚拟 HUB 中不能运行。 +CMD_CascadePolicySet_Args [name] [/NAME:policy_name] [/VALUE:num|yes|no] +CMD_CascadePolicySet_[name] 指定级联名称来改变设置。 +CMD_CascadePolicySet_NAME 选定要更改设置的协议名称。变更协议的名称和可变更的值,可通过运行 PolicyList 命令获得列表。 +CMD_CascadePolicySet_VALUE 设定协议的新值,如果协议是数值,请设定为一个整数。如果是选择型,请选 yes 或 no。 设定的值可以通过运行PolicyList命令来获得。 +CMD_CascadePolicySet_PROMPT_POLNAME 更改值得协议的名称: +CMD_CascadePolicySet_PROMPT_POLVALUE 设置新值: +CMD_CascadePolicySet_Invalid_Name 指定的协议名称 "%S" 是无效的。\n请运行 PolicyList 命令,您可以获取设置协议的清单。 +CMD_CascadePolicySet_Invalid_Name_For_Cascade 指定协议 "%S" 在设置级联的安全协议时不可用。 +CMD_CascadePolicySet_Invalid_Range 协议 "%S" 请在 %s 范围内选定。 + + +# PolicyList 命令 +CMD_PolicyList 查看安全协议和可以设置的值得列表 +CMD_PolicyList_Help 显示 VPN Server 中的用户,群,级联的安全协议的项目名称,说明,以及可以设定的值的清单。\n不指定任何参数的前提下运行 PolicyList 命令,你可以获得被支持的安全协议的名称和说明。\n如果用 PolicyList 指令指定名称,您可以获得关于这个协议的详细说明,及值的类型和值的范围。 +CMD_PolicyList_Args PolicyList [name] +CMD_PolicyList_[name] 选定想要显示的协议名称。如果没有指定,所有的名称和安全协议及其说明将被列表的支持。 +CMD_PolicyList_Invalid_Name 无效的安全协议名称。 +CMD_PolicyList_Column_1 协议名称 +CMD_PolicyList_Column_2 协议的简单解释 +CMD_PolicyList_Column_3 设置值 +CMD_PolicyList_Help_1 策略名称 +CMD_PolicyList_Help_2 协议的简单说明 +CMD_PolicyList_Help_3 [可以设定的值的范围] +CMD_PolicyList_Help_4 默认值 +CMD_PolicyList_Help_5 [协议的详细说明 +CMD_PolicyList_Range_Bool 是 (Yes) 或 否 (No) +CMD_PolicyList_Range_Int_1 %s 以上或 %s 以下 (0 不能设定) +CMD_PolicyList_Range_Int_2 %s 以上或 %s 以下 (但是,没有指定为 0 则没有设置) + + +# CascadeStatusGet 命令 +CMD_CascadeStatusGet 获取级联的当前状态 +CMD_CascadeStatusGet_Help 选定在当前虚拟 HUB 上注册的级联,如果此级联处于连线状态,您将可以获得它的连接状态和其他信息。\n此命令在集群虚拟 HUB 中不能运行。 +CMD_CascadeStatusGet_Args CascadeStatusGet [name] +CMD_CascadeStatusGet_[name] 指定级联名称,以获取信息。 + + +# CascadeRename 命令 +CMD_CascadeRename 更改级联的名称 +CMD_CascadeRename_Help 选定在当前虚拟 HUB 上注册的级联,改变它的连接名称。\n此命令在集群虚拟 HUB 中不能运行。 +CMD_CascadeRename_Args CascadeRename [name] [/NEW:new_name] +CMD_CascadeRename_[name] 指定要变更的级联的当前名称。 +CMD_CascadeRename_NEW 指定变更后的新名称。 +CMD_CascadeRename_PROMPT_OLD 目前的名称: +CMD_CascadeRename_PROMPT_NEW 新名称: + + + +# CascadeOnline 命令 +CMD_CascadeOnline 设置级联接续的在线状态 +CMD_CascadeOnline_Help 选定在当前虚拟 HUB 上注册的级联,将级联的连接状态设定为连接。级联成功连接后,可以通过连接设定连接到 VPN Server。处于在线状态的级联,除非运行 CascadeOffline 脱机命令,则 VPN Server 始终保持连接。\n此命令在集群虚拟 HUB 中不能运行。 +CMD_CascadeOnline_Args CascadeOnline [name] +CMD_CascadeOnline_[name] 指定级联名称设定为联机状态。 + + +# CascadeOffline 命令 +CMD_CascadeOffline 将级联设置为脱机状态 +CMD_CascadeOffline_Help 选定在当前虚拟 HUB 上注册的级联,将级联的连接状态设定为脱机。处于脱机状态的级联,除非运行 CascadeOnline 命令使它连线,否则无法连接到 VPN Server。\n此命令在集群虚拟 HUB 中不能运行。 +CMD_CascadeOffline_Args CascadeOffline [name] +CMD_CascadeOffline_[name] 指定级联名称设置到脱机状态。 + + +# AccessAdd 命令 +CMD_AccessAdd 添加规则到允许访问列表 (IPv4) +CMD_AccessAdd_Help 在当前虚拟 HUB 的访问列表中,添加新的规则。\n访问列表指的是虚拟 HUB 中,对流动的数据包进行筛选的规则,访问列表中可以登录多条规则,每条规则可以定义优先顺序。所有的数据包,按照最初适用的条件,或是通过或是销毁。不符合任何规则的数据包则将被默许通过。您也可以使用AccessAddEx 命令,来生成延迟、时基误差和数据包丢失。\n此命令,在 VPN Bridge 中不会运行。\n此命令在集群虚拟 HUB 中不能运行。 +CMD_AccessAdd_Args AccessAdd [pass|discard] [/MEMO:memo] [/PRIORITY:priority] [/SRCUSERNAME:username] [/DESTUSERNAME:username] [/SRCMAC:mac/mask] [/DESTMAC:mac/mask] [/SRCIP:ip/mask] [/DESTIP:ip/mask] [/PROTOCOL:tcp|udp|icmpv4|icmpv6|ip|num] [/SRCPORT:start-end] [/DESTPORT:start-end] [/TCPSTATE:established|unestablished] +CMD_AccessAdd_[pass|discard] 确定数据包跟规则条件一致时的处理。当您指定 pass 意为通过,指定 discard,意为销毁。 +CMD_AccessAdd_MEMO 选定规则的解释 (备忘录)。 +CMD_AccessAdd_PRIORITY 用 1 以上的整数指定优先顺序。数字越小优先级越高。 +CMD_AccessAdd_SRCIP 作为规则条件制定一个源 IPv4 地址。用点把十进制数值分开的 IP 地址/掩码[格式指定一个 IPv4 地址,例如 192.168.0.1 掩码例如 255.255.255.0 为十进制,以点分隔,或者像 24 这样从开始设定字节长度,以十进位。如果设定为 0.0.0.0/0.0.0.0 则显示所有主机。 +CMD_AccessAdd_DESTIP 作为规则的条件必须制定目标 IPv4 地址:用 [IP 地址/掩码]格式制定方法同指定 /SRCIP 参数类似。 +CMD_AccessAdd_PROTOCOL 根据规则的条件,需指定协议类型。IP 协议号或者输入一个十进制数,或者 "tcp" (TCP/IP 协议,第 6 号),"udp" (UDP/IP 协议,第 17 号),"icmpv4" (ICMPv4 协议,第 1 号),"icmpv6" (ICMPv6 协议,第 58 号),"ip" (所有的 IP 协议,0 号) 来指定所有 IP 协议中的关键字。如果选定所有的 IP 协议,则选 0。 +CMD_AccessAdd_SRCPORT 协议 TCP/IP 或 UDP/IP 的情况下,作为规则需指定源端口号。其他的协议不需要。如果该参数没有指定,则选定所有端口。设定方法,例如 "1-1024" (第 1 到 1024),"23" (只选第 23 只)。 +CMD_AccessAdd_DESTPORT 协议 TCP/IP 或 UDP/IP 的情况下,作为规则需指定源端口号。其他的协议不需要。制定方法同指定 /SRCPORT 参数一样。 +CMD_AccessAdd_SRCUSERNAME 作为此规则的条件,只有被指定的用户 / 用户組发送的数据包,才适用与此规则。在这种情况下,需指定用户名 / 用户組名。 +CMD_AccessAdd_DESTUSERNAME 作为此规则的条件,只有被指定的用户 / 用户組接受的数据包,才适用与此规则。在这种情况下,需指定用户名 / 用户組名。 +CMD_AccessAdd_SRCMAC 作为规则的条件,指定发送原 MAC 地址。MAC 地址像例子 (00-AC-84-EA-33-BC/FF-FF-FF-FF-FF-00) 一样地 '-' 或 '/' 断开十六进制数写。段落文字能省略。 +CMD_AccessAdd_DESTMAC 作为规则的条件,指定地址 MAC 地址。指定方法,/SRCMAC 参数同样。 +CMD_AccessAdd_TCPSTATE 作为规则的条件,指定 TCP 连接的状态。 Established 或指定 Unestablished。 +CMD_AccessAdd_Prompt_TYPE 通过或破坏: +CMD_AccessAdd_Prompt_MEMO 规则的解释 (备忘录): +CMD_AccessAdd_Prompt_PRIORITY 规则的优先顺序: +CMD_AccessAdd_Eval_PRIORITY 请用 1 以上的整数指定优先顺序。 +CMD_AccessAdd_Prompt_SRCIP 发信方的源 IP 地址 (0.0.0.0/0 则代表所有): +CMD_AccessAdd_Prompt_DESTIP 收信方的源 IP 地址 (0.0.0.0/0 则代表所有): +CMD_AccessAdd_Prompt_PROTOCOL 协议号码或协议名称 (tcp/udp/icmpv4/icmpv6/ip): +CMD_AccessAdd_Prompt_SRCPORT 源端口范围 (仅限 tcp/udp): +CMD_AccessAdd_Prompt_DESTPORT 目标端口号范围 (仅限 tcp/udp): +CMD_AccessAdd_Prompt_SRCUSERNAME 发送用户名 (若无指定代表全部): +CMD_AccessAdd_Prompt_DESTUSERNAME 接收用户名 (若无指定代表全部): +CMD_AccessAdd_Prompt_SRCMAC 由于发送原 MAC 地址和面罩 (无指定全部): +CMD_AccessAdd_Prompt_DESTMAC 由于地址 MAC 地址和面罩 (无指定全部): +CMD_AccessAdd_Prompt_TCPSTATE TCP 连接的状态 (Established/Unestablished): + + +# AccessAddEx 命令 +CMD_AccessAddEx 添加扩展访问列表规则 (IPv4:延迟、时基误差/数据包丢失产生) +CMD_AccessAddEx_Help 在当前管理的虚拟 HUB 的访问列表中,使用此命令添加新的规则。当数据包经由虚拟 HUB 通过时,你可以设置产生延迟、时基误差和数据包丢失。\n访问列表是一组文件规则被应用到流过虚拟 HUB 的数据包。您可以在一个访问列表中注册多个规则,你也可以定义每个规则的优先级。检查所有的数据包的规则所指定的条件,在访问列表中注册的规则,由第一个匹配的规则根据规定的操作,它们要么通过要么被丢弃。不匹配任何规则的数据包暗中允许通过。您也可以使用 AccessAddEx 的命令来生成延迟、时基误差和数据包丢失。\n此命令不能在 VPN Bridge 上运行。\n在以成员服务器群集上运行的 VPN Server 的虚拟 HUB 上,您不能执行此命令。 +CMD_AccessAddEx_Args AccessAddEx [pass|discard] [/MEMO:memo] [/PRIORITY:priority] [/SRCUSERNAME:username] [/DESTUSERNAME:username] [/SRCMAC:mac/mask] [/DESTMAC:mac/mask] [/SRCIP:ip/mask] [/DESTIP:ip/mask] [/PROTOCOL:tcp|udp|icmpv4|icmpv6|ip|num] [/SRCPORT:start-end] [/DESTPORT:start-end] [/SRCUSERNAME:username] [/DESTUSERNAME:username] [/TCPSTATE:established|unestablished] [/DELAY:delay_millisec] [/JITTER:jitter_percent] [/LOSS:loss_percent] [/REDIRECTURL:url] +CMD_AccessAddEx_[pass|discard] 当一个数据包匹配此规则条件时,该操作就已决定了。当通过被指定时,则数据包允许通过;当丢弃被指定时,数据包被丢弃。如果动作是通过,延迟、时基误差和数据包丢失的设置被应用。 +CMD_AccessAddEx_MEMO 指定此规则的描述 (备忘录)。 +CMD_AccessAddEx_PRIORITY 指定 1 或以上的整数作为此规则的优先级。数字越小优先级越高。 +CMD_AccessAddEx_SRCIP 指定一个源 IPv4 地址作为一个规则条件。用点把十进制数值分开的 [IP 地址/掩码] 格式指定一个 IPv4 地址,例如: 192.168.0.1。对于掩码,您或者可以指定由点分开的十进制数值,例如 255.255.255.0 也可以指定从标头用十进制数值的比特长度,如 24。 如果您指定: 0.0.0.0/0.0.0.0 这表示所有主机。 +CMD_AccessAddEx_DESTIP 用 [IP 地址/掩码] 格式指定一个目的 IPv4 地址作为一个规则条件指定方法同指定 /SRCPORT 参数一样。 +CMD_AccessAddEx_PROTOCOL 指定一个协议类型作为一个规则条件。使用十进制数值输入 IP 协议号,或者指定关键字中的一个 "tcp" (TCP/IP 协议,第 6 号),"udp" (UDP/IP 协议,第 17 号),"icmpv4" (ICMPv4 协议,第 1 号),"icmpv6" (ICMPv6 协议,第 58 号)或者, "ip" (所有的 IP 协议,0 号)。指定数字 0,则规则会应用到全部 IP 协议。 +CMD_AccessAddEx_SRCPORT 如果已指定的协议是 TCP/IP 或 UDP/IP 的话,指定端口号的目的地作为规则条件。其他的协议会被忽略。如果该参数没有指定,那么规则会应用到所有端口号。当指定时,请使用如下方法: "1-1024" (第 1 到 1024),"23" (仅限 23)。 +CMD_AccessAddEx_DESTPORT 如果已指定的协议是 TCP/IP 或 UDP/IP 的话,指定目的端口号的目的地作为规则条件。其他协议将被忽略。指定方法同指定 /SRCPORT 参数一样。 +CMD_AccessAddEx_SRCUSERNAME 您可以将此规则仅用于作为规则条件被指定了用户名的用户会话发送的数据包。在这种情况下,请指定该用户名。 +CMD_AccessAddEx_DESTUSERNAME 您可以将此规则仅用于作为规则条件被指定了用户名的用户会话接收的数据包。在这种情况下,请指定该用户名。 +CMD_AccessAddEx_SRCMAC 指定目标 MAC 地址作为一个规则。用'-' 或 '/'分隔符和十六进制数字,如 (00-AC-84-EA-33-BC/FF-FF-FF-FF-FF-00) 来指定 MAC 地址。分隔符可跳过。 +CMD_AccessAddEx_DESTMAC 指定目标 MAC 地址作为一个规则。指定方法同指定 /SRCPORT 参数一样。 +CMD_AccessAddEx_TCPSTATE 指定 TCP 连接状态作为一个规则。使用 Established (已建立的)或 Unestablished(未建立的)。 +CMD_AccessAddEx_DELAY 当数据包通过时,设置此数值来生成延迟。以毫秒来指定延迟的时间段。指定 0,意为不会生成延迟。延迟最多为 10000 毫秒、 +CMD_AccessAddEx_JITTER 当数据包通过时,设置此数值来生成时基误差。用 0% 到 100% 之内的范围来指定时基误差波动的频率。指定 0,意为不会生成时基误差。 +CMD_AccessAddEx_LOSS 当数据包通过时,设置此数值来生成数据包丢失。用 0% 到 100% 之内的范围来指定丢包的频率。指定 0,意为不会生成丢包。 +CMD_AccessAddEx_REDIRECTURL The specified URL will be mandatory replied to the client as a response for TCP connecting request packets which matches the conditions of this access list entry via this Virtual Hub. To use this setting, you can enforce the web browser of the VPN Client computer to show the specified web site when that web browser tries to access the specific IP address. +CMD_AccessAddEx_Prompt_DELAY 生成延迟 (毫秒: 0 - 10000): +CMD_AccessAddEx_Prompt_JITTER 生成时基误差的波动(百分比: 0 - 100): +CMD_AccessAddEx_Prompt_LOSS 丢包率 (百分比: 0 - 100): +CMD_AccessAddEx_Eval_DELAY 最大延迟为 10000 +CMD_AccessAddEx_Eval_JITTER 最大时基误差的波动为 100 +CMD_AccessAddEx_Eval_LOSS 最大丢包率为 100 + + +# AccessAdd6 命令 +CMD_AccessAdd6 添加访问列表规则 (IPv6) +CMD_AccessAdd6_Help 在当前管理的虚拟 HUB 的访问列表中,使用此命令添加新的规则。\n访问列表是一组文件规则被应用到流过虚拟 HUB 的数据包。您可以在一个访问列表中注册多个规则,你也可以定义每个规则的优先级。检查所有的数据包的规则所指定的条件,在访问列表中注册的规则,由第一个匹配的规则根据规定的操作,它们要么通过要么被丢弃。不匹配任何规则的数据包暗中允许通过。您也可以使用 AccessAddEx6 的命令来生成延迟、时基误差和数据包丢失。 \n此命令不能在 VPN Bridge 上运行。 \n在以成员服务器群集上运行的 VPN Server 的虚拟 HUB 上,您不能执行此命令。 +CMD_AccessAdd6_Args AccessAdd6 [pass|discard] [/MEMO:memo] [/PRIORITY:priority] [/SRCUSERNAME:username] [/DESTUSERNAME:username] [/SRCMAC:mac/mask] [/DESTMAC:mac/mask] [/SRCIP:ip/mask] [/DESTIP:ip/mask] [/PROTOCOL:tcp|udp|icmpv4|icmpv6|ip|num] [/SRCPORT:start-end] [/DESTPORT:start-end] [/TCPSTATE: established|unestablished] +CMD_AccessAdd6_[pass|discard] 当一个数据包匹配此规则条件时,该操作就已决定了。当通过被指定时,则数据包允许通过;当丢弃被指定时,数据包被丢弃。 +CMD_AccessAdd6_MEMO 指定此规则的描述。 (备忘录)。 +CMD_AccessAdd6_PRIORITY 指定1或以上的整数作为此规的优先级。数字越小优先级越高。 +CMD_AccessAdd6_SRCIP 指定一个源 IPv6 地址作为一个规则条件。使用冒号分割十六进制数字的 [IP 地址/掩码] 格式来指定 IPv6 地址。例如 2001:200:0:1:: 对于掩码来讲,您或者可以使用冒号分隔十六位数值的格式,例如 ffff:ffff:ffff:ffff:: 或者您也可以通过用标头的十进制数值像 128,来指定比特长度。如果您要指定 "::/0",意为所有主机。 +CMD_AccessAdd6_DESTIP 用 [IP 地址/掩码] 格式指定一个目标 IPv6 地址作为一个规则条件。制定方法同指定/SRCIP参数类似。 +CMD_AccessAdd6_PROTOCOL 指定一个协议类型来作为一个规则条件。输入十进制数值的 IP 协议号或者指定一个关键字 "tcp" (TCP/IP 协议,第 6 号),"udp" (UDP/IP 协议,第 17 号),"icmpv4" (ICMPv4 协议,第 1 号),"icmpv6" (ICMPv6 协议,第 58 号),"ip" (所有的 IP 协议,0 号)。指定]0[,则规则会应用于所有IP协议。 +CMD_AccessAdd6_SRCPORT 如果指定的协议是 TCP/IP 或 UDP/IP,则指定源端口号作为规则条件。其他协议将被忽略。如果该参数没有指定,规则将会应用到所有端口号。指定时,请使用如下方法 "1-1024" (第 1 到 1024),"23" (仅是第 23 )。 +CMD_AccessAdd6_DESTPORT 如果指定的协议是 TCP/IP 或 UDP/IP,则指定目标端口号作为规则条件。其他协议将被忽略。指定方法同指定 /SRCPORT 参数一样。 +CMD_AccessAdd6_SRCUSERNAME 您可以将此规则仅用于作为规则条件被指定了用户名的用户会话发送的数据包。在这种情况下,请指定该用户名。 +CMD_AccessAdd6_DESTUSERNAME 您可以将此规则仅用于作为规则条件被指定了用户名的用户会话接收的数据包。在这种情况下,请指定该用户名。 +CMD_AccessAdd6_SRCMAC 指定目的 MAC 地址作为规则。用分隔符 "-" 或者 ":" 和十六进制的数字,如 00-AC-84-EA-33-BC/FF-FF-FF-FF-FF-00 来指定 MAC 地址。分隔符可以跳过。 +CMD_AccessAdd6_DESTMAC 指定目标 MAC 地址作为一个规则。方法与指定 /SRCMAC 参数同样。 +CMD_AccessAdd6_TCPSTATE 指定 TCP 连接状态作为一个规则。使用 Established 或 Unestablished。 +CMD_AccessAdd6_Prompt_TYPE 通过或丢弃: +CMD_AccessAdd6_Prompt_MEMO 规则描述 (备忘录): +CMD_AccessAdd6_Prompt_PRIORITY 规则优先级: +CMD_AccessAdd6_Eval_PRIORITY 请用 1 或以上的整数指定优先顺序。 +CMD_AccessAdd6_Prompt_SRCIP 源 IPv6 地址 (::/0 则代表所有): +CMD_AccessAdd6_Prompt_DESTIP 目标 IPv6 地址 (::/0 则代表所有): +CMD_AccessAdd6_Prompt_PROTOCOL 协议号或协议名称 (tcp/udp/icmpv4/icmpv6/ip): +CMD_AccessAdd6_Prompt_SRCPORT 源端口号范围 (仅限 tcp/udp): +CMD_AccessAdd6_Prompt_DESTPORT 目标端口号范围 (仅限 tcp/udp): +CMD_AccessAdd6_Prompt_SRCUSERNAME 源用户名 (若无指定代表全部): +CMD_AccessAdd6_Prompt_DESTUSERNAME 目的用户名 (若无指定代表全部): +CMD_AccessAdd6_Prompt_SRCMAC 源 MAC 地址和掩码 (若无指定代表全部): +CMD_AccessAdd6_Prompt_DESTMAC 目标 MAC 地址和掩码 (若无指定代表全部): +CMD_AccessAdd6_Prompt_TCPSTATE TCP 连接的状态 (Established/Unestablished): + + +# AccessAddEx6 命令 +CMD_AccessAddEx6 添加扩展访问列表规则 (IPv6,生成延迟,时基误差/数据包丢失) +CMD_AccessAddEx6_Help 在当前管理的虚拟 HUB 的访问列表中,使用此命令添加新的规则。当数据包经由虚拟 HUB 通过时,你可以设置产生延迟、时基误差和数据包丢失。\n访问列表是一组文件规则被应用到流过虚拟 HUB 的数据包。您可以在一个访问列表中注册多个规则,你也可以定义每个规则的优先级。检查所有的数据包的规则所指定的条件,在访问列表中注册的规则,由第一个匹配的规则根据规定的操作,它们要么通过要么被丢弃。不匹配任何规则的数据包暗中允许通过。您也可以使用 AccessAddEx6 的命令来生成延迟、时基误差和数据包丢失。 \n此命令不能在 VPN Bridge 上运行。 \n在以成员服务器群集上运行的 VPN Server 的虚拟 HUB 上,您不能执行此命令。 +CMD_AccessAddEx6_Args AccessAddEx6 [pass|discard] [/MEMO:memo] [/PRIORITY:priority] [/SRCUSERNAME:username] [/DESTUSERNAME:username] [/SRCMAC:mac/mask] [/DESTMAC:mac/mask] [/SRCIP:ip/mask] [/DESTIP:ip/mask] [/PROTOCOL:tcp|udp|icmpv4|icmpv6|ip|num] [/SRCPORT:start-end] [/DESTPORT:start-end] [/TCPSTATE: established|unestablished] [/DELAY:delay_millisec] [/JITTER:jitter_percent] [/LOSS:loss_percent] [/REDIRECTURL:url] +CMD_AccessAddEx6_[pass|discard] 如果通过,会产生延迟,抖动和丢包。当一个数据包匹配此规则条件时,该操作就已决定了。当通过被指定时,则数据包允许通过;当丢弃被指定时,数据包被丢弃。如果动作是通过,延迟、时基误差和数据包丢失的设置被应用。 +CMD_AccessAddEx6_MEMO 指定此规则的描述(备忘录)。 +CMD_AccessAddEx6_PRIORITY 指定1或以上的整数作为此规则的优先级。数字越小优先级越高。 +CMD_AccessAddEx6_SRCIP 指定一个源 IPv6 地址作为一个规则条件。指定一个源 IPv6 地址作为一个规则条件。对于掩码来讲,您或者可以使用冒号分隔十六位数值的格式,例如 "ffff:ffff:ffff:ffff::" 或者您也可以通过用标头的十进制数值像 "64",来指定比特长度。如果您要指定 "::/0",意为所有主机。 +CMD_AccessAddEx6_DESTIP 用 [IP 地址/掩码] 格式指定一个目标 IPv6 地址作为一个规则条件。指定方法同指定 /SRCIP 参数类似。 +CMD_AccessAddEx6_PROTOCOL 指定一个协议类型来作为一个规则条件。输入十进制数值的IP 协议号或者指定一个关键字 "tcp" (TCP/IP 协议,第 6 号),"udp" (UDP/IP 协议,第 17 号),"icmpv4" (ICMPv4 协议,第 1 号),"icmpv6" (ICMPv6 协议,第 58 号),"ip" (所有的 IP 协议,0 号)。指定 0,则规则会应用于所有 IP 协议。 +CMD_AccessAddEx6_SRCPORT 如果已指定的协议是 TCP/IP 或 UDP/IP 的话,指定端口号的目的地作为规则条件。其他的协议会被忽略。如果该参数没有指定,那么规则会应用到所有端口号。当指定时,请使用如下方法: "1-1024" (第 1 到 1024),"23" (仅限 23)。 +CMD_AccessAddEx6_DESTPORT 如果指定的协议是 TCP/IP 或 UDP/IP 的话,则指定目标端口号作为规则条件。其他协议会被忽略。如果该参数没有指定,指定方法同指定 /SRCPORT 参数一样。 +CMD_AccessAddEx6_SRCUSERNAME 您可以将此规则仅用于作为规则条件被指定了用户名的用户会话发送的数据包。在这种情况下,请指定该用户名。 +CMD_AccessAddEx6_DESTUSERNAME 您可以将此规则仅用于作为规则条件被指定了用户名的用户会话接收的数据包。在这种情况下,请指定该用户名。 +CMD_AccessAddEx6_SRCMAC 指定目标 MAC 地址作为规则。用分隔符]-[或者]:[和十六进制的数字,如 "00-AC-84-EA-33-BC/FF-FF-FF-FF-FF-00" 来指定 MAC 地址。分隔符可以跳过。 +CMD_AccessAddEx6_DESTMAC 指定目标 MAC 地址作为一个规则。方法与指定 /SRCMAC 参数同样。 +CMD_AccessAddEx6_TCPSTATE 指定 TCP连接状态作为一个规则。使用已建立的(Established) 或未建立的(Unestablished)。 +CMD_AccessAddEx6_DELAY 当数据包通过时,设置本数值来产生延迟。以毫秒为单位来指定延迟周期。指定0,意为不产生延迟。延迟最大为 10000 毫秒。 +CMD_AccessAddEx6_JITTER 当数据包通过时,设置本数值来产生时基误差。当数据包通过时,设置此数值来生成时基误差。用 0% 到 100% 之内的范围来指定时基误差波动的频率。指定 0,意为不会生成时基误差。 +CMD_AccessAddEx6_LOSS 当数据包通过时,设置本数值来产生数据包丢失。指定 0% 至 100% 来作为丢包的比率范围。指定 0,意为无丢包生成。 +CMD_AccessAddEx6_REDIRECTURL The specified URL will be mandatory replied to the client as a response for TCP connecting request packets which matches the conditions of this access list entry via this Virtual Hub. To use this setting, you can enforce the web browser of the VPN Client computer to show the specified web site when that web browser tries to access the specific IP address. +CMD_AccessAddEx6_Prompt_DELAY 生成延迟 (毫秒: 0 - 10000): +CMD_AccessAddEx6_Prompt_JITTER 生成时基误差的波动 (百分比: 0 - 100): +CMD_AccessAddEx6_Prompt_LOSS 丢包率 (百分比: 0 - 100): +CMD_AccessAddEx6_Eval_DELAY 最大延迟为 10000 +CMD_AccessAddEx6_Eval_JITTER 最大时基误差波动为 100 +CMD_AccessAddEx6_Eval_LOSS 最大丢包率为 100 + + +# AccessList 命令 +CMD_AccessList 获取访问列表规则 +CMD_AccessList_Help 获取当前虚拟 HUB 的访问列表中注册的数据包筛选规则一览表。\n访问列表,即是虚拟 HUB 内对流动的数据包进行筛选的规则的集合,访问列表中可以登录多条规则,每条规则可以定义优先顺序。通过包过滤规则适用英寸访问列表可以注册一个以上的规则可以定义一个优先考虑每一条规则。所有的数据包,按照最初适用的条件,或是通过或是销毁。不符合任何规则的数据包则将被默许通过。\n此命令,在 VPN Bridge 中不会运行。\n此命令在集群虚拟 HUB 中不能运行。 +CMD_AccessList_Args AccessList + + +# AccessDelete 命令 +CMD_AccessDelete 从访问列表中删除规则 +CMD_AccessDelete_Help 从当前虚拟 HUB 中注册的访问列表中,选定数据包过滤规则并加以删除。\n要删除规则,需要指定该规则 ID。ID 可以运行 AccessList 获得。\n另外不删除而是暂时禁用的规则执行 AccessDisable 命令。\n此命令,在 VPN Bridge 中不会运行。\n此命令在集群虚拟 HUB 中不能运行。 +CMD_AccessDelete_Args AccessDelete [id] +CMD_AccessDelete_[id] 指定要删除的规则的 ID 或唯一 ID。 +CMD_Access_Prompt_ID 访问列表规则 ID 或唯一 ID: + + +# AccessEnable 命令 +CMD_AccessEnable 启用访问列表规则功能 +CMD_AccessEnable_Help 从当前虚拟 HUB 中注册的访问列表中,选定数据包筛选规则并激活。激活的规则用于数据包筛选。\n要启用该规则,必须指定它的 ID。您可以使用 AccessList 命令获取 ID。\n此命令,在 VPN Bridge 中不会运行。\n此命令在集群虚拟 HUB 中不能运行。 +CMD_AccessEnable_Args AccessEnable [id] +CMD_AccessEnable_[id] 指定规则的 ID 并激活。 + + +# AccessDisable 命令 +CMD_AccessDisable 禁用访问列表规则 +CMD_AccessDisable_Help 从当前虚拟 HUB 中注册的访问列表中,选定数据包筛选规则并禁用。被禁用的筛选规则将不会被用于数据包筛选。\n要禁用的规则,规则必须指定的 ID。\n要禁用该规则,必须指定它的 ID。您可以使用 AccessList 命令获取 ID。\n此命令,在 VPN Bridge 中不会运行。\n此命令在集群虚拟 HUB 中不能运行。 +CMD_AccessDisable_Args AccessDisable [id] +CMD_AccessDisable_[id] 指定规则的 ID 并禁用。 + + +# UserList 命令 +CMD_UserList 获取用户列表 +CMD_UserList_Help 获取当前虚拟 HUB 中注册的安全帐户数据库信息中的用户清单。\n此命令,在 VPN Bridge 中不会运行。\n此命令在集群虚拟 HUB 中不能运行。 +CMD_UserList_Args UserList + + +# UserCreate 命令 +CMD_UserCreate 创建用户 +CMD_UserCreate_Help 在当前虚拟 HUB 中注册的安全帐户数据库中创建一个新用户。\n当您创建一个用户,根据用户信息的认证,VPN Client 可以连接到这个虚拟 HUB。\n如果您使用 UserCreate 命令创建一个用户,用户身份验证方法是验证密码,注册为一个随机字符串作为密码分配。因此,用户不能直接连接到虚拟 HUB。在创建用户后,则必须运用 UserPasswordSet 命令,设定指定用户的密码。或者使用 UserAnonymousSet 命令,UserCertSet 命令,UserSignedSet 命令,UserRadiusSet 命令,UserNTLMSet 命令来改变用户身份验证方式。\n除非真有用户名为 "*" (星号),否则当客户登陆时提供的用户名与已有用户名不一致的情况下,将自动登录为 RADIUS 服务器,或者 NT 控制器来验证。\n如果要更改用户信息,可以执行 UserSet 命令。\n此命令,在 VPN Bridge 中不会运行。\n此命令在集群虚拟 HUB 中不能运行。 +CMD_UserCreate_Args UserCreate [name] [/GROUP:group] [/REALNAME:realname] [/NOTE:note] +CMD_UserCreate_[name] 指定新创建用户的用户名。 +CMD_UserCreate_GROUP 如果让用户加入一个用户组,请指定组名。如果你让用户不属于任何组,则设定为 /GROUP:none。 +CMD_UserCreate_REALNAME 指定用户的全名。如果不指定,请选 /REALNAME:none。 +CMD_UserCreate_NOTE 指定该用户的说明。否则,选择 /NOTE:none。 +CMD_UserCreate_Prompt_NAME 用户名: +CMD_UserCreate_Prompt_GROUP 加入群组名称: +CMD_UserCreate_Prompt_REALNAME 用户全名: +CMD_UserCreate_Prompt_NOTE 用户描述: + + +# UserSet 命令 +CMD_UserSet 更改用户信息 +CMD_UserSet_Help 变更当前虚拟 HUB 中的安全帐户数据库中注册的客户信息。\n可以更改的信息,即使创建新用户所需要的 "组名称","全名" 和 "描述" 这三个项目。\n要获得用户的名单,请使用 UserList 命令。\n此命令,在 VPN Bridge 中不会运行。\n此命令在集群虚拟 HUB 中不能运行。 +CMD_UserSet_Args UserSet [name] [/GROUP:group] [/REALNAME:realname] [/NOTE:note] +CMD_UserSet_[name] 指定用户名更改设置。 +CMD_UserSet_GROUP 如果让用户加入一个用户组,请指定组名。如果你让用户不属于任何组,则设定为 /GROUP:none。 +CMD_UserSet_REALNAME 指定用户的全名。如果不指定,请选 /REALNAME:none。 +CMD_UserSet_NOTE 指定该用户的说明。否则,选择 /NOTE:none + + +# UserDelete 命令 +CMD_UserDelete 删除用户 +CMD_UserDelete_Help 删除在虚拟 HUB 中的安全帐户数据库中注册的用户。当你删除一个用户,该用户将无法连接到虚拟 HUB。\n如果您使用 UserPolicySet 命令,即使不删除也可暂时禁止用户登录。\n要获得用户的名单,请使用 UserList 命令。\n此命令,在 VPN Bridge 中不会运行。\n此命令在集群虚拟 HUB 中不能运行。 +CMD_UserDelete_Args UserDelete [name] +CMD_UserDelete_[name] 指定用户名将其删除。 + + +# UserGet 命令 +CMD_UserGet 获取用户信息 +CMD_UserGet_Help 获取在虚拟 HUB 中的安全帐户数据库中注册用户的登录信息。\n这个指令可以得到的信息有 "用户名","全名","描述","组的成员","有效期","安全协议","身份验证方法",以及验证参数。\n要获得用户的名单,请使用 UserList 命令。\n此命令,在 VPN Bridge 中不会运行。\n此命令在集群虚拟 HUB 中不能运行。 +CMD_UserGet_Args UserGet [name] +CMD_UserGet_[name] 指定的用户名来获取信息。 +CMD_UserGet_Column_Name 用户名 +CMD_UserGet_Column_RealName 全名 +CMD_UserGet_Column_Note 描述 +CMD_UserGet_Column_Group 组名称 +CMD_UserGet_Column_Expires 有效期 +CMD_UserGet_Column_AuthType 验证方法 +CMD_UserGet_Column_UserCert 已注册的用户固有的证书 +CMD_UserGet_Column_RadiusAlias 外部认证服务器验证用户名 +CMD_UserGet_Column_RootCert_CN 证书的 CN 值得限定 +CMD_UserGet_Column_RootCert_SERIAL 证书的序列号的限定 +CMD_UserGet_Policy 该用户设定的安全协议 + + +# UserAnonymousSet 命令 +CMD_UserAnonymousSet 将用户身份验证方法设置为匿名验证 +CMD_UserAnonymousSet_Help 在虚拟 HUB 中的安全帐户数据库中注册用户的验证方法设定为 "匿名验证"。"匿名验证" 的用户连接到 VPN Client HUB 时,不会有任何用户认证即可以连接到 HUB。匿名身份验证设置适合那些公开的谁都可以连接的 VPN Server。\n要获得用户的名单,请使用 UserList 命令。\n此命令,在 VPN Bridge 中不会运行。\n此命令在集群虚拟 HUB 中不能运行。 +CMD_UserAnonymousSet_Args UserAnonymousSet [name] +CMD_UserAnonymousSet_[name] 指定用户名更改设置。 + + +# UserPasswordSet 命令 +CMD_UserPasswordSet 将用户身份验证方法设置为密码验证,并设定密码 +CMD_UserPasswordSet_Help 在虚拟 HUB 中的安全帐户数据库中注册用户的验证方法设定为 "密码验证" 所谓 "密码验证" 即所有安全帐户数据库中的用户都设置密码注册。当此用户连接虚拟 HUB 时,会提示输入密码,如果一致,则允许连接。\n事实上,由于用户的密码是经过处理以后保存的,因此即使分析原始材料,也不会分析出密码。\n要获得用户的名单,请使用 UserList 命令。\n此命令,在 VPN Bridge 中不会运行。\n此命令在集群虚拟 HUB 中不能运行。 +CMD_UserPasswordSet_Args UserPasswordSet [name] [/PASSWORD:password] +CMD_UserPasswordSet_[name] 指定用户名更改设置。 +CMD_UserPasswordSet_PASSWORD 指定用户的密码设置。如果您不指定此参数将被提示输入密码。 + + +# UserCertSet 命令 +CMD_UserCertSet 将用户身份验证方法设置为固有证书验证,并设定证书 +CMD_UserCertSet_Help 在虚拟 HUB 中的安全帐户数据库中注册用户的验证方法设定为 "固有证书验证" 所谓 "固有证书验证" 即所有安全帐户数据库中的用户都注册一个 X.509 证书。当此用户连接虚拟 HUB 时,提供的固有证书与登记证书一致,或持有对应证书的密钥,允许是通过验证实现连接。\n要获得用户的名单,请使用 UserList 命令。\n此命令,在 VPN Bridge 中不会运行。\n此命令在集群虚拟 HUB 中不能运行。 +CMD_UserCertSet_Args UserCertSet [name] [/LOADCERT:cert] +CMD_UserCertSet_[name] 指定的用户名更改设置。 +CMD_UserCertSet_LOADCERT 指定 X.509 证书文件名,这顶用户证书。 + + +# UserCertGet 命令 +CMD_UserCertGet 获取注册固有证书认证用户的证书 +CMD_UserCertGet_Help 在虚拟 HUB 中的安全帐户数据库中注册用户的 "固有证书认证" 的用户,取得用户的 X.509 证书,并保存。\n如果用户未指定 "固有证书认证",则会发生错误。\n要获得用户的名单,请使用 UserList 命令。\n此命令,在 VPN Bridge 中不会运行。\n此命令在集群虚拟 HUB 中不能运行。 +CMD_UserCertGet_Args UserCertGet [name] [/SAVECERT:cert] +CMD_UserCertGet_[name] 指定的用户名来检索信息。 +CMD_UserCertGet_SAVECERT 指定文件名来保存获取的用户的 X.509 证书。 +CMD_UserCertGet_Not_Cert 或者非固定证书认证,或者为设定为固有证书验证。 + + +# UserSignedSet 命令 +CMD_UserSignedSet 将用户身份验证方法设置为已签名证明书认证 +CMD_UserSignedSet_Help 将已注册在目前管理的虚拟 HUB 的安全帐户数据库的用户认证方法设定为已签名认证书认证。用户以已签名证明书认证的用户名链接虚拟 HUB 时,用户所提交的证明书会被验证是否为虚拟 HUB 认可的证明机构的证明书一览中任意证明书的签名,且客户是否持有与证书相应的密钥,用 RSA 算法验证可以链接的认证法。/n还可以设定成已注册用户希望的证明书的通用名 (CN) 及编号,只有通过了上述验证的证明书的内容与设定值一致的情况下才能许可链接。/n要取得目前注册用户一览,请使用用户名单指令。\n此指令,虚拟专用桥不能运行。 \n此指令令在群集内作为群集成员服务器操作的 VPN Server 的虚拟 HUB 上不能运行。 +CMD_UserSignedSet_Args UserSignedSet [name] [/CN:cn] [/SERIAL:serial] +CMD_UserSignedSet_[name] 指定更改设定的用户名 +CMD_UserSignedSet_CN 如果指定此参数,在验证了用户提交的证明书是否由可信赖的证明机构签名后,该证明书的通用名 (CN) 的值,与根据此参数设定的值相比较,只有取得一致的情况下才允许链接。指定 "none" 的情况下不进行确认。 +CMD_UserSignedSet_SERIAL 如果指定此参数,在验证了用户提交的证明书是否由可信赖的证明机构签名后,该证明书的序列号的值,与根据此参数设定的值相比较,只有取得一致的情况下才允许链接。指定 "none" 的情况下不进行确认。 +CMD_UserSignedSet_Prompt_CN 限定通用名 (CN) 的值 +CMD_UserSignedSet_Prompt_SERIAL 限定编号的值 + + +# UserRadiusSet 命令 +CMD_UserRadiusSet 将用户的认证方法设定为半径认证 +CMD_UserRadiusSet_Help 将在目前管理的虚拟 HUB 的安全帐户数据库上注册的用户认证方法设置为 "半径认证"。用户以被半径认证设置的用户名连接虚拟 HUB 时,用户名和用户输入的密码被发送到半径服务器,半径服务器检查用户名和密码后,如过该认证成功,用户被允许 VPN 连接。\n要使用半径认证,需要事先使用 RadiusServerSet 指令把要使用的半径服务器设置为虚拟 HUB。\n要获得目前注册的用户列表,请使用 UserList 指令。\n此指令,虚拟专用桥不能运行。\n此指令令在群集内作为群集成员服务器操作的 VPN Server 的虚拟 HUB 上不能运行。 +CMD_UserRadiusSet_Args UserRadiusSet [name] [/ALIAS:alias_name] +CMD_UserRadiusSet_[name] 指定更改设定的用户名 +CMD_UserRadiusSet_ALIAS 如果此参数被设置,可以使对半径服务器发送的用户名与虚拟 HUB 上的用户名是不同的。如果没有设置,请指定为 /ALIAS:none (使用虚拟 HUB 上的用户名)。用户名是 "*" 的情况下 /ALIAS 参数被忽略。关于 "*" 用户的描述,输入 UserCreate /HELP 可显示。 +CMD_UserRadiusSet_Prompt_ALIAS 验证用别名 (可选) + + +# UserNTLMSet 命令 +CMD_UserNTLMSet 用户身份验证方法设置为 NT 域认证 +CMD_UserNTLMSet_Help 将在目前管理的虚拟 HUB 的安全帐户数据库上注册的用户认证方法设置为 "NT 域验证"。用户以被 NT 域认证设置的用户名连接虚拟 HUB 时,用户名和用户输入的密码被发送到 Windows NT / 2000 / Server 2003 / Server 2008 域控制器或 Active Directory 服务器,认证服务器检查用户名和密码后,如果认证成功后,该用户的 VPN 连接被允许。要使用 NT 域认证,VPN Server 不要在连接到该域的 Windows NT 4.0,Windows 2000,Windows XP,Windows Server 2003 和 Windows Server 2008 的任何操作系统上运行。详情,请与 VPN Server 管理员咨询。\n要获得目前注册的用户列表,请使用 UserList 指令。\n此指令,虚拟专用桥不能运行。\n此指令令在群集内作为群集成员服务器操作的 VPN Server 的虚拟 HUB 上不能运行。 +CMD_UserNTLMSet_Args UserNTLMSet [name] [/ALIAS:alias_name] +CMD_UserNTLMSet_[name] 指定更改设定的用户名 +CMD_UserNTLMSet_ALIAS 如果此参数被设置,可以使对 NT 域或 Active Directory 发送的用户名与虚拟 HUB 上的用户名不同。如果没有设置,请指定 /ALIAS:none (使用虚拟 HUB 上的用户名)。用户名是 "*" 的情况下 /ALIAS 参数被忽略。关于 "*" 用户的描述,输入 UserCreate /HELP 可显示。 + + +# UserPolicyRemove 命令 +CMD_UserPolicyRemove 删除用户的安全策略 +CMD_UserPolicyRemove_Help 删除在目前管理的虚拟 HUB 的安全帐户数据库上已注册的用户设置的安全策略设置。被删除安全策略设置的用户,适用该用户所属的组的安全策略设置。如果不属于任何组,或改组没有设置安全策略,则遵从默认值 (允许访问: 启用,TCP连接数最大值: 32 个,超时时间: 20 秒)。\n要获得目前注册的用户列表,请使用 UserList 命令。\n此指令,虚拟专用桥不能运行。 \n此指令令在群集内作为群集成员服务器操作的 VPN Server 的虚拟 HUB 上不能运行。 +CMD_UserPolicyRemove_Args UserPolicyRemove [name] +CMD_UserPolicyRemove_[name] 指定更改设定的用户名 + + +# UserPolicySet 命令 +CMD_UserPolicySet 设置用户的安全策略 +CMD_UserPolicySet_Help 变更在目前管理的虚拟 HUB 的安全帐户数据库上已注册的用户设置的安全策略内容。\n当用户未设置安全策略时,设置新的默认安全策略后,更改被指定的值。\n要获得当前已注册的用户列表,请使用 UserList 指令。\n此指令,虚拟专用桥不能运行。\n此指令令在群集内作为群集成员服务器操作的 VPN Server 的虚拟 HUB 上不能运行。 +CMD_UserPolicySet_Args UserPolicySet [name] [/NAME:policy_name] [/VALUE:num|yes|no] +CMD_UserPolicySet_[name] 指定更改设定的用户名 +CMD_UserPolicySet_NAME 指定要变更值的策略的名称。您可以使用 PolicyList 命令显示策略名称和可设定值的列表。 +CMD_UserPolicySet_VALUE 指定策略的新值。如果其策略是数值型,指定整数。如果是布尔型,指定 "yes" 或 "no"。可以设定的类型和值,可以使用 PolicyList 指令显示。 + + +# UserExpiresSet 命令 +CMD_UserExpiresSet 设置用户的有效期限 +CMD_UserExpiresSet_Help 设置在目前管理的虚拟 HUB 安全帐户数据库中注册的用户的有效期限。有效期限到期的用户不能连接虚拟 HUB。\n要获得当前已注册的用户列表,请使用 UserList 指令。\n此指令,虚拟专用桥不能运行。\n此指令令在群集内作为群集成员服务器操作的 VPN Server 的虚拟 HUB 上不能运行。 +CMD_UserExpiresSet_Args UserExpiresSet [name] [/EXPIRES:expires] +CMD_UserExpiresSet_[name] 指定更改设定的用户名 +CMD_UserExpiresSet_EXPIRES 指定用户有效期限的日期和时间。如 "2005/10/08 19:30:00",以 6 个整数指定年,月,日,时,分,秒,用斜线或冒号分隔。年指定为 4 位数。如果把空格加入到值中,需要把整个值用 "" 围住。可以指定本地时间 (计算机上的命令行管理工具运行的标准时间)。如果指定 /EXPIRES:none,可以解除有效期限。 +CMD_UserExpiresSet_Prompt_EXPIRES 用户的有效期限 (没有指定,即没有期限): + + +# GroupList 命令 +CMD_GroupList 获取组列表 +CMD_GroupList_Help 获取在目前管理的虚拟 HUB 的安全帐户数据库中注册的组列表。\n此命令用 VPN Bridge 不能运行。\n此命令在群集内作为群集成员服务器操作的 VPN Server 的虚拟 HUB 上不能运行。 +CMD_GroupList_Args GroupList + + +# GroupCreate 命令 +CMD_GroupCreate 创建组 +CMD_GroupCreate_Help 在目前管理的虚拟 HUB 安全帐户数据库内建立新组。\n在组内可以登记多个用户。要在组内注册用户,使用 GroupJoin 命令。\n此命令用 VPN Bridge 不能运行。\n此命令在群集内作为群集成员服务器操作的 VPN Server 的虚拟 HUB 上不能运行。 +CMD_GroupCreate_Args GroupCreate [name] [/REALNAME:realname] [/NOTE:note] +CMD_GroupCreate_[name] 指定要创建的组名。 +CMD_GroupCreate_REALNAME 指定该组的全名。例如,如果组对应于实际的部分或部门名称,指定其名称。如果不指定的情况下,请指定 /REALNAME:none。 +CMD_GroupCreate_NOTE 指定组的描述。如果不指定的情况下,请指定 /NOTE:none。 +CMD_GroupCreate_Prompt_NAME 组名称: +CMD_GroupCreate_Prompt_REALNAME 组的全名: +CMD_GroupCreate_Prompt_NOTE 组描述: + + +# GroupSet 命令 +CMD_GroupSet 设置组信息 +CMD_GroupSet_Help 设置在目前管理的虚拟 HUB 安全帐户数据库中注册的组信息。\n要获取当前已注册的组列表,请使用 GroupList 命令。\n此命令用 VPN Bridge 不能运行。\n此命令在群集内作为群集成员服务器操作的 VPN Server 的虚拟 HUB 上不能运行。 +CMD_GroupSet_Args GroupSet [name] [/REALNAME:realname] [/NOTE:note] +CMD_GroupSet_[name] 指定变更设定的组名。 +CMD_GroupSet_REALNAME 指定该组的全名。例如,如果组对应于实际的部分或部门名称,指定其名称。如果不指定的情况下,请指定 /REALNAME:none。 +CMD_GroupSet_NOTE 指定组的描述。如果不指定的情况下,请指定 /NOTE:none。 + + +# GroupDelete 命令 +CMD_GroupDelete 删除组 +CMD_GroupDelete_Help 删除目前管理的虚拟 HUB 安全帐户数据库中注册的组。\n一旦删除组,该组所属的所有用户将成为未分配的。\n要获取当前已注册的组列表,请使用 GroupList 命令。\n此命令不能运行的 VPN Bridge。\n您不能执行这个虚拟的 VPN 作为在群集成员服务器操作系统服务器花鼓命令。 +CMD_GroupDelete_Args GroupDelete [name] +CMD_GroupDelete_[name] 指定删除的组名。 + + +# GroupGet 命令 +CMD_GroupGet 获得组信息和所属用户列表 +CMD_GroupGet_Help 获取目前管理的虚拟 HUB 安全帐户数据库中注册的组信息和属于改组的用户列表。\n要获取当前已注册的组列表,请使用 GroupList 命令。\n此命令用 VPN Bridge 不能运行。\n此命令在群集内作为群集成员服务器操作的 VPN Server 的虚拟 HUB 上不能运行。 +CMD_GroupGet_Args GroupGet [name] +CMD_GroupGet_[name] 指定获得信息的组名。 +CMD_GroupGet_Column_NAME 组名 +CMD_GroupGet_Column_REALNAME 全名 +CMD_GroupGet_Column_NOTE 描述 +CMD_GroupGet_Column_POLICY 这个组所设定的安全测略 +CMD_GroupGet_Column_MEMBERS 属于这个组的用户名列表 + + +# GroupJoin 命令 +CMD_GroupJoin 用户添加到组 +CMD_GroupJoin_Help 在目前管理的虚拟 HUB 的安全帐户数据库注册的组内,添加安全帐户数据库内的用户。\n目前注册的用户和组的列表,可使用 UserList 命令和 GroupList 命令获取。\n此命令用 VPN Bridge 不能运行。\n此命令在群集内作为群集成员服务器操作的 VPN Server 的虚拟 HUB 上不能运行。 +CMD_GroupJoin_Args GroupJoin [name] [/USERNAME:username] +CMD_GroupJoin_[name] 指定要添加用户的组名。 +CMD_GroupJoin_USERNAME 指定往以 name 指定了的组添加的用户名。 +CMD_GroupJoin_Prompt_USERNAME 要加入组的用户名: + + +# GroupUnjoin 命令 +CMD_GroupUnjoin 从组内删除用户 +CMD_GroupUnjoin_Help 从目前管理的虚拟 HUB 安全帐户数据库注册的组中,删除指定用户。用户一旦从组中被删除,该用户成为未分配。\n要获取当前组的用户列表,使用 GroupGet 命令。\n要获取当前已注册的组列表,使用 GroupList 命令。\n此命令用 VPN Bridge 不能运行。\n此命令在群集内作为群集成员服务器操作的 VPN Server 的虚拟 HUB 上不能运行。 +CMD_GroupUnjoin_Args GroupUnjoin [name] +CMD_GroupUnjoin_[name] 指定要从组内删除的用户名。 +CMD_GroupUnjoin_Prompt_name 要从组内删除的用户名: + + +# GroupPolicyRemove 命令 +CMD_GroupPolicyRemove 删除组的安全策略 +CMD_GroupPolicyRemove_Help 对在目前管理的虚拟 HUB 的安全帐户数据胡中注册的组,删除其被设置的安全策略的设置。对所属的组及用户本身没有被设置安全策略的用户,遵照默认值 (允许访问: 启用,TCP 连接数的最大值: 32 个,超时时间: 20 秒)。\n要获得当前已注册的组列表,使用 GroupList 命令。\n此命令用 VPN Bridge 不能运行。\n此命令在群集内作为群集成员服务器操作的 VPN Server 的虚拟 HUB 上不能运行。 +CMD_GroupPolicyRemove_Args GroupPolicyRemove [name] +CMD_GroupPolicyRemove_[name] 指定变更设定的组名。 + + +# GroupPolicySet 命令 +CMD_GroupPolicySet 设置组的安全策略 +CMD_GroupPolicySet_Help 对在目前管理的虚拟 HUB 的安全帐户数据胡中注册的组,更改其被设置的安全策略的设置。\n如组尚未设置安全策略,新的默认安全策略设置后,更改被指定的值。\n要获得当前已注册的组列表,使用 GroupList 命令。\n此命令用 VPN Bridge 不能运行。\n此命令在群集内作为群集成员服务器操作的 VPN Server 的虚拟 HUB 上不能运行。 +CMD_GroupPolicySet_Args GroupPolicySet [name] [/NAME:policy_name] [/VALUE:num|yes|no] +CMD_GroupPolicySet_[name] 指定变更设定的组名。 +CMD_GroupPolicySet_NAME 指定要更改其值的策略名称。您可以使用 PolicyList 命令显示的策略名称和可以设置值的列表。 +CMD_GroupPolicySet_VALUE 指定一个新的策略值。如果策略是数值型的情况下,指定一个整数。如果是布尔型的情况下,指定 "yes" 或 "no"。可以设定类型和值,可以使用 PolicyList 指令显示。 + + +# SessionList 命令 +CMD_SessionList 获取连接会话的列表 +CMD_SessionList_Help 获取目前管理的与虚拟 HUB 连接中的的会话列表。在会话列表中,以下信息将显示为每个连接: [会话名称],[会话场所],[用户名],[连接源主机名称],[TCP 连接],[传输字节数] 和 [传输数据包数]。\n如果当前连接的 VPN Server 是群集控制器,管理的虚拟 HUB 是静态的虚拟 HUB,可以得到连接其所有的集群成员的该虚拟 HUB 的会话列表的结合。\n在其他情况下,只能获取与目前管理的 VPN Server 实际连接着的会话列表。 +CMD_SessionList_Args SessionList + + +# SessionGet 命令 +CMD_SessionGet 获取会话信息 +CMD_SessionGet_Help 指定与当目前管理的虚拟 HUB 连接着的会话,并获得其会话信息。会话信息包括以下内容: 连接源主机名和用户名,版本信息,时间信息,TCP 连接数,通讯参数,会话密钥,输入输出的数据统计资料,和其他客户端和服务器信息等。\n要获得当前连接的会话列表,请使用 SessionList 命令。 +CMD_SessionGet_Args SessionGet [name] +CMD_SessionGet_[name] 指定要获取信息的会话名称。 +CMD_SessionGet_Prompt_NAME 会话名称: + + +# SessionDisconnect 命令 +CMD_SessionDisconnect 断开会话 +CMD_SessionDisconnect_Help 指定连接到目前管理的虚拟 HUB 的会话,管理员权限以强制断开其会话。\n但是,终端的客户端的设置为通信断开后的自动启动重新连接会话的情况下,可能客户端会重新连接。\n要获得当前连接会话列表,请使用 SessionList 命令。 +CMD_SessionDisconnect_Args SessionDisconnect [name] +CMD_SessionDisconnect_[name] 指定要断开的会话名称。 + + +# MacTable 命令 +CMD_MacTable 获取 MAC 地址表数据库 +CMD_MacTable_Help 获取当前管理的虚拟 HUB 保持的 MAC 地址表的数据库。\nMAC 地址表数据库是虚拟 HUB 需要进行交换以太网帧的平台,虚拟 HUB 基于 MAC 地址表的数据库,决定各个以太网帧排序目标会话。MAC 地址数据库自动分析创建虚拟 HUB 流动的通信内容。\n指定的会话名称,可以得到与该会话有关的 MAC 地址表项。 +CMD_MacTable_Args MacTable [session_name] +CMD_MacTable_[session_name] 如果指定作为参数的会话名称,可以只显示与该会话相关联的 MAC 地址表项。如果不指定,则显示所有的项。 + + +# MacDelete 命令 +CMD_MacDelete 删除 MAC 地址表项 +CMD_MacDelete_Help 操作目前管理的虚拟 HUB 保持的 MAC 地址表数据库,从数据库中删除指定的 MAC 地址项。\n要获取目前的 MAC 地址表数据库的内容,请使用 MacTable 命令。 +CMD_MacDelete_Args MacDelete [id] +CMD_MacDelete_[id] 指定要删除的 MAC 地址表项的 ID。 +CMD_MacDelete_Prompt 要删除的 ID: + + +# IpTable 命令 +CMD_IpTable 获取 IP 地址表数据库 +CMD_IpTable_Help 目前管理的虚拟 HUB 保持的 IP 地址表的数据库。\nIP 地址表数据库是一个自动分析生成通信内容的平台,为使虚拟 HUB 能够掌握哪个会话使用的是哪个 IP 地址,这是经常被使用的虚拟 HUB 安全策略的引擎。\n指定的会话名称,可以获取与该会话相关联的 IP 地址表项。 +CMD_IpTable_Args IpTable [session_name] +CMD_IpTable_[session_name] 指定作为参数的会话名称,可以只显示与该会话相关联的 IP 地址表项。如果不指定,则显示所有的项。 + + +# IpDelete 命令 +CMD_IpDelete 删除 IP 地址表项 +CMD_IpDelete_Help 操作目前管理的虚拟 HUB 保持的 IP 地址表数据库,从数据库中删除指定的 IP 地址项。\n要获取目前的 IP 地址表数据库的内容,请使用 IpTable 命令。 +CMD_IpDelete_Args IpDelete [id] +CMD_IpDelete_[id] 指定要删除的 IP 地址表项的 ID。 + + +# SecureNatEnable 命令 +CMD_SecureNatEnable 启用虚拟 NAT 和 DHCP 服务器功能 (安全网络功能) +CMD_SecureNatEnable_Help 使在目前管理的虚拟 HUB 内启动并运行虚拟 NAT 和 DHCP 服务器功能 (安全网络功能)。执行此指令前,必须先使用 SecureNatHostGet 指令,NatGet 指令和 DhcpGet 指令检查当前虚拟 NAT 功能和 DHCP 服务器的设置内容。\n一旦启用安全网络的功能,可以在虚拟 HUB 的虚拟网络上使 NAT 路由器 (IP 伪装) 和 DHCP 服务器功能虚拟性的运行。\n\n[有关安全网络功能的警告]\n安全网络的功能是面向系统管理员和对具备有关网络的丰富知识的人的功能。\n如果正确使用安全网络功能,可能实现通过 VPN 的安全的远程访问。但是如果错误地使用,可能使整个网络处于危险状态。如果不具备全面的的网络知识,没有得到网络管理员许可的情况下,请禁用安全网络功能。关于安全网络功能的详细说明,请参阅 VPN Server 的手册和在线文档。\n此命令在群集内作为群集成员服务器操作的 VPN Server 的虚拟 HUB 上不能运行。 +CMD_SecureNatEnable_Args SecureNatEnable + + +# SecureNatDisable 命令 +CMD_SecureNatDisable 禁用虚拟 NAT 和 DHCP 服务器功能 (安全网络功能) +CMD_SecureNatDisable_Help 在当前管理的虚拟 HUB 内禁用虚拟 NAT 和 DHCP 服务器功能 (安全网络功能)。一旦执行该命令,虚拟 NAT 功能立即停止,虚拟 DHCP 服务器功能则删除持有的 DHCP 租赁数据并停止该服务。\n该指令在作为进群操作的 VPN Server 的虚拟服务器上不能执行。 +CMD_SecureNatDisable_Args SecureNatDisable + + +# SecureNatStatusGet 命令 +CMD_SecureNatStatusGet 获取虚拟 NAT 和 DHCP 服务器功能 (安全网络功能) 的工作状态 +CMD_SecureNatStatusGet_Help 如果在目前管理的虚拟 HUB 内操作虚拟 NAT 和 DHCP 服务器功能 (安全网络功能),获得其操作状态。 \n该指令在作为进群操作的 VPN Server 的虚拟服务器上不能执行。 +CMD_SecureNatStatusGet_Args SecureNatStatusGet + + +# SecureNatHostGet 命令 +CMD_SecureNatHostGet 获取安全网络功能的虚拟主机的网络接口设置 +CMD_SecureNatHostGet_Help 在当前管理的虚拟 HUB 内获取虚拟 NAT 和 DHCP 服务器功能 (安全网络功能) 中的虚拟主机的网络接口设置。\n安全网络功能有一枚在虚拟 HUB 内二级市场中的虚拟 LAN 卡,它被赋予了 MAC 地址和 IP 地址。这样,连接到同一个二级市场的其他主机,能够如存在于网络的真实 IP 主机般与安全网络的虚拟主机通信。\n\n[有关安全网络功能的警告]\n安全网络的功能是面向系统管理员和对具备有关网络的丰富知识的人的功能。\n如果正确使用安全网络功能,可能实现通过 VPN 的安全的远程访问。但是如果错误地使用,可能使整个网络处于危险状态。如果不具备全面的的网络知识,没有得到网络管理员许可的情况下,请禁用安全网络功能。关于安全网络功能的详细说明,请参阅 VPN Server 的手册和在线文档。\n此命令在群集内作为群集成员服务器操作的 VPN Server 的虚拟 HUB 上不能运行。 +CMD_SecureNatHostGet_Args SecureNatHostGet +CMD_SecureNatHostGet_Column_MAC MAC 地址 +CMD_SecureNatHostGet_Column_IP IP 地址 +CMD_SecureNatHostGet_Column_MASK 子网掩码 +CMD_SecureNatHostGet_Column_LOG 保存 NAT 和 DHCP 操作日志 + + +# SecureNatHostSet 命令 +CMD_SecureNatHostSet 更改安全网络功能的虚拟主机的网络接口设置 +CMD_SecureNatHostSet_Help 当前管理的虚拟 HUB 内,更改和保存虚拟 NAT 和 DHCP 服务器功能 (安全网络功能) 的设置项目中的虚拟主机网络接口设置。\n安全网络功能有一枚在虚拟 HUB 内二级市场中的虚拟 LAN 卡,它被赋予了 MAC 地址和 IP 地址。这样,连接到同一个二级市场的其他主机,能够如存在于网络的真实 IP 主机般与安全网络的虚拟主机通信。\n\n[有关安全网络功能的警告]\n安全网络的功能是面向系统管理员和对具备有关网络的丰富知识的人的功能。\n如果正确使用安全网络功能,可能实现通过 VPN 的安全的远程访问。但是如果错误地使用,可能使整个网络处于危险状态。如果不具备全面的的网络知识,没有得到网络管理员许可的情况下,请禁用安全网络功能。关于安全网络功能的详细说明,请参阅 VPN Server 的手册和在线文档。\n此命令在群集内作为群集成员服务器操作的 VPN Server 的虚拟 HUB 上不能运行。 +CMD_SecureNatHostSet_Args SecureNatHostSet [/MAC:mac] [/IP:ip] [/MASK:mask] +CMD_SecureNatHostSet_MAC 指定分配到虚拟接口的 MAC 地址。MAC 地址用诸如 "00-AC-01-23-45-67" 的字符串指定。一但指定 /MAC:none,则不更改将当前的设置。 +CMD_SecureNatHostSet_IP 指定分配到虚拟接口的 IP 地址。一但指定 /IP:none,则不更改将当前的设置。 +CMD_SecureNatHostSet_MASK 指定分配到虚拟接口的子网掩码。一但指定 /MASK:none,则不更改将当前的设置。 +CMD_SecureNatHostSet_Prompt_MAC MAC 地址: +CMD_SecureNatHostSet_Prompt_IP IP 地址: +CMD_SecureNatHostSet_Prompt_MASK 子网掩码: + + +# NatGet 命令 +CMD_NatGet 获得安全网络功能的虚拟 NAT 功能的设置 +CMD_NatGet_Help 在当前管理的虚拟 HUB 内,获得虚拟 NAT 和 DHCP 服务器功能 (安全网络功能) 的设置项目中的虚 NAT 设置。\n该指令在作为进群操作的 VPN Server 的虚拟服务器上不能执行。 +CMD_NatGet_Args NatGet +CMD_NatGet_Column_USE 使用虚拟 NAT 功能 +CMD_NetGet_Column_MTU MTU 值 +CMD_NatGet_Column_TCP TCP 会话超时 (秒) +CMD_NatGet_Column_UDP UDP 会话超时 (秒) + + +# NatEnable 命令 +CMD_NatEnable 启用安全网络功能的虚拟 NAT 功能 +CMD_NatEnable_Help 在目前管理的虚拟 HUB 内启用虚拟 NAT 功能。\n如果使用此指令启动虚拟 NAT 功能,但 SecureNAT 功能没有工作时,则虚拟的 NAT 不工作。要启动 SecureNAT 功能的工作,使用 SecureNatEnable 命令。\n该指令在作为进群操作的 VPN Server 的虚拟服务器上不能执行。 +CMD_NatEnable_Args NatEnable + + +# NatDisable 命令 +CMD_NatDisable 禁用安全网络功能的虚拟 NAT 功能 +CMD_NatDisable_Help 在目前管理的虚拟 HUB 内禁用虚拟 NAT 功能。\n该指令在作为进群操作的 VPN Server 的虚拟服务器上不能执行。 +CMD_NatDisable_Args NatDisable + + +# NatSet 命令 +CMD_NatSet 更改安全网络功能的虚拟 NAT 功能的设置 +CMD_NatSet_Help 更改目前管理的虚拟 HUB 内的虚拟的 NAT 设置。虚拟的 NAT 设置的内容包括: MTU 值,TCP 会话超时,UDP 会话超时。\n该指令在作为进群操作的 VPN Server 的虚拟服务器上不能执行。 +CMD_NatSet_Args NatSet [/MTU:mtu] [/TCPTIMEOUT:tcp_timeout] [/UDPTIMEOUT:udp_timeout] [/LOG:yes|no] +CMD_NatSet_MTU 用字节数单位的整数设置 MTU (最大可转让单位的大小)。此值是不包括虚拟 NAT 发送的以太网帧的 MAC 头最大有效载荷长度,默认值是 1500 字节。 +CMD_NatSet_TCPTIMEOUT 设置虚拟 NAT 中转 TCP 会话时如果持续多少秒非通信状态即超时并丢弃会话。 +CMD_NatSet_UDPTIMEOUT 设置虚拟 NAT 中转 UDP 会话时如果持续多少秒非通信状态即超时并丢弃会话。 +CMD_NatSet_LOG 指定是否将虚拟 NAT 的操作保存在虚拟 HUB 安全日志。指定 "yes" 即保存它,指定 "no" 即不保存。 +CMD_NatSet_Prompt_MTU MTU 值: +CMD_NatSet_Prompt_TCPTIMEOUT TCP 会话超时 (秒): +CMD_NatSet_Prompt_UDPTIMEOUT UDP 会话超时 (秒): +CMD_NatSet_Prompt_LOG 保存日志 (yes/no): +CMD_NatSet_Eval_MTU 请在从 %d 到 %d 之间设定 MTU 值。 +CMD_NatSet_Eval_TCP 请在从 %d 到 %d 之间设定 TCP 会话超时秒数。 +CMD_NatSet_Eval_UDP 请在从 %d 到 %d 之间设定 UDP 会话超时秒数。 + + +# NatTable 命令 +CMD_NatTable 获得安全网络功能的虚拟 NAT 功能会话表 +CMD_NatTable_Help 虚拟 NAT 功能在目前管理的虚拟 HUB 内运作时,经由虚拟 NAT 获取目前通信中的 TCP 及 UDP 会话表 (NAT 表)。\n该指令在作为进群操作的 VPN Server 的虚拟服务器上不能执行。 +CMD_NatTable_Args NatTable + + +# DhcpGet 命令 +CMD_DhcpGet 获得安全网络功能的虚拟 DHCP 服务器功能的设置 +CMD_DhcpGet_Help 在当前管理的虚拟 HUB 内获取虚拟 NAT 和 DHCP 服务器功能 (安全网络功能) 的设置项目中的虚拟 DHCP 服务器设置。\n该指令在作为进群操作的 VPN Server 的虚拟服务器上不能执行。 +CMD_DhcpGet_Args DhcpGet +CMD_DhcpGet_Column_Log NAT 和 DHCP 的操作日志记录 +CMD_DhcpGet_Column_USE 使用虚拟 DHCP 功能 +CMD_DhcpGet_Column_IP1 分发地址范围的开始 +CMD_DhcpGet_Column_IP2 分发地址范围的结束 +CMD_DhcpGet_Column_MASK 子网掩码 +CMD_DhcpGet_Column_LEASE 租赁期限 (秒) +CMD_DhcpGet_Column_GW 默认网关地址 +CMD_DhcpGet_Column_DNS DNS 服务器地址 1 +CMD_DhcpGet_Column_DNS2 DNS 服务器地址 2 +CMD_DhcpGet_Column_DOMAIN 域名 +CMD_DhcpGet_Column_PUSHROUTE 静态路由表推送 + + +# DhcpEnable 命令 +CMD_DhcpEnable 启动安全网络功能的虚拟 DHCP 服务器功能 +CMD_DhcpEnable_Help 在当前管理的虚拟 HUB 内启动虚拟 DHCP 服务器功能。如果使用此指令启动虚拟 DHCP 服务器功能但 SecureNAT 功能不工作的情况下,则虚拟 DHCP 服务器不工作。要启动 SecureNAT 功能,使用 SecureNatEnable 指令。\n该指令在作为进群操作的 VPN Server 的虚拟服务器上不能执行。 +CMD_DhcpEnable_Args DhcpEnable + + +# DhcpDisable 命令 +CMD_DhcpDisable 禁用安全网络功能的虚拟 DHCP 服务器功能 +CMD_DhcpDisable_Help 在目前管理的虚拟 HUB 内禁用 DHCP 服务器。\n该指令在作为进群操作的 VPN Server 的虚拟服务器上不能执行。 +CMD_DhcpDisable_Args DhcpDisable + + +# DhcpSet 命令 +CMD_DhcpSet 更改安全网络功能的虚拟 DHCP 服务器功能的设置 +CMD_DhcpSet_Help 在现在管理的虚拟 HUB 内,更改虚拟 DHCP 服务器的设置。虚拟 DHCP 服务器设置包括: 分配 IP 地址范围,子网掩码,出租期限,及分配给客户端的选项值。\n该指令在作为进群操作的 VPN Server 的虚拟服务器上不能执行。 +CMD_DhcpSet_Args DhcpSet [/START:start_ip] [/END:end_ip] [/MASK:subnetmask] [/EXPIRE:sec] [/GW:gwip] [/DNS:dns] [/DNS2:dns2] [/DOMAIN:domain] [/LOG:yes|no] [/PUSHROUTE:"routing_table"] +CMD_DhcpSet_START 指定地址范围的开始点,以分发给客户。(例如: 192.168.30.10) +CMD_DhcpSet_END 指定地址范围的结束点,以分发给客户。(例如: 192.168.30.200) +CMD_DhcpSet_MASK 指定对客户指定的子网掩码。(例如: 255.255.255.0) +CMD_DhcpSet_EXPIRE 以秒为单位对客户指定租赁 IP 地址时的有效期限 +CMD_DhcpSet_GW 指定要通知给客户端的默认网关的 IP 地址。如果要与安全网络功能的虚拟 NAT 功能一起启动并使用时,可以指定安全网络的虚拟主机的 IP 地址。如果指定 "0" 或 "none",则不将默认网关通知客户。 +CMD_DhcpSet_DNS 指定被通知到客户端的主 DNS 服务器的 IP 地址。当 SecureNAT 功能的虚拟 NAT 功能已经启用并正在运行时,您可以为此指定一个 SecureNAT 虚拟主机 IP 地址。如果您指定的是 0 或者 none,那么客户端就不会被 DNS 服务器地址通知。 +CMD_DhcpSet_DNS2 指定被通知到客户端的次要 DNS 服务器 IP 地址。当 SecureNAT 功能的虚拟 NAT 功能已经启用并正在运行时,您可以为此指定一个 SecureNAT 虚拟主机 IP 地址。如果您指定的是 0 或者 none,那么客户端就不会被 DNS 服务器地址通知。 +CMD_DhcpSet_DOMAIN 指定域名通知客户。如果指定 none,该域名不通知客户。 +CMD_DhcpSet_LOG 指定是否将虚拟 DHCP 服务器运行保存为安全日志。指定 "yes" 则保存。此值与虚拟 NAT 功能的日志保存设置是联动的。 +CMD_DhcpSet_PUSHROUTE 指定静态路由表推送。\n例如: "192.168.5.0/255.255.255.0/192.168.4.254, 10.0.0.0/255.0.0.0/192.168.4.253"\n用逗号或空格字符来拆分多条目 (最多 64 条目)。每个条目必须以 "IP 网络地址/子网掩码/网关 IP 地址" 的格式来指定。 \n这个虚拟 DHCP 服务器可以推送带DHCP应答消息的无类静态路由 (RFC 3442) 至 VPN 客户端。\nVPN 客户端是否能够识别无类静态路由 (RFC 3442) 取决于目标VPN客户端软件。SoftEther VPN 客户端和 OpenVPN 客户端都支持无类静态路由。在 L2TP/IPSec 和 MS-SSTP 协议上,兼容性取决于客户端软件的实施。如果你清除了虚拟 DHCP 服务器选项的默认网关字段,您就可以实现拆分隧道。在客户端一侧,为了使用拆分隧道,L2TP/IPSec 和 MS-SSTP 客户端需要配置为不创建默认网关。\n您还可以通过现有的外部 DHCP 服务器推送无类静态路由 (RFC 3442)。在这种情况下,在 SecureNAT 禁用虚拟 DHCP 服务器功能,在这一屏幕上你不需要设置无类路由。\n请参阅 RFC 3442 以了解无类路由。 +CMD_DhcpSet_Prompt_START 分发地址范围的开始: +CMD_DhcpSet_Prompt_END 分发地址范围的结束: +CMD_DhcpSet_Prompt_MASK 子网掩码: +CMD_DhcpSet_Prompt_EXPIRE 租赁期限 (补): +CMD_DhcpSet_Prompt_GW 默认网关 (可以不设定): +CMD_DhcpSet_Prompt_DNS DNS 服务器 1 (可以不设定): +CMD_DhcpSet_Prompt_DNS2 DNS 服务器 2 (可以不设定): +CMD_DhcpSet_Prompt_DOMAIN 域名: + + +# DhcpTable 命令 +CMD_DhcpTable 获取安全网络功能的虚拟 DHCP 服务器租约表格 +CMD_DhcpTable_Help 在目前管理的虚拟 HUB 内操作 DHCP 服务器功能时,获取分配到 DHCP 服务器持有的客户端的 IP 地址租约表。\n该指令在作为进群操作的 VPN Server 的虚拟服务器上不能执行。 +CMD_DhcpTable_Args DhcpTable + + +# AdminOptionList 命令 +CMD_AdminOptionList 获取虚拟 HUB 管理选项列表 +CMD_AdminOptionList_Help 获取目前管理的虚拟 HUB 设置的虚拟 HUB 管理选项列表。\nVPN Server 的管理员委托各个虚拟 HUB 的管理员对虚拟 HUB 进行管理时,为限制其设置范围,使用虚拟 HUB 管理选项。\n能够对虚拟 HUB 管理选项进行添加,编辑,删除的,只有掌握着此 VPN Server 全部管理权限的管理员。虚拟 HUB 的管理员可以显示管理选项,但不能更改。\n然而,allow_hub_admin_change_option 设置为 1 时,虚拟 HUB 的管理员也可以编辑管理选项。\n此命令用 VPN Bridge 不能运行。\n此命令在群集内作为群集成员服务器操作的 VPN Server 的虚拟 HUB 上不能运行。 +CMD_AdminOptionList_Args AdminOptionList + + +# AdminOptionSet 命令 +CMD_AdminOptionSet 设置虚拟 HUB 管理选项的价值 +CMD_AdminOptionSet_Help 变更目前管理的虚拟 HUB 设置的虚拟 HUB 管理选项的值。\nVPN Server 的管理员委托各个虚拟 HUB 的管理员对虚拟 HUB 进行管理时,为限制其设置范围,使用虚拟 HUB 管理选项。\n能够对虚拟 HUB 管理选项进行添加,编辑,删除的,只有掌握着此 VPN Server 全部管理权限的管理员。虚拟 HUB 的管理员可以显示管理选项,但不能更改。\n然而,allow_hub_admin_change_option 设置为 1 时,虚拟 HUB 的管理员也可以编辑管理选项。\n此命令用 VPN Bridge 不能运行。\n此命令在群集内作为群集成员服务器操作的 VPN Server 的虚拟 HUB 上不能运行。 +CMD_AdminOptionSet_Args AdminOptionSet [name] [/VALUE:value] +CMD_AdminOptionSet_[name] 指定更改值的管理选项名。以 AdminOptionList 指令可以获取名单。 +CMD_AdminOptionSet_VALUE 以整数指定要设定的值。 +CMD_AdminOptionSet_Prompt_name 要更改值的管理选项名称: +CMD_AdminOptionSet_Prompt_VALUE 设定值 (整数): + + +# ExtOptionList 命令 +CMD_ExtOptionList 获取虚拟 HUB 扩展选项列表 +CMD_ExtOptionList_Help 获取目前管理的虚拟 HUB 设置的虚拟 HUB 扩展选项列表。\n虚拟 HUB 扩展选项使你可以对虚拟 HUB 进行更多的配置。\默认情况下,VPN Server 的全球管理员和个人虚拟 HUB 的管理员都可以修改虚拟 HUB 扩展选项。\n但是,如果虚拟 HUB 管理选项 deny_hub_admin_change_ext_option 被设置为 1,个人虚拟 HUB 管理员就不能修改虚拟 HUB 扩展选项。\n此命令不能在 VPN Bridge 上运行。\n以集群成员运行的 VPN Server 的虚拟 HUB 不能执行此命令。 +CMD_ExtOptionList_Args ExtOptionList + + +# ExtOptionSet 命令 +CMD_ExtOptionSet 设置虚拟 HUB 扩展选项的值 +CMD_ExtOptionSet_Help 使用此命令在当前管理的虚拟 HUB 的虚拟 HUB 扩展选项列表设置一个值。\n虚拟 HUB 扩展选项使你可以对虚拟 HUB 进行更多的配置。\默认情况下,VPN Server 的全球管理员和个人虚拟 HUB 的管理员都可以修改虚拟 HUB 扩展选项。\n但是,如果虚拟 HUB 管理选项 deny_hub_admin_change_ext_option 被设置为 1,个人虚拟 HUB 管理员就不能修改虚拟 HUB 扩展选项。\n此命令不能在 VPN Bridge 上运行。 \n以集群成员运行的 VPN Server 的虚拟 HUB 不能执行此命令。 +CMD_ExtOptionSet_Args ExtOptionSet [name] [/VALUE:value] +CMD_ExtOptionSet_[name] 指定您要更改其值的虚拟 HUB 扩展选项的名称。使用 ExtOptionList 命令,你可以得到一个名称列表。 +CMD_ExtOptionSet_VALUE 以整数指定要设定的值。 +CMD_ExtOptionSet_Prompt_name 要更改值的扩展选项名称: +CMD_ExtOptionSet_Prompt_VALUE 设定值 (整数): + + +# CrlList 命令 +CMD_CrlList 获取无效证书名单列表 +CMD_CrlList_Help 获取目前管理的虚拟 HUB 设置的无效证书名单列表。\n一旦证书注册到无效证书列表内,提交了其证书的客户,将不能用证书认证模式连接虚拟 HUB。\n通常情况下,因为泄漏密钥或证书持有人的权限失效时,将该证书作为无效证书注册到虚拟 HUB,而 VPN 客户欲使用该证书连接虚拟 HUB 时会被拒绝用户认证,这种情况下该功能被使用。\n此命令用 VPN Bridge 不能运行。\n此命令在群集内作为群集成员服务器操作的 VPN Server 的虚拟 HUB 上不能运行。 +CMD_CrlList_Args CrlList + + +# CrlAdd 命令 +CMD_CrlAdd 添加无效的证书 +CMD_CrlAdd_Help 在目前管理的虚拟 HUB 设置的无效的证书名单中添加新的无效证书的定义。\n用此指令的参数指定要注册到无效证书列表中的内容。用户用证书认证模式连接到虚拟 HUB 时,如果其证书与无效证书列表中注册的一条以上的内容一致,将拒绝该用户的连接。\n与此指令指定的参数定义的所有条件相一致的证书,会被判断为无效。\n可以设置该项目为:[名称 (CN)],[所属机构 (O)],[组织单位 (OU)],[国家 (C)],[州 (ST)],[现地 (L)],[序号 (十六进制)],[MD5 摘要值 (十六进制,128 位)],[SHA-1 摘要值 (十六进制,160位)]。摘要值 (哈希值) 的指定,是将证明书指定为事实上的唯一。通常情况下,如果输入 MD5 或 SHA-1摘要值,就不用输入其他项目。\n此命令用 VPN Bridge 不能运行。\n此命令在群集内作为群集成员服务器操作的 VPN Server 的虚拟 HUB 上不能运行。 +CMD_CrlAdd_Args CrlAdd [/SERIAL:serial] [/MD5:md5] [/SHA1:sha1] [/CN:cn] [/O:o] [/OU:ou] [/C:c] [/ST:st] [/L:l] +CMD_CrlAdd_SERIAL 作为条件,在设定证书的序列号 (16 进制) 时,以此此参数指定其值。 +CMD_CrlAdd_MD5 作为条件,在设定证书的 MD5 摘要值 (十六进制,128 位) 时,以此参数指定其值。如果不指定 16 进制 32 个字符 (16 字节) 的参数,则被忽略。 +CMD_CrlAdd_SHA1 作为条件,在设定证书的 SHA-1 摘要值的条件 (十六进制,160 位) 时,以此参数指定其值。如不指定十六进制 40 个字符 (20 字节) 的参数,则被忽略。 +CMD_CrlAdd_CN 作为条件,指定证书的名称 (CN) 时,以此参数设定其值。 +CMD_CrlAdd_O 作为条件,指定证书的所属机构 (O) 时,以此参数设定其值。 +CMD_CrlAdd_OU 作为条件,指定证书的组织单位 (OU) 时,以此参数设定其值。 +CMD_CrlAdd_C 作为条件,指定证书的国家 (C) 时,以此参数设定其值。 +CMD_CrlAdd_ST 作为条件,指定证书的州 (ST) 时,以此参数设定其值。 +CMD_CrlAdd_L 作为条件,指定证书的当地 (L) 时,以此参数设定其值。 + + +# CrlDel 命令 +CMD_CrlDel 删除无效的证书 +CMD_CrlDel_Help 从目前管理的虚拟 HUB设置的无效证书名单中指定并删除无效证书的定义。\n目前注册的无效证书的定义列表,可用 CrlList 指令获取。\n该指令虚拟专用桥不能运行。 \n该指令在作为进群操作的 VPN Server 的虚拟服务器上不能执行。 +CMD_CrlDel_Args CrlDel [id] +CMD_CrlDel_[id] 指定要删除的无效的证书的定义中的 ID。 +CMD_CrlDel_Prompt_ID 删除 ID: + + +# CrlGet 命令 +CMD_CrlGet 获取无效的证书 +CMD_CrlGet_Help 从目前管理的虚拟 HUB 设置的无效证书名单中指定无效证书的定义,获取其定义的内容。\n目前注册的无效证书的定义列表,可用 CrlList 指令获取。\n该指令虚拟专用桥不能运行。\n该指令在作为进群操作的 VPN Server 的虚拟服务器上不能执行。 +CMD_CrlGet_Args CrlGet [id] +CMD_CrlGet_[id] 指定要获取的无效的证书的定义中的 ID。 +CMD_CrlGet_Prompt_ID 获取 ID: +CMD_CrlGet_CN 名 (CN) +CMD_CrlGet_O 所属机构 (O) +CMD_CrlGet_OU 组织单位 (OU) +CMD_CrlGet_C 国家 (C) +CMD_CrlGet_ST 州 (ST) +CMD_CrlGet_L 本地 (L) +CMD_CrlGet_SERI 序列号 (十六进制) +CMD_CrlGet_MD5_HASH MD5 摘要值 (以十六进制,128 位) +CMD_CrlGet_SHA1_HASH SHA-1 摘要值 (以十六进制,160 位) + + +# AcList 命令 +CMD_AcList 获取源 IP 地址访问限制列表的规则项目列表 +CMD_AcList_Help 用本命令来获取目前管理的虚拟 HUB 上设置的源 IP 地址限制列表规则的列表。\n根据客户端电脑的源 IP 地址,您可以允许或拒绝对该虚拟 HUB 的 VPN 连接。可以定义多个规则,设置每个规则的优先顺序。优先顺序按照从高到低顺序,根据最先与 IP 地址匹配的规则运行,允许或拒绝从客户端的连接。\n该命令在 VPN Bridge 上不能运行。\n以集群成员运行的 VPN Server 的虚拟 HUB 不能执行此命令。 +CMD_AcList_Args AcList + + +# AcAdd 命令 +CMD_AcAdd 添加规则到 IP 地址限制列表(IPv4) +CMD_AcAdd_Help 在目前管理的虚拟 HUB 设置的 IP 地址限制列表中添加新规则。\n当 VPN Client 试图连接虚拟 HUB 时,在此设置的项目决定允许或拒绝来自该客户端的连接。\n你可以指定规则项目的内容相匹配的客户端 IP 地址,或者 IP 地址和子网掩码。如果只指定 IP 地址,仅指定一台与该规则相匹配的计算机;如果指定 IP 网络掩码地址和子网掩码地址,该规则匹配的子网范围内的所有计算机均被指定。\n可以设置规则的优先顺序。以大于 1 的整数指定优先顺序,值越小则优先顺序越高。\n要获取目前注册的源 IP 地址限制列表,使用 AcList 命令。\n该命令在 VPN Bridge 上不能运行。\n以集群成员运行的 VPN Server 的虚拟 HUB 不能执行此命令。 +CMD_AcAdd_Args AcAdd [allow|deny] [/PRIORITY:priority] [/IP:ip/mask] +CMD_AcAdd_[allow|deny] 设定允许 ("allow") 或拒绝 ("deny") 与规则相一致的来自客户端的连接。 +CMD_AcAdd_PRIORITY 以大于 1 的整数指定该规则的优先顺序。其值越小则优先顺序越高。 +CMD_AcAdd_IP 以 "IP 地址/掩码" 的形式指定客户端 IPv4 地址范围。IPv4 地址为 "192.168.0.1" 那样的,指定为用点分隔的十进制数。掩码为 "255.255.255.0" 那样的,指定为用点分隔的十进制数,可以用十进制数指定 24 位从头开始的比特长度,可作为十进制 10 款规定。要指定一个单独的 IPv4 主机,指定掩码为 "32" 或者 "255.255.255.255" +CMD_AcAdd_Prompt_AD allow 或 deny: +CMD_AcAdd_Prompt_PRIORITY 优先顺序: +CMD_AcAdd_Prompt_IP IPv4 地址/掩码: +CMD_AcAdd_Eval_PRIORITY 优先级请指定 1 或以上的数字。 + + +# AcAdd6 命令 +CMD_AcAdd6 添加规则到源 IP 地址访问限制列表(IPv6) +CMD_AcAdd6_Help 在目前管理的虚拟 HUB 设置的 IP 地址限制列表中添加新规则。\n当 VPN Client 试图连接虚拟 HUB 时,在此设置的项目决定允许或拒绝来自该客户端的连接。\n你可以指定规则项目的内容相匹配的客户端 IP 地址,或者 IP 地址和子网掩码。如果只指定 IP 地址,仅指定一台与该规则相匹配的计算机;如果指定 IP 网络掩码地址和子网掩码地址,该规则匹配的子网范围内的所有计算机均被指定。\n可以设置规则的优先顺序。以大于 1 的整数指定优先顺序,值越小则优先顺序越高。\n要获取目前注册的源 IP 地址限制列表,使用 AcList 命令。\n该命令在 VPN Bridge 上不能运行。\n以集群成员运行的 VPN Server 的虚拟 HUB 不能执行此命令。 +CMD_AcAdd6_Args AcAdd6 [allow|deny] [/PRIORITY:priority] [/IP:ip/mask] +CMD_AcAdd6_[allow|deny] 设定允许 ("allow") 或拒绝 ("deny") 与规则相一致的来自客户端的连接。 +CMD_AcAdd6_PRIORITY 以大于 1 的整数指定该规则的优先顺序。其值越小则优先顺序越高。 +CMD_AcAdd6_IP 以 [IP 地址/掩码] 的形式指定客户端 IPv6 地址范围。IPv6 地址为 2001:200:0:1:: 那样的,指定由冒号分隔的十六进制数。掩码为 ffff:ffff:ffff:ffff:: 那样的,指定由冒号分隔的十六进制数,可以用十进制数指定 64 位从头开始的比特长度,可作为十进制 10 款规定。如果设定为 "::/128" 则显示单一的主机。 +CMD_AcAdd6_Prompt_AD allow 或 deny: +CMD_AcAdd6_Prompt_PRIORITY 优先顺序: +CMD_AcAdd6_Prompt_IP IPv6 地址/掩码: +CMD_AcAdd6_Eval_PRIORITY 优先级请指定 1 或以上的数字。 + + +# AcDel 命令 +CMD_AcDel 源 IP 地址限制列表内的删除规则 +CMD_AcDel_Help 使用本命令删除目前管理的虚拟 HUB 设置的 IP 地址限制列表的规则。\n要获取目前注册的 IP 访问控制列表的规则列表,使用AcList命令。\n该指令虚拟专用桥不能运行。\n该命令在 VPN Bridge 上不能运行。\n以集群成员运行的 VPN Server 的虚拟 HUB 不能执行此命令。 +CMD_AcDel_Args AcDel [id] +CMD_AcDel_[id] 指定要删除的源 IP 地址限制列表内的规则的 ID。 +CMD_AcDel_Prompt_ID 要删除的规则的 ID: + + +# LicenseAdd 命令 +CMD_LicenseAdd 注册新的许可证密钥 +CMD_LicenseAdd_Help 在 SoftEther VPN Server 注册新的许可证密钥。\n要使用 SoftEther VPN Server,需获取有效的许可证,并注册许可证密钥。许可证密钥是由 36 个字母数字字符和连字符 ( '-' ) 组成的,以证明许可证所有权的密钥的代码。\n一起获得本软件及许可证证书时,许可证密钥会被印刷在许可证证书上。如果在线购买本软件的许可证时,许可证密钥会在购买时的网页画面或邮件中记载。此外,许可证密钥还可能其他以方法被记载。如有不明,请咨询许可证的销售方。\n\n要获取目前注册的许可证列表,使用 LicenseList 指令。\n要显示目前 VPN Server 的许可证状态,使用 LicenseStatus 指令。\n要运行此指令,需要 VPN Server 的管理员权限。\n该指令虚拟专用桥不能运行。 +CMD_LicenseAdd_Args LicenseAdd [key] +CMD_LicenseAdd_[key] 指定要注册的许可证密钥。36 位字母数字,6 个一组以连字符分隔,进行指定。 +CMD_LicenseAdd_Prompt_Key 许可证密钥: + + +# LicenseDel 命令 +CMD_LicenseDel 删除已注册许可 +CMD_LicenseDel_Help 从 SoftEther VPN Server 上目前注册的许可证名单中删除指定的许可证。\n\n要获得目前注册的许可证名单,使用 LicenseList 指令。\n要显示目前的 VPN Server 的许可证状态,使用 LicenseStatus 指令。\n要运行此指令,需要 VPN Server 管理员权限。\n此指令,虚拟专用桥不能运行。 +CMD_LicenseDel_Args LicenseDel [id] +CMD_LicenseDel_[id] 指定要删除的的许可证的号码。 +CMD_LicenseDel_Prompt_ID 删除许可证号码: + + +# LicenseList 命令 +CMD_LicenseList 获得已注册许可证的列表 +CMD_LicenseList_Help 在 SoftEther VPN Server 上显示目前注册许可证的许可证密钥,许可证类型,状态,有效期限,许可证 ID,许可证类型 ID,服务器 ID 和编号 ID 的列表。\n\n要显示目前的 VPN Server 的许可证状态,使用 LicenseStatus 指令。\n要运行此指令,需要 VPN Server 管理员权限。\n此命令,虚拟专用桥不能运行。 +CMD_LicenseList_Args LicenseList + + +# LicenseStatus 命令 +CMD_LicenseStatus 获取目前的 VPN Server 状态 +CMD_LicenseStatus_Help 获取并显示当前 SoftEther VPN Server 的许可证状态。 \n显示 SoftEther VPN Server 目前产品版本名称,服务器 ID,产品许可证的有效期限,及可以利用的客户端连接许可证数和桥连接许可证数。\n\n要运行此指令,需要 VPN Server 管理员权限。\n此指令,虚拟专用桥不能运行。 +CMD_LicenseStatus_Args LicenseStatus + +# SoftEther VPN 4.0 添加的 命令 +# IPsecEnable 命令 +CMD_IPsecEnable 启用或禁用 IPsec VPN Server 功能 +CMD_IPsecEnable_Help 在 SoftEther VPN Server 上启用或禁用IPsec VPN Server 功能。\n如果您禁用了此功能,VPN Server 上的虚拟 HUB 将会接受从 L2TP 兼容的 PC,Mac OS X 和智能手机的远程 VPN 连接,同时也会接受 EtherIP 站点到站点的 VPN 连接。从智能手机上的 VPN 连接,如iPhone、iPad 和 Android, 和从 Mac OS X 和 Windows 上的本地 VPN Client 的连接也都会接受。\n\n要执行此命令,您必须具有 VPN Server 管理员权限。\n该命令在 VPN Bridge 上不能运行。\n以集群成员运行的 VPN Server 的虚拟 HUB 不能执行此命令。 +CMD_IPsecEnable_Args IPsecEnable [/L2TP:yes|no] [/L2TPRAW:yes|no] [/ETHERIP:yes|no] [/PSK:pre-shared-key] [/DEFAULTHUB:default_hub] +CMD_IPsecEnable_L2TP 启用或禁用 L2TP over IPsec 服务器功能。要接受来自 iPhone, iPad, Android, Windows 或者 Mac OS X 的 VPN 连接,请启用本选项。 +CMD_IPsecEnable_L2TPRAW 启用或禁用 L2TP 服务器功能 (未加密的原始 L2TP).要接受特殊 VPN 客服端,请启用本选项。 +CMD_IPsecEnable_ETHERIP 启用或禁用 EtherIP / L2TPv3 over IPsec服务器功能(为站点到站点 VPN Server 功能). 兼容 EtherIP over IPsec 的路由器产品就可以连接到 VPN Server 上的虚拟 HUB ,并建成二层(以太网)网桥。 +CMD_IPsecEnable_PSK 指定 IPsec 预共享密钥。IPsec 预共享密钥通常称为 "PSK" 或者"秘钥"。指定一个 8 位或者小于 8 位的密钥,并且将它分配给要连接到该 VPN Server 的用户。请注意:Google Android 4.0 有一个漏洞 bug,当预共享密钥是 10 位或以上时,会引发意外行为。介于这种情况,预共享密钥应该是 9 位或小于 9 位。 +CMD_IPsecEnable_DEFAULTHUB 为防止遗漏用户名上的 HUB 名,请指定默认的虚拟 HUB。用户应该指定他们的用户名,如 "用户名@目标虚拟 HUB 名" 来连接此 L2TP 服务器。如果指定的虚拟 HUB 被遗漏,那么上述HUB将会作为目标被使用。 +CMD_IPsecEnable_Prompt_L2TP 启用 L2TP over IPsec 服务器功能(yes / no): +CMD_IPsecEnable_Prompt_L2TPRAW 启用原始 L2TP 服务器功能(yes / no): +CMD_IPsecEnable_Prompt_ETHERIP 启用 EtherIP / L2TPv3 over IPsec服务器功能(yes / no): +CMD_IPsecEnable_Prompt_PSK IPsec 的预共享密钥(推荐:最多 9 位) +CMD_IPsecEnable_Prompt_DEFAULTHUB 为避免在用户名中遗漏 HUB,请默认虚拟 HUB 。 + + +# IPsecGet 命令 +CMD_IPsecGet 获得当前IPsec VPN Server 设置 +CMD_IPsecGet_Help 获得并显示在 SoftEther VPN Server 上的当前 IPsec VPN Server 设置。\n\n要执行此命令,您必须具有 VPN Server 管理员权限。\n该命令在 VPN Bridge 上不能运行。\n以集群成员运行的 VPN Server 的虚拟 HUB 不能执行此命令。 +CMD_IPsecGet_Args IPsecGet +CMD_IPsecGet_PRINT_L2TP L2TP over IPsec 服务器功能已启用 +CMD_IPsecGet_PRINT_L2TPRAW 原始 L2TP 服务器功能已启用 +CMD_IPsecGet_PRINT_ETHERIP EtherIP / L2TPv3 over IPsec 服务器功能已启用 +CMD_IPsecGet_PRINT_PSK IPsec 预共享密钥字符串 +CMD_IPsecGet_PRINT_DEFAULTHUB 默认虚拟 HUB 名 + + +# EtherIpClientAdd 命令 +CMD_EtherIpClientAdd 添加新的 EtherIP / L2TPv3 over IPsec 客户端设置来接受 EtherIP / L2TPv3 客户端设备 +CMD_EtherIpClientAdd_Help 添加一个新的设置条目启用 EtherIP / L2TPv3 over IPsec 服务器功能来接受客户端设备。\n为了能够通过EtherIP / L2TPv3 over IPsec 服务器功能接受来自路由器的连接,您需要定义两者之间的关系表。这两者分别是表示客户端兼容EtherIP / L2TPv3 over IPsec 路由器的IPsec Phase 1 字符串和目标虚拟 HUB 的名称。\n在您使用 EtherIpClientAdd 命令添加了一个连接定义后,这个定义的连接设置将会被应用到, EtherIP / L2TPv3 over IPsec 客户端设备的接入请求会话中。\n用户名和密码条目必须要在虚拟 HUB 上注册。一个 EtherIP / L2TPv3 客户端会被认为它使用如上的用户信息的身份连接到虚拟 HUB 。n\n为执行此命令,您必须具有 VPN Server 管理员权限。\n该命令在 VPN Bridge 上不能运行。\n以集群成员运行的 VPN Server 的虚拟 HUB 不能执行此命令。 +CMD_EtherIpClientAdd_Args EtherIpClientAdd [ID] [/HUB:hubname] [/USERNAME:username] [/PASSWORD:password] +CMD_EtherIpClientAdd_[ID] 指定一个 ISAKMP Phase 1 ID。这个 ID 必须与 EtherIP / L2TPv3 客户端的ID配置完全相同。如果. EtherIP 客户端用 IP 地址作为Phase 1 ID,您可以指定像 ID 的字符类似的 IP 地址。如果您指定 '*' (星号),它将会是一个与任一不符合其他具体规则的客户端相符合的通配符。 +CMD_EtherIpClientAdd_HUB 指定要连接的虚拟 HUB 名称。 +CMD_EtherIpClientAdd_USERNAME 指定连接到目的虚拟 HUB 的用户名。 +CMD_EtherIpClientAdd_PASSWORD 指定连接到目的虚拟 HUB 的密码。 +CMD_EtherIpClientAdd_Prompt_ID ISAKMP Phase 1 ID ('*' 是通配符): +CMD_EtherIpClientAdd_Prompt_HUB 虚拟 HUB 名 +CMD_EtherIpClientAdd_Prompt_USERNAME 登录虚拟 HUB 的用户名 +CMD_EtherIpClientAdd_Prompt_PASSWORD 登录虚拟 HUB 的密码 + + +# EtherIpClientDelete 命令 +CMD_EtherIpClientDelete 删除一个 EtherIP / L2TPv3 over IPsec 客户端设置 +CMD_EtherIpClientDelete_Help 本命令删除一个通过使用 EtherIP / L2TPv3 over IPsec 功能来接受 VPN Client 的条目。\n\n要执行此命令,您必须具有 VPN Server 管理员权限。\n该命令在 VPN Bridge 上不能运行。\n以集群成员运行的 VPN Server 的虚拟 HUB 不能执行此命令。 +CMD_EtherIpClientDelete_Args EtherIpClientDelete [ID] +CMD_EtherIpClientDelete_[ID] 指定一个要删除的 ISAKMP Phase 1 ID +CMD_EtherIpClientDelete_Prompt_ID ISAKMP Phase 1 ID: + + +# EtherIpClientList 命令 +CMD_EtherIpClientList 获得当前 EtherIP / L2TPv3 客户端设备条目定义列表 +CMD_EtherIpClientList_Help 这个命令会获得和显示通过 EtherIP / L2TPv3 over IPsec 功能来接受 VPN Client 条目的列表。\n\n要执行此命令,您必须具有 VPN Server 管理员权限。\n该命令在 VPN Bridge 上不能运行。\n以集群成员运行的 VPN Server 的虚拟 HUB 不能执行此命令。 +CMD_EtherIpClientList_Args EtherIpClientList + + +# OpenVpnMakeConfig 命令 +CMD_OpenVpnMakeConfig 生成 OpenVPN Client 样本设置文件 +CMD_OpenVpnMakeConfig_Help 原来,OpenVPN Client 会要求用户手写很难的配置文件。本工具可以帮助您创建一个有用的配置样本。你所需要生成的 OpenVPN Client 配置文件就是运行此命令。\n\n要执行此命令,您必须具有 VPN Server 管理员权限。\n该命令在 VPN Bridge 上不能运行。\n以集群成员运行的 VPN Server 的虚拟 HUB 不能执行此命令。 +CMD_OpenVpnMakeConfig_Args OpenVpnMakeConfig [ZIP_FileName] +CMD_OpenVpnMakeConfig_[ZIP_FileName] 指定以 ZIP 压缩格式保存的输出文件。如果没指定文件后缀,那么".zip" 后缀就会被添加在文件名上。 +CMD_OpenVpnMakeConfig_Prompt_ZIP 设置文件夹的输出文件名。(ZIP 压缩文件): +CMD_OpenVpnMakeConfig_OK 样本设置文件被保存为 "%s"。您可以解压此文件以获取设置文件。\n +CMD_OpenVpnMakeConfig_ERROR 本样本设置文件不能保存为 "%s"。该文件名无效。\n + + +# ServerCertRegenerate 命令 +CMD_ServerCertRegenerate 生成一个新的带有指定 CN (Common Name) 的自签名证书,并且在 VPN Server 上注册。 +CMD_ServerCertRegenerate_Help 您可以使用此命令,将当前 VPN Server 上的证书替换成一个新的、有 CN (Common Name) 值字段的、自签字证书。n\n此命令在您想使用 Microsoft SSTP VPN 克隆服务器功能时很方便。因为在 VPN Server 上 SSL 证书的 CN 值必须要与 SSTP VPN Client 指定的主机名吻合。\n\n本命令会删除 VPN Server 上现有的 SSL 证书。这要求事先使用 ServerKeyGet 命令备份当前的 SSL 证书和密钥。\n\n要执行此命令,您必须具有 VPN Server 管理员权限。\n该命令在 VPN Bridge 上不能运行。\n以集群成员运行的 VPN Server 的虚拟 HUB 不能执行此命令。 +CMD_ServerCertRegenerate_Args ServerCertRegenerate [CN] +CMD_ServerCertRegenerate_[CN] 指定一个新证书要使用的 Common Name(CN) +CMD_ServerCertRegenerate_Prompt_CN Common Name(CN)值: + + +# VpnOverIcmpDnsEnable 命令 +CMD_VpnOverIcmpDnsEnable 启用/禁用 VPN over ICMP / VPN over DNS服务器功能 +CMD_VpnOverIcmpDnsEnable_Help 即使有防火墙或者有屏蔽TCP/IP通信的路由器,您也可以只用 ICMP 或者 DNS 数据包建立一个 VPN 。您需要事先启用如下功能。\n\n注意:本功能仅在紧急情况下使用。它在有防火墙或者路由器被错误配置屏蔽 TCP/IP 时,并且 ICMP 和 DNS 都没有被屏蔽的情况下可使用。它不是为长期稳定使用的。\n\n要执行此命令,您必须具有 VPN Server 管理员权限。\n该命令在 VPN Bridge 上不能运行。 +CMD_VpnOverIcmpDnsEnable_Args VpnOverIcmpDnsEnable [/ICMP:yes|no] [/DNS:yes|no] +CMD_VpnOverIcmpDnsEnable_ICMP 指定 "yes",启用 VPN over ICMP 服务器。指定 "no",禁用。 +CMD_VpnOverIcmpDnsEnable_DNS 指定 "yes",启用 VPN over DNS服务器。指定 "no",禁用。 +CMD_VpnOverIcmpDnsEnable_Prompt_ICMP 启用 VPN over ICMP服务器 (yes/no): +CMD_VpnOverIcmpDnsEnable_Prompt_DNS 启用 VPN over DNS服务器 (yes/no): + +# VpnOverIcmpDnsGet 命令 +CMD_VpnOverIcmpDnsGet 获取 VPN over ICMP / VPN over DNS 功能的当前设置 +CMD_VpnOverIcmpDnsGet_Help 获得并显示 VPN over ICMP / VPN over DNS 功能的当前状态。\n\n要执行此命令,您必须具有 VPN Server 管理员权限。\n该命令在 VPN Bridge 上不能运行。 +CMD_VpnOverIcmpDnsGet_Args VpnOverIcmpDnsGet +CMD_VpnOverIcmpDnsGet_PRINT_ICMP VPN over ICMP 服务器已开启 +CMD_VpnOverIcmpDnsGet_PRINT_DNS VPN over DNS 服务器已禁用 + + +# DynamicDnsGetStatus 命令 +CMD_DynamicDnsGetStatus 显示动态 DNS 功能的当前状态 +CMD_DynamicDnsGetStatus_Help 获得并显示动态 DNS 功能的当前状态。\n\n动态 DNS 会为本 VPN Server 分配一个唯一的和永久的 DNS 主机名。您可以在设置 VPN Client 和 VPN Bridge 时使用该主机名指定的 VPN Server。您不必注册并且保存域名。\n同时,如果您的 ISP 分派给您一个动态(不稳定) IP 地址,您的动态 DNS 主机名相应的 IP 地址也将会自动改变。它使您只用动态 IP 地址就可以保持 VPN Server 的运行。\r\n因此,您再也不需要为了维持静态全球 IP 地址,每月花费费用了。\n[注意]\n要禁止动态 DNS 功能,修改 VPN Server 和配置文件。\r\n\r\n"declare root" 指令有"declare DDnsClient"指令。在本指令中,那你可以从错误到正确切换"bool disable",并重启 VPN Server ,这样,动态 DNS 功能就禁用了。\n\n要执行此命令,您必须具有 VPN Server 管理员权限。\n该命令在 VPN Bridge 上不能运行。 +CMD_DynamicDnsGetStatus_Args DynamicDnsGetStatus +CMD_DynamicDnsGetStatus_PRINT_FQDN 分配的动态 DNS 主机名 (FQDN) +CMD_DynamicDnsGetStatus_PRINT_HOSTNAME 分配的动态 DNS 主机名 (主机名) +CMD_DynamicDnsGetStatus_PRINT_SUFFIX DNS 后缀 +CMD_DynamicDnsGetStatus_PRINT_IPv4 全球 IPv4 地址 +CMD_DynamicDnsGetStatus_PRINT_IPv6 全球 IPv6 地址 + + +# DynamicDnsSetHostname 命令 +CMD_DynamicDnsSetHostname 设置动态 DNS 主机名 +CMD_DynamicDnsSetHostname_Help 您可以用本命令更改动态 DNS 功能分配的主机名。当前分配的主机名可以通过使用 DynamicDnsGetStatus 命令来显示。\n\n动态 DNS 为 VPN Server 分配了一个唯一的和永久的 DNS 主机名。您可以在设置 VPN Client 和 VPN Bridge 时使用该主机名指定的 VPN Server。您不必注册并且保存域名。\n同时,如果您的 ISP 分派给您一个动态(不稳定) IP 地址,您的动态 DNS 主机名相应的 IP 地址也将会自动改变。它使您只用动态 IP 地址就可以保持 VPN Server 的运行。\r\n因此,您再也不需要为了维持静态全球 IP 地址,每月花费费用了。\n[注意]\n要禁止动态 DNS 功能,修改 VPN Server 和配置文件。\r\n\r\n"declare root" 指令有"declare DDnsClient"指令。在本指令中,那你可以从错误到正确切换"bool disable",并重启 VPN Server,这样,动态 DNS 功能就禁用了。\n\n要执行此命令,您必须具有 VPN Server 管理员权限。\n该命令在 VPN Bridge 上不能运行。 +CMD_DynamicDnsSetHostname_Args DynamicDnsSetHostname [hostname] +CMD_DynamicDnsSetHostname_[hostname] 指定新的主机名,主机名长度最短3个字母,最长为 31 个字母。仅限数字和字母。 +CMD_DynamicDnsSetHostname_Prompt_hostname Dynamic 动态 DNS 主机名 (3 – 31 个字母): + + +# VpnAzureGetStatus command +CMD_VpnAzureGetStatus 显示 VPN Azure 功能的当前状态 +CMD_VpnAzureGetStatus_Help 获取和显示 VPN Azure 功能的当前状态。\n\nVPN Azure 可以更容易地从你家里的计算机到你办公室的计算机建立一个VPN会话。当一个 VPN 连接建立了,您可以访问您公司专用网络上的任何其他服务器。在办公室的计算机(VPN 服务器)上,你并不需要一个全球 IP 地址。它可以在防火墙或 NAT 后面工作。无需网络管理员的配置。您可以在您的家用电脑使用 Windows 内置的 SSTP VPN 客户端。\nVPN Azure 是一个云 VPN 服务由 SoftEther 公司经营。VPN Azure 是免费的,可提供给任何人。访问 http://www.vpnazure.net/ 查看详细信息和如何使用的说明。\n\nVPN Azure 主机名与动态 DNS 设置的主机名相同,但改变的域名后缀为“vpnazure.net”。要改变主机名使用 DynamicDnsSetHostname 命令。\n\n要执行此命令,你必须具有VPN 服务器管理员权限。\n此命令不能在 VPN 网桥上运行。\n以集群成员运行的 VPN 服务器的虚拟 HUB 不能执行此命令。 +CMD_VpnAzureGetStatus_Args VpnAzureGetStatus +CMD_VpnAzureGetStatus_PRINT_ENABLED VPN Azure 功能已启用 +CMD_VpnAzureGetStatus_PRINT_CONNECTED 至 VPN Azure 云服务器的连接建立 +CMD_VpnAzureGetStatus_PRINT_HOSTNAME 在 VPN Azure 服务上的本 VPN 服务器的主机名 + + +# VpnAzureSetStatus command +CMD_VpnAzureSetEnable 启用/禁用 VPN Azure 功能 +CMD_VpnAzureSetEnable_Help 启用或禁用 VPN Azure 功能。\n\nVPN Azure 可以更容易地从你家里的计算机到你办公室的计算机建立一个 VPN 会话。当一个 VPN 连接建立了,您可以访问您公司专用网络上的任何其他服务器。\n在办公室的计算机(VPN 服务器)上,你并不需要一个全球 IP 地址。它可以在防火墙或 NAT 后面工作。无需网络管理员的配置。您可以在您的家用电脑使用 Windows 内置的 SSTP VPN 客户端。\nVPN Azure 是一个云 VPN 服务由 SoftEther 公司经营。VPN Azure 是免费的,可提供给任何人。访问 http://www.vpnazure.net/ 查看详细信息和如何使用的说明。\n\nVPN Azure 主机名与动态 DNS 设置的主机名相同,但改变的域名后缀为“vpnazure.net”。要改变主机名使用 DynamicDnsSetHostname 命令。\n\n要执行此命令,你必须具有 VPN 服务器管理员权限。\n此命令不能在 VPN 网桥上运行。\n以集群成员运行的 VPN 服务器的虚拟 HUB 不能执行此命令。 +CMD_VpnAzureSetEnable_Args VpnAzureSetEnable [yes|no] +CMD_VpnAzureSetEnable_[yes|no] 指定“yes”,启用 VPN Azure。“no”禁用它。 +CMD_VpnAzureSetEnable_PROMPT 启用 VPN Azure (yes/no): + + + +####################################################### +# # +#在这里往下是 VPN Client 用的管理命令 # +# # +####################################################### + + +# VersionGet 命令 +CMD_VersionGet 获取 VPN 客户服务的版本信息 +CMD_VersionGet_Help 获取目前管理的 VPN 客户服务程序的版本信息。 +CMD_VersionGet_Args VersionGet +CMD_VersionGet_1 产品名 +CMD_VersionGet_2 版本信息 +CMD_VersionGet_3 建设信息 +CMD_VersionGet_4 进程 ID +CMD_VersionGet_5 操作系统类型 + + +# PasswordSet 命令 +CMD_PasswordSet 为连接到 VPN 客户服务的密码的设定 +CMD_PasswordSet_Help 对 VPN Client 服务,从命令行管理工具及 VPN Client 经理来进行连接控制时,可以要求输入密码。使用此指令,可以设置要求输入的密码。\n以只对从远程 (本地主机以外的电脑) 进行操作时要求其输入密码。 +CMD_PasswordSet_Args PasswordSet [password] [/REMOTEONLY:yes|no] +CMD_PasswordSet_[password] 指定要设置的密码。如指定为 "none",可以删除密码的设置。 +CMD_PasswordSet_REMOTEONLY 如果指定 "yes",只对从远程 (本地主机以外的电脑) 进行操作时要求其输入密码,从本地主机连接时,不要求密码。如果省略此参数,则视为 "no"。 + + +# PasswordGet 命令 +CMD_PasswordGet 获取为连接到 VPN 客户服务的密码的设定 +CMD_PasswordGet_Help 对 VPN Client 服务,从命令行管理工具及 VPN Client 经理来进行连接控制时,获取是否要求输入密码的设置。\n而且,对于要求密码的情况下,获取是否设置只对从远程 (本地主机以外的电脑) 进行操作的情况要求输入密码。 +CMD_PasswordGet_Args PasswordGet +CMD_PasswordGet_1 设置密码 +CMD_PasswordGet_2 只需要远程连接时使用密码 + + +# CertList 命令 +CMD_CertList 获取信任的证明机构的证书列表 +CMD_CertList_Help VPN Client 管理信用的证明机构的证书列表。已注册的证明机构证书的注册列表,用来进行连接 VPN Server 时的验证服务器证书。 +CMD_CertList_Args CertList + + +# CertAdd 命令 +CMD_CertAdd 添加信任的证明机构的证书 +CMD_CertAdd_Help 向 VPN Client 信任的证明机构的证书列表添加新证书。已注册的证明机构证书的注册列表,用来进行连接 VPN Server 时的验证服务器证书。\n要获取当前的证书列表,使用 CertList 指令。\n要添加证书,该证书需要保存为 X.509 格式的文件。 +CMD_CertAdd_Args CertAdd [path] +CMD_CertAdd_[path] 指定要注册的 X.509 证书的文件名。 + + +# CertDelete 命令 +CMD_CertDelete 删除信任的证明机构的证书 +CMD_CertDelete_Help 从 VPN Client 信任的证明机构的证书列表中删除现有的证书。\n要获取当前的证书列表,使用 CertList 命令。 +CMD_CertDelete_Args CertDelete [id] +CMD_CertDelete_[id] 指定要删除的证书的 ID。 + + +# CertGet 命令 +CMD_CertGet 获得新任的证明机构的证书 +CMD_CertGet_Help 获取 VPN Client 信任的证明机构的证书列表中的现有证书,以 X.509 格式文件保存。 +CMD_CertGet_Args CertGet [id] [/SAVECERT:path] +CMD_CertGet_[id] 指定要获取的证书 ID。 +CMD_CertGet_SAVECERT 指定获取到的证书的保存文件名。 + + +# SecureList 命令 +CMD_SecureList 获取可用的智能卡种类列表 +CMD_SecureList_Help VPN Client 显示的被支持的智能卡类型的列表。\n智能卡类型的列表,目前的计算机上被安装驱动程序,且显示以 VPN 软件支持的设备列表。\n\n如果没有显示目前使用的智能卡型,或许可以通过更新 VPN 软件至新的版本来使用。 +CMD_SecureList_Args SecureList + + +# SecureSelect 命令 +CMD_SecureSelect 选择要使用的智能卡种类 +CMD_SecureSelect_Help 选择 VPN 客户使用的智能卡类型。\n可以使用的智能卡种类列表,可用 SecureList 指令获取。 +CMD_SecureSelect_Args SecureSelect [id] +CMD_SecureSelect_[id] 指定智能卡种类的 ID。 +CMD_SecureSelect_PROMPT_ID 使用的智能卡种类的 ID: + + +# SecureGet 命令 +CMD_SecureGet 获取使用的智能卡种类的 ID +CMD_SecureGet_Help 获取为当前 VPN 客户的使用而设置的智能卡种类的 ID。通过基于此 ID 上的 SecureList 指令的结果,可以获取当前选择的智能卡类型。\n如果当前的智能卡没有被选择,ID 显示是 0。 +CMD_SecureGet_Args SecureGet +CMD_SecureGet_Print 当前选择的智能卡 ID 是 %u。 +CMD_SecureGet_NoPrint 智能卡目前没有被选择。 + + +# NicCreate 命令 +CMD_NicCreate 新的虚拟 LAN 卡的创建 +CMD_NicCreate_Help 将新的虚拟 LAN 卡添加到系统。可以对虚拟 LAN 卡任意命名。\n然而,给虚拟 LAN 卡命名时只能使用英文字母数字,Windows 2000 以上的系统最大可设置 31 个字符,Windows 98,98 SE 和 ME 系统最大可设置 4 个字符。\n调用了 NicCreate 指令时,VPN Client 运行的操作系统,将被安装新的虚拟 LAN 卡设备驱动程序。\n在此情况下,操作系统可能会显示对话框,确认是否要安装设备驱动程序。 +CMD_NicCreate_Args NicCreate [name] +CMD_NicCreate_[name] 指定虚拟 LAN 卡名。 +CMD_NicCreate_PROMPT_NAME 虚拟 LAN 卡名: + + +# NicDelete 命令 +CMD_NicDelete 删除虚拟 LAN 卡 +CMD_NicDelete_Help 从系统中删除现有的虚拟 LAN 卡。\n当从系统中删除虚拟 LAN 卡,使用此虚拟 LAN 卡的连接将被中断。\n而且,位使用被删除的虚拟 LAN 卡而设置的连接设置,自动更改设置为使用别的虚拟 LAN 卡。\n当 VPN 客户运行 Windows 2000 以上的操纵系统时,此指令可以被使用。 +CMD_NicDelete_Args NicDelete [name] +CMD_NicDelete_[name] 指定的虚拟 LAN 卡名 + + +# NicUpgrade 命令 +CMD_NicUpgrade 升级虚拟 LAN 卡设备驱动 +CMD_NicUpgrade_Help 如果现有的虚拟 LAN 卡的设备驱动程序版本太旧,在当前正在运行的 VPN Client 升级到同包附带的最新的设备驱动程序。即使不进行升级,也要重新安装设备驱动程序。\n操作系统可能会显示对话框,确认是否要安装设备驱动程序。\n此指令,在 VPN Client 正运行 Windows 2000 以上的操作系统时能够使用。 +CMD_NicUpgrade_Args NicUpgrade [name] +CMD_NicUpgrade_[name] 指定的虚拟 LAN 卡名 + + +# NicGetSetting 命令 +CMD_NicGetSetting 获取虚拟 LAN 卡的设置 +CMD_NicGetSetting_Help 获取现有的虚拟 LAN 卡的 MAC 地址设置。\n当 VPN 客户运行 Windows 2000 以上的操纵系统时,此指令可以被使用。 +CMD_NicGetSetting_Args NicGetSetting [name] +CMD_NicGetSetting_[name] 指定虚拟 LAN 卡名 +CMD_NicGetSetting_1 设备名称 +CMD_NicGetSetting_2 状态 +CMD_NicGetSetting_3 MAC 地址 +CMD_NicGetSetting_4 版本 +CMD_NicGetSetting_5 驱动程序文件名 +CMD_NicGetSetting_6 GUID + + +# NicSetSetting 命令 +CMD_NicSetSetting 更改虚拟 LAN 卡设置 +CMD_NicSetSetting_Help 更改现有的虚拟 LAN 卡的 MAC 地址设置。一旦启动该指令,目前运行中的虚拟 LAN 卡设备驱动将被重新启动。\n当 VPN 客户运行 Windows 2000 以上的操纵系统时,此指令可以被使用。 +CMD_NicSetSetting_Args NicSetSetting [name] [/MAC:mac] +CMD_NicSetSetting_[name] 指定虚拟 LAN 卡名 +CMD_NicSetSetting_MAC 指定要设置的 MAC 地址。\nMAC 地址请用 6 字节十六进制字符串指定。\n例如: 00:AC:01:23:45:67 或 00-AC-01-23-45-67 +CMD_NicSetSetting_PROMPT_MAC 配置 MAC 地址: + + +# NicEnable 命令 +CMD_NicEnable 启用虚拟 LAN 卡 +CMD_NicEnable_Help 启动现有的被禁用的虚拟 LAN 卡。\n当 VPN 客户运行 Windows 2000 以上的操纵系统时,此指令可以被使用。 +CMD_NicEnable_Args NicEnable [name] +CMD_NicEnable_[name] 指定虚拟 LAN 卡的名称。 + + +# NicDisable 命令 +CMD_NicDisable 禁用虚拟 LAN 卡 +CMD_NicDisable_Help 禁用现有的正使用的虚拟 LAN 卡。\n当 VPN 客户运行 Windows 2000 以上的操纵系统时,此指令可以被使用。 +CMD_NicDisable_Args NicDisable [name] +CMD_NicDisable_[name] 指定虚拟 LAN 卡的名称。 + + +# NicList 命令 +CMD_NicList 获取虚拟 LAN 卡列表 +CMD_NicList_Help 获取在当前系统注册的虚拟 LAN 卡列表 +CMD_NicList_Args NicList + + +# AccountList 命令 +CMD_AccountList 获取连接设置列表 +CMD_AccountList_Help 获取登录到 VPN Client 的连接设置列表 +CMD_AccountList_Args AccountList + + +# AccountCreate 命令 +CMD_AccountCreate 创建新的连接设置 +CMD_AccountCreate_Help 在 VPN Client 创建新的连接设置。\n要创建连接设置,作为初始参数需要指定加在连接设置名称和连接终端的服务器,及连接终端的虚拟 HUB,用户名上使用的虚拟 LAN 卡名。创建了新的连接设置时,用户认证的类型被初始设置为 [匿名认证],代理服务器的设置和服务器证书的检查选项不被设置。若要更改这些设置和其他的详细设置,创建连接设置后,使用以 "Account" 名字开始的其他指令。 +CMD_AccountCreate_Args AccountCreate [name] [/SERVER:hostname:port] [/HUB:hubname] [/USERNAME:username] [/NICNAME:nicname] +CMD_AccountCreate_[name] 指定要创建的连接设置名 +CMD_AccountCreate_SERVER 以 [主机名:端口号] 的形式指定终端 VPN Server 的主机名,端口号。可以通过 IP 地址进行指定。 +CMD_AccountCreate_HUB 在终端 VPN Server 上指定虚拟 HUB。 +CMD_AccountCreate_USERNAME 指定在连接到终端 VPN Server 时用于用户认证的用户名。 +CMD_AccountCreate_NICNAME 指定用于连接的虚拟 LAN 卡名。 +CMD_AccountCreate_Prompt_Name 连接设置名: +CMD_AccountCreate_Prompt_Server 终端 VPN Server 主机名和端口号: +CMD_AccountCreate_Prompt_Hub 终端虚拟 HUB 名称: +CMD_AccountCreate_Prompt_Username 连接用户名: +CMD_AccountCreate_Prompt_Nicname 使用虚拟 LAN 卡名称: + + +# AccountSet 命令 +CMD_AccountSet 设定连接设置连接终端 +CMD_AccountSet_Help 设置注册在 VPN 客户的连接设置的终端 VPN Server 主机名和端口号,虚拟 HUB 名,及用于连接的用户名,加在其上使用的虚拟 LAN 卡名。 +CMD_AccountSet_Args AccountSet [name] [/SERVER:hostname:port] [/HUB:hubname] +CMD_AccountSet_[name] 指定要更改设置的连接设置名。 +CMD_AccountSet_SERVER 以 [主机名:端口号] 的形式指定终端 VPN Server 的主机名,端口号。可以通过 IP 地址进行指定。 +CMD_AccountSet_HUB 指定终端的 VPN Server 上的虚拟 HUB。 + + +# AccountGet 命令 +CMD_AccountGet 取得连接设置的设置 +CMD_AccountGet_Help 获取注册到 VPN Client 的连接设置的连接设置内容。\n而且,要改变连接设置的连接设置内容,在创建连接设置后使用其他的以 "Account" 名开始的的指令。 +CMD_AccountGet_Args AccountGet [name] +CMD_AccountGet_[name] 指定要获取的连接设置名。 + + +# AccountDelete 命令 +CMD_AccountDelete 删除连接设置 +CMD_AccountDelete_Help 删除注册到 VPN Client 的连接设置。如果指定的连接设置处于在线状态,将会自动断开连接并删除。 +CMD_AccountDelete_Args AccountDelete [name] +CMD_AccountDelete_[name] 指定要删除的连接设置名。 + + +# AccountUsernameSet 命令 +CMD_AccountUsernameSet 设置用于连接的连接设置的用户名 +CMD_AccountUsernameSet_Help 指定注册到 VPN Client 的连接设置,且其连接设置连接到 VPN Server 上时,指定需要进行用户认证的用户名。\n而且,在一些情况下有必要指定用户认证的种类和需要的参数。要更改这些信息,可以使用如下指令: AccountAnonymousSet, AccountPasswordSet, AccountCertSet 和 AccountSecureCertSet。 +CMD_AccountUsernameSet_Args AccountUsernameSet [name] [/USERNAME:username] +CMD_AccountUsernameSet_[name] 指定更改设置的连接设置名。 +CMD_AccountUsernameSet_USERNAME 指定连接设置连接到 VPN Server 上时需要进行用户认证的用户名。 +CMD_AccountUsername_Notice 这种连接设置的认证方法,目前被设置为密码认证。更改用户名后,必须使用 AccountPasswordSet 指令重新设定。 + + +# AccountAnonymousSet 命令 +CMD_AccountAnonymousSet 设定连接设置的用户认证种类为匿名认证 +CMD_AccountAnonymousSet_Help 指定注册到 VPN Client 的连接设置,把其连接设置连接到 VPN Server 上时的用户认证方法,设置为 [匿名认证]。 +CMD_AccountAnonymousSet_Args AccountAnonymousSet [name] +CMD_AccountAnonymousSet_[name] 指定更改设置的连接设置名。 + + +# AccountPasswordSet 命令 +CMD_AccountPasswordSet 设定连接设置的用户证类型为密码认证 +CMD_AccountPasswordSet_Help 指定注册到 VPN Client 的连接设置,把其连接设置连接到 VPN Server 上时的用户认证方法,设置为 [密码认证]。指定 [标准密码认证] 和 [RADIUS 或 NT 域认证] 作为密码认证种类。 +CMD_AccountPasswordSet_Args AccountPasswordSet [name] [/PASSWORD:password] [/TYPE:standard|radius] +CMD_AccountPasswordSet_[name] 指定更改设置的连接设置名。 +CMD_AccountPasswordSet_PASSWORD 指定密码认证使用的密码。如果不指定,将显示输入密码的提示。 +CMD_AccountPasswordSet_TYPE 作为密码认证类型,指定 "standard" (标准密码认证) 或 "radius" (RADIUS 或 NT 域认证) 的二者之一。 +CMD_AccountPasswordSet_Prompt_Type 指定 standard 或 radius: +CMD_AccountPasswordSet_Type_Invalid standard 或 radius 的指定是不正确的。 + + +# AccountCertSet 命令 +CMD_AccountCertSet 设置连接设置的用户认证类型为用户证书认证 +CMD_AccountCertSet_Help 指定注册到 VPN Client 的连接设置,把其连接设置连接到 VPN Server 上时的用户认证方法,设置为 [用户证书认证]。作为该证书,必须指定证书文件为 X.509 格式且私钥文件是 Base 64 编码。 +CMD_AccountCertSet_Args AccountCertSet [name] [/LOADCERT:cert] [/LOADKEY:key] +CMD_AccountCertSet_[name] 指定要更改设置的连接设置名 +CMD_AccountCertSet_LOADCERT 指定以证书认证提交的 X.509 格式证书的文件名。 +CMD_AccountCertSet_LOADKEY 指定以对应证书的 Base 64 格式的编码私钥文件名。 + + +# AccountCertGet 命令 +CMD_AccountCertGet 获取用于连接设置的客户端证书 +CMD_AccountCertGet_Help 当指定注册到 VPN Client 的连接设置,其连接设置使用使用客户证书认证时,获取作为客户证书提出的证书,并保存该证书文件为 X.509 格式。 +CMD_AccountCertGet_Args AccountCertGet [name] [/SAVECERT:cert] +CMD_AccountCertGet_[name] 指定要获取设置的连接设置名。 +CMD_AccountCertGet_SAVECERT 指定以 X.509 格式保存获取的证书的文件名。 + + +# AccountEncryptEnable 命令 +CMD_AccountEncryptEnable 启用连接设置进行通信的加密 +CMD_AccountEncryptEnable_Help 当指定注册到 VPN Client 的连接设置,且其连接设置与 VPN Server 间进行 VPN 连接通信时,将与 VPN Server 间的通信内容以 SSL 设置为加密。\n通常,将与 VPN Server 间的通信以 SSL 加密,是防止信息的窃听和篡改。也可以禁用加密。当禁用加密时,通信量将扩大但是通信数据将以纯文本格式在网络上传输。 +CMD_AccountEncryptEnable_Args AccountEncryptEnable [name] +CMD_AccountEncryptEnable_[name] 指定要更改设置的连接设置名。 + + +# AccountEncryptDisable 命令 +CMD_AccountEncryptDisable 禁用连接设置进行通信时的加密 +CMD_AccountEncryptDisable_Help 当指定注册到 VPN Client 的连接设置,且其连接设置与 VPN Server 间进行 VPN 连接通信时,将与 VPN Server 间的通信内容以 SSL 设置为不加密。\n通常,将与 VPN Server 间的通信以 SSL 加密,是防止信息的窃听和篡改。也可以禁用加密。当禁用加密时,通信量将扩大但是通信数据将以纯文本格式在网络上传输。 +CMD_AccountEncryptDisable_Args AccountEncryptDisable [name] +CMD_AccountEncryptDisable_[name] 指定要更改设置的连接设置名。 + + +# AccountCompressEnable 命令 +CMD_AccountCompressEnable 启用连接设置进行通信时的数据压缩 +CMD_AccountCompressEnable_Help 当指定注册到 VPN Client 的连接设置,且其连接设置与 VPN Server 间进行 VPN 连接通信时,将与 VPN Server 间的通信内容设置为压缩。\n最大可以进行约 80% 的压缩。但是,压缩会使客户端及服务器双方的 CPU 产生较高的负荷。当线路速度为约 10 Mbps 以上时,压缩可能会降低吞吐量,产生反面效果。 +CMD_AccountCompressEnable_Args AccountCompressEnable [name] +CMD_AccountCompressEnable_[name] 指定要更改设置的连接设置名。 + + +# AccountCompressDisable 命令 +CMD_AccountCompressDisable 禁用连接设置进行通信时的数据压缩 +CMD_AccountCompressDisable_Help 当指定注册到 VPN Client 的连接设置,且其连接设置与 VPN Server 间进行 VPN 连接通信时,将与 VPN Server 间的通信内容设置为不压缩。 +CMD_AccountCompressDisable_Args AccountCompressDisable [name] +CMD_AccountCompressDisable_[name] 指定要更改设置的连接设置名。 + + +# AccountHttpHeader* commands +CMD_AccountHttpHeader_Prompt_Name Value name (part before the colon): +CMD_AccountHttpHeader_Prompt_Data Value data (part after the colon): + + +# AccountHttpHeaderAdd command +CMD_AccountHttpHeaderAdd Add a custom value in the HTTP header sent to the proxy server +CMD_AccountHttpHeaderAdd_Help Use this to add a custom value in the HTTP header sent to the proxy server. A custom HTTP header can be used to bypass certain restrictions imposed on the network or to avoid speed limitations applied by the QoS. +CMD_AccountHttpHeaderAdd_Args AccountHttpHeaderAdd [name] [/NAME:name] [/DATA:data] +CMD_AccountHttpHeaderAdd_[name] Specify the name of the VPN Connection Setting whose setting you want to change. +CMD_AccountHttpHeaderAdd_NAME Specify the name of the custom value (the part before the colon character). +CMD_AccountHttpHeaderAdd_DATA Specify the data of the custom value (the part after the colon character). + + +# AccountHttpHeaderDelete command +CMD_AccountHttpHeaderDelete Delete a custom value in the HTTP header sent to the proxy server +CMD_AccountHttpHeaderDelete_Help Use this to delete a custom value in the HTTP header sent to the proxy server. A custom HTTP header can be used to bypass certain restrictions imposed on the network or to avoid speed limitations applied by the QoS. +CMD_AccountHttpHeaderDelete_Args AccountHttpHeaderDelete [name] [/NAME:name] +CMD_AccountHttpHeaderDelete_[name] Specify the name of the VPN Connection Setting whose setting you want to change. +CMD_AccountHttpHeaderDelete_NAME Specify the name of the custom value (the part before the colon character). + + +# AccountHttpHeaderGet command +CMD_AccountHttpHeaderGet Get the list of custom values in the HTTP header sent to the proxy server +CMD_AccountHttpHeaderGet_Help Use this to get the list of custom values in the HTTP header sent to the proxy server. A custom HTTP header can be used to bypass certain restrictions imposed on the network or to avoid speed limitations applied by the QoS. +CMD_AccountHttpHeaderGet_Args AccountHttpHeaderGet [name] +CMD_AccountHttpHeaderGet_[name] Specify the name of the VPN Connection Setting whose setting you want to get. + + +# AccountProxyNone 命令 +CMD_AccountProxyNone 将连接设置的连接方法直接设置为 TCP/IP 连接 +CMD_AccountProxyNone_Help 当指定注册到 VPN Client 的连接设置,将其连接设置与 VPN Server 间进行 VPN 连接时使用的连接方法设置为 [直接 TCP/IP连接],不通过代理服务器。 +CMD_AccountProxyNone_Args AccountProxyNone [name] +CMD_AccountProxyNone_[name] 指定要更改设置的连接设置名。 + + +# AccountProxyHttp 命令 +CMD_AccountProxyHttp 将连接设置的连接方法设置为通过 HTTP 代理服务器连接 +CMD_AccountProxyHttp_Help 当指定注册到 VPN Client 的连接设置,将其连接设置与 VPN Server 间进行 VPN 连接时使用的连接方法设置为 [通过 HTTP 代理服务器连接],指定将通过的 HTTP 代理服务器的主机名和端口号,用户名和密码 (如果需要)。\n通过 HTTP 代理服务器,必须对应因进行 HTTPS 通信的 CONNECT 方法。 +CMD_AccountProxyHttp_Args AccountProxyHttp [name] [/SERVER:hostname:port] [/USERNAME:username] [/PASSWORD:password] +CMD_AccountProxyHttp_[name] 指定要更改设置的连接设置名。 +CMD_AccountProxyHttp_SERVER 以 [主机名:端口号] 的形式,指定通过 HTTP 代理服务器的主机名或 IP 地址和端口号。 +CMD_AccountProxyHttp_USERNAME 如果因为连接通过 HTTP 代理服务器而需要用户认证时,指定用户名。与此同时也指定 /PASSWORD 参数。/USERNAME 和 /PASSWORD 参数没有被指定时,不设置用户身份验证数据。 +CMD_AccountProxyHttp_PASSWORD 如果因为连接通过 HTTP 代理服务器而需要用户认证时,指定密码。与 /USERNAME 参数一起指定。 +CMD_AccountProxyHttp_Prompt_Server 代理服务器主机名和端口号: + + +# AccountProxySocks 命令 +CMD_AccountProxySocks 将连接设置的连接方法设置为通过 SOCKS4 代理服务器连接 +CMD_AccountProxySocks_Help 当指定注册到 VPN Client 的连接设置,将其连接设置与 VPN Server 间进行 VPN 连接时使用的连接方法设置为 [通过 SOCKS4 服务器连接],并指定要通过的 SOCKS4 代理服务器的主机名和端口号,用户名和密码 (如果需要)。 +CMD_AccountProxySocks_Args AccountProxySocks [name] [/SERVER:hostname:port] [/USERNAME:username] [/PASSWORD:password] +CMD_AccountProxySocks_[name] 指定要更改设置的连接设置名。 +CMD_AccountProxySocks_SERVER 以 [主机名:端口号] 形式,指定要通过的 SOCKS4 代理服务器主机名或 IP 地址和端口号。 +CMD_AccountProxySocks_USERNAME 如果因为连接通过 SOCKS4 代理服务器而需要用户认证时,指定用户名。与此同时也指定 /PASSWORD 参数。/USERNAME 和 /PASSWORD 参数没有被指定时,不设置用户身份验证数据。 +CMD_AccountProxySocks_PASSWORD 如果因为连接通过 SOCKS4 代理服务器而需要用户认证时,指定密码。与 /USERNAME 参数一起指定。 + + +# AccountProxySocks5 命令 +CMD_AccountProxySocks5 将连接设置的连接方法设置为通过 SOCKS5 代理服务器连接 +CMD_AccountProxySocks5_Help 当指定注册到 VPN Client 的连接设置,将其连接设置与 VPN Server 间进行 VPN 连接时使用的连接方法设置为 [通过 SOCKS5 服务器连接],并指定要通过的 SOCKS5 代理服务器的主机名和端口号,用户名和密码 (如果需要)。 +CMD_AccountProxySocks5_Args AccountProxySocks5 [name] [/SERVER:hostname:port] [/USERNAME:username] [/PASSWORD:password] +CMD_AccountProxySocks5_[name] 指定要更改设置的连接设置名。 +CMD_AccountProxySocks5_SERVER 以 [主机名:端口号] 形式,指定要通过的 SOCKS5 代理服务器主机名或 IP 地址和端口号。 +CMD_AccountProxySocks5_USERNAME 如果因为连接通过 SOCKS5 代理服务器而需要用户认证时,指定用户名。与此同时也指定 /PASSWORD 参数。/USERNAME 和 /PASSWORD 参数没有被指定时,不设置用户身份验证数据。 +CMD_AccountProxySocks5_PASSWORD 如果因为连接通过 SOCKS5 代理服务器而需要用户认证时,指定密码。与 /USERNAME 参数一起指定。 + + +# AccountServerCertEnable 命令 +CMD_AccountServerCertEnable 启用连接设置服务器证书验证选项 +CMD_AccountServerCertEnable_Help 指定注册到 VPN Client 的连接设置,其连接设置连接到 VPN Server 时,启动检查连接终端的 VPN Server 提交的 SSL 证书是否可信的选项。\n如果启用此选项,可以预先将连接目标服务器的 SSL 证书以 AccountServerCertSet 指令保存在连接设置的设置内,或建议将服务器的 SSL 证书签名了的根证书,以 CertAdd 指令注册到虚拟 HUB 信任的证明机构的证书列表中。如果没有注册,初次连接时可能会显示确认信息。\n验证连接设置的服务器证书的选项处于启动状态,连接了的 VPN Server 的证书不可信时,立即解除连接,反复重试。 +CMD_AccountServerCertEnable_Args AccountServerCertEnable [name] +CMD_AccountServerCertEnable_[name] 指定要更改设置的连接设置名。 + + +# AccountServerCertDisable 命令 +CMD_AccountServerCertDisable 禁用连接设置服务器证书验证选项 +CMD_AccountServerCertDisable_Help 指定注册到 VPN Client 的连接设置,其连接设置与 VPN Server 连接时,禁止检验由目标 VPN Server 提供的 SSL 证明书是否可信的选项。 +CMD_AccountServerCertDisable_Args AccountServerCertDisable [name] +CMD_AccountServerCertDisable_[name] 指定要更改设置的连接设置名。 + + +# AccountRetryOnServerCertEnable command +CMD_AccountRetryOnServerCertEnable Enable VPN connection retry if server certificate is untrusted +CMD_AccountRetryOnServerCertEnable_Help When a VPN Connection Setting registered on the VPN Client is specified and that VPN Connection Setting connects to a VPN Server, use this to enable the option to retry connection if Server certificate cannot be trusted. +CMD_AccountRetryOnServerCertEnable_Args AccountRetryOnServerCertEnable [name] +CMD_AccountRetryOnServerCertEnable_[name] Specify the name of the VPN Connection Setting whose setting you want to change. + + +# AccountRetryOnServerCertDisable command +CMD_AccountRetryOnServerCertDisable Disable VPN connection retry if server certificate is invalid +CMD_AccountRetryOnServerCertDisable_Help When a VPN Connection Setting registered on the VPN Client is specified and that VPN Connection Setting connects to a VPN Server, use this to disable the option to retry connection if Server certificate cannot be trusted. +CMD_AccountRetryOnServerCertDisable_Args AccountRetryOnServerCertDisable [name] +CMD_AccountRetryOnServerCertDisable_[name] Specify the name of the VPN Connection Setting whose setting you want to change. + + +# AccountServerCertSet 命令 +CMD_AccountServerCertSet 设置连接设置的服务器固有证明书 +CMD_AccountServerCertSet_Help 指定注册到 VPN Client 的连接设置,其连接设置连接到 VPN Server 时,预先注册与连接目标的 VPN Server 提交的 SSL 证书相同的证书。\n如果启动了连接设置的服务器证书验证选项,可以预先将连接目标服务器的 SSL 证书以此指令保存在连接设置的设置内,或需要将服务器的 SSL 证书签名了的根证书,以 CAAdd 指令注册到虚拟 HUB 信任的证明机构的证书列表中。\n验证连接设置的服务器证书的选项处于启动状态,连接了的 VPN Server 的证书不可信时,立即解除连接,反复重试。 +CMD_AccountServerCertSet_Args AccountServerCertSet [name] [/LOADCERT:cert] +CMD_AccountServerCertSet_[name] 指定要更改设置的连接设置名。 +CMD_AccountServerCertSet_LOADCERT 指定以 X.509 证书格式保存的设置服务器固有证书的证书文件名。 + + +# AccountServerCertDelete 命令 +CMD_AccountServerCertDelete 删除连接设置的服务器固有证书 +CMD_AccountServerCertDelete_Help 指定注册到到 VPN Client 的连接设置,且其连接设置注册了服务器固有证书时,删除证书。 +CMD_AccountServerCertDelete_Args AccountServerCertDelete [name] +CMD_AccountServerCertDelete_[name] 指定要更改设置的连接设置名。 + + +# AccountServerCertGet 命令 +CMD_AccountServerCertGet 获取连接设置的服务器固有证明书 +CMD_AccountServerCertGet_Help 指定注册到到 VPN Client 的连接设置,且其连接设置注册了服务器固有证书时,获取该证书并以 X.509 格式保存证明书文件。 +CMD_AccountServerCertGet_Args AccountServerCertGet [name] [/SAVECERT:path] +CMD_AccountServerCertGet_[name] 指定要更改设置的连接设置名。 +CMD_AccountServerCertGet_SAVECERT 指定以 X.509 证书格式保存的服务器固有证书的证书文件名。 + + +# AccountDetailSet 命令 +CMD_AccountDetailSet 设置接续设置的高级通信设置 +CMD_AccountDetailSet_Help 指定注册到 VPN Client 的连接设置,并定制其连接设置与 VPN Server 通信时使用的 VPN 协议的通信设置。 +CMD_AccountDetailSet_Args AccountDetailSet [name] [/MAXTCP:max_connection] [/INTERVAL:additional_interval] [/TTL:disconnect_span] [/HALF:yes|no] [/BRIDGE:yes|no] [/MONITOR:yes|no] [/NOTRACK:yes|no] [/NOQOS:yes|no] +CMD_AccountDetailSet_[name] 指定要更改设置的连接设置名。 +CMD_AccountDetailSet_MAXTCP VPN 通信使用的 TCP 连接数,指定从 1 到 32 的整数。在与 VPN Server 之间的 VPN 通信会话上的数据传送,通过使用多个 TCP 连接,可以提高通信速度。\n注意: 如果连接服务器的线路是高速线路时,建议 8 个左右,如果是拨号等低速线路时,建议 1 个。 +CMD_AccountDetailSet_INTERVAL 建立多个 TCP 连接进行 VPN 通信时,以秒为单位指定每个 TCP 连接的建立间隔。规定值为 1 秒。 +CMD_AccountDetailSet_TTL 如果设置的每个 TCP 连接的寿命时,从 TCP 连接的建立到断开的寿命以秒数来指定。如果指定 "0",则寿命未被设置。 +CMD_AccountDetailSet_HALF 要启动半双工模式,指定 "yes"。将两个以上的 TCP 连接捆绑,进行 VPN 通信时,可以使用 "半双工模式"。启动半双工模式,能够自动将各 TCP 连接的数据传输方向固定各一半。例如,使用 8 个 TCP 连接建立了 VPN 会话时,启动半双工模式,则固定 4 个 TCP 连接为上传方向专用,剩下 4 个 TCP 连接为下载方向专用,进行通信。 +CMD_AccountDetailSet_BRIDGE 与 VPN Server 以 "桥 / 路由器模式" 连接时,指定 "yes"。使用桥/路由器模式连接时,VPN Client 的虚拟 LAN 卡方将能够与其他网络进行桥或路由。然而,如果用于连接的用户的安全策略禁用桥或路由时,则连接失败。 +CMD_AccountDetailSet_MONITOR 与 VPN Server 以 "监控模式" 连接时,指定 "yes"。如果使用监测模式连接时,可以接收虚拟 HUB 内传送的所有的数据包。然而,用于连接的用户安全策略不允许监视模式时,则连接失败。 +CMD_AccountDetailSet_NOTRACK 指定 "yes",禁用路由器表项调节器。通常情况下,指定 "no"。 +CMD_AccountDetailSet_NOQOS 禁用 VoIP / QoS 功能时指定 "yes"。通常指定 "no"。 +CMD_AccountDetailSet_Eval_MaxTcp TCP 连接数请在 1 - 32 号之间指定。 +CMD_AccountDetailSet_Eval_Interval TCP 连接的建立间隔请指定 1 秒以上。 +CMD_AccountDetailSet_Prompt_MaxTcp 用于 VPN 通信的 TCP 连接数: +CMD_AccountDetailSet_Prompt_Interval 各 TCP 连接的建立间隔: +CMD_AccountDetailSet_Prompt_TTL 各 TCP 连接的寿命 (不带: 0): +CMD_AccountDetailSet_Prompt_HALF 启用半双工模式 (yes/no): +CMD_AccountDetailSet_Prompt_BRIDGE 启用桥/路由器模式 (yes/no): +CMD_AccountDetailSet_Prompt_MONITOR 启用监控模式 (yes/no): +CMD_AccountDetailSet_Prompt_NOTRACK 禁用路由表项调节器 (yes/no): +CMD_AccountDetailSet_Prompt_NOQOS 禁用 QoS 控制功能 (yes/no): +CMD_AccountDetailSet_DISABLEUDP Specify "yes" when disabling UDP acceleration function. Normally "no" is specified. +CMD_AccountDetailSet_Prompt_DISABLEUDP Disable UDP Acceleration Function (yes/no): + + +# AccountRename 命令 +CMD_AccountRename 更改连接设置名称 +CMD_AccountRename_Help 指定在 VPN Client 注册的连接设置,更改其连接设置名称。 +CMD_AccountRename_Args AccountRename [name] [/NEW:new_name] +CMD_AccountRename_[name] 指定要更改名称的连接设置的当前名称。 +CMD_AccountRename_NEW 指定变更后的新名称。 +CMD_AccountRename_PROMPT_OLD 目前的名称: +CMD_AccountRename_PROMPT_NEW 新名称: + + +# AccountConnect 命令 +CMD_AccountConnect 使用连接设置,开始连接 VPN Server +CMD_AccountConnect_Help 指定注册到 VPN Client 的连接设置,并启动连接设置连接到 VPN Server 上。处于正在连接中或已连接状态的连接设置,将一直连接 VPN Server,或不断尝试连接 VPN Server,直到使用 AccountDisconnect 指令断开连接。(但是,如果使用 AccountRetrySet 指令指定了重试次数时,连接尝试将在达到被指定次数时中断。) +CMD_AccountConnect_Args AccountConnect [name] +CMD_AccountConnect_[name] 指定要启动的连接设置名。 + + +# AccountDisconnect 命令 +CMD_AccountDisconnect 断开连接中的连接设置 +CMD_AccountDisconnect_Help 指定注册到 VPN Client 的连接设置,其连接设置处于连接处理中或已连接的状态时,立即将其断开。 +CMD_AccountDisconnect_Args AccountDisconnect [name] +CMD_AccountDisconnect_[name] 指定要断开的连接设置名。 + + +# AccountStatusGet 命令 +CMD_AccountStatusGet 获取当前连接设置的状态 +CMD_AccountStatusGet_Help 指定注册到 VPN Client 的连接设置,且该连接设置当前已连接时,获取其连接状态和和其他信息。 +CMD_AccountStatusGet_Args AccountStatusGet [name] +CMD_AccountStatusGet_[name] 指定要获取信息的连接设置名。 + + +# AccountNicSet 命令 +CMD_AccountNicSet 设置连接设置时使用的虚拟 LAN 卡 +CMD_AccountNicSet_Help 更改注册到 VPN 客户上的现有的连接设置用于连接 VPN Server 的虚拟 LAN 卡名。 +CMD_AccountNicSet_Args AccountNicSet [name] [/NICNAME:nicname] +CMD_AccountNicSet_[name] 指定要更改设置的连接设置名。 +CMD_AccountNicSet_NICNAME 指定连接 VPN Server 时使用的虚拟 LAN 卡名。 + + +# AccountStatusShow 命令 +CMD_AccountStatusShow 设置成在连接到 VPN Server 时显示连接状态和错误的画面 +CMD_AccountStatusShow_Help 指定注册到 VPN Client 的连接设置且用其连接设置连接到 VPN Server 时,设置在计算机上显示连接状态和错误画面。 +CMD_AccountStatusShow_Args AccountStatusShow [name] +CMD_AccountStatusShow_[name] 指定要更改设置的连接设置名。 + + +# AccountStatusHide 命令 +CMD_AccountStatusHide 设置成在连接到 VPN Server 时不显示连接状态和错误的画面 +CMD_AccountStatusHide_Help 指定注册到 VPN Client 的连接设置且用其连接设置连接到 VPN Server 时,设置在计算机上不显示连接状态和错误画面。 +CMD_AccountStatusHide_Args AccountStatusHide [name] +CMD_AccountStatusHide_[name] 指定要更改设置的连接设置名。 + + +# AccountSecureCertSet 命令 +CMD_AccountSecureCertSet 将连接设置的用户认证类型设置为智能卡认证 +CMD_AccountSecureCertSet_Help 指定注册到 VPN Client 的连设置,将其连接设置连接到 VPN Server 时的用户认证方法设置为 [智能卡认证]。此外,必须指定存储在智能卡上的证书对象名和密钥对象名。 +CMD_AccountSecureCertSet_Args AccountSecureCertSet [name] [/CERTNAME:cert] [/KEYNAME:key] +CMD_AccountSecureCertSet_[name] 指定要更改设置的连接设置名。 +CMD_AccountSecureCertSet_CERTNAME 指定存储在智能卡中的证书对象名。 +CMD_AccountSecureCertSet_KEYNAME 指定存储在智能卡中的密钥对象名。 +CMD_AccountSecureCertSet_PROMPT_CERTNAME 智能卡证书对象名: +CMD_AccountSecureCertSet_PROMPT_KEYNAME 智能卡私匙对象名: + + +# PcAccountOpensslEngineCertSet +CMD_AccountOpensslCertSet_PROMPT_KEYNAME Specify the openssl engine specific key name: +CMD_AccountOpensslCertSet_PROMPT_ENGINENAME Specify the openssl engine name: + + +# AccountRetrySet 命令 +CMD_AccountRetrySet 设置连接设置的连接失败或断开时建立重新连接的次数和间隔 +CMD_AccountRetrySet_Help 指定注册到 VPN Client 的连接设置,且其连接设置试图连接到 VPN Server 时,还有连接中的与 VPN Server 的通信被断开或连接失败时,指定连接的重试次数和连接重试的间隔。\n而且,如果用户认证类型为 [智能卡认证] 时,不管连接重试次数如何设置,都将不进行连接重试。 +CMD_AccountRetrySet_Args AccountRetrySet [name] [/NUM:num_retry] [/INTERVAL:retry_interval] +CMD_AccountRetrySet_[name] 指定要更改设置的连接设置名。 +CMD_AccountRetrySet_NUM 指定连续进行重新连接的次数。 如指定 "999",重试次数为无限次 (永久连接)。如指定 "0",不进行重新连接。 +CMD_AccountRetrySet_INTERVAL 重新进行连接时,设置距离上次断开或连接失败后需多少秒开始重新连接处理。 +CMD_AccountRetrySet_PROMPT_NUM 重新连接次数 ("999" 为无限次): +CMD_AccountRetrySet_PROMPT_INTERVAL 重新连接间隔 (秒): +CMD_AccountRetrySet_EVAL_INTERVAL 请指定 5 秒以上的重新连接间隔。 + + +# AccountStartupSet 命令 +CMD_AccountStartupSet 设定连接设置的启动连接 +CMD_AccountStartupSet_Help 指定注册到 VPN Client 的连接设置,并将其设定为启动连接。设置为启动连接的连接设置,在 VPN Client 服务运行的同时将自动启动连接程序。 +CMD_AccountStartupSet_Args AccountStartupSet [name] +CMD_AccountStartupSet_[name] 指定要更改设置的连接设置名。 + + +# AccountStartupRemove 命令 +CMD_AccountStartupRemove 解除连接设置的启动连接 +CMD_AccountStartupRemove_Help 指定注册到 VPN Client 的连接设置,并把其连接设置设置为当前启动连接时,解除启动连接设置。 +CMD_AccountStartupRemove_Args AccountStartupRemove [name] +CMD_AccountStartupRemove_[name] 指定要更改设置的连接设置名。 + + +# AccountExport 命令 +CMD_AccountExport 导出连接设置 +CMD_AccountExport_Help 指定注册到 VPN Client 的连接设置,将其连接设置的内容作为文本文件导出。因为而后要导入被导出的连接设置,可以复制连接设置的内容。而且,因为以文本文件保存,可以用一般的文本编辑器进行编辑。\n导出目标文件,以 UTF-8 格式的文本文件保存。还有,如果在文件名称上添加 .vpn 的扩展名,因为能与 Windows 版 VPN Client 连接员产生关联,会很方便。 +CMD_AccountExport_Args AccountExport [name] [/SAVEPATH:savepath] +CMD_AccountExport_[name] 指定导出连接设置的连接设置名。 +CMD_AccountExport_SAVEPATH 指定保存目标文件名 +CMD_AccountExport_PROMPT_SAVEPATH 保存目标文件名 (推荐扩展 .vpn): + + +# AccountImport 命令 +CMD_AccountImport 导入连接设置 +CMD_AccountImport_Help 导入由 AccountExport 指令导出的连接设置文件,添加到 VPN 客户。 +CMD_AccountImport_Args AccountImport [path] +CMD_AccountImport_[path] 指定导入源文件名。 +CMD_AccountImport_PROMPT_PATH 导入源文件名: +CMD_AccountImport_FAILED_PARSE 不能正确解析指定的文件。请检查该文件是否已正确导出。 +CMD_AccountImport_OK 连接设置 "%s" 已导入。 + + + +# RemoteEnable 命令 +CMD_RemoteEnable 允许 VPN 客户服务的远程管理 +CMD_RemoteEnable_Help 对 VPN Client 服务,从本地主机以外的远程计算机上,允许通过命令行管理设施或 VPN Client 管理器员进行连接和管理。 +CMD_RemoteEnable_Args RemoteEnable + + +# RemoteDisable 命令 +CMD_RemoteDisable 禁止 VPN 客户服务的远程管理 +CMD_RemoteDisable_Help 对 VPN Client 服务,从本地主机以外的远程计算机上,禁止通过命令行管理设施或 VPN Client 管理器员进行连接和管理。 +CMD_RemoteDisable_Args RemoteDisable + + + + + + +################################################### +# # +# 下面这是VPN工具用的指令 # +# # +################################################### + + +# MakeCert 命令 +CMD_MakeCert 创建新的 X.509 证书和密钥 (1024 位) +CMD_MakeCert_Help 创建新的 X.509 证书和密钥,将其保存为一个文件。\n证书公共密钥和秘密密钥的生成算法使用 RSA 1024 位。\n作为证书类型,可以创建由根证书 (自签名证书) 和其他证书签名的某个证书。要创建由其他证书签名的证书,需要与用于签名的证书 (X.509格式文件) 相对应的密钥文件 (Base 64 编码)。\n\n创建的证书可以指定名称 (CN),所属机构 (O),组织单位 (OU),国家 (C),州 (ST),当地 (L),序列号,有效期限。\n创建的证书以 X.509 格式的文件,密钥文件以 RSA 1024 位的 Base 64 编码文件,被分别保存。\n\nMakeCert 指令是一个工具,它提供创建证书所需的最低功能。如果想创建一个真正的证书,建议使用 OpenSSL 等免费软件和出售的 CA (认证机构) 软件。\n\n※注意: 此指令可以从 SoftEther VPN 命令行管理工具调用。虽然目前以管理模式连接到 VPN Server 和 VPN Client 时可以运行,但要实际运行 RSA 演算,生成证书数据的,是运行此指令的计算机,和以管理模式连接的链接目标计算机没有任何关系。 +CMD_MakeCert_Args MakeCert [/CN:cn] [/O:o] [/OU:ou] [/C:c] [/ST:st] [/L:l] [/SERIAL:serial] [/EXPIRES:expires] [/SIGNCERT:signcert] [/SIGNKEY:signkey] [/SAVECERT:savecert] [/SAVEKEY:savekey] +CMD_MakeCert_CN 指定创建证书的名称 (CN) 项目。还可以指定 none。 +CMD_MakeCert_O 指定创建证书的所属机构 (O) 项目。还可以指定 none。 +CMD_MakeCert_OU 指定创建证书的组织单位 (OU) 项目。还可以指定 none。 +CMD_MakeCert_C 指定创建证书的国家 (C) 项目。还可以指定 none。 +CMD_MakeCert_ST 指定创建证书的州 (ST) 项目。还可以指定 none。 +CMD_MakeCert_L 指定创建证书的当地 (L) 项目。还可以指定 none。 +CMD_MakeCert_SERIAL 指定创建证书的序列号项目。以 16 进制指定。还可以指定 none。 +CMD_MakeCert_EXPIRES 指定创建证书的有效期限。如果指定 none 或 0,将被使用 3650 天 (约 10 年)。最大可以指定 10950 天 (约 30 年)。 +CMD_MakeCert_SIGNCERT 根据现有的证书对要创建的证书签名时,指定用来签名的 X.509 形式的证书文件名。如果省略参数,将作为根证书而创建没有签名的新证书。 +CMD_MakeCert_SIGNKEY 指定与 /SIGNCERT 指定的证书相应的密钥 (RSA,Base 64 的编码) +CMD_MakeCert_SAVECERT 指定文件名以保存创建的证书。该证书以包含 RSA 形式的 1024 位公开密钥的 X.509 文件格式被保存。 +CMD_MakeCert_SAVEKEY 指定文件名保存对应创建的证书的密钥。该密钥以 RSA 形式的 1024 位密钥文件被保存。 +CMD_MakeCert_PROMPT_CN 创建证书的名称 (CN): +CMD_MakeCert_PROMPT_O 创建证书的所属机构 (O): +CMD_MakeCert_PROMPT_OU 创建证书的组织单位 (OU): +CMD_MakeCert_PROMPT_C 创建证书的国家 (C): +CMD_MakeCert_PROMPT_ST 创建证书的州 (ST): +CMD_MakeCert_PROMPT_L 创建证书的当地 (L): +CMD_MakeCert_PROMPT_SERIAL 创建证书的序列号 (十六进制): +CMD_MakeCert_PROMPT_EXPIRES 创建证书的有效期限 (日): +CMD_MakeCert_PROMPT_SAVECERT 保存已创建证书的文件名: +CMD_MakeCert_PROMPT_SAVEKEY 保存已创建密钥的文件名: +CMD_MakeCert_EVAL_EXPIRES 请指定有效期限为 %u 以上 %u 以下。 +CMD_MakeCert_ERROR_SIGNKEY 无法读取以 /SIGNCERT 和 /SIGNKEY 指定的证明书和密钥或组合不正确。 +CMD_MakeCert_ERROR_GEN_FAILED 无法生成证书和私钥。 + + +# MakeCert2048 命令 +CMD_MakeCert2048 创建新的 X.509 证书和密钥 (2048 位) +CMD_MakeCert2048_Help 创建新的 X.509 证书和密钥,将其保存为一个文件。\n证书公共密钥和秘密密钥的生成算法使用 RSA 1024 位。\n作为证书类型,可以创建由根证书 (自签名证书) 和其他证书签名的某个证书。要创建由其他证书签名的证书,需要与用于签名的证书 (X.509 格式文件) 相对应的密钥文件 (Base 64 编码)。\n\n创建的证书可以指定名称 (CN),所属机构 (O),组织单位 (OU),国家 (C),州 (ST),当地 (L),序列号,有效期限。\n创建的证书以 X.509 格式的文件,密钥文件以 RSA 2048 位的 Base 64 编码文件,被分别保存。\n\nMakeCert 指令是一个工具,它提供创建证书所需的最低功能。如果想创建一个真正的证书,建议使用 OpenSSL 等免费软件和出售的 CA (认证机构) 软件。\n\n※注意: 此指令可以从 SoftEther VPN 命令行管理工具调用。虽然目前以管理模式连接到 VPN Server 和 VPN Client 时可以运行,但要实际运行 RSA 演算,生成证书数据的,是运行此指令的计算机,和以管理模式连接的链接目标计算机没有任何关系。 +CMD_MakeCert2048_Args MakeCert2048 [/CN:cn] [/O:o] [/OU:ou] [/C:c] [/ST:st] [/L:l] [/SERIAL:serial] [/EXPIRES:expires] [/SIGNCERT:signcert] [/SIGNKEY:signkey] [/SAVECERT:savecert] [/SAVEKEY:savekey] +CMD_MakeCert2048_CN 指定创建证书的名称 (CN) 项目。还可以指定 none。 +CMD_MakeCert2048_O 指定创建证书的所属机构 (O) 项目。还可以指定 none。 +CMD_MakeCert2048_OU 指定创建证书的组织单位 (OU) 项目。还可以指定 none。 +CMD_MakeCert2048_C 指定创建证书的国家 (C) 项目。还可以指定 none。 +CMD_MakeCert2048_ST 指定创建证书的州 (ST) 项目。还可以指定 none。 +CMD_MakeCert2048_L 指定创建证书的当地 (L) 项目。还可以指定 none。 +CMD_MakeCert2048_SERIAL 指定创建证书的序列号项目。以 16 进制指定。还可以指定 none。 +CMD_MakeCert2048_EXPIRES 指定创建证书的有效期限。如果指定 none 或 0,将被使用 3650 天 (约 10 年)。最大可以指定 10950 天 (约 30 年)。 +CMD_MakeCert2048_SIGNCERT 根据现有的证书对要创建的证书签名时,指定用来签名的 X.509 形式的证书文件名。如果省略参数,将作为根证书而创建没有签名的新证书。 +CMD_MakeCert2048_SIGNKEY 指定与 /SIGNCERT 指定的证书相应的密钥 (RSA,Base 64 的编码) +CMD_MakeCert2048_SAVECERT 指定文件名以保存创建的证书。该证书以包含 RSA 形式的 2048 位公开密钥的 X.509 文件格式被保存。 +CMD_MakeCert2048_SAVEKEY 指定文件名保存对应创建的证书的密钥。该密钥以 RSA 形式的 2048 位密钥文件被保存。 + + +# TrafficClient 命令 +CMD_TrafficClient 在用户模式下,运行网络流量速度测试工具 +CMD_TrafficClient_Help 运行通信吞吐量测量工具的客户端程序。\n通信吞吐量测量工具,作为 TrafficClient 和 TrafficServer 两个指令使用,可以测量在 IP 网络上连接的 2 台计算机之间可传送的通信吞吐量。在另一台计算机上使用 TrafficServer 指令使通信吞吐量测量工具服务器处于待机状态,用 TrafficClient 指令指定并连接其服务器的主机名或 IP 地址和端口号,测量通信速度。\n同时建立多个连接,计算各连接最大限度传送流数据的结果,及在指定时间内能够实际传送的数据的比特数,以此为依据计算通信吞吐量的平均值 (bps),用此方法进行通信速度的测量。通常,用一个 TCP 连接时,由于 TCP 算法的限制,大多数时候只能用比实际的网络吞吐量慢的速度通信。因此,建议测量同时建立多个 TCP 连接进行通信的结果。用此方法测量的吞吐量,以实际上作为 TCP 流到达接收方的数据的比特长度来计算,因此途中产生的数据包丢失和数据包损坏不包括在实际到达的数据包中,因而能够计算出纯粹的网络最大通信带宽的近似值。\n用作为测量结构的,在 TCP 内被传输的 TCP 流的大小,来计算在网络上实际传输的数据量的近似值,将其除以时间,计算出比特每秒 (bps)。假定计算的物理网络类型为以太网 (IEEE802.3) ,MAC 帧有效载荷的大小是 1,500 比特 (TCP 的 MSS 是 1,460 比特)。如果指定 /RAW 选项,不会对 TCP/IP 头和 MAC 头的数据量进行更正计算。\n\n※注意: 此指令可以从 SoftEther VPN 命令行管理工具调用。虽然目前以管理模式连接到 VPN Server 和 VPN Client 时可以运行,但要实际进行通信,测量吞吐量的,是运行此指令的计算机,与以管理模式连接的连接目标计算机没有任何关系。 +CMD_TrafficClient_Args TrafficClient [host:port] [/NUMTCP:numtcp] [/TYPE:download|upload|full] [/SPAN:span] [/DOUBLE:yes|no] [/RAW:yes|no] +CMD_TrafficClient_[host:port] 指定通信吞吐量测量服务器 (TrafficServer) 待机时的主机名,或 IP 地址和端口号。如果省略端口号,9821 将被使用。 +CMD_TrafficClient_NUMTCP 指定同时在客户端和服务器进行数据传输的 TCP 连接数量。如果省略,32 将被使用。 +CMD_TrafficClient_TYPE 指定进行吞吐量测量时的数据传输流方向。指定下列选项之一: "download","upload" 或 "full"。指定 "download",则数据从服务器端向客户端传送。指定 "upload",则数据从客户端向服务器端传送。指定 "full",数据将双向传送。当指定 "full" 时,NUMTCP 的值必须指定是 2 以上的偶数 (同时被连接的 TCP 连接中一半用于下载的方向,而另一半用于上传的方向)。如果省略此参数,将使用 "full"。 +CMD_TrafficClient_SPAN 以秒为单位指定为测量吞吐量而进行数据传输时间。如果省略此参数,"15秒" 将被使用。 +CMD_TrafficClient_DOUBLE 指定 "yes" 时,测量结果的吞吐量将显示为 2 倍。在中途有网络设备等,测量其其网络设备的输入输出合计的吞吐量能力时,此选项被使用。 +CMD_TrafficClient_RAW 通过指定 "yes",计算将不校正 TCP/IP 头和 MAC 头的数据量。 +CMD_TrafficClient_EVAL_NUMTCP TCP 连接的数量请在 32 以下指定。 +CMD_TrafficClient_PROMPT_HOST 测量服务器名称和端口号 (如果省略 9821): +CMD_TrafficClient_ERROR_NUMTCP 当数据的流向是 "full" (双向) 时,须将 TCP 连接数 (/NUMTCP) 指定为偶数值。 +CMD_TrafficClient_ERROR_HOSTPORT 指定的主机名或端口号不正确。 + + +# TrafficServer 命令 +CMD_TrafficServer 在服务器模式下,运行网络流量速度测试工具 +CMD_TrafficServer_Help 运行通信吞吐量测量工具的服务器程序。\n通信吞吐量测量工具,作为 TrafficClient 和 TrafficServer 两个指令使用,可以测量在 IP 网络上连接的 2 台计算机之间可传送的通信吞吐量。\n要使此计算机上的 TCP 端口处于待机状态,等待从另一台计算机的 TrafficClient 连接,启动 TrafficServer 指令并指定端口号。\n关于通信吞吐量测量工具的详细情况,输入 "TrafficClient ?" 将显示。\n\n※注意: 此指令可以从 SoftEther VPN 命令行管理工具调用。虽然目前以管理模式连接 VPN Server 和 VPN Client 时可以运行,但要进行实际通信并测量吞吐量的,是运行此指令的计算机,与用管理模式连接终端的计算机没有任何关系。 +CMD_TrafficServer_Args TrafficServer [port] [/NOHUP:yes|no] +CMD_TrafficServer_[port] 以整数指定等待连接的端口号。被指定的端口,如果已经由另一个程序在使用,或不能打开该端口时,将发生错误。 +CMD_TrafficServer_NOHUP When "yes" is specified, the server process never stops without regard to any input from the console. It is convenient when you want to run the TrafficServer endlessly. + + +# 关于 TrafficClient / TrafficServer 的内部信息字符串 +TT_LISTEN_FAILED 不能使 TCP 端口 %u 处于待机状态。该端口可能正被其他的程序使用或打开此端口的权限。 +TTS_LISTEN_STOP 关闭了待机端口。 +TTS_ENTER_TO_EXIT \n----------------------------------------\n在服务器模式下开启的网络流量速度测试工具。\n\n按下 Enter 键,停止服务器程序。\n----------------------------------------\n\n +TTS_INIT 运行服务器程序... +TTS_LISTEN_STARTED 启动了服务器程序。将 IPv4 的 TCP 端口 %u 处于待机状态,等待从客户端的连接。 +TTS_LISTEN_STARTED_V6 将 IPv6 的 TCP 端口 %u 处于待机状态,等待从客户端的连接。 +TTS_LISTEN_FAILED_V6 无法打开 IPv6 TCP 端口 %u。另一个应用程序可能正在使用同一个 IPv6 TCP 端口,或者没有安装 IPv6 协议栈在操作系统上。 +TTS_STOP_INIT 停止服务器程序... +TTS_STOP_FINISHED 停止服务器程序完成了。 +TTS_ACCEPTED 连接 %u: 从客户端 %S 的端口 %u 被连接了。 +TTS_DISCONNECTED 连接 %u 个 (%S) 被中断了。 +TTS_DISCONNECT 连接 %u (%S) 中断了。 +TTC_INIT 客户端程序启动... +TTC_FREE 客户端程序终止了。 +TTC_CONNECT_START 服务器 %S (端口 %u) 的连接将启动。%u 个 TCP 连接将实现连接。 +TTC_CONNECT_FAILED %u 个 TCP 连接接续失败。 +TTC_CONNECT_NOT_SERVER 除 TrafficServer 外其他程序在终端 TCP 端口运行,流量不能测量。 +TTC_CONNECT_OK %u 个 TCP 连接数已连接。 +TTC_CONNECT_OK_2 \ 数据传输方向: %s +TTC_ERROR_ABORTED 与服务器的 TCP 连接初始化失败。测量将停止。 +TTC_SUMMARY_BAR ------------------------------------------------------- +TTC_SUMMARY_TITLE 网络传输速度测试工具客户端设置参数。 +TTC_SUMMARY_HOST 终端主机名 +TTC_SUMMARY_PORT 终端 TCP 端口号 +TTC_SUMMARY_NUMTCP 建立的 TCP 连接数 +TTC_SUMMARY_TYPE 数据传输方向 +TTC_SUMMARY_SPAN 数据传输时间 +TTC_SUMMARY_ETHER 以太网帧数据校正 +TTC_SUMMARY_DOUBLE 中继器输入输出力合计速度的测量 +TTC_TYPE_DOWNLOAD 下载 (服务器 -> 客户端) +TTC_TYPE_UPLOAD 上传 (客户端 -> 服务器) +TTC_TYPE_FULL 双向 (服务器 <--> 客户端) +TTC_SPAN_STR %.1f 秒 +TTC_COMM_START 所有连接已经建立,数据传输开始。\n测量开始时间: %s\n预计完成时间: %s\n\n测量进行中。请稍后。\n(测量进行中,请不要使用其他应用程序。)\n\n +TTC_COMM_END 因为过了 %.1f 秒以上,数据通信将终止。\n\n +TTC_COMM_USER_CANCEL 由于用户取消,数据通信将终止。\n\n +TTC_COMM_DISCONNECTED TCP 连接 %u 已被断开。 +TTC_STOPPING 停止通信吞吐量测量工具客户端操作... +TTC_ENTER_TO_EXIT \n----------------------------------------\n在客户模式下开启网络传输速度测试工具。\n\n按下Enter键停止客户端程序。\n----------------------------------------\n\n +TTC_RES_TITLE \n\n网络传输速度测试工具 \n\n +TTC_RES_COLUMN_1 项目名称 +TTC_RES_COLUMN_2 正常查看 +TTC_RES_COLUMN_3 简化查看 +TTC_RES_SPAN 检测时的使用时间 +TTC_RES_ETHER 以太网帧数据校正 +TTC_RES_BYTES_DOWNLOAD 下载通信数据量 +TTC_RES_BYTES_UPLOAD 上载通信数据量 +TTC_RES_BYTES_TOTAL 总通信数据量 +TTC_RES_DOUBLE 中继器输入输出总吞吐量计算 +TTC_RES_BPS_DOWNLOAD 下载方向的平均吞吐量 +TTC_RES_BPS_UPLOAD 上传方向的平均吞吐量 +TTC_RES_BPS_TOTAL 总平均吞吐量 + + +# Check 命令 +CMD_Check 检测 SoftEther VPN 是否能正常运行 +CMD_Check_Help 正在运行 vpncmd 的计算机上,正检测 SoftEther VPN Server / Bridge 的运行平台是否适合。\n通过了这一检查的系统,SoftEther VPN 软件有较高的可能性进行正常运行。此外,无法通过此检查的系统,如果使用了 SoftEther VPN 软件可能会发生一些问题。 +CMD_Check_Args Check + + +# 关于系统 checker +# (包含着一部分奇怪的字符串,不过,是检测字符编码变换用的) +CHECK_TITLE ---------------------------------------------------\nSoftEther VPN 运行环境检查工具\nDeveloper Edition\n\nCopyright (c) all contributors on SoftEther VPN project in GitHub.\nCopyright (c) Daiyuu Nobori, SoftEther Project at University of Tsukuba, and SoftEther Corporation.\nAll Rights Reserved.\n\n +CHECK_NOTE 如果运行了此运行环境检测工具的系统通过了测试,SoftEther VPN 软件有较高的运行可能性。检测可能需要一定的时间。请稍候...\n\n +CHECK_EXEC_TAG '%s' 的检测中...\n +CHECK_PASS [合格] ○ +CHECK_FAIL [不合格] × +CHECK_RESULT_1 全部检测通过,说明 SoftEther VPN Server / Bridge 在此系统上正常运行的可能性很高。 +CHECK_RESULT_2 一部分的检测结果是不合格。请确认系统的运行环境。如果在这个系统上实行 SoftEther VPN Server / Bridge,有发生问题的可能性。 +CHECK_TEST_123456789 123456789 + + +CHECK_PROC_KERNEL 内核系统 +CHECK_PROC_MEMORY 存储器操作系统 +CHECK_PROC_STRINGS ANSI / Unicode 字符串处理系统 +CHECK_PROC_FILESYSTEM 文件系统 +CHECK_PROC_THREAD 线程处理系统 +CHECK_PROC_NETWORK 网络系统 + + +###################################################### +# # +# 安装向导(SW)字符串 # +# # +###################################################### + +SW_TITLE SoftEther VPN Developer Edition 安装向导 (版本 %S) +SW_EXIT_CONFIRM SoftEther VPN 的安装未完成。\r\n\r\n您确定要退出吗? +SW_UNINSTALL_CONFIRM 开启%s卸载程序。\r\n\r\n您确定要继续吗? + + +SW_COMPONENT_VPNSERVER_TITLE SoftEther VPN Server +SW_COMPONENT_VPNSERVER_DESCRIPTION 把它安装在服务器计算机上作为 VPN 的中心站点。管理工具也会同时安装。 + +SW_COMPONENT_VPNCLIENT_TITLE SoftEther VPN Client +SW_COMPONENT_VPNCLIENT_DESCRIPTION 安装它在 VPN Client 电脑上。VPN Client 台电脑将能连接到中心 VPN Server 了。管理工具也会同时安装。 + +SW_COMPONENT_VPNBRIDGE_TITLE SoftEther VPN Bridge +SW_COMPONENT_VPNBRIDGE_DESCRIPTION 安装它在每个站点的电脑上。每个 VPN Bridge 将会建立一个通向中心 VPN Server 的 VPN 连接。管理工具也会同时安装。 + +SW_COMPONENT_VPNSMGR_TITLE SoftEther VPN Server 管理工具 (仅限管理工具) +SW_COMPONENT_VPNSMGR_DESCRIPTION 安装的只有 VPN Server 管理工具。不会安装 VPN Server 服务程序。您可以在 Windows, Linux, Mac OS X, Solaris, FreeBSD 的系统上使用此 VPN Server 管理工具进行连接和管理远程的 VPN Server / Bridge 端。 + +SW_COMPONENT_VPNCMGR_TITLE SoftEther VPN Client 管理工具(仅限管理工具) +SW_COMPONENT_VPNCMGR_DESCRIPTION 安装的只有 VPN Client 管理工具。不会安装 VPN Client 服务程序。您可以在 Windows 或 Linux 的系统上使用此 VPN Client 管理工具进行连接和管理远程的 VPN Client 。 + +SW_WELCOME_TITLE 欢迎来到 SoftEther VPN Developer Edition 安装向导 +SW_MODE_TITLE 选择一个安装模式 +SW_NOT_ADMIN_TITLE 没有足够权限 +SW_COMPONENTS_TITLE 选择安装一个软件部分 +SW_EULA_TITLE 最终用户许可协议 +SW_WARNING_TITLE 重要信息 +SW_DIR_TITLE 安装目录 +SW_READY_TITLE 准备安装l +SW_PERFORM_TITLE 安装正在进行中 +SW_ERROR_TITLE 安装结果 +SW_FINISH_TITLE 安装结束 +SW_UNINST1_TITLE 卸载程序r +SW_LANG1_TITLE SoftEther VPN : 配置显示语言 +SW_EASY1_TITLE 欢迎来到 SoftEther VPN Client 简单安装程序创建工具 +SW_EASY2_TITLE 指定文件夹 +SW_WEB1_TITLE 欢迎来到 SoftEther VPN Client Web安装程序创建工具 +SW_WEB2_TITLE 指定文件夹 + +SW_UNINSTALLINFO_URL http://selinks.org/ +SW_UNINSTALLINFO_PUBLISHER SoftEther VPN Project + +SW_KB3033929_REQUIRED 在 Windows 7 以及 Windows Server 2008 R2系统上, SoftEther VPN 的一些功能需要安全更新程序KB3033929。\r\n\r\n如果 KB3033929 未在你的系统中安装, 在安装SoftEther VPN 前请从 Windows Update 或 Microsoft 网站上下载安装该更新程序。 + + +SW_COMPONENTS_ABOUT_TAG 关于 %s +SW_COMPONENTS_REQUIRE_ADMIN 安装需要管理员权限 +SW_COMPONENTS_REQUIRE_ADMIN_TEXT 您需要一个有管理权限的用户来重启本安装向导,并以系统模式安装 %s。以系统模式安装,请点击后退。 +SW_DIR_SELECT 请指定安装目录 +SW_DIR_MORE_THAN_110 目录名太长。\r\n最多指定 110 个字母. +SW_DIR_WRITE_ERROR 无法创建指定的目录 "%s",或在目录中写入文件失败。\r\n\r\n指定另外一个目录。 +SW_DIR_DST_IS_SAME_TO_SRC 指定的目录 "%s" 与源目录相同。 +SW_DIR_IS_NOT_HDD 指定的目录 "%s" 不在本地硬盘驱动上。\r\n\r\n要 "%s" 在系统模式下安装,您必须指定一个在本地硬盘驱动上的目录。 +SW_DIR_IS_NOT_FULLPATH 目录 "%s" 不是全路径格式。\r\n\r\n请指定一个全路径目录。 +SW_DIR_DST_IS_OTHER_PRODUCT 指定的目录已经有另一个部分已安装。\r\n\r\n请指定另外一个目录。 +SW_DIR_DST_IS_NEWER 本软件的更新版本已经安装到指定目录。\r\n\r\n您不必安装本版本。 +SW_DIR_DST_IS_NEWER_2 本软件的更新版本已经安装到指定目录。\r\n\r\n本安装程序将导入和应用已嵌入在简单安装工具中的 VPN 连接设置。程序文件不会被覆盖。 +SW_DIR_DST_IS_BROKEN 无法读取指定目录下的文件 "%s"。\r\n\r\n请指定另外一个目录。 +SW_DIR_DST_IS_SYSTEM_MODE 同样的软件已经在指定目录中以系统模式安装。\r\n\r\n请指定另外一个目录。 +SW_DIR_DST_IS_USER_MODE 同样的软件已经在指定目录中以用户模式安装。\r\n\r\n请指定另外一个目录。 +SW_SYSTEM_MODE_ALREADY_INSTALLED 本软件 "%s" 以系统模式被安装在这台电脑上。\r\n\r\n同样的软件以用户模式和系统模式安装在同一台电脑上会发生冲突。\r\n\r\n您确定要以用户模式继续进行安装? + +SW_SETUPLOG_CORRUPTED "setuplog.dat" 文件已被破坏。 +SW_MSI_UNINSTALL_FAILED 之前的版本 %s (产品号: "%S")已安装。 Windows安装工具卸载旧版本失败。\r\n\r\n请您手动卸载并且重启本安装工具。 +SW_MSI_UNINSTALL_REBOOT_REQUIRED Windows 安装工具已经卸载旧版本 %s。请重启电脑。\r\n\r\n点击结束按钮并且手动重启电脑,然后在电脑重启后,重启本安装工具。 +SW_NOTICE_VPNSERVER_IS_INSTALLED SoftEther VPN Bridge 端作为软件一部分来安装。但是,本电脑已经安装了 SoftEther VPN Server。\r\n\r\n通常,您不需要在同一台电脑上同时安装 SoftEther VPN Server 端和 SoftEther VPN Bridge 端。\r\n如果您同时安装了这两个软件,那么有些冲突就会发生,例如端口号重复。\r\n如果您想把 SoftEther VPN Server 端替换成 SoftEther VPN Bridge 端,您应该退出本安装工具,卸载 SoftEther VPN Server 端,并在卸载成功后重启本安装工具。\r\n\r\n您确定要继续 SoftEther VPN Bridge 端的安装吗? +SW_NOTICE_VPNBRIDGE_IS_INSTALLED SoftEther VPN Server 端被选为一个部分来安装。但是,本电脑已安装 SoftEther VPN Bridge 端。通常,您不需要在同一台电脑上同时安装 SoftEther VPN Server 端和 SoftEther VPN Bridge 端。\r\n如果您同时安装了这两个软件,那么有些冲突就会发生,例如端口号重复。\r\n如果您想把 SoftEther VPN Bridge 替换成 SoftEther VPN Server 端,您应该退出本安装工具,卸载 SoftEther VPN Bridge,并在卸载成功后重启本安装工具。\r\n\r\n您确定要继续 SoftEther VPN Server 端的安装吗? +SW_OS_FAILED 本操作系统不支持%s. +SW_LANG_NOT_CHANGED %s的语言设置没有改变。 +SW_LANG_LIST_LOAD_FAILED 载入可用语言列表失败。 +SW_LANG_OK 显示语言 %s 修改成功。\r\n如果目前 %s程序正在运行,请退出并重启,以改变显示语言。如果显示语言依然未改变,请重启 Windows。\r\n +SW_LANG_OK_SERVICE 记录服务程序的日志文件的语言会在重启后修改。 +SW_LANG_OK_VPNCMGR \r\n在退出和重启 VPN Client 管理器之后,其显示设置将会改变。 (包括任务托盘的彻底终止) +SW_CHILD_PROCESS_ERROR 子进程执行失败。 +SW_EXE_FILTER Windows 可执行文件 (*.EXE)|*.exe|All Files (*.*)|*.* +SW_PERFORM_MSG_EASY_INFO 编辑 VPN Client 简单安装工具 +SW_EASY_FINISHED_MSG VPN Client 简单安装工具创建成功。\r\n本安装工具保存为如下文件名。\r\n\r\n%s\r\n\r\n您可以在公司里分配以上的文件。 +SW_EASY_ERROR_MSG VPN Client 简单安装工具创建失败。 +SW_OTHER_INSTANCE_EXISTS 另外一个 SoftEther VPN 安装向导正在运行中\r\n\r\n您可以在那个向导退出后,继续运行此向导。 +SW_PERFORM_MSG_WEB_INFO 编译 VPN Client Web安装工具 +SW_WEB_ERROR_MSG VPN Client Web 安装工具创建失败。 +SW_INSTALLER_CACHE_IS_NOT_SIGNED 目前已安装 SoftEther VPN Client 的这台电脑没有安 SoftEther 公司签署 Authenticode 数字证书的数字签名包。\r\n它有可能是从一个客户定制的安装工具上安装的(例如:简单安装程序生成器制造的一个安装程序。)\r\n\r\n如果您继续创建 Web 安装工具,当下载的时候,会在用户界面上出现一个警示信息。\r\n为避免出现警示信息,您需要取消本创建向导,从 SoftEther 公司官网下载最新版本的 SoftEther VPN Client,重新安装并开启本 Web 安装工具创建器向导。\r\n\r\n你确定要继续创建一个 Web 安装工具吗? +SW_FILE_NOT_FOUNT 没有找到文件 "%s" +SW_WEB_FINISHED Web安装工具已创建,并保存为 "%s"。\r\n\r\n请将 ZIP 文件解压缩,并将解压后的文件上传到 Web 服务器,编辑一个HTML文件和一个 inf 文件来适当替换URL。\r\n\r\n部署 Web 安装程序的解释说明在ZIP文件中描述。 + +SW_VG_CONFIRM_MSG 您想用 SoftEther VPN 客户端安装并激活 VPN Gate P2P 中继功能的插件吗 ?\r\n\r\n本插件可以规避官方防火墙的限制实现通信的稳定性。同时 VPN Gate 的通信经常会消耗一定的网络带宽。所以不推荐在移动连接上使用 VPN Gate。\r\n\r\n请注意,一些国家和地区有规定禁止加密通信绕过官方防火墙。在这种情况下,请您不要在您的计算机上使用 VPN Gate 功能。VPN Gate 主要在日本使用。VPN Gate 仅仅是一个学术研究项目。VPN Gate 受日本法律管辖。使用此软件和服务期间,请您遵守本国相关的法律法规,这是您自己的责任。您将完全承担使用此软件和服务造成的任何损失和责任,不管在日本境内还是境外。 + + + + +SW_PERFORM_MSG_INIT_TASKS 准备任务... +SW_PERFORM_MSG_COPY_PREPARE 准备复制文件... +SW_PERFORM_MSG_WRITE_ERROR 写入目标文件 "%s" 失败。\r\n\r\n可能有另外一个项目正在使用该文件。\r\n如果程序或者服务%s正在运行,请关闭,并点击重试。 +SW_PERFORM_MSG_COPY_FILE 正在复制 "%s" ... +SW_PERFORM_MSG_SET_SECURITY 在 "%s" 设置安全系统 +SW_PERFORM_MSG_PLUGIN 插件安装中... +SW_PERFORM_MSG_STOP_SVC 停止 "%s" 的服务 +SW_PERFORM_MSG_WAIT_FOR_FILE_UNLOCK 文件 "%s" 被一个正在运行的程序锁定。正等待解锁... +SW_PERFORM_MSG_INSTALL_SVC 安装 %s 服务... +SW_PERFORM_MSG_START_SVC 开始 %s 服务... +SW_PERFORM_MSG_CREATE_LINKS 创建快捷方式文件夹... +SW_PERFORM_MSG_DELETE_LINKS 删除快捷方式文件夹... +SW_PERFORM_MSG_DELETE_OLD_LINKS 删除旧的快捷方式文件夹... +SW_PERFORM_MSG_REGISTER_UNINSTALL 在控制面板注册卸载信息... +SW_PERFORM_MSG_IMPORTING_ACCOUNT 在简单安装工具中的导入嵌入的 VPN 连接设置... +SW_PERFORM_MSG_DELETE_SETUP_INFO 删除安装信息和日志... +SW_PERFORM_MSG_WRITE_LOG 写入一个设置日志... +SW_PERFORM_MSG_COPY_ERROR 复制文件 "%s" 失败。 +SW_PERFORM_MSG_CREATE_LINK_ERROR 创建快捷方式文件 "%s" 失败。\r\n\r\n您要重试吗? +SW_PERFORM_MSG_WRITE_LOG_ERROR 安装日志文件 "%s" 创建中。\r\n\r\n您要重试吗? +SW_PERFORM_MSG_STOP_SVC_ERROR 关闭 "%s" 服务(内部名: "%S")失败。 +SW_PERFORM_MSG_START_SVC_ERROR 开启 "%s" 服务(内部名: "%S")失败。 +SW_PERFORM_MSG_SVC_UNINSTALL_FAILED 卸载 "%s" 服务(内部名: "%S")失败。 +SW_PERFORM_MSG_SVC_INSTALL_FAILED 安装 "%s" 服务(内部名: "%S")失败。 +SW_PERFORM_MSG_SVC_USERMODE_EXEC_FAILED 开启用户模式 %s 服务失败。 +SW_PERFORM_MSG_UPDATING 系统设置更新中... +SW_PERFORM_MSG_DELETE_NIC 移除虚拟网络适配器... +SW_PERFORM_MSG_FINISHED 安装进程结束。 +SW_PERFORM_MSG_UNINSTALL_MSI Windows 安装工具正在卸载旧版本 %s... +SW_PERFORM_MSG_UPDATE_LANG_CONFIG 修改语言设置... + +SW_PERFORM_MSG_INIT_UNINST 正准备卸载... +SW_PERFORM_MSG_DELETE_PREPARE 正准备删除文件... +SW_PERFORM_MSG_DELETE_ERROR 删除文件 "%s" 失败。\r\n\r\n可能有另外一个程序正在使用该文件。\r\n如果程序或服务 %s 正在运行,请关闭,并点击重试。 +SW_PERFORM_MSG_UNINSTALL_SVC 服务 "%s" 卸载中... +SW_PERFORM_MSG_DELETE 正在删除服务 "%s" ... +SW_PERFORM_MSG_EASY_INIT 创建简单安装工具... +SW_PERFORM_MSG_WEB_INIT 创建 Web 安装工具... +SW_PERFORM_MSG_INSTALL_SELOW 一个系统还原点创建中并安装必要成分。这可能需要一段时间... + + + +SW_TAG_USERNAME \ (用户模式) +SW_DIRNAME_CONFIG_TOOLS 配置工具 +SW_DIRNAME_ADMIN_TOOLS 管理工具 +SW_DIRNAME_LANGUAGE_TOOLS 语言设置 + +SW_RUN_TEXT_VPNSMGR 开启 SoftEther VPN Server 管理工具 +SW_RUN_TEXT_VPNCMGR 开启 SoftEther VPN Client 管理工具. + +SW_NIC_UNINSTALL SoftEther VPN 客户端的虚拟网络适配器已在系统上创建。\r\n你要删除这些虚拟网络适配器? + +# --- Do not translate this section !!! stay them in English !!! --- +SW_TAG_USERNAME_ENGLISH \ (User-Mode) +SW_LINK_NAME_VPNSERVER_SVC SoftEther VPN Server Developer User-mode Service +SW_LINK_NAME_VPNBRIDGE_SVC SoftEther VPN Bridge Developer User-mode Service +SW_LONG_VPNSERVER SoftEther VPN Server Developer Edition +SW_LONG_VPNCLIENT SoftEther VPN Client Developer Edition +SW_LONG_VPNBRIDGE SoftEther VPN Bridge Developer Edition +SW_LONG_VPNSMGR SoftEther VPN Server Manager Developer Edition +SW_LONG_VPNCMGR SoftEther VPN Client Manager Developer Edition +SW_LANG_SET_FAILED Failed to write the new language setting on lang.config file. +# --- end of "Do not translate this section" --- + + +# 快捷方式文件名 +SW_LINK_NAME_VPNSMGR_SHORT SoftEther VPN Server 管理工具 (Dev) +SW_LINK_NAME_VPNSMGR_SHORT_UM SE-VPN Server Manager (Dev User) +SW_LINK_NAME_VPNSMGR_SHORT_TOOLSONLY SE-VPN Server Manager (Dev Tools) +SW_LINK_NAME_VPNSMGR_SHORT_TOOLSONLY_UM SE-VPN Server Manager (Dev User Tools) +SW_LINK_NAME_VPNSMGR_FULL SoftEther VPN Server 管理工具 Developer Edition +SW_LINK_NAME_VPNSMGR_COMMENT 您在一个远程计算机上可以管理 SoftEther VPN Server 或者 SoftEther VPN Bridge 端。 + +SW_LINK_NAME_VPNCMGR_SHORT SoftEther VPN Client 管理工具 (Dev) +SW_LINK_NAME_VPNCMGR_FULL SoftEther VPN Client 管理工具 Developer Edition +SW_LINK_NAME_VPNCMGR_COMMENT 您可以通过使用 SoftEther VPN Client 连接到 VPN Server。 + +SW_LINK_NAME_VPNCMGRTOOLS_SHORT SoftEther VPN Client 远程管理工具 (Dev) +SW_LINK_NAME_VPNCMGRTOOLS_SHORT_UM SE-VPN Client Remote Manager (Dev User) +SW_LINK_NAME_VPNCMGRTOOLS_FULL SoftEther VPN Client 远程管理工具 Developer Edition + +SW_LINK_NAME_VPNCMGR2_FULL 管理远程电脑上的 SoftEther VPN Client +SW_LINK_NAME_VPNCMGR2_COMMENT 您可以建立一个远程连接来管理远程电脑上的 SoftEther VPN Client 。 + +SW_LINK_NAME_VPNCMGRTRAY_FULL SoftEther VPN Client Manager Developer Edition Startup +SW_LINK_NAME_VPNCMGRTRAY_COMMENT 在任务栏的通知区域注册一个 SoftEther VPN Client Developer Edition图标。 + +SW_LINK_NAME_EASYINSTALLER 简单安装工具创建工具 +SW_LINK_NAME_EASYINSTALLER_COMMENT 为公司系统管理员创建 SoftEther VPN Client 简单安装工具的工具,有自动快速启动到指定目标 VPN 连接的功能。 + +SW_LINK_NAME_WEBINSTALLER Web安装工具创建工具 +SW_LINK_NAME_WEBINSTALLER_COMMENT 为公司系统管理员创建 SoftEther VPN Client Web安装工具(ActiveX 安装工具)的工具,有自动快速启动到指定目标 VPN 连接的功能。 + + +SW_LINK_NAME_VPNCMD SoftEther VPN 命令行实用工具(vpncmd) +SW_LINK_NAME_VPNCMD_COMMENT 用 vpncmd 在命令行界面管理 SoftEther VPN Server , SoftEther VPN Bridge 端和 SoftEther VPN Client 。 +SW_LINK_NAME_TRAFFIC 网络传输速度测量工具 +SW_LINK_NAME_TRAFFIC_COMMENT 工具执行用 TCP/IP 连接的两台电脑之间的数据包传输,会用尽量大的吞吐量,从而测量出精确的网络可用传输速度。本工具不仅限于 VPN,也可以用在物理网络中。 +SW_LINK_NAME_TCP TCP/IP 优化实用工具 +SW_LINK_NAME_TCP_COMMENT TCP/IP 优化实用工具可以调节 Windows 的 TCP/IP 参数,以提高本电脑的网络通信吞吐量。 +SW_LINK_NAME_SERVICES 服务正在本电脑运行 +SW_LINK_NAME_SERVICES_COMMENT 开始,结束和配置 Windows 服务。您可以开启和关闭 SoftEther VPN 服务。 +SW_LINK_NAME_VPNSERVER_SVC_COMMENT 使用用户模式开启 SoftEther VPN Server 服务。 +SW_LINK_NAME_VPNBRIDGE_SVC_COMMENT 使用用户模式开启 SoftEther VPN Bridge 服务。 + +SW_LINK_NAME_UNINSTALL 卸载 %s +SW_LINK_NAME_UNINSTALL_COMMENT 在本电脑中卸载 %s +SW_LINK_NAME_LANGUAGE 配置显示语言 +SW_LINK_NAME_LANGUAGE_COMMENT 修改 %s 的显示语言设置。 + +SW_LINK_NAME_DEBUG 调试信息采集工具 +SW_LINK_NAME_DEBUG_COMMENT 采集 SoftEther VPN 的调试信息。仅在您的支持人员要求你这样做时使用此工具。 + + diff --git a/src/bin/hamcore/strtable_en.stb b/src/bin/hamcore/strtable_en.stb index 5dfdf53c..4c52b004 100644 --- a/src/bin/hamcore/strtable_en.stb +++ b/src/bin/hamcore/strtable_en.stb @@ -1,7305 +1,7305 @@ -# SoftEther VPN String Table -# Copyright (c) all contributors on SoftEther VPN project in GitHub. -# Copyright (c) Daiyuu Nobori, SoftEther Project at University of Tsukuba, and SoftEther Corporation. -# -# https://www.softether.org/ - - -########################################################################### -# # -# String data such as messages in software # -# (Excludes dialog box resource strings) # -# # -########################################################################### - - - -# Environment parameters -DEFAULT_FONT Tahoma -DEFAULT_FONT_WIN7 Segoe UI -DEFAULT_FONT_2 Tahoma -DEFAULT_FONT_SIZE 8 -DEFAULT_LOCALE - - $ : : $ Sun Mon Tue Wed Thu Fri Sat : : : $ (None) - - -# 言語 -# (0: 日本語, 1: 英語) -LANG 1 -LANGSTR English - -STRTABLE_ID SE_VPN_20121007 - - -# Strings for Japanese version only (not required for other language versions.) -CM_JAPANESE_ONLY_OLD_STARTUP %s\\SoftEther VPN Client 2.0 タスクトレイ.lnk - - -# Software information -PRODUCT_NAME_VPN_CLI SoftEther VPN Client Developer Edition -PRODUCT_NAME_VPN_CMGR SoftEther VPN Client Manager Developer Edition -PRODUCT_NAME_VPN_SVR SoftEther VPN Server Developer Edition -PRODUCT_NAME_VPN_BRIDGE SoftEther VPN Bridge Developer Edition -PRODUCT_NAME_VPN_SMGR SoftEther VPN Server Manager Developer Edition -PRODUCT_NAME_ELOGSVC SoftEther EtherLogger Developer Edition -PRODUCT_NAME_ELOGMGR SoftEther EtherLogger Developer Edition - -# Branding String for Limited Connection -# BRANDED_C_TO_S Branded_VPN -# BRANDED_C_FROM_S Branded_VPN - -# Client ID (sample) -# CLIENT_ID 123 - -# Family Name for Software Update Check -PRODUCT_FAMILY_NAME SoftEtherDev - -# Product information -SE_COMPANY_URL https://selinks.org/?se -SE_VPNAZURE_URL https://selinks.org/?vpnazure - -# Common strings -COMMON_UNKNOWN (Unknown) - - -# Protocol error strings -ERR_UNKNOWN An unknown error occurred. -ERR_0 No error. -ERR_1 Connection to the server failed. Check network connection and make sure that address and port number of destination server are correct. -ERR_2 Protocol error occurred. Error was returned from the destination server. -ERR_3 Connection has been disconnected. -ERR_4 Protocol error occurred. -ERR_5 A client which is non-SoftEther VPN software has connected to the port. -ERR_6 The command has been canceled by user. -ERR_7 The server denied the specified auth type. -ERR_8 The specified Virtual Hub does not exist on the server. -ERR_9 User authentication failed. -ERR_10 The specified Virtual Hub is currently stopped. Wait for a while and then reconnect. -ERR_11 The VPN session has been deleted. It is possible that either the administrator disconnected the session or the connection from the client to the VPN Server has been disconnected. -ERR_12 Access has been denied. -ERR_13 Time-out occurred during VPN session communication. It is possible the connection from the client to the VPN Server has been disconnected. -ERR_14 Protocol number is invalid. -ERR_15 There are too many TCP/IP connections. -ERR_16 There are too many sessions connected to either the destination server or Virtual Hub. -ERR_17 Connection to proxy server failed. -ERR_18 An error occurred on the proxy server. -ERR_19 User authentication failed on the proxy server. -ERR_20 There are too many sessions by the same user. Other person might be connected to the Virtual Hub as the same user. -ERR_21 A license error occurred on the VPN Server. Contact the VPN Server's administrator. -ERR_22 Cannot access the Virtual Network Adapter device driver. Check the Virtual Network Adapter is installed and make sure that it has not been disabled. -ERR_23 An internal error occurred. -ERR_24 Access to either the smart card or USB hardware token device failed. -ERR_25 The PIN code is incorrect. -ERR_26 The specified certificate is not stored on either the smart card or the USB hardware token device. -ERR_27 The specified private key is not stored on either the smart card or the USB hardware token device. -ERR_28 Write operation to the smart card or USB hardware token device failed. -ERR_29 Object not found. -ERR_30 A Virtual Network Adapter with the specified name already exists. Specify a different name. -ERR_31 Installation of the Virtual Network Adapter device driver failed. -ERR_32 You cannot use the specified name for a Virtual Network Adapter device. -ERR_33 Unsupported. -ERR_34 VPN Connection Setting with the specified name already exists. -ERR_35 The specified VPN Connection Setting is currently connected. -ERR_36 The specified VPN Connection Setting does not exist. -ERR_37 The specified VPN Connection Setting is not connected. -ERR_38 Invalid parameter. -ERR_39 Error occurred on smart card or USB hardware token. -ERR_40 Although authentication of smart card or USB hardware token was selected, but the device to be used has not been selected. Select from the Smart Card menu of Connection Manager. -ERR_41 The specified Virtual Network Adapter is being used by at least one VPN Connection Setting. \r\nEither delete the VPN Connection Setting that is using this Virtual Network Adapter or change Virtual Network Adapter that this VPN Connection Setting is using. -ERR_42 Cannot find the Virtual Network Adapter that the specified VPN Connection Setting is using. \r\nMake sure this Virtual Network Adapter exists. Also make sure the Virtual Network Adapter device has not been disabled. \r\n\r\nIf you cannot resolve the problem, either change the Virtual Network Adapter being used by this VPN Connection Setting or create a new Virtual Network Adapter with the same name. -ERR_43 The Virtual Network Adapter used by the specified VPN Connection Setting is already being used by another VPN Connection Setting. \r\nIf there is another VPN Connection Setting that is using the same Virtual Network Adapter, disconnect that VPN Connection Setting. -ERR_44 The Virtual Network Adapter being used by the specified VPN Connection Setting has been disabled. \r\nBefore using this VPN Connection Setting, enable the Virtual Network Adapter. -ERR_45 The specified value is invalid. -ERR_46 The connection destination is not a cluster controller. -ERR_47 Trying to connect. -ERR_48 Connection to the cluster controller failed. -ERR_49 The cluster controller was unable to assign a new session on a cluster. -ERR_50 Unable to manage the Virtual Hub of the cluster member server. -ERR_51 The user's password used to connect was blank so the connection from remote is prohibited. Blank password can be allowed only to connections from the VPN Server's localhost (127.0.0.1). -ERR_52 Not enough privileges. -ERR_53 Specified listener not found. -ERR_54 The listener of the specified port number already exists. -ERR_55 This is not a cluster member server. -ERR_56 The specified encryption algorithm name is not supported. -ERR_57 The Virtual Hub with the specified name already exists on the server. -ERR_58 There are too many registered Virtual Hubs. No more can be created. Delete the old Virtual Hubs. -ERR_59 The Cascade Connection with the specified name already exists. -ERR_60 A Cascade Connection cannot be created on a server on a cluster. -ERR_61 The specified Cascade Connection is offline. -ERR_62 There are too many access lists. -ERR_63 There are too many users. -ERR_64 There are too many groups. -ERR_65 The specified group does not exist. -ERR_66 The user with the specified name already exists on the Virtual Hub. -ERR_67 The group with the specified name already exists on the Virtual Hub. -ERR_68 A user with the specified name exists on the server but the type of authentication is not password authentication. Unable to change the password. -ERR_69 The user name or old password you entered is incorrect. Note that the password is case-sensitive. -ERR_70 Saitama. -ERR_71 SoftEther has temporarily stopped the current distribution by order of the Japan Ministry of Economy Trade and Industry. -ERR_72 SoftEther has temporarily stopped the current distribution by order of the IPA. -ERR_73 Unable to disconnect the Cascade Connection's session. To delete the session, stop the Cascade Connection. -ERR_74 The VPN Connection Setting for connection with the VPN Server is incomplete. At first you have to complete the VPN Connection Setting for connection with the VPN Server. -ERR_75 VPN Connection to the VPN Server has already started. -ERR_76 Not connected to the VPN Server. -ERR_77 The specified X509 certificate file does not contain a RSA 1024 bit or 2048 bit public key. SoftEther VPN software supports only RSA 1024 bit or 2048 bit certificates. -ERR_78 Unable to disconnect the SecureNAT session. To delete the session, stop the SecureNAT function. -ERR_79 Cannot enable the SecureNAT in a clustering environment. -ERR_80 The SecureNAT is not operating. -ERR_81 This VPN Connection session to the VPN Server has been disconnected by the firewall device installed by the network administrator. Contact the network administrator. -ERR_82 Unable to disconnect the Local Bridge session. To delete the session, stop the Local Bridge. -ERR_83 The Local Bridge is not operating. -ERR_84 Local Bridge cannot be used by the destination VPN Server. Refer to online help or other documentation for the setting method when using Local Bridge on the VPN Server you are using. -ERR_85 Unable to trust the certificate provided by the destination server. The setting to always verify the server certificate is enabled in the VPN Connection Settings. Either register a root certificate that can be trusted or register a individual certificate. -ERR_86 The product code of the destination server is incorrect. It is not possible to connect from this client. -ERR_87 The client and server version is different. Update the software. -ERR_88 Failed to add a capture device. A same capture device might be already registered. -ERR_89 Unable to connect to the destination server from this client. A special client software is required. -ERR_90 The specified capture device is not registered. -ERR_91 Unable to disconnect the Virtual Layer 3 Switch session. To delete the session, stop the Virtual Layer 3 Switch. -ERR_92 A Virtual Layer 3 Switch with the specified name already exists. Specify a different name. -ERR_93 Specified Virtual Layer 3 Switch not found. -ERR_94 The specified name is invalid. Check if the name contains characters that cannot be used. -ERR_95 Failed to add the Virtual Layer 3 interface. Please check that the parameters are valid. Also please make sure that the Virtual Layer 3 switch is stopped. Adding or deleting interfaces are unable when the Virtual Layer 3 switch is running. -ERR_96 Failed to delete the Virtual Layer 3 interface. Please check that the parameters are valid. Also please make sure that the Virtual Layer 3 switch is stopped. Adding or deleting interfaces are unable when the Virtual Layer 3 switch is running. -ERR_97 The Virtual Layer 3 interface that is connecting to the destination Virtual Hub of the specified Virtual Layer 3 interface already exists in the Virtual Layer 3 Switch. No more than one Virtual Layer 3 interface that connects to the same Virtual Hub can be defined in a Virtual Layer 3 Switch. -ERR_98 Failed to add routing table entry. Please check that the parameters are valid. Also please make sure that the Virtual Layer 3 switch is stopped. Adding or deleting routing table entries are unable when the Virtual Layer 3 switch is running. -ERR_99 Failed to delete routing table entry. Please check that the parameters are valid. Also please make sure that the Virtual Layer 3 switch is stopped. Adding or deleting routing table entries are unable when the Virtual Layer 3 switch is running. -ERR_100 The specified routing table entry already exists. -ERR_101 The client clock and the server clock are not synchronized with each other. Check the time settings. -ERR_102 Unable to start this Virtual Layer 3 Switch. \r\n\r\nTo start the Virtual Layer 3 Switch, at least 1 virtual interface must be defined in the Virtual Layer 3 Switch. -ERR_103 Not enough Client Connection Licenses on the destination VPN Server. Contact the server administrator. -ERR_104 Not enough Bridge Connection Licenses on the destination VPN Server. Contact the server administrator. -ERR_105 Due to current technical difficulties, the destination VPN Server is not receiving the connection. Either wait a while, or contact the VPN Server administrator requesting that the server log file be checked. -ERR_106 The destination VPN Server's certificate has expired. Contact the VPN Server's administrator. -ERR_107 A connection has beens requested in Monitoring Mode. But the security policy for the connecting user does not permit Monitoring Mode. -ERR_108 A connection has been requested in Bridge / Router Mode. But the security policy for the connecting user forbids both bridge mode and router mode. -ERR_109 A connection from a client IP address has been denied by the Source IP Restriction List of the Virtual Hub. -ERR_110 There are too many items. -ERR_111 Out of memory. -ERR_112 The specified object already exists. -ERR_113 A fatal error occurred. It is possible that the program operation is unable to continue. -ERR_114 The destination VPN Server has detected a software license violation. Connection is refused. Contact the VPN Server's administrator. -ERR_115 The destination VPN Server has connected via the Internet to an important server provided by SoftEther VPN Project and cannot validate a license. Either wait a while, or contact the VPN Server administrator requesting that the server log file and the Internet connection status of the server itself be checked. -ERR_116 A software license violation has been detected on the client side. Connection is refused. -ERR_117 The command or file name is incorrect. -ERR_118 The license key is incorrect. -ERR_119 No valid product license is registered on the VPN Server. Contact the VPN Server's administrator. -ERR_120 The product license required for the VPN Server to operate as a cluster is not registered. Contact the VPN Server's administrator. -ERR_121 This VPN Connection Setting has been installed using the "Web Installer Creation Kit" or "Simple Installer Creation Kit". The destination server is not an edition that supports the SoftEther VPN 2.0 Administration Pack. Contact the system administrator or person who created the installer. -ERR_122 With the VPN Server SDK for .NET, it is only possible to connect to the SoftEther VPN Server edition that supports the SoftEther VPN 2.0 Administration Pack. The destination VPN Server is not an edition that supports the SoftEther VPN 2.0 Administration Pack. Contact the system administrator. -ERR_123 Beta Version Software on the destination server is expired. Contact to system administrator of the server to download a new beta version or full version from http://selinks.org/. -ERR_124 The VPN connection to VPN Server is refused at server side. -ERR_125 The VPN connection to VPN Server is refused at client side. -ERR_126 The security policy enforced the VPN session to disconnect automatically because the specific time has been elapsed. If you wish to continue please re-connect. -ERR_127 The VPN Server requires the special-version VPN Client software. Consult with the administrator. -ERR_128 The number of registered user objects exceeds the maximum number which is allowed the product license applied on the VPN Server. You cannot add user objects anymore unless you delete old one, or upgrade the edition of the product. -ERR_129 The subscription contract has already expired before the release-date of this version of VPN Server. The customer has been authorized to use VPN Server's builds only in the period of the subscription contract. The customer has to extend the period of the subscription. The customer also be able to 'downgrade' the version of VPN Server to older version which has released before the end of the subscription. If you want to downgrade the version, older versions might be available on http://selinks.org/. -ERR_130 We are afraid that the trial license keys cannot be obtained frequently by the same customer. Please consider to purchase the product version. -ERR_131 Several VPN Servers on the same IP address. You can specify the destination server's private IP or hostname concretely such as "Global IP address or host name/192.168.x.x". Or if a NAT is used on the server's side, configure the NAT to open, relay or transfer appropriate ports. -ERR_132 The key for Dynamic DNS Service duplicates to others. The key will be reset automatically. -ERR_133 The specified Dynamic DNS hostname is already used. Please change the hostname. -ERR_134 The specified Dynamic DNS hostname has an invalid characters. Please change the hostname. -ERR_135 The length of the specified Dynamic DNS hostname is too long. A hostname must be equal or shorter than 31 letters. -ERR_136 The Dynamic DNS hostname is not specified. -ERR_137 The length of the specified Dynamic DNS hostname is too long. A hostname must be equal of longer than 3 letters. -ERR_138 The password of the specified user in the Virtual Hub must be reset before using MS-CHAP v2 authentication. Please ask the administrator of the VPN Server to reset the password by the VPN Server Manager or vpncmd which internal version is 4.0 or greater. Or you can change the password with VPN Client by yourself. -ERR_139 The connection to the Dynamic DNS server has been disconnected. -ERR_140 Failed to initialize the ICMP (Ping) protocol. The process of the VPN Server might be running in a normal-user privileges. In such case, run the VPN Server as a system service. (in Linux / UNIX, run it in root privileges.) -ERR_141 Failed to open the DNS port 53. Make sure that there are no other DNS server program (for example, BIND or Microsoft DNS Server) on the same computer. If there are conflicting services stop them. Or run the VPN Server's process in root privileges on Linux / UNIX/ -ERR_142 The OpenVPN Server function is not enabled. -ERR_143 The Certificate Authentication function and the External Server Authentication function have not been implemented on the open-source version of SoftEther VPN yet. Choose either Anonymous Authentication or Password Authentication instead. -ERR_144 Unacceptable operation. Use the VPN Gate Control Panel to change the VPN Gate Relay Server settings. -ERR_145 Unacceptable operation. Use the VPN Gate Utility to modify the connection setting for VPN Gate Public VPN Relay Servers. -ERR_146 The VPN Gate Service is running inside the VPN Client program. You cannot stop the VPN Gate Service on this screen. Use the VPN Client Manager to enable or disable the VPN Gate Service. -ERR_147 This feature is not supported. It hasn't been implemented yet on the open-source version of SoftEther VPN. -ERR_148 The VPN connection was disconnected because the system is being suspended. - -# Concerning licenses -LICENSE_INFO_URL https://selinks.org/?new_license -LICENSE_SUPPORT_URL https://selinks.org/?q=license_info&id=%s -LICENSE_STATUS_OK Valid -LICENSE_STATUS_EXPIRED Expired -LICENSE_STATUS_ID_DIFF Server ID Mismatch -LICENSE_STATUS_DUP Duplication -LICENSE_STATUS_INSUFFICIENT Other Licenses are Required -LICENSE_STATUS_COMPETITION Competition with Other Licenses -LICENSE_STATUS_NONSENSE Meaningless for Current Edition -LICENSE_STATUS_CPU CPU Type is Incompatible -LICENSE_STATUS_OTHERERROR Unknown Error - - -# Concerning TCP optimization -TCPOPT_NOT_SUPPORTED The TCP Optimization Utility cannot be used on this operating system. -TCPOPT_NOT_ADMIN Users without administrator privileges cannot use the TCP Optimization Utility. - - -# Windows Vista / Windows 7 / Windows 8 Optimization -VISTA_MMCSS_MSG Do you wish to optimize Windows Vista / Windows 7 / Windows 8 / Windows 10 for playing multimedia files with VPN? (e.g. videos, audios and streaming) -VISTA_MMCSS_MSG_2 Optimization for Windows Vista / Windows 7 / Windows 8 / Windows 10 with VPN has already done.\r\nDo you wish to remove optimized configuration? -VISTA_MMCSS_MSG_3 You cannot use optimization in currently environment. -VISTA_MMCSS_MSG_4 You must have administrator privileges for this function.\r\nPlease note that in Windows Vista / Windows 7 / Windows 8 / Windows 10 you should use "Run as Administrators" to execute program. -VISTA_MMCSS_MSG_5 Optimization is finished. -VISTA_MMCSS_MSG_6 Optimization configuration is removed. - - -# Concerning PKCS utility -PKCS_UTIL_TITLE PKCS#12 Writing Utility -PKCS_UTIL_SAVEDLG_TITLE Select the PKCS#12 file that you want to write to the USB token. -PKCS_UTIL_READ_ERROR Unable to read the file: %s. -PKCS_UTIL_WRITE_OK_MSG The file %s has been written to the USB hardware token. -PKCS_UTIL_DELETE_OK_MSG The PKCS#12 certificate data has been deleted from the USB hardware token. -PKCS_UTIL_SECA_FILENAME seca_p12 -PKCS_MAKE_SURE The PKCS#12 certificate data written to USB token will be deleted. \r\n Once data is deleted it cannot be restored. \r\r\n\r\r\nDo you wish to continue? -PKCS_UTIL_BAD_FILE The specified file could not be identified as a PKCS#12 file. - - -# Concerning common dialogs -DLG_ALL_FILES All Files (*.*)|*.* -DLG_CERT_FILES X509 Certificate Files (*.CER;*.CRT)|*.cer;*.crt|All Files (*.*)|*.* -DLG_KEY_FILTER Private Key Files (*.KEY;*.PEM)|*.key;*.pem|All Files (*.*)|*.* -DLG_PKCS12_FILTER PKCS#12 Files (*.P12;*.PFX)|*.p12;*.pfx|All Files (*.*)|*.* -DLG_CERT_OR_P12_FILTER X509 Certificate Files or PKCS#12 Files (*.CER;*.CRT;*.P12;*.PFX)|*.cer;*.crt;*.p12;*.pfx|X509 Certificate Files (*.CER;*.CRT)|*.cer;*.crt|PKCS#12 Files (*.P12;*.PFX)|*.p12;*.pfx|All Files (*.*)|*.* -DLG_CONFIG_FILES Setting Files (*.CONFIG)|*.config|All Files (*.*)|*.* -DLG_KEY_OR_P12_FILTER Private Key Files or PKCS#12 Files (*.KEY;*.PEM;*.P12;*.PFX)|*.key;*.pem;*.p12;*.pfx|Private Key Files (*.KEY;*.PEM)|*.key;*.pem|PKCS#12 Files (*.P12;*.PFX)|*.p12;*.pfx|All Files (*.*)|*.* -DLG_ZIP_FILER ZIP Files (*.ZIP)|*.zip|All Files (*.*)|*.* -DLG_OPEN_CERT Select the Certificate File -DLG_OPEN_KEY Select the Private Key File -DLG_OPEN_KEY_WITH_CERT Select the Corresponding Private Key file -DLG_OPEN_FILE_ERROR Unable to read the specified file: %S. -DLG_OPEN_FILE_ERROR_W Unable to read the specified file: %s. -DLG_BAD_P12 The file "%S" is not a valid PKCS#12 certificate file. -DLG_BAD_P12_W The file "%s" is not a valid PKCS#12 certificate file. -DLG_BAD_X509 The file "%S" is not a valid X509 certificate file. -DLG_BAD_X509_W The file "%s" is not a valid X509 certificate file. -DLG_BAD_KEY The file "%S" is not a valid RSA private key file. -DLG_BAD_KEY_W The file "%s" is not a valid RSA private key file. -DLG_BAD_SIGNATURE The private key does not correctly correspond with the public key contained in the specified certificate. \r\nA private key that corresponds to the certificate public key is required. -DLG_SAVE_CERT Specify a file name where you want to save the certificate -DLG_SAVE_KEY Specify a file name where you want to save the private key -DLG_SAVE_P12 Specify a file name where you want to save the certificate and private key -DLG_SAVE_FILE Specify a file name to save a file -DLG_SAVE_OPENVPN_CONFIG Specify a file name to save the ZIP file contains OpenVPN settings -DLG_CERT_SAVE_OK The certificate has been saved successfully. -DLG_CERT_SAVE_ERROR Unable to save certificate. -DLG_KEY_SAVE_OK The private key has been saved successfully. -DLG_KEY_SAVE_ERROR Unable to save private key. -DLG_KEY_PAIR_SAVE_OK The certificate and private key were saved successfully. -DLG_KEY_PAIR_SAVE_ERROR Unable to save the certificate and private key. -DLG_REBOOT_INFO The computer will restart after %u seconds. -DLG_REBOOT_INFO_2 Restarting the computer. -DLG_REBOOT_ERROR Failed to restart the computer. \r\n\r\nPlease manually restart the computer now. -DLG_SAVE_CONFIG Specify a File Name for Saving the Configuration -DLG_OPEN_CONFIG Specify the Configuration File to Import -DLG_STRING_DEFTITLE String Input -DLG_STRING_DEFINFO Enter strings. -DLG_ABOUT_LEGAL Legal Notices -DLG_ABOUT_AUTHORS List of Authors -DLG_UPDATE_DATE \ (Released on %S) -DLG_UPDATE_HINT Press OK to view the information of the latest update on the web browser.\r\n\r\nYou have to download and install updates manually. If you want to update software on the other computer you have to log in to the computer by Remote Desktop or SSH to perform the download and update. - - - -# Concerning competing processes -BAD_PROCESS_TITLE Warning concerning %S -BAD_PROCESS_MESSAGE It is possible that the software "%S" is running on this computer, which could cause problems. \r\n\r\nThere is a possibility that problems in "%S" will cause instability in VPN communication and errors. \r\n\r\nIf, by using VPN together with the software "%S" VPN becomes unstable, either stop or uninstall "%S". (Note that in some cases, because of the nature of the software, there are cases that the problems will still remain on the computer where even if you stop the software.) \r\n - - -# Concerning hardware tokens -SEC_SMART_CARD Smart Card -SEC_USB_TOKEN USB Token -SEC_INIT_MSG_1 Insert the following smart card into the smart card reader and enter the PIN code. -SEC_INIT_MSG_2 Connect the following USB token hardware to the computer's USB port and enter the PIN code. -SEC_OPENING Opening Device... -SEC_CLOSING Closing Device... -SEC_OPEN_SESSION Opening Secure Session... -SEC_CLOSE_SESSION Closing Secure Session... -SEC_LOGIN Logging in to Token... -SEC_LOGOUT Logging out from Token... -SEC_INIT_BATCH Starting Batch Process... -SEC_READ_DATA Reading Data... -SEC_WRITE_DATA Writing Data... -SEC_READ_CERT Reading Certificate... -SEC_WRITE_CERT Writing Certificate... -SEC_DELETE Deleting Object... -SEC_SIGN Processing Digital Signature by Private Key... -SEC_WRITE_KEY Writing Private Key... -SEC_ENUM Enumerating Object... -SEC_FINISHED The operation is complete. -SEC_ERROR_INVALID_ID The specified security device (device %u) is invalid. -SEC_ERROR_OPEN_DEVICE Unable to open the device %S. Make sure the device is connected to the computer. -SEC_ERROR_OPEN_DEVICEEX Unable to open the device %S. Make sure the device is connected to the computer. \r\n\r\nIf using public key infrastructure (PKI) with special client software, it is necessary to select the smart card device in PKI Utility from the Start menu beforehand. -SEC_ERROR_OPEN_SESSION Unable to start security session in device: %S. Make sure the correct device is selected. -SEC_ERROR_LOGIN The entered PIN code is incorrect. -SEC_ERROR_NOT_FOUND_1 The specified object does not exist in smart card. Make sure the correct smart card is inserted. -SEC_ERROR_NOT_FOUND_2 The specified object does not exist in USB token hardware. Make sure the correct USB token hardware is connected. -SEC_ERROR_SIGN_1 Either private key does not exist in smart card or digital signature operation failed. Make sure the correct smart card is inserted. -SEC_ERROR_SIGN_2 Either private key does not exist in USB token hardware or digital signature operation failed. Make sure the correct USB token hardware is connected. -SEC_ERROR_WRITE_1 Unable to write object to smart card. There is a possibility that there is insufficient free memory available on smart card. -SEC_ERROR_WRITE_2 Unable to write object to USB token hardware. There is a possibility that is insufficient free memory available on the USB token. -SEC_ERROR_ENUM Enumeration of object stored in token failed. -SEC_ERROR_DELETE Deletion of specified object failed. It is possible the specified object does not exist in the memory. -SEC_COLUMN1 Device Name -SEC_COLUMN2 Type -SEC_COLUMN3 Manufacturer -SEC_COLUMN4 DLL Name -SEC_INVALID_ID The specified smart card device does not exist. Select the smart card type again. -SEC_MGR_COLUMN1 Name -SEC_MGR_COLUMN2 Type -SEC_MGR_COLUMN3 Private -SEC_TYPE_DATA Data -SEC_TYPE_CERT Certificate -SEC_TYPE_KEY Private Key -SEC_TYPE_PUB Public Key -SEC_YES Yes -SEC_NO No -SEC_NONE None -SEC_IMPORT_DATA Select the data you want to import. -SEC_IMPORT_CERT Select the certificate you want to import. -SEC_IMPORT_KEY Select the private key you want to import. -SEC_READ_FAILED Reading from specified file failed. -SEC_DATA_TOO_BIG The specified data size is too big. Data larger than %u bytes cannot be written to the smart card. -SEC_OBJECT_NAME_TITLE Name of object to insert -SEC_OBJECT_NAME_INFO Specify the name of the object to be written to the new smart card. You can specify alphanumeric characters excluding double-byte and special characters for the object name. \r\n\r\nCaution: If there is an object with the same name of the same type already written on the card, that object will be overwritten. -SEC_DELETE_MSG The selected object will be deleted from the smart card. \r\nDo you really want to do this? -SEC_OBJECT_IMPORT_OK Object has been written to smart card. -SEC_OBJECT_EXPORT_OK The data read from the smart card has been saved. -SEC_NEW_CERT_IMPORT_OK The newly created certificate has been written to the smart card. -SEC_CURRENT_DEVICE Currently the device %S is selected. -SEC_CURRENT_NO_DEVICE Select which smart card device to use. -SEC_NO_SECURE_DEVICE A SoftEther VPN-compatible smart card or hardware security token device is not installed on the system. \r\n\r\nTo use a smart card or hardware token using SoftEther VPN it is necessary to install a PKCS#11-compatible device driver on Windows. In addition, it is necessary that SoftEther VPN supports the device type. \r\n\r\nMake sure a system-compatible device driver has been installed. \r\nRefer to the SoftEther VPN Project website for the list of SoftEther VPN-compatible devices. Also, it may be possible to increase the compatible devices by updating to the most recent software version. -SEC_PIN_DEVICE_OPEN_ERR Unable to connect the device "%S". Make sure the hardware is correctly connected. -SEC_PIN_CURRENT_BAD Current PIN code is incorrect. -SEC_PIN_CHANGE_FAILED Changing of PIN code failed. -SEC_PIN_OK The PIN code has been changed. - - -# TCP Connection Dialog -CONNECTDLG_CAPTION Connecting -CONNECTDLG_MESSAGE Connecting to the server "%S" (TCP port: %u)... -CONNECTDLG_CANCELING Aborting the connection. Please wait... - - -# NIC Info Dialog -NICINFO_1 Connected to the VPN Server. -NICINFO_1_1 Requesting an IP address to the DHCP server in the VPN... -NICINFO_1_2 Determining the IP address to use in the VPN... - -NICINFO_2 The VPN Connection is Established. -NICINFO_2_1 Your assigned IP address is %S. - -NICINFO_3 The VPN Connection is Established. -NICINFO_3_1 Your IP address %S is ready to use. - - -# Concerning password input dialogs during login -PW_RETRYCOUNT Automatic reconnection will be made after %u seconds with no input. -PW_LOGIN_DLG_TITLE Login -PW_TYPE_0 Anonymous Authentication -PW_TYPE_1 Standard Password Authentication -PW_TYPE_2 RADIUS or NT Domain Authentication -PW_TYPE_3 Client Certificate Authentication -PW_TYPE_4 Smart Card Authentication -PW_TYPE_5 Openssl Engine Authentication - -PW_MSG_PROXY User authentication failed on the proxy server %S. Re-enter the correct user name and password. -PW_TYPE_PROXY Proxy Server Authentication - - -# Concerning VPN connection status -STATUS_1 Initializing... -STATUS_2 Connecting to VPN Server "%S" via Proxy Server %S... -STATUS_3 Authenticating User on Proxy Server %S... -STATUS_4 Connecting to VPN Server "%S"... -STATUS_5 Verifying Server Certificate... -STATUS_6 Authenticating User... -STATUS_7 Establishing VPN Session... -STATUS_8 Connecting to VPN Server on Cluster... -STATUS_9 VPN Session has been established. - - -# Concerning certificate dialogs -CERT_NOT_FOUND Unable to find the certificate of the certificate authority who issued this certificate on the list of trusted certificates. -CERT_ROOT This certificate is a root certificate (self-signed certificate). -CERT_LV_C1 Field -CERT_LV_C2 Value -CERT_SERIAL Serial Number -CERT_ISSUER Issuer -CERT_SUBJECT Subject -CERT_NOT_BEFORE Issued at -CERT_NOT_AFTER Expires at -CERT_BITS Bits -CERT_PUBLIC_KEY Public Key -CERT_DIGEST_MD5 Digest (MD5) -CERT_DIGEST_SHA1 Digest (SHA-1) -CERT_NO_SERIAL There is no serial number -CERT_BITS_FORMAT %u bits - - -# Concerning certificate confirmation dialogs -CC_DANGEROUS_MSG The server certificate that was saved on the previous VPN connection to this server (%S) does not match the current server certificate provided by the server. \r\n\r\nDigest Value (MD5) of Previous: %S\r\nDigest Value (SHA1) of Previous: %S\r\n\r\nDigest Value (MD5) of Current: %S\r\nDigest Value (SHA1) of Current: %S\r\n\r\nIt is possible the server administrator changed the certificate on the VPN Server side. However, it is also possible a man-in-the-middle attack such as spoofing is occurring. \r\nIt is strongly recommended that you ask for clarification from the administrator of VPN Server you want to connect to. -CC_WARNING_MSG Do you want the certificate of the VPN Server you are currently connecting to be automatically trusted next time you connect to %s?\r\n\r\nDigest Value (SHA1): %S\r\nDigest Value (MD5): %S\r\n\r\nIf there is doubt regarding the authenticity of this server's certificate, contact the server's owner, by a sure and safe method, and quote the above digest value to confirm the facts. \r\n\r\nClick Yes to automatically trust this certificate if this server provides the same certificate next time you connect to it. \r\nClick No to trust the certificate for this time only and to display this warning again next time you connect to this server. \r\nClick Cancel to return to the Security Warnings window. \r\n\r\nNote: This setting can be changed on an account-by-account basis. You can make this setting in Account Properties of VPN Client Manager. - - -# Errors about Windows Versions -WINVER_TITLE Warning about Windows versions -WINVER_ERROR_FORMAT The version and Service Pack of Windows on %s is "%S".\r\n\r\nThe latest supported version and Service Pack of Windows by %s is as follows:\r\n%S\r\nBecause of the version of Windows on %s is newer than the version of Windows which %s supports, unexpected troubles or compatible issues might occur.\r\nIn order to avoid problems, we will recommend you to obtain and install the latest update of %s.\r\n(It is possible to continue using the current version without updates although that is not what we recommend.)\r\n\r\nIf you are the administrator, you can download the latest update-patch of %s from the web site http://selinks.org/?se for free.\r\n\r\nIf you are not the administrator you should notify the VPN Server's administrator of this message.\r\n\r\n----- MSG%04u%02u -----\r\n\r\n -WINVER_ERROR_VPNSERVER the VPN Server on the destination computer -WINVER_ERROR_VPNBRIDGE the VPN Bridge on the destination computer -WINVER_ERROR_VPNCLIENT the VPN Client on this local computer -WINVER_ERROR_PC_LOCAL this local computer -WINVER_ERROR_PC_REMOTE the remote server - - -# Warning for Open-source Version -OSS_MSG Welcome to the SoftEther VPN Server Academic Version!\r\n\r\n\r\nThis VPN Server is open-source free software developed as academic research at University of Tsukuba, Japan, and distributed from the SoftEther VPN Project (http://www.softether.org/), for free of charge for the public interests.\r\n\r\nSoftEther VPN software is distributed to public as a part of the joint-research contract between University of Tsukuba and SoftEther VPN Project. SoftEther VPN software is developed and published for JUST AN ACADEMIC RESEARCH PURPOSE. Therefore no support service are provided about SoftEther VPN software even if it contains bugs or vulnerabilities. A user will be liable for the result of use SoftEther VPN. The developers and publishers of SoftEther VPN will never be liable for either any consequences or damages.\r\n\r\nEnjoy using VPN with SoftEther VPN Server.\r\n\r\nFor more details of SoftEther VPN, visit http://www.softether.org/.\r\n\r\n -NATT_MSG ** Connected with NAT traversal - might be unstable **\r\n\r\nThis VPN Client is connected to the VPN Server '%S' by using the NAT Traversal (UDP Hole Punching) technology.\r\n\r\nNAT Traversal allows the VPN Server behind the NAT-box to accept VPN connections from VPN Client without any port-forwarding setting on the NAT-box.\r\n\r\nHowever, NAT Traversal-based VPN sessions sometimes become unstable, because NAT Traversal uses UDP-based protocol. For example, the VPN tunnel disconnects every 5 minutes if there is a poor NAT-box between the VPN Server and the VPN Client. Some large-scale NAT gateways in cheap ISPs sometimes cause the same problem on NAT Traversal. This is a problem of routers or ISPs. This is not a problem of SoftEther VPN software.\r\n\r\nTo solve the unstable tunnel problem, you should connect to the VPN Server's TCP listener port directly, instead of using NAT Traversal. To connect to the VPN Server directly by using TCP, a listener port of the VPN Server must be exposed to the Internet by a port-forward setting on the NAT-box. Ask the administrator of the NAT-box, or refer to the manual of the NAT-box to add a port-forwarding setting on the NAT-box.\r\n\r\nIf this message still remains despite the VPN Server is exposing a TCP port to the Internet, check the "Disable NAT-T" checkbox on the VPN Client connection setting screen.\r\n\r\n -NATT_MSG2 ** Connected with NAT traversal - might be unstable **\r\n\r\nThis VPN Client is connected to the VPN Server '%S' by using the NAT Traversal (UDP Hole Punching) technology.\r\n\r\nNAT Traversal allows the VPN Server behind the NAT-box to accept VPN connections from VPN Client without any port-forwarding setting on the NAT-box.\r\n\r\nHowever, NAT Traversal-based VPN sessions sometimes become unstable, because NAT Traversal uses UDP-based protocol. For example, the VPN tunnel disconnects every 5 minutes if there is a poor NAT-box between the VPN Server and the VPN Client. Some large-scale NAT gateways in cheap ISPs sometimes cause the same problem on NAT Traversal. This is a problem of routers or ISPs. This is not a problem of SoftEther VPN software.\r\n\r\nTo solve the unstable tunnel problem, you should connect to the VPN Server's TCP listener port directly, instead of using NAT Traversal. To connect to the VPN Server directly by using TCP, a listener port of the VPN Server must be exposed to the Internet by a port-forward setting on the NAT-box. Ask the administrator of the NAT-box, or refer to the manual of the NAT-box to add a port-forwarding setting on the NAT-box.\r\n\r\nIf this message still remains despite the VPN Server is exposing a TCP port to the Internet, check the "Disable NAT-T" checkbox on the VPN Client connection setting screen after upgrading the VPN Client to Build 9428 or later.\r\n\r\n - - - -# Virtual HUB Admin Options -HUB_AO_CLICK Select an item to view the description here. -HUB_AO_UNKNOWN The description of the item was not found. Refer to the documents, or speculate the meaning and purpose of the item from the name of the item. -HUB_AO_allow_hub_admin_change_option This is a special item. If you are enable (set to 1) this option, then not only the VPN Server's global administrator but also the Virtual Hub's administrator will be granted to modify the Virtual Hub Admin Options by himself. -HUB_AO_deny_hub_admin_change_ext_option If you are enable (set to 1) this option, the Virtual Hub's administrator will be forbidden to modify any values on the Virtual Hub Extended Options, then only the VPN Server's global administrator can modify them. -HUB_AO_no_delay_jitter_packet_loss If you set this option to non-zero value, then all parameters of delay, jitter and packet-loss on the access-list entry will be ignored even if these parameters are set when the administrator adds a new access list entry. Therefore, delay, jitter and packet-loss generating function will be virtually disabled. Because of the delay generating function sometimes make a high volume of load on the CPU and RAM, a Virtual Hub which is shared by several users should have this option enabled. -HUB_AO_max_users If you set this option to non-zero value, the maximum number of user objects registered on the Virtual Hub will be limited to this value, then greater number of user objects than this value cannot be added. -HUB_AO_max_multilogins_per_user If you set this option to non-zero value, the maximum number of VPN Sessions per an individual user object will be limited to this value, then greater number of VPN Sessions of individual user object than this value cannot be established. -HUB_AO_max_groups If you set this option to non-zero value, then the maximum number of group objects on the Virtual Hub will be limited to this value and any more groups will not be allowed to be registered. -HUB_AO_max_accesslists If you set this option to non-zero value, then the maximum number of access list entries on the Virtual Hub will be limited to this value and any more entries will not be allowed to be registered. -HUB_AO_max_sessions_client_bridge_apply Only when this value is set to non-zero value, the values max_sessions_client and max_sessions_bridge will be applied. -HUB_AO_max_sessions If you set this option to non-zero value, then the maximum number of VPN Sessions will be limited to this value. -HUB_AO_max_sessions_client If you set this option to non-zero value, then the maximum number of VPN Client sessions will be limited to this value. No more VPN Client sessions will be allowed to establish. This option is valid only when the max_sessions_client_bridge_apply option is set to non-zero value. -HUB_AO_max_sessions_bridge If you set this option to non-zero value, then the maximum number of VPN Bridge sessions will be limited to this value. No more VPN Bridge sessions will be allowed to establish. This option is valid only when the max_sessions_client_bridge_apply option is set to non-zero value. -HUB_AO_max_bitrates_download If you set this option to non-zero value, then all VPN Sessions on the Virtual Hub will be mandated to have a security policy setting which the "Download Bandwidth" value is set to this value. It will limit the downloading traffic speed of each VPN Session. For example, if this value is set to 1000000, then a downloading bandwidth of each VPN Session on the Virtual Hub will be limited to 1Mbps. -HUB_AO_max_bitrates_upload If you set this option to non-zero value, then all VPN Sessions on the Virtual Hub will be mandated to have a security policy setting which the "Download Bandwidth" value is set to this value. It will limit the uploading traffic speed of each VPN Session. For example, if this value is set to 1000000, then a uploading bandwidth of each VPN Session on the Virtual Hub will be limited to 1Mbps. -HUB_AO_deny_empty_password If you set this option to non-zero value, no user objects will be able to have an empty password. A user who has an empty password will be forbidden to connect a VPN Session. (Exception: a VPN connection from localhost will be permitted even if the password is empty.) -HUB_AO_deny_bridge If you set this option to non-zero value, then any VPN Sessions in Bridge Mode will not be granted to establish, regardless of the setting of existing security policy of the user. No one will be able to connect to the Virtual Hub for bridging purpose. -HUB_AO_deny_routing If you set this option to non-zero value, then any VPN Sessions in Routing Mode will not be granted to establish, regardless of the setting of existing security policy of the user. No one will be able to connect to the Virtual Hub for routing purpose. -HUB_AO_deny_qos If you set this option to non-zero value, then every VPN Sessions will be enforced to disable the QoS function regardless of the setting of existing security policy of the user. -HUB_AO_deny_change_user_password If you set this option to non-zero value, then any users on the Virtual Hub will be forbidden to change its password by VPN Client's password-changing function. -HUB_AO_no_change_users If you set this option to non-zero value, then the administrator of the Virtual HUB will be forbidden to add, edit or remove a user. -HUB_AO_no_change_groups If you set this option to non-zero value, then the administrator of the Virtual HUB will be forbidden to add, edit or remove a group. -HUB_AO_no_securenat If you set this option to non-zero value, then the administrator of the Virtual HUB will be forbidden to enable or disable the SecureNAT function. -HUB_AO_no_securenat_enablenat If you set this option to non-zero value, then the administrator of the Virtual HUB will be forbidden to enable or disable the Virtual NAT function in the SecureNAT function. -HUB_AO_no_securenat_enabledhcp If you set this option to non-zero value, then the administrator of the Virtual HUB will be forbidden to enable or disable the Virtual DHCP Server function in the SecureNAT function. -HUB_AO_no_cascade If you set this option to non-zero value, then the administrator of the Virtual HUB will be forbidden to add, edit, remove or change the online status of a cascade connection. -HUB_AO_no_online If you set this option to non-zero value, then the administrator of the Virtual HUB will be forbidden to change the offline Virtual Hub to the online state. -HUB_AO_no_offline If you set this option to non-zero value, then the administrator of the Virtual HUB will be forbidden to change the online Virtual Hub to the offline state. -HUB_AO_no_change_log_config If you set this option to non-zero value, then the administrator of the Virtual HUB will be forbidden to change the settings of logging function. -HUB_AO_no_disconnect_session If you set this option to non-zero value, then the administrator of the Virtual HUB will be forbidden to disconnect a specific VPN Session. -HUB_AO_no_delete_iptable If you set this option to non-zero value, then the administrator of the Virtual HUB will be forbidden to delete a specific IP address entry from the IP address table database. -HUB_AO_no_delete_mactable If you set this option to non-zero value, then the administrator of the Virtual HUB will be forbidden to delete a specific MAC address entry from the MAC address table database. -HUB_AO_no_enum_session If you set this option to non-zero value, then the administrator of the Virtual HUB will be forbidden to enumerate the sessions on the Virtual Hub. -HUB_AO_no_query_session If you set this option to non-zero value, then the administrator of the Virtual HUB will be forbidden to specify a session and get the information of the session. -HUB_AO_no_change_admin_password If you set this option to non-zero value, then the administrator of the Virtual HUB will be forbidden to change the administrator's password of the Virtual Hub. -HUB_AO_no_change_log_switch_type If you set this option to non-zero value, then the administrator of the Virtual HUB will be forbidden to change the Log Switching settings on the logging function settings of the Virtual Hub. -HUB_AO_no_change_access_list If you set this option to non-zero value, then the administrator of the Virtual HUB will be forbidden to modify the access list of the Virtual Hub. -HUB_AO_no_change_access_control_list If you set this option to non-zero value, then the administrator of the Virtual HUB will be forbidden to modify the source IP address limit list of the Virtual Hub. -HUB_AO_no_change_cert_list If you set this option to non-zero value, then the administrator of the Virtual HUB will be forbidden to modify the trusted certificate authority list of the Virtual Hub. -HUB_AO_no_change_crl_list If you set this option to non-zero value, then the administrator of the Virtual HUB will be forbidden to modify the certificate revoked list of the Virtual Hub. -HUB_AO_no_read_log_file If you set this option to non-zero value, then the administrator of the Virtual HUB will be forbidden to enumerate or download the log files of the Virtual Hub remotely. -HUB_AO_no_change_msg If you set this option to non-zero value, then the administrator of the Virtual HUB will be forbidden to change the message which should be displayed when a VPN Client connects to the Virtual Hub. -HUB_AO_no_access_list_include_file If you set this option to non-zero value, then the administrator of the Virtual HUB will be forbidden to specify "include:" or "exclude:" instruction as a source or a destination user field on a access list entry of the Virtual Hub. - - - -# Virtual Hub Extended Options -HUB_AO_NoAddressPollingIPv4 If you set this option to non-zero value, then the Virtual Hub will not perform the maintenance of the IPv4 address table and the MAC address table on the hub with using sending ARP packets per 5 seconds in order to check keep-alive IPv4 devices. As a result, IPv4 devices might be deleted on the IPv4 address table and MAC address table after a particular period (from 1 to 10 minutes) will be elapsed in the case of no-communication activities via the Virtual Hub, even if it is still alive. This option can eliminate the amount of broadcast packets, however some IPv4-related security policies will not work effectively. -HUB_AO_NoAddressPollingIPv6 If you set this option to non-zero value, then the Virtual Hub will not perform the maintenance of the IPv6 address table and the MAC address table on the hub with using sending ICMPv6 packets per 5 seconds in order to check keep-alive IPv6 devices. As a result, IPv6 devices might be deleted on the IPv6 address table and MAC address table after a particular period (from 1 to 10 minutes) will be elapsed in the case of no-communication activities via the Virtual Hub, even if it is still alive. This option can eliminate the amount of broadcast packets, however some IPv6-related security policies will not work effectively. -HUB_AO_NoIpTable If you set this option to non-zero value, then the Virtual Hub will not construct and maintain the internal IP address table. This option can eliminate the amount of CPU and RAM usages, however some IP-related security policies will not work effectively. -HUB_AO_NoMacAddressLog If you set this option to non-zero value, then any logs which indicate the registration of a new MAC address to the MAC address table on the Virtual Hub will not be logged to the security log. -HUB_AO_ManageOnlyPrivateIP If you set this option to non-zero value, then the IPv4 address table of the Virtual Hub will contain only private IPv4 addresses. In this context, the private IPv4 addresses are: 10.0.0.0/8, 172.16.0.0/12, 192.168.0.0/16 and 169.254.0.0/16. Any other IPv4 addresses will not added on the table. -HUB_AO_ManageOnlyLocalUnicastIPv6 If you set this option to non-zero value, then the IPv6 address table of the Virtual Hub will contain only local unicast IPv6 addresses. In this context, the private IPv6 addresses are: fe80::/10. Any other IPv6 addresses will not added on the table. -HUB_AO_DisableIPParsing If you set this option to non-zero value, then the Virtual Hub will disable the internal parsing function of IP headers in all Ethernet packets. This option can eliminate the amount of CPU and RAM usages, however the Vitual Hub will not perform building and maintenance of the IP address table internally, and some IP-related security policies will not work effectively. -HUB_AO_YieldAfterStorePacket If you set this option to non-zero value, then the Virtual Hub sets the CPU to idle state after store-forward processing of a packet. This might results good effects to make the delay of packets shorter, however the counts of thread context switch will be increased and the performance might decline. -HUB_AO_FilterPPPoE If you set this option to non-zero value, then the Virtual Hub discards all PPPoE (PPP over Ethernet) packets. It is convenient to split each site's PPPoE segment when making a bridge between two or more local area networks. -HUB_AO_FilterOSPF If you set this option to non-zero value, then the Virtual Hub discards all OSPF (Open Shortest Path First) packets. -HUB_AO_FilterIPv4 If you set this option to non-zero value, then the Virtual Hub discards all IPv4 and ARP packets. -HUB_AO_FilterIPv6 If you set this option to non-zero value, then the Virtual Hub discards all IPv6 packets. -HUB_AO_FilterNonIP If you set this option to non-zero value, then the Virtual Hub discards all non-IP packets (non-IPv4, ARP or IPv6 packets). Incidentally, any tagged-VLAN packets via the Virtual Hub will be regarded as non-IP packets. -HUB_AO_FilterBPDU If you set this option to non-zero value, then the Virtual Hub discards all BPDU (Bridge Protocol Data Unit) packets. -HUB_AO_NoIPv6DefaultRouterInRAWhenIPv6 If you set this option to non-zero value, then all VPN Sessions on the Virtual Hub will have the enabled "No Default-Router on IPv6 RA (physical IPv6)" security policy. When the physical communication protocol between VPN Client / VPN Bridge and VPN Server is IPv6, any IPv6 RA (Router Advertisement) packet with non-zero value in the router-lifetime will set to zero-value. This is effective to avoid the horrible behavior from the IPv6 routing confusion which is caused by the VPN client's attempts to use the remote-side IPv6 router as its local IPv6 router. -HUB_AO_NoLookBPDUBridgeId If you set this option to non-zero value, then the Virtual Hub will ignore the source MAC field in a BPDU (Bridge Protocol Data Unit) packet. This value will be much more advanced. Do not modify it unless you are very ultra special expert of computer networking. -HUB_AO_NoManageVlanId If you set this option to non-zero value, then the Virtual Hub will not use VLAN ID on the MAC address table. Any VLAN ID in tagged-VLAN packets will be ignored. -HUB_AO_VlanTypeId Specify the Ethernet Type ID (TPID) of VLAN tags in decimal. The default value is 33024 (0x8100 in hex). This value will be much more advanced. Do not modify it unless you are very ultra special expert of computer networking. -HUB_AO_FixForDLinkBPDU If you set this option to non-zero value, then the FixForDLinkBPDU option will be enabled. This value will be much more advanced. Do not modify it unless you are very ultra special expert of computer networking. -HUB_AO_NoIPv4PacketLog If you set this option to non-zero value, then IPv4 packets via the Virtual Hub will not be logged. -HUB_AO_NoIPv6PacketLog If you set this option to non-zero value, then IPv6 packets via the Virtual Hub will not be logged. -HUB_AO_NoSpinLockForPacketDelay If you set this option to non-zero value, then the VPN Server will not use spin-lock mechanisms to simulate the delay of packets when the packet-delay generating function is applied to the packet. Instead, the timer interrupt by the operating system will be adopted. It will reduce the CPU time, however the resolution of generating delays will deteriorate. -HUB_AO_BroadcastStormDetectionThreshold Specify the threshold to detect the broadcast storm per a second. When the number of broadcast packets from a particular VPN Session exceeded this threshold, packets will be regarded as broadcast storm and become subjects to be filtered. The default value (zero-value) is 32. -HUB_AO_ClientMinimumRequiredBuild If you set this option to non-zero value, then the Virtual Hub will deny any access from VPN Client which has less build number than this value. -HUB_AO_RequiredClientId If you set this option to non-zero value, then the Virtual Hub will deny any access from VPN Client which doesn't have the embedded "Client ID" value in the software. -HUB_AO_AdjustTcpMssValue If you set this option to non-zero value, then the Virtual Hub will adjust MSS (Max Segment Size) values of headers of all TCP/IP packets not to exceed this value. -HUB_AO_DisableAdjustTcpMss If you set this option to non-zero value, then any MSS (Max Segment Size) options on the Virtual Hub will be disabled. Even if the AdjustTcpMssValue option is specified, or a VPN Session is made by IPsec / L2TP / EtherIP / L2TPv3 Server Function, the adjustment of MSS will be disabled. -HUB_AO_NoDhcpPacketLogOutsideHub If you set this option to non-zero value, then the Virtual Hub will not record non-related DHCP packets to the packet log. "Non-related DHCP packets" are DHCP packets which are not bound to any VPN Session on the Virtual Hub. -HUB_AO_DisableHttpParsing If you set this option to non-zero value, then the Virtual Hub will not perform parsing HTTP headers in all HTTP packets. It will reduce the usage of CPU and RAM, however the HTTP access logs will not be recorded. -HUB_AO_DisableUdpAcceleration If you set this option to non-zero value, then all UDP Acceleration Function will be disabled on the all VPN Sessions of the Virtual Hub. -HUB_AO_DisableUdpFilterForLocalBridgeNic If you set this option to non-zero value, then the Virtual Hub disables the trouble-preventing filtering function to filter DHCP packets which might causes of network unstable. By default, a local bridge interface sometimes try to acquire an IP address from remote-side DHCP server, however such a behavior should infinite loop in the routing table. The filtering function can avoid such problems. This option can disable the filtering function. -HUB_AO_ApplyIPv4AccessListOnArpPacket If you set this option to non-zero value, then the IPv4 access list entries will be applied on not only IPv4 packets but also ARP packets. It is convenient to filter unnecessary ARP packets which might cause troubles. -HUB_AO_RemoveDefGwOnDhcpForLocalhost If you set this option to non-zero value, when a VPN Client on the localhost connects to the Virtual Hub and try to acquire an IP address from the DHCP Server in the segment of the Virtual Hub, corresponding DHCP reply packets will be discarded. It can prevent unexpected infinite loop of packets routing. -HUB_AO_SecureNAT_MaxTcpSessionsPerIp If you set this option to non-zero value, then the number of TCP connections (which is not SYN_SENT) per IP state will be limited to this value. -HUB_AO_SecureNAT_MaxTcpSynSentPerIp If you set this option to non-zero value, then the number of TCP connections (which is SYN_SENT) per IP state will be limited to this value. -HUB_AO_SecureNAT_MaxUdpSessionsPerIp If you set this option to non-zero value, then the number of UDP sessions per IP state will be limited to this value. -HUB_AO_SecureNAT_MaxDnsSessionsPerIp If you set this option to non-zero value, then the number of DNS sessions per IP which is not SYN_SENT state will be limited to this value. -HUB_AO_SecureNAT_MaxIcmpSessionsPerIp If you set this option to non-zero value, then the number of ICMP sessions per IP which is not SYN_SENT state will be limited to this value. -HUB_AO_AccessListIncludeFileCacheLifetime Specify a period in seconds to hold the cache of external user-list files which is for an access list entry which has "include:" or "exclude:" formats as its username. -HUB_AO_DisableKernelModeSecureNAT If you set this option to non-zero value, then the Kernel-mode NAT function on the SecureNAT function will be disabled. Kernel-mode NAT is a function to accelerate the performance of the Virtual NAT function on SecureNAT. Kernel-mode NAT can work only when the VPN Server process is running with system privileges (i.e. root, SYSTEM or Administrators contexts.). If the Kernel-mode NAT causes something wrong operations, use this option to disable it. -HUB_AO_DisableUserModeSecureNAT If you set this option to non-zero value, then the User-mode NAT function on the SecureNAT function will be disabled. User-mode NAT is a function to make the NAT possible to run as normal-user privileges. -HUB_AO_DisableCheckMacOnLocalBridge If you set this option to non-zero value, the MAC address duplication check will be disabled on the Local Bridge function. There might be a case when some network adapters has a problem that reflects outgoing packets towards the Virtual Hub. A Virtual HUB detects such duplications automatically, and discards them. Enable this flag to disable the detection and discarding. -HUB_AO_DisableCorrectIpOffloadChecksum If you set this option to non-zero value, then the checking and correction of IP check-sum value on the Local Bridge function. Some network adapters, which have IP, TCP or UDP header check-sum offloading engines, transmit packets with incomplete check-sum values. Such packets cannot be treated correctly by receiver-side. So the Local Bridge detects such packets and corrects its check-sum fields. Enable this flag to disable such correction. -HUB_AO_BroadcastLimiterStrictMode If you set this option to non-zero value, then the broadcast-storm detection algorithm will compare either source or destination IP address of each packet. If any of the two fields matches, the packet will be recorded on the short-term history of broadcast-storm detection state machine. -HUB_AO_MaxLoggedPacketsPerMinute Maximum number of logging target packets per minute. -HUB_AO_DoNotSaveHeavySecurityLogs Do not take heavy security log. -HUB_AO_DropBroadcastsInPrivacyFilterMode Drop broadcasting packets if the both source and destination session is PrivacyFilter mode. -HUB_AO_DropArpInPrivacyFilterMode Drop ARP packets if the both source and destination session is PrivacyFilter mode. -HUB_AO_SuppressClientUpdateNotification Suppress the update notification screen on the VPN Client. -HUB_AO_FloodingSendQueueBufferQuota Specify the quota limitation value (in bytes) of the sending queue buffer size which the flooding operation on the Virtual Hub can consume. The quota value is applied on the total length of sending queues of all active VPN sessions. Specify '0' to disable the quota. This option is effective to solve the out-of-memory problem on the network where there are many flooding packets. -HUB_AO_AssignVLanIdByRadiusAttribute Enable the VLAN ID dynamic assignment function. Each VPN session will be assigned its own VLAN ID by the RADIUS attribute value when the user is authenticated by the external RADIUS server unless the user object has a VLAN ID security policy. The RADIUS attribute with the name "Tunnel-Pvt-Group-ID" (ID = 81) will be used as the VLAN ID. The data type must be STRING. -HUB_AO_DenyAllRadiusLoginWithNoVlanAssign If you set this option to non-zero value, then all users, which RADIUS server returns no "Tunnel-Pvt-Group-ID" (ID = 81) value, will be denied to connect to the Virtual Hub. (Only if the values of AssignVLanIdByRadiusAttribute is non-zero value.) -HUB_AO_SecureNAT_RandomizeAssignIp If you set this option to non-zero value, then the Virtual DHCP Server of the SecureNAT function will choose an unused IP address randomly from the DHCP pool while the default behavior is to choose the first unused IP address. -HUB_AO_DetectDormantSessionInterval If you set this option to non-zero value, then the Virtual Hub will treat the VPN sessions, which have transmitted no packets for the last specified intervals (in seconds), as Dormant Sessions. The Virtual Hub will not flood packets, which should be flood, to any Dormant Sessions. -HUB_AO_NoPhysicalIPOnPacketLog If you set this option to non-zero value, then the physical IP addresses of VPN clients of either the source VPN session or the destination VPN session will not be recorded on the packet log file. -HUB_AO_UseHubNameAsDhcpUserClassOption If you set this option to non-zero value, then the Virtual Hub Name will be added to a DHCP request to an external DHCP server as the "User-Class" option. This allows to use separate pools of IP addresses for each Virtual Hub. (For only L2TP/IPsec and OpenVPN sessions.) -HUB_AO_UseHubNameAsRadiusNasId If you set this option to non-zero value, then the NAS-Identifier RADIUS attribute will be set to a name of the Virtual Hub. This allows to determine on RADIUS server whether access to the Virtual Hub should be granted or denied. - - -# Concerning failed connection dialogs -ERRDLG_ERRMSG Error (Error Code %u):\r\n%s\r\n -ERRDLG_RETRYCOUNT An automatic reconnection will be made after %u seconds... -ERRDLG_INFORMATION Click Retry to start connecting again. -ERRDLG_RETRY_INFO_1 Do you wish to retry? (%u retries / %u total retries) -ERRDLG_RETRY_INFO_2 Do you wish to retry? (%u retries / total infinite retries) -ERRDLG_DISCONNECTED_MSG Connection to VPN Server "%S" has been disconnected. -ERRDLG_DEVICE_ERROR The connection with the VPN Server has been disconnected because the Virtual Network Adapter (device name: %S) has been stopped. \r\n\r\nError code %u: %s - - -# Concerning protocols -PROTO_DIRECT_TCP Direct TCP/IP Connection -PROTO_HTTP_PROXY Connection via HTTP Proxy -PROTO_SOCKS_PROXY Connection via SOCKS4 Proxy -PROTO_SOCKS5_PROXY Connection via SOCKS5 Proxy -PROTO_SSH Connection via SSH Server -PROTO_UNKNOWN Unknown Protocol - - -# Concerning caps -# (Control characters) -CAPS_YES Yes -CAPS_NO No -# (Title) -CT_i_max_packet_size Maximum Ethernet Packet Size -CT_i_max_hubs Maximum Virtual Hubs -CT_i_max_user_creation Maximum Users on Entire VPN Server -CT_i_max_sessions Maximum Total Sessions -CT_i_max_clients Maximum Client Sessions -CT_i_max_bridges Maximum Bridge Sessions -CT_i_max_users_per_hub Maximum Users per Virtual Hub -CT_i_max_groups_per_hub Maximum Groups per Virtual Hub -CT_i_max_access_lists Maximum Access Lists per Virtual Hub -CT_i_max_mac_tables Maximum MAC Address Entries per Virtual Hub -CT_i_max_ip_tables Maximum IP Address Entries per Virtual Hub -CT_i_max_secnat_tables Maximum SecureNAT Entries per Virtual Hub -CT_i_max_l3_sw Maximum Virtual Layer 3 Switches -CT_i_max_l3_if Maximum Virtual Interfaces per Layer 3 Switch -CT_i_max_l3_table Maximum Routing Tables per Layer 3 Switch -CT_b_bridge Works as VPN Bridge Software -CT_b_standalone Standalone Mode -CT_b_cluster_controller Cluster Controller Mode -CT_b_cluster_member Cluster Member Mode -CT_b_vpn_client_connect Accepting Connection from VPN Client / Bridge -CT_b_local_bridge Local Bridge is Supported -CT_b_must_install_pcap Packet Capture Driver is Not Installed -CT_b_tap_supported Tun/Tap Device is Supported (only in Linux) -CT_b_support_config_hub Changing Virtual Hub Settings is Supported -CT_b_support_securenat SecureNAT is Supported -CT_b_virtual_nat_disabled Virtual NAT is Disabled (only DHCP Enabled) -CT_b_support_cascade Cascade Connection is Supported -CT_b_support_cascade_cert Server Authentication for Cascade Connection is Supported -CT_b_support_config_log Changing Settings for Saving Log is Supported -CT_b_support_autodelete Automatic Deletion of Log Files is Supported -CT_b_support_radius External Authentication Server is Supported -CT_b_support_config_rw Remote Reading and Writing of Config File is Supported -CT_b_support_hub_admin_option Virtual Hub Administration Options is Supported -CT_b_support_cascade_client_cert Client Certificates for Cascade Connection is Supported -CT_b_support_hide_hub Virtual Hub Enumeration Setting is Supported -CT_b_support_cluster_admin Integrated Administration for All Cluster Nodes is Supported -CT_b_support_cluster Operation as Part of a Cluster is Supported -CT_b_support_cluster_controller Operating as a Cluster Controller -CT_b_support_layer3 The Virtual Layer 3 Switch is Supported -CT_b_support_crl Virtual Hub-Specific Certificate Revocation Lists is Supported -CT_b_support_ac Virtual Hub-Specific Source IP Address Limit Lists is Supported -CT_b_support_read_log Downloading of Log Files is Supported -CT_b_support_rename_cascade Renaming of Cascade Connection is Supported -CT_b_support_license Management of Licenses is Supported -CT_b_support_limit_multilogin Limits for Multiple Login by Same User is Supported -CT_b_support_qos VoIP / QoS Functions is Supported -CT_b_support_syslog Syslog Sending Functions is Supported -CT_b_cluster_hub_type_fixed The Virtual Hub Types in a Cluster are Fixed -CT_b_beta_version Beta Version (Pre-release build) -CT_b_support_check_mac Specifing MAC Address in Access Lists is Supported -CT_b_support_check_tcp_state Checking TCP Connection State Filtering is Supported -CT_b_support_network_connection_name Getting Network Friendly Name is Supported - -CT_b_support_radius_retry_interval_and_several_servers Retry Interval and Multi server is Supported in RADIUS Auth -CT_b_support_vlan Tagged VLAN ID is Supported in MAC Address Table -CT_b_support_hub_ext_options Virtual Hub Extended Option is Supported -CT_b_support_policy_ver_3 Security Policy version 3 is Supported -CT_b_support_ipv6_acl IPv6 Access List is Supported -CT_b_support_ex_acl Delay, Jitter and Packet Loss is Supported in Access List -CT_b_support_acl_group Conditioning by Group name is Supported in Access List -CT_b_support_ipv6_ac IPv6 IP Access Control Lists is Supported -CT_b_support_eth_vlan Tagged VLAN Packet Transparency Support tool is Supported -CT_b_support_msg Message of Today function is Supported -CT_b_vpn3 Internal Version 3.0 functions are Supported -CT_b_vpn4 Internal Version 4.0 functions are Supported -CT_b_support_ipsec IPsec / L2TP / EtherIP / L2TPv3 Server Functions are Supported -CT_b_support_sstp MS-SSTP VPN Server Function is Supported -CT_b_support_udp_acceleration UDP Acceleration Function is Supported -CT_b_support_openvpn OpenVPN Server Function is Supported -CT_b_support_ddns Dynamic DNS Client Function is Supported -CT_b_support_ddns_proxy DDNS via Proxy Server is Supported -CT_b_support_special_listener VPN over ICMP and VPN over DNS is Supported -CT_b_support_redirect_url_acl HTTP URL Redirection in Access List is Supported -CT_b_is_in_vm Running on VM (Virtual Machine) -CT_b_support_azure VPN Azure is Supported -CT_b_support_aes_ni CPU AES Acceleration (AES-NI) is Active -CT_b_using_selow_driver SoftEther Lightweight Kernel-mode Ethernet Driver is Active -CT_b_support_vgs VPN Gate Service Server Functions are Supported -CT_b_support_vgs_in_client VPN Gate Service Server Functions (VPN Client integrated) -CT_b_is_softether Either Free or Open-Source Version of SoftEther VPN -CT_b_suppport_push_route Static Routing Table Pushing Function -CT_b_suppport_push_route_config Static Routing Table Pushing Function (Configurable) - -# Concerning policies -POL_TITLE_STR Policy Name -POL_VALUE_STR Current Value -POL_TYPE_BOOL ON / OFF -POL_TYPE_INT Integer -POL_BOOL_ENABLE Enabled -POL_BOOL_DISABLE - -POL_BOOL_DISABLE_EX - -POL_INT_ZERO - -POL_INT_COUNT %u -POL_INT_SEC %u seconds -POL_INT_BPS %u bps -POL_INT_VLAN %u - -# Ver 2.0 -POL_0 Allow Access -POL_EX_0 The users defined this policy have permission to make VPN connection to VPN Server. -POL_1 Filter DHCP Packets (IPv4) -POL_EX_1 All IPv4 DHCP packets in sessions defined this policy will be filtered. -POL_2 Disallow DHCP Server Operation (IPv4) -POL_EX_2 Computers connected to sessions that have this policy setting will not be allowed to become a DHCP server and distribute IPv4 addresses to DHCP clients. -POL_3 Enforce DHCP Allocated IP Addresses (IPv4) -POL_EX_3 Computers in sessions that have this policy setting will only be able to use IPv4 addresses allocated by a DHCP server on the virtual network side. -POL_4 Deny Bridge Operation -POL_EX_4 Bridge-mode connections are denied for user sessions that have this policy setting. Even in cases when the Ethernet Bridge is configured in the client side, communication will not be possible. -POL_5 Deny Routing Operation (IPv4) -POL_EX_5 IPv4 routing will be denied for sessions that have this policy setting. Even in the case where the IP router is operating on the user client side, communication will not be possible. -POL_6 Deny MAC Addresses Duplication -POL_EX_6 The use of duplicating MAC addresses that are in use by computers of different sessions cannot be used by sessions with this policy setting. -POL_7 Deny IP Address Duplication (IPv4) -POL_EX_7 The use of duplicating IPv4 addresses that are in use by computers of different sessions cannot be used by sessions with this policy setting. -POL_8 Deny Non-ARP / Non-DHCP / Non-ICMPv6 broadcasts -POL_EX_8 The sending or receiving of broadcast packets that are not ARP protocol, DHCP protocol, nor ICMPv6 on the virtual network will not be allowed for sessions with this policy setting. -POL_9 Privacy Filter Mode -POL_EX_9 All direct communication between sessions with the privacy filter mode policy setting will be filtered. -POL_10 Deny Operation as TCP/IP Server (IPv4) -POL_EX_10 Computers of sessions with this policy setting can't listen and accept TCP/IP connections in IPv4. -POL_11 Unlimited Number of Broadcasts -POL_EX_11 If a computer of a session with this policy setting sends broadcast packets of a number unusually larger than what would be considered normal on the virtual network, there will be no automatic limiting. -POL_12 Allow Monitoring Mode -POL_EX_12 Users with this policy setting will be granted to connect to the Virtual Hub in Monitoring Mode. Sessions in Monitoring Mode are able to monitor (tap) all packets flowing through the Virtual Hub. -POL_13 Maximum Number of TCP Connections -POL_EX_13 For sessions with this policy setting, this sets the maximum number of physical TCP connections consists in a physical VPN session. -POL_14 Time-out Period -POL_EX_14 For sessions with this policy setting, this sets, in seconds, the time-out period to wait before disconnecting a session when communication trouble occurs between the VPN Client / VPN Server. -POL_15 Maximum Number of MAC Addresses -POL_EX_15 For sessions with this policy setting, this limits the number of MAC addresses per session. -POL_16 Maximum Number of IP Addresses (IPv4) -POL_EX_16 For sessions with this policy setting, this specifies the number of IPv4 addresses that can be registered for a single session. -POL_17 Upload Bandwidth -POL_EX_17 For sessions with this policy setting, this limits the traffic bandwidth that is in the inwards direction from outside to inside the Virtual Hub. -POL_18 Download Bandwidth -POL_EX_18 For sessions with this policy setting, this limits the traffic bandwidth that is in the outwards direction from inside the Virtual Hub to outside the Virtual Hub. -POL_19 Deny Changing Password -POL_EX_19 The users which use password authentication with this policy setting are not allowed to change their own password from the VPN Client Manager or similar. -POL_20 Maximum Number of Multiple Logins -POL_EX_20 Users with this policy setting are unable to have more than this number of concurrent logins. Bridge Mode sessions are not subjects to this policy. This security policy is only available on VPN Server 3.0 or greater, or VPN Server 2.0 with the multi-login restriction function. -POL_21 Deny VoIP / QoS Function -POL_EX_21 Users with this security policy are unable to use VoIP / QoS functions in VPN connection sessions. This security policy is only available on VPN Server 3.0 or greater, or VPN Server 2.0 with the VoIP / QoS functions. - -# Ver 3.0 -POL_22 Filter RS / RA Packets (IPv6) -POL_EX_22 All ICMPv6 packets which the message-type is 133 (Router Solicitation) or 134 (Router Advertisement) in sessions defined this policy will be filtered. As a result, an IPv6 client will be unable to use IPv6 address prefix auto detection and IPv6 default gateway auto detection. -POL_23 Filter RA Packets (IPv6) -POL_EX_23 All ICMPv6 packets which the message-type is 134 (Router Advertisement) in sessions defined this policy will be filtered. As a result, a malicious users will be unable to spread illegal IPv6 prefix or default gateway advertisements on the network. -POL_24 Filter DHCP Packets (IPv6) -POL_EX_24 All IPv6 DHCP packets in sessions defined this policy will be filtered. -POL_25 Disallow DHCP Server Operation (IPv6) -POL_EX_25 Computers connected to sessions that have this policy setting will not be allowed to become a DHCP server and distribute IPv6 addresses to DHCP clients. -POL_26 Deny Routing Operation (IPv6) -POL_EX_26 IPv6 routing will be denied for sessions that have this policy setting. Even in the case where the IP router is operating on the user client side, communication will not be possible. -POL_27 Deny IP Address Duplication (IPv6) -POL_EX_27 The use of duplicating IPv6 addresses that are in use by computers of different sessions cannot be used by sessions with this policy setting. -POL_28 Deny Operation as TCP/IP Server (IPv6) -POL_EX_28 Computers of sessions with this policy setting can't listen and accept TCP/IP connections in IPv6. -POL_29 Maximum Number of IP Addresses (IPv6) -POL_EX_29 For sessions with this policy setting, this specifies the number of IPv6 addresses that can be registered for a single session. -POL_30 Disallow Password Save in VPN Client -POL_EX_30 For users with this policy setting, when the user is using *standard* password authentication, the user will be unable to save the password in VPN Client. The user will be required to input passwords for every time to connect a VPN. This will improve the security. If this policy is enabled, VPN Client Version 2.0 will be denied to access. -POL_31 VPN Client Automatic Disconnect -POL_EX_31 For users with this policy setting, a user's VPN session will be disconnected automatically after the specific period will elapse. In this case no automatic re-connection will be performed. This can prevent a lot of inactive VPN Sessions. If this policy is enabled, VPN Client Version 2.0 will be denied to access. -POL_32 Filter All IPv4 Packets -POL_EX_32 All IPv4 and ARP packets in sessions defined this policy will be filtered. -POL_33 Filter All IPv6 Packets -POL_EX_33 All IPv6 packets in sessions defined this policy will be filtered. -POL_34 Filter All Non-IP Packets -POL_EX_34 All non-IP packets in sessions defined this policy will be filtered. "Non-IP packet" mean a packet which is not IPv4, ARP nor IPv6. Any tagged-VLAN packets via the Virtual Hub will be regarded as non-IP packets. -POL_35 No Default-Router on IPv6 RA -POL_EX_35 In all VPN Sessions defines this policy, any IPv6 RA (Router Advertisement) packet with non-zero value in the router-lifetime will set to zero-value. This is effective to avoid the horrible behavior from the IPv6 routing confusion which is caused by the VPN client's attempts to use the remote-side IPv6 router as its local IPv6 router. -POL_36 No Default-Router on IPv6 RA (physical IPv6) -POL_EX_36 In all VPN Sessions defines this policy (only when the physical communication protocol between VPN Client / VPN Bridge and VPN Server is IPv6), any IPv6 RA (Router Advertisement) packet with non-zero value in the router-lifetime will set to zero-value. This is effective to avoid the horrible behavior from the IPv6 routing confusion which is caused by the VPN client's attempts to use the remote-side IPv6 router as its local IPv6 router. -POL_37 VLAN ID (IEEE802.1Q) -POL_EX_37 You can specify the VLAN ID on the security policy. All VPN Sessions defines this policy, all Ethernet packets toward the Virtual Hub from the user will be inserted a VLAN tag (IEEE 802.1Q) with the VLAN ID. The user can also receive only packets with a VLAN tag which has the same VLAN ID. (Receiving process removes the VLAN tag automatically.) Any Ethernet packets with any other VLAN IDs or non-VLAN packets will not be received. All VPN Sessions without this policy definition can send / receive any kinds of Ethernet packets regardless of VLAN tags, and VLAN tags are not inserted or removed automatically. Any tagged-VLAN packets via the Virtual Hub will be regarded as non-IP packets. Therefore, tagged-VLAN packets are not subjects for IPv4 / IPv6 security policies, access lists nor other IPv4 / IPv6 specific deep processing. - - -# Concerning remote connection dialog -REMOTE_DEF_CAPTION Remote Connection -REMOTE_DEF_TITLE Specify the computer you want to remotely connect to. - - -# Concerning client notification service -CN_TITLE SoftEther VPN Client Developer Edition - - -# Concerning Connection Manager -CM_TITLE SoftEther VPN Client Developer Edition Manager -CM_PW_LOCALMACHINE Local Computer -CM_NO_REMOTE The VPN Client service running on %s disallows remote connections. -CM_CONNECT_FAILED Unable to connect to the VPN Client service operating on %s. \r\nMake sure the VPN Client service has started and is running normally. -CM_BAD_PASSWORD The password is incorrect. Re-enter password. The password is case-sensitive so be sure to discern between upper and lower case letters. -CM_NUM_CONN_COUNT %u VPN Sessions -CM_CONN_NO Not Connected -CM_PRODUCT_NAME SoftEther VPN Client Build %u -CM_ACCOUNT_COLUMN_1 VPN Connection Setting Name -CM_ACCOUNT_COLUMN_2 Status -CM_ACCOUNT_COLUMN_3 VPN Server Hostname -CM_ACCOUNT_COLUMN_3_2 Virtual Hub -CM_ACCOUNT_COLUMN_4 Virtual Network Adapter Name -CM_VLAN_COLUMN_1 Virtual Network Adapter Name -CM_VLAN_COLUMN_2 Status -CM_VLAN_COLUMN_3 MAC Address -CM_VLAN_COLUMN_4 Version -CM_ACCOUNT_OFFLINE Offline -CM_ACCOUNT_ONLINE Connected -CM_ACCOUNT_CONNECTING Connecting -CM_VLAN_ENABLED Enabled -CM_VLAN_DISABLED Disabled -CM_DELETE_ACCOUNT_MSG This will delete the VPN Connection Setting "%s". Do you really want to do this? -CM_ST_ACCOUNT_NAME VPN Connection Setting Name -CM_ST_CONNECTED Session Status -CM_ST_CONNECTED_TRUE Connection Completed (Session Established) -CM_ST_CONNECTED_FALSE Trying to Connect -CM_ST_CONNECTING Connection to VPN Server Started -CM_ST_NEGOTIATION Negotiating -CM_ST_AUTH Authenticating User -CM_ST_ESTABLISHED Connection is Established -CM_ST_RETRY Retrying -CM_ST_IDLE Idle -CM_ST_SERVER_NAME Server Name -CM_ST_SERVER_PORT Port Number -CM_ST_PORT_TCP TCP Port %u -CM_ST_SERVER_P_NAME Server Product Name -CM_ST_SERVER_P_VER Server Version -CM_ST_SERVER_P_BUILD Server Build -CM_ST_START_TIME Connection Started at -CM_ST_FIRST_ESTAB_TIME First Session has been Established since -CM_ST_NONE - -CM_ST_CURR_ESTAB_TIME Current Session has been Established since -CM_ST_NUM_ESTABLISHED Number of Established Sessions -CM_ST_NUM_STR %u Times -CM_ST_HALF_CONNECTION Half Duplex TCP Connection Mode -CM_ST_HALF_TRUE Yes (Half Duplex Mode) -CM_ST_HALF_FALSE No (Full Duplex Mode) -CM_ST_QOS VoIP / QoS Function -CM_ST_QOS_TRUE Enabled -CM_ST_QOS_FALSE Disabled -CM_ST_NUM_TCP Number of TCP Connections -CM_ST_NUM_TCP_UPLOAD Number of Uplink TCP Connections -CM_ST_NUM_TCP_DOWNLOAD Number of Downlink TCP Connections -CM_ST_MAX_TCP Maximum Number of TCP Connections -CM_ST_VLAN_ID VLAN ID -CM_ST_NO_VLAN - -CM_ST_USE_ENCRYPT Encryption -CM_ST_USE_ENCRYPT_TRUE Enabled (Algorithm: %S) -CM_ST_USE_ENCRYPT_TRUE2 Enabled -CM_ST_USE_ENCRYPT_FALSE Disabled (No Encryption) -CM_ST_USE_COMPRESS Use of Compression -CM_ST_UDP_ACCEL_ENABLED UDP Acceleration is Supported -CM_ST_UDP_ACCEL_USING UDP Acceleration is Active -CM_ST_RUDP TCP over UDP (NAT Traversal) -CM_ST_UNDERLAY_PROTOCOL Physical Underlay Protocol -CM_ST_COMPRESS_TRUE Yes (%u %%) -CM_ST_COMPRESS_FALSE No (No Compression) -CM_ST_SESSION_NAME Session Name -CM_ST_CONNECTION_NAME Connection Name -CM_ST_SESSION_KEY Session Key (160 bit) -CM_ST_BRIDGE_MODE Bridge / Router Mode -CM_ST_MONITOR_MODE Monitoring Mode -CM_ST_YES Yes -CM_ST_NO No -CM_ST_SEND_SIZE Outgoing Data Size -CM_ST_RECV_SIZE Incoming Data Size - -CM_ST_SEND_UCAST_NUM Outgoing Unicast Packets -CM_ST_SEND_UCAST_SIZE Outgoing Unicast Total Size -CM_ST_SEND_BCAST_NUM Outgoing Broadcast Packets -CM_ST_SEND_BCAST_SIZE Outgoing Broadcast Total Size - -CM_ST_RECV_UCAST_NUM Incoming Unicast Packets -CM_ST_RECV_UCAST_SIZE Incoming Unicast Total Size -CM_ST_RECV_BCAST_NUM Incoming Broadcast Packets -CM_ST_RECV_BCAST_SIZE Incoming Broadcast Total Size - -CM_ST_NUM_PACKET_STR %S packets -CM_ST_SIZE_BYTE_STR %S bytes - -CM_NEW_ICON Add VPN Connection -CM_VGC_ICON VPN Gate Public VPN Relay Servers -CM_VGC_LINK VPN Gate Academic Web Site -CM_ST_TITLE Connection Status of %s -CM_ST_COLUMN_1 Item -CM_ST_COLUMN_2 Status -CM_NEW_ACCOUNT_NAME_1 New VPN Connection -CM_NEW_ACCOUNT_NAME_2 New VPN Connection (%u) -CM_ACCOUNT_TITLE_1 New VPN Connection Setting Properties -CM_ACCOUNT_TITLE_2 Properties of %s -CM_SERVER_CERT_1 &Specify Individual Cert -CM_SERVER_CERT_2 &Delete Certificate -CM_CLIENT_CERT_1 Specify Client &Certificate -CM_CLIENT_CERT_2 Delete &Client Certificate -CM_CERT_INFO Issued to: %s\r\nIssuer: %s\r\nExpiration: %s -CM_NO_CERT You must specify a client certificate to be used for user authentication. -CM_NO_SECURE Specify the client certificate and private key inside the smart card to be used for user authentication. -CM_CERT_SECURE_INFO Certificate: "%S"\r\nPrivate Key: "%S" -CM_SELECT_SECURE_DEVICE Select Smart Card -CM_SELECT_CERT_INCARD Specify Cert and Pri&vate Key -CM_VIEW_CLIENT_CERT &View Client Certificate -CM_NO_VLAN Before you can create a new VPN Connection Setting you need to create a Virtual Network Adapter. \r\n\r\nDo you want to create a Virtual Network Adapter? -CM_NO_VLAN_2 Before connecting to VPN Server you need to create a Virtual Network Adapter. \r\n\r\nDo you want to create a Virtual Network Adapter? -CM_VLAN_REMOTE_ERROR Unable to create a Virtual Network Adapter from a remote location. \r\n\rStart the VPN Client Manager on the local computer on which the VPN Client service is running and install a Virtual Network Adapter. -CM_9X_VLAN_INSTALL A new Virtual Network Adapter will now be created. \r\n\r\nAfter a Virtual Network Adapter is created, it is necessary to restart Windows directly afterwards. \r\nWhile the Virtual Network Adapter is being installed, you may be asked to insert the Windows installation CD-ROM. \r\n\r\nClose all currently running applications except the VPN Client Manager, have your Windows installation CD-ROM ready at hand, and click OK. \r\nClicking OK will start the installation of the Virtual Network Adapter. When this is finished, Windows will automatically restart. -CM_9X_VLAN_ME_MESSAGE A Virtual Network Adapter has been created. After you click OK, the computer will automatically restart. \r\n\r\nAfter the computer restarts, the Install New Device wizard might appear. \r\nIf the wizard does appear, click Next for each screen until the installation is completed. -CM_9X_VLAN_UNINSTALL To delete a Virtual Network Adapter, delete it from Network Properties. \r\n\r\nDo you want to display the Network Properties window? -CM_PORT_1 8888 (PX-VPN Port) -CM_PORT_2 443 (HTTPS Port) -CM_PORT_3 992 (TELNETS Port) -CM_PORT_4 5555 (SE-VPN Port) -CM_RETRY_INTERVAL_ERROR Set a re-connection interval (at least 5 seconds) when VPN connection has been disconnected. -CM_DELETE_CLIENT_CERT This will delete the client certificate that has been set. Do you really want to do this? -CM_DELETE_SERVER_CERT This will delete the server individual certificate that has been set. Do you really want to do this? -CM_SET_STARTUP The VPN Connection Setting "%s" is now set as a startup connection.\r\n\r\nThis account will be connected automatically next time the computer restarts.\r\n(If you are using Windows, the automatic connection will be started in the background mode before a user logs on to Windows.) -CM_REMOVE_STARTUP Do you wish to delete the startup connection property of VPN Connection Setting "%s"? -CM_NO_DISCONNECT_SPAN Please set the life of the TCP connection. -CM_HALF_MSG When using half-duplex mode, set at least 2 for the number of TCP connections. -CM_TOO_SMALL_INTERVAL Set at least 1 second for the interval to establish a TCP connection. -CM_DELETE_VLAN This will delete the Virtual Network Adapter "%s". Do you really want to do this? -CM_COPY_NAME_1 Copy of %s -CM_COPY_NAME_2 Copy (%u) of %s -CM_IMPORT_NAME_1 %s -CM_IMPORT_NAME_2 %s (%u) -CM_CERT_COLUMN_1 Issued to -CM_CERT_COLUMN_2 Issuer -CM_CERT_COLUMN_3 Expiration -CM_CERT_DELETE_MSG Delete this certificate from the list? -CM_PASSWORD_SET The password has been set. -CM_PASSWORD_REMOVE The password setting has been deleted. -CM_UNDER_CONSTRUCTION Incomplete. -CM_CURRENT_ACTIVE The settings of VPN Connection Setting "%s" were saved. But this VPN Connection Setting is currently online and the new settings will apply in the next connection. -CM_DISCONNECT_ALL This will disconnect all %u VPN Connection Settings that are currently connected. \r\nDo you really want to do this? -CM_HTTPS_MSG You have chosen to connect via an HTTP proxy server. \r\n\r\nUsual HTTP proxy servers do not allow access to a TCP port of your choice. \r\nWhen a VPN Client connects to a VPN Server via a HTTP proxy server, it is possible to connect by using HTTPS (HTTP over SSL) communication. \r\nIn this case it is recommended that you specify 443 (HTTPS Port) as the destination VPN Server port number. \r\n(If you specify a different port number, there are cases where it will not be possible to connect via an HTTP proxy server. \r\n Make sure that port 443 is enabled on the destination VPN Server.)\r\n\r\nFor detailed information contact either the system administrator or network administrator of the HTTP proxy server you plan to connect via. \r\n\r\nDo you want to change the port number specification of the destination VPN Server to 443 (HTTPS Port)? -CM_REMOTE_WARNING You are making changes to the remote management setting that will disallow remote management. \r\n\r\nCurrently the VPN Client Manager is connected to remote computer "%S" and is controlling the VPN Client service on that computer. \r\nIf remote connection is disabled, it will no longer be possible to remotely connect to and control the VPN Client service on computer "%S" using the VPN Client Manager. \r\n\r\nDo you want to disable remote management? -CM_KEEP_INTERVAL_MSG Set a period between %u and %u seconds in the Packet Send Interval. -CM_REMOTE_TITLE Using the VPN Client Manager, it is possible to connect to, and remotely manage a VPN Client service operating on another computer. \r\n(Note that the VPN Client service on the remote computer must allow remote management.) -CM_DESKTOP_LOCAL_PC Local Computer -CM_DESKTOP_REMOTE_PC Computer %S -CM_DESKTOP_MSG_LOCAL_TS Terminal Service (Remote Desktop) Function -CM_DESKTOP_MSG_LOCAL_SW Switch User Function -CM_DESKTOP_MSG_LOCAL_1 Currently %s is installed on this computer, providing an environment that permits multiple users to log on concurrently. In this case, the messages regarding progress status, error messages and other messages displayed by VPN Client will be displayed on a session called the "Console Session". -CM_DESKTOP_MSG_LOCAL_21 Currently "Session ID: 0, User %s" is assigned as the Console Session of this computer, however because you have started VPN Client Manager on session %u, it is not possible to display the message windows such as the progress status or errors that VPN Client displays. -CM_DESKTOP_MSG_LOCAL_22 Currently no one is logged into the Console Session "Session ID: 0" of this computer and because you have started VPN Client Manager on session %u, it is not possible to display the message windows such as the progress status or errors that VPN Client displays. -CM_DESKTOP_MSG_LOCAL_31 It is recommended that when this computer's Console Session (Session ID: 0, User %s) is displayed, start the VPN Client Manager in that session and start the connection to the VPN Connection Setting "%s". You will be able to start a connection process by doing what you are doing now. But it will be at the risk of being unable to check the progress status and error messages that may be displayed during the process. -CM_DESKTOP_MSG_LOCAL_32 It is recommended that you first log off and then after logging in locally, start the VPN Client Manager in that session and start the connection to VPN Connection Setting "%s". Although you will be able to start a connection process by doing what you are doing now, this will be at the risk of being unable to check the progress status and error messages that may be displayed during the process. -CM_DESKTOP_MSG_REMOTE_1 Because you are currently performing operation while remotely connected to VPN Client on computer %S, if the VPN Client displays any progress status or error messages during the VPN connection process to the VPN Connection Setting, you will not be able to check these messages from your current screen display. -CM_DESKTOP_MSG_REMOTE_2 To check all the progress status, error and other message windows that VPN Client displays, you must log in locally to computer %S and display the Control Session (desktop). -CM_DESKTOP_MSG_REMOTE_3 It is recommended that you first log in directly and locally to computer %S, and then start the VPN Client Manager in that session and start the connection to VPN Connection Setting "%s". Although you will be able to start a connection process by doing what you are doing now, this will be at the risk of being unable to check the progress status and error messages that may be displayed during the process. -CM_STOP_INST_VLAN_1 To install a Virtual Network Adapter on this computer you must start the VPN Client Manager within a "Console Session". \r\n\r\nCurrently, %s is installed on this computer and the current user is not logged into the Console Session but rather is logged in as the remote session (session ID: %u).\r\nTo install a Virtual Network Adapter, VPN Client Manager must be started in the Console Session (session ID: %u, user %s is logged on). \r\n\r\nFirst log on to the computer locally by using the user switching function, or the /console switch function that is on the remote desktop, or alternatively the computer's local console device and then start the VPN Client Manager and install the Virtual Network Adapter. -CM_STOP_INST_VLAN_2 To install a Virtual Network Adapter on this computer you must start the VPN Client Manager within a "Console Session". \r\n\r\nCurrently, %s is installed on this computer and the current user is not logged into the Console Session but rather is logged in as the remote session (session ID: %u).\r\nTo install a Virtual Network Adapter you must start the VPN Client Manager within a "Console Session". \r\n(Currently the user is not logged on to the Console Session (Session ID: 0).) \r\n\r\nFirst log on to the computer locally by using the user switching function, or the /console switch function that is on the remote desktop, or alternatively the computer's local console device and then start the VPN Client Manager and install the Virtual Network Adapter. -CM_SHORTCUT_DESKTOP_MSG To start a connection using the shortcut to the VPN Connection Setting, you must launch the shortcut file within the "Console Session". \r\n\r\nCurrently the user is logged on as the remote session (session ID: %u) and not as the Console Session. -CM_HTTP_PROXY_WARNING Connect via HTTP Proxy Server is selected. \r\n\r\nIn many cases, the HTTP proxy server will only allow 2 kinds of TCP port to be used for the connection to the destination server port number, HTTP protocol (TCP port number 80) and HTTPS protocol (TCP port number 443). \r\n(There are also cases when the proxy server does allow a wider choice of TCP port for connection.) \r\n\r\nWhen making a VPN connection via an HTTP proxy server that denies connections to server ports other than HTTP ports or HTTPS ports, you must specify 443 (HTTPS protocol) as the destination VPN Server port number. \r\n\r\nTo check whether the HTTP proxy server you are connecting via allows connection to ports other than port numbers 80 or 443, contact the administrator of the HTTP proxy server. \r\n\r\nCurrently, %d is specified as the destination VPN Server port number. Do you want to change the port number to 443 (HTTPS protocol)?\r\n(The port 443 of the VPN Servers you connect to must be set to listening status and ready for connection.) \r\nIf you are unsure, then contact the system administrator or the network administrator. -CM_HTTP_HEADER_COLUMN_0 Name -CM_HTTP_HEADER_COLUMN_1 Value -CM_PASSWORD_CHANGED The password has been changed. -CM_ACCOUNT_SETTING_FILE VPN Connection Setting Files (*.VPN)|*.vpn|All Files (*.*)|*.* -CM_ACCOUNT_SAVE_TITLE Enter a VPN Connection Setting File's File Name for the Export Destination -CM_ACCOUNT_OPEN_TITLE Select the VPN Connection Setting File to Import -CM_ACCOUNT_FILE_BANNER # VPN Client VPN Connection Setting File\r\n# \r\n# This file is exported using the VPN Client Manager.\r\n# The contents of this file can be edited using a text editor.\r\n# \r\n# When this file is imported to the Client Connection Manager\r\n# it can be used immediately.\r\n\r\n -CM_FAILED_TO_OPEN_FILE Unable to open file. -CM_FAILED_TO_SAVE_FILE Unable to save file. -CM_ACCOUNT_PARSE_FAILED Unable to load the VPN Connection Setting from the specified file. \r\nCheck the contents of the file. -CM_ACCOUNT_MSG_SENSITIVE This VPN Connection Setting has the username and the password.\r\nDo you want to remove these sensitive information from the exported setting file?\r\n\r\nClick Yes to remove sensitive information.\r\nIn that case a user will be required to input the username and the password when he is trying to connect to the VPN Server.\r\n\r\nClick No to stay the sensitive information remaining on the file. -CM_SHORTCUT_FILE Shortcut Files|*.lnk -CM_SHORTCUT_SAVE_TITLE Enter the Shortcut File Name. -CM_SHORTCUT_UNSUPPORTED The connection shortcut function is not supported by this version of VPN Client. \r\nUpdate to a new version. -CM_SHORTCUT_COMMENT Using the VPN Connection Setting "%s" to connect to the VPN Server. -CM_SHORTCUT_ERROR Failed to create a shortcut. -CM_VPN_FILE_CLICKED Do you want to import the VPN Connection File? -CM_VPN_FILE_IMPORT_NG Unable to import the VPN Connection Setting File. Because the VPN Client setting has been locked. -CM_VLAN_INSTALLING Please Wait a While -CM_SECURE_MUST_LOCAL It is currently not possible to configure smart card settings because you are connected to and managing a VPN Client on a remote computer. -CM_DETAIL_MODE_LINK_STR With a Cascade Connection, Connect by Bridge / Router mode is always enabled. -CM_TRAY_INITING SoftEther VPN Client Manager (Developer Edition) ... -CM_TRAY_NOT_CONNECTED SoftEther VPN Client Manager (Developer Edition)\r\nNot connected. -CM_TRAY_CONNECTED_0 SoftEther VPN Client Manager (Developer Edition)\r\nActive connections to %u servers and is attempting to connect to %u servers -CM_TRAY_CONNECTED_1 SoftEther VPN Client Manager (Developer Edition)\r\nAttempting to connect to %u servers -CM_TRAY_CONNECTED_2 SoftEther VPN Client Manager (Developer Edition)\r\nActive connections to %u servers -CM_TRAY_MENU_1_SHOW &Show VPN Client Manager -CM_TRAY_MENU_1_HIDE Cl&ose VPN Client Manager -CM_TRAY_MENU_2_QUIT E&xit VPN Client Manager Program -CM_TRAY_MENU_CONNECT Start VPN &Connection -CM_TRAY_MENU_DISCONNECT &Disconnect VPN Connection -CM_TRAY_MENU_STATUS Show VPN Connec&tion Status -CM_TRAY_MENU_DISCONNECT_ALL Disconnect &All VPN Connections -CM_TRAY_MENU_NEW &New VPN Connection Setting... -CM_TRAY_MENU_RECENT Recent VPN Servers... -CM_TRAY_MENU_TRAFFIC Network &Traffic Speed Test Tool... -CM_TRAY_MENU_NETIF Show Network &Device Status... -CM_TRAY_MENU_ABOUT &About VPN Client Manager... -CM_TRAY_MENU_SETTING Change Operation &Mode... -CM_TRAY_MENU_CANCEL Close this menu -CM_EXIT_MESSAGE This will exit the VPN Client Manager program. \r\nDo you really want to do this? -CM_IMPORT_MESSAGE From file "%S", VPN Connection Setting "%s" has been installed. -CM_VLAN_CREATING Creating a new Virtual Network Adapter for Windows. \r\n\r\nThis process can take several seconds or over a minute. \r\nPlease wait...\r\n\r\n(Please do not perform other operations while the Virtual Network Adapter is being installed.) -CM_SETTING_PASSWORD The setting is locked. To remove the setting-locker, you must enter a password. -CM_EASY_MODE_NOT_ON_REMOTE Unable to connect because of the VPN Client on the remote computer is running in Easy Mode. -CM_EASY_CONNECT_BUTTON_1 Start VPN &Connection -CM_EASY_CONNECT_BUTTON_2 &Disconnect -CM_EASY_ACCOUNT_WARNING You can only modify Proxy Server Setting, User Authentication and Virtual Network Adapter Used because the setting has been locked. -CM_EASY_INFO_1 Select a VPN connection. -CM_EASY_INFO_2 Click Start VPN Connection to start a VPN connection. -CM_EASY_INFO_3 VPN connection is active. You can disconnect by clicking Disconnect. -CM_EXT_VOICE_MSG It is possible that some of the voice message contents of the Extension Voice Guide has not been played normally. \r\nIs the Extension Voice Guide enabled? -CM_EASY_TITLE VPN Client Easy Connection Manager -CM_EASY_CONNECTED VPN connection is active. -CM_EASY_CONNECTING Establishing VPN connection... -CM_PROXY_FROM_IE Currently proxy setting from Internet Explorer has been loaded. -CM_TRAY_ICON_RESTORE The icon in the task tray has been deleted.\r\n\r\nTo restore the icon, run the VPN Client Manager and click Show Task-tray Icon in the View menu. -CM_WOULDYOULOAD_IE_PROXY Currently the Internet Explorer on this computer is configured to use the proxy server "%S".\r\nDo you want to apply the current proxy settings on the new VPN connection setting?\r\n\r\nClick Yes to use the proxy settings of Internet Explorer.\r\nClick No to use direct connection to the VPN Server (does not a proxy server.)\r\nThis setting can be modified in the property screen of the connection settings any time later. -CM_MSG_TITLE VPN Server "%S" (Virtual Hub: "%S") -CM_JUMPLIST_RCCONNECT Recent VPN Servers -CM_VPNGATE_MESSAGE There is the list of Public VPN Relay Servers on the VPN Gate Academic Project Web Site.\r\nAnyone on the Internet can connect a VPN connection to any VPN servers on the list.\r\n\r\nVPN Gate Academic Project is not a part of SoftEther VPN.\r\nThis icon provides just a link to http://www.vpngate.net/.\r\nYou need to install VPN Gate Plugin to connect VPN Gate.\r\n\r\nDo you want to visit http://www.vpngate.net/ (provided by University of Tsukuba) ? -CM_VLAN_REINSTALL_MSG After reinstalling the Virtual Network Adapter driver, the current Virtual Network Adapter's MAC address will change. Also, all TCP/IP settings within the Virtual Network Adapter will reset.\r\n\r\nIn case the reinstalled Virtual Network Adapter fails to work, delete it and create a new one. If it still doesn't work properly, please create a new Virtual Network Adapter with a different name. - - -VGC_COLUMN_0 DDNS Hostname -VGC_COLUMN_1 IP Address (Hostname) -VGC_COLUMN_2 Region -VGC_COLUMN_3 Uptime -VGC_COLUMN_4 VPN Sessions -VGC_COLUMN_5 Line Speed -VGC_COLUMN_6 Ping (Google, SE) -VGC_COLUMN_7 SSL-VPN (TCP) -VGC_COLUMN_8 UDP Support -VGC_COLUMN_9 Logging Policy -VGC_COLUMN_10 Cumulative Transfers -VGC_COLUMN_11 Cumulative Users -VGC_COLUMN_12 Operator's Name -VGC_COLUMN_13 Operator's Message -VGC_COLUMN_14 Total Score - -VGC_LOG_PERMANENT Permanent -VGC_LOG_2WEEKS 2 Weeks -VGC_LOG_NONE No Logs - -VGC_UPTIME_MIN %u mins -VGC_UPTIME_HOUR %u hours -VGC_UPTIME_DAY %u days -VGC_NUM_VPN %u sessions -VGC_NUM_LOGIN %S logins - -VGC_UDP_AVAILABLE UDP OK - -VGC_TITLE VPN Gate Plug-in Message - -VGC_VER_DIFF The version of VPN Gate Client Plug-in is different from SoftEther VPN Client.\r\n\r\n- Current VPN Gate Plug-in: Build %u\r\n- Current SoftEther VPN Client: Build %u\r\n\r\nIt is recommended to download and install VPN Gate Plug-in Build %u. Otherwise, communication errors or list-update errors might be occur. If the VPN Server List updating fails many times, update the VPN Gate Plug-in version.\r\n\r\nThe latest VPN Gate Plug-in is available at http://www.vpngate.net/.\r\n(Use a mirror-site if you cannot visit the above web-site directly.)\r\n\r\n - -VGC_LIST_STR_OK %S Public VPN Relay Servers on the Earth! (Updated at %S) -VGC_LIST_STR_OK_2 %S Servers (at %S) - List update failed. Try again. If fails again, download the latest VPN Gate Client. -VGC_LIST_STR_NG List update failed. Try again. If fails again, download the latest VPN Gate Client. -VGC_PROXY_MSG If you are using a proxy server, you might not be able to use VPN Relay Servers which don't support the TCP port 443 as "SSL-VPN Connection" from such a proxy-mandated network. -VGC_PROXY_TITLE Notice for Proxy Server Users - -VGS_NO_HUB_YET In order to set the message, first you have to commit enabling the VPN Gate service. After the service will be enabled, re-open this window and set the message. - -VGS_STOP VPN Gate Service will stop after you click the OK button.\r\n\r\nAfter VPN Gate Service will be stopped, this computer will never accept new VPN connection requests, however, still-alive VPN Sessions might remain.\r\n (Such VPN sessions sometimes hidden from the enumeration.) \r\n\r\nTo terminate all of still-alive VPN Sessions completely, restart SoftEther VPN Server or SoftEther VPN Client service, or reboot the computer. - -VGS_START This will activate the VPN Gate Relay Service function.\r\n\r\nVPN Gate Relay Service function must be activated by your own risk.\r\nSome countries prohibit using of encrypted VPN by laws.\r\nFor more details about VPN Gate Relay Service please visit http://www.vpngate.net/en/join.aspx.\r\n\r\nThe VPN Gate Academic Experiment Service is operated as a research project at the graduate school on University of Tsukuba, Japan. The service is governed under the Japanese laws. Other countries' laws are none of our concerns nor responsibilities.\r\n\r\nBy nature, there are almost 200 countries in the World, with different laws. It is impossible to verify every countries' laws and regulations and make the software comply with all countries' laws in advance to release the software. If a user uses VPN Gate service in a specific country, and damaged by public servants of the authority, the developer of either the service or software will never be liable to recover or compensate such damages or criminal responsibilities.\r\nBy using this software and service, the user must observe all concerned laws and rules with user's own responsibility. The user will be completely liable to any damages and responsibilities which are results of using this software and service, regardless of either inside or outside of Japan's territory.\r\nIf you don't agree nor understand the above warnings, do not use any of VPN Gate Academic Experiment Service functions. - - -# Concerning services (Win32) -SVC_HELP *** Command Line Arguments of %s (%S) ***\r\n\r\nThis program (%s) is a process runs as a background task. Start the program by specifying the following arguments on the command line. \r\n\r\n\r\n/install : Installs %s service (service name: %S) in Windows. After this, the service will automatically start. \r\n\r\n/uninstall... Uninstalls %s service (service name: %S) from Windows. \r\n\r\n/start : Starts %s service (service name: %S). \r\n\r\n/stop : Stops %s service (service name: %S). \r\n\r\n/test : Starts %s program in test mode. (For debug)\r\n\r\n/usermode : Starts %s program in the user mode. (When possible)\r\n\r\n/usermode_showtray : When starting in the user mode, this is used to display task tray icons when they were set to be hidden on a previous occasion. \r\n\r\n/usermode_hidetray : When starting in the user mode, this sets the task tray icons to be hidden. \r\n\r\n\r\nNote: Commands related to service operation other than /test and /usermode can only be operated on Windows NT / XP / Server 2003 / Vista / Server 2008. -SVC_NT_ONLY The service related operation commands can only operate on Windows NT / 2000 / XP / Server 2003 / Vista / Server 2008. \r\nThey do not operate on Windows 98 / Me. -SVC_ALREADY_INSTALLED The "%s" service (service name: %S) is already installed on this computer. Do you want to uninstall it and then re-install? -SVC_INSTALL_OK The "%s" service (Service name: %S) has been installed successfully. \r\n\r\n(Execution path: %s)\r\n\r\nThe service has started. -SVC_INSTALL_FAILED The installation of the "%s" service (service name: %S) failed. -SVC_INSTALL_FAILED_2 The "%s" service (Service name: %S) has been successfully installed. \r\n\r\n(Execution path: %s)\r\n\r\nAn attempt to start the service, however, failed. -SVC_NOT_INSTALLED The "%s" service (service name: %S) is not yet installed on this computer. Use the /install command line argument to install it. -SVC_START_OK The "%s" service (service name: %S) started successfully. -SVC_START_FAILED The "%s" service (service name: %S) failed to start. -SVR_ALREADY_START The "%s" service (service name: %S) has already started. -SVC_STOP_OK The "%s" service (Service name: %S) has been stopped. -SVC_STOP_FAILED The "%s" service (service name: %S) failed to stop. -SVC_ALREADY_STOP The "%s" service (service name: %S) is already stopped. -SVC_UNINSTALL_OK The "%s" service (Service name: %S) has been uninstalled successfully. -SVC_UNINSTALL_FAILED The uninstallation of the "%s" service (service name: %S) failed. -SVC_NOT_FOUND Unable to find information related to service %S from the string table. -SVC_NOT_ADMIN To install, uninstall, start or stop the service you must have administrator privileges for this computer. \r\n\r\nIf you have an administrators account for this computer, log out and log on as an administrator. \r\nIf you are unclear about administrators accounts, contact your system administrator. -SVC_TEST_MSG The "%s" service is started in test mode. \r\n\r\nClick OK to exit the service. -SVC_TRAY_TOOLTIP %S (User mode) -SVC_TEST_MUTEX The executable file %s is already started. -SVC_USERMODE_MUTEX Another process of %s is already started. -SVC_SERVICE_MUTEX Because service %S has process %s that is already started, the service cannot start. -SVC_USERMODE_MENU_1 &Hide Tasktray Icon -SVC_USERMODE_MENU_2 E&xit %s -SVC_HIDE_TRAY_MSG This will hide the tasktray icons when starting %S in user mode. \r\nBeginning from next time %S is started in user mode, icons will not be displayed in the tasktray. \r\nThe menu to exit the process will also be hidden. \r\n\r\nTo exit the process in the case of Windows 98 / Me, use the Ctrl + Alt + Del key combination and select to end the process. \r\nWhen using other operating systems, use Task Manager. \r\n\r\nTo redisplay the tasktray icons, use the /usermode_showtray option when starting in user mode next time. - - -# Concerning services (UNIX) -UNIX_SVC_HELP %S service program\nCopyright (c) all contributors on SoftEther VPN project in GitHub.\nCopyright (c) Daiyuu Nobori, SoftEther Project at University of Tsukuba, and SoftEther Corporation.\nAll Rights Reserved.\n\n%S command usage:\n %S start - Start the %S service.\n %S stop - Stop the %S service if the service has been already started.\n\n -UNIX_SVC_STARTED The %S service has been started.\n -UNIX_SVC_STOPPING Stopping the %S service ...\n -UNIX_SVC_STOPPED %S service has been stopped.\n -UNIX_SVC_STOP_FAILED Stopping %S service was failed.\n -UNIX_SVC_ALREADY_START %S service has been already started.\nRun the "%S stop" command to stop this service.\n -UNIX_SVC_NOT_STARTED %S service has not yet been started.\nRun the "%S start" to start this service.\n -UNIX_SVC_ERROR_FORK Failed to create child process for the %S service.\n -UNIX_SVC_NONROOT \nWarning: The current user context is non-root. It is recommended to run the VPN service by the root user. Although the VPN service may run under non-root users, some privilege-required functions (e.g. the local bridge function) need the root privilege.\n - - -# Service definition (SoftEther VPN Client) -SVC_VPNCLIENT_NAME vpnclient -SVC_VPNCLIENT_TITLE SoftEther VPN Client -SVC_VPNCLIENT_DESCRIPT This manages the Virtual Network Adapter device driver and connection service for the SoftEther VPN Client. When this service is stopped, it will not be possible to use SoftEther VPN Client on this computer to connect to a SoftEther VPN Server. - - -# Service Definition (SoftEther VPN Server) -SVC_VPNSERVER_NAME vpnserver -SVC_VPNSERVER_TITLE SoftEther VPN Server -SVC_VPNSERVER_DESCRIPT This manages the server processes of SoftEther VPN Server. SoftEther VPN Server provides high-performance SoftEther VPN Server functions via TCP/IP protocol. When this service is stopped, SoftEther VPN Server on this computer will stop and SoftEther VPN Client will be unable to establish a VPN connection with this computer. - - -# Service Definition (SoftEther VPN Bridge) -SVC_VPNBRIDGE_NAME vpnbridge -SVC_VPNBRIDGE_TITLE SoftEther VPN Bridge -SVC_VPNBRIDGE_DESCRIPT This manages the processes of SoftEther VPN Bridge. SoftEther VPN Bridge provides a bridging connection between the network this computer is connected to and a SoftEther VPN Server that is remotely located. When this service is stopped, SoftEther VPN Bridge on this computer will stop and it will no longer be possible to communicate via the bridge connection. - - -# Service definition (SoftEther VPN Client) -SVC_SEVPNCLIENTDEV_NAME sevpnclientdev -SVC_SEVPNCLIENTDEV_TITLE SoftEther VPN Client Developer Edition -SVC_SEVPNCLIENTDEV_DESCRIPT This manages the Virtual Network Adapter device driver and connection service for the SoftEther VPN Client. When this service is stopped, it will not be possible to use SoftEther VPN Client on this computer to connect to a SoftEther VPN Server. - - -# Service Definition (SoftEther VPN Server) -SVC_SEVPNSERVERDEV_NAME sevpnserverdev -SVC_SEVPNSERVERDEV_TITLE SoftEther VPN Server Developer Edition -SVC_SEVPNSERVERDEV_DESCRIPT This manages the server processes of SoftEther VPN Server. SoftEther VPN Server provides high-performance SoftEther VPN Server functions via TCP/IP protocol. When this service is stopped, SoftEther VPN Server on this computer will stop and SoftEther VPN Client will be unable to establish a VPN connection with this computer. - - -# Service Definition (SoftEther VPN Bridge) -SVC_SEVPNBRIDGEDEV_NAME sevpnbridgedev -SVC_SEVPNBRIDGEDEV_TITLE SoftEther VPN Bridge Developer Edition -SVC_SEVPNBRIDGEDEV_DESCRIPT This manages the processes of SoftEther VPN Bridge. SoftEther VPN Bridge provides a bridging connection between the network this computer is connected to and a SoftEther VPN Server that is remotely located. When this service is stopped, SoftEther VPN Bridge on this computer will stop and it will no longer be possible to communicate via the bridge connection. - - -# Service definition (SoftEther VPN User-mode Router) -SVC_VPNROUTER_NAME vpnrouter -SVC_VPNROUTER_TITLE SoftEther VPN Router Developer Edition -SVC_VPNROUTER_DESCRIPT This manages the server processes of SoftEther VPN Router (service mode). SoftEther VPN Router is a program that provides a virtual NAT and DHCP server that operates in user mode and by using simple operations it is possible to establish a safe connection between a virtual IP network and a physical IP network. When this service is stopped, SoftEther VPN Router on this computer will stop and SoftEther VPN Client will be unable to use the routing service on this computer. - - -# Service Definition (EtherLogger) -SVC_ELOGSVC_NAME elogsvc -SVC_ELOGSVC_TITLE SoftEther EtherLogger Developer Edition -SVC_ELOGSVC_DESCRIPT SoftEther EtherLogger is a service that captures data flowing through LAN cards connected to the computer and keeps a log of the headers of the packet types specified by the administrator and all data in text file format. - - -# Concerning SoftEther VPN Server Manager -SM_TITLE SoftEther VPN Server Manager Developer Edition -SM_LOCALHOST localhost (This server) -SM_SERVER_BRIDGE_TITLE Manage VPN Bridge "%S" -SM_S_VHUB_BRIDGE When using VPN Bridge, you manage Virtual Hub "BRIDGE" to operate management of VPN Bridge. -SM_DISCONNECTED The management connection has been disconnected. -SM_MIKAN Under Construction. -SM_MAIN_COLUMN_1 Setting Name -SM_MAIN_COLUMN_2 VPN Server Hostname -SM_MAIN_COLUMN_3 Operation Mode -SM_MODE_SERVER Entire VPN Server -SM_MODE_HUB Hub '%S' Only -SM_EDIT_CAPTION_1 New Connection Setting -SM_EDIT_CAPTION_2 Edit %s -SM_SETTING_EXISTS A Connection Setting with the same name as Connection Setting "%s" is already registered. Specify a different name. -SM_SETTING_DELETE_MSG This will delete the Connection Setting "%s". Do you really want to do this? -SM_PASSWORD_TYPE_STR Password for Administration Connection -SM_HUB_COLUMN_1 Virtual Hub Name -SM_HUB_COLUMN_2 Status -SM_HUB_COLUMN_3 Type -SM_HUB_COLUMN_4 Users -SM_HUB_COLUMN_5 Groups -SM_HUB_COLUMN_6 Sessions -SM_HUB_COLUMN_7 MAC Tables -SM_HUB_COLUMN_8 IP Tables -SM_HUB_COLUMN_9 Num Logins -SM_HUB_COLUMN_10 Last Login -SM_HUB_COLUMN_11 Last Communication -SM_HUB_ONLINE Online -SM_HUB_OFFLINE Offline -SM_HUB_STANDALONE Standalone -SM_HUB_STATIC Static Hub -SM_HUB_DYNAMIC Dynamic Hub -SM_SERVER_STANDALONE Standalone Server -SM_FARM_CONTROLLER Cluster Controller -SM_FARM_MEMBER Cluster Member Server -SM_INFORMATION Latest Information -SM_HUB_STATUS_CAPTION Status of Virtual Hub "%s" -SM_HUB_STATUS_HUBNAME Virtual Hub Name -SM_HUB_STATUS_ONLINE Status -SM_HUB_TYPE Type -SM_HUB_NUM_SESSIONS Sessions -SM_HUB_NUM_SESSIONS_CLIENT Sessions (Client) -SM_HUB_NUM_SESSIONS_BRIDGE Sessions (Bridge) -SM_HUB_NUM_ACCESSES Access Lists -SM_HUB_NUM_USERS Users -SM_HUB_NUM_GROUPS Groups -SM_HUB_NUM_MAC_TABLES MAC Tables -SM_HUB_NUM_IP_TABLES IP Tables -SM_HUB_SECURE_NAT SecureNAT -SM_HUB_SECURE_NAT_YES Enabled -SM_HUB_SECURE_NAT_NO Disabled -SM_HUB_NUM_LOGIN Num Logins -SM_HUB_LAST_LOGIN_TIME Last Login -SM_HUB_LAST_COMM_TIME Last Communication -SM_HUB_CREATED_TIME Created at -SM_STATUS_COLUMN_1 Item -SM_STATUS_COLUMN_2 Value - -SM_ST_SEND_UCAST_NUM Outgoing Unicast Packets -SM_ST_SEND_UCAST_SIZE Outgoing Unicast Total Size -SM_ST_SEND_BCAST_NUM Outgoing Broadcast Packets -SM_ST_SEND_BCAST_SIZE Outgoing Broadcast Total Size - -SM_ST_RECV_UCAST_NUM Incoming Unicast Packets -SM_ST_RECV_UCAST_SIZE Incoming Unicast Total Size -SM_ST_RECV_BCAST_NUM Incoming Broadcast Packets -SM_ST_RECV_BCAST_SIZE Incoming Broadcast Total Size - -SM_ST_NUM_PACKET_STR %S packets -SM_ST_SIZE_BYTE_STR %S bytes - -CM_EDIT_HUB_1 New Virtual Hub -CM_EDIT_HUB_2 Properties of %S - -CM_EDIT_HUB_STANDALONE Currently the server is operating in Standalone Mode. This Virtual Hub is operating as a Standalone Hub. -CM_EDIT_HUB_TYPE_FIXED Currently the server is operating in Cluster Mode. This Virtual Hub is of the following type, which means it is not possible to make dynamic changes. -CM_EDIT_HUB_CREATED A new Virtual Hub '%S' has been created. -CM_OFFLINE_MSG Do you want to switch %s to offline?\r\n\r\nIf you switch the Virtual Hub to offline all sessions currently connected to the Virtual Hub will be disconnected and new sessions will be unable to connect. -CM_DELETE_HUB_MSG Do you want to delete %S?\r\n\r\nIf you delete the Virtual Hub, all sessions currently connected to the Virtual Hub will be disconnected and new sessions will be unable to connect. \r\nThis will also delete all the Hub settings, user objects, group objects, certificates and Cascade Connections. \r\n\r\nOnce you delete the Virtual Hub, it cannot be recovered. \r\nAre you sure you want to delete it? -CM_HUB_DELETED_MSG Virtual Hub %S has been deleted. -CM_LISTENER_COLUMN_1 Port Number -CM_LISTENER_COLUMN_2 Status -CM_LISTENER_TCP_PORT TCP %u -CM_LISTENER_ONLINE Listening -CM_LISTENER_OFFLINE Stopped -CM_LISTENER_ERROR Error -CM_DELETE_LISTENER_MSG This will delete the Listener (TCP port %u). From now on, it will not be possible to connect to this port. \r\nDo you really want to do this? -CM_STOP_LISTENER_MSG This will stop the Listener (TCP port %u). Until Listener is restarted it will not be possible to connect to this port. \r\n\r\nDo you really want to do this? -CM_CLOSE_BUTTON Close -CM_CERT_SET_MSG A new server certificate has been set.\r\n\r\nIf you are using OpenVPN protocols, please mind that you may have to update the inline certificate data in the OpenVPN configuration file. - -CM_SHORTCUT_DISCONNECT There is already an active connection to the specified connection destination. \r\n\r\nDo you want to disconnect? - - -SM_SERVER_STATUS Server Status -SM_ST_SERVER_TYPE Server Type -SM_ST_NUM_TCP Number of Active Sockets -SM_ST_NUM_TCP_LOCAL Number of Active Sockets (This Server) -SM_ST_NUM_TCP_REMOTE Number of Active Sockets (Other Member Servers) -SM_ST_NUM_HUB_TOTAL Number of Virtual Hubs -SM_ST_NUM_HUB_STATIC Number of Static Virtual Hubs -SM_ST_NUM_HUB_DYNAMIC Number of Dynamic Virtual Hubs -SM_ST_NUM_SESSION_TOTAL Number of Sessions -SM_ST_NUM_SESSION_LOCAL Number of Sessions (This Server) -SM_ST_NUM_SESSION_REMOTE Number of Sessions (Other Member Servers) -SM_ST_NUM_MAC_TABLE Number of MAC Address Tables -SM_ST_NUM_IP_TABLE Number of IP Address Tables -SM_ST_NUM_USERS Number of Users -SM_ST_NUM_GROUPS Number of Groups -SM_ST_CLIENT_LICENSE Using Client Connection Licenses (This Server) -SM_ST_BRIDGE_LICENSE Using Bridge Connection Licenses (This Server) -SM_ST_CLIENT_LICENSE_EX Using Client Connection Licenses (Entire Cluster) -SM_ST_BRIDGE_LICENSE_EX Using Bridge Connection Licenses (Entire Cluster) -SM_ST_START_TIME Server Started at -SM_ST_CURRENT_TIME Current Time -SM_ST_CURRENT_TICK 64 bit High-Precision Logical System Clock -SM_ST_TOTAL_MEMORY Total Logical Memory Size -SM_ST_USED_MEMORY Used Logical Memory Size -SM_ST_FREE_MEMORY Free Logical Memory Size -SM_ST_TOTAL_PHYS Total Physical Memory Size -SM_ST_USED_PHYS Used Physical Memory Size -SM_ST_FREE_PHYS Free Physical Memory Size -SM_ST_RAM_SIZE_KB %S bytes -SM_INFO_TITLE VPN Server Version Information -SM_INFO_PRODUCT_NAME Product Name -SM_INFO_VERSION Version -SM_INFO_BUILD Build -SM_INFO_HOSTNAME Host Name -SM_OS_SYSTEM_NAME Type of Operating System -SM_OS_PRODUCT_NAME Product Name of Operating System -SM_OS_SERVICE_PACK Service Pack -SM_OS_SP_TAG Service Pack %u -SM_OS_VENDER_NAME Operating System Vendor -SM_OS_VERSION Operating System Version -SM_OS_KERNEL_NAME Type of OS Kernel -SM_OS_KERNEL_VERSION Version of OS Kernel -SM_CONNECTION_TYPE_0 Client -SM_CONNECTION_TYPE_1 Initializing... -SM_CONNECTION_TYPE_2 Login -SM_CONNECTION_TYPE_3 Additional Connection -SM_CONNECTION_TYPE_4 Clustering RPC -SM_CONNECTION_TYPE_5 Management RPC -SM_CONNECTION_TYPE_6 Hub Enumeration RPC -SM_CONNECTION_TYPE_7 Changing Password -SM_CONNECTION_TYPE_8 MS-SSTP Connection -SM_CONNECTION_TYPE_9 OpenVPN Connection -SM_CONN_COLUMN_1 Connection Name -SM_CONN_COLUMN_2 Connection Source -SM_CONN_COLUMN_3 Connection Start -SM_CONN_COLUMN_4 Type -SM_HOSTNAME_AND_PORT %S: %u -SM_CONN_DISCONNECT_MSG This will disconnect connection %s. \r\nDo you really want to do this? -SM_CONNINFO_CAPTION Connection %s Information -SM_CONNINFO_NAME Connection Name -SM_CONNINFO_TYPE Connection Type -SM_CONNINFO_HOSTNAME Source Host Name -SM_CONNINFO_IP Client IP Address -SM_CONNINFO_PORT Client Port Number (TCP) -SM_CONNINFO_TIME Connection Start -SM_CONNINFO_SERVER_STR Server Product Name -SM_CONNINFO_SERVER_VER Sever Version -SM_CONNINFO_SERVER_BUILD Server Build Number -SM_CONNINFO_CLIENT_STR Client Product Name -SM_CONNINFO_CLIENT_VER Client Version -SM_CONNINFO_CLIENT_BUILD Client Build -SM_FARM_REBOOT_MSG You are about to change the clustering configuration. \r\n\r\nWhen you change the clustering configuration, all currently connected sessions and connections for management purposes (including this management connection) will be disconnected and the server program will restart. \r\nWhen there are many server users, it could take over a minute to restart. \r\n\r\nClick OK to automatically disconnect the connection with the server. To continue management, you will need to reconnect to the server. -SM_FM_COLUMN_1 Type -SM_FM_COLUMN_2 Connection Started at -SM_FM_COLUMN_3 Host Name -SM_FM_COLUMN_4 Point -SM_FM_COLUMN_5 Number of Sessions -SM_FM_COLUMN_6 Number of TCP Connections -SM_FM_COLUMN_7 Number of Operating Hubs -SM_FM_COLUMN_8 Using Client Connection Licenses -SM_FM_COLUMN_9 Using Bridge Connection Licenses -SM_FM_CONTROLLER Controller -SM_FM_MEMBER Member -SM_FMINFO_TYPE Server Type -SM_FMINFO_CONNECT_TIME Connection Established at -SM_FMINFO_IP IP Address -SM_FMINFO_HOSTNAME Host Name -SM_FMINFO_POINT Point -SM_FMINFO_WEIGHT Performance Standard Ratio -SM_FMINFO_NUM_PORT Number of Public Ports -SM_FMINFO_PORT Public Port #%u (TCP/IP) -SM_FMINFO_NUM_HUB Number of Running Virtual Hubs -SM_FMINFO_HUB Virtual Hub #%u -SM_FMINFO_HUB_TAG_1 %S (Dynamic) -SM_FMINFO_HUB_TAG_2 %S (Static) -SM_FMINFO_NUM_SESSION Number of Sessions -SM_FMINFO_NUN_CONNECTION Number of TCP Connections -SM_FMINFO_CAPTION Cluster Member Server Status -SM_FC_STATUS_CAPTION Connection to Cluster Controller Status -SM_FC_IP Controller IP Address -SM_FC_PORT Controller TCP/IP Port -SM_FC_STATUS Connection Status -SM_FC_ONLINE Online -SM_FC_OFFLINE Offline -SM_FC_LAST_ERROR Last Error -SM_FC_ERROR_TAG %s (Error Code: %u) -SM_FC_START_TIME Connection Started at -SM_FC_FIRST_TIME First Connection Established at -SM_FC_CURRENT_TIME Current Connection Established at -SM_FC_NUM_TRY Number of Connection Attempts -SM_FC_NUM_CONNECTED Number of Successful Connections -SM_FC_NUM_FAILED Number of Failed Connections -SM_FC_NOT_CONNECTED (Not Connected) -SM_CHANGE_PASSWORD_1 The passwords you entered did not match. Enter the same password in Confirm as you enter in Password. -SM_CHANGE_PASSWORD_2 You have entered an empty password. Continue anyway? -SM_CHANGE_PASSWORD_3 The password has been changed. -SM_USER_COLUMN_1 User Name -SM_USER_COLUMN_2 Full Name -SM_USER_COLUMN_3 Group Name -SM_USER_COLUMN_4 Description -SM_USER_COLUMN_5 Auth Method -SM_USER_COLUMN_6 Num Logins -SM_USER_COLUMN_7 Last Login -SM_AUTHTYPE_0 Anonymous Authentication -SM_AUTHTYPE_1 Password Authentication -SM_AUTHTYPE_2 Individual Certificate Authentication -SM_AUTHTYPE_3 Signed Certificate Authentication -SM_AUTHTYPE_4 RADIUS Authentication -SM_AUTHTYPE_5 NT Domain Authentication -SM_NO_GROUP - -SM_USER_DELETE_MSG This will delete the user "%s". Do you really want to do this? -SM_EDIT_USER_CAPTION_1 Create New User -SM_EDIT_USER_CAPTION_2 Properties of User %S -SM_EDIT_USER_CERT_INFO The users using 'Individual Certificate Authentication' will be allowed or denied connection depending on whether the SSL client certificate completely matches the certificate that has been set for the user beforehand. -SM_EDIT_USER_POL_DLG Security Policy of User %S -SM_POLICY_DEF_CAPTION Security Policy -SM_LIMIT_STR Specify an integer that is within the range %u to %u. -SM_POLICY_INIT_TITLE Select a policy item from the list on the left. -SM_USER_CREATE_OK User %S has been created. -SM_USERINFO_CAPTION User "%S" Information -SM_USERINFO_NAME User Name -SM_USERINFO_GROUP Group Name -SM_USERINFO_CREATE Created on -SM_USERINFO_UPDATE Updated on -SM_USERINFO_EXPIRE Expiration Date -SM_USERINFO_NUMLOGIN Number of Logins -SM_GROUPLIST_NAME Group Name -SM_GROUPLIST_REALNAME Full Name -SM_GROUPLIST_NOTE Description -SM_GROUPLIST_NUMUSERS Num Users -SM_EDIT_GROUP_CAPTION_1 Creation of New Group -SM_EDIT_GROUP_CAPTION_2 Properties of Group %S -SM_GROUP_CREATED Group %S has been created. -SM_GROUP_DELETE_MSG Group %S has been deleted. Do you really want to do this? -SM_GROUP_POLICY_CAPTION Security Policy of Group %S -SM_GROUP_MEMBER_STR \ (Display only users belonging to group %S) -SM_SELECT_GROUP &Select -SM_SELECT_NO_GROUP &None -SM_SELECT_ALT_GROUP Select a &Group... -SM_ACCESS_COLUMN_0 ID -SM_ACCESS_COLUMN_1 Action -SM_ACCESS_COLUMN_2 Status -SM_ACCESS_COLUMN_3 Priority -SM_ACCESS_COLUMN_4 Memo -SM_ACCESS_COLUMN_5 Contents -SM_ACCESS_COLUMN_6 Unique ID -SM_ACCESS_PASS Pass -SM_ACCESS_DISCARD Discard -SM_ACCESS_ENABLE Enable -SM_ACCESS_DISABLE Disable -SM_ACCESS_PROTO_1 All IPv4 / IPv6 Protocols -SM_ACCESS_PROTO_2 6 (TCP/IP Protocol) -SM_ACCESS_PROTO_3 17 (UDP/IP Protocol) -SM_ACCESS_PROTO_4 1 (ICMPv4 Protocol) -SM_ACCESS_PROTO_5 58 (ICMPv6 Protocol) -SM_ACCESS_PROTO_6 Specify the IP Protocol Number -SM_SELECT_USER &Select -SM_SELECT_NO Do&n't Select -SM_PLEASE_SELECT Select User. -SM_LINK_COLUMN_1 Setting Name -SM_LINK_COLUMN_2 Status -SM_LINK_COLUMN_3 Established at -SM_LINK_COLUMN_4 Destination VPN Server -SM_LINK_COLUMN_5 Virtual Hub -SM_LINK_STATUS_OFFLINE Offline (Stopped) -SM_LINK_STATUS_ERROR Error %u: %s -SM_LINK_STATUS_ONLINE Online (Established) -SM_LINK_POLICY_GROUP Cascade Connection Setting -SM_LINK_POLICY_CAPTION Security policy settings applicable to Cascade sessions -SM_LINK_CONNECTING Connecting -SM_LINK_SAVE_ONLINE Although the Cascade Connection Setting "%s" has been changed, this Cascade Connection is currently online. The setting will not be applied until next time the connection is established. -SM_LINK_DELETE_MSG This will delete the settings for Cascade Connection "%s". Do you really want to do this? -SM_LINK_OFFLINE_MSG Currently Cascade Connection "%s" is active. Do you want to disconnect this connection? -SM_LINK_STATUS_CAPTION Connection status of Cascade Connection "%s" -SM_LOG_SWITCH_0 No Switching -SM_LOG_SWITCH_1 Switch in Every Second -SM_LOG_SWITCH_2 Switch in Every Minute -SM_LOG_SWITCH_3 Switch in Every Hour -SM_LOG_SWITCH_4 Switch in Every Day -SM_LOG_SWITCH_5 Switch in Every Month -SM_SESS_DISCONNECT_MSG This will disconnect session "%S". Do you really want to do this? -SM_SESS_COLUMN_1 Session Name -SM_SESS_COLUMN_2 Location -SM_SESS_COLUMN_3 User Name -SM_SESS_COLUMN_4 Source Host Name -SM_SESS_COLUMN_5 TCP Connections -SM_SESS_COLUMN_6 Transfer Bytes -SM_SESS_COLUMN_7 Transfer Packets -SM_SESS_COLUMN_8 VLAN ID -SM_SESS_NORMAL Local Session -SM_SESS_LOCAL Local Session -SM_SESS_LOCAL_2 On '%S' -SM_SESS_REMOTE On '%S' -SM_SESS_LINK Cascade Connection -SM_SESS_LINK_HOSTNAME Virtual Host -SM_SESS_LINK_TCP None -SM_SESS_SNAT SecureNAT Session -SM_SESS_SNAT_HOSTNAME Virtual Host -SM_SESS_SNAT_TCP None -SM_SESS_BRIDGE Local Bridge Session -SM_SESS_BRIDGE_HOSTNAME Ethernet Bridge -SM_SESS_LAYER3_HOSTNAME Virtual Layer 3 Switch -SM_SESS_BRIDGE_TCP None -SM_SESS_STATUS_CAPTION VPN Session "%S" Status -SM_SESS_STATUS_USERNAME User Name (Authentication) -SM_SESS_STATUS_REALUSER User Name (Database) -SM_SESS_STATUS_GROUPNAME Group Name -SM_CLIENT_IP Client IP Address -SM_CLIENT_HOSTNAME Client Host Name -SM_NODE_CLIENT_NAME Client Product Name (Reported) -SM_NODE_CLIENT_VER Client Version (Reported) -SM_NODE_CLIENT_BUILD Client Build (Reported) -SM_NODE_SERVER_NAME Server Product Name (Reported) -SM_NODE_SERVER_VER Server Version (Reported) -SM_NODE_SERVER_BUILD Server Build (Reported) -SM_NODE_CLIENT_OS_NAME Client OS Name (Reported) -SM_NODE_CLIENT_OS_VER Client OS Version (Reported) -SM_NODE_CLIENT_OS_PID Client OS Product ID (Reported) -SM_NODE_CLIENT_HOST Client Host Name (Reported) -SM_NODE_CLIENT_IP Client IP Address (Reported) -SM_NODE_CLIENT_PORT Client Port (Reported) -SM_NODE_SERVER_HOST Server Host Name (Reported) -SM_NODE_SERVER_IP Server IP Address (Reported) -SM_NODE_SERVER_PORT Server Port (Reported) -SM_NODE_PROXY_HOSTNAME Proxy Host Name (Reported) -SM_NODE_PROXY_IP Proxy IP Address (Reported) -SM_NODE_PROXY_PORT Proxy Port (Reported) -SM_MAC_COLUMN_1 Session Name -SM_MAC_COLUMN_2 MAC Address -SM_MAC_COLUMN_3 Created at -SM_MAC_COLUMN_4 Updated at -SM_MAC_COLUMN_5 Location -SM_MAC_COLUMN_1A VLAN ID -SM_SESSION_FILTER \ (Displays only entries of session %S) -SM_IP_COLUMN_1 Session Name -SM_IP_COLUMN_2 IP Address -SM_IP_COLUMN_3 Created at -SM_IP_COLUMN_4 Updated at -SM_IP_COLUMN_5 Location -SM_MAC_IP_DHCP %S (DHCP) -SM_MACIP_LOCAL On This Server -SM_MACIP_SERVER On '%S' -SM_SNAT_STATUS SecureNAT Operating Status -SM_SNAT_NUM_SESSION %u Session -SM_SNAT_NUM_CLIENT %u Client -SM_SNAT_IS_KERNEL Kernel-mode NAT is Active -SM_SNAT_IS_RAW Raw IP mode NAT is Active -SM_BRIDGE_TOO_OLD_VER The Local Bridge function is not supported by the version of the VPN Server that is currently connected. \r\nTry update to a new version. -SM_BRIDGE_UNSUPPORTED Unable to use the Local Bridge function with the operating system that this VPN Server is operating on. For the list of operating system that the Local Bridge function can be used on, refer to the online documentation of the VPN Server. -SM_BRIDGE_WPCAP_REMOTE In order to use the Local Bridge function on this VPN Server, you must install the WinPcap software. The software WinPcap is currently not installed on the server computer. \r\n\r\nTo continue the installation of the WinPcap software, you must start SoftEther VPN Server Manager on the server computer that is running VPN Server and then while connected to localhost (location of your own computer), have the Local Bridge Function Setting window displayed. \r\nTo continue, first exit this management session, and then, after starting SoftEther VPN Server Manager on the server computer, connect to localhost and continue the setting process. -SM_BRIDGE_WPCAP_ROOT In order to use the Local Bridge function on this VPN Server, you must install the WinPcap software. \r\n\r\nTo continue the installation you must log in to this computer as a user with administrator privileges. \r\nLog on as an administrator and start the SoftEther VPN Server Manager again. -SM_BRIDGE_WPCAP_INSTALL In order to use the Local Bridge function on this VPN Server, you must install the WinPcap software. The software WinPcap is currently not installed on the server computer. \r\n\r\nWinPcap is an easy-to-install free software that is bundled together with the VPN Server. \r\n\r\nDo you want to begin the installation of WinPcap? -SM_BRIDGE_WPCAP_REBOOT1 After WinPcap installation has completed, you must restart the computer before you use the Local Bridge function again. \r\n\r\nAfter you restart the computer manually and start VPN Server, configure the settings for the Local Bridge function. -SM_BRIDGE_WPCAP_REBOOT2 After WinPcap installation has completed, you must restart the SoftEther VPN Server service before you use the Local Bridge function again. \r\n\r\nIt only takes a short time to restart the SoftEther VPN Server service, however all sessions that are currently connected to the VPN Server will be disconnected. \r\nThis management session will also be disconnected, so you will need to reconnect to continue. \r\n\r\nDo you want to restart the SoftEther VPN Server service? -SM_BRIDGE_RESOURCE Unable to load the WinPcap driver. -SM_BRIDGE_COLUMN_1 Number -SM_BRIDGE_COLUMN_2 Virtual Hub Name -SM_BRIDGE_COLUMN_3 Network Adapter or Tap Device Name -SM_BRIDGE_COLUMN_4 Status -SM_BRIDGE_OFFLINE Offline -SM_BRIDGE_ONLINE Operating -SM_BRIDGE_ERROR Error -SM_BRIDGE_OK The Local Bridge connection definition has been added. -SM_BRIDGE_DELETE Do you want to delete the Local Bridge from Virtual Hub "%s" to device "%s"? -SM_BRIDGE_DELETE_OK The Local Bridge has been deleted. -SM_BRIDGE_INTEL While in the condition that occurs immediately after a new bridge connection is made when bridging to a physical network adapter, depending on the type of network adapter, there are cases where it will not be possible to communicate using TCP/IP to the network adapter using a bridge connection from a computer on the virtual network. \r\n(This phenomenon is known to occur for Intel and Broadcom network adapters.) \r\n\r\n\r\nIf this issue arises, remedy the situation by restarting the computer on which VPN Server / Bridge is running. Normal communication will be possible after the computer has restarted. \r\n\r\n\r\nAlso many wireless network adapters will not respond to the sending of packets in promiscuous mode and when this occurs you will be unable to use the Local Bridge. If this issue arises, try using a regular wired network adapter instead of the wireless network adapter. -SM_BRIDGE_VPN You are attempting to make a Local Bridge to "%S".\r\n\r\nA Local Bridge is made between a Virtual Hub and a physical network adapter in usual usage. It is unusual to make a Local Bridge to a Virtual Network Adapter.\r\nPlease make sure that it is your intention.\r\n\r\nDo you really want to continue? -SM_BRIDGE_INFO_1 Select the Ethernet device (network adapter) for the bridge destination. -SM_BRIDGE_INFO_2 Enter a name of the new tap device to create. -SM_CONFIG_SAVED The configuration file has been saved. -SM_CONFIG_SAVE_FAILED Failed to save the configuration file. -SM_CONFIG_OPEN_FAILED Unable to open the specified file. -SM_CONFIG_CONFIRM This will apply the specified configuration file to the VPN Server. The VPN Server will automatically restart and it will start loading the new configuration file. The users who are currently connected to the VPN Server will be disconnected. This management session will also be disconnected, you will be needing to reconnect to the server. \r\n\r\nDo you want to proceed? -SM_CONFIG_WRITE_OK The configuration file on the server side has been overwritten. -SM_AO_COLUMN_1 Item -SM_AO_COLUMN_2 Value -SM_TRUE_OR_FALSE Set either 0 (false) or 1 (true) for this item. -SM_AO_SET_OK The Virtual Hub Administration Option has been set. -SM_EXT_OPTION_SET_OK The Virtual Hub Extended Option has been set. -SM_PASSWORD_MSG Currently an administrator password has not been set for this VPN Server. It is recommended that a password is set. \r\n\r\nDo you want to set a server administrator password? -SM_L3_SW_COLUMN1 Layer 3 Switch Name -SM_L3_SW_COLUMN2 Running Status -SM_L3_SW_COLUMN3 Interfaces -SM_L3_SW_COLUMN4 Routing Tables -SM_L3_SW_ST_F_F Stop -SM_L3_SW_ST_T_F Start (Error) -SM_L3_SW_ST_T_T Start (Running) -SM_L3_SW_DEL_MSG This will delete the Virtual Layer 3 Switch "%S". \r\nDo you really want to do this? -SM_L3_SW_IF_COLUMN1 IP Address -SM_L3_SW_IF_COLUMN2 Subnet Mask -SM_L3_SW_IF_COLUMN3 Virtual Hub Name -SM_L3_SW_TABLE_COLUMN1 Network Address -SM_L3_SW_TABLE_COLUMN2 Subnet Mask -SM_L3_SW_TABLE_COLUMN3 Gateway Address -SM_L3_SW_TABLE_COLUMN4 Metric -SM_SECURE_NAT_MSG Are you sure you want to enable the SecureNAT?\r\n\r\nIf you enable the SecureNAT, a virtual router with virtual NAT function will be created that has one IP address in the Virtual Hub. This Virtual Router will interact as one computer or router with other computers that are connected to the virtual network. \r\n\r\nThe SecureNAT in the Virtual NAT enables any computers connected to the Virtual Hub to establish communication with an external network via the SecureNAT. \r\nTherefore, when SecureNAT is running on this VPN Server, there is no need to use local VPN Client to connect the self-computer's Virtual Hub.\r\n\r\n\r\nAlso, please take care about that if there is already a DHCP server in a location that can be reached from a Virtual Hub Layer 2 segment, disable the DHCP server function by clicking the SecureNAT Configuration, otherwise there will be a DHCP conflict. \r\n\r\nMoreover, you can disable the NAT function and only use the DHCP server if you wish. -SM_CRL_COLUMN_1 Certificate Summary -SM_CRL_DELETE_MSG This will delete the selected item. Do you really want to do this? -SM_CRL_EMPTY_MSG No items have been selected. \r\nIf you add this certificate revocation entry, all certificates will be judged as invalid and all client connections that are made in certificate authentication mode will be refused. \r\n\r\nDo you really want to do this? -SM_AC_COLUMN_1 ID -SM_AC_COLUMN_2 Priority -SM_AC_COLUMN_3 Action -SM_AC_COLUMN_4 Contents -SM_AC_PASS Pass -SM_AC_DENY Deny -SM_LOG_FILE_COLUMN_1 Log File Name -SM_LOG_FILE_COLUMN_2 File Size -SM_LOG_FILE_COLUMN_3 Updated on -SM_LOG_FILE_COLUMN_4 Location -SM_READ_LOG_FILE_INFO_1 Please wait until processing is finished... -SM_READ_LOG_FILE_INFO_2 %S in process, %S has finished... -SM_READ_LOG_FILE_ERROR Failed to download file -SM_READ_SAVE_DLG_TITLE Specify a File Name for the Log File's Save Destination -SM_READ_SAVE_DLG_FILTER Log Files (*.LOG)|*.log|All Files (*.*)|*.* -SM_READ_SAVE_FAILED Failed to save the log file. -SM_READ_SAVE_TMP_FAILED Unable to write to temporary file "%S". -SM_READ_SAVE_OPEN_ERROR Unable to open temporary file "%S". \r\n\r\nIt is possible that the .LOG file extension is not an assigned file type in Windows. -SM_LICENSE_COLUMN_1 Number -SM_LICENSE_COLUMN_2 License Key -SM_LICENSE_COLUMN_3 License Type Name -SM_LICENSE_COLUMN_4 Status -SM_LICENSE_COLUMN_5 Expiration Date -SM_LICENSE_COLUMN_6 License ID -SM_LICENSE_COLUMN_7 License Type ID -SM_LICENSE_COLUMN_8 Server ID -SM_LICENSE_COLUMN_9 Serial ID -SM_LICENSE_INFINITE Infinite -SM_LICENSE_NO_EXPIRES No Expiration -SM_LICENSE_STATUS_EDITION Product Edition -SM_LICENSE_STATUS_RELEASE Release Date of VPN Server -SM_LICENSE_STATUS_SYSTEM_ID Current Server ID -SM_LICENSE_STATUS_EXPIRES Expiration of Current Product License -SM_LICENSE_STATUS_SUBSCRIPTION Status of Subscription Contract -SM_LICENSE_STATUS_SUBSCRIPTION_NONEED No Need (This Edition requires no subscription keys) -SM_LICENSE_STATUS_SUBSCRIPTION_NONE No Keys (Adding a subscription key is required) -SM_LICENSE_STATUS_SUBSCRIPTION_VALID Subscription is Active [Until %s] -SM_LICENSE_STATUS_SUBSCRIPTION_EXPIRED Subscription is Expired [at %s] -SM_LICENSE_STATUS_SUBSCRIPTION_BUILD Version Allowed by Current Contract -SM_LICENSE_STATUS_SUBSCRIPTION_BUILD_STR Free Upgrade to Any Future Versions Released Until %s is Allowed -SM_LICENSE_STATUS_ENTERPRISE Enterprise Functions Availability -SM_LICENSE_STATUS_ENTERPRISE_YES Yes (Available) -SM_LICENSE_STATUS_ENTERPRISE_NO No (Unavailable) -SM_LICENSE_NUM_USER Allowed User Objects to Create -SM_LICENSE_NUM_CLIENT Allowed Concurrent Clients -SM_LICENSE_NUM_BRIDGE Allowed Concurrent Bridges -SM_NO_LICENSE_COLUMN Caution: -SM_NO_LICENSE Because there are no product licenses registered, this VPN Server's communication function doesn't operate. -SM_LICENSE_DELETE_MSG Are you sure you want to delete the selected license from the VPN Server? -SM_SYSLOG_0 Disable Syslog Send Function -SM_SYSLOG_1 Send Server Logs by Syslog -SM_SYSLOG_2 Send Server and Virtual Hub Security Logs by Syslog -SM_SYSLOG_3 Send Server, Virtual Hub Security, and Packet Logs by Syslog -SM_SETUP_INFO_1 Click Next to start Setup. Click Close if you want to exit the setup and manually configure all settings. -SM_SETUP_INFO_2 Click Close to configuring the settings of a VPN server manually by yourself. -SM_SETUP_BRIDGE_ONLY You are currently connected to VPN Bridge. You can only create VPN Bridge at Each Site for Multi-site VPN. -SM_SETUP_BRIDGE_EDGE VPN Bridge at &Each Site -SM_SETUP_WARNING The current settings of this VPN Server or VPN Bridge will be initialized. \r\nDo you really want to do this? -SM_SETUP_SELECT Select the Ethernet device to establish the bridge connection. -SM_SETUP_NO_LICENSE_KEY Currently there is no licenses registered for this SoftEther VPN Server. \r\n\r\nFor SoftEther VPN Server to operate as a VPN server, you must enter a license key. \r\nDo you want to display the License Manager?\r\n\r\n(To use the VPN Server as a Trial Version, you have to obtain a trial key from the SoftEther VPN Project web site.\r\nClick Yes and click Obtain or Extend of License button to obtain a trial key. -SM_HUBEXT_OPTION_TITLE Virtual Hub Extended Options -SM_HUBEXT_OPTION_STATIC1 Virtual Hub Extended Options allows you to configure more detailed parameters of this Virtual Hub. -SM_HUBEXT_OPTION_STATIC2 By default, both VPN Server's global administrators and individual Virtual Hub's administrators can modify the Virtual Hub Extended Options.\nHowever, if the deny_hub_admin_change_ext_option is set to 1 on the Virtual Hub Admin Options, the individual Virtual Hub's administrators cannot modify the Virtual Hub Extended Options. (View only.) -SM_VLAN_COLUMN_0 Network Adapter Name -SM_VLAN_COLUMN_1 Driver Type -SM_VLAN_COLUMN_2 Driver File Name -SM_VLAN_COLUMN_3 VLAN Transparency Setting -SM_VLAN_COLUMN_4 GUID -SM_VLAN_COLUMN_5 Device Instance ID -SM_VLAN_YES Enabled -SM_VLAN_NO Not Enabled -SM_VLAN_MSG_1 The Windows Registry has been configured to allow the network adapter "%S" to transmit / receive tagged-VLAN packets.\r\n\r\nHowever, there are some network adapters which requires additional settings on the property of the Device Manager on the local computer's Windows to set the parameters to enable Jumbo Frames. (Ethernet frames which are larger than 1,512 bytes.) Unless you enable Jumbo Frames, some large VLAN packets will be dropped. In the case if large VLAN packets always disappeared, please enable Jumbo Frames. (For example, set the maximum size to 4,088 bytes.) The Device Manager in Windows will help you to configure.\r\n\r\nThis VLAN Transparency Setting has been written to the Windows Registry, however it is not guaranteed that VLAN packets can be transmitted effectively.\r\nIf transmitting VLAN tagged packets will fail after this configuration, refer the manual of the network adapter "%S" to configure manually and adequately. Moreover, "%S" might not support the VLAN transparency setting. In that case, such a network adapter cannot be used to transmit VLAN frames. Use other products.\r\n\r\nTo apply this setting, Windows which runs VPN Server must be rebooted. Do not forget to reboot it. -SM_VLAN_MSG_2 The Windows Registry parameters which was enabling the VLAN transparency features on the network adapter "%S" are deleted from the Registry.\r\n\r\nIf you did a Jumbo Frame enable settings last time, undo such changes manually.\r\n\r\nTo apply this setting, Windows which runs VPN Server must be rebooted. Do not forget to reboot it. -SM_VLAN_NOTHING There are no network adapters which VLAN Transparency Setting Tool supports on the computer "%S".\r\n\r\nHowever, some network adapters are capable to transmit VLAN tagged packets by default, or can be configured to perform VLAN tagged packets by specific configuration utility provided by the vendor.\r\nBy using such network adapters, you have to configure such settings by yourself manually. -SM_SERVER_ADMIN_MSG VPN Server / Bridge "%S" -SM_ETHERIP_COLUMN_0 ISAKMP Phase 1 ID -SM_ETHERIP_COLUMN_1 Virtual Hub Name -SM_ETHERIP_COLUMN_2 User Name -SM_ETHERIP_ADD_OK A new EtherIP / L2TPv3 client setting has been registered. -SM_IPSEC_SETUP_QUESTION This VPN Server has a function to accept IPsec / L2TP / EtherIP / L2TPv3 compatible VPN clients or VPN router products.\r\n\r\nYou can allow the VPN Server to accept connections from smartphones such as iPhone, iPad, Android, or standard VPN client functions on Mac OS X or Windows.\r\n\r\nDo you want to set up the IPsec?\r\n(IPsec settings can be configured by clicking "IPsec / L2TP Settings" button any time later.) -SM_OPENVPN_CONFIG_SAVE_OK The ZIP file '%s' which contains the setting files for OpenVPN.\r\n\r\nOpen this ZIP file to extract sample configuration files for OpenVPN which can be used immediately and easily.\r\nYou might be required to revise the configuration file a little.\r\n\r\nFor details please read the 'readme.txt' file in the ZIP file.\r\n\r\nDo you want to open this ZIP file now? -SM_OPENVPN_CONFIG_SAVE_NG Failed to save the ZIP file '%s'. -SM_OPENVPN_CONFIG_OPEN_NG Failed to open the ZIP file '%s'. Please open this file manually. -SM_DDNS_IPV4_ERROR Unable to reach the IPv4 DDNS Server. -SM_DDNS_IPV6_ERROR Unable to reach the IPv6 DDNS Server. -SM_DDNS_FQDN_EMPTY (None) -SM_DDNS_OK_MSG The Dynamic DNS hostname: %S%S\r\n\r\nYou can access to the below IP address by specifying the above DNS hostname.\r\n\r\nIPv4 Address: %s\r\nIPv6 Address: %s\r\n\r\nYou can also specify the following special forms of hostnames to specify IPv4 or IPv6 as the address-type explicitly.\r\n\r\nHostname for IPv4: %S.v4%S\r\nHostname for IPv6: %S.v6%S\r\n -SM_DDNS_OK_TITLE Dynamic DNS Function -SM_DDNS_OK_MSG2 The Dynamic DNS hostname has been changed to '%S'.\r\n\r\nClick Hint to read additional information. -SM_DDNS_KEY_TITLE Dynamic DNS Key -SM_DDNS_KEY_MSG Your Dynamic DNS Private Key: %s\r\n\r\nThis is the private key which is associated with your current DDNS name. If your VPN Server PC damaged and lost the key, the current DDNS name will be occupied forever and other VPN Server will not be able to use the same name.\r\nIf you want to continue to use the same name, keep the key on a safe place, such as an Internet storage, an another PC or a notepad.\r\nWhen applying the key to the new VPN Server, edit the configuration file of the VPN Server to replace the key by the string in the value following to "byte Key" in the "declare DDnsClient" directive.\r\nDo not use the duplicated key to two or more VPN Servers at the same time. -SM_DDNS_KEY_ERR Failed to read the DNS key. -SM_IPSEC_PSK_TOO_LONG The pre-shared key (PSK) has 10 or more letters.\r\n\r\nIt is reported that several versions of Google Android has a serious bug with 10 or more letters pre-shared key.\r\nTherefore 9 or less letters are recommended for pre-shared key.\r\n\r\nDo you want to try another pre-shared key? -SM_ADVANCED_REDIRECT_URL_HINT_TITLE How to Use Advanced HTTP Redirection Function -SM_ADVANCED_REDIRECT_URL_HINT Advanced HTTP Redirection (For Experts)\r\n\r\nThe string "" is a place holder. It can embedded on the URL of redirection.\r\n\r\nEmbedded URL Example:\r\nhttp://www.google.com/search?q=|secret\r\n\r\nWhen the client is being redirected, the actual destination URL of redirection will be replaced as follows.\r\n\r\nUsername|Session ID|IP Address|Date and Time|Hash Value\r\n\r\\nAfter Replacement Example: zurukko|SID-ZURUKKO-123|219.117.219.154|20131117100354|99707160AFE7A454042B2C47B064112D652452D7\r\n\r\nThe details of each fields are described as following.\r\n\r\nUsername: The username using for the current VPN Session will be placed.\r\n\r\nSession ID: The Session ID of the VPN Session will be placed.\r\n\r\nDate and Time: 14-digits will be placed as 'YYYYMMDDHHMMSS' format (Time zone is UTC).\r\n\r\nHash Value: A 40-characters hexadecimal strings which represent 20 bytes binary data. The binary data is the result of SHA-1 hash function to the temporary string. The temporary string is the combination of the bit-array of the above fields plus the secret string after the '|' symbol in the redirection URL. (In the above example, "secret" is the secret string.) If there are no '|' symbols in the URL, no hash value will be appended.\r\n\r\nThe Purpose of Hash Value: The secret string is effective as the secret key. Thanks to the secret key, the CGI program which receives the query strings on the redirected URL can verify the integrity of the parameters included in the URL.\r\n -SM_ADVANCED_REDIRECT_URL_MSG An URL must start with "http://" or "https://" -SM_DISABLE_DDNS_HINT_CAPTION Disable Dynamic DNS Function -SM_DISABLE_DDNS_HINT To disable the Dynamic DNS Function, modify the configuration file of VPN Server.\r\n\r\nThe "declare root" directive has the "declare DDnsClient" directive. In this directive, you can switch "bool Disable" from false to true, and reboot the VPN Server, then the Dynamic DNS Function will be disabled.\r\n -SM_REGENERATE_CERT_MSG The certificate of VPN Server is being replaced to the new one.\r\n\r\nThis will affect all VPN Clients which are configured to verify the certificate of VPN Server.\r\nDo you want to continue? -SM_DDNS_SERVER_CERT_MSG The DDNS hostname has been changed to "%S".\r\n\r\nIf you are planning to use Microsoft SSTP VPN to connect to the VPN Server from Windows Vista or greater versions of Windows with specifying the DDNS hostname as the destination of VPN Server, the destination hostname of the VPN Server must exactly match to the CN (Common Name) field on the certificate of VPN Server due to the security.\r\n\r\nDo you want to regenerate the server certificate in order to match the CN value to "%S"?\r\n(Click No to keep using the current server certificate.) -SM_DDNS_SERVER_CERT_OK The SSL certificate of VPN Server is now regenerated.\r\n\r\nWhen you make Microsoft SSTP VPN client connects to the VPN Server, you should specify the current DDNS hostname "%S" as the destination server hostname.\r\nYou have to also prepare the "Trusted Root Certificates" list on the Windows to add the certificate of this VPN Server beforehand.\r\n(To install a root certificate to Windows, open MMC and navigate to "Local Computer" in the "Certificates" applet. After that, you can import a certificate into the trusted root certification list.\r\n For details refer Microsoft's documents.)\r\n\r\nDo you want to save the new SSL certificate as a file in the X.509 format? -SM_SETUP_STEP_SECURENAT This VPN Server / Bridge might be running as user-more, or by other limitations, the Virtual Hub and a physical network adapter cannot be bridged together. Instead, the SecureNAT function allows VPN Clients to communicate with other computers in the physical network. The SecureNAT function was enabled by default. You can configure or disable it. -SM_SETUP_STEP_SECURENAT_TITLE Step 3. Bridge Virtual Hub and Physical Network -SM_UPDATE_CHECK_TITLE_VPNSERVER %S VPN Server (on the host '%S') -SM_UPDATE_CHECK_TITLE_VPNBRIDGE %S VPN Bridge (on the host '%S') -SM_FACTORY_DEFAULT_WARNING This will perform a factory-reset on the VPN Server / Bridge.\r\nThe current configuration of VPN Server / Bridge will be erased, and the initial settings will be applied immediately.\r\nYou are recommended to make a backup copy of the current configuration before do a factory-reset.\r\n\r\nPress OK to perform a factory-reset. The VPN Server / Bridge will be rebooted. The current management connection will be disconnected, so please re-connect to the VPN Server / Bridge.\r\n\r\nPress Cancel to cancel the operation. -SM_FACTORY_DEFAULT_PERFORMED The factory-reset operation is performing on the server.\r\n\r\nPress OK to exit the current session of VPN Server Manager.\r\nAfter exiting, please re-start the VPN Server Manager and connect to the VPN Server again.\r\nThen you will see the VPN Server is reset. -SM_AZURE_STATUS_CONNECTED Status: Connected -SM_AZURE_STATUS_NOT_CONNECTED Status: Not Connected -SM_NO_BRIDGE_NICS No physical network adapters suitable for Local Bridge were found on the VPN server computer.\r\nIn order to create a Local Bridge, you have to install at least one physical network adapters on the computer.\r\nYou cannot use Wi-Fi adapters or 3G adapters for Local Bridge.\r\nPlease install a physical network adapter which is compatible to wired Ethernet.\r\n\r\nIf a recently-installed network adapter doesn't appear, once reboot the computer.\r\n\r\nIf the Local Bridge cannot be used anyway, you can use "SecureNAT Function" instead.\r\n\r\nIf you have a certain reason to use unusual network adapters (i.e. Wi-Fi adapters, 3G adapters or virtual adapters), set the "ShowAllInterfaces" variable on the "LocalBridgeList" directive to "true" and restart the VPN Server. Then such devices will appear on the list. (For advanced Windows users only.)\r\n\r\nIf this error occurs after you upgraded Windows, please re-install SoftEther VPN Server or SoftEther VPN Bridge> -SM_CERT_MESSAGE The current SSL self-signed root certificate on this VPN Server is in the old format.\r\n\r\nSome versions of OpenVPN Connect for Android have a bug to misinterpret SSL certificates in the old format. It might cause the connection problem from OpenVPN Connect for Android to this VPN Server.\r\n\r\nIf you are planning to use OpenVPN Connect for Android as a VPN client, it is recommended to regenerate the SSL server certificate.\r\n\r\nDo you want to regenerate the server certificate now? -SM_CERT_MESSAGE_CLI --- Caution ---\r\n\r\nThe current SSL self-signed root certificate on this VPN Server is in the old format.\r\n\r\nSome versions of OpenVPN Connect for Android have a bug to misinterpret SSL certificates in the old format. It might cause the connection problem from OpenVPN Connect for Android to this VPN Server.\r\n\r\nIf you are planning to use OpenVPN Connect for Android as a VPN client, it is recommended to regenerate the SSL server certificate.\r\n\r\nTo regenerate and update the server certificate, execute the "ServerCertRegenerate" command after updating the VPN Server to the latest version. -SM_CERT_NEED_ROOT The specified SSL certificate is a sub-certificate which was issued by a CA (Certificate Authority).\r\n\r\nIf you are planning to support either Microsoft SSTP or OpenVPN protocol on this VPN server, you have to install the root certificate and all intermediate certificates (if exists) on this VPN Server.\r\n\r\nTo install these certificates, copy the root certificate and all intermediate certificate files (in the X.509 format) into the "chain_certs" subdirectory on the directory which is VPN Server has been installed on.\r\n\r\nIf you don't know how to obtain root and intermediate certificate files for your certificate authority (CA), please refer to the CA's web site or contact technical support staffs of the CA. - - -# Concerning User-mode Router Administration Tools -NM_TITLE deleted -NM_CONNECT_TITLE deleted -NM_STATUS_TAG Connection status: %s -NM_OFFLINE You are not connected to any VPN Servers. -NM_CONNECTING Connecting to VPN Server -NM_CONNECTED Connected to VPN Server "%S" -NM_CONNECT_ERROR Error number %u (%s) -NM_ACCOUNT_TITLE deleted -NM_STATUS User-mode Router Status -NM_STATUS_CONNECT Connection Status -NM_STATUS_TCP NAT TCP/IP Sessions -NM_STATUS_UDP NAT UDP/IP Sessions -NM_STATUS_ICMP NAT ICMP Sessions -NM_STATUS_DNS NAT DNS Sessions -NM_STATUS_DHCP Allocated DHCP Clients -NM_INFO User-mode Router information -NM_INFO_PRODUCT_NAME Product Name -NM_INFO_VERSION_STR Version information -NM_INFO_BUILD_INFO Build information -NM_INFO_HOSTNAME Host name -NM_NAT_ID ID -NM_NAT_PROTOCOL Protocol -NM_NAT_SRC_HOST Source Host -NM_NAT_SRC_PORT Source Port -NM_NAT_DST_HOST Destination Host -NM_NAT_DST_PORT Destination Port -NM_NAT_CREATED Session Created On -NM_NAT_LAST_COMM Last Communication Time -NM_NAT_SIZE Receive / Send Size -NM_NAT_TCP_STATUS TCP Connection Status -NM_NAT_PROTO_TCP TCP/IP -NM_NAT_PROTO_UDP UDP/IP -NM_NAT_PROTO_DNS DNS -NM_NAT_PROTO_ICMP ICMP -NAT_TCP_CONNECTING Connecting -NAT_TCP_SEND_RESET Disconnecting -NAT_TCP_CONNECTED Connected -NAT_TCP_ESTABLISHED Running -NAT_TCP_WAIT_DISCONNECT Disconnecting -DHCP_DHCP_ID ID -DHCP_LEASED_TIME Leased at -DHCP_EXPIRE_TIME Expires at -DHCP_MAC_ADDRESS MAC Address -DHCP_IP_ADDRESS Allocated IP -DHCP_HOSTNAME Client Host Name -NM_PASSWORD_MSG The administration password has been set. -NM_PUSH_ROUTE_WARNING The specified text of the static routing table may have a syntax error. - - -# Concerning version information -ABOUT_CAPTION About %s -BETA_EXPIRES Because the currently installed SoftEther VPN software is a beta version, you cannot use it after the provision of a newer beta version of full version. \r\nAccess http://selinks.org/ and get the latest version of SoftEther VPN software. - - -# Concerning the saving of logs -# (Common log) -L_YES Yes -L_NO No -L_LINE ------------------------------------------------------ - -# (Server log) -LS_START_UTF8 Log Messages are written with UTF-8 Encoding Format. -LS_START_1 The SoftEther VPN Server has been started. -LS_START_2 %S %S -LS_START_3 %S -LS_END_1 The SoftEther VPN Server Engine has been successfully shutdown. -LS_END_2 The Server Engine shutdown processing has started. -LS_STOP_ALL_LISTENER All TCP listeners will be stopped. -LS_STOP_ALL_LISTENER_2 All TCP listeners have been stopped. -LS_STOP_ALL_HUB Stopping all Virtual Hubs. -LS_STOP_ALL_HUB_2 All Virtual Hubs have been stopped. -LS_STOP_CEDAR Shutting down the Cedar communication module. -LS_STOP_CEDAR_2 The Cedar communication module has been shut down. -LS_STOP_FARM_MEMBER Disconnecting connection to the cluster controller. -LS_STOP_FARM_MEMBER_2 Connection with the cluster controller has been disconnected. -LS_STOP_FARM_CONTROL Cluster controller is stopping. -LS_STOP_FARM_CONTROL_2 Cluster controller has stopped. -LS_ENUM_ETHERNET_1 Ethernet device has been enumerated. -LS_ENUM_ETHERNET_2 Device %u: "%S" -LS_LOAD_CONFIG_1 Loading the configuration file. -LS_LOAD_CONFIG_2 The configuration file has been loaded. -LS_LOAD_CONFIG_3 Configuration file does not exist. Attempting to start using initial settings. -LS_INIT_SAVE_THREAD Starting the automatically saving background task. The interval between auto-saves is %u seconds. You can change the interval by changing the parameter AutoSaveConfigSpan in the configuration file. -LS_BAD_CONFIG The contents of the configuration file is invalid. The loading process has been terminated. -LS_LISTENER_START_1 TCP Listener (port %u) is starting. -LS_LISTENER_START_2 TCP Listener (port %u) has started. Now listening for connection from client. -LS_LISTENER_START_3 Unable to set port to Listen status for TCP Listener (port %u). Attempting at fixed intervals until successful. -LS_LISTENER_ACCEPT On the TCP Listener (Port %u), a Client (IP address %S, Host name "%S", Port number %u) has connected. -LS_LISTENER_DISCONNECT The connection with the client (IP address %S, Port number %u) has been disconnected. -LS_LISTENER_DOS A DoS attack on the TCP Listener (port %u) has been detected. The connecting source IP address is %S, port number is %u. This connection will be forcefully disconnected now. -LS_LISTENER_MAXUEC The TCP listener is temporary suspending to accept new inward connections because of the number of pending TCP connections exceeded %u. (Current value = %u) -LS_LISTENER_STOP_1 TCP Listener (port %u) is stopping. -LS_LISTENER_STOP_2 TCP Listener (port %u) has stopped. -LS_HUB_START Virtual Hub "%S" has been started. -LS_HUB_STOP Virtual Hub "%S" has been stopped. -LS_HUB_MAC The MAC address of Virtual Hub "%S" is "%S". -LS_NODE_INFO_TAG Client product name: "%S", Client version: %u, Client build number: %u, Server product name: "%S", Server version: %u, Server build number: %u, Client OS name: "%S", Client OS version: "%S", Client product ID: "%S", Client host name: "%S", Client IP address: "%S", Client port number: %u, Server host name: "%S", Server IP address: "%S", Server port number: %u, Proxy host name: "%S", Proxy IP address: "%S", Proxy port number: %u, Virtual Hub name: "%S", Client unique ID: "%S" -LS_CONNECTION_START_1 For the client (IP address: %S, host name: "%S", port number: %u), connection "%S" has been created. -LS_CONNECTION_END_1 Connection "%S" has been terminated. -LS_SSL_START SSL communication for connection "%S" has been started. The encryption algorithm name is "%S". -LS_CONNECTION_ERROR Connection "%S" terminated by the cause "%s" (code %u). -LS_FARMMEMBER_NOT_ADMIN Connection "%S": Although the server is a cluster member, the client attempted that to directly connect to the Virtual Hub "%S" while not being administrator user "%S". The user name provided by the client is "%S". Access is refused. -LS_HUB_NOT_FOUND Connection "%S": Virtual Hub "%S" that the client is trying to connect to does not exist on the server. -LS_IP_DENIED Connection "%S": The source IP address "%S" of the client has refused based on the Source IP Address Limit List defined for the Virtual Hub. -LS_LICENSE_ERROR Connection "%S": Because a license-related error has been occurred, the client is unable to connect to the server. -LS_BETA_EXPIRES This beta version of SoftEther VPN Server is expired. The beta version period of use has expired. Download a new beta version or full version from http://selinks.org/. -LS_TICKET_1 A new client authentication ticket has been issued for cluster member "%S". Virtual Hub "%S", User name "%S" ("%S"), Session name "%S", Ticket "%S" -LS_TICKET_2 A new client authentication ticket has been received from the cluster controller. Virtual Hub "%S", User name "%S" ("%S"), Session name "%S", Ticket "%S", Expiration %u seconds -LS_ENUM_HUB Connection "%S": %u Virtual Hub servers have been enumerated on this server. -LS_FARM_ACCEPT_1 Connection "%S": Although this server received a cluster control connection request, this server is not a cluster controller. -LS_FARM_ACCEPT_2 Connection "%S":Although this server received a cluster control connection request, the authentication password is incorrect and connection has been refused. -LS_FARM_ACCEPT_3 Connection "%S": This server received a cluster control connection request. Authentication has been successful. -LS_FARM_SERV_START Connection with a cluster member has been established. IP address: %S, Host name: "%S" -LS_FARM_SERV_END Connection with cluster member "%S" has been deleted. -LS_FARM_CONNECT_1 Connection to cluster controller "%S" has started. -LS_FARM_CONNECT_2 Connection to cluster controller "%S" has been refused. Error: %s (code %u) -LS_FARM_CONNECT_3 TCP connection to cluster controller "%S" failed. Continuing to attempt connection in intervals of %u seconds until connection is successful. -LS_FARM_DISCONNECT Connection to the cluster controller has stopped. -LS_FARM_START Connected to cluster controller. Operation as cluster member is starting. -LS_LICENSE_NOT_VPNSERVER Connection "%S": License error occurred. The VPN Client attempted to connect while the VPN Server product license is not yet registered. -LS_LICENSE_NOT_VPNCLUSTER Connection "%S": License error occurred. The license registered on this VPN Server is of a type that prevents the use of the current clustering function and a VPN Client has attempted connection while operating in Cluster mode. You must restart the VPN Server. -LS_LICENSE_VIOLATION Connection "%S": A license violation has occurred on the VPN Server and connections are not being received. -LS_LICENSE_VIOLATION_DETECTED A license violation has been detected. A different VPN Server is operating with the same server ID "%I64u" as this VPN Server. It is possible that there are two or more VPN Servers in the cluster that are using the same license. Check the license information of each VPN Server. -LS_API_AUTH_OK HTTPS API client "%r:%u" (%S): Administration mode: "%S": The embedded HTTPS web server accepted the successful login. Username: "%S", Method: "%S", Path: "%S" -LS_API_AUTH_ERROR HTTPS API client "%r:%u" (%S): The embedded HTTPS web server refused a login attempt. Username: "%S", Method: "%S", Path: "%S" -LS_API_RPC_CALL HTTPS API client "%r:%u" (%S): The client called a JSON-API. Method: "%S", Returned error code: %u (0 = success), Returned error message: "%s" - - -# (Proto log) -LP_PREFIX_SESSION [%s] %r:%u -> %r:%u (%s): -LP_SESSION_CREATED Session created. -LP_SESSION_DELETED Session deleted. - - -# (OpenVPN Logs) -LO_PREFIX_RAW OpenVPN Module: -LO_PREFIX_SESSION OpenVPN Session %u (%r:%u -> %r:%u): -LO_PREFIX_CHANNEL OpenVPN Session %u (%r:%u -> %r:%u) Channel %u: -LO_NEW_CHANNEL A new channel is created. -LO_CHANNEL_ESTABLISHED_NEWKEY The channel is established. (Trigger: Re-key completion.) -LO_OPTION_STR_RECV Option Strings Received: "%S" -LO_CLIENT_CERT Client certificate received (subject: CN="%s"), will use certificate authentication. -LO_CLIENT_UNVERIFIED_CERT Client certificate was provided but did not pass verification (error="%S"), will use password authentication. -LO_CLIENT_NO_CERT Client certificate is not provided, will use password authentication. -LO_OPTION_STR_SEND Option Strings to Send: "%S" -LO_INITIATE_REKEY The re-keying process is started. -LO_CHANNEL_ESTABLISHED The channel becomes the established state. -LO_PUSH_REPLY The full strings replied: "%S" -LO_CHANNEL_FAILED Failed to connect a channel. -LO_CHANNEL_DISCONNECTED_BY_HUB This OpenVPN channel is being terminated because the administrator of the Virtual Hub has disconnected this the VPN Session. - - -# (IPsec Logs) -LI_PREFIX_RAW IPsec Module: -LI_PREFIX_CLIENT IPsec Client %u (%S:%u -> %S:%u): -LI_PREFIX_IKE IPsec IKE Session (IKE SA) %u (Client: %u) (%S:%u -> %S:%u): -LI_PREFIX_IPSEC IPsec ESP Session (IPsec SA) %u (Client: %u) (%S:%u -> %S:%u): -LI_START The IPsec ver 2.0 (ISAKMP/IKEv1) processing module is started. -LI_STOPPING The IPsec ver 2.0 (ISAKMP/IKEv1) processing module is now terminating... -LI_STOP The IPsec ver 2.0 (ISAKMP/IKEv1) processing module is terminated. -LI_NUM_IPSEC_SA The number of still-alive IPsec SAs was %u. -LI_NUM_IKE_SA The number of still-alive IKE SAs was %u. -LI_NUM_IKE_CLIENTS The number of still-alive IPsec Clients was %u. -LI_L2TP_SERVER_STARTED The L2TP Server Module is started. -LI_ETHERIP_SERVER_STARTED The EtherIP Server Module is started. The Session ID of the EtherIP Session: %u -LI_DELETE_IKE_CLIENT This IPsec Client is deleted. -LI_DELETE_IKE_SA This IKE SA is deleted. -LI_DELETE_IPSEC_SA This IPsec SA is deleted. -LI_START_QM_FROM_SERVER The server initiates a QuickMode negotiation. -LI_START_QM_FROM_CLIENT The client initiates a QuickMode negotiation. -LI_QM_DH_ERROR Failed to calculate a Diffie-Hellman algorithm. -LI_NEW_IKE_CLIENT A new IPsec client is created. -LI_NEW_IKE_SA A new IKE SA (%s) is created. Initiator Cookie: 0x%I64X, Responder Cookie: 0x%I64X, DH Group: %S, Hash Algorithm: %S, Cipher Algorithm: %S, Cipher Key Size: %u bits, Lifetime: %u Kbytes or %u seconds -LI_TAG_MAINMODE Main Mode -LI_TAG_AGGRESSIVE Aggressive Mode -LI_NEW_IPSEC_SA A new IPsec SA (Direction: %s) is created. SPI: 0x%X, DH Group: %S, Hash Algorithm: %S, Cipher Algorithm: %S, Cipher Key Size: %u bits, Lifetime: %u Kbytes or %u seconds -LI_TAG_SERVER_TO_CLIENT Server -> Client -LI_TAG_CLIENT_TO_SERVER Client -> Server -LI_IPSEC_SA_SPI_SET The SPI which has been pending is now set. New SPI: 0x%X -LI_IPSEC_SA_ESTABLISHED This IPsec SA is established between the server and the client. -LI_IKE_SA_ESTABLISHED This IKE SA is established between the server and the client. -LI_IPSEC_NO_TRANSFORM There are no acceptable transform proposals from the client for establishing an IPsec SA. -LI_IKE_NO_TRANSFORM There are no acceptable transform proposals from the client for establishing an IKE SA. -LI_IKE_NO_NAT_T The connection cannot be accepted because this VPN client is not compatible with IPsec NAT Traversal (RFC 3947 Negotiation of NAT-Traversal in the IKE or draft-ietf-ipsec-nat-t-ike). -LI_SET_CLIENT_ID The client ID which this client presented in the establishing phase is "%S". -LI_CLIENT_MERGE This client (Client %u) and the other client (Client %u) is the same client. So they are merged to the client %u. -LI_CLIENT_UPDATE The port number information of this client is updated. - - -# (EtherIP Log) -LE_PREFIX EtherIP / L2TPv3 Session %u (%S:%u -> %S:%u): -LE_START_MODULE The EtherIP / L2TPv3 Module is started. -LE_STOP The EtherIP / L2TPv3 Module is stopped. -LE_NO_SETTING Error: No EtherIP / L2TPv3 setting entries for the Client ID "%S" is registered on the VPN Server. Please register an entry of a EtherIP / L2TPv3 setting on the VPN Server beforehand. -LE_START_IPC The internal pipe was created between the EtherIP / L2TPv3 module to the Virtual Hub "%S". The using username is "%S". The IPv4 TCP MSS (Max Segment Size) to be set is %u bytes. -LE_IPC_CONNECT_ERROR The connection from the EtherIP / L2TPv3 module to the Virtual Hub "%S" failed. Error: %u : %s -LE_IPC_CONNECT_OK The connection from the EtherIP / L2TPv3 module to the Virtual Hub "%S" succeeded. -LE_RECONNECT Settings of EtherIP / L2TPv3 has been changed. Internal pipes is now being deleted and auto-reconnecting. - - -# (PPP Log) -LP_PREFIX %S%SPPP Session [%S:%u]: -LP_CONNECTED A new PPP session (Upper protocol: %S) is started. IP Address of PPP Client: %S (Hostname: "%S"), Port Number of PPP Client: %u, IP Address of PPP Server: %S, Port Number of PPP Server: %u, Client Software Name: "%S", IPv4 TCP MSS (Max Segment Size): %u bytes -LP_DISCONNECTED The PPP session is disconnected. -LP_PAP_REJECTED The client denied to accept the authentication protocol "PAP" (Password Authentication Protocol, a clear-text password authentication protocol). Enable PAP on the client-side and retry. -LP_PAP_MSCHAPV2_REJECTED The client denied to accept both the "PAP" (Password Authentication Protocol, a clear-text password authentication protocol) and MS-CHAP v2 Protocol. Enable either PAP or MS-CHAP v2 on the client-side and retry. -LP_DISCONNECTED_ABNORMAL A PPP protocol error occurred, or the PPP session has been disconnected. -LP_NEXT_PROTOCOL_IS_NOT_PAP An invalid protocol (Protocol Number: 0x%x) with non-PAP (Password Authentication Protocol) control packet. -LP_PAP_FAILED "PAP" (Password Authentication Protocol, a clear-text password authentication protocol) user authentication failed. -LP_MSCHAPV2_FAILED "MS-CHAP v2" (Microsoft Challenge and Response Protocol Version 2.0) user authentication failed. -LP_NEXT_PROTOCOL_IS_NOT_IPCP An invalid protocol (Protocol Number: 0x%x) with non-IPCP (IP Configuration Protocol) control packet. -LP_DATA_TIMEOUT A timeout on the PPP data transmitting occurred. The PPP client might be disconnected from the network. -LP_CONTROL_TIMEOUT A timeout on the PPP control transmitting occurred. No responses from the PPP client. -LP_VPN_SESSION_TERMINATED The PPP session is disconnected because the VPN Session has been disconnected by the administrator. -LP_UPPER_PROTOCOL_DISCONNECTED The PPP session is disconnected because the upper-layer protocol "%S" has been disconnected. -LP_NORMAL_TERMINATE The PPP session is disconnected by the VPN Client's disconnecting request. -LP_IP_ADDRESS_NOT_DETERMIND The VPN Client sent a packet though an IP address of the VPN Client hasn't been determined. -LP_DHCP_REQUEST_TRYING Trying to request an IP address from the DHCP server. -LP_DHCP_REQUEST_OK An IP address is assigned. IP Address of Client: %S, Subnet Mask: %S, Default Gateway: %S, Domain Name: "%S", DNS Server 1: %S, DNS Server 2: %S, WINS Server 1: %S, WINS Server 2: %S, IP Address of DHCP Server: %S, Lease Lifetime: %u seconds -LP_DHCP_REQUEST_NG Acquiring an IP address from the DHCP server failed. To accept a PPP session, you need to have a DHCP server. Make sure that a DHCP server is working normally in the Ethernet segment which the Virtual Hub belongs to. If you do not have a DHCP server, you can use the Virtual DHCP function of the SecureNAT on the Virtual Hub instead. -LP_DHCP_INFORM_TRYING Acquiring the IP networking information such as subnet mask and the default gateway information from the DHCP server. -LP_DHCP_INFORM_OK The networking information has been acquired. Subnet Mask: %S, Default Gateway: %S, Domain Name: "%S", DNS Server 1: %S, DNS Server 2: %S, WINS Server 1: %S, WINS Server 2: %S, IP Address of DHCP Server: %S -LP_DHCP_INFORM_NG Acquiring the networking information from the DHCP server failed. To accept a PPP session, you need to have a DHCP server. Make sure that a DHCP server is working normally in the Ethernet segment which the Virtual Hub belongs to. If you do not have a DHCP server, you can use the Virtual DHCP function of the SecureNAT on the Virtual Hub instead. -LP_SET_IPV4_PARAM The IP address and other network information parameters are set successfully. IP Address of Client: %S, Subnet Mask: %S, Default Gateway: %S, DNS Server 1: %S, DNS Server 2: %S, WINS Server 1: %S, WINS Server 2: %S - - -# (Virtual Hub log) -LH_ONLINE The Virtual Hub is now online. -LH_OFFLINE The Virtual Hub is now offline. -LH_CONNECT_CLIENT The connection "%S" (IP address: %S, Host name: %S, Port number: %u, Client name: "%S", Version: %S, Build: %u) is attempting to connect to the Virtual Hub. The auth type provided is "%s" and the user name is "%S". -LH_AUTH_UNKNOWN Unknown auth type. -LH_AUTH_ANONYMOUS Anonymous authentication -LH_AUTH_PASSWORD Password authentication -LH_AUTH_PLAIN_PASSWORD External server authentication -LH_AUTH_CERT Certificate authentication -LH_AUTH_TICKET Ticket authentication -LH_AUTH_OPENVPN_CERT OpenVPN certificate authentication -LH_AUTH_RADIUS_NOT_SUPPORT Connection "%S": The authentication method of the user "%S" has been specified as RADIUS Authentication or Active Directory Authentication (NT Domain Authentication). However, the edition of the VPN Server is "%S". This edition does not support RADIUS Authentication nor Active Directory Authentication (NT Domain Authentication). The connection will be denied. -LH_AUTH_RADIUS_NOT_SUPPORT_ON_OPEN_SOURCE Connection "%S": The authentication method of the user "%S" has been specified as RADIUS Authentication or Active Directory Authentication (NT Domain Authentication). However, such an external user-authentication function hasn't been implemented on the Open-Source version of SoftEther VPN yet. The connection will be denied. -LH_AUTH_CERT_NOT_SUPPORT_ON_OPEN_SOURCE Connection "%S": The authentication method of the user "%S" has been specified as Certificate Authentication. However, the Certificate Authentication function hasn't been implemented on the Open-Source version of SoftEther VPN yet. The connection will be denied. -LH_AUTH_OK Connection "%S": Successfully authenticated as user "%S". -LH_AUTH_OK_CERT The Virtual Hub's Security Account Manager has received the following certificate from the VPN Client and accepted its contents as the certificate for when user "%S" logs in: %s -LH_AUTH_NG_CERT Although the Virtual Hub's Security Account Manager has received the following certificate, has refused its contents as the certificate for when user "%S" logs in because this certificate's contents matches the contents that are registered in the Virtual Hub's certificates revocation list: %s -LH_AUTH_NG Connection "%S": User authentication failed. The user name that has been provided was "%S", from %S. -LH_LOCAL_ONLY Connection "%S": The remote login has been refused because of the password for user "%S" is blank. -LH_POLICY_ACCESS_NG Connection "%S": Access has beens refused to user "%S" based on the security policy. -LH_USER_EXPIRES Connection "%S": Access has been refused to user "%S" because of the expiration date has been expired. -LH_CLIENT_VERSION_OLD Connection "%S": The build number of the VPN Client is %u. Only the build %u or latest version of VPN Client is granted to access the VPN Server. -LH_CLIENT_ID_REQUIRED Connection "%S": The Client ID which has been specified by the VPN Client is %u. However, this Virtual Hub has the RequiredClientId value set to %u. -LH_FARM_SELECT_1 Connection "%S": The cluster controller is deciding the destination cluster member of this client. -LH_FARM_SELECT_2 Connection "%S": Failed to decide the destination cluster member server. -LH_FARM_SELECT_3 Connection "%S": This current VPN Server has been decided as the destination cluster member server. Proceeding to receive connection. -LH_FARM_SELECT_4 Connection "%S": The server "%S" has been decided as a destination cluster member server. Instructing clients to redirect connection to this server. -LH_MAX_SESSION Connection "%S": The maximum number of sessions (%u) that can be set by the Virtual Hub has been reached. Unable to create a new session. -LH_MAX_SESSION_CLIENT Connection "%S": The maximum number of client sessions (%u) that can be set by the Virtual Hub has been reached. Unable to create a new session. -LH_MAX_SESSION_BRIDGE Connection "%S": The maximum number of bridge sessions (%u) that can be set by the Virtual Hub has been reached. Unable to create a new session. -LH_MAX_SESSION_2 Connection "%S": The maximum number of sessions (%u) that can be managed by a VPN Server has been reached. Unable to create a new session. -LH_NEW_SESSION Connection "%S": The new session "%S" has been created. (IP address: %S, Port number: %u, Physical underlying protocol: "%S") -LH_SET_SESSION Session "%S": The parameter has been set. Max number of TCP connections: %u, Use of encryption: %s, Use of compression: %s, Use of Half duplex communication: %s, Timeout: %u seconds. -LH_NODE_INFO Session "%S": VPN Client details: (%s) -LH_VLAN_ID Session "%S": Assigned VLAN ID: %u -LH_INVALID_SIGNATURE Session "%S": The connected client sent invalid protocol data. Unable to establish normal communication with client. First check for problems with the connections and cabling of the network connecting the client and the server and then check there is not a special transparent packet re-writing device installed. -LH_END_SESSION Session "%S": The session has been terminated. The statistical information is as follows: Total outgoing data size: %I64u bytes, Total incoming data size: %I64u bytes. -LH_BCAST_STORM Session "%S": A large volume of broadcast packets has been detected. There are cases where packets are discarded based on the policy. The source MAC address is %S, the source IP address is %S, the destination IP address is %S. The number of broadcast packets is equal to or larger than %u items per 1 second (note this information is the result of mechanical analysis of part of the packets and could be incorrect). -LH_DHCP_FORCE Session "%S": The packet was discarded because it has been attempting to use the IP address %S, which is not a DHCP server allocated IP address. -LH_MAC_LIMIT Session "%S": Although the virtual hub has attempt to assign a new MAC address "%S" was made, %u MAC addresses have already been assigned for this service. According to the security policy, this session is allowed to have a maximum of %u MAC addresses. The packet has been discarded. -LH_BRIDGE_LIMIT Session "%S": Although the virtual hub has attempt to assign a new MAC address "%S" was made, %u MAC addresses have already been assigned for this service. According to the security policy, this session is denied bridges and is therefore allowed to hold no more than %u MAC addresses. The packet has been discarded. -LH_MAC_REGIST Session "%S": A new MAC address "%S" has been assigned. -LH_MAC_REGIST_VLAN Session "%S": A new MAC address "%S" (VLAN ID: %u) has been assigned. -LH_IP_LIMIT Session "%S": Although the virtual hub has attempt to assign a new IP address %S was made, %u IP addresses have already been assigned for this service. According to the security policy, this session is allowed to have a maximum of %u IP addresses. The packet has been discarded. -LH_ROUTING_LIMIT Session "%S": Although the virtual hub has attempt to assign a new IP address %S was made, %u IP addresses have already been assigned for this service. According to the security policy, this session is denied routing and is therefore allowed to hold no more than %u IP addresses. The packet has been discarded. -LH_IP_CONFLICT Session "%S": Although the virtual hub has attempt to use the IP address %S was made, this IP address is already being used by another session "%S" (MAC Address: "%S"). The security policy for this session denies duplication of IP addresses that are used by other sessions. The packet has been discarded. Detailed Information: CreatedTime=%I64u, UpdatedTime=%I64u, DhcpAllocated=%u, Now=%I64u -LH_NO_SERVER Session "%S": Although TCP/IP connection request (from %S:%u to %S:%u) was made to this session, because of the security policy denies operation as a server, the packet has been discarded. -LH_NO_DHCP Session "%S": Although host %S on this session sent a packet that allocates an IP address as a DHCP server for host %S on another session, this session's security policy denies operation as a DHCP server. The packet has been discarded. -LH_REGIST_DHCP Session "%S": The DHCP server of host "%S" (%S) on this session allocated, for host "%S" on another session "%S", the new IP address %S. -LH_BRIDGE_1 Session "%S": A Local Bridge connection to physical Ethernet interface "%S" was started. -LH_BRIDGE_2 Session "%S": Because communication has failed to be established with physical Ethernet interface "%S", the Local Bridge has stopped. -LH_SET_MTU Session "%S": The physical Ethernet interface "%S" has an MTU value set to %u. It is necessary to send and receive an Ethernet packet which has %u bytes. The MTU is now changed to %u. -LH_SET_MTU_ERROR Session "%S": The physical Ethernet interface "%S" has an MTU value set to %u. It is necessary to send and receive an Ethernet packet which has %u bytes. However, changing the MTU to %u failed. This physical Ethernet interface or device driver might be unable to process an Ethernet packet which has more 1,514 bytes (payload size: 1,500 bytes). In such case, the larger tagged-VLAN packets than 1,514 bytes cannot be transmitted. You should replace the current physical Ethernet adapter to another which supports Jumbo Frames. You can also try to update the device driver. Another possible method is to enable Jumbo Frames on the operating system or device driver settings. -LH_START_BRIDGE The Local Bridge connection "%S" has started. The bridge session "%S" was created. -LH_STOP_BRIDGE The Local Bridge connection "%S" has stopped. -LH_LINK_START The Cascade Connection "%s" has been established. The Cascade session "%S" was created. -LH_LINK_STOP The Cascade Connection "%s" has stopped. -LH_NAT_START SecureNAT has started. The SecureNAT session "%S" was created. -LH_NAT_STOP SecureNAT stopped. -LH_NAT_TCP_SUCCEED The connection to TCP session %u: Host "%S (%S)", Port %u was successful. -LH_NAT_TCP_FAILED The connection to TCP session %u: Host "%S", Port %u failed. -LH_NAT_TCP_DELETED The TCP session %u has been deleted. -LH_NAT_TCP_CREATED The TCP session %u has been created. Connection source %S:%u, Connection destination %S:%u -LH_NAT_UDP_DELETED The UDP session %u has been deleted. -LH_NAT_UDP_CREATED The UDP session %u has been created. Connection source %S:%u, Connection destination %S:%u -LH_NAT_DHCP_CREATED The DHCP entry %u has been created. MAC address: %S, IP address: %S, host name: %S, expiration span: %u seconds -LH_CHANGE_PASSWORD_1 The connection "%S" (IP address %S) connected to Virtual Hub in change password mode. -LH_CHANGE_PASSWORD_2 Connection "%S": Changing of password failed. The specified user "%S" does not exist. -LH_CHANGE_PASSWORD_3 Connection "%S": Changing of password failed. The auth type of user "%S" is not password authentication. -LH_CHANGE_PASSWORD_4 Connection "%S": Changing of password failed. The old password of user "%S" is incorrect. -LH_CHANGE_PASSWORD_5 Connection "%S": The password of user "%S" has been changed. -LH_CONNECT_1 Starting Cascade Connection "%s": connection number %u. -LH_CONNECT_2 The Cascade Connection "%s" is connected. Session name: "%S" -LH_CONNECT_ERROR The connection for Cascade Connection "%s" has been either disconnected or it failed. Cause: %s (code %u) -LH_POLICY_MONITOR_MODE Connection "%S": Because of a user whose security policy denies permission for Monitoring Mode requested that Monitoring Mode be enabled and attempted to connect to a Virtual Hub, the connection has been denied. -LH_POLICY_BRIDGE_MODE Connection "%S": Because of a user whose security policy denies both bridge connections and routing operations requested that bridge connections or routing operations be enabled and attempted to connect to the Virtual Hub, the connection has been denied. -LH_NOT_ENOUGH_CLIENT_LICENSE Connection "%S": Although this connection attempted to connect to the VPN Server using "client connection mode", because this would have made the number of client connections on the entire server exceed the number of registered Client Connection Licenses, it is not possible to receive the connection for this connection. When the number of licenses for concurrent connections is insufficient, you must either disconnect another existing client connection or increase the number of licenses. There are currently %u registered Client Connection Licenses and the number of connections to servers was %u. -LH_NOT_ENOUGH_BRIDGE_LICENSE Connection "%S": Although this connection attempted to connect to the VPN Server using "bridge connection mode", because this would have made the number of bridge connections on the entire server exceed the number of registered Bridge Connection Licenses, it is not possible to receive the connection for this connection. When the number of licenses for concurrent connections is insufficient, you must either disconnect another existing client connection or increase the number of licenses. There are currently %u registered Bridge Connection Licenses and the number of connections to servers was %u. -LH_TOO_MANY_MULTILOGINS Connection "%S": Although the user "%S" made a login attempt, the security policy that applies to this user limits the maximum number of multiple logins to %u sessions. Currently the number of logins by this user is %u sessions and therefore the user has denied permission for a new VPN connection. -LH_TOO_MANY_MULTILOGINS2 Connection "%S": Although the user "%S" made a login attempt, this edition of the VPN Server permits the maximum number of multiple concurrent VPN sessions to %u sessions per user. Current number of the multiple concurrent VPN sessions of this users is %u, so no more concurrent VPN sessions cannot be permitted. If you want to support more number of multiple concurrent VPN sessions per user, please consider upgrading to Professional Edition or greater of the VPN Server. -LH_PACKET_LOG_NO_LOG The edition of this VPN Server doesn't supports the packet logging function. No IP address nor TCP/UDP header data will be recorded. After you upgrade the edition of the VPN Server to Professional Edition or greater, all kinds of packet logs will be recorded in this file. -LH_PACKET_LOG_NO_LOG_OSS The VPN Server is either Open-Source or Free version. It hasn't implemented the IP Address or TCP/UDP header data logging function. No IP address nor TCP/UDP header data are not be recorded here. -LH_NO_RADIUS_SETTING The user "%S" is configured to use RADIUS authentication. However, there is no RADIUS authentication settings. The user cannot be authenticated. -LH_KERNEL_MODE_START It has been detected that the Kernel-mode NAT for SecureNAT can be run on the interface "%S". The Kernel-mode NAT is starting. The TCP, UDP and ICMP NAT processings will be performed with high-performance via Kernel-Mode hereafter. The parameters of Kernel-mode NAT: IP Address = "%r", Subnet Mask = "%r", Default Gateway = "%r", Broadcast Address = "%r", Virtual MAC Address: "%S", DHCP Server Address: "%r", DNS Server Address: "%r" -LH_KERNEL_MODE_STOP The Kernel-mode NAT on the interface "%S" for SecureNAT has been stopped. - - -# (Administration log) -LA_CONNECTED_1 Connection "%S" connected using server admin mode. -LA_CONNECTED_2 Connection "%S" connected using Virtual Hub Admin Mode. The name of the Virtual Hub is "%S". -LA_IP_DENIED Connection "%S" attempted to connect using administration mode from an IP address whose permission is denied by adminip.txt. Disconnecting. -LA_ERROR Connection "%S" was unable to log in using administration mode. %s (Error code %u) -LA_OK Connection "%S" successfully logged in using administration mode. -LA_RPC_START Connection "%S" created a new remote procedure call session "%S" for the purpose of administration mode. -LA_TAG_1 Administration mode [%S]: -LA_TAG_2 Administration mode [%S] (Virtual Hub "%S"): -LA_CREATE_LISTENER A new TCP listener (port number %u) has been created. -LA_DELETE_LISTENER TCP listener (port number %u) has been deleted. -LA_ENABLE_LISTENER TCP listener (port number %u) has been enabled. -LA_DISABLE_LISTENER TCP listener (port number %u) has been disabled. -LA_SET_PORTS_UDP UDP ports have been set: %s. -LA_SET_PROTO_OPTIONS %s options have been set. -LA_SET_SERVER_PASSWORD The server administrator password has been set. -LA_SET_FARM_SETTING The clustering setting has been changed. -LA_SET_SERVER_CERT The server certificates have been set. -LA_REGENERATE_SERVER_CERT The server certificate has been re-generated. The new CN: "%S" -LA_SET_SERVER_CIPHER A new encryption algorithm name for the server has been set. The new encryption algorithm name is "%S". -LA_CREATE_HUB A new Virtual Hub "%S" has been created. -LA_SET_HUB The Virtual Hub setting has been changed. -LA_DELETE_HUB The Virtual Hub "%S" has been deleted. -LA_SET_HUB_RADIUS The Virtual Hub's external RADIUS authentication server setting has been changed. -LA_DISCONNECT_CONN The client connection "%S" connected to the server has been forcefully disconnected. -LA_SET_HUB_ONLINE The Virtual Hub is now online. -LA_SET_HUB_OFFLINE The Virtual Hub is now offline. -LA_SET_SNAT_OPTION The SecureNAT option has been set. -LA_ENABLE_SNAT The SecureNAT function has been enabled. -LA_DISABLE_SNAT The SecureNAT function has been disabled. -LA_SET_HUB_LOG The log save setting has been changed. -LA_ADD_CA A registration of trusted root certificate has been added. -LA_DELETE_CA A registration of trusted root certificate has been deleted. -LA_CREATE_LINK The Cascade Connection "%s" has been added. -LA_SET_LINK The setting for Cascade Connection "%s" has been changed. -LA_SET_LINK_ONLINE The Cascade Connection "%s" is now online. -LA_SET_LINK_OFFLINE The Cascade Connection "%s" is now offline. -LA_DELETE_LINK The Cascade Connection "%s" has been deleted. -LA_RENAME_LINK The name of Cascade Connection "%s" has been changed to "%s". -LA_ADD_ACCESS An access list has been added. -LA_DELETE_ACCESS The access list has been deleted. -LA_SET_ACCESS_LIST The access list has been updated. An access list of %u items are set. -LA_SET_AC_LIST The Source IP Address Limit List has been updated. Rule items for %u items are set. -LA_CREATE_USER User "%S" has been created. -LA_SET_USER The setting of user "%S" has been updated. -LA_DELETE_USER User "%S" has been deleted. -LA_CREATE_GROUP Group "%S" has been created. -LA_SET_GROUP The setting of group "%S" has been updated. -LA_DELETE_GROUP Group "%S" has been deleted. -LA_DELETE_SESSION This session "%S" has been forcefully disconnected. -LA_SET_KEEP The server's Internet keep-alive setting has been updated. -LA_SET_SYSLOG The server's syslog send function setting has been updated. -LA_DELETE_BRIDGE The Local Bridge connection definition "%S" --> "%S" has been deleted. -LA_ADD_BRIDGE The Local Bridge connection definition "%S" --> "%S" has been added. -LA_REBOOT_SERVER There has been a request to restart VPN Server. -LA_GET_CONFIG The config file has been read. -LA_SET_CONFIG The config file has been written. Restarting VPN Server. -LA_SET_HUB_ADMIN_OPTION The administration option has been set for Virtual Hub "%S". -LA_SET_HUB_EXT_OPTION The Virtual Hub Extended Option has been set for Virtual Hub "%S". -LA_ADD_L3_SW The Virtual Layer 3 Switch "%S" has been created on the server. -LA_DEL_L3_SW The Virtual Layer 3 Switch "%S" has been deleted from the server. -LA_START_L3_SW The Virtual Layer 3 Switch "%S" has been started. -LA_STOP_L3_SW The Virtual Layer 3 Switch "%S" has been stopped. -LA_ADD_L3_IF The virtual interface for Virtual Hub "%S" has been added to Virtual Layer 3 Switch "%S". -LA_DEL_L3_IF The virtual interface for Virtual Hub "%S" has been deleted from Virtual Layer 3 Switch "%S". -LA_ADD_L3_TABLE The routing table for network "%S" has been added to Virtual Layer 3 Switch "%S". -LA_DEL_L3_TABLE The routing table for network "%S" has been deleted from Virtual Layer 3 Switch "%S". -LA_ADD_CRL A certificate has been added to Certificate Revocation List. -LA_DEL_CRL A certificate has been deleted from Certificate Revocation List. -LA_SET_CRL A registered item in a registration of a list of invalid certificates has been edited. -LA_READ_LOG_FILE The log file on the server "%S" (log file "%S") has been downloaded. -LA_ADD_LICENSE_KEY A new license key "%S" has been registered. -LA_DEL_LICENSE_KEY An existing license (No. %u) has been deleted. -LA_SET_IPSEC_CONFIG The IPsec server setting has been updated. -LA_ADD_ETHERIP_ID A new EtherIP / L2TPv3 server setting (ID="%S") has been added. -LA_DEL_ETHERIP_ID The new EtherIP / L2TPv3 server setting (ID="%S") has been deleted. -LA_SET_OVPN_SSTP_CONFIG The OpenVPN and MS-SSTP VPN Server setting has been updated. -LA_DDNS_HOSTNAME_CHANGED The hostname of Dynamic DNS Function has been changed to "%S". -LA_SET_SPECIAL_LISTENER Special Listener enable / disable status has been changed. - -# (Client log) -LC_START_1 The SoftEther VPN Client Engine has been started. -LC_START_2 %S %S -LC_START_3 %S -LC_END The SoftEther VPN Client Engine has been shut down. -LC_LOAD_CONFIG_1 Loading configuration file... -LC_LOAD_CONFIG_2 The configuration file has been loaded. -LC_LOAD_CONFIG_3 Configuration file does not exist. Applying the initial settings. -LC_NEW_ACCOUNT A new VPN Connection Setting "%s" has been created. -LC_DELETE_ACCOUNT The VPN Connection Setting "%s" has been deleted. -LC_RENAME_ACCOUNT The name of VPN Connection Setting "%s" has been changed to "%s". -LC_CONNECT Connection processing for VPN Connection Setting "%s" has started. -LC_CONNECT_1 VPN Connection Setting "%s": Connection operation starting (this is now %u times). -LC_CONNECT_2 VPN Connection Setting "%s": Now connected. Session name: "%S" -LC_CONNECT_ERROR VPN Connection Setting "%s": The connection has been either disconnected or it failed. Cause: %s (code %u) -LC_DISCONNECT Disconnecting the VPN Connection Setting "%s". -LC_CREATE_VLAN A Virtual Network Adapter "%S" has been created. -LC_UPDATE_VLAN The Virtual Network Adapter "%S" driver has been reinstalled. -LC_DELETE_VLAN The Virtual Network Adapter "%S" has been deleted. -LC_SET_PASSWORD The password setting for connection to a client service has been changed. -LC_TAP_NOT_FOUND Cannot find the tun/tap driver for Mac OS X. Please install the tun/tap driver. - -# (Eraser log) -LE_START Monitoring the directory "%S". If the amount of available free disk space becomes less than %S, the backup files for log files and configurations that are saved on the sub-directories of this directory will be automatically deleted in the order of oldest first. The amount of free disk space that determines when to start deletion can be modified by changing the "AutoDeleteCheckDiskFreeSpaceMin" item in the configuration file. -LE_DELETE The free disk space is now less then %S so the old file "%S" has been automatically deleted. The amount of free disk space that determines when to start deletion can be modified by changing the "AutoDeleteCheckDiskFreeSpaceMin" item in the configuration file. -LE_NOT_ENOUGH_FREE <> If the free disk space becomes lower than %S, it will no longer be possible to automatically delete the old backup files of log files and configurations. We recommend that you immediately manually delete the unnecessary files on this computer and recover the necessary free disk space. When there is a very small amount of free disk space, computer operation can become unstable. - -# (Layer 3 Switch log) -L3_SWITCH_START The Virtual Layer 3 Switch "%S" started. It will wait until the Virtual Hubs of all interfaces registered on this switch become online and then it will start operation. -L3_SWITCH_ONLINE The Virtual Hubs of all interfaces of the Virtual Layer 3 Switch "%S" are online and the Virtual Layer 3 Switch has commenced Virtual Layer 3 Switch operation. -L3_SWITCH_OFFLINE At least one Virtual Hub of an interface registered on Virtual Layer 3 Switch "%S" stopped, and Virtual Layer 3 Switch operation has been stopped. -L3_SWITCH_STOP The Virtual Layer 3 Switch "%S" terminated. - - -# Concerning Microsoft.c -MS_VIRTUAL Proprietary Virtual/Internal Interface -MS_ETHERNET Ethernet Interface -MS_TOKENRING Token Ring Interface -MS_FDDI FDDI Interface -MS_PPP PPP (Dialup or VPN) -MS_LOOPBACK Loopback Interface -MS_SLIP SLIP Interface -MS_WLAN Wireless Network Interface -MS_OTHER Unknown Other Interface -MS_NON_OPERATIONAL Disabled -MS_UNREACHABLE Not Connected -MS_DISCONNECTED Not Connected -MS_CONNECTING Connecting -MS_CONNECTED Connected -MS_OPERATIONAL Connected - - -# Concerning Network Utility -UT_SM_COLUMN_1 Item Name -UT_SM_COLUMN_2 Value -UT_SM_ST_TITLE Network Adapter Name -UT_SM_ST_GUID GUID -UT_SM_ST_TYPE Type -UT_SM_ST_TYPE2 Physical Wired Ethernet -UT_SM_ST_STATUS Status -UT_SM_ST_MTU MTU -UT_SM_ST_SPEED Link Speed -UT_SM_ST_ADDRESS Physical Address -UT_SM_ST_RECV_BYTES Incoming Bytes -UT_SM_ST_RECV_BCASTS Incoming Broadcast Packets -UT_SM_ST_RECV_UNICASTS Incoming Unicast Packets -UT_SM_ST_SEND_BYTES Outgoing Bytes -UT_SM_ST_SEND_BCASTS Outgoing Broadcast Packets -UT_SM_ST_SEND_UNICASTS Outgoing Unicast Packets -UT_SM_ST_IP IP Address %u -UT_SM_ST_SUBNET Subnet Mask %u -UT_SM_ST_GATEWAY Gateway %u -UT_SM_ST_DHCP DHCP Server -UT_SM_ST_DHCP_1 Lease Start -UT_SM_ST_DHCP_2 Lease Limit date and time -UT_SM_ST_WINS_1 WINS Server 1 -UT_SM_ST_WINS_2 WINS Server 2 - - -# Concerning EtherLogger Manager -EM_TITLE SoftEther EtherLogger Manager -EM_REMOTE_TITLE You can connect to and manage the SoftEther EtherLogger service. \r\nEnter the host name and IP address of the computer on which the EtherLogger service to be managed is operating. You can also concatenate the port number by using the ":" (colon). -EM_MAIN_COLUMN_1 Network adapter name -EM_MAIN_COLUMN_2 Status -EM_MAIN_OK Operating -EM_MAIN_ERROR Error -EM_ADD_NEW Add new capture device -EM_ADD_EDIT Edit capture settings -EM_DELETE_CONFIRM Are you sure you want to delete capture setting "%S"? -EM_NO_LICENSE_COLUMN Note: -EM_NO_LICENSE Because not even one product license is registered, this SoftEther EtherLogger will not operate. - -EM_UNSUPPORTED Unable to use SoftEther EtherLogger on the operating system that this SoftEther EtherLogger is operating on. For the list of operating system that the SoftEther EtherLogger can be used on, please refer to the online documentation of the SoftEther EtherLogger. -EM_WPCAP_REMOTE In order to use this SoftEther EtherLogger, you need to install WinPcap software. The software WinPcap is currently not installed on the server computer. \r\n\r\nTo continue the installation of the WinPcap software, you must start SoftEther EtherLogger Manager on the server computer that is running VPN Server and then while connected to localhost (location of your own computer), have the Local Bridge Function Setting window displayed. \r\nTo continue, first exit this management session, and then, after starting SoftEther EtherLogger Manager on the server computer, connect to localhost and continue the setting process. -EM_WPCAP_ROOT In order to use this SoftEther EtherLogger, you need to install WinPcap software. \r\n\r\nTo continue the installation you must log in to this computer as a user with administrator privileges. \r\nLog on as an administrator and start the SoftEther VPN Server Manager again. -EM_WPCAP_INSTALL In order to use this SoftEther EtherLogger, you need to install WinPcap software. The software WinPcap is currently not installed on the server computer. \r\n\r\nWinPcap is an easy-to-install free software that is bundled together with the VPN Server. \r\n\r\nDo you want to begin the installation of WinPcap? -EM_WPCAP_REBOOT1 After WinPcap installation has completed, you must restart the computer before you use the SoftEther EtherLogger. \r\n\r\nAfter you restart the computer manually and start SoftEther EtherLogger, configure the settings again. -EM_WPCAP_REBOOT2 After WinPcap is installed, you must restart the SoftEther EtherLogger service. \r\n\r\nIt only takes a short time to restart the SoftEther EtherLogger service, however all management sessions that are currently connected to the SoftEther EtherLogger will be disconnected. \r\nThis management session will also be disconnected, so you will need to reconnect to continue. \r\n\r\nDo you want to restart the SoftEther Ether Logger service? -EM_RESOURCE Unable to read the WinPcap driver. - - -########################################################################### -# # -# String data of dialog boxes in software # -# # -########################################################################### - - -PREFIX D_SECURE -CAPTION Access to %s - %S -S_TITLE Access to %S -S_DEVICE_INFO Device Name: %S\r\nManufacturer: %S -IDS_STATIC1 Device Information -S_WARNING Take care entering the PIN code because if you have entered it incorrectly for a few times the device will be locked. -IDOK &OK -IDCANCEL Cancel -S_PIN_CODE &PIN Code: - - -PREFIX D_PKCSUTIL -CAPTION PKCS#12 Write Utility -S_TITLE ePass 1000 USB token PKCS#12 Write Utility -STATIC1 By using this utility, you can write a PKCS#12 file (certificate file) of your choice to an ePass 1000 USB hardware security token. \r\n\r\nThe USB token that the certificate file is written in can be used for SoftEther VPN authentication. -STATIC2 Write to PKCS#12 file -STATIC3 To write an existing PKC#12 file to a USB token, click Write. \r\nNOTE: If a PKCS#12 certificate for SoftEther VPN is already stored in the USB token, it will be overwritten. -B_WRITE &Write -STATIC4 Erase PKCS#12 certificate from USB token. -STATIC5 You can erase the certificate data from a USB token on which a PKCS#12 certificate for SoftEther VPN is already stored. -B_ERASE &Erase -IDCANCEL E&xit Utilities -S_COPYRIGHT Copyright (c) SoftEther VPN Project.\r\nAll Rights Reserved. - - -PREFIX D_PASSPHRASE -CAPTION Private Key Passphrase -STATIC1 The private key is protected by passphrase. \r\n\r\nEnter the passphrase to read the private key. -STATIC2 &Passphrase: -IDOK &OK -IDCANCEL Cancel - - -PREFIX D_NM_CONNECT -CAPTION Connect to SoftEther VPN User-mode Router -S_TITLE Connecting to "%S"... - - -PREFIX D_PASSWORD -CAPTION Login to %S -S_TITLE Enter your user name and password to log in to server %S. Make sure you select the correct auth type. -STATIC1 Enter Use&r Info: -STATIC2 Auth &Type: -STATIC3 User &Name: -STATIC4 &Password: -R_NO_SAVE_PASSWORD &Do not Save Password -S_COUNTDOWN An automatic reconnection will be made after %u seconds... -IDOK &OK -IDCANCEL Cancel Connection - - -PREFIX D_STATUS -CAPTION Connecting to "%s"... -S_STATUS Initializing... -IDCANCEL Cancel - - -PREFIX D_CERT -CAPTION Certificate -S_TITLE The following information is available for this certificate. -STATIC1 Basic Information of this Certificate: -STATIC2 Issued to: -STATIC3 Issuer: -STATIC4 Expires at: -STATIC5 Advanced Information of this Certificate: -STATIC6 Certificate of Authority Who Signed This Certificate: -S_PARENT The certificate of the certificate authority who signed this certificate is registered on the list of trusted certificates. -S_PARENT_BUTTON_STR &View Certificate -IDCANCEL &OK -B_SAVE &Save to File - - -PREFIX D_CHECKCERT -CAPTION Security Alert - %s -S_TITLE Although the connection to the destination VPN Server "%S" that you are currently connecting to is encrypted, the trustworthiness of the server certificate provided by the server is unknown. -STATIC1 About the Server Certificate -STATIC2 Establishing encrypted tunnel (SSL session) between VPN Server and VPN Client. Checking the server certificate enables to verify the authenticity of the server. -S_MSG1 The server certificate provided by destination VPN Server "%S" is as follows. -STATIC3 Issued to: -STATIC4 Issuer: -STATIC5 Expires at: -B_SHOW &Show Certificate -STATIC6 Digest (MD5): -STATIC7 Digest (SHA-1): -IDOK &Resume the Connection -IDCANCEL &Cancel Connection -STATIC8 There may be a problem with this certificate, such as it has not been issued by a trusted certificate authority (CA), or cert is expired. -STATIC9 Confirm the content of this certificate and decide whether or not to connect to this VPN Server. Click Cancel Connection to abort the connection. - - -PREFIX D_CONNECTERROR -CAPTION Connect Error - %s -S_TITLE An error occurred while connection to VPN Server "%S". -S_COUNTDOWN Automatically reconnects after %u seconds... -IDOK &Retry -IDCANCEL Cancel Connection -R_HIDE &Hide this window when connecting next time - - -PREFIX D_CM_LOGIN -CAPTION Enter Password - VPN Client Manager -S_TITLE You must enter a client administration password to operate the VPN Client that is operating on %s. Enter the client administration password. -STATIC1 &Password: -STATIC2 Enter the Client Administration Password: -IDOK &OK -IDCANCEL Cancel - - -PREFIX D_CONNECTION_STATUS -S_TITLE Status of VPN Session of %s (Real Time) -B_POLICY Security &Policy... -B_SERVER_CERT &Server Certificate -B_CLIENT_CERT &Client Certificate -IDCANCEL &Close - - -PREFIX D_CM_POLICY -CAPTION Security Policy List -S_TITLE Security policies defined for the current session %s -IDCANCEL &Close - - -PREFIX D_CM_ACCOUNT -STATIC1 Please configure the VPN Connection Setting for VPN Server. -S_ACCOUNT_NAME Setting &Name: -STATIC2 Destination VPN Server: -STATIC3 Specify the host name or IP address, and the port number and the Virtual Hub on the destination VPN Server. -STATIC4 &Host Name: -STATIC5 &Port Number: -STATIC6 (TCP Port) -STATIC7 &Virtual Hub Name: -STATIC8 Pro&xy Server as Relay: -STATIC9 You can connect to a VPN Server via a proxy server. -STATIC10 Proxy &Type: -R_DIRECT_TCP &Direct TCP/IP Connection (No Proxy) -R_HTTPS Connect via H&TTP Proxy Server -R_SOCKS Connect via &SOCKS4 Proxy Server -R_SOCKS5 Connect via &SOCKS5 Proxy Server -B_PROXY_CONFIG P&roxy Server Setting -STATIC11 Server Certificate Veri&fication Option: -R_CHECK_CERT Always Verify Server &Certificate -B_TRUST Manage Trusted CA &Certificate List -B_SERVER_CERT &Specify Individual Cert -B_VIEW_SERVER_CERT Show Indi&vidual Cert -S_VLAN_GROUP Virtua&l Network Adapter to Use: -S_POLICY_1 You can configure the security policy which will be applied to the Cascade Connection on this Virtual Hub's side. -B_POLICY Security Po&licy -STATIC12 User &Authentication Setting: -STATIC13 Auth &Type: -S_USERNAME &User Name: -S_PASSWORD Password: -S_CERT_INFO You must specify a client certificate to be used for user authentication. -STATIC14 Advanc&ed Setting of Communication: -R_RETRY Reconnects Automatically After Disconnected -S_RETRY_NUM_1 Reconnect &Count: -S_RETRY_NUM_2 times -S_RETRY_SPAN_1 Reconnect Interval: -S_RETRY_SPAN_2 seconds -R_INFINITE &Infinite Reconnects (Keep VPN Always Online) -B_DETAIL A&dvanced Settings... -IDOK &OK -IDCANCEL Cancel -B_CHANGE_PASSWORD Change &Password -S_CHANGE_PASSWORD You can change the user's password on the VPN Server. -R_HIDE Hide Status and Errors Screens -R_HIDE2 Hide IP Address Screens -STATIC15 Set the user authentication information that is required when connecting to the VPN Server. -B_REGIST_CLIENT_CERT Specify Client &Certificate -B_IE Import I&E Proxy Server Settings -R_DISABLE_NATT Disable NAT-T - - -PREFIX D_CM_PROXY -CAPTION Proxy Server Connection Setting -STATIC1 Enter the host name of the proxy server for relaying (HTTP proxy or SOCKS proxy), and the IP address, port, and when necessary, the user name and password. -STATIC2 &Host Name: -STATIC3 Port: -STATIC4 &User Name: -STATIC5 &Password: -B_HTTP_HEADER Custom HTTP header values -IDOK &OK -IDCANCEL Cancel -STATIC6 (optional) -STATIC7 (optional) - - -PREFIX D_CM_PROXY_HTTP_HEADER -CAPTION Custom Proxy HTTP Header Values -B_NEW New -B_DELETE Delete -B_CLEAR Clear -IDOK &OK -IDCANCEL Cancel - - -PREFIX D_CM_DETAIL -CAPTION Advanced Settings -STATIC1 Optional settings for system administrators and experts for networking, communication protocol, and security. Customize the VPN protocol communication settings. -STATIC2 Op&timization of VPN Communication: -STATIC3 Uses multiple physical TCP connection aggregation for a logical VPN connection to increase the communication throughput. -STATIC4 &Number of TCP Connections: -STATIC5 connections -STATIC6 Note: It is recommend that about 8 connections for broadband and 1 connection for slow line (e.g. dialup). -STATIC7 Advanced Settings: -STATIC8 Establi&shing Interval: -STATIC9 seconds -R_USE_DISCONNECT Set Connection Lifetime of E&ach TCP Connection -STATIC10 Lifetime: -STATIC11 seconds -STATIC12 When using two or more TCP connections, Half Duplex Mode is available. The half-duplex mode fixes the data direction as half and half for each TCP connection. For example when a VPN using 8 TCP connections is established, physical consists of the VPN tunnel will be fixed so that 4 TCP connections are dedicated to the upload direction and the other 4 connections are dedicated to the download direction. -R_USE_HALF_CONNECTION Use &Half-Duplex Mode -STATIC13 Encryption and &Compression: -STATIC14 Normally the VPN session is encrypted for secure. You can disable encryption to improve the throughput. Please note that the data flows in plain over the network when disabled. -R_USE_ENCRYPT &Encrypt VPN Session with SSL -STATIC15 You can use data compression to save VPN communication bandwidth. Enable this option when using a slow connectivity such as dial-up or mobile connection. -R_DISABLE_UDP Disable UD&P Acceleration -R_USE_COMPRESS &Use Data Compression -STATIC16 VPN Connection &Mode: -S_MODE You can specify the following connection modes. (Options for network administrators.) -R_BRIDGE &Bridge / Router Mode -R_MONITOR Monitoring Mo&de -STATIC17 Other Confi&gurations: -R_NO_ROUTING No Adjustments of &Routing Table -STATIC18 Keep the settings default in this dialog unless you are told to do so by a system administrator, or you have expertise for networking and security. -STATIC19 The VoIP / QoS functions handle high priority packets such as IP telephone packets (VoIP) to be transmitted faster. -R_DISABLE_QOS Disable VoIP / &QoS Functions -IDOK &OK -IDCANCEL Cancel -S_UDPACCEL You can use data compression to save VPN communication bandwidth. Enable this option when using a slow connectivity such as dial-up or mobile connection. - - -PREFIX D_CM_NEW_VLAN -CAPTION Create New Virtual Network Adapter -S_INFO A new Virtual Network Adapter will be created on the system.\r\nYou can specify a name for the Virtual Network Adapter, which can be a maximum of %u alphanumeric characters. -STATIC1 Virtual Network Adapter &Name: -IDOK &OK -IDCANCEL Cancel -S_WIN8 The name of a Virtual Network Adapter must be 'VPN' or 'VPN2' to 'VPN127'. (Maximum 127 adapters can be created.) - - -PREFIX D_CM_TRUST -CAPTION Manage Trusted CA Certificate List -STATIC1 Here you can manage the list of certificate authority (CA) certificates that are trusted.\r\n\r\nYou can use the CA certificate list registered here to verify server certificates when connecting to VPN Servers. -B_IMPORT &Add -B_EXPORT &Export -IDOK &View Certificate -IDCANCEL &Close -B_DELETE &Delete - - -PREFIX D_CM_PASSWORD -CAPTION Set Password - VPN Client Manager -S_TITLE You can set the password to limit the SoftEther VPN Client Service.\r\nAfter setting a password, you will be asked to enter a password the next time you use the VPN Client Connect Manager to connect to the SoftEther VPN Client service. -STATIC1 Set Client Administration Password: -R_USE_PASSWORD &Use Password -R_REMOTE_ONLY Only &Request Password for Remote Operation -IDC_STATIC1 &Password: -IDC_STATIC2 &Confirm: -IDOK &OK -IDCANCEL Cancel - - -PREFIX D_CM_CONFIG -CAPTION Optional Settings -STATIC1 You can modify the settings for VPN Client. -STATIC2 R&emote Management: -STATIC3 You can remotely manage the VPN Client Service Program from another computer by using VPN Client Manager Remote Mode. -R_ALLOW_REMOTE_CONFIG Allow &Remote Management of VPN Client Service -S_WARNING It is recommended to set a password if you allow remote management. From the menu bar, choose Tools -> Set Password to set the password. -STATIC4 For environments where Internet connections will automatically be disconnected when idle, you can keep alive the Internet connection by sending dummy packets to any host on the Internet. -R_USE_KEEP_CONNECT Use &Keep Alive Internet Connection Function -S_HOSTNAME &Host Name: -S_PORT &Port Number: -S_INTERVAL Packet Send &Interval: -S_INTERVAL2 seconds -S_PROTOCOL Pr&otocol: -R_TCP &TCP/IP Protocol -R_UDP &UDP/IP Protocol -S_INFO Packets sent to keep alive the Internet connection have random bits. No personal information is sent. -IDOK &OK -IDCANCEL Cancel -STATIC5 &Other Configurations: -R_ALPHA Transparency of UI: -STATIC6 Note: The transparency setting will be applied after the connection manager is restarted. -STATIC7 &Keep Alive Internet Connection Function: - - -PREFIX D_ABOUT -S_INFO1 SoftEther VPN %u.0 Developer Edition (Ver %u.%02u, Build %u) -S_INFO2 Licensed under the Apache License, Version 2.0.\r\nCopyright (c) 2012-%u all contributors on SoftEther VPN project in GitHub. All Rights Reserved.\r\nWeb Site: http://www.softether.org/\r\n%S -S_INFO3 This product includes the following software components:\r\nBitVisor: Copyright (c) 2007, 2008 University of Tsukuba. Copyright (C) 2007, 2008 National Institute of Information and Communications Technology. All rights reserved. / Microsoft(R) C Runtime Library: (c) 2007 Microsoft Corporation. All Rights Reserved. / PKCS #11 Cryptographic Token Interface (Cryptoki): Copyright (c) RSA Security Inc. / WinPcap: Copyright (c) 2001 - 2003 NetGroup, Politecnico di Torino (Italy). All rights reserved. / libedit: Copyright (c) 1992, 1993 The Regents of the University of California. All rights reserved. / libiconv: Copyright (C) 2007 Free Software Foundation, Inc. / ncurses: Copyright (c) 1998-2005, 2006 Free Software Foundation, Inc. / OpenSSL: Copyright (c) 1998-2011 The OpenSSL Project. All rights reserved. This product includes software developed by the OpenSSL Project for use in the OpenSSL Toolkit (http://www.openssl.org/). This product includes cryptographic software written by Eric Young (eay@cryptsoft.com). / zlib: (C) 1995-2004 Jean-loup Gailly and Mark Adler. / Special Thanks to: Software Laboratory, Academic Computing Communication Center, Industrial Liaison and Cooperative Research Center and Professor Yasushi Shinjo in University of Tsukuba, Japan. -S_INFO4 THIS SOFTWARE IS FREEWARE DEVELOPED UNDER THE SOFTETHER VPN PROJECT AT UNIVERSITY OF TSUKUBA, WITHOUT WARRANTY OF AND KIND. IN NO EVENT SHALL THE DEVELOPERS, COPYRIGHT OWNERS OR DISTRIBUTORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY IN ANY WAY OUT OF THE USE OF THIS SOFTWARE.\r\n\r\nSoftEther VPN is a work of the research and development project of Japanese Government, subsidized by Ministry of Economy, Trade and Industry of Japan, administrated by Information Promotion Agency. -IDCANCEL &OK -B_WEB Visit SoftEther VPN &Website... -B_EULA &End User License -B_IMPORTANT &Important Notices -B_LEGAL &Legal Notices -B_UPDATE_CONFIG &Configure Updates -B_AUTHORS List of &Authors - - -PREFIX D_REMOTE -STATIC1 &Specify the Host Name of the Destination Computer, or IP Address: -R_LOCAL Connect to &Local Computer (Computer Displaying this Window) -S_HOSTNAME &Computer Name: -IDOK &OK -IDCANCEL Cancel - - -PREFIX D_CM_DESKTOP -CAPTION Connection - %s -S_TITLE Starting connect process for VPN Connection Setting "%s". -S_WARNING VPN Client will output to the "Console Session" window of %s, the progress status and error messages related to the process of connecting to VPN Server -S_INFO Do you want to proceed with the connection? -IDOK &Continue -IDCANCEL Cancel - - -PREFIX D_CM_CHANGE_PASSWORD -CAPTION Change Password -S_TITLE You can change the password of the user registered on server %S. -STATIC1 Change &Password -STATIC2 Virtual &Hub Name: -STATIC3 &User Name: -STATIC4 &Old Password: -STATIC5 &New Password: -STATIC6 &Confirm of New Password: -IDOK &OK -IDCANCEL Cancel -S_STATIC Note: If authentication type is RADIUS or NT Domain Authentication, you cannot change the user's password here. - - -PREFIX D_SM_MAIN -CAPTION SoftEther VPN Server Manager Developer Edition -STATIC1 Connection &Settings for VPN Server: -STATIC2 Connection Settings for VPN Server or VPN Bridge are defined as follows. Double-click the item to connect to the server.\r\nTo add a new connection, click New Setting. -B_NEW_SETTING &New Setting -B_EDIT_SETTING &Edit Setting -B_DELETE &Delete Setting -IDOK &Connect -B_SECURE_MANAGER &Smart Card Manager... -B_SELECT_SECURE Select S&mart card... -B_ABOUT &About SoftEther VPN... -IDCANCEL E&xit SoftEther VPN Server Manager -B_CERT_TOOL Make a Certificate - - -PREFIX D_SM_EDIT_SETTING -STATIC1 Please configure the connection setting for the VPN Server or the VPN Bridge to manage. -STATIC2 Setting &Name: -STATIC3 Destination VPN Server: -STATIC4 Specify the host name or IP address, and the port number and the Virtual Hub on the destination VPN Server. -STATIC5 &Host Name: -R_LOCALHOST Connect to &Localhost -STATIC6 &Port Number: -STATIC7 (TCP Port) -STATIC8 Pro&xy Server as Relay: -STATIC9 You can connect to a VPN Server via a proxy server. -STATIC10 Proxy &Type: -R_DIRECT_TCP &Direct TCP/IP Connection (No Proxy) -R_HTTPS Connect via H&TTP Proxy Server -R_SOCKS Connect via S&OCKS4 Proxy Server -R_SOCKS5 Connect via S&OCKS5 Proxy Server -B_PROXY_CONFIG P&roxy Server Setting -STATIC11 Select Administration &Mode and Enter Password -STATIC12 You can connect to VPN Server using either Server Admin Mode or Virtual Hub Admin Mode.\r\n\r\nServer Admin Mode allows you manage entire VPN Server and all Virtual Hubs. \r\n\r\nVirtual Hub Admin Mode allows you manage only one Virtual Hub for which you hold privileges. -R_SERVER_ADMIN &Server Admin Mode -R_HUB_ADMIN Virtual H&UB Admin Mode -S_HUBNAME &Virtual Hub Name: -STATIC13 Please enter the password to connect administration mode. -S_PASSWORD &Password: -R_NO_SAVE Do not &Save Admin's Password -IDOK &OK -IDCANCEL Cancel - - -PREFIX D_SM_SERVER -CAPTION %s - SoftEther VPN Server Manager -S_TITLE Manage VPN Server "%S" -S_VHUB_BRIDGE Virtual Hubs Hosted by this VPN Server: -IDOK M&anage Virtual Hub -B_ONLINE &Online -B_OFFLINE O&ffline -B_HUB_STATUS View &Status -B_CREATE &Create a Virtual Hub -B_EDIT Prop&erties -B_DELETE &Delete -STATIC1 Management of &Listeners: -STATIC2 L&istener List (TCP/IP port): -B_CREATE_LISTENER C&reate -B_DELETE_LISTENER Dele&te -B_START Start -B_STOP Sto&p -S_UDP Multiple UDP ports can be specified by splitting them with a space or a comma. Leave empty to disable the UDP listener. -B_APPLY Apply -STATIC3 VPN Server and &Network Information and Settings: -B_SSL &Encryption and Network -B_STATUS &View Server Status -B_INFO About this VPN Server -B_LICENSE Add / Delete &Licenses -B_FARM Clustering Configuration -B_FARM_STATUS Clustering Status -B_CONNECTION Show List of\r\nTCP/IP Connections -B_BRIDGE Local &Bridge Setting -B_L3 Layer &3 Switch Setting -B_CONFIG E&dit Config -B_REFRESH Refres&h -IDCANCEL E&xit -S_BETA Beta Version (Pre-release) -B_IPSEC IPsec / L&2TP Setting -B_DDNS Dynamic DNS Setting -S_DDNS Current DDNS Hostname: -B_OPENVPN OpenVPN / MS-SSTP Setting -B_AZURE VPN Azure Setting -S_AZURE VPN Azure Hostname: -B_VPNGATE VPN Gate Setting - - -PREFIX D_SM_STATUS -IDOK Refres&h -IDCANCEL E&xit - - -PREFIX D_SM_EDIT_HUB -STATIC1 Virtual Hub &Name: -STATIC2 Security &Settings: -S_BOLD Administration password for this Virtual Hub. -STATIC3 &Password: -STATIC4 &Confirm: -R_NO_ENUM No En&umerate to Anonymous Users -STATIC5 V&irtual Hub Options: -R_LIMIT_MAX_SESSION &Limit Max VPN Sessions -S_MAX_SESSION_1 Ma&x Number of Sessions: -S_MAX_SESSION_2 sessions -STATIC6 (Will not count sessions on server side that are generated by Local Bridge, Virtual NAT or Cascade Connection.) -STATIC7 Virtual Hub Status: -STATIC8 Set the Virtual Hub status. -R_ONLINE Onlin&e -R_OFFLINE O&ffline -STATIC9 Set Clustering: -S_FARM_INFO Select the Virtual Hub type in the cluster. -R_STATIC St&atic Virtual Hub -R_DYNAMIC &Dynamic Virtual Hub -S_AO_1 Virtual Hub Admin Option: -S_AO_3 Display and edit the Virtual Hub administration options. -B_ADMINOPTION Virtual Hub Admin Option -S_ACL_3 Sou&rce IP Address Limit List -S_ACL Allow or deny VPN connections to this Virtual Hub according to the client computer's IP address. -B_ACL IP Access Con&trol List -IDOK &OK -IDCANCEL Cancel -STATIC10 You can configure more advanced settings on the Virtual Hub Extended Option List. -B_EXTOPTION Edit Virtual Hub Extended Option List -S_MSG_1 Show Message when Client Connects -S_MSG_2 Shows a message on the screen of a user when a VPN Client connects to this Virtual Hub. -B_MSG Set the Messa&ge - - -PREFIX D_SM_CREATE_LISTENER -CAPTION Create Listener -STATIC1 You can add a TCP/IP port number for the VPN Server to accept connections from clients. \r\n\r\nSpecify the port number to add. -STATIC2 If the port number is already being used by another server program, the status of the new listener will be error. \r\n\r\nIn this case, stop the other program that is opening the same port. -STATIC3 &Port Number: -IDOK &OK -IDCANCEL Cancel -STATIC4 (TCP/IP Port) - - -PREFIX D_SM_SSL -CAPTION Encryption and Network Settings -STATIC1 You can view or change settings related to encryption, communication and security for this VPN Server. -STATIC2 Encryption &Algorithm Settings: -STATIC3 Specify the encryption algorithm for SSL applied to the connection between this VPN Server and VPN Clients. The encryption algorithm must be compatible with SSL Version 3. -STATIC4 En&cryption Algorithm Name: -STATIC6 Server &Certificate Settings: -STATIC7 Specify the X509 certificate and private key to be presented to clients by this server. -B_IMPORT &Import -B_EXPORT E&xport -B_VIEW &View -B_REGENERATE New -STATIC8 &Keep Alive Internet Connection: -STATIC9 For environments where Internet connections will automatically be disconnected when idle, you can keep alive the Internet connection by sending dummy packets to any host on the Internet. -STATIC10 Server Certificate: -R_USE_KEEP_CONNECT Use &Keep Alive Internet Connection -S_HOSTNAME &Host Name: -S_PORT &Port: -S_INTERVAL Send &Interval: -S_INTERVAL2 seconds -S_PROTOCOL Pr&otocol: -R_TCP &TCP/IP Protocol -R_UDP &UDP/IP Protocol -S_INFO Packets sent to keep alive the Internet connection have random bits. No personal information is sent. -STATIC11 Administrator Pass&word: -S_INFO4 You can modify an administrator password of the administrator for all Virtual Hubs and this entire VPN Server. -B_PASSWORD Change Admin &Password -IDOK &OK -IDCANCEL Cancel -IDCANCEL2 Cancel -STATIC12 Syslog Send Function: -STATIC13 You can transfer the entire VPN Server / Bridge Logs, Virtual Hub Administration Logs, or Virtual Hub Packet Logs by using syslog protocol instead of writing to a local disk. -STATIC14 Syslog &Server Host Name: -STATIC15 P&ort: -S_OVER_FUNCS VPN over ICMP / DNS Server Function -S_INFO5 You can establish a VPN only with ICMP or DNS packets even if there is a firewall or routers which blocks TCP/IP communications. -B_SPECIALLISTENER VPN over ICMP / DNS Settings -B_UPDATE_CONFIG &Update Notify Setting... - - -PREFIX D_SM_SAVE_KEY_PAIR -CAPTION Save Certificate and Private Key -STATIC1 Select the method to save the certificate and private key. -STATIC2 Sa&ve Method: -R_X509_AND_KEY Save as &X509 Certificate (.CER) and Private Key File (.KEY) -R_PKCS12 Save as &PKCA#12 File (.P12) -R_SECURE Write to &Smart Card -STATIC3 Saving by splitting into two files: a standard Base 64-encoded certificate file and a private key file. -STATIC4 Saving as a PKCS#12 (Public Key Cryptography Standard #12) file. \r\nYou can store both certificate and private key in a single PKCS#12 file. -STATIC5 When a smart card is connected to this computer, you can write the certificate and private key to a smart card. -B_SELECT &Select Which Smart Card to Use... -S_PASS3 Private Key P&rotection: -S_PASS4 When saving the private key, you can set a passphrase to encrypt. You will be required to enter the passphrase when loading it. -R_USE_PASS Set P&assphrase -S_PASS1 Pa&ssphrase: -S_PASS2 Con&firm: -IDOK &OK -IDCANCEL Cancel -B_SECURE_MANAGER Smart Card &Manager... - - -PREFIX D_SM_CONNECTION -CAPTION Connection List -S_TITLE The server %S has the following active connections. Connections which have been established as a VPN session are not included. -IDOK Show Connection &Information -B_DISCONNECT &Disconnect -B_REFRESH Refres&h -IDCANCEL E&xit - - -PREFIX D_SM_FARM -CAPTION Clustering Configuration -S_TITLE You can change configuration for clustering function of VPN Server "%S". -STATIC1 Clustering can realize load balancing and fault balance protection to bundle multiple VPN Servers. -STATIC2 Current Mode: -STATIC3 Clustering Se&ttings: -R_STANDALONE &Standalone Server (No Clustering) -R_CONTROLLER &Cluster Controller -R_MEMBER Cluster &Member Server -STATIC4 C&onfigurable Parameters as a Member Server: -S_IP_1 Public &IP Address: -S_IP_2 (When a public IP address is omitted, the IP address of the network interface used when connecting to the cluster controller will be used.) -S_PORT_1 &Public Port List: -S_PORT_2 (Separate multiple port numbers by a space or a comma.) -S_CONTROLLER Controller &Host Name or IP Address: -S_CONTROLLER_PORT Port Number of\r\nControlle&r: -S_PORT_3 (TCP Port) -S_PASSWORD Administration &Password: -STATIC5 When you modify a clustering configuration, the VPN Server service restarts automatically. When this happens, all the currently connected sessions and administration-related connections will be disconnected. -IDOK &OK -IDCANCEL Cancel -S_1 Standard Ratio in Cluster: -S_2 (Standard: 100) -R_CONTROLLER_ONLY Controller Functions Only (No VPN session in itself) - - -PREFIX D_SM_FARM_MEMBER -CAPTION Cluster Member List -S_TITLE Currently the following Cluster Member Servers are connected to the Cluster Controller %S. -IDOK Cluster Member Server &Information -B_REFRESH Refres&h -IDCANCEL E&xit -B_CERT View Server &Certificate - - -PREFIX D_SM_CHANGE_PASSWORD -CAPTION Change Administrator Password of %S -S_TITLE Change the administrator password of the server %S. Enter the new password and click OK. -STATIC1 New &Password: -STATIC2 &Confirm Password: -IDOK &OK -IDCANCEL Cancel - - -PREFIX D_SM_HUB -CAPTION Management of Virtual Hub - '%S' -S_TITLE Virtual Hub '%S' -STATIC1 Management of Security &Database: -B_USER Manage &Users -S_USER Add, delete or edit user accounts. -B_GROUP Manage &Groups -S_GROUP Add, delete or edit groups. -B_ACCESS Manage &Access Lists -S_ACCESS Add or delete access lists (Packet filtering rules). -STATIC2 Virtual Hub Settings: -B_PROPERTY Virtual Hub &Properties -S_PROPERTY Configure this Hub. -B_RADIUS Auth&entication Server Setting -S_RADIUS Use external RADIUS authentication server for user authentication. -B_LINK Manage &Cascade Connections -S_LINK Establish Cascade Connection to Hubs on local or remote VPN Servers. -STATIC3 Cu&rrent Status of this Virtual Hub: -B_REFRESH Refres&h -STATIC4 &Other Settings: -B_LOG &Log Save Setting -B_LOG_FILE Log File List -S_LOG Configure settings of log saving function. -B_CA &Trusted CA Certificates -B_CRL Revo&ked Certs -S_CA Manage trusted CA certificates. -B_SNAT &Virtual NAT and Virtual DHCP Server (SecureNAT) -S_SNAT Secure NAT is available on this Virtual Hub. You can run Virtual NAT and Virtual DHCP. -STATIC5 VPN Sess&ions Management: -B_SESSION Manage &Sessions -IDCANCEL E&xit - - -PREFIX D_SM_USER -CAPTION Manage Users -S_TITLE Virtual Hub "%S" has the following users. -IDOK &Edit -B_CREATE &New -B_DELETE &Remove -B_REFRESH &Refresh -IDCANCEL E&xit -B_STATUS &View User Info - - -PREFIX D_SM_EDIT_USER -IDC_STATIC1 &User Name: -IDC_STATIC3 &Full Name: -IDC_STATIC4 &Note: -IDC_STATIC5 Group Name\r\n(Optional): -B_GROUP Browse Groups... -R_EXPIRES &Set the Expiration Date for This Account -IDC_STATIC6 &Auth Type: -S_RADIUS_3 RADIUS or NT Domain Authentication Settings: -S_RADIUS_1 Login attempts by password will be verified by the external RADIUS server, Windows NT domain controller, or Active Directory controller. -R_SET_RADIUS_USERNAME Specify User Name on Authentication Server -S_RADIUS_2 User Name on Authentication Server: -S_POLICY_1 Security Policy -R_POLICY Set Securit&y Policy -B_POLICY Security Policy -S_PASSWORD_1 Password Authentication Settings: -S_PASSWORD_2 &Password: -S_PASSWORD_3 &Confirm Password: -S_USER_CERT_1 Individual Certificate Authentication Settings: -B_LOAD_CERT Sp&ecify Certificate -B_VIEW_CERT &View Certificate -B_CREATE Create Certificate -S_ROOT_CERT_1 Signed Certificate Authentication Settings: -S_ROOT_CERT_2 Verification of whether the client certificate is signed is based on a certificate of a CA trusted by this Virtual Hub. -R_CN Limit Common Name (CN) Value -R_SERIAL &Limit Values of the Certificate Serial Number -S_ROOT_CERT_3 Note: Enter hexadecimal values. (Example: 0155ABCDEF) -S_HINT Hint: Define a user object with username '*' (asterisk) in order to accept a login attempt of a user which does not match any of registered explicit user objects. Such a special user will use the external user-authentication server to verify the login. -IDOK &OK -IDCANCEL Cancel - - -PREFIX D_SM_POLICY -STATIC1 Selected &Policy: -S_BOLD Des&cription of the policy: -S_BOLD2 Current &Value: -R_ENABLE &Enable the Policy -R_DISABLE &Disable the Policy -R_DEFINE De&fine the Policy -IDOK &OK -IDCANCEL Cancel - - -PREFIX D_SM_GROUP -CAPTION Manage Groups -S_TITLE Virtual Hub "%S" has the following groups. -B_CREATE &New -IDOK &Edit -B_DELETE &Remove -B_REFRESH &Refresh -B_USER &Member List -IDCANCEL E&xit - - -PREFIX D_SM_EDIT_GROUP -IDC_STATIC1 &Group Name: -IDC_STATIC3 &Full Name: -IDC_STATIC4 &Note: -S_POLICY_1 Security Policy: -R_POLICY Set this group's Securit&y Policy -B_POLICY Security Policy -S_POLICY_2 Statistical Information of the Group: -IDOK &OK -IDCANCEL Cancel - - -PREFIX D_SM_ACCESS_LIST -CAPTION Access Lists -S_TITLE The Virtual Hub "%S" has the following access lists (packet filtering rules). -B_ADD &New (IPv&4) -B_ADD_V6 &New (IPv&6) -IDOK &Edit -B_DELETE &Delete -B_SAVE &Save -IDCANCEL &Cancel -STATIC1 Items with higher priority appear higher in the list. -STATIC2 Note: IP packets that did not match any access list items can pass. -B_CLONE Cl&one -B_ENABLE E&nable -B_DISABLE D&isable - - -PREFIX D_SM_EDIT_ACCESS -CAPTION Edit Access List Item -STATIC1 Configure the access list settings. The access list that is defined here will be applied to all IP packets passing through the Virtual Hub. -STATIC2 Basic Settings -STATIC3 &Memo: -STATIC4 &Action: -R_PASS &Pass -R_DISCARD &Discard -STATIC5 P&riority: -STATIC6 (Smaller number has higher priority.) -STATIC7 Filtering Options for IP Headers -S_ACCESS_SRC_ALL Source IP Address: -R_SRC_ALL Applies to All Source Addresses -S_SRC_IP_1 IPv4 Address: -S_SRC_IP_2 Subnet Mask: -S_SRC_IP_3 (255.255.255.255 means a single host) -S_SRC_IP_1_V6 IPv6 Address: -S_SRC_IP_3_V6 (For example: "ffff:ff00::" or "/24". "/128" means a single host.) -S_ACCESS_DST_ALL Destination IP Address: -R_DST_ALL Applies to All Destination Addresses -S_IP_DST_1 IPv4 Address: -S_IP_DST_2 Subnet Mask: -S_IP_DST_3 (255.255.255.255 means Specified host only) -S_IP_DST_1_V6 IPv6 Address: -S_IP_DST_3_V6 (For example: "ffff:ff00::" or "/24". "/128" means a single host.) -STATIC9 Protocol Type: -STATIC10 Filtering Options for TCP Headers and UDP Headers -S_TCP_1 Minimum -S_TCP_2 Maximum -S_TCP_3 Source Port: -S_TCP_5 Destination Port: -S_TCP_7 The blank port number field matches any ports.\r\nIt will apply to packets that match only the minimum value when the minimum value is specified but the maximum value is not. -STATIC11 Filtering Options for Users or Groups -STATIC11_OLD Filtering Options for Users -STATIC12 This access list will be applied only to the packets that for specific users, groups send or receive. -STATIC12_OLD This access list will be applied only to packets that for specific users send or receive. -STATIC13 Source Name: -B_USER1 Browse... -STATIC14 Destination Name: -B_USER2 Browse... -STATIC15 Leave these fields blank if you don't specify user name nor group name. -STATIC15_OLD Leave these fields blank if you don't specify user name. -IDOK &OK -IDCANCEL Cancel -S_PROTOID Specify IP Protocol: -STATIC16 Filtering Options for MAC Headers -S_CHECK_SRC_MAC Source MAC Address: -R_CHECK_SRC_MAC Applies to any Source Addresses -S_SRC_MAC MAC Address: -S_SRC_MAC_MASK Mask: -S_CHECK_DST_MAC Destination MAC Address: -R_CHECK_DST_MAC Applies to any Destination Addresses -B_SIMULATION De&lay and Packet Loss... -S_DST_MAC MAC Address: -S_DST_MAC_MASK Mask: -S_MAC_NOTE You can use hexadecimal number with two separators, "-" or ":", and without the separators.\r\n(FF-FF-FF-FF-FF-FF means a specified host) -R_CHECK_TCP_STATE Verify TCP Connection State (Only TCP Packets) -R_ESTABLISHED Established Packet -R_UNESTABLISHED Unestablished Packet -R_REDIRECT Redirect HTTP Request to Specific URL -B_REDIRECT Set URL Redirect to... - -PREFIX D_SM_RADIUS -CAPTION Authentication Server Settings -S_TITLE To use an external RADIUS server to verify login attempts to the Virtual Hub "%S", specify an external RADIUS server that verifies the user name and password. -STATIC1 RADIUS Server Settings: -R_USE_RADIUS &Use RADIUS Authentication -S_RADIUS_1 RADIUS &Server Host Name or IP: -S_RADIUS_2 &Port: -S_RADIUS3 (UDP Port) -S_RADIUS_4 Shared S&ecret: -S_RADIUS_5 &Confirm Shared Secret: -S_RADIUS_6 The RADIUS server must accept requests from IP addresses of this VPN Server. Also, authentication by Password Authentication Protocol (PAP) must be enabled. -S_RADIUS_7 milliseconds (above %u, below %u) -S_RADIUS_8 &Retry Interval -S_RADIUS_9 (use ',' or ';' to split multiple hostnames.) -STATIC2 When using Windows NT Domain Controller or Windows Server Active Directory Controller as an external authentication server, you must setup the VPN Server computer to join the domain. To use NT Domain Authentication, there are no items to configure here. -IDOK &OK -IDCANCEL Cancel - - -PREFIX D_SM_LINK -CAPTION Cascade Connections on %S -STATIC1 Cascade Connection can make a layer-2 Ethernet-level links between this Virtual Hub and other Virtual Hub which is located on either local or remote VPN Server. -STATIC2 Before Using Cascade Connection -STATIC3 Cascade Connection realizes a Layer 2 Bridge between multiple Virtual Hubs. But if the connection is incorrectly configured, an infinity loop could inadvertently be created. When using a Cascade Connection function please design the network topology with care. -B_CREATE &New -B_EDIT &Edit -B_ONLINE O&nline -B_OFFLINE O&ffline -IDOK &Status -B_DELETE &Delete -B_RENAME Ren&ame -B_REFRESH &Refresh -IDCANCEL E&xit - - -PREFIX D_SM_LOG -CAPTION Log Save Settings -S_TITLE You can save the security logs (such as history of user logins) of Virtual Hub "%S", and the packet logs of all packets that pass through the Virtual Hub. -STATIC1 &Security Log: -B_SEC Save S&ecurity Log -S_SEC Log File S&witch Cycle: -STATIC2 &Packet Log: -B_PACKET Save Pack&et Log -S_PACKET Log File S&witch Cycle: -S_PACKET_0 TCP Connection: -B_PACKET_0_0 Do not Save -B_PACKET_0_1 Header Only -B_PACKET_0_2 Headers && Payloads -S_PACKET_1 TCP Packet: -B_PACKET_1_0 Do not Save -B_PACKET_1_1 Header Only -B_PACKET_1_2 Headers && Payloads -S_PACKET_2 DHCP Packet: -B_PACKET_2_0 Do not Save -B_PACKET_2_1 Header Only -B_PACKET_2_2 Headers && Payloads -S_PACKET_3 UDP Packet: -B_PACKET_3_0 Do not Save -B_PACKET_3_1 Header Only -B_PACKET_3_2 Headers && Payloads -S_PACKET_4 ICMP Packet: -B_PACKET_4_0 Do not Save -B_PACKET_4_1 Header Only -B_PACKET_4_2 Headers && Payloads -S_PACKET_5 IP Packet: -B_PACKET_5_0 Do not Save -B_PACKET_5_1 Header Only -B_PACKET_5_2 Headers && Payloads -S_PACKET_6 ARP Packet: -B_PACKET_6_0 Do not Save -B_PACKET_6_1 Header Only -B_PACKET_6_2 Headers && Payloads -S_PACKET_7 Ethernet\r\nPacket: -B_PACKET_7_0 Do not Save -B_PACKET_7_1 Header Only -B_PACKET_7_2 Headers && Payloads -IDOK &OK -IDCANCEL Cancel -STATIC3 Saving large amounts of packet logs can place a large burden on the CPU and the hard disk and it can cause lower performance of Hub and entire VPN Server. Enable logging on only the necessary packet log to save. - - -PREFIX D_SM_CA -CAPTION Manage Trusted CA Certificates -STATIC1 You can manage the list of certificate authority (CA) certificates that are trusted by this Virtual Hub.\r\n\r\nThe list of CA certificates that is listed here is used to verify certificates when a VPN Client is connected in signed certificate authentication mode. -B_IMPORT &Add -IDOK &View Certificate -IDCANCEL &Close -B_DELETE &Delete - - -PREFIX D_SM_SESSION -CAPTION Manage Sessions - %S -S_TITLE Virtual Hub "%S" has the following VPN sessions currently. -STATIC1 Operations for Sessions -IDOK Session &Information -B_DISCONNECT &Disconnect -B_REFRESH Refres&h -B_SESSION_MAC_TABLE &MAC Table of Selected Session -B_SESSION_IP_TABLE I&P Table of Selected Session -STATIC2 &Other Administration Tasks -B_MAC_TABLE MAC &Address Table List -B_IP_TABLE IP Address Ta&ble List -IDCANCEL E&xit -S_FARM_INFO_2 The sessions displayed here are all sessions on the current cluster. To manage sessions on other cluster member servers you must connect as an administrator to those servers. - - -PREFIX D_SM_MAC -CAPTION MAC Address Table -S_TITLE The MAC address table database on the Virtual Hub "%S" has the following entries. -B_DELETE &Delete Selected Entry -B_REFRESH Refres&h -IDCANCEL E&xit - - -PREFIX D_SM_IP -CAPTION IP Address Table -S_TITLE The IP address table database on the Virtual Hub "%S" has the following entries. -B_DELETE &Delete Selected Entry -B_REFRESH Refres&h -IDCANCEL E&xit - - -PREFIX D_SM_CREATE_CERT -CAPTION Create New Certificate -STATIC1 You can easily create certificates which is signed by self or other certificates. -STATIC2 Certificate &Type: -R_ROOT_CERT &Root Certificate (Self-Signed Certificate) -R_SIGNED_CERT Certificate &Signed by Other Certificate -S_LOAD_1 &Certificate and Private Key for Signing: -B_LOAD &Load Certificate and Private Key -S_LOAD_2 Click 'Load Certificate and Private Key' to specify the X509 Certificate and RSA Private Key that will user a new certificate signature. -S_LOAD_3 Common Name (CN): -S_LOAD_4 Organization (O): -S_LOAD_5 Organization Unit (OU): -S_LOAD_6 Country (C): -S_LOAD_7 State (ST): -S_LOAD_8 Locale (L): -S_LOAD_11 &Serial Number:\r\n(Hexadecimal) -S_LOAD_9 &Expires in: -S_LOAD_10 Days -STATIC3 To manage certificates and certificate authorities on a large scale, you should use either free software such as OpenSSL, or commercial CA (certificate authority) software. -IDOK &OK -IDCANCEL Cancel -S_LOAD_12 Strength&ness: - - -PREFIX D_NM_LOGIN -CAPTION deleted -S_TITLE deleted -STATIC1 deleted -STATIC2 deleted -IDOK deleted -IDCANCEL deleted - - -PREFIX D_SPEEDMETER -CAPTION Network Device Status -STATIC1 Select Network Adapter: -STATIC2 Real-time Status -STATIC3 &Refresh - - -PREFIX D_NM_MAIN -CAPTION deleted -STATIC1 deleted -STATIC2 deleted -B_SETTING Connection &Setting for VPN Server -B_CONNECT &Connect -B_DISCONNECT &Disconnect -STATIC3 Operation Settings of User-mode Router -STATIC4 You can set the operations in a virtual network of a SoftEther VPN User-mode Router. -B_OPTION &Operation Settings of User-mode Router -STATIC5 Operating Status of User-mode Router -STATIC6 Displays the current operating status of the SoftEther VPN User-mode Router. -B_NAT Virtual &NAT Status -B_DHCP Virtual D&HCP Server Status -B_STATUS User-mode &Router Status -B_INFO User-mode Router &Information -B_PASSWORD Administration &Password Setting -B_REFRESH Refr&esh -B_ABOUT &About... -IDCANCEL E&xit - - -PREFIX D_NM_OPTION -CAPTION SecureNAT Configuration -S_TITLE Set how SecureNAT virtual host performs operation on the virtual network of Virtual Hub "%S". -STATIC1 Virtual Host's Network Interface Settings: -STATIC2 &MAC Address: -STATIC3 I&P Address: -STATIC4 &Subnet Mask: -STATIC5 Virtual NAT Settings: -R_USE_NAT Use Virtual N&AT Function -STATIC6 M&TU Value: -STATIC7 bytes -STATIC8 T&CP Session Timeout: -STATIC9 seconds -STATIC10 &UDP Session Timeout: -STATIC11 seconds -R_SAVE_LOG Save NAT or DHCP Server Operations to &Log File -STATIC12 Virtual DHCP Server Settings: -R_USE_DHCP Use Virtual DHCP Server Fu&nctions -STATIC13 &Distributes IP Address: -STATIC14 to -STATIC15 . -STATIC16 Su&bnet Mask: -STATIC17 L&ease Limit: -STATIC18 seconds -STATIC19 Options Applied to Clients (optional): -STATIC20 De&fault Gateway\r\nAddress: -STATIC21 DNS &Server Address 1: -STATIC22 Domain Name: -STATIC23 DNS &Server Address 2: -IDOK &OK -IDCANCEL Cancel -S_1 Static routing table pushing function (for split tunneling) -S_2 Push the static routing table to VPN clients. -B_PUSH Edit the static routing table to push - - -PREFIX D_NM_NAT -CAPTION NAT Session Table on Virtual NAT Router -S_TITLE There are the following TCP or UDP NAT table entries on the virtual NAT router of SecureNAT. -B_REFRESH Refres&h -IDCANCEL E&xit - - -PREFIX D_NM_DHCP -CAPTION IP Lease Table on Virtual DHCP Server -S_TITLE The SecureNAT Virtual DHCP Server has allocated the following IP addresses to clients. -B_REFRESH Refres&h -IDCANCEL E&xit - - -PREFIX D_NM_CHANGE_PASSWORD -CAPTION Change Administrator Password of %S -S_TITLE You can change the administrator password of SoftEther VPN User-mode Router (%S). Click OK after entering the new password. -STATIC1 New &Password: -STATIC2 &Confirm Your Input: -IDOK &OK -IDCANCEL Cancel - - -PREFIX D_SM_SNAT -CAPTION Virtual NAT and Virtual DHCP Function (SecureNAT) Setting -S_TITLE SecureNAT enables you to operate a virtual NAT router (IP Masquerade) and DHCP Server function on a virtual network of Virtual Hub "%S". -STATIC1 Warning about SecureNAT -S_WARNING The SecureNAT function is recommended only for system administrators or people with a detailed knowledge of networking. -S_WARNING2 If you use the SecureNAT correctly, it is possible to realize a safety remote access via a VPN. However when you use this as incorrectly, it can put the entire network in danger. Anyone who does not have a thorough knowledge of networks and anyone who does not have the network administrator's permission must not enable the SecureNAT. For a detailed explanation of the SecureNAT function, please refer to the VPN Server's manual or online documentation. -STATIC2 Enabling / Disabling and Changing the Setting of the SecureNAT -STATIC3 You can enable, disable or change the settings of the SecureNAT on this Virtual Hub. -B_ENABLE &Enable SecureNAT -B_DISABLE &Disable SecureNAT -B_CONFIG SecureNAT &Configuration -STATIC4 Note: When a running SecureNAT is disabled, all active TCP and UDP sessions that are connected via SecureNAT will be terminated. -STATIC5 View Current SecureNAT Status -STATIC6 You can view the current SecureNAT operating status. -B_NAT Virtual &NAT Router Status -B_DHCP Virtual D&HCP Server Status -B_STATUS View &SecureNAT Operating Status -S_TSUKUBA2 SecureNAT uses technology that Daiyuu Nobori developed in 2004 at "Special Seminar on Information I" at the College of Information Science of the Third Cluster of Colleges, Tsukuba University. -IDCANCEL E&xit - - -PREFIX D_SM_BRIDGE -CAPTION Local Bridge Settings -STATIC1 Local Bridge can establish a Layer 2 bridge connection between a Virtual Hub on this VPN server and a physical Ethernet Device (Network Adapter). \r\nIt is also possible to create a tap device (virtual network interface) and establish a bridge connection with a Virtual Hub. (Tap is supported on Linux versions only) -B_DELETE &Delete Local Bridge -STATIC2 New &New Local Bridge Definition: -STATIC3 Select the Virtual Hub to bridge. -STATIC4 Virtual &Hub: -STATIC5 &Type to Create: -R_BRIDGE Bridge with &Physical Existing Network Adapter -R_TAP Bridge with New &Tap Device -S_ETH_1 LAN Adapter: -S_TAP_1 New Tap &Device Name: -S_TAP_2 (Maximum 11 Characters) -STATIC6 Note: Although it is possible to establish a bridge using any operating network adapter, in high load environments, you should prepare a network adapter dedicated for bridging. -IDOK Cre&ate Local Bridge -STATIC7 If a network adapter doesn't appear which is recently added on the system, reboot the computer and re-open this screen. -IDCANCEL E&xit -B_VLAN VLAN Transparency Setting Tool - - -PREFIX D_WIN9X_REBOOT -CAPTION VPN Client - Install Virtual Network Adapter -STATIC1 The VPN Client Virtual Network Adapter has been installed. \r\nIt is necessary to shutdown Windows now and restart the computer. \r\n\r\nThe computer will restart automatically. If the computer does not restart, please restart the computer manually. - - -PREFIX D_EM_MAIN -CAPTION SoftEther EtherLogger Manager -STATIC1 SoftEther EtherLogger is a service that captures data flowing through LAN cards connected to the computer and keeps a log of the headers of the packet types specified by the administrator and all data in text file format. \r\n\r\nCurrently, the following capture devices are performing capture logging. -B_PASSWORD Administration &Password -B_LICENSE &License -B_ADD &Add -IDOK &Edit -B_DELETE &Delete -IDCANCEL E&xit - - -PREFIX D_EM_ADD -STATIC1 Name of Network Adapter Used for Capture: -R_PROMISCUOUS Do&n't Use Promiscuous Mode During Capture -STATIC2 &Packet Log: -S_PACKET Log File S&witch Cycle: -S_PACKET_0 TCP Connection Log: -B_PACKET_0_0 Save Nothing -B_PACKET_0_1 Header Information Only -B_PACKET_0_2 Whole Packet Contents -S_PACKET_1 TCP Packet Log: -B_PACKET_1_0 Save Nothing -B_PACKET_1_1 Header Information Only -B_PACKET_1_2 Whole Packet Contents -S_PACKET_2 DHCP Packet Log: -B_PACKET_2_0 Save Nothing -B_PACKET_2_1 Header Information Only -B_PACKET_2_2 Whole Packet Contents -S_PACKET_3 UDP Packet Log: -B_PACKET_3_0 Save Nothing -B_PACKET_3_1 Header Information Only -B_PACKET_3_2 Whole Packet Contents -S_PACKET_4 ICMP Packet Log: -B_PACKET_4_0 Save Nothing -B_PACKET_4_1 Header Information Only -B_PACKET_4_2 Whole Packet Contents -S_PACKET_5 IP Packet Log: -B_PACKET_5_0 Save Nothing -B_PACKET_5_1 Header Information Only -B_PACKET_5_2 Whole Packet Contents -S_PACKET_6 ARP Packet Log: -B_PACKET_6_0 Save Nothing -B_PACKET_6_1 Header Information Only -B_PACKET_6_2 Whole Packet Contents -S_PACKET_7 Ethernet\r\nPacket Log: -B_PACKET_7_0 Save Nothing -B_PACKET_7_1 Header Information Only -B_PACKET_7_2 Whole Packet Contents -IDOK &OK -IDCANCEL Cancel -STATIC3 Saving large volume packet logs can place a large burden on the CPU and the hard disk and it can cause lower performance of the entire system. Please configure settings so that only the necessary packet log information is saved. - - -PREFIX D_EM_PASSWORD -CAPTION Change Administrator Password -S_TITLE You can change the administrator password. Click OK after entering the new password. -STATIC1 New &Password: -STATIC2 &Confirm: -IDOK &OK -IDCANCEL Cancel - - -PREFIX D_EM_LICENSE -CAPTION Add or Delete License -STATIC1 To use SoftEther EtherLogger you must acquire a valid license and register the license key. Using this window, you can register a new license key, delete a registered license key and display the current license list and the license mode of the SoftEther EtherLogger. -S_BOLD &List of Currently Registered Licenses: -B_OBTAIN &Obtain License -STATIC2 Click Obtain License to display the website that will provide instructions on how to obtain a license. -B_ADD &Add License Key Registration -B_DEL &Delete -IDOK &Information About License -STATIC3 Select a license and click Information About License to connect to SoftEther VPN Project's website (softether.com) and view the registered information relating to the selected license. -S_BOLD2 Current License &Mode of SoftEther EtherLogger: -IDCANCEL E&xit - - -PREFIX D_EM_LICENSE_ADD -CAPTION Add License Key Registration -S_INFO You can register a license key of a SoftEther EtherLogger product license. -STATIC1 The license keys are 36 alphanumeric characters in length plus hyphens. They are key codes that certify the ownership of a license. \r\n\r\nWhen a license certificate is received together with this software, the license key is printed on this license certificate. If the license for this software has been purchased online, the license key is provided by email and on the website window at the time the license is purchased. The license key may also be written down by some other method. If you don't know where the license key is written down, ask the vendor who sold you the license. -STATIC2 &Input the License Key Correctly: -STATIC3 Enter the license key by separating the input into 6-digit groups. You don't need to input the hyphens. It is also possible to copy && paste the license key. -B_INFO2 This software has world-wide copyright protection. Customers can only make copies and use this software in accordance with the license conditions. Warning: Use of illegitimately obtained license keys, use of a single license on multiple servers, or unauthorized distribution of licenses is a breach of the license agreement and such action may result in civil or legal proceedings. -IDOK &Register -IDCANCEL Cancel - -PREFIX D_EM_REMOTE -STATIC1 &Specify the Host Name of the Destination Computer, or IP Address: -R_LOCAL Connect to &Local Computer (Computer Displaying this Window) -S_HOSTNAME &Computer Name: -IDOK &OK -IDCANCEL Cancel -B_ABOUT Version information - -PREFIX D_SM_CONFIG -CAPTION Edit Config File -IDC_INFO The current configuration of the VPN Server "%S" is as follows.\r\nYou can edit the contents of this configuration file and apply it to the VPN Server. -B_EXPORT &Save to File -B_IMPORT &Import File and Apply -IDCANCEL &Close -STATIC1 You can edit the configuration file by using any text editors. When applying the edited configuration file to the VPN Server, the VPN Server will automatically restart and launch according to the new configuration file. If an invalid configuration file is applied, errors will occur and the current setting contents will get lost, so be careful when editing the configuration file. -B_FACTORY &Restore to Factory Default - - -PREFIX D_SM_ADMIN_OPTION -CAPTION Virtual Hub Administration Option -S_INFO Currently the following administration options are set for the Virtual Hub "%S". -B_ADD &Add Value -B_EDIT &Edit Value -B_DELETE &Delete Value -STATIC1 The purpose of the Virtual Hub administration options is to set limitations to administrators who are in Virtual Hub Admin Mode. -IDOK &Save -IDCANCEL Cancel -STATIC2 Only an administrator for this entire VPN Server may edit the Virtual Hub administration options. The individual Virtual Hub administrators are unable to change the administration options, however they are able to view them.\r\nHowever, if allow_hub_admin_change_option is set to "1", then Virtual Hub administrators are able to edit the administration options. -S_BOLD Description: - - -PREFIX D_SM_MSG -CAPTION Set the Message -S_MSG_2 You can set a message to display on the screen of a user when a VPN Client connects to the Virtual Hub "%S". To show a message, input the message that you want to show. -C_USEMSG Show &Message -STATIC1 About the Message Display Function -S_INFO The VPN Client must be Version 3.0 or later.\r\n\r\nSpecify a single line starts with "http://" as the message to open the default Web browser on the client instead to showing a message. -IDOK &OK -IDCANCEL Cancel - - -PREFIX D_NICINFO -CAPTION Virtual Network Adapter "%S" Status -IDCANCEL &Close - - -PREFIX D_SM_VLAN -CAPTION VLAN Transparency Setting Tool -STATIC1 Some network adapters are unable to transmit tagged-VLAN packets (IEEE802.1Q) transparency. by default\r\n\r\nIf you use such a network adapter to bridge to the Virtual Hub and need to exchange Ethernet packets with VLAN tags, you have to configure the network adapter to enable processing packets for VLAN transparency. -B_ENABLE Configure the Selected Network Adapters to VLAN Transparency -B_DISABLE &Unset the Configuration -STATIC2 About the VLAN Transparency Setting Tool -S_WARNING This tool can enable or disable the transparency for tagged VLAN packets on Intel, Broadcom or Marvell's network adapters. (Only using the vendor provided drivers for Windows.) -S_WARNING2 The above network adapters in the list means supported by this tool. No other network adapters can be configured by this tool. However, other network adapters which is not on the list might be able to support tagged VLAN packets by default or by using some configuration.\r\n\r\nSuch network adapters must be configured by the system administrator with logged on Windows. -IDCANCEL E&xit - - -PREFIX D_SM_SIMULATION -CAPTION Delay and Packet Loss Generating Function -STATIC1 This function can generate delays, jitters and packet losses on packets which match the condition of this access list entry when transmitted via this Virtual Hub.\r\n\r\nThis function is convenient to simulate a low-quality and slow Internet, WAN or wireless connections on the desk or laboratory. For example, you can use it to evaluate and test IP telephonies (VoIP). -STATIC2 Generate Delays, Jitters and Packet Losses as follow: -C_DELAY Generate &Delays -S_DELAY The Period of Delay (0 - 10000) : -S_DELAY2 milliseconds -C_JITTER Generate &Jitters (Fluctuation) -S_JITTER The Ratio of Jitter (0 - 100) : -S_JITTER2 Percent (%) -C_LOSS Generate Packet &Losses -S_LOSS The Ratio of Packet Losses (0 - 100) : -S_LOSS2 Percent (%) -IDOK &OK -IDCANCEL Cancel - - -PREFIX D_SM_AO_VALUE -CAPTION Name and Value -STATIC1 &Name: -STATIC2 &Value: -STATIC3 (Integer) -IDOK &OK -IDCANCEL Cancel - - -PREFIX D_SM_L3 -CAPTION Virtual Layer 3 Switch Setting -STATIC1 You can define Virtual Layer 3 Switches between two or more Virtual Hubs operating on this VPN Server to achieve routing between different IP networks. -STATIC2 The Virtual Layer 3 Switch functions are provided for network administrators or people who know a lot about networking and IP routing. If you are using the regular VPN functions, you do not need to use the Virtual Layer 3 Switch functions.\r\n\r\nIf the Virtual Layer 3 Switch functions are to be used, the person who configures them must have sufficient knowledge of IP routing. -STATIC3 Cautions about Virtual Layer 3 Switch Function -S_BOLD Defined Virtual &Layer 3 &Switches: -B_ADD &New -B_START &Start -B_STOP S&top -IDOK &Edit -B_DELETE &Delete -IDCANCEL &Close - - -PREFIX D_SM_L3_ADD -CAPTION New Virtual Layer 3 Switch -STATIC1 To create a new Virtual Layer 3 Switch, enter a name for the switch. \r\n\r\nThe Virtual Layer 3 Switch cannot have the duplicated name as another Virtual Layer 3 Switch on this VPN Server. -STATIC2 &Name: -IDOK &OK -IDCANCEL Cancel - - -PREFIX D_SM_L3_SW -CAPTION Edit Virtual Layer 3 Switch "%S" -STATIC1 You can define multiple virtual interfaces and routing tables on a Virtual Layer 3 Switch. -STATIC2 A virtual interface is associated to a Virtual Hub and operates as a single IP host on the Virtual Hub when the Virtual Hub is running. When multiple virtual interfaces that respectively belong to a different IP network of a different Virtual Hub are defined, IP routing will be automatically performed between these interfaces. \r\nIt is possible to manually set the routing table and more detailed settings. -S_BOLD1 Virtual &Interfaces: -B_ADD_IF &New Virtual Interface -B_DEL_IF D&elete Virtual Interface -S_BOLD2 Routing &Table: -B_ADD_TABLE A&dd Routing Table Entry -B_DEL_TABLE De&lete Routing Table Entry -B_START &Start -B_STOP S&top -IDCANCEL &Close - - -PREFIX D_SM_L3_SW_IF -CAPTION Add Virtual Interface -STATIC1 Adds a new virtual interface to the Virtual Layer 3 Switch. \r\n\r\nYou must define the IP network that the virtual interface belongs to and the IP address of the interface itself. \r\nPlease select or enter the name of the virtual Hub that the interface will attach to. -STATIC2 Virtual Hub to &Attach -STATIC3 Select or enter the name of the Virtual Hub that this interface will attach to. -STATIC4 Virtual &Hub: -STATIC5 IP A&ddress and Subnet Mask of Virtual Interface: -STATIC6 The virtual interface must have one IP address in the Virtual Hub. You also must specify the subnet mask of an IP network that the IP address belongs to. \r\n\r\nRouting via the Virtual Layer 3 Switches attaching to multiple virtual Hubs operates based on the IP address is specified here. -S_SRC_IP_1 &IP address: -S_SRC_IP_2 &Subnet Mask: -IDOK &OK -IDCANCEL Cancel - - -PREFIX D_SM_L3_SW_TABLE -CAPTION New Routing Table Entry -STATIC1 Adds a new routing table entry to the routing table of the Virtual Layer 3 Switch. \r\n\r\nIf the destination IP address of the IP packet does not belong to any IP network that belongs to a virtual interface, the IP routing engine of the Virtual Layer 3 Switch will reference the routing table and execute the routing. -STATIC2 Definitions of Routing Table &Entry: -STATIC3 The virtual interface must have one IP address in the Virtual Hub. You also must specify the subnet mask of an IP network that the IP address belongs to. \r\n\r\nRouting via the Virtual Layer 3 Switches of IP spaces of multiple virtual Hubs operates based on the IP address is specified here. -S_SRC_IP_1 &Network Address: -S_SRC_IP_2 &Subnet Mask: -S_SRC_IP_3 &Gateway Address: -S_SRC_IP_4 &Metric Value: -STATIC4 Note: To specify the default gateway, specify '0.0.0.0' for both the network address and the subnet mask. -IDOK &OK -IDCANCEL Cancel - - -PREFIX D_CM_SELECT_SECURE -CAPTION Select Smart Card -STATIC1 Select the type of smart card device to use. \r\n\r\nThe types of smart cards listed in this list have had their drivers installed on the current computer and are supported by VPN software. \r\nIf there is a type of smart card that is currently being used that does not appear in the list, it may be possible that update of the VPN software to a newer version enable you to use it. \r\n\r\nNote: If a driver is not displayed immediately after installation, restart Windows. -IDOK &OK -IDCANCEL Cancel - - -PREFIX D_CM_SECURE_MANAGER -CAPTION Smart Card Manager -S_INFO Current Smart Card:\r\n\r\n%S -B_BOLD Objects stored on the smart card: -B_REFRESH &Refresh Object List -B_IMPORT &Import to Card... -B_EXPORT &Export from Card... -B_DELETE &Delete from Card -B_NEW_CERT &Write New Certificate and Private Key to Card... -B_PIN &Change PIN Code... -IDCANCEL Close - - -PREFIX D_CM_SECURE_TYPE -CAPTION Select Object Type -STATIC Select the type of the object you want to import. -R_CERT &Certificate -R_KEY Private &Key -R_DATA &Data -IDOK &OK -IDCANCEL Cancel - - -PREFIX D_STRING -CAPTION VPN Software -IDOK &OK -IDCANCEL Cancel - - -PREFIX D_SM_SELECT_KEYPAIR -CAPTION Specify Certificate in Smart Card -S_INFO Currently selected smart card:\r\n\r\n%S -B_BOLD1 Select the certificate in the smart card. -IDOK &OK -IDCANCEL Cancel -B_BOLD2 Select the corresponding private key. - - -PREFIX D_CM_LOAD_X -CAPTION Load Certificate -STATIC1 Select the method to load the certificate. -R_FROM_FILE Load Certificate from &File -R_FROM_SECURE Load Certificate from &Smart Card -S_FILE You can load a certificate from a file that stores certificate data (extensions: .cer, .crt, .p12, .pfx). -S_CERT If a smart card is connected to this computer, you can load a certificate from a smart card. -B_SELECT &Select Which Smart Card to Use... -IDOK &OK -IDCANCEL Cancel - - -PREFIX D_CM_SECURE_PIN -CAPTION Change PIN Code -STATIC1 You can change the PIN code (secret number) of the smart card. \r\n\r\nTo change the PIN code, you are required to enter the current PIN code and the new PIN code twice. -STATIC2 &Current PIN code: -STATIC3 &New PIN Code: -STATIC4 Con&firm New PIN: -STATIC5 Note -STATIC6 If you incorrectly input the current PIN a certain number of times, the smart card will be rendered unusable. -STATIC7 Please insert the smart card and click OK. -IDOK &OK -IDCANCEL Cancel - - -PREFIX D_SM_CRL -CAPTION Certificates Revocation List -STATIC1 You can manage the Certificates Revocation List on this Virtual Hub. \r\n\r\nBy adding certificates in Certificates Revocation List, the clients who provide these certificates will be denied to connect to this Virtual Hub using certificate authentication mode. -B_ADD &Add -IDOK &Edit -IDCANCEL &Close -B_DELETE &Delete - - -PREFIX D_SM_EDIT_CRL -CAPTION Revoked Certificate -STATIC1 You can set the contents of an entry on the revocation list. \r\n\r\nWhen a user connects to a Virtual Hub in certificate authentication mode and that certificate matches one or more of the contents defined in the Certificates Revocation List, the user will be denied to connect. -S_BOLD The certificates that matches all the fields of the items will be disabled. -STATIC2 Contents of Certificate: -R_CN Common Name (CN): -R_O Organization (O): -R_OU Organization Unit (OU): -R_C Country (C): -R_ST State (ST): -R_L Locale (L): -STATIC3 Certificate Attribute Value: -R_SERI Serial Number (Hex): -R_MD5_HASH MD5 Digest Value (Hex, 128 bit): -R_SHA1_HASH SHA-1 Digest Value (Hex, 160 bit): -STATIC4 A digest value (hash value) can identify the particular certificate exactly. If you specify a MD5 or SHA-1 digest value, you need not to specify other items. -STATIC5 Import Values from a Certificate File -STATIC6 If there is a certificate file that you want to disable, you can correctly specify the certificate and add it to the invalid list by importing that file. Click Load Certificate and the contents of the specified certificate file will be imported automatically. -B_LOAD &Load Certificate... -IDOK &OK -IDCANCEL Cancel - - -PREFIX D_SM_AC_LIST -CAPTION Source IP Address Limit List -S_TITLE To allow or deny VPN connections to this VPN Server Virtual Hub "%S" according to the client computer's IP address, you can set the rules to allow or deny the connection below. -B_ADD &New Rule -IDOK &Edit Rule -B_DELETE &Delete Rule -B_SAVE &Save -IDCANCEL &Cancel -STATIC1 Items with higher priority appear higher in the list. -STATIC2 If the client's IP address does not match any item in the list, VPN connection to this Virtual Hub will be allowed. - - -PREFIX D_SM_AC -CAPTION Edit Rule Entry of Source IP Address Limit List -STATIC1 Define a rule in the IP Access Control List. The values set here will be used to decide whether to allow or deny connection from a VPN Client when this client attempts connection to the Virtual Hub. -STATIC2 Defines of a Rule -STATIC3 Apply this Rule when the client's IP address matches the following: -R_SINGLE &Single IP Address -R_MASKED &Multiple IP Addresses (Specify by IP Network Address and Mask) -STATIC4 &Address: -S_MASK Net Mas&k: -STATIC5 Action -R_PASS &Permit -R_DENY &Deny -STATIC6 Others -STATIC7 P&riority: -STATIC8 (Integer: higher priority is given to smaller numbers) -STATIC9 IP Protocol Version -IDOK &OK -IDCANCEL Cancel - - -PREFIX D_SM_LOG_FILE -CAPTION Log File List -STATIC1 You can download log files that are saved on the server. \r\n\r\nThe administrator of the entire VPN Server is granted to download all Virtual Hub logs and server logs. Virtual Hub administrators are granted to download the log file for that Virtual Hub. -IDOK &Download -B_REFRESH &Refresh -IDCANCEL Close - - -PREFIX D_SM_READ_LOG_FILE -CAPTION Download File -S_INFO2 Downloading the file "%S" from the VPN Server. \r\nPlease wait... -IDCANCEL &Stop Download - - -PREFIX D_SM_SAVE_LOG -CAPTION Downloaded Log File -S_INFO The file "%S" has been downloaded. \r\n\r\nYou can open or save this file. -IDOK &Open -B_SAVE &Save -IDCANCEL Cancel - - -PREFIX D_TCP -CAPTION TCP Optimization Utility -STATIC1 By optimizing the TCP/IP settings on Windows, it is possible to increase the network communication throughput of this computer. \r\n\r\nBy using this TCP Optimization Utility, you can easily configure the settings for optimize the parameters. -STATIC2 Current TCP/IP setting parameters of Windows is as follows. By changing these values you can optimize the TCP/IP settings. Using this utility any time later you can reset the values or restore them to the previous setting. -STATIC3 TCP/IP Communication Setting: -STATIC4 TCP &Receiving Window Size: -R_RECV_DISABLE Use OS &Default Value -R_RECV_ENABLE S&et the Values Below -S_RECV bytes -B_RECV Default Value -STATIC5 TCP &Sending Window Size: -R_SEND_DISABLE Use OS Default Value -R_SEND_ENABLE Set the Values Below -S_SEND bytes -B_SEND Default Value -IDOK &OK -IDCANCEL Cancel -STATIC6 The changes above will take effect after Windows has rebooted. After changing the settings, you do not need to immediately reboot the computer, but until it is rebooted the TCP/IP optimized settings will not take effect. -B_DELETE Do not Manage by this Utility - - -PREFIX D_TCP_MSG -CAPTION TCP Optimization -STATIC1 By optimizing the TCP/IP settings on Windows, it is possible to increase the network communication throughput of this computer. Do you want to optimize the communication settings?\r\n\r\nYou can start at any time in the future the TCP Optimization Utility and optimize the communication settings or restore them to their previous values. -STATIC2 When the TCP/IP settings are changed, the changes will take effect after Windows has restarted. After changing the settings, you do not need to immediately restart the computer, but until it is restarted the TCP/IP optimized settings will not take effect. -R_OPTIMIZE &Automatically Optimize Communication Settings -R_MANUAL &Manually Optimize Using TCP Optimization Utility -R_NO &Do not Optimize -IDOK &Next > -IDOK3 < &Back - - -PREFIX D_CM_PKCSEULA -CAPTION Notice to Use Smart Card's Drivers -S_INFO_1 You are attempting to access the smart card with software "%S". -S_INFO_2 When using software "%S", if there are conditions of use for this software and the smart card that is to be used, you must agree to these conditions of use before using them. \r\n\r\nFor details please contact the vendor of software "%S" and of the smart card. -S_INFO_3 Do you agree to the above and want to use the software "%S" and access the specified smart card? -IDOK &Yes -IDCANCEL &No - - -PREFIX D_CM_TRAFFIC -CAPTION Network Traffic Speed Test Tool -STATIC1 Network Traffic Speed Test Tool performs transmitting packets between two computers connected with TCP/IP, with large amount of throughput as possible, in order to measure the actual network traffic speed available. This tool can be used for not limited VPNs, but it is useful for physical networks. -STATIC2 Use this tool to measure the current bandwidth capacity of the network. Note that the value obtained is sometimes lower than the actual network processing capacity due to the CPU performance of both endpoints, what other programs are currently running and fluctuations in the rate of use of the network. -S_1 Configurations: -S_3 Which is the role of this computer? -R_SERVER Test &Server -R_CLIENT Test &Client -S_4 To activate the test server, specify the listening port number.\r\nTo use it as the test client, specify the host name of the destination test server or the IP address, and port number. If necessary, configure the optional settings below. -S_5 Destination Test Server &Hostname: -S_6 &Port Number: -S_7 (TCP port) -S_8 Configure following options on the client side. -S_9 Direction of Data Communication -R_DOWNLOAD &Download (Incoming: from Server to Client) -R_UPLOAD &Upload (Outgoing: from Client to Server) -R_FULL Download and Upload (&Full-Duplex Mode: In and Out Simultaneously) -S_10 Advanced Settings -S_11 &Number of Concurrent Parallel TCP Connections: -S_12 Me&asuring Period: -S_13 seconds -R_ETHERNET Correct L2 Throughput Assuming &Ethernet -R_DOUBLE Relay Device Mode -S_14 connections -IDOK &Run -IDCANCEL Cancel -S_15 You can also run this tool from the vpncmd Command-line Management Utility (also available on non-Windows OS). - - -PREFIX D_CM_TRAFFIC_RUN -CAPTION Network Traffic Speed Test Tool -S_INFO The Network Traffic Speed Test Tool is running. The operating status is as follows. -STATIC1 To abort the Network Traffic Speed Test Tool, click Exit. -IDCANCEL &Exit - - -PREFIX D_CM_TRAFFIC_RESULT -CAPTION Communication Traffic Measurement Results -STATIC1 Communication traffic has been measured. The results are shown below. -IDCANCEL &Close - - -PREFIX D_SM_LICENSE -CAPTION Add or Remove License -STATIC1 To use SoftEther VPN Server you must acquire a valid license and register the license key. You can register a new license key, delete a registered license key and display the current license list and the license mode of the VPN Server here. -S_BOLD Currently Registered &License Keys: -B_OBTAIN &Obtain or Extend a License -STATIC2 Click Obtain or Extend License to visit the website that will provide instructions on how to obtain a license. -B_ADD &Add a License Key -B_DEL &Delete -IDOK &Information About License -STATIC3 Select a license and click Information About License to connect to SoftEther VPN Project's website (softether.com) and view the registered information relating to the selected license. -S_BOLD2 Current License &Mode of SoftEther VPN Server: -IDCANCEL E&xit - - -PREFIX D_SM_LICENSE_ADD -CAPTION Add License Keys -S_INFO You can register a SoftEther VPN Server product license or a connection license. -STATIC1 The license keys are 36 alphanumeric characters in length plus dashes. They are key codes that certify the ownership of a license. \r\n\r\nWhen a license certificate is received together with this software, the license key is printed on this license certificate. If the license for this software has been purchased online, the license key is provided by email and on the website window at the time the license is purchased. The license key may also be written down by some other method. If you don't know where the license key is written down, ask the vendor who sold you the license. -STATIC2 &Input the License Key Accurately: -STATIC3 Enter the license key by separating the input into 6-digit groups. You don't need to input the dashes. It is also possible to copy && paste the license key. -B_INFO2 This software is protected by world-wide copyright laws. Customers can only make copies and use this software in accordance with the license conditions. Warning: Use of illegitimately obtained license keys, use of a single license on multiple servers, or unauthorized distribution of licenses is a breach of the license agreement and such action may result in civil or legal proceedings. -IDOK &Register -IDCANCEL Cancel - - -PREFIX D_FREEINFO -CAPTION About SoftEther VPN Server Free Edition -S_INFO_1 Thank you for trying out the SoftEther VPN Server Free Edition. -S_INFO_2 The SoftEther VPN Server operating on destination server "%S" is the Free Edition intended for personal use. \r\nWhen using the Free Edition, you can use all the SoftEther VPN Server functions but the User Agreement prohibits the following usage. -S_INFO_3 Use where communication for commercial purposes travels via the VPN Server. -S_INFO_4 Note that if the software is used based on the above mentioned prohibited usage, it is a breach of the SoftEther VPN Server user agreement. The above restriction is lifted once you obtain a regular product license for SoftEther VPN Server. For details on the regular product version, please visit www.softether.com. \r\n\r\nIf this server is being used under the usage described above, please contact us via our website at www.softether.com. \r\n\r\nNote: This window will appear when connected to a Free Edition of VPN Server. This window does not appear when Editions other than the Free Editions of the software product are used. \r\nNote: Apart from this notification window, there are absolutely no differences between the Free Edition software and the product version. -B_HIDE &Hide this window next time. -IDCANCEL &OK - - -PREFIX D_CM_SETTING -CAPTION Switch SoftEther VPN Client Operating Mode -STATIC1 You can use SoftEther VPN Client in either Normal Mode or Easy Mode. To switch to the other mode, check the respective checkbox below. -R_NORMAL &Normal Mode -R_EASY &Easy Mode -STATIC2 When using Normal Mode, you can perform all the operations that the SoftEther VPN Client software provides. We recommend that general users and system administrators use this mode. -STATIC3 Easy Mode only allows the most frequently used operations such as connecting to the VPN Server. We recommend this mode to beginner users. -STATIC4 By using the Setting Locker, you can connect to a VPN Server by using a Connection Setting registered in SoftEther VPN Client, but by doing so, you are prevented from changing the parameters of Connection Settings, creating a new Connection Setting or deleting a Connection Setting. -R_LOCK Enable Setting &Locker -S_PASSWORD1 You can specify a password. The input of that password will be required next time to disable the Setting Locker. -S_PASSWORD2 &Password: -S_PASSWORD3 &Confirm: -IDOK &OK -IDCANCEL Cancel -S_VGS2 You can configure the VPN Gate Academic Service settings. -B_VGS VPN &Gate Service Settings... - - - -PREFIX D_CM_EASY -CAPTION SoftEther VPN Client Easy Manager (Developer Edition) -B_MODE Switch Operation &Mode -IDCANCEL &Close -B_STATUS View Connection &Status -B_VGC VPN Gate Academic Project - - -PREFIX D_SM_SETUP -CAPTION SoftEther VPN Server / Bridge Easy Setup (Developer Edition) -S_TITLE SoftEther VPN Server / Bridge Easy Setup (Developer Edition) -IDC_STATIC_1 By using this setup you can easily setup a SoftEther VPN Server or VPN Bridge for the following use and purpose. After exiting the setup, you can use the VPN Server Manager to freely configure more advanced settings. -S_BOLD Select the type of VPN server you want to build. Multiple types can be selected together. -C_REMOTE &Remote Access VPN Server -S_REMOTE_1 The Remote Access VPN Server allows VPN Client computers in remote locations to access to the existing Ethernet segments, for example company LAN.\r\nAny VPN Clients who is connecting to the VPN Server will be able to access to the network as if they are connected directly and physically to the network. -C_SITE &Site-to-site VPN Server or VPN Bridge -S_SITE_1 Site-to-site VPN is a VPN configuration to connect between two or more remote Ethernet segments.\r\nEach of the sites are connected together, and become the same segment at Layer-2 level. It enables any computers of each sites to communicate to each other as if there is a single network. -S_SITE_2 Select the role of this VPN Server: -C_CENTER VPN Server that Accepts Connection from Other Sites (&Center) -C_EDGE VPN Server or VPN Bridge at Each Site (&Edge) -C_OTHER &Other Advanced Configuration of VPN -S_OTHER Select this if you are planning to build a VPN system that provides advanced functions such as a clustering function and a Virtual Layer 3 Switch function. -IDOK &Next > -IDCANCEL &Close - - -PREFIX D_SM_SETUP_HUB -CAPTION Easy Setup - Decide the Virtual Hub Name -IDC_STATIC_1 You have to create one Virtual Hub on the VPN Server at least. Name the new Virtual Hub as you prefer. -IDC_STATIC_2 Virtual Hub &Name: -IDOK &OK -IDCANCEL Cancel - - -PREFIX D_SM_SETUP_STEP -CAPTION VPN Easy Setup Tasks -IDC_STATIC_1 To complete the setup of this VPN Server / VPN Bridge, you must complete the following tasks. -S_1_1 Step 1. Create a User to Accept VPN Connection -S_1_2 When this VPN Server accepts a remote access VPN, or becomes the central site-to-site VPN server that accepts connections from other sites, create users to accept the VPN connection. -B_USER Create &Users -S_2_1 Step 2. Define a Connection to Destination VPN Server -S_2_2 When this VPN Server is installed on a particular site (edge) of a site-to-site VPN, you have to specify the address of the center VPN Server that accepts the connections, and establish a connection to that central VPN Server. -B_CASCADE &Configure Connection Setting -S_3_1 Step 3. Set Local Bridge -S_3_2 For an site-to-site VPN, use the Local Bridge Function to connect a bridge between the virtual Ethernet segment on the VPN side and the physical Ethernet segment on the local side. Select an existing Ethernet device (Network Adapter) that will be provide the bridge connection to the VPN. -IDCANCEL &Close -IDC_STATIC_8 Once the required settings are configured, click Close. An advanced management tool for VPN Server / VPN Bridge will be appeared. You can then configure any advanced settings as you wish. -B_SECURENAT Configure SecureN&AT - - -PREFIX D_CPU64_WARNING -CAPTION Information on SoftEther VPN 64-bit Edition -S_BOLD The SoftEther VPN software currently installed is the 32-bit edition, but the Windows operating system that is currently running is a 64-bit edition. -S_INFO You can run the 32-bit edition of SoftEther VPN software on a 64-bit edition of Windows, but it will run on Window's 32-bit emulator, and this results in reduced performance. \r\nThere is also a possibility that some functions are not supported. \r\n\r\nWe strongly recommend you to install and use the 64-bit edition of SoftEther VPN software when running it on 64-bit Windows. \r\nYou can download the 64-bit edition of the SoftEther VPN software from http://selinks.org/. \r\n\r\nThis dialog box will close automatically in 30 seconds. -IDOK &OK - - -PREFIX D_ONCEMSG -CAPTION TITLE -C_DONTSHOWAGAIN &Do not show this message again -IDCANCEL &OK - - -PREFIX D_CONNECT -IDCANCEL Cancel - - -PREFIX D_SM_IPSEC -CAPTION IPsec / L2TP / EtherIP / L2TPv3 Settings -S_TITLE IPsec / L2TP / EtherIP / L2TPv3 Server Settings -S_3 Virtual Hubs on the VPN Server can accept Remote-Access VPN connections from L2TP-compatible PCs, Mac OS X and Smartphones, and also can accept EtherIP / L2TPv3 Site-to-Site VPN Connection. -S01 L2TP Server (Remote-Access VPN Server Function) -S02 VPN Connections from Smartphones suchlike iPhone, iPad and Android, and also from built-in VPN Clients on Mac OS X and Windows can be accepted. -R_L2TP_OVER_IPSEC Enable L2TP Server Function (L2TP over IP&sec) -S03 Make VPN Connections from iPhone, iPad, Android, Windows, and Mac OS X acceptable. -R_L2TP_RAW Enable L2TP Server Function (Raw &L2TP with No Encryptions) -S04 It supports special VPN Clients which uses L2TP with no IPsec encryption. -S_1 Default Virtual &Hub in a case of omitting a name of Hub on the Username: -S_2 Users should specify their username such as "Username@Target Virtual Hub Name" to connect this L2TP Server.\r\nIf designation of a Virtual Hub is omitted, the below Hub will be used as the target. -S05 EtherIP Server Function (Site-to-Site VPN Connection) -S06 Router products which are compatible with EtherIP / L2TPv3 over IPsec can connect to Virtual Hub on the VPN Server and establish Layer-2 (Ethernet) Bridging. -R_ETHERIP Enable &EtherIP / L2TPv3 over IPsec Server Function -B_DETAIL EtherIP / L2TPv3 &Detail Settings -S07 IPsec &Common Settings -S_PSK IPsec &Pre-Shared Key: -S_PSK2 IPsec Pre-Shared Key is also called "PSKs" or "Secrets". Specify it with around eight ASCII characters, and let all VPN users know. -IDOK &OK -IDCANCEL Cancel - - -PREFIX D_SM_ETHERIP -CAPTION EtherIP / L2TPv3 Server Detail Settings -S_TITLE EtherIP / L2TPv3 Server Detail Settings -S01 EtherIP / L2TPv3 over IPsec compatible routers can connect to Virtual Hubs on VPN Server and establish Layer-2 (Ethernet) Bridge. For instance, Cisco routers, NEC IX series and IIJ SEIL routers are recommended as compatible VPN routers. -S02 In order to accept EtherIP / L2TPv3 protocol, define appropriate EtherIP / L2TPv3 Client Settings to identify the client site of the router beforehand. A EtherIP / L2TPv3 Client Setting must have a corresponding IPsec Phase 1 ID. -S_BOLD &Table of IPsec Phase 1 ID and the Virtual Hub -B_ADD &Add -IDOK &Edit -B_DELETE &Delete -IDCANCEL E&xit - - -PREFIX D_SM_ETHERIP_ID -CAPTION EtherIP / L2TPv3 over IPsec Client Setting -S01 The following Virtual Hub connection settings will be applied only when an EtherIP / L2TPv3 over IPsec Client is attempting to connect this VPN Server with an ISAKMP (IKE) Phase ID which is exactly equal to the value specified below. -S02 ISAKMP Phase 1 &ID: -S03 Virtual &Hub: -S04 &Username: -S05 &Password: -S06 Note that the username and the password must be same as a registered on the Virtual Hub. An EtherIP / L2TPv3 Client will be regarded as it connected the Virtual Hub with the identification of the above user information. -IDOK &OK -IDCANCEL Cancel -S07 The ID must be exact same as an ID in the configuration of the EtherIP / L2TPv3 Client. You can specify IP address as well as characters as ID, if the EtherIP / L2TPv3 Client uses IP address as Phase 1 ID. You can specify '*' (asterisk) as a wildcard to match any other clients which don't match other explicit rules. - - -PREFIX D_SM_OPENVPN -CAPTION OpenVPN / MS-SSTP Settings -S_TITLE OpenVPN / MS-SSTP VPN Clone Server Function Settings -S_1 This VPN Server has the clone functions of OpenVPN software products by OpenVPN Technologies, Inc.\r\n\r\nAny OpenVPN Clients can connect to this VPN Server. -R_OPENVPN Enable &OpenVPN Clone Server Function -S_TOOL Sample File Generating Tool for OpenVPN Clients -S_TOOL2 Making a OpenVPN Client configuration file is a very difficult job. You can use this tool to generate an appropriate OpenVPN Client configuration file. The generated configuration sample can be used immediately. -B_CONFIG Generate a Sample &Configuration File for OpenVPN Clients -S_2 Microsoft SSTP VPN Clone Server Function -S_3 This VPN Server has the clone functions of MS-SSTP VPN Server which is on Windows Server 2008 / 2012 by Microsoft Corporation.\r\nBuilt-in MS-SSTP Clients on Windows Vista / 7 / 8 / RT / 10 can connect to this VPN Server. -R_SSTP Enable &MS-SSTP VPN Clone Server Function -S_SSTP The value of CN (Common Name) on the SSL certificate of VPN Server must match to the hostname specified on the client, and that certificate must be in the trusted list on the client. For details refer the Microsoft's documents. -S_4 The manner to specify a username to connect to the Virtual Hub, and the selection rule of default Hub by using these clone server functions are same to the IPsec Server functions. -B_IPSEC I&Psec Server Configuration -S_13 OpenVPN Clone Server Function -IDOK &OK -IDCANCEL Cancel - - -PREFIX D_SM_DDNS -CAPTION Dynamic DNS Function -S_TITLE Dynamic DNS Function -S_BOLD This VPN Server has a Built-in Dynamic DNS Function. -S_1 The Dynamic DNS assigns a unique and permanent DNS hostname for this VPN Server. You can use that hostname to specify this VPN Server on the settings for VPN Client and VPN Bridge. You need not to register and keep a domain name. -S_22 Also, if your ISP assigns you a dynamic (not-fixed) IP address, the corresponding IP address of your Dynamic DNS hostname will be automatically changed. It enables you to keep running the VPN Server by using only a dynamic IP address.\r\nTherefore, you need not any longer to keep static global IP addresses with expenses monthly costs. -S_3 Moreover, this VPN Server version supports 'NAT-Traversal' function. If the VPN Server is inside the NAT and is assigned only a private IP address, you can connect to that VPN Server from the Internet side without any special settings on the NAT beforehand. -S_4 Current &Status: -S_STATUS3 Assigned Dynamic DNS &Hostname: -B_HINT Hint -S_STATUS4 Global IPv&4 Address: -S_STATUS5 Global IPv&6 Address: -S_5 Modify the Settings: -S_STATUS6 &Change the Dynamic DNS Hostname: -S_STATUS7 Hostname is with only alphabets numeric, and dashes '-'. Three letters at least.\r\nYou can change it any time later. -IDOK Set to &Above Hostname -B_RESTORE &Restore -S_2 If you are not connected to IPv6 Internet, "Global IPv6 Address" should show an error.\r\nA few countries or territories might prohibit Dynamic DNS Service. -IDCANCEL E&xit -B_DISABLE &Disable Dynamic DNS Function -B_PROXY Connect via &Proxy Server... -S_STATUS8 DNS Key: -B_HINT2 Hint - -PREFIX D_SM_SPECIALLISTENER -CAPTION VPN over ICMP / DNS Function Settings -S_TITLE VPN over ICMP / DNS Function -S_1 VPN over ICMP / DNS Function -S_2 You can establish a VPN only with ICMP or DNS packets even if there is a firewall or routers which blocks TCP/IP communications. You need to enable the following functions beforehand. -R_OVER_ICMP Enable VPN over &ICMP Server Function -R_OVER_DNS Enable VPN over &DNS Server Function (Uses UDP Port 53) -IDOK &OK -IDCANCEL Cancel -S_3 Requires VPN Client / VPN Bridge internal version 4.0 or greater. -S_4 Warning: Use this function for emergency only. It is helpful when a firewall or router is misconfigured to blocks TCP/IP, but either ICMP or DNS is not blocked. It is not for long-term stable using. - - -PREFIX D_SM_REDIRECT -CAPTION HTTP URL Redirection Settings -S_1 The specified URL below will be mandatory replied to the client as a response for TCP connecting request packets which matches the conditions of this access list entry via this Virtual Hub.\r\n\r\nTo use this setting, you can enforce the web browser of the VPN Client computer to show the specified web site when that web browser tries to access the specific IP address. -S_2 Specify a URL which redirects to. -S_BOLD2 The &URL Redirect To: -S_3 Example: -S_4 Simple URL Redirection: -S_5 Advanced URL Redirection: -B_HINT &Usage of Advanced URL Redirection Function... -S_6 Caption -S_BOLD This function is for TCP/IP expert administrator. Read the following instructions and be careful to set up. -S_7 This redirection rule is not effective in the case that the destination session of a packet matches the destination username or groupname of an access list entries. -S_8 This redirection rule is ignored for non-TCP packets if it matches the condition. -S_9 This redirection rule always replies HTTP redirect messages. (Not limited for port 80.) If you want to apply to only port 80, set the destination port to 80 on the condition of the access list entry. -S_10 If as the result of redirection by this rule the client attempts to access the redirected URL and such a new request matches this rule again, the redirection results will be replied for such new requests. It will cause an infinite redirection loop. -IDOK &OK -IDCANCEL Cancel -S_11 The advanced redirection function can provide the VPN Session information to the CGI which is redirected to. - - -PREFIX D_SW_WELCOME -CAPTION D_SW_WELCOME -S_WELCOME SoftEther VPN is freeware developed at University of Tsukuba, Japan. High-performance VPN with the ultimate compatibilities to many devices. Windows, Mac, smartphones, tablets (iPhone, iPad, Android, Windows RT) and Cisco or other VPN routers are supported. SoftEther VPN also accepts OpenVPN and MS-SSTP VPN clients. -S_TITLE Extremely Powerful Open-Source VPN Software. - -PREFIX D_SW_MODE -CAPTION D_SW_MODE -R_SYSTEM &System Mode (Recommended) -R_USER &User Mode -S_1 Install the VPN software to this computer normally. The administrator privilege is required. -S_USER Install the VPN software with the normal user privilege. No administrator privilege is required. Some functions such as Local Bridge will be disabled. Runs only the user "%s" is logged on Windows. -S_2 SoftEther VPN can be installed by one of two methods.\r\n\r\nPlease select the System Mode normally.\r\n\r\nIf you cannot use the administrator privilege for some reasons, you can select the User Mode to continue the installation. - - -PREFIX D_SW_NOT_ADMIN -CAPTION D_SW_NOT_ADMIN -S_INFO The user "%s" which is logged on Windows does not have the administrator privilege.\r\n\r\nLog off Windows, log on by the user who has the administrator privilege and restart the Setup Wizard if you want to continue the setup. -S_INFO6 Click Finish to exit the Setup Wizard. -S_INFO2 If you cannot use the administrator privilege, you can choose the User Mode installation.\r\nTo install the software in the User Mode, click Back. - - -PREFIX D_SW_COMPONENTS -CAPTION D_SW_COMPONENTS - - -PREFIX D_SW_EULA -CAPTION D_SW_EULA -S_1 Please read the End User License Agreement carefully. -B_AGREE I agree to the End User License Agreement. - - -PREFIX D_SW_WARNING -CAPTION D_SW_WARNING -S_1 SoftEther VPN software has extremely powerful communication abilities. Before use please read the Important Notices carefully. - - -PREFIX D_SW_DIR -CAPTION D_SW_DIR -S_INFO Please specify the directory to install %s. -R_CUSTOM &Specify the Directory -S_DEST &Directory: -B_BROWSE &Browse... -R_SHOWCUSTOM &Advanced Install Options for Experts -R_FOR_SYSTEM Install on &Windows of this Computer Entirely -R_FOR_USER Install only on the Environment of User "%s" -S_WARNING Caution: Not recommended. After the user "%s" logs off Windows, %s will stop. Local Bridge function and L2TP/IPsec Function (supports for Mac and Smartphones) will be unavailabe. - - -PREFIX D_SW_READY -CAPTION D_SW_READY -S_INFO Install of %s is ready. -S_INFO7 Click Next to perform the install. - - -PREFIX D_SW_PERFORM -CAPTION D_SW_PERFORM -S_INFO The setup of %s is in progress.\r\nPlease wait... -S_INFO8 SoftEther VPN is a work of the research and development project of Japanese Government, subsidized by Ministry of Economy, Trade and Industry of Japan, administrated by Information Promotion Agency. - - -PREFIX D_SW_ERROR -CAPTION D_SW_ERROR -S_INFO An error occurred and the setup of %s is aborted.\r\n\r\nRestart the Setup Wizard if you want to retry. - - -PREFIX D_SW_FINISH -CAPTION D_SW_FINISH -S_INFO The setup process of %s has completed successfully. -S_INFO8 SoftEther VPN is a work of the research and development project of Japanese Government, subsidized by Ministry of Economy, Trade and Industry of Japan, administrated by Information Promotion Agency. - - -PREFIX D_SW_UNINST1 -CAPTION D_SW_UNINST1 -S_WELCOME The Setup Wizard can uninstall %s from the computer.\r\n\r\nClick Next if you want to start uninstall. -S_TITLE %s Uninstall Wizard - - -PREFIX D_SW_EASY1 -CAPTION D_SW_EASY1 -S_WELCOME Installing and setting up the VPN Clients to a lot of computers in the enterprise is a hard work. -S_TITLE What is SoftEther VPN Client Easy Installer? -S_WELCOME2 Easy Installer Creator is a tool for enterprise administrators. You can create a VPN Client installer with embedding a specific VPN connection setting by using Easy Installer Creator. Personal users can also exploit this tool. -S_WELCOME3 A created Easy Installer can be distributed to employees in the enterprise by using file servers or e-mails. If a user runs the Easy Installer, VPN Client will be installed and the VPN connection setting will be imported, and then the VPN connection will be started automatically. - - -PREFIX D_SW_EASY2 -CAPTION D_SW_EASY2 -S_BOLD1 Specify a VPN connection setting file (.vpn file) to embed -S_1 Please specify a VPN connection setting file (a file which extension is .vpn) to embed on the Easy Installer. You can export a setting file by clicking Export VPN Connection Setting on the right-click menu of the target connection setting on the VPN Client Manager. -S_18 Connection &Setting: -B_BROWSE_SETTING &Browse... -B_DELETE_SENSITIVE &Eliminate Username and Password from Connection Setting File -S_BOLD2 Specify an EXE filename to be generated -S_3 This tool will output an EXE file (executable file) which implements an Easy Installer. Please specify the output filename to be generated. -S_19 Save &as: -B_BROWSE_OUT B&rowse... -B_EASYMODE Set the VPN Client Manager to &Easy Mode when Installation - - -PREFIX D_SW_WEB1 -CAPTION D_SW_WEB1 -S_WELCOME You can create a SoftEther VPN Client Web Installer and upload it on the Web server in the enterprise. A user opens that web page and can install the SoftEther VPN Client automatically. You can also setup the automatic import and kick-start of a built-in VPN connection setting. -S_TITLE What is SoftEther VPN Web Installer? -S_WELCOME2 The generated Web Installer can be placed as HTML files on the intranet Web server. If an employee accesses to the URL of that HTML files, the SoftEther VPN Client Installer will be executed. -S_WELCOME3 Using ActiveX Control. Internet Explorer 5.0, greater on Windows 2000 or greater are supported. Other web browsers or older operating systems (for example Windows 98) are not supported. - - -PREFIX D_SW_WEB2 -CAPTION D_SW_WEB2 -S_BOLD1 Specify a VPN connection setting file (.vpn file) to embed -S_1 Please specify a VPN connection setting file (a file which extension is .vpn) to embed on the Web Installer. You can export a setting file by clicking Export VPN Connection Setting on the right-click menu of the target connection setting on the VPN Client Manager. -S_18 Connection &Setting: -B_BROWSE_SETTING &Browse... -B_DELETE_SENSITIVE &Eliminate Username and Password from Connection Setting File -S_BOLD2 Specify the output filename to be generated -S_3 This tool will output a ZIP file (archive file) which contains HTML files and CAB files that should be placed on the Web server. Please specify the output filename to be generated. -S_19 Save &as: -B_BROWSE_OUT B&rowse... -B_EASYMODE Set the VPN Client Manager to &Easy Mode when Installation - - -PREFIX D_UPDATE_NOTICE -CAPTION Updates of %s -IDOK &Show the Update Information... -B_CONFIG &Configure Update... -IDCANCEL &Do Not Show this Message Again -S_INFO The latest version of %s is released. You can download it and update now. -S_PRODUCT Software: -S_CURRENT Current Version: -S_CURRENT_STR Ver %u.%02u.%04u%s -S_LATEST Latest Version: -S_LATEST_STR Ver %S%s - - -PREFIX D_UPDATE_CONFIG -CAPTION Configuration of Update Notification -S_INFO Checks the new versions of %s periodically and popup a notification when a new version will be released.\r\n\r\nHTTPS packets will be used between this computer and the SoftEther Update server located in Tsukuba-city, Ibaraki-prefecture, Japan in order to check updates. No personal information will be sent. -S_TITLE %s Update and Notify Settings -S_ENABLE &Enable Update Checks -S_DISABLE &Disable Update Checks -IDCANCEL &Close - - -PREFIX D_SM_VMBRIDGE -CAPTION Instructions for Local Bridge on VM -S_TITLE Using Local Bridge Function on VM -S_1 It has been detected that the VPN Server might be running on a VM (Virtual Machine) suchlike VMware or Hyper-V. Read the following instructions carefully. If you are not using a VM, please ignore this message. -S_2 Some VMs prohibit the "Promiscuous Mode" (MAC Address Spoofing) on the network adapters by default.\r\n\r\nIf the Promiscuous Mode (MAC Address Spoofing) is administratively disabled, the Local Bridge function between a Virtual Hub on the VPN Server and a physical network adapter on the physical computer does not work well. You should allow the Promiscuous Mode (MAC Address Spoofing) by using the configuration tool of the VM.\r\n\r\nFor details please refer the documents of your VM. If it is a shared-VM and administrated by other person, please request the administrator to permit the use of the Promiscuous (MAC Address Spoofing) Mode to your VM. -S_BOLD Instructions -IDCANCEL &OK - - -PREFIX D_SM_AZURE -CAPTION VPN Azure Service Settings -S_TITLE VPN Azure Cloud VPN Service (Free) -S_1 VPN Azure makes it easier to establish a VPN Session from your home PC to your office PC. While a VPN connection is established, you can access to any other servers on the private network of your company. -S_2 You don't need a global IP address on the office PC (VPN Server). It can work behind firewalls or NATs. No network administrator's configuration required. You can use the built-in SSTP-VPN Client of Windows in your home PC. -S_3 VPN Azure is a cloud VPN service operated by SoftEther VPN Project. VPN Azure is free of charge and available to anyone. Press the right button to see details and how-to-use instructions. -B_BOLD VPN Azure Setting -R_ENABLE &Enable VPN Azure -R_DISABLE &Disable VPN Azure -S_HOSTNAME_BORDER Current VPN Azure Hostname -S_HOSTNAME_INFO The VPN Azure hostname is same to the Dynamic DNS hostname, but altering the domain suffix to "vpnazure.net". -B_CHANGE Change &Hostname -B_WEB How to Use VPN Azure\r\n(Visit the Web) -IDCANCEL &OK - - -PREFIX D_SM_PROXY -CAPTION Connect via Proxy Server -STATIC9 You can connect via a proxy server. -STATIC10 Proxy &Type: -R_DIRECT_TCP &Direct TCP/IP Connection (No Proxy) -R_HTTPS Connect via H&TTP Proxy Server -R_SOCKS Connect via S&OCKS4 Proxy Server -R_SOCKS5 Connect via S&OCKS5 Proxy Server -B_PROXY_CONFIG P&roxy Server Setting -IDOK &OK -IDCANCEL Cancel - - -PREFIX D_VGC_LIST -CAPTION VPN Gate Academic Experimental Project Plugin for SoftEther VPN Client -S_TITLE VPN Gate Public VPN Relay Servers -S_INFO1 Gain freedom access to Internet by using VPN connection via Public VPN Servers provided by volunteers abound the world. Bypass your local malfunctioning firewall's packet blocking, and hide your IP address safely. -IDOK &Connect to the VPN Server -B_PROXY &Proxy Settings -S_VLAN Virtual Network Adapter: -B_WEB VPN Gate Academic\r\nWeb Site -B_REFRESH &Refresh List -S_REFRESH Refreshing the List... -S_RESEARCH Academic project at University of Tsukuba, Japan. -S_INFO9 A VPN Server with higher Line Speed (measured by Mbps) and smaller Ping result are usually more comfortable to use. You might be able to browse websites which are normally unreachable from your area if you use VPN servers that are not in your area. - - -PREFIX D_VGC_PROTOCOL -CAPTION Select VPN Protocol to Connect -S_TITLE The Public VPN Relay Server "%S" (%S) supports both TCP and UDP as VPN protocol. -S_INFO Select preferred VPN Protocol to use in order to connect the VPN Server "%S" (%S). In general, the TCP protocol is easy to pass through the firewall. Try the UDP protocol only if the TCP has been failed. -R_TCP Use &TCP Protocol (Ethernet over HTTPS VPN) (Recommended) -R_UDP Use &UDP Protocol (Ethernet over UDP VPN) -IDOK &OK -IDCANCEL Cancel - - -PREFIX D_VGS_CONFIG -CAPTION VPN Gate Service Control Panel -R_ENABLE &Enable the VPN Gate Relay Service and Join the VPN Gate Research as a Volunteer. -S_TITLE Join the VPN Gate Academic Research Project? -S_INFO1 VPN Gate is an academic experiment for the research on the 'Distributed Public VPN Relay Server' technology, operated at the Graduate School on University of Tsukuba, Japan. VPN Gate Client users can connect to VPN Gate Services running on Public VPN Relay Servers, and enjoy unrestricted Internet access via the VPN Relay Server. -S_INFO9 When a VPN Gate Client user accesses to a server on Internet, the source IP address will be replaced to the IP address of the relaying Public VPN Server. Consequently, the VPN Gate Client user will be able to browse overseas web sites smoothly even if the user's local firewall is out of order by an unknown reason and unable to pass such an access. -S_WARNING If you check the above checkbox and press OK, the VPN Gate Relay Service will be activated on this computer. As the result, any VPN Gate Client will be able to communicate towards the Internet via the VPN Gate Relay Service. It is secure even if your computer is on the private network (e.g. corporate network) because any accesses to private IP addresses will not be permitted to pass via the VPN Gate Relay Service. -B_OPTION VPN Gate Service &Option Settings... -IDOK &OK -IDCANCEL Cancel -B_WEB &Browse http://www.vpngate.net/ ... - - -PREFIX D_VGS_OPTION -CAPTION VPN Gate Service Options -S_TITLE VPN Gate Service Options -S_1 This computer will be a Public VPN Server. Please fill the operator's information of the server. The information will be published on the list at www.vpngate.net and other related services. The contact address will be also used to contact from VPN Gate Academic Project operators. -S_2 Operator: -S_3 &Operator of Server: -S_19 (Up to 64 letters) -S_20 &Abuse Report Address\r\n(e-mail addresses etc.): -S_21 (Up to 64 letters) -S_22 The &Message to Users:\r\n(Up to 128 letters) -S_23 The message will be shown on the list of VPN Gate Servers. Enter an enjoyable message to let users feel pleasure. -S_24 VPN Settings: -R_LOG &Save VPN Packet Logs (Recommended) -R_2WEEKS Auto Delete or Archive with Encoding for Packet Logs After &Two Weeks (Recommended) -R_PERMANENT Make Packet Logs Occupy Free Disk Space &Permanently -R_L2TP Enable &L2TP/IPsec VPN Server Function (Recommended) -S_25 Allows Mac OS X, iPhone, iPad and Android clients to make a VPN connection. -B_MESSAGE Pop-up Your Advertisement Message on the VPN Client &Screen ... -IDOK &OK -IDCANCEL Cancel - - -PREFIX D_VGS_WARNING -CAPTION Caution before Joining VPN Gate Academic Experiment -S1 The VPN Gate Academic Experiment Service is operated as a research project at the graduate school on University of Tsukuba, Japan. The service is governed under the Japanese laws. Other countries' laws are none of our concerns nor responsibilities. -S2 By nature, there are almost 200 countries in the World, with different laws. It is impossible to verify every countries' laws and regulations and make the software comply with all countries' laws in advance to release the software. If a user uses VPN Gate service in a specific country, and damaged by public servants of the authority, the developer of either the service or software will never be liable to recover or compensate such damages or criminal responsibilities. -S3 By using this software and service, the user must observe all concerned laws and rules with user's own responsibility. The user will be completely liable to any damages and responsibilities which are results of using this software and service, regardless of either inside or outside of Japan's territory. -S4 If you don't agree nor understand the above warnings, do not use any of VPN Gate Academic Experiment Service functions. -S5 Note: VPN Gate is a research project for just academic purpose only. VPN Gate was developed as a plug-in for SoftEther VPN and UT-VPN. However, all parts of VPN Gate were developed on this research project at University of Tsukuba. Any parts of VPN Gate are not developed by SoftEther VPN Project. The VPN Gate Research Project is not a subject to be led, operated, promoted nor guaranteed by SoftEther VPN Project. -R_NEVER Do Not &Show This Message Again -B_WEB Visit VPN Gate &Web Site... -IDOK &Agree -IDCANCEL &Disagree -S_BOLD Caution! Do Not Use the VPN Gate Services in Countries where VPN Communications are Prohibited. - - -PREFIX D_NM_PUSH -CAPTION Edit the static routing table to push -S1 This Virtual DHCP Server can push the classless static routes (RFC 3442) with DHCP reply messages to VPN clients. -S2 Whether or not a VPN client can recognize the classless static routes (RFC 3442) depends on the target VPN client software. SoftEther VPN Client and OpenVPN Client are supporting the classless static routes. On L2TP/IPsec and MS-SSTP protocols, the compatibility depends on the implementation of the client software. -S3 You can realize the split tunneling if you clear the default gateway field on the Virtual DHCP Server options. On the client side, L2TP/IPsec and MS-SSTP clients need to be configured not to set up the default gateway for the split tunneling usage. -S4 You can also push the classless static routes (RFC 3442) by your existing external DHCP server. In that case, disable the Virtual DHCP Server function on SecureNAT, and you need not to set up the classless routes on this screen. -S5 Edit the static routing table to push -S6 Example: 192.168.5.0/255.255.255.0/192.168.4.254, 10.0.0.0/255.0.0.0/192.168.4.253\r\n\r\nSplit multiple entries (maximum: 64 entries) by comma or space characters.\r\nEach entry must be specified in the "IP network address/subnet mask/gateway IP address" format. -S7 See the RFC 3442 to understand the classless routes. -IDOK &OK -IDCANCEL Cancel - - - -########################################################################### -# # -#String data of menus in software # -# # -########################################################################### - - -# Connection Manager menu -PREFIX CM_MENU -# [Connect] menu -CMD_TOP_CONNECT &Connect -CMD_CONNECT C&onnect\tEnter -CMD_STATUS View &Status...\tCtrl+S -CMD_DISCONNECT D&isconnect\tCtrl+D -CMD_DISCONNECT_ALL Disconnect &All\tCtrl+I -CMD_NEW &New VPN Connection Setting...\tCtrl+N -CMD_CLONE &Copy\tCtrl+C -CMD_SHORTCUT Create VPN Connection S&hortcut... -CMD_EXPORT_ACCOUNT E&xport VPN Connection Setting... -CMD_IMPORT_ACCOUNT Im&port VPN Connection Setting... -CMD_STARTUP Se&t as Startup Connection\tCtrl+T -CMD_NOSTARTUP R&emove Startup Connection -CMD_RECENT Recent &VPN Servers -CMD_RENAME Rena&me\tF2 -CMD_DELETE &Delete\tDel -CMD_PROPERTY P&roperties...\tAlt+Enter -CMD_EXIT Cl&ose Connection Manager\tAlt+F4 -CMD_QUIT E&xit Connection Manager Program\tAlt+Q -# [Edit] menu -CMD_TOP_EDIT &Edit -CMD_SELECT_ALL Select &All\tCtrl+A -CMD_SWITCH_SELECT Sw&itch Selection -# [View] menu -CMD_TOP_VIEW &View -CMD_STATUSBAR Show &Status Bar -CMD_VISTASTYLE Windows Vista / 7 / 8 / 10 Styles -CMD_SHOWPORT Show &Ports on Connection List -CMD_TRAYICON Show Icons on &Task Tray -CMD_ICON &Icon -CMD_DETAIL &Detail -CMD_GRID Display &Grid -CMD_REFRESH &Refresh\tF5 -# [VLAN] menu -CMD_TOP_VLAN Virtua&l Adapter -CMD_NEW_VLAN &New Virtual Network Adapter...\tCtrl+L -CMD_ENABLE_VLAN &Enable Virtual Network Adapter\tCtrl+E -CMD_DISABLE_VLAN Dis&able Virtual Network Adapter\tCtrl+B -CMD_DELETE_VLAN &Delete Virtual Network Adapter\tDel -CMD_REINSTALL &Reinstall Driver...\tCtrl+U -CMD_WINNET Open Windows Network Connections...\tCtrl+W -# [Connect] menu -CMD_TOP_SECURE &Smart Card -CMD_SECURE_MANAGER Smart Card &Manager...\tCtrl+G -CMD_SECURE_SELECT &Select a Smart Card to Use... -# [Tools] menu -CMD_TOP_TOOL &Tools -CMD_PASSWORD Set &Password...\tCtrl+P -CMD_TRUST Manage &Trusted CA Certificate List\tCtrl+R -CMD_NETIF &Network Device Status... -CMD_TCPIP TCP Optimization &Utility... -CMD_MMCSS Optimization for Windows &Vista / 7 / 8 / 10... -CMD_TRAFFIC Network T&raffic Speed Test Tool...\tCtrl+Q -CMD_CM_SETTING Switch Operation &Mode... -CMD_LANGUAGE &Language Settings... -CMD_OPTION &Options...\tCtrl+O -# [Voice] menu -CMD_TOP_VOICE V&oice -CMD_VOIDE_NONE Voice Gui&de Off -CMD_VOICE_NORMAL &Normal Voice Guide -CMD_VOICE_ODD Extended V&oice Guide -# [Help] menu -CMD_TOP_HELP &Help -CMD_ABOUT &About... - - - - - - - - - - - - - - - - - -########################################################################### -# # -# Command prompt string data # -# # -########################################################################### - -PREFIX NULL - -# Console system general -CON_INFILE_ERROR Error: Unable to open the specified input file "%s". -CON_OUTFILE_ERROR Error: Unable to create the specified output file "%s". -CON_INFILE_START The commands written in the file "%s" will be used instead of input from keyboard. -CON_OUTFILE_START The message output to the console will be saved in the file "%s". -CON_USER_CANCEL [EOF] -CON_UNKNOWN_CMD "%S": Command not found. \nYou can use the HELP command to view a list of the available commands. -CON_AMBIGUOUS_CMD "%S": The command-name is ambiguous. -CON_AMBIGUOUS_CMD_1 The specified command name matches the following multiple commands. -CON_AMBIGUOUS_CMD_2 Please re-specify the command name more strictly. -CON_INVALID_PARAM The parameter "/%S" has been specified. It is not possible to specify this parameter when using the command "%S". Input "%S /HELP" to see the list of what parameters can be used. -CON_AMBIGUOUS_PARAM "%S": The parameter name is ambiguous. -CON_AMBIGUOUS_PARAM_1 The specified parameter name matches with the following parameters that can be specified as a parameter of command "%S". -CON_AMBIGUOUS_PARAM_2 Please re-specify the parameter name more strictly. - - -# Unknown command -CMD_UNKNOWM There is no description for this command. -CMD_UNKNOWN_HELP There is no detailed description for this command. If you would like to know more detail about this command, please refer to the manual or online documentation. -CMD_UNKNOWN_ARGS There is no command execution example. -CMD_UNKNOWN_PARAM There is no description for this parameter. - - -# Strings being used within console system -CMD_HELP_1 You can use the following %u commands: -CMD_HELP_2 To reference the usage for each command, input "command name ?" to view a help. -CMD_EVAL_MIN_MAX You must specify an integer in the range from %u to %u for the value. -CMD_PROMPT Enter a value: -CMD_EVAL_NOT_EMPTY You cannot make a blank specification. -CMD_EVAL_SAFE The string contains unusable characters. -CMD_EVAL_INT You must specify an integer that is not less than 1. -CMD_HELP_TITLE Help for command "%S" -CMD_HELP_DESCRIPTION Purpose: -CMD_HELP_USAGE Usage: -CMD_HELP_HELP Description: -CMD_HELP_ARGS Parameters: -CMD_PROMPT_PORT Input the port number: -CMD_EVAL_PORT Port number is invalid. Specify a port number that is within the range of 1 to 65535. -CMD_CT_STD_COLUMN_1 Item -CMD_CT_STD_COLUMN_2 Value -CMD_CT_STD_COLUMN_3 Description -CMD_PARSE_IP_SUBNET_ERROR_1_6 Specify in the format of "IPv6 address/subnet mask". \nSpecify the IPv6 address by separating the hexadecimal values using colons such as "2001:200:0:1::". For the subnet mask, either specify hexadecimal values separated by colons such as "ffff:ffff:ffff:ffff::", or you can specify the bit length of subnet mask using a decimal value such as 64. \nTo specify a standalone host, specify the subnet mask as either "ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff" or "128". \n(Example)\n2001:200:0:1::/64\n2001:200:0:1::/ffff:ffff:ffff:ffff::\n2001:200:0:1::5/12\n\n -CMD_PARSE_IP_SUBNET_ERROR_1 Specify in the format of "IPv4 address/subnet mask". \nSpecify the IPv4 address by separating the decimal values using dots such as "192.168.0.1". For the subnet mask, either specify decimal values separated by dots such as "255.255.255.0", or you can specify the bit length of subnet mask using a decimal value such as 24. \nTo specify a standalone host, specify the subnet mask as either "255.255.255.255" or "32". \n(Example)\n 192.168.0.1/24\n 192.168.0.1/255.255.255.0\n192.168.0.5/255.255.255.255\n\n -CMD_PARSE_IP_SUBNET_ERROR_2 The specified IP address is not a network address. -CMD_PARSE_IP_SUBNET_ERROR_3 The specified IP address is not a network prefix address. -CMD_EVAL_DATE_TIME_FAILED The date and time specification is invalid. \nThe date and time must be in the same format as "2005/10/08 19:30:00" where 6 integers are specified, representing year/month/day hour:minute:second separated by forward slashes, a space and then colons. Specify 4 digits for the year. -CMD_PARSE_IP_MASK_ERROR_1_6 Specify in the format of "IPv6 address/mask". \nSpecify the IPv6 address by separating the hexadecimal values using colons such as "2001:200:0:1::". For the mask, either specify hexadecimal values separated by colons such as "ffff:ffff:ffff:ffff::", or you can specify the bit length of mask using a decimal value such as 64. \nTo specify a standalone host, specify the mask as either "ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff" or "128". \n(Example)\n2001:200:0:1::/64\n2001:200:0:1::/ffff:ffff:ffff:ffff::\n2001:200:0:1::5/12\n\n -CMD_PARSE_IP_MASK_ERROR_1 Specify in the format of "IPv4 address/mask". \nSpecify the IPv4 address by separating the decimal values using dots such as "192.168.0.1". For the mask, either specify decimal values separated by dots such as "255.255.255.0", or you can specify the bit length of mask using a decimal value such as 24. \nTo specify a standalone host, specify the mask as either "255.255.255.255" or "32". \n(Example)\n 192.168.0.1/24\n 192.168.0.1/255.255.255.0\n192.168.0.5/255.255.255.255\n\n - - - -# Common messages -CMD_MSG_INVALID_HOSTNAME Specified host name is invalid. -CMD_MSG_OK The command completed successfully. -CMD_MSG_ALLOW Allow -CMD_MSG_DENY Deny -CMD_MSG_INFINITE Infinite -CMD_MSG_ENABLE Enable -CMD_MSG_DISABLE Disable -CMD_MSG_LOAD_CERT_FAILED Unable to read the specified X.509 certificate file. -CMD_MSG_SAVE_CERT_FAILED Failed to write the X.509 certificate file. -CMD_ACCOUNT_COLUMN_NAME VPN Connection Setting Name -CMD_ACCOUNT_COLUMN_HOSTNAME Destination VPN Server Host Name -CMD_ACCOUNT_COLUMN_PORT Destination VPN Server Port Number -CMD_ACCOUNT_COLUMN_HUBNAME Destination VPN Server Virtual Hub Name -CMD_ACCOUNT_COLUMN_PROXY_TYPE Proxy Server Type -CMD_ACCOUNT_COLUMN_PROXY_HOSTNAME Proxy Server Host Name -CMD_ACCOUNT_COLUMN_PROXY_PORT Proxy Server Port Number -CMD_ACCOUNT_COLUMN_PROXY_USERNAME Proxy Server User Name -CMD_ACCOUNT_COLUMN_SERVER_CERT_USE Verify Server Certificate -CMD_ACCOUNT_COLUMN_SERVER_CERT_NAME Registered Server Individual Certificate -CMD_ACCOUNT_COLUMN_RETRY_ON_SERVER_CERT Retry on Untrusted Server Certificate -CMD_ACCOUNT_COLUMN_DEVICE_NAME Device Name Used for Connection -CMD_ACCOUNT_COLUMN_AUTH_TYPE Authentication Type -CMD_ACCOUNT_COLUMN_AUTH_USERNAME User Name -CMD_ACCOUNT_COLUMN_AUTH_CERT_NAME Client Certificate for Authentication Use -CMD_ACCOUNT_COLUMN_NUMTCP Number of TCP Connections to Use in VPN Communication -CMD_ACCOUNT_COLUMN_TCP_INTERVAL Interval between Establishing Each TCP Connection -CMD_ACCOUNT_COLUMN_TCP_TTL Connection Life of Each TCP Connection -CMD_ACCOUNT_COLUMN_TCP_HALF Use Half Duplex Mode -CMD_ACCOUNT_COLUMN_ENCRYPT Encryption by SSL -CMD_ACCOUNT_COLUMN_COMPRESS Data Compression -CMD_ACCOUNT_COLUMN_BRIDGE_ROUTER Connect by Bridge / Router Mode -CMD_ACCOUNT_COLUMN_MONITOR Connect by Monitoring Mode -CMD_ACCOUNT_COLUMN_NO_TRACKING No Adjustment for Routing Table -CMD_ACCOUNT_COLUMN_QOS_DISABLE Do not Use QoS Control Function -CMD_ACCOUNT_COLUMN_DISABLEUDP Disable UDP Acceleration - - -# Debugging Information Collecting Tool -CMD_DEBUG_SOFTNAME Debugging Information Collecting Tool -CMD_DEBUG_PRINT Debugging Information Collecting Tool\r\n\r\n -CMD_DEBUG_NOT_2000 Windows 2000 or later is required. -CMD_DEBUG_NOT_ADMIN You must login as Administrators on Windows to execute this command. -CMD_DEBUG_UAC_FAILED Failed to obtain the Administrators privilege. -CMD_DEBUG_SAVE_TITLE Specify Destination Path to Save File -CMD_DEBUG_OK A debugging information file was saved as "%s".\r\n\r\nSend this file to your support staff.\r\nYou must verify the contents of this file before sending it to the support staff.\r\nRemove confidential information on this file with your responsibility and by yourself if there are some confidential information which you don't want to disclose it to the staff.\r\n\r\nIf you ignore the confidential information contained on the file, and you agree to send the entire file to the support staff, it means that you have agreed to disclose the entire contents of the file to the support staff. -CMD_DEBUG_NG Failed to save the debugging information as "%s". - - - -# TEST command -CMD_TEST Executing test operation. -CMD_TEST_HELP This is a test command. Executing test operation. With the test command, you can specify a number of arguments. You can omit the number of arguments. -CMD_TEST_ARGS Test [/A1:a_str] [/A2:b_str] [/A3:int_value] -CMD_TEST_A1 Specifies parameter A1. This can be omitted. -CMD_TEST_A2 Specifies parameter A2. If this is omitted, a prompt will be displayed to input parameter A2 when the command is executed. You cannot make a blank specification. -CMD_TEST_A3 Specify a numeric value. You must specify an integer that is within the range of 1 to 100. Specifying an integer outside that range will cause an error message to be displayed. -CMD_TEST_EVAL_A2 You cannot make a blank specification for parameter A2. -CMD_IP_EVAL_FAILED The IP address is incorrectly specified. -CMD_HOSTPORT_EVAL_FAILED The host name and port number specification is invalid. \nPlease specify using the format of host name:port number, or IP address:port number. -CMD_PORTLIST_EVAL_FAILED The port number list specification is invalid. \nThe list must have at least one port number set, and it is also possible to set multiple port numbers. When specifying multiple port numbers, separate them using a comma such as "443,992,8888". -CMD_PROTOCOL_EVAL_FAILED The protocol is incorrectly specified. Specify either ip, tcp, udp, icmpv4, icmpv6 or a protocol number (0 to 255) for the protocol. -CMD_PORT_RANGE_EVAL_FAILED The port number or the port number range was incorrectly specified. If specifying only one port number, an integer must be used to specify that port number. If specifying multiple ports, specify the beginning port number and the end port number joined together by a hyphen like "80-443". -CMD_TCP_CONNECTION_STATE_EVAL_FAILED The TCP connection state specification is invalid. Specify either "Established" or "Unestablished" and specify TCP when selecting protocol. -CMD_MAC_ADDRESS_AND_MASK_EVAL_FAILED The MAC address and mask specification is invalid. Use hexadecimal number with the separators, "-" or ":", and without the separators. An example is "00-AC-84-EA-33-BC/FF-FF-FF-FF-FF-FF". -CMD_EXEC_MSG_NAME %S command - %s -CMD_ID ID -CMD_FILE_NOT_FOUND Cannot find specified file "%s". -CMD_FILE_NAME_EMPTY The file name is not specified. -CMD_SAVECERTPATH Save X.509 certificate to file name: -CMD_SAVECERT_FAILED Failed to save the certificate file. -CMD_SAVEKEYPATH Save private key to file name: -CMD_SAVEKEY_FAILED Failed to save the private key file. -CMD_SAVEFILE_FAILED Failed to save the file. -CMD_LOADFILE_FAILED Failed to open the file. -CMD_LOADCERTPATH Read X.509 certificate from file name: -CMD_LOADCERT_FAILED Failed to read certificate file. -CMD_LOADKEYPATH Read private key from file name: -CMD_LOADKEY_FAILED Failed to read private key file. -CMD_LOADKEY_ENCRYPTED_1 The specified private key file is protected by a passphrase. -CMD_LOADKEY_ENCRYPTED_2 Please enter the passphrase: -CMD_LOADKEY_ENCRYPTED_3 The passphrase is incorrect. -CMD_KEYPAIR_FAILED The X.509 certificate and private key combination has been incorrectly specified. \r\nA certificate and a private key that corresponds to that certificate is required. -CMD_CERT_NOT_EXISTS The certificate is not registered. -CMD_NO_SETTINGS - -CMD_DISCONNECTED_MSG \n--- Error ---\n\nThe communication session with the host you were managing has been disconnected. From now on, if you run any commands an error will occur. \n\nTo reconnect to the host you were managing, first leave the prompt by inputting "EXIT" and then reconnect. \n\n - - -# VPNCMD コマンド -CMD_VPNCMD SoftEther VPN Command Line Management Utility Developer Edition -CMD_VPNCMD_HELP The 'vpncmd' program is a utility that allows you to manage SoftEther VPN software by using command lines. By using vpncmd, you can connect to a VPN Client, a VPN Server or VPN Bridge that is running on a local or remote computer and manage these services. Moreover, by using VPN Tools mode, you can call the Network Traffic Speed Test Tool and the certificate creation function. These can be used even when not connected to the VPN Server or VPN Client. \nWhen using vpncmd, if the file name is specified by using the /IN and /OUT parameter, the command can be executed in a batch according to a file in which the executable commands are enumerated and the execution results can be written to a file. Normally a command prompt will appear after vpncmd is launched but when an input file is specified by the /IN parameter, the program will automatically terminate after the execution of all lines in the input file is complete. Also, when a command to execute is specified by the /CMD parameter, the program will automatically terminate after the execution of that command is complete. You cannot specify the /IN parameter and the /CMD parameter at the same time. The termination code of the vpncmd program will be the error code of the last executed command (0 in the case of successful execution). \nUnder a Windows environment, when vpncmd is launched once or more by a user with administrator privileges, it is possible to simply input 'vpncmd' to a Windows command prompt or [Run...] window to launch vpncmd. To achieve the same result under a UNIX system, you can manually set, as appropriate, the PATH environment variable. -CMD_VPNCMD_ARGS vpncmd [host:port] [/CLIENT|/SERVER|/TOOLS] [/HUB:hub] [/ADMINHUB:adminhub] [/PASSWORD:password] [/IN:infile] [/OUT:outfile] [/CMD commands...] -CMD_VPNCMD_[host:port] By specifying parameters in the format "host name:port number", a connection will automatically be made to that host. If this is not specified, a prompt will appear to input the connection destination. When connecting to a VPN Client, you cannot specify a port number. -CMD_VPNCMD_CLIENT This will connect to VPN Client to do management. You cannot specify it together with /SERVER. -CMD_VPNCMD_SERVER This will connect to VPN Server or VPN Bridge to do management. You cannot specify it together with /CLIENT. -CMD_VPNCMD_TOOLS This will enables use of VPN Tools commands. VPN Tools include the simple certificate creation tool (MakeCert command) and the Network Traffic Speed Test Tool (SpeedTest command). -CMD_VPNCMD_HUB When connecting to the VPN Server by "Virtual Hub Admin Mode", this specifies the Virtual Hub name 'hub'. If you specify the host name but not the /HUB parameter, connection will be by "Server Admin Mode". -CMD_VPNCMD_ADMINHUB This will specify the name of the Virtual Hub 'adminhub' that is automatically selected after connecting to the VPN Server. If the /HUB parameter was specified, the Virtual Hub will be selected automatically and this specification will not be necessary. -CMD_VPNCMD_PASSWORD If the administrator password is required when connecting, specify the password 'password'. When the password is not specified, a prompt to input the password will be displayed. -CMD_VPNCMD_IN This will specify the text file 'infile' that contains the list of commands that are automatically executed after the connection is completed. If the /IN parameter is specified, the vpncmd program will terminate automatically after the execution of all commands in the file are finished. If the file contains multiple-byte characters, the encoding must be Unicode (UTF-8). This cannot be specified together with /CMD (if /CMD is specified, /IN will be ignored). -CMD_VPNCMD_OUT You can specify the text file 'outfile' to write all strings such as onscreen prompts, message, error and execution results. Note that if the specified file already exists, the contents of the existing file will be overwritten. Output strings will be recorded using Unicode (UTF-8) encoding. -CMD_VPNCMD_CMD If the optional command 'commands...' is included after /CMD, that command will be executed after the connection is complete and the vpncmd program will terminate after that. This cannot be specified together with /IN (if specified together with /IN, /IN will be ignored). Specify the /CMD parameter after all other vpncmd parameters. -CMD_VPNCMD_CSV You can specify this option to enable CSV outputs. Results of each command will be printed in the CSV format. It is useful for processing the results by other programs. -CMD_VPNCMD_CS_1 By using vpncmd program, the following can be achieved. \n\n1. Management of VPN Server or VPN Bridge \n2. Management of VPN Client\n3. Use of VPN Tools (certificate creation and Network Traffic Speed Test Tool)\n\n -CMD_VPNCMD_CS_2 Select 1, 2 or 3: -CMD_VPNCMD_HOST_1 Specify the host name or IP address of the computer that the destination VPN Server or VPN Bridge is operating on. \nBy specifying according to the format 'host name:port number', you can also specify the port number. \n(When the port number is unspecified, 443 is used.)\nIf nothing is input and the Enter key is pressed, the connection will be made to the port number 443 of localhost (this computer). -CMD_VPNCMD_HOST_2 Specify the host name or IP address of the computer that the destination VPN Client is operating on. \nIf nothing is input and Enter is pressed, connection will be made to localhost (this computer). -CMD_VPNCMD_HOST_3 Hostname of IP Address of Destination: -CMD_VPNCMD_HUB_1 If connecting to the server by Virtual Hub Admin Mode, please input the Virtual Hub name. \nIf connecting by server admin mode, please press Enter without inputting anything. -CMD_VPNCMD_HUB_2 Specify Virtual Hub Name: -CMD_VPNCMD_ABOUT SoftEther VPN Command Line Management Utility (vpncmd command)\nDeveloper Edition\n%S\n%S\nCopyright (c) all contributors on SoftEther VPN project in GitHub.\nCopyright (c) Daiyuu Nobori, SoftEther Project at University of Tsukuba, and SoftEther Corporation.\nAll rights reserved.\n -CMD_VPNCMD_PASSWORD_1 Access has been denied. Possibly the password is incorrect, or perhaps you are connecting by an incorrect admin mode. You can try inputting the password again. To cancel, press Ctrl+D. -CMD_VPNCMD_PASSWORD_2 Password: -CMD_VPNCMD_ERROR Error occurred. (Error code: %u)\n%s -CMD_VPNCMD_SERVER_CONNECTED Connection has been established with VPN Server "%S" (port %u). -CMD_VPNCMD_SERVER_CONNECTED_1 You have administrator privileges for the entire VPN Server. -CMD_VPNCMD_SERVER_CONNECTED_2 You have administrator privileges for Virtual Hub '%S' on the VPN Server. -CMD_VPNCMD_CLIENT_NO_REMODE The destination VPN Client server does not allow administrating connections from remote computers. Launch the command line management utility or VPN Client Manager on the computer that VPN Client is running on and connect to localhost. -CMD_VPNCMD_PWPROMPT_0 Please enter the password. To cancel press the Ctrl+D key. -CMD_VPNCMD_PWPROMPT_1 Password: -CMD_VPNCMD_PWPROMPT_2 Confirm input: -CMD_VPNCMD_PWPROMPT_3 The password and the password confirmation do not match. Please input the password and confirmation again. -CMD_VPNCMD_CLIENT_CONNECTED Connected to VPN Client "%S". -CMD_VPNCMD_TOOLS_CONNECTED VPN Tools has been launched. By inputting HELP, you can view a list of the commands that can be used. - - -####################################################### -# # -# Management commands for VPN Server are listed below # -# # -####################################################### - - - -# About command -CMD_About Display the version information -CMD_About_HELP This displays the version information of this command line management utility. Included in the version information are the vpncmd version number, build number and build information. -CMD_About_ARGS About - - -# ServerInfoGet command -CMD_ServerInfoGet Get server information -CMD_ServerInfoGet_Help This allows you to obtain the server information of the currently connected VPN Server or VPN Bridge. Included in the server information are the version number, build number and build information. You can also obtain information on the current server operation mode and the information of operating system that the server is operating on. -CMD_ServerInfoGet_Args ServerInfoGet - - -# ServerStatusGet command -CMD_ServerStatusGet Get Current Server Status -CMD_ServerStatusGet_Help This allows you to obtain in real-time the current status of the currently connected VPN Server or VPN Bridge. You can get statistical information on data communication and the number of different kinds of objects that exist on the server. You can get information on how much memory is being used on the current computer by the OS. -CMD_ServerStatusGet_Args ServerStatusGet - - -# ListenerCreate command -CMD_ListenerCreate Create New TCP Listener -CMD_ListenerCreate_Help This allows you to create a new TCP Listener on the server. By creating the TCP Listener the server starts listening for a connection from clients at the specified TCP/IP port number. \nA TCP Listener that has been created can be deleted by the ListenerDelete command. \nYou can also get a list of TCP Listeners currently registered by using the ListenerList command. \nnTo execute this command, you must have VPN Server administrator privileges. -CMD_ListenerCreate_Args ListenerCreate [port] -CMD_ListenerCreate_[port] Using an integer, specify the newly added TCP/IP listener port number. You can also use a port number that is already being used by a different program; however the VPN Server will not be able to use it until that program ends the use of that port. Specify a port number that is within the range of 1 to 65535. -CMD_ListenerCreate_PortPrompt Port number of newly added TCP/IP Listener: - - -# ListenerDelete command -CMD_ListenerDelete Delete TCP Listener -CMD_ListenerDelete_Help This allows you to delete a TCP Listener that's registered on the server. When the TCP Listener is in a state of operation, the listener will automatically be deleted when its operation stops. \nYou can also get a list of TCP Listeners currently registered by using the ListenerList command. \nTo execute this command, you must have VPN Server administrator privileges. -CMD_ListenerDelete_Args ListenerDelete [port] -CMD_ListenerDelete_[port] Using an integer, specify the TCP/IP listener port number you want to delete. -CMD_ListenerDelete_PortPrompt Port number of TCP/IP Listener: - - -# ListenerList command -CMD_ListenerList Get List of TCP Listeners -CMD_ListenerList_Help This allows you to get a list of TCP listeners registered on the current server. You can obtain information on whether the various TCP listeners have a status of operating or error. \nTo execute this command, you must have VPN Server administrator privileges. -CMD_ListenerList_Args ListenerList -CMD_ListenerList_Column1 TCP Port Number -CMD_ListenerList_Column2 Status - - -# ListenerEnable command -CMD_ListenerEnable Begin TCP Listener Operation -CMD_ListenerEnable_Help This starts the operation of stopped TCP Listeners registered on the current server. \nYou can also get a list of TCP Listeners currently registered by using the ListenerList command. \nTo execute this command, you must have VPN Server administrator privileges. -CMD_ListenerEnable_Args ListenerEnable [port] -CMD_ListenerEnable_[port] Using an integer, specify the port number of the TCP/IP listener you want to start. -CMD_ListenerEnable_PortPrompt Port number of TCP/IP Listener to start: - - -# ListenerDisable command -CMD_ListenerDisable Stop TCP Listener Operation -CMD_ListenerDisable_Help This stops the operation of operating TCP Listeners registered on the current server. \nYou can also get a list of TCP Listeners currently registered by using the ListenerList command. \nTo execute this command, you must have VPN Server administrator privileges. -CMD_ListenerDisable_Args ListenerDisable [port] -CMD_ListenerDisable_[port] Using an integer, specify the port number of the TCP/IP listener you want to stop. -CMD_ListenerDisable_PortPrompt Port number of TCP/IP Listener to start: - - -# PortsUDPSet command -CMD_PortsUDPSet Sets the UDP ports that the server should listen on -CMD_PortsUDPSet_Help This command can be used to specify a single or multiple UDP ports the server should listen on. \nYou can specify a port that is used by another process, however the server will not be able to use it until the port becomes free. \nSpecify a port number that is within the range of 1 to 65535. \nYou can list the ports that are currently set with the PortsUDPGet command. \nTo execute this command, you must have VPN Server administrator privileges. -CMD_PortsUDPSet_Args PortsUDPSet [ports] -CMD_PortsUDPSet_[ports] Multiple UDP ports can be specified by splitting them with a space or a comma, for example: "443, 992, 1194, 5555". \nSpecify "0" to disable the UDP listener. \n\nPorts: - - -# PortsUDPGet command -CMD_PortsUDPGet Lists the UDP ports that the server is listening on -CMD_PortsUDPGet_Help This command can be used to retrieve the UDP ports the server is listening on. \nYou can set the ports with the PortsUDPSet command. -CMD_PortsUDPGet_Args PortsUDPGet -CMD_PortsUDPGet_Ports UDP ports - - -# ProtoOptionsSet command -CMD_ProtoOptionsSet Sets an option's value for the specified protocol -CMD_ProtoOptionsSet_Help This command can be used to change an option's value for a specific protocol. \nYou can retrieve the options using the ProtoOptionsGet command. \nTo execute this command, you must have VPN Server administrator privileges. -CMD_ProtoOptionsSet_Args ProtoOptionsSet [protocol] [/NAME:option_name] [/VALUE:string/true/false] -CMD_ProtoOptionsSet_[protocol] Protocol name. -CMD_ProtoOptionsSet_NAME Option name. -CMD_ProtoOptionsSet_VALUE Option value. Make sure to write a value that is accepted by the specified protocol! -CMD_ProtoOptionsSet_Prompt_[protocol] Protocol: -CMD_ProtoOptionsSet_Prompt_NAME Option: -CMD_ProtoOptionsSet_Prompt_VALUE Value: - - -# ProtoOptionsGet command -CMD_ProtoOptionsGet Lists the options for the specified protocol -CMD_ProtoOptionsGet_Help This command can be used to retrieve the options for a specific protocol. \nDetailed info (e.g. value type) will be shown. \nYou can change an option's value with the ProtoOptionsSet command. -CMD_ProtoOptionsGet_Args ProtoOptionsGet [protocol] -CMD_ProtoOptionsGet_[protocol] Protocol name. -CMD_ProtoOptionsGet_Prompt_[protocol] Protocol: -CMD_ProtoOptionsGet_Column_Name Name -CMD_ProtoOptionsGet_Column_Type Type -CMD_ProtoOptionsGet_Column_Value Value -CMD_ProtoOptionsGet_Column_Description Description - -# ProtoOptions -CMD_ProtoOptions_Description_OpenVPN_DefaultClientOption When OpenVPN is compiled without OCC code, it doesn't send the options string to the server. The original OpenVPN server still works, because the configuration is static. SoftEther VPN is heuristic and wants to support as many different configurations as possible. This option allows to define the string that is sent to clients built without OCC code, so that they can successfully connect. -CMD_ProtoOptions_Description_OpenVPN_Obfuscation This may help an OpenVPN client bypass firewalls that are aware of the protocol and block it. The same XOR mask has to be applied client-side, otherwise it will not be able to connect with certain obfuscation methods! -CMD_ProtoOptions_Description_OpenVPN_ObfuscationMask Mask used to XOR the bytes in the packet (used for certain obfuscation modes). -CMD_ProtoOptions_Description_OpenVPN_PushDummyIPv4AddressOnL2Mode There's a bug that manifests under certain circumstances on Linux. It causes the OpenVPN client to disconnect unless the TAP device is UP. This option tells the server to push a dummy IPv4 address (RFC7600) to the client, so that the TAP adapter is forced to be UP. - -# ServerPasswordSet command -CMD_ServerPasswordSet Set VPN Server Administrator Password -CMD_ServerPasswordSet_Help This sets the VPN Server administrator password. You can specify the password as a parameter. If the password is not specified, a prompt will be displayed to input the password and password confirmation. If you include the password as a parameter, this password will be displayed momentarily on the screen, which poses a risk. We recommend that whenever possible, avoid specifying this parameter and input the password using the password prompt. \nTo execute this command, you must have VPN Server administrator privileges. -CMD_ServerPasswordSet_Args ServerPasswordSet [password] -CMD_ServerPasswordSet_[password] This specifies a new password setting. - - -# ClusterSettingGet command -CMD_ClusterSettingGet Get Clustering Configuration of Current VPN Server -CMD_ClusterSettingGet_Help You can use this to acquire the clustering configuration of the current VPN Server. \nTo execute this command, you must have VPN Server administrator privileges. -CMD_ClusterSettingGet_Args ClusterSettingGet -CMD_ClusterSettingGet_Current Current Configuration -CMD_ClusterSettingGet_None (No setting) -CMD_ClusterSettingGet_PublicIp Public IP Address -CMD_ClusterSettingGet_PublicPorts List of Public Ports -CMD_ClusterSettingGet_Controller Destination Controller -CMD_ClusterSettingGet_ControllerOnly Controller Function Only -CMD_ClusterSettingGet_Weight Performance Standard in Cluster - - -# ClusterSettingStandalone command -CMD_ClusterSettingStandalone Set VPN Server Type as Standalone -CMD_ClusterSettingStandalone_Help Use this to set the VPN Server type as Standalone Server. Standalone server means a VPN Server that does not belong to any cluster in its current state. When VPN Server is installed, by default it will be in standalone server mode. Unless you have particular plans to configure a cluster, we recommend the VPN Server be operated in standalone mode. \nTo execute this command, you must have VPN Server administrator privileges. \nAlso, when this command is executed, VPN Server will automatically restart. \nThis command cannot be run on VPN Bridge. -CMD_ClusterSettingStandalone_Args ClusterSettingStandalone - - -# ClusterSettingController command -CMD_ClusterSettingController Set VPN Server Type as Cluster Controller -CMD_ClusterSettingController_Help Use this to set the VPN Server type as Cluster Controller. A cluster controller is the central computer of all member servers of a cluster in the case where a clustering environment is made up of multiple VPN Servers. A cluster requires one computer to serve this role. The other cluster member servers that are configured in the same cluster begin operation as a cluster member by connecting to the cluster controller. \nTo execute this command, you must have VPN Server administrator privileges. \nAlso, when this command is executed, VPN Server will automatically restart. \nThis command cannot be run on VPN Bridge. -CMD_ClusterSettingController_Args ClusterSettingController [/WEIGHT:weight] [/ONLY:yes|no] -CMD_ClusterSettingController_WEIGHT This sets a value for the performance standard ratio of this VPN Server. This is the standard value for when load balancing is performed in the cluster. Normally it is 100. For example, making only one machine 200 while the other members have a status of 100, will regulate that machine to receive twice as many connections as the other members during load balancing. Specify 1 or higher for the value. If this parameter is left unspecified, 100 will be used. -CMD_ClusterSettingController_ONLY By specifying "yes" here, the VPN Server will operate only as a controller on the cluster and it will always distribute general VPN Client connections to members other than itself. This function is used in high-load environments. If this parameter is left unspecified, "no" will be used. - - -# ClusterSettingMember command -CMD_ClusterSettingMember Set VPN Server Type as Cluster Member -CMD_ClusterSettingMember_Help Use this to set the VPN Server type as Cluster Member Server. A cluster member server is a member computer belonging to a clustering configuration made up of multiple VPN Servers with another existing cluster controller as the center. Multiple cluster members can be added to the cluster as required. \nBefore setting the VPN Server as a cluster member server, first ask the administrator of the cluster controller to be used for the controller's IP address and port number, the public IP address and public port number (when required) of this VPN Server and the password. \nTo execute this command, you must have VPN Server administrator privileges. \nAlso, when this command is executed, VPN Server will automatically restart. \nThis command cannot be run on VPN Bridge. -CMD_ClusterSettingMember_Args ClusterSettingMember [server:port] [/IP:ip] [/PORTS:ports] [/PASSWORD:password] [/WEIGHT:weight] -CMD_ClusterSettingMember_[server:port] Specify the host name or IP address, and port number of the destination cluster controller using the parameter with the format host name:port number. -CMD_ClusterSettingMember_IP Specify the public IP address of this server. If you wish to leave public IP address unspecified, specify it like this: "/IP:none". When a public IP address is not specified, the IP address of the network interface used when connecting to the cluster controller will be automatically used. -CMD_ClusterSettingMember_PORTS Use this to specify the list of public port numbers on this server. The list must have at least one public port number set, and it is also possible to set multiple public port numbers. When specifying multiple port numbers, separate them using a comma such as "/PORTS443,992,8888". -CMD_ClusterSettingMember_PASSWORD Specify the password required to connect to the destination controller. It needs to be the same as an administrator password on the destination controller. -CMD_ClusterSettingMember_WEIGHT This sets a value for the performance standard ratio of this VPN Server. This is the standard value for when load balancing is performed in the cluster. For example, making only one machine 200 while the other members have a status of 100, will regulate that machine to receive twice as many connections as the other members. Specify 1 or higher for the value. If this parameter is left unspecified, 100 will be used. -CMD_ClusterSettingMember_Prompt_IP_1 Specify a public IP address. \nIf you wish to leave this unspecified, press Enter without inputting anything. -CMD_ClusterSettingMember_Prompt_IP_2 Public IP Address: -CMD_ClusterSettingMember_Prompt_PORT_1 Please specify a list of public port numbers. \nWhen specifying 2 or more port numbers, separate each entry with a comma, like: 444,992,888. -CMD_ClusterSettingMember_Prompt_PORT_2 Public Port Number: -CMD_ClusterSettingMember_Prompt_HOST_1 Destination Controller Host Name and Port Number: - - -# ClusterMemberList command -CMD_ClusterMemberList Get List of Cluster Members -CMD_ClusterMemberList_Help Use this command when the VPN Server is operating as a cluster controller to get a list of the cluster member servers on the same cluster, including the cluster controller itself. \nFor each member, the following information is also listed. Type, Connection Start, Host Name, Points, Number of Session, Number of TCP Connections, Number of Operating Virtual Hubs, Using Client Connection License and Using Bridge Connection License. \nThis command cannot be run on VPN Bridge. -CMD_ClusterMemberList_Args ClusterMemberList - - -# ClusterMemberInfoGet command -CMD_ClusterMemberInfoGet Get Cluster Member Information -CMD_ClusterMemberInfoGet_Help When the VPN Server is operating as a cluster controller, you can get information on cluster member servers on that cluster by specifying the IDs of the member servers. \nYou can get the following information about the specified cluster member server: Server Type, Time Connection has been Established, IP Address, Host Name, Points, Public Port List, Number of Operating Virtual Hubs, First Virtual Hub, Number of Sessions and Number of TCP Connections. \nThis command cannot be run on VPN Bridge. -CMD_ClusterMemberInfoGet_Args ClusterMemberInfoGet [id] -CMD_ClusterMemberInfoGet_[id] Specify the ID of the cluster member whose information you want to get. You can obtain the cluster member server ID by using the ClusterMemberList command. -CMD_ClusterMemberInfoGet_PROMPT_ID Cluster Member ID to Get Info: - - -# ClusterMemberCertGet command -CMD_ClusterMemberCertGet Get Cluster Member Certificate -CMD_ClusterMemberCertGet_Help When the VPN Server is operating as a cluster controller, you can get the public X.509 certificate of cluster member servers on that cluster by specifying the IDs of those member servers. You can save the certificate as an X.509 format file. \nThis command cannot be run on VPN Bridge. -CMD_ClusterMemberCertGet_Args ClusterMemberCertGet [id] [/SAVECERT:cert] -CMD_ClusterMemberCertGet_[id] Specify the ID of the cluster member whose certificate you want to get. You can obtain the cluster member server ID by using the ClusterMemberList command. -CMD_ClusterMemberCertGet_SAVECERT Specify the file path name to save the certificate you obtained. You can save the certificate in X.509 format. -CMD_ClusterMemberCertGet_PROMPT_ID Cluster Member ID to Get Certificate: - -# ClusterConnectionStatusGet command -CMD_ClusterConnectionStatusGet Get Connection Status to Cluster Controller -CMD_ClusterConnectionStatusGet_Help Use this command when the VPN Server is operating as a cluster controller to get the status of connection to the cluster controller. \nYou can get the following information: Controller IP Address, Port Number, Connection Status, Connection Start Time, First Connection Established Time, Current Connection Established Time, Number of Connection Attempts, Number of Successful Connections, Number of Failed Connections. \nThis command cannot be run on VPN Bridge. -CMD_ClusterConnectionStatusGet_Args ClusterConnectionStatusGet - - -# Debug command -CMD_Debug Execute a Debug Command -CMD_Debug_Help Runs a debug command on the running VPN Server / Bridge process.\nThis command should be executed wjen the support staff requests to do so.\nMisuse of this command might cause a crash of VPN Server / Bridge running. -CMD_Debug_Args Debug [id] [/ARG:arg] -CMD_Debug_[id] Specify a debug command number. -CMD_Debug_ARG Specify a string to pass to the debug command. If a string contains spaces, contains the whole command by " ". -CMD_Debug_Msg1 Sending the debug command... -CMD_Debug_Msg2 The debug command has executed.\nResults: \"%S\" - - -# Crash command -CMD_Crash Raise a error on the VPN Server / Bridge to terminate the process forcefully. -CMD_Crash_Help This command will raise a fatal error (memory access violation) on the VPN Server / Bridge running process in order to crash the process. As the result, VPN Server / Bridge will be terminated and restarted if it is running as a service mode. If the VPN Server is running as a user mode, the process will not automatically restarted.\nThis command is for a situation when the VPN Server / Bridge is under a non-recoverable error or the process is in an infinite loop. This command will disconnect all VPN Sessions on the VPN Server / Bridge. All unsaved settings in the memory of VPN Server / Bridge will be lost.\nBefore run this command, run the Flush command to try to save volatile data to the configuration file.\nTo execute this command, you must have VPN Server / VPN Bridge administrator privileges. -CMD_Crash_Args Crash [yes] -CMD_Crash_[yes] Input "yes" for confirmation. -CMD_Crash_Msg Sending the Crush command to the VPN Server. The VPN Server will be let to crash immediately, so you can never get the result value of this command. After this moment, vpncmd will be disconnected from the VPN Server. -CMD_Crash_Confirm Do you really want to crash the VPN Server?\nInput "yes" if it is ok: -CMD_Crash_Aborted The Crash command has been aborted. - - -# Flush command -CMD_Flush Save All Volatile Data of VPN Server / Bridge to the Configuration File -CMD_Flush_Help Normally, the VPN Server / VPN Bridge retains the volatile configuration data in memory. It is flushed to the disk as vpn_server.config or vpn_bridge.config periodically. The period is 300 seconds (5 minutes) by default. (The period can be altered by modifying the AutoSaveConfigSpan item in the configuration file.) The data will be saved on the timing of shutting down normally of the VPN Server / Bridge.\nExecute the Flush command to make the VPN Server / Bridge save the settings to the file immediately. The setting data will be stored on the disk drive of the server computer. Use the Flush command in a situation that you do not have an enough time to shut down the server process normally.\nTo execute this command, you must have VPN Server administrator privileges. \nTo execute this command, you must have VPN Server / VPN Bridge administrator privileges. -CMD_Flush_Args Flush -CMD_Flush_Msg1 Writing volatile data from memory to the disk...\n -CMD_Flush_Msg2 Saving completed. The file size is %S bytes.\n - - -# ServerCertGet command -CMD_ServerCertGet Get SSL Certificate of VPN Server -CMD_ServerCertGet_Help Use this to get the SSL certificate that the VPN Server provides to the connected client. You can save the certificate as an X.509 format file. -CMD_ServerCertGet_Args ServerCertGet [cert] -CMD_ServerCertGet_[cert] Specify the file path name to save the certificate you obtained. You can save the certificate in X.509 format. - - -# ServerKeyGet command -CMD_ServerKeyGet Get SSL Certificate Private Key of VPN Server -CMD_ServerKeyGet_Help Use this to get the SSL certificate private key that the VPN Server provides to the connected client. You can save the private key as a Base 64 encoded file. \nTo execute this command, you must have VPN Server administrator privileges. -CMD_ServerKeyGet_Args ServerKeyGet [key] -CMD_ServerKeyGet_[key] Specify the file path name to save the private key you obtained. You can save the private key in a Base 64 encoded format. - - -# ServerCertSet command -CMD_ServerCertSet Set SSL Certificate and Private Key of VPN Server -CMD_ServerCertSet_Help You can set the SSL certificate that the VPN Server provides to the connected client and the private key for that certificate. The certificate must be in X.509 format and the private key must be Base 64 encoded format. \nTo execute this command, you must have VPN Server administrator privileges. -CMD_ServerCertSet_Args ServerCertSet [/LOADCERT:cert] [/LOADKEY:key] -CMD_ServerCertSet_LOADCERT Specify the X.509 format certificate file to use. -CMD_ServerCertSet_LOADKEY Specify the Base 64 encoded private key file for the certificate to use. - - -# ServerCipherGet command -CMD_ServerCipherGet Get the Encrypted Algorithm Used for VPN Communication. -CMD_ServerCipherGet_Help Use this to get the current setting of the algorithm used for the electronic signature and encrypted for SSL connection to be used for communication between the VPN Server and the connected client and the list of algorithms that can be used on the VPN Server. -CMD_ServerCipherGet_Args ServerCipherGet -CMD_ServerCipherGet_SERVER Encrypted Algorithm Currently Used by VPN Server: -CMD_ServerCipherGet_CIPHERS List of Usable Encrypted Algorithm Names: - -# ServerCipherSet command -CMD_ServerCipherSet Set the Encrypted Algorithm Used for VPN Communication. -CMD_ServerCipherSet_Help Use this to set the algorithm used for the electronic signature and encrypted for SSL connections to be used for communication between the VPN Server and the connected client. \nBy specifying the algorithm name, the specified algorithm will be used later between the VPN Client and VPN Bridge connected to this server and the data will be encrypted. \nTo execute this command, you must have VPN Server administrator privileges. -CMD_ServerCipherSet_Args ServerCipherSet [name] -CMD_ServerCipherSet_[name] This specifies the encrypted and electronic signature algorithm to set. You can obtain the list of usable algorithms by using the ServerCipherGet command. -CMD_ServerCipherSet_PROMPT_NAME Encrypted Algorithm Name to Specify: - -# KeepEnable command -CMD_KeepEnable Enable the Keep Alive Internet Connection Function -CMD_KeepEnable_Help This allows you to enable the Keep Alive Internet Connection Function. By using the Keep Alive Internet Connection Function for network connection environments where connections will automatically be disconnected when there are periods of no communication that are longer than a set period, it is possible to keep alive the Internet connection by sending packets to a nominated server on the Internet at set intervals. \nYou can set a destination host name etc, by using the KeepSet command. \nTo execute this command on a VPN Server or VPN Bridge, you must have administrator privileges. -CMD_KeepEnable_Args KeepEnable - - -# KeepDisable command -CMD_KeepDisable Disable the Keep Alive Internet Connection Function -CMD_KeepDisable_Help This allows you to disable the Keep Alive Internet Connection Function.\nTo execute this command on a VPN Server or VPN Bridge, you must have administrator privileges. -CMD_KeepDisable_Args KeepDisable - - -# KeepSet command -CMD_KeepSet Set the Keep Alive Internet Connection Function -CMD_KeepSet_Help Use this to set the destination host name etc. of the Keep Alive Internet Connection Function. For network connection environments where connections will automatically be disconnected where there are periods of no communication that are longer than a set period, by using the Keep Alive Internet Connection Function, it is possible to keep alive the Internet connection by sending packets to a nominated server on the Internet at set intervals. \nWhen using this command, you can specify the following: Host Name, Port Number, Packet Send Interval, and Protocol. \nPackets sent to keep alive the Internet connection will have random content and personal information that could identify a computer or user is not sent. \nYou can use the KeepEnable command or KeepDisable command to enable/disable the Keep Alive Internet Connection Function. KeepSet does not change the enabled/disabled status. \nTo execute this command on a VPN Server or VPN Bridge, you must have administrator privileges. -CMD_KeepSet_Args KeepSet [/HOST:host:port] [/PROTOCOL:tcp|udp] [/INTERVAL:interval] -CMD_KeepSet_HOST Specify the host name or IP address, and port number of the destination using the format "host name:port number". -CMD_KeepSet_PROTOCOL Specify either tcp or udp. -CMD_KeepSet_INTERVAL Specify, in seconds, the interval between the sending of packets. -CMD_KeepSet_PROMPT_HOST Destination Host Name/IP Address and Port Number: -CMD_KeepSet_PROMPT_PROTOCOL tcp or udp: -CMD_KeepSet_PROMPT_INTERVAL Interval Between Packets Sends (Seconds): -CMD_KeepSet_EVAL_TCP_UDP Please specify "tcp" or "udp". - -# KeepGet command -CMD_KeepGet Get the Keep Alive Internet Connection Function -CMD_KeepGet_Help Use this to get the current setting contents of the Keep Alive Internet Connection Function. In addition to the destination's Host Name, Port Number, Packet Send Interval and Protocol, you can obtain the current enabled/disabled status of the Keep Alive Internet Connection Function. -CMD_KeepGet_Args KeepGet -CMD_KeepGet_COLUMN_1 Host Name -CMD_KeepGet_COLUMN_2 Port Number -CMD_KeepGet_COLUMN_3 Packet Send Interval (Sec) -CMD_KeepGet_COLUMN_4 Protocol -CMD_KeepGet_COLUMN_5 Current Status - - -# SyslogEnable command -CMD_SyslogEnable Set syslog Send Function -CMD_SyslogEnable_Help Use this to set the usage of syslog send function and which syslog server to use. -CMD_SyslogEnable_Args SyslogEnable [1|2|3] [/HOST:host:port] -CMD_SyslogEnable_[1|2|3] Specify, using an integer, 1, 2 or 3 for the setting to use the syslog send function. \n1: Send server log by syslog. \n2: Send server and Virtual Hub security logs by syslog. \n3: Send server, Virtual Hub security, and packet logs by syslog. -CMD_SyslogEnable_HOST Specify the host name or IP address, and port number of the syslog server using the format [host name:port number]. If the port number is omitted, 514 will be used. -CMD_SyslogEnable_MINMAX Specify, using an integer, 1, 2 or 3 for the setting to use the syslog send function. -CMD_SyslogEnable_Prompt_123 Setting to Use syslog Send Function (1-3): -CMD_SyslogEnable_Prompt_HOST Specify syslog Server: - - -# SyslogDisable command -CMD_SyslogDisable Disable syslog Send Function -CMD_SyslogDisable_Help Use this to disable the syslog send function. -CMD_SyslogDisable_Args SyslogDisable - - -# SyslogGet command -CMD_SyslogGet Get syslog Send Function -CMD_SyslogGet_Help This allows you to get the current setting contents of the syslog send function. You can get the usage setting of the syslog function and the host name and port number of the syslog server to use. -CMD_SyslogGet_Args SyslogGet -CMD_SyslogGet_COLUMN_1 Set the Use of syslog Send Function -CMD_SyslogGet_COLUMN_2 syslog Server Host Name -CMD_SyslogGet_COLUMN_3 syslog Server Port Number - - -# ConnectionList command -CMD_ConnectionList Get List of TCP Connections Connecting to the VPN Server -CMD_ConnectionList_Help Use this to get a list of TCP/IP connections that are currently connecting to the VPN Server. It does not display the TCP connections that have been established as VPN sessions. To get the list of TCP/IP connections that have been established as VPN sessions, you can use the SessionList command. \nYou can get the following: Connection Name, Connection Source, Connection Start and Type.\nTo execute this command, you must have VPN Server administrator privileges. -CMD_ConnectionList_Args ConnectionList - - -# ConnectionList command -CMD_ConnectionGet Get Information of TCP Connections Connecting to the VPN Server -CMD_ConnectionGet_Help Use this to get detailed information of a specific TCP/IP connection that is connecting to the VPN Server. \nYou can get the following information: Connection Name, Connection Type, Source Hostname, Source IP Address, Source Port Number (TCP), Connection Start, Server Product Name, Server Version, Server Build Number, Client Product Name, Client Version, and Client Build Number. \nTo execute this command, you must have VPN Server administrator privileges. -CMD_ConnectionGet_Args ConnectionGet [name] -CMD_ConnectionGet_[name] This allows you to specify the name of the connection whose information you want to get. To get a list of connection names, you can use the ConnectionList command. -CMD_ConnectionGet_PROMPT_NAME Connection Name to Get Info: - -# ConnectionDisconnect command -CMD_ConnectionDisconnect Disconnect TCP Connections Connecting to the VPN Server -CMD_ConnectionDisconnect_Help Use this to forcefully disconnect specific TCP/IP connections that are connecting to the VPN Server. \nTo execute this command, you must have VPN Server administrator privileges. -CMD_ConnectionDisconnect_Args ConnectionDisconnect [name] -CMD_ConnectionDisconnect_[name] Specify the name of the connection to disconnect. To get a list of connection names, you can use the ConnectionList command. -CMD_ConnectionDisconnect_PROMPT_NAME Connection Name to Disconnect: - - -# BridgeDeviceList command -CMD_BridgeDeviceList Get List of Network Adapters Usable as Local Bridge -CMD_BridgeDeviceList_Help Use this to get a list of Ethernet devices (network adapters) that can be used as a bridge destination device as part of a Local Bridge connection. If possible, network connection name is displayed. \nYou can use a device displayed here by using the BridgeCreate command. \nTo execute this command, you must have VPN Server administrator privileges. -CMD_BridgeDeviceList_Args BridgeDeviceList - - -# BridgeList command -CMD_BridgeList Get List of Local Bridge Connection -CMD_BridgeList_Help Use this to get a list of the currently defined Local Bridge connections. \nYou can get the Local Bridge connection Virtual Hub name and the bridge destination Ethernet device (network adapter) name or tap device name, as well as the operating status. -CMD_BridgeList_Args BridgeList - - -# BridgeCreate command -CMD_BridgeCreate Create Local Bridge Connection -CMD_BridgeCreate_Help Use this to create a new Local Bridge connection on the VPN Server.\nBy using a Local Bridge, you can configure a Layer 2 bridge connection between a Virtual Hub operating on this VPN server and a physical Ethernet Device (Network Adapter). \nYou can create a tap device (virtual network interface) on the system and connect a bridge between Virtual Hubs (the tap device is only supported by Linux versions). \nIt is possible to establish a bridge to an operating network adapter of your choice for the bridge destination Ethernet device (network adapter), but in high load environments, we recommend you prepare a network adapter dedicated to serve as a bridge. \nTo execute this command, you must have VPN Server administrator privileges. -CMD_BridgeCreate_Args BridgeCreate [hubname] [/DEVICE:device_name] [/TAP:yes|no] -CMD_BridgeCreate_[hubname] Specify the Virtual Hub to create bridge. To get a list of Virtual Hubs, you can use the HubList command. It is not essential that you specify a Virtual Hub that is currently operating. If you specify a Virtual Hub name that is not currently operating or that does not exist, the Local Bridge connection will become enabled when the actual operation of that Virtual Hub begins. -CMD_BridgeCreate_DEVICE Specify the bridge destination Ethernet device (network adapter) or tap device name. You can get the list of Ethernet device names by using the BridgeDeviceList command. -CMD_BridgeCreate_TAP Specify yes if you are using a tap device rather than a network adapter for the bridge destination (only supported for Linux versions). When this is omitted, it will be treated the same as when no is specified. -CMD_BridgeCreate_PROMPT_HUBNAME Virtual Hub Name to Create Bridge: -CMD_BridgeCreate_PROMPT_DEVICE Bridge Destination Device Name: -CMD_BridgeCreate_PROMPT_TAP Use tap device? (yes/no): - - -# BridgeDelete command -CMD_BridgeDelete Delete Local Bridge Connection -CMD_BridgeDelete_Help Use this to delete an existing Local Bridge connection. To get a list of current Local Bridge connections use the BridgeDeviceList command. \nTo execute this command, you must have VPN Server administrator privileges. -CMD_BridgeDelete_Args BridgeDelete [hubname] [/DEVICE:device_name] -CMD_BridgeDelete_[hubname] Specify the Virtual Hub of the Local Bridge to delete. -CMD_BridgeDelete_DEVICE Specify the device name (network adapter or tap device name) of the Local Bridge to delete. -CMD_BridgeDelete_PROMPT_HUBNAME Virtual Hub Name to Delete Bridge: -CMD_BridgeDelete_PROMPT_DEVICE Bridge Device Name to Delete: - - -# Caps command -CMD_Caps Get List of Server Functions/Capability -CMD_Caps_Help Use this get a list of functions and capability of the VPN Server currently connected and being managed. \nThe function and capability of VPN Servers are different depending on the operating VPN server's edition and version. Sometimes commands may be included in the command line management utility that cannot operate because of the function and capability of the destination VPN Server. Using this command, you can find out the capability of the target VPN Server and report it. \nIf the version of the VPN Server is newer than the command line management utility and there are functions that the command line management utility does not recognize, you can display the contents strings (variable names) as they are. -CMD_Caps_Args Caps - - -# Reboot command -CMD_Reboot Reboot VPN Server Service -CMD_Reboot_Help Use this to restart the VPN Server service. \nWhen you restart the VPN Server, all currently connected sessions and TCP connections will be disconnected and no new connections will be accepted until the restart process has completed. \nBy using this command, only the VPN Server service program will be restarted and the physical computer that VPN Server is operating on does not restart. This management session will also be disconnected, so you will need to reconnect to continue management. \nAlso, by specifying the /RESTCONFIG:yes parameter, the contents of the configuration file (.config) held by the current VPN Server will be initialized. \nTo execute this command, you must have VPN Server administrator privileges. -CMD_Reboot_Args Reboot [/RESETCONFIG:yes|no] -CMD_Reboot_RESETCONFIG By specifying yes, the contents of the configuration file (.config) held by the current VPN Server will be initialized. Please carefully consider the implications when setting this parameter. - - -# ConfigGet command -CMD_ConfigGet Get the current configuration of the VPN Server -CMD_ConfigGet_Help Use this to get a text file (.config file) that contains the current configuration contents of the VPN server. You can get the status on the VPN Server at the instant this command is executed. \nWhen part of the contents of the configuration file does not specify a parameter, it will be displayed on screen as it is. By specifying a save destination file name by parameter, the contents will be saved by that file name. \nYou can edit the configuration file by using a regular text editor. To write an edited configuration to the VPN Server, use the ConfigSet command. \nTo execute this command, you must have VPN Server administrator privileges. -CMD_ConfigGet_Args ConfigGet [path] -CMD_ConfigGet_[path] When you want to save the contents of the configuration file to a file, use this to specify the file name. If left unspecified, the configuration contents will be displayed on screen. If the configuration file contains multiple-byte characters, the encoding must be saved as Unicode (UTF-8). -CMD_ConfigGet_FILENAME Config name: "%S", Size: %u -CMD_ConfigGet_FILE_SAVE_FAILED Creation of specified file failed. - - -# ConfigSet command -CMD_ConfigSet Write Configuration File to VPN Server -CMD_ConfigSet_Help Use this to write the configuration file to the VPN Server. By executing this command, the contents of the specified configuration file will be applied to the VPN Server and the VPN Server program will automatically restart and upon restart, operate according to the new configuration contents. \nBecause it is difficult for an administrator to write all the contents of a configuration file, we recommend you use the ConfigGet command to get the current contents of the VPN Server configuration and save it to file. You can then edit these contents in a regular text editor and then use the ConfigSet command to rewrite the contents to the VPN Server. \nThis command is for people with a detailed knowledge of the VPN Server and if an incorrectly configured configuration file is written to the VPN Server, it not only could cause errors, it could also result in the lost of the current setting data. Take special care when carrying out this action. \nTo execute this command, you must have VPN Server administrator privileges. -CMD_ConfigSet_Args ConfigSet [path] -CMD_ConfigSet_[path] Specify the file name of the write destination configuration file. If the write destination file contains multiple-byte characters, the encoding must be Unicode (UTF-8). -CMD_ConfigSet_PROMPT_PATH Config file path name to upload to server: -CMD_ConfigSet_FILE_LOAD_FAILED Reading from specified file failed. - - -# RouterList command -CMD_RouterList Get List of Virtual Layer 3 Switches -CMD_RouterList_Help Use this to get the list of Virtual Layer 3 Switches defined on the VPN Server. You can get the following information on the Virtual Layer 3 Switches: Switch Name, Operating Status, Number of Interfaces, and Number of Routing Tables. \nTo execute this command, you must have VPN Server administrator privileges. \nAlso, this command does not operate on VPN Bridge. -CMD_RouterList_Args RouterList - - -# RouterAdd command -CMD_RouterAdd Define New Virtual Layer 3 Switch -CMD_RouterAdd_Help Use this to define a new Virtual Layer 3 Switch on the VPN Server. \nTo execute this command, you must have VPN Server administrator privileges. \nAlso, this command does not operate on VPN Bridge. \n\n[Explanation on Virtual Layer 3 Switch Function]\nYou can define Virtual Layer 3 Switches between multiple Virtual Hubs operating on this VPN Server and configure routing between different IP networks. \n\n[Caution about the Virtual Layer 3 Switch Function]\nThe Virtual Layer 3 Switch functions are provided for network administrators and other people who know a lot about networks and IP routing. If you are using the regular VPN functions, you do not need to use the Virtual Layer 3 Switch functions. \nIf the Virtual Layer 3 Switch functions are to be used, the person who configures them must have sufficient knowledge of IP routing and be perfectly capable of not impacting the network. -CMD_RouterAdd_Args RouterAdd [name] -CMD_RouterAdd_[name] Use this to specify the name of the newly created Virtual Layer 3 Switch name. You cannot add a name that is identical to an existing Virtual Layer 3 Switch. -CMD_RouterAdd_PROMPT_NAME Name of Virtual Layer 3 Switch to Create: - - -# RouterDelete command -CMD_RouterDelete Delete Virtual Layer 3 Switch -CMD_RouterDelete_Help Use this to delete an existing Virtual Layer 3 Switch that is defined on the VPN Server. When the specified Virtual Layer 3 Switch is operating, it will be automatically deleted after operation stops. \nTo get a list of existing Virtual Layer 3 Switches, use the RouterList command. \nTo execute this command, you must have VPN Server administrator privileges. \nAlso, this command does not operate on VPN Bridge. -CMD_RouterDelete_Args RouterDelete [name] -CMD_RouterDelete_[name] Use this to specify the name of the Virtual Layer 3 Switch to be deleted. -CMD_RouterDelete_PROMPT_NAME Name of Virtual Layer 3 Switch to Delete: - - -# RouterStart command -CMD_RouterStart Start Virtual Layer 3 Switch Operation -CMD_RouterStart_Help Use this to start the operation of an existing Virtual Layer 3 Switch defined on the VPN Server whose operation is currently stopped. \nTo get a list of existing Virtual Layer 3 Switches, use the RouterList command. \nTo execute this command, you must have VPN Server administrator privileges. \nAlso, this command does not operate on VPN Bridge. \n\n[Explanation on Virtual Layer 3 Switch Function]\nYou can define Virtual Layer 3 Switches between multiple Virtual Hubs operating on this VPN Server and configure routing between different IP networks. \n\n[Caution about the Virtual Layer 3 Switch Function]\nThe Virtual Layer 3 Switch functions are provided for network administrators and other people who know a lot about networks and IP routing. If you are using the regular VPN functions, you do not need to use the Virtual Layer 3 Switch functions. \nIf the Virtual Layer 3 Switch functions are to be used, the person who configures them must have sufficient knowledge of IP routing and be perfectly capable of not impacting the network. -CMD_RouterStart_Args RouterStart [name] -CMD_RouterStart_[name] Use this to specify the name of the Virtual Layer 3 Switch to start. -CMD_RouterStart_PROMPT_NAME Name of Virtual Layer 3 Switch to Start: - - -# RouterStop command -CMD_RouterStop Stop Virtual Layer 3 Switch Operation -CMD_RouterStop_Help Use this to stop the operation of an existing Virtual Layer 3 Switch defined on the VPN Server whose operation is currently operating. \nTo get a list of existing Virtual Layer 3 Switches, use the RouterList command. \nTo execute this command, you must have VPN Server administrator privileges. -CMD_RouterStop_Args RouterStop [name] -CMD_RouterStop_[name] Use this to specify the name of the Virtual Layer 3 Switch to stop. -CMD_RouterStop_PROMPT_NAME Name of Virtual Layer 3 Switch to Stop: - - -# RouterIfList command -CMD_RouterIfList Get List of Interfaces Registered on the Virtual Layer 3 Switch -CMD_RouterIfList_Help Use this to get a list of virtual interfaces when virtual interfaces have been defined on a specified Virtual Layer 3 Switch. \nYou can define multiple virtual interfaces and routing tables for a single Virtual Layer 3 Switch. \nA virtual interface is associated to a virtual Hub and operates as a single IP host on the Virtual Hub when that Virtual Hub is operating. When multiple virtual interfaces that respectively belong to a different IP network of a different Virtual Hub are defined, IP routing will be automatically performed between these interfaces. \nTo execute this command, you must have VPN Server administrator privileges. \nAlso, this command does not operate on VPN Bridge. -CMD_RouterIfList_Args RouterIfList [name] -CMD_RouterIfList_[name] Use this to specify the name of the Virtual Layer 3 Switch. -CMD_RouterIfList_PROMPT_NAME Name of Virtual Layer 3 Switch: - - -# RouterIfAdd command -CMD_RouterIfAdd Add Virtual Interface to Virtual Layer 3 Switch -CMD_RouterIfAdd_Help Use this to add to a specified Virtual Layer 3 Switch, a virtual interface that connects to a Virtual Hub operating on the same VPN Server. \nYou can define multiple virtual interfaces and routing tables for a single Virtual Layer 3 Switch. \nA virtual interface is associated to a virtual Hub and operates as a single IP host on the Virtual Hub when that Virtual Hub is operating. When multiple virtual interfaces that respectively belong to a different IP network of a different Virtual Hub are defined, IP routing will be automatically performed between these interfaces. \nYou must define the IP network space that the virtual interface belongs to and the IP address of the interface itself. \nAlso, you must specify the name of the Virtual Hub that the interface will connect to. \nYou can specify a Virtual Hub that currently doesn't exist for the Virtual Hub name. \nThe virtual interface must have one IP address in the Virtual Hub. You also must specify the subnet mask of an IP network that the IP address belongs to. \nRouting via the Virtual Layer 3 Switches of IP spaces of multiple virtual Hubs operates based on the IP address is specified here. \nTo execute this command, you must have VPN Server administrator privileges. \nAlso, this command does not operate on VPN Bridge. \nTo execute this command, the target Virtual Layer 3 Switch must be stopped. If it is not stopped, first use the RouterStop command to stop it and then execute this command. -CMD_RouterIfAdd_Args RouterIfAdd [name] [/HUB:hub] [/IP:ip/mask] -CMD_RouterIfAdd_[name] Use this to specify the name of the Virtual Layer 3 Switch. -CMD_RouterIfAdd_HUB Use this to specify the name of the Virtual Hub to be the connection destination of the virtual interface to be newly added. To get a list of Virtual Hubs, you can use the HubList command. It is not essential that you specify a Virtual Hub that is currently operating. If you specify a Virtual Hub name that is not currently operating or that does not exist, the Virtual Layer 3 Switch will become enabled when the actual operation of that Virtual Hub begins. -CMD_RouterIfAdd_IP Using the format: "IP address/subnet mask", specify the IP address and subnet mask held by the virtual interface to be newly added. Specify the IP address by separating the decimal values using dots such as 192.168.0.1 For the subnet mask, either specify decimal values separated by dots such as 255.255.255.0, or you can specify the bit length from the header using a decimal value such as 24. -CMD_RouterIfAdd_PROMPT_NAME Name of Virtual Layer 3 Switch: -CMD_RouterIfAdd_PROMPT_HUB Destination Virtual Hub Name of Virtual Interface: -CMD_RouterIfAdd_PROMPT_IP IP Address/Subnet Mask: - - -# RouterIfDel command -CMD_RouterIfDel Delete Virtual Interface of Virtual Layer 3 Switch -CMD_RouterIfDel_Help Use this to delete a virtual interface already defined in the specified Virtual Layer 3 Switch. \nYou can get a list of the virtual interfaces currently defined, by using the RouterIfList command. \nTo execute this command, you must have VPN Server administrator privileges. \nAlso, this command does not operate on VPN Bridge. \nTo execute this command, the target Virtual Layer 3 Switch must be stopped. If it is not stopped, first use the RouterStop command to stop it and then execute this command. -CMD_RouterIfDel_Args RouterIfDel [name] [/HUB:hub] -CMD_RouterIfDel_[name] Use this to specify the name of the Virtual Layer 3 Switch. -CMD_RouterIfDel_HUB Use this to specify the name of the Virtual Hub to be the connection destination of the virtual interface to be deleted. - - -# RouterTableList command -CMD_RouterTableList Get List of Routing Tables of Virtual Layer 3 Switch -CMD_RouterTableList_Help Use this to get a list of routing tables when routing tables have been defined on a specified Virtual Layer 3 Switch. \nIf the destination IP address of the IP packet does not belong to any IP network that belongs to a virtual interface, the IP routing engine of the Virtual Layer 3 Switch will reference this routing table and execute routing. \nTo execute this command, you must have VPN Server administrator privileges. \nAlso, this command does not operate on VPN Bridge. -CMD_RouterTableList_Args RouterTableList [name] -CMD_RouterTableList_[name] Use this to specify the name of the Virtual Layer 3 Switch. -CMD_RouterTableList_PROMPT_NAME Name of Virtual Layer 3 Switch: - - -# RouterTableAdd command -CMD_RouterTableAdd Add Routing Table Entry for Virtual Layer 3 Switch -CMD_RouterTableAdd_Help Here you can add a new routing table entry to the routing table of the specified Virtual Layer 3 Switch. \nIf the destination IP address of the IP packet does not belong to any IP network that belongs to a virtual interface, the IP routing engine of the Virtual Layer 3 Switch will reference the routing table and execute routing. \nYou must specify the contents of the routing table entry to be added to the Virtual Layer 3 Switch. You must specify any IP address that belongs to the same IP network in the virtual interface of this Virtual Layer 3 Switch as the gateway address. \nTo execute this command, you must have VPN Server administrator privileges. \nAlso, this command does not operate on VPN Bridge. \nTo execute this command, the target Virtual Layer 3 Switch must be stopped. If it is not stopped, first use the RouterStop command to stop it and then execute this command. -CMD_RouterTableAdd_Args RouterTableAdd [name] [/NETWORK:ip/mask] [/GATEWAY:gwip] [/METRIC:metric] -CMD_RouterTableAdd_[name] Use this to specify the name of the Virtual Layer 3 Switch. -CMD_RouterTableAdd_NETWORK Using the format: "IP address/subnet mask", specify the network address and subnet mask of the routing table entry to be newly added. Specify the network address by separating the decimal values using dots such as "192.168.0.1". For the subnet mask, either specify decimal values separated by dots such as 255.255.255.0, or you can specify the bit length from the header using a decimal value such as 24. If you specify 0.0.0.0/0.0.0.0, the default route will be used. -CMD_RouterTableAdd_GATEWAY Specify the gateway IP address. -CMD_RouterTableAdd_METRIC Specify a metric value. Specify an integer (1 or higher). -CMD_RouterTableAdd_PROMPT_NAME Name of Virtual Layer 3 Switch: -CMD_RouterTableAdd_PROMPT_NETWORK Network Address/Subnet Mask: -CMD_RouterTableAdd_PROMPT_GATEWAY Gateway Address: -CMD_RouterTableAdd_PROMPT_METRIC Metric Value: - - -# RouterTableDel command -CMD_RouterTableDel Delete Routing Table Entry of Virtual Layer 3 Switch -CMD_RouterTableDel_Help Use this to delete a routing table entry that is defined in the specified Virtual Layer 3 Switch. \nYou can get a list of the already defined routing table entries by using the RouterTableList command. \nTo execute this command, you must have VPN Server administrator privileges. \nAlso, this command does not operate on VPN Bridge. \nTo execute this command, the target Virtual Layer 3 Switch must be stopped. If it is not stopped, first use the RouterStop command to stop it and then execute this command. -CMD_RouterTableDel_Args RouterTableDel [name] [/NETWORK:ip/mask] [/GATEWAY:gwip] [/METRIC:metric] -CMD_RouterTableDel_[name] Use this to specify the name of the Virtual Layer 3 Switch. -CMD_RouterTableDel_NETWORK Using the format: "IP address/subnet mask", specify the network address of the routing table entry to be deleted. -CMD_RouterTableDel_GATEWAY Specify the gateway IP address. -CMD_RouterTableDel_METRIC Specify a metric value. Specify an integer (1 or higher). - - -# LogFileList command -CMD_LogFileList Get List of Log Files -CMD_LogFileList_Help Use this to display a list of log files outputted by the VPN Server that have been saved on the VPN Server computer. By specifying a log file file name displayed here and calling it using the LogFileGet command you can download the contents of the log file. \nIf you are connected to the VPN Server in server admin mode, you can display or download the packet logs and security logs of all Virtual Hubs and the server log of the VPN Server. \nWhen connected in Virtual Hub Admin Mode, you are able to view or download only the packet log and security log of the Virtual Hub that is the target of management. -CMD_LogFileList_Args LogFileList -CMD_LogFileList_START Getting list of log files. This may take a while. Please wait... -CMD_LogFileList_NUM_LOGS In total there are %u log files. - - -# LogFileGet command -CMD_LogFileGet Download Log file -CMD_LogFileGet_Help Use this to download the log file that is saved on the VPN Server computer. To download the log file first display the list of log files using the LogFileList command and then download the log file using the LogFileGet command. If you are connected to the VPN Server in server admin mode, you can display or download the packet logs and security logs of all Virtual Hubs and the server log of the VPN Server. When connected in Virtual Hub Admin Mode, you are able to view or download only the packet log and security log of the Virtual Hub that is the target of management. \nIf you have specified the file name as a parameter, the downloaded log file will be saved to the file of that file name. If the destination file is not specified, the log file will be displayed onscreen. \nThe size of the log file can get very big, so pay careful attention to this issue. -CMD_LogFileGet_Args LogFileGet [name] [/SERVER:server] [/SAVEPATH:savepath] -CMD_LogFileGet_[name] Specify the name of the log file to be downloaded. To get a list of downloadable log files, use the LogFileList command. -CMD_LogFileGet_SERVER Use this to specify the server name when making a download request to a cluster controller. Specify the server that will be displayed by the LogFileGet command. -CMD_LogFileGet_SAVEPATH Use this to specify the destination file name for when saving the downloaded log file. When this is left unspecified, the file will be displayed onscreen. -CMD_LogFileGet_PROMPT_NAME Name of log file to download: -CMD_LogFileGet_START Downloading log file. This may take a while. Please wait... -CMD_LogFileGet_FAILED The download failed. -CMD_LogFileGet_SAVE_FAILED Unable to write to the specified file. -CMD_LogFileGet_FILESIZE File size of log file: %u - - -# HubCreate command -CMD_HubCreate Create New Virtual Hub -CMD_HubCreate_Help Use this to create a new Virtual Hub on the VPN Server. \nThe created Virtual Hub will begin operation immediately. \nWhen the VPN Server is operating on a cluster, this command is only valid for the cluster controller. Also, the new Virtual Hub will operate as a dynamic Virtual Hub. You can change it to a static Virtual Hub by using the HubSetStatic command. To get a list of Virtual Hubs that are already on the VPN Server, use the HubList command. \nTo execute this command, you must have VPN Server administrator privileges. \nAlso, this command does not operate on VPN Servers that are operating as a VPN Bridge or cluster member. \nWhen issuing the command to a cluster controller on a cluster to create a Virtual Hub, use either the HubCreateStatic command or the HubCreateDynamic command (issuing the HubCreate command to a cluster controller has the same operational effect as issuing the HubCreateDynamic command). -CMD_HubCreate_Args HubCreate [name] [/PASSWORD:password] -CMD_HubCreate_[name] Specify the name of the Virtual Hub to create. -CMD_HubCreate_PASSWORD Specify an administrator password when the administrator password is going to be set for the Virtual Hub to be created. If this is not specified, a prompt will appear to input the password. -CMD_HubCreate_PROMPT_NAME Name of Virtual Hub to be created: - - -# HubCreateDynamic command -CMD_HubCreateDynamic Create New Dynamic Virtual Hub (For Clustering) -CMD_HubCreateDynamic_Help Use this to create a new dynamic Virtual Hub on the VPN Server. \nThe created Virtual Hub will begin operation immediately. \nWhen the VPN Server is operating on a cluster, this command is only valid for the cluster controller. Also, the new Virtual Hub will operate as a dynamic Virtual Hub. You can change it to a static Virtual Hub by using the HubSetStatic command. To get a list of Virtual Hubs that are already on the VPN Server, use the HubList command. \nTo execute this command, you must have VPN Server administrator privileges. \nAlso, this command does not operate on VPN Servers that are operating as a VPN Bridge, cluster member or standalone server. -CMD_HubCreateDynamic_Args HubCreateDynamic [name] [/PASSWORD:password] -CMD_HubCreateDynamic_[name] Specify the name of the Virtual Hub to create. -CMD_HubCreateDynamic_PASSWORD Specify an administrator password when the administrator password is going to be set for the Virtual Hub to be created. If this is not specified, a prompt will appear to input the password. - - -# HubCreateStatic command -CMD_HubCreateStatic Create New Static Virtual Hub (For Clustering) -CMD_HubCreateStatic_Help Use this to create a new static Virtual Hub on the VPN Server. \nThe created Virtual Hub will begin operation immediately. \nWhen the VPN Server is operating on a cluster, this command is only valid for the cluster controller. Also, the new Virtual Hub will operate as a dynamic Virtual Hub. You can change it to a static Virtual Hub by using the HubSetStatic command. To get a list of Virtual Hubs that are already on the VPN Server, use the HubList command. \nTo execute this command, you must have VPN Server administrator privileges. \nAlso, this command does not operate on VPN Servers that are operating as a VPN Bridge, cluster member or standalone server. -CMD_HubCreateStatic_Args HubCreateStatic [name] [/PASSWORD:password] -CMD_HubCreateStatic_[name] Specify the name of the Virtual Hub to create. -CMD_HubCreateStatic_PASSWORD Specify an administrator password when the administrator password is going to be set for the Virtual Hub to be created. If this is not specified, a prompt will appear to input the password. - - -# HubDelete command -CMD_HubDelete Delete Virtual Hub -CMD_HubDelete_Help Use this to delete an existing Virtual Hub on the VPN Server. \nIf you delete the Virtual Hub, all sessions that are currently connected to the Virtual Hub will be disconnected and new sessions will be unable to connect to the Virtual Hub. \nAlso, this will also delete all the Hub settings, user objects, group objects, certificates and Cascade Connections. \nOnce you delete the Virtual Hub, it cannot be recovered. \nTo execute this command, you must have VPN Server administrator privileges. \nAlso, this command does not operate on VPN Servers that are operating as a VPN Bridge or cluster member. -CMD_HubDelete_Args HubDelete [name] -CMD_HubDelete_[name] Specify the name of the Virtual Hub to delete. -CMD_HubDelete_PROMPT_NAME Name of Virtual Hub to delete: - - -# HubSetStatic command -CMD_HubSetStatic Change Virtual Hub Type to Static Virtual Hub -CMD_HubSetStatic_Help Use this when a VPN Server is operating on a cluster and you want to change the type of the Virtual Hub to a static Virtual Hub. When the type of the Virtual Hub is changed, all sessions that are currently connected to the Virtual Hub will be disconnected. \nWhen there is a Virtual Hub operating as a static virtual Hub, a Virtual Hub with that name will be created on all the cluster member servers. A user who attempts to connect this Virtual Hub will be connected to one of the cluster members hosting this Virtual Hub as determined by an algorithm based on each server's load status. \nA static Virtual Hub, for example, could be used for a remote access VPN that allows thousands or tens of thousands of users to connect at the same time for the purpose of remotely accessing an internal company LAN from the Internet for business. \nTo execute this command, you must have VPN Server administrator privileges. \nAlso, this command does not operate on VPN Servers that are operating as a VPN Bridge, cluster member or standalone server. \nThis command cannot be used for VPN Servers that are newer than Build 5190. -CMD_HubSetStatic_Args HubSetStatic [name] -CMD_HubSetStatic_[name] Specify the name of the Virtual Hub to be set as the static Virtual Hub. -CMD_HubChange_PROMPT_NAME Name of Virtual Hub to change setting: - - -# HubSetDynamic command -CMD_HubSetDynamic Change Virtual Hub Type to Dynamic Virtual Hub -CMD_HubSetDynamic_Help Use this when a VPN Server is operating on a cluster and you want to change the type of the Virtual Hub to a dynamic Virtual Hub. When the type of the Virtual Hub is changed, all sessions that are currently connected to the Virtual Hub will be disconnected. \nWhen there is not even one client connected to a dynamic Virtual Hub defined on the cluster, then that Virtual Hub does not exist on any cluster member. When the first client to attempt to connect to the dynamic Virtual Hub does so, the server with the lowest load on the cluster starts hosting that Virtual Hub. When the second and subsequent clients attempt to connect to the same virtual Hub, they are automatically connected to the server hosting the Virtual Hub. When all the clients are disconnected from a particular dynamic Virtual Hub, the Virtual Hub will return to the original state of not existing on any of the servers. \nThere is a broad range of applications for dynamic Virtual Hubs, such as a Virtual Hub defined for each business section within a company so that employees can connect to the Virtual Hub of their own department to do their work in a centralized management environment that is deployed on a single cluster. \nTo execute this command, you must have VPN Server administrator privileges. \nAlso, this command does not operate on VPN Servers that are operating as a VPN Bridge, cluster member or standalone server. \nThis command cannot be used for VPN Servers that are newer than Build 5190. -CMD_HubSetDynamic_Args HubSetDynamic [name] -CMD_HubSetDynamic_[name] Specify the name of the Virtual Hub to be set as the dynamic Virtual Hub. - - -# HubList command -CMD_HubList Get List of Virtual Hubs -CMD_HubList_Help Use this to get a list of existing Virtual Hubs on the VPN Server. For each Virtual Hub, you can get the following information: Virtual Hub Name, Status, Type, Number of Users, Number of Groups, Number of Sessions, Number of MAC Tables, Number of IP Tables, Number of Logins, Last Login, and Last Communication.\nNote that when connecting in Virtual Hub Admin Mode, if in the options of a Virtual Hub that you do not have administrator privileges for, the option Don't Enumerate this Virtual Hub for Anonymous Users is enabled then that Virtual Hub will not be enumerated. If you are connected in Server Admin Mode, then the list of all Virtual Hubs will be displayed. \nWhen connecting to and managing a non-cluster-controller cluster member of a clustering environment, only the Virtual Hub currently being hosted by that VPN Server will be displayed. When connecting to a cluster controller for administration purposes, all the Virtual Hubs will be displayed. -CMD_HubList_Args HubList - - -# Hub command -CMD_Hub Select Virtual Hub to Manage -CMD_Hub_Help Use this to select the Virtual Hub to be the target of administration. For an administration utility with the status of being connected to a VPN Server, before executing a command to set or manage a Virtual Hub, you must use the Hub command to select the Virtual Hub to manage. \nWhen in the status of being connected to a VPN Server in Virtual Hub Admin Mode, you can select a single Virtual Hub to be the target of administration but you cannot select other Virtual Hubs. When having the status of being connected to the VPN Server in Server Admin Mode, you can make all Virtual Hubs the target of administration. \nTo get a list of Virtual Hubs that currently exist on the VPN Server, use the HubList command. \nFor the VPN Bridge, you can only select the Virtual Hub that has the name "BRIDGE". -CMD_Hub_Args Hub [name] -CMD_Hub_[name] Specify the name of the Virtual Hub to manage. If this parameter is left unspecified, the Select Virtual Hub to Manage will be cancelled. -CMD_Hub_Unselected The Virtual Hub selection has been unselected. -CMD_Hub_Selected The Virtual Hub "%S" has been selected. -CMD_Hub_Select_Failed When attempting to select Virtual Hub "%S" that has been specified by /ADMINHUB, the following error occurred. -CMD_Hub_Not_Selected Before executing this command, first select the Virtual Hub to manage using the Hub command. - - -# Online command -CMD_Online Switch Virtual Hub to Online -CMD_Online_Help Use this when the Virtual Hub currently being managed is offline to switch it to online. A Virtual Hub with an offline status cannot receive VPN connections from clients. By switching the Virtual Hub to online, that Virtual Hub becomes able to receive connections from users and provide services. \nThis command cannot be run on VPN Bridge. \nYou cannot execute this command for Virtual Hubs of VPN Servers operating as a cluster. -CMD_Online_Args Online - - -# Offline command -CMD_Offline Switch Virtual Hub to Offline -CMD_Offline_Help Use this when the Virtual Hub currently being managed is online to switch it to offline. If there are sessions currently connected to the Virtual Hub, all sessions will be disconnected. A Virtual Hub with an offline status cannot receive VPN connections from clients. \nThis command cannot be run on VPN Bridge. \nYou cannot execute this command for Virtual Hubs of VPN Servers operating as a cluster. -CMD_Offline_Args Offline - - -# SetMaxSession command -CMD_SetMaxSession Set the Max Number of Concurrently Connected Sessions for Virtual Hub -CMD_SetMaxSession_Help Use this to set the maximum number of sessions that can be concurrently connected to the Virtual Hub that is currently being managed. When there are more sessions than the maximum number of concurrently connected sessions that are being connected from the VPN Client or VPN Bridge, when the maximum number of sessions is reached, clients will no longer be able to connect. This limit on the maximum number of concurrently connected sessions does not include sessions generated in the Virtual Hub by Local Bridges, Virtual NAT, and Cascade Connections. \nYou can get the current setting for the max number of concurrently connected sessions by using the OptionsGet command. \nThis command cannot be run on VPN Bridge. \nYou cannot execute this command for Virtual Hubs of VPN Servers operating as a cluster. -CMD_SetMaxSession_Args SetMaxSession [max_session] -CMD_SetMaxSession_[max_session] Using an integer, specify the maximum number of concurrently connected sessions to set. Specifying 0 results in a setting of unlimited. -CMD_SetMaxSession_Prompt Max Number of Sessions: - - -# SetHubPassword command -CMD_SetHubPassword Set Virtual Hub Administrator Password -CMD_SetHubPassword_Help Use this to set the Administrator Password for the Virtual Hub that is currently being managed. When a Virtual Hub administrator password has been set, you are able to connect to that Virtual Hub from a VPN Server connection utility in Virtual Hub Admin Mode, by specifying the password. It is also possible to make a VPN connection from a VPN client or VPN Bridge by specifying "Administrator" for the user name and the password for the Virtual Hub administrator password. \nThis command cannot be run on VPN Bridge. \nYou cannot execute this command for Virtual Hubs of VPN Servers operating as a cluster. -CMD_SetHubPassword_Args SetHubPassword [password] -CMD_SetHubPassword_[password] Specify the password you wish to set. If a password is not specified by parameter, a prompt will appear to input the password. - - -# SetEnumAllow command -CMD_SetEnumAllow Allow Enumeration by Virtual Hub Anonymous Users -CMD_SetEnumAllow_Help Use this to change the options setting of the Virtual Hub you are currently managing to allow anonymous users to enumerate this Virtual Hub. By setting this option, it makes it possible for VPN Client users to enumerate this Virtual Hub simply by inputting this VPN Server address. Also, by using the SetEnumDeny command, you can deny anonymous users the ability to enumerate. At the time a Virtual Hub is created, enumeration will be allowed. \nThis command cannot be run on VPN Bridge. \nYou cannot execute this command for Virtual Hubs of VPN Servers operating as a cluster. -CMD_SetEnumAllow_Args SetEnumAllow - - -# SetEnumDeny command -CMD_SetEnumDeny Deny Enumeration by Virtual Hub Anonymous Users -CMD_SetEnumDeny_Help Use this to change the options setting of the Virtual Hub you are currently managing to prevent anonymous users from enumerating this Virtual Hub. By setting this option, the VPN Client user will be unable to enumerate this Virtual Hub even if they send a Virtual Hub enumeration request to the VPN Server. Also, by using the SetEnumAllow command, you can allow anonymous users to enumerate. \nThis command cannot be run on VPN Bridge. \nYou cannot execute this command for Virtual Hubs of VPN Servers operating as a cluster. -CMD_SetEnumDeny_Args SetEnumDeny - - -# OptionsGet command -CMD_OptionsGet Get Options Setting of Virtual Hubs -CMD_OptionsGet_Help Use this to get a list of the Options setting of the Virtual Hub currently being managed. You can get the following: Allow/Deny Virtual Hub Enumeration, Maximum Concurrent Connections, Online/Offline Status, and Virtual Hub Type in Clustering Environment. \nYou cannot execute this command for Virtual Hubs of VPN Servers operating as a cluster. -CMD_OptionsGet_Args OptionsGet -CMD_OptionsGet_TITLE Options Setting List of Virtual Hub "%S" -CMD_OptionsGet_ENUM Enumeration of Virtual Hub for Anonymous User -CMD_OptionsGet_MAXSESSIONS Max Number of Sessions -CMD_OptionsGet_STATUS Status -CMD_OptionsGet_TYPE Virtual Hub Type - - - -# RadiusServerSet command -CMD_RadiusServerSet Set RADIUS Server to use for User Authentication -CMD_RadiusServerSet_Help To accept users to the currently managed Virtual Hub in RADIUS server authentication mode, you can specify an external RADIUS server that confirms the user name and password. (You can specify multiple hostname by splitting with comma or semicolon.) \nThe RADIUS server must be set to receive requests from IP addresses of this VPN Server. Also, authentication by Password Authentication Protocol (PAP) must be enabled. \nThis command cannot be run on VPN Bridge. \nYou cannot execute this command for Virtual Hubs of VPN Servers operating as a cluster. -CMD_RadiusServerSet_Args RadiusServerSet [server_name:port] [/SECRET:secret] [/RETRY_INTERVAL:interval] -CMD_RadiusServerSet_[server_name:port] Using the format "host name:port number", specify the host name or IP address, and the UDP port number of the RADIUS server being used. If the port number is omitted, 1812 will be used. You can specify multiple hostname by splitting with comma or semicolon. -CMD_RadiusServerSet_SECRET Specify the shared secret (password) used for communication with the RADIUS Server -CMD_RadiusServerSet_RETRY_INTERVAL Specify the retry interval between retries in milliseconds. -CMD_RadiusServerSet_Prompt_Host Host Number and Port Number of RADIUS Server to Use: -CMD_RadiusServerSet_Prompt_Secret Shared Secret: -CMD_RadiusServerSet_Prompt_RetryInterval Retry Interval (milliseconds): -CMD_RadiusServerSet_EVAL_NUMINTERVAL The retry interval must be in from 500 to 10000 milliseconds. - - -# RadiusServerDelete command -CMD_RadiusServerDelete Delete Setting to Use RADIUS Server for User Authentication -CMD_RadiusServerDelete_Help Use this to delete the setting related to using a RADIUS server when a user connects to the currently managed Virtual Hub in RADIUS Server Authentication Mode and disable the RADIUS authentication. To get the settings related to the current RADIUS server use the RadiusServerGet command. \nThis command cannot be run on VPN Bridge. \nYou cannot execute this command for Virtual Hubs of VPN Servers operating as a cluster. -CMD_RadiusServerDelete_Args RadiusServerDelete - - -# RadiusServerGet command -CMD_RadiusServerGet Get Setting of RADIUS Server Used for User Authentication -CMD_RadiusServerGet_Help Use this to get the current settings for the RADIUS server used when a user connects to the currently managed Virtual Hub using RADIUS Server Authentication Mode. \nThis command cannot be run on VPN Bridge. \nYou cannot execute this command for Virtual Hubs of VPN Servers operating as a cluster. -CMD_RadiusServerGet_Args RadiusServerGet -CMD_RadiusServerGet_STATUS Use RADIUS Server -CMD_RadiusServerGet_HOST RADIUS Server Host Name or IP Address: -CMD_RadiusServerGet_PORT RADIUS Server Port Number -CMD_RadiusServerGet_SECRET Shared Secret -CMD_RadiusServerGet_RetryInterval Retry Interval (in milliseconds) - - -# StatusGet command -CMD_StatusGet Get Current Status of Virtual Hub -CMD_StatusGet_Help Use this to get the current status of the Virtual Hub currently being managed. You can get the following information: Virtual Hub Type, Number of Sessions, Number of Each Type of Object, Number of Logins, Last Login, Last Communication, and Communication Statistical Data. -CMD_StatusGet_Args StatusGet - - -# LogGet command -CMD_LogGet Get Log Save Setting of Virtual Hub -CMD_LogGet_Help Use this to get the log save setting for the Virtual Hub that is currently being managed. You can get the setting information such as the save setting related to security logs and packet logs and information on what has been saved. -CMD_LogGet_Args LogGet -CMD_Log_SecurityLog Save Security Log -CMD_Log_PacketLog Save Packet Log -CMD_Log_SwitchType Log File Switch Cycle -CMD_Log_0 TCP Connection Log -CMD_Log_1 TCP Packet Log -CMD_Log_2 DHCP Log -CMD_Log_3 UDP Log -CMD_Log_4 ICMP Log -CMD_Log_5 IP Log -CMD_Log_6 ARP Log -CMD_Log_7 Ethernet Log - - -# LogEnable command -CMD_LogEnable Enable Security Log or Packet Log -CMD_LogEnable_Help Use this to enable a security log or packet log of the Virtual Hub currently being managed. \nTo get the current setting, you can use the LogGet command. -CMD_LogEnable_Args LogEnable [security|packet] -CMD_LogEnable_[security|packet] Select the type of log to enable. Specify either "security" or "packet". -CMD_LogEnable_Prompt Select Security or Packet: -CMD_LogEnable_Prompt_Error Invalid specification. - - -# LogDisable command -CMD_LogDisable Disable Security Log or Packet Log -CMD_LogDisable_Help Use this to disable a security log or packet log of the Virtual Hub currently being managed. \nTo get the current setting, you can use the LogGet command. -CMD_LogDisable_Args LogDisable [security|packet] -CMD_LogDisable_[security|packet] Select the type of log to disable. Specify either "security" or "packet". - - -# LogSwitchSet command -CMD_LogSwitchSet Set Log File Switch Cycle -CMD_LogSwitchSet_Help Use this to set the log file switch cycle for the security log or packet log that the currently managed Virtual Hub saves. The log file switch cycle can be changed to switch in every second, every minute, every hour, every day, every month ,or not switch. \nTo get the current setting, you can use the LogGet command. -CMD_LogSwitchSet_Args LogSwitchSet [security|packet] [/SWITCH:sec|min|hour|day|month|none] -CMD_LogSwitchSet_[security|packet] Select the type of log to change setting. Specify either "security" or "packet". -CMD_LogSwitchSet_SWITCH Select the switch cycle to set. Specify sec, min, hour, day, month or none. -CMD_LogSwitchSet_Prompt Specify sec, min, hour, day, month or none: - - -# LogPacketSaveType command -CMD_LogPacketSaveType Set Save Contents and Type of Packet to Save to Packet Log -CMD_LogPacketSaveType_Help Use this to set the save contents of the packet log for each type of packet to be saved by the currently managed Virtual Hub. There are the following packet types: TCP Connection Log, TCP Packet Log, DHCP Packet Log, UDP Packet Log, ICMP Packet Log, IP Packet Log, ARP Packet Log, and Ethernet Packet Log.\nTo get the current setting, you can use the LogGet command. -CMD_LogPacketSaveType_Args LogPacketSaveType [/TYPE:tcpconn|tcpdata|dhcp|udp|icmp|ip|arp|ether] [/SAVE:none|header|full] -CMD_LogPacketSaveType_TYPE Specify tcpconn, tcpdata, dhcp, udp, icmp, ip, arp, or ether to specify the type of packet whose save contents are going to be changed. -CMD_LogPacketSaveType_SAVE Specify the save contents of the packet log. \nSpecify either none: save nothing\nheader: header information only\nfull: all packet contents -CMD_LogPacketSaveType_Prompt_TYPE Specify tcpconn, tcpdata, dhcp, udp, icmp, ip, arp, or ether: -CMD_LogPacketSaveType_Prompt_SAVE Specify none, header, or full: - - -# CAList command -CMD_CAList Get List of Trusted CA Certificates -CMD_CAList_Help Here you can manage the certificate authority certificates that are trusted by this currently managed Virtual Hub. The list of certificate authority certificates that are registered is used to verify certificates when a VPN Client is connected in signed certificate authentication mode. \nThis command cannot be run on VPN Bridge. \nYou cannot execute this command for Virtual Hubs of VPN Servers operating as a member server on a cluster. -CMD_CAList_Args CAList -CMD_CAList_COLUMN_ID ID - - -# CAAdd command -CMD_CAAdd Add Trusted CA Certificate -CMD_CAAdd_Help Use this to add a new certificate to a list of CA certificates trusted by the currently managed Virtual Hub. The list of certificate authority certificates that are registered is used to verify certificates when a VPN Client is connected in signed certificate authentication mode. \nTo get a list of the current certificates you can use the CAList command. \nThe certificate you add must be saved in the X.509 file format. \nThis command cannot be run on VPN Bridge. \nYou cannot execute this command for Virtual Hubs of VPN Servers operating as a member server on a cluster. -CMD_CAAdd_Args CAAdd [path] -CMD_CAAdd_[path] Specify the file name of the X.509 certificate to register. -CMD_CAAdd_PROMPT_PATH Name of X.509 Certificate File to Register: - - -# CADelete command -CMD_CADelete Delete Trusted CA Certificate -CMD_CADelete_Help Use this to delete an existing certificate from the list of CA certificates trusted by the currently managed Virtual Hub. \nTo get a list of the current certificates you can use the CAList command. \nThis command cannot be run on VPN Bridge. \nYou cannot execute this command for Virtual Hubs of VPN Servers operating as a member server on a cluster. -CMD_CADelete_Args CADelete [id] -CMD_CADelete_[id] Specify the ID of the certificate to delete. -CMD_CADelete_PROMPT_ID ID of Certificate to Delete: - - -# CAGet command -CMD_CAGet Get Trusted CA Certificate -CMD_CAGet_Help Use this to get an existing certificate from the list of CA certificates trusted by the currently managed Virtual Hub and save it as a file in X.509 format. \nThis command cannot be run on VPN Bridge. \nYou cannot execute this command for Virtual Hubs of VPN Servers operating as a member server on a cluster. -CMD_CAGet_Args CAGet [id] [/SAVECERT:path] -CMD_CAGet_[id] Specify the ID of the certificate to get. -CMD_CAGet_SAVECERT Specify the file name to save the certificate you obtained. -CMD_CAGet_PROMPT_ID ID of Certificate to Get: -CMD_CAGet_PROMPT_SAVECERT Name of File to Save: - - -# CascadeList command -CMD_CascadeList Get List of Cascade Connections -CMD_CascadeList_Help Use this to get a list of Cascade Connections that are registered on the currently managed Virtual Hub. \nBy using a Cascade Connection, you can connect this Virtual Hub by Layer 2 Cascade Connection to another Virtual Hub that is operating on the same or a different computer. \n\n[Warning About Cascade Connections]\nBy connecting using a Cascade Connection you can create a Layer 2 bridge between multiple Virtual Hubs but if the connection is incorrectly configured, a loopback Cascade Connection could inadvertently be created. When using a Cascade Connection function please design the network topology with care. \nYou cannot execute this command for Virtual Hubs of VPN Servers operating as a cluster. -CMD_CascadeList_Args CascadeList - - -# CascadeCreate command -CMD_CascadeCreate Create New Cascade Connection -CMD_CascadeCreate_Help Use this to create a new Cascade Connection on the currently managed Virtual Hub. \nBy using a Cascade Connection, you can connect this Virtual Hub by Cascade Connection to another Virtual Hub that is operating on the same or a different computer. \nTo create a Cascade Connection, you must specify the name of the Cascade Connection, destination server and destination Virtual Hub and user name. When a new Cascade Connection is created, the type of user authentication is initially set as Anonymous Authentication and the proxy server setting and the verification options of the server certificate is not set. To change these settings and other advanced settings after a Cascade Connection has been created, use the other commands that begin with the name "Cascade". \n\n[Warning About Cascade Connections]\nBy connecting using a Cascade Connection you can create a Layer 2 bridge between multiple Virtual Hubs but if the connection is incorrectly configured, a loopback Cascade Connection could inadvertently be created. When using a Cascade Connection function please design the network topology with care. \n\nYou cannot execute this command for Virtual Hubs of VPN Servers operating as a cluster. -CMD_CascadeCreate_Args CascadeCreate [name] [/SERVER:hostname:port] [/HUB:hubname] [/USERNAME:username] -CMD_CascadeCreate_[name] Specify the name of the Cascade Connection to create. -CMD_CascadeCreate_SERVER Specify the host name and port number of the destination VPN Server using the format [host name:port number]. You can also specify by IP address. -CMD_CascadeCreate_HUB Specify the Virtual Hub on the destination VPN Server. -CMD_CascadeCreate_USERNAME Specify the user name to use for user authentication when connecting to the destination VPN Server. -CMD_CascadeCreate_Prompt_Name Cascade Connection Name: -CMD_CascadeCreate_Prompt_Server Destination VPN Server Host Name and Port Number: -CMD_CascadeCreate_Prompt_Hub Destination Virtual Hub Name: -CMD_CascadeCreate_Prompt_Username Connecting User Name: - - -# CascadeSet command -CMD_CascadeSet Set the Destination for Cascade Connection -CMD_CascadeSet_Help Use this to set the destination VPN Server host name and port number, Virtual Hub name and the user name that will use the connection for the Cascade Connection registered on the currently managed virtual Hub. \nYou cannot execute this command for Virtual Hubs of VPN Servers operating as a cluster. -CMD_CascadeSet_Args CascadeSet [name] [/SERVER:hostname:port] [/HUB:hubname] -CMD_CascadeSet_[name] Specify the name of the Cascade Connection whose setting you want to change. -CMD_CascadeSet_SERVER Specify the host name and port number of the destination VPN Server using the format [host name:port number]. You can also specify by IP address. -CMD_CascadeSet_HUB Specify the Virtual Hub on the destination VPN Server. - - -# CascadeGet command -CMD_CascadeGet Get the Cascade Connection Setting -CMD_CascadeGet_Help Use this to get the Connection Setting of a Cascade Connection that is registered on the currently managed Virtual Hub. \nTo change the Connection Setting contents of the Cascade Connection, use the other commands that begin with the name "Cascade" after creating the Cascade Connection. \nYou cannot execute this command for Virtual Hubs of VPN Servers operating as a cluster. -CMD_CascadeGet_Args CascadeGet [name] -CMD_CascadeGet_[name] Specify the name of the Cascade Connection whose setting you want to get. -CMD_CascadeGet_Policy [Cascade Session Security Policy Setting Value] - -# CascadeDelete command -CMD_CascadeDelete Delete Cascade Connection Setting -CMD_CascadeDelete_Help Use this to delete a Cascade Connection that is registered on the currently managed Virtual Hub. If the specified Cascade Connection has a status of online, the connections will be automatically disconnected and then the Cascade Connection will be deleted. \nYou cannot execute this command for Virtual Hubs of VPN Servers operating as a cluster. -CMD_CascadeDelete_Args CascadeDelete [name] -CMD_CascadeDelete_[name] Specify the name of the Cascade Connection to delete. - - -# CascadeUsernameSet command -CMD_CascadeUsernameSet Set User Name to Use Connection of Cascade Connection -CMD_CascadeUsernameSet_Help When a Cascade Connection registered on the currently managed Virtual Hub is specified and that Cascade Connection connects to the VPN Server, use this to specify the user name required for user authentication. \nIn some cases it is necessary to specify the type of user authentication and specify the required parameters. To change this information you can use commands such as CascadeAnonymousSet, CascadePasswordSet, and CascadeCertSet. \nYou cannot execute this command for Virtual Hubs of VPN Servers operating as a cluster. -CMD_CascadeUsernameSet_Args CascadeUsernameSet [name] [/USERNAME:username] -CMD_CascadeUsernameSet_[name] Specify the name of the Cascade Connection whose setting you want to change. -CMD_CascadeUsernameSet_USERNAME Specify the user name required for user authentication when the Cascade Connection connects to the VPN Server. -CMD_CascadeUsername_Notice The auth type for this Connection Setting is currently set as password authentication. After changing the user name, you must use the CascadePasswordSet command to reset the password. - - -# CascadeAnonymousSet command -CMD_CascadeAnonymousSet Set User Authentication Type of Cascade Connection to Anonymous Authentication -CMD_CascadeAnonymousSet_Help When a Cascade Connection registered on the currently managed Virtual Hub is specified and that Cascade Connection connects to the VPN Server, set the user authe type to [anonymous authentication]. \nYou cannot execute this command for Virtual Hubs of VPN Servers operating as a cluster. -CMD_CascadeAnonymousSet_Args CascadeAnonymousSet [name] -CMD_CascadeAnonymousSet_[name] Specify the name of the Cascade Connection whose setting you want to change. - - -# CascadePasswordSet command -CMD_CascadePasswordSet Set User Authentication Type of Cascade Connection to Password Authentication -CMD_CascadePasswordSet_Help When a Cascade Connection registered on the currently managed Virtual Hub is specified and that Cascade Connection connects to the VPN Server, use this to set the user auth type to Password Authentication. Specify Standard Password Authentication and RADIUS or NT Domain Authentication as the password authentication type. \nYou cannot execute this command for Virtual Hubs of VPN Servers operating as a cluster. -CMD_CascadePasswordSet_Args CascadePasswordSet [name] [/PASSWORD:password] [/TYPE:standard|radius] -CMD_CascadePasswordSet_[name] Specify the name of the Cascade Connection whose setting you want to change. -CMD_CascadePasswordSet_PASSWORD Specify the password to use for password authentication. If this is not specified, a prompt will appear to input the password. -CMD_CascadePasswordSet_TYPE Specify either "standard" (Standard Password Authentication) or "radius" (RADIUS or NT Domain Authentication) as the password authentication type. -CMD_CascadePasswordSet_Prompt_Type Specify standard or radius: -CMD_CascadePasswordSet_Type_Invalid The standard or radius specification is invalid. - - -# CascadeCertSet command -CMD_CascadeCertSet Set User Authentication Type of Cascade Connection to Client Certificate Authentication -CMD_CascadeCertSet_Help When a Cascade Connection registered on the currently managed Virtual Hub is specified and that Cascade Connection connects to the VPN Server, use this to set the user auth type to Client Certificate Authentication. For this certificate, you must specify a certificate file in the X.509 format and a private key file that is Base 64 encoded. \nYou cannot execute this command for Virtual Hubs of VPN Servers operating as a cluster. -CMD_CascadeCertSet_Args CascadeCertSet [name] [/LOADCERT:cert] [/LOADKEY:key] -CMD_CascadeCertSet_[name] Specify the name of the Cascade Connection whose setting you want to change. -CMD_CascadeCertSet_LOADCERT Specify the X.509 format certificate file to provide for certificate authentication. -CMD_CascadeCertSet_LOADKEY Specify the Base-64-encoded private key file name for the certificate. - - -# CascadeCertGet command -CMD_CascadeCertGet Get Client Certificate to Use for Cascade Connection -CMD_CascadeCertGet_Help When a Cascade Connection registered on the currently managed Virtual Hub is specified and that Cascade Connection uses client certificate authentication, use this to get the certificate that is provided as the client certificate and save the certificate file in X.509 format. \nYou cannot execute this command for Virtual Hubs of VPN Servers operating as a cluster. -CMD_CascadeCertGet_Args CascadeCertGet [name] [/SAVECERT:cert] -CMD_CascadeCertGet_[name] Specify the name of the Cascade Connection whose setting you want to get. -CMD_CascadeCertGet_SAVECERT Specify the file name to save the certificate you obtained in X.509 format. -CMD_CascadeCertSet_Not_Auth_Cert The specified Cascade Connection is not in client certificate authentication mode. -CMD_CascadeCertSet_Cert_Not_Exists The certificate is not stored in the Connection Setting of the specified Cascade Connection. - - -# CascadeEncryptEnable command -CMD_CascadeEncryptEnable Enable Encryption when Communicating by Cascade Connection -CMD_CascadeEncryptEnable_Help When a Cascade Connection registered on the currently managed Virtual Hub is specified and that Cascade Connection is used for communication between VPN Servers via a VPN connection, use this to set the communication contents between the VPN Servers to be encrypted by SSL. \nNormally communication between VPN Servers is encrypted by SSL to prevent eavesdropping of information and fraud. You can also disable encryption. When encryption is disabled, the communication throughput improves but the communication data flows over the network in plain text. \nYou cannot execute this command for Virtual Hubs of VPN Servers operating as a cluster. -CMD_CascadeEncryptEnable_Args CascadeEncryptEnable [name] -CMD_CascadeEncryptEnable_[name] Specify the name of the Cascade Connection whose setting you want to change. - - -# CascadeEncryptDisable command -CMD_CascadeEncryptDisable Disable Encryption when Communicating by Cascade Connection -CMD_CascadeEncryptDisable_Help When a Cascade Connection registered on the currently managed Virtual Hub is specified and that Cascade Connection is used for communication between VPN Servers via a VPN connection, use this to set the communication contents between the VPN Servers not to be encrypted. \nNormally communication between VPN Servers is encrypted by SSL to prevent eavesdropping of information and fraud. You can also disable encryption. When encryption is disabled, the communication throughput improves but the communication data flows over the network in plain text. \nYou cannot execute this command for Virtual Hubs of VPN Servers operating as a cluster. -CMD_CascadeEncryptDisable_Args CascadeEncryptDisable [name] -CMD_CascadeEncryptDisable_[name] Specify the name of the Cascade Connection whose setting you want to change. - - -# CascadeCompressEnable command -CMD_CascadeCompressEnable Enable Data Compression when Communicating by Cascade Connection -CMD_CascadeCompressEnable_Help When a Cascade Connection registered on the currently managed Virtual Hub is specified and that Cascade Connection is used for communication between VPN Servers via a VPN connection, use this to set the communication contents between the VPN Servers to be compressed. \nIt is possible to achieve a maximum of 80% compression. Compression however places higher loads on the CPU of both the client and server machines. When the line speed is about 10 Mbps or greater, compression can lower throughput, but sometimes it can have the opposite effect. \nYou cannot execute this command for Virtual Hubs of VPN Servers operating as a cluster. -CMD_CascadeCompressEnable_Args CascadeCompressEnable [name] -CMD_CascadeCompressEnable_[name] Specify the name of the Cascade Connection whose setting you want to change. - - -# CascadeCompressDisable command -CMD_CascadeCompressDisable Disable Data Compression when Communicating by Cascade Connection -CMD_CascadeCompressDisable_Help When a Cascade Connection registered on the currently managed Virtual Hub is specified and that Cascade Connection is used for communication between VPN Servers via a VPN connection, use this to set the communication contents between the VPN Servers to be not compressed. \nYou cannot execute this command for Virtual Hubs of VPN Servers operating as a cluster. -CMD_CascadeCompressDisable_Args CascadeCompressDisable [name] -CMD_CascadeCompressDisable_[name] Specify the name of the Cascade Connection whose setting you want to change. - - -# CascadeHttpHeader* commands -CMD_CascadeHttpHeader_Prompt_Name Value name (part before the colon): -CMD_CascadeHttpHeader_Prompt_Data Value data (part after the colon): - - -# CascadeHttpHeaderAdd command -CMD_CascadeHttpHeaderAdd Add a custom value in the HTTP header sent to the proxy server -CMD_CascadeHttpHeaderAdd_Help Use this to add a custom value in the HTTP header sent to the proxy server. A custom HTTP header can be used to bypass certain restrictions imposed on the network or to avoid speed limitations applied by the QoS. -CMD_CascadeHttpHeaderAdd_Args CascadeHttpHeaderAdd [name] [/NAME:name] [/DATA:data] -CMD_CascadeHttpHeaderAdd_[name] Specify the name of the Cascade Connection whose setting you want to change. -CMD_CascadeHttpHeaderAdd_NAME Specify the name of the custom value (the part before the colon character). -CMD_CascadeHttpHeaderAdd_DATA Specify the data of the custom value (the part after the colon character). - - -# CascadeHttpHeaderDelete command -CMD_CascadeHttpHeaderDelete Delete a custom value in the HTTP header sent to the proxy server -CMD_CascadeHttpHeaderDelete_Help Use this to delete a custom value in the HTTP header sent to the proxy server. A custom HTTP header can be used to bypass certain restrictions imposed on the network or to avoid speed limitations applied by the QoS. -CMD_CascadeHttpHeaderDelete_Args CascadeHttpHeaderDelete [name] [/NAME:name] -CMD_CascadeHttpHeaderDelete_[name] Specify the name of the Cascade Connection whose setting you want to change. -CMD_CascadeHttpHeaderDelete_NAME Specify the name of the custom value (the part before the colon character). - - -# CascadeHttpHeaderGet command -CMD_CascadeHttpHeaderGet Get the list of custom values in the HTTP header sent to the proxy server -CMD_CascadeHttpHeaderGet_Help Use this to get the list of custom values in the HTTP header sent to the proxy server. A custom HTTP header can be used to bypass certain restrictions imposed on the network or to avoid speed limitations applied by the QoS. -CMD_CascadeHttpHeaderGet_Args CascadeHttpHeaderGet [name] -CMD_CascadeHttpHeaderGet_[name] Specify the name of the Cascade Connection whose setting you want to get. - - -# CascadeProxyNone command -CMD_CascadeProxyNone Specify Direct TCP/IP Connection as the Connection Method of Cascade Connection -CMD_CascadeProxyNone_Help When a Cascade Connection registered on the currently managed Virtual Hub is specified and that Cascade Connection connects to a VPN Server, use this to set Direct TCP/IP Connection as the connection method to use, in which case the connection route will not be via a proxy server. \nYou cannot execute this command for Virtual Hubs of VPN Servers operating as a cluster. -CMD_CascadeProxyNone_Args CascadeProxyNone [name] -CMD_CascadeProxyNone_[name] Specify the name of the Cascade Connection whose setting you want to change. - - -# CascadeProxyHttp command -CMD_CascadeProxyHttp Set Connection Method of Cascade Connection to be via an HTTP Proxy Server -CMD_CascadeProxyHttp_Help When a Cascade Connection registered on the currently managed Virtual Hub is specified and that Cascade Connection connects to a VPN Server, use this to set Connect via HTTP Proxy Server as the method of connection to use, which requires the specification of the host name and port number of the HTTP Proxy server to communicate via as well as a user name and password (when required). \nThe HTTP server that communication will travel via must be compatible with the CONNECT method to use HTTPS communication. \nYou cannot execute this command for Virtual Hubs of VPN Servers operating as a cluster. -CMD_CascadeProxyHttp_Args CascadeProxyHttp [name] [/SERVER:hostname:port] [/USERNAME:username] [/PASSWORD:password] -CMD_CascadeProxyHttp_[name] Specify the name of the Cascade Connection whose setting you want to change. -CMD_CascadeProxyHttp_SERVER Specify the host name or IP address, and port number of the on-route HTTP proxy server using the format [host name:port number]. -CMD_CascadeProxyHttp_USERNAME When user authentication is required to connect to the on-route HTTP proxy server, specify the user name. Also, specify the /PASSWORD parameter at the same time. If the parameters /USERNAME and /PASSWORD are not specified, the user authentication data will not be set. -CMD_CascadeProxyHttp_PASSWORD When user authentication is required to connect to the on-route HTTP proxy server, specify the password. Specify this together with the /USERNAME parameter. -CMD_CascadeProxyHttp_Prompt_Server Proxy Server Host Name and Port Number: - - -# CascadeProxySocks command -CMD_CascadeProxySocks Set Connection Method of Cascade Connection to be via a SOCKS4 Proxy Server -CMD_CascadeProxySocks_Help When a Cascade Connection registered on the currently managed Virtual Hub is specified and that Cascade Connection connects to a VPN Server, use this to set Connect via SOCKS4 Proxy Server as the method of connection to use, which requires the specification of the host name and port number of the SOCKS4 Proxy server to communicate via as well as a user name and password (when required). \nYou cannot execute this command for Virtual Hubs of VPN Servers operating as a cluster. -CMD_CascadeProxySocks_Args CascadeProxySocks [name] [/SERVER:hostname:port] [/USERNAME:username] [/PASSWORD:password] -CMD_CascadeProxySocks_[name] Specify the name of the Cascade Connection whose setting you want to change. -CMD_CascadeProxySocks_SERVER Specify the host name or IP address, and port number of the on-route SOCKS4 proxy server using the format "host name:port number". -CMD_CascadeProxySocks_USERNAME When user authentication is required to connect to the on-route SOCKS4 proxy server, specify the user name. Also, specify the /PASSWORD parameter at the same time. If the parameters /USERNAME and /PASSWORD are not specified, the user authentication data will not be set. -CMD_CascadeProxySocks_PASSWORD When user authentication is required to connect to the on-route SOCKS4 proxy server, specify the password. Specify this together with the /USERNAME parameter. - - -# CascadeProxySocks5 command -CMD_CascadeProxySocks5 Set Connection Method of Cascade Connection to be via a SOCKS5 Proxy Server -CMD_CascadeProxySocks5_Help When a Cascade Connection registered on the currently managed Virtual Hub is specified and that Cascade Connection connects to a VPN Server, use this to set Connect via SOCKS5 Proxy Server as the method of connection to use, which requires the specification of the host name and port number of the SOCKS Proxy server to communicate via as well as a user name and password (when required). \nYou cannot execute this command for Virtual Hubs of VPN Servers operating as a cluster. -CMD_CascadeProxySocks5_Args CascadeProxySocks5 [name] [/SERVER:hostname:port] [/USERNAME:username] [/PASSWORD:password] -CMD_CascadeProxySocks5_[name] Specify the name of the Cascade Connection whose setting you want to change. -CMD_CascadeProxySocks5_SERVER Specify the host name or IP address, and port number of the on-route SOCKS5 proxy server using the format "host name:port number". -CMD_CascadeProxySocks5_USERNAME When user authentication is required to connect to the on-route SOCKS5 proxy server, specify the user name. Also, specify the /PASSWORD parameter at the same time. If the parameters /USERNAME and /PASSWORD are not specified, the user authentication data will not be set. -CMD_CascadeProxySocks5_PASSWORD When user authentication is required to connect to the on-route SOCKS5 proxy server, specify the password. Specify this together with the /USERNAME parameter. - - -# CascadeServerCertEnable command -CMD_CascadeServerCertEnable Enable Cascade Connection Server Certificate Verification Option -CMD_CascadeServerCertEnable_Help When a Cascade Connection registered on the currently managed Virtual Hub is specified and that Cascade Connection connects to a VPN Server, use this to enable the option to check whether the SSL certificate provided by the destination VPN Server can be trusted. \nIf this option is enabled you must either use the CascadeServerCertSet command to save the connection destination server SSL certificate beforehand in the Cascade Connection Settings beforehand, or use the CAAdd command etc. to register a root certificate containing the signed server SSL certificate in the list of Virtual Hub trusted CA certificates. \nIf the certificate of the connected VPN Server cannot be trusted under the condition where the option to verify server certificates was enabled for the Cascade Connection, the connection will be promptly cancelled and continual reattempts at connection will be made. \nYou cannot execute this command for Virtual Hubs of VPN Servers operating as a cluster. -CMD_CascadeServerCertEnable_Args CascadeServerCertEnable [name] -CMD_CascadeServerCertEnable_[name] Specify the name of the Cascade Connection whose setting you want to change. - - -# CascadeServerCertDisable command -CMD_CascadeServerCertDisable Disable Cascade Connection Server Certificate Verification Option -CMD_CascadeServerCertDisable_Help When a Cascade Connection registered on the currently managed Virtual Hub is specified and that Cascade Connection connects to a VPN Server, use this to disable the option to check whether the SSL certificate provided by the destination VPN Server can be trusted. \nYou cannot execute this command for Virtual Hubs of VPN Servers operating as a cluster. -CMD_CascadeServerCertDisable_Args CascadeServerCertDisable [name] -CMD_CascadeServerCertDisable_[name] Specify the name of the Cascade Connection whose setting you want to change. - - -# CascadeServerCertSet command -CMD_CascadeServerCertSet Set the Server Individual Certificate for Cascade Connection -CMD_CascadeServerCertSet_Help When a Cascade Connection registered on the currently managed Virtual Hub is specified and that Cascade Connection connects to a VPN Server, use this to register beforehand the same certificate as the SSL certificate provided by the destination VPN Server. \nIf the option to verify server certificates for Cascade Connections is enabled, you must either use this command to save the connection destination server SSL certificate beforehand in the Cascade Connection Settings beforehand, or use the CAAdd command etc. to register a root certificate containing the signed server SSL certificate in the list of Virtual Hub trusted CA certificates. \nIf the certificate of the connected VPN Server cannot be trusted under the condition where the option to verify server certificates was enabled for the Cascade Connection, the connection will be promptly cancelled and continual reattempts at connection will be made. \nYou cannot execute this command for Virtual Hubs of VPN Servers operating as a cluster. -CMD_CascadeServerCertSet_Args CascadeServerCertSet [name] [/LOADCERT:cert] -CMD_CascadeServerCertSet_[name] Specify the name of the Cascade Connection whose setting you want to change. -CMD_CascadeServerCertSet_LOADCERT Specify X.509 format certificate file name that the server individual certificate you wish to set is saved under. - - -# CascadeServerCertDelete command -CMD_CascadeServerCertDelete Delete the Server Individual Certificate for Cascade Connection -CMD_CascadeServerCertDelete_Help When a Cascade Connection registered on the currently managed Virtual Hub is specified and a server individual certificate is registered for that Cascade Connection, use this to delete that server individual certificate. \nYou cannot execute this command for Virtual Hubs of VPN Servers operating as a cluster. -CMD_CascadeServerCertDelete_Args CascadeServerCertDelete [name] -CMD_CascadeServerCertDelete_[name] Specify the name of the Cascade Connection whose setting you want to change. - - -# CascadeServerCertGet command -CMD_CascadeServerCertGet Get the Server Individual Certificate for Cascade Connection -CMD_CascadeServerCertGet_Help When a Cascade Connection registered on the currently managed Virtual Hub is specified and a server individual certificate is registered for that Cascade Connection, use this to get that certificate and save it as an X.509 format certificate file. \nYou cannot execute this command for Virtual Hubs of VPN Servers operating as a cluster. -CMD_CascadeServerCertGet_Args CascadeServerCertGet [name] [/SAVECERT:path] -CMD_CascadeServerCertGet_[name] Specify the name of the Cascade Connection whose setting you want to change. -CMD_CascadeServerCertGet_SAVECERT Specify the certificate file name to save the server individual certificate in X.509 format. - - -# CascadeDetailSet command -CMD_CascadeDetailSet Set Advanced Settings for Cascade Connection -CMD_CascadeDetailSet_Help Use this to customize the VPN protocol communication settings used when a Cascade Connection registered on the currently managed Virtual Hub is specified and that Cascade Connection connects to the VPN Server. \nYou cannot execute this command for Virtual Hubs of VPN Servers operating as a cluster. -CMD_CascadeDetailSet_Args CascadeDetailSet [name] [/MAXTCP:max_connection] [/INTERVAL:interval] [/TTL:disconnect_span] [/HALF:yes|no] [/NOQOS:yes|no] -CMD_CascadeDetailSet_[name] Specify the name of the Cascade Connection whose setting you want to change. -CMD_CascadeDetailSet_MAXTCP Specify, using an integer in the range 1 to 32, the number of TCP connections to be used for VPN communication. By using data transmission by multiple TCP connections for VPN communication sessions with VPN Servers it is sometimes possible to increase communication speed. \nNote: We recommend about 8 lines when the connection lines to the server are fast, and 1 line when using a slow connection such as dialup. -CMD_CascadeDetailSet_INTERVAL When communicating by VPN by establishing multiple TCP connections, specify in seconds, the establishing interval for each TCP connection. The standard value is 1 second. -CMD_CascadeDetailSet_TTL When specifying connection life of each TCP connection specify in seconds the keep-alive time from establishing a TCP connection until disconnection. If 0 is specified, keep-alive will not be set. -CMD_CascadeDetailSet_HALF Specify "yes" when enabling half duplex mode. When using two or more TCP connections for VPN communication, it is possible to use Half Duplex Mode. By enabling half duplex mode it is possible to automatically fix data transmission direction as half and half for each TCP connection. In the case where a VPN using 8 TCP connections is established, for example, when half-duplex is enabled, communication can be fixes so that 4 TCP connections are dedicated to the upload direction and the other 4 connections are dedicated to the download direction. -CMD_CascadeDetailSet_NOQOS Specify "yes" when disabling VoIP / QoS functions. Normally "no" is specified. -CMD_CascadeDetailSet_Eval_MaxTcp Specify an integer in the range 1 to 32 for the number of TCP connections. -CMD_CascadeDetailSet_Eval_Interval Set at least 1 second for the interval to establish a TCP connection. -CMD_CascadeDetailSet_Prompt_MaxTcp Number of TCP Connections to Use in VPN Communication: -CMD_CascadeDetailSet_Prompt_Interval Interval between Establishing Each TCP Connection: -CMD_CascadeDetailSet_Prompt_TTL Connection Life of Each TCP Connection (0 for no keep-alive): -CMD_CascadeDetailSet_Prompt_HALF Enable half-duplex mode (yes/no): - - -# CascadePolicySet command -CMD_CascadePolicySet Set Cascade Connection Session Security Policy -CMD_CascadePolicySet_Help When a Cascade Connection registered on the currently managed Virtual Hub is specified and that Cascade Connection is established, use this to change the security policy contents that are applied to the session generated by the Virtual Hub. \nWhen a Virtual Hub makes a Cascade Connection to another VPN Server, a Cascade Session will be newly generated on the Virtual Hub that is the Cascade Connection source. You can use this command to set the security policy contents that will set this Cascade session. \nYou cannot execute this command for Virtual Hubs of VPN Servers operating as a cluster. -CMD_CascadePolicySet_Args [name] [/NAME:policy_name] [/VALUE:num|yes|no] -CMD_CascadePolicySet_[name] Specify the name of the Cascade Connection whose setting you want to change. -CMD_CascadePolicySet_NAME Specify the name of policy whose values you want to change. You can use the PolicyList command to display a list of policy names and values that can be set. -CMD_CascadePolicySet_VALUE Specify a new policy value. If the policy is an integer value, specify an integer. Specify yes or no for Boolean types. You can view the type and value that can be set by using the PolicyList command. -CMD_CascadePolicySet_PROMPT_POLNAME Name of Policy Whose Value you want to Change: -CMD_CascadePolicySet_PROMPT_POLVALUE Value to newly set: -CMD_CascadePolicySet_Invalid_Name The specified policy name "%S" is invalid. \nCheck the list of policy names that can be set using the PolicyList command. -CMD_CascadePolicySet_Invalid_Name_For_Cascade The specified policy name "%S" cannot be used for a Cascade Connection security policy setting. -CMD_CascadePolicySet_Invalid_Range Specify policy "%S" within the range of %s. - - -# PolicyList command -CMD_PolicyList Display List of Security Policy Types and Settable Values -CMD_PolicyList_Help Use this to display a list of item names, descriptions, and settable values in the security policies that can be set for VPN Server users and groups and Cascade Connections. \nBy running the PolicyList command without specifying any parameters, a list of all supported security policy names and descriptions will be displayed. \nBy specifying the name using the PolicyList command parameter, a detailed description related to this value and the type and range of the settable value will be displayed. -CMD_PolicyList_Args PolicyList [name] -CMD_PolicyList_[name] This allows you to specify the policy name whose description you want to display. If you don't specify a name, a list of all supported security names and descriptions will be displayed. -CMD_PolicyList_Invalid_Name The specified policy name is invalid. -CMD_PolicyList_Column_1 Policy name -CMD_PolicyList_Column_2 Simple description of policy -CMD_PolicyList_Column_3 Setting value -CMD_PolicyList_Help_1 [Policy Name] -CMD_PolicyList_Help_2 [Simple Description of Policy] -CMD_PolicyList_Help_3 [Range of Settable Values] -CMD_PolicyList_Help_4 [Default Value] -CMD_PolicyList_Help_5 [Detailed Description of Policy] -CMD_PolicyList_Range_Bool yes or no -CMD_PolicyList_Range_Int_1 Range from %s to %s (0 cannot be specified) -CMD_PolicyList_Range_Int_2 Range from %s to %s (if 0 is specified, nothing is set) - - -# CascadeStatusGet command -CMD_CascadeStatusGet Get Current Cascade Connection Status -CMD_CascadeStatusGet_Help When a Cascade Connection registered on the currently managed Virtual Hub is specified and that Cascade Connection is currently online, use this to get its connection status and other information. \nYou cannot execute this command for Virtual Hubs of VPN Servers operating as a cluster. -CMD_CascadeStatusGet_Args CascadeStatusGet [name] -CMD_CascadeStatusGet_[name] Specify the name of the Cascade Connection whose information you want to get. - - -# CascadeRename command -CMD_CascadeRename Change Name of Cascade Connection -CMD_CascadeRename_Help When a Cascade Connection registered on the currently managed Virtual Hub is specified, use this to change the name of that Cascade Connection. \nYou cannot execute this command for Virtual Hubs of VPN Servers operating as a cluster. -CMD_CascadeRename_Args CascadeRename [name] [/NEW:new_name] -CMD_CascadeRename_[name] Specify the current name of the Cascade Connection whose name you want to change. -CMD_CascadeRename_NEW Specify the new name after the change. -CMD_CascadeRename_PROMPT_OLD Current Name: -CMD_CascadeRename_PROMPT_NEW New Name: - - - -# CascadeOnline command -CMD_CascadeOnline Switch Cascade Connection to Online Status -CMD_CascadeOnline_Help When a Cascade Connection registered on the currently managed Virtual Hub is specified, use this to switch that Cascade Connection to online status. The Cascade Connection that is switched to online status begins the process of connecting to the destination VPN Server in accordance with the Connection Setting. The Cascade Connection that is switched to online status will establish normal connection to the VPN Server or continue to attempt connection until it is switched to offline status. \nYou cannot execute this command for Virtual Hubs of VPN Servers operating as a cluster. -CMD_CascadeOnline_Args CascadeOnline [name] -CMD_CascadeOnline_[name] Specify the name of the Cascade Connection to switch to online status. - - -# CascadeOffline command -CMD_CascadeOffline Switch Cascade Connection to Offline Status -CMD_CascadeOffline_Help When a Cascade Connection registered on the currently managed Virtual Hub is specified, use this to switch that Cascade Connection to offline status. The Cascade Connection that is switched to offline will not connect to the VPN Server until next time it is switched to the online status using the CascadeOnline command \nYou cannot execute this command for Virtual Hubs of VPN Servers operating as a cluster. -CMD_CascadeOffline_Args CascadeOffline [name] -CMD_CascadeOffline_[name] Specify the name of the Cascade Connection to switch to offline status. - - -# AccessAdd command -CMD_AccessAdd Add Access List Rules (IPv4) -CMD_AccessAdd_Help Use this to add a new rule to the access list of the currently managed Virtual Hub. \nThe access list is a set of packet file rules that are applied to packets that flow through the Virtual Hub. You can register multiple rules in an access list and you can also define an priority for each rule. All packets are checked for the conditions specified by the rules registered in the access list and based on the operation that is stipulated by the first matching rule, they either pass or are discarded. Packets that do not match any rule are implicitly allowed to pass. You can also use the AccessAddEx command to generate delays, jitters and packet losses. \nThis command cannot be run on VPN Bridge. \nYou cannot execute this command for Virtual Hubs of VPN Servers operating as a member server on a cluster. -CMD_AccessAdd_Args AccessAdd [pass|discard] [/MEMO:memo] [/PRIORITY:priority] [/SRCUSERNAME:username] [/DESTUSERNAME:username] [/SRCMAC:mac/mask] [/DESTMAC:mac/mask] [/SRCIP:ip/mask] [/DESTIP:ip/mask] [/PROTOCOL:tcp|udp|icmpv4|icmpv6|ip|num] [/SRCPORT:start-end] [/DESTPORT:start-end] [/TCPSTATE: established|unestablished] -CMD_AccessAdd_[pass|discard] When a packet matches this rule condition, this operation is decided. When pass is specified, the packet is allowed to pass, and when discard is specified, the packet is discarded. -CMD_AccessAdd_MEMO Specify a description (memo) for this rule. -CMD_AccessAdd_PRIORITY Specify an integer of 1 or higher to indicate the priority of the rule. Higher priority is given to rules with the lower priority values. -CMD_AccessAdd_SRCIP Specify a source IPv4 address as a rule condition. Specify the IPv4 address in the format of "IP Address/Mask" by separating the decimal values using dots such as "192.168.0.1". For the mask, either specify decimal values separated by dots such as "255.255.255.0", or you can specify the bit length from the header using a decimal value such as "24". If you specify "0.0.0.0/0.0.0.0", this means all hosts. -CMD_AccessAdd_DESTIP Specify a destination IPv4 address as a rule condition in the format of "IP Address/Mask". Use the same method of specification as for the /SRCIP parameter. -CMD_AccessAdd_PROTOCOL Specify a protocol type as a rule condition. Input the IP protocol number using decimal values or specify one of the keywords "tcp" (TCP/IP protocol, no.6), "udp" (UDP/IP protocol, no.17), "icmpv4" (ICMPv4 protocol, no.1), "icmpv6" (ICMPv6 protocol, no.58) or "ip" (all protocols, no.0). Specify 0 to make the rule apply to all IP protocols. -CMD_AccessAdd_SRCPORT If the specified protocol is TCP/IP or UDP/IP, specify the source port number as the rule condition. Protocols other than this will be ignored. When this parameter is not specified, the rules will apply to all port numbers. When specifying, do so using the following method "1-1024" (1 to 1024), "23" (only 23). -CMD_AccessAdd_DESTPORT If the specified protocol is TCP/IP or UDP/IP, specify the destination port number as the rule condition. Protocols other than this will be ignored. Use the same method of specification as for the /SRCPORT parameter. -CMD_AccessAdd_SRCUSERNAME You can apply this rule to only the packets sent by a user session of a user name that has been specified as a rule condition. In this case, specify the user name. -CMD_AccessAdd_DESTUSERNAME You can apply this rule to only the packets received by a user session of a user name that has been specified as a rule condition. In this case, specify the user name. -CMD_AccessAdd_SRCMAC Specify destination MAC address as a rule. Specify MAC address with "-" or ":" separators and hexadecimal number like "00-AC-84-EA-33-BC/FF-FF-FF-FF-FF-00". The separators are skippable. -CMD_AccessAdd_DESTMAC Specify destination MAC address as a rule. Use the same method of specification as for the /SRCMAC parameter. -CMD_AccessAdd_TCPSTATE Specify TCP connection state as a rule. Use Established or Unestablished. -CMD_AccessAdd_Prompt_TYPE Pass or Discard: -CMD_AccessAdd_Prompt_MEMO Rule Description (Memo): -CMD_AccessAdd_Prompt_PRIORITY Rule Priority: -CMD_AccessAdd_Eval_PRIORITY Specify an integer of 1 or higher for the priority. -CMD_AccessAdd_Prompt_SRCIP Source IP Address ("0.0.0.0/0" specifies all): -CMD_AccessAdd_Prompt_DESTIP Destination IP Address ("0.0.0.0/0" specifies all): -CMD_AccessAdd_Prompt_PROTOCOL Protocol No. or Protocol Name (tcp/udp/icmpv4/icmpv6/ip): -CMD_AccessAdd_Prompt_SRCPORT Source Port Number Range (tcp/udp only): -CMD_AccessAdd_Prompt_DESTPORT Destination Port Number Range (tcp/udp only): -CMD_AccessAdd_Prompt_SRCUSERNAME Source User Name (all when unspecified): -CMD_AccessAdd_Prompt_DESTUSERNAME Destination User Name (all when unspecified): -CMD_AccessAdd_Prompt_SRCMAC Source MAC Address and Mask (all when unspecified): -CMD_AccessAdd_Prompt_DESTMAC Destination MAC Address and Mask (all when unspecified): -CMD_AccessAdd_Prompt_TCPSTATE TCP Connection State (Established/Unestablished): - - -# AccessAddEx command -CMD_AccessAddEx Add Extended Access List Rules (IPv4: Delay, Jitter and Packet Loss Generating) -CMD_AccessAddEx_Help Use this to add a new rule to the access list of the currently managed Virtual Hub. You can set to generate delays, jitters and packet losses when a packet is passing via the Virtual Hub. \nThe access list is a set of packet file rules that are applied to packets that flow through the Virtual Hub. You can register multiple rules in an access list and you can also define an priority for each rule. All packets are checked for the conditions specified by the rules registered in the access list and based on the operation that is stipulated by the first matching rule, they either pass or are discarded. Packets that do not match any rule are implicitly allowed to pass. You can also use the AccessAddEx command to generate delays, jitters and packet losses. \nThis command cannot be run on VPN Bridge. \nYou cannot execute this command for Virtual Hubs of VPN Servers operating as a member server on a cluster. -CMD_AccessAddEx_Args AccessAddEx [pass|discard] [/MEMO:memo] [/PRIORITY:priority] [/SRCUSERNAME:username] [/DESTUSERNAME:username] [/SRCMAC:mac/mask] [/DESTMAC:mac/mask] [/SRCIP:ip/mask] [/DESTIP:ip/mask] [/PROTOCOL:tcp|udp|icmpv4|icmpv6|ip|num] [/SRCPORT:start-end] [/DESTPORT:start-end] [/TCPSTATE: established|unestablished] [/DELAY:delay_millisec] [/JITTER:jitter_percent] [/LOSS:loss_percent] [/REDIRECTURL:url] -CMD_AccessAddEx_[pass|discard] When a packet matches this rule condition, this operation is decided. When pass is specified, the packet is allowed to pass, and when discard is specified, the packet is discarded. The setting of delays, jitters and packet losses is applied if the action is pass. -CMD_AccessAddEx_MEMO Specify a description (memo) for this rule. -CMD_AccessAddEx_PRIORITY Specify an integer of 1 or higher to indicate the priority of the rule. Higher priority is given to rules with the lower priority values. -CMD_AccessAddEx_SRCIP Specify a source IPv4 address as a rule condition. Specify the IPv4 address in the format of "IP Address/Mask" by separating the decimal values using dots such as "192.168.0.1". For the mask, either specify decimal values separated by dots such as "255.255.255.0", or you can specify the bit length from the header using a decimal value such as "24". If you specify "0.0.0.0/0.0.0.0", this means all hosts. -CMD_AccessAddEx_DESTIP Specify a destination IPv4 address as a rule condition in the format of "IP Address/Mask". Use the same method of specification as for the /SRCIP parameter. -CMD_AccessAddEx_PROTOCOL Specify a protocol type as a rule condition. Input the IP protocol number using decimal values or specify one of the keywords "tcp" (TCP/IP protocol, no.6), "udp" (UDP/IP protocol, no.17), "icmpv4" (ICMPv4 protocol, no.1), "icmpv6" (ICMPv6 protocol, no.58) or "ip" (all protocols, no.0). Specify 0 to make the rule apply to all IP protocols. -CMD_AccessAddEx_SRCPORT If the specified protocol is TCP/IP or UDP/IP, specify the source port number as the rule condition. Protocols other than this will be ignored. When this parameter is not specified, the rules will apply to all port numbers. When specifying, do so using the following method "1-1024" (1 to 1024), "23" (only 23). -CMD_AccessAddEx_DESTPORT If the specified protocol is TCP/IP or UDP/IP, specify the destination port number as the rule condition. Protocols other than this will be ignored. Use the same method of specification as for the /SRCPORT parameter. -CMD_AccessAddEx_SRCUSERNAME You can apply this rule to only the packets sent by a user session of a user name that has been specified as a rule condition. In this case, specify the user name. -CMD_AccessAddEx_DESTUSERNAME You can apply this rule to only the packets received by a user session of a user name that has been specified as a rule condition. In this case, specify the user name. -CMD_AccessAddEx_SRCMAC Specify destination MAC address as a rule. Specify MAC address with "-" or ":" separators and hexadecimal number like "00-AC-84-EA-33-BC/FF-FF-FF-FF-FF-00". The separators are skippable. -CMD_AccessAddEx_DESTMAC Specify destination MAC address as a rule. Use the same method of specification as for the /SRCMAC parameter. -CMD_AccessAddEx_TCPSTATE Specify TCP connection state as a rule. Use Established or Unestablished. -CMD_AccessAddEx_DELAY Set this value to generate delays when packets is passing. Specify the delay period in milliseconds. Specify 0 means no delays to generate. The delays must be 10000 milliseconds at most. -CMD_AccessAddEx_JITTER Set this value to generate jitters when packets is passing. Specify the ratio of fluctuation of jitters within 0% to 100% range. Specify 0 means no jitters to generate. -CMD_AccessAddEx_LOSS Set this value to generate packet losses when packets is passing. Specify the ratio of packet losses within 0% to 100% range. Specify 0 means no packet losses to generate. -CMD_AccessAddEx_REDIRECTURL The specified URL will be mandatory replied to the client as a response for TCP connecting request packets which matches the conditions of this access list entry via this Virtual Hub. To use this setting, you can enforce the web browser of the VPN Client computer to show the specified web site when that web browser tries to access the specific IP address. -CMD_AccessAddEx_Prompt_DELAY Delays to Generate (in milliseconds: 0 - 10000): -CMD_AccessAddEx_Prompt_JITTER Fluctuation of Jitters to Generate (Percent: 0 - 100): -CMD_AccessAddEx_Prompt_LOSS Ratio of Packet Losses (Percent: 0 - 100): -CMD_AccessAddEx_Eval_DELAY Delays must be 10000 at maximum. -CMD_AccessAddEx_Eval_JITTER Fluctuation of Jitters must be 100 at maximum. -CMD_AccessAddEx_Eval_LOSS Ratio of Packet Losses must be 100 at maximum. - - -# AccessAdd6 command -CMD_AccessAdd6 Add Access List Rules (IPv6) -CMD_AccessAdd6_Help Use this to add a new rule to the access list of the currently managed Virtual Hub. \nThe access list is a set of packet file rules that are applied to packets that flow through the Virtual Hub. You can register multiple rules in an access list and you can also define an priority for each rule. All packets are checked for the conditions specified by the rules registered in the access list and based on the operation that is stipulated by the first matching rule, they either pass or are discarded. Packets that do not match any rule are implicitly allowed to pass. You can also use the AccessAddEx6 command to generate delays, jitters and packet losses. \nThis command cannot be run on VPN Bridge. \nYou cannot execute this command for Virtual Hubs of VPN Servers operating as a member server on a cluster. -CMD_AccessAdd6_Args AccessAdd6 [pass|discard] [/MEMO:memo] [/PRIORITY:priority] [/SRCUSERNAME:username] [/DESTUSERNAME:username] [/SRCMAC:mac/mask] [/DESTMAC:mac/mask] [/SRCIP:ip/mask] [/DESTIP:ip/mask] [/PROTOCOL:tcp|udp|icmpv4|icmpv6|ip|num] [/SRCPORT:start-end] [/DESTPORT:start-end] [/TCPSTATE: established|unestablished] -CMD_AccessAdd6_[pass|discard] When a packet matches this rule condition, this operation is decided. When pass is specified, the packet is allowed to pass, and when discard is specified, the packet is discarded. -CMD_AccessAdd6_MEMO Specify a description (memo) for this rule. -CMD_AccessAdd6_PRIORITY Specify an integer of 1 or higher to indicate the priority of the rule. Higher priority is given to rules with the lower priority values. -CMD_AccessAdd6_SRCIP Specify a source IPv6 address as a rule condition. Specify the IPv6 address in the format of "IP Address/Mask" by separating the hexadecimal values using colons such as "2001:200:0:1::". For the mask, either specify hexadecimal values separated by colons such as ffff:ffff:ffff:ffff::, or you can specify the bit length from the header using a decimal value such as "64". If you specify "::/0", this means all hosts. -CMD_AccessAdd6_DESTIP Specify a destination IPv6 address as a rule condition in the format of "IP Address/Mask". Use the same method of specification as for the /SRCIP parameter. -CMD_AccessAdd6_PROTOCOL Specify a protocol type as a rule condition. Input the IP protocol number using decimal values or specify one of the keywords "tcp" (TCP/IP protocol, no.6), "udp" (UDP/IP protocol, no.17), "icmpv4" (ICMPv4 protocol, no.1), "icmpv6" (ICMPv6 protocol, no.58) or "ip" (all protocols, no.0). Specify 0 to make the rule apply to all IP protocols. -CMD_AccessAdd6_SRCPORT If the specified protocol is TCP/IP or UDP/IP, specify the source port number as the rule condition. Protocols other than this will be ignored. When this parameter is not specified, the rules will apply to all port numbers. When specifying, do so using the following method "1-1024" (1 to 1024), "23" (only 23). -CMD_AccessAdd6_DESTPORT If the specified protocol is TCP/IP or UDP/IP, specify the destination port number as the rule condition. Protocols other than this will be ignored. Use the same method of specification as for the /SRCPORT parameter. -CMD_AccessAdd6_SRCUSERNAME You can apply this rule to only the packets sent by a user session of a user name that has been specified as a rule condition. In this case, specify the user name. -CMD_AccessAdd6_DESTUSERNAME You can apply this rule to only the packets received by a user session of a user name that has been specified as a rule condition. In this case, specify the user name. -CMD_AccessAdd6_SRCMAC Specify destination MAC address as a rule. Specify MAC address with "-" or ":" separators and hexadecimal number like "00-AC-84-EA-33-BC/FF-FF-FF-FF-FF-00". The separators can be skipped. -CMD_AccessAdd6_DESTMAC Specify destination MAC address as a rule. Use the same method of specification as for the /SRCMAC parameter. -CMD_AccessAdd6_TCPSTATE Specify TCP connection state as a rule. Use Established or Unestablished. -CMD_AccessAdd6_Prompt_TYPE Pass or Discard: -CMD_AccessAdd6_Prompt_MEMO Rule Description (Memo): -CMD_AccessAdd6_Prompt_PRIORITY Rule Priority: -CMD_AccessAdd6_Eval_PRIORITY Specify an integer of 1 or higher for the priority. -CMD_AccessAdd6_Prompt_SRCIP Source IP Address ("::/0" specifies all): -CMD_AccessAdd6_Prompt_DESTIP Destination IP Address ("::/0" specifies all): -CMD_AccessAdd6_Prompt_PROTOCOL Protocol No. or Protocol Name (tcp/udp/icmpv4/icmpv6/ip): -CMD_AccessAdd6_Prompt_SRCPORT Source Port Number Range (tcp/udp only): -CMD_AccessAdd6_Prompt_DESTPORT Destination Port Number Range (tcp/udp only): -CMD_AccessAdd6_Prompt_SRCUSERNAME Source User Name (all when unspecified): -CMD_AccessAdd6_Prompt_DESTUSERNAME Destination User Name (all when unspecified): -CMD_AccessAdd6_Prompt_SRCMAC Source MAC Address and Mask (all when unspecified): -CMD_AccessAdd6_Prompt_DESTMAC Destination MAC Address and Mask (all when unspecified): -CMD_AccessAdd6_Prompt_TCPSTATE TCP Connection State (Established/Unestablished): - - -# AccessAddEx6 command -CMD_AccessAddEx6 Add Extended Access List Rules (IPv6: Delay, Jitter and Packet Loss Generating) -CMD_AccessAddEx6_Help Use this to add a new rule to the access list of the currently managed Virtual Hub. You can set to generate delays, jitters and packet losses when a packet is passing via the Virtual Hub. \nThe access list is a set of packet file rules that are applied to packets that flow through the Virtual Hub. You can register multiple rules in an access list and you can also define a priority for each rule. All packets are checked for the conditions specified by the rules registered in the access list and based on the operation that is stipulated by the first matching rule, they either pass or are discarded. Packets that do not match any rule are implicitly allowed to pass. You can also use the AccessAddEx6 command to generate delays, jitters and packet losses. \nThis command cannot be run on VPN Bridge. \nYou cannot execute this command for Virtual Hubs of VPN Servers operating as a member server on a cluster. -CMD_AccessAddEx6_Args AccessAddEx6 [pass|discard] [/MEMO:memo] [/PRIORITY:priority] [/SRCUSERNAME:username] [/DESTUSERNAME:username] [/SRCMAC:mac/mask] [/DESTMAC:mac/mask] [/SRCIP:ip/mask] [/DESTIP:ip/mask] [/PROTOCOL:tcp|udp|icmpv4|icmpv6|ip|num] [/SRCPORT:start-end] [/DESTPORT:start-end] [/TCPSTATE: established|unestablished] [/DELAY:delay_millisec] [/JITTER:jitter_percent] [/LOSS:loss_percent] [/REDIRECTURL:url] -CMD_AccessAddEx6_[pass|discard] When a packet matches this rule condition, this operation is decided. When pass is specified, the packet is allowed to pass, and when discard is specified, the packet is discarded. The setting of delays, jitters and packet losses is applied if the action is pass. -CMD_AccessAddEx6_MEMO Specify a description (memo) for this rule. -CMD_AccessAddEx6_PRIORITY Specify an integer of 1 or higher to indicate the priority of the rule. Higher priority is given to rules with the lower priority values. -CMD_AccessAddEx6_SRCIP Specify a source IPv6 address as a rule condition. Specify the IPv6 address in the format of "IP Address/Mask" by separating the hexadecimal values using colons such as "2001:200:0:1::". For the mask, either specify hexadecimal values separated by colons such as "ffff:ffff:ffff:ffff::", or you can specify the bit length from the header using a decimal value such as 64. If you specify "::/0", this means all hosts. -CMD_AccessAddEx6_DESTIP Specify a destination IPv6 address as a rule condition in the format of "IP Address/Mask". Use the same method of specification as for the /SRCIP parameter. -CMD_AccessAddEx6_PROTOCOL Specify a protocol type as a rule condition. Input the IP protocol number using decimal values or specify one of the keywords "tcp" (TCP/IP protocol, no.6), "udp" (UDP/IP protocol, no.17), "icmpv4" (ICMPv4 protocol, no.1), "icmpv6" (ICMPv6 protocol, no.58) or "ip" (all protocols, no.0). Specify 0 to make the rule apply to all IP protocols. -CMD_AccessAddEx6_SRCPORT If the specified protocol is TCP/IP or UDP/IP, specify the source port number as the rule condition. Protocols other than this will be ignored. When this parameter is not specified, the rules will apply to all port numbers. When specifying, do so using the following method "1-1024" (1 to 1024), "23" (only 23). -CMD_AccessAddEx6_DESTPORT If the specified protocol is TCP/IP or UDP/IP, specify the destination port number as the rule condition. Protocols other than this will be ignored. Use the same method of specification as for the /SRCPORT parameter. -CMD_AccessAddEx6_SRCUSERNAME You can apply this rule to only the packets sent by a user session of a user name that has been specified as a rule condition. In this case, specify the user name. -CMD_AccessAddEx6_DESTUSERNAME You can apply this rule to only the packets received by a user session of a user name that has been specified as a rule condition. In this case, specify the user name. -CMD_AccessAddEx6_SRCMAC Specify destination MAC address as a rule. Specify MAC address with "-" or ":" separators and hexadecimal number like "00-AC-84-EA-33-BC/FF-FF-FF-FF-FF-00". The separators can be skipped. -CMD_AccessAddEx6_DESTMAC Specify destination MAC address as a rule. Use the same method of specification as for the /SRCMAC parameter. -CMD_AccessAddEx6_TCPSTATE Specify TCP connection state as a rule. Use Established or Unestablished. -CMD_AccessAddEx6_DELAY Set this value to generate delays when packets is passing. Specify the delay period in milliseconds. Specify 0 means no delays to generate. The delays must be 10000 milliseconds at most. -CMD_AccessAddEx6_JITTER Set this value to generate jitters when packets is passing. Specify the ratio of fluctuation of jitters within 0% to 100% range. Specify 0 means no jitters to generate. -CMD_AccessAddEx6_LOSS Set this value to generate packet losses when packets is passing. Specify the ratio of packet losses within 0% to 100% range. Specify 0 means no packet losses to generate. -CMD_AccessAddEx6_REDIRECTURL The specified URL will be mandatory replied to the client as a response for TCP connecting request packets which matches the conditions of this access list entry via this Virtual Hub. To use this setting, you can enforce the web browser of the VPN Client computer to show the specified web site when that web browser tries to access the specific IP address. -CMD_AccessAddEx6_Prompt_DELAY Delays to Generate (in milliseconds: 0 - 10000): -CMD_AccessAddEx6_Prompt_JITTER Fluctuation of Jitters to Generate (Percent: 0 - 100): -CMD_AccessAddEx6_Prompt_LOSS Ratio of Packet Losses (Percent: 0 - 100): -CMD_AccessAddEx6_Eval_DELAY Delays must be 10000 at maximum. -CMD_AccessAddEx6_Eval_JITTER Fluctuation of Jitters must be 100 at maximum. -CMD_AccessAddEx6_Eval_LOSS Ratio of Packet Losses must be 100 at maximum. - - -# AccessList command -CMD_AccessList Get Access List Rule List -CMD_AccessList_Help Use this to get a list of packet filter rules that are registered on access list of the currently managed Virtual Hub. \nThe access list is a set of packet file rules that are applied to packets that flow through the Virtual Hub. You can register multiple rules in an access list and you can also define a priority for each rule. All packets are checked for the conditions specified by the rules registered in the access list and based on the operation that is stipulated by the first matching rule, they either pass or are discarded. Packets that do not match any rule are implicitly allowed to pass. \nThis command cannot be run on VPN Bridge. \nYou cannot execute this command for Virtual Hubs of VPN Servers operating as a member server on a cluster. -CMD_AccessList_Args AccessList - - -# AccessDelete command -CMD_AccessDelete Delete Rule from Access List -CMD_AccessDelete_Help Use this to specify a packet filter rule registered on the access list of the currently managed Virtual Hub and delete it. \nTo delete a rule, you must specify that rule's ID. You can display the ID by using the AccessList command. \nIf you wish not to delete the rule but to only temporarily disable it, use the AccessDisable command. \nThis command cannot be run on VPN Bridge. \nYou cannot execute this command for Virtual Hubs of VPN Servers operating as a member server on a cluster. -CMD_AccessDelete_Args AccessDelete [id] -CMD_AccessDelete_[id] Specify either the ID or the Unique ID of the rule to delete. -CMD_Access_Prompt_ID Access List Rule ID or Unique ID: - - -# AccessEnable command -CMD_AccessEnable Enable Access List Rule -CMD_AccessEnable_Help Use this to specify a packet filter rule registered on the access list of the currently managed Virtual Hub and enable it. The enabled rule will be used by packet filtering. \nTo enable a rule, you must specify that rule's ID. You can display the ID by using the AccessList command. \nThis command cannot be run on VPN Bridge. \nYou cannot execute this command for Virtual Hubs of VPN Servers operating as a member server on a cluster. -CMD_AccessEnable_Args AccessEnable [id] -CMD_AccessEnable_[id] Specify the ID of the rule to enable. - - -# AccessDisable command -CMD_AccessDisable Disable Access List Rule -CMD_AccessDisable_Help Use this to specify a packet filter rule registered on the access list of the currently managed Virtual Hub and disable it. The disabled rule will be used by packet filtering. \nTo disable a rule, you must specify that rule's ID. You can display the ID by using the AccessList command. \nThis command cannot be run on VPN Bridge. \nYou cannot execute this command for Virtual Hubs of VPN Servers operating as a member server on a cluster. -CMD_AccessDisable_Args AccessDisable [id] -CMD_AccessDisable_[id] Specify the ID of the rule to disable. - - -# UserList command -CMD_UserList Get List of Users -CMD_UserList_Help Use this to get a list of users that are registered on the security account database of the currently managed Virtual Hub. \nThis command cannot be run on VPN Bridge. \nYou cannot execute this command for Virtual Hubs of VPN Servers operating as a member server on a cluster. -CMD_UserList_Args UserList - - -# UserCreate command -CMD_UserCreate Create User -CMD_UserCreate_Help Use this to create a new user in the security account database of the currently managed Virtual Hub. \nBy creating a user, the VPN Client can connect to the Virtual Hub by using the authentication information of that user. \nWhen a user is created using the UserCreate command and the auth type of that user is registered as Password Authentication, a random string will be assigned as the password. Therefore, that user will not be able to connect to the Virtual Hub in that state. After creating the user, you must always use the UserPasswordSet command to specify the user password, or alternatively use the UserAnonymousSet command, UserCertSet command, UserSignedSet command, UserRadiusSet command or UserNTLMSet command to change the user's auth type. \nNote that a user whose user name has been created as "*" (a single asterisk character) will automatically be registered as a RADIUS authentication user. For cases where there are users with "*" as the name, when a user, whose user name that has been provided when a client connected to a VPN Server does not match existing user names, is able to be authenticated by a RADIUS server or NT domain controller by inputting a user name and password, the authentication settings and security policy settings will follow the setting for the user "*". \nTo change the user information of a user that has been created, use the UserSet command. \nThis command cannot be run on VPN Bridge. \nYou cannot execute this command for Virtual Hubs of VPN Servers operating as a member server on a cluster. -CMD_UserCreate_Args UserCreate [name] [/GROUP:group] [/REALNAME:realname] [/NOTE:note] -CMD_UserCreate_[name] Specify the user name of the user to be newly created. -CMD_UserCreate_GROUP When assigning a user in a group, specify the group name. When not assigning a user to any group, specify /GROUP:none. -CMD_UserCreate_REALNAME Specify the user's full name. If you are not specifying this, specify /REALNAME:none. -CMD_UserCreate_NOTE Specify a description of the user. If you are not specifying this, specify /NOTE:none -CMD_UserCreate_Prompt_NAME User Name: -CMD_UserCreate_Prompt_GROUP Assigned Group Name: -CMD_UserCreate_Prompt_REALNAME User Full Name: -CMD_UserCreate_Prompt_NOTE User Description: - - -# UserSet command -CMD_UserSet Change User Information -CMD_UserSet_Help Use this to change user information that is registered on the security account database of the currently managed Virtual Hub. \nThe user information that can be changed using this command are the three items that are specified when a new user is created using the UserCreate command: Group Name, Full Name, and Description. \nTo get the list of currently registered users, use the UserList command. \nThis command cannot be run on VPN Bridge. \nYou cannot execute this command for Virtual Hubs of VPN Servers operating as a member server on a cluster. -CMD_UserSet_Args UserSet [name] [/GROUP:group] [/REALNAME:realname] [/NOTE:note] -CMD_UserSet_[name] Specify the user name of the user whose setting you want to change. -CMD_UserSet_GROUP When assigning a user in a group, specify the group name. When not assigning a user to any group, specify /GROUP:none. -CMD_UserSet_REALNAME Specify the user's full name. If you are not specifying this, specify /REALNAME:none -CMD_UserSet_NOTE Specify a description of the user. If you are not specifying this, specify /NOTE:none. - - -# UserDelete command -CMD_UserDelete Delete User -CMD_UserDelete_Help Use this to delete a user that is registered on the security account database of the currently managed Virtual Hub. By deleting the user, that user will no long be able to connect to the Virtual Hub. \nYou can use the UserPolicySet command to instead of deleting a user, set the user to be temporarily denied from logging in. \nTo get the list of currently registered users, use the UserList command. \nThis command cannot be run on VPN Bridge. \nYou cannot execute this command for Virtual Hubs of VPN Servers operating as a member server on a cluster. -CMD_UserDelete_Args UserDelete [name] -CMD_UserDelete_[name] Specify the name of the user to delete. - - -# UserGet command -CMD_UserGet Get User Information -CMD_UserGet_Help Use this to get user registration information that is registered on the security account database of the currently managed Virtual Hub. \nThe information that you can get using this command are User Name, Full Name, Group Name, Expiration Date, Security Policy, and Auth Type, as well as parameters that are specified as auth type attributes and the statistical data of that user. \nTo get the list of currently registered users, use the UserList command. \nThis command cannot be run on VPN Bridge. \nYou cannot execute this command for Virtual Hubs of VPN Servers operating as a member server on a cluster. -CMD_UserGet_Args UserGet [name] -CMD_UserGet_[name] Specify the user name of the user whose information you want to get. -CMD_UserGet_Column_Name User Name -CMD_UserGet_Column_RealName Full Name -CMD_UserGet_Column_Note Description -CMD_UserGet_Column_Group Group Name -CMD_UserGet_Column_Expires Expiration Date -CMD_UserGet_Column_AuthType Auth Type -CMD_UserGet_Column_UserCert Registered User Individual Certificate -CMD_UserGet_Column_RadiusAlias External Authentication Server Authentication User Name -CMD_UserGet_Column_RootCert_CN Limit of Certificate CN Value -CMD_UserGet_Column_RootCert_SERIAL Limit of Certificate Serial Number -CMD_UserGet_Policy Security Policy Set for this User - - -# UserAnonymousSet command -CMD_UserAnonymousSet Set Anonymous Authentication for User Auth Type -CMD_UserAnonymousSet_Help Use this to set Anonymous Authentication as the auth type for a user that is registered on the security account database of the currently managed Virtual Hub. A VPN Client that has connected to a Virtual Hub using a user name of a user set to anonymous authentication can connect to a Virtual Hub without undergoing user authentication and without conditions. The anonymous authentication function is ideally suited to public VPN Servers that are setup to allow anyone to connect via the Internet etc. \nTo get the list of currently registered users, use the UserList command. \nThis command cannot be run on VPN Bridge. \nYou cannot execute this command for Virtual Hubs of VPN Servers operating as a member server on a cluster. -CMD_UserAnonymousSet_Args UserAnonymousSet [name] -CMD_UserAnonymousSet_[name] Specify the user name of the user whose setting you want to change. - - -# UserPasswordSet command -CMD_UserPasswordSet Set Password Authentication for User Auth Type and Set Password -CMD_UserPasswordSet_Help Use this to set Password Authentication as the auth type for a user that is registered on the security account database of the currently managed Virtual Hub. Password Authentication requires a user-defined password to be set for the user object in the security account database of the Virtual Hub and when a user attempts to connect to the Virtual Hub using this user name, they will be prompted to input a password and if it is the matching password, connection will be allowed. \nThe user password is actually saved in hash code which means even if the VPN Server setting file is analyzed, the original password cannot be deciphered. \nTo get the list of currently registered users, use the UserList command. \nThis command cannot be run on VPN Bridge. \nYou cannot execute this command for Virtual Hubs of VPN Servers operating as a member server on a cluster. -CMD_UserPasswordSet_Args UserPasswordSet [name] [/PASSWORD:password] -CMD_UserPasswordSet_[name] Specify the user name of the user whose setting you want to change. -CMD_UserPasswordSet_PASSWORD Specify the password to be set for the user. If this parameter is not specified a prompt will appear to input the password. - - -# UserCertSet command -CMD_UserCertSet Set Individual Certificate Authentication for User Auth Type and Set Certificate -CMD_UserCertSet_Help Use this to set Individual Certificate Authentication as the Auth Type for a user that is registered on the security account database of the currently managed Virtual Hub. Individual Certificate Authentication requires one X.509 format certificate to be set for the user object in the security account database of the Virtual Hub and when a user attempts to connect to the Virtual Hub using this user name, an RSA algorithm is used to verify if the provided certificate matches the registered certificate and whether the client holds a private key that corresponds to that certificate and if so, connection is allowed. \nTo get the list of currently registered users, use the UserList command. \nThis command cannot be run on VPN Bridge. \nYou cannot execute this command for Virtual Hubs of VPN Servers operating as a member server on a cluster. -CMD_UserCertSet_Args UserCertSet [name] [/LOADCERT:cert] -CMD_UserCertSet_[name] Specify the user name of the user whose setting you want to change. -CMD_UserCertSet_LOADCERT Specify the certificate to set for the user by specifying an X.509 format certificate file. - - -# UserCertGet command -CMD_UserCertGet Get Certificate Registered for Individual Certificate Authentication User -CMD_UserCertGet_Help Use this to get an X.509 format certificate registered for a user of Individual Certificate Authentication who is registered in the security account database of the currently managed Virtual Hub and save it to file. \nIf the specified user is not set as Individual Certificate Authentication an error will occur. \nTo get the list of currently registered users, use the UserList command. \nThis command cannot be run on VPN Bridge. \nYou cannot execute this command for Virtual Hubs of VPN Servers operating as a member server on a cluster. -CMD_UserCertGet_Args UserCertGet [name] [/SAVECERT:cert] -CMD_UserCertGet_[name] Specify the user name of the user whose information you want to get. -CMD_UserCertGet_SAVECERT Specify the file name to save, in X.509 format, the user certificate you obtained. -CMD_UserCertGet_Not_Cert Either the user is not set as individual certificate authentication or a unique certificate is not set. - - -# UserSignedSet command -CMD_UserSignedSet Set Signed Certificate Authentication for User Auth Type -CMD_UserSignedSet_Help Use this to set Signed Certificate Authentication as the auth type for a user that is registered on the security account database of the currently managed Virtual Hub. When a user connects to a Virtual Hub using a user name that is set for signed certificate authentication, an RSA algorithm is used to verify whether the certificate provided by the user is signed by any of the certificates in the list of trusted CA certificates of that Virtual Hub and whether the client holds a private key that corresponds with that certificate, and if so, connection is allowed. \nIt is also possible to set the connection to be allowed only when a certificate common name (CN) and serial number that is expected for each user is registered and the contents of the certificate after the abovementioned verification is passed matches the set value. \nTo get the list of currently registered users, use the UserList command. \nThis command cannot be run on VPN Bridge. \nYou cannot execute this command for Virtual Hubs of VPN Servers operating as a member server on a cluster. -CMD_UserSignedSet_Args UserSignedSet [name] [/CN:cn] [/SERIAL:serial] -CMD_UserSignedSet_[name] Specify the user name of the user whose setting you want to change. -CMD_UserSignedSet_CN When this parameter is set, after it has been verified that the certificate that the user provided has been signed by the trusted certificate authority, connection will only be allowed when the value of the common name (CN) of this certificate is compared with the value set by this parameter and the values match. When "none" is specified, this check is not made. -CMD_UserSignedSet_SERIAL When this parameter is set, after it has been verified that the certificate that the user provided has been signed by the trusted certificate authority, connection will only be allowed when the value of the serial number of this certificate is compared with the value set by this parameter and the values match. When "none" is specified, this check is not made. -CMD_UserSignedSet_Prompt_CN Limit of Common Name (CN) Value: -CMD_UserSignedSet_Prompt_SERIAL Limit of Serial Number Value: - - -# UserRadiusSet command -CMD_UserRadiusSet Set RADIUS Authentication for User Auth Type -CMD_UserRadiusSet_Help Use this to set RADIUS Authentication as the auth type for a user that is registered on the security account database of the currently managed Virtual Hub. When a user connects to a Virtual Hub using a user name that is set for RADIUS authentication, the user name and the user input password is sent to the RADIUS server where the RADIUS SERVER checks the user name and password, then if the verification is successful, that user is allowed VPN connection. \nIn order to user RADIUS authentication, the RADIUS server used for this verification must be set in the Virtual Hub beforehand by using the RadiusServerSet command. \nTo get the list of currently registered users, use the UserList command. \nThis command cannot be run on VPN Bridge. \nYou cannot execute this command for Virtual Hubs of VPN Servers operating as a member server on a cluster. -CMD_UserRadiusSet_Args UserRadiusSet [name] [/ALIAS:alias_name] -CMD_UserRadiusSet_[name] Specify the user name of the user whose setting you want to change. -CMD_UserRadiusSet_ALIAS When this parameter is set, it is possible to make the user name sent to the RADIUS server different to the user name on the Virtual Hub. When this is not set, please specify /ALIAS:none (the user name on the Virtual Hub will be used). If the user name is "*", the /ALIAS parameter will be ignored. To read an explanation of the "*" user, please input UserCreate/HELP to display this information. -CMD_UserRadiusSet_Prompt_ALIAS Alias Name for Authentication (Optional): - - -# UserNTLMSet コマンド -CMD_UserNTLMSet Set NT Domain Authentication for User Auth Type -CMD_UserNTLMSet_Help Use this to set NT Domain Authentication as the auth type for a user that is registered on the security account database of the currently managed Virtual Hub. When a user connects to a Virtual Hub using a user name that is set for NT Domain authentication, the user name and the user input password is sent to the Windows NT / 2000 / Server 2003 / Server 2008 / Server 2008 R2 / Server 2012 Domain Controller or Active Directory Server where the server checks the user name and password, then if the verification is successful, that user is allowed VPN connection. \nTo use NT Domain authentication, the VPN Server must be operating on a Windows NT 4.0, Windows 2000, Windows XP, Windows Vista, Windows Server 2008, Windows Server 2008 R2 or Windows Server 2012 operating system that is connected to that domain. For details please contact the VPN Server's administrator. \nTo get the list of currently registered users, use the UserList command. \nThis command cannot be run on VPN Bridge. \nYou cannot execute this command for Virtual Hubs of VPN Servers operating as a member server on a cluster. -CMD_UserNTLMSet_Args UserNTLMSet [name] [/ALIAS:alias_name] -CMD_UserNTLMSet_[name] Specify the user name of the user whose setting you want to change. -CMD_UserNTLMSet_ALIAS When this parameter is set, it is possible to make the user name sent to the NT Domain or Active Directory server different to the user name on the Virtual Hub. When this is not set, please specify /ALIAS:none (the user name on the Virtual Hub will be used). If the user name is "*", the /ALIAS parameter will be ignored. To read an explanation of the "*" user, please input UserCreate/HELP to display this information. - - -# UserPolicyRemove command -CMD_UserPolicyRemove Delete User Security Policy -CMD_UserPolicyRemove_Help Use this to delete the security policy setting that is set for a user that is registered on the security account database of the currently managed Virtual Hub. A user who has had their security policy setting deleted will be assigned the security policy setting of the group that user is assigned to. In the cases where the user is not assigned to a group or when a security policy setting has not been set for the group, the default values (Allow Access: Enabled, Maximum Number of TCP Connections: 32, Time-out Period: 20 seconds) will be applied. \nTo get the list of currently registered users, use the UserList command. \nThis command cannot be run on VPN Bridge. \nYou cannot execute this command for Virtual Hubs of VPN Servers operating as a member server on a cluster. -CMD_UserPolicyRemove_Args UserPolicyRemove [name] -CMD_UserPolicyRemove_[name] Specify the user name of the user whose setting you want to change. - - -# UserPolicySet command -CMD_UserPolicySet Set User Security Policy -CMD_UserPolicySet_Help Use this to set the security policy contents that are set for a user that is registered on the security account database of the currently managed Virtual Hub. \nWhen a user has not been set a security policy, use this to change the specified values after a new default security policy has been set. \nTo get the list of currently registered users, use the UserList command. \nThis command cannot be run on VPN Bridge. \nYou cannot execute this command for Virtual Hubs of VPN Servers operating as a member server on a cluster. -CMD_UserPolicySet_Args UserPolicySet [name] [/NAME:policy_name] [/VALUE:num|yes|no] -CMD_UserPolicySet_[name] Specify the user name of the user whose setting you want to change. -CMD_UserPolicySet_NAME Specify the name of policy whose values you want to change. You can use the PolicyList command to display a list of policy names and values that can be set. -CMD_UserPolicySet_VALUE Specify a new policy value. If the policy is an integer value, specify an integer. Specify yes or no for Boolean types. You can view the type and value that can be set by using the PolicyList command. - - -# UserExpiresSet command -CMD_UserExpiresSet Set User's Expiration Date -CMD_UserExpiresSet_Help Use this to set the user's expiration date that is registered on the security account database of the currently managed Virtual Hub. A user whose expiration date has expired cannot connect to the Virtual Hub. \nTo get the list of currently registered users, use the UserList command. \nThis command cannot be run on VPN Bridge. \nYou cannot execute this command for Virtual Hubs of VPN Servers operating as a member server on a cluster. -CMD_UserExpiresSet_Args UserExpiresSet [name] [/EXPIRES:expires] -CMD_UserExpiresSet_[name] Specify the user name of the user whose setting you want to change. -CMD_UserExpiresSet_EXPIRES Specify the user expiration date and time. The date and time must be in the same format as "2005/10/08 19:30:00" where 6 integers are specified, representing year/month/day hour:minute:second separated by forward slashes, a space and then colons. Specify 4 digits for the year. If you put a space in a value, the entire value must be enclosed by "". For this specification, local time (standard time for the computer on which the command line management utility is running) can be specified. By specifying /EXPIRES:none, you can remove the expiration date restriction. -CMD_UserExpiresSet_Prompt_EXPIRES User Expiration Date (no expiration if nothing specified): - - -# GroupList command -CMD_GroupList Get List of Groups -CMD_GroupList_Help Use this to get a list of groups that are registered on the security account database of the currently managed Virtual Hub. \nThis command cannot be run on VPN Bridge. \nYou cannot execute this command for Virtual Hubs of VPN Servers operating as a member server on a cluster. -CMD_GroupList_Args GroupList - - -# GroupCreate command -CMD_GroupCreate Create Group -CMD_GroupCreate_Help Use this to create a new group in the security account database of the currently managed Virtual Hub. \nYou can register multiple users in a group. To register users in a group use the GroupJoin command. \nThis command cannot be run on VPN Bridge. \nYou cannot execute this command for Virtual Hubs of VPN Servers operating as a member server on a cluster. -CMD_GroupCreate_Args GroupCreate [name] [/REALNAME:realname] [/NOTE:note] -CMD_GroupCreate_[name] Specify the name of the group to create. -CMD_GroupCreate_REALNAME Specify the group's full name. For example, if the group corresponds to an actual section or department name, specify that name. If you are not specifying this, specify /REALNAME:none -CMD_GroupCreate_NOTE Specify a description of the group. If you are not specifying this, specify /NOTE:none -CMD_GroupCreate_Prompt_NAME Group Name: -CMD_GroupCreate_Prompt_REALNAME Group Full Name: -CMD_GroupCreate_Prompt_NOTE Group Description: - - -# GroupSet command -CMD_GroupSet Set Group Information -CMD_GroupSet_Help Use this to set group information that is registered on the security account database of the currently managed Virtual Hub. \nTo get the list of currently registered groups, use the GroupList command. \nThis command cannot be run on VPN Bridge. \nYou cannot execute this command for Virtual Hubs of VPN Servers operating as a member server on a cluster. -CMD_GroupSet_Args GroupSet [name] [/REALNAME:realname] [/NOTE:note] -CMD_GroupSet_[name] Specify the group name of the group whose setting you want to change. -CMD_GroupSet_REALNAME Specify the group's Full name. For example, if the group corresponds to an actual section or department name, specify that name. If you are not specifying this, specify /REALNAME:none -CMD_GroupSet_NOTE Specify a description of the group. If you are not specifying this, specify /NOTE:none. - - -# GroupDelete command -CMD_GroupDelete Delete Group -CMD_GroupDelete_Help Use this to delete a group that is registered on the security account database of the currently managed Virtual Hub. \nWhen you delete a group all users assigned to that group will become unassigned. \nTo get the list of currently registered groups, use the GroupList command. \nThis command cannot be run on VPN Bridge. \nYou cannot execute this command for Virtual Hubs of VPN Servers operating as a member server on a cluster. -CMD_GroupDelete_Args GroupDelete [name] -CMD_GroupDelete_[name] Specify the name of the group to delete. - - -# GroupGet command -CMD_GroupGet Get Group Information and List of Assigned Users -CMD_GroupGet_Help Use this to get the information of a group that is registered on the security account database of the currently managed Virtual Hub as well as a list of users assigned to that group. \nTo get the list of currently registered groups, use the GroupList command. \nThis command cannot be run on VPN Bridge. \nYou cannot execute this command for Virtual Hubs of VPN Servers operating as a member server on a cluster. -CMD_GroupGet_Args GroupGet [name] -CMD_GroupGet_[name] Specify the group name of the group whose information you want to get. -CMD_GroupGet_Column_NAME Group Name -CMD_GroupGet_Column_REALNAME Full Name -CMD_GroupGet_Column_NOTE Description -CMD_GroupGet_Column_POLICY This is the security policy that is set for this group. -CMD_GroupGet_Column_MEMBERS This is a list of user names of users who are assigned to this group. - - -# GroupJoin command -CMD_GroupJoin Add User to Group -CMD_GroupJoin_Help Use this to add a user in the security account database of the currently managed Virtual Hub to a group that is registered on that security account database. \nTo get a list of users and groups that are currently registered, use the UserList command and the GroupList command. \nThis command cannot be run on VPN Bridge. \nYou cannot execute this command for Virtual Hubs of VPN Servers operating as a member server on a cluster. -CMD_GroupJoin_Args GroupJoin [name] [/USERNAME:username] -CMD_GroupJoin_[name] Specify the group name of the group to which you want to add a user. -CMD_GroupJoin_USERNAME Specify the user name of the user you want to add to the group specified by "name". -CMD_GroupJoin_Prompt_USERNAME Name of User to Join Group: - - -# GroupUnjoin command -CMD_GroupUnjoin Delete User from Group -CMD_GroupUnjoin_Help Use this to delete a specified user from the group that is registered on the security account database of the currently managed Virtual Hub. By deleting a user from the group, that user becomes unassigned. \nTo get a list of users that are currently assigned to a group, use the GroupGet command. \nTo get the list of currently registered groups, use the GroupList command. \nThis command cannot be run on VPN Bridge. \nYou cannot execute this command for Virtual Hubs of VPN Servers operating as a member server on a cluster. -CMD_GroupUnjoin_Args GroupUnjoin [name] -CMD_GroupUnjoin_[name] Specify the name of the user to delete from the group. -CMD_GroupUnjoin_Prompt_name Name of User to Delete from Group: - - -# GroupPolicyRemove command -CMD_GroupPolicyRemove Delete Group Security Policy -CMD_GroupPolicyRemove_Help Use this to delete the security policy setting that is set for a group that is registered on the security account database of the currently managed Virtual Hub. Users who do not have a security policy set for the user themselves or for the group they are assigned to, will have the default values (Allow Access: Enabled, Maximum Number of TCP Connections: 32, Time-out Period: 20 seconds) applied to them. \nTo get the list of currently registered groups, use the GroupList command. \nThis command cannot be run on VPN Bridge. \nYou cannot execute this command for Virtual Hubs of VPN Servers operating as a member server on a cluster. -CMD_GroupPolicyRemove_Args GroupPolicyRemove [name] -CMD_GroupPolicyRemove_[name] Specify the group name of the group whose setting you want to change. - - -# GroupPolicySet command -CMD_GroupPolicySet Set Group Security Policy -CMD_GroupPolicySet_Help Use this to set the security policy contents that are set for a group that is registered on the security account database of the currently managed Virtual Hub. \nWhen a group has not been set a security policy, use this to change the specified values after a new default security policy has been set. \nTo get the list of currently registered groups, use the GroupList command. \nThis command cannot be run on VPN Bridge. \nYou cannot execute this command for Virtual Hubs of VPN Servers operating as a member server on a cluster. -CMD_GroupPolicySet_Args GroupPolicySet [name] [/NAME:policy_name] [/VALUE:num|yes|no] -CMD_GroupPolicySet_[name] Specify the group name of the group whose setting you want to change. -CMD_GroupPolicySet_NAME Specify the name of policy whose values you want to change. You can use the PolicyList command to display a list of policy names and values that can be set. -CMD_GroupPolicySet_VALUE Specify a new policy value. If the policy is an integer value, specify an integer. Specify yes or no for Boolean types. You can view the type and value that can be set by using the PolicyList command. - - -# SessionList command -CMD_SessionList Get List of Connected Sessions -CMD_SessionList_Help Use this to get a list of the sessions connected to the Virtual Hub currently being managed. In the list of sessions, the following information will be displayed for each connection: Session Name, Session Site, User Name, Source Host Name, TCP Connection, Transfer Bytes and Transfer Packets. \nIf the currently connected VPN Server is a cluster controller and the currently managed Virtual Hub is a static Virtual Hub, you can get an all-linked-together list of all sessions connected to that Virtual Hub on all cluster members. \nIn all other cases, only the list of sessions that are actually connected to the currently managed VPN Server will be obtained. -CMD_SessionList_Args SessionList - - -# SessionGet command -CMD_SessionGet Get Session Information -CMD_SessionGet_Help Use this to specify a session currently connected to the currently managed Virtual Hub and get the session information. The session information includes the following: source host name and user name, version information, time information, number of TCP connections, communication parameters, session key, statistical information on data transferred, and other client and server information. \nTo get the list of currently connected sessions, use the SessionList command. -CMD_SessionGet_Args SessionGet [name] -CMD_SessionGet_[name] Specify the session name of the session whose information you want to get. -CMD_SessionGet_Prompt_NAME Session name: - - -# SessionDisconnect command -CMD_SessionDisconnect Disconnect Session -CMD_SessionDisconnect_Help Use this to specify a session currently connected to the currently managed Virtual Hub and forcefully disconnect that session using manager privileges. \nNote that when communication is disconnected by settings on the source client side and the automatically reconnect option is enabled, it is possible that the client will reconnect. \nTo get the list of currently connected sessions, use the SessionList command. -CMD_SessionDisconnect_Args SessionDisconnect [name] -CMD_SessionDisconnect_[name] Specify the session name of the session to disconnect. - - -# MacTable command -CMD_MacTable Get the MAC Address Table Database -CMD_MacTable_Help Use this to get the MAC address table database that is held by the currently managed Virtual Hub. \nThe MAC address table database is a table that the Virtual Hub requires to perform the action of switching Ethernet frames and the Virtual Hub decides the sorting destination session of each Ethernet frame based on the MAC address table database. The MAC address database is built by the Virtual Hub automatically analyzing the contents of the communication throughput. \nBy specifying the session name you can get the MAC address table entry that has been associated with that session. -CMD_MacTable_Args MacTable [session_name] -CMD_MacTable_[session_name] By specifying the session name as a parameter, you can display only the MAC address table entry that is associated with that session. When this is left unspecified, all the entries will be displayed. - - -# MacDelete command -CMD_MacDelete Delete MAC Address Table Entry -CMD_MacDelete_Help Use this command to operate the MAC address table database held by the currently managed Virtual Hub and delete a specified MAC address table entry from the database. \nTo get the contents of the current MAC address table database use the MacTable command. -CMD_MacDelete_Args MacDelete [id] -CMD_MacDelete_[id] Specify the ID of the MAC address table entry to delete. -CMD_MacDelete_Prompt ID to Delete: - - -# IpTable command -CMD_IpTable Get the IP Address Table Database -CMD_IpTable_Help Use this to get the IP address table database that is held by the currently managed Virtual Hub. \nThe IP address table database is a table that is automatically generated by analyzing the contents of communication so that the Virtual Hub can always know which session is using which IP address and it is frequently used by the engine that applies the Virtual Hub security policy. \nBy specifying the session name you can get the IP address table entry that has been associated with that session. -CMD_IpTable_Args IpTable [session_name] -CMD_IpTable_[session_name] By specifying the session name as a parameter, you can display only the IP address table entry that is associated with that session. When this is left unspecified, all the entries will be displayed. - - -# IpDelete command -CMD_IpDelete Delete IP Address Table Entry -CMD_IpDelete_Help Use this command to operate the IP address table database held by the currently managed Virtual Hub and delete a specified IP address table entry from the database. \nTo get the contents of the current IP address table database use the IpTable command. -CMD_IpDelete_Args IpDelete [id] -CMD_IpDelete_[id] Specify the ID of the IP address table entry to delete. - - -# SecureNatEnable command -CMD_SecureNatEnable Enable the Virtual NAT and DHCP Server Function (SecureNat Function) -CMD_SecureNatEnable_Help Use this to enable the Virtual NAT and DHCP Server function (SecureNat Function) on the currently managed Virtual Hub and begin its operation. Before executing this command, you must first check the setting contents of the current Virtual NAT function and DHCP Server function using the SecureNatHostGet command, NatGet command and DhcpGet command. \nBy enabling the SecureNAT function, you can virtually operate a NAT router (IP masquerade) and the DHCP Server function on a virtual network on the Virtual Hub. \n\n[Warning about SecureNAT Function]\nThe SecureNAT function is recommended only for system administrators and people with a detailed knowledge of networks. \nIf you use the SecureNAT function correctly, it is possible to achieve a safe form of remote access via a VPN. However when used in the wrong way, it can put the entire network in danger. Anyone who does not have a thorough knowledge of networks and anyone who does not have the network administrator's permission must not enable the SecureNAT function. For a detailed explanation of the SecureNAT function, please refer to the VPN Server's manual and online documentation. \nYou cannot execute this command for Virtual Hubs of VPN Servers operating as a cluster. -CMD_SecureNatEnable_Args SecureNatEnable - - -# SecureNatDisable command -CMD_SecureNatDisable Disable the Virtual NAT and DHCP Server Function (SecureNat Function) -CMD_SecureNatDisable_Help Use this to disable the Virtual NAT and DHCP Server function (SecureNat Function) on the currently managed Virtual Hub. By executing this command the Virtual NAT function immediately stops operating and the Virtual DHCP Server function deletes the DHCP lease database and stops the service. \nYou cannot execute this command for Virtual Hubs of VPN Servers operating as a cluster. -CMD_SecureNatDisable_Args SecureNatDisable - - -# SecureNatStatusGet command -CMD_SecureNatStatusGet Get the Operating Status of the Virtual NAT and DHCP Server Function (SecureNat Function) -CMD_SecureNatStatusGet_Help Use this to get the operating status of the Virtual NAT and DHCP Server function (SecureNat Function) when it is operating on the currently managed Virtual Hub. \nYou cannot execute this command for Virtual Hubs of VPN Servers operating as a cluster. -CMD_SecureNatStatusGet_Args SecureNatStatusGet - - -# SecureNatHostGet command -CMD_SecureNatHostGet Get Network Interface Setting of Virtual Host of SecureNAT Function -CMD_SecureNatHostGet_Help Use this to get the virtual host network interface setting from the setting items of the Virtual NAT and DHCP Server function (SecureNAT function) on the currently managed Virtual Hub. \nThe SecureNAT function holds one virtual network adapter on the L2 segment inside the Virtual Hub and it has been assigned a MAC address and an IP address. By doing this, another host connected to the same L2 segment is able to communicate with the SecureNAT virtual host as if it is an actual IP host existing on the network. \n\n[Warning about SecureNAT Function]\nThe SecureNAT function is recommended only for system administrators and people with a detailed knowledge of networks. \nIf you use the SecureNAT function correctly, it is possible to achieve a safe form of remote access via a VPN. However when used in the wrong way, it can put the entire network in danger. Anyone who does not have a thorough knowledge of networks and anyone who does not have the network administrators permission must not enable the SecureNAT function. For a detailed explanation of the SecureNAT function, please refer to the VPN Server's manual and online documentation. \nYou cannot execute this command for Virtual Hubs of VPN Servers operating as a cluster. -CMD_SecureNatHostGet_Args SecureNatHostGet -CMD_SecureNatHostGet_Column_MAC MAC Address -CMD_SecureNatHostGet_Column_IP IP Address -CMD_SecureNatHostGet_Column_MASK Subnet Mask -CMD_SecureNatHostGet_Column_LOG Save NAT and DHCP Operation Log - - -# SecureNatHostSet command -CMD_SecureNatHostSet Change Network Interface Setting of Virtual Host of SecureNAT Function -CMD_SecureNatHostSet_Help Use this to change and save the virtual host network interface setting in the setting items of the Virtual NAT and DHCP Server function (SecureNAT function) on the currently managed Virtual Hub. \nThe SecureNAT function holds one virtual network adapter on the L2 segment inside the Virtual Hub and it has been assigned a MAC address and an IP address. By doing this, another host connected to the same L2 segment is able to communicate with the SecureNAT virtual host as if it is an actual IP host existing on the network. \n\n[Warning about SecureNAT Function]\nThe SecureNAT function is recommended only for system administrators and people with a detailed knowledge of networks. \nIf you use the SecureNAT function correctly, it is possible to achieve a safe form of remote access via a VPN. However when used in the wrong way, it can put the entire network in danger. Anyone who does not have a thorough knowledge of networks and anyone who does not have the network administrators permission must not enable the SecureNAT function. For a detailed explanation of the SecureNAT function, please refer to the VPN Server's manual and online documentation. \nYou cannot execute this command for Virtual Hubs of VPN Servers operating as a cluster. -CMD_SecureNatHostSet_Args SecureNatHostSet [/MAC:mac] [/IP:ip] [/MASK:mask] -CMD_SecureNatHostSet_MAC Specify the MAC address to assign for the virtual interface. Specify a MAC address using a string like "00-AC-01-23-45-67". When /MAC:none is specified, no changes will be made to the current setting. -CMD_SecureNatHostSet_IP Specify the IP address to assign for the virtual interface. When /IP:none is specified, no changes will be made to the current setting. -CMD_SecureNatHostSet_MASK Specify the subnet mask to assign for the virtual interface. When /MASK:none is specified, no changes will be made to the current setting. -CMD_SecureNatHostSet_Prompt_MAC MAC Address: -CMD_SecureNatHostSet_Prompt_IP IP Address: -CMD_SecureNatHostSet_Prompt_MASK Subnet Mask: - - -# NatGet command -CMD_NatGet Get Virtual NAT Function Setting of SecureNAT Function -CMD_NatGet_Help Use this to get the virtual NAT setting from the setting items of the Virtual NAT and DHCP Server function (SecureNAT function) on the currently managed Virtual Hub. \nYou cannot execute this command for Virtual Hubs of VPN Servers operating as a cluster. -CMD_NatGet_Args NatGet -CMD_NatGet_Column_USE Use Virtual NAT Function -CMD_NetGet_Column_MTU MTU Value -CMD_NatGet_Column_TCP TCP Session Timeout (Seconds) -CMD_NatGet_Column_UDP UDP Session Timeout (Seconds) - - -# NatEnable command -CMD_NatEnable Enable Virtual NAT Function of SecureNAT Function -CMD_NatEnable_Help Use this to enable the Virtual NAT function on the currently managed Virtual Hub. \nIf the SecureNAT function is still not operating even after this command has been used to enable the Virtual NAT function, Virtual NAT is not operating. To start the operation of the SecureNAT Function, use the SecureNatEnable command. \nYou cannot execute this command for Virtual Hubs of VPN Servers operating as a cluster. -CMD_NatEnable_Args NatEnable - - -# NatDisable command -CMD_NatDisable Disable Virtual NAT Function of SecureNAT Function -CMD_NatDisable_Help Use this to disable the Virtual NAT function on the currently managed Virtual Hub. \nYou cannot execute this command for Virtual Hubs of VPN Servers operating as a cluster. -CMD_NatDisable_Args NatDisable - - -# NatSet command -CMD_NatSet Change Virtual NAT Function Setting of SecureNAT Function -CMD_NatSet_Help Use this to change the Virtual NAT setting of the currently managed Virtual Hub. The contents of the Virtual NAT setting includes: MTU value, TCP session timeout and UDP session timeout \nYou cannot execute this command for Virtual Hubs of VPN Servers operating as a cluster. -CMD_NatSet_Args NatSet [/MTU:mtu] [/TCPTIMEOUT:tcp_timeout] [/UDPTIMEOUT:udp_timeout] [/LOG:yes|no] -CMD_NatSet_MTU Set the MTU (Maximum transferable unit size) using an integer to specify the byte length unit. This value is the maximum payload length excluding the MAC header of the Ethernet frame that the Virtual NAT sends and the default is 1500 bytes. -CMD_NatSet_TCPTIMEOUT This sets how many seconds a condition of non-communication continues in a TCP session that the Virtual NAT is relaying before a timeout occurs and the session is discarded. -CMD_NatSet_UDPTIMEOUT This sets how many seconds a condition of non-communication continues in a UDP session that the Virtual NAT is relaying before a timeout occurs and the session is discarded. -CMD_NatSet_LOG Specify whether or not to save the Virtual NAT operation in the Virtual Hub security log. Specify "yes" to save it, and "no" to not save it. -CMD_NatSet_Prompt_MTU MTU Value: -CMD_NatSet_Prompt_TCPTIMEOUT TCP Session Timeout (Seconds): -CMD_NatSet_Prompt_UDPTIMEOUT UDP Session Timeout (Seconds): -CMD_NatSet_Prompt_LOG Save Log (yes / no): -CMD_NatSet_Eval_MTU Specify a value in the range %d to %d for the MTU value. -CMD_NatSet_Eval_TCP Specify the number of seconds in the range %d to %d for the TCP session timeout. -CMD_NatSet_Eval_UDP Specify the number of seconds in the range %d to %d for the UDP session timeout. - - -# NatTable command -CMD_NatTable Get Virtual NAT Function Session Table of SecureNAT Function -CMD_NatTable_Help Use this to get the table of TCP and UDP sessions currently communicating via the Virtual NAT (NAT table) in cases when the Virtual NAT function is operating on the currently managed Virtual Hub. \nYou cannot execute this command for Virtual Hubs of VPN Servers operating as a cluster. -CMD_NatTable_Args NatTable - - -# DhcpGet command -CMD_DhcpGet Get Virtual DHCP Server Function Setting of SecureNAT Function -CMD_DhcpGet_Help Use this to get the virtual DHCP Server setting from the setting items of the Virtual NAT and DHCP Server function (SecureNAT function) on the currently managed Virtual Hub. \nYou cannot execute this command for Virtual Hubs of VPN Servers operating as a cluster. -CMD_DhcpGet_Args DhcpGet -CMD_DhcpGet_Column_Log Record Log of NAT and DHCP Operation -CMD_DhcpGet_Column_USE Use Virtual DHCP Function -CMD_DhcpGet_Column_IP1 Start Distribution Address Band -CMD_DhcpGet_Column_IP2 End Distribution Address Band -CMD_DhcpGet_Column_MASK Subnet Mask -CMD_DhcpGet_Column_LEASE Lease Limit (Seconds) -CMD_DhcpGet_Column_GW Default Gateway Address -CMD_DhcpGet_Column_DNS DNS Server Address 1 -CMD_DhcpGet_Column_DNS2 DNS Server Address 2 -CMD_DhcpGet_Column_DOMAIN Domain Name -CMD_DhcpGet_Column_PUSHROUTE Static Routing Table to Push - - -# DhcpEnable command -CMD_DhcpEnable Enable Virtual DHCP Server Function of SecureNAT Function -CMD_DhcpEnable_Help Use this to enable the Virtual DHCP Server function on the currently managed Virtual Hub. \nIf the SecureNAT function is still not operating even after this command has been used to enable the Virtual DHCP function, Virtual DHCP Server is not operating. To start the operation of the SecureNAT Function, use the SecureNatEnable command. \nYou cannot execute this command for Virtual Hubs of VPN Servers operating as a cluster. -CMD_DhcpEnable_Args DhcpEnable - - -# DhcpDisable command -CMD_DhcpDisable Disable Virtual DHCP Server Function of SecureNAT Function -CMD_DhcpDisable_Help Use this to disable the Virtual DHCP Server function on the currently managed Virtual Hub. \nYou cannot execute this command for Virtual Hubs of VPN Servers operating as a cluster. -CMD_DhcpDisable_Args DhcpDisable - - -# DhcpSet command -CMD_DhcpSet Change Virtual DHCP Server Function Setting of SecureNAT Function -CMD_DhcpSet_Help Use this to change the Virtual DHCP Server setting of the currently managed Virtual Hub. The Virtual DHCP Server settings include the following items: distribution address band, subnet mask, lease limit, and option values assigned to clients. \nYou cannot execute this command for Virtual Hubs of VPN Servers operating as a cluster. -CMD_DhcpSet_Args DhcpSet [/START:start_ip] [/END:end_ip] [/MASK:subnetmask] [/EXPIRE:sec] [/GW:gwip] [/DNS:dns] [/DNS2:dns2][/DOMAIN:domain] [/LOG:yes|no] [/PUSHROUTE:"routing_table"] -CMD_DhcpSet_START Specify the start point of the address band to be distributed to the client. (Example: 192.168.30.10) -CMD_DhcpSet_END Specify the end point of the address band to be distributed to the client. (Example: 192.168.30.200) -CMD_DhcpSet_MASK Specify the subnet mask to be specified for the client. (Example: 255.255.255.0) -CMD_DhcpSet_EXPIRE Specify the expiration date in second units for leasing an IP address to a client. -CMD_DhcpSet_GW Specify the IP address of the default gateway to be notified to the client. You can specify a SecureNAT Virtual Host IP address for this when the SecureNAT Function's Virtual NAT Function has been enabled and is being used also. If you specify 0 or none, then the client will not be notified of the default gateway. -CMD_DhcpSet_DNS Specify the IP address of the primary DNS Server to be notified to the client. You can specify a SecureNAT Virtual Host IP address for this when the SecureNAT Function's Virtual NAT Function has been enabled and is being used also. If you specify 0 or none, then the client will not be notified of the DNS Server address. -CMD_DhcpSet_DNS2 Specify the IP address of the secondary DNS Server to be notified to the client. You can specify a SecureNAT Virtual Host IP address for this when the SecureNAT Function's Virtual NAT Function has been enabled and is being used also. If you specify 0 or none, then the client will not be notified of the DNS Server address. -CMD_DhcpSet_DOMAIN Specify the domain name to be notified to the client. If you specify none, then the client will not be notified of the domain name. -CMD_DhcpSet_LOG Specify whether or not to save the Virtual DHCP Server operation in the Virtual Hub security log. Specify "yes" to save it. This value is interlinked with the Virtual NAT Function log save setting. -CMD_DhcpSet_PUSHROUTE Specify the static routing table to push.\nExample: "192.168.5.0/255.255.255.0/192.168.4.254, 10.0.0.0/255.0.0.0/192.168.4.253"\nSplit multiple entries (maximum: 64 entries) by comma or space characters. Each entry must be specified in the "IP network address/subnet mask/gateway IP address" format.\nThis Virtual DHCP Server can push the classless static routes (RFC 3442) with DHCP reply messages to VPN clients.\nWhether or not a VPN client can recognize the classless static routes (RFC 3442) depends on the target VPN client software. SoftEther VPN Client and OpenVPN Client are supporting the classless static routes. On L2TP/IPsec and MS-SSTP protocols, the compatibility depends on the implementation of the client software. You can realize the split tunneling if you clear the default gateway field on the Virtual DHCP Server options. On the client side, L2TP/IPsec and MS-SSTP clients need to be configured not to set up the default gateway for the split tunneling usage.\nYou can also push the classless static routes (RFC 3442) by your existing external DHCP server. In that case, disable the Virtual DHCP Server function on SecureNAT, and you need not to set up the classless routes on this command.\nSee the RFC 3442 to understand the classless routes. -CMD_DhcpSet_Prompt_START Start Point for Distributed Address Band: -CMD_DhcpSet_Prompt_END End Point for Distributed Address Band: -CMD_DhcpSet_Prompt_MASK Subnet Mask: -CMD_DhcpSet_Prompt_EXPIRE Lease Limit (Seconds): -CMD_DhcpSet_Prompt_GW Default Gateway ('none' to not set this): -CMD_DhcpSet_Prompt_DNS DNS Server 1 ('none' to not set this): -CMD_DhcpSet_Prompt_DNS2 DNS Server 2 ('none' to not set this): -CMD_DhcpSet_Prompt_DOMAIN Domain Name: - - -# DhcpTable command -CMD_DhcpTable Get Virtual DHCP Server Function Lease Table of SecureNAT Function -CMD_DhcpTable_Help Use this to get the lease table of IP addresses, held by the Virtual DHCP Server, that are assigned to clients in cases when the Virtual NAT function is operating on the currently managed Virtual Hub. \nYou cannot execute this command for Virtual Hubs of VPN Servers operating as a cluster. -CMD_DhcpTable_Args DhcpTable - - -# AdminOptionList command -CMD_AdminOptionList Get List of Virtual Hub Administration Options -CMD_AdminOptionList_Help Use this to get a list of Virtual Hub administration options that are set on the currently managed Virtual Hub. \nThe purpose of the Virtual Hub administration options is for the VPN Server Administrator to set limits for the setting ranges when the administration of the Virtual Hub is to be trusted to each Virtual Hub administrator. \nOnly an administrator with administration privileges for this entire VPN Server is able to add, edit and delete the Virtual Hub administration options. The Virtual Hub administrators are unable to make changes to the administration options, however they are able to view them. \nThere is an exception however. If allow_hub_admin_change_option is set to "1", even Virtual Hub administrators are able to edit the administration options. \nThis command cannot be run on VPN Bridge. \nYou cannot execute this command for Virtual Hubs of VPN Servers operating as a cluster member. -CMD_AdminOptionList_Args AdminOptionList - - -# AdminOptionSet command -CMD_AdminOptionSet Set Values of Virtual Hub Administration Options -CMD_AdminOptionSet_Help Use this to change the values of Virtual Hub administration options that are set on the currently managed Virtual Hub. \nThe purpose of the Virtual Hub administration options is for the VPN Server Administrator to set limits for the setting ranges when the administration of the Virtual Hub is to be trusted to each Virtual Hub administrator. \nOnly an administrator with administration privileges for this entire VPN Server is able to add, edit and delete the Virtual Hub administration options. The Virtual Hub administrators are unable to make changes to the administration options, however they are able to view them. \nThere is an exception however. If allow_hub_admin_change_option is set to "1", even Virtual Hub administrators are able to edit the administration options. \nThis command cannot be run on VPN Bridge. \nYou cannot execute this command for Virtual Hubs of VPN Servers operating as a cluster member. -CMD_AdminOptionSet_Args AdminOptionSet [name] [/VALUE:value] -CMD_AdminOptionSet_[name] Specify the name of the administration option whose value you want to change. You can get a list of names by using the AdminOptionList command. -CMD_AdminOptionSet_VALUE Specify an integer for the setting value. -CMD_AdminOptionSet_Prompt_name Name of Administration Option to Change Value: -CMD_AdminOptionSet_Prompt_VALUE Setting Value (Integer): - - -# ExtOptionList command -CMD_ExtOptionList Get List of Virtual Hub Extended Options -CMD_ExtOptionList_Help Use this to get a Virtual Hub Extended Options List that is set on the currently managed Virtual Hub.\nVirtual Hub Extended Option enables you to configure more detail settings of the Virtual Hub.\nBy default, both VPN Server's global administrators and individual Virtual Hub's administrators can modify the Virtual Hub Extended Options.\nHowever, if the deny_hub_admin_change_ext_option is set to 1 on the Virtual Hub Admin Options, the individual Virtual Hub's administrators cannot modify the Virtual Hub Extended Options.\nThis command cannot be run on VPN Bridge. \nYou cannot execute this command for Virtual Hubs of VPN Servers operating as a cluster member. -CMD_ExtOptionList_Args ExtOptionList - - -# ExtOptionSet command -CMD_ExtOptionSet Set a Value of Virtual Hub Extended Options -CMD_ExtOptionSet_Help Use this to set a value in the Virtual Hub Extended Options List that is set on the currently managed Virtual Hub.\nVirtual Hub Extended Option enables you to configure more detail settings of the Virtual Hub.\nBy default, both VPN Server's global administrators and individual Virtual Hub's administrators can modify the Virtual Hub Extended Options.\nHowever, if the deny_hub_admin_change_ext_option is set to 1 on the Virtual Hub Admin Options, the individual Virtual Hub's administrators cannot modify the Virtual Hub Extended Options.\nThis command cannot be run on VPN Bridge. \nYou cannot execute this command for Virtual Hubs of VPN Servers operating as a cluster member. -CMD_ExtOptionSet_Args ExtOptionSet [name] [/VALUE:value] -CMD_ExtOptionSet_[name] Specify the name of the Virtual Hub Extended Options whose value you want to change. You can get a list of names by using the ExtOptionList command. -CMD_ExtOptionSet_VALUE Specify an integer for the setting value. -CMD_ExtOptionSet_Prompt_name Name of Extended Option to Change Value: -CMD_ExtOptionSet_Prompt_VALUE Setting Value (Integer): - - -# CrlList command -CMD_CrlList Get List of Certificates Revocation List -CMD_CrlList_Help Use this to get a Certificates Revocation List that is set on the currently managed Virtual Hub. \nBy registering certificates in the Certificates Revocation List, the clients who provide these certificates will be unable to connect to this Virtual Hub using certificate authentication mode. \nNormally with this function, in cases where the security of a private key has been compromised or where a person holding a certificate has been stripped of their privileges, by registering that certificate as invalid on the Virtual Hub, it is possible to deny user authentication when that certificate is used by a client to connect to the Virtual Hub. \nThis command cannot be run on VPN Bridge. \nYou cannot execute this command for Virtual Hubs of VPN Servers operating as a cluster. -CMD_CrlList_Args CrlList - - -# CrlAdd command -CMD_CrlAdd Add a Revoked Certificate -CMD_CrlAdd_Help Use this to add a new revoked certificate definition in the Certificate Revocation List that is set on the currently managed Virtual Hub. \nSpecify the contents to be registered in the Certificate Revocation List by using the parameters of this command. When a user connects to a Virtual Hub in certificate authentication mode and that certificate matches 1 or more of the contents registered in the certificates revocation list, the user is denied connection. \nA certificate that matches all the conditions that are defined by the parameters specified by this command will be judged as invalid. \nThe items that can be set are as follows: Name (CN), Organization (O), Organization Unit (OU), Country (C), State (ST), Locale (L), Serial Number (hexadecimal), MD5 Digest Value (hexadecimal, 128 bit), and SHA-1 Digest Value (hexadecimal, 160 bit). For the specification of a digest value (hash value) a certificate is optionally specified depending on the circumstances. Normally when a MD5 or SHA-1 digest value is input, it is not necessary to input the other items. \nThis command cannot be run on VPN Bridge. \nYou cannot execute this command for Virtual Hubs of VPN Servers operating as a cluster. -CMD_CrlAdd_Args CrlAdd [/SERIAL:serial] [/MD5:md5] [/SHA1:sha1] [/CN:cn] [/O:o] [/OU:ou] [/C:c] [/ST:st] [/L:l] -CMD_CrlAdd_SERIAL Use this parameter to specify the value for the certificate serial number (hexadecimal) when it is set as a condition. -CMD_CrlAdd_MD5 Use this parameter to specify the value for the certificate MD5 digest value (hexadecimal, 128 bits) when it is set as a condition. If this parameter specification is other than a hexadecimal value of 32 characters (16 bytes), it will be ignored. -CMD_CrlAdd_SHA1 Use this parameter to specify the value for the certificate SHA1 digest value (hexadecimal, 160 bits) when it is set as a condition. If this parameter specification is other than a hexadecimal value of 40 characters (16 bytes), it will be ignored. -CMD_CrlAdd_CN Use this parameter to specify the name (CN) of the certificate when it is set as a condition. -CMD_CrlAdd_O Use this parameter to specify the organization (O) of the certificate when it is set as a condition. -CMD_CrlAdd_OU Use this parameter to specify the organization unit (OU) of the certificate when it is set as a condition. -CMD_CrlAdd_C Use this parameter to specify the country (C) of the certificate when it is set as a condition. -CMD_CrlAdd_ST Use this parameter to specify the state (ST) of the certificate when it is set as a condition. -CMD_CrlAdd_L Use this parameter to specify the locale (L) of the certificate when it is set as a condition. - - -# CrlDel command -CMD_CrlDel Delete a Revoked Certificate -CMD_CrlDel_Help Use this to specify and delete a revoked certificate definition from the certificate revocation list that is set on the currently managed Virtual Hub. \nTo get the list of currently registered revoked certificate definitions, use the CrlList command. \nThis command cannot be run on VPN Bridge. \nYou cannot execute this command for Virtual Hubs of VPN Servers operating as a cluster. -CMD_CrlDel_Args CrlDel [id] -CMD_CrlDel_[id] Specify the ID of the revoked certificate definition you want to delete. -CMD_CrlDel_Prompt_ID ID to Delete: - - -# CrlGet command -CMD_CrlGet Get a Revoked Certificate -CMD_CrlGet_Help Use this to specify and get the contents of a revoked certificate definition from the Certificates Revocation List that is set on the currently managed Virtual Hub. \nTo get the list of currently registered revoked certificate definitions, use the CrlList command. \nThis command cannot be run on VPN Bridge. \nYou cannot execute this command for Virtual Hubs of VPN Servers operating as a cluster. -CMD_CrlGet_Args CrlGet [id] -CMD_CrlGet_[id] Specify the ID of the revoked certificate definition you want to get. -CMD_CrlGet_Prompt_ID ID to Get: -CMD_CrlGet_CN Common Name (CN) -CMD_CrlGet_O Organization (O) -CMD_CrlGet_OU Organization Unit (OU) -CMD_CrlGet_C Country (C) -CMD_CrlGet_ST State (ST) -CMD_CrlGet_L Locale (L) -CMD_CrlGet_SERI Serial Number (Hexadecimal) -CMD_CrlGet_MD5_HASH MD5 Digest Value (Hexadecimal, 128 bit) -CMD_CrlGet_SHA1_HASH SHA-1 Digest Value (Hexadecimal, 160 bit) - - -# AcList command -CMD_AcList Get List of Rule Items of Source IP Address Limit List -CMD_AcList_Help Use this to get a list of Source IP Address Limit List rules that is set on the currently managed Virtual Hub. \nYou can allow or deny VPN connections to this Virtual Hub according to the client computer's source IP address. You can define multiple rules and set a priority for each rule. The search proceeds from the rule with the highest order or priority and based on the action of the rule that the IP address first matches, the connection from the client is either allowed or denied. \nThis command cannot be run on VPN Bridge. \nYou cannot execute this command for Virtual Hubs of VPN Servers operating as a cluster. -CMD_AcList_Args AcList - - -# AcAdd command -CMD_AcAdd Add Rule to Source IP Address Limit List (IPv4) -CMD_AcAdd_Help Use this to add a new rule to the Source IP Address Limit List that is set on the currently managed Virtual Hub. \nThe items set here will be used to decide whether to allow or deny connection from a VPN Client when this client attempts connection to the Virtual Hub. \nYou can specify a client IP address, or IP address or mask to match the rule as the contents of the rule item. By specifying an IP address only, there will only be one specified computer that will match the rule, but by specifying an IP net mask address or subnet mask address, all the computers in the range of that subnet will match the rule. \nYou can specify the priority for the rule. You can specify an integer of 1 or greater for the priority and the smaller the number, the higher the priority. \nTo get a list of the currently registered Source IP Address Limit List, use the AcList command. \nThis command cannot be run on VPN Bridge. \nYou cannot execute this command for Virtual Hubs of VPN Servers operating as a cluster. -CMD_AcAdd_Args AcAdd [allow|deny] [/PRIORITY:priority] [/IP:ip/mask] -CMD_AcAdd_[allow|deny] Set whether to "allow" or "deny" the connection from a client that matches the rule. -CMD_AcAdd_PRIORITY Specify an integer of 1 or higher to indicate the priority of the rule. The smaller the value the higher the priority. -CMD_AcAdd_IP Using the format: "IP Address/Mask", specify the range of client IPv4 addresses. Specify the IPv4 address by separating the decimal values using dots such as "192.168.0.1". For the mask, either specify decimal values separated by dots such as "255.255.255.0", or you can specify the bit length from the header using a decimal value such as "24". To specify a single IPv4 host, specify the mask as "32" or "255.255.255.255". -CMD_AcAdd_Prompt_AD allow or deny: -CMD_AcAdd_Prompt_PRIORITY Priority: -CMD_AcAdd_Prompt_IP IPv4 Address/Mask: -CMD_AcAdd_Eval_PRIORITY Specify 1 or higher for the priority. - - -# AcAdd6 command -CMD_AcAdd6 Add Rule to Source IP Address Limit List (IPv6) -CMD_AcAdd6_Help Use this to add a new rule to the Source IP Address Limit List that is set on the currently managed Virtual Hub. \nThe items set here will be used to decide whether to allow or deny connection from a VPN Client when this client attempts connection to the Virtual Hub. \nYou can specify a client IP address, or IP address or mask to match the rule as the contents of the rule item. By specifying an IP address only, there will only be one specified computer that will match the rule, but by specifying an IP net mask address or subnet mask address, all the computers in the range of that subnet will match the rule. \nYou can specify the priority for the rule. You can specify an integer of 1 or greater for the priority and the smaller the number, the higher the priority. \nTo get a list of the currently registered Source IP Address Limit List, use the AcList command. \nThis command cannot be run on VPN Bridge. \nYou cannot execute this command for Virtual Hubs of VPN Servers operating as a cluster. -CMD_AcAdd6_Args AcAdd6 [allow|deny] [/PRIORITY:priority] [/IP:ip/mask] -CMD_AcAdd6_[allow|deny] Set whether to "allow" or "deny" the connection from a client that matches the rule. -CMD_AcAdd6_PRIORITY Specify an integer of 1 or higher to indicate the priority of the rule. The smaller the value the higher the priority. -CMD_AcAdd6_IP Using the format: "IP Address/Mask", specify the range of client IPv6 addresses. Specify the IPv6 address by separating the hexadecimal values using colons such as "2001:200:0:1::". For the mask, either specify hexadecimal values separated by colons such as "ffff:ffff:ffff:ffff::", or you can specify the bit length from the header using a decimal value such as "64". To specify a single IPv6 host, specify the mask as "128" or "ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff". -CMD_AcAdd6_Prompt_AD allow or deny: -CMD_AcAdd6_Prompt_PRIORITY Priority: -CMD_AcAdd6_Prompt_IP IPv6 Address/Mask: -CMD_AcAdd6_Eval_PRIORITY Specify 1 or higher for the priority. - - -# AcDel command -CMD_AcDel Delete Rule from Source IP Address Limit List -CMD_AcDel_Help Use this to delete a rule from the Source IP Address Limit List that is set on the currently managed Virtual Hub. \nTo get a list of the currently registered IP access control list, use the AcList command. \nThis command cannot be run on VPN Bridge. \nYou cannot execute this command for Virtual Hubs of VPN Servers operating as a cluster. -CMD_AcDel_Args AcDel [id] -CMD_AcDel_[id] Specify the ID of the rule in the Source IP Address Limit List that you want to delete. -CMD_AcDel_Prompt_ID ID of Rule to Delete: - - -# LicenseAdd command -CMD_LicenseAdd Add License Key Registration -CMD_LicenseAdd_Help Use this to register a new license key on the SoftEther VPN Server. \nTo use SoftEther VPN Server you must acquire a valid license and register the license key. The license keys are 36 alphanumeric characters in length plus hyphens. They are key codes that certify the ownership of a license. \nWhen a license certificate is received together with this software, the license key is printed on this license certificate. If the license for this software has been purchased online, the license key is provided by email and on the website window at the time the license is purchased. The license key may also be written down by some other method. If you don't know where the license key is written down, ask the vendor who sold you the license. \n\nTo get the list of currently registered licenses, use the LicenseList command. \nTo display the license status of the current VPN Server, use the LicenseStatus command. \nTo execute this command, you must have VPN Server administrator privileges. \nThis command cannot be run on VPN Bridge. -CMD_LicenseAdd_Args LicenseAdd [key] -CMD_LicenseAdd_[key] Specify the license key to register. Specify 36 digits of alphanumeric characters and group the digits in groups of 6 separating them by hyphen. -CMD_LicenseAdd_Prompt_Key License Key: - - -# LicenseDel command -CMD_LicenseDel Delete Registered License -CMD_LicenseDel_Help Use this to delete a specified license from the license list that is currently registered on the SoftEther VPN Server. \n\nTo get the list of currently registered licenses, use the LicenseList command. \nTo display the license status of the current VPN Server, use the LicenseStatus command. \nTo execute this command, you must have VPN Server administrator privileges. \nThis command cannot be run on VPN Bridge. -CMD_LicenseDel_Args LicenseDel [id] -CMD_LicenseDel_[id] Specify the license number to delete. -CMD_LicenseDel_Prompt_ID License Number to Delete: - - -# LicenseList command -CMD_LicenseList Get List of Registered Licenses -CMD_LicenseList_Help Use this to display a list of license information currently registered on the SoftEther VPN Server including: license key, license type name, status, expiration date, license ID, license type ID, server ID and serial ID. \n\nTo display the license status of the current VPN Server, use the LicenseStatus command. \nTo execute this command, you must have VPN Server administrator privileges. \nThis command cannot be run on VPN Bridge. -CMD_LicenseList_Args LicenseList - - -# LicenseStatus command -CMD_LicenseStatus Get License Status of Current VPN Server -CMD_LicenseStatus_Help Use this to get and display the license status of the current SoftEther VPN Server. \nThe following current information on the SoftEther VPN Server will be displayed: product edition, server ID, product license expiration date, number of usable Client Connection Licenses and number of Bridge Connection Licenses. \n\nTo execute this command, you must have VPN Server administrator privileges. \nThis command cannot be run on VPN Bridge. -CMD_LicenseStatus_Args LicenseStatus - - -# Commands added after SoftEther VPN 4.0 -# IPsecEnable command -CMD_IPsecEnable Enable or Disable IPsec VPN Server Function -CMD_IPsecEnable_Help Enable or Disable IPsec VPN Server Function on SoftEther VPN Server.\nIf you enable this function, Virtual Hubs on the VPN Server will be able to accept Remote-Access VPN connections from L2TP-compatible PCs, Mac OS X and Smartphones, and also can accept EtherIP Site-to-Site VPN Connection. VPN Connections from Smartphones suchlike iPhone, iPad and Android, and also from native VPN Clients on Mac OS X and Windows can be accepted.\n\nTo execute this command, you must have VPN Server administrator privileges. \nThis command cannot be run on VPN Bridge.\nYou cannot execute this command for Virtual Hubs of VPN Servers operating as a cluster. -CMD_IPsecEnable_Args IPsecEnable [/L2TP:yes|no] [/L2TPRAW:yes|no] [/ETHERIP:yes|no] [/PSK:pre-shared-key] [/DEFAULTHUB:default_hub] -CMD_IPsecEnable_L2TP Enable or Disable the L2TP over IPsec Server Function. To accept VPN connections from iPhone, iPad, Android, Windows or Mac OS X, enable this option. -CMD_IPsecEnable_L2TPRAW Enable or Disable the L2TP Server Function (Raw L2TP with No Encryptions). To accept special VPN clients, enable this option. -CMD_IPsecEnable_ETHERIP Enable or Disable the EtherIP / L2TPv3 over IPsec Server Function (for site-to-site VPN Server function). Router Products which are compatible with EtherIP over IPsec can connect to Virtual Hubs on the VPN Server and establish Layer-2 (Ethernet) Bridging. -CMD_IPsecEnable_PSK Specify the IPsec Pre-Shared Key. An IPsec Pre-Shared Key is also called as "PSK" or "secret". Specify it equal or less than 8 letters, and distribute it to every users who will connect to the VPN Server. Please note: Google Android 4.0 has a bug which a Pre-Shared Key with 10 or more letters causes a unexpected behavior. For that reason, the letters of a Pre-Shared Key should be 9 or less characters. -CMD_IPsecEnable_DEFAULTHUB Specify the default Virtual HUB in a case of omitting the name of HUB on the Username. Users should specify their username such as "Username@Target Virtual HUB Name" to connect this L2TP Server. If the designation of the Virtual Hub is omitted, the above HUB will be used as the target. -CMD_IPsecEnable_Prompt_L2TP Enable L2TP over IPsec Server Function (yes / no): -CMD_IPsecEnable_Prompt_L2TPRAW Enable Raw L2TP Server Function (yes / no): -CMD_IPsecEnable_Prompt_ETHERIP Enable EtherIP / L2TPv3 over IPsec Server Function (yes / no): -CMD_IPsecEnable_Prompt_PSK Pre Shared Key for IPsec (Recommended: 9 letters at maximum): -CMD_IPsecEnable_Prompt_DEFAULTHUB Default Virtual HUB in a case of omitting the HUB on the Username: - - -# IPsecGet command -CMD_IPsecGet Get the Current IPsec VPN Server Settings -CMD_IPsecGet_Help Get and view the current IPsec VPN Server settings on the SoftEther VPN Server.\n\nTo execute this command, you must have VPN Server administrator privileges. \nThis command cannot be run on VPN Bridge.\nYou cannot execute this command for Virtual Hubs of VPN Servers operating as a cluster. -CMD_IPsecGet_Args IPsecGet -CMD_IPsecGet_PRINT_L2TP L2TP over IPsec Server Function Enabled -CMD_IPsecGet_PRINT_L2TPRAW Raw L2TP Server Function Enabled -CMD_IPsecGet_PRINT_ETHERIP EtherIP / L2TPv3 over IPsec Server Function Enabled -CMD_IPsecGet_PRINT_PSK IPsec Pre-Shared Key String -CMD_IPsecGet_PRINT_DEFAULTHUB Name of Default Virtual Hub - - -# EtherIpClientAdd command -CMD_EtherIpClientAdd Add New EtherIP / L2TPv3 over IPsec Client Setting to Accept EtherIP / L2TPv3 Client Devices -CMD_EtherIpClientAdd_Help Add a new setting entry to enable the EtherIP / L2TPv3 over IPsec Server Function to accept client devices.\nIn order to accept connections from routers by the EtherIP / L2TPv3 over IPsec Server Function, you have to define the relation table between an IPsec Phase 1 string which is presented by client devices of EtherIP / L2TPv3 over IPsec compatible router, and the designation of the destination Virtual Hub.\nAfter you add a definition entry by EtherIpClientAdd command, the defined connection setting to the Virtual Hub will be applied on the login-attempting session from an EtherIP / L2TPv3 over IPsec client device.\nThe username and password in an entry must be registered on the Virtual Hub. An EtherIP / L2TPv3 client will be regarded as it connected the Virtual HUB with the identification of the above user information.\n\nTo execute this command, you must have VPN Server administrator privileges. \nThis command cannot be run on VPN Bridge.\nYou cannot execute this command for Virtual Hubs of VPN Servers operating as a cluster. -CMD_EtherIpClientAdd_Args EtherIpClientAdd [ID] [/HUB:hubname] [/USERNAME:username] [/PASSWORD:password] -CMD_EtherIpClientAdd_[ID] Specify an ISAKMP Phase 1 ID. The ID must be exactly same as a ID in the configuration of the EtherIP / L2TPv3 Client. You can specify IP address as well as characters as ID, if the EtherIP Client uses IP address as Phase 1 ID. If you specify '*' (asterisk), it will be a wildcard to match any clients which doesn't match other explicit rules. -CMD_EtherIpClientAdd_HUB Specify the name of the Virtual Hub to connect. -CMD_EtherIpClientAdd_USERNAME Specify the username to login to the destination Virtual Hub. -CMD_EtherIpClientAdd_PASSWORD Specify the password to login to the destination Virtual Hub. -CMD_EtherIpClientAdd_Prompt_ID ISAKMP Phase 1 ID ('*' is a wildcard): -CMD_EtherIpClientAdd_Prompt_HUB Virtual Hub Name: -CMD_EtherIpClientAdd_Prompt_USERNAME Username to Login Virtual Hub: -CMD_EtherIpClientAdd_Prompt_PASSWORD Password to Login Virtual Hub: - - -# EtherIpClientDelete command -CMD_EtherIpClientDelete Delete an EtherIP / L2TPv3 over IPsec Client Setting -CMD_EtherIpClientDelete_Help This command deletes an entry to accept VPN clients by EtherIP / L2TPv3 over IPsec Function. \n\nTo execute this command, you must have VPN Server administrator privileges. \nThis command cannot be run on VPN Bridge.\nYou cannot execute this command for Virtual Hubs of VPN Servers operating as a cluster. -CMD_EtherIpClientDelete_Args EtherIpClientDelete [ID] -CMD_EtherIpClientDelete_[ID] Specify the ISAKMP Phase 1 ID to delete. -CMD_EtherIpClientDelete_Prompt_ID ISAKMP Phase 1 ID: - - -# EtherIpClientList command -CMD_EtherIpClientList Get the Current List of EtherIP / L2TPv3 Client Device Entry Definitions -CMD_EtherIpClientList_Help This command gets and shows the list of entries to accept VPN clients by EtherIP / L2TPv3 over IPsec Function.\n\nTo execute this command, you must have VPN Server administrator privileges. \nThis command cannot be run on VPN Bridge.\nYou cannot execute this command for Virtual Hubs of VPN Servers operating as a cluster. -CMD_EtherIpClientList_Args EtherIpClientList - - -# OpenVpnMakeConfig command -CMD_OpenVpnMakeConfig Generate a Sample Setting File for OpenVPN Client -CMD_OpenVpnMakeConfig_Help Originally, the OpenVPN Client requires a user to write a very difficult configuration file manually. This tool helps you to make a useful configuration sample. What you need to generate the configuration file for the OpenVPN Client is to run this command.\n\nTo execute this command, you must have VPN Server administrator privileges. \nThis command cannot be run on VPN Bridge.\nYou cannot execute this command for Virtual Hubs of VPN Servers operating as a cluster. -CMD_OpenVpnMakeConfig_Args OpenVpnMakeConfig [ZIP_FileName] -CMD_OpenVpnMakeConfig_[ZIP_FileName] Specify the output setting files to be saved as ZIP compression format. If no file extension is specified, the ".zip" extension will be appended to the filename. -CMD_OpenVpnMakeConfig_Prompt_ZIP Output Filename of Setting Files (ZIP compressed file): -CMD_OpenVpnMakeConfig_OK The sample setting file was saved as "%s". You can unzip this file to extract setting files.\n -CMD_OpenVpnMakeConfig_ERROR The sample setting files were unable to be saved as "%s". The filename might be invalid.\n - - -# ServerCertRegenerate command -CMD_ServerCertRegenerate Generate New Self-Signed Certificate with Specified CN (Common Name) and Register on VPN Server -CMD_ServerCertRegenerate_Help You can use this command to replace the current certificate on the VPN Server to a new self-signed certificate which has the CN (Common Name) value in the fields.\n\nThis command is convenient if you are planning to use Microsoft SSTP VPN Clone Server Function. Because of the value of CN (Common Name) on the SSL certificate of VPN Server must match to the hostname specified on the SSTP VPN client.\n\nThis command will delete the existing SSL certificate of the VPN Server. It is recommended to backup the current SSL certificate and private key by using the ServerKeyGet command beforehand.\n\nTo execute this command, you must have VPN Server administrator privileges. \nThis command cannot be run on VPN Bridge.\nYou cannot execute this command for Virtual Hubs of VPN Servers operating as a cluster. -CMD_ServerCertRegenerate_Args ServerCertRegenerate [CN] -CMD_ServerCertRegenerate_[CN] Specify a Common Name (CN) which the new certificate will have. -CMD_ServerCertRegenerate_Prompt_CN Value of Common Name (CN): - - -# VpnOverIcmpDnsEnable command -CMD_VpnOverIcmpDnsEnable Enable / Disable the VPN over ICMP / VPN over DNS Server Function -CMD_VpnOverIcmpDnsEnable_Help You can establish a VPN only with ICMP or DNS packets even if there is a firewall or routers which blocks TCP/IP communications. You have to enable the following functions beforehand.\n\nWarning: Use this function for emergency only. It is helpful when a firewall or router is misconfigured to blocks TCP/IP, but either ICMP or DNS is not blocked. It is not for long-term stable using.\n\nTo execute this command, you must have VPN Server administrator privileges. \nThis command cannot be run on VPN Bridge. -CMD_VpnOverIcmpDnsEnable_Args VpnOverIcmpDnsEnable [/ICMP:yes|no] [/DNS:yes|no] -CMD_VpnOverIcmpDnsEnable_ICMP Specify yes to enable the VPN over ICMP Server. Specify no to disable. -CMD_VpnOverIcmpDnsEnable_DNS Specify yes to enable the VPN over DNS Server. Specify no to disable. -CMD_VpnOverIcmpDnsEnable_Prompt_ICMP Enable VPN over ICMP Server (yes / no): -CMD_VpnOverIcmpDnsEnable_Prompt_DNS Enable VPN over DNS Server (yes / no): - - -# VpnOverIcmpDnsGet command -CMD_VpnOverIcmpDnsGet Get Current Setting of the VPN over ICMP / VPN over DNS Function -CMD_VpnOverIcmpDnsGet_Help Get and show the current VPN over ICMP / VPN over DNS Function status.\n\nTo execute this command, you must have VPN Server administrator privileges. \nThis command cannot be run on VPN Bridge. -CMD_VpnOverIcmpDnsGet_Args VpnOverIcmpDnsGet -CMD_VpnOverIcmpDnsGet_PRINT_ICMP VPN over ICMP Server Enabled -CMD_VpnOverIcmpDnsGet_PRINT_DNS VPN over DNS Server Enabled - - -# DynamicDnsGetStatus command -CMD_DynamicDnsGetStatus Show the Current Status of Dynamic DNS Function -CMD_DynamicDnsGetStatus_Help Get and show the current status of the Dynamic DNS function.\n\nThe Dynamic DNS assigns a unique and permanent DNS hostname for this VPN Server. You can use that hostname to specify this VPN Server on the settings for VPN Client and VPN Bridge. You need not to register and keep a domain name.\nAlso, if your ISP assigns you a dynamic (not-fixed) IP address, the corresponding IP address of your Dynamic DNS hostname will be automatically changed. It enables you to keep running the VPN Server by using only a dynamic IP address.\r\nTherefore, you need not any longer to keep static global IP addresses with expenses monthly costs.\n[Caution]\nTo disable the Dynamic DNS Function, modify the configuration file of VPN Server.\r\n\r\nThe "declare root" directive has the "declare DDnsClient" directive. In this directive, you can switch "bool Disable" from false to true, and reboot the VPN Server, then the Dynamic DNS Function will be disabled.\r\nTo execute this command, you must have VPN Server administrator privileges. \nThis command cannot be run on VPN Bridge. -CMD_DynamicDnsGetStatus_Args DynamicDnsGetStatus -CMD_DynamicDnsGetStatus_PRINT_FQDN Assigned Dynamic DNS Hostname (Full) -CMD_DynamicDnsGetStatus_PRINT_HOSTNAME Assigned Dynamic DNS Hostname (Hostname) -CMD_DynamicDnsGetStatus_PRINT_SUFFIX DNS Suffix -CMD_DynamicDnsGetStatus_PRINT_IPv4 Global IPv4 Address -CMD_DynamicDnsGetStatus_PRINT_IPv6 Global IPv6 Address - - -# DynamicDnsSetHostname command -CMD_DynamicDnsSetHostname Set the Dynamic DNS Hostname -CMD_DynamicDnsSetHostname_Help You can use this command to change the hostname assigned by the Dynamic DNS function. The currently assigned hostname can be showen by the DynamicDnsGetStatus command.\n\nThe Dynamic DNS assigns a unique and permanent DNS hostname for this VPN Server. You can use that hostname to specify this VPN Server on the settings for VPN Client and VPN Bridge. You need not to register and keep a domain name.\nAlso, if your ISP assigns you a dynamic (not-fixed) IP address, the corresponding IP address of your Dynamic DNS hostname will be automatically changed. It enables you to keep running the VPN Server by using only a dynamic IP address.\r\nTherefore, you need not any longer to keep static global IP addresses with expenses monthly costs.\n[Caution]\nTo disable the Dynamic DNS Function, modify the configuration file of VPN Server.\r\n\r\nThe "declare root" directive has the "declare DDnsClient" directive. In this directive, you can switch "bool Disable" from false to true, and reboot the VPN Server, then the Dynamic DNS Function will be disabled.\r\nTo execute this command, you must have VPN Server administrator privileges. \nThis command cannot be run on VPN Bridge. -CMD_DynamicDnsSetHostname_Args DynamicDnsSetHostname [hostname] -CMD_DynamicDnsSetHostname_[hostname] Specify the new hostname with 3 letters at least and 31 letters at most. Only alphabets and numerics can be used. -CMD_DynamicDnsSetHostname_Prompt_hostname Dynamic DNS Hostname (3 - 31 letters): - - -# VpnAzureGetStatus command -CMD_VpnAzureGetStatus Show the current status of VPN Azure function -CMD_VpnAzureGetStatus_Help Get and show the current status of the VPN Azure function.\n\nVPN Azure makes it easier to establish a VPN Session from your home PC to your office PC. While a VPN connection is established, you can access to any other servers on the private network of your company.\nYou don't need a global IP address on the office PC (VPN Server). It can work behind firewalls or NATs. No network administrator's configuration required. You can use the built-in SSTP-VPN Client of Windows in your home PC.\nVPN Azure is a cloud VPN service operated by SoftEther VPN Project. VPN Azure is free of charge and available to anyone. Visit http://www.vpnazure.net/ to see details and how-to-use instructions.\n\nThe VPN Azure hostname is same to the hostname of the Dynamic DNS setting, but altering the domain suffix to "vpnazure.net". To change the hostname use the DynamicDnsSetHostname command.\n\nTo execute this command, you must have VPN Server administrator privileges. \nThis command cannot be run on VPN Bridge.\nYou cannot execute this command for Virtual Hubs of VPN Servers operating as a cluster. -CMD_VpnAzureGetStatus_Args VpnAzureGetStatus -CMD_VpnAzureGetStatus_PRINT_ENABLED VPN Azure Function is Enabled -CMD_VpnAzureGetStatus_PRINT_CONNECTED Connection to VPN Azure Cloud Server is Established -CMD_VpnAzureGetStatus_PRINT_HOSTNAME Hostname of this VPN Server on VPN Azure Service - - -# VpnAzureSetStatus command -CMD_VpnAzureSetEnable Enable / Disable VPN Azure Function -CMD_VpnAzureSetEnable_Help Enable or disable the VPN Azure function.\n\nVPN Azure makes it easier to establish a VPN Session from your home PC to your office PC. While a VPN connection is established, you can access to any other servers on the private network of your company.\nYou don't need a global IP address on the office PC (VPN Server). It can work behind firewalls or NATs. No network administrator's configuration required. You can use the built-in SSTP-VPN Client of Windows in your home PC.\nVPN Azure is a cloud VPN service operated by SoftEther VPN Project. VPN Azure is free of charge and available to anyone. Visit http://www.vpnazure.net/ to see details and how-to-use instructions.\n\nThe VPN Azure hostname is same to the hostname of the Dynamic DNS setting, but altering the domain suffix to "vpnazure.net". To change the hostname use the DynamicDnsSetHostname command.\n\nTo execute this command, you must have VPN Server administrator privileges. \nThis command cannot be run on VPN Bridge.\nYou cannot execute this command for Virtual Hubs of VPN Servers operating as a cluster. -CMD_VpnAzureSetEnable_Args VpnAzureSetEnable [yes|no] -CMD_VpnAzureSetEnable_[yes|no] Specify 'yes' to enable VPN Azure. 'no' to disable it. -CMD_VpnAzureSetEnable_PROMPT Enable VPN Azure (yes / no): - - - - -####################################################### -# # -# Management commands for VPN Client are listed below # -# # -####################################################### - - -# VersionGet command -CMD_VersionGet Get Version Information of VPN Client Service -CMD_VersionGet_Help Use this to get the version information of the currently managed VPN Client Service program. -CMD_VersionGet_Args VersionGet -CMD_VersionGet_1 Product Name -CMD_VersionGet_2 Version Information -CMD_VersionGet_3 Build Information -CMD_VersionGet_4 Process ID -CMD_VersionGet_5 OS Type - - -# PasswordSet command -CMD_PasswordSet Set the password to connect to the VPN Client service. -CMD_PasswordSet_Help You can make it mandatory to input a password for occasions when the Command Line Management Utility and the VPN Client Manager connect to a VPN Client service to control it. You can use this command to set the password that must be input. \nYou can also make it mandatory for this password to be input when doing remote operations (from a computer that is not localhost) -CMD_PasswordSet_Args PasswordSet [password] [/REMOTEONLY:yes|no] -CMD_PasswordSet_[password] Specify the password you wish to set. You can delete the password setting by specifying "none". -CMD_PasswordSet_REMOTEONLY Specify "yes" to only require the password to be input when operation is done remotely (from a computer that is not localhost). This stops the password being required when the connection is from localhost. When this parameter is omitted, it will be regarded as "no". - - -# PasswordGet command -CMD_PasswordGet Get Password Setting to Connect to VPN Client Service -CMD_PasswordGet_Help Use this to get the setting that determines whether to input a password for occasions when the Command Line Management Utility and the VPN Client Manager connect to a VPN Client service to control it. \nIn the case when a password is requested, it also gets the setting that determines whether this password is only requested when operation is performed remotely (from a computer that is not localhost). -CMD_PasswordGet_Args PasswordGet -CMD_PasswordGet_1 Set Password -CMD_PasswordGet_2 Request Password for Remote Operation Only - - -# CertList command -CMD_CertList Get List of Trusted CA Certificates -CMD_CertList_Help Here you can manage the list of certificate authority certificates that are trusted by VPN client. You can use the registered CA certificate list to verify server certificates when connecting to VPN Servers. -CMD_CertList_Args CertList - - -# CertAdd command -CMD_CertAdd Add Trusted CA Certificate -CMD_CertAdd_Help Use this to add a new certificate to a list of CA certificates trusted by the VPN Client. You can use the registered CA certificate list to verify server certificates when connecting to VPN Servers. \nTo get a list of the current certificates you can use the CertList command. \nThe certificate you add must be saved in the X.509 file format. -CMD_CertAdd_Args CertAdd [path] -CMD_CertAdd_[path] Specify the file name of the X.509 certificate to register. - - -# CertDelete command -CMD_CertDelete Delete Trusted CA Certificate -CMD_CertDelete_Help Use this to delete an existing certificate from a list of CA certificates trusted by the VPN Client. \nTo get a list of the current certificates you can use the CertList command. -CMD_CertDelete_Args CertDelete [id] -CMD_CertDelete_[id] Specify the ID of the certificate to delete. - - -# CertGet command -CMD_CertGet Get Trusted CA Certificate -CMD_CertGet_Help Use this to get an existing certificate from the list of CA certificates trusted by the VPN Client and save it as a file in X.509 format. -CMD_CertGet_Args CertGet [id] [/SAVECERT:path] -CMD_CertGet_[id] Specify the ID of the certificate to get. -CMD_CertGet_SAVECERT Specify the file name to save the certificate you obtained. - - -# SecureList command -CMD_SecureList Get List of Usable Smart Card Types -CMD_SecureList_Help Use this to display a list of smart cards that are supported by VPN Client. \nThe types of smart cards listed in this list have had their drivers installed on the current computer and are supported by VPN software. \r\nIf there is a type of smart card that is currently being used that does not appear in the list, it may be possible to enable use by updating the VPN software to a newer version. -CMD_SecureList_Args SecureList - - -# SecureSelect command -CMD_SecureSelect Select the Smart Card Type to Use -CMD_SecureSelect_Help Use this to select the type of the smart card to be used by the VPN Client. \nTo get the list of usable smart card types, use the SecureList command. -CMD_SecureSelect_Args SecureSelect [id] -CMD_SecureSelect_[id] Specify the ID of the smart card type. -CMD_SecureSelect_PROMPT_ID ID of Smart Card Type to Use - - -# SecureGet command -CMD_SecureGet Get ID of Smart Card Type to Use -CMD_SecureGet_Help Use this to get the ID of the smart card type that is set to be used for the current VPN Client. By viewing the results of the SecureList command based on this ID, you can get the type of the currently selected smart card. \nIf there is no smart card that is currently selected, 0 will be displayed for the ID. -CMD_SecureGet_Args SecureGet -CMD_SecureGet_Print The currently selected smart card ID is %u. -CMD_SecureGet_NoPrint Currently, a smart card is not selected. - - -# NicCreate command -CMD_NicCreate Create New Virtual Network Adapter -CMD_NicCreate_Help Use this to add a new Virtual Network Adapter to the system. You can give the virtual network adapter a name of your choice. \nYou can set a name that consists of alphanumeric characters for the virtual network adapter. For Windows 2000 or newer systems, this name can be up to 31 characters, but for Windows 98, 98SE and ME it can be up to 4 characters. \nIf the NicCreate command was called, a new virtual network adapter device driver will be installed on the operating system that the VPN Client is operating on. \nIn this case, depending on the operating system, a dialog box may appear to confirm if it is OK to install the device driver. -CMD_NicCreate_Args NicCreate [name] -CMD_NicCreate_[name] Specify the name of the virtual network adapter. -CMD_NicCreate_PROMPT_NAME Virtual Network Adapter Name: - - -# NicDelete command -CMD_NicDelete Delete Virtual Network Adapter -CMD_NicDelete_Help Use this to delete an existing virtual network adapter from the system. \nWhen you delete a virtual network adapter from the system, all the connections which are using that virtual network adapter will be disconnected. \nAlso, the Connection Settings that are set to use a virtual network adapter that has been deleted will have their settings automatically changed to use another virtual network adapter. \nThis command can be used when VPN Client is operating on Windows 2000 or newer operating systems. -CMD_NicDelete_Args NicDelete [name] -CMD_NicDelete_[name] Specify the name of the virtual network adapter. - - -# NicUpgrade command -CMD_NicUpgrade Upgrade Virtual Network Adapter Device Driver -CMD_NicUpgrade_Help If the device driver version of the existing virtual network adapter is old, then this upgrades to the latest device driver that was bundled with the currently operating VPN client. Even if a upgrade is not performed, the device driver will be reinstalled. \nIn this case, depending on the operating system, a dialog box may appear to confirm if it is OK to install the device driver. \nThis command can be used when VPN Client is operating on Windows 2000 or newer operating systems. -CMD_NicUpgrade_Args NicUpgrade [name] -CMD_NicUpgrade_[name] Specify the name of the virtual network adapter. - - -# NicGetSetting command -CMD_NicGetSetting Get Virtual Network Adapter Setting -CMD_NicGetSetting_Help Use this to get the MAC address setting of the existing virtual network adapter. \nThis command can be used when VPN Client is operating on Windows 2000 or newer operating systems. -CMD_NicGetSetting_Args NicGetSetting [name] -CMD_NicGetSetting_[name] Specify the name of the virtual network adapter. -CMD_NicGetSetting_1 Device Name -CMD_NicGetSetting_2 Status -CMD_NicGetSetting_3 MAC Address -CMD_NicGetSetting_4 Version -CMD_NicGetSetting_5 Driver File Name -CMD_NicGetSetting_6 GUID - - -# NicSetSetting command -CMD_NicSetSetting Change Virtual Network Adapter Setting -CMD_NicSetSetting_Help Use this to change the MAC address setting of the existing virtual network adapter. When this command is executed, the currently operating virtual network adapter device drivers will be restarted. \nThis command can be used when VPN Client is operating on Windows 2000 or newer operating systems. -CMD_NicSetSetting_Args NicSetSetting [name] [/MAC:mac] -CMD_NicSetSetting_[name] Specify the name of the virtual network adapter. -CMD_NicSetSetting_MAC Specify the MAC address you wish to set. \nSpecify a 6-byte hexadecimal string for the MAC address. \nExample: 00:AC:01:23:45:67 or 00-AC-01-23-45-67 -CMD_NicSetSetting_PROMPT_MAC MAC Address to Set: - - -# NicEnable command -CMD_NicEnable Enable Virtual Network Adapter -CMD_NicEnable_Help Use this to enable an existing, disabled virtual network adapter. \nThis command can be used when VPN Client is operating on Windows 2000 or newer operating systems. -CMD_NicEnable_Args NicEnable [name] -CMD_NicEnable_[name] Specify the name of the virtual network adapter. - - -# NicDisable command -CMD_NicDisable Disable Virtual Network Adapter -CMD_NicDisable_Help Use this to disable an existing, enabled virtual network adapter. \nThis command can be used when VPN Client is operating on Windows 2000 or newer operating systems. -CMD_NicDisable_Args NicDisable [name] -CMD_NicDisable_[name] Specify the name of the virtual network adapter. - - -# NicList command -CMD_NicList Get List of Virtual Network Adapters -CMD_NicList_Help This allows you to get a list of virtual network adapters registered on the current system. -CMD_NicList_Args NicList - - -# AccountList command -CMD_AccountList Get List of VPN Connection Settings -CMD_AccountList_Help Use this to get a list of VPN Connection Settings registered on the VPN Client. -CMD_AccountList_Args AccountList - - -# AccountCreate command -CMD_AccountCreate Create New VPN Connection Setting -CMD_AccountCreate_Help Use this to create a new VPN Connection Setting on the VPN Client. \nTo create a VPN Connection Setting, in addition to specifying the VPN Connection Setting name and destination server as initial parameters and the destination virtual Hub, and user name, you must also specify the name of the virtual network adapter to use. When a new VPN Connection Setting is created, the type of user authentication is initially set as Anonymous Authentication and the proxy server setting and the verification options of the server certificate is not set. To change these settings and other advanced settings after the VPN Connection Setting has been created, use the other commands that begin with the name "Account". -CMD_AccountCreate_Args AccountCreate [name] [/SERVER:hostname:port] [/HUB:hubname] [/USERNAME:username] [/NICNAME:nicname] -CMD_AccountCreate_[name] Specify the name of the VPN Connection Setting to create. -CMD_AccountCreate_SERVER Specify the host name and port number of the destination VPN Server using the format [host name:port number]. You can also specify by IP address. -CMD_AccountCreate_HUB Specify the Virtual Hub on the destination VPN Server. -CMD_AccountCreate_USERNAME Specify the user name to use for user authentication when connecting to the destination VPN Server. -CMD_AccountCreate_NICNAME Specify the virtual network adapter to use to connect. -CMD_AccountCreate_Prompt_Name Name of VPN Connection Setting: -CMD_AccountCreate_Prompt_Server Destination VPN Server Host Name and Port Number: -CMD_AccountCreate_Prompt_Hub Destination Virtual Hub Name: -CMD_AccountCreate_Prompt_Username Connecting User Name: -CMD_AccountCreate_Prompt_Nicname Used Virtual Network Adapter Name: - - -# AccountSet command -CMD_AccountSet Set the VPN Connection Setting Connection Destination -CMD_AccountSet_Help Use this to set, for the VPN Connection Setting registered on the VPN Client, the destination VPN Server host name and port number, Virtual Hub name, user name used for connection and virtual network adapter name to use. -CMD_AccountSet_Args AccountSet [name] [/SERVER:hostname:port] [/HUB:hubname] -CMD_AccountSet_[name] Specify the name of the VPN Connection Setting whose setting you want to change. -CMD_AccountSet_SERVER Specify the host name and port number of the destination VPN Server using the format "host name:port number". You can also specify by IP address. -CMD_AccountSet_HUB Specify the Virtual Hub on the destination VPN Server. - - -# AccountGet command -CMD_AccountGet Get Setting of VPN Connection Setting -CMD_AccountGet_Help Use this to get the VPN Connection Setting contents of a VPN Connection Setting registered on the VPN Client. \nTo change the VPN Connection Setting contents of the VPN Connection Setting, use the other commands that begin with the name "Account" after creating the VPN Connection Setting. -CMD_AccountGet_Args AccountGet [name] -CMD_AccountGet_[name] Specify the name of the VPN Connection Setting whose setting you want to get. - - -# AccountDelete command -CMD_AccountDelete Delete VPN Connection Setting -CMD_AccountDelete_Help Use this to delete VPN Connection Setting that is registered on the VPN Client. If the specified VPN Connection Setting has a status of online, the connections will be automatically disconnected and then the VPN Connection Setting will be deleted. -CMD_AccountDelete_Args AccountDelete [name] -CMD_AccountDelete_[name] Specify the name of the VPN Connection Setting to delete. - - -# AccountUsernameSet command -CMD_AccountUsernameSet Set User Name of User to Use Connection of VPN Connection Setting -CMD_AccountUsernameSet_Help When a VPN Connection Setting registered on the VPN Client is specified and that VPN Connection Setting connects to the VPN Server, use this to specify the user name required for user authentication. \nIn some cases it is necessary to specify the type of user authentication and specify the required parameters. To change this information you can use commands such as AccountAnonymousSet, AccountPasswordSet, AccountCertSet and AccountSecureCertSet. -CMD_AccountUsernameSet_Args AccountUsernameSet [name] [/USERNAME:username] -CMD_AccountUsernameSet_[name] Specify the name of the VPN Connection Setting whose setting you want to change. -CMD_AccountUsernameSet_USERNAME Specify the user name required for user authentication when the VPN Connection Setting connects to the VPN Server. -CMD_AccountUsername_Notice The auth type for this VPN Connection Setting is currently set as password authentication. After changing the user name, you must use the AccountPasswordSet command to reset the password. - - -# AccountAnonymousSet command -CMD_AccountAnonymousSet Set User Authentication Type of VPN Connection Setting to Anonymous Authentication -CMD_AccountAnonymousSet_Help Use this to set the user auth type to [Anonymous Authentication] for when a VPN Connection Setting registered on the VPN Client is specified and that VPN Connection Setting connects to the VPN Server. -CMD_AccountAnonymousSet_Args AccountAnonymousSet [name] -CMD_AccountAnonymousSet_[name] Specify the name of the VPN Connection Setting whose setting you want to change. - - -# AccountPasswordSet command -CMD_AccountPasswordSet Set User Authentication Type of VPN Connection Setting to Password Authentication -CMD_AccountPasswordSet_Help Use this to set the user auth type to Password Authentication for when a VPN Connection Setting registered on the VPN Client is specified and that VPN Connection Setting connects to the VPN Server. Specify Standard Password Authentication and RADIUS or NT Domain Authentication as the password authentication type. -CMD_AccountPasswordSet_Args AccountPasswordSet [name] [/PASSWORD:password] [/TYPE:standard|radius] -CMD_AccountPasswordSet_[name] Specify the name of the VPN Connection Setting whose setting you want to change. -CMD_AccountPasswordSet_PASSWORD Specify the password to use for password authentication. If this is not specified, a prompt will appear to input the password. -CMD_AccountPasswordSet_TYPE Specify either "standard" (Standard Password Authentication) or "radius" (RADIUS or NT Domain Authentication) as the password authentication type. -CMD_AccountPasswordSet_Prompt_Type Specify standard or radius: -CMD_AccountPasswordSet_Type_Invalid The standard or radius specification is invalid. - - -# AccountCertSet command -CMD_AccountCertSet Set User Authentication Type of VPN Connection Setting to Client Certificate Authentication -CMD_AccountCertSet_Help Use this to set the user auth type to Client Certificate Authentication for when a VPN Connection Setting registered on the VPN Client is specified and that VPN Connection Setting connects to the VPN Server. For this certificate, you must specify a certificate file in the X.509 format and a private key file that is Base 64 encoded. -CMD_AccountCertSet_Args AccountCertSet [name] [/LOADCERT:cert] [/LOADKEY:key] -CMD_AccountCertSet_[name] Specify the name of the VPN Connection Setting whose setting you want to change. -CMD_AccountCertSet_LOADCERT Specify the X.509 format certificate file to provide for certificate authentication. -CMD_AccountCertSet_LOADKEY Specify the Base-64-encoded private key file name for the certificate. - - -# AccountCertGet command -CMD_AccountCertGet Get Client Certificate to Use for Cascade Connection -CMD_AccountCertGet_Help When a VPN Connection Setting registered on VPN Client is specified and that VPN Connection Setting uses client certificate authentication, use this to get the certificate that is provided as the client certificate and save the certificate file in X.509 format. -CMD_AccountCertGet_Args AccountCertGet [name] [/SAVECERT:cert] -CMD_AccountCertGet_[name] Specify the name of the VPN Connection Setting whose setting you want to get. -CMD_AccountCertGet_SAVECERT Specify the file name to save the certificate you obtained in X.509 format. - - -# AccountEncryptEnable command -CMD_AccountEncryptEnable Enable Encryption when Communicating by VPN Connection Setting -CMD_AccountEncryptEnable_Help When a VPN Connection Setting registered on the VPN Client is specified and that VPN Connection Setting is used for communication between VPN Servers via a VPN connection, use this to set the communication contents between the VPN Servers to be encrypted by SSL. \nNormally communication between VPN Servers is encrypted by SSL to prevent eavesdropping of information and fraud. You can also disable encryption. When encryption is disabled, the communication throughput improves but the communication data flows over the network in plain text. -CMD_AccountEncryptEnable_Args AccountEncryptEnable [name] -CMD_AccountEncryptEnable_[name] Specify the name of the VPN Connection Setting whose setting you want to change. - - -# AccountEncryptDisable command -CMD_AccountEncryptDisable Disable Encryption when Communicating by VPN Connection Setting -CMD_AccountEncryptDisable_Help When a VPN Connection Setting registered on the VPN Client is specified and that VPN Connection Setting is used for communication between VPN Servers via a VPN connection, use this to set the communication contents between the VPN Servers not to be encrypted. \nNormally communication between VPN Servers is encrypted by SSL to prevent eavesdropping of information and fraud. You can also disable encryption. When encryption is disabled, the communication throughput improves but the communication data flows over the network in plain text. -CMD_AccountEncryptDisable_Args AccountEncryptDisable [name] -CMD_AccountEncryptDisable_[name] Specify the name of the VPN Connection Setting whose setting you want to change. - - -# AccountCompressEnable command -CMD_AccountCompressEnable Enable Data Compression when Communicating by VPN Connection Setting -CMD_AccountCompressEnable_Help When a VPN Connection Setting registered on the VPN Client is specified and that VPN Connection Setting is used for communication between VPN Servers via a VPN connection, use this to set the communication contents between the VPN Servers to be compressed. \nIt is possible to achieve a maximum of 80% compression. Compression however places higher loads on the CPU of both the client and server machines. When the line speed is about 10 Mbps or greater, compression can lower throughput, but sometimes it can have the opposite effect. -CMD_AccountCompressEnable_Args AccountCompressEnable [name] -CMD_AccountCompressEnable_[name] Specify the name of the VPN Connection Setting whose setting you want to change. - - -# AccountCompressDisable command -CMD_AccountCompressDisable Disable Data Compression when Communicating by VPN Connection Setting -CMD_AccountCompressDisable_Help When a VPN Connection Setting registered on the VPN Client is specified and that VPN Connection Setting is used for communication between VPN Servers via a VPN connection, use this to set the communication contents between the VPN Servers not to be compressed. -CMD_AccountCompressDisable_Args AccountCompressDisable [name] -CMD_AccountCompressDisable_[name] Specify the name of the VPN Connection Setting whose setting you want to change. - - -# AccountHttpHeader* commands -CMD_AccountHttpHeader_Prompt_Name Value name (part before the colon): -CMD_AccountHttpHeader_Prompt_Data Value data (part after the colon): - - -# AccountHttpHeaderAdd command -CMD_AccountHttpHeaderAdd Add a custom value in the HTTP header sent to the proxy server -CMD_AccountHttpHeaderAdd_Help Use this to add a custom value in the HTTP header sent to the proxy server. A custom HTTP header can be used to bypass certain restrictions imposed on the network or to avoid speed limitations applied by the QoS. -CMD_AccountHttpHeaderAdd_Args AccountHttpHeaderAdd [name] [/NAME:name] [/DATA:data] -CMD_AccountHttpHeaderAdd_[name] Specify the name of the VPN Connection Setting whose setting you want to change. -CMD_AccountHttpHeaderAdd_NAME Specify the name of the custom value (the part before the colon character). -CMD_AccountHttpHeaderAdd_DATA Specify the data of the custom value (the part after the colon character). - - -# AccountHttpHeaderDelete command -CMD_AccountHttpHeaderDelete Delete a custom value in the HTTP header sent to the proxy server -CMD_AccountHttpHeaderDelete_Help Use this to delete a custom value in the HTTP header sent to the proxy server. A custom HTTP header can be used to bypass certain restrictions imposed on the network or to avoid speed limitations applied by the QoS. -CMD_AccountHttpHeaderDelete_Args AccountHttpHeaderDelete [name] [/NAME:name] -CMD_AccountHttpHeaderDelete_[name] Specify the name of the VPN Connection Setting whose setting you want to change. -CMD_AccountHttpHeaderDelete_NAME Specify the name of the custom value (the part before the colon character). - - -# AccountHttpHeaderGet command -CMD_AccountHttpHeaderGet Get the list of custom values in the HTTP header sent to the proxy server -CMD_AccountHttpHeaderGet_Help Use this to get the list of custom values in the HTTP header sent to the proxy server. A custom HTTP header can be used to bypass certain restrictions imposed on the network or to avoid speed limitations applied by the QoS. -CMD_AccountHttpHeaderGet_Args AccountHttpHeaderGet [name] -CMD_AccountHttpHeaderGet_[name] Specify the name of the VPN Connection Setting whose setting you want to get. - - -# AccountProxyNone command -CMD_AccountProxyNone Specify Direct TCP/IP Connection as the Connection Method of VPN Connection Setting -CMD_AccountProxyNone_Help When a VPN Connection Setting registered on the VPN Client is specified and that VPN Connection Setting connects to a VPN Server, use this to set Direct TCP/IP Connection as the connection method to use, in which case the connection route will not be via a proxy server. -CMD_AccountProxyNone_Args AccountProxyNone [name] -CMD_AccountProxyNone_[name] Specify the name of the VPN Connection Setting whose setting you want to change. - - -# AccountProxyHttp command -CMD_AccountProxyHttp Set Connection Method of VPN Connection Setting to be via an HTTP Proxy Server -CMD_AccountProxyHttp_Help When a VPN Connection Setting registered on the VPN Client is specified and that VPN Connection Setting connects to a VPN Server, use this to set Connect via HTTP Proxy Server as the method of connection to use, which requires the specification of the host name and port number of the HTTP Proxy server to communicate via as well as a user name and password (when required). \nThe HTTP proxy server that communication will travel via must be compatible with the CONNECT method to use HTTPS communication. -CMD_AccountProxyHttp_Args AccountProxyHttp [name] [/SERVER:hostname:port] [/USERNAME:username] [/PASSWORD:password] -CMD_AccountProxyHttp_[name] Specify the name of the VPN Connection Setting whose setting you want to change. -CMD_AccountProxyHttp_SERVER Specify the host name or IP address, and port number of the on-route HTTP proxy server using the format [host name:port number]. -CMD_AccountProxyHttp_USERNAME When user authentication is required to connect to the on-route HTTP proxy server, specify the user name. Also, specify the /PASSWORD parameter at the same time. If the parameters /USERNAME and /PASSWORD are not specified, the user authentication data will not be set. -CMD_AccountProxyHttp_PASSWORD When user authentication is required to connect to the on-route HTTP proxy server, specify the password. Specify this together with the /USERNAME parameter. -CMD_AccountProxyHttp_Prompt_Server Proxy Server Host Name and Port Number: - - -# AccountProxySocks command -CMD_AccountProxySocks Set Connection Method of VPN Connection Setting to be via a SOCKS4 Proxy Server -CMD_AccountProxySocks_Help When a VPN Connection Setting registered on the VPN Client is specified and that VPN Connection Setting connects to a VPN Server, use this to set Connect via SOCKS4 Proxy Server as the method of connection to use, which requires the specification of the host name and port number of the SOCKS4 Proxy server to communicate via as well as a user name and password (when required). -CMD_AccountProxySocks_Args AccountProxySocks [name] [/SERVER:hostname:port] [/USERNAME:username] [/PASSWORD:password] -CMD_AccountProxySocks_[name] Specify the name of the VPN Connection Setting whose setting you want to change. -CMD_AccountProxySocks_SERVER Specify the host name or IP address, and port number of the on-route SOCKS4 proxy server using the format [host name:port number]. -CMD_AccountProxySocks_USERNAME When user authentication is required to connect to the on-route SOCKS4 proxy server, specify the user name. Also, specify the /PASSWORD parameter at the same time. If the parameters /USERNAME and /PASSWORD are not specified, the user authentication data will not be set. -CMD_AccountProxySocks_PASSWORD When user authentication is required to connect to the on-route SOCKS4 proxy server, specify the password. Specify this together with the /USERNAME parameter. - - -# AccountProxySocks5 command -CMD_AccountProxySocks5 Set Connection Method of VPN Connection Setting to be via a SOCKS5 Proxy Server -CMD_AccountProxySocks5_Help When a VPN Connection Setting registered on the VPN Client is specified and that VPN Connection Setting connects to a VPN Server, use this to set Connect via SOCKS5 Proxy Server as the method of connection to use, which requires the specification of the host name and port number of the SOCKS5 Proxy server to communicate via as well as a user name and password (when required). -CMD_AccountProxySocks5_Args AccountProxySocks5 [name] [/SERVER:hostname:port] [/USERNAME:username] [/PASSWORD:password] -CMD_AccountProxySocks5_[name] Specify the name of the VPN Connection Setting whose setting you want to change. -CMD_AccountProxySocks5_SERVER Specify the host name or IP address, and port number of the on-route SOCKS5 proxy server using the format [host name:port number]. -CMD_AccountProxySocks5_USERNAME When user authentication is required to connect to the on-route SOCKS5 proxy server, specify the user name. Also, specify the /PASSWORD parameter at the same time. If the parameters /USERNAME and /PASSWORD are not specified, the user authentication data will not be set. -CMD_AccountProxySocks5_PASSWORD When user authentication is required to connect to the on-route SOCKS5 proxy server, specify the password. Specify this together with the /USERNAME parameter. - - -# AccountServerCertEnable command -CMD_AccountServerCertEnable Enable VPN Connection Setting Server Certificate Verification Option -CMD_AccountServerCertEnable_Help When a VPN Connection Setting registered on the VPN Client is specified and that VPN Connection Setting connects to a VPN Server, use this to enable the option to check whether the SSL certificate provided by the destination VPN Server can be trusted. \nIf this option is enabled, we recommend that you either use the AccountServerCertSet command to save the connection destination server SSL certificate beforehand in the VPN Connection Setting settings beforehand, or use the CertAdd command etc. to register a root certificate containing the signed server SSL certificate in the list of Virtual Hub trusted CA certificates. If it is not registered, a confirmation message sometimes is displayed on the initial connection. \nIf the certificate of the connected VPN Server cannot be trusted under the condition where the option to verify server certificates has been enabled for the VPN Connection Setting, the connection will be promptly cancelled and continual reattempts at connection will be made. -CMD_AccountServerCertEnable_Args AccountServerCertEnable [name] -CMD_AccountServerCertEnable_[name] Specify the name of the VPN Connection Setting whose setting you want to change. - - -# AccountServerCertDisable command -CMD_AccountServerCertDisable Disable VPN Connection Setting Server Certificate Verification Option -CMD_AccountServerCertDisable_Help When a VPN Connection Setting registered on the VPN Client is specified and that VPN Connection Setting connects to a VPN Server, use this to disable the option to check whether the SSL certificate provided by the destination VPN Server can be trusted. -CMD_AccountServerCertDisable_Args AccountServerCertDisable [name] -CMD_AccountServerCertDisable_[name] Specify the name of the VPN Connection Setting whose setting you want to change. - - -# AccountRetryOnServerCertEnable command -CMD_AccountRetryOnServerCertEnable Enable VPN connection retry if server certificate is invalid -CMD_AccountRetryOnServerCertEnable_Help When a VPN Connection Setting registered on the VPN Client is specified and that VPN Connection Setting connects to a VPN Server, use this to enable the option to retry connection if Server certificate cannot be trusted. -CMD_AccountRetryOnServerCertEnable_Args AccountRetryOnServerCertEnable [name] -CMD_AccountRetryOnServerCertEnable_[name] Specify the name of the VPN Connection Setting whose setting you want to change. - - -# AccountRetryOnServerCertDisable command -CMD_AccountRetryOnServerCertDisable Disable VPN connection retry if server certificate is invalid -CMD_AccountRetryOnServerCertDisable_Help When a VPN Connection Setting registered on the VPN Client is specified and that VPN Connection Setting connects to a VPN Server, use this to disable the option to retry connection if Server certificate cannot be trusted. -CMD_AccountRetryOnServerCertDisable_Args AccountRetryOnServerCertDisable [name] -CMD_AccountRetryOnServerCertDisable_[name] Specify the name of the VPN Connection Setting whose setting you want to change. - - -# AccountServerCertSet command -CMD_AccountServerCertSet Set Server Individual Certificate for VPN Connection Setting -CMD_AccountServerCertSet_Help When a VPN Connection Setting registered on the VPN Client is specified and that VPN Connection Setting connects to a VPN Server, use this to register the same certificate as the SSL certificate provided by the destination VPN Server. \nIf the option to verify server certificates for VPN Connection Settings is enabled, you must either use this command to save the connection destination server SSL certificate beforehand in the VPN Connection Setting settings beforehand, or use the CAAdd command etc. to register a root certificate containing the signed server SSL certificate in the list of Virtual Hub trusted CA certificates. \nIf the certificate of the connected VPN Server cannot be trusted under the condition where the option to verify server certificates has been enabled for the VPN Connection Setting, the connection will be promptly cancelled and continual reattempts at connection will be made. -CMD_AccountServerCertSet_Args AccountServerCertSet [name] [/LOADCERT:cert] -CMD_AccountServerCertSet_[name] Specify the name of the VPN Connection Setting whose setting you want to change. -CMD_AccountServerCertSet_LOADCERT Specify X.509 format certificate file name that the server individual certificate which you wish to set is saved under. - - -# AccountServerCertDelete command -CMD_AccountServerCertDelete Delete Server Individual Certificate for VPN Connection Setting -CMD_AccountServerCertDelete_Help When a VPN Connection Setting registered on the VPN Client is specified and a server individual certificate is registered for that VPN Connection Setting, use this to delete that certificate. -CMD_AccountServerCertDelete_Args AccountServerCertDelete [name] -CMD_AccountServerCertDelete_[name] Specify the name of the VPN Connection Setting whose setting you want to change. - - -# AccountServerCertGet command -CMD_AccountServerCertGet Get Server Individual Certificate for VPN Connection Setting -CMD_AccountServerCertGet_Help When a VPN Connection Setting is specified and a server Individual certificate is registered for that VPN Connection Setting, use this to get that certificate and save it as an X.509 format certificate file. -CMD_AccountServerCertGet_Args AccountServerCertGet [name] [/SAVECERT:path] -CMD_AccountServerCertGet_[name] Specify the name of the VPN Connection Setting whose setting you want to change. -CMD_AccountServerCertGet_SAVECERT Specify the certificate file name to save the server individual certificate in X.509 format. - - -# AccountDetailSet command -CMD_AccountDetailSet Set Advanced Settings for VPN Connection Setting -CMD_AccountDetailSet_Help Use this to customize the VPN protocol communication settings used when a VPN Connection Setting registered on a VPN Client is specified and that VPN Connection Setting connects to the VPN Server. -CMD_AccountDetailSet_Args AccountDetailSet [name] [/MAXTCP:max_connection] [/INTERVAL:additional_interval] [/TTL:disconnect_span] [/HALF:yes|no] [/BRIDGE:yes|no] [/MONITOR:yes|no] [/NOTRACK:yes|no] [/NOQOS:yes|no] -CMD_AccountDetailSet_[name] Specify the name of the VPN Connection Setting whose setting you want to change. -CMD_AccountDetailSet_MAXTCP Specify, using an integer in the range 1 to 32, the number of TCP connections to be used for VPN communication. By using data transmission by multiple TCP connections for VPN communication sessions with VPN Servers it is sometimes possible to increase communication speed. \nNote: We recommend about 8 lines when the connection lines to the server are fast, and 1 line when using a slow connection such as dialup. -CMD_AccountDetailSet_INTERVAL When communicating by VPN by establishing multiple TCP connections, specify in seconds, the establishing interval for each TCP connection. The standard value is 1 second. -CMD_AccountDetailSet_TTL When specifying connection life of each TCP connection specify in seconds the keep-alive time from establishing a TCP connection until disconnection. If 0 is specified, keep-alive will not be set. -CMD_AccountDetailSet_HALF Specify "yes" when enabling half duplex mode. When using two or more TCP connections for VPN communication, it is possible to use Half Duplex Mode. By enabling half duplex mode it is possible to automatically fix data transmission direction as half and half for each TCP connection. In the case where a VPN using 8 TCP connections is established, for example, when half-duplex is enabled, communication can be fixes so that 4 TCP connections are dedicated to the upload direction and the other 4 connections are dedicated to the download direction. -CMD_AccountDetailSet_BRIDGE Specify "yes" when connecting to the VPN Server using Bridge / Router Mode. When using Bridge / Router Mode to connect, it is possible to provide bridging or routing to another network on the side of the virtual network adapter of the VPN Client. However, if the security policy of the user who is being used for connection denies the use of bridges or routing, then connection will fail. -CMD_AccountDetailSet_MONITOR Specify "yes" when connecting to the VPN Server using Monitoring Mode. When a connection is made using Monitoring Mode, you can receive all packets that flow through the Virtual Hub. However, if the security policy of the user who is being used for connection does not allow Monitoring Mode, then connection will fail. -CMD_AccountDetailSet_NOTRACK Specify "yes" will disable the adjustments of routing table. Normally "no" is specified. -CMD_AccountDetailSet_NOQOS Specify "yes" when disabling VoIP / QoS functions. Normally "no" is specified. -CMD_AccountDetailSet_DISABLEUDP Specify "yes" when disabling UDP acceleration function. Normally "no" is specified. -CMD_AccountDetailSet_Eval_MaxTcp Specify an integer in the range 1 to 32 for the number of TCP connections. -CMD_AccountDetailSet_Eval_Interval Set at least 1 second for the interval to establish a TCP connection. -CMD_AccountDetailSet_Prompt_MaxTcp Number of TCP Connections to Use in VPN Communication: -CMD_AccountDetailSet_Prompt_Interval Interval between Establishing Each TCP Connection: -CMD_AccountDetailSet_Prompt_TTL Connection Life of Each TCP Connection (0 for no keep-alive): -CMD_AccountDetailSet_Prompt_HALF Enable Half-Duplex Mode (yes/no): -CMD_AccountDetailSet_Prompt_BRIDGE Enable Bridge / Router Mode (yes/no): -CMD_AccountDetailSet_Prompt_MONITOR Enable Monitoring Mode (yes/no): -CMD_AccountDetailSet_Prompt_NOTRACK Disable Adjustment of Routing Table (yes/no): -CMD_AccountDetailSet_Prompt_NOQOS Disable QoS Control Function (yes/no): -CMD_AccountDetailSet_Prompt_DISABLEUDP Disable UDP Acceleration Function (yes/no): - - -# AccountRename command -CMD_AccountRename Change VPN Connection Setting Name -CMD_AccountRename_Help Use this to specify a VPN Connection Setting registered on the VPN Client and change its name. -CMD_AccountRename_Args AccountRename [name] [/NEW:new_name] -CMD_AccountRename_[name] Specify the current name of the VPN Connection Setting whose name you want to change. -CMD_AccountRename_NEW Specify the new name after the change. -CMD_AccountRename_PROMPT_OLD Current Name: -CMD_AccountRename_PROMPT_NEW New Name: - - -# AccountConnect command -CMD_AccountConnect Start Connection to VPN Server using VPN Connection Setting -CMD_AccountConnect_Help Use this to specify a VPN Connection Setting registered on the VPN Client and start a connection to the VPN Server using that VPN Connection Setting. A VPN Connection Setting that has a connecting status or a connected status will continue to be connected to the VPN Server, or continue to attempt to connect to the VPN Server until the AccountDisconnect command is used to disconnect the connection (Note however, if the AccountRetrySet command is used to specify the number of retries, connection attempts will be aborted when the specified value is reached.) -CMD_AccountConnect_Args AccountConnect [name] -CMD_AccountConnect_[name] Specify the name of the VPN Connection Setting whose connection you want to start. - - -# AccountDisconnect command -CMD_AccountDisconnect Disconnect VPN Connection Setting During Connection -CMD_AccountDisconnect_Help Use this to specify a VPN Connection Setting that is registered on the VPN Client and that is either in the condition of connecting or is connected, and immediately disconnect it. -CMD_AccountDisconnect_Args AccountDisconnect [name] -CMD_AccountDisconnect_[name] Specify the name of the VPN Connection Setting to disconnect. - - -# AccountStatusGet command -CMD_AccountStatusGet Get Current VPN Connection Setting Status -CMD_AccountStatusGet_Help When a VPN Connection Setting that is registered on the VPN Client is specified and that VPN Connection Setting is currently connected, use this to get its connection status and other information. -CMD_AccountStatusGet_Args AccountStatusGet [name] -CMD_AccountStatusGet_[name] Specify the name of the VPN Connection Setting whose information you want to get. - - -# AccountNicSet command -CMD_AccountNicSet Set Virtual Network Adapter for VPN Connection Setting to Use -CMD_AccountNicSet_Help Use this to change the Virtual Network Adapter name that the existing VPN Connection Settings registered on the VPN Client will use for the connection to a VPN Server. -CMD_AccountNicSet_Args AccountNicSet [name] [/NICNAME:nicname] -CMD_AccountNicSet_[name] Specify the name of the VPN Connection Setting whose setting you want to change. -CMD_AccountNicSet_NICNAME Specify the Virtual Network Adapter name to use when connecting to the VPN Server. - - -# AccountStatusShow command -CMD_AccountStatusShow Set Connection Status and Error Screen to Display when Connecting to VPN Server -CMD_AccountStatusShow_Help When a communication setting is registered on the VPN Client and that communication setting is being used to connect to the VPN Server, use this to set the connection status and error screen to be displayed on the computer display. -CMD_AccountStatusShow_Args AccountStatusShow [name] -CMD_AccountStatusShow_[name] Specify the name of the VPN Connection Setting whose setting you want to change. - - -# AccountStatusHide command -CMD_AccountStatusHide Set Connection Status and Error Screen to be Hidden when Connecting to VPN Server -CMD_AccountStatusHide_Help When a communication setting is registered on the VPN Client and that communication setting is being used to connect to the VPN Server, use this to set the connection status and error screen to not be displayed on the computer display. -CMD_AccountStatusHide_Args AccountStatusHide [name] -CMD_AccountStatusHide_[name] Specify the name of the VPN Connection Setting whose setting you want to change. - - -# AccountSecureCertSet command -CMD_AccountSecureCertSet Set User Authentication Type of VPN Connection Setting to Smart Card Authentication -CMD_AccountSecureCertSet_Help Use this to set the user auth type to Smart Card Authentication for when a VPN Connection Setting registered on the VPN Client is specified and that VPN Connection Setting connects to the VPN Server. Also, you must specify the names of the certificate object and the private key object stored on the smart card. -CMD_AccountSecureCertSet_Args AccountSecureCertSet [name] [/CERTNAME:cert] [/KEYNAME:key] -CMD_AccountSecureCertSet_[name] Specify the name of the VPN Connection Setting whose setting you want to change. -CMD_AccountSecureCertSet_CERTNAME Specify the name of the certificate object stored on the smart card. -CMD_AccountSecureCertSet_KEYNAME Specify the name of the private key object stored on the smart card. The private key must be compatible with the certificate specified by /CERTNAME. -CMD_AccountSecureCertSet_PROMPT_CERTNAME Name of Certificate Object on Smart Card: -CMD_AccountSecureCertSet_PROMPT_KEYNAME Name of Private Key Object on Smart Card: - - -# PcAccountOpensslEngineCertSet -CMD_AccountOpensslCertSet_PROMPT_KEYNAME Specify the openssl engine specific key name: -CMD_AccountOpensslCertSet_PROMPT_ENGINENAME Specify the openssl engine name: - - -# AccountRetrySet コマンド -CMD_AccountRetrySet Set Interval between Connection Retries for Connection Failures or Disconnections of VPN Connection Setting -CMD_AccountRetrySet_Help When a VPN Connection Setting registered on the VPN Client is specified and that VPN Connection Setting attempts to connect to a VPN Server, use this to specify the interval to wait between connection attempts and the limit of how many times to retry connecting when communication with the VPN Server has been disconnected or when the connection process failed. \nIf the user authentication type is Smart Card Authentication, no connection retry will be performed regardless of the Number of Connection Attempts setting. -CMD_AccountRetrySet_Args AccountRetrySet [name] [/NUM:num_retry] [/INTERVAL:retry_interval] -CMD_AccountRetrySet_[name] Specify the name of the VPN Connection Setting whose setting you want to change. -CMD_AccountRetrySet_NUM Specify the number of times to make consecutive retries. By specifying "999", there will be limitless attempts to reconnection (always connect). By specifying "0", not attempt at reconnection will be made. -CMD_AccountRetrySet_INTERVAL When attempting a reconnection, this sets how many seconds to wait after the previous disconnection or connection failure before starting the reconnection process. -CMD_AccountRetrySet_PROMPT_NUM Reconnection Count ("999" is unlimited): -CMD_AccountRetrySet_PROMPT_INTERVAL Reconnection Interval (Seconds): -CMD_AccountRetrySet_EVAL_INTERVAL Specify 5 seconds or more for the retries interval. - - -# AccountStartupSet command -CMD_AccountStartupSet Set VPN Connection Setting as Startup Connection -CMD_AccountStartupSet_Help Use this to specify a VPN Connection Setting registered on the VPN Client and set it as the startup connection. The VPN Connection Setting that is set as the startup connection will automatically start the connection process when the VPN Client service starts. -CMD_AccountStartupSet_Args AccountStartupSet [name] -CMD_AccountStartupSet_[name] Specify the name of the VPN Connection Setting whose setting you want to change. - - -# AccountStartupRemove command -CMD_AccountStartupRemove Remove Startup Connection of VPN Connection Setting -CMD_AccountStartupRemove_Help When a VPN Connection Setting registered on the VPN Client is specified and that VPN Connection Setting is currently set as a startup connection, use this to delete the startup connection. -CMD_AccountStartupRemove_Args AccountStartupRemove [name] -CMD_AccountStartupRemove_[name] Specify the name of the VPN Connection Setting whose setting you want to change. - - -# AccountExport command -CMD_AccountExport Export VPN Connection Setting -CMD_AccountExport_Help Use this to specify a VPN Connection Setting registered on the VPN Client and export its contents as a text file. By exporting a VPN Connection Setting file, and then later, importing it, you can duplicate the contents of a VPN Connection Setting. Also, because it gets saved as a text file, you can edit the contents using a conventional text editor. \nThe export destination file is saved as a UTF-8 format text file. Also, it is convenient to save the file name with the file extension .vpn as this file extension is associated to the Windows Edition VPN Client Manager. -CMD_AccountExport_Args AccountExport [name] [/SAVEPATH:savepath] -CMD_AccountExport_[name] Specify the name of the VPN Connection Setting to export. -CMD_AccountExport_SAVEPATH Specify a file name for the save destination. -CMD_AccountExport_PROMPT_SAVEPATH Save Destination File Name (recommended extension: vpn): - - -# AccountImport command -CMD_AccountImport Import VPN Connection Setting -CMD_AccountImport_Help Use this to import the VPN Connection Setting file that has been exported by the AccountExport command and add it to the VPN Client. -CMD_AccountImport_Args AccountImport [path] -CMD_AccountImport_[path] Specify the file name of the import source. -CMD_AccountImport_PROMPT_PATH Import Source File Name: -CMD_AccountImport_FAILED_PARSE Unable to correctly parse the specified file. Please check it if the file was exported correctly. -CMD_AccountImport_OK The VPN Connection Setting "%s" has been imported. - - - -# RemoteEnable command -CMD_RemoteEnable Allow Remote Management of VPN Client Service -CMD_RemoteEnable_Help Use this to allow management of a VPN Client service from a remote computer that is not localhost, via a remote connection by Command Line Management Utility or VPN Client Manager. -CMD_RemoteEnable_Args RemoteEnable - - -# RemoteDisable command -CMD_RemoteDisable Deny Remote Management of VPN Client Service -CMD_RemoteDisable_Help Use this to deny management of a VPN Client service from a remote computer that is not localhost, via a remote connection by Command Line Management Utility or VPN Client Manager. -CMD_RemoteDisable_Args RemoteDisable - - - - - - -################################################### -# # -# Commands for VPN Tools are listed below # -# # -################################################### - - -# MakeCert command -CMD_MakeCert Create New X.509 Certificate and Private Key (1024 bit) -CMD_MakeCert_Help Use this to create a new X.509 certificate and private key and save it as a file. \nThe algorithm used to create the public key and private key of the certificate is RSA 1024 bit. \nYou can choose to create a root certificate (self-signed certificate) or a certificate signed by another certificate. To create a certificate that is signed by another certificate, you require a private key file (base 64 encoded) that is compatible with the certificate that uses the signature (X.509 format file). \n\nWhen creating a certificate, you can specify the following: Name (CN), Organization (O), Organization Unit (OU), Country (C), State (ST), Locale (L), Serial Number, and Expiration Date. \nThe created certificate will be saved as an X.509 format file and the private key file will be saved in a Base 64 encoded RSA 1024 bit format file. \n\nThe MakeCert command is a tool that provides the most rudimentary function for creating certificates. If you want to create a more substantial certificate, we recommend that you use either free software such as OpenSSL, or commercial CA (certificate authority) software. \n\nNote: This command can be called from the SoftEther VPN Command Line Management Utility. You can also execute this command while connected to the current VPN Server or VPN Client in Administration Mode but, what actually performs the RSA computation, generates the certificate data and saves it to file is the computer on which the command is running, and all this is executed in a context that has absolutely no relationship to the computer that is the destination of the Administration Mode connection. -CMD_MakeCert_Args MakeCert [/CN:cn] [/O:o] [/OU:ou] [/C:c] [/ST:st] [/L:l] [/SERIAL:serial] [/EXPIRES:expires] [/SIGNCERT:signcert] [/SIGNKEY:signkey] [/SAVECERT:savecert] [/SAVEKEY:savekey] -CMD_MakeCert_CN Specify the Name (CN) item of the certificate to create. You can specify "none". -CMD_MakeCert_O Specify the Organization (O) item of the certificate to create. You can specify "none". -CMD_MakeCert_OU Specify the Organization Unit (OU) item of the certificate to create. You can specify "none". -CMD_MakeCert_C Specify the Country (C) item of the certificate to create. You can specify "none". -CMD_MakeCert_ST Specify the State (ST) item of the certificate to create. You can specify "none". -CMD_MakeCert_L Specify the Locale (L) item of the certificate to create. You can specify "none". -CMD_MakeCert_SERIAL Specify the Serial Number item of the certificate to create. Specify using hexadecimal values. You can specify "none". -CMD_MakeCert_EXPIRES Specify the Expiration Date item of the certificate to create. If you specify "none" or "0", 3650 days (approx. 10 years) will be used. You can specify a maximum of 10950 days (about 30 years). -CMD_MakeCert_SIGNCERT For cases when the certificate to be created is signed by an existing certificate, specify the X.509 format certificate file name to be used to sign the signature. When this parameter is omitted, such signature signing is not performed and the new certificate is created as a root certificate. -CMD_MakeCert_SIGNKEY Specify a private key (RSA, base-64 encoded) that is compatible with the certificate specified by /SIGNCERT. -CMD_MakeCert_SAVECERT Specify the file name to save the certificate you created. The certificate is saved as an X.509 file that includes a public key that is RSA format 1024 bit. -CMD_MakeCert_SAVEKEY Specify the file name to save private key that is compatible with the certificate you created. The private key will be saved as an RSA-format 1024-bit private key file. -CMD_MakeCert_PROMPT_CN Name of Certificate to Create (CN): -CMD_MakeCert_PROMPT_O Organization of Certificate to Create (O): -CMD_MakeCert_PROMPT_OU Organization Unit of Certificate to Create (OU): -CMD_MakeCert_PROMPT_C Country of Certificate to Create (C): -CMD_MakeCert_PROMPT_ST State of Certificate to Create (ST): -CMD_MakeCert_PROMPT_L Locale of Certificate to Create (L): -CMD_MakeCert_PROMPT_SERIAL Serial Number of Certificate to Create (Hexadecimal): -CMD_MakeCert_PROMPT_EXPIRES Expiration Date of Certificate to Create (Days): -CMD_MakeCert_PROMPT_SAVECERT File Name to Save Certificate to Create: -CMD_MakeCert_PROMPT_SAVEKEY File Name to Save Private Key to Create: -CMD_MakeCert_EVAL_EXPIRES Specify the Expiration Date within the range %u to %u. -CMD_MakeCert_ERROR_SIGNKEY Either it is not possible to read the certificate or private key specified by /SIGNCERT and /SIGNKEY, or they were an invalid combination. -CMD_MakeCert_ERROR_GEN_FAILED Creation of certificate and private key failed. - - -# MakeCert2048 command -CMD_MakeCert2048 Create New X.509 Certificate and Private Key (2048 bit) -CMD_MakeCert2048_Help Use this to create a new X.509 certificate and private key and save it as a file. \nThe algorithm used to create the public key and private key of the certificate is RSA 2048 bit. \nYou can choose to create a root certificate (self-signed certificate) or a certificate signed by another certificate. To create a certificate that is signed by another certificate, you require a private key file (base 64 encoded) that is compatible with the certificate that uses the signature (X.509 format file). \n\nWhen creating a certificate, you can specify the following: Name (CN), Organization (O), Organization Unit (OU), Country (C), State (ST), Locale (L), Serial Number, and Expiration Date. \nThe created certificate will be saved as an X.509 format file and the private key file will be saved in a Base 64 encoded RSA 2048 bit format file. \n\nThe MakeCert command is a tool that provides the most rudimentary function for creating certificates. If you want to create a more substantial certificate, we recommend that you use either free software such as OpenSSL, or commercial CA (certificate authority) software. \n\nNote: This command can be called from the SoftEther VPN Command Line Management Utility. You can also execute this command while connected to the current VPN Server or VPN Client in Administration Mode but, what actually performs the RSA computation, generates the certificate data and saves it to file is the computer on which the command is running, and all this is executed in a context that has absolutely no relationship to the computer that is the destination of the Administration Mode connection. -CMD_MakeCert2048_Args MakeCert2048 [/CN:cn] [/O:o] [/OU:ou] [/C:c] [/ST:st] [/L:l] [/SERIAL:serial] [/EXPIRES:expires] [/SIGNCERT:signcert] [/SIGNKEY:signkey] [/SAVECERT:savecert] [/SAVEKEY:savekey] -CMD_MakeCert2048_CN Specify the Name (CN) item of the certificate to create. You can specify "none". -CMD_MakeCert2048_O Specify the Organization (O) item of the certificate to create. You can specify "none". -CMD_MakeCert2048_OU Specify the Organization Unit (OU) item of the certificate to create. You can specify "none". -CMD_MakeCert2048_C Specify the Country (C) item of the certificate to create. You can specify "none". -CMD_MakeCert2048_ST Specify the State (ST) item of the certificate to create. You can specify "none". -CMD_MakeCert2048_L Specify the Locale (L) item of the certificate to create. You can specify "none". -CMD_MakeCert2048_SERIAL Specify the Serial Number item of the certificate to create. Specify using hexadecimal values. You can specify "none". -CMD_MakeCert2048_EXPIRES Specify the Expiration Date item of the certificate to create. If you specify "none" or "0", 3650 days (approx. 10 years) will be used. You can specify a maximum of 10950 days (about 30 years). -CMD_MakeCert2048_SIGNCERT For cases when the certificate to be created is signed by an existing certificate, specify the X.509 format certificate file name to be used to sign the signature. When this parameter is omitted, such signature signing is not performed and the new certificate is created as a root certificate. -CMD_MakeCert2048_SIGNKEY Specify a private key (RSA, base-64 encoded) that is compatible with the certificate specified by /SIGNCERT. -CMD_MakeCert2048_SAVECERT Specify the file name to save the certificate you created. The certificate is saved as an X.509 file that includes a public key that is RSA format 2048 bit. -CMD_MakeCert2048_SAVEKEY Specify the file name to save private key that is compatible with the certificate you created. The private key will be saved as an RSA-format 2048-bit private key file. - - -# TrafficClient command -CMD_TrafficClient Run Network Traffic Speed Test Tool in Client Mode -CMD_TrafficClient_Help Use this to execute the communication throughput measurement tool's client program. \nTwo commands, TrafficClient and TrafficServer, are used for the communication throughput measurement tool to enable the measurement of communication throughput that can be transferred between two computers connected by IP network. The TrafficServer command is used first on another computer which puts the communication throughput measurement tool server in a listening condition. Then the TrafficClient command is used to connect to that server by specifying its host name or IP address and port number, which makes it possible to measure the communication speed. \nMeasurement of the communication speed is carried out by concurrently establishing multiple TCP connections and calculating the actual number of bits of data that can be transferred within a specified time based on the respective results of transferring the maximum stream data on each connection and then using that to calculate the average value (bps) of communication throughput. Normally when there is one TCP connection, it is common to only be able to achieve communication speeds slower than the actual net throughput because of limitations related to the TCP algorithm. We therefore recommend the establishment of multiple concurrent TCP connections when measuring communication results. Because the throughput that is measured using this measurement method is calculated from the bit length of the data that arrives on the receiver side as a stream by TCP, the packet loss that occurs during transfer and the packets with corrupted data are not included in the packets that actually arrive, which means it is possible to calculate a genuine value that is close to the maximum possible communication bandwidth of the network. \nUsing the measurement results, i.e. the stream size transferred by TCP, the approximate value of data volume that actually passed through the network is calculated and this is divided by time to calculate the bits per sec (bps). The calculation assumes the type of the physical network is Ethernet (IEEE802.3) and the MAC frame payload size is 1,500 bytes (TCP MSS is 1,460 bytes). By specifying the /RAW option, the calculation will not make corrections for the TCP/IP header and MAC header data volume. \n\nNote: This command can be called from the SoftEther VPN Command Line Management Utility. You can also execute this command while connected to the current VPN Server or VPN Client in Administration Mode but, what actually conducts communication and measures the throughput is the computer on which the command is running, and all this is executed in a context that has absolutely no relationship to the computer that is the destination of the Administration Mode connection. -CMD_TrafficClient_Args TrafficClient [host:port] [/NUMTCP:numtcp] [/TYPE:download|upload|full] [/SPAN:span] [/DOUBLE:yes|no] [/RAW:yes|no] -CMD_TrafficClient_[host:port] Specify the host name or IP address and port number that the communication throughput measurement tool server (TrafficServer) is listening for. If the port number is omitted, 9821 will be used. -CMD_TrafficClient_NUMTCP Specify the number of TCP connections to be concurrently established between the client and the server for data transfer. If omitted, 32 will be used. -CMD_TrafficClient_TYPE Specify the direction of data flow when throughput measurement is performed. Specify one of the following options: "download", "upload" or "full". By specifying "download" the data will be transmitted from the server side to the client side. By specifying "upload" the data will be transmitted from the client side to the server side. By specifying "full", the data will be transferred in both directions. When "full" is specified, the NUMTCP value must be an even number of two or more (half the number will be used for concurrent TCP connections in the download direction and the other half will be used in the upload direction). If this parameter is omitted, "full" will be used. -CMD_TrafficClient_SPAN Specify, using seconds, the time span to conduct data transfer for the measurement of throughput. If this parameter is omitted, "15" will be used. -CMD_TrafficClient_DOUBLE When "yes" is specified, the throughput of the measured result will be doubled and then displayed. This option is used for cases when a network device etc. is somewhere on the data route and the total throughput capability that is input and output by this network device is being measured. -CMD_TrafficClient_RAW By specifying "yes", the calculation will not make corrections for the TCP/IP header and MAC header data volume. -CMD_TrafficClient_EVAL_NUMTCP Specify a value of 32 or less for the number of TCP connections. -CMD_TrafficClient_PROMPT_HOST Measurement Server Name and Port Number (9821 if omitted): -CMD_TrafficClient_ERROR_NUMTCP When the data direction is "full" (both directions), you must specify an even value for the number of TCP connections (/NUMTCP). -CMD_TrafficClient_ERROR_HOSTPORT The host name or port number is incorrectly specified. - - -# TrafficServer command -CMD_TrafficServer Run Network Traffic Speed Test Tool in Server Mode -CMD_TrafficServer_Help Use this to execute the communication throughput measurement tool's server program. \nTwo commands, TrafficClient and TrafficServer, are used for the communication throughput measurement tool to enable the measurement of communication throughput that can be transferred between two computers connected by IP network. \nTo set the TCP port of this computer to the Listen status to listen for the connection from the TrafficClient of another computer, specify the port number and start the server program using the TrafficServer command. \nYou can display more detailed information on the communication throughput measurement tool by inputting "TrafficClient ?". \n\nNote: This command can be called from the SoftEther VPN Command Line Management Utility. You can also execute this command while connected to the current VPN Server or VPN Client in Administration Mode but, what actually conducts communication and measures the throughput is the computer on which the command is running, and all this is executed in a context that has absolutely no relationship to the computer that is the destination of the Administration Mode connection. -CMD_TrafficServer_Args TrafficServer [port] [/NOHUP:yes|no] -CMD_TrafficServer_[port] Specify, using an integer, the port number at which to listen for the connection. If the specified port has been already being used by another program, or if the port cannot be opened, an error will occur. -CMD_TrafficServer_NOHUP When "yes" is specified, the server process never stops without regard to any input from the console. It is convenient when you want to run the TrafficServer endlessly. - - - -# Internal message strings concerning TrafficClient / TrafficServer -TT_LISTEN_FAILED Unable to set TCP port %u to Listen status. The port may be being used by another application or this application did not have the authority to open the port. -TTS_LISTEN_STOP The port for listening has been closed. -TTS_ENTER_TO_EXIT \n----------------------------------------\nThe Network Traffic Speed Test Tool in Server Mode started. \n\nPress the Enter key to stop the server program. \n----------------------------------------\n\n -TTS_INIT Starting the server program... -TTS_LISTEN_STARTED The server program has been started. Now the IPv4 TCP port %u is set to Listen status and listening for connection from the client. -TTS_LISTEN_STARTED_V6 The IPv6 TCP Port %u is listening to accept clients. -TTS_LISTEN_FAILED_V6 Failed to open the IPv6 TCP Port %u. Another application might be using the same IPv6 TCP Port, or the IPv6 stack is not installed on the operating system. -TTS_STOP_INIT Stopping the server program... -TTS_STOP_FINISHED The stopping of the server program is complete. -TTS_ACCEPTED Connection %u: Connected from Client %S Port %u. -TTS_DISCONNECTED Connection %u (%S) has been disconnected. -TTS_DISCONNECT Connection %u (%S) has been disconnected. -TTC_INIT Starting the client program... -TTC_FREE The client program has beens terminated. -TTC_CONNECT_START The connection to server %S (port %u) will start. %u TCP connections will be connected. -TTC_CONNECT_FAILED The connection of TCP connection number %u failed. -TTC_CONNECT_NOT_SERVER Because a program other than TrafficServer is operating on the destination TCP port, traffic cannot be measured. -TTC_CONNECT_OK TCP connection number %u has been connected. -TTC_CONNECT_OK_2 \ Data transfer direction: %s -TTC_ERROR_ABORTED The TCP connection initialization with the server failed. Measurement will stop. -TTC_SUMMARY_BAR ------------------------------------------------------- -TTC_SUMMARY_TITLE Network Traffic Speed Test Tool Client Setting Parameters -TTC_SUMMARY_HOST Destination Host Name -TTC_SUMMARY_PORT Destination TCP Port Number -TTC_SUMMARY_NUMTCP Number of TCP Connections to Establish -TTC_SUMMARY_TYPE Data Transfer Direction -TTC_SUMMARY_SPAN Data Transmission Time -TTC_SUMMARY_ETHER Data Correction for Ethernet Frames -TTC_SUMMARY_DOUBLE Measurement of Total Speed of Relay Device Input Output -TTC_TYPE_DOWNLOAD Download (Server to Client) -TTC_TYPE_UPLOAD Upload (Client to Server) -TTC_TYPE_FULL Full (Server < -- > Client) -TTC_SPAN_STR %.1f seconds -TTC_COMM_START \nAll connections were established and so data transfer started. \nMeasurement Start Time: %s\nScheduled Finish Time: %s\n\nMeasuring in progress. Please wait... \n(Do not use any other applications while measuring is in progress.)\n\n -TTC_COMM_END Because %.1f seconds or more have passed, the data communication will end. \n\n -TTC_COMM_USER_CANCEL Because of cancellation by user, the data communication will end. \n\n -TTC_COMM_DISCONNECTED The TCP connection %u has been disconnected. -TTC_STOPPING Stopping the operation of the communication throughput measurement tool client... -TTC_ENTER_TO_EXIT \n----------------------------------------\nThe Network Traffic Speed Test Tool in Client Mode started. \n\nPress the Enter key to stop the client program. \n----------------------------------------\n\n -TTC_RES_TITLE \n\nNetwork Traffic Speed Test Tool\n\n -TTC_RES_COLUMN_1 Item Name -TTC_RES_COLUMN_2 Normal View -TTC_RES_COLUMN_3 Simplified View -TTC_RES_SPAN Time Span for Measurement -TTC_RES_ETHER Data Correction for Ethernet Frames -TTC_RES_BYTES_DOWNLOAD Communication Data Volume in Download Direction -TTC_RES_BYTES_UPLOAD Communication Data Volume in Upload Direction -TTC_RES_BYTES_TOTAL Total Communication Data Volume -TTC_RES_DOUBLE Relay Device Input Output Total Throughput Computation -TTC_RES_BPS_DOWNLOAD Average Throughput in Download Direction -TTC_RES_BPS_UPLOAD Average Throughput in Upload Direction -TTC_RES_BPS_TOTAL Total Average Throughput - - -# Check command -CMD_Check Check whether SoftEther VPN Operation is Possible -CMD_Check_Help Use this to check if the current computer that is running vpncmd is a suitable operation platform for SoftEther VPN Server / Bridge. \nIf this check passes on a system, it is most likely that SoftEther VPN software will operate correctly on that system. \nAlso, if this check does not pass on a system, then this indicates that some type of trouble may arise if SoftEther VPN software is used on that system. -CMD_Check_Args Check - - -# Concerning System Checker -# (This contains some strange character strings which are used to check character code conversion.) -CHECK_TITLE ---------------------------------------------------\nSoftEther VPN Operation Environment Check Tool\nDeveloper Edition\n\nCopyright (c) SoftEther VPN Project.\nAll Rights Reserved.\n\n -CHECK_NOTE If this operation environment check tool is run on a system and that system passes, it is most likely that SoftEther VPN software can operate on that system. This check may take a while. Please wait...\n\n -CHECK_EXEC_TAG Checking '%s'... \n -CHECK_PASS Pass -CHECK_FAIL Fail -CHECK_RESULT_1 All checks passed. It is most likely that SoftEther VPN Server / Bridge can operate normally on this system. -CHECK_RESULT_2 Some checks failed. Please check the operation environment of this system. If SoftEther VPN Server / Bridge were to be executed on this system, troubles may occur. -CHECK_TEST_123456789 123456789 - - -CHECK_PROC_KERNEL Kernel System -CHECK_PROC_MEMORY Memory Operation System -CHECK_PROC_STRINGS ANSI / Unicode string processing system -CHECK_PROC_FILESYSTEM File system -CHECK_PROC_THREAD Thread processing system -CHECK_PROC_NETWORK Network system - - - - - - - - -###################################################### -# # -# Setup Wizard (SW) Strings # -# # -###################################################### - -SW_TITLE SoftEther VPN Developer Edition Setup Wizard (Version %S) -SW_EXIT_CONFIRM The setup process of SoftEther VPN hasn't been finished yet.\r\n\r\nDo you want to exit the setup? -SW_UNINSTALL_CONFIRM Starting the uninstall process of %s.\r\n\r\nDo you want to continue? - - -SW_COMPONENT_VPNSERVER_TITLE SoftEther VPN Server -SW_COMPONENT_VPNSERVER_DESCRIPTION Install it on a server computer at the central site of VPN. The management tools will be also installed. - -SW_COMPONENT_VPNCLIENT_TITLE SoftEther VPN Client -SW_COMPONENT_VPNCLIENT_DESCRIPTION Install it on VPN client computers. A VPN client computer will be able to connect to the central VPN Server. The management tools will be also installed. - -SW_COMPONENT_VPNBRIDGE_TITLE SoftEther VPN Bridge -SW_COMPONENT_VPNBRIDGE_DESCRIPTION Install it on computers at each site. Each VPN Bridge will establish a VPN connection to the central VPN Server. The management tools will be also installed. - -SW_COMPONENT_VPNSMGR_TITLE SoftEther VPN Server Manager (Admin Tools Only) -SW_COMPONENT_VPNSMGR_DESCRIPTION Only the VPN Server Manager will be installed. The VPN Server service program will not be installed. You can use the VPN Server Manager to connect and manage remote VPN Servers and VPN Bridges on other computers which can be run on Windows, Linux, Mac OS X, Solaris and FreeBSD. - -SW_COMPONENT_VPNCMGR_TITLE SoftEther VPN Client Manager (Admin Tools Only) -SW_COMPONENT_VPNCMGR_DESCRIPTION Only the VPN Client Manager will be installed. The VPN Client service program will not be installed. You can use the VPN Client Manager to connect and manage remote VPN Clients on other computers which can be run on Windows and Linux. - -SW_WELCOME_TITLE Welcome to the SoftEther VPN Developer Edition Setup Wizard -SW_MODE_TITLE Select a Setup Mode -SW_NOT_ADMIN_TITLE Not Enough Privileges -SW_COMPONENTS_TITLE Select Software Components to Install -SW_EULA_TITLE End User License Agreement -SW_WARNING_TITLE Important Notices -SW_DIR_TITLE Directory to Install on -SW_READY_TITLE Ready to Install -SW_PERFORM_TITLE Setup is in Progress -SW_ERROR_TITLE Results of Setup -SW_FINISH_TITLE Setup Finished -SW_UNINST1_TITLE Uninstaller -SW_LANG1_TITLE SoftEther VPN: Configure the Display Language -SW_EASY1_TITLE Welcome to SoftEther VPN Client Easy Installer Creator -SW_EASY2_TITLE Specify Files -SW_WEB1_TITLE Welcome to SoftEther VPN Client Web Installer Creator -SW_WEB2_TITLE Specify Files - -SW_UNINSTALLINFO_URL http://selinks.org/ -SW_UNINSTALLINFO_PUBLISHER SoftEther VPN Project - -SW_KB3033929_REQUIRED In Windows 7 and Windows Server 2008 R2, some SoftEther VPN functions require the Microsoft's Windows Update module KB3033929 installed.\r\n\r\nIf KB3033929 is not installed in your Windows, please install it from Windows Update or Microsoft website before installing SoftEther VPN. - - -SW_COMPONENTS_ABOUT_TAG About %s -SW_COMPONENTS_REQUIRE_ADMIN Installation Requires Administrators Privileges -SW_COMPONENTS_REQUIRE_ADMIN_TEXT You have to restart the setup wizard by a user who has Administrators privileges to install %s in the System Mode. To install in the System Mode, click Back. -SW_DIR_SELECT Please Specify the Directory to Install -SW_DIR_MORE_THAN_110 The directory name is too long.\r\nSpecify 110 letters at most. -SW_DIR_WRITE_ERROR Unable to create the specified directory "%s" or failed to write a file on the directory.\r\n\r\nSpecify another directory. -SW_DIR_DST_IS_SAME_TO_SRC The specified directory "%s" is same as the source directory. -SW_DIR_IS_NOT_HDD The specified directory "%s" is not a local hard disk drive.\r\n\r\nTo install %s in the System Mode, you have to specify a directory on a local hard disk drive. -SW_DIR_IS_NOT_FULLPATH The directory "%s" is not a format of full path.\r\n\r\nPlease specify the full path of the directory. -SW_DIR_DST_IS_OTHER_PRODUCT The specified directory has another component already installed.\r\n\r\nPlease specify another directory. -SW_DIR_DST_IS_NEWER Newer version of the software has been installed on the specified directory.\r\n\r\nYou need not to install this version. -SW_DIR_DST_IS_NEWER_2 Newer version of the software has been installed on the specified directory.\r\n\r\nThis installer will import and apply the VPN Connection Settings which is built-in on the Easy Installer. No program files will be overwritten. -SW_DIR_DST_IS_BROKEN Unable to read a file "%s" which is on the specified directory.\r\n\r\nPlease specify another directory. -SW_DIR_DST_IS_SYSTEM_MODE The same software is already installed on the specified directory as the System Mode.\r\n\r\nPlease specify another directory. -SW_DIR_DST_IS_USER_MODE The same software is already installed on the specified directory as the User Mode.\r\n\r\nPlease specify another directory. -SW_SYSTEM_MODE_ALREADY_INSTALLED The software "%s" is already installed on this computer as the System Mode.\r\n\r\nBoth the System Mode and the User Mode installation of the same software on the same computer will conflict.\r\n\r\nDo you really want to continue the installation as the User Mode? - -SW_SETUPLOG_CORRUPTED The "setuplog.dat" file is broken. -SW_MSI_UNINSTALL_FAILED The older version of %s (Product Code: "%S") is installed. Windows Installer failed to uninstall this older version.\r\n\r\nPlease uninstall this older version manually and restart this installer again. -SW_MSI_UNINSTALL_REBOOT_REQUIRED Windows Installer has uninstalled the older version of %s. The reboot of computer is required.\r\n\r\nPress Finish button and reboot the computer MANUALLY, and restart this installer after the reboot. -SW_NOTICE_VPNSERVER_IS_INSTALLED SoftEther VPN Bridge is selected as a component to install. However, this computer has already had SoftEther VPN Server installed.\r\n\r\nUsually, you don't need to install both SoftEther VPN Server and SoftEther VPN Bridge on the same computer.\r\nIf you install both software, conflicts such as port number duplication will occur.\r\nIf you want to replace the SoftEther VPN Server to SoftEther VPN Bridge, you should exit this installer, uninstall SoftEther VPN Server and restart this installer after that.\r\n\r\nDo you really want to continue the SoftEther VPN Bridge installation? -SW_NOTICE_VPNBRIDGE_IS_INSTALLED SoftEther VPN Server is selected as a component to install. However, this computer has already had SoftEther VPN Bridge installed.\r\n\r\nUsually, you don't need to install both SoftEther VPN Bridge and SoftEther VPN Server on the same computer.\r\nIf you install both software, conflicts such as port number duplication will occur.\r\nIf you want to replace the SoftEther VPN Server to SoftEther VPN Server, you should exit this installer, uninstall SoftEther VPN Bridge and restart this installer after that.\r\n\r\nDo you really want to continue the SoftEther VPN Server installation? -SW_OS_FAILED This operating system doesn't support %s. -SW_LANG_NOT_CHANGED The language settings of %s were not changed. -SW_LANG_LIST_LOAD_FAILED Loading the available language list failed. -SW_LANG_OK The display language of %s has been changed successfully.\r\nIf %s programs are currently running, exit a program and restart it to apply the new display language. If the display language still doesn't effect, reboot Windows.\r\n -SW_LANG_OK_SERVICE \r\nThe language of log files which the service program records will be changed to the new language after a reboot. -SW_LANG_OK_VPNCMGR \r\nThe display setting of VPN Client Manager will be changed after exit and reboot VPN Client Manager. (Including complete termination from the task tray.) -SW_CHILD_PROCESS_ERROR Failed to execute a child process. -SW_EXE_FILTER Windows Executable Files (*.EXE)|*.exe|All Files (*.*)|*.* -SW_PERFORM_MSG_EASY_INFO Compiling the VPN Client Easy Installer... -SW_EASY_FINISHED_MSG The VPN Client Easy Installer is created successfully.\r\nThe installer is saved as the following filename.\r\n\r\n%s\r\n\r\nYou can distribute the above file in the enterprise. -SW_EASY_ERROR_MSG Failed to create a VPN Client Easy Installer. -SW_OTHER_INSTANCE_EXISTS Another SoftEther VPN Setup Wizard is running.\r\n\r\nYou can continue this wizard after another wizard exits. -SW_PERFORM_MSG_WEB_INFO Compiling the VPN Client Web Installer... -SW_WEB_ERROR_MSG Failed to create a VPN Client Web Installer. -SW_INSTALLER_CACHE_IS_NOT_SIGNED The currently installed SoftEther VPN Client of this computer has not been installed from the digital-signed package signed by an Authenticode digital certificate of SoftEther VPN Project.\r\nIt might be installed from a customized installer (for example, an installer created by Easy Installer Creator.)\r\n\r\nIf you continue to create a Web Installer, a warning message will be appeared on the user's screen when its loading.\r\nTo avoid showing the warning message, you should cancel this creating wizard, download the latest version of SoftEther VPN Client from the SoftEther VPN Project's web site, re-install it and restart the Web Installer Creator wizard.\r\n\r\nDo you really to continue to create a Web Installer? -SW_FILE_NOT_FOUNT The file "%s" not found. -SW_WEB_FINISHED The Web Installer is created and saved as "%s".\r\n\r\nPlease extract inner files from the ZIP file, upload them into the Web server, and edit a HTML file and an inf file to replace URLs appropriately.\r\n\r\nThe explanation to deploy the Web Installer is described on the ZIP file. - -SW_VG_CONFIRM_MSG Do you really want to install and activate the VPN Gate P2P Relay Function plug-in module with SoftEther VPN Client?\r\n\r\nThis plug-in will realize the stability of communication to bypass the government censorship firewall. However, the communication of VPN Gate usually consumes some network bandwidth. VPN Gate is not recommended to be used in the mobile connections. \r\n\r\nPlease note that there are some countries and regions which have the regulation to forbid the encrypted communications to bypass government censorship firewalls. In such a case, you must not use the VPN Gate functions on your computer. VPN Gate is intended to be used mainly in Japan. VPN Gate is a research project for just academic purpose only. VPN Gate is governed under the Japanese laws. Other countries' laws are none of our concerns nor responsibilities. By using this software and service, you must observe all concerned laws and rules with your own responsibility. You will be completely liable to any damages and responsibilities which are results of using this software and service, regardless of either inside or outside of Japan's territory. - - - - -SW_PERFORM_MSG_INIT_TASKS Preparing the tasks... -SW_PERFORM_MSG_COPY_PREPARE Preparing the copying of files... -SW_PERFORM_MSG_WRITE_ERROR Failed to write the destination file "%s".\r\n\r\nThere might be another person who has been keeping this file open.\r\nIf programs or services of %s are running, please terminate them and click Retry. -SW_PERFORM_MSG_COPY_FILE Copying "%s" ... -SW_PERFORM_MSG_SET_SECURITY Setting a security on "%s" ... -SW_PERFORM_MSG_PLUGIN Installing the plugins... -SW_PERFORM_MSG_STOP_SVC Stopping the "%s" service ... -SW_PERFORM_MSG_WAIT_FOR_FILE_UNLOCK The file "%s" is locked by a running program. Waiting to unlock... -SW_PERFORM_MSG_INSTALL_SVC Installing the %s service... -SW_PERFORM_MSG_START_SVC Starting the %s service... -SW_PERFORM_MSG_CREATE_LINKS Creating shortcut files... -SW_PERFORM_MSG_DELETE_LINKS Deleting shortcut files... -SW_PERFORM_MSG_DELETE_OLD_LINKS Deleting old shortcut files... -SW_PERFORM_MSG_REGISTER_UNINSTALL Registering uninstall information on the Control Panel... -SW_PERFORM_MSG_IMPORTING_ACCOUNT Importing the Built-in VPN Connection Setting in the Easy Installer... -SW_PERFORM_MSG_DELETE_SETUP_INFO Deleting the install information and logs... -SW_PERFORM_MSG_WRITE_LOG Writing a setup log... -SW_PERFORM_MSG_COPY_ERROR Copying to the file "%s" failed. -SW_PERFORM_MSG_CREATE_LINK_ERROR Creating the shortcut file "%s" failed.\r\n\r\nDo you want to retry? -SW_PERFORM_MSG_WRITE_LOG_ERROR Creating the setup log file "%s".\r\n\r\nDo you want to retry? -SW_PERFORM_MSG_STOP_SVC_ERROR Stopping the "%s" service (internal name: "%S") failed. -SW_PERFORM_MSG_START_SVC_ERROR Starting the "%s" service (internal name: "%S") failed. -SW_PERFORM_MSG_SVC_UNINSTALL_FAILED Uninstall of the "%s" service (internal name: "%S") failed. -SW_PERFORM_MSG_SVC_INSTALL_FAILED Install of the "%s" service (internal name: "%S") failed. -SW_PERFORM_MSG_SVC_USERMODE_EXEC_FAILED Starting the user-mode service "%s" failed. -SW_PERFORM_MSG_UPDATING Updating system settings... -SW_PERFORM_MSG_DELETE_NIC Removing the Virtual Network Adapters... -SW_PERFORM_MSG_FINISHED Setup progress finished. -SW_PERFORM_MSG_UNINSTALL_MSI Windows Installer is uninstalling the older version of %s... -SW_PERFORM_MSG_UPDATE_LANG_CONFIG Changing the language settings... - -SW_PERFORM_MSG_INIT_UNINST Preparing uninstall... -SW_PERFORM_MSG_DELETE_PREPARE Preparing to delete files... -SW_PERFORM_MSG_DELETE_ERROR Unable to delete the file "%s".\r\n\r\nThere might be another program who is keeping this file open.\r\nIf programs or services of %s are running, please terminate them and click Retry. -SW_PERFORM_MSG_UNINSTALL_SVC Uninstalling the "%s" service ... -SW_PERFORM_MSG_DELETE Deleting the "%s" service ... -SW_PERFORM_MSG_EASY_INIT Building the Easy Installer... -SW_PERFORM_MSG_WEB_INIT Building the Web Installer... -SW_PERFORM_MSG_INSTALL_SELOW Creating a restore point of the system and installing essential components. It may take a while... - - -SW_TAG_USERNAME \ (User-mode) -SW_DIRNAME_CONFIG_TOOLS Configuration Tools -SW_DIRNAME_ADMIN_TOOLS Administrative Tools -SW_DIRNAME_LANGUAGE_TOOLS Language Settings - -SW_RUN_TEXT_VPNSMGR Start the SoftEther VPN Server Manager. -SW_RUN_TEXT_VPNCMGR Start the SoftEther VPN Client Manager. - -SW_NIC_UNINSTALL Virtual Network Adapters of SoftEther VPN Client have been created on the system.\r\nDo you want to delete these Virtual Network Adapters? - -# Do not translate this section !!! -SW_TAG_USERNAME_ENGLISH \ (User-Mode) -SW_LINK_NAME_VPNSERVER_SVC SoftEther VPN Server Developer User-mode Service -SW_LINK_NAME_VPNBRIDGE_SVC SoftEther VPN Bridge Developer User-mode Service -SW_LONG_VPNSERVER SoftEther VPN Server Developer Edition -SW_LONG_VPNCLIENT SoftEther VPN Client Developer Edition -SW_LONG_VPNBRIDGE SoftEther VPN Bridge Developer Edition -SW_LONG_VPNSMGR SoftEther VPN Server Manager Developer Edition -SW_LONG_VPNCMGR SoftEther VPN Client Manager Developer Edition -SW_LANG_SET_FAILED Failed to write the new language setting on lang.config file. -# --- end of "Do not translate this section" --- - - -# Shortcuts Filenames -SW_LINK_NAME_VPNSMGR_SHORT SoftEther VPN Server Manager (Dev) -SW_LINK_NAME_VPNSMGR_SHORT_UM SE-VPN Server Manager (Dev User) -SW_LINK_NAME_VPNSMGR_SHORT_TOOLSONLY SE-VPN Server Manager (Dev Tools) -SW_LINK_NAME_VPNSMGR_SHORT_TOOLSONLY_UM SE-VPN Server Manager (Dev Tools User) -SW_LINK_NAME_VPNSMGR_FULL SoftEther VPN Server Manager Developer Edition -SW_LINK_NAME_VPNSMGR_COMMENT You can manage SoftEther VPN Server or SoftEther VPN Bridge on a remote computer. - -SW_LINK_NAME_VPNCMGR_SHORT SoftEther VPN Client Manager (Dev) -SW_LINK_NAME_VPNCMGR_FULL SoftEther VPN Client Manager Developer Edition -SW_LINK_NAME_VPNCMGR_COMMENT You can connect to a VPN Server by using SoftEther VPN Client. - -SW_LINK_NAME_VPNCMGRTOOLS_SHORT SoftEther VPN Client Remote Manager (Dev) -SW_LINK_NAME_VPNCMGRTOOLS_SHORT_UM SE-VPN Client Remote Manager (Dev User) -SW_LINK_NAME_VPNCMGRTOOLS_FULL SoftEther VPN Client Remote Manager Developer Edition - -SW_LINK_NAME_VPNCMGR2_FULL Manage Remote Computer's SoftEther VPN Client -SW_LINK_NAME_VPNCMGR2_COMMENT You can establish a remote connection to and manage a SoftEther VPN Client on a remote computer. - -SW_LINK_NAME_VPNCMGRTRAY_FULL SoftEther VPN Client Manager Developer Edition Startup -SW_LINK_NAME_VPNCMGRTRAY_COMMENT Registers an icon of SoftEther VPN Client Developer Edition on the taskbar's notification area. - -SW_LINK_NAME_EASYINSTALLER Easy Installer Creator -SW_LINK_NAME_EASYINSTALLER_COMMENT A tool for enterprise system administrators to create a SoftEther VPN Client Easy Installer which has a function to kick-start a VPN connection to the specific destination automatically. - -SW_LINK_NAME_WEBINSTALLER Web Installer Creator -SW_LINK_NAME_WEBINSTALLER_COMMENT A tool for enterprise system administrators to create a SoftEther VPN Client Web Installer (ActiveX Installer) which has a function to kick-start a VPN connection to the specific destination automatically. - - -SW_LINK_NAME_VPNCMD SoftEther VPN Command Line Utility (vpncmd) -SW_LINK_NAME_VPNCMD_COMMENT Manage SoftEther VPN Server, SoftEther VPN Bridge and SoftEther VPN Client on the command-line interface in vpncmd. -SW_LINK_NAME_TRAFFIC Network Traffic Speed Test Tool -SW_LINK_NAME_TRAFFIC_COMMENT Performs transmitting packets between two computers connected with TCP/IP, with large amount of throughput as possible, in order to measure the actual network traffic speed available. -SW_LINK_NAME_TCP TCP Optimization Utility -SW_LINK_NAME_TCP_COMMENT TCP Optimization Utility can adjust the parameters of TCP/IP of Windows in order to increase the network communication throughput of this computer. -SW_LINK_NAME_SERVICES Services Running on this Computer -SW_LINK_NAME_SERVICES_COMMENT Starts, stops, and configures Windows services. You can start and stop SoftEther VPN services. -SW_LINK_NAME_VPNSERVER_SVC_COMMENT Starts SoftEther VPN Server Service in the User Mode. -SW_LINK_NAME_VPNBRIDGE_SVC_COMMENT Starts SoftEther VPN Bridge Service in the User Mode. - -SW_LINK_NAME_UNINSTALL Uninstall %s -SW_LINK_NAME_UNINSTALL_COMMENT Uninstall %s on this computer. - -SW_LINK_NAME_LANGUAGE Configure Display Language -SW_LINK_NAME_LANGUAGE_COMMENT Change the display language setting of %s. - -SW_LINK_NAME_DEBUG Debugging Information Collecting Tool -SW_LINK_NAME_DEBUG_COMMENT Collects debugging information of SoftEther VPN. Use this tool only if your support staff asks you to do so. +# SoftEther VPN String Table +# Copyright (c) all contributors on SoftEther VPN project in GitHub. +# Copyright (c) Daiyuu Nobori, SoftEther Project at University of Tsukuba, and SoftEther Corporation. +# +# https://www.softether.org/ + + +########################################################################### +# # +# String data such as messages in software # +# (Excludes dialog box resource strings) # +# # +########################################################################### + + + +# Environment parameters +DEFAULT_FONT Tahoma +DEFAULT_FONT_WIN7 Segoe UI +DEFAULT_FONT_2 Tahoma +DEFAULT_FONT_SIZE 8 +DEFAULT_LOCALE - - $ : : $ Sun Mon Tue Wed Thu Fri Sat : : : $ (None) + + +# 言語 +# (0: 日本語, 1: 英語) +LANG 1 +LANGSTR English + +STRTABLE_ID SE_VPN_20121007 + + +# Strings for Japanese version only (not required for other language versions.) +CM_JAPANESE_ONLY_OLD_STARTUP %s\\SoftEther VPN Client 2.0 タスクトレイ.lnk + + +# Software information +PRODUCT_NAME_VPN_CLI SoftEther VPN Client Developer Edition +PRODUCT_NAME_VPN_CMGR SoftEther VPN Client Manager Developer Edition +PRODUCT_NAME_VPN_SVR SoftEther VPN Server Developer Edition +PRODUCT_NAME_VPN_BRIDGE SoftEther VPN Bridge Developer Edition +PRODUCT_NAME_VPN_SMGR SoftEther VPN Server Manager Developer Edition +PRODUCT_NAME_ELOGSVC SoftEther EtherLogger Developer Edition +PRODUCT_NAME_ELOGMGR SoftEther EtherLogger Developer Edition + +# Branding String for Limited Connection +# BRANDED_C_TO_S Branded_VPN +# BRANDED_C_FROM_S Branded_VPN + +# Client ID (sample) +# CLIENT_ID 123 + +# Family Name for Software Update Check +PRODUCT_FAMILY_NAME SoftEtherDev + +# Product information +SE_COMPANY_URL https://selinks.org/?se +SE_VPNAZURE_URL https://selinks.org/?vpnazure + +# Common strings +COMMON_UNKNOWN (Unknown) + + +# Protocol error strings +ERR_UNKNOWN An unknown error occurred. +ERR_0 No error. +ERR_1 Connection to the server failed. Check network connection and make sure that address and port number of destination server are correct. +ERR_2 Protocol error occurred. Error was returned from the destination server. +ERR_3 Connection has been disconnected. +ERR_4 Protocol error occurred. +ERR_5 A client which is non-SoftEther VPN software has connected to the port. +ERR_6 The command has been canceled by user. +ERR_7 The server denied the specified auth type. +ERR_8 The specified Virtual Hub does not exist on the server. +ERR_9 User authentication failed. +ERR_10 The specified Virtual Hub is currently stopped. Wait for a while and then reconnect. +ERR_11 The VPN session has been deleted. It is possible that either the administrator disconnected the session or the connection from the client to the VPN Server has been disconnected. +ERR_12 Access has been denied. +ERR_13 Time-out occurred during VPN session communication. It is possible the connection from the client to the VPN Server has been disconnected. +ERR_14 Protocol number is invalid. +ERR_15 There are too many TCP/IP connections. +ERR_16 There are too many sessions connected to either the destination server or Virtual Hub. +ERR_17 Connection to proxy server failed. +ERR_18 An error occurred on the proxy server. +ERR_19 User authentication failed on the proxy server. +ERR_20 There are too many sessions by the same user. Other person might be connected to the Virtual Hub as the same user. +ERR_21 A license error occurred on the VPN Server. Contact the VPN Server's administrator. +ERR_22 Cannot access the Virtual Network Adapter device driver. Check the Virtual Network Adapter is installed and make sure that it has not been disabled. +ERR_23 An internal error occurred. +ERR_24 Access to either the smart card or USB hardware token device failed. +ERR_25 The PIN code is incorrect. +ERR_26 The specified certificate is not stored on either the smart card or the USB hardware token device. +ERR_27 The specified private key is not stored on either the smart card or the USB hardware token device. +ERR_28 Write operation to the smart card or USB hardware token device failed. +ERR_29 Object not found. +ERR_30 A Virtual Network Adapter with the specified name already exists. Specify a different name. +ERR_31 Installation of the Virtual Network Adapter device driver failed. +ERR_32 You cannot use the specified name for a Virtual Network Adapter device. +ERR_33 Unsupported. +ERR_34 VPN Connection Setting with the specified name already exists. +ERR_35 The specified VPN Connection Setting is currently connected. +ERR_36 The specified VPN Connection Setting does not exist. +ERR_37 The specified VPN Connection Setting is not connected. +ERR_38 Invalid parameter. +ERR_39 Error occurred on smart card or USB hardware token. +ERR_40 Although authentication of smart card or USB hardware token was selected, but the device to be used has not been selected. Select from the Smart Card menu of Connection Manager. +ERR_41 The specified Virtual Network Adapter is being used by at least one VPN Connection Setting. \r\nEither delete the VPN Connection Setting that is using this Virtual Network Adapter or change Virtual Network Adapter that this VPN Connection Setting is using. +ERR_42 Cannot find the Virtual Network Adapter that the specified VPN Connection Setting is using. \r\nMake sure this Virtual Network Adapter exists. Also make sure the Virtual Network Adapter device has not been disabled. \r\n\r\nIf you cannot resolve the problem, either change the Virtual Network Adapter being used by this VPN Connection Setting or create a new Virtual Network Adapter with the same name. +ERR_43 The Virtual Network Adapter used by the specified VPN Connection Setting is already being used by another VPN Connection Setting. \r\nIf there is another VPN Connection Setting that is using the same Virtual Network Adapter, disconnect that VPN Connection Setting. +ERR_44 The Virtual Network Adapter being used by the specified VPN Connection Setting has been disabled. \r\nBefore using this VPN Connection Setting, enable the Virtual Network Adapter. +ERR_45 The specified value is invalid. +ERR_46 The connection destination is not a cluster controller. +ERR_47 Trying to connect. +ERR_48 Connection to the cluster controller failed. +ERR_49 The cluster controller was unable to assign a new session on a cluster. +ERR_50 Unable to manage the Virtual Hub of the cluster member server. +ERR_51 The user's password used to connect was blank so the connection from remote is prohibited. Blank password can be allowed only to connections from the VPN Server's localhost (127.0.0.1). +ERR_52 Not enough privileges. +ERR_53 Specified listener not found. +ERR_54 The listener of the specified port number already exists. +ERR_55 This is not a cluster member server. +ERR_56 The specified encryption algorithm name is not supported. +ERR_57 The Virtual Hub with the specified name already exists on the server. +ERR_58 There are too many registered Virtual Hubs. No more can be created. Delete the old Virtual Hubs. +ERR_59 The Cascade Connection with the specified name already exists. +ERR_60 A Cascade Connection cannot be created on a server on a cluster. +ERR_61 The specified Cascade Connection is offline. +ERR_62 There are too many access lists. +ERR_63 There are too many users. +ERR_64 There are too many groups. +ERR_65 The specified group does not exist. +ERR_66 The user with the specified name already exists on the Virtual Hub. +ERR_67 The group with the specified name already exists on the Virtual Hub. +ERR_68 A user with the specified name exists on the server but the type of authentication is not password authentication. Unable to change the password. +ERR_69 The user name or old password you entered is incorrect. Note that the password is case-sensitive. +ERR_70 Saitama. +ERR_71 SoftEther has temporarily stopped the current distribution by order of the Japan Ministry of Economy Trade and Industry. +ERR_72 SoftEther has temporarily stopped the current distribution by order of the IPA. +ERR_73 Unable to disconnect the Cascade Connection's session. To delete the session, stop the Cascade Connection. +ERR_74 The VPN Connection Setting for connection with the VPN Server is incomplete. At first you have to complete the VPN Connection Setting for connection with the VPN Server. +ERR_75 VPN Connection to the VPN Server has already started. +ERR_76 Not connected to the VPN Server. +ERR_77 The specified X509 certificate file does not contain a RSA 1024 bit or 2048 bit public key. SoftEther VPN software supports only RSA 1024 bit or 2048 bit certificates. +ERR_78 Unable to disconnect the SecureNAT session. To delete the session, stop the SecureNAT function. +ERR_79 Cannot enable the SecureNAT in a clustering environment. +ERR_80 The SecureNAT is not operating. +ERR_81 This VPN Connection session to the VPN Server has been disconnected by the firewall device installed by the network administrator. Contact the network administrator. +ERR_82 Unable to disconnect the Local Bridge session. To delete the session, stop the Local Bridge. +ERR_83 The Local Bridge is not operating. +ERR_84 Local Bridge cannot be used by the destination VPN Server. Refer to online help or other documentation for the setting method when using Local Bridge on the VPN Server you are using. +ERR_85 Unable to trust the certificate provided by the destination server. The setting to always verify the server certificate is enabled in the VPN Connection Settings. Either register a root certificate that can be trusted or register a individual certificate. +ERR_86 The product code of the destination server is incorrect. It is not possible to connect from this client. +ERR_87 The client and server version is different. Update the software. +ERR_88 Failed to add a capture device. A same capture device might be already registered. +ERR_89 Unable to connect to the destination server from this client. A special client software is required. +ERR_90 The specified capture device is not registered. +ERR_91 Unable to disconnect the Virtual Layer 3 Switch session. To delete the session, stop the Virtual Layer 3 Switch. +ERR_92 A Virtual Layer 3 Switch with the specified name already exists. Specify a different name. +ERR_93 Specified Virtual Layer 3 Switch not found. +ERR_94 The specified name is invalid. Check if the name contains characters that cannot be used. +ERR_95 Failed to add the Virtual Layer 3 interface. Please check that the parameters are valid. Also please make sure that the Virtual Layer 3 switch is stopped. Adding or deleting interfaces are unable when the Virtual Layer 3 switch is running. +ERR_96 Failed to delete the Virtual Layer 3 interface. Please check that the parameters are valid. Also please make sure that the Virtual Layer 3 switch is stopped. Adding or deleting interfaces are unable when the Virtual Layer 3 switch is running. +ERR_97 The Virtual Layer 3 interface that is connecting to the destination Virtual Hub of the specified Virtual Layer 3 interface already exists in the Virtual Layer 3 Switch. No more than one Virtual Layer 3 interface that connects to the same Virtual Hub can be defined in a Virtual Layer 3 Switch. +ERR_98 Failed to add routing table entry. Please check that the parameters are valid. Also please make sure that the Virtual Layer 3 switch is stopped. Adding or deleting routing table entries are unable when the Virtual Layer 3 switch is running. +ERR_99 Failed to delete routing table entry. Please check that the parameters are valid. Also please make sure that the Virtual Layer 3 switch is stopped. Adding or deleting routing table entries are unable when the Virtual Layer 3 switch is running. +ERR_100 The specified routing table entry already exists. +ERR_101 The client clock and the server clock are not synchronized with each other. Check the time settings. +ERR_102 Unable to start this Virtual Layer 3 Switch. \r\n\r\nTo start the Virtual Layer 3 Switch, at least 1 virtual interface must be defined in the Virtual Layer 3 Switch. +ERR_103 Not enough Client Connection Licenses on the destination VPN Server. Contact the server administrator. +ERR_104 Not enough Bridge Connection Licenses on the destination VPN Server. Contact the server administrator. +ERR_105 Due to current technical difficulties, the destination VPN Server is not receiving the connection. Either wait a while, or contact the VPN Server administrator requesting that the server log file be checked. +ERR_106 The destination VPN Server's certificate has expired. Contact the VPN Server's administrator. +ERR_107 A connection has beens requested in Monitoring Mode. But the security policy for the connecting user does not permit Monitoring Mode. +ERR_108 A connection has been requested in Bridge / Router Mode. But the security policy for the connecting user forbids both bridge mode and router mode. +ERR_109 A connection from a client IP address has been denied by the Source IP Restriction List of the Virtual Hub. +ERR_110 There are too many items. +ERR_111 Out of memory. +ERR_112 The specified object already exists. +ERR_113 A fatal error occurred. It is possible that the program operation is unable to continue. +ERR_114 The destination VPN Server has detected a software license violation. Connection is refused. Contact the VPN Server's administrator. +ERR_115 The destination VPN Server has connected via the Internet to an important server provided by SoftEther VPN Project and cannot validate a license. Either wait a while, or contact the VPN Server administrator requesting that the server log file and the Internet connection status of the server itself be checked. +ERR_116 A software license violation has been detected on the client side. Connection is refused. +ERR_117 The command or file name is incorrect. +ERR_118 The license key is incorrect. +ERR_119 No valid product license is registered on the VPN Server. Contact the VPN Server's administrator. +ERR_120 The product license required for the VPN Server to operate as a cluster is not registered. Contact the VPN Server's administrator. +ERR_121 This VPN Connection Setting has been installed using the "Web Installer Creation Kit" or "Simple Installer Creation Kit". The destination server is not an edition that supports the SoftEther VPN 2.0 Administration Pack. Contact the system administrator or person who created the installer. +ERR_122 With the VPN Server SDK for .NET, it is only possible to connect to the SoftEther VPN Server edition that supports the SoftEther VPN 2.0 Administration Pack. The destination VPN Server is not an edition that supports the SoftEther VPN 2.0 Administration Pack. Contact the system administrator. +ERR_123 Beta Version Software on the destination server is expired. Contact to system administrator of the server to download a new beta version or full version from http://selinks.org/. +ERR_124 The VPN connection to VPN Server is refused at server side. +ERR_125 The VPN connection to VPN Server is refused at client side. +ERR_126 The security policy enforced the VPN session to disconnect automatically because the specific time has been elapsed. If you wish to continue please re-connect. +ERR_127 The VPN Server requires the special-version VPN Client software. Consult with the administrator. +ERR_128 The number of registered user objects exceeds the maximum number which is allowed the product license applied on the VPN Server. You cannot add user objects anymore unless you delete old one, or upgrade the edition of the product. +ERR_129 The subscription contract has already expired before the release-date of this version of VPN Server. The customer has been authorized to use VPN Server's builds only in the period of the subscription contract. The customer has to extend the period of the subscription. The customer also be able to 'downgrade' the version of VPN Server to older version which has released before the end of the subscription. If you want to downgrade the version, older versions might be available on http://selinks.org/. +ERR_130 We are afraid that the trial license keys cannot be obtained frequently by the same customer. Please consider to purchase the product version. +ERR_131 Several VPN Servers on the same IP address. You can specify the destination server's private IP or hostname concretely such as "Global IP address or host name/192.168.x.x". Or if a NAT is used on the server's side, configure the NAT to open, relay or transfer appropriate ports. +ERR_132 The key for Dynamic DNS Service duplicates to others. The key will be reset automatically. +ERR_133 The specified Dynamic DNS hostname is already used. Please change the hostname. +ERR_134 The specified Dynamic DNS hostname has an invalid characters. Please change the hostname. +ERR_135 The length of the specified Dynamic DNS hostname is too long. A hostname must be equal or shorter than 31 letters. +ERR_136 The Dynamic DNS hostname is not specified. +ERR_137 The length of the specified Dynamic DNS hostname is too long. A hostname must be equal of longer than 3 letters. +ERR_138 The password of the specified user in the Virtual Hub must be reset before using MS-CHAP v2 authentication. Please ask the administrator of the VPN Server to reset the password by the VPN Server Manager or vpncmd which internal version is 4.0 or greater. Or you can change the password with VPN Client by yourself. +ERR_139 The connection to the Dynamic DNS server has been disconnected. +ERR_140 Failed to initialize the ICMP (Ping) protocol. The process of the VPN Server might be running in a normal-user privileges. In such case, run the VPN Server as a system service. (in Linux / UNIX, run it in root privileges.) +ERR_141 Failed to open the DNS port 53. Make sure that there are no other DNS server program (for example, BIND or Microsoft DNS Server) on the same computer. If there are conflicting services stop them. Or run the VPN Server's process in root privileges on Linux / UNIX/ +ERR_142 The OpenVPN Server function is not enabled. +ERR_143 The Certificate Authentication function and the External Server Authentication function have not been implemented on the open-source version of SoftEther VPN yet. Choose either Anonymous Authentication or Password Authentication instead. +ERR_144 Unacceptable operation. Use the VPN Gate Control Panel to change the VPN Gate Relay Server settings. +ERR_145 Unacceptable operation. Use the VPN Gate Utility to modify the connection setting for VPN Gate Public VPN Relay Servers. +ERR_146 The VPN Gate Service is running inside the VPN Client program. You cannot stop the VPN Gate Service on this screen. Use the VPN Client Manager to enable or disable the VPN Gate Service. +ERR_147 This feature is not supported. It hasn't been implemented yet on the open-source version of SoftEther VPN. +ERR_148 The VPN connection was disconnected because the system is being suspended. + +# Concerning licenses +LICENSE_INFO_URL https://selinks.org/?new_license +LICENSE_SUPPORT_URL https://selinks.org/?q=license_info&id=%s +LICENSE_STATUS_OK Valid +LICENSE_STATUS_EXPIRED Expired +LICENSE_STATUS_ID_DIFF Server ID Mismatch +LICENSE_STATUS_DUP Duplication +LICENSE_STATUS_INSUFFICIENT Other Licenses are Required +LICENSE_STATUS_COMPETITION Competition with Other Licenses +LICENSE_STATUS_NONSENSE Meaningless for Current Edition +LICENSE_STATUS_CPU CPU Type is Incompatible +LICENSE_STATUS_OTHERERROR Unknown Error + + +# Concerning TCP optimization +TCPOPT_NOT_SUPPORTED The TCP Optimization Utility cannot be used on this operating system. +TCPOPT_NOT_ADMIN Users without administrator privileges cannot use the TCP Optimization Utility. + + +# Windows Vista / Windows 7 / Windows 8 Optimization +VISTA_MMCSS_MSG Do you wish to optimize Windows Vista / Windows 7 / Windows 8 / Windows 10 for playing multimedia files with VPN? (e.g. videos, audios and streaming) +VISTA_MMCSS_MSG_2 Optimization for Windows Vista / Windows 7 / Windows 8 / Windows 10 with VPN has already done.\r\nDo you wish to remove optimized configuration? +VISTA_MMCSS_MSG_3 You cannot use optimization in currently environment. +VISTA_MMCSS_MSG_4 You must have administrator privileges for this function.\r\nPlease note that in Windows Vista / Windows 7 / Windows 8 / Windows 10 you should use "Run as Administrators" to execute program. +VISTA_MMCSS_MSG_5 Optimization is finished. +VISTA_MMCSS_MSG_6 Optimization configuration is removed. + + +# Concerning PKCS utility +PKCS_UTIL_TITLE PKCS#12 Writing Utility +PKCS_UTIL_SAVEDLG_TITLE Select the PKCS#12 file that you want to write to the USB token. +PKCS_UTIL_READ_ERROR Unable to read the file: %s. +PKCS_UTIL_WRITE_OK_MSG The file %s has been written to the USB hardware token. +PKCS_UTIL_DELETE_OK_MSG The PKCS#12 certificate data has been deleted from the USB hardware token. +PKCS_UTIL_SECA_FILENAME seca_p12 +PKCS_MAKE_SURE The PKCS#12 certificate data written to USB token will be deleted. \r\n Once data is deleted it cannot be restored. \r\r\n\r\r\nDo you wish to continue? +PKCS_UTIL_BAD_FILE The specified file could not be identified as a PKCS#12 file. + + +# Concerning common dialogs +DLG_ALL_FILES All Files (*.*)|*.* +DLG_CERT_FILES X509 Certificate Files (*.CER;*.CRT)|*.cer;*.crt|All Files (*.*)|*.* +DLG_KEY_FILTER Private Key Files (*.KEY;*.PEM)|*.key;*.pem|All Files (*.*)|*.* +DLG_PKCS12_FILTER PKCS#12 Files (*.P12;*.PFX)|*.p12;*.pfx|All Files (*.*)|*.* +DLG_CERT_OR_P12_FILTER X509 Certificate Files or PKCS#12 Files (*.CER;*.CRT;*.P12;*.PFX)|*.cer;*.crt;*.p12;*.pfx|X509 Certificate Files (*.CER;*.CRT)|*.cer;*.crt|PKCS#12 Files (*.P12;*.PFX)|*.p12;*.pfx|All Files (*.*)|*.* +DLG_CONFIG_FILES Setting Files (*.CONFIG)|*.config|All Files (*.*)|*.* +DLG_KEY_OR_P12_FILTER Private Key Files or PKCS#12 Files (*.KEY;*.PEM;*.P12;*.PFX)|*.key;*.pem;*.p12;*.pfx|Private Key Files (*.KEY;*.PEM)|*.key;*.pem|PKCS#12 Files (*.P12;*.PFX)|*.p12;*.pfx|All Files (*.*)|*.* +DLG_ZIP_FILER ZIP Files (*.ZIP)|*.zip|All Files (*.*)|*.* +DLG_OPEN_CERT Select the Certificate File +DLG_OPEN_KEY Select the Private Key File +DLG_OPEN_KEY_WITH_CERT Select the Corresponding Private Key file +DLG_OPEN_FILE_ERROR Unable to read the specified file: %S. +DLG_OPEN_FILE_ERROR_W Unable to read the specified file: %s. +DLG_BAD_P12 The file "%S" is not a valid PKCS#12 certificate file. +DLG_BAD_P12_W The file "%s" is not a valid PKCS#12 certificate file. +DLG_BAD_X509 The file "%S" is not a valid X509 certificate file. +DLG_BAD_X509_W The file "%s" is not a valid X509 certificate file. +DLG_BAD_KEY The file "%S" is not a valid RSA private key file. +DLG_BAD_KEY_W The file "%s" is not a valid RSA private key file. +DLG_BAD_SIGNATURE The private key does not correctly correspond with the public key contained in the specified certificate. \r\nA private key that corresponds to the certificate public key is required. +DLG_SAVE_CERT Specify a file name where you want to save the certificate +DLG_SAVE_KEY Specify a file name where you want to save the private key +DLG_SAVE_P12 Specify a file name where you want to save the certificate and private key +DLG_SAVE_FILE Specify a file name to save a file +DLG_SAVE_OPENVPN_CONFIG Specify a file name to save the ZIP file contains OpenVPN settings +DLG_CERT_SAVE_OK The certificate has been saved successfully. +DLG_CERT_SAVE_ERROR Unable to save certificate. +DLG_KEY_SAVE_OK The private key has been saved successfully. +DLG_KEY_SAVE_ERROR Unable to save private key. +DLG_KEY_PAIR_SAVE_OK The certificate and private key were saved successfully. +DLG_KEY_PAIR_SAVE_ERROR Unable to save the certificate and private key. +DLG_REBOOT_INFO The computer will restart after %u seconds. +DLG_REBOOT_INFO_2 Restarting the computer. +DLG_REBOOT_ERROR Failed to restart the computer. \r\n\r\nPlease manually restart the computer now. +DLG_SAVE_CONFIG Specify a File Name for Saving the Configuration +DLG_OPEN_CONFIG Specify the Configuration File to Import +DLG_STRING_DEFTITLE String Input +DLG_STRING_DEFINFO Enter strings. +DLG_ABOUT_LEGAL Legal Notices +DLG_ABOUT_AUTHORS List of Authors +DLG_UPDATE_DATE \ (Released on %S) +DLG_UPDATE_HINT Press OK to view the information of the latest update on the web browser.\r\n\r\nYou have to download and install updates manually. If you want to update software on the other computer you have to log in to the computer by Remote Desktop or SSH to perform the download and update. + + + +# Concerning competing processes +BAD_PROCESS_TITLE Warning concerning %S +BAD_PROCESS_MESSAGE It is possible that the software "%S" is running on this computer, which could cause problems. \r\n\r\nThere is a possibility that problems in "%S" will cause instability in VPN communication and errors. \r\n\r\nIf, by using VPN together with the software "%S" VPN becomes unstable, either stop or uninstall "%S". (Note that in some cases, because of the nature of the software, there are cases that the problems will still remain on the computer where even if you stop the software.) \r\n + + +# Concerning hardware tokens +SEC_SMART_CARD Smart Card +SEC_USB_TOKEN USB Token +SEC_INIT_MSG_1 Insert the following smart card into the smart card reader and enter the PIN code. +SEC_INIT_MSG_2 Connect the following USB token hardware to the computer's USB port and enter the PIN code. +SEC_OPENING Opening Device... +SEC_CLOSING Closing Device... +SEC_OPEN_SESSION Opening Secure Session... +SEC_CLOSE_SESSION Closing Secure Session... +SEC_LOGIN Logging in to Token... +SEC_LOGOUT Logging out from Token... +SEC_INIT_BATCH Starting Batch Process... +SEC_READ_DATA Reading Data... +SEC_WRITE_DATA Writing Data... +SEC_READ_CERT Reading Certificate... +SEC_WRITE_CERT Writing Certificate... +SEC_DELETE Deleting Object... +SEC_SIGN Processing Digital Signature by Private Key... +SEC_WRITE_KEY Writing Private Key... +SEC_ENUM Enumerating Object... +SEC_FINISHED The operation is complete. +SEC_ERROR_INVALID_ID The specified security device (device %u) is invalid. +SEC_ERROR_OPEN_DEVICE Unable to open the device %S. Make sure the device is connected to the computer. +SEC_ERROR_OPEN_DEVICEEX Unable to open the device %S. Make sure the device is connected to the computer. \r\n\r\nIf using public key infrastructure (PKI) with special client software, it is necessary to select the smart card device in PKI Utility from the Start menu beforehand. +SEC_ERROR_OPEN_SESSION Unable to start security session in device: %S. Make sure the correct device is selected. +SEC_ERROR_LOGIN The entered PIN code is incorrect. +SEC_ERROR_NOT_FOUND_1 The specified object does not exist in smart card. Make sure the correct smart card is inserted. +SEC_ERROR_NOT_FOUND_2 The specified object does not exist in USB token hardware. Make sure the correct USB token hardware is connected. +SEC_ERROR_SIGN_1 Either private key does not exist in smart card or digital signature operation failed. Make sure the correct smart card is inserted. +SEC_ERROR_SIGN_2 Either private key does not exist in USB token hardware or digital signature operation failed. Make sure the correct USB token hardware is connected. +SEC_ERROR_WRITE_1 Unable to write object to smart card. There is a possibility that there is insufficient free memory available on smart card. +SEC_ERROR_WRITE_2 Unable to write object to USB token hardware. There is a possibility that is insufficient free memory available on the USB token. +SEC_ERROR_ENUM Enumeration of object stored in token failed. +SEC_ERROR_DELETE Deletion of specified object failed. It is possible the specified object does not exist in the memory. +SEC_COLUMN1 Device Name +SEC_COLUMN2 Type +SEC_COLUMN3 Manufacturer +SEC_COLUMN4 DLL Name +SEC_INVALID_ID The specified smart card device does not exist. Select the smart card type again. +SEC_MGR_COLUMN1 Name +SEC_MGR_COLUMN2 Type +SEC_MGR_COLUMN3 Private +SEC_TYPE_DATA Data +SEC_TYPE_CERT Certificate +SEC_TYPE_KEY Private Key +SEC_TYPE_PUB Public Key +SEC_YES Yes +SEC_NO No +SEC_NONE None +SEC_IMPORT_DATA Select the data you want to import. +SEC_IMPORT_CERT Select the certificate you want to import. +SEC_IMPORT_KEY Select the private key you want to import. +SEC_READ_FAILED Reading from specified file failed. +SEC_DATA_TOO_BIG The specified data size is too big. Data larger than %u bytes cannot be written to the smart card. +SEC_OBJECT_NAME_TITLE Name of object to insert +SEC_OBJECT_NAME_INFO Specify the name of the object to be written to the new smart card. You can specify alphanumeric characters excluding double-byte and special characters for the object name. \r\n\r\nCaution: If there is an object with the same name of the same type already written on the card, that object will be overwritten. +SEC_DELETE_MSG The selected object will be deleted from the smart card. \r\nDo you really want to do this? +SEC_OBJECT_IMPORT_OK Object has been written to smart card. +SEC_OBJECT_EXPORT_OK The data read from the smart card has been saved. +SEC_NEW_CERT_IMPORT_OK The newly created certificate has been written to the smart card. +SEC_CURRENT_DEVICE Currently the device %S is selected. +SEC_CURRENT_NO_DEVICE Select which smart card device to use. +SEC_NO_SECURE_DEVICE A SoftEther VPN-compatible smart card or hardware security token device is not installed on the system. \r\n\r\nTo use a smart card or hardware token using SoftEther VPN it is necessary to install a PKCS#11-compatible device driver on Windows. In addition, it is necessary that SoftEther VPN supports the device type. \r\n\r\nMake sure a system-compatible device driver has been installed. \r\nRefer to the SoftEther VPN Project website for the list of SoftEther VPN-compatible devices. Also, it may be possible to increase the compatible devices by updating to the most recent software version. +SEC_PIN_DEVICE_OPEN_ERR Unable to connect the device "%S". Make sure the hardware is correctly connected. +SEC_PIN_CURRENT_BAD Current PIN code is incorrect. +SEC_PIN_CHANGE_FAILED Changing of PIN code failed. +SEC_PIN_OK The PIN code has been changed. + + +# TCP Connection Dialog +CONNECTDLG_CAPTION Connecting +CONNECTDLG_MESSAGE Connecting to the server "%S" (TCP port: %u)... +CONNECTDLG_CANCELING Aborting the connection. Please wait... + + +# NIC Info Dialog +NICINFO_1 Connected to the VPN Server. +NICINFO_1_1 Requesting an IP address to the DHCP server in the VPN... +NICINFO_1_2 Determining the IP address to use in the VPN... + +NICINFO_2 The VPN Connection is Established. +NICINFO_2_1 Your assigned IP address is %S. + +NICINFO_3 The VPN Connection is Established. +NICINFO_3_1 Your IP address %S is ready to use. + + +# Concerning password input dialogs during login +PW_RETRYCOUNT Automatic reconnection will be made after %u seconds with no input. +PW_LOGIN_DLG_TITLE Login +PW_TYPE_0 Anonymous Authentication +PW_TYPE_1 Standard Password Authentication +PW_TYPE_2 RADIUS or NT Domain Authentication +PW_TYPE_3 Client Certificate Authentication +PW_TYPE_4 Smart Card Authentication +PW_TYPE_5 Openssl Engine Authentication + +PW_MSG_PROXY User authentication failed on the proxy server %S. Re-enter the correct user name and password. +PW_TYPE_PROXY Proxy Server Authentication + + +# Concerning VPN connection status +STATUS_1 Initializing... +STATUS_2 Connecting to VPN Server "%S" via Proxy Server %S... +STATUS_3 Authenticating User on Proxy Server %S... +STATUS_4 Connecting to VPN Server "%S"... +STATUS_5 Verifying Server Certificate... +STATUS_6 Authenticating User... +STATUS_7 Establishing VPN Session... +STATUS_8 Connecting to VPN Server on Cluster... +STATUS_9 VPN Session has been established. + + +# Concerning certificate dialogs +CERT_NOT_FOUND Unable to find the certificate of the certificate authority who issued this certificate on the list of trusted certificates. +CERT_ROOT This certificate is a root certificate (self-signed certificate). +CERT_LV_C1 Field +CERT_LV_C2 Value +CERT_SERIAL Serial Number +CERT_ISSUER Issuer +CERT_SUBJECT Subject +CERT_NOT_BEFORE Issued at +CERT_NOT_AFTER Expires at +CERT_BITS Bits +CERT_PUBLIC_KEY Public Key +CERT_DIGEST_MD5 Digest (MD5) +CERT_DIGEST_SHA1 Digest (SHA-1) +CERT_NO_SERIAL There is no serial number +CERT_BITS_FORMAT %u bits + + +# Concerning certificate confirmation dialogs +CC_DANGEROUS_MSG The server certificate that was saved on the previous VPN connection to this server (%S) does not match the current server certificate provided by the server. \r\n\r\nDigest Value (MD5) of Previous: %S\r\nDigest Value (SHA1) of Previous: %S\r\n\r\nDigest Value (MD5) of Current: %S\r\nDigest Value (SHA1) of Current: %S\r\n\r\nIt is possible the server administrator changed the certificate on the VPN Server side. However, it is also possible a man-in-the-middle attack such as spoofing is occurring. \r\nIt is strongly recommended that you ask for clarification from the administrator of VPN Server you want to connect to. +CC_WARNING_MSG Do you want the certificate of the VPN Server you are currently connecting to be automatically trusted next time you connect to %s?\r\n\r\nDigest Value (SHA1): %S\r\nDigest Value (MD5): %S\r\n\r\nIf there is doubt regarding the authenticity of this server's certificate, contact the server's owner, by a sure and safe method, and quote the above digest value to confirm the facts. \r\n\r\nClick Yes to automatically trust this certificate if this server provides the same certificate next time you connect to it. \r\nClick No to trust the certificate for this time only and to display this warning again next time you connect to this server. \r\nClick Cancel to return to the Security Warnings window. \r\n\r\nNote: This setting can be changed on an account-by-account basis. You can make this setting in Account Properties of VPN Client Manager. + + +# Errors about Windows Versions +WINVER_TITLE Warning about Windows versions +WINVER_ERROR_FORMAT The version and Service Pack of Windows on %s is "%S".\r\n\r\nThe latest supported version and Service Pack of Windows by %s is as follows:\r\n%S\r\nBecause of the version of Windows on %s is newer than the version of Windows which %s supports, unexpected troubles or compatible issues might occur.\r\nIn order to avoid problems, we will recommend you to obtain and install the latest update of %s.\r\n(It is possible to continue using the current version without updates although that is not what we recommend.)\r\n\r\nIf you are the administrator, you can download the latest update-patch of %s from the web site http://selinks.org/?se for free.\r\n\r\nIf you are not the administrator you should notify the VPN Server's administrator of this message.\r\n\r\n----- MSG%04u%02u -----\r\n\r\n +WINVER_ERROR_VPNSERVER the VPN Server on the destination computer +WINVER_ERROR_VPNBRIDGE the VPN Bridge on the destination computer +WINVER_ERROR_VPNCLIENT the VPN Client on this local computer +WINVER_ERROR_PC_LOCAL this local computer +WINVER_ERROR_PC_REMOTE the remote server + + +# Warning for Open-source Version +OSS_MSG Welcome to the SoftEther VPN Server Academic Version!\r\n\r\n\r\nThis VPN Server is open-source free software developed as academic research at University of Tsukuba, Japan, and distributed from the SoftEther VPN Project (http://www.softether.org/), for free of charge for the public interests.\r\n\r\nSoftEther VPN software is distributed to public as a part of the joint-research contract between University of Tsukuba and SoftEther VPN Project. SoftEther VPN software is developed and published for JUST AN ACADEMIC RESEARCH PURPOSE. Therefore no support service are provided about SoftEther VPN software even if it contains bugs or vulnerabilities. A user will be liable for the result of use SoftEther VPN. The developers and publishers of SoftEther VPN will never be liable for either any consequences or damages.\r\n\r\nEnjoy using VPN with SoftEther VPN Server.\r\n\r\nFor more details of SoftEther VPN, visit http://www.softether.org/.\r\n\r\n +NATT_MSG ** Connected with NAT traversal - might be unstable **\r\n\r\nThis VPN Client is connected to the VPN Server '%S' by using the NAT Traversal (UDP Hole Punching) technology.\r\n\r\nNAT Traversal allows the VPN Server behind the NAT-box to accept VPN connections from VPN Client without any port-forwarding setting on the NAT-box.\r\n\r\nHowever, NAT Traversal-based VPN sessions sometimes become unstable, because NAT Traversal uses UDP-based protocol. For example, the VPN tunnel disconnects every 5 minutes if there is a poor NAT-box between the VPN Server and the VPN Client. Some large-scale NAT gateways in cheap ISPs sometimes cause the same problem on NAT Traversal. This is a problem of routers or ISPs. This is not a problem of SoftEther VPN software.\r\n\r\nTo solve the unstable tunnel problem, you should connect to the VPN Server's TCP listener port directly, instead of using NAT Traversal. To connect to the VPN Server directly by using TCP, a listener port of the VPN Server must be exposed to the Internet by a port-forward setting on the NAT-box. Ask the administrator of the NAT-box, or refer to the manual of the NAT-box to add a port-forwarding setting on the NAT-box.\r\n\r\nIf this message still remains despite the VPN Server is exposing a TCP port to the Internet, check the "Disable NAT-T" checkbox on the VPN Client connection setting screen.\r\n\r\n +NATT_MSG2 ** Connected with NAT traversal - might be unstable **\r\n\r\nThis VPN Client is connected to the VPN Server '%S' by using the NAT Traversal (UDP Hole Punching) technology.\r\n\r\nNAT Traversal allows the VPN Server behind the NAT-box to accept VPN connections from VPN Client without any port-forwarding setting on the NAT-box.\r\n\r\nHowever, NAT Traversal-based VPN sessions sometimes become unstable, because NAT Traversal uses UDP-based protocol. For example, the VPN tunnel disconnects every 5 minutes if there is a poor NAT-box between the VPN Server and the VPN Client. Some large-scale NAT gateways in cheap ISPs sometimes cause the same problem on NAT Traversal. This is a problem of routers or ISPs. This is not a problem of SoftEther VPN software.\r\n\r\nTo solve the unstable tunnel problem, you should connect to the VPN Server's TCP listener port directly, instead of using NAT Traversal. To connect to the VPN Server directly by using TCP, a listener port of the VPN Server must be exposed to the Internet by a port-forward setting on the NAT-box. Ask the administrator of the NAT-box, or refer to the manual of the NAT-box to add a port-forwarding setting on the NAT-box.\r\n\r\nIf this message still remains despite the VPN Server is exposing a TCP port to the Internet, check the "Disable NAT-T" checkbox on the VPN Client connection setting screen after upgrading the VPN Client to Build 9428 or later.\r\n\r\n + + + +# Virtual HUB Admin Options +HUB_AO_CLICK Select an item to view the description here. +HUB_AO_UNKNOWN The description of the item was not found. Refer to the documents, or speculate the meaning and purpose of the item from the name of the item. +HUB_AO_allow_hub_admin_change_option This is a special item. If you are enable (set to 1) this option, then not only the VPN Server's global administrator but also the Virtual Hub's administrator will be granted to modify the Virtual Hub Admin Options by himself. +HUB_AO_deny_hub_admin_change_ext_option If you are enable (set to 1) this option, the Virtual Hub's administrator will be forbidden to modify any values on the Virtual Hub Extended Options, then only the VPN Server's global administrator can modify them. +HUB_AO_no_delay_jitter_packet_loss If you set this option to non-zero value, then all parameters of delay, jitter and packet-loss on the access-list entry will be ignored even if these parameters are set when the administrator adds a new access list entry. Therefore, delay, jitter and packet-loss generating function will be virtually disabled. Because of the delay generating function sometimes make a high volume of load on the CPU and RAM, a Virtual Hub which is shared by several users should have this option enabled. +HUB_AO_max_users If you set this option to non-zero value, the maximum number of user objects registered on the Virtual Hub will be limited to this value, then greater number of user objects than this value cannot be added. +HUB_AO_max_multilogins_per_user If you set this option to non-zero value, the maximum number of VPN Sessions per an individual user object will be limited to this value, then greater number of VPN Sessions of individual user object than this value cannot be established. +HUB_AO_max_groups If you set this option to non-zero value, then the maximum number of group objects on the Virtual Hub will be limited to this value and any more groups will not be allowed to be registered. +HUB_AO_max_accesslists If you set this option to non-zero value, then the maximum number of access list entries on the Virtual Hub will be limited to this value and any more entries will not be allowed to be registered. +HUB_AO_max_sessions_client_bridge_apply Only when this value is set to non-zero value, the values max_sessions_client and max_sessions_bridge will be applied. +HUB_AO_max_sessions If you set this option to non-zero value, then the maximum number of VPN Sessions will be limited to this value. +HUB_AO_max_sessions_client If you set this option to non-zero value, then the maximum number of VPN Client sessions will be limited to this value. No more VPN Client sessions will be allowed to establish. This option is valid only when the max_sessions_client_bridge_apply option is set to non-zero value. +HUB_AO_max_sessions_bridge If you set this option to non-zero value, then the maximum number of VPN Bridge sessions will be limited to this value. No more VPN Bridge sessions will be allowed to establish. This option is valid only when the max_sessions_client_bridge_apply option is set to non-zero value. +HUB_AO_max_bitrates_download If you set this option to non-zero value, then all VPN Sessions on the Virtual Hub will be mandated to have a security policy setting which the "Download Bandwidth" value is set to this value. It will limit the downloading traffic speed of each VPN Session. For example, if this value is set to 1000000, then a downloading bandwidth of each VPN Session on the Virtual Hub will be limited to 1Mbps. +HUB_AO_max_bitrates_upload If you set this option to non-zero value, then all VPN Sessions on the Virtual Hub will be mandated to have a security policy setting which the "Download Bandwidth" value is set to this value. It will limit the uploading traffic speed of each VPN Session. For example, if this value is set to 1000000, then a uploading bandwidth of each VPN Session on the Virtual Hub will be limited to 1Mbps. +HUB_AO_deny_empty_password If you set this option to non-zero value, no user objects will be able to have an empty password. A user who has an empty password will be forbidden to connect a VPN Session. (Exception: a VPN connection from localhost will be permitted even if the password is empty.) +HUB_AO_deny_bridge If you set this option to non-zero value, then any VPN Sessions in Bridge Mode will not be granted to establish, regardless of the setting of existing security policy of the user. No one will be able to connect to the Virtual Hub for bridging purpose. +HUB_AO_deny_routing If you set this option to non-zero value, then any VPN Sessions in Routing Mode will not be granted to establish, regardless of the setting of existing security policy of the user. No one will be able to connect to the Virtual Hub for routing purpose. +HUB_AO_deny_qos If you set this option to non-zero value, then every VPN Sessions will be enforced to disable the QoS function regardless of the setting of existing security policy of the user. +HUB_AO_deny_change_user_password If you set this option to non-zero value, then any users on the Virtual Hub will be forbidden to change its password by VPN Client's password-changing function. +HUB_AO_no_change_users If you set this option to non-zero value, then the administrator of the Virtual HUB will be forbidden to add, edit or remove a user. +HUB_AO_no_change_groups If you set this option to non-zero value, then the administrator of the Virtual HUB will be forbidden to add, edit or remove a group. +HUB_AO_no_securenat If you set this option to non-zero value, then the administrator of the Virtual HUB will be forbidden to enable or disable the SecureNAT function. +HUB_AO_no_securenat_enablenat If you set this option to non-zero value, then the administrator of the Virtual HUB will be forbidden to enable or disable the Virtual NAT function in the SecureNAT function. +HUB_AO_no_securenat_enabledhcp If you set this option to non-zero value, then the administrator of the Virtual HUB will be forbidden to enable or disable the Virtual DHCP Server function in the SecureNAT function. +HUB_AO_no_cascade If you set this option to non-zero value, then the administrator of the Virtual HUB will be forbidden to add, edit, remove or change the online status of a cascade connection. +HUB_AO_no_online If you set this option to non-zero value, then the administrator of the Virtual HUB will be forbidden to change the offline Virtual Hub to the online state. +HUB_AO_no_offline If you set this option to non-zero value, then the administrator of the Virtual HUB will be forbidden to change the online Virtual Hub to the offline state. +HUB_AO_no_change_log_config If you set this option to non-zero value, then the administrator of the Virtual HUB will be forbidden to change the settings of logging function. +HUB_AO_no_disconnect_session If you set this option to non-zero value, then the administrator of the Virtual HUB will be forbidden to disconnect a specific VPN Session. +HUB_AO_no_delete_iptable If you set this option to non-zero value, then the administrator of the Virtual HUB will be forbidden to delete a specific IP address entry from the IP address table database. +HUB_AO_no_delete_mactable If you set this option to non-zero value, then the administrator of the Virtual HUB will be forbidden to delete a specific MAC address entry from the MAC address table database. +HUB_AO_no_enum_session If you set this option to non-zero value, then the administrator of the Virtual HUB will be forbidden to enumerate the sessions on the Virtual Hub. +HUB_AO_no_query_session If you set this option to non-zero value, then the administrator of the Virtual HUB will be forbidden to specify a session and get the information of the session. +HUB_AO_no_change_admin_password If you set this option to non-zero value, then the administrator of the Virtual HUB will be forbidden to change the administrator's password of the Virtual Hub. +HUB_AO_no_change_log_switch_type If you set this option to non-zero value, then the administrator of the Virtual HUB will be forbidden to change the Log Switching settings on the logging function settings of the Virtual Hub. +HUB_AO_no_change_access_list If you set this option to non-zero value, then the administrator of the Virtual HUB will be forbidden to modify the access list of the Virtual Hub. +HUB_AO_no_change_access_control_list If you set this option to non-zero value, then the administrator of the Virtual HUB will be forbidden to modify the source IP address limit list of the Virtual Hub. +HUB_AO_no_change_cert_list If you set this option to non-zero value, then the administrator of the Virtual HUB will be forbidden to modify the trusted certificate authority list of the Virtual Hub. +HUB_AO_no_change_crl_list If you set this option to non-zero value, then the administrator of the Virtual HUB will be forbidden to modify the certificate revoked list of the Virtual Hub. +HUB_AO_no_read_log_file If you set this option to non-zero value, then the administrator of the Virtual HUB will be forbidden to enumerate or download the log files of the Virtual Hub remotely. +HUB_AO_no_change_msg If you set this option to non-zero value, then the administrator of the Virtual HUB will be forbidden to change the message which should be displayed when a VPN Client connects to the Virtual Hub. +HUB_AO_no_access_list_include_file If you set this option to non-zero value, then the administrator of the Virtual HUB will be forbidden to specify "include:" or "exclude:" instruction as a source or a destination user field on a access list entry of the Virtual Hub. + + + +# Virtual Hub Extended Options +HUB_AO_NoAddressPollingIPv4 If you set this option to non-zero value, then the Virtual Hub will not perform the maintenance of the IPv4 address table and the MAC address table on the hub with using sending ARP packets per 5 seconds in order to check keep-alive IPv4 devices. As a result, IPv4 devices might be deleted on the IPv4 address table and MAC address table after a particular period (from 1 to 10 minutes) will be elapsed in the case of no-communication activities via the Virtual Hub, even if it is still alive. This option can eliminate the amount of broadcast packets, however some IPv4-related security policies will not work effectively. +HUB_AO_NoAddressPollingIPv6 If you set this option to non-zero value, then the Virtual Hub will not perform the maintenance of the IPv6 address table and the MAC address table on the hub with using sending ICMPv6 packets per 5 seconds in order to check keep-alive IPv6 devices. As a result, IPv6 devices might be deleted on the IPv6 address table and MAC address table after a particular period (from 1 to 10 minutes) will be elapsed in the case of no-communication activities via the Virtual Hub, even if it is still alive. This option can eliminate the amount of broadcast packets, however some IPv6-related security policies will not work effectively. +HUB_AO_NoIpTable If you set this option to non-zero value, then the Virtual Hub will not construct and maintain the internal IP address table. This option can eliminate the amount of CPU and RAM usages, however some IP-related security policies will not work effectively. +HUB_AO_NoMacAddressLog If you set this option to non-zero value, then any logs which indicate the registration of a new MAC address to the MAC address table on the Virtual Hub will not be logged to the security log. +HUB_AO_ManageOnlyPrivateIP If you set this option to non-zero value, then the IPv4 address table of the Virtual Hub will contain only private IPv4 addresses. In this context, the private IPv4 addresses are: 10.0.0.0/8, 172.16.0.0/12, 192.168.0.0/16 and 169.254.0.0/16. Any other IPv4 addresses will not added on the table. +HUB_AO_ManageOnlyLocalUnicastIPv6 If you set this option to non-zero value, then the IPv6 address table of the Virtual Hub will contain only local unicast IPv6 addresses. In this context, the private IPv6 addresses are: fe80::/10. Any other IPv6 addresses will not added on the table. +HUB_AO_DisableIPParsing If you set this option to non-zero value, then the Virtual Hub will disable the internal parsing function of IP headers in all Ethernet packets. This option can eliminate the amount of CPU and RAM usages, however the Vitual Hub will not perform building and maintenance of the IP address table internally, and some IP-related security policies will not work effectively. +HUB_AO_YieldAfterStorePacket If you set this option to non-zero value, then the Virtual Hub sets the CPU to idle state after store-forward processing of a packet. This might results good effects to make the delay of packets shorter, however the counts of thread context switch will be increased and the performance might decline. +HUB_AO_FilterPPPoE If you set this option to non-zero value, then the Virtual Hub discards all PPPoE (PPP over Ethernet) packets. It is convenient to split each site's PPPoE segment when making a bridge between two or more local area networks. +HUB_AO_FilterOSPF If you set this option to non-zero value, then the Virtual Hub discards all OSPF (Open Shortest Path First) packets. +HUB_AO_FilterIPv4 If you set this option to non-zero value, then the Virtual Hub discards all IPv4 and ARP packets. +HUB_AO_FilterIPv6 If you set this option to non-zero value, then the Virtual Hub discards all IPv6 packets. +HUB_AO_FilterNonIP If you set this option to non-zero value, then the Virtual Hub discards all non-IP packets (non-IPv4, ARP or IPv6 packets). Incidentally, any tagged-VLAN packets via the Virtual Hub will be regarded as non-IP packets. +HUB_AO_FilterBPDU If you set this option to non-zero value, then the Virtual Hub discards all BPDU (Bridge Protocol Data Unit) packets. +HUB_AO_NoIPv6DefaultRouterInRAWhenIPv6 If you set this option to non-zero value, then all VPN Sessions on the Virtual Hub will have the enabled "No Default-Router on IPv6 RA (physical IPv6)" security policy. When the physical communication protocol between VPN Client / VPN Bridge and VPN Server is IPv6, any IPv6 RA (Router Advertisement) packet with non-zero value in the router-lifetime will set to zero-value. This is effective to avoid the horrible behavior from the IPv6 routing confusion which is caused by the VPN client's attempts to use the remote-side IPv6 router as its local IPv6 router. +HUB_AO_NoLookBPDUBridgeId If you set this option to non-zero value, then the Virtual Hub will ignore the source MAC field in a BPDU (Bridge Protocol Data Unit) packet. This value will be much more advanced. Do not modify it unless you are very ultra special expert of computer networking. +HUB_AO_NoManageVlanId If you set this option to non-zero value, then the Virtual Hub will not use VLAN ID on the MAC address table. Any VLAN ID in tagged-VLAN packets will be ignored. +HUB_AO_VlanTypeId Specify the Ethernet Type ID (TPID) of VLAN tags in decimal. The default value is 33024 (0x8100 in hex). This value will be much more advanced. Do not modify it unless you are very ultra special expert of computer networking. +HUB_AO_FixForDLinkBPDU If you set this option to non-zero value, then the FixForDLinkBPDU option will be enabled. This value will be much more advanced. Do not modify it unless you are very ultra special expert of computer networking. +HUB_AO_NoIPv4PacketLog If you set this option to non-zero value, then IPv4 packets via the Virtual Hub will not be logged. +HUB_AO_NoIPv6PacketLog If you set this option to non-zero value, then IPv6 packets via the Virtual Hub will not be logged. +HUB_AO_NoSpinLockForPacketDelay If you set this option to non-zero value, then the VPN Server will not use spin-lock mechanisms to simulate the delay of packets when the packet-delay generating function is applied to the packet. Instead, the timer interrupt by the operating system will be adopted. It will reduce the CPU time, however the resolution of generating delays will deteriorate. +HUB_AO_BroadcastStormDetectionThreshold Specify the threshold to detect the broadcast storm per a second. When the number of broadcast packets from a particular VPN Session exceeded this threshold, packets will be regarded as broadcast storm and become subjects to be filtered. The default value (zero-value) is 32. +HUB_AO_ClientMinimumRequiredBuild If you set this option to non-zero value, then the Virtual Hub will deny any access from VPN Client which has less build number than this value. +HUB_AO_RequiredClientId If you set this option to non-zero value, then the Virtual Hub will deny any access from VPN Client which doesn't have the embedded "Client ID" value in the software. +HUB_AO_AdjustTcpMssValue If you set this option to non-zero value, then the Virtual Hub will adjust MSS (Max Segment Size) values of headers of all TCP/IP packets not to exceed this value. +HUB_AO_DisableAdjustTcpMss If you set this option to non-zero value, then any MSS (Max Segment Size) options on the Virtual Hub will be disabled. Even if the AdjustTcpMssValue option is specified, or a VPN Session is made by IPsec / L2TP / EtherIP / L2TPv3 Server Function, the adjustment of MSS will be disabled. +HUB_AO_NoDhcpPacketLogOutsideHub If you set this option to non-zero value, then the Virtual Hub will not record non-related DHCP packets to the packet log. "Non-related DHCP packets" are DHCP packets which are not bound to any VPN Session on the Virtual Hub. +HUB_AO_DisableHttpParsing If you set this option to non-zero value, then the Virtual Hub will not perform parsing HTTP headers in all HTTP packets. It will reduce the usage of CPU and RAM, however the HTTP access logs will not be recorded. +HUB_AO_DisableUdpAcceleration If you set this option to non-zero value, then all UDP Acceleration Function will be disabled on the all VPN Sessions of the Virtual Hub. +HUB_AO_DisableUdpFilterForLocalBridgeNic If you set this option to non-zero value, then the Virtual Hub disables the trouble-preventing filtering function to filter DHCP packets which might causes of network unstable. By default, a local bridge interface sometimes try to acquire an IP address from remote-side DHCP server, however such a behavior should infinite loop in the routing table. The filtering function can avoid such problems. This option can disable the filtering function. +HUB_AO_ApplyIPv4AccessListOnArpPacket If you set this option to non-zero value, then the IPv4 access list entries will be applied on not only IPv4 packets but also ARP packets. It is convenient to filter unnecessary ARP packets which might cause troubles. +HUB_AO_RemoveDefGwOnDhcpForLocalhost If you set this option to non-zero value, when a VPN Client on the localhost connects to the Virtual Hub and try to acquire an IP address from the DHCP Server in the segment of the Virtual Hub, corresponding DHCP reply packets will be discarded. It can prevent unexpected infinite loop of packets routing. +HUB_AO_SecureNAT_MaxTcpSessionsPerIp If you set this option to non-zero value, then the number of TCP connections (which is not SYN_SENT) per IP state will be limited to this value. +HUB_AO_SecureNAT_MaxTcpSynSentPerIp If you set this option to non-zero value, then the number of TCP connections (which is SYN_SENT) per IP state will be limited to this value. +HUB_AO_SecureNAT_MaxUdpSessionsPerIp If you set this option to non-zero value, then the number of UDP sessions per IP state will be limited to this value. +HUB_AO_SecureNAT_MaxDnsSessionsPerIp If you set this option to non-zero value, then the number of DNS sessions per IP which is not SYN_SENT state will be limited to this value. +HUB_AO_SecureNAT_MaxIcmpSessionsPerIp If you set this option to non-zero value, then the number of ICMP sessions per IP which is not SYN_SENT state will be limited to this value. +HUB_AO_AccessListIncludeFileCacheLifetime Specify a period in seconds to hold the cache of external user-list files which is for an access list entry which has "include:" or "exclude:" formats as its username. +HUB_AO_DisableKernelModeSecureNAT If you set this option to non-zero value, then the Kernel-mode NAT function on the SecureNAT function will be disabled. Kernel-mode NAT is a function to accelerate the performance of the Virtual NAT function on SecureNAT. Kernel-mode NAT can work only when the VPN Server process is running with system privileges (i.e. root, SYSTEM or Administrators contexts.). If the Kernel-mode NAT causes something wrong operations, use this option to disable it. +HUB_AO_DisableUserModeSecureNAT If you set this option to non-zero value, then the User-mode NAT function on the SecureNAT function will be disabled. User-mode NAT is a function to make the NAT possible to run as normal-user privileges. +HUB_AO_DisableCheckMacOnLocalBridge If you set this option to non-zero value, the MAC address duplication check will be disabled on the Local Bridge function. There might be a case when some network adapters has a problem that reflects outgoing packets towards the Virtual Hub. A Virtual HUB detects such duplications automatically, and discards them. Enable this flag to disable the detection and discarding. +HUB_AO_DisableCorrectIpOffloadChecksum If you set this option to non-zero value, then the checking and correction of IP check-sum value on the Local Bridge function. Some network adapters, which have IP, TCP or UDP header check-sum offloading engines, transmit packets with incomplete check-sum values. Such packets cannot be treated correctly by receiver-side. So the Local Bridge detects such packets and corrects its check-sum fields. Enable this flag to disable such correction. +HUB_AO_BroadcastLimiterStrictMode If you set this option to non-zero value, then the broadcast-storm detection algorithm will compare either source or destination IP address of each packet. If any of the two fields matches, the packet will be recorded on the short-term history of broadcast-storm detection state machine. +HUB_AO_MaxLoggedPacketsPerMinute Maximum number of logging target packets per minute. +HUB_AO_DoNotSaveHeavySecurityLogs Do not take heavy security log. +HUB_AO_DropBroadcastsInPrivacyFilterMode Drop broadcasting packets if the both source and destination session is PrivacyFilter mode. +HUB_AO_DropArpInPrivacyFilterMode Drop ARP packets if the both source and destination session is PrivacyFilter mode. +HUB_AO_SuppressClientUpdateNotification Suppress the update notification screen on the VPN Client. +HUB_AO_FloodingSendQueueBufferQuota Specify the quota limitation value (in bytes) of the sending queue buffer size which the flooding operation on the Virtual Hub can consume. The quota value is applied on the total length of sending queues of all active VPN sessions. Specify '0' to disable the quota. This option is effective to solve the out-of-memory problem on the network where there are many flooding packets. +HUB_AO_AssignVLanIdByRadiusAttribute Enable the VLAN ID dynamic assignment function. Each VPN session will be assigned its own VLAN ID by the RADIUS attribute value when the user is authenticated by the external RADIUS server unless the user object has a VLAN ID security policy. The RADIUS attribute with the name "Tunnel-Pvt-Group-ID" (ID = 81) will be used as the VLAN ID. The data type must be STRING. +HUB_AO_DenyAllRadiusLoginWithNoVlanAssign If you set this option to non-zero value, then all users, which RADIUS server returns no "Tunnel-Pvt-Group-ID" (ID = 81) value, will be denied to connect to the Virtual Hub. (Only if the values of AssignVLanIdByRadiusAttribute is non-zero value.) +HUB_AO_SecureNAT_RandomizeAssignIp If you set this option to non-zero value, then the Virtual DHCP Server of the SecureNAT function will choose an unused IP address randomly from the DHCP pool while the default behavior is to choose the first unused IP address. +HUB_AO_DetectDormantSessionInterval If you set this option to non-zero value, then the Virtual Hub will treat the VPN sessions, which have transmitted no packets for the last specified intervals (in seconds), as Dormant Sessions. The Virtual Hub will not flood packets, which should be flood, to any Dormant Sessions. +HUB_AO_NoPhysicalIPOnPacketLog If you set this option to non-zero value, then the physical IP addresses of VPN clients of either the source VPN session or the destination VPN session will not be recorded on the packet log file. +HUB_AO_UseHubNameAsDhcpUserClassOption If you set this option to non-zero value, then the Virtual Hub Name will be added to a DHCP request to an external DHCP server as the "User-Class" option. This allows to use separate pools of IP addresses for each Virtual Hub. (For only L2TP/IPsec and OpenVPN sessions.) +HUB_AO_UseHubNameAsRadiusNasId If you set this option to non-zero value, then the NAS-Identifier RADIUS attribute will be set to a name of the Virtual Hub. This allows to determine on RADIUS server whether access to the Virtual Hub should be granted or denied. + + +# Concerning failed connection dialogs +ERRDLG_ERRMSG Error (Error Code %u):\r\n%s\r\n +ERRDLG_RETRYCOUNT An automatic reconnection will be made after %u seconds... +ERRDLG_INFORMATION Click Retry to start connecting again. +ERRDLG_RETRY_INFO_1 Do you wish to retry? (%u retries / %u total retries) +ERRDLG_RETRY_INFO_2 Do you wish to retry? (%u retries / total infinite retries) +ERRDLG_DISCONNECTED_MSG Connection to VPN Server "%S" has been disconnected. +ERRDLG_DEVICE_ERROR The connection with the VPN Server has been disconnected because the Virtual Network Adapter (device name: %S) has been stopped. \r\n\r\nError code %u: %s + + +# Concerning protocols +PROTO_DIRECT_TCP Direct TCP/IP Connection +PROTO_HTTP_PROXY Connection via HTTP Proxy +PROTO_SOCKS_PROXY Connection via SOCKS4 Proxy +PROTO_SOCKS5_PROXY Connection via SOCKS5 Proxy +PROTO_SSH Connection via SSH Server +PROTO_UNKNOWN Unknown Protocol + + +# Concerning caps +# (Control characters) +CAPS_YES Yes +CAPS_NO No +# (Title) +CT_i_max_packet_size Maximum Ethernet Packet Size +CT_i_max_hubs Maximum Virtual Hubs +CT_i_max_user_creation Maximum Users on Entire VPN Server +CT_i_max_sessions Maximum Total Sessions +CT_i_max_clients Maximum Client Sessions +CT_i_max_bridges Maximum Bridge Sessions +CT_i_max_users_per_hub Maximum Users per Virtual Hub +CT_i_max_groups_per_hub Maximum Groups per Virtual Hub +CT_i_max_access_lists Maximum Access Lists per Virtual Hub +CT_i_max_mac_tables Maximum MAC Address Entries per Virtual Hub +CT_i_max_ip_tables Maximum IP Address Entries per Virtual Hub +CT_i_max_secnat_tables Maximum SecureNAT Entries per Virtual Hub +CT_i_max_l3_sw Maximum Virtual Layer 3 Switches +CT_i_max_l3_if Maximum Virtual Interfaces per Layer 3 Switch +CT_i_max_l3_table Maximum Routing Tables per Layer 3 Switch +CT_b_bridge Works as VPN Bridge Software +CT_b_standalone Standalone Mode +CT_b_cluster_controller Cluster Controller Mode +CT_b_cluster_member Cluster Member Mode +CT_b_vpn_client_connect Accepting Connection from VPN Client / Bridge +CT_b_local_bridge Local Bridge is Supported +CT_b_must_install_pcap Packet Capture Driver is Not Installed +CT_b_tap_supported Tun/Tap Device is Supported (only in Linux) +CT_b_support_config_hub Changing Virtual Hub Settings is Supported +CT_b_support_securenat SecureNAT is Supported +CT_b_virtual_nat_disabled Virtual NAT is Disabled (only DHCP Enabled) +CT_b_support_cascade Cascade Connection is Supported +CT_b_support_cascade_cert Server Authentication for Cascade Connection is Supported +CT_b_support_config_log Changing Settings for Saving Log is Supported +CT_b_support_autodelete Automatic Deletion of Log Files is Supported +CT_b_support_radius External Authentication Server is Supported +CT_b_support_config_rw Remote Reading and Writing of Config File is Supported +CT_b_support_hub_admin_option Virtual Hub Administration Options is Supported +CT_b_support_cascade_client_cert Client Certificates for Cascade Connection is Supported +CT_b_support_hide_hub Virtual Hub Enumeration Setting is Supported +CT_b_support_cluster_admin Integrated Administration for All Cluster Nodes is Supported +CT_b_support_cluster Operation as Part of a Cluster is Supported +CT_b_support_cluster_controller Operating as a Cluster Controller +CT_b_support_layer3 The Virtual Layer 3 Switch is Supported +CT_b_support_crl Virtual Hub-Specific Certificate Revocation Lists is Supported +CT_b_support_ac Virtual Hub-Specific Source IP Address Limit Lists is Supported +CT_b_support_read_log Downloading of Log Files is Supported +CT_b_support_rename_cascade Renaming of Cascade Connection is Supported +CT_b_support_license Management of Licenses is Supported +CT_b_support_limit_multilogin Limits for Multiple Login by Same User is Supported +CT_b_support_qos VoIP / QoS Functions is Supported +CT_b_support_syslog Syslog Sending Functions is Supported +CT_b_cluster_hub_type_fixed The Virtual Hub Types in a Cluster are Fixed +CT_b_beta_version Beta Version (Pre-release build) +CT_b_support_check_mac Specifing MAC Address in Access Lists is Supported +CT_b_support_check_tcp_state Checking TCP Connection State Filtering is Supported +CT_b_support_network_connection_name Getting Network Friendly Name is Supported + +CT_b_support_radius_retry_interval_and_several_servers Retry Interval and Multi server is Supported in RADIUS Auth +CT_b_support_vlan Tagged VLAN ID is Supported in MAC Address Table +CT_b_support_hub_ext_options Virtual Hub Extended Option is Supported +CT_b_support_policy_ver_3 Security Policy version 3 is Supported +CT_b_support_ipv6_acl IPv6 Access List is Supported +CT_b_support_ex_acl Delay, Jitter and Packet Loss is Supported in Access List +CT_b_support_acl_group Conditioning by Group name is Supported in Access List +CT_b_support_ipv6_ac IPv6 IP Access Control Lists is Supported +CT_b_support_eth_vlan Tagged VLAN Packet Transparency Support tool is Supported +CT_b_support_msg Message of Today function is Supported +CT_b_vpn3 Internal Version 3.0 functions are Supported +CT_b_vpn4 Internal Version 4.0 functions are Supported +CT_b_support_ipsec IPsec / L2TP / EtherIP / L2TPv3 Server Functions are Supported +CT_b_support_sstp MS-SSTP VPN Server Function is Supported +CT_b_support_udp_acceleration UDP Acceleration Function is Supported +CT_b_support_openvpn OpenVPN Server Function is Supported +CT_b_support_ddns Dynamic DNS Client Function is Supported +CT_b_support_ddns_proxy DDNS via Proxy Server is Supported +CT_b_support_special_listener VPN over ICMP and VPN over DNS is Supported +CT_b_support_redirect_url_acl HTTP URL Redirection in Access List is Supported +CT_b_is_in_vm Running on VM (Virtual Machine) +CT_b_support_azure VPN Azure is Supported +CT_b_support_aes_ni CPU AES Acceleration (AES-NI) is Active +CT_b_using_selow_driver SoftEther Lightweight Kernel-mode Ethernet Driver is Active +CT_b_support_vgs VPN Gate Service Server Functions are Supported +CT_b_support_vgs_in_client VPN Gate Service Server Functions (VPN Client integrated) +CT_b_is_softether Either Free or Open-Source Version of SoftEther VPN +CT_b_suppport_push_route Static Routing Table Pushing Function +CT_b_suppport_push_route_config Static Routing Table Pushing Function (Configurable) + +# Concerning policies +POL_TITLE_STR Policy Name +POL_VALUE_STR Current Value +POL_TYPE_BOOL ON / OFF +POL_TYPE_INT Integer +POL_BOOL_ENABLE Enabled +POL_BOOL_DISABLE - +POL_BOOL_DISABLE_EX - +POL_INT_ZERO - +POL_INT_COUNT %u +POL_INT_SEC %u seconds +POL_INT_BPS %u bps +POL_INT_VLAN %u + +# Ver 2.0 +POL_0 Allow Access +POL_EX_0 The users defined this policy have permission to make VPN connection to VPN Server. +POL_1 Filter DHCP Packets (IPv4) +POL_EX_1 All IPv4 DHCP packets in sessions defined this policy will be filtered. +POL_2 Disallow DHCP Server Operation (IPv4) +POL_EX_2 Computers connected to sessions that have this policy setting will not be allowed to become a DHCP server and distribute IPv4 addresses to DHCP clients. +POL_3 Enforce DHCP Allocated IP Addresses (IPv4) +POL_EX_3 Computers in sessions that have this policy setting will only be able to use IPv4 addresses allocated by a DHCP server on the virtual network side. +POL_4 Deny Bridge Operation +POL_EX_4 Bridge-mode connections are denied for user sessions that have this policy setting. Even in cases when the Ethernet Bridge is configured in the client side, communication will not be possible. +POL_5 Deny Routing Operation (IPv4) +POL_EX_5 IPv4 routing will be denied for sessions that have this policy setting. Even in the case where the IP router is operating on the user client side, communication will not be possible. +POL_6 Deny MAC Addresses Duplication +POL_EX_6 The use of duplicating MAC addresses that are in use by computers of different sessions cannot be used by sessions with this policy setting. +POL_7 Deny IP Address Duplication (IPv4) +POL_EX_7 The use of duplicating IPv4 addresses that are in use by computers of different sessions cannot be used by sessions with this policy setting. +POL_8 Deny Non-ARP / Non-DHCP / Non-ICMPv6 broadcasts +POL_EX_8 The sending or receiving of broadcast packets that are not ARP protocol, DHCP protocol, nor ICMPv6 on the virtual network will not be allowed for sessions with this policy setting. +POL_9 Privacy Filter Mode +POL_EX_9 All direct communication between sessions with the privacy filter mode policy setting will be filtered. +POL_10 Deny Operation as TCP/IP Server (IPv4) +POL_EX_10 Computers of sessions with this policy setting can't listen and accept TCP/IP connections in IPv4. +POL_11 Unlimited Number of Broadcasts +POL_EX_11 If a computer of a session with this policy setting sends broadcast packets of a number unusually larger than what would be considered normal on the virtual network, there will be no automatic limiting. +POL_12 Allow Monitoring Mode +POL_EX_12 Users with this policy setting will be granted to connect to the Virtual Hub in Monitoring Mode. Sessions in Monitoring Mode are able to monitor (tap) all packets flowing through the Virtual Hub. +POL_13 Maximum Number of TCP Connections +POL_EX_13 For sessions with this policy setting, this sets the maximum number of physical TCP connections consists in a physical VPN session. +POL_14 Time-out Period +POL_EX_14 For sessions with this policy setting, this sets, in seconds, the time-out period to wait before disconnecting a session when communication trouble occurs between the VPN Client / VPN Server. +POL_15 Maximum Number of MAC Addresses +POL_EX_15 For sessions with this policy setting, this limits the number of MAC addresses per session. +POL_16 Maximum Number of IP Addresses (IPv4) +POL_EX_16 For sessions with this policy setting, this specifies the number of IPv4 addresses that can be registered for a single session. +POL_17 Upload Bandwidth +POL_EX_17 For sessions with this policy setting, this limits the traffic bandwidth that is in the inwards direction from outside to inside the Virtual Hub. +POL_18 Download Bandwidth +POL_EX_18 For sessions with this policy setting, this limits the traffic bandwidth that is in the outwards direction from inside the Virtual Hub to outside the Virtual Hub. +POL_19 Deny Changing Password +POL_EX_19 The users which use password authentication with this policy setting are not allowed to change their own password from the VPN Client Manager or similar. +POL_20 Maximum Number of Multiple Logins +POL_EX_20 Users with this policy setting are unable to have more than this number of concurrent logins. Bridge Mode sessions are not subjects to this policy. This security policy is only available on VPN Server 3.0 or greater, or VPN Server 2.0 with the multi-login restriction function. +POL_21 Deny VoIP / QoS Function +POL_EX_21 Users with this security policy are unable to use VoIP / QoS functions in VPN connection sessions. This security policy is only available on VPN Server 3.0 or greater, or VPN Server 2.0 with the VoIP / QoS functions. + +# Ver 3.0 +POL_22 Filter RS / RA Packets (IPv6) +POL_EX_22 All ICMPv6 packets which the message-type is 133 (Router Solicitation) or 134 (Router Advertisement) in sessions defined this policy will be filtered. As a result, an IPv6 client will be unable to use IPv6 address prefix auto detection and IPv6 default gateway auto detection. +POL_23 Filter RA Packets (IPv6) +POL_EX_23 All ICMPv6 packets which the message-type is 134 (Router Advertisement) in sessions defined this policy will be filtered. As a result, a malicious users will be unable to spread illegal IPv6 prefix or default gateway advertisements on the network. +POL_24 Filter DHCP Packets (IPv6) +POL_EX_24 All IPv6 DHCP packets in sessions defined this policy will be filtered. +POL_25 Disallow DHCP Server Operation (IPv6) +POL_EX_25 Computers connected to sessions that have this policy setting will not be allowed to become a DHCP server and distribute IPv6 addresses to DHCP clients. +POL_26 Deny Routing Operation (IPv6) +POL_EX_26 IPv6 routing will be denied for sessions that have this policy setting. Even in the case where the IP router is operating on the user client side, communication will not be possible. +POL_27 Deny IP Address Duplication (IPv6) +POL_EX_27 The use of duplicating IPv6 addresses that are in use by computers of different sessions cannot be used by sessions with this policy setting. +POL_28 Deny Operation as TCP/IP Server (IPv6) +POL_EX_28 Computers of sessions with this policy setting can't listen and accept TCP/IP connections in IPv6. +POL_29 Maximum Number of IP Addresses (IPv6) +POL_EX_29 For sessions with this policy setting, this specifies the number of IPv6 addresses that can be registered for a single session. +POL_30 Disallow Password Save in VPN Client +POL_EX_30 For users with this policy setting, when the user is using *standard* password authentication, the user will be unable to save the password in VPN Client. The user will be required to input passwords for every time to connect a VPN. This will improve the security. If this policy is enabled, VPN Client Version 2.0 will be denied to access. +POL_31 VPN Client Automatic Disconnect +POL_EX_31 For users with this policy setting, a user's VPN session will be disconnected automatically after the specific period will elapse. In this case no automatic re-connection will be performed. This can prevent a lot of inactive VPN Sessions. If this policy is enabled, VPN Client Version 2.0 will be denied to access. +POL_32 Filter All IPv4 Packets +POL_EX_32 All IPv4 and ARP packets in sessions defined this policy will be filtered. +POL_33 Filter All IPv6 Packets +POL_EX_33 All IPv6 packets in sessions defined this policy will be filtered. +POL_34 Filter All Non-IP Packets +POL_EX_34 All non-IP packets in sessions defined this policy will be filtered. "Non-IP packet" mean a packet which is not IPv4, ARP nor IPv6. Any tagged-VLAN packets via the Virtual Hub will be regarded as non-IP packets. +POL_35 No Default-Router on IPv6 RA +POL_EX_35 In all VPN Sessions defines this policy, any IPv6 RA (Router Advertisement) packet with non-zero value in the router-lifetime will set to zero-value. This is effective to avoid the horrible behavior from the IPv6 routing confusion which is caused by the VPN client's attempts to use the remote-side IPv6 router as its local IPv6 router. +POL_36 No Default-Router on IPv6 RA (physical IPv6) +POL_EX_36 In all VPN Sessions defines this policy (only when the physical communication protocol between VPN Client / VPN Bridge and VPN Server is IPv6), any IPv6 RA (Router Advertisement) packet with non-zero value in the router-lifetime will set to zero-value. This is effective to avoid the horrible behavior from the IPv6 routing confusion which is caused by the VPN client's attempts to use the remote-side IPv6 router as its local IPv6 router. +POL_37 VLAN ID (IEEE802.1Q) +POL_EX_37 You can specify the VLAN ID on the security policy. All VPN Sessions defines this policy, all Ethernet packets toward the Virtual Hub from the user will be inserted a VLAN tag (IEEE 802.1Q) with the VLAN ID. The user can also receive only packets with a VLAN tag which has the same VLAN ID. (Receiving process removes the VLAN tag automatically.) Any Ethernet packets with any other VLAN IDs or non-VLAN packets will not be received. All VPN Sessions without this policy definition can send / receive any kinds of Ethernet packets regardless of VLAN tags, and VLAN tags are not inserted or removed automatically. Any tagged-VLAN packets via the Virtual Hub will be regarded as non-IP packets. Therefore, tagged-VLAN packets are not subjects for IPv4 / IPv6 security policies, access lists nor other IPv4 / IPv6 specific deep processing. + + +# Concerning remote connection dialog +REMOTE_DEF_CAPTION Remote Connection +REMOTE_DEF_TITLE Specify the computer you want to remotely connect to. + + +# Concerning client notification service +CN_TITLE SoftEther VPN Client Developer Edition + + +# Concerning Connection Manager +CM_TITLE SoftEther VPN Client Developer Edition Manager +CM_PW_LOCALMACHINE Local Computer +CM_NO_REMOTE The VPN Client service running on %s disallows remote connections. +CM_CONNECT_FAILED Unable to connect to the VPN Client service operating on %s. \r\nMake sure the VPN Client service has started and is running normally. +CM_BAD_PASSWORD The password is incorrect. Re-enter password. The password is case-sensitive so be sure to discern between upper and lower case letters. +CM_NUM_CONN_COUNT %u VPN Sessions +CM_CONN_NO Not Connected +CM_PRODUCT_NAME SoftEther VPN Client Build %u +CM_ACCOUNT_COLUMN_1 VPN Connection Setting Name +CM_ACCOUNT_COLUMN_2 Status +CM_ACCOUNT_COLUMN_3 VPN Server Hostname +CM_ACCOUNT_COLUMN_3_2 Virtual Hub +CM_ACCOUNT_COLUMN_4 Virtual Network Adapter Name +CM_VLAN_COLUMN_1 Virtual Network Adapter Name +CM_VLAN_COLUMN_2 Status +CM_VLAN_COLUMN_3 MAC Address +CM_VLAN_COLUMN_4 Version +CM_ACCOUNT_OFFLINE Offline +CM_ACCOUNT_ONLINE Connected +CM_ACCOUNT_CONNECTING Connecting +CM_VLAN_ENABLED Enabled +CM_VLAN_DISABLED Disabled +CM_DELETE_ACCOUNT_MSG This will delete the VPN Connection Setting "%s". Do you really want to do this? +CM_ST_ACCOUNT_NAME VPN Connection Setting Name +CM_ST_CONNECTED Session Status +CM_ST_CONNECTED_TRUE Connection Completed (Session Established) +CM_ST_CONNECTED_FALSE Trying to Connect +CM_ST_CONNECTING Connection to VPN Server Started +CM_ST_NEGOTIATION Negotiating +CM_ST_AUTH Authenticating User +CM_ST_ESTABLISHED Connection is Established +CM_ST_RETRY Retrying +CM_ST_IDLE Idle +CM_ST_SERVER_NAME Server Name +CM_ST_SERVER_PORT Port Number +CM_ST_PORT_TCP TCP Port %u +CM_ST_SERVER_P_NAME Server Product Name +CM_ST_SERVER_P_VER Server Version +CM_ST_SERVER_P_BUILD Server Build +CM_ST_START_TIME Connection Started at +CM_ST_FIRST_ESTAB_TIME First Session has been Established since +CM_ST_NONE - +CM_ST_CURR_ESTAB_TIME Current Session has been Established since +CM_ST_NUM_ESTABLISHED Number of Established Sessions +CM_ST_NUM_STR %u Times +CM_ST_HALF_CONNECTION Half Duplex TCP Connection Mode +CM_ST_HALF_TRUE Yes (Half Duplex Mode) +CM_ST_HALF_FALSE No (Full Duplex Mode) +CM_ST_QOS VoIP / QoS Function +CM_ST_QOS_TRUE Enabled +CM_ST_QOS_FALSE Disabled +CM_ST_NUM_TCP Number of TCP Connections +CM_ST_NUM_TCP_UPLOAD Number of Uplink TCP Connections +CM_ST_NUM_TCP_DOWNLOAD Number of Downlink TCP Connections +CM_ST_MAX_TCP Maximum Number of TCP Connections +CM_ST_VLAN_ID VLAN ID +CM_ST_NO_VLAN - +CM_ST_USE_ENCRYPT Encryption +CM_ST_USE_ENCRYPT_TRUE Enabled (Algorithm: %S) +CM_ST_USE_ENCRYPT_TRUE2 Enabled +CM_ST_USE_ENCRYPT_FALSE Disabled (No Encryption) +CM_ST_USE_COMPRESS Use of Compression +CM_ST_UDP_ACCEL_ENABLED UDP Acceleration is Supported +CM_ST_UDP_ACCEL_USING UDP Acceleration is Active +CM_ST_RUDP TCP over UDP (NAT Traversal) +CM_ST_UNDERLAY_PROTOCOL Physical Underlay Protocol +CM_ST_COMPRESS_TRUE Yes (%u %%) +CM_ST_COMPRESS_FALSE No (No Compression) +CM_ST_SESSION_NAME Session Name +CM_ST_CONNECTION_NAME Connection Name +CM_ST_SESSION_KEY Session Key (160 bit) +CM_ST_BRIDGE_MODE Bridge / Router Mode +CM_ST_MONITOR_MODE Monitoring Mode +CM_ST_YES Yes +CM_ST_NO No +CM_ST_SEND_SIZE Outgoing Data Size +CM_ST_RECV_SIZE Incoming Data Size + +CM_ST_SEND_UCAST_NUM Outgoing Unicast Packets +CM_ST_SEND_UCAST_SIZE Outgoing Unicast Total Size +CM_ST_SEND_BCAST_NUM Outgoing Broadcast Packets +CM_ST_SEND_BCAST_SIZE Outgoing Broadcast Total Size + +CM_ST_RECV_UCAST_NUM Incoming Unicast Packets +CM_ST_RECV_UCAST_SIZE Incoming Unicast Total Size +CM_ST_RECV_BCAST_NUM Incoming Broadcast Packets +CM_ST_RECV_BCAST_SIZE Incoming Broadcast Total Size + +CM_ST_NUM_PACKET_STR %S packets +CM_ST_SIZE_BYTE_STR %S bytes + +CM_NEW_ICON Add VPN Connection +CM_VGC_ICON VPN Gate Public VPN Relay Servers +CM_VGC_LINK VPN Gate Academic Web Site +CM_ST_TITLE Connection Status of %s +CM_ST_COLUMN_1 Item +CM_ST_COLUMN_2 Status +CM_NEW_ACCOUNT_NAME_1 New VPN Connection +CM_NEW_ACCOUNT_NAME_2 New VPN Connection (%u) +CM_ACCOUNT_TITLE_1 New VPN Connection Setting Properties +CM_ACCOUNT_TITLE_2 Properties of %s +CM_SERVER_CERT_1 &Specify Individual Cert +CM_SERVER_CERT_2 &Delete Certificate +CM_CLIENT_CERT_1 Specify Client &Certificate +CM_CLIENT_CERT_2 Delete &Client Certificate +CM_CERT_INFO Issued to: %s\r\nIssuer: %s\r\nExpiration: %s +CM_NO_CERT You must specify a client certificate to be used for user authentication. +CM_NO_SECURE Specify the client certificate and private key inside the smart card to be used for user authentication. +CM_CERT_SECURE_INFO Certificate: "%S"\r\nPrivate Key: "%S" +CM_SELECT_SECURE_DEVICE Select Smart Card +CM_SELECT_CERT_INCARD Specify Cert and Pri&vate Key +CM_VIEW_CLIENT_CERT &View Client Certificate +CM_NO_VLAN Before you can create a new VPN Connection Setting you need to create a Virtual Network Adapter. \r\n\r\nDo you want to create a Virtual Network Adapter? +CM_NO_VLAN_2 Before connecting to VPN Server you need to create a Virtual Network Adapter. \r\n\r\nDo you want to create a Virtual Network Adapter? +CM_VLAN_REMOTE_ERROR Unable to create a Virtual Network Adapter from a remote location. \r\n\rStart the VPN Client Manager on the local computer on which the VPN Client service is running and install a Virtual Network Adapter. +CM_9X_VLAN_INSTALL A new Virtual Network Adapter will now be created. \r\n\r\nAfter a Virtual Network Adapter is created, it is necessary to restart Windows directly afterwards. \r\nWhile the Virtual Network Adapter is being installed, you may be asked to insert the Windows installation CD-ROM. \r\n\r\nClose all currently running applications except the VPN Client Manager, have your Windows installation CD-ROM ready at hand, and click OK. \r\nClicking OK will start the installation of the Virtual Network Adapter. When this is finished, Windows will automatically restart. +CM_9X_VLAN_ME_MESSAGE A Virtual Network Adapter has been created. After you click OK, the computer will automatically restart. \r\n\r\nAfter the computer restarts, the Install New Device wizard might appear. \r\nIf the wizard does appear, click Next for each screen until the installation is completed. +CM_9X_VLAN_UNINSTALL To delete a Virtual Network Adapter, delete it from Network Properties. \r\n\r\nDo you want to display the Network Properties window? +CM_PORT_1 8888 (PX-VPN Port) +CM_PORT_2 443 (HTTPS Port) +CM_PORT_3 992 (TELNETS Port) +CM_PORT_4 5555 (SE-VPN Port) +CM_RETRY_INTERVAL_ERROR Set a re-connection interval (at least 5 seconds) when VPN connection has been disconnected. +CM_DELETE_CLIENT_CERT This will delete the client certificate that has been set. Do you really want to do this? +CM_DELETE_SERVER_CERT This will delete the server individual certificate that has been set. Do you really want to do this? +CM_SET_STARTUP The VPN Connection Setting "%s" is now set as a startup connection.\r\n\r\nThis account will be connected automatically next time the computer restarts.\r\n(If you are using Windows, the automatic connection will be started in the background mode before a user logs on to Windows.) +CM_REMOVE_STARTUP Do you wish to delete the startup connection property of VPN Connection Setting "%s"? +CM_NO_DISCONNECT_SPAN Please set the life of the TCP connection. +CM_HALF_MSG When using half-duplex mode, set at least 2 for the number of TCP connections. +CM_TOO_SMALL_INTERVAL Set at least 1 second for the interval to establish a TCP connection. +CM_DELETE_VLAN This will delete the Virtual Network Adapter "%s". Do you really want to do this? +CM_COPY_NAME_1 Copy of %s +CM_COPY_NAME_2 Copy (%u) of %s +CM_IMPORT_NAME_1 %s +CM_IMPORT_NAME_2 %s (%u) +CM_CERT_COLUMN_1 Issued to +CM_CERT_COLUMN_2 Issuer +CM_CERT_COLUMN_3 Expiration +CM_CERT_DELETE_MSG Delete this certificate from the list? +CM_PASSWORD_SET The password has been set. +CM_PASSWORD_REMOVE The password setting has been deleted. +CM_UNDER_CONSTRUCTION Incomplete. +CM_CURRENT_ACTIVE The settings of VPN Connection Setting "%s" were saved. But this VPN Connection Setting is currently online and the new settings will apply in the next connection. +CM_DISCONNECT_ALL This will disconnect all %u VPN Connection Settings that are currently connected. \r\nDo you really want to do this? +CM_HTTPS_MSG You have chosen to connect via an HTTP proxy server. \r\n\r\nUsual HTTP proxy servers do not allow access to a TCP port of your choice. \r\nWhen a VPN Client connects to a VPN Server via a HTTP proxy server, it is possible to connect by using HTTPS (HTTP over SSL) communication. \r\nIn this case it is recommended that you specify 443 (HTTPS Port) as the destination VPN Server port number. \r\n(If you specify a different port number, there are cases where it will not be possible to connect via an HTTP proxy server. \r\n Make sure that port 443 is enabled on the destination VPN Server.)\r\n\r\nFor detailed information contact either the system administrator or network administrator of the HTTP proxy server you plan to connect via. \r\n\r\nDo you want to change the port number specification of the destination VPN Server to 443 (HTTPS Port)? +CM_REMOTE_WARNING You are making changes to the remote management setting that will disallow remote management. \r\n\r\nCurrently the VPN Client Manager is connected to remote computer "%S" and is controlling the VPN Client service on that computer. \r\nIf remote connection is disabled, it will no longer be possible to remotely connect to and control the VPN Client service on computer "%S" using the VPN Client Manager. \r\n\r\nDo you want to disable remote management? +CM_KEEP_INTERVAL_MSG Set a period between %u and %u seconds in the Packet Send Interval. +CM_REMOTE_TITLE Using the VPN Client Manager, it is possible to connect to, and remotely manage a VPN Client service operating on another computer. \r\n(Note that the VPN Client service on the remote computer must allow remote management.) +CM_DESKTOP_LOCAL_PC Local Computer +CM_DESKTOP_REMOTE_PC Computer %S +CM_DESKTOP_MSG_LOCAL_TS Terminal Service (Remote Desktop) Function +CM_DESKTOP_MSG_LOCAL_SW Switch User Function +CM_DESKTOP_MSG_LOCAL_1 Currently %s is installed on this computer, providing an environment that permits multiple users to log on concurrently. In this case, the messages regarding progress status, error messages and other messages displayed by VPN Client will be displayed on a session called the "Console Session". +CM_DESKTOP_MSG_LOCAL_21 Currently "Session ID: 0, User %s" is assigned as the Console Session of this computer, however because you have started VPN Client Manager on session %u, it is not possible to display the message windows such as the progress status or errors that VPN Client displays. +CM_DESKTOP_MSG_LOCAL_22 Currently no one is logged into the Console Session "Session ID: 0" of this computer and because you have started VPN Client Manager on session %u, it is not possible to display the message windows such as the progress status or errors that VPN Client displays. +CM_DESKTOP_MSG_LOCAL_31 It is recommended that when this computer's Console Session (Session ID: 0, User %s) is displayed, start the VPN Client Manager in that session and start the connection to the VPN Connection Setting "%s". You will be able to start a connection process by doing what you are doing now. But it will be at the risk of being unable to check the progress status and error messages that may be displayed during the process. +CM_DESKTOP_MSG_LOCAL_32 It is recommended that you first log off and then after logging in locally, start the VPN Client Manager in that session and start the connection to VPN Connection Setting "%s". Although you will be able to start a connection process by doing what you are doing now, this will be at the risk of being unable to check the progress status and error messages that may be displayed during the process. +CM_DESKTOP_MSG_REMOTE_1 Because you are currently performing operation while remotely connected to VPN Client on computer %S, if the VPN Client displays any progress status or error messages during the VPN connection process to the VPN Connection Setting, you will not be able to check these messages from your current screen display. +CM_DESKTOP_MSG_REMOTE_2 To check all the progress status, error and other message windows that VPN Client displays, you must log in locally to computer %S and display the Control Session (desktop). +CM_DESKTOP_MSG_REMOTE_3 It is recommended that you first log in directly and locally to computer %S, and then start the VPN Client Manager in that session and start the connection to VPN Connection Setting "%s". Although you will be able to start a connection process by doing what you are doing now, this will be at the risk of being unable to check the progress status and error messages that may be displayed during the process. +CM_STOP_INST_VLAN_1 To install a Virtual Network Adapter on this computer you must start the VPN Client Manager within a "Console Session". \r\n\r\nCurrently, %s is installed on this computer and the current user is not logged into the Console Session but rather is logged in as the remote session (session ID: %u).\r\nTo install a Virtual Network Adapter, VPN Client Manager must be started in the Console Session (session ID: %u, user %s is logged on). \r\n\r\nFirst log on to the computer locally by using the user switching function, or the /console switch function that is on the remote desktop, or alternatively the computer's local console device and then start the VPN Client Manager and install the Virtual Network Adapter. +CM_STOP_INST_VLAN_2 To install a Virtual Network Adapter on this computer you must start the VPN Client Manager within a "Console Session". \r\n\r\nCurrently, %s is installed on this computer and the current user is not logged into the Console Session but rather is logged in as the remote session (session ID: %u).\r\nTo install a Virtual Network Adapter you must start the VPN Client Manager within a "Console Session". \r\n(Currently the user is not logged on to the Console Session (Session ID: 0).) \r\n\r\nFirst log on to the computer locally by using the user switching function, or the /console switch function that is on the remote desktop, or alternatively the computer's local console device and then start the VPN Client Manager and install the Virtual Network Adapter. +CM_SHORTCUT_DESKTOP_MSG To start a connection using the shortcut to the VPN Connection Setting, you must launch the shortcut file within the "Console Session". \r\n\r\nCurrently the user is logged on as the remote session (session ID: %u) and not as the Console Session. +CM_HTTP_PROXY_WARNING Connect via HTTP Proxy Server is selected. \r\n\r\nIn many cases, the HTTP proxy server will only allow 2 kinds of TCP port to be used for the connection to the destination server port number, HTTP protocol (TCP port number 80) and HTTPS protocol (TCP port number 443). \r\n(There are also cases when the proxy server does allow a wider choice of TCP port for connection.) \r\n\r\nWhen making a VPN connection via an HTTP proxy server that denies connections to server ports other than HTTP ports or HTTPS ports, you must specify 443 (HTTPS protocol) as the destination VPN Server port number. \r\n\r\nTo check whether the HTTP proxy server you are connecting via allows connection to ports other than port numbers 80 or 443, contact the administrator of the HTTP proxy server. \r\n\r\nCurrently, %d is specified as the destination VPN Server port number. Do you want to change the port number to 443 (HTTPS protocol)?\r\n(The port 443 of the VPN Servers you connect to must be set to listening status and ready for connection.) \r\nIf you are unsure, then contact the system administrator or the network administrator. +CM_HTTP_HEADER_COLUMN_0 Name +CM_HTTP_HEADER_COLUMN_1 Value +CM_PASSWORD_CHANGED The password has been changed. +CM_ACCOUNT_SETTING_FILE VPN Connection Setting Files (*.VPN)|*.vpn|All Files (*.*)|*.* +CM_ACCOUNT_SAVE_TITLE Enter a VPN Connection Setting File's File Name for the Export Destination +CM_ACCOUNT_OPEN_TITLE Select the VPN Connection Setting File to Import +CM_ACCOUNT_FILE_BANNER # VPN Client VPN Connection Setting File\r\n# \r\n# This file is exported using the VPN Client Manager.\r\n# The contents of this file can be edited using a text editor.\r\n# \r\n# When this file is imported to the Client Connection Manager\r\n# it can be used immediately.\r\n\r\n +CM_FAILED_TO_OPEN_FILE Unable to open file. +CM_FAILED_TO_SAVE_FILE Unable to save file. +CM_ACCOUNT_PARSE_FAILED Unable to load the VPN Connection Setting from the specified file. \r\nCheck the contents of the file. +CM_ACCOUNT_MSG_SENSITIVE This VPN Connection Setting has the username and the password.\r\nDo you want to remove these sensitive information from the exported setting file?\r\n\r\nClick Yes to remove sensitive information.\r\nIn that case a user will be required to input the username and the password when he is trying to connect to the VPN Server.\r\n\r\nClick No to stay the sensitive information remaining on the file. +CM_SHORTCUT_FILE Shortcut Files|*.lnk +CM_SHORTCUT_SAVE_TITLE Enter the Shortcut File Name. +CM_SHORTCUT_UNSUPPORTED The connection shortcut function is not supported by this version of VPN Client. \r\nUpdate to a new version. +CM_SHORTCUT_COMMENT Using the VPN Connection Setting "%s" to connect to the VPN Server. +CM_SHORTCUT_ERROR Failed to create a shortcut. +CM_VPN_FILE_CLICKED Do you want to import the VPN Connection File? +CM_VPN_FILE_IMPORT_NG Unable to import the VPN Connection Setting File. Because the VPN Client setting has been locked. +CM_VLAN_INSTALLING Please Wait a While +CM_SECURE_MUST_LOCAL It is currently not possible to configure smart card settings because you are connected to and managing a VPN Client on a remote computer. +CM_DETAIL_MODE_LINK_STR With a Cascade Connection, Connect by Bridge / Router mode is always enabled. +CM_TRAY_INITING SoftEther VPN Client Manager (Developer Edition) ... +CM_TRAY_NOT_CONNECTED SoftEther VPN Client Manager (Developer Edition)\r\nNot connected. +CM_TRAY_CONNECTED_0 SoftEther VPN Client Manager (Developer Edition)\r\nActive connections to %u servers and is attempting to connect to %u servers +CM_TRAY_CONNECTED_1 SoftEther VPN Client Manager (Developer Edition)\r\nAttempting to connect to %u servers +CM_TRAY_CONNECTED_2 SoftEther VPN Client Manager (Developer Edition)\r\nActive connections to %u servers +CM_TRAY_MENU_1_SHOW &Show VPN Client Manager +CM_TRAY_MENU_1_HIDE Cl&ose VPN Client Manager +CM_TRAY_MENU_2_QUIT E&xit VPN Client Manager Program +CM_TRAY_MENU_CONNECT Start VPN &Connection +CM_TRAY_MENU_DISCONNECT &Disconnect VPN Connection +CM_TRAY_MENU_STATUS Show VPN Connec&tion Status +CM_TRAY_MENU_DISCONNECT_ALL Disconnect &All VPN Connections +CM_TRAY_MENU_NEW &New VPN Connection Setting... +CM_TRAY_MENU_RECENT Recent VPN Servers... +CM_TRAY_MENU_TRAFFIC Network &Traffic Speed Test Tool... +CM_TRAY_MENU_NETIF Show Network &Device Status... +CM_TRAY_MENU_ABOUT &About VPN Client Manager... +CM_TRAY_MENU_SETTING Change Operation &Mode... +CM_TRAY_MENU_CANCEL Close this menu +CM_EXIT_MESSAGE This will exit the VPN Client Manager program. \r\nDo you really want to do this? +CM_IMPORT_MESSAGE From file "%S", VPN Connection Setting "%s" has been installed. +CM_VLAN_CREATING Creating a new Virtual Network Adapter for Windows. \r\n\r\nThis process can take several seconds or over a minute. \r\nPlease wait...\r\n\r\n(Please do not perform other operations while the Virtual Network Adapter is being installed.) +CM_SETTING_PASSWORD The setting is locked. To remove the setting-locker, you must enter a password. +CM_EASY_MODE_NOT_ON_REMOTE Unable to connect because of the VPN Client on the remote computer is running in Easy Mode. +CM_EASY_CONNECT_BUTTON_1 Start VPN &Connection +CM_EASY_CONNECT_BUTTON_2 &Disconnect +CM_EASY_ACCOUNT_WARNING You can only modify Proxy Server Setting, User Authentication and Virtual Network Adapter Used because the setting has been locked. +CM_EASY_INFO_1 Select a VPN connection. +CM_EASY_INFO_2 Click Start VPN Connection to start a VPN connection. +CM_EASY_INFO_3 VPN connection is active. You can disconnect by clicking Disconnect. +CM_EXT_VOICE_MSG It is possible that some of the voice message contents of the Extension Voice Guide has not been played normally. \r\nIs the Extension Voice Guide enabled? +CM_EASY_TITLE VPN Client Easy Connection Manager +CM_EASY_CONNECTED VPN connection is active. +CM_EASY_CONNECTING Establishing VPN connection... +CM_PROXY_FROM_IE Currently proxy setting from Internet Explorer has been loaded. +CM_TRAY_ICON_RESTORE The icon in the task tray has been deleted.\r\n\r\nTo restore the icon, run the VPN Client Manager and click Show Task-tray Icon in the View menu. +CM_WOULDYOULOAD_IE_PROXY Currently the Internet Explorer on this computer is configured to use the proxy server "%S".\r\nDo you want to apply the current proxy settings on the new VPN connection setting?\r\n\r\nClick Yes to use the proxy settings of Internet Explorer.\r\nClick No to use direct connection to the VPN Server (does not a proxy server.)\r\nThis setting can be modified in the property screen of the connection settings any time later. +CM_MSG_TITLE VPN Server "%S" (Virtual Hub: "%S") +CM_JUMPLIST_RCCONNECT Recent VPN Servers +CM_VPNGATE_MESSAGE There is the list of Public VPN Relay Servers on the VPN Gate Academic Project Web Site.\r\nAnyone on the Internet can connect a VPN connection to any VPN servers on the list.\r\n\r\nVPN Gate Academic Project is not a part of SoftEther VPN.\r\nThis icon provides just a link to http://www.vpngate.net/.\r\nYou need to install VPN Gate Plugin to connect VPN Gate.\r\n\r\nDo you want to visit http://www.vpngate.net/ (provided by University of Tsukuba) ? +CM_VLAN_REINSTALL_MSG After reinstalling the Virtual Network Adapter driver, the current Virtual Network Adapter's MAC address will change. Also, all TCP/IP settings within the Virtual Network Adapter will reset.\r\n\r\nIn case the reinstalled Virtual Network Adapter fails to work, delete it and create a new one. If it still doesn't work properly, please create a new Virtual Network Adapter with a different name. + + +VGC_COLUMN_0 DDNS Hostname +VGC_COLUMN_1 IP Address (Hostname) +VGC_COLUMN_2 Region +VGC_COLUMN_3 Uptime +VGC_COLUMN_4 VPN Sessions +VGC_COLUMN_5 Line Speed +VGC_COLUMN_6 Ping (Google, SE) +VGC_COLUMN_7 SSL-VPN (TCP) +VGC_COLUMN_8 UDP Support +VGC_COLUMN_9 Logging Policy +VGC_COLUMN_10 Cumulative Transfers +VGC_COLUMN_11 Cumulative Users +VGC_COLUMN_12 Operator's Name +VGC_COLUMN_13 Operator's Message +VGC_COLUMN_14 Total Score + +VGC_LOG_PERMANENT Permanent +VGC_LOG_2WEEKS 2 Weeks +VGC_LOG_NONE No Logs + +VGC_UPTIME_MIN %u mins +VGC_UPTIME_HOUR %u hours +VGC_UPTIME_DAY %u days +VGC_NUM_VPN %u sessions +VGC_NUM_LOGIN %S logins + +VGC_UDP_AVAILABLE UDP OK + +VGC_TITLE VPN Gate Plug-in Message + +VGC_VER_DIFF The version of VPN Gate Client Plug-in is different from SoftEther VPN Client.\r\n\r\n- Current VPN Gate Plug-in: Build %u\r\n- Current SoftEther VPN Client: Build %u\r\n\r\nIt is recommended to download and install VPN Gate Plug-in Build %u. Otherwise, communication errors or list-update errors might be occur. If the VPN Server List updating fails many times, update the VPN Gate Plug-in version.\r\n\r\nThe latest VPN Gate Plug-in is available at http://www.vpngate.net/.\r\n(Use a mirror-site if you cannot visit the above web-site directly.)\r\n\r\n + +VGC_LIST_STR_OK %S Public VPN Relay Servers on the Earth! (Updated at %S) +VGC_LIST_STR_OK_2 %S Servers (at %S) - List update failed. Try again. If fails again, download the latest VPN Gate Client. +VGC_LIST_STR_NG List update failed. Try again. If fails again, download the latest VPN Gate Client. +VGC_PROXY_MSG If you are using a proxy server, you might not be able to use VPN Relay Servers which don't support the TCP port 443 as "SSL-VPN Connection" from such a proxy-mandated network. +VGC_PROXY_TITLE Notice for Proxy Server Users + +VGS_NO_HUB_YET In order to set the message, first you have to commit enabling the VPN Gate service. After the service will be enabled, re-open this window and set the message. + +VGS_STOP VPN Gate Service will stop after you click the OK button.\r\n\r\nAfter VPN Gate Service will be stopped, this computer will never accept new VPN connection requests, however, still-alive VPN Sessions might remain.\r\n (Such VPN sessions sometimes hidden from the enumeration.) \r\n\r\nTo terminate all of still-alive VPN Sessions completely, restart SoftEther VPN Server or SoftEther VPN Client service, or reboot the computer. + +VGS_START This will activate the VPN Gate Relay Service function.\r\n\r\nVPN Gate Relay Service function must be activated by your own risk.\r\nSome countries prohibit using of encrypted VPN by laws.\r\nFor more details about VPN Gate Relay Service please visit http://www.vpngate.net/en/join.aspx.\r\n\r\nThe VPN Gate Academic Experiment Service is operated as a research project at the graduate school on University of Tsukuba, Japan. The service is governed under the Japanese laws. Other countries' laws are none of our concerns nor responsibilities.\r\n\r\nBy nature, there are almost 200 countries in the World, with different laws. It is impossible to verify every countries' laws and regulations and make the software comply with all countries' laws in advance to release the software. If a user uses VPN Gate service in a specific country, and damaged by public servants of the authority, the developer of either the service or software will never be liable to recover or compensate such damages or criminal responsibilities.\r\nBy using this software and service, the user must observe all concerned laws and rules with user's own responsibility. The user will be completely liable to any damages and responsibilities which are results of using this software and service, regardless of either inside or outside of Japan's territory.\r\nIf you don't agree nor understand the above warnings, do not use any of VPN Gate Academic Experiment Service functions. + + +# Concerning services (Win32) +SVC_HELP *** Command Line Arguments of %s (%S) ***\r\n\r\nThis program (%s) is a process runs as a background task. Start the program by specifying the following arguments on the command line. \r\n\r\n\r\n/install : Installs %s service (service name: %S) in Windows. After this, the service will automatically start. \r\n\r\n/uninstall... Uninstalls %s service (service name: %S) from Windows. \r\n\r\n/start : Starts %s service (service name: %S). \r\n\r\n/stop : Stops %s service (service name: %S). \r\n\r\n/test : Starts %s program in test mode. (For debug)\r\n\r\n/usermode : Starts %s program in the user mode. (When possible)\r\n\r\n/usermode_showtray : When starting in the user mode, this is used to display task tray icons when they were set to be hidden on a previous occasion. \r\n\r\n/usermode_hidetray : When starting in the user mode, this sets the task tray icons to be hidden. \r\n\r\n\r\nNote: Commands related to service operation other than /test and /usermode can only be operated on Windows NT / XP / Server 2003 / Vista / Server 2008. +SVC_NT_ONLY The service related operation commands can only operate on Windows NT / 2000 / XP / Server 2003 / Vista / Server 2008. \r\nThey do not operate on Windows 98 / Me. +SVC_ALREADY_INSTALLED The "%s" service (service name: %S) is already installed on this computer. Do you want to uninstall it and then re-install? +SVC_INSTALL_OK The "%s" service (Service name: %S) has been installed successfully. \r\n\r\n(Execution path: %s)\r\n\r\nThe service has started. +SVC_INSTALL_FAILED The installation of the "%s" service (service name: %S) failed. +SVC_INSTALL_FAILED_2 The "%s" service (Service name: %S) has been successfully installed. \r\n\r\n(Execution path: %s)\r\n\r\nAn attempt to start the service, however, failed. +SVC_NOT_INSTALLED The "%s" service (service name: %S) is not yet installed on this computer. Use the /install command line argument to install it. +SVC_START_OK The "%s" service (service name: %S) started successfully. +SVC_START_FAILED The "%s" service (service name: %S) failed to start. +SVR_ALREADY_START The "%s" service (service name: %S) has already started. +SVC_STOP_OK The "%s" service (Service name: %S) has been stopped. +SVC_STOP_FAILED The "%s" service (service name: %S) failed to stop. +SVC_ALREADY_STOP The "%s" service (service name: %S) is already stopped. +SVC_UNINSTALL_OK The "%s" service (Service name: %S) has been uninstalled successfully. +SVC_UNINSTALL_FAILED The uninstallation of the "%s" service (service name: %S) failed. +SVC_NOT_FOUND Unable to find information related to service %S from the string table. +SVC_NOT_ADMIN To install, uninstall, start or stop the service you must have administrator privileges for this computer. \r\n\r\nIf you have an administrators account for this computer, log out and log on as an administrator. \r\nIf you are unclear about administrators accounts, contact your system administrator. +SVC_TEST_MSG The "%s" service is started in test mode. \r\n\r\nClick OK to exit the service. +SVC_TRAY_TOOLTIP %S (User mode) +SVC_TEST_MUTEX The executable file %s is already started. +SVC_USERMODE_MUTEX Another process of %s is already started. +SVC_SERVICE_MUTEX Because service %S has process %s that is already started, the service cannot start. +SVC_USERMODE_MENU_1 &Hide Tasktray Icon +SVC_USERMODE_MENU_2 E&xit %s +SVC_HIDE_TRAY_MSG This will hide the tasktray icons when starting %S in user mode. \r\nBeginning from next time %S is started in user mode, icons will not be displayed in the tasktray. \r\nThe menu to exit the process will also be hidden. \r\n\r\nTo exit the process in the case of Windows 98 / Me, use the Ctrl + Alt + Del key combination and select to end the process. \r\nWhen using other operating systems, use Task Manager. \r\n\r\nTo redisplay the tasktray icons, use the /usermode_showtray option when starting in user mode next time. + + +# Concerning services (UNIX) +UNIX_SVC_HELP %S service program\nCopyright (c) all contributors on SoftEther VPN project in GitHub.\nCopyright (c) Daiyuu Nobori, SoftEther Project at University of Tsukuba, and SoftEther Corporation.\nAll Rights Reserved.\n\n%S command usage:\n %S start - Start the %S service.\n %S stop - Stop the %S service if the service has been already started.\n\n +UNIX_SVC_STARTED The %S service has been started.\n +UNIX_SVC_STOPPING Stopping the %S service ...\n +UNIX_SVC_STOPPED %S service has been stopped.\n +UNIX_SVC_STOP_FAILED Stopping %S service was failed.\n +UNIX_SVC_ALREADY_START %S service has been already started.\nRun the "%S stop" command to stop this service.\n +UNIX_SVC_NOT_STARTED %S service has not yet been started.\nRun the "%S start" to start this service.\n +UNIX_SVC_ERROR_FORK Failed to create child process for the %S service.\n +UNIX_SVC_NONROOT \nWarning: The current user context is non-root. It is recommended to run the VPN service by the root user. Although the VPN service may run under non-root users, some privilege-required functions (e.g. the local bridge function) need the root privilege.\n + + +# Service definition (SoftEther VPN Client) +SVC_VPNCLIENT_NAME vpnclient +SVC_VPNCLIENT_TITLE SoftEther VPN Client +SVC_VPNCLIENT_DESCRIPT This manages the Virtual Network Adapter device driver and connection service for the SoftEther VPN Client. When this service is stopped, it will not be possible to use SoftEther VPN Client on this computer to connect to a SoftEther VPN Server. + + +# Service Definition (SoftEther VPN Server) +SVC_VPNSERVER_NAME vpnserver +SVC_VPNSERVER_TITLE SoftEther VPN Server +SVC_VPNSERVER_DESCRIPT This manages the server processes of SoftEther VPN Server. SoftEther VPN Server provides high-performance SoftEther VPN Server functions via TCP/IP protocol. When this service is stopped, SoftEther VPN Server on this computer will stop and SoftEther VPN Client will be unable to establish a VPN connection with this computer. + + +# Service Definition (SoftEther VPN Bridge) +SVC_VPNBRIDGE_NAME vpnbridge +SVC_VPNBRIDGE_TITLE SoftEther VPN Bridge +SVC_VPNBRIDGE_DESCRIPT This manages the processes of SoftEther VPN Bridge. SoftEther VPN Bridge provides a bridging connection between the network this computer is connected to and a SoftEther VPN Server that is remotely located. When this service is stopped, SoftEther VPN Bridge on this computer will stop and it will no longer be possible to communicate via the bridge connection. + + +# Service definition (SoftEther VPN Client) +SVC_SEVPNCLIENTDEV_NAME sevpnclientdev +SVC_SEVPNCLIENTDEV_TITLE SoftEther VPN Client Developer Edition +SVC_SEVPNCLIENTDEV_DESCRIPT This manages the Virtual Network Adapter device driver and connection service for the SoftEther VPN Client. When this service is stopped, it will not be possible to use SoftEther VPN Client on this computer to connect to a SoftEther VPN Server. + + +# Service Definition (SoftEther VPN Server) +SVC_SEVPNSERVERDEV_NAME sevpnserverdev +SVC_SEVPNSERVERDEV_TITLE SoftEther VPN Server Developer Edition +SVC_SEVPNSERVERDEV_DESCRIPT This manages the server processes of SoftEther VPN Server. SoftEther VPN Server provides high-performance SoftEther VPN Server functions via TCP/IP protocol. When this service is stopped, SoftEther VPN Server on this computer will stop and SoftEther VPN Client will be unable to establish a VPN connection with this computer. + + +# Service Definition (SoftEther VPN Bridge) +SVC_SEVPNBRIDGEDEV_NAME sevpnbridgedev +SVC_SEVPNBRIDGEDEV_TITLE SoftEther VPN Bridge Developer Edition +SVC_SEVPNBRIDGEDEV_DESCRIPT This manages the processes of SoftEther VPN Bridge. SoftEther VPN Bridge provides a bridging connection between the network this computer is connected to and a SoftEther VPN Server that is remotely located. When this service is stopped, SoftEther VPN Bridge on this computer will stop and it will no longer be possible to communicate via the bridge connection. + + +# Service definition (SoftEther VPN User-mode Router) +SVC_VPNROUTER_NAME vpnrouter +SVC_VPNROUTER_TITLE SoftEther VPN Router Developer Edition +SVC_VPNROUTER_DESCRIPT This manages the server processes of SoftEther VPN Router (service mode). SoftEther VPN Router is a program that provides a virtual NAT and DHCP server that operates in user mode and by using simple operations it is possible to establish a safe connection between a virtual IP network and a physical IP network. When this service is stopped, SoftEther VPN Router on this computer will stop and SoftEther VPN Client will be unable to use the routing service on this computer. + + +# Service Definition (EtherLogger) +SVC_ELOGSVC_NAME elogsvc +SVC_ELOGSVC_TITLE SoftEther EtherLogger Developer Edition +SVC_ELOGSVC_DESCRIPT SoftEther EtherLogger is a service that captures data flowing through LAN cards connected to the computer and keeps a log of the headers of the packet types specified by the administrator and all data in text file format. + + +# Concerning SoftEther VPN Server Manager +SM_TITLE SoftEther VPN Server Manager Developer Edition +SM_LOCALHOST localhost (This server) +SM_SERVER_BRIDGE_TITLE Manage VPN Bridge "%S" +SM_S_VHUB_BRIDGE When using VPN Bridge, you manage Virtual Hub "BRIDGE" to operate management of VPN Bridge. +SM_DISCONNECTED The management connection has been disconnected. +SM_MIKAN Under Construction. +SM_MAIN_COLUMN_1 Setting Name +SM_MAIN_COLUMN_2 VPN Server Hostname +SM_MAIN_COLUMN_3 Operation Mode +SM_MODE_SERVER Entire VPN Server +SM_MODE_HUB Hub '%S' Only +SM_EDIT_CAPTION_1 New Connection Setting +SM_EDIT_CAPTION_2 Edit %s +SM_SETTING_EXISTS A Connection Setting with the same name as Connection Setting "%s" is already registered. Specify a different name. +SM_SETTING_DELETE_MSG This will delete the Connection Setting "%s". Do you really want to do this? +SM_PASSWORD_TYPE_STR Password for Administration Connection +SM_HUB_COLUMN_1 Virtual Hub Name +SM_HUB_COLUMN_2 Status +SM_HUB_COLUMN_3 Type +SM_HUB_COLUMN_4 Users +SM_HUB_COLUMN_5 Groups +SM_HUB_COLUMN_6 Sessions +SM_HUB_COLUMN_7 MAC Tables +SM_HUB_COLUMN_8 IP Tables +SM_HUB_COLUMN_9 Num Logins +SM_HUB_COLUMN_10 Last Login +SM_HUB_COLUMN_11 Last Communication +SM_HUB_ONLINE Online +SM_HUB_OFFLINE Offline +SM_HUB_STANDALONE Standalone +SM_HUB_STATIC Static Hub +SM_HUB_DYNAMIC Dynamic Hub +SM_SERVER_STANDALONE Standalone Server +SM_FARM_CONTROLLER Cluster Controller +SM_FARM_MEMBER Cluster Member Server +SM_INFORMATION Latest Information +SM_HUB_STATUS_CAPTION Status of Virtual Hub "%s" +SM_HUB_STATUS_HUBNAME Virtual Hub Name +SM_HUB_STATUS_ONLINE Status +SM_HUB_TYPE Type +SM_HUB_NUM_SESSIONS Sessions +SM_HUB_NUM_SESSIONS_CLIENT Sessions (Client) +SM_HUB_NUM_SESSIONS_BRIDGE Sessions (Bridge) +SM_HUB_NUM_ACCESSES Access Lists +SM_HUB_NUM_USERS Users +SM_HUB_NUM_GROUPS Groups +SM_HUB_NUM_MAC_TABLES MAC Tables +SM_HUB_NUM_IP_TABLES IP Tables +SM_HUB_SECURE_NAT SecureNAT +SM_HUB_SECURE_NAT_YES Enabled +SM_HUB_SECURE_NAT_NO Disabled +SM_HUB_NUM_LOGIN Num Logins +SM_HUB_LAST_LOGIN_TIME Last Login +SM_HUB_LAST_COMM_TIME Last Communication +SM_HUB_CREATED_TIME Created at +SM_STATUS_COLUMN_1 Item +SM_STATUS_COLUMN_2 Value + +SM_ST_SEND_UCAST_NUM Outgoing Unicast Packets +SM_ST_SEND_UCAST_SIZE Outgoing Unicast Total Size +SM_ST_SEND_BCAST_NUM Outgoing Broadcast Packets +SM_ST_SEND_BCAST_SIZE Outgoing Broadcast Total Size + +SM_ST_RECV_UCAST_NUM Incoming Unicast Packets +SM_ST_RECV_UCAST_SIZE Incoming Unicast Total Size +SM_ST_RECV_BCAST_NUM Incoming Broadcast Packets +SM_ST_RECV_BCAST_SIZE Incoming Broadcast Total Size + +SM_ST_NUM_PACKET_STR %S packets +SM_ST_SIZE_BYTE_STR %S bytes + +CM_EDIT_HUB_1 New Virtual Hub +CM_EDIT_HUB_2 Properties of %S + +CM_EDIT_HUB_STANDALONE Currently the server is operating in Standalone Mode. This Virtual Hub is operating as a Standalone Hub. +CM_EDIT_HUB_TYPE_FIXED Currently the server is operating in Cluster Mode. This Virtual Hub is of the following type, which means it is not possible to make dynamic changes. +CM_EDIT_HUB_CREATED A new Virtual Hub '%S' has been created. +CM_OFFLINE_MSG Do you want to switch %s to offline?\r\n\r\nIf you switch the Virtual Hub to offline all sessions currently connected to the Virtual Hub will be disconnected and new sessions will be unable to connect. +CM_DELETE_HUB_MSG Do you want to delete %S?\r\n\r\nIf you delete the Virtual Hub, all sessions currently connected to the Virtual Hub will be disconnected and new sessions will be unable to connect. \r\nThis will also delete all the Hub settings, user objects, group objects, certificates and Cascade Connections. \r\n\r\nOnce you delete the Virtual Hub, it cannot be recovered. \r\nAre you sure you want to delete it? +CM_HUB_DELETED_MSG Virtual Hub %S has been deleted. +CM_LISTENER_COLUMN_1 Port Number +CM_LISTENER_COLUMN_2 Status +CM_LISTENER_TCP_PORT TCP %u +CM_LISTENER_ONLINE Listening +CM_LISTENER_OFFLINE Stopped +CM_LISTENER_ERROR Error +CM_DELETE_LISTENER_MSG This will delete the Listener (TCP port %u). From now on, it will not be possible to connect to this port. \r\nDo you really want to do this? +CM_STOP_LISTENER_MSG This will stop the Listener (TCP port %u). Until Listener is restarted it will not be possible to connect to this port. \r\n\r\nDo you really want to do this? +CM_CLOSE_BUTTON Close +CM_CERT_SET_MSG A new server certificate has been set.\r\n\r\nIf you are using OpenVPN protocols, please mind that you may have to update the inline certificate data in the OpenVPN configuration file. + +CM_SHORTCUT_DISCONNECT There is already an active connection to the specified connection destination. \r\n\r\nDo you want to disconnect? + + +SM_SERVER_STATUS Server Status +SM_ST_SERVER_TYPE Server Type +SM_ST_NUM_TCP Number of Active Sockets +SM_ST_NUM_TCP_LOCAL Number of Active Sockets (This Server) +SM_ST_NUM_TCP_REMOTE Number of Active Sockets (Other Member Servers) +SM_ST_NUM_HUB_TOTAL Number of Virtual Hubs +SM_ST_NUM_HUB_STATIC Number of Static Virtual Hubs +SM_ST_NUM_HUB_DYNAMIC Number of Dynamic Virtual Hubs +SM_ST_NUM_SESSION_TOTAL Number of Sessions +SM_ST_NUM_SESSION_LOCAL Number of Sessions (This Server) +SM_ST_NUM_SESSION_REMOTE Number of Sessions (Other Member Servers) +SM_ST_NUM_MAC_TABLE Number of MAC Address Tables +SM_ST_NUM_IP_TABLE Number of IP Address Tables +SM_ST_NUM_USERS Number of Users +SM_ST_NUM_GROUPS Number of Groups +SM_ST_CLIENT_LICENSE Using Client Connection Licenses (This Server) +SM_ST_BRIDGE_LICENSE Using Bridge Connection Licenses (This Server) +SM_ST_CLIENT_LICENSE_EX Using Client Connection Licenses (Entire Cluster) +SM_ST_BRIDGE_LICENSE_EX Using Bridge Connection Licenses (Entire Cluster) +SM_ST_START_TIME Server Started at +SM_ST_CURRENT_TIME Current Time +SM_ST_CURRENT_TICK 64 bit High-Precision Logical System Clock +SM_ST_TOTAL_MEMORY Total Logical Memory Size +SM_ST_USED_MEMORY Used Logical Memory Size +SM_ST_FREE_MEMORY Free Logical Memory Size +SM_ST_TOTAL_PHYS Total Physical Memory Size +SM_ST_USED_PHYS Used Physical Memory Size +SM_ST_FREE_PHYS Free Physical Memory Size +SM_ST_RAM_SIZE_KB %S bytes +SM_INFO_TITLE VPN Server Version Information +SM_INFO_PRODUCT_NAME Product Name +SM_INFO_VERSION Version +SM_INFO_BUILD Build +SM_INFO_HOSTNAME Host Name +SM_OS_SYSTEM_NAME Type of Operating System +SM_OS_PRODUCT_NAME Product Name of Operating System +SM_OS_SERVICE_PACK Service Pack +SM_OS_SP_TAG Service Pack %u +SM_OS_VENDER_NAME Operating System Vendor +SM_OS_VERSION Operating System Version +SM_OS_KERNEL_NAME Type of OS Kernel +SM_OS_KERNEL_VERSION Version of OS Kernel +SM_CONNECTION_TYPE_0 Client +SM_CONNECTION_TYPE_1 Initializing... +SM_CONNECTION_TYPE_2 Login +SM_CONNECTION_TYPE_3 Additional Connection +SM_CONNECTION_TYPE_4 Clustering RPC +SM_CONNECTION_TYPE_5 Management RPC +SM_CONNECTION_TYPE_6 Hub Enumeration RPC +SM_CONNECTION_TYPE_7 Changing Password +SM_CONNECTION_TYPE_8 MS-SSTP Connection +SM_CONNECTION_TYPE_9 OpenVPN Connection +SM_CONN_COLUMN_1 Connection Name +SM_CONN_COLUMN_2 Connection Source +SM_CONN_COLUMN_3 Connection Start +SM_CONN_COLUMN_4 Type +SM_HOSTNAME_AND_PORT %S: %u +SM_CONN_DISCONNECT_MSG This will disconnect connection %s. \r\nDo you really want to do this? +SM_CONNINFO_CAPTION Connection %s Information +SM_CONNINFO_NAME Connection Name +SM_CONNINFO_TYPE Connection Type +SM_CONNINFO_HOSTNAME Source Host Name +SM_CONNINFO_IP Client IP Address +SM_CONNINFO_PORT Client Port Number (TCP) +SM_CONNINFO_TIME Connection Start +SM_CONNINFO_SERVER_STR Server Product Name +SM_CONNINFO_SERVER_VER Sever Version +SM_CONNINFO_SERVER_BUILD Server Build Number +SM_CONNINFO_CLIENT_STR Client Product Name +SM_CONNINFO_CLIENT_VER Client Version +SM_CONNINFO_CLIENT_BUILD Client Build +SM_FARM_REBOOT_MSG You are about to change the clustering configuration. \r\n\r\nWhen you change the clustering configuration, all currently connected sessions and connections for management purposes (including this management connection) will be disconnected and the server program will restart. \r\nWhen there are many server users, it could take over a minute to restart. \r\n\r\nClick OK to automatically disconnect the connection with the server. To continue management, you will need to reconnect to the server. +SM_FM_COLUMN_1 Type +SM_FM_COLUMN_2 Connection Started at +SM_FM_COLUMN_3 Host Name +SM_FM_COLUMN_4 Point +SM_FM_COLUMN_5 Number of Sessions +SM_FM_COLUMN_6 Number of TCP Connections +SM_FM_COLUMN_7 Number of Operating Hubs +SM_FM_COLUMN_8 Using Client Connection Licenses +SM_FM_COLUMN_9 Using Bridge Connection Licenses +SM_FM_CONTROLLER Controller +SM_FM_MEMBER Member +SM_FMINFO_TYPE Server Type +SM_FMINFO_CONNECT_TIME Connection Established at +SM_FMINFO_IP IP Address +SM_FMINFO_HOSTNAME Host Name +SM_FMINFO_POINT Point +SM_FMINFO_WEIGHT Performance Standard Ratio +SM_FMINFO_NUM_PORT Number of Public Ports +SM_FMINFO_PORT Public Port #%u (TCP/IP) +SM_FMINFO_NUM_HUB Number of Running Virtual Hubs +SM_FMINFO_HUB Virtual Hub #%u +SM_FMINFO_HUB_TAG_1 %S (Dynamic) +SM_FMINFO_HUB_TAG_2 %S (Static) +SM_FMINFO_NUM_SESSION Number of Sessions +SM_FMINFO_NUN_CONNECTION Number of TCP Connections +SM_FMINFO_CAPTION Cluster Member Server Status +SM_FC_STATUS_CAPTION Connection to Cluster Controller Status +SM_FC_IP Controller IP Address +SM_FC_PORT Controller TCP/IP Port +SM_FC_STATUS Connection Status +SM_FC_ONLINE Online +SM_FC_OFFLINE Offline +SM_FC_LAST_ERROR Last Error +SM_FC_ERROR_TAG %s (Error Code: %u) +SM_FC_START_TIME Connection Started at +SM_FC_FIRST_TIME First Connection Established at +SM_FC_CURRENT_TIME Current Connection Established at +SM_FC_NUM_TRY Number of Connection Attempts +SM_FC_NUM_CONNECTED Number of Successful Connections +SM_FC_NUM_FAILED Number of Failed Connections +SM_FC_NOT_CONNECTED (Not Connected) +SM_CHANGE_PASSWORD_1 The passwords you entered did not match. Enter the same password in Confirm as you enter in Password. +SM_CHANGE_PASSWORD_2 You have entered an empty password. Continue anyway? +SM_CHANGE_PASSWORD_3 The password has been changed. +SM_USER_COLUMN_1 User Name +SM_USER_COLUMN_2 Full Name +SM_USER_COLUMN_3 Group Name +SM_USER_COLUMN_4 Description +SM_USER_COLUMN_5 Auth Method +SM_USER_COLUMN_6 Num Logins +SM_USER_COLUMN_7 Last Login +SM_AUTHTYPE_0 Anonymous Authentication +SM_AUTHTYPE_1 Password Authentication +SM_AUTHTYPE_2 Individual Certificate Authentication +SM_AUTHTYPE_3 Signed Certificate Authentication +SM_AUTHTYPE_4 RADIUS Authentication +SM_AUTHTYPE_5 NT Domain Authentication +SM_NO_GROUP - +SM_USER_DELETE_MSG This will delete the user "%s". Do you really want to do this? +SM_EDIT_USER_CAPTION_1 Create New User +SM_EDIT_USER_CAPTION_2 Properties of User %S +SM_EDIT_USER_CERT_INFO The users using 'Individual Certificate Authentication' will be allowed or denied connection depending on whether the SSL client certificate completely matches the certificate that has been set for the user beforehand. +SM_EDIT_USER_POL_DLG Security Policy of User %S +SM_POLICY_DEF_CAPTION Security Policy +SM_LIMIT_STR Specify an integer that is within the range %u to %u. +SM_POLICY_INIT_TITLE Select a policy item from the list on the left. +SM_USER_CREATE_OK User %S has been created. +SM_USERINFO_CAPTION User "%S" Information +SM_USERINFO_NAME User Name +SM_USERINFO_GROUP Group Name +SM_USERINFO_CREATE Created on +SM_USERINFO_UPDATE Updated on +SM_USERINFO_EXPIRE Expiration Date +SM_USERINFO_NUMLOGIN Number of Logins +SM_GROUPLIST_NAME Group Name +SM_GROUPLIST_REALNAME Full Name +SM_GROUPLIST_NOTE Description +SM_GROUPLIST_NUMUSERS Num Users +SM_EDIT_GROUP_CAPTION_1 Creation of New Group +SM_EDIT_GROUP_CAPTION_2 Properties of Group %S +SM_GROUP_CREATED Group %S has been created. +SM_GROUP_DELETE_MSG Group %S has been deleted. Do you really want to do this? +SM_GROUP_POLICY_CAPTION Security Policy of Group %S +SM_GROUP_MEMBER_STR \ (Display only users belonging to group %S) +SM_SELECT_GROUP &Select +SM_SELECT_NO_GROUP &None +SM_SELECT_ALT_GROUP Select a &Group... +SM_ACCESS_COLUMN_0 ID +SM_ACCESS_COLUMN_1 Action +SM_ACCESS_COLUMN_2 Status +SM_ACCESS_COLUMN_3 Priority +SM_ACCESS_COLUMN_4 Memo +SM_ACCESS_COLUMN_5 Contents +SM_ACCESS_COLUMN_6 Unique ID +SM_ACCESS_PASS Pass +SM_ACCESS_DISCARD Discard +SM_ACCESS_ENABLE Enable +SM_ACCESS_DISABLE Disable +SM_ACCESS_PROTO_1 All IPv4 / IPv6 Protocols +SM_ACCESS_PROTO_2 6 (TCP/IP Protocol) +SM_ACCESS_PROTO_3 17 (UDP/IP Protocol) +SM_ACCESS_PROTO_4 1 (ICMPv4 Protocol) +SM_ACCESS_PROTO_5 58 (ICMPv6 Protocol) +SM_ACCESS_PROTO_6 Specify the IP Protocol Number +SM_SELECT_USER &Select +SM_SELECT_NO Do&n't Select +SM_PLEASE_SELECT Select User. +SM_LINK_COLUMN_1 Setting Name +SM_LINK_COLUMN_2 Status +SM_LINK_COLUMN_3 Established at +SM_LINK_COLUMN_4 Destination VPN Server +SM_LINK_COLUMN_5 Virtual Hub +SM_LINK_STATUS_OFFLINE Offline (Stopped) +SM_LINK_STATUS_ERROR Error %u: %s +SM_LINK_STATUS_ONLINE Online (Established) +SM_LINK_POLICY_GROUP Cascade Connection Setting +SM_LINK_POLICY_CAPTION Security policy settings applicable to Cascade sessions +SM_LINK_CONNECTING Connecting +SM_LINK_SAVE_ONLINE Although the Cascade Connection Setting "%s" has been changed, this Cascade Connection is currently online. The setting will not be applied until next time the connection is established. +SM_LINK_DELETE_MSG This will delete the settings for Cascade Connection "%s". Do you really want to do this? +SM_LINK_OFFLINE_MSG Currently Cascade Connection "%s" is active. Do you want to disconnect this connection? +SM_LINK_STATUS_CAPTION Connection status of Cascade Connection "%s" +SM_LOG_SWITCH_0 No Switching +SM_LOG_SWITCH_1 Switch in Every Second +SM_LOG_SWITCH_2 Switch in Every Minute +SM_LOG_SWITCH_3 Switch in Every Hour +SM_LOG_SWITCH_4 Switch in Every Day +SM_LOG_SWITCH_5 Switch in Every Month +SM_SESS_DISCONNECT_MSG This will disconnect session "%S". Do you really want to do this? +SM_SESS_COLUMN_1 Session Name +SM_SESS_COLUMN_2 Location +SM_SESS_COLUMN_3 User Name +SM_SESS_COLUMN_4 Source Host Name +SM_SESS_COLUMN_5 TCP Connections +SM_SESS_COLUMN_6 Transfer Bytes +SM_SESS_COLUMN_7 Transfer Packets +SM_SESS_COLUMN_8 VLAN ID +SM_SESS_NORMAL Local Session +SM_SESS_LOCAL Local Session +SM_SESS_LOCAL_2 On '%S' +SM_SESS_REMOTE On '%S' +SM_SESS_LINK Cascade Connection +SM_SESS_LINK_HOSTNAME Virtual Host +SM_SESS_LINK_TCP None +SM_SESS_SNAT SecureNAT Session +SM_SESS_SNAT_HOSTNAME Virtual Host +SM_SESS_SNAT_TCP None +SM_SESS_BRIDGE Local Bridge Session +SM_SESS_BRIDGE_HOSTNAME Ethernet Bridge +SM_SESS_LAYER3_HOSTNAME Virtual Layer 3 Switch +SM_SESS_BRIDGE_TCP None +SM_SESS_STATUS_CAPTION VPN Session "%S" Status +SM_SESS_STATUS_USERNAME User Name (Authentication) +SM_SESS_STATUS_REALUSER User Name (Database) +SM_SESS_STATUS_GROUPNAME Group Name +SM_CLIENT_IP Client IP Address +SM_CLIENT_HOSTNAME Client Host Name +SM_NODE_CLIENT_NAME Client Product Name (Reported) +SM_NODE_CLIENT_VER Client Version (Reported) +SM_NODE_CLIENT_BUILD Client Build (Reported) +SM_NODE_SERVER_NAME Server Product Name (Reported) +SM_NODE_SERVER_VER Server Version (Reported) +SM_NODE_SERVER_BUILD Server Build (Reported) +SM_NODE_CLIENT_OS_NAME Client OS Name (Reported) +SM_NODE_CLIENT_OS_VER Client OS Version (Reported) +SM_NODE_CLIENT_OS_PID Client OS Product ID (Reported) +SM_NODE_CLIENT_HOST Client Host Name (Reported) +SM_NODE_CLIENT_IP Client IP Address (Reported) +SM_NODE_CLIENT_PORT Client Port (Reported) +SM_NODE_SERVER_HOST Server Host Name (Reported) +SM_NODE_SERVER_IP Server IP Address (Reported) +SM_NODE_SERVER_PORT Server Port (Reported) +SM_NODE_PROXY_HOSTNAME Proxy Host Name (Reported) +SM_NODE_PROXY_IP Proxy IP Address (Reported) +SM_NODE_PROXY_PORT Proxy Port (Reported) +SM_MAC_COLUMN_1 Session Name +SM_MAC_COLUMN_2 MAC Address +SM_MAC_COLUMN_3 Created at +SM_MAC_COLUMN_4 Updated at +SM_MAC_COLUMN_5 Location +SM_MAC_COLUMN_1A VLAN ID +SM_SESSION_FILTER \ (Displays only entries of session %S) +SM_IP_COLUMN_1 Session Name +SM_IP_COLUMN_2 IP Address +SM_IP_COLUMN_3 Created at +SM_IP_COLUMN_4 Updated at +SM_IP_COLUMN_5 Location +SM_MAC_IP_DHCP %S (DHCP) +SM_MACIP_LOCAL On This Server +SM_MACIP_SERVER On '%S' +SM_SNAT_STATUS SecureNAT Operating Status +SM_SNAT_NUM_SESSION %u Session +SM_SNAT_NUM_CLIENT %u Client +SM_SNAT_IS_KERNEL Kernel-mode NAT is Active +SM_SNAT_IS_RAW Raw IP mode NAT is Active +SM_BRIDGE_TOO_OLD_VER The Local Bridge function is not supported by the version of the VPN Server that is currently connected. \r\nTry update to a new version. +SM_BRIDGE_UNSUPPORTED Unable to use the Local Bridge function with the operating system that this VPN Server is operating on. For the list of operating system that the Local Bridge function can be used on, refer to the online documentation of the VPN Server. +SM_BRIDGE_WPCAP_REMOTE In order to use the Local Bridge function on this VPN Server, you must install the WinPcap software. The software WinPcap is currently not installed on the server computer. \r\n\r\nTo continue the installation of the WinPcap software, you must start SoftEther VPN Server Manager on the server computer that is running VPN Server and then while connected to localhost (location of your own computer), have the Local Bridge Function Setting window displayed. \r\nTo continue, first exit this management session, and then, after starting SoftEther VPN Server Manager on the server computer, connect to localhost and continue the setting process. +SM_BRIDGE_WPCAP_ROOT In order to use the Local Bridge function on this VPN Server, you must install the WinPcap software. \r\n\r\nTo continue the installation you must log in to this computer as a user with administrator privileges. \r\nLog on as an administrator and start the SoftEther VPN Server Manager again. +SM_BRIDGE_WPCAP_INSTALL In order to use the Local Bridge function on this VPN Server, you must install the WinPcap software. The software WinPcap is currently not installed on the server computer. \r\n\r\nWinPcap is an easy-to-install free software that is bundled together with the VPN Server. \r\n\r\nDo you want to begin the installation of WinPcap? +SM_BRIDGE_WPCAP_REBOOT1 After WinPcap installation has completed, you must restart the computer before you use the Local Bridge function again. \r\n\r\nAfter you restart the computer manually and start VPN Server, configure the settings for the Local Bridge function. +SM_BRIDGE_WPCAP_REBOOT2 After WinPcap installation has completed, you must restart the SoftEther VPN Server service before you use the Local Bridge function again. \r\n\r\nIt only takes a short time to restart the SoftEther VPN Server service, however all sessions that are currently connected to the VPN Server will be disconnected. \r\nThis management session will also be disconnected, so you will need to reconnect to continue. \r\n\r\nDo you want to restart the SoftEther VPN Server service? +SM_BRIDGE_RESOURCE Unable to load the WinPcap driver. +SM_BRIDGE_COLUMN_1 Number +SM_BRIDGE_COLUMN_2 Virtual Hub Name +SM_BRIDGE_COLUMN_3 Network Adapter or Tap Device Name +SM_BRIDGE_COLUMN_4 Status +SM_BRIDGE_OFFLINE Offline +SM_BRIDGE_ONLINE Operating +SM_BRIDGE_ERROR Error +SM_BRIDGE_OK The Local Bridge connection definition has been added. +SM_BRIDGE_DELETE Do you want to delete the Local Bridge from Virtual Hub "%s" to device "%s"? +SM_BRIDGE_DELETE_OK The Local Bridge has been deleted. +SM_BRIDGE_INTEL While in the condition that occurs immediately after a new bridge connection is made when bridging to a physical network adapter, depending on the type of network adapter, there are cases where it will not be possible to communicate using TCP/IP to the network adapter using a bridge connection from a computer on the virtual network. \r\n(This phenomenon is known to occur for Intel and Broadcom network adapters.) \r\n\r\n\r\nIf this issue arises, remedy the situation by restarting the computer on which VPN Server / Bridge is running. Normal communication will be possible after the computer has restarted. \r\n\r\n\r\nAlso many wireless network adapters will not respond to the sending of packets in promiscuous mode and when this occurs you will be unable to use the Local Bridge. If this issue arises, try using a regular wired network adapter instead of the wireless network adapter. +SM_BRIDGE_VPN You are attempting to make a Local Bridge to "%S".\r\n\r\nA Local Bridge is made between a Virtual Hub and a physical network adapter in usual usage. It is unusual to make a Local Bridge to a Virtual Network Adapter.\r\nPlease make sure that it is your intention.\r\n\r\nDo you really want to continue? +SM_BRIDGE_INFO_1 Select the Ethernet device (network adapter) for the bridge destination. +SM_BRIDGE_INFO_2 Enter a name of the new tap device to create. +SM_CONFIG_SAVED The configuration file has been saved. +SM_CONFIG_SAVE_FAILED Failed to save the configuration file. +SM_CONFIG_OPEN_FAILED Unable to open the specified file. +SM_CONFIG_CONFIRM This will apply the specified configuration file to the VPN Server. The VPN Server will automatically restart and it will start loading the new configuration file. The users who are currently connected to the VPN Server will be disconnected. This management session will also be disconnected, you will be needing to reconnect to the server. \r\n\r\nDo you want to proceed? +SM_CONFIG_WRITE_OK The configuration file on the server side has been overwritten. +SM_AO_COLUMN_1 Item +SM_AO_COLUMN_2 Value +SM_TRUE_OR_FALSE Set either 0 (false) or 1 (true) for this item. +SM_AO_SET_OK The Virtual Hub Administration Option has been set. +SM_EXT_OPTION_SET_OK The Virtual Hub Extended Option has been set. +SM_PASSWORD_MSG Currently an administrator password has not been set for this VPN Server. It is recommended that a password is set. \r\n\r\nDo you want to set a server administrator password? +SM_L3_SW_COLUMN1 Layer 3 Switch Name +SM_L3_SW_COLUMN2 Running Status +SM_L3_SW_COLUMN3 Interfaces +SM_L3_SW_COLUMN4 Routing Tables +SM_L3_SW_ST_F_F Stop +SM_L3_SW_ST_T_F Start (Error) +SM_L3_SW_ST_T_T Start (Running) +SM_L3_SW_DEL_MSG This will delete the Virtual Layer 3 Switch "%S". \r\nDo you really want to do this? +SM_L3_SW_IF_COLUMN1 IP Address +SM_L3_SW_IF_COLUMN2 Subnet Mask +SM_L3_SW_IF_COLUMN3 Virtual Hub Name +SM_L3_SW_TABLE_COLUMN1 Network Address +SM_L3_SW_TABLE_COLUMN2 Subnet Mask +SM_L3_SW_TABLE_COLUMN3 Gateway Address +SM_L3_SW_TABLE_COLUMN4 Metric +SM_SECURE_NAT_MSG Are you sure you want to enable the SecureNAT?\r\n\r\nIf you enable the SecureNAT, a virtual router with virtual NAT function will be created that has one IP address in the Virtual Hub. This Virtual Router will interact as one computer or router with other computers that are connected to the virtual network. \r\n\r\nThe SecureNAT in the Virtual NAT enables any computers connected to the Virtual Hub to establish communication with an external network via the SecureNAT. \r\nTherefore, when SecureNAT is running on this VPN Server, there is no need to use local VPN Client to connect the self-computer's Virtual Hub.\r\n\r\n\r\nAlso, please take care about that if there is already a DHCP server in a location that can be reached from a Virtual Hub Layer 2 segment, disable the DHCP server function by clicking the SecureNAT Configuration, otherwise there will be a DHCP conflict. \r\n\r\nMoreover, you can disable the NAT function and only use the DHCP server if you wish. +SM_CRL_COLUMN_1 Certificate Summary +SM_CRL_DELETE_MSG This will delete the selected item. Do you really want to do this? +SM_CRL_EMPTY_MSG No items have been selected. \r\nIf you add this certificate revocation entry, all certificates will be judged as invalid and all client connections that are made in certificate authentication mode will be refused. \r\n\r\nDo you really want to do this? +SM_AC_COLUMN_1 ID +SM_AC_COLUMN_2 Priority +SM_AC_COLUMN_3 Action +SM_AC_COLUMN_4 Contents +SM_AC_PASS Pass +SM_AC_DENY Deny +SM_LOG_FILE_COLUMN_1 Log File Name +SM_LOG_FILE_COLUMN_2 File Size +SM_LOG_FILE_COLUMN_3 Updated on +SM_LOG_FILE_COLUMN_4 Location +SM_READ_LOG_FILE_INFO_1 Please wait until processing is finished... +SM_READ_LOG_FILE_INFO_2 %S in process, %S has finished... +SM_READ_LOG_FILE_ERROR Failed to download file +SM_READ_SAVE_DLG_TITLE Specify a File Name for the Log File's Save Destination +SM_READ_SAVE_DLG_FILTER Log Files (*.LOG)|*.log|All Files (*.*)|*.* +SM_READ_SAVE_FAILED Failed to save the log file. +SM_READ_SAVE_TMP_FAILED Unable to write to temporary file "%S". +SM_READ_SAVE_OPEN_ERROR Unable to open temporary file "%S". \r\n\r\nIt is possible that the .LOG file extension is not an assigned file type in Windows. +SM_LICENSE_COLUMN_1 Number +SM_LICENSE_COLUMN_2 License Key +SM_LICENSE_COLUMN_3 License Type Name +SM_LICENSE_COLUMN_4 Status +SM_LICENSE_COLUMN_5 Expiration Date +SM_LICENSE_COLUMN_6 License ID +SM_LICENSE_COLUMN_7 License Type ID +SM_LICENSE_COLUMN_8 Server ID +SM_LICENSE_COLUMN_9 Serial ID +SM_LICENSE_INFINITE Infinite +SM_LICENSE_NO_EXPIRES No Expiration +SM_LICENSE_STATUS_EDITION Product Edition +SM_LICENSE_STATUS_RELEASE Release Date of VPN Server +SM_LICENSE_STATUS_SYSTEM_ID Current Server ID +SM_LICENSE_STATUS_EXPIRES Expiration of Current Product License +SM_LICENSE_STATUS_SUBSCRIPTION Status of Subscription Contract +SM_LICENSE_STATUS_SUBSCRIPTION_NONEED No Need (This Edition requires no subscription keys) +SM_LICENSE_STATUS_SUBSCRIPTION_NONE No Keys (Adding a subscription key is required) +SM_LICENSE_STATUS_SUBSCRIPTION_VALID Subscription is Active [Until %s] +SM_LICENSE_STATUS_SUBSCRIPTION_EXPIRED Subscription is Expired [at %s] +SM_LICENSE_STATUS_SUBSCRIPTION_BUILD Version Allowed by Current Contract +SM_LICENSE_STATUS_SUBSCRIPTION_BUILD_STR Free Upgrade to Any Future Versions Released Until %s is Allowed +SM_LICENSE_STATUS_ENTERPRISE Enterprise Functions Availability +SM_LICENSE_STATUS_ENTERPRISE_YES Yes (Available) +SM_LICENSE_STATUS_ENTERPRISE_NO No (Unavailable) +SM_LICENSE_NUM_USER Allowed User Objects to Create +SM_LICENSE_NUM_CLIENT Allowed Concurrent Clients +SM_LICENSE_NUM_BRIDGE Allowed Concurrent Bridges +SM_NO_LICENSE_COLUMN Caution: +SM_NO_LICENSE Because there are no product licenses registered, this VPN Server's communication function doesn't operate. +SM_LICENSE_DELETE_MSG Are you sure you want to delete the selected license from the VPN Server? +SM_SYSLOG_0 Disable Syslog Send Function +SM_SYSLOG_1 Send Server Logs by Syslog +SM_SYSLOG_2 Send Server and Virtual Hub Security Logs by Syslog +SM_SYSLOG_3 Send Server, Virtual Hub Security, and Packet Logs by Syslog +SM_SETUP_INFO_1 Click Next to start Setup. Click Close if you want to exit the setup and manually configure all settings. +SM_SETUP_INFO_2 Click Close to configuring the settings of a VPN server manually by yourself. +SM_SETUP_BRIDGE_ONLY You are currently connected to VPN Bridge. You can only create VPN Bridge at Each Site for Multi-site VPN. +SM_SETUP_BRIDGE_EDGE VPN Bridge at &Each Site +SM_SETUP_WARNING The current settings of this VPN Server or VPN Bridge will be initialized. \r\nDo you really want to do this? +SM_SETUP_SELECT Select the Ethernet device to establish the bridge connection. +SM_SETUP_NO_LICENSE_KEY Currently there is no licenses registered for this SoftEther VPN Server. \r\n\r\nFor SoftEther VPN Server to operate as a VPN server, you must enter a license key. \r\nDo you want to display the License Manager?\r\n\r\n(To use the VPN Server as a Trial Version, you have to obtain a trial key from the SoftEther VPN Project web site.\r\nClick Yes and click Obtain or Extend of License button to obtain a trial key. +SM_HUBEXT_OPTION_TITLE Virtual Hub Extended Options +SM_HUBEXT_OPTION_STATIC1 Virtual Hub Extended Options allows you to configure more detailed parameters of this Virtual Hub. +SM_HUBEXT_OPTION_STATIC2 By default, both VPN Server's global administrators and individual Virtual Hub's administrators can modify the Virtual Hub Extended Options.\nHowever, if the deny_hub_admin_change_ext_option is set to 1 on the Virtual Hub Admin Options, the individual Virtual Hub's administrators cannot modify the Virtual Hub Extended Options. (View only.) +SM_VLAN_COLUMN_0 Network Adapter Name +SM_VLAN_COLUMN_1 Driver Type +SM_VLAN_COLUMN_2 Driver File Name +SM_VLAN_COLUMN_3 VLAN Transparency Setting +SM_VLAN_COLUMN_4 GUID +SM_VLAN_COLUMN_5 Device Instance ID +SM_VLAN_YES Enabled +SM_VLAN_NO Not Enabled +SM_VLAN_MSG_1 The Windows Registry has been configured to allow the network adapter "%S" to transmit / receive tagged-VLAN packets.\r\n\r\nHowever, there are some network adapters which requires additional settings on the property of the Device Manager on the local computer's Windows to set the parameters to enable Jumbo Frames. (Ethernet frames which are larger than 1,512 bytes.) Unless you enable Jumbo Frames, some large VLAN packets will be dropped. In the case if large VLAN packets always disappeared, please enable Jumbo Frames. (For example, set the maximum size to 4,088 bytes.) The Device Manager in Windows will help you to configure.\r\n\r\nThis VLAN Transparency Setting has been written to the Windows Registry, however it is not guaranteed that VLAN packets can be transmitted effectively.\r\nIf transmitting VLAN tagged packets will fail after this configuration, refer the manual of the network adapter "%S" to configure manually and adequately. Moreover, "%S" might not support the VLAN transparency setting. In that case, such a network adapter cannot be used to transmit VLAN frames. Use other products.\r\n\r\nTo apply this setting, Windows which runs VPN Server must be rebooted. Do not forget to reboot it. +SM_VLAN_MSG_2 The Windows Registry parameters which was enabling the VLAN transparency features on the network adapter "%S" are deleted from the Registry.\r\n\r\nIf you did a Jumbo Frame enable settings last time, undo such changes manually.\r\n\r\nTo apply this setting, Windows which runs VPN Server must be rebooted. Do not forget to reboot it. +SM_VLAN_NOTHING There are no network adapters which VLAN Transparency Setting Tool supports on the computer "%S".\r\n\r\nHowever, some network adapters are capable to transmit VLAN tagged packets by default, or can be configured to perform VLAN tagged packets by specific configuration utility provided by the vendor.\r\nBy using such network adapters, you have to configure such settings by yourself manually. +SM_SERVER_ADMIN_MSG VPN Server / Bridge "%S" +SM_ETHERIP_COLUMN_0 ISAKMP Phase 1 ID +SM_ETHERIP_COLUMN_1 Virtual Hub Name +SM_ETHERIP_COLUMN_2 User Name +SM_ETHERIP_ADD_OK A new EtherIP / L2TPv3 client setting has been registered. +SM_IPSEC_SETUP_QUESTION This VPN Server has a function to accept IPsec / L2TP / EtherIP / L2TPv3 compatible VPN clients or VPN router products.\r\n\r\nYou can allow the VPN Server to accept connections from smartphones such as iPhone, iPad, Android, or standard VPN client functions on Mac OS X or Windows.\r\n\r\nDo you want to set up the IPsec?\r\n(IPsec settings can be configured by clicking "IPsec / L2TP Settings" button any time later.) +SM_OPENVPN_CONFIG_SAVE_OK The ZIP file '%s' which contains the setting files for OpenVPN.\r\n\r\nOpen this ZIP file to extract sample configuration files for OpenVPN which can be used immediately and easily.\r\nYou might be required to revise the configuration file a little.\r\n\r\nFor details please read the 'readme.txt' file in the ZIP file.\r\n\r\nDo you want to open this ZIP file now? +SM_OPENVPN_CONFIG_SAVE_NG Failed to save the ZIP file '%s'. +SM_OPENVPN_CONFIG_OPEN_NG Failed to open the ZIP file '%s'. Please open this file manually. +SM_DDNS_IPV4_ERROR Unable to reach the IPv4 DDNS Server. +SM_DDNS_IPV6_ERROR Unable to reach the IPv6 DDNS Server. +SM_DDNS_FQDN_EMPTY (None) +SM_DDNS_OK_MSG The Dynamic DNS hostname: %S%S\r\n\r\nYou can access to the below IP address by specifying the above DNS hostname.\r\n\r\nIPv4 Address: %s\r\nIPv6 Address: %s\r\n\r\nYou can also specify the following special forms of hostnames to specify IPv4 or IPv6 as the address-type explicitly.\r\n\r\nHostname for IPv4: %S.v4%S\r\nHostname for IPv6: %S.v6%S\r\n +SM_DDNS_OK_TITLE Dynamic DNS Function +SM_DDNS_OK_MSG2 The Dynamic DNS hostname has been changed to '%S'.\r\n\r\nClick Hint to read additional information. +SM_DDNS_KEY_TITLE Dynamic DNS Key +SM_DDNS_KEY_MSG Your Dynamic DNS Private Key: %s\r\n\r\nThis is the private key which is associated with your current DDNS name. If your VPN Server PC damaged and lost the key, the current DDNS name will be occupied forever and other VPN Server will not be able to use the same name.\r\nIf you want to continue to use the same name, keep the key on a safe place, such as an Internet storage, an another PC or a notepad.\r\nWhen applying the key to the new VPN Server, edit the configuration file of the VPN Server to replace the key by the string in the value following to "byte Key" in the "declare DDnsClient" directive.\r\nDo not use the duplicated key to two or more VPN Servers at the same time. +SM_DDNS_KEY_ERR Failed to read the DNS key. +SM_IPSEC_PSK_TOO_LONG The pre-shared key (PSK) has 10 or more letters.\r\n\r\nIt is reported that several versions of Google Android has a serious bug with 10 or more letters pre-shared key.\r\nTherefore 9 or less letters are recommended for pre-shared key.\r\n\r\nDo you want to try another pre-shared key? +SM_ADVANCED_REDIRECT_URL_HINT_TITLE How to Use Advanced HTTP Redirection Function +SM_ADVANCED_REDIRECT_URL_HINT Advanced HTTP Redirection (For Experts)\r\n\r\nThe string "" is a place holder. It can embedded on the URL of redirection.\r\n\r\nEmbedded URL Example:\r\nhttp://www.google.com/search?q=|secret\r\n\r\nWhen the client is being redirected, the actual destination URL of redirection will be replaced as follows.\r\n\r\nUsername|Session ID|IP Address|Date and Time|Hash Value\r\n\r\\nAfter Replacement Example: zurukko|SID-ZURUKKO-123|219.117.219.154|20131117100354|99707160AFE7A454042B2C47B064112D652452D7\r\n\r\nThe details of each fields are described as following.\r\n\r\nUsername: The username using for the current VPN Session will be placed.\r\n\r\nSession ID: The Session ID of the VPN Session will be placed.\r\n\r\nDate and Time: 14-digits will be placed as 'YYYYMMDDHHMMSS' format (Time zone is UTC).\r\n\r\nHash Value: A 40-characters hexadecimal strings which represent 20 bytes binary data. The binary data is the result of SHA-1 hash function to the temporary string. The temporary string is the combination of the bit-array of the above fields plus the secret string after the '|' symbol in the redirection URL. (In the above example, "secret" is the secret string.) If there are no '|' symbols in the URL, no hash value will be appended.\r\n\r\nThe Purpose of Hash Value: The secret string is effective as the secret key. Thanks to the secret key, the CGI program which receives the query strings on the redirected URL can verify the integrity of the parameters included in the URL.\r\n +SM_ADVANCED_REDIRECT_URL_MSG An URL must start with "http://" or "https://" +SM_DISABLE_DDNS_HINT_CAPTION Disable Dynamic DNS Function +SM_DISABLE_DDNS_HINT To disable the Dynamic DNS Function, modify the configuration file of VPN Server.\r\n\r\nThe "declare root" directive has the "declare DDnsClient" directive. In this directive, you can switch "bool Disable" from false to true, and reboot the VPN Server, then the Dynamic DNS Function will be disabled.\r\n +SM_REGENERATE_CERT_MSG The certificate of VPN Server is being replaced to the new one.\r\n\r\nThis will affect all VPN Clients which are configured to verify the certificate of VPN Server.\r\nDo you want to continue? +SM_DDNS_SERVER_CERT_MSG The DDNS hostname has been changed to "%S".\r\n\r\nIf you are planning to use Microsoft SSTP VPN to connect to the VPN Server from Windows Vista or greater versions of Windows with specifying the DDNS hostname as the destination of VPN Server, the destination hostname of the VPN Server must exactly match to the CN (Common Name) field on the certificate of VPN Server due to the security.\r\n\r\nDo you want to regenerate the server certificate in order to match the CN value to "%S"?\r\n(Click No to keep using the current server certificate.) +SM_DDNS_SERVER_CERT_OK The SSL certificate of VPN Server is now regenerated.\r\n\r\nWhen you make Microsoft SSTP VPN client connects to the VPN Server, you should specify the current DDNS hostname "%S" as the destination server hostname.\r\nYou have to also prepare the "Trusted Root Certificates" list on the Windows to add the certificate of this VPN Server beforehand.\r\n(To install a root certificate to Windows, open MMC and navigate to "Local Computer" in the "Certificates" applet. After that, you can import a certificate into the trusted root certification list.\r\n For details refer Microsoft's documents.)\r\n\r\nDo you want to save the new SSL certificate as a file in the X.509 format? +SM_SETUP_STEP_SECURENAT This VPN Server / Bridge might be running as user-more, or by other limitations, the Virtual Hub and a physical network adapter cannot be bridged together. Instead, the SecureNAT function allows VPN Clients to communicate with other computers in the physical network. The SecureNAT function was enabled by default. You can configure or disable it. +SM_SETUP_STEP_SECURENAT_TITLE Step 3. Bridge Virtual Hub and Physical Network +SM_UPDATE_CHECK_TITLE_VPNSERVER %S VPN Server (on the host '%S') +SM_UPDATE_CHECK_TITLE_VPNBRIDGE %S VPN Bridge (on the host '%S') +SM_FACTORY_DEFAULT_WARNING This will perform a factory-reset on the VPN Server / Bridge.\r\nThe current configuration of VPN Server / Bridge will be erased, and the initial settings will be applied immediately.\r\nYou are recommended to make a backup copy of the current configuration before do a factory-reset.\r\n\r\nPress OK to perform a factory-reset. The VPN Server / Bridge will be rebooted. The current management connection will be disconnected, so please re-connect to the VPN Server / Bridge.\r\n\r\nPress Cancel to cancel the operation. +SM_FACTORY_DEFAULT_PERFORMED The factory-reset operation is performing on the server.\r\n\r\nPress OK to exit the current session of VPN Server Manager.\r\nAfter exiting, please re-start the VPN Server Manager and connect to the VPN Server again.\r\nThen you will see the VPN Server is reset. +SM_AZURE_STATUS_CONNECTED Status: Connected +SM_AZURE_STATUS_NOT_CONNECTED Status: Not Connected +SM_NO_BRIDGE_NICS No physical network adapters suitable for Local Bridge were found on the VPN server computer.\r\nIn order to create a Local Bridge, you have to install at least one physical network adapters on the computer.\r\nYou cannot use Wi-Fi adapters or 3G adapters for Local Bridge.\r\nPlease install a physical network adapter which is compatible to wired Ethernet.\r\n\r\nIf a recently-installed network adapter doesn't appear, once reboot the computer.\r\n\r\nIf the Local Bridge cannot be used anyway, you can use "SecureNAT Function" instead.\r\n\r\nIf you have a certain reason to use unusual network adapters (i.e. Wi-Fi adapters, 3G adapters or virtual adapters), set the "ShowAllInterfaces" variable on the "LocalBridgeList" directive to "true" and restart the VPN Server. Then such devices will appear on the list. (For advanced Windows users only.)\r\n\r\nIf this error occurs after you upgraded Windows, please re-install SoftEther VPN Server or SoftEther VPN Bridge> +SM_CERT_MESSAGE The current SSL self-signed root certificate on this VPN Server is in the old format.\r\n\r\nSome versions of OpenVPN Connect for Android have a bug to misinterpret SSL certificates in the old format. It might cause the connection problem from OpenVPN Connect for Android to this VPN Server.\r\n\r\nIf you are planning to use OpenVPN Connect for Android as a VPN client, it is recommended to regenerate the SSL server certificate.\r\n\r\nDo you want to regenerate the server certificate now? +SM_CERT_MESSAGE_CLI --- Caution ---\r\n\r\nThe current SSL self-signed root certificate on this VPN Server is in the old format.\r\n\r\nSome versions of OpenVPN Connect for Android have a bug to misinterpret SSL certificates in the old format. It might cause the connection problem from OpenVPN Connect for Android to this VPN Server.\r\n\r\nIf you are planning to use OpenVPN Connect for Android as a VPN client, it is recommended to regenerate the SSL server certificate.\r\n\r\nTo regenerate and update the server certificate, execute the "ServerCertRegenerate" command after updating the VPN Server to the latest version. +SM_CERT_NEED_ROOT The specified SSL certificate is a sub-certificate which was issued by a CA (Certificate Authority).\r\n\r\nIf you are planning to support either Microsoft SSTP or OpenVPN protocol on this VPN server, you have to install the root certificate and all intermediate certificates (if exists) on this VPN Server.\r\n\r\nTo install these certificates, copy the root certificate and all intermediate certificate files (in the X.509 format) into the "chain_certs" subdirectory on the directory which is VPN Server has been installed on.\r\n\r\nIf you don't know how to obtain root and intermediate certificate files for your certificate authority (CA), please refer to the CA's web site or contact technical support staffs of the CA. + + +# Concerning User-mode Router Administration Tools +NM_TITLE deleted +NM_CONNECT_TITLE deleted +NM_STATUS_TAG Connection status: %s +NM_OFFLINE You are not connected to any VPN Servers. +NM_CONNECTING Connecting to VPN Server +NM_CONNECTED Connected to VPN Server "%S" +NM_CONNECT_ERROR Error number %u (%s) +NM_ACCOUNT_TITLE deleted +NM_STATUS User-mode Router Status +NM_STATUS_CONNECT Connection Status +NM_STATUS_TCP NAT TCP/IP Sessions +NM_STATUS_UDP NAT UDP/IP Sessions +NM_STATUS_ICMP NAT ICMP Sessions +NM_STATUS_DNS NAT DNS Sessions +NM_STATUS_DHCP Allocated DHCP Clients +NM_INFO User-mode Router information +NM_INFO_PRODUCT_NAME Product Name +NM_INFO_VERSION_STR Version information +NM_INFO_BUILD_INFO Build information +NM_INFO_HOSTNAME Host name +NM_NAT_ID ID +NM_NAT_PROTOCOL Protocol +NM_NAT_SRC_HOST Source Host +NM_NAT_SRC_PORT Source Port +NM_NAT_DST_HOST Destination Host +NM_NAT_DST_PORT Destination Port +NM_NAT_CREATED Session Created On +NM_NAT_LAST_COMM Last Communication Time +NM_NAT_SIZE Receive / Send Size +NM_NAT_TCP_STATUS TCP Connection Status +NM_NAT_PROTO_TCP TCP/IP +NM_NAT_PROTO_UDP UDP/IP +NM_NAT_PROTO_DNS DNS +NM_NAT_PROTO_ICMP ICMP +NAT_TCP_CONNECTING Connecting +NAT_TCP_SEND_RESET Disconnecting +NAT_TCP_CONNECTED Connected +NAT_TCP_ESTABLISHED Running +NAT_TCP_WAIT_DISCONNECT Disconnecting +DHCP_DHCP_ID ID +DHCP_LEASED_TIME Leased at +DHCP_EXPIRE_TIME Expires at +DHCP_MAC_ADDRESS MAC Address +DHCP_IP_ADDRESS Allocated IP +DHCP_HOSTNAME Client Host Name +NM_PASSWORD_MSG The administration password has been set. +NM_PUSH_ROUTE_WARNING The specified text of the static routing table may have a syntax error. + + +# Concerning version information +ABOUT_CAPTION About %s +BETA_EXPIRES Because the currently installed SoftEther VPN software is a beta version, you cannot use it after the provision of a newer beta version of full version. \r\nAccess http://selinks.org/ and get the latest version of SoftEther VPN software. + + +# Concerning the saving of logs +# (Common log) +L_YES Yes +L_NO No +L_LINE ------------------------------------------------------ + +# (Server log) +LS_START_UTF8 Log Messages are written with UTF-8 Encoding Format. +LS_START_1 The SoftEther VPN Server has been started. +LS_START_2 %S %S +LS_START_3 %S +LS_END_1 The SoftEther VPN Server Engine has been successfully shutdown. +LS_END_2 The Server Engine shutdown processing has started. +LS_STOP_ALL_LISTENER All TCP listeners will be stopped. +LS_STOP_ALL_LISTENER_2 All TCP listeners have been stopped. +LS_STOP_ALL_HUB Stopping all Virtual Hubs. +LS_STOP_ALL_HUB_2 All Virtual Hubs have been stopped. +LS_STOP_CEDAR Shutting down the Cedar communication module. +LS_STOP_CEDAR_2 The Cedar communication module has been shut down. +LS_STOP_FARM_MEMBER Disconnecting connection to the cluster controller. +LS_STOP_FARM_MEMBER_2 Connection with the cluster controller has been disconnected. +LS_STOP_FARM_CONTROL Cluster controller is stopping. +LS_STOP_FARM_CONTROL_2 Cluster controller has stopped. +LS_ENUM_ETHERNET_1 Ethernet device has been enumerated. +LS_ENUM_ETHERNET_2 Device %u: "%S" +LS_LOAD_CONFIG_1 Loading the configuration file. +LS_LOAD_CONFIG_2 The configuration file has been loaded. +LS_LOAD_CONFIG_3 Configuration file does not exist. Attempting to start using initial settings. +LS_INIT_SAVE_THREAD Starting the automatically saving background task. The interval between auto-saves is %u seconds. You can change the interval by changing the parameter AutoSaveConfigSpan in the configuration file. +LS_BAD_CONFIG The contents of the configuration file is invalid. The loading process has been terminated. +LS_LISTENER_START_1 TCP Listener (port %u) is starting. +LS_LISTENER_START_2 TCP Listener (port %u) has started. Now listening for connection from client. +LS_LISTENER_START_3 Unable to set port to Listen status for TCP Listener (port %u). Attempting at fixed intervals until successful. +LS_LISTENER_ACCEPT On the TCP Listener (Port %u), a Client (IP address %S, Host name "%S", Port number %u) has connected. +LS_LISTENER_DISCONNECT The connection with the client (IP address %S, Port number %u) has been disconnected. +LS_LISTENER_DOS A DoS attack on the TCP Listener (port %u) has been detected. The connecting source IP address is %S, port number is %u. This connection will be forcefully disconnected now. +LS_LISTENER_MAXUEC The TCP listener is temporary suspending to accept new inward connections because of the number of pending TCP connections exceeded %u. (Current value = %u) +LS_LISTENER_STOP_1 TCP Listener (port %u) is stopping. +LS_LISTENER_STOP_2 TCP Listener (port %u) has stopped. +LS_HUB_START Virtual Hub "%S" has been started. +LS_HUB_STOP Virtual Hub "%S" has been stopped. +LS_HUB_MAC The MAC address of Virtual Hub "%S" is "%S". +LS_NODE_INFO_TAG Client product name: "%S", Client version: %u, Client build number: %u, Server product name: "%S", Server version: %u, Server build number: %u, Client OS name: "%S", Client OS version: "%S", Client product ID: "%S", Client host name: "%S", Client IP address: "%S", Client port number: %u, Server host name: "%S", Server IP address: "%S", Server port number: %u, Proxy host name: "%S", Proxy IP address: "%S", Proxy port number: %u, Virtual Hub name: "%S", Client unique ID: "%S" +LS_CONNECTION_START_1 For the client (IP address: %S, host name: "%S", port number: %u), connection "%S" has been created. +LS_CONNECTION_END_1 Connection "%S" has been terminated. +LS_SSL_START SSL communication for connection "%S" has been started. The encryption algorithm name is "%S". +LS_CONNECTION_ERROR Connection "%S" terminated by the cause "%s" (code %u). +LS_FARMMEMBER_NOT_ADMIN Connection "%S": Although the server is a cluster member, the client attempted that to directly connect to the Virtual Hub "%S" while not being administrator user "%S". The user name provided by the client is "%S". Access is refused. +LS_HUB_NOT_FOUND Connection "%S": Virtual Hub "%S" that the client is trying to connect to does not exist on the server. +LS_IP_DENIED Connection "%S": The source IP address "%S" of the client has refused based on the Source IP Address Limit List defined for the Virtual Hub. +LS_LICENSE_ERROR Connection "%S": Because a license-related error has been occurred, the client is unable to connect to the server. +LS_BETA_EXPIRES This beta version of SoftEther VPN Server is expired. The beta version period of use has expired. Download a new beta version or full version from http://selinks.org/. +LS_TICKET_1 A new client authentication ticket has been issued for cluster member "%S". Virtual Hub "%S", User name "%S" ("%S"), Session name "%S", Ticket "%S" +LS_TICKET_2 A new client authentication ticket has been received from the cluster controller. Virtual Hub "%S", User name "%S" ("%S"), Session name "%S", Ticket "%S", Expiration %u seconds +LS_ENUM_HUB Connection "%S": %u Virtual Hub servers have been enumerated on this server. +LS_FARM_ACCEPT_1 Connection "%S": Although this server received a cluster control connection request, this server is not a cluster controller. +LS_FARM_ACCEPT_2 Connection "%S":Although this server received a cluster control connection request, the authentication password is incorrect and connection has been refused. +LS_FARM_ACCEPT_3 Connection "%S": This server received a cluster control connection request. Authentication has been successful. +LS_FARM_SERV_START Connection with a cluster member has been established. IP address: %S, Host name: "%S" +LS_FARM_SERV_END Connection with cluster member "%S" has been deleted. +LS_FARM_CONNECT_1 Connection to cluster controller "%S" has started. +LS_FARM_CONNECT_2 Connection to cluster controller "%S" has been refused. Error: %s (code %u) +LS_FARM_CONNECT_3 TCP connection to cluster controller "%S" failed. Continuing to attempt connection in intervals of %u seconds until connection is successful. +LS_FARM_DISCONNECT Connection to the cluster controller has stopped. +LS_FARM_START Connected to cluster controller. Operation as cluster member is starting. +LS_LICENSE_NOT_VPNSERVER Connection "%S": License error occurred. The VPN Client attempted to connect while the VPN Server product license is not yet registered. +LS_LICENSE_NOT_VPNCLUSTER Connection "%S": License error occurred. The license registered on this VPN Server is of a type that prevents the use of the current clustering function and a VPN Client has attempted connection while operating in Cluster mode. You must restart the VPN Server. +LS_LICENSE_VIOLATION Connection "%S": A license violation has occurred on the VPN Server and connections are not being received. +LS_LICENSE_VIOLATION_DETECTED A license violation has been detected. A different VPN Server is operating with the same server ID "%I64u" as this VPN Server. It is possible that there are two or more VPN Servers in the cluster that are using the same license. Check the license information of each VPN Server. +LS_API_AUTH_OK HTTPS API client "%r:%u" (%S): Administration mode: "%S": The embedded HTTPS web server accepted the successful login. Username: "%S", Method: "%S", Path: "%S" +LS_API_AUTH_ERROR HTTPS API client "%r:%u" (%S): The embedded HTTPS web server refused a login attempt. Username: "%S", Method: "%S", Path: "%S" +LS_API_RPC_CALL HTTPS API client "%r:%u" (%S): The client called a JSON-API. Method: "%S", Returned error code: %u (0 = success), Returned error message: "%s" + + +# (Proto log) +LP_PREFIX_SESSION [%s] %r:%u -> %r:%u (%s): +LP_SESSION_CREATED Session created. +LP_SESSION_DELETED Session deleted. + + +# (OpenVPN Logs) +LO_PREFIX_RAW OpenVPN Module: +LO_PREFIX_SESSION OpenVPN Session %u (%r:%u -> %r:%u): +LO_PREFIX_CHANNEL OpenVPN Session %u (%r:%u -> %r:%u) Channel %u: +LO_NEW_CHANNEL A new channel is created. +LO_CHANNEL_ESTABLISHED_NEWKEY The channel is established. (Trigger: Re-key completion.) +LO_OPTION_STR_RECV Option Strings Received: "%S" +LO_CLIENT_CERT Client certificate received (subject: CN="%s"), will use certificate authentication. +LO_CLIENT_UNVERIFIED_CERT Client certificate was provided but did not pass verification (error="%S"), will use password authentication. +LO_CLIENT_NO_CERT Client certificate is not provided, will use password authentication. +LO_OPTION_STR_SEND Option Strings to Send: "%S" +LO_INITIATE_REKEY The re-keying process is started. +LO_CHANNEL_ESTABLISHED The channel becomes the established state. +LO_PUSH_REPLY The full strings replied: "%S" +LO_CHANNEL_FAILED Failed to connect a channel. +LO_CHANNEL_DISCONNECTED_BY_HUB This OpenVPN channel is being terminated because the administrator of the Virtual Hub has disconnected this the VPN Session. + + +# (IPsec Logs) +LI_PREFIX_RAW IPsec Module: +LI_PREFIX_CLIENT IPsec Client %u (%S:%u -> %S:%u): +LI_PREFIX_IKE IPsec IKE Session (IKE SA) %u (Client: %u) (%S:%u -> %S:%u): +LI_PREFIX_IPSEC IPsec ESP Session (IPsec SA) %u (Client: %u) (%S:%u -> %S:%u): +LI_START The IPsec ver 2.0 (ISAKMP/IKEv1) processing module is started. +LI_STOPPING The IPsec ver 2.0 (ISAKMP/IKEv1) processing module is now terminating... +LI_STOP The IPsec ver 2.0 (ISAKMP/IKEv1) processing module is terminated. +LI_NUM_IPSEC_SA The number of still-alive IPsec SAs was %u. +LI_NUM_IKE_SA The number of still-alive IKE SAs was %u. +LI_NUM_IKE_CLIENTS The number of still-alive IPsec Clients was %u. +LI_L2TP_SERVER_STARTED The L2TP Server Module is started. +LI_ETHERIP_SERVER_STARTED The EtherIP Server Module is started. The Session ID of the EtherIP Session: %u +LI_DELETE_IKE_CLIENT This IPsec Client is deleted. +LI_DELETE_IKE_SA This IKE SA is deleted. +LI_DELETE_IPSEC_SA This IPsec SA is deleted. +LI_START_QM_FROM_SERVER The server initiates a QuickMode negotiation. +LI_START_QM_FROM_CLIENT The client initiates a QuickMode negotiation. +LI_QM_DH_ERROR Failed to calculate a Diffie-Hellman algorithm. +LI_NEW_IKE_CLIENT A new IPsec client is created. +LI_NEW_IKE_SA A new IKE SA (%s) is created. Initiator Cookie: 0x%I64X, Responder Cookie: 0x%I64X, DH Group: %S, Hash Algorithm: %S, Cipher Algorithm: %S, Cipher Key Size: %u bits, Lifetime: %u Kbytes or %u seconds +LI_TAG_MAINMODE Main Mode +LI_TAG_AGGRESSIVE Aggressive Mode +LI_NEW_IPSEC_SA A new IPsec SA (Direction: %s) is created. SPI: 0x%X, DH Group: %S, Hash Algorithm: %S, Cipher Algorithm: %S, Cipher Key Size: %u bits, Lifetime: %u Kbytes or %u seconds +LI_TAG_SERVER_TO_CLIENT Server -> Client +LI_TAG_CLIENT_TO_SERVER Client -> Server +LI_IPSEC_SA_SPI_SET The SPI which has been pending is now set. New SPI: 0x%X +LI_IPSEC_SA_ESTABLISHED This IPsec SA is established between the server and the client. +LI_IKE_SA_ESTABLISHED This IKE SA is established between the server and the client. +LI_IPSEC_NO_TRANSFORM There are no acceptable transform proposals from the client for establishing an IPsec SA. +LI_IKE_NO_TRANSFORM There are no acceptable transform proposals from the client for establishing an IKE SA. +LI_IKE_NO_NAT_T The connection cannot be accepted because this VPN client is not compatible with IPsec NAT Traversal (RFC 3947 Negotiation of NAT-Traversal in the IKE or draft-ietf-ipsec-nat-t-ike). +LI_SET_CLIENT_ID The client ID which this client presented in the establishing phase is "%S". +LI_CLIENT_MERGE This client (Client %u) and the other client (Client %u) is the same client. So they are merged to the client %u. +LI_CLIENT_UPDATE The port number information of this client is updated. + + +# (EtherIP Log) +LE_PREFIX EtherIP / L2TPv3 Session %u (%S:%u -> %S:%u): +LE_START_MODULE The EtherIP / L2TPv3 Module is started. +LE_STOP The EtherIP / L2TPv3 Module is stopped. +LE_NO_SETTING Error: No EtherIP / L2TPv3 setting entries for the Client ID "%S" is registered on the VPN Server. Please register an entry of a EtherIP / L2TPv3 setting on the VPN Server beforehand. +LE_START_IPC The internal pipe was created between the EtherIP / L2TPv3 module to the Virtual Hub "%S". The using username is "%S". The IPv4 TCP MSS (Max Segment Size) to be set is %u bytes. +LE_IPC_CONNECT_ERROR The connection from the EtherIP / L2TPv3 module to the Virtual Hub "%S" failed. Error: %u : %s +LE_IPC_CONNECT_OK The connection from the EtherIP / L2TPv3 module to the Virtual Hub "%S" succeeded. +LE_RECONNECT Settings of EtherIP / L2TPv3 has been changed. Internal pipes is now being deleted and auto-reconnecting. + + +# (PPP Log) +LP_PREFIX %S%SPPP Session [%S:%u]: +LP_CONNECTED A new PPP session (Upper protocol: %S) is started. IP Address of PPP Client: %S (Hostname: "%S"), Port Number of PPP Client: %u, IP Address of PPP Server: %S, Port Number of PPP Server: %u, Client Software Name: "%S", IPv4 TCP MSS (Max Segment Size): %u bytes +LP_DISCONNECTED The PPP session is disconnected. +LP_PAP_REJECTED The client denied to accept the authentication protocol "PAP" (Password Authentication Protocol, a clear-text password authentication protocol). Enable PAP on the client-side and retry. +LP_PAP_MSCHAPV2_REJECTED The client denied to accept both the "PAP" (Password Authentication Protocol, a clear-text password authentication protocol) and MS-CHAP v2 Protocol. Enable either PAP or MS-CHAP v2 on the client-side and retry. +LP_DISCONNECTED_ABNORMAL A PPP protocol error occurred, or the PPP session has been disconnected. +LP_NEXT_PROTOCOL_IS_NOT_PAP An invalid protocol (Protocol Number: 0x%x) with non-PAP (Password Authentication Protocol) control packet. +LP_PAP_FAILED "PAP" (Password Authentication Protocol, a clear-text password authentication protocol) user authentication failed. +LP_MSCHAPV2_FAILED "MS-CHAP v2" (Microsoft Challenge and Response Protocol Version 2.0) user authentication failed. +LP_NEXT_PROTOCOL_IS_NOT_IPCP An invalid protocol (Protocol Number: 0x%x) with non-IPCP (IP Configuration Protocol) control packet. +LP_DATA_TIMEOUT A timeout on the PPP data transmitting occurred. The PPP client might be disconnected from the network. +LP_CONTROL_TIMEOUT A timeout on the PPP control transmitting occurred. No responses from the PPP client. +LP_VPN_SESSION_TERMINATED The PPP session is disconnected because the VPN Session has been disconnected by the administrator. +LP_UPPER_PROTOCOL_DISCONNECTED The PPP session is disconnected because the upper-layer protocol "%S" has been disconnected. +LP_NORMAL_TERMINATE The PPP session is disconnected by the VPN Client's disconnecting request. +LP_IP_ADDRESS_NOT_DETERMIND The VPN Client sent a packet though an IP address of the VPN Client hasn't been determined. +LP_DHCP_REQUEST_TRYING Trying to request an IP address from the DHCP server. +LP_DHCP_REQUEST_OK An IP address is assigned. IP Address of Client: %S, Subnet Mask: %S, Default Gateway: %S, Domain Name: "%S", DNS Server 1: %S, DNS Server 2: %S, WINS Server 1: %S, WINS Server 2: %S, IP Address of DHCP Server: %S, Lease Lifetime: %u seconds +LP_DHCP_REQUEST_NG Acquiring an IP address from the DHCP server failed. To accept a PPP session, you need to have a DHCP server. Make sure that a DHCP server is working normally in the Ethernet segment which the Virtual Hub belongs to. If you do not have a DHCP server, you can use the Virtual DHCP function of the SecureNAT on the Virtual Hub instead. +LP_DHCP_INFORM_TRYING Acquiring the IP networking information such as subnet mask and the default gateway information from the DHCP server. +LP_DHCP_INFORM_OK The networking information has been acquired. Subnet Mask: %S, Default Gateway: %S, Domain Name: "%S", DNS Server 1: %S, DNS Server 2: %S, WINS Server 1: %S, WINS Server 2: %S, IP Address of DHCP Server: %S +LP_DHCP_INFORM_NG Acquiring the networking information from the DHCP server failed. To accept a PPP session, you need to have a DHCP server. Make sure that a DHCP server is working normally in the Ethernet segment which the Virtual Hub belongs to. If you do not have a DHCP server, you can use the Virtual DHCP function of the SecureNAT on the Virtual Hub instead. +LP_SET_IPV4_PARAM The IP address and other network information parameters are set successfully. IP Address of Client: %S, Subnet Mask: %S, Default Gateway: %S, DNS Server 1: %S, DNS Server 2: %S, WINS Server 1: %S, WINS Server 2: %S + + +# (Virtual Hub log) +LH_ONLINE The Virtual Hub is now online. +LH_OFFLINE The Virtual Hub is now offline. +LH_CONNECT_CLIENT The connection "%S" (IP address: %S, Host name: %S, Port number: %u, Client name: "%S", Version: %S, Build: %u) is attempting to connect to the Virtual Hub. The auth type provided is "%s" and the user name is "%S". +LH_AUTH_UNKNOWN Unknown auth type. +LH_AUTH_ANONYMOUS Anonymous authentication +LH_AUTH_PASSWORD Password authentication +LH_AUTH_PLAIN_PASSWORD External server authentication +LH_AUTH_CERT Certificate authentication +LH_AUTH_TICKET Ticket authentication +LH_AUTH_OPENVPN_CERT OpenVPN certificate authentication +LH_AUTH_RADIUS_NOT_SUPPORT Connection "%S": The authentication method of the user "%S" has been specified as RADIUS Authentication or Active Directory Authentication (NT Domain Authentication). However, the edition of the VPN Server is "%S". This edition does not support RADIUS Authentication nor Active Directory Authentication (NT Domain Authentication). The connection will be denied. +LH_AUTH_RADIUS_NOT_SUPPORT_ON_OPEN_SOURCE Connection "%S": The authentication method of the user "%S" has been specified as RADIUS Authentication or Active Directory Authentication (NT Domain Authentication). However, such an external user-authentication function hasn't been implemented on the Open-Source version of SoftEther VPN yet. The connection will be denied. +LH_AUTH_CERT_NOT_SUPPORT_ON_OPEN_SOURCE Connection "%S": The authentication method of the user "%S" has been specified as Certificate Authentication. However, the Certificate Authentication function hasn't been implemented on the Open-Source version of SoftEther VPN yet. The connection will be denied. +LH_AUTH_OK Connection "%S": Successfully authenticated as user "%S". +LH_AUTH_OK_CERT The Virtual Hub's Security Account Manager has received the following certificate from the VPN Client and accepted its contents as the certificate for when user "%S" logs in: %s +LH_AUTH_NG_CERT Although the Virtual Hub's Security Account Manager has received the following certificate, has refused its contents as the certificate for when user "%S" logs in because this certificate's contents matches the contents that are registered in the Virtual Hub's certificates revocation list: %s +LH_AUTH_NG Connection "%S": User authentication failed. The user name that has been provided was "%S", from %S. +LH_LOCAL_ONLY Connection "%S": The remote login has been refused because of the password for user "%S" is blank. +LH_POLICY_ACCESS_NG Connection "%S": Access has beens refused to user "%S" based on the security policy. +LH_USER_EXPIRES Connection "%S": Access has been refused to user "%S" because of the expiration date has been expired. +LH_CLIENT_VERSION_OLD Connection "%S": The build number of the VPN Client is %u. Only the build %u or latest version of VPN Client is granted to access the VPN Server. +LH_CLIENT_ID_REQUIRED Connection "%S": The Client ID which has been specified by the VPN Client is %u. However, this Virtual Hub has the RequiredClientId value set to %u. +LH_FARM_SELECT_1 Connection "%S": The cluster controller is deciding the destination cluster member of this client. +LH_FARM_SELECT_2 Connection "%S": Failed to decide the destination cluster member server. +LH_FARM_SELECT_3 Connection "%S": This current VPN Server has been decided as the destination cluster member server. Proceeding to receive connection. +LH_FARM_SELECT_4 Connection "%S": The server "%S" has been decided as a destination cluster member server. Instructing clients to redirect connection to this server. +LH_MAX_SESSION Connection "%S": The maximum number of sessions (%u) that can be set by the Virtual Hub has been reached. Unable to create a new session. +LH_MAX_SESSION_CLIENT Connection "%S": The maximum number of client sessions (%u) that can be set by the Virtual Hub has been reached. Unable to create a new session. +LH_MAX_SESSION_BRIDGE Connection "%S": The maximum number of bridge sessions (%u) that can be set by the Virtual Hub has been reached. Unable to create a new session. +LH_MAX_SESSION_2 Connection "%S": The maximum number of sessions (%u) that can be managed by a VPN Server has been reached. Unable to create a new session. +LH_NEW_SESSION Connection "%S": The new session "%S" has been created. (IP address: %S, Port number: %u, Physical underlying protocol: "%S") +LH_SET_SESSION Session "%S": The parameter has been set. Max number of TCP connections: %u, Use of encryption: %s, Use of compression: %s, Use of Half duplex communication: %s, Timeout: %u seconds. +LH_NODE_INFO Session "%S": VPN Client details: (%s) +LH_VLAN_ID Session "%S": Assigned VLAN ID: %u +LH_INVALID_SIGNATURE Session "%S": The connected client sent invalid protocol data. Unable to establish normal communication with client. First check for problems with the connections and cabling of the network connecting the client and the server and then check there is not a special transparent packet re-writing device installed. +LH_END_SESSION Session "%S": The session has been terminated. The statistical information is as follows: Total outgoing data size: %I64u bytes, Total incoming data size: %I64u bytes. +LH_BCAST_STORM Session "%S": A large volume of broadcast packets has been detected. There are cases where packets are discarded based on the policy. The source MAC address is %S, the source IP address is %S, the destination IP address is %S. The number of broadcast packets is equal to or larger than %u items per 1 second (note this information is the result of mechanical analysis of part of the packets and could be incorrect). +LH_DHCP_FORCE Session "%S": The packet was discarded because it has been attempting to use the IP address %S, which is not a DHCP server allocated IP address. +LH_MAC_LIMIT Session "%S": Although the virtual hub has attempt to assign a new MAC address "%S" was made, %u MAC addresses have already been assigned for this service. According to the security policy, this session is allowed to have a maximum of %u MAC addresses. The packet has been discarded. +LH_BRIDGE_LIMIT Session "%S": Although the virtual hub has attempt to assign a new MAC address "%S" was made, %u MAC addresses have already been assigned for this service. According to the security policy, this session is denied bridges and is therefore allowed to hold no more than %u MAC addresses. The packet has been discarded. +LH_MAC_REGIST Session "%S": A new MAC address "%S" has been assigned. +LH_MAC_REGIST_VLAN Session "%S": A new MAC address "%S" (VLAN ID: %u) has been assigned. +LH_IP_LIMIT Session "%S": Although the virtual hub has attempt to assign a new IP address %S was made, %u IP addresses have already been assigned for this service. According to the security policy, this session is allowed to have a maximum of %u IP addresses. The packet has been discarded. +LH_ROUTING_LIMIT Session "%S": Although the virtual hub has attempt to assign a new IP address %S was made, %u IP addresses have already been assigned for this service. According to the security policy, this session is denied routing and is therefore allowed to hold no more than %u IP addresses. The packet has been discarded. +LH_IP_CONFLICT Session "%S": Although the virtual hub has attempt to use the IP address %S was made, this IP address is already being used by another session "%S" (MAC Address: "%S"). The security policy for this session denies duplication of IP addresses that are used by other sessions. The packet has been discarded. Detailed Information: CreatedTime=%I64u, UpdatedTime=%I64u, DhcpAllocated=%u, Now=%I64u +LH_NO_SERVER Session "%S": Although TCP/IP connection request (from %S:%u to %S:%u) was made to this session, because of the security policy denies operation as a server, the packet has been discarded. +LH_NO_DHCP Session "%S": Although host %S on this session sent a packet that allocates an IP address as a DHCP server for host %S on another session, this session's security policy denies operation as a DHCP server. The packet has been discarded. +LH_REGIST_DHCP Session "%S": The DHCP server of host "%S" (%S) on this session allocated, for host "%S" on another session "%S", the new IP address %S. +LH_BRIDGE_1 Session "%S": A Local Bridge connection to physical Ethernet interface "%S" was started. +LH_BRIDGE_2 Session "%S": Because communication has failed to be established with physical Ethernet interface "%S", the Local Bridge has stopped. +LH_SET_MTU Session "%S": The physical Ethernet interface "%S" has an MTU value set to %u. It is necessary to send and receive an Ethernet packet which has %u bytes. The MTU is now changed to %u. +LH_SET_MTU_ERROR Session "%S": The physical Ethernet interface "%S" has an MTU value set to %u. It is necessary to send and receive an Ethernet packet which has %u bytes. However, changing the MTU to %u failed. This physical Ethernet interface or device driver might be unable to process an Ethernet packet which has more 1,514 bytes (payload size: 1,500 bytes). In such case, the larger tagged-VLAN packets than 1,514 bytes cannot be transmitted. You should replace the current physical Ethernet adapter to another which supports Jumbo Frames. You can also try to update the device driver. Another possible method is to enable Jumbo Frames on the operating system or device driver settings. +LH_START_BRIDGE The Local Bridge connection "%S" has started. The bridge session "%S" was created. +LH_STOP_BRIDGE The Local Bridge connection "%S" has stopped. +LH_LINK_START The Cascade Connection "%s" has been established. The Cascade session "%S" was created. +LH_LINK_STOP The Cascade Connection "%s" has stopped. +LH_NAT_START SecureNAT has started. The SecureNAT session "%S" was created. +LH_NAT_STOP SecureNAT stopped. +LH_NAT_TCP_SUCCEED The connection to TCP session %u: Host "%S (%S)", Port %u was successful. +LH_NAT_TCP_FAILED The connection to TCP session %u: Host "%S", Port %u failed. +LH_NAT_TCP_DELETED The TCP session %u has been deleted. +LH_NAT_TCP_CREATED The TCP session %u has been created. Connection source %S:%u, Connection destination %S:%u +LH_NAT_UDP_DELETED The UDP session %u has been deleted. +LH_NAT_UDP_CREATED The UDP session %u has been created. Connection source %S:%u, Connection destination %S:%u +LH_NAT_DHCP_CREATED The DHCP entry %u has been created. MAC address: %S, IP address: %S, host name: %S, expiration span: %u seconds +LH_CHANGE_PASSWORD_1 The connection "%S" (IP address %S) connected to Virtual Hub in change password mode. +LH_CHANGE_PASSWORD_2 Connection "%S": Changing of password failed. The specified user "%S" does not exist. +LH_CHANGE_PASSWORD_3 Connection "%S": Changing of password failed. The auth type of user "%S" is not password authentication. +LH_CHANGE_PASSWORD_4 Connection "%S": Changing of password failed. The old password of user "%S" is incorrect. +LH_CHANGE_PASSWORD_5 Connection "%S": The password of user "%S" has been changed. +LH_CONNECT_1 Starting Cascade Connection "%s": connection number %u. +LH_CONNECT_2 The Cascade Connection "%s" is connected. Session name: "%S" +LH_CONNECT_ERROR The connection for Cascade Connection "%s" has been either disconnected or it failed. Cause: %s (code %u) +LH_POLICY_MONITOR_MODE Connection "%S": Because of a user whose security policy denies permission for Monitoring Mode requested that Monitoring Mode be enabled and attempted to connect to a Virtual Hub, the connection has been denied. +LH_POLICY_BRIDGE_MODE Connection "%S": Because of a user whose security policy denies both bridge connections and routing operations requested that bridge connections or routing operations be enabled and attempted to connect to the Virtual Hub, the connection has been denied. +LH_NOT_ENOUGH_CLIENT_LICENSE Connection "%S": Although this connection attempted to connect to the VPN Server using "client connection mode", because this would have made the number of client connections on the entire server exceed the number of registered Client Connection Licenses, it is not possible to receive the connection for this connection. When the number of licenses for concurrent connections is insufficient, you must either disconnect another existing client connection or increase the number of licenses. There are currently %u registered Client Connection Licenses and the number of connections to servers was %u. +LH_NOT_ENOUGH_BRIDGE_LICENSE Connection "%S": Although this connection attempted to connect to the VPN Server using "bridge connection mode", because this would have made the number of bridge connections on the entire server exceed the number of registered Bridge Connection Licenses, it is not possible to receive the connection for this connection. When the number of licenses for concurrent connections is insufficient, you must either disconnect another existing client connection or increase the number of licenses. There are currently %u registered Bridge Connection Licenses and the number of connections to servers was %u. +LH_TOO_MANY_MULTILOGINS Connection "%S": Although the user "%S" made a login attempt, the security policy that applies to this user limits the maximum number of multiple logins to %u sessions. Currently the number of logins by this user is %u sessions and therefore the user has denied permission for a new VPN connection. +LH_TOO_MANY_MULTILOGINS2 Connection "%S": Although the user "%S" made a login attempt, this edition of the VPN Server permits the maximum number of multiple concurrent VPN sessions to %u sessions per user. Current number of the multiple concurrent VPN sessions of this users is %u, so no more concurrent VPN sessions cannot be permitted. If you want to support more number of multiple concurrent VPN sessions per user, please consider upgrading to Professional Edition or greater of the VPN Server. +LH_PACKET_LOG_NO_LOG The edition of this VPN Server doesn't supports the packet logging function. No IP address nor TCP/UDP header data will be recorded. After you upgrade the edition of the VPN Server to Professional Edition or greater, all kinds of packet logs will be recorded in this file. +LH_PACKET_LOG_NO_LOG_OSS The VPN Server is either Open-Source or Free version. It hasn't implemented the IP Address or TCP/UDP header data logging function. No IP address nor TCP/UDP header data are not be recorded here. +LH_NO_RADIUS_SETTING The user "%S" is configured to use RADIUS authentication. However, there is no RADIUS authentication settings. The user cannot be authenticated. +LH_KERNEL_MODE_START It has been detected that the Kernel-mode NAT for SecureNAT can be run on the interface "%S". The Kernel-mode NAT is starting. The TCP, UDP and ICMP NAT processings will be performed with high-performance via Kernel-Mode hereafter. The parameters of Kernel-mode NAT: IP Address = "%r", Subnet Mask = "%r", Default Gateway = "%r", Broadcast Address = "%r", Virtual MAC Address: "%S", DHCP Server Address: "%r", DNS Server Address: "%r" +LH_KERNEL_MODE_STOP The Kernel-mode NAT on the interface "%S" for SecureNAT has been stopped. + + +# (Administration log) +LA_CONNECTED_1 Connection "%S" connected using server admin mode. +LA_CONNECTED_2 Connection "%S" connected using Virtual Hub Admin Mode. The name of the Virtual Hub is "%S". +LA_IP_DENIED Connection "%S" attempted to connect using administration mode from an IP address whose permission is denied by adminip.txt. Disconnecting. +LA_ERROR Connection "%S" was unable to log in using administration mode. %s (Error code %u) +LA_OK Connection "%S" successfully logged in using administration mode. +LA_RPC_START Connection "%S" created a new remote procedure call session "%S" for the purpose of administration mode. +LA_TAG_1 Administration mode [%S]: +LA_TAG_2 Administration mode [%S] (Virtual Hub "%S"): +LA_CREATE_LISTENER A new TCP listener (port number %u) has been created. +LA_DELETE_LISTENER TCP listener (port number %u) has been deleted. +LA_ENABLE_LISTENER TCP listener (port number %u) has been enabled. +LA_DISABLE_LISTENER TCP listener (port number %u) has been disabled. +LA_SET_PORTS_UDP UDP ports have been set: %s. +LA_SET_PROTO_OPTIONS %s options have been set. +LA_SET_SERVER_PASSWORD The server administrator password has been set. +LA_SET_FARM_SETTING The clustering setting has been changed. +LA_SET_SERVER_CERT The server certificates have been set. +LA_REGENERATE_SERVER_CERT The server certificate has been re-generated. The new CN: "%S" +LA_SET_SERVER_CIPHER A new encryption algorithm name for the server has been set. The new encryption algorithm name is "%S". +LA_CREATE_HUB A new Virtual Hub "%S" has been created. +LA_SET_HUB The Virtual Hub setting has been changed. +LA_DELETE_HUB The Virtual Hub "%S" has been deleted. +LA_SET_HUB_RADIUS The Virtual Hub's external RADIUS authentication server setting has been changed. +LA_DISCONNECT_CONN The client connection "%S" connected to the server has been forcefully disconnected. +LA_SET_HUB_ONLINE The Virtual Hub is now online. +LA_SET_HUB_OFFLINE The Virtual Hub is now offline. +LA_SET_SNAT_OPTION The SecureNAT option has been set. +LA_ENABLE_SNAT The SecureNAT function has been enabled. +LA_DISABLE_SNAT The SecureNAT function has been disabled. +LA_SET_HUB_LOG The log save setting has been changed. +LA_ADD_CA A registration of trusted root certificate has been added. +LA_DELETE_CA A registration of trusted root certificate has been deleted. +LA_CREATE_LINK The Cascade Connection "%s" has been added. +LA_SET_LINK The setting for Cascade Connection "%s" has been changed. +LA_SET_LINK_ONLINE The Cascade Connection "%s" is now online. +LA_SET_LINK_OFFLINE The Cascade Connection "%s" is now offline. +LA_DELETE_LINK The Cascade Connection "%s" has been deleted. +LA_RENAME_LINK The name of Cascade Connection "%s" has been changed to "%s". +LA_ADD_ACCESS An access list has been added. +LA_DELETE_ACCESS The access list has been deleted. +LA_SET_ACCESS_LIST The access list has been updated. An access list of %u items are set. +LA_SET_AC_LIST The Source IP Address Limit List has been updated. Rule items for %u items are set. +LA_CREATE_USER User "%S" has been created. +LA_SET_USER The setting of user "%S" has been updated. +LA_DELETE_USER User "%S" has been deleted. +LA_CREATE_GROUP Group "%S" has been created. +LA_SET_GROUP The setting of group "%S" has been updated. +LA_DELETE_GROUP Group "%S" has been deleted. +LA_DELETE_SESSION This session "%S" has been forcefully disconnected. +LA_SET_KEEP The server's Internet keep-alive setting has been updated. +LA_SET_SYSLOG The server's syslog send function setting has been updated. +LA_DELETE_BRIDGE The Local Bridge connection definition "%S" --> "%S" has been deleted. +LA_ADD_BRIDGE The Local Bridge connection definition "%S" --> "%S" has been added. +LA_REBOOT_SERVER There has been a request to restart VPN Server. +LA_GET_CONFIG The config file has been read. +LA_SET_CONFIG The config file has been written. Restarting VPN Server. +LA_SET_HUB_ADMIN_OPTION The administration option has been set for Virtual Hub "%S". +LA_SET_HUB_EXT_OPTION The Virtual Hub Extended Option has been set for Virtual Hub "%S". +LA_ADD_L3_SW The Virtual Layer 3 Switch "%S" has been created on the server. +LA_DEL_L3_SW The Virtual Layer 3 Switch "%S" has been deleted from the server. +LA_START_L3_SW The Virtual Layer 3 Switch "%S" has been started. +LA_STOP_L3_SW The Virtual Layer 3 Switch "%S" has been stopped. +LA_ADD_L3_IF The virtual interface for Virtual Hub "%S" has been added to Virtual Layer 3 Switch "%S". +LA_DEL_L3_IF The virtual interface for Virtual Hub "%S" has been deleted from Virtual Layer 3 Switch "%S". +LA_ADD_L3_TABLE The routing table for network "%S" has been added to Virtual Layer 3 Switch "%S". +LA_DEL_L3_TABLE The routing table for network "%S" has been deleted from Virtual Layer 3 Switch "%S". +LA_ADD_CRL A certificate has been added to Certificate Revocation List. +LA_DEL_CRL A certificate has been deleted from Certificate Revocation List. +LA_SET_CRL A registered item in a registration of a list of invalid certificates has been edited. +LA_READ_LOG_FILE The log file on the server "%S" (log file "%S") has been downloaded. +LA_ADD_LICENSE_KEY A new license key "%S" has been registered. +LA_DEL_LICENSE_KEY An existing license (No. %u) has been deleted. +LA_SET_IPSEC_CONFIG The IPsec server setting has been updated. +LA_ADD_ETHERIP_ID A new EtherIP / L2TPv3 server setting (ID="%S") has been added. +LA_DEL_ETHERIP_ID The new EtherIP / L2TPv3 server setting (ID="%S") has been deleted. +LA_SET_OVPN_SSTP_CONFIG The OpenVPN and MS-SSTP VPN Server setting has been updated. +LA_DDNS_HOSTNAME_CHANGED The hostname of Dynamic DNS Function has been changed to "%S". +LA_SET_SPECIAL_LISTENER Special Listener enable / disable status has been changed. + +# (Client log) +LC_START_1 The SoftEther VPN Client Engine has been started. +LC_START_2 %S %S +LC_START_3 %S +LC_END The SoftEther VPN Client Engine has been shut down. +LC_LOAD_CONFIG_1 Loading configuration file... +LC_LOAD_CONFIG_2 The configuration file has been loaded. +LC_LOAD_CONFIG_3 Configuration file does not exist. Applying the initial settings. +LC_NEW_ACCOUNT A new VPN Connection Setting "%s" has been created. +LC_DELETE_ACCOUNT The VPN Connection Setting "%s" has been deleted. +LC_RENAME_ACCOUNT The name of VPN Connection Setting "%s" has been changed to "%s". +LC_CONNECT Connection processing for VPN Connection Setting "%s" has started. +LC_CONNECT_1 VPN Connection Setting "%s": Connection operation starting (this is now %u times). +LC_CONNECT_2 VPN Connection Setting "%s": Now connected. Session name: "%S" +LC_CONNECT_ERROR VPN Connection Setting "%s": The connection has been either disconnected or it failed. Cause: %s (code %u) +LC_DISCONNECT Disconnecting the VPN Connection Setting "%s". +LC_CREATE_VLAN A Virtual Network Adapter "%S" has been created. +LC_UPDATE_VLAN The Virtual Network Adapter "%S" driver has been reinstalled. +LC_DELETE_VLAN The Virtual Network Adapter "%S" has been deleted. +LC_SET_PASSWORD The password setting for connection to a client service has been changed. +LC_TAP_NOT_FOUND Cannot find the tun/tap driver for Mac OS X. Please install the tun/tap driver. + +# (Eraser log) +LE_START Monitoring the directory "%S". If the amount of available free disk space becomes less than %S, the backup files for log files and configurations that are saved on the sub-directories of this directory will be automatically deleted in the order of oldest first. The amount of free disk space that determines when to start deletion can be modified by changing the "AutoDeleteCheckDiskFreeSpaceMin" item in the configuration file. +LE_DELETE The free disk space is now less then %S so the old file "%S" has been automatically deleted. The amount of free disk space that determines when to start deletion can be modified by changing the "AutoDeleteCheckDiskFreeSpaceMin" item in the configuration file. +LE_NOT_ENOUGH_FREE <> If the free disk space becomes lower than %S, it will no longer be possible to automatically delete the old backup files of log files and configurations. We recommend that you immediately manually delete the unnecessary files on this computer and recover the necessary free disk space. When there is a very small amount of free disk space, computer operation can become unstable. + +# (Layer 3 Switch log) +L3_SWITCH_START The Virtual Layer 3 Switch "%S" started. It will wait until the Virtual Hubs of all interfaces registered on this switch become online and then it will start operation. +L3_SWITCH_ONLINE The Virtual Hubs of all interfaces of the Virtual Layer 3 Switch "%S" are online and the Virtual Layer 3 Switch has commenced Virtual Layer 3 Switch operation. +L3_SWITCH_OFFLINE At least one Virtual Hub of an interface registered on Virtual Layer 3 Switch "%S" stopped, and Virtual Layer 3 Switch operation has been stopped. +L3_SWITCH_STOP The Virtual Layer 3 Switch "%S" terminated. + + +# Concerning Microsoft.c +MS_VIRTUAL Proprietary Virtual/Internal Interface +MS_ETHERNET Ethernet Interface +MS_TOKENRING Token Ring Interface +MS_FDDI FDDI Interface +MS_PPP PPP (Dialup or VPN) +MS_LOOPBACK Loopback Interface +MS_SLIP SLIP Interface +MS_WLAN Wireless Network Interface +MS_OTHER Unknown Other Interface +MS_NON_OPERATIONAL Disabled +MS_UNREACHABLE Not Connected +MS_DISCONNECTED Not Connected +MS_CONNECTING Connecting +MS_CONNECTED Connected +MS_OPERATIONAL Connected + + +# Concerning Network Utility +UT_SM_COLUMN_1 Item Name +UT_SM_COLUMN_2 Value +UT_SM_ST_TITLE Network Adapter Name +UT_SM_ST_GUID GUID +UT_SM_ST_TYPE Type +UT_SM_ST_TYPE2 Physical Wired Ethernet +UT_SM_ST_STATUS Status +UT_SM_ST_MTU MTU +UT_SM_ST_SPEED Link Speed +UT_SM_ST_ADDRESS Physical Address +UT_SM_ST_RECV_BYTES Incoming Bytes +UT_SM_ST_RECV_BCASTS Incoming Broadcast Packets +UT_SM_ST_RECV_UNICASTS Incoming Unicast Packets +UT_SM_ST_SEND_BYTES Outgoing Bytes +UT_SM_ST_SEND_BCASTS Outgoing Broadcast Packets +UT_SM_ST_SEND_UNICASTS Outgoing Unicast Packets +UT_SM_ST_IP IP Address %u +UT_SM_ST_SUBNET Subnet Mask %u +UT_SM_ST_GATEWAY Gateway %u +UT_SM_ST_DHCP DHCP Server +UT_SM_ST_DHCP_1 Lease Start +UT_SM_ST_DHCP_2 Lease Limit date and time +UT_SM_ST_WINS_1 WINS Server 1 +UT_SM_ST_WINS_2 WINS Server 2 + + +# Concerning EtherLogger Manager +EM_TITLE SoftEther EtherLogger Manager +EM_REMOTE_TITLE You can connect to and manage the SoftEther EtherLogger service. \r\nEnter the host name and IP address of the computer on which the EtherLogger service to be managed is operating. You can also concatenate the port number by using the ":" (colon). +EM_MAIN_COLUMN_1 Network adapter name +EM_MAIN_COLUMN_2 Status +EM_MAIN_OK Operating +EM_MAIN_ERROR Error +EM_ADD_NEW Add new capture device +EM_ADD_EDIT Edit capture settings +EM_DELETE_CONFIRM Are you sure you want to delete capture setting "%S"? +EM_NO_LICENSE_COLUMN Note: +EM_NO_LICENSE Because not even one product license is registered, this SoftEther EtherLogger will not operate. + +EM_UNSUPPORTED Unable to use SoftEther EtherLogger on the operating system that this SoftEther EtherLogger is operating on. For the list of operating system that the SoftEther EtherLogger can be used on, please refer to the online documentation of the SoftEther EtherLogger. +EM_WPCAP_REMOTE In order to use this SoftEther EtherLogger, you need to install WinPcap software. The software WinPcap is currently not installed on the server computer. \r\n\r\nTo continue the installation of the WinPcap software, you must start SoftEther EtherLogger Manager on the server computer that is running VPN Server and then while connected to localhost (location of your own computer), have the Local Bridge Function Setting window displayed. \r\nTo continue, first exit this management session, and then, after starting SoftEther EtherLogger Manager on the server computer, connect to localhost and continue the setting process. +EM_WPCAP_ROOT In order to use this SoftEther EtherLogger, you need to install WinPcap software. \r\n\r\nTo continue the installation you must log in to this computer as a user with administrator privileges. \r\nLog on as an administrator and start the SoftEther VPN Server Manager again. +EM_WPCAP_INSTALL In order to use this SoftEther EtherLogger, you need to install WinPcap software. The software WinPcap is currently not installed on the server computer. \r\n\r\nWinPcap is an easy-to-install free software that is bundled together with the VPN Server. \r\n\r\nDo you want to begin the installation of WinPcap? +EM_WPCAP_REBOOT1 After WinPcap installation has completed, you must restart the computer before you use the SoftEther EtherLogger. \r\n\r\nAfter you restart the computer manually and start SoftEther EtherLogger, configure the settings again. +EM_WPCAP_REBOOT2 After WinPcap is installed, you must restart the SoftEther EtherLogger service. \r\n\r\nIt only takes a short time to restart the SoftEther EtherLogger service, however all management sessions that are currently connected to the SoftEther EtherLogger will be disconnected. \r\nThis management session will also be disconnected, so you will need to reconnect to continue. \r\n\r\nDo you want to restart the SoftEther Ether Logger service? +EM_RESOURCE Unable to read the WinPcap driver. + + +########################################################################### +# # +# String data of dialog boxes in software # +# # +########################################################################### + + +PREFIX D_SECURE +CAPTION Access to %s - %S +S_TITLE Access to %S +S_DEVICE_INFO Device Name: %S\r\nManufacturer: %S +IDS_STATIC1 Device Information +S_WARNING Take care entering the PIN code because if you have entered it incorrectly for a few times the device will be locked. +IDOK &OK +IDCANCEL Cancel +S_PIN_CODE &PIN Code: + + +PREFIX D_PKCSUTIL +CAPTION PKCS#12 Write Utility +S_TITLE ePass 1000 USB token PKCS#12 Write Utility +STATIC1 By using this utility, you can write a PKCS#12 file (certificate file) of your choice to an ePass 1000 USB hardware security token. \r\n\r\nThe USB token that the certificate file is written in can be used for SoftEther VPN authentication. +STATIC2 Write to PKCS#12 file +STATIC3 To write an existing PKC#12 file to a USB token, click Write. \r\nNOTE: If a PKCS#12 certificate for SoftEther VPN is already stored in the USB token, it will be overwritten. +B_WRITE &Write +STATIC4 Erase PKCS#12 certificate from USB token. +STATIC5 You can erase the certificate data from a USB token on which a PKCS#12 certificate for SoftEther VPN is already stored. +B_ERASE &Erase +IDCANCEL E&xit Utilities +S_COPYRIGHT Copyright (c) SoftEther VPN Project.\r\nAll Rights Reserved. + + +PREFIX D_PASSPHRASE +CAPTION Private Key Passphrase +STATIC1 The private key is protected by passphrase. \r\n\r\nEnter the passphrase to read the private key. +STATIC2 &Passphrase: +IDOK &OK +IDCANCEL Cancel + + +PREFIX D_NM_CONNECT +CAPTION Connect to SoftEther VPN User-mode Router +S_TITLE Connecting to "%S"... + + +PREFIX D_PASSWORD +CAPTION Login to %S +S_TITLE Enter your user name and password to log in to server %S. Make sure you select the correct auth type. +STATIC1 Enter Use&r Info: +STATIC2 Auth &Type: +STATIC3 User &Name: +STATIC4 &Password: +R_NO_SAVE_PASSWORD &Do not Save Password +S_COUNTDOWN An automatic reconnection will be made after %u seconds... +IDOK &OK +IDCANCEL Cancel Connection + + +PREFIX D_STATUS +CAPTION Connecting to "%s"... +S_STATUS Initializing... +IDCANCEL Cancel + + +PREFIX D_CERT +CAPTION Certificate +S_TITLE The following information is available for this certificate. +STATIC1 Basic Information of this Certificate: +STATIC2 Issued to: +STATIC3 Issuer: +STATIC4 Expires at: +STATIC5 Advanced Information of this Certificate: +STATIC6 Certificate of Authority Who Signed This Certificate: +S_PARENT The certificate of the certificate authority who signed this certificate is registered on the list of trusted certificates. +S_PARENT_BUTTON_STR &View Certificate +IDCANCEL &OK +B_SAVE &Save to File + + +PREFIX D_CHECKCERT +CAPTION Security Alert - %s +S_TITLE Although the connection to the destination VPN Server "%S" that you are currently connecting to is encrypted, the trustworthiness of the server certificate provided by the server is unknown. +STATIC1 About the Server Certificate +STATIC2 Establishing encrypted tunnel (SSL session) between VPN Server and VPN Client. Checking the server certificate enables to verify the authenticity of the server. +S_MSG1 The server certificate provided by destination VPN Server "%S" is as follows. +STATIC3 Issued to: +STATIC4 Issuer: +STATIC5 Expires at: +B_SHOW &Show Certificate +STATIC6 Digest (MD5): +STATIC7 Digest (SHA-1): +IDOK &Resume the Connection +IDCANCEL &Cancel Connection +STATIC8 There may be a problem with this certificate, such as it has not been issued by a trusted certificate authority (CA), or cert is expired. +STATIC9 Confirm the content of this certificate and decide whether or not to connect to this VPN Server. Click Cancel Connection to abort the connection. + + +PREFIX D_CONNECTERROR +CAPTION Connect Error - %s +S_TITLE An error occurred while connection to VPN Server "%S". +S_COUNTDOWN Automatically reconnects after %u seconds... +IDOK &Retry +IDCANCEL Cancel Connection +R_HIDE &Hide this window when connecting next time + + +PREFIX D_CM_LOGIN +CAPTION Enter Password - VPN Client Manager +S_TITLE You must enter a client administration password to operate the VPN Client that is operating on %s. Enter the client administration password. +STATIC1 &Password: +STATIC2 Enter the Client Administration Password: +IDOK &OK +IDCANCEL Cancel + + +PREFIX D_CONNECTION_STATUS +S_TITLE Status of VPN Session of %s (Real Time) +B_POLICY Security &Policy... +B_SERVER_CERT &Server Certificate +B_CLIENT_CERT &Client Certificate +IDCANCEL &Close + + +PREFIX D_CM_POLICY +CAPTION Security Policy List +S_TITLE Security policies defined for the current session %s +IDCANCEL &Close + + +PREFIX D_CM_ACCOUNT +STATIC1 Please configure the VPN Connection Setting for VPN Server. +S_ACCOUNT_NAME Setting &Name: +STATIC2 Destination VPN Server: +STATIC3 Specify the host name or IP address, and the port number and the Virtual Hub on the destination VPN Server. +STATIC4 &Host Name: +STATIC5 &Port Number: +STATIC6 (TCP Port) +STATIC7 &Virtual Hub Name: +STATIC8 Pro&xy Server as Relay: +STATIC9 You can connect to a VPN Server via a proxy server. +STATIC10 Proxy &Type: +R_DIRECT_TCP &Direct TCP/IP Connection (No Proxy) +R_HTTPS Connect via H&TTP Proxy Server +R_SOCKS Connect via &SOCKS4 Proxy Server +R_SOCKS5 Connect via &SOCKS5 Proxy Server +B_PROXY_CONFIG P&roxy Server Setting +STATIC11 Server Certificate Veri&fication Option: +R_CHECK_CERT Always Verify Server &Certificate +B_TRUST Manage Trusted CA &Certificate List +B_SERVER_CERT &Specify Individual Cert +B_VIEW_SERVER_CERT Show Indi&vidual Cert +S_VLAN_GROUP Virtua&l Network Adapter to Use: +S_POLICY_1 You can configure the security policy which will be applied to the Cascade Connection on this Virtual Hub's side. +B_POLICY Security Po&licy +STATIC12 User &Authentication Setting: +STATIC13 Auth &Type: +S_USERNAME &User Name: +S_PASSWORD Password: +S_CERT_INFO You must specify a client certificate to be used for user authentication. +STATIC14 Advanc&ed Setting of Communication: +R_RETRY Reconnects Automatically After Disconnected +S_RETRY_NUM_1 Reconnect &Count: +S_RETRY_NUM_2 times +S_RETRY_SPAN_1 Reconnect Interval: +S_RETRY_SPAN_2 seconds +R_INFINITE &Infinite Reconnects (Keep VPN Always Online) +B_DETAIL A&dvanced Settings... +IDOK &OK +IDCANCEL Cancel +B_CHANGE_PASSWORD Change &Password +S_CHANGE_PASSWORD You can change the user's password on the VPN Server. +R_HIDE Hide Status and Errors Screens +R_HIDE2 Hide IP Address Screens +STATIC15 Set the user authentication information that is required when connecting to the VPN Server. +B_REGIST_CLIENT_CERT Specify Client &Certificate +B_IE Import I&E Proxy Server Settings +R_DISABLE_NATT Disable NAT-T + + +PREFIX D_CM_PROXY +CAPTION Proxy Server Connection Setting +STATIC1 Enter the host name of the proxy server for relaying (HTTP proxy or SOCKS proxy), and the IP address, port, and when necessary, the user name and password. +STATIC2 &Host Name: +STATIC3 Port: +STATIC4 &User Name: +STATIC5 &Password: +B_HTTP_HEADER Custom HTTP header values +IDOK &OK +IDCANCEL Cancel +STATIC6 (optional) +STATIC7 (optional) + + +PREFIX D_CM_PROXY_HTTP_HEADER +CAPTION Custom Proxy HTTP Header Values +B_NEW New +B_DELETE Delete +B_CLEAR Clear +IDOK &OK +IDCANCEL Cancel + + +PREFIX D_CM_DETAIL +CAPTION Advanced Settings +STATIC1 Optional settings for system administrators and experts for networking, communication protocol, and security. Customize the VPN protocol communication settings. +STATIC2 Op&timization of VPN Communication: +STATIC3 Uses multiple physical TCP connection aggregation for a logical VPN connection to increase the communication throughput. +STATIC4 &Number of TCP Connections: +STATIC5 connections +STATIC6 Note: It is recommend that about 8 connections for broadband and 1 connection for slow line (e.g. dialup). +STATIC7 Advanced Settings: +STATIC8 Establi&shing Interval: +STATIC9 seconds +R_USE_DISCONNECT Set Connection Lifetime of E&ach TCP Connection +STATIC10 Lifetime: +STATIC11 seconds +STATIC12 When using two or more TCP connections, Half Duplex Mode is available. The half-duplex mode fixes the data direction as half and half for each TCP connection. For example when a VPN using 8 TCP connections is established, physical consists of the VPN tunnel will be fixed so that 4 TCP connections are dedicated to the upload direction and the other 4 connections are dedicated to the download direction. +R_USE_HALF_CONNECTION Use &Half-Duplex Mode +STATIC13 Encryption and &Compression: +STATIC14 Normally the VPN session is encrypted for secure. You can disable encryption to improve the throughput. Please note that the data flows in plain over the network when disabled. +R_USE_ENCRYPT &Encrypt VPN Session with SSL +STATIC15 You can use data compression to save VPN communication bandwidth. Enable this option when using a slow connectivity such as dial-up or mobile connection. +R_DISABLE_UDP Disable UD&P Acceleration +R_USE_COMPRESS &Use Data Compression +STATIC16 VPN Connection &Mode: +S_MODE You can specify the following connection modes. (Options for network administrators.) +R_BRIDGE &Bridge / Router Mode +R_MONITOR Monitoring Mo&de +STATIC17 Other Confi&gurations: +R_NO_ROUTING No Adjustments of &Routing Table +STATIC18 Keep the settings default in this dialog unless you are told to do so by a system administrator, or you have expertise for networking and security. +STATIC19 The VoIP / QoS functions handle high priority packets such as IP telephone packets (VoIP) to be transmitted faster. +R_DISABLE_QOS Disable VoIP / &QoS Functions +IDOK &OK +IDCANCEL Cancel +S_UDPACCEL You can use data compression to save VPN communication bandwidth. Enable this option when using a slow connectivity such as dial-up or mobile connection. + + +PREFIX D_CM_NEW_VLAN +CAPTION Create New Virtual Network Adapter +S_INFO A new Virtual Network Adapter will be created on the system.\r\nYou can specify a name for the Virtual Network Adapter, which can be a maximum of %u alphanumeric characters. +STATIC1 Virtual Network Adapter &Name: +IDOK &OK +IDCANCEL Cancel +S_WIN8 The name of a Virtual Network Adapter must be 'VPN' or 'VPN2' to 'VPN127'. (Maximum 127 adapters can be created.) + + +PREFIX D_CM_TRUST +CAPTION Manage Trusted CA Certificate List +STATIC1 Here you can manage the list of certificate authority (CA) certificates that are trusted.\r\n\r\nYou can use the CA certificate list registered here to verify server certificates when connecting to VPN Servers. +B_IMPORT &Add +B_EXPORT &Export +IDOK &View Certificate +IDCANCEL &Close +B_DELETE &Delete + + +PREFIX D_CM_PASSWORD +CAPTION Set Password - VPN Client Manager +S_TITLE You can set the password to limit the SoftEther VPN Client Service.\r\nAfter setting a password, you will be asked to enter a password the next time you use the VPN Client Connect Manager to connect to the SoftEther VPN Client service. +STATIC1 Set Client Administration Password: +R_USE_PASSWORD &Use Password +R_REMOTE_ONLY Only &Request Password for Remote Operation +IDC_STATIC1 &Password: +IDC_STATIC2 &Confirm: +IDOK &OK +IDCANCEL Cancel + + +PREFIX D_CM_CONFIG +CAPTION Optional Settings +STATIC1 You can modify the settings for VPN Client. +STATIC2 R&emote Management: +STATIC3 You can remotely manage the VPN Client Service Program from another computer by using VPN Client Manager Remote Mode. +R_ALLOW_REMOTE_CONFIG Allow &Remote Management of VPN Client Service +S_WARNING It is recommended to set a password if you allow remote management. From the menu bar, choose Tools -> Set Password to set the password. +STATIC4 For environments where Internet connections will automatically be disconnected when idle, you can keep alive the Internet connection by sending dummy packets to any host on the Internet. +R_USE_KEEP_CONNECT Use &Keep Alive Internet Connection Function +S_HOSTNAME &Host Name: +S_PORT &Port Number: +S_INTERVAL Packet Send &Interval: +S_INTERVAL2 seconds +S_PROTOCOL Pr&otocol: +R_TCP &TCP/IP Protocol +R_UDP &UDP/IP Protocol +S_INFO Packets sent to keep alive the Internet connection have random bits. No personal information is sent. +IDOK &OK +IDCANCEL Cancel +STATIC5 &Other Configurations: +R_ALPHA Transparency of UI: +STATIC6 Note: The transparency setting will be applied after the connection manager is restarted. +STATIC7 &Keep Alive Internet Connection Function: + + +PREFIX D_ABOUT +S_INFO1 SoftEther VPN %u.0 Developer Edition (Ver %u.%02u, Build %u) +S_INFO2 Licensed under the Apache License, Version 2.0.\r\nCopyright (c) 2012-%u all contributors on SoftEther VPN project in GitHub. All Rights Reserved.\r\nWeb Site: http://www.softether.org/\r\n%S +S_INFO3 This product includes the following software components:\r\nBitVisor: Copyright (c) 2007, 2008 University of Tsukuba. Copyright (C) 2007, 2008 National Institute of Information and Communications Technology. All rights reserved. / Microsoft(R) C Runtime Library: (c) 2007 Microsoft Corporation. All Rights Reserved. / PKCS #11 Cryptographic Token Interface (Cryptoki): Copyright (c) RSA Security Inc. / WinPcap: Copyright (c) 2001 - 2003 NetGroup, Politecnico di Torino (Italy). All rights reserved. / libedit: Copyright (c) 1992, 1993 The Regents of the University of California. All rights reserved. / libiconv: Copyright (C) 2007 Free Software Foundation, Inc. / ncurses: Copyright (c) 1998-2005, 2006 Free Software Foundation, Inc. / OpenSSL: Copyright (c) 1998-2011 The OpenSSL Project. All rights reserved. This product includes software developed by the OpenSSL Project for use in the OpenSSL Toolkit (http://www.openssl.org/). This product includes cryptographic software written by Eric Young (eay@cryptsoft.com). / zlib: (C) 1995-2004 Jean-loup Gailly and Mark Adler. / Special Thanks to: Software Laboratory, Academic Computing Communication Center, Industrial Liaison and Cooperative Research Center and Professor Yasushi Shinjo in University of Tsukuba, Japan. +S_INFO4 THIS SOFTWARE IS FREEWARE DEVELOPED UNDER THE SOFTETHER VPN PROJECT AT UNIVERSITY OF TSUKUBA, WITHOUT WARRANTY OF AND KIND. IN NO EVENT SHALL THE DEVELOPERS, COPYRIGHT OWNERS OR DISTRIBUTORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY IN ANY WAY OUT OF THE USE OF THIS SOFTWARE.\r\n\r\nSoftEther VPN is a work of the research and development project of Japanese Government, subsidized by Ministry of Economy, Trade and Industry of Japan, administrated by Information Promotion Agency. +IDCANCEL &OK +B_WEB Visit SoftEther VPN &Website... +B_EULA &End User License +B_IMPORTANT &Important Notices +B_LEGAL &Legal Notices +B_UPDATE_CONFIG &Configure Updates +B_AUTHORS List of &Authors + + +PREFIX D_REMOTE +STATIC1 &Specify the Host Name of the Destination Computer, or IP Address: +R_LOCAL Connect to &Local Computer (Computer Displaying this Window) +S_HOSTNAME &Computer Name: +IDOK &OK +IDCANCEL Cancel + + +PREFIX D_CM_DESKTOP +CAPTION Connection - %s +S_TITLE Starting connect process for VPN Connection Setting "%s". +S_WARNING VPN Client will output to the "Console Session" window of %s, the progress status and error messages related to the process of connecting to VPN Server +S_INFO Do you want to proceed with the connection? +IDOK &Continue +IDCANCEL Cancel + + +PREFIX D_CM_CHANGE_PASSWORD +CAPTION Change Password +S_TITLE You can change the password of the user registered on server %S. +STATIC1 Change &Password +STATIC2 Virtual &Hub Name: +STATIC3 &User Name: +STATIC4 &Old Password: +STATIC5 &New Password: +STATIC6 &Confirm of New Password: +IDOK &OK +IDCANCEL Cancel +S_STATIC Note: If authentication type is RADIUS or NT Domain Authentication, you cannot change the user's password here. + + +PREFIX D_SM_MAIN +CAPTION SoftEther VPN Server Manager Developer Edition +STATIC1 Connection &Settings for VPN Server: +STATIC2 Connection Settings for VPN Server or VPN Bridge are defined as follows. Double-click the item to connect to the server.\r\nTo add a new connection, click New Setting. +B_NEW_SETTING &New Setting +B_EDIT_SETTING &Edit Setting +B_DELETE &Delete Setting +IDOK &Connect +B_SECURE_MANAGER &Smart Card Manager... +B_SELECT_SECURE Select S&mart card... +B_ABOUT &About SoftEther VPN... +IDCANCEL E&xit SoftEther VPN Server Manager +B_CERT_TOOL Make a Certificate + + +PREFIX D_SM_EDIT_SETTING +STATIC1 Please configure the connection setting for the VPN Server or the VPN Bridge to manage. +STATIC2 Setting &Name: +STATIC3 Destination VPN Server: +STATIC4 Specify the host name or IP address, and the port number and the Virtual Hub on the destination VPN Server. +STATIC5 &Host Name: +R_LOCALHOST Connect to &Localhost +STATIC6 &Port Number: +STATIC7 (TCP Port) +STATIC8 Pro&xy Server as Relay: +STATIC9 You can connect to a VPN Server via a proxy server. +STATIC10 Proxy &Type: +R_DIRECT_TCP &Direct TCP/IP Connection (No Proxy) +R_HTTPS Connect via H&TTP Proxy Server +R_SOCKS Connect via S&OCKS4 Proxy Server +R_SOCKS5 Connect via S&OCKS5 Proxy Server +B_PROXY_CONFIG P&roxy Server Setting +STATIC11 Select Administration &Mode and Enter Password +STATIC12 You can connect to VPN Server using either Server Admin Mode or Virtual Hub Admin Mode.\r\n\r\nServer Admin Mode allows you manage entire VPN Server and all Virtual Hubs. \r\n\r\nVirtual Hub Admin Mode allows you manage only one Virtual Hub for which you hold privileges. +R_SERVER_ADMIN &Server Admin Mode +R_HUB_ADMIN Virtual H&UB Admin Mode +S_HUBNAME &Virtual Hub Name: +STATIC13 Please enter the password to connect administration mode. +S_PASSWORD &Password: +R_NO_SAVE Do not &Save Admin's Password +IDOK &OK +IDCANCEL Cancel + + +PREFIX D_SM_SERVER +CAPTION %s - SoftEther VPN Server Manager +S_TITLE Manage VPN Server "%S" +S_VHUB_BRIDGE Virtual Hubs Hosted by this VPN Server: +IDOK M&anage Virtual Hub +B_ONLINE &Online +B_OFFLINE O&ffline +B_HUB_STATUS View &Status +B_CREATE &Create a Virtual Hub +B_EDIT Prop&erties +B_DELETE &Delete +STATIC1 Management of &Listeners: +STATIC2 L&istener List (TCP/IP port): +B_CREATE_LISTENER C&reate +B_DELETE_LISTENER Dele&te +B_START Start +B_STOP Sto&p +S_UDP Multiple UDP ports can be specified by splitting them with a space or a comma. Leave empty to disable the UDP listener. +B_APPLY Apply +STATIC3 VPN Server and &Network Information and Settings: +B_SSL &Encryption and Network +B_STATUS &View Server Status +B_INFO About this VPN Server +B_LICENSE Add / Delete &Licenses +B_FARM Clustering Configuration +B_FARM_STATUS Clustering Status +B_CONNECTION Show List of\r\nTCP/IP Connections +B_BRIDGE Local &Bridge Setting +B_L3 Layer &3 Switch Setting +B_CONFIG E&dit Config +B_REFRESH Refres&h +IDCANCEL E&xit +S_BETA Beta Version (Pre-release) +B_IPSEC IPsec / L&2TP Setting +B_DDNS Dynamic DNS Setting +S_DDNS Current DDNS Hostname: +B_OPENVPN OpenVPN / MS-SSTP Setting +B_AZURE VPN Azure Setting +S_AZURE VPN Azure Hostname: +B_VPNGATE VPN Gate Setting + + +PREFIX D_SM_STATUS +IDOK Refres&h +IDCANCEL E&xit + + +PREFIX D_SM_EDIT_HUB +STATIC1 Virtual Hub &Name: +STATIC2 Security &Settings: +S_BOLD Administration password for this Virtual Hub. +STATIC3 &Password: +STATIC4 &Confirm: +R_NO_ENUM No En&umerate to Anonymous Users +STATIC5 V&irtual Hub Options: +R_LIMIT_MAX_SESSION &Limit Max VPN Sessions +S_MAX_SESSION_1 Ma&x Number of Sessions: +S_MAX_SESSION_2 sessions +STATIC6 (Will not count sessions on server side that are generated by Local Bridge, Virtual NAT or Cascade Connection.) +STATIC7 Virtual Hub Status: +STATIC8 Set the Virtual Hub status. +R_ONLINE Onlin&e +R_OFFLINE O&ffline +STATIC9 Set Clustering: +S_FARM_INFO Select the Virtual Hub type in the cluster. +R_STATIC St&atic Virtual Hub +R_DYNAMIC &Dynamic Virtual Hub +S_AO_1 Virtual Hub Admin Option: +S_AO_3 Display and edit the Virtual Hub administration options. +B_ADMINOPTION Virtual Hub Admin Option +S_ACL_3 Sou&rce IP Address Limit List +S_ACL Allow or deny VPN connections to this Virtual Hub according to the client computer's IP address. +B_ACL IP Access Con&trol List +IDOK &OK +IDCANCEL Cancel +STATIC10 You can configure more advanced settings on the Virtual Hub Extended Option List. +B_EXTOPTION Edit Virtual Hub Extended Option List +S_MSG_1 Show Message when Client Connects +S_MSG_2 Shows a message on the screen of a user when a VPN Client connects to this Virtual Hub. +B_MSG Set the Messa&ge + + +PREFIX D_SM_CREATE_LISTENER +CAPTION Create Listener +STATIC1 You can add a TCP/IP port number for the VPN Server to accept connections from clients. \r\n\r\nSpecify the port number to add. +STATIC2 If the port number is already being used by another server program, the status of the new listener will be error. \r\n\r\nIn this case, stop the other program that is opening the same port. +STATIC3 &Port Number: +IDOK &OK +IDCANCEL Cancel +STATIC4 (TCP/IP Port) + + +PREFIX D_SM_SSL +CAPTION Encryption and Network Settings +STATIC1 You can view or change settings related to encryption, communication and security for this VPN Server. +STATIC2 Encryption &Algorithm Settings: +STATIC3 Specify the encryption algorithm for SSL applied to the connection between this VPN Server and VPN Clients. The encryption algorithm must be compatible with SSL Version 3. +STATIC4 En&cryption Algorithm Name: +STATIC6 Server &Certificate Settings: +STATIC7 Specify the X509 certificate and private key to be presented to clients by this server. +B_IMPORT &Import +B_EXPORT E&xport +B_VIEW &View +B_REGENERATE New +STATIC8 &Keep Alive Internet Connection: +STATIC9 For environments where Internet connections will automatically be disconnected when idle, you can keep alive the Internet connection by sending dummy packets to any host on the Internet. +STATIC10 Server Certificate: +R_USE_KEEP_CONNECT Use &Keep Alive Internet Connection +S_HOSTNAME &Host Name: +S_PORT &Port: +S_INTERVAL Send &Interval: +S_INTERVAL2 seconds +S_PROTOCOL Pr&otocol: +R_TCP &TCP/IP Protocol +R_UDP &UDP/IP Protocol +S_INFO Packets sent to keep alive the Internet connection have random bits. No personal information is sent. +STATIC11 Administrator Pass&word: +S_INFO4 You can modify an administrator password of the administrator for all Virtual Hubs and this entire VPN Server. +B_PASSWORD Change Admin &Password +IDOK &OK +IDCANCEL Cancel +IDCANCEL2 Cancel +STATIC12 Syslog Send Function: +STATIC13 You can transfer the entire VPN Server / Bridge Logs, Virtual Hub Administration Logs, or Virtual Hub Packet Logs by using syslog protocol instead of writing to a local disk. +STATIC14 Syslog &Server Host Name: +STATIC15 P&ort: +S_OVER_FUNCS VPN over ICMP / DNS Server Function +S_INFO5 You can establish a VPN only with ICMP or DNS packets even if there is a firewall or routers which blocks TCP/IP communications. +B_SPECIALLISTENER VPN over ICMP / DNS Settings +B_UPDATE_CONFIG &Update Notify Setting... + + +PREFIX D_SM_SAVE_KEY_PAIR +CAPTION Save Certificate and Private Key +STATIC1 Select the method to save the certificate and private key. +STATIC2 Sa&ve Method: +R_X509_AND_KEY Save as &X509 Certificate (.CER) and Private Key File (.KEY) +R_PKCS12 Save as &PKCA#12 File (.P12) +R_SECURE Write to &Smart Card +STATIC3 Saving by splitting into two files: a standard Base 64-encoded certificate file and a private key file. +STATIC4 Saving as a PKCS#12 (Public Key Cryptography Standard #12) file. \r\nYou can store both certificate and private key in a single PKCS#12 file. +STATIC5 When a smart card is connected to this computer, you can write the certificate and private key to a smart card. +B_SELECT &Select Which Smart Card to Use... +S_PASS3 Private Key P&rotection: +S_PASS4 When saving the private key, you can set a passphrase to encrypt. You will be required to enter the passphrase when loading it. +R_USE_PASS Set P&assphrase +S_PASS1 Pa&ssphrase: +S_PASS2 Con&firm: +IDOK &OK +IDCANCEL Cancel +B_SECURE_MANAGER Smart Card &Manager... + + +PREFIX D_SM_CONNECTION +CAPTION Connection List +S_TITLE The server %S has the following active connections. Connections which have been established as a VPN session are not included. +IDOK Show Connection &Information +B_DISCONNECT &Disconnect +B_REFRESH Refres&h +IDCANCEL E&xit + + +PREFIX D_SM_FARM +CAPTION Clustering Configuration +S_TITLE You can change configuration for clustering function of VPN Server "%S". +STATIC1 Clustering can realize load balancing and fault balance protection to bundle multiple VPN Servers. +STATIC2 Current Mode: +STATIC3 Clustering Se&ttings: +R_STANDALONE &Standalone Server (No Clustering) +R_CONTROLLER &Cluster Controller +R_MEMBER Cluster &Member Server +STATIC4 C&onfigurable Parameters as a Member Server: +S_IP_1 Public &IP Address: +S_IP_2 (When a public IP address is omitted, the IP address of the network interface used when connecting to the cluster controller will be used.) +S_PORT_1 &Public Port List: +S_PORT_2 (Separate multiple port numbers by a space or a comma.) +S_CONTROLLER Controller &Host Name or IP Address: +S_CONTROLLER_PORT Port Number of\r\nControlle&r: +S_PORT_3 (TCP Port) +S_PASSWORD Administration &Password: +STATIC5 When you modify a clustering configuration, the VPN Server service restarts automatically. When this happens, all the currently connected sessions and administration-related connections will be disconnected. +IDOK &OK +IDCANCEL Cancel +S_1 Standard Ratio in Cluster: +S_2 (Standard: 100) +R_CONTROLLER_ONLY Controller Functions Only (No VPN session in itself) + + +PREFIX D_SM_FARM_MEMBER +CAPTION Cluster Member List +S_TITLE Currently the following Cluster Member Servers are connected to the Cluster Controller %S. +IDOK Cluster Member Server &Information +B_REFRESH Refres&h +IDCANCEL E&xit +B_CERT View Server &Certificate + + +PREFIX D_SM_CHANGE_PASSWORD +CAPTION Change Administrator Password of %S +S_TITLE Change the administrator password of the server %S. Enter the new password and click OK. +STATIC1 New &Password: +STATIC2 &Confirm Password: +IDOK &OK +IDCANCEL Cancel + + +PREFIX D_SM_HUB +CAPTION Management of Virtual Hub - '%S' +S_TITLE Virtual Hub '%S' +STATIC1 Management of Security &Database: +B_USER Manage &Users +S_USER Add, delete or edit user accounts. +B_GROUP Manage &Groups +S_GROUP Add, delete or edit groups. +B_ACCESS Manage &Access Lists +S_ACCESS Add or delete access lists (Packet filtering rules). +STATIC2 Virtual Hub Settings: +B_PROPERTY Virtual Hub &Properties +S_PROPERTY Configure this Hub. +B_RADIUS Auth&entication Server Setting +S_RADIUS Use external RADIUS authentication server for user authentication. +B_LINK Manage &Cascade Connections +S_LINK Establish Cascade Connection to Hubs on local or remote VPN Servers. +STATIC3 Cu&rrent Status of this Virtual Hub: +B_REFRESH Refres&h +STATIC4 &Other Settings: +B_LOG &Log Save Setting +B_LOG_FILE Log File List +S_LOG Configure settings of log saving function. +B_CA &Trusted CA Certificates +B_CRL Revo&ked Certs +S_CA Manage trusted CA certificates. +B_SNAT &Virtual NAT and Virtual DHCP Server (SecureNAT) +S_SNAT Secure NAT is available on this Virtual Hub. You can run Virtual NAT and Virtual DHCP. +STATIC5 VPN Sess&ions Management: +B_SESSION Manage &Sessions +IDCANCEL E&xit + + +PREFIX D_SM_USER +CAPTION Manage Users +S_TITLE Virtual Hub "%S" has the following users. +IDOK &Edit +B_CREATE &New +B_DELETE &Remove +B_REFRESH &Refresh +IDCANCEL E&xit +B_STATUS &View User Info + + +PREFIX D_SM_EDIT_USER +IDC_STATIC1 &User Name: +IDC_STATIC3 &Full Name: +IDC_STATIC4 &Note: +IDC_STATIC5 Group Name\r\n(Optional): +B_GROUP Browse Groups... +R_EXPIRES &Set the Expiration Date for This Account +IDC_STATIC6 &Auth Type: +S_RADIUS_3 RADIUS or NT Domain Authentication Settings: +S_RADIUS_1 Login attempts by password will be verified by the external RADIUS server, Windows NT domain controller, or Active Directory controller. +R_SET_RADIUS_USERNAME Specify User Name on Authentication Server +S_RADIUS_2 User Name on Authentication Server: +S_POLICY_1 Security Policy +R_POLICY Set Securit&y Policy +B_POLICY Security Policy +S_PASSWORD_1 Password Authentication Settings: +S_PASSWORD_2 &Password: +S_PASSWORD_3 &Confirm Password: +S_USER_CERT_1 Individual Certificate Authentication Settings: +B_LOAD_CERT Sp&ecify Certificate +B_VIEW_CERT &View Certificate +B_CREATE Create Certificate +S_ROOT_CERT_1 Signed Certificate Authentication Settings: +S_ROOT_CERT_2 Verification of whether the client certificate is signed is based on a certificate of a CA trusted by this Virtual Hub. +R_CN Limit Common Name (CN) Value +R_SERIAL &Limit Values of the Certificate Serial Number +S_ROOT_CERT_3 Note: Enter hexadecimal values. (Example: 0155ABCDEF) +S_HINT Hint: Define a user object with username '*' (asterisk) in order to accept a login attempt of a user which does not match any of registered explicit user objects. Such a special user will use the external user-authentication server to verify the login. +IDOK &OK +IDCANCEL Cancel + + +PREFIX D_SM_POLICY +STATIC1 Selected &Policy: +S_BOLD Des&cription of the policy: +S_BOLD2 Current &Value: +R_ENABLE &Enable the Policy +R_DISABLE &Disable the Policy +R_DEFINE De&fine the Policy +IDOK &OK +IDCANCEL Cancel + + +PREFIX D_SM_GROUP +CAPTION Manage Groups +S_TITLE Virtual Hub "%S" has the following groups. +B_CREATE &New +IDOK &Edit +B_DELETE &Remove +B_REFRESH &Refresh +B_USER &Member List +IDCANCEL E&xit + + +PREFIX D_SM_EDIT_GROUP +IDC_STATIC1 &Group Name: +IDC_STATIC3 &Full Name: +IDC_STATIC4 &Note: +S_POLICY_1 Security Policy: +R_POLICY Set this group's Securit&y Policy +B_POLICY Security Policy +S_POLICY_2 Statistical Information of the Group: +IDOK &OK +IDCANCEL Cancel + + +PREFIX D_SM_ACCESS_LIST +CAPTION Access Lists +S_TITLE The Virtual Hub "%S" has the following access lists (packet filtering rules). +B_ADD &New (IPv&4) +B_ADD_V6 &New (IPv&6) +IDOK &Edit +B_DELETE &Delete +B_SAVE &Save +IDCANCEL &Cancel +STATIC1 Items with higher priority appear higher in the list. +STATIC2 Note: IP packets that did not match any access list items can pass. +B_CLONE Cl&one +B_ENABLE E&nable +B_DISABLE D&isable + + +PREFIX D_SM_EDIT_ACCESS +CAPTION Edit Access List Item +STATIC1 Configure the access list settings. The access list that is defined here will be applied to all IP packets passing through the Virtual Hub. +STATIC2 Basic Settings +STATIC3 &Memo: +STATIC4 &Action: +R_PASS &Pass +R_DISCARD &Discard +STATIC5 P&riority: +STATIC6 (Smaller number has higher priority.) +STATIC7 Filtering Options for IP Headers +S_ACCESS_SRC_ALL Source IP Address: +R_SRC_ALL Applies to All Source Addresses +S_SRC_IP_1 IPv4 Address: +S_SRC_IP_2 Subnet Mask: +S_SRC_IP_3 (255.255.255.255 means a single host) +S_SRC_IP_1_V6 IPv6 Address: +S_SRC_IP_3_V6 (For example: "ffff:ff00::" or "/24". "/128" means a single host.) +S_ACCESS_DST_ALL Destination IP Address: +R_DST_ALL Applies to All Destination Addresses +S_IP_DST_1 IPv4 Address: +S_IP_DST_2 Subnet Mask: +S_IP_DST_3 (255.255.255.255 means Specified host only) +S_IP_DST_1_V6 IPv6 Address: +S_IP_DST_3_V6 (For example: "ffff:ff00::" or "/24". "/128" means a single host.) +STATIC9 Protocol Type: +STATIC10 Filtering Options for TCP Headers and UDP Headers +S_TCP_1 Minimum +S_TCP_2 Maximum +S_TCP_3 Source Port: +S_TCP_5 Destination Port: +S_TCP_7 The blank port number field matches any ports.\r\nIt will apply to packets that match only the minimum value when the minimum value is specified but the maximum value is not. +STATIC11 Filtering Options for Users or Groups +STATIC11_OLD Filtering Options for Users +STATIC12 This access list will be applied only to the packets that for specific users, groups send or receive. +STATIC12_OLD This access list will be applied only to packets that for specific users send or receive. +STATIC13 Source Name: +B_USER1 Browse... +STATIC14 Destination Name: +B_USER2 Browse... +STATIC15 Leave these fields blank if you don't specify user name nor group name. +STATIC15_OLD Leave these fields blank if you don't specify user name. +IDOK &OK +IDCANCEL Cancel +S_PROTOID Specify IP Protocol: +STATIC16 Filtering Options for MAC Headers +S_CHECK_SRC_MAC Source MAC Address: +R_CHECK_SRC_MAC Applies to any Source Addresses +S_SRC_MAC MAC Address: +S_SRC_MAC_MASK Mask: +S_CHECK_DST_MAC Destination MAC Address: +R_CHECK_DST_MAC Applies to any Destination Addresses +B_SIMULATION De&lay and Packet Loss... +S_DST_MAC MAC Address: +S_DST_MAC_MASK Mask: +S_MAC_NOTE You can use hexadecimal number with two separators, "-" or ":", and without the separators.\r\n(FF-FF-FF-FF-FF-FF means a specified host) +R_CHECK_TCP_STATE Verify TCP Connection State (Only TCP Packets) +R_ESTABLISHED Established Packet +R_UNESTABLISHED Unestablished Packet +R_REDIRECT Redirect HTTP Request to Specific URL +B_REDIRECT Set URL Redirect to... + +PREFIX D_SM_RADIUS +CAPTION Authentication Server Settings +S_TITLE To use an external RADIUS server to verify login attempts to the Virtual Hub "%S", specify an external RADIUS server that verifies the user name and password. +STATIC1 RADIUS Server Settings: +R_USE_RADIUS &Use RADIUS Authentication +S_RADIUS_1 RADIUS &Server Host Name or IP: +S_RADIUS_2 &Port: +S_RADIUS3 (UDP Port) +S_RADIUS_4 Shared S&ecret: +S_RADIUS_5 &Confirm Shared Secret: +S_RADIUS_6 The RADIUS server must accept requests from IP addresses of this VPN Server. Also, authentication by Password Authentication Protocol (PAP) must be enabled. +S_RADIUS_7 milliseconds (above %u, below %u) +S_RADIUS_8 &Retry Interval +S_RADIUS_9 (use ',' or ';' to split multiple hostnames.) +STATIC2 When using Windows NT Domain Controller or Windows Server Active Directory Controller as an external authentication server, you must setup the VPN Server computer to join the domain. To use NT Domain Authentication, there are no items to configure here. +IDOK &OK +IDCANCEL Cancel + + +PREFIX D_SM_LINK +CAPTION Cascade Connections on %S +STATIC1 Cascade Connection can make a layer-2 Ethernet-level links between this Virtual Hub and other Virtual Hub which is located on either local or remote VPN Server. +STATIC2 Before Using Cascade Connection +STATIC3 Cascade Connection realizes a Layer 2 Bridge between multiple Virtual Hubs. But if the connection is incorrectly configured, an infinity loop could inadvertently be created. When using a Cascade Connection function please design the network topology with care. +B_CREATE &New +B_EDIT &Edit +B_ONLINE O&nline +B_OFFLINE O&ffline +IDOK &Status +B_DELETE &Delete +B_RENAME Ren&ame +B_REFRESH &Refresh +IDCANCEL E&xit + + +PREFIX D_SM_LOG +CAPTION Log Save Settings +S_TITLE You can save the security logs (such as history of user logins) of Virtual Hub "%S", and the packet logs of all packets that pass through the Virtual Hub. +STATIC1 &Security Log: +B_SEC Save S&ecurity Log +S_SEC Log File S&witch Cycle: +STATIC2 &Packet Log: +B_PACKET Save Pack&et Log +S_PACKET Log File S&witch Cycle: +S_PACKET_0 TCP Connection: +B_PACKET_0_0 Do not Save +B_PACKET_0_1 Header Only +B_PACKET_0_2 Headers && Payloads +S_PACKET_1 TCP Packet: +B_PACKET_1_0 Do not Save +B_PACKET_1_1 Header Only +B_PACKET_1_2 Headers && Payloads +S_PACKET_2 DHCP Packet: +B_PACKET_2_0 Do not Save +B_PACKET_2_1 Header Only +B_PACKET_2_2 Headers && Payloads +S_PACKET_3 UDP Packet: +B_PACKET_3_0 Do not Save +B_PACKET_3_1 Header Only +B_PACKET_3_2 Headers && Payloads +S_PACKET_4 ICMP Packet: +B_PACKET_4_0 Do not Save +B_PACKET_4_1 Header Only +B_PACKET_4_2 Headers && Payloads +S_PACKET_5 IP Packet: +B_PACKET_5_0 Do not Save +B_PACKET_5_1 Header Only +B_PACKET_5_2 Headers && Payloads +S_PACKET_6 ARP Packet: +B_PACKET_6_0 Do not Save +B_PACKET_6_1 Header Only +B_PACKET_6_2 Headers && Payloads +S_PACKET_7 Ethernet\r\nPacket: +B_PACKET_7_0 Do not Save +B_PACKET_7_1 Header Only +B_PACKET_7_2 Headers && Payloads +IDOK &OK +IDCANCEL Cancel +STATIC3 Saving large amounts of packet logs can place a large burden on the CPU and the hard disk and it can cause lower performance of Hub and entire VPN Server. Enable logging on only the necessary packet log to save. + + +PREFIX D_SM_CA +CAPTION Manage Trusted CA Certificates +STATIC1 You can manage the list of certificate authority (CA) certificates that are trusted by this Virtual Hub.\r\n\r\nThe list of CA certificates that is listed here is used to verify certificates when a VPN Client is connected in signed certificate authentication mode. +B_IMPORT &Add +IDOK &View Certificate +IDCANCEL &Close +B_DELETE &Delete + + +PREFIX D_SM_SESSION +CAPTION Manage Sessions - %S +S_TITLE Virtual Hub "%S" has the following VPN sessions currently. +STATIC1 Operations for Sessions +IDOK Session &Information +B_DISCONNECT &Disconnect +B_REFRESH Refres&h +B_SESSION_MAC_TABLE &MAC Table of Selected Session +B_SESSION_IP_TABLE I&P Table of Selected Session +STATIC2 &Other Administration Tasks +B_MAC_TABLE MAC &Address Table List +B_IP_TABLE IP Address Ta&ble List +IDCANCEL E&xit +S_FARM_INFO_2 The sessions displayed here are all sessions on the current cluster. To manage sessions on other cluster member servers you must connect as an administrator to those servers. + + +PREFIX D_SM_MAC +CAPTION MAC Address Table +S_TITLE The MAC address table database on the Virtual Hub "%S" has the following entries. +B_DELETE &Delete Selected Entry +B_REFRESH Refres&h +IDCANCEL E&xit + + +PREFIX D_SM_IP +CAPTION IP Address Table +S_TITLE The IP address table database on the Virtual Hub "%S" has the following entries. +B_DELETE &Delete Selected Entry +B_REFRESH Refres&h +IDCANCEL E&xit + + +PREFIX D_SM_CREATE_CERT +CAPTION Create New Certificate +STATIC1 You can easily create certificates which is signed by self or other certificates. +STATIC2 Certificate &Type: +R_ROOT_CERT &Root Certificate (Self-Signed Certificate) +R_SIGNED_CERT Certificate &Signed by Other Certificate +S_LOAD_1 &Certificate and Private Key for Signing: +B_LOAD &Load Certificate and Private Key +S_LOAD_2 Click 'Load Certificate and Private Key' to specify the X509 Certificate and RSA Private Key that will user a new certificate signature. +S_LOAD_3 Common Name (CN): +S_LOAD_4 Organization (O): +S_LOAD_5 Organization Unit (OU): +S_LOAD_6 Country (C): +S_LOAD_7 State (ST): +S_LOAD_8 Locale (L): +S_LOAD_11 &Serial Number:\r\n(Hexadecimal) +S_LOAD_9 &Expires in: +S_LOAD_10 Days +STATIC3 To manage certificates and certificate authorities on a large scale, you should use either free software such as OpenSSL, or commercial CA (certificate authority) software. +IDOK &OK +IDCANCEL Cancel +S_LOAD_12 Strength&ness: + + +PREFIX D_NM_LOGIN +CAPTION deleted +S_TITLE deleted +STATIC1 deleted +STATIC2 deleted +IDOK deleted +IDCANCEL deleted + + +PREFIX D_SPEEDMETER +CAPTION Network Device Status +STATIC1 Select Network Adapter: +STATIC2 Real-time Status +STATIC3 &Refresh + + +PREFIX D_NM_MAIN +CAPTION deleted +STATIC1 deleted +STATIC2 deleted +B_SETTING Connection &Setting for VPN Server +B_CONNECT &Connect +B_DISCONNECT &Disconnect +STATIC3 Operation Settings of User-mode Router +STATIC4 You can set the operations in a virtual network of a SoftEther VPN User-mode Router. +B_OPTION &Operation Settings of User-mode Router +STATIC5 Operating Status of User-mode Router +STATIC6 Displays the current operating status of the SoftEther VPN User-mode Router. +B_NAT Virtual &NAT Status +B_DHCP Virtual D&HCP Server Status +B_STATUS User-mode &Router Status +B_INFO User-mode Router &Information +B_PASSWORD Administration &Password Setting +B_REFRESH Refr&esh +B_ABOUT &About... +IDCANCEL E&xit + + +PREFIX D_NM_OPTION +CAPTION SecureNAT Configuration +S_TITLE Set how SecureNAT virtual host performs operation on the virtual network of Virtual Hub "%S". +STATIC1 Virtual Host's Network Interface Settings: +STATIC2 &MAC Address: +STATIC3 I&P Address: +STATIC4 &Subnet Mask: +STATIC5 Virtual NAT Settings: +R_USE_NAT Use Virtual N&AT Function +STATIC6 M&TU Value: +STATIC7 bytes +STATIC8 T&CP Session Timeout: +STATIC9 seconds +STATIC10 &UDP Session Timeout: +STATIC11 seconds +R_SAVE_LOG Save NAT or DHCP Server Operations to &Log File +STATIC12 Virtual DHCP Server Settings: +R_USE_DHCP Use Virtual DHCP Server Fu&nctions +STATIC13 &Distributes IP Address: +STATIC14 to +STATIC15 . +STATIC16 Su&bnet Mask: +STATIC17 L&ease Limit: +STATIC18 seconds +STATIC19 Options Applied to Clients (optional): +STATIC20 De&fault Gateway\r\nAddress: +STATIC21 DNS &Server Address 1: +STATIC22 Domain Name: +STATIC23 DNS &Server Address 2: +IDOK &OK +IDCANCEL Cancel +S_1 Static routing table pushing function (for split tunneling) +S_2 Push the static routing table to VPN clients. +B_PUSH Edit the static routing table to push + + +PREFIX D_NM_NAT +CAPTION NAT Session Table on Virtual NAT Router +S_TITLE There are the following TCP or UDP NAT table entries on the virtual NAT router of SecureNAT. +B_REFRESH Refres&h +IDCANCEL E&xit + + +PREFIX D_NM_DHCP +CAPTION IP Lease Table on Virtual DHCP Server +S_TITLE The SecureNAT Virtual DHCP Server has allocated the following IP addresses to clients. +B_REFRESH Refres&h +IDCANCEL E&xit + + +PREFIX D_NM_CHANGE_PASSWORD +CAPTION Change Administrator Password of %S +S_TITLE You can change the administrator password of SoftEther VPN User-mode Router (%S). Click OK after entering the new password. +STATIC1 New &Password: +STATIC2 &Confirm Your Input: +IDOK &OK +IDCANCEL Cancel + + +PREFIX D_SM_SNAT +CAPTION Virtual NAT and Virtual DHCP Function (SecureNAT) Setting +S_TITLE SecureNAT enables you to operate a virtual NAT router (IP Masquerade) and DHCP Server function on a virtual network of Virtual Hub "%S". +STATIC1 Warning about SecureNAT +S_WARNING The SecureNAT function is recommended only for system administrators or people with a detailed knowledge of networking. +S_WARNING2 If you use the SecureNAT correctly, it is possible to realize a safety remote access via a VPN. However when you use this as incorrectly, it can put the entire network in danger. Anyone who does not have a thorough knowledge of networks and anyone who does not have the network administrator's permission must not enable the SecureNAT. For a detailed explanation of the SecureNAT function, please refer to the VPN Server's manual or online documentation. +STATIC2 Enabling / Disabling and Changing the Setting of the SecureNAT +STATIC3 You can enable, disable or change the settings of the SecureNAT on this Virtual Hub. +B_ENABLE &Enable SecureNAT +B_DISABLE &Disable SecureNAT +B_CONFIG SecureNAT &Configuration +STATIC4 Note: When a running SecureNAT is disabled, all active TCP and UDP sessions that are connected via SecureNAT will be terminated. +STATIC5 View Current SecureNAT Status +STATIC6 You can view the current SecureNAT operating status. +B_NAT Virtual &NAT Router Status +B_DHCP Virtual D&HCP Server Status +B_STATUS View &SecureNAT Operating Status +S_TSUKUBA2 SecureNAT uses technology that Daiyuu Nobori developed in 2004 at "Special Seminar on Information I" at the College of Information Science of the Third Cluster of Colleges, Tsukuba University. +IDCANCEL E&xit + + +PREFIX D_SM_BRIDGE +CAPTION Local Bridge Settings +STATIC1 Local Bridge can establish a Layer 2 bridge connection between a Virtual Hub on this VPN server and a physical Ethernet Device (Network Adapter). \r\nIt is also possible to create a tap device (virtual network interface) and establish a bridge connection with a Virtual Hub. (Tap is supported on Linux versions only) +B_DELETE &Delete Local Bridge +STATIC2 New &New Local Bridge Definition: +STATIC3 Select the Virtual Hub to bridge. +STATIC4 Virtual &Hub: +STATIC5 &Type to Create: +R_BRIDGE Bridge with &Physical Existing Network Adapter +R_TAP Bridge with New &Tap Device +S_ETH_1 LAN Adapter: +S_TAP_1 New Tap &Device Name: +S_TAP_2 (Maximum 11 Characters) +STATIC6 Note: Although it is possible to establish a bridge using any operating network adapter, in high load environments, you should prepare a network adapter dedicated for bridging. +IDOK Cre&ate Local Bridge +STATIC7 If a network adapter doesn't appear which is recently added on the system, reboot the computer and re-open this screen. +IDCANCEL E&xit +B_VLAN VLAN Transparency Setting Tool + + +PREFIX D_WIN9X_REBOOT +CAPTION VPN Client - Install Virtual Network Adapter +STATIC1 The VPN Client Virtual Network Adapter has been installed. \r\nIt is necessary to shutdown Windows now and restart the computer. \r\n\r\nThe computer will restart automatically. If the computer does not restart, please restart the computer manually. + + +PREFIX D_EM_MAIN +CAPTION SoftEther EtherLogger Manager +STATIC1 SoftEther EtherLogger is a service that captures data flowing through LAN cards connected to the computer and keeps a log of the headers of the packet types specified by the administrator and all data in text file format. \r\n\r\nCurrently, the following capture devices are performing capture logging. +B_PASSWORD Administration &Password +B_LICENSE &License +B_ADD &Add +IDOK &Edit +B_DELETE &Delete +IDCANCEL E&xit + + +PREFIX D_EM_ADD +STATIC1 Name of Network Adapter Used for Capture: +R_PROMISCUOUS Do&n't Use Promiscuous Mode During Capture +STATIC2 &Packet Log: +S_PACKET Log File S&witch Cycle: +S_PACKET_0 TCP Connection Log: +B_PACKET_0_0 Save Nothing +B_PACKET_0_1 Header Information Only +B_PACKET_0_2 Whole Packet Contents +S_PACKET_1 TCP Packet Log: +B_PACKET_1_0 Save Nothing +B_PACKET_1_1 Header Information Only +B_PACKET_1_2 Whole Packet Contents +S_PACKET_2 DHCP Packet Log: +B_PACKET_2_0 Save Nothing +B_PACKET_2_1 Header Information Only +B_PACKET_2_2 Whole Packet Contents +S_PACKET_3 UDP Packet Log: +B_PACKET_3_0 Save Nothing +B_PACKET_3_1 Header Information Only +B_PACKET_3_2 Whole Packet Contents +S_PACKET_4 ICMP Packet Log: +B_PACKET_4_0 Save Nothing +B_PACKET_4_1 Header Information Only +B_PACKET_4_2 Whole Packet Contents +S_PACKET_5 IP Packet Log: +B_PACKET_5_0 Save Nothing +B_PACKET_5_1 Header Information Only +B_PACKET_5_2 Whole Packet Contents +S_PACKET_6 ARP Packet Log: +B_PACKET_6_0 Save Nothing +B_PACKET_6_1 Header Information Only +B_PACKET_6_2 Whole Packet Contents +S_PACKET_7 Ethernet\r\nPacket Log: +B_PACKET_7_0 Save Nothing +B_PACKET_7_1 Header Information Only +B_PACKET_7_2 Whole Packet Contents +IDOK &OK +IDCANCEL Cancel +STATIC3 Saving large volume packet logs can place a large burden on the CPU and the hard disk and it can cause lower performance of the entire system. Please configure settings so that only the necessary packet log information is saved. + + +PREFIX D_EM_PASSWORD +CAPTION Change Administrator Password +S_TITLE You can change the administrator password. Click OK after entering the new password. +STATIC1 New &Password: +STATIC2 &Confirm: +IDOK &OK +IDCANCEL Cancel + + +PREFIX D_EM_LICENSE +CAPTION Add or Delete License +STATIC1 To use SoftEther EtherLogger you must acquire a valid license and register the license key. Using this window, you can register a new license key, delete a registered license key and display the current license list and the license mode of the SoftEther EtherLogger. +S_BOLD &List of Currently Registered Licenses: +B_OBTAIN &Obtain License +STATIC2 Click Obtain License to display the website that will provide instructions on how to obtain a license. +B_ADD &Add License Key Registration +B_DEL &Delete +IDOK &Information About License +STATIC3 Select a license and click Information About License to connect to SoftEther VPN Project's website (softether.com) and view the registered information relating to the selected license. +S_BOLD2 Current License &Mode of SoftEther EtherLogger: +IDCANCEL E&xit + + +PREFIX D_EM_LICENSE_ADD +CAPTION Add License Key Registration +S_INFO You can register a license key of a SoftEther EtherLogger product license. +STATIC1 The license keys are 36 alphanumeric characters in length plus hyphens. They are key codes that certify the ownership of a license. \r\n\r\nWhen a license certificate is received together with this software, the license key is printed on this license certificate. If the license for this software has been purchased online, the license key is provided by email and on the website window at the time the license is purchased. The license key may also be written down by some other method. If you don't know where the license key is written down, ask the vendor who sold you the license. +STATIC2 &Input the License Key Correctly: +STATIC3 Enter the license key by separating the input into 6-digit groups. You don't need to input the hyphens. It is also possible to copy && paste the license key. +B_INFO2 This software has world-wide copyright protection. Customers can only make copies and use this software in accordance with the license conditions. Warning: Use of illegitimately obtained license keys, use of a single license on multiple servers, or unauthorized distribution of licenses is a breach of the license agreement and such action may result in civil or legal proceedings. +IDOK &Register +IDCANCEL Cancel + +PREFIX D_EM_REMOTE +STATIC1 &Specify the Host Name of the Destination Computer, or IP Address: +R_LOCAL Connect to &Local Computer (Computer Displaying this Window) +S_HOSTNAME &Computer Name: +IDOK &OK +IDCANCEL Cancel +B_ABOUT Version information + +PREFIX D_SM_CONFIG +CAPTION Edit Config File +IDC_INFO The current configuration of the VPN Server "%S" is as follows.\r\nYou can edit the contents of this configuration file and apply it to the VPN Server. +B_EXPORT &Save to File +B_IMPORT &Import File and Apply +IDCANCEL &Close +STATIC1 You can edit the configuration file by using any text editors. When applying the edited configuration file to the VPN Server, the VPN Server will automatically restart and launch according to the new configuration file. If an invalid configuration file is applied, errors will occur and the current setting contents will get lost, so be careful when editing the configuration file. +B_FACTORY &Restore to Factory Default + + +PREFIX D_SM_ADMIN_OPTION +CAPTION Virtual Hub Administration Option +S_INFO Currently the following administration options are set for the Virtual Hub "%S". +B_ADD &Add Value +B_EDIT &Edit Value +B_DELETE &Delete Value +STATIC1 The purpose of the Virtual Hub administration options is to set limitations to administrators who are in Virtual Hub Admin Mode. +IDOK &Save +IDCANCEL Cancel +STATIC2 Only an administrator for this entire VPN Server may edit the Virtual Hub administration options. The individual Virtual Hub administrators are unable to change the administration options, however they are able to view them.\r\nHowever, if allow_hub_admin_change_option is set to "1", then Virtual Hub administrators are able to edit the administration options. +S_BOLD Description: + + +PREFIX D_SM_MSG +CAPTION Set the Message +S_MSG_2 You can set a message to display on the screen of a user when a VPN Client connects to the Virtual Hub "%S". To show a message, input the message that you want to show. +C_USEMSG Show &Message +STATIC1 About the Message Display Function +S_INFO The VPN Client must be Version 3.0 or later.\r\n\r\nSpecify a single line starts with "http://" as the message to open the default Web browser on the client instead to showing a message. +IDOK &OK +IDCANCEL Cancel + + +PREFIX D_NICINFO +CAPTION Virtual Network Adapter "%S" Status +IDCANCEL &Close + + +PREFIX D_SM_VLAN +CAPTION VLAN Transparency Setting Tool +STATIC1 Some network adapters are unable to transmit tagged-VLAN packets (IEEE802.1Q) transparency. by default\r\n\r\nIf you use such a network adapter to bridge to the Virtual Hub and need to exchange Ethernet packets with VLAN tags, you have to configure the network adapter to enable processing packets for VLAN transparency. +B_ENABLE Configure the Selected Network Adapters to VLAN Transparency +B_DISABLE &Unset the Configuration +STATIC2 About the VLAN Transparency Setting Tool +S_WARNING This tool can enable or disable the transparency for tagged VLAN packets on Intel, Broadcom or Marvell's network adapters. (Only using the vendor provided drivers for Windows.) +S_WARNING2 The above network adapters in the list means supported by this tool. No other network adapters can be configured by this tool. However, other network adapters which is not on the list might be able to support tagged VLAN packets by default or by using some configuration.\r\n\r\nSuch network adapters must be configured by the system administrator with logged on Windows. +IDCANCEL E&xit + + +PREFIX D_SM_SIMULATION +CAPTION Delay and Packet Loss Generating Function +STATIC1 This function can generate delays, jitters and packet losses on packets which match the condition of this access list entry when transmitted via this Virtual Hub.\r\n\r\nThis function is convenient to simulate a low-quality and slow Internet, WAN or wireless connections on the desk or laboratory. For example, you can use it to evaluate and test IP telephonies (VoIP). +STATIC2 Generate Delays, Jitters and Packet Losses as follow: +C_DELAY Generate &Delays +S_DELAY The Period of Delay (0 - 10000) : +S_DELAY2 milliseconds +C_JITTER Generate &Jitters (Fluctuation) +S_JITTER The Ratio of Jitter (0 - 100) : +S_JITTER2 Percent (%) +C_LOSS Generate Packet &Losses +S_LOSS The Ratio of Packet Losses (0 - 100) : +S_LOSS2 Percent (%) +IDOK &OK +IDCANCEL Cancel + + +PREFIX D_SM_AO_VALUE +CAPTION Name and Value +STATIC1 &Name: +STATIC2 &Value: +STATIC3 (Integer) +IDOK &OK +IDCANCEL Cancel + + +PREFIX D_SM_L3 +CAPTION Virtual Layer 3 Switch Setting +STATIC1 You can define Virtual Layer 3 Switches between two or more Virtual Hubs operating on this VPN Server to achieve routing between different IP networks. +STATIC2 The Virtual Layer 3 Switch functions are provided for network administrators or people who know a lot about networking and IP routing. If you are using the regular VPN functions, you do not need to use the Virtual Layer 3 Switch functions.\r\n\r\nIf the Virtual Layer 3 Switch functions are to be used, the person who configures them must have sufficient knowledge of IP routing. +STATIC3 Cautions about Virtual Layer 3 Switch Function +S_BOLD Defined Virtual &Layer 3 &Switches: +B_ADD &New +B_START &Start +B_STOP S&top +IDOK &Edit +B_DELETE &Delete +IDCANCEL &Close + + +PREFIX D_SM_L3_ADD +CAPTION New Virtual Layer 3 Switch +STATIC1 To create a new Virtual Layer 3 Switch, enter a name for the switch. \r\n\r\nThe Virtual Layer 3 Switch cannot have the duplicated name as another Virtual Layer 3 Switch on this VPN Server. +STATIC2 &Name: +IDOK &OK +IDCANCEL Cancel + + +PREFIX D_SM_L3_SW +CAPTION Edit Virtual Layer 3 Switch "%S" +STATIC1 You can define multiple virtual interfaces and routing tables on a Virtual Layer 3 Switch. +STATIC2 A virtual interface is associated to a Virtual Hub and operates as a single IP host on the Virtual Hub when the Virtual Hub is running. When multiple virtual interfaces that respectively belong to a different IP network of a different Virtual Hub are defined, IP routing will be automatically performed between these interfaces. \r\nIt is possible to manually set the routing table and more detailed settings. +S_BOLD1 Virtual &Interfaces: +B_ADD_IF &New Virtual Interface +B_DEL_IF D&elete Virtual Interface +S_BOLD2 Routing &Table: +B_ADD_TABLE A&dd Routing Table Entry +B_DEL_TABLE De&lete Routing Table Entry +B_START &Start +B_STOP S&top +IDCANCEL &Close + + +PREFIX D_SM_L3_SW_IF +CAPTION Add Virtual Interface +STATIC1 Adds a new virtual interface to the Virtual Layer 3 Switch. \r\n\r\nYou must define the IP network that the virtual interface belongs to and the IP address of the interface itself. \r\nPlease select or enter the name of the virtual Hub that the interface will attach to. +STATIC2 Virtual Hub to &Attach +STATIC3 Select or enter the name of the Virtual Hub that this interface will attach to. +STATIC4 Virtual &Hub: +STATIC5 IP A&ddress and Subnet Mask of Virtual Interface: +STATIC6 The virtual interface must have one IP address in the Virtual Hub. You also must specify the subnet mask of an IP network that the IP address belongs to. \r\n\r\nRouting via the Virtual Layer 3 Switches attaching to multiple virtual Hubs operates based on the IP address is specified here. +S_SRC_IP_1 &IP address: +S_SRC_IP_2 &Subnet Mask: +IDOK &OK +IDCANCEL Cancel + + +PREFIX D_SM_L3_SW_TABLE +CAPTION New Routing Table Entry +STATIC1 Adds a new routing table entry to the routing table of the Virtual Layer 3 Switch. \r\n\r\nIf the destination IP address of the IP packet does not belong to any IP network that belongs to a virtual interface, the IP routing engine of the Virtual Layer 3 Switch will reference the routing table and execute the routing. +STATIC2 Definitions of Routing Table &Entry: +STATIC3 The virtual interface must have one IP address in the Virtual Hub. You also must specify the subnet mask of an IP network that the IP address belongs to. \r\n\r\nRouting via the Virtual Layer 3 Switches of IP spaces of multiple virtual Hubs operates based on the IP address is specified here. +S_SRC_IP_1 &Network Address: +S_SRC_IP_2 &Subnet Mask: +S_SRC_IP_3 &Gateway Address: +S_SRC_IP_4 &Metric Value: +STATIC4 Note: To specify the default gateway, specify '0.0.0.0' for both the network address and the subnet mask. +IDOK &OK +IDCANCEL Cancel + + +PREFIX D_CM_SELECT_SECURE +CAPTION Select Smart Card +STATIC1 Select the type of smart card device to use. \r\n\r\nThe types of smart cards listed in this list have had their drivers installed on the current computer and are supported by VPN software. \r\nIf there is a type of smart card that is currently being used that does not appear in the list, it may be possible that update of the VPN software to a newer version enable you to use it. \r\n\r\nNote: If a driver is not displayed immediately after installation, restart Windows. +IDOK &OK +IDCANCEL Cancel + + +PREFIX D_CM_SECURE_MANAGER +CAPTION Smart Card Manager +S_INFO Current Smart Card:\r\n\r\n%S +B_BOLD Objects stored on the smart card: +B_REFRESH &Refresh Object List +B_IMPORT &Import to Card... +B_EXPORT &Export from Card... +B_DELETE &Delete from Card +B_NEW_CERT &Write New Certificate and Private Key to Card... +B_PIN &Change PIN Code... +IDCANCEL Close + + +PREFIX D_CM_SECURE_TYPE +CAPTION Select Object Type +STATIC Select the type of the object you want to import. +R_CERT &Certificate +R_KEY Private &Key +R_DATA &Data +IDOK &OK +IDCANCEL Cancel + + +PREFIX D_STRING +CAPTION VPN Software +IDOK &OK +IDCANCEL Cancel + + +PREFIX D_SM_SELECT_KEYPAIR +CAPTION Specify Certificate in Smart Card +S_INFO Currently selected smart card:\r\n\r\n%S +B_BOLD1 Select the certificate in the smart card. +IDOK &OK +IDCANCEL Cancel +B_BOLD2 Select the corresponding private key. + + +PREFIX D_CM_LOAD_X +CAPTION Load Certificate +STATIC1 Select the method to load the certificate. +R_FROM_FILE Load Certificate from &File +R_FROM_SECURE Load Certificate from &Smart Card +S_FILE You can load a certificate from a file that stores certificate data (extensions: .cer, .crt, .p12, .pfx). +S_CERT If a smart card is connected to this computer, you can load a certificate from a smart card. +B_SELECT &Select Which Smart Card to Use... +IDOK &OK +IDCANCEL Cancel + + +PREFIX D_CM_SECURE_PIN +CAPTION Change PIN Code +STATIC1 You can change the PIN code (secret number) of the smart card. \r\n\r\nTo change the PIN code, you are required to enter the current PIN code and the new PIN code twice. +STATIC2 &Current PIN code: +STATIC3 &New PIN Code: +STATIC4 Con&firm New PIN: +STATIC5 Note +STATIC6 If you incorrectly input the current PIN a certain number of times, the smart card will be rendered unusable. +STATIC7 Please insert the smart card and click OK. +IDOK &OK +IDCANCEL Cancel + + +PREFIX D_SM_CRL +CAPTION Certificates Revocation List +STATIC1 You can manage the Certificates Revocation List on this Virtual Hub. \r\n\r\nBy adding certificates in Certificates Revocation List, the clients who provide these certificates will be denied to connect to this Virtual Hub using certificate authentication mode. +B_ADD &Add +IDOK &Edit +IDCANCEL &Close +B_DELETE &Delete + + +PREFIX D_SM_EDIT_CRL +CAPTION Revoked Certificate +STATIC1 You can set the contents of an entry on the revocation list. \r\n\r\nWhen a user connects to a Virtual Hub in certificate authentication mode and that certificate matches one or more of the contents defined in the Certificates Revocation List, the user will be denied to connect. +S_BOLD The certificates that matches all the fields of the items will be disabled. +STATIC2 Contents of Certificate: +R_CN Common Name (CN): +R_O Organization (O): +R_OU Organization Unit (OU): +R_C Country (C): +R_ST State (ST): +R_L Locale (L): +STATIC3 Certificate Attribute Value: +R_SERI Serial Number (Hex): +R_MD5_HASH MD5 Digest Value (Hex, 128 bit): +R_SHA1_HASH SHA-1 Digest Value (Hex, 160 bit): +STATIC4 A digest value (hash value) can identify the particular certificate exactly. If you specify a MD5 or SHA-1 digest value, you need not to specify other items. +STATIC5 Import Values from a Certificate File +STATIC6 If there is a certificate file that you want to disable, you can correctly specify the certificate and add it to the invalid list by importing that file. Click Load Certificate and the contents of the specified certificate file will be imported automatically. +B_LOAD &Load Certificate... +IDOK &OK +IDCANCEL Cancel + + +PREFIX D_SM_AC_LIST +CAPTION Source IP Address Limit List +S_TITLE To allow or deny VPN connections to this VPN Server Virtual Hub "%S" according to the client computer's IP address, you can set the rules to allow or deny the connection below. +B_ADD &New Rule +IDOK &Edit Rule +B_DELETE &Delete Rule +B_SAVE &Save +IDCANCEL &Cancel +STATIC1 Items with higher priority appear higher in the list. +STATIC2 If the client's IP address does not match any item in the list, VPN connection to this Virtual Hub will be allowed. + + +PREFIX D_SM_AC +CAPTION Edit Rule Entry of Source IP Address Limit List +STATIC1 Define a rule in the IP Access Control List. The values set here will be used to decide whether to allow or deny connection from a VPN Client when this client attempts connection to the Virtual Hub. +STATIC2 Defines of a Rule +STATIC3 Apply this Rule when the client's IP address matches the following: +R_SINGLE &Single IP Address +R_MASKED &Multiple IP Addresses (Specify by IP Network Address and Mask) +STATIC4 &Address: +S_MASK Net Mas&k: +STATIC5 Action +R_PASS &Permit +R_DENY &Deny +STATIC6 Others +STATIC7 P&riority: +STATIC8 (Integer: higher priority is given to smaller numbers) +STATIC9 IP Protocol Version +IDOK &OK +IDCANCEL Cancel + + +PREFIX D_SM_LOG_FILE +CAPTION Log File List +STATIC1 You can download log files that are saved on the server. \r\n\r\nThe administrator of the entire VPN Server is granted to download all Virtual Hub logs and server logs. Virtual Hub administrators are granted to download the log file for that Virtual Hub. +IDOK &Download +B_REFRESH &Refresh +IDCANCEL Close + + +PREFIX D_SM_READ_LOG_FILE +CAPTION Download File +S_INFO2 Downloading the file "%S" from the VPN Server. \r\nPlease wait... +IDCANCEL &Stop Download + + +PREFIX D_SM_SAVE_LOG +CAPTION Downloaded Log File +S_INFO The file "%S" has been downloaded. \r\n\r\nYou can open or save this file. +IDOK &Open +B_SAVE &Save +IDCANCEL Cancel + + +PREFIX D_TCP +CAPTION TCP Optimization Utility +STATIC1 By optimizing the TCP/IP settings on Windows, it is possible to increase the network communication throughput of this computer. \r\n\r\nBy using this TCP Optimization Utility, you can easily configure the settings for optimize the parameters. +STATIC2 Current TCP/IP setting parameters of Windows is as follows. By changing these values you can optimize the TCP/IP settings. Using this utility any time later you can reset the values or restore them to the previous setting. +STATIC3 TCP/IP Communication Setting: +STATIC4 TCP &Receiving Window Size: +R_RECV_DISABLE Use OS &Default Value +R_RECV_ENABLE S&et the Values Below +S_RECV bytes +B_RECV Default Value +STATIC5 TCP &Sending Window Size: +R_SEND_DISABLE Use OS Default Value +R_SEND_ENABLE Set the Values Below +S_SEND bytes +B_SEND Default Value +IDOK &OK +IDCANCEL Cancel +STATIC6 The changes above will take effect after Windows has rebooted. After changing the settings, you do not need to immediately reboot the computer, but until it is rebooted the TCP/IP optimized settings will not take effect. +B_DELETE Do not Manage by this Utility + + +PREFIX D_TCP_MSG +CAPTION TCP Optimization +STATIC1 By optimizing the TCP/IP settings on Windows, it is possible to increase the network communication throughput of this computer. Do you want to optimize the communication settings?\r\n\r\nYou can start at any time in the future the TCP Optimization Utility and optimize the communication settings or restore them to their previous values. +STATIC2 When the TCP/IP settings are changed, the changes will take effect after Windows has restarted. After changing the settings, you do not need to immediately restart the computer, but until it is restarted the TCP/IP optimized settings will not take effect. +R_OPTIMIZE &Automatically Optimize Communication Settings +R_MANUAL &Manually Optimize Using TCP Optimization Utility +R_NO &Do not Optimize +IDOK &Next > +IDOK3 < &Back + + +PREFIX D_CM_PKCSEULA +CAPTION Notice to Use Smart Card's Drivers +S_INFO_1 You are attempting to access the smart card with software "%S". +S_INFO_2 When using software "%S", if there are conditions of use for this software and the smart card that is to be used, you must agree to these conditions of use before using them. \r\n\r\nFor details please contact the vendor of software "%S" and of the smart card. +S_INFO_3 Do you agree to the above and want to use the software "%S" and access the specified smart card? +IDOK &Yes +IDCANCEL &No + + +PREFIX D_CM_TRAFFIC +CAPTION Network Traffic Speed Test Tool +STATIC1 Network Traffic Speed Test Tool performs transmitting packets between two computers connected with TCP/IP, with large amount of throughput as possible, in order to measure the actual network traffic speed available. This tool can be used for not limited VPNs, but it is useful for physical networks. +STATIC2 Use this tool to measure the current bandwidth capacity of the network. Note that the value obtained is sometimes lower than the actual network processing capacity due to the CPU performance of both endpoints, what other programs are currently running and fluctuations in the rate of use of the network. +S_1 Configurations: +S_3 Which is the role of this computer? +R_SERVER Test &Server +R_CLIENT Test &Client +S_4 To activate the test server, specify the listening port number.\r\nTo use it as the test client, specify the host name of the destination test server or the IP address, and port number. If necessary, configure the optional settings below. +S_5 Destination Test Server &Hostname: +S_6 &Port Number: +S_7 (TCP port) +S_8 Configure following options on the client side. +S_9 Direction of Data Communication +R_DOWNLOAD &Download (Incoming: from Server to Client) +R_UPLOAD &Upload (Outgoing: from Client to Server) +R_FULL Download and Upload (&Full-Duplex Mode: In and Out Simultaneously) +S_10 Advanced Settings +S_11 &Number of Concurrent Parallel TCP Connections: +S_12 Me&asuring Period: +S_13 seconds +R_ETHERNET Correct L2 Throughput Assuming &Ethernet +R_DOUBLE Relay Device Mode +S_14 connections +IDOK &Run +IDCANCEL Cancel +S_15 You can also run this tool from the vpncmd Command-line Management Utility (also available on non-Windows OS). + + +PREFIX D_CM_TRAFFIC_RUN +CAPTION Network Traffic Speed Test Tool +S_INFO The Network Traffic Speed Test Tool is running. The operating status is as follows. +STATIC1 To abort the Network Traffic Speed Test Tool, click Exit. +IDCANCEL &Exit + + +PREFIX D_CM_TRAFFIC_RESULT +CAPTION Communication Traffic Measurement Results +STATIC1 Communication traffic has been measured. The results are shown below. +IDCANCEL &Close + + +PREFIX D_SM_LICENSE +CAPTION Add or Remove License +STATIC1 To use SoftEther VPN Server you must acquire a valid license and register the license key. You can register a new license key, delete a registered license key and display the current license list and the license mode of the VPN Server here. +S_BOLD Currently Registered &License Keys: +B_OBTAIN &Obtain or Extend a License +STATIC2 Click Obtain or Extend License to visit the website that will provide instructions on how to obtain a license. +B_ADD &Add a License Key +B_DEL &Delete +IDOK &Information About License +STATIC3 Select a license and click Information About License to connect to SoftEther VPN Project's website (softether.com) and view the registered information relating to the selected license. +S_BOLD2 Current License &Mode of SoftEther VPN Server: +IDCANCEL E&xit + + +PREFIX D_SM_LICENSE_ADD +CAPTION Add License Keys +S_INFO You can register a SoftEther VPN Server product license or a connection license. +STATIC1 The license keys are 36 alphanumeric characters in length plus dashes. They are key codes that certify the ownership of a license. \r\n\r\nWhen a license certificate is received together with this software, the license key is printed on this license certificate. If the license for this software has been purchased online, the license key is provided by email and on the website window at the time the license is purchased. The license key may also be written down by some other method. If you don't know where the license key is written down, ask the vendor who sold you the license. +STATIC2 &Input the License Key Accurately: +STATIC3 Enter the license key by separating the input into 6-digit groups. You don't need to input the dashes. It is also possible to copy && paste the license key. +B_INFO2 This software is protected by world-wide copyright laws. Customers can only make copies and use this software in accordance with the license conditions. Warning: Use of illegitimately obtained license keys, use of a single license on multiple servers, or unauthorized distribution of licenses is a breach of the license agreement and such action may result in civil or legal proceedings. +IDOK &Register +IDCANCEL Cancel + + +PREFIX D_FREEINFO +CAPTION About SoftEther VPN Server Free Edition +S_INFO_1 Thank you for trying out the SoftEther VPN Server Free Edition. +S_INFO_2 The SoftEther VPN Server operating on destination server "%S" is the Free Edition intended for personal use. \r\nWhen using the Free Edition, you can use all the SoftEther VPN Server functions but the User Agreement prohibits the following usage. +S_INFO_3 Use where communication for commercial purposes travels via the VPN Server. +S_INFO_4 Note that if the software is used based on the above mentioned prohibited usage, it is a breach of the SoftEther VPN Server user agreement. The above restriction is lifted once you obtain a regular product license for SoftEther VPN Server. For details on the regular product version, please visit www.softether.com. \r\n\r\nIf this server is being used under the usage described above, please contact us via our website at www.softether.com. \r\n\r\nNote: This window will appear when connected to a Free Edition of VPN Server. This window does not appear when Editions other than the Free Editions of the software product are used. \r\nNote: Apart from this notification window, there are absolutely no differences between the Free Edition software and the product version. +B_HIDE &Hide this window next time. +IDCANCEL &OK + + +PREFIX D_CM_SETTING +CAPTION Switch SoftEther VPN Client Operating Mode +STATIC1 You can use SoftEther VPN Client in either Normal Mode or Easy Mode. To switch to the other mode, check the respective checkbox below. +R_NORMAL &Normal Mode +R_EASY &Easy Mode +STATIC2 When using Normal Mode, you can perform all the operations that the SoftEther VPN Client software provides. We recommend that general users and system administrators use this mode. +STATIC3 Easy Mode only allows the most frequently used operations such as connecting to the VPN Server. We recommend this mode to beginner users. +STATIC4 By using the Setting Locker, you can connect to a VPN Server by using a Connection Setting registered in SoftEther VPN Client, but by doing so, you are prevented from changing the parameters of Connection Settings, creating a new Connection Setting or deleting a Connection Setting. +R_LOCK Enable Setting &Locker +S_PASSWORD1 You can specify a password. The input of that password will be required next time to disable the Setting Locker. +S_PASSWORD2 &Password: +S_PASSWORD3 &Confirm: +IDOK &OK +IDCANCEL Cancel +S_VGS2 You can configure the VPN Gate Academic Service settings. +B_VGS VPN &Gate Service Settings... + + + +PREFIX D_CM_EASY +CAPTION SoftEther VPN Client Easy Manager (Developer Edition) +B_MODE Switch Operation &Mode +IDCANCEL &Close +B_STATUS View Connection &Status +B_VGC VPN Gate Academic Project + + +PREFIX D_SM_SETUP +CAPTION SoftEther VPN Server / Bridge Easy Setup (Developer Edition) +S_TITLE SoftEther VPN Server / Bridge Easy Setup (Developer Edition) +IDC_STATIC_1 By using this setup you can easily setup a SoftEther VPN Server or VPN Bridge for the following use and purpose. After exiting the setup, you can use the VPN Server Manager to freely configure more advanced settings. +S_BOLD Select the type of VPN server you want to build. Multiple types can be selected together. +C_REMOTE &Remote Access VPN Server +S_REMOTE_1 The Remote Access VPN Server allows VPN Client computers in remote locations to access to the existing Ethernet segments, for example company LAN.\r\nAny VPN Clients who is connecting to the VPN Server will be able to access to the network as if they are connected directly and physically to the network. +C_SITE &Site-to-site VPN Server or VPN Bridge +S_SITE_1 Site-to-site VPN is a VPN configuration to connect between two or more remote Ethernet segments.\r\nEach of the sites are connected together, and become the same segment at Layer-2 level. It enables any computers of each sites to communicate to each other as if there is a single network. +S_SITE_2 Select the role of this VPN Server: +C_CENTER VPN Server that Accepts Connection from Other Sites (&Center) +C_EDGE VPN Server or VPN Bridge at Each Site (&Edge) +C_OTHER &Other Advanced Configuration of VPN +S_OTHER Select this if you are planning to build a VPN system that provides advanced functions such as a clustering function and a Virtual Layer 3 Switch function. +IDOK &Next > +IDCANCEL &Close + + +PREFIX D_SM_SETUP_HUB +CAPTION Easy Setup - Decide the Virtual Hub Name +IDC_STATIC_1 You have to create one Virtual Hub on the VPN Server at least. Name the new Virtual Hub as you prefer. +IDC_STATIC_2 Virtual Hub &Name: +IDOK &OK +IDCANCEL Cancel + + +PREFIX D_SM_SETUP_STEP +CAPTION VPN Easy Setup Tasks +IDC_STATIC_1 To complete the setup of this VPN Server / VPN Bridge, you must complete the following tasks. +S_1_1 Step 1. Create a User to Accept VPN Connection +S_1_2 When this VPN Server accepts a remote access VPN, or becomes the central site-to-site VPN server that accepts connections from other sites, create users to accept the VPN connection. +B_USER Create &Users +S_2_1 Step 2. Define a Connection to Destination VPN Server +S_2_2 When this VPN Server is installed on a particular site (edge) of a site-to-site VPN, you have to specify the address of the center VPN Server that accepts the connections, and establish a connection to that central VPN Server. +B_CASCADE &Configure Connection Setting +S_3_1 Step 3. Set Local Bridge +S_3_2 For an site-to-site VPN, use the Local Bridge Function to connect a bridge between the virtual Ethernet segment on the VPN side and the physical Ethernet segment on the local side. Select an existing Ethernet device (Network Adapter) that will be provide the bridge connection to the VPN. +IDCANCEL &Close +IDC_STATIC_8 Once the required settings are configured, click Close. An advanced management tool for VPN Server / VPN Bridge will be appeared. You can then configure any advanced settings as you wish. +B_SECURENAT Configure SecureN&AT + + +PREFIX D_CPU64_WARNING +CAPTION Information on SoftEther VPN 64-bit Edition +S_BOLD The SoftEther VPN software currently installed is the 32-bit edition, but the Windows operating system that is currently running is a 64-bit edition. +S_INFO You can run the 32-bit edition of SoftEther VPN software on a 64-bit edition of Windows, but it will run on Window's 32-bit emulator, and this results in reduced performance. \r\nThere is also a possibility that some functions are not supported. \r\n\r\nWe strongly recommend you to install and use the 64-bit edition of SoftEther VPN software when running it on 64-bit Windows. \r\nYou can download the 64-bit edition of the SoftEther VPN software from http://selinks.org/. \r\n\r\nThis dialog box will close automatically in 30 seconds. +IDOK &OK + + +PREFIX D_ONCEMSG +CAPTION TITLE +C_DONTSHOWAGAIN &Do not show this message again +IDCANCEL &OK + + +PREFIX D_CONNECT +IDCANCEL Cancel + + +PREFIX D_SM_IPSEC +CAPTION IPsec / L2TP / EtherIP / L2TPv3 Settings +S_TITLE IPsec / L2TP / EtherIP / L2TPv3 Server Settings +S_3 Virtual Hubs on the VPN Server can accept Remote-Access VPN connections from L2TP-compatible PCs, Mac OS X and Smartphones, and also can accept EtherIP / L2TPv3 Site-to-Site VPN Connection. +S01 L2TP Server (Remote-Access VPN Server Function) +S02 VPN Connections from Smartphones suchlike iPhone, iPad and Android, and also from built-in VPN Clients on Mac OS X and Windows can be accepted. +R_L2TP_OVER_IPSEC Enable L2TP Server Function (L2TP over IP&sec) +S03 Make VPN Connections from iPhone, iPad, Android, Windows, and Mac OS X acceptable. +R_L2TP_RAW Enable L2TP Server Function (Raw &L2TP with No Encryptions) +S04 It supports special VPN Clients which uses L2TP with no IPsec encryption. +S_1 Default Virtual &Hub in a case of omitting a name of Hub on the Username: +S_2 Users should specify their username such as "Username@Target Virtual Hub Name" to connect this L2TP Server.\r\nIf designation of a Virtual Hub is omitted, the below Hub will be used as the target. +S05 EtherIP Server Function (Site-to-Site VPN Connection) +S06 Router products which are compatible with EtherIP / L2TPv3 over IPsec can connect to Virtual Hub on the VPN Server and establish Layer-2 (Ethernet) Bridging. +R_ETHERIP Enable &EtherIP / L2TPv3 over IPsec Server Function +B_DETAIL EtherIP / L2TPv3 &Detail Settings +S07 IPsec &Common Settings +S_PSK IPsec &Pre-Shared Key: +S_PSK2 IPsec Pre-Shared Key is also called "PSKs" or "Secrets". Specify it with around eight ASCII characters, and let all VPN users know. +IDOK &OK +IDCANCEL Cancel + + +PREFIX D_SM_ETHERIP +CAPTION EtherIP / L2TPv3 Server Detail Settings +S_TITLE EtherIP / L2TPv3 Server Detail Settings +S01 EtherIP / L2TPv3 over IPsec compatible routers can connect to Virtual Hubs on VPN Server and establish Layer-2 (Ethernet) Bridge. For instance, Cisco routers, NEC IX series and IIJ SEIL routers are recommended as compatible VPN routers. +S02 In order to accept EtherIP / L2TPv3 protocol, define appropriate EtherIP / L2TPv3 Client Settings to identify the client site of the router beforehand. A EtherIP / L2TPv3 Client Setting must have a corresponding IPsec Phase 1 ID. +S_BOLD &Table of IPsec Phase 1 ID and the Virtual Hub +B_ADD &Add +IDOK &Edit +B_DELETE &Delete +IDCANCEL E&xit + + +PREFIX D_SM_ETHERIP_ID +CAPTION EtherIP / L2TPv3 over IPsec Client Setting +S01 The following Virtual Hub connection settings will be applied only when an EtherIP / L2TPv3 over IPsec Client is attempting to connect this VPN Server with an ISAKMP (IKE) Phase ID which is exactly equal to the value specified below. +S02 ISAKMP Phase 1 &ID: +S03 Virtual &Hub: +S04 &Username: +S05 &Password: +S06 Note that the username and the password must be same as a registered on the Virtual Hub. An EtherIP / L2TPv3 Client will be regarded as it connected the Virtual Hub with the identification of the above user information. +IDOK &OK +IDCANCEL Cancel +S07 The ID must be exact same as an ID in the configuration of the EtherIP / L2TPv3 Client. You can specify IP address as well as characters as ID, if the EtherIP / L2TPv3 Client uses IP address as Phase 1 ID. You can specify '*' (asterisk) as a wildcard to match any other clients which don't match other explicit rules. + + +PREFIX D_SM_OPENVPN +CAPTION OpenVPN / MS-SSTP Settings +S_TITLE OpenVPN / MS-SSTP VPN Clone Server Function Settings +S_1 This VPN Server has the clone functions of OpenVPN software products by OpenVPN Technologies, Inc.\r\n\r\nAny OpenVPN Clients can connect to this VPN Server. +R_OPENVPN Enable &OpenVPN Clone Server Function +S_TOOL Sample File Generating Tool for OpenVPN Clients +S_TOOL2 Making a OpenVPN Client configuration file is a very difficult job. You can use this tool to generate an appropriate OpenVPN Client configuration file. The generated configuration sample can be used immediately. +B_CONFIG Generate a Sample &Configuration File for OpenVPN Clients +S_2 Microsoft SSTP VPN Clone Server Function +S_3 This VPN Server has the clone functions of MS-SSTP VPN Server which is on Windows Server 2008 / 2012 by Microsoft Corporation.\r\nBuilt-in MS-SSTP Clients on Windows Vista / 7 / 8 / RT / 10 can connect to this VPN Server. +R_SSTP Enable &MS-SSTP VPN Clone Server Function +S_SSTP The value of CN (Common Name) on the SSL certificate of VPN Server must match to the hostname specified on the client, and that certificate must be in the trusted list on the client. For details refer the Microsoft's documents. +S_4 The manner to specify a username to connect to the Virtual Hub, and the selection rule of default Hub by using these clone server functions are same to the IPsec Server functions. +B_IPSEC I&Psec Server Configuration +S_13 OpenVPN Clone Server Function +IDOK &OK +IDCANCEL Cancel + + +PREFIX D_SM_DDNS +CAPTION Dynamic DNS Function +S_TITLE Dynamic DNS Function +S_BOLD This VPN Server has a Built-in Dynamic DNS Function. +S_1 The Dynamic DNS assigns a unique and permanent DNS hostname for this VPN Server. You can use that hostname to specify this VPN Server on the settings for VPN Client and VPN Bridge. You need not to register and keep a domain name. +S_22 Also, if your ISP assigns you a dynamic (not-fixed) IP address, the corresponding IP address of your Dynamic DNS hostname will be automatically changed. It enables you to keep running the VPN Server by using only a dynamic IP address.\r\nTherefore, you need not any longer to keep static global IP addresses with expenses monthly costs. +S_3 Moreover, this VPN Server version supports 'NAT-Traversal' function. If the VPN Server is inside the NAT and is assigned only a private IP address, you can connect to that VPN Server from the Internet side without any special settings on the NAT beforehand. +S_4 Current &Status: +S_STATUS3 Assigned Dynamic DNS &Hostname: +B_HINT Hint +S_STATUS4 Global IPv&4 Address: +S_STATUS5 Global IPv&6 Address: +S_5 Modify the Settings: +S_STATUS6 &Change the Dynamic DNS Hostname: +S_STATUS7 Hostname is with only alphabets numeric, and dashes '-'. Three letters at least.\r\nYou can change it any time later. +IDOK Set to &Above Hostname +B_RESTORE &Restore +S_2 If you are not connected to IPv6 Internet, "Global IPv6 Address" should show an error.\r\nA few countries or territories might prohibit Dynamic DNS Service. +IDCANCEL E&xit +B_DISABLE &Disable Dynamic DNS Function +B_PROXY Connect via &Proxy Server... +S_STATUS8 DNS Key: +B_HINT2 Hint + +PREFIX D_SM_SPECIALLISTENER +CAPTION VPN over ICMP / DNS Function Settings +S_TITLE VPN over ICMP / DNS Function +S_1 VPN over ICMP / DNS Function +S_2 You can establish a VPN only with ICMP or DNS packets even if there is a firewall or routers which blocks TCP/IP communications. You need to enable the following functions beforehand. +R_OVER_ICMP Enable VPN over &ICMP Server Function +R_OVER_DNS Enable VPN over &DNS Server Function (Uses UDP Port 53) +IDOK &OK +IDCANCEL Cancel +S_3 Requires VPN Client / VPN Bridge internal version 4.0 or greater. +S_4 Warning: Use this function for emergency only. It is helpful when a firewall or router is misconfigured to blocks TCP/IP, but either ICMP or DNS is not blocked. It is not for long-term stable using. + + +PREFIX D_SM_REDIRECT +CAPTION HTTP URL Redirection Settings +S_1 The specified URL below will be mandatory replied to the client as a response for TCP connecting request packets which matches the conditions of this access list entry via this Virtual Hub.\r\n\r\nTo use this setting, you can enforce the web browser of the VPN Client computer to show the specified web site when that web browser tries to access the specific IP address. +S_2 Specify a URL which redirects to. +S_BOLD2 The &URL Redirect To: +S_3 Example: +S_4 Simple URL Redirection: +S_5 Advanced URL Redirection: +B_HINT &Usage of Advanced URL Redirection Function... +S_6 Caption +S_BOLD This function is for TCP/IP expert administrator. Read the following instructions and be careful to set up. +S_7 This redirection rule is not effective in the case that the destination session of a packet matches the destination username or groupname of an access list entries. +S_8 This redirection rule is ignored for non-TCP packets if it matches the condition. +S_9 This redirection rule always replies HTTP redirect messages. (Not limited for port 80.) If you want to apply to only port 80, set the destination port to 80 on the condition of the access list entry. +S_10 If as the result of redirection by this rule the client attempts to access the redirected URL and such a new request matches this rule again, the redirection results will be replied for such new requests. It will cause an infinite redirection loop. +IDOK &OK +IDCANCEL Cancel +S_11 The advanced redirection function can provide the VPN Session information to the CGI which is redirected to. + + +PREFIX D_SW_WELCOME +CAPTION D_SW_WELCOME +S_WELCOME SoftEther VPN is freeware developed at University of Tsukuba, Japan. High-performance VPN with the ultimate compatibilities to many devices. Windows, Mac, smartphones, tablets (iPhone, iPad, Android, Windows RT) and Cisco or other VPN routers are supported. SoftEther VPN also accepts OpenVPN and MS-SSTP VPN clients. +S_TITLE Extremely Powerful Open-Source VPN Software. + +PREFIX D_SW_MODE +CAPTION D_SW_MODE +R_SYSTEM &System Mode (Recommended) +R_USER &User Mode +S_1 Install the VPN software to this computer normally. The administrator privilege is required. +S_USER Install the VPN software with the normal user privilege. No administrator privilege is required. Some functions such as Local Bridge will be disabled. Runs only the user "%s" is logged on Windows. +S_2 SoftEther VPN can be installed by one of two methods.\r\n\r\nPlease select the System Mode normally.\r\n\r\nIf you cannot use the administrator privilege for some reasons, you can select the User Mode to continue the installation. + + +PREFIX D_SW_NOT_ADMIN +CAPTION D_SW_NOT_ADMIN +S_INFO The user "%s" which is logged on Windows does not have the administrator privilege.\r\n\r\nLog off Windows, log on by the user who has the administrator privilege and restart the Setup Wizard if you want to continue the setup. +S_INFO6 Click Finish to exit the Setup Wizard. +S_INFO2 If you cannot use the administrator privilege, you can choose the User Mode installation.\r\nTo install the software in the User Mode, click Back. + + +PREFIX D_SW_COMPONENTS +CAPTION D_SW_COMPONENTS + + +PREFIX D_SW_EULA +CAPTION D_SW_EULA +S_1 Please read the End User License Agreement carefully. +B_AGREE I agree to the End User License Agreement. + + +PREFIX D_SW_WARNING +CAPTION D_SW_WARNING +S_1 SoftEther VPN software has extremely powerful communication abilities. Before use please read the Important Notices carefully. + + +PREFIX D_SW_DIR +CAPTION D_SW_DIR +S_INFO Please specify the directory to install %s. +R_CUSTOM &Specify the Directory +S_DEST &Directory: +B_BROWSE &Browse... +R_SHOWCUSTOM &Advanced Install Options for Experts +R_FOR_SYSTEM Install on &Windows of this Computer Entirely +R_FOR_USER Install only on the Environment of User "%s" +S_WARNING Caution: Not recommended. After the user "%s" logs off Windows, %s will stop. Local Bridge function and L2TP/IPsec Function (supports for Mac and Smartphones) will be unavailabe. + + +PREFIX D_SW_READY +CAPTION D_SW_READY +S_INFO Install of %s is ready. +S_INFO7 Click Next to perform the install. + + +PREFIX D_SW_PERFORM +CAPTION D_SW_PERFORM +S_INFO The setup of %s is in progress.\r\nPlease wait... +S_INFO8 SoftEther VPN is a work of the research and development project of Japanese Government, subsidized by Ministry of Economy, Trade and Industry of Japan, administrated by Information Promotion Agency. + + +PREFIX D_SW_ERROR +CAPTION D_SW_ERROR +S_INFO An error occurred and the setup of %s is aborted.\r\n\r\nRestart the Setup Wizard if you want to retry. + + +PREFIX D_SW_FINISH +CAPTION D_SW_FINISH +S_INFO The setup process of %s has completed successfully. +S_INFO8 SoftEther VPN is a work of the research and development project of Japanese Government, subsidized by Ministry of Economy, Trade and Industry of Japan, administrated by Information Promotion Agency. + + +PREFIX D_SW_UNINST1 +CAPTION D_SW_UNINST1 +S_WELCOME The Setup Wizard can uninstall %s from the computer.\r\n\r\nClick Next if you want to start uninstall. +S_TITLE %s Uninstall Wizard + + +PREFIX D_SW_EASY1 +CAPTION D_SW_EASY1 +S_WELCOME Installing and setting up the VPN Clients to a lot of computers in the enterprise is a hard work. +S_TITLE What is SoftEther VPN Client Easy Installer? +S_WELCOME2 Easy Installer Creator is a tool for enterprise administrators. You can create a VPN Client installer with embedding a specific VPN connection setting by using Easy Installer Creator. Personal users can also exploit this tool. +S_WELCOME3 A created Easy Installer can be distributed to employees in the enterprise by using file servers or e-mails. If a user runs the Easy Installer, VPN Client will be installed and the VPN connection setting will be imported, and then the VPN connection will be started automatically. + + +PREFIX D_SW_EASY2 +CAPTION D_SW_EASY2 +S_BOLD1 Specify a VPN connection setting file (.vpn file) to embed +S_1 Please specify a VPN connection setting file (a file which extension is .vpn) to embed on the Easy Installer. You can export a setting file by clicking Export VPN Connection Setting on the right-click menu of the target connection setting on the VPN Client Manager. +S_18 Connection &Setting: +B_BROWSE_SETTING &Browse... +B_DELETE_SENSITIVE &Eliminate Username and Password from Connection Setting File +S_BOLD2 Specify an EXE filename to be generated +S_3 This tool will output an EXE file (executable file) which implements an Easy Installer. Please specify the output filename to be generated. +S_19 Save &as: +B_BROWSE_OUT B&rowse... +B_EASYMODE Set the VPN Client Manager to &Easy Mode when Installation + + +PREFIX D_SW_WEB1 +CAPTION D_SW_WEB1 +S_WELCOME You can create a SoftEther VPN Client Web Installer and upload it on the Web server in the enterprise. A user opens that web page and can install the SoftEther VPN Client automatically. You can also setup the automatic import and kick-start of a built-in VPN connection setting. +S_TITLE What is SoftEther VPN Web Installer? +S_WELCOME2 The generated Web Installer can be placed as HTML files on the intranet Web server. If an employee accesses to the URL of that HTML files, the SoftEther VPN Client Installer will be executed. +S_WELCOME3 Using ActiveX Control. Internet Explorer 5.0, greater on Windows 2000 or greater are supported. Other web browsers or older operating systems (for example Windows 98) are not supported. + + +PREFIX D_SW_WEB2 +CAPTION D_SW_WEB2 +S_BOLD1 Specify a VPN connection setting file (.vpn file) to embed +S_1 Please specify a VPN connection setting file (a file which extension is .vpn) to embed on the Web Installer. You can export a setting file by clicking Export VPN Connection Setting on the right-click menu of the target connection setting on the VPN Client Manager. +S_18 Connection &Setting: +B_BROWSE_SETTING &Browse... +B_DELETE_SENSITIVE &Eliminate Username and Password from Connection Setting File +S_BOLD2 Specify the output filename to be generated +S_3 This tool will output a ZIP file (archive file) which contains HTML files and CAB files that should be placed on the Web server. Please specify the output filename to be generated. +S_19 Save &as: +B_BROWSE_OUT B&rowse... +B_EASYMODE Set the VPN Client Manager to &Easy Mode when Installation + + +PREFIX D_UPDATE_NOTICE +CAPTION Updates of %s +IDOK &Show the Update Information... +B_CONFIG &Configure Update... +IDCANCEL &Do Not Show this Message Again +S_INFO The latest version of %s is released. You can download it and update now. +S_PRODUCT Software: +S_CURRENT Current Version: +S_CURRENT_STR Ver %u.%02u.%04u%s +S_LATEST Latest Version: +S_LATEST_STR Ver %S%s + + +PREFIX D_UPDATE_CONFIG +CAPTION Configuration of Update Notification +S_INFO Checks the new versions of %s periodically and popup a notification when a new version will be released.\r\n\r\nHTTPS packets will be used between this computer and the SoftEther Update server located in Tsukuba-city, Ibaraki-prefecture, Japan in order to check updates. No personal information will be sent. +S_TITLE %s Update and Notify Settings +S_ENABLE &Enable Update Checks +S_DISABLE &Disable Update Checks +IDCANCEL &Close + + +PREFIX D_SM_VMBRIDGE +CAPTION Instructions for Local Bridge on VM +S_TITLE Using Local Bridge Function on VM +S_1 It has been detected that the VPN Server might be running on a VM (Virtual Machine) suchlike VMware or Hyper-V. Read the following instructions carefully. If you are not using a VM, please ignore this message. +S_2 Some VMs prohibit the "Promiscuous Mode" (MAC Address Spoofing) on the network adapters by default.\r\n\r\nIf the Promiscuous Mode (MAC Address Spoofing) is administratively disabled, the Local Bridge function between a Virtual Hub on the VPN Server and a physical network adapter on the physical computer does not work well. You should allow the Promiscuous Mode (MAC Address Spoofing) by using the configuration tool of the VM.\r\n\r\nFor details please refer the documents of your VM. If it is a shared-VM and administrated by other person, please request the administrator to permit the use of the Promiscuous (MAC Address Spoofing) Mode to your VM. +S_BOLD Instructions +IDCANCEL &OK + + +PREFIX D_SM_AZURE +CAPTION VPN Azure Service Settings +S_TITLE VPN Azure Cloud VPN Service (Free) +S_1 VPN Azure makes it easier to establish a VPN Session from your home PC to your office PC. While a VPN connection is established, you can access to any other servers on the private network of your company. +S_2 You don't need a global IP address on the office PC (VPN Server). It can work behind firewalls or NATs. No network administrator's configuration required. You can use the built-in SSTP-VPN Client of Windows in your home PC. +S_3 VPN Azure is a cloud VPN service operated by SoftEther VPN Project. VPN Azure is free of charge and available to anyone. Press the right button to see details and how-to-use instructions. +B_BOLD VPN Azure Setting +R_ENABLE &Enable VPN Azure +R_DISABLE &Disable VPN Azure +S_HOSTNAME_BORDER Current VPN Azure Hostname +S_HOSTNAME_INFO The VPN Azure hostname is same to the Dynamic DNS hostname, but altering the domain suffix to "vpnazure.net". +B_CHANGE Change &Hostname +B_WEB How to Use VPN Azure\r\n(Visit the Web) +IDCANCEL &OK + + +PREFIX D_SM_PROXY +CAPTION Connect via Proxy Server +STATIC9 You can connect via a proxy server. +STATIC10 Proxy &Type: +R_DIRECT_TCP &Direct TCP/IP Connection (No Proxy) +R_HTTPS Connect via H&TTP Proxy Server +R_SOCKS Connect via S&OCKS4 Proxy Server +R_SOCKS5 Connect via S&OCKS5 Proxy Server +B_PROXY_CONFIG P&roxy Server Setting +IDOK &OK +IDCANCEL Cancel + + +PREFIX D_VGC_LIST +CAPTION VPN Gate Academic Experimental Project Plugin for SoftEther VPN Client +S_TITLE VPN Gate Public VPN Relay Servers +S_INFO1 Gain freedom access to Internet by using VPN connection via Public VPN Servers provided by volunteers abound the world. Bypass your local malfunctioning firewall's packet blocking, and hide your IP address safely. +IDOK &Connect to the VPN Server +B_PROXY &Proxy Settings +S_VLAN Virtual Network Adapter: +B_WEB VPN Gate Academic\r\nWeb Site +B_REFRESH &Refresh List +S_REFRESH Refreshing the List... +S_RESEARCH Academic project at University of Tsukuba, Japan. +S_INFO9 A VPN Server with higher Line Speed (measured by Mbps) and smaller Ping result are usually more comfortable to use. You might be able to browse websites which are normally unreachable from your area if you use VPN servers that are not in your area. + + +PREFIX D_VGC_PROTOCOL +CAPTION Select VPN Protocol to Connect +S_TITLE The Public VPN Relay Server "%S" (%S) supports both TCP and UDP as VPN protocol. +S_INFO Select preferred VPN Protocol to use in order to connect the VPN Server "%S" (%S). In general, the TCP protocol is easy to pass through the firewall. Try the UDP protocol only if the TCP has been failed. +R_TCP Use &TCP Protocol (Ethernet over HTTPS VPN) (Recommended) +R_UDP Use &UDP Protocol (Ethernet over UDP VPN) +IDOK &OK +IDCANCEL Cancel + + +PREFIX D_VGS_CONFIG +CAPTION VPN Gate Service Control Panel +R_ENABLE &Enable the VPN Gate Relay Service and Join the VPN Gate Research as a Volunteer. +S_TITLE Join the VPN Gate Academic Research Project? +S_INFO1 VPN Gate is an academic experiment for the research on the 'Distributed Public VPN Relay Server' technology, operated at the Graduate School on University of Tsukuba, Japan. VPN Gate Client users can connect to VPN Gate Services running on Public VPN Relay Servers, and enjoy unrestricted Internet access via the VPN Relay Server. +S_INFO9 When a VPN Gate Client user accesses to a server on Internet, the source IP address will be replaced to the IP address of the relaying Public VPN Server. Consequently, the VPN Gate Client user will be able to browse overseas web sites smoothly even if the user's local firewall is out of order by an unknown reason and unable to pass such an access. +S_WARNING If you check the above checkbox and press OK, the VPN Gate Relay Service will be activated on this computer. As the result, any VPN Gate Client will be able to communicate towards the Internet via the VPN Gate Relay Service. It is secure even if your computer is on the private network (e.g. corporate network) because any accesses to private IP addresses will not be permitted to pass via the VPN Gate Relay Service. +B_OPTION VPN Gate Service &Option Settings... +IDOK &OK +IDCANCEL Cancel +B_WEB &Browse http://www.vpngate.net/ ... + + +PREFIX D_VGS_OPTION +CAPTION VPN Gate Service Options +S_TITLE VPN Gate Service Options +S_1 This computer will be a Public VPN Server. Please fill the operator's information of the server. The information will be published on the list at www.vpngate.net and other related services. The contact address will be also used to contact from VPN Gate Academic Project operators. +S_2 Operator: +S_3 &Operator of Server: +S_19 (Up to 64 letters) +S_20 &Abuse Report Address\r\n(e-mail addresses etc.): +S_21 (Up to 64 letters) +S_22 The &Message to Users:\r\n(Up to 128 letters) +S_23 The message will be shown on the list of VPN Gate Servers. Enter an enjoyable message to let users feel pleasure. +S_24 VPN Settings: +R_LOG &Save VPN Packet Logs (Recommended) +R_2WEEKS Auto Delete or Archive with Encoding for Packet Logs After &Two Weeks (Recommended) +R_PERMANENT Make Packet Logs Occupy Free Disk Space &Permanently +R_L2TP Enable &L2TP/IPsec VPN Server Function (Recommended) +S_25 Allows Mac OS X, iPhone, iPad and Android clients to make a VPN connection. +B_MESSAGE Pop-up Your Advertisement Message on the VPN Client &Screen ... +IDOK &OK +IDCANCEL Cancel + + +PREFIX D_VGS_WARNING +CAPTION Caution before Joining VPN Gate Academic Experiment +S1 The VPN Gate Academic Experiment Service is operated as a research project at the graduate school on University of Tsukuba, Japan. The service is governed under the Japanese laws. Other countries' laws are none of our concerns nor responsibilities. +S2 By nature, there are almost 200 countries in the World, with different laws. It is impossible to verify every countries' laws and regulations and make the software comply with all countries' laws in advance to release the software. If a user uses VPN Gate service in a specific country, and damaged by public servants of the authority, the developer of either the service or software will never be liable to recover or compensate such damages or criminal responsibilities. +S3 By using this software and service, the user must observe all concerned laws and rules with user's own responsibility. The user will be completely liable to any damages and responsibilities which are results of using this software and service, regardless of either inside or outside of Japan's territory. +S4 If you don't agree nor understand the above warnings, do not use any of VPN Gate Academic Experiment Service functions. +S5 Note: VPN Gate is a research project for just academic purpose only. VPN Gate was developed as a plug-in for SoftEther VPN and UT-VPN. However, all parts of VPN Gate were developed on this research project at University of Tsukuba. Any parts of VPN Gate are not developed by SoftEther VPN Project. The VPN Gate Research Project is not a subject to be led, operated, promoted nor guaranteed by SoftEther VPN Project. +R_NEVER Do Not &Show This Message Again +B_WEB Visit VPN Gate &Web Site... +IDOK &Agree +IDCANCEL &Disagree +S_BOLD Caution! Do Not Use the VPN Gate Services in Countries where VPN Communications are Prohibited. + + +PREFIX D_NM_PUSH +CAPTION Edit the static routing table to push +S1 This Virtual DHCP Server can push the classless static routes (RFC 3442) with DHCP reply messages to VPN clients. +S2 Whether or not a VPN client can recognize the classless static routes (RFC 3442) depends on the target VPN client software. SoftEther VPN Client and OpenVPN Client are supporting the classless static routes. On L2TP/IPsec and MS-SSTP protocols, the compatibility depends on the implementation of the client software. +S3 You can realize the split tunneling if you clear the default gateway field on the Virtual DHCP Server options. On the client side, L2TP/IPsec and MS-SSTP clients need to be configured not to set up the default gateway for the split tunneling usage. +S4 You can also push the classless static routes (RFC 3442) by your existing external DHCP server. In that case, disable the Virtual DHCP Server function on SecureNAT, and you need not to set up the classless routes on this screen. +S5 Edit the static routing table to push +S6 Example: 192.168.5.0/255.255.255.0/192.168.4.254, 10.0.0.0/255.0.0.0/192.168.4.253\r\n\r\nSplit multiple entries (maximum: 64 entries) by comma or space characters.\r\nEach entry must be specified in the "IP network address/subnet mask/gateway IP address" format. +S7 See the RFC 3442 to understand the classless routes. +IDOK &OK +IDCANCEL Cancel + + + +########################################################################### +# # +#String data of menus in software # +# # +########################################################################### + + +# Connection Manager menu +PREFIX CM_MENU +# [Connect] menu +CMD_TOP_CONNECT &Connect +CMD_CONNECT C&onnect\tEnter +CMD_STATUS View &Status...\tCtrl+S +CMD_DISCONNECT D&isconnect\tCtrl+D +CMD_DISCONNECT_ALL Disconnect &All\tCtrl+I +CMD_NEW &New VPN Connection Setting...\tCtrl+N +CMD_CLONE &Copy\tCtrl+C +CMD_SHORTCUT Create VPN Connection S&hortcut... +CMD_EXPORT_ACCOUNT E&xport VPN Connection Setting... +CMD_IMPORT_ACCOUNT Im&port VPN Connection Setting... +CMD_STARTUP Se&t as Startup Connection\tCtrl+T +CMD_NOSTARTUP R&emove Startup Connection +CMD_RECENT Recent &VPN Servers +CMD_RENAME Rena&me\tF2 +CMD_DELETE &Delete\tDel +CMD_PROPERTY P&roperties...\tAlt+Enter +CMD_EXIT Cl&ose Connection Manager\tAlt+F4 +CMD_QUIT E&xit Connection Manager Program\tAlt+Q +# [Edit] menu +CMD_TOP_EDIT &Edit +CMD_SELECT_ALL Select &All\tCtrl+A +CMD_SWITCH_SELECT Sw&itch Selection +# [View] menu +CMD_TOP_VIEW &View +CMD_STATUSBAR Show &Status Bar +CMD_VISTASTYLE Windows Vista / 7 / 8 / 10 Styles +CMD_SHOWPORT Show &Ports on Connection List +CMD_TRAYICON Show Icons on &Task Tray +CMD_ICON &Icon +CMD_DETAIL &Detail +CMD_GRID Display &Grid +CMD_REFRESH &Refresh\tF5 +# [VLAN] menu +CMD_TOP_VLAN Virtua&l Adapter +CMD_NEW_VLAN &New Virtual Network Adapter...\tCtrl+L +CMD_ENABLE_VLAN &Enable Virtual Network Adapter\tCtrl+E +CMD_DISABLE_VLAN Dis&able Virtual Network Adapter\tCtrl+B +CMD_DELETE_VLAN &Delete Virtual Network Adapter\tDel +CMD_REINSTALL &Reinstall Driver...\tCtrl+U +CMD_WINNET Open Windows Network Connections...\tCtrl+W +# [Connect] menu +CMD_TOP_SECURE &Smart Card +CMD_SECURE_MANAGER Smart Card &Manager...\tCtrl+G +CMD_SECURE_SELECT &Select a Smart Card to Use... +# [Tools] menu +CMD_TOP_TOOL &Tools +CMD_PASSWORD Set &Password...\tCtrl+P +CMD_TRUST Manage &Trusted CA Certificate List\tCtrl+R +CMD_NETIF &Network Device Status... +CMD_TCPIP TCP Optimization &Utility... +CMD_MMCSS Optimization for Windows &Vista / 7 / 8 / 10... +CMD_TRAFFIC Network T&raffic Speed Test Tool...\tCtrl+Q +CMD_CM_SETTING Switch Operation &Mode... +CMD_LANGUAGE &Language Settings... +CMD_OPTION &Options...\tCtrl+O +# [Voice] menu +CMD_TOP_VOICE V&oice +CMD_VOIDE_NONE Voice Gui&de Off +CMD_VOICE_NORMAL &Normal Voice Guide +CMD_VOICE_ODD Extended V&oice Guide +# [Help] menu +CMD_TOP_HELP &Help +CMD_ABOUT &About... + + + + + + + + + + + + + + + + + +########################################################################### +# # +# Command prompt string data # +# # +########################################################################### + +PREFIX NULL + +# Console system general +CON_INFILE_ERROR Error: Unable to open the specified input file "%s". +CON_OUTFILE_ERROR Error: Unable to create the specified output file "%s". +CON_INFILE_START The commands written in the file "%s" will be used instead of input from keyboard. +CON_OUTFILE_START The message output to the console will be saved in the file "%s". +CON_USER_CANCEL [EOF] +CON_UNKNOWN_CMD "%S": Command not found. \nYou can use the HELP command to view a list of the available commands. +CON_AMBIGUOUS_CMD "%S": The command-name is ambiguous. +CON_AMBIGUOUS_CMD_1 The specified command name matches the following multiple commands. +CON_AMBIGUOUS_CMD_2 Please re-specify the command name more strictly. +CON_INVALID_PARAM The parameter "/%S" has been specified. It is not possible to specify this parameter when using the command "%S". Input "%S /HELP" to see the list of what parameters can be used. +CON_AMBIGUOUS_PARAM "%S": The parameter name is ambiguous. +CON_AMBIGUOUS_PARAM_1 The specified parameter name matches with the following parameters that can be specified as a parameter of command "%S". +CON_AMBIGUOUS_PARAM_2 Please re-specify the parameter name more strictly. + + +# Unknown command +CMD_UNKNOWM There is no description for this command. +CMD_UNKNOWN_HELP There is no detailed description for this command. If you would like to know more detail about this command, please refer to the manual or online documentation. +CMD_UNKNOWN_ARGS There is no command execution example. +CMD_UNKNOWN_PARAM There is no description for this parameter. + + +# Strings being used within console system +CMD_HELP_1 You can use the following %u commands: +CMD_HELP_2 To reference the usage for each command, input "command name ?" to view a help. +CMD_EVAL_MIN_MAX You must specify an integer in the range from %u to %u for the value. +CMD_PROMPT Enter a value: +CMD_EVAL_NOT_EMPTY You cannot make a blank specification. +CMD_EVAL_SAFE The string contains unusable characters. +CMD_EVAL_INT You must specify an integer that is not less than 1. +CMD_HELP_TITLE Help for command "%S" +CMD_HELP_DESCRIPTION Purpose: +CMD_HELP_USAGE Usage: +CMD_HELP_HELP Description: +CMD_HELP_ARGS Parameters: +CMD_PROMPT_PORT Input the port number: +CMD_EVAL_PORT Port number is invalid. Specify a port number that is within the range of 1 to 65535. +CMD_CT_STD_COLUMN_1 Item +CMD_CT_STD_COLUMN_2 Value +CMD_CT_STD_COLUMN_3 Description +CMD_PARSE_IP_SUBNET_ERROR_1_6 Specify in the format of "IPv6 address/subnet mask". \nSpecify the IPv6 address by separating the hexadecimal values using colons such as "2001:200:0:1::". For the subnet mask, either specify hexadecimal values separated by colons such as "ffff:ffff:ffff:ffff::", or you can specify the bit length of subnet mask using a decimal value such as 64. \nTo specify a standalone host, specify the subnet mask as either "ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff" or "128". \n(Example)\n2001:200:0:1::/64\n2001:200:0:1::/ffff:ffff:ffff:ffff::\n2001:200:0:1::5/12\n\n +CMD_PARSE_IP_SUBNET_ERROR_1 Specify in the format of "IPv4 address/subnet mask". \nSpecify the IPv4 address by separating the decimal values using dots such as "192.168.0.1". For the subnet mask, either specify decimal values separated by dots such as "255.255.255.0", or you can specify the bit length of subnet mask using a decimal value such as 24. \nTo specify a standalone host, specify the subnet mask as either "255.255.255.255" or "32". \n(Example)\n 192.168.0.1/24\n 192.168.0.1/255.255.255.0\n192.168.0.5/255.255.255.255\n\n +CMD_PARSE_IP_SUBNET_ERROR_2 The specified IP address is not a network address. +CMD_PARSE_IP_SUBNET_ERROR_3 The specified IP address is not a network prefix address. +CMD_EVAL_DATE_TIME_FAILED The date and time specification is invalid. \nThe date and time must be in the same format as "2005/10/08 19:30:00" where 6 integers are specified, representing year/month/day hour:minute:second separated by forward slashes, a space and then colons. Specify 4 digits for the year. +CMD_PARSE_IP_MASK_ERROR_1_6 Specify in the format of "IPv6 address/mask". \nSpecify the IPv6 address by separating the hexadecimal values using colons such as "2001:200:0:1::". For the mask, either specify hexadecimal values separated by colons such as "ffff:ffff:ffff:ffff::", or you can specify the bit length of mask using a decimal value such as 64. \nTo specify a standalone host, specify the mask as either "ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff" or "128". \n(Example)\n2001:200:0:1::/64\n2001:200:0:1::/ffff:ffff:ffff:ffff::\n2001:200:0:1::5/12\n\n +CMD_PARSE_IP_MASK_ERROR_1 Specify in the format of "IPv4 address/mask". \nSpecify the IPv4 address by separating the decimal values using dots such as "192.168.0.1". For the mask, either specify decimal values separated by dots such as "255.255.255.0", or you can specify the bit length of mask using a decimal value such as 24. \nTo specify a standalone host, specify the mask as either "255.255.255.255" or "32". \n(Example)\n 192.168.0.1/24\n 192.168.0.1/255.255.255.0\n192.168.0.5/255.255.255.255\n\n + + + +# Common messages +CMD_MSG_INVALID_HOSTNAME Specified host name is invalid. +CMD_MSG_OK The command completed successfully. +CMD_MSG_ALLOW Allow +CMD_MSG_DENY Deny +CMD_MSG_INFINITE Infinite +CMD_MSG_ENABLE Enable +CMD_MSG_DISABLE Disable +CMD_MSG_LOAD_CERT_FAILED Unable to read the specified X.509 certificate file. +CMD_MSG_SAVE_CERT_FAILED Failed to write the X.509 certificate file. +CMD_ACCOUNT_COLUMN_NAME VPN Connection Setting Name +CMD_ACCOUNT_COLUMN_HOSTNAME Destination VPN Server Host Name +CMD_ACCOUNT_COLUMN_PORT Destination VPN Server Port Number +CMD_ACCOUNT_COLUMN_HUBNAME Destination VPN Server Virtual Hub Name +CMD_ACCOUNT_COLUMN_PROXY_TYPE Proxy Server Type +CMD_ACCOUNT_COLUMN_PROXY_HOSTNAME Proxy Server Host Name +CMD_ACCOUNT_COLUMN_PROXY_PORT Proxy Server Port Number +CMD_ACCOUNT_COLUMN_PROXY_USERNAME Proxy Server User Name +CMD_ACCOUNT_COLUMN_SERVER_CERT_USE Verify Server Certificate +CMD_ACCOUNT_COLUMN_SERVER_CERT_NAME Registered Server Individual Certificate +CMD_ACCOUNT_COLUMN_RETRY_ON_SERVER_CERT Retry on Untrusted Server Certificate +CMD_ACCOUNT_COLUMN_DEVICE_NAME Device Name Used for Connection +CMD_ACCOUNT_COLUMN_AUTH_TYPE Authentication Type +CMD_ACCOUNT_COLUMN_AUTH_USERNAME User Name +CMD_ACCOUNT_COLUMN_AUTH_CERT_NAME Client Certificate for Authentication Use +CMD_ACCOUNT_COLUMN_NUMTCP Number of TCP Connections to Use in VPN Communication +CMD_ACCOUNT_COLUMN_TCP_INTERVAL Interval between Establishing Each TCP Connection +CMD_ACCOUNT_COLUMN_TCP_TTL Connection Life of Each TCP Connection +CMD_ACCOUNT_COLUMN_TCP_HALF Use Half Duplex Mode +CMD_ACCOUNT_COLUMN_ENCRYPT Encryption by SSL +CMD_ACCOUNT_COLUMN_COMPRESS Data Compression +CMD_ACCOUNT_COLUMN_BRIDGE_ROUTER Connect by Bridge / Router Mode +CMD_ACCOUNT_COLUMN_MONITOR Connect by Monitoring Mode +CMD_ACCOUNT_COLUMN_NO_TRACKING No Adjustment for Routing Table +CMD_ACCOUNT_COLUMN_QOS_DISABLE Do not Use QoS Control Function +CMD_ACCOUNT_COLUMN_DISABLEUDP Disable UDP Acceleration + + +# Debugging Information Collecting Tool +CMD_DEBUG_SOFTNAME Debugging Information Collecting Tool +CMD_DEBUG_PRINT Debugging Information Collecting Tool\r\n\r\n +CMD_DEBUG_NOT_2000 Windows 2000 or later is required. +CMD_DEBUG_NOT_ADMIN You must login as Administrators on Windows to execute this command. +CMD_DEBUG_UAC_FAILED Failed to obtain the Administrators privilege. +CMD_DEBUG_SAVE_TITLE Specify Destination Path to Save File +CMD_DEBUG_OK A debugging information file was saved as "%s".\r\n\r\nSend this file to your support staff.\r\nYou must verify the contents of this file before sending it to the support staff.\r\nRemove confidential information on this file with your responsibility and by yourself if there are some confidential information which you don't want to disclose it to the staff.\r\n\r\nIf you ignore the confidential information contained on the file, and you agree to send the entire file to the support staff, it means that you have agreed to disclose the entire contents of the file to the support staff. +CMD_DEBUG_NG Failed to save the debugging information as "%s". + + + +# TEST command +CMD_TEST Executing test operation. +CMD_TEST_HELP This is a test command. Executing test operation. With the test command, you can specify a number of arguments. You can omit the number of arguments. +CMD_TEST_ARGS Test [/A1:a_str] [/A2:b_str] [/A3:int_value] +CMD_TEST_A1 Specifies parameter A1. This can be omitted. +CMD_TEST_A2 Specifies parameter A2. If this is omitted, a prompt will be displayed to input parameter A2 when the command is executed. You cannot make a blank specification. +CMD_TEST_A3 Specify a numeric value. You must specify an integer that is within the range of 1 to 100. Specifying an integer outside that range will cause an error message to be displayed. +CMD_TEST_EVAL_A2 You cannot make a blank specification for parameter A2. +CMD_IP_EVAL_FAILED The IP address is incorrectly specified. +CMD_HOSTPORT_EVAL_FAILED The host name and port number specification is invalid. \nPlease specify using the format of host name:port number, or IP address:port number. +CMD_PORTLIST_EVAL_FAILED The port number list specification is invalid. \nThe list must have at least one port number set, and it is also possible to set multiple port numbers. When specifying multiple port numbers, separate them using a comma such as "443,992,8888". +CMD_PROTOCOL_EVAL_FAILED The protocol is incorrectly specified. Specify either ip, tcp, udp, icmpv4, icmpv6 or a protocol number (0 to 255) for the protocol. +CMD_PORT_RANGE_EVAL_FAILED The port number or the port number range was incorrectly specified. If specifying only one port number, an integer must be used to specify that port number. If specifying multiple ports, specify the beginning port number and the end port number joined together by a hyphen like "80-443". +CMD_TCP_CONNECTION_STATE_EVAL_FAILED The TCP connection state specification is invalid. Specify either "Established" or "Unestablished" and specify TCP when selecting protocol. +CMD_MAC_ADDRESS_AND_MASK_EVAL_FAILED The MAC address and mask specification is invalid. Use hexadecimal number with the separators, "-" or ":", and without the separators. An example is "00-AC-84-EA-33-BC/FF-FF-FF-FF-FF-FF". +CMD_EXEC_MSG_NAME %S command - %s +CMD_ID ID +CMD_FILE_NOT_FOUND Cannot find specified file "%s". +CMD_FILE_NAME_EMPTY The file name is not specified. +CMD_SAVECERTPATH Save X.509 certificate to file name: +CMD_SAVECERT_FAILED Failed to save the certificate file. +CMD_SAVEKEYPATH Save private key to file name: +CMD_SAVEKEY_FAILED Failed to save the private key file. +CMD_SAVEFILE_FAILED Failed to save the file. +CMD_LOADFILE_FAILED Failed to open the file. +CMD_LOADCERTPATH Read X.509 certificate from file name: +CMD_LOADCERT_FAILED Failed to read certificate file. +CMD_LOADKEYPATH Read private key from file name: +CMD_LOADKEY_FAILED Failed to read private key file. +CMD_LOADKEY_ENCRYPTED_1 The specified private key file is protected by a passphrase. +CMD_LOADKEY_ENCRYPTED_2 Please enter the passphrase: +CMD_LOADKEY_ENCRYPTED_3 The passphrase is incorrect. +CMD_KEYPAIR_FAILED The X.509 certificate and private key combination has been incorrectly specified. \r\nA certificate and a private key that corresponds to that certificate is required. +CMD_CERT_NOT_EXISTS The certificate is not registered. +CMD_NO_SETTINGS - +CMD_DISCONNECTED_MSG \n--- Error ---\n\nThe communication session with the host you were managing has been disconnected. From now on, if you run any commands an error will occur. \n\nTo reconnect to the host you were managing, first leave the prompt by inputting "EXIT" and then reconnect. \n\n + + +# VPNCMD コマンド +CMD_VPNCMD SoftEther VPN Command Line Management Utility Developer Edition +CMD_VPNCMD_HELP The 'vpncmd' program is a utility that allows you to manage SoftEther VPN software by using command lines. By using vpncmd, you can connect to a VPN Client, a VPN Server or VPN Bridge that is running on a local or remote computer and manage these services. Moreover, by using VPN Tools mode, you can call the Network Traffic Speed Test Tool and the certificate creation function. These can be used even when not connected to the VPN Server or VPN Client. \nWhen using vpncmd, if the file name is specified by using the /IN and /OUT parameter, the command can be executed in a batch according to a file in which the executable commands are enumerated and the execution results can be written to a file. Normally a command prompt will appear after vpncmd is launched but when an input file is specified by the /IN parameter, the program will automatically terminate after the execution of all lines in the input file is complete. Also, when a command to execute is specified by the /CMD parameter, the program will automatically terminate after the execution of that command is complete. You cannot specify the /IN parameter and the /CMD parameter at the same time. The termination code of the vpncmd program will be the error code of the last executed command (0 in the case of successful execution). \nUnder a Windows environment, when vpncmd is launched once or more by a user with administrator privileges, it is possible to simply input 'vpncmd' to a Windows command prompt or [Run...] window to launch vpncmd. To achieve the same result under a UNIX system, you can manually set, as appropriate, the PATH environment variable. +CMD_VPNCMD_ARGS vpncmd [host:port] [/CLIENT|/SERVER|/TOOLS] [/HUB:hub] [/ADMINHUB:adminhub] [/PASSWORD:password] [/IN:infile] [/OUT:outfile] [/CMD commands...] +CMD_VPNCMD_[host:port] By specifying parameters in the format "host name:port number", a connection will automatically be made to that host. If this is not specified, a prompt will appear to input the connection destination. When connecting to a VPN Client, you cannot specify a port number. +CMD_VPNCMD_CLIENT This will connect to VPN Client to do management. You cannot specify it together with /SERVER. +CMD_VPNCMD_SERVER This will connect to VPN Server or VPN Bridge to do management. You cannot specify it together with /CLIENT. +CMD_VPNCMD_TOOLS This will enables use of VPN Tools commands. VPN Tools include the simple certificate creation tool (MakeCert command) and the Network Traffic Speed Test Tool (SpeedTest command). +CMD_VPNCMD_HUB When connecting to the VPN Server by "Virtual Hub Admin Mode", this specifies the Virtual Hub name 'hub'. If you specify the host name but not the /HUB parameter, connection will be by "Server Admin Mode". +CMD_VPNCMD_ADMINHUB This will specify the name of the Virtual Hub 'adminhub' that is automatically selected after connecting to the VPN Server. If the /HUB parameter was specified, the Virtual Hub will be selected automatically and this specification will not be necessary. +CMD_VPNCMD_PASSWORD If the administrator password is required when connecting, specify the password 'password'. When the password is not specified, a prompt to input the password will be displayed. +CMD_VPNCMD_IN This will specify the text file 'infile' that contains the list of commands that are automatically executed after the connection is completed. If the /IN parameter is specified, the vpncmd program will terminate automatically after the execution of all commands in the file are finished. If the file contains multiple-byte characters, the encoding must be Unicode (UTF-8). This cannot be specified together with /CMD (if /CMD is specified, /IN will be ignored). +CMD_VPNCMD_OUT You can specify the text file 'outfile' to write all strings such as onscreen prompts, message, error and execution results. Note that if the specified file already exists, the contents of the existing file will be overwritten. Output strings will be recorded using Unicode (UTF-8) encoding. +CMD_VPNCMD_CMD If the optional command 'commands...' is included after /CMD, that command will be executed after the connection is complete and the vpncmd program will terminate after that. This cannot be specified together with /IN (if specified together with /IN, /IN will be ignored). Specify the /CMD parameter after all other vpncmd parameters. +CMD_VPNCMD_CSV You can specify this option to enable CSV outputs. Results of each command will be printed in the CSV format. It is useful for processing the results by other programs. +CMD_VPNCMD_CS_1 By using vpncmd program, the following can be achieved. \n\n1. Management of VPN Server or VPN Bridge \n2. Management of VPN Client\n3. Use of VPN Tools (certificate creation and Network Traffic Speed Test Tool)\n\n +CMD_VPNCMD_CS_2 Select 1, 2 or 3: +CMD_VPNCMD_HOST_1 Specify the host name or IP address of the computer that the destination VPN Server or VPN Bridge is operating on. \nBy specifying according to the format 'host name:port number', you can also specify the port number. \n(When the port number is unspecified, 443 is used.)\nIf nothing is input and the Enter key is pressed, the connection will be made to the port number 443 of localhost (this computer). +CMD_VPNCMD_HOST_2 Specify the host name or IP address of the computer that the destination VPN Client is operating on. \nIf nothing is input and Enter is pressed, connection will be made to localhost (this computer). +CMD_VPNCMD_HOST_3 Hostname of IP Address of Destination: +CMD_VPNCMD_HUB_1 If connecting to the server by Virtual Hub Admin Mode, please input the Virtual Hub name. \nIf connecting by server admin mode, please press Enter without inputting anything. +CMD_VPNCMD_HUB_2 Specify Virtual Hub Name: +CMD_VPNCMD_ABOUT SoftEther VPN Command Line Management Utility (vpncmd command)\nDeveloper Edition\n%S\n%S\nCopyright (c) all contributors on SoftEther VPN project in GitHub.\nCopyright (c) Daiyuu Nobori, SoftEther Project at University of Tsukuba, and SoftEther Corporation.\nAll rights reserved.\n +CMD_VPNCMD_PASSWORD_1 Access has been denied. Possibly the password is incorrect, or perhaps you are connecting by an incorrect admin mode. You can try inputting the password again. To cancel, press Ctrl+D. +CMD_VPNCMD_PASSWORD_2 Password: +CMD_VPNCMD_ERROR Error occurred. (Error code: %u)\n%s +CMD_VPNCMD_SERVER_CONNECTED Connection has been established with VPN Server "%S" (port %u). +CMD_VPNCMD_SERVER_CONNECTED_1 You have administrator privileges for the entire VPN Server. +CMD_VPNCMD_SERVER_CONNECTED_2 You have administrator privileges for Virtual Hub '%S' on the VPN Server. +CMD_VPNCMD_CLIENT_NO_REMODE The destination VPN Client server does not allow administrating connections from remote computers. Launch the command line management utility or VPN Client Manager on the computer that VPN Client is running on and connect to localhost. +CMD_VPNCMD_PWPROMPT_0 Please enter the password. To cancel press the Ctrl+D key. +CMD_VPNCMD_PWPROMPT_1 Password: +CMD_VPNCMD_PWPROMPT_2 Confirm input: +CMD_VPNCMD_PWPROMPT_3 The password and the password confirmation do not match. Please input the password and confirmation again. +CMD_VPNCMD_CLIENT_CONNECTED Connected to VPN Client "%S". +CMD_VPNCMD_TOOLS_CONNECTED VPN Tools has been launched. By inputting HELP, you can view a list of the commands that can be used. + + +####################################################### +# # +# Management commands for VPN Server are listed below # +# # +####################################################### + + + +# About command +CMD_About Display the version information +CMD_About_HELP This displays the version information of this command line management utility. Included in the version information are the vpncmd version number, build number and build information. +CMD_About_ARGS About + + +# ServerInfoGet command +CMD_ServerInfoGet Get server information +CMD_ServerInfoGet_Help This allows you to obtain the server information of the currently connected VPN Server or VPN Bridge. Included in the server information are the version number, build number and build information. You can also obtain information on the current server operation mode and the information of operating system that the server is operating on. +CMD_ServerInfoGet_Args ServerInfoGet + + +# ServerStatusGet command +CMD_ServerStatusGet Get Current Server Status +CMD_ServerStatusGet_Help This allows you to obtain in real-time the current status of the currently connected VPN Server or VPN Bridge. You can get statistical information on data communication and the number of different kinds of objects that exist on the server. You can get information on how much memory is being used on the current computer by the OS. +CMD_ServerStatusGet_Args ServerStatusGet + + +# ListenerCreate command +CMD_ListenerCreate Create New TCP Listener +CMD_ListenerCreate_Help This allows you to create a new TCP Listener on the server. By creating the TCP Listener the server starts listening for a connection from clients at the specified TCP/IP port number. \nA TCP Listener that has been created can be deleted by the ListenerDelete command. \nYou can also get a list of TCP Listeners currently registered by using the ListenerList command. \nnTo execute this command, you must have VPN Server administrator privileges. +CMD_ListenerCreate_Args ListenerCreate [port] +CMD_ListenerCreate_[port] Using an integer, specify the newly added TCP/IP listener port number. You can also use a port number that is already being used by a different program; however the VPN Server will not be able to use it until that program ends the use of that port. Specify a port number that is within the range of 1 to 65535. +CMD_ListenerCreate_PortPrompt Port number of newly added TCP/IP Listener: + + +# ListenerDelete command +CMD_ListenerDelete Delete TCP Listener +CMD_ListenerDelete_Help This allows you to delete a TCP Listener that's registered on the server. When the TCP Listener is in a state of operation, the listener will automatically be deleted when its operation stops. \nYou can also get a list of TCP Listeners currently registered by using the ListenerList command. \nTo execute this command, you must have VPN Server administrator privileges. +CMD_ListenerDelete_Args ListenerDelete [port] +CMD_ListenerDelete_[port] Using an integer, specify the TCP/IP listener port number you want to delete. +CMD_ListenerDelete_PortPrompt Port number of TCP/IP Listener: + + +# ListenerList command +CMD_ListenerList Get List of TCP Listeners +CMD_ListenerList_Help This allows you to get a list of TCP listeners registered on the current server. You can obtain information on whether the various TCP listeners have a status of operating or error. \nTo execute this command, you must have VPN Server administrator privileges. +CMD_ListenerList_Args ListenerList +CMD_ListenerList_Column1 TCP Port Number +CMD_ListenerList_Column2 Status + + +# ListenerEnable command +CMD_ListenerEnable Begin TCP Listener Operation +CMD_ListenerEnable_Help This starts the operation of stopped TCP Listeners registered on the current server. \nYou can also get a list of TCP Listeners currently registered by using the ListenerList command. \nTo execute this command, you must have VPN Server administrator privileges. +CMD_ListenerEnable_Args ListenerEnable [port] +CMD_ListenerEnable_[port] Using an integer, specify the port number of the TCP/IP listener you want to start. +CMD_ListenerEnable_PortPrompt Port number of TCP/IP Listener to start: + + +# ListenerDisable command +CMD_ListenerDisable Stop TCP Listener Operation +CMD_ListenerDisable_Help This stops the operation of operating TCP Listeners registered on the current server. \nYou can also get a list of TCP Listeners currently registered by using the ListenerList command. \nTo execute this command, you must have VPN Server administrator privileges. +CMD_ListenerDisable_Args ListenerDisable [port] +CMD_ListenerDisable_[port] Using an integer, specify the port number of the TCP/IP listener you want to stop. +CMD_ListenerDisable_PortPrompt Port number of TCP/IP Listener to start: + + +# PortsUDPSet command +CMD_PortsUDPSet Sets the UDP ports that the server should listen on +CMD_PortsUDPSet_Help This command can be used to specify a single or multiple UDP ports the server should listen on. \nYou can specify a port that is used by another process, however the server will not be able to use it until the port becomes free. \nSpecify a port number that is within the range of 1 to 65535. \nYou can list the ports that are currently set with the PortsUDPGet command. \nTo execute this command, you must have VPN Server administrator privileges. +CMD_PortsUDPSet_Args PortsUDPSet [ports] +CMD_PortsUDPSet_[ports] Multiple UDP ports can be specified by splitting them with a space or a comma, for example: "443, 992, 1194, 5555". \nSpecify "0" to disable the UDP listener. \n\nPorts: + + +# PortsUDPGet command +CMD_PortsUDPGet Lists the UDP ports that the server is listening on +CMD_PortsUDPGet_Help This command can be used to retrieve the UDP ports the server is listening on. \nYou can set the ports with the PortsUDPSet command. +CMD_PortsUDPGet_Args PortsUDPGet +CMD_PortsUDPGet_Ports UDP ports + + +# ProtoOptionsSet command +CMD_ProtoOptionsSet Sets an option's value for the specified protocol +CMD_ProtoOptionsSet_Help This command can be used to change an option's value for a specific protocol. \nYou can retrieve the options using the ProtoOptionsGet command. \nTo execute this command, you must have VPN Server administrator privileges. +CMD_ProtoOptionsSet_Args ProtoOptionsSet [protocol] [/NAME:option_name] [/VALUE:string/true/false] +CMD_ProtoOptionsSet_[protocol] Protocol name. +CMD_ProtoOptionsSet_NAME Option name. +CMD_ProtoOptionsSet_VALUE Option value. Make sure to write a value that is accepted by the specified protocol! +CMD_ProtoOptionsSet_Prompt_[protocol] Protocol: +CMD_ProtoOptionsSet_Prompt_NAME Option: +CMD_ProtoOptionsSet_Prompt_VALUE Value: + + +# ProtoOptionsGet command +CMD_ProtoOptionsGet Lists the options for the specified protocol +CMD_ProtoOptionsGet_Help This command can be used to retrieve the options for a specific protocol. \nDetailed info (e.g. value type) will be shown. \nYou can change an option's value with the ProtoOptionsSet command. +CMD_ProtoOptionsGet_Args ProtoOptionsGet [protocol] +CMD_ProtoOptionsGet_[protocol] Protocol name. +CMD_ProtoOptionsGet_Prompt_[protocol] Protocol: +CMD_ProtoOptionsGet_Column_Name Name +CMD_ProtoOptionsGet_Column_Type Type +CMD_ProtoOptionsGet_Column_Value Value +CMD_ProtoOptionsGet_Column_Description Description + +# ProtoOptions +CMD_ProtoOptions_Description_OpenVPN_DefaultClientOption When OpenVPN is compiled without OCC code, it doesn't send the options string to the server. The original OpenVPN server still works, because the configuration is static. SoftEther VPN is heuristic and wants to support as many different configurations as possible. This option allows to define the string that is sent to clients built without OCC code, so that they can successfully connect. +CMD_ProtoOptions_Description_OpenVPN_Obfuscation This may help an OpenVPN client bypass firewalls that are aware of the protocol and block it. The same XOR mask has to be applied client-side, otherwise it will not be able to connect with certain obfuscation methods! +CMD_ProtoOptions_Description_OpenVPN_ObfuscationMask Mask used to XOR the bytes in the packet (used for certain obfuscation modes). +CMD_ProtoOptions_Description_OpenVPN_PushDummyIPv4AddressOnL2Mode There's a bug that manifests under certain circumstances on Linux. It causes the OpenVPN client to disconnect unless the TAP device is UP. This option tells the server to push a dummy IPv4 address (RFC7600) to the client, so that the TAP adapter is forced to be UP. + +# ServerPasswordSet command +CMD_ServerPasswordSet Set VPN Server Administrator Password +CMD_ServerPasswordSet_Help This sets the VPN Server administrator password. You can specify the password as a parameter. If the password is not specified, a prompt will be displayed to input the password and password confirmation. If you include the password as a parameter, this password will be displayed momentarily on the screen, which poses a risk. We recommend that whenever possible, avoid specifying this parameter and input the password using the password prompt. \nTo execute this command, you must have VPN Server administrator privileges. +CMD_ServerPasswordSet_Args ServerPasswordSet [password] +CMD_ServerPasswordSet_[password] This specifies a new password setting. + + +# ClusterSettingGet command +CMD_ClusterSettingGet Get Clustering Configuration of Current VPN Server +CMD_ClusterSettingGet_Help You can use this to acquire the clustering configuration of the current VPN Server. \nTo execute this command, you must have VPN Server administrator privileges. +CMD_ClusterSettingGet_Args ClusterSettingGet +CMD_ClusterSettingGet_Current Current Configuration +CMD_ClusterSettingGet_None (No setting) +CMD_ClusterSettingGet_PublicIp Public IP Address +CMD_ClusterSettingGet_PublicPorts List of Public Ports +CMD_ClusterSettingGet_Controller Destination Controller +CMD_ClusterSettingGet_ControllerOnly Controller Function Only +CMD_ClusterSettingGet_Weight Performance Standard in Cluster + + +# ClusterSettingStandalone command +CMD_ClusterSettingStandalone Set VPN Server Type as Standalone +CMD_ClusterSettingStandalone_Help Use this to set the VPN Server type as Standalone Server. Standalone server means a VPN Server that does not belong to any cluster in its current state. When VPN Server is installed, by default it will be in standalone server mode. Unless you have particular plans to configure a cluster, we recommend the VPN Server be operated in standalone mode. \nTo execute this command, you must have VPN Server administrator privileges. \nAlso, when this command is executed, VPN Server will automatically restart. \nThis command cannot be run on VPN Bridge. +CMD_ClusterSettingStandalone_Args ClusterSettingStandalone + + +# ClusterSettingController command +CMD_ClusterSettingController Set VPN Server Type as Cluster Controller +CMD_ClusterSettingController_Help Use this to set the VPN Server type as Cluster Controller. A cluster controller is the central computer of all member servers of a cluster in the case where a clustering environment is made up of multiple VPN Servers. A cluster requires one computer to serve this role. The other cluster member servers that are configured in the same cluster begin operation as a cluster member by connecting to the cluster controller. \nTo execute this command, you must have VPN Server administrator privileges. \nAlso, when this command is executed, VPN Server will automatically restart. \nThis command cannot be run on VPN Bridge. +CMD_ClusterSettingController_Args ClusterSettingController [/WEIGHT:weight] [/ONLY:yes|no] +CMD_ClusterSettingController_WEIGHT This sets a value for the performance standard ratio of this VPN Server. This is the standard value for when load balancing is performed in the cluster. Normally it is 100. For example, making only one machine 200 while the other members have a status of 100, will regulate that machine to receive twice as many connections as the other members during load balancing. Specify 1 or higher for the value. If this parameter is left unspecified, 100 will be used. +CMD_ClusterSettingController_ONLY By specifying "yes" here, the VPN Server will operate only as a controller on the cluster and it will always distribute general VPN Client connections to members other than itself. This function is used in high-load environments. If this parameter is left unspecified, "no" will be used. + + +# ClusterSettingMember command +CMD_ClusterSettingMember Set VPN Server Type as Cluster Member +CMD_ClusterSettingMember_Help Use this to set the VPN Server type as Cluster Member Server. A cluster member server is a member computer belonging to a clustering configuration made up of multiple VPN Servers with another existing cluster controller as the center. Multiple cluster members can be added to the cluster as required. \nBefore setting the VPN Server as a cluster member server, first ask the administrator of the cluster controller to be used for the controller's IP address and port number, the public IP address and public port number (when required) of this VPN Server and the password. \nTo execute this command, you must have VPN Server administrator privileges. \nAlso, when this command is executed, VPN Server will automatically restart. \nThis command cannot be run on VPN Bridge. +CMD_ClusterSettingMember_Args ClusterSettingMember [server:port] [/IP:ip] [/PORTS:ports] [/PASSWORD:password] [/WEIGHT:weight] +CMD_ClusterSettingMember_[server:port] Specify the host name or IP address, and port number of the destination cluster controller using the parameter with the format host name:port number. +CMD_ClusterSettingMember_IP Specify the public IP address of this server. If you wish to leave public IP address unspecified, specify it like this: "/IP:none". When a public IP address is not specified, the IP address of the network interface used when connecting to the cluster controller will be automatically used. +CMD_ClusterSettingMember_PORTS Use this to specify the list of public port numbers on this server. The list must have at least one public port number set, and it is also possible to set multiple public port numbers. When specifying multiple port numbers, separate them using a comma such as "/PORTS443,992,8888". +CMD_ClusterSettingMember_PASSWORD Specify the password required to connect to the destination controller. It needs to be the same as an administrator password on the destination controller. +CMD_ClusterSettingMember_WEIGHT This sets a value for the performance standard ratio of this VPN Server. This is the standard value for when load balancing is performed in the cluster. For example, making only one machine 200 while the other members have a status of 100, will regulate that machine to receive twice as many connections as the other members. Specify 1 or higher for the value. If this parameter is left unspecified, 100 will be used. +CMD_ClusterSettingMember_Prompt_IP_1 Specify a public IP address. \nIf you wish to leave this unspecified, press Enter without inputting anything. +CMD_ClusterSettingMember_Prompt_IP_2 Public IP Address: +CMD_ClusterSettingMember_Prompt_PORT_1 Please specify a list of public port numbers. \nWhen specifying 2 or more port numbers, separate each entry with a comma, like: 444,992,888. +CMD_ClusterSettingMember_Prompt_PORT_2 Public Port Number: +CMD_ClusterSettingMember_Prompt_HOST_1 Destination Controller Host Name and Port Number: + + +# ClusterMemberList command +CMD_ClusterMemberList Get List of Cluster Members +CMD_ClusterMemberList_Help Use this command when the VPN Server is operating as a cluster controller to get a list of the cluster member servers on the same cluster, including the cluster controller itself. \nFor each member, the following information is also listed. Type, Connection Start, Host Name, Points, Number of Session, Number of TCP Connections, Number of Operating Virtual Hubs, Using Client Connection License and Using Bridge Connection License. \nThis command cannot be run on VPN Bridge. +CMD_ClusterMemberList_Args ClusterMemberList + + +# ClusterMemberInfoGet command +CMD_ClusterMemberInfoGet Get Cluster Member Information +CMD_ClusterMemberInfoGet_Help When the VPN Server is operating as a cluster controller, you can get information on cluster member servers on that cluster by specifying the IDs of the member servers. \nYou can get the following information about the specified cluster member server: Server Type, Time Connection has been Established, IP Address, Host Name, Points, Public Port List, Number of Operating Virtual Hubs, First Virtual Hub, Number of Sessions and Number of TCP Connections. \nThis command cannot be run on VPN Bridge. +CMD_ClusterMemberInfoGet_Args ClusterMemberInfoGet [id] +CMD_ClusterMemberInfoGet_[id] Specify the ID of the cluster member whose information you want to get. You can obtain the cluster member server ID by using the ClusterMemberList command. +CMD_ClusterMemberInfoGet_PROMPT_ID Cluster Member ID to Get Info: + + +# ClusterMemberCertGet command +CMD_ClusterMemberCertGet Get Cluster Member Certificate +CMD_ClusterMemberCertGet_Help When the VPN Server is operating as a cluster controller, you can get the public X.509 certificate of cluster member servers on that cluster by specifying the IDs of those member servers. You can save the certificate as an X.509 format file. \nThis command cannot be run on VPN Bridge. +CMD_ClusterMemberCertGet_Args ClusterMemberCertGet [id] [/SAVECERT:cert] +CMD_ClusterMemberCertGet_[id] Specify the ID of the cluster member whose certificate you want to get. You can obtain the cluster member server ID by using the ClusterMemberList command. +CMD_ClusterMemberCertGet_SAVECERT Specify the file path name to save the certificate you obtained. You can save the certificate in X.509 format. +CMD_ClusterMemberCertGet_PROMPT_ID Cluster Member ID to Get Certificate: + +# ClusterConnectionStatusGet command +CMD_ClusterConnectionStatusGet Get Connection Status to Cluster Controller +CMD_ClusterConnectionStatusGet_Help Use this command when the VPN Server is operating as a cluster controller to get the status of connection to the cluster controller. \nYou can get the following information: Controller IP Address, Port Number, Connection Status, Connection Start Time, First Connection Established Time, Current Connection Established Time, Number of Connection Attempts, Number of Successful Connections, Number of Failed Connections. \nThis command cannot be run on VPN Bridge. +CMD_ClusterConnectionStatusGet_Args ClusterConnectionStatusGet + + +# Debug command +CMD_Debug Execute a Debug Command +CMD_Debug_Help Runs a debug command on the running VPN Server / Bridge process.\nThis command should be executed wjen the support staff requests to do so.\nMisuse of this command might cause a crash of VPN Server / Bridge running. +CMD_Debug_Args Debug [id] [/ARG:arg] +CMD_Debug_[id] Specify a debug command number. +CMD_Debug_ARG Specify a string to pass to the debug command. If a string contains spaces, contains the whole command by " ". +CMD_Debug_Msg1 Sending the debug command... +CMD_Debug_Msg2 The debug command has executed.\nResults: \"%S\" + + +# Crash command +CMD_Crash Raise a error on the VPN Server / Bridge to terminate the process forcefully. +CMD_Crash_Help This command will raise a fatal error (memory access violation) on the VPN Server / Bridge running process in order to crash the process. As the result, VPN Server / Bridge will be terminated and restarted if it is running as a service mode. If the VPN Server is running as a user mode, the process will not automatically restarted.\nThis command is for a situation when the VPN Server / Bridge is under a non-recoverable error or the process is in an infinite loop. This command will disconnect all VPN Sessions on the VPN Server / Bridge. All unsaved settings in the memory of VPN Server / Bridge will be lost.\nBefore run this command, run the Flush command to try to save volatile data to the configuration file.\nTo execute this command, you must have VPN Server / VPN Bridge administrator privileges. +CMD_Crash_Args Crash [yes] +CMD_Crash_[yes] Input "yes" for confirmation. +CMD_Crash_Msg Sending the Crush command to the VPN Server. The VPN Server will be let to crash immediately, so you can never get the result value of this command. After this moment, vpncmd will be disconnected from the VPN Server. +CMD_Crash_Confirm Do you really want to crash the VPN Server?\nInput "yes" if it is ok: +CMD_Crash_Aborted The Crash command has been aborted. + + +# Flush command +CMD_Flush Save All Volatile Data of VPN Server / Bridge to the Configuration File +CMD_Flush_Help Normally, the VPN Server / VPN Bridge retains the volatile configuration data in memory. It is flushed to the disk as vpn_server.config or vpn_bridge.config periodically. The period is 300 seconds (5 minutes) by default. (The period can be altered by modifying the AutoSaveConfigSpan item in the configuration file.) The data will be saved on the timing of shutting down normally of the VPN Server / Bridge.\nExecute the Flush command to make the VPN Server / Bridge save the settings to the file immediately. The setting data will be stored on the disk drive of the server computer. Use the Flush command in a situation that you do not have an enough time to shut down the server process normally.\nTo execute this command, you must have VPN Server administrator privileges. \nTo execute this command, you must have VPN Server / VPN Bridge administrator privileges. +CMD_Flush_Args Flush +CMD_Flush_Msg1 Writing volatile data from memory to the disk...\n +CMD_Flush_Msg2 Saving completed. The file size is %S bytes.\n + + +# ServerCertGet command +CMD_ServerCertGet Get SSL Certificate of VPN Server +CMD_ServerCertGet_Help Use this to get the SSL certificate that the VPN Server provides to the connected client. You can save the certificate as an X.509 format file. +CMD_ServerCertGet_Args ServerCertGet [cert] +CMD_ServerCertGet_[cert] Specify the file path name to save the certificate you obtained. You can save the certificate in X.509 format. + + +# ServerKeyGet command +CMD_ServerKeyGet Get SSL Certificate Private Key of VPN Server +CMD_ServerKeyGet_Help Use this to get the SSL certificate private key that the VPN Server provides to the connected client. You can save the private key as a Base 64 encoded file. \nTo execute this command, you must have VPN Server administrator privileges. +CMD_ServerKeyGet_Args ServerKeyGet [key] +CMD_ServerKeyGet_[key] Specify the file path name to save the private key you obtained. You can save the private key in a Base 64 encoded format. + + +# ServerCertSet command +CMD_ServerCertSet Set SSL Certificate and Private Key of VPN Server +CMD_ServerCertSet_Help You can set the SSL certificate that the VPN Server provides to the connected client and the private key for that certificate. The certificate must be in X.509 format and the private key must be Base 64 encoded format. \nTo execute this command, you must have VPN Server administrator privileges. +CMD_ServerCertSet_Args ServerCertSet [/LOADCERT:cert] [/LOADKEY:key] +CMD_ServerCertSet_LOADCERT Specify the X.509 format certificate file to use. +CMD_ServerCertSet_LOADKEY Specify the Base 64 encoded private key file for the certificate to use. + + +# ServerCipherGet command +CMD_ServerCipherGet Get the Encrypted Algorithm Used for VPN Communication. +CMD_ServerCipherGet_Help Use this to get the current setting of the algorithm used for the electronic signature and encrypted for SSL connection to be used for communication between the VPN Server and the connected client and the list of algorithms that can be used on the VPN Server. +CMD_ServerCipherGet_Args ServerCipherGet +CMD_ServerCipherGet_SERVER Encrypted Algorithm Currently Used by VPN Server: +CMD_ServerCipherGet_CIPHERS List of Usable Encrypted Algorithm Names: + +# ServerCipherSet command +CMD_ServerCipherSet Set the Encrypted Algorithm Used for VPN Communication. +CMD_ServerCipherSet_Help Use this to set the algorithm used for the electronic signature and encrypted for SSL connections to be used for communication between the VPN Server and the connected client. \nBy specifying the algorithm name, the specified algorithm will be used later between the VPN Client and VPN Bridge connected to this server and the data will be encrypted. \nTo execute this command, you must have VPN Server administrator privileges. +CMD_ServerCipherSet_Args ServerCipherSet [name] +CMD_ServerCipherSet_[name] This specifies the encrypted and electronic signature algorithm to set. You can obtain the list of usable algorithms by using the ServerCipherGet command. +CMD_ServerCipherSet_PROMPT_NAME Encrypted Algorithm Name to Specify: + +# KeepEnable command +CMD_KeepEnable Enable the Keep Alive Internet Connection Function +CMD_KeepEnable_Help This allows you to enable the Keep Alive Internet Connection Function. By using the Keep Alive Internet Connection Function for network connection environments where connections will automatically be disconnected when there are periods of no communication that are longer than a set period, it is possible to keep alive the Internet connection by sending packets to a nominated server on the Internet at set intervals. \nYou can set a destination host name etc, by using the KeepSet command. \nTo execute this command on a VPN Server or VPN Bridge, you must have administrator privileges. +CMD_KeepEnable_Args KeepEnable + + +# KeepDisable command +CMD_KeepDisable Disable the Keep Alive Internet Connection Function +CMD_KeepDisable_Help This allows you to disable the Keep Alive Internet Connection Function.\nTo execute this command on a VPN Server or VPN Bridge, you must have administrator privileges. +CMD_KeepDisable_Args KeepDisable + + +# KeepSet command +CMD_KeepSet Set the Keep Alive Internet Connection Function +CMD_KeepSet_Help Use this to set the destination host name etc. of the Keep Alive Internet Connection Function. For network connection environments where connections will automatically be disconnected where there are periods of no communication that are longer than a set period, by using the Keep Alive Internet Connection Function, it is possible to keep alive the Internet connection by sending packets to a nominated server on the Internet at set intervals. \nWhen using this command, you can specify the following: Host Name, Port Number, Packet Send Interval, and Protocol. \nPackets sent to keep alive the Internet connection will have random content and personal information that could identify a computer or user is not sent. \nYou can use the KeepEnable command or KeepDisable command to enable/disable the Keep Alive Internet Connection Function. KeepSet does not change the enabled/disabled status. \nTo execute this command on a VPN Server or VPN Bridge, you must have administrator privileges. +CMD_KeepSet_Args KeepSet [/HOST:host:port] [/PROTOCOL:tcp|udp] [/INTERVAL:interval] +CMD_KeepSet_HOST Specify the host name or IP address, and port number of the destination using the format "host name:port number". +CMD_KeepSet_PROTOCOL Specify either tcp or udp. +CMD_KeepSet_INTERVAL Specify, in seconds, the interval between the sending of packets. +CMD_KeepSet_PROMPT_HOST Destination Host Name/IP Address and Port Number: +CMD_KeepSet_PROMPT_PROTOCOL tcp or udp: +CMD_KeepSet_PROMPT_INTERVAL Interval Between Packets Sends (Seconds): +CMD_KeepSet_EVAL_TCP_UDP Please specify "tcp" or "udp". + +# KeepGet command +CMD_KeepGet Get the Keep Alive Internet Connection Function +CMD_KeepGet_Help Use this to get the current setting contents of the Keep Alive Internet Connection Function. In addition to the destination's Host Name, Port Number, Packet Send Interval and Protocol, you can obtain the current enabled/disabled status of the Keep Alive Internet Connection Function. +CMD_KeepGet_Args KeepGet +CMD_KeepGet_COLUMN_1 Host Name +CMD_KeepGet_COLUMN_2 Port Number +CMD_KeepGet_COLUMN_3 Packet Send Interval (Sec) +CMD_KeepGet_COLUMN_4 Protocol +CMD_KeepGet_COLUMN_5 Current Status + + +# SyslogEnable command +CMD_SyslogEnable Set syslog Send Function +CMD_SyslogEnable_Help Use this to set the usage of syslog send function and which syslog server to use. +CMD_SyslogEnable_Args SyslogEnable [1|2|3] [/HOST:host:port] +CMD_SyslogEnable_[1|2|3] Specify, using an integer, 1, 2 or 3 for the setting to use the syslog send function. \n1: Send server log by syslog. \n2: Send server and Virtual Hub security logs by syslog. \n3: Send server, Virtual Hub security, and packet logs by syslog. +CMD_SyslogEnable_HOST Specify the host name or IP address, and port number of the syslog server using the format [host name:port number]. If the port number is omitted, 514 will be used. +CMD_SyslogEnable_MINMAX Specify, using an integer, 1, 2 or 3 for the setting to use the syslog send function. +CMD_SyslogEnable_Prompt_123 Setting to Use syslog Send Function (1-3): +CMD_SyslogEnable_Prompt_HOST Specify syslog Server: + + +# SyslogDisable command +CMD_SyslogDisable Disable syslog Send Function +CMD_SyslogDisable_Help Use this to disable the syslog send function. +CMD_SyslogDisable_Args SyslogDisable + + +# SyslogGet command +CMD_SyslogGet Get syslog Send Function +CMD_SyslogGet_Help This allows you to get the current setting contents of the syslog send function. You can get the usage setting of the syslog function and the host name and port number of the syslog server to use. +CMD_SyslogGet_Args SyslogGet +CMD_SyslogGet_COLUMN_1 Set the Use of syslog Send Function +CMD_SyslogGet_COLUMN_2 syslog Server Host Name +CMD_SyslogGet_COLUMN_3 syslog Server Port Number + + +# ConnectionList command +CMD_ConnectionList Get List of TCP Connections Connecting to the VPN Server +CMD_ConnectionList_Help Use this to get a list of TCP/IP connections that are currently connecting to the VPN Server. It does not display the TCP connections that have been established as VPN sessions. To get the list of TCP/IP connections that have been established as VPN sessions, you can use the SessionList command. \nYou can get the following: Connection Name, Connection Source, Connection Start and Type.\nTo execute this command, you must have VPN Server administrator privileges. +CMD_ConnectionList_Args ConnectionList + + +# ConnectionList command +CMD_ConnectionGet Get Information of TCP Connections Connecting to the VPN Server +CMD_ConnectionGet_Help Use this to get detailed information of a specific TCP/IP connection that is connecting to the VPN Server. \nYou can get the following information: Connection Name, Connection Type, Source Hostname, Source IP Address, Source Port Number (TCP), Connection Start, Server Product Name, Server Version, Server Build Number, Client Product Name, Client Version, and Client Build Number. \nTo execute this command, you must have VPN Server administrator privileges. +CMD_ConnectionGet_Args ConnectionGet [name] +CMD_ConnectionGet_[name] This allows you to specify the name of the connection whose information you want to get. To get a list of connection names, you can use the ConnectionList command. +CMD_ConnectionGet_PROMPT_NAME Connection Name to Get Info: + +# ConnectionDisconnect command +CMD_ConnectionDisconnect Disconnect TCP Connections Connecting to the VPN Server +CMD_ConnectionDisconnect_Help Use this to forcefully disconnect specific TCP/IP connections that are connecting to the VPN Server. \nTo execute this command, you must have VPN Server administrator privileges. +CMD_ConnectionDisconnect_Args ConnectionDisconnect [name] +CMD_ConnectionDisconnect_[name] Specify the name of the connection to disconnect. To get a list of connection names, you can use the ConnectionList command. +CMD_ConnectionDisconnect_PROMPT_NAME Connection Name to Disconnect: + + +# BridgeDeviceList command +CMD_BridgeDeviceList Get List of Network Adapters Usable as Local Bridge +CMD_BridgeDeviceList_Help Use this to get a list of Ethernet devices (network adapters) that can be used as a bridge destination device as part of a Local Bridge connection. If possible, network connection name is displayed. \nYou can use a device displayed here by using the BridgeCreate command. \nTo execute this command, you must have VPN Server administrator privileges. +CMD_BridgeDeviceList_Args BridgeDeviceList + + +# BridgeList command +CMD_BridgeList Get List of Local Bridge Connection +CMD_BridgeList_Help Use this to get a list of the currently defined Local Bridge connections. \nYou can get the Local Bridge connection Virtual Hub name and the bridge destination Ethernet device (network adapter) name or tap device name, as well as the operating status. +CMD_BridgeList_Args BridgeList + + +# BridgeCreate command +CMD_BridgeCreate Create Local Bridge Connection +CMD_BridgeCreate_Help Use this to create a new Local Bridge connection on the VPN Server.\nBy using a Local Bridge, you can configure a Layer 2 bridge connection between a Virtual Hub operating on this VPN server and a physical Ethernet Device (Network Adapter). \nYou can create a tap device (virtual network interface) on the system and connect a bridge between Virtual Hubs (the tap device is only supported by Linux versions). \nIt is possible to establish a bridge to an operating network adapter of your choice for the bridge destination Ethernet device (network adapter), but in high load environments, we recommend you prepare a network adapter dedicated to serve as a bridge. \nTo execute this command, you must have VPN Server administrator privileges. +CMD_BridgeCreate_Args BridgeCreate [hubname] [/DEVICE:device_name] [/TAP:yes|no] +CMD_BridgeCreate_[hubname] Specify the Virtual Hub to create bridge. To get a list of Virtual Hubs, you can use the HubList command. It is not essential that you specify a Virtual Hub that is currently operating. If you specify a Virtual Hub name that is not currently operating or that does not exist, the Local Bridge connection will become enabled when the actual operation of that Virtual Hub begins. +CMD_BridgeCreate_DEVICE Specify the bridge destination Ethernet device (network adapter) or tap device name. You can get the list of Ethernet device names by using the BridgeDeviceList command. +CMD_BridgeCreate_TAP Specify yes if you are using a tap device rather than a network adapter for the bridge destination (only supported for Linux versions). When this is omitted, it will be treated the same as when no is specified. +CMD_BridgeCreate_PROMPT_HUBNAME Virtual Hub Name to Create Bridge: +CMD_BridgeCreate_PROMPT_DEVICE Bridge Destination Device Name: +CMD_BridgeCreate_PROMPT_TAP Use tap device? (yes/no): + + +# BridgeDelete command +CMD_BridgeDelete Delete Local Bridge Connection +CMD_BridgeDelete_Help Use this to delete an existing Local Bridge connection. To get a list of current Local Bridge connections use the BridgeDeviceList command. \nTo execute this command, you must have VPN Server administrator privileges. +CMD_BridgeDelete_Args BridgeDelete [hubname] [/DEVICE:device_name] +CMD_BridgeDelete_[hubname] Specify the Virtual Hub of the Local Bridge to delete. +CMD_BridgeDelete_DEVICE Specify the device name (network adapter or tap device name) of the Local Bridge to delete. +CMD_BridgeDelete_PROMPT_HUBNAME Virtual Hub Name to Delete Bridge: +CMD_BridgeDelete_PROMPT_DEVICE Bridge Device Name to Delete: + + +# Caps command +CMD_Caps Get List of Server Functions/Capability +CMD_Caps_Help Use this get a list of functions and capability of the VPN Server currently connected and being managed. \nThe function and capability of VPN Servers are different depending on the operating VPN server's edition and version. Sometimes commands may be included in the command line management utility that cannot operate because of the function and capability of the destination VPN Server. Using this command, you can find out the capability of the target VPN Server and report it. \nIf the version of the VPN Server is newer than the command line management utility and there are functions that the command line management utility does not recognize, you can display the contents strings (variable names) as they are. +CMD_Caps_Args Caps + + +# Reboot command +CMD_Reboot Reboot VPN Server Service +CMD_Reboot_Help Use this to restart the VPN Server service. \nWhen you restart the VPN Server, all currently connected sessions and TCP connections will be disconnected and no new connections will be accepted until the restart process has completed. \nBy using this command, only the VPN Server service program will be restarted and the physical computer that VPN Server is operating on does not restart. This management session will also be disconnected, so you will need to reconnect to continue management. \nAlso, by specifying the /RESTCONFIG:yes parameter, the contents of the configuration file (.config) held by the current VPN Server will be initialized. \nTo execute this command, you must have VPN Server administrator privileges. +CMD_Reboot_Args Reboot [/RESETCONFIG:yes|no] +CMD_Reboot_RESETCONFIG By specifying yes, the contents of the configuration file (.config) held by the current VPN Server will be initialized. Please carefully consider the implications when setting this parameter. + + +# ConfigGet command +CMD_ConfigGet Get the current configuration of the VPN Server +CMD_ConfigGet_Help Use this to get a text file (.config file) that contains the current configuration contents of the VPN server. You can get the status on the VPN Server at the instant this command is executed. \nWhen part of the contents of the configuration file does not specify a parameter, it will be displayed on screen as it is. By specifying a save destination file name by parameter, the contents will be saved by that file name. \nYou can edit the configuration file by using a regular text editor. To write an edited configuration to the VPN Server, use the ConfigSet command. \nTo execute this command, you must have VPN Server administrator privileges. +CMD_ConfigGet_Args ConfigGet [path] +CMD_ConfigGet_[path] When you want to save the contents of the configuration file to a file, use this to specify the file name. If left unspecified, the configuration contents will be displayed on screen. If the configuration file contains multiple-byte characters, the encoding must be saved as Unicode (UTF-8). +CMD_ConfigGet_FILENAME Config name: "%S", Size: %u +CMD_ConfigGet_FILE_SAVE_FAILED Creation of specified file failed. + + +# ConfigSet command +CMD_ConfigSet Write Configuration File to VPN Server +CMD_ConfigSet_Help Use this to write the configuration file to the VPN Server. By executing this command, the contents of the specified configuration file will be applied to the VPN Server and the VPN Server program will automatically restart and upon restart, operate according to the new configuration contents. \nBecause it is difficult for an administrator to write all the contents of a configuration file, we recommend you use the ConfigGet command to get the current contents of the VPN Server configuration and save it to file. You can then edit these contents in a regular text editor and then use the ConfigSet command to rewrite the contents to the VPN Server. \nThis command is for people with a detailed knowledge of the VPN Server and if an incorrectly configured configuration file is written to the VPN Server, it not only could cause errors, it could also result in the lost of the current setting data. Take special care when carrying out this action. \nTo execute this command, you must have VPN Server administrator privileges. +CMD_ConfigSet_Args ConfigSet [path] +CMD_ConfigSet_[path] Specify the file name of the write destination configuration file. If the write destination file contains multiple-byte characters, the encoding must be Unicode (UTF-8). +CMD_ConfigSet_PROMPT_PATH Config file path name to upload to server: +CMD_ConfigSet_FILE_LOAD_FAILED Reading from specified file failed. + + +# RouterList command +CMD_RouterList Get List of Virtual Layer 3 Switches +CMD_RouterList_Help Use this to get the list of Virtual Layer 3 Switches defined on the VPN Server. You can get the following information on the Virtual Layer 3 Switches: Switch Name, Operating Status, Number of Interfaces, and Number of Routing Tables. \nTo execute this command, you must have VPN Server administrator privileges. \nAlso, this command does not operate on VPN Bridge. +CMD_RouterList_Args RouterList + + +# RouterAdd command +CMD_RouterAdd Define New Virtual Layer 3 Switch +CMD_RouterAdd_Help Use this to define a new Virtual Layer 3 Switch on the VPN Server. \nTo execute this command, you must have VPN Server administrator privileges. \nAlso, this command does not operate on VPN Bridge. \n\n[Explanation on Virtual Layer 3 Switch Function]\nYou can define Virtual Layer 3 Switches between multiple Virtual Hubs operating on this VPN Server and configure routing between different IP networks. \n\n[Caution about the Virtual Layer 3 Switch Function]\nThe Virtual Layer 3 Switch functions are provided for network administrators and other people who know a lot about networks and IP routing. If you are using the regular VPN functions, you do not need to use the Virtual Layer 3 Switch functions. \nIf the Virtual Layer 3 Switch functions are to be used, the person who configures them must have sufficient knowledge of IP routing and be perfectly capable of not impacting the network. +CMD_RouterAdd_Args RouterAdd [name] +CMD_RouterAdd_[name] Use this to specify the name of the newly created Virtual Layer 3 Switch name. You cannot add a name that is identical to an existing Virtual Layer 3 Switch. +CMD_RouterAdd_PROMPT_NAME Name of Virtual Layer 3 Switch to Create: + + +# RouterDelete command +CMD_RouterDelete Delete Virtual Layer 3 Switch +CMD_RouterDelete_Help Use this to delete an existing Virtual Layer 3 Switch that is defined on the VPN Server. When the specified Virtual Layer 3 Switch is operating, it will be automatically deleted after operation stops. \nTo get a list of existing Virtual Layer 3 Switches, use the RouterList command. \nTo execute this command, you must have VPN Server administrator privileges. \nAlso, this command does not operate on VPN Bridge. +CMD_RouterDelete_Args RouterDelete [name] +CMD_RouterDelete_[name] Use this to specify the name of the Virtual Layer 3 Switch to be deleted. +CMD_RouterDelete_PROMPT_NAME Name of Virtual Layer 3 Switch to Delete: + + +# RouterStart command +CMD_RouterStart Start Virtual Layer 3 Switch Operation +CMD_RouterStart_Help Use this to start the operation of an existing Virtual Layer 3 Switch defined on the VPN Server whose operation is currently stopped. \nTo get a list of existing Virtual Layer 3 Switches, use the RouterList command. \nTo execute this command, you must have VPN Server administrator privileges. \nAlso, this command does not operate on VPN Bridge. \n\n[Explanation on Virtual Layer 3 Switch Function]\nYou can define Virtual Layer 3 Switches between multiple Virtual Hubs operating on this VPN Server and configure routing between different IP networks. \n\n[Caution about the Virtual Layer 3 Switch Function]\nThe Virtual Layer 3 Switch functions are provided for network administrators and other people who know a lot about networks and IP routing. If you are using the regular VPN functions, you do not need to use the Virtual Layer 3 Switch functions. \nIf the Virtual Layer 3 Switch functions are to be used, the person who configures them must have sufficient knowledge of IP routing and be perfectly capable of not impacting the network. +CMD_RouterStart_Args RouterStart [name] +CMD_RouterStart_[name] Use this to specify the name of the Virtual Layer 3 Switch to start. +CMD_RouterStart_PROMPT_NAME Name of Virtual Layer 3 Switch to Start: + + +# RouterStop command +CMD_RouterStop Stop Virtual Layer 3 Switch Operation +CMD_RouterStop_Help Use this to stop the operation of an existing Virtual Layer 3 Switch defined on the VPN Server whose operation is currently operating. \nTo get a list of existing Virtual Layer 3 Switches, use the RouterList command. \nTo execute this command, you must have VPN Server administrator privileges. +CMD_RouterStop_Args RouterStop [name] +CMD_RouterStop_[name] Use this to specify the name of the Virtual Layer 3 Switch to stop. +CMD_RouterStop_PROMPT_NAME Name of Virtual Layer 3 Switch to Stop: + + +# RouterIfList command +CMD_RouterIfList Get List of Interfaces Registered on the Virtual Layer 3 Switch +CMD_RouterIfList_Help Use this to get a list of virtual interfaces when virtual interfaces have been defined on a specified Virtual Layer 3 Switch. \nYou can define multiple virtual interfaces and routing tables for a single Virtual Layer 3 Switch. \nA virtual interface is associated to a virtual Hub and operates as a single IP host on the Virtual Hub when that Virtual Hub is operating. When multiple virtual interfaces that respectively belong to a different IP network of a different Virtual Hub are defined, IP routing will be automatically performed between these interfaces. \nTo execute this command, you must have VPN Server administrator privileges. \nAlso, this command does not operate on VPN Bridge. +CMD_RouterIfList_Args RouterIfList [name] +CMD_RouterIfList_[name] Use this to specify the name of the Virtual Layer 3 Switch. +CMD_RouterIfList_PROMPT_NAME Name of Virtual Layer 3 Switch: + + +# RouterIfAdd command +CMD_RouterIfAdd Add Virtual Interface to Virtual Layer 3 Switch +CMD_RouterIfAdd_Help Use this to add to a specified Virtual Layer 3 Switch, a virtual interface that connects to a Virtual Hub operating on the same VPN Server. \nYou can define multiple virtual interfaces and routing tables for a single Virtual Layer 3 Switch. \nA virtual interface is associated to a virtual Hub and operates as a single IP host on the Virtual Hub when that Virtual Hub is operating. When multiple virtual interfaces that respectively belong to a different IP network of a different Virtual Hub are defined, IP routing will be automatically performed between these interfaces. \nYou must define the IP network space that the virtual interface belongs to and the IP address of the interface itself. \nAlso, you must specify the name of the Virtual Hub that the interface will connect to. \nYou can specify a Virtual Hub that currently doesn't exist for the Virtual Hub name. \nThe virtual interface must have one IP address in the Virtual Hub. You also must specify the subnet mask of an IP network that the IP address belongs to. \nRouting via the Virtual Layer 3 Switches of IP spaces of multiple virtual Hubs operates based on the IP address is specified here. \nTo execute this command, you must have VPN Server administrator privileges. \nAlso, this command does not operate on VPN Bridge. \nTo execute this command, the target Virtual Layer 3 Switch must be stopped. If it is not stopped, first use the RouterStop command to stop it and then execute this command. +CMD_RouterIfAdd_Args RouterIfAdd [name] [/HUB:hub] [/IP:ip/mask] +CMD_RouterIfAdd_[name] Use this to specify the name of the Virtual Layer 3 Switch. +CMD_RouterIfAdd_HUB Use this to specify the name of the Virtual Hub to be the connection destination of the virtual interface to be newly added. To get a list of Virtual Hubs, you can use the HubList command. It is not essential that you specify a Virtual Hub that is currently operating. If you specify a Virtual Hub name that is not currently operating or that does not exist, the Virtual Layer 3 Switch will become enabled when the actual operation of that Virtual Hub begins. +CMD_RouterIfAdd_IP Using the format: "IP address/subnet mask", specify the IP address and subnet mask held by the virtual interface to be newly added. Specify the IP address by separating the decimal values using dots such as 192.168.0.1 For the subnet mask, either specify decimal values separated by dots such as 255.255.255.0, or you can specify the bit length from the header using a decimal value such as 24. +CMD_RouterIfAdd_PROMPT_NAME Name of Virtual Layer 3 Switch: +CMD_RouterIfAdd_PROMPT_HUB Destination Virtual Hub Name of Virtual Interface: +CMD_RouterIfAdd_PROMPT_IP IP Address/Subnet Mask: + + +# RouterIfDel command +CMD_RouterIfDel Delete Virtual Interface of Virtual Layer 3 Switch +CMD_RouterIfDel_Help Use this to delete a virtual interface already defined in the specified Virtual Layer 3 Switch. \nYou can get a list of the virtual interfaces currently defined, by using the RouterIfList command. \nTo execute this command, you must have VPN Server administrator privileges. \nAlso, this command does not operate on VPN Bridge. \nTo execute this command, the target Virtual Layer 3 Switch must be stopped. If it is not stopped, first use the RouterStop command to stop it and then execute this command. +CMD_RouterIfDel_Args RouterIfDel [name] [/HUB:hub] +CMD_RouterIfDel_[name] Use this to specify the name of the Virtual Layer 3 Switch. +CMD_RouterIfDel_HUB Use this to specify the name of the Virtual Hub to be the connection destination of the virtual interface to be deleted. + + +# RouterTableList command +CMD_RouterTableList Get List of Routing Tables of Virtual Layer 3 Switch +CMD_RouterTableList_Help Use this to get a list of routing tables when routing tables have been defined on a specified Virtual Layer 3 Switch. \nIf the destination IP address of the IP packet does not belong to any IP network that belongs to a virtual interface, the IP routing engine of the Virtual Layer 3 Switch will reference this routing table and execute routing. \nTo execute this command, you must have VPN Server administrator privileges. \nAlso, this command does not operate on VPN Bridge. +CMD_RouterTableList_Args RouterTableList [name] +CMD_RouterTableList_[name] Use this to specify the name of the Virtual Layer 3 Switch. +CMD_RouterTableList_PROMPT_NAME Name of Virtual Layer 3 Switch: + + +# RouterTableAdd command +CMD_RouterTableAdd Add Routing Table Entry for Virtual Layer 3 Switch +CMD_RouterTableAdd_Help Here you can add a new routing table entry to the routing table of the specified Virtual Layer 3 Switch. \nIf the destination IP address of the IP packet does not belong to any IP network that belongs to a virtual interface, the IP routing engine of the Virtual Layer 3 Switch will reference the routing table and execute routing. \nYou must specify the contents of the routing table entry to be added to the Virtual Layer 3 Switch. You must specify any IP address that belongs to the same IP network in the virtual interface of this Virtual Layer 3 Switch as the gateway address. \nTo execute this command, you must have VPN Server administrator privileges. \nAlso, this command does not operate on VPN Bridge. \nTo execute this command, the target Virtual Layer 3 Switch must be stopped. If it is not stopped, first use the RouterStop command to stop it and then execute this command. +CMD_RouterTableAdd_Args RouterTableAdd [name] [/NETWORK:ip/mask] [/GATEWAY:gwip] [/METRIC:metric] +CMD_RouterTableAdd_[name] Use this to specify the name of the Virtual Layer 3 Switch. +CMD_RouterTableAdd_NETWORK Using the format: "IP address/subnet mask", specify the network address and subnet mask of the routing table entry to be newly added. Specify the network address by separating the decimal values using dots such as "192.168.0.1". For the subnet mask, either specify decimal values separated by dots such as 255.255.255.0, or you can specify the bit length from the header using a decimal value such as 24. If you specify 0.0.0.0/0.0.0.0, the default route will be used. +CMD_RouterTableAdd_GATEWAY Specify the gateway IP address. +CMD_RouterTableAdd_METRIC Specify a metric value. Specify an integer (1 or higher). +CMD_RouterTableAdd_PROMPT_NAME Name of Virtual Layer 3 Switch: +CMD_RouterTableAdd_PROMPT_NETWORK Network Address/Subnet Mask: +CMD_RouterTableAdd_PROMPT_GATEWAY Gateway Address: +CMD_RouterTableAdd_PROMPT_METRIC Metric Value: + + +# RouterTableDel command +CMD_RouterTableDel Delete Routing Table Entry of Virtual Layer 3 Switch +CMD_RouterTableDel_Help Use this to delete a routing table entry that is defined in the specified Virtual Layer 3 Switch. \nYou can get a list of the already defined routing table entries by using the RouterTableList command. \nTo execute this command, you must have VPN Server administrator privileges. \nAlso, this command does not operate on VPN Bridge. \nTo execute this command, the target Virtual Layer 3 Switch must be stopped. If it is not stopped, first use the RouterStop command to stop it and then execute this command. +CMD_RouterTableDel_Args RouterTableDel [name] [/NETWORK:ip/mask] [/GATEWAY:gwip] [/METRIC:metric] +CMD_RouterTableDel_[name] Use this to specify the name of the Virtual Layer 3 Switch. +CMD_RouterTableDel_NETWORK Using the format: "IP address/subnet mask", specify the network address of the routing table entry to be deleted. +CMD_RouterTableDel_GATEWAY Specify the gateway IP address. +CMD_RouterTableDel_METRIC Specify a metric value. Specify an integer (1 or higher). + + +# LogFileList command +CMD_LogFileList Get List of Log Files +CMD_LogFileList_Help Use this to display a list of log files outputted by the VPN Server that have been saved on the VPN Server computer. By specifying a log file file name displayed here and calling it using the LogFileGet command you can download the contents of the log file. \nIf you are connected to the VPN Server in server admin mode, you can display or download the packet logs and security logs of all Virtual Hubs and the server log of the VPN Server. \nWhen connected in Virtual Hub Admin Mode, you are able to view or download only the packet log and security log of the Virtual Hub that is the target of management. +CMD_LogFileList_Args LogFileList +CMD_LogFileList_START Getting list of log files. This may take a while. Please wait... +CMD_LogFileList_NUM_LOGS In total there are %u log files. + + +# LogFileGet command +CMD_LogFileGet Download Log file +CMD_LogFileGet_Help Use this to download the log file that is saved on the VPN Server computer. To download the log file first display the list of log files using the LogFileList command and then download the log file using the LogFileGet command. If you are connected to the VPN Server in server admin mode, you can display or download the packet logs and security logs of all Virtual Hubs and the server log of the VPN Server. When connected in Virtual Hub Admin Mode, you are able to view or download only the packet log and security log of the Virtual Hub that is the target of management. \nIf you have specified the file name as a parameter, the downloaded log file will be saved to the file of that file name. If the destination file is not specified, the log file will be displayed onscreen. \nThe size of the log file can get very big, so pay careful attention to this issue. +CMD_LogFileGet_Args LogFileGet [name] [/SERVER:server] [/SAVEPATH:savepath] +CMD_LogFileGet_[name] Specify the name of the log file to be downloaded. To get a list of downloadable log files, use the LogFileList command. +CMD_LogFileGet_SERVER Use this to specify the server name when making a download request to a cluster controller. Specify the server that will be displayed by the LogFileGet command. +CMD_LogFileGet_SAVEPATH Use this to specify the destination file name for when saving the downloaded log file. When this is left unspecified, the file will be displayed onscreen. +CMD_LogFileGet_PROMPT_NAME Name of log file to download: +CMD_LogFileGet_START Downloading log file. This may take a while. Please wait... +CMD_LogFileGet_FAILED The download failed. +CMD_LogFileGet_SAVE_FAILED Unable to write to the specified file. +CMD_LogFileGet_FILESIZE File size of log file: %u + + +# HubCreate command +CMD_HubCreate Create New Virtual Hub +CMD_HubCreate_Help Use this to create a new Virtual Hub on the VPN Server. \nThe created Virtual Hub will begin operation immediately. \nWhen the VPN Server is operating on a cluster, this command is only valid for the cluster controller. Also, the new Virtual Hub will operate as a dynamic Virtual Hub. You can change it to a static Virtual Hub by using the HubSetStatic command. To get a list of Virtual Hubs that are already on the VPN Server, use the HubList command. \nTo execute this command, you must have VPN Server administrator privileges. \nAlso, this command does not operate on VPN Servers that are operating as a VPN Bridge or cluster member. \nWhen issuing the command to a cluster controller on a cluster to create a Virtual Hub, use either the HubCreateStatic command or the HubCreateDynamic command (issuing the HubCreate command to a cluster controller has the same operational effect as issuing the HubCreateDynamic command). +CMD_HubCreate_Args HubCreate [name] [/PASSWORD:password] +CMD_HubCreate_[name] Specify the name of the Virtual Hub to create. +CMD_HubCreate_PASSWORD Specify an administrator password when the administrator password is going to be set for the Virtual Hub to be created. If this is not specified, a prompt will appear to input the password. +CMD_HubCreate_PROMPT_NAME Name of Virtual Hub to be created: + + +# HubCreateDynamic command +CMD_HubCreateDynamic Create New Dynamic Virtual Hub (For Clustering) +CMD_HubCreateDynamic_Help Use this to create a new dynamic Virtual Hub on the VPN Server. \nThe created Virtual Hub will begin operation immediately. \nWhen the VPN Server is operating on a cluster, this command is only valid for the cluster controller. Also, the new Virtual Hub will operate as a dynamic Virtual Hub. You can change it to a static Virtual Hub by using the HubSetStatic command. To get a list of Virtual Hubs that are already on the VPN Server, use the HubList command. \nTo execute this command, you must have VPN Server administrator privileges. \nAlso, this command does not operate on VPN Servers that are operating as a VPN Bridge, cluster member or standalone server. +CMD_HubCreateDynamic_Args HubCreateDynamic [name] [/PASSWORD:password] +CMD_HubCreateDynamic_[name] Specify the name of the Virtual Hub to create. +CMD_HubCreateDynamic_PASSWORD Specify an administrator password when the administrator password is going to be set for the Virtual Hub to be created. If this is not specified, a prompt will appear to input the password. + + +# HubCreateStatic command +CMD_HubCreateStatic Create New Static Virtual Hub (For Clustering) +CMD_HubCreateStatic_Help Use this to create a new static Virtual Hub on the VPN Server. \nThe created Virtual Hub will begin operation immediately. \nWhen the VPN Server is operating on a cluster, this command is only valid for the cluster controller. Also, the new Virtual Hub will operate as a dynamic Virtual Hub. You can change it to a static Virtual Hub by using the HubSetStatic command. To get a list of Virtual Hubs that are already on the VPN Server, use the HubList command. \nTo execute this command, you must have VPN Server administrator privileges. \nAlso, this command does not operate on VPN Servers that are operating as a VPN Bridge, cluster member or standalone server. +CMD_HubCreateStatic_Args HubCreateStatic [name] [/PASSWORD:password] +CMD_HubCreateStatic_[name] Specify the name of the Virtual Hub to create. +CMD_HubCreateStatic_PASSWORD Specify an administrator password when the administrator password is going to be set for the Virtual Hub to be created. If this is not specified, a prompt will appear to input the password. + + +# HubDelete command +CMD_HubDelete Delete Virtual Hub +CMD_HubDelete_Help Use this to delete an existing Virtual Hub on the VPN Server. \nIf you delete the Virtual Hub, all sessions that are currently connected to the Virtual Hub will be disconnected and new sessions will be unable to connect to the Virtual Hub. \nAlso, this will also delete all the Hub settings, user objects, group objects, certificates and Cascade Connections. \nOnce you delete the Virtual Hub, it cannot be recovered. \nTo execute this command, you must have VPN Server administrator privileges. \nAlso, this command does not operate on VPN Servers that are operating as a VPN Bridge or cluster member. +CMD_HubDelete_Args HubDelete [name] +CMD_HubDelete_[name] Specify the name of the Virtual Hub to delete. +CMD_HubDelete_PROMPT_NAME Name of Virtual Hub to delete: + + +# HubSetStatic command +CMD_HubSetStatic Change Virtual Hub Type to Static Virtual Hub +CMD_HubSetStatic_Help Use this when a VPN Server is operating on a cluster and you want to change the type of the Virtual Hub to a static Virtual Hub. When the type of the Virtual Hub is changed, all sessions that are currently connected to the Virtual Hub will be disconnected. \nWhen there is a Virtual Hub operating as a static virtual Hub, a Virtual Hub with that name will be created on all the cluster member servers. A user who attempts to connect this Virtual Hub will be connected to one of the cluster members hosting this Virtual Hub as determined by an algorithm based on each server's load status. \nA static Virtual Hub, for example, could be used for a remote access VPN that allows thousands or tens of thousands of users to connect at the same time for the purpose of remotely accessing an internal company LAN from the Internet for business. \nTo execute this command, you must have VPN Server administrator privileges. \nAlso, this command does not operate on VPN Servers that are operating as a VPN Bridge, cluster member or standalone server. \nThis command cannot be used for VPN Servers that are newer than Build 5190. +CMD_HubSetStatic_Args HubSetStatic [name] +CMD_HubSetStatic_[name] Specify the name of the Virtual Hub to be set as the static Virtual Hub. +CMD_HubChange_PROMPT_NAME Name of Virtual Hub to change setting: + + +# HubSetDynamic command +CMD_HubSetDynamic Change Virtual Hub Type to Dynamic Virtual Hub +CMD_HubSetDynamic_Help Use this when a VPN Server is operating on a cluster and you want to change the type of the Virtual Hub to a dynamic Virtual Hub. When the type of the Virtual Hub is changed, all sessions that are currently connected to the Virtual Hub will be disconnected. \nWhen there is not even one client connected to a dynamic Virtual Hub defined on the cluster, then that Virtual Hub does not exist on any cluster member. When the first client to attempt to connect to the dynamic Virtual Hub does so, the server with the lowest load on the cluster starts hosting that Virtual Hub. When the second and subsequent clients attempt to connect to the same virtual Hub, they are automatically connected to the server hosting the Virtual Hub. When all the clients are disconnected from a particular dynamic Virtual Hub, the Virtual Hub will return to the original state of not existing on any of the servers. \nThere is a broad range of applications for dynamic Virtual Hubs, such as a Virtual Hub defined for each business section within a company so that employees can connect to the Virtual Hub of their own department to do their work in a centralized management environment that is deployed on a single cluster. \nTo execute this command, you must have VPN Server administrator privileges. \nAlso, this command does not operate on VPN Servers that are operating as a VPN Bridge, cluster member or standalone server. \nThis command cannot be used for VPN Servers that are newer than Build 5190. +CMD_HubSetDynamic_Args HubSetDynamic [name] +CMD_HubSetDynamic_[name] Specify the name of the Virtual Hub to be set as the dynamic Virtual Hub. + + +# HubList command +CMD_HubList Get List of Virtual Hubs +CMD_HubList_Help Use this to get a list of existing Virtual Hubs on the VPN Server. For each Virtual Hub, you can get the following information: Virtual Hub Name, Status, Type, Number of Users, Number of Groups, Number of Sessions, Number of MAC Tables, Number of IP Tables, Number of Logins, Last Login, and Last Communication.\nNote that when connecting in Virtual Hub Admin Mode, if in the options of a Virtual Hub that you do not have administrator privileges for, the option Don't Enumerate this Virtual Hub for Anonymous Users is enabled then that Virtual Hub will not be enumerated. If you are connected in Server Admin Mode, then the list of all Virtual Hubs will be displayed. \nWhen connecting to and managing a non-cluster-controller cluster member of a clustering environment, only the Virtual Hub currently being hosted by that VPN Server will be displayed. When connecting to a cluster controller for administration purposes, all the Virtual Hubs will be displayed. +CMD_HubList_Args HubList + + +# Hub command +CMD_Hub Select Virtual Hub to Manage +CMD_Hub_Help Use this to select the Virtual Hub to be the target of administration. For an administration utility with the status of being connected to a VPN Server, before executing a command to set or manage a Virtual Hub, you must use the Hub command to select the Virtual Hub to manage. \nWhen in the status of being connected to a VPN Server in Virtual Hub Admin Mode, you can select a single Virtual Hub to be the target of administration but you cannot select other Virtual Hubs. When having the status of being connected to the VPN Server in Server Admin Mode, you can make all Virtual Hubs the target of administration. \nTo get a list of Virtual Hubs that currently exist on the VPN Server, use the HubList command. \nFor the VPN Bridge, you can only select the Virtual Hub that has the name "BRIDGE". +CMD_Hub_Args Hub [name] +CMD_Hub_[name] Specify the name of the Virtual Hub to manage. If this parameter is left unspecified, the Select Virtual Hub to Manage will be cancelled. +CMD_Hub_Unselected The Virtual Hub selection has been unselected. +CMD_Hub_Selected The Virtual Hub "%S" has been selected. +CMD_Hub_Select_Failed When attempting to select Virtual Hub "%S" that has been specified by /ADMINHUB, the following error occurred. +CMD_Hub_Not_Selected Before executing this command, first select the Virtual Hub to manage using the Hub command. + + +# Online command +CMD_Online Switch Virtual Hub to Online +CMD_Online_Help Use this when the Virtual Hub currently being managed is offline to switch it to online. A Virtual Hub with an offline status cannot receive VPN connections from clients. By switching the Virtual Hub to online, that Virtual Hub becomes able to receive connections from users and provide services. \nThis command cannot be run on VPN Bridge. \nYou cannot execute this command for Virtual Hubs of VPN Servers operating as a cluster. +CMD_Online_Args Online + + +# Offline command +CMD_Offline Switch Virtual Hub to Offline +CMD_Offline_Help Use this when the Virtual Hub currently being managed is online to switch it to offline. If there are sessions currently connected to the Virtual Hub, all sessions will be disconnected. A Virtual Hub with an offline status cannot receive VPN connections from clients. \nThis command cannot be run on VPN Bridge. \nYou cannot execute this command for Virtual Hubs of VPN Servers operating as a cluster. +CMD_Offline_Args Offline + + +# SetMaxSession command +CMD_SetMaxSession Set the Max Number of Concurrently Connected Sessions for Virtual Hub +CMD_SetMaxSession_Help Use this to set the maximum number of sessions that can be concurrently connected to the Virtual Hub that is currently being managed. When there are more sessions than the maximum number of concurrently connected sessions that are being connected from the VPN Client or VPN Bridge, when the maximum number of sessions is reached, clients will no longer be able to connect. This limit on the maximum number of concurrently connected sessions does not include sessions generated in the Virtual Hub by Local Bridges, Virtual NAT, and Cascade Connections. \nYou can get the current setting for the max number of concurrently connected sessions by using the OptionsGet command. \nThis command cannot be run on VPN Bridge. \nYou cannot execute this command for Virtual Hubs of VPN Servers operating as a cluster. +CMD_SetMaxSession_Args SetMaxSession [max_session] +CMD_SetMaxSession_[max_session] Using an integer, specify the maximum number of concurrently connected sessions to set. Specifying 0 results in a setting of unlimited. +CMD_SetMaxSession_Prompt Max Number of Sessions: + + +# SetHubPassword command +CMD_SetHubPassword Set Virtual Hub Administrator Password +CMD_SetHubPassword_Help Use this to set the Administrator Password for the Virtual Hub that is currently being managed. When a Virtual Hub administrator password has been set, you are able to connect to that Virtual Hub from a VPN Server connection utility in Virtual Hub Admin Mode, by specifying the password. It is also possible to make a VPN connection from a VPN client or VPN Bridge by specifying "Administrator" for the user name and the password for the Virtual Hub administrator password. \nThis command cannot be run on VPN Bridge. \nYou cannot execute this command for Virtual Hubs of VPN Servers operating as a cluster. +CMD_SetHubPassword_Args SetHubPassword [password] +CMD_SetHubPassword_[password] Specify the password you wish to set. If a password is not specified by parameter, a prompt will appear to input the password. + + +# SetEnumAllow command +CMD_SetEnumAllow Allow Enumeration by Virtual Hub Anonymous Users +CMD_SetEnumAllow_Help Use this to change the options setting of the Virtual Hub you are currently managing to allow anonymous users to enumerate this Virtual Hub. By setting this option, it makes it possible for VPN Client users to enumerate this Virtual Hub simply by inputting this VPN Server address. Also, by using the SetEnumDeny command, you can deny anonymous users the ability to enumerate. At the time a Virtual Hub is created, enumeration will be allowed. \nThis command cannot be run on VPN Bridge. \nYou cannot execute this command for Virtual Hubs of VPN Servers operating as a cluster. +CMD_SetEnumAllow_Args SetEnumAllow + + +# SetEnumDeny command +CMD_SetEnumDeny Deny Enumeration by Virtual Hub Anonymous Users +CMD_SetEnumDeny_Help Use this to change the options setting of the Virtual Hub you are currently managing to prevent anonymous users from enumerating this Virtual Hub. By setting this option, the VPN Client user will be unable to enumerate this Virtual Hub even if they send a Virtual Hub enumeration request to the VPN Server. Also, by using the SetEnumAllow command, you can allow anonymous users to enumerate. \nThis command cannot be run on VPN Bridge. \nYou cannot execute this command for Virtual Hubs of VPN Servers operating as a cluster. +CMD_SetEnumDeny_Args SetEnumDeny + + +# OptionsGet command +CMD_OptionsGet Get Options Setting of Virtual Hubs +CMD_OptionsGet_Help Use this to get a list of the Options setting of the Virtual Hub currently being managed. You can get the following: Allow/Deny Virtual Hub Enumeration, Maximum Concurrent Connections, Online/Offline Status, and Virtual Hub Type in Clustering Environment. \nYou cannot execute this command for Virtual Hubs of VPN Servers operating as a cluster. +CMD_OptionsGet_Args OptionsGet +CMD_OptionsGet_TITLE Options Setting List of Virtual Hub "%S" +CMD_OptionsGet_ENUM Enumeration of Virtual Hub for Anonymous User +CMD_OptionsGet_MAXSESSIONS Max Number of Sessions +CMD_OptionsGet_STATUS Status +CMD_OptionsGet_TYPE Virtual Hub Type + + + +# RadiusServerSet command +CMD_RadiusServerSet Set RADIUS Server to use for User Authentication +CMD_RadiusServerSet_Help To accept users to the currently managed Virtual Hub in RADIUS server authentication mode, you can specify an external RADIUS server that confirms the user name and password. (You can specify multiple hostname by splitting with comma or semicolon.) \nThe RADIUS server must be set to receive requests from IP addresses of this VPN Server. Also, authentication by Password Authentication Protocol (PAP) must be enabled. \nThis command cannot be run on VPN Bridge. \nYou cannot execute this command for Virtual Hubs of VPN Servers operating as a cluster. +CMD_RadiusServerSet_Args RadiusServerSet [server_name:port] [/SECRET:secret] [/RETRY_INTERVAL:interval] +CMD_RadiusServerSet_[server_name:port] Using the format "host name:port number", specify the host name or IP address, and the UDP port number of the RADIUS server being used. If the port number is omitted, 1812 will be used. You can specify multiple hostname by splitting with comma or semicolon. +CMD_RadiusServerSet_SECRET Specify the shared secret (password) used for communication with the RADIUS Server +CMD_RadiusServerSet_RETRY_INTERVAL Specify the retry interval between retries in milliseconds. +CMD_RadiusServerSet_Prompt_Host Host Number and Port Number of RADIUS Server to Use: +CMD_RadiusServerSet_Prompt_Secret Shared Secret: +CMD_RadiusServerSet_Prompt_RetryInterval Retry Interval (milliseconds): +CMD_RadiusServerSet_EVAL_NUMINTERVAL The retry interval must be in from 500 to 10000 milliseconds. + + +# RadiusServerDelete command +CMD_RadiusServerDelete Delete Setting to Use RADIUS Server for User Authentication +CMD_RadiusServerDelete_Help Use this to delete the setting related to using a RADIUS server when a user connects to the currently managed Virtual Hub in RADIUS Server Authentication Mode and disable the RADIUS authentication. To get the settings related to the current RADIUS server use the RadiusServerGet command. \nThis command cannot be run on VPN Bridge. \nYou cannot execute this command for Virtual Hubs of VPN Servers operating as a cluster. +CMD_RadiusServerDelete_Args RadiusServerDelete + + +# RadiusServerGet command +CMD_RadiusServerGet Get Setting of RADIUS Server Used for User Authentication +CMD_RadiusServerGet_Help Use this to get the current settings for the RADIUS server used when a user connects to the currently managed Virtual Hub using RADIUS Server Authentication Mode. \nThis command cannot be run on VPN Bridge. \nYou cannot execute this command for Virtual Hubs of VPN Servers operating as a cluster. +CMD_RadiusServerGet_Args RadiusServerGet +CMD_RadiusServerGet_STATUS Use RADIUS Server +CMD_RadiusServerGet_HOST RADIUS Server Host Name or IP Address: +CMD_RadiusServerGet_PORT RADIUS Server Port Number +CMD_RadiusServerGet_SECRET Shared Secret +CMD_RadiusServerGet_RetryInterval Retry Interval (in milliseconds) + + +# StatusGet command +CMD_StatusGet Get Current Status of Virtual Hub +CMD_StatusGet_Help Use this to get the current status of the Virtual Hub currently being managed. You can get the following information: Virtual Hub Type, Number of Sessions, Number of Each Type of Object, Number of Logins, Last Login, Last Communication, and Communication Statistical Data. +CMD_StatusGet_Args StatusGet + + +# LogGet command +CMD_LogGet Get Log Save Setting of Virtual Hub +CMD_LogGet_Help Use this to get the log save setting for the Virtual Hub that is currently being managed. You can get the setting information such as the save setting related to security logs and packet logs and information on what has been saved. +CMD_LogGet_Args LogGet +CMD_Log_SecurityLog Save Security Log +CMD_Log_PacketLog Save Packet Log +CMD_Log_SwitchType Log File Switch Cycle +CMD_Log_0 TCP Connection Log +CMD_Log_1 TCP Packet Log +CMD_Log_2 DHCP Log +CMD_Log_3 UDP Log +CMD_Log_4 ICMP Log +CMD_Log_5 IP Log +CMD_Log_6 ARP Log +CMD_Log_7 Ethernet Log + + +# LogEnable command +CMD_LogEnable Enable Security Log or Packet Log +CMD_LogEnable_Help Use this to enable a security log or packet log of the Virtual Hub currently being managed. \nTo get the current setting, you can use the LogGet command. +CMD_LogEnable_Args LogEnable [security|packet] +CMD_LogEnable_[security|packet] Select the type of log to enable. Specify either "security" or "packet". +CMD_LogEnable_Prompt Select Security or Packet: +CMD_LogEnable_Prompt_Error Invalid specification. + + +# LogDisable command +CMD_LogDisable Disable Security Log or Packet Log +CMD_LogDisable_Help Use this to disable a security log or packet log of the Virtual Hub currently being managed. \nTo get the current setting, you can use the LogGet command. +CMD_LogDisable_Args LogDisable [security|packet] +CMD_LogDisable_[security|packet] Select the type of log to disable. Specify either "security" or "packet". + + +# LogSwitchSet command +CMD_LogSwitchSet Set Log File Switch Cycle +CMD_LogSwitchSet_Help Use this to set the log file switch cycle for the security log or packet log that the currently managed Virtual Hub saves. The log file switch cycle can be changed to switch in every second, every minute, every hour, every day, every month ,or not switch. \nTo get the current setting, you can use the LogGet command. +CMD_LogSwitchSet_Args LogSwitchSet [security|packet] [/SWITCH:sec|min|hour|day|month|none] +CMD_LogSwitchSet_[security|packet] Select the type of log to change setting. Specify either "security" or "packet". +CMD_LogSwitchSet_SWITCH Select the switch cycle to set. Specify sec, min, hour, day, month or none. +CMD_LogSwitchSet_Prompt Specify sec, min, hour, day, month or none: + + +# LogPacketSaveType command +CMD_LogPacketSaveType Set Save Contents and Type of Packet to Save to Packet Log +CMD_LogPacketSaveType_Help Use this to set the save contents of the packet log for each type of packet to be saved by the currently managed Virtual Hub. There are the following packet types: TCP Connection Log, TCP Packet Log, DHCP Packet Log, UDP Packet Log, ICMP Packet Log, IP Packet Log, ARP Packet Log, and Ethernet Packet Log.\nTo get the current setting, you can use the LogGet command. +CMD_LogPacketSaveType_Args LogPacketSaveType [/TYPE:tcpconn|tcpdata|dhcp|udp|icmp|ip|arp|ether] [/SAVE:none|header|full] +CMD_LogPacketSaveType_TYPE Specify tcpconn, tcpdata, dhcp, udp, icmp, ip, arp, or ether to specify the type of packet whose save contents are going to be changed. +CMD_LogPacketSaveType_SAVE Specify the save contents of the packet log. \nSpecify either none: save nothing\nheader: header information only\nfull: all packet contents +CMD_LogPacketSaveType_Prompt_TYPE Specify tcpconn, tcpdata, dhcp, udp, icmp, ip, arp, or ether: +CMD_LogPacketSaveType_Prompt_SAVE Specify none, header, or full: + + +# CAList command +CMD_CAList Get List of Trusted CA Certificates +CMD_CAList_Help Here you can manage the certificate authority certificates that are trusted by this currently managed Virtual Hub. The list of certificate authority certificates that are registered is used to verify certificates when a VPN Client is connected in signed certificate authentication mode. \nThis command cannot be run on VPN Bridge. \nYou cannot execute this command for Virtual Hubs of VPN Servers operating as a member server on a cluster. +CMD_CAList_Args CAList +CMD_CAList_COLUMN_ID ID + + +# CAAdd command +CMD_CAAdd Add Trusted CA Certificate +CMD_CAAdd_Help Use this to add a new certificate to a list of CA certificates trusted by the currently managed Virtual Hub. The list of certificate authority certificates that are registered is used to verify certificates when a VPN Client is connected in signed certificate authentication mode. \nTo get a list of the current certificates you can use the CAList command. \nThe certificate you add must be saved in the X.509 file format. \nThis command cannot be run on VPN Bridge. \nYou cannot execute this command for Virtual Hubs of VPN Servers operating as a member server on a cluster. +CMD_CAAdd_Args CAAdd [path] +CMD_CAAdd_[path] Specify the file name of the X.509 certificate to register. +CMD_CAAdd_PROMPT_PATH Name of X.509 Certificate File to Register: + + +# CADelete command +CMD_CADelete Delete Trusted CA Certificate +CMD_CADelete_Help Use this to delete an existing certificate from the list of CA certificates trusted by the currently managed Virtual Hub. \nTo get a list of the current certificates you can use the CAList command. \nThis command cannot be run on VPN Bridge. \nYou cannot execute this command for Virtual Hubs of VPN Servers operating as a member server on a cluster. +CMD_CADelete_Args CADelete [id] +CMD_CADelete_[id] Specify the ID of the certificate to delete. +CMD_CADelete_PROMPT_ID ID of Certificate to Delete: + + +# CAGet command +CMD_CAGet Get Trusted CA Certificate +CMD_CAGet_Help Use this to get an existing certificate from the list of CA certificates trusted by the currently managed Virtual Hub and save it as a file in X.509 format. \nThis command cannot be run on VPN Bridge. \nYou cannot execute this command for Virtual Hubs of VPN Servers operating as a member server on a cluster. +CMD_CAGet_Args CAGet [id] [/SAVECERT:path] +CMD_CAGet_[id] Specify the ID of the certificate to get. +CMD_CAGet_SAVECERT Specify the file name to save the certificate you obtained. +CMD_CAGet_PROMPT_ID ID of Certificate to Get: +CMD_CAGet_PROMPT_SAVECERT Name of File to Save: + + +# CascadeList command +CMD_CascadeList Get List of Cascade Connections +CMD_CascadeList_Help Use this to get a list of Cascade Connections that are registered on the currently managed Virtual Hub. \nBy using a Cascade Connection, you can connect this Virtual Hub by Layer 2 Cascade Connection to another Virtual Hub that is operating on the same or a different computer. \n\n[Warning About Cascade Connections]\nBy connecting using a Cascade Connection you can create a Layer 2 bridge between multiple Virtual Hubs but if the connection is incorrectly configured, a loopback Cascade Connection could inadvertently be created. When using a Cascade Connection function please design the network topology with care. \nYou cannot execute this command for Virtual Hubs of VPN Servers operating as a cluster. +CMD_CascadeList_Args CascadeList + + +# CascadeCreate command +CMD_CascadeCreate Create New Cascade Connection +CMD_CascadeCreate_Help Use this to create a new Cascade Connection on the currently managed Virtual Hub. \nBy using a Cascade Connection, you can connect this Virtual Hub by Cascade Connection to another Virtual Hub that is operating on the same or a different computer. \nTo create a Cascade Connection, you must specify the name of the Cascade Connection, destination server and destination Virtual Hub and user name. When a new Cascade Connection is created, the type of user authentication is initially set as Anonymous Authentication and the proxy server setting and the verification options of the server certificate is not set. To change these settings and other advanced settings after a Cascade Connection has been created, use the other commands that begin with the name "Cascade". \n\n[Warning About Cascade Connections]\nBy connecting using a Cascade Connection you can create a Layer 2 bridge between multiple Virtual Hubs but if the connection is incorrectly configured, a loopback Cascade Connection could inadvertently be created. When using a Cascade Connection function please design the network topology with care. \n\nYou cannot execute this command for Virtual Hubs of VPN Servers operating as a cluster. +CMD_CascadeCreate_Args CascadeCreate [name] [/SERVER:hostname:port] [/HUB:hubname] [/USERNAME:username] +CMD_CascadeCreate_[name] Specify the name of the Cascade Connection to create. +CMD_CascadeCreate_SERVER Specify the host name and port number of the destination VPN Server using the format [host name:port number]. You can also specify by IP address. +CMD_CascadeCreate_HUB Specify the Virtual Hub on the destination VPN Server. +CMD_CascadeCreate_USERNAME Specify the user name to use for user authentication when connecting to the destination VPN Server. +CMD_CascadeCreate_Prompt_Name Cascade Connection Name: +CMD_CascadeCreate_Prompt_Server Destination VPN Server Host Name and Port Number: +CMD_CascadeCreate_Prompt_Hub Destination Virtual Hub Name: +CMD_CascadeCreate_Prompt_Username Connecting User Name: + + +# CascadeSet command +CMD_CascadeSet Set the Destination for Cascade Connection +CMD_CascadeSet_Help Use this to set the destination VPN Server host name and port number, Virtual Hub name and the user name that will use the connection for the Cascade Connection registered on the currently managed virtual Hub. \nYou cannot execute this command for Virtual Hubs of VPN Servers operating as a cluster. +CMD_CascadeSet_Args CascadeSet [name] [/SERVER:hostname:port] [/HUB:hubname] +CMD_CascadeSet_[name] Specify the name of the Cascade Connection whose setting you want to change. +CMD_CascadeSet_SERVER Specify the host name and port number of the destination VPN Server using the format [host name:port number]. You can also specify by IP address. +CMD_CascadeSet_HUB Specify the Virtual Hub on the destination VPN Server. + + +# CascadeGet command +CMD_CascadeGet Get the Cascade Connection Setting +CMD_CascadeGet_Help Use this to get the Connection Setting of a Cascade Connection that is registered on the currently managed Virtual Hub. \nTo change the Connection Setting contents of the Cascade Connection, use the other commands that begin with the name "Cascade" after creating the Cascade Connection. \nYou cannot execute this command for Virtual Hubs of VPN Servers operating as a cluster. +CMD_CascadeGet_Args CascadeGet [name] +CMD_CascadeGet_[name] Specify the name of the Cascade Connection whose setting you want to get. +CMD_CascadeGet_Policy [Cascade Session Security Policy Setting Value] + +# CascadeDelete command +CMD_CascadeDelete Delete Cascade Connection Setting +CMD_CascadeDelete_Help Use this to delete a Cascade Connection that is registered on the currently managed Virtual Hub. If the specified Cascade Connection has a status of online, the connections will be automatically disconnected and then the Cascade Connection will be deleted. \nYou cannot execute this command for Virtual Hubs of VPN Servers operating as a cluster. +CMD_CascadeDelete_Args CascadeDelete [name] +CMD_CascadeDelete_[name] Specify the name of the Cascade Connection to delete. + + +# CascadeUsernameSet command +CMD_CascadeUsernameSet Set User Name to Use Connection of Cascade Connection +CMD_CascadeUsernameSet_Help When a Cascade Connection registered on the currently managed Virtual Hub is specified and that Cascade Connection connects to the VPN Server, use this to specify the user name required for user authentication. \nIn some cases it is necessary to specify the type of user authentication and specify the required parameters. To change this information you can use commands such as CascadeAnonymousSet, CascadePasswordSet, and CascadeCertSet. \nYou cannot execute this command for Virtual Hubs of VPN Servers operating as a cluster. +CMD_CascadeUsernameSet_Args CascadeUsernameSet [name] [/USERNAME:username] +CMD_CascadeUsernameSet_[name] Specify the name of the Cascade Connection whose setting you want to change. +CMD_CascadeUsernameSet_USERNAME Specify the user name required for user authentication when the Cascade Connection connects to the VPN Server. +CMD_CascadeUsername_Notice The auth type for this Connection Setting is currently set as password authentication. After changing the user name, you must use the CascadePasswordSet command to reset the password. + + +# CascadeAnonymousSet command +CMD_CascadeAnonymousSet Set User Authentication Type of Cascade Connection to Anonymous Authentication +CMD_CascadeAnonymousSet_Help When a Cascade Connection registered on the currently managed Virtual Hub is specified and that Cascade Connection connects to the VPN Server, set the user authe type to [anonymous authentication]. \nYou cannot execute this command for Virtual Hubs of VPN Servers operating as a cluster. +CMD_CascadeAnonymousSet_Args CascadeAnonymousSet [name] +CMD_CascadeAnonymousSet_[name] Specify the name of the Cascade Connection whose setting you want to change. + + +# CascadePasswordSet command +CMD_CascadePasswordSet Set User Authentication Type of Cascade Connection to Password Authentication +CMD_CascadePasswordSet_Help When a Cascade Connection registered on the currently managed Virtual Hub is specified and that Cascade Connection connects to the VPN Server, use this to set the user auth type to Password Authentication. Specify Standard Password Authentication and RADIUS or NT Domain Authentication as the password authentication type. \nYou cannot execute this command for Virtual Hubs of VPN Servers operating as a cluster. +CMD_CascadePasswordSet_Args CascadePasswordSet [name] [/PASSWORD:password] [/TYPE:standard|radius] +CMD_CascadePasswordSet_[name] Specify the name of the Cascade Connection whose setting you want to change. +CMD_CascadePasswordSet_PASSWORD Specify the password to use for password authentication. If this is not specified, a prompt will appear to input the password. +CMD_CascadePasswordSet_TYPE Specify either "standard" (Standard Password Authentication) or "radius" (RADIUS or NT Domain Authentication) as the password authentication type. +CMD_CascadePasswordSet_Prompt_Type Specify standard or radius: +CMD_CascadePasswordSet_Type_Invalid The standard or radius specification is invalid. + + +# CascadeCertSet command +CMD_CascadeCertSet Set User Authentication Type of Cascade Connection to Client Certificate Authentication +CMD_CascadeCertSet_Help When a Cascade Connection registered on the currently managed Virtual Hub is specified and that Cascade Connection connects to the VPN Server, use this to set the user auth type to Client Certificate Authentication. For this certificate, you must specify a certificate file in the X.509 format and a private key file that is Base 64 encoded. \nYou cannot execute this command for Virtual Hubs of VPN Servers operating as a cluster. +CMD_CascadeCertSet_Args CascadeCertSet [name] [/LOADCERT:cert] [/LOADKEY:key] +CMD_CascadeCertSet_[name] Specify the name of the Cascade Connection whose setting you want to change. +CMD_CascadeCertSet_LOADCERT Specify the X.509 format certificate file to provide for certificate authentication. +CMD_CascadeCertSet_LOADKEY Specify the Base-64-encoded private key file name for the certificate. + + +# CascadeCertGet command +CMD_CascadeCertGet Get Client Certificate to Use for Cascade Connection +CMD_CascadeCertGet_Help When a Cascade Connection registered on the currently managed Virtual Hub is specified and that Cascade Connection uses client certificate authentication, use this to get the certificate that is provided as the client certificate and save the certificate file in X.509 format. \nYou cannot execute this command for Virtual Hubs of VPN Servers operating as a cluster. +CMD_CascadeCertGet_Args CascadeCertGet [name] [/SAVECERT:cert] +CMD_CascadeCertGet_[name] Specify the name of the Cascade Connection whose setting you want to get. +CMD_CascadeCertGet_SAVECERT Specify the file name to save the certificate you obtained in X.509 format. +CMD_CascadeCertSet_Not_Auth_Cert The specified Cascade Connection is not in client certificate authentication mode. +CMD_CascadeCertSet_Cert_Not_Exists The certificate is not stored in the Connection Setting of the specified Cascade Connection. + + +# CascadeEncryptEnable command +CMD_CascadeEncryptEnable Enable Encryption when Communicating by Cascade Connection +CMD_CascadeEncryptEnable_Help When a Cascade Connection registered on the currently managed Virtual Hub is specified and that Cascade Connection is used for communication between VPN Servers via a VPN connection, use this to set the communication contents between the VPN Servers to be encrypted by SSL. \nNormally communication between VPN Servers is encrypted by SSL to prevent eavesdropping of information and fraud. You can also disable encryption. When encryption is disabled, the communication throughput improves but the communication data flows over the network in plain text. \nYou cannot execute this command for Virtual Hubs of VPN Servers operating as a cluster. +CMD_CascadeEncryptEnable_Args CascadeEncryptEnable [name] +CMD_CascadeEncryptEnable_[name] Specify the name of the Cascade Connection whose setting you want to change. + + +# CascadeEncryptDisable command +CMD_CascadeEncryptDisable Disable Encryption when Communicating by Cascade Connection +CMD_CascadeEncryptDisable_Help When a Cascade Connection registered on the currently managed Virtual Hub is specified and that Cascade Connection is used for communication between VPN Servers via a VPN connection, use this to set the communication contents between the VPN Servers not to be encrypted. \nNormally communication between VPN Servers is encrypted by SSL to prevent eavesdropping of information and fraud. You can also disable encryption. When encryption is disabled, the communication throughput improves but the communication data flows over the network in plain text. \nYou cannot execute this command for Virtual Hubs of VPN Servers operating as a cluster. +CMD_CascadeEncryptDisable_Args CascadeEncryptDisable [name] +CMD_CascadeEncryptDisable_[name] Specify the name of the Cascade Connection whose setting you want to change. + + +# CascadeCompressEnable command +CMD_CascadeCompressEnable Enable Data Compression when Communicating by Cascade Connection +CMD_CascadeCompressEnable_Help When a Cascade Connection registered on the currently managed Virtual Hub is specified and that Cascade Connection is used for communication between VPN Servers via a VPN connection, use this to set the communication contents between the VPN Servers to be compressed. \nIt is possible to achieve a maximum of 80% compression. Compression however places higher loads on the CPU of both the client and server machines. When the line speed is about 10 Mbps or greater, compression can lower throughput, but sometimes it can have the opposite effect. \nYou cannot execute this command for Virtual Hubs of VPN Servers operating as a cluster. +CMD_CascadeCompressEnable_Args CascadeCompressEnable [name] +CMD_CascadeCompressEnable_[name] Specify the name of the Cascade Connection whose setting you want to change. + + +# CascadeCompressDisable command +CMD_CascadeCompressDisable Disable Data Compression when Communicating by Cascade Connection +CMD_CascadeCompressDisable_Help When a Cascade Connection registered on the currently managed Virtual Hub is specified and that Cascade Connection is used for communication between VPN Servers via a VPN connection, use this to set the communication contents between the VPN Servers to be not compressed. \nYou cannot execute this command for Virtual Hubs of VPN Servers operating as a cluster. +CMD_CascadeCompressDisable_Args CascadeCompressDisable [name] +CMD_CascadeCompressDisable_[name] Specify the name of the Cascade Connection whose setting you want to change. + + +# CascadeHttpHeader* commands +CMD_CascadeHttpHeader_Prompt_Name Value name (part before the colon): +CMD_CascadeHttpHeader_Prompt_Data Value data (part after the colon): + + +# CascadeHttpHeaderAdd command +CMD_CascadeHttpHeaderAdd Add a custom value in the HTTP header sent to the proxy server +CMD_CascadeHttpHeaderAdd_Help Use this to add a custom value in the HTTP header sent to the proxy server. A custom HTTP header can be used to bypass certain restrictions imposed on the network or to avoid speed limitations applied by the QoS. +CMD_CascadeHttpHeaderAdd_Args CascadeHttpHeaderAdd [name] [/NAME:name] [/DATA:data] +CMD_CascadeHttpHeaderAdd_[name] Specify the name of the Cascade Connection whose setting you want to change. +CMD_CascadeHttpHeaderAdd_NAME Specify the name of the custom value (the part before the colon character). +CMD_CascadeHttpHeaderAdd_DATA Specify the data of the custom value (the part after the colon character). + + +# CascadeHttpHeaderDelete command +CMD_CascadeHttpHeaderDelete Delete a custom value in the HTTP header sent to the proxy server +CMD_CascadeHttpHeaderDelete_Help Use this to delete a custom value in the HTTP header sent to the proxy server. A custom HTTP header can be used to bypass certain restrictions imposed on the network or to avoid speed limitations applied by the QoS. +CMD_CascadeHttpHeaderDelete_Args CascadeHttpHeaderDelete [name] [/NAME:name] +CMD_CascadeHttpHeaderDelete_[name] Specify the name of the Cascade Connection whose setting you want to change. +CMD_CascadeHttpHeaderDelete_NAME Specify the name of the custom value (the part before the colon character). + + +# CascadeHttpHeaderGet command +CMD_CascadeHttpHeaderGet Get the list of custom values in the HTTP header sent to the proxy server +CMD_CascadeHttpHeaderGet_Help Use this to get the list of custom values in the HTTP header sent to the proxy server. A custom HTTP header can be used to bypass certain restrictions imposed on the network or to avoid speed limitations applied by the QoS. +CMD_CascadeHttpHeaderGet_Args CascadeHttpHeaderGet [name] +CMD_CascadeHttpHeaderGet_[name] Specify the name of the Cascade Connection whose setting you want to get. + + +# CascadeProxyNone command +CMD_CascadeProxyNone Specify Direct TCP/IP Connection as the Connection Method of Cascade Connection +CMD_CascadeProxyNone_Help When a Cascade Connection registered on the currently managed Virtual Hub is specified and that Cascade Connection connects to a VPN Server, use this to set Direct TCP/IP Connection as the connection method to use, in which case the connection route will not be via a proxy server. \nYou cannot execute this command for Virtual Hubs of VPN Servers operating as a cluster. +CMD_CascadeProxyNone_Args CascadeProxyNone [name] +CMD_CascadeProxyNone_[name] Specify the name of the Cascade Connection whose setting you want to change. + + +# CascadeProxyHttp command +CMD_CascadeProxyHttp Set Connection Method of Cascade Connection to be via an HTTP Proxy Server +CMD_CascadeProxyHttp_Help When a Cascade Connection registered on the currently managed Virtual Hub is specified and that Cascade Connection connects to a VPN Server, use this to set Connect via HTTP Proxy Server as the method of connection to use, which requires the specification of the host name and port number of the HTTP Proxy server to communicate via as well as a user name and password (when required). \nThe HTTP server that communication will travel via must be compatible with the CONNECT method to use HTTPS communication. \nYou cannot execute this command for Virtual Hubs of VPN Servers operating as a cluster. +CMD_CascadeProxyHttp_Args CascadeProxyHttp [name] [/SERVER:hostname:port] [/USERNAME:username] [/PASSWORD:password] +CMD_CascadeProxyHttp_[name] Specify the name of the Cascade Connection whose setting you want to change. +CMD_CascadeProxyHttp_SERVER Specify the host name or IP address, and port number of the on-route HTTP proxy server using the format [host name:port number]. +CMD_CascadeProxyHttp_USERNAME When user authentication is required to connect to the on-route HTTP proxy server, specify the user name. Also, specify the /PASSWORD parameter at the same time. If the parameters /USERNAME and /PASSWORD are not specified, the user authentication data will not be set. +CMD_CascadeProxyHttp_PASSWORD When user authentication is required to connect to the on-route HTTP proxy server, specify the password. Specify this together with the /USERNAME parameter. +CMD_CascadeProxyHttp_Prompt_Server Proxy Server Host Name and Port Number: + + +# CascadeProxySocks command +CMD_CascadeProxySocks Set Connection Method of Cascade Connection to be via a SOCKS4 Proxy Server +CMD_CascadeProxySocks_Help When a Cascade Connection registered on the currently managed Virtual Hub is specified and that Cascade Connection connects to a VPN Server, use this to set Connect via SOCKS4 Proxy Server as the method of connection to use, which requires the specification of the host name and port number of the SOCKS4 Proxy server to communicate via as well as a user name and password (when required). \nYou cannot execute this command for Virtual Hubs of VPN Servers operating as a cluster. +CMD_CascadeProxySocks_Args CascadeProxySocks [name] [/SERVER:hostname:port] [/USERNAME:username] [/PASSWORD:password] +CMD_CascadeProxySocks_[name] Specify the name of the Cascade Connection whose setting you want to change. +CMD_CascadeProxySocks_SERVER Specify the host name or IP address, and port number of the on-route SOCKS4 proxy server using the format "host name:port number". +CMD_CascadeProxySocks_USERNAME When user authentication is required to connect to the on-route SOCKS4 proxy server, specify the user name. Also, specify the /PASSWORD parameter at the same time. If the parameters /USERNAME and /PASSWORD are not specified, the user authentication data will not be set. +CMD_CascadeProxySocks_PASSWORD When user authentication is required to connect to the on-route SOCKS4 proxy server, specify the password. Specify this together with the /USERNAME parameter. + + +# CascadeProxySocks5 command +CMD_CascadeProxySocks5 Set Connection Method of Cascade Connection to be via a SOCKS5 Proxy Server +CMD_CascadeProxySocks5_Help When a Cascade Connection registered on the currently managed Virtual Hub is specified and that Cascade Connection connects to a VPN Server, use this to set Connect via SOCKS5 Proxy Server as the method of connection to use, which requires the specification of the host name and port number of the SOCKS Proxy server to communicate via as well as a user name and password (when required). \nYou cannot execute this command for Virtual Hubs of VPN Servers operating as a cluster. +CMD_CascadeProxySocks5_Args CascadeProxySocks5 [name] [/SERVER:hostname:port] [/USERNAME:username] [/PASSWORD:password] +CMD_CascadeProxySocks5_[name] Specify the name of the Cascade Connection whose setting you want to change. +CMD_CascadeProxySocks5_SERVER Specify the host name or IP address, and port number of the on-route SOCKS5 proxy server using the format "host name:port number". +CMD_CascadeProxySocks5_USERNAME When user authentication is required to connect to the on-route SOCKS5 proxy server, specify the user name. Also, specify the /PASSWORD parameter at the same time. If the parameters /USERNAME and /PASSWORD are not specified, the user authentication data will not be set. +CMD_CascadeProxySocks5_PASSWORD When user authentication is required to connect to the on-route SOCKS5 proxy server, specify the password. Specify this together with the /USERNAME parameter. + + +# CascadeServerCertEnable command +CMD_CascadeServerCertEnable Enable Cascade Connection Server Certificate Verification Option +CMD_CascadeServerCertEnable_Help When a Cascade Connection registered on the currently managed Virtual Hub is specified and that Cascade Connection connects to a VPN Server, use this to enable the option to check whether the SSL certificate provided by the destination VPN Server can be trusted. \nIf this option is enabled you must either use the CascadeServerCertSet command to save the connection destination server SSL certificate beforehand in the Cascade Connection Settings beforehand, or use the CAAdd command etc. to register a root certificate containing the signed server SSL certificate in the list of Virtual Hub trusted CA certificates. \nIf the certificate of the connected VPN Server cannot be trusted under the condition where the option to verify server certificates was enabled for the Cascade Connection, the connection will be promptly cancelled and continual reattempts at connection will be made. \nYou cannot execute this command for Virtual Hubs of VPN Servers operating as a cluster. +CMD_CascadeServerCertEnable_Args CascadeServerCertEnable [name] +CMD_CascadeServerCertEnable_[name] Specify the name of the Cascade Connection whose setting you want to change. + + +# CascadeServerCertDisable command +CMD_CascadeServerCertDisable Disable Cascade Connection Server Certificate Verification Option +CMD_CascadeServerCertDisable_Help When a Cascade Connection registered on the currently managed Virtual Hub is specified and that Cascade Connection connects to a VPN Server, use this to disable the option to check whether the SSL certificate provided by the destination VPN Server can be trusted. \nYou cannot execute this command for Virtual Hubs of VPN Servers operating as a cluster. +CMD_CascadeServerCertDisable_Args CascadeServerCertDisable [name] +CMD_CascadeServerCertDisable_[name] Specify the name of the Cascade Connection whose setting you want to change. + + +# CascadeServerCertSet command +CMD_CascadeServerCertSet Set the Server Individual Certificate for Cascade Connection +CMD_CascadeServerCertSet_Help When a Cascade Connection registered on the currently managed Virtual Hub is specified and that Cascade Connection connects to a VPN Server, use this to register beforehand the same certificate as the SSL certificate provided by the destination VPN Server. \nIf the option to verify server certificates for Cascade Connections is enabled, you must either use this command to save the connection destination server SSL certificate beforehand in the Cascade Connection Settings beforehand, or use the CAAdd command etc. to register a root certificate containing the signed server SSL certificate in the list of Virtual Hub trusted CA certificates. \nIf the certificate of the connected VPN Server cannot be trusted under the condition where the option to verify server certificates was enabled for the Cascade Connection, the connection will be promptly cancelled and continual reattempts at connection will be made. \nYou cannot execute this command for Virtual Hubs of VPN Servers operating as a cluster. +CMD_CascadeServerCertSet_Args CascadeServerCertSet [name] [/LOADCERT:cert] +CMD_CascadeServerCertSet_[name] Specify the name of the Cascade Connection whose setting you want to change. +CMD_CascadeServerCertSet_LOADCERT Specify X.509 format certificate file name that the server individual certificate you wish to set is saved under. + + +# CascadeServerCertDelete command +CMD_CascadeServerCertDelete Delete the Server Individual Certificate for Cascade Connection +CMD_CascadeServerCertDelete_Help When a Cascade Connection registered on the currently managed Virtual Hub is specified and a server individual certificate is registered for that Cascade Connection, use this to delete that server individual certificate. \nYou cannot execute this command for Virtual Hubs of VPN Servers operating as a cluster. +CMD_CascadeServerCertDelete_Args CascadeServerCertDelete [name] +CMD_CascadeServerCertDelete_[name] Specify the name of the Cascade Connection whose setting you want to change. + + +# CascadeServerCertGet command +CMD_CascadeServerCertGet Get the Server Individual Certificate for Cascade Connection +CMD_CascadeServerCertGet_Help When a Cascade Connection registered on the currently managed Virtual Hub is specified and a server individual certificate is registered for that Cascade Connection, use this to get that certificate and save it as an X.509 format certificate file. \nYou cannot execute this command for Virtual Hubs of VPN Servers operating as a cluster. +CMD_CascadeServerCertGet_Args CascadeServerCertGet [name] [/SAVECERT:path] +CMD_CascadeServerCertGet_[name] Specify the name of the Cascade Connection whose setting you want to change. +CMD_CascadeServerCertGet_SAVECERT Specify the certificate file name to save the server individual certificate in X.509 format. + + +# CascadeDetailSet command +CMD_CascadeDetailSet Set Advanced Settings for Cascade Connection +CMD_CascadeDetailSet_Help Use this to customize the VPN protocol communication settings used when a Cascade Connection registered on the currently managed Virtual Hub is specified and that Cascade Connection connects to the VPN Server. \nYou cannot execute this command for Virtual Hubs of VPN Servers operating as a cluster. +CMD_CascadeDetailSet_Args CascadeDetailSet [name] [/MAXTCP:max_connection] [/INTERVAL:interval] [/TTL:disconnect_span] [/HALF:yes|no] [/NOQOS:yes|no] +CMD_CascadeDetailSet_[name] Specify the name of the Cascade Connection whose setting you want to change. +CMD_CascadeDetailSet_MAXTCP Specify, using an integer in the range 1 to 32, the number of TCP connections to be used for VPN communication. By using data transmission by multiple TCP connections for VPN communication sessions with VPN Servers it is sometimes possible to increase communication speed. \nNote: We recommend about 8 lines when the connection lines to the server are fast, and 1 line when using a slow connection such as dialup. +CMD_CascadeDetailSet_INTERVAL When communicating by VPN by establishing multiple TCP connections, specify in seconds, the establishing interval for each TCP connection. The standard value is 1 second. +CMD_CascadeDetailSet_TTL When specifying connection life of each TCP connection specify in seconds the keep-alive time from establishing a TCP connection until disconnection. If 0 is specified, keep-alive will not be set. +CMD_CascadeDetailSet_HALF Specify "yes" when enabling half duplex mode. When using two or more TCP connections for VPN communication, it is possible to use Half Duplex Mode. By enabling half duplex mode it is possible to automatically fix data transmission direction as half and half for each TCP connection. In the case where a VPN using 8 TCP connections is established, for example, when half-duplex is enabled, communication can be fixes so that 4 TCP connections are dedicated to the upload direction and the other 4 connections are dedicated to the download direction. +CMD_CascadeDetailSet_NOQOS Specify "yes" when disabling VoIP / QoS functions. Normally "no" is specified. +CMD_CascadeDetailSet_Eval_MaxTcp Specify an integer in the range 1 to 32 for the number of TCP connections. +CMD_CascadeDetailSet_Eval_Interval Set at least 1 second for the interval to establish a TCP connection. +CMD_CascadeDetailSet_Prompt_MaxTcp Number of TCP Connections to Use in VPN Communication: +CMD_CascadeDetailSet_Prompt_Interval Interval between Establishing Each TCP Connection: +CMD_CascadeDetailSet_Prompt_TTL Connection Life of Each TCP Connection (0 for no keep-alive): +CMD_CascadeDetailSet_Prompt_HALF Enable half-duplex mode (yes/no): + + +# CascadePolicySet command +CMD_CascadePolicySet Set Cascade Connection Session Security Policy +CMD_CascadePolicySet_Help When a Cascade Connection registered on the currently managed Virtual Hub is specified and that Cascade Connection is established, use this to change the security policy contents that are applied to the session generated by the Virtual Hub. \nWhen a Virtual Hub makes a Cascade Connection to another VPN Server, a Cascade Session will be newly generated on the Virtual Hub that is the Cascade Connection source. You can use this command to set the security policy contents that will set this Cascade session. \nYou cannot execute this command for Virtual Hubs of VPN Servers operating as a cluster. +CMD_CascadePolicySet_Args [name] [/NAME:policy_name] [/VALUE:num|yes|no] +CMD_CascadePolicySet_[name] Specify the name of the Cascade Connection whose setting you want to change. +CMD_CascadePolicySet_NAME Specify the name of policy whose values you want to change. You can use the PolicyList command to display a list of policy names and values that can be set. +CMD_CascadePolicySet_VALUE Specify a new policy value. If the policy is an integer value, specify an integer. Specify yes or no for Boolean types. You can view the type and value that can be set by using the PolicyList command. +CMD_CascadePolicySet_PROMPT_POLNAME Name of Policy Whose Value you want to Change: +CMD_CascadePolicySet_PROMPT_POLVALUE Value to newly set: +CMD_CascadePolicySet_Invalid_Name The specified policy name "%S" is invalid. \nCheck the list of policy names that can be set using the PolicyList command. +CMD_CascadePolicySet_Invalid_Name_For_Cascade The specified policy name "%S" cannot be used for a Cascade Connection security policy setting. +CMD_CascadePolicySet_Invalid_Range Specify policy "%S" within the range of %s. + + +# PolicyList command +CMD_PolicyList Display List of Security Policy Types and Settable Values +CMD_PolicyList_Help Use this to display a list of item names, descriptions, and settable values in the security policies that can be set for VPN Server users and groups and Cascade Connections. \nBy running the PolicyList command without specifying any parameters, a list of all supported security policy names and descriptions will be displayed. \nBy specifying the name using the PolicyList command parameter, a detailed description related to this value and the type and range of the settable value will be displayed. +CMD_PolicyList_Args PolicyList [name] +CMD_PolicyList_[name] This allows you to specify the policy name whose description you want to display. If you don't specify a name, a list of all supported security names and descriptions will be displayed. +CMD_PolicyList_Invalid_Name The specified policy name is invalid. +CMD_PolicyList_Column_1 Policy name +CMD_PolicyList_Column_2 Simple description of policy +CMD_PolicyList_Column_3 Setting value +CMD_PolicyList_Help_1 [Policy Name] +CMD_PolicyList_Help_2 [Simple Description of Policy] +CMD_PolicyList_Help_3 [Range of Settable Values] +CMD_PolicyList_Help_4 [Default Value] +CMD_PolicyList_Help_5 [Detailed Description of Policy] +CMD_PolicyList_Range_Bool yes or no +CMD_PolicyList_Range_Int_1 Range from %s to %s (0 cannot be specified) +CMD_PolicyList_Range_Int_2 Range from %s to %s (if 0 is specified, nothing is set) + + +# CascadeStatusGet command +CMD_CascadeStatusGet Get Current Cascade Connection Status +CMD_CascadeStatusGet_Help When a Cascade Connection registered on the currently managed Virtual Hub is specified and that Cascade Connection is currently online, use this to get its connection status and other information. \nYou cannot execute this command for Virtual Hubs of VPN Servers operating as a cluster. +CMD_CascadeStatusGet_Args CascadeStatusGet [name] +CMD_CascadeStatusGet_[name] Specify the name of the Cascade Connection whose information you want to get. + + +# CascadeRename command +CMD_CascadeRename Change Name of Cascade Connection +CMD_CascadeRename_Help When a Cascade Connection registered on the currently managed Virtual Hub is specified, use this to change the name of that Cascade Connection. \nYou cannot execute this command for Virtual Hubs of VPN Servers operating as a cluster. +CMD_CascadeRename_Args CascadeRename [name] [/NEW:new_name] +CMD_CascadeRename_[name] Specify the current name of the Cascade Connection whose name you want to change. +CMD_CascadeRename_NEW Specify the new name after the change. +CMD_CascadeRename_PROMPT_OLD Current Name: +CMD_CascadeRename_PROMPT_NEW New Name: + + + +# CascadeOnline command +CMD_CascadeOnline Switch Cascade Connection to Online Status +CMD_CascadeOnline_Help When a Cascade Connection registered on the currently managed Virtual Hub is specified, use this to switch that Cascade Connection to online status. The Cascade Connection that is switched to online status begins the process of connecting to the destination VPN Server in accordance with the Connection Setting. The Cascade Connection that is switched to online status will establish normal connection to the VPN Server or continue to attempt connection until it is switched to offline status. \nYou cannot execute this command for Virtual Hubs of VPN Servers operating as a cluster. +CMD_CascadeOnline_Args CascadeOnline [name] +CMD_CascadeOnline_[name] Specify the name of the Cascade Connection to switch to online status. + + +# CascadeOffline command +CMD_CascadeOffline Switch Cascade Connection to Offline Status +CMD_CascadeOffline_Help When a Cascade Connection registered on the currently managed Virtual Hub is specified, use this to switch that Cascade Connection to offline status. The Cascade Connection that is switched to offline will not connect to the VPN Server until next time it is switched to the online status using the CascadeOnline command \nYou cannot execute this command for Virtual Hubs of VPN Servers operating as a cluster. +CMD_CascadeOffline_Args CascadeOffline [name] +CMD_CascadeOffline_[name] Specify the name of the Cascade Connection to switch to offline status. + + +# AccessAdd command +CMD_AccessAdd Add Access List Rules (IPv4) +CMD_AccessAdd_Help Use this to add a new rule to the access list of the currently managed Virtual Hub. \nThe access list is a set of packet file rules that are applied to packets that flow through the Virtual Hub. You can register multiple rules in an access list and you can also define an priority for each rule. All packets are checked for the conditions specified by the rules registered in the access list and based on the operation that is stipulated by the first matching rule, they either pass or are discarded. Packets that do not match any rule are implicitly allowed to pass. You can also use the AccessAddEx command to generate delays, jitters and packet losses. \nThis command cannot be run on VPN Bridge. \nYou cannot execute this command for Virtual Hubs of VPN Servers operating as a member server on a cluster. +CMD_AccessAdd_Args AccessAdd [pass|discard] [/MEMO:memo] [/PRIORITY:priority] [/SRCUSERNAME:username] [/DESTUSERNAME:username] [/SRCMAC:mac/mask] [/DESTMAC:mac/mask] [/SRCIP:ip/mask] [/DESTIP:ip/mask] [/PROTOCOL:tcp|udp|icmpv4|icmpv6|ip|num] [/SRCPORT:start-end] [/DESTPORT:start-end] [/TCPSTATE: established|unestablished] +CMD_AccessAdd_[pass|discard] When a packet matches this rule condition, this operation is decided. When pass is specified, the packet is allowed to pass, and when discard is specified, the packet is discarded. +CMD_AccessAdd_MEMO Specify a description (memo) for this rule. +CMD_AccessAdd_PRIORITY Specify an integer of 1 or higher to indicate the priority of the rule. Higher priority is given to rules with the lower priority values. +CMD_AccessAdd_SRCIP Specify a source IPv4 address as a rule condition. Specify the IPv4 address in the format of "IP Address/Mask" by separating the decimal values using dots such as "192.168.0.1". For the mask, either specify decimal values separated by dots such as "255.255.255.0", or you can specify the bit length from the header using a decimal value such as "24". If you specify "0.0.0.0/0.0.0.0", this means all hosts. +CMD_AccessAdd_DESTIP Specify a destination IPv4 address as a rule condition in the format of "IP Address/Mask". Use the same method of specification as for the /SRCIP parameter. +CMD_AccessAdd_PROTOCOL Specify a protocol type as a rule condition. Input the IP protocol number using decimal values or specify one of the keywords "tcp" (TCP/IP protocol, no.6), "udp" (UDP/IP protocol, no.17), "icmpv4" (ICMPv4 protocol, no.1), "icmpv6" (ICMPv6 protocol, no.58) or "ip" (all protocols, no.0). Specify 0 to make the rule apply to all IP protocols. +CMD_AccessAdd_SRCPORT If the specified protocol is TCP/IP or UDP/IP, specify the source port number as the rule condition. Protocols other than this will be ignored. When this parameter is not specified, the rules will apply to all port numbers. When specifying, do so using the following method "1-1024" (1 to 1024), "23" (only 23). +CMD_AccessAdd_DESTPORT If the specified protocol is TCP/IP or UDP/IP, specify the destination port number as the rule condition. Protocols other than this will be ignored. Use the same method of specification as for the /SRCPORT parameter. +CMD_AccessAdd_SRCUSERNAME You can apply this rule to only the packets sent by a user session of a user name that has been specified as a rule condition. In this case, specify the user name. +CMD_AccessAdd_DESTUSERNAME You can apply this rule to only the packets received by a user session of a user name that has been specified as a rule condition. In this case, specify the user name. +CMD_AccessAdd_SRCMAC Specify destination MAC address as a rule. Specify MAC address with "-" or ":" separators and hexadecimal number like "00-AC-84-EA-33-BC/FF-FF-FF-FF-FF-00". The separators are skippable. +CMD_AccessAdd_DESTMAC Specify destination MAC address as a rule. Use the same method of specification as for the /SRCMAC parameter. +CMD_AccessAdd_TCPSTATE Specify TCP connection state as a rule. Use Established or Unestablished. +CMD_AccessAdd_Prompt_TYPE Pass or Discard: +CMD_AccessAdd_Prompt_MEMO Rule Description (Memo): +CMD_AccessAdd_Prompt_PRIORITY Rule Priority: +CMD_AccessAdd_Eval_PRIORITY Specify an integer of 1 or higher for the priority. +CMD_AccessAdd_Prompt_SRCIP Source IP Address ("0.0.0.0/0" specifies all): +CMD_AccessAdd_Prompt_DESTIP Destination IP Address ("0.0.0.0/0" specifies all): +CMD_AccessAdd_Prompt_PROTOCOL Protocol No. or Protocol Name (tcp/udp/icmpv4/icmpv6/ip): +CMD_AccessAdd_Prompt_SRCPORT Source Port Number Range (tcp/udp only): +CMD_AccessAdd_Prompt_DESTPORT Destination Port Number Range (tcp/udp only): +CMD_AccessAdd_Prompt_SRCUSERNAME Source User Name (all when unspecified): +CMD_AccessAdd_Prompt_DESTUSERNAME Destination User Name (all when unspecified): +CMD_AccessAdd_Prompt_SRCMAC Source MAC Address and Mask (all when unspecified): +CMD_AccessAdd_Prompt_DESTMAC Destination MAC Address and Mask (all when unspecified): +CMD_AccessAdd_Prompt_TCPSTATE TCP Connection State (Established/Unestablished): + + +# AccessAddEx command +CMD_AccessAddEx Add Extended Access List Rules (IPv4: Delay, Jitter and Packet Loss Generating) +CMD_AccessAddEx_Help Use this to add a new rule to the access list of the currently managed Virtual Hub. You can set to generate delays, jitters and packet losses when a packet is passing via the Virtual Hub. \nThe access list is a set of packet file rules that are applied to packets that flow through the Virtual Hub. You can register multiple rules in an access list and you can also define an priority for each rule. All packets are checked for the conditions specified by the rules registered in the access list and based on the operation that is stipulated by the first matching rule, they either pass or are discarded. Packets that do not match any rule are implicitly allowed to pass. You can also use the AccessAddEx command to generate delays, jitters and packet losses. \nThis command cannot be run on VPN Bridge. \nYou cannot execute this command for Virtual Hubs of VPN Servers operating as a member server on a cluster. +CMD_AccessAddEx_Args AccessAddEx [pass|discard] [/MEMO:memo] [/PRIORITY:priority] [/SRCUSERNAME:username] [/DESTUSERNAME:username] [/SRCMAC:mac/mask] [/DESTMAC:mac/mask] [/SRCIP:ip/mask] [/DESTIP:ip/mask] [/PROTOCOL:tcp|udp|icmpv4|icmpv6|ip|num] [/SRCPORT:start-end] [/DESTPORT:start-end] [/TCPSTATE: established|unestablished] [/DELAY:delay_millisec] [/JITTER:jitter_percent] [/LOSS:loss_percent] [/REDIRECTURL:url] +CMD_AccessAddEx_[pass|discard] When a packet matches this rule condition, this operation is decided. When pass is specified, the packet is allowed to pass, and when discard is specified, the packet is discarded. The setting of delays, jitters and packet losses is applied if the action is pass. +CMD_AccessAddEx_MEMO Specify a description (memo) for this rule. +CMD_AccessAddEx_PRIORITY Specify an integer of 1 or higher to indicate the priority of the rule. Higher priority is given to rules with the lower priority values. +CMD_AccessAddEx_SRCIP Specify a source IPv4 address as a rule condition. Specify the IPv4 address in the format of "IP Address/Mask" by separating the decimal values using dots such as "192.168.0.1". For the mask, either specify decimal values separated by dots such as "255.255.255.0", or you can specify the bit length from the header using a decimal value such as "24". If you specify "0.0.0.0/0.0.0.0", this means all hosts. +CMD_AccessAddEx_DESTIP Specify a destination IPv4 address as a rule condition in the format of "IP Address/Mask". Use the same method of specification as for the /SRCIP parameter. +CMD_AccessAddEx_PROTOCOL Specify a protocol type as a rule condition. Input the IP protocol number using decimal values or specify one of the keywords "tcp" (TCP/IP protocol, no.6), "udp" (UDP/IP protocol, no.17), "icmpv4" (ICMPv4 protocol, no.1), "icmpv6" (ICMPv6 protocol, no.58) or "ip" (all protocols, no.0). Specify 0 to make the rule apply to all IP protocols. +CMD_AccessAddEx_SRCPORT If the specified protocol is TCP/IP or UDP/IP, specify the source port number as the rule condition. Protocols other than this will be ignored. When this parameter is not specified, the rules will apply to all port numbers. When specifying, do so using the following method "1-1024" (1 to 1024), "23" (only 23). +CMD_AccessAddEx_DESTPORT If the specified protocol is TCP/IP or UDP/IP, specify the destination port number as the rule condition. Protocols other than this will be ignored. Use the same method of specification as for the /SRCPORT parameter. +CMD_AccessAddEx_SRCUSERNAME You can apply this rule to only the packets sent by a user session of a user name that has been specified as a rule condition. In this case, specify the user name. +CMD_AccessAddEx_DESTUSERNAME You can apply this rule to only the packets received by a user session of a user name that has been specified as a rule condition. In this case, specify the user name. +CMD_AccessAddEx_SRCMAC Specify destination MAC address as a rule. Specify MAC address with "-" or ":" separators and hexadecimal number like "00-AC-84-EA-33-BC/FF-FF-FF-FF-FF-00". The separators are skippable. +CMD_AccessAddEx_DESTMAC Specify destination MAC address as a rule. Use the same method of specification as for the /SRCMAC parameter. +CMD_AccessAddEx_TCPSTATE Specify TCP connection state as a rule. Use Established or Unestablished. +CMD_AccessAddEx_DELAY Set this value to generate delays when packets is passing. Specify the delay period in milliseconds. Specify 0 means no delays to generate. The delays must be 10000 milliseconds at most. +CMD_AccessAddEx_JITTER Set this value to generate jitters when packets is passing. Specify the ratio of fluctuation of jitters within 0% to 100% range. Specify 0 means no jitters to generate. +CMD_AccessAddEx_LOSS Set this value to generate packet losses when packets is passing. Specify the ratio of packet losses within 0% to 100% range. Specify 0 means no packet losses to generate. +CMD_AccessAddEx_REDIRECTURL The specified URL will be mandatory replied to the client as a response for TCP connecting request packets which matches the conditions of this access list entry via this Virtual Hub. To use this setting, you can enforce the web browser of the VPN Client computer to show the specified web site when that web browser tries to access the specific IP address. +CMD_AccessAddEx_Prompt_DELAY Delays to Generate (in milliseconds: 0 - 10000): +CMD_AccessAddEx_Prompt_JITTER Fluctuation of Jitters to Generate (Percent: 0 - 100): +CMD_AccessAddEx_Prompt_LOSS Ratio of Packet Losses (Percent: 0 - 100): +CMD_AccessAddEx_Eval_DELAY Delays must be 10000 at maximum. +CMD_AccessAddEx_Eval_JITTER Fluctuation of Jitters must be 100 at maximum. +CMD_AccessAddEx_Eval_LOSS Ratio of Packet Losses must be 100 at maximum. + + +# AccessAdd6 command +CMD_AccessAdd6 Add Access List Rules (IPv6) +CMD_AccessAdd6_Help Use this to add a new rule to the access list of the currently managed Virtual Hub. \nThe access list is a set of packet file rules that are applied to packets that flow through the Virtual Hub. You can register multiple rules in an access list and you can also define an priority for each rule. All packets are checked for the conditions specified by the rules registered in the access list and based on the operation that is stipulated by the first matching rule, they either pass or are discarded. Packets that do not match any rule are implicitly allowed to pass. You can also use the AccessAddEx6 command to generate delays, jitters and packet losses. \nThis command cannot be run on VPN Bridge. \nYou cannot execute this command for Virtual Hubs of VPN Servers operating as a member server on a cluster. +CMD_AccessAdd6_Args AccessAdd6 [pass|discard] [/MEMO:memo] [/PRIORITY:priority] [/SRCUSERNAME:username] [/DESTUSERNAME:username] [/SRCMAC:mac/mask] [/DESTMAC:mac/mask] [/SRCIP:ip/mask] [/DESTIP:ip/mask] [/PROTOCOL:tcp|udp|icmpv4|icmpv6|ip|num] [/SRCPORT:start-end] [/DESTPORT:start-end] [/TCPSTATE: established|unestablished] +CMD_AccessAdd6_[pass|discard] When a packet matches this rule condition, this operation is decided. When pass is specified, the packet is allowed to pass, and when discard is specified, the packet is discarded. +CMD_AccessAdd6_MEMO Specify a description (memo) for this rule. +CMD_AccessAdd6_PRIORITY Specify an integer of 1 or higher to indicate the priority of the rule. Higher priority is given to rules with the lower priority values. +CMD_AccessAdd6_SRCIP Specify a source IPv6 address as a rule condition. Specify the IPv6 address in the format of "IP Address/Mask" by separating the hexadecimal values using colons such as "2001:200:0:1::". For the mask, either specify hexadecimal values separated by colons such as ffff:ffff:ffff:ffff::, or you can specify the bit length from the header using a decimal value such as "64". If you specify "::/0", this means all hosts. +CMD_AccessAdd6_DESTIP Specify a destination IPv6 address as a rule condition in the format of "IP Address/Mask". Use the same method of specification as for the /SRCIP parameter. +CMD_AccessAdd6_PROTOCOL Specify a protocol type as a rule condition. Input the IP protocol number using decimal values or specify one of the keywords "tcp" (TCP/IP protocol, no.6), "udp" (UDP/IP protocol, no.17), "icmpv4" (ICMPv4 protocol, no.1), "icmpv6" (ICMPv6 protocol, no.58) or "ip" (all protocols, no.0). Specify 0 to make the rule apply to all IP protocols. +CMD_AccessAdd6_SRCPORT If the specified protocol is TCP/IP or UDP/IP, specify the source port number as the rule condition. Protocols other than this will be ignored. When this parameter is not specified, the rules will apply to all port numbers. When specifying, do so using the following method "1-1024" (1 to 1024), "23" (only 23). +CMD_AccessAdd6_DESTPORT If the specified protocol is TCP/IP or UDP/IP, specify the destination port number as the rule condition. Protocols other than this will be ignored. Use the same method of specification as for the /SRCPORT parameter. +CMD_AccessAdd6_SRCUSERNAME You can apply this rule to only the packets sent by a user session of a user name that has been specified as a rule condition. In this case, specify the user name. +CMD_AccessAdd6_DESTUSERNAME You can apply this rule to only the packets received by a user session of a user name that has been specified as a rule condition. In this case, specify the user name. +CMD_AccessAdd6_SRCMAC Specify destination MAC address as a rule. Specify MAC address with "-" or ":" separators and hexadecimal number like "00-AC-84-EA-33-BC/FF-FF-FF-FF-FF-00". The separators can be skipped. +CMD_AccessAdd6_DESTMAC Specify destination MAC address as a rule. Use the same method of specification as for the /SRCMAC parameter. +CMD_AccessAdd6_TCPSTATE Specify TCP connection state as a rule. Use Established or Unestablished. +CMD_AccessAdd6_Prompt_TYPE Pass or Discard: +CMD_AccessAdd6_Prompt_MEMO Rule Description (Memo): +CMD_AccessAdd6_Prompt_PRIORITY Rule Priority: +CMD_AccessAdd6_Eval_PRIORITY Specify an integer of 1 or higher for the priority. +CMD_AccessAdd6_Prompt_SRCIP Source IP Address ("::/0" specifies all): +CMD_AccessAdd6_Prompt_DESTIP Destination IP Address ("::/0" specifies all): +CMD_AccessAdd6_Prompt_PROTOCOL Protocol No. or Protocol Name (tcp/udp/icmpv4/icmpv6/ip): +CMD_AccessAdd6_Prompt_SRCPORT Source Port Number Range (tcp/udp only): +CMD_AccessAdd6_Prompt_DESTPORT Destination Port Number Range (tcp/udp only): +CMD_AccessAdd6_Prompt_SRCUSERNAME Source User Name (all when unspecified): +CMD_AccessAdd6_Prompt_DESTUSERNAME Destination User Name (all when unspecified): +CMD_AccessAdd6_Prompt_SRCMAC Source MAC Address and Mask (all when unspecified): +CMD_AccessAdd6_Prompt_DESTMAC Destination MAC Address and Mask (all when unspecified): +CMD_AccessAdd6_Prompt_TCPSTATE TCP Connection State (Established/Unestablished): + + +# AccessAddEx6 command +CMD_AccessAddEx6 Add Extended Access List Rules (IPv6: Delay, Jitter and Packet Loss Generating) +CMD_AccessAddEx6_Help Use this to add a new rule to the access list of the currently managed Virtual Hub. You can set to generate delays, jitters and packet losses when a packet is passing via the Virtual Hub. \nThe access list is a set of packet file rules that are applied to packets that flow through the Virtual Hub. You can register multiple rules in an access list and you can also define a priority for each rule. All packets are checked for the conditions specified by the rules registered in the access list and based on the operation that is stipulated by the first matching rule, they either pass or are discarded. Packets that do not match any rule are implicitly allowed to pass. You can also use the AccessAddEx6 command to generate delays, jitters and packet losses. \nThis command cannot be run on VPN Bridge. \nYou cannot execute this command for Virtual Hubs of VPN Servers operating as a member server on a cluster. +CMD_AccessAddEx6_Args AccessAddEx6 [pass|discard] [/MEMO:memo] [/PRIORITY:priority] [/SRCUSERNAME:username] [/DESTUSERNAME:username] [/SRCMAC:mac/mask] [/DESTMAC:mac/mask] [/SRCIP:ip/mask] [/DESTIP:ip/mask] [/PROTOCOL:tcp|udp|icmpv4|icmpv6|ip|num] [/SRCPORT:start-end] [/DESTPORT:start-end] [/TCPSTATE: established|unestablished] [/DELAY:delay_millisec] [/JITTER:jitter_percent] [/LOSS:loss_percent] [/REDIRECTURL:url] +CMD_AccessAddEx6_[pass|discard] When a packet matches this rule condition, this operation is decided. When pass is specified, the packet is allowed to pass, and when discard is specified, the packet is discarded. The setting of delays, jitters and packet losses is applied if the action is pass. +CMD_AccessAddEx6_MEMO Specify a description (memo) for this rule. +CMD_AccessAddEx6_PRIORITY Specify an integer of 1 or higher to indicate the priority of the rule. Higher priority is given to rules with the lower priority values. +CMD_AccessAddEx6_SRCIP Specify a source IPv6 address as a rule condition. Specify the IPv6 address in the format of "IP Address/Mask" by separating the hexadecimal values using colons such as "2001:200:0:1::". For the mask, either specify hexadecimal values separated by colons such as "ffff:ffff:ffff:ffff::", or you can specify the bit length from the header using a decimal value such as 64. If you specify "::/0", this means all hosts. +CMD_AccessAddEx6_DESTIP Specify a destination IPv6 address as a rule condition in the format of "IP Address/Mask". Use the same method of specification as for the /SRCIP parameter. +CMD_AccessAddEx6_PROTOCOL Specify a protocol type as a rule condition. Input the IP protocol number using decimal values or specify one of the keywords "tcp" (TCP/IP protocol, no.6), "udp" (UDP/IP protocol, no.17), "icmpv4" (ICMPv4 protocol, no.1), "icmpv6" (ICMPv6 protocol, no.58) or "ip" (all protocols, no.0). Specify 0 to make the rule apply to all IP protocols. +CMD_AccessAddEx6_SRCPORT If the specified protocol is TCP/IP or UDP/IP, specify the source port number as the rule condition. Protocols other than this will be ignored. When this parameter is not specified, the rules will apply to all port numbers. When specifying, do so using the following method "1-1024" (1 to 1024), "23" (only 23). +CMD_AccessAddEx6_DESTPORT If the specified protocol is TCP/IP or UDP/IP, specify the destination port number as the rule condition. Protocols other than this will be ignored. Use the same method of specification as for the /SRCPORT parameter. +CMD_AccessAddEx6_SRCUSERNAME You can apply this rule to only the packets sent by a user session of a user name that has been specified as a rule condition. In this case, specify the user name. +CMD_AccessAddEx6_DESTUSERNAME You can apply this rule to only the packets received by a user session of a user name that has been specified as a rule condition. In this case, specify the user name. +CMD_AccessAddEx6_SRCMAC Specify destination MAC address as a rule. Specify MAC address with "-" or ":" separators and hexadecimal number like "00-AC-84-EA-33-BC/FF-FF-FF-FF-FF-00". The separators can be skipped. +CMD_AccessAddEx6_DESTMAC Specify destination MAC address as a rule. Use the same method of specification as for the /SRCMAC parameter. +CMD_AccessAddEx6_TCPSTATE Specify TCP connection state as a rule. Use Established or Unestablished. +CMD_AccessAddEx6_DELAY Set this value to generate delays when packets is passing. Specify the delay period in milliseconds. Specify 0 means no delays to generate. The delays must be 10000 milliseconds at most. +CMD_AccessAddEx6_JITTER Set this value to generate jitters when packets is passing. Specify the ratio of fluctuation of jitters within 0% to 100% range. Specify 0 means no jitters to generate. +CMD_AccessAddEx6_LOSS Set this value to generate packet losses when packets is passing. Specify the ratio of packet losses within 0% to 100% range. Specify 0 means no packet losses to generate. +CMD_AccessAddEx6_REDIRECTURL The specified URL will be mandatory replied to the client as a response for TCP connecting request packets which matches the conditions of this access list entry via this Virtual Hub. To use this setting, you can enforce the web browser of the VPN Client computer to show the specified web site when that web browser tries to access the specific IP address. +CMD_AccessAddEx6_Prompt_DELAY Delays to Generate (in milliseconds: 0 - 10000): +CMD_AccessAddEx6_Prompt_JITTER Fluctuation of Jitters to Generate (Percent: 0 - 100): +CMD_AccessAddEx6_Prompt_LOSS Ratio of Packet Losses (Percent: 0 - 100): +CMD_AccessAddEx6_Eval_DELAY Delays must be 10000 at maximum. +CMD_AccessAddEx6_Eval_JITTER Fluctuation of Jitters must be 100 at maximum. +CMD_AccessAddEx6_Eval_LOSS Ratio of Packet Losses must be 100 at maximum. + + +# AccessList command +CMD_AccessList Get Access List Rule List +CMD_AccessList_Help Use this to get a list of packet filter rules that are registered on access list of the currently managed Virtual Hub. \nThe access list is a set of packet file rules that are applied to packets that flow through the Virtual Hub. You can register multiple rules in an access list and you can also define a priority for each rule. All packets are checked for the conditions specified by the rules registered in the access list and based on the operation that is stipulated by the first matching rule, they either pass or are discarded. Packets that do not match any rule are implicitly allowed to pass. \nThis command cannot be run on VPN Bridge. \nYou cannot execute this command for Virtual Hubs of VPN Servers operating as a member server on a cluster. +CMD_AccessList_Args AccessList + + +# AccessDelete command +CMD_AccessDelete Delete Rule from Access List +CMD_AccessDelete_Help Use this to specify a packet filter rule registered on the access list of the currently managed Virtual Hub and delete it. \nTo delete a rule, you must specify that rule's ID. You can display the ID by using the AccessList command. \nIf you wish not to delete the rule but to only temporarily disable it, use the AccessDisable command. \nThis command cannot be run on VPN Bridge. \nYou cannot execute this command for Virtual Hubs of VPN Servers operating as a member server on a cluster. +CMD_AccessDelete_Args AccessDelete [id] +CMD_AccessDelete_[id] Specify either the ID or the Unique ID of the rule to delete. +CMD_Access_Prompt_ID Access List Rule ID or Unique ID: + + +# AccessEnable command +CMD_AccessEnable Enable Access List Rule +CMD_AccessEnable_Help Use this to specify a packet filter rule registered on the access list of the currently managed Virtual Hub and enable it. The enabled rule will be used by packet filtering. \nTo enable a rule, you must specify that rule's ID. You can display the ID by using the AccessList command. \nThis command cannot be run on VPN Bridge. \nYou cannot execute this command for Virtual Hubs of VPN Servers operating as a member server on a cluster. +CMD_AccessEnable_Args AccessEnable [id] +CMD_AccessEnable_[id] Specify the ID of the rule to enable. + + +# AccessDisable command +CMD_AccessDisable Disable Access List Rule +CMD_AccessDisable_Help Use this to specify a packet filter rule registered on the access list of the currently managed Virtual Hub and disable it. The disabled rule will be used by packet filtering. \nTo disable a rule, you must specify that rule's ID. You can display the ID by using the AccessList command. \nThis command cannot be run on VPN Bridge. \nYou cannot execute this command for Virtual Hubs of VPN Servers operating as a member server on a cluster. +CMD_AccessDisable_Args AccessDisable [id] +CMD_AccessDisable_[id] Specify the ID of the rule to disable. + + +# UserList command +CMD_UserList Get List of Users +CMD_UserList_Help Use this to get a list of users that are registered on the security account database of the currently managed Virtual Hub. \nThis command cannot be run on VPN Bridge. \nYou cannot execute this command for Virtual Hubs of VPN Servers operating as a member server on a cluster. +CMD_UserList_Args UserList + + +# UserCreate command +CMD_UserCreate Create User +CMD_UserCreate_Help Use this to create a new user in the security account database of the currently managed Virtual Hub. \nBy creating a user, the VPN Client can connect to the Virtual Hub by using the authentication information of that user. \nWhen a user is created using the UserCreate command and the auth type of that user is registered as Password Authentication, a random string will be assigned as the password. Therefore, that user will not be able to connect to the Virtual Hub in that state. After creating the user, you must always use the UserPasswordSet command to specify the user password, or alternatively use the UserAnonymousSet command, UserCertSet command, UserSignedSet command, UserRadiusSet command or UserNTLMSet command to change the user's auth type. \nNote that a user whose user name has been created as "*" (a single asterisk character) will automatically be registered as a RADIUS authentication user. For cases where there are users with "*" as the name, when a user, whose user name that has been provided when a client connected to a VPN Server does not match existing user names, is able to be authenticated by a RADIUS server or NT domain controller by inputting a user name and password, the authentication settings and security policy settings will follow the setting for the user "*". \nTo change the user information of a user that has been created, use the UserSet command. \nThis command cannot be run on VPN Bridge. \nYou cannot execute this command for Virtual Hubs of VPN Servers operating as a member server on a cluster. +CMD_UserCreate_Args UserCreate [name] [/GROUP:group] [/REALNAME:realname] [/NOTE:note] +CMD_UserCreate_[name] Specify the user name of the user to be newly created. +CMD_UserCreate_GROUP When assigning a user in a group, specify the group name. When not assigning a user to any group, specify /GROUP:none. +CMD_UserCreate_REALNAME Specify the user's full name. If you are not specifying this, specify /REALNAME:none. +CMD_UserCreate_NOTE Specify a description of the user. If you are not specifying this, specify /NOTE:none +CMD_UserCreate_Prompt_NAME User Name: +CMD_UserCreate_Prompt_GROUP Assigned Group Name: +CMD_UserCreate_Prompt_REALNAME User Full Name: +CMD_UserCreate_Prompt_NOTE User Description: + + +# UserSet command +CMD_UserSet Change User Information +CMD_UserSet_Help Use this to change user information that is registered on the security account database of the currently managed Virtual Hub. \nThe user information that can be changed using this command are the three items that are specified when a new user is created using the UserCreate command: Group Name, Full Name, and Description. \nTo get the list of currently registered users, use the UserList command. \nThis command cannot be run on VPN Bridge. \nYou cannot execute this command for Virtual Hubs of VPN Servers operating as a member server on a cluster. +CMD_UserSet_Args UserSet [name] [/GROUP:group] [/REALNAME:realname] [/NOTE:note] +CMD_UserSet_[name] Specify the user name of the user whose setting you want to change. +CMD_UserSet_GROUP When assigning a user in a group, specify the group name. When not assigning a user to any group, specify /GROUP:none. +CMD_UserSet_REALNAME Specify the user's full name. If you are not specifying this, specify /REALNAME:none +CMD_UserSet_NOTE Specify a description of the user. If you are not specifying this, specify /NOTE:none. + + +# UserDelete command +CMD_UserDelete Delete User +CMD_UserDelete_Help Use this to delete a user that is registered on the security account database of the currently managed Virtual Hub. By deleting the user, that user will no long be able to connect to the Virtual Hub. \nYou can use the UserPolicySet command to instead of deleting a user, set the user to be temporarily denied from logging in. \nTo get the list of currently registered users, use the UserList command. \nThis command cannot be run on VPN Bridge. \nYou cannot execute this command for Virtual Hubs of VPN Servers operating as a member server on a cluster. +CMD_UserDelete_Args UserDelete [name] +CMD_UserDelete_[name] Specify the name of the user to delete. + + +# UserGet command +CMD_UserGet Get User Information +CMD_UserGet_Help Use this to get user registration information that is registered on the security account database of the currently managed Virtual Hub. \nThe information that you can get using this command are User Name, Full Name, Group Name, Expiration Date, Security Policy, and Auth Type, as well as parameters that are specified as auth type attributes and the statistical data of that user. \nTo get the list of currently registered users, use the UserList command. \nThis command cannot be run on VPN Bridge. \nYou cannot execute this command for Virtual Hubs of VPN Servers operating as a member server on a cluster. +CMD_UserGet_Args UserGet [name] +CMD_UserGet_[name] Specify the user name of the user whose information you want to get. +CMD_UserGet_Column_Name User Name +CMD_UserGet_Column_RealName Full Name +CMD_UserGet_Column_Note Description +CMD_UserGet_Column_Group Group Name +CMD_UserGet_Column_Expires Expiration Date +CMD_UserGet_Column_AuthType Auth Type +CMD_UserGet_Column_UserCert Registered User Individual Certificate +CMD_UserGet_Column_RadiusAlias External Authentication Server Authentication User Name +CMD_UserGet_Column_RootCert_CN Limit of Certificate CN Value +CMD_UserGet_Column_RootCert_SERIAL Limit of Certificate Serial Number +CMD_UserGet_Policy Security Policy Set for this User + + +# UserAnonymousSet command +CMD_UserAnonymousSet Set Anonymous Authentication for User Auth Type +CMD_UserAnonymousSet_Help Use this to set Anonymous Authentication as the auth type for a user that is registered on the security account database of the currently managed Virtual Hub. A VPN Client that has connected to a Virtual Hub using a user name of a user set to anonymous authentication can connect to a Virtual Hub without undergoing user authentication and without conditions. The anonymous authentication function is ideally suited to public VPN Servers that are setup to allow anyone to connect via the Internet etc. \nTo get the list of currently registered users, use the UserList command. \nThis command cannot be run on VPN Bridge. \nYou cannot execute this command for Virtual Hubs of VPN Servers operating as a member server on a cluster. +CMD_UserAnonymousSet_Args UserAnonymousSet [name] +CMD_UserAnonymousSet_[name] Specify the user name of the user whose setting you want to change. + + +# UserPasswordSet command +CMD_UserPasswordSet Set Password Authentication for User Auth Type and Set Password +CMD_UserPasswordSet_Help Use this to set Password Authentication as the auth type for a user that is registered on the security account database of the currently managed Virtual Hub. Password Authentication requires a user-defined password to be set for the user object in the security account database of the Virtual Hub and when a user attempts to connect to the Virtual Hub using this user name, they will be prompted to input a password and if it is the matching password, connection will be allowed. \nThe user password is actually saved in hash code which means even if the VPN Server setting file is analyzed, the original password cannot be deciphered. \nTo get the list of currently registered users, use the UserList command. \nThis command cannot be run on VPN Bridge. \nYou cannot execute this command for Virtual Hubs of VPN Servers operating as a member server on a cluster. +CMD_UserPasswordSet_Args UserPasswordSet [name] [/PASSWORD:password] +CMD_UserPasswordSet_[name] Specify the user name of the user whose setting you want to change. +CMD_UserPasswordSet_PASSWORD Specify the password to be set for the user. If this parameter is not specified a prompt will appear to input the password. + + +# UserCertSet command +CMD_UserCertSet Set Individual Certificate Authentication for User Auth Type and Set Certificate +CMD_UserCertSet_Help Use this to set Individual Certificate Authentication as the Auth Type for a user that is registered on the security account database of the currently managed Virtual Hub. Individual Certificate Authentication requires one X.509 format certificate to be set for the user object in the security account database of the Virtual Hub and when a user attempts to connect to the Virtual Hub using this user name, an RSA algorithm is used to verify if the provided certificate matches the registered certificate and whether the client holds a private key that corresponds to that certificate and if so, connection is allowed. \nTo get the list of currently registered users, use the UserList command. \nThis command cannot be run on VPN Bridge. \nYou cannot execute this command for Virtual Hubs of VPN Servers operating as a member server on a cluster. +CMD_UserCertSet_Args UserCertSet [name] [/LOADCERT:cert] +CMD_UserCertSet_[name] Specify the user name of the user whose setting you want to change. +CMD_UserCertSet_LOADCERT Specify the certificate to set for the user by specifying an X.509 format certificate file. + + +# UserCertGet command +CMD_UserCertGet Get Certificate Registered for Individual Certificate Authentication User +CMD_UserCertGet_Help Use this to get an X.509 format certificate registered for a user of Individual Certificate Authentication who is registered in the security account database of the currently managed Virtual Hub and save it to file. \nIf the specified user is not set as Individual Certificate Authentication an error will occur. \nTo get the list of currently registered users, use the UserList command. \nThis command cannot be run on VPN Bridge. \nYou cannot execute this command for Virtual Hubs of VPN Servers operating as a member server on a cluster. +CMD_UserCertGet_Args UserCertGet [name] [/SAVECERT:cert] +CMD_UserCertGet_[name] Specify the user name of the user whose information you want to get. +CMD_UserCertGet_SAVECERT Specify the file name to save, in X.509 format, the user certificate you obtained. +CMD_UserCertGet_Not_Cert Either the user is not set as individual certificate authentication or a unique certificate is not set. + + +# UserSignedSet command +CMD_UserSignedSet Set Signed Certificate Authentication for User Auth Type +CMD_UserSignedSet_Help Use this to set Signed Certificate Authentication as the auth type for a user that is registered on the security account database of the currently managed Virtual Hub. When a user connects to a Virtual Hub using a user name that is set for signed certificate authentication, an RSA algorithm is used to verify whether the certificate provided by the user is signed by any of the certificates in the list of trusted CA certificates of that Virtual Hub and whether the client holds a private key that corresponds with that certificate, and if so, connection is allowed. \nIt is also possible to set the connection to be allowed only when a certificate common name (CN) and serial number that is expected for each user is registered and the contents of the certificate after the abovementioned verification is passed matches the set value. \nTo get the list of currently registered users, use the UserList command. \nThis command cannot be run on VPN Bridge. \nYou cannot execute this command for Virtual Hubs of VPN Servers operating as a member server on a cluster. +CMD_UserSignedSet_Args UserSignedSet [name] [/CN:cn] [/SERIAL:serial] +CMD_UserSignedSet_[name] Specify the user name of the user whose setting you want to change. +CMD_UserSignedSet_CN When this parameter is set, after it has been verified that the certificate that the user provided has been signed by the trusted certificate authority, connection will only be allowed when the value of the common name (CN) of this certificate is compared with the value set by this parameter and the values match. When "none" is specified, this check is not made. +CMD_UserSignedSet_SERIAL When this parameter is set, after it has been verified that the certificate that the user provided has been signed by the trusted certificate authority, connection will only be allowed when the value of the serial number of this certificate is compared with the value set by this parameter and the values match. When "none" is specified, this check is not made. +CMD_UserSignedSet_Prompt_CN Limit of Common Name (CN) Value: +CMD_UserSignedSet_Prompt_SERIAL Limit of Serial Number Value: + + +# UserRadiusSet command +CMD_UserRadiusSet Set RADIUS Authentication for User Auth Type +CMD_UserRadiusSet_Help Use this to set RADIUS Authentication as the auth type for a user that is registered on the security account database of the currently managed Virtual Hub. When a user connects to a Virtual Hub using a user name that is set for RADIUS authentication, the user name and the user input password is sent to the RADIUS server where the RADIUS SERVER checks the user name and password, then if the verification is successful, that user is allowed VPN connection. \nIn order to user RADIUS authentication, the RADIUS server used for this verification must be set in the Virtual Hub beforehand by using the RadiusServerSet command. \nTo get the list of currently registered users, use the UserList command. \nThis command cannot be run on VPN Bridge. \nYou cannot execute this command for Virtual Hubs of VPN Servers operating as a member server on a cluster. +CMD_UserRadiusSet_Args UserRadiusSet [name] [/ALIAS:alias_name] +CMD_UserRadiusSet_[name] Specify the user name of the user whose setting you want to change. +CMD_UserRadiusSet_ALIAS When this parameter is set, it is possible to make the user name sent to the RADIUS server different to the user name on the Virtual Hub. When this is not set, please specify /ALIAS:none (the user name on the Virtual Hub will be used). If the user name is "*", the /ALIAS parameter will be ignored. To read an explanation of the "*" user, please input UserCreate/HELP to display this information. +CMD_UserRadiusSet_Prompt_ALIAS Alias Name for Authentication (Optional): + + +# UserNTLMSet コマンド +CMD_UserNTLMSet Set NT Domain Authentication for User Auth Type +CMD_UserNTLMSet_Help Use this to set NT Domain Authentication as the auth type for a user that is registered on the security account database of the currently managed Virtual Hub. When a user connects to a Virtual Hub using a user name that is set for NT Domain authentication, the user name and the user input password is sent to the Windows NT / 2000 / Server 2003 / Server 2008 / Server 2008 R2 / Server 2012 Domain Controller or Active Directory Server where the server checks the user name and password, then if the verification is successful, that user is allowed VPN connection. \nTo use NT Domain authentication, the VPN Server must be operating on a Windows NT 4.0, Windows 2000, Windows XP, Windows Vista, Windows Server 2008, Windows Server 2008 R2 or Windows Server 2012 operating system that is connected to that domain. For details please contact the VPN Server's administrator. \nTo get the list of currently registered users, use the UserList command. \nThis command cannot be run on VPN Bridge. \nYou cannot execute this command for Virtual Hubs of VPN Servers operating as a member server on a cluster. +CMD_UserNTLMSet_Args UserNTLMSet [name] [/ALIAS:alias_name] +CMD_UserNTLMSet_[name] Specify the user name of the user whose setting you want to change. +CMD_UserNTLMSet_ALIAS When this parameter is set, it is possible to make the user name sent to the NT Domain or Active Directory server different to the user name on the Virtual Hub. When this is not set, please specify /ALIAS:none (the user name on the Virtual Hub will be used). If the user name is "*", the /ALIAS parameter will be ignored. To read an explanation of the "*" user, please input UserCreate/HELP to display this information. + + +# UserPolicyRemove command +CMD_UserPolicyRemove Delete User Security Policy +CMD_UserPolicyRemove_Help Use this to delete the security policy setting that is set for a user that is registered on the security account database of the currently managed Virtual Hub. A user who has had their security policy setting deleted will be assigned the security policy setting of the group that user is assigned to. In the cases where the user is not assigned to a group or when a security policy setting has not been set for the group, the default values (Allow Access: Enabled, Maximum Number of TCP Connections: 32, Time-out Period: 20 seconds) will be applied. \nTo get the list of currently registered users, use the UserList command. \nThis command cannot be run on VPN Bridge. \nYou cannot execute this command for Virtual Hubs of VPN Servers operating as a member server on a cluster. +CMD_UserPolicyRemove_Args UserPolicyRemove [name] +CMD_UserPolicyRemove_[name] Specify the user name of the user whose setting you want to change. + + +# UserPolicySet command +CMD_UserPolicySet Set User Security Policy +CMD_UserPolicySet_Help Use this to set the security policy contents that are set for a user that is registered on the security account database of the currently managed Virtual Hub. \nWhen a user has not been set a security policy, use this to change the specified values after a new default security policy has been set. \nTo get the list of currently registered users, use the UserList command. \nThis command cannot be run on VPN Bridge. \nYou cannot execute this command for Virtual Hubs of VPN Servers operating as a member server on a cluster. +CMD_UserPolicySet_Args UserPolicySet [name] [/NAME:policy_name] [/VALUE:num|yes|no] +CMD_UserPolicySet_[name] Specify the user name of the user whose setting you want to change. +CMD_UserPolicySet_NAME Specify the name of policy whose values you want to change. You can use the PolicyList command to display a list of policy names and values that can be set. +CMD_UserPolicySet_VALUE Specify a new policy value. If the policy is an integer value, specify an integer. Specify yes or no for Boolean types. You can view the type and value that can be set by using the PolicyList command. + + +# UserExpiresSet command +CMD_UserExpiresSet Set User's Expiration Date +CMD_UserExpiresSet_Help Use this to set the user's expiration date that is registered on the security account database of the currently managed Virtual Hub. A user whose expiration date has expired cannot connect to the Virtual Hub. \nTo get the list of currently registered users, use the UserList command. \nThis command cannot be run on VPN Bridge. \nYou cannot execute this command for Virtual Hubs of VPN Servers operating as a member server on a cluster. +CMD_UserExpiresSet_Args UserExpiresSet [name] [/EXPIRES:expires] +CMD_UserExpiresSet_[name] Specify the user name of the user whose setting you want to change. +CMD_UserExpiresSet_EXPIRES Specify the user expiration date and time. The date and time must be in the same format as "2005/10/08 19:30:00" where 6 integers are specified, representing year/month/day hour:minute:second separated by forward slashes, a space and then colons. Specify 4 digits for the year. If you put a space in a value, the entire value must be enclosed by "". For this specification, local time (standard time for the computer on which the command line management utility is running) can be specified. By specifying /EXPIRES:none, you can remove the expiration date restriction. +CMD_UserExpiresSet_Prompt_EXPIRES User Expiration Date (no expiration if nothing specified): + + +# GroupList command +CMD_GroupList Get List of Groups +CMD_GroupList_Help Use this to get a list of groups that are registered on the security account database of the currently managed Virtual Hub. \nThis command cannot be run on VPN Bridge. \nYou cannot execute this command for Virtual Hubs of VPN Servers operating as a member server on a cluster. +CMD_GroupList_Args GroupList + + +# GroupCreate command +CMD_GroupCreate Create Group +CMD_GroupCreate_Help Use this to create a new group in the security account database of the currently managed Virtual Hub. \nYou can register multiple users in a group. To register users in a group use the GroupJoin command. \nThis command cannot be run on VPN Bridge. \nYou cannot execute this command for Virtual Hubs of VPN Servers operating as a member server on a cluster. +CMD_GroupCreate_Args GroupCreate [name] [/REALNAME:realname] [/NOTE:note] +CMD_GroupCreate_[name] Specify the name of the group to create. +CMD_GroupCreate_REALNAME Specify the group's full name. For example, if the group corresponds to an actual section or department name, specify that name. If you are not specifying this, specify /REALNAME:none +CMD_GroupCreate_NOTE Specify a description of the group. If you are not specifying this, specify /NOTE:none +CMD_GroupCreate_Prompt_NAME Group Name: +CMD_GroupCreate_Prompt_REALNAME Group Full Name: +CMD_GroupCreate_Prompt_NOTE Group Description: + + +# GroupSet command +CMD_GroupSet Set Group Information +CMD_GroupSet_Help Use this to set group information that is registered on the security account database of the currently managed Virtual Hub. \nTo get the list of currently registered groups, use the GroupList command. \nThis command cannot be run on VPN Bridge. \nYou cannot execute this command for Virtual Hubs of VPN Servers operating as a member server on a cluster. +CMD_GroupSet_Args GroupSet [name] [/REALNAME:realname] [/NOTE:note] +CMD_GroupSet_[name] Specify the group name of the group whose setting you want to change. +CMD_GroupSet_REALNAME Specify the group's Full name. For example, if the group corresponds to an actual section or department name, specify that name. If you are not specifying this, specify /REALNAME:none +CMD_GroupSet_NOTE Specify a description of the group. If you are not specifying this, specify /NOTE:none. + + +# GroupDelete command +CMD_GroupDelete Delete Group +CMD_GroupDelete_Help Use this to delete a group that is registered on the security account database of the currently managed Virtual Hub. \nWhen you delete a group all users assigned to that group will become unassigned. \nTo get the list of currently registered groups, use the GroupList command. \nThis command cannot be run on VPN Bridge. \nYou cannot execute this command for Virtual Hubs of VPN Servers operating as a member server on a cluster. +CMD_GroupDelete_Args GroupDelete [name] +CMD_GroupDelete_[name] Specify the name of the group to delete. + + +# GroupGet command +CMD_GroupGet Get Group Information and List of Assigned Users +CMD_GroupGet_Help Use this to get the information of a group that is registered on the security account database of the currently managed Virtual Hub as well as a list of users assigned to that group. \nTo get the list of currently registered groups, use the GroupList command. \nThis command cannot be run on VPN Bridge. \nYou cannot execute this command for Virtual Hubs of VPN Servers operating as a member server on a cluster. +CMD_GroupGet_Args GroupGet [name] +CMD_GroupGet_[name] Specify the group name of the group whose information you want to get. +CMD_GroupGet_Column_NAME Group Name +CMD_GroupGet_Column_REALNAME Full Name +CMD_GroupGet_Column_NOTE Description +CMD_GroupGet_Column_POLICY This is the security policy that is set for this group. +CMD_GroupGet_Column_MEMBERS This is a list of user names of users who are assigned to this group. + + +# GroupJoin command +CMD_GroupJoin Add User to Group +CMD_GroupJoin_Help Use this to add a user in the security account database of the currently managed Virtual Hub to a group that is registered on that security account database. \nTo get a list of users and groups that are currently registered, use the UserList command and the GroupList command. \nThis command cannot be run on VPN Bridge. \nYou cannot execute this command for Virtual Hubs of VPN Servers operating as a member server on a cluster. +CMD_GroupJoin_Args GroupJoin [name] [/USERNAME:username] +CMD_GroupJoin_[name] Specify the group name of the group to which you want to add a user. +CMD_GroupJoin_USERNAME Specify the user name of the user you want to add to the group specified by "name". +CMD_GroupJoin_Prompt_USERNAME Name of User to Join Group: + + +# GroupUnjoin command +CMD_GroupUnjoin Delete User from Group +CMD_GroupUnjoin_Help Use this to delete a specified user from the group that is registered on the security account database of the currently managed Virtual Hub. By deleting a user from the group, that user becomes unassigned. \nTo get a list of users that are currently assigned to a group, use the GroupGet command. \nTo get the list of currently registered groups, use the GroupList command. \nThis command cannot be run on VPN Bridge. \nYou cannot execute this command for Virtual Hubs of VPN Servers operating as a member server on a cluster. +CMD_GroupUnjoin_Args GroupUnjoin [name] +CMD_GroupUnjoin_[name] Specify the name of the user to delete from the group. +CMD_GroupUnjoin_Prompt_name Name of User to Delete from Group: + + +# GroupPolicyRemove command +CMD_GroupPolicyRemove Delete Group Security Policy +CMD_GroupPolicyRemove_Help Use this to delete the security policy setting that is set for a group that is registered on the security account database of the currently managed Virtual Hub. Users who do not have a security policy set for the user themselves or for the group they are assigned to, will have the default values (Allow Access: Enabled, Maximum Number of TCP Connections: 32, Time-out Period: 20 seconds) applied to them. \nTo get the list of currently registered groups, use the GroupList command. \nThis command cannot be run on VPN Bridge. \nYou cannot execute this command for Virtual Hubs of VPN Servers operating as a member server on a cluster. +CMD_GroupPolicyRemove_Args GroupPolicyRemove [name] +CMD_GroupPolicyRemove_[name] Specify the group name of the group whose setting you want to change. + + +# GroupPolicySet command +CMD_GroupPolicySet Set Group Security Policy +CMD_GroupPolicySet_Help Use this to set the security policy contents that are set for a group that is registered on the security account database of the currently managed Virtual Hub. \nWhen a group has not been set a security policy, use this to change the specified values after a new default security policy has been set. \nTo get the list of currently registered groups, use the GroupList command. \nThis command cannot be run on VPN Bridge. \nYou cannot execute this command for Virtual Hubs of VPN Servers operating as a member server on a cluster. +CMD_GroupPolicySet_Args GroupPolicySet [name] [/NAME:policy_name] [/VALUE:num|yes|no] +CMD_GroupPolicySet_[name] Specify the group name of the group whose setting you want to change. +CMD_GroupPolicySet_NAME Specify the name of policy whose values you want to change. You can use the PolicyList command to display a list of policy names and values that can be set. +CMD_GroupPolicySet_VALUE Specify a new policy value. If the policy is an integer value, specify an integer. Specify yes or no for Boolean types. You can view the type and value that can be set by using the PolicyList command. + + +# SessionList command +CMD_SessionList Get List of Connected Sessions +CMD_SessionList_Help Use this to get a list of the sessions connected to the Virtual Hub currently being managed. In the list of sessions, the following information will be displayed for each connection: Session Name, Session Site, User Name, Source Host Name, TCP Connection, Transfer Bytes and Transfer Packets. \nIf the currently connected VPN Server is a cluster controller and the currently managed Virtual Hub is a static Virtual Hub, you can get an all-linked-together list of all sessions connected to that Virtual Hub on all cluster members. \nIn all other cases, only the list of sessions that are actually connected to the currently managed VPN Server will be obtained. +CMD_SessionList_Args SessionList + + +# SessionGet command +CMD_SessionGet Get Session Information +CMD_SessionGet_Help Use this to specify a session currently connected to the currently managed Virtual Hub and get the session information. The session information includes the following: source host name and user name, version information, time information, number of TCP connections, communication parameters, session key, statistical information on data transferred, and other client and server information. \nTo get the list of currently connected sessions, use the SessionList command. +CMD_SessionGet_Args SessionGet [name] +CMD_SessionGet_[name] Specify the session name of the session whose information you want to get. +CMD_SessionGet_Prompt_NAME Session name: + + +# SessionDisconnect command +CMD_SessionDisconnect Disconnect Session +CMD_SessionDisconnect_Help Use this to specify a session currently connected to the currently managed Virtual Hub and forcefully disconnect that session using manager privileges. \nNote that when communication is disconnected by settings on the source client side and the automatically reconnect option is enabled, it is possible that the client will reconnect. \nTo get the list of currently connected sessions, use the SessionList command. +CMD_SessionDisconnect_Args SessionDisconnect [name] +CMD_SessionDisconnect_[name] Specify the session name of the session to disconnect. + + +# MacTable command +CMD_MacTable Get the MAC Address Table Database +CMD_MacTable_Help Use this to get the MAC address table database that is held by the currently managed Virtual Hub. \nThe MAC address table database is a table that the Virtual Hub requires to perform the action of switching Ethernet frames and the Virtual Hub decides the sorting destination session of each Ethernet frame based on the MAC address table database. The MAC address database is built by the Virtual Hub automatically analyzing the contents of the communication throughput. \nBy specifying the session name you can get the MAC address table entry that has been associated with that session. +CMD_MacTable_Args MacTable [session_name] +CMD_MacTable_[session_name] By specifying the session name as a parameter, you can display only the MAC address table entry that is associated with that session. When this is left unspecified, all the entries will be displayed. + + +# MacDelete command +CMD_MacDelete Delete MAC Address Table Entry +CMD_MacDelete_Help Use this command to operate the MAC address table database held by the currently managed Virtual Hub and delete a specified MAC address table entry from the database. \nTo get the contents of the current MAC address table database use the MacTable command. +CMD_MacDelete_Args MacDelete [id] +CMD_MacDelete_[id] Specify the ID of the MAC address table entry to delete. +CMD_MacDelete_Prompt ID to Delete: + + +# IpTable command +CMD_IpTable Get the IP Address Table Database +CMD_IpTable_Help Use this to get the IP address table database that is held by the currently managed Virtual Hub. \nThe IP address table database is a table that is automatically generated by analyzing the contents of communication so that the Virtual Hub can always know which session is using which IP address and it is frequently used by the engine that applies the Virtual Hub security policy. \nBy specifying the session name you can get the IP address table entry that has been associated with that session. +CMD_IpTable_Args IpTable [session_name] +CMD_IpTable_[session_name] By specifying the session name as a parameter, you can display only the IP address table entry that is associated with that session. When this is left unspecified, all the entries will be displayed. + + +# IpDelete command +CMD_IpDelete Delete IP Address Table Entry +CMD_IpDelete_Help Use this command to operate the IP address table database held by the currently managed Virtual Hub and delete a specified IP address table entry from the database. \nTo get the contents of the current IP address table database use the IpTable command. +CMD_IpDelete_Args IpDelete [id] +CMD_IpDelete_[id] Specify the ID of the IP address table entry to delete. + + +# SecureNatEnable command +CMD_SecureNatEnable Enable the Virtual NAT and DHCP Server Function (SecureNat Function) +CMD_SecureNatEnable_Help Use this to enable the Virtual NAT and DHCP Server function (SecureNat Function) on the currently managed Virtual Hub and begin its operation. Before executing this command, you must first check the setting contents of the current Virtual NAT function and DHCP Server function using the SecureNatHostGet command, NatGet command and DhcpGet command. \nBy enabling the SecureNAT function, you can virtually operate a NAT router (IP masquerade) and the DHCP Server function on a virtual network on the Virtual Hub. \n\n[Warning about SecureNAT Function]\nThe SecureNAT function is recommended only for system administrators and people with a detailed knowledge of networks. \nIf you use the SecureNAT function correctly, it is possible to achieve a safe form of remote access via a VPN. However when used in the wrong way, it can put the entire network in danger. Anyone who does not have a thorough knowledge of networks and anyone who does not have the network administrator's permission must not enable the SecureNAT function. For a detailed explanation of the SecureNAT function, please refer to the VPN Server's manual and online documentation. \nYou cannot execute this command for Virtual Hubs of VPN Servers operating as a cluster. +CMD_SecureNatEnable_Args SecureNatEnable + + +# SecureNatDisable command +CMD_SecureNatDisable Disable the Virtual NAT and DHCP Server Function (SecureNat Function) +CMD_SecureNatDisable_Help Use this to disable the Virtual NAT and DHCP Server function (SecureNat Function) on the currently managed Virtual Hub. By executing this command the Virtual NAT function immediately stops operating and the Virtual DHCP Server function deletes the DHCP lease database and stops the service. \nYou cannot execute this command for Virtual Hubs of VPN Servers operating as a cluster. +CMD_SecureNatDisable_Args SecureNatDisable + + +# SecureNatStatusGet command +CMD_SecureNatStatusGet Get the Operating Status of the Virtual NAT and DHCP Server Function (SecureNat Function) +CMD_SecureNatStatusGet_Help Use this to get the operating status of the Virtual NAT and DHCP Server function (SecureNat Function) when it is operating on the currently managed Virtual Hub. \nYou cannot execute this command for Virtual Hubs of VPN Servers operating as a cluster. +CMD_SecureNatStatusGet_Args SecureNatStatusGet + + +# SecureNatHostGet command +CMD_SecureNatHostGet Get Network Interface Setting of Virtual Host of SecureNAT Function +CMD_SecureNatHostGet_Help Use this to get the virtual host network interface setting from the setting items of the Virtual NAT and DHCP Server function (SecureNAT function) on the currently managed Virtual Hub. \nThe SecureNAT function holds one virtual network adapter on the L2 segment inside the Virtual Hub and it has been assigned a MAC address and an IP address. By doing this, another host connected to the same L2 segment is able to communicate with the SecureNAT virtual host as if it is an actual IP host existing on the network. \n\n[Warning about SecureNAT Function]\nThe SecureNAT function is recommended only for system administrators and people with a detailed knowledge of networks. \nIf you use the SecureNAT function correctly, it is possible to achieve a safe form of remote access via a VPN. However when used in the wrong way, it can put the entire network in danger. Anyone who does not have a thorough knowledge of networks and anyone who does not have the network administrators permission must not enable the SecureNAT function. For a detailed explanation of the SecureNAT function, please refer to the VPN Server's manual and online documentation. \nYou cannot execute this command for Virtual Hubs of VPN Servers operating as a cluster. +CMD_SecureNatHostGet_Args SecureNatHostGet +CMD_SecureNatHostGet_Column_MAC MAC Address +CMD_SecureNatHostGet_Column_IP IP Address +CMD_SecureNatHostGet_Column_MASK Subnet Mask +CMD_SecureNatHostGet_Column_LOG Save NAT and DHCP Operation Log + + +# SecureNatHostSet command +CMD_SecureNatHostSet Change Network Interface Setting of Virtual Host of SecureNAT Function +CMD_SecureNatHostSet_Help Use this to change and save the virtual host network interface setting in the setting items of the Virtual NAT and DHCP Server function (SecureNAT function) on the currently managed Virtual Hub. \nThe SecureNAT function holds one virtual network adapter on the L2 segment inside the Virtual Hub and it has been assigned a MAC address and an IP address. By doing this, another host connected to the same L2 segment is able to communicate with the SecureNAT virtual host as if it is an actual IP host existing on the network. \n\n[Warning about SecureNAT Function]\nThe SecureNAT function is recommended only for system administrators and people with a detailed knowledge of networks. \nIf you use the SecureNAT function correctly, it is possible to achieve a safe form of remote access via a VPN. However when used in the wrong way, it can put the entire network in danger. Anyone who does not have a thorough knowledge of networks and anyone who does not have the network administrators permission must not enable the SecureNAT function. For a detailed explanation of the SecureNAT function, please refer to the VPN Server's manual and online documentation. \nYou cannot execute this command for Virtual Hubs of VPN Servers operating as a cluster. +CMD_SecureNatHostSet_Args SecureNatHostSet [/MAC:mac] [/IP:ip] [/MASK:mask] +CMD_SecureNatHostSet_MAC Specify the MAC address to assign for the virtual interface. Specify a MAC address using a string like "00-AC-01-23-45-67". When /MAC:none is specified, no changes will be made to the current setting. +CMD_SecureNatHostSet_IP Specify the IP address to assign for the virtual interface. When /IP:none is specified, no changes will be made to the current setting. +CMD_SecureNatHostSet_MASK Specify the subnet mask to assign for the virtual interface. When /MASK:none is specified, no changes will be made to the current setting. +CMD_SecureNatHostSet_Prompt_MAC MAC Address: +CMD_SecureNatHostSet_Prompt_IP IP Address: +CMD_SecureNatHostSet_Prompt_MASK Subnet Mask: + + +# NatGet command +CMD_NatGet Get Virtual NAT Function Setting of SecureNAT Function +CMD_NatGet_Help Use this to get the virtual NAT setting from the setting items of the Virtual NAT and DHCP Server function (SecureNAT function) on the currently managed Virtual Hub. \nYou cannot execute this command for Virtual Hubs of VPN Servers operating as a cluster. +CMD_NatGet_Args NatGet +CMD_NatGet_Column_USE Use Virtual NAT Function +CMD_NetGet_Column_MTU MTU Value +CMD_NatGet_Column_TCP TCP Session Timeout (Seconds) +CMD_NatGet_Column_UDP UDP Session Timeout (Seconds) + + +# NatEnable command +CMD_NatEnable Enable Virtual NAT Function of SecureNAT Function +CMD_NatEnable_Help Use this to enable the Virtual NAT function on the currently managed Virtual Hub. \nIf the SecureNAT function is still not operating even after this command has been used to enable the Virtual NAT function, Virtual NAT is not operating. To start the operation of the SecureNAT Function, use the SecureNatEnable command. \nYou cannot execute this command for Virtual Hubs of VPN Servers operating as a cluster. +CMD_NatEnable_Args NatEnable + + +# NatDisable command +CMD_NatDisable Disable Virtual NAT Function of SecureNAT Function +CMD_NatDisable_Help Use this to disable the Virtual NAT function on the currently managed Virtual Hub. \nYou cannot execute this command for Virtual Hubs of VPN Servers operating as a cluster. +CMD_NatDisable_Args NatDisable + + +# NatSet command +CMD_NatSet Change Virtual NAT Function Setting of SecureNAT Function +CMD_NatSet_Help Use this to change the Virtual NAT setting of the currently managed Virtual Hub. The contents of the Virtual NAT setting includes: MTU value, TCP session timeout and UDP session timeout \nYou cannot execute this command for Virtual Hubs of VPN Servers operating as a cluster. +CMD_NatSet_Args NatSet [/MTU:mtu] [/TCPTIMEOUT:tcp_timeout] [/UDPTIMEOUT:udp_timeout] [/LOG:yes|no] +CMD_NatSet_MTU Set the MTU (Maximum transferable unit size) using an integer to specify the byte length unit. This value is the maximum payload length excluding the MAC header of the Ethernet frame that the Virtual NAT sends and the default is 1500 bytes. +CMD_NatSet_TCPTIMEOUT This sets how many seconds a condition of non-communication continues in a TCP session that the Virtual NAT is relaying before a timeout occurs and the session is discarded. +CMD_NatSet_UDPTIMEOUT This sets how many seconds a condition of non-communication continues in a UDP session that the Virtual NAT is relaying before a timeout occurs and the session is discarded. +CMD_NatSet_LOG Specify whether or not to save the Virtual NAT operation in the Virtual Hub security log. Specify "yes" to save it, and "no" to not save it. +CMD_NatSet_Prompt_MTU MTU Value: +CMD_NatSet_Prompt_TCPTIMEOUT TCP Session Timeout (Seconds): +CMD_NatSet_Prompt_UDPTIMEOUT UDP Session Timeout (Seconds): +CMD_NatSet_Prompt_LOG Save Log (yes / no): +CMD_NatSet_Eval_MTU Specify a value in the range %d to %d for the MTU value. +CMD_NatSet_Eval_TCP Specify the number of seconds in the range %d to %d for the TCP session timeout. +CMD_NatSet_Eval_UDP Specify the number of seconds in the range %d to %d for the UDP session timeout. + + +# NatTable command +CMD_NatTable Get Virtual NAT Function Session Table of SecureNAT Function +CMD_NatTable_Help Use this to get the table of TCP and UDP sessions currently communicating via the Virtual NAT (NAT table) in cases when the Virtual NAT function is operating on the currently managed Virtual Hub. \nYou cannot execute this command for Virtual Hubs of VPN Servers operating as a cluster. +CMD_NatTable_Args NatTable + + +# DhcpGet command +CMD_DhcpGet Get Virtual DHCP Server Function Setting of SecureNAT Function +CMD_DhcpGet_Help Use this to get the virtual DHCP Server setting from the setting items of the Virtual NAT and DHCP Server function (SecureNAT function) on the currently managed Virtual Hub. \nYou cannot execute this command for Virtual Hubs of VPN Servers operating as a cluster. +CMD_DhcpGet_Args DhcpGet +CMD_DhcpGet_Column_Log Record Log of NAT and DHCP Operation +CMD_DhcpGet_Column_USE Use Virtual DHCP Function +CMD_DhcpGet_Column_IP1 Start Distribution Address Band +CMD_DhcpGet_Column_IP2 End Distribution Address Band +CMD_DhcpGet_Column_MASK Subnet Mask +CMD_DhcpGet_Column_LEASE Lease Limit (Seconds) +CMD_DhcpGet_Column_GW Default Gateway Address +CMD_DhcpGet_Column_DNS DNS Server Address 1 +CMD_DhcpGet_Column_DNS2 DNS Server Address 2 +CMD_DhcpGet_Column_DOMAIN Domain Name +CMD_DhcpGet_Column_PUSHROUTE Static Routing Table to Push + + +# DhcpEnable command +CMD_DhcpEnable Enable Virtual DHCP Server Function of SecureNAT Function +CMD_DhcpEnable_Help Use this to enable the Virtual DHCP Server function on the currently managed Virtual Hub. \nIf the SecureNAT function is still not operating even after this command has been used to enable the Virtual DHCP function, Virtual DHCP Server is not operating. To start the operation of the SecureNAT Function, use the SecureNatEnable command. \nYou cannot execute this command for Virtual Hubs of VPN Servers operating as a cluster. +CMD_DhcpEnable_Args DhcpEnable + + +# DhcpDisable command +CMD_DhcpDisable Disable Virtual DHCP Server Function of SecureNAT Function +CMD_DhcpDisable_Help Use this to disable the Virtual DHCP Server function on the currently managed Virtual Hub. \nYou cannot execute this command for Virtual Hubs of VPN Servers operating as a cluster. +CMD_DhcpDisable_Args DhcpDisable + + +# DhcpSet command +CMD_DhcpSet Change Virtual DHCP Server Function Setting of SecureNAT Function +CMD_DhcpSet_Help Use this to change the Virtual DHCP Server setting of the currently managed Virtual Hub. The Virtual DHCP Server settings include the following items: distribution address band, subnet mask, lease limit, and option values assigned to clients. \nYou cannot execute this command for Virtual Hubs of VPN Servers operating as a cluster. +CMD_DhcpSet_Args DhcpSet [/START:start_ip] [/END:end_ip] [/MASK:subnetmask] [/EXPIRE:sec] [/GW:gwip] [/DNS:dns] [/DNS2:dns2][/DOMAIN:domain] [/LOG:yes|no] [/PUSHROUTE:"routing_table"] +CMD_DhcpSet_START Specify the start point of the address band to be distributed to the client. (Example: 192.168.30.10) +CMD_DhcpSet_END Specify the end point of the address band to be distributed to the client. (Example: 192.168.30.200) +CMD_DhcpSet_MASK Specify the subnet mask to be specified for the client. (Example: 255.255.255.0) +CMD_DhcpSet_EXPIRE Specify the expiration date in second units for leasing an IP address to a client. +CMD_DhcpSet_GW Specify the IP address of the default gateway to be notified to the client. You can specify a SecureNAT Virtual Host IP address for this when the SecureNAT Function's Virtual NAT Function has been enabled and is being used also. If you specify 0 or none, then the client will not be notified of the default gateway. +CMD_DhcpSet_DNS Specify the IP address of the primary DNS Server to be notified to the client. You can specify a SecureNAT Virtual Host IP address for this when the SecureNAT Function's Virtual NAT Function has been enabled and is being used also. If you specify 0 or none, then the client will not be notified of the DNS Server address. +CMD_DhcpSet_DNS2 Specify the IP address of the secondary DNS Server to be notified to the client. You can specify a SecureNAT Virtual Host IP address for this when the SecureNAT Function's Virtual NAT Function has been enabled and is being used also. If you specify 0 or none, then the client will not be notified of the DNS Server address. +CMD_DhcpSet_DOMAIN Specify the domain name to be notified to the client. If you specify none, then the client will not be notified of the domain name. +CMD_DhcpSet_LOG Specify whether or not to save the Virtual DHCP Server operation in the Virtual Hub security log. Specify "yes" to save it. This value is interlinked with the Virtual NAT Function log save setting. +CMD_DhcpSet_PUSHROUTE Specify the static routing table to push.\nExample: "192.168.5.0/255.255.255.0/192.168.4.254, 10.0.0.0/255.0.0.0/192.168.4.253"\nSplit multiple entries (maximum: 64 entries) by comma or space characters. Each entry must be specified in the "IP network address/subnet mask/gateway IP address" format.\nThis Virtual DHCP Server can push the classless static routes (RFC 3442) with DHCP reply messages to VPN clients.\nWhether or not a VPN client can recognize the classless static routes (RFC 3442) depends on the target VPN client software. SoftEther VPN Client and OpenVPN Client are supporting the classless static routes. On L2TP/IPsec and MS-SSTP protocols, the compatibility depends on the implementation of the client software. You can realize the split tunneling if you clear the default gateway field on the Virtual DHCP Server options. On the client side, L2TP/IPsec and MS-SSTP clients need to be configured not to set up the default gateway for the split tunneling usage.\nYou can also push the classless static routes (RFC 3442) by your existing external DHCP server. In that case, disable the Virtual DHCP Server function on SecureNAT, and you need not to set up the classless routes on this command.\nSee the RFC 3442 to understand the classless routes. +CMD_DhcpSet_Prompt_START Start Point for Distributed Address Band: +CMD_DhcpSet_Prompt_END End Point for Distributed Address Band: +CMD_DhcpSet_Prompt_MASK Subnet Mask: +CMD_DhcpSet_Prompt_EXPIRE Lease Limit (Seconds): +CMD_DhcpSet_Prompt_GW Default Gateway ('none' to not set this): +CMD_DhcpSet_Prompt_DNS DNS Server 1 ('none' to not set this): +CMD_DhcpSet_Prompt_DNS2 DNS Server 2 ('none' to not set this): +CMD_DhcpSet_Prompt_DOMAIN Domain Name: + + +# DhcpTable command +CMD_DhcpTable Get Virtual DHCP Server Function Lease Table of SecureNAT Function +CMD_DhcpTable_Help Use this to get the lease table of IP addresses, held by the Virtual DHCP Server, that are assigned to clients in cases when the Virtual NAT function is operating on the currently managed Virtual Hub. \nYou cannot execute this command for Virtual Hubs of VPN Servers operating as a cluster. +CMD_DhcpTable_Args DhcpTable + + +# AdminOptionList command +CMD_AdminOptionList Get List of Virtual Hub Administration Options +CMD_AdminOptionList_Help Use this to get a list of Virtual Hub administration options that are set on the currently managed Virtual Hub. \nThe purpose of the Virtual Hub administration options is for the VPN Server Administrator to set limits for the setting ranges when the administration of the Virtual Hub is to be trusted to each Virtual Hub administrator. \nOnly an administrator with administration privileges for this entire VPN Server is able to add, edit and delete the Virtual Hub administration options. The Virtual Hub administrators are unable to make changes to the administration options, however they are able to view them. \nThere is an exception however. If allow_hub_admin_change_option is set to "1", even Virtual Hub administrators are able to edit the administration options. \nThis command cannot be run on VPN Bridge. \nYou cannot execute this command for Virtual Hubs of VPN Servers operating as a cluster member. +CMD_AdminOptionList_Args AdminOptionList + + +# AdminOptionSet command +CMD_AdminOptionSet Set Values of Virtual Hub Administration Options +CMD_AdminOptionSet_Help Use this to change the values of Virtual Hub administration options that are set on the currently managed Virtual Hub. \nThe purpose of the Virtual Hub administration options is for the VPN Server Administrator to set limits for the setting ranges when the administration of the Virtual Hub is to be trusted to each Virtual Hub administrator. \nOnly an administrator with administration privileges for this entire VPN Server is able to add, edit and delete the Virtual Hub administration options. The Virtual Hub administrators are unable to make changes to the administration options, however they are able to view them. \nThere is an exception however. If allow_hub_admin_change_option is set to "1", even Virtual Hub administrators are able to edit the administration options. \nThis command cannot be run on VPN Bridge. \nYou cannot execute this command for Virtual Hubs of VPN Servers operating as a cluster member. +CMD_AdminOptionSet_Args AdminOptionSet [name] [/VALUE:value] +CMD_AdminOptionSet_[name] Specify the name of the administration option whose value you want to change. You can get a list of names by using the AdminOptionList command. +CMD_AdminOptionSet_VALUE Specify an integer for the setting value. +CMD_AdminOptionSet_Prompt_name Name of Administration Option to Change Value: +CMD_AdminOptionSet_Prompt_VALUE Setting Value (Integer): + + +# ExtOptionList command +CMD_ExtOptionList Get List of Virtual Hub Extended Options +CMD_ExtOptionList_Help Use this to get a Virtual Hub Extended Options List that is set on the currently managed Virtual Hub.\nVirtual Hub Extended Option enables you to configure more detail settings of the Virtual Hub.\nBy default, both VPN Server's global administrators and individual Virtual Hub's administrators can modify the Virtual Hub Extended Options.\nHowever, if the deny_hub_admin_change_ext_option is set to 1 on the Virtual Hub Admin Options, the individual Virtual Hub's administrators cannot modify the Virtual Hub Extended Options.\nThis command cannot be run on VPN Bridge. \nYou cannot execute this command for Virtual Hubs of VPN Servers operating as a cluster member. +CMD_ExtOptionList_Args ExtOptionList + + +# ExtOptionSet command +CMD_ExtOptionSet Set a Value of Virtual Hub Extended Options +CMD_ExtOptionSet_Help Use this to set a value in the Virtual Hub Extended Options List that is set on the currently managed Virtual Hub.\nVirtual Hub Extended Option enables you to configure more detail settings of the Virtual Hub.\nBy default, both VPN Server's global administrators and individual Virtual Hub's administrators can modify the Virtual Hub Extended Options.\nHowever, if the deny_hub_admin_change_ext_option is set to 1 on the Virtual Hub Admin Options, the individual Virtual Hub's administrators cannot modify the Virtual Hub Extended Options.\nThis command cannot be run on VPN Bridge. \nYou cannot execute this command for Virtual Hubs of VPN Servers operating as a cluster member. +CMD_ExtOptionSet_Args ExtOptionSet [name] [/VALUE:value] +CMD_ExtOptionSet_[name] Specify the name of the Virtual Hub Extended Options whose value you want to change. You can get a list of names by using the ExtOptionList command. +CMD_ExtOptionSet_VALUE Specify an integer for the setting value. +CMD_ExtOptionSet_Prompt_name Name of Extended Option to Change Value: +CMD_ExtOptionSet_Prompt_VALUE Setting Value (Integer): + + +# CrlList command +CMD_CrlList Get List of Certificates Revocation List +CMD_CrlList_Help Use this to get a Certificates Revocation List that is set on the currently managed Virtual Hub. \nBy registering certificates in the Certificates Revocation List, the clients who provide these certificates will be unable to connect to this Virtual Hub using certificate authentication mode. \nNormally with this function, in cases where the security of a private key has been compromised or where a person holding a certificate has been stripped of their privileges, by registering that certificate as invalid on the Virtual Hub, it is possible to deny user authentication when that certificate is used by a client to connect to the Virtual Hub. \nThis command cannot be run on VPN Bridge. \nYou cannot execute this command for Virtual Hubs of VPN Servers operating as a cluster. +CMD_CrlList_Args CrlList + + +# CrlAdd command +CMD_CrlAdd Add a Revoked Certificate +CMD_CrlAdd_Help Use this to add a new revoked certificate definition in the Certificate Revocation List that is set on the currently managed Virtual Hub. \nSpecify the contents to be registered in the Certificate Revocation List by using the parameters of this command. When a user connects to a Virtual Hub in certificate authentication mode and that certificate matches 1 or more of the contents registered in the certificates revocation list, the user is denied connection. \nA certificate that matches all the conditions that are defined by the parameters specified by this command will be judged as invalid. \nThe items that can be set are as follows: Name (CN), Organization (O), Organization Unit (OU), Country (C), State (ST), Locale (L), Serial Number (hexadecimal), MD5 Digest Value (hexadecimal, 128 bit), and SHA-1 Digest Value (hexadecimal, 160 bit). For the specification of a digest value (hash value) a certificate is optionally specified depending on the circumstances. Normally when a MD5 or SHA-1 digest value is input, it is not necessary to input the other items. \nThis command cannot be run on VPN Bridge. \nYou cannot execute this command for Virtual Hubs of VPN Servers operating as a cluster. +CMD_CrlAdd_Args CrlAdd [/SERIAL:serial] [/MD5:md5] [/SHA1:sha1] [/CN:cn] [/O:o] [/OU:ou] [/C:c] [/ST:st] [/L:l] +CMD_CrlAdd_SERIAL Use this parameter to specify the value for the certificate serial number (hexadecimal) when it is set as a condition. +CMD_CrlAdd_MD5 Use this parameter to specify the value for the certificate MD5 digest value (hexadecimal, 128 bits) when it is set as a condition. If this parameter specification is other than a hexadecimal value of 32 characters (16 bytes), it will be ignored. +CMD_CrlAdd_SHA1 Use this parameter to specify the value for the certificate SHA1 digest value (hexadecimal, 160 bits) when it is set as a condition. If this parameter specification is other than a hexadecimal value of 40 characters (16 bytes), it will be ignored. +CMD_CrlAdd_CN Use this parameter to specify the name (CN) of the certificate when it is set as a condition. +CMD_CrlAdd_O Use this parameter to specify the organization (O) of the certificate when it is set as a condition. +CMD_CrlAdd_OU Use this parameter to specify the organization unit (OU) of the certificate when it is set as a condition. +CMD_CrlAdd_C Use this parameter to specify the country (C) of the certificate when it is set as a condition. +CMD_CrlAdd_ST Use this parameter to specify the state (ST) of the certificate when it is set as a condition. +CMD_CrlAdd_L Use this parameter to specify the locale (L) of the certificate when it is set as a condition. + + +# CrlDel command +CMD_CrlDel Delete a Revoked Certificate +CMD_CrlDel_Help Use this to specify and delete a revoked certificate definition from the certificate revocation list that is set on the currently managed Virtual Hub. \nTo get the list of currently registered revoked certificate definitions, use the CrlList command. \nThis command cannot be run on VPN Bridge. \nYou cannot execute this command for Virtual Hubs of VPN Servers operating as a cluster. +CMD_CrlDel_Args CrlDel [id] +CMD_CrlDel_[id] Specify the ID of the revoked certificate definition you want to delete. +CMD_CrlDel_Prompt_ID ID to Delete: + + +# CrlGet command +CMD_CrlGet Get a Revoked Certificate +CMD_CrlGet_Help Use this to specify and get the contents of a revoked certificate definition from the Certificates Revocation List that is set on the currently managed Virtual Hub. \nTo get the list of currently registered revoked certificate definitions, use the CrlList command. \nThis command cannot be run on VPN Bridge. \nYou cannot execute this command for Virtual Hubs of VPN Servers operating as a cluster. +CMD_CrlGet_Args CrlGet [id] +CMD_CrlGet_[id] Specify the ID of the revoked certificate definition you want to get. +CMD_CrlGet_Prompt_ID ID to Get: +CMD_CrlGet_CN Common Name (CN) +CMD_CrlGet_O Organization (O) +CMD_CrlGet_OU Organization Unit (OU) +CMD_CrlGet_C Country (C) +CMD_CrlGet_ST State (ST) +CMD_CrlGet_L Locale (L) +CMD_CrlGet_SERI Serial Number (Hexadecimal) +CMD_CrlGet_MD5_HASH MD5 Digest Value (Hexadecimal, 128 bit) +CMD_CrlGet_SHA1_HASH SHA-1 Digest Value (Hexadecimal, 160 bit) + + +# AcList command +CMD_AcList Get List of Rule Items of Source IP Address Limit List +CMD_AcList_Help Use this to get a list of Source IP Address Limit List rules that is set on the currently managed Virtual Hub. \nYou can allow or deny VPN connections to this Virtual Hub according to the client computer's source IP address. You can define multiple rules and set a priority for each rule. The search proceeds from the rule with the highest order or priority and based on the action of the rule that the IP address first matches, the connection from the client is either allowed or denied. \nThis command cannot be run on VPN Bridge. \nYou cannot execute this command for Virtual Hubs of VPN Servers operating as a cluster. +CMD_AcList_Args AcList + + +# AcAdd command +CMD_AcAdd Add Rule to Source IP Address Limit List (IPv4) +CMD_AcAdd_Help Use this to add a new rule to the Source IP Address Limit List that is set on the currently managed Virtual Hub. \nThe items set here will be used to decide whether to allow or deny connection from a VPN Client when this client attempts connection to the Virtual Hub. \nYou can specify a client IP address, or IP address or mask to match the rule as the contents of the rule item. By specifying an IP address only, there will only be one specified computer that will match the rule, but by specifying an IP net mask address or subnet mask address, all the computers in the range of that subnet will match the rule. \nYou can specify the priority for the rule. You can specify an integer of 1 or greater for the priority and the smaller the number, the higher the priority. \nTo get a list of the currently registered Source IP Address Limit List, use the AcList command. \nThis command cannot be run on VPN Bridge. \nYou cannot execute this command for Virtual Hubs of VPN Servers operating as a cluster. +CMD_AcAdd_Args AcAdd [allow|deny] [/PRIORITY:priority] [/IP:ip/mask] +CMD_AcAdd_[allow|deny] Set whether to "allow" or "deny" the connection from a client that matches the rule. +CMD_AcAdd_PRIORITY Specify an integer of 1 or higher to indicate the priority of the rule. The smaller the value the higher the priority. +CMD_AcAdd_IP Using the format: "IP Address/Mask", specify the range of client IPv4 addresses. Specify the IPv4 address by separating the decimal values using dots such as "192.168.0.1". For the mask, either specify decimal values separated by dots such as "255.255.255.0", or you can specify the bit length from the header using a decimal value such as "24". To specify a single IPv4 host, specify the mask as "32" or "255.255.255.255". +CMD_AcAdd_Prompt_AD allow or deny: +CMD_AcAdd_Prompt_PRIORITY Priority: +CMD_AcAdd_Prompt_IP IPv4 Address/Mask: +CMD_AcAdd_Eval_PRIORITY Specify 1 or higher for the priority. + + +# AcAdd6 command +CMD_AcAdd6 Add Rule to Source IP Address Limit List (IPv6) +CMD_AcAdd6_Help Use this to add a new rule to the Source IP Address Limit List that is set on the currently managed Virtual Hub. \nThe items set here will be used to decide whether to allow or deny connection from a VPN Client when this client attempts connection to the Virtual Hub. \nYou can specify a client IP address, or IP address or mask to match the rule as the contents of the rule item. By specifying an IP address only, there will only be one specified computer that will match the rule, but by specifying an IP net mask address or subnet mask address, all the computers in the range of that subnet will match the rule. \nYou can specify the priority for the rule. You can specify an integer of 1 or greater for the priority and the smaller the number, the higher the priority. \nTo get a list of the currently registered Source IP Address Limit List, use the AcList command. \nThis command cannot be run on VPN Bridge. \nYou cannot execute this command for Virtual Hubs of VPN Servers operating as a cluster. +CMD_AcAdd6_Args AcAdd6 [allow|deny] [/PRIORITY:priority] [/IP:ip/mask] +CMD_AcAdd6_[allow|deny] Set whether to "allow" or "deny" the connection from a client that matches the rule. +CMD_AcAdd6_PRIORITY Specify an integer of 1 or higher to indicate the priority of the rule. The smaller the value the higher the priority. +CMD_AcAdd6_IP Using the format: "IP Address/Mask", specify the range of client IPv6 addresses. Specify the IPv6 address by separating the hexadecimal values using colons such as "2001:200:0:1::". For the mask, either specify hexadecimal values separated by colons such as "ffff:ffff:ffff:ffff::", or you can specify the bit length from the header using a decimal value such as "64". To specify a single IPv6 host, specify the mask as "128" or "ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff". +CMD_AcAdd6_Prompt_AD allow or deny: +CMD_AcAdd6_Prompt_PRIORITY Priority: +CMD_AcAdd6_Prompt_IP IPv6 Address/Mask: +CMD_AcAdd6_Eval_PRIORITY Specify 1 or higher for the priority. + + +# AcDel command +CMD_AcDel Delete Rule from Source IP Address Limit List +CMD_AcDel_Help Use this to delete a rule from the Source IP Address Limit List that is set on the currently managed Virtual Hub. \nTo get a list of the currently registered IP access control list, use the AcList command. \nThis command cannot be run on VPN Bridge. \nYou cannot execute this command for Virtual Hubs of VPN Servers operating as a cluster. +CMD_AcDel_Args AcDel [id] +CMD_AcDel_[id] Specify the ID of the rule in the Source IP Address Limit List that you want to delete. +CMD_AcDel_Prompt_ID ID of Rule to Delete: + + +# LicenseAdd command +CMD_LicenseAdd Add License Key Registration +CMD_LicenseAdd_Help Use this to register a new license key on the SoftEther VPN Server. \nTo use SoftEther VPN Server you must acquire a valid license and register the license key. The license keys are 36 alphanumeric characters in length plus hyphens. They are key codes that certify the ownership of a license. \nWhen a license certificate is received together with this software, the license key is printed on this license certificate. If the license for this software has been purchased online, the license key is provided by email and on the website window at the time the license is purchased. The license key may also be written down by some other method. If you don't know where the license key is written down, ask the vendor who sold you the license. \n\nTo get the list of currently registered licenses, use the LicenseList command. \nTo display the license status of the current VPN Server, use the LicenseStatus command. \nTo execute this command, you must have VPN Server administrator privileges. \nThis command cannot be run on VPN Bridge. +CMD_LicenseAdd_Args LicenseAdd [key] +CMD_LicenseAdd_[key] Specify the license key to register. Specify 36 digits of alphanumeric characters and group the digits in groups of 6 separating them by hyphen. +CMD_LicenseAdd_Prompt_Key License Key: + + +# LicenseDel command +CMD_LicenseDel Delete Registered License +CMD_LicenseDel_Help Use this to delete a specified license from the license list that is currently registered on the SoftEther VPN Server. \n\nTo get the list of currently registered licenses, use the LicenseList command. \nTo display the license status of the current VPN Server, use the LicenseStatus command. \nTo execute this command, you must have VPN Server administrator privileges. \nThis command cannot be run on VPN Bridge. +CMD_LicenseDel_Args LicenseDel [id] +CMD_LicenseDel_[id] Specify the license number to delete. +CMD_LicenseDel_Prompt_ID License Number to Delete: + + +# LicenseList command +CMD_LicenseList Get List of Registered Licenses +CMD_LicenseList_Help Use this to display a list of license information currently registered on the SoftEther VPN Server including: license key, license type name, status, expiration date, license ID, license type ID, server ID and serial ID. \n\nTo display the license status of the current VPN Server, use the LicenseStatus command. \nTo execute this command, you must have VPN Server administrator privileges. \nThis command cannot be run on VPN Bridge. +CMD_LicenseList_Args LicenseList + + +# LicenseStatus command +CMD_LicenseStatus Get License Status of Current VPN Server +CMD_LicenseStatus_Help Use this to get and display the license status of the current SoftEther VPN Server. \nThe following current information on the SoftEther VPN Server will be displayed: product edition, server ID, product license expiration date, number of usable Client Connection Licenses and number of Bridge Connection Licenses. \n\nTo execute this command, you must have VPN Server administrator privileges. \nThis command cannot be run on VPN Bridge. +CMD_LicenseStatus_Args LicenseStatus + + +# Commands added after SoftEther VPN 4.0 +# IPsecEnable command +CMD_IPsecEnable Enable or Disable IPsec VPN Server Function +CMD_IPsecEnable_Help Enable or Disable IPsec VPN Server Function on SoftEther VPN Server.\nIf you enable this function, Virtual Hubs on the VPN Server will be able to accept Remote-Access VPN connections from L2TP-compatible PCs, Mac OS X and Smartphones, and also can accept EtherIP Site-to-Site VPN Connection. VPN Connections from Smartphones suchlike iPhone, iPad and Android, and also from native VPN Clients on Mac OS X and Windows can be accepted.\n\nTo execute this command, you must have VPN Server administrator privileges. \nThis command cannot be run on VPN Bridge.\nYou cannot execute this command for Virtual Hubs of VPN Servers operating as a cluster. +CMD_IPsecEnable_Args IPsecEnable [/L2TP:yes|no] [/L2TPRAW:yes|no] [/ETHERIP:yes|no] [/PSK:pre-shared-key] [/DEFAULTHUB:default_hub] +CMD_IPsecEnable_L2TP Enable or Disable the L2TP over IPsec Server Function. To accept VPN connections from iPhone, iPad, Android, Windows or Mac OS X, enable this option. +CMD_IPsecEnable_L2TPRAW Enable or Disable the L2TP Server Function (Raw L2TP with No Encryptions). To accept special VPN clients, enable this option. +CMD_IPsecEnable_ETHERIP Enable or Disable the EtherIP / L2TPv3 over IPsec Server Function (for site-to-site VPN Server function). Router Products which are compatible with EtherIP over IPsec can connect to Virtual Hubs on the VPN Server and establish Layer-2 (Ethernet) Bridging. +CMD_IPsecEnable_PSK Specify the IPsec Pre-Shared Key. An IPsec Pre-Shared Key is also called as "PSK" or "secret". Specify it equal or less than 8 letters, and distribute it to every users who will connect to the VPN Server. Please note: Google Android 4.0 has a bug which a Pre-Shared Key with 10 or more letters causes a unexpected behavior. For that reason, the letters of a Pre-Shared Key should be 9 or less characters. +CMD_IPsecEnable_DEFAULTHUB Specify the default Virtual HUB in a case of omitting the name of HUB on the Username. Users should specify their username such as "Username@Target Virtual HUB Name" to connect this L2TP Server. If the designation of the Virtual Hub is omitted, the above HUB will be used as the target. +CMD_IPsecEnable_Prompt_L2TP Enable L2TP over IPsec Server Function (yes / no): +CMD_IPsecEnable_Prompt_L2TPRAW Enable Raw L2TP Server Function (yes / no): +CMD_IPsecEnable_Prompt_ETHERIP Enable EtherIP / L2TPv3 over IPsec Server Function (yes / no): +CMD_IPsecEnable_Prompt_PSK Pre Shared Key for IPsec (Recommended: 9 letters at maximum): +CMD_IPsecEnable_Prompt_DEFAULTHUB Default Virtual HUB in a case of omitting the HUB on the Username: + + +# IPsecGet command +CMD_IPsecGet Get the Current IPsec VPN Server Settings +CMD_IPsecGet_Help Get and view the current IPsec VPN Server settings on the SoftEther VPN Server.\n\nTo execute this command, you must have VPN Server administrator privileges. \nThis command cannot be run on VPN Bridge.\nYou cannot execute this command for Virtual Hubs of VPN Servers operating as a cluster. +CMD_IPsecGet_Args IPsecGet +CMD_IPsecGet_PRINT_L2TP L2TP over IPsec Server Function Enabled +CMD_IPsecGet_PRINT_L2TPRAW Raw L2TP Server Function Enabled +CMD_IPsecGet_PRINT_ETHERIP EtherIP / L2TPv3 over IPsec Server Function Enabled +CMD_IPsecGet_PRINT_PSK IPsec Pre-Shared Key String +CMD_IPsecGet_PRINT_DEFAULTHUB Name of Default Virtual Hub + + +# EtherIpClientAdd command +CMD_EtherIpClientAdd Add New EtherIP / L2TPv3 over IPsec Client Setting to Accept EtherIP / L2TPv3 Client Devices +CMD_EtherIpClientAdd_Help Add a new setting entry to enable the EtherIP / L2TPv3 over IPsec Server Function to accept client devices.\nIn order to accept connections from routers by the EtherIP / L2TPv3 over IPsec Server Function, you have to define the relation table between an IPsec Phase 1 string which is presented by client devices of EtherIP / L2TPv3 over IPsec compatible router, and the designation of the destination Virtual Hub.\nAfter you add a definition entry by EtherIpClientAdd command, the defined connection setting to the Virtual Hub will be applied on the login-attempting session from an EtherIP / L2TPv3 over IPsec client device.\nThe username and password in an entry must be registered on the Virtual Hub. An EtherIP / L2TPv3 client will be regarded as it connected the Virtual HUB with the identification of the above user information.\n\nTo execute this command, you must have VPN Server administrator privileges. \nThis command cannot be run on VPN Bridge.\nYou cannot execute this command for Virtual Hubs of VPN Servers operating as a cluster. +CMD_EtherIpClientAdd_Args EtherIpClientAdd [ID] [/HUB:hubname] [/USERNAME:username] [/PASSWORD:password] +CMD_EtherIpClientAdd_[ID] Specify an ISAKMP Phase 1 ID. The ID must be exactly same as a ID in the configuration of the EtherIP / L2TPv3 Client. You can specify IP address as well as characters as ID, if the EtherIP Client uses IP address as Phase 1 ID. If you specify '*' (asterisk), it will be a wildcard to match any clients which doesn't match other explicit rules. +CMD_EtherIpClientAdd_HUB Specify the name of the Virtual Hub to connect. +CMD_EtherIpClientAdd_USERNAME Specify the username to login to the destination Virtual Hub. +CMD_EtherIpClientAdd_PASSWORD Specify the password to login to the destination Virtual Hub. +CMD_EtherIpClientAdd_Prompt_ID ISAKMP Phase 1 ID ('*' is a wildcard): +CMD_EtherIpClientAdd_Prompt_HUB Virtual Hub Name: +CMD_EtherIpClientAdd_Prompt_USERNAME Username to Login Virtual Hub: +CMD_EtherIpClientAdd_Prompt_PASSWORD Password to Login Virtual Hub: + + +# EtherIpClientDelete command +CMD_EtherIpClientDelete Delete an EtherIP / L2TPv3 over IPsec Client Setting +CMD_EtherIpClientDelete_Help This command deletes an entry to accept VPN clients by EtherIP / L2TPv3 over IPsec Function. \n\nTo execute this command, you must have VPN Server administrator privileges. \nThis command cannot be run on VPN Bridge.\nYou cannot execute this command for Virtual Hubs of VPN Servers operating as a cluster. +CMD_EtherIpClientDelete_Args EtherIpClientDelete [ID] +CMD_EtherIpClientDelete_[ID] Specify the ISAKMP Phase 1 ID to delete. +CMD_EtherIpClientDelete_Prompt_ID ISAKMP Phase 1 ID: + + +# EtherIpClientList command +CMD_EtherIpClientList Get the Current List of EtherIP / L2TPv3 Client Device Entry Definitions +CMD_EtherIpClientList_Help This command gets and shows the list of entries to accept VPN clients by EtherIP / L2TPv3 over IPsec Function.\n\nTo execute this command, you must have VPN Server administrator privileges. \nThis command cannot be run on VPN Bridge.\nYou cannot execute this command for Virtual Hubs of VPN Servers operating as a cluster. +CMD_EtherIpClientList_Args EtherIpClientList + + +# OpenVpnMakeConfig command +CMD_OpenVpnMakeConfig Generate a Sample Setting File for OpenVPN Client +CMD_OpenVpnMakeConfig_Help Originally, the OpenVPN Client requires a user to write a very difficult configuration file manually. This tool helps you to make a useful configuration sample. What you need to generate the configuration file for the OpenVPN Client is to run this command.\n\nTo execute this command, you must have VPN Server administrator privileges. \nThis command cannot be run on VPN Bridge.\nYou cannot execute this command for Virtual Hubs of VPN Servers operating as a cluster. +CMD_OpenVpnMakeConfig_Args OpenVpnMakeConfig [ZIP_FileName] +CMD_OpenVpnMakeConfig_[ZIP_FileName] Specify the output setting files to be saved as ZIP compression format. If no file extension is specified, the ".zip" extension will be appended to the filename. +CMD_OpenVpnMakeConfig_Prompt_ZIP Output Filename of Setting Files (ZIP compressed file): +CMD_OpenVpnMakeConfig_OK The sample setting file was saved as "%s". You can unzip this file to extract setting files.\n +CMD_OpenVpnMakeConfig_ERROR The sample setting files were unable to be saved as "%s". The filename might be invalid.\n + + +# ServerCertRegenerate command +CMD_ServerCertRegenerate Generate New Self-Signed Certificate with Specified CN (Common Name) and Register on VPN Server +CMD_ServerCertRegenerate_Help You can use this command to replace the current certificate on the VPN Server to a new self-signed certificate which has the CN (Common Name) value in the fields.\n\nThis command is convenient if you are planning to use Microsoft SSTP VPN Clone Server Function. Because of the value of CN (Common Name) on the SSL certificate of VPN Server must match to the hostname specified on the SSTP VPN client.\n\nThis command will delete the existing SSL certificate of the VPN Server. It is recommended to backup the current SSL certificate and private key by using the ServerKeyGet command beforehand.\n\nTo execute this command, you must have VPN Server administrator privileges. \nThis command cannot be run on VPN Bridge.\nYou cannot execute this command for Virtual Hubs of VPN Servers operating as a cluster. +CMD_ServerCertRegenerate_Args ServerCertRegenerate [CN] +CMD_ServerCertRegenerate_[CN] Specify a Common Name (CN) which the new certificate will have. +CMD_ServerCertRegenerate_Prompt_CN Value of Common Name (CN): + + +# VpnOverIcmpDnsEnable command +CMD_VpnOverIcmpDnsEnable Enable / Disable the VPN over ICMP / VPN over DNS Server Function +CMD_VpnOverIcmpDnsEnable_Help You can establish a VPN only with ICMP or DNS packets even if there is a firewall or routers which blocks TCP/IP communications. You have to enable the following functions beforehand.\n\nWarning: Use this function for emergency only. It is helpful when a firewall or router is misconfigured to blocks TCP/IP, but either ICMP or DNS is not blocked. It is not for long-term stable using.\n\nTo execute this command, you must have VPN Server administrator privileges. \nThis command cannot be run on VPN Bridge. +CMD_VpnOverIcmpDnsEnable_Args VpnOverIcmpDnsEnable [/ICMP:yes|no] [/DNS:yes|no] +CMD_VpnOverIcmpDnsEnable_ICMP Specify yes to enable the VPN over ICMP Server. Specify no to disable. +CMD_VpnOverIcmpDnsEnable_DNS Specify yes to enable the VPN over DNS Server. Specify no to disable. +CMD_VpnOverIcmpDnsEnable_Prompt_ICMP Enable VPN over ICMP Server (yes / no): +CMD_VpnOverIcmpDnsEnable_Prompt_DNS Enable VPN over DNS Server (yes / no): + + +# VpnOverIcmpDnsGet command +CMD_VpnOverIcmpDnsGet Get Current Setting of the VPN over ICMP / VPN over DNS Function +CMD_VpnOverIcmpDnsGet_Help Get and show the current VPN over ICMP / VPN over DNS Function status.\n\nTo execute this command, you must have VPN Server administrator privileges. \nThis command cannot be run on VPN Bridge. +CMD_VpnOverIcmpDnsGet_Args VpnOverIcmpDnsGet +CMD_VpnOverIcmpDnsGet_PRINT_ICMP VPN over ICMP Server Enabled +CMD_VpnOverIcmpDnsGet_PRINT_DNS VPN over DNS Server Enabled + + +# DynamicDnsGetStatus command +CMD_DynamicDnsGetStatus Show the Current Status of Dynamic DNS Function +CMD_DynamicDnsGetStatus_Help Get and show the current status of the Dynamic DNS function.\n\nThe Dynamic DNS assigns a unique and permanent DNS hostname for this VPN Server. You can use that hostname to specify this VPN Server on the settings for VPN Client and VPN Bridge. You need not to register and keep a domain name.\nAlso, if your ISP assigns you a dynamic (not-fixed) IP address, the corresponding IP address of your Dynamic DNS hostname will be automatically changed. It enables you to keep running the VPN Server by using only a dynamic IP address.\r\nTherefore, you need not any longer to keep static global IP addresses with expenses monthly costs.\n[Caution]\nTo disable the Dynamic DNS Function, modify the configuration file of VPN Server.\r\n\r\nThe "declare root" directive has the "declare DDnsClient" directive. In this directive, you can switch "bool Disable" from false to true, and reboot the VPN Server, then the Dynamic DNS Function will be disabled.\r\nTo execute this command, you must have VPN Server administrator privileges. \nThis command cannot be run on VPN Bridge. +CMD_DynamicDnsGetStatus_Args DynamicDnsGetStatus +CMD_DynamicDnsGetStatus_PRINT_FQDN Assigned Dynamic DNS Hostname (Full) +CMD_DynamicDnsGetStatus_PRINT_HOSTNAME Assigned Dynamic DNS Hostname (Hostname) +CMD_DynamicDnsGetStatus_PRINT_SUFFIX DNS Suffix +CMD_DynamicDnsGetStatus_PRINT_IPv4 Global IPv4 Address +CMD_DynamicDnsGetStatus_PRINT_IPv6 Global IPv6 Address + + +# DynamicDnsSetHostname command +CMD_DynamicDnsSetHostname Set the Dynamic DNS Hostname +CMD_DynamicDnsSetHostname_Help You can use this command to change the hostname assigned by the Dynamic DNS function. The currently assigned hostname can be showen by the DynamicDnsGetStatus command.\n\nThe Dynamic DNS assigns a unique and permanent DNS hostname for this VPN Server. You can use that hostname to specify this VPN Server on the settings for VPN Client and VPN Bridge. You need not to register and keep a domain name.\nAlso, if your ISP assigns you a dynamic (not-fixed) IP address, the corresponding IP address of your Dynamic DNS hostname will be automatically changed. It enables you to keep running the VPN Server by using only a dynamic IP address.\r\nTherefore, you need not any longer to keep static global IP addresses with expenses monthly costs.\n[Caution]\nTo disable the Dynamic DNS Function, modify the configuration file of VPN Server.\r\n\r\nThe "declare root" directive has the "declare DDnsClient" directive. In this directive, you can switch "bool Disable" from false to true, and reboot the VPN Server, then the Dynamic DNS Function will be disabled.\r\nTo execute this command, you must have VPN Server administrator privileges. \nThis command cannot be run on VPN Bridge. +CMD_DynamicDnsSetHostname_Args DynamicDnsSetHostname [hostname] +CMD_DynamicDnsSetHostname_[hostname] Specify the new hostname with 3 letters at least and 31 letters at most. Only alphabets and numerics can be used. +CMD_DynamicDnsSetHostname_Prompt_hostname Dynamic DNS Hostname (3 - 31 letters): + + +# VpnAzureGetStatus command +CMD_VpnAzureGetStatus Show the current status of VPN Azure function +CMD_VpnAzureGetStatus_Help Get and show the current status of the VPN Azure function.\n\nVPN Azure makes it easier to establish a VPN Session from your home PC to your office PC. While a VPN connection is established, you can access to any other servers on the private network of your company.\nYou don't need a global IP address on the office PC (VPN Server). It can work behind firewalls or NATs. No network administrator's configuration required. You can use the built-in SSTP-VPN Client of Windows in your home PC.\nVPN Azure is a cloud VPN service operated by SoftEther VPN Project. VPN Azure is free of charge and available to anyone. Visit http://www.vpnazure.net/ to see details and how-to-use instructions.\n\nThe VPN Azure hostname is same to the hostname of the Dynamic DNS setting, but altering the domain suffix to "vpnazure.net". To change the hostname use the DynamicDnsSetHostname command.\n\nTo execute this command, you must have VPN Server administrator privileges. \nThis command cannot be run on VPN Bridge.\nYou cannot execute this command for Virtual Hubs of VPN Servers operating as a cluster. +CMD_VpnAzureGetStatus_Args VpnAzureGetStatus +CMD_VpnAzureGetStatus_PRINT_ENABLED VPN Azure Function is Enabled +CMD_VpnAzureGetStatus_PRINT_CONNECTED Connection to VPN Azure Cloud Server is Established +CMD_VpnAzureGetStatus_PRINT_HOSTNAME Hostname of this VPN Server on VPN Azure Service + + +# VpnAzureSetStatus command +CMD_VpnAzureSetEnable Enable / Disable VPN Azure Function +CMD_VpnAzureSetEnable_Help Enable or disable the VPN Azure function.\n\nVPN Azure makes it easier to establish a VPN Session from your home PC to your office PC. While a VPN connection is established, you can access to any other servers on the private network of your company.\nYou don't need a global IP address on the office PC (VPN Server). It can work behind firewalls or NATs. No network administrator's configuration required. You can use the built-in SSTP-VPN Client of Windows in your home PC.\nVPN Azure is a cloud VPN service operated by SoftEther VPN Project. VPN Azure is free of charge and available to anyone. Visit http://www.vpnazure.net/ to see details and how-to-use instructions.\n\nThe VPN Azure hostname is same to the hostname of the Dynamic DNS setting, but altering the domain suffix to "vpnazure.net". To change the hostname use the DynamicDnsSetHostname command.\n\nTo execute this command, you must have VPN Server administrator privileges. \nThis command cannot be run on VPN Bridge.\nYou cannot execute this command for Virtual Hubs of VPN Servers operating as a cluster. +CMD_VpnAzureSetEnable_Args VpnAzureSetEnable [yes|no] +CMD_VpnAzureSetEnable_[yes|no] Specify 'yes' to enable VPN Azure. 'no' to disable it. +CMD_VpnAzureSetEnable_PROMPT Enable VPN Azure (yes / no): + + + + +####################################################### +# # +# Management commands for VPN Client are listed below # +# # +####################################################### + + +# VersionGet command +CMD_VersionGet Get Version Information of VPN Client Service +CMD_VersionGet_Help Use this to get the version information of the currently managed VPN Client Service program. +CMD_VersionGet_Args VersionGet +CMD_VersionGet_1 Product Name +CMD_VersionGet_2 Version Information +CMD_VersionGet_3 Build Information +CMD_VersionGet_4 Process ID +CMD_VersionGet_5 OS Type + + +# PasswordSet command +CMD_PasswordSet Set the password to connect to the VPN Client service. +CMD_PasswordSet_Help You can make it mandatory to input a password for occasions when the Command Line Management Utility and the VPN Client Manager connect to a VPN Client service to control it. You can use this command to set the password that must be input. \nYou can also make it mandatory for this password to be input when doing remote operations (from a computer that is not localhost) +CMD_PasswordSet_Args PasswordSet [password] [/REMOTEONLY:yes|no] +CMD_PasswordSet_[password] Specify the password you wish to set. You can delete the password setting by specifying "none". +CMD_PasswordSet_REMOTEONLY Specify "yes" to only require the password to be input when operation is done remotely (from a computer that is not localhost). This stops the password being required when the connection is from localhost. When this parameter is omitted, it will be regarded as "no". + + +# PasswordGet command +CMD_PasswordGet Get Password Setting to Connect to VPN Client Service +CMD_PasswordGet_Help Use this to get the setting that determines whether to input a password for occasions when the Command Line Management Utility and the VPN Client Manager connect to a VPN Client service to control it. \nIn the case when a password is requested, it also gets the setting that determines whether this password is only requested when operation is performed remotely (from a computer that is not localhost). +CMD_PasswordGet_Args PasswordGet +CMD_PasswordGet_1 Set Password +CMD_PasswordGet_2 Request Password for Remote Operation Only + + +# CertList command +CMD_CertList Get List of Trusted CA Certificates +CMD_CertList_Help Here you can manage the list of certificate authority certificates that are trusted by VPN client. You can use the registered CA certificate list to verify server certificates when connecting to VPN Servers. +CMD_CertList_Args CertList + + +# CertAdd command +CMD_CertAdd Add Trusted CA Certificate +CMD_CertAdd_Help Use this to add a new certificate to a list of CA certificates trusted by the VPN Client. You can use the registered CA certificate list to verify server certificates when connecting to VPN Servers. \nTo get a list of the current certificates you can use the CertList command. \nThe certificate you add must be saved in the X.509 file format. +CMD_CertAdd_Args CertAdd [path] +CMD_CertAdd_[path] Specify the file name of the X.509 certificate to register. + + +# CertDelete command +CMD_CertDelete Delete Trusted CA Certificate +CMD_CertDelete_Help Use this to delete an existing certificate from a list of CA certificates trusted by the VPN Client. \nTo get a list of the current certificates you can use the CertList command. +CMD_CertDelete_Args CertDelete [id] +CMD_CertDelete_[id] Specify the ID of the certificate to delete. + + +# CertGet command +CMD_CertGet Get Trusted CA Certificate +CMD_CertGet_Help Use this to get an existing certificate from the list of CA certificates trusted by the VPN Client and save it as a file in X.509 format. +CMD_CertGet_Args CertGet [id] [/SAVECERT:path] +CMD_CertGet_[id] Specify the ID of the certificate to get. +CMD_CertGet_SAVECERT Specify the file name to save the certificate you obtained. + + +# SecureList command +CMD_SecureList Get List of Usable Smart Card Types +CMD_SecureList_Help Use this to display a list of smart cards that are supported by VPN Client. \nThe types of smart cards listed in this list have had their drivers installed on the current computer and are supported by VPN software. \r\nIf there is a type of smart card that is currently being used that does not appear in the list, it may be possible to enable use by updating the VPN software to a newer version. +CMD_SecureList_Args SecureList + + +# SecureSelect command +CMD_SecureSelect Select the Smart Card Type to Use +CMD_SecureSelect_Help Use this to select the type of the smart card to be used by the VPN Client. \nTo get the list of usable smart card types, use the SecureList command. +CMD_SecureSelect_Args SecureSelect [id] +CMD_SecureSelect_[id] Specify the ID of the smart card type. +CMD_SecureSelect_PROMPT_ID ID of Smart Card Type to Use + + +# SecureGet command +CMD_SecureGet Get ID of Smart Card Type to Use +CMD_SecureGet_Help Use this to get the ID of the smart card type that is set to be used for the current VPN Client. By viewing the results of the SecureList command based on this ID, you can get the type of the currently selected smart card. \nIf there is no smart card that is currently selected, 0 will be displayed for the ID. +CMD_SecureGet_Args SecureGet +CMD_SecureGet_Print The currently selected smart card ID is %u. +CMD_SecureGet_NoPrint Currently, a smart card is not selected. + + +# NicCreate command +CMD_NicCreate Create New Virtual Network Adapter +CMD_NicCreate_Help Use this to add a new Virtual Network Adapter to the system. You can give the virtual network adapter a name of your choice. \nYou can set a name that consists of alphanumeric characters for the virtual network adapter. For Windows 2000 or newer systems, this name can be up to 31 characters, but for Windows 98, 98SE and ME it can be up to 4 characters. \nIf the NicCreate command was called, a new virtual network adapter device driver will be installed on the operating system that the VPN Client is operating on. \nIn this case, depending on the operating system, a dialog box may appear to confirm if it is OK to install the device driver. +CMD_NicCreate_Args NicCreate [name] +CMD_NicCreate_[name] Specify the name of the virtual network adapter. +CMD_NicCreate_PROMPT_NAME Virtual Network Adapter Name: + + +# NicDelete command +CMD_NicDelete Delete Virtual Network Adapter +CMD_NicDelete_Help Use this to delete an existing virtual network adapter from the system. \nWhen you delete a virtual network adapter from the system, all the connections which are using that virtual network adapter will be disconnected. \nAlso, the Connection Settings that are set to use a virtual network adapter that has been deleted will have their settings automatically changed to use another virtual network adapter. \nThis command can be used when VPN Client is operating on Windows 2000 or newer operating systems. +CMD_NicDelete_Args NicDelete [name] +CMD_NicDelete_[name] Specify the name of the virtual network adapter. + + +# NicUpgrade command +CMD_NicUpgrade Upgrade Virtual Network Adapter Device Driver +CMD_NicUpgrade_Help If the device driver version of the existing virtual network adapter is old, then this upgrades to the latest device driver that was bundled with the currently operating VPN client. Even if a upgrade is not performed, the device driver will be reinstalled. \nIn this case, depending on the operating system, a dialog box may appear to confirm if it is OK to install the device driver. \nThis command can be used when VPN Client is operating on Windows 2000 or newer operating systems. +CMD_NicUpgrade_Args NicUpgrade [name] +CMD_NicUpgrade_[name] Specify the name of the virtual network adapter. + + +# NicGetSetting command +CMD_NicGetSetting Get Virtual Network Adapter Setting +CMD_NicGetSetting_Help Use this to get the MAC address setting of the existing virtual network adapter. \nThis command can be used when VPN Client is operating on Windows 2000 or newer operating systems. +CMD_NicGetSetting_Args NicGetSetting [name] +CMD_NicGetSetting_[name] Specify the name of the virtual network adapter. +CMD_NicGetSetting_1 Device Name +CMD_NicGetSetting_2 Status +CMD_NicGetSetting_3 MAC Address +CMD_NicGetSetting_4 Version +CMD_NicGetSetting_5 Driver File Name +CMD_NicGetSetting_6 GUID + + +# NicSetSetting command +CMD_NicSetSetting Change Virtual Network Adapter Setting +CMD_NicSetSetting_Help Use this to change the MAC address setting of the existing virtual network adapter. When this command is executed, the currently operating virtual network adapter device drivers will be restarted. \nThis command can be used when VPN Client is operating on Windows 2000 or newer operating systems. +CMD_NicSetSetting_Args NicSetSetting [name] [/MAC:mac] +CMD_NicSetSetting_[name] Specify the name of the virtual network adapter. +CMD_NicSetSetting_MAC Specify the MAC address you wish to set. \nSpecify a 6-byte hexadecimal string for the MAC address. \nExample: 00:AC:01:23:45:67 or 00-AC-01-23-45-67 +CMD_NicSetSetting_PROMPT_MAC MAC Address to Set: + + +# NicEnable command +CMD_NicEnable Enable Virtual Network Adapter +CMD_NicEnable_Help Use this to enable an existing, disabled virtual network adapter. \nThis command can be used when VPN Client is operating on Windows 2000 or newer operating systems. +CMD_NicEnable_Args NicEnable [name] +CMD_NicEnable_[name] Specify the name of the virtual network adapter. + + +# NicDisable command +CMD_NicDisable Disable Virtual Network Adapter +CMD_NicDisable_Help Use this to disable an existing, enabled virtual network adapter. \nThis command can be used when VPN Client is operating on Windows 2000 or newer operating systems. +CMD_NicDisable_Args NicDisable [name] +CMD_NicDisable_[name] Specify the name of the virtual network adapter. + + +# NicList command +CMD_NicList Get List of Virtual Network Adapters +CMD_NicList_Help This allows you to get a list of virtual network adapters registered on the current system. +CMD_NicList_Args NicList + + +# AccountList command +CMD_AccountList Get List of VPN Connection Settings +CMD_AccountList_Help Use this to get a list of VPN Connection Settings registered on the VPN Client. +CMD_AccountList_Args AccountList + + +# AccountCreate command +CMD_AccountCreate Create New VPN Connection Setting +CMD_AccountCreate_Help Use this to create a new VPN Connection Setting on the VPN Client. \nTo create a VPN Connection Setting, in addition to specifying the VPN Connection Setting name and destination server as initial parameters and the destination virtual Hub, and user name, you must also specify the name of the virtual network adapter to use. When a new VPN Connection Setting is created, the type of user authentication is initially set as Anonymous Authentication and the proxy server setting and the verification options of the server certificate is not set. To change these settings and other advanced settings after the VPN Connection Setting has been created, use the other commands that begin with the name "Account". +CMD_AccountCreate_Args AccountCreate [name] [/SERVER:hostname:port] [/HUB:hubname] [/USERNAME:username] [/NICNAME:nicname] +CMD_AccountCreate_[name] Specify the name of the VPN Connection Setting to create. +CMD_AccountCreate_SERVER Specify the host name and port number of the destination VPN Server using the format [host name:port number]. You can also specify by IP address. +CMD_AccountCreate_HUB Specify the Virtual Hub on the destination VPN Server. +CMD_AccountCreate_USERNAME Specify the user name to use for user authentication when connecting to the destination VPN Server. +CMD_AccountCreate_NICNAME Specify the virtual network adapter to use to connect. +CMD_AccountCreate_Prompt_Name Name of VPN Connection Setting: +CMD_AccountCreate_Prompt_Server Destination VPN Server Host Name and Port Number: +CMD_AccountCreate_Prompt_Hub Destination Virtual Hub Name: +CMD_AccountCreate_Prompt_Username Connecting User Name: +CMD_AccountCreate_Prompt_Nicname Used Virtual Network Adapter Name: + + +# AccountSet command +CMD_AccountSet Set the VPN Connection Setting Connection Destination +CMD_AccountSet_Help Use this to set, for the VPN Connection Setting registered on the VPN Client, the destination VPN Server host name and port number, Virtual Hub name, user name used for connection and virtual network adapter name to use. +CMD_AccountSet_Args AccountSet [name] [/SERVER:hostname:port] [/HUB:hubname] +CMD_AccountSet_[name] Specify the name of the VPN Connection Setting whose setting you want to change. +CMD_AccountSet_SERVER Specify the host name and port number of the destination VPN Server using the format "host name:port number". You can also specify by IP address. +CMD_AccountSet_HUB Specify the Virtual Hub on the destination VPN Server. + + +# AccountGet command +CMD_AccountGet Get Setting of VPN Connection Setting +CMD_AccountGet_Help Use this to get the VPN Connection Setting contents of a VPN Connection Setting registered on the VPN Client. \nTo change the VPN Connection Setting contents of the VPN Connection Setting, use the other commands that begin with the name "Account" after creating the VPN Connection Setting. +CMD_AccountGet_Args AccountGet [name] +CMD_AccountGet_[name] Specify the name of the VPN Connection Setting whose setting you want to get. + + +# AccountDelete command +CMD_AccountDelete Delete VPN Connection Setting +CMD_AccountDelete_Help Use this to delete VPN Connection Setting that is registered on the VPN Client. If the specified VPN Connection Setting has a status of online, the connections will be automatically disconnected and then the VPN Connection Setting will be deleted. +CMD_AccountDelete_Args AccountDelete [name] +CMD_AccountDelete_[name] Specify the name of the VPN Connection Setting to delete. + + +# AccountUsernameSet command +CMD_AccountUsernameSet Set User Name of User to Use Connection of VPN Connection Setting +CMD_AccountUsernameSet_Help When a VPN Connection Setting registered on the VPN Client is specified and that VPN Connection Setting connects to the VPN Server, use this to specify the user name required for user authentication. \nIn some cases it is necessary to specify the type of user authentication and specify the required parameters. To change this information you can use commands such as AccountAnonymousSet, AccountPasswordSet, AccountCertSet and AccountSecureCertSet. +CMD_AccountUsernameSet_Args AccountUsernameSet [name] [/USERNAME:username] +CMD_AccountUsernameSet_[name] Specify the name of the VPN Connection Setting whose setting you want to change. +CMD_AccountUsernameSet_USERNAME Specify the user name required for user authentication when the VPN Connection Setting connects to the VPN Server. +CMD_AccountUsername_Notice The auth type for this VPN Connection Setting is currently set as password authentication. After changing the user name, you must use the AccountPasswordSet command to reset the password. + + +# AccountAnonymousSet command +CMD_AccountAnonymousSet Set User Authentication Type of VPN Connection Setting to Anonymous Authentication +CMD_AccountAnonymousSet_Help Use this to set the user auth type to [Anonymous Authentication] for when a VPN Connection Setting registered on the VPN Client is specified and that VPN Connection Setting connects to the VPN Server. +CMD_AccountAnonymousSet_Args AccountAnonymousSet [name] +CMD_AccountAnonymousSet_[name] Specify the name of the VPN Connection Setting whose setting you want to change. + + +# AccountPasswordSet command +CMD_AccountPasswordSet Set User Authentication Type of VPN Connection Setting to Password Authentication +CMD_AccountPasswordSet_Help Use this to set the user auth type to Password Authentication for when a VPN Connection Setting registered on the VPN Client is specified and that VPN Connection Setting connects to the VPN Server. Specify Standard Password Authentication and RADIUS or NT Domain Authentication as the password authentication type. +CMD_AccountPasswordSet_Args AccountPasswordSet [name] [/PASSWORD:password] [/TYPE:standard|radius] +CMD_AccountPasswordSet_[name] Specify the name of the VPN Connection Setting whose setting you want to change. +CMD_AccountPasswordSet_PASSWORD Specify the password to use for password authentication. If this is not specified, a prompt will appear to input the password. +CMD_AccountPasswordSet_TYPE Specify either "standard" (Standard Password Authentication) or "radius" (RADIUS or NT Domain Authentication) as the password authentication type. +CMD_AccountPasswordSet_Prompt_Type Specify standard or radius: +CMD_AccountPasswordSet_Type_Invalid The standard or radius specification is invalid. + + +# AccountCertSet command +CMD_AccountCertSet Set User Authentication Type of VPN Connection Setting to Client Certificate Authentication +CMD_AccountCertSet_Help Use this to set the user auth type to Client Certificate Authentication for when a VPN Connection Setting registered on the VPN Client is specified and that VPN Connection Setting connects to the VPN Server. For this certificate, you must specify a certificate file in the X.509 format and a private key file that is Base 64 encoded. +CMD_AccountCertSet_Args AccountCertSet [name] [/LOADCERT:cert] [/LOADKEY:key] +CMD_AccountCertSet_[name] Specify the name of the VPN Connection Setting whose setting you want to change. +CMD_AccountCertSet_LOADCERT Specify the X.509 format certificate file to provide for certificate authentication. +CMD_AccountCertSet_LOADKEY Specify the Base-64-encoded private key file name for the certificate. + + +# AccountCertGet command +CMD_AccountCertGet Get Client Certificate to Use for Cascade Connection +CMD_AccountCertGet_Help When a VPN Connection Setting registered on VPN Client is specified and that VPN Connection Setting uses client certificate authentication, use this to get the certificate that is provided as the client certificate and save the certificate file in X.509 format. +CMD_AccountCertGet_Args AccountCertGet [name] [/SAVECERT:cert] +CMD_AccountCertGet_[name] Specify the name of the VPN Connection Setting whose setting you want to get. +CMD_AccountCertGet_SAVECERT Specify the file name to save the certificate you obtained in X.509 format. + + +# AccountEncryptEnable command +CMD_AccountEncryptEnable Enable Encryption when Communicating by VPN Connection Setting +CMD_AccountEncryptEnable_Help When a VPN Connection Setting registered on the VPN Client is specified and that VPN Connection Setting is used for communication between VPN Servers via a VPN connection, use this to set the communication contents between the VPN Servers to be encrypted by SSL. \nNormally communication between VPN Servers is encrypted by SSL to prevent eavesdropping of information and fraud. You can also disable encryption. When encryption is disabled, the communication throughput improves but the communication data flows over the network in plain text. +CMD_AccountEncryptEnable_Args AccountEncryptEnable [name] +CMD_AccountEncryptEnable_[name] Specify the name of the VPN Connection Setting whose setting you want to change. + + +# AccountEncryptDisable command +CMD_AccountEncryptDisable Disable Encryption when Communicating by VPN Connection Setting +CMD_AccountEncryptDisable_Help When a VPN Connection Setting registered on the VPN Client is specified and that VPN Connection Setting is used for communication between VPN Servers via a VPN connection, use this to set the communication contents between the VPN Servers not to be encrypted. \nNormally communication between VPN Servers is encrypted by SSL to prevent eavesdropping of information and fraud. You can also disable encryption. When encryption is disabled, the communication throughput improves but the communication data flows over the network in plain text. +CMD_AccountEncryptDisable_Args AccountEncryptDisable [name] +CMD_AccountEncryptDisable_[name] Specify the name of the VPN Connection Setting whose setting you want to change. + + +# AccountCompressEnable command +CMD_AccountCompressEnable Enable Data Compression when Communicating by VPN Connection Setting +CMD_AccountCompressEnable_Help When a VPN Connection Setting registered on the VPN Client is specified and that VPN Connection Setting is used for communication between VPN Servers via a VPN connection, use this to set the communication contents between the VPN Servers to be compressed. \nIt is possible to achieve a maximum of 80% compression. Compression however places higher loads on the CPU of both the client and server machines. When the line speed is about 10 Mbps or greater, compression can lower throughput, but sometimes it can have the opposite effect. +CMD_AccountCompressEnable_Args AccountCompressEnable [name] +CMD_AccountCompressEnable_[name] Specify the name of the VPN Connection Setting whose setting you want to change. + + +# AccountCompressDisable command +CMD_AccountCompressDisable Disable Data Compression when Communicating by VPN Connection Setting +CMD_AccountCompressDisable_Help When a VPN Connection Setting registered on the VPN Client is specified and that VPN Connection Setting is used for communication between VPN Servers via a VPN connection, use this to set the communication contents between the VPN Servers not to be compressed. +CMD_AccountCompressDisable_Args AccountCompressDisable [name] +CMD_AccountCompressDisable_[name] Specify the name of the VPN Connection Setting whose setting you want to change. + + +# AccountHttpHeader* commands +CMD_AccountHttpHeader_Prompt_Name Value name (part before the colon): +CMD_AccountHttpHeader_Prompt_Data Value data (part after the colon): + + +# AccountHttpHeaderAdd command +CMD_AccountHttpHeaderAdd Add a custom value in the HTTP header sent to the proxy server +CMD_AccountHttpHeaderAdd_Help Use this to add a custom value in the HTTP header sent to the proxy server. A custom HTTP header can be used to bypass certain restrictions imposed on the network or to avoid speed limitations applied by the QoS. +CMD_AccountHttpHeaderAdd_Args AccountHttpHeaderAdd [name] [/NAME:name] [/DATA:data] +CMD_AccountHttpHeaderAdd_[name] Specify the name of the VPN Connection Setting whose setting you want to change. +CMD_AccountHttpHeaderAdd_NAME Specify the name of the custom value (the part before the colon character). +CMD_AccountHttpHeaderAdd_DATA Specify the data of the custom value (the part after the colon character). + + +# AccountHttpHeaderDelete command +CMD_AccountHttpHeaderDelete Delete a custom value in the HTTP header sent to the proxy server +CMD_AccountHttpHeaderDelete_Help Use this to delete a custom value in the HTTP header sent to the proxy server. A custom HTTP header can be used to bypass certain restrictions imposed on the network or to avoid speed limitations applied by the QoS. +CMD_AccountHttpHeaderDelete_Args AccountHttpHeaderDelete [name] [/NAME:name] +CMD_AccountHttpHeaderDelete_[name] Specify the name of the VPN Connection Setting whose setting you want to change. +CMD_AccountHttpHeaderDelete_NAME Specify the name of the custom value (the part before the colon character). + + +# AccountHttpHeaderGet command +CMD_AccountHttpHeaderGet Get the list of custom values in the HTTP header sent to the proxy server +CMD_AccountHttpHeaderGet_Help Use this to get the list of custom values in the HTTP header sent to the proxy server. A custom HTTP header can be used to bypass certain restrictions imposed on the network or to avoid speed limitations applied by the QoS. +CMD_AccountHttpHeaderGet_Args AccountHttpHeaderGet [name] +CMD_AccountHttpHeaderGet_[name] Specify the name of the VPN Connection Setting whose setting you want to get. + + +# AccountProxyNone command +CMD_AccountProxyNone Specify Direct TCP/IP Connection as the Connection Method of VPN Connection Setting +CMD_AccountProxyNone_Help When a VPN Connection Setting registered on the VPN Client is specified and that VPN Connection Setting connects to a VPN Server, use this to set Direct TCP/IP Connection as the connection method to use, in which case the connection route will not be via a proxy server. +CMD_AccountProxyNone_Args AccountProxyNone [name] +CMD_AccountProxyNone_[name] Specify the name of the VPN Connection Setting whose setting you want to change. + + +# AccountProxyHttp command +CMD_AccountProxyHttp Set Connection Method of VPN Connection Setting to be via an HTTP Proxy Server +CMD_AccountProxyHttp_Help When a VPN Connection Setting registered on the VPN Client is specified and that VPN Connection Setting connects to a VPN Server, use this to set Connect via HTTP Proxy Server as the method of connection to use, which requires the specification of the host name and port number of the HTTP Proxy server to communicate via as well as a user name and password (when required). \nThe HTTP proxy server that communication will travel via must be compatible with the CONNECT method to use HTTPS communication. +CMD_AccountProxyHttp_Args AccountProxyHttp [name] [/SERVER:hostname:port] [/USERNAME:username] [/PASSWORD:password] +CMD_AccountProxyHttp_[name] Specify the name of the VPN Connection Setting whose setting you want to change. +CMD_AccountProxyHttp_SERVER Specify the host name or IP address, and port number of the on-route HTTP proxy server using the format [host name:port number]. +CMD_AccountProxyHttp_USERNAME When user authentication is required to connect to the on-route HTTP proxy server, specify the user name. Also, specify the /PASSWORD parameter at the same time. If the parameters /USERNAME and /PASSWORD are not specified, the user authentication data will not be set. +CMD_AccountProxyHttp_PASSWORD When user authentication is required to connect to the on-route HTTP proxy server, specify the password. Specify this together with the /USERNAME parameter. +CMD_AccountProxyHttp_Prompt_Server Proxy Server Host Name and Port Number: + + +# AccountProxySocks command +CMD_AccountProxySocks Set Connection Method of VPN Connection Setting to be via a SOCKS4 Proxy Server +CMD_AccountProxySocks_Help When a VPN Connection Setting registered on the VPN Client is specified and that VPN Connection Setting connects to a VPN Server, use this to set Connect via SOCKS4 Proxy Server as the method of connection to use, which requires the specification of the host name and port number of the SOCKS4 Proxy server to communicate via as well as a user name and password (when required). +CMD_AccountProxySocks_Args AccountProxySocks [name] [/SERVER:hostname:port] [/USERNAME:username] [/PASSWORD:password] +CMD_AccountProxySocks_[name] Specify the name of the VPN Connection Setting whose setting you want to change. +CMD_AccountProxySocks_SERVER Specify the host name or IP address, and port number of the on-route SOCKS4 proxy server using the format [host name:port number]. +CMD_AccountProxySocks_USERNAME When user authentication is required to connect to the on-route SOCKS4 proxy server, specify the user name. Also, specify the /PASSWORD parameter at the same time. If the parameters /USERNAME and /PASSWORD are not specified, the user authentication data will not be set. +CMD_AccountProxySocks_PASSWORD When user authentication is required to connect to the on-route SOCKS4 proxy server, specify the password. Specify this together with the /USERNAME parameter. + + +# AccountProxySocks5 command +CMD_AccountProxySocks5 Set Connection Method of VPN Connection Setting to be via a SOCKS5 Proxy Server +CMD_AccountProxySocks5_Help When a VPN Connection Setting registered on the VPN Client is specified and that VPN Connection Setting connects to a VPN Server, use this to set Connect via SOCKS5 Proxy Server as the method of connection to use, which requires the specification of the host name and port number of the SOCKS5 Proxy server to communicate via as well as a user name and password (when required). +CMD_AccountProxySocks5_Args AccountProxySocks5 [name] [/SERVER:hostname:port] [/USERNAME:username] [/PASSWORD:password] +CMD_AccountProxySocks5_[name] Specify the name of the VPN Connection Setting whose setting you want to change. +CMD_AccountProxySocks5_SERVER Specify the host name or IP address, and port number of the on-route SOCKS5 proxy server using the format [host name:port number]. +CMD_AccountProxySocks5_USERNAME When user authentication is required to connect to the on-route SOCKS5 proxy server, specify the user name. Also, specify the /PASSWORD parameter at the same time. If the parameters /USERNAME and /PASSWORD are not specified, the user authentication data will not be set. +CMD_AccountProxySocks5_PASSWORD When user authentication is required to connect to the on-route SOCKS5 proxy server, specify the password. Specify this together with the /USERNAME parameter. + + +# AccountServerCertEnable command +CMD_AccountServerCertEnable Enable VPN Connection Setting Server Certificate Verification Option +CMD_AccountServerCertEnable_Help When a VPN Connection Setting registered on the VPN Client is specified and that VPN Connection Setting connects to a VPN Server, use this to enable the option to check whether the SSL certificate provided by the destination VPN Server can be trusted. \nIf this option is enabled, we recommend that you either use the AccountServerCertSet command to save the connection destination server SSL certificate beforehand in the VPN Connection Setting settings beforehand, or use the CertAdd command etc. to register a root certificate containing the signed server SSL certificate in the list of Virtual Hub trusted CA certificates. If it is not registered, a confirmation message sometimes is displayed on the initial connection. \nIf the certificate of the connected VPN Server cannot be trusted under the condition where the option to verify server certificates has been enabled for the VPN Connection Setting, the connection will be promptly cancelled and continual reattempts at connection will be made. +CMD_AccountServerCertEnable_Args AccountServerCertEnable [name] +CMD_AccountServerCertEnable_[name] Specify the name of the VPN Connection Setting whose setting you want to change. + + +# AccountServerCertDisable command +CMD_AccountServerCertDisable Disable VPN Connection Setting Server Certificate Verification Option +CMD_AccountServerCertDisable_Help When a VPN Connection Setting registered on the VPN Client is specified and that VPN Connection Setting connects to a VPN Server, use this to disable the option to check whether the SSL certificate provided by the destination VPN Server can be trusted. +CMD_AccountServerCertDisable_Args AccountServerCertDisable [name] +CMD_AccountServerCertDisable_[name] Specify the name of the VPN Connection Setting whose setting you want to change. + + +# AccountRetryOnServerCertEnable command +CMD_AccountRetryOnServerCertEnable Enable VPN connection retry if server certificate is invalid +CMD_AccountRetryOnServerCertEnable_Help When a VPN Connection Setting registered on the VPN Client is specified and that VPN Connection Setting connects to a VPN Server, use this to enable the option to retry connection if Server certificate cannot be trusted. +CMD_AccountRetryOnServerCertEnable_Args AccountRetryOnServerCertEnable [name] +CMD_AccountRetryOnServerCertEnable_[name] Specify the name of the VPN Connection Setting whose setting you want to change. + + +# AccountRetryOnServerCertDisable command +CMD_AccountRetryOnServerCertDisable Disable VPN connection retry if server certificate is invalid +CMD_AccountRetryOnServerCertDisable_Help When a VPN Connection Setting registered on the VPN Client is specified and that VPN Connection Setting connects to a VPN Server, use this to disable the option to retry connection if Server certificate cannot be trusted. +CMD_AccountRetryOnServerCertDisable_Args AccountRetryOnServerCertDisable [name] +CMD_AccountRetryOnServerCertDisable_[name] Specify the name of the VPN Connection Setting whose setting you want to change. + + +# AccountServerCertSet command +CMD_AccountServerCertSet Set Server Individual Certificate for VPN Connection Setting +CMD_AccountServerCertSet_Help When a VPN Connection Setting registered on the VPN Client is specified and that VPN Connection Setting connects to a VPN Server, use this to register the same certificate as the SSL certificate provided by the destination VPN Server. \nIf the option to verify server certificates for VPN Connection Settings is enabled, you must either use this command to save the connection destination server SSL certificate beforehand in the VPN Connection Setting settings beforehand, or use the CAAdd command etc. to register a root certificate containing the signed server SSL certificate in the list of Virtual Hub trusted CA certificates. \nIf the certificate of the connected VPN Server cannot be trusted under the condition where the option to verify server certificates has been enabled for the VPN Connection Setting, the connection will be promptly cancelled and continual reattempts at connection will be made. +CMD_AccountServerCertSet_Args AccountServerCertSet [name] [/LOADCERT:cert] +CMD_AccountServerCertSet_[name] Specify the name of the VPN Connection Setting whose setting you want to change. +CMD_AccountServerCertSet_LOADCERT Specify X.509 format certificate file name that the server individual certificate which you wish to set is saved under. + + +# AccountServerCertDelete command +CMD_AccountServerCertDelete Delete Server Individual Certificate for VPN Connection Setting +CMD_AccountServerCertDelete_Help When a VPN Connection Setting registered on the VPN Client is specified and a server individual certificate is registered for that VPN Connection Setting, use this to delete that certificate. +CMD_AccountServerCertDelete_Args AccountServerCertDelete [name] +CMD_AccountServerCertDelete_[name] Specify the name of the VPN Connection Setting whose setting you want to change. + + +# AccountServerCertGet command +CMD_AccountServerCertGet Get Server Individual Certificate for VPN Connection Setting +CMD_AccountServerCertGet_Help When a VPN Connection Setting is specified and a server Individual certificate is registered for that VPN Connection Setting, use this to get that certificate and save it as an X.509 format certificate file. +CMD_AccountServerCertGet_Args AccountServerCertGet [name] [/SAVECERT:path] +CMD_AccountServerCertGet_[name] Specify the name of the VPN Connection Setting whose setting you want to change. +CMD_AccountServerCertGet_SAVECERT Specify the certificate file name to save the server individual certificate in X.509 format. + + +# AccountDetailSet command +CMD_AccountDetailSet Set Advanced Settings for VPN Connection Setting +CMD_AccountDetailSet_Help Use this to customize the VPN protocol communication settings used when a VPN Connection Setting registered on a VPN Client is specified and that VPN Connection Setting connects to the VPN Server. +CMD_AccountDetailSet_Args AccountDetailSet [name] [/MAXTCP:max_connection] [/INTERVAL:additional_interval] [/TTL:disconnect_span] [/HALF:yes|no] [/BRIDGE:yes|no] [/MONITOR:yes|no] [/NOTRACK:yes|no] [/NOQOS:yes|no] +CMD_AccountDetailSet_[name] Specify the name of the VPN Connection Setting whose setting you want to change. +CMD_AccountDetailSet_MAXTCP Specify, using an integer in the range 1 to 32, the number of TCP connections to be used for VPN communication. By using data transmission by multiple TCP connections for VPN communication sessions with VPN Servers it is sometimes possible to increase communication speed. \nNote: We recommend about 8 lines when the connection lines to the server are fast, and 1 line when using a slow connection such as dialup. +CMD_AccountDetailSet_INTERVAL When communicating by VPN by establishing multiple TCP connections, specify in seconds, the establishing interval for each TCP connection. The standard value is 1 second. +CMD_AccountDetailSet_TTL When specifying connection life of each TCP connection specify in seconds the keep-alive time from establishing a TCP connection until disconnection. If 0 is specified, keep-alive will not be set. +CMD_AccountDetailSet_HALF Specify "yes" when enabling half duplex mode. When using two or more TCP connections for VPN communication, it is possible to use Half Duplex Mode. By enabling half duplex mode it is possible to automatically fix data transmission direction as half and half for each TCP connection. In the case where a VPN using 8 TCP connections is established, for example, when half-duplex is enabled, communication can be fixes so that 4 TCP connections are dedicated to the upload direction and the other 4 connections are dedicated to the download direction. +CMD_AccountDetailSet_BRIDGE Specify "yes" when connecting to the VPN Server using Bridge / Router Mode. When using Bridge / Router Mode to connect, it is possible to provide bridging or routing to another network on the side of the virtual network adapter of the VPN Client. However, if the security policy of the user who is being used for connection denies the use of bridges or routing, then connection will fail. +CMD_AccountDetailSet_MONITOR Specify "yes" when connecting to the VPN Server using Monitoring Mode. When a connection is made using Monitoring Mode, you can receive all packets that flow through the Virtual Hub. However, if the security policy of the user who is being used for connection does not allow Monitoring Mode, then connection will fail. +CMD_AccountDetailSet_NOTRACK Specify "yes" will disable the adjustments of routing table. Normally "no" is specified. +CMD_AccountDetailSet_NOQOS Specify "yes" when disabling VoIP / QoS functions. Normally "no" is specified. +CMD_AccountDetailSet_DISABLEUDP Specify "yes" when disabling UDP acceleration function. Normally "no" is specified. +CMD_AccountDetailSet_Eval_MaxTcp Specify an integer in the range 1 to 32 for the number of TCP connections. +CMD_AccountDetailSet_Eval_Interval Set at least 1 second for the interval to establish a TCP connection. +CMD_AccountDetailSet_Prompt_MaxTcp Number of TCP Connections to Use in VPN Communication: +CMD_AccountDetailSet_Prompt_Interval Interval between Establishing Each TCP Connection: +CMD_AccountDetailSet_Prompt_TTL Connection Life of Each TCP Connection (0 for no keep-alive): +CMD_AccountDetailSet_Prompt_HALF Enable Half-Duplex Mode (yes/no): +CMD_AccountDetailSet_Prompt_BRIDGE Enable Bridge / Router Mode (yes/no): +CMD_AccountDetailSet_Prompt_MONITOR Enable Monitoring Mode (yes/no): +CMD_AccountDetailSet_Prompt_NOTRACK Disable Adjustment of Routing Table (yes/no): +CMD_AccountDetailSet_Prompt_NOQOS Disable QoS Control Function (yes/no): +CMD_AccountDetailSet_Prompt_DISABLEUDP Disable UDP Acceleration Function (yes/no): + + +# AccountRename command +CMD_AccountRename Change VPN Connection Setting Name +CMD_AccountRename_Help Use this to specify a VPN Connection Setting registered on the VPN Client and change its name. +CMD_AccountRename_Args AccountRename [name] [/NEW:new_name] +CMD_AccountRename_[name] Specify the current name of the VPN Connection Setting whose name you want to change. +CMD_AccountRename_NEW Specify the new name after the change. +CMD_AccountRename_PROMPT_OLD Current Name: +CMD_AccountRename_PROMPT_NEW New Name: + + +# AccountConnect command +CMD_AccountConnect Start Connection to VPN Server using VPN Connection Setting +CMD_AccountConnect_Help Use this to specify a VPN Connection Setting registered on the VPN Client and start a connection to the VPN Server using that VPN Connection Setting. A VPN Connection Setting that has a connecting status or a connected status will continue to be connected to the VPN Server, or continue to attempt to connect to the VPN Server until the AccountDisconnect command is used to disconnect the connection (Note however, if the AccountRetrySet command is used to specify the number of retries, connection attempts will be aborted when the specified value is reached.) +CMD_AccountConnect_Args AccountConnect [name] +CMD_AccountConnect_[name] Specify the name of the VPN Connection Setting whose connection you want to start. + + +# AccountDisconnect command +CMD_AccountDisconnect Disconnect VPN Connection Setting During Connection +CMD_AccountDisconnect_Help Use this to specify a VPN Connection Setting that is registered on the VPN Client and that is either in the condition of connecting or is connected, and immediately disconnect it. +CMD_AccountDisconnect_Args AccountDisconnect [name] +CMD_AccountDisconnect_[name] Specify the name of the VPN Connection Setting to disconnect. + + +# AccountStatusGet command +CMD_AccountStatusGet Get Current VPN Connection Setting Status +CMD_AccountStatusGet_Help When a VPN Connection Setting that is registered on the VPN Client is specified and that VPN Connection Setting is currently connected, use this to get its connection status and other information. +CMD_AccountStatusGet_Args AccountStatusGet [name] +CMD_AccountStatusGet_[name] Specify the name of the VPN Connection Setting whose information you want to get. + + +# AccountNicSet command +CMD_AccountNicSet Set Virtual Network Adapter for VPN Connection Setting to Use +CMD_AccountNicSet_Help Use this to change the Virtual Network Adapter name that the existing VPN Connection Settings registered on the VPN Client will use for the connection to a VPN Server. +CMD_AccountNicSet_Args AccountNicSet [name] [/NICNAME:nicname] +CMD_AccountNicSet_[name] Specify the name of the VPN Connection Setting whose setting you want to change. +CMD_AccountNicSet_NICNAME Specify the Virtual Network Adapter name to use when connecting to the VPN Server. + + +# AccountStatusShow command +CMD_AccountStatusShow Set Connection Status and Error Screen to Display when Connecting to VPN Server +CMD_AccountStatusShow_Help When a communication setting is registered on the VPN Client and that communication setting is being used to connect to the VPN Server, use this to set the connection status and error screen to be displayed on the computer display. +CMD_AccountStatusShow_Args AccountStatusShow [name] +CMD_AccountStatusShow_[name] Specify the name of the VPN Connection Setting whose setting you want to change. + + +# AccountStatusHide command +CMD_AccountStatusHide Set Connection Status and Error Screen to be Hidden when Connecting to VPN Server +CMD_AccountStatusHide_Help When a communication setting is registered on the VPN Client and that communication setting is being used to connect to the VPN Server, use this to set the connection status and error screen to not be displayed on the computer display. +CMD_AccountStatusHide_Args AccountStatusHide [name] +CMD_AccountStatusHide_[name] Specify the name of the VPN Connection Setting whose setting you want to change. + + +# AccountSecureCertSet command +CMD_AccountSecureCertSet Set User Authentication Type of VPN Connection Setting to Smart Card Authentication +CMD_AccountSecureCertSet_Help Use this to set the user auth type to Smart Card Authentication for when a VPN Connection Setting registered on the VPN Client is specified and that VPN Connection Setting connects to the VPN Server. Also, you must specify the names of the certificate object and the private key object stored on the smart card. +CMD_AccountSecureCertSet_Args AccountSecureCertSet [name] [/CERTNAME:cert] [/KEYNAME:key] +CMD_AccountSecureCertSet_[name] Specify the name of the VPN Connection Setting whose setting you want to change. +CMD_AccountSecureCertSet_CERTNAME Specify the name of the certificate object stored on the smart card. +CMD_AccountSecureCertSet_KEYNAME Specify the name of the private key object stored on the smart card. The private key must be compatible with the certificate specified by /CERTNAME. +CMD_AccountSecureCertSet_PROMPT_CERTNAME Name of Certificate Object on Smart Card: +CMD_AccountSecureCertSet_PROMPT_KEYNAME Name of Private Key Object on Smart Card: + + +# PcAccountOpensslEngineCertSet +CMD_AccountOpensslCertSet_PROMPT_KEYNAME Specify the openssl engine specific key name: +CMD_AccountOpensslCertSet_PROMPT_ENGINENAME Specify the openssl engine name: + + +# AccountRetrySet コマンド +CMD_AccountRetrySet Set Interval between Connection Retries for Connection Failures or Disconnections of VPN Connection Setting +CMD_AccountRetrySet_Help When a VPN Connection Setting registered on the VPN Client is specified and that VPN Connection Setting attempts to connect to a VPN Server, use this to specify the interval to wait between connection attempts and the limit of how many times to retry connecting when communication with the VPN Server has been disconnected or when the connection process failed. \nIf the user authentication type is Smart Card Authentication, no connection retry will be performed regardless of the Number of Connection Attempts setting. +CMD_AccountRetrySet_Args AccountRetrySet [name] [/NUM:num_retry] [/INTERVAL:retry_interval] +CMD_AccountRetrySet_[name] Specify the name of the VPN Connection Setting whose setting you want to change. +CMD_AccountRetrySet_NUM Specify the number of times to make consecutive retries. By specifying "999", there will be limitless attempts to reconnection (always connect). By specifying "0", not attempt at reconnection will be made. +CMD_AccountRetrySet_INTERVAL When attempting a reconnection, this sets how many seconds to wait after the previous disconnection or connection failure before starting the reconnection process. +CMD_AccountRetrySet_PROMPT_NUM Reconnection Count ("999" is unlimited): +CMD_AccountRetrySet_PROMPT_INTERVAL Reconnection Interval (Seconds): +CMD_AccountRetrySet_EVAL_INTERVAL Specify 5 seconds or more for the retries interval. + + +# AccountStartupSet command +CMD_AccountStartupSet Set VPN Connection Setting as Startup Connection +CMD_AccountStartupSet_Help Use this to specify a VPN Connection Setting registered on the VPN Client and set it as the startup connection. The VPN Connection Setting that is set as the startup connection will automatically start the connection process when the VPN Client service starts. +CMD_AccountStartupSet_Args AccountStartupSet [name] +CMD_AccountStartupSet_[name] Specify the name of the VPN Connection Setting whose setting you want to change. + + +# AccountStartupRemove command +CMD_AccountStartupRemove Remove Startup Connection of VPN Connection Setting +CMD_AccountStartupRemove_Help When a VPN Connection Setting registered on the VPN Client is specified and that VPN Connection Setting is currently set as a startup connection, use this to delete the startup connection. +CMD_AccountStartupRemove_Args AccountStartupRemove [name] +CMD_AccountStartupRemove_[name] Specify the name of the VPN Connection Setting whose setting you want to change. + + +# AccountExport command +CMD_AccountExport Export VPN Connection Setting +CMD_AccountExport_Help Use this to specify a VPN Connection Setting registered on the VPN Client and export its contents as a text file. By exporting a VPN Connection Setting file, and then later, importing it, you can duplicate the contents of a VPN Connection Setting. Also, because it gets saved as a text file, you can edit the contents using a conventional text editor. \nThe export destination file is saved as a UTF-8 format text file. Also, it is convenient to save the file name with the file extension .vpn as this file extension is associated to the Windows Edition VPN Client Manager. +CMD_AccountExport_Args AccountExport [name] [/SAVEPATH:savepath] +CMD_AccountExport_[name] Specify the name of the VPN Connection Setting to export. +CMD_AccountExport_SAVEPATH Specify a file name for the save destination. +CMD_AccountExport_PROMPT_SAVEPATH Save Destination File Name (recommended extension: vpn): + + +# AccountImport command +CMD_AccountImport Import VPN Connection Setting +CMD_AccountImport_Help Use this to import the VPN Connection Setting file that has been exported by the AccountExport command and add it to the VPN Client. +CMD_AccountImport_Args AccountImport [path] +CMD_AccountImport_[path] Specify the file name of the import source. +CMD_AccountImport_PROMPT_PATH Import Source File Name: +CMD_AccountImport_FAILED_PARSE Unable to correctly parse the specified file. Please check it if the file was exported correctly. +CMD_AccountImport_OK The VPN Connection Setting "%s" has been imported. + + + +# RemoteEnable command +CMD_RemoteEnable Allow Remote Management of VPN Client Service +CMD_RemoteEnable_Help Use this to allow management of a VPN Client service from a remote computer that is not localhost, via a remote connection by Command Line Management Utility or VPN Client Manager. +CMD_RemoteEnable_Args RemoteEnable + + +# RemoteDisable command +CMD_RemoteDisable Deny Remote Management of VPN Client Service +CMD_RemoteDisable_Help Use this to deny management of a VPN Client service from a remote computer that is not localhost, via a remote connection by Command Line Management Utility or VPN Client Manager. +CMD_RemoteDisable_Args RemoteDisable + + + + + + +################################################### +# # +# Commands for VPN Tools are listed below # +# # +################################################### + + +# MakeCert command +CMD_MakeCert Create New X.509 Certificate and Private Key (1024 bit) +CMD_MakeCert_Help Use this to create a new X.509 certificate and private key and save it as a file. \nThe algorithm used to create the public key and private key of the certificate is RSA 1024 bit. \nYou can choose to create a root certificate (self-signed certificate) or a certificate signed by another certificate. To create a certificate that is signed by another certificate, you require a private key file (base 64 encoded) that is compatible with the certificate that uses the signature (X.509 format file). \n\nWhen creating a certificate, you can specify the following: Name (CN), Organization (O), Organization Unit (OU), Country (C), State (ST), Locale (L), Serial Number, and Expiration Date. \nThe created certificate will be saved as an X.509 format file and the private key file will be saved in a Base 64 encoded RSA 1024 bit format file. \n\nThe MakeCert command is a tool that provides the most rudimentary function for creating certificates. If you want to create a more substantial certificate, we recommend that you use either free software such as OpenSSL, or commercial CA (certificate authority) software. \n\nNote: This command can be called from the SoftEther VPN Command Line Management Utility. You can also execute this command while connected to the current VPN Server or VPN Client in Administration Mode but, what actually performs the RSA computation, generates the certificate data and saves it to file is the computer on which the command is running, and all this is executed in a context that has absolutely no relationship to the computer that is the destination of the Administration Mode connection. +CMD_MakeCert_Args MakeCert [/CN:cn] [/O:o] [/OU:ou] [/C:c] [/ST:st] [/L:l] [/SERIAL:serial] [/EXPIRES:expires] [/SIGNCERT:signcert] [/SIGNKEY:signkey] [/SAVECERT:savecert] [/SAVEKEY:savekey] +CMD_MakeCert_CN Specify the Name (CN) item of the certificate to create. You can specify "none". +CMD_MakeCert_O Specify the Organization (O) item of the certificate to create. You can specify "none". +CMD_MakeCert_OU Specify the Organization Unit (OU) item of the certificate to create. You can specify "none". +CMD_MakeCert_C Specify the Country (C) item of the certificate to create. You can specify "none". +CMD_MakeCert_ST Specify the State (ST) item of the certificate to create. You can specify "none". +CMD_MakeCert_L Specify the Locale (L) item of the certificate to create. You can specify "none". +CMD_MakeCert_SERIAL Specify the Serial Number item of the certificate to create. Specify using hexadecimal values. You can specify "none". +CMD_MakeCert_EXPIRES Specify the Expiration Date item of the certificate to create. If you specify "none" or "0", 3650 days (approx. 10 years) will be used. You can specify a maximum of 10950 days (about 30 years). +CMD_MakeCert_SIGNCERT For cases when the certificate to be created is signed by an existing certificate, specify the X.509 format certificate file name to be used to sign the signature. When this parameter is omitted, such signature signing is not performed and the new certificate is created as a root certificate. +CMD_MakeCert_SIGNKEY Specify a private key (RSA, base-64 encoded) that is compatible with the certificate specified by /SIGNCERT. +CMD_MakeCert_SAVECERT Specify the file name to save the certificate you created. The certificate is saved as an X.509 file that includes a public key that is RSA format 1024 bit. +CMD_MakeCert_SAVEKEY Specify the file name to save private key that is compatible with the certificate you created. The private key will be saved as an RSA-format 1024-bit private key file. +CMD_MakeCert_PROMPT_CN Name of Certificate to Create (CN): +CMD_MakeCert_PROMPT_O Organization of Certificate to Create (O): +CMD_MakeCert_PROMPT_OU Organization Unit of Certificate to Create (OU): +CMD_MakeCert_PROMPT_C Country of Certificate to Create (C): +CMD_MakeCert_PROMPT_ST State of Certificate to Create (ST): +CMD_MakeCert_PROMPT_L Locale of Certificate to Create (L): +CMD_MakeCert_PROMPT_SERIAL Serial Number of Certificate to Create (Hexadecimal): +CMD_MakeCert_PROMPT_EXPIRES Expiration Date of Certificate to Create (Days): +CMD_MakeCert_PROMPT_SAVECERT File Name to Save Certificate to Create: +CMD_MakeCert_PROMPT_SAVEKEY File Name to Save Private Key to Create: +CMD_MakeCert_EVAL_EXPIRES Specify the Expiration Date within the range %u to %u. +CMD_MakeCert_ERROR_SIGNKEY Either it is not possible to read the certificate or private key specified by /SIGNCERT and /SIGNKEY, or they were an invalid combination. +CMD_MakeCert_ERROR_GEN_FAILED Creation of certificate and private key failed. + + +# MakeCert2048 command +CMD_MakeCert2048 Create New X.509 Certificate and Private Key (2048 bit) +CMD_MakeCert2048_Help Use this to create a new X.509 certificate and private key and save it as a file. \nThe algorithm used to create the public key and private key of the certificate is RSA 2048 bit. \nYou can choose to create a root certificate (self-signed certificate) or a certificate signed by another certificate. To create a certificate that is signed by another certificate, you require a private key file (base 64 encoded) that is compatible with the certificate that uses the signature (X.509 format file). \n\nWhen creating a certificate, you can specify the following: Name (CN), Organization (O), Organization Unit (OU), Country (C), State (ST), Locale (L), Serial Number, and Expiration Date. \nThe created certificate will be saved as an X.509 format file and the private key file will be saved in a Base 64 encoded RSA 2048 bit format file. \n\nThe MakeCert command is a tool that provides the most rudimentary function for creating certificates. If you want to create a more substantial certificate, we recommend that you use either free software such as OpenSSL, or commercial CA (certificate authority) software. \n\nNote: This command can be called from the SoftEther VPN Command Line Management Utility. You can also execute this command while connected to the current VPN Server or VPN Client in Administration Mode but, what actually performs the RSA computation, generates the certificate data and saves it to file is the computer on which the command is running, and all this is executed in a context that has absolutely no relationship to the computer that is the destination of the Administration Mode connection. +CMD_MakeCert2048_Args MakeCert2048 [/CN:cn] [/O:o] [/OU:ou] [/C:c] [/ST:st] [/L:l] [/SERIAL:serial] [/EXPIRES:expires] [/SIGNCERT:signcert] [/SIGNKEY:signkey] [/SAVECERT:savecert] [/SAVEKEY:savekey] +CMD_MakeCert2048_CN Specify the Name (CN) item of the certificate to create. You can specify "none". +CMD_MakeCert2048_O Specify the Organization (O) item of the certificate to create. You can specify "none". +CMD_MakeCert2048_OU Specify the Organization Unit (OU) item of the certificate to create. You can specify "none". +CMD_MakeCert2048_C Specify the Country (C) item of the certificate to create. You can specify "none". +CMD_MakeCert2048_ST Specify the State (ST) item of the certificate to create. You can specify "none". +CMD_MakeCert2048_L Specify the Locale (L) item of the certificate to create. You can specify "none". +CMD_MakeCert2048_SERIAL Specify the Serial Number item of the certificate to create. Specify using hexadecimal values. You can specify "none". +CMD_MakeCert2048_EXPIRES Specify the Expiration Date item of the certificate to create. If you specify "none" or "0", 3650 days (approx. 10 years) will be used. You can specify a maximum of 10950 days (about 30 years). +CMD_MakeCert2048_SIGNCERT For cases when the certificate to be created is signed by an existing certificate, specify the X.509 format certificate file name to be used to sign the signature. When this parameter is omitted, such signature signing is not performed and the new certificate is created as a root certificate. +CMD_MakeCert2048_SIGNKEY Specify a private key (RSA, base-64 encoded) that is compatible with the certificate specified by /SIGNCERT. +CMD_MakeCert2048_SAVECERT Specify the file name to save the certificate you created. The certificate is saved as an X.509 file that includes a public key that is RSA format 2048 bit. +CMD_MakeCert2048_SAVEKEY Specify the file name to save private key that is compatible with the certificate you created. The private key will be saved as an RSA-format 2048-bit private key file. + + +# TrafficClient command +CMD_TrafficClient Run Network Traffic Speed Test Tool in Client Mode +CMD_TrafficClient_Help Use this to execute the communication throughput measurement tool's client program. \nTwo commands, TrafficClient and TrafficServer, are used for the communication throughput measurement tool to enable the measurement of communication throughput that can be transferred between two computers connected by IP network. The TrafficServer command is used first on another computer which puts the communication throughput measurement tool server in a listening condition. Then the TrafficClient command is used to connect to that server by specifying its host name or IP address and port number, which makes it possible to measure the communication speed. \nMeasurement of the communication speed is carried out by concurrently establishing multiple TCP connections and calculating the actual number of bits of data that can be transferred within a specified time based on the respective results of transferring the maximum stream data on each connection and then using that to calculate the average value (bps) of communication throughput. Normally when there is one TCP connection, it is common to only be able to achieve communication speeds slower than the actual net throughput because of limitations related to the TCP algorithm. We therefore recommend the establishment of multiple concurrent TCP connections when measuring communication results. Because the throughput that is measured using this measurement method is calculated from the bit length of the data that arrives on the receiver side as a stream by TCP, the packet loss that occurs during transfer and the packets with corrupted data are not included in the packets that actually arrive, which means it is possible to calculate a genuine value that is close to the maximum possible communication bandwidth of the network. \nUsing the measurement results, i.e. the stream size transferred by TCP, the approximate value of data volume that actually passed through the network is calculated and this is divided by time to calculate the bits per sec (bps). The calculation assumes the type of the physical network is Ethernet (IEEE802.3) and the MAC frame payload size is 1,500 bytes (TCP MSS is 1,460 bytes). By specifying the /RAW option, the calculation will not make corrections for the TCP/IP header and MAC header data volume. \n\nNote: This command can be called from the SoftEther VPN Command Line Management Utility. You can also execute this command while connected to the current VPN Server or VPN Client in Administration Mode but, what actually conducts communication and measures the throughput is the computer on which the command is running, and all this is executed in a context that has absolutely no relationship to the computer that is the destination of the Administration Mode connection. +CMD_TrafficClient_Args TrafficClient [host:port] [/NUMTCP:numtcp] [/TYPE:download|upload|full] [/SPAN:span] [/DOUBLE:yes|no] [/RAW:yes|no] +CMD_TrafficClient_[host:port] Specify the host name or IP address and port number that the communication throughput measurement tool server (TrafficServer) is listening for. If the port number is omitted, 9821 will be used. +CMD_TrafficClient_NUMTCP Specify the number of TCP connections to be concurrently established between the client and the server for data transfer. If omitted, 32 will be used. +CMD_TrafficClient_TYPE Specify the direction of data flow when throughput measurement is performed. Specify one of the following options: "download", "upload" or "full". By specifying "download" the data will be transmitted from the server side to the client side. By specifying "upload" the data will be transmitted from the client side to the server side. By specifying "full", the data will be transferred in both directions. When "full" is specified, the NUMTCP value must be an even number of two or more (half the number will be used for concurrent TCP connections in the download direction and the other half will be used in the upload direction). If this parameter is omitted, "full" will be used. +CMD_TrafficClient_SPAN Specify, using seconds, the time span to conduct data transfer for the measurement of throughput. If this parameter is omitted, "15" will be used. +CMD_TrafficClient_DOUBLE When "yes" is specified, the throughput of the measured result will be doubled and then displayed. This option is used for cases when a network device etc. is somewhere on the data route and the total throughput capability that is input and output by this network device is being measured. +CMD_TrafficClient_RAW By specifying "yes", the calculation will not make corrections for the TCP/IP header and MAC header data volume. +CMD_TrafficClient_EVAL_NUMTCP Specify a value of 32 or less for the number of TCP connections. +CMD_TrafficClient_PROMPT_HOST Measurement Server Name and Port Number (9821 if omitted): +CMD_TrafficClient_ERROR_NUMTCP When the data direction is "full" (both directions), you must specify an even value for the number of TCP connections (/NUMTCP). +CMD_TrafficClient_ERROR_HOSTPORT The host name or port number is incorrectly specified. + + +# TrafficServer command +CMD_TrafficServer Run Network Traffic Speed Test Tool in Server Mode +CMD_TrafficServer_Help Use this to execute the communication throughput measurement tool's server program. \nTwo commands, TrafficClient and TrafficServer, are used for the communication throughput measurement tool to enable the measurement of communication throughput that can be transferred between two computers connected by IP network. \nTo set the TCP port of this computer to the Listen status to listen for the connection from the TrafficClient of another computer, specify the port number and start the server program using the TrafficServer command. \nYou can display more detailed information on the communication throughput measurement tool by inputting "TrafficClient ?". \n\nNote: This command can be called from the SoftEther VPN Command Line Management Utility. You can also execute this command while connected to the current VPN Server or VPN Client in Administration Mode but, what actually conducts communication and measures the throughput is the computer on which the command is running, and all this is executed in a context that has absolutely no relationship to the computer that is the destination of the Administration Mode connection. +CMD_TrafficServer_Args TrafficServer [port] [/NOHUP:yes|no] +CMD_TrafficServer_[port] Specify, using an integer, the port number at which to listen for the connection. If the specified port has been already being used by another program, or if the port cannot be opened, an error will occur. +CMD_TrafficServer_NOHUP When "yes" is specified, the server process never stops without regard to any input from the console. It is convenient when you want to run the TrafficServer endlessly. + + + +# Internal message strings concerning TrafficClient / TrafficServer +TT_LISTEN_FAILED Unable to set TCP port %u to Listen status. The port may be being used by another application or this application did not have the authority to open the port. +TTS_LISTEN_STOP The port for listening has been closed. +TTS_ENTER_TO_EXIT \n----------------------------------------\nThe Network Traffic Speed Test Tool in Server Mode started. \n\nPress the Enter key to stop the server program. \n----------------------------------------\n\n +TTS_INIT Starting the server program... +TTS_LISTEN_STARTED The server program has been started. Now the IPv4 TCP port %u is set to Listen status and listening for connection from the client. +TTS_LISTEN_STARTED_V6 The IPv6 TCP Port %u is listening to accept clients. +TTS_LISTEN_FAILED_V6 Failed to open the IPv6 TCP Port %u. Another application might be using the same IPv6 TCP Port, or the IPv6 stack is not installed on the operating system. +TTS_STOP_INIT Stopping the server program... +TTS_STOP_FINISHED The stopping of the server program is complete. +TTS_ACCEPTED Connection %u: Connected from Client %S Port %u. +TTS_DISCONNECTED Connection %u (%S) has been disconnected. +TTS_DISCONNECT Connection %u (%S) has been disconnected. +TTC_INIT Starting the client program... +TTC_FREE The client program has beens terminated. +TTC_CONNECT_START The connection to server %S (port %u) will start. %u TCP connections will be connected. +TTC_CONNECT_FAILED The connection of TCP connection number %u failed. +TTC_CONNECT_NOT_SERVER Because a program other than TrafficServer is operating on the destination TCP port, traffic cannot be measured. +TTC_CONNECT_OK TCP connection number %u has been connected. +TTC_CONNECT_OK_2 \ Data transfer direction: %s +TTC_ERROR_ABORTED The TCP connection initialization with the server failed. Measurement will stop. +TTC_SUMMARY_BAR ------------------------------------------------------- +TTC_SUMMARY_TITLE Network Traffic Speed Test Tool Client Setting Parameters +TTC_SUMMARY_HOST Destination Host Name +TTC_SUMMARY_PORT Destination TCP Port Number +TTC_SUMMARY_NUMTCP Number of TCP Connections to Establish +TTC_SUMMARY_TYPE Data Transfer Direction +TTC_SUMMARY_SPAN Data Transmission Time +TTC_SUMMARY_ETHER Data Correction for Ethernet Frames +TTC_SUMMARY_DOUBLE Measurement of Total Speed of Relay Device Input Output +TTC_TYPE_DOWNLOAD Download (Server to Client) +TTC_TYPE_UPLOAD Upload (Client to Server) +TTC_TYPE_FULL Full (Server < -- > Client) +TTC_SPAN_STR %.1f seconds +TTC_COMM_START \nAll connections were established and so data transfer started. \nMeasurement Start Time: %s\nScheduled Finish Time: %s\n\nMeasuring in progress. Please wait... \n(Do not use any other applications while measuring is in progress.)\n\n +TTC_COMM_END Because %.1f seconds or more have passed, the data communication will end. \n\n +TTC_COMM_USER_CANCEL Because of cancellation by user, the data communication will end. \n\n +TTC_COMM_DISCONNECTED The TCP connection %u has been disconnected. +TTC_STOPPING Stopping the operation of the communication throughput measurement tool client... +TTC_ENTER_TO_EXIT \n----------------------------------------\nThe Network Traffic Speed Test Tool in Client Mode started. \n\nPress the Enter key to stop the client program. \n----------------------------------------\n\n +TTC_RES_TITLE \n\nNetwork Traffic Speed Test Tool\n\n +TTC_RES_COLUMN_1 Item Name +TTC_RES_COLUMN_2 Normal View +TTC_RES_COLUMN_3 Simplified View +TTC_RES_SPAN Time Span for Measurement +TTC_RES_ETHER Data Correction for Ethernet Frames +TTC_RES_BYTES_DOWNLOAD Communication Data Volume in Download Direction +TTC_RES_BYTES_UPLOAD Communication Data Volume in Upload Direction +TTC_RES_BYTES_TOTAL Total Communication Data Volume +TTC_RES_DOUBLE Relay Device Input Output Total Throughput Computation +TTC_RES_BPS_DOWNLOAD Average Throughput in Download Direction +TTC_RES_BPS_UPLOAD Average Throughput in Upload Direction +TTC_RES_BPS_TOTAL Total Average Throughput + + +# Check command +CMD_Check Check whether SoftEther VPN Operation is Possible +CMD_Check_Help Use this to check if the current computer that is running vpncmd is a suitable operation platform for SoftEther VPN Server / Bridge. \nIf this check passes on a system, it is most likely that SoftEther VPN software will operate correctly on that system. \nAlso, if this check does not pass on a system, then this indicates that some type of trouble may arise if SoftEther VPN software is used on that system. +CMD_Check_Args Check + + +# Concerning System Checker +# (This contains some strange character strings which are used to check character code conversion.) +CHECK_TITLE ---------------------------------------------------\nSoftEther VPN Operation Environment Check Tool\nDeveloper Edition\n\nCopyright (c) SoftEther VPN Project.\nAll Rights Reserved.\n\n +CHECK_NOTE If this operation environment check tool is run on a system and that system passes, it is most likely that SoftEther VPN software can operate on that system. This check may take a while. Please wait...\n\n +CHECK_EXEC_TAG Checking '%s'... \n +CHECK_PASS Pass +CHECK_FAIL Fail +CHECK_RESULT_1 All checks passed. It is most likely that SoftEther VPN Server / Bridge can operate normally on this system. +CHECK_RESULT_2 Some checks failed. Please check the operation environment of this system. If SoftEther VPN Server / Bridge were to be executed on this system, troubles may occur. +CHECK_TEST_123456789 123456789 + + +CHECK_PROC_KERNEL Kernel System +CHECK_PROC_MEMORY Memory Operation System +CHECK_PROC_STRINGS ANSI / Unicode string processing system +CHECK_PROC_FILESYSTEM File system +CHECK_PROC_THREAD Thread processing system +CHECK_PROC_NETWORK Network system + + + + + + + + +###################################################### +# # +# Setup Wizard (SW) Strings # +# # +###################################################### + +SW_TITLE SoftEther VPN Developer Edition Setup Wizard (Version %S) +SW_EXIT_CONFIRM The setup process of SoftEther VPN hasn't been finished yet.\r\n\r\nDo you want to exit the setup? +SW_UNINSTALL_CONFIRM Starting the uninstall process of %s.\r\n\r\nDo you want to continue? + + +SW_COMPONENT_VPNSERVER_TITLE SoftEther VPN Server +SW_COMPONENT_VPNSERVER_DESCRIPTION Install it on a server computer at the central site of VPN. The management tools will be also installed. + +SW_COMPONENT_VPNCLIENT_TITLE SoftEther VPN Client +SW_COMPONENT_VPNCLIENT_DESCRIPTION Install it on VPN client computers. A VPN client computer will be able to connect to the central VPN Server. The management tools will be also installed. + +SW_COMPONENT_VPNBRIDGE_TITLE SoftEther VPN Bridge +SW_COMPONENT_VPNBRIDGE_DESCRIPTION Install it on computers at each site. Each VPN Bridge will establish a VPN connection to the central VPN Server. The management tools will be also installed. + +SW_COMPONENT_VPNSMGR_TITLE SoftEther VPN Server Manager (Admin Tools Only) +SW_COMPONENT_VPNSMGR_DESCRIPTION Only the VPN Server Manager will be installed. The VPN Server service program will not be installed. You can use the VPN Server Manager to connect and manage remote VPN Servers and VPN Bridges on other computers which can be run on Windows, Linux, Mac OS X, Solaris and FreeBSD. + +SW_COMPONENT_VPNCMGR_TITLE SoftEther VPN Client Manager (Admin Tools Only) +SW_COMPONENT_VPNCMGR_DESCRIPTION Only the VPN Client Manager will be installed. The VPN Client service program will not be installed. You can use the VPN Client Manager to connect and manage remote VPN Clients on other computers which can be run on Windows and Linux. + +SW_WELCOME_TITLE Welcome to the SoftEther VPN Developer Edition Setup Wizard +SW_MODE_TITLE Select a Setup Mode +SW_NOT_ADMIN_TITLE Not Enough Privileges +SW_COMPONENTS_TITLE Select Software Components to Install +SW_EULA_TITLE End User License Agreement +SW_WARNING_TITLE Important Notices +SW_DIR_TITLE Directory to Install on +SW_READY_TITLE Ready to Install +SW_PERFORM_TITLE Setup is in Progress +SW_ERROR_TITLE Results of Setup +SW_FINISH_TITLE Setup Finished +SW_UNINST1_TITLE Uninstaller +SW_LANG1_TITLE SoftEther VPN: Configure the Display Language +SW_EASY1_TITLE Welcome to SoftEther VPN Client Easy Installer Creator +SW_EASY2_TITLE Specify Files +SW_WEB1_TITLE Welcome to SoftEther VPN Client Web Installer Creator +SW_WEB2_TITLE Specify Files + +SW_UNINSTALLINFO_URL http://selinks.org/ +SW_UNINSTALLINFO_PUBLISHER SoftEther VPN Project + +SW_KB3033929_REQUIRED In Windows 7 and Windows Server 2008 R2, some SoftEther VPN functions require the Microsoft's Windows Update module KB3033929 installed.\r\n\r\nIf KB3033929 is not installed in your Windows, please install it from Windows Update or Microsoft website before installing SoftEther VPN. + + +SW_COMPONENTS_ABOUT_TAG About %s +SW_COMPONENTS_REQUIRE_ADMIN Installation Requires Administrators Privileges +SW_COMPONENTS_REQUIRE_ADMIN_TEXT You have to restart the setup wizard by a user who has Administrators privileges to install %s in the System Mode. To install in the System Mode, click Back. +SW_DIR_SELECT Please Specify the Directory to Install +SW_DIR_MORE_THAN_110 The directory name is too long.\r\nSpecify 110 letters at most. +SW_DIR_WRITE_ERROR Unable to create the specified directory "%s" or failed to write a file on the directory.\r\n\r\nSpecify another directory. +SW_DIR_DST_IS_SAME_TO_SRC The specified directory "%s" is same as the source directory. +SW_DIR_IS_NOT_HDD The specified directory "%s" is not a local hard disk drive.\r\n\r\nTo install %s in the System Mode, you have to specify a directory on a local hard disk drive. +SW_DIR_IS_NOT_FULLPATH The directory "%s" is not a format of full path.\r\n\r\nPlease specify the full path of the directory. +SW_DIR_DST_IS_OTHER_PRODUCT The specified directory has another component already installed.\r\n\r\nPlease specify another directory. +SW_DIR_DST_IS_NEWER Newer version of the software has been installed on the specified directory.\r\n\r\nYou need not to install this version. +SW_DIR_DST_IS_NEWER_2 Newer version of the software has been installed on the specified directory.\r\n\r\nThis installer will import and apply the VPN Connection Settings which is built-in on the Easy Installer. No program files will be overwritten. +SW_DIR_DST_IS_BROKEN Unable to read a file "%s" which is on the specified directory.\r\n\r\nPlease specify another directory. +SW_DIR_DST_IS_SYSTEM_MODE The same software is already installed on the specified directory as the System Mode.\r\n\r\nPlease specify another directory. +SW_DIR_DST_IS_USER_MODE The same software is already installed on the specified directory as the User Mode.\r\n\r\nPlease specify another directory. +SW_SYSTEM_MODE_ALREADY_INSTALLED The software "%s" is already installed on this computer as the System Mode.\r\n\r\nBoth the System Mode and the User Mode installation of the same software on the same computer will conflict.\r\n\r\nDo you really want to continue the installation as the User Mode? + +SW_SETUPLOG_CORRUPTED The "setuplog.dat" file is broken. +SW_MSI_UNINSTALL_FAILED The older version of %s (Product Code: "%S") is installed. Windows Installer failed to uninstall this older version.\r\n\r\nPlease uninstall this older version manually and restart this installer again. +SW_MSI_UNINSTALL_REBOOT_REQUIRED Windows Installer has uninstalled the older version of %s. The reboot of computer is required.\r\n\r\nPress Finish button and reboot the computer MANUALLY, and restart this installer after the reboot. +SW_NOTICE_VPNSERVER_IS_INSTALLED SoftEther VPN Bridge is selected as a component to install. However, this computer has already had SoftEther VPN Server installed.\r\n\r\nUsually, you don't need to install both SoftEther VPN Server and SoftEther VPN Bridge on the same computer.\r\nIf you install both software, conflicts such as port number duplication will occur.\r\nIf you want to replace the SoftEther VPN Server to SoftEther VPN Bridge, you should exit this installer, uninstall SoftEther VPN Server and restart this installer after that.\r\n\r\nDo you really want to continue the SoftEther VPN Bridge installation? +SW_NOTICE_VPNBRIDGE_IS_INSTALLED SoftEther VPN Server is selected as a component to install. However, this computer has already had SoftEther VPN Bridge installed.\r\n\r\nUsually, you don't need to install both SoftEther VPN Bridge and SoftEther VPN Server on the same computer.\r\nIf you install both software, conflicts such as port number duplication will occur.\r\nIf you want to replace the SoftEther VPN Server to SoftEther VPN Server, you should exit this installer, uninstall SoftEther VPN Bridge and restart this installer after that.\r\n\r\nDo you really want to continue the SoftEther VPN Server installation? +SW_OS_FAILED This operating system doesn't support %s. +SW_LANG_NOT_CHANGED The language settings of %s were not changed. +SW_LANG_LIST_LOAD_FAILED Loading the available language list failed. +SW_LANG_OK The display language of %s has been changed successfully.\r\nIf %s programs are currently running, exit a program and restart it to apply the new display language. If the display language still doesn't effect, reboot Windows.\r\n +SW_LANG_OK_SERVICE \r\nThe language of log files which the service program records will be changed to the new language after a reboot. +SW_LANG_OK_VPNCMGR \r\nThe display setting of VPN Client Manager will be changed after exit and reboot VPN Client Manager. (Including complete termination from the task tray.) +SW_CHILD_PROCESS_ERROR Failed to execute a child process. +SW_EXE_FILTER Windows Executable Files (*.EXE)|*.exe|All Files (*.*)|*.* +SW_PERFORM_MSG_EASY_INFO Compiling the VPN Client Easy Installer... +SW_EASY_FINISHED_MSG The VPN Client Easy Installer is created successfully.\r\nThe installer is saved as the following filename.\r\n\r\n%s\r\n\r\nYou can distribute the above file in the enterprise. +SW_EASY_ERROR_MSG Failed to create a VPN Client Easy Installer. +SW_OTHER_INSTANCE_EXISTS Another SoftEther VPN Setup Wizard is running.\r\n\r\nYou can continue this wizard after another wizard exits. +SW_PERFORM_MSG_WEB_INFO Compiling the VPN Client Web Installer... +SW_WEB_ERROR_MSG Failed to create a VPN Client Web Installer. +SW_INSTALLER_CACHE_IS_NOT_SIGNED The currently installed SoftEther VPN Client of this computer has not been installed from the digital-signed package signed by an Authenticode digital certificate of SoftEther VPN Project.\r\nIt might be installed from a customized installer (for example, an installer created by Easy Installer Creator.)\r\n\r\nIf you continue to create a Web Installer, a warning message will be appeared on the user's screen when its loading.\r\nTo avoid showing the warning message, you should cancel this creating wizard, download the latest version of SoftEther VPN Client from the SoftEther VPN Project's web site, re-install it and restart the Web Installer Creator wizard.\r\n\r\nDo you really to continue to create a Web Installer? +SW_FILE_NOT_FOUNT The file "%s" not found. +SW_WEB_FINISHED The Web Installer is created and saved as "%s".\r\n\r\nPlease extract inner files from the ZIP file, upload them into the Web server, and edit a HTML file and an inf file to replace URLs appropriately.\r\n\r\nThe explanation to deploy the Web Installer is described on the ZIP file. + +SW_VG_CONFIRM_MSG Do you really want to install and activate the VPN Gate P2P Relay Function plug-in module with SoftEther VPN Client?\r\n\r\nThis plug-in will realize the stability of communication to bypass the government censorship firewall. However, the communication of VPN Gate usually consumes some network bandwidth. VPN Gate is not recommended to be used in the mobile connections. \r\n\r\nPlease note that there are some countries and regions which have the regulation to forbid the encrypted communications to bypass government censorship firewalls. In such a case, you must not use the VPN Gate functions on your computer. VPN Gate is intended to be used mainly in Japan. VPN Gate is a research project for just academic purpose only. VPN Gate is governed under the Japanese laws. Other countries' laws are none of our concerns nor responsibilities. By using this software and service, you must observe all concerned laws and rules with your own responsibility. You will be completely liable to any damages and responsibilities which are results of using this software and service, regardless of either inside or outside of Japan's territory. + + + + +SW_PERFORM_MSG_INIT_TASKS Preparing the tasks... +SW_PERFORM_MSG_COPY_PREPARE Preparing the copying of files... +SW_PERFORM_MSG_WRITE_ERROR Failed to write the destination file "%s".\r\n\r\nThere might be another person who has been keeping this file open.\r\nIf programs or services of %s are running, please terminate them and click Retry. +SW_PERFORM_MSG_COPY_FILE Copying "%s" ... +SW_PERFORM_MSG_SET_SECURITY Setting a security on "%s" ... +SW_PERFORM_MSG_PLUGIN Installing the plugins... +SW_PERFORM_MSG_STOP_SVC Stopping the "%s" service ... +SW_PERFORM_MSG_WAIT_FOR_FILE_UNLOCK The file "%s" is locked by a running program. Waiting to unlock... +SW_PERFORM_MSG_INSTALL_SVC Installing the %s service... +SW_PERFORM_MSG_START_SVC Starting the %s service... +SW_PERFORM_MSG_CREATE_LINKS Creating shortcut files... +SW_PERFORM_MSG_DELETE_LINKS Deleting shortcut files... +SW_PERFORM_MSG_DELETE_OLD_LINKS Deleting old shortcut files... +SW_PERFORM_MSG_REGISTER_UNINSTALL Registering uninstall information on the Control Panel... +SW_PERFORM_MSG_IMPORTING_ACCOUNT Importing the Built-in VPN Connection Setting in the Easy Installer... +SW_PERFORM_MSG_DELETE_SETUP_INFO Deleting the install information and logs... +SW_PERFORM_MSG_WRITE_LOG Writing a setup log... +SW_PERFORM_MSG_COPY_ERROR Copying to the file "%s" failed. +SW_PERFORM_MSG_CREATE_LINK_ERROR Creating the shortcut file "%s" failed.\r\n\r\nDo you want to retry? +SW_PERFORM_MSG_WRITE_LOG_ERROR Creating the setup log file "%s".\r\n\r\nDo you want to retry? +SW_PERFORM_MSG_STOP_SVC_ERROR Stopping the "%s" service (internal name: "%S") failed. +SW_PERFORM_MSG_START_SVC_ERROR Starting the "%s" service (internal name: "%S") failed. +SW_PERFORM_MSG_SVC_UNINSTALL_FAILED Uninstall of the "%s" service (internal name: "%S") failed. +SW_PERFORM_MSG_SVC_INSTALL_FAILED Install of the "%s" service (internal name: "%S") failed. +SW_PERFORM_MSG_SVC_USERMODE_EXEC_FAILED Starting the user-mode service "%s" failed. +SW_PERFORM_MSG_UPDATING Updating system settings... +SW_PERFORM_MSG_DELETE_NIC Removing the Virtual Network Adapters... +SW_PERFORM_MSG_FINISHED Setup progress finished. +SW_PERFORM_MSG_UNINSTALL_MSI Windows Installer is uninstalling the older version of %s... +SW_PERFORM_MSG_UPDATE_LANG_CONFIG Changing the language settings... + +SW_PERFORM_MSG_INIT_UNINST Preparing uninstall... +SW_PERFORM_MSG_DELETE_PREPARE Preparing to delete files... +SW_PERFORM_MSG_DELETE_ERROR Unable to delete the file "%s".\r\n\r\nThere might be another program who is keeping this file open.\r\nIf programs or services of %s are running, please terminate them and click Retry. +SW_PERFORM_MSG_UNINSTALL_SVC Uninstalling the "%s" service ... +SW_PERFORM_MSG_DELETE Deleting the "%s" service ... +SW_PERFORM_MSG_EASY_INIT Building the Easy Installer... +SW_PERFORM_MSG_WEB_INIT Building the Web Installer... +SW_PERFORM_MSG_INSTALL_SELOW Creating a restore point of the system and installing essential components. It may take a while... + + +SW_TAG_USERNAME \ (User-mode) +SW_DIRNAME_CONFIG_TOOLS Configuration Tools +SW_DIRNAME_ADMIN_TOOLS Administrative Tools +SW_DIRNAME_LANGUAGE_TOOLS Language Settings + +SW_RUN_TEXT_VPNSMGR Start the SoftEther VPN Server Manager. +SW_RUN_TEXT_VPNCMGR Start the SoftEther VPN Client Manager. + +SW_NIC_UNINSTALL Virtual Network Adapters of SoftEther VPN Client have been created on the system.\r\nDo you want to delete these Virtual Network Adapters? + +# Do not translate this section !!! +SW_TAG_USERNAME_ENGLISH \ (User-Mode) +SW_LINK_NAME_VPNSERVER_SVC SoftEther VPN Server Developer User-mode Service +SW_LINK_NAME_VPNBRIDGE_SVC SoftEther VPN Bridge Developer User-mode Service +SW_LONG_VPNSERVER SoftEther VPN Server Developer Edition +SW_LONG_VPNCLIENT SoftEther VPN Client Developer Edition +SW_LONG_VPNBRIDGE SoftEther VPN Bridge Developer Edition +SW_LONG_VPNSMGR SoftEther VPN Server Manager Developer Edition +SW_LONG_VPNCMGR SoftEther VPN Client Manager Developer Edition +SW_LANG_SET_FAILED Failed to write the new language setting on lang.config file. +# --- end of "Do not translate this section" --- + + +# Shortcuts Filenames +SW_LINK_NAME_VPNSMGR_SHORT SoftEther VPN Server Manager (Dev) +SW_LINK_NAME_VPNSMGR_SHORT_UM SE-VPN Server Manager (Dev User) +SW_LINK_NAME_VPNSMGR_SHORT_TOOLSONLY SE-VPN Server Manager (Dev Tools) +SW_LINK_NAME_VPNSMGR_SHORT_TOOLSONLY_UM SE-VPN Server Manager (Dev Tools User) +SW_LINK_NAME_VPNSMGR_FULL SoftEther VPN Server Manager Developer Edition +SW_LINK_NAME_VPNSMGR_COMMENT You can manage SoftEther VPN Server or SoftEther VPN Bridge on a remote computer. + +SW_LINK_NAME_VPNCMGR_SHORT SoftEther VPN Client Manager (Dev) +SW_LINK_NAME_VPNCMGR_FULL SoftEther VPN Client Manager Developer Edition +SW_LINK_NAME_VPNCMGR_COMMENT You can connect to a VPN Server by using SoftEther VPN Client. + +SW_LINK_NAME_VPNCMGRTOOLS_SHORT SoftEther VPN Client Remote Manager (Dev) +SW_LINK_NAME_VPNCMGRTOOLS_SHORT_UM SE-VPN Client Remote Manager (Dev User) +SW_LINK_NAME_VPNCMGRTOOLS_FULL SoftEther VPN Client Remote Manager Developer Edition + +SW_LINK_NAME_VPNCMGR2_FULL Manage Remote Computer's SoftEther VPN Client +SW_LINK_NAME_VPNCMGR2_COMMENT You can establish a remote connection to and manage a SoftEther VPN Client on a remote computer. + +SW_LINK_NAME_VPNCMGRTRAY_FULL SoftEther VPN Client Manager Developer Edition Startup +SW_LINK_NAME_VPNCMGRTRAY_COMMENT Registers an icon of SoftEther VPN Client Developer Edition on the taskbar's notification area. + +SW_LINK_NAME_EASYINSTALLER Easy Installer Creator +SW_LINK_NAME_EASYINSTALLER_COMMENT A tool for enterprise system administrators to create a SoftEther VPN Client Easy Installer which has a function to kick-start a VPN connection to the specific destination automatically. + +SW_LINK_NAME_WEBINSTALLER Web Installer Creator +SW_LINK_NAME_WEBINSTALLER_COMMENT A tool for enterprise system administrators to create a SoftEther VPN Client Web Installer (ActiveX Installer) which has a function to kick-start a VPN connection to the specific destination automatically. + + +SW_LINK_NAME_VPNCMD SoftEther VPN Command Line Utility (vpncmd) +SW_LINK_NAME_VPNCMD_COMMENT Manage SoftEther VPN Server, SoftEther VPN Bridge and SoftEther VPN Client on the command-line interface in vpncmd. +SW_LINK_NAME_TRAFFIC Network Traffic Speed Test Tool +SW_LINK_NAME_TRAFFIC_COMMENT Performs transmitting packets between two computers connected with TCP/IP, with large amount of throughput as possible, in order to measure the actual network traffic speed available. +SW_LINK_NAME_TCP TCP Optimization Utility +SW_LINK_NAME_TCP_COMMENT TCP Optimization Utility can adjust the parameters of TCP/IP of Windows in order to increase the network communication throughput of this computer. +SW_LINK_NAME_SERVICES Services Running on this Computer +SW_LINK_NAME_SERVICES_COMMENT Starts, stops, and configures Windows services. You can start and stop SoftEther VPN services. +SW_LINK_NAME_VPNSERVER_SVC_COMMENT Starts SoftEther VPN Server Service in the User Mode. +SW_LINK_NAME_VPNBRIDGE_SVC_COMMENT Starts SoftEther VPN Bridge Service in the User Mode. + +SW_LINK_NAME_UNINSTALL Uninstall %s +SW_LINK_NAME_UNINSTALL_COMMENT Uninstall %s on this computer. + +SW_LINK_NAME_LANGUAGE Configure Display Language +SW_LINK_NAME_LANGUAGE_COMMENT Change the display language setting of %s. + +SW_LINK_NAME_DEBUG Debugging Information Collecting Tool +SW_LINK_NAME_DEBUG_COMMENT Collects debugging information of SoftEther VPN. Use this tool only if your support staff asks you to do so. diff --git a/src/bin/hamcore/strtable_ja.stb b/src/bin/hamcore/strtable_ja.stb index dca65fe9..65384ec4 100644 --- a/src/bin/hamcore/strtable_ja.stb +++ b/src/bin/hamcore/strtable_ja.stb @@ -1,7306 +1,7306 @@ -# SoftEther VPN String Table -# Copyright (c) all contributors on SoftEther VPN project in GitHub. -# Copyright (c) Daiyuu Nobori, SoftEther Project at University of Tsukuba, and SoftEther Corporation. -# -# https://www.softether.org/ - - -########################################################################### -# # -# ソフトウェア内のメッセージ等の文字列データ # -# (ダイアログボックスリソース文字列は除く) # -# # -########################################################################### - - - -# 環境パラメータ -DEFAULT_FONT MS UI Gothic -DEFAULT_FONT_HIGHDPI Meiryo UI -DEFAULT_FONT_2 MS Gothic -DEFAULT_FONT_SIZE 9 -DEFAULT_LOCALE 年 月 日 時 分 秒 日 月 火 水 木 金 土 日 時間 分 秒 (なし) - - -# 言語 -# (0: 日本語, 1: 英語) -LANG 0 -LANGSTR Japanese - - -# 文字列テーブル識別子 -STRTABLE_ID SE_VPN_20121007 - - -# 日本語版のみの文字列 (他の言語では不要) -CM_JAPANESE_ONLY_OLD_STARTUP %s\\SoftEther VPN Client 2.0 タスクトレイ.lnk - -# ソフトウェア情報 -PRODUCT_NAME_VPN_CLI SoftEther VPN Client Developer Edition -PRODUCT_NAME_VPN_CMGR SoftEther VPN Developer Edition クライアント接続マネージャ -PRODUCT_NAME_VPN_SVR SoftEther VPN Server Developer Edition -PRODUCT_NAME_VPN_BRIDGE SoftEther VPN Bridge Developer Edition -PRODUCT_NAME_VPN_SMGR SoftEther VPN Developer Edition サーバー管理マネージャ -PRODUCT_NAME_ELOGSVC SoftEther EtherLogger Developer Edition -PRODUCT_NAME_ELOGMGR SoftEther EtherLogger Developer Edition - -# ソフトウェア更新チェック用の Family Name -PRODUCT_FAMILY_NAME SoftEtherDev - - -# 接続制限用のブランド化文字列 -# BRANDED_C_TO_S Branded_VPN -# BRANDED_C_FROM_S Branded_VPN - -# クライアント ID -# CLIENT_ID 123 - -# プロダクト情報 -SE_COMPANY_URL https://selinks.org/?se -SE_VPNAZURE_URL https://selinks.org/?vpnazure - -# 共通文字列 -COMMON_UNKNOWN (不明) - - -# プロトコルエラー文字列 -ERR_UNKNOWN 不明なエラーが発生しました。 -ERR_0 エラーはありません。 -ERR_1 サーバーへの接続が失敗しました。ネットワーク接続や、接続先サーバーのアドレスやポート番号を確認してください。 -ERR_2 プロトコルエラーが発生しました。接続先サーバーからエラーが返されました。 -ERR_3 接続が切断されました。 -ERR_4 プロトコルエラーが発生しました。 -ERR_5 SoftEther VPN ソフトウェア以外のクライアントがポートに接続しました。 -ERR_6 ユーザーによってキャンセルされました。 -ERR_7 指定された認証方法はサーバーによって拒否されました。 -ERR_8 指定された仮想 HUB がサーバーに存在しません。 -ERR_9 ユーザー認証に失敗しました。 -ERR_10 指定された仮想 HUB は現在停止中です。しばらく待ってから、再接続してください。 -ERR_11 VPN セッションが削除されました。管理者がセッションを切断したか、クライアントから VPN Server への接続が切断された可能性があります。 -ERR_12 アクセスが拒否されました。 -ERR_13 VPN セッションの通信がタイムアウトしました。クライアントから VPN Server への接続が切断された可能性があります。 -ERR_14 プロトコル番号が不正です。 -ERR_15 TCP/IP コネクション数が多すぎます。 -ERR_16 接続先のサーバーまたは仮想 HUB に接続しているセッション数が多すぎます。 -ERR_17 プロキシサーバーへの接続に失敗しました。 -ERR_18 プロキシサーバーでエラーが発生しました。 -ERR_19 プロキシサーバーでのユーザー認証に失敗しました。 -ERR_20 同一ユーザーのセッション数が多すぎます。すでに他のユーザーが同一のユーザーとして VPN 接続している可能性があります。 -ERR_21 VPN Server でライセンスエラーが発生しました。VPN Server の管理者にお問い合わせください。 -ERR_22 仮想 LAN カードデバイスドライバにアクセスできません。仮想 LAN カードがインストールされており、無効になっていないことを確認してください。 -ERR_23 内部エラーが発生しました。 -ERR_24 スマートカードまたは USB ハードウェアトークンデバイスへのアクセスに失敗しました。 -ERR_25 PIN コードが違います。 -ERR_26 スマートカードまたは USB ハードウェアトークンデバイスには、指定された証明書は格納されていません。 -ERR_27 スマートカードまたは USB ハードウェアトークンデバイスには、指定された秘密鍵は格納されていません。 -ERR_28 スマートカードまたは USB ハードウェアトークンデバイスへの書き込みに失敗しました。 -ERR_29 指定されたオブジェクトが見つかりません。 -ERR_30 指定された名前の仮想 LAN カードはすでに存在します。別の名前を指定してください。 -ERR_31 仮想 LAN カードデバイスドライバのインストールに失敗しました。 -ERR_32 指定された名前は、仮想 LAN カードのデバイス名として使用できません。 -ERR_33 サポートされていません。 -ERR_34 指定された名前の接続設定はすでに存在しています。 -ERR_35 指定された接続設定は現在接続中です。 -ERR_36 指定された接続設定は存在しません。 -ERR_37 指定された接続設定は接続されていません。 -ERR_38 パラメータが不正です。 -ERR_39 スマートカードまたは USB ハードウェアトークンでエラーが発生しました。 -ERR_40 スマートカードまたは USB ハードウェアトークン認証を選択しましたが、使用するデバイスが選択されていません。接続マネージャの [スマートカード] メニューで選択してください。 -ERR_41 指定された仮想 LAN カードは 1 つ以上の接続設定によって使用されています。\r\nこの仮想 LAN カードを使用している接続設定を削除するか、接続設定が使用する仮想 LAN カードを変更してください。 -ERR_42 指定された接続設定が使用する仮想 LAN カードが見つかりません。\r\n仮想 LAN カードが存在していることを確認してください。また、仮想 LAN カードデバイスが無効化されていないことを確認してください。\r\n\r\n問題が解決できない場合は、この接続設定の使用する仮想 LAN カードを変更するか、同じ名前の仮想 LAN カードを新規作成してください。 -ERR_43 指定された接続設定が使用する仮想 LAN カードは、すでに別の接続設定によって使用中です。\r\n同じ仮想 LAN カードを使用している別の接続設定がある場合は、その接続設定を切断してください。 -ERR_44 指定された接続設定が使用する仮想 LAN カードが無効化されています。\r\nこの接続設定を使用する前に、仮想 LAN カードを有効化して、使用可能な状態にしてください。 -ERR_45 指定された値が不正です。 -ERR_46 接続先はクラスタコントローラではありません。 -ERR_47 接続試行中です。 -ERR_48 クラスタコントローラへの接続に失敗しました。 -ERR_49 クラスタコントローラはクラスタ上に新しいセッションを割り当てることができませんでした。 -ERR_50 クラスタメンバサーバーの仮想 HUB を管理することはできません。 -ERR_51 接続しようとしたユーザーのパスワードは空のため、リモートから接続を行うことはできません。空のパスワードを使っている場合、VPN Server のローカルコンピュータ localhost (127.0.0.1) 上からのみ接続できます。 -ERR_52 権限が不足しています。 -ERR_53 指定したリスナーが見つかりません。 -ERR_54 すでに指定したポート番号のリスナーが存在しています。 -ERR_55 クラスタメンバサーバーではありません。 -ERR_56 指定した暗号化アルゴリズム名はサポートされていません。 -ERR_57 指定した名前の仮想 HUB はすでにサーバー上に存在します。 -ERR_58 登録されている仮想 HUB が多すぎます。これ以上登録できません。古い仮想 HUB を削除してください。 -ERR_59 指定された名前のカスケード接続がすでに存在します。 -ERR_60 カスケード接続はクラスタ上のサーバーに作成することはできません。 -ERR_61 指定されたカスケード接続がオフラインになっています。 -ERR_62 登録されているアクセスリスト数が多すぎます。 -ERR_63 登録されているユーザー数が多すぎます。 -ERR_64 登録されているグループ数が多すぎます。 -ERR_65 指定したグループは存在しません。 -ERR_66 指定した名前のユーザーがすでに仮想 HUB 上に存在します。 -ERR_67 指定した名前のグループがすでに仮想 HUB 上に存在します。 -ERR_68 指定した名前のユーザーはサーバー上に存在しますが、認証の種類はパスワード認証ではありません。パスワードを変更することはできません。 -ERR_69 入力されたユーザー名または古いパスワードが正しくありません。パスワードは大文字・小文字を区別されます。 -ERR_70 さいたま。 -ERR_71 SoftEther は経済産業省の要請により現在配布を一時停止させていただいております。 -ERR_72 SoftEther は IPA の要請により現在配布を一時停止させていただいております。 -ERR_73 カスケード接続のセッションは切断できません。セッションを削除するには、カスケード接続を停止してください。 -ERR_74 VPN Server への接続設定が未完了です。先に VPN Server に接続するための接続設定を行ってください。 -ERR_75 すでに VPN Server への接続を開始しています。 -ERR_76 VPN Server に接続されていません。 -ERR_77 指定された X509 証明書ファイルは RSA 1024 bit、1536 bit、2048 bit、3072 bit または 4096 bit の公開鍵を持っていません。SoftEther VPN ソフトウェアは RSA 1024 bit、1536 bit、2048 bit、3072 bit または 4096 bit 証明書をサポートしています。 -ERR_78 SecureNAT のセッションは切断できません。セッションを削除するには、SecureNAT 機能を停止してください。 -ERR_79 SecureNAT 機能はクラスタリング環境では有効にすることはできません。 -ERR_80 SecureNAT 機能が動作していません。 -ERR_81 この VPN Server への接続セッションは、ネットワーク管理者によって設置されているファイアウォール装置によって遮断されました。ネットワーク管理者にお問い合わせください。 -ERR_82 ローカルブリッジセッションは切断できません。セッションを削除するには、ローカルブリッジ機能を停止してください。 -ERR_83 ローカルブリッジ機能が動作していません。 -ERR_84 接続先の VPN Server では、ローカルブリッジが使用できません。お使いの VPN Server でローカルブリッジを使用するための設定方法については、オンラインヘルプなどを参照してください。 -ERR_85 接続先サーバーの提示した証明書が信頼できません。接続設定でサーバー証明書を必ず検証する設定が有効になっています。信頼できるルート証明書を登録するか、固有証明書を登録してください。 -ERR_86 接続先サーバーの製品コードが違います。このクライアントから接続することはできません。 -ERR_87 クライアントとサーバーのバージョンが違います。ソフトウェアをアップデートしてください。 -ERR_88 キャプチャデバイスの追加に失敗しました。すでに同一のキャプチャデバイスが登録されている可能性があります。 -ERR_89 接続先サーバーはクライアントから接続することはできません。専用クライアントソフトウェアが必要です。 -ERR_90 指定したキャプチャデバイスは登録されていません。 -ERR_91 仮想レイヤ 3 スイッチセッションは切断できません。セッションを削除するには、仮想レイヤ 3 スイッチを停止してください。 -ERR_92 指定された名前の仮想レイヤ 3 スイッチは既に存在します。別の名前を指定してください。 -ERR_93 指定された名前の仮想レイヤ 3 スイッチが見つかりません。 -ERR_94 指定された名前が不正です。使用できない文字が含まれていないかどうかチェックしてください。 -ERR_95 仮想レイヤ 3 インターフェイスの追加に失敗しました。パラメータが正しいかどうか確認してください。また、仮想レイヤ 3 スイッチが動作中の場合は、仮想レイヤ 3 インターフェイスの追加または削除はできません。仮想レイヤ 3 スイッチを停止してください。 -ERR_96 仮想レイヤ 3 インターフェイスの削除に失敗しました。パラメータが正しいかどうか確認してください。また、仮想レイヤ 3 スイッチが動作中の場合は、仮想レイヤ 3 インターフェイスの追加または削除はできません。仮想レイヤ 3 スイッチを停止してください。 -ERR_97 指定された仮想レイヤ 3 インターフェイスの接続先仮想 HUB に接続している仮想レイヤ 3 インターフェイスが仮想レイヤ 3 スイッチの中に既に存在します。1 つの仮想レイヤ 3 スイッチの中では、同一の仮想 HUB に接続する仮想レイヤ 3 インターフェイスは 1 つしか定義できません。 -ERR_98 ルーティングテーブルの追加に失敗しました。パラメータが正しいかどうか確認してください。また、仮想レイヤ 3 スイッチが動作中の場合は、ルーティングテーブルの追加または削除はできません。仮想レイヤ 3 スイッチを停止してください。 -ERR_99 ルーティングテーブルの削除に失敗しました。パラメータが正しいかどうか確認してください。また、仮想レイヤ 3 スイッチが動作中の場合は、ルーティングテーブルの追加または削除はできません。仮想レイヤ 3 スイッチを停止してください。 -ERR_100 指定されたルーティングテーブルはすでに存在します。 -ERR_101 クライアントとサーバーの間の時計がずれています。時刻設定を確認してください。 -ERR_102 この仮想レイヤ 3 スイッチを開始できません。\r\n\r\n仮想レイヤ 3 スイッチを開始するには、最低でも 1 つの仮想インターフェイスが仮想レイヤ 3 スイッチ内に定義されている必要があります。 -ERR_103 接続先の VPN Server のクライアント接続ライセンス数が不足しています。サーバー管理者にお問い合わせください。 -ERR_104 接続先の VPN Server のブリッジ接続ライセンス数が不足しています。サーバー管理者にお問い合わせください。 -ERR_105 接続先の VPN Server は、現在技術的な問題で接続を受け付けていません。しばらく待つか、VPN Server の管理者に連絡してサーバーのログファイルを確認するよう要請してください。 -ERR_106 接続先の VPN Server の証明書の有効期限が切れています。VPN Server の管理者にご連絡ください。 -ERR_107 モニタリングモードで接続を要求しましたが、接続に使用したユーザーのセキュリティポリシーはモニタリングモードを許可していません。 -ERR_108 ブリッジ / ルータモードで接続を要求しましたが、接続に使用したユーザーのセキュリティポリシーはブリッジモードもルータモードも禁止しています。 -ERR_109 VPN Server の仮想 HUB の接続元 IP 制限リストの設定によって、クライアントの IP アドレスからの接続は拒否されました。 -ERR_110 項目数が多すぎます。 -ERR_111 メモリが不足しています。 -ERR_112 指定されたオブジェクトはすでに存在しています。 -ERR_113 致命的なエラーが発生しました。プログラムの動作が継続できない可能性があります。 -ERR_114 接続先 VPN Server でソフトウェアライセンス違反が検出されています。接続は許可されません。VPN Server の管理者にお問い合わせください。 -ERR_115 接続先の VPN Server が現在インターネット上のソフトイーサ株式会社が提供する重要なサーバーに接続し、ライセンスを確認できない状態です。しばらく待つか、VPN Server の管理者に連絡してサーバーのログファイルおよびサーバー本体のインターネットへの接続状況を確認するよう要請してください。 -ERR_116 クライアント側でソフトウェアライセンス違反が検出されました。接続は許可されません。 -ERR_117 コマンドまたはファイル名が不正です。 -ERR_118 ライセンスキーが正しくありません。 -ERR_119 VPN Server に有効なライセンスが登録されていません。VPN Server の管理者に連絡してください。 -ERR_120 VPN Server がクラスタとして動作するために必要な製品ライセンスが登録されていません。VPN Server の管理者に連絡してください。 -ERR_121 この VPN Client の接続設定は SoftEther VPN 2.0 Administration Pack に含まれる「Web インストーラ作成キット」または「簡易インストーラ作成キット」によってインストールされたものですが、接続先の VPN Server は SoftEther VPN 2.0 Administration Pack に対応したエディションではありません。インストーラの作成元やシステム管理者にお問い合わせください。 -ERR_122 VPN Server SDK for .NET ライブラリは SoftEther VPN 2.0 Administration Pack に対応したエディションの SoftEther VPN Server にのみ接続することができます。接続先の VPN Server は SoftEther VPN 2.0 Administration Pack に対応したエディションではありません。システム管理者にお問い合わせください。 -ERR_123 接続先のソフトウェアはベータ版で、期限が切れています。より新しいベータ版または完成版の提供が開始された後は利用することはできません。http://selinks.org/ にアクセスし、最新版のソフトウェアを入手するよう、接続先のサーバーの管理者に連絡してください。 -ERR_124 VPN Server への接続がサーバ側で拒否されました。 -ERR_125 VPN Server への接続がクライアント側で拒否されました。 -ERR_126 一定時間が経過したため、管理者によって設定されたセキュリティポリシーの設定により、VPN 接続が自動的に切断されました。続けて通信を行いたい場合は、もう一度接続してください。 -ERR_127 この VPN Server に接続するためには、VPN Server の管理者が作成した特別バージョンの VPN Client ソフトウェアが必要です。VPN Server の管理者にお問い合わせください。 -ERR_128 この VPN Server には、すでに現在の製品エディションのライセンスで許容されている作成可能ユーザー数以上の個数のユーザーオブジェクトが作成・登録されています。これ以上、この VPN Server に新しいユーザーオブジェクトを作成することはできません。既存のユーザーオブジェクトをいくつか削除するか、製品エディションを Professional Edition など上位のバージョンにアップグレードしてください。 -ERR_129 投入しようとしたライセンスキーのサブスクリプション契約は、この VPN Server がリリース (ビルド) された日よりも前に有効期限が切れています。お客様は、サブスクリプション契約を締結されていた期間中にリリース (ビルド) されたバージョンの VPN Server のみを使用する権利があります。お客様が過去にサブスクリプション契約を締結されていた期間中にリリース (ビルド) された古いバージョンの VPN Server を使用するか、またはお客様のサブスクリプション契約を更新して新しいライセンスキーを取得してください。なお、古いバージョンの VPN Server にダウングレードするために、http://selinks.org/ からソフトウェアをダウンロードできる場合があります。 -ERR_130 VPN Server の体験版ライセンスキーを何個も連続して取得し、利用することはできません。製品版ライセンスのご購入をご検討ください。 -ERR_131 同一 IP アドレスに複数の VPN Server があります。NAT 使用の場合は、ポート開放設定を行ってください。または「接続先グローバル IP アドレスまたはホスト名/192.168.x.x」のように "/" を付加し、この文字以降に接続先を特定するプライベート IP アドレスまたはホスト名を指定してください。 -ERR_132 ダイナミック DNS サービス用のホストキーが重複しています。キーは自動的にリセットされます。 -ERR_133 指定されたダイナミック DNS ホスト名はすでに使用されています。別のホスト名を指定してください。 -ERR_134 指定されたダイナミック DNS ホスト名の一部に使用できない文字が含まれています。別のホスト名を指定してください。 -ERR_135 指定されたダイナミック DNS ホスト名が長すぎます。ホスト名は 31 文字以下で指定してください。 -ERR_136 ダイナミック DNS ホスト名が指定されていません。 -ERR_137 指定されたダイナミック DNS ホスト名が短すぎます。ホスト名は 3 文字以上で指定してください。 -ERR_138 仮想 HUB に登録されているユーザーのパスワードは、MS-CHAP v2 認証を行う前に一度再設定される必要があります。VPN サーバーの管理者に依頼してパスワードを内部バージョン 4.0 以降の VPN サーバーマネージャまたは vpncmd ユーティリティを用いて再設定するか、VPN Client ソフトウェアを用いてパスワードを変更してください。 -ERR_139 ダイナミック DNS サーバーとの間の通信が切断されました。 -ERR_140 ICMP (Ping) プロトコルを初期化することができませんでした。VPN Server を動作させているプロセスが一般ユーザー権限で動作している可能性があります。そのような場合は、VPN Server をシステムサービスとして動作させてください (Linux / UNIX の場合は root 権限で動作させてください)。 -ERR_141 DNS ポート 53 を開くことができませんでした。VPN Server が動作しているコンピュータですでに別の DNS サーバープログラム (BIND や Microsoft DNS Server など) が動作していないかどうか確認してください。これらの同一ポートを使用するプログラムを終了させて再試行してみてください。また、Linux / UNIX の場合は VPN Server プロセスが root 権限で動作していることを確認してください。 -ERR_142 OpenVPN サーバー機能が有効になっていません。 -ERR_143 ユーザー認証の方法のうち「証明書認証」および「外部サーバー認証」機能はオープンソース版 SoftEther VPN にはまだ実装されていません。ユーザー認証の方法として「匿名認証」または「パスワード認証」のいずれかを選択してください。 -ERR_144 この操作は実行できません。VPN Gate 中継サーバーに関する操作は VPN Gate コントロールパネルから実行してください。 -ERR_145 この操作は実行できません。VPN Gate 公開 VPN 中継サーバーの接続設定に関する操作は VPN Gate の設定画面から実行してください。 -ERR_146 VPN Gate サービスが VPN Client 内で動作している場合は、この設定画面から VPN Gate サービスを停止することはできません。VPN Gate サービスを停止するには、VPN Client 接続マネージャの設定ツールを使用してください。 -ERR_147 この機能はオープンソース版 SoftEther VPN にはまだ実装されていません。 -ERR_148 Windows システムがサスペンド状態に移行中のため、VPN 通信が切断されました。 - - - -# ライセンス関係 -LICENSE_INFO_URL https://selinks.org/?new_license -LICENSE_SUPPORT_URL https://selinks.org/?q=license_info&id=%s -LICENSE_STATUS_OK 有効 -LICENSE_STATUS_EXPIRED 有効期限切れ -LICENSE_STATUS_ID_DIFF サーバー ID 不一致 -LICENSE_STATUS_DUP 重複 -LICENSE_STATUS_INSUFFICIENT 必要な他のライセンスが不足 -LICENSE_STATUS_COMPETITION 他のライセンスと競合 -LICENSE_STATUS_NONSENSE 現在のエディションでは無意味 -LICENSE_STATUS_CPU CPU の種類が不一致 -LICENSE_STATUS_OTHERERROR 不明なエラーのため無効 - - -# TCP 最適化関係 -TCPOPT_NOT_SUPPORTED TCP/IP 通信設定最適化ユーティリティは、このオペレーティングシステムでは使用できません。 -TCPOPT_NOT_ADMIN TCP/IP 通信設定最適化ユーティリティは、管理者権限の無いユーザーは使用できません。 - - -# Windows Vista / Windows 7 / Windows 8 用最適化関係 -VISTA_MMCSS_MSG Windows Vista / Windows 7 / Windows 8 / Windows 10 で VPN 通信を経由してマルチメディアファイル (ビデオやオーディオ、ストリーミングなど) を再生するための最適化をしますか? -VISTA_MMCSS_MSG_2 すでに Windows Vista / Windows 7 / Windows 8 / Windows 10 で VPN 通信を経由してマルチメディアファイル (ビデオやオーディオ、ストリーミングなど) を再生するための最適化の設定が行われています。\r\n最適化設定を削除して、元に戻しますか? -VISTA_MMCSS_MSG_3 現在の環境では、最適化の機能は使用できません。 -VISTA_MMCSS_MSG_4 この機能は、Administrators 権限でプログラムを起動している際にのみ使用できます。\r\nWindows Vista / Windows 7 / Windows 8 / Windows 10 の場合は、[管理者として実行] 機能を使用してプログラムを実行してください。 -VISTA_MMCSS_MSG_5 最適化設定が完了しました。 -VISTA_MMCSS_MSG_6 最適化設定は削除されました。 - -# PKCS ユーティリティ関係 -PKCS_UTIL_TITLE PKCS#12 書き込みユーティリティ -PKCS_UTIL_SAVEDLG_TITLE USB トークンに書き込みたい PKCS#12 ファイルを選択 -PKCS_UTIL_READ_ERROR ファイル %s を読み込めませんでした。 -PKCS_UTIL_WRITE_OK_MSG ファイル %s を USB ハードウェアトークンに書き込みました。 -PKCS_UTIL_DELETE_OK_MSG USB ハードウェアトークンから PKCS#12 証明書データを消去しました。 -PKCS_UTIL_SECA_FILENAME seca_p12 -PKCS_MAKE_SURE USB トークン内に書き込まれている PKCS#12 証明書データを消去します。\r\n一旦消去したデータは、二度と復元することはできません。\r\r\n\r\r\n続行しますか? -PKCS_UTIL_BAD_FILE 指定されたファイルは PKCS#12 ファイルとして認識できませんでした。 - - -# 共通ダイアログ関係 -DLG_ALL_FILES すべてのファイル (*.*)|*.* -DLG_CERT_FILES X509 証明書ファイル (*.CER;*.CRT)|*.cer;*.crt|すべてのファイル (*.*)|*.* -DLG_KEY_FILTER 秘密鍵ファイル (*.KEY;*.PEM)|*.key;*.pem|すべてのファイル (*.*)|*.* -DLG_PKCS12_FILTER PKCS#12 ファイル (*.P12;*.PFX)|*.p12;*.pfx|すべてのファイル (*.*)|*.* -DLG_CERT_OR_P12_FILTER X509 証明書または PKCS#12 ファイル (*.CER;*.CRT;*.P12;*.PFX)|*.cer;*.crt;*.p12;*.pfx|X509 証明書ファイル (*.CER;*.CRT)|*.cer;*.crt|PKCS#12 ファイル (*.P12;*.PFX)|*.p12;*.pfx|すべてのファイル (*.*)|*.* -DLG_CONFIG_FILES 設定ファイル (*.CONFIG)|*.config|すべてのファイル (*.*)|*.* -DLG_KEY_OR_P12_FILTER 秘密鍵ファイルまたは PKCS#12 ファイル (*.KEY;*.PEM;*.P12;*.PFX)|*.key;*.pem;*.p12;*.pfx|秘密鍵ファイル (*.KEY;*.PEM)|*.key;*.pem|PKCS#12 ファイル (*.P12;*.PFX)|*.p12;*.pfx|すべてのファイル (*.*)|*.* -DLG_ZIP_FILER ZIP ファイル (*.ZIP)|*.zip|すべてのファイル (*.*)|*.* -DLG_OPEN_CERT 証明書ファイルを選択してください -DLG_OPEN_KEY 秘密鍵ファイルを選択してください -DLG_OPEN_KEY_WITH_CERT 対応する秘密鍵ファイルを選択してください -DLG_OPEN_FILE_ERROR 指定されたファイル "%S" を読み込めませんでした。 -DLG_OPEN_FILE_ERROR_W 指定されたファイル "%s" を読み込めませんでした。 -DLG_BAD_P12 ファイル "%S" は有効な PKCS#12 証明書ファイルではありません。 -DLG_BAD_P12_W ファイル "%s" は有効な PKCS#12 証明書ファイルではありません。 -DLG_BAD_X509 ファイル "%S" は有効な X509 証明書ファイルではありません。 -DLG_BAD_X509_W ファイル "%s" は有効な X509 証明書ファイルではありません。 -DLG_BAD_KEY ファイル "%S" は有効な RSA 秘密鍵ファイルではありません。 -DLG_BAD_KEY_W ファイル "%s" は有効な RSA 秘密鍵ファイルではありません。 -DLG_BAD_SIGNATURE 指定された証明書に含まれる公開鍵と秘密鍵が正しく対応していません。\r\n証明書の公開鍵に対応した秘密鍵が必要です。 -DLG_SAVE_CERT 証明書を保存するファイル名を指定してください -DLG_SAVE_KEY 秘密鍵を保存するファイル名を指定してください -DLG_SAVE_P12 証明書と秘密鍵を保存するファイル名を指定してください -DLG_SAVE_FILE 保存先のファイル名を指定してください -DLG_SAVE_OPENVPN_CONFIG OpenVPN 設定ファイルを格納した ZIP ファイルの保存先 -DLG_CERT_SAVE_OK 証明書を正しく保存しました。 -DLG_CERT_SAVE_ERROR 証明書を保存できませんでした。 -DLG_KEY_SAVE_OK 秘密鍵を正しく保存しました。 -DLG_KEY_SAVE_ERROR 秘密鍵を保存できませんでした。 -DLG_KEY_PAIR_SAVE_OK 証明書と秘密鍵を正しく保存しました。 -DLG_KEY_PAIR_SAVE_ERROR 証明書と秘密鍵を正しく保存できませんでした。 -DLG_REBOOT_INFO %u 秒後にコンピュータを再起動します。 -DLG_REBOOT_INFO_2 コンピュータを再起動しています... -DLG_REBOOT_ERROR コンピュータの再起動に失敗しました。\r\n\r\n直ちにコンピュータを手動で再起動してください。 -DLG_SAVE_CONFIG コンフィグレーションの保存先ファイル名を指定してください -DLG_OPEN_CONFIG インポートするコンフィグレーションファイルを指定してください -DLG_STRING_DEFTITLE 文字列の入力 -DLG_STRING_DEFINFO 文字列を入力してください。 -DLG_ABOUT_LEGAL 法律上の通知 -DLG_ABOUT_AUTHORS 開発者の一覧 -DLG_UPDATE_DATE \ (%S にリリース) -DLG_UPDATE_HINT [OK] をクリックすると、Web ブラウザが開いて最新のアップデートに関する情報が表示されます。\r\n\r\nアップデートのダウンロードとインストールは手動で行う必要があります。他のコンピュータ上のソフトウェアのアップデートを行う場合は、そのコンピュータにリモートデスクトップや SSH などでログインしてダウンロードとアップデート作業を行ってください。\r\n - - -# 競合するプロセス関係 -BAD_PROCESS_TITLE %S に関する警告 -BAD_PROCESS_MESSAGE このコンピュータで、問題の原因となる可能性のあるソフトウェア "%S" が動作している可能性があることが検出されました。\r\n\r\n"%S" に含まれる問題が原因で VPN 通信が不安定になったり、エラーが発生したりする可能性があります。\r\n\r\nVPN をソフトウェア "%S" と共に利用したことにより、VPN の動作が不安定になる場合は、"%S" を停止するか、アンインストールすることを推奨します (ソフトウェアの種類によっては、停止させるだけでは依然としてコンピュータに問題が残る可能性がありますのでご注意ください)。\r\n - - -# ハードウェアトークン関係 -SEC_SMART_CARD スマートカード -SEC_USB_TOKEN USB トークン -SEC_INIT_MSG_1 以下のスマートカードをスマートカードリーダに挿入し、PIN コードを入力してください。 -SEC_INIT_MSG_2 以下の USB トークンハードウェアをコンピュータの USB ポートに接続し、PIN コードを入力してください。 -SEC_OPENING デバイスを開いています... -SEC_CLOSING デバイスを閉じています... -SEC_OPEN_SESSION セキュアセッションを開いています... -SEC_CLOSE_SESSION セキュアセッションを閉じています... -SEC_LOGIN トークンにログインしています... -SEC_LOGOUT トークンからログアウトしています... -SEC_INIT_BATCH バッチ処理を開始しています... -SEC_READ_DATA データを読み出しています... -SEC_WRITE_DATA データを書き込んでいます... -SEC_READ_CERT 証明書を読み込んでいます... -SEC_WRITE_CERT 証明書を書き込んでいます... -SEC_DELETE オブジェクトを削除しています... -SEC_SIGN 秘密鍵によるデジタル署名を行っています... -SEC_WRITE_KEY 秘密鍵を書き込んでいます... -SEC_ENUM オブジェクトを列挙しています... -SEC_FINISHED 操作が完了しました。 -SEC_ERROR_INVALID_ID 指定されたセキュリティデバイス (デバイス %u) は無効です。 -SEC_ERROR_OPEN_DEVICE デバイス %S を開くことができませんでした。デバイスがコンピュータに接続されていることを確認してください。 -SEC_ERROR_OPEN_DEVICEEX デバイス %S を開くことができませんでした。デバイスがコンピュータに接続されていることを確認してください。\r\n\r\nなお、住民基本台帳ネットワークカードなどの公的個人認証サービスクライアントソフトウェア等を使用している場合は、事前に [スタート] メニューの [公的個人認証ユーティリティ] で使用するスマートカードデバイスを選択しておく必要があります。 -SEC_ERROR_OPEN_SESSION デバイス %S 内部でセキュリティセッションを開始することができませんでした。正しいデバイスが選択されていることを確認してください。 -SEC_ERROR_LOGIN 入力された PIN コードが間違っています。 -SEC_ERROR_NOT_FOUND_1 スマートカード内に指定されたオブジェクトが存在しません。正しいスマートカードが挿入されていることを確認してください。 -SEC_ERROR_NOT_FOUND_2 USB トークンハードウェア内に指定されたオブジェクトが存在しません。正しい USB トークンハードウェアが接続されていることを確認してください。 -SEC_ERROR_SIGN_1 スマートカード内に秘密鍵が存在しないか、デジタル署名操作に失敗しました。正しいスマートカードが挿入されていることを確認してください。 -SEC_ERROR_SIGN_2 USB トークンハードウェア内に秘密鍵が存在しないか、デジタル署名操作に失敗しました。正しい USB トークンハードウェアが接続されていることを確認してください。 -SEC_ERROR_WRITE_1 オブジェクトをスマートカードに書き込むことができませんでした。スマートカードの空きメモリが不足している可能性があります。 -SEC_ERROR_WRITE_2 オブジェクトを USB トークンハードウェアに書き込むことができませんでした。 スマートカードの空きメモリが不足している可能性があります。 -SEC_ERROR_ENUM トークン内に格納されているオブジェクトの列挙に失敗しました。 -SEC_ERROR_DELETE 指定されたオブジェクトの削除に失敗しました。指定されたオブジェクトはメモリ内に存在しない可能性があります。 -SEC_COLUMN1 デバイス名 -SEC_COLUMN2 種類 -SEC_COLUMN3 製造元 -SEC_COLUMN4 DLL 名 -SEC_INVALID_ID 指定されたスマートカードデバイスは存在しません。スマートカードの種類をもう一度選択してください。 -SEC_MGR_COLUMN1 名前 -SEC_MGR_COLUMN2 種類 -SEC_MGR_COLUMN3 プライベート -SEC_TYPE_DATA データ -SEC_TYPE_CERT 証明書 -SEC_TYPE_KEY 秘密鍵 -SEC_TYPE_PUB 公開鍵 -SEC_YES はい -SEC_NO いいえ -SEC_NONE なし -SEC_IMPORT_DATA インポートしたいデータを選択してください -SEC_IMPORT_CERT インポートしたい証明書を選択してください -SEC_IMPORT_KEY インポートしたい秘密鍵を選択してください -SEC_READ_FAILED 指定されたファイルの読み込みに失敗しました。 -SEC_DATA_TOO_BIG 指定されたデータのサイズが大きすぎます。スマートカードには %u バイトを超えるデータを書き込むことはできません。 -SEC_OBJECT_NAME_TITLE 挿入するオブジェクトの名前 -SEC_OBJECT_NAME_INFO 新しくスマートカードに書き込むオブジェクトの名前を指定してください。オブジェクトの名前には、特殊な記号を除く任意の半角文字を指定することができます。\r\n\r\nすでにカードに書き込まれている同じ種類のオブジェクト名と重複すると上書きされますので注意してください。 -SEC_DELETE_MSG 選択したオブジェクトをスマートカードから削除します。\r\nよろしいですか? -SEC_OBJECT_IMPORT_OK オブジェクトをスマートカードに書き込みました。 -SEC_OBJECT_EXPORT_OK スマートカードから読み取ったデータをファイルに保存しました。 -SEC_NEW_CERT_IMPORT_OK 新しく生成した証明書をスマートカードに書き込みました。 -SEC_CURRENT_DEVICE 現在、デバイス %S が選択されています。 -SEC_CURRENT_NO_DEVICE 使用するスマートカードデバイスを選択してください。 -SEC_NO_SECURE_DEVICE システムに SoftEther VPN が対応したスマートカードまたはハードウェアセキュリティトークンデバイスがインストールされていません。\r\n\r\nSoftEther VPN でスマートカードまたはハードウェアトークンを利用するには、PKCS#11 に対応したデバイスドライバが Windows にインストールされている必要があります。また、SoftEther VPN が対応している種類のデバイスである必要があります。\r\n\r\nシステムに対応したデバイスドライバがインストールされていることを確認してください。\r\nSoftEther VPN が対応しているデバイスの一覧については、ソフトイーサ株式会社の Web サイトをご覧ください。また、ソフトウェアのバージョンを最新のものにアップデートすることにより対応機器が増える場合もあります。 -SEC_PIN_DEVICE_OPEN_ERR デバイス "%S" に接続できませんでした。ハードウェアが正しく接続されているかどうかを確認してください。 -SEC_PIN_CURRENT_BAD 現在の PIN コードが間違っています。 -SEC_PIN_CHANGE_FAILED PIN コードの変更に失敗しました。 -SEC_PIN_OK PIN コードを変更しました。 - - -# TCP 接続ダイアログ関係 -CONNECTDLG_CAPTION 接続中 -CONNECTDLG_MESSAGE サーバー "%S" (TCP ポート: %u) に接続しています... -CONNECTDLG_CANCELING 接続をキャンセルしています。しばらくお待ちください... - - -# NIC 情報ダイアログ関係 -NICINFO_1 VPN サーバーに接続しました。 -NICINFO_1_1 VPN 上の DHCP サーバーから IP アドレスを取得中... -NICINFO_1_2 VPN 内で使用する IP アドレスを決定中... - -NICINFO_2 VPN 通信が可能になりました。 -NICINFO_2_1 IP アドレス %S の割り当てが完了しました。 - -NICINFO_3 VPN 通信が可能になりました。 -NICINFO_3_1 IP アドレス %S が利用可能になりました。 - - -# ログイン時パスワード入力ダイアログ関係 -PW_RETRYCOUNT 入力が行われない場合、あと %u 秒後に自動的に再接続します... -PW_LOGIN_DLG_TITLE ログイン -PW_TYPE_0 匿名認証 -PW_TYPE_1 標準パスワード認証 -PW_TYPE_2 RADIUS または NT ドメイン認証 -PW_TYPE_3 クライアント証明書認証 -PW_TYPE_4 スマートカード認証 -PW_TYPE_5 Openssl Engine Authentication - -PW_MSG_PROXY プロキシサーバー %S でのユーザー認証に失敗しました。正しいユーザー名とパスワードを再入力してください。 -PW_TYPE_PROXY プロキシサーバー認証 - - -# VPN 接続ステータス関係 -STATUS_1 初期化中... -STATUS_2 VPN サーバー "%S" にプロキシサーバー %S 経由で接続しています... -STATUS_3 プロキシサーバー %S でユーザー認証をしています... -STATUS_4 VPN サーバー "%S" に接続しています... -STATUS_5 サーバー証明書を検証しています... -STATUS_6 ユーザー認証を行っています... -STATUS_7 VPN セッションを確立しています... -STATUS_8 クラスタ内の VPN サーバーに接続しています... -STATUS_9 VPN セッションの確立が完了しました。 - - -# 証明書ダイアログ関係 -CERT_NOT_FOUND この証明書を発行した証明機関の証明書が信頼できる証明書のリストから見つかりませんでした。 -CERT_ROOT この証明書はルート証明書 (自己署名証明書) です。 -CERT_LV_C1 フィールド -CERT_LV_C2 値 -CERT_SERIAL シリアル番号 -CERT_ISSUER 発行者 -CERT_SUBJECT サブジェクト -CERT_NOT_BEFORE 有効期限の開始 -CERT_NOT_AFTER 有効期限の終了 -CERT_BITS ビット数 -CERT_PUBLIC_KEY 公開鍵 -CERT_DIGEST_MD5 ダイジェスト (MD5) -CERT_DIGEST_SHA1 ダイジェスト (SHA-1) -CERT_NO_SERIAL シリアル番号はありません -CERT_BITS_FORMAT %u bits - - -# 証明書確認ダイアログ関係 -CC_DANGEROUS_MSG 前回、このサーバー (%S) に VPN 接続した際に保存されたサーバー証明書と、今回の接続の際にサーバーが提示しているサーバー証明書が一致しません。\r\n\r\n前回のダイジェスト値 (MD5) : %S\r\n前回のダイジェスト値 (SHA1): %S\r\n\r\n今回のダイジェスト値 (MD5) : %S\r\n今回のダイジェスト値 (SHA1): %S\r\n\r\nVPN Server 側の証明書がサーバー管理者によって変更された可能性がありますが、場合によっては、成り済ましなどの中間攻撃を受けている可能性もあります。\r\n接続しようとしている VPN Server の管理者に詳細を問い合わせることを強くお勧めします。 -CC_WARNING_MSG 現在接続しようとしている VPN Server のサーバー証明書を次回 %s に接続する際に自動的に信頼しますか?\r\n\r\nダイジェスト値 (SHA1): %S\r\nダイジェスト値 (MD5) : %S\r\n\r\nこのサーバー証明書が正しいものであるかどうか不安な場合は、上記のダイジェスト値をサーバー設置者に対して安全な方法で確認してください。\r\n\r\n[はい] をクリックすると、次回からこのサーバーに接続する際にこのサーバー証明書が提示された場合は、自動的に信頼します。\r\n[いいえ] をクリックすると、今回の接続のみ信頼し、次回の接続の際には再度警告のメッセージを表示します。\r\n[キャンセル] をクリックすると、セキュリティの警告画面に戻ります。\r\n\r\n※ この設定はアカウントごとに変更することができます。VPN クライアント接続マネージャのアカウントのプロパティで設定できます。 - - -# 接続失敗ダイアログ関係 -ERRDLG_ERRMSG エラー (エラーコード %u) :\r\n%s\r\n -ERRDLG_RETRYCOUNT 入力が行われない場合、あと %u 秒後に自動的に再接続します... -ERRDLG_INFORMATION [再試行] をクリックすると、再度接続を開始します。 -ERRDLG_RETRY_INFO_1 %u / %u 回目の再試行を行いますか? -ERRDLG_RETRY_INFO_2 %u 回目の再試行を行いますか? -ERRDLG_DISCONNECTED_MSG VPN Server "%S" への接続が切断されました。 -ERRDLG_DEVICE_ERROR 仮想 LAN カード (デバイス名: %S) が停止されたため、VPN Server との接続を切断しました。\r\n\r\nエラーコード %u: %s - - -# プロトコル関係 -PROTO_DIRECT_TCP 直接 TCP/IP 接続 -PROTO_HTTP_PROXY HTTP プロキシ経由接続 -PROTO_SOCKS_PROXY SOCKS4 プロキシ経由接続 -PROTO_SOCKS5_PROXY SOCKS5 プロキシ経由接続 -PROTO_SSH SSH サーバー経由接続 -PROTO_UNKNOWN 不明なプロトコル - - -# Windows のバージョンに関するエラー -WINVER_TITLE Windows のバージョンに関する警告 -WINVER_ERROR_FORMAT %sの Windows のバージョン (およびサービスパック番号) は「%S」です。\r\n\r\n%s が対応している Windows のバージョン (およびサービスパック番号) は以下のとおりです:\r\n%S\r\n\r\n%sの Windows のバージョンは、%s が対応している Windows のバージョンよりも新しいため、予期せぬ不具合や互換性の問題などが発生する可能性があります。\r\n予期せぬ不具合や互換性の問題などを避けるために、%s の更新版を入手しアップデートすることを推奨します。\r\n(アップデートせずにこのまま使用することは可能ですが、できるだけ早急にアップデートすることをお勧めいたします。)\r\n\r\nあなたがシステム管理者である場合は、%s の更新版アップデートパッチを、ソフトイーサ株式会社の Web サイト http://selinks.org/ から無料でダウンロードすることができます。\r\n\r\nあなたがシステム管理者でない場合は、この警告メッセージが表示された旨を VPN システムの管理者にお伝えください。\r\n\r\n----- MSG%04u%02u -----\r\n\r\n -WINVER_ERROR_VPNSERVER 接続先サーバーコンピュータの VPN Server -WINVER_ERROR_VPNBRIDGE 接続先サーバーコンピュータの VPN Bridge -WINVER_ERROR_VPNCLIENT このクライアントコンピュータの VPN Client -WINVER_ERROR_PC_LOCAL このクライアントコンピュータ -WINVER_ERROR_PC_REMOTE 接続先のサーバーコンピュータ - - -# オープンソース版に関する警告 -OSS_MSG はじめに - SoftEther VPN Server について\r\n\r\nこの VPN Server は、筑波大学において学術実験目的で開発され SoftEther プロジェクト http://www.softether.org/ で無償配布されているオープンソースのフリーソフトです。\r\nSoftEther VPN ソフトウェアは国立大学法人筑波大学とソフトイーサ株式会社との共同研究契約の一環として広く公開されているものです。SoftEther VPN ソフトウェアは学術実験目的で開発・公開されております。SoftEther VPN ソフトウェアに含まれる不具合等についてのサポート等は提供されておらず、利用者がすべての責任を負うことになります。本ソフトウェアの開発者・配布者は、SoftEther VPN ソフトウェアの利用の結果、利用者に生じる損失等について、一切責任を負いません。\r\n\r\nこれらのことに合意いただいた上で、SoftEther VPN Server を用いた通信をお楽しみください。\r\n\r\nSoftEther VPN について詳しくは http://www.softether.org/ をご参照ください。\r\n\r\n - - -# NAT Traversal に関する警告 -NATT_MSG ** NAT Traversal 接続 - 安定性低下の可能性があります **\r\n\r\nVPN Client は VPN Server '%S' に NAT トラバーサル (UDP ホールパンチング) モードで接続しました。\r\n\r\nNAT トラバーサルによって、VPN Client は NAT やファイアウォールの背後にある VPN Server に、それらの NAT やファイアウォールでのポートフォワーディングの設定を行うことなく接続することができます。\r\n\r\nしかし、NAT トラバーサルは UDP をベースとした通信を使用するため、VPN セッションが不安定になる原因となる場合があります。たとえば、安価な NAT ルータが VPN Server と VPN Client との間に存在する場合、NAT トラバーサル上の VPN トンネルは 5 分ごとに切断される場合があります。また、安価な ISP が大規模な NAT を使用している場合にも NAT トラバーサルは不安定になります。これはルータや ISP の品質の問題であり、SoftEther VPN の問題ではありません。\r\n\r\nこれを解決するためには、NAT トラバーサルを使用するのではなく、直接 TCP/IP によって VPN Server のリスナーポートに VPN Client が接続することができるようにします。そのためには、VPN Server のリスナーポートがインターネットに対して公開されるように、NAT におけるポートフォワーディング設定を行ってください。NAT におけるポートフォワーディング設定の方法は、NAT の管理者に問い合わせるか、NAT 製品の説明書をお読みください。\r\n\r\nVPN Server が TCP ポートをインターネットに対して公開しているにも関わらずこのメッセージが表示される場合は、VPN Client の接続設定画面で「NAT-T 無効」をチェックしてください。\r\n\r\n -NATT_MSG2 ** NAT Traversal 接続 - 安定性低下の可能性があります **\r\n\r\nVPN Client は VPN Server '%S' に NAT トラバーサル (UDP ホールパンチング) モードで接続しました。\r\n\r\nNAT トラバーサルによって、VPN Client は NAT やファイアウォールの背後にある VPN Server に、それらの NAT やファイアウォールでのポートフォワーディングの設定を行うことなく接続することができます。\r\n\r\nしかし、NAT トラバーサルは UDP をベースとした通信を使用するため、VPN セッションが不安定になる原因となる場合があります。たとえば、安価な NAT ルータが VPN Server と VPN Client との間に存在する場合、NAT トラバーサル上の VPN トンネルは 5 分ごとに切断される場合があります。また、安価な ISP が大規模な NAT を使用している場合にも NAT トラバーサルは不安定になります。これはルータや ISP の品質の問題であり、SoftEther VPN の問題ではありません。\r\n\r\nこれを解決するためには、NAT トラバーサルを使用するのではなく、直接 TCP/IP によって VPN Server のリスナーポートに VPN Client が接続することができるようにします。そのためには、VPN Server のリスナーポートがインターネットに対して公開されるように、NAT におけるポートフォワーディング設定を行ってください。NAT におけるポートフォワーディング設定の方法は、NAT の管理者に問い合わせるか、NAT 製品の説明書をお読みください。\r\n\r\nVPN Server が TCP ポートをインターネットに対して公開しているにも関わらずこのメッセージが表示される場合は、VPN Client のバージョンを Build 9428 以降にアップグレードしてから、VPN Client の接続設定画面で「NAT-T 無効」をチェックしてください。\r\n\r\n - - -# 仮想 HUB 管理オプション関係 -HUB_AO_CLICK 項目名を 1 つ選択すると、その項目名に関する説明文が表示されます。 -HUB_AO_UNKNOWN この項目に関する説明文が見つかりませんでした。ドキュメント等を参照するか、項目名をもとに意味・内容を推測して利用してください。 -HUB_AO_allow_hub_admin_change_option この項目は特殊です。この項目が 1 (有効) の場合は、VPN Server 全体の管理者だけでなく仮想 HUB の管理者も自ら仮想 HUB 管理オプションを変更することができるようになります。 -HUB_AO_deny_hub_admin_change_ext_option この項目が 1 (有効) の場合は、仮想 HUB の管理者は仮想 HUB の拡張オプションの設定を変更することができなくなり、VPN Server 全体の管理者のみが仮想 HUB の拡張オプションの設定を変更することができるようになります。 -HUB_AO_no_delay_jitter_packet_loss この項目が 1 以上に設定されている場合は、仮想 HUB のアクセスリストを追加する際に遅延・ジッタ・パケットロスを生成させるためのパラメータが設定されている場合であっても、それらの値をすべて削除します。これにより、遅延・パケットロス生成機能が実質的に無効になります。遅延・パケットロス生成機能は VPN Server の CPU およびメモリ使用率を高くする可能性があるため、多くのユーザーで共有する仮想 HUB の場合は、高負荷を避けるためにこのオプションを使用してください。 -HUB_AO_max_users この項目が 1 以上に設定されている場合は、仮想 HUB に登録できるユーザーの最大数がこの項目の指定数に制限され、それ以上のユーザーオブジェクトを登録することはできなくなります。 -HUB_AO_max_multilogins_per_user この項目が 1 以上に設定されている場合は、仮想 HUB に登録されている 1 個のユーザーオブジェクトに対して同時にログインし接続可能な VPN セッション数がこの項目の指定数に制限され、それ以上の VPN セッションが同一のユーザーオブジェクトを用いて VPN サーバーに接続することができなくなります。 -HUB_AO_max_groups この項目が 1 以上に設定されている場合は、仮想 HUB に登録できるグループの最大数がこの項目の指定数に制限され、それ以上のグループオブジェクトを登録することはできなくなります。 -HUB_AO_max_accesslists この項目が 1 以上に設定されている場合は、仮想 HUB に登録できるアクセスリスト項目の最大数がこの項目の指定数に制限され、それ以上のアクセスリスト項目を登録することはできなくなります。 -HUB_AO_max_sessions_client_bridge_apply この項目が 1 以上に設定されている場合のみ、max_sessions_client および max_sessions_bridge の値が適用されます。 -HUB_AO_max_sessions この項目が 1 以上に設定されている場合は、仮想 HUB に接続できる VPN セッション数がこの項目の指定数に制限され、それ以上の VPN 接続を同時に処理することはできなくなります。 -HUB_AO_max_sessions_client この項目が 1 以上に設定されている場合は、仮想 HUB に接続できる VPN クライアントセッション数がこの項目の指定数に制限され、それ以上の VPN 接続を同時に処理することはできなくなります。この項目は、max_sessions_client_bridge_apply が 1 以上に設定されている場合のみ有効です。 -HUB_AO_max_sessions_bridge この項目が 1 以上に設定されている場合は、仮想 HUB に接続できる VPN ブリッジセッション数がこの項目の指定数に制限され、それ以上の VPN 接続を同時に処理することはできなくなります。この項目は、max_sessions_client_bridge_apply が 1 以上に設定されている場合のみ有効です。 -HUB_AO_max_bitrates_download この項目が 1 以上に設定されている場合は、仮想 HUB に接続するすべての VPN セッションのセキュリティポリシーのうち [ダウンロード帯域幅] ポリシーの値がこの項目の指定数に強制的に変更され、セッションのダウンロード速度が制限されます。たとえば、この値が 1000000 になっている場合は、この仮想 HUB に対するいかなる VPN 接続セッションでもそのダウンロード通信速度は 1 Mbps を超えることはできなくなります。 -HUB_AO_max_bitrates_upload この項目が 1 以上に設定されている場合は、仮想 HUB に接続するすべての VPN セッションのセキュリティポリシーのうち [アップロード帯域幅] ポリシーの値がこの項目の指定数に強制的に変更され、セッションのアップロード速度が制限されます。たとえば、この値が 1000000 になっている場合は、この仮想 HUB に対するいかなる VPN 接続セッションでもそのアップロード通信速度は 1 Mbps を超えることはできなくなります。 -HUB_AO_deny_empty_password この項目が 1 (有効) の場合は、仮想 HUB に登録されているユーザーに空のパスワードを設定することはできなくなります。もし空のパスワードが設定されているユーザーがいる場合は、そのユーザーは VPN 接続を行うことはできません (例外として、localhost からの接続は可能です)。 -HUB_AO_deny_bridge この項目が 1 (有効) の場合は、仮想 HUB に対して接続されるセッションは、接続時のユーザーのセキュリティポリシーの内容にかかわらず常にブリッジが禁止されます。したがって、この仮想 HUB にブリッジ目的で接続することができなくなります。 -HUB_AO_deny_routing この項目が 1 (有効) の場合は、仮想 HUB に対して接続されるセッションは、接続時のユーザーのセキュリティポリシーの内容にかかわらず常にルータ動作が禁止されます。したがって、この仮想 HUB にルーティング目的で接続することができなくなります。 -HUB_AO_deny_qos この項目が 1 (有効) の場合は、仮想 HUB に対して接続されるセッションは、接続時のユーザーのセキュリティポリシーの内容にかかわらず常に QoS 機能が禁止されます。 -HUB_AO_deny_change_user_password この項目が 1 (有効) の場合は、仮想 HUB のユーザーが「パスワード認証」モードの場合、自分でパスワードを変更することができなくなります。 -HUB_AO_no_change_users この項目が 1 (有効) の場合は、仮想 HUB の管理者は仮想 HUB に新しいユーザーを追加したり、既存のユーザーを削除または編集したりすることができなくなります。 -HUB_AO_no_change_groups この項目が 1 (有効) の場合は、仮想 HUB の管理者は仮想 HUB に新しいグループを追加したり、既存のグループを削除または編集したりすることができなくなります。 -HUB_AO_no_securenat この項目が 1 (有効) の場合は、仮想 HUB の管理者は SecureNAT 機能を有効または無効にすることができなくなります。 -HUB_AO_no_securenat_enablenat この項目が 1 (有効) の場合は、仮想 HUB の管理者は SecureNAT 機能における仮想 NAT 機能を有効または無効にすることができなくなります。 -HUB_AO_no_securenat_enabledhcp この項目が 1 (有効) の場合は、仮想 HUB の管理者は SecureNAT 機能における仮想 DHCP サーバー機能を有効または無効にすることができなくなります。 -HUB_AO_no_cascade この項目が 1 (有効) の場合は、仮想 HUB の管理者はカスケード接続を作成・削除・編集またはオンライン化 / オフライン化することができなくなります。 -HUB_AO_no_online この項目が 1 (有効) の場合は、仮想 HUB の管理者はオフライン状態の仮想 HUB をオンライン化することができなくなります。 -HUB_AO_no_offline この項目が 1 (有効) の場合は、仮想 HUB の管理者はオンライン状態の仮想 HUB をオフライン化することができなくなります。 -HUB_AO_no_change_log_config この項目が 1 (有効) の場合は、仮想 HUB の管理者は仮想 HUB のログファイルの保存設定を変更することができなくなります。 -HUB_AO_no_disconnect_session この項目が 1 (有効) の場合は、仮想 HUB の管理者は仮想 HUB に接続されている VPN セッションを指定して強制切断することができなくなります。 -HUB_AO_no_delete_iptable この項目が 1 (有効) の場合は、仮想 HUB の管理者は仮想 HUB の IP アドレステーブルデータベースから IP アドレスエントリを指定して削除することができなくなります。 -HUB_AO_no_delete_mactable この項目が 1 (有効) の場合は、仮想 HUB の管理者は仮想 HUB の MAC アドレステーブルデータベースから MAC アドレスエントリを指定して削除することができなくなります。 -HUB_AO_no_enum_session この項目が 1 (有効) の場合は、仮想 HUB の管理者は仮想 HUB に現在接続している VPN セッションの一覧を列挙できなくなります。 -HUB_AO_no_query_session この項目が 1 (有効) の場合は、仮想 HUB の管理者は仮想 HUB に現在接続している VPN セッションを指定して、そのセッションに関する詳細情報を取得することができなくなります。 -HUB_AO_no_change_admin_password この項目が 1 (有効) の場合は、仮想 HUB の管理者は仮想 HUB の管理者パスワードを変更できなくなります。 -HUB_AO_no_change_log_switch_type この項目が 1 (有効) の場合は、仮想 HUB の管理者は仮想 HUB のログファイルの保存設定のうち、[ログファイルの切り替え周期] 設定項目を変更できなくなります。 -HUB_AO_no_change_access_list この項目が 1 (有効) の場合は、仮想 HUB の管理者は仮想 HUB のアクセスリストを操作することができなくなります。 -HUB_AO_no_change_access_control_list この項目が 1 (有効) の場合は、仮想 HUB の管理者は仮想 HUB のアクセス元 IP 制限リストを操作することができなくなります。 -HUB_AO_no_change_cert_list この項目が 1 (有効) の場合は、仮想 HUB の管理者は仮想 HUB の「信頼する証明機関の証明書一覧」リストを操作することができなくなります。 -HUB_AO_no_change_crl_list この項目が 1 (有効) の場合は、仮想 HUB の管理者は仮想 HUB の「無効な証明書」リストを操作することができなくなります。 -HUB_AO_no_read_log_file この項目が 1 (有効) の場合は、仮想 HUB の管理者は仮想 HUB のログファイルを管理接続を通じて列挙したり、リモートから読み出したりすることができなくなります。 -HUB_AO_no_change_msg この項目が 1 (有効) の場合は、仮想 HUB の管理者は仮想 HUB に VPN Client が接続する際に VPN Client に表示されるべきメッセージを設定することができなくなります。 -HUB_AO_no_access_list_include_file この項目が 1 (有効) の場合は、仮想 HUB の管理者は仮想 HUB にアクセスリストを追加する際に送信元または宛先ユーザー名として "include:" または "exclude:" 指定でユーザー名リストファイルを指定することができなくなります。 - - -# 仮想 HUB 拡張オプション関係 -HUB_AO_NoAddressPollingIPv4 この項目が 1 (有効) の場合は、通常、仮想 HUB が 5 秒ごとに実施するセグメント内の MAC アドレステーブルおよび IPv4 アドレステーブルのメンテナンス (IPv4 デバイスの生存確認のための ARP パケットの送信) を実施しないようになります。一定時間無通信の IPv4 デバイスは、仮想 HUB のセグメントに存在していても、一定時間 (1 分~ 10 分間) でテーブルから消去されるようになります。これによりブロードキャストパケット数を削減することができますが、いくつかの IPv4 関係のセキュリティポリシーが実質的に機能しなくなることがあります。 -HUB_AO_NoAddressPollingIPv6 この項目が 1 (有効) の場合は、通常、仮想 HUB が 5 秒ごとに実施するセグメント内の MAC アドレステーブルおよび IPv6 アドレステーブルのメンテナンス (IPv6 デバイスの生存確認のための ICMPv6 パケットの送信) を実施しないようになります。一定時間無通信の IPv6 デバイスは、仮想 HUB のセグメントに存在していても、一定時間 (1 分~ 10 分間) でテーブルから消去されるようになります。これによりブロードキャストパケット数を削減することができますが、いくつかの IPv6 関係のセキュリティポリシーが実質的に機能しなくなることがあります。 -HUB_AO_NoIpTable この項目が 1 (有効) の場合は、仮想 HUB は IP アドレステーブルを内部的に自動構築しないようになります。これにより VPN Server の CPU およびメモリの使用量を削減することができますが、いくつかの IP 関係のセキュリティポリシーが実質的に機能しなくなることがあります。 -HUB_AO_NoMacAddressLog この項目が 1 (有効) の場合は、仮想 HUB は、仮想 HUB の MAC アドレステーブルに新しい MAC アドレスが登録された場合のログをセキュリティログに書きこまないようになります。 -HUB_AO_ManageOnlyPrivateIP この項目が 1 (有効) の場合は、仮想 HUB が内部的に構築する IPv4 アドレステーブルにはプライベート IPv4 アドレスのみが格納されるようになります。ここでのプライベート IPv4 アドレスとは、10.0.0.0/8, 172.16.0.0/12, 192.168.0.0/16, 169.254.0.0/16 を意味します。それ以外の IPv4 アドレスは IPv4 アドレステーブルに格納されないようになります。 -HUB_AO_ManageOnlyLocalUnicastIPv6 この項目が 1 (有効) の場合は、仮想 HUB が内部的に構築する IPv6 アドレステーブルにはローカルユニキャスト IPv6 アドレスのみが格納されるようになります。ここでのローカルユニキャスト IPv6 アドレスとは、fe80::/10 を意味します。それ以外の IPv6 アドレスは IPv6 アドレステーブルに格納されないようになります。 -HUB_AO_DisableIPParsing この項目が 1 (有効) の場合は、仮想 HUB は内部的にすべての Ethernet パケットの IP ヘッダを解釈しないようになります。これにより VPN Server の CPU およびメモリの使用量を削減することができますが、仮想 HUB は IP アドレステーブルを内部的に自動構築しないようになり、いくつかの IP 関係のセキュリティポリシーが実質的に機能しなくなることがあります。 -HUB_AO_YieldAfterStorePacket この項目が 1 (有効) の場合は、仮想 HUB はある VPN セッションからパケットを受け取った後、そのパケットを他の VPN セッションにストア・フォワードした直後に一旦 CPU を待機状態に設定します。これによりパケットの遅延が若干短くなる可能性がありますが、スレッドコンテキストスイッチ回数が増加することによりパフォーマンスが低下する可能性もあります。 -HUB_AO_FilterPPPoE この項目が 1 (有効) の場合は、仮想 HUB はすべての PPPoE (PPP over Ethernet) パケットを破棄し、転送しないようにします。複数の LAN 同士をブリッジ接続する場合で、両方の PPPoE セグメントを分割したい場合に便利です。 -HUB_AO_FilterOSPF この項目が 1 (有効) の場合は、仮想 HUB はすべての OSPF (Open Shortest Path First) パケットを破棄し、転送しないようにします。 -HUB_AO_FilterIPv4 この項目が 1 (有効) の場合は、仮想 HUB はすべての IPv4 パケットおよび ARP パケットを破棄し、転送しないようにします。 -HUB_AO_FilterIPv6 この項目が 1 (有効) の場合は、仮想 HUB はすべての IPv6 パケットを破棄し、転送しないようにします。 -HUB_AO_FilterNonIP この項目が 1 (有効) の場合は、仮想 HUB はすべての非 IP パケット (IPv4, ARP, IPv6 以外の種類のパケット) を破棄し、転送しないようにします。なお、仮想 HUB を通過するすべてのタグ VLAN パケットは非 IP パケットとしてみなされます。 -HUB_AO_FilterBPDU この項目が 1 (有効) の場合は、仮想 HUB はすべての BPDU (Bridge Protocol Data Unit) パケットを破棄し、転送しないようにします。これにより、すべてのスパニング・ツリーパケットが伝送されなくなります。 -HUB_AO_NoIPv6DefaultRouterInRAWhenIPv6 この項目が 1 (有効) の場合は、仮想 HUB に対して接続されるすべての VPN セッションは [IPv6 ルータ広告からデフォルトルータ指定を削除 (IPv6 物理接続時自動有効化)] ポリシーが自動的に有効になります。VPN Client または VPN Bridge から VPN Server に対する接続および通信に利用する物理的なプロトコルが IPv6 の場合には、その VPN セッションに対して、仮想 HUB の他のセッションの IPv6 ルータが発信する IPv6 ルータ広告メッセージのルータ有効期間の値が 0 以外の数値の場合、この値を強制的に 0 に書き換えて伝送します。これにより、VPN クライアントコンピュータが VPN 接続した先のネットワークに存在するルータをデフォルトルータとして利用することにより物理的な IPv6 通信が途切れてしまう誤作動を防止することができます。 -HUB_AO_NoLookBPDUBridgeId この項目が 1 (有効) の場合は、仮想 HUB は BPDU (Bridge Protocol Data Unit) パケットの内容をもとに MAC アドレステーブルを構築する際に BPDU パケット内のフィールドに記載されている送信元 MAC アドレスを無視し、Ethernet ヘッダに記載されている送信元 MAC アドレスをもとに MAC アドレステーブルを構築します。この値はネットワークに非常に詳しい方以外は変更しないでください。 -HUB_AO_NoManageVlanId この項目が 1 (有効) の場合は、仮想 HUB は MAC アドレステーブルの構築および検索において VLAN ID を管理しないようにし、すべての Ethernet パケットの VLAN タグを無視します。 -HUB_AO_VlanTypeId VLAN タグの Ethernet Type ID (TPID) の値を 10 進数で指定します。この値はデフォルトでは 33024 (16 進数で 0x8100) です。この値はネットワークに非常に詳しい方以外は変更しないでください。 -HUB_AO_FixForDLinkBPDU この項目が 1 (有効) の場合は、FixForDLinkBPDU オプションが有効になります。この値はネットワークに非常に詳しい方以外は変更しないでください。 -HUB_AO_NoIPv4PacketLog この項目が 1 (有効) の場合は、仮想 HUB を流れるすべての IPv4 パケットに関するパケットログが保存されないようになります。 -HUB_AO_NoIPv6PacketLog この項目が 1 (有効) の場合は、仮想 HUB を流れるすべての IPv6 パケットに関するパケットログが保存されないようになります。 -HUB_AO_NoSpinLockForPacketDelay この項目が 1 (有効) の場合は、仮想 HUB のアクセスリストによってパケットに遅延を発生させる場合において、遅延時間を高精細にシミュレーションするためにスピンロックを使用せず、OS によるタイマ割り込みによって遅延を発生させるようにします。これにより CPU 使用率が低下しますが、発生させることができる遅延の精度は低くなります。 -HUB_AO_BroadcastStormDetectionThreshold 大量のブロードキャストパケットが仮想 HUB に同一のセッションから投入された場合に、ブロードキャストストームであると判定するための閾値を指定します。1 秒間あたりのパケット個数を指定します。指定しない場合 (0 の場合) は 32 が使用されます。 -HUB_AO_ClientMinimumRequiredBuild この項目が 1 以上に設定されている場合は、設定されている数値よりもビルド番号が小さい VPN Client が接続してきた場合に VPN 接続を拒否します。 -HUB_AO_RequiredClientId この項目が 1 (有効) の場合は、この整数と同一の「クライアント ID」が埋め込まれている VPN Client ソフトウェアだけがこの仮想 HUB に接続でき、それ以外の VPN Client は接続できなくなります。 -HUB_AO_AdjustTcpMssValue この項目が 1 (有効) の場合は、この仮想 HUB を経由して通信が行われるすべての TCP/IP パケットの MSS (Max Segment Size) をこの項目で指定したバイト数以下になるように自動調整します。 -HUB_AO_DisableAdjustTcpMss この項目が 1 (有効) の場合は、この仮想 HUB におけるいかなる MSS (Max Segment Size) も無効にします。AdjustTcpMssValue オプションが指定されている場合や、IPsec / L2TP / EtherIP / L2TPv3 サーバー機能によって受け付けた VPN 通信が行われる場合においても、MSS の調整は行われなくなります。 -HUB_AO_NoDhcpPacketLogOutsideHub この項目が 1 (有効) の場合は、仮想 HUB 内に到達した DHCP による IP アドレス割当パケットのうち、この仮想 HUB に接続されているセッションと無関係のものについてログを保存しないようにします。 -HUB_AO_DisableHttpParsing この項目が 1 (有効) の場合は、仮想 HUB は内部的にすべての HTTP パケットの HTTP ヘッダを解釈しないようになります。これにより VPN Server の CPU およびメモリの使用量を削減することができますが、HTTP アクセスログが保存されなくなります。 -HUB_AO_DisableUdpAcceleration この項目が 1 (有効) の場合は、この仮想 HUB に対して接続されるすべての VPN セッションにおいて UDP 高速化機能の使用を禁止します。 -HUB_AO_DisableUdpFilterForLocalBridgeNic この項目が 1 (有効) の場合は、仮想 HUB 内で作成されるローカルブリッジを構成する物理的な LAN カードが VPN を経由して遠隔地の DHCP サーバーから IP アドレスの割当を受けることで動作が不安定になる問題を解決するための DHCP パケットフィルタリング動作を無効にします。 -HUB_AO_ApplyIPv4AccessListOnArpPacket この項目が 1 (有効) の場合は、仮想 HUB 内で定義されている IPv4 アクセスリストのルールを ARP パケットにも適用します。不要な ARP 要求パケットを遮断したい場合に便利です。 -HUB_AO_RemoveDefGwOnDhcpForLocalhost この項目が 1 (有効) の場合は、DHCP サーバーが仮想 HUB に接続された VPN クライアントに IP アドレスを割当てる際に、当該 VPN クライアントが VPN Server が動作しているコンピュータと同一である場合は DHCP 応答パケットからデフォルトゲートウェイの指定を削除します。これにより、意図しない無限ループを防止することができます。 -HUB_AO_SecureNAT_MaxTcpSessionsPerIp この項目が 0 以外に設定されている場合は、SecureNAT 機能を利用する VPN クライアント 1 台あたりの TCP コネクション数 (SYN_SENT 状態以外の TCP コネクション) のこの項目で指定した数に制限されます。 -HUB_AO_SecureNAT_MaxTcpSynSentPerIp この項目が 0 以外に設定されている場合は、SecureNAT 機能を利用する VPN クライアント 1 台あたりの TCP コネクション数 (SYN_SENT 状態の TCP コネクション) のこの項目で指定した数に制限されます。 -HUB_AO_SecureNAT_MaxUdpSessionsPerIp この項目が 0 以外に設定されている場合は、SecureNAT 機能を利用する VPN クライアント 1 台あたりの UDP セッション数のこの項目で指定した数に制限されます。 -HUB_AO_SecureNAT_MaxDnsSessionsPerIp この項目が 0 以外に設定されている場合は、SecureNAT 機能を利用する VPN クライアント 1 台あたりの DNS セッション数のこの項目で指定した数に制限されます。 -HUB_AO_SecureNAT_MaxIcmpSessionsPerIp この項目が 0 以外に設定されている場合は、SecureNAT 機能を利用する VPN クライアント 1 台あたりの ICMP セッション数のこの項目で指定した数に制限されます。 -HUB_AO_AccessListIncludeFileCacheLifetime 仮想 HUB のアクセスリストのエントリにユーザー名が "include:" または "exclude:" 形式で指定されており、外部ファイルを参照している場合、当該外部ファイルを読み込んでからメモリにキャッシュする時間を秒単位で指定します。 -HUB_AO_DisableKernelModeSecureNAT この項目が 1 (有効) の場合は、SecureNAT 機能におけるカーネルモード NAT を無効にします。カーネルモード NAT は、SecureNAT の仮想 NAT 機能の動作速度を高速化するための機能であり、VPN Server プロセスがシステム権限で動作している場合に使用できます。カーネルモード NAT が原因で何らかの通信障害が発生した場合はこのオプションを使用してカーネルモード NAT を無効にしてください。 -HUB_AO_DisableUserModeSecureNAT この項目が 1 (有効) の場合は、SecureNAT 機能におけるユーザーモード NAT を無効にします。ユーザーモード NAT は、SecureNAT の仮想 NAT 機能を一般ユーザー権限で動作させるための機能であり、VPN Server プロセスが一般ユーザー権限で動作している場合でも使用できます。 -HUB_AO_DisableCheckMacOnLocalBridge この項目が 1 (有効) の場合は、ローカルブリッジ機能において MAC アドレスの重複チェックを無効にします。一部の LAN カードでは、ローカルブリッジ機能によって送出されたパケットが LAN カード内部で反射し仮想 HUB に戻ってくる場合があります。この場合、仮想 HUB は MAC アドレスの重複を自動的に検出し、反射してきたパケットを破棄します。このフラグを有効にすると、この検出チェックが無効になります。 -HUB_AO_DisableCorrectIpOffloadChecksum この項目が 1 (有効) の場合は、ローカルブリッジ機能において IP チェックサムの検査および補正処理が無効になります。IP, TCP, UDP ヘッダのチェックサムのオフロード機能が搭載されている LAN カードから送信された IP パケットが同一ホスト上で動作する VPN Server のローカルブリッジに入力された場合、当該 IP パケットのチェックサムは不正確な値が代入されている場合があります。ローカルブリッジはデフォルトでその不正確な値を検出し、正しいチェックサムの計算結果を代入します。このフラグを有効にすると、これらの補正処理が無効になります。 -HUB_AO_BroadcastLimiterStrictMode この項目が 1 (有効) の場合は、仮想 HUB 上のセッションにおけるブロードキャストストームの検出アルゴリズムにおいて、送信元 IP アドレスまたは宛先 IP アドレスのいずれか 1 個が一致していれば既存の検出用記録とヒットしたとみなします。 -HUB_AO_MaxLoggedPacketsPerMinute 1 分間あたりにパケットログに保存することができる最大のパケット数を指定します。 -HUB_AO_DoNotSaveHeavySecurityLogs 保存に負荷がかかるセキュリティログを保存しない設定をします。 -HUB_AO_DropBroadcastsInPrivacyFilterMode 送信元および宛先の両方のセッションがプライバシーフィルタモードの場合、ブロードキャストパケットを破棄します。 -HUB_AO_DropArpInPrivacyFilterMode 送信元および宛先の両方のセッションがプライバシーフィルタモードの場合、ARP パケットを破棄します。 -HUB_AO_SuppressClientUpdateNotification VPN Client のアップデート通知画面の表示を抑制します。 -HUB_AO_FloodingSendQueueBufferQuota パケットの仮想 HUB 内におけるフラッディング動作時において消費することを許容する送信キューのバッファサイズの制限値 (バイト数) を指定します。クオータは、すべての接続中の VPN セッションの送信キューの合計長さに対してグローバルに適用されます。0 を指定すると無制限になります。このオプションは、フラッディングパケットが多発するネットワークにおいてメモリ消費量が増大する問題を解決するために利用できます。 -HUB_AO_AssignVLanIdByRadiusAttribute VLAN ID の動的割り当て機能を有効にします。VPN 接続するユーザーオブジェクトのセキュリティポリシーに VLAN ID が指定されていない場合は、各 VPN セッションはユーザー認証を行った RADIUS サーバーから返却される RADIUS 属性の値に基づき VLAN が割当てられます。RADIUS 属性のうち、 "Tunnel-Pvt-Group-ID" (ID = 81) の値が使用されます。データ型は文字列である必要があります。 -HUB_AO_DenyAllRadiusLoginWithNoVlanAssign この項目が 1 (有効) の場合は、RADIUS サーバーが "Tunnel-Pvt-Group-ID" (ID = 81) の値を返却しなかった場合は VPN 接続が拒否されます。(AssignVLanIdByRadiusAttribute の値が 1 の場合に限ります。) -HUB_AO_SecureNAT_RandomizeAssignIp この項目が 1 (有効) の場合は、SecureNAT 機能における仮想 DHCP サーバーは、DHCP クライアントに対して割当てる IP アドレスを指定された IP アドレスプール内の未使用アドレスからランダムに選択するようになります。なお、既定の動作は、未使用アドレスのうち最初のアドレスを割当てるようになっています。 -HUB_AO_DetectDormantSessionInterval この項目が 0 以外の場合は、指定された秒数無通信であった VPN セッションをドーマント状態 (休止状態) として識別します。ドーマント状態の VPN セッションに対しては、仮想 HUB 内でフラッディングされるべきパケットがフラッディングされなくなります。 -HUB_AO_NoPhysicalIPOnPacketLog この項目が 1 (有効) の場合は、パケットログに送信元および宛先 VPN セッションの物理的な接続元 VPN クライアントの IP アドレスが記録されないようになります。 -HUB_AO_UseHubNameAsDhcpUserClassOption この項目が 1 (有効) の場合は、仮想 HUB は DHCP サーバーに対して IP アドレスの取得を要求する際に仮想 HUB 名を DHCP パケットの "User-Class" オプションに埋め込むようになります。この機能は、複数の仮想 HUB がある場合に、DHCP サーバーがそれぞれの仮想 HUB 用に IP プールを確保する場合に便利です。(L2TP/IPsec および OpenVPN セッションのみ対応。) -HUB_AO_UseHubNameAsRadiusNasId この項目が 1 (有効) の場合は、NAS-Identifier RADIUS 属性に仮想 HUB 名が埋め込まれます。この機能は、RADIUS サーバにおいて仮想 HUB ごとにアクセスの許可 / 拒否を設定したい場合に便利です。 - - -# Caps 関係 -# (制御文字) -CAPS_YES はい -CAPS_NO いいえ -# (タイトル) -CT_i_max_packet_size 最大 Ethernet パケットサイズ -CT_i_max_hubs 最大仮想 HUB 数 -CT_i_max_user_creation 最大作成可能ユーザー数 -CT_i_max_sessions 最大同時接続可能セッション数 -CT_i_max_clients 最大クライアントセッション数 -CT_i_max_bridges 最大ブリッジセッション数 -CT_i_max_users_per_hub 登録可能な最大ユーザー数 / 仮想 HUB -CT_i_max_groups_per_hub 登録可能な最大グループ数 / 仮想 HUB -CT_i_max_access_lists 登録可能な最大アクセスリスト数 / 仮想 HUB -CT_i_max_mac_tables MAC アドレステーブル最大サイズ / 仮想 HUB -CT_i_max_ip_tables IP アドレステーブル最大サイズ / 仮想 HUB -CT_i_max_secnat_tables SecureNAT テーブル最大サイズ / 仮想 HUB -CT_i_max_l3_sw 登録可能な最大仮想レイヤ 3 スイッチ数 -CT_i_max_l3_if 登録可能な最大仮想インターフェイス数 / レイヤ 3 スイッチ -CT_i_max_l3_table 登録可能な最大ルーティングテーブル数 / レイヤ 3 スイッチ -CT_b_bridge VPN Bridge ソフトウェアとして動作 -CT_b_standalone スタンドアロンモード -CT_b_cluster_controller クラスタコントローラモード -CT_b_cluster_member クラスタメンバモード -CT_b_vpn_client_connect VPN Client / Bridge から接続が可能 -CT_b_local_bridge ローカルブリッジ機能が使用可能 -CT_b_must_install_pcap パケットキャプチャドライバが未インストール -CT_b_tap_supported tun/tap が使用可能 (Linux のみ) -CT_b_support_config_hub 仮想 HUB の設定の変更が可能 -CT_b_support_securenat SecureNAT 機能が使用可能 -CT_b_virtual_nat_disabled 仮想 NAT 機能は無効 (仮想 DHCP 機能のみ有効) -CT_b_support_cascade カスケード接続が使用可能 -CT_b_support_cascade_cert カスケード接続時にサーバー認証が使用可能 -CT_b_support_config_log ログ保存設定の変更が可能 -CT_b_support_autodelete ログファイルの自動削除が使用可能 -CT_b_support_radius 外部認証サーバーによる認証設定が可能 -CT_b_support_config_rw リモートで Config ファイルの読み書きが可能 -CT_b_support_hub_admin_option 仮想 HUB の管理オプションが設定可能 -CT_b_support_cascade_client_cert カスケード接続時にクライアント証明書が使用可能 -CT_b_support_hide_hub 匿名ユーザーへの仮想 HUB の列挙を禁止することが可能 -CT_b_support_cluster_admin 複数サーバーに分散したクラスタの統合管理が可能 -CT_b_support_cluster クラスタの一部として動作可能 -CT_b_support_cluster_controller クラスタコントローラとして動作中 -CT_b_support_layer3 仮想レイヤ 3 スイッチ機能をサポート -CT_b_support_crl 無効な証明書の一覧を仮想 HUB ごとに設定可能 -CT_b_support_ac 接続元 IP 制限リストを仮想 HUB ごとに設定可能 -CT_b_support_read_log ログファイルのダウンロードが可能 -CT_b_support_rename_cascade カスケード接続設定の名前の変更が可能 -CT_b_support_license ライセンス管理が可能 -CT_b_support_limit_multilogin 同一ユーザーの多重ログイン数の制限を設定可能 -CT_b_support_qos VoIP / QoS 対応機能が利用可能 -CT_b_support_syslog syslog 機能が利用可能 -CT_b_cluster_hub_type_fixed クラスタ内の仮想 HUB の種類が固定されている -CT_b_beta_version ベータ版 (プレリリースビルド) である -CT_b_support_check_mac アクセスリストで MAC アドレスを指定可能 -CT_b_support_check_tcp_state TCP コネクションの状態でパケットフィルタリングが可能 -CT_b_support_network_connection_name 物理的な LAN カードの別名を取得することが可能 -CT_b_support_radius_retry_interval_and_several_servers RADIUS 認証で再試行間隔および複数サーバー指定が可能 -CT_b_support_vlan MAC アドレステーブルでタグ VLAN の ID を管理可能 -CT_b_support_hub_ext_options 仮想 HUB 拡張オプションをサポート -CT_b_support_policy_ver_3 セキュリティポリシー バージョン 3.0 をサポート -CT_b_support_ipv6_acl IPv6 アクセスリストをサポート -CT_b_support_ex_acl アクセスリストで遅延・ジッタ・パケットロスの設定をサポート -CT_b_support_acl_group アクセスリストでグループ名による条件の指定をサポート -CT_b_support_ipv6_ac IPv6 接続元 IP 制限リストをサポート -CT_b_support_eth_vlan タグ VLAN パケット透過設定ツールをサポート -CT_b_support_msg 仮想 HUB への VPN 接続時のメッセージ表示機能をサポート -CT_b_vpn3 内部バージョン 3.0 の新機能 -CT_b_vpn4 内部バージョン 4.0 の新機能 -CT_b_support_ipsec IPsec / L2TP / EtherIP / L2TPv3 サーバー機能 -CT_b_support_sstp MS-SSTP VPN サーバー機能 -CT_b_support_udp_acceleration UDP アクセラレーション機能 -CT_b_support_openvpn OpenVPN サーバー機能 -CT_b_support_ddns ダイナミック DNS クライアント機能 -CT_b_support_ddns_proxy DDNS クライアントのプロキシサーバー経由の接続 -CT_b_support_special_listener VPN over ICMP および VPN over DNS 接続の受付け -CT_b_support_redirect_url_acl アクセスリストで HTTP の URL リダイレクト機能をサポート -CT_b_is_in_vm VM (仮想マシン) 内で動作中 -CT_b_support_azure VPN Azure 機能が利用可能 -CT_b_support_aes_ni CPU AES Acceleration (AES-NI) が動作中 -CT_b_using_selow_driver SoftEther 軽量カーネルモード Ethernet ドライバを使用中 -CT_b_support_vgs VPN Gate サービス サーバー機能が利用可能 -CT_b_support_vgs_in_client VPN Gate サービス サーバー機能 (VPN Client 統合) -CT_b_is_softether 無償版またはオープンソース版の SoftEther VPN である -CT_b_suppport_push_route 静的ルーティングテーブルのプッシュ機能 -CT_b_suppport_push_route_config 静的ルーティングテーブルのプッシュ機能 (設定可) - - -# ポリシー関係 -POL_TITLE_STR ポリシー名 -POL_VALUE_STR ポリシー設定値 -POL_TYPE_BOOL ON / OFF 型 -POL_TYPE_INT 整数値型 -POL_BOOL_ENABLE 有効 -POL_BOOL_DISABLE - -POL_BOOL_DISABLE_EX - -POL_INT_ZERO - -POL_INT_COUNT %u 個 -POL_INT_SEC %u 秒 -POL_INT_BPS %u bps -POL_INT_VLAN %u - -# Ver 2.0 -POL_0 アクセスを許可 -POL_EX_0 このポリシーが設定されているユーザーは、VPN Server に VPN 接続することを許可されます。 -POL_1 DHCP パケットをフィルタリング (IPv4) -POL_EX_1 このポリシーが設定されているセッションにおける IPv4 における DHCP パケットをすべてフィルタリングします。 -POL_2 DHCP サーバーの動作を禁止 (IPv4) -POL_EX_2 このポリシーが設定されているセッションに接続しているコンピュータが DHCP サーバーとなり IPv4 アドレスや DNS サーバーの情報などを IPv4 DHCP クライアントに配布することを禁止します。 -POL_3 DHCP が割り当てた IP アドレスを強制 (IPv4) -POL_EX_3 このポリシーが設定されているセッション内の IPv4 コンピュータは、仮想ネットワーク側の DHCP サーバーが割り当てを行った IPv4 アドレスしか利用できないようにします。 -POL_4 ブリッジを禁止 -POL_EX_4 このポリシーが設定されているユーザーのセッションでは、ブリッジ接続を禁止します。ユーザーのクライアント側に Ethernet ブリッジが設定されていても、通信ができなくなります。 -POL_5 ルータ動作を禁止 (IPv4) -POL_EX_5 このポリシーが設定されているセッションでは、IPv4 ルーティングを禁止します。ユーザーのクライアント側で IP ルータが動作していても、通信ができなくなります。 -POL_6 MAC アドレスの重複を禁止 -POL_EX_6 このポリシーが設定されているセッションでは、別のセッションのコンピュータが使用中の MAC アドレスを使用することができないようにします。 -POL_7 IP アドレスの重複を禁止 (IPv4) -POL_EX_7 このポリシーが設定されているセッションでは、別のセッションのコンピュータが使用中の IPv4 アドレスを重複して使用することができないようにします。 -POL_8 ARP・DHCP・ICMPv6 以外のブロードキャストを禁止 -POL_EX_8 このポリシーが設定されているセッションでは、仮想ネットワークに対して IPv4 における ARP プロトコルと DHCP プロトコルおよび IPv6 における ICMPv6 プロトコルによるブロードキャストパケット以外のすべてのブロードキャストパケットの送受信を禁止します。 -POL_9 プライバシーフィルタモード -POL_EX_9 プライバシーフィルタモードポリシーが設定されているセッション間における直接的な通信をすべてフィルタリングします。 -POL_10 TCP/IP サーバーとしての動作を禁止 (IPv4) -POL_EX_10 このポリシーが設定されているセッションのコンピュータが TCP/IP プロトコルにおけるサーバーとしての動作を行うことを禁止します。 -POL_11 ブロードキャスト数を制限しない -POL_EX_11 このポリシーが設定されているセッションのコンピュータが通常は考えられないような異常な数のブロードキャストパケットを仮想ネットワークに送出しても自動的に制限しないようにします。 -POL_12 モニタリングモードを許可 -POL_EX_12 このポリシーが設定されているユーザーはモニタリングモードで仮想 HUB に接続することができます。モニタリングモードのセッションは仮想 HUB 内を流れるすべてのパケットをモニタリング (傍受) することができます。 -POL_13 TCP コネクション数の最大値 -POL_EX_13 このポリシーが設定されているセッションのセッション1つあたりに割り当てることができる物理的な TCP コネクション数の最大数を設定します。 -POL_14 通信タイムアウト時間 -POL_EX_14 このポリシーが設定されているセッションにおいて VPN Client / VPN Server 間の通信に障害が発生した場合、セッションを切断するまでのタイムアウト時間を秒単位で設定します。 -POL_15 MAC アドレスの上限数 -POL_EX_15 このポリシーが設定されているセッションの1セッションあたりに登録することができる MAC アドレスの数を指定します。 -POL_16 IP アドレスの上限数 (IPv4) -POL_EX_16 このポリシーが設定されているセッションの1セッションあたりに登録することができる IPv4 アドレスの数を指定します。 -POL_17 アップロード帯域幅 -POL_EX_17 このポリシーが設定されているセッションにおける仮想 HUB の外側から仮想 HUB の内側方向に入ってくるトラフィックの帯域幅を制限します。 -POL_18 ダウンロード帯域幅 -POL_EX_18 このポリシーが設定されているセッションにおける仮想 HUB の内側から仮想 HUB の外側方向に出ていくトラフィックの帯域幅を制限します。 -POL_19 ユーザーはパスワードを変更できない -POL_EX_19 このポリシーが設定されているユーザーがパスワード認証の場合、ユーザーが VPN クライアント接続マネージャなどから自分のパスワードを変更することを禁止します。 -POL_20 多重ログイン制限数 -POL_EX_20 このポリシーが設定されているユーザーが設定されている数以上の同時ログインを行うことを禁止します。ブリッジモードセッションにはこの制限は適用されません。このセキュリティポリシーは、VPN Server 3.0 以降、または多重ログイン制限機能が搭載されている VPN Server 2.0 でのみ有効です。 -POL_21 VoIP / QoS 対応機能の使用を禁止 -POL_EX_21 このポリシーが設定されているユーザーの VPN 接続セッションにおいて VoIP / QoS 対応機能の使用を禁止します。このセキュリティポリシーは、VPN Server 3.0 以降、または VoIP / QoS 対応機能が搭載されている VPN Server 2.0 でのみ有効です。 - -# Ver 3.0 -POL_22 ルータ要請/広告パケットをフィルタリング (IPv6) -POL_EX_22 このポリシーが設定されているセッションにおける IPv6 における ICMPv6 パケットのうち、メッセージの種類が 133 (ルータ要請) および 134 (ルータ広告) であるすべてのパケットをフィルタリングします。これにより、IPv6 クライアントは IPv6 における IP アドレスプレフィックス自動検出機能およびデフォルトゲートウェイ自動検出機能を利用することができなくなります。 -POL_23 ルータ広告パケットをフィルタリング (IPv6) -POL_EX_23 このポリシーが設定されているセッションに接続されている IPv6 ルータが仮想 HUB に対して発信したすべての ICMPv6 パケットのうち、メッセージの種類が 134 (ルータ広告) であるすべてのパケットをフィルタリングします。これにより、悪意のあるユーザーが不正なプレフィックスおよびデフォルトゲートウェイ情報をネットワークに流すことを禁止できます。 -POL_24 DHCP パケットをフィルタリング (IPv6) -POL_EX_24 このポリシーが設定されているセッションにおける IPv6 における DHCP パケットをすべてフィルタリングします。 -POL_25 DHCP サーバーの動作を禁止 (IPv6) -POL_EX_25 このポリシーが設定されているセッションに接続しているコンピュータが DHCP サーバーとなり IPv6 アドレスや DNS サーバーの情報などを IPv6 DHCP クライアントに配布することを禁止します。 -POL_26 ルータ動作を禁止 (IPv6) -POL_EX_26 このポリシーが設定されているセッションでは、IPv6 ルーティングを禁止します。ユーザーのクライアント側で IP ルータが動作していても、通信ができなくなります。 -POL_27 IP アドレスの重複を禁止 (IPv6) -POL_EX_27 このポリシーが設定されているセッションでは、別のセッションのコンピュータが使用中の IPv6 アドレスを重複して使用することができないようにします。 -POL_28 TCP/IP サーバーとしての動作を禁止 (IPv6) -POL_EX_28 このポリシーが設定されているセッションのコンピュータが TCP/IP プロトコルにおけるサーバーとしての動作を行うことを禁止します。 -POL_29 IP アドレスの上限数 (IPv6) -POL_EX_29 このポリシーが設定されているセッションの1セッションあたりに登録することができる IPv6 アドレスの数を指定します。IPv6 クライアントは一般的に複数個の IPv6 一時アドレスを利用することがあるため、1 セッションあたりに接続するコンピュータの台数が 1 台だけであったとしても、この値は少なくとも 20 以上に設定することを推奨します。 -POL_30 VPN Client でパスワードの保存を禁止 -POL_EX_30 このポリシーが設定されているユーザーとして VPN 接続してきた VPN Client は、ユーザー認証の方式がパスワード認証である場合において、パスワードを記憶して保存することができなくなります。これにより、ユーザーは VPN 接続を行う都度パスワードの入力を求められるようになり、セキュリティが向上します。なお、このポリシーが有効な場合は、VPN Client のバージョン 2.0 の古いクライアント PC は接続を拒否されるようになります。 -POL_31 VPN Client を一定時間で自動切断 -POL_EX_31 このポリシーが設定されている場合、VPN 接続してきた VPN Client は、接続後、指定された秒数が経過すると、自動的に VPN 接続を切断します。この場合は、自動再接続は実施されません。これにより、アクティブでないユーザーによる大量の VPN 接続を禁止することができます。なお、このポリシーが有効な場合は、VPN Client のバージョン 2.0 の古いクライアント PC は接続を拒否されるようになります。 -POL_32 IPv4 パケットをすべてフィルタリング -POL_EX_32 このポリシーが設定されているセッションでは、すべての IPv4 パケットの送受信がフィルタリングされ遮断されます。また、ARP パケットの送受信も禁止されます。 -POL_33 IPv6 パケットをすべてフィルタリング -POL_EX_33 このポリシーが設定されているセッションでは、すべての IPv6 パケットの送受信がフィルタリングされ遮断されます。 -POL_34 非 IP パケットをすべてフィルタリング -POL_EX_34 このポリシーが設定されているセッションでは、すべての非 IP パケット (IPv4, ARP, IPv6 以外の種類のパケット) の送受信がフィルタリングされ遮断されます。なお、仮想 HUB を通過するすべてのタグ VLAN パケットは非 IP パケットとしてみなされます。 -POL_35 IPv6 ルータ広告からデフォルトルータ指定を削除 -POL_EX_35 このポリシーが設定されているセッションに対して、仮想 HUB の他のセッションの IPv6 ルータが発信する IPv6 ルータ広告メッセージのルータ有効期間の値が 0 以外の数値の場合、この値を強制的に 0 に書き換えて伝送します。これにより、VPN クライアントコンピュータが VPN 接続した先のネットワークに存在するルータをデフォルトルータとして利用することにより物理的な IPv6 通信が途切れてしまう誤作動を防止することができます。 -POL_36 IPv6 ルータ広告からデフォルトルータ指定を削除 (IPv6 接続時自動有効化) -POL_EX_36 [IPv6 ルータ広告からデフォルトルータ指定を削除] ポリシーが無効である場合でも、VPN Client または VPN Bridge から VPN Server に対する接続および通信に利用する物理的なプロトコルが IPv6 の場合には自動的に [IPv6 ルータ広告からデフォルトルータ指定を削除] ポリシーが有効に設定されているものとみなして動作するようにします。 -POL_37 VLAN ID (IEEE802.1Q) -POL_EX_37 このポリシーで VLAN ID を設定することができます。VLAN ID ポリシーが設定されているセッションでは、そのセッションのユーザーが仮想 HUB に対して送信するすべての Ethernet フレームに自動的に VLAN タグ (IEEE 802.1Q 準拠) が付加されます。また、そのセッションのユーザーは同一の VLAN ID が書き込まれた VLAN タグ付きのフレームのみを受信することができます (受信の際には、自動的に VLAN タグは除去されます)。他の ID の VLAN タグが付いているか、または VLAN タグが付いていないフレームは受信できません。VLAN ID ポリシーが設定されていないセッションでは、すべての Ethernet フレームが送受信でき、VLAN タグの自動付与や除去は実施されません。なお、仮想 HUB を通過するすべてのタグ VLAN パケットは非 IP パケットとしてみなされます。また、タグ VLAN パケットは仮想 HUB における IPv4 / IPv6 に関係するセキュリティポリシー、アクセスリストおよびその他の IPv4 / IPv6 パケット固有の処理の適用対象となりません。 - - -# リモート接続ダイアログ関係 -REMOTE_DEF_CAPTION リモート接続 -REMOTE_DEF_TITLE リモート接続先のコンピュータを指定してください。 - - -# クライアント通知サービス関係 -CN_TITLE SoftEther VPN Client Developer Edition - - -# 接続マネージャ関係 -CM_TITLE SoftEther VPN Developer Edition クライアント接続マネージャ -CM_PW_LOCALMACHINE このコンピュータ -CM_NO_REMOTE %s で動作している VPN Client サービスは、リモートからの操作を許可していません。 -CM_CONNECT_FAILED %s で動作している VPN Client サービスに接続できませんでした。\r\nVPN Client サービスが起動し、正しく動作しているかどうか確認してください。 -CM_BAD_PASSWORD パスワードが誤っています。再度入力してください。パスワードを入力するときは大文字と小文字に注意してください。 -CM_NUM_CONN_COUNT VPN 接続中: %u アカウント -CM_CONN_NO 未接続 -CM_PRODUCT_NAME SoftEther VPN Client Build %u -CM_ACCOUNT_COLUMN_1 接続設定名 -CM_ACCOUNT_COLUMN_2 状態 -CM_ACCOUNT_COLUMN_3 接続先 VPN サーバー -CM_ACCOUNT_COLUMN_3_2 仮想 HUB 名 -CM_ACCOUNT_COLUMN_4 仮想 LAN カード名 -CM_VLAN_COLUMN_1 仮想 LAN カード名 -CM_VLAN_COLUMN_2 状態 -CM_VLAN_COLUMN_3 MAC アドレス -CM_VLAN_COLUMN_4 バージョン -CM_ACCOUNT_OFFLINE オフライン -CM_ACCOUNT_ONLINE 接続完了 -CM_ACCOUNT_CONNECTING 接続処理中 -CM_VLAN_ENABLED 有効 (使用可能) -CM_VLAN_DISABLED 無効 (使用不可) -CM_DELETE_ACCOUNT_MSG 接続設定 "%s" を削除します。よろしいですか? -CM_ST_ACCOUNT_NAME 接続設定名 -CM_ST_CONNECTED セッション接続状態 -CM_ST_CONNECTED_TRUE 接続完了 (セッション確立済み) -CM_ST_CONNECTED_FALSE 接続試行中 -CM_ST_CONNECTING VPN サーバーに接続開始中 -CM_ST_NEGOTIATION ネゴシエーション中 -CM_ST_AUTH ユーザー認証中 -CM_ST_ESTABLISHED コネクション確立済み -CM_ST_RETRY 再試行中 -CM_ST_IDLE アイドル状態 -CM_ST_SERVER_NAME サーバー名 -CM_ST_SERVER_PORT ポート番号 -CM_ST_PORT_TCP TCP ポート %u -CM_ST_SERVER_P_NAME サーバー製品名 -CM_ST_SERVER_P_VER サーバーバージョン -CM_ST_SERVER_P_BUILD サーバービルド番号 -CM_ST_START_TIME 接続開始時刻 -CM_ST_FIRST_ESTAB_TIME 初回セッションの確立時刻 -CM_ST_NONE - -CM_ST_CURR_ESTAB_TIME 現在のセッションの確立時刻 -CM_ST_NUM_ESTABLISHED セッション確立回数 -CM_ST_NUM_STR %u 回 -CM_ST_HALF_CONNECTION 半二重 TCP コネクションモード -CM_ST_HALF_TRUE はい (半二重モード) -CM_ST_HALF_FALSE いいえ (全二重モード) -CM_ST_QOS VoIP / QoS 対応機能 -CM_ST_QOS_TRUE 有効 (使用中) -CM_ST_QOS_FALSE 無効 -CM_ST_NUM_TCP TCP コネクション数 -CM_ST_NUM_TCP_UPLOAD 上り方向 TCP コネクション数 -CM_ST_NUM_TCP_DOWNLOAD 下り方向 TCP コネクション数 -CM_ST_MAX_TCP TCP コネクション数最大値 -CM_ST_VLAN_ID VLAN ID -CM_ST_NO_VLAN - -CM_ST_USE_ENCRYPT 暗号化の使用 -CM_ST_USE_ENCRYPT_TRUE はい (暗号化アルゴリズム: %S) -CM_ST_USE_ENCRYPT_TRUE2 はい -CM_ST_USE_ENCRYPT_FALSE いいえ (暗号化なし) -CM_ST_USE_COMPRESS 圧縮の使用 -CM_ST_UDP_ACCEL_ENABLED UDP 高速化機能をサポート -CM_ST_UDP_ACCEL_USING UDP 高速化機能を使用中 -CM_ST_RUDP TCP over UDP (NAT Traversal) -CM_ST_UNDERLAY_PROTOCOL 物理通信に使用中のプロトコル -CM_ST_COMPRESS_TRUE はい (約 %u %%) -CM_ST_COMPRESS_FALSE いいえ (圧縮無し) -CM_ST_SESSION_NAME セッション名 -CM_ST_CONNECTION_NAME コネクション名 -CM_ST_SESSION_KEY セッションキー (160bit) -CM_ST_BRIDGE_MODE ブリッジ / ルータモード -CM_ST_MONITOR_MODE モニタリングモード -CM_ST_YES はい -CM_ST_NO いいえ -CM_ST_SEND_SIZE 送信データサイズ -CM_ST_RECV_SIZE 受信データサイズ - -CM_ST_SEND_UCAST_NUM 送信ユニキャストパケット数 -CM_ST_SEND_UCAST_SIZE 送信ユニキャスト合計サイズ -CM_ST_SEND_BCAST_NUM 送信ブロードキャストパケット数 -CM_ST_SEND_BCAST_SIZE 送信ブロードキャスト合計サイズ - -CM_ST_RECV_UCAST_NUM 受信ユニキャストパケット数 -CM_ST_RECV_UCAST_SIZE 受信ユニキャスト合計サイズ -CM_ST_RECV_BCAST_NUM 受信ブロードキャストパケット数 -CM_ST_RECV_BCAST_SIZE 受信ブロードキャスト合計サイズ - -CM_ST_NUM_PACKET_STR %S パケット -CM_ST_SIZE_BYTE_STR %S バイト - -CM_NEW_ICON 新しい接続設定の作成 -CM_VGC_ICON VPN Gate 公開 VPN 中継サーバー -CM_VGC_LINK VPN Gate 学術実験 Web サイト -CM_ST_TITLE %s の接続状況 -CM_ST_COLUMN_1 項目名 -CM_ST_COLUMN_2 状況 -CM_NEW_ACCOUNT_NAME_1 新しい接続 -CM_NEW_ACCOUNT_NAME_2 新しい接続 (%u) -CM_ACCOUNT_TITLE_1 新しい接続設定のプロパティ -CM_ACCOUNT_TITLE_2 %s のプロパティ -CM_SERVER_CERT_1 固有証明書の登録(&R) -CM_SERVER_CERT_2 固有証明書の削除(&0) -CM_CLIENT_CERT_1 クライアント証明書の指定(&8) -CM_CLIENT_CERT_2 クライアント証明書の削除(&8) -CM_CERT_INFO 発行先: %s\r\n発行者: %s\r\n有効期限: %s -CM_NO_CERT ユーザー認証に使用するクライアント証明書を指定する必要があります。 -CM_NO_SECURE ユーザー認証に使用するスマートカード内のクライアント証明書と秘密鍵を指定してください。 -CM_CERT_SECURE_INFO 証明書: "%S"\r\n秘密鍵: "%S" -CM_SELECT_SECURE_DEVICE 使用スマートカード選択(&J) -CM_SELECT_CERT_INCARD 証明書と秘密鍵の指定(&7) -CM_VIEW_CLIENT_CERT クライアント証明書の表示(&7) -CM_NO_VLAN 新しい接続設定を作成する前に、仮想 LAN カードを作成してください。\r\n\r\n仮想 LAN カードを作成しますか? -CM_NO_VLAN_2 VPN Server に接続する前に、仮想 LAN カードを作成してください。\r\n\r\n仮想 LAN カードを作成しますか? -CM_VLAN_REMOTE_ERROR 仮想 LAN カードはリモートから作成することができません。\r\n\rVPN Client サービスが動作しているローカルコンピュータ上で VPN クライアント接続マネージャを起動し、仮想 LAN カードをインストールしてください。 -CM_9X_VLAN_INSTALL 新しい仮想 LAN カードを作成します。\r\n\r\n仮想 LAN カードを作成した場合、直ちに Windows を再起動する必要があります。\r\nまた、仮想 LAN カードのインストール中に Windows のインストール CD-ROM が必要になる場合があります。\r\n\r\nVPN クライアント接続マネージャ以外のすべての作業中のアプリケーションを終了し、Windows のインストール CD-ROM を用意してから、[OK] をクリックしてください。\r\n[OK] をクリックすると、仮想 LAN カードのインストールが開始されます。その後、自動的に Windows が再起動します。 -CM_9X_VLAN_ME_MESSAGE 仮想 LAN カードを作成しました。[OK] をクリックすると、コンピュータを自動的に再起動します。\r\n\r\n再起動後、新しいデバイスのインストールウィザードが表示される場合があります。\r\nその場合は、[次へ] を数回クリックしてドライバのインストールを完了させてください。 -CM_9X_VLAN_UNINSTALL 仮想 LAN カードの削除は、ネットワークのプロパティから行ってください。\r\n\r\nネットワークのプロパティ画面を表示しますか? -CM_PORT_1 8888 (PX-VPN ポート) -CM_PORT_2 443 (HTTPS ポート) -CM_PORT_3 992 (telnets ポート) -CM_PORT_4 5555 (SE-VPN ポート) -CM_RETRY_INTERVAL_ERROR 再接続間隔は 5 秒以上に設定してください。 -CM_DELETE_CLIENT_CERT 設定されているクライアント証明書を削除します。よろしいですか? -CM_DELETE_SERVER_CERT 設定されているサーバー固有証明書を削除します。よろしいですか? -CM_SET_STARTUP 接続設定 "%s" をスタートアップ接続に設定しました。\r\n\r\nこのアカウントは次回のコンピュータ起動時に自動的に接続されます。\r\n(Windows をお使いの場合は、Windows の起動直後に接続が開始されます。\r\nユーザーがログオンする前にバックグラウンドで接続されます。) -CM_REMOVE_STARTUP 接続設定 "%s" のスタートアップ接続属性を解除しますか? -CM_NO_DISCONNECT_SPAN TCP コネクションの寿命を設定してください。 -CM_HALF_MSG 半二重モードを使用する場合は TCP コネクション数は 2 以上に設定してください。 -CM_TOO_SMALL_INTERVAL TCP コネクションの確立間隔は 1 秒以上に設定してください。 -CM_DELETE_VLAN 仮想 LAN カード "%s" を削除します。よろしいですか? -CM_COPY_NAME_1 コピー ~ %s -CM_COPY_NAME_2 コピー (%u) ~ %s -CM_IMPORT_NAME_1 %s -CM_IMPORT_NAME_2 %s (%u) -CM_CERT_COLUMN_1 発行先 -CM_CERT_COLUMN_2 発行者 -CM_CERT_COLUMN_3 有効期限 -CM_CERT_DELETE_MSG この証明書をリストから削除しますか? -CM_PASSWORD_SET パスワードを設定しました。 -CM_PASSWORD_REMOVE パスワード設定を解除しました。 -CM_UNDER_CONSTRUCTION 未完成です。 -CM_CURRENT_ACTIVE 接続設定 "%s" の設定を保存しましたが、現在この接続設定は VPN Server に接続中のため、設定内容は次回接続時まで適用されません。 -CM_DISCONNECT_ALL 現在接続中の %u 個の接続設定をすべて切断します。\r\nよろしいですか? -CM_HTTPS_MSG HTTP プロキシサーバー経由で接続することを選択しました。\r\n\r\n多くの HTTP プロキシサーバーは、任意の TCP ポートへのアクセスを許可していません。\r\nVPN Client は、HTTP プロキシサーバーを経由して VPN Server に接続する際、HTTPS (HTTP over SSL) 通信を行って接続することができます。\r\nこの場合は、接続先 VPN Server のポート番号を 443 (HTTPS ポート) に設定することをお勧めします。\r\n(他のポート番号の場合、HTTP プロキシサーバーを経由することができない場合があります。\r\n 接続先 VPN Server でポート 443 が有効になっていることを確認してください。)\r\n\r\n詳しい情報については、経由しようとしている HTTP プロキシサーバーのシステム管理者やネットワーク管理者にお問い合わせください。\r\n\r\n接続先 VPN Server のポート番号指定を 443 (HTTPS ポート) に変更しますか? -CM_REMOTE_WARNING [リモート管理の設定] を許可しない設定に変更しようとしています。\r\n\r\n現在、VPN クライアント接続マネージャはリモートコンピュータ "%S" に接続し、このコンピュータ上の VPN Client サービスを制御しています。\r\nリモート接続を無効にした場合、コンピュータ "%S" の VPN Client サービスにリモートから VPN クライアント接続マネージャによって接続し、制御することはできなくなります。\r\n\r\nリモート管理を無効にしますか? -CM_KEEP_INTERVAL_MSG [パケット送出間隔] には %u 秒から %u 秒までの値を設定してください。 -CM_REMOTE_TITLE 別のコンピュータ上で動作している VPN Client サービスを VPN クライアント接続マネージャから接続し、リモート管理することができます。\r\n(ただし、接続先のコンピュータの VPN Client サービスがリモート管理を許可している必要があります。) -CM_DESKTOP_LOCAL_PC このコンピュータ -CM_DESKTOP_REMOTE_PC コンピュータ %S -CM_DESKTOP_MSG_LOCAL_TS ターミナルサービス (リモートデスクトップ) 機能 -CM_DESKTOP_MSG_LOCAL_SW ユーザーの切り替え機能 -CM_DESKTOP_MSG_LOCAL_1 現在、このコンピュータには%sがインストールされており、複数のユーザーが同時にログオンできる環境になっています。この場合、VPN Client が表示する進行状況のメッセージやエラーメッセージなどは、「コンソールセッション」と呼ばれるセッション上に表示されます。 -CM_DESKTOP_MSG_LOCAL_21 現在、このコンピュータのコンソールセッションは 「セッション ID: 0、ユーザー %s」 に割り当てられていますが、あなたはセッション %u で VPN クライアント接続マネージャを起動しているため、VPN Client が表示する進行状況やエラーなどのメッセージウインドウを表示することができません。 -CM_DESKTOP_MSG_LOCAL_22 現在、このコンピュータのコンソールセッション (セッション ID: 0) には誰もログオンしておらず、あなたはセッション %u で VPN クライアント接続マネージャを起動しているため、VPN Client が表示する進行状況やエラーなどのメッセージウインドウを表示することができません。 -CM_DESKTOP_MSG_LOCAL_31 コンピュータのコンソールセッション (セッション ID: 0、ユーザー %s) を表示してから、そのセッション内で VPN クライアント接続マネージャを起動し、接続設定 "%s" への接続を開始することをお勧めします。このまま接続処理を開始することもできますが、その場合は途中で表示される可能性のある進行状況やエラー メッセージをすべて確認できない場合があります。 -CM_DESKTOP_MSG_LOCAL_32 一度ログオフし、ローカルログオンし直してから、そのセッション内で VPN クライアント接続マネージャを起動し、接続設定 "%s" への接続を開始することをお勧めします。このまま接続処理を開始することもできますが、その場合は途中で表示される可能性のある進行状況やエラー メッセージをすべて確認できない場合があります。 -CM_DESKTOP_MSG_REMOTE_1 現在、コンピュータ %S 上の VPN Client に対してリモート接続して操作を行っているため、接続設定への VPN 接続中に VPN Client が進行状況のメッセージやエラーメッセージなどを表示した場合、そのメッセージを現在の画面で確認することはできません。 -CM_DESKTOP_MSG_REMOTE_2 VPN Client が表示する進行状況やエラーなどのメッセージウインドウをすべて確認するには、コンピュータ %S にローカルログオンして、コンソールセッション (デスクトップ) を表示しておく必要があります。 -CM_DESKTOP_MSG_REMOTE_3 コンピュータ %S にコンソールセッションとして直接ローカルログオンしてから、そのセッション内で VPN クライアント接続マネージャを起動し、接続設定 "%s" への接続を開始することをお勧めします。このまま接続処理を開始することもできますが、その場合は途中で表示される可能性のある進行状況やエラー メッセージをすべて確認できない場合があります。 -CM_STOP_INST_VLAN_1 このコンピュータで仮想 LAN カードのインストール作業を行うには、「コンソールセッション」 上で VPN クライアント接続マネージャを起動する必要があります。\r\n\r\n現在、このコンピュータには%sがインストールされており、現在のユーザーはコンソールセッションではなくリモートセッション (セッション ID: %u) としてログオンしています。\r\n仮想 LAN カードのインストール作業を行うには、コンソールセッション (セッション ID: %u、ユーザー %s がログオン中) 上で VPN クライアント接続マネージャを起動する必要があります。\r\n\r\nユーザーの切り替え機能を使用するか、リモートデスクトップの /console スイッチ機能を使用するか、またはコンピュータのローカルコンソールデバイスを使用してコンピュータにローカルログオンしてから VPN クライアント接続マネージャを起動し、仮想 LAN カードのインストール作業を行ってください。 -CM_STOP_INST_VLAN_2 このコンピュータで仮想 LAN カードのインストール作業を行うには、「コンソールセッション」 上で VPN クライアント接続マネージャを起動する必要があります。\r\n\r\n現在、このコンピュータには%sがインストールされており、現在のユーザーはコンソールセッションではなくリモートセッション (セッション ID: %u) としてログオンしています。\r\n仮想 LAN カードのインストール作業を行うには、コンソールセッション上で VPN クライアント接続マネージャを起動する必要があります。\r\n(現在、コンソールセッション (セッション ID: 0) にはユーザーがログオンしていません。)\r\n\r\nユーザーの切り替え機能を使用するか、リモートデスクトップの /console スイッチ機能を使用するか、またはコンピュータのローカルコンソールデバイスを使用してコンピュータにローカルログオンしてから VPN クライアント接続マネージャを起動し、仮想 LAN カードのインストール作業を行ってください。 -CM_SHORTCUT_DESKTOP_MSG 接続設定へのショートカットを使用して接続を開始するには、「コンソールセッション」上でショートカットファイルを起動する必要があります。\r\n\r\n現在のユーザーはコンソールセッションではなくリモートセッション (セッション ID: %u) としてログオンしています。 -CM_HTTP_PROXY_WARNING [HTTP プロキシサーバー経由接続] が選択されています。\r\n\r\n多くの場合、HTTP プロキシサーバーは接続先サーバーのポート番号として、HTTP プロトコル (TCP ポート 80 番) および HTTPS プロトコル (TCP ポート 443 番) の 2 種類の TCP ポートに対する接続のみを許可しています。\r\n(プロキシサーバーが任意の TCP ポートに対する接続を許可している場合もあります。)\r\n\r\nHTTP ポートまたは HTTPS ポート以外へのサーバー ポートへの接続を禁止している HTTP プロキシサーバーを経由して VPN 接続を行う場合は、接続先 VPN Server のポート番号は 443 (HTTPS プロトコル) に指定する必要があります。\r\n\r\n経由する HTTP プロキシサーバーが 80 番または 443 番ポート以外への接続を許可しているかどうかを確認するには、HTTP プロキシサーバーの管理者にお問い合わせください。\r\n\r\n現在、接続先 VPN Server のポート番号は %d が指定されていますが、ポート番号を 443 番 (HTTPS プロトコル) に変更しますか?\r\n(接続する VPN Server のポート 443 において接続を待ち受ける設定になっている必要があります。)\r\n不明な場合は、システム管理者またはネットワーク管理者にお問い合わせください。 -CM_HTTP_HEADER_COLUMN_0 Name -CM_HTTP_HEADER_COLUMN_1 Value -CM_PASSWORD_CHANGED パスワードが変更されました。 -CM_ACCOUNT_SETTING_FILE 接続設定ファイル (*.VPN)|*.vpn|すべてのファイル (*.*)|*.* -CM_ACCOUNT_SAVE_TITLE エクスポート先の接続設定ファイル名を入力してください。 -CM_ACCOUNT_OPEN_TITLE インポートする接続設定ファイルを選択してください。 -CM_ACCOUNT_FILE_BANNER # VPN Client 接続設定ファイル\r\n# \r\n# このファイルは VPN クライアント接続マネージャによってエクスポートされたものです。\r\n# このファイルの内容はテキストエディタで編集することができます。\r\n# \r\n# このファイルをクライアント接続マネージャにインポートすると、すぐに使用する\r\n# ことができます。\r\n\r\n -CM_FAILED_TO_OPEN_FILE ファイルを開くことができませんでした。 -CM_FAILED_TO_SAVE_FILE ファイルを保存することができませんでした。 -CM_ACCOUNT_PARSE_FAILED 指定されたファイルから接続設定を読み込むことができませんでした。\r\nファイルの内容を確認してください。 -CM_ACCOUNT_MSG_SENSITIVE この接続設定にはユーザー名とパスワード情報が保存されています。\r\nユーザー名とパスワード情報を接続設定ファイルから消去しますか?\r\n\r\n[はい] をクリックすると、接続設定ファイルから認証情報を削除します。\r\nこの場合は、接続設定をインポートしたユーザーは VPN 接続時にユーザー名とパスワードの入力を求められます。\r\n\r\n[いいえ] をクリックすると、接続設定ファイルに認証情報を格納したままにします。 -CM_SHORTCUT_FILE ショートカットファイル|*.lnk -CM_SHORTCUT_SAVE_TITLE ショートカットファイル名を入力してください。 -CM_SHORTCUT_UNSUPPORTED このバージョンの VPN Client では、接続ショートカット機能をサポートしていません。\r\n新しいバージョンにアップデートしてください。 -CM_SHORTCUT_COMMENT 接続設定「%s」を使用して VPN Server に接続します。 -CM_SHORTCUT_ERROR ショートカットの作成に失敗しました。 -CM_VPN_FILE_CLICKED 接続設定ファイルをインポートしますか? -CM_VPN_FILE_IMPORT_NG 接続設定ファイルをインポートできません。VPN Client の設定がロックされています。 -CM_VLAN_INSTALLING しばらくお待ちください... -CM_SECURE_MUST_LOCAL 現在リモートコンピュータの VPN Client サービスに接続して管理しているため、スマートカードの設定を行うことはできません。 -CM_DETAIL_MODE_LINK_STR カスケード接続では、常に [ブリッジ / ルータモードで接続] が有効になっています。 -CM_TRAY_INITING SoftEther VPN クライアント接続マネージャ (Developer Edition) -CM_TRAY_NOT_CONNECTED SoftEther VPN クライアント接続マネージャ (Developer Edition)\r\n接続していません -CM_TRAY_CONNECTED_0 SoftEther VPN クライアント接続マネージャ (Developer Edition)\r\n%u 個のサーバーとの接続が完了し、%u 個のサーバーに接続を試行しています -CM_TRAY_CONNECTED_1 SoftEther VPN クライアント接続マネージャ (Developer Edition)\r\n%u 個のサーバーに接続を試行しています -CM_TRAY_CONNECTED_2 SoftEther VPN クライアント接続マネージャ (Developer Edition)\r\n%u 個のサーバーと接続が完了しています -CM_TRAY_MENU_1_SHOW 接続マネージャを表示する(&S) -CM_TRAY_MENU_1_HIDE 接続マネージャを閉じる(&O) -CM_TRAY_MENU_2_QUIT 接続マネージャプログラムの終了(&X) -CM_TRAY_MENU_CONNECT VPN 接続を開始(&C) -CM_TRAY_MENU_DISCONNECT VPN 接続を切断(&D) -CM_TRAY_MENU_STATUS 接続状態を表示(&I) -CM_TRAY_MENU_DISCONNECT_ALL すべての接続を切断(&A) -CM_TRAY_MENU_NEW 接続設定の新規作成(&N)... -CM_TRAY_MENU_RECENT 最近接続した VPN サーバー(&Y) -CM_TRAY_MENU_TRAFFIC 通信スループット測定ツール(&R)... -CM_TRAY_MENU_NETIF ネットワークデバイスの状態を表示(&D)... -CM_TRAY_MENU_ABOUT 接続マネージャのバージョン情報(&A)... -CM_TRAY_MENU_SETTING 動作モードの変更(&M)... -CM_TRAY_MENU_CANCEL このメニューを閉じる -CM_EXIT_MESSAGE VPN クライアント接続マネージャプログラムを終了します。\r\nよろしいですか? -CM_IMPORT_MESSAGE ファイル "%S" から接続設定 "%s" をインポートしました。 -CM_VLAN_CREATING 新しい VPN 用仮想 LAN カードを作成し、Windows に追加しています。\r\n\r\nこの処理には数秒から数十秒かかる場合があります。\r\nしばらくお待ちください...\r\n\r\n(仮想 LAN カードの作成中は他の操作はしないでください。) -CM_SETTING_PASSWORD 設定ロック機能が有効になっています。解除するにはパスワードを入力する必要があります。 -CM_EASY_MODE_NOT_ON_REMOTE リモートコンピュータの VPN Client の動作モードが [簡易モード] のため、接続できません。 -CM_EASY_CONNECT_BUTTON_1 VPN 接続を開始(&C) -CM_EASY_CONNECT_BUTTON_2 切断(&D) -CM_EASY_ACCOUNT_WARNING 設定がロックされているため、[経由するプロキシサーバーの設定]、[ユーザー認証] および [使用する仮想 LAN カード] のみが変更できます。 -CM_EASY_INFO_1 VPN 接続先を選択してください。 -CM_EASY_INFO_2 [VPN 接続を開始] ボタンをクリックすると VPN 接続を開始します。 -CM_EASY_INFO_3 VPN 接続中です。[切断] ボタンで切断できます。 -CM_EXT_VOICE_MSG 拡張音声ガイドの音声メッセージの内容は、一部正常に再生されない可能性があります。\r\n拡張音声ガイドを有効にしますか? -CM_EASY_TITLE VPN クライアント簡易接続マネージャ -CM_EASY_CONNECTED VPN 接続が完了しました。 -CM_EASY_CONNECTING VPN 接続の実行中... -CM_PROXY_FROM_IE 現在の Internet Explorer のプロキシサーバーの設定を読み込みました。 -CM_TRAY_ICON_RESTORE タスクトレイのアイコンを消去しました。\r\n\r\nアイコンを復活させるには、VPN クライアント接続マネージャを起動し、通常モードで [表示] メニューの [タスクトレイのアイコンを表示] をクリックしてください。 -CM_WOULDYOULOAD_IE_PROXY 現在、このコンピュータは Internet Explorer の設定でプロキシサーバー "%S" を使用するように設定されています。\r\n今回作成する新しい接続設定では、Internet Explorer のプロキシサーバー設定を用いて VPN 接続するようにしますか?\r\n\r\n[はい] をクリックすると、Internet Explorer のプロキシサーバー設定を使用します。\r\n[いいえ] をクリックすると、プロキシサーバーを使用せずに直接 VPN 接続するように設定します。\r\nこの設定は、いつでも接続設定のプロパティ画面から変更できます。 -CM_MSG_TITLE VPN サーバー "%S" (仮想 HUB: "%S") -CM_JUMPLIST_RCCONNECT 最近の接続先 -CM_VPNGATE_MESSAGE VPN Gate 学術実験プロジェクトの Web サイトには、公開 VPN 中継サーバーの一覧が公開されています。\r\nこれらの VPN サーバーには、誰でもユーザー登録なしで VPN 接続することができます。\r\n\r\nVPN Gate 学術実験プロジェクトは SoftEther VPN の一部ではありません。\r\nこのアイコンは http://www.vpngate.net/ へのリンクを提供しているに過ぎません。\r\nVPN Gate に接続するためには、VPN Gate Plugin をインストールする必要があります。\r\n\r\nhttp://www.vpngate.net/ (筑波大学における学術実験サイト) を開きますか? -CM_VLAN_REINSTALL_MSG 仮想 LAN カードのドライバを再インストールすると、MAC アドレスが変更になります。また、仮想 LAN カードに関する TCP/IP などのネットワーク設定は初期化されます。続行しますか?\r\n\r\nなお、仮想 LAN カードのドライバを再インストールしても正常に動作しない場合は、新たに別の名前で仮想 LAN カードを作成してください。 - - -# VPN Gate Service 関係 -VGC_COLUMN_0 DDNS 名 -VGC_COLUMN_1 IP アドレス (ホスト名) -VGC_COLUMN_2 国・地域 -VGC_COLUMN_3 起動時間 -VGC_COLUMN_4 VPN 接続数 -VGC_COLUMN_5 回線速度 -VGC_COLUMN_6 Ping (Google, SE) -VGC_COLUMN_7 SSL-VPN (TCP) -VGC_COLUMN_8 UDP サポート -VGC_COLUMN_9 ログ保存ポリシー -VGC_COLUMN_10 累積通信量 -VGC_COLUMN_11 累積ユーザー数 -VGC_COLUMN_12 運営者 -VGC_COLUMN_13 運営者によるメッセージ -VGC_COLUMN_14 スコア - -VGC_LOG_PERMANENT 恒久的に保存 -VGC_LOG_2WEEKS 2 週間保存 -VGC_LOG_NONE ログ無効 - -VGC_UPTIME_MIN %u 分間 -VGC_UPTIME_HOUR %u 時間 -VGC_UPTIME_DAY %u 日間 -VGC_NUM_VPN %u セッション -VGC_NUM_LOGIN %S 人 - -VGC_UDP_AVAILABLE UDP OK - -VGC_TITLE VPN Gate プラグインに関するメッセージ - -VGC_VER_DIFF この VPN Gate Client プラグインのバージョンが SoftEther VPN Client のバージョンと異なっています。\r\n\r\n現在の VPN Gate プラグイン: ビルド %u\r\n現在の SoftEther VPN Client: ビルド %u\r\n\r\nVPN Gate プラグインの最新版 (ビルド %u) をダウンロードしてインストールすることをお勧めします。最新版にアップデートしない場合、VPN 通信エラーやリスト更新エラーが発生する場合があります。もし何度も VPN サーバーリストの更新に失敗する場合は VPN Gate プラグインのバージョンをアップデートしてください。\r\n\r\n最新版の VPN Gate プラグインの入手: http://www.vpngate.net/\r\n(もし上記サイトに直接アクセスできない場合はミラーサイトを経由してアクセスしてください。)\r\n\r\n - -VGC_LIST_STR_OK 地球上に %S 台の公開 VPN 中継サーバー (%S に更新) -VGC_LIST_STR_OK_2 %S 台のサーバー (%S に更新) - リスト取得失敗。最新版の VPN Gate Client をダウンロードしてください。 -VGC_LIST_STR_NG リスト取得失敗。最新版の VPN Gate Client をダウンロードしてください。 -VGC_PROXY_MSG プロキシサーバーを経由する必要があるネットワーク環境の内部からは、「SSL-VPN 接続」で TCP ポート 443 がサポートされていない VPN 中継サーバーにはアクセスできない場合があります。 -VGC_PROXY_TITLE プロキシサーバーに関するご注意 - -VGS_NO_HUB_YET メッセージを設定するには、最初にまず VPN Gate サービス コントロールパネルで VPN Gate サービスを有効にして [OK] をクリックしてから、再度このウインドウを開いてください。 - -VGS_STOP VPN Gate サービスを停止します。\r\n\r\nVPN Gate サービスを停止すると、このコンピュータは新たな VPN 接続を受付けなくなりますが、現在アクティブな VPN セッションは残る場合があります。\r\n(それらの VPN セッションは列挙されない場合があります。)\r\n\r\nアクティブな VPN セッションを削除するためには、VPN Gate サービスを停止した後は直ちに SoftEther VPN Server または SoftEther VPN Client サービスを再起動するか、コンピュータを再起動してください。 - -VGS_START VPN Gate 中継サービス機能を有効にします。\r\nこのコンピュータで VPN Gate 中継サービス機能を有効にすると、このコンピュータは、任意の VPN Gate ユーザーからの VPN 接続を受け付け、通信を中継することができるようになります。\r\n\r\nVPN Gate 中継サービス機能は、ユーザーの責任で有効にしてください。\r\n法令によって VPN による暗号化通信が禁止されている国があります。\r\nVPN Gate 中継サービス機能について詳しくは http://www.vpngate.net/ja/join.aspx をお読みください。\r\n\r\nVPN Gate 学術実験サービスは、日本国に所在する筑波大学大学院における研究プロジェクトとして運営されているサービスです。本サービスは日本国の法令にのみ準拠して運用されており、日本国以外の国・地域の法令については一切関知しておりません。\r\n\r\nそもそも世界には 200 カ国近くの国が存在しており、それぞれの国における法律は互いに異なります。すべての国の法律を調査した上でそれらすべてに適合することを保証したソフトウェアを開発することは事実上不可能です。万一ユーザーが本サービスを特定の国・地域の領域内で利用したことによって公務員により法的なペナルティを科せられるなどの損害が発生した場合であっても、プロジェクト実施者は一切責任を負いません。\r\n本ソフトウェアまたはサービスを使用する際には、ユーザーが適用されるすべての法令をユーザーの責任により遵守してください。本ソフトウェアまたはサービスを日本国内・国外を問わず使用された場合に発生するすべての損害と責任は、ユーザーに帰責します。本学術実験の運営者およびソフトウェアの供給者は、一切責任を負いません。\r\nこれらの注意事項に同意いただけない場合は、VPN Gate 学術実験サービスに関連する機能を使用しないでください。 - - -# サービス関係 (Win32) -SVC_HELP [ %s (%S) のコマンドライン引数 ]\r\n\r\nこのプログラム (%s) はバックグラウンドで稼動するプロセスです。以下のコマンドライン引数を与えて起動してください。\r\n\r\n\r\n/install …… %s サービス (サービス名: %S) を Windows にインストールします。その後自動的にサービスを起動します。\r\n\r\n/uninstall …… %s サービス (サービス名: %S) を Windows からアンインストールします。\r\n\r\n/start … %s サービス (サービス名: %S) を起動します。\r\n\r\n/stop … %s サービス (サービス名: %S) を停止します。\r\n\r\n/test … %s プログラムをテストモードで起動します。(デバッグ用)\r\n\r\n/usermode … %s プログラムをユーザーモードで起動します。(可能な場合)\r\n\r\n/usermode_showtray … ユーザーモードで起動する際、以前タスクトレイのアイコンを非表示に設定したことがある場合は、アイコンを回復します。\r\n\r\n/usermode_hidetray … ユーザーモードで起動する際、タスクトレイのアイコンを非表示にします。\r\n\r\n\r\n※ /test および /usermode 以外のサービス操作系コマンドは Windows 98 / Me では動作しません。 -SVC_NT_ONLY サービス系の操作コマンドは Windows 98 / Me では動作しません。 -SVC_ALREADY_INSTALLED サービス %s (サービス名 %S) はすでにこのコンピュータにインストールされています。一度アンインストールしてから、再インストールしますか? -SVC_INSTALL_OK サービス %s (サービス名 %S) を正しくインストールしました。\r\n\r\n(実行パス: %s)\r\n\r\nサービスの起動が完了しました。 -SVC_INSTALL_FAILED サービス %s (サービス名 %S) のインストールに失敗しました。 -SVC_INSTALL_FAILED_2 サービス %s (サービス名 %S) を正しくインストールしました。\r\n\r\n(実行パス: %s)\r\n\r\nただし、サービスの起動に失敗しました。 -SVC_NOT_INSTALLED サービス %s (サービス名 %S) はコンピュータにインストールされていません。/install コマンドライン引数を使用してインストールしてください。 -SVC_START_OK サービス %s (サービス名 %S) の起動が完了しました。 -SVC_START_FAILED サービス %s (サービス名 %S) の起動に失敗しました。 -SVR_ALREADY_START サービス %s (サービス名 %S) はすでに起動しています。 -SVC_STOP_OK サービス %s (サービス名 %S) を停止しました。 -SVC_STOP_FAILED サービス %s (サービス名 %S) の停止に失敗しました。 -SVC_ALREADY_STOP サービス %s (サービス名 %S) はすでに停止しています。 -SVC_UNINSTALL_OK サービス %s (サービス名 %S) をアンインストールしました。 -SVC_UNINSTALL_FAILED サービス %s (サービス名 %S) のアンインストールに失敗しました。 -SVC_NOT_FOUND サービス %S に関する情報が文字列テーブル内から見つかりませんでした。 -SVC_NOT_ADMIN サービスをインストール / アンインストール / 起動 / 停止するには、このコンピュータの Administrators 権限 (システム管理者権限) が必要です。\r\n\r\nこのコンピュータの Administrators アカウントを持っている場合は、Administrators アカウントとしてログオンし直してください。\r\nAdministrators アカウントが不明な場合は、システム管理者にお問い合わせください。 -SVC_TEST_MSG サービス %s をテストモードで起動しています。\r\n\r\n[OK] をクリックすると終了します。 -SVC_TRAY_TOOLTIP %S (ユーザーモード) -SVC_TEST_MUTEX すでに実行可能ファイル %s が起動しています。 -SVC_USERMODE_MUTEX すでに %s の別のプロセスが起動しています。 -SVC_SERVICE_MUTEX サービス %S のプロセス %s がすでに起動しているため、サービスを開始できません。 -SVC_USERMODE_MENU_1 タスクトレイアイコンを非表示にする(&H) -SVC_USERMODE_MENU_2 %s の終了(&X) -SVC_HIDE_TRAY_MSG %S のユーザーモード起動時のタスクトレイアイコンを非表示にします。\r\n次回以降 %S をユーザーモードで起動した際に、タスクトレイにアイコンが表示されなくなります。\r\nプロセスを終了するメニューも表示されなくなります。\r\n\r\nプロセスを終了するには、Windows 98 / Me の場合は Ctrl + Alt + Del キーを押して [プログラムの強制終了] を使用してください。\r\nそれ以外の OS の場合は [タスクマネージャ] を使用してください。\r\n\r\nタスクトレイアイコンの表示を復活させるには、次回のユーザーモード起動時に /usermode_showtray オプションを使用してください。 - - -# サービス関係 (UNIX) -UNIX_SVC_HELP %S service program\nCopyright (c) all contributors on SoftEther VPN project in GitHub.\nCopyright (c) Daiyuu Nobori, SoftEther Project at University of Tsukuba, and SoftEther Corporation.\nAll Rights Reserved.\n\n%S command usage:\n %S start - Start the %S service.\n %S stop - Stop the %S service if the service has been already started.\n\n -UNIX_SVC_STARTED The %S service has been started.\n -UNIX_SVC_STOPPING Stopping the %S service ...\n -UNIX_SVC_STOPPED %S service has been stopped.\n -UNIX_SVC_STOP_FAILED Stopping %S service was failed.\n -UNIX_SVC_ALREADY_START %S service has been already started.\nRun the "%S stop" command to stop this service.\n -UNIX_SVC_NOT_STARTED %S service has not yet been started.\nRun the "%S start" to start this service.\n -UNIX_SVC_ERROR_FORK Failed to create child process for the %S service.\n -UNIX_SVC_NONROOT \nWarning: The current user context is non-root. It is recommended to run the VPN service by the root user. Although the VPN service may run under non-root users, some privilege-required functions (e.g. the local bridge function) need the root privilege.\n - - -# サービス定義 (SoftEther VPN Client) -SVC_VPNCLIENT_NAME vpnclient -SVC_VPNCLIENT_TITLE SoftEther VPN Client -SVC_VPNCLIENT_DESCRIPT SoftEther VPN Client の仮想 LAN カードデバイスドライバおよび接続サービスを管理します。このサービスが停止された場合は、このコンピュータの SoftEther VPN Client を使用して SoftEther VPN Server に接続することができなくなります。 - - -# サービス定義 (SoftEther VPN Server) -SVC_VPNSERVER_NAME vpnserver -SVC_VPNSERVER_TITLE SoftEther VPN Server -SVC_VPNSERVER_DESCRIPT SoftEther VPN Server サーバー プロセスを管理します。SoftEther VPN Server は高性能の SoftEther VPN Server 機能を TCP/IP プロトコルを通じて提供します。このサービスが停止された場合は、このコンピュータの SoftEther VPN Server は停止し、SoftEther VPN Client はこのコンピュータに VPN 接続することができなくなります。 - - -# サービス定義 (SoftEther VPN Bridge) -SVC_VPNBRIDGE_NAME vpnbridge -SVC_VPNBRIDGE_TITLE SoftEther VPN Bridge -SVC_VPNBRIDGE_DESCRIPT SoftEther VPN Bridge プロセスを管理します。SoftEther VPN Bridge はこのコンピュータに接続されているネットワークと遠隔地にある SoftEther VPN Server との間をブリッジ接続します。このサービスが停止された場合は、このコンピュータの SoftEther VPN Bridge は停止し、ブリッジ接続を経由した通信ができなくなります。 - - -# サービス定義 (SoftEther VPN Client) -SVC_SEVPNCLIENTDEV_NAME sevpnclientdev -SVC_SEVPNCLIENTDEV_TITLE SoftEther VPN Client Developer Edition -SVC_SEVPNCLIENTDEV_DESCRIPT SoftEther VPN Client の仮想 LAN カードデバイスドライバおよび接続サービスを管理します。このサービスが停止された場合は、このコンピュータの SoftEther VPN Client を使用して SoftEther VPN Server に接続することができなくなります。 - - -# サービス定義 (SoftEther VPN Server) -SVC_SEVPNSERVERDEV_NAME sevpnserverdev -SVC_SEVPNSERVERDEV_TITLE SoftEther VPN Server Developer Edition -SVC_SEVPNSERVERDEV_DESCRIPT SoftEther VPN Server サーバー プロセスを管理します。SoftEther VPN Server は高性能の SoftEther VPN Server 機能を TCP/IP プロトコルを通じて提供します。このサービスが停止された場合は、このコンピュータの SoftEther VPN Server は停止し、SoftEther VPN Client はこのコンピュータに VPN 接続することができなくなります。 - - -# サービス定義 (SoftEther VPN Bridge) -SVC_SEVPNBRIDGEDEV_NAME sevpnbridgedev -SVC_SEVPNBRIDGEDEV_TITLE SoftEther VPN Bridge Developer Edition -SVC_SEVPNBRIDGEDEV_DESCRIPT SoftEther VPN Bridge プロセスを管理します。SoftEther VPN Bridge はこのコンピュータに接続されているネットワークと遠隔地にある SoftEther VPN Server との間をブリッジ接続します。このサービスが停止された場合は、このコンピュータの SoftEther VPN Bridge は停止し、ブリッジ接続を経由した通信ができなくなります。 - - -# サービス定義 (SoftEther VPN User-mode Router) -SVC_VPNROUTER_NAME vpnrouter -SVC_VPNROUTER_TITLE SoftEther VPN Router Developer Edition -SVC_VPNROUTER_DESCRIPT SoftEther VPN Router (サービスモード) のサーバー プロセスを管理します。SoftEther VPN Router はユーザーモードで動作する仮想 NAT および DHCP サーバーを提供するプログラムで、仮想 IP ネットワークと物理的な IP ネットワークとの間を簡単な操作で安全に接続することができます。このサービスが停止された場合は、このコンピュータの SoftEther VPN Router は停止し、VPN Client はこのコンピュータのルーティングサービスを利用することができなくなります。 - - -# サービス定義 (EtherLogger) -SVC_ELOGSVC_NAME elogsvc -SVC_ELOGSVC_TITLE SoftEther EtherLogger Developer Edition -SVC_ELOGSVC_DESCRIPT SoftEther EtherLogger は、コンピュータに接続されている LAN カードを流れるデータをキャプチャし、管理者が指定した種類のパケットのヘッダまたはすべてのデータをテキストファイルにログとして記録するサービスです。 - - -# SoftEther VPN サーバー管理マネージャ関係 -SM_TITLE SoftEther VPN Developer Edition サーバー管理マネージャ -SM_LOCALHOST localhost (このサーバー) -SM_SERVER_BRIDGE_TITLE VPN Bridge "%S" の管理 -SM_S_VHUB_BRIDGE VPN Bridge では、"BRIDGE" という名前の仮想 HUB に対して操作を行うことで管理します。 -SM_DISCONNECTED 管理用コネクションが切断されました。 -SM_MIKAN 未完成です。 -SM_MAIN_COLUMN_1 接続設定名 -SM_MAIN_COLUMN_2 接続先 VPN Server -SM_MAIN_COLUMN_3 管理対象 -SM_MODE_SERVER サーバー全体 -SM_MODE_HUB %S -SM_EDIT_CAPTION_1 新しい接続設定の作成 -SM_EDIT_CAPTION_2 %s の編集 -SM_SETTING_EXISTS すでに同じ名前の接続設定 "%s" が登録されています。別の名前を指定してください。 -SM_SETTING_DELETE_MSG 接続設定 "%s" を削除します。よろしいですか? -SM_PASSWORD_TYPE_STR 管理接続用パスワード -SM_HUB_COLUMN_1 仮想 HUB 名 -SM_HUB_COLUMN_2 状態 -SM_HUB_COLUMN_3 種類 -SM_HUB_COLUMN_4 ユーザー -SM_HUB_COLUMN_5 グループ -SM_HUB_COLUMN_6 セッション -SM_HUB_COLUMN_7 MAC テーブル -SM_HUB_COLUMN_8 IP テーブル -SM_HUB_COLUMN_9 ログイン回数 -SM_HUB_COLUMN_10 最終ログイン日時 -SM_HUB_COLUMN_11 最終通信日時 -SM_HUB_ONLINE オンライン -SM_HUB_OFFLINE オフライン -SM_HUB_STANDALONE スタンドアロン -SM_HUB_STATIC スタティック仮想 HUB -SM_HUB_DYNAMIC ダイナミック仮想 HUB -SM_SERVER_STANDALONE スタンドアロンサーバー -SM_FARM_CONTROLLER クラスタコントローラ -SM_FARM_MEMBER クラスタメンバサーバー -SM_INFORMATION 最新情報 -SM_HUB_STATUS_CAPTION 仮想 HUB "%s" の状態 -SM_HUB_STATUS_HUBNAME 仮想 HUB 名 -SM_HUB_STATUS_ONLINE 状態 -SM_HUB_TYPE 種類 -SM_HUB_NUM_SESSIONS セッション数 -SM_HUB_NUM_SESSIONS_CLIENT セッション数 (クライアント) -SM_HUB_NUM_SESSIONS_BRIDGE セッション数 (ブリッジ) -SM_HUB_NUM_ACCESSES アクセスリスト数 -SM_HUB_NUM_USERS ユーザー数 -SM_HUB_NUM_GROUPS グループ数 -SM_HUB_NUM_MAC_TABLES MAC テーブル数 -SM_HUB_NUM_IP_TABLES IP テーブル数 -SM_HUB_SECURE_NAT SecureNAT 機能 -SM_HUB_SECURE_NAT_YES 有効 -SM_HUB_SECURE_NAT_NO 無効 -SM_HUB_NUM_LOGIN ログイン回数 -SM_HUB_LAST_LOGIN_TIME 最終ログイン日時 -SM_HUB_LAST_COMM_TIME 最終通信日時 -SM_HUB_CREATED_TIME 作成日時 -SM_STATUS_COLUMN_1 項目 -SM_STATUS_COLUMN_2 値 - -SM_ST_SEND_UCAST_NUM 送信ユニキャストパケット数 -SM_ST_SEND_UCAST_SIZE 送信ユニキャスト合計サイズ -SM_ST_SEND_BCAST_NUM 送信ブロードキャストパケット数 -SM_ST_SEND_BCAST_SIZE 送信ブロードキャスト合計サイズ - -SM_ST_RECV_UCAST_NUM 受信ユニキャストパケット数 -SM_ST_RECV_UCAST_SIZE 受信ユニキャスト合計サイズ -SM_ST_RECV_BCAST_NUM 受信ブロードキャストパケット数 -SM_ST_RECV_BCAST_SIZE 受信ブロードキャスト合計サイズ - -SM_ST_NUM_PACKET_STR %S パケット -SM_ST_SIZE_BYTE_STR %S バイト - -CM_EDIT_HUB_1 仮想 HUB の新規作成 -CM_EDIT_HUB_2 %S のプロパティ - -CM_EDIT_HUB_STANDALONE 現在、サーバーはスタンドアロンモードで動作しています。この仮想 HUB はスタンドアロン HUB として動作します。 -CM_EDIT_HUB_TYPE_FIXED 現在、サーバーはクラスタモードで動作しています。この仮想 HUB の種類は下記のとおりで、動的な変更はできません。 -CM_EDIT_HUB_CREATED 新しい仮想 HUB %S を作成しました。 -CM_OFFLINE_MSG %s をオフラインにしますか?\r\n\r\n仮想 HUB をオフラインにすると、現在仮想 HUB に接続しているすべてのセッションが切断され、新しいセッションが接続できなくなります。 -CM_DELETE_HUB_MSG %S を削除しますか?\r\n\r\n仮想 HUB を削除すると、現在仮想 HUB に接続しているセッションがすべて切断され、新たなセッションが仮想 HUB に接続できなくなります。\r\nまた、仮想 HUB のすべての設定、ユーザー オブジェクト、グループオブジェクト、証明書、およびカスケード接続が削除されます。\r\n\r\n仮想 HUB を削除すると、元に戻すことはできません。\r\n削除しますか? -CM_HUB_DELETED_MSG 仮想 HUB %S を削除しました。 -CM_LISTENER_COLUMN_1 ポート番号 -CM_LISTENER_COLUMN_2 状態 -CM_LISTENER_TCP_PORT TCP %u -CM_LISTENER_ONLINE 動作中 -CM_LISTENER_OFFLINE 停止中 -CM_LISTENER_ERROR エラー発生 -CM_DELETE_LISTENER_MSG リスナー (TCP ポート %u) を削除します。今後、このポートには接続できなくなります。\r\nよろしいですか? -CM_STOP_LISTENER_MSG リスナー (TCP ポート %u) を停止します。リスナーを再開するまで、このポートには接続できなくなります。\r\n\r\nよろしいですか? -CM_CLOSE_BUTTON 閉じる -CM_CERT_SET_MSG 新しいサーバー証明書を設定しました。\r\n\r\nなお、OpenVPN クライアントを使用している場合は、OpenVPN 設定ファイルに埋め込まれている証明書を更新する必要がある場合がありますので、ご注意ください。 -CM_SHORTCUT_DISCONNECT 指定された接続先にすでに接続しています。\r\n\r\n切断しますか? - - - -SM_SERVER_STATUS サーバー状態 -SM_ST_SERVER_TYPE サーバーの種類 -SM_ST_NUM_TCP 開いているソケット数 -SM_ST_NUM_TCP_LOCAL このサーバーのソケット数 -SM_ST_NUM_TCP_REMOTE 他のクラスタメンバサーバーのソケット数合計 -SM_ST_NUM_HUB_TOTAL 仮想 HUB 数 -SM_ST_NUM_HUB_STATIC スタティック仮想 HUB 数 -SM_ST_NUM_HUB_DYNAMIC ダイナミック仮想 HUB 数 -SM_ST_NUM_SESSION_TOTAL セッション数 -SM_ST_NUM_SESSION_LOCAL このサーバーのセッション数 -SM_ST_NUM_SESSION_REMOTE 他のクラスタメンバサーバーのセッション数 -SM_ST_NUM_MAC_TABLE MAC アドレステーブル数 -SM_ST_NUM_IP_TABLE IP アドレステーブル数 -SM_ST_NUM_USERS ユーザー数 -SM_ST_NUM_GROUPS グループ数 -SM_ST_CLIENT_LICENSE 消費クライアント接続ライセンス数 (このサーバー) -SM_ST_BRIDGE_LICENSE 消費ブリッジ接続ライセンス数 (このサーバー) -SM_ST_CLIENT_LICENSE_EX 消費クライアント接続ライセンス数 (クラスタ全体) -SM_ST_BRIDGE_LICENSE_EX 消費ブリッジ接続ライセンス数 (クラスタ全体) -SM_ST_START_TIME サーバー起動時刻 -SM_ST_CURRENT_TIME 現在時刻 -SM_ST_CURRENT_TICK 64 bit 高精度論理システム時刻 -SM_ST_TOTAL_MEMORY 合計論理メモリサイズ -SM_ST_USED_MEMORY 使用中の論理メモリサイズ -SM_ST_FREE_MEMORY 空き論理メモリサイズ -SM_ST_TOTAL_PHYS 合計物理メモリサイズ -SM_ST_USED_PHYS 使用中の物理メモリサイズ -SM_ST_FREE_PHYS 空き物理メモリサイズ -SM_ST_RAM_SIZE_KB %S バイト -SM_INFO_TITLE 接続先 VPN Server バージョン情報 -SM_INFO_PRODUCT_NAME 製品名 -SM_INFO_VERSION バージョン情報 -SM_INFO_BUILD ビルド情報 -SM_INFO_HOSTNAME ホスト名 -SM_OS_SYSTEM_NAME オペレーティングシステム種類 -SM_OS_PRODUCT_NAME オペレーティングシステム製品名 -SM_OS_SERVICE_PACK サービスパック -SM_OS_SP_TAG Service Pack %u -SM_OS_VENDER_NAME オペレーティングシステム製造元 -SM_OS_VERSION オペレーティングシステムバージョン -SM_OS_KERNEL_NAME OS カーネル名 -SM_OS_KERNEL_VERSION OS カーネルバージョン -SM_CONNECTION_TYPE_0 クライアント -SM_CONNECTION_TYPE_1 初期化中 -SM_CONNECTION_TYPE_2 ログイン -SM_CONNECTION_TYPE_3 追加接続 -SM_CONNECTION_TYPE_4 クラスタリング RPC -SM_CONNECTION_TYPE_5 管理用 RPC -SM_CONNECTION_TYPE_6 HUB 列挙 RPC -SM_CONNECTION_TYPE_7 パスワード変更 -SM_CONNECTION_TYPE_8 MS-SSTP 接続 -SM_CONNECTION_TYPE_9 OpenVPN 接続 -SM_CONN_COLUMN_1 コネクション名 -SM_CONN_COLUMN_2 接続元 -SM_CONN_COLUMN_3 接続時刻 -SM_CONN_COLUMN_4 種類 -SM_HOSTNAME_AND_PORT %S:%u -SM_CONN_DISCONNECT_MSG コネクション %s を切断します。\r\nよろしいですか? -SM_CONNINFO_CAPTION コネクション %s の情報 -SM_CONNINFO_NAME コネクション名 -SM_CONNINFO_TYPE コネクションの種類 -SM_CONNINFO_HOSTNAME クライアントホスト名 -SM_CONNINFO_IP クライアント IP アドレス -SM_CONNINFO_PORT クライアントポート番号 (TCP) -SM_CONNINFO_TIME 接続時刻 -SM_CONNINFO_SERVER_STR サーバー製品名 -SM_CONNINFO_SERVER_VER サーバー バージョン -SM_CONNINFO_SERVER_BUILD サーバー ビルド番号 -SM_CONNINFO_CLIENT_STR クライアント製品名 -SM_CONNINFO_CLIENT_VER クライアントバージョン -SM_CONNINFO_CLIENT_BUILD クライアントビルド番号 -SM_FARM_REBOOT_MSG クラスタリング構成を変更しようとしています。\r\n\r\nクラスタリング構成を変更すると、現在接続されているすべてのセッションおよび管理用コネクション (この管理用コネクションを含む) がすべて切断され、サーバー プログラムが再起動します。\r\nサーバーのユーザー数が多い場合は、再起動に数十秒かかる場合もあります。\r\n\r\n[OK] をクリックすると、サーバーとの接続が自動的に切断されます。管理を継続するには、もう一度サーバーに接続し直してください。 -SM_FM_COLUMN_1 種類 -SM_FM_COLUMN_2 接続時刻 -SM_FM_COLUMN_3 ホスト名 -SM_FM_COLUMN_4 ポイント -SM_FM_COLUMN_5 セッション数 -SM_FM_COLUMN_6 TCP コネクション数 -SM_FM_COLUMN_7 動作 HUB 数 -SM_FM_COLUMN_8 消費クライアント接続ライセンス -SM_FM_COLUMN_9 消費ブリッジ接続ライセンス -SM_FM_CONTROLLER コントローラ -SM_FM_MEMBER メンバ -SM_FMINFO_TYPE サーバーの種類 -SM_FMINFO_CONNECT_TIME 接続確立時刻 -SM_FMINFO_IP IP アドレス -SM_FMINFO_HOSTNAME ホスト名 -SM_FMINFO_POINT ポイント -SM_FMINFO_WEIGHT 性能基準比 -SM_FMINFO_NUM_PORT 公開ポート数 -SM_FMINFO_PORT %u 個目の公開ポート (TCP/IP) -SM_FMINFO_NUM_HUB 動作している仮想 HUB 数 -SM_FMINFO_HUB %u 個目の仮想 HUB -SM_FMINFO_HUB_TAG_1 %S (ダイナミック) -SM_FMINFO_HUB_TAG_2 %S (スタティック) -SM_FMINFO_NUM_SESSION セッション数 -SM_FMINFO_NUN_CONNECTION TCP コネクション数 -SM_FMINFO_CAPTION クラスタメンバサーバーの状態 -SM_FC_STATUS_CAPTION クラスタコントローラへの接続状態 -SM_FC_IP コントローラの IP アドレス -SM_FC_PORT コントローラの TCP/IP ポート番号 -SM_FC_STATUS 接続状態 -SM_FC_ONLINE オンライン -SM_FC_OFFLINE オフライン -SM_FC_LAST_ERROR 最後に発生したエラー -SM_FC_ERROR_TAG %s (エラーコード: %u) -SM_FC_START_TIME 接続開始時刻 -SM_FC_FIRST_TIME 最初の接続確立成功時刻 -SM_FC_CURRENT_TIME 現在の接続確立成功時刻 -SM_FC_NUM_TRY 接続試行回数 -SM_FC_NUM_CONNECTED 接続に成功した回数 -SM_FC_NUM_FAILED 接続に失敗した回数 -SM_FC_NOT_CONNECTED (未接続) -SM_CHANGE_PASSWORD_1 確認入力がパスワードと一致しません。[パスワード] と [確認入力] には同一のパスワードを入力してください。 -SM_CHANGE_PASSWORD_2 パスワードが入力されていません。続行しますか? -SM_CHANGE_PASSWORD_3 パスワードを変更しました。 -SM_USER_COLUMN_1 ユーザー名 -SM_USER_COLUMN_2 本名 -SM_USER_COLUMN_3 所属グループ -SM_USER_COLUMN_4 説明 -SM_USER_COLUMN_5 認証方法 -SM_USER_COLUMN_6 ログイン回数 -SM_USER_COLUMN_7 最終ログイン日時 -SM_AUTHTYPE_0 匿名認証 -SM_AUTHTYPE_1 パスワード認証 -SM_AUTHTYPE_2 固有証明書認証 -SM_AUTHTYPE_3 署名済み証明書認証 -SM_AUTHTYPE_4 RADIUS 認証 -SM_AUTHTYPE_5 NT ドメイン認証 -SM_NO_GROUP - -SM_USER_DELETE_MSG ユーザー "%s" を削除します。よろしいですか? -SM_EDIT_USER_CAPTION_1 ユーザーの新規作成 -SM_EDIT_USER_CAPTION_2 ユーザー %S のプロパティ -SM_EDIT_USER_CERT_INFO [固有証明書認証] が選択されているユーザーは、接続時に SSL クライアント証明書が予めユーザーごとに設定された証明書と完全に一致するかどうかで接続を許可または拒否されます。 -SM_EDIT_USER_POL_DLG ユーザー %S のセキュリティポリシー -SM_POLICY_DEF_CAPTION セキュリティポリシー -SM_LIMIT_STR %u ~ %u の範囲の整数値を指定してください。 -SM_POLICY_INIT_TITLE 左のリストからポリシー項目を選択してください。 -SM_USER_CREATE_OK ユーザー %S を作成しました。 -SM_USERINFO_CAPTION ユーザー "%S" の情報 -SM_USERINFO_NAME ユーザー名 -SM_USERINFO_GROUP グループ名 -SM_USERINFO_CREATE 作成日時 -SM_USERINFO_UPDATE 更新日時 -SM_USERINFO_EXPIRE 有効期限 -SM_USERINFO_NUMLOGIN ログイン回数 -SM_GROUPLIST_NAME グループ名 -SM_GROUPLIST_REALNAME 本名 -SM_GROUPLIST_NOTE 説明 -SM_GROUPLIST_NUMUSERS ユーザー数 -SM_EDIT_GROUP_CAPTION_1 グループの新規作成 -SM_EDIT_GROUP_CAPTION_2 グループ %S のプロパティ -SM_GROUP_CREATED グループ %S を作成しました。 -SM_GROUP_DELETE_MSG グループ %S を削除します。よろしいですか? -SM_GROUP_POLICY_CAPTION グループ %S のセキュリティポリシー -SM_GROUP_MEMBER_STR \ (グループ %S に所属しているユーザーのみ表示) -SM_SELECT_GROUP 選択(&S) -SM_SELECT_NO_GROUP なし(&N) -SM_SELECT_ALT_GROUP グループを選択(&G)... -SM_ACCESS_COLUMN_0 ID -SM_ACCESS_COLUMN_1 動作 -SM_ACCESS_COLUMN_2 状態 -SM_ACCESS_COLUMN_3 優先順位 -SM_ACCESS_COLUMN_4 説明 -SM_ACCESS_COLUMN_5 内容 -SM_ACCESS_COLUMN_6 ユニーク ID -SM_ACCESS_PASS 通過 -SM_ACCESS_DISCARD 破棄 -SM_ACCESS_ENABLE 有効 -SM_ACCESS_DISABLE 無効 -SM_ACCESS_PROTO_1 すべての IPv4 / IPv6 プロトコル -SM_ACCESS_PROTO_2 6 (TCP/IP プロトコル) -SM_ACCESS_PROTO_3 17 (UDP/IP プロトコル) -SM_ACCESS_PROTO_4 1 (ICMPv4 プロトコル) -SM_ACCESS_PROTO_5 58 (ICMPv6 プロトコル) -SM_ACCESS_PROTO_6 IP プロトコル番号を指定 -SM_SELECT_USER 選択(&S) -SM_SELECT_NO 選択しない(&N) -SM_PLEASE_SELECT ユーザーを選択してください。 -SM_LINK_COLUMN_1 接続設定名 -SM_LINK_COLUMN_2 状態 -SM_LINK_COLUMN_3 接続完了時刻 -SM_LINK_COLUMN_4 接続先 VPN Server -SM_LINK_COLUMN_5 接続先仮想 HUB -SM_LINK_STATUS_OFFLINE オフライン (停止中) -SM_LINK_STATUS_ERROR エラー%u:%s -SM_LINK_STATUS_ONLINE オンライン (接続済み) -SM_LINK_POLICY_GROUP カスケード接続の設定 -SM_LINK_POLICY_CAPTION カスケードセッションに適用するセキュリティポリシーの設定 -SM_LINK_CONNECTING 接続処理中 -SM_LINK_SAVE_ONLINE カスケード接続設定 "%s" を変更しましたが、現在このカスケード接続はオンラインのため、次回接続時まで設定は適用されません。 -SM_LINK_DELETE_MSG カスケード接続 "%s" の設定を削除します。よろしいですか? -SM_LINK_OFFLINE_MSG カスケード接続 "%s" は現在接続中です。接続を切断しますか? -SM_LINK_STATUS_CAPTION カスケード接続 "%s" の接続状況 -SM_LOG_SWITCH_0 切り替えを行わない -SM_LOG_SWITCH_1 1 秒単位で切り替える -SM_LOG_SWITCH_2 1 分単位で切り替える -SM_LOG_SWITCH_3 1 時間単位で切り替える -SM_LOG_SWITCH_4 1 日単位で切り替える -SM_LOG_SWITCH_5 1 ヶ月単位で切り替える -SM_SESS_DISCONNECT_MSG セッション "%S" を切断します。よろしいですか? -SM_SESS_COLUMN_1 セッション名 -SM_SESS_COLUMN_2 場所 -SM_SESS_COLUMN_3 ユーザー名 -SM_SESS_COLUMN_4 接続元ホスト名 -SM_SESS_COLUMN_5 TCP コネクション -SM_SESS_COLUMN_6 転送バイト数 -SM_SESS_COLUMN_7 転送パケット数 -SM_SESS_COLUMN_8 VLAN ID -SM_SESS_NORMAL ローカルセッション -SM_SESS_LOCAL ローカルセッション -SM_SESS_LOCAL_2 %S 上 -SM_SESS_REMOTE %S 上 -SM_SESS_LINK カスケード接続 -SM_SESS_LINK_HOSTNAME 仮想ホスト -SM_SESS_LINK_TCP なし -SM_SESS_SNAT SecureNAT セッション -SM_SESS_SNAT_HOSTNAME 仮想ホスト -SM_SESS_SNAT_TCP なし -SM_SESS_BRIDGE ローカルブリッジセッション -SM_SESS_BRIDGE_HOSTNAME Ethernet ブリッジ -SM_SESS_LAYER3_HOSTNAME 仮想レイヤ 3 スイッチ -SM_SESS_BRIDGE_TCP なし -SM_SESS_STATUS_CAPTION VPN セッション "%S" の状況 -SM_SESS_STATUS_USERNAME ユーザー名 (認証) -SM_SESS_STATUS_REALUSER ユーザー名 (データベース) -SM_SESS_STATUS_GROUPNAME グループ名 -SM_CLIENT_IP クライアント IP アドレス -SM_CLIENT_HOSTNAME クライアントホスト名 -SM_NODE_CLIENT_NAME クライアント製品名 (申告) -SM_NODE_CLIENT_VER クライアントバージョン (申告) -SM_NODE_CLIENT_BUILD クライアントビルド番号 (申告) -SM_NODE_SERVER_NAME サーバー製品名 (申告) -SM_NODE_SERVER_VER サーバーバージョン (申告) -SM_NODE_SERVER_BUILD サーバービルド番号 (申告) -SM_NODE_CLIENT_OS_NAME クライアント OS 名 (申告) -SM_NODE_CLIENT_OS_VER クライアント OS バージョン (申告) -SM_NODE_CLIENT_OS_PID クライアント OS プロダクト ID (申告) -SM_NODE_CLIENT_HOST クライアントホスト名 (申告) -SM_NODE_CLIENT_IP クライアント IP アドレス (申告) -SM_NODE_CLIENT_PORT クライアントポート番号 (申告) -SM_NODE_SERVER_HOST サーバーホスト名 (申告) -SM_NODE_SERVER_IP サーバー IP アドレス (申告) -SM_NODE_SERVER_PORT サーバーポート番号 (申告) -SM_NODE_PROXY_HOSTNAME 経由プロキシホスト名 (申告) -SM_NODE_PROXY_IP 経由プロキシ IP アドレス (申告) -SM_NODE_PROXY_PORT 経由プロキシポート番号 (申告) -SM_MAC_COLUMN_1 セッション名 -SM_MAC_COLUMN_2 MAC アドレス -SM_MAC_COLUMN_3 作成時刻 -SM_MAC_COLUMN_4 更新時刻 -SM_MAC_COLUMN_5 場所 -SM_MAC_COLUMN_1A VLAN ID -SM_SESSION_FILTER \ (セッション %S のエントリのみ表示) -SM_IP_COLUMN_1 セッション名 -SM_IP_COLUMN_2 IP アドレス -SM_IP_COLUMN_3 作成時刻 -SM_IP_COLUMN_4 更新時刻 -SM_IP_COLUMN_5 場所 -SM_MAC_IP_DHCP %S (DHCP) -SM_MACIP_LOCAL このサーバー上 -SM_MACIP_SERVER %S 上 -SM_SNAT_STATUS SecureNAT の動作状況 -SM_SNAT_NUM_SESSION %u セッション -SM_SNAT_NUM_CLIENT %u クライアント -SM_SNAT_IS_KERNEL カーネルモード NAT で動作中 -SM_SNAT_IS_RAW Raw IP モード NAT で動作中 -SM_BRIDGE_TOO_OLD_VER 現在接続している VPN Server のバージョンでは、ローカルブリッジ機能はサポートされていません。\r\n新しいバージョンにアップデートしてみてください。 -SM_BRIDGE_UNSUPPORTED この VPN Server が動作しているオペレーティングシステム上では、ローカルブリッジ機能を使用することはできません。ローカルブリッジ機能が使用できるオペレーティングシステムの一覧については、VPN Server のオンラインドキュメントを参照してください。 -SM_BRIDGE_WPCAP_REMOTE この VPN Server 上でローカルブリッジ機能を使用するためには、WinPcap ソフトウェアをインストールする必要があります。現在、サーバー コンピュータ上には WinPcap ソフトウェアがインストールされていません。\r\n\r\nWinPcap ソフトウェアのインストールを続行するためには、VPN Server が動作しているサーバー コンピュータ上で SoftEther VPN サーバー管理マネージャを起動し、localhost (自分自身) に対して接続した状態で、ローカルブリッジ機能設定画面を表示する必要があります。\r\n続行するには、一旦この管理セッションを終了し、サーバー コンピュータ上で SoftEther VPN サーバー管理マネージャを起動してから、localhost に対して接続して、設定を続行してください。 -SM_BRIDGE_WPCAP_ROOT この VPN Server 上でローカルブリッジ機能を使用するためには、WinPcap ソフトウェアをインストールする必要があります。\r\n\r\nインストールを継続するには、このコンピュータ上で Administrators (管理者) 権限を持ったユーザーでログオンする必要があります。\r\nAdministrators 権限でログオンし、もう一度 SoftEther VPN サーバー管理マネージャを起動してください。 -SM_BRIDGE_WPCAP_INSTALL この VPN Server 上でローカルブリッジ機能を使用するためには、WinPcap ソフトウェアをインストールする必要があります。現在、サーバー コンピュータ上には WinPcap ソフトウェアがインストールされていません。\r\n\r\nWinPcap はフリーソフトウェアであり、VPN Server の一部として同梱されているため、簡単にインストールすることができます。\r\n\r\nWinPcap のインストールを開始しますか? -SM_BRIDGE_WPCAP_REBOOT1 WinPcap のインストールが完了した後にローカルブリッジ機能を使用する場合は、コンピュータを再起動する必要があります。\r\n\r\nコンピュータを手動で再起動し、VPN Server が起動した後、ローカルブリッジ機能の設定を行ってください。 -SM_BRIDGE_WPCAP_REBOOT2 WinPcap のインストールが完了した後にローカルブリッジ機能を使用する場合は、SoftEther VPN Server サービスを再起動する必要があります。\r\n\r\nSoftEther VPN Server サービスの再起動は短時間で完了しますが、現在この VPN Server に接続しているセッションはすべて切断されます。\r\nこの管理セッションも切断されるため、続行するには再接続してください。\r\n\r\nSoftEther VPN Server サービスを再起動しますか? -SM_BRIDGE_RESOURCE WinPcap のドライバを読み込めませんでした。 -SM_BRIDGE_COLUMN_1 番号 -SM_BRIDGE_COLUMN_2 仮想 HUB 名 -SM_BRIDGE_COLUMN_3 ブリッジ先 LAN カードまたは tap デバイス名 -SM_BRIDGE_COLUMN_4 状態 -SM_BRIDGE_OFFLINE オフライン -SM_BRIDGE_ONLINE 動作中 -SM_BRIDGE_ERROR エラー発生 -SM_BRIDGE_OK ローカルブリッジ接続の定義を追加しました。 -SM_BRIDGE_DELETE 仮想 HUB "%s" からデバイス "%s" までのローカルブリッジを削除しますか? -SM_BRIDGE_DELETE_OK ローカルブリッジを削除しました。 -SM_BRIDGE_INTEL 物理的な LAN カードに対してブリッジを行う場合、新しいブリッジ接続を作成した直後の状態では、一部の LAN カードでは仮想ネットワーク内のコンピュータからブリッジ接続に使用している LAN カード自身に対する TCP/IP 通信が正しく行えない場合があります。\r\n(特に、Intel や Broadcom 製 LAN カードなどでこの現象が発生する場合があります。)\r\n\r\n\r\nその場合は、一度 VPN Server / Bridge が動作しているコンピュータを再起動してください。コンピュータの再起動後に正しく通信することができるようになります。\r\n\r\n\r\nまた、大半の無線 LAN アダプタはプロミスキャスモードでのパケットの送受信に対応していない場合が多いため、ローカルブリッジに使用できない場合があります。このような場合は、無線 LAN アダプタではなく通常の LAN カードの使用を検討してください。 -SM_BRIDGE_VPN "%S" に対してローカルブリッジ接続しようとしています。\r\n\r\n通常は、仮想 HUB と物理的な LAN カードとの間でローカルブリッジ接続を行います。仮想 LAN カード等に対してローカルブリッジ接続を行う必要があることはあまりありません。\r\nこれが意図した操作であるかどうか、もう一度確認してください。\r\n\r\n本当に続行しますか? -SM_BRIDGE_INFO_1 ブリッジ先の Ethernet デバイス (LAN カード) を選択してください。 -SM_BRIDGE_INFO_2 新しく作成する tap デバイスの名前を入力してください。 -SM_CONFIG_SAVED コンフィグレーションファイルを保存しました。 -SM_CONFIG_SAVE_FAILED コンフィグレーションファイルの保存に失敗しました。 -SM_CONFIG_OPEN_FAILED 指定したファイルを開けませんでした。 -SM_CONFIG_CONFIRM 指定されたコンフィグレーションファイルを VPN Server に書き込みます。VPN Server は自動的に再起動し、新しいコンフィグレーションファイルの内容で起動します。現在 VPN Server に接続中のユーザーは一旦切断されます。この管理セッションも切断されますので、再度サーバーに接続し直してください。\r\n\r\n続行しますか? -SM_CONFIG_WRITE_OK サーバー側のコンフィグレーションファイルを書き換えました。 -SM_AO_COLUMN_1 値の名前 -SM_AO_COLUMN_2 設定値 -SM_TRUE_OR_FALSE この項目は 0 (false) または 1 (true) で設定してください。 -SM_AO_SET_OK 仮想 HUB の管理オプションを設定しました。 -SM_EXT_OPTION_SET_OK 仮想 HUB の拡張オプションを設定しました。 -SM_PASSWORD_MSG 現在、接続先の VPN Server には管理者パスワードが設定されていません。パスワードを設定することをお勧めします。\r\n\r\nサーバー管理者パスワードを設定しますか? -SM_L3_SW_COLUMN1 レイヤ 3 スイッチ名 -SM_L3_SW_COLUMN2 動作状況 -SM_L3_SW_COLUMN3 インターフェイス数 -SM_L3_SW_COLUMN4 ルーティングテーブル数 -SM_L3_SW_ST_F_F 停止 -SM_L3_SW_ST_T_F 開始 (エラー) -SM_L3_SW_ST_T_T 開始 (動作中) -SM_L3_SW_DEL_MSG 仮想レイヤ 3 スイッチ "%S" を削除します。\r\nよろしいですか? -SM_L3_SW_IF_COLUMN1 IP アドレス -SM_L3_SW_IF_COLUMN2 サブネットマスク -SM_L3_SW_IF_COLUMN3 仮想 HUB 名 -SM_L3_SW_TABLE_COLUMN1 ネットワークアドレス -SM_L3_SW_TABLE_COLUMN2 サブネットマスク -SM_L3_SW_TABLE_COLUMN3 ゲートウェイアドレス -SM_L3_SW_TABLE_COLUMN4 メトリック -SM_SECURE_NAT_MSG SecureNAT 機能を本当に有効にしますか?\r\n\r\nSecureNAT 機能を有効にすると、仮想 HUB の中に IP アドレスを 1 つ持った仮想の NAT 機能付きルータが生成されます。この仮想ルータは仮想 LAN にアクセスできるコンピュータからは 1 台のコンピュータまたはルータに見えます。\r\n\r\nSecureNAT の仮想 NAT 機能は、仮想 HUB に接続している任意のコンピュータに対して、SecureNAT 機能を動作させているコンピュータを経由して外部ネットワークと通信可能にします。\r\nしたがって、この VPN Server で SecureNAT を動作させた場合、同一のコンピュータから localhost (自分自身) に対して仮想 LAN カードを接続する必要はありません。(SecureNAT が動作しているコンピュータが自分自身に対して仮想 LAN カードを接続すると、設定によってはパケットが無限ループすることがあります。)\r\n\r\n\r\nまた、すでに仮想 HUB の レイヤ 2 セグメントから到達可能な場所に DHCP サーバーが存在する場合は、DHCP の競合が発生するため、[SecureNAT の設定] をクリックして DHCP サーバー機能を無効にしてください。\r\n\r\nまた、NAT 機能を無効にして DHCP サーバーとしてのみ使用することもできます。 -SM_CRL_COLUMN_1 証明書の概要 -SM_CRL_DELETE_MSG 選択した項目を削除します。よろしいですか? -SM_CRL_EMPTY_MSG 項目が 1 つも選択されていません。\r\nこの無効な証明書エントリが追加されると、すべての証明書が無効として判断され、証明書認証モードで接続しようとするすべてのクライアントの接続が拒否されます。\r\n\r\nよろしいですか? -SM_AC_COLUMN_1 ID -SM_AC_COLUMN_2 優先順位 -SM_AC_COLUMN_3 動作 -SM_AC_COLUMN_4 内容 -SM_AC_PASS 許可 -SM_AC_DENY 拒否 -SM_LOG_FILE_COLUMN_1 ログファイル名 -SM_LOG_FILE_COLUMN_2 ファイルサイズ -SM_LOG_FILE_COLUMN_3 更新日時 -SM_LOG_FILE_COLUMN_4 場所 -SM_READ_LOG_FILE_INFO_1 処理中につきしばらくお待ちください... -SM_READ_LOG_FILE_INFO_2 %S 中 %S が完了しました... -SM_READ_LOG_FILE_ERROR ファイルのダウンロードは正しく完了しませんでした。 -SM_READ_SAVE_DLG_TITLE ログファイルの保存先ファイル名を指定してください -SM_READ_SAVE_DLG_FILTER ログファイル (*.LOG)|*.log|すべてのファイル (*.*)|*.* -SM_READ_SAVE_FAILED ログファイルの保存に失敗しました。 -SM_READ_SAVE_TMP_FAILED 一時ファイル "%S" に書き込めませんでした。 -SM_READ_SAVE_OPEN_ERROR 一時ファイル "%S" を開くことができませんでした。\r\n\r\n拡張子が .LOG のファイルが Windows によって関連付けられていない可能性があります。 -SM_LICENSE_COLUMN_1 番号 -SM_LICENSE_COLUMN_2 ライセンスキー -SM_LICENSE_COLUMN_3 ライセンス種類名 -SM_LICENSE_COLUMN_4 状態 -SM_LICENSE_COLUMN_5 有効期限 -SM_LICENSE_COLUMN_6 ライセンス ID -SM_LICENSE_COLUMN_7 ライセンス種類 ID -SM_LICENSE_COLUMN_8 サーバー ID -SM_LICENSE_COLUMN_9 シリアル ID -SM_LICENSE_INFINITE 無制限 -SM_LICENSE_NO_EXPIRES 無期限 -SM_LICENSE_STATUS_EDITION 製品エディション名 -SM_LICENSE_STATUS_RELEASE この VPN Server のリリース日付 -SM_LICENSE_STATUS_SYSTEM_ID 現在のサーバー ID -SM_LICENSE_STATUS_EXPIRES 現在の製品ライセンスの有効期限 -SM_LICENSE_STATUS_SUBSCRIPTION サブスクリプション契約の状態 -SM_LICENSE_STATUS_SUBSCRIPTION_NONEED 契約なし (このエディションではサブスクリプションキーは不要) -SM_LICENSE_STATUS_SUBSCRIPTION_NONE キー登録まだ (このエディションではサブスクリプションキーの登録が必須) -SM_LICENSE_STATUS_SUBSCRIPTION_VALID 契約済み [契約期間: %s まで] -SM_LICENSE_STATUS_SUBSCRIPTION_EXPIRED 契約期限切れ [契約期間: %s まで] -SM_LICENSE_STATUS_SUBSCRIPTION_BUILD 現在の契約で利用可能なバージョン -SM_LICENSE_STATUS_SUBSCRIPTION_BUILD_STR %s までにリリースされる全バージョンに無償アップグレード可能 -SM_LICENSE_STATUS_ENTERPRISE エンタープライズ機能の利用可否 -SM_LICENSE_STATUS_ENTERPRISE_YES はい (利用可能) -SM_LICENSE_STATUS_ENTERPRISE_NO いいえ (利用不可能) -SM_LICENSE_NUM_USER ユーザー作成可能数 -SM_LICENSE_NUM_CLIENT クライアント同時接続可能数 -SM_LICENSE_NUM_BRIDGE ブリッジ同時接続可能数 -SM_NO_LICENSE_COLUMN ご注意: -SM_NO_LICENSE 製品ライセンスが 1 つも登録されていないため、この VPN Server の通信機能は動作しません。 -SM_LICENSE_DELETE_MSG 選択されたライセンスを VPN Server から削除しますか? -SM_SYSLOG_0 syslog 送信機能を使用しない -SM_SYSLOG_1 サーバーログを syslog で送信 -SM_SYSLOG_2 サーバーおよび仮想 HUB セキュリティログを syslog で送信 -SM_SYSLOG_3 サーバー、仮想 HUB セキュリティおよびパケットログを syslog で送信 -SM_SETUP_INFO_1 [次へ] をクリックすると、セットアップを開始します。[閉じる] をクリックすると、このセットアップ画面を閉じ、手動ですべての設定を行うことができます。 -SM_SETUP_INFO_2 高度な機能を用いた VPN サーバーの設定を行うには、[閉じる] をクリックしてください。 -SM_SETUP_BRIDGE_ONLY 現在 VPN Bridge に接続しているため、[拠点間接続 VPN] における [各拠点に設置する VPN Bridge] のみを構築できます。 -SM_SETUP_BRIDGE_EDGE 各拠点に設置する VPN Bridge (&E) -SM_SETUP_WARNING 続行すると、この VPN Server または VPN Bridge の現在の設定内容は、簡易セットアップで指定した内容に初期化されます。\r\nよろしいですか? -SM_SETUP_SELECT ブリッジ接続する Ethernet デバイスを選択してください -SM_SETUP_NO_LICENSE_KEY この SoftEther VPN Server には、有効なライセンスキーが登録されていません。\r\n\r\nSoftEther VPN Server が VPN サーバーとして動作するには、ライセンスキーの登録が必要です。\r\nライセンスの管理画面を表示しますか?\r\n\r\n(体験版として使用する場合は、ソフトイーサ株式会社の Web サイトにアクセスして体験版のライセンスキーを取得する必要があります。\r\n[はい] をクリックしてから [ライセンスの入手・更新] ボタンをクリックすると、体験版のライセンスキーを入手できます。) -SM_HUBEXT_OPTION_TITLE 仮想 HUB 拡張オプション -SM_HUBEXT_OPTION_STATIC1 仮想 HUB 拡張オプションを使用すると、この仮想 HUB に関するより詳細な設定を行うことができるようになります。 -SM_HUBEXT_OPTION_STATIC2 標準では、VPN Server 全体の管理者および仮想 HUB 管理者の両方とも、仮想 HUB 拡張オプションを編集することができます。\r\nただし、仮想 HUB 管理オプションの deny_hub_admin_change_ext_option が 1 に設定されている場合は、仮想 HUB の管理者は、拡張オプションを編集することができません (設定内容を表示することはできます)。 -SM_VLAN_COLUMN_0 LAN カード名 -SM_VLAN_COLUMN_1 ドライバ種類 -SM_VLAN_COLUMN_2 ドライバファイル名 -SM_VLAN_COLUMN_3 VLAN 透過設定 -SM_VLAN_COLUMN_4 GUID -SM_VLAN_COLUMN_5 デバイスインスタンス ID -SM_VLAN_YES 設定済み -SM_VLAN_NO 未設定 -SM_VLAN_MSG_1 LAN カード "%S" でタグ VLAN パケットが透過するようにレジストリを設定しました。\r\n\r\nなお、一部の LAN カードでは、別途、対象の Windows コンピュータにログオンして、デバイスマネージャから LAN カードのプロパティを開き、ジャンボフレーム (フレームサイズが 1,514 バイト以上の Ethernet フレーム) の送受信を有効にする必要がある場合があります。ジャンボフレームの設定を行わないと、タグ VLAN パケットのうちフレームサイズが最大のものの送受信に失敗する可能性があります。大きなサイズのパケットのみ送受信が不安定な場合は、必ずジャンボフレームを有効化してください (例えば、最大パケットサイズを 4,088 バイトに設定してください) 。設定方法については、Windows のデバイスマネージャから LAN カードの設定を開くか、または LAN カードのドキュメントを参考にしてください。\r\n\r\nなお、今回の設定変更の内容は Windows レジストリに書き込まれましたが、必ずしも今回の設定変更によってタグ VLAN パケットが透過するようになることが保証される訳ではありません。\r\nこの設定を行った後タグ VLAN パケットの送受信が正常に行えない場合は、LAN カード "%S" のドキュメントを参照して適切に手動で設定してください。また、LAN カード "%S" がそもそもタグ VLAN パケットに対応していない可能性もあります。そのような場合は、その LAN カードはタグ VLAN パケットの送受信に使用できませんので、別の種類の LAN カードをローカルブリッジ用にご利用ください。\r\n\r\n今回の設定内容を適用するためには、対象の Windows コンピュータを再起動する必要があります。忘れずに必ず再起動してください。 -SM_VLAN_MSG_2 LAN カード "%S" に設定されていたタグ VLAN パケットが透過するようにするための設定をレジストリから削除しました。\r\n\r\nなお、以前にタグ VLAN パケットの透過を実現するために LAN カードにジャンボフレームを利用可能とするための設定を行った場合で、今後ジャンボフレームの利用が不要だと思われる場合は、手動でジャンボフレームの設定を解除してください。\r\n\r\n今回の設定内容を適用するためには、対象の Windows コンピュータを再起動する必要があります。忘れずに必ず再起動してください。 -SM_VLAN_NOTHING 現在、コンピュータ "%S" には、タグ VLAN パケット透過設定ツールが対応している物理的な LAN カードは 1 枚もありません。\r\n\r\nただし、現在このタグ VLAN パケット透過設定ツールが対応していない LAN カードでも、タグ VLAN がデフォルトで透過可能か、または何らかの設定を行うことにより透過可能になることがあります。\r\nその場合は、システム管理者が自ら Windows にログインし、そのような設定を行う必要があります。 -SM_SERVER_ADMIN_MSG VPN Server / Bridge "%S" -SM_ETHERIP_COLUMN_0 ISAKMP Phase 1 ID -SM_ETHERIP_COLUMN_1 仮想 HUB 名 -SM_ETHERIP_COLUMN_2 ユーザー名 -SM_ETHERIP_ADD_OK 新しい EtherIP / L2TPv3 クライアントの接続設定を追加しました。 -SM_IPSEC_SETUP_QUESTION この VPN Server は IPsec / L2TP / EtherIP / L2TPv3 対応の VPN クライアントやルータ製品などからの接続を受け付けることができる機能を有しています。\r\n\r\nこの VPN Server が iPhone、iPad、Android などのスマートフォンや Mac OS X、Windows などに搭載されている VPN クライアント機能からの接続を受け付けることができるように IPsec の設定を行うことができます。\r\n\r\nIPsec の設定を行いますか?\r\n(この設定は後から [IPsec / L2TP 設定] ボタンをクリックしていつでも行うことができます。) -SM_OPENVPN_CONFIG_SAVE_OK OpenVPN 設定ファイルを格納した ZIP ファイルを '%s' に保存しました。\r\n\r\nこの ZIP ファイルを開くと、OpenVPN クライアントで使用できる設定ファイルのサンプルが展開できます。\r\nなお、設定ファイルは実際に使用する前には環境に応じて修正する必要がある場合があります。\r\n\r\n詳しくは ZIP ファイル内の 'readme.txt' ファイルをお読みください。\r\n\r\nこの ZIP ファイルを今すぐ開きますか? -SM_OPENVPN_CONFIG_SAVE_NG ZIP ファイル '%s' の保存に失敗しました。 -SM_OPENVPN_CONFIG_OPEN_NG ZIP ファイル '%s' を開こうとして失敗しました。手動でこのファイルを開いてください。 -SM_DDNS_IPV4_ERROR IPv4 の DDNS サーバーに到達できません。 -SM_DDNS_IPV6_ERROR IPv6 の DDNS サーバーに到達できません。 -SM_DDNS_FQDN_EMPTY (なし) -SM_DDNS_OK_MSG ダイナミック DNS ホスト名: %S%S\r\n\r\n上記の DNS ホスト名を指定することにより、この VPN Server のグローバル IP アドレスである以下の IP アドレスにアクセスすることができます。\r\n\r\nIPv4 アドレス: %s\r\nIPv6 アドレス: %s\r\n\r\nなお、以下のような DNS ホスト名を指定することにより、IPv4 アドレスまたは IPv6 アドレスのいずれかのみを明示的に応答させることができます。\r\n\r\nIPv4 のみを応答するホスト名: %S.v4%S\r\nIPv6 のみを応答するホスト名: %S.v6%S\r\n -SM_DDNS_OK_TITLE ダイナミック DNS 機能 -SM_DDNS_OK_MSG2 ダイナミック DNS ホスト名を '%S' に変更しました。\r\n\r\n[ヒント] ボタンをクリックして追加情報をお読みください。 -SM_DDNS_KEY_TITLE ダイナミック DNS 秘密鍵 -SM_DDNS_KEY_MSG ダイナミック DNS 秘密鍵: %s\r\n\r\nこの秘密鍵は、現在使用している DDNS 名と対応付けられています。現在 VPN Server として使用している PC が破損するなどして、この秘密鍵が失われると、その時設定されていた DDNS 名は占有されたままの状態となり、他の VPN Serverで使用できなくなります。同じ名前を継続して使用したい場合は、秘密鍵を他の PC やインタネット上のストレージ、メモ用紙などに保管しておいてください。\r\n秘密鍵を新しい VPN Server に設定する際は、VPN Server の設定ファイルを編集します。"declare DDnsClient" ディレクティブ中にある "byte Key" に続く値を、保管しておいた秘密鍵の文字列で置き換えてください。\r\nなお、同時に複数の VPN Server で同じ秘密鍵を設定すると正常に動作しなくなりますので注意してください。 -SM_DDNS_KEY_ERR DNS 鍵の取得に失敗しました。 -SM_IPSEC_PSK_TOO_LONG 事前共有鍵 (PSK) の長さが 10 文字以上に設定されています。\r\n\r\nAndroid 携帯電話の一部のバージョンにはバグがあり、事前共有鍵が 10 文字以上の場合は VPN 接続が行えない場合があります。\r\nそのため、事前共有鍵の長さは 9 文字以下とすることを推奨します。\r\n\r\n事前共有鍵の設定を見直しますか? -SM_ADVANCED_REDIRECT_URL_HINT_TITLE 高度な HTTP リダイレクション機能の使い方 -SM_ADVANCED_REDIRECT_URL_HINT 高度な HTTP リダイレクション機能 (上級者向け)\r\n\r\nアクセスリストに HTTP リダイレクト先の URL を記載する際に、URL の一部として という文字列を埋め込むことができます。これにより、リダイレクト先の URL を受取った CGI などで、VPN 接続を行っているクライアントの情報を用いた高度な処理を実行することができます。\r\n\r\n埋め込み URL 例:\r\nhttp://www.google.com/search?q=|secret\r\n\r\n実際にクライアントがリダイレクトされる際には、当該文字列部分が以下のような文字列に置換されます。\r\n\r\nユーザー名|セッション ID|IP アドレス|日付と時刻|ハッシュ値\r\n\r\n置換後の例: zurukko|SID-ZURUKKO-123|219.117.219.154|20131117100354|99707160AFE7A454042B2C47B064112D652452D7\r\n\r\nここで、上記の各フィールドの値の内容の詳細は以下のとおりです。\r\n\r\nユーザー名: VPN 接続を行っているユーザー名が代入されます。\r\n\r\nセッション ID: 当該 VPN セッションの ID が代入されます。\r\n\r\n日付と時刻: 'YYYYMMDDHHMMSS' の形式で 14 桁の数字が代入されます (タイムゾーンは UTC)。\r\n\r\nハッシュ値: ハッシュ値直前までの上記フィールドのビット列に URL 中の文字 '|' 以降の末尾までの文字列 (上記の例では "secret" という文字列) のビット列とを連結し SHA-1 ハッシュ関数を適用した結果の 20 バイトを 16 進数で表記した 40 文字の文字列。なお、URL 中に文字 '|' が存在しない場合はハッシュ値は付与されません。\r\n\r\nハッシュ値の存在意義について: ハッシュ文字列 (上記の例では "secret" という文字列) は秘密鍵として機能します。これにより、リダイレクト先でクエリ文字列を受取った CGI は受取った文字列がクライアントによって不正に改ざんされていないことを確認できます。\r\n -SM_ADVANCED_REDIRECT_URL_MSG URL は "http://" または "https://" で始まる必要があります。 -SM_DISABLE_DDNS_HINT_CAPTION ダイナミック DNS 機能を無効にする -SM_DISABLE_DDNS_HINT ダイナミック DNS 機能を無効にするには、VPN Server の設定ファイルを編集します。\r\n\r\n"declare root" ディレクティブ内に "declare DDnsClient" ディレクティブがあります。この中にある "bool Disable" の値を true に設定して VPN Server を再起動することにより、ダイナミック DNS 機能が無効になります。\r\n -SM_REGENERATE_CERT_MSG VPN Server のサーバー証明書を新しいものに置換します。\r\n\r\nこれにより、古いサーバー証明書に接続することを前提に設定されていた VPN Client はこの VPN Server に接続できなくなる可能性があります。\r\nよろしいですか? -SM_DDNS_SERVER_CERT_MSG DDNS ホスト名を "%S" に変更しました。\r\n\r\nこの VPN Server に Microsoft SSTP VPN プロトコルを用いて Windows Vista 以降のバージョンの Windows の組み込み SSTP VPN クライアントから接続する場合は、VPN クライアント側で接続先 VPN サーバー名として指定するホスト名 (DNS 名) の文字列と、この VPN Server の SSL サーバー証明書の CN (Common Name) の文字列とが完全一致している必要があります。\r\n\r\nこの VPN Server の SSL サーバー証明書の CN が "%S" となるようにサーバー証明書を再生成しますか?\r\n([いいえ] をクリックすると、現在の SSL サーバー証明書が引き続き使用されます。) -SM_DDNS_SERVER_CERT_OK VPN Server の SSL 証明書を再生成しました。\r\n\r\nこの VPN Server に Microsoft SSTP VPN クライアントから接続する場合は、現在の DDNS ホスト名 "%S" を接続先サーバー名として指定することを推奨します。\r\nまた、SSTP VPN クライアントとなる Windows 上の「信頼できるルート証明書」にあらかじめこの VPN Server の証明書ファイルをインストールしておく必要があります。\r\n(ルート証明書を Windows にインストールするには、MMC の「証明書」で「ローカル コンピュータ」の証明書ストアを開き、「信頼できるルート証明書」にこの VPN Server の証明書ファイルを追加します。\r\n 詳しくは Microsoft 社のドキュメントを参照してください。)\r\n\r\n新しい VPN Server の SSL 証明書を X.509 形式の証明書ファイルに保存しますか? -SM_SETUP_STEP_SECURENAT この VPN Server / Bridge はユーザーモードで起動しているか、OS がローカルブリッジ非対応のため、仮想 HUB と物理的な LAN カードとをブリッジできません。代わりに「SecureNAT」機能を使用すれば、接続してきた VPN クライアントは仮想 NAT を経由して LAN 上のコンピュータにアクセスできるようになります。 -SM_SETUP_STEP_SECURENAT_TITLE 3. 仮想 HUB と物理的な LAN との接続 -SM_UPDATE_CHECK_TITLE_VPNSERVER %S VPN Server (サーバー '%S' 上) -SM_UPDATE_CHECK_TITLE_VPNBRIDGE %S VPN Bridge (サーバー '%S' 上) -SM_FACTORY_DEFAULT_WARNING VPN Server / Bridge の設定をリセットします。\r\nVPN Server / Bridge の現在の設定は消去され、直ちに初期設定 (インストール直後の設定) に戻ります。\r\nリセットを実行する前に、現在の設定ファイルをバックアップしておくことを推奨します。\r\n\r\n[OK] をクリックするとリセットを実行します。VPN Server / Bridge サービスは再起動し現在の VPN サーバー管理マネージャの接続は切断されますので、その後に VPN Server / Bridge に再接続してください。\r\n再接続を行うと、設定がリセットされた後の VPN Server にアクセスできます。 -SM_FACTORY_DEFAULT_PERFORMED 設定のリセット処理はサーバー上で開始されました。\r\n\r\nOk をクリックすると現在の VPN サーバー管理マネージャのセッションを終了します。\r\n終了した後に、VPN サーバー管理マネージャを再度起動して VPN Server に再接続してください。\r\n再接続すると、設定がリセットされた後の VPN Server が出現します。 -SM_AZURE_STATUS_CONNECTED 状態: クラウドに接続完了 -SM_AZURE_STATUS_NOT_CONNECTED 状態: クラウドに未接続 -SM_NO_BRIDGE_NICS ローカルブリッジを作成することができる物理的な LAN カードが VPN サーバーのコンピュータに 1 枚も見つかりませんでした。\r\n\r\nローカルブリッジを作成するには、物理的な LAN カードを 1 枚以上コンピュータにインストールする必要があります。\r\n無線 LAN カード、3G アダプタ等は使用できません。\r\n通常のケーブル接続の Ethernet に対応した LAN カードをインストールしてください。\r\n\r\n最近インストールした LAN カードが表示されない場合は、一度コンピュータを再起動してください。\r\n\r\nローカルブリッジを使用できない場合は、代わりに「SecureNAT 機能」の仮想 NAT 機能の使用を検討してください。\r\n\r\nなお、何らかの理由で物理的な LAN カード以外の LAN カード (無線 LAN、仮想 LAN など) を使用したい場合は、設定ファイルの "LocalBridgeList" ディレクティブ内の "ShowAllInterfaces" を "true" にして VPN Server を再起動するとこれらのデバイスも表示されるようになります。(上級者向け、Windows のみ)\r\n\r\nWindows をアップグレードした後にこの問題が発生するようになった場合は、SoftEther VPN Server または SoftEther VPN Bridge を再インストールしてみてください。 -SM_CERT_MESSAGE 現在サーバーに設定されている SSL 自己署名ルート証明書は古い形式です。\r\n\r\nOpenVPN プロトコルを用いてこの VPN Server に接続しているクライアントが存在する場合、現在のサーバー証明書の使用を継続すると、OpenVPN Connect for Android で不具合が発生する可能性があります。\r\n\r\nOpenVPN Connect for Android を使用してこの VPN Server に VPN 接続を行っている場合は、サーバー証明書を再作成して更新することをお勧めします。\r\n\r\nサーバー証明書を再作成して更新しますか? -SM_CERT_MESSAGE_CLI --- ご注意 ---\r\n\r\n現在サーバーに設定されている SSL 自己署名ルート証明書は古い形式です。\r\n\r\n現在のサーバー証明書の使用を継続した場合、OpenVPN Connect for Android で不具合が発生する可能性があります。\r\n\r\nOpenVPN Connect for Android を使用してこの VPN Server に VPN 接続を行っている場合は、サーバー証明書を再作成して更新することをお勧めします。\r\n\r\nサーバー証明書を再作成して更新するには、VPN Server を最新版にアップデートしてから、"ServerCertRegenerate" コマンドを実行してください。 -SM_CERT_NEED_ROOT 指定された SSL 証明書は、証明機関 (CA) によって発行された証明書です。\r\n\r\nこの VPN Server に Microsoft SSTP または OpenVPN プロトコルで VPN 接続を行う場合は、ルート証明書および中間証明書 (存在する場合) を VPN Server にインストールする必要があります。\r\n\r\nVPN Server にルート証明書および中間証明書をインストールするためには、X.509 証明書のルート証明書および中間証明書ファイルを VPN Server がインストールされているディレクトリの中にある "chain_certs" サブディレクトリにコピーしてください。\r\n\r\nルート証明書および中間証明書ファイルの取得方法は、証明機関 (CA) が発行している Web サイトをお読みいただくか、証明機関 (CA) のサポートに問い合わせてください。 - - -# User-modeRouter 管理ツール関係 -NM_TITLE deleted -NM_CONNECT_TITLE deleted -NM_STATUS_TAG 接続状況: %s -NM_OFFLINE どの VPN Server にも接続していません。 -NM_CONNECTING VPN Server に接続中 -NM_CONNECTED VPN Server "%S" への接続が完了 -NM_CONNECT_ERROR エラー番号 %u (%s) -NM_ACCOUNT_TITLE deleted -NM_STATUS User-mode Router の状況 -NM_STATUS_CONNECT 接続状況 -NM_STATUS_TCP NAT TCP/IP セッション数 -NM_STATUS_UDP NAT UDP/IP セッション数 -NM_STATUS_ICMP NAT ICMP セッション数 -NM_STATUS_DNS NAT DNS セッション数 -NM_STATUS_DHCP 割り当て済み DHCP クライアント数 -NM_INFO User-mode Router の情報 -NM_INFO_PRODUCT_NAME 製品名 -NM_INFO_VERSION_STR バージョン情報 -NM_INFO_BUILD_INFO ビルド情報 -NM_INFO_HOSTNAME ホスト名 -NM_NAT_ID ID -NM_NAT_PROTOCOL プロトコル -NM_NAT_SRC_HOST 接続元ホスト -NM_NAT_SRC_PORT 接続元ポート -NM_NAT_DST_HOST 接続先ホスト -NM_NAT_DST_PORT 接続先ポート -NM_NAT_CREATED セッション作成日時 -NM_NAT_LAST_COMM 最終通信時刻 -NM_NAT_SIZE 受信 / 送信サイズ -NM_NAT_TCP_STATUS TCP 接続状態 -NM_NAT_PROTO_TCP TCP/IP -NM_NAT_PROTO_UDP UDP/IP -NM_NAT_PROTO_DNS DNS -NM_NAT_PROTO_ICMP ICMP -NAT_TCP_CONNECTING 接続中 -NAT_TCP_SEND_RESET 切断中 -NAT_TCP_CONNECTED 接続完了 -NAT_TCP_ESTABLISHED 通信中 -NAT_TCP_WAIT_DISCONNECT 切断中 -DHCP_DHCP_ID ID -DHCP_LEASED_TIME リース開始日時 -DHCP_EXPIRE_TIME リース期限 -DHCP_MAC_ADDRESS MAC アドレス -DHCP_IP_ADDRESS 割り当て IP -DHCP_HOSTNAME クライアントホスト名 -NM_PASSWORD_MSG 管理パスワードを設定しました。 -NM_PUSH_ROUTE_WARNING 指定された静的ルーティングテーブルのテキストには文法エラーがある可能性があります。 - - -# バージョン情報系 -ABOUT_CAPTION %s のバージョン情報 -BETA_EXPIRES 現在インストールされている SoftEther VPN ソフトウェアはベータ版で、期限が切れています。より新しいベータ版または完成版の提供が開始された後は利用することはできません。\r\nhttp://selinks.org/ にアクセスし、最新版の SoftEther VPN ソフトウェアを入手してください。 - - -# ログ保存関係 -# (共通ログ) -L_YES はい -L_NO いいえ -L_LINE ------------------------------------------------------ - -# (サーバー ログ) -LS_START_UTF8 Log Messages are written with UTF-8 Encoding Format. -LS_START_1 SoftEther VPN Server エンジンを起動しました。 -LS_START_2 %S %S -LS_START_3 %S -LS_END_1 SoftEther VPN Server エンジンは正常にシャットダウンされました。 -LS_END_2 サーバー エンジンのシャットダウン処理を開始しています。 -LS_STOP_ALL_LISTENER すべての TCP リスナーを停止します。 -LS_STOP_ALL_LISTENER_2 すべての TCP リスナーの停止が完了しました。 -LS_STOP_ALL_HUB すべての仮想 HUB を停止しています。 -LS_STOP_ALL_HUB_2 すべての仮想 HUB の停止が完了しました。 -LS_STOP_CEDAR Cedar 通信モジュールをシャットダウンしています。 -LS_STOP_CEDAR_2 Cedar 通信モジュールをシャットダウンしました。 -LS_STOP_FARM_MEMBER クラスタコントローラへの接続を切断しています。 -LS_STOP_FARM_MEMBER_2 クラスタコントローラとの間の接続の切断が完了しました。 -LS_STOP_FARM_CONTROL クラスタコントローラを停止しています。 -LS_STOP_FARM_CONTROL_2 クラスタコントローラの停止が完了しました。 -LS_ENUM_ETHERNET_1 Ethernet デバイスの列挙を行いました。 -LS_ENUM_ETHERNET_2 デバイス %u: "%S" -LS_LOAD_CONFIG_1 設定ファイルの読み込みを行います。 -LS_LOAD_CONFIG_2 設定ファイルの読み込みが完了しました。 -LS_LOAD_CONFIG_3 設定ファイルが存在しません。初期設定での起動を試行します。 -LS_INIT_SAVE_THREAD 自動設定保存のためのバックグラウンドタスクを起動します。保存間隔は %u 秒です。なお、自動保存の間隔はコンフィグレーションファイルの AutoSaveConfigSpan パラメータで変更することができます。 -LS_BAD_CONFIG 設定ファイルの内容が不正です。読み込みを終了します。 -LS_LISTENER_START_1 TCP リスナー (ポート %u) を開始しています。 -LS_LISTENER_START_2 TCP リスナー (ポート %u) が開始されました。クライアントからの接続を待機しています。 -LS_LISTENER_START_3 TCP リスナー (ポート %u) でポートを Listen 状態に設定できませんでした。成功するまで一定間隔で試行します。 -LS_LISTENER_ACCEPT TCP リスナー (ポート %u) にクライアント (IP アドレス %S, ホスト名 "%S", ポート番号 %u) が接続しました。 -LS_LISTENER_DISCONNECT クライアント (IP アドレス %S, ポート番号 %u) との間のコネクションは切断されました。 -LS_LISTENER_DOS TCP リスナー (ポート %u) に対する DoS アタックを検出しました。接続元は IP アドレス %S, ポート番号 %u です。このコネクションは強制切断します。 -LS_LISTENER_MAXUEC TCP リスナーが処理している未処理のコネクション数が %u に達した (現在数 = %u) ため、一時的に受付接続数を制限しています。 -LS_LISTENER_STOP_1 TCP リスナー (ポート %u) を停止しています。 -LS_LISTENER_STOP_2 TCP リスナー (ポート %u) の停止が完了しました。 -LS_HUB_START 仮想 HUB "%S" を開始しました。 -LS_HUB_STOP 仮想 HUB "%S" を停止しました。 -LS_HUB_MAC 仮想 HUB "%S" の MAC アドレスは "%S" です。 -LS_NODE_INFO_TAG クライアント製品名 "%S", クライアントバージョン %u, クライアントビルド番号 %u, サーバー製品名 "%S", サーバーバージョン %u, サーバービルド番号 %u, クライアント OS 名 "%S", クライアント OS バージョン "%S", クライアントプロダクト ID "%S", クライアントホスト名 "%S", クライアント IP アドレス "%S", クライアントポート番号 %u, サーバーホスト名 "%S", サーバー IP アドレス "%S", サーバーポート番号 %u, プロキシホスト名 "%S", プロキシ IP アドレス "%S", プロキシポート番号 %u, 仮想 HUB 名 "%S", クライアントユニーク ID "%S" -LS_CONNECTION_START_1 クライアント (IP アドレス %S, ホスト名 "%S", ポート番号 %u) に対応するコネクション "%S" が作成されました。 -LS_CONNECTION_END_1 コネクション "%S" が終了しました。 -LS_SSL_START コネクション "%S" に対する SSL 通信が開始されました。暗号化アルゴリズム名は "%S" です。 -LS_CONNECTION_ERROR コネクション "%S" は理由 "%s" (コード %u) で終了しました。 -LS_FARMMEMBER_NOT_ADMIN コネクション "%S": サーバーはクラスタメンバですが、クライアントは仮想 HUB "%S" に管理者ユーザー "%S" 以外で直接接続しようと試みました。クライアントが提示したユーザー名は "%S" です。アクセスは許可されません。 -LS_HUB_NOT_FOUND コネクション "%S": クライアントが接続しようとした仮想 HUB "%S" はサーバー上に存在しません。 -LS_IP_DENIED コネクション "%S": クライアントの接続元 IP アドレス "%S" は、仮想 HUB に定義されている 接続元 IP 制限リストによって拒否されました。 -LS_LICENSE_ERROR コネクション "%S": ライセンス上のエラーが発生したため、クライアントはサーバーに接続できませんでした。 -LS_BETA_EXPIRES ライセンスエラーが発生しました。ベータ版の使用期限が終了しています。新しいベータ版または完成版を http://selinks.org/ からダウンロードしてください。 -LS_TICKET_1 クラスタメンバサーバー "%S" に対して新しいクライアント認証チケットを発行しました。仮想 HUB "%S", ユーザー名 "%S" ("%S"), セッション名 "%S", チケット "%S" -LS_TICKET_2 クラスタコントローラから新しいクライアント認証チケットを受領しました。仮想 HUB "%S", ユーザー名 "%S" ("%S"), セッション名 "%S", チケット "%S", 有効期限 %u 秒 -LS_ENUM_HUB コネクション "%S": このサーバー上の %u 個の仮想 HUB を列挙しました。 -LS_FARM_ACCEPT_1 コネクション "%S": このサーバーに対してクラスタコントロール接続を要求してきましたが、このサーバーはクラスタコントローラではありません。 -LS_FARM_ACCEPT_2 コネクション "%S": このサーバーに対してクラスタコントロール接続を要求してきましたが、認証パスワードが間違っているため、接続を拒否しました。 -LS_FARM_ACCEPT_3 コネクション "%S": このサーバーに対するクラスタコントロール接続を要求してきました。認証に成功しました。 -LS_FARM_SERV_START クラスタメンバとの間で接続を確立しました。IP アドレス %S, ホスト名 "%S" -LS_FARM_SERV_END クラスタメンバ "%S" との間の接続を解除しました。 -LS_FARM_CONNECT_1 クラスタコントローラ "%S" への接続を開始しました。 -LS_FARM_CONNECT_2 クラスタコントローラ "%S" への接続が拒否されました。エラー: %s (コード %u) -LS_FARM_CONNECT_3 クラスタコントローラ "%S" への TCP 接続に失敗しました。接続が成功するまで %u 秒間隔で試行します。 -LS_FARM_DISCONNECT クラスタコントローラへの接続を停止しました。 -LS_FARM_START クラスタコントローラへの接続が完了しました。クラスタメンバとしての動作を開始します。 -LS_LICENSE_NOT_VPNSERVER コネクション "%S": ライセンスエラーが発生しました。VPN Server 製品ライセンスが登録されていない時に、VPN Client が接続しようとしました。 -LS_LICENSE_NOT_VPNCLUSTER コネクション "%S": ライセンスエラーが発生しました。この VPN Server には現在クラスタリング機能を使用できない種類のライセンスが登録されていますが、クラスタモードで動作中に VPN Client が接続しようとしました。VPN Server を再起動する必要があります。 -LS_LICENSE_VIOLATION コネクション "%S": VPN Server でライセンス違反が発生しているため、接続を受け付けられません。 -LS_LICENSE_VIOLATION_DETECTED ライセンス違反を検出しました。別の VPN Server が、この VPN Server と同じサーバー ID "%I64u" で動作しています。クラスタ内に同一のライセンスを使用した 2 台以上の VPN Server が存在する可能性があります。各 VPN Server のライセンス情報を確認してください。 -LS_API_AUTH_OK HTTPS API クライアント "%r:%u" (%S): 管理モード: "%S" で組み込み HTTPS Web サーバーを用いてログインに成功しました。使用されたユーザー名: "%S", メソッド: "%S", パス: "%S" -LS_API_AUTH_ERROR HTTPS API クライアント "%r:%u" (%S): 組み込み HTTPS Web サーバーを用いてログインに失敗しました。使用されたユーザー名: "%S", メソッド: "%S", パス: "%S" -LS_API_RPC_CALL HTTPS API クライアント "%r:%u" (%S): JSON-API を呼び出しました。メソッド名: "%S", 結果エラーコード: %u (0 = 成功), 結果エラーメッセージ: "%s" - -# (Proto ログ) -LP_PREFIX_SESSION [%s] %r:%u -> %r:%u (%s): -LP_SESSION_CREATED Session created. -LP_SESSION_DELETED Session deleted. - -# (OpenVPN ログ) -LO_PREFIX_RAW OpenVPN モジュール: -LO_PREFIX_SESSION OpenVPN セッション %u (%r:%u -> %r:%u): -LO_PREFIX_CHANNEL OpenVPN セッション %u (%r:%u -> %r:%u) チャネル %u: -LO_NEW_CHANNEL 新しいチャネルを作成しました。 -LO_CHANNEL_ESTABLISHED_NEWKEY チャネルが確立状態になりました (原因: リキーの完了)。 -LO_OPTION_STR_RECV 受信したオプション文字列: "%S" -LO_CLIENT_CERT クライアント証明書 (subject: CN="%s") を受信しました。証明書認証を使用します。 -LO_CLIENT_UNVERIFIED_CERT 提示されたクライアント証明書の検証に失敗しました。パスワード認証を使用します。(エラー: "%S") -LO_CLIENT_NO_CERT クライアント証明書が提示されませんでした。パスワード認証を使用します。 -LO_OPTION_STR_SEND 送信するオプション文字列: "%S" -LO_INITIATE_REKEY このチャネルのリキーを開始します。 -LO_CHANNEL_ESTABLISHED チャネルが確立状態になりました。 -LO_PUSH_REPLY 応答オプション文字列の全文: "%S" -LO_CHANNEL_FAILED チャネルの接続処理に失敗しました。 -LO_CHANNEL_DISCONNECTED_BY_HUB 仮想 HUB の管理者によって VPN セッションが切断されたため、この OpenVPN チャネルを切断します。 - - -# (IPsec ログ) -LI_PREFIX_RAW IPsec モジュール: -LI_PREFIX_CLIENT IPsec クライアント %u (%S:%u -> %S:%u): -LI_PREFIX_IKE IPsec IKE セッション (IKE SA) %u (クライアント: %u) (%S:%u -> %S:%u): -LI_PREFIX_IPSEC IPsec ESP セッション (IPsec SA) %u (クライアント: %u) (%S:%u -> %S:%u): -LI_START IPsec ver 2.0 (ISAKMP/IKEv1) 処理モジュールを起動しました。 -LI_STOPPING IPsec ver 2.0 (ISAKMP/IKEv1) 処理モジュールの終了処理を開始しています... -LI_STOP IPsec ver 2.0 (ISAKMP/IKEv1) 処理モジュールを終了しました。 -LI_NUM_IPSEC_SA 終了時に残存していた IPsec SA の数は %u 個でした。 -LI_NUM_IKE_SA 終了時に残存していた IKE SA の数は %u 個でした。 -LI_NUM_IKE_CLIENTS 終了時に残存していた IPsec クライアントの数は %u 個でした。 -LI_L2TP_SERVER_STARTED L2TP サーバーモジュールを開始しました。 -LI_ETHERIP_SERVER_STARTED EtherIP サーバーモジュールを開始しました。EtherIP セッション番号: %u -LI_DELETE_IKE_CLIENT この IPsec クライアントを削除しました。 -LI_DELETE_IKE_SA この IKE SA を削除しました。 -LI_DELETE_IPSEC_SA この IPsec SA を削除しました。 -LI_START_QM_FROM_SERVER サーバー側から QuickMode の折衝を開始しました。 -LI_START_QM_FROM_CLIENT クライアント側から QuickMode の折衝が開始されました。 -LI_QM_DH_ERROR Diffie-Hellman アルゴリズムの計算に失敗しました。 -LI_NEW_IKE_CLIENT 新しい IPsec クライアントを作成しました。 -LI_NEW_IKE_SA 新しい IKE SA (%s) を作成しました。Initiator Cookie: 0x%I64X, Responder Cookie: 0x%I64X, DH グループ: %S, ハッシュアルゴリズム: %S, 暗号化アルゴリズム: %S, 暗号鍵サイズ: %u bits, 有効期限: %u kbytes または %u 秒 -LI_TAG_MAINMODE Main Mode -LI_TAG_AGGRESSIVE Aggressive Mode -LI_NEW_IPSEC_SA 新しい IPsec SA (方向: %s) を作成しました。SPI: 0x%X, DH グループ: %S, ハッシュアルゴリズム: %S, 暗号化アルゴリズム: %S, 暗号鍵サイズ: %u bits, 有効期限: %u kbytes または %u 秒 -LI_TAG_SERVER_TO_CLIENT サーバー -> クライアント -LI_TAG_CLIENT_TO_SERVER クライアント -> サーバー -LI_IPSEC_SA_SPI_SET これまで未定であった SPI を変更しました。新しい SPI: 0x%X -LI_IPSEC_SA_ESTABLISHED サーバー・クライアント間でこの IPsec SA が確立されました。 -LI_IKE_SA_ESTABLISHED サーバー・クライアント間でこの IKE SA が確立されました。 -LI_IPSEC_NO_TRANSFORM クライアント側から提示された IPsec SA 確立のためのトランスフォーム候補に受諾することができるものが見つかりませんでした。 -LI_IKE_NO_TRANSFORM クライアント側から提示された IKE SA 確立のためのトランスフォーム候補に受諾することができるものが見つかりませんでした。 -LI_IKE_NO_NAT_T このクライアントは IPsec NAT Traversal (RFC 3947 Negotiation of NAT-Traversal in the IKE または draft-ietf-ipsec-nat-t-ike) に対応していないため、接続を受け付けることができません。 -LI_SET_CLIENT_ID このクライアントが IKE SA の確立時に提示したクライアント ID は "%S" です。 -LI_CLIENT_MERGE このクライアント (クライアント %u) と既存の別のクライアント %u とは同一ですので、クライアント %u に結合されました。 -LI_CLIENT_UPDATE このクライアントのポート番号情報が更新されました。 - - -# (EtherIP ログ) -LE_PREFIX EtherIP / L2TPv3 セッション %u (%S:%u -> %S:%u): -LE_START_MODULE EtherIP / L2TPv3 モジュールが開始されました。 -LE_STOP EtherIP / L2TPv3 モジュールを終了しました。 -LE_NO_SETTING エラー: クライアント ID "%S" に対する EtherIP / L2TPv3 の設定が登録されていません。EtherIP / L2TPv3 の設定を VPN Server に登録してください。 -LE_START_IPC EtherIP / L2TPv3 モジュールから仮想 HUB "%S" への内部的通信の接続処理を開始しました。使用するユーザ名は "%S" です。設定する IPv4 TCP MSS (Max Segment Size) は %u bytes です。 -LE_IPC_CONNECT_ERROR EtherIP / L2TPv3 モジュールから仮想 HUB "%S" への接続に失敗しました。エラー: %u: %s -LE_IPC_CONNECT_OK EtherIP / L2TPv3 モジュールから仮想 HUB "%S" への接続に成功しました。 -LE_RECONNECT EtherIP / L2TPv3 関係の設定が変更されたため、内部的接続を一旦切断して再接続します。 - - -# (PPP ログ) -LP_PREFIX %S%SPPP セッション [%S:%u]: -LP_CONNECTED 新しい PPP セッション (上位プロトコル: %S) が開始されました。PPP クライアント IP アドレス: %S (ホスト名: "%S"), PPP クライアント ポート番号: %u, PPP サーバー IP アドレス: %S, PPP サーバー ポート番号:%u, クライアント ソフトウェア名: "%S", IPv4 TCP MSS (Max Segment Size): %u bytes -LP_DISCONNECTED PPP セッションは切断されました。 -LP_PAP_REJECTED クライアントは認証プロトコルとして "PAP" (Password Authentication Protocol、クリアテキストパスワード認証プロトコル) を拒否しました。クライアント側の接続設定で PAP を有効にして再試行してください。 -LP_PAP_MSCHAPV2_REJECTED クライアントは認証プロトコルとして "PAP" (Password Authentication Protocol、クリアテキストパスワード認証プロトコル) および MS-CHAP v2 プロトコルの両方を拒否しました。クライアント側の接続設定で PAP または MS-CHAP v2 のいずれかを有効にして再試行してください。 -LP_DISCONNECTED_ABNORMAL PPP プロトコルエラーが発生したか、または PPP セッションが切断されました。 -LP_NEXT_PROTOCOL_IS_NOT_PAP PAP (Password Authentication Protocol) の制御データ以外の不正なプロトコル (プロトコル番号: 0x%x) を受信しました。 -LP_PAP_FAILED "PAP" (Password Authentication Protocol、クリアテキストパスワード認証プロトコル) におけるユーザー認証に失敗しました。 -LP_MSCHAPV2_FAILED "MS-CHAP v2" (Microsoft Challenge and Response Protocol Version 2.0、マイクロソフトの暗号化されたパスワード認証プロトコル) におけるユーザー認証に失敗しました。 -LP_NEXT_PROTOCOL_IS_NOT_IPCP IPCP (IP Configuration Protocol) の制御データ以外の不正なプロトコル (プロトコル番号: 0x%x) を受信しました。 -LP_DATA_TIMEOUT PPP データ通信のタイムアウトが発生しました。PPP クライアントがネットワークから切断された可能性があります。 -LP_CONTROL_TIMEOUT PPP コントロール通信のタイムアウトが発生しました。PPP クライアントから応答がありません。 -LP_VPN_SESSION_TERMINATED VPN セッションがシステム管理者によって切断されたため、PPP セッションを切断します。 -LP_UPPER_PROTOCOL_DISCONNECTED 上位プロトコル "%S" が切断されたため、PPP セッションを切断します。 -LP_NORMAL_TERMINATE VPN クライアント側からの切断要求により、PPP セッションを切断します。 -LP_IP_ADDRESS_NOT_DETERMIND VPN クライアントの IP アドレスがまだ決定されていないにもかかわらず、VPN クライアントが通信を行おうとしました。 -LP_DHCP_REQUEST_TRYING DHCP サーバーから IP アドレスを取得しようと試行しています。 -LP_DHCP_REQUEST_OK DHCP サーバーから IP アドレスを取得しました。クライアント IP アドレス: %S, サブネットマスク: %S, デフォルトゲートウェイ: %S, ドメイン名: "%S", DNS サーバー 1: %S, DNS サーバー 2: %S, WINS サーバー 1: %S, WINS サーバー 2: %S, DHCP サーバー IP アドレス: %S, リース時間: %u 秒 -LP_DHCP_REQUEST_NG DHCP サーバーからの IP アドレスの取得に失敗しました。PPP の通信を受諾するためには DHCP サーバーが必要です。仮想 HUB の Ethernet セグメント上で DHCP サーバーが正しく動作しているかどうか確認してください。DHCP サーバーを用意することができない場合は、仮想 HUB の SecureNAT 機能を用いることもできます。 -LP_DHCP_INFORM_TRYING DHCP サーバーからサブネットマスクやデフォルトゲートウェイなどの IP ネットワーク情報を取得しようと試行しています。 -LP_DHCP_INFORM_OK DHCP サーバーから IP ネットワーク情報を取得しました。サブネットマスク: %S, デフォルトゲートウェイ: %S, ドメイン名: "%S", DNS サーバー 1: %S, DNS サーバー 2: %S, WINS サーバー 1: %S, WINS サーバー 2: %S, DHCP サーバー IP アドレス: %S -LP_DHCP_INFORM_NG DHCP サーバーからの IP ネットワーク情報の取得に失敗しました。PPP の通信を受諾するためには DHCP サーバーが必要です。仮想 HUB の Ethernet セグメント上で DHCP サーバーが正しく動作しているかどうか確認してください。DHCP サーバーを用意することができない場合は、仮想 HUB の SecureNAT 機能を用いることもできます。 -LP_SET_IPV4_PARAM クライアントの IP アドレスおよびその他の IP ネットワーク情報の設定が完了しました。クライアント IP アドレス: %S, サブネットマスク: %S, デフォルトゲートウェイ: %S, DNS サーバー 1: %S, DNS サーバー 2: %S, WINS サーバー 1: %S, WINS サーバー 2: %S - - -# (仮想 HUB ログ) -LH_ONLINE 仮想 HUB がオンラインになりました。 -LH_OFFLINE 仮想 HUB がオフラインになりました。 -LH_CONNECT_CLIENT コネクション "%S" (IP アドレス %S, ホスト名 %S, ポート番号 %u, クライアント名 "%S", バージョン %S ビルド %u) が仮想 HUB への接続を試行しています。提示している認証方法は "%s" でユーザー名は "%S" です。 -LH_AUTH_UNKNOWN 不明な認証メソッド -LH_AUTH_ANONYMOUS 匿名認証 -LH_AUTH_PASSWORD パスワード認証 -LH_AUTH_PLAIN_PASSWORD 外部サーバー認証 -LH_AUTH_CERT 証明書認証 -LH_AUTH_TICKET チケット認証 -LH_AUTH_OPENVPN_CERT OpenVPN 証明書認証 -LH_AUTH_RADIUS_NOT_SUPPORT コネクション "%S": ユーザー "%S" の認証方法として RADIUS 認証または Active Directory 認証 (NT ドメイン認証) が指定されましたが、現在の VPN Server のエディションは "%S" であるため、RADIUS 認証または Active Directory 認証 (NT ドメイン認証) を使用することができません。接続は拒否されます。 -LH_AUTH_RADIUS_NOT_SUPPORT_ON_OPEN_SOURCE コネクション "%S": ユーザー "%S" の認証方法として RADIUS 認証または Active Directory 認証 (NT ドメイン認証) が指定されましたが、RADIUS 認証または Active Directory 認証 (NT ドメイン認証) を使用することができません。この機能はオープンソース版 SoftEther VPN にはまだ実装されていません。接続は拒否されます。 -LH_AUTH_CERT_NOT_SUPPORT_ON_OPEN_SOURCE コネクション "%S": ユーザー "%S" の認証方法として証明書認証が指定されましたが、証明書認証を使用することができません。この機能はオープンソース版 SoftEther VPN にはまだ実装されていません。接続は拒否されます。 -LH_AUTH_OK コネクション "%S": ユーザー "%S" として正しく認証されました。 -LH_AUTH_OK_CERT 仮想 HUB のセキュリティアカウントマネージャは、ユーザー "%S" がログインする際の証明書として、次の証明書を VPN Client から受理し、その内容を承認しました: %s -LH_AUTH_NG_CERT 仮想 HUB のセキュリティアカウントマネージャは、ユーザー "%S" がログインする際の証明書として、次の証明書を VPN Client から受理しましたが、この証明書は仮想 HUB の無効な証明書一覧に登録されている内容に一致するため拒否しました: %s -LH_AUTH_NG コネクション "%S": ユーザー認証に失敗しました。提示されたユーザー名は "%S" 、接続元は "%S" でした。 -LH_LOCAL_ONLY コネクション "%S": ユーザー "%S" のパスワードが空白のため、リモートからのログインは拒否されました。 -LH_POLICY_ACCESS_NG コネクション "%S": ユーザー "%S" はセキュリティポリシーによってアクセスが拒否されています。 -LH_USER_EXPIRES コネクション "%S": ユーザー "%S" の有効期限が切れており、アクセスが拒否されました。 -LH_CLIENT_VERSION_OLD コネクション "%S": クライアントのビルド番号は %u です。最低でもビルド %u 以上のクライアントからのみ接続が許可されます。 -LH_CLIENT_ID_REQUIRED コネクション "%S": クライアントから送付されたクライアント ID は %u ですが、この仮想 HUB に設定されている RequiredClientId の値は %u です。 -LH_FARM_SELECT_1 コネクション "%S": クラスタコントローラはこのクライアントの接続先のクラスタメンバを決定しています。 -LH_FARM_SELECT_2 コネクション "%S": 接続先クラスタメンバサーバーの決定に失敗しました。 -LH_FARM_SELECT_3 コネクション "%S": 接続先クラスタメンバサーバーとして現在のこの VPN Server が決定されました。接続受け入れを続行します。 -LH_FARM_SELECT_4 コネクション "%S": 接続先クラスタメンバサーバーとしてサーバー "%S" が決定されました。クライアントに対してこのサーバーへ接続をリダイレクトするように指示します。 -LH_MAX_SESSION コネクション "%S": 仮想 HUB が設定された最大セッション数 %u に達しています。新しいセッションは作成できません。 -LH_MAX_SESSION_CLIENT コネクション "%S": 仮想 HUB が設定された最大クライアントセッション数 %u に達しています。新しいセッションは作成できません。 -LH_MAX_SESSION_BRIDGE コネクション "%S": 仮想 HUB が設定された最大ブリッジセッション数 %u に達しています。新しいセッションは作成できません。 -LH_MAX_SESSION_2 コネクション "%S": VPN Server 上で管理することができる最大セッション数 %u に達しています。新しいセッションは作成できません。 -LH_NEW_SESSION コネクション "%S": 新しいセッション "%S" が作成されました。(IP アドレス %S, ポート番号 %u, 物理レイヤのプロトコル: "%S") -LH_SET_SESSION セッション "%S": パラメータが設定されました。最大 TCP コネクション数 %u, 暗号化の使用 %s, 圧縮の使用 %s, 半二重通信の使用 %s, タイムアウト %u 秒 -LH_NODE_INFO セッション "%S": VPN Client の詳細: (%s) -LH_VLAN_ID セッション "%S": 割り当てられた VLAN ID: %u -LH_INVALID_SIGNATURE セッション "%S": 接続してきたクライアントが無効なプロトコルデータを送信しました。クライアントとの通信が正常にできません。クライアントとこのサーバーとの間のネットワーク回線に異常が無いかどうか、特殊な透過型パケット書き換え装置を設置していないかどうか確認してください。 -LH_END_SESSION セッション "%S": セッションが終了しました。統計情報は次の通りです。合計送信データサイズ: %I64u バイト, 合計受信データサイズ: %I64u バイト -LH_BCAST_STORM セッション "%S": 大量のブロードキャストパケットを検出しました。ポリシーに従ってパケットを破棄する場合があります。送信元 MAC アドレスは %S, 送信元 IP アドレスは %S, 宛先 IP アドレスは %S です。ブロードキャストパケット数は 1 秒間に %u 個以上です (なおこの情報はパケットの一部を機械的に解析した結果であり、不正確な場合があります)。 -LH_DHCP_FORCE セッション "%S": DHCP サーバーが割り当てていない IP アドレス %S を使用しようとしたため、パケットは破棄されました。 -LH_MAC_LIMIT セッション "%S": 新しい MAC アドレス "%S" を関連付けようとしましたが、すでにこのセッションには %u 個の MAC アドレスが関連付けられています。セキュリティポリシーでは、このセッションは最大 %u 個の MAC アドレスを持つことが許可されています。パケットは破棄されます。 -LH_BRIDGE_LIMIT セッション "%S": 新しい MAC アドレス "%S" を関連付けようとしましたが、すでにこのセッションには %u 個の MAC アドレスが関連付けられています。セキュリティポリシーでは、このセッションはブリッジを禁止されているので、 %u 個より多い MAC アドレスを持つことは許可されません。パケットは破棄されます。 -LH_MAC_REGIST セッション "%S": 新しい MAC アドレス "%S" が関連付けられました。 -LH_MAC_REGIST_VLAN セッション "%S": 新しい MAC アドレス "%S" (VLAN ID: %u) が関連付けられました。 -LH_IP_LIMIT セッション "%S": 新しい IP アドレス %S を関連付けようとしましたが、すでにこのセッションには %u 個の IP アドレスが関連付けられています。セキュリティポリシーでは、このセッションは最大 %u 個の IP アドレスを持つことが許可されています。パケットは破棄されます。 -LH_ROUTING_LIMIT セッション "%S": 新しい IP アドレス %S を関連付けようとしましたが、すでにこのセッションには %u 個の IP アドレスが関連付けられています。セキュリティポリシーでは、このセッションはルーティングを禁止されているので、%u 個より多い IP アドレスを持つことは許可されていません。パケットは破棄されます。 -LH_IP_CONFLICT セッション "%S": IP アドレス %S を使用しようとしましたが、この IP アドレスは既に別のセッション "%S" (MAC アドレス: "%S") によって使用されています。このセッションのセキュリティポリシーにより、他のセッションが使用中の IP アドレスとの重複は禁止されます。パケットは破棄されます。詳細情報: CreatedTime=%I64u, UpdatedTime=%I64u, DhcpAllocated=%u, Now=%I64u -LH_NO_SERVER セッション "%S": このセッションに対して %S:%u から %S:%u への TCP/IP 接続要求がありましたが、セキュリティポリシーによりサーバーとしての動作が禁止されているため、パケットは破棄されました。 -LH_NO_DHCP セッション "%S": このセッション上のホスト %S が別のセッション上のホスト %S に対して DHCP サーバーとして IP アドレスを割り当てるパケットを送信しましたが、このセッションのセキュリティポリシーにより DHCP サーバーとしての動作は禁止されています。パケットは破棄されます。 -LH_REGIST_DHCP セッション "%S": このセッション上のホスト "%S" (%S) の DHCP サーバーは、別のセッション "%S" 上のホスト "%S" に対して新しい IP アドレス %S を割り当てました。 -LH_BRIDGE_1 セッション "%S": ローカルブリッジを物理的な Ethernet インターフェイス "%S" との間で開始しました。 -LH_BRIDGE_2 セッション "%S": 物理的な Ethernet インターフェイス "%S" との間の通信に失敗したため、ローカルブリッジを停止しました。 -LH_SET_MTU セッション "%S": 物理的な Ethernet インターフェイス "%S" の MTU は現在 %u です。%u バイトの Ethernet パケットを送受信するため、これを %u に設定変更しました。 -LH_SET_MTU_ERROR セッション "%S": エラー: 物理的な Ethernet インターフェイス "%S" の MTU は現在 %u です。%u バイトの Ethernet パケットを送受信するため MTU を %u に設定することに失敗しました。この物理的な Ethernet インターフェイスおよびデバイスドライバが 1,514 バイト (ペイロード部分: 1,500 バイト) を超える Ethernet パケットの送受信に対応していない可能性があります。その場合、サイズの大きなタグ VLAN パケットの送受信はできません。物理的な Ethernet インターフェイスの種類を Jumbo Frames に対応したものに交換するか、デバイスドライバをアップデートしてみてください。また、オペレーティングシステムやデバイスドライバの設定で、Jumbo Frames を許可してください。 -LH_START_BRIDGE ローカルブリッジ接続 "%S" を開始しました。ブリッジセッション "%S" を作成しました。 -LH_STOP_BRIDGE ローカルブリッジ接続 "%S" を停止しました。 -LH_LINK_START カスケード接続 "%s" が確立されました。カスケードセッション "%S" を作成しました。 -LH_LINK_STOP カスケード接続 "%s" が停止しました。 -LH_NAT_START SecureNAT が開始されました。SecureNAT セッション "%S" を作成しました。 -LH_NAT_STOP SecureNAT が停止しました。 -LH_NAT_TCP_SUCCEED TCP セッション %u: ホスト "%S (%S)", ポート %u への接続に成功しました。 -LH_NAT_TCP_FAILED TCP セッション %u: ホスト "%S", ポート %u への接続に失敗しました。 -LH_NAT_TCP_DELETED TCP セッション %u が削除されました。 -LH_NAT_TCP_CREATED TCP セッション %u が作成されました。接続元 %S:%u, 接続先 %S:%u -LH_NAT_UDP_DELETED UDP セッション %u が削除されました。 -LH_NAT_UDP_CREATED UDP セッション %u が作成されました。接続元 %S:%u, 接続先 %S:%u -LH_NAT_DHCP_CREATED DHCP エントリ %u が作成されました。MAC アドレス: %S, IP アドレス: %S, ホスト名: %S, 有効期限: %u 秒 -LH_CHANGE_PASSWORD_1 コネクション "%S" (IP アドレス %S) がパスワード変更モードで仮想 HUB に接続しました。 -LH_CHANGE_PASSWORD_2 コネクション "%S": パスワードの変更に失敗しました。指定したユーザー "%S" は存在しません。 -LH_CHANGE_PASSWORD_3 コネクション "%S": パスワードの変更に失敗しました。ユーザー "%S" の認証方法はパスワード認証ではありません。 -LH_CHANGE_PASSWORD_4 コネクション "%S": パスワードの変更に失敗しました。ユーザー "%S" の古いパスワードが間違っています。 -LH_CHANGE_PASSWORD_5 コネクション "%S": ユーザー "%S" のパスワードを変更しました。 -LH_CONNECT_1 カスケード接続 "%s": %u 回目の接続動作を開始します。 -LH_CONNECT_2 カスケード接続 "%s": 接続が完了しました。セッション名: "%S" -LH_CONNECT_ERROR カスケード接続 "%s": 接続が切断されたか、接続に失敗しました。理由: %s (コード %u) -LH_POLICY_MONITOR_MODE コネクション "%S": セキュリティポリシーで [モニタリングモード] が許可されていないユーザーが、モニタリングモードを有効にするように要求して仮想 HUB に接続しようとしたため、接続を拒否しました。 -LH_POLICY_BRIDGE_MODE コネクション "%S": セキュリティポリシーで [ブリッジを禁止する] および [ルーティングを禁止する] の両方が有効になっているユーザーが、ブリッジ / ルータモードを有効にするように要求して仮想 HUB に接続しようとしたため、接続を拒否しました。 -LH_NOT_ENOUGH_CLIENT_LICENSE コネクション "%S": このコネクションは VPN Server に「クライアント接続モード」で接続しようとしましたが、サーバー全体のクライアント接続数が登録されているクライアント接続ライセンス数を上回るため、このコネクションの接続を受け付けることができませんでした。同時接続ライセンス数が不足している場合は、既存の別のクライアントの接続を切断するか、ライセンス数を増やす必要があります。現在登録されているクライアント接続ライセンス数は %u で、サーバーへの接続数は %u でした。 -LH_NOT_ENOUGH_BRIDGE_LICENSE コネクション "%S": このコネクションは VPN Server に「ブリッジ接続モード」で接続しようとしましたが、サーバー全体のブリッジ接続数が登録されているブリッジ接続ライセンス数を上回るため、このコネクションの接続を受け付けることができませんでした。同時接続ライセンス数が不足している場合は、既存の別のクライアントの接続を切断するか、ライセンス数を増やす必要があります。現在登録されているブリッジ接続ライセンス数は %u で、サーバーへの接続数は %u でした。 -LH_TOO_MANY_MULTILOGINS コネクション "%S": ユーザー "%S" がログインしようとしましたが、このユーザーが適用されるセキュリティポリシーは多重ログイン数の上限を %u セッションに制限しています。現在のこのユーザーのログイン数は %u セッションですので、新たに VPN 接続を許可できませんでした。 -LH_TOO_MANY_MULTILOGINS2 コネクション "%S": ユーザー "%S" がログインしようとしましたが、この VPN Server の製品エディションでは、1 個のユーザーオブジェクトに対して同時にログインできる VPN セッション数は %u セッションに制限されています。現在のこのユーザーのログイン数は %u セッションですので、新たに VPN 接続を許可できませんでした。なお、VPN Server の Professional Edition 以上の製品エディションの場合は、1 個のユーザーオブジェクトに対して同時に多重ログインが可能です。 -LH_PACKET_LOG_NO_LOG この VPN Server はパケットログの保存に対応していない製品エディションのため、IP アドレスや TCP/UDP などのデータは保存されません。VPN Server のエディションを Professional Edition 以上にアップグレードすると、すべてのパケットログが保存されるようになります。 -LH_PACKET_LOG_NO_LOG_OSS この VPN Server はオープンソース版または無償版であるため、パケットログの保存に対応していません。そのため、IP アドレスや TCP/UDP などのデータは保存されません。 -LH_NO_RADIUS_SETTING この仮想 HUB にユーザー "%S" が接続するためには RADIUS 認証を行う必要がありますが、RADIUS サーバーの設定が行われていないためユーザー認証を実施できません。 -LH_KERNEL_MODE_START 仮想 NAT 機能でカーネルモード NAT がインターフェイス "%S" 上で利用可能であることが検出されました。カーネルモード NAT を開始します。今後の TCP, UDP および ICMP の NAT 処理はカーネルモードを経由して高速に実行されます。カーネルモード NAT の物理ネットワーク上でのパラメータ: IP アドレス = "%r", サブネットマスク = "%r", デフォルトゲートウェイ = "%r", ブロードキャストアドレス = "%r", 仮想 MAC アドレス: "%S", DHCP サーバーアドレス: "%r", DNS サーバーアドレス: "%r" -LH_KERNEL_MODE_STOP 仮想 NAT 機能でインターフェイス "%S" 上のカーネルモード NAT を停止しました。 - - -# (管理ログ) -LA_CONNECTED_1 コネクション "%S" がサーバー管理モードで接続しました。 -LA_CONNECTED_2 コネクション "%S" が仮想 HUB 管理モードで接続しました。仮想 HUB 名は "%S" です。 -LA_IP_DENIED コネクション "%S" は adminip.txt ファイルで許可されていない IP アドレスから管理モードで接続しようとしました。切断します。 -LA_ERROR コネクション "%S" は管理モードにログインできませんでした。%s (エラーコード %u) -LA_OK コネクション "%S" が管理モードでのログインに成功しました。 -LA_RPC_START コネクション "%S" は管理モードのための新しいリモートプロシージャコールセッション "%S" を生成しました。 -LA_TAG_1 管理モード [%S]: -LA_TAG_2 管理モード [%S] (仮想 HUB "%S"): -LA_CREATE_LISTENER 新しい TCP リスナー (ポート番号 %u) を作成しました。 -LA_DELETE_LISTENER TCP リスナー (ポート番号 %u) を削除しました。 -LA_ENABLE_LISTENER TCP リスナー (ポート番号 %u) を有効化しました。 -LA_DISABLE_LISTENER TCP リスナー (ポート番号 %u) を無効化しました。 -LA_SET_PORTS_UDP UDP ポートの一覧が設定されました: %s. -LA_SET_PROTO_OPTIONS オプション %s が設定されました。 -LA_SET_SERVER_PASSWORD サーバー管理者パスワードを設定しました。 -LA_SET_FARM_SETTING クラスタリング設定を変更しました。 -LA_SET_SERVER_CERT サーバー証明書を設定しました。 -LA_REGENERATE_SERVER_CERT サーバー証明書を再生成しました。新しい CN: "%S" -LA_SET_SERVER_CIPHER サーバーの新しい暗号化アルゴリズム名を設定しました。新しい暗号化アルゴリズム名は "%S" です。 -LA_CREATE_HUB 新しい仮想 HUB "%S" を作成しました。 -LA_SET_HUB 仮想 HUB の設定を変更しました。 -LA_DELETE_HUB 仮想 HUB "%S" を削除しました。 -LA_SET_HUB_RADIUS 仮想 HUB の外部 RADIUS 認証サーバーの設定を変更しました。 -LA_DISCONNECT_CONN サーバーに接続しているクライアントのコネクション "%S" を強制切断しました。 -LA_SET_HUB_ONLINE 仮想 HUB をオンラインにしました。 -LA_SET_HUB_OFFLINE 仮想 HUB をオフラインにしました。 -LA_SET_SNAT_OPTION SecureNAT オプションを設定しました。 -LA_ENABLE_SNAT SecureNAT 機能を有効にしました。 -LA_DISABLE_SNAT SecureNAT 機能を無効にしました。 -LA_SET_HUB_LOG ログ保存設定を変更しました。 -LA_ADD_CA 信頼するルート証明書の登録を追加しました。 -LA_DELETE_CA 信頼するルート証明書の登録を削除しました。 -LA_CREATE_LINK カスケード接続 "%s" を追加しました。 -LA_SET_LINK カスケード接続 "%s" の設定を変更しました。 -LA_SET_LINK_ONLINE カスケード接続 "%s" をオンラインにしました。 -LA_SET_LINK_OFFLINE カスケード接続 "%s" をオフラインにしました。 -LA_DELETE_LINK カスケード接続 "%s" を削除しました。 -LA_RENAME_LINK カスケード接続 "%s" の名前を "%s" に変更しました。 -LA_ADD_ACCESS アクセスリストを追加しました。 -LA_DELETE_ACCESS アクセスリストを削除しました。 -LA_SET_ACCESS_LIST アクセスリストを更新しました。%u 個のアクセスリストを設定しました。 -LA_SET_AC_LIST 接続元 IP 制限リストを更新しました。%u 個のルール項目を設定しました。 -LA_CREATE_USER ユーザー "%S" を作成しました。 -LA_SET_USER ユーザー "%S" の設定を更新しました。 -LA_DELETE_USER ユーザー "%S" を削除しました。 -LA_CREATE_GROUP グループ "%S" を作成しました。 -LA_SET_GROUP グループ "%S" の設定を更新しました。 -LA_DELETE_GROUP グループ "%S" を削除しました。 -LA_DELETE_SESSION セッション "%S" を強制切断しました。 -LA_SET_KEEP サーバーのインターネット接続維持設定を更新しました。 -LA_SET_SYSLOG サーバーの syslog 送信機能の設定を更新しました。 -LA_DELETE_BRIDGE ローカルブリッジ接続定義 "%S" -> "%S" を削除しました。 -LA_ADD_BRIDGE ローカルブリッジ接続定義 "%S" -> "%S" を追加しました。 -LA_REBOOT_SERVER VPN Server を再起動するように要求しました。 -LA_GET_CONFIG config ファイルを読み出しました。 -LA_SET_CONFIG config ファイルを書き込みました。VPN Server を再起動します。 -LA_SET_HUB_ADMIN_OPTION 仮想 HUB "%S" の管理オプションを設定しました。 -LA_SET_HUB_EXT_OPTION 仮想 HUB "%S" の拡張オプションを設定しました。 -LA_ADD_L3_SW 仮想レイヤ 3 スイッチ "%S" をサーバーに作成しました。 -LA_DEL_L3_SW 仮想レイヤ 3 スイッチ "%S" をサーバーから削除しました。 -LA_START_L3_SW 仮想レイヤ 3 スイッチ "%S" を開始しました。 -LA_STOP_L3_SW 仮想レイヤ 3 スイッチ "%S" を停止しました。 -LA_ADD_L3_IF 仮想 HUB "%S" に対する仮想インターフェイスを仮想レイヤ 3 スイッチ "%S" に追加しました。 -LA_DEL_L3_IF 仮想 HUB "%S" に対する仮想インターフェイスを仮想レイヤ 3 スイッチ "%S" から削除しました。 -LA_ADD_L3_TABLE ネットワーク "%S" に対するルーティングテーブルを仮想レイヤ 3 スイッチ "%S" に追加しました。 -LA_DEL_L3_TABLE ネットワーク "%S" に対するルーティングテーブルを仮想レイヤ 3 スイッチ "%S" から削除しました。 -LA_ADD_CRL 無効な証明書の一覧の登録を追加しました。 -LA_DEL_CRL 無効な証明書の一覧の登録を削除しました。 -LA_SET_CRL 無効な証明書の一覧の登録の登録済み項目を編集しました。 -LA_READ_LOG_FILE サーバー "%S" 上のログファイル "%S" をダウンロードしました。 -LA_ADD_LICENSE_KEY 新しいライセンスキー "%S" を登録しました。 -LA_DEL_LICENSE_KEY 既存のライセンス (%u 番) を削除しました。 -LA_SET_IPSEC_CONFIG IPsec サーバーの設定を更新しました。 -LA_ADD_ETHERIP_ID EtherIP / L2TPv3 サーバーの設定 (ID="%S") を追加しました。 -LA_DEL_ETHERIP_ID EtherIP / L2TPv3 サーバーの設定 (ID="%S") を削除しました。 -LA_SET_OVPN_SSTP_CONFIG OpenVPN および MS-SSTP VPN サーバーの設定を更新しました。 -LA_DDNS_HOSTNAME_CHANGED ダイナミック DNS 機能のホスト名を "%S" に変更しました。 -LA_SET_SPECIAL_LISTENER 特別なリスナの有効 / 無効状態を変更しました。 - -# (Client ログ) -LC_START_1 SoftEther VPN Client エンジンを起動しました。 -LC_START_2 %S %S -LC_START_3 %S -LC_END SoftEther VPN Client エンジンをシャットダウンしました。 -LC_LOAD_CONFIG_1 設定ファイルを読み込んでいます。 -LC_LOAD_CONFIG_2 設定ファイルの読み込みが完了しました。 -LC_LOAD_CONFIG_3 設定ファイルが存在しません。初期設定を作成します。 -LC_NEW_ACCOUNT 新しい接続設定 "%s" を作成しました。 -LC_DELETE_ACCOUNT 接続設定 "%s" を削除しました。 -LC_RENAME_ACCOUNT 接続設定 "%s" の名前を "%s" に変更しました。 -LC_CONNECT 接続設定 "%s" への接続処理を開始しました。 -LC_CONNECT_1 接続設定 "%s": %u 回目の接続動作を開始します。 -LC_CONNECT_2 接続設定 "%s": 接続が完了しました。セッション名: "%S" -LC_CONNECT_ERROR 接続設定 "%s": 接続が切断されたか、接続に失敗しました。理由: %s (コード %u) -LC_DISCONNECT 接続設定 "%s" を切断します。 -LC_CREATE_VLAN 仮想 LAN カード "%S" を作成しました。 -LC_UPDATE_VLAN 仮想 LAN カード "%S" のドライバを再インストールしました。 -LC_DELETE_VLAN 仮想 LAN カード "%S" を削除しました。 -LC_SET_PASSWORD クライアントサービスに接続するためのパスワード設定を変更しました。 -LC_TAP_NOT_FOUND MacOS X 用の tun/tap ドライバが見つかりません。tun/tap ドライバのインストールを行ってください。 - -# (イレーザー ログ) -LE_START ディレクトリ "%S" の監視を開始します。ディスクの空き容量が %S 未満になった場合、このディレクトリのサブディレクトリ内に保存されているログファイルおよび設定のバックアップファイルを、古い順番に自動的に削除します。削除を開始するディスクの最小空き容量は、設定ファイルの "AutoDeleteCheckDiskFreeSpaceMin" 項目で変更することができます。 -LE_DELETE ディスクの空き容量が %S 未満になったため、古いファイル "%S" を自動的に削除しました。なお、削除を開始するディスクの最小空き容量は、設定ファイルの "AutoDeleteCheckDiskFreeSpaceMin" 項目で変更することができます。 -LE_NOT_ENOUGH_FREE <<警告>> ディスクの空き容量が %S 以下になっていますが、これ以上古いログファイルおよび設定のバックアップファイルを自動的に削除することができませんでした。直ちに手動でこのコンピュータの不要なファイルを削除し、ディスク容量を確保することをお勧めします。空きディスク容量が極端に少なくなると、コンピュータの動作が不安定になる場合があります。 - -# (レイヤ 3 スイッチログ) -L3_SWITCH_START 仮想レイヤ 3 スイッチ "%S" が起動しました。このスイッチに登録されているすべてのインターフェイスの仮想 HUB がオンラインになるまで待機して、動作を開始します。 -L3_SWITCH_ONLINE 仮想レイヤ 3 スイッチ "%S" のすべてのインターフェイスの仮想 HUB がオンラインになったので、仮想レイヤ 3 スイッチの動作を開始します。 -L3_SWITCH_OFFLINE 仮想レイヤ 3 スイッチ "%S" に登録されている 1 つ以上のインターフェイスの仮想 HUB が停止したので、仮想レイヤ 3 スイッチの動作を停止します。 -L3_SWITCH_STOP 仮想レイヤ 3 スイッチ "%S" が終了しました。 - - -# Microsoft.c 関係 -MS_VIRTUAL 独自の仮想/内部インタフェース -MS_ETHERNET Ethernet インターフェイス -MS_TOKENRING トークンリングインターフェイス -MS_FDDI FDDI インターフェイス -MS_PPP PPP (ダイヤルアップまたは VPN) -MS_LOOPBACK ループバックインターフェイス -MS_SLIP SLIP インターフェイス -MS_WLAN 無線 LAN インターフェイス -MS_OTHER 不明な種類のインターフェイス -MS_NON_OPERATIONAL 無効 -MS_UNREACHABLE 未接続 -MS_DISCONNECTED 未接続 -MS_CONNECTING 接続中 -MS_CONNECTED 接続済み -MS_OPERATIONAL 接続済み - - -# Network Utility 関係 -UT_SM_COLUMN_1 項目名 -UT_SM_COLUMN_2 値 -UT_SM_ST_TITLE ネットワークアダプタ名 -UT_SM_ST_GUID GUID -UT_SM_ST_TYPE 種類 -UT_SM_ST_TYPE2 物理 Ethernet LAN 接続 -UT_SM_ST_STATUS 状況 -UT_SM_ST_MTU MTU -UT_SM_ST_SPEED リンク速度 -UT_SM_ST_ADDRESS 物理アドレス -UT_SM_ST_RECV_BYTES 受信バイト数 -UT_SM_ST_RECV_BCASTS 受信ブロードキャスト数 -UT_SM_ST_RECV_UNICASTS 受信ユニキャスト数 -UT_SM_ST_SEND_BYTES 送信バイト数 -UT_SM_ST_SEND_BCASTS 送信ブロードキャスト数 -UT_SM_ST_SEND_UNICASTS 送信ユニキャスト数 -UT_SM_ST_IP IP アドレス %u -UT_SM_ST_SUBNET サブネットマスク %u -UT_SM_ST_GATEWAY ゲートウェイ %u -UT_SM_ST_DHCP DHCP サーバー -UT_SM_ST_DHCP_1 リース開始日時 -UT_SM_ST_DHCP_2 リース期限日時 -UT_SM_ST_WINS_1 WINS サーバー 1 -UT_SM_ST_WINS_2 WINS サーバー 2 - - -# EtherLogger Manager 関係 -EM_TITLE SoftEther EtherLogger Manager -EM_REMOTE_TITLE SoftEther EtherLogger サービスに接続し、管理することができます。\r\n管理する EtherLogger サービスが動作しているコンピュータのホスト名または IP アドレスを入力してください。":" (コロン) に続けてポート番号を指定することもできます。 -EM_MAIN_COLUMN_1 LAN カード名 -EM_MAIN_COLUMN_2 状態 -EM_MAIN_OK 動作中 -EM_MAIN_ERROR エラー発生 -EM_ADD_NEW 新しいキャプチャデバイスの追加 -EM_ADD_EDIT キャプチャ設定の編集 -EM_DELETE_CONFIRM キャプチャ設定 "%S" を削除しますか? -EM_NO_LICENSE_COLUMN ご注意: -EM_NO_LICENSE 製品ライセンスが 1 つも登録されていないため、この SoftEther EtherLogger は動作しません。 - -EM_UNSUPPORTED この SoftEther EtherLogger が動作しているオペレーティングシステム上では、SoftEther EtherLogger を使用することはできません。SoftEther EtherLogger が使用できるオペレーティングシステムの一覧については、SoftEther EtherLogger のオンラインドキュメントを参照してください。 -EM_WPCAP_REMOTE この SoftEther EtherLogger を使用するためには、WinPcap ソフトウェアをインストールする必要があります。現在、サーバー コンピュータ上には WinPcap ソフトウェアがインストールされていません。\r\n\r\nWinPcap ソフトウェアのインストールを続行するためには、VPN Server が動作しているサーバー コンピュータ上で SoftEther EtherLogger Managerを起動し、localhost (自分自身) に対して接続した状態で、ローカルブリッジ機能設定画面を表示する必要があります。\r\n続行するには、一旦この管理セッションを終了し、サーバー コンピュータ上で SoftEther EtherLogger Manager を起動してから、localhost に対して接続して、設定を続行してください。 -EM_WPCAP_ROOT この SoftEther EtherLogger を使用するためには、WinPcap ソフトウェアをインストールする必要があります。\r\n\r\nインストールを継続するには、このコンピュータ上で Administrators (管理者) 権限を持ったユーザーでログオンする必要があります。\r\nAdministrators 権限でログオンし、もう一度 SoftEther VPN サーバー管理マネージャを起動してください。 -EM_WPCAP_INSTALL この SoftEther EtherLogger を使用するためには、WinPcap ソフトウェアをインストールする必要があります。現在、サーバー コンピュータ上には WinPcap ソフトウェアがインストールされていません。\r\n\r\nWinPcap はフリーソフトウェアであり、VPN Server の一部として同梱されているため、簡単にインストールすることができます。\r\n\r\nWinPcap のインストールを開始しますか? -EM_WPCAP_REBOOT1 WinPcap のインストールが完了した後に SoftEther EtherLogger を使用する場合は、コンピュータを再起動する必要があります。\r\n\r\nコンピュータを手動で再起動し、SoftEther EtherLogger が起動した後で、もう一度設定を行ってください。 -EM_WPCAP_REBOOT2 WinPcap のインストールが完了した後に、SoftEther EtherLogger サービスを再起動する必要があります。\r\n\r\nSoftEther EtherLogger サービスの再起動は短時間で完了しますが、現在この SoftEther EtherLogger に接続している管理セッションはすべて切断されます。\r\nこの管理セッションも切断されるため、続行するには再接続してください。\r\n\r\nSoftEther EtherLogger サービスを再起動しますか? -EM_RESOURCE WinPcap のドライバを読み込めませんでした。 - - - -########################################################################### -# # -# ソフトウェア内のダイアログボックスの文字列データ # -# # -########################################################################### - - -PREFIX D_SECURE -CAPTION %s - %S へのアクセス -S_TITLE %S へのアクセス -S_DEVICE_INFO デバイス名: %S\r\n製造元: %S -IDS_STATIC1 デバイス情報 -S_WARNING 一定回数 PIN コードを間違えるとデバイスにアクセスできなくなる場合があります。ご注意ください。 -IDOK &OK -IDCANCEL キャンセル -S_PIN_CODE &PIN コード: - - -PREFIX D_PKCSUTIL -CAPTION PKCS#12 書き込みユーティリティ -S_TITLE ePass 1000 USB トークン PKCS#12 書き込みユーティリティ -STATIC1 このユーティリティを使用すると、任意の PKCS#12 ファイル (証明書ファイル) を ePass 1000 USB ハードウェアセキュリティトークンに書き込むことができます。\r\n\r\n証明書ファイルが書き込まれた USB トークンは、SoftEther VPN の認証に使用できます。 -STATIC2 PKCS#12 ファイルの書き込み -STATIC3 既存の PKCS#12 ファイルを USB トークンに書き込む場合は、[書き込み] をクリックしてください。\r\n※ すでに USB トークン内に SoftEther VPN 用の PKCS#12 証明書が格納されている場合は上書きされます。 -B_WRITE 書き込み(&W) -STATIC4 USB トークン内の PKCS#12 証明書の消去 -STATIC5 すでに SoftEther VPN 用の PKCS#12 証明書が格納されている USB トークンから、証明書データを消去することができます。 -B_ERASE 消去(&E) -IDCANCEL ユーティリティの終了(&X) -S_COPYRIGHT Copyright (c) SoftEther VPN Project.\r\nAll Rights Reserved. - - -PREFIX D_PASSPHRASE -CAPTION 秘密鍵のパスフレーズ -STATIC1 秘密鍵はパスフレーズによって保護されています。\r\n\r\n秘密鍵を読み取るためのパスフレーズを入力してください。 -STATIC2 パスフレーズ(&P): -IDOK &OK -IDCANCEL キャンセル - - -PREFIX D_NM_CONNECT -CAPTION SoftEther VPN User-mode Router へ接続 -S_TITLE %S に接続しています... - - -PREFIX D_PASSWORD -CAPTION %S へのログイン -S_TITLE サーバー %S にログインするためのユーザー名とパスワードを入力してください。また、正しいアカウントの種類が選択されていることを確認してください。 -STATIC1 ユーザー情報の入力(&R): -STATIC2 アカウントの種類(&T): -STATIC3 ユーザー名(&N): -STATIC4 パスワード(&P): -R_NO_SAVE_PASSWORD パスワードを保存しない(&D) -S_COUNTDOWN 入力が行われない場合、あと %u 秒後に自動的に再接続します... -IDOK &OK -IDCANCEL 接続の中断 - - -PREFIX D_STATUS -CAPTION %s に接続しています... -S_STATUS 初期化しています... -IDCANCEL キャンセル - - -PREFIX D_CERT -CAPTION 証明書 -S_TITLE この証明書に関する情報は以下の通りです。 -STATIC1 証明書基本情報: -STATIC2 発行先: -STATIC3 発行者: -STATIC4 有効期限: -STATIC5 証明書詳細情報: -STATIC6 この証明書を署名した証明機関の証明書: -S_PARENT この証明書を署名した証明機関の証明書が信頼できる証明書のリストに登録されています。 -S_PARENT_BUTTON_STR 証明書の表示(&V) -IDCANCEL &OK -B_SAVE ファイルに保存(&S) - - -PREFIX D_CHECKCERT -CAPTION セキュリティの警告 - %s -S_TITLE 現在接続しようとしている接続先 VPN Server "%S" との間の通信は暗号化されていますが、サーバーが提示したサーバー証明書が信頼できるかどうかはわかりません。 -STATIC1 サーバー証明書について -STATIC2 VPN 通信では、サーバーとクライアントの間で暗号化通信 (SSL セッション) を確立します。その際にサーバーの証明書を確認することによって、接続しようとしているサーバーが本物かどうかを検証することができます。 -S_MSG1 接続先の VPN Server "%S" が提示したサーバー証明書は以下のとおりです。 -STATIC3 発行先: -STATIC4 発行者: -STATIC5 有効期限: -B_SHOW 証明書を表示する(&S) -STATIC6 ダイジェスト (MD5): -STATIC7 ダイジェスト (SHA-1): -IDOK 接続を続ける(&R) -IDCANCEL 接続をキャンセル(&C) -STATIC8 このサーバー証明書は、信頼された証明機関により発行されていないか、有効期限切れか、その他の問題がある可能性があります。 -STATIC9 上記の証明書の内容を確認してから、この VPN Server への接続を行うかどうかを決定してください。[接続をキャンセル] をクリックすると、このサーバーへの接続を中断します。 - - -PREFIX D_CONNECTERROR -CAPTION 接続エラー - %s -S_TITLE VPN サーバー "%S" との通信で以下のエラーが発生しました。 -S_COUNTDOWN あと %u 秒後に自動的に再接続します... -IDOK 再試行(&R) -IDCANCEL 接続の中断 -R_HIDE 今回の接続時にはこのウインドウを非表示にする(&H) - - -PREFIX D_CM_LOGIN -CAPTION パスワードの入力 - VPN クライアント接続マネージャ -S_TITLE %s 上で動作している VPN Client を操作するためには、クライアント管理パスワードが必要です。クライアント管理パスワードを入力してください。 -STATIC1 パスワード(&P): -STATIC2 クライアント管理パスワードの入力: -IDOK &OK -IDCANCEL キャンセル - - -PREFIX D_CONNECTION_STATUS -S_TITLE 接続設定 %s の VPN セッションの状況 (リアルタイム) -B_POLICY セキュリティポリシー(&P)... -B_SERVER_CERT サーバー証明書(&S) -B_CLIENT_CERT クライアント証明書(&E) -IDCANCEL 閉じる(&C) - - -PREFIX D_CM_POLICY -CAPTION セキュリティポリシー一覧 -S_TITLE 接続設定 %s の現在のセッションに設定されているセキュリティポリシー -IDCANCEL 閉じる(&C) - - -PREFIX D_CM_ACCOUNT -STATIC1 VPN Server への接続設定を行います。 -S_ACCOUNT_NAME 接続設定名(&T): -STATIC2 接続先 VPN Server の指定(&B): -STATIC3 接続したい VPN Server が動作しているコンピュータのホスト名または IP アドレス、ポート番号、および仮想 HUB 名を指定してください。 -STATIC4 ホスト名(&H): -STATIC5 ポート番号(&P): -STATIC6 (TCP ポート) -STATIC7 仮想 HUB 名(&V): -STATIC8 経由するプロキシサーバーの設定(&X): -STATIC9 プロキシサーバーを経由して VPN Server に接続することができます。 -STATIC10 プロキシの種類(&M): -R_DIRECT_TCP 直接 TCP/IP 接続 (プロキシを使わない) (&D) -R_HTTPS HTTP プロキシサーバー経由接続(&Q) -R_SOCKS SOCKS4 プロキシサーバー経由接続(&S) -R_SOCKS5 SOCKS5 プロキシサーバー経由接続(&S) -B_PROXY_CONFIG プロキシサーバーの接続設定(&2) -STATIC11 サーバー証明書の検証オプション(&F): -R_CHECK_CERT サーバー証明書を必ず検証する(&3) -B_TRUST 信頼する証明機関の証明書の管理(&4) -B_SERVER_CERT 固有証明書の登録(&R) -B_VIEW_SERVER_CERT 固有証明書の表示(&5) -S_VLAN_GROUP 使用する仮想 LAN カード(&L): -S_POLICY_1 カスケード接続を行う際に、この仮想 HUB 側で生成されるセッションに適用するセキュリティポリシーを設定することができます。 -B_POLICY セキュリティポリシー(&L) -STATIC12 ユーザー認証(&A): -STATIC13 認証の種類(&6): -S_USERNAME ユーザー名(&U): -S_PASSWORD パスワード(&Y): -S_CERT_INFO ユーザー認証に使用するクライアント証明書を指定する必要があります。 -STATIC14 通信の詳細設定(&G): -R_RETRY VPN Server との通信が切断された場合は再接続する(&Z) -S_RETRY_NUM_1 再接続回数(&C): -S_RETRY_NUM_2 回 -S_RETRY_SPAN_1 再接続間隔(&K): -S_RETRY_SPAN_2 秒 -R_INFINITE 無限に再接続を試行する (常時接続) (&I) -B_DETAIL 高度な通信設定(&N)... -IDOK &OK -IDCANCEL キャンセル -B_CHANGE_PASSWORD パスワードの変更(&J) -S_CHANGE_PASSWORD VPN Server 側のユーザーのパスワードを変更できます。 -R_HIDE 接続中の画面とエラー画面を非表示(&W) -R_HIDE2 IP アドレスメッセージを非表示(&9) -STATIC15 VPN Server に接続する際に必要なユーザー認証情報を設定してください。 -B_REGIST_CLIENT_CERT クライアント証明書の指定(&8) -B_IE IE の設定を使用(&E) -R_DISABLE_NATT NAT-T 無効 - - -PREFIX D_CM_PROXY -CAPTION プロキシサーバーの接続設定 -STATIC1 経由するプロキシサーバー (HTTP プロキシまたは SOCKS プロキシ) のホスト名または IP アドレス、ポート番号、および必要な場合はユーザー名とパスワードを入力してください。 -STATIC2 ホスト名(&H): -STATIC3 ポート番号(&A): -STATIC4 ユーザー名(&U): -STATIC5 パスワード(&P): -B_HTTP_HEADER Custom HTTP header values -IDOK &OK -IDCANCEL キャンセル -STATIC6 (オプション) -STATIC7 (オプション) - - -PREFIX D_CM_PROXY_HTTP_HEADER -CAPTION Custom Proxy HTTP Header Values -B_NEW New -B_DELETE Delete -B_CLEAR Clear -IDOK &OK -IDCANCEL Cancel - - -PREFIX D_CM_DETAIL -CAPTION 高度な通信設定 -STATIC1 ネットワーク、通信プロトコル、およびセキュリティに関する詳しい知識をお持ちの方とシステム管理者向けのオプションです。VPN プロトコルの通信設定をカスタマイズできます。 -STATIC2 VPN 通信の最適化(&T): -STATIC3 VPN Server との間の VPN 通信セッションにおけるデータ伝送に複数本の TCP コネクションを束ねて使用することにより、通信速度を向上できる場合があります。 -STATIC4 VPN 通信に使用する TCP コネクション数(&N): -STATIC5 本 -STATIC6 ※ サーバーへの接続回線が高速な場合は 8 本程度を、ダイヤルアップ等の低速な場合は 1 本をお勧めします。 -STATIC7 詳細設定: -STATIC8 各 TCP コネクションの確立間隔(&S): -STATIC9 秒 -R_USE_DISCONNECT 各 TCP コネクションの寿命を設定する(&A) -STATIC10 寿命(&P): -STATIC11 秒 -STATIC12 2 本以上の TCP コネクションを束ねて VPN 通信を行う際、「半二重モード」を使用することができます。\r\n半二重モードを有効にすると、自動的に各 TCP コネクションのデータ伝送方向を半数ずつ固定することができます。\r\n\r\nたとえば、8 本の TCP コネクションを使用して VPN セッションを確立した場合、半二重モードを有効にすると、4 本の TCP コネクションはアップロード方向専用、残りの 4 本のコネクションはダウンロード方向専用に固定され通信が行われます。 -R_USE_HALF_CONNECTION 半二重モードを使用する(&H) -STATIC13 暗号化と圧縮(&C): -STATIC14 通常は、VPN Server との間の通信を SSL で暗号化して、情報の盗聴や改ざんを防止します。暗号化を無効にすることもできます。暗号化を無効にすると、通信のスループットが向上しますが、通信データは平文でネットワーク上を流れます。 -R_USE_ENCRYPT VPN Server との間の通信を SSL で暗号化する(&E) -STATIC15 データ圧縮技術を使用して、VPN 通信を圧縮することができます。ダイヤルアップ接続やモバイル接続など、低速回線でのみ使用してください。 -R_DISABLE_UDP UD&P 高速化機能を無効にする -R_USE_COMPRESS データ圧縮を使用する(&U) -STATIC16 接続モードの選択(&M): -S_MODE VPN Server に下記の接続モードを指定して接続することができます。(ネットワーク管理者用) -R_BRIDGE ブリッジ / ルータモードで接続(&B) -R_MONITOR モニタリングモードで接続(&D) -STATIC17 その他の設定(&G): -R_NO_ROUTING ルーティングテーブルの調整処理を行わない(&R) -STATIC18 この設定画面の設定項目は、システム管理者から指示があった場合や、ネットワークやセキュリティに関して詳しい知識をお持ちの場合以外は変更しないでください。 -STATIC19 VoIP / QoS 対応機能を使用すると、IP 電話パケットなどの優先度の高いパケットを VPN 内で高速に伝送できます。 -R_DISABLE_QOS VoIP / QoS 対応機能を無効にする(&Q) -IDOK &OK -IDCANCEL キャンセル -S_UDPACCEL データ圧縮技術を使用して、VPN 通信を圧縮することができます。ダイヤルアップ接続やモバイル接続など、低速回線でのみ使用してください。 - - -PREFIX D_CM_NEW_VLAN -CAPTION 新しい仮想 LAN カードの作成 -S_INFO 新しい仮想 LAN カードをシステムに追加します。\r\n仮想 LAN カードには英数字 %u 文字以内の名前を付けることができます。 -STATIC1 仮想 LAN カードの名前(&N): -IDOK &OK -IDCANCEL キャンセル -S_WIN8 仮想 LAN カード名には 'VPN'、または 'VPN2' から 'VPN127' までの名前を指定してください (合計 127 個作成可能)。 - - -PREFIX D_CM_TRUST -CAPTION 信頼する証明機関の証明書の管理 -STATIC1 VPN Client が信頼する証明機関の証明書一覧を管理します。\r\n\r\nここで登録された証明機関の証明書一覧は、VPN Server への接続時のサーバー証明書の検証などに利用されます。 -B_IMPORT 追加(&A) -B_EXPORT エクスポート(&E) -IDOK 証明書の表示(&V) -IDCANCEL 閉じる(&C) -B_DELETE 削除(&D) - - -PREFIX D_CM_PASSWORD -CAPTION パスワードの設定 - VPN クライアント接続マネージャ -S_TITLE この SoftEther VPN Client サービスの制御を行うためのパスワードを設定することができます。\r\nパスワードを設定すると、次回 VPN クライアント接続マネージャで SoftEther VPN Client サービスに接続する際にパスワードの入力が求められます。 -STATIC1 クライアント管理パスワードの設定: -R_USE_PASSWORD パスワードを設定する(&U) -R_REMOTE_ONLY パスワードはリモートから操作を行う場合のみ要求する(&R) -IDC_STATIC1 パスワード(&P): -IDC_STATIC2 確認入力(&E): -IDOK &OK -IDCANCEL キャンセル - - -PREFIX D_CM_CONFIG -CAPTION オプション設定 -STATIC1 VPN Client の動作に関する設定を変更できます。 -STATIC2 リモート管理の設定(&E) -STATIC3 VPN Client サービスプログラムを別のコンピュータ上から VPN クライアント接続マネージャによってリモート管理することが可能です。 -R_ALLOW_REMOTE_CONFIG VPN Client サービスのリモート管理を許可する(&R) -S_WARNING リモート管理を許可する場合、パスワードを設定しておくことを強くお勧めします。パスワードは [ツール] メニューの [パスワードの設定] をクリックして設定することができます。 -STATIC4 一定期間無通信状態が続くと接続が自動的に切断されるようなネットワーク接続環境の場合、インターネット上の任意のサーバーに対して一定間隔ごとにパケットを送信することにより、インターネット接続を維持することができます。 -R_USE_KEEP_CONNECT インターネット接続の維持機能を使用する(&K) -S_HOSTNAME ホスト名(&H): -S_PORT ポート番号(&P): -S_INTERVAL パケット送出間隔(&I): -S_INTERVAL2 秒間に 1 パケット -S_PROTOCOL プロトコル(&C): -R_TCP TCP/IP プロトコル(&T) -R_UDP UDP/IP プロトコル(&U) -S_INFO インターネット接続維持のために送信されるパケットはランダムな内容であり、コンピュータやユーザーを識別する個人情報などが送信されることはありません。 -IDOK &OK -IDCANCEL キャンセル -STATIC5 その他の設定(&S) -R_ALPHA ウインドウを半透明にする(&A) -STATIC6 ※ 半透明の設定は接続マネージャを再起動するまで適用されません。 -STATIC7 インターネット接続の維持機能(&N) - - -PREFIX D_ABOUT -S_INFO1 SoftEther VPN %u.0 Developer Edition (Ver %u.%02u, Build %u) -S_INFO2 Licensed under the Apache License, Version 2.0.\r\nCopyright (c) 2012-%u all contributors on SoftEther VPN project in GitHub. All Rights Reserved.\r\nWeb Site: http://www.softether.org/\r\n%S -S_INFO3 This product includes the following software components:\r\nBitVisor: Copyright (c) 2007, 2008 University of Tsukuba. Copyright (C) 2007, 2008 National Institute of Information and Communications Technology. All rights reserved. / Microsoft(R) C Runtime Library: (c) 2007 Microsoft Corporation. All Rights Reserved. / PKCS #11 Cryptographic Token Interface (Cryptoki): Copyright (c) RSA Security Inc. / WinPcap: Copyright (c) 2001 - 2003 NetGroup, Politecnico di Torino (Italy). All rights reserved. / libedit: Copyright (c) 1992, 1993 The Regents of the University of California. All rights reserved. / libiconv: Copyright (C) 2007 Free Software Foundation, Inc. / ncurses: Copyright (c) 1998-2005, 2006 Free Software Foundation, Inc. / OpenSSL: Copyright (c) 1998-2011 The OpenSSL Project. All rights reserved. This product includes software developed by the OpenSSL Project for use in the OpenSSL Toolkit (http://www.openssl.org/). This product includes cryptographic software written by Eric Young (eay@cryptsoft.com). / zlib: (C) 1995-2004 Jean-loup Gailly and Mark Adler. / Special Thanks to: Software Laboratory, Academic Computing Communication Center, Industrial Liaison and Cooperative Research Center and Professor Yasushi Shinjo in University of Tsukuba, Japan. -S_INFO4 本ソフトウェアは筑波大学 SoftEther VPN プロジェクトで開発されたフリーウェアです。本ソフトウェアは一切の保証がない状態で提供されるものであり、開発および配布元は使用の結果の損害について一切責任を負いません。\r\n\r\nSoftEther VPN ソフトウェアは日本国経済産業省のソフトウェア研究開発プロジェクトの成果物です。IPA (独立行政法人 情報処理推進機構) の未踏ソフトウェア創造事業に採択され開発されました。詳しくは http://www.ipa.go.jp/ をご覧ください。 -IDCANCEL &OK -B_WEB SoftEther VPN の Web サイト(&W)... -B_EULA 使用許諾契約書(&E) -B_IMPORTANT 重要事項説明書(&I) -B_LEGAL 法律上の通知(&L) -B_UPDATE_CONFIG 更新通知設定(&C) -B_AUTHORS 開発者の一覧(&A) - - -PREFIX D_REMOTE -STATIC1 接続するコンピュータのホスト名または IP アドレスを指定してください(&S): -R_LOCAL ローカルコンピュータ (この画面を表示しているコンピュータ) に接続(&L) -S_HOSTNAME コンピュータ名(&C): -IDOK &OK -IDCANCEL キャンセル - - -PREFIX D_CM_DESKTOP -CAPTION 接続 - %s -S_TITLE 接続設定 "%s" の接続処理を開始します。 -S_WARNING VPN Client は、VPN Server への接続中の進行状況やエラー メッセージなどを、%sの 「コンソールセッション」 の画面上に出力します。 -S_INFO 接続を継続してもよろしいですか? -IDOK 継続(&C) -IDCANCEL キャンセル - - -PREFIX D_CM_CHANGE_PASSWORD -CAPTION パスワードの変更 -S_TITLE サーバー %S 上に登録されているユーザーのパスワードを変更することができます。 -STATIC1 パスワードの変更(&P) -STATIC2 仮想 HUB 名(&H): -STATIC3 ユーザー名(&U): -STATIC4 古いパスワード(&W): -STATIC5 新しいパスワード(&N): -STATIC6 新しいパスワードの\r\n確認入力(&C): -IDOK &OK -IDCANCEL キャンセル -S_STATIC ※ [RADIUS または NT ドメイン認証] を使用して認証するユーザーのパスワードは変更できません。 - - -PREFIX D_SM_MAIN -CAPTION SoftEther VPN Developer Edition サーバー管理マネージャ -STATIC1 SoftEther VPN Server への接続設定(&P): -STATIC2 以下の VPN Server または VPN Bridge への接続設定が登録されています。名前をダブルクリックすると、サーバーに接続できます。\r\n新しい接続を追加するには [新しい接続設定] をクリックしてください。 -B_NEW_SETTING 新しい接続設定(&N) -B_EDIT_SETTING 接続設定の編集(&E) -B_DELETE 接続設定の削除(&D) -IDOK 接続(&C) -B_SECURE_MANAGER スマートカードマネージャ(&S)... -B_SELECT_SECURE スマートカード選択(&M)... -B_ABOUT バージョン情報(&A) -IDCANCEL SoftEther VPN サーバー管理マネージャの終了(&X) -B_CERT_TOOL 証明書作成ツール(&R) - - -PREFIX D_SM_EDIT_SETTING -STATIC1 管理する VPN Server の接続設定を行います。 -STATIC2 接続設定名(&N): -STATIC3 接続先 VPN Server の指定(&B): -STATIC4 管理したい VPN Server が動作しているコンピュータのホスト名または IP アドレスおよひポート番号を指定してください。 -STATIC5 ホスト名(&H): -R_LOCALHOST このコンピュータ (localhost) に接続(&L) -STATIC6 ポート番号(&P): -STATIC7 (TCP ポート) -STATIC8 経由するプロキシサーバーの設定(&X): -STATIC9 プロキシサーバーを経由して VPN Server に接続することができます。 -STATIC10 プロキシの種類(&Y): -R_DIRECT_TCP 直接 TCP/IP 接続 (プロキシを使わない) (&D) -R_HTTPS HTTP プロキシサーバー経由接続(&T) -R_SOCKS SOCKS4 プロキシサーバー経由接続(&K) -R_SOCKS5 SOCKS5 プロキシサーバー経由接続(&K) -B_PROXY_CONFIG プロキシサーバーの接続設定(&R) -STATIC11 管理モードの選択とパスワードの入力(&M) -STATIC12 VPN Server には、サーバー管理モードと仮想 HUB 管理モードのどちらかのモードで接続できます。\r\n\r\nサーバー管理モードで接続すると、VPN Server の設定とすべての仮想 HUB が管理できます。\r\n\r\n仮想 HUB 管理モードで接続すると、権限を持っている仮想 HUB の管理ができます。 -R_SERVER_ADMIN サーバー管理モード(&S) -R_HUB_ADMIN 仮想 HUB 管理モード(&U) -S_HUBNAME 仮想 HUB 名(&V): -STATIC13 管理モードで接続する際のパスワードを入力してください。 -S_PASSWORD 管理パスワード(&A): -R_NO_SAVE 管理パスワードを保存しない(&W) -IDOK &OK -IDCANCEL キャンセル - - -PREFIX D_SM_SERVER -CAPTION %s - SoftEther VPN サーバー管理マネージャ -S_TITLE VPN Server "%S" の管理 -S_VHUB_BRIDGE このサーバーがホストしている仮想 HUB (&U): -IDOK 仮想 HUB の管理(&A) -B_ONLINE オンライン(&O) -B_OFFLINE オフライン(&F) -B_HUB_STATUS 状態の表示(&S) -B_CREATE 仮想 HUB の作成(&C) -B_EDIT プロパティ(&E) -B_DELETE 削除(&D) -STATIC1 リスナーの管理(&J) -STATIC2 リスナー一覧 (TCP/IP ポート) (&I): -B_CREATE_LISTENER 新規作成(&R) -B_DELETE_LISTENER 削除(&T) -B_START 開始(&G) -B_STOP 停止(&P) -S_UDP 複数の UDP ポートを指定するには、スペースかカンマで区切ってください。空欄にすると UDP リスナーを停止します。 -B_APPLY 適用 -STATIC3 サーバー情報の参照および設定(&N) -B_SSL 暗号化と通信関係の設定(&W) -B_STATUS サーバー状態の表示(&V) -B_INFO SoftEther VPN Server\r\nに関する情報(&Q) -B_LICENSE ライセンスの追加と削除(&L) -B_FARM クラスタリング構成(&M) -B_FARM_STATUS クラスタリング状態(&Z) -B_CONNECTION TCP/IP コネクション\r\n一覧の表示(&Y) -B_BRIDGE ローカルブリッジ設定(&B) -B_L3 レイヤ 3 スイッチ設定(&3) -B_CONFIG Config 編集(&K) -B_REFRESH 最新の状態に更新(&H) -IDCANCEL 閉じる(&X) -S_BETA ベータ版 (プレリリース) -B_IPSEC IPsec / L&2TP 設定 -B_DDNS ダイナミック DNS 設定 -S_DDNS 現在の DDNS ホスト名: -B_OPENVPN OpenVPN / MS-SSTP 設定 -B_AZURE VPN Azure 設定 -S_AZURE VPN Azure ホスト名: -B_VPNGATE VPN Gate サービス設定 - - -PREFIX D_SM_STATUS -IDOK 最新の状態に更新(&H) -IDCANCEL 閉じる(&X) - - -PREFIX D_SM_EDIT_HUB -STATIC1 仮想 HUB 名(&N): -STATIC2 セキュリティ設定(&S): -S_BOLD この仮想 HUB の管理用パスワード -STATIC3 パスワード(&P): -STATIC4 確認入力(&C): -R_NO_ENUM 匿名ユーザーに対してこの仮想 HUB を列挙しない(&U) -STATIC5 仮想 HUB オプション(&I): -R_LIMIT_MAX_SESSION 最大同時接続セッション数を制限する(&L) -S_MAX_SESSION_1 最大同時接続セッション数(&Z): -S_MAX_SESSION_2 セッション -STATIC6 (ローカルブリッジ、仮想 NAT、カスケード接続などによって生成されるサーバー側の仮想セッション数は含まない) -STATIC7 仮想 HUB の状態(&J): -STATIC8 仮想 HUB の状態を選択してください。 -R_ONLINE オンライン(&E) -R_OFFLINE オフライン(&F) -STATIC9 クラスタリング設定(&M): -S_FARM_INFO クラスタ内での仮想 HUB の種類を選択してください。 -R_STATIC スタティック仮想 HUB(&A) -R_DYNAMIC ダイナミック仮想 HUB(&D) -S_AO_1 仮想 HUB 管理オプション(&Y): -S_AO_3 仮想 HUB の管理オプションを表示および編集できます。 -B_ADMINOPTION 仮想 HUB 管理オプション(&K) -S_ACL_3 接続元 IP 制限リスト(&R): -S_ACL クライアントコンピュータの IP アドレスによって、この仮想 HUB への VPN 接続を許可または拒否することができます。 -B_ACL 接続元 IP 制限リスト(&T) -IDOK &OK -IDCANCEL キャンセル -STATIC10 仮想 HUB 拡張オプションを使用すると、この仮想 HUB に関するより詳細な設定を行うことができるようになります。 -B_EXTOPTION 仮想 HUB 拡張オプションの編集(&X) -S_MSG_1 接続時にメッセージを表示 -S_MSG_2 この仮想 HUB に VPN Client が接続した際に、ユーザーの画面にメッセージを表示できます。 -B_MSG メッセージの設定(&G) - - -PREFIX D_SM_CREATE_LISTENER -CAPTION リスナーの新規作成 -STATIC1 VPN Server がクライアントからの接続を待ち受ける TCP/IP ポート番号を追加することができます。\r\n\r\n新しく追加するポート番号を指定してください。 -STATIC2 ポート番号がすでに別のサーバー プログラムによって使用されている場合など、ポートの確保に失敗した場合は、リスナーの状態がエラー状態となります。\r\n\r\nその場合は、同じポート番号を開いている別のプログラムを停止してください。 -STATIC3 ポート番号(&P): -IDOK &OK -IDCANCEL キャンセル -STATIC4 (TCP/IP ポート) - - -PREFIX D_SM_SSL -CAPTION 暗号化と通信関係の設定 -STATIC1 この VPN Server の暗号化、通信、およびセキュリティに関する設定を参照または変更することができます。 -STATIC2 使用する暗号化アルゴリズム(&A): -STATIC3 この VPN Server に接続した VPN Client との間で使用される SSL に対応した暗号化アルゴリズム名を指定してください。暗号化アルゴリズムは SSL バージョン 3 に対応したものでなければなりません。 -STATIC4 暗号化アルゴリズム名(&C): -STATIC6 サーバー証明書(&E): -STATIC7 この VPN Server がクライアントに対して提示する X509 証明書と秘密鍵を指定してください。 -B_IMPORT インポート(&I) -B_EXPORT エクスポート(&X) -B_VIEW 証明書の表示(&V) -B_REGENERATE 新規作成(&N) -STATIC8 インターネット接続の維持機能: -STATIC9 一定期間無通信状態が続くと接続が自動的に切断されるようなネットワーク接続環境の場合、インターネット上の任意のサーバーに対して一定間隔ごとにパケットを送信することにより、インターネット接続を維持することができます。 -STATIC10 サーバー証明書: -R_USE_KEEP_CONNECT インターネット接続の維持機能を使用する(&K) -S_HOSTNAME ホスト名(&H): -S_PORT ポート番号(&F): -S_INTERVAL パケット送出間隔(&D): -S_INTERVAL2 秒 -S_PROTOCOL プロトコル(&L): -R_TCP TCP/IP プロトコル(&T) -R_UDP UDP/IP プロトコル(&U) -S_INFO インターネット接続維持のために送信されるパケットはランダムな内容であり、コンピュータやユーザーを識別する個人情報などが送信されることはありません。 -STATIC11 管理者パスワード(&W): -S_INFO4 この VPN Server 全体とすべての仮想 HUB に対する管理権限を有する管理者パスワードを設定または変更することができます。 -B_PASSWORD 管理者パスワードの変更(&P) -IDOK &OK -IDCANCEL キャンセル -IDCANCEL2 キャンセル -STATIC12 syslog 送信機能 -STATIC13 VPN サーバー / VPN ブリッジ全体のログ、仮想 HUB の管理ログおよび仮想 HUB のパケットログを、ディスク上のファイルに書き出す代わりに syslog プロトコルで転送することができます。 -STATIC14 syslog サーバーホスト名(&S): -STATIC15 ポート番号(&R): -S_OVER_FUNCS VPN over ICMP / DNS サーバー機能 -S_INFO5 ファイアウォールやルータで TCP/IP の通信が遮断されている場合でも、ICMP または DNS パケットのみを用いて VPN を確立できます。 -B_SPECIALLISTENER VPN over ICMP / DNS 設定 -B_UPDATE_CONFIG 更新通知設定(&U)... - - -PREFIX D_SM_SAVE_KEY_PAIR -CAPTION 証明書と秘密鍵の保存 -STATIC1 証明書と秘密鍵を保存する方法を選択してください。 -STATIC2 保存方法(&V): -R_X509_AND_KEY X509 証明書ファイル (.CER) と秘密鍵ファイル (.KEY) の組合せとして保存する(&X) -R_PKCS12 PKCS#12 ファイル (.P12) として保存する(&P) -R_SECURE スマートカードに書き込む(&W) -STATIC3 標準的な Base 64 にエンコードされた証明書ファイルと秘密鍵ファイルの 2 つのファイルに分けて保存します。 -STATIC4 PKCS#12 (Public Key Cryptography Standard #12) ファイルとして保存します。\r\n1 つの PKCS#12 ファイルには、証明書と秘密鍵の両方を格納することが出来ます。 -STATIC5 このコンピュータにスマートカードが接続されている場合は、スマートカード内に証明書と秘密鍵を同時に書き込むことができます。 -B_SELECT 使用するスマートカードの選択(&S)... -S_PASS3 秘密鍵の保護(&R) -S_PASS4 秘密鍵を保存する際にパスフレーズを設定することができます。パスフレーズを設定した秘密鍵は、読み取る際にパスフレーズを入力する必要があります。 -R_USE_PASS パスフレーズを設定する(&A) -S_PASS1 パスフレーズ(&H): -S_PASS2 確認入力(&E): -IDOK &OK -IDCANCEL キャンセル -B_SECURE_MANAGER スマートカードマネージャ(&M)... - - -PREFIX D_SM_CONNECTION -CAPTION コネクション一覧 -S_TITLE 現在、サーバー %S に接続中のコネクションは以下のとおりです。ただし、VPN セッションが確立済みのコネクションは表示されません。 -IDOK コネクションの情報を表示(&I) -B_DISCONNECT 切断(&D) -B_REFRESH 最新の状態に更新(&H) -IDCANCEL 閉じる(&X) - - -PREFIX D_SM_FARM -CAPTION クラスタリング構成 -S_TITLE VPN Server "%S" のクラスタリング構成を変更できます。 -STATIC1 複数台の VPN Server でクラスタを構成すると、ロードバランシング (負荷分散) およびフォールトトレランスの確保を実現することができます。 -STATIC2 現在の動作モード: -STATIC3 クラスタリング構成の設定(&T): -R_STANDALONE スタンドアロンサーバー (クラスタリング構成無し) (&S) -R_CONTROLLER クラスタコントローラ(&C) -R_MEMBER クラスタメンバサーバー(&M) -STATIC4 クラスタメンバサーバー時の設定項目(&E): -S_IP_1 公開 IP アドレス(&I): -S_IP_2 (公開 IP アドレスを入力しない場合は、クラスタコントローラへの接続の際に使用されるネットワークインターフェイスの IP アドレスが自動的に使用されます。) -S_PORT_1 公開ポート一覧(&P): -S_PORT_2 (複数入力する場合はスペースまたはカンマで区切ってください。) -S_CONTROLLER コントローラのホスト名または IP アドレス(&H): -S_CONTROLLER_PORT コントローラの\r\nポート番号(&R): -S_PORT_3 (TCP ポート) -S_PASSWORD 管理パスワード(&D): -STATIC5 クラスタリング構成を変更すると、VPN Server サービスが自動的に再起動します。その際、現在接続されているすべてのセッションおよび管理用コネクションが切断されます。 -IDOK &OK -IDCANCEL キャンセル -S_1 クラスタ内での性能基準比(&W): -S_2 (標準: 100) -R_CONTROLLER_ONLY コントローラ機能のみ (自身は VPN 通信を処理しない) - - -PREFIX D_SM_FARM_MEMBER -CAPTION クラスタメンバ一覧 -S_TITLE 現在、クラスタコントローラ %S には以下のクラスタメンバサーバーが接続しています。 -IDOK クラスタメンバサーバーの情報を表示(&I) -B_REFRESH 最新の状態に更新(&H) -IDCANCEL 閉じる(&X) -B_CERT サーバー証明書の表示(&C) - - -PREFIX D_SM_CHANGE_PASSWORD -CAPTION %S の管理者パスワードの設定 -S_TITLE サーバー %S の管理者パスワードを設定します。新しいパスワードを入力してから [OK] をクリックしてください。 -STATIC1 新しいパスワード(&P): -STATIC2 確認入力(&C): -IDOK &OK -IDCANCEL キャンセル - - -PREFIX D_SM_HUB -CAPTION 仮想 HUB の管理 - %S -S_TITLE %S の管理 -STATIC1 セキュリティデータベースの管理(&D): -B_USER ユーザーの管理(&U) -S_USER ユーザー アカウントを追加・削除・編集できます。 -B_GROUP グループの管理(&G) -S_GROUP グループを追加・削除・編集できます。 -B_ACCESS アクセスリストの管理(&A) -S_ACCESS アクセスリスト (パケットフィルタリングルール) を追加・削除できます。 -STATIC2 仮想 HUB 設定(&N) -B_PROPERTY 仮想 HUB のプロパティ(&P) -S_PROPERTY この仮想 HUB の設定を変更できます。 -B_RADIUS 認証サーバーの設定(&E) -S_RADIUS ユーザー認証に使用する RADIUS 認証サーバーの設定を行うことができます。 -B_LINK カスケード接続の管理(&C) -S_LINK 同一または別のサーバー上の複数の仮想 HUB 同士をカスケード接続することができます。 -STATIC3 この仮想 HUB の現在の状況(&R): -B_REFRESH 最新の状態に更新(&H) -STATIC4 その他の管理(&O) -B_LOG ログ保存設定(&L) -B_LOG_FILE ログファイル一覧(&Q) -S_LOG ログの保存に関する設定を行うことができます。 -B_CA 信頼する証明機関の証明書(&T) -B_CRL 無効な証明書(&K) -S_CA この仮想 HUB が信頼する証明機関の証明書を管理します。 -B_SNAT 仮想 NAT および仮想 DHCP サーバー機能(&V) -S_SNAT この仮想 HUB 内で SecureNAT 機能を動作させます。仮想 NAT と仮想 DHCP を稼動できます。 -STATIC5 セッションの管理(&I): -B_SESSION セッションの管理(&S) -IDCANCEL 閉じる(&X) - - -PREFIX D_SM_USER -CAPTION ユーザーの管理 -S_TITLE 仮想 HUB "%S" に登録されているユーザーは以下の通りです。 -IDOK 編集(&E) -B_CREATE 新規作成(&C) -B_DELETE 削除(&D) -B_REFRESH 最新の状態に更新(&R) -IDCANCEL 閉じる(&X) -B_STATUS ユーザー情報表示(&V) - - -PREFIX D_SM_EDIT_USER -IDC_STATIC1 ユーザー名(&U): -IDC_STATIC3 本名(&R): -IDC_STATIC4 説明(&N): -IDC_STATIC5 グループ名\r\n(省略可能): -B_GROUP グループの参照(&J)... -R_EXPIRES このアカウントの有効期限を設定する(&S) -IDC_STATIC6 認証方法(&A): -S_RADIUS_3 RADIUS または NT ドメイン認証 -S_RADIUS_1 外部の RADIUS サーバー、Windows NT ドメインコントローラ、または Active Directory コントローラによってユーザーが入力したパスワードが検証されます。 -R_SET_RADIUS_USERNAME 認証サーバー上のユーザー名を指定する(&K) -S_RADIUS_2 認証サーバーにおけるユーザー名(&T): -S_POLICY_1 セキュリティポリシー -R_POLICY このユーザーのセキュリティポリシーを設定する(&Y) -B_POLICY セキュリティポリシー(&M) -S_PASSWORD_1 パスワード認証 -S_PASSWORD_2 パスワード(&P): -S_PASSWORD_3 パスワードの確認入力(&C): -S_USER_CERT_1 固有証明書認証 -B_LOAD_CERT 証明書の指定(&E) -B_VIEW_CERT 証明書の表示(&V) -B_CREATE 証明書作成ツール(&W) -S_ROOT_CERT_1 署名済み証明書認証 -S_ROOT_CERT_2 クライアント証明書がこの仮想 HUB の信頼する証明機関の証明書によって署名されているかどうかを検証します。 -R_CN 証明書の Common Name (CN) の値を限定する(&B) -R_SERIAL 証明書のシリアル番号の値を限定する(&L) -S_ROOT_CERT_3 ※ 16 進数で入力してください。(例: 0155ABCDEF) -S_HINT ヒント: ユーザー名が '*' (アスタリスク) のユーザーを作成すると、他に明示的に一致するユーザー名の定義がないユーザーが接続しようとした場合に外部認証サーバーを使用したパスワード認証による接続を許可できます。 -IDOK &OK -IDCANCEL キャンセル - - -PREFIX D_SM_POLICY -STATIC1 選択されているポリシー(&P): -S_BOLD このポリシーの説明(&C): -S_BOLD2 設定値(&V): -R_ENABLE このポリシーを有効にする(&E) -R_DISABLE このポリシーを無効にする(&D) -R_DEFINE このポリシーの値を定義する(&F) -IDOK &OK -IDCANCEL キャンセル - - -PREFIX D_SM_GROUP -CAPTION グループの管理 -S_TITLE 仮想 HUB "%S" に登録されているグループは以下の通りです。 -B_CREATE 新規作成(&C) -IDOK 編集(&E) -B_DELETE 削除(&D) -B_REFRESH 最新の状態に更新(&R) -B_USER メンバ一覧(&M) -IDCANCEL 閉じる(&X) - - -PREFIX D_SM_EDIT_GROUP -IDC_STATIC1 グループ名(&G): -IDC_STATIC3 本名(&R): -IDC_STATIC4 説明(&N): -S_POLICY_1 セキュリティポリシー -R_POLICY このグループのユーザーのセキュリティポリシーを設定する(&Y) -B_POLICY セキュリティポリシー(&M) -S_POLICY_2 このグループの統計情報 -IDOK &OK -IDCANCEL キャンセル - - -PREFIX D_SM_ACCESS_LIST -CAPTION アクセスリスト -S_TITLE 仮想 HUB "%S" には、現在以下のアクセスリスト (パケットフィルタリングルール) が登録されています。 -B_ADD 追加 (IPv&4) -B_ADD_V6 追加 (IPv&6) -IDOK 編集(&E) -B_DELETE 削除(&D) -B_SAVE 保存(&S) -IDCANCEL キャンセル(&C) -STATIC1 優先順位はリストの上のものほど高くなります。 -STATIC2 VPN Server では、どのアクセスリスト項目にも一致しなかった IP パケットは、無条件で仮想 HUB を通過できます。 -B_CLONE クローン(&O) -B_ENABLE 有効にする(&N) -B_DISABLE 無効にする(&I) - - -PREFIX D_SM_EDIT_ACCESS -CAPTION アクセスリスト項目の編集 -STATIC1 アクセスリスト項目を設定してください。ここで設定したアクセスリストは、仮想 HUB 内を通過するすべての IP パケットに対して適用されます。 -STATIC2 基本設定 -STATIC3 アクセスリストの説明(&N): -STATIC4 動作(&A): -R_PASS 通過(&P) -R_DISCARD 破棄(&D) -STATIC5 優先順位(&R): -STATIC6 (整数値: 小さいほど\r\n優先順位が高くなります) -STATIC7 IP ヘッダに関するフィルタリングオプション -S_ACCESS_SRC_ALL 送信元 IP アドレス: -R_SRC_ALL すべての送信元に対して適用する -S_SRC_IP_1 IPv4 アドレス: -S_SRC_IP_2 マスク: -S_SRC_IP_3 (255.255.255.255: 単一ホスト) -S_SRC_IP_1_V6 IPv6 アドレス: -S_SRC_IP_3_V6 (マスク表記例: "ffff:ff00::" または "/24"。単一ホストの場合は "/128") -S_ACCESS_DST_ALL 宛先 IP アドレス: -R_DST_ALL すべての宛先に対して適用する -S_IP_DST_1 IPv4 アドレス: -S_IP_DST_2 マスク: -S_IP_DST_3 (255.255.255.255: 単一ホスト) -S_IP_DST_1_V6 IPv6 アドレス: -S_IP_DST_3_V6 (マスク表記例: "ffff:ff00::" または "/24"。単一ホストの場合は "/128") -STATIC9 プロトコルの種類: -STATIC10 TCP ヘッダまたは UDP ヘッダに関するフィルタリングオプション -S_TCP_1 最小値 -S_TCP_2 最大値 -S_TCP_3 送信元ポート番号: -S_TCP_5 宛先ポート番号: -S_TCP_7 ポート番号が空欄の場合はすべてのポートに対して適用されます。\r\n最小値が指定されていて最大値が指定されていない場合は最小値と一致するパケットのみ適用されます。 -STATIC11 ユーザーまたはグループに関するフィルタリングオプション -STATIC11_OLD ユーザーに関するフィルタリングオプション -STATIC12 このアクセスリスト項目を特定のユーザーまたはグループが送信したパケット、または特定のユーザーまたはグループによって受信されるパケットに対してのみ適用することができます。 -STATIC12_OLD このアクセスリスト項目を特定のユーザーが送信したパケット、または特定のユーザーによって受信されるパケットに対してのみ適用することができます。 -STATIC13 送信元の名前: -B_USER1 参照... -STATIC14 宛先の名前: -B_USER2 参照... -STATIC15 それぞれユーザー名またはグループ名のどちらかを指定してください。指定しない場合は空欄にしてください。 -STATIC15_OLD それぞれユーザー名を指定してください。指定しない場合は空欄にしてください。 -IDOK &OK -IDCANCEL キャンセル -S_PROTOID IP プロトコル番号の指定: -STATIC16 MAC ヘッダに関するフィルタリングオプション -S_CHECK_SRC_MAC 送信元 MAC アドレス: -R_CHECK_SRC_MAC すべての送信元に対して適用する -S_SRC_MAC MAC アドレス: -S_SRC_MAC_MASK マスク: -S_CHECK_DST_MAC 宛先 MAC アドレス: -R_CHECK_DST_MAC すべての宛先に対して適用する -B_SIMULATION 遅延・パケットロス生成機能(&L)... -S_DST_MAC MAC アドレス: -S_DST_MAC_MASK マスク: -S_MAC_NOTE MAC アドレスとマスクに 16 進数と "-" または ":" の文字が使えますが、省略することも可能です。(FF-FF-FF-FF-FF-FF: 単一ホスト) -R_CHECK_TCP_STATE TCP コネクションの状態を検査 (TCP パケットのみ) -R_ESTABLISHED 確立済みパケット -R_UNESTABLISHED 未確立パケット -R_REDIRECT HTTP アクセスを強制的に指定 URL へリダイレクト -B_REDIRECT リダイレクト先 URL... - - -PREFIX D_SM_RADIUS -CAPTION 認証サーバーの設定 -S_TITLE 仮想 HUB "%S" にユーザーが RADIUS サーバー認証モードで接続した場合に、ユーザー名とパスワードを確認する外部の RADIUS サーバーを指定することができます。 -STATIC1 RADIUS サーバーの設定(&F): -R_USE_RADIUS RADIUS 認証を使用する(&U) -S_RADIUS_1 RADIUS サーバーのホスト名または IP アドレス(&S): -S_RADIUS_2 ポート番号(&P): -S_RADIUS3 (UDP ポート) -S_RADIUS_4 共有シークレット(&E): -S_RADIUS_5 共有シークレットの確認入力(&C): -S_RADIUS_6 RADIUS サーバーは、この VPN Server の IP アドレスからの要求を受け付けるように設定しておく必要があります。また、Password Authentication Protocol (PAP) による認証が有効になっている必要があります。 -S_RADIUS_7 ミリ秒 (%u 以上 %u 未満) -S_RADIUS_8 再試行間隔(&R): -S_RADIUS_9 (, または ; で複数指定することができます。) -STATIC2 外部認証サーバーとして Windows NT ドメインコントローラまたは Windows Server の Active Directory コントローラを使用する場合は、VPN Server を動作させているコンピュータをそのドメインに所属させておく必要があります。NT ドメイン認証を使用する場合は、設定する項目はありません。 -IDOK &OK -IDCANCEL キャンセル - - -PREFIX D_SM_LINK -CAPTION %S 上のカスケード接続 -STATIC1 カスケード接続を使用すると、この仮想 HUB を同一または別のコンピュータ上で動作している他の仮想 HUB にレイヤ 2 カスケード接続することができます。 -STATIC2 カスケード接続における警告 -STATIC3 カスケード接続を使用すると、複数の仮想 HUB 間でのレイヤ 2 ブリッジが可能ですが、接続方法を間違えると、ループ状のカスケード接続を作成してしまう場合があります。カスケード接続機能を使用する際には、慎重にネットワークトポロジを設計してください。 -B_CREATE 新規作成(&C) -B_EDIT 編集(&E) -B_ONLINE オンライン(&N) -B_OFFLINE オフライン(&F) -IDOK 状態(&S) -B_DELETE 削除(&D) -B_RENAME 名前の変更(&A) -B_REFRESH 最新の状態に更新(&R) -IDCANCEL 閉じる(&X) - - -PREFIX D_SM_LOG -CAPTION ログ保存設定 -S_TITLE 仮想 HUB "%S" に関するセキュリティログ (ユーザーのログインなどの記録) および仮想 HUB を通過するすべてのパケットに関するパケットログを保存することができます。 -STATIC1 セキュリティログ(&S): -B_SEC セキュリティログを保存する(&E) -S_SEC ログファイルの切り替え周期(&W): -STATIC2 パケットログ(&P): -B_PACKET パケットログを保存する(&F) -S_PACKET ログファイルの切り替え周期(&X): -S_PACKET_0 TCP コネクションログ: -B_PACKET_0_0 保存無し -B_PACKET_0_1 ヘッダ情報のみ -B_PACKET_0_2 パケット内容すべて -S_PACKET_1 TCP パケットログ: -B_PACKET_1_0 保存無し -B_PACKET_1_1 ヘッダ情報のみ -B_PACKET_1_2 パケット内容すべて -S_PACKET_2 DHCP パケットログ: -B_PACKET_2_0 保存無し -B_PACKET_2_1 ヘッダ情報のみ -B_PACKET_2_2 パケット内容すべて -S_PACKET_3 UDP パケットログ: -B_PACKET_3_0 保存無し -B_PACKET_3_1 ヘッダ情報のみ -B_PACKET_3_2 パケット内容すべて -S_PACKET_4 ICMP パケットログ: -B_PACKET_4_0 保存無し -B_PACKET_4_1 ヘッダ情報のみ -B_PACKET_4_2 パケット内容すべて -S_PACKET_5 IP パケットログ: -B_PACKET_5_0 保存無し -B_PACKET_5_1 ヘッダ情報のみ -B_PACKET_5_2 パケット内容すべて -S_PACKET_6 ARP パケットログ: -B_PACKET_6_0 保存無し -B_PACKET_6_1 ヘッダ情報のみ -B_PACKET_6_2 パケット内容すべて -S_PACKET_7 Ethernet\r\nパケットログ: -B_PACKET_7_0 保存無し -B_PACKET_7_1 ヘッダ情報のみ -B_PACKET_7_2 パケット内容すべて -IDOK &OK -IDCANCEL キャンセル -STATIC3 大量のパケットログを保存しようとすると、CPU およびハードディスクに大きな負担がかかり、仮想 HUB や VPN Server 全体のパフォーマンス低下の原因になる場合があります。必要なパケットログ情報のみ保存するように設定してください。 - - -PREFIX D_SM_CA -CAPTION 信頼する証明機関の証明書の管理 -STATIC1 この仮想 HUB が信頼する証明機関の証明書一覧を管理します。\r\n\r\nここで登録された証明機関の証明書一覧は、VPN Client が署名済み証明書認証モードで接続してきた際の証明書の検証に使用されます。 -B_IMPORT 追加(&A) -IDOK 証明書の表示(&V) -IDCANCEL 閉じる(&C) -B_DELETE 削除(&D) - - -PREFIX D_SM_SESSION -CAPTION セッションの管理 - %S -S_TITLE 現在、仮想 HUB "%S" に以下のセッションが接続しています。 -STATIC1 セッションに関する操作 -IDOK セッションの情報を表示(&I) -B_DISCONNECT 切断(&D) -B_REFRESH 最新の状態に更新(&H) -B_SESSION_MAC_TABLE このセッションの MAC テーブル(&M) -B_SESSION_IP_TABLE このセッションの IP テーブル(&P) -STATIC2 その他の管理タスク -B_MAC_TABLE MAC アドレステーブル一覧(&A) -B_IP_TABLE IP アドレステーブル一覧(&B) -IDCANCEL 閉じる(&X) -S_FARM_INFO_2 現在のクラスタ上のすべてのセッションを表示していますが、別のクラスタメンバサーバー上のセッションを管理するにはそのサーバーに管理接続する必要があります。 - - -PREFIX D_SM_MAC -CAPTION MAC アドレステーブル -S_TITLE 仮想 HUB "%S" 上の MAC アドレステーブルデータベースは以下の通りです。 -B_DELETE 選択したエントリを削除(&D) -B_REFRESH 最新の状態に更新(&H) -IDCANCEL 閉じる(&X) - - -PREFIX D_SM_IP -CAPTION IP アドレステーブル -S_TITLE 仮想 HUB "%S" 上の IP アドレステーブルデータベースは以下の通りです。 -B_DELETE 選択したエントリを削除(&D) -B_REFRESH 最新の状態に更新(&H) -IDCANCEL 閉じる(&X) - - -PREFIX D_SM_CREATE_CERT -CAPTION 新しい証明書の作成 -STATIC1 このツールを使用すると、ルート証明書、または既存の証明書によって署名された証明書を簡単に作成することができます。 -STATIC2 証明書の種類(&T): -R_ROOT_CERT ルート証明書 (自己署名証明書)(&R) -R_SIGNED_CERT 他の証明書によって署名された証明書(&S) -S_LOAD_1 署名するために使用する証明書と秘密鍵(&C): -B_LOAD 証明書と秘密鍵の読み込み(&L) -S_LOAD_2 [証明書と秘密鍵の読み込み] をクリックして、新しい証明書の署名に使う X509 証明書と RSA 秘密鍵を指定してください。 -S_LOAD_3 名前 (CN): -S_LOAD_4 所属機関 (O): -S_LOAD_5 組織単位 (OU): -S_LOAD_6 国 (C): -S_LOAD_7 都道府県 (ST): -S_LOAD_8 ローカル (L): -S_LOAD_11 シリアル番号(S):\r\n(16進数) -S_LOAD_9 証明書の有効期間(&E): -S_LOAD_10 日 -STATIC3 大規模に証明書および証明機関を運用する場合は、OpenSSL などのフリーソフトや、市販の CA (証明機関) ソフトウェアを使用することを推奨します。 -IDOK &OK -IDCANCEL キャンセル -S_LOAD_12 暗号強度(&N): - - -PREFIX D_NM_LOGIN -CAPTION deleted -S_TITLE deleted -STATIC1 deleted -STATIC2 deleted -IDOK deleted -IDCANCEL deleted - - -PREFIX D_SPEEDMETER -CAPTION ネットワークデバイスの状態 -STATIC1 ネットワークアダプタの選択: -STATIC2 最新の状況(&L) -STATIC3 更新(&R) - - -PREFIX D_NM_MAIN -CAPTION deleted -STATIC1 deleted -STATIC2 deleted -B_SETTING VPN Server への接続の設定(&S) -B_CONNECT 接続(&C) -B_DISCONNECT 切断(&D) -STATIC3 User-mode Router の動作に関する設定 -STATIC4 SoftEther VPN User-mode Router の仮想ネットワーク内の動作を設定することができます。 -B_OPTION User-mode Router の動作設定(&O) -STATIC5 User-mode Router の動作状況 -STATIC6 SoftEther VPN User-mode Router の現在の動作状況を表示します。 -B_NAT 仮想 NAT の状況(&N) -B_DHCP 仮想 DHCP サーバーの状況(&H) -B_STATUS User-mode Router の状況(&R) -B_INFO User-mode Router の情報(&I) -B_PASSWORD 管理パスワードの設定(&P) -B_REFRESH 最新状態に更新(&E) -B_ABOUT バージョン情報(&A) -IDCANCEL 閉じる(&X) - - -PREFIX D_NM_OPTION -CAPTION SecureNAT の設定 -S_TITLE SecureNAT 仮想ホストが仮想 HUB "%S" の仮想ネットワーク内でどのような動作を行うかを設定してください。 -STATIC1 仮想ホストのネットワークインターフェイスの設定: -STATIC2 MAC アドレス(&M): -STATIC3 IP アドレス(&P): -STATIC4 サブネットマスク(&S): -STATIC5 仮想 NAT の設定: -R_USE_NAT 仮想 NAT 機能を使用する(&A) -STATIC6 M&TU 値: -STATIC7 バイト -STATIC8 TCP セッションのタイムアウト(&C): -STATIC9 秒 -STATIC10 UDP セッションのタイムアウト(&U): -STATIC11 秒 -R_SAVE_LOG NAT および DHCP サーバーの動作をログファイルに保存する(&L) -STATIC12 仮想 DHCP サーバーの設定: -R_USE_DHCP 仮想 DHCP サーバー機能を使用する(&N) -STATIC13 配布 IP アドレス帯(&D): -STATIC14 から -STATIC15 まで -STATIC16 サブネットマスク(&B): -STATIC17 リース期限(&E): -STATIC18 秒 -STATIC19 クライアントに割り当てるオプションの設定 (空欄でも可): -STATIC20 デフォルトゲートウェイの\r\nアドレス(&F): -STATIC21 DNS サーバーのアドレス 1 (&V): -STATIC22 ドメイン名(&W): -STATIC23 DNS サーバーのアドレス 2 (&X): -IDOK &OK -IDCANCEL キャンセル -S_1 静的ルーティングテーブルのプッシュ (スプリットトンネリング) -S_2 VPN クライアントに対して静的ルーティングテーブルをプッシュ送信することができます。 -B_PUSH プッシュする静的ルーティングテーブルの編集 - - -PREFIX D_NM_NAT -CAPTION 仮想 NAT ルータ上の NAT セッションテーブル -S_TITLE 現在、SecureNAT の仮想 NAT ルータ上に以下の TCP または UDP の NAT テーブルエントリがあります。 -B_REFRESH 最新の状態に更新(&H) -IDCANCEL 閉じる(&X) - - -PREFIX D_NM_DHCP -CAPTION 仮想 DHCP サーバー上の IP リーステーブル -S_TITLE 現在、SecureNAT の仮想 DHCP サーバーは以下の IP アドレスをクライアントに配布しています。 -B_REFRESH 最新の状態に更新(&H) -IDCANCEL 閉じる(&X) - - -PREFIX D_NM_CHANGE_PASSWORD -CAPTION %S の管理者パスワードの変更 -S_TITLE SoftEther VPN User-mode Router (%S) の管理者パスワードを変更できます。新しいパスワードを入力してから [OK] をクリックしてください。 -STATIC1 新しいパスワード(&P): -STATIC2 確認入力(&C): -IDOK &OK -IDCANCEL キャンセル - - -PREFIX D_SM_SNAT -CAPTION 仮想 NAT および仮想 DHCP 機能 (SecureNAT) の設定 -S_TITLE SecureNAT 機能を有効にすると、仮想 HUB "%S" 内の仮想ネットワーク内において NAT ルータ (IP マスカレード) や DHCP サーバー機能を仮想的に動作させることができるようになります。 -STATIC1 SecureNAT 機能に関する警告 -S_WARNING SecureNAT 機能はシステム管理者やネットワークに関して詳しい知識のある方向けの機能です。 -S_WARNING2 SecureNAT 機能を正しく使用すると、VPN を経由した安全なリモートアクセスが実現できます。しかし、誤った方法で使用すると、ネットワーク全体を危険な状態にする可能性もあります。ネットワークに関する十分な知識をお持ちでない場合や、ネットワーク管理者の許可を得ていない場合は、SecureNAT 機能を有効にしないでください。SecureNAT 機能に関する詳しい説明は、VPN Server のマニュアルやオンラインドキュメントを参照してください。 -STATIC2 SecureNAT 機能の有効 / 無効および設定の変更 -STATIC3 この仮想 HUB 内で SecureNAT 機能を有効または無効にしたり、設定を変更できます。 -B_ENABLE SecureNAT 機能を有効にする(&E) -B_DISABLE SecureNAT 機能を無効にする(&D) -B_CONFIG SecureNAT の設定(&C) -STATIC4 ※ 動作中の SecureNAT を無効にした場合、現在 SecureNAT を経由して接続中の TCP または UDP セッションはすべて切断されます。 -STATIC5 現在の SecureNAT の状況の表示 -STATIC6 現在の SecureNAT の動作状況を表示することができます。 -B_NAT 仮想 NAT ルータの状況(&N) -B_DHCP 仮想 DHCP サーバーの状況(&H) -B_STATUS SecureNAT の動作状況の表示(&S) -S_TSUKUBA2 SecureNAT は、登 大遊 が筑波大学第三学群情報学類の平成16年度授業 "情報特別演習Ⅰ" で開発した技術を使用しています。 -IDCANCEL 閉じる(&X) - - -PREFIX D_SM_BRIDGE -CAPTION ローカルブリッジ設定 -STATIC1 ローカルブリッジを使用すると、この VPN Server 上で動作する仮想 HUB と物理的な Ethernet デバイス (LAN カード) との間でレイヤ 2 ブリッジ接続を構成することができます。\r\nまた、システムに tap デバイス (仮想のネットワークインターフェイス) を作成し、仮想 HUB との間でブリッジ接続することもできます。(Linux 版のみサポート) -B_DELETE ローカルブリッジの削除(&D) -STATIC2 新しいローカルブリッジの定義(&N): -STATIC3 ブリッジする仮想 HUB を選択するか、名前を入力してください。 -STATIC4 仮想 HUB(&H): -STATIC5 作成する種類(&Y): -R_BRIDGE 物理的な既存の LAN カードとのブリッジ接続(&P) -R_TAP 新しい tap デバイスとのブリッジ接続(&T) -S_ETH_1 LAN カード(&L): -S_TAP_1 新しい tap デバイス名(&V): -S_TAP_2 (11 文字以内) -STATIC6 ※ 稼働中の任意の LAN カードとの間でブリッジできますが、高負荷環境においてはブリッジ専用に LAN カードを用意することをお勧めします。 -IDOK ローカルブリッジを追加(&A) -STATIC7 最近システムに追加された LAN カードが表示されない場合は、コンピュータを再起動して再度この画面を開ければ表示されます。 -IDCANCEL 閉じる(&X) -B_VLAN タグ VLAN パケット透過設定ツール(&G) - - -PREFIX D_WIN9X_REBOOT -CAPTION VPN Client - 仮想 LAN カードのインストール -STATIC1 VPN Client の仮想 LAN カードのインストールを行いました。\r\n直ちに Windows を終了し、コンピュータを再起動する必要があります。\r\n\r\nコンピュータは自動的に再起動されます。自動的に再起動しない場合は、手動で再起動を行ってください。 - - -PREFIX D_EM_MAIN -CAPTION SoftEther EtherLogger Manager -STATIC1 SoftEther EtherLogger は、コンピュータに接続されている LAN カードを流れるデータをキャプチャし、管理者が指定した種類のパケットのヘッダまたはすべてのデータをテキストファイルにログとして記録するサービスです。\r\n\r\n現在、以下のキャプチャデバイスでパケットロギングを実行しています。 -B_PASSWORD 管理パスワード(&P) -B_LICENSE ライセンス(&L) -B_ADD 追加(&A) -IDOK 編集(&E) -B_DELETE 削除(&D) -IDCANCEL 閉じる(&X) - - -PREFIX D_EM_ADD -STATIC1 キャプチャに使用する LAN カード名(&L): -R_PROMISCUOUS キャプチャの際にプロミスキャスモードを使用しない(&N) -STATIC2 パケットログ(&P): -S_PACKET ログファイルの切り替え周期(&W): -S_PACKET_0 TCP コネクションログ: -B_PACKET_0_0 保存無し -B_PACKET_0_1 ヘッダ情報のみ -B_PACKET_0_2 パケット内容すべて -S_PACKET_1 TCP パケットログ: -B_PACKET_1_0 保存無し -B_PACKET_1_1 ヘッダ情報のみ -B_PACKET_1_2 パケット内容すべて -S_PACKET_2 DHCP パケットログ: -B_PACKET_2_0 保存無し -B_PACKET_2_1 ヘッダ情報のみ -B_PACKET_2_2 パケット内容すべて -S_PACKET_3 UDP パケットログ: -B_PACKET_3_0 保存無し -B_PACKET_3_1 ヘッダ情報のみ -B_PACKET_3_2 パケット内容すべて -S_PACKET_4 ICMP パケットログ: -B_PACKET_4_0 保存無し -B_PACKET_4_1 ヘッダ情報のみ -B_PACKET_4_2 パケット内容すべて -S_PACKET_5 IP パケットログ: -B_PACKET_5_0 保存無し -B_PACKET_5_1 ヘッダ情報のみ -B_PACKET_5_2 パケット内容すべて -S_PACKET_6 ARP パケットログ: -B_PACKET_6_0 保存無し -B_PACKET_6_1 ヘッダ情報のみ -B_PACKET_6_2 パケット内容すべて -S_PACKET_7 Ethernet\r\nパケットログ: -B_PACKET_7_0 保存無し -B_PACKET_7_1 ヘッダ情報のみ -B_PACKET_7_2 パケット内容すべて -IDOK &OK -IDCANCEL キャンセル -STATIC3 大量のパケットログを保存しようとすると、CPU およびハードディスクに大きな負担がかかり、システム全体のパフォーマンス低下の原因になる場合があります。必要なパケットログ情報のみ保存するように設定してください。 - - -PREFIX D_EM_PASSWORD -CAPTION 管理者パスワードの変更 -S_TITLE 管理者パスワードを変更できます。新しいパスワードを入力してから [OK] をクリックしてください。 -STATIC1 新しいパスワード(&P): -STATIC2 確認入力(&C): -IDOK &OK -IDCANCEL キャンセル - - -PREFIX D_EM_LICENSE -CAPTION ライセンスの追加と削除 -STATIC1 SoftEther EtherLogger を使用するには、有効なライセンスを取得し、ライセンスキーを登録する必要があります。この画面では、新しいライセンスキーを登録したり、登録済みのライセンスキーを削除したり、現在のライセンス一覧や SoftEther EtherLogger のライセンスモードを表示したりすることができます。 -S_BOLD 現在登録されているライセンスの一覧(&L): -B_OBTAIN ライセンスの入手・更新(&O) -STATIC2 [ライセンスの入手・更新] をクリックすると、ライセンスの入手・更新方法に関する説明が記載された Web サイトを表示します。 -B_ADD 新しいライセンスキーの登録(&A) -B_DEL 削除(&D) -IDOK ライセンスに関する情報(&I) -STATIC3 ライセンスを選択し、[ライセンスに関する情報] をクリックすると、ソフトイーサ株式会社の Web サイト (softether.com) に接続し、そのライセンスに関する登録情報を表示します。 -S_BOLD2 現在の SoftEther EtherLogger のライセンスモード(&M): -IDCANCEL 閉じる(&X) - - -PREFIX D_EM_LICENSE_ADD -CAPTION 新しいライセンスキーの登録 -S_INFO SoftEther EtherLogger の製品ライセンスのライセンスキーを登録することができます。 -STATIC1 ライセンスキーは、36 桁の英数字およびハイフン ( '-' ) で構成されている、ライセンスの所有を証明するキーコードです。\r\n\r\nライセンスキーは、本ソフトウェアと共にライセンス証書を受け取った場合はライセンス証書に印刷されています。本ソフトウェアのライセンスをオンラインで購入した場合は、購入時の Web サイトの画面やメールなどにライセンスキーが記載されていることがあります。その他の方法でライセンスキーが記載されている場合もあります。不明な場合は、ライセンスの購入元にお問い合わせください。 -STATIC2 ライセンスキーを正確に入力してください(&I): -STATIC3 ライセンスキーは 6 桁ごとに区切って入力してください。ハイフンは入力する必要はありません。コピー && ペーストで入力することも可能です。 -B_INFO2 本ソフトウェアの著作権は全世界で保護されています。お客様は、ライセンス契約書の条件に従った場合のみ、本ソフトウェアを複製・使用することが可能です。不正に入手したライセンスキーの使用、複数台のサーバーでの同一ライセンスキーの使用、ライセンスキーの無断頒布などはライセンス契約書に違反し、民事または刑事上の罰を受ける可能性がありますので、ご注意ください。 -IDOK 登録(&R) -IDCANCEL キャンセル - -PREFIX D_EM_REMOTE -STATIC1 接続するコンピュータのホスト名または IP アドレスを指定してください(&S): -R_LOCAL ローカルコンピュータ (この画面を表示しているコンピュータ) に接続(&L) -S_HOSTNAME コンピュータ名(&C): -IDOK &OK -IDCANCEL キャンセル -B_ABOUT バージョン情報 - -PREFIX D_SM_CONFIG -CAPTION Config ファイルの編集 -IDC_INFO VPN Server "%S" の現在のコンフィグレーションファイルは下記のとおりです。\r\nこのコンフィグレーションファイルの内容を編集して、VPN Server に書き込むこともできます。 -B_EXPORT ファイルに保存(&S) -B_IMPORT ファイルからインポートして書き込み(&I) -IDCANCEL 閉じる(&C) -STATIC1 コンフィグレーションファイルは通常のテキストエディタ等で編集可能です。編集したコンフィグレーションファイルを VPN Server に書き込んだ場合、VPN Server は自動的に再起動し、新しいコンフィグレーションファイルに従って起動します。不正なコンフィグレーションファイルを書き込んだ場合はエラーが発生したり現在の設定内容が失われたりする可能性がありますので、十分注意してください。 -B_FACTORY 設定をリセットして初期化(&R) - - -PREFIX D_SM_ADMIN_OPTION -CAPTION 仮想 HUB 管理オプション -S_INFO 現在、仮想 HUB "%S" には以下の管理オプションが設定されています。 -B_ADD 値の追加(&A) -B_EDIT 値の編集(&E) -B_DELETE 値の削除(&D) -STATIC1 仮想 HUB 管理オプションは、VPN Server の管理者が各仮想 HUB の管理者に仮想 HUB の管理を委任している場合に、設定範囲を制限するために使用します。 -IDOK 保存(&S) -IDCANCEL キャンセル -STATIC2 仮想 HUB の管理オプションを編集することができるのは、この VPN Server 全体の管理権限を持った管理者のみです。仮想 HUB の管理者は、管理オプションを表示できますが、変更することはできません。\r\nただし、allow_hub_admin_change_option が 1 に設定されている場合は、仮想 HUB の管理者でも管理オプションを編集することができます。 -S_BOLD 説明: - - -PREFIX D_SM_MSG -CAPTION メッセージの設定 -S_MSG_2 仮想 HUB "%S" に VPN Client が接続した際に、ユーザーの画面にメッセージを表示できます。メッセージを表示する場合は、以下に表示したいメッセージの内容を入力してください。 -C_USEMSG メッセージを表示する(&M) -STATIC1 メッセージの表示機能について -S_INFO 接続元のユーザーが使用している VPN Client のバージョンが 3.0 以降である必要があります。\r\n\r\nメッセージに「http://」で始まる URL を 1 行だけ記載すると、メッセージを表示する代わりにその URL をデフォルトの Web ブラウザを起動して表示することができます。 -IDOK &OK -IDCANCEL キャンセル - - -PREFIX D_NICINFO -CAPTION 仮想 LAN カード "%S" の状態 -IDCANCEL 閉じる(&C) - - -PREFIX D_SM_VLAN -CAPTION タグ VLAN パケット透過設定ツール -STATIC1 LAN カードの種類によっては、デフォルトでタグ VLAN パケット (IEEE802.1Q) を透過できない場合があります。\r\n\r\n仮想 HUB と LAN カードをローカルブリッジ接続する場合で、物理的なネットワークからタグ VLAN パケットを仮想 HUB に入力したり、仮想 HUB からタグ VLAN パケットを物理的なネットワークに出力したりしたい場合は、LAN カードに VLAN パケットを透過するための設定を行う必要があります。 -B_ENABLE 選択した LAN カードをタグ VLAN が透過可能に設定する(&C) -B_DISABLE 設定を解除する(&U) -STATIC2 タグ VLAN パケット透過設定ツールについて -S_WARNING このツールを用いると、Intel、Broadcom および Marvell 製の正規ドライバを用いている一部の Windows 用 LAN カードのタグ VLAN の透過設定を行ったり、設定を解除したりすることができます。 -S_WARNING2 上記のリストに表示されている LAN カードは、このツールによって設定を変更することがサポートされています。リストに表示されていない LAN カードはこのツールによって設定をすることができません。リストにない LAN カードでも、タグ VLAN がデフォルトで透過可能か、または何らかの設定を行うことにより透過可能になることがあります。\r\n\r\nその場合は、システム管理者が自ら Windows にログインし、そのような設定を行う必要があります。 -IDCANCEL 閉じる(&X) - - -PREFIX D_SM_SIMULATION -CAPTION 遅延・パケットロス生成機能 -STATIC1 このアクセスリストの条件に一致するパケットが仮想 HUB を通過する場合に、そのパケットに遅延・ジッタおよびパケットロスを発生させることができます。\r\n\r\nこの機能により、低速で品質の低いインターネット回線や WAN 回線、ワイヤレス回線などを利用した場合の動作を、LAN 内の机上で実験することができます。たとえば、IP 電話 (VoIP) 等の動作試験に便利です。 -STATIC2 発生させる遅延・ジッタ・パケットロスの内容: -C_DELAY 遅延を発生させる(&D) -S_DELAY 発生させる遅延の量 (0 - 10000) : -S_DELAY2 ミリ秒 (msecs) -C_JITTER 遅延にジッタ (揺らぎ) を発生させる(&J) -S_JITTER 発生させる遅延の揺らぎ (0 - 100) : -S_JITTER2 パーセント (%) -C_LOSS パケットロスを発生させる(&L) -S_LOSS 発生させるパケットロス率 (0 - 100) : -S_LOSS2 パーセント (%) -IDOK &OK -IDCANCEL キャンセル - - -PREFIX D_SM_AO_VALUE -CAPTION 名前と値 -STATIC1 名前(&N): -STATIC2 値(&V): -STATIC3 (整数値) -IDOK &OK -IDCANCEL キャンセル - - -PREFIX D_SM_L3 -CAPTION 仮想レイヤ 3 スイッチ設定 -STATIC1 この VPN Server 内で動作している複数の仮想 HUB 間で仮想のレイヤ 3 スイッチを定義し、異なった IP ネットワーク間をルーティングすることができます。 -STATIC2 仮想レイヤ 3 スイッチ機能は、ネットワークおよび IP ルーティングに関する詳しい知識をお持ちの方やネットワーク管理者のための機能です。通常の VPN 機能を使用する場合は、仮想レイヤ 3 スイッチ機能を使用する必要はありません。\r\n\r\n仮想レイヤ 3 スイッチ機能を使用する場合は、IP ルーティングに関する十分な知識をお持ちの上で、ネットワークに与える影響を十分考慮してから設定してください。 -STATIC3 仮想レイヤ 3 スイッチ機能に関するご注意 -S_BOLD 定義されている仮想レイヤ 3 スイッチの一覧(&L): -B_ADD 新規作成(&N) -B_START 動作開始(&S) -B_STOP 動作停止(&T) -IDOK 編集(&E) -B_DELETE 削除(&D) -IDCANCEL 閉じる(&C) - - -PREFIX D_SM_L3_ADD -CAPTION 新規仮想レイヤ 3 スイッチの作成 -STATIC1 新しい仮想レイヤ 3 スイッチを作成します。名前を入力してください。\r\n\r\n仮想レイヤ 3 スイッチの名前は、既にこの VPN Server に存在する他の仮想レイヤ 3 スイッチと重複することはできません。 -STATIC2 名前(&N): -IDOK &OK -IDCANCEL キャンセル - - -PREFIX D_SM_L3_SW -CAPTION 仮想レイヤ 3 スイッチ "%S" の編集 -STATIC1 1 つの仮想レイヤ 3 スイッチには、複数個の仮想インターフェイスとルーティングテーブルを定義することができます。 -STATIC2 仮想インターフェイスは仮想 HUB に関連付けられ、仮想 HUB が動作しているときに仮想 HUB 内で 1 台の IP ホストのように動作します。複数の仮想 HUB に対してそれぞれ別々の IP ネットワークに所属する仮想インターフェイスが定義されているとき、それらのインターフェイス間で IP ルーティングが自動的に行われます。\r\n\r\nまた、ルーティングテーブルを手動で設定して、より細かい経路設定を行うことも可能です。 -S_BOLD1 仮想インターフェイス一覧(&I): -B_ADD_IF 仮想インターフェイスの追加(&A) -B_DEL_IF 仮想インターフェイスの削除(&E) -S_BOLD2 ルーティングテーブル(&R): -B_ADD_TABLE ルーティングテーブルエントリの追加(&D) -B_DEL_TABLE ルーティングテーブルエントリの削除(&L) -B_START 動作開始(&S) -B_STOP 動作停止(&T) -IDCANCEL 閉じる(&C) - - -PREFIX D_SM_L3_SW_IF -CAPTION 仮想インターフェイスの追加 -STATIC1 新しい仮想インターフェイスを仮想レイヤ 3 スイッチに追加します。\r\n\r\n仮想インターフェイスが所属する IP ネットワーク空間とインターフェイス自身の IP アドレスを定義する必要があります。\r\nまた、インターフェイスが接続する先の仮想 HUB 名を選択するか入力してください。\r\n仮想 HUB 名は現在存在していない仮想 HUB を指定することもできます。 -STATIC2 接続先仮想 HUB (&A) -STATIC3 このインターフェイスが接続する仮想 HUB を選択するか、名前を入力してください。 -STATIC4 仮想 HUB (&H): -STATIC5 仮想インターフェイスの持つ IP アドレスと所属するサブネット空間(&D) -STATIC6 仮想インターフェイスは、仮想 HUB 内で 1 つの IP アドレスを持つ必要があります。また、その IP アドレスの属する IP ネットワークのサブネットマスクを指定する必要もあります。\r\n\r\n複数の仮想 HUB 内の IP 空間同士の仮想レイヤ 3 スイッチを経由したルーティングは、ここで指定した IP アドレスに基づいて動作します。 -S_SRC_IP_1 &IP アドレス: -S_SRC_IP_2 サブネットマスク(&S): -IDOK &OK -IDCANCEL キャンセル - - -PREFIX D_SM_L3_SW_TABLE -CAPTION ルーティングテーブルエントリの追加 -STATIC1 仮想レイヤ 3 スイッチのルーティングテーブルに新しいルーティングテーブルエントリを追加します。\r\n\r\n仮想レイヤ 3 スイッチの IP ルーティングエンジンは、IP パケットの宛先 IP アドレスが各仮想インターフェイスの所属する IP ネットワークのいずれにも所属しない場合、ルーティングテーブルを参照してルーティングを行います。 -STATIC2 ルーティングテーブルエントリの内容(&E): -STATIC3 仮想インターフェイスは、仮想 HUB 内で 1 つの IP アドレスを持つ必要があります。また、その IP アドレスの属する IP ネットワークのサブネットマスクを指定する必要もあります。\r\n\r\n複数の仮想 HUB 内の IP 空間同士の仮想レイヤ 3 スイッチを経由したルーティングは、ここで指定した IP アドレスに基づいて動作します。 -S_SRC_IP_1 ネットワークアドレス(&N): -S_SRC_IP_2 サブネットマスク(&S): -S_SRC_IP_3 ゲートウェイアドレス(&G): -S_SRC_IP_4 メトリック値(&M): -STATIC4 ※ ネットワークアドレスに 0.0.0.0 を、サブネットマスクに 0.0.0.0 を指定すると、デフォルトルートの意味になります。 -IDOK &OK -IDCANCEL キャンセル - - -PREFIX D_CM_SELECT_SECURE -CAPTION スマートカードの選択 -STATIC1 使用するスマートカードの種類を選択してください。\r\n\r\nスマートカードの種類の一覧には、現在コンピュータにドライバがインストールされていて、かつ VPN ソフトウェアでサポートされているデバイスの一覧が表示されます。\r\n現在使用しているスマートカードの種類が表示されない場合は、VPN ソフトウェアをより新しいバージョンにアップデートすることにより使用できるようになる場合もあります。\r\n\r\n※ 導入直後のドライバが表示されない場合は、Windows を再起動してみてください。 -IDOK &OK -IDCANCEL キャンセル - - -PREFIX D_CM_SECURE_MANAGER -CAPTION スマートカードマネージャ -S_INFO 現在選択されているスマートカード:\r\n\r\n%S -B_BOLD スマートカードに格納されているオブジェクト一覧: -B_REFRESH オブジェクトリスト更新(&R) -B_IMPORT カードへ書き込み(&I)... -B_EXPORT カードから読み込み(&E)... -B_DELETE カードから削除(&D) -B_NEW_CERT 新しい証明書と秘密鍵を作成してカードに書き込む(&N)... -B_PIN PIN コードの変更(&C)... -IDCANCEL 閉じる - - -PREFIX D_CM_SECURE_TYPE -CAPTION オブジェクトの種類の選択 -STATIC インポートしたいオブジェクトの種類を選択してください。 -R_CERT 証明書(&C) -R_KEY 秘密鍵(&K) -R_DATA 任意のデータ(&D) -IDOK &OK -IDCANCEL キャンセル - - -PREFIX D_STRING -CAPTION VPN ソフトウェア -IDOK &OK -IDCANCEL キャンセル - - -PREFIX D_SM_SELECT_KEYPAIR -CAPTION スマートカード内の証明書の指定 -S_INFO 現在選択されているスマートカード:\r\n\r\n%S -B_BOLD1 スマートカード内の証明書を選択してください: -IDOK &OK -IDCANCEL キャンセル -B_BOLD2 対応した秘密鍵を選択してください: - - -PREFIX D_CM_LOAD_X -CAPTION 証明書の読み込み -STATIC1 どちらの方法で証明書を読み込みますか? -R_FROM_FILE ファイルから証明書を読み込む(&F) -R_FROM_SECURE スマートカードから証明書を読み込む(&R) -S_FILE 証明書データが保存されているファイル (拡張子が .cer, .crt, .p12, .pfx のいずれか) から証明書を読み込むことができます。 -S_CERT このコンピュータにスマートカードが接続されている場合は、スマートカード内の証明書を読み込むことができます。 -B_SELECT 使用するスマートカードの選択(&S)... -IDOK &OK -IDCANCEL キャンセル - - -PREFIX D_CM_SECURE_PIN -CAPTION PIN コードの変更 -STATIC1 スマートカードの PIN コード (暗証番号) を変更することができます。\r\n\r\nPIN コードを変更するには、現在の PIN コードと、新しい PIN コードを 2 回入力してください。設定した PIN コードは忘れないようにしてください。 -STATIC2 現在の PIN コード(&C): -STATIC3 新しい PIN コード(&N): -STATIC4 確認入力(&E): -STATIC5 ご注意 -STATIC6 現在の PIN コードを一定回数間違えると、スマートカードが使用できなくなる場合があります。 -STATIC7 スマートカードを挿入して [OK] をクリックしてください。 -IDOK &OK -IDCANCEL キャンセル - - -PREFIX D_SM_CRL -CAPTION 無効な証明書の一覧 -STATIC1 この仮想 HUB 内で無効な証明書の一覧を管理します。\r\n\r\n無効な証明書の一覧に証明書を登録すると、その証明書を提示したクライアントは、この仮想 HUB に証明書認証モードで接続できなくなります。 -B_ADD 追加(&A) -IDOK 編集(&E) -IDCANCEL 閉じる(&C) -B_DELETE 削除(&D) - - -PREFIX D_SM_EDIT_CRL -CAPTION 無効な証明書 -STATIC1 無効な証明書の一覧に登録する内容を設定します。\r\n\r\n仮想 HUB にユーザーが証明書認証モードで接続してきたとき、その証明書が無効な証明書の一覧に登録されている 1 つ以上の内容に一致する場合に、そのユーザーの接続を拒否します。 -S_BOLD 下記の定義された項目すべての内容に一致する証明書を無効とします。 -STATIC2 証明書の内容 -R_CN 名前 (CN): -R_O 所属機関 (O): -R_OU 組織単位 (OU): -R_C 国 (C): -R_ST 都道府県 (ST): -R_L ローカル (L): -STATIC3 証明書の属性値: -R_SERI シリアル番号 (16進数): -R_MD5_HASH MD5 ダイジェスト値 (16進数, 128 bit): -R_SHA1_HASH SHA-1 ダイジェスト値 (16進数, 160 bit): -STATIC4 ダイジェスト値 (ハッシュ値) の指定は、証明書を事実上一意に指定することになります。通常、MD5 または SHA-1 のダイジェスト値を入力する場合は、その他の項目を入力する必要はありません。 -STATIC5 既存の証明書ファイルからの指定 -STATIC6 無効にしたい証明書のファイルがある場合は、そのファイルを指定することにより証明書を正確に指定して無効リストに追加することができます。[証明書の読み込み] をクリックして指定した証明書ファイルの内容が自動的に入力されます。 -B_LOAD 証明書の読み込み(&L)... -IDOK &OK -IDCANCEL キャンセル - - -PREFIX D_SM_AC_LIST -CAPTION 接続元 IP 制限リスト -S_TITLE クライアントコンピュータの IP アドレスによって、この VPN Server の仮想 HUB "%S" への VPN 接続を許可または拒否することができます。下記に接続を許可または拒否するルールを設定できます。 -B_ADD ルールの追加(&A) -IDOK ルールの編集(&E) -B_DELETE ルールの削除(&D) -B_SAVE 保存(&S) -IDCANCEL キャンセル(&C) -STATIC1 優先順位はリストの上のものほど高くなります。 -STATIC2 クライアントの IP アドレスがリスト内のどの項目にも一致しなかった場合は、この仮想 HUB への VPN 接続を許可されます。 - - -PREFIX D_SM_AC -CAPTION 接続元 IP 制限リストのルール項目の編集 -STATIC1 IP アクセス制限リストのルール項目を設定してください。ここで設定した項目は、VPN Client が仮想 HUB に接続しようとした際にそのクライアントからの接続を許可するか拒否するかを決定するために使用されます。 -STATIC2 ルール項目の内容 -STATIC3 クライアントの IP アドレスが以下のときにルールを適用する: -R_SINGLE 単一の IP アドレス(&S) -R_MASKED 複数の IP アドレス (IP ネットワークアドレスとネットマスクで指定) (&M) : -STATIC4 アドレス(&A): -S_MASK ネットマスク(&K): -STATIC5 動作 -R_PASS 接続を許可する(&P) -R_DENY 接続を拒否する(&D) -STATIC6 その他 -STATIC7 優先順位(&R): -STATIC8 (整数値: 小さいほど優先順位が高くなります) -STATIC9 IP プロトコル バージョン: -IDOK &OK -IDCANCEL キャンセル - - -PREFIX D_SM_LOG_FILE -CAPTION ログファイル一覧 -STATIC1 サーバー上に保存されているログファイルを指定してダウンロードすることができます。\r\n\r\nVPN Server 全体の管理者は、すべての仮想 HUB のログおよびサーバー ログをダウンロードすることができます。仮想 HUB の管理者は、その仮想 HUB のログファイルのみダウンロードできます。 -IDOK ダウンロード(&D) -B_REFRESH 最新の状態に更新(&R) -IDCANCEL 閉じる - - -PREFIX D_SM_READ_LOG_FILE -CAPTION ファイルのダウンロード -S_INFO2 ファイル "%S" を VPN Server からダウンロードしています。\r\nしばらくお待ちください... -IDCANCEL ダウンロードの中止(&S) - - -PREFIX D_SM_SAVE_LOG -CAPTION ログファイルのダウンロード完了 -S_INFO ファイル "%S" のダウンロードが完了しました。\r\n\r\nこのファイルを開くか、保存することができます。 -IDOK 開く(&O) -B_SAVE 保存(&S) -IDCANCEL キャンセル - - -PREFIX D_TCP -CAPTION TCP/IP 最適化ユーティリティ -STATIC1 Windows のインターネットプロトコル (TCP/IP) の設定を最適化することにより、このコンピュータのネットワークの通信速度を高速化することができる場合があります。\r\n\r\nこの TCP/IP 最適化ユーティリティを使用すると、通信速度の最適化の設定を簡単に行うことができます。 -STATIC2 下記に表示されているのは、現在の Windows が保持している TCP/IP の設定値です。これらの値を変更することにより、TCP/IP の設定を最適化することができます。また、このユーティリティを後から起動することで、いつでも値を再設定したり元に戻したりすることができます。 -STATIC3 TCP/IP 通信設定: -STATIC4 TCP 受信ウインドウサイズ(&R): -R_RECV_DISABLE OS のデフォルト値を使用する(&D) -R_RECV_ENABLE 下記の値に設定する(&E) -S_RECV バイト -B_RECV 推奨値を使用(&C) -STATIC5 TCP 送信ウインドウサイズ(&S): -R_SEND_DISABLE OS のデフォルト値を使用する(&I) -R_SEND_ENABLE 下記の値に設定する(&N) -S_SEND バイト -B_SEND 推奨値を使用(&M) -IDOK &OK -IDCANCEL キャンセル -STATIC6 TCP/IP の設定を変更した場合は、Windows を再起動した際に設定が有効になります。設定変更後、すぐにコンピュータを再起動する必要はありませんが、再起動するまでは TCP/IP の最適化設定は有効になりません。 -B_DELETE TCP 通信設定最適化ユーティリティによる管理を行わない - - -PREFIX D_TCP_MSG -CAPTION TCP/IP 通信設定の最適化 -STATIC1 Windows の TCP/IP 通信設定を最適化すると、TCP/IP を使用した通信速度が大幅に向上する場合があります。通信設定を最適化しますか?\r\n\r\n後から TCP/IP 最適化ユーティリティを起動して、いつでも通信設定を最適化したり、元に戻したりすることができます。 -STATIC2 TCP/IP の設定を変更した場合は、Windows を再起動した際に設定が有効になります。設定変更後、すぐにコンピュータを再起動する必要はありませんが、再起動するまでは TCP/IP の最適化設定は有効になりません。 -R_OPTIMIZE 通信設定を自動的に最適化する(&A) -R_MANUAL TCP/IP 最適化ユーティリティを使用して手動で最適化する(&M) -R_NO 最適化は行わない(&D) -IDOK 次へ(&N) > -IDOK3 < 戻る(&B) - - -PREFIX D_CM_PKCSEULA -CAPTION ソフトウェアとスマートカードの使用条件に関する確認 -S_INFO_1 ソフトウェア "%S" を使用して指定したスマートカードにアクセスしようとしています。 -S_INFO_2 ソフトウェア "%S" を使用する場合は、そのソフトウェアや使用するスマートカードの使用条件がある場合は、それに同意した上で使用する必要がある場合があります。\r\n\r\n詳しくは、ソフトウェア "%S" やスマートカードの提供元にお問い合わせください。 -S_INFO_3 上記に同意し、ソフトウェア "%S" を使用して指定したスマートカードへのアクセスを行いますか? -IDOK はい(&Y) -IDCANCEL いいえ(&N) - - -PREFIX D_CM_TRAFFIC -CAPTION 通信スループット測定ツール -STATIC1 通信スループット測定ツールを使用すると、IP ネットワークに接続されている 2 台のコンピュータ間で最大限に通信を行い、実際の通信データ量と通信時間からその間のネットワークの最大帯域幅 (スループット) を測定することができます。このツールは、VPN の仮想ネットワーク内でも、VPN と関係無い物理的なネットワークでも使用することができます。 -STATIC2 このツールを使用して、現在のネットワークの通信能力を測定することができます。ただし、測定結果は測定する両方のコンピュータの CPU 能力や他に動作しているアプリケーションの状態、ネットワークの使用率などによって変化するため、実際のネットワークの処理能力よりも低い値がでる場合もあります。 -S_1 動作設定 -S_3 このコンピュータは測定サーバーまたは測定クライアントのどちらですか? -R_SERVER 測定サーバー(&S) -R_CLIENT 測定クライアント(&C) -S_4 測定サーバーの場合は、待ち受けるポート番号を指定します。\r\n測定クライアントの場合は、接続先の測定サーバーのホスト名または IP アドレスとポート番号を指定し、必要な場合は必要なオプションを設定します。 -S_5 接続先の測定サーバー名(&H): -S_6 ポート番号(&P): -S_7 (TCP ポート) -S_8 下記のオプションはクライアント側で設定します。 -S_9 データ通信の方向 -R_DOWNLOAD 測定サーバーから測定クライアントに伝送 (ダウンロード) (&D) -R_UPLOAD 測定クライアントから測定サーバーに伝送 (アップロード) (&U) -R_FULL 双方向に伝送 (ダウンロードとアップロードを同時に実行) (&F) -S_10 通信の詳細設定 -S_11 並列接続してデータ伝送に使用する TCP コネクション数(&N): -S_12 データ伝送時間 (計測時間) (&A): -S_13 秒間 -R_ETHERNET Ethernet と仮定してレイヤ 2 でのスループットを算出(&E) -R_DOUBLE 中継機器能力測定モード(&B) -S_14 コネクション -IDOK 実行(&R) -IDCANCEL キャンセル -S_15 通信スループット測定ツールは vpncmd コマンドライン管理ユーティリティから実行することもできます (Windows 以外の OS でも使用可能です)。 - - -PREFIX D_CM_TRAFFIC_RUN -CAPTION 通信トラフィック測定ツール -S_INFO 現在、通信トラフィック測定ツールを実行しています。下記に動作状況が表示されます。 -STATIC1 通信トラフィック測定ツールを終了してこの画面を閉じるには、[終了] をクリックしてください。 -IDCANCEL 終了(&X) - - -PREFIX D_CM_TRAFFIC_RESULT -CAPTION 通信トラフィック測定結果 -STATIC1 通信トラフィックの測定が完了しました。結果は次のとおりです。 -IDCANCEL 閉じる(&C) - - -PREFIX D_SM_LICENSE -CAPTION ライセンスの追加と削除 -STATIC1 SoftEther VPN Server を使用するには、有効なライセンスを取得し、ライセンスキーを登録する必要があります。この画面では、新しいライセンスキーを登録したり、登録済みのライセンスキーを削除したり、現在のライセンス一覧や VPN Server のライセンスモードを表示したりすることができます。 -S_BOLD 現在登録されているライセンスの一覧(&L): -B_OBTAIN ライセンスの入手・更新(&O) -STATIC2 [ライセンスの入手・更新] をクリックすると、ライセンスの入手・更新方法に関する説明が記載された Web サイトを表示します。 -B_ADD 新しいライセンスキーの登録(&A) -B_DEL 削除(&D) -IDOK ライセンスに関する情報(&I) -STATIC3 ライセンスを選択し、[ライセンスに関する情報] をクリックすると、ソフトイーサ株式会社の Web サイト (softether.com) に接続し、そのライセンスに関する登録情報を表示します。 -S_BOLD2 現在の SoftEther VPN Server のライセンスモード(&M): -IDCANCEL 閉じる(&X) - - -PREFIX D_SM_LICENSE_ADD -CAPTION 新しいライセンスキーの登録 -S_INFO SoftEther VPN Server の製品ライセンスまたは接続ライセンスのライセンスキーを登録することができます。 -STATIC1 ライセンスキーは、36 桁の英数字およびハイフン ( '-' ) で構成されている、ライセンスの所有を証明するキーコードです。\r\n\r\nライセンスキーは、本ソフトウェアと共にライセンス証書を受け取った場合はライセンス証書に印刷されています。本ソフトウェアのライセンスをオンラインで購入した場合は、購入時の Web サイトの画面やメールなどにライセンスキーが記載されていることがあります。その他の方法でライセンスキーが記載されている場合もあります。不明な場合は、ライセンスの購入元にお問い合わせください。 -STATIC2 ライセンスキーを正確に入力してください(&I): -STATIC3 ライセンスキーは 6 桁ごとに区切って入力してください。ハイフンは入力する必要はありません。コピー && ペーストで入力することも可能です。 -B_INFO2 本ソフトウェアの著作権は全世界で保護されています。お客様は、ライセンス契約書の条件に従った場合のみ、本ソフトウェアを複製・使用することが可能です。不正に入手したライセンスキーの使用、複数台のサーバーでの同一ライセンスキーの使用、ライセンスキーの無断頒布などはライセンス契約書に違反し、民事または刑事上の罰を受ける可能性がありますので、ご注意ください。 -IDOK 登録(&R) -IDCANCEL キャンセル - - -PREFIX D_FREEINFO -CAPTION SoftEther VPN Server Free Edition について -S_INFO_1 SoftEther VPN Server Free Edition をご利用いただきありがとうございます。 -S_INFO_2 接続先のサーバー "%S" で稼動している SoftEther VPN Server は個人利用を目的とした Free Edition です。\r\nFree Edition では SoftEther VPN Server のすべての機能が使用できますが、下記の利用方法は使用権許諾契約によって禁止されています。 -S_INFO_3 ・ VPN Server を経由して、業務のための通信が行われるような使用方法。 -S_INFO_4 上記の禁止されている使用方法で使用した場合は、SoftEther VPN Server 使用権許諾契約違反となりますのでご注意ください。SoftEther VPN Server の通常製品版のライセンスを入手していただくことにより、上記のような制限は無くなります。 通常製品版については、www.softether.com をご覧ください。\r\n\r\nもし、このサーバーを上記のような使用方法で使用されている場合は、www.softether.com までご連絡いただきますようお願いいたします。\r\n\r\n※ この画面は、Free Edition の VPN Server に接続した際に表示されます。Free Edition 以外のエディション製品では表示されません。\r\n※ Free Edition のソフトウェアは、製品版と比較してこのお知らせ画面が表示される以外の違いは全くありません。 -B_HIDE 次回からこのお知らせを表示しない(&H) -IDCANCEL &OK - - -PREFIX D_CM_SETTING -CAPTION SoftEther VPN Client 動作モード変更 -STATIC1 SoftEther VPN Client は「通常モード」または「簡易モード」で使用することができます。使用するモードを切り替えるには、下記のチェックボックスを選択してください。 -R_NORMAL 通常モード(&N) -R_EASY 簡易モード(&E) -STATIC2 [通常モード] は SoftEther VPN Client ソフトウェアのすべての操作を行うことができる動作モードです。一般的なユーザーやシステム管理者にお勧めします。 -STATIC3 [簡易モード] は VPN Server への接続などの最もよく使用する操作しかできない動作モードです。VPN について詳しい知識をお持ちでないユーザーにお勧めします。 -STATIC4 [設定ロック機能] を使用すると、SoftEther VPN Client に登録されている接続設定を使って VPN Server に接続することはできますが、接続設定の内容を変更したり、新しく接続設定を作成したり、削除したりすることができなくなります。 -R_LOCK 設定ロック機能を使う(&L) -S_PASSWORD1 パスワードを指定することができます。パスワードを指定すると、後から設定ロック機能を無効にする際にパスワードの入力が必要になります。 -S_PASSWORD2 パスワード(&P): -S_PASSWORD3 確認入力(&C): -IDOK &OK -IDCANCEL キャンセル -S_VGS2 VPN Gate 学術実験サービスの設定を行うことができます。 -B_VGS VPN &Gate サービスの設定... - - -PREFIX D_CM_EASY -CAPTION SoftEther VPN クライアント簡易接続マネージャ (Developer Edition) -B_MODE 動作モードの変更(&M) -IDCANCEL 閉じる(&C) -B_STATUS 接続状況の表示(&S) -B_VGC VPN Gate 学術実験 - - -PREFIX D_SM_SETUP -CAPTION SoftEther VPN Server / Bridge 簡易セットアップ (Developer Edition) -S_TITLE SoftEther VPN Server / Bridge 簡易セットアップ (Developer Edition) -IDC_STATIC_1 このセットアッププログラムを使用すると、SoftEther VPN Server または VPN Bridge を以下の用途や目的のために簡単にセットアップすることができます。セットアップ終了後は、VPN サーバー管理マネージャを用いて、より詳細な設定を自由に行うことができます。 -S_BOLD 構築しようとしている VPN サーバーの種類を選択してください。複数の用途のための VPN サーバーを構築しようとしている場合は、複数の種類を選択することができます。 -C_REMOTE リモートアクセス VPN サーバー(&R) -S_REMOTE_1 リモートアクセス VPN は、たとえば社内 LAN などの既存の Ethernet セグメントに対して、インターネットなどを経由して遠隔地の VPN クライアントコンピュータが VPN 接続することができる形態の VPN 構成です。\r\nVPN Server に接続した VPN クライアントコンピュータは、社内の Ethernet に対して直接 LAN ケーブルで接続しているのと同等の状態でネットワークにアクセスできるようになります。 -C_SITE 拠点間接続 VPN サーバーまたはブリッジ(&S) -S_SITE_1 拠点間接続 VPN は、既存の 2 箇所以上の拠点の Ethernet セグメント同士を VPN 接続する形態の VPN 構成です。\r\nVPN 接続されたそれぞれの拠点同士はレイヤ 2 レベルで同一のセグメントとなりますので、各拠点内のコンピュータ同士が同一ネットワーク内にあるものとして通信することができるようになります。 -S_SITE_2 この VPN Server の役割を選択してください: -C_CENTER 拠点間接続 VPN の中心となり、他拠点からの接続を受け入れる VPN Server (&M) -C_EDGE 各拠点に設置する VPN Server または VPN Bridge (&E) -C_OTHER 高度な機能を用いた VPN (&O) -S_OTHER クラスタリング機能や仮想レイヤ 3 スイッチ機能などの高度な機能を提供する VPN システムを構築する場合。 -IDOK 次へ(&N) -IDCANCEL 閉じる(&C) - - -PREFIX D_SM_SETUP_HUB -CAPTION 簡易セットアップ - 仮想 HUB 名の決定 -IDC_STATIC_1 VPN Server 上に仮想 HUB を 1 個作成する必要があります。仮想 HUB の名前は自由に指定することができます。 -IDC_STATIC_2 仮想 HUB 名(&N): -IDOK &OK -IDCANCEL キャンセル - - -PREFIX D_SM_SETUP_STEP -CAPTION 簡易セットアップの実行 -IDC_STATIC_1 この VPN Server / VPN Bridge のセットアップを完了するには、下記のタスクのうち必要なものを実行してください。 -S_1_1 1. VPN 接続を受け入れるためのユーザーの作成 -S_1_2 この VPN Server がリモートアクセス VPN を受け入れる場合、または拠点間接続 VPN において中心となり他拠点からの接続を受け入れる場合は、VPN 接続を受け入れるためにユーザーを作成しておく必要があります。 -B_USER ユーザーを作成する(&U) -S_2_1 2. 接続先の VPN Server への接続設定 -S_2_2 拠点間接続 VPN における各拠点に設置する VPN Server または VPN Bridge の場合は、各 VPN 拠点からの接続を受け付ける、中心となる VPN Server のアドレスなどを入力して、その VPN Server への接続を確立する必要があります。 -B_CASCADE 接続先の VPN Server への接続設定を行う(&O) -S_3_1 3. ローカルブリッジの設定 -S_3_2 VPN 経由で LAN にアクセスするためには、VPN 側の仮想的な Ethernet セグメントと物理的な Ethernet セグメントとの間を「ローカルブリッジ接続」機能でブリッジ接続する必要があります。\r\n\r\nVPN に対してブリッジ接続する既存の Ethernet デバイス (LAN カード) を選択してください。 -IDCANCEL 閉じる(&C) -IDC_STATIC_8 必要な設定がすべて完了したら、[閉じる] をクリックしてください。VPN Server / VPN Bridge の詳細な管理画面が表示されます。その後は必要な場合に詳細な設定を行ってください。 -B_SECURENAT SecureN&AT 機能の設定を行う - - -PREFIX D_CPU64_WARNING -CAPTION SoftEther VPN の 64 bit 版に関する情報 -S_BOLD インストールされた SoftEther VPN ソフトウェアは 32 bit 版ですが、現在実行されている Windows オペレーティングシステムは 64 bit 版です。 -S_INFO 64 bit 版 Windows 上で 32 bit 版の SoftEther VPN ソフトウェアを実行することは可能ですが、Windows が搭載している 32 bit エミュレータ上で動作することになるため、パフォーマンスが低下する場合があります。\r\nまた、一部の機能がサポートされない可能性があります。\r\n\r\n64 bit 版 Windows 上では SoftEther VPN ソフトウェアの 64 bit 版をインストールして使用されることを強く推奨します。\r\nSoftEther VPN ソフトウェアの 64 bit 版は http://selinks.org/ よりダウンロードすることができます。\r\n\r\nこのダイアログボックスは、30 秒後に自動的に閉じます。 -IDOK &OK - - -PREFIX D_ONCEMSG -CAPTION TITLE -C_DONTSHOWAGAIN 今後はこのメッセージを表示しない(&D) -IDCANCEL &OK - - -PREFIX D_CONNECT -IDCANCEL キャンセル - - -PREFIX D_SM_IPSEC -CAPTION IPsec / L2TP / EtherIP / L2TPv3 設定 -S_TITLE IPsec / L2TP / EtherIP / L2TPv3 サーバー機能の設定 -S_3 この VPN Server 上の仮想 HUB は、L2TP に対応した PC や Mac OS X、スマートフォン等からリモートアクセス VPN 接続を受け付けたり、EtherIP / L2TPv3 に対応した市販のルータ等から拠点間 VPN 接続を受け付けたりできます。 -S01 L2TP サーバー機能 (リモートアクセス VPN サーバー接続) -S02 iPhone、iPad、Android 等のスマートフォンや Mac OS X、Windows 等の OS 付属の標準 VPN クライアントから VPN 接続ができるようになります。 -R_L2TP_OVER_IPSEC L2TP サーバー機能を有効にする (L2TP over IP&sec) -S03 iPhone、iPad、Android、Windows、Mac OS X からの VPN 接続を受け付けることができます。 -R_L2TP_RAW L2TP サーバー機能を有効にする (暗号化されていない &L2TP) -S04 IPsec を用いない L2TP を使用する特殊なクライアントをサポートできます。 -S_1 接続時のユーザー名で仮想 HUB 名が省略された場合に接続する仮想 HUB の選択(&H): -S_2 L2TP、OpenVPN および MS-SSTP VPN 接続時のユーザー名は "仮想HUB名\\ユーザー名" または "ユーザー名@仮想HUB名" のように指定してください。なお、仮想 HUB 名の指定が省略された場合、デフォルトで接続する仮想 HUB を設定しておくことができます。 -S05 EtherIP / L2TPv3 サーバー機能 (拠点間接続 VPN サーバー機能) -S06 EtherIP / L2TPv3 over IPsec に対応した市販のルータ製品は、この VPN Server の仮想 HUB にレイヤ 2 (Ethernet) でブリッジ接続できます。 -R_ETHERIP &EtherIP / L2TPv3 over IPsec サーバー機能有効 -B_DETAIL サーバー機能の詳細設定(&D) -S07 IPsec 共通設定(&C) -S_PSK IPsec 事前共有鍵(&P): -S_PSK2 IPsec 事前共有鍵は、「PSK (Pre-Shared Key)」または「シークレット」と呼ばれることがあります。8 文字程度で設定し、VPN を利用するすべてのユーザーに配布してください。 -IDOK &OK -IDCANCEL キャンセル - - -PREFIX D_SM_ETHERIP -CAPTION EtherIP / L2TPv3 サーバー機能の詳細設定 -S_TITLE EtherIP / L2TPv3 サーバー機能 -S01 VPN Server に EtherIP / L2TPv3 over IPsec に対応した市販のルータ機器からレイヤ 2 Ethernet ブリッジ接続を行うことができます。\r\nCisco 社のルータや NEC 製の IX ルータ、IIJ 製の SEIL ルータ等がお勧めです。 -S02 EtherIP / L2TPv3 による接続を受け付けるには、予め、クライアント側となる EtherIP / L2TPv3 対応ルータがこの VPN Server に接続する際の IPsec Phase 1 ID 文字列と、接続先の仮想 HUB の情報の対応表を定義しておく必要があります。 -S_BOLD IPsec Phase 1 ID と接続先仮想 HUB との対応表(&T): -B_ADD 追加(&A) -IDOK 編集(&E) -B_DELETE 削除(&D) -IDCANCEL 閉じる(&X) - - -PREFIX D_SM_ETHERIP_ID -CAPTION EtherIP / L2TPv3 over IPsec クライアント定義 -S01 EtherIP / L2TPv3 over IPsec クライアントがこの VPN Server に接続しようとした際の ISAKMP (IKE) Phase 1 のイニシエータ ID 文字列が以下に一致する場合に、次の仮想 HUB への接続設定を適用します。 -S02 ISAKMP Phase 1 &ID: -S03 接続先の仮想 &HUB: -S04 ユーザー名(&U): -S05 パスワード(&P): -S06 ユーザー名とパスワードは、仮想 HUB に登録されている必要があります。EtherIP / L2TPv3 クライアントは、上記で入力された情報で識別されるユーザーの権限で仮想 HUB に接続したものとみなされます。 -IDOK &OK -IDCANCEL キャンセル -S07 (ID はクライアント側のルータの接続設定で設定するものと同一の文字列を指定してください。文字列のほか、ID の種類が IP アドレスの場合は IP アドレスも指定できます。)\r\n\r\nなお、'*' (アスタリスク) を指定するとワイルドカード指定となり、他の明示的なルールに一致しないすべての接続元クライアントが対象となります。 - - -PREFIX D_SM_OPENVPN -CAPTION OpenVPN / MS-SSTP 設定 -S_TITLE OpenVPN / MS-SSTP VPN サーバー機能設定 -S_1 OpenVPN 社の OpenVPN ソフトウェア製品と同等の VPN サーバー機能を搭載しています。\r\n\r\nOpenVPN クライアントからこの VPN Server に接続できます。 -R_OPENVPN &OpenVPN サーバー機能を有効にする -S_TOOL OpenVPN クライアント用サンプル設定ファイル自動作成ツール -S_TOOL2 本来、OpenVPN クライアントを使うためには設定ファイルを手動で記述する必要があり、これは難易度が高い作業です。しかし、以下のボタンをクリックするだけでこの VPN Server に接続することができる基本的な OpenVPN クライアント用の設定ファイルを自動的に生成することができます。 -B_CONFIG OpenVPN クライアント用のサンプル設定ファイルを生成(&C) -S_2 Microsoft SSTP VPN 互換サーバー機能 -S_3 Microsoft 社の Windows Server 2008 / 2012 製品に搭載されている MS-SSTP VPN サーバー機能と互換性がある機能を搭載しています。\r\n\r\nWindows Vista / 7 / 8 / RT / 10 に標準搭載の MS-SSTP クライアントからこの VPN Server に接続できます。 -R_SSTP &MS-SSTP VPN サーバー機能を有効にする -S_SSTP VPN Server の SSL 証明書の CN の値がクライアント側で指定するホスト名と一致し、かつその証明書が信頼されている必要があります。詳しくは Microsoft 社のドキュメントを参照してください。 -S_4 これらの互換サーバー機能で仮想 HUB に接続する場合のユーザー名の指定方法、およびデフォルト仮想 HUB の選択規則は、IPsec サーバー機能と同様です。 -B_IPSEC I&Psec サーバー機能の設定 -S_13 OpenVPN 互換サーバー機能 -IDOK &OK -IDCANCEL キャンセル - - -PREFIX D_SM_DDNS -CAPTION ダイナミック DNS 機能 -S_TITLE ダイナミック DNS 機能 -S_BOLD このバージョンの VPN Server にはダイナミック DNS 機能が搭載されています。 -S_1 ダイナミック DNS により、この VPN Server コンピュータに永続的な固有の DNS ホスト名が割当てられます。これにより独自でドメインを所有していなくても、VPN Client や VPN Bridge などの設定画面上で VPN Server の IP アドレスの代わりに DNS ホスト名によって VPN Server を指定することができます。 -S_22 また、IP アドレスが変化する可能性がある一般的な ISP を用いて VPN Server をインターネットに接続する場合でも、IP アドレスが変化すれば自動的に DNS ホストに対応する IP アドレスが更新されますので、可変 IP アドレスでも VPN Server を運用することができるようになります。\r\nこれにより、高価な月額料金が必要な固定グローバル IP アドレスのサービスを契約する必要がなくなります。 -S_3 さらに、このバージョンの VPN Server は NAT トラバーサル機能をサポートしており、VPN Server が NAT の内側にありプライベート IP アドレスしか持っていない場合でも、NAT 上で特別な設定をすることなく、インターネット側からの VPN 接続を受付けることができます。 -S_4 現在の状態(&S): -S_STATUS3 割当てられているダイナミック DNS ホスト名(&H): -B_HINT ヒント -S_STATUS4 グローバル IPv&4 アドレス: -S_STATUS5 グローバル IPv&6 アドレス: -S_5 設定の変更(&M): -S_STATUS6 ダイナミック DNS ホスト名の変更(&C): -S_STATUS7 3 文字以上 31 文字以内の半角英数字およびハイフン '-' が使用できます。\r\n変更は何度でも可能です。 -IDOK 上記の DNS ホスト名に変更する(&A) -B_RESTORE 変更前に戻す(&R) -S_2 IPv6 インターネットに接続されていない場合は上記の [IPv6 アドレス] の欄にエラーが表示されますが、異常ではありません。一部の国・地域では、行政機関による制限により、ダイナミック DNS サービスが利用できない場合があります。 -IDCANCEL 閉じる(&X) -B_DISABLE ダイナミック DNS 機能を無効にする(&D) -B_PROXY プロキシサーバー経由で接続(&P) -S_STATUS8 DNS 鍵: -B_HINT2 ヒント - - -PREFIX D_SM_SPECIALLISTENER -CAPTION VPN over ICMP / DNS 機能の設定 -S_TITLE VPN over ICMP / DNS 機能 -S_1 VPN over ICMP / DNS 機能 -S_2 ファイアウォールやルータ等の故障や過負荷、設定ミス等により TCP/IP 通信が遮断されている環境のネットワークからでも、ICMP (Ping) または DNS パケットの通信が可能であれば、この VPN Server との間で VPN 通信を行うことができます。そのためには、予め以下の機能を有効にしておく必要があります。 -R_OVER_ICMP VPN over &ICMP サーバー機能を有効にする -R_OVER_DNS VPN over &DNS サーバー機能を有効にする (UDP ポート 53 を使用します) -IDOK &OK -IDCANCEL キャンセル -S_3 接続元の VPN Client または VPN Bridge は内部バージョン 4.0 以降が必要です。 -S_4 警告: これは、ファイウォールやルータ等が一時的に不調となっており ICMP または DNS のみ安定した通信が可能な環境で VPN 通信を確立するための機能です。緊急時などには有益ですが、長期間の利用には適さない場合があります。 - - -PREFIX D_SM_REDIRECT -CAPTION HTTP URL リダイレクション設定 -S_1 仮想 HUB を経由する TCP コネクションがこのアクセスリストの条件に一致した場合、その TCP コネクションを用いてクライアントが何らかの通信を行おうとすると、強制的に以下に設定された URL 文字列をクライアントに対して応答します。\r\n\r\nこれにより、VPN クライアント上で起動している Web ブラウザが特定の IP アドレスにアクセスした場合などに任意の Web ページをその Web ブラウザ上に表示させることができます。 -S_2 リダイレクト先 URL の入力: -S_BOLD2 リダイレクト先 &URL: -S_3 入力例: -S_4 単純な URL リダイレクション: -S_5 高度な URL リダイレクション: -B_HINT 高度な URL リダイレクション機能の使い方(&U)... -S_6 ご注意 -S_BOLD この機能は TCP/IP に詳しいネットワーク管理者向けの機能です。以下の注意事項をよく読み、慎重に設定してください。 -S_7 アクセスリストの条件に宛先セッションのユーザー名またはグループ名が指定されている場合で当該アクセスリストがパケットに一致した場合はこの機能は無視されます。 -S_8 TCP 以外のパケットがアクセスリストに一致した場合はこの機能は無視されます。 -S_9 すべての TCP パケットに対して HTTP リダイレクト応答を返します (ポート 80 に限定されません)。たとえばポート 80 に限定するためには、アクセスリストの条件で宛先ポートを TCP 80 に限定してください。 -S_10 リダイレクト先の URL に対してクライアントがアクセスしようとした結果が再度このアクセスリストに一致した場合は、当該アクセス要求に対して再度リダイレクション応答が返信されます。この場合は無限のリダイレクションの繰り返しが発生する可能性があります。 -IDOK &OK -IDCANCEL キャンセル -S_11 高度なリダイレクション機能は、リダイレクト先 CGI に VPN セッション情報を提供できます。 - - -PREFIX D_SW_WELCOME -CAPTION D_SW_WELCOME -S_WELCOME SoftEther VPN は筑波大学で開発された、Windows や Mac などのコンピュータおよび iPhone, iPad, Android, Windows RT などのスマートフォンやタブレット、Cisco などのサードパーティ製 VPN ルータ、OpenVPN や MS-SSTP などの既存の VPN プロトコルとも互換性がある安全で高性能なオープンソース VPN ソフトウェアです。 -S_TITLE すべての主要なデバイスに対応するオープンソース VPN ソフトウェア - - -PREFIX D_SW_MODE -CAPTION D_SW_MODE -R_SYSTEM システムモード (推奨) (&S) -R_USER ユーザーモード (&U) -S_1 このコンピュータに通常の方法で VPN ソフトウェアをインストールします。このコンピュータの管理者権限が必要です。 -S_USER 一般ユーザー権限で VPN ソフトウェアをインストールします。管理者権限は不要ですが、ローカルブリッジなどの一部の機能が利用できません。ユーザー "%s" が Windows にログオンしている間だけ使用できます。 -S_2 SoftEther VPN は 2 種類のセットアップモードでインストールできます。\r\n\r\n通常は「システムモード」を選択してください。\r\n\r\n何らかの理由で管理者権限を取得することができない場合は、「ユーザーモード」を選択すれば一般ユーザー権限でインストールすることもできます。 - - -PREFIX D_SW_NOT_ADMIN -CAPTION D_SW_NOT_ADMIN -S_INFO 現在 Windows にログオンしているユーザー "%s" には管理者権限 (Administrators 権限) がありません。\r\n\r\nセットアップを続行するには、一度 Windows からログオフし、このコンピュータの管理者権限を持つユーザーでログオンしてから再度セットアップ ウィザードを起動してください。 -S_INFO6 「完了」をクリックすると、セットアップ ウィザードを終了します。 -S_INFO2 管理者権限が無い場合でも、ユーザーモードでインストールすることができます。\r\nユーザーモードでソフトウェアをインストールするには、「戻る」をクリックしてください。 - - -PREFIX D_SW_COMPONENTS -CAPTION D_SW_COMPONENTS - - -PREFIX D_SW_EULA -CAPTION D_SW_EULA -S_1 使用許諾契約書を注意してお読みください。 -B_AGREE 使用許諾契約書に同意します(&A) - - -PREFIX D_SW_WARNING -CAPTION D_SW_WARNING -S_1 SoftEther VPN ソフトウェアは非常に強力な通信機能を有しているため、ご利用にあたっては下記の重要事項説明書をよくお読みください。 - - -PREFIX D_SW_DIR -CAPTION D_SW_DIR -S_INFO 「%s」 のインストール先ディレクトリを指定してください。 -R_CUSTOM インストール先を変更(&S) -S_DEST インストール先(&D): -B_BROWSE 参照(&B)... -R_SHOWCUSTOM 上級者のためのインストールオプション(&A) -R_FOR_SYSTEM このコンピュータの Windows にインストール(&Y) -R_FOR_USER ユーザー "%s" の環境にのみインストール(&U) -S_WARNING ご注意: 推奨されません。ユーザー "%s" が Windows からログオフすると、%s の動作は停止します。また、ローカルブリッジ機能や L2TP/IPsec 機能 (Mac やスマートフォンからの接続) などは動作しません。 - - -PREFIX D_SW_READY -CAPTION D_SW_READY -S_INFO 「%s」 のインストールの準備が完了しました。 -S_INFO7 「次へ」をクリックするとインストール処理を開始します。 - - - -PREFIX D_SW_PERFORM -CAPTION D_SW_PERFORM -S_INFO %s のセットアップが進行中です。\r\n完了までしばらくお待ちください... -S_INFO8 SoftEther VPN は日本国経済産業省のソフトウェア研究開発プロジェクトの成果物です。IPA (独立行政法人 情報処理推進機構) の未踏ソフトウェア創造事業に採択され開発されました。詳しくは http://www.ipa.go.jp/ をご覧ください。 - -PREFIX D_SW_ERROR -CAPTION D_SW_ERROR -S_INFO エラーが発生したため、%s のセットアップを完了できませんでした。\r\n\r\n再試行するには、もう一度セットアップ ウィザードを起動してください。 - - -PREFIX D_SW_FINISH -CAPTION D_SW_FINISH -S_INFO %s のセットアップ処理が正常に完了しました。 -S_INFO8 SoftEther VPN は日本国経済産業省のソフトウェア研究開発プロジェクトの成果物です。IPA (独立行政法人 情報処理推進機構) の未踏ソフトウェア創造事業に採択され開発されました。詳しくは http://www.ipa.go.jp/ をご覧ください。 - -PREFIX D_SW_UNINST1 -CAPTION D_SW_UNINST1 -S_WELCOME このセットアップウィザードを使用すると、%s をコンピュータからアンインストールすることができます。\r\n\r\nアンインストールを開始するには、「次へ」をクリックしてください。 -S_TITLE %s のアンインストール - - - -PREFIX D_SW_EASY1 -CAPTION D_SW_EASY1 -S_WELCOME 企業内の多くの数のユーザーのコンピュータに VPN Client をインストールする際に、1 台ずつ VPN 接続設定を実施するのは大変です。 -S_TITLE SoftEther VPN Client 簡易インストーラとは -S_WELCOME2 「簡易インストーラ作成ウィザード」は、企業のシステム管理者向けのツールです。「簡易インストーラ作成ウィザード」を使用すれば、あらかじめ指定した接続設定ファイルを埋め込んだ VPN Client のインストーラを作成できます。もちろん、個人のユーザーも使用できます。 -S_WELCOME3 作成したインストーラは、社内のファイルサーバーやメールなどを用いて社員に配布できます。インストーラを実行すると VPN Client がインストールされ、自動的に接続設定がインポートされてその接続設定を用いた VPN 接続が開始されます。 - - -PREFIX D_SW_EASY2 -CAPTION D_SW_EASY2 -S_BOLD1 埋め込みたい接続設定ファイル (.vpn ファイル) を指定してください -S_1 簡易インストーラに埋め込みたい接続設定ファイル (拡張子が .vpn のファイル) を指定してください。接続設定ファイルは、VPN クライアント接続マネージャ内の接続設定を右クリックして「接続設定のエクスポート」をクリックしてエクスポートできます。 -S_18 接続設定(&S): -B_BROWSE_SETTING 参照(&B)... -B_DELETE_SENSITIVE 接続設定ファイル内にユーザー名とパスワードを格納しない(&E) -S_BOLD2 生成される EXE ファイルの保存先ファイル名を指定してください -S_3 このウィザードは、簡易インストーラとして EXE ファイル (実行可能ファイル) を生成します。生成されるファイルを保存するためのファイル名を指定してください。 -S_19 ファイル名(&A): -B_BROWSE_OUT 参照(&R)... -B_EASYMODE VPN クライアント接続マネージャを簡易モードに設定する(&E) - - -PREFIX D_SW_WEB1 -CAPTION D_SW_WEB1 -S_WELCOME SoftEther VPN Client Web インストーラを作成すると、Web ブラウザを開き特定のページにアクセスすることにより、SoftEther VPN Client を自動的にインストールすることができます。この際に、予め設定しておいた接続設定ファイルをインポートして VPN 接続を開始させることもできます。 -S_TITLE SoftEther VPN Client Web インストーラとは -S_WELCOME2 作成した Web インストーラは、社内向けの Web サーバーなどに HTML ファイルとして設置できます。設置された HTML ファイルの URL に社員がアクセスすると、SoftEther VPN Client のインストーラが起動します。 -S_WELCOME3 ActiveX コントロールを使用しています。クライアントブラウザは Internet Explorer 5.0 以降、オペレーティングシステムは Windows 2000 以降がサポートされています。IE 以外のブラウザや Windows 98 などの古い OS はサポートされません。 - - -PREFIX D_SW_WEB2 -CAPTION D_SW_WEB2 -S_BOLD1 埋め込みたい接続設定ファイル (.vpn ファイル) を指定してください -S_1 Web インストーラに埋め込みたい接続設定ファイル (拡張子が .vpn のファイル) を指定してください。接続設定ファイルは、VPN クライアント接続マネージャ内の接続設定を右クリックして「接続設定のエクスポート」をクリックしてエクスポートできます。 -S_18 接続設定(&S): -B_BROWSE_SETTING 参照(&B)... -B_DELETE_SENSITIVE 接続設定ファイル内にユーザー名とパスワードを格納しない(&E) -S_BOLD2 生成される Web サーバー設置用ファイルの保存先ファイル名を指定してください -S_3 このウィザードは、Web サーバーに設置するための HTML ファイルや CAB ファイルが格納された ZIP ファイル (アーカイブファイル) を生成します。生成されるファイルを保存するためのファイル名を指定してください。 -S_19 ファイル名(&A): -B_BROWSE_OUT 参照(&R)... -B_EASYMODE VPN クライアント接続マネージャを簡易モードに設定する(&E) - - -PREFIX D_UPDATE_NOTICE -CAPTION %s のアップデート -IDOK 更新 Web サイトを表示(&S)... -B_CONFIG アップデート通知設定(&C)... -IDCANCEL 今後このメッセージを表示しない(&I) -S_INFO %s の最新バージョンがリリースされています。今すぐダウンロードしてアップデートできます。 -S_PRODUCT ソフトウェア: -S_CURRENT 現在使用中のバージョン: -S_CURRENT_STR Ver %u.%02u.%04u%s -S_LATEST 最新バージョン: -S_LATEST_STR Ver %S%s - - -PREFIX D_UPDATE_CONFIG -CAPTION アップデート通知の設定 -S_INFO %s の新しいバージョンがリリースされていないかどうか定期的にチェックし、リリースされていた場合は通知画面を表示します。\r\n\r\nアップデートチェックのために日本の茨城県つくば市に設置されている SoftEther Update サーバーとの間で HTTPS 通信を行います。お客様の個人情報が送信されることはありません。 -S_TITLE %s のアップデートチェックと通知の設定 -S_ENABLE アップデートチェックを有効にする(&E) -S_DISABLE アップデートチェックを無効にする(&D) -IDCANCEL 閉じる(&C) - - -PREFIX D_SM_VMBRIDGE -CAPTION VM 内でローカルブリッジを使用する場合の注意事項 -S_TITLE VM 内でのローカルブリッジ機能の使用 -S_1 VPN Server が VMware や Hyper-V などの VM (仮想マシン) 内で動作している可能性が検出されました。以下の注意事項をよくお読みください。VM を使用していない場合は、このメッセージは無視してください。 -S_2 VM では、デフォルト設定で LAN カードの「プロミスキャスモード」(MAC アドレス スプーフィング) での通信が禁止されている場合があります。\r\n\r\nVM 内で動作する VPN Server の仮想 HUB とホストマシンに装着されている物理的な LAN カードとの間でローカルブリッジを行う場合、プロミスキャスモード (MAC アドレス スプーフィング) が禁止されていると正常に通信ができません。このような場合は、VM の設定ツールを用いてプロミスキャスモード (MAC アドレス スプーフィング) を有効にしてください。\r\n\r\n詳しくは、VM のドキュメントを参照してください。他の管理者によって管理されている共有 VM の場合は、管理者にプロミスキャスモード (MAC アドレス スプーフィング) を許可するよう要請してください。 -S_BOLD 注意事項 -IDCANCEL &OK - - -PREFIX D_SM_AZURE -CAPTION VPN Azure サービスの設定 -S_TITLE VPN Azure クラウド型 VPN サービス (無料) -S_1 VPN Azure により、会社のパソコンに自宅や外出先のパソコンから非常に簡単に VPN 接続できるようになります。VPN 接続中は会社のパソコンを経由して、社内 LAN の他のサーバーにもアクセスできます。 -S_2 会社のパソコン (VPN Server) にはグローバル IP アドレスは不要です。ファイアウォールや NAT の内側であっても動作し、ネットワーク管理者による設定は一切必要ありません。VPN クライアントとなる自宅のパソコンでは、Windows に標準付属の SSTP VPN クライアントを使用できます。 -S_3 VPN Azure は、SoftEther VPN Server をお使いの方はどなたでも無料で利用できるクラウド VPN サービスです。ソフトイーサ株式会社によって運営されています。使い方を表示するには、右のボタンをクリックしてください。 -B_BOLD VPN Azure 設定 -R_ENABLE VPN Azure を有効にする(&E) -R_DISABLE VPN Azure を無効にする(&D) -S_HOSTNAME_BORDER 現在の VPN Azure ホスト名 -S_HOSTNAME_INFO VPN Azure ホスト名はダイナミック DNS サービスのホスト名のドメイン部分を "vpnazure.net" に変更したものが使用されます。 -B_CHANGE ホスト名の変更(&H) -B_WEB VPN Azure の使い方\r\n(Web サイトを表示) -IDCANCEL &OK - - -PREFIX D_SM_PROXY -CAPTION プロキシサーバー経由の接続 -STATIC9 プロキシサーバーを経由してサーバーに接続することができます。 -STATIC10 プロキシの種類(&Y): -R_DIRECT_TCP 直接 TCP/IP 接続 (プロキシを使わない) (&D) -R_HTTPS HTTP プロキシサーバー経由接続(&T) -R_SOCKS SOCKS4 プロキシサーバー経由接続(&K) -R_SOCKS5 SOCKS5 プロキシサーバー経由接続(&K) -B_PROXY_CONFIG プロキシサーバーの接続設定(&R) -IDOK &OK -IDCANCEL キャンセル - - -PREFIX D_VGC_LIST -CAPTION VPN Gate 学術実験プロジェクト プラグイン for SoftEther VPN Client -S_TITLE VPN Gate 公開 VPN 中継サーバー一覧 -S_INFO1 世界中のボランティアによって無償提供されている VPN サーバーに VPN 接続すると、その VPN サーバーを経由してインターネットに自由にアクセスできます。ローカルのファイアウォールの制約を回避したり、自分の IP アドレスを秘匿したりできます。 -IDOK 選択した VPN サーバーに接続(&C) -B_PROXY プロキシ設定(&P) -S_VLAN 仮想 LAN カード: -B_WEB VPN Gate 学術実験\r\nWeb サイト -B_REFRESH リストを更新(&R) -S_REFRESH リストを更新中... -S_RESEARCH 筑波大学における学術研究プロジェクト -S_INFO9 回線速度 (Mbps) が高速で Ping の値が小さな VPN サーバーほど快適です。また、海外に設置されている VPN サーバーを経由すれば、普段あなたの国から閲覧できない Web サイトやコンテンツが見えるようになるかも知れません。 - - -PREFIX D_VGC_PROTOCOL -CAPTION 接続に使用する VPN プロトコルの選択 -S_TITLE 公開 VPN 中継サーバー "%S" (%S) は TCP と UDP の両方の VPN プロトコルをサポートしています。 -S_INFO VPN サーバー "%S" (%S) への接続に使用する VPN プロトコルを選択してください。一般的に TCP のほうがファイアウォールを通過しやすいですが、TCP で正常に使用できなかった場合は代わりに UDP をお試しください。 -R_TCP &TCP を使用 (Ethernet over HTTPS VPN) (推奨) -R_UDP &UDP を使用 (Ethernet over UDP VPN) -IDOK &OK -IDCANCEL キャンセル - - -PREFIX D_VGS_CONFIG -CAPTION VPN Gate サービス コントロールパネル -R_ENABLE VPN Gate 中継サービスを有効にし、ボランティアとして実験に参加する(&E) -S_TITLE VPN Gate 学術実験に参加しますか? -S_INFO1 VPN Gate は筑波大学大学院における学術的な研究として実施されている、分散型公開 VPN 中継サーバーの運用に関する実験です。VPN Gate クライアントのユーザーは、公開 VPN 中継サーバーコンピュータ上で動作する VPN Gate サービスに接続することにより、その VPN サービスを経由してインターネットにアクセスできます。 -S_INFO9 VPN Gate クライアントのユーザーがインターネット上のサーバーにアクセスする際は、アクセス元の IP アドレスが公開 VPN 中継サーバーのコンピュータの IP アドレスに変化します。これにより、VPN Gate クライアントのユーザーはたとえばローカルのファイアウォールが故障しているためアクセスできない海外の Web サイトにスムーズにアクセスできるようになります。 -S_WARNING チェックボックスをチェックして [OK] をクリックすると、このコンピュータ上で VPN Gate 中継サービスが動作します。これにより、任意の VPN Gate クライアントが当該 VPN Gate 中継サービスを経由してインターネットに向かって通信することができるようになります。VPN Gate 中継サービスが動作している場合でも、このコンピュータが接続されている社内 LAN などのプライベート IP アドレスに対する VPN 通信は VPN Gate 中継サービスを経由しないため安全です。 -B_OPTION VPN Gate サービスのオプション設定(&O)... -IDOK &OK -IDCANCEL キャンセル -B_WEB http://www.vpngate.net/ を開く(&B)... - - -PREFIX D_VGS_OPTION -CAPTION VPN Gate サービスのオプション設定 -S_TITLE VPN Gate サービスのオプション設定 -S_1 VPN Gate サービスをこのコンピュータで動作させる場合、このコンピュータは公開 VPN サーバーになります。サーバーの運営者情報を入力してください。入力された運営者情報は、www.vpngate.net 上のサーバー一覧表などに公開され、誰でも閲覧できます。また、VPN Gate 実験に関する連絡先として使用いたします。 -S_2 運営者情報: -S_3 この VPN Gate サービスの運営者(&O): -S_19 (64 文字以内) -S_20 不正利用があったときの通報先\r\n(メールアドレス等) (&A): -S_21 (64 文字以内) -S_22 利用者へのメッセージ(&M):\r\n(128 文字以内) -S_23 利用者へのメッセージは、VPN Gate サーバー一覧表の内で表示されます。楽しいメッセージを入力すると、心理的に良好な気持ちになります。 -S_24 VPN 通信設定: -R_LOG VPN 通信のパケットログを保存する(&S) (推奨) -R_2WEEKS 2 週間以上経過したパケットログは自動削除またはエンコード後アーカイブする(&T) (推奨) -R_PERMANENT パケットログはディスク容量が許す限り恒久的に保存する(&P) -R_L2TP &L2TP/IPsec VPN サーバー機能を有効にする (推奨) -S_25 Mac OS X、iPhone / iPad、Android などからの VPN 接続を可能にします。 -B_MESSAGE VPN Client が VPN 接続してきた際にクライアント PC の画面上にメッセージを表示する(&S)... -IDOK &OK -IDCANCEL キャンセル - - -PREFIX D_VGS_WARNING -CAPTION VPN Gate 学術実験への参加前のご注意 -S1 VPN Gate 学術実験サービスは、日本国に所在する筑波大学大学院における研究プロジェクトとして運営されているサービスです。本サービスは日本国の法令にのみ準拠して運用されており、日本国以外の国・地域の法令については一切関知しておりません。 -S2 そもそも世界には 200 カ国近くの国が存在しており、それぞれの国における法律は互いに異なります。すべての国の法律を調査した上でそれらすべてに適合することを保証したソフトウェアを開発することは事実上不可能です。万一ユーザーが本サービスを特定の国・地域の領域内で利用したことによって公務員により法的なペナルティを科せられるなどの損害が発生した場合であっても、プロジェクト実施者は一切責任を負いません。 -S3 本ソフトウェアまたはサービスを使用する際には、ユーザーが適用されるすべての法令をユーザーの責任により遵守してください。本ソフトウェアまたはサービスを日本国内・国外を問わず使用された場合に発生するすべての損害と責任は、ユーザーに帰責します。本学術実験の運営者およびソフトウェアの供給者は、一切責任を負いません。 -S4 これらの注意事項に同意いただけない場合は、VPN Gate 学術実験サービスに関連する機能を使用しないでください。 -S5 VPN Gate は筑波大学大学院における学術目的の研究プロジェクトです。VPN Gate ソフトウェアはフリーウェアである SoftEther VPN およびオープンソースである UT-VPN を拡張するプラグインの形で開発されていますが、これは本研究プロジェクトにおいて開発されたものであり、ソフトイーサ株式会社によって開発されたものではありません。本研究はソフトイーサ株式会社が主宰、推進または保証するものではありません。 -R_NEVER 今後このメッセージを表示しない(&S) -B_WEB VPN Gate 学術実験 &Web サイト... -IDOK 同意する(&A) -IDCANCEL 同意しない(&D) -S_BOLD VPN 通信が禁止されている国・地域では VPN Gate を使用しないでください。 - - -PREFIX D_NM_PUSH -CAPTION プッシュする静的ルーティングテーブルの編集 -S1 VPN クライアントに対してこの仮想 DHCP サーバーから DHCP 応答を送信する際に、クラスレス静的ルート (RFC 3442) を併せて送信することができます。 -S2 VPN クライアントがクラスレス静的ルート (RFC 3442) を認識できるかどうかは、VPN クライアントソフトウェアによって異なります。SoftEther VPN Client および OpenVPN Client はクラスレス静的ルートに対応しています。L2TP/IPsec および MS-SSTP においては、利用の可否はクライアントソフトウェアに依存します。 -S3 仮想 DHCP サーバーのオプションでデフォルトゲートウェイを空欄に設定することで、スプリットトンネリングが実現できます。L2TP/IPsec および MS-SSTP クライアントを使用している場合は、IPv4 の設定画面でデフォルトゲートウェイを VPN サーバーに向けないようにする設定が必要です。 -S4 ローカルブリッジ経由で外部に DHCP サーバーがある場合は、その DHCP サーバーでクラスレス静的ルート (RFC 3442) をプッシュするよう設定することもできます。その場合は、SecureNAT の仮想 DHCP サーバー機能は無効にしてください。また、この画面での設定は必要ありません。 -S5 プッシュする静的ルーティングテーブルの編集 -S6 例: 192.168.5.0/255.255.255.0/192.168.4.254, 10.0.0.0/255.0.0.0/192.168.4.253\r\n\r\n複数のエントリ (最大 64 個) はカンマまたはスペースで区切ります。\r\n各エントリは、"IP ネットワークアドレス/サブネットマスク/ゲートウェイ IP アドレス" の書式で記述します。 -S7 クラスレス静的ルートについては、RFC 3442 をお読みください。 -IDOK &OK -IDCANCEL キャンセル - - - -########################################################################### -# # -# ソフトウェア内のメニューの文字列データ # -# # -########################################################################### - - -# 接続マネージャのメニュー -PREFIX CM_MENU -# [接続] メニュー -CMD_TOP_CONNECT 接続(&C) -CMD_CONNECT 接続(&O)\tEnter -CMD_STATUS 状態の表示(&S)...\tCtrl+S -CMD_DISCONNECT 切断(&I)\tCtrl+D -CMD_DISCONNECT_ALL すべての接続を切断(&A)\tCtrl+I -CMD_RENAME 名前の変更(&M)\tF2 -CMD_NEW 接続設定の新規作成(&N)...\tCtrl+N -CMD_CLONE コピーの作成(&C)\tCtrl+C -CMD_SHORTCUT 接続ショートカットの作成(&H)... -CMD_EXPORT_ACCOUNT 接続設定のエクスポート(&F)... -CMD_IMPORT_ACCOUNT 接続設定のインポート(&P)... -CMD_STARTUP スタートアップ接続に設定(&T)\tCtrl+T -CMD_NOSTARTUP スタートアップ接続を解除(&E) -CMD_RECENT 最近接続した &VPN サーバー -CMD_DELETE 削除(&D)\tDel -CMD_PROPERTY プロパティ(&R)...\tAlt+Enter -CMD_EXIT 接続マネージャを閉じる(&O)\tAlt+F4 -CMD_QUIT 接続マネージャプログラムの終了(&X)\tAlt+Q -# [編集] メニュー -CMD_TOP_EDIT 編集(&E) -CMD_SELECT_ALL すべて選択(&A)\tCtrl+A -CMD_SWITCH_SELECT 選択の切り替え(&I) -# [表示] メニュー -CMD_TOP_VIEW 表示(&V) -CMD_STATUSBAR ステータスバーの表示(&S) -CMD_VISTASTYLE Windows Vista / 7 / 8 / 10 スタイル(&Y) -CMD_SHOWPORT ポート番号を接続設定一覧に表示(&P) -CMD_TRAYICON タスクトレイのアイコンの表示(&T) -CMD_ICON アイコン(&I) -CMD_DETAIL 詳細(&D) -CMD_GRID 罫線を表示(&G) -CMD_REFRESH 最新の状態に更新(&R)\tF5 -# [仮想 LAN] メニュー -CMD_TOP_VLAN 仮想 &LAN -CMD_NEW_VLAN 新規仮想 LAN カードの作成(&C)...\tCtrl+L -CMD_ENABLE_VLAN 仮想 LAN カードの有効化(&E)\tCtrl+E -CMD_DISABLE_VLAN 仮想 LAN カードの無効化(&S)\tCtrl+B -CMD_DELETE_VLAN 仮想 LAN カードの削除(&D)\tDel -CMD_REINSTALL ドライバの再インストール(&U)...\tCtrl+U -CMD_WINNET &Windows ネットワーク接続の設定...\tCtrl+W -# [スマートカード] メニュー -CMD_TOP_SECURE スマートカード(&S) -CMD_SECURE_MANAGER スマートカードマネージャ(&M)...\tCtrl+G -CMD_SECURE_SELECT 使用するスマートカードの選択(&S)... -# [ツール] メニュー -CMD_TOP_TOOL ツール(&T) -CMD_PASSWORD パスワードの設定(&P)...\tCtrl+P -CMD_TRUST 信頼する証明機関の証明書の管理(&T)...\tCtrl+R -CMD_NETIF ネットワークデバイスの状態(&N)... -CMD_TCPIP TCP/IP 最適化ユーティリティ(&U)... -CMD_MMCSS Windows Vista / 7 / 8 / 10 のための最適化機能(&V)... -CMD_TRAFFIC 通信スループット測定ツール(&R)...\tCtrl+Q -CMD_CM_SETTING 動作モードの変更(&M)... -CMD_LANGUAGE 表示言語の変更(&L)... -CMD_OPTION オプション設定(&O)...\tCtrl+O -# [音声ガイド] メニュー -CMD_TOP_VOICE 音声ガイド(&O) -CMD_VOIDE_NONE 音声ガイド OFF(&D) -CMD_VOICE_NORMAL 標準の音声ガイド(&N) -CMD_VOICE_ODD 拡張音声ガイド(&O) -# [ヘルプ] メニュー -CMD_TOP_HELP ヘルプ(&H) -CMD_ABOUT バージョン情報(&A)... - - - - - - - - - - - - - - - -########################################################################### -# # -# コマンドプロンプトの文字列データ # -# # -########################################################################### - -PREFIX NULL - -# コンソールシステム全般系 -CON_INFILE_ERROR エラー: 指定された入力ファイル "%s" を開くことができません。 -CON_OUTFILE_ERROR エラー: 指定された出力ファイル "%s" を作成することができませんでした。 -CON_INFILE_START ファイル "%s" に記述されているコマンドを、キーボードからの入力の代わりに使用します。 -CON_OUTFILE_START 画面に出力されたメッセージは、ファイル "%s" にも保存されます。 -CON_USER_CANCEL [EOF] -CON_UNKNOWN_CMD "%S": コマンドが見つかりません。\nHELP コマンドで使用できるコマンド一覧を表示できます。 -CON_AMBIGUOUS_CMD "%S": コマンドが曖昧です。 -CON_AMBIGUOUS_CMD_1 指定されたコマンド名は、次の複数のコマンドに一致します: -CON_AMBIGUOUS_CMD_2 より厳密にコマンド名を指定し直してください。 -CON_INVALID_PARAM パラメータ "/%S" が指定されています。コマンド "%S" ではそのようなパラメータは指定できません。詳しくは "%S /HELP" と入力して使用できるパラメータ一覧を確認してください。 -CON_AMBIGUOUS_PARAM "/%S": パラメータ名が曖昧です。 -CON_AMBIGUOUS_PARAM_1 指定されたパラメータ名は、コマンド "%S" のパラメータとして指定可能な次の複数のパラメータに一致します: -CON_AMBIGUOUS_PARAM_2 より厳密にパラメータ名を指定し直してください。 - - -# 不明なコマンド -CMD_UNKNOWM このコマンドに関する説明はありません。 -CMD_UNKNOWN_HELP このコマンドに関する詳細な説明はありません。このコマンドの動作について詳しく知りたい場合は、マニュアルやオンラインドキュメントを参照してください。 -CMD_UNKNOWN_ARGS コマンドの実行例はありません。 -CMD_UNKNOWN_PARAM このパラメータに関する説明はありません。 - - -# コンソールシステム内部で使用している文字列 -CMD_HELP_1 下記の %u 個のコマンドが使用できます: -CMD_HELP_2 それぞれのコマンドの使用方法については、"コマンド名 ?" と入力するとヘルプが表示されます。 -CMD_EVAL_MIN_MAX 値は %u 以上 %u 以下の整数で指定する必要があります。 -CMD_PROMPT 値を入力してください : -CMD_EVAL_NOT_EMPTY 空白を指定することはできません。 -CMD_EVAL_SAFE 使用できない文字が含まれています。 -CMD_EVAL_INT 1 以上の整数を指定する必要があります。 -CMD_HELP_TITLE コマンド "%S" のヘルプ -CMD_HELP_DESCRIPTION [目的] -CMD_HELP_USAGE [使用方法] -CMD_HELP_HELP [説明] -CMD_HELP_ARGS [パラメータ] -CMD_PROMPT_PORT ポート番号を入力してください : -CMD_EVAL_PORT ポート番号が不正です。ポート番号は 1 以上 65535 以下で指定してください。 -CMD_CT_STD_COLUMN_1 項目 -CMD_CT_STD_COLUMN_2 値 -CMD_CT_STD_COLUMN_3 説明 -CMD_PARSE_IP_SUBNET_ERROR_1_6 "IPv6 アドレス/サブネットマスク" の形式で指定してください。\nIPv6 アドレスは 2001:200:0:1:: のように 16 進数をコロンで区切って指定します。サブネットマスクは ffff:ffff:ffff:ffff:: のように IPv6 形式で区切って指定するか、64 のように先頭からのビット長を 10 進数で指定できます。\n単一の IPv6 ホストを指定するには、サブネットマスクを ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff または 128 として指定します。\n(例)\n2001:200:0:1::/64\n2001:200:0:1::/ffff:ffff:ffff:ffff::\n2001:200:0:1::5/128\n\n -CMD_PARSE_IP_SUBNET_ERROR_1 "IPv4 アドレス/サブネットマスク" の形式で指定してください。\nIPv4 アドレスは 192.168.0.1 のように 10 進数をドットで区切って指定します。サブネットマスクは 255.255.255.0 のように 10 進数をドットで区切って指定するか、24 のように先頭からのビット長を 10 進数で指定できます。\n単一のホストを指定するには、サブネットマスクを 255.255.255.255 または 32 として指定します。\n(例)\n192.168.0.1/24\n192.168.0.1/255.255.255.0\n192.168.0.5/255.255.255.255\n\n -CMD_PARSE_IP_SUBNET_ERROR_2 指定された IP アドレスはネットワークアドレスではありません。 -CMD_PARSE_IP_SUBNET_ERROR_3 指定された IP アドレスはネットワークプレフィックスアドレスではありません。 -CMD_EVAL_DATE_TIME_FAILED 日付と時刻の指定が不正です。\n"2005/10/08 19:30:00" のように、年・月・日・時・分・秒 の 6 個の整数をスペース、スラッシュまたはコロンで区切って指定してください。年は 4 桁で指定してください。 -CMD_PARSE_IP_MASK_ERROR_1_6 "IPv6 アドレス/マスク" の形式で指定してください。\nIPv6 アドレスは 2001:200:0:1:: のように 16 進数をコロンで区切って指定します。マスクは ffff:ffff:ffff:ffff:: のように IPv6 形式で区切って指定するか、64 のように先頭からのビット長を 10 進数で指定できます。\n単一の IPv6 ホストを指定するには、マスクを ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff または 128 として指定します。\n(例)\n2001:200:0:1::/64\n2001:200:0:1::/ffff:ffff:ffff:ffff::\n2001:200:0:1::5/128\n\n -CMD_PARSE_IP_MASK_ERROR_1 "IPv4 アドレス/マスク" の形式で指定してください。\nIPv4 アドレスは 192.168.0.1 のように 10 進数をドットで区切って指定します。マスクは 255.255.255.0 のように 10 進数をドットで区切って指定するか、24 のように先頭からのビット長を 10 進数で指定できます。\n単一のホストを指定するには、マスクを 255.255.255.255 または 32 として指定します。\n(例)\n192.168.0.1/24\n192.168.0.1/255.255.255.0\n192.168.0.5/255.255.255.255\n\n - - -# 共通メッセージ -CMD_MSG_INVALID_HOSTNAME ホスト名の指定が正しくありません。 -CMD_MSG_OK コマンドは正常に終了しました。 -CMD_MSG_ALLOW 許可 -CMD_MSG_DENY 禁止 -CMD_MSG_INFINITE 無制限 -CMD_MSG_ENABLE 有効 -CMD_MSG_DISABLE 無効 -CMD_MSG_LOAD_CERT_FAILED 指定された X.509 証明書ファイルを読み込めません。 -CMD_MSG_SAVE_CERT_FAILED X.509 証明書ファイルの書き込みに失敗しました。 -CMD_ACCOUNT_COLUMN_NAME 接続設定名 -CMD_ACCOUNT_COLUMN_HOSTNAME 接続先 VPN Server のホスト名 -CMD_ACCOUNT_COLUMN_PORT 接続先 VPN Server のポート番号 -CMD_ACCOUNT_COLUMN_HUBNAME 接続先 VPN Server の仮想 HUB 名 -CMD_ACCOUNT_COLUMN_PROXY_TYPE 経由するプロキシサーバーの種類 -CMD_ACCOUNT_COLUMN_PROXY_HOSTNAME プロキシサーバーのホスト名 -CMD_ACCOUNT_COLUMN_PROXY_PORT プロキシサーバーのポート番号 -CMD_ACCOUNT_COLUMN_PROXY_USERNAME プロキシサーバーのユーザー名 -CMD_ACCOUNT_COLUMN_SERVER_CERT_USE サーバー証明書の検証 -CMD_ACCOUNT_COLUMN_SERVER_CERT_NAME 登録されているサーバー固有証明書 -CMD_ACCOUNT_COLUMN_RETRY_ON_SERVER_CERT サーバー証明書が信頼できない場合に接続を再試行する -CMD_ACCOUNT_COLUMN_DEVICE_NAME 接続に使用するデバイス名 -CMD_ACCOUNT_COLUMN_AUTH_TYPE 認証の種類 -CMD_ACCOUNT_COLUMN_AUTH_USERNAME ユーザー名 -CMD_ACCOUNT_COLUMN_AUTH_CERT_NAME 認証に使用するクライアント証明書 -CMD_ACCOUNT_COLUMN_NUMTCP VPN 通信に使用する TCP コネクション数 -CMD_ACCOUNT_COLUMN_TCP_INTERVAL 各 TCP コネクションの確立間隔 -CMD_ACCOUNT_COLUMN_TCP_TTL 各 TCP コネクションの寿命 -CMD_ACCOUNT_COLUMN_TCP_HALF 半二重モードの使用 -CMD_ACCOUNT_COLUMN_ENCRYPT SSL による暗号化 -CMD_ACCOUNT_COLUMN_COMPRESS データ圧縮 -CMD_ACCOUNT_COLUMN_BRIDGE_ROUTER ブリッジ / ルータモードで接続 -CMD_ACCOUNT_COLUMN_MONITOR モニタリングモードで接続 -CMD_ACCOUNT_COLUMN_NO_TRACKING ルーティングテーブルを調整しない -CMD_ACCOUNT_COLUMN_QOS_DISABLE QoS 制御機能を使用しない -CMD_ACCOUNT_COLUMN_DISABLEUDP UDP 高速化機能を無効化する - - -# デバッグ情報書き出しコマンド -CMD_DEBUG_SOFTNAME SoftEther VPN デバッグ情報収集ツール -CMD_DEBUG_PRINT SoftEther VPN デバッグ情報収集ツール\r\n\r\n -CMD_DEBUG_NOT_2000 このコマンドは Windows 2000 以降でのみ使用できます。 -CMD_DEBUG_NOT_ADMIN このコマンドを起動するには、Windows に管理者権限でログインする必要があります。 -CMD_DEBUG_UAC_FAILED 管理者権限の取得に失敗しました。 -CMD_DEBUG_SAVE_TITLE デバッグ情報の保存先ファイル名を指定してください -CMD_DEBUG_OK デバッグ情報ファイルを "%s" に保存しました。\r\n\r\nこのファイルをサポート担当者の指示に従ってサポート担当者にお送りください。\r\nなお、ファイルをお送りいただく前に必ずファイルの内容をご確認ください。\r\nもしファイルの内容に秘密情報が含まれている場合で、その情報をファイルの送付先の担当者に開示したくないとお考えの場合は、当該秘密情報の部分のみをあなたの責任において手動で除去してから再度ファイルを ZIP で圧縮しお送りください。\r\n\r\n秘密情報が含まれているにも関わらず、それを削除せずにサポート担当者にお送りいただいた場合、当該秘密情報をサポート担当者に開示することについて同意されたものとみなされますのでご注意ください。 -CMD_DEBUG_NG デバッグ情報ファイルを "%s" に保存できませんでした。 - - -# TEST コマンド -CMD_TEST 実験的な動作を行います。 -CMD_TEST_HELP テストコマンドです。実験的な動作を行います。Test コマンドはいくつかの引数を指定することができます。いくつかの引数は省略することができます。 -CMD_TEST_ARGS Test [/A1:a_str] [/A2:b_str] [/A3:int_value] -CMD_TEST_A1 パラメータ A1 を指定します。省略することができます。 -CMD_TEST_A2 パラメータ A2 を指定します。省略すると、実行時にパラメータ A2 を入力するためのプロンプトが表示されます。空白を指定することはできません。 -CMD_TEST_A3 数値を指定します。1 以上 100 以下の整数を指定しなければなりません。それ以外の整数を指定した場合は、エラーメッセージが表示されます。 -CMD_TEST_EVAL_A2 パラメータ A2 に空白を指定することはできません。 -CMD_IP_EVAL_FAILED IP アドレスの指定が正しくありません。 -CMD_HOSTPORT_EVAL_FAILED ホスト名とポート番号の指定が不正です。\nホスト名:ポート番号 または IPアドレス:ポート番号 のような形式で指定してください。 -CMD_PORTLIST_EVAL_FAILED ポート番号の一覧の指定が不正です。\nポート番号は少なくとも 1 つ以上設定する必要があり、複数個設定することも可能です。その場合は、"443,992,8888" のようにカンマ記号で区切ってください。 -CMD_PROTOCOL_EVAL_FAILED プロトコルの指定が正しくありません。プロトコルは ip, tcp, udp, icmpv4, icmpv6 またはプロトコル番号 (0 から 255 まで) を指定してください。 -CMD_PORT_RANGE_EVAL_FAILED ポート番号またはポート番号の範囲の指定が正しくありません。ポート番号を 1 つだけ指定する場合はそのポート番号を整数で指定してください。複数のポートを指定する場合は範囲の開始ポート番号と終了ポート番号を 80-443 のようにハイフンでつないで指定してください。 -CMD_TCP_CONNECTION_STATE_EVAL_FAILED TCP コネクションの状態指定が不正です。TCP コネクションの状態を指定する場合は、"Established" または "Unestablished" を指定してください。プロトコルの指定で tcp を選択する必要があります。 -CMD_MAC_ADDRESS_AND_MASK_EVAL_FAILED MAC アドレスとマスクの指定が不正です。MAC アドレスとマスクには、16 進数で指定してください。"-" や ":" の区切りが使用出来ますが、省略もできます。例えば "00-AC-84-EA-33-BC/FF-FF-FF-FF-FF-FF" のように指定してください。 -CMD_EXEC_MSG_NAME %S コマンド - %s -CMD_ID ID -CMD_FILE_NOT_FOUND 指定されたファイル "%s" が見つかりません。 -CMD_FILE_NAME_EMPTY ファイル名が指定されていません。 -CMD_SAVECERTPATH X.509 証明書の保存先ファイル名: -CMD_SAVECERT_FAILED 証明書ファイルの保存に失敗しました。 -CMD_SAVEKEYPATH 秘密鍵の保存先ファイル名: -CMD_SAVEKEY_FAILED 秘密鍵ファイルの保存に失敗しました。 -CMD_SAVEFILE_FAILED ファイルの保存に失敗しました。 -CMD_LOADFILE_FAILED ファイルのオープンに失敗しました。 -CMD_LOADCERTPATH 読み込む X.509 証明書のファイル名: -CMD_LOADCERT_FAILED 証明書ファイルの読み込みに失敗しました。 -CMD_LOADKEYPATH 読み込む秘密鍵のファイル名: -CMD_LOADKEY_FAILED 秘密鍵ファイルの読み込みに失敗しました。 -CMD_LOADKEY_ENCRYPTED_1 指定された秘密鍵ファイルはパスフレーズによって保護されています。 -CMD_LOADKEY_ENCRYPTED_2 パスフレーズを入力してください: -CMD_LOADKEY_ENCRYPTED_3 パスフレーズが間違っています。 -CMD_KEYPAIR_FAILED 指定された X.509 証明書と秘密鍵の組合せは正しくありません。証明書とその証明書に対応した秘密鍵が必要です。 -CMD_CERT_NOT_EXISTS 証明書は登録されていません。 -CMD_NO_SETTINGS - -CMD_DISCONNECTED_MSG \n--- エラー ---\n\n管理対象のホストとの通信セッションが切断されました。この後のコマンドを実行してもエラーになります。\n\n管理対象のホストに再接続するには、EXIT と入力して一度プロンプトから抜けてから再接続してください。\n\n - - -# VPNCMD コマンド -CMD_VPNCMD SoftEther VPN Developer Edition コマンドライン管理ユーティリティ -CMD_VPNCMD_HELP vpncmd プログラムは、SoftEther VPN ソフトウェアをコマンドラインで管理することができるユーティリティです。vpncmd を使用すると、ローカルまたはリモートコンピュータで動作している VPN Client、VPN Server、および VPN Bridge に接続してそれらのサービスを管理することができます。また、VPN Tools モードを使用して、VPN Server や VPN Client に接続していなくても使用できる証明書の作成や速度測定機能などを呼び出すこともできます。\nvpncmd では、/IN および /OUT パラメータとしてファイル名を指定した場合、実行するコマンドを列挙したファイルに従ってコマンドを一括実行したり、実行結果をファイルに書き出すことができます。通常、vpncmd を起動した場合はコマンドプロンプトが表示されますが、/IN パラメータで入力ファイルを指定した場合は入力ファイルのすべての行の実行が完了すると自動的に終了します。また、/CMD パラメータで実行するコマンドを指定した場合、そのコマンドの実行が完了すると自動的に終了します。/IN パラメータと /CMD パラメータは同時に指定することはできません。vpncmd プログラムの終了コードは、最後に実行したコマンドのエラーコード (成功した場合は 0) となります。\nWindows 環境では、管理者権限で 1 度以上 vpncmd を起動すると、次回から Windows のコマンドプロンプトや [ファイル名を指定して実行] を開いて vpncmd と入力するだけで vpncmd を起動することができるようになります。UNIX システムで同様のことを実現するためには、PATH 環境変数を手動で適切に設定することができます。 -CMD_VPNCMD_ARGS vpncmd [host:port] [/CLIENT|/SERVER|/TOOLS] [/HUB:hub] [/ADMINHUB:adminhub] [/PASSWORD:password] [/IN:infile] [/OUT:outfile] [/CMD commands...] -CMD_VPNCMD_[host:port] [ホスト名:ポート番号] の形式のパラメータを指定すると、そのホストに自動的に接続します。指定しない場合は、接続先を入力するプロンプトが表示されます。VPN Client に接続する場合は、ポート番号は指定できません。 -CMD_VPNCMD_CLIENT VPN Client に接続して管理を行います。/SERVER と共に指定することはできません。 -CMD_VPNCMD_SERVER VPN Server または VPN Bridge に接続して管理を行います。/CLIENT と共に指定することはできません。 -CMD_VPNCMD_TOOLS VPN Tools のコマンドを使用できるプロンプトを表示します。これには、証明書簡易作成ツール (MakeCert コマンド) および通信速度測定ツール (SpeedTest コマンド) などが含まれます。 -CMD_VPNCMD_HUB VPN Server に「仮想 HUB 管理モード」で接続する際の仮想 HUB 名 'hub' を指定します。ホスト名を指定して /HUB パラメータを指定しない場合は、「サーバー管理モード」で接続します。 -CMD_VPNCMD_ADMINHUB VPN Server に接続した後に自動的に選択する仮想 HUB 名 'adminhub' を指定します。/HUB パラメータを指定した場合は、その仮想 HUB が自動的に選択されますので、指定する必要はありません。 -CMD_VPNCMD_PASSWORD 接続する際に管理パスワードが必要な場合は、パスワード 'password' を指定します。パスワードが指定されていない場合は、入力するプロンプトが表示されます。 -CMD_VPNCMD_IN 接続が完了した後に自動的に実行するコマンドの一覧が記載されたテキストファイル名 'infile' を指定します。/IN パラメータが指定されている場合は、ファイル内のすべての行の実行が完了した後に自動的に vpncmd プログラムは終了します。ファイルに多バイト文字が含まれている場合は、Unicode (UTF-8) でエンコードされている必要があります。/CMD と共に指定することはできません (/CMD と共に指定した場合は /IN は無視されます)。 -CMD_VPNCMD_OUT 画面に表示されるプロンプト、メッセージ、エラー、実行結果などのすべての文字列を書き出すテキストファイル名 'outfile' を指定することができます。既に存在するファイルを指定した場合、ファイルの内容は上書きされますのでご注意ください。多バイト文字は、Unicode (UTF-8) でエンコードされて記録されます。 -CMD_VPNCMD_CMD /CMD の後に任意のコマンド 'commands...' を記述すると、接続が完了した後にそのコマンドが実行され、その後 vpncmd プログラムは終了します。/IN と共に指定することはできません (/IN と共に指定した場合は /IN は無視されます)。/CMD パラメータは他のすべての vpncmd のパラメータよりも後に指定してください。 -CMD_VPNCMD_CSV 各コマンドが結果を CSV 形式で出力するようにします。他のプログラムによって出力結果を自動処理する際に便利です。 -CMD_VPNCMD_CS_1 vpncmd プログラムを使って以下のことができます。\n\n1. VPN Server または VPN Bridge の管理\n2. VPN Client の管理\n3. VPN Tools コマンドの使用 (証明書作成や通信速度測定)\n\n -CMD_VPNCMD_CS_2 1 - 3 を選択: -CMD_VPNCMD_HOST_1 接続先の VPN Server または VPN Bridge が動作しているコンピュータの IP アドレスまたはホスト名を指定してください。\n'ホスト名:ポート番号' の形式で指定すると、ポート番号も指定できます。\n(ポート番号を指定しない場合は 443 が使用されます。)\n何も入力せずに Enter を押すと、localhost (このコンピュータ) のポート 443 に接続します。 -CMD_VPNCMD_HOST_2 接続先の VPN Client が動作しているコンピュータの IP アドレスまたはホスト名を指定してください。\n何も入力せずに Enter を押すと、localhost (このコンピュータ) に接続します。 -CMD_VPNCMD_HOST_3 接続先のホスト名または IP アドレス: -CMD_VPNCMD_HUB_1 サーバーに仮想 HUB 管理モードで接続する場合は、仮想 HUB 名を入力してください。\nサーバー管理モードで接続する場合は、何も入力せずに Enter を押してください。 -CMD_VPNCMD_HUB_2 接続先の仮想 HUB 名を入力: -CMD_VPNCMD_ABOUT SoftEther VPN コマンドライン管理ユーティリティ (vpncmd コマンド)\nDeveloper Edition\n%S\n%S\nCopyright (c) all contributors on SoftEther VPN project in GitHub.\nCopyright (c) Daiyuu Nobori, SoftEther Project at University of Tsukuba, and SoftEther Corporation.\nAll rights reserved.\n -CMD_VPNCMD_PASSWORD_1 アクセスが拒否されました。パスワードが間違っているか、接続する管理モードが正しくない可能性があります。パスワードをもう一度入力することができます。キャンセルする場合は、Ctrl + D を押してください。 -CMD_VPNCMD_PASSWORD_2 パスワード: -CMD_VPNCMD_ERROR エラーが発生しました。(エラーコード: %u)\n%s -CMD_VPNCMD_SERVER_CONNECTED VPN Server "%S" (ポート %u) に接続しました。 -CMD_VPNCMD_SERVER_CONNECTED_1 VPN Server 全体の管理権限があります。 -CMD_VPNCMD_SERVER_CONNECTED_2 VPN Server 内の仮想 HUB '%S' に対する管理権限があります。 -CMD_VPNCMD_CLIENT_NO_REMODE 接続先の VPN Client サービスはリモートコンピュータからの管理接続を許可していません。VPN Client が動作しているコンピュータ上でコマンドライン管理ユーティリティまたは VPN クライアント接続マネージャを起動し、localhost に対して接続してください。 -CMD_VPNCMD_PWPROMPT_0 パスワードを入力してください。キャンセルするには Ctrl+D キーを押してください。 -CMD_VPNCMD_PWPROMPT_1 パスワード: -CMD_VPNCMD_PWPROMPT_2 確認入力 : -CMD_VPNCMD_PWPROMPT_3 入力されたパスワードと確認入力が異なります。もう一度入力してください。 -CMD_VPNCMD_CLIENT_CONNECTED VPN Client "%S" に接続しました。 -CMD_VPNCMD_TOOLS_CONNECTED VPN Tools を起動しました。HELP と入力すると、使用できるコマンド一覧が表示できます。 - - -###################################################### -# # -# ここから下は VPN Server 用の管理コマンド # -# # -###################################################### - - - -# About コマンド -CMD_About バージョン情報の表示 -CMD_About_HELP このコマンドライン管理ユーティリティのバージョン情報を表示します。バージョン情報には、vpncmd のバージョン番号、ビルド番号、ビルド情報などが含まれます。 -CMD_About_ARGS About - - -# ServerInfoGet コマンド -CMD_ServerInfoGet サーバー情報の取得 -CMD_ServerInfoGet_Help 現在接続している VPN Server または VPN Bridge のサーバー情報を取得します。サーバーの情報には、バージョン番号、ビルド番号、ビルド情報などが含まれます。また、現在のサーバーの動作モードや動作しているオペレーティングシステムの情報なども取得できます。 -CMD_ServerInfoGet_Args ServerInfoGet - - -# ServerStatusGet コマンド -CMD_ServerStatusGet サーバーの現在の状態の取得 -CMD_ServerStatusGet_Help 現在接続している VPN Server または VPN Bridge の現在の状態をリアルタイムに取得します。サーバー上に存在する各種オブジェクトの個数や、データ通信の統計情報などを取得できます。また、OS によっては現在コンピュータで使用されているメモリ量などを取得することもできます。 -CMD_ServerStatusGet_Args ServerStatusGet - - -# ListenerCreate コマンド -CMD_ListenerCreate TCP リスナーの追加 -CMD_ListenerCreate_Help サーバーに新しい TCP リスナーを追加します。TCP リスナーを追加すると、サーバーは指定した TCP/IP ポート番号でクライアントからの接続の待機を開始します。\n一度追加した TCP リスナーは、ListenerDelete コマンドで削除することができます。\nなお、現在の登録されている TCP リスナーの一覧は、ListenerList コマンドで取得することができます。\nこのコマンドを実行するには、VPN Server の管理者権限が必要です。 -CMD_ListenerCreate_Args ListenerCreate [port] -CMD_ListenerCreate_[port] 新しく追加する TCP/IP リスナーのポート番号を整数で指定します。すでに別のプログラムが使用しているポート番号を使用することもできますが、そのプログラムがポートの使用を終了するまで、VPN Server はそのポートを使用できません。ポート番号は 1 以上 65535 以下で指定してください。 -CMD_ListenerCreate_PortPrompt 新しく追加する TCP/IP リスナーのポート番号: - - -# ListenerDelete コマンド -CMD_ListenerDelete TCP リスナーの削除 -CMD_ListenerDelete_Help サーバーに登録されている TCP リスナーを削除します。TCP リスナーが動作状態にある場合は、自動的に動作を停止してからリスナーが削除されます。\nなお、現在の登録されている TCP リスナーの一覧は、ListenerList コマンドで取得することができます。\nこのコマンドを実行するには、VPN Server の管理者権限が必要です。 -CMD_ListenerDelete_Args ListenerDelete [port] -CMD_ListenerDelete_[port] 削除したい TCP/IP リスナーのポート番号を、整数で指定します。 -CMD_ListenerDelete_PortPrompt 削除する TCP/IP リスナーのポート番号: - - -# ListenerList コマンド -CMD_ListenerList TCP リスナー一覧の取得 -CMD_ListenerList_Help 現在サーバーに登録されている TCP リスナーの一覧を取得します。各 TCP リスナーが動作中、またはエラー状態であるかどうかの情報も取得します。\nこのコマンドを実行するには、VPN Server の管理者権限が必要です。 -CMD_ListenerList_Args ListenerList -CMD_ListenerList_Column1 TCP ポート番号 -CMD_ListenerList_Column2 状態 - - -# ListenerEnable コマンド -CMD_ListenerEnable TCP リスナーの動作開始 -CMD_ListenerEnable_Help 現在サーバーに登録されている TCP リスナーが停止している場合は、その動作を開始します。\nなお、現在の登録されている TCP リスナーの一覧は、ListenerList コマンドで取得することができます。\nこのコマンドを実行するには、VPN Server の管理者権限が必要です。 -CMD_ListenerEnable_Args ListenerEnable [port] -CMD_ListenerEnable_[port] 開始する TCP/IP リスナーのポート番号を、整数で指定します。 -CMD_ListenerEnable_PortPrompt 開始する TCP/IP リスナーのポート番号: - - -# ListenerDisable コマンド -CMD_ListenerDisable TCP リスナーの動作停止 -CMD_ListenerDisable_Help 現在サーバーに登録されている TCP リスナーが動作している場合は、その動作を停止します。\nなお、現在の登録されている TCP リスナーの一覧は、ListenerList コマンドで取得することができます。\nこのコマンドを実行するには、VPN Server の管理者権限が必要です。 -CMD_ListenerDisable_Args ListenerDisable [port] -CMD_ListenerDisable_[port] 停止する TCP/IP リスナーのポート番号を、整数で指定します。 -CMD_ListenerDisable_PortPrompt 開始する TCP/IP リスナーのポート番号: - - -# PortsUDPSet command -CMD_PortsUDPSet サーバーが着信を受付ける UDP ポート番号の一覧を設定します。 -CMD_PortsUDPSet_Help このコマンドを使用すると、このサーバーが着信を受付ける単一または複数の UDP ポートの一覧を設定することができます。\n他のプロセスによって使用されている UDP ポートを設定することも可能ですが、そのポートが解放されるまでは機能しません。\nポート番号は、1 から 65535 の間で指定します。\n現在設定されているポートの一覧は、PortsUDPGet コマンドを使用して確認することができます。\nこのコマンドを実行するには、VPN Server の管理者権限が必要です。 -CMD_PortsUDPSet_Args PortsUDPSet [ports] -CMD_PortsUDPSet_[ports] 複数のポート番号を指定する場合は、スペース文字またはカンマ文字で区切ってください。例: "443, 992, 1194, 5555". \n"0" を指定すると、UDP リスナーを無効化することができます。\n\nポート一覧: - - -# PortsUDPGet command -CMD_PortsUDPGet サーバーにおける着信 UDP ポートの一覧を表示します。 -CMD_PortsUDPGet_Help このコマンドを使用すると、サーバーで待受け状態になっている UDP ポートの一覧を表示することができます。\nポートの設定を変更するには、PortsUDPSet コマンドを使用してください。 -CMD_PortsUDPGet_Args PortsUDPGet -CMD_PortsUDPGet_Ports UDP ポート一覧 - - -# ProtoOptionsSet コマンド -CMD_ProtoOptionsSet 特定のプロトコル固有のオプション値を設定します。 -CMD_ProtoOptionsSet_Help このコマンドを使用することにより、特定のプロトコル固有のオプション値を設定することができます。 \nProtoOptionsGet コマンドを使用することにより、オプション値を取得することもできます。 \nこのコマンドを実行するには、VPN Server の管理者権限が必要です。 -CMD_ProtoOptionsSet_Args ProtoOptionsSet [protocol] [/NAME:option_name] [/VALUE:string/true/false] -CMD_ProtoOptionsSet_[protocol] プロトコル名 -CMD_ProtoOptionsSet_NAME オプション名 -CMD_ProtoOptionsSet_VALUE オプション値 (対象のプロトコルで対応している値を指定してください) -CMD_ProtoOptionsSet_Prompt_[protocol] プロトコル: -CMD_ProtoOptionsSet_Prompt_NAME オプション: -CMD_ProtoOptionsSet_Prompt_VALUE 値: - - -# ProtoOptionsGet コマンド -CMD_ProtoOptionsGet 指定されたプロトコル固有のオプション値を表示します。 -CMD_ProtoOptionsGet_Help このコマンドを使用することにより、特定のプロトコル固有のオプション値を取得することができます。 \n詳細な情報 (例: 値の型) が表示されます。オプション値を設定するには、ProtoOptionsSet コマンドを使用してください。 -CMD_ProtoOptionsGet_Args ProtoOptionsGet [protocol] -CMD_ProtoOptionsGet_[protocol] プロトコル名 -CMD_ProtoOptionsGet_Prompt_[protocol] プロトコル: -CMD_ProtoOptionsGet_Column_Name 名前 -CMD_ProtoOptionsGet_Column_Type 型 -CMD_ProtoOptionsGet_Column_Value 値 -CMD_ProtoOptionsGet_Column_Description 説明 - - -# ProtoOptions -CMD_ProtoOptions_Description_OpenVPN_DefaultClientOption OpenVPN の OCC codeRT 版以外の場合は、OpenVPN はサーバーに対してオプション文字列を送信しません。OpenVPN サーバーのオリジナル版は、オプションを固定で指定する仕組みになっているため、その場合でも動作します。一方、SoftEther VPN は、様々なオプションを動的に設定することができる機能を有しております。そこで、このオプションを使用することにより、OCC code なしでビルドされた OpenVPN に対してデフォルトの静的オプション文字列を送付することができるようになります。これにより、OCC code なしでビルドされた OpenVPN からの接続が成功するようになります。 -CMD_ProtoOptions_Description_OpenVPN_Obfuscation OpenVPN クライアントが検閲用ファイアウォールを回避するための難読化コードを設定します。クライアント側とサーバー側では、同一の XOR マスクを設定する必要があります。コードが異なると、接続ができません。 -CMD_ProtoOptions_Description_OpenVPN_ObfuscationMask パケットで使用される XOR マスクを指定します。OpenVPN クライアントが検閲用ファイアウォールを回避するための難読化コードとして使用されます。 -CMD_ProtoOptions_Description_OpenVPN_PushDummyIPv4AddressOnL2Mode Linux における特定の状況下では manifests に不具合があります。この不具合により、OpenVPN クライアントは TAP デバイスが UP 状態であるにもかかわらず、切断状態となります。このオプションを使用することにより、VPN サーバーは、ダミーの IPv4 アドレス (RFC7600 で規定) をクライアントに対してプッシュ送信することができるようになります。これにより、TAP アダプタが常に UP 状態になります。 - - -# ServerPasswordSet コマンド -CMD_ServerPasswordSet VPN Server の管理者パスワードの設定 -CMD_ServerPasswordSet_Help VPN Server の管理者パスワードを設定します。パラメータとしてパスワードを指定することができます。パラメータを指定しない場合は、パスワードと、その確認入力を行なうためのプロンプトが表示されます。パスワードをパラメータに与えた場合、そのパスワードが一時的に画面に表示されるため危険です。できる限り、パラメータを指定せずに、パスワードプロンプトを用いてパスワードを入力することを推奨します。\nこのコマンドを実行するには、VPN Server の管理者権限が必要です。 -CMD_ServerPasswordSet_Args ServerPasswordSet [password] -CMD_ServerPasswordSet_[password] 新しく設定するパスワードを指定します。 - - -# ClusterSettingGet コマンド -CMD_ClusterSettingGet 現在の VPN Server のクラスタリング構成の取得 -CMD_ClusterSettingGet_Help 現在の VPN Server のクラスタリング構成を取得します。\nこのコマンドを実行するには、VPN Server の管理者権限が必要です。 -CMD_ClusterSettingGet_Args ClusterSettingGet -CMD_ClusterSettingGet_Current 現在の構成 -CMD_ClusterSettingGet_None (設定無し) -CMD_ClusterSettingGet_PublicIp 公開 IP アドレス -CMD_ClusterSettingGet_PublicPorts 公開ポート一覧 -CMD_ClusterSettingGet_Controller 接続先コントローラ -CMD_ClusterSettingGet_ControllerOnly コントローラ機能のみ -CMD_ClusterSettingGet_Weight クラスタ内での性能基準値 - - -# ClusterSettingStandalone コマンド -CMD_ClusterSettingStandalone VPN Server の種類をスタンドアロンに設定 -CMD_ClusterSettingStandalone_Help VPN Server の種類を、「スタンドアロンサーバー」に設定します。スタンドアロンサーバーとは、いずれのクラスタにも属していない状態の VPN Server を意味します。VPN Server をインストールした状態ではデフォルトでスタンドアロンサーバーモードになります。特にクラスタを構成する予定がない場合は、スタンドアロンサーバーモードで動作させることを推奨します。\nこのコマンドを実行するには、VPN Server の管理者権限が必要です。\nまた、このコマンドを実行すると、VPN Server は自動的に再起動します。\nこのコマンドは、VPN Bridge では実行できません。 -CMD_ClusterSettingStandalone_Args ClusterSettingStandalone - - -# ClusterSettingController コマンド -CMD_ClusterSettingController VPN Server の種類をクラスタコントローラに設定 -CMD_ClusterSettingController_Help VPN Server の種類を、「クラスタコントローラ」に設定します。クラスタコントローラとは、複数台の VPN Server でクラスタリングを構築する場合における、各クラスタメンバサーバーの中心となるコンピュータで、クラスタ内に 1 台必要です。同一クラスタを構成する他のクラスタメンバサーバーは、クラスタコントローラに接続することによりクラスタメンバとしての動作を開始します。\nこのコマンドを実行するには、VPN Server の管理者権限が必要です。\nまた、このコマンドを実行すると、VPN Server は自動的に再起動します。\nこのコマンドは、VPN Bridge では実行できません。 -CMD_ClusterSettingController_Args ClusterSettingController [/WEIGHT:weight] [/ONLY:yes|no] -CMD_ClusterSettingController_WEIGHT この VPN Server の性能基準比の値を設定します。クラスタ内でロードバランシングを行う際に基準となる値です。通常は 100 です。たとえば、他のメンバが 100 の状態で、1 台だけ 200 にすると、他のメンバの 2 倍接続を受け持つようにロードバランシング時に調整されます。値は 1 以上で指定します。このパラメータを指定しない場合は、100 が使用されます。 -CMD_ClusterSettingController_ONLY "yes" を指定すると、VPN Server がクラスタ内でコントローラとしての機能のみを動作させ、一般の VPN Client の接続は、自分自身以外のメンバに必ず振り分けるようになります。この機能は、負荷が高い環境で使用します。このパラメータを指定しない場合は、"no" が使用されます。 - - -# ClusterSettingMember コマンド -CMD_ClusterSettingMember VPN Server の種類をクラスタメンバに設定 -CMD_ClusterSettingMember_Help VPN Server の種類を、「クラスタメンバサーバー」に設定します。クラスタメンバサーバーとは、複数台の VPN Server でクラスタリングを構築する場合における、特定の既存のクラスタコントローラが中心となって構成されるクラスタに属する他のメンバコンピュータで、クラスタに必要なだけ複数追加することができます。\nクラスタメンバサーバーとして VPN Server を設定するには、事前に参加する予定のクラスタのコントローラの管理者に、コントローラの IP アドレスとポート番号、この VPN Server の公開 IP アドレスおよび公開ポート番号 (必要な場合)、およびパスワードを問い合わせる必要があります。\nこのコマンドを実行するには、VPN Server の管理者権限が必要です。\nまた、このコマンドを実行すると、VPN Server は自動的に再起動します。\nこのコマンドは、VPN Bridge では実行できません。 -CMD_ClusterSettingMember_Args ClusterSettingMember [server:port] [/IP:ip] [/PORTS:ports] [/PASSWORD:password] [/WEIGHT:weight] -CMD_ClusterSettingMember_[server:port] [ホスト名:ポート番号] の形式のパラメータで、接続先のクラスタコントローラのホスト名、または IP アドレス、およびポート番号を指定します。 -CMD_ClusterSettingMember_IP このサーバーの公開 IP アドレスを指定します。公開 IP アドレスを指定しない場合、"/IP:none" のように指定してください。公開 IP アドレスを指定しなければ、クラスタコントローラへの接続の際に使用されるネットワークインターフェイスの IP アドレスが自動的に使われます。 -CMD_ClusterSettingMember_PORTS このサーバーの公開ポート番号の一覧を指定します。公開ポート番号は、少なくとも 1 つ以上設定する必要があり、複数個設定することも可能です。その場合は、"/PORTS:443,992,8888" のようにカンマ記号で区切ってください。 -CMD_ClusterSettingMember_PASSWORD 接続先のコントローラに接続するためのパスワードを指定します。接続先のコントローラの管理パスワードと同一です。 -CMD_ClusterSettingMember_WEIGHT この VPN Server の性能基準比の値を設定します。クラスタ内で、ロードバランシングを行う際の基準となる値です。たとえば、他のメンバが 100 の状態で、1 台だけ 200 にすると、他のメンバの 2 倍の接続を受け持つように調整されます。値は 1 以上で指定します。このパラメータを指定しない場合は、100 が使用されます。 -CMD_ClusterSettingMember_Prompt_IP_1 公開 IP アドレスを指定してください。\n指定しない場合は、何も入力せずに Enter を押してください。 -CMD_ClusterSettingMember_Prompt_IP_2 公開 IP アドレス: -CMD_ClusterSettingMember_Prompt_PORT_1 公開ポート番号の一覧を指定してください。\n2 個以上のポート番号を指定する場合は、443,992,8888 のようにカンマ記号で区切ってください。 -CMD_ClusterSettingMember_Prompt_PORT_2 公開ポート番号: -CMD_ClusterSettingMember_Prompt_HOST_1 接続先コントローラのホスト名とポート番号: - - -# ClusterMemberList コマンド -CMD_ClusterMemberList クラスタメンバの一覧の取得 -CMD_ClusterMemberList_Help VPN Server がクラスタコントローラとして動作している場合、そのクラスタ内のクラスタメンバサーバーの一覧を、クラスタコントローラ自身を含めて取得します。\n各メンバ毎に、[種類]、[接続時刻]、[ホスト名]、[ポイント]、[セッション数]、[TCP コネクション数]、[動作仮想 HUB 数]、[消費クライアント接続ライセンス]、[消費ブリッジ接続ライセンス] の一覧も取得します。\nこのコマンドは、VPN Bridge では実行できません。 -CMD_ClusterMemberList_Args ClusterMemberList - - -# ClusterMemberInfoGet コマンド -CMD_ClusterMemberInfoGet クラスタメンバの情報の取得 -CMD_ClusterMemberInfoGet_Help VPN Server がクラスタコントローラとして動作している場合、そのクラスタ内のクラスタメンバサーバーの ID を指定して、そのメンバサーバーの情報を取得することができます。\n指定されたクラスタメンバサーバーの [サーバーの種類]、[接続確立時刻]、[IP アドレス]、[ホスト名]、[ポイント]、[公開ポートの一覧]、[動作している仮想 HUB 数]、[1 個目の仮想 HUB]、[セッション数]、[TCP コネクション数] が取得できます。\nこのコマンドは、VPN Bridge では実行できません。 -CMD_ClusterMemberInfoGet_Args ClusterMemberInfoGet [id] -CMD_ClusterMemberInfoGet_[id] 情報を取得するクラスタメンバの ID を指定します。クラスタメンバサーバーの ID は、ClusterMemberList コマンドで取得することができます。 -CMD_ClusterMemberInfoGet_PROMPT_ID 情報を取得するクラスタメンバの ID: - - -# ClusterMemberCertGet コマンド -CMD_ClusterMemberCertGet クラスタメンバの証明書の取得 -CMD_ClusterMemberCertGet_Help VPN Server がクラスタコントローラとして動作している場合、そのクラスタ内のクラスタメンバサーバーの ID を指定して、そのメンバサーバーの公開している X.509 証明書を取得することができます。証明書は、X.509 形式のファイルに保存することができます。\nこのコマンドは、VPN Bridge では実行できません。 -CMD_ClusterMemberCertGet_Args ClusterMemberCertGet [id] [/SAVECERT:cert] -CMD_ClusterMemberCertGet_[id] 証明書を取得するクラスタメンバの ID を指定します。クラスタメンバサーバーの ID は、ClusterMemberList コマンドで取得することができます。 -CMD_ClusterMemberCertGet_SAVECERT 取得した証明書を保存するファイルのパス名を指定します。証明書は X.509 形式で保存されます。 -CMD_ClusterMemberCertGet_PROMPT_ID 証明書を取得するクラスタメンバの ID: - -# ClusterConnectionStatusGet コマンド -CMD_ClusterConnectionStatusGet クラスタコントローラへの接続状態の取得 -CMD_ClusterConnectionStatusGet_Help VPN Server がクラスタメンバサーバーとして動作している場合、クラスタコントローラへの接続状態を取得します。\n取得できる情報には、[コントローラの IP アドレス]、[ポート番号]、[接続状態]、[接続開始時刻]、[最初の接続確立成功時刻]、[現在の接続成功確立時刻]、[接続試行回数]、[接続に成功した回数]、[接続に失敗した回数] があります。\nこのコマンドは、VPN Bridge では実行できません。 -CMD_ClusterConnectionStatusGet_Args ClusterConnectionStatusGet - - -# Debug コマンド -CMD_Debug デバッグコマンドの実行 -CMD_Debug_Help VPN Server / Bridge の実行中のプロセスでデバッグコマンドを実行します。\nこのコマンドは、ソフトイーサ株式会社からのサポートの指示があった場合のみ使用してください。\nむやみにこのコマンドを使用すると、動作中の VPN Server / Bridge が停止する原因になります。 -CMD_Debug_Args Debug [id] [/ARG:arg] -CMD_Debug_[id] デバッグコマンド番号を整数で指定します。 -CMD_Debug_ARG デバッグコマンドに渡す文字列を指定します。スペースを含む場合は、" " で囲んでください。 -CMD_Debug_Msg1 デバッグコマンドを送信中... -CMD_Debug_Msg2 デバッグコマンドの動作が完了しました。\n戻り値: \"%S\" - -# Crash コマンド -CMD_Crash VPN Server / Bridge プロセスでエラーを発生させプロセスを強制終了する -CMD_Crash_Help VPN Server / Bridge の実行中のプロセスで致命的なエラー (メモリ保護違反など) を発生させ、プロセスをクラッシュさせます。その結果、VPN Server / Bridge がサービスモードで起動している場合は、自動的にプロセスが再起動します。VPN Server がユーザーモードで起動している場合は、プロセスは自動的に再起動しません。\nこのコマンドは、VPN Server / Bridge で何らかの回復不能なエラーが発生したり、プロセスが暴走したりしているときに、すぐにプロセスを再起動しなければならないような場合に利用してください。このコマンドを実行すると、現在 VPN Server / Bridge に接続されているすべての VPN セッションは切断されます。また、VPN Server がメモリ内に保有している未保存のデータはすべて失われます。\nこのコマンドを実行する前に、Flush コマンドを実行してVPN Server / Bridge の未保存の設定データを設定ファイルに強制保存することをお勧めします。\nこのコマンドは、VPN Server / Bridge 全体の管理者のみが実行できます。 -CMD_Crash_Args Crash [yes] -CMD_Crash_[yes] 確認のため、"yes" と指定してください。 -CMD_Crash_Msg VPN Server にクラッシュ コマンドを送信しています。VPN Server は直ちにクラッシュするため、コマンドが成功したかどうかの戻り値は取得できません。このコマンドを実行した後は、vpncmd は VPN Server との間の接続を切断されます。 -CMD_Crash_Confirm 本当に VPN Server をクラッシュさせますか?\nよろしい場合は "yes" と入力してください: -CMD_Crash_Aborted Crash コマンドは中止されました。 - - -# Flush コマンド -CMD_Flush VPN Server / Bridge の未保存の設定データを設定ファイルに強制保存する -CMD_Flush_Help 通常、VPN Server / Bridge は設定内容をメモリ内に保持し、vpn_server.config または vpn_bridge.config ファイルに定期的に保存します。これらの設定ファイルへの保存処理は、通常、300 秒 (5 分) ごとに自動的に行われます (この間隔は、設定ファイルの AutoSaveConfigSpan 項目を編集することで変更できます)。なお、VPN Server / Bridge サービスが正常終了しようとする際にもこれらの設定ファイルは自動的に保存されます。\nFlush コマンドを実行すると、VPN Server / Bridge は、すぐに設定ファイルへの保存処理を実施します。これにより、現在の最新の設定データが必ずサーバーコンピュータのディスクドライブにフラッシュされます。たとえば、やむを得ずサービスプロセスを正常終了する時間的余裕がない場合は、Flush コマンドを用いてデータを強制保存してから、サービスプロセスやサーバーコンピュータを強制シャットダウンしてください。\nこのコマンドは、VPN Server / Bridge 全体の管理者のみが実行できます。 -CMD_Flush_Args Flush -CMD_Flush_Msg1 メモリ上の設定データをディスクに書き込んでいます...\n -CMD_Flush_Msg2 書き込みに成功しました。ファイルサイズは %S bytes です。\n - - -# ServerCertGet コマンド -CMD_ServerCertGet VPN Server の SSL 証明書の取得 -CMD_ServerCertGet_Help VPN Server が、接続したクライアントに対して提示する SSL 証明書を取得します。証明書は、X.509 形式のファイルに保存することができます。 -CMD_ServerCertGet_Args ServerCertGet [cert] -CMD_ServerCertGet_[cert] 取得した証明書を保存するファイルのパス名を指定します。証明書は X.509 形式で保存されます。 - - -# ServerKeyGet コマンド -CMD_ServerKeyGet VPN Server の SSL 証明書の秘密鍵の取得 -CMD_ServerKeyGet_Help VPN Server が接続したクライアントに対して提示する SSL 証明書の秘密鍵を取得します。秘密鍵は、Base 64 でエンコードされたファイルに保存することができます。\nこのコマンドを実行するには、VPN Server の管理者権限が必要です。 -CMD_ServerKeyGet_Args ServerKeyGet [key] -CMD_ServerKeyGet_[key] 取得した秘密鍵を保存するファイルのパス名を指定します。秘密鍵は Base 64 エンコードされて保存されます。 - - -# ServerCertSet コマンド -CMD_ServerCertSet VPN Server の SSL 証明書と秘密鍵の設定 -CMD_ServerCertSet_Help VPN Server が接続したクライアントに対して提示する SSL 証明書と、その証明書に対応する秘密鍵を設定します。証明書は X.509 形式、秘密鍵は Base 64 エンコードされた形式である必要があります。\nこのコマンドを実行するには、VPN Server の管理者権限が必要です。 -CMD_ServerCertSet_Args ServerCertSet [/LOADCERT:cert] [/LOADKEY:key] -CMD_ServerCertSet_LOADCERT 使用する X.509 形式の証明書ファイルを指定します。 -CMD_ServerCertSet_LOADKEY 使用する Base 64 エンコードされた、証明書に対応する秘密鍵ファイルを指定します。 - - -# ServerCipherGet コマンド -CMD_ServerCipherGet VPN 通信で使用される暗号化アルゴリズムの取得 -CMD_ServerCipherGet_Help VPN Server と、接続したクライアントとの間で通信に使用する SSL コネクションにおける暗号化、および電子署名に用いられるアルゴリズムの現在の設定と、VPN Server 上で使用可能なアルゴリズムの一覧を取得します。 -CMD_ServerCipherGet_Args ServerCipherGet -CMD_ServerCipherGet_SERVER VPN Server で現在使用されている暗号化アルゴリズム: -CMD_ServerCipherGet_CIPHERS 使用可能な暗号化アルゴリズム名の一覧: - -# ServerCipherSet コマンド -CMD_ServerCipherSet VPN 通信で使用される暗号化アルゴリズムの設定 -CMD_ServerCipherSet_Help VPN Server と、接続したクライアントとの間で通信に使用する SSL コネクションにおける暗号化、および電子署名に用いられるアルゴリズムを設定します。\nアルゴリズム名を指定すると、以後この VPN Server に接続した VPN Client や、VPN Bridge との間で、指定したアルゴリズムが使用され、データが暗号化されます。\nこのコマンドを実行するには、VPN Server の管理者権限が必要です。 -CMD_ServerCipherSet_Args ServerCipherSet [name] -CMD_ServerCipherSet_[name] 設定するる暗号化および電子署名アルゴリズムを指定します。使用可能なアルゴリズムの一覧は、ServerCipherGet コマンドで取得することができます。 -CMD_ServerCipherSet_PROMPT_NAME 指定する暗号化アルゴリズム名: - -# KeepEnable コマンド -CMD_KeepEnable インターネット接続の維持機能の有効化 -CMD_KeepEnable_Help [インターネット接続の維持機能] を有効にします。[インターネット接続の維持機能] を使用すると、一定期間無通信状態が続くと、自動的に接続が切断されるようなネットワーク接続環境の場合、インターネット上の任意のサーバーに対して一定間隔ごとにパケットを送信することにより、インターネット接続を維持することができます。\n接続先のホスト名などについては、KeepSet コマンドで設定することができます。\nVPN Server または VPN Bridge で、このコマンドを実行するには、管理者権限が必要です。 -CMD_KeepEnable_Args KeepEnable - - -# KeepDisable コマンド -CMD_KeepDisable インターネット接続の維持機能の無効化 -CMD_KeepDisable_Help [インターネット接続の維持機能] を無効にします。\nVPN Server または VPN Bridge で、このコマンドを実行するには、管理者権限が必要です。 -CMD_KeepDisable_Args KeepDisable - - -# KeepSet コマンド -CMD_KeepSet インターネット接続の維持機能の設定 -CMD_KeepSet_Help [インターネット接続の維持機能] の接続先ホスト名などの設定を行ないます。一定期間無通信状態が続くと自動的に接続が切断されるようなネットワーク接続環境で、[インターネット接続の維持機能] を使用すると、インターネット上の任意のサーバーに対して、一定間隔ごとにパケットを送信することにより、インターネット接続を維持することができます。\nこのコマンドでは、通信先の [ホスト名]、[ポート番号]、[パケット送出間隔]、および [プロトコル] を指定することができます。\nインターネット接続維持のために送信されるパケットは、ランダムな内容であり、コンピュータやユーザーを識別する個人情報などが送信されることはありません。\nインターネット接続の維持機能は、KeepEnable コマンド、または KeepDisable コマンドを用いて、有効化 / 無効化することができます。KeepSet は有効 / 無効の状態を変更しません。\nVPN Server または VPN Bridge で、このコマンドを実行するには、管理者権限が必要です。 -CMD_KeepSet_Args KeepSet [/HOST:host:port] [/PROTOCOL:tcp|udp] [/INTERVAL:interval] -CMD_KeepSet_HOST [ホスト名:ポート番号] の形式で、通信先のホスト名、または IP アドレスとポート番号を指定します。 -CMD_KeepSet_PROTOCOL tcp または udp を指定します。 -CMD_KeepSet_INTERVAL パケットを送出する間隔を秒単位で指定します。 -CMD_KeepSet_PROMPT_HOST 通信先のホスト名または IP アドレスとポート番号: -CMD_KeepSet_PROMPT_PROTOCOL tcp または udp: -CMD_KeepSet_PROMPT_INTERVAL パケットを送出する間隔 (秒単位): -CMD_KeepSet_EVAL_TCP_UDP "tcp" または "udp" を指定してください。 - -# KeepGet コマンド -CMD_KeepGet インターネット接続の維持機能の取得 -CMD_KeepGet_Help [インターネット接続の維持機能] の、現在の設定内容を取得します。通信先の [ホスト名]、[ポート番号]、[パケット送出間隔]、および [プロトコル] に加えて、現在の [インターネット接続の維持機能] の有効状態が取得できます。 -CMD_KeepGet_Args KeepGet -CMD_KeepGet_COLUMN_1 ホスト名 -CMD_KeepGet_COLUMN_2 ポート番号 -CMD_KeepGet_COLUMN_3 パケット送出間隔 (秒) -CMD_KeepGet_COLUMN_4 プロトコル -CMD_KeepGet_COLUMN_5 現在の状態 - - -# SyslogEnable コマンド -CMD_SyslogEnable syslog 送信機能の設定 -CMD_SyslogEnable_Help syslog 送信機能の使用方法と使用する syslog サーバーを設定します。 -CMD_SyslogEnable_Args SyslogEnable [1|2|3] [/HOST:host:port] -CMD_SyslogEnable_[1|2|3] syslog 送信機能使用設定を 1 ~ 3 のいずれかの整数で指定します。\n1: サーバーログを syslog で送信。\n2: サーバーおよび仮想 HUB セキュリティログを syslog で送信。\n3: サーバー、仮想 HUB セキュリティおよびパケットログを syslog で送信。 -CMD_SyslogEnable_HOST [ホスト名:ポート番号] の形式で、syslog サーバーのホスト名、または IP アドレスとポート番号を指定します。ポート番号を省略すると 514 を使用します。 -CMD_SyslogEnable_MINMAX syslog 送信機能使用設定は 1 ~ 3 のいずれかの整数を指定してください。 -CMD_SyslogEnable_Prompt_123 syslog 送信機能使用設定 (1 ~ 3): -CMD_SyslogEnable_Prompt_HOST syslog サーバーの指定: - - -# SyslogDisable コマンド -CMD_SyslogDisable syslog 送信機能の無効化 -CMD_SyslogDisable_Help syslog 送信機能を使用しないようにします。 -CMD_SyslogDisable_Args SyslogDisable - - -# SyslogGet コマンド -CMD_SyslogGet syslog 送信機能の取得 -CMD_SyslogGet_Help syslog 送信機能の現在の設定内容を取得します。syslog 機能の使用方法の設定、および使用する syslog サーバーのホスト名とポート番号が取得できます。 -CMD_SyslogGet_Args SyslogGet -CMD_SyslogGet_COLUMN_1 syslog 送信機能使用設定 -CMD_SyslogGet_COLUMN_2 syslog サーバーホスト名 -CMD_SyslogGet_COLUMN_3 syslog サーバーポート番号 - - -# ConnectionList コマンド -CMD_ConnectionList VPN Server に接続中の TCP コネクション一覧の取得 -CMD_ConnectionList_Help 現在、VPN Server に接続中の TCP/IP コネクションの一覧を取得します。ただし、VPN セッションとして確立された TCP/IP コネクションは表示されません。VPN セッションとして確立された TCP/IP コネクションの一覧は、SessionList コマンドを用いて取得できます。\n[コネクション名]、[接続元]、[接続時刻] および [種類] を取得することができます。\nこのコマンドを実行するには、VPN Server の管理者権限が必要です。 -CMD_ConnectionList_Args ConnectionList - - -# ConnectionGet コマンド -CMD_ConnectionGet VPN Server に接続中の TCP コネクションの情報の取得 -CMD_ConnectionGet_Help VPN Server に接続中の指定された TCP/IP コネクションに関する詳細な情報を取得します。\n[コネクション名]、[コネクションの種類]、[接続元ホスト名]、[接続元 IP アドレス]、[接続元ポート番号 (TCP)]、[接続時刻]、[サーバー製品名]、[サーバー バージョン]、[サーバー ビルド番号]、[クライアント製品名]、[クライアントバージョン]、[クライアントビルド番号] が取得できます。\nこのコマンドを実行するには、VPN Server の管理者権限が必要です。 -CMD_ConnectionGet_Args ConnectionGet [name] -CMD_ConnectionGet_[name] 情報を取得するコネクション名を指定します。コネクション名の一覧は、ConnectionList コマンドで取得できます。 -CMD_ConnectionGet_PROMPT_NAME 情報を取得するコネクション名: - -# ConnectionDisconnect コマンド -CMD_ConnectionDisconnect VPN Server に接続中の TCP コネクションの切断 -CMD_ConnectionDisconnect_Help VPN Server に接続中の指定された TCP/IP コネクションを強制的に切断します。\nこのコマンドを実行するには、VPN Server の管理者権限が必要です。 -CMD_ConnectionDisconnect_Args ConnectionDisconnect [name] -CMD_ConnectionDisconnect_[name] 切断するコネクション名を指定します。コネクション名の一覧は ConnectionList コマンドで取得できます。 -CMD_ConnectionDisconnect_PROMPT_NAME 切断するコネクション名: - - -# BridgeDeviceList コマンド -CMD_BridgeDeviceList ローカルブリッジに使用できる LAN カード一覧の取得 -CMD_BridgeDeviceList_Help ローカルブリッジ接続で、ブリッジ先のデバイスとして使用できる Ethernet デバイス (LAN カード) の一覧を取得します。\nここで表示されるデバイス名は、BridgeCreate コマンドで使用することができます。\nこのコマンドを実行するには、VPN Server の管理者権限が必要です。 -CMD_BridgeDeviceList_Args BridgeDeviceList - - -# BridgeList コマンド -CMD_BridgeList ローカルブリッジ接続の一覧の取得 -CMD_BridgeList_Help 現在定義されているローカルブリッジ接続の一覧を取得します。\nローカルブリッジ接続の仮想 HUB 名と、ブリッジ先の Ethernet デバイス (LAN カード) 名、または tap デバイス名および動作状況が取得できます。 -CMD_BridgeList_Args BridgeList - - -# BridgeCreate コマンド -CMD_BridgeCreate ローカルブリッジ接続の作成 -CMD_BridgeCreate_Help 新しいローカルブリッジ接続を VPN Server 上に作成します。\nローカルブリッジを使用すると、この VPN Server 上で動作する仮想 HUB と、物理的な Ethernet デバイス (LAN カード) との間でレイヤ 2 ブリッジ接続を構成することができます。\nシステムに tap デバイス (仮想のネットワークインターフェイス) を作成し、仮想 HUB との間でブリッジ接続することもできます (tap デバイスは Linux 版のみサポートされています)。\nブリッジ先の Ethernet デバイス (LAN カード) には、稼働中の任意の LAN カードとの間でブリッジできますが、高負荷環境においてはブリッジ専用に LAN カードを用意することをお勧めします。\nこのコマンドを実行するには、VPN Server の管理者権限が必要です。 -CMD_BridgeCreate_Args BridgeCreate [hubname] [/DEVICE:device_name] [/TAP:yes|no] -CMD_BridgeCreate_[hubname] ブリッジする仮想 HUB を指定します。仮想 HUB の一覧は、HubList コマンドで取得できます。ただし、必ずしも現在動作している仮想 HUB 名を指定する必要はありません。現在動作していない、または存在しない仮想 HUB 名を指定すると、その仮想 HUB が実際に動作を開始した際にローカルブリッジ接続が有効になります。 -CMD_BridgeCreate_DEVICE ブリッジ先の Ethernet デバイス (LAN カード) 名、または tap デバイス名を指定します。Ethernet デバイス名の一覧は、BridgeDeviceList コマンドで取得することができます。 -CMD_BridgeCreate_TAP ブリッジ先として LAN カードではなく、tap デバイスを使用する場合は yes を指定します (Linux 版のみサポートされます)。省略した場合は no と見なされます。 -CMD_BridgeCreate_PROMPT_HUBNAME ブリッジする仮想 HUB 名: -CMD_BridgeCreate_PROMPT_DEVICE ブリッジ先のデバイス名: -CMD_BridgeCreate_PROMPT_TAP tap デバイスを使用しますか (yes/no): - - -# BridgeDelete コマンド -CMD_BridgeDelete ローカルブリッジ接続の削除 -CMD_BridgeDelete_Help 既存のローカルブリッジ接続を削除します。現在のローカルブリッジ接続の一覧は、BridgeDeviceList コマンドで取得できます。\nこのコマンドを実行するには、VPN Server の管理者権限が必要です。 -CMD_BridgeDelete_Args BridgeDelete [hubname] [/DEVICE:device_name] -CMD_BridgeDelete_[hubname] 削除するローカルブリッジの、仮想 HUB を指定します。 -CMD_BridgeDelete_DEVICE 削除するローカルブリッジの、デバイス名 (LAN カード名または tap デバイス名) を指定します。 -CMD_BridgeDelete_PROMPT_HUBNAME 削除するブリッジの仮想 HUB 名: -CMD_BridgeDelete_PROMPT_DEVICE 削除するブリッジのデバイス名: - - -# Caps コマンド -CMD_Caps サーバーの機能・能力一覧の取得 -CMD_Caps_Help 現在接続して管理している VPN Server の持つ機能と能力の一覧を取得します。\nVPN Server の機能や能力は、動作している VPN Server のエディションやバージョンによって異なります。コマンドライン管理ユーティリティにあるコマンドでも、接続先の VPN Server の機能や能力によっては動作しない場合があります。このコマンドは、接続先の VPN Server の能力を調査して報告します。\nVPN Server のバージョンの方がコマンドライン管理ユーティリティよりも新しく、コマンドライン管理ユーティリティが把握していない機能がある場合は、その内部文字列 (変数名) が、そのまま表示されることがあります。 -CMD_Caps_Args Caps - - -# Reboot コマンド -CMD_Reboot VPN Server サービスの再起動 -CMD_Reboot_Help VPN Server サービスを再起動します。\nVPN Server を再起動すると、現在接続しているセッションや TCP コネクションはすべて切断され、再起動が完了するまで新たな接続は受け付けなくなります。\nこのコマンドでは、VPN Server サービスプログラムのみが再起動され、VPN Server が動作している物理的なコンピュータが再起動することはありません。この管理セッションも切断されるため、管理を続行するには再接続してください。\nまた、/RESETCONFIG:yes パラメータを指定すると、現在の VPN Server が持っているコンフィグレーションファイル (.config) の内容を初期化します。\nこのコマンドを実行するには、VPN Server の管理者権限が必要です。 -CMD_Reboot_Args Reboot [/RESETCONFIG:yes|no] -CMD_Reboot_RESETCONFIG yes を指定すると、現在の VPN Server が持っているコンフィグレーションファイル (.config) の内容を初期化します。このパラメータは慎重に設定してください。 - - -# ConfigGet コマンド -CMD_ConfigGet VPN Server の現在のコンフィグレーションの取得 -CMD_ConfigGet_Help VPN Server の、現在のコンフィグレーションの内容を構造化したテキストファイル (.config ファイル) として取得します。このコマンドを実行した瞬間の VPN Server 内の状態が取得できます。\nコンフィグレーションファイルの内容は、パラメータを指定しない場合は、画面上にそのまま表示されます。パラメータで保存するファイル名を指定すると、そのファイル名で内容が保存されます。\nコンフィグレーションファイルは、通常のテキストエディタ等で編集可能です。編集したコンフィグレーションを VPN Server に書き込むには、ConfigSet コマンドを使用します。\nこのコマンドを実行するには、VPN Server の管理者権限が必要です。 -CMD_ConfigGet_Args ConfigGet [path] -CMD_ConfigGet_[path] コンフィグレーションファイルの内容をファイルに保存したい場合は、そのファイル名を指定します。何も指定しない場合は、コンフィグレーションの内容は画面に表示されます。コンフィグレーションファイルにマルチバイト文字が含まれる場合は、Unicode (UTF-8) でエンコードされて保存されます。 -CMD_ConfigGet_FILENAME Config 名: "%S", サイズ: %u -CMD_ConfigGet_FILE_SAVE_FAILED 指定されたファイルの作成に失敗しました。 - - -# ConfigSet コマンド -CMD_ConfigSet VPN Server へのコンフィグレーションの書き込み -CMD_ConfigSet_Help VPN Server にコンフィグレーションを書き込みます。このコマンドを実行すると、指定したコンフィグレーションファイルの内容が VPN Server に適用され、VPN Server プログラムは自動的に再起動され、新しいコンフィグレーションの内容に従って動作を開始します。\nコンフィグレーションファイルは、すべての内容を管理者が記述するのは困難であるため、ConfigGet コマンドで、まず現在の VPN Server のコンフィグレーションの内容を取得してファイルに保存し、その内容を通常のテキストエディタなどで編集したものを ConfigSet コマンドで VPN Server に書き戻すことを推奨します。\nこのコマンドは、VPN Server に関する詳しい知識をお持ちの方のためのコマンドであり、不正なコンフィグレーションファイルを書き込んだ場合は、エラーが発生したり現在の設定内容が失われたりする可能性がありますので、十分注意してください。\nこのコマンドを実行するには、VPN Server の管理者権限が必要です。 -CMD_ConfigSet_Args ConfigSet [path] -CMD_ConfigSet_[path] 書き込むコンフィグレーションファイルのファイル名を指定します。書き込むファイルにマルチバイト文字が含まれている場合は、Unicode (UTF-8) でエンコードされている必要があります。 -CMD_ConfigSet_PROMPT_PATH サーバーにアップロードする Config ファイルのパス名: -CMD_ConfigSet_FILE_LOAD_FAILED 指定されたファイルの読み込みに失敗しました。 - - -# RouterList コマンド -CMD_RouterList 仮想レイヤ 3 スイッチ一覧の取得 -CMD_RouterList_Help VPN Server 上に定義されている仮想レイヤ 3 スイッチの一覧を取得します。仮想レイヤ 3 スイッチの [スイッチ名]、[動作状況]、[インターフェイス数]、[ルーティングテーブル数] が取得できます。\nこのコマンドを実行するには、VPN Server の管理者権限が必要です。\nまた、このコマンドは VPN Bridge では動作しません。 -CMD_RouterList_Args RouterList - - -# RouterAdd コマンド -CMD_RouterAdd 新しい仮想レイヤ 3 スイッチの定義 -CMD_RouterAdd_Help VPN Server 上に、新しい仮想レイヤ 3 スイッチを定義します。\nこのコマンドを実行するには、VPN Server の管理者権限が必要です。\nまた、このコマンドは VPN Bridge では動作しません。\n\n[仮想レイヤ 3 スイッチ機能についての説明]\nこの VPN Server 内で動作している複数の仮想 HUB 間で、仮想のレイヤ 3 スイッチを定義し、異なった IP ネットワーク間をルーティングすることができます。\n\n[仮想レイヤ 3 スイッチ機能に関するご注意]\n仮想レイヤ 3 スイッチ機能は、ネットワークおよび IP ルーティングに関する詳しい知識をお持ちの方やネットワーク管理者のための機能です。通常の VPN 機能を使用する場合は、仮想レイヤ 3 スイッチ機能を使用する必要はありません。\n仮想レイヤ 3 スイッチ機能を使用する場合は、IP ルーティングに関する十分な知識をお持ちの上で、ネットワークに与える影響を十分考慮してから設定してください。 -CMD_RouterAdd_Args RouterAdd [name] -CMD_RouterAdd_[name] 新しく作成する仮想レイヤ 3 スイッチの名前を指定します。既に存在する仮想レイヤ 3 スイッチと同一の名前を付けることはできません。 -CMD_RouterAdd_PROMPT_NAME 作成する仮想レイヤ 3 スイッチの名前: - - -# RouterDelete コマンド -CMD_RouterDelete 仮想レイヤ 3 スイッチの削除 -CMD_RouterDelete_Help VPN Server 上に定義されている、既存の仮想レイヤ 3 スイッチを削除します。指定した仮想レイヤ 3 スイッチが動作中の場合は、自動的に動作を停止してから削除を行ないます。\n既存の仮想レイヤ 3 スイッチの一覧を取得するには、RouterList コマンドを使用します。\nこのコマンドを実行するには、VPN Server の管理者権限が必要です。\nまた、このコマンドは VPN Bridge では動作しません。 -CMD_RouterDelete_Args RouterDelete [name] -CMD_RouterDelete_[name] 削除する仮想レイヤ 3 スイッチの名前を指定します。 -CMD_RouterDelete_PROMPT_NAME 削除する仮想レイヤ 3 スイッチの名前: - - -# RouterStart コマンド -CMD_RouterStart 仮想レイヤ 3 スイッチの動作の開始 -CMD_RouterStart_Help VPN Server 上に定義されている、既存の仮想レイヤ 3 スイッチの動作が停止している場合は、その動作を開始します。\n既存の仮想レイヤ 3 スイッチの一覧を取得するには、RouterList コマンドを使用します。\nこのコマンドを実行するには、VPN Server の管理者権限が必要です。\nまた、このコマンドは VPN Bridge では動作しません。\n\n[仮想レイヤ 3 スイッチ機能についての説明]\nこの VPN Server 内で動作している、複数の仮想 HUB 間で仮想のレイヤ 3 スイッチを定義し、異なった IP ネットワーク間をルーティングすることができます。\n\n[仮想レイヤ 3 スイッチ機能に関するご注意]\n仮想レイヤ 3 スイッチ機能は、ネットワークおよび IP ルーティングに関する詳しい知識をお持ちの方や、ネットワーク管理者のための機能です。通常の VPN 機能を使用する場合は、仮想レイヤ 3 スイッチ機能を使用する必要はありません。\n仮想レイヤ 3 スイッチ機能を使用する場合は、IP ルーティングに関する十分な知識をお持ちの上で、ネットワークに与える影響を十分考慮してから設定してください。 -CMD_RouterStart_Args RouterStart [name] -CMD_RouterStart_[name] 開始する仮想レイヤ 3 スイッチの名前を指定します。 -CMD_RouterStart_PROMPT_NAME 開始する仮想レイヤ 3 スイッチの名前: - - -# RouterStop コマンド -CMD_RouterStop 仮想レイヤ 3 スイッチの動作の停止 -CMD_RouterStop_Help VPN Server 上に定義されている、既存の仮想レイヤ 3 スイッチの動作が動作している場合は、その動作を停止します。\n既存の仮想レイヤ 3 スイッチの一覧を取得するには、RouterList コマンドを使用します。\nこのコマンドを実行するには、VPN Server の管理者権限が必要です。 -CMD_RouterStop_Args RouterStop [name] -CMD_RouterStop_[name] 停止する仮想レイヤ 3 スイッチの名前を指定します。 -CMD_RouterStop_PROMPT_NAME 停止する仮想レイヤ 3 スイッチの名前: - - -# RouterIfList コマンド -CMD_RouterIfList 仮想レイヤ 3 スイッチに登録されているインターフェイス一覧の取得 -CMD_RouterIfList_Help 指定した仮想レイヤ 3 スイッチに仮想インターフェイスが定義されている場合は、仮想インターフェイスの一覧を取得します。\n1 つの仮想レイヤ 3 スイッチには、複数個の仮想インターフェイスとルーティングテーブルを定義することができます。\n仮想インターフェイスは仮想 HUB に関連付けられ、仮想 HUB が動作しているときに、仮想 HUB 内で 1 台の IP ホストのように動作します。複数の仮想 HUB に対して、それぞれ別々の IP ネットワークに所属する仮想インターフェイスが定義されているとき、それらのインターフェイス間で IP ルーティングが自動的に行われます。\nこのコマンドを実行するには、VPN Server の管理者権限が必要です。\nまた、このコマンドは VPN Bridge では動作しません。 -CMD_RouterIfList_Args RouterIfList [name] -CMD_RouterIfList_[name] 仮想レイヤ 3 スイッチの名前を指定します。 -CMD_RouterIfList_PROMPT_NAME 仮想レイヤ 3 スイッチの名前: - - -# RouterIfAdd コマンド -CMD_RouterIfAdd 仮想レイヤ 3 スイッチへの仮想インターフェイスの追加 -CMD_RouterIfAdd_Help 指定した仮想レイヤ 3 スイッチに、同じ VPN Server 上で動作している仮想 HUB へ接続する仮想インターフェイスを追加します。\n1 つの仮想レイヤ 3 スイッチには、複数個の仮想インターフェイスとルーティングテーブルを定義することができます。\n仮想インターフェイスは仮想 HUB に関連付けられ、仮想 HUB が動作しているときに、仮想 HUB 内で 1 台の IP ホストのように動作します。複数の仮想 HUB に対して、それぞれ別々の IP ネットワークに所属する仮想インターフェイスが定義されているとき、それらのインターフェイス間で IP ルーティングが自動的に行われます。\n仮想インターフェイスが所属する IP ネットワーク空間と、インターフェイス自身の IP アドレスを定義する必要があります。\nまた、インターフェイスが接続する先の仮想 HUB 名を指定する必要があります。\n仮想 HUB 名には現在存在していない仮想 HUB を指定することもできます。\n仮想インターフェイスは、仮想 HUB 内で 1 つの IP アドレスを持つ必要があります。また、その IP アドレスの属する IP ネットワークのサブネットマスクを指定する必要もあります。\n複数の仮想 HUB 内の IP 空間同士の仮想レイヤ 3 スイッチを経由したルーティングは、ここで指定した IP アドレスに基づいて動作します。\nこのコマンドを実行するには、VPN Server の管理者権限が必要です。\nまた、このコマンドは VPN Bridge では動作しません。\nこのコマンドを実行するには、操作対象の仮想レイヤ 3 スイッチが停止している必要があります。もし停止していない場合は、RouterStop コマンドで停止させてからこのコマンドを実行してください。 -CMD_RouterIfAdd_Args RouterIfAdd [name] [/HUB:hub] [/IP:ip/mask] -CMD_RouterIfAdd_[name] 仮想レイヤ 3 スイッチの名前を指定します。 -CMD_RouterIfAdd_HUB 新しく追加する仮想インターフェイスの接続先の仮想 HUB 名を指定します。仮想 HUB の一覧は、HubList コマンドで取得できます。ただし、必ずしも現在動作している仮想 HUB 名を指定する必要はありません。現在動作していない、または存在しない仮想 HUB 名を指定すると、その仮想 HUB が実際に動作を開始した際に、仮想レイヤ 3 スイッチが有効になります。 -CMD_RouterIfAdd_IP [IP アドレス/サブネットマスク] の形式で、新しく追加する仮想インターフェイスの持つ IP アドレスと、サブネットマスクを指定します。IP アドレスは 192.168.0.1 のように、10 進数をドットで区切って指定します。サブネットマスクは 255.255.255.0 のように 10 進数をドットで区切って指定するか、24 のように先頭からのビット長を 10 進数で指定できます。 -CMD_RouterIfAdd_PROMPT_NAME 仮想レイヤ 3 スイッチの名前: -CMD_RouterIfAdd_PROMPT_HUB 仮想インターフェイスの接続先の仮想 HUB 名: -CMD_RouterIfAdd_PROMPT_IP IP アドレス/サブネットマスク: - - -# RouterIfDel コマンド -CMD_RouterIfDel 仮想レイヤ 3 スイッチの仮想インターフェイスの削除 -CMD_RouterIfDel_Help 指定した仮想レイヤ 3 スイッチ内に、すでに定義されている仮想インターフェイスを削除します。\n現在定義されている仮想インターフェイスの一覧は、RouterIfList コマンドで取得することができます。\nこのコマンドを実行するには、VPN Server の管理者権限が必要です。\nまた、このコマンドは VPN Bridge では動作しません。\nこのコマンドを実行するには、操作対象の仮想レイヤ 3 スイッチが停止している必要があります。もし停止していない場合は、RouterStop コマンドで停止させてからこのコマンドを実行してください。 -CMD_RouterIfDel_Args RouterIfDel [name] [/HUB:hub] -CMD_RouterIfDel_[name] 仮想レイヤ 3 スイッチの名前を指定します。 -CMD_RouterIfDel_HUB 削除する仮想インターフェイスの接続先の仮想 HUB 名を指定します。 - - -# RouterTableList コマンド -CMD_RouterTableList 仮想レイヤ 3 スイッチのルーティングテーブル一覧の取得 -CMD_RouterTableList_Help 指定した仮想レイヤ 3 スイッチに、ルーティングテーブルが定義されている場合は、ルーティングテーブルの一覧を取得します。\n仮想レイヤ 3 スイッチの IP ルーティングエンジンは、IP パケットの宛先 IP アドレスが、各仮想インターフェイスの所属する IP ネットワークのいずれにも所属しない場合は、このルーティングテーブルを参照してルーティングを行います。\nこのコマンドを実行するには、VPN Server の管理者権限が必要です。\nまた、このコマンドは VPN Bridge では動作しません。 -CMD_RouterTableList_Args RouterTableList [name] -CMD_RouterTableList_[name] 仮想レイヤ 3 スイッチの名前を指定します。 -CMD_RouterTableList_PROMPT_NAME 仮想レイヤ 3 スイッチの名前: - - -# RouterTableAdd コマンド -CMD_RouterTableAdd 仮想レイヤ 3 スイッチへのルーティングテーブルエントリの追加 -CMD_RouterTableAdd_Help 指定した仮想レイヤ 3 スイッチのルーティングテーブルに、新しいルーティングテーブルエントリを追加します。\n仮想レイヤ 3 スイッチの IP ルーティングエンジンは、IP パケットの宛先 IP アドレスが、各仮想インターフェイスの所属する IP ネットワークのいずれにも所属しない場合、ルーティングテーブルを参照してルーティングを行います。\n仮想レイヤ 3 スイッチに追加するルーティングテーブルのエントリの内容を指定する必要があります。ゲートウェイアドレスとしては、この仮想レイヤ 3 スイッチの仮想インターフェイスのうち、いずれかと同じ IP ネットワークに所属する IP アドレスを指定する必要があります。\nこのコマンドを実行するには、VPN Server の管理者権限が必要です。\nまた、このコマンドは VPN Bridge では動作しません。\nこのコマンドを実行するには、操作対象の仮想レイヤ 3 スイッチが停止している必要があります。もし停止していない場合は、RouterStop コマンドで停止させてからこのコマンドを実行してください。 -CMD_RouterTableAdd_Args RouterTableAdd [name] [/NETWORK:ip/mask] [/GATEWAY:gwip] [/METRIC:metric] -CMD_RouterTableAdd_[name] 仮想レイヤ 3 スイッチの名前を指定します。 -CMD_RouterTableAdd_NETWORK [IP アドレス/サブネットマスク] の形式で、新しく追加するルーティングテーブルエントリの、ネットワークアドレスとサブネットマスクを指定します。ネットワークアドレスは、192.168.0.1 のように 10 進数をドットで区切って指定します。サブネットマスクは、255.255.255.0 のように 10 進数をドットで区切って指定するか、24 のように先頭からのビット長を 10 進数で指定できます。0.0.0.0/0.0.0.0 を指定すると、デフォルトルートの意味になります。 -CMD_RouterTableAdd_GATEWAY ゲートウェイの IP アドレスを指定します。 -CMD_RouterTableAdd_METRIC メトリック値を指定します。1 以上の整数で指定してください。 -CMD_RouterTableAdd_PROMPT_NAME 仮想レイヤ 3 スイッチの名前: -CMD_RouterTableAdd_PROMPT_NETWORK ネットワークアドレス/サブネットマスク: -CMD_RouterTableAdd_PROMPT_GATEWAY ゲートウェイアドレス: -CMD_RouterTableAdd_PROMPT_METRIC メトリック値: - - -# RouterTableDel コマンド -CMD_RouterTableDel 仮想レイヤ 3 スイッチのルーティングテーブルエントリの削除 -CMD_RouterTableDel_Help 指定した仮想レイヤ 3 スイッチ内に定義されているルーティングテーブルのエントリを削除します。\nすでに定義されているルーティンクテーブルエントリの一覧は、RouterTableList コマンドで取得できます。\nこのコマンドを実行するには、VPN Server の管理者権限が必要です。\nまた、このコマンドは VPN Bridge では動作しません。\nこのコマンドを実行するには、操作対象の仮想レイヤ 3 スイッチが停止している必要があります。もし停止していない場合は、RouterStop コマンドで停止させてからこのコマンドを実行してください。 -CMD_RouterTableDel_Args RouterTableDel [name] [/NETWORK:ip/mask] [/GATEWAY:gwip] [/METRIC:metric] -CMD_RouterTableDel_[name] 仮想レイヤ 3 スイッチの名前を指定します。 -CMD_RouterTableDel_NETWORK [IP アドレス/サブネットマスク] の形式で、削除するルーティングテーブルエントリの、ネットワークアドレスを指定します。 -CMD_RouterTableDel_GATEWAY ゲートウェイの IP アドレスを指定します。 -CMD_RouterTableDel_METRIC メトリック値を指定します。1 以上の整数で指定してください。 - - -# LogFileList コマンド -CMD_LogFileList ログファイル一覧の取得 -CMD_LogFileList_Help VPN Server のコンピュータ上に保存されている、VPN Server が出力したログファイルの一覧を表示します。ここで表示されるログファイルのファイル名を指定して LogFileGet コマンドを呼び出すことにより、ログファイルの内容をダウンロードすることもできます。\nVPN Server にサーバー管理モードで接続している場合は、すべての仮想 HUB のパケットログ、セキュリティログ、および VPN Server のサーバー ログを表示またはダウンロードすることができます。\n仮想 HUB 管理モードで接続している場合は、管理対象の仮想 HUB のパケットログとセキュリティログのみを表示またはダウンロードすることができます。 -CMD_LogFileList_Args LogFileList -CMD_LogFileList_START ログファイル一覧を取得しています。これには、時間がかかる場合があります。しばらくお待ちください... -CMD_LogFileList_NUM_LOGS 全部で %u 個のログファイルがあります。 - - -# LogFileGet コマンド -CMD_LogFileGet ログファイルのダウンロード -CMD_LogFileGet_Help VPN Server のコンピュータ上に保存されているログファイルをダウンロードします。ログファイルをダウンロードするには、まず LogFileList コマンドでログファイルの一覧を表示してから、次に LogFileGet コマンドでダウンロードすることができます。VPN Server にサーバー管理モードで接続している場合は、すべての仮想 HUB のパケットログ、セキュリティログ、および VPN Server のサーバー ログを表示またはダウンロードすることができます。仮想 HUB 管理モードで接続している場合は、管理対象の仮想 HUB のパケットログと、セキュリティログのみを表示、またはダウンロードすることができます。\nパラメータとしてファイル名を指定した場合は、ダウンロードしたログファイルは、そのファイル名のファイルに保存されます。ファイル名を指定しなかった場合は、画面上に表示されます。\nログファイルのサイズは、巨大になる場合がありますので、注意してください。 -CMD_LogFileGet_Args LogFileGet [name] [/SERVER:server] [/SAVEPATH:savepath] -CMD_LogFileGet_[name] ダウンロードするログファイル名を指定します。LogFileList コマンドで、ダウンロードできるログファイル名の一覧を取得できます。 -CMD_LogFileGet_SERVER クラスタコントローラに対してダウンロード要求を行う場合は、ログファイルが保存されているサーバー名を指定します。LogFileGet コマンドで表示されるサーバーを指定してください。 -CMD_LogFileGet_SAVEPATH ダウンロードしたログファイルを保存する場合は、ファイル名を指定します。指定しない場合は、画面上に表示されます。 -CMD_LogFileGet_PROMPT_NAME ダウンロードするログファイル名: -CMD_LogFileGet_START ログファイルをダウンロードしています。これには、時間がかかる場合があります。しばらくお待ちください... -CMD_LogFileGet_FAILED ダウンロードに失敗しました。 -CMD_LogFileGet_SAVE_FAILED 指定されたファイルに書き込めません。 -CMD_LogFileGet_FILESIZE ログファイルのファイルサイズ: %u - - -# HubCreate コマンド -CMD_HubCreate 新しい仮想 HUB の作成 -CMD_HubCreate_Help VPN Server 上に新しい仮想 HUB を作成します。\n作成した仮想 HUB は、直ちに動作を開始します。\nVPN Server がクラスタ内で動作している場合は、このコマンドはクラスタコントローラに対してのみ有効です。また、新しい仮想 HUB は、ダイナミック仮想 HUB として動作します。HubSetStatic コマンドで、スタティック仮想 HUB に変更することもできます。すでに VPN Server 上に存在する仮想 HUB の一覧を取得するには、HubList コマンドを使用します。\nこのコマンドを実行するには、VPN Server の管理者権限が必要です。\nまた、このコマンドは VPN Bridge およびクラスタメンバサーバーとして動作している VPN Server では動作しません。\nなお、クラスタ上でクラスタコントローラに対して仮想 HUB の作成コマンドを発行する場合は、HubCreateStatic コマンドまたは HubCreateDynamic コマンドを使用してください (クラスタコントローラに対して HubCreate コマンドを使用すると HubCreateDynamic コマンドと同等に動作します)。 -CMD_HubCreate_Args HubCreate [name] [/PASSWORD:password] -CMD_HubCreate_[name] 作成する仮想 HUB の名前を指定します。 -CMD_HubCreate_PASSWORD 作成する仮想 HUB の管理パスワードを設定する場合は、その管理パスワードを指定します。指定しない場合は、入力するためのプロンプトが表示されます。 -CMD_HubCreate_PROMPT_NAME 作成する仮想 HUB の名前: - - -# HubCreateDynamic コマンド -CMD_HubCreateDynamic 新しいダイナミック仮想 HUB の作成 (クラスタリング用) -CMD_HubCreateDynamic_Help VPN Server 上に新しいダイナミック仮想 HUB を作成します。\n作成した仮想 HUB は、直ちに動作を開始します。\nVPN Server がクラスタ内で動作している場合は、このコマンドはクラスタコントローラに対してのみ有効です。また、新しい仮想 HUB は、ダイナミック仮想 HUB として動作します。HubSetStatic コマンドで、スタティック仮想 HUB に変更することもできます。すでに VPN Server 上に存在する仮想 HUB の一覧を取得するには、HubList コマンドを使用します。\nこのコマンドを実行するには、VPN Server の管理者権限が必要です。\nまた、このコマンドは VPN Bridge およびクラスタメンバサーバー、またはスタンドアロンサーバーとして動作している VPN Server では動作しません。 -CMD_HubCreateDynamic_Args HubCreateDynamic [name] [/PASSWORD:password] -CMD_HubCreateDynamic_[name] 作成する仮想 HUB の名前を指定します。 -CMD_HubCreateDynamic_PASSWORD 作成する仮想 HUB の管理パスワードを設定する場合は、その管理パスワードを指定します。指定しない場合は、入力するためのプロンプトが表示されます。 - - -# HubCreateStatic コマンド -CMD_HubCreateStatic 新しいスタティック仮想 HUB の作成 (クラスタリング用) -CMD_HubCreateStatic_Help VPN Server 上に新しいスタティック仮想 HUB を作成します。\n作成した仮想 HUB は、直ちに動作を開始します。\nVPN Server がクラスタ内で動作している場合は、このコマンドはクラスタコントローラに対してのみ有効です。また、新しい仮想 HUB は、ダイナミック仮想 HUB として動作します。HubSetStatic コマンドで、スタティック仮想 HUB に変更することもできます。すでに VPN Server 上に存在する仮想 HUB の一覧を取得するには、HubList コマンドを使用します。\nこのコマンドを実行するには、VPN Server の管理者権限が必要です。\nまた、このコマンドは VPN Bridge およびクラスタメンバサーバー、またはスタンドアロンサーバーとして動作している VPN Server では動作しません。 -CMD_HubCreateStatic_Args HubCreateStatic [name] [/PASSWORD:password] -CMD_HubCreateStatic_[name] 作成する仮想 HUB の名前を指定します。 -CMD_HubCreateStatic_PASSWORD 作成する仮想 HUB の管理パスワードを設定する場合は、その管理パスワードを指定します。指定しない場合は、入力するためのプロンプトが表示されます。 - - -# HubDelete コマンド -CMD_HubDelete 仮想 HUB の削除 -CMD_HubDelete_Help VPN Server 上の、既存の仮想 HUB を削除します。\n仮想 HUB を削除すると、現在仮想 HUB に接続しているセッションがすべて切断され、新たなセッションが仮想 HUB に接続できなくなります。\nまた、仮想 HUB のすべての設定、ユーザー オブジェクト、グループオブジェクト、証明書、およびカスケード接続が削除されます。\n仮想 HUB を削除すると、元に戻すことはできません。\nこのコマンドを実行するには、VPN Server の管理者権限が必要です。\nまた、このコマンドは VPN Bridge、およびクラスタメンバサーバーとして動作している VPN Server では動作しません。 -CMD_HubDelete_Args HubDelete [name] -CMD_HubDelete_[name] 削除する仮想 HUB の名前を指定します。 -CMD_HubDelete_PROMPT_NAME 削除する仮想 HUB の名前: - - -# HubSetStatic コマンド -CMD_HubSetStatic 仮想 HUB の種類をスタティック仮想 HUB に変更 -CMD_HubSetStatic_Help VPN Server がクラスタ内で動作している場合、仮想 HUB の種類を、スタティック仮想 HUB に設定します。仮想 HUB の種類を変更すると、現在仮想 HUB に接続しているすべてのセッションは一旦切断されます。\nスタティック仮想 HUB として動作している仮想 HUB がある場合、すべてのクラスタメンバサーバー上で、その名前の仮想 HUB が生成されます。その仮想 HUB に接続しようとしたユーザーは、各サーバーの負荷状況を元にしたアルゴリズムによって、その仮想 HUB をホスティングしている、いずれかのクラスタメンバに接続されます。\nスタティック仮想 HUB は、一例として、企業におけるインターネットから社内 LAN へのリモートアクセス用途において、同時に数千~数万単位の大量のユーザーが同時に接続する可能性があるリモートアクセス VPN 用に利用することが可能です。\nこのコマンドを実行するには、VPN Server の管理者権限が必要です。\nまた、このコマンドは VPN Bridge およびクラスタメンバサーバー、またはスタンドアロンサーバーとして動作している VPN Server では動作しません。\nこのコマンドはビルド 5190 より新しい VPN Server では使用できません。 -CMD_HubSetStatic_Args HubSetStatic [name] -CMD_HubSetStatic_[name] スタティック仮想 HUB に設定する仮想 HUB の名前を指定します。 -CMD_HubChange_PROMPT_NAME 設定を変更する仮想 HUB の名前: - - -# HubSetDynamic コマンド -CMD_HubSetDynamic 仮想 HUB の種類をダイナミック仮想 HUB に変更 -CMD_HubSetDynamic_Help VPN Server がクラスタ内で動作している場合、仮想 HUB の種類を、ダイナミック仮想 HUB に設定します。仮想 HUB の種類を変更すると、現在仮想 HUB に接続しているすべてのセッションは一旦切断されます。\nクラスタ内に定義されているダイナミック仮想 HUB にクライアントが 1 台も接続していないとき、その仮想 HUB はどのクラスタメンバ上にも存在しません。ダイナミック仮想 HUB に 1 台目のクライアントが接続しようとすると、クラスタ内で最も負荷の低いサーバーがその仮想 HUB をホスティングします。2 台目以降のクライアントがその仮想 HUB に接続しようとすると、仮想 HUB をホスティングしているサーバーに自動的に接続します。各ダイナミック仮想 HUB は、すべてのクライアントが切断すると、どのサーバーにも実体が存在しない状態に戻ります。\nダイナミック仮想 HUB の応用例は幅広く、たとえば社内において部課毎に仮想 HUB を定義しておき、各社員が自分が所属している部課の仮想 HUB に接続して作業を行うといったことを、単一のクラスタを設置するだけで、集中管理することができます。\nこのコマンドを実行するには、VPN Server の管理者権限が必要です。\nまた、このコマンドは VPN Bridge およびクラスタメンバサーバー、またはスタンドアロンサーバーとして動作している VPN Server では動作しません。\nこのコマンドはビルド 5190 より新しい VPN Server では使用できません。 -CMD_HubSetDynamic_Args HubSetDynamic [name] -CMD_HubSetDynamic_[name] ダイナミック仮想 HUB に設定する仮想 HUB の名前を指定します。 - - -# HubList コマンド -CMD_HubList 仮想 HUB の一覧の取得 -CMD_HubList_Help VPN Server 内の、既存の仮想 HUB の一覧を取得します。それぞれの仮想 HUB について、[仮想 HUB 名]、[状態]、[種類]、[ユーザー数]、[グループ数]、[セッション数]、[MAC テーブル数]、[IP テーブル数]、[ログイン回数]、[最終ログイン日時]、[最終通信日時] を取得できます。\nただし、仮想 HUB 管理モードで接続している場合は、管理権限のない仮想 HUB のオプションで、匿名ユーザーに対して仮想 HUB を列挙しないオプションが有効になっている場合、その仮想 HUB は列挙されません。サーバー管理モードで接続している場合は、すべての仮想 HUB の一覧が表示されます。\nクラスタリング環境におけるクラスタコントローラ以外のクラスタメンバに接続して管理している場合は、その VPN Server が、現在ホスティングしている仮想 HUB のみが表示されます。クラスタコントローラに接続して管理している場合は、すべての仮想 HUB が表示されます。 -CMD_HubList_Args HubList - - -# Hub コマンド -CMD_Hub 管理する仮想 HUB の選択 -CMD_Hub_Help 管理対象の仮想 HUB を選択します。VPN Server に接続した状態の管理ユーティリティでは、仮想 HUB に関する設定・管理を行なうコマンドを実行する前に、管理を行なう仮想 HUB を Hub コマンドで選択しておく必要があります。\nVPN Server に仮想 HUB 管理モードで接続している状態では、管理対象となっている 1 つの仮想 HUB を選択することができ、他の仮想 HUB を選択することはできません。VPN Server にサーバー管理モードで接続している状態では、すべての仮想 HUB の管理を行なうことができます。\n現在サーバー上に存在する仮想 HUB の一覧を取得するには、HubList コマンドを使用します。\nVPN Bridge では、"BRIDGE" という名前の仮想 HUB 以外を選択することはできません。 -CMD_Hub_Args Hub [name] -CMD_Hub_[name] 管理する仮想 HUB の名前を指定します。パラメータを指定していない場合は、管理対象の仮想 HUB の選択を解除します。 -CMD_Hub_Unselected 仮想 HUB の選択を解除しました。 -CMD_Hub_Selected 仮想 HUB "%S" を選択しました。 -CMD_Hub_Select_Failed /ADMINHUB で指定された仮想 HUB "%S" を選択しようとして、下記のエラーが発生しました。 -CMD_Hub_Not_Selected このコマンドを実行する前に、Hub コマンドで管理対象の仮想 HUB を選択してください。 - - -# Online コマンド -CMD_Online 仮想 HUB をオンラインにする -CMD_Online_Help 現在管理している仮想 HUB がオフラインになっている場合は、オンラインにします。オフライン状態の仮想 HUB は、クライアントからの VPN 接続を受け付けません。仮想 HUB をオンライン化することによって、その仮想 HUB はユーザーからの接続を受け付けたり、サービスを提供したりするようになります。\nこのコマンドは、VPN Bridge では実行できません。\nこのコマンドは、クラスタとして動作している VPN Server の仮想 HUB では実行できません。 -CMD_Online_Args Online - - -# Offline コマンド -CMD_Offline 仮想 HUB をオフラインにする -CMD_Offline_Help 現在管理している仮想 HUB がオンラインになっている場合は、オフラインにします。仮想 HUB に接続中のセッションがある場合は、すべて切断されます。オフライン状態の仮想 HUB は、クライアントからの VPN 接続を受け付けません。\nこのコマンドは、VPN Bridge では実行できません。\nこのコマンドは、クラスタとして動作している VPN Server の仮想 HUB では実行できません。 -CMD_Offline_Args Offline - - -# SetMaxSession コマンド -CMD_SetMaxSession 仮想 HUB の最大同時接続セッション数を設定する -CMD_SetMaxSession_Help 現在管理している仮想 HUB の、最大同時接続セッション数を設定します。最大同時接続セッション数を越えたセッションが、VPN Client や VPN Bridge から接続された場合、最大同時接続セッション数を上回った時点で、それ以上クライアントは接続できなくなります。この最大同時接続セッション数の制限には、ローカルブリッジ、仮想 NAT、カスケード接続などによって仮想 HUB 内に生成されるセッションは含まれません。\n現在の最大同時接続セッション数の設定は、OptionsGet コマンドによって取得することができます。\nこのコマンドは、VPN Bridge では実行できません。\nこのコマンドは、クラスタとして動作している VPN Server の仮想 HUB では実行できません。 -CMD_SetMaxSession_Args SetMaxSession [max_session] -CMD_SetMaxSession_[max_session] 設定する最大同時接続セッション数を、整数で指定します。0 を指定すると、無制限になります。 -CMD_SetMaxSession_Prompt 最大同時接続セッション数: - - -# SetHubPassword コマンド -CMD_SetHubPassword 仮想 HUB の管理パスワードを設定する -CMD_SetHubPassword_Help 現在管理している仮想 HUB の、管理パスワードを設定します。仮想 HUB の管理パスワードが設定されている場合、その仮想 HUB に対して、VPN Server の接続ユーティリティから、仮想 HUB 管理モードでパスワードを指定して接続することができます。また、VPN Client や VPN Bridge などから、ユーザー名を "Administrator"、パスワードを仮想 HUB の管理者パスワードに指定して VPN 接続することも可能になります。\nこのコマンドは、VPN Bridge では実行できません。\nこのコマンドは、クラスタとして動作している VPN Server の仮想 HUB では実行できません。 -CMD_SetHubPassword_Args SetHubPassword [password] -CMD_SetHubPassword_[password] 設定するパスワードを指定します。パラメータでパスワードを指定しない場合は、パスワードを入力するプロンプトが表示されます。 - - -# SetEnumAllow コマンド -CMD_SetEnumAllow 仮想 HUB の匿名ユーザーへの列挙の許可設定 -CMD_SetEnumAllow_Help 現在管理している仮想 HUB のオプション設定を変更し、匿名ユーザーに対して、この仮想 HUB を列挙するように設定します。このオプションを設定すると、VPN Client のユーザーは、この VPN Server のアドレスを入力するだけでこの仮想 HUB を列挙することが可能です。また、SetEnumDeny コマンドを使用すると、匿名ユーザーへの列挙を禁止することができます。仮想 HUB は、作成された時点では列挙が許可されています。\nこのコマンドは、VPN Bridge では実行できません。\nこのコマンドは、クラスタとして動作している VPN Server の仮想 HUB では実行できません。 -CMD_SetEnumAllow_Args SetEnumAllow - - -# SetEnumDeny コマンド -CMD_SetEnumDeny 仮想 HUB の匿名ユーザーへの列挙の禁止設定 -CMD_SetEnumDeny_Help 現在管理している仮想 HUB のオプション設定を変更し、匿名ユーザーに対して、この仮想 HUB を列挙しないように設定します。このオプションを設定すると、VPN Client のユーザーが、VPN Server に対して仮想 HUB の列挙を要求した場合でも、この仮想 HUB は列挙されないようになります。また、SetEnumAllow コマンドを使用すると、匿名ユーザーへの列挙を許可することができます。\nこのコマンドは、VPN Bridge では実行できません。\nこのコマンドは、クラスタとして動作している VPN Server の仮想 HUB では実行できません。 -CMD_SetEnumDeny_Args SetEnumDeny - - -# OptionsGet コマンド -CMD_OptionsGet 仮想 HUB のオプション設定の取得 -CMD_OptionsGet_Help 現在管理している仮想 HUB のオプション設定の一覧を取得します。仮想 HUB の列挙の許可 / 禁止の設定、最大同時接続数、オンライン / オフライン状態、およびクラスタリング環境における仮想 HUB の種類を取得することができます。\nこのコマンドは、クラスタとして動作している VPN Server の仮想 HUB では実行できません。 -CMD_OptionsGet_Args OptionsGet -CMD_OptionsGet_TITLE 仮想 HUB "%S" のオプション設定一覧 -CMD_OptionsGet_ENUM 匿名ユーザーに対する仮想 HUB の列挙 -CMD_OptionsGet_MAXSESSIONS 最大同時接続セッション数 -CMD_OptionsGet_STATUS 状態 -CMD_OptionsGet_TYPE 仮想 HUB の種類 - - - -# RadiusServerSet コマンド -CMD_RadiusServerSet ユーザー認証に使用する RADIUS サーバーの設定 -CMD_RadiusServerSet_Help 現在管理している仮想 HUB に、ユーザーが RADIUS サーバー認証モードで接続した場合に、ユーザー名とパスワードを確認するための外部の RADIUS サーバーを指定します。\nRadius サーバーは、この VPN Server の IP アドレスからの要求を受け付けるように設定しておく必要があります。また、Password Authentication Protocol (PAP) による認証が有効になっている必要があります。\nこのコマンドは、VPN Bridge では実行できません。\nこのコマンドは、クラスタとして動作している VPN Server の仮想 HUB では実行できません。 -CMD_RadiusServerSet_Args RadiusServerSet [server_name:port] [/SECRET:secret] [/RETRY_INTERVAL:interval] -CMD_RadiusServerSet_[server_name:port] [ホスト名:ポート番号] の形式で、使用する RADIUS サーバーのホスト名、または IP アドレスと UDP ポート番号を指定します。ポート番号を省略した場合は、1812 が使用されます。 -CMD_RadiusServerSet_SECRET RADIUS サーバーとの間での通信に使用する共有シークレット (パスワード) を指定します。 -CMD_RadiusServerSet_RETRY_INTERVAL RADIUS サーバーとの間での通信に使用する再試行間隔をミリ秒単位で指定します。 -CMD_RadiusServerSet_Prompt_Host 使用する RADIUS サーバーのホスト名とポート番号: -CMD_RadiusServerSet_Prompt_Secret 共有シークレット: -CMD_RadiusServerSet_Prompt_RetryInterval 再試行間隔 (ミリ秒単位): -CMD_RadiusServerSet_EVAL_NUMINTERVAL 再試行間隔は 500 から 10000 ミリ秒の範囲で指定してください。 - -# RadiusServerDelete コマンド -CMD_RadiusServerDelete ユーザー認証に使用する RADIUS サーバー設定の削除 -CMD_RadiusServerDelete_Help 現在管理している仮想 HUB にユーザーが RADIUS サーバー認証モードで接続した場合に使用する RADIUS サーバーに関する設定を削除し、RADIUS 認証を使用できないようにします。現在の RADIUS サーバーに関する設定は、RadiusServerGet コマンドで取得することができます。\nこのコマンドは、VPN Bridge では実行できません。\nこのコマンドは、クラスタとして動作している VPN Server の仮想 HUB では実行できません。 -CMD_RadiusServerDelete_Args RadiusServerDelete - - -# RadiusServerGet コマンド -CMD_RadiusServerGet ユーザー認証に使用する RADIUS サーバー設定の取得 -CMD_RadiusServerGet_Help 現在管理している仮想 HUB に、ユーザーが RADIUS サーバー認証モードで接続した場合に使用する RADIUS サーバーについての現在の設定を取得します。\nこのコマンドは、VPN Bridge では実行できません。\nこのコマンドは、クラスタとして動作している VPN Server の仮想 HUB では実行できません。 -CMD_RadiusServerGet_Args RadiusServerGet -CMD_RadiusServerGet_STATUS RADIUS サーバーの使用 -CMD_RadiusServerGet_HOST RADIUS サーバーのホスト名または IP アドレス -CMD_RadiusServerGet_PORT RADIUS サーバーのポート番号 -CMD_RadiusServerGet_SECRET 共有シークレット -CMD_RadiusServerGet_RetryInterval 再試行間隔 (ミリ秒単位) - - -# StatusGet コマンド -CMD_StatusGet 仮想 HUB の現在の状況の取得 -CMD_StatusGet_Help 現在管理している仮想 HUB の、現在の状況を取得します。仮想 HUB の種類やセッション数、各種オブジェクト数、ログイン回数、最終ログイン日時と最終通信日時、通信の統計データを取得することができます。 -CMD_StatusGet_Args StatusGet - - -# LogGet コマンド -CMD_LogGet 仮想 HUB のログ保存設定の取得 -CMD_LogGet_Help 現在管理している仮想 HUB の、ログ保存設定を取得します。セキュリティログとパケットログに関する保存設定や、保存対象などの設定情報が取得できます。 -CMD_LogGet_Args LogGet -CMD_Log_SecurityLog セキュリティログの保存 -CMD_Log_PacketLog パケットログの保存 -CMD_Log_SwitchType ログファイルの切り替え周期 -CMD_Log_0 TCP コネクションログ -CMD_Log_1 TCP パケットログ -CMD_Log_2 DHCP ログ -CMD_Log_3 UDP ログ -CMD_Log_4 ICMP ログ -CMD_Log_5 IP ログ -CMD_Log_6 ARP ログ -CMD_Log_7 Ethernet ログ - - -# LogEnable コマンド -CMD_LogEnable セキュリティログまたはパケットログの有効化 -CMD_LogEnable_Help 現在管理している仮想 HUB の、セキュリティログまたはパケットログを有効化します。\n現在の設定は、LogGet コマンドで取得することができます。 -CMD_LogEnable_Args LogEnable [security|packet] -CMD_LogEnable_[security|packet] 有効化するログの種類を選択します。"security" または "packet" のいずれかを指定します。 -CMD_LogEnable_Prompt security または packet を選択: -CMD_LogEnable_Prompt_Error 指定が不正です。 - - -# LogDisable コマンド -CMD_LogDisable セキュリティログまたはパケットログの無効化 -CMD_LogDisable_Help 現在管理している仮想 HUB の、セキュリティログまたはパケットログを無効化します。\n現在の設定は、LogGet コマンドで取得することができます。 -CMD_LogDisable_Args LogDisable [security|packet] -CMD_LogDisable_[security|packet] 無効化するログの種類を選択します。"security" または "packet" のいずれかを指定します。 - - -# LogSwitchSet コマンド -CMD_LogSwitchSet ログファイルの切り替え周期の設定 -CMD_LogSwitchSet_Help 現在管理している仮想 HUB が保存する、セキュリティログまたはパケットログのログファイルの切り替え周期を設定します。ログファイルの切り替え周期は、1 秒単位、1 分単位、1 時間単位、1 日単位、1 ヶ月単位、または切り替えを行わないように変更することができます。\n現在の設定は、LogGet コマンドで取得することができます。 -CMD_LogSwitchSet_Args LogSwitchSet [security|packet] [/SWITCH:sec|min|hour|day|month|none] -CMD_LogSwitchSet_[security|packet] 設定を変更するログの種類を選択します。"security" または "packet" のいずれかを指定します。 -CMD_LogSwitchSet_SWITCH 設定する切り替え周期を選択します。sec、min、hour、day、month、none から指定します。 -CMD_LogSwitchSet_Prompt sec, min, hour, day, month, none を指定: - - -# LogPacketSaveType コマンド -CMD_LogPacketSaveType パケットログに保存するパケットの種類と保存内容の設定 -CMD_LogPacketSaveType_Help 現在管理している仮想 HUB で保存する、パケットログの保存内容を、パケットの種類ごとに設定します。パケットの種類には、[TCP コネクションログ]、[TCP パケットログ]、[DHCP パケットログ]、[UDP パケットログ]、[ICMP パケットログ]、[IP パケットログ]、[ARP パケットログ]、[Ethernet パケットログ] があります。\n現在の設定は、LogGet コマンドで取得することができます。 -CMD_LogPacketSaveType_Args LogPacketSaveType [/TYPE:tcpconn|tcpdata|dhcp|udp|icmp|ip|arp|ether] [/SAVE:none|header|full] -CMD_LogPacketSaveType_TYPE 保存内容の変更対称のパケットの種類を、tcpconn、tcpdata、dhcp、udp、icmp、ip、arp、ether の中から指定します。 -CMD_LogPacketSaveType_SAVE パケットログの保存内容を指定します。\nnone : 保存無し\nheader: ヘッダ情報のみ\nfull : パケット内容すべて\nのいずれかを指定します。 -CMD_LogPacketSaveType_Prompt_TYPE tcpconn, tcpdata, dhcp, udp, icmp, ip, arp, ether を指定: -CMD_LogPacketSaveType_Prompt_SAVE none, header, full を指定: - - -# CAList コマンド -CMD_CAList 信頼する証明機関の証明書一覧の取得 -CMD_CAList_Help 現在管理している仮想 HUB が信頼する証明機関の証明書を管理します。登録されている証明機関の証明書一覧は、VPN Client が署名済み証明書認証モードで接続してきた際の証明書の検証に使用されます。\nこのコマンドは、VPN Bridge では実行できません。\nこのコマンドは、クラスタ内でクラスタメンバサーバーとして動作している VPN Server の仮想 HUB では実行できません。 -CMD_CAList_Args CAList -CMD_CAList_COLUMN_ID ID - - -# CAAdd コマンド -CMD_CAAdd 信頼する証明機関の証明書の追加 -CMD_CAAdd_Help 現在管理している仮想 HUB が信頼する証明機関の証明書一覧に、新しい証明書を追加します。登録されている証明機関の証明書一覧は、VPN Client が、署名済み証明書認証モードで接続してきた際の証明書の検証に使用されます。\n現在の証明書一覧を取得するには、CAList コマンドを使用します。\n証明書を追加するには、その証明書が X.509 形式のファイルとして保存されている必要があります。\nこのコマンドは、VPN Bridge では実行できません。\nこのコマンドは、クラスタ内でクラスタメンバサーバーとして動作している VPN Server の仮想 HUB では実行できません。 -CMD_CAAdd_Args CAAdd [path] -CMD_CAAdd_[path] 登録する X.509 証明書ファイル名を指定します。 -CMD_CAAdd_PROMPT_PATH 登録する X.509 証明書ファイル名: - - -# CADelete コマンド -CMD_CADelete 信頼する証明機関の証明書の削除 -CMD_CADelete_Help 現在管理している仮想 HUB が信頼する証明機関の証明書一覧から、既存の証明書を削除します。\n現在の証明書一覧を取得するには、CAList コマンドを使用します。\nこのコマンドは、VPN Bridge では実行できません。\nこのコマンドは、クラスタ内でクラスタメンバサーバーとして動作している VPN Server の仮想 HUB では実行できません。 -CMD_CADelete_Args CADelete [id] -CMD_CADelete_[id] 削除する証明書の ID を指定します。 -CMD_CADelete_PROMPT_ID 削除する証明書の ID: - - -# CAGet コマンド -CMD_CAGet 信頼する証明機関の証明書の取得 -CMD_CAGet_Help 現在管理している仮想 HUB が信頼する証明機関の証明書一覧内の既存の証明書を取得し、X.509 形式のファイルとして保存します。\nこのコマンドは、VPN Bridge では実行できません。\nこのコマンドは、クラスタ内でクラスタメンバサーバーとして動作している VPN Server の仮想 HUB では実行できません。 -CMD_CAGet_Args CAGet [id] [/SAVECERT:path] -CMD_CAGet_[id] 取得する証明書の ID を指定します。 -CMD_CAGet_SAVECERT 取得した証明書を保存するファイル名を指定します。 -CMD_CAGet_PROMPT_ID 取得する証明書の ID: -CMD_CAGet_PROMPT_SAVECERT 保存するファイル名: - - -# CascadeList コマンド -CMD_CascadeList カスケード接続一覧の取得 -CMD_CascadeList_Help 現在管理している仮想 HUB に登録されているカスケード接続の一覧を取得します。\nカスケード接続を使用すると、この仮想 HUB を同一または別のコンピュータ上で動作している他の仮想 HUB に、レイヤ 2 カスケード接続することができます。\n\n[カスケード接続における警告]\nカスケード接続を使用すると、複数の仮想 HUB 間でのレイヤ 2 ブリッジが可能ですが、接続方法を間違えると、ループ状のカスケード接続を作成してしまう場合があります。カスケード接続機能を使用する際には、慎重にネットワークトポロジを設計してください。\nこのコマンドは、クラスタとして動作している VPN Server の仮想 HUB では実行できません。 -CMD_CascadeList_Args CascadeList - - -# CascadeCreate コマンド -CMD_CascadeCreate 新しいカスケード接続の作成 -CMD_CascadeCreate_Help 現在管理している仮想 HUB に、新しいカスケード接続を作成します。\nカスケード接続を使用すると、この仮想 HUB を同一または別のコンピュータ上で動作している他の仮想 HUB にカスケード接続することができます。\nカスケード接続を作成するには、初期パラメータとして、カスケード接続の名前と接続先のサーバーおよび接続先の仮想 HUB、ユーザー名を指定する必要があります。新しいカスケード接続を作成した場合、ユーザー認証の種類は [匿名認証] に初期設定され、プロキシサーバーの設定とサーバー証明書の検証オプションは設定されません。これらの設定やその他の詳細設定を変更するには、カスケード接続を作成した後に "Cascade" という名前で始まる他のコマンドを使用します。\n\n[カスケード接続における警告]\nカスケード接続を使用すると、複数の仮想 HUB 間でのレイヤ 2 ブリッジが可能ですが、接続方法を間違えると、ループ状のカスケード接続を作成してしまう場合があります。カスケード接続機能を使用する際には、慎重にネットワークトポロジを設計してください。\n\nこのコマンドは、クラスタとして動作している VPN Server の仮想 HUB では実行できません。 -CMD_CascadeCreate_Args CascadeCreate [name] [/SERVER:hostname:port] [/HUB:hubname] [/USERNAME:username] -CMD_CascadeCreate_[name] 作成するカスケード接続の名前を指定します。 -CMD_CascadeCreate_SERVER [ホスト名:ポート番号] の形式で、接続先の VPN Server のホスト名とポート番号を指定します。IP アドレスで指定することもできます。 -CMD_CascadeCreate_HUB 接続先の VPN Server 内の仮想 HUB を指定します。 -CMD_CascadeCreate_USERNAME 接続先の VPN Server に接続する際のユーザー認証で使用するユーザー名を指定します。 -CMD_CascadeCreate_Prompt_Name カスケード接続の名前: -CMD_CascadeCreate_Prompt_Server 接続先 VPN Server のホスト名とポート番号: -CMD_CascadeCreate_Prompt_Hub 接続先仮想 HUB 名: -CMD_CascadeCreate_Prompt_Username 接続するユーザー名: - - -# CascadeSet コマンド -CMD_CascadeSet カスケード接続の接続先の設定 -CMD_CascadeSet_Help 現在管理している仮想 HUB に登録されているカスケード接続の、接続先の VPN Server のホスト名とポート番号、仮想 HUB 名、および接続に使用するユーザー名を設定します。\nこのコマンドは、クラスタとして動作している VPN Server の仮想 HUB では実行できません。 -CMD_CascadeSet_Args CascadeSet [name] [/SERVER:hostname:port] [/HUB:hubname] -CMD_CascadeSet_[name] 設定を変更するカスケード接続の名前を指定します。 -CMD_CascadeSet_SERVER [ホスト名:ポート番号] の形式で、接続先の VPN Server のホスト名とポート番号を指定します。IP アドレスで指定することもできます。 -CMD_CascadeSet_HUB 接続先の VPN Server 内の仮想 HUB を指定します。 - - -# CascadeGet コマンド -CMD_CascadeGet カスケード接続の設定の取得 -CMD_CascadeGet_Help 現在管理している仮想 HUB に登録されているカスケード接続の接続設定内容を取得します。\nなお、カスケード接続の接続設定内容を変更するには、カスケード接続を作成した後に "Cascade" という名前で始まる、他のコマンドを使用します。\nこのコマンドは、クラスタとして動作している VPN Server の仮想 HUB では実行できません。 -CMD_CascadeGet_Args CascadeGet [name] -CMD_CascadeGet_[name] 設定を取得するカスケード接続の名前を指定します。 -CMD_CascadeGet_Policy [カスケードセッションのセキュリティポリシー設定値] - -# CascadeDelete コマンド -CMD_CascadeDelete カスケード接続の削除 -CMD_CascadeDelete_Help 現在管理している仮想 HUB に登録されているカスケード接続を削除します。指定されたカスケード接続がオンライン状態である場合は、自動的に接続を切断してから削除します。\nこのコマンドは、クラスタとして動作している VPN Server の仮想 HUB では実行できません。 -CMD_CascadeDelete_Args CascadeDelete [name] -CMD_CascadeDelete_[name] 削除するカスケード接続の名前を指定します。 - - -# CascadeUsernameSet コマンド -CMD_CascadeUsernameSet カスケード接続の接続に使用するユーザー名の設定 -CMD_CascadeUsernameSet_Help 現在管理している仮想 HUB に登録されているカスケード接続を指定し、そのカスケード接続が VPN Server に接続する際の、ユーザー認証に必要なユーザー名を指定します。\nなお、ユーザー認証の種類を指定したり、必要なパラメータを指定したりする必要がある場合があります。これらの情報を変更するには、CascadeAnonymousSet、CascadePasswordSet、CascadeCertSet などのコマンドを使用します。\nこのコマンドは、クラスタとして動作している VPN Server の仮想 HUB では実行できません。 -CMD_CascadeUsernameSet_Args CascadeUsernameSet [name] [/USERNAME:username] -CMD_CascadeUsernameSet_[name] 設定を変更するカスケード接続の名前を指定します。 -CMD_CascadeUsernameSet_USERNAME カスケード接続が VPN Server に接続する際の、ユーザー認証に必要なユーザー名を指定します。 -CMD_CascadeUsername_Notice この接続設定の認証方法は、現在パスワード認証に設定されています。ユーザー名を変更した後、CascadePasswordSet コマンドでパスワードを設定し直す必要があります。 - - -# CascadeAnonymousSet コマンド -CMD_CascadeAnonymousSet カスケード接続のユーザー認証の種類を匿名認証に設定 -CMD_CascadeAnonymousSet_Help 現在管理している仮想 HUB に登録されているカスケード接続を指定し、そのカスケード接続が VPN Server に接続する際の、ユーザー認証の方法を [匿名認証] に設定します。\nこのコマンドは、クラスタとして動作している VPN Server の仮想 HUB では実行できません。 -CMD_CascadeAnonymousSet_Args CascadeAnonymousSet [name] -CMD_CascadeAnonymousSet_[name] 設定を変更するカスケード接続の名前を指定します。 - - -# CascadePasswordSet コマンド -CMD_CascadePasswordSet カスケード接続のユーザー認証の種類をパスワード認証に設定 -CMD_CascadePasswordSet_Help 現在管理している仮想 HUB に登録されているカスケード接続を指定し、そのカスケード接続が VPN Server に接続する際のユーザー認証の方法を [パスワード認証] に設定します。パスワード認証の種類には、[標準パスワード認証] と [RADIUS または NT ドメイン認証] を指定します。\nこのコマンドは、クラスタとして動作している VPN Server の仮想 HUB では実行できません。 -CMD_CascadePasswordSet_Args CascadePasswordSet [name] [/PASSWORD:password] [/TYPE:standard|radius] -CMD_CascadePasswordSet_[name] 設定を変更するカスケード接続の名前を指定します。 -CMD_CascadePasswordSet_PASSWORD パスワード認証で使用するパスワードを指定します。指定しない場合は、パスワードを入力するためのプロンプトが表示されます。 -CMD_CascadePasswordSet_TYPE パスワード認証の種類として、"standard" (標準パスワード認証)、または "radius" (RADIUS または NT ドメイン認証) のどちらかを指定します。 -CMD_CascadePasswordSet_Prompt_Type standard または radius の指定: -CMD_CascadePasswordSet_Type_Invalid standard または radius の指定が不正です。 - - -# CascadeCertSet コマンド -CMD_CascadeCertSet カスケード接続のユーザー認証の種類をクライアント証明書認証に設定 -CMD_CascadeCertSet_Help 現在管理している仮想 HUB に登録されているカスケード接続を指定し、そのカスケード接続が VPN Server に接続する際のユーザー認証の方法を [クライアント証明書認証] に設定します。証明書としては、X.509 形式の証明書ファイルと、Base 64 でエンコードされた対応した秘密鍵ファイルを指定する必要があります。\nこのコマンドは、クラスタとして動作している VPN Server の仮想 HUB では実行できません。 -CMD_CascadeCertSet_Args CascadeCertSet [name] [/LOADCERT:cert] [/LOADKEY:key] -CMD_CascadeCertSet_[name] 設定を変更するカスケード接続の名前を指定します。 -CMD_CascadeCertSet_LOADCERT 証明書認証で提示する X.509 形式の証明書ファイル名を指定します。 -CMD_CascadeCertSet_LOADKEY 証明書に対応した Base 64 形式でエンコードされた秘密鍵ファイル名を指定します。 - - -# CascadeCertGet コマンド -CMD_CascadeCertGet カスケード接続に用いるクライアント証明書の取得 -CMD_CascadeCertGet_Help 現在管理している仮想 HUB に登録されているカスケード接続を指定し、そのカスケード接続がクライアント証明書認証を使用する場合は、クライアント証明書として提示する証明書を取得して、証明書ファイルを X.509 形式で保存します。\nこのコマンドは、クラスタとして動作している VPN Server の仮想 HUB では実行できません。 -CMD_CascadeCertGet_Args CascadeCertGet [name] [/SAVECERT:cert] -CMD_CascadeCertGet_[name] 設定を取得するカスケード接続の名前を指定します。 -CMD_CascadeCertGet_SAVECERT 取得した証明書を X.509 形式で保存するファイル名を指定します。 -CMD_CascadeCertSet_Not_Auth_Cert 指定したカスケード接続はクライアント証明書認証モードではありません。 -CMD_CascadeCertSet_Cert_Not_Exists 指定したカスケード接続の接続設定に証明書が格納されていません。 - - -# CascadeEncryptEnable コマンド -CMD_CascadeEncryptEnable カスケード接続の通信時の暗号化の有効化 -CMD_CascadeEncryptEnable_Help 現在管理している仮想 HUB に登録されているカスケード接続を指定し、そのカスケード接続が VPN Server との間で VPN 接続を行なって通信をする際に、VPN Server との間の通信内容を SSL で暗号化するように設定します。\n通常は、VPN Server との間の通信を SSL で暗号化して、情報の盗聴や改ざんを防止します。暗号化を無効にすることもできます。暗号化を無効にすると、通信のスループットが向上しますが、通信データは平文でネットワーク上を流れます。\nこのコマンドは、クラスタとして動作している VPN Server の仮想 HUB では実行できません。 -CMD_CascadeEncryptEnable_Args CascadeEncryptEnable [name] -CMD_CascadeEncryptEnable_[name] 設定を変更するカスケード接続の名前を指定します。 - - -# CascadeEncryptDisable コマンド -CMD_CascadeEncryptDisable カスケード接続の通信時の暗号化の無効化 -CMD_CascadeEncryptDisable_Help 現在管理している仮想 HUB に登録されているカスケード接続を指定し、そのカスケード接続が VPN Server との間で VPN 接続を行なって通信をする際に VPN Server との間の通信内容を暗号化しないように設定します。\n通常は、VPN Server との間の通信を SSL で暗号化して、情報の盗聴や改ざんを防止します。暗号化を無効にすることもできます。暗号化を無効にすると、通信のスループットが向上しますが、通信データは平文でネットワーク上を流れます。\nこのコマンドは、クラスタとして動作している VPN Server の仮想 HUB では実行できません。 -CMD_CascadeEncryptDisable_Args CascadeEncryptDisable [name] -CMD_CascadeEncryptDisable_[name] 設定を変更するカスケード接続の名前を指定します。 - - -# CascadeCompressEnable コマンド -CMD_CascadeCompressEnable カスケード接続の通信時のデータ圧縮の有効化 -CMD_CascadeCompressEnable_Help 現在管理している仮想 HUB に登録されているカスケード接続を指定し、そのカスケード接続が VPN Server との間で VPN 接続を行なって通信をする際に、VPN Server との間の通信内容を圧縮するように設定します。\n最大で約 80 % 程度の圧縮を行うことができます。ただし、圧縮を行うと、クライアントおよびサーバーの両方で CPU 負荷が高くなります。回線速度が約 10 Mbps 以上の場合は、圧縮を行うとスループットが低下し、逆効果となる場合があります。\nこのコマンドは、クラスタとして動作している VPN Server の仮想 HUB では実行できません。 -CMD_CascadeCompressEnable_Args CascadeCompressEnable [name] -CMD_CascadeCompressEnable_[name] 設定を変更するカスケード接続の名前を指定します。 - - -# CascadeCompressDisable コマンド -CMD_CascadeCompressDisable カスケード接続の通信時のデータ圧縮の無効化 -CMD_CascadeCompressDisable_Help 現在管理している仮想 HUB に登録されているカスケード接続を指定し、そのカスケード接続が VPN Server との間で VPN 接続を行なって通信をする際に、VPN Server との間の通信内容を圧縮しないように設定します。\nこのコマンドは、クラスタとして動作している VPN Server の仮想 HUB では実行できません。 -CMD_CascadeCompressDisable_Args CascadeCompressDisable [name] -CMD_CascadeCompressDisable_[name] 設定を変更するカスケード接続の名前を指定します。 - - -# CascadeHttpHeader* コマンド -CMD_CascadeHttpHeader_Prompt_Name ヘッダー名 (コロンより前の部分): -CMD_CascadeHttpHeader_Prompt_Data ヘッダー値 (コロンより後の部分): - -# CascadeHttpHeaderAdd コマンド -CMD_CascadeHttpHeaderAdd プロキシサーバー経由で接続する際のカスタム HTTP ヘッダーを追加 -CMD_CascadeHttpHeaderAdd_Help VPN Client に登録されている接続設定を指定し、経由する HTTP プロキシサーバーに送信されるカスタム HTTP ヘッダーを追加します。カスタム HTTP ヘッダーを使用することによりネットワークに課された特定の制限を回避したり、QoS により適当される速度制限を回避できる場合があります。 -CMD_CascadeHttpHeaderAdd_Args CascadeHttpHeaderAdd [name] [/NAME:name] [/DATA:data] -CMD_CascadeHttpHeaderAdd_[name] 設定を変更する接続設定の名前を指定します。 -CMD_CascadeHttpHeaderAdd_NAME 追加するヘッダーの名前を指定します (コロンより前の部分)。 -CMD_CascadeHttpHeaderAdd_DATA 追加するヘッダーの値を指定します (コロンより後の部分)。 - - -# CascadeHttpHeaderDelete コマンド -CMD_CascadeHttpHeaderDelete プロキシサーバー経由で接続する際のカスタム HTTP ヘッダーを削除 -CMD_CascadeHttpHeaderDelete_Help VPN Client に登録されている接続設定を指定し、経由する HTTP プロキシサーバーに送信されるカスタム HTTP ヘッダーを削除します。カスタム HTTP ヘッダーを使用することによりネットワークに課された特定の制限を回避したり、QoS により適当される速度制限を回避できる場合があります。 -CMD_CascadeHttpHeaderDelete_Args CascadeHttpHeaderDelete [name] [/NAME:name] -CMD_CascadeHttpHeaderDelete_[name] 設定を削除する接続設定の名前を指定します。 -CMD_CascadeHttpHeaderDelete_NAME 削除するヘッダーの名前を指定します (コロンより前の部分)。 - - -# CascadeHttpHeaderGet コマンド -CMD_CascadeHttpHeaderGet プロキシサーバー経由で接続する際のカスタム HTTP ヘッダー一覧を取得 -CMD_CascadeHttpHeaderGet_Help VPN Client に登録されている接続設定を指定し、経由する HTTP プロキシサーバーに送信されるカスタム HTTP ヘッダーの一覧を表示します。カスタム HTTP ヘッダーを使用することによりネットワークに課された特定の制限を回避したり、QoS により適当される速度制限を回避できる場合があります。 -CMD_CascadeHttpHeaderGet_Args CascadeHttpHeaderGet [name] -CMD_CascadeHttpHeaderGet_[name] 設定を取得する接続設定の名前を指定します。 - - -# CascadeProxyNone コマンド -CMD_CascadeProxyNone カスケード接続の接続方法を直接 TCP/IP 接続に設定 -CMD_CascadeProxyNone_Help 現在管理している仮想 HUB に登録されているカスケード接続を指定し、そのカスケード接続が VPN Server に対して接続する際に、使用する接続方法を [直接 TCP/IP 接続] に設定し、プロキシサーバーを経由しないようにします。\nこのコマンドは、クラスタとして動作している VPN Server の仮想 HUB では実行できません。 -CMD_CascadeProxyNone_Args CascadeProxyNone [name] -CMD_CascadeProxyNone_[name] 設定を変更するカスケード接続の名前を指定します。 - - -# CascadeProxyHttp コマンド -CMD_CascadeProxyHttp カスケード接続の接続方法を HTTP プロキシサーバー経由接続に設定 -CMD_CascadeProxyHttp_Help 現在管理している仮想 HUB に登録されているカスケード接続を指定し、そのカスケード接続が VPN Server に対して接続する際に、使用する接続方法を [HTTP プロキシサーバー経由接続] に設定し、経由する HTTP プロキシサーバーのホスト名とポート番号、ユーザー名とパスワード (必要な場合) を指定します。\n経由する HTTP サーバーは、HTTPS 通信をするための CONNECT メソッドに対応している必要があります。\nこのコマンドは、クラスタとして動作している VPN Server の仮想 HUB では実行できません。 -CMD_CascadeProxyHttp_Args CascadeProxyHttp [name] [/SERVER:hostname:port] [/USERNAME:username] [/PASSWORD:password] -CMD_CascadeProxyHttp_[name] 設定を変更するカスケード接続の名前を指定します。 -CMD_CascadeProxyHttp_SERVER [ホスト名:ポート番号] の形式で、経由する HTTP プロキシサーバーのホスト名、または IP アドレスとポート番号を指定します。 -CMD_CascadeProxyHttp_USERNAME 経由する HTTP プロキシサーバーに接続するためにユーザー認証が必要な場合、ユーザー名を指定します。また、同時に /PASSWORD パラメータも指定します。/USERNAME と /PASSWORD パラメータが指定されない場合は、ユーザー認証データを設定しません。 -CMD_CascadeProxyHttp_PASSWORD 経由する HTTP プロキシサーバーに接続するためにユーザー認証が必要な場合、パスワードを指定します。/USERNAME パラメータと共に指定します。 -CMD_CascadeProxyHttp_Prompt_Server プロキシサーバーのホスト名とポート番号: - - -# CascadeProxySocks コマンド -CMD_CascadeProxySocks カスケード接続の接続方法を SOCKS4 プロキシサーバー経由接続に設定 -CMD_CascadeProxySocks_Help 現在管理している仮想 HUB に登録されているカスケード接続を指定し、そのカスケード接続が VPN Server に対して接続する際に、使用する接続方法を [SOCKS4 プロキシサーバー経由接続] に設定し、経由する SOCKS4 プロキシサーバーのホスト名とポート番号、ユーザー名とパスワード (必要な場合) を指定します。\n経由する SOCKS4 サーバーは、SOCKS4 バージョン 4 に対応している必要があります。\nこのコマンドは、クラスタとして動作している VPN Server の仮想 HUB では実行できません。 -CMD_CascadeProxySocks_Args CascadeProxySocks [name] [/SERVER:hostname:port] [/USERNAME:username] [/PASSWORD:password] -CMD_CascadeProxySocks_[name] 設定を変更するカスケード接続の名前を指定します。 -CMD_CascadeProxySocks_SERVER [ホスト名:ポート番号] の形式で、経由する SOCKS4 プロキシサーバーのホスト名、または IP アドレスとポート番号を指定します。 -CMD_CascadeProxySocks_USERNAME 経由する SOCKS4 プロキシサーバーに接続するためにユーザー認証が必要な場合、ユーザー名を指定します。また、同時に /PASSWORD パラメータも指定します。/USERNAME と /PASSWORD パラメータが指定されない場合は、ユーザー認証データを設定しません。 -CMD_CascadeProxySocks_PASSWORD 経由する SOCKS4 プロキシサーバーに接続するためにユーザー認証が必要な場合、パスワードを指定します。/USERNAME パラメータと共に指定します。 - - -# CascadeProxySocks5 コマンド -CMD_CascadeProxySocks5 カスケード接続の接続方法を SOCKS4 プロキシサーバー経由接続に設定 -CMD_CascadeProxySocks5_Help 現在管理している仮想 HUB に登録されているカスケード接続を指定し、そのカスケード接続が VPN Server に対して接続する際に、使用する接続方法を [SOCKS5 プロキシサーバー経由接続] に設定し、経由する SOCKS5 プロキシサーバーのホスト名とポート番号、ユーザー名とパスワード (必要な場合) を指定します。\nこのコマンドは、クラスタとして動作している VPN Server の仮想 HUB では実行できません。 -CMD_CascadeProxySocks5_Args CascadeProxySocks5 [name] [/SERVER:hostname:port] [/USERNAME:username] [/PASSWORD:password] -CMD_CascadeProxySocks5_[name] 設定を変更するカスケード接続の名前を指定します。 -CMD_CascadeProxySocks5_SERVER [ホスト名:ポート番号] の形式で、経由する SOCKS5 プロキシサーバーのホスト名、または IP アドレスとポート番号を指定します。 -CMD_CascadeProxySocks5_USERNAME 経由する SOCKS5 プロキシサーバーに接続するためにユーザー認証が必要な場合、ユーザー名を指定します。また、同時に /PASSWORD パラメータも指定します。/USERNAME と /PASSWORD パラメータが指定されない場合は、ユーザー認証データを設定しません。 -CMD_CascadeProxySocks5_PASSWORD 経由する SOCKS5 プロキシサーバーに接続するためにユーザー認証が必要な場合、パスワードを指定します。/USERNAME パラメータと共に指定します。 - - -# CascadeServerCertEnable コマンド -CMD_CascadeServerCertEnable カスケード接続のサーバー証明書の検証オプションの有効化 -CMD_CascadeServerCertEnable_Help 現在管理している仮想 HUB に登録されているカスケード接続を指定し、そのカスケード接続が VPN Server に対して接続する際に、接続先の VPN Server の提示する SSL 証明書が信頼できるかどうか検査するオプションを有効にします。\nこのオプションが有効になっている場合、接続先サーバーの SSL 証明書をあらかじめ CascadeServerCertSet コマンドでカスケード接続設定内に保存しておくか、または仮想 HUB の信頼する証明機関の証明書一覧に、サーバーの SSL 証明書を署名したルート証明書を CAAdd コマンドなどで登録しておく必要があります。\nカスケード接続の、サーバー証明書の検証オプションが有効になっている状態で接続した VPN Server の証明書が信頼できない場合、直ちに接続を解除して再試行を繰り返します。\nこのコマンドは、クラスタとして動作している VPN Server の仮想 HUB では実行できません。 -CMD_CascadeServerCertEnable_Args CascadeServerCertEnable [name] -CMD_CascadeServerCertEnable_[name] 設定を変更するカスケード接続の名前を指定します。 - - -# CascadeServerCertDisable コマンド -CMD_CascadeServerCertDisable カスケード接続のサーバー証明書の検証オプションの無効化 -CMD_CascadeServerCertDisable_Help 現在管理している仮想 HUB に登録されているカスケード接続を指定し、そのカスケード接続が VPN Server に対して接続する際に、接続先の VPN Server の提示する SSL 証明書が、信頼できるかどうか検査するオプションを無効にします。\nこのコマンドは、クラスタとして動作している VPN Server の仮想 HUB では実行できません。 -CMD_CascadeServerCertDisable_Args CascadeServerCertDisable [name] -CMD_CascadeServerCertDisable_[name] 設定を変更するカスケード接続の名前を指定します。 - - -# CascadeServerCertSet コマンド -CMD_CascadeServerCertSet カスケード接続のサーバー固有証明書の設定 -CMD_CascadeServerCertSet_Help 現在管理している仮想 HUB に登録されているカスケード接続を指定し、そのカスケード接続が VPN Server に対して接続する際に、接続先の VPN Server の提示する SSL 証明書と同じ証明書をあらかじめ登録します。\nカスケード接続の、サーバー証明書の検証オプションが有効になっている場合、接続先サーバーの SSL 証明書を、あらかじめこのコマンドでカスケード接続設定内に保存しておくか、または仮想 HUB の信頼する証明機関の証明書一覧に、サーバーの SSL 証明書を署名したルート証明書を CAAdd コマンドなどで登録しておく必要があります。\nカスケード接続の、サーバー証明書の検証オプションが有効になっている状態で接続した VPN Server の証明書が信頼できない場合、直ちに接続を解除して再試行を繰り返します。\nこのコマンドは、クラスタとして動作している VPN Server の仮想 HUB では実行できません。 -CMD_CascadeServerCertSet_Args CascadeServerCertSet [name] [/LOADCERT:cert] -CMD_CascadeServerCertSet_[name] 設定を変更するカスケード接続の名前を指定します。 -CMD_CascadeServerCertSet_LOADCERT 設定するサーバー固有証明書が保存されている X.509 形式の証明書ファイル名を指定します。 - - -# CascadeServerCertDelete コマンド -CMD_CascadeServerCertDelete カスケード接続のサーバー固有証明書の削除 -CMD_CascadeServerCertDelete_Help 現在管理している仮想 HUB に登録されているカスケード接続を指定し、そのカスケード接続にサーバー固有証明書が登録されている場合は、それを削除します。\nこのコマンドは、クラスタとして動作している VPN Server の仮想 HUB では実行できません。 -CMD_CascadeServerCertDelete_Args CascadeServerCertDelete [name] -CMD_CascadeServerCertDelete_[name] 設定を変更するカスケード接続の名前を指定します。 - - -# CascadeServerCertGet コマンド -CMD_CascadeServerCertGet カスケード接続のサーバー固有証明書の取得 -CMD_CascadeServerCertGet_Help 現在管理している仮想 HUB に登録されているカスケード接続を指定し、そのカスケード接続にサーバー固有証明書が登録されている場合は、その証明書を取得して、X.509 形式の証明書ファイルとして保存します。\nこのコマンドは、クラスタとして動作している VPN Server の仮想 HUB では実行できません。 -CMD_CascadeServerCertGet_Args CascadeServerCertGet [name] [/SAVECERT:path] -CMD_CascadeServerCertGet_[name] 設定を変更するカスケード接続の名前を指定します。 -CMD_CascadeServerCertGet_SAVECERT サーバー固有証明書を X.509 形式で保存する証明書ファイル名を指定します。 - - -# CascadeDetailSet コマンド -CMD_CascadeDetailSet カスケード接続の高度な通信設定の設定 -CMD_CascadeDetailSet_Help 現在管理している仮想 HUB に登録されているカスケード接続を指定し、そのカスケード接続が VPN Server と通信する際に使用される、VPN プロトコルの通信設定をカスタマイズします。\nこのコマンドは、クラスタとして動作している VPN Server の仮想 HUB では実行できません。 -CMD_CascadeDetailSet_Args CascadeDetailSet [name] [/MAXTCP:max_connection] [/INTERVAL:interval] [/TTL:disconnect_span] [/HALF:yes|no] [/NOQOS:yes|no] -CMD_CascadeDetailSet_[name] 設定を変更するカスケード接続の名前を指定します。 -CMD_CascadeDetailSet_MAXTCP VPN 通信に使用する TCP コネクション数を、1 以上 32 以下の整数で指定します。VPN Server との間の VPN 通信セッションにおけるデータ伝送に、複数本の TCP コネクションを束ねて使用することにより、通信速度を向上できる場合があります。\n注意: サーバーへの接続回線が高速な場合は 8 本程度を、ダイヤルアップ等の低速な場合は 1 本をお勧めします。 -CMD_CascadeDetailSet_INTERVAL 複数の TCP コネクションを確立して VPN 通信を行うとき、各 TCP コネクションの確立間隔を秒単位で指定します。規定値は 1 秒です。 -CMD_CascadeDetailSet_TTL 各 TCP コネクションの寿命を設定する場合は、TCP コネクションが確立されてから切断されるまでの寿命を、秒数で指定します。0 を指定すると、寿命は設定されません。 -CMD_CascadeDetailSet_HALF 半二重モードを有効にする場合は "yes" を指定します。2 本以上の TCP コネクションを束ねて VPN 通信を行う際、「半二重モード」を使用することができます。半二重モードを有効にすると、自動的に各 TCP コネクションのデータ伝送方向を半数ずつ固定することができます。たとえば、8 本の TCP コネクションを使用して VPN セッションを確立した場合、半二重モードを有効にすると、4 本の TCP コネクションはアップロード方向専用、残りの 4 本のコネクションはダウンロード方向専用に固定され通信が行われます。 -CMD_CascadeDetailSet_NOQOS VoIP / QoS 対応機能を無効にする場合は "yes" を指定します。通常は "no" を指定します。 -CMD_CascadeDetailSet_Eval_MaxTcp TCP コネクション数は 1 から 32 の間で指定してください。 -CMD_CascadeDetailSet_Eval_Interval TCP コネクションの確立間隔は 1 秒以上を指定してください。 -CMD_CascadeDetailSet_Prompt_MaxTcp VPN 通信に使用する TCP コネクション数: -CMD_CascadeDetailSet_Prompt_Interval 各 TCP コネクションの確立間隔: -CMD_CascadeDetailSet_Prompt_TTL 各 TCP コネクションの寿命 (0 で無し): -CMD_CascadeDetailSet_Prompt_HALF 半二重モードを有効にする (yes/no): - - -# CascadePolicySet コマンド -CMD_CascadePolicySet カスケード接続セッションのセキュリティポリシーの設定 -CMD_CascadePolicySet_Help 現在管理している仮想 HUB に登録されているカスケード接続を指定し、そのカスケード接続が確立した際に、仮想 HUB で生成されるセッションに適用するセキュリティポリシーの内容を変更します。\n仮想 HUB が別の VPN Server にカスケード接続すると、カスケード接続元の仮想 HUB には「カスケードセッション」が新しく生成されます。そのカスケードセッションに設定するセキュリティポリシーの内容を、このコマンドで設定することができます。\nこのコマンドは、クラスタとして動作している VPN Server の仮想 HUB では実行できません。 -CMD_CascadePolicySet_Args [name] [/NAME:policy_name] [/VALUE:num|yes|no] -CMD_CascadePolicySet_[name] 設定を変更するカスケード接続の名前を指定します。 -CMD_CascadePolicySet_NAME 値を変更するポリシーの名前を指定します。ポリシーの名前と、設定できる値の一覧は PolicyList コマンドで表示することができます。 -CMD_CascadePolicySet_VALUE ポリシーの新しい値を指定します。そのポリシーが数値型の場合は整数を指定します。ブール型の場合は yes または no を指定します。設定できる型と値は PolicyList コマンドで表示することができます。 -CMD_CascadePolicySet_PROMPT_POLNAME 値を変更するポリシーの名前: -CMD_CascadePolicySet_PROMPT_POLVALUE 新しく設定する値: -CMD_CascadePolicySet_Invalid_Name 指定されたポリシー名 "%S" は不正です。\nPolicyList コマンドで設定できるポリシー名の一覧を確認してください。 -CMD_CascadePolicySet_Invalid_Name_For_Cascade 指定されたポリシー名 "%S" はカスケード接続のセキュリティポリシー設定では使用できません。 -CMD_CascadePolicySet_Invalid_Range ポリシー "%S" は %s の範囲で指定してください。 - - -# PolicyList コマンド -CMD_PolicyList セキュリティポリシーの種類と設定可能値の一覧を表示 -CMD_PolicyList_Help VPN Server のユーザーやグループ、カスケード接続に対して設定することができるセキュリティポリシー内の項目の名前、説明、および設定できる値の一覧を表示します。\nPolicyList コマンドに何も引数を指定せずに起動すると、サポートされているすべてのセキュリティポリシーの名前と説明の一覧が表示されます。\nPolicyList コマンドの引数で名前を指定すると、その値に関する詳細な説明と、設定できる値の型および範囲が表示されます。 -CMD_PolicyList_Args PolicyList [name] -CMD_PolicyList_[name] 説明を表示するポリシー名を指定します。指定しない場合は、サポートされているすべてのセキュリティポリシーの名前と、説明の一覧が表示されます。 -CMD_PolicyList_Invalid_Name 指定されたセキュリティポリシー名が不正です。 -CMD_PolicyList_Column_1 ポリシー名 -CMD_PolicyList_Column_2 ポリシーの簡易説明 -CMD_PolicyList_Column_3 設定値 -CMD_PolicyList_Help_1 [ポリシー名] -CMD_PolicyList_Help_2 [ポリシーの簡易説明] -CMD_PolicyList_Help_3 [設定できる値の範囲] -CMD_PolicyList_Help_4 [デフォルト値] -CMD_PolicyList_Help_5 [ポリシーの詳細説明] -CMD_PolicyList_Range_Bool はい (Yes) または いいえ (No) -CMD_PolicyList_Range_Int_1 %s 以上 %s 以下 (0 は指定できない) -CMD_PolicyList_Range_Int_2 %s 以上 %s 以下 (ただし 0 を指定すると設定無し) - - -# CascadeStatusGet コマンド -CMD_CascadeStatusGet カスケード接続の現在の状態の取得 -CMD_CascadeStatusGet_Help 現在管理している仮想 HUB に登録されているカスケード接続を指定し、そのカスケード接続が現在オンラインである場合は、その接続状態やその他の情報を取得します。\nこのコマンドは、クラスタとして動作している VPN Server の仮想 HUB では実行できません。 -CMD_CascadeStatusGet_Args CascadeStatusGet [name] -CMD_CascadeStatusGet_[name] 情報を取得するカスケード接続の名前を指定します。 - - -# CascadeRename コマンド -CMD_CascadeRename カスケード接続の名前の変更 -CMD_CascadeRename_Help 現在管理している仮想 HUB に登録されているカスケード接続を指定し、そのカスケード接続の名前を変更します。\nこのコマンドは、クラスタとして動作している VPN Server の仮想 HUB では実行できません。 -CMD_CascadeRename_Args CascadeRename [name] [/NEW:new_name] -CMD_CascadeRename_[name] 名前を変更するカスケード接続の現在の名前を指定します。 -CMD_CascadeRename_NEW 変更後の新しい名前を指定します。 -CMD_CascadeRename_PROMPT_OLD 現在の名前: -CMD_CascadeRename_PROMPT_NEW 新しい名前: - - - -# CascadeOnline コマンド -CMD_CascadeOnline カスケード接続のオンライン状態への設定 -CMD_CascadeOnline_Help 現在管理している仮想 HUB に登録されているカスケード接続を指定し、そのカスケード接続をオンライン化します。オンライン状態になったカスケード接続は、接続設定に従って、接続先の VPN Server への接続処理を開始します。オンライン状態になったカスケード接続は、CascadeOffline コマンドでオフライン状態に設定するまで、VPN Server に常時接続または接続を試行し続けます。\nこのコマンドは、クラスタとして動作している VPN Server の仮想 HUB では実行できません。 -CMD_CascadeOnline_Args CascadeOnline [name] -CMD_CascadeOnline_[name] オンライン状態にするカスケード接続の名前を指定します。 - - -# CascadeOffline コマンド -CMD_CascadeOffline カスケード接続のオフライン状態への設定 -CMD_CascadeOffline_Help 現在管理している仮想 HUB に登録されているカスケード接続を指定し、そのカスケード接続をオフライン化します。オフライン化されたカスケード接続は、次に CascadeOnline コマンドでオンライン状態に設定するまで VPN Server に対して接続しません。\nこのコマンドは、クラスタとして動作している VPN Server の仮想 HUB では実行できません。 -CMD_CascadeOffline_Args CascadeOffline [name] -CMD_CascadeOffline_[name] オフライン状態にするカスケード接続の名前を指定します。 - - -# AccessAdd コマンド -CMD_AccessAdd アクセスリストへのルールの追加 (IPv4) -CMD_AccessAdd_Help 現在管理している仮想 HUB のアクセスリストに、新しいルールを追加します。\nアクセスリストとは、仮想 HUB 内を流れるパケットに対して適用されるパケットフィルタルールの集合です。アクセスリストには複数のルールを登録することができ、各ルールごとに優先順位を定義することができます。すべてのパケットは、アクセスリストに登録されているルールで指定された条件に、最初に一致したルールで規定されている動作で、通過または破棄が決定されます。どのルールの条件にも一致しなかったパケットは、暗黙で通過を許可されます。なお、AccessAddEx コマンドを使用することで、通過時に遅延・ジッタ・パケットロスを発生させることもできます。\nこのコマンドは、VPN Bridge では実行できません。\nこのコマンドは、クラスタ内でクラスタメンバサーバーとして動作している VPN Server の仮想 HUB では実行できません。 -CMD_AccessAdd_Args AccessAdd [pass|discard] [/MEMO:memo] [/PRIORITY:priority] [/SRCUSERNAME:username] [/DESTUSERNAME:username] [/SRCMAC:mac/mask] [/DESTMAC:mac/mask] [/SRCIP:ip/mask] [/DESTIP:ip/mask] [/PROTOCOL:tcp|udp|icmpv4|icmpv6|ip|num] [/SRCPORT:start-end] [/DESTPORT:start-end] [/TCPSTATE:established|unestablished] -CMD_AccessAdd_[pass|discard] パケットが、このルールの条件に一致した場合の動作を決定します。pass を指定すると [通過] を、discard を指定すると [破棄] を意味します。 -CMD_AccessAdd_MEMO ルールの説明 (メモ) を指定します。 -CMD_AccessAdd_PRIORITY ルールの優先順位を 1 以上の整数で指定します。優先順位は小さいものほど優先度が高くなります。 -CMD_AccessAdd_SRCIP ルールの条件として、送信元 IPv4 アドレスを "IPアドレス/マスク" の形式で指定します。IP アドレスは 192.168.0.1 のように 10 進数をドットで区切って指定します。マスクは 255.255.255.0 のように 10 進数をドットで区切って指定するか、24 のように先頭からのビット長を 10 進数で指定できます。0.0.0.0/0.0.0.0 を指定すると、すべてのホストを示します。 -CMD_AccessAdd_DESTIP ルールの条件として、宛先 IPv4 アドレスを "IPアドレス/マスク" の形式で指定します。指定方法は /SRCIP パラメータと同様です。 -CMD_AccessAdd_PROTOCOL ルールの条件として、プロトコルの種類を指定します。IP プロトコル番号を 10 進数で入力するか、"tcp" (TCP/IP プロトコル、6 番)、"udp" (UDP/IP プロトコル、17番)、"icmpv4" (ICMPv4 プロトコル、1 番)、"icmpv6" (ICMPv6 プロトコル、58 番)、"ip" (すべての IP プロトコル、0 番) のキーワードを指定します。すべての IP プロトコルを対象とするには 0 を指定します。 -CMD_AccessAdd_SRCPORT プロトコルが TCP/IP または UDP/IP の場合は、ルールの条件として、送信元ポート番号を指定します。それ以外のプロトコルの場合は無視されます。このパラメータを指定しない場合は、すべてのポート番号が対象となります。指定方法は、"1-1024" (1 番以上 1024 番以下)、"23" (23 番のみ) などのように指定します。 -CMD_AccessAdd_DESTPORT プロトコルが TCP/IP または UDP/IP の場合は、ルールの条件として、宛先ポート番号を指定します。それ以外のプロトコルの場合は無視されます。指定方法は /SRCPORT パラメータと同様です。 -CMD_AccessAdd_SRCUSERNAME ルールの条件として、指定された名前のユーザーまたはグループのセッションによって送信されたパケットのみに、このルールを適用することができます。その場合は、ユーザー名またはグループ名を指定します。 -CMD_AccessAdd_DESTUSERNAME ルールの条件として、指定された名前のユーザーまたはグループのユーザーのセッションが受信するパケットのみに、このルールを適用することができます。その場合は、ユーザー名またはグループ名を指定します。 -CMD_AccessAdd_SRCMAC ルールの条件として、送信元 MAC アドレスを指定します。MAC アドレスは 00-AC-84-EA-33-BC/FF-FF-FF-FF-FF-00 のように 16 進数と "-" か ":" の区切り文字を使用して指定します。区切り文字は省略できます。 -CMD_AccessAdd_DESTMAC ルールの条件として、宛先 MAC アドレスを指定します。指定方法は、/SRCMAC パラメータと同様です。 -CMD_AccessAdd_TCPSTATE ルールの条件として、TCP コネクションの状態を指定します。 Established または Unestablished を指定します。 -CMD_AccessAdd_Prompt_TYPE pass または discard: -CMD_AccessAdd_Prompt_MEMO ルールの説明 (メモ): -CMD_AccessAdd_Prompt_PRIORITY ルールの優先順位: -CMD_AccessAdd_Eval_PRIORITY 優先順位は 1 以上の整数で指定してください。 -CMD_AccessAdd_Prompt_SRCIP 送信元 IP アドレス (0.0.0.0/0 ですべて): -CMD_AccessAdd_Prompt_DESTIP 宛先 IP アドレス (0.0.0.0/0 ですべて): -CMD_AccessAdd_Prompt_PROTOCOL プロトコル番号またはプロトコル名 (tcp/udp/icmpv4/icmpv6/ip): -CMD_AccessAdd_Prompt_SRCPORT 送信元ポート番号の範囲 (tcp/udp の場合のみ): -CMD_AccessAdd_Prompt_DESTPORT 宛先ポート番号の範囲 (tcp/udp の場合のみ): -CMD_AccessAdd_Prompt_SRCUSERNAME 送信ユーザー名 (無指定ですべて): -CMD_AccessAdd_Prompt_DESTUSERNAME 受信ユーザー名 (無指定ですべて): -CMD_AccessAdd_Prompt_SRCMAC 送信元 MAC アドレスとマスク(無指定ですべて): -CMD_AccessAdd_Prompt_DESTMAC 宛先 MAC アドレスとマスク(無指定ですべて): -CMD_AccessAdd_Prompt_TCPSTATE TCP コネクションの状態 (Established/Unestablished): - - -# AccessAddEx コマンド -CMD_AccessAddEx アクセスリストへのルールの追加 (IPv4, 遅延・ジッタ・パケットロス設定可能) -CMD_AccessAddEx_Help 現在管理している仮想 HUB のアクセスリストに、新しいルールを追加します。通過時に遅延・ジッタ・パケットロスを発生させることができます。\nアクセスリストとは、仮想 HUB 内を流れるパケットに対して適用されるパケットフィルタルールの集合です。アクセスリストには複数のルールを登録することができ、各ルールごとに優先順位を定義することができます。すべてのパケットは、アクセスリストに登録されているルールで指定された条件に、最初に一致したルールで規定されている動作で、通過または破棄が決定されます。どのルールの条件にも一致しなかったパケットは、暗黙で通過を許可されます。\nこのコマンドは、VPN Bridge では実行できません。\nこのコマンドは、クラスタ内でクラスタメンバサーバーとして動作している VPN Server の仮想 HUB では実行できません。 -CMD_AccessAddEx_Args AccessAddEx [pass|discard] [/MEMO:memo] [/PRIORITY:priority] [/SRCUSERNAME:username] [/DESTUSERNAME:username] [/SRCMAC:mac/mask] [/DESTMAC:mac/mask] [/SRCIP:ip/mask] [/DESTIP:ip/mask] [/PROTOCOL:tcp|udp|icmpv4|icmpv6|ip|num] [/SRCPORT:start-end] [/DESTPORT:start-end] [/SRCUSERNAME:username] [/DESTUSERNAME:username] [/TCPSTATE:established|unestablished] [/DELAY:delay_millisec] [/JITTER:jitter_percent] [/LOSS:loss_percent] [/REDIRECTURL:url] -CMD_AccessAddEx_[pass|discard] パケットが、このルールの条件に一致した場合の動作を決定します。pass を指定すると [通過] を、discard を指定すると [破棄] を意味します。遅延・ジッタ・パケットロス設定は、pass の場合のみ適用されます。 -CMD_AccessAddEx_MEMO ルールの説明 (メモ) を指定します。 -CMD_AccessAddEx_PRIORITY ルールの優先順位を 1 以上の整数で指定します。優先順位は小さいものほど優先度が高くなります。 -CMD_AccessAddEx_SRCIP ルールの条件として、送信元 IPv4 アドレスを "IPアドレス/マスク" の形式で指定します。IP アドレスは 192.168.0.1 のように 10 進数をドットで区切って指定します。マスクは 255.255.255.0 のように 10 進数をドットで区切って指定するか、24 のように先頭からのビット長を 10 進数で指定できます。0.0.0.0/0.0.0.0 を指定すると、すべてのホストを示します。 -CMD_AccessAddEx_DESTIP ルールの条件として、宛先 IPv4 アドレスを "IPアドレス/マスク" の形式で指定します。指定方法は /SRCIP パラメータと同様です。 -CMD_AccessAddEx_PROTOCOL ルールの条件として、プロトコルの種類を指定します。IP プロトコル番号を 10 進数で入力するか、"tcp" (TCP/IP プロトコル、6 番)、"udp" (UDP/IP プロトコル、17番)、"icmpv4" (ICMPv4 プロトコル、1 番)、"icmpv6" (ICMPv6 プロトコル、58 番)、"ip" (すべての IP プロトコル、0 番) のキーワードを指定します。すべての IP プロトコルを対象とするには 0 を指定します。 -CMD_AccessAddEx_SRCPORT プロトコルが TCP/IP または UDP/IP の場合は、ルールの条件として、送信元ポート番号を指定します。それ以外のプロトコルの場合は無視されます。このパラメータを指定しない場合は、すべてのポート番号が対象となります。指定方法は、"1-1024" (1 番以上 1024 番以下)、"23" (23 番のみ) などのように指定します。 -CMD_AccessAddEx_DESTPORT プロトコルが TCP/IP または UDP/IP の場合は、ルールの条件として、宛先ポート番号を指定します。それ以外のプロトコルの場合は無視されます。指定方法は /SRCPORT パラメータと同様です。 -CMD_AccessAddEx_SRCUSERNAME ルールの条件として、指定された名前のユーザーまたはグループのセッションによって送信されたパケットのみに、このルールを適用することができます。その場合は、ユーザー名またはグループ名を指定します。 -CMD_AccessAddEx_DESTUSERNAME ルールの条件として、指定された名前のユーザーまたはグループのセッションが受信するパケットのみに、このルールを適用することができます。その場合は、ユーザー名またはグループ名を指定します。 -CMD_AccessAddEx_SRCMAC ルールの条件として、送信元 MAC アドレスを指定します。MAC アドレスは 00-AC-84-EA-33-BC/FF-FF-FF-FF-FF-00 のように 16 進数と "-" か ":" の区切り文字を使用して指定します。区切り文字は省略できます。 -CMD_AccessAddEx_DESTMAC ルールの条件として、宛先 MAC アドレスを指定します。指定方法は、/SRCMAC パラメータと同様です。 -CMD_AccessAddEx_TCPSTATE ルールの条件として、TCP コネクションの状態を指定します。Established または Unestablished を指定します。 -CMD_AccessAddEx_DELAY このルールによってパケットが通過する場合に遅延を発生させることができます。発生させたい遅延時間をミリ秒単位で指定します。無指定または 0 を指定すると、遅延は発生しません。遅延は 10000 ミリ秒以下である必要があります。 -CMD_AccessAddEx_JITTER このルールによってパケットが通過する場合にジッタを発生させることができます。遅延の値に対してジッタの揺らぎを 0% ~ 100% のパーセント数値で指定します。無指定または 0 を指定すると、ジッタは発生しません。 -CMD_AccessAddEx_LOSS このルールによってパケットが通過する場合にパケットロスを発生させることができます。パケットが破棄される可能性を 0% ~ 100% のパーセント数値で指定します。無指定または 0 を指定すると、パケットロスは発生しません。 -CMD_AccessAddEx_REDIRECTURL HTTP リクエストに対するリダイレクト先の URL を指定することができます。仮想 HUB を経由する TCP コネクションがこのアクセスリストの条件に一致した場合、その TCP コネクションを用いてクライアントが何らかの通信を行おうとすると、強制的に設定された URL 文字列をクライアントに対して応答します。これにより、VPN クライアント上で起動している Web ブラウザが特定の IP アドレスにアクセスした場合などに任意の Web ページをその Web ブラウザ上に表示させることができます。 - -CMD_AccessAddEx_Prompt_DELAY 発生させる遅延 (ミリ秒単位: 0 - 10000): -CMD_AccessAddEx_Prompt_JITTER 発生させるジッタの揺らぎ (パーセント単位: 0 - 100): -CMD_AccessAddEx_Prompt_LOSS 発生させるパケットロス率 (パーセント単位: 0 - 100): -CMD_AccessAddEx_Eval_DELAY 遅延は 0 - 10000 の整数で設定してください。 -CMD_AccessAddEx_Eval_JITTER ジッタの揺らぎは 0 - 100 の整数で指定してください。 -CMD_AccessAddEx_Eval_LOSS パケットロス率は 0 - 100 の整数で指定してください。 - - - -# AccessAdd6 コマンド -CMD_AccessAdd6 アクセスリストへのルールの追加 (IPv6) -CMD_AccessAdd6_Help 現在管理している仮想 HUB のアクセスリストに、新しいルールを追加します。\nアクセスリストとは、仮想 HUB 内を流れるパケットに対して適用されるパケットフィルタルールの集合です。アクセスリストには複数のルールを登録することができ、各ルールごとに優先順位を定義することができます。すべてのパケットは、アクセスリストに登録されているルールで指定された条件に、最初に一致したルールで規定されている動作で、通過または破棄が決定されます。どのルールの条件にも一致しなかったパケットは、暗黙で通過を許可されます。なお、AccessAddEx6 コマンドを使用することで、通過時に遅延・ジッタ・パケットロスを発生させることもできます。\nこのコマンドは、VPN Bridge では実行できません。\nこのコマンドは、クラスタ内でクラスタメンバサーバーとして動作している VPN Server の仮想 HUB では実行できません。 -CMD_AccessAdd6_Args AccessAdd6 [pass|discard] [/MEMO:memo] [/PRIORITY:priority] [/SRCUSERNAME:username] [/DESTUSERNAME:username] [/SRCMAC:mac/mask] [/DESTMAC:mac/mask] [/SRCIP:ip/mask] [/DESTIP:ip/mask] [/PROTOCOL:tcp|udp|icmpv4|icmpv6|ip|num] [/SRCPORT:start-end] [/DESTPORT:start-end] [/SRCUSERNAME:username] [/DESTUSERNAME:username] [/TCPSTATE:established|unestablished] -CMD_AccessAdd6_[pass|discard] パケットが、このルールの条件に一致した場合の動作を決定します。pass を指定すると [通過] を、discard を指定すると [破棄] を意味します。 -CMD_AccessAdd6_MEMO ルールの説明 (メモ) を指定します。 -CMD_AccessAdd6_PRIORITY ルールの優先順位を 1 以上の整数で指定します。優先順位は小さいものほど優先度が高くなります。 -CMD_AccessAdd6_SRCIP ルールの条件として、送信元 IPv6 アドレスを "IPアドレス/マスク" の形式で指定します。IPv6 アドレスは 2001:200:0:1:: のように 16 進数をコロンで区切って指定します。マスクは ffff:ffff:ffff:ffff:: のように IPv6 形式で区切って指定するか、64 のように先頭からのビット長を 10 進数で指定します。単一の IPv6 ホストを指定するには、マスクを ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff または 128 として指定します。すべての IPv6 ホストを指定するには、"::/0" と指定します。 -CMD_AccessAdd6_DESTIP ルールの条件として、宛先 IPv6 アドレスを "IPアドレス/マスク" の形式で指定します。指定方法は /SRCIP パラメータと同様です。 -CMD_AccessAdd6_PROTOCOL ルールの条件として、プロトコルの種類を指定します。IP プロトコル番号を 10 進数で入力するか、"tcp" (TCP/IP プロトコル、6 番)、"udp" (UDP/IP プロトコル、17番)、"icmpv4" (ICMPv4 プロトコル、1 番)、"icmpv6" (ICMPv6 プロトコル、58 番)、"ip" (すべての IP プロトコル、0 番) のキーワードを指定します。すべての IP プロトコルを対象とするには 0 を指定します。 -CMD_AccessAdd6_SRCPORT プロトコルが TCP/IP または UDP/IP の場合は、ルールの条件として、送信元ポート番号を指定します。それ以外のプロトコルの場合は無視されます。このパラメータを指定しない場合は、すべてのポート番号が対象となります。指定方法は、"1-1024" (1 番以上 1024 番以下)、"23" (23 番のみ) などのように指定します。 -CMD_AccessAdd6_DESTPORT プロトコルが TCP/IP または UDP/IP の場合は、ルールの条件として、宛先ポート番号を指定します。それ以外のプロトコルの場合は無視されます。指定方法は /SRCPORT パラメータと同様です。 -CMD_AccessAdd6_SRCUSERNAME ルールの条件として、指定された名前のユーザーまたはグループのセッションによって送信されたパケットのみに、このルールを適用することができます。その場合は、ユーザー名またはグループ名を指定します。 -CMD_AccessAdd6_DESTUSERNAME ルールの条件として、指定された名前のユーザーまたはグループのセッションが受信するパケットのみに、このルールを適用することができます。その場合は、ユーザー名またはグループ名を指定します。 -CMD_AccessAdd6_SRCMAC ルールの条件として、送信元 MAC アドレスを指定します。MAC アドレスは 00-AC-84-EA-33-BC/FF-FF-FF-FF-FF-00 のように 16 進数と "-" か ":" の区切り文字を使用して指定します。区切り文字は省略できます。 -CMD_AccessAdd6_DESTMAC ルールの条件として、宛先 MAC アドレスを指定します。指定方法は、/SRCMAC パラメータと同様です。 -CMD_AccessAdd6_TCPSTATE ルールの条件として、TCP コネクションの状態を指定します。 Established または Unestablished を指定します。 -CMD_AccessAdd6_Prompt_TYPE pass または discard: -CMD_AccessAdd6_Prompt_MEMO ルールの説明 (メモ): -CMD_AccessAdd6_Prompt_PRIORITY ルールの優先順位: -CMD_AccessAdd6_Eval_PRIORITY 優先順位は 1 以上の整数で指定してください。 -CMD_AccessAdd6_Prompt_SRCIP 送信元 IPv6 アドレス (::/0 ですべて): -CMD_AccessAdd6_Prompt_DESTIP 宛先 IPv6 アドレス (::/0 ですべて): -CMD_AccessAdd6_Prompt_PROTOCOL プロトコル番号またはプロトコル名 (tcp/udp/icmpv4/icmpv6/ip): -CMD_AccessAdd6_Prompt_SRCPORT 送信元ポート番号の範囲 (tcp/udpの場合のみ): -CMD_AccessAdd6_Prompt_DESTPORT 宛先ポート番号の範囲 (tcp/udpの場合のみ): -CMD_AccessAdd6_Prompt_SRCUSERNAME 送信ユーザー名 (無指定ですべて): -CMD_AccessAdd6_Prompt_DESTUSERNAME 受信ユーザー名 (無指定ですべて): -CMD_AccessAdd6_Prompt_SRCMAC 送信元 MAC アドレスとマスク(無指定ですべて): -CMD_AccessAdd6_Prompt_DESTMAC 宛先 MAC アドレスとマスク(無指定ですべて): -CMD_AccessAdd6_Prompt_TCPSTATE TCP コネクションの状態(Established/Unestablished): - - -# AccessAddEx6 コマンド -CMD_AccessAddEx6 アクセスリストへのルールの追加 (IPv6, 遅延・ジッタ・パケットロス設定可能) -CMD_AccessAddEx6_Help 現在管理している仮想 HUB のアクセスリストに、新しいルールを追加します。通過時に遅延・ジッタ・パケットロスを発生させることができます。\nアクセスリストとは、仮想 HUB 内を流れるパケットに対して適用されるパケットフィルタルールの集合です。アクセスリストには複数のルールを登録することができ、各ルールごとに優先順位を定義することができます。すべてのパケットは、アクセスリストに登録されているルールで指定された条件に、最初に一致したルールで規定されている動作で、通過または破棄が決定されます。どのルールの条件にも一致しなかったパケットは、暗黙で通過を許可されます。\nこのコマンドは、VPN Bridge では実行できません。\nこのコマンドは、クラスタ内でクラスタメンバサーバーとして動作している VPN Server の仮想 HUB では実行できません。 -CMD_AccessAddEx6_Args AccessAddEx6 [pass|discard] [/MEMO:memo] [/PRIORITY:priority] [/SRCUSERNAME:username] [/DESTUSERNAME:username] [/SRCMAC:mac/mask] [/DESTMAC:mac/mask] [/SRCIP:ip/mask] [/DESTIP:ip/mask] [/PROTOCOL:tcp|udp|icmpv4|icmpv6|ip|num] [/SRCPORT:start-end] [/DESTPORT:start-end] [/SRCUSERNAME:username] [/DESTUSERNAME:username] [/TCPSTATE:established|unestablished] [/DELAY:delay_millisec] [/JITTER:jitter_percent] [/LOSS:loss_percent] [/REDIRECTURL:url] -CMD_AccessAddEx6_[pass|discard] パケットが、このルールの条件に一致した場合の動作を決定します。pass を指定すると [通過] を、discard を指定すると [破棄] を意味します。遅延・ジッタ・パケットロス設定は、pass の場合のみ適用されます。 -CMD_AccessAddEx6_MEMO ルールの説明 (メモ) を指定します。 -CMD_AccessAddEx6_PRIORITY ルールの優先順位を 1 以上の整数で指定します。優先順位は小さいものほど優先度が高くなります。 -CMD_AccessAddEx6_SRCIP ルールの条件として、送信元 IPv6 アドレスを "IPアドレス/マスク" の形式で指定します。IPv6 アドレスは 2001:200:0:1:: のように 16 進数をコロンで区切って指定します。マスクは ffff:ffff:ffff:ffff:: のように IPv6 形式で区切って指定するか、64 のように先頭からのビット長を 10 進数で指定します。単一の IPv6 ホストを指定するには、マスクを ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff または 128 として指定します。すべての IPv6 ホストを指定するには、"::/0" と指定します。 -CMD_AccessAddEx6_DESTIP ルールの条件として、宛先 IPv6 アドレスを "IPアドレス/マスク" の形式で指定します。指定方法は /SRCIP パラメータと同様です。 -CMD_AccessAddEx6_PROTOCOL ルールの条件として、プロトコルの種類を指定します。IP プロトコル番号を 10 進数で入力するか、"tcp" (TCP/IP プロトコル、6 番)、"udp" (UDP/IP プロトコル、17番)、"icmpv4" (ICMPv4 プロトコル、1 番)、"icmpv6" (ICMPv6 プロトコル、58 番)、"ip" (すべての IP プロトコル、0 番) のキーワードを指定します。すべての IP プロトコルを対象とするには 0 を指定します。 -CMD_AccessAddEx6_SRCPORT プロトコルが TCP/IP または UDP/IP の場合は、ルールの条件として、送信元ポート番号を指定します。それ以外のプロトコルの場合は無視されます。このパラメータを指定しない場合は、すべてのポート番号が対象となります。指定方法は、"1-1024" (1 番以上 1024 番以下)、"23" (23 番のみ) などのように指定します。 -CMD_AccessAddEx6_DESTPORT プロトコルが TCP/IP または UDP/IP の場合は、ルールの条件として、宛先ポート番号を指定します。それ以外のプロトコルの場合は無視されます。指定方法は /SRCPORT パラメータと同様です。 -CMD_AccessAddEx6_SRCUSERNAME ルールの条件として、指定された名前のユーザーまたはグループのセッションによって送信されたパケットのみに、このルールを適用することができます。その場合は、ユーザー名またはグループ名を指定します。 -CMD_AccessAddEx6_DESTUSERNAME ルールの条件として、指定された名前のユーザーまたはグループのセッションが受信するパケットのみに、このルールを適用することができます。その場合は、ユーザー名またはグループ名を指定します。 -CMD_AccessAddEx6_SRCMAC ルールの条件として、送信元 MAC アドレスを指定します。MAC アドレスは 00-AC-84-EA-33-BC/FF-FF-FF-FF-FF-00 のように 16 進数と "-" か ":" の区切り文字を使用して指定します。区切り文字は省略できます。 -CMD_AccessAddEx6_DESTMAC ルールの条件として、宛先 MAC アドレスを指定します。指定方法は、/SRCMAC パラメータと同様です。 -CMD_AccessAddEx6_TCPSTATE ルールの条件として、TCP コネクションの状態を指定します。 Established または Unestablished を指定します。 -CMD_AccessAddEx6_DELAY このルールによってパケットが通過する場合に遅延を発生させることができます。発生させたい遅延時間をミリ秒単位で指定します。無指定または 0 を指定すると、遅延は発生しません。ジッタは 10000 ミリ秒以下である必要があります。 -CMD_AccessAddEx6_JITTER このルールによってパケットが通過する場合にジッタを発生させることができます。遅延の値に対してジッタの揺らぎを 0% ~ 100% のパーセント数値で指定します。無指定または 0 を指定すると、ジッタは発生しません。 -CMD_AccessAddEx6_LOSS このルールによってパケットが通過する場合にパケットロスを発生させることができます。パケットが破棄される可能性を 0% ~ 100% のパーセント数値で指定します。無指定または 0 を指定すると、パケットロスは発生しません。 -CMD_AccessAddEx6_REDIRECTURL HTTP リクエストに対するリダイレクト先の URL を指定することができます。仮想 HUB を経由する TCP コネクションがこのアクセスリストの条件に一致した場合、その TCP コネクションを用いてクライアントが何らかの通信を行おうとすると、設定された URL 文字列をクライアントに対して応答します。これにより、VPN クライアント上で起動している Web ブラウザが特定の IP アドレスにアクセスした場合などに任意の Web ページをその Web ブラウザ上に表示させることができます。 - -CMD_AccessAddEx6_Prompt_DELAY 発生させる遅延 (ミリ秒単位: 0 - 10000): -CMD_AccessAddEx6_Prompt_JITTER 発生させるジッタの揺らぎ (パーセント単位: 0 - 100): -CMD_AccessAddEx6_Prompt_LOSS 発生させるパケットロス率 (パーセント単位: 0 - 100): -CMD_AccessAddEx6_Eval_DELAY 遅延は 0 - 10000 の整数で設定してください。 -CMD_AccessAddEx6_Eval_JITTER ジッタの揺らぎは 0 - 100 の整数で指定してください。 -CMD_AccessAddEx6_Eval_LOSS パケットロス率は 0 - 100 の整数で指定してください。 - - - - - -# AccessList コマンド -CMD_AccessList アクセスリストのルール一覧の取得 -CMD_AccessList_Help 現在管理している仮想 HUB のアクセスリストに登録されている、パケットフィルタルールの一覧を取得します。\nアクセスリストとは、仮想 HUB 内を流れるパケットに対して適用されるパケットフィルタルールの集合です。アクセスリストには複数のルールを登録することができ、ルール毎に優先順位を定義することができます。すべてのパケットは、アクセスリストに登録されているルールで指定された条件に、最初に一致したルールで規定されている動作で、通過または破棄が決定されます。どのルールの条件にも一致しなかったパケットは、暗黙で通過を許可されます。\nこのコマンドは、VPN Bridge では実行できません。\nこのコマンドは、クラスタ内でクラスタメンバサーバーとして動作している VPN Server の仮想 HUB では実行できません。 -CMD_AccessList_Args AccessList - - -# AccessDelete コマンド -CMD_AccessDelete アクセスリストからルールを削除 -CMD_AccessDelete_Help 現在管理している仮想 HUB のアクセスリストに登録されている、パケットフィルタルールを指定して削除します。\nルールを削除するには、そのルールの ID を指定する必要があります。ID は AccessList コマンドで表示できます。\nなお、ルールを削除しなくても一時的に無効化するには AccessDisable コマンドを使用します。\nこのコマンドは、VPN Bridge では実行できません。\nこのコマンドは、クラスタ内でクラスタメンバサーバーとして動作している VPN Server の仮想 HUB では実行できません。 -CMD_AccessDelete_Args AccessDelete [id] -CMD_AccessDelete_[id] 削除するルールの ID またはユニーク ID を指定します。 -CMD_Access_Prompt_ID アクセスリストのルール ID またはユニーク ID: - - -# AccessEnable コマンド -CMD_AccessEnable アクセスリストのルールの有効化 -CMD_AccessEnable_Help 現在管理している仮想 HUB のアクセスリストに登録されているパケットフィルタルールを指定して有効化します。有効化したルールは、パケットフィルタリングに使用されます。\nルールを有効化するには、そのルールの ID を指定する必要があります。ID は AccessList コマンドで表示できます。\nこのコマンドは、VPN Bridge では実行できません。\nこのコマンドは、クラスタ内でクラスタメンバサーバーとして動作している VPN Server の仮想 HUB では実行できません。 -CMD_AccessEnable_Args AccessEnable [id] -CMD_AccessEnable_[id] 有効化するルールの ID を指定します。 - - -# AccessDisable コマンド -CMD_AccessDisable アクセスリストのルールの無効化 -CMD_AccessDisable_Help 現在管理している仮想 HUB のアクセスリストに登録されているパケットフィルタルールを指定して無効化します。無効化したルールは、パケットフィルタリングに使用されなくなります。\nルールを無効化するには、そのルールの ID を指定する必要があります。ID は AccessList コマンドで表示できます。\nこのコマンドは、VPN Bridge では実行できません。\nこのコマンドは、クラスタ内でクラスタメンバサーバーとして動作している VPN Server の仮想 HUB では実行できません。 -CMD_AccessDisable_Args AccessDisable [id] -CMD_AccessDisable_[id] 無効化するルールの ID を指定します。 - - -# UserList コマンド -CMD_UserList ユーザー一覧の取得 -CMD_UserList_Help 現在管理している仮想 HUB の、セキュリティアカウントデータベースに登録されているユーザー一覧を取得します。\nこのコマンドは、VPN Bridge では実行できません。\nこのコマンドは、クラスタ内でクラスタメンバサーバーとして動作している VPN Server の仮想 HUB では実行できません。 -CMD_UserList_Args UserList - - -# UserCreate コマンド -CMD_UserCreate ユーザーの作成 -CMD_UserCreate_Help 現在管理している仮想 HUB の、セキュリティアカウントデータベースに新しいユーザーを作成します。\nユーザーを作成すると、そのユーザーの認証情報に従って、VPN Client がこの仮想 HUB に接続することができるようになります。\nUserCreate コマンドを使用してユーザーを作成した場合、そのユーザーの認証方法は [パスワード認証] として登録され、パスワードとしてランダムな文字列が割り当てられます。したがって、そのユーザーはそのままでは仮想 HUB に接続することはできません。ユーザーを作成した後、必ず UserPasswordSet コマンドでユーザーのパスワードを指定するか、UserAnonymousSet コマンド、UserCertSet コマンド、UserSignedSet コマンド、UserRadiusSet コマンドまたは UserNTLMSet コマンドでユーザーの認証方法を変更してください。\nただし、ユーザー名を "*" (アスタリスク 1 文字) として作成したユーザーは、自動的に RADIUS 認証のユーザーとして登録されます。"*" という名前のユーザーが存在する場合に限り、クライアントが VPN Server に接続した際に提示したユーザー名が既存のユーザー名と一致しないユーザーは、そのユーザーが入力したユーザー名とパスワードによって、RADIUS サーバーまたは NT ドメインコントローラによって認証されることができ、その場合の認証設定やセキュリティポリシーの設定は "*" ユーザーに設定に準拠します。\n一度作成したユーザーのユーザー情報を変更するには、UserSet コマンドを使用します。\nこのコマンドは、VPN Bridge では実行できません。\nこのコマンドは、クラスタ内でクラスタメンバサーバーとして動作している VPN Server の仮想 HUB では実行できません。 -CMD_UserCreate_Args UserCreate [name] [/GROUP:group] [/REALNAME:realname] [/NOTE:note] -CMD_UserCreate_[name] 新しく作成するユーザーのユーザー名を指定します。 -CMD_UserCreate_GROUP ユーザーをグループに参加させる場合、グループ名を指定します。ユーザーをどのグループにも所属させない場合は /GROUP:none と指定します。 -CMD_UserCreate_REALNAME ユーザーの本名を指定します。指定しない場合は、/REALNAME:none と指定します。 -CMD_UserCreate_NOTE ユーザーの説明を指定します。指定しない場合は、/NOTE:none と指定します。 -CMD_UserCreate_Prompt_NAME ユーザー名: -CMD_UserCreate_Prompt_GROUP 参加するグループ名: -CMD_UserCreate_Prompt_REALNAME ユーザーの本名: -CMD_UserCreate_Prompt_NOTE ユーザーの説明: - - -# UserSet コマンド -CMD_UserSet ユーザー情報の変更 -CMD_UserSet_Help 現在管理している仮想 HUB の、セキュリティアカウントデータベースに登録されているユーザーの情報を変更します。\nこのコマンドで変更できるユーザーの情報は、UserCreate コマンドで、新しくユーザーを作成するときに指定する「グループ名」、「本名」および「説明」の 3 項目です。\n現在登録されているユーザーの一覧を取得するには、UserList コマンドを使用してください。\nこのコマンドは、VPN Bridge では実行できません。\nこのコマンドは、クラスタ内でクラスタメンバサーバーとして動作している VPN Server の仮想 HUB では実行できません。 -CMD_UserSet_Args UserSet [name] [/GROUP:group] [/REALNAME:realname] [/NOTE:note] -CMD_UserSet_[name] 設定を変更するユーザー名を指定します。 -CMD_UserSet_GROUP ユーザーをグループに参加させる場合、グループ名を指定します。ユーザーをどのグループにも所属させない場合は /GROUP:none と指定します。 -CMD_UserSet_REALNAME ユーザーの本名を指定します。指定しない場合は、/REALNAME:none と指定します。 -CMD_UserSet_NOTE ユーザーの説明を指定します。指定しない場合は、/NOTE:none と指定します。 - - -# UserDelete コマンド -CMD_UserDelete ユーザーの削除 -CMD_UserDelete_Help 現在管理している仮想 HUB の、セキュリティアカウントデータベースに登録されているユーザーを削除します。ユーザーを削除すると、そのユーザーは仮想 HUB に接続できなくなります。\nUserPolicySet コマンドを使用すると、ユーザーを削除しなくても、一時的にログインを禁止するように設定することができます。\n現在登録されているユーザーの一覧を取得するには、UserList コマンドを使用してください。\nこのコマンドは、VPN Bridge では実行できません。\nこのコマンドは、クラスタ内でクラスタメンバサーバーとして動作している VPN Server の仮想 HUB では実行できません。 -CMD_UserDelete_Args UserDelete [name] -CMD_UserDelete_[name] 削除するユーザー名を指定します。 - - -# UserGet コマンド -CMD_UserGet ユーザー情報の取得 -CMD_UserGet_Help 現在管理している仮想 HUB の、セキュリティアカウントデータベースに登録されているユーザーの登録情報を所得します。\nこのコマンドで取得できる情報は、「ユーザー名」、「本名」、「説明」、「所属グループ」、「有効期限」、「セキュリティポリシー」、「認証方法」、および設定されている認証方法の属性として指定されているパラメータに加えて、そのユーザーの統計データです。\n現在登録されているユーザーの一覧を取得するには、UserList コマンドを使用してください。\nこのコマンドは、VPN Bridge では実行できません。\nこのコマンドは、クラスタ内でクラスタメンバサーバーとして動作している VPN Server の仮想 HUB では実行できません。 -CMD_UserGet_Args UserGet [name] -CMD_UserGet_[name] 情報を取得するユーザー名を指定します。 -CMD_UserGet_Column_Name ユーザー名 -CMD_UserGet_Column_RealName 本名 -CMD_UserGet_Column_Note 説明 -CMD_UserGet_Column_Group グループ名 -CMD_UserGet_Column_Expires 有効期限 -CMD_UserGet_Column_AuthType 認証方法 -CMD_UserGet_Column_UserCert 登録済みユーザー固有証明書 -CMD_UserGet_Column_RadiusAlias 外部認証サーバーの認証ユーザー名 -CMD_UserGet_Column_RootCert_CN 証明書の CN の値の限定 -CMD_UserGet_Column_RootCert_SERIAL 証明書のシリアル番号の限定 -CMD_UserGet_Policy このユーザーに設定されたセキュリティポリシー - - -# UserAnonymousSet コマンド -CMD_UserAnonymousSet ユーザーの認証方法を匿名認証に設定 -CMD_UserAnonymousSet_Help 現在管理している仮想 HUB の、セキュリティアカウントデータベースに登録されているユーザーの認証方法を「匿名認証」に設定します。匿名認証に設定されたユーザーのユーザー名で仮想 HUB に接続した VPN Client は、いかなるユーザー認証も受けずに無条件で仮想 HUB に接続することができます。匿名認証機能は、インターネットなどで広く誰でも接続できるような設定で公開する VPN Server に最適です。\n現在登録されているユーザーの一覧を取得するには、UserList コマンドを使用してください。\nこのコマンドは、VPN Bridge では実行できません。\nこのコマンドは、クラスタ内でクラスタメンバサーバーとして動作している VPN Server の仮想 HUB では実行できません。 -CMD_UserAnonymousSet_Args UserAnonymousSet [name] -CMD_UserAnonymousSet_[name] 設定を変更するユーザー名を指定します。 - - -# UserPasswordSet コマンド -CMD_UserPasswordSet ユーザーの認証方法をパスワード認証に設定しパスワードを設定 -CMD_UserPasswordSet_Help 現在管理している仮想 HUB の、セキュリティアカウントデータベースに登録されているユーザーの認証方法を「パスワード認証」に設定します。パスワード認証とは、仮想 HUB のセキュリティアカウントデータベース内のユーザー オブジェクトに対して任意のパスワードを設定しておき、そのユーザー名でユーザーが仮想 HUB に接続しようとした際にパスワードの入力を求め、そのパスワードが一致した場合に接続を許可する認証方法です。\n実際には、ユーザーのパスワードはハッシュ化され保存されるので、VPN Server の設定ファイルを解析しても元のパスワードはわかりません。\n現在登録されているユーザーの一覧を取得するには、UserList コマンドを使用してください。\nこのコマンドは、VPN Bridge では実行できません。\nこのコマンドは、クラスタ内でクラスタメンバサーバーとして動作している VPN Server の仮想 HUB では実行できません。 -CMD_UserPasswordSet_Args UserPasswordSet [name] [/PASSWORD:password] -CMD_UserPasswordSet_[name] 設定を変更するユーザー名を指定します。 -CMD_UserPasswordSet_PASSWORD ユーザーに対して設定するパスワードを指定します。このパラメータを指定しない場合は、パスワードを入力するプロンプトが表示されます。 - - -# UserCertSet コマンド -CMD_UserCertSet ユーザーの認証方法を固有証明書認証に設定し証明書を設定 -CMD_UserCertSet_Help 現在管理している仮想 HUB の、セキュリティアカウントデータベースに登録されているユーザーの認証方法を「固有証明書認証」に設定します。固有証明書認証とは、仮想 HUB のセキュリティアカウントデータベース内のユーザー オブジェクトに対して 1 つの X.509 証明書を設定しておき、そのユーザー名でユーザーが仮想 HUB に接続しようとした際に、提示した証明書が登録されている証明書と一致し、かつクライアントがその証明書に対応する秘密鍵を保持しているかを RSA アルゴリズムで検証することによって接続を許可する認証方法です。\n現在登録されているユーザーの一覧を取得するには、UserList コマンドを使用してください。\nこのコマンドは、VPN Bridge では実行できません。\nこのコマンドは、クラスタ内でクラスタメンバサーバーとして動作している VPN Server の仮想 HUB では実行できません。 -CMD_UserCertSet_Args UserCertSet [name] [/LOADCERT:cert] -CMD_UserCertSet_[name] 設定を変更するユーザー名を指定します。 -CMD_UserCertSet_LOADCERT ユーザーに対して設定する証明書を X.509 証明書ファイル名で指定します。 - - -# UserCertGet コマンド -CMD_UserCertGet 固有証明書認証のユーザーの登録されている証明書の取得 -CMD_UserCertGet_Help 現在管理している仮想 HUB の、セキュリティアカウントデータベースに登録されている「固有証明書認証」のユーザーに対して設定されている X.509 形式の証明書を取得し、ファイルに保存します。\n指定したユーザーが「固有証明書認証」として設定されていない場合は、エラーが発生します。\n現在登録されているユーザーの一覧を取得するには、UserList コマンドを使用してください。\nこのコマンドは、VPN Bridge では実行できません。\nこのコマンドは、クラスタ内でクラスタメンバサーバーとして動作している VPN Server の仮想 HUB では実行できません。 -CMD_UserCertGet_Args UserCertGet [name] [/SAVECERT:cert] -CMD_UserCertGet_[name] 情報を取得するユーザー名を指定します。 -CMD_UserCertGet_SAVECERT 取得したユーザーの証明書を X.509 形式で保存するファイル名を指定します。 -CMD_UserCertGet_Not_Cert ユーザーは固有証明書認証でないか、固有証明書が設定されていません。 - - -# UserSignedSet コマンド -CMD_UserSignedSet ユーザーの認証方法を署名済み証明書認証に設定 -CMD_UserSignedSet_Help 現在管理している仮想 HUB の、セキュリティアカウントデータベースに登録されているユーザーの認証方法を「署名済み証明書認証」に設定します。署名済み証明書認証に設定されているユーザー名で、ユーザーが仮想 HUB に接続した際に、ユーザーが提示した証明書がその仮想 HUB の信頼する証明機関の証明書の一覧内の証明書のいずれかによって署名されているかどうかが検査され、かつクライアントがその証明書に対応する秘密鍵を保持しているかを RSA アルゴリズムで検証することによって接続を許可する認証方法です。\nまた、ユーザーごとに期待する証明書の Common Name (CN)、およびシリアル番号を登録しておき、前記の検証を通過した後証明書の内容が設定された値に一致した場合にのみ接続を許可するようにする設定も可能です。\n現在登録されているユーザーの一覧を取得するには、UserList コマンドを使用してください。\nこのコマンドは、VPN Bridge では実行できません。\nこのコマンドは、クラスタ内でクラスタメンバサーバーとして動作している VPN Server の仮想 HUB では実行できません。 -CMD_UserSignedSet_Args UserSignedSet [name] [/CN:cn] [/SERIAL:serial] -CMD_UserSignedSet_[name] 設定を変更するユーザー名を指定します。 -CMD_UserSignedSet_CN このパラメータを指定した場合は、ユーザーが提示した証明書が信頼できる証明機関によって署名されているかどうかを検証した後に、その証明書の Common Name (CN) の値を、このパラメータによって設定された値と比較して一致している場合のみ接続を許可します。"none" を指定した場合は、このチェックは行われません。 -CMD_UserSignedSet_SERIAL このパラメータを指定した場合は、ユーザーが提示した証明書が信頼できる証明機関によって署名されているかどうかを検証した後に、その証明書のシリアル番号の値を、このパラメータによって設定された値と比較して一致している場合のみ接続を許可します。"none" を指定した場合は、このチェックは行われません。 -CMD_UserSignedSet_Prompt_CN Common Name (CN) の値を限定: -CMD_UserSignedSet_Prompt_SERIAL シリアル番号の値を限定: - - -# UserRadiusSet コマンド -CMD_UserRadiusSet ユーザーの認証方法を RADIUS 認証に設定 -CMD_UserRadiusSet_Help 現在管理している仮想 HUB の、セキュリティアカウントデータベースに登録されているユーザーの認証方法を「RADIUS 認証」に設定します。RADIUS 認証に設定されているユーザー名でユーザーが仮想 HUB に接続した際に、ユーザー名とユーザーが入力したパスワードが RADIUS サーバーに送信され、RADIUS サーバーがユーザー名とパスワードのチェックを行った後に認証が成功すると、そのユーザーの VPN 接続が許可されます。\nRadius 認証を使用するには、あらかじめ RadiusServerSet コマンドを使用して使用する RADIUS サーバーを仮想 HUB に設定しておく必要があります。\n現在登録されているユーザーの一覧を取得するには、UserList コマンドを使用してください。\nこのコマンドは、VPN Bridge では実行できません。\nこのコマンドは、クラスタ内でクラスタメンバサーバーとして動作している VPN Server の仮想 HUB では実行できません。 -CMD_UserRadiusSet_Args UserRadiusSet [name] [/ALIAS:alias_name] -CMD_UserRadiusSet_[name] 設定を変更するユーザー名を指定します。 -CMD_UserRadiusSet_ALIAS このパラメータが設定されている場合、RADIUS サーバーに対して送信されるユーザー名を、仮想 HUB 上のユーザー名とは別のユーザー名にすることが可能です。設定しない場合は、/ALIAS:none と指定してください (仮想 HUB 上のユーザー名が使用されます)。ユーザー名が "*" の場合は /ALIAS パラメータは無視されます。"*" ユーザーについての説明は、UserCreate /HELP と入力すると表示されます。 -CMD_UserRadiusSet_Prompt_ALIAS 認証用エイリアス名 (オプション): - - -# UserNTLMSet コマンド -CMD_UserNTLMSet ユーザーの認証方法を NT ドメイン認証に設定 -CMD_UserNTLMSet_Help 現在管理している仮想 HUB の、セキュリティアカウントデータベースに登録されているユーザーの認証方法を「NT ドメイン認証」に設定します。NT ドメイン認証に設定されているユーザー名でユーザーが仮想 HUB に接続した際に、ユーザー名とユーザーが入力したパスワードが Windows NT / 2000 / Server 2003 / Server 2008 / Server 2008 R2 / Server 2012 のドメインコントローラ、または Active Directory サーバーに送信され、認証サーバーがユーザー名とパスワードのチェックを行った後に認証が成功すると、そのユーザーの VPN 接続が許可されます。\nNT ドメイン認証を使用するには、VPN Server がそのドメインに接続されているオペレーティングシステム上で動作している必要があります。詳しくは VPN Server の管理者にお問い合わせください。\n現在登録されているユーザーの一覧を取得するには、UserList コマンドを使用してください。\nこのコマンドは、VPN Bridge では実行できません。\nこのコマンドは、クラスタ内でクラスタメンバサーバーとして動作している VPN Server の仮想 HUB では実行できません。 -CMD_UserNTLMSet_Args UserNTLMSet [name] [/ALIAS:alias_name] -CMD_UserNTLMSet_[name] 設定を変更するユーザー名を指定します。 -CMD_UserNTLMSet_ALIAS このパラメータが設定されている場合、NT ドメインまたは Active Directory に対して送信されるユーザー名を、仮想 HUB 上のユーザー名とは別のユーザー名にすることが可能です。設定しない場合は、/ALIAS:none と指定してください (仮想 HUB 上のユーザー名が使用されます)。ユーザー名が "*" の場合は /ALIAS パラメータは無視されます。"*" ユーザーについての説明は、UserCreate /HELP と入力すると表示されます。 - - -# UserPolicyRemove コマンド -CMD_UserPolicyRemove ユーザーのセキュリティポリシーの削除 -CMD_UserPolicyRemove_Help 現在管理している仮想 HUB の、セキュリティアカウントデータベースに登録されているユーザーに対して設定されている、セキュリティポリシーの設定を削除します。セキュリティポリシーの設定が削除されているユーザーは、そのユーザーが所属しているグループのセキュリティポリシーの設定が適用されます。グループに所属していないか、グループにセキュリティポリシーが設定されていない場合は、デフォルトの値 (アクセスを許可: 有効、TCP 接続数の最大値: 32 個、タイムアウト時間: 20 秒) に従います。\n現在登録されているユーザーの一覧を取得するには、UserList コマンドを使用してください。\nこのコマンドは、VPN Bridge では実行できません。\nこのコマンドは、クラスタ内でクラスタメンバサーバーとして動作している VPN Server の仮想 HUB では実行できません。 -CMD_UserPolicyRemove_Args UserPolicyRemove [name] -CMD_UserPolicyRemove_[name] 設定を変更するユーザー名を指定します。 - - -# UserPolicySet コマンド -CMD_UserPolicySet ユーザーのセキュリティポリシーの設定 -CMD_UserPolicySet_Help 現在管理している仮想 HUB の、セキュリティアカウントデータベースに登録されているユーザーに対して設定されているセキュリティポリシーの内容を変更します。\nユーザーにセキュリティポリシーが設定されていない場合は、新しいデフォルトのセキュリティポリシーを設定してから、指定された値を変更します。\n現在登録されているユーザーの一覧を取得するには、UserList コマンドを使用してください。\nこのコマンドは、VPN Bridge では実行できません。\nこのコマンドは、クラスタ内でクラスタメンバサーバーとして動作している VPN Server の仮想 HUB では実行できません。 -CMD_UserPolicySet_Args UserPolicySet [name] [/NAME:policy_name] [/VALUE:num|yes|no] -CMD_UserPolicySet_[name] 設定を変更するユーザー名を指定します。 -CMD_UserPolicySet_NAME 値を変更するポリシーの名前を指定します。ポリシーの名前と設定できる値の一覧は PolicyList コマンドで表示することができます。 -CMD_UserPolicySet_VALUE ポリシーの新しい値を指定します。そのポリシーが数値型の場合は整数を指定します。ブール型の場合は yes または no を指定します。設定できる型と値は、PolicyList コマンドで表示することができます。 - - -# UserExpiresSet コマンド -CMD_UserExpiresSet ユーザーの有効期限の設定 -CMD_UserExpiresSet_Help 現在管理している仮想 HUB の、セキュリティアカウントデータベースに登録されているユーザーの有効期限を設定します。有効期限が終了したユーザーは、仮想 HUB に接続できなくなります。\n現在登録されているユーザーの一覧を取得するには、UserList コマンドを使用してください。\nこのコマンドは、VPN Bridge では実行できません。\nこのコマンドは、クラスタ内でクラスタメンバサーバーとして動作している VPN Server の仮想 HUB では実行できません。 -CMD_UserExpiresSet_Args UserExpiresSet [name] [/EXPIRES:expires] -CMD_UserExpiresSet_[name] 設定を変更するユーザー名を指定します。 -CMD_UserExpiresSet_EXPIRES ユーザーの有効期限の日時を指定します。"2005/10/08 19:30:00" のように、年・月・日・時・分・秒 の 6 個の整数をスペース、スラッシュまたはコロンで区切って指定してください。年は 4 桁で指定してください。値にスペースを入れる場合は、値全体を "" で囲む必要があります。指定はローカル時刻 (コマンドライン管理ユーティリティを実行しているコンピュータの基準時刻) で指定できます。/EXPIRES:none と指定すると、有効期限は解除されます。 -CMD_UserExpiresSet_Prompt_EXPIRES ユーザーの有効期限 (無指定で無期限): - - -# GroupList コマンド -CMD_GroupList グループ一覧の取得 -CMD_GroupList_Help 現在管理している仮想 HUB の、セキュリティアカウントデータベースに登録されているグループ一覧を取得します。\nこのコマンドは、VPN Bridge では実行できません。\nこのコマンドは、クラスタ内でクラスタメンバサーバーとして動作している VPN Server の仮想 HUB では実行できません。 -CMD_GroupList_Args GroupList - - -# GroupCreate コマンド -CMD_GroupCreate グループの作成 -CMD_GroupCreate_Help 現在管理している仮想 HUB の、セキュリティアカウントデータベースに新しいグループを作成します。\nグループには複数のユーザーを登録することができます。グループにユーザーを登録するには、GroupJoin コマンドを使用します。\nこのコマンドは、VPN Bridge では実行できません。\nこのコマンドは、クラスタ内でクラスタメンバサーバーとして動作している VPN Server の仮想 HUB では実行できません。 -CMD_GroupCreate_Args GroupCreate [name] [/REALNAME:realname] [/NOTE:note] -CMD_GroupCreate_[name] 作成するグループ名を指定します。 -CMD_GroupCreate_REALNAME グループの本名を指定します。たとえば、グループが実際の部課名に対応する場合は、その名前を指定します。指定しない場合は、/REALNAME:none と指定します。 -CMD_GroupCreate_NOTE グループの説明を指定します。指定しない場合は、/NOTE:none と指定します。 -CMD_GroupCreate_Prompt_NAME グループ名: -CMD_GroupCreate_Prompt_REALNAME グループの本名: -CMD_GroupCreate_Prompt_NOTE グループの説明: - - -# GroupSet コマンド -CMD_GroupSet グループ情報の設定 -CMD_GroupSet_Help 現在管理している仮想 HUB の、セキュリティアカウントデータベースに登録されているグループの情報を設定します。\n現在登録されているグループの一覧を取得するには、GroupList コマンドを使用してください。\nこのコマンドは、VPN Bridge では実行できません。\nこのコマンドは、クラスタ内でクラスタメンバサーバーとして動作している VPN Server の仮想 HUB では実行できません。 -CMD_GroupSet_Args GroupSet [name] [/REALNAME:realname] [/NOTE:note] -CMD_GroupSet_[name] 設定を変更するグループ名を指定します。 -CMD_GroupSet_REALNAME グループの本名を指定します。たとえば、グループが実際の部課名に対応する場合は、その名前を指定します。指定しない場合は、/REALNAME:none と指定します。 -CMD_GroupSet_NOTE グループの説明を指定します。指定しない場合は、/NOTE:none と指定します。 - - -# GroupDelete コマンド -CMD_GroupDelete グループの削除 -CMD_GroupDelete_Help 現在管理している仮想 HUB の、セキュリティアカウントデータベースに登録されているグループを削除します。\nグループを削除すると、そのグループに所属していたユーザーはすべて無所属になります。\n現在登録されているグループの一覧を取得するには、GroupList コマンドを使用してください。\nこのコマンドは、VPN Bridge では実行できません。\nこのコマンドは、クラスタ内でクラスタメンバサーバーとして動作している VPN Server の仮想 HUB では実行できません。 -CMD_GroupDelete_Args GroupDelete [name] -CMD_GroupDelete_[name] 削除するグループ名を指定します - - -# GroupGet コマンド -CMD_GroupGet グループ情報と所属しているユーザー一覧の取得 -CMD_GroupGet_Help 現在管理している仮想 HUB の、セキュリティアカウントデータベースに登録されているグループの情報と、そのグループに所属しているユーザーの一覧を取得します。\n現在登録されているグループの一覧を取得するには、GroupList コマンドを使用してください。\nこのコマンドは、VPN Bridge では実行できません。\nこのコマンドは、クラスタ内でクラスタメンバサーバーとして動作している VPN Server の仮想 HUB では実行できません。 -CMD_GroupGet_Args GroupGet [name] -CMD_GroupGet_[name] 情報を取得するグループ名を指定します。 -CMD_GroupGet_Column_NAME グループ名 -CMD_GroupGet_Column_REALNAME 本名 -CMD_GroupGet_Column_NOTE 説明 -CMD_GroupGet_Column_POLICY このグループに設定されているセキュリティポリシー -CMD_GroupGet_Column_MEMBERS このグループに所属しているユーザー名の一覧 - - -# GroupJoin コマンド -CMD_GroupJoin グループにユーザーを追加 -CMD_GroupJoin_Help 現在管理している仮想 HUB の、セキュリティアカウントデータベースに登録されているグループに、セキュリティアカウントデータベース内のユーザーを追加します。\n現在登録されているユーザーとグループの一覧は、UserList コマンドと GroupList コマンドで取得できます。\nこのコマンドは、VPN Bridge では実行できません。\nこのコマンドは、クラスタ内でクラスタメンバサーバーとして動作している VPN Server の仮想 HUB では実行できません。 -CMD_GroupJoin_Args GroupJoin [name] [/USERNAME:username] -CMD_GroupJoin_[name] ユーザーを追加するグループ名を指定します。 -CMD_GroupJoin_USERNAME name で指定したグループに追加するユーザー名を指定します。 -CMD_GroupJoin_Prompt_USERNAME グループに参加させるユーザー名: - - -# GroupUnjoin コマンド -CMD_GroupUnjoin グループからユーザーを削除 -CMD_GroupUnjoin_Help 現在管理している仮想 HUB の、セキュリティアカウントデータベースに登録されているグループから、指定したユーザーを削除します。グループからユーザーが削除されると、そのユーザーは無所属となります。\nグループに現在所属しているユーザーの一覧を取得するには、GroupGet コマンドを使用します。\n現在登録されているグループの一覧を取得するには、GroupList コマンドを使用してください。\nこのコマンドは、VPN Bridge では実行できません。\nこのコマンドは、クラスタ内でクラスタメンバサーバーとして動作している VPN Server の仮想 HUB では実行できません。 -CMD_GroupUnjoin_Args GroupUnjoin [name] -CMD_GroupUnjoin_[name] グループから削除するユーザー名を指定します。 -CMD_GroupUnjoin_Prompt_name グループから削除するユーザー名: - - -# GroupPolicyRemove コマンド -CMD_GroupPolicyRemove グループのセキュリティポリシーの削除 -CMD_GroupPolicyRemove_Help 現在管理している仮想 HUB の、セキュリティアカウントデータベースに登録されているグループに対して設定されているセキュリティポリシーの設定を削除します。所属しているグループにもユーザー本体にもセキュリティポリシーが設定されていないユーザーは、デフォルトの値 (アクセスを許可: 有効、TCP 接続数の最大値: 32 個、タイムアウト時間: 20 秒) に従います。\n現在登録されているグループの一覧を取得するには、GroupList コマンドを使用してください。\nこのコマンドは、VPN Bridge では実行できません。\nこのコマンドは、クラスタ内でクラスタメンバサーバーとして動作している VPN Server の仮想 HUB では実行できません。 -CMD_GroupPolicyRemove_Args GroupPolicyRemove [name] -CMD_GroupPolicyRemove_[name] 設定を変更するグループ名を指定します。 - - -# GroupPolicySet コマンド -CMD_GroupPolicySet グループのセキュリティポリシーの設定 -CMD_GroupPolicySet_Help 現在管理している仮想 HUB の、セキュリティアカウントデータベースに登録されているグループに対して設定されているセキュリティポリシーの内容を変更します。\nグループにセキュリティポリシーが設定されていない場合は、新しいデフォルトのセキュリティポリシーを設定してから、指定された値を変更します。\n現在登録されているグループの一覧を取得するには、GroupList コマンドを使用してください。\nこのコマンドは、VPN Bridge では実行できません。\nこのコマンドは、クラスタ内でクラスタメンバサーバーとして動作している VPN Server の仮想 HUB では実行できません。 -CMD_GroupPolicySet_Args GroupPolicySet [name] [/NAME:policy_name] [/VALUE:num|yes|no] -CMD_GroupPolicySet_[name] 設定を変更するグループ名を指定します。 -CMD_GroupPolicySet_NAME 値を変更するポリシーの名前を指定します。ポリシーの名前と設定できる値の一覧は、PolicyList コマンドで表示することができます。 -CMD_GroupPolicySet_VALUE ポリシーの新しい値を指定します。そのポリシーが数値型の場合は整数を指定します。ブール型の場合は yes または no を指定します。設定できる型と値は、PolicyList コマンドで表示することができます。 - - -# SessionList コマンド -CMD_SessionList 接続中のセッション一覧の取得 -CMD_SessionList_Help 現在管理している仮想 HUB に接続中のセッション一覧を取得します。セッション一覧には、各コネクションごとの [セッション名]、[セッションの場所]、[ユーザー名]、[接続元ホスト名]、[TCP コネクション]、[転送バイト数]、[転送パケット数] が表示されます。\n現在接続中の VPN Server がクラスタコントローラで、管理している仮想 HUB がスタティック仮想 HUB の場合は、すべてのクラスタメンバの当該仮想 HUB に接続しているセッション一覧がすべて結合されて取得されます。\nそれ以外の場合は、現在管理している VPN Server に実際に接続しているセッション一覧のみが取得されます。 -CMD_SessionList_Args SessionList - - -# SessionGet コマンド -CMD_SessionGet セッション情報の取得 -CMD_SessionGet_Help 現在管理している仮想 HUB に接続中のセッションを指定して、そのセッションの情報を取得します。セッション情報には、接続元ホスト名やユーザー名、バージョン情報、時刻情報、TCP コネクション数、通信パラメータ、セッションキー、送受信したデータの統計情報、その他のクライアントやサーバーの情報などが含まれます。\n現在接続中のセッション一覧を取得するには、SessionList コマンドを使用してください。 -CMD_SessionGet_Args SessionGet [name] -CMD_SessionGet_[name] 情報を取得するセッション名を指定します。 -CMD_SessionGet_Prompt_NAME セッション名: - - -# SessionDisconnect コマンド -CMD_SessionDisconnect セッションの切断 -CMD_SessionDisconnect_Help 現在管理している仮想 HUB に接続中のセッションを指定して、そのセッションを管理者権限で強制切断します。\nただし、接続元のクライアント側の設定で通信が切断された場合は自動的に再接続するオプションが有効になっている場合、クライアントはもう一度接続してくる可能性があります。\n現在接続中のセッション一覧を取得するには、SessionList コマンドを使用してください。 -CMD_SessionDisconnect_Args SessionDisconnect [name] -CMD_SessionDisconnect_[name] 切断するセッション名を指定します。 - - -# MacTable コマンド -CMD_MacTable MAC アドレステーブルデータベースの取得 -CMD_MacTable_Help 現在管理している仮想 HUB が保持している MAC アドレステーブルデータベースを取得します。\nMAC アドレステーブルデータベースは、仮想 HUB が Ethernet フレームのスイッチング動作を行うために必要なテーブルで、仮想 HUB は MAC アドレステーブルデータベースに基づいて、各 Ethernet フレームの振り分け先セッションを決定します。MAC アドレスデータベースは、仮想 HUB が流れる通信の内容を自動的に分析して構築します。\nセッション名を指定して、そのセッションに関連付けられている MAC アドレステーブルエントリを取得することもできます。 -CMD_MacTable_Args MacTable [session_name] -CMD_MacTable_[session_name] 引数としてセッション名を指定すると、そのセッションに関連付けられている MAC アドレステーブルエントリのみを表示します。指定しない場合は、すべてのエントリが表示されます。 - - -# MacDelete コマンド -CMD_MacDelete MAC アドレステーブルエントリの削除 -CMD_MacDelete_Help 現在管理している仮想 HUB が保持している MAC アドレステーブルデータベースを操作し、指定された MAC アドレステーブルエントリをデータベースから削除します。\n現在の MAC アドレステーブルデータベースの内容を取得するには、MacTable コマンドを使用してください。 -CMD_MacDelete_Args MacDelete [id] -CMD_MacDelete_[id] 削除する MAC アドレステーブルエントリの ID を指定します。 -CMD_MacDelete_Prompt 削除する ID: - - -# IpTable コマンド -CMD_IpTable IP アドレステーブルデータベースの取得 -CMD_IpTable_Help 現在管理している仮想 HUB が保持している IP アドレステーブルデータベースを取得します。\nIP アドレステーブルデータベースは、どのセッションがどの IP アドレスを使用しているかを常に仮想 HUB が把握するために、自動的に通信内容を分析して生成されるテーブルで、仮想 HUB のセキュリティポリシー適用エンジンによって頻繁に使用されています。\nセッション名を指定して、そのセッションに関連付けられている IP アドレステーブルエントリを取得することもできます。 -CMD_IpTable_Args IpTable [session_name] -CMD_IpTable_[session_name] 引数としてセッション名を指定すると、そのセッションに関連付けられている IP アドレステーブルエントリのみを表示します。指定しない場合は、すべてのエントリが表示されます。 - - -# IpDelete コマンド -CMD_IpDelete IP アドレステーブルエントリの削除 -CMD_IpDelete_Help 現在管理している仮想 HUB が保持している IP アドレステーブルデータベースを操作し、指定された IP アドレステーブルエントリをデータベースから削除します。\n現在の IP アドレステーブルデータベースの内容を取得するには、IpTable コマンドを使用してください。 -CMD_IpDelete_Args IpDelete [id] -CMD_IpDelete_[id] 削除する IP アドレステーブルエントリの ID を指定します。 - - -# SecureNatEnable コマンド -CMD_SecureNatEnable 仮想 NAT および DHCP サーバー機能 (SecureNAT 機能) の有効化 -CMD_SecureNatEnable_Help 現在管理している仮想 HUB 内で、仮想 NAT および DHCP サーバー機能 (SecureNAT 機能) を有効化し、動作を開始します。このコマンドを実行する前に、必ず SecureNatHostGet コマンド、NatGet コマンドおよび DhcpGet コマンドで、現在の仮想 NAT 機能および DHCP サーバー機能の設定内容を確認してください。\nSecureNAT 機能を有効にすると、仮想 HUB 内の仮想ネットワークにおいて NAT ルータ (IP マスカレード) や DHCP サーバー機能を仮想的に動作させることができるようになります。\n\n[SecureNAT 機能に関する警告]\nSecureNAT 機能はシステム管理者やネットワークに関して詳しい知識のある方向けの機能です。\nSecureNAT 機能を正しく使用すると、VPN を経由した安全なリモートアクセスが実現できます。しかし、誤った方法で使用すると、ネットワーク全体を危険な状態にする可能性もあります。ネットワークに関する十分な知識をお持ちでない場合や、ネットワーク管理者の許可を得ていない場合は、SecureNAT 機能を有効にしないでください。SecureNAT 機能に関する詳しい説明は、VPN Server のマニュアルやオンラインドキュメントを参照してください。\nこのコマンドは、クラスタとして動作している VPN Server の仮想 HUB では実行できません。 -CMD_SecureNatEnable_Args SecureNatEnable - - -# SecureNatDisable コマンド -CMD_SecureNatDisable 仮想 NAT および DHCP サーバー機能 (SecureNAT 機能) の無効化 -CMD_SecureNatDisable_Help 現在管理している仮想 HUB 内で、仮想 NAT および DHCP サーバー機能 (SecureNAT 機能) を無効化します。このコマンドを実行すると、仮想 NAT 機能は直ちに動作を停止し、仮想 DHCP サーバー機能は保持している DHCP リースデータベースを削除しサービスを停止します。\nこのコマンドは、クラスタとして動作している VPN Server の仮想 HUB では実行できません。 -CMD_SecureNatDisable_Args SecureNatDisable - - -# SecureNatStatusGet コマンド -CMD_SecureNatStatusGet 仮想 NAT および DHCP サーバー機能 (SecureNAT 機能) の動作状況の取得 -CMD_SecureNatStatusGet_Help 現在管理している仮想 HUB 内で、仮想 NAT および DHCP サーバー機能 (SecureNAT 機能) が動作している場合は、その動作状況を取得します。\nこのコマンドは、クラスタとして動作している VPN Server の仮想 HUB では実行できません。 -CMD_SecureNatStatusGet_Args SecureNatStatusGet - - -# SecureNatHostGet コマンド -CMD_SecureNatHostGet SecureNAT 機能の仮想ホストのネットワークインターフェイス設定の取得 -CMD_SecureNatHostGet_Help 現在管理している仮想 HUB 内で、仮想 NAT および DHCP サーバー機能 (SecureNAT 機能) の設定項目の内、仮想ホストのネットワークインターフェイスの設定を取得します。\nSecureNAT 機能は、仮想 HUB の内部で、L2 セグメント内で 1 枚の仮想的な LAN カードを持ち、MAC アドレスと IP アドレスを割り当てられます。これによって、同一 L2 セグメントに接続している他のホストは、まるで実際の IP ホストがネットワーク上に存在しているかのように SecureNAT の仮想ホストと通信することが可能になります。\n\n[SecureNAT 機能に関する警告]\nSecureNAT 機能はシステム管理者やネットワークに関して詳しい知識のある方向けの機能です。\nSecureNAT 機能を正しく使用すると、VPN を経由した安全なリモートアクセスが実現できます。しかし、誤った方法で使用すると、ネットワーク全体を危険な状態にする可能性もあります。ネットワークに関する十分な知識をお持ちでない場合や、ネットワーク管理者の許可を得ていない場合は、SecureNAT 機能を有効にしないでください。SecureNAT 機能に関する詳しい説明は、VPN Server のマニュアルやオンラインドキュメントを参照してください。\nこのコマンドは、クラスタとして動作している VPN Server の仮想 HUB では実行できません。 -CMD_SecureNatHostGet_Args SecureNatHostGet -CMD_SecureNatHostGet_Column_MAC MAC アドレス -CMD_SecureNatHostGet_Column_IP IP アドレス -CMD_SecureNatHostGet_Column_MASK サブネットマスク -CMD_SecureNatHostGet_Column_LOG NAT および DHCP の動作のログ保存 - - -# SecureNatHostSet コマンド -CMD_SecureNatHostSet SecureNAT 機能の仮想ホストのネットワークインターフェイス設定の変更 -CMD_SecureNatHostSet_Help 現在管理している仮想 HUB 内で、仮想 NAT および DHCP サーバー機能 (SecureNAT 機能) の設定項目の内、仮想ホストのネットワークインターフェイスの設定を変更して保存します。\nSecureNAT 機能は、仮想 HUB の内部で、L2 セグメント内で 1 枚の仮想的な LAN カードを持ち、MAC アドレスと IP アドレスを割り当てられます。これによって、同一 L2 セグメントに接続している他のホストは、まるで実際の IP ホストがネットワーク上に存在しているかのように SecureNAT の仮想ホストと通信することが可能になります。\n\n[SecureNAT 機能に関する警告]\nSecureNAT 機能はシステム管理者やネットワークに関して詳しい知識のある方向けの機能です。\nSecureNAT 機能を正しく使用すると、VPN を経由した安全なリモートアクセスが実現できます。しかし、誤った方法で使用すると、ネットワーク全体を危険な状態にする可能性もあります。ネットワークに関する十分な知識をお持ちでない場合や、ネットワーク管理者の許可を得ていない場合は、SecureNAT 機能を有効にしないでください。SecureNAT 機能に関する詳しい説明は、VPN Server のマニュアルやオンラインドキュメントを参照してください。\nこのコマンドは、クラスタとして動作している VPN Server の仮想 HUB では実行できません。 -CMD_SecureNatHostSet_Args SecureNatHostSet [/MAC:mac] [/IP:ip] [/MASK:mask] -CMD_SecureNatHostSet_MAC 仮想インターフェイスに割り当てる MAC アドレスを指定します。MAC アドレスは "00-AC-01-23-45-67" のように文字列で指定します。/MAC:none を指定すると、現在の設定を変更しません。 -CMD_SecureNatHostSet_IP 仮想インターフェイスに割り当てる IP アドレスを指定します。/IP:none を指定すると、現在の設定を変更しません。 -CMD_SecureNatHostSet_MASK 仮想インターフェイスに割り当てるサブネットマスクを指定します。/MASK:none を指定すると、現在の設定を変更しません。 -CMD_SecureNatHostSet_Prompt_MAC MAC アドレス: -CMD_SecureNatHostSet_Prompt_IP IP アドレス: -CMD_SecureNatHostSet_Prompt_MASK サブネットマスク: - - -# NatGet コマンド -CMD_NatGet SecureNAT 機能の仮想 NAT 機能の設定の取得 -CMD_NatGet_Help 現在管理している仮想 HUB 内で、仮想 NAT および DHCP サーバー機能 (SecureNAT 機能) の設定項目の内、仮想 NAT の設定を取得します。\nこのコマンドは、クラスタとして動作している VPN Server の仮想 HUB では実行できません。 -CMD_NatGet_Args NatGet -CMD_NatGet_Column_USE 仮想 NAT 機能を使用する -CMD_NetGet_Column_MTU MTU 値 -CMD_NatGet_Column_TCP TCP セッションのタイムアウト (秒) -CMD_NatGet_Column_UDP UDP セッションのタイムアウト (秒) - - -# NatEnable コマンド -CMD_NatEnable SecureNAT 機能の仮想 NAT 機能の有効化 -CMD_NatEnable_Help 現在管理している仮想 HUB 内で、仮想 NAT 機能を有効にします。\nこのコマンドを用いて仮想 NAT 機能を有効にしても、SecureNAT 機能が動作していない場合は、仮想 NAT は動作しません。SecureNAT 機能の動作を開始するには、SecureNatEnable コマンドを使用します。\nこのコマンドは、クラスタとして動作している VPN Server の仮想 HUB では実行できません。 -CMD_NatEnable_Args NatEnable - - -# NatDisable コマンド -CMD_NatDisable SecureNAT 機能の仮想 NAT 機能の無効化 -CMD_NatDisable_Help 現在管理している仮想 HUB 内で、仮想 NAT 機能を無効にします。\nこのコマンドは、クラスタとして動作している VPN Server の仮想 HUB では実行できません。 -CMD_NatDisable_Args NatDisable - - -# NatSet コマンド -CMD_NatSet SecureNAT 機能の仮想 NAT 機能の設定の変更 -CMD_NatSet_Help 現在管理している仮想 HUB 内の仮想 NAT の設定を変更します。仮想 NAT の設定には、MTU 値、TCP セッションのタイムアウト時間、UDP セッションのタイムアウト時間が含まれます。\nこのコマンドは、クラスタとして動作している VPN Server の仮想 HUB では実行できません。 -CMD_NatSet_Args NatSet [/MTU:mtu] [/TCPTIMEOUT:tcp_timeout] [/UDPTIMEOUT:udp_timeout] [/LOG:yes|no] -CMD_NatSet_MTU MTU (最大転送可能ユニットサイズ) を、バイト数単位の整数で設定します。この値は、仮想 NAT が送出する Ethernet フレームの MAC ヘッダを除いたペイロードの最大長で、デフォルトでは 1500 バイトです。 -CMD_NatSet_TCPTIMEOUT 仮想 NAT が中継する TCP セッションで、何秒間無通信状態が続けばタイムアウトしセッションを破棄するかを設定します。 -CMD_NatSet_UDPTIMEOUT 仮想 NAT が中継する UDP セッションで、何秒間無通信状態が続けばタイムアウトしセッションを破棄するかを設定します。 -CMD_NatSet_LOG 仮想 NAT の動作を、仮想 HUB のセキュリティログに保存するかどうかを指定します。"yes" を指定すると保存され、"no" を指定すると保存しません。 -CMD_NatSet_Prompt_MTU MTU 値: -CMD_NatSet_Prompt_TCPTIMEOUT TCP セッションのタイムアウト秒数: -CMD_NatSet_Prompt_UDPTIMEOUT UDP セッションのタイムアウト秒数: -CMD_NatSet_Prompt_LOG ログの保存 (yes / no): -CMD_NatSet_Eval_MTU MTU 値は %d から %d の間で設定してください。 -CMD_NatSet_Eval_TCP TCP セッションのタイムアウト秒数は %d から %d の間で設定してください。 -CMD_NatSet_Eval_UDP UDP セッションのタイムアウト秒数は %d から %d の間で設定してください。 - - -# NatTable コマンド -CMD_NatTable SecureNAT 機能の仮想 NAT 機能のセッションテーブルの取得 -CMD_NatTable_Help 現在管理している仮想 HUB 内で仮想 NAT 機能が動作している場合、仮想 NAT を経由して現在通信中の TCP、および UDP のセッションテーブル (NAT テーブル) を取得します。\nこのコマンドは、クラスタとして動作している VPN Server の仮想 HUB では実行できません。 -CMD_NatTable_Args NatTable - - -# DhcpGet コマンド -CMD_DhcpGet SecureNAT 機能の仮想 DHCP サーバー機能の設定の取得 -CMD_DhcpGet_Help 現在管理している仮想 HUB 内で、仮想 NAT および DHCP サーバー機能 (SecureNAT 機能) の設定項目の内、仮想 DHCP サーバーの設定を取得します。\nこのコマンドは、クラスタとして動作している VPN Server の仮想 HUB では実行できません。 -CMD_DhcpGet_Args DhcpGet -CMD_DhcpGet_Column_Log NAT および DHCP 動作のログ記録 -CMD_DhcpGet_Column_USE 仮想 DHCP 機能を使用する -CMD_DhcpGet_Column_IP1 配布アドレス帯の開始 -CMD_DhcpGet_Column_IP2 配布アドレス帯の終了 -CMD_DhcpGet_Column_MASK サブネットマスク -CMD_DhcpGet_Column_LEASE リース期限 (秒) -CMD_DhcpGet_Column_GW デフォルトゲートウェイアドレス -CMD_DhcpGet_Column_DNS DNS サーバー アドレス 1 -CMD_DhcpGet_Column_DNS2 DNS サーバー アドレス 2 -CMD_DhcpGet_Column_DOMAIN ドメイン名 -CMD_DhcpGet_Column_PUSHROUTE プッシュする静的ルーティングテーブル - - -# DhcpEnable コマンド -CMD_DhcpEnable SecureNAT 機能の仮想 DHCP サーバー機能の有効化 -CMD_DhcpEnable_Help 現在管理している仮想 HUB 内で、仮想 DHCP サーバー機能を有効にします。\nこのコマンドを用いて仮想 DHCP 機能を有効にしても、SecureNAT 機能が動作していない場合は、仮想 DHCP サーバーは動作しません。SecureNAT 機能の動作を開始するには、SecureNatEnable コマンドを使用します。\nこのコマンドは、クラスタとして動作している VPN Server の仮想 HUB では実行できません。 -CMD_DhcpEnable_Args DhcpEnable - - -# DhcpDisable コマンド -CMD_DhcpDisable SecureNAT 機能の仮想 DHCP サーバー機能の無効化 -CMD_DhcpDisable_Help 現在管理している仮想 HUB 内で、仮想 DHCP サーバー機能を無効にします。\nこのコマンドは、クラスタとして動作している VPN Server の仮想 HUB では実行できません。 -CMD_DhcpDisable_Args DhcpDisable - - -# DhcpSet コマンド -CMD_DhcpSet SecureNAT 機能の仮想 DHCP サーバー機能の設定の変更 -CMD_DhcpSet_Help 現在管理している仮想 HUB 内の、仮想 DHCP サーバーの設定を変更します。仮想 DHCP サーバーの設定には、配布 IP アドレス帯、サブネットマスク、リース期限、およびクライアントに割り当てるオプション値が含まれます。\nこのコマンドは、クラスタとして動作している VPN Server の仮想 HUB では実行できません。 -CMD_DhcpSet_Args DhcpSet [/START:start_ip] [/END:end_ip] [/MASK:subnetmask] [/EXPIRE:sec] [/GW:gwip] [/DNS:dns] [/DNS2:dns2] [/DOMAIN:domain] [/LOG:yes|no] [/PUSHROUTE:"routing_table"] -CMD_DhcpSet_START クライアントに対して配布するアドレス帯の開始点を指定します。(例: 192.168.30.10) -CMD_DhcpSet_END クライアントに対して配布するアドレス帯の終了点を指定します。(例: 192.168.30.200) -CMD_DhcpSet_MASK クライアントに対して指定するサブネットマスクを指定します。(例: 255.255.255.0) -CMD_DhcpSet_EXPIRE クライアントに対して IP アドレスをリースする際の有効期限を秒単位で指定します。 -CMD_DhcpSet_GW クライアントに対して通知するデフォルトゲートウェイの IP アドレスを指定します。SecureNAT 機能の仮想 NAT 機能と共に有効にして使用する場合は、SecureNAT の仮想ホストの IP アドレスを指定することもできます。0 または none を指定すると、デフォルトゲートウェイをクライアントに対して通知しません。 -CMD_DhcpSet_DNS クライアントに対して通知する DNS サーバー (プライマリ) の IP アドレスを指定します。SecureNAT 機能の仮想 NAT 機能と共に有効にして使用する場合は、SecureNAT の仮想ホストの IP アドレスを指定することもできます。0 または none を指定すると、DNS サーバー アドレスをクライアントに対して通知しません。 -CMD_DhcpSet_DNS2 クライアントに対して通知する DNS サーバー (セカンダリ) の IP アドレスを指定します。SecureNAT 機能の仮想 NAT 機能と共に有効にして使用する場合は、SecureNAT の仮想ホストの IP アドレスを指定することもできます。0 または none を指定すると、DNS サーバー アドレスをクライアントに対して通知しません。 -CMD_DhcpSet_DOMAIN クライアントに対して通知するドメイン名を指定します。none を指定すると、ドメイン名をクライアントに対して通知しません。 -CMD_DhcpSet_LOG 仮想 DHCP サーバーの動作を仮想 HUB のセキュリティログに保存するかどうかを指定します。"yes" を指定すると保存します。この値は、仮想 NAT 機能のログ保存設定と連動しています。 -CMD_DhcpSet_PUSHROUTE プッシュする静的ルーティングテーブルを指定します。\n例: "192.168.5.0/255.255.255.0/192.168.4.254, 10.0.0.0/255.0.0.0/192.168.4.253"\n複数のエントリ (最大 64 個) はカンマまたはスペースで区切ります。各エントリは、"IP ネットワークアドレス/サブネットマスク/ゲートウェイ IP アドレス" の書式で記述します。\nVPN クライアントに対してこの仮想 DHCP サーバーから DHCP 応答を送信する際に、クラスレス静的ルート (RFC 3442) を併せて送信することができます。\nVPN クライアントがクラスレス静的ルート (RFC 3442) を認識できるかどうかは、VPN クライアントソフトウェアによって異なります。SoftEther VPN Client および OpenVPN Client はクラスレス静的ルートに対応しています。L2TP/IPsec および MS-SSTP においては、利用の可否はクライアントソフトウェアに依存します。\n仮想 DHCP サーバーのオプションでデフォルトゲートウェイを空欄に設定することで、スプリットトンネリングが実現できます。L2TP/IPsec および MS-SSTP クライアントを使用している場合は、IPv4 の設定画面でデフォルトゲートウェイを VPN サーバーに向けないようにする設定が必要です。\nローカルブリッジ経由で外部に DHCP サーバーがある場合は、その DHCP サーバーでクラスレス静的ルート (RFC 3442) をプッシュするよう設定することもできます。その場合は、SecureNAT の仮想 DHCP サーバー機能は無効にしてください。また、このコマンドでの設定は必要ありません。\nクラスレス静的ルートについては、RFC 3442 をお読みください。 -CMD_DhcpSet_Prompt_START 配布するアドレス帯の開始点: -CMD_DhcpSet_Prompt_END 配布するアドレス帯の終了点: -CMD_DhcpSet_Prompt_MASK サブネットマスク: -CMD_DhcpSet_Prompt_EXPIRE リース期限 (秒): -CMD_DhcpSet_Prompt_GW デフォルトゲートウェイ (未設定可): -CMD_DhcpSet_Prompt_DNS DNS サーバー 1 (未設定可): -CMD_DhcpSet_Prompt_DNS2 DNS サーバー 2 (未設定可): -CMD_DhcpSet_Prompt_DOMAIN ドメイン名: - - -# DhcpTable コマンド -CMD_DhcpTable SecureNAT 機能の仮想 DHCP サーバー機能のリーステーブルの取得 -CMD_DhcpTable_Help 現在管理している仮想 HUB 内で仮想 DHCP サーバー機能が動作している場合、仮想 DHCP サーバーが保持しているクライアントに対して割り当てた IP アドレスのリーステーブルを取得します。\nこのコマンドは、クラスタとして動作している VPN Server の仮想 HUB では実行できません。 -CMD_DhcpTable_Args DhcpTable - - -# AdminOptionList コマンド -CMD_AdminOptionList 仮想 HUB 管理オプションの一覧の取得 -CMD_AdminOptionList_Help 現在管理している仮想 HUB に設定されている仮想 HUB 管理オプションの一覧を取得します。\n仮想 HUB 管理オプションは、VPN Server の管理者が各仮想 HUB の管理者に仮想 HUB の管理を委任している場合に、設定範囲を制限するために使用します。\n仮想 HUB の管理オプションを追加・編集および削除することができるのは、この VPN Server 全体の管理権限を持った管理者のみです。仮想 HUB の管理者は、管理オプションを表示できますが、変更することはできません。\nただし、allow_hub_admin_change_option が 1 に設定されている場合は、仮想 HUB の管理者でも管理オプションを編集することができます。\nこのコマンドは、VPN Bridge では実行できません。\nこのコマンドは、クラスタ内でクラスタメンバサーバーとして動作している VPN Server の仮想 HUB では実行できません。 -CMD_AdminOptionList_Args AdminOptionList - - -# AdminOptionSet コマンド -CMD_AdminOptionSet 仮想 HUB 管理オプションの値の設定 -CMD_AdminOptionSet_Help 現在管理している仮想 HUB に設定されている仮想 HUB 管理オプションの値を変更します。\n仮想 HUB 管理オプションは、VPN Server の管理者が各仮想 HUB の管理者に仮想 HUB の管理を委任している場合に、設定範囲を制限するために使用します。\n仮想 HUB の管理オプションを追加・編集および削除することができるのは、この VPN Server 全体の管理権限を持った管理者のみです。仮想 HUB の管理者は、管理オプションを表示できますが、変更することはできません。\nただし、allow_hub_admin_change_option が 1 に設定されている場合は、仮想 HUB の管理者でも管理オプションを編集することができます。\nこのコマンドは、VPN Bridge では実行できません。\nこのコマンドは、クラスタ内でクラスタメンバサーバーとして動作している VPN Server の仮想 HUB では実行できません。 -CMD_AdminOptionSet_Args AdminOptionSet [name] [/VALUE:value] -CMD_AdminOptionSet_[name] 値を変更する管理オプション名を指定します。AdminOptionList コマンドで名前の一覧を取得できます。 -CMD_AdminOptionSet_VALUE 設定する値を整数で指定します。 -CMD_AdminOptionSet_Prompt_name 値を変更する管理オプション名: -CMD_AdminOptionSet_Prompt_VALUE 設定する値 (整数): - - -# ExtOptionList コマンド -CMD_ExtOptionList 仮想 HUB 拡張オプションの一覧の取得 -CMD_ExtOptionList_Help 現在管理している仮想 HUB に設定されている仮想 HUB 拡張オプションの一覧を取得します。\n仮想 HUB 拡張オプションは、仮想 HUB に関するより詳細な設定を行うことができる機能です。\n仮想 HUB の管理オプションを追加・編集および削除することができるのは、この VPN Server 全体の管理権限を持った管理者および仮想 HUB の管理者です。\nただし、仮想 HUB 管理オプションの deny_hub_admin_change_ext_option が 1 に設定されている場合は、仮想 HUB の管理者は、拡張オプションを編集することができません。\nこのコマンドは、VPN Bridge では実行できません。\nこのコマンドは、クラスタ内でクラスタメンバサーバーとして動作している VPN Server の仮想 HUB では実行できません。 -CMD_ExtOptionList_Args ExtOptionList - - -# ExtOptionSet コマンド -CMD_ExtOptionSet 仮想 HUB 管理オプションの値の設定 -CMD_ExtOptionSet_Help 現在管理している仮想 HUB に設定されている仮想 HUB 拡張オプションの値を設定します。\n仮想 HUB 拡張オプションは、仮想 HUB に関するより詳細な設定を行うことができる機能です。\n仮想 HUB の管理オプションを追加・編集および削除することができるのは、この VPN Server 全体の管理権限を持った管理者および仮想 HUB の管理者です。\nただし、仮想 HUB 管理オプションの deny_hub_admin_change_ext_option が 1 に設定されている場合は、仮想 HUB の管理者は、拡張オプションを編集することができません。\nこのコマンドは、VPN Bridge では実行できません。\nこのコマンドは、クラスタ内でクラスタメンバサーバーとして動作している VPN Server の仮想 HUB では実行できません。 -CMD_ExtOptionSet_Args ExtOptionSet [name] [/VALUE:value] -CMD_ExtOptionSet_[name] 値を変更する拡張オプション名を指定します。ExtOptionList コマンドで名前の一覧を取得できます。 -CMD_ExtOptionSet_VALUE 設定する値を整数で指定します。 -CMD_ExtOptionSet_Prompt_name 値を変更する拡張オプション名: -CMD_ExtOptionSet_Prompt_VALUE 設定する値 (整数): - - -# CrlList コマンド -CMD_CrlList 無効な証明書リストの一覧の取得 -CMD_CrlList_Help 現在管理している仮想 HUB に設定されている、無効な証明書リストの一覧を取得します。\n無効な証明書の一覧に証明書を登録すると、その証明書を提示したクライアントは、この仮想 HUB に証明書認証モードで接続できなくなります。\n通常、この機能は秘密鍵が漏洩したり、証明書を保有する者の権限が失効した場合に、当該証明書を無効として仮想 HUB に登録することにより、その証明書を用いて VPN Client が仮想 HUB に接続しようとした際に、ユーザー認証を拒否するために使用されます。\nこのコマンドは、VPN Bridge では実行できません。\nこのコマンドは、クラスタとして動作している VPN Server の仮想 HUB では実行できません。 -CMD_CrlList_Args CrlList - - -# CrlAdd コマンド -CMD_CrlAdd 無効な証明書の追加 -CMD_CrlAdd_Help 現在管理している仮想 HUB に設定されている無効な証明書リストに、新しい無効な証明書の定義を追加します。\n無効な証明書の一覧に登録する内容を、このコマンドのパラメータで指定します。仮想 HUB にユーザーが証明書認証モードで接続してきたとき、その証明書が無効な証明書の一覧に登録されている 1 つ以上の内容に一致する場合に、そのユーザーの接続を拒否します。\nこのコマンドで指定したパラメータで定義されるすべての条件に一致した証明書が、無効として判定されます。\n設定できる項目は、[名前 (CN)]、[所属機関 (O)]、[組織単位 (OU)]、[国 (C)]、[都道府県 (ST)]、[ローカル (L)]、[シリアル番号 (16進数)]、[MD5 ダイジェスト値 (16進数, 128 bit)]、[SHA-1 ダイジェスト値 (16進数, 160 bit)] です。ダイジェスト値 (ハッシュ値) の指定は、証明書を事実上一意に指定することになります。通常、MD5 または SHA-1 のダイジェスト値を入力する場合は、その他の項目を入力する必要はありません。\nこのコマンドは、VPN Bridge では実行できません。\nこのコマンドは、クラスタとして動作している VPN Server の仮想 HUB では実行できません。 -CMD_CrlAdd_Args CrlAdd [/SERIAL:serial] [/MD5:md5] [/SHA1:sha1] [/CN:cn] [/O:o] [/OU:ou] [/C:c] [/ST:st] [/L:l] -CMD_CrlAdd_SERIAL 条件として証明書のシリアル番号 (16進数) を設定する場合はこのパラメータで値を指定します。 -CMD_CrlAdd_MD5 条件として証明書の MD5 ダイジェスト値 (16進数, 128 bit) を設定する場合は、このパラメータで値を指定します。16 進数で 32 文字 (16 Bytes) のパラメータを指定しない場合は無視されます。 -CMD_CrlAdd_SHA1 条件として証明書の SHA1 ダイジェスト値 (16進数, 160 bit) を設定する場合は、このパラメータで値を指定します。16 進数で 40 文字 (20 Bytes) のパラメータを指定しない場合は無視されます。 -CMD_CrlAdd_CN 条件として証明書の名前 (CN) を指定する場合は、このパラメータで値を設定します。 -CMD_CrlAdd_O 条件として証明書の所属機関 (O) を指定する場合は、このパラメータで値を設定します。 -CMD_CrlAdd_OU 条件として証明書の組織単位 (OU) を指定する場合は、このパラメータで値を設定します。 -CMD_CrlAdd_C 条件として証明書の国 (C) を指定する場合は、このパラメータで値を設定します。 -CMD_CrlAdd_ST 条件として証明書の都道府県 (ST) を指定する場合は、このパラメータで値を設定します。 -CMD_CrlAdd_L 条件として証明書のローカル (L) を指定する場合は、このパラメータで値を設定します。 - - -# CrlDel コマンド -CMD_CrlDel 無効な証明書の削除 -CMD_CrlDel_Help 現在管理している仮想 HUB に設定されている無効な証明書のリストから、無効な証明書の定義を指定して削除します。\n現在登録されている無効な証明書の定義一覧は、CrlList コマンドで取得できます\nこのコマンドは、VPN Bridge では実行できません。\nこのコマンドは、クラスタとして動作している VPN Server の仮想 HUB では実行できません。 -CMD_CrlDel_Args CrlDel [id] -CMD_CrlDel_[id] 削除する無効な証明書の定義の ID を指定します。 -CMD_CrlDel_Prompt_ID 削除する ID: - - -# CrlGet コマンド -CMD_CrlGet 無効な証明書の取得 -CMD_CrlGet_Help 現在管理している仮想 HUB に設定されている無効な証明書のリストから、無効な証明書の定義を指定して、その定義内容を取得します。\n現在登録されている無効な証明書の定義一覧は、CrlList コマンドで取得できます。\nこのコマンドは、VPN Bridge では実行できません。\nこのコマンドは、クラスタとして動作している VPN Server の仮想 HUB では実行できません。 -CMD_CrlGet_Args CrlGet [id] -CMD_CrlGet_[id] 取得する無効な証明書の定義の ID を指定します。 -CMD_CrlGet_Prompt_ID 取得する ID: -CMD_CrlGet_CN 名前 (CN) -CMD_CrlGet_O 所属機関 (O) -CMD_CrlGet_OU 組織単位 (OU) -CMD_CrlGet_C 国 (C) -CMD_CrlGet_ST 都道府県 (ST) -CMD_CrlGet_L ローカル (L) -CMD_CrlGet_SERI シリアル番号 (16進数) -CMD_CrlGet_MD5_HASH MD5 ダイジェスト値 (16進数, 128 bit) -CMD_CrlGet_SHA1_HASH SHA-1 ダイジェスト値 (16進数, 160 bit) - - -# AcList コマンド -CMD_AcList 接続元 IP 制限リストのルール一覧の取得 -CMD_AcList_Help 現在管理している仮想 HUB に設定されている 接続元 IP 制限リストのルール一覧を取得します。\nクライアントコンピュータの接続元 IP アドレスによって、この仮想 HUB への VPN 接続を、許可または拒否することができます。複数のルールを定義することができ、各ルールには優先順位を設定することができます。優先順位が高いルールから検索を行い、最初に IP アドレスが一致したルールの動作に基づいて、そのクライアントからの接続を、許可または拒否します。\nこのコマンドは、VPN Bridge では実行できません。\nこのコマンドは、クラスタとして動作している VPN Server の仮想 HUB では実行できません。 -CMD_AcList_Args AcList - - -# AcAdd コマンド -CMD_AcAdd 接続元 IP 制限リストにルールを追加 (IPv4) -CMD_AcAdd_Help 現在管理している仮想 HUB に設定されている 接続元 IP 制限リストに新しいルールを追加します。\nここで設定した項目は、VPN Client が仮想 HUB に接続しようとした際に、そのクライアントからの接続を許可するか拒否するかを決定するために使用されます。\nルール項目の内容として、ルールに一致するクライアントの IP アドレス、または IP アドレスとマスクを指定することができます。IP アドレスのみを指定すると、単一の指定したコンピュータのみがルールに一致することになりますが、IP ネットワークアドレスとマスクを指定すると、そのサブネットの範囲内のすべてのコンピュータがルールに一致することになります。\nルールには優先順位を設定することができます。優先順位は 1 以上の整数で指定し、値が小さいほど優先順位は高く評価されます。\n現在登録されている 接続元 IP 制限リストのルール一覧を取得するには、AcList コマンドを使用します。\nこのコマンドは、VPN Bridge では実行できません。\nこのコマンドは、クラスタとして動作している VPN Server の仮想 HUB では実行できません。 -CMD_AcAdd_Args AcAdd [allow|deny] [/PRIORITY:priority] [/IP:ip/mask] -CMD_AcAdd_[allow|deny] ルールに一致したクライアントからの接続を許可する ("allow") か拒否する ("deny") かを設定します。 -CMD_AcAdd_PRIORITY ルールの優先順位を 1 以上の整数で指定します。値が小さいほど優先順位は高く評価されます。 -CMD_AcAdd_IP [IP アドレス/マスク] の形式で、クライアント IPv4 アドレスの範囲を指定します。IPv4 アドレスは 192.168.0.1 のように、10 進数をドットで区切って指定します。マスクは 255.255.255.0 のように 10 進数をドットで区切って指定するか、24 のように先頭からのビット長を 10 進数で指定します。単一の IPv4 ホストを指定するには、マスクを 255.255.255.255 または 32 として指定します。 -CMD_AcAdd_Prompt_AD allow または deny: -CMD_AcAdd_Prompt_PRIORITY 優先順位: -CMD_AcAdd_Prompt_IP IPv4 アドレス/マスク: -CMD_AcAdd_Eval_PRIORITY 優先順位は 1 以上で指定してください。 - - -# AcAdd6 コマンド -CMD_AcAdd6 接続元 IP 制限リストにルールを追加 (IPv6) -CMD_AcAdd6_Help 現在管理している仮想 HUB に設定されている 接続元 IP 制限リストに新しいルールを追加します。\nここで設定した項目は、VPN Client が仮想 HUB に接続しようとした際に、そのクライアントからの接続を許可するか拒否するかを決定するために使用されます。\nルール項目の内容として、ルールに一致するクライアントの IP アドレス、または IP アドレスとマスクを指定することができます。IP アドレスのみを指定すると、単一の指定したコンピュータのみがルールに一致することになりますが、IP ネットワークアドレスとマスクを指定すると、そのサブネットの範囲内のすべてのコンピュータがルールに一致することになります。\nルールには優先順位を設定することができます。優先順位は 1 以上の整数で指定し、値が小さいほど優先順位は高く評価されます。\n現在登録されている 接続元 IP 制限リストのルール一覧を取得するには、AcList コマンドを使用します。\nこのコマンドは、VPN Bridge では実行できません。\nこのコマンドは、クラスタとして動作している VPN Server の仮想 HUB では実行できません。 -CMD_AcAdd6_Args AcAdd6 [allow|deny] [/PRIORITY:priority] [/IP:ip/mask] -CMD_AcAdd6_[allow|deny] ルールに一致したクライアントからの接続を許可する ("allow") か拒否する ("deny") かを設定します。 -CMD_AcAdd6_PRIORITY ルールの優先順位を 1 以上の整数で指定します。値が小さいほど優先順位は高く評価されます。 -CMD_AcAdd6_IP [IP アドレス/マスク] の形式で、クライアント IPv6 アドレスの範囲を指定します。IPv6 アドレスは 2001:200:0:1:: のように 16 進数をコロンで区切って指定します。マスクは ffff:ffff:ffff:ffff:: のように IPv6 形式で区切って指定するか、64 のように先頭からのビット長を 10 進数で指定します。単一の IPv6 ホストを指定するには、マスクを ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff または 128 として指定します。 -CMD_AcAdd6_Prompt_AD allow または deny: -CMD_AcAdd6_Prompt_PRIORITY 優先順位: -CMD_AcAdd6_Prompt_IP IPv6 アドレス/サブネットマスク: -CMD_AcAdd6_Eval_PRIORITY 優先順位は 1 以上で指定してください。 - -# AcDel コマンド -CMD_AcDel 接続元 IP 制限リスト内のルールの削除 -CMD_AcDel_Help 現在管理している仮想 HUB に設定されている 接続元 IP 制限リストのルールを削除します。\n現在登録されている 接続元 IP 制限リストのルール一覧を取得するには、AcList コマンドを使用します。\nこのコマンドは、VPN Bridge では実行できません。\nこのコマンドは、クラスタとして動作している VPN Server の仮想 HUB では実行できません。 -CMD_AcDel_Args AcDel [id] -CMD_AcDel_[id] 削除する接続元 IP 制限リスト内のルールの ID を指定します。 -CMD_AcDel_Prompt_ID 削除するルールの ID: - - -# LicenseAdd コマンド -CMD_LicenseAdd 新しいライセンスキーの登録 -CMD_LicenseAdd_Help SoftEther VPN Server に、新しいライセンスキーを登録します。\nSoftEther VPN Server を使用するには、有効なライセンスを取得し、ライセンスキーを登録する必要があります。ライセンスキーは、36 桁の英数字およびハイフン ( '-' ) で構成されている、ライセンスの所有を証明するキーコードです。\nライセンスキーは、本ソフトウェアと共にライセンス証書を受け取った場合は、ライセンス証書に印刷されています。本ソフトウェアのライセンスをオンラインで購入した場合は、購入時の Web サイトの画面やメールなどにライセンスキーが記載されていることがあります。また、その他の方法で、ライセンスキーが記載されている場合もあります。不明な場合は、ライセンスの購入元にお問い合わせください。\n\n現在登録されているライセンスの一覧を取得するには、LicenseList コマンドを使用します。\n現在の VPN Server のライセンス状態を表示するには、LicenseStatus コマンドを使用します。\nこのコマンドを実行するには、VPN Server の管理者権限が必要です。\nこのコマンドは、VPN Bridge では実行できません。 -CMD_LicenseAdd_Args LicenseAdd [key] -CMD_LicenseAdd_[key] 登録するライセンスキーを指定します。36 桁の英数字を、6 桁ごとにハイフンで区切って指定してください。 -CMD_LicenseAdd_Prompt_Key ライセンスキー: - - -# LicenseDel コマンド -CMD_LicenseDel 登録されているライセンスの削除 -CMD_LicenseDel_Help SoftEther VPN Server に、現在登録されているライセンス一覧から、指定されたライセンスを削除します。\n\n現在登録されているライセンスの一覧を取得するには、LicenseList コマンドを使用します。\n現在の VPN Server のライセンス状態を表示するには、LicenseStatus コマンドを使用します。\nこのコマンドを実行するには、VPN Server の管理者権限が必要です。\nこのコマンドは、VPN Bridge では実行できません。 -CMD_LicenseDel_Args LicenseDel [id] -CMD_LicenseDel_[id] 削除するライセンスの番号を指定します。 -CMD_LicenseDel_Prompt_ID 削除するライセンスの番号: - - -# LicenseList コマンド -CMD_LicenseList 登録されているライセンス一覧の取得 -CMD_LicenseList_Help SoftEther VPN Server に、現在登録されているライセンスのライセンスキー、ライセンス種類名、状態、有効期限、ライセンス ID、ライセンス種類 ID、サーバー ID およびシリアル ID の一覧を表示します。\n\n現在の VPN Server のライセンス状態を表示するには、LicenseStatus コマンドを使用します。\nこのコマンドを実行するには、VPN Server の管理者権限が必要です。\nこのコマンドは、VPN Bridge では実行できません。 -CMD_LicenseList_Args LicenseList - - -# LicenseStatus コマンド -CMD_LicenseStatus 現在の VPN Server のライセンス状態の取得 -CMD_LicenseStatus_Help 現在の SoftEther VPN Server のライセンス状態を取得して表示します。\nSoftEther VPN Server の現在の製品エディション名、サーバー ID、製品ライセンスの有効期限、および利用可能なクライアント接続ライセンス数とブリッジ接続ライセンス数が表示されます。\n\nこのコマンドを実行するには、VPN Server の管理者権限が必要です。\nこのコマンドは、VPN Bridge では実行できません。 -CMD_LicenseStatus_Args LicenseStatus - - -## SoftEther VPN 4.0 で新たに追加されたコマンド - -# IPsecEnable コマンド -CMD_IPsecEnable IPsec VPN サーバー機能の有効化 / 無効化 -CMD_IPsecEnable_Help SoftEther VPN Server の IPsec VPN サーバー機能を有効化 / 無効化します。\nIPsec VPN サーバー機能を有効にすると、VPN Server 上の仮想 HUB は、IPsec / L2TP / EtherIP / L2TPv3 に対応した PC や Mac OS X、スマートフォン、ルータ等からの VPN 接続を受付けることができるようになります。\n\nこのコマンドを実行するには、VPN Server の管理者権限が必要です。\nこのコマンドは、VPN Bridge では実行できません。\nこのコマンドは、クラスタとして動作している VPN Server の仮想 HUB では実行できません。 -CMD_IPsecEnable_Args IPsecEnable [/L2TP:yes|no] [/L2TPRAW:yes|no] [/ETHERIP:yes|no] [/PSK:pre-shared-key] [/DEFAULTHUB:default_hub] -CMD_IPsecEnable_L2TP L2TP over IPsec サーバー機能を有効または無効に設定します。iPhone、iPad、Android、Windows、Mac OS X からの VPN 接続を受付けるにはこの機能を有効にしてください。 -CMD_IPsecEnable_L2TPRAW IPsec を用いない L2TP サーバー機能を有効または無効に設定します。特殊なクライアントからの接続を受付ける場合のみ有効にしてください。 -CMD_IPsecEnable_ETHERIP EtherIP / L2TPv3 over IPsec サーバー機能 (拠点間接続 VPN サーバー機能) を有効または無効に設定します。EtherIP / L2TPv3 over IPsec に対応した市販のルータ製品は、この VPN Server の仮想 HUB にレイヤ 2 (Ethernet) でブリッジ接続できるようになります。 -CMD_IPsecEnable_PSK IPsec 事前共有鍵を設定します。IPsec 事前共有鍵は、「PSK (Pre-Shared Key)」または「シークレット」と呼ばれることがあります。8 文字程度で設定し、VPN を利用するすべてのユーザーに配布してください。Google Android 4.0 にはバグがあり、PSK の文字数が 10 文字を超えた場合は VPN 通信に失敗することがあります。そのため、PSK の文字数は 9 文字以下にすることを推奨します。 -CMD_IPsecEnable_DEFAULTHUB 接続時のユーザー名において仮想 HUB 名が省略された場合に接続するデフォルトの仮想 HUB の名前を指定します。通常、L2TP, OpenVPN および MS-SSTP VPN 接続時のユーザー名は "仮想HUB名\\ユーザー名" または "ユーザー名@仮想HUB名" のように指定される必要があります。もしユーザーが仮想 HUB 名の指定を省略した場合は、DEFAULTHUB パラメータとして指定されている仮想 HUB がデフォルトの仮想 HUB として選択されることになります。 -CMD_IPsecEnable_Prompt_L2TP L2TP over IPsec サーバー機能を有効 (yes / no): -CMD_IPsecEnable_Prompt_L2TPRAW Raw L2TP サーバー機能を有効 (yes / no): -CMD_IPsecEnable_Prompt_ETHERIP EtherIP / L2TPv3 over IPsec サーバー機能を有効 (yes / no): -CMD_IPsecEnable_Prompt_PSK IPsec 事前共有鍵の文字列 (9 文字以下を推奨): -CMD_IPsecEnable_Prompt_DEFAULTHUB VPN 接続時に仮想 HUB 名が省略された場合のデフォルト仮想 HUB 名: - - -# IPsecGet コマンド -CMD_IPsecGet IPsec VPN サーバー機能の現在の設定の取得 -CMD_IPsecGet_Help SoftEther VPN Server の IPsec VPN サーバー機能の現在の設定を取得して表示します。\n\nこのコマンドを実行するには、VPN Server の管理者権限が必要です。\nこのコマンドは、VPN Bridge では実行できません。\nこのコマンドは、クラスタとして動作している VPN Server の仮想 HUB では実行できません。 -CMD_IPsecGet_Args IPsecGet -CMD_IPsecGet_PRINT_L2TP L2TP over IPsec サーバー機能は有効 -CMD_IPsecGet_PRINT_L2TPRAW Raw L2TP サーバー機能は有効 -CMD_IPsecGet_PRINT_ETHERIP EtherIP / L2TPv3 over IPsec サーバー機能は有効 -CMD_IPsecGet_PRINT_PSK IPsec 事前共有鍵の文字列 -CMD_IPsecGet_PRINT_DEFAULTHUB デフォルト仮想 HUB 名 - - -# EtherIpClientAdd コマンド -CMD_EtherIpClientAdd EtherIP / L2TPv3 over IPsec サーバー機能のクライアントデバイスからの接続を受付けるための接続設定の追加 -CMD_EtherIpClientAdd_Help EtherIP / L2TPv3 over IPsec サーバー機能のクライアントデバイスからの接続を受付けるための接続設定を追加します。\nEtherIP / L2TPv3 over IPsec サーバー機能が有効になっている場合にルータ等からの接続を受付けるには、予めクライアント側となる EtherIP / L2TPv3 over IPsec 対応ルータが VPN Server に接続する際の IPsec Phase 1 文字列と、接続先の仮想 HUB の情報の対応表を定義しておく必要があります。\nEtherIpClientAdd コマンドを用いて定義を追加することにより、EtherIP / L2TPv3 over IPsec クライアントがこの VPN Server に接続しようとした際の ISAKMP (IKE) Phase 1 のイニシエータ ID 文字列が定義に一致する場合に、定義されている仮想 HUB への接続設定が適用されます。\nユーザー名とパスワードは、仮想 HUB に登録されている必要があります。EtherIP / L2TPv3 クライアントは、このコマンドで入力された情報で識別されるユーザーの権限で仮想 HUB に接続したものとみなされます。\n\nこのコマンドを実行するには、VPN Server の管理者権限が必要です。\nこのコマンドは、VPN Bridge では実行できません。\nこのコマンドは、クラスタとして動作している VPN Server の仮想 HUB では実行できません。 -CMD_EtherIpClientAdd_Args EtherIpClientAdd [ID] [/HUB:hubname] [/USERNAME:username] [/PASSWORD:password] -CMD_EtherIpClientAdd_[ID] ISAKMP Phase 1 ID を指定します。ID はクライアント側のルータの接続設定で設定するものと同一の文字列を指定してください。文字列のほか、ID の種類が IP アドレスの場合は IP アドレスも指定できます。なお、'*' (アスタリスク) を指定するとワイルドカード指定となり、他の明示的なルールに一致しないすべての接続元クライアントが対象となります。 -CMD_EtherIpClientAdd_HUB 接続先の仮想 HUB の名前を指定します。 -CMD_EtherIpClientAdd_USERNAME 接続先の仮想 HUB にログインするためのユーザー名を指定します。 -CMD_EtherIpClientAdd_PASSWORD 接続先の仮想 HUB にログインするためのパスワードを指定します。 -CMD_EtherIpClientAdd_Prompt_ID ISAKMP Phase 1 ID ('*' でワイルドカード指定): -CMD_EtherIpClientAdd_Prompt_HUB 接続先の仮想 HUB の名前: -CMD_EtherIpClientAdd_Prompt_USERNAME 仮想 HUB ログイン用ユーザー名: -CMD_EtherIpClientAdd_Prompt_PASSWORD 仮想 HUB ログイン用パスワード: - - -# EtherIpClientDelete コマンド -CMD_EtherIpClientDelete EtherIP / L2TPv3 over IPsec サーバー機能のクライアントデバイスからの接続を受付けるための接続設定の削除 -CMD_EtherIpClientDelete_Help EtherIP / L2TPv3 over IPsec サーバー機能のクライアントデバイスからの接続を受付けるための接続設定の定義済み項目を削除します。\n\nこのコマンドを実行するには、VPN Server の管理者権限が必要です。\nこのコマンドは、VPN Bridge では実行できません。\nこのコマンドは、クラスタとして動作している VPN Server の仮想 HUB では実行できません。 -CMD_EtherIpClientDelete_Args EtherIpClientDelete [ID] -CMD_EtherIpClientDelete_[ID] ISAKMP Phase 1 ID を指定します。 -CMD_EtherIpClientDelete_Prompt_ID ISAKMP Phase 1 ID: - - -# EtherIpClientList コマンド -CMD_EtherIpClientList EtherIP / L2TPv3 over IPsec サーバー機能のクライアントデバイスからの接続を受付けるための接続設定の一覧表示 -CMD_EtherIpClientList_Help EtherIP / L2TPv3 over IPsec サーバー機能のクライアントデバイスからの接続を受付けるための接続設定の定義済み一覧を表示します。\n\nこのコマンドを実行するには、VPN Server の管理者権限が必要です。\nこのコマンドは、VPN Bridge では実行できません。\nこのコマンドは、クラスタとして動作している VPN Server の仮想 HUB では実行できません。 -CMD_EtherIpClientList_Args EtherIpClientList - - -# OpenVpnMakeConfig コマンド -CMD_OpenVpnMakeConfig OpenVPN 互換サーバー機能に接続可能なサンプルの OpenVPN 設定ファイルの生成 -CMD_OpenVpnMakeConfig_Help 本来、OpenVPN クライアントを使うためには設定ファイルを手動で記述する必要がありますが、これは難易度が高い作業です。しかし、このコマンドを使用すればこの VPN Server に接続することができる基本的な OpenVPN クライアント用の設定ファイルを自動的に生成することができます。\n\nこのコマンドを実行するには、VPN Server の管理者権限が必要です。\nこのコマンドは、VPN Bridge では実行できません。\nこのコマンドは、クラスタとして動作している VPN Server の仮想 HUB では実行できません。 -CMD_OpenVpnMakeConfig_Args OpenVpnMakeConfig [ZIP_FileName] -CMD_OpenVpnMakeConfig_[ZIP_FileName] このコマンドによって出力される設定ファイル (ZIP 圧縮形式) の保存先ファイル名を指定します。拡張子が指定されていない場合は自動的に ".zip" が付加されます。 -CMD_OpenVpnMakeConfig_Prompt_ZIP 設定ファイルを保存する先のファイル名 (ZIP 圧縮形式): -CMD_OpenVpnMakeConfig_OK サンプル設定ファイルを "%s" ファイルに保存しました。このファイルを unzip コマンドなどを用いて展開して使用できます。\n -CMD_OpenVpnMakeConfig_ERROR サンプル設定ファイルを "%s" ファイルに保存できませんでした。ファイル名が正しくない可能性があります。\n - - -# ServerCertRegenerate コマンド -CMD_ServerCertRegenerate 指定された CN (Common Name) を持つ自己署名証明書を新たに作成し VPN Server に登録 -CMD_ServerCertRegenerate_Help SoftEther VPN Server の SSL-VPN 機能で提示されるサーバー証明書を、新たに作成する証明書に置き換えます。新たな証明書は自己署名証明書として生成され、CN (Common Name) の値を任意の文字列に設定することができます。\n\nこのコマンドは、Microsoft SSTP VPN 互換サーバー機能を使用しようとする場合に便利です。なぜならば、SSTP VPN クライアント (Windows Vista / 7 / 8 / RT / 10 に標準搭載) は接続先の VPN Server の提示する SSL 証明書の CN (Common Name) の値が接続先として指定されているホスト名文字列と完全に一致するかどうかを検証し、もし一致しない場合は接続をキャンセルするためです。\n\nこのコマンドは、既存の VPN Server の SSL 証明書を削除します。ServerCertGet コマンドおよび ServerKeyGet コマンドを用いて、現在の証明書と秘密鍵をバックアップしておくことを推奨します。\n\nこのコマンドを実行するには、VPN Server の管理者権限が必要です。\nこのコマンドは、VPN Bridge では実行できません。 -CMD_ServerCertRegenerate_Args ServerCertRegenerate [CN] -CMD_ServerCertRegenerate_[CN] 新たに生成する自己署名証明書の Common Name (CN) の値を指定します。 -CMD_ServerCertRegenerate_Prompt_CN Common Name (CN) の値: - - -# VpnOverIcmpDnsEnable コマンド -CMD_VpnOverIcmpDnsEnable VPN over ICMP / VPN over DNS サーバー機能を有効化 / 無効化 -CMD_VpnOverIcmpDnsEnable_Help ファイアウォールやルータ等の故障や過負荷、設定ミス等により TCP/IP 通信ができない環境のネットワークからでも、ICMP (Ping) または DNS パケットの通信が可能であれば、VPN Server と VPN Client との間で VPN 通信を行うことができます。そのためには、予め VPN over ICMP / VPN over DNS サーバー機能を有効にしておく必要があります。\n\n警告: この機能はファイアウォールやルータ等が一時的に不調となっており ICMP または DNS のみ安定した通信が可能な環境で VPN 通信を確立するための機能であ。緊急時などには有益ですが、長期間の利用には適しない場合があります。\n\n接続元の VPN Client または VPN Bridge は内部バージョン 4.0 以降が必要です。\n\nこのコマンドを実行するには、VPN Server の管理者権限が必要です。\nこのコマンドは、VPN Bridge では実行できません。 -CMD_VpnOverIcmpDnsEnable_Args VpnOverIcmpDnsEnable [/ICMP:yes|no] [/DNS:yes|no] -CMD_VpnOverIcmpDnsEnable_ICMP VPN over ICMP サーバーを有効にするには yes、無効にするには no を指定します。 -CMD_VpnOverIcmpDnsEnable_DNS VPN over DNS サーバーを有効にするには yes、無効にするには no を指定します。 -CMD_VpnOverIcmpDnsEnable_Prompt_ICMP VPN over ICMP サーバーを有効 (yes / no): -CMD_VpnOverIcmpDnsEnable_Prompt_DNS VPN over DNS サーバーを有効 (yes / no): - - -# VpnOverIcmpDnsGet コマンド -CMD_VpnOverIcmpDnsGet 現在の VPN over ICMP / VPN over DNS サーバー機能の設定を取得 -CMD_VpnOverIcmpDnsGet_Help 現在の VPN over ICMP / VPN over DNS サーバー機能の設定を取得して表示します。\n\nこのコマンドを実行するには、VPN Server の管理者権限が必要です。\nこのコマンドは、VPN Bridge では実行できません。 -CMD_VpnOverIcmpDnsGet_Args VpnOverIcmpDnsGet -CMD_VpnOverIcmpDnsGet_PRINT_ICMP VPN over ICMP サーバーが有効 -CMD_VpnOverIcmpDnsGet_PRINT_DNS VPN over DNS サーバーが有効 - - -# DynamicDnsGetStatus コマンド -CMD_DynamicDnsGetStatus ダイナミック DNS 機能の現在の状態の取得 -CMD_DynamicDnsGetStatus_Help ダイナミック DNS 機能の現在の状態を取得して表示します。\n\nダイナミック DNS による、VPN Server コンピュータに永続的な固有の DNS ホスト名が割当てられます。これにより独自でドメインを所有していなくても、VPN Client や VPN Bridge などの設定画面上が VPN Server の IP アドレスの代わりに DNS ホスト名によって VPN Server を指定することができます。\nまた、IP アドレスが変化する可能性がある一般的な ISP を用いて VPN Server をインターネットに接続する場合でも、IP アドレスが変化すれば自動的に DNS ホスト名対応する IP アドレスが更新されますので、可変 IP アドレスでも VPN Server を運用することができるようになります。\nこれにより、高価な月額料金が必要な固定グローバル IP アドレスのサービスを契約する必要がなくなります。\n\n[注意]\nダイナミック DNS 機能を無効にするには、VPN Server の設定ファイルを編集します。\n"declare root" ディレクティブ内に "declare DDnsClient" ディレクティブがあります。この中にある "bool Disable" の値を true に設定して VPN Server を再起動することにより、ダイナミック DNS 機能が無効になります。\n\nこのコマンドを実行するには、VPN Server の管理者権限が必要です。\nこのコマンドは、VPN Bridge では実行できません。 -CMD_DynamicDnsGetStatus_Args DynamicDnsGetStatus -CMD_DynamicDnsGetStatus_PRINT_FQDN 割当ダイナミック DNS ホスト名 (完全) -CMD_DynamicDnsGetStatus_PRINT_HOSTNAME 割当ダイナミック DNS ホスト名 (ホスト名) -CMD_DynamicDnsGetStatus_PRINT_SUFFIX DNS サフィックス -CMD_DynamicDnsGetStatus_PRINT_IPv4 グローバル IPv4 アドレス -CMD_DynamicDnsGetStatus_PRINT_IPv6 グローバル IPv6 アドレス - - -# DynamicDnsSetHostname コマンド -CMD_DynamicDnsSetHostname ダイナミック DNS ホスト名の設定 -CMD_DynamicDnsSetHostname_Help ダイナミック DNS 機能で VPN Server が使用するホスト名を設定します。現在割当てられているホスト名は DynamicDnsGetStatus コマンドで確認できます。\n\nダイナミック DNS による、VPN Server コンピュータに永続的な固有の DNS ホスト名が割当てられます。これにより独自でドメインを所有していなくても、VPN Client や VPN Bridge などの設定画面上が VPN Server の IP アドレスの代わりに DNS ホスト名によって VPN Server を指定することができます。\nまた、IP アドレスが変化する可能性がある一般的な ISP を用いて VPN Server をインターネットに接続する場合でも、IP アドレスが変化すれば自動的に DNS ホスト名対応する IP アドレスが更新されますので、可変 IP アドレスでも VPN Server を運用することができるようになります。\nこれにより、高価な月額料金が必要な固定グローバル IP アドレスのサービスを契約する必要がなくなります。\n\n[注意]\nダイナミック DNS 機能を無効にするには、VPN Server の設定ファイルを編集します。\n"declare root" ディレクティブ内に "declare DDnsClient" ディレクティブがあります。この中にある "bool Disable" の値を true に設定して VPN Server を再起動することにより、ダイナミック DNS 機能が無効になります。\n\nこのコマンドを実行するには、VPN Server の管理者権限が必要です。\nこのコマンドは、VPN Bridge では実行できません。 -CMD_DynamicDnsSetHostname_Args DynamicDnsSetHostname [hostname] -CMD_DynamicDnsSetHostname_[hostname] 新しいホスト名を 3 文字以上 31 文字以下の半角英数字およびハイフン '-' で指定します。変更は何度でも可能です。 -CMD_DynamicDnsSetHostname_Prompt_hostname ダイナミック DNS ホスト名 (3 - 31 文字): - - -# VpnAzureGetStatus コマンド -CMD_VpnAzureGetStatus VPN Azure 機能の現在の状態の取得 -CMD_VpnAzureGetStatus_Help VPN Azure 機能の現在の状態を取得します。\n\nVPN Azure により、会社のパソコンに自宅や外出先のパソコンから非常に簡単に VPN 接続できるようになります。VPN 接続中は会社のパソコンを経由して、社内 LAN の他のサーバーにもアクセスできます。\n会社のパソコン (VPN Server) にはグローバル IP アドレスは不要です。ファイアウォールや NAT の内側であっても動作し、ネットワーク管理者による設定は一切必要ありません。VPN クライアントとなる自宅のパソコンでは、Windows に標準付属の SSTP VPN クライアントを使用できます。\nVPN Azure は、SoftEther VPN Server をお使いの方はどなたでも無料で利用できるクラウド VPN サービスです。ソフトイーサ株式会社によって運営されています。使い方は http://www.vpnazure.net/ に掲載されています。\n\nVPN Azure ホスト名はダイナミック DNS サービスのホスト名のドメイン部分を "vpnazure.net" に変更したものが使用されます。ホスト名を変更するには DynamicDnsSetHostname コマンドを使用してください。\n\nこのコマンドを実行するには、VPN Server の管理者権限が必要です。\nこのコマンドは、VPN Bridge では実行できません。\nこのコマンドは、クラスタとして動作している VPN Server の仮想 HUB では実行できません。 -CMD_VpnAzureGetStatus_Args VpnAzureGetStatus -CMD_VpnAzureGetStatus_PRINT_ENABLED VPN Azure 機能が有効 -CMD_VpnAzureGetStatus_PRINT_CONNECTED VPN Azure クラウドサーバーへ接続完了 -CMD_VpnAzureGetStatus_PRINT_HOSTNAME VPN Azure サービス上でのホスト名 - - -# VpnAzureSetStatus コマンド -CMD_VpnAzureSetEnable VPN Azure 機能の有効化 / 無効化 -CMD_VpnAzureSetEnable_Help VPN Azure 機能を有効または無効にします。\n\nVPN Azure により、会社のパソコンに自宅や外出先のパソコンから非常に簡単に VPN 接続できるようになります。VPN 接続中は会社のパソコンを経由して、社内 LAN の他のサーバーにもアクセスできます。\n会社のパソコン (VPN Server) にはグローバル IP アドレスは不要です。ファイアウォールや NAT の内側であっても動作し、ネットワーク管理者による設定は一切必要ありません。VPN クライアントとなる自宅のパソコンでは、Windows に標準付属の SSTP VPN クライアントを使用できます。\nVPN Azure は、SoftEther VPN Server をお使いの方はどなたでも無料で利用できるクラウド VPN サービスです。ソフトイーサ株式会社によって運営されています。使い方は http://www.vpnazure.net/ に掲載されています。\n\nVPN Azure ホスト名はダイナミック DNS サービスのホスト名のドメイン部分を "vpnazure.net" に変更したものが使用されます。ホスト名を変更するには DynamicDnsSetHostname コマンドを使用してください。\n\nこのコマンドを実行するには、VPN Server の管理者権限が必要です。\nこのコマンドは、VPN Bridge では実行できません。\nこのコマンドは、クラスタとして動作している VPN Server の仮想 HUB では実行できません。 -CMD_VpnAzureSetEnable_Args VpnAzureSetEnable [yes|no] -CMD_VpnAzureSetEnable_[yes|no] VPN Azure 機能を有効にするには yes、無効にするには no を指定します。 -CMD_VpnAzureSetEnable_PROMPT VPN Azure 機能を有効 (yes / no): - - - -###################################################### -# # -# ここから下は VPN Client 用の管理コマンド # -# # -###################################################### - - -# VersionGet コマンド -CMD_VersionGet VPN Client サービスのバージョン情報の取得 -CMD_VersionGet_Help 現在管理している VPN Client サービスプログラムのバージョン情報を取得します。 -CMD_VersionGet_Args VersionGet -CMD_VersionGet_1 製品名 -CMD_VersionGet_2 バージョン情報 -CMD_VersionGet_3 ビルド情報 -CMD_VersionGet_4 プロセス ID -CMD_VersionGet_5 OS の種類 - - -# PasswordSet コマンド -CMD_PasswordSet VPN Client サービスに接続するためのパスワードの設定 -CMD_PasswordSet_Help VPN Client サービスに、コマンドライン管理ユーティリティや VPN クライアント接続マネージャなどから接続して制御を行う際に、パスワードの入力を求めることができます。このコマンドを用いて、入力を求めるパスワードを設定することができます。\nパスワードは、リモート (localhost 以外のコンピュータ) から操作を行う場合のみ入力させることを要求することもできます。 -CMD_PasswordSet_Args PasswordSet [password] [/REMOTEONLY:yes|no] -CMD_PasswordSet_[password] 設定するパスワードを指定します。"none" と指定すると、パスワードの設定を削除することができます。 -CMD_PasswordSet_REMOTEONLY yes を指定すると、パスワードはリモート (localhost 以外のコンピュータ) から操作を行う場合のみ要求され、localhost からの接続時には要求されなくなります。このパラメータを省略した場合は、"no" と見なします。 - - -# PasswordGet コマンド -CMD_PasswordGet VPN Client サービスに接続するためのパスワードの設定の取得 -CMD_PasswordGet_Help VPN Client サービスに、コマンドライン管理ユーティリティや VPN クライアント接続マネージャなどから接続して制御を行う際に、パスワードの入力を求めるようになっているかどうかの設定を取得します。\nまた、パスワードを要求する場合についは、リモート (localhost 以外のコンピュータ) から操作を行う場合のみ入力させる設定になっているかどうかも取得します。 -CMD_PasswordGet_Args PasswordGet -CMD_PasswordGet_1 パスワードの設定 -CMD_PasswordGet_2 リモートからの接続時のみパスワードを要求 - - -# CertList コマンド -CMD_CertList 信頼する証明機関の証明書一覧の取得 -CMD_CertList_Help VPN Client が信頼する証明機関の証明書一覧を管理します。登録されている証明機関の証明書一覧は、VPN Server への接続時の、サーバー証明書の検証などに利用されます。 -CMD_CertList_Args CertList - - -# CertAdd コマンド -CMD_CertAdd 信頼する証明機関の証明書の追加 -CMD_CertAdd_Help VPN Client が信頼する証明機関の証明書一覧に、新しい証明書を追加します。登録された証明機関の証明書一覧は、VPN Server への接続時の、サーバー証明書の検証などに利用されます。\n現在の証明書一覧を取得するには、CertList コマンドを使用します。\n証明書を追加するには、その証明書が X.509 形式のファイルとして保存されている必要があります。 -CMD_CertAdd_Args CertAdd [path] -CMD_CertAdd_[path] 登録する X.509 証明書ファイル名を指定します。 - - -# CertDelete コマンド -CMD_CertDelete 信頼する証明機関の証明書の削除 -CMD_CertDelete_Help VPN Client が信頼する証明機関の証明書一覧から、既存の証明書を削除します。\n現在の証明書一覧を取得するには、CertList コマンドを使用します。 -CMD_CertDelete_Args CertDelete [id] -CMD_CertDelete_[id] 削除する証明書の ID を指定します。 - - -# CertGet コマンド -CMD_CertGet 信頼する証明機関の証明書の取得 -CMD_CertGet_Help VPN Client が信頼する証明機関の証明書一覧内の、既存の証明書を取得し、X.509 形式のファイルとして保存します。 -CMD_CertGet_Args CertGet [id] [/SAVECERT:path] -CMD_CertGet_[id] 取得する証明書の ID を指定します。 -CMD_CertGet_SAVECERT 取得した証明書を保存するファイル名を指定します。 - - -# SecureList コマンド -CMD_SecureList 使用できるスマートカードの種類の一覧の取得 -CMD_SecureList_Help VPN Client でサポートされているスマートカードの種類の一覧を表示します。\nスマートカードの種類の一覧には、現在コンピュータにドライバがインストールされていて、かつ VPN ソフトウェアでサポートされているデバイスの一覧が表示されます。\r\n現在使用しているスマートカードの種類が表示されない場合は、VPN ソフトウェアをより新しいバージョンにアップデートすることにより使用できるようになる場合もあります。 -CMD_SecureList_Args SecureList - - -# SecureSelect コマンド -CMD_SecureSelect 使用するスマートカードの種類の選択 -CMD_SecureSelect_Help VPN Client で使用するスマートカードの種類を選択します。\n使用できるスマートカードの種類の一覧は、SecureList コマンドで取得することができます。 -CMD_SecureSelect_Args SecureSelect [id] -CMD_SecureSelect_[id] スマートカードの種類の ID を指定します。 -CMD_SecureSelect_PROMPT_ID 使用するスマートカードの種類の ID: - - -# SecureGet コマンド -CMD_SecureGet 使用するスマートカードの種類の ID の取得 -CMD_SecureGet_Help 現在 VPN Client で使用するように設定されているスマートカードの種類の ID を取得します。この ID を元に SecureList コマンドの結果を見ることによって、現在選択されているスマートカードの種類が取得できます。\n現在スマートカードが選択されていない場合は、ID が 0 と表示されます。 -CMD_SecureGet_Args SecureGet -CMD_SecureGet_Print 現在選択されているスマートカード ID は %u です。 -CMD_SecureGet_NoPrint 現在スマートカードは選択されていません。 - - -# NicCreate コマンド -CMD_NicCreate 新規仮想 LAN カードの作成 -CMD_NicCreate_Help 新しい仮想 LAN カードをシステムに追加します。仮想 LAN カードには任意の名前を付けることができます。\nただし、仮想 LAN カード名に使用することができる文字は英数字のみで、Windows 2000 以降のシステムでは 31 文字まで、Windows 98, 98 SE および ME では 4 文字まで設定することができます。\nNicCreate コマンドを呼び出した場合、VPN Client が動作しているオペレーティングシステムに、新しい仮想 LAN カードデバイスドライバがインストールされます。\nこの場合、オペレーティングシステムによっては、デバイスドライバをインストールしても良いかどうか確認するダイアログボックスが表示される場合があります。 -CMD_NicCreate_Args NicCreate [name] -CMD_NicCreate_[name] 仮想 LAN カードの名前を指定します。 -CMD_NicCreate_PROMPT_NAME 仮想 LAN カードの名前: - - -# NicDelete コマンド -CMD_NicDelete 仮想 LAN カードの削除 -CMD_NicDelete_Help 既存の仮想 LAN カードをシステムから削除します。\nシステムから仮想 LAN カードを削除すると、その仮想 LAN カードを使用していた接続は切断されます。\nまた、削除された仮想 LAN カードを使用するように設定されていた接続設定は、別の仮想 LAN カードを使用するように自動的に設定変更されます。\nこのコマンドは、VPN Client が Windows 2000 以降のオペレーティングシステムで動作している場合に使用できます。 -CMD_NicDelete_Args NicDelete [name] -CMD_NicDelete_[name] 仮想 LAN カードの名前を指定します。 - - -# NicUpgrade コマンド -CMD_NicUpgrade 仮想 LAN カードのデバイスドライバのアップグレード -CMD_NicUpgrade_Help 既存の仮想 LAN カードのデバイスドライバのバージョンが古い場合、現在動作している VPN Client に同梱されている最新のデバイスドライバにアップグレードします。アップグレードが行われない場合でも、デバイスドライバを再インストールします。\nオペレーティングシステムによっては、デバイスドライバをインストールしても良いかどうか確認するダイアログボックスが表示される場合があります。\nこのコマンドは、VPN Client が Windows 2000 以降のオペレーティングシステムで動作している場合に使用できます。 -CMD_NicUpgrade_Args NicUpgrade [name] -CMD_NicUpgrade_[name] 仮想 LAN カードの名前を指定します。 - - -# NicGetSetting コマンド -CMD_NicGetSetting 仮想 LAN カードの設定の取得 -CMD_NicGetSetting_Help 既存の仮想 LAN カードの MAC アドレス設定を取得します。\nこのコマンドは、VPN Client が Windows 2000 以降のオペレーティングシステムで動作している場合に使用できます。 -CMD_NicGetSetting_Args NicGetSetting [name] -CMD_NicGetSetting_[name] 仮想 LAN カードの名前を指定します。 -CMD_NicGetSetting_1 デバイス名 -CMD_NicGetSetting_2 状態 -CMD_NicGetSetting_3 MAC アドレス -CMD_NicGetSetting_4 バージョン -CMD_NicGetSetting_5 ドライバファイル名 -CMD_NicGetSetting_6 GUID - - -# NicSetSetting コマンド -CMD_NicSetSetting 仮想 LAN カードの設定の変更 -CMD_NicSetSetting_Help 既存の仮想 LAN カードの MAC アドレス設定を変更します。このコマンドを実行すると、現在動作中の仮想 LAN カードデバイスドライバは再起動します。\nこのコマンドは、VPN Client が Windows 2000 以降のオペレーティングシステムで動作している場合に使用できます。 -CMD_NicSetSetting_Args NicSetSetting [name] [/MAC:mac] -CMD_NicSetSetting_[name] 仮想 LAN カードの名前を指定します。 -CMD_NicSetSetting_MAC 設定する MAC アドレスを指定します。\nMAC アドレスは、6 バイト分の 16 進数を文字列で指定してください。\n例: 00:AC:01:23:45:67 または 00-AC-01-23-45-67 -CMD_NicSetSetting_PROMPT_MAC 設定する MAC アドレス: - - -# NicEnable コマンド -CMD_NicEnable 仮想 LAN カードの有効化 -CMD_NicEnable_Help 既存の仮想 LAN カードが無効化されている場合は、有効化します。\nこのコマンドは、VPN Client が Windows 2000 以降のオペレーティングシステムで動作している場合に使用できます。 -CMD_NicEnable_Args NicEnable [name] -CMD_NicEnable_[name] 仮想 LAN カードの名前を指定します。 - - -# NicDisable コマンド -CMD_NicDisable 仮想 LAN カードの無効化 -CMD_NicDisable_Help 既存の仮想 LAN カードが有効化されている場合は、無効化します。\nこのコマンドは、VPN Client が Windows 2000 以降のオペレーティングシステムで動作している場合に使用できます。 -CMD_NicDisable_Args NicDisable [name] -CMD_NicDisable_[name] 仮想 LAN カードの名前を指定します。 - - -# NicList コマンド -CMD_NicList 仮想 LAN カード一覧の取得 -CMD_NicList_Help 現在システムに登録されている仮想 LAN カードの一覧を取得します。 -CMD_NicList_Args NicList - - -# AccountList コマンド -CMD_AccountList 接続設定一覧の取得 -CMD_AccountList_Help VPN Client に登録されている接続設定の一覧を取得します。 -CMD_AccountList_Args AccountList - - -# AccountCreate コマンド -CMD_AccountCreate 新しい接続設定の作成 -CMD_AccountCreate_Help VPN Client に新しい接続設定を作成します。\n接続設定を作成するには、初期パラメータとして接続設定の名前と接続先のサーバー、および接続先の仮想 HUB、ユーザー名に加えて使用する仮想 LAN カード名を指定する必要があります。新しい接続設定を作成した場合、ユーザー認証の種類は [匿名認証] に初期設定され、プロキシサーバーの設定とサーバー証明書の検証オプションは設定されません。これらの設定やその他の詳細設定を変更するには、接続設定を作成した後に、"Account" という名前で始まる他のコマンドを使用します。 -CMD_AccountCreate_Args AccountCreate [name] [/SERVER:hostname:port] [/HUB:hubname] [/USERNAME:username] [/NICNAME:nicname] -CMD_AccountCreate_[name] 作成する接続設定の名前を指定します。 -CMD_AccountCreate_SERVER [ホスト名:ポート番号] の形式で、接続先の VPN Server のホスト名と、ポート番号を指定します。IP アドレスで指定することもできます。 -CMD_AccountCreate_HUB 接続先の VPN Server 内の仮想 HUB を指定します。 -CMD_AccountCreate_USERNAME 接続先の VPN Server に接続する際の、ユーザー認証で使用するユーザー名を指定します。 -CMD_AccountCreate_NICNAME 接続に使用する仮想 LAN カード名を指定します。 -CMD_AccountCreate_Prompt_Name 接続設定の名前: -CMD_AccountCreate_Prompt_Server 接続先 VPN Server のホスト名とポート番号: -CMD_AccountCreate_Prompt_Hub 接続先仮想 HUB 名: -CMD_AccountCreate_Prompt_Username 接続するユーザー名: -CMD_AccountCreate_Prompt_Nicname 使用する仮想 LAN カード名: - - -# AccountSet コマンド -CMD_AccountSet 接続設定の接続先の設定 -CMD_AccountSet_Help VPN Client に登録されている接続設定の、接続先の VPN Server のホスト名とポート番号、仮想 HUB 名、および接続に使用するユーザー名に加えて使用する仮想 LAN カード名を設定します。 -CMD_AccountSet_Args AccountSet [name] [/SERVER:hostname:port] [/HUB:hubname] -CMD_AccountSet_[name] 設定を変更する接続設定の名前を指定します。 -CMD_AccountSet_SERVER [ホスト名:ポート番号] の形式で、接続先の VPN Server のホスト名と、ポート番号を指定します。IP アドレスで指定することもできます。 -CMD_AccountSet_HUB 接続先の VPN Server 内の仮想 HUB を指定します。 - - -# AccountGet コマンド -CMD_AccountGet 接続設定の設定の取得 -CMD_AccountGet_Help VPN Client に登録されている接続設定の接続設定内容を取得します。\nなお、接続設定の接続設定内容を変更するには、接続設定を作成した後に、"Account" という名前で始まる他のコマンドを使用します。 -CMD_AccountGet_Args AccountGet [name] -CMD_AccountGet_[name] 設定を取得する接続設定の名前を指定します。 - - -# AccountDelete コマンド -CMD_AccountDelete 接続設定の削除 -CMD_AccountDelete_Help VPN Client に登録されている接続設定を削除します。指定された接続設定がオンライン状態である場合は、自動的に接続を切断してから削除します。 -CMD_AccountDelete_Args AccountDelete [name] -CMD_AccountDelete_[name] 削除する接続設定の名前を指定します。 - - -# AccountUsernameSet コマンド -CMD_AccountUsernameSet 接続設定の接続に使用するユーザー名の設定 -CMD_AccountUsernameSet_Help VPN Client に登録されている接続設定を指定し、その接続設定が VPN Server に接続する際の、ユーザー認証に必要なユーザー名を指定します。\nなお、ユーザー認証の種類を指定したり、必要なパラメータを指定したりする必要がある場合があります。これらの情報を変更するには、AccountAnonymousSet、AccountPasswordSet、AccountCertSet、AccountSecureCertSet などのコマンドを使用します。 -CMD_AccountUsernameSet_Args AccountUsernameSet [name] [/USERNAME:username] -CMD_AccountUsernameSet_[name] 設定を変更する接続設定の名前を指定します。 -CMD_AccountUsernameSet_USERNAME 接続設定が VPN Server に接続する際の、ユーザー認証に必要なユーザー名を指定します。 -CMD_AccountUsername_Notice この接続設定の認証方法は、現在パスワード認証に設定されています。ユーザー名を変更した後、AccountPasswordSet コマンドでパスワードを設定し直す必要があります。 - - -# AccountAnonymousSet コマンド -CMD_AccountAnonymousSet 接続設定のユーザー認証の種類を匿名認証に設定 -CMD_AccountAnonymousSet_Help VPN Client に登録されている接続設定を指定し、その接続設定が VPN Server に接続する際のユーザー認証の方法を、[匿名認証] に設定します。 -CMD_AccountAnonymousSet_Args AccountAnonymousSet [name] -CMD_AccountAnonymousSet_[name] 設定を変更する接続設定の名前を指定します。 - - -# AccountPasswordSet コマンド -CMD_AccountPasswordSet 接続設定のユーザー認証の種類をパスワード認証に設定 -CMD_AccountPasswordSet_Help VPN Client に登録されている接続設定を指定し、その接続設定が VPN Server に接続する際のユーザー認証の方法を、[パスワード認証] に設定します。パスワード認証の種類には、[標準パスワード認証] と [RADIUS または NT ドメイン認証] を指定します。 -CMD_AccountPasswordSet_Args AccountPasswordSet [name] [/PASSWORD:password] [/TYPE:standard|radius] -CMD_AccountPasswordSet_[name] 設定を変更する接続設定の名前を指定します。 -CMD_AccountPasswordSet_PASSWORD パスワード認証で使用するパスワードを指定します。指定しない場合は、パスワードを入力するためのプロンプトが表示されます。 -CMD_AccountPasswordSet_TYPE パスワード認証の種類として、"standard" (標準パスワード認証) または "radius" (RADIUS または NT ドメイン認証) の、どちらかを指定します。 -CMD_AccountPasswordSet_Prompt_Type standard または radius の指定: -CMD_AccountPasswordSet_Type_Invalid standard または radius の指定が不正です。 - - -# AccountCertSet コマンド -CMD_AccountCertSet 接続設定のユーザー認証の種類をクライアント証明書認証に設定 -CMD_AccountCertSet_Help VPN Client に登録されている接続設定を指定し、その接続設定が VPN Server に接続する際のユーザー認証の方法を、[クライアント証明書認証] に設定します。証明書としては、X.509 形式の証明書ファイルと、Base 64 でエンコードされた対応した秘密鍵ファイルを指定する必要があります。 -CMD_AccountCertSet_Args AccountCertSet [name] [/LOADCERT:cert] [/LOADKEY:key] -CMD_AccountCertSet_[name] 設定を変更する接続設定の名前を指定します。 -CMD_AccountCertSet_LOADCERT 証明書認証で提示する X.509 形式の証明書ファイル名を指定します。 -CMD_AccountCertSet_LOADKEY 証明書に対応した Base 64 形式でエンコードされた秘密鍵ファイル名を指定します。 - - -# AccountCertGet コマンド -CMD_AccountCertGet 接続設定に用いるクライアント証明書の取得 -CMD_AccountCertGet_Help VPN Client に登録されている接続設定を指定し、その接続設定がクライアント証明書認証を使用する場合は、クライアント証明書として提示する証明書を取得して、証明書ファイルを X.509 形式で保存します。 -CMD_AccountCertGet_Args AccountCertGet [name] [/SAVECERT:cert] -CMD_AccountCertGet_[name] 設定を取得する接続設定の名前を指定します。 -CMD_AccountCertGet_SAVECERT 取得した証明書を X.509 形式で保存するファイル名を指定します。 - - -# AccountEncryptEnable コマンド -CMD_AccountEncryptEnable 接続設定の通信時の暗号化の有効化 -CMD_AccountEncryptEnable_Help VPN Client に登録されている接続設定を指定し、その接続設定が VPN Server との間で VPN 接続を行なって通信をする際に、VPN Server との間の通信内容を SSL で暗号化するように設定します。\n通常は、VPN Server との間の通信を SSL で暗号化して、情報の盗聴や改ざんを防止します。暗号化を無効にすることもできます。暗号化を無効にすると、通信のスループットが向上しますが、通信データは平文でネットワーク上を流れます。 -CMD_AccountEncryptEnable_Args AccountEncryptEnable [name] -CMD_AccountEncryptEnable_[name] 設定を変更する接続設定の名前を指定します。 - - -# AccountEncryptDisable コマンド -CMD_AccountEncryptDisable 接続設定の通信時の暗号化の無効化 -CMD_AccountEncryptDisable_Help VPN Client に登録されている接続設定を指定し、その接続設定が VPN Server との間で VPN 接続を行なって通信をする際に、VPN Server との間の通信内容を暗号化しないように設定します。\n通常は、VPN Server との間の通信を SSL で暗号化して、情報の盗聴や改ざんを防止します。暗号化を無効にすることもできます。暗号化を無効にすると、通信のスループットが向上しますが、通信データは平文でネットワーク上を流れます。 -CMD_AccountEncryptDisable_Args AccountEncryptDisable [name] -CMD_AccountEncryptDisable_[name] 設定を変更する接続設定の名前を指定します。 - - -# AccountCompressEnable コマンド -CMD_AccountCompressEnable 接続設定の通信時のデータ圧縮の有効化 -CMD_AccountCompressEnable_Help VPN Client に登録されている接続設定を指定し、その接続設定が VPN Server との間で VPN 接続を行なって通信をする際に、VPN Server との間の通信内容を圧縮するように設定します。\n最大で約 80 % 程度の圧縮を行うことができます。ただし、圧縮を行うと、クライアントおよびサーバーの両方で CPU 負荷が高くなります。回線速度が約 10 Mbps 以上の場合は、圧縮を行うとスループットが低下し、逆効果となる場合があります。 -CMD_AccountCompressEnable_Args AccountCompressEnable [name] -CMD_AccountCompressEnable_[name] 設定を変更する接続設定の名前を指定します。 - - -# AccountCompressDisable コマンド -CMD_AccountCompressDisable 接続設定の通信時のデータ圧縮の無効化 -CMD_AccountCompressDisable_Help VPN Client に登録されている接続設定を指定し、その接続設定が VPN Server との間で VPN 接続を行なって通信をする際に、VPN Server との間の通信内容を圧縮しないように設定します。 -CMD_AccountCompressDisable_Args AccountCompressDisable [name] -CMD_AccountCompressDisable_[name] 設定を変更する接続設定の名前を指定します。 - - -# AccountHttpHeader* コマンド -CMD_AccountHttpHeader_Prompt_Name ヘッダー名 (コロンより前の部分): -CMD_AccountHttpHeader_Prompt_Data ヘッダー値 (コロンより後の部分): - - -# AccountHttpHeaderAdd コマンド -CMD_AccountHttpHeaderAdd プロキシサーバー経由で接続する際のカスタム HTTP ヘッダーを追加 -CMD_AccountHttpHeaderAdd_Help VPN Client に登録されている接続設定を指定し、経由する HTTP プロキシサーバーに送信されるカスタム HTTP ヘッダーを追加します。カスタム HTTP ヘッダーを使用することによりネットワークに課された特定の制限を回避したり、QoS により適当される速度制限を回避できる場合があります。 -CMD_AccountHttpHeaderAdd_Args AccountHttpHeaderAdd [name] [/NAME:name] [/DATA:data] -CMD_AccountHttpHeaderAdd_[name] 設定を変更する接続設定の名前を指定します。 -CMD_AccountHttpHeaderAdd_NAME 追加するヘッダーの名前を指定します (コロンより前の部分)。 -CMD_AccountHttpHeaderAdd_DATA 追加するヘッダーの値を指定します (コロンより後の部分)。 - - -# AccountHttpHeaderDelete コマンド -CMD_AccountHttpHeaderDelete プロキシサーバー経由で接続する際のカスタム HTTP ヘッダーを削除 -CMD_AccountHttpHeaderDelete_Help VPN Client に登録されている接続設定を指定し、経由する HTTP プロキシサーバーに送信されるカスタム HTTP ヘッダーを削除します。カスタム HTTP ヘッダーを使用することによりネットワークに課された特定の制限を回避したり、QoS により適当される速度制限を回避できる場合があります。 -CMD_AccountHttpHeaderDelete_Args AccountHttpHeaderDelete [name] [/NAME:name] -CMD_AccountHttpHeaderDelete_[name] 設定を削除する接続設定の名前を指定します。 -CMD_AccountHttpHeaderDelete_NAME 削除するヘッダーの名前を指定します (コロンより前の部分)。 - - -# AccountHttpHeaderGet コマンド -CMD_AccountHttpHeaderGet プロキシサーバー経由で接続する際のカスタム HTTP ヘッダー一覧を取得 -CMD_AccountHttpHeaderGet_Help VPN Client に登録されている接続設定を指定し、経由する HTTP プロキシサーバーに送信されるカスタム HTTP ヘッダーの一覧を表示します。カスタム HTTP ヘッダーを使用することによりネットワークに課された特定の制限を回避したり、QoS により適当される速度制限を回避できる場合があります。 -CMD_AccountHttpHeaderGet_Args AccountHttpHeaderGet [name] -CMD_AccountHttpHeaderGet_[name] 設定を取得する接続設定の名前を指定します。 - - -# AccountProxyNone コマンド -CMD_AccountProxyNone 接続設定の接続方法を直接 TCP/IP 接続に設定 -CMD_AccountProxyNone_Help VPN Client に登録されている接続設定を指定し、その接続設定が VPN Server に対して接続する際に使用する接続方法を [直接 TCP/IP 接続] に設定し、プロキシサーバーを経由しないようにします。 -CMD_AccountProxyNone_Args AccountProxyNone [name] -CMD_AccountProxyNone_[name] 設定を変更する接続設定の名前を指定します。 - - -# AccountProxyHttp コマンド -CMD_AccountProxyHttp 接続設定の接続方法を HTTP プロキシサーバー経由接続に設定 -CMD_AccountProxyHttp_Help VPN Client に登録されている接続設定を指定し、その接続設定が VPN Server に対して接続する際に使用する接続方法を [HTTP プロキシサーバー経由接続] に設定し、経由する HTTP プロキシサーバーのホスト名とポート番号、ユーザー名とパスワード (必要な場合) を指定します。\n経由する HTTP プロキシサーバーは、HTTPS 通信をするための CONNECT メソッドに対応している必要があります。 -CMD_AccountProxyHttp_Args AccountProxyHttp [name] [/SERVER:hostname:port] [/USERNAME:username] [/PASSWORD:password] -CMD_AccountProxyHttp_[name] 設定を変更する接続設定の名前を指定します。 -CMD_AccountProxyHttp_SERVER [ホスト名:ポート番号] の形式で、経由する HTTP プロキシサーバーのホスト名、または IP アドレスとポート番号を指定します。 -CMD_AccountProxyHttp_USERNAME 経由する HTTP プロキシサーバーに接続するためにユーザー認証が必要な場合、ユーザー名を指定します。また、同時に /PASSWORD パラメータも指定します。/USERNAME と /PASSWORD パラメータが指定されない場合は、ユーザー認証データを設定しません。 -CMD_AccountProxyHttp_PASSWORD 経由する HTTP プロキシサーバーに接続するためにユーザー認証が必要な場合、パスワードを指定します。/USERNAME パラメータと共に指定します。 -CMD_AccountProxyHttp_Prompt_Server プロキシサーバーのホスト名とポート番号: - - -# AccountProxySocks コマンド -CMD_AccountProxySocks 接続設定の接続方法を SOCKS4 プロキシサーバー経由接続に設定 -CMD_AccountProxySocks_Help VPN Client に登録されている接続設定を指定し、その接続設定が VPN Server に対して接続する際に使用する接続方法を [SOCKS4 プロキシサーバー経由接続] に設定し、経由する SOCKS4 プロキシサーバーのホスト名とポート番号、ユーザー名とパスワード (必要な場合) を指定します。 -CMD_AccountProxySocks_Args AccountProxySocks [name] [/SERVER:hostname:port] [/USERNAME:username] [/PASSWORD:password] -CMD_AccountProxySocks_[name] 設定を変更する接続設定の名前を指定します。 -CMD_AccountProxySocks_SERVER [ホスト名:ポート番号] の形式で、経由する SOCKS4 プロキシサーバーのホスト名、または IP アドレスとポート番号を指定します。 -CMD_AccountProxySocks_USERNAME 経由する SOCKS4 プロキシサーバーに接続するためにユーザー認証が必要な場合、ユーザー名を指定します。また、同時に /PASSWORD パラメータも指定します。/USERNAME と /PASSWORD パラメータが指定されない場合は、ユーザー認証データを設定しません。 -CMD_AccountProxySocks_PASSWORD 経由する SOCKS4 プロキシサーバーに接続するためにユーザー認証が必要な場合、パスワードを指定します。/USERNAME パラメータと共に指定します。 - - -# AccountProxySocks5 コマンド -CMD_AccountProxySocks5 接続設定の接続方法を SOCKS5 プロキシサーバー経由接続に設定 -CMD_AccountProxySocks5_Help VPN Client に登録されている接続設定を指定し、その接続設定が VPN Server に対して接続する際に使用する接続方法を [SOCKS5 プロキシサーバー経由接続] に設定し、経由する SOCKS5 プロキシサーバーのホスト名とポート番号、ユーザー名とパスワード (必要な場合) を指定します。 -CMD_AccountProxySocks5_Args AccountProxySocks5 [name] [/SERVER:hostname:port] [/USERNAME:username] [/PASSWORD:password] -CMD_AccountProxySocks5_[name] 設定を変更する接続設定の名前を指定します。 -CMD_AccountProxySocks5_SERVER [ホスト名:ポート番号] の形式で、経由する SOCKS5 プロキシサーバーのホスト名、または IP アドレスとポート番号を指定します。 -CMD_AccountProxySocks5_USERNAME 経由する SOCKS5 プロキシサーバーに接続するためにユーザー認証が必要な場合、ユーザー名を指定します。また、同時に /PASSWORD パラメータも指定します。/USERNAME と /PASSWORD パラメータが指定されない場合は、ユーザー認証データを設定しません。 -CMD_AccountProxySocks5_PASSWORD 経由する SOCKS5 プロキシサーバーに接続するためにユーザー認証が必要な場合、パスワードを指定します。/USERNAME パラメータと共に指定します。 - - -# AccountServerCertEnable コマンド -CMD_AccountServerCertEnable 接続設定のサーバー証明書の検証オプションの有効化 -CMD_AccountServerCertEnable_Help VPN Client に登録されている接続設定を指定し、その接続設定が VPN Server に対して接続する際に、接続先の VPN Server の提示する SSL 証明書が信頼できるかどうか検査するオプションを有効にします。\nこのオプションが有効になっている場合、接続先サーバーの SSL 証明書を、あらかじめ AccountServerCertSet コマンドで接続設定設定内に保存しておくか、または仮想 HUB の信頼する証明機関の証明書一覧に、サーバーの SSL 証明書を署名したルート証明書を CertAdd コマンドなどで登録しておくことを推奨します。登録されていない場合は、初回接続時に確認のメッセージが表示される場合があります。\n接続設定のサーバー証明書の検証オプションが有効になっている状態で、接続した VPN Server の証明書が信頼できない場合、直ちに接続を解除して再試行を繰り返します。 -CMD_AccountServerCertEnable_Args AccountServerCertEnable [name] -CMD_AccountServerCertEnable_[name] 設定を変更する接続設定の名前を指定します。 - - -# AccountServerCertDisable コマンド -CMD_AccountServerCertDisable 接続設定のサーバー証明書の検証オプションの無効化 -CMD_AccountServerCertDisable_Help VPN Client に登録されている接続設定を指定し、その接続設定が VPN Server に対して接続する際に、接続先の VPN Server の提示する SSL 証明書が信頼できるかどうか検査するオプションを無効にします。 -CMD_AccountServerCertDisable_Args AccountServerCertDisable [name] -CMD_AccountServerCertDisable_[name] 設定を変更する接続設定の名前を指定します。 - - -# AccountRetryOnServerCertEnable コマンド -CMD_AccountRetryOnServerCertEnable 接続設定のサーバー証明書が信頼できない場合の接続再試行を有効化 -CMD_AccountRetryOnServerCertEnable_Help 接続設定のサーバー証明書の検証プションが有効になっている状態で、 VPN Server の証明書が信頼できない場合、直ちに接続を解除して再試行を繰り返します。AccountRetryOnServerCertDisableコマンドを使用することにより再試行を行わないように設定することができますが、このコマンドを使用することにより、デフォルトの接続再試行を行う状態に戻すことができます。 - -CMD_AccountRetryOnServerCertEnable_Args AccountRetryOnServerCertEnable [name] -CMD_AccountRetryOnServerCertEnable_[name] 設定を変更する接続設定の名前を指定します。 - - -# AccountRetryOnServerCertDisable コマンド -CMD_AccountRetryOnServerCertDisable 接続設定のサーバー証明書が信頼できない場合の接続再試行を無効化 -CMD_AccountRetryOnServerCertDisable_Help 接続設定のサーバー証明書の検証プションが有効になっている状態で、 VPN Server の証明書が信頼できない場合、直ちに接続を解除して再試行を繰り返しますが、このコマンドを使用することにより再試行を行わないように設定することができます。 -CMD_AccountRetryOnServerCertDisable_Args AccountRetryOnServerCertDisable [name] -CMD_AccountRetryOnServerCertDisable_[name] 設定を変更する接続設定の名前を指定します。 - - -# AccountServerCertSet コマンド -CMD_AccountServerCertSet 接続設定のサーバー固有証明書の設定 -CMD_AccountServerCertSet_Help VPN Client に登録されている接続設定を指定し、その接続設定が VPN Server に対して接続する際に、接続先の VPN Server の提示する SSL 証明書と同じ証明書をあらかじめ登録します。\n接続設定のサーバー証明書の検証オプションが有効になっている場合、接続先サーバーの SSL 証明書をあらかじめこのコマンドで接続設定設定内に保存しておくか、または仮想 HUB の信頼する証明機関の証明書一覧に、サーバーの SSL 証明書を署名したルート証明書を CAAdd コマンドなどで登録しておく必要があります。\n接続設定のサーバー証明書の検証オプションが有効になっている状態で、接続した VPN Server の証明書が信頼できない場合、直ちに接続を解除して再試行を繰り返します。 -CMD_AccountServerCertSet_Args AccountServerCertSet [name] [/LOADCERT:cert] -CMD_AccountServerCertSet_[name] 設定を変更する接続設定の名前を指定します。 -CMD_AccountServerCertSet_LOADCERT 設定するサーバー固有証明書が保存されている、X.509 形式の証明書ファイル名を指定します。 - - -# AccountServerCertDelete コマンド -CMD_AccountServerCertDelete 接続設定のサーバー固有証明書の削除 -CMD_AccountServerCertDelete_Help VPN Client に登録されている接続設定を指定し、その接続設定にサーバー固有証明書が登録されている場合は、それを削除します。 -CMD_AccountServerCertDelete_Args AccountServerCertDelete [name] -CMD_AccountServerCertDelete_[name] 設定を変更する接続設定の名前を指定します。 - - -# AccountServerCertGet コマンド -CMD_AccountServerCertGet 接続設定のサーバー固有証明書の取得 -CMD_AccountServerCertGet_Help VPN Client に登録されている接続設定を指定し、その接続設定にサーバー固有証明書が登録されている場合はその証明書を取得して、X.509 形式の証明書ファイルとして保存します。 -CMD_AccountServerCertGet_Args AccountServerCertGet [name] [/SAVECERT:path] -CMD_AccountServerCertGet_[name] 設定を変更する接続設定の名前を指定します。 -CMD_AccountServerCertGet_SAVECERT サーバー固有証明書を X.509 形式で保存する証明書ファイル名を指定します。 - - -# AccountDetailSet コマンド -CMD_AccountDetailSet 接続設定の高度な通信設定の設定 -CMD_AccountDetailSet_Help VPN Client に登録されている接続設定を指定し、その接続設定が VPN Server と通信する際に使用される VPN プロトコルの通信設定をカスタマイズします。 -CMD_AccountDetailSet_Args AccountDetailSet [name] [/MAXTCP:max_connection] [/INTERVAL:additional_interval] [/TTL:disconnect_span] [/HALF:yes|no] [/BRIDGE:yes|no] [/MONITOR:yes|no] [/NOTRACK:yes|no] [/NOQOS:yes|no] -CMD_AccountDetailSet_[name] 設定を変更する接続設定の名前を指定します。 -CMD_AccountDetailSet_MAXTCP VPN 通信に使用する TCP コネクション数を、1 以上 32 以下の整数で指定します。VPN Server との間の VPN 通信セッションにおけるデータ伝送に、複数本の TCP コネクションを束ねて使用することにより、通信速度を向上できる場合があります。\n注意: サーバーへの接続回線が高速な場合は 8 本程度を、ダイヤルアップ等の低速な場合は 1 本をお勧めします。 -CMD_AccountDetailSet_INTERVAL 複数の TCP コネクションを確立して VPN 通信を行うとき、各 TCP コネクションの確立間隔を秒単位で指定します。規定値は 1 秒です。 -CMD_AccountDetailSet_TTL 各 TCP コネクションの寿命を設定する場合は、TCP コネクションが確立されてから切断されるまでの寿命を、秒数で指定します。0 を指定すると、寿命は設定されません。 -CMD_AccountDetailSet_HALF 半二重モードを有効にする場合は "yes" を指定します。2 本以上の TCP コネクションを束ねて VPN 通信を行う際、「半二重モード」を使用することができます。半二重モードを有効にすると、自動的に各 TCP コネクションのデータ伝送方向を、半数ずつ固定することができます。たとえば、8 本の TCP コネクションを使用して VPN セッションを確立した場合、半二重モードを有効にすると、4 本の TCP コネクションはアップロード方向専用、残りの 4 本のコネクションはダウンロード方向専用に固定され通信が行われます。 -CMD_AccountDetailSet_BRIDGE VPN Server に「ブリッジ / ルータモード」で接続する場合は "yes" を指定します。ブリッジ / ルータモードを使用して接続した場合、VPN Client の仮想 LAN カードの側で、別のネットワークにブリッジしたりルーティングしたりすることができるようになります。ただし、接続に使用するユーザーのセキュリティポリシーで、ブリッジまたはルーティングが禁止されている場合は、接続に失敗します。 -CMD_AccountDetailSet_MONITOR VPN Server に「モニタリングモード」で接続する場合は "yes" を指定します。モニタリングモードを使用して接続した場合、仮想 HUB 内を流れるすべてのパケットを受信することができます。ただし、接続に使用するユーザーのセキュリティポリシーで、モニタリングモードが許可されていない場合は、接続に失敗します。 -CMD_AccountDetailSet_NOTRACK ルーティングテーブルの調整処理を行わない場合は "yes" を指定します。通常は "no" を指定します。 -CMD_AccountDetailSet_NOQOS VoIP / QoS 対応機能を無効にする場合は "yes" を指定します。通常は "no" を指定します。 -CMD_AccountDetailSet_DISABLEUDP UDP 高速化機能を無効にする場合は "yes" を指定します。通常は "no" を指定します。 -CMD_AccountDetailSet_Eval_MaxTcp TCP コネクション数は 1 から 32 の間で指定してください。 -CMD_AccountDetailSet_Eval_Interval TCP コネクションの確立間隔は 1 秒以上を指定してください。 -CMD_AccountDetailSet_Prompt_MaxTcp VPN 通信に使用する TCP コネクション数: -CMD_AccountDetailSet_Prompt_Interval 各 TCP コネクションの確立間隔: -CMD_AccountDetailSet_Prompt_TTL 各 TCP コネクションの寿命 (0 で無し): -CMD_AccountDetailSet_Prompt_HALF 半二重モードを有効にする (yes/no): -CMD_AccountDetailSet_Prompt_BRIDGE ブリッジ/ルータモードを有効にする (yes/no): -CMD_AccountDetailSet_Prompt_MONITOR モニタリングモードを有効にする (yes/no): -CMD_AccountDetailSet_Prompt_NOTRACK ルーティングテーブル調整処理を無効化する (yes/no): -CMD_AccountDetailSet_Prompt_NOQOS QoS 制御機能を無効化する (yes/no): -CMD_AccountDetailSet_Prompt_DISABLEUDP UDP 高速化機能を無効化する (yes/no): - - -# AccountRename コマンド -CMD_AccountRename 接続設定の名前の変更 -CMD_AccountRename_Help VPN Client に登録されている接続設定を指定し、その接続設定の名前を変更します。 -CMD_AccountRename_Args AccountRename [name] [/NEW:new_name] -CMD_AccountRename_[name] 名前を変更する接続設定の現在の名前を指定します。 -CMD_AccountRename_NEW 変更後の新しい名前を指定します。 -CMD_AccountRename_PROMPT_OLD 現在の名前: -CMD_AccountRename_PROMPT_NEW 新しい名前: - - -# AccountConnect コマンド -CMD_AccountConnect 接続設定を使用して VPN Server へ接続を開始 -CMD_AccountConnect_Help VPN Client に登録されている接続設定を指定し、その接続設定を使用して VPN Server への接続を開始します。接続処理中、または接続済みの状態になった接続設定は、AccountDisconnect コマンドで切断するまで VPN Server に常時接続、または接続を試行し続けます (ただし AccountRetrySet コマンドで再試行回数を指定してある場合は、指定された回数で試行を中断します)。 -CMD_AccountConnect_Args AccountConnect [name] -CMD_AccountConnect_[name] 接続を開始する接続設定の名前を指定します。 - - -# AccountDisconnect コマンド -CMD_AccountDisconnect 接続中の接続設定の切断 -CMD_AccountDisconnect_Help VPN Client に登録されている接続設定を指定し、その接続設定が接続処理中、または接続済みの状態である場合は直ちに切断します。 -CMD_AccountDisconnect_Args AccountDisconnect [name] -CMD_AccountDisconnect_[name] 切断する接続設定の名前を指定します。 - - -# AccountStatusGet コマンド -CMD_AccountStatusGet 接続設定の現在の状態の取得 -CMD_AccountStatusGet_Help VPN Client に登録されている接続設定を指定し、その接続設定が現在接続済みである場合は、その接続状態やその他の情報を取得します。 -CMD_AccountStatusGet_Args AccountStatusGet [name] -CMD_AccountStatusGet_[name] 情報を取得する接続設定の名前を指定します。 - - -# AccountNicSet コマンド -CMD_AccountNicSet 接続設定で使用する仮想 LAN カードの設定 -CMD_AccountNicSet_Help VPN Client に登録されている既存の接続設定が VPN Server への接続に使用する仮想 LAN カード名を変更します。 -CMD_AccountNicSet_Args AccountNicSet [name] [/NICNAME:nicname] -CMD_AccountNicSet_[name] 設定を変更する接続設定の名前を指定します。 -CMD_AccountNicSet_NICNAME VPN Server に接続する際に使用する仮想 LAN カード名を指定します。 - - -# AccountStatusShow コマンド -CMD_AccountStatusShow VPN Server への接続中に接続状況やエラー画面を表示するように設定 -CMD_AccountStatusShow_Help VPN Client に登録されている接続設定を指定し、その接続設定を用いて VPN Server に接続する際に、接続状況やエラー画面などをコンピュータのディスプレイ上に表示するように設定します。 -CMD_AccountStatusShow_Args AccountStatusShow [name] -CMD_AccountStatusShow_[name] 設定を変更する接続設定の名前を指定します。 - - -# AccountStatusHide コマンド -CMD_AccountStatusHide VPN Server への接続中に接続状況やエラー画面を表示しないように設定 -CMD_AccountStatusHide_Help VPN Client に登録されている接続設定を指定し、その接続設定を用いて VPN Server に接続する際に、接続状況やエラー画面などをコンピュータのディスプレイ上に表示しないように設定します。 -CMD_AccountStatusHide_Args AccountStatusHide [name] -CMD_AccountStatusHide_[name] 設定を変更する接続設定の名前を指定します。 - - -# AccountSecureCertSet コマンド -CMD_AccountSecureCertSet 接続設定のユーザー認証の種類をスマートカード認証に設定 -CMD_AccountSecureCertSet_Help VPN Client に登録されている接続設定を指定し、その接続設定が VPN Server に接続する際のユーザー認証の方法を [スマートカード認証] に設定します。また、スマートカード内に格納されている証明書オブジェクトと秘密鍵オブジェクトの名前を指定する必要があります。 -CMD_AccountSecureCertSet_Args AccountSecureCertSet [name] [/CERTNAME:cert] [/KEYNAME:key] -CMD_AccountSecureCertSet_[name] 設定を変更する接続設定の名前を指定します。 -CMD_AccountSecureCertSet_CERTNAME スマートカード内に格納されている証明書オブジェクトの名前を指定します。 -CMD_AccountSecureCertSet_KEYNAME スマートカード内に格納されている秘密鍵オブジェクトの名前を指定します。/CERTNAME で指定した証明書に対応している必要があります。 -CMD_AccountSecureCertSet_PROMPT_CERTNAME スマートカード内証明書オブジェクトの名前: -CMD_AccountSecureCertSet_PROMPT_KEYNAME スマートカード内秘密鍵オブジェクトの名前: - - -# PcAccountOpensslEngineCertSet -CMD_AccountOpensslCertSet_PROMPT_KEYNAME Specify the openssl engine specific key name: -CMD_AccountOpensslCertSet_PROMPT_ENGINENAME Specify the openssl engine name: - - -# AccountRetrySet コマンド -CMD_AccountRetrySet 接続設定の接続失敗または切断時の再試行回数と間隔の設定 -CMD_AccountRetrySet_Help VPN Client に登録されている接続設定を指定し、その接続設定が VPN Server に接続しようとする際、または接続中に VPN Server との通信が切断されたり、接続に失敗したりした場合に、接続を再試行する回数と接続再試行間隔を指定します。\nなお、ユーザー認証の種類が [スマートカード認証] の場合は、接続試行回数の設定にかかわらず、再試行は行いません。 -CMD_AccountRetrySet_Args AccountRetrySet [name] [/NUM:num_retry] [/INTERVAL:retry_interval] -CMD_AccountRetrySet_[name] 設定を変更する接続設定の名前を指定します。 -CMD_AccountRetrySet_NUM 連続して再接続を行う回数を指定します。"999" と指定すると、無限に再接続を試行します (常時接続)。0 を指定すると再接続を行いません。 -CMD_AccountRetrySet_INTERVAL 再接続を行う場合、前回接続が切断または接続失敗してから、何秒後に再接続処理を開始するかを設定します。 -CMD_AccountRetrySet_PROMPT_NUM 再接続回数 ("999" で無限): -CMD_AccountRetrySet_PROMPT_INTERVAL 再接続間隔 (秒): -CMD_AccountRetrySet_EVAL_INTERVAL 再接続間隔は 5 秒以上で指定してください。 - - -# AccountStartupSet コマンド -CMD_AccountStartupSet 接続設定をスタートアップ接続に設定 -CMD_AccountStartupSet_Help VPN Client に登録されている接続設定を指定し、その接続設定をスタートアップ接続に設定します。スタートアップ接続に設定されている接続設定は、VPN Client サービスが起動すると同時に自動的に接続処理を開始します。 -CMD_AccountStartupSet_Args AccountStartupSet [name] -CMD_AccountStartupSet_[name] 設定を変更する接続設定の名前を指定します。 - - -# AccountStartupRemove コマンド -CMD_AccountStartupRemove 接続設定のスタートアップ接続を解除 -CMD_AccountStartupRemove_Help VPN Client に登録されている接続設定を指定し、その接続設定が現在スタートアップ接続に設定されている場合は、スタートアップ接続設定を解除します。 -CMD_AccountStartupRemove_Args AccountStartupRemove [name] -CMD_AccountStartupRemove_[name] 設定を変更する接続設定の名前を指定します。 - - -# AccountExport コマンド -CMD_AccountExport 接続設定のエクスポート -CMD_AccountExport_Help VPN Client に登録されている接続設定を指定し、その接続設定の内容を、テキストファイルとしてエクスポートします。エクスポートされた接続設定ファイルを後からインポートすることによって、接続設定の内容を複製することができます。また、テキストファイルで保存されるため、一般的なテキストエディタで編集することも可能です。\nエクスポート先のファイルは、UTF-8 形式のテキストファイルとして保存されます。なお、ファイル名に .vpn という拡張子を付けると、Windows 版 VPN クライアント接続マネージャと関連付けされるので便利です。 -CMD_AccountExport_Args AccountExport [name] [/SAVEPATH:savepath] -CMD_AccountExport_[name] 接続設定をエクスポートする接続設定名を指定します。 -CMD_AccountExport_SAVEPATH 保存先のファイル名を指定します。 -CMD_AccountExport_PROMPT_SAVEPATH 保存先ファイル名 (拡張子は .vpn を推奨): - - -# AccountImport コマンド -CMD_AccountImport 接続設定のインポート -CMD_AccountImport_Help AccountExport コマンドによってエクスポートされた接続設定ファイルをインポートし、VPN Client に追加します。 -CMD_AccountImport_Args AccountImport [path] -CMD_AccountImport_[path] インポート元のファイル名を指定します。 -CMD_AccountImport_PROMPT_PATH インポート元ファイル名: -CMD_AccountImport_FAILED_PARSE 指定されたファイルを正しく解析することができませんでした。正しくエクスポートされたファイルかどうか確認してください。 -CMD_AccountImport_OK 接続設定 "%s" としてインポートしました。 - - - -# RemoteEnable コマンド -CMD_RemoteEnable VPN Client サービスのリモート管理の許可 -CMD_RemoteEnable_Help VPN Client サービスに、localhost 以外のリモートコンピュータから、コマンドライン管理ユーティリティまたは VPN クライアント接続マネージャでリモート接続して管理することを許可します。 -CMD_RemoteEnable_Args RemoteEnable - - -# RemoteDisable コマンド -CMD_RemoteDisable VPN Client サービスのリモート管理の禁止 -CMD_RemoteDisable_Help VPN Client サービスに、localhost 以外のリモートコンピュータからコマンドライン管理ユーティリティまたは VPN クライアント接続マネージャでリモート接続して管理することを禁止します。 -CMD_RemoteDisable_Args RemoteDisable - - - - - - -################################################### -# # -# ここから下は VPN Tools 用のコマンド # -# # -################################################### - - -# MakeCert コマンド -CMD_MakeCert 新しい X.509 証明書と秘密鍵の作成 (1024 bit) -CMD_MakeCert_Help 新しい X.509 証明書と秘密鍵を作成し、ファイルとして保存します。\n証明書の公開鍵と秘密鍵の生成アルゴリズムには、RSA 1024 bit が使用されます。\n証明書の種類として、ルート証明書 (自己署名証明書) と他の証明書によって署名された証明書のどちらでも作成することができます。他の証明書によって署名された証明書を作成するためには、署名に使用する証明書 (X.509 形式のファイル) と対応する秘密鍵ファイル (Base 64 エンコード) が必要です。\n\n作成する証明書には、名前 (CN)、所属機関 (O)、組織単位 (OU)、国 (C)、都道府県 (ST)、ローカル (L)、シリアル番号、有効期限を指定することができます。\n作成された証明書は X.509 形式のファイルとして、秘密鍵ファイルは RSA 1024 bit 形式の Base 64 エンコードされたファイルとしてそれぞれ保存されます。\n\nMakeCert コマンドは、証明書を作成するための必要最低限の機能を用意したツールです。本格的な証明書を作成したい場合は、OpenSSL などのフリーソフトや、市販の CA (証明機関) ソフトウェアを使用することを推奨します。\n\n※注意: このコマンドは SoftEther VPN コマンドライン管理ユーティリティから呼び出すことが可能です。現在 VPN Server や VPN Client に管理モードで接続している場合も実行できますが、実際に RSA 演算を行い、証明書データを生成しファイルに保存するのはこのコマンドを実行しているコンピュータであり、管理モードで接続先のコンピュータとは一切関係ないコンテキストで実行されます。 -CMD_MakeCert_Args MakeCert [/CN:cn] [/O:o] [/OU:ou] [/C:c] [/ST:st] [/L:l] [/SERIAL:serial] [/EXPIRES:expires] [/SIGNCERT:signcert] [/SIGNKEY:signkey] [/SAVECERT:savecert] [/SAVEKEY:savekey] -CMD_MakeCert_CN 作成する証明書の名前 (CN) 項目を指定します。none を指定することもできます。 -CMD_MakeCert_O 作成する証明書の所属機関 (O) 項目を指定します。none を指定することもできます。 -CMD_MakeCert_OU 作成する証明書の組織単位 (OU) 項目を指定します。none を指定することもできます。 -CMD_MakeCert_C 作成する証明書の国 (C) 項目を指定します。none を指定することもできます。 -CMD_MakeCert_ST 作成する証明書の都道府県 (ST) 項目を指定します。none を指定することもできます。 -CMD_MakeCert_L 作成する証明書のローカル (L) 項目を指定します。none を指定することもできます。 -CMD_MakeCert_SERIAL 作成する証明書のシリアル番号項目を指定します。16 進数で指定します。none を指定することもできます。 -CMD_MakeCert_EXPIRES 作成する証明書の有効期限を指定します。none または 0 を指定すると、3650 日 (約 10 年) が使用されます。最大 10950 日 (約 30 年) まで指定できます。 -CMD_MakeCert_SIGNCERT 作成する証明書を、既存の証明書によって署名する場合は、署名に使用する X.509 形式の証明書のファイル名を指定します。パラメータを省略した場合は、署名は行わず新しい証明書をルート証明書として作成します。 -CMD_MakeCert_SIGNKEY /SIGNCERT で指定した証明書に対応する秘密鍵 (RSA, Base-64 エンコード) を指定します。 -CMD_MakeCert_SAVECERT 作成した証明書を保存するファイル名を指定します。証明書は RSA 形式の 1024 bit の公開鍵を含んだ X.509 ファイルとして保存されます。 -CMD_MakeCert_SAVEKEY 作成した証明書に対応する秘密鍵を保存するファイル名を指定します。秘密鍵は RSA 形式の 1024 bit の秘密鍵ファイルとして保存されます。 -CMD_MakeCert_PROMPT_CN 作成する証明書の名前 (CN): -CMD_MakeCert_PROMPT_O 作成する証明書の所属機関 (O): -CMD_MakeCert_PROMPT_OU 作成する証明書の組織単位 (OU): -CMD_MakeCert_PROMPT_C 作成する証明書の国 (C): -CMD_MakeCert_PROMPT_ST 作成する証明書の都道府県 (ST): -CMD_MakeCert_PROMPT_L 作成する証明書のローカル (L): -CMD_MakeCert_PROMPT_SERIAL 作成する証明書のシリアル番号 (16 進数): -CMD_MakeCert_PROMPT_EXPIRES 作成する証明書の有効期限 (日): -CMD_MakeCert_PROMPT_SAVECERT 作成した証明書を保存するファイル名: -CMD_MakeCert_PROMPT_SAVEKEY 作成した秘密鍵を保存するファイル名: -CMD_MakeCert_EVAL_EXPIRES 有効期限は %u 以上 %u 以下で指定してください。 -CMD_MakeCert_ERROR_SIGNKEY /SIGNCERT と /SIGNKEY で指定された証明書または秘密鍵が読み込めないか、組み合わせが不正です。 -CMD_MakeCert_ERROR_GEN_FAILED 証明書と秘密鍵の生成に失敗しました。 - - -# MakeCert2048 コマンド -CMD_MakeCert2048 新しい X.509 証明書と秘密鍵の作成 (2048 bit) -CMD_MakeCert2048_Help 新しい X.509 証明書と秘密鍵を作成し、ファイルとして保存します。\n証明書の公開鍵と秘密鍵の生成アルゴリズムには、RSA 2048 bit が使用されます。\n証明書の種類として、ルート証明書 (自己署名証明書) と他の証明書によって署名された証明書のどちらでも作成することができます。他の証明書によって署名された証明書を作成するためには、署名に使用する証明書 (X.509 形式のファイル) と対応する秘密鍵ファイル (Base 64 エンコード) が必要です。\n\n作成する証明書には、名前 (CN)、所属機関 (O)、組織単位 (OU)、国 (C)、都道府県 (ST)、ローカル (L)、シリアル番号、有効期限を指定することができます。\n作成された証明書は X.509 形式のファイルとして、秘密鍵ファイルは RSA 2048 bit 形式の Base 64 エンコードされたファイルとしてそれぞれ保存されます。\n\nMakeCert コマンドは、証明書を作成するための必要最低限の機能を用意したツールです。本格的な証明書を作成したい場合は、OpenSSL などのフリーソフトや、市販の CA (証明機関) ソフトウェアを使用することを推奨します。\n\n※注意: このコマンドは SoftEther VPN コマンドライン管理ユーティリティから呼び出すことが可能です。現在 VPN Server や VPN Client に管理モードで接続している場合も実行できますが、実際に RSA 演算を行い、証明書データを生成しファイルに保存するのはこのコマンドを実行しているコンピュータであり、管理モードで接続先のコンピュータとは一切関係ないコンテキストで実行されます。 -CMD_MakeCert2048_Args MakeCert2048 [/CN:cn] [/O:o] [/OU:ou] [/C:c] [/ST:st] [/L:l] [/SERIAL:serial] [/EXPIRES:expires] [/SIGNCERT:signcert] [/SIGNKEY:signkey] [/SAVECERT:savecert] [/SAVEKEY:savekey] -CMD_MakeCert2048_CN 作成する証明書の名前 (CN) 項目を指定します。none を指定することもできます。 -CMD_MakeCert2048_O 作成する証明書の所属機関 (O) 項目を指定します。none を指定することもできます。 -CMD_MakeCert2048_OU 作成する証明書の組織単位 (OU) 項目を指定します。none を指定することもできます。 -CMD_MakeCert2048_C 作成する証明書の国 (C) 項目を指定します。none を指定することもできます。 -CMD_MakeCert2048_ST 作成する証明書の都道府県 (ST) 項目を指定します。none を指定することもできます。 -CMD_MakeCert2048_L 作成する証明書のローカル (L) 項目を指定します。none を指定することもできます。 -CMD_MakeCert2048_SERIAL 作成する証明書のシリアル番号項目を指定します。16 進数で指定します。none を指定することもできます。 -CMD_MakeCert2048_EXPIRES 作成する証明書の有効期限を指定します。none または 0 を指定すると、3650 日 (約 10 年) が使用されます。最大 10950 日 (約 30 年) まで指定できます。 -CMD_MakeCert2048_SIGNCERT 作成する証明書を、既存の証明書によって署名する場合は、署名に使用する X.509 形式の証明書のファイル名を指定します。パラメータを省略した場合は、署名は行わず新しい証明書をルート証明書として作成します。 -CMD_MakeCert2048_SIGNKEY /SIGNCERT で指定した証明書に対応する秘密鍵 (RSA, Base-64 エンコード) を指定します。 -CMD_MakeCert2048_SAVECERT 作成した証明書を保存するファイル名を指定します。証明書は RSA 形式の 2048 bit の公開鍵を含んだ X.509 ファイルとして保存されます。 -CMD_MakeCert2048_SAVEKEY 作成した証明書に対応する秘密鍵を保存するファイル名を指定します。秘密鍵は RSA 形式の 2048 bit の秘密鍵ファイルとして保存されます。 - - -# TrafficClient コマンド -CMD_TrafficClient 通信スループット測定ツールクライアントの実行 -CMD_TrafficClient_Help 通信スループット測定ツールの、クライアントプログラムを実行します。\n通信スループット測定ツールは TrafficClient と TrafficServer の 2 つのコマンドとして利用し、IP ネットワーク上で接続された 2 台のコンピュータの間で伝送することができる通信スループットを計測することができます。すでに別のコンピュータ上で、TrafficServer コマンドを用いて通信スループット測定ツールサーバーを待機させておき、TrafficClient コマンドで、そのサーバーのホスト名または IP アドレスとポート番号を指定して接続し、通信速度を測定することができます。\n通信速度の測定は、同時に複数本の TCP コネクションを確立し、それぞれのコネクションで最大限にストリームデータを伝送した結果、指定された時間内に実際に伝送することができたデータのビット数を計算し、それを元に通信スループットの平均値 (bps) を算出する方法で行われます。通常、1 本の TCP コネクションを用いた場合は TCP のアルゴリズム上の限界により、実際のネットワークスループットよりも遅い速度でしか通信できない場合が多いため、複数本の TCP コネクションを同時に確立して通信した結果を測定することを推奨します。この測定方法によって計測されたスループットは実際に TCP でストリームとして受信側に届いたデータのビット長から計算されるため、途中で発生したパケットロスやデータ破損したパケットは、実際に届いたパケットには含まれず、純粋なネットワークの最大通信可能帯域幅に近い値を算出することができます。\n測定結果として TCP 内で伝送されたストリームサイズから、実際にネットワーク上を流れたデータ量の近似値を計算し、それを時間で割ってビット毎秒 (bps) を算出します。物理的なネットワークの種類は Ethernet (IEEE802.3) で、MAC フレームのペイロードサイズは 1,500 Bytes (TCP の MSS は 1,460 Bytes) と仮定して計算が行われます。/RAW オプションを指定すると、TCP/IP ヘッダや MAC ヘッダのデータ量を補正する計算は行われません。\n\n※注意: このコマンドは SoftEther VPN コマンドライン管理ユーティリティから呼び出すことが可能です。現在 VPN Server や VPN Client に管理モードで接続している場合も実行できますが、実際に通信を行ってスループットを測定するのは、このコマンドを実行しているコンピュータであり、管理モードで接続先のコンピュータとは一切関係ないコンテキストで実行されます。 -CMD_TrafficClient_Args TrafficClient [host:port] [/NUMTCP:numtcp] [/TYPE:download|upload|full] [/SPAN:span] [/DOUBLE:yes|no] [/RAW:yes|no] -CMD_TrafficClient_[host:port] 通信スループット測定ツールサーバー (TrafficServer) が待機しているホスト名、または IP アドレスとポート番号を指定します。ポート番号を省略した場合は、9821 が使用されます。 -CMD_TrafficClient_NUMTCP 同時にクライアントとサーバーとの間で確立されデータが伝送される TCP コネクション数を指定します。省略した場合は 32 が使用されます。 -CMD_TrafficClient_TYPE スループット測定を行う際の、データの流れる方向を指定します。"download"、"upload"、"full" のうち 1 つを指定します。download を指定すると、サーバー側からクライアント側にデータが伝送されます。upload を指定すると、クライアント側からサーバー側にデータが伝送されます。full を指定すると、双方向にデータが伝送されます。full を指定する場合は、NUMTCP の値は 2 以上の偶数に指定する必要があります (同時に接続される TCP コネクションのうち半数がダウンロード方向、残りの半数がアップロード方向に使用されます)。このパラメータを省略した場合は full が使用されます。 -CMD_TrafficClient_SPAN スループットを測定するためのデータ伝送を行う時間を、秒数単位で指定します。このパラメータを省略した場合は 15 秒が使用されます。 -CMD_TrafficClient_DOUBLE "yes" を指定した場合、計測した結果のスループットを 2 倍にして表示します。このオプションは、途中にネットワーク装置などがあり、そのネットワーク装置が入出力した合計のスループット能力を測定する場合に使用します。 -CMD_TrafficClient_RAW "yes" を指定すると、TCP/IP ヘッダや MAC ヘッダのデータ量を補正する計算を行いません。 -CMD_TrafficClient_EVAL_NUMTCP TCP コネクション数は 32 以下で指定してください。 -CMD_TrafficClient_PROMPT_HOST 測定サーバー名とポート番号 (省略した場合は 9821): -CMD_TrafficClient_ERROR_NUMTCP データの流れる方向が "full" (双方向) の場合、TCP コネクション数 (/NUMTCP) は偶数の値を指定する必要があります。 -CMD_TrafficClient_ERROR_HOSTPORT ホスト名またはポート番号の指定が正しくありません。 - - -# TrafficServer コマンド -CMD_TrafficServer 通信スループット測定ツールサーバーの実行 -CMD_TrafficServer_Help 通信スループット測定ツールのサーバープログラムを実行します。\n通信スループット測定ツールは、TrafficClient と TrafficServer の 2 つのコマンドとして利用し、IP ネットワーク上で接続された 2 台のコンピュータの間で伝送することができる通信スループットを計測することができます。\nこのコンピュータ上の TCP ポートを待機状態にして、別のコンピュータからの TrafficClient からの接続を待ち受けるには、TrafficServer コマンドにポート番号を指定して起動します。\n通信スループット測定ツールに関する詳細は、"TrafficClient ?" と入力すると表示されます。\n\n※注意: このコマンドは SoftEther VPN コマンドライン管理ユーティリティから呼び出すことが可能です。現在 VPN Server や VPN Client に管理モードで接続している場合も実行できますが、実際に通信を行ってスループットを測定するのは、このコマンドを実行しているコンピュータであり、管理モードで接続先のコンピュータとは一切関係ないコンテキストで実行されます。 -CMD_TrafficServer_Args TrafficServer [port] [/NOHUP:yes|no] -CMD_TrafficServer_[port] 接続を待ち受けるポート番号を整数で指定します。指定されたポートが、すでに別のプログラムによって使用中の場合や、ポートを開くことができない場合はエラーが発生します。 -CMD_TrafficServer_NOHUP "yes" を指定した場合、コンソールからの入力にかかわらず終了をしません。測定サーバーとして永久に動作させたい場合に便利です。 - - -# TrafficClient / TrafficServer 系内部メッセージ文字列 -TT_LISTEN_FAILED TCP ポート %u を待機状態にすることができませんでした。ポートが他のアプリケーションによって使用されているか、ポートを開く権限が無い可能性があります。 -TTS_LISTEN_STOP 待機ポートを閉じました。 -TTS_ENTER_TO_EXIT \n----------------------------------------\n通信スループット測定ツールのサーバープログラムを起動しました。\n\nEnter キーを押すと、サーバープログラムを停止します。\n----------------------------------------\n\n -TTS_INIT サーバープログラムを起動しています... -TTS_LISTEN_STARTED サーバープログラムを起動しました。IPv4 TCP ポート %u を待機状態にしてクライアントからの接続を待機しています。 -TTS_LISTEN_STARTED_V6 IPv6 TCP ポート %u を待機状態にしてクライアントからの接続を待機しています。 -TTS_LISTEN_FAILED_V6 IPv6 TCP ポート %u を待機状態にできませんでした。他のアプリケーションが同一 IPv6 TCP ポートを使用しているか、IPv6 スタックがインストールされていない可能性があります。 -TTS_STOP_INIT サーバープログラムを停止しています... -TTS_STOP_FINISHED サーバープログラムの停止が完了しました。 -TTS_ACCEPTED コネクション %u: クライアント %S のポート %u から接続されました。 -TTS_DISCONNECTED コネクション %u (%S) が切断されました。 -TTS_DISCONNECT コネクション %u (%S) を切断しました。 -TTC_INIT クライアントプログラムを起動しています... -TTC_FREE クライアントプログラムが終了しました。 -TTC_CONNECT_START サーバー %S (ポート %u) への接続を開始します。%u 本の TCP コネクションを接続します。 -TTC_CONNECT_FAILED %u 本目の TCP コネクションの接続に失敗しました。 -TTC_CONNECT_NOT_SERVER 接続先の TCP ポートで TrafficServer 以外のプログラムが動作しているため、トラフィックを計測できません。 -TTC_CONNECT_OK %u 本目の TCP コネクションを接続しました。 -TTC_CONNECT_OK_2 \ データ伝送方向: %s -TTC_ERROR_ABORTED サーバーとの間の TCP コネクションの初期化に失敗しました。計測を中止します。 -TTC_SUMMARY_BAR ------------------------------------------------------- -TTC_SUMMARY_TITLE 通信スループット測定ツールクライアント 設定内容 -TTC_SUMMARY_HOST 接続先のホスト名 -TTC_SUMMARY_PORT 接続先の TCP ポート番号 -TTC_SUMMARY_NUMTCP 確立する TCP コネクション数 -TTC_SUMMARY_TYPE データ伝送方向 -TTC_SUMMARY_SPAN データ伝送時間 -TTC_SUMMARY_ETHER Ethernet フレーム用にデータ補正 -TTC_SUMMARY_DOUBLE 中継機器の入出力合計速度の計測 -TTC_TYPE_DOWNLOAD ダウンロード (サーバー -> クライアント) -TTC_TYPE_UPLOAD アップロード (クライアント -> サーバー) -TTC_TYPE_FULL 双方向 (サーバー <--> クライアント) -TTC_SPAN_STR %.1f 秒 -TTC_COMM_START \nすべてのコネクションが確立されたので、データ送受信を開始しました。\n測定開始時刻: %s\n完了予定時刻: %s\n\n計測中です。しばらくお待ちください。\n(測定中は他のアプリケーションを使用しないでください。)\n\n -TTC_COMM_END %.1f 秒以上が経過したので、データ通信を終了します。\n\n -TTC_COMM_USER_CANCEL ユーザーによってキャンセルされたので、データ通信を終了します。\n\n -TTC_COMM_DISCONNECTED TCP コネクション %u が切断されました。 -TTC_STOPPING 通信スループット測定ツールクライアントの動作を停止しています... -TTC_ENTER_TO_EXIT \n----------------------------------------\n通信スループット測定ツールのクライアントプログラムを起動しました。\n\nEnter キーを押すと、クライアントプログラムを停止します。\n----------------------------------------\n\n -TTC_RES_TITLE \n\n通信スループット測定ツールによる測定結果\n\n -TTC_RES_COLUMN_1 項目名 -TTC_RES_COLUMN_2 通常の表示 -TTC_RES_COLUMN_3 省略表示 -TTC_RES_SPAN 測定に使用した時間 -TTC_RES_ETHER Ethernet フレーム用にデータ補正 -TTC_RES_BYTES_DOWNLOAD ダウンロード方向の通信データ量 -TTC_RES_BYTES_UPLOAD アップロード方向の通信データ量 -TTC_RES_BYTES_TOTAL 合計通信データ量 -TTC_RES_DOUBLE 中継機器入出力合計スループット算出 -TTC_RES_BPS_DOWNLOAD ダウンロード方向の平均スループット -TTC_RES_BPS_UPLOAD アップロード方向の平均スループット -TTC_RES_BPS_TOTAL 合計平均スループット - - -# Check コマンド -CMD_Check SoftEther VPN の動作が可能かどうかチェックする -CMD_Check_Help 現在 vpncmd を動作させているコンピュータが、SoftEther VPN Server / Bridge の動作プラットフォームとして適切であるかどうかをチェックします。\nこのチェックを通過したシステム上では、SoftEther VPN ソフトウェアが正しく動作する可能性が高いと思われます。\nまた、このチェックを通過できないシステム上では、SoftEther VPN ソフトウェアを使用した場合に、何らかの問題が発生する可能性があります。 -CMD_Check_Args Check - - -# システムチェッカ関係 -# (一部奇妙な文字列が含まれていますが、文字コード変換のチェック用です) -CHECK_TITLE ---------------------------------------------------\nSoftEther VPN 動作環境チェックツール\nDeveloper Edition\n\nCopyright (c) all contributors on SoftEther VPN project in GitHub.\nCopyright (c) Daiyuu Nobori, SoftEther Project at University of Tsukuba, and SoftEther Corporation.\nAll Rights Reserved.\n\n -CHECK_NOTE この動作環境チェックツールを実行したシステムがテストに合格した場合は、SoftEther VPN ソフトウェアが動作する可能性が高いです。チェックにはしばらく時間がかかる場合があります。そのままお待ちください...\n\n -CHECK_EXEC_TAG '%s' のチェック中...\n -CHECK_PASS [合格] ○ -CHECK_FAIL [不合格] × -CHECK_RESULT_1 すべてのチェックに合格しました。このシステム上で SoftEther VPN Server / Bridge が正しく動作する可能性が高いと思われます。 -CHECK_RESULT_2 一部のチェック結果は不合格でした。システムの動作環境を確認してください。このシステム上で SoftEther VPN Server / Bridge を実行した場合、問題が発生する可能性があります。 -CHECK_TEST_123456789 123456789 - - -CHECK_PROC_KERNEL カーネル系 -CHECK_PROC_MEMORY メモリ操作系 -CHECK_PROC_STRINGS ANSI / Unicode 文字列処理系 -CHECK_PROC_FILESYSTEM ファイルシステム -CHECK_PROC_THREAD スレッド処理システム -CHECK_PROC_NETWORK ネットワークシステム - - - - - - -###################################################### -# # -# Setup Wizard (SW) Strings # -# # -###################################################### - -SW_TITLE SoftEther VPN Developer Edition セットアップ ウィザード (バージョン %S) -SW_EXIT_CONFIRM SoftEther VPN のセットアップは完了していません。\r\n\r\nセットアップ ウィザードを終了しますか? -SW_UNINSTALL_CONFIRM %s のアンインストール処理を開始します。\r\n\r\nよろしいですか? - - -SW_COMPONENT_VPNSERVER_TITLE SoftEther VPN Server -SW_COMPONENT_VPNSERVER_DESCRIPTION センター拠点にインストールします。VPN を構築する際にセンター側となる拠点のコンピュータにインストールしてください。管理ツールもインストールされます。 - -SW_COMPONENT_VPNCLIENT_TITLE SoftEther VPN Client -SW_COMPONENT_VPNCLIENT_DESCRIPTION VPN クライアントとなる PC にインストールします。センター拠点で稼働している VPN Server に対してこのコンピュータを VPN 接続するためにインストールしてください。管理ツールもインストールされます。 - -SW_COMPONENT_VPNBRIDGE_TITLE SoftEther VPN Bridge -SW_COMPONENT_VPNBRIDGE_DESCRIPTION ブランチ拠点にインストールします。この拠点の物理的な LAN にあるコンピュータすべてをセンター拠点にある VPN Server を経由して通信できるようにするためにインストールしてください。管理ツールもインストールされます。 - -SW_COMPONENT_VPNSMGR_TITLE SoftEther VPN サーバー管理マネージャ (管理ツールのみ) -SW_COMPONENT_VPNSMGR_DESCRIPTION この PC に VPN サーバー管理マネージャのみをインストールします。VPN Server 本体はインストールしません。別のコンピュータの Windows / Linux / Mac OS X / Solaris / FreeBSD で動作している VPN Server / VPN Bridge をリモート管理することができます。 - -SW_COMPONENT_VPNCMGR_TITLE SoftEther VPN クライアント接続マネージャ (管理ツールのみ) -SW_COMPONENT_VPNCMGR_DESCRIPTION この PC に VPN クライアント接続マネージャのみをインストールします。VPN Client 本体はインストールしません。別のコンピュータの Windows / Linux で動作している VPN Client をリモート管理することができます。 - -SW_WELCOME_TITLE SoftEther VPN Developer Edition セットアップ ウィザードへようこそ -SW_MODE_TITLE セットアップモードの選択 -SW_NOT_ADMIN_TITLE 権限が不足しています -SW_COMPONENTS_TITLE インストールするソフトウェアの選択 -SW_EULA_TITLE 使用許諾契約書 -SW_WARNING_TITLE 重要事項説明書 -SW_DIR_TITLE インストール先ディレクトリ -SW_READY_TITLE インストール準備の完了 -SW_PERFORM_TITLE セットアップの進行中 -SW_ERROR_TITLE セットアップの結果 -SW_FINISH_TITLE セットアップが完了しました -SW_UNINST1_TITLE アンインストールの開始 -SW_LANG1_TITLE SoftEther VPN: Configure the Display Language (言語設定の変更) -SW_EASY1_TITLE SoftEther VPN Client 簡易インストーラ作成ウィザードへようこそ -SW_EASY2_TITLE ファイルの指定 -SW_WEB1_TITLE SoftEther VPN Client Web インストーラ作成ウィザードへようこそ -SW_WEB2_TITLE ファイルの指定 - - -SW_UNINSTALLINFO_URL http://selinks.org/ -SW_UNINSTALLINFO_PUBLISHER SoftEther VPN Project - -SW_KB3033929_REQUIRED Windows 7 および Windows Server 2008 R2 では、SoftEther VPN の一部の機能を利用するためには、Microsoft 社の Windows Update プログラム KB3033929 がインストールされている必要があります。\r\n\r\nKB3033929 がインストールされていない場合は、SoftEther VPN をインストールする前に、Windows Update または Microsoft 社の Web サイトから KB3033929 をインストールをしてください。 - - -SW_COMPONENTS_ABOUT_TAG 「%s」とは -SW_COMPONENTS_REQUIRE_ADMIN インストールには管理者権限が必要です -SW_COMPONENTS_REQUIRE_ADMIN_TEXT 「%s」をインストールするには管理者権限があるユーザーによってセットアップを起動し、「システムモード」でインストールする必要があります。システムモードでインストールするには、「戻る」ボタンをクリックしてください。 -SW_DIR_SELECT インストール先ディレクトリを選択してください -SW_DIR_MORE_THAN_110 インストール先ディレクトリ名が長すぎます。\r\n110 文字以下で指定してください。 -SW_DIR_WRITE_ERROR 指定されたディレクトリ "%s" を作成することができないか、当該ディレクトリにファイルを書き込むことができません。\r\n\r\n他のディレクトリを選択してください。 -SW_DIR_DST_IS_SAME_TO_SRC 指定されたディレクトリ "%s" はインストール元と同一です。 -SW_DIR_IS_NOT_HDD 指定されたディレクトリ "%s" はローカルハードディスクドライブではありません。\r\n\r\nシステムモードで %s をインストールするためには、ローカルハードディスク上のディレクトリを指定する必要があります。 -SW_DIR_IS_NOT_FULLPATH ディレクトリ名 "%s" はフルパス形式ではありません。\r\n\r\nフルパス形式で指定してください。 -SW_DIR_DST_IS_OTHER_PRODUCT 指定されたディレクトリには別のコンポーネントがすでにインストールされています。\r\n\r\n別のディレクトリを指定してください。 -SW_DIR_DST_IS_NEWER 指定されたディレクトリにはより新しいバージョンの本ソフトウェアがすでにインストールされています。\r\n\r\nこのインストールを行う必要はありません。 -SW_DIR_DST_IS_NEWER_2 指定されたディレクトリにはより新しいバージョンの本ソフトウェアがすでにインストールされています。\r\n\r\nこのインストーラでは簡易インストール機能による VPN の接続設定の適用のみを行い、プログラムファイルの上書きは行いません。 -SW_DIR_DST_IS_BROKEN 指定されたディレクトリに存在するファイル "%s" を読み込むことができません。\r\n\r\n別のディレクトリを指定してください。 -SW_DIR_DST_IS_SYSTEM_MODE 指定されたディレクトリにはすでに本ソフトウェアがシステムモードでインストールされています。\r\n\r\n別のディレクトリを指定してください。 -SW_DIR_DST_IS_USER_MODE 指定されたディレクトリにはすでに本ソフトウェアがユーザーモードでインストールされています。\r\n\r\n別のディレクトリを指定してください。 -SW_SYSTEM_MODE_ALREADY_INSTALLED ソフトウェア 「%s」 はすでにこのコンピュータにシステムモードでインストールされています。\r\n\r\n同一コンピュータに同一コンポーネントをシステムモードとユーザーモードの両方でインストールする場合は競合が発生する場合があります。\r\n\r\n本当にユーザーモードでインストールを実行しますか? - -SW_SETUPLOG_CORRUPTED setuplog.dat ファイルが破損しています。 -SW_MSI_UNINSTALL_FAILED %s の古いバージョン (製品コード: "%S") を Windows Installer でアンインストールしようとしましたが、アンインストールに失敗しました。\r\n\r\nこのバージョンを手動でアンインストールしてから、再度このインストーラを起動してください。 -SW_MSI_UNINSTALL_REBOOT_REQUIRED %s の古いバージョンを Windows Installer でアンインストールしました。コンピュータの再起動が必要です。\r\n\r\n「完了」をクリックしてから手動でコンピュータを再起動し、その後もう一度このインストーラを起動してください。 -SW_NOTICE_VPNSERVER_IS_INSTALLED コンポーネントとして SoftEther VPN Bridge が選択されましたが、このコンピュータにはすでに SoftEther VPN Server がインストールされています。\r\n\r\n通常、同一のコンピュータに SoftEther VPN Server と SoftEther VPN Bridge の両方をインストールする必要はありません。\r\n両方をインストールするとポート番号の競合などが発生し、不具合の原因となります。\r\nもし SoftEther VPN Server を SoftEther VPN Bridge に入れ替える場合は、一端このインストーラを終了し、SoftEther VPN Server をアンインストールしてから再度このインストーラを起動してください。\r\n\r\nSoftEther VPN Bridge のインストールを続行しますか? -SW_NOTICE_VPNBRIDGE_IS_INSTALLED コンポーネントとして SoftEther VPN Server が選択されましたが、このコンピュータにはすでに SoftEther VPN Bridge がインストールされています。\r\n\r\n通常、同一のコンピュータに SoftEther VPN Server と SoftEther VPN Bridge の両方をインストールする必要はありません。\r\n両方をインストールするとポート番号の競合などが発生し、不具合の原因となります。\r\nもし SoftEther VPN Bridge を SoftEther VPN Server に入れ替える場合は、一端このインストーラを終了し、SoftEther VPN Bridge をアンインストールしてから再度このインストーラを起動してください。\r\n\r\nSoftEther VPN Server のインストールを続行しますか? -SW_OS_FAILED %s はこのオペレーティングシステムにはインストールできません。 -SW_LANG_NOT_CHANGED %s の言語設定は変更されませんでした。 -SW_LANG_LIST_LOAD_FAILED 言語一覧データの読み込みに失敗しました。 -SW_LANG_OK %s の表示言語の変更が完了しました。\r\n%s のプログラムが起動している場合は、プログラムを一度終了してから再起動すると新しい表示言語が適用されます。表示言語が変化しない場合は、Windows を再起動してみてください。\r\n -SW_LANG_OK_SERVICE \r\nサービスが動作している場合は、サービスの出力するログファイルの言語設定はサービスを再起動した後に適用されます。 -SW_LANG_OK_VPNCMGR \r\nVPN クライアント接続マネージャの表示言語は、VPN クライアント接続マネージャを終了 (タスクトレイに常駐させている場合は完全に終了) してから再起動した後に適用されます。 -SW_CHILD_PROCESS_ERROR 子プロセスを起動できませんでした。 -SW_EXE_FILTER Windows 実行可能ファイル (*.EXE)|*.exe|すべてのファイル (*.*)|*.* -SW_PERFORM_MSG_EASY_INFO VPN Client の簡易インストーラをコンパイル中... -SW_EASY_FINISHED_MSG VPN Client の簡易インストーラの生成が完了しました。\r\n簡易インストーラは、以下のファイル名で保存されました。\r\n\r\n%s\r\n\r\n上記のファイルを組織内で配布して使用できます。 -SW_EASY_ERROR_MSG VPN Client の簡易インストーラの生成に失敗しました。 -SW_OTHER_INSTANCE_EXISTS すでに他の SoftEther VPN セットアップウィザードが起動しています。\r\n\r\n他に起動しているセットアップウィザードを確認し、そのウィザードを終了させてから続行してください。 -SW_PERFORM_MSG_WEB_INFO VPN Client の Web インストーラをコンパイル中... -SW_WEB_ERROR_MSG VPN Client の Web インストーラの生成に失敗しました。 -SW_INSTALLER_CACHE_IS_NOT_SIGNED 現在のコンピュータにインストールされている SoftEther VPN Client は、SoftEther VPN Project の有効な Authenticode デジタル証明書で署名されたパッケージからインストールされていません。\r\nカスタマイズされたバージョンのインストーラからインストールされた可能性があります。\r\nたとえば、「簡易インストーラ作成キット」によってカスタマイズされたインストーラを用いてインストールされた可能性があります。\r\n\r\nこのままの状態で Web インストーラを作成すると、作成したインストーラをロードしようとした際にセキュリティの警告メッセージが表示されます。\r\n警告メッセージを表示しないようにするためには、一端 Web インストーラの作成をキャンセルし、ソフトイーサ社の Web サイトから最新の SoftEther VPN Client パッケージをダウンロードして再インストールしてから再度 Web インストーラを作成してください。\r\n\r\nこのまま続行しますか? -SW_FILE_NOT_FOUNT ファイル "%s" が見つかりません。 -SW_WEB_FINISHED 生成された Web インストーラを格納したファイル "%s" を保存しました。\r\n\r\nこの ZIP ファイルを展開し、中身のファイルを Web サーバーに設置して HTML ファイルや inf ファイル内の URL を適切に書き換えてください。\r\n\r\nWeb インストーラの配置方法に関する説明は ZIP ファイル内に記載されています。 - -SW_VG_CONFIRM_MSG SoftEther VPN Client に組み込まれた VPN Gate P2P 中継機能プラグインモジュール をインストールし有効化します。よろしいですか?\r\n\r\n本プラグインは、政府の検閲用ファイアウォールを回避するための通信の安定化を実現します。しかしながら、VPN Gate のためのネットワーク帯域の消費量が増加します。したがって、モバイル回線において VPN Gate 機能を使用することは推奨されていません。\r\n\r\n政府の検閲用ファイアウォールを回避する目的で暗号化された通信を行うことは、いくつかの国および地域では禁止されています。そのような場合は、VPN Gate 機能をコンピュータで使用してはいけません。VPN Gate は専ら日本国内における使用を想定し開発されています。VPN Gate は学術目的の研究プロジェクトです。VPN Gate は日本国の法令に基づいて提供されます。その他の国の法律については、VPN Gate Project は一切関知しておりません。本ソフトウェアおよびサービスを使用するにあたり、ユーザーはユーザー自身の責任において、適用されるすべての法令を遵守しなければなりません。使用場所が日本国内または国外のいずれであるかに係わらず、本ソフトウェアおよびサービスを使用したことによるすべての損害および責任はユーザーが負うこととなります。 - - - -SW_PERFORM_MSG_INIT_TASKS タスクを準備しています... -SW_PERFORM_MSG_COPY_PREPARE ファイルのコピーの準備をしています... -SW_PERFORM_MSG_WRITE_ERROR インストール先ファイル "%s" に書き込むことができません。\r\n\r\nこのファイルを開いているプログラムが実行中の可能性があります。\r\n「%s」関係のプログラムやサービスが起動している場合は、終了してから「再試行」をクリックしてください。 -SW_PERFORM_MSG_COPY_FILE "%s" をコピーしています... -SW_PERFORM_MSG_SET_SECURITY "%s" にセキュリティを設定しています... -SW_PERFORM_MSG_PLUGIN プラグインをインストールしています... -SW_PERFORM_MSG_STOP_SVC サービス 「%s」 を停止中... -SW_PERFORM_MSG_WAIT_FOR_FILE_UNLOCK ファイル "%s" が実行中のプログラムによってロックされています。ロックが解除されるまで待機中... -SW_PERFORM_MSG_INSTALL_SVC サービス 「%s」 をインストール中... -SW_PERFORM_MSG_START_SVC サービス 「%s」 を開始中... -SW_PERFORM_MSG_CREATE_LINKS ショートカットファイルを作成中... -SW_PERFORM_MSG_DELETE_LINKS ショートカットファイルを削除中... -SW_PERFORM_MSG_DELETE_OLD_LINKS 古いショートカットファイルを削除中... -SW_PERFORM_MSG_REGISTER_UNINSTALL アンインストール情報をコントロールパネルに登録中... -SW_PERFORM_MSG_IMPORTING_ACCOUNT 簡易インストーラに内蔵されている接続設定をインポートしています... -SW_PERFORM_MSG_DELETE_SETUP_INFO インストール情報およびログを削除中... -SW_PERFORM_MSG_WRITE_LOG セットアップログを書き出しています... -SW_PERFORM_MSG_COPY_ERROR ファイル "%s" へのコピーに失敗しました。 -SW_PERFORM_MSG_CREATE_LINK_ERROR ショートカットファイル "%s" の作成に失敗しました。\r\n\r\n再試行しますか? -SW_PERFORM_MSG_WRITE_LOG_ERROR セットアップログファイル "%s" の作成に失敗しました。\r\n\r\n再試行しますか? -SW_PERFORM_MSG_STOP_SVC_ERROR サービス 「%s」 (内部名: "%S") の停止に失敗しました。 -SW_PERFORM_MSG_START_SVC_ERROR サービス 「%s」 (内部名: "%S") の開始に失敗しました。 -SW_PERFORM_MSG_SVC_UNINSTALL_FAILED サービス 「%s」 (内部名: "%S") のアンインストールに失敗しました。 -SW_PERFORM_MSG_SVC_INSTALL_FAILED サービス 「%s」 (内部名: "%S") のインストールに失敗しました。 -SW_PERFORM_MSG_SVC_USERMODE_EXEC_FAILED ユーザーモードサービス "%s" の起動に失敗しました。 -SW_PERFORM_MSG_UPDATING システム設定を更新しています... -SW_PERFORM_MSG_DELETE_NIC 仮想 LAN カードを削除しています... -SW_PERFORM_MSG_FINISHED セットアップ処理が完了しました。 -SW_PERFORM_MSG_UNINSTALL_MSI %s の古いバージョンを Windows Installer を用いてアンインストールしています... -SW_PERFORM_MSG_UPDATE_LANG_CONFIG 言語設定を変更しています... - -SW_PERFORM_MSG_INIT_UNINST アンインストールの準備をしています... -SW_PERFORM_MSG_DELETE_PREPARE ファイルの削除の準備をしています... -SW_PERFORM_MSG_DELETE_ERROR ファイル "%s" を削除することができません。\r\n\r\nこのファイルを開いているプログラムが実行中の可能性があります。\r\n「%s」関係のプログラムやサービスが起動している場合は、終了してから「再試行」をクリックしてください。 -SW_PERFORM_MSG_UNINSTALL_SVC サービス 「%s」 をアンインストール中... -SW_PERFORM_MSG_DELETE "%s" を削除しています... -SW_PERFORM_MSG_EASY_INIT 簡易インストーラをビルドしています... -SW_PERFORM_MSG_WEB_INIT Web インストーラをビルドしています... -SW_PERFORM_MSG_INSTALL_SELOW システムの復元ポイントを作成し、必要なネットワークコンポーネントをインストールしています。これには数分間かかる場合があります... - - -SW_TAG_USERNAME \ (ユーザー) -SW_DIRNAME_CONFIG_TOOLS 構成ツール -SW_DIRNAME_ADMIN_TOOLS 管理者用ツール -SW_DIRNAME_LANGUAGE_TOOLS Language Settings - -SW_RUN_TEXT_VPNSMGR SoftEther VPN サーバー管理マネージャを起動します。 -SW_RUN_TEXT_VPNCMGR SoftEther VPN クライアント接続マネージャを起動します。 - -SW_NIC_UNINSTALL SoftEther VPN Client の仮想 LAN カードが作成されています。\r\nこれらの仮想 LAN カードを削除しますか? - -# Do not translate this section !!! -SW_TAG_USERNAME_ENGLISH \ (User-Mode) -SW_LINK_NAME_VPNSERVER_SVC SoftEther VPN Server Developer User-mode Service -SW_LINK_NAME_VPNBRIDGE_SVC SoftEther VPN Bridge Developer User-mode Service -SW_LONG_VPNSERVER SoftEther VPN Server Developer Edition -SW_LONG_VPNCLIENT SoftEther VPN Client Developer Edition -SW_LONG_VPNBRIDGE SoftEther VPN Bridge Developer Edition -SW_LONG_VPNSMGR SoftEther VPN Server Manager Developer Edition -SW_LONG_VPNCMGR SoftEther VPN Client Manager Developer Edition -SW_LANG_SET_FAILED Failed to write the new language setting on lang.config file. -# --- end of "Do not translate this section" --- - -# ショートカット名 -SW_LINK_NAME_VPNSMGR_SHORT SoftEther VPN サーバー管理 (Dev) -SW_LINK_NAME_VPNSMGR_SHORT_UM SE-VPN サーバー管理 (Dev・ユーザー) -SW_LINK_NAME_VPNSMGR_SHORT_TOOLSONLY SE-VPN サーバー管理 (Dev・ツール) -SW_LINK_NAME_VPNSMGR_SHORT_TOOLSONLY_UM SE-VPN サーバー管理 (Dev・ツール・ユーザー) -SW_LINK_NAME_VPNSMGR_FULL SoftEther VPN サーバー管理マネージャ Developer Edition -SW_LINK_NAME_VPNSMGR_COMMENT ローカルまたはリモート コンピュータ上で動作している SoftEther VPN Server および SoftEther VPN Bridge を管理するための管理ツールです。 - -SW_LINK_NAME_VPNCMGR_SHORT SoftEther VPN クライアント接続 (Dev) -SW_LINK_NAME_VPNCMGR_FULL SoftEther VPN クライアント接続マネージャ Developer Edition -SW_LINK_NAME_VPNCMGR_COMMENT SoftEther VPN Client Developer Edition を使用して VPN サーバーに接続することができます。 - -SW_LINK_NAME_VPNCMGRTOOLS_SHORT SoftEther VPN クライアント リモート管理 (Dev) -SW_LINK_NAME_VPNCMGRTOOLS_SHORT_UM SE-VPN クライアント リモート管理 (Dev・ユーザー) -SW_LINK_NAME_VPNCMGRTOOLS_FULL SoftEther VPN クライアント リモート管理 Developer Edition - -SW_LINK_NAME_VPNCMGR2_FULL 別のコンピュータの SoftEther VPN Client の管理 -SW_LINK_NAME_VPNCMGR2_COMMENT 別のコンピュータ上の SoftEther VPN Client プログラムにリモート接続して管理することができます。 - -SW_LINK_NAME_VPNCMGRTRAY_FULL SoftEther VPN Client Manager Developer Edition Startup -SW_LINK_NAME_VPNCMGRTRAY_COMMENT SoftEther VPN Client Developer Edition のアイコンをタスクバーの通知領域に表示します。 - -SW_LINK_NAME_EASYINSTALLER 簡易インストーラ作成ウィザード -SW_LINK_NAME_EASYINSTALLER_COMMENT 自動的に特定の接続先に VPN 接続を開始する機能を搭載した SoftEther VPN Client の簡易インストーラを作成する管理者向けのツールです。 - -SW_LINK_NAME_WEBINSTALLER Web インストーラ作成ウィザード -SW_LINK_NAME_WEBINSTALLER_COMMENT 自動的に特定の接続先に VPN 接続を開始する機能を搭載した SoftEther VPN Client の Web インストーラ (ActiveX インストーラ)を作成する管理者向けのツールです。 - -SW_LINK_NAME_VPNCMD SoftEther VPN コマンドライン管理ユーティリティ (vpncmd) -SW_LINK_NAME_VPNCMD_COMMENT vpncmd を使用して、SoftEther VPN Server, SoftEther VPN Bridge および SoftEther VPN Client をコマンドライン・インターフェイスで管理します。 -SW_LINK_NAME_TRAFFIC 通信スループット測定ツール -SW_LINK_NAME_TRAFFIC_COMMENT 通信スループット測定ツールを使用して、IP ネットワーク上にある 2 台のコンピュータ間で最大限に通信を行い、通信速度を簡単に測定することができます。 -SW_LINK_NAME_TCP TCP 通信設定最適化ユーティリティ -SW_LINK_NAME_TCP_COMMENT TCP/IP 通信設定を調整して、このコンピュータの TCP/IP プロトコルを使用した通信速度を向上させることができます。 -SW_LINK_NAME_SERVICES このコンピュータで動作中のサービス一覧 -SW_LINK_NAME_SERVICES_COMMENT 現在 Windows 上で動作しているサービス一覧を表示します。SoftEther VPN 関係のサービスの動作を開始または停止することができます。 -SW_LINK_NAME_VPNSERVER_SVC_COMMENT SoftEther VPN Server サービスをユーザーモードで起動します。 -SW_LINK_NAME_VPNBRIDGE_SVC_COMMENT SoftEther VPN Bridge サービスをユーザーモードで起動します。 - -SW_LINK_NAME_UNINSTALL %s のアンインストール -SW_LINK_NAME_UNINSTALL_COMMENT インストールされている %s をアンインストールします。 - -SW_LINK_NAME_LANGUAGE Configure Display Language (言語設定) -SW_LINK_NAME_LANGUAGE_COMMENT %s の表示言語を変更します。 - -SW_LINK_NAME_DEBUG デバッグ情報収集ツール -SW_LINK_NAME_DEBUG_COMMENT SoftEther VPN のデバッグ情報を収集します。サポート担当者から依頼があった場合のみ使用してください。 +# SoftEther VPN String Table +# Copyright (c) all contributors on SoftEther VPN project in GitHub. +# Copyright (c) Daiyuu Nobori, SoftEther Project at University of Tsukuba, and SoftEther Corporation. +# +# https://www.softether.org/ + + +########################################################################### +# # +# ソフトウェア内のメッセージ等の文字列データ # +# (ダイアログボックスリソース文字列は除く) # +# # +########################################################################### + + + +# 環境パラメータ +DEFAULT_FONT MS UI Gothic +DEFAULT_FONT_HIGHDPI Meiryo UI +DEFAULT_FONT_2 MS Gothic +DEFAULT_FONT_SIZE 9 +DEFAULT_LOCALE 年 月 日 時 分 秒 日 月 火 水 木 金 土 日 時間 分 秒 (なし) + + +# 言語 +# (0: 日本語, 1: 英語) +LANG 0 +LANGSTR Japanese + + +# 文字列テーブル識別子 +STRTABLE_ID SE_VPN_20121007 + + +# 日本語版のみの文字列 (他の言語では不要) +CM_JAPANESE_ONLY_OLD_STARTUP %s\\SoftEther VPN Client 2.0 タスクトレイ.lnk + +# ソフトウェア情報 +PRODUCT_NAME_VPN_CLI SoftEther VPN Client Developer Edition +PRODUCT_NAME_VPN_CMGR SoftEther VPN Developer Edition クライアント接続マネージャ +PRODUCT_NAME_VPN_SVR SoftEther VPN Server Developer Edition +PRODUCT_NAME_VPN_BRIDGE SoftEther VPN Bridge Developer Edition +PRODUCT_NAME_VPN_SMGR SoftEther VPN Developer Edition サーバー管理マネージャ +PRODUCT_NAME_ELOGSVC SoftEther EtherLogger Developer Edition +PRODUCT_NAME_ELOGMGR SoftEther EtherLogger Developer Edition + +# ソフトウェア更新チェック用の Family Name +PRODUCT_FAMILY_NAME SoftEtherDev + + +# 接続制限用のブランド化文字列 +# BRANDED_C_TO_S Branded_VPN +# BRANDED_C_FROM_S Branded_VPN + +# クライアント ID +# CLIENT_ID 123 + +# プロダクト情報 +SE_COMPANY_URL https://selinks.org/?se +SE_VPNAZURE_URL https://selinks.org/?vpnazure + +# 共通文字列 +COMMON_UNKNOWN (不明) + + +# プロトコルエラー文字列 +ERR_UNKNOWN 不明なエラーが発生しました。 +ERR_0 エラーはありません。 +ERR_1 サーバーへの接続が失敗しました。ネットワーク接続や、接続先サーバーのアドレスやポート番号を確認してください。 +ERR_2 プロトコルエラーが発生しました。接続先サーバーからエラーが返されました。 +ERR_3 接続が切断されました。 +ERR_4 プロトコルエラーが発生しました。 +ERR_5 SoftEther VPN ソフトウェア以外のクライアントがポートに接続しました。 +ERR_6 ユーザーによってキャンセルされました。 +ERR_7 指定された認証方法はサーバーによって拒否されました。 +ERR_8 指定された仮想 HUB がサーバーに存在しません。 +ERR_9 ユーザー認証に失敗しました。 +ERR_10 指定された仮想 HUB は現在停止中です。しばらく待ってから、再接続してください。 +ERR_11 VPN セッションが削除されました。管理者がセッションを切断したか、クライアントから VPN Server への接続が切断された可能性があります。 +ERR_12 アクセスが拒否されました。 +ERR_13 VPN セッションの通信がタイムアウトしました。クライアントから VPN Server への接続が切断された可能性があります。 +ERR_14 プロトコル番号が不正です。 +ERR_15 TCP/IP コネクション数が多すぎます。 +ERR_16 接続先のサーバーまたは仮想 HUB に接続しているセッション数が多すぎます。 +ERR_17 プロキシサーバーへの接続に失敗しました。 +ERR_18 プロキシサーバーでエラーが発生しました。 +ERR_19 プロキシサーバーでのユーザー認証に失敗しました。 +ERR_20 同一ユーザーのセッション数が多すぎます。すでに他のユーザーが同一のユーザーとして VPN 接続している可能性があります。 +ERR_21 VPN Server でライセンスエラーが発生しました。VPN Server の管理者にお問い合わせください。 +ERR_22 仮想 LAN カードデバイスドライバにアクセスできません。仮想 LAN カードがインストールされており、無効になっていないことを確認してください。 +ERR_23 内部エラーが発生しました。 +ERR_24 スマートカードまたは USB ハードウェアトークンデバイスへのアクセスに失敗しました。 +ERR_25 PIN コードが違います。 +ERR_26 スマートカードまたは USB ハードウェアトークンデバイスには、指定された証明書は格納されていません。 +ERR_27 スマートカードまたは USB ハードウェアトークンデバイスには、指定された秘密鍵は格納されていません。 +ERR_28 スマートカードまたは USB ハードウェアトークンデバイスへの書き込みに失敗しました。 +ERR_29 指定されたオブジェクトが見つかりません。 +ERR_30 指定された名前の仮想 LAN カードはすでに存在します。別の名前を指定してください。 +ERR_31 仮想 LAN カードデバイスドライバのインストールに失敗しました。 +ERR_32 指定された名前は、仮想 LAN カードのデバイス名として使用できません。 +ERR_33 サポートされていません。 +ERR_34 指定された名前の接続設定はすでに存在しています。 +ERR_35 指定された接続設定は現在接続中です。 +ERR_36 指定された接続設定は存在しません。 +ERR_37 指定された接続設定は接続されていません。 +ERR_38 パラメータが不正です。 +ERR_39 スマートカードまたは USB ハードウェアトークンでエラーが発生しました。 +ERR_40 スマートカードまたは USB ハードウェアトークン認証を選択しましたが、使用するデバイスが選択されていません。接続マネージャの [スマートカード] メニューで選択してください。 +ERR_41 指定された仮想 LAN カードは 1 つ以上の接続設定によって使用されています。\r\nこの仮想 LAN カードを使用している接続設定を削除するか、接続設定が使用する仮想 LAN カードを変更してください。 +ERR_42 指定された接続設定が使用する仮想 LAN カードが見つかりません。\r\n仮想 LAN カードが存在していることを確認してください。また、仮想 LAN カードデバイスが無効化されていないことを確認してください。\r\n\r\n問題が解決できない場合は、この接続設定の使用する仮想 LAN カードを変更するか、同じ名前の仮想 LAN カードを新規作成してください。 +ERR_43 指定された接続設定が使用する仮想 LAN カードは、すでに別の接続設定によって使用中です。\r\n同じ仮想 LAN カードを使用している別の接続設定がある場合は、その接続設定を切断してください。 +ERR_44 指定された接続設定が使用する仮想 LAN カードが無効化されています。\r\nこの接続設定を使用する前に、仮想 LAN カードを有効化して、使用可能な状態にしてください。 +ERR_45 指定された値が不正です。 +ERR_46 接続先はクラスタコントローラではありません。 +ERR_47 接続試行中です。 +ERR_48 クラスタコントローラへの接続に失敗しました。 +ERR_49 クラスタコントローラはクラスタ上に新しいセッションを割り当てることができませんでした。 +ERR_50 クラスタメンバサーバーの仮想 HUB を管理することはできません。 +ERR_51 接続しようとしたユーザーのパスワードは空のため、リモートから接続を行うことはできません。空のパスワードを使っている場合、VPN Server のローカルコンピュータ localhost (127.0.0.1) 上からのみ接続できます。 +ERR_52 権限が不足しています。 +ERR_53 指定したリスナーが見つかりません。 +ERR_54 すでに指定したポート番号のリスナーが存在しています。 +ERR_55 クラスタメンバサーバーではありません。 +ERR_56 指定した暗号化アルゴリズム名はサポートされていません。 +ERR_57 指定した名前の仮想 HUB はすでにサーバー上に存在します。 +ERR_58 登録されている仮想 HUB が多すぎます。これ以上登録できません。古い仮想 HUB を削除してください。 +ERR_59 指定された名前のカスケード接続がすでに存在します。 +ERR_60 カスケード接続はクラスタ上のサーバーに作成することはできません。 +ERR_61 指定されたカスケード接続がオフラインになっています。 +ERR_62 登録されているアクセスリスト数が多すぎます。 +ERR_63 登録されているユーザー数が多すぎます。 +ERR_64 登録されているグループ数が多すぎます。 +ERR_65 指定したグループは存在しません。 +ERR_66 指定した名前のユーザーがすでに仮想 HUB 上に存在します。 +ERR_67 指定した名前のグループがすでに仮想 HUB 上に存在します。 +ERR_68 指定した名前のユーザーはサーバー上に存在しますが、認証の種類はパスワード認証ではありません。パスワードを変更することはできません。 +ERR_69 入力されたユーザー名または古いパスワードが正しくありません。パスワードは大文字・小文字を区別されます。 +ERR_70 さいたま。 +ERR_71 SoftEther は経済産業省の要請により現在配布を一時停止させていただいております。 +ERR_72 SoftEther は IPA の要請により現在配布を一時停止させていただいております。 +ERR_73 カスケード接続のセッションは切断できません。セッションを削除するには、カスケード接続を停止してください。 +ERR_74 VPN Server への接続設定が未完了です。先に VPN Server に接続するための接続設定を行ってください。 +ERR_75 すでに VPN Server への接続を開始しています。 +ERR_76 VPN Server に接続されていません。 +ERR_77 指定された X509 証明書ファイルは RSA 1024 bit、1536 bit、2048 bit、3072 bit または 4096 bit の公開鍵を持っていません。SoftEther VPN ソフトウェアは RSA 1024 bit、1536 bit、2048 bit、3072 bit または 4096 bit 証明書をサポートしています。 +ERR_78 SecureNAT のセッションは切断できません。セッションを削除するには、SecureNAT 機能を停止してください。 +ERR_79 SecureNAT 機能はクラスタリング環境では有効にすることはできません。 +ERR_80 SecureNAT 機能が動作していません。 +ERR_81 この VPN Server への接続セッションは、ネットワーク管理者によって設置されているファイアウォール装置によって遮断されました。ネットワーク管理者にお問い合わせください。 +ERR_82 ローカルブリッジセッションは切断できません。セッションを削除するには、ローカルブリッジ機能を停止してください。 +ERR_83 ローカルブリッジ機能が動作していません。 +ERR_84 接続先の VPN Server では、ローカルブリッジが使用できません。お使いの VPN Server でローカルブリッジを使用するための設定方法については、オンラインヘルプなどを参照してください。 +ERR_85 接続先サーバーの提示した証明書が信頼できません。接続設定でサーバー証明書を必ず検証する設定が有効になっています。信頼できるルート証明書を登録するか、固有証明書を登録してください。 +ERR_86 接続先サーバーの製品コードが違います。このクライアントから接続することはできません。 +ERR_87 クライアントとサーバーのバージョンが違います。ソフトウェアをアップデートしてください。 +ERR_88 キャプチャデバイスの追加に失敗しました。すでに同一のキャプチャデバイスが登録されている可能性があります。 +ERR_89 接続先サーバーはクライアントから接続することはできません。専用クライアントソフトウェアが必要です。 +ERR_90 指定したキャプチャデバイスは登録されていません。 +ERR_91 仮想レイヤ 3 スイッチセッションは切断できません。セッションを削除するには、仮想レイヤ 3 スイッチを停止してください。 +ERR_92 指定された名前の仮想レイヤ 3 スイッチは既に存在します。別の名前を指定してください。 +ERR_93 指定された名前の仮想レイヤ 3 スイッチが見つかりません。 +ERR_94 指定された名前が不正です。使用できない文字が含まれていないかどうかチェックしてください。 +ERR_95 仮想レイヤ 3 インターフェイスの追加に失敗しました。パラメータが正しいかどうか確認してください。また、仮想レイヤ 3 スイッチが動作中の場合は、仮想レイヤ 3 インターフェイスの追加または削除はできません。仮想レイヤ 3 スイッチを停止してください。 +ERR_96 仮想レイヤ 3 インターフェイスの削除に失敗しました。パラメータが正しいかどうか確認してください。また、仮想レイヤ 3 スイッチが動作中の場合は、仮想レイヤ 3 インターフェイスの追加または削除はできません。仮想レイヤ 3 スイッチを停止してください。 +ERR_97 指定された仮想レイヤ 3 インターフェイスの接続先仮想 HUB に接続している仮想レイヤ 3 インターフェイスが仮想レイヤ 3 スイッチの中に既に存在します。1 つの仮想レイヤ 3 スイッチの中では、同一の仮想 HUB に接続する仮想レイヤ 3 インターフェイスは 1 つしか定義できません。 +ERR_98 ルーティングテーブルの追加に失敗しました。パラメータが正しいかどうか確認してください。また、仮想レイヤ 3 スイッチが動作中の場合は、ルーティングテーブルの追加または削除はできません。仮想レイヤ 3 スイッチを停止してください。 +ERR_99 ルーティングテーブルの削除に失敗しました。パラメータが正しいかどうか確認してください。また、仮想レイヤ 3 スイッチが動作中の場合は、ルーティングテーブルの追加または削除はできません。仮想レイヤ 3 スイッチを停止してください。 +ERR_100 指定されたルーティングテーブルはすでに存在します。 +ERR_101 クライアントとサーバーの間の時計がずれています。時刻設定を確認してください。 +ERR_102 この仮想レイヤ 3 スイッチを開始できません。\r\n\r\n仮想レイヤ 3 スイッチを開始するには、最低でも 1 つの仮想インターフェイスが仮想レイヤ 3 スイッチ内に定義されている必要があります。 +ERR_103 接続先の VPN Server のクライアント接続ライセンス数が不足しています。サーバー管理者にお問い合わせください。 +ERR_104 接続先の VPN Server のブリッジ接続ライセンス数が不足しています。サーバー管理者にお問い合わせください。 +ERR_105 接続先の VPN Server は、現在技術的な問題で接続を受け付けていません。しばらく待つか、VPN Server の管理者に連絡してサーバーのログファイルを確認するよう要請してください。 +ERR_106 接続先の VPN Server の証明書の有効期限が切れています。VPN Server の管理者にご連絡ください。 +ERR_107 モニタリングモードで接続を要求しましたが、接続に使用したユーザーのセキュリティポリシーはモニタリングモードを許可していません。 +ERR_108 ブリッジ / ルータモードで接続を要求しましたが、接続に使用したユーザーのセキュリティポリシーはブリッジモードもルータモードも禁止しています。 +ERR_109 VPN Server の仮想 HUB の接続元 IP 制限リストの設定によって、クライアントの IP アドレスからの接続は拒否されました。 +ERR_110 項目数が多すぎます。 +ERR_111 メモリが不足しています。 +ERR_112 指定されたオブジェクトはすでに存在しています。 +ERR_113 致命的なエラーが発生しました。プログラムの動作が継続できない可能性があります。 +ERR_114 接続先 VPN Server でソフトウェアライセンス違反が検出されています。接続は許可されません。VPN Server の管理者にお問い合わせください。 +ERR_115 接続先の VPN Server が現在インターネット上のソフトイーサ株式会社が提供する重要なサーバーに接続し、ライセンスを確認できない状態です。しばらく待つか、VPN Server の管理者に連絡してサーバーのログファイルおよびサーバー本体のインターネットへの接続状況を確認するよう要請してください。 +ERR_116 クライアント側でソフトウェアライセンス違反が検出されました。接続は許可されません。 +ERR_117 コマンドまたはファイル名が不正です。 +ERR_118 ライセンスキーが正しくありません。 +ERR_119 VPN Server に有効なライセンスが登録されていません。VPN Server の管理者に連絡してください。 +ERR_120 VPN Server がクラスタとして動作するために必要な製品ライセンスが登録されていません。VPN Server の管理者に連絡してください。 +ERR_121 この VPN Client の接続設定は SoftEther VPN 2.0 Administration Pack に含まれる「Web インストーラ作成キット」または「簡易インストーラ作成キット」によってインストールされたものですが、接続先の VPN Server は SoftEther VPN 2.0 Administration Pack に対応したエディションではありません。インストーラの作成元やシステム管理者にお問い合わせください。 +ERR_122 VPN Server SDK for .NET ライブラリは SoftEther VPN 2.0 Administration Pack に対応したエディションの SoftEther VPN Server にのみ接続することができます。接続先の VPN Server は SoftEther VPN 2.0 Administration Pack に対応したエディションではありません。システム管理者にお問い合わせください。 +ERR_123 接続先のソフトウェアはベータ版で、期限が切れています。より新しいベータ版または完成版の提供が開始された後は利用することはできません。http://selinks.org/ にアクセスし、最新版のソフトウェアを入手するよう、接続先のサーバーの管理者に連絡してください。 +ERR_124 VPN Server への接続がサーバ側で拒否されました。 +ERR_125 VPN Server への接続がクライアント側で拒否されました。 +ERR_126 一定時間が経過したため、管理者によって設定されたセキュリティポリシーの設定により、VPN 接続が自動的に切断されました。続けて通信を行いたい場合は、もう一度接続してください。 +ERR_127 この VPN Server に接続するためには、VPN Server の管理者が作成した特別バージョンの VPN Client ソフトウェアが必要です。VPN Server の管理者にお問い合わせください。 +ERR_128 この VPN Server には、すでに現在の製品エディションのライセンスで許容されている作成可能ユーザー数以上の個数のユーザーオブジェクトが作成・登録されています。これ以上、この VPN Server に新しいユーザーオブジェクトを作成することはできません。既存のユーザーオブジェクトをいくつか削除するか、製品エディションを Professional Edition など上位のバージョンにアップグレードしてください。 +ERR_129 投入しようとしたライセンスキーのサブスクリプション契約は、この VPN Server がリリース (ビルド) された日よりも前に有効期限が切れています。お客様は、サブスクリプション契約を締結されていた期間中にリリース (ビルド) されたバージョンの VPN Server のみを使用する権利があります。お客様が過去にサブスクリプション契約を締結されていた期間中にリリース (ビルド) された古いバージョンの VPN Server を使用するか、またはお客様のサブスクリプション契約を更新して新しいライセンスキーを取得してください。なお、古いバージョンの VPN Server にダウングレードするために、http://selinks.org/ からソフトウェアをダウンロードできる場合があります。 +ERR_130 VPN Server の体験版ライセンスキーを何個も連続して取得し、利用することはできません。製品版ライセンスのご購入をご検討ください。 +ERR_131 同一 IP アドレスに複数の VPN Server があります。NAT 使用の場合は、ポート開放設定を行ってください。または「接続先グローバル IP アドレスまたはホスト名/192.168.x.x」のように "/" を付加し、この文字以降に接続先を特定するプライベート IP アドレスまたはホスト名を指定してください。 +ERR_132 ダイナミック DNS サービス用のホストキーが重複しています。キーは自動的にリセットされます。 +ERR_133 指定されたダイナミック DNS ホスト名はすでに使用されています。別のホスト名を指定してください。 +ERR_134 指定されたダイナミック DNS ホスト名の一部に使用できない文字が含まれています。別のホスト名を指定してください。 +ERR_135 指定されたダイナミック DNS ホスト名が長すぎます。ホスト名は 31 文字以下で指定してください。 +ERR_136 ダイナミック DNS ホスト名が指定されていません。 +ERR_137 指定されたダイナミック DNS ホスト名が短すぎます。ホスト名は 3 文字以上で指定してください。 +ERR_138 仮想 HUB に登録されているユーザーのパスワードは、MS-CHAP v2 認証を行う前に一度再設定される必要があります。VPN サーバーの管理者に依頼してパスワードを内部バージョン 4.0 以降の VPN サーバーマネージャまたは vpncmd ユーティリティを用いて再設定するか、VPN Client ソフトウェアを用いてパスワードを変更してください。 +ERR_139 ダイナミック DNS サーバーとの間の通信が切断されました。 +ERR_140 ICMP (Ping) プロトコルを初期化することができませんでした。VPN Server を動作させているプロセスが一般ユーザー権限で動作している可能性があります。そのような場合は、VPN Server をシステムサービスとして動作させてください (Linux / UNIX の場合は root 権限で動作させてください)。 +ERR_141 DNS ポート 53 を開くことができませんでした。VPN Server が動作しているコンピュータですでに別の DNS サーバープログラム (BIND や Microsoft DNS Server など) が動作していないかどうか確認してください。これらの同一ポートを使用するプログラムを終了させて再試行してみてください。また、Linux / UNIX の場合は VPN Server プロセスが root 権限で動作していることを確認してください。 +ERR_142 OpenVPN サーバー機能が有効になっていません。 +ERR_143 ユーザー認証の方法のうち「証明書認証」および「外部サーバー認証」機能はオープンソース版 SoftEther VPN にはまだ実装されていません。ユーザー認証の方法として「匿名認証」または「パスワード認証」のいずれかを選択してください。 +ERR_144 この操作は実行できません。VPN Gate 中継サーバーに関する操作は VPN Gate コントロールパネルから実行してください。 +ERR_145 この操作は実行できません。VPN Gate 公開 VPN 中継サーバーの接続設定に関する操作は VPN Gate の設定画面から実行してください。 +ERR_146 VPN Gate サービスが VPN Client 内で動作している場合は、この設定画面から VPN Gate サービスを停止することはできません。VPN Gate サービスを停止するには、VPN Client 接続マネージャの設定ツールを使用してください。 +ERR_147 この機能はオープンソース版 SoftEther VPN にはまだ実装されていません。 +ERR_148 Windows システムがサスペンド状態に移行中のため、VPN 通信が切断されました。 + + + +# ライセンス関係 +LICENSE_INFO_URL https://selinks.org/?new_license +LICENSE_SUPPORT_URL https://selinks.org/?q=license_info&id=%s +LICENSE_STATUS_OK 有効 +LICENSE_STATUS_EXPIRED 有効期限切れ +LICENSE_STATUS_ID_DIFF サーバー ID 不一致 +LICENSE_STATUS_DUP 重複 +LICENSE_STATUS_INSUFFICIENT 必要な他のライセンスが不足 +LICENSE_STATUS_COMPETITION 他のライセンスと競合 +LICENSE_STATUS_NONSENSE 現在のエディションでは無意味 +LICENSE_STATUS_CPU CPU の種類が不一致 +LICENSE_STATUS_OTHERERROR 不明なエラーのため無効 + + +# TCP 最適化関係 +TCPOPT_NOT_SUPPORTED TCP/IP 通信設定最適化ユーティリティは、このオペレーティングシステムでは使用できません。 +TCPOPT_NOT_ADMIN TCP/IP 通信設定最適化ユーティリティは、管理者権限の無いユーザーは使用できません。 + + +# Windows Vista / Windows 7 / Windows 8 用最適化関係 +VISTA_MMCSS_MSG Windows Vista / Windows 7 / Windows 8 / Windows 10 で VPN 通信を経由してマルチメディアファイル (ビデオやオーディオ、ストリーミングなど) を再生するための最適化をしますか? +VISTA_MMCSS_MSG_2 すでに Windows Vista / Windows 7 / Windows 8 / Windows 10 で VPN 通信を経由してマルチメディアファイル (ビデオやオーディオ、ストリーミングなど) を再生するための最適化の設定が行われています。\r\n最適化設定を削除して、元に戻しますか? +VISTA_MMCSS_MSG_3 現在の環境では、最適化の機能は使用できません。 +VISTA_MMCSS_MSG_4 この機能は、Administrators 権限でプログラムを起動している際にのみ使用できます。\r\nWindows Vista / Windows 7 / Windows 8 / Windows 10 の場合は、[管理者として実行] 機能を使用してプログラムを実行してください。 +VISTA_MMCSS_MSG_5 最適化設定が完了しました。 +VISTA_MMCSS_MSG_6 最適化設定は削除されました。 + +# PKCS ユーティリティ関係 +PKCS_UTIL_TITLE PKCS#12 書き込みユーティリティ +PKCS_UTIL_SAVEDLG_TITLE USB トークンに書き込みたい PKCS#12 ファイルを選択 +PKCS_UTIL_READ_ERROR ファイル %s を読み込めませんでした。 +PKCS_UTIL_WRITE_OK_MSG ファイル %s を USB ハードウェアトークンに書き込みました。 +PKCS_UTIL_DELETE_OK_MSG USB ハードウェアトークンから PKCS#12 証明書データを消去しました。 +PKCS_UTIL_SECA_FILENAME seca_p12 +PKCS_MAKE_SURE USB トークン内に書き込まれている PKCS#12 証明書データを消去します。\r\n一旦消去したデータは、二度と復元することはできません。\r\r\n\r\r\n続行しますか? +PKCS_UTIL_BAD_FILE 指定されたファイルは PKCS#12 ファイルとして認識できませんでした。 + + +# 共通ダイアログ関係 +DLG_ALL_FILES すべてのファイル (*.*)|*.* +DLG_CERT_FILES X509 証明書ファイル (*.CER;*.CRT)|*.cer;*.crt|すべてのファイル (*.*)|*.* +DLG_KEY_FILTER 秘密鍵ファイル (*.KEY;*.PEM)|*.key;*.pem|すべてのファイル (*.*)|*.* +DLG_PKCS12_FILTER PKCS#12 ファイル (*.P12;*.PFX)|*.p12;*.pfx|すべてのファイル (*.*)|*.* +DLG_CERT_OR_P12_FILTER X509 証明書または PKCS#12 ファイル (*.CER;*.CRT;*.P12;*.PFX)|*.cer;*.crt;*.p12;*.pfx|X509 証明書ファイル (*.CER;*.CRT)|*.cer;*.crt|PKCS#12 ファイル (*.P12;*.PFX)|*.p12;*.pfx|すべてのファイル (*.*)|*.* +DLG_CONFIG_FILES 設定ファイル (*.CONFIG)|*.config|すべてのファイル (*.*)|*.* +DLG_KEY_OR_P12_FILTER 秘密鍵ファイルまたは PKCS#12 ファイル (*.KEY;*.PEM;*.P12;*.PFX)|*.key;*.pem;*.p12;*.pfx|秘密鍵ファイル (*.KEY;*.PEM)|*.key;*.pem|PKCS#12 ファイル (*.P12;*.PFX)|*.p12;*.pfx|すべてのファイル (*.*)|*.* +DLG_ZIP_FILER ZIP ファイル (*.ZIP)|*.zip|すべてのファイル (*.*)|*.* +DLG_OPEN_CERT 証明書ファイルを選択してください +DLG_OPEN_KEY 秘密鍵ファイルを選択してください +DLG_OPEN_KEY_WITH_CERT 対応する秘密鍵ファイルを選択してください +DLG_OPEN_FILE_ERROR 指定されたファイル "%S" を読み込めませんでした。 +DLG_OPEN_FILE_ERROR_W 指定されたファイル "%s" を読み込めませんでした。 +DLG_BAD_P12 ファイル "%S" は有効な PKCS#12 証明書ファイルではありません。 +DLG_BAD_P12_W ファイル "%s" は有効な PKCS#12 証明書ファイルではありません。 +DLG_BAD_X509 ファイル "%S" は有効な X509 証明書ファイルではありません。 +DLG_BAD_X509_W ファイル "%s" は有効な X509 証明書ファイルではありません。 +DLG_BAD_KEY ファイル "%S" は有効な RSA 秘密鍵ファイルではありません。 +DLG_BAD_KEY_W ファイル "%s" は有効な RSA 秘密鍵ファイルではありません。 +DLG_BAD_SIGNATURE 指定された証明書に含まれる公開鍵と秘密鍵が正しく対応していません。\r\n証明書の公開鍵に対応した秘密鍵が必要です。 +DLG_SAVE_CERT 証明書を保存するファイル名を指定してください +DLG_SAVE_KEY 秘密鍵を保存するファイル名を指定してください +DLG_SAVE_P12 証明書と秘密鍵を保存するファイル名を指定してください +DLG_SAVE_FILE 保存先のファイル名を指定してください +DLG_SAVE_OPENVPN_CONFIG OpenVPN 設定ファイルを格納した ZIP ファイルの保存先 +DLG_CERT_SAVE_OK 証明書を正しく保存しました。 +DLG_CERT_SAVE_ERROR 証明書を保存できませんでした。 +DLG_KEY_SAVE_OK 秘密鍵を正しく保存しました。 +DLG_KEY_SAVE_ERROR 秘密鍵を保存できませんでした。 +DLG_KEY_PAIR_SAVE_OK 証明書と秘密鍵を正しく保存しました。 +DLG_KEY_PAIR_SAVE_ERROR 証明書と秘密鍵を正しく保存できませんでした。 +DLG_REBOOT_INFO %u 秒後にコンピュータを再起動します。 +DLG_REBOOT_INFO_2 コンピュータを再起動しています... +DLG_REBOOT_ERROR コンピュータの再起動に失敗しました。\r\n\r\n直ちにコンピュータを手動で再起動してください。 +DLG_SAVE_CONFIG コンフィグレーションの保存先ファイル名を指定してください +DLG_OPEN_CONFIG インポートするコンフィグレーションファイルを指定してください +DLG_STRING_DEFTITLE 文字列の入力 +DLG_STRING_DEFINFO 文字列を入力してください。 +DLG_ABOUT_LEGAL 法律上の通知 +DLG_ABOUT_AUTHORS 開発者の一覧 +DLG_UPDATE_DATE \ (%S にリリース) +DLG_UPDATE_HINT [OK] をクリックすると、Web ブラウザが開いて最新のアップデートに関する情報が表示されます。\r\n\r\nアップデートのダウンロードとインストールは手動で行う必要があります。他のコンピュータ上のソフトウェアのアップデートを行う場合は、そのコンピュータにリモートデスクトップや SSH などでログインしてダウンロードとアップデート作業を行ってください。\r\n + + +# 競合するプロセス関係 +BAD_PROCESS_TITLE %S に関する警告 +BAD_PROCESS_MESSAGE このコンピュータで、問題の原因となる可能性のあるソフトウェア "%S" が動作している可能性があることが検出されました。\r\n\r\n"%S" に含まれる問題が原因で VPN 通信が不安定になったり、エラーが発生したりする可能性があります。\r\n\r\nVPN をソフトウェア "%S" と共に利用したことにより、VPN の動作が不安定になる場合は、"%S" を停止するか、アンインストールすることを推奨します (ソフトウェアの種類によっては、停止させるだけでは依然としてコンピュータに問題が残る可能性がありますのでご注意ください)。\r\n + + +# ハードウェアトークン関係 +SEC_SMART_CARD スマートカード +SEC_USB_TOKEN USB トークン +SEC_INIT_MSG_1 以下のスマートカードをスマートカードリーダに挿入し、PIN コードを入力してください。 +SEC_INIT_MSG_2 以下の USB トークンハードウェアをコンピュータの USB ポートに接続し、PIN コードを入力してください。 +SEC_OPENING デバイスを開いています... +SEC_CLOSING デバイスを閉じています... +SEC_OPEN_SESSION セキュアセッションを開いています... +SEC_CLOSE_SESSION セキュアセッションを閉じています... +SEC_LOGIN トークンにログインしています... +SEC_LOGOUT トークンからログアウトしています... +SEC_INIT_BATCH バッチ処理を開始しています... +SEC_READ_DATA データを読み出しています... +SEC_WRITE_DATA データを書き込んでいます... +SEC_READ_CERT 証明書を読み込んでいます... +SEC_WRITE_CERT 証明書を書き込んでいます... +SEC_DELETE オブジェクトを削除しています... +SEC_SIGN 秘密鍵によるデジタル署名を行っています... +SEC_WRITE_KEY 秘密鍵を書き込んでいます... +SEC_ENUM オブジェクトを列挙しています... +SEC_FINISHED 操作が完了しました。 +SEC_ERROR_INVALID_ID 指定されたセキュリティデバイス (デバイス %u) は無効です。 +SEC_ERROR_OPEN_DEVICE デバイス %S を開くことができませんでした。デバイスがコンピュータに接続されていることを確認してください。 +SEC_ERROR_OPEN_DEVICEEX デバイス %S を開くことができませんでした。デバイスがコンピュータに接続されていることを確認してください。\r\n\r\nなお、住民基本台帳ネットワークカードなどの公的個人認証サービスクライアントソフトウェア等を使用している場合は、事前に [スタート] メニューの [公的個人認証ユーティリティ] で使用するスマートカードデバイスを選択しておく必要があります。 +SEC_ERROR_OPEN_SESSION デバイス %S 内部でセキュリティセッションを開始することができませんでした。正しいデバイスが選択されていることを確認してください。 +SEC_ERROR_LOGIN 入力された PIN コードが間違っています。 +SEC_ERROR_NOT_FOUND_1 スマートカード内に指定されたオブジェクトが存在しません。正しいスマートカードが挿入されていることを確認してください。 +SEC_ERROR_NOT_FOUND_2 USB トークンハードウェア内に指定されたオブジェクトが存在しません。正しい USB トークンハードウェアが接続されていることを確認してください。 +SEC_ERROR_SIGN_1 スマートカード内に秘密鍵が存在しないか、デジタル署名操作に失敗しました。正しいスマートカードが挿入されていることを確認してください。 +SEC_ERROR_SIGN_2 USB トークンハードウェア内に秘密鍵が存在しないか、デジタル署名操作に失敗しました。正しい USB トークンハードウェアが接続されていることを確認してください。 +SEC_ERROR_WRITE_1 オブジェクトをスマートカードに書き込むことができませんでした。スマートカードの空きメモリが不足している可能性があります。 +SEC_ERROR_WRITE_2 オブジェクトを USB トークンハードウェアに書き込むことができませんでした。 スマートカードの空きメモリが不足している可能性があります。 +SEC_ERROR_ENUM トークン内に格納されているオブジェクトの列挙に失敗しました。 +SEC_ERROR_DELETE 指定されたオブジェクトの削除に失敗しました。指定されたオブジェクトはメモリ内に存在しない可能性があります。 +SEC_COLUMN1 デバイス名 +SEC_COLUMN2 種類 +SEC_COLUMN3 製造元 +SEC_COLUMN4 DLL 名 +SEC_INVALID_ID 指定されたスマートカードデバイスは存在しません。スマートカードの種類をもう一度選択してください。 +SEC_MGR_COLUMN1 名前 +SEC_MGR_COLUMN2 種類 +SEC_MGR_COLUMN3 プライベート +SEC_TYPE_DATA データ +SEC_TYPE_CERT 証明書 +SEC_TYPE_KEY 秘密鍵 +SEC_TYPE_PUB 公開鍵 +SEC_YES はい +SEC_NO いいえ +SEC_NONE なし +SEC_IMPORT_DATA インポートしたいデータを選択してください +SEC_IMPORT_CERT インポートしたい証明書を選択してください +SEC_IMPORT_KEY インポートしたい秘密鍵を選択してください +SEC_READ_FAILED 指定されたファイルの読み込みに失敗しました。 +SEC_DATA_TOO_BIG 指定されたデータのサイズが大きすぎます。スマートカードには %u バイトを超えるデータを書き込むことはできません。 +SEC_OBJECT_NAME_TITLE 挿入するオブジェクトの名前 +SEC_OBJECT_NAME_INFO 新しくスマートカードに書き込むオブジェクトの名前を指定してください。オブジェクトの名前には、特殊な記号を除く任意の半角文字を指定することができます。\r\n\r\nすでにカードに書き込まれている同じ種類のオブジェクト名と重複すると上書きされますので注意してください。 +SEC_DELETE_MSG 選択したオブジェクトをスマートカードから削除します。\r\nよろしいですか? +SEC_OBJECT_IMPORT_OK オブジェクトをスマートカードに書き込みました。 +SEC_OBJECT_EXPORT_OK スマートカードから読み取ったデータをファイルに保存しました。 +SEC_NEW_CERT_IMPORT_OK 新しく生成した証明書をスマートカードに書き込みました。 +SEC_CURRENT_DEVICE 現在、デバイス %S が選択されています。 +SEC_CURRENT_NO_DEVICE 使用するスマートカードデバイスを選択してください。 +SEC_NO_SECURE_DEVICE システムに SoftEther VPN が対応したスマートカードまたはハードウェアセキュリティトークンデバイスがインストールされていません。\r\n\r\nSoftEther VPN でスマートカードまたはハードウェアトークンを利用するには、PKCS#11 に対応したデバイスドライバが Windows にインストールされている必要があります。また、SoftEther VPN が対応している種類のデバイスである必要があります。\r\n\r\nシステムに対応したデバイスドライバがインストールされていることを確認してください。\r\nSoftEther VPN が対応しているデバイスの一覧については、ソフトイーサ株式会社の Web サイトをご覧ください。また、ソフトウェアのバージョンを最新のものにアップデートすることにより対応機器が増える場合もあります。 +SEC_PIN_DEVICE_OPEN_ERR デバイス "%S" に接続できませんでした。ハードウェアが正しく接続されているかどうかを確認してください。 +SEC_PIN_CURRENT_BAD 現在の PIN コードが間違っています。 +SEC_PIN_CHANGE_FAILED PIN コードの変更に失敗しました。 +SEC_PIN_OK PIN コードを変更しました。 + + +# TCP 接続ダイアログ関係 +CONNECTDLG_CAPTION 接続中 +CONNECTDLG_MESSAGE サーバー "%S" (TCP ポート: %u) に接続しています... +CONNECTDLG_CANCELING 接続をキャンセルしています。しばらくお待ちください... + + +# NIC 情報ダイアログ関係 +NICINFO_1 VPN サーバーに接続しました。 +NICINFO_1_1 VPN 上の DHCP サーバーから IP アドレスを取得中... +NICINFO_1_2 VPN 内で使用する IP アドレスを決定中... + +NICINFO_2 VPN 通信が可能になりました。 +NICINFO_2_1 IP アドレス %S の割り当てが完了しました。 + +NICINFO_3 VPN 通信が可能になりました。 +NICINFO_3_1 IP アドレス %S が利用可能になりました。 + + +# ログイン時パスワード入力ダイアログ関係 +PW_RETRYCOUNT 入力が行われない場合、あと %u 秒後に自動的に再接続します... +PW_LOGIN_DLG_TITLE ログイン +PW_TYPE_0 匿名認証 +PW_TYPE_1 標準パスワード認証 +PW_TYPE_2 RADIUS または NT ドメイン認証 +PW_TYPE_3 クライアント証明書認証 +PW_TYPE_4 スマートカード認証 +PW_TYPE_5 Openssl Engine Authentication + +PW_MSG_PROXY プロキシサーバー %S でのユーザー認証に失敗しました。正しいユーザー名とパスワードを再入力してください。 +PW_TYPE_PROXY プロキシサーバー認証 + + +# VPN 接続ステータス関係 +STATUS_1 初期化中... +STATUS_2 VPN サーバー "%S" にプロキシサーバー %S 経由で接続しています... +STATUS_3 プロキシサーバー %S でユーザー認証をしています... +STATUS_4 VPN サーバー "%S" に接続しています... +STATUS_5 サーバー証明書を検証しています... +STATUS_6 ユーザー認証を行っています... +STATUS_7 VPN セッションを確立しています... +STATUS_8 クラスタ内の VPN サーバーに接続しています... +STATUS_9 VPN セッションの確立が完了しました。 + + +# 証明書ダイアログ関係 +CERT_NOT_FOUND この証明書を発行した証明機関の証明書が信頼できる証明書のリストから見つかりませんでした。 +CERT_ROOT この証明書はルート証明書 (自己署名証明書) です。 +CERT_LV_C1 フィールド +CERT_LV_C2 値 +CERT_SERIAL シリアル番号 +CERT_ISSUER 発行者 +CERT_SUBJECT サブジェクト +CERT_NOT_BEFORE 有効期限の開始 +CERT_NOT_AFTER 有効期限の終了 +CERT_BITS ビット数 +CERT_PUBLIC_KEY 公開鍵 +CERT_DIGEST_MD5 ダイジェスト (MD5) +CERT_DIGEST_SHA1 ダイジェスト (SHA-1) +CERT_NO_SERIAL シリアル番号はありません +CERT_BITS_FORMAT %u bits + + +# 証明書確認ダイアログ関係 +CC_DANGEROUS_MSG 前回、このサーバー (%S) に VPN 接続した際に保存されたサーバー証明書と、今回の接続の際にサーバーが提示しているサーバー証明書が一致しません。\r\n\r\n前回のダイジェスト値 (MD5) : %S\r\n前回のダイジェスト値 (SHA1): %S\r\n\r\n今回のダイジェスト値 (MD5) : %S\r\n今回のダイジェスト値 (SHA1): %S\r\n\r\nVPN Server 側の証明書がサーバー管理者によって変更された可能性がありますが、場合によっては、成り済ましなどの中間攻撃を受けている可能性もあります。\r\n接続しようとしている VPN Server の管理者に詳細を問い合わせることを強くお勧めします。 +CC_WARNING_MSG 現在接続しようとしている VPN Server のサーバー証明書を次回 %s に接続する際に自動的に信頼しますか?\r\n\r\nダイジェスト値 (SHA1): %S\r\nダイジェスト値 (MD5) : %S\r\n\r\nこのサーバー証明書が正しいものであるかどうか不安な場合は、上記のダイジェスト値をサーバー設置者に対して安全な方法で確認してください。\r\n\r\n[はい] をクリックすると、次回からこのサーバーに接続する際にこのサーバー証明書が提示された場合は、自動的に信頼します。\r\n[いいえ] をクリックすると、今回の接続のみ信頼し、次回の接続の際には再度警告のメッセージを表示します。\r\n[キャンセル] をクリックすると、セキュリティの警告画面に戻ります。\r\n\r\n※ この設定はアカウントごとに変更することができます。VPN クライアント接続マネージャのアカウントのプロパティで設定できます。 + + +# 接続失敗ダイアログ関係 +ERRDLG_ERRMSG エラー (エラーコード %u) :\r\n%s\r\n +ERRDLG_RETRYCOUNT 入力が行われない場合、あと %u 秒後に自動的に再接続します... +ERRDLG_INFORMATION [再試行] をクリックすると、再度接続を開始します。 +ERRDLG_RETRY_INFO_1 %u / %u 回目の再試行を行いますか? +ERRDLG_RETRY_INFO_2 %u 回目の再試行を行いますか? +ERRDLG_DISCONNECTED_MSG VPN Server "%S" への接続が切断されました。 +ERRDLG_DEVICE_ERROR 仮想 LAN カード (デバイス名: %S) が停止されたため、VPN Server との接続を切断しました。\r\n\r\nエラーコード %u: %s + + +# プロトコル関係 +PROTO_DIRECT_TCP 直接 TCP/IP 接続 +PROTO_HTTP_PROXY HTTP プロキシ経由接続 +PROTO_SOCKS_PROXY SOCKS4 プロキシ経由接続 +PROTO_SOCKS5_PROXY SOCKS5 プロキシ経由接続 +PROTO_SSH SSH サーバー経由接続 +PROTO_UNKNOWN 不明なプロトコル + + +# Windows のバージョンに関するエラー +WINVER_TITLE Windows のバージョンに関する警告 +WINVER_ERROR_FORMAT %sの Windows のバージョン (およびサービスパック番号) は「%S」です。\r\n\r\n%s が対応している Windows のバージョン (およびサービスパック番号) は以下のとおりです:\r\n%S\r\n\r\n%sの Windows のバージョンは、%s が対応している Windows のバージョンよりも新しいため、予期せぬ不具合や互換性の問題などが発生する可能性があります。\r\n予期せぬ不具合や互換性の問題などを避けるために、%s の更新版を入手しアップデートすることを推奨します。\r\n(アップデートせずにこのまま使用することは可能ですが、できるだけ早急にアップデートすることをお勧めいたします。)\r\n\r\nあなたがシステム管理者である場合は、%s の更新版アップデートパッチを、ソフトイーサ株式会社の Web サイト http://selinks.org/ から無料でダウンロードすることができます。\r\n\r\nあなたがシステム管理者でない場合は、この警告メッセージが表示された旨を VPN システムの管理者にお伝えください。\r\n\r\n----- MSG%04u%02u -----\r\n\r\n +WINVER_ERROR_VPNSERVER 接続先サーバーコンピュータの VPN Server +WINVER_ERROR_VPNBRIDGE 接続先サーバーコンピュータの VPN Bridge +WINVER_ERROR_VPNCLIENT このクライアントコンピュータの VPN Client +WINVER_ERROR_PC_LOCAL このクライアントコンピュータ +WINVER_ERROR_PC_REMOTE 接続先のサーバーコンピュータ + + +# オープンソース版に関する警告 +OSS_MSG はじめに - SoftEther VPN Server について\r\n\r\nこの VPN Server は、筑波大学において学術実験目的で開発され SoftEther プロジェクト http://www.softether.org/ で無償配布されているオープンソースのフリーソフトです。\r\nSoftEther VPN ソフトウェアは国立大学法人筑波大学とソフトイーサ株式会社との共同研究契約の一環として広く公開されているものです。SoftEther VPN ソフトウェアは学術実験目的で開発・公開されております。SoftEther VPN ソフトウェアに含まれる不具合等についてのサポート等は提供されておらず、利用者がすべての責任を負うことになります。本ソフトウェアの開発者・配布者は、SoftEther VPN ソフトウェアの利用の結果、利用者に生じる損失等について、一切責任を負いません。\r\n\r\nこれらのことに合意いただいた上で、SoftEther VPN Server を用いた通信をお楽しみください。\r\n\r\nSoftEther VPN について詳しくは http://www.softether.org/ をご参照ください。\r\n\r\n + + +# NAT Traversal に関する警告 +NATT_MSG ** NAT Traversal 接続 - 安定性低下の可能性があります **\r\n\r\nVPN Client は VPN Server '%S' に NAT トラバーサル (UDP ホールパンチング) モードで接続しました。\r\n\r\nNAT トラバーサルによって、VPN Client は NAT やファイアウォールの背後にある VPN Server に、それらの NAT やファイアウォールでのポートフォワーディングの設定を行うことなく接続することができます。\r\n\r\nしかし、NAT トラバーサルは UDP をベースとした通信を使用するため、VPN セッションが不安定になる原因となる場合があります。たとえば、安価な NAT ルータが VPN Server と VPN Client との間に存在する場合、NAT トラバーサル上の VPN トンネルは 5 分ごとに切断される場合があります。また、安価な ISP が大規模な NAT を使用している場合にも NAT トラバーサルは不安定になります。これはルータや ISP の品質の問題であり、SoftEther VPN の問題ではありません。\r\n\r\nこれを解決するためには、NAT トラバーサルを使用するのではなく、直接 TCP/IP によって VPN Server のリスナーポートに VPN Client が接続することができるようにします。そのためには、VPN Server のリスナーポートがインターネットに対して公開されるように、NAT におけるポートフォワーディング設定を行ってください。NAT におけるポートフォワーディング設定の方法は、NAT の管理者に問い合わせるか、NAT 製品の説明書をお読みください。\r\n\r\nVPN Server が TCP ポートをインターネットに対して公開しているにも関わらずこのメッセージが表示される場合は、VPN Client の接続設定画面で「NAT-T 無効」をチェックしてください。\r\n\r\n +NATT_MSG2 ** NAT Traversal 接続 - 安定性低下の可能性があります **\r\n\r\nVPN Client は VPN Server '%S' に NAT トラバーサル (UDP ホールパンチング) モードで接続しました。\r\n\r\nNAT トラバーサルによって、VPN Client は NAT やファイアウォールの背後にある VPN Server に、それらの NAT やファイアウォールでのポートフォワーディングの設定を行うことなく接続することができます。\r\n\r\nしかし、NAT トラバーサルは UDP をベースとした通信を使用するため、VPN セッションが不安定になる原因となる場合があります。たとえば、安価な NAT ルータが VPN Server と VPN Client との間に存在する場合、NAT トラバーサル上の VPN トンネルは 5 分ごとに切断される場合があります。また、安価な ISP が大規模な NAT を使用している場合にも NAT トラバーサルは不安定になります。これはルータや ISP の品質の問題であり、SoftEther VPN の問題ではありません。\r\n\r\nこれを解決するためには、NAT トラバーサルを使用するのではなく、直接 TCP/IP によって VPN Server のリスナーポートに VPN Client が接続することができるようにします。そのためには、VPN Server のリスナーポートがインターネットに対して公開されるように、NAT におけるポートフォワーディング設定を行ってください。NAT におけるポートフォワーディング設定の方法は、NAT の管理者に問い合わせるか、NAT 製品の説明書をお読みください。\r\n\r\nVPN Server が TCP ポートをインターネットに対して公開しているにも関わらずこのメッセージが表示される場合は、VPN Client のバージョンを Build 9428 以降にアップグレードしてから、VPN Client の接続設定画面で「NAT-T 無効」をチェックしてください。\r\n\r\n + + +# 仮想 HUB 管理オプション関係 +HUB_AO_CLICK 項目名を 1 つ選択すると、その項目名に関する説明文が表示されます。 +HUB_AO_UNKNOWN この項目に関する説明文が見つかりませんでした。ドキュメント等を参照するか、項目名をもとに意味・内容を推測して利用してください。 +HUB_AO_allow_hub_admin_change_option この項目は特殊です。この項目が 1 (有効) の場合は、VPN Server 全体の管理者だけでなく仮想 HUB の管理者も自ら仮想 HUB 管理オプションを変更することができるようになります。 +HUB_AO_deny_hub_admin_change_ext_option この項目が 1 (有効) の場合は、仮想 HUB の管理者は仮想 HUB の拡張オプションの設定を変更することができなくなり、VPN Server 全体の管理者のみが仮想 HUB の拡張オプションの設定を変更することができるようになります。 +HUB_AO_no_delay_jitter_packet_loss この項目が 1 以上に設定されている場合は、仮想 HUB のアクセスリストを追加する際に遅延・ジッタ・パケットロスを生成させるためのパラメータが設定されている場合であっても、それらの値をすべて削除します。これにより、遅延・パケットロス生成機能が実質的に無効になります。遅延・パケットロス生成機能は VPN Server の CPU およびメモリ使用率を高くする可能性があるため、多くのユーザーで共有する仮想 HUB の場合は、高負荷を避けるためにこのオプションを使用してください。 +HUB_AO_max_users この項目が 1 以上に設定されている場合は、仮想 HUB に登録できるユーザーの最大数がこの項目の指定数に制限され、それ以上のユーザーオブジェクトを登録することはできなくなります。 +HUB_AO_max_multilogins_per_user この項目が 1 以上に設定されている場合は、仮想 HUB に登録されている 1 個のユーザーオブジェクトに対して同時にログインし接続可能な VPN セッション数がこの項目の指定数に制限され、それ以上の VPN セッションが同一のユーザーオブジェクトを用いて VPN サーバーに接続することができなくなります。 +HUB_AO_max_groups この項目が 1 以上に設定されている場合は、仮想 HUB に登録できるグループの最大数がこの項目の指定数に制限され、それ以上のグループオブジェクトを登録することはできなくなります。 +HUB_AO_max_accesslists この項目が 1 以上に設定されている場合は、仮想 HUB に登録できるアクセスリスト項目の最大数がこの項目の指定数に制限され、それ以上のアクセスリスト項目を登録することはできなくなります。 +HUB_AO_max_sessions_client_bridge_apply この項目が 1 以上に設定されている場合のみ、max_sessions_client および max_sessions_bridge の値が適用されます。 +HUB_AO_max_sessions この項目が 1 以上に設定されている場合は、仮想 HUB に接続できる VPN セッション数がこの項目の指定数に制限され、それ以上の VPN 接続を同時に処理することはできなくなります。 +HUB_AO_max_sessions_client この項目が 1 以上に設定されている場合は、仮想 HUB に接続できる VPN クライアントセッション数がこの項目の指定数に制限され、それ以上の VPN 接続を同時に処理することはできなくなります。この項目は、max_sessions_client_bridge_apply が 1 以上に設定されている場合のみ有効です。 +HUB_AO_max_sessions_bridge この項目が 1 以上に設定されている場合は、仮想 HUB に接続できる VPN ブリッジセッション数がこの項目の指定数に制限され、それ以上の VPN 接続を同時に処理することはできなくなります。この項目は、max_sessions_client_bridge_apply が 1 以上に設定されている場合のみ有効です。 +HUB_AO_max_bitrates_download この項目が 1 以上に設定されている場合は、仮想 HUB に接続するすべての VPN セッションのセキュリティポリシーのうち [ダウンロード帯域幅] ポリシーの値がこの項目の指定数に強制的に変更され、セッションのダウンロード速度が制限されます。たとえば、この値が 1000000 になっている場合は、この仮想 HUB に対するいかなる VPN 接続セッションでもそのダウンロード通信速度は 1 Mbps を超えることはできなくなります。 +HUB_AO_max_bitrates_upload この項目が 1 以上に設定されている場合は、仮想 HUB に接続するすべての VPN セッションのセキュリティポリシーのうち [アップロード帯域幅] ポリシーの値がこの項目の指定数に強制的に変更され、セッションのアップロード速度が制限されます。たとえば、この値が 1000000 になっている場合は、この仮想 HUB に対するいかなる VPN 接続セッションでもそのアップロード通信速度は 1 Mbps を超えることはできなくなります。 +HUB_AO_deny_empty_password この項目が 1 (有効) の場合は、仮想 HUB に登録されているユーザーに空のパスワードを設定することはできなくなります。もし空のパスワードが設定されているユーザーがいる場合は、そのユーザーは VPN 接続を行うことはできません (例外として、localhost からの接続は可能です)。 +HUB_AO_deny_bridge この項目が 1 (有効) の場合は、仮想 HUB に対して接続されるセッションは、接続時のユーザーのセキュリティポリシーの内容にかかわらず常にブリッジが禁止されます。したがって、この仮想 HUB にブリッジ目的で接続することができなくなります。 +HUB_AO_deny_routing この項目が 1 (有効) の場合は、仮想 HUB に対して接続されるセッションは、接続時のユーザーのセキュリティポリシーの内容にかかわらず常にルータ動作が禁止されます。したがって、この仮想 HUB にルーティング目的で接続することができなくなります。 +HUB_AO_deny_qos この項目が 1 (有効) の場合は、仮想 HUB に対して接続されるセッションは、接続時のユーザーのセキュリティポリシーの内容にかかわらず常に QoS 機能が禁止されます。 +HUB_AO_deny_change_user_password この項目が 1 (有効) の場合は、仮想 HUB のユーザーが「パスワード認証」モードの場合、自分でパスワードを変更することができなくなります。 +HUB_AO_no_change_users この項目が 1 (有効) の場合は、仮想 HUB の管理者は仮想 HUB に新しいユーザーを追加したり、既存のユーザーを削除または編集したりすることができなくなります。 +HUB_AO_no_change_groups この項目が 1 (有効) の場合は、仮想 HUB の管理者は仮想 HUB に新しいグループを追加したり、既存のグループを削除または編集したりすることができなくなります。 +HUB_AO_no_securenat この項目が 1 (有効) の場合は、仮想 HUB の管理者は SecureNAT 機能を有効または無効にすることができなくなります。 +HUB_AO_no_securenat_enablenat この項目が 1 (有効) の場合は、仮想 HUB の管理者は SecureNAT 機能における仮想 NAT 機能を有効または無効にすることができなくなります。 +HUB_AO_no_securenat_enabledhcp この項目が 1 (有効) の場合は、仮想 HUB の管理者は SecureNAT 機能における仮想 DHCP サーバー機能を有効または無効にすることができなくなります。 +HUB_AO_no_cascade この項目が 1 (有効) の場合は、仮想 HUB の管理者はカスケード接続を作成・削除・編集またはオンライン化 / オフライン化することができなくなります。 +HUB_AO_no_online この項目が 1 (有効) の場合は、仮想 HUB の管理者はオフライン状態の仮想 HUB をオンライン化することができなくなります。 +HUB_AO_no_offline この項目が 1 (有効) の場合は、仮想 HUB の管理者はオンライン状態の仮想 HUB をオフライン化することができなくなります。 +HUB_AO_no_change_log_config この項目が 1 (有効) の場合は、仮想 HUB の管理者は仮想 HUB のログファイルの保存設定を変更することができなくなります。 +HUB_AO_no_disconnect_session この項目が 1 (有効) の場合は、仮想 HUB の管理者は仮想 HUB に接続されている VPN セッションを指定して強制切断することができなくなります。 +HUB_AO_no_delete_iptable この項目が 1 (有効) の場合は、仮想 HUB の管理者は仮想 HUB の IP アドレステーブルデータベースから IP アドレスエントリを指定して削除することができなくなります。 +HUB_AO_no_delete_mactable この項目が 1 (有効) の場合は、仮想 HUB の管理者は仮想 HUB の MAC アドレステーブルデータベースから MAC アドレスエントリを指定して削除することができなくなります。 +HUB_AO_no_enum_session この項目が 1 (有効) の場合は、仮想 HUB の管理者は仮想 HUB に現在接続している VPN セッションの一覧を列挙できなくなります。 +HUB_AO_no_query_session この項目が 1 (有効) の場合は、仮想 HUB の管理者は仮想 HUB に現在接続している VPN セッションを指定して、そのセッションに関する詳細情報を取得することができなくなります。 +HUB_AO_no_change_admin_password この項目が 1 (有効) の場合は、仮想 HUB の管理者は仮想 HUB の管理者パスワードを変更できなくなります。 +HUB_AO_no_change_log_switch_type この項目が 1 (有効) の場合は、仮想 HUB の管理者は仮想 HUB のログファイルの保存設定のうち、[ログファイルの切り替え周期] 設定項目を変更できなくなります。 +HUB_AO_no_change_access_list この項目が 1 (有効) の場合は、仮想 HUB の管理者は仮想 HUB のアクセスリストを操作することができなくなります。 +HUB_AO_no_change_access_control_list この項目が 1 (有効) の場合は、仮想 HUB の管理者は仮想 HUB のアクセス元 IP 制限リストを操作することができなくなります。 +HUB_AO_no_change_cert_list この項目が 1 (有効) の場合は、仮想 HUB の管理者は仮想 HUB の「信頼する証明機関の証明書一覧」リストを操作することができなくなります。 +HUB_AO_no_change_crl_list この項目が 1 (有効) の場合は、仮想 HUB の管理者は仮想 HUB の「無効な証明書」リストを操作することができなくなります。 +HUB_AO_no_read_log_file この項目が 1 (有効) の場合は、仮想 HUB の管理者は仮想 HUB のログファイルを管理接続を通じて列挙したり、リモートから読み出したりすることができなくなります。 +HUB_AO_no_change_msg この項目が 1 (有効) の場合は、仮想 HUB の管理者は仮想 HUB に VPN Client が接続する際に VPN Client に表示されるべきメッセージを設定することができなくなります。 +HUB_AO_no_access_list_include_file この項目が 1 (有効) の場合は、仮想 HUB の管理者は仮想 HUB にアクセスリストを追加する際に送信元または宛先ユーザー名として "include:" または "exclude:" 指定でユーザー名リストファイルを指定することができなくなります。 + + +# 仮想 HUB 拡張オプション関係 +HUB_AO_NoAddressPollingIPv4 この項目が 1 (有効) の場合は、通常、仮想 HUB が 5 秒ごとに実施するセグメント内の MAC アドレステーブルおよび IPv4 アドレステーブルのメンテナンス (IPv4 デバイスの生存確認のための ARP パケットの送信) を実施しないようになります。一定時間無通信の IPv4 デバイスは、仮想 HUB のセグメントに存在していても、一定時間 (1 分~ 10 分間) でテーブルから消去されるようになります。これによりブロードキャストパケット数を削減することができますが、いくつかの IPv4 関係のセキュリティポリシーが実質的に機能しなくなることがあります。 +HUB_AO_NoAddressPollingIPv6 この項目が 1 (有効) の場合は、通常、仮想 HUB が 5 秒ごとに実施するセグメント内の MAC アドレステーブルおよび IPv6 アドレステーブルのメンテナンス (IPv6 デバイスの生存確認のための ICMPv6 パケットの送信) を実施しないようになります。一定時間無通信の IPv6 デバイスは、仮想 HUB のセグメントに存在していても、一定時間 (1 分~ 10 分間) でテーブルから消去されるようになります。これによりブロードキャストパケット数を削減することができますが、いくつかの IPv6 関係のセキュリティポリシーが実質的に機能しなくなることがあります。 +HUB_AO_NoIpTable この項目が 1 (有効) の場合は、仮想 HUB は IP アドレステーブルを内部的に自動構築しないようになります。これにより VPN Server の CPU およびメモリの使用量を削減することができますが、いくつかの IP 関係のセキュリティポリシーが実質的に機能しなくなることがあります。 +HUB_AO_NoMacAddressLog この項目が 1 (有効) の場合は、仮想 HUB は、仮想 HUB の MAC アドレステーブルに新しい MAC アドレスが登録された場合のログをセキュリティログに書きこまないようになります。 +HUB_AO_ManageOnlyPrivateIP この項目が 1 (有効) の場合は、仮想 HUB が内部的に構築する IPv4 アドレステーブルにはプライベート IPv4 アドレスのみが格納されるようになります。ここでのプライベート IPv4 アドレスとは、10.0.0.0/8, 172.16.0.0/12, 192.168.0.0/16, 169.254.0.0/16 を意味します。それ以外の IPv4 アドレスは IPv4 アドレステーブルに格納されないようになります。 +HUB_AO_ManageOnlyLocalUnicastIPv6 この項目が 1 (有効) の場合は、仮想 HUB が内部的に構築する IPv6 アドレステーブルにはローカルユニキャスト IPv6 アドレスのみが格納されるようになります。ここでのローカルユニキャスト IPv6 アドレスとは、fe80::/10 を意味します。それ以外の IPv6 アドレスは IPv6 アドレステーブルに格納されないようになります。 +HUB_AO_DisableIPParsing この項目が 1 (有効) の場合は、仮想 HUB は内部的にすべての Ethernet パケットの IP ヘッダを解釈しないようになります。これにより VPN Server の CPU およびメモリの使用量を削減することができますが、仮想 HUB は IP アドレステーブルを内部的に自動構築しないようになり、いくつかの IP 関係のセキュリティポリシーが実質的に機能しなくなることがあります。 +HUB_AO_YieldAfterStorePacket この項目が 1 (有効) の場合は、仮想 HUB はある VPN セッションからパケットを受け取った後、そのパケットを他の VPN セッションにストア・フォワードした直後に一旦 CPU を待機状態に設定します。これによりパケットの遅延が若干短くなる可能性がありますが、スレッドコンテキストスイッチ回数が増加することによりパフォーマンスが低下する可能性もあります。 +HUB_AO_FilterPPPoE この項目が 1 (有効) の場合は、仮想 HUB はすべての PPPoE (PPP over Ethernet) パケットを破棄し、転送しないようにします。複数の LAN 同士をブリッジ接続する場合で、両方の PPPoE セグメントを分割したい場合に便利です。 +HUB_AO_FilterOSPF この項目が 1 (有効) の場合は、仮想 HUB はすべての OSPF (Open Shortest Path First) パケットを破棄し、転送しないようにします。 +HUB_AO_FilterIPv4 この項目が 1 (有効) の場合は、仮想 HUB はすべての IPv4 パケットおよび ARP パケットを破棄し、転送しないようにします。 +HUB_AO_FilterIPv6 この項目が 1 (有効) の場合は、仮想 HUB はすべての IPv6 パケットを破棄し、転送しないようにします。 +HUB_AO_FilterNonIP この項目が 1 (有効) の場合は、仮想 HUB はすべての非 IP パケット (IPv4, ARP, IPv6 以外の種類のパケット) を破棄し、転送しないようにします。なお、仮想 HUB を通過するすべてのタグ VLAN パケットは非 IP パケットとしてみなされます。 +HUB_AO_FilterBPDU この項目が 1 (有効) の場合は、仮想 HUB はすべての BPDU (Bridge Protocol Data Unit) パケットを破棄し、転送しないようにします。これにより、すべてのスパニング・ツリーパケットが伝送されなくなります。 +HUB_AO_NoIPv6DefaultRouterInRAWhenIPv6 この項目が 1 (有効) の場合は、仮想 HUB に対して接続されるすべての VPN セッションは [IPv6 ルータ広告からデフォルトルータ指定を削除 (IPv6 物理接続時自動有効化)] ポリシーが自動的に有効になります。VPN Client または VPN Bridge から VPN Server に対する接続および通信に利用する物理的なプロトコルが IPv6 の場合には、その VPN セッションに対して、仮想 HUB の他のセッションの IPv6 ルータが発信する IPv6 ルータ広告メッセージのルータ有効期間の値が 0 以外の数値の場合、この値を強制的に 0 に書き換えて伝送します。これにより、VPN クライアントコンピュータが VPN 接続した先のネットワークに存在するルータをデフォルトルータとして利用することにより物理的な IPv6 通信が途切れてしまう誤作動を防止することができます。 +HUB_AO_NoLookBPDUBridgeId この項目が 1 (有効) の場合は、仮想 HUB は BPDU (Bridge Protocol Data Unit) パケットの内容をもとに MAC アドレステーブルを構築する際に BPDU パケット内のフィールドに記載されている送信元 MAC アドレスを無視し、Ethernet ヘッダに記載されている送信元 MAC アドレスをもとに MAC アドレステーブルを構築します。この値はネットワークに非常に詳しい方以外は変更しないでください。 +HUB_AO_NoManageVlanId この項目が 1 (有効) の場合は、仮想 HUB は MAC アドレステーブルの構築および検索において VLAN ID を管理しないようにし、すべての Ethernet パケットの VLAN タグを無視します。 +HUB_AO_VlanTypeId VLAN タグの Ethernet Type ID (TPID) の値を 10 進数で指定します。この値はデフォルトでは 33024 (16 進数で 0x8100) です。この値はネットワークに非常に詳しい方以外は変更しないでください。 +HUB_AO_FixForDLinkBPDU この項目が 1 (有効) の場合は、FixForDLinkBPDU オプションが有効になります。この値はネットワークに非常に詳しい方以外は変更しないでください。 +HUB_AO_NoIPv4PacketLog この項目が 1 (有効) の場合は、仮想 HUB を流れるすべての IPv4 パケットに関するパケットログが保存されないようになります。 +HUB_AO_NoIPv6PacketLog この項目が 1 (有効) の場合は、仮想 HUB を流れるすべての IPv6 パケットに関するパケットログが保存されないようになります。 +HUB_AO_NoSpinLockForPacketDelay この項目が 1 (有効) の場合は、仮想 HUB のアクセスリストによってパケットに遅延を発生させる場合において、遅延時間を高精細にシミュレーションするためにスピンロックを使用せず、OS によるタイマ割り込みによって遅延を発生させるようにします。これにより CPU 使用率が低下しますが、発生させることができる遅延の精度は低くなります。 +HUB_AO_BroadcastStormDetectionThreshold 大量のブロードキャストパケットが仮想 HUB に同一のセッションから投入された場合に、ブロードキャストストームであると判定するための閾値を指定します。1 秒間あたりのパケット個数を指定します。指定しない場合 (0 の場合) は 32 が使用されます。 +HUB_AO_ClientMinimumRequiredBuild この項目が 1 以上に設定されている場合は、設定されている数値よりもビルド番号が小さい VPN Client が接続してきた場合に VPN 接続を拒否します。 +HUB_AO_RequiredClientId この項目が 1 (有効) の場合は、この整数と同一の「クライアント ID」が埋め込まれている VPN Client ソフトウェアだけがこの仮想 HUB に接続でき、それ以外の VPN Client は接続できなくなります。 +HUB_AO_AdjustTcpMssValue この項目が 1 (有効) の場合は、この仮想 HUB を経由して通信が行われるすべての TCP/IP パケットの MSS (Max Segment Size) をこの項目で指定したバイト数以下になるように自動調整します。 +HUB_AO_DisableAdjustTcpMss この項目が 1 (有効) の場合は、この仮想 HUB におけるいかなる MSS (Max Segment Size) も無効にします。AdjustTcpMssValue オプションが指定されている場合や、IPsec / L2TP / EtherIP / L2TPv3 サーバー機能によって受け付けた VPN 通信が行われる場合においても、MSS の調整は行われなくなります。 +HUB_AO_NoDhcpPacketLogOutsideHub この項目が 1 (有効) の場合は、仮想 HUB 内に到達した DHCP による IP アドレス割当パケットのうち、この仮想 HUB に接続されているセッションと無関係のものについてログを保存しないようにします。 +HUB_AO_DisableHttpParsing この項目が 1 (有効) の場合は、仮想 HUB は内部的にすべての HTTP パケットの HTTP ヘッダを解釈しないようになります。これにより VPN Server の CPU およびメモリの使用量を削減することができますが、HTTP アクセスログが保存されなくなります。 +HUB_AO_DisableUdpAcceleration この項目が 1 (有効) の場合は、この仮想 HUB に対して接続されるすべての VPN セッションにおいて UDP 高速化機能の使用を禁止します。 +HUB_AO_DisableUdpFilterForLocalBridgeNic この項目が 1 (有効) の場合は、仮想 HUB 内で作成されるローカルブリッジを構成する物理的な LAN カードが VPN を経由して遠隔地の DHCP サーバーから IP アドレスの割当を受けることで動作が不安定になる問題を解決するための DHCP パケットフィルタリング動作を無効にします。 +HUB_AO_ApplyIPv4AccessListOnArpPacket この項目が 1 (有効) の場合は、仮想 HUB 内で定義されている IPv4 アクセスリストのルールを ARP パケットにも適用します。不要な ARP 要求パケットを遮断したい場合に便利です。 +HUB_AO_RemoveDefGwOnDhcpForLocalhost この項目が 1 (有効) の場合は、DHCP サーバーが仮想 HUB に接続された VPN クライアントに IP アドレスを割当てる際に、当該 VPN クライアントが VPN Server が動作しているコンピュータと同一である場合は DHCP 応答パケットからデフォルトゲートウェイの指定を削除します。これにより、意図しない無限ループを防止することができます。 +HUB_AO_SecureNAT_MaxTcpSessionsPerIp この項目が 0 以外に設定されている場合は、SecureNAT 機能を利用する VPN クライアント 1 台あたりの TCP コネクション数 (SYN_SENT 状態以外の TCP コネクション) のこの項目で指定した数に制限されます。 +HUB_AO_SecureNAT_MaxTcpSynSentPerIp この項目が 0 以外に設定されている場合は、SecureNAT 機能を利用する VPN クライアント 1 台あたりの TCP コネクション数 (SYN_SENT 状態の TCP コネクション) のこの項目で指定した数に制限されます。 +HUB_AO_SecureNAT_MaxUdpSessionsPerIp この項目が 0 以外に設定されている場合は、SecureNAT 機能を利用する VPN クライアント 1 台あたりの UDP セッション数のこの項目で指定した数に制限されます。 +HUB_AO_SecureNAT_MaxDnsSessionsPerIp この項目が 0 以外に設定されている場合は、SecureNAT 機能を利用する VPN クライアント 1 台あたりの DNS セッション数のこの項目で指定した数に制限されます。 +HUB_AO_SecureNAT_MaxIcmpSessionsPerIp この項目が 0 以外に設定されている場合は、SecureNAT 機能を利用する VPN クライアント 1 台あたりの ICMP セッション数のこの項目で指定した数に制限されます。 +HUB_AO_AccessListIncludeFileCacheLifetime 仮想 HUB のアクセスリストのエントリにユーザー名が "include:" または "exclude:" 形式で指定されており、外部ファイルを参照している場合、当該外部ファイルを読み込んでからメモリにキャッシュする時間を秒単位で指定します。 +HUB_AO_DisableKernelModeSecureNAT この項目が 1 (有効) の場合は、SecureNAT 機能におけるカーネルモード NAT を無効にします。カーネルモード NAT は、SecureNAT の仮想 NAT 機能の動作速度を高速化するための機能であり、VPN Server プロセスがシステム権限で動作している場合に使用できます。カーネルモード NAT が原因で何らかの通信障害が発生した場合はこのオプションを使用してカーネルモード NAT を無効にしてください。 +HUB_AO_DisableUserModeSecureNAT この項目が 1 (有効) の場合は、SecureNAT 機能におけるユーザーモード NAT を無効にします。ユーザーモード NAT は、SecureNAT の仮想 NAT 機能を一般ユーザー権限で動作させるための機能であり、VPN Server プロセスが一般ユーザー権限で動作している場合でも使用できます。 +HUB_AO_DisableCheckMacOnLocalBridge この項目が 1 (有効) の場合は、ローカルブリッジ機能において MAC アドレスの重複チェックを無効にします。一部の LAN カードでは、ローカルブリッジ機能によって送出されたパケットが LAN カード内部で反射し仮想 HUB に戻ってくる場合があります。この場合、仮想 HUB は MAC アドレスの重複を自動的に検出し、反射してきたパケットを破棄します。このフラグを有効にすると、この検出チェックが無効になります。 +HUB_AO_DisableCorrectIpOffloadChecksum この項目が 1 (有効) の場合は、ローカルブリッジ機能において IP チェックサムの検査および補正処理が無効になります。IP, TCP, UDP ヘッダのチェックサムのオフロード機能が搭載されている LAN カードから送信された IP パケットが同一ホスト上で動作する VPN Server のローカルブリッジに入力された場合、当該 IP パケットのチェックサムは不正確な値が代入されている場合があります。ローカルブリッジはデフォルトでその不正確な値を検出し、正しいチェックサムの計算結果を代入します。このフラグを有効にすると、これらの補正処理が無効になります。 +HUB_AO_BroadcastLimiterStrictMode この項目が 1 (有効) の場合は、仮想 HUB 上のセッションにおけるブロードキャストストームの検出アルゴリズムにおいて、送信元 IP アドレスまたは宛先 IP アドレスのいずれか 1 個が一致していれば既存の検出用記録とヒットしたとみなします。 +HUB_AO_MaxLoggedPacketsPerMinute 1 分間あたりにパケットログに保存することができる最大のパケット数を指定します。 +HUB_AO_DoNotSaveHeavySecurityLogs 保存に負荷がかかるセキュリティログを保存しない設定をします。 +HUB_AO_DropBroadcastsInPrivacyFilterMode 送信元および宛先の両方のセッションがプライバシーフィルタモードの場合、ブロードキャストパケットを破棄します。 +HUB_AO_DropArpInPrivacyFilterMode 送信元および宛先の両方のセッションがプライバシーフィルタモードの場合、ARP パケットを破棄します。 +HUB_AO_SuppressClientUpdateNotification VPN Client のアップデート通知画面の表示を抑制します。 +HUB_AO_FloodingSendQueueBufferQuota パケットの仮想 HUB 内におけるフラッディング動作時において消費することを許容する送信キューのバッファサイズの制限値 (バイト数) を指定します。クオータは、すべての接続中の VPN セッションの送信キューの合計長さに対してグローバルに適用されます。0 を指定すると無制限になります。このオプションは、フラッディングパケットが多発するネットワークにおいてメモリ消費量が増大する問題を解決するために利用できます。 +HUB_AO_AssignVLanIdByRadiusAttribute VLAN ID の動的割り当て機能を有効にします。VPN 接続するユーザーオブジェクトのセキュリティポリシーに VLAN ID が指定されていない場合は、各 VPN セッションはユーザー認証を行った RADIUS サーバーから返却される RADIUS 属性の値に基づき VLAN が割当てられます。RADIUS 属性のうち、 "Tunnel-Pvt-Group-ID" (ID = 81) の値が使用されます。データ型は文字列である必要があります。 +HUB_AO_DenyAllRadiusLoginWithNoVlanAssign この項目が 1 (有効) の場合は、RADIUS サーバーが "Tunnel-Pvt-Group-ID" (ID = 81) の値を返却しなかった場合は VPN 接続が拒否されます。(AssignVLanIdByRadiusAttribute の値が 1 の場合に限ります。) +HUB_AO_SecureNAT_RandomizeAssignIp この項目が 1 (有効) の場合は、SecureNAT 機能における仮想 DHCP サーバーは、DHCP クライアントに対して割当てる IP アドレスを指定された IP アドレスプール内の未使用アドレスからランダムに選択するようになります。なお、既定の動作は、未使用アドレスのうち最初のアドレスを割当てるようになっています。 +HUB_AO_DetectDormantSessionInterval この項目が 0 以外の場合は、指定された秒数無通信であった VPN セッションをドーマント状態 (休止状態) として識別します。ドーマント状態の VPN セッションに対しては、仮想 HUB 内でフラッディングされるべきパケットがフラッディングされなくなります。 +HUB_AO_NoPhysicalIPOnPacketLog この項目が 1 (有効) の場合は、パケットログに送信元および宛先 VPN セッションの物理的な接続元 VPN クライアントの IP アドレスが記録されないようになります。 +HUB_AO_UseHubNameAsDhcpUserClassOption この項目が 1 (有効) の場合は、仮想 HUB は DHCP サーバーに対して IP アドレスの取得を要求する際に仮想 HUB 名を DHCP パケットの "User-Class" オプションに埋め込むようになります。この機能は、複数の仮想 HUB がある場合に、DHCP サーバーがそれぞれの仮想 HUB 用に IP プールを確保する場合に便利です。(L2TP/IPsec および OpenVPN セッションのみ対応。) +HUB_AO_UseHubNameAsRadiusNasId この項目が 1 (有効) の場合は、NAS-Identifier RADIUS 属性に仮想 HUB 名が埋め込まれます。この機能は、RADIUS サーバにおいて仮想 HUB ごとにアクセスの許可 / 拒否を設定したい場合に便利です。 + + +# Caps 関係 +# (制御文字) +CAPS_YES はい +CAPS_NO いいえ +# (タイトル) +CT_i_max_packet_size 最大 Ethernet パケットサイズ +CT_i_max_hubs 最大仮想 HUB 数 +CT_i_max_user_creation 最大作成可能ユーザー数 +CT_i_max_sessions 最大同時接続可能セッション数 +CT_i_max_clients 最大クライアントセッション数 +CT_i_max_bridges 最大ブリッジセッション数 +CT_i_max_users_per_hub 登録可能な最大ユーザー数 / 仮想 HUB +CT_i_max_groups_per_hub 登録可能な最大グループ数 / 仮想 HUB +CT_i_max_access_lists 登録可能な最大アクセスリスト数 / 仮想 HUB +CT_i_max_mac_tables MAC アドレステーブル最大サイズ / 仮想 HUB +CT_i_max_ip_tables IP アドレステーブル最大サイズ / 仮想 HUB +CT_i_max_secnat_tables SecureNAT テーブル最大サイズ / 仮想 HUB +CT_i_max_l3_sw 登録可能な最大仮想レイヤ 3 スイッチ数 +CT_i_max_l3_if 登録可能な最大仮想インターフェイス数 / レイヤ 3 スイッチ +CT_i_max_l3_table 登録可能な最大ルーティングテーブル数 / レイヤ 3 スイッチ +CT_b_bridge VPN Bridge ソフトウェアとして動作 +CT_b_standalone スタンドアロンモード +CT_b_cluster_controller クラスタコントローラモード +CT_b_cluster_member クラスタメンバモード +CT_b_vpn_client_connect VPN Client / Bridge から接続が可能 +CT_b_local_bridge ローカルブリッジ機能が使用可能 +CT_b_must_install_pcap パケットキャプチャドライバが未インストール +CT_b_tap_supported tun/tap が使用可能 (Linux のみ) +CT_b_support_config_hub 仮想 HUB の設定の変更が可能 +CT_b_support_securenat SecureNAT 機能が使用可能 +CT_b_virtual_nat_disabled 仮想 NAT 機能は無効 (仮想 DHCP 機能のみ有効) +CT_b_support_cascade カスケード接続が使用可能 +CT_b_support_cascade_cert カスケード接続時にサーバー認証が使用可能 +CT_b_support_config_log ログ保存設定の変更が可能 +CT_b_support_autodelete ログファイルの自動削除が使用可能 +CT_b_support_radius 外部認証サーバーによる認証設定が可能 +CT_b_support_config_rw リモートで Config ファイルの読み書きが可能 +CT_b_support_hub_admin_option 仮想 HUB の管理オプションが設定可能 +CT_b_support_cascade_client_cert カスケード接続時にクライアント証明書が使用可能 +CT_b_support_hide_hub 匿名ユーザーへの仮想 HUB の列挙を禁止することが可能 +CT_b_support_cluster_admin 複数サーバーに分散したクラスタの統合管理が可能 +CT_b_support_cluster クラスタの一部として動作可能 +CT_b_support_cluster_controller クラスタコントローラとして動作中 +CT_b_support_layer3 仮想レイヤ 3 スイッチ機能をサポート +CT_b_support_crl 無効な証明書の一覧を仮想 HUB ごとに設定可能 +CT_b_support_ac 接続元 IP 制限リストを仮想 HUB ごとに設定可能 +CT_b_support_read_log ログファイルのダウンロードが可能 +CT_b_support_rename_cascade カスケード接続設定の名前の変更が可能 +CT_b_support_license ライセンス管理が可能 +CT_b_support_limit_multilogin 同一ユーザーの多重ログイン数の制限を設定可能 +CT_b_support_qos VoIP / QoS 対応機能が利用可能 +CT_b_support_syslog syslog 機能が利用可能 +CT_b_cluster_hub_type_fixed クラスタ内の仮想 HUB の種類が固定されている +CT_b_beta_version ベータ版 (プレリリースビルド) である +CT_b_support_check_mac アクセスリストで MAC アドレスを指定可能 +CT_b_support_check_tcp_state TCP コネクションの状態でパケットフィルタリングが可能 +CT_b_support_network_connection_name 物理的な LAN カードの別名を取得することが可能 +CT_b_support_radius_retry_interval_and_several_servers RADIUS 認証で再試行間隔および複数サーバー指定が可能 +CT_b_support_vlan MAC アドレステーブルでタグ VLAN の ID を管理可能 +CT_b_support_hub_ext_options 仮想 HUB 拡張オプションをサポート +CT_b_support_policy_ver_3 セキュリティポリシー バージョン 3.0 をサポート +CT_b_support_ipv6_acl IPv6 アクセスリストをサポート +CT_b_support_ex_acl アクセスリストで遅延・ジッタ・パケットロスの設定をサポート +CT_b_support_acl_group アクセスリストでグループ名による条件の指定をサポート +CT_b_support_ipv6_ac IPv6 接続元 IP 制限リストをサポート +CT_b_support_eth_vlan タグ VLAN パケット透過設定ツールをサポート +CT_b_support_msg 仮想 HUB への VPN 接続時のメッセージ表示機能をサポート +CT_b_vpn3 内部バージョン 3.0 の新機能 +CT_b_vpn4 内部バージョン 4.0 の新機能 +CT_b_support_ipsec IPsec / L2TP / EtherIP / L2TPv3 サーバー機能 +CT_b_support_sstp MS-SSTP VPN サーバー機能 +CT_b_support_udp_acceleration UDP アクセラレーション機能 +CT_b_support_openvpn OpenVPN サーバー機能 +CT_b_support_ddns ダイナミック DNS クライアント機能 +CT_b_support_ddns_proxy DDNS クライアントのプロキシサーバー経由の接続 +CT_b_support_special_listener VPN over ICMP および VPN over DNS 接続の受付け +CT_b_support_redirect_url_acl アクセスリストで HTTP の URL リダイレクト機能をサポート +CT_b_is_in_vm VM (仮想マシン) 内で動作中 +CT_b_support_azure VPN Azure 機能が利用可能 +CT_b_support_aes_ni CPU AES Acceleration (AES-NI) が動作中 +CT_b_using_selow_driver SoftEther 軽量カーネルモード Ethernet ドライバを使用中 +CT_b_support_vgs VPN Gate サービス サーバー機能が利用可能 +CT_b_support_vgs_in_client VPN Gate サービス サーバー機能 (VPN Client 統合) +CT_b_is_softether 無償版またはオープンソース版の SoftEther VPN である +CT_b_suppport_push_route 静的ルーティングテーブルのプッシュ機能 +CT_b_suppport_push_route_config 静的ルーティングテーブルのプッシュ機能 (設定可) + + +# ポリシー関係 +POL_TITLE_STR ポリシー名 +POL_VALUE_STR ポリシー設定値 +POL_TYPE_BOOL ON / OFF 型 +POL_TYPE_INT 整数値型 +POL_BOOL_ENABLE 有効 +POL_BOOL_DISABLE - +POL_BOOL_DISABLE_EX - +POL_INT_ZERO - +POL_INT_COUNT %u 個 +POL_INT_SEC %u 秒 +POL_INT_BPS %u bps +POL_INT_VLAN %u + +# Ver 2.0 +POL_0 アクセスを許可 +POL_EX_0 このポリシーが設定されているユーザーは、VPN Server に VPN 接続することを許可されます。 +POL_1 DHCP パケットをフィルタリング (IPv4) +POL_EX_1 このポリシーが設定されているセッションにおける IPv4 における DHCP パケットをすべてフィルタリングします。 +POL_2 DHCP サーバーの動作を禁止 (IPv4) +POL_EX_2 このポリシーが設定されているセッションに接続しているコンピュータが DHCP サーバーとなり IPv4 アドレスや DNS サーバーの情報などを IPv4 DHCP クライアントに配布することを禁止します。 +POL_3 DHCP が割り当てた IP アドレスを強制 (IPv4) +POL_EX_3 このポリシーが設定されているセッション内の IPv4 コンピュータは、仮想ネットワーク側の DHCP サーバーが割り当てを行った IPv4 アドレスしか利用できないようにします。 +POL_4 ブリッジを禁止 +POL_EX_4 このポリシーが設定されているユーザーのセッションでは、ブリッジ接続を禁止します。ユーザーのクライアント側に Ethernet ブリッジが設定されていても、通信ができなくなります。 +POL_5 ルータ動作を禁止 (IPv4) +POL_EX_5 このポリシーが設定されているセッションでは、IPv4 ルーティングを禁止します。ユーザーのクライアント側で IP ルータが動作していても、通信ができなくなります。 +POL_6 MAC アドレスの重複を禁止 +POL_EX_6 このポリシーが設定されているセッションでは、別のセッションのコンピュータが使用中の MAC アドレスを使用することができないようにします。 +POL_7 IP アドレスの重複を禁止 (IPv4) +POL_EX_7 このポリシーが設定されているセッションでは、別のセッションのコンピュータが使用中の IPv4 アドレスを重複して使用することができないようにします。 +POL_8 ARP・DHCP・ICMPv6 以外のブロードキャストを禁止 +POL_EX_8 このポリシーが設定されているセッションでは、仮想ネットワークに対して IPv4 における ARP プロトコルと DHCP プロトコルおよび IPv6 における ICMPv6 プロトコルによるブロードキャストパケット以外のすべてのブロードキャストパケットの送受信を禁止します。 +POL_9 プライバシーフィルタモード +POL_EX_9 プライバシーフィルタモードポリシーが設定されているセッション間における直接的な通信をすべてフィルタリングします。 +POL_10 TCP/IP サーバーとしての動作を禁止 (IPv4) +POL_EX_10 このポリシーが設定されているセッションのコンピュータが TCP/IP プロトコルにおけるサーバーとしての動作を行うことを禁止します。 +POL_11 ブロードキャスト数を制限しない +POL_EX_11 このポリシーが設定されているセッションのコンピュータが通常は考えられないような異常な数のブロードキャストパケットを仮想ネットワークに送出しても自動的に制限しないようにします。 +POL_12 モニタリングモードを許可 +POL_EX_12 このポリシーが設定されているユーザーはモニタリングモードで仮想 HUB に接続することができます。モニタリングモードのセッションは仮想 HUB 内を流れるすべてのパケットをモニタリング (傍受) することができます。 +POL_13 TCP コネクション数の最大値 +POL_EX_13 このポリシーが設定されているセッションのセッション1つあたりに割り当てることができる物理的な TCP コネクション数の最大数を設定します。 +POL_14 通信タイムアウト時間 +POL_EX_14 このポリシーが設定されているセッションにおいて VPN Client / VPN Server 間の通信に障害が発生した場合、セッションを切断するまでのタイムアウト時間を秒単位で設定します。 +POL_15 MAC アドレスの上限数 +POL_EX_15 このポリシーが設定されているセッションの1セッションあたりに登録することができる MAC アドレスの数を指定します。 +POL_16 IP アドレスの上限数 (IPv4) +POL_EX_16 このポリシーが設定されているセッションの1セッションあたりに登録することができる IPv4 アドレスの数を指定します。 +POL_17 アップロード帯域幅 +POL_EX_17 このポリシーが設定されているセッションにおける仮想 HUB の外側から仮想 HUB の内側方向に入ってくるトラフィックの帯域幅を制限します。 +POL_18 ダウンロード帯域幅 +POL_EX_18 このポリシーが設定されているセッションにおける仮想 HUB の内側から仮想 HUB の外側方向に出ていくトラフィックの帯域幅を制限します。 +POL_19 ユーザーはパスワードを変更できない +POL_EX_19 このポリシーが設定されているユーザーがパスワード認証の場合、ユーザーが VPN クライアント接続マネージャなどから自分のパスワードを変更することを禁止します。 +POL_20 多重ログイン制限数 +POL_EX_20 このポリシーが設定されているユーザーが設定されている数以上の同時ログインを行うことを禁止します。ブリッジモードセッションにはこの制限は適用されません。このセキュリティポリシーは、VPN Server 3.0 以降、または多重ログイン制限機能が搭載されている VPN Server 2.0 でのみ有効です。 +POL_21 VoIP / QoS 対応機能の使用を禁止 +POL_EX_21 このポリシーが設定されているユーザーの VPN 接続セッションにおいて VoIP / QoS 対応機能の使用を禁止します。このセキュリティポリシーは、VPN Server 3.0 以降、または VoIP / QoS 対応機能が搭載されている VPN Server 2.0 でのみ有効です。 + +# Ver 3.0 +POL_22 ルータ要請/広告パケットをフィルタリング (IPv6) +POL_EX_22 このポリシーが設定されているセッションにおける IPv6 における ICMPv6 パケットのうち、メッセージの種類が 133 (ルータ要請) および 134 (ルータ広告) であるすべてのパケットをフィルタリングします。これにより、IPv6 クライアントは IPv6 における IP アドレスプレフィックス自動検出機能およびデフォルトゲートウェイ自動検出機能を利用することができなくなります。 +POL_23 ルータ広告パケットをフィルタリング (IPv6) +POL_EX_23 このポリシーが設定されているセッションに接続されている IPv6 ルータが仮想 HUB に対して発信したすべての ICMPv6 パケットのうち、メッセージの種類が 134 (ルータ広告) であるすべてのパケットをフィルタリングします。これにより、悪意のあるユーザーが不正なプレフィックスおよびデフォルトゲートウェイ情報をネットワークに流すことを禁止できます。 +POL_24 DHCP パケットをフィルタリング (IPv6) +POL_EX_24 このポリシーが設定されているセッションにおける IPv6 における DHCP パケットをすべてフィルタリングします。 +POL_25 DHCP サーバーの動作を禁止 (IPv6) +POL_EX_25 このポリシーが設定されているセッションに接続しているコンピュータが DHCP サーバーとなり IPv6 アドレスや DNS サーバーの情報などを IPv6 DHCP クライアントに配布することを禁止します。 +POL_26 ルータ動作を禁止 (IPv6) +POL_EX_26 このポリシーが設定されているセッションでは、IPv6 ルーティングを禁止します。ユーザーのクライアント側で IP ルータが動作していても、通信ができなくなります。 +POL_27 IP アドレスの重複を禁止 (IPv6) +POL_EX_27 このポリシーが設定されているセッションでは、別のセッションのコンピュータが使用中の IPv6 アドレスを重複して使用することができないようにします。 +POL_28 TCP/IP サーバーとしての動作を禁止 (IPv6) +POL_EX_28 このポリシーが設定されているセッションのコンピュータが TCP/IP プロトコルにおけるサーバーとしての動作を行うことを禁止します。 +POL_29 IP アドレスの上限数 (IPv6) +POL_EX_29 このポリシーが設定されているセッションの1セッションあたりに登録することができる IPv6 アドレスの数を指定します。IPv6 クライアントは一般的に複数個の IPv6 一時アドレスを利用することがあるため、1 セッションあたりに接続するコンピュータの台数が 1 台だけであったとしても、この値は少なくとも 20 以上に設定することを推奨します。 +POL_30 VPN Client でパスワードの保存を禁止 +POL_EX_30 このポリシーが設定されているユーザーとして VPN 接続してきた VPN Client は、ユーザー認証の方式がパスワード認証である場合において、パスワードを記憶して保存することができなくなります。これにより、ユーザーは VPN 接続を行う都度パスワードの入力を求められるようになり、セキュリティが向上します。なお、このポリシーが有効な場合は、VPN Client のバージョン 2.0 の古いクライアント PC は接続を拒否されるようになります。 +POL_31 VPN Client を一定時間で自動切断 +POL_EX_31 このポリシーが設定されている場合、VPN 接続してきた VPN Client は、接続後、指定された秒数が経過すると、自動的に VPN 接続を切断します。この場合は、自動再接続は実施されません。これにより、アクティブでないユーザーによる大量の VPN 接続を禁止することができます。なお、このポリシーが有効な場合は、VPN Client のバージョン 2.0 の古いクライアント PC は接続を拒否されるようになります。 +POL_32 IPv4 パケットをすべてフィルタリング +POL_EX_32 このポリシーが設定されているセッションでは、すべての IPv4 パケットの送受信がフィルタリングされ遮断されます。また、ARP パケットの送受信も禁止されます。 +POL_33 IPv6 パケットをすべてフィルタリング +POL_EX_33 このポリシーが設定されているセッションでは、すべての IPv6 パケットの送受信がフィルタリングされ遮断されます。 +POL_34 非 IP パケットをすべてフィルタリング +POL_EX_34 このポリシーが設定されているセッションでは、すべての非 IP パケット (IPv4, ARP, IPv6 以外の種類のパケット) の送受信がフィルタリングされ遮断されます。なお、仮想 HUB を通過するすべてのタグ VLAN パケットは非 IP パケットとしてみなされます。 +POL_35 IPv6 ルータ広告からデフォルトルータ指定を削除 +POL_EX_35 このポリシーが設定されているセッションに対して、仮想 HUB の他のセッションの IPv6 ルータが発信する IPv6 ルータ広告メッセージのルータ有効期間の値が 0 以外の数値の場合、この値を強制的に 0 に書き換えて伝送します。これにより、VPN クライアントコンピュータが VPN 接続した先のネットワークに存在するルータをデフォルトルータとして利用することにより物理的な IPv6 通信が途切れてしまう誤作動を防止することができます。 +POL_36 IPv6 ルータ広告からデフォルトルータ指定を削除 (IPv6 接続時自動有効化) +POL_EX_36 [IPv6 ルータ広告からデフォルトルータ指定を削除] ポリシーが無効である場合でも、VPN Client または VPN Bridge から VPN Server に対する接続および通信に利用する物理的なプロトコルが IPv6 の場合には自動的に [IPv6 ルータ広告からデフォルトルータ指定を削除] ポリシーが有効に設定されているものとみなして動作するようにします。 +POL_37 VLAN ID (IEEE802.1Q) +POL_EX_37 このポリシーで VLAN ID を設定することができます。VLAN ID ポリシーが設定されているセッションでは、そのセッションのユーザーが仮想 HUB に対して送信するすべての Ethernet フレームに自動的に VLAN タグ (IEEE 802.1Q 準拠) が付加されます。また、そのセッションのユーザーは同一の VLAN ID が書き込まれた VLAN タグ付きのフレームのみを受信することができます (受信の際には、自動的に VLAN タグは除去されます)。他の ID の VLAN タグが付いているか、または VLAN タグが付いていないフレームは受信できません。VLAN ID ポリシーが設定されていないセッションでは、すべての Ethernet フレームが送受信でき、VLAN タグの自動付与や除去は実施されません。なお、仮想 HUB を通過するすべてのタグ VLAN パケットは非 IP パケットとしてみなされます。また、タグ VLAN パケットは仮想 HUB における IPv4 / IPv6 に関係するセキュリティポリシー、アクセスリストおよびその他の IPv4 / IPv6 パケット固有の処理の適用対象となりません。 + + +# リモート接続ダイアログ関係 +REMOTE_DEF_CAPTION リモート接続 +REMOTE_DEF_TITLE リモート接続先のコンピュータを指定してください。 + + +# クライアント通知サービス関係 +CN_TITLE SoftEther VPN Client Developer Edition + + +# 接続マネージャ関係 +CM_TITLE SoftEther VPN Developer Edition クライアント接続マネージャ +CM_PW_LOCALMACHINE このコンピュータ +CM_NO_REMOTE %s で動作している VPN Client サービスは、リモートからの操作を許可していません。 +CM_CONNECT_FAILED %s で動作している VPN Client サービスに接続できませんでした。\r\nVPN Client サービスが起動し、正しく動作しているかどうか確認してください。 +CM_BAD_PASSWORD パスワードが誤っています。再度入力してください。パスワードを入力するときは大文字と小文字に注意してください。 +CM_NUM_CONN_COUNT VPN 接続中: %u アカウント +CM_CONN_NO 未接続 +CM_PRODUCT_NAME SoftEther VPN Client Build %u +CM_ACCOUNT_COLUMN_1 接続設定名 +CM_ACCOUNT_COLUMN_2 状態 +CM_ACCOUNT_COLUMN_3 接続先 VPN サーバー +CM_ACCOUNT_COLUMN_3_2 仮想 HUB 名 +CM_ACCOUNT_COLUMN_4 仮想 LAN カード名 +CM_VLAN_COLUMN_1 仮想 LAN カード名 +CM_VLAN_COLUMN_2 状態 +CM_VLAN_COLUMN_3 MAC アドレス +CM_VLAN_COLUMN_4 バージョン +CM_ACCOUNT_OFFLINE オフライン +CM_ACCOUNT_ONLINE 接続完了 +CM_ACCOUNT_CONNECTING 接続処理中 +CM_VLAN_ENABLED 有効 (使用可能) +CM_VLAN_DISABLED 無効 (使用不可) +CM_DELETE_ACCOUNT_MSG 接続設定 "%s" を削除します。よろしいですか? +CM_ST_ACCOUNT_NAME 接続設定名 +CM_ST_CONNECTED セッション接続状態 +CM_ST_CONNECTED_TRUE 接続完了 (セッション確立済み) +CM_ST_CONNECTED_FALSE 接続試行中 +CM_ST_CONNECTING VPN サーバーに接続開始中 +CM_ST_NEGOTIATION ネゴシエーション中 +CM_ST_AUTH ユーザー認証中 +CM_ST_ESTABLISHED コネクション確立済み +CM_ST_RETRY 再試行中 +CM_ST_IDLE アイドル状態 +CM_ST_SERVER_NAME サーバー名 +CM_ST_SERVER_PORT ポート番号 +CM_ST_PORT_TCP TCP ポート %u +CM_ST_SERVER_P_NAME サーバー製品名 +CM_ST_SERVER_P_VER サーバーバージョン +CM_ST_SERVER_P_BUILD サーバービルド番号 +CM_ST_START_TIME 接続開始時刻 +CM_ST_FIRST_ESTAB_TIME 初回セッションの確立時刻 +CM_ST_NONE - +CM_ST_CURR_ESTAB_TIME 現在のセッションの確立時刻 +CM_ST_NUM_ESTABLISHED セッション確立回数 +CM_ST_NUM_STR %u 回 +CM_ST_HALF_CONNECTION 半二重 TCP コネクションモード +CM_ST_HALF_TRUE はい (半二重モード) +CM_ST_HALF_FALSE いいえ (全二重モード) +CM_ST_QOS VoIP / QoS 対応機能 +CM_ST_QOS_TRUE 有効 (使用中) +CM_ST_QOS_FALSE 無効 +CM_ST_NUM_TCP TCP コネクション数 +CM_ST_NUM_TCP_UPLOAD 上り方向 TCP コネクション数 +CM_ST_NUM_TCP_DOWNLOAD 下り方向 TCP コネクション数 +CM_ST_MAX_TCP TCP コネクション数最大値 +CM_ST_VLAN_ID VLAN ID +CM_ST_NO_VLAN - +CM_ST_USE_ENCRYPT 暗号化の使用 +CM_ST_USE_ENCRYPT_TRUE はい (暗号化アルゴリズム: %S) +CM_ST_USE_ENCRYPT_TRUE2 はい +CM_ST_USE_ENCRYPT_FALSE いいえ (暗号化なし) +CM_ST_USE_COMPRESS 圧縮の使用 +CM_ST_UDP_ACCEL_ENABLED UDP 高速化機能をサポート +CM_ST_UDP_ACCEL_USING UDP 高速化機能を使用中 +CM_ST_RUDP TCP over UDP (NAT Traversal) +CM_ST_UNDERLAY_PROTOCOL 物理通信に使用中のプロトコル +CM_ST_COMPRESS_TRUE はい (約 %u %%) +CM_ST_COMPRESS_FALSE いいえ (圧縮無し) +CM_ST_SESSION_NAME セッション名 +CM_ST_CONNECTION_NAME コネクション名 +CM_ST_SESSION_KEY セッションキー (160bit) +CM_ST_BRIDGE_MODE ブリッジ / ルータモード +CM_ST_MONITOR_MODE モニタリングモード +CM_ST_YES はい +CM_ST_NO いいえ +CM_ST_SEND_SIZE 送信データサイズ +CM_ST_RECV_SIZE 受信データサイズ + +CM_ST_SEND_UCAST_NUM 送信ユニキャストパケット数 +CM_ST_SEND_UCAST_SIZE 送信ユニキャスト合計サイズ +CM_ST_SEND_BCAST_NUM 送信ブロードキャストパケット数 +CM_ST_SEND_BCAST_SIZE 送信ブロードキャスト合計サイズ + +CM_ST_RECV_UCAST_NUM 受信ユニキャストパケット数 +CM_ST_RECV_UCAST_SIZE 受信ユニキャスト合計サイズ +CM_ST_RECV_BCAST_NUM 受信ブロードキャストパケット数 +CM_ST_RECV_BCAST_SIZE 受信ブロードキャスト合計サイズ + +CM_ST_NUM_PACKET_STR %S パケット +CM_ST_SIZE_BYTE_STR %S バイト + +CM_NEW_ICON 新しい接続設定の作成 +CM_VGC_ICON VPN Gate 公開 VPN 中継サーバー +CM_VGC_LINK VPN Gate 学術実験 Web サイト +CM_ST_TITLE %s の接続状況 +CM_ST_COLUMN_1 項目名 +CM_ST_COLUMN_2 状況 +CM_NEW_ACCOUNT_NAME_1 新しい接続 +CM_NEW_ACCOUNT_NAME_2 新しい接続 (%u) +CM_ACCOUNT_TITLE_1 新しい接続設定のプロパティ +CM_ACCOUNT_TITLE_2 %s のプロパティ +CM_SERVER_CERT_1 固有証明書の登録(&R) +CM_SERVER_CERT_2 固有証明書の削除(&0) +CM_CLIENT_CERT_1 クライアント証明書の指定(&8) +CM_CLIENT_CERT_2 クライアント証明書の削除(&8) +CM_CERT_INFO 発行先: %s\r\n発行者: %s\r\n有効期限: %s +CM_NO_CERT ユーザー認証に使用するクライアント証明書を指定する必要があります。 +CM_NO_SECURE ユーザー認証に使用するスマートカード内のクライアント証明書と秘密鍵を指定してください。 +CM_CERT_SECURE_INFO 証明書: "%S"\r\n秘密鍵: "%S" +CM_SELECT_SECURE_DEVICE 使用スマートカード選択(&J) +CM_SELECT_CERT_INCARD 証明書と秘密鍵の指定(&7) +CM_VIEW_CLIENT_CERT クライアント証明書の表示(&7) +CM_NO_VLAN 新しい接続設定を作成する前に、仮想 LAN カードを作成してください。\r\n\r\n仮想 LAN カードを作成しますか? +CM_NO_VLAN_2 VPN Server に接続する前に、仮想 LAN カードを作成してください。\r\n\r\n仮想 LAN カードを作成しますか? +CM_VLAN_REMOTE_ERROR 仮想 LAN カードはリモートから作成することができません。\r\n\rVPN Client サービスが動作しているローカルコンピュータ上で VPN クライアント接続マネージャを起動し、仮想 LAN カードをインストールしてください。 +CM_9X_VLAN_INSTALL 新しい仮想 LAN カードを作成します。\r\n\r\n仮想 LAN カードを作成した場合、直ちに Windows を再起動する必要があります。\r\nまた、仮想 LAN カードのインストール中に Windows のインストール CD-ROM が必要になる場合があります。\r\n\r\nVPN クライアント接続マネージャ以外のすべての作業中のアプリケーションを終了し、Windows のインストール CD-ROM を用意してから、[OK] をクリックしてください。\r\n[OK] をクリックすると、仮想 LAN カードのインストールが開始されます。その後、自動的に Windows が再起動します。 +CM_9X_VLAN_ME_MESSAGE 仮想 LAN カードを作成しました。[OK] をクリックすると、コンピュータを自動的に再起動します。\r\n\r\n再起動後、新しいデバイスのインストールウィザードが表示される場合があります。\r\nその場合は、[次へ] を数回クリックしてドライバのインストールを完了させてください。 +CM_9X_VLAN_UNINSTALL 仮想 LAN カードの削除は、ネットワークのプロパティから行ってください。\r\n\r\nネットワークのプロパティ画面を表示しますか? +CM_PORT_1 8888 (PX-VPN ポート) +CM_PORT_2 443 (HTTPS ポート) +CM_PORT_3 992 (telnets ポート) +CM_PORT_4 5555 (SE-VPN ポート) +CM_RETRY_INTERVAL_ERROR 再接続間隔は 5 秒以上に設定してください。 +CM_DELETE_CLIENT_CERT 設定されているクライアント証明書を削除します。よろしいですか? +CM_DELETE_SERVER_CERT 設定されているサーバー固有証明書を削除します。よろしいですか? +CM_SET_STARTUP 接続設定 "%s" をスタートアップ接続に設定しました。\r\n\r\nこのアカウントは次回のコンピュータ起動時に自動的に接続されます。\r\n(Windows をお使いの場合は、Windows の起動直後に接続が開始されます。\r\nユーザーがログオンする前にバックグラウンドで接続されます。) +CM_REMOVE_STARTUP 接続設定 "%s" のスタートアップ接続属性を解除しますか? +CM_NO_DISCONNECT_SPAN TCP コネクションの寿命を設定してください。 +CM_HALF_MSG 半二重モードを使用する場合は TCP コネクション数は 2 以上に設定してください。 +CM_TOO_SMALL_INTERVAL TCP コネクションの確立間隔は 1 秒以上に設定してください。 +CM_DELETE_VLAN 仮想 LAN カード "%s" を削除します。よろしいですか? +CM_COPY_NAME_1 コピー ~ %s +CM_COPY_NAME_2 コピー (%u) ~ %s +CM_IMPORT_NAME_1 %s +CM_IMPORT_NAME_2 %s (%u) +CM_CERT_COLUMN_1 発行先 +CM_CERT_COLUMN_2 発行者 +CM_CERT_COLUMN_3 有効期限 +CM_CERT_DELETE_MSG この証明書をリストから削除しますか? +CM_PASSWORD_SET パスワードを設定しました。 +CM_PASSWORD_REMOVE パスワード設定を解除しました。 +CM_UNDER_CONSTRUCTION 未完成です。 +CM_CURRENT_ACTIVE 接続設定 "%s" の設定を保存しましたが、現在この接続設定は VPN Server に接続中のため、設定内容は次回接続時まで適用されません。 +CM_DISCONNECT_ALL 現在接続中の %u 個の接続設定をすべて切断します。\r\nよろしいですか? +CM_HTTPS_MSG HTTP プロキシサーバー経由で接続することを選択しました。\r\n\r\n多くの HTTP プロキシサーバーは、任意の TCP ポートへのアクセスを許可していません。\r\nVPN Client は、HTTP プロキシサーバーを経由して VPN Server に接続する際、HTTPS (HTTP over SSL) 通信を行って接続することができます。\r\nこの場合は、接続先 VPN Server のポート番号を 443 (HTTPS ポート) に設定することをお勧めします。\r\n(他のポート番号の場合、HTTP プロキシサーバーを経由することができない場合があります。\r\n 接続先 VPN Server でポート 443 が有効になっていることを確認してください。)\r\n\r\n詳しい情報については、経由しようとしている HTTP プロキシサーバーのシステム管理者やネットワーク管理者にお問い合わせください。\r\n\r\n接続先 VPN Server のポート番号指定を 443 (HTTPS ポート) に変更しますか? +CM_REMOTE_WARNING [リモート管理の設定] を許可しない設定に変更しようとしています。\r\n\r\n現在、VPN クライアント接続マネージャはリモートコンピュータ "%S" に接続し、このコンピュータ上の VPN Client サービスを制御しています。\r\nリモート接続を無効にした場合、コンピュータ "%S" の VPN Client サービスにリモートから VPN クライアント接続マネージャによって接続し、制御することはできなくなります。\r\n\r\nリモート管理を無効にしますか? +CM_KEEP_INTERVAL_MSG [パケット送出間隔] には %u 秒から %u 秒までの値を設定してください。 +CM_REMOTE_TITLE 別のコンピュータ上で動作している VPN Client サービスを VPN クライアント接続マネージャから接続し、リモート管理することができます。\r\n(ただし、接続先のコンピュータの VPN Client サービスがリモート管理を許可している必要があります。) +CM_DESKTOP_LOCAL_PC このコンピュータ +CM_DESKTOP_REMOTE_PC コンピュータ %S +CM_DESKTOP_MSG_LOCAL_TS ターミナルサービス (リモートデスクトップ) 機能 +CM_DESKTOP_MSG_LOCAL_SW ユーザーの切り替え機能 +CM_DESKTOP_MSG_LOCAL_1 現在、このコンピュータには%sがインストールされており、複数のユーザーが同時にログオンできる環境になっています。この場合、VPN Client が表示する進行状況のメッセージやエラーメッセージなどは、「コンソールセッション」と呼ばれるセッション上に表示されます。 +CM_DESKTOP_MSG_LOCAL_21 現在、このコンピュータのコンソールセッションは 「セッション ID: 0、ユーザー %s」 に割り当てられていますが、あなたはセッション %u で VPN クライアント接続マネージャを起動しているため、VPN Client が表示する進行状況やエラーなどのメッセージウインドウを表示することができません。 +CM_DESKTOP_MSG_LOCAL_22 現在、このコンピュータのコンソールセッション (セッション ID: 0) には誰もログオンしておらず、あなたはセッション %u で VPN クライアント接続マネージャを起動しているため、VPN Client が表示する進行状況やエラーなどのメッセージウインドウを表示することができません。 +CM_DESKTOP_MSG_LOCAL_31 コンピュータのコンソールセッション (セッション ID: 0、ユーザー %s) を表示してから、そのセッション内で VPN クライアント接続マネージャを起動し、接続設定 "%s" への接続を開始することをお勧めします。このまま接続処理を開始することもできますが、その場合は途中で表示される可能性のある進行状況やエラー メッセージをすべて確認できない場合があります。 +CM_DESKTOP_MSG_LOCAL_32 一度ログオフし、ローカルログオンし直してから、そのセッション内で VPN クライアント接続マネージャを起動し、接続設定 "%s" への接続を開始することをお勧めします。このまま接続処理を開始することもできますが、その場合は途中で表示される可能性のある進行状況やエラー メッセージをすべて確認できない場合があります。 +CM_DESKTOP_MSG_REMOTE_1 現在、コンピュータ %S 上の VPN Client に対してリモート接続して操作を行っているため、接続設定への VPN 接続中に VPN Client が進行状況のメッセージやエラーメッセージなどを表示した場合、そのメッセージを現在の画面で確認することはできません。 +CM_DESKTOP_MSG_REMOTE_2 VPN Client が表示する進行状況やエラーなどのメッセージウインドウをすべて確認するには、コンピュータ %S にローカルログオンして、コンソールセッション (デスクトップ) を表示しておく必要があります。 +CM_DESKTOP_MSG_REMOTE_3 コンピュータ %S にコンソールセッションとして直接ローカルログオンしてから、そのセッション内で VPN クライアント接続マネージャを起動し、接続設定 "%s" への接続を開始することをお勧めします。このまま接続処理を開始することもできますが、その場合は途中で表示される可能性のある進行状況やエラー メッセージをすべて確認できない場合があります。 +CM_STOP_INST_VLAN_1 このコンピュータで仮想 LAN カードのインストール作業を行うには、「コンソールセッション」 上で VPN クライアント接続マネージャを起動する必要があります。\r\n\r\n現在、このコンピュータには%sがインストールされており、現在のユーザーはコンソールセッションではなくリモートセッション (セッション ID: %u) としてログオンしています。\r\n仮想 LAN カードのインストール作業を行うには、コンソールセッション (セッション ID: %u、ユーザー %s がログオン中) 上で VPN クライアント接続マネージャを起動する必要があります。\r\n\r\nユーザーの切り替え機能を使用するか、リモートデスクトップの /console スイッチ機能を使用するか、またはコンピュータのローカルコンソールデバイスを使用してコンピュータにローカルログオンしてから VPN クライアント接続マネージャを起動し、仮想 LAN カードのインストール作業を行ってください。 +CM_STOP_INST_VLAN_2 このコンピュータで仮想 LAN カードのインストール作業を行うには、「コンソールセッション」 上で VPN クライアント接続マネージャを起動する必要があります。\r\n\r\n現在、このコンピュータには%sがインストールされており、現在のユーザーはコンソールセッションではなくリモートセッション (セッション ID: %u) としてログオンしています。\r\n仮想 LAN カードのインストール作業を行うには、コンソールセッション上で VPN クライアント接続マネージャを起動する必要があります。\r\n(現在、コンソールセッション (セッション ID: 0) にはユーザーがログオンしていません。)\r\n\r\nユーザーの切り替え機能を使用するか、リモートデスクトップの /console スイッチ機能を使用するか、またはコンピュータのローカルコンソールデバイスを使用してコンピュータにローカルログオンしてから VPN クライアント接続マネージャを起動し、仮想 LAN カードのインストール作業を行ってください。 +CM_SHORTCUT_DESKTOP_MSG 接続設定へのショートカットを使用して接続を開始するには、「コンソールセッション」上でショートカットファイルを起動する必要があります。\r\n\r\n現在のユーザーはコンソールセッションではなくリモートセッション (セッション ID: %u) としてログオンしています。 +CM_HTTP_PROXY_WARNING [HTTP プロキシサーバー経由接続] が選択されています。\r\n\r\n多くの場合、HTTP プロキシサーバーは接続先サーバーのポート番号として、HTTP プロトコル (TCP ポート 80 番) および HTTPS プロトコル (TCP ポート 443 番) の 2 種類の TCP ポートに対する接続のみを許可しています。\r\n(プロキシサーバーが任意の TCP ポートに対する接続を許可している場合もあります。)\r\n\r\nHTTP ポートまたは HTTPS ポート以外へのサーバー ポートへの接続を禁止している HTTP プロキシサーバーを経由して VPN 接続を行う場合は、接続先 VPN Server のポート番号は 443 (HTTPS プロトコル) に指定する必要があります。\r\n\r\n経由する HTTP プロキシサーバーが 80 番または 443 番ポート以外への接続を許可しているかどうかを確認するには、HTTP プロキシサーバーの管理者にお問い合わせください。\r\n\r\n現在、接続先 VPN Server のポート番号は %d が指定されていますが、ポート番号を 443 番 (HTTPS プロトコル) に変更しますか?\r\n(接続する VPN Server のポート 443 において接続を待ち受ける設定になっている必要があります。)\r\n不明な場合は、システム管理者またはネットワーク管理者にお問い合わせください。 +CM_HTTP_HEADER_COLUMN_0 Name +CM_HTTP_HEADER_COLUMN_1 Value +CM_PASSWORD_CHANGED パスワードが変更されました。 +CM_ACCOUNT_SETTING_FILE 接続設定ファイル (*.VPN)|*.vpn|すべてのファイル (*.*)|*.* +CM_ACCOUNT_SAVE_TITLE エクスポート先の接続設定ファイル名を入力してください。 +CM_ACCOUNT_OPEN_TITLE インポートする接続設定ファイルを選択してください。 +CM_ACCOUNT_FILE_BANNER # VPN Client 接続設定ファイル\r\n# \r\n# このファイルは VPN クライアント接続マネージャによってエクスポートされたものです。\r\n# このファイルの内容はテキストエディタで編集することができます。\r\n# \r\n# このファイルをクライアント接続マネージャにインポートすると、すぐに使用する\r\n# ことができます。\r\n\r\n +CM_FAILED_TO_OPEN_FILE ファイルを開くことができませんでした。 +CM_FAILED_TO_SAVE_FILE ファイルを保存することができませんでした。 +CM_ACCOUNT_PARSE_FAILED 指定されたファイルから接続設定を読み込むことができませんでした。\r\nファイルの内容を確認してください。 +CM_ACCOUNT_MSG_SENSITIVE この接続設定にはユーザー名とパスワード情報が保存されています。\r\nユーザー名とパスワード情報を接続設定ファイルから消去しますか?\r\n\r\n[はい] をクリックすると、接続設定ファイルから認証情報を削除します。\r\nこの場合は、接続設定をインポートしたユーザーは VPN 接続時にユーザー名とパスワードの入力を求められます。\r\n\r\n[いいえ] をクリックすると、接続設定ファイルに認証情報を格納したままにします。 +CM_SHORTCUT_FILE ショートカットファイル|*.lnk +CM_SHORTCUT_SAVE_TITLE ショートカットファイル名を入力してください。 +CM_SHORTCUT_UNSUPPORTED このバージョンの VPN Client では、接続ショートカット機能をサポートしていません。\r\n新しいバージョンにアップデートしてください。 +CM_SHORTCUT_COMMENT 接続設定「%s」を使用して VPN Server に接続します。 +CM_SHORTCUT_ERROR ショートカットの作成に失敗しました。 +CM_VPN_FILE_CLICKED 接続設定ファイルをインポートしますか? +CM_VPN_FILE_IMPORT_NG 接続設定ファイルをインポートできません。VPN Client の設定がロックされています。 +CM_VLAN_INSTALLING しばらくお待ちください... +CM_SECURE_MUST_LOCAL 現在リモートコンピュータの VPN Client サービスに接続して管理しているため、スマートカードの設定を行うことはできません。 +CM_DETAIL_MODE_LINK_STR カスケード接続では、常に [ブリッジ / ルータモードで接続] が有効になっています。 +CM_TRAY_INITING SoftEther VPN クライアント接続マネージャ (Developer Edition) +CM_TRAY_NOT_CONNECTED SoftEther VPN クライアント接続マネージャ (Developer Edition)\r\n接続していません +CM_TRAY_CONNECTED_0 SoftEther VPN クライアント接続マネージャ (Developer Edition)\r\n%u 個のサーバーとの接続が完了し、%u 個のサーバーに接続を試行しています +CM_TRAY_CONNECTED_1 SoftEther VPN クライアント接続マネージャ (Developer Edition)\r\n%u 個のサーバーに接続を試行しています +CM_TRAY_CONNECTED_2 SoftEther VPN クライアント接続マネージャ (Developer Edition)\r\n%u 個のサーバーと接続が完了しています +CM_TRAY_MENU_1_SHOW 接続マネージャを表示する(&S) +CM_TRAY_MENU_1_HIDE 接続マネージャを閉じる(&O) +CM_TRAY_MENU_2_QUIT 接続マネージャプログラムの終了(&X) +CM_TRAY_MENU_CONNECT VPN 接続を開始(&C) +CM_TRAY_MENU_DISCONNECT VPN 接続を切断(&D) +CM_TRAY_MENU_STATUS 接続状態を表示(&I) +CM_TRAY_MENU_DISCONNECT_ALL すべての接続を切断(&A) +CM_TRAY_MENU_NEW 接続設定の新規作成(&N)... +CM_TRAY_MENU_RECENT 最近接続した VPN サーバー(&Y) +CM_TRAY_MENU_TRAFFIC 通信スループット測定ツール(&R)... +CM_TRAY_MENU_NETIF ネットワークデバイスの状態を表示(&D)... +CM_TRAY_MENU_ABOUT 接続マネージャのバージョン情報(&A)... +CM_TRAY_MENU_SETTING 動作モードの変更(&M)... +CM_TRAY_MENU_CANCEL このメニューを閉じる +CM_EXIT_MESSAGE VPN クライアント接続マネージャプログラムを終了します。\r\nよろしいですか? +CM_IMPORT_MESSAGE ファイル "%S" から接続設定 "%s" をインポートしました。 +CM_VLAN_CREATING 新しい VPN 用仮想 LAN カードを作成し、Windows に追加しています。\r\n\r\nこの処理には数秒から数十秒かかる場合があります。\r\nしばらくお待ちください...\r\n\r\n(仮想 LAN カードの作成中は他の操作はしないでください。) +CM_SETTING_PASSWORD 設定ロック機能が有効になっています。解除するにはパスワードを入力する必要があります。 +CM_EASY_MODE_NOT_ON_REMOTE リモートコンピュータの VPN Client の動作モードが [簡易モード] のため、接続できません。 +CM_EASY_CONNECT_BUTTON_1 VPN 接続を開始(&C) +CM_EASY_CONNECT_BUTTON_2 切断(&D) +CM_EASY_ACCOUNT_WARNING 設定がロックされているため、[経由するプロキシサーバーの設定]、[ユーザー認証] および [使用する仮想 LAN カード] のみが変更できます。 +CM_EASY_INFO_1 VPN 接続先を選択してください。 +CM_EASY_INFO_2 [VPN 接続を開始] ボタンをクリックすると VPN 接続を開始します。 +CM_EASY_INFO_3 VPN 接続中です。[切断] ボタンで切断できます。 +CM_EXT_VOICE_MSG 拡張音声ガイドの音声メッセージの内容は、一部正常に再生されない可能性があります。\r\n拡張音声ガイドを有効にしますか? +CM_EASY_TITLE VPN クライアント簡易接続マネージャ +CM_EASY_CONNECTED VPN 接続が完了しました。 +CM_EASY_CONNECTING VPN 接続の実行中... +CM_PROXY_FROM_IE 現在の Internet Explorer のプロキシサーバーの設定を読み込みました。 +CM_TRAY_ICON_RESTORE タスクトレイのアイコンを消去しました。\r\n\r\nアイコンを復活させるには、VPN クライアント接続マネージャを起動し、通常モードで [表示] メニューの [タスクトレイのアイコンを表示] をクリックしてください。 +CM_WOULDYOULOAD_IE_PROXY 現在、このコンピュータは Internet Explorer の設定でプロキシサーバー "%S" を使用するように設定されています。\r\n今回作成する新しい接続設定では、Internet Explorer のプロキシサーバー設定を用いて VPN 接続するようにしますか?\r\n\r\n[はい] をクリックすると、Internet Explorer のプロキシサーバー設定を使用します。\r\n[いいえ] をクリックすると、プロキシサーバーを使用せずに直接 VPN 接続するように設定します。\r\nこの設定は、いつでも接続設定のプロパティ画面から変更できます。 +CM_MSG_TITLE VPN サーバー "%S" (仮想 HUB: "%S") +CM_JUMPLIST_RCCONNECT 最近の接続先 +CM_VPNGATE_MESSAGE VPN Gate 学術実験プロジェクトの Web サイトには、公開 VPN 中継サーバーの一覧が公開されています。\r\nこれらの VPN サーバーには、誰でもユーザー登録なしで VPN 接続することができます。\r\n\r\nVPN Gate 学術実験プロジェクトは SoftEther VPN の一部ではありません。\r\nこのアイコンは http://www.vpngate.net/ へのリンクを提供しているに過ぎません。\r\nVPN Gate に接続するためには、VPN Gate Plugin をインストールする必要があります。\r\n\r\nhttp://www.vpngate.net/ (筑波大学における学術実験サイト) を開きますか? +CM_VLAN_REINSTALL_MSG 仮想 LAN カードのドライバを再インストールすると、MAC アドレスが変更になります。また、仮想 LAN カードに関する TCP/IP などのネットワーク設定は初期化されます。続行しますか?\r\n\r\nなお、仮想 LAN カードのドライバを再インストールしても正常に動作しない場合は、新たに別の名前で仮想 LAN カードを作成してください。 + + +# VPN Gate Service 関係 +VGC_COLUMN_0 DDNS 名 +VGC_COLUMN_1 IP アドレス (ホスト名) +VGC_COLUMN_2 国・地域 +VGC_COLUMN_3 起動時間 +VGC_COLUMN_4 VPN 接続数 +VGC_COLUMN_5 回線速度 +VGC_COLUMN_6 Ping (Google, SE) +VGC_COLUMN_7 SSL-VPN (TCP) +VGC_COLUMN_8 UDP サポート +VGC_COLUMN_9 ログ保存ポリシー +VGC_COLUMN_10 累積通信量 +VGC_COLUMN_11 累積ユーザー数 +VGC_COLUMN_12 運営者 +VGC_COLUMN_13 運営者によるメッセージ +VGC_COLUMN_14 スコア + +VGC_LOG_PERMANENT 恒久的に保存 +VGC_LOG_2WEEKS 2 週間保存 +VGC_LOG_NONE ログ無効 + +VGC_UPTIME_MIN %u 分間 +VGC_UPTIME_HOUR %u 時間 +VGC_UPTIME_DAY %u 日間 +VGC_NUM_VPN %u セッション +VGC_NUM_LOGIN %S 人 + +VGC_UDP_AVAILABLE UDP OK + +VGC_TITLE VPN Gate プラグインに関するメッセージ + +VGC_VER_DIFF この VPN Gate Client プラグインのバージョンが SoftEther VPN Client のバージョンと異なっています。\r\n\r\n現在の VPN Gate プラグイン: ビルド %u\r\n現在の SoftEther VPN Client: ビルド %u\r\n\r\nVPN Gate プラグインの最新版 (ビルド %u) をダウンロードしてインストールすることをお勧めします。最新版にアップデートしない場合、VPN 通信エラーやリスト更新エラーが発生する場合があります。もし何度も VPN サーバーリストの更新に失敗する場合は VPN Gate プラグインのバージョンをアップデートしてください。\r\n\r\n最新版の VPN Gate プラグインの入手: http://www.vpngate.net/\r\n(もし上記サイトに直接アクセスできない場合はミラーサイトを経由してアクセスしてください。)\r\n\r\n + +VGC_LIST_STR_OK 地球上に %S 台の公開 VPN 中継サーバー (%S に更新) +VGC_LIST_STR_OK_2 %S 台のサーバー (%S に更新) - リスト取得失敗。最新版の VPN Gate Client をダウンロードしてください。 +VGC_LIST_STR_NG リスト取得失敗。最新版の VPN Gate Client をダウンロードしてください。 +VGC_PROXY_MSG プロキシサーバーを経由する必要があるネットワーク環境の内部からは、「SSL-VPN 接続」で TCP ポート 443 がサポートされていない VPN 中継サーバーにはアクセスできない場合があります。 +VGC_PROXY_TITLE プロキシサーバーに関するご注意 + +VGS_NO_HUB_YET メッセージを設定するには、最初にまず VPN Gate サービス コントロールパネルで VPN Gate サービスを有効にして [OK] をクリックしてから、再度このウインドウを開いてください。 + +VGS_STOP VPN Gate サービスを停止します。\r\n\r\nVPN Gate サービスを停止すると、このコンピュータは新たな VPN 接続を受付けなくなりますが、現在アクティブな VPN セッションは残る場合があります。\r\n(それらの VPN セッションは列挙されない場合があります。)\r\n\r\nアクティブな VPN セッションを削除するためには、VPN Gate サービスを停止した後は直ちに SoftEther VPN Server または SoftEther VPN Client サービスを再起動するか、コンピュータを再起動してください。 + +VGS_START VPN Gate 中継サービス機能を有効にします。\r\nこのコンピュータで VPN Gate 中継サービス機能を有効にすると、このコンピュータは、任意の VPN Gate ユーザーからの VPN 接続を受け付け、通信を中継することができるようになります。\r\n\r\nVPN Gate 中継サービス機能は、ユーザーの責任で有効にしてください。\r\n法令によって VPN による暗号化通信が禁止されている国があります。\r\nVPN Gate 中継サービス機能について詳しくは http://www.vpngate.net/ja/join.aspx をお読みください。\r\n\r\nVPN Gate 学術実験サービスは、日本国に所在する筑波大学大学院における研究プロジェクトとして運営されているサービスです。本サービスは日本国の法令にのみ準拠して運用されており、日本国以外の国・地域の法令については一切関知しておりません。\r\n\r\nそもそも世界には 200 カ国近くの国が存在しており、それぞれの国における法律は互いに異なります。すべての国の法律を調査した上でそれらすべてに適合することを保証したソフトウェアを開発することは事実上不可能です。万一ユーザーが本サービスを特定の国・地域の領域内で利用したことによって公務員により法的なペナルティを科せられるなどの損害が発生した場合であっても、プロジェクト実施者は一切責任を負いません。\r\n本ソフトウェアまたはサービスを使用する際には、ユーザーが適用されるすべての法令をユーザーの責任により遵守してください。本ソフトウェアまたはサービスを日本国内・国外を問わず使用された場合に発生するすべての損害と責任は、ユーザーに帰責します。本学術実験の運営者およびソフトウェアの供給者は、一切責任を負いません。\r\nこれらの注意事項に同意いただけない場合は、VPN Gate 学術実験サービスに関連する機能を使用しないでください。 + + +# サービス関係 (Win32) +SVC_HELP [ %s (%S) のコマンドライン引数 ]\r\n\r\nこのプログラム (%s) はバックグラウンドで稼動するプロセスです。以下のコマンドライン引数を与えて起動してください。\r\n\r\n\r\n/install …… %s サービス (サービス名: %S) を Windows にインストールします。その後自動的にサービスを起動します。\r\n\r\n/uninstall …… %s サービス (サービス名: %S) を Windows からアンインストールします。\r\n\r\n/start … %s サービス (サービス名: %S) を起動します。\r\n\r\n/stop … %s サービス (サービス名: %S) を停止します。\r\n\r\n/test … %s プログラムをテストモードで起動します。(デバッグ用)\r\n\r\n/usermode … %s プログラムをユーザーモードで起動します。(可能な場合)\r\n\r\n/usermode_showtray … ユーザーモードで起動する際、以前タスクトレイのアイコンを非表示に設定したことがある場合は、アイコンを回復します。\r\n\r\n/usermode_hidetray … ユーザーモードで起動する際、タスクトレイのアイコンを非表示にします。\r\n\r\n\r\n※ /test および /usermode 以外のサービス操作系コマンドは Windows 98 / Me では動作しません。 +SVC_NT_ONLY サービス系の操作コマンドは Windows 98 / Me では動作しません。 +SVC_ALREADY_INSTALLED サービス %s (サービス名 %S) はすでにこのコンピュータにインストールされています。一度アンインストールしてから、再インストールしますか? +SVC_INSTALL_OK サービス %s (サービス名 %S) を正しくインストールしました。\r\n\r\n(実行パス: %s)\r\n\r\nサービスの起動が完了しました。 +SVC_INSTALL_FAILED サービス %s (サービス名 %S) のインストールに失敗しました。 +SVC_INSTALL_FAILED_2 サービス %s (サービス名 %S) を正しくインストールしました。\r\n\r\n(実行パス: %s)\r\n\r\nただし、サービスの起動に失敗しました。 +SVC_NOT_INSTALLED サービス %s (サービス名 %S) はコンピュータにインストールされていません。/install コマンドライン引数を使用してインストールしてください。 +SVC_START_OK サービス %s (サービス名 %S) の起動が完了しました。 +SVC_START_FAILED サービス %s (サービス名 %S) の起動に失敗しました。 +SVR_ALREADY_START サービス %s (サービス名 %S) はすでに起動しています。 +SVC_STOP_OK サービス %s (サービス名 %S) を停止しました。 +SVC_STOP_FAILED サービス %s (サービス名 %S) の停止に失敗しました。 +SVC_ALREADY_STOP サービス %s (サービス名 %S) はすでに停止しています。 +SVC_UNINSTALL_OK サービス %s (サービス名 %S) をアンインストールしました。 +SVC_UNINSTALL_FAILED サービス %s (サービス名 %S) のアンインストールに失敗しました。 +SVC_NOT_FOUND サービス %S に関する情報が文字列テーブル内から見つかりませんでした。 +SVC_NOT_ADMIN サービスをインストール / アンインストール / 起動 / 停止するには、このコンピュータの Administrators 権限 (システム管理者権限) が必要です。\r\n\r\nこのコンピュータの Administrators アカウントを持っている場合は、Administrators アカウントとしてログオンし直してください。\r\nAdministrators アカウントが不明な場合は、システム管理者にお問い合わせください。 +SVC_TEST_MSG サービス %s をテストモードで起動しています。\r\n\r\n[OK] をクリックすると終了します。 +SVC_TRAY_TOOLTIP %S (ユーザーモード) +SVC_TEST_MUTEX すでに実行可能ファイル %s が起動しています。 +SVC_USERMODE_MUTEX すでに %s の別のプロセスが起動しています。 +SVC_SERVICE_MUTEX サービス %S のプロセス %s がすでに起動しているため、サービスを開始できません。 +SVC_USERMODE_MENU_1 タスクトレイアイコンを非表示にする(&H) +SVC_USERMODE_MENU_2 %s の終了(&X) +SVC_HIDE_TRAY_MSG %S のユーザーモード起動時のタスクトレイアイコンを非表示にします。\r\n次回以降 %S をユーザーモードで起動した際に、タスクトレイにアイコンが表示されなくなります。\r\nプロセスを終了するメニューも表示されなくなります。\r\n\r\nプロセスを終了するには、Windows 98 / Me の場合は Ctrl + Alt + Del キーを押して [プログラムの強制終了] を使用してください。\r\nそれ以外の OS の場合は [タスクマネージャ] を使用してください。\r\n\r\nタスクトレイアイコンの表示を復活させるには、次回のユーザーモード起動時に /usermode_showtray オプションを使用してください。 + + +# サービス関係 (UNIX) +UNIX_SVC_HELP %S service program\nCopyright (c) all contributors on SoftEther VPN project in GitHub.\nCopyright (c) Daiyuu Nobori, SoftEther Project at University of Tsukuba, and SoftEther Corporation.\nAll Rights Reserved.\n\n%S command usage:\n %S start - Start the %S service.\n %S stop - Stop the %S service if the service has been already started.\n\n +UNIX_SVC_STARTED The %S service has been started.\n +UNIX_SVC_STOPPING Stopping the %S service ...\n +UNIX_SVC_STOPPED %S service has been stopped.\n +UNIX_SVC_STOP_FAILED Stopping %S service was failed.\n +UNIX_SVC_ALREADY_START %S service has been already started.\nRun the "%S stop" command to stop this service.\n +UNIX_SVC_NOT_STARTED %S service has not yet been started.\nRun the "%S start" to start this service.\n +UNIX_SVC_ERROR_FORK Failed to create child process for the %S service.\n +UNIX_SVC_NONROOT \nWarning: The current user context is non-root. It is recommended to run the VPN service by the root user. Although the VPN service may run under non-root users, some privilege-required functions (e.g. the local bridge function) need the root privilege.\n + + +# サービス定義 (SoftEther VPN Client) +SVC_VPNCLIENT_NAME vpnclient +SVC_VPNCLIENT_TITLE SoftEther VPN Client +SVC_VPNCLIENT_DESCRIPT SoftEther VPN Client の仮想 LAN カードデバイスドライバおよび接続サービスを管理します。このサービスが停止された場合は、このコンピュータの SoftEther VPN Client を使用して SoftEther VPN Server に接続することができなくなります。 + + +# サービス定義 (SoftEther VPN Server) +SVC_VPNSERVER_NAME vpnserver +SVC_VPNSERVER_TITLE SoftEther VPN Server +SVC_VPNSERVER_DESCRIPT SoftEther VPN Server サーバー プロセスを管理します。SoftEther VPN Server は高性能の SoftEther VPN Server 機能を TCP/IP プロトコルを通じて提供します。このサービスが停止された場合は、このコンピュータの SoftEther VPN Server は停止し、SoftEther VPN Client はこのコンピュータに VPN 接続することができなくなります。 + + +# サービス定義 (SoftEther VPN Bridge) +SVC_VPNBRIDGE_NAME vpnbridge +SVC_VPNBRIDGE_TITLE SoftEther VPN Bridge +SVC_VPNBRIDGE_DESCRIPT SoftEther VPN Bridge プロセスを管理します。SoftEther VPN Bridge はこのコンピュータに接続されているネットワークと遠隔地にある SoftEther VPN Server との間をブリッジ接続します。このサービスが停止された場合は、このコンピュータの SoftEther VPN Bridge は停止し、ブリッジ接続を経由した通信ができなくなります。 + + +# サービス定義 (SoftEther VPN Client) +SVC_SEVPNCLIENTDEV_NAME sevpnclientdev +SVC_SEVPNCLIENTDEV_TITLE SoftEther VPN Client Developer Edition +SVC_SEVPNCLIENTDEV_DESCRIPT SoftEther VPN Client の仮想 LAN カードデバイスドライバおよび接続サービスを管理します。このサービスが停止された場合は、このコンピュータの SoftEther VPN Client を使用して SoftEther VPN Server に接続することができなくなります。 + + +# サービス定義 (SoftEther VPN Server) +SVC_SEVPNSERVERDEV_NAME sevpnserverdev +SVC_SEVPNSERVERDEV_TITLE SoftEther VPN Server Developer Edition +SVC_SEVPNSERVERDEV_DESCRIPT SoftEther VPN Server サーバー プロセスを管理します。SoftEther VPN Server は高性能の SoftEther VPN Server 機能を TCP/IP プロトコルを通じて提供します。このサービスが停止された場合は、このコンピュータの SoftEther VPN Server は停止し、SoftEther VPN Client はこのコンピュータに VPN 接続することができなくなります。 + + +# サービス定義 (SoftEther VPN Bridge) +SVC_SEVPNBRIDGEDEV_NAME sevpnbridgedev +SVC_SEVPNBRIDGEDEV_TITLE SoftEther VPN Bridge Developer Edition +SVC_SEVPNBRIDGEDEV_DESCRIPT SoftEther VPN Bridge プロセスを管理します。SoftEther VPN Bridge はこのコンピュータに接続されているネットワークと遠隔地にある SoftEther VPN Server との間をブリッジ接続します。このサービスが停止された場合は、このコンピュータの SoftEther VPN Bridge は停止し、ブリッジ接続を経由した通信ができなくなります。 + + +# サービス定義 (SoftEther VPN User-mode Router) +SVC_VPNROUTER_NAME vpnrouter +SVC_VPNROUTER_TITLE SoftEther VPN Router Developer Edition +SVC_VPNROUTER_DESCRIPT SoftEther VPN Router (サービスモード) のサーバー プロセスを管理します。SoftEther VPN Router はユーザーモードで動作する仮想 NAT および DHCP サーバーを提供するプログラムで、仮想 IP ネットワークと物理的な IP ネットワークとの間を簡単な操作で安全に接続することができます。このサービスが停止された場合は、このコンピュータの SoftEther VPN Router は停止し、VPN Client はこのコンピュータのルーティングサービスを利用することができなくなります。 + + +# サービス定義 (EtherLogger) +SVC_ELOGSVC_NAME elogsvc +SVC_ELOGSVC_TITLE SoftEther EtherLogger Developer Edition +SVC_ELOGSVC_DESCRIPT SoftEther EtherLogger は、コンピュータに接続されている LAN カードを流れるデータをキャプチャし、管理者が指定した種類のパケットのヘッダまたはすべてのデータをテキストファイルにログとして記録するサービスです。 + + +# SoftEther VPN サーバー管理マネージャ関係 +SM_TITLE SoftEther VPN Developer Edition サーバー管理マネージャ +SM_LOCALHOST localhost (このサーバー) +SM_SERVER_BRIDGE_TITLE VPN Bridge "%S" の管理 +SM_S_VHUB_BRIDGE VPN Bridge では、"BRIDGE" という名前の仮想 HUB に対して操作を行うことで管理します。 +SM_DISCONNECTED 管理用コネクションが切断されました。 +SM_MIKAN 未完成です。 +SM_MAIN_COLUMN_1 接続設定名 +SM_MAIN_COLUMN_2 接続先 VPN Server +SM_MAIN_COLUMN_3 管理対象 +SM_MODE_SERVER サーバー全体 +SM_MODE_HUB %S +SM_EDIT_CAPTION_1 新しい接続設定の作成 +SM_EDIT_CAPTION_2 %s の編集 +SM_SETTING_EXISTS すでに同じ名前の接続設定 "%s" が登録されています。別の名前を指定してください。 +SM_SETTING_DELETE_MSG 接続設定 "%s" を削除します。よろしいですか? +SM_PASSWORD_TYPE_STR 管理接続用パスワード +SM_HUB_COLUMN_1 仮想 HUB 名 +SM_HUB_COLUMN_2 状態 +SM_HUB_COLUMN_3 種類 +SM_HUB_COLUMN_4 ユーザー +SM_HUB_COLUMN_5 グループ +SM_HUB_COLUMN_6 セッション +SM_HUB_COLUMN_7 MAC テーブル +SM_HUB_COLUMN_8 IP テーブル +SM_HUB_COLUMN_9 ログイン回数 +SM_HUB_COLUMN_10 最終ログイン日時 +SM_HUB_COLUMN_11 最終通信日時 +SM_HUB_ONLINE オンライン +SM_HUB_OFFLINE オフライン +SM_HUB_STANDALONE スタンドアロン +SM_HUB_STATIC スタティック仮想 HUB +SM_HUB_DYNAMIC ダイナミック仮想 HUB +SM_SERVER_STANDALONE スタンドアロンサーバー +SM_FARM_CONTROLLER クラスタコントローラ +SM_FARM_MEMBER クラスタメンバサーバー +SM_INFORMATION 最新情報 +SM_HUB_STATUS_CAPTION 仮想 HUB "%s" の状態 +SM_HUB_STATUS_HUBNAME 仮想 HUB 名 +SM_HUB_STATUS_ONLINE 状態 +SM_HUB_TYPE 種類 +SM_HUB_NUM_SESSIONS セッション数 +SM_HUB_NUM_SESSIONS_CLIENT セッション数 (クライアント) +SM_HUB_NUM_SESSIONS_BRIDGE セッション数 (ブリッジ) +SM_HUB_NUM_ACCESSES アクセスリスト数 +SM_HUB_NUM_USERS ユーザー数 +SM_HUB_NUM_GROUPS グループ数 +SM_HUB_NUM_MAC_TABLES MAC テーブル数 +SM_HUB_NUM_IP_TABLES IP テーブル数 +SM_HUB_SECURE_NAT SecureNAT 機能 +SM_HUB_SECURE_NAT_YES 有効 +SM_HUB_SECURE_NAT_NO 無効 +SM_HUB_NUM_LOGIN ログイン回数 +SM_HUB_LAST_LOGIN_TIME 最終ログイン日時 +SM_HUB_LAST_COMM_TIME 最終通信日時 +SM_HUB_CREATED_TIME 作成日時 +SM_STATUS_COLUMN_1 項目 +SM_STATUS_COLUMN_2 値 + +SM_ST_SEND_UCAST_NUM 送信ユニキャストパケット数 +SM_ST_SEND_UCAST_SIZE 送信ユニキャスト合計サイズ +SM_ST_SEND_BCAST_NUM 送信ブロードキャストパケット数 +SM_ST_SEND_BCAST_SIZE 送信ブロードキャスト合計サイズ + +SM_ST_RECV_UCAST_NUM 受信ユニキャストパケット数 +SM_ST_RECV_UCAST_SIZE 受信ユニキャスト合計サイズ +SM_ST_RECV_BCAST_NUM 受信ブロードキャストパケット数 +SM_ST_RECV_BCAST_SIZE 受信ブロードキャスト合計サイズ + +SM_ST_NUM_PACKET_STR %S パケット +SM_ST_SIZE_BYTE_STR %S バイト + +CM_EDIT_HUB_1 仮想 HUB の新規作成 +CM_EDIT_HUB_2 %S のプロパティ + +CM_EDIT_HUB_STANDALONE 現在、サーバーはスタンドアロンモードで動作しています。この仮想 HUB はスタンドアロン HUB として動作します。 +CM_EDIT_HUB_TYPE_FIXED 現在、サーバーはクラスタモードで動作しています。この仮想 HUB の種類は下記のとおりで、動的な変更はできません。 +CM_EDIT_HUB_CREATED 新しい仮想 HUB %S を作成しました。 +CM_OFFLINE_MSG %s をオフラインにしますか?\r\n\r\n仮想 HUB をオフラインにすると、現在仮想 HUB に接続しているすべてのセッションが切断され、新しいセッションが接続できなくなります。 +CM_DELETE_HUB_MSG %S を削除しますか?\r\n\r\n仮想 HUB を削除すると、現在仮想 HUB に接続しているセッションがすべて切断され、新たなセッションが仮想 HUB に接続できなくなります。\r\nまた、仮想 HUB のすべての設定、ユーザー オブジェクト、グループオブジェクト、証明書、およびカスケード接続が削除されます。\r\n\r\n仮想 HUB を削除すると、元に戻すことはできません。\r\n削除しますか? +CM_HUB_DELETED_MSG 仮想 HUB %S を削除しました。 +CM_LISTENER_COLUMN_1 ポート番号 +CM_LISTENER_COLUMN_2 状態 +CM_LISTENER_TCP_PORT TCP %u +CM_LISTENER_ONLINE 動作中 +CM_LISTENER_OFFLINE 停止中 +CM_LISTENER_ERROR エラー発生 +CM_DELETE_LISTENER_MSG リスナー (TCP ポート %u) を削除します。今後、このポートには接続できなくなります。\r\nよろしいですか? +CM_STOP_LISTENER_MSG リスナー (TCP ポート %u) を停止します。リスナーを再開するまで、このポートには接続できなくなります。\r\n\r\nよろしいですか? +CM_CLOSE_BUTTON 閉じる +CM_CERT_SET_MSG 新しいサーバー証明書を設定しました。\r\n\r\nなお、OpenVPN クライアントを使用している場合は、OpenVPN 設定ファイルに埋め込まれている証明書を更新する必要がある場合がありますので、ご注意ください。 +CM_SHORTCUT_DISCONNECT 指定された接続先にすでに接続しています。\r\n\r\n切断しますか? + + + +SM_SERVER_STATUS サーバー状態 +SM_ST_SERVER_TYPE サーバーの種類 +SM_ST_NUM_TCP 開いているソケット数 +SM_ST_NUM_TCP_LOCAL このサーバーのソケット数 +SM_ST_NUM_TCP_REMOTE 他のクラスタメンバサーバーのソケット数合計 +SM_ST_NUM_HUB_TOTAL 仮想 HUB 数 +SM_ST_NUM_HUB_STATIC スタティック仮想 HUB 数 +SM_ST_NUM_HUB_DYNAMIC ダイナミック仮想 HUB 数 +SM_ST_NUM_SESSION_TOTAL セッション数 +SM_ST_NUM_SESSION_LOCAL このサーバーのセッション数 +SM_ST_NUM_SESSION_REMOTE 他のクラスタメンバサーバーのセッション数 +SM_ST_NUM_MAC_TABLE MAC アドレステーブル数 +SM_ST_NUM_IP_TABLE IP アドレステーブル数 +SM_ST_NUM_USERS ユーザー数 +SM_ST_NUM_GROUPS グループ数 +SM_ST_CLIENT_LICENSE 消費クライアント接続ライセンス数 (このサーバー) +SM_ST_BRIDGE_LICENSE 消費ブリッジ接続ライセンス数 (このサーバー) +SM_ST_CLIENT_LICENSE_EX 消費クライアント接続ライセンス数 (クラスタ全体) +SM_ST_BRIDGE_LICENSE_EX 消費ブリッジ接続ライセンス数 (クラスタ全体) +SM_ST_START_TIME サーバー起動時刻 +SM_ST_CURRENT_TIME 現在時刻 +SM_ST_CURRENT_TICK 64 bit 高精度論理システム時刻 +SM_ST_TOTAL_MEMORY 合計論理メモリサイズ +SM_ST_USED_MEMORY 使用中の論理メモリサイズ +SM_ST_FREE_MEMORY 空き論理メモリサイズ +SM_ST_TOTAL_PHYS 合計物理メモリサイズ +SM_ST_USED_PHYS 使用中の物理メモリサイズ +SM_ST_FREE_PHYS 空き物理メモリサイズ +SM_ST_RAM_SIZE_KB %S バイト +SM_INFO_TITLE 接続先 VPN Server バージョン情報 +SM_INFO_PRODUCT_NAME 製品名 +SM_INFO_VERSION バージョン情報 +SM_INFO_BUILD ビルド情報 +SM_INFO_HOSTNAME ホスト名 +SM_OS_SYSTEM_NAME オペレーティングシステム種類 +SM_OS_PRODUCT_NAME オペレーティングシステム製品名 +SM_OS_SERVICE_PACK サービスパック +SM_OS_SP_TAG Service Pack %u +SM_OS_VENDER_NAME オペレーティングシステム製造元 +SM_OS_VERSION オペレーティングシステムバージョン +SM_OS_KERNEL_NAME OS カーネル名 +SM_OS_KERNEL_VERSION OS カーネルバージョン +SM_CONNECTION_TYPE_0 クライアント +SM_CONNECTION_TYPE_1 初期化中 +SM_CONNECTION_TYPE_2 ログイン +SM_CONNECTION_TYPE_3 追加接続 +SM_CONNECTION_TYPE_4 クラスタリング RPC +SM_CONNECTION_TYPE_5 管理用 RPC +SM_CONNECTION_TYPE_6 HUB 列挙 RPC +SM_CONNECTION_TYPE_7 パスワード変更 +SM_CONNECTION_TYPE_8 MS-SSTP 接続 +SM_CONNECTION_TYPE_9 OpenVPN 接続 +SM_CONN_COLUMN_1 コネクション名 +SM_CONN_COLUMN_2 接続元 +SM_CONN_COLUMN_3 接続時刻 +SM_CONN_COLUMN_4 種類 +SM_HOSTNAME_AND_PORT %S:%u +SM_CONN_DISCONNECT_MSG コネクション %s を切断します。\r\nよろしいですか? +SM_CONNINFO_CAPTION コネクション %s の情報 +SM_CONNINFO_NAME コネクション名 +SM_CONNINFO_TYPE コネクションの種類 +SM_CONNINFO_HOSTNAME クライアントホスト名 +SM_CONNINFO_IP クライアント IP アドレス +SM_CONNINFO_PORT クライアントポート番号 (TCP) +SM_CONNINFO_TIME 接続時刻 +SM_CONNINFO_SERVER_STR サーバー製品名 +SM_CONNINFO_SERVER_VER サーバー バージョン +SM_CONNINFO_SERVER_BUILD サーバー ビルド番号 +SM_CONNINFO_CLIENT_STR クライアント製品名 +SM_CONNINFO_CLIENT_VER クライアントバージョン +SM_CONNINFO_CLIENT_BUILD クライアントビルド番号 +SM_FARM_REBOOT_MSG クラスタリング構成を変更しようとしています。\r\n\r\nクラスタリング構成を変更すると、現在接続されているすべてのセッションおよび管理用コネクション (この管理用コネクションを含む) がすべて切断され、サーバー プログラムが再起動します。\r\nサーバーのユーザー数が多い場合は、再起動に数十秒かかる場合もあります。\r\n\r\n[OK] をクリックすると、サーバーとの接続が自動的に切断されます。管理を継続するには、もう一度サーバーに接続し直してください。 +SM_FM_COLUMN_1 種類 +SM_FM_COLUMN_2 接続時刻 +SM_FM_COLUMN_3 ホスト名 +SM_FM_COLUMN_4 ポイント +SM_FM_COLUMN_5 セッション数 +SM_FM_COLUMN_6 TCP コネクション数 +SM_FM_COLUMN_7 動作 HUB 数 +SM_FM_COLUMN_8 消費クライアント接続ライセンス +SM_FM_COLUMN_9 消費ブリッジ接続ライセンス +SM_FM_CONTROLLER コントローラ +SM_FM_MEMBER メンバ +SM_FMINFO_TYPE サーバーの種類 +SM_FMINFO_CONNECT_TIME 接続確立時刻 +SM_FMINFO_IP IP アドレス +SM_FMINFO_HOSTNAME ホスト名 +SM_FMINFO_POINT ポイント +SM_FMINFO_WEIGHT 性能基準比 +SM_FMINFO_NUM_PORT 公開ポート数 +SM_FMINFO_PORT %u 個目の公開ポート (TCP/IP) +SM_FMINFO_NUM_HUB 動作している仮想 HUB 数 +SM_FMINFO_HUB %u 個目の仮想 HUB +SM_FMINFO_HUB_TAG_1 %S (ダイナミック) +SM_FMINFO_HUB_TAG_2 %S (スタティック) +SM_FMINFO_NUM_SESSION セッション数 +SM_FMINFO_NUN_CONNECTION TCP コネクション数 +SM_FMINFO_CAPTION クラスタメンバサーバーの状態 +SM_FC_STATUS_CAPTION クラスタコントローラへの接続状態 +SM_FC_IP コントローラの IP アドレス +SM_FC_PORT コントローラの TCP/IP ポート番号 +SM_FC_STATUS 接続状態 +SM_FC_ONLINE オンライン +SM_FC_OFFLINE オフライン +SM_FC_LAST_ERROR 最後に発生したエラー +SM_FC_ERROR_TAG %s (エラーコード: %u) +SM_FC_START_TIME 接続開始時刻 +SM_FC_FIRST_TIME 最初の接続確立成功時刻 +SM_FC_CURRENT_TIME 現在の接続確立成功時刻 +SM_FC_NUM_TRY 接続試行回数 +SM_FC_NUM_CONNECTED 接続に成功した回数 +SM_FC_NUM_FAILED 接続に失敗した回数 +SM_FC_NOT_CONNECTED (未接続) +SM_CHANGE_PASSWORD_1 確認入力がパスワードと一致しません。[パスワード] と [確認入力] には同一のパスワードを入力してください。 +SM_CHANGE_PASSWORD_2 パスワードが入力されていません。続行しますか? +SM_CHANGE_PASSWORD_3 パスワードを変更しました。 +SM_USER_COLUMN_1 ユーザー名 +SM_USER_COLUMN_2 本名 +SM_USER_COLUMN_3 所属グループ +SM_USER_COLUMN_4 説明 +SM_USER_COLUMN_5 認証方法 +SM_USER_COLUMN_6 ログイン回数 +SM_USER_COLUMN_7 最終ログイン日時 +SM_AUTHTYPE_0 匿名認証 +SM_AUTHTYPE_1 パスワード認証 +SM_AUTHTYPE_2 固有証明書認証 +SM_AUTHTYPE_3 署名済み証明書認証 +SM_AUTHTYPE_4 RADIUS 認証 +SM_AUTHTYPE_5 NT ドメイン認証 +SM_NO_GROUP - +SM_USER_DELETE_MSG ユーザー "%s" を削除します。よろしいですか? +SM_EDIT_USER_CAPTION_1 ユーザーの新規作成 +SM_EDIT_USER_CAPTION_2 ユーザー %S のプロパティ +SM_EDIT_USER_CERT_INFO [固有証明書認証] が選択されているユーザーは、接続時に SSL クライアント証明書が予めユーザーごとに設定された証明書と完全に一致するかどうかで接続を許可または拒否されます。 +SM_EDIT_USER_POL_DLG ユーザー %S のセキュリティポリシー +SM_POLICY_DEF_CAPTION セキュリティポリシー +SM_LIMIT_STR %u ~ %u の範囲の整数値を指定してください。 +SM_POLICY_INIT_TITLE 左のリストからポリシー項目を選択してください。 +SM_USER_CREATE_OK ユーザー %S を作成しました。 +SM_USERINFO_CAPTION ユーザー "%S" の情報 +SM_USERINFO_NAME ユーザー名 +SM_USERINFO_GROUP グループ名 +SM_USERINFO_CREATE 作成日時 +SM_USERINFO_UPDATE 更新日時 +SM_USERINFO_EXPIRE 有効期限 +SM_USERINFO_NUMLOGIN ログイン回数 +SM_GROUPLIST_NAME グループ名 +SM_GROUPLIST_REALNAME 本名 +SM_GROUPLIST_NOTE 説明 +SM_GROUPLIST_NUMUSERS ユーザー数 +SM_EDIT_GROUP_CAPTION_1 グループの新規作成 +SM_EDIT_GROUP_CAPTION_2 グループ %S のプロパティ +SM_GROUP_CREATED グループ %S を作成しました。 +SM_GROUP_DELETE_MSG グループ %S を削除します。よろしいですか? +SM_GROUP_POLICY_CAPTION グループ %S のセキュリティポリシー +SM_GROUP_MEMBER_STR \ (グループ %S に所属しているユーザーのみ表示) +SM_SELECT_GROUP 選択(&S) +SM_SELECT_NO_GROUP なし(&N) +SM_SELECT_ALT_GROUP グループを選択(&G)... +SM_ACCESS_COLUMN_0 ID +SM_ACCESS_COLUMN_1 動作 +SM_ACCESS_COLUMN_2 状態 +SM_ACCESS_COLUMN_3 優先順位 +SM_ACCESS_COLUMN_4 説明 +SM_ACCESS_COLUMN_5 内容 +SM_ACCESS_COLUMN_6 ユニーク ID +SM_ACCESS_PASS 通過 +SM_ACCESS_DISCARD 破棄 +SM_ACCESS_ENABLE 有効 +SM_ACCESS_DISABLE 無効 +SM_ACCESS_PROTO_1 すべての IPv4 / IPv6 プロトコル +SM_ACCESS_PROTO_2 6 (TCP/IP プロトコル) +SM_ACCESS_PROTO_3 17 (UDP/IP プロトコル) +SM_ACCESS_PROTO_4 1 (ICMPv4 プロトコル) +SM_ACCESS_PROTO_5 58 (ICMPv6 プロトコル) +SM_ACCESS_PROTO_6 IP プロトコル番号を指定 +SM_SELECT_USER 選択(&S) +SM_SELECT_NO 選択しない(&N) +SM_PLEASE_SELECT ユーザーを選択してください。 +SM_LINK_COLUMN_1 接続設定名 +SM_LINK_COLUMN_2 状態 +SM_LINK_COLUMN_3 接続完了時刻 +SM_LINK_COLUMN_4 接続先 VPN Server +SM_LINK_COLUMN_5 接続先仮想 HUB +SM_LINK_STATUS_OFFLINE オフライン (停止中) +SM_LINK_STATUS_ERROR エラー%u:%s +SM_LINK_STATUS_ONLINE オンライン (接続済み) +SM_LINK_POLICY_GROUP カスケード接続の設定 +SM_LINK_POLICY_CAPTION カスケードセッションに適用するセキュリティポリシーの設定 +SM_LINK_CONNECTING 接続処理中 +SM_LINK_SAVE_ONLINE カスケード接続設定 "%s" を変更しましたが、現在このカスケード接続はオンラインのため、次回接続時まで設定は適用されません。 +SM_LINK_DELETE_MSG カスケード接続 "%s" の設定を削除します。よろしいですか? +SM_LINK_OFFLINE_MSG カスケード接続 "%s" は現在接続中です。接続を切断しますか? +SM_LINK_STATUS_CAPTION カスケード接続 "%s" の接続状況 +SM_LOG_SWITCH_0 切り替えを行わない +SM_LOG_SWITCH_1 1 秒単位で切り替える +SM_LOG_SWITCH_2 1 分単位で切り替える +SM_LOG_SWITCH_3 1 時間単位で切り替える +SM_LOG_SWITCH_4 1 日単位で切り替える +SM_LOG_SWITCH_5 1 ヶ月単位で切り替える +SM_SESS_DISCONNECT_MSG セッション "%S" を切断します。よろしいですか? +SM_SESS_COLUMN_1 セッション名 +SM_SESS_COLUMN_2 場所 +SM_SESS_COLUMN_3 ユーザー名 +SM_SESS_COLUMN_4 接続元ホスト名 +SM_SESS_COLUMN_5 TCP コネクション +SM_SESS_COLUMN_6 転送バイト数 +SM_SESS_COLUMN_7 転送パケット数 +SM_SESS_COLUMN_8 VLAN ID +SM_SESS_NORMAL ローカルセッション +SM_SESS_LOCAL ローカルセッション +SM_SESS_LOCAL_2 %S 上 +SM_SESS_REMOTE %S 上 +SM_SESS_LINK カスケード接続 +SM_SESS_LINK_HOSTNAME 仮想ホスト +SM_SESS_LINK_TCP なし +SM_SESS_SNAT SecureNAT セッション +SM_SESS_SNAT_HOSTNAME 仮想ホスト +SM_SESS_SNAT_TCP なし +SM_SESS_BRIDGE ローカルブリッジセッション +SM_SESS_BRIDGE_HOSTNAME Ethernet ブリッジ +SM_SESS_LAYER3_HOSTNAME 仮想レイヤ 3 スイッチ +SM_SESS_BRIDGE_TCP なし +SM_SESS_STATUS_CAPTION VPN セッション "%S" の状況 +SM_SESS_STATUS_USERNAME ユーザー名 (認証) +SM_SESS_STATUS_REALUSER ユーザー名 (データベース) +SM_SESS_STATUS_GROUPNAME グループ名 +SM_CLIENT_IP クライアント IP アドレス +SM_CLIENT_HOSTNAME クライアントホスト名 +SM_NODE_CLIENT_NAME クライアント製品名 (申告) +SM_NODE_CLIENT_VER クライアントバージョン (申告) +SM_NODE_CLIENT_BUILD クライアントビルド番号 (申告) +SM_NODE_SERVER_NAME サーバー製品名 (申告) +SM_NODE_SERVER_VER サーバーバージョン (申告) +SM_NODE_SERVER_BUILD サーバービルド番号 (申告) +SM_NODE_CLIENT_OS_NAME クライアント OS 名 (申告) +SM_NODE_CLIENT_OS_VER クライアント OS バージョン (申告) +SM_NODE_CLIENT_OS_PID クライアント OS プロダクト ID (申告) +SM_NODE_CLIENT_HOST クライアントホスト名 (申告) +SM_NODE_CLIENT_IP クライアント IP アドレス (申告) +SM_NODE_CLIENT_PORT クライアントポート番号 (申告) +SM_NODE_SERVER_HOST サーバーホスト名 (申告) +SM_NODE_SERVER_IP サーバー IP アドレス (申告) +SM_NODE_SERVER_PORT サーバーポート番号 (申告) +SM_NODE_PROXY_HOSTNAME 経由プロキシホスト名 (申告) +SM_NODE_PROXY_IP 経由プロキシ IP アドレス (申告) +SM_NODE_PROXY_PORT 経由プロキシポート番号 (申告) +SM_MAC_COLUMN_1 セッション名 +SM_MAC_COLUMN_2 MAC アドレス +SM_MAC_COLUMN_3 作成時刻 +SM_MAC_COLUMN_4 更新時刻 +SM_MAC_COLUMN_5 場所 +SM_MAC_COLUMN_1A VLAN ID +SM_SESSION_FILTER \ (セッション %S のエントリのみ表示) +SM_IP_COLUMN_1 セッション名 +SM_IP_COLUMN_2 IP アドレス +SM_IP_COLUMN_3 作成時刻 +SM_IP_COLUMN_4 更新時刻 +SM_IP_COLUMN_5 場所 +SM_MAC_IP_DHCP %S (DHCP) +SM_MACIP_LOCAL このサーバー上 +SM_MACIP_SERVER %S 上 +SM_SNAT_STATUS SecureNAT の動作状況 +SM_SNAT_NUM_SESSION %u セッション +SM_SNAT_NUM_CLIENT %u クライアント +SM_SNAT_IS_KERNEL カーネルモード NAT で動作中 +SM_SNAT_IS_RAW Raw IP モード NAT で動作中 +SM_BRIDGE_TOO_OLD_VER 現在接続している VPN Server のバージョンでは、ローカルブリッジ機能はサポートされていません。\r\n新しいバージョンにアップデートしてみてください。 +SM_BRIDGE_UNSUPPORTED この VPN Server が動作しているオペレーティングシステム上では、ローカルブリッジ機能を使用することはできません。ローカルブリッジ機能が使用できるオペレーティングシステムの一覧については、VPN Server のオンラインドキュメントを参照してください。 +SM_BRIDGE_WPCAP_REMOTE この VPN Server 上でローカルブリッジ機能を使用するためには、WinPcap ソフトウェアをインストールする必要があります。現在、サーバー コンピュータ上には WinPcap ソフトウェアがインストールされていません。\r\n\r\nWinPcap ソフトウェアのインストールを続行するためには、VPN Server が動作しているサーバー コンピュータ上で SoftEther VPN サーバー管理マネージャを起動し、localhost (自分自身) に対して接続した状態で、ローカルブリッジ機能設定画面を表示する必要があります。\r\n続行するには、一旦この管理セッションを終了し、サーバー コンピュータ上で SoftEther VPN サーバー管理マネージャを起動してから、localhost に対して接続して、設定を続行してください。 +SM_BRIDGE_WPCAP_ROOT この VPN Server 上でローカルブリッジ機能を使用するためには、WinPcap ソフトウェアをインストールする必要があります。\r\n\r\nインストールを継続するには、このコンピュータ上で Administrators (管理者) 権限を持ったユーザーでログオンする必要があります。\r\nAdministrators 権限でログオンし、もう一度 SoftEther VPN サーバー管理マネージャを起動してください。 +SM_BRIDGE_WPCAP_INSTALL この VPN Server 上でローカルブリッジ機能を使用するためには、WinPcap ソフトウェアをインストールする必要があります。現在、サーバー コンピュータ上には WinPcap ソフトウェアがインストールされていません。\r\n\r\nWinPcap はフリーソフトウェアであり、VPN Server の一部として同梱されているため、簡単にインストールすることができます。\r\n\r\nWinPcap のインストールを開始しますか? +SM_BRIDGE_WPCAP_REBOOT1 WinPcap のインストールが完了した後にローカルブリッジ機能を使用する場合は、コンピュータを再起動する必要があります。\r\n\r\nコンピュータを手動で再起動し、VPN Server が起動した後、ローカルブリッジ機能の設定を行ってください。 +SM_BRIDGE_WPCAP_REBOOT2 WinPcap のインストールが完了した後にローカルブリッジ機能を使用する場合は、SoftEther VPN Server サービスを再起動する必要があります。\r\n\r\nSoftEther VPN Server サービスの再起動は短時間で完了しますが、現在この VPN Server に接続しているセッションはすべて切断されます。\r\nこの管理セッションも切断されるため、続行するには再接続してください。\r\n\r\nSoftEther VPN Server サービスを再起動しますか? +SM_BRIDGE_RESOURCE WinPcap のドライバを読み込めませんでした。 +SM_BRIDGE_COLUMN_1 番号 +SM_BRIDGE_COLUMN_2 仮想 HUB 名 +SM_BRIDGE_COLUMN_3 ブリッジ先 LAN カードまたは tap デバイス名 +SM_BRIDGE_COLUMN_4 状態 +SM_BRIDGE_OFFLINE オフライン +SM_BRIDGE_ONLINE 動作中 +SM_BRIDGE_ERROR エラー発生 +SM_BRIDGE_OK ローカルブリッジ接続の定義を追加しました。 +SM_BRIDGE_DELETE 仮想 HUB "%s" からデバイス "%s" までのローカルブリッジを削除しますか? +SM_BRIDGE_DELETE_OK ローカルブリッジを削除しました。 +SM_BRIDGE_INTEL 物理的な LAN カードに対してブリッジを行う場合、新しいブリッジ接続を作成した直後の状態では、一部の LAN カードでは仮想ネットワーク内のコンピュータからブリッジ接続に使用している LAN カード自身に対する TCP/IP 通信が正しく行えない場合があります。\r\n(特に、Intel や Broadcom 製 LAN カードなどでこの現象が発生する場合があります。)\r\n\r\n\r\nその場合は、一度 VPN Server / Bridge が動作しているコンピュータを再起動してください。コンピュータの再起動後に正しく通信することができるようになります。\r\n\r\n\r\nまた、大半の無線 LAN アダプタはプロミスキャスモードでのパケットの送受信に対応していない場合が多いため、ローカルブリッジに使用できない場合があります。このような場合は、無線 LAN アダプタではなく通常の LAN カードの使用を検討してください。 +SM_BRIDGE_VPN "%S" に対してローカルブリッジ接続しようとしています。\r\n\r\n通常は、仮想 HUB と物理的な LAN カードとの間でローカルブリッジ接続を行います。仮想 LAN カード等に対してローカルブリッジ接続を行う必要があることはあまりありません。\r\nこれが意図した操作であるかどうか、もう一度確認してください。\r\n\r\n本当に続行しますか? +SM_BRIDGE_INFO_1 ブリッジ先の Ethernet デバイス (LAN カード) を選択してください。 +SM_BRIDGE_INFO_2 新しく作成する tap デバイスの名前を入力してください。 +SM_CONFIG_SAVED コンフィグレーションファイルを保存しました。 +SM_CONFIG_SAVE_FAILED コンフィグレーションファイルの保存に失敗しました。 +SM_CONFIG_OPEN_FAILED 指定したファイルを開けませんでした。 +SM_CONFIG_CONFIRM 指定されたコンフィグレーションファイルを VPN Server に書き込みます。VPN Server は自動的に再起動し、新しいコンフィグレーションファイルの内容で起動します。現在 VPN Server に接続中のユーザーは一旦切断されます。この管理セッションも切断されますので、再度サーバーに接続し直してください。\r\n\r\n続行しますか? +SM_CONFIG_WRITE_OK サーバー側のコンフィグレーションファイルを書き換えました。 +SM_AO_COLUMN_1 値の名前 +SM_AO_COLUMN_2 設定値 +SM_TRUE_OR_FALSE この項目は 0 (false) または 1 (true) で設定してください。 +SM_AO_SET_OK 仮想 HUB の管理オプションを設定しました。 +SM_EXT_OPTION_SET_OK 仮想 HUB の拡張オプションを設定しました。 +SM_PASSWORD_MSG 現在、接続先の VPN Server には管理者パスワードが設定されていません。パスワードを設定することをお勧めします。\r\n\r\nサーバー管理者パスワードを設定しますか? +SM_L3_SW_COLUMN1 レイヤ 3 スイッチ名 +SM_L3_SW_COLUMN2 動作状況 +SM_L3_SW_COLUMN3 インターフェイス数 +SM_L3_SW_COLUMN4 ルーティングテーブル数 +SM_L3_SW_ST_F_F 停止 +SM_L3_SW_ST_T_F 開始 (エラー) +SM_L3_SW_ST_T_T 開始 (動作中) +SM_L3_SW_DEL_MSG 仮想レイヤ 3 スイッチ "%S" を削除します。\r\nよろしいですか? +SM_L3_SW_IF_COLUMN1 IP アドレス +SM_L3_SW_IF_COLUMN2 サブネットマスク +SM_L3_SW_IF_COLUMN3 仮想 HUB 名 +SM_L3_SW_TABLE_COLUMN1 ネットワークアドレス +SM_L3_SW_TABLE_COLUMN2 サブネットマスク +SM_L3_SW_TABLE_COLUMN3 ゲートウェイアドレス +SM_L3_SW_TABLE_COLUMN4 メトリック +SM_SECURE_NAT_MSG SecureNAT 機能を本当に有効にしますか?\r\n\r\nSecureNAT 機能を有効にすると、仮想 HUB の中に IP アドレスを 1 つ持った仮想の NAT 機能付きルータが生成されます。この仮想ルータは仮想 LAN にアクセスできるコンピュータからは 1 台のコンピュータまたはルータに見えます。\r\n\r\nSecureNAT の仮想 NAT 機能は、仮想 HUB に接続している任意のコンピュータに対して、SecureNAT 機能を動作させているコンピュータを経由して外部ネットワークと通信可能にします。\r\nしたがって、この VPN Server で SecureNAT を動作させた場合、同一のコンピュータから localhost (自分自身) に対して仮想 LAN カードを接続する必要はありません。(SecureNAT が動作しているコンピュータが自分自身に対して仮想 LAN カードを接続すると、設定によってはパケットが無限ループすることがあります。)\r\n\r\n\r\nまた、すでに仮想 HUB の レイヤ 2 セグメントから到達可能な場所に DHCP サーバーが存在する場合は、DHCP の競合が発生するため、[SecureNAT の設定] をクリックして DHCP サーバー機能を無効にしてください。\r\n\r\nまた、NAT 機能を無効にして DHCP サーバーとしてのみ使用することもできます。 +SM_CRL_COLUMN_1 証明書の概要 +SM_CRL_DELETE_MSG 選択した項目を削除します。よろしいですか? +SM_CRL_EMPTY_MSG 項目が 1 つも選択されていません。\r\nこの無効な証明書エントリが追加されると、すべての証明書が無効として判断され、証明書認証モードで接続しようとするすべてのクライアントの接続が拒否されます。\r\n\r\nよろしいですか? +SM_AC_COLUMN_1 ID +SM_AC_COLUMN_2 優先順位 +SM_AC_COLUMN_3 動作 +SM_AC_COLUMN_4 内容 +SM_AC_PASS 許可 +SM_AC_DENY 拒否 +SM_LOG_FILE_COLUMN_1 ログファイル名 +SM_LOG_FILE_COLUMN_2 ファイルサイズ +SM_LOG_FILE_COLUMN_3 更新日時 +SM_LOG_FILE_COLUMN_4 場所 +SM_READ_LOG_FILE_INFO_1 処理中につきしばらくお待ちください... +SM_READ_LOG_FILE_INFO_2 %S 中 %S が完了しました... +SM_READ_LOG_FILE_ERROR ファイルのダウンロードは正しく完了しませんでした。 +SM_READ_SAVE_DLG_TITLE ログファイルの保存先ファイル名を指定してください +SM_READ_SAVE_DLG_FILTER ログファイル (*.LOG)|*.log|すべてのファイル (*.*)|*.* +SM_READ_SAVE_FAILED ログファイルの保存に失敗しました。 +SM_READ_SAVE_TMP_FAILED 一時ファイル "%S" に書き込めませんでした。 +SM_READ_SAVE_OPEN_ERROR 一時ファイル "%S" を開くことができませんでした。\r\n\r\n拡張子が .LOG のファイルが Windows によって関連付けられていない可能性があります。 +SM_LICENSE_COLUMN_1 番号 +SM_LICENSE_COLUMN_2 ライセンスキー +SM_LICENSE_COLUMN_3 ライセンス種類名 +SM_LICENSE_COLUMN_4 状態 +SM_LICENSE_COLUMN_5 有効期限 +SM_LICENSE_COLUMN_6 ライセンス ID +SM_LICENSE_COLUMN_7 ライセンス種類 ID +SM_LICENSE_COLUMN_8 サーバー ID +SM_LICENSE_COLUMN_9 シリアル ID +SM_LICENSE_INFINITE 無制限 +SM_LICENSE_NO_EXPIRES 無期限 +SM_LICENSE_STATUS_EDITION 製品エディション名 +SM_LICENSE_STATUS_RELEASE この VPN Server のリリース日付 +SM_LICENSE_STATUS_SYSTEM_ID 現在のサーバー ID +SM_LICENSE_STATUS_EXPIRES 現在の製品ライセンスの有効期限 +SM_LICENSE_STATUS_SUBSCRIPTION サブスクリプション契約の状態 +SM_LICENSE_STATUS_SUBSCRIPTION_NONEED 契約なし (このエディションではサブスクリプションキーは不要) +SM_LICENSE_STATUS_SUBSCRIPTION_NONE キー登録まだ (このエディションではサブスクリプションキーの登録が必須) +SM_LICENSE_STATUS_SUBSCRIPTION_VALID 契約済み [契約期間: %s まで] +SM_LICENSE_STATUS_SUBSCRIPTION_EXPIRED 契約期限切れ [契約期間: %s まで] +SM_LICENSE_STATUS_SUBSCRIPTION_BUILD 現在の契約で利用可能なバージョン +SM_LICENSE_STATUS_SUBSCRIPTION_BUILD_STR %s までにリリースされる全バージョンに無償アップグレード可能 +SM_LICENSE_STATUS_ENTERPRISE エンタープライズ機能の利用可否 +SM_LICENSE_STATUS_ENTERPRISE_YES はい (利用可能) +SM_LICENSE_STATUS_ENTERPRISE_NO いいえ (利用不可能) +SM_LICENSE_NUM_USER ユーザー作成可能数 +SM_LICENSE_NUM_CLIENT クライアント同時接続可能数 +SM_LICENSE_NUM_BRIDGE ブリッジ同時接続可能数 +SM_NO_LICENSE_COLUMN ご注意: +SM_NO_LICENSE 製品ライセンスが 1 つも登録されていないため、この VPN Server の通信機能は動作しません。 +SM_LICENSE_DELETE_MSG 選択されたライセンスを VPN Server から削除しますか? +SM_SYSLOG_0 syslog 送信機能を使用しない +SM_SYSLOG_1 サーバーログを syslog で送信 +SM_SYSLOG_2 サーバーおよび仮想 HUB セキュリティログを syslog で送信 +SM_SYSLOG_3 サーバー、仮想 HUB セキュリティおよびパケットログを syslog で送信 +SM_SETUP_INFO_1 [次へ] をクリックすると、セットアップを開始します。[閉じる] をクリックすると、このセットアップ画面を閉じ、手動ですべての設定を行うことができます。 +SM_SETUP_INFO_2 高度な機能を用いた VPN サーバーの設定を行うには、[閉じる] をクリックしてください。 +SM_SETUP_BRIDGE_ONLY 現在 VPN Bridge に接続しているため、[拠点間接続 VPN] における [各拠点に設置する VPN Bridge] のみを構築できます。 +SM_SETUP_BRIDGE_EDGE 各拠点に設置する VPN Bridge (&E) +SM_SETUP_WARNING 続行すると、この VPN Server または VPN Bridge の現在の設定内容は、簡易セットアップで指定した内容に初期化されます。\r\nよろしいですか? +SM_SETUP_SELECT ブリッジ接続する Ethernet デバイスを選択してください +SM_SETUP_NO_LICENSE_KEY この SoftEther VPN Server には、有効なライセンスキーが登録されていません。\r\n\r\nSoftEther VPN Server が VPN サーバーとして動作するには、ライセンスキーの登録が必要です。\r\nライセンスの管理画面を表示しますか?\r\n\r\n(体験版として使用する場合は、ソフトイーサ株式会社の Web サイトにアクセスして体験版のライセンスキーを取得する必要があります。\r\n[はい] をクリックしてから [ライセンスの入手・更新] ボタンをクリックすると、体験版のライセンスキーを入手できます。) +SM_HUBEXT_OPTION_TITLE 仮想 HUB 拡張オプション +SM_HUBEXT_OPTION_STATIC1 仮想 HUB 拡張オプションを使用すると、この仮想 HUB に関するより詳細な設定を行うことができるようになります。 +SM_HUBEXT_OPTION_STATIC2 標準では、VPN Server 全体の管理者および仮想 HUB 管理者の両方とも、仮想 HUB 拡張オプションを編集することができます。\r\nただし、仮想 HUB 管理オプションの deny_hub_admin_change_ext_option が 1 に設定されている場合は、仮想 HUB の管理者は、拡張オプションを編集することができません (設定内容を表示することはできます)。 +SM_VLAN_COLUMN_0 LAN カード名 +SM_VLAN_COLUMN_1 ドライバ種類 +SM_VLAN_COLUMN_2 ドライバファイル名 +SM_VLAN_COLUMN_3 VLAN 透過設定 +SM_VLAN_COLUMN_4 GUID +SM_VLAN_COLUMN_5 デバイスインスタンス ID +SM_VLAN_YES 設定済み +SM_VLAN_NO 未設定 +SM_VLAN_MSG_1 LAN カード "%S" でタグ VLAN パケットが透過するようにレジストリを設定しました。\r\n\r\nなお、一部の LAN カードでは、別途、対象の Windows コンピュータにログオンして、デバイスマネージャから LAN カードのプロパティを開き、ジャンボフレーム (フレームサイズが 1,514 バイト以上の Ethernet フレーム) の送受信を有効にする必要がある場合があります。ジャンボフレームの設定を行わないと、タグ VLAN パケットのうちフレームサイズが最大のものの送受信に失敗する可能性があります。大きなサイズのパケットのみ送受信が不安定な場合は、必ずジャンボフレームを有効化してください (例えば、最大パケットサイズを 4,088 バイトに設定してください) 。設定方法については、Windows のデバイスマネージャから LAN カードの設定を開くか、または LAN カードのドキュメントを参考にしてください。\r\n\r\nなお、今回の設定変更の内容は Windows レジストリに書き込まれましたが、必ずしも今回の設定変更によってタグ VLAN パケットが透過するようになることが保証される訳ではありません。\r\nこの設定を行った後タグ VLAN パケットの送受信が正常に行えない場合は、LAN カード "%S" のドキュメントを参照して適切に手動で設定してください。また、LAN カード "%S" がそもそもタグ VLAN パケットに対応していない可能性もあります。そのような場合は、その LAN カードはタグ VLAN パケットの送受信に使用できませんので、別の種類の LAN カードをローカルブリッジ用にご利用ください。\r\n\r\n今回の設定内容を適用するためには、対象の Windows コンピュータを再起動する必要があります。忘れずに必ず再起動してください。 +SM_VLAN_MSG_2 LAN カード "%S" に設定されていたタグ VLAN パケットが透過するようにするための設定をレジストリから削除しました。\r\n\r\nなお、以前にタグ VLAN パケットの透過を実現するために LAN カードにジャンボフレームを利用可能とするための設定を行った場合で、今後ジャンボフレームの利用が不要だと思われる場合は、手動でジャンボフレームの設定を解除してください。\r\n\r\n今回の設定内容を適用するためには、対象の Windows コンピュータを再起動する必要があります。忘れずに必ず再起動してください。 +SM_VLAN_NOTHING 現在、コンピュータ "%S" には、タグ VLAN パケット透過設定ツールが対応している物理的な LAN カードは 1 枚もありません。\r\n\r\nただし、現在このタグ VLAN パケット透過設定ツールが対応していない LAN カードでも、タグ VLAN がデフォルトで透過可能か、または何らかの設定を行うことにより透過可能になることがあります。\r\nその場合は、システム管理者が自ら Windows にログインし、そのような設定を行う必要があります。 +SM_SERVER_ADMIN_MSG VPN Server / Bridge "%S" +SM_ETHERIP_COLUMN_0 ISAKMP Phase 1 ID +SM_ETHERIP_COLUMN_1 仮想 HUB 名 +SM_ETHERIP_COLUMN_2 ユーザー名 +SM_ETHERIP_ADD_OK 新しい EtherIP / L2TPv3 クライアントの接続設定を追加しました。 +SM_IPSEC_SETUP_QUESTION この VPN Server は IPsec / L2TP / EtherIP / L2TPv3 対応の VPN クライアントやルータ製品などからの接続を受け付けることができる機能を有しています。\r\n\r\nこの VPN Server が iPhone、iPad、Android などのスマートフォンや Mac OS X、Windows などに搭載されている VPN クライアント機能からの接続を受け付けることができるように IPsec の設定を行うことができます。\r\n\r\nIPsec の設定を行いますか?\r\n(この設定は後から [IPsec / L2TP 設定] ボタンをクリックしていつでも行うことができます。) +SM_OPENVPN_CONFIG_SAVE_OK OpenVPN 設定ファイルを格納した ZIP ファイルを '%s' に保存しました。\r\n\r\nこの ZIP ファイルを開くと、OpenVPN クライアントで使用できる設定ファイルのサンプルが展開できます。\r\nなお、設定ファイルは実際に使用する前には環境に応じて修正する必要がある場合があります。\r\n\r\n詳しくは ZIP ファイル内の 'readme.txt' ファイルをお読みください。\r\n\r\nこの ZIP ファイルを今すぐ開きますか? +SM_OPENVPN_CONFIG_SAVE_NG ZIP ファイル '%s' の保存に失敗しました。 +SM_OPENVPN_CONFIG_OPEN_NG ZIP ファイル '%s' を開こうとして失敗しました。手動でこのファイルを開いてください。 +SM_DDNS_IPV4_ERROR IPv4 の DDNS サーバーに到達できません。 +SM_DDNS_IPV6_ERROR IPv6 の DDNS サーバーに到達できません。 +SM_DDNS_FQDN_EMPTY (なし) +SM_DDNS_OK_MSG ダイナミック DNS ホスト名: %S%S\r\n\r\n上記の DNS ホスト名を指定することにより、この VPN Server のグローバル IP アドレスである以下の IP アドレスにアクセスすることができます。\r\n\r\nIPv4 アドレス: %s\r\nIPv6 アドレス: %s\r\n\r\nなお、以下のような DNS ホスト名を指定することにより、IPv4 アドレスまたは IPv6 アドレスのいずれかのみを明示的に応答させることができます。\r\n\r\nIPv4 のみを応答するホスト名: %S.v4%S\r\nIPv6 のみを応答するホスト名: %S.v6%S\r\n +SM_DDNS_OK_TITLE ダイナミック DNS 機能 +SM_DDNS_OK_MSG2 ダイナミック DNS ホスト名を '%S' に変更しました。\r\n\r\n[ヒント] ボタンをクリックして追加情報をお読みください。 +SM_DDNS_KEY_TITLE ダイナミック DNS 秘密鍵 +SM_DDNS_KEY_MSG ダイナミック DNS 秘密鍵: %s\r\n\r\nこの秘密鍵は、現在使用している DDNS 名と対応付けられています。現在 VPN Server として使用している PC が破損するなどして、この秘密鍵が失われると、その時設定されていた DDNS 名は占有されたままの状態となり、他の VPN Serverで使用できなくなります。同じ名前を継続して使用したい場合は、秘密鍵を他の PC やインタネット上のストレージ、メモ用紙などに保管しておいてください。\r\n秘密鍵を新しい VPN Server に設定する際は、VPN Server の設定ファイルを編集します。"declare DDnsClient" ディレクティブ中にある "byte Key" に続く値を、保管しておいた秘密鍵の文字列で置き換えてください。\r\nなお、同時に複数の VPN Server で同じ秘密鍵を設定すると正常に動作しなくなりますので注意してください。 +SM_DDNS_KEY_ERR DNS 鍵の取得に失敗しました。 +SM_IPSEC_PSK_TOO_LONG 事前共有鍵 (PSK) の長さが 10 文字以上に設定されています。\r\n\r\nAndroid 携帯電話の一部のバージョンにはバグがあり、事前共有鍵が 10 文字以上の場合は VPN 接続が行えない場合があります。\r\nそのため、事前共有鍵の長さは 9 文字以下とすることを推奨します。\r\n\r\n事前共有鍵の設定を見直しますか? +SM_ADVANCED_REDIRECT_URL_HINT_TITLE 高度な HTTP リダイレクション機能の使い方 +SM_ADVANCED_REDIRECT_URL_HINT 高度な HTTP リダイレクション機能 (上級者向け)\r\n\r\nアクセスリストに HTTP リダイレクト先の URL を記載する際に、URL の一部として という文字列を埋め込むことができます。これにより、リダイレクト先の URL を受取った CGI などで、VPN 接続を行っているクライアントの情報を用いた高度な処理を実行することができます。\r\n\r\n埋め込み URL 例:\r\nhttp://www.google.com/search?q=|secret\r\n\r\n実際にクライアントがリダイレクトされる際には、当該文字列部分が以下のような文字列に置換されます。\r\n\r\nユーザー名|セッション ID|IP アドレス|日付と時刻|ハッシュ値\r\n\r\n置換後の例: zurukko|SID-ZURUKKO-123|219.117.219.154|20131117100354|99707160AFE7A454042B2C47B064112D652452D7\r\n\r\nここで、上記の各フィールドの値の内容の詳細は以下のとおりです。\r\n\r\nユーザー名: VPN 接続を行っているユーザー名が代入されます。\r\n\r\nセッション ID: 当該 VPN セッションの ID が代入されます。\r\n\r\n日付と時刻: 'YYYYMMDDHHMMSS' の形式で 14 桁の数字が代入されます (タイムゾーンは UTC)。\r\n\r\nハッシュ値: ハッシュ値直前までの上記フィールドのビット列に URL 中の文字 '|' 以降の末尾までの文字列 (上記の例では "secret" という文字列) のビット列とを連結し SHA-1 ハッシュ関数を適用した結果の 20 バイトを 16 進数で表記した 40 文字の文字列。なお、URL 中に文字 '|' が存在しない場合はハッシュ値は付与されません。\r\n\r\nハッシュ値の存在意義について: ハッシュ文字列 (上記の例では "secret" という文字列) は秘密鍵として機能します。これにより、リダイレクト先でクエリ文字列を受取った CGI は受取った文字列がクライアントによって不正に改ざんされていないことを確認できます。\r\n +SM_ADVANCED_REDIRECT_URL_MSG URL は "http://" または "https://" で始まる必要があります。 +SM_DISABLE_DDNS_HINT_CAPTION ダイナミック DNS 機能を無効にする +SM_DISABLE_DDNS_HINT ダイナミック DNS 機能を無効にするには、VPN Server の設定ファイルを編集します。\r\n\r\n"declare root" ディレクティブ内に "declare DDnsClient" ディレクティブがあります。この中にある "bool Disable" の値を true に設定して VPN Server を再起動することにより、ダイナミック DNS 機能が無効になります。\r\n +SM_REGENERATE_CERT_MSG VPN Server のサーバー証明書を新しいものに置換します。\r\n\r\nこれにより、古いサーバー証明書に接続することを前提に設定されていた VPN Client はこの VPN Server に接続できなくなる可能性があります。\r\nよろしいですか? +SM_DDNS_SERVER_CERT_MSG DDNS ホスト名を "%S" に変更しました。\r\n\r\nこの VPN Server に Microsoft SSTP VPN プロトコルを用いて Windows Vista 以降のバージョンの Windows の組み込み SSTP VPN クライアントから接続する場合は、VPN クライアント側で接続先 VPN サーバー名として指定するホスト名 (DNS 名) の文字列と、この VPN Server の SSL サーバー証明書の CN (Common Name) の文字列とが完全一致している必要があります。\r\n\r\nこの VPN Server の SSL サーバー証明書の CN が "%S" となるようにサーバー証明書を再生成しますか?\r\n([いいえ] をクリックすると、現在の SSL サーバー証明書が引き続き使用されます。) +SM_DDNS_SERVER_CERT_OK VPN Server の SSL 証明書を再生成しました。\r\n\r\nこの VPN Server に Microsoft SSTP VPN クライアントから接続する場合は、現在の DDNS ホスト名 "%S" を接続先サーバー名として指定することを推奨します。\r\nまた、SSTP VPN クライアントとなる Windows 上の「信頼できるルート証明書」にあらかじめこの VPN Server の証明書ファイルをインストールしておく必要があります。\r\n(ルート証明書を Windows にインストールするには、MMC の「証明書」で「ローカル コンピュータ」の証明書ストアを開き、「信頼できるルート証明書」にこの VPN Server の証明書ファイルを追加します。\r\n 詳しくは Microsoft 社のドキュメントを参照してください。)\r\n\r\n新しい VPN Server の SSL 証明書を X.509 形式の証明書ファイルに保存しますか? +SM_SETUP_STEP_SECURENAT この VPN Server / Bridge はユーザーモードで起動しているか、OS がローカルブリッジ非対応のため、仮想 HUB と物理的な LAN カードとをブリッジできません。代わりに「SecureNAT」機能を使用すれば、接続してきた VPN クライアントは仮想 NAT を経由して LAN 上のコンピュータにアクセスできるようになります。 +SM_SETUP_STEP_SECURENAT_TITLE 3. 仮想 HUB と物理的な LAN との接続 +SM_UPDATE_CHECK_TITLE_VPNSERVER %S VPN Server (サーバー '%S' 上) +SM_UPDATE_CHECK_TITLE_VPNBRIDGE %S VPN Bridge (サーバー '%S' 上) +SM_FACTORY_DEFAULT_WARNING VPN Server / Bridge の設定をリセットします。\r\nVPN Server / Bridge の現在の設定は消去され、直ちに初期設定 (インストール直後の設定) に戻ります。\r\nリセットを実行する前に、現在の設定ファイルをバックアップしておくことを推奨します。\r\n\r\n[OK] をクリックするとリセットを実行します。VPN Server / Bridge サービスは再起動し現在の VPN サーバー管理マネージャの接続は切断されますので、その後に VPN Server / Bridge に再接続してください。\r\n再接続を行うと、設定がリセットされた後の VPN Server にアクセスできます。 +SM_FACTORY_DEFAULT_PERFORMED 設定のリセット処理はサーバー上で開始されました。\r\n\r\nOk をクリックすると現在の VPN サーバー管理マネージャのセッションを終了します。\r\n終了した後に、VPN サーバー管理マネージャを再度起動して VPN Server に再接続してください。\r\n再接続すると、設定がリセットされた後の VPN Server が出現します。 +SM_AZURE_STATUS_CONNECTED 状態: クラウドに接続完了 +SM_AZURE_STATUS_NOT_CONNECTED 状態: クラウドに未接続 +SM_NO_BRIDGE_NICS ローカルブリッジを作成することができる物理的な LAN カードが VPN サーバーのコンピュータに 1 枚も見つかりませんでした。\r\n\r\nローカルブリッジを作成するには、物理的な LAN カードを 1 枚以上コンピュータにインストールする必要があります。\r\n無線 LAN カード、3G アダプタ等は使用できません。\r\n通常のケーブル接続の Ethernet に対応した LAN カードをインストールしてください。\r\n\r\n最近インストールした LAN カードが表示されない場合は、一度コンピュータを再起動してください。\r\n\r\nローカルブリッジを使用できない場合は、代わりに「SecureNAT 機能」の仮想 NAT 機能の使用を検討してください。\r\n\r\nなお、何らかの理由で物理的な LAN カード以外の LAN カード (無線 LAN、仮想 LAN など) を使用したい場合は、設定ファイルの "LocalBridgeList" ディレクティブ内の "ShowAllInterfaces" を "true" にして VPN Server を再起動するとこれらのデバイスも表示されるようになります。(上級者向け、Windows のみ)\r\n\r\nWindows をアップグレードした後にこの問題が発生するようになった場合は、SoftEther VPN Server または SoftEther VPN Bridge を再インストールしてみてください。 +SM_CERT_MESSAGE 現在サーバーに設定されている SSL 自己署名ルート証明書は古い形式です。\r\n\r\nOpenVPN プロトコルを用いてこの VPN Server に接続しているクライアントが存在する場合、現在のサーバー証明書の使用を継続すると、OpenVPN Connect for Android で不具合が発生する可能性があります。\r\n\r\nOpenVPN Connect for Android を使用してこの VPN Server に VPN 接続を行っている場合は、サーバー証明書を再作成して更新することをお勧めします。\r\n\r\nサーバー証明書を再作成して更新しますか? +SM_CERT_MESSAGE_CLI --- ご注意 ---\r\n\r\n現在サーバーに設定されている SSL 自己署名ルート証明書は古い形式です。\r\n\r\n現在のサーバー証明書の使用を継続した場合、OpenVPN Connect for Android で不具合が発生する可能性があります。\r\n\r\nOpenVPN Connect for Android を使用してこの VPN Server に VPN 接続を行っている場合は、サーバー証明書を再作成して更新することをお勧めします。\r\n\r\nサーバー証明書を再作成して更新するには、VPN Server を最新版にアップデートしてから、"ServerCertRegenerate" コマンドを実行してください。 +SM_CERT_NEED_ROOT 指定された SSL 証明書は、証明機関 (CA) によって発行された証明書です。\r\n\r\nこの VPN Server に Microsoft SSTP または OpenVPN プロトコルで VPN 接続を行う場合は、ルート証明書および中間証明書 (存在する場合) を VPN Server にインストールする必要があります。\r\n\r\nVPN Server にルート証明書および中間証明書をインストールするためには、X.509 証明書のルート証明書および中間証明書ファイルを VPN Server がインストールされているディレクトリの中にある "chain_certs" サブディレクトリにコピーしてください。\r\n\r\nルート証明書および中間証明書ファイルの取得方法は、証明機関 (CA) が発行している Web サイトをお読みいただくか、証明機関 (CA) のサポートに問い合わせてください。 + + +# User-modeRouter 管理ツール関係 +NM_TITLE deleted +NM_CONNECT_TITLE deleted +NM_STATUS_TAG 接続状況: %s +NM_OFFLINE どの VPN Server にも接続していません。 +NM_CONNECTING VPN Server に接続中 +NM_CONNECTED VPN Server "%S" への接続が完了 +NM_CONNECT_ERROR エラー番号 %u (%s) +NM_ACCOUNT_TITLE deleted +NM_STATUS User-mode Router の状況 +NM_STATUS_CONNECT 接続状況 +NM_STATUS_TCP NAT TCP/IP セッション数 +NM_STATUS_UDP NAT UDP/IP セッション数 +NM_STATUS_ICMP NAT ICMP セッション数 +NM_STATUS_DNS NAT DNS セッション数 +NM_STATUS_DHCP 割り当て済み DHCP クライアント数 +NM_INFO User-mode Router の情報 +NM_INFO_PRODUCT_NAME 製品名 +NM_INFO_VERSION_STR バージョン情報 +NM_INFO_BUILD_INFO ビルド情報 +NM_INFO_HOSTNAME ホスト名 +NM_NAT_ID ID +NM_NAT_PROTOCOL プロトコル +NM_NAT_SRC_HOST 接続元ホスト +NM_NAT_SRC_PORT 接続元ポート +NM_NAT_DST_HOST 接続先ホスト +NM_NAT_DST_PORT 接続先ポート +NM_NAT_CREATED セッション作成日時 +NM_NAT_LAST_COMM 最終通信時刻 +NM_NAT_SIZE 受信 / 送信サイズ +NM_NAT_TCP_STATUS TCP 接続状態 +NM_NAT_PROTO_TCP TCP/IP +NM_NAT_PROTO_UDP UDP/IP +NM_NAT_PROTO_DNS DNS +NM_NAT_PROTO_ICMP ICMP +NAT_TCP_CONNECTING 接続中 +NAT_TCP_SEND_RESET 切断中 +NAT_TCP_CONNECTED 接続完了 +NAT_TCP_ESTABLISHED 通信中 +NAT_TCP_WAIT_DISCONNECT 切断中 +DHCP_DHCP_ID ID +DHCP_LEASED_TIME リース開始日時 +DHCP_EXPIRE_TIME リース期限 +DHCP_MAC_ADDRESS MAC アドレス +DHCP_IP_ADDRESS 割り当て IP +DHCP_HOSTNAME クライアントホスト名 +NM_PASSWORD_MSG 管理パスワードを設定しました。 +NM_PUSH_ROUTE_WARNING 指定された静的ルーティングテーブルのテキストには文法エラーがある可能性があります。 + + +# バージョン情報系 +ABOUT_CAPTION %s のバージョン情報 +BETA_EXPIRES 現在インストールされている SoftEther VPN ソフトウェアはベータ版で、期限が切れています。より新しいベータ版または完成版の提供が開始された後は利用することはできません。\r\nhttp://selinks.org/ にアクセスし、最新版の SoftEther VPN ソフトウェアを入手してください。 + + +# ログ保存関係 +# (共通ログ) +L_YES はい +L_NO いいえ +L_LINE ------------------------------------------------------ + +# (サーバー ログ) +LS_START_UTF8 Log Messages are written with UTF-8 Encoding Format. +LS_START_1 SoftEther VPN Server エンジンを起動しました。 +LS_START_2 %S %S +LS_START_3 %S +LS_END_1 SoftEther VPN Server エンジンは正常にシャットダウンされました。 +LS_END_2 サーバー エンジンのシャットダウン処理を開始しています。 +LS_STOP_ALL_LISTENER すべての TCP リスナーを停止します。 +LS_STOP_ALL_LISTENER_2 すべての TCP リスナーの停止が完了しました。 +LS_STOP_ALL_HUB すべての仮想 HUB を停止しています。 +LS_STOP_ALL_HUB_2 すべての仮想 HUB の停止が完了しました。 +LS_STOP_CEDAR Cedar 通信モジュールをシャットダウンしています。 +LS_STOP_CEDAR_2 Cedar 通信モジュールをシャットダウンしました。 +LS_STOP_FARM_MEMBER クラスタコントローラへの接続を切断しています。 +LS_STOP_FARM_MEMBER_2 クラスタコントローラとの間の接続の切断が完了しました。 +LS_STOP_FARM_CONTROL クラスタコントローラを停止しています。 +LS_STOP_FARM_CONTROL_2 クラスタコントローラの停止が完了しました。 +LS_ENUM_ETHERNET_1 Ethernet デバイスの列挙を行いました。 +LS_ENUM_ETHERNET_2 デバイス %u: "%S" +LS_LOAD_CONFIG_1 設定ファイルの読み込みを行います。 +LS_LOAD_CONFIG_2 設定ファイルの読み込みが完了しました。 +LS_LOAD_CONFIG_3 設定ファイルが存在しません。初期設定での起動を試行します。 +LS_INIT_SAVE_THREAD 自動設定保存のためのバックグラウンドタスクを起動します。保存間隔は %u 秒です。なお、自動保存の間隔はコンフィグレーションファイルの AutoSaveConfigSpan パラメータで変更することができます。 +LS_BAD_CONFIG 設定ファイルの内容が不正です。読み込みを終了します。 +LS_LISTENER_START_1 TCP リスナー (ポート %u) を開始しています。 +LS_LISTENER_START_2 TCP リスナー (ポート %u) が開始されました。クライアントからの接続を待機しています。 +LS_LISTENER_START_3 TCP リスナー (ポート %u) でポートを Listen 状態に設定できませんでした。成功するまで一定間隔で試行します。 +LS_LISTENER_ACCEPT TCP リスナー (ポート %u) にクライアント (IP アドレス %S, ホスト名 "%S", ポート番号 %u) が接続しました。 +LS_LISTENER_DISCONNECT クライアント (IP アドレス %S, ポート番号 %u) との間のコネクションは切断されました。 +LS_LISTENER_DOS TCP リスナー (ポート %u) に対する DoS アタックを検出しました。接続元は IP アドレス %S, ポート番号 %u です。このコネクションは強制切断します。 +LS_LISTENER_MAXUEC TCP リスナーが処理している未処理のコネクション数が %u に達した (現在数 = %u) ため、一時的に受付接続数を制限しています。 +LS_LISTENER_STOP_1 TCP リスナー (ポート %u) を停止しています。 +LS_LISTENER_STOP_2 TCP リスナー (ポート %u) の停止が完了しました。 +LS_HUB_START 仮想 HUB "%S" を開始しました。 +LS_HUB_STOP 仮想 HUB "%S" を停止しました。 +LS_HUB_MAC 仮想 HUB "%S" の MAC アドレスは "%S" です。 +LS_NODE_INFO_TAG クライアント製品名 "%S", クライアントバージョン %u, クライアントビルド番号 %u, サーバー製品名 "%S", サーバーバージョン %u, サーバービルド番号 %u, クライアント OS 名 "%S", クライアント OS バージョン "%S", クライアントプロダクト ID "%S", クライアントホスト名 "%S", クライアント IP アドレス "%S", クライアントポート番号 %u, サーバーホスト名 "%S", サーバー IP アドレス "%S", サーバーポート番号 %u, プロキシホスト名 "%S", プロキシ IP アドレス "%S", プロキシポート番号 %u, 仮想 HUB 名 "%S", クライアントユニーク ID "%S" +LS_CONNECTION_START_1 クライアント (IP アドレス %S, ホスト名 "%S", ポート番号 %u) に対応するコネクション "%S" が作成されました。 +LS_CONNECTION_END_1 コネクション "%S" が終了しました。 +LS_SSL_START コネクション "%S" に対する SSL 通信が開始されました。暗号化アルゴリズム名は "%S" です。 +LS_CONNECTION_ERROR コネクション "%S" は理由 "%s" (コード %u) で終了しました。 +LS_FARMMEMBER_NOT_ADMIN コネクション "%S": サーバーはクラスタメンバですが、クライアントは仮想 HUB "%S" に管理者ユーザー "%S" 以外で直接接続しようと試みました。クライアントが提示したユーザー名は "%S" です。アクセスは許可されません。 +LS_HUB_NOT_FOUND コネクション "%S": クライアントが接続しようとした仮想 HUB "%S" はサーバー上に存在しません。 +LS_IP_DENIED コネクション "%S": クライアントの接続元 IP アドレス "%S" は、仮想 HUB に定義されている 接続元 IP 制限リストによって拒否されました。 +LS_LICENSE_ERROR コネクション "%S": ライセンス上のエラーが発生したため、クライアントはサーバーに接続できませんでした。 +LS_BETA_EXPIRES ライセンスエラーが発生しました。ベータ版の使用期限が終了しています。新しいベータ版または完成版を http://selinks.org/ からダウンロードしてください。 +LS_TICKET_1 クラスタメンバサーバー "%S" に対して新しいクライアント認証チケットを発行しました。仮想 HUB "%S", ユーザー名 "%S" ("%S"), セッション名 "%S", チケット "%S" +LS_TICKET_2 クラスタコントローラから新しいクライアント認証チケットを受領しました。仮想 HUB "%S", ユーザー名 "%S" ("%S"), セッション名 "%S", チケット "%S", 有効期限 %u 秒 +LS_ENUM_HUB コネクション "%S": このサーバー上の %u 個の仮想 HUB を列挙しました。 +LS_FARM_ACCEPT_1 コネクション "%S": このサーバーに対してクラスタコントロール接続を要求してきましたが、このサーバーはクラスタコントローラではありません。 +LS_FARM_ACCEPT_2 コネクション "%S": このサーバーに対してクラスタコントロール接続を要求してきましたが、認証パスワードが間違っているため、接続を拒否しました。 +LS_FARM_ACCEPT_3 コネクション "%S": このサーバーに対するクラスタコントロール接続を要求してきました。認証に成功しました。 +LS_FARM_SERV_START クラスタメンバとの間で接続を確立しました。IP アドレス %S, ホスト名 "%S" +LS_FARM_SERV_END クラスタメンバ "%S" との間の接続を解除しました。 +LS_FARM_CONNECT_1 クラスタコントローラ "%S" への接続を開始しました。 +LS_FARM_CONNECT_2 クラスタコントローラ "%S" への接続が拒否されました。エラー: %s (コード %u) +LS_FARM_CONNECT_3 クラスタコントローラ "%S" への TCP 接続に失敗しました。接続が成功するまで %u 秒間隔で試行します。 +LS_FARM_DISCONNECT クラスタコントローラへの接続を停止しました。 +LS_FARM_START クラスタコントローラへの接続が完了しました。クラスタメンバとしての動作を開始します。 +LS_LICENSE_NOT_VPNSERVER コネクション "%S": ライセンスエラーが発生しました。VPN Server 製品ライセンスが登録されていない時に、VPN Client が接続しようとしました。 +LS_LICENSE_NOT_VPNCLUSTER コネクション "%S": ライセンスエラーが発生しました。この VPN Server には現在クラスタリング機能を使用できない種類のライセンスが登録されていますが、クラスタモードで動作中に VPN Client が接続しようとしました。VPN Server を再起動する必要があります。 +LS_LICENSE_VIOLATION コネクション "%S": VPN Server でライセンス違反が発生しているため、接続を受け付けられません。 +LS_LICENSE_VIOLATION_DETECTED ライセンス違反を検出しました。別の VPN Server が、この VPN Server と同じサーバー ID "%I64u" で動作しています。クラスタ内に同一のライセンスを使用した 2 台以上の VPN Server が存在する可能性があります。各 VPN Server のライセンス情報を確認してください。 +LS_API_AUTH_OK HTTPS API クライアント "%r:%u" (%S): 管理モード: "%S" で組み込み HTTPS Web サーバーを用いてログインに成功しました。使用されたユーザー名: "%S", メソッド: "%S", パス: "%S" +LS_API_AUTH_ERROR HTTPS API クライアント "%r:%u" (%S): 組み込み HTTPS Web サーバーを用いてログインに失敗しました。使用されたユーザー名: "%S", メソッド: "%S", パス: "%S" +LS_API_RPC_CALL HTTPS API クライアント "%r:%u" (%S): JSON-API を呼び出しました。メソッド名: "%S", 結果エラーコード: %u (0 = 成功), 結果エラーメッセージ: "%s" + +# (Proto ログ) +LP_PREFIX_SESSION [%s] %r:%u -> %r:%u (%s): +LP_SESSION_CREATED Session created. +LP_SESSION_DELETED Session deleted. + +# (OpenVPN ログ) +LO_PREFIX_RAW OpenVPN モジュール: +LO_PREFIX_SESSION OpenVPN セッション %u (%r:%u -> %r:%u): +LO_PREFIX_CHANNEL OpenVPN セッション %u (%r:%u -> %r:%u) チャネル %u: +LO_NEW_CHANNEL 新しいチャネルを作成しました。 +LO_CHANNEL_ESTABLISHED_NEWKEY チャネルが確立状態になりました (原因: リキーの完了)。 +LO_OPTION_STR_RECV 受信したオプション文字列: "%S" +LO_CLIENT_CERT クライアント証明書 (subject: CN="%s") を受信しました。証明書認証を使用します。 +LO_CLIENT_UNVERIFIED_CERT 提示されたクライアント証明書の検証に失敗しました。パスワード認証を使用します。(エラー: "%S") +LO_CLIENT_NO_CERT クライアント証明書が提示されませんでした。パスワード認証を使用します。 +LO_OPTION_STR_SEND 送信するオプション文字列: "%S" +LO_INITIATE_REKEY このチャネルのリキーを開始します。 +LO_CHANNEL_ESTABLISHED チャネルが確立状態になりました。 +LO_PUSH_REPLY 応答オプション文字列の全文: "%S" +LO_CHANNEL_FAILED チャネルの接続処理に失敗しました。 +LO_CHANNEL_DISCONNECTED_BY_HUB 仮想 HUB の管理者によって VPN セッションが切断されたため、この OpenVPN チャネルを切断します。 + + +# (IPsec ログ) +LI_PREFIX_RAW IPsec モジュール: +LI_PREFIX_CLIENT IPsec クライアント %u (%S:%u -> %S:%u): +LI_PREFIX_IKE IPsec IKE セッション (IKE SA) %u (クライアント: %u) (%S:%u -> %S:%u): +LI_PREFIX_IPSEC IPsec ESP セッション (IPsec SA) %u (クライアント: %u) (%S:%u -> %S:%u): +LI_START IPsec ver 2.0 (ISAKMP/IKEv1) 処理モジュールを起動しました。 +LI_STOPPING IPsec ver 2.0 (ISAKMP/IKEv1) 処理モジュールの終了処理を開始しています... +LI_STOP IPsec ver 2.0 (ISAKMP/IKEv1) 処理モジュールを終了しました。 +LI_NUM_IPSEC_SA 終了時に残存していた IPsec SA の数は %u 個でした。 +LI_NUM_IKE_SA 終了時に残存していた IKE SA の数は %u 個でした。 +LI_NUM_IKE_CLIENTS 終了時に残存していた IPsec クライアントの数は %u 個でした。 +LI_L2TP_SERVER_STARTED L2TP サーバーモジュールを開始しました。 +LI_ETHERIP_SERVER_STARTED EtherIP サーバーモジュールを開始しました。EtherIP セッション番号: %u +LI_DELETE_IKE_CLIENT この IPsec クライアントを削除しました。 +LI_DELETE_IKE_SA この IKE SA を削除しました。 +LI_DELETE_IPSEC_SA この IPsec SA を削除しました。 +LI_START_QM_FROM_SERVER サーバー側から QuickMode の折衝を開始しました。 +LI_START_QM_FROM_CLIENT クライアント側から QuickMode の折衝が開始されました。 +LI_QM_DH_ERROR Diffie-Hellman アルゴリズムの計算に失敗しました。 +LI_NEW_IKE_CLIENT 新しい IPsec クライアントを作成しました。 +LI_NEW_IKE_SA 新しい IKE SA (%s) を作成しました。Initiator Cookie: 0x%I64X, Responder Cookie: 0x%I64X, DH グループ: %S, ハッシュアルゴリズム: %S, 暗号化アルゴリズム: %S, 暗号鍵サイズ: %u bits, 有効期限: %u kbytes または %u 秒 +LI_TAG_MAINMODE Main Mode +LI_TAG_AGGRESSIVE Aggressive Mode +LI_NEW_IPSEC_SA 新しい IPsec SA (方向: %s) を作成しました。SPI: 0x%X, DH グループ: %S, ハッシュアルゴリズム: %S, 暗号化アルゴリズム: %S, 暗号鍵サイズ: %u bits, 有効期限: %u kbytes または %u 秒 +LI_TAG_SERVER_TO_CLIENT サーバー -> クライアント +LI_TAG_CLIENT_TO_SERVER クライアント -> サーバー +LI_IPSEC_SA_SPI_SET これまで未定であった SPI を変更しました。新しい SPI: 0x%X +LI_IPSEC_SA_ESTABLISHED サーバー・クライアント間でこの IPsec SA が確立されました。 +LI_IKE_SA_ESTABLISHED サーバー・クライアント間でこの IKE SA が確立されました。 +LI_IPSEC_NO_TRANSFORM クライアント側から提示された IPsec SA 確立のためのトランスフォーム候補に受諾することができるものが見つかりませんでした。 +LI_IKE_NO_TRANSFORM クライアント側から提示された IKE SA 確立のためのトランスフォーム候補に受諾することができるものが見つかりませんでした。 +LI_IKE_NO_NAT_T このクライアントは IPsec NAT Traversal (RFC 3947 Negotiation of NAT-Traversal in the IKE または draft-ietf-ipsec-nat-t-ike) に対応していないため、接続を受け付けることができません。 +LI_SET_CLIENT_ID このクライアントが IKE SA の確立時に提示したクライアント ID は "%S" です。 +LI_CLIENT_MERGE このクライアント (クライアント %u) と既存の別のクライアント %u とは同一ですので、クライアント %u に結合されました。 +LI_CLIENT_UPDATE このクライアントのポート番号情報が更新されました。 + + +# (EtherIP ログ) +LE_PREFIX EtherIP / L2TPv3 セッション %u (%S:%u -> %S:%u): +LE_START_MODULE EtherIP / L2TPv3 モジュールが開始されました。 +LE_STOP EtherIP / L2TPv3 モジュールを終了しました。 +LE_NO_SETTING エラー: クライアント ID "%S" に対する EtherIP / L2TPv3 の設定が登録されていません。EtherIP / L2TPv3 の設定を VPN Server に登録してください。 +LE_START_IPC EtherIP / L2TPv3 モジュールから仮想 HUB "%S" への内部的通信の接続処理を開始しました。使用するユーザ名は "%S" です。設定する IPv4 TCP MSS (Max Segment Size) は %u bytes です。 +LE_IPC_CONNECT_ERROR EtherIP / L2TPv3 モジュールから仮想 HUB "%S" への接続に失敗しました。エラー: %u: %s +LE_IPC_CONNECT_OK EtherIP / L2TPv3 モジュールから仮想 HUB "%S" への接続に成功しました。 +LE_RECONNECT EtherIP / L2TPv3 関係の設定が変更されたため、内部的接続を一旦切断して再接続します。 + + +# (PPP ログ) +LP_PREFIX %S%SPPP セッション [%S:%u]: +LP_CONNECTED 新しい PPP セッション (上位プロトコル: %S) が開始されました。PPP クライアント IP アドレス: %S (ホスト名: "%S"), PPP クライアント ポート番号: %u, PPP サーバー IP アドレス: %S, PPP サーバー ポート番号:%u, クライアント ソフトウェア名: "%S", IPv4 TCP MSS (Max Segment Size): %u bytes +LP_DISCONNECTED PPP セッションは切断されました。 +LP_PAP_REJECTED クライアントは認証プロトコルとして "PAP" (Password Authentication Protocol、クリアテキストパスワード認証プロトコル) を拒否しました。クライアント側の接続設定で PAP を有効にして再試行してください。 +LP_PAP_MSCHAPV2_REJECTED クライアントは認証プロトコルとして "PAP" (Password Authentication Protocol、クリアテキストパスワード認証プロトコル) および MS-CHAP v2 プロトコルの両方を拒否しました。クライアント側の接続設定で PAP または MS-CHAP v2 のいずれかを有効にして再試行してください。 +LP_DISCONNECTED_ABNORMAL PPP プロトコルエラーが発生したか、または PPP セッションが切断されました。 +LP_NEXT_PROTOCOL_IS_NOT_PAP PAP (Password Authentication Protocol) の制御データ以外の不正なプロトコル (プロトコル番号: 0x%x) を受信しました。 +LP_PAP_FAILED "PAP" (Password Authentication Protocol、クリアテキストパスワード認証プロトコル) におけるユーザー認証に失敗しました。 +LP_MSCHAPV2_FAILED "MS-CHAP v2" (Microsoft Challenge and Response Protocol Version 2.0、マイクロソフトの暗号化されたパスワード認証プロトコル) におけるユーザー認証に失敗しました。 +LP_NEXT_PROTOCOL_IS_NOT_IPCP IPCP (IP Configuration Protocol) の制御データ以外の不正なプロトコル (プロトコル番号: 0x%x) を受信しました。 +LP_DATA_TIMEOUT PPP データ通信のタイムアウトが発生しました。PPP クライアントがネットワークから切断された可能性があります。 +LP_CONTROL_TIMEOUT PPP コントロール通信のタイムアウトが発生しました。PPP クライアントから応答がありません。 +LP_VPN_SESSION_TERMINATED VPN セッションがシステム管理者によって切断されたため、PPP セッションを切断します。 +LP_UPPER_PROTOCOL_DISCONNECTED 上位プロトコル "%S" が切断されたため、PPP セッションを切断します。 +LP_NORMAL_TERMINATE VPN クライアント側からの切断要求により、PPP セッションを切断します。 +LP_IP_ADDRESS_NOT_DETERMIND VPN クライアントの IP アドレスがまだ決定されていないにもかかわらず、VPN クライアントが通信を行おうとしました。 +LP_DHCP_REQUEST_TRYING DHCP サーバーから IP アドレスを取得しようと試行しています。 +LP_DHCP_REQUEST_OK DHCP サーバーから IP アドレスを取得しました。クライアント IP アドレス: %S, サブネットマスク: %S, デフォルトゲートウェイ: %S, ドメイン名: "%S", DNS サーバー 1: %S, DNS サーバー 2: %S, WINS サーバー 1: %S, WINS サーバー 2: %S, DHCP サーバー IP アドレス: %S, リース時間: %u 秒 +LP_DHCP_REQUEST_NG DHCP サーバーからの IP アドレスの取得に失敗しました。PPP の通信を受諾するためには DHCP サーバーが必要です。仮想 HUB の Ethernet セグメント上で DHCP サーバーが正しく動作しているかどうか確認してください。DHCP サーバーを用意することができない場合は、仮想 HUB の SecureNAT 機能を用いることもできます。 +LP_DHCP_INFORM_TRYING DHCP サーバーからサブネットマスクやデフォルトゲートウェイなどの IP ネットワーク情報を取得しようと試行しています。 +LP_DHCP_INFORM_OK DHCP サーバーから IP ネットワーク情報を取得しました。サブネットマスク: %S, デフォルトゲートウェイ: %S, ドメイン名: "%S", DNS サーバー 1: %S, DNS サーバー 2: %S, WINS サーバー 1: %S, WINS サーバー 2: %S, DHCP サーバー IP アドレス: %S +LP_DHCP_INFORM_NG DHCP サーバーからの IP ネットワーク情報の取得に失敗しました。PPP の通信を受諾するためには DHCP サーバーが必要です。仮想 HUB の Ethernet セグメント上で DHCP サーバーが正しく動作しているかどうか確認してください。DHCP サーバーを用意することができない場合は、仮想 HUB の SecureNAT 機能を用いることもできます。 +LP_SET_IPV4_PARAM クライアントの IP アドレスおよびその他の IP ネットワーク情報の設定が完了しました。クライアント IP アドレス: %S, サブネットマスク: %S, デフォルトゲートウェイ: %S, DNS サーバー 1: %S, DNS サーバー 2: %S, WINS サーバー 1: %S, WINS サーバー 2: %S + + +# (仮想 HUB ログ) +LH_ONLINE 仮想 HUB がオンラインになりました。 +LH_OFFLINE 仮想 HUB がオフラインになりました。 +LH_CONNECT_CLIENT コネクション "%S" (IP アドレス %S, ホスト名 %S, ポート番号 %u, クライアント名 "%S", バージョン %S ビルド %u) が仮想 HUB への接続を試行しています。提示している認証方法は "%s" でユーザー名は "%S" です。 +LH_AUTH_UNKNOWN 不明な認証メソッド +LH_AUTH_ANONYMOUS 匿名認証 +LH_AUTH_PASSWORD パスワード認証 +LH_AUTH_PLAIN_PASSWORD 外部サーバー認証 +LH_AUTH_CERT 証明書認証 +LH_AUTH_TICKET チケット認証 +LH_AUTH_OPENVPN_CERT OpenVPN 証明書認証 +LH_AUTH_RADIUS_NOT_SUPPORT コネクション "%S": ユーザー "%S" の認証方法として RADIUS 認証または Active Directory 認証 (NT ドメイン認証) が指定されましたが、現在の VPN Server のエディションは "%S" であるため、RADIUS 認証または Active Directory 認証 (NT ドメイン認証) を使用することができません。接続は拒否されます。 +LH_AUTH_RADIUS_NOT_SUPPORT_ON_OPEN_SOURCE コネクション "%S": ユーザー "%S" の認証方法として RADIUS 認証または Active Directory 認証 (NT ドメイン認証) が指定されましたが、RADIUS 認証または Active Directory 認証 (NT ドメイン認証) を使用することができません。この機能はオープンソース版 SoftEther VPN にはまだ実装されていません。接続は拒否されます。 +LH_AUTH_CERT_NOT_SUPPORT_ON_OPEN_SOURCE コネクション "%S": ユーザー "%S" の認証方法として証明書認証が指定されましたが、証明書認証を使用することができません。この機能はオープンソース版 SoftEther VPN にはまだ実装されていません。接続は拒否されます。 +LH_AUTH_OK コネクション "%S": ユーザー "%S" として正しく認証されました。 +LH_AUTH_OK_CERT 仮想 HUB のセキュリティアカウントマネージャは、ユーザー "%S" がログインする際の証明書として、次の証明書を VPN Client から受理し、その内容を承認しました: %s +LH_AUTH_NG_CERT 仮想 HUB のセキュリティアカウントマネージャは、ユーザー "%S" がログインする際の証明書として、次の証明書を VPN Client から受理しましたが、この証明書は仮想 HUB の無効な証明書一覧に登録されている内容に一致するため拒否しました: %s +LH_AUTH_NG コネクション "%S": ユーザー認証に失敗しました。提示されたユーザー名は "%S" 、接続元は "%S" でした。 +LH_LOCAL_ONLY コネクション "%S": ユーザー "%S" のパスワードが空白のため、リモートからのログインは拒否されました。 +LH_POLICY_ACCESS_NG コネクション "%S": ユーザー "%S" はセキュリティポリシーによってアクセスが拒否されています。 +LH_USER_EXPIRES コネクション "%S": ユーザー "%S" の有効期限が切れており、アクセスが拒否されました。 +LH_CLIENT_VERSION_OLD コネクション "%S": クライアントのビルド番号は %u です。最低でもビルド %u 以上のクライアントからのみ接続が許可されます。 +LH_CLIENT_ID_REQUIRED コネクション "%S": クライアントから送付されたクライアント ID は %u ですが、この仮想 HUB に設定されている RequiredClientId の値は %u です。 +LH_FARM_SELECT_1 コネクション "%S": クラスタコントローラはこのクライアントの接続先のクラスタメンバを決定しています。 +LH_FARM_SELECT_2 コネクション "%S": 接続先クラスタメンバサーバーの決定に失敗しました。 +LH_FARM_SELECT_3 コネクション "%S": 接続先クラスタメンバサーバーとして現在のこの VPN Server が決定されました。接続受け入れを続行します。 +LH_FARM_SELECT_4 コネクション "%S": 接続先クラスタメンバサーバーとしてサーバー "%S" が決定されました。クライアントに対してこのサーバーへ接続をリダイレクトするように指示します。 +LH_MAX_SESSION コネクション "%S": 仮想 HUB が設定された最大セッション数 %u に達しています。新しいセッションは作成できません。 +LH_MAX_SESSION_CLIENT コネクション "%S": 仮想 HUB が設定された最大クライアントセッション数 %u に達しています。新しいセッションは作成できません。 +LH_MAX_SESSION_BRIDGE コネクション "%S": 仮想 HUB が設定された最大ブリッジセッション数 %u に達しています。新しいセッションは作成できません。 +LH_MAX_SESSION_2 コネクション "%S": VPN Server 上で管理することができる最大セッション数 %u に達しています。新しいセッションは作成できません。 +LH_NEW_SESSION コネクション "%S": 新しいセッション "%S" が作成されました。(IP アドレス %S, ポート番号 %u, 物理レイヤのプロトコル: "%S") +LH_SET_SESSION セッション "%S": パラメータが設定されました。最大 TCP コネクション数 %u, 暗号化の使用 %s, 圧縮の使用 %s, 半二重通信の使用 %s, タイムアウト %u 秒 +LH_NODE_INFO セッション "%S": VPN Client の詳細: (%s) +LH_VLAN_ID セッション "%S": 割り当てられた VLAN ID: %u +LH_INVALID_SIGNATURE セッション "%S": 接続してきたクライアントが無効なプロトコルデータを送信しました。クライアントとの通信が正常にできません。クライアントとこのサーバーとの間のネットワーク回線に異常が無いかどうか、特殊な透過型パケット書き換え装置を設置していないかどうか確認してください。 +LH_END_SESSION セッション "%S": セッションが終了しました。統計情報は次の通りです。合計送信データサイズ: %I64u バイト, 合計受信データサイズ: %I64u バイト +LH_BCAST_STORM セッション "%S": 大量のブロードキャストパケットを検出しました。ポリシーに従ってパケットを破棄する場合があります。送信元 MAC アドレスは %S, 送信元 IP アドレスは %S, 宛先 IP アドレスは %S です。ブロードキャストパケット数は 1 秒間に %u 個以上です (なおこの情報はパケットの一部を機械的に解析した結果であり、不正確な場合があります)。 +LH_DHCP_FORCE セッション "%S": DHCP サーバーが割り当てていない IP アドレス %S を使用しようとしたため、パケットは破棄されました。 +LH_MAC_LIMIT セッション "%S": 新しい MAC アドレス "%S" を関連付けようとしましたが、すでにこのセッションには %u 個の MAC アドレスが関連付けられています。セキュリティポリシーでは、このセッションは最大 %u 個の MAC アドレスを持つことが許可されています。パケットは破棄されます。 +LH_BRIDGE_LIMIT セッション "%S": 新しい MAC アドレス "%S" を関連付けようとしましたが、すでにこのセッションには %u 個の MAC アドレスが関連付けられています。セキュリティポリシーでは、このセッションはブリッジを禁止されているので、 %u 個より多い MAC アドレスを持つことは許可されません。パケットは破棄されます。 +LH_MAC_REGIST セッション "%S": 新しい MAC アドレス "%S" が関連付けられました。 +LH_MAC_REGIST_VLAN セッション "%S": 新しい MAC アドレス "%S" (VLAN ID: %u) が関連付けられました。 +LH_IP_LIMIT セッション "%S": 新しい IP アドレス %S を関連付けようとしましたが、すでにこのセッションには %u 個の IP アドレスが関連付けられています。セキュリティポリシーでは、このセッションは最大 %u 個の IP アドレスを持つことが許可されています。パケットは破棄されます。 +LH_ROUTING_LIMIT セッション "%S": 新しい IP アドレス %S を関連付けようとしましたが、すでにこのセッションには %u 個の IP アドレスが関連付けられています。セキュリティポリシーでは、このセッションはルーティングを禁止されているので、%u 個より多い IP アドレスを持つことは許可されていません。パケットは破棄されます。 +LH_IP_CONFLICT セッション "%S": IP アドレス %S を使用しようとしましたが、この IP アドレスは既に別のセッション "%S" (MAC アドレス: "%S") によって使用されています。このセッションのセキュリティポリシーにより、他のセッションが使用中の IP アドレスとの重複は禁止されます。パケットは破棄されます。詳細情報: CreatedTime=%I64u, UpdatedTime=%I64u, DhcpAllocated=%u, Now=%I64u +LH_NO_SERVER セッション "%S": このセッションに対して %S:%u から %S:%u への TCP/IP 接続要求がありましたが、セキュリティポリシーによりサーバーとしての動作が禁止されているため、パケットは破棄されました。 +LH_NO_DHCP セッション "%S": このセッション上のホスト %S が別のセッション上のホスト %S に対して DHCP サーバーとして IP アドレスを割り当てるパケットを送信しましたが、このセッションのセキュリティポリシーにより DHCP サーバーとしての動作は禁止されています。パケットは破棄されます。 +LH_REGIST_DHCP セッション "%S": このセッション上のホスト "%S" (%S) の DHCP サーバーは、別のセッション "%S" 上のホスト "%S" に対して新しい IP アドレス %S を割り当てました。 +LH_BRIDGE_1 セッション "%S": ローカルブリッジを物理的な Ethernet インターフェイス "%S" との間で開始しました。 +LH_BRIDGE_2 セッション "%S": 物理的な Ethernet インターフェイス "%S" との間の通信に失敗したため、ローカルブリッジを停止しました。 +LH_SET_MTU セッション "%S": 物理的な Ethernet インターフェイス "%S" の MTU は現在 %u です。%u バイトの Ethernet パケットを送受信するため、これを %u に設定変更しました。 +LH_SET_MTU_ERROR セッション "%S": エラー: 物理的な Ethernet インターフェイス "%S" の MTU は現在 %u です。%u バイトの Ethernet パケットを送受信するため MTU を %u に設定することに失敗しました。この物理的な Ethernet インターフェイスおよびデバイスドライバが 1,514 バイト (ペイロード部分: 1,500 バイト) を超える Ethernet パケットの送受信に対応していない可能性があります。その場合、サイズの大きなタグ VLAN パケットの送受信はできません。物理的な Ethernet インターフェイスの種類を Jumbo Frames に対応したものに交換するか、デバイスドライバをアップデートしてみてください。また、オペレーティングシステムやデバイスドライバの設定で、Jumbo Frames を許可してください。 +LH_START_BRIDGE ローカルブリッジ接続 "%S" を開始しました。ブリッジセッション "%S" を作成しました。 +LH_STOP_BRIDGE ローカルブリッジ接続 "%S" を停止しました。 +LH_LINK_START カスケード接続 "%s" が確立されました。カスケードセッション "%S" を作成しました。 +LH_LINK_STOP カスケード接続 "%s" が停止しました。 +LH_NAT_START SecureNAT が開始されました。SecureNAT セッション "%S" を作成しました。 +LH_NAT_STOP SecureNAT が停止しました。 +LH_NAT_TCP_SUCCEED TCP セッション %u: ホスト "%S (%S)", ポート %u への接続に成功しました。 +LH_NAT_TCP_FAILED TCP セッション %u: ホスト "%S", ポート %u への接続に失敗しました。 +LH_NAT_TCP_DELETED TCP セッション %u が削除されました。 +LH_NAT_TCP_CREATED TCP セッション %u が作成されました。接続元 %S:%u, 接続先 %S:%u +LH_NAT_UDP_DELETED UDP セッション %u が削除されました。 +LH_NAT_UDP_CREATED UDP セッション %u が作成されました。接続元 %S:%u, 接続先 %S:%u +LH_NAT_DHCP_CREATED DHCP エントリ %u が作成されました。MAC アドレス: %S, IP アドレス: %S, ホスト名: %S, 有効期限: %u 秒 +LH_CHANGE_PASSWORD_1 コネクション "%S" (IP アドレス %S) がパスワード変更モードで仮想 HUB に接続しました。 +LH_CHANGE_PASSWORD_2 コネクション "%S": パスワードの変更に失敗しました。指定したユーザー "%S" は存在しません。 +LH_CHANGE_PASSWORD_3 コネクション "%S": パスワードの変更に失敗しました。ユーザー "%S" の認証方法はパスワード認証ではありません。 +LH_CHANGE_PASSWORD_4 コネクション "%S": パスワードの変更に失敗しました。ユーザー "%S" の古いパスワードが間違っています。 +LH_CHANGE_PASSWORD_5 コネクション "%S": ユーザー "%S" のパスワードを変更しました。 +LH_CONNECT_1 カスケード接続 "%s": %u 回目の接続動作を開始します。 +LH_CONNECT_2 カスケード接続 "%s": 接続が完了しました。セッション名: "%S" +LH_CONNECT_ERROR カスケード接続 "%s": 接続が切断されたか、接続に失敗しました。理由: %s (コード %u) +LH_POLICY_MONITOR_MODE コネクション "%S": セキュリティポリシーで [モニタリングモード] が許可されていないユーザーが、モニタリングモードを有効にするように要求して仮想 HUB に接続しようとしたため、接続を拒否しました。 +LH_POLICY_BRIDGE_MODE コネクション "%S": セキュリティポリシーで [ブリッジを禁止する] および [ルーティングを禁止する] の両方が有効になっているユーザーが、ブリッジ / ルータモードを有効にするように要求して仮想 HUB に接続しようとしたため、接続を拒否しました。 +LH_NOT_ENOUGH_CLIENT_LICENSE コネクション "%S": このコネクションは VPN Server に「クライアント接続モード」で接続しようとしましたが、サーバー全体のクライアント接続数が登録されているクライアント接続ライセンス数を上回るため、このコネクションの接続を受け付けることができませんでした。同時接続ライセンス数が不足している場合は、既存の別のクライアントの接続を切断するか、ライセンス数を増やす必要があります。現在登録されているクライアント接続ライセンス数は %u で、サーバーへの接続数は %u でした。 +LH_NOT_ENOUGH_BRIDGE_LICENSE コネクション "%S": このコネクションは VPN Server に「ブリッジ接続モード」で接続しようとしましたが、サーバー全体のブリッジ接続数が登録されているブリッジ接続ライセンス数を上回るため、このコネクションの接続を受け付けることができませんでした。同時接続ライセンス数が不足している場合は、既存の別のクライアントの接続を切断するか、ライセンス数を増やす必要があります。現在登録されているブリッジ接続ライセンス数は %u で、サーバーへの接続数は %u でした。 +LH_TOO_MANY_MULTILOGINS コネクション "%S": ユーザー "%S" がログインしようとしましたが、このユーザーが適用されるセキュリティポリシーは多重ログイン数の上限を %u セッションに制限しています。現在のこのユーザーのログイン数は %u セッションですので、新たに VPN 接続を許可できませんでした。 +LH_TOO_MANY_MULTILOGINS2 コネクション "%S": ユーザー "%S" がログインしようとしましたが、この VPN Server の製品エディションでは、1 個のユーザーオブジェクトに対して同時にログインできる VPN セッション数は %u セッションに制限されています。現在のこのユーザーのログイン数は %u セッションですので、新たに VPN 接続を許可できませんでした。なお、VPN Server の Professional Edition 以上の製品エディションの場合は、1 個のユーザーオブジェクトに対して同時に多重ログインが可能です。 +LH_PACKET_LOG_NO_LOG この VPN Server はパケットログの保存に対応していない製品エディションのため、IP アドレスや TCP/UDP などのデータは保存されません。VPN Server のエディションを Professional Edition 以上にアップグレードすると、すべてのパケットログが保存されるようになります。 +LH_PACKET_LOG_NO_LOG_OSS この VPN Server はオープンソース版または無償版であるため、パケットログの保存に対応していません。そのため、IP アドレスや TCP/UDP などのデータは保存されません。 +LH_NO_RADIUS_SETTING この仮想 HUB にユーザー "%S" が接続するためには RADIUS 認証を行う必要がありますが、RADIUS サーバーの設定が行われていないためユーザー認証を実施できません。 +LH_KERNEL_MODE_START 仮想 NAT 機能でカーネルモード NAT がインターフェイス "%S" 上で利用可能であることが検出されました。カーネルモード NAT を開始します。今後の TCP, UDP および ICMP の NAT 処理はカーネルモードを経由して高速に実行されます。カーネルモード NAT の物理ネットワーク上でのパラメータ: IP アドレス = "%r", サブネットマスク = "%r", デフォルトゲートウェイ = "%r", ブロードキャストアドレス = "%r", 仮想 MAC アドレス: "%S", DHCP サーバーアドレス: "%r", DNS サーバーアドレス: "%r" +LH_KERNEL_MODE_STOP 仮想 NAT 機能でインターフェイス "%S" 上のカーネルモード NAT を停止しました。 + + +# (管理ログ) +LA_CONNECTED_1 コネクション "%S" がサーバー管理モードで接続しました。 +LA_CONNECTED_2 コネクション "%S" が仮想 HUB 管理モードで接続しました。仮想 HUB 名は "%S" です。 +LA_IP_DENIED コネクション "%S" は adminip.txt ファイルで許可されていない IP アドレスから管理モードで接続しようとしました。切断します。 +LA_ERROR コネクション "%S" は管理モードにログインできませんでした。%s (エラーコード %u) +LA_OK コネクション "%S" が管理モードでのログインに成功しました。 +LA_RPC_START コネクション "%S" は管理モードのための新しいリモートプロシージャコールセッション "%S" を生成しました。 +LA_TAG_1 管理モード [%S]: +LA_TAG_2 管理モード [%S] (仮想 HUB "%S"): +LA_CREATE_LISTENER 新しい TCP リスナー (ポート番号 %u) を作成しました。 +LA_DELETE_LISTENER TCP リスナー (ポート番号 %u) を削除しました。 +LA_ENABLE_LISTENER TCP リスナー (ポート番号 %u) を有効化しました。 +LA_DISABLE_LISTENER TCP リスナー (ポート番号 %u) を無効化しました。 +LA_SET_PORTS_UDP UDP ポートの一覧が設定されました: %s. +LA_SET_PROTO_OPTIONS オプション %s が設定されました。 +LA_SET_SERVER_PASSWORD サーバー管理者パスワードを設定しました。 +LA_SET_FARM_SETTING クラスタリング設定を変更しました。 +LA_SET_SERVER_CERT サーバー証明書を設定しました。 +LA_REGENERATE_SERVER_CERT サーバー証明書を再生成しました。新しい CN: "%S" +LA_SET_SERVER_CIPHER サーバーの新しい暗号化アルゴリズム名を設定しました。新しい暗号化アルゴリズム名は "%S" です。 +LA_CREATE_HUB 新しい仮想 HUB "%S" を作成しました。 +LA_SET_HUB 仮想 HUB の設定を変更しました。 +LA_DELETE_HUB 仮想 HUB "%S" を削除しました。 +LA_SET_HUB_RADIUS 仮想 HUB の外部 RADIUS 認証サーバーの設定を変更しました。 +LA_DISCONNECT_CONN サーバーに接続しているクライアントのコネクション "%S" を強制切断しました。 +LA_SET_HUB_ONLINE 仮想 HUB をオンラインにしました。 +LA_SET_HUB_OFFLINE 仮想 HUB をオフラインにしました。 +LA_SET_SNAT_OPTION SecureNAT オプションを設定しました。 +LA_ENABLE_SNAT SecureNAT 機能を有効にしました。 +LA_DISABLE_SNAT SecureNAT 機能を無効にしました。 +LA_SET_HUB_LOG ログ保存設定を変更しました。 +LA_ADD_CA 信頼するルート証明書の登録を追加しました。 +LA_DELETE_CA 信頼するルート証明書の登録を削除しました。 +LA_CREATE_LINK カスケード接続 "%s" を追加しました。 +LA_SET_LINK カスケード接続 "%s" の設定を変更しました。 +LA_SET_LINK_ONLINE カスケード接続 "%s" をオンラインにしました。 +LA_SET_LINK_OFFLINE カスケード接続 "%s" をオフラインにしました。 +LA_DELETE_LINK カスケード接続 "%s" を削除しました。 +LA_RENAME_LINK カスケード接続 "%s" の名前を "%s" に変更しました。 +LA_ADD_ACCESS アクセスリストを追加しました。 +LA_DELETE_ACCESS アクセスリストを削除しました。 +LA_SET_ACCESS_LIST アクセスリストを更新しました。%u 個のアクセスリストを設定しました。 +LA_SET_AC_LIST 接続元 IP 制限リストを更新しました。%u 個のルール項目を設定しました。 +LA_CREATE_USER ユーザー "%S" を作成しました。 +LA_SET_USER ユーザー "%S" の設定を更新しました。 +LA_DELETE_USER ユーザー "%S" を削除しました。 +LA_CREATE_GROUP グループ "%S" を作成しました。 +LA_SET_GROUP グループ "%S" の設定を更新しました。 +LA_DELETE_GROUP グループ "%S" を削除しました。 +LA_DELETE_SESSION セッション "%S" を強制切断しました。 +LA_SET_KEEP サーバーのインターネット接続維持設定を更新しました。 +LA_SET_SYSLOG サーバーの syslog 送信機能の設定を更新しました。 +LA_DELETE_BRIDGE ローカルブリッジ接続定義 "%S" -> "%S" を削除しました。 +LA_ADD_BRIDGE ローカルブリッジ接続定義 "%S" -> "%S" を追加しました。 +LA_REBOOT_SERVER VPN Server を再起動するように要求しました。 +LA_GET_CONFIG config ファイルを読み出しました。 +LA_SET_CONFIG config ファイルを書き込みました。VPN Server を再起動します。 +LA_SET_HUB_ADMIN_OPTION 仮想 HUB "%S" の管理オプションを設定しました。 +LA_SET_HUB_EXT_OPTION 仮想 HUB "%S" の拡張オプションを設定しました。 +LA_ADD_L3_SW 仮想レイヤ 3 スイッチ "%S" をサーバーに作成しました。 +LA_DEL_L3_SW 仮想レイヤ 3 スイッチ "%S" をサーバーから削除しました。 +LA_START_L3_SW 仮想レイヤ 3 スイッチ "%S" を開始しました。 +LA_STOP_L3_SW 仮想レイヤ 3 スイッチ "%S" を停止しました。 +LA_ADD_L3_IF 仮想 HUB "%S" に対する仮想インターフェイスを仮想レイヤ 3 スイッチ "%S" に追加しました。 +LA_DEL_L3_IF 仮想 HUB "%S" に対する仮想インターフェイスを仮想レイヤ 3 スイッチ "%S" から削除しました。 +LA_ADD_L3_TABLE ネットワーク "%S" に対するルーティングテーブルを仮想レイヤ 3 スイッチ "%S" に追加しました。 +LA_DEL_L3_TABLE ネットワーク "%S" に対するルーティングテーブルを仮想レイヤ 3 スイッチ "%S" から削除しました。 +LA_ADD_CRL 無効な証明書の一覧の登録を追加しました。 +LA_DEL_CRL 無効な証明書の一覧の登録を削除しました。 +LA_SET_CRL 無効な証明書の一覧の登録の登録済み項目を編集しました。 +LA_READ_LOG_FILE サーバー "%S" 上のログファイル "%S" をダウンロードしました。 +LA_ADD_LICENSE_KEY 新しいライセンスキー "%S" を登録しました。 +LA_DEL_LICENSE_KEY 既存のライセンス (%u 番) を削除しました。 +LA_SET_IPSEC_CONFIG IPsec サーバーの設定を更新しました。 +LA_ADD_ETHERIP_ID EtherIP / L2TPv3 サーバーの設定 (ID="%S") を追加しました。 +LA_DEL_ETHERIP_ID EtherIP / L2TPv3 サーバーの設定 (ID="%S") を削除しました。 +LA_SET_OVPN_SSTP_CONFIG OpenVPN および MS-SSTP VPN サーバーの設定を更新しました。 +LA_DDNS_HOSTNAME_CHANGED ダイナミック DNS 機能のホスト名を "%S" に変更しました。 +LA_SET_SPECIAL_LISTENER 特別なリスナの有効 / 無効状態を変更しました。 + +# (Client ログ) +LC_START_1 SoftEther VPN Client エンジンを起動しました。 +LC_START_2 %S %S +LC_START_3 %S +LC_END SoftEther VPN Client エンジンをシャットダウンしました。 +LC_LOAD_CONFIG_1 設定ファイルを読み込んでいます。 +LC_LOAD_CONFIG_2 設定ファイルの読み込みが完了しました。 +LC_LOAD_CONFIG_3 設定ファイルが存在しません。初期設定を作成します。 +LC_NEW_ACCOUNT 新しい接続設定 "%s" を作成しました。 +LC_DELETE_ACCOUNT 接続設定 "%s" を削除しました。 +LC_RENAME_ACCOUNT 接続設定 "%s" の名前を "%s" に変更しました。 +LC_CONNECT 接続設定 "%s" への接続処理を開始しました。 +LC_CONNECT_1 接続設定 "%s": %u 回目の接続動作を開始します。 +LC_CONNECT_2 接続設定 "%s": 接続が完了しました。セッション名: "%S" +LC_CONNECT_ERROR 接続設定 "%s": 接続が切断されたか、接続に失敗しました。理由: %s (コード %u) +LC_DISCONNECT 接続設定 "%s" を切断します。 +LC_CREATE_VLAN 仮想 LAN カード "%S" を作成しました。 +LC_UPDATE_VLAN 仮想 LAN カード "%S" のドライバを再インストールしました。 +LC_DELETE_VLAN 仮想 LAN カード "%S" を削除しました。 +LC_SET_PASSWORD クライアントサービスに接続するためのパスワード設定を変更しました。 +LC_TAP_NOT_FOUND MacOS X 用の tun/tap ドライバが見つかりません。tun/tap ドライバのインストールを行ってください。 + +# (イレーザー ログ) +LE_START ディレクトリ "%S" の監視を開始します。ディスクの空き容量が %S 未満になった場合、このディレクトリのサブディレクトリ内に保存されているログファイルおよび設定のバックアップファイルを、古い順番に自動的に削除します。削除を開始するディスクの最小空き容量は、設定ファイルの "AutoDeleteCheckDiskFreeSpaceMin" 項目で変更することができます。 +LE_DELETE ディスクの空き容量が %S 未満になったため、古いファイル "%S" を自動的に削除しました。なお、削除を開始するディスクの最小空き容量は、設定ファイルの "AutoDeleteCheckDiskFreeSpaceMin" 項目で変更することができます。 +LE_NOT_ENOUGH_FREE <<警告>> ディスクの空き容量が %S 以下になっていますが、これ以上古いログファイルおよび設定のバックアップファイルを自動的に削除することができませんでした。直ちに手動でこのコンピュータの不要なファイルを削除し、ディスク容量を確保することをお勧めします。空きディスク容量が極端に少なくなると、コンピュータの動作が不安定になる場合があります。 + +# (レイヤ 3 スイッチログ) +L3_SWITCH_START 仮想レイヤ 3 スイッチ "%S" が起動しました。このスイッチに登録されているすべてのインターフェイスの仮想 HUB がオンラインになるまで待機して、動作を開始します。 +L3_SWITCH_ONLINE 仮想レイヤ 3 スイッチ "%S" のすべてのインターフェイスの仮想 HUB がオンラインになったので、仮想レイヤ 3 スイッチの動作を開始します。 +L3_SWITCH_OFFLINE 仮想レイヤ 3 スイッチ "%S" に登録されている 1 つ以上のインターフェイスの仮想 HUB が停止したので、仮想レイヤ 3 スイッチの動作を停止します。 +L3_SWITCH_STOP 仮想レイヤ 3 スイッチ "%S" が終了しました。 + + +# Microsoft.c 関係 +MS_VIRTUAL 独自の仮想/内部インタフェース +MS_ETHERNET Ethernet インターフェイス +MS_TOKENRING トークンリングインターフェイス +MS_FDDI FDDI インターフェイス +MS_PPP PPP (ダイヤルアップまたは VPN) +MS_LOOPBACK ループバックインターフェイス +MS_SLIP SLIP インターフェイス +MS_WLAN 無線 LAN インターフェイス +MS_OTHER 不明な種類のインターフェイス +MS_NON_OPERATIONAL 無効 +MS_UNREACHABLE 未接続 +MS_DISCONNECTED 未接続 +MS_CONNECTING 接続中 +MS_CONNECTED 接続済み +MS_OPERATIONAL 接続済み + + +# Network Utility 関係 +UT_SM_COLUMN_1 項目名 +UT_SM_COLUMN_2 値 +UT_SM_ST_TITLE ネットワークアダプタ名 +UT_SM_ST_GUID GUID +UT_SM_ST_TYPE 種類 +UT_SM_ST_TYPE2 物理 Ethernet LAN 接続 +UT_SM_ST_STATUS 状況 +UT_SM_ST_MTU MTU +UT_SM_ST_SPEED リンク速度 +UT_SM_ST_ADDRESS 物理アドレス +UT_SM_ST_RECV_BYTES 受信バイト数 +UT_SM_ST_RECV_BCASTS 受信ブロードキャスト数 +UT_SM_ST_RECV_UNICASTS 受信ユニキャスト数 +UT_SM_ST_SEND_BYTES 送信バイト数 +UT_SM_ST_SEND_BCASTS 送信ブロードキャスト数 +UT_SM_ST_SEND_UNICASTS 送信ユニキャスト数 +UT_SM_ST_IP IP アドレス %u +UT_SM_ST_SUBNET サブネットマスク %u +UT_SM_ST_GATEWAY ゲートウェイ %u +UT_SM_ST_DHCP DHCP サーバー +UT_SM_ST_DHCP_1 リース開始日時 +UT_SM_ST_DHCP_2 リース期限日時 +UT_SM_ST_WINS_1 WINS サーバー 1 +UT_SM_ST_WINS_2 WINS サーバー 2 + + +# EtherLogger Manager 関係 +EM_TITLE SoftEther EtherLogger Manager +EM_REMOTE_TITLE SoftEther EtherLogger サービスに接続し、管理することができます。\r\n管理する EtherLogger サービスが動作しているコンピュータのホスト名または IP アドレスを入力してください。":" (コロン) に続けてポート番号を指定することもできます。 +EM_MAIN_COLUMN_1 LAN カード名 +EM_MAIN_COLUMN_2 状態 +EM_MAIN_OK 動作中 +EM_MAIN_ERROR エラー発生 +EM_ADD_NEW 新しいキャプチャデバイスの追加 +EM_ADD_EDIT キャプチャ設定の編集 +EM_DELETE_CONFIRM キャプチャ設定 "%S" を削除しますか? +EM_NO_LICENSE_COLUMN ご注意: +EM_NO_LICENSE 製品ライセンスが 1 つも登録されていないため、この SoftEther EtherLogger は動作しません。 + +EM_UNSUPPORTED この SoftEther EtherLogger が動作しているオペレーティングシステム上では、SoftEther EtherLogger を使用することはできません。SoftEther EtherLogger が使用できるオペレーティングシステムの一覧については、SoftEther EtherLogger のオンラインドキュメントを参照してください。 +EM_WPCAP_REMOTE この SoftEther EtherLogger を使用するためには、WinPcap ソフトウェアをインストールする必要があります。現在、サーバー コンピュータ上には WinPcap ソフトウェアがインストールされていません。\r\n\r\nWinPcap ソフトウェアのインストールを続行するためには、VPN Server が動作しているサーバー コンピュータ上で SoftEther EtherLogger Managerを起動し、localhost (自分自身) に対して接続した状態で、ローカルブリッジ機能設定画面を表示する必要があります。\r\n続行するには、一旦この管理セッションを終了し、サーバー コンピュータ上で SoftEther EtherLogger Manager を起動してから、localhost に対して接続して、設定を続行してください。 +EM_WPCAP_ROOT この SoftEther EtherLogger を使用するためには、WinPcap ソフトウェアをインストールする必要があります。\r\n\r\nインストールを継続するには、このコンピュータ上で Administrators (管理者) 権限を持ったユーザーでログオンする必要があります。\r\nAdministrators 権限でログオンし、もう一度 SoftEther VPN サーバー管理マネージャを起動してください。 +EM_WPCAP_INSTALL この SoftEther EtherLogger を使用するためには、WinPcap ソフトウェアをインストールする必要があります。現在、サーバー コンピュータ上には WinPcap ソフトウェアがインストールされていません。\r\n\r\nWinPcap はフリーソフトウェアであり、VPN Server の一部として同梱されているため、簡単にインストールすることができます。\r\n\r\nWinPcap のインストールを開始しますか? +EM_WPCAP_REBOOT1 WinPcap のインストールが完了した後に SoftEther EtherLogger を使用する場合は、コンピュータを再起動する必要があります。\r\n\r\nコンピュータを手動で再起動し、SoftEther EtherLogger が起動した後で、もう一度設定を行ってください。 +EM_WPCAP_REBOOT2 WinPcap のインストールが完了した後に、SoftEther EtherLogger サービスを再起動する必要があります。\r\n\r\nSoftEther EtherLogger サービスの再起動は短時間で完了しますが、現在この SoftEther EtherLogger に接続している管理セッションはすべて切断されます。\r\nこの管理セッションも切断されるため、続行するには再接続してください。\r\n\r\nSoftEther EtherLogger サービスを再起動しますか? +EM_RESOURCE WinPcap のドライバを読み込めませんでした。 + + + +########################################################################### +# # +# ソフトウェア内のダイアログボックスの文字列データ # +# # +########################################################################### + + +PREFIX D_SECURE +CAPTION %s - %S へのアクセス +S_TITLE %S へのアクセス +S_DEVICE_INFO デバイス名: %S\r\n製造元: %S +IDS_STATIC1 デバイス情報 +S_WARNING 一定回数 PIN コードを間違えるとデバイスにアクセスできなくなる場合があります。ご注意ください。 +IDOK &OK +IDCANCEL キャンセル +S_PIN_CODE &PIN コード: + + +PREFIX D_PKCSUTIL +CAPTION PKCS#12 書き込みユーティリティ +S_TITLE ePass 1000 USB トークン PKCS#12 書き込みユーティリティ +STATIC1 このユーティリティを使用すると、任意の PKCS#12 ファイル (証明書ファイル) を ePass 1000 USB ハードウェアセキュリティトークンに書き込むことができます。\r\n\r\n証明書ファイルが書き込まれた USB トークンは、SoftEther VPN の認証に使用できます。 +STATIC2 PKCS#12 ファイルの書き込み +STATIC3 既存の PKCS#12 ファイルを USB トークンに書き込む場合は、[書き込み] をクリックしてください。\r\n※ すでに USB トークン内に SoftEther VPN 用の PKCS#12 証明書が格納されている場合は上書きされます。 +B_WRITE 書き込み(&W) +STATIC4 USB トークン内の PKCS#12 証明書の消去 +STATIC5 すでに SoftEther VPN 用の PKCS#12 証明書が格納されている USB トークンから、証明書データを消去することができます。 +B_ERASE 消去(&E) +IDCANCEL ユーティリティの終了(&X) +S_COPYRIGHT Copyright (c) SoftEther VPN Project.\r\nAll Rights Reserved. + + +PREFIX D_PASSPHRASE +CAPTION 秘密鍵のパスフレーズ +STATIC1 秘密鍵はパスフレーズによって保護されています。\r\n\r\n秘密鍵を読み取るためのパスフレーズを入力してください。 +STATIC2 パスフレーズ(&P): +IDOK &OK +IDCANCEL キャンセル + + +PREFIX D_NM_CONNECT +CAPTION SoftEther VPN User-mode Router へ接続 +S_TITLE %S に接続しています... + + +PREFIX D_PASSWORD +CAPTION %S へのログイン +S_TITLE サーバー %S にログインするためのユーザー名とパスワードを入力してください。また、正しいアカウントの種類が選択されていることを確認してください。 +STATIC1 ユーザー情報の入力(&R): +STATIC2 アカウントの種類(&T): +STATIC3 ユーザー名(&N): +STATIC4 パスワード(&P): +R_NO_SAVE_PASSWORD パスワードを保存しない(&D) +S_COUNTDOWN 入力が行われない場合、あと %u 秒後に自動的に再接続します... +IDOK &OK +IDCANCEL 接続の中断 + + +PREFIX D_STATUS +CAPTION %s に接続しています... +S_STATUS 初期化しています... +IDCANCEL キャンセル + + +PREFIX D_CERT +CAPTION 証明書 +S_TITLE この証明書に関する情報は以下の通りです。 +STATIC1 証明書基本情報: +STATIC2 発行先: +STATIC3 発行者: +STATIC4 有効期限: +STATIC5 証明書詳細情報: +STATIC6 この証明書を署名した証明機関の証明書: +S_PARENT この証明書を署名した証明機関の証明書が信頼できる証明書のリストに登録されています。 +S_PARENT_BUTTON_STR 証明書の表示(&V) +IDCANCEL &OK +B_SAVE ファイルに保存(&S) + + +PREFIX D_CHECKCERT +CAPTION セキュリティの警告 - %s +S_TITLE 現在接続しようとしている接続先 VPN Server "%S" との間の通信は暗号化されていますが、サーバーが提示したサーバー証明書が信頼できるかどうかはわかりません。 +STATIC1 サーバー証明書について +STATIC2 VPN 通信では、サーバーとクライアントの間で暗号化通信 (SSL セッション) を確立します。その際にサーバーの証明書を確認することによって、接続しようとしているサーバーが本物かどうかを検証することができます。 +S_MSG1 接続先の VPN Server "%S" が提示したサーバー証明書は以下のとおりです。 +STATIC3 発行先: +STATIC4 発行者: +STATIC5 有効期限: +B_SHOW 証明書を表示する(&S) +STATIC6 ダイジェスト (MD5): +STATIC7 ダイジェスト (SHA-1): +IDOK 接続を続ける(&R) +IDCANCEL 接続をキャンセル(&C) +STATIC8 このサーバー証明書は、信頼された証明機関により発行されていないか、有効期限切れか、その他の問題がある可能性があります。 +STATIC9 上記の証明書の内容を確認してから、この VPN Server への接続を行うかどうかを決定してください。[接続をキャンセル] をクリックすると、このサーバーへの接続を中断します。 + + +PREFIX D_CONNECTERROR +CAPTION 接続エラー - %s +S_TITLE VPN サーバー "%S" との通信で以下のエラーが発生しました。 +S_COUNTDOWN あと %u 秒後に自動的に再接続します... +IDOK 再試行(&R) +IDCANCEL 接続の中断 +R_HIDE 今回の接続時にはこのウインドウを非表示にする(&H) + + +PREFIX D_CM_LOGIN +CAPTION パスワードの入力 - VPN クライアント接続マネージャ +S_TITLE %s 上で動作している VPN Client を操作するためには、クライアント管理パスワードが必要です。クライアント管理パスワードを入力してください。 +STATIC1 パスワード(&P): +STATIC2 クライアント管理パスワードの入力: +IDOK &OK +IDCANCEL キャンセル + + +PREFIX D_CONNECTION_STATUS +S_TITLE 接続設定 %s の VPN セッションの状況 (リアルタイム) +B_POLICY セキュリティポリシー(&P)... +B_SERVER_CERT サーバー証明書(&S) +B_CLIENT_CERT クライアント証明書(&E) +IDCANCEL 閉じる(&C) + + +PREFIX D_CM_POLICY +CAPTION セキュリティポリシー一覧 +S_TITLE 接続設定 %s の現在のセッションに設定されているセキュリティポリシー +IDCANCEL 閉じる(&C) + + +PREFIX D_CM_ACCOUNT +STATIC1 VPN Server への接続設定を行います。 +S_ACCOUNT_NAME 接続設定名(&T): +STATIC2 接続先 VPN Server の指定(&B): +STATIC3 接続したい VPN Server が動作しているコンピュータのホスト名または IP アドレス、ポート番号、および仮想 HUB 名を指定してください。 +STATIC4 ホスト名(&H): +STATIC5 ポート番号(&P): +STATIC6 (TCP ポート) +STATIC7 仮想 HUB 名(&V): +STATIC8 経由するプロキシサーバーの設定(&X): +STATIC9 プロキシサーバーを経由して VPN Server に接続することができます。 +STATIC10 プロキシの種類(&M): +R_DIRECT_TCP 直接 TCP/IP 接続 (プロキシを使わない) (&D) +R_HTTPS HTTP プロキシサーバー経由接続(&Q) +R_SOCKS SOCKS4 プロキシサーバー経由接続(&S) +R_SOCKS5 SOCKS5 プロキシサーバー経由接続(&S) +B_PROXY_CONFIG プロキシサーバーの接続設定(&2) +STATIC11 サーバー証明書の検証オプション(&F): +R_CHECK_CERT サーバー証明書を必ず検証する(&3) +B_TRUST 信頼する証明機関の証明書の管理(&4) +B_SERVER_CERT 固有証明書の登録(&R) +B_VIEW_SERVER_CERT 固有証明書の表示(&5) +S_VLAN_GROUP 使用する仮想 LAN カード(&L): +S_POLICY_1 カスケード接続を行う際に、この仮想 HUB 側で生成されるセッションに適用するセキュリティポリシーを設定することができます。 +B_POLICY セキュリティポリシー(&L) +STATIC12 ユーザー認証(&A): +STATIC13 認証の種類(&6): +S_USERNAME ユーザー名(&U): +S_PASSWORD パスワード(&Y): +S_CERT_INFO ユーザー認証に使用するクライアント証明書を指定する必要があります。 +STATIC14 通信の詳細設定(&G): +R_RETRY VPN Server との通信が切断された場合は再接続する(&Z) +S_RETRY_NUM_1 再接続回数(&C): +S_RETRY_NUM_2 回 +S_RETRY_SPAN_1 再接続間隔(&K): +S_RETRY_SPAN_2 秒 +R_INFINITE 無限に再接続を試行する (常時接続) (&I) +B_DETAIL 高度な通信設定(&N)... +IDOK &OK +IDCANCEL キャンセル +B_CHANGE_PASSWORD パスワードの変更(&J) +S_CHANGE_PASSWORD VPN Server 側のユーザーのパスワードを変更できます。 +R_HIDE 接続中の画面とエラー画面を非表示(&W) +R_HIDE2 IP アドレスメッセージを非表示(&9) +STATIC15 VPN Server に接続する際に必要なユーザー認証情報を設定してください。 +B_REGIST_CLIENT_CERT クライアント証明書の指定(&8) +B_IE IE の設定を使用(&E) +R_DISABLE_NATT NAT-T 無効 + + +PREFIX D_CM_PROXY +CAPTION プロキシサーバーの接続設定 +STATIC1 経由するプロキシサーバー (HTTP プロキシまたは SOCKS プロキシ) のホスト名または IP アドレス、ポート番号、および必要な場合はユーザー名とパスワードを入力してください。 +STATIC2 ホスト名(&H): +STATIC3 ポート番号(&A): +STATIC4 ユーザー名(&U): +STATIC5 パスワード(&P): +B_HTTP_HEADER Custom HTTP header values +IDOK &OK +IDCANCEL キャンセル +STATIC6 (オプション) +STATIC7 (オプション) + + +PREFIX D_CM_PROXY_HTTP_HEADER +CAPTION Custom Proxy HTTP Header Values +B_NEW New +B_DELETE Delete +B_CLEAR Clear +IDOK &OK +IDCANCEL Cancel + + +PREFIX D_CM_DETAIL +CAPTION 高度な通信設定 +STATIC1 ネットワーク、通信プロトコル、およびセキュリティに関する詳しい知識をお持ちの方とシステム管理者向けのオプションです。VPN プロトコルの通信設定をカスタマイズできます。 +STATIC2 VPN 通信の最適化(&T): +STATIC3 VPN Server との間の VPN 通信セッションにおけるデータ伝送に複数本の TCP コネクションを束ねて使用することにより、通信速度を向上できる場合があります。 +STATIC4 VPN 通信に使用する TCP コネクション数(&N): +STATIC5 本 +STATIC6 ※ サーバーへの接続回線が高速な場合は 8 本程度を、ダイヤルアップ等の低速な場合は 1 本をお勧めします。 +STATIC7 詳細設定: +STATIC8 各 TCP コネクションの確立間隔(&S): +STATIC9 秒 +R_USE_DISCONNECT 各 TCP コネクションの寿命を設定する(&A) +STATIC10 寿命(&P): +STATIC11 秒 +STATIC12 2 本以上の TCP コネクションを束ねて VPN 通信を行う際、「半二重モード」を使用することができます。\r\n半二重モードを有効にすると、自動的に各 TCP コネクションのデータ伝送方向を半数ずつ固定することができます。\r\n\r\nたとえば、8 本の TCP コネクションを使用して VPN セッションを確立した場合、半二重モードを有効にすると、4 本の TCP コネクションはアップロード方向専用、残りの 4 本のコネクションはダウンロード方向専用に固定され通信が行われます。 +R_USE_HALF_CONNECTION 半二重モードを使用する(&H) +STATIC13 暗号化と圧縮(&C): +STATIC14 通常は、VPN Server との間の通信を SSL で暗号化して、情報の盗聴や改ざんを防止します。暗号化を無効にすることもできます。暗号化を無効にすると、通信のスループットが向上しますが、通信データは平文でネットワーク上を流れます。 +R_USE_ENCRYPT VPN Server との間の通信を SSL で暗号化する(&E) +STATIC15 データ圧縮技術を使用して、VPN 通信を圧縮することができます。ダイヤルアップ接続やモバイル接続など、低速回線でのみ使用してください。 +R_DISABLE_UDP UD&P 高速化機能を無効にする +R_USE_COMPRESS データ圧縮を使用する(&U) +STATIC16 接続モードの選択(&M): +S_MODE VPN Server に下記の接続モードを指定して接続することができます。(ネットワーク管理者用) +R_BRIDGE ブリッジ / ルータモードで接続(&B) +R_MONITOR モニタリングモードで接続(&D) +STATIC17 その他の設定(&G): +R_NO_ROUTING ルーティングテーブルの調整処理を行わない(&R) +STATIC18 この設定画面の設定項目は、システム管理者から指示があった場合や、ネットワークやセキュリティに関して詳しい知識をお持ちの場合以外は変更しないでください。 +STATIC19 VoIP / QoS 対応機能を使用すると、IP 電話パケットなどの優先度の高いパケットを VPN 内で高速に伝送できます。 +R_DISABLE_QOS VoIP / QoS 対応機能を無効にする(&Q) +IDOK &OK +IDCANCEL キャンセル +S_UDPACCEL データ圧縮技術を使用して、VPN 通信を圧縮することができます。ダイヤルアップ接続やモバイル接続など、低速回線でのみ使用してください。 + + +PREFIX D_CM_NEW_VLAN +CAPTION 新しい仮想 LAN カードの作成 +S_INFO 新しい仮想 LAN カードをシステムに追加します。\r\n仮想 LAN カードには英数字 %u 文字以内の名前を付けることができます。 +STATIC1 仮想 LAN カードの名前(&N): +IDOK &OK +IDCANCEL キャンセル +S_WIN8 仮想 LAN カード名には 'VPN'、または 'VPN2' から 'VPN127' までの名前を指定してください (合計 127 個作成可能)。 + + +PREFIX D_CM_TRUST +CAPTION 信頼する証明機関の証明書の管理 +STATIC1 VPN Client が信頼する証明機関の証明書一覧を管理します。\r\n\r\nここで登録された証明機関の証明書一覧は、VPN Server への接続時のサーバー証明書の検証などに利用されます。 +B_IMPORT 追加(&A) +B_EXPORT エクスポート(&E) +IDOK 証明書の表示(&V) +IDCANCEL 閉じる(&C) +B_DELETE 削除(&D) + + +PREFIX D_CM_PASSWORD +CAPTION パスワードの設定 - VPN クライアント接続マネージャ +S_TITLE この SoftEther VPN Client サービスの制御を行うためのパスワードを設定することができます。\r\nパスワードを設定すると、次回 VPN クライアント接続マネージャで SoftEther VPN Client サービスに接続する際にパスワードの入力が求められます。 +STATIC1 クライアント管理パスワードの設定: +R_USE_PASSWORD パスワードを設定する(&U) +R_REMOTE_ONLY パスワードはリモートから操作を行う場合のみ要求する(&R) +IDC_STATIC1 パスワード(&P): +IDC_STATIC2 確認入力(&E): +IDOK &OK +IDCANCEL キャンセル + + +PREFIX D_CM_CONFIG +CAPTION オプション設定 +STATIC1 VPN Client の動作に関する設定を変更できます。 +STATIC2 リモート管理の設定(&E) +STATIC3 VPN Client サービスプログラムを別のコンピュータ上から VPN クライアント接続マネージャによってリモート管理することが可能です。 +R_ALLOW_REMOTE_CONFIG VPN Client サービスのリモート管理を許可する(&R) +S_WARNING リモート管理を許可する場合、パスワードを設定しておくことを強くお勧めします。パスワードは [ツール] メニューの [パスワードの設定] をクリックして設定することができます。 +STATIC4 一定期間無通信状態が続くと接続が自動的に切断されるようなネットワーク接続環境の場合、インターネット上の任意のサーバーに対して一定間隔ごとにパケットを送信することにより、インターネット接続を維持することができます。 +R_USE_KEEP_CONNECT インターネット接続の維持機能を使用する(&K) +S_HOSTNAME ホスト名(&H): +S_PORT ポート番号(&P): +S_INTERVAL パケット送出間隔(&I): +S_INTERVAL2 秒間に 1 パケット +S_PROTOCOL プロトコル(&C): +R_TCP TCP/IP プロトコル(&T) +R_UDP UDP/IP プロトコル(&U) +S_INFO インターネット接続維持のために送信されるパケットはランダムな内容であり、コンピュータやユーザーを識別する個人情報などが送信されることはありません。 +IDOK &OK +IDCANCEL キャンセル +STATIC5 その他の設定(&S) +R_ALPHA ウインドウを半透明にする(&A) +STATIC6 ※ 半透明の設定は接続マネージャを再起動するまで適用されません。 +STATIC7 インターネット接続の維持機能(&N) + + +PREFIX D_ABOUT +S_INFO1 SoftEther VPN %u.0 Developer Edition (Ver %u.%02u, Build %u) +S_INFO2 Licensed under the Apache License, Version 2.0.\r\nCopyright (c) 2012-%u all contributors on SoftEther VPN project in GitHub. All Rights Reserved.\r\nWeb Site: http://www.softether.org/\r\n%S +S_INFO3 This product includes the following software components:\r\nBitVisor: Copyright (c) 2007, 2008 University of Tsukuba. Copyright (C) 2007, 2008 National Institute of Information and Communications Technology. All rights reserved. / Microsoft(R) C Runtime Library: (c) 2007 Microsoft Corporation. All Rights Reserved. / PKCS #11 Cryptographic Token Interface (Cryptoki): Copyright (c) RSA Security Inc. / WinPcap: Copyright (c) 2001 - 2003 NetGroup, Politecnico di Torino (Italy). All rights reserved. / libedit: Copyright (c) 1992, 1993 The Regents of the University of California. All rights reserved. / libiconv: Copyright (C) 2007 Free Software Foundation, Inc. / ncurses: Copyright (c) 1998-2005, 2006 Free Software Foundation, Inc. / OpenSSL: Copyright (c) 1998-2011 The OpenSSL Project. All rights reserved. This product includes software developed by the OpenSSL Project for use in the OpenSSL Toolkit (http://www.openssl.org/). This product includes cryptographic software written by Eric Young (eay@cryptsoft.com). / zlib: (C) 1995-2004 Jean-loup Gailly and Mark Adler. / Special Thanks to: Software Laboratory, Academic Computing Communication Center, Industrial Liaison and Cooperative Research Center and Professor Yasushi Shinjo in University of Tsukuba, Japan. +S_INFO4 本ソフトウェアは筑波大学 SoftEther VPN プロジェクトで開発されたフリーウェアです。本ソフトウェアは一切の保証がない状態で提供されるものであり、開発および配布元は使用の結果の損害について一切責任を負いません。\r\n\r\nSoftEther VPN ソフトウェアは日本国経済産業省のソフトウェア研究開発プロジェクトの成果物です。IPA (独立行政法人 情報処理推進機構) の未踏ソフトウェア創造事業に採択され開発されました。詳しくは http://www.ipa.go.jp/ をご覧ください。 +IDCANCEL &OK +B_WEB SoftEther VPN の Web サイト(&W)... +B_EULA 使用許諾契約書(&E) +B_IMPORTANT 重要事項説明書(&I) +B_LEGAL 法律上の通知(&L) +B_UPDATE_CONFIG 更新通知設定(&C) +B_AUTHORS 開発者の一覧(&A) + + +PREFIX D_REMOTE +STATIC1 接続するコンピュータのホスト名または IP アドレスを指定してください(&S): +R_LOCAL ローカルコンピュータ (この画面を表示しているコンピュータ) に接続(&L) +S_HOSTNAME コンピュータ名(&C): +IDOK &OK +IDCANCEL キャンセル + + +PREFIX D_CM_DESKTOP +CAPTION 接続 - %s +S_TITLE 接続設定 "%s" の接続処理を開始します。 +S_WARNING VPN Client は、VPN Server への接続中の進行状況やエラー メッセージなどを、%sの 「コンソールセッション」 の画面上に出力します。 +S_INFO 接続を継続してもよろしいですか? +IDOK 継続(&C) +IDCANCEL キャンセル + + +PREFIX D_CM_CHANGE_PASSWORD +CAPTION パスワードの変更 +S_TITLE サーバー %S 上に登録されているユーザーのパスワードを変更することができます。 +STATIC1 パスワードの変更(&P) +STATIC2 仮想 HUB 名(&H): +STATIC3 ユーザー名(&U): +STATIC4 古いパスワード(&W): +STATIC5 新しいパスワード(&N): +STATIC6 新しいパスワードの\r\n確認入力(&C): +IDOK &OK +IDCANCEL キャンセル +S_STATIC ※ [RADIUS または NT ドメイン認証] を使用して認証するユーザーのパスワードは変更できません。 + + +PREFIX D_SM_MAIN +CAPTION SoftEther VPN Developer Edition サーバー管理マネージャ +STATIC1 SoftEther VPN Server への接続設定(&P): +STATIC2 以下の VPN Server または VPN Bridge への接続設定が登録されています。名前をダブルクリックすると、サーバーに接続できます。\r\n新しい接続を追加するには [新しい接続設定] をクリックしてください。 +B_NEW_SETTING 新しい接続設定(&N) +B_EDIT_SETTING 接続設定の編集(&E) +B_DELETE 接続設定の削除(&D) +IDOK 接続(&C) +B_SECURE_MANAGER スマートカードマネージャ(&S)... +B_SELECT_SECURE スマートカード選択(&M)... +B_ABOUT バージョン情報(&A) +IDCANCEL SoftEther VPN サーバー管理マネージャの終了(&X) +B_CERT_TOOL 証明書作成ツール(&R) + + +PREFIX D_SM_EDIT_SETTING +STATIC1 管理する VPN Server の接続設定を行います。 +STATIC2 接続設定名(&N): +STATIC3 接続先 VPN Server の指定(&B): +STATIC4 管理したい VPN Server が動作しているコンピュータのホスト名または IP アドレスおよひポート番号を指定してください。 +STATIC5 ホスト名(&H): +R_LOCALHOST このコンピュータ (localhost) に接続(&L) +STATIC6 ポート番号(&P): +STATIC7 (TCP ポート) +STATIC8 経由するプロキシサーバーの設定(&X): +STATIC9 プロキシサーバーを経由して VPN Server に接続することができます。 +STATIC10 プロキシの種類(&Y): +R_DIRECT_TCP 直接 TCP/IP 接続 (プロキシを使わない) (&D) +R_HTTPS HTTP プロキシサーバー経由接続(&T) +R_SOCKS SOCKS4 プロキシサーバー経由接続(&K) +R_SOCKS5 SOCKS5 プロキシサーバー経由接続(&K) +B_PROXY_CONFIG プロキシサーバーの接続設定(&R) +STATIC11 管理モードの選択とパスワードの入力(&M) +STATIC12 VPN Server には、サーバー管理モードと仮想 HUB 管理モードのどちらかのモードで接続できます。\r\n\r\nサーバー管理モードで接続すると、VPN Server の設定とすべての仮想 HUB が管理できます。\r\n\r\n仮想 HUB 管理モードで接続すると、権限を持っている仮想 HUB の管理ができます。 +R_SERVER_ADMIN サーバー管理モード(&S) +R_HUB_ADMIN 仮想 HUB 管理モード(&U) +S_HUBNAME 仮想 HUB 名(&V): +STATIC13 管理モードで接続する際のパスワードを入力してください。 +S_PASSWORD 管理パスワード(&A): +R_NO_SAVE 管理パスワードを保存しない(&W) +IDOK &OK +IDCANCEL キャンセル + + +PREFIX D_SM_SERVER +CAPTION %s - SoftEther VPN サーバー管理マネージャ +S_TITLE VPN Server "%S" の管理 +S_VHUB_BRIDGE このサーバーがホストしている仮想 HUB (&U): +IDOK 仮想 HUB の管理(&A) +B_ONLINE オンライン(&O) +B_OFFLINE オフライン(&F) +B_HUB_STATUS 状態の表示(&S) +B_CREATE 仮想 HUB の作成(&C) +B_EDIT プロパティ(&E) +B_DELETE 削除(&D) +STATIC1 リスナーの管理(&J) +STATIC2 リスナー一覧 (TCP/IP ポート) (&I): +B_CREATE_LISTENER 新規作成(&R) +B_DELETE_LISTENER 削除(&T) +B_START 開始(&G) +B_STOP 停止(&P) +S_UDP 複数の UDP ポートを指定するには、スペースかカンマで区切ってください。空欄にすると UDP リスナーを停止します。 +B_APPLY 適用 +STATIC3 サーバー情報の参照および設定(&N) +B_SSL 暗号化と通信関係の設定(&W) +B_STATUS サーバー状態の表示(&V) +B_INFO SoftEther VPN Server\r\nに関する情報(&Q) +B_LICENSE ライセンスの追加と削除(&L) +B_FARM クラスタリング構成(&M) +B_FARM_STATUS クラスタリング状態(&Z) +B_CONNECTION TCP/IP コネクション\r\n一覧の表示(&Y) +B_BRIDGE ローカルブリッジ設定(&B) +B_L3 レイヤ 3 スイッチ設定(&3) +B_CONFIG Config 編集(&K) +B_REFRESH 最新の状態に更新(&H) +IDCANCEL 閉じる(&X) +S_BETA ベータ版 (プレリリース) +B_IPSEC IPsec / L&2TP 設定 +B_DDNS ダイナミック DNS 設定 +S_DDNS 現在の DDNS ホスト名: +B_OPENVPN OpenVPN / MS-SSTP 設定 +B_AZURE VPN Azure 設定 +S_AZURE VPN Azure ホスト名: +B_VPNGATE VPN Gate サービス設定 + + +PREFIX D_SM_STATUS +IDOK 最新の状態に更新(&H) +IDCANCEL 閉じる(&X) + + +PREFIX D_SM_EDIT_HUB +STATIC1 仮想 HUB 名(&N): +STATIC2 セキュリティ設定(&S): +S_BOLD この仮想 HUB の管理用パスワード +STATIC3 パスワード(&P): +STATIC4 確認入力(&C): +R_NO_ENUM 匿名ユーザーに対してこの仮想 HUB を列挙しない(&U) +STATIC5 仮想 HUB オプション(&I): +R_LIMIT_MAX_SESSION 最大同時接続セッション数を制限する(&L) +S_MAX_SESSION_1 最大同時接続セッション数(&Z): +S_MAX_SESSION_2 セッション +STATIC6 (ローカルブリッジ、仮想 NAT、カスケード接続などによって生成されるサーバー側の仮想セッション数は含まない) +STATIC7 仮想 HUB の状態(&J): +STATIC8 仮想 HUB の状態を選択してください。 +R_ONLINE オンライン(&E) +R_OFFLINE オフライン(&F) +STATIC9 クラスタリング設定(&M): +S_FARM_INFO クラスタ内での仮想 HUB の種類を選択してください。 +R_STATIC スタティック仮想 HUB(&A) +R_DYNAMIC ダイナミック仮想 HUB(&D) +S_AO_1 仮想 HUB 管理オプション(&Y): +S_AO_3 仮想 HUB の管理オプションを表示および編集できます。 +B_ADMINOPTION 仮想 HUB 管理オプション(&K) +S_ACL_3 接続元 IP 制限リスト(&R): +S_ACL クライアントコンピュータの IP アドレスによって、この仮想 HUB への VPN 接続を許可または拒否することができます。 +B_ACL 接続元 IP 制限リスト(&T) +IDOK &OK +IDCANCEL キャンセル +STATIC10 仮想 HUB 拡張オプションを使用すると、この仮想 HUB に関するより詳細な設定を行うことができるようになります。 +B_EXTOPTION 仮想 HUB 拡張オプションの編集(&X) +S_MSG_1 接続時にメッセージを表示 +S_MSG_2 この仮想 HUB に VPN Client が接続した際に、ユーザーの画面にメッセージを表示できます。 +B_MSG メッセージの設定(&G) + + +PREFIX D_SM_CREATE_LISTENER +CAPTION リスナーの新規作成 +STATIC1 VPN Server がクライアントからの接続を待ち受ける TCP/IP ポート番号を追加することができます。\r\n\r\n新しく追加するポート番号を指定してください。 +STATIC2 ポート番号がすでに別のサーバー プログラムによって使用されている場合など、ポートの確保に失敗した場合は、リスナーの状態がエラー状態となります。\r\n\r\nその場合は、同じポート番号を開いている別のプログラムを停止してください。 +STATIC3 ポート番号(&P): +IDOK &OK +IDCANCEL キャンセル +STATIC4 (TCP/IP ポート) + + +PREFIX D_SM_SSL +CAPTION 暗号化と通信関係の設定 +STATIC1 この VPN Server の暗号化、通信、およびセキュリティに関する設定を参照または変更することができます。 +STATIC2 使用する暗号化アルゴリズム(&A): +STATIC3 この VPN Server に接続した VPN Client との間で使用される SSL に対応した暗号化アルゴリズム名を指定してください。暗号化アルゴリズムは SSL バージョン 3 に対応したものでなければなりません。 +STATIC4 暗号化アルゴリズム名(&C): +STATIC6 サーバー証明書(&E): +STATIC7 この VPN Server がクライアントに対して提示する X509 証明書と秘密鍵を指定してください。 +B_IMPORT インポート(&I) +B_EXPORT エクスポート(&X) +B_VIEW 証明書の表示(&V) +B_REGENERATE 新規作成(&N) +STATIC8 インターネット接続の維持機能: +STATIC9 一定期間無通信状態が続くと接続が自動的に切断されるようなネットワーク接続環境の場合、インターネット上の任意のサーバーに対して一定間隔ごとにパケットを送信することにより、インターネット接続を維持することができます。 +STATIC10 サーバー証明書: +R_USE_KEEP_CONNECT インターネット接続の維持機能を使用する(&K) +S_HOSTNAME ホスト名(&H): +S_PORT ポート番号(&F): +S_INTERVAL パケット送出間隔(&D): +S_INTERVAL2 秒 +S_PROTOCOL プロトコル(&L): +R_TCP TCP/IP プロトコル(&T) +R_UDP UDP/IP プロトコル(&U) +S_INFO インターネット接続維持のために送信されるパケットはランダムな内容であり、コンピュータやユーザーを識別する個人情報などが送信されることはありません。 +STATIC11 管理者パスワード(&W): +S_INFO4 この VPN Server 全体とすべての仮想 HUB に対する管理権限を有する管理者パスワードを設定または変更することができます。 +B_PASSWORD 管理者パスワードの変更(&P) +IDOK &OK +IDCANCEL キャンセル +IDCANCEL2 キャンセル +STATIC12 syslog 送信機能 +STATIC13 VPN サーバー / VPN ブリッジ全体のログ、仮想 HUB の管理ログおよび仮想 HUB のパケットログを、ディスク上のファイルに書き出す代わりに syslog プロトコルで転送することができます。 +STATIC14 syslog サーバーホスト名(&S): +STATIC15 ポート番号(&R): +S_OVER_FUNCS VPN over ICMP / DNS サーバー機能 +S_INFO5 ファイアウォールやルータで TCP/IP の通信が遮断されている場合でも、ICMP または DNS パケットのみを用いて VPN を確立できます。 +B_SPECIALLISTENER VPN over ICMP / DNS 設定 +B_UPDATE_CONFIG 更新通知設定(&U)... + + +PREFIX D_SM_SAVE_KEY_PAIR +CAPTION 証明書と秘密鍵の保存 +STATIC1 証明書と秘密鍵を保存する方法を選択してください。 +STATIC2 保存方法(&V): +R_X509_AND_KEY X509 証明書ファイル (.CER) と秘密鍵ファイル (.KEY) の組合せとして保存する(&X) +R_PKCS12 PKCS#12 ファイル (.P12) として保存する(&P) +R_SECURE スマートカードに書き込む(&W) +STATIC3 標準的な Base 64 にエンコードされた証明書ファイルと秘密鍵ファイルの 2 つのファイルに分けて保存します。 +STATIC4 PKCS#12 (Public Key Cryptography Standard #12) ファイルとして保存します。\r\n1 つの PKCS#12 ファイルには、証明書と秘密鍵の両方を格納することが出来ます。 +STATIC5 このコンピュータにスマートカードが接続されている場合は、スマートカード内に証明書と秘密鍵を同時に書き込むことができます。 +B_SELECT 使用するスマートカードの選択(&S)... +S_PASS3 秘密鍵の保護(&R) +S_PASS4 秘密鍵を保存する際にパスフレーズを設定することができます。パスフレーズを設定した秘密鍵は、読み取る際にパスフレーズを入力する必要があります。 +R_USE_PASS パスフレーズを設定する(&A) +S_PASS1 パスフレーズ(&H): +S_PASS2 確認入力(&E): +IDOK &OK +IDCANCEL キャンセル +B_SECURE_MANAGER スマートカードマネージャ(&M)... + + +PREFIX D_SM_CONNECTION +CAPTION コネクション一覧 +S_TITLE 現在、サーバー %S に接続中のコネクションは以下のとおりです。ただし、VPN セッションが確立済みのコネクションは表示されません。 +IDOK コネクションの情報を表示(&I) +B_DISCONNECT 切断(&D) +B_REFRESH 最新の状態に更新(&H) +IDCANCEL 閉じる(&X) + + +PREFIX D_SM_FARM +CAPTION クラスタリング構成 +S_TITLE VPN Server "%S" のクラスタリング構成を変更できます。 +STATIC1 複数台の VPN Server でクラスタを構成すると、ロードバランシング (負荷分散) およびフォールトトレランスの確保を実現することができます。 +STATIC2 現在の動作モード: +STATIC3 クラスタリング構成の設定(&T): +R_STANDALONE スタンドアロンサーバー (クラスタリング構成無し) (&S) +R_CONTROLLER クラスタコントローラ(&C) +R_MEMBER クラスタメンバサーバー(&M) +STATIC4 クラスタメンバサーバー時の設定項目(&E): +S_IP_1 公開 IP アドレス(&I): +S_IP_2 (公開 IP アドレスを入力しない場合は、クラスタコントローラへの接続の際に使用されるネットワークインターフェイスの IP アドレスが自動的に使用されます。) +S_PORT_1 公開ポート一覧(&P): +S_PORT_2 (複数入力する場合はスペースまたはカンマで区切ってください。) +S_CONTROLLER コントローラのホスト名または IP アドレス(&H): +S_CONTROLLER_PORT コントローラの\r\nポート番号(&R): +S_PORT_3 (TCP ポート) +S_PASSWORD 管理パスワード(&D): +STATIC5 クラスタリング構成を変更すると、VPN Server サービスが自動的に再起動します。その際、現在接続されているすべてのセッションおよび管理用コネクションが切断されます。 +IDOK &OK +IDCANCEL キャンセル +S_1 クラスタ内での性能基準比(&W): +S_2 (標準: 100) +R_CONTROLLER_ONLY コントローラ機能のみ (自身は VPN 通信を処理しない) + + +PREFIX D_SM_FARM_MEMBER +CAPTION クラスタメンバ一覧 +S_TITLE 現在、クラスタコントローラ %S には以下のクラスタメンバサーバーが接続しています。 +IDOK クラスタメンバサーバーの情報を表示(&I) +B_REFRESH 最新の状態に更新(&H) +IDCANCEL 閉じる(&X) +B_CERT サーバー証明書の表示(&C) + + +PREFIX D_SM_CHANGE_PASSWORD +CAPTION %S の管理者パスワードの設定 +S_TITLE サーバー %S の管理者パスワードを設定します。新しいパスワードを入力してから [OK] をクリックしてください。 +STATIC1 新しいパスワード(&P): +STATIC2 確認入力(&C): +IDOK &OK +IDCANCEL キャンセル + + +PREFIX D_SM_HUB +CAPTION 仮想 HUB の管理 - %S +S_TITLE %S の管理 +STATIC1 セキュリティデータベースの管理(&D): +B_USER ユーザーの管理(&U) +S_USER ユーザー アカウントを追加・削除・編集できます。 +B_GROUP グループの管理(&G) +S_GROUP グループを追加・削除・編集できます。 +B_ACCESS アクセスリストの管理(&A) +S_ACCESS アクセスリスト (パケットフィルタリングルール) を追加・削除できます。 +STATIC2 仮想 HUB 設定(&N) +B_PROPERTY 仮想 HUB のプロパティ(&P) +S_PROPERTY この仮想 HUB の設定を変更できます。 +B_RADIUS 認証サーバーの設定(&E) +S_RADIUS ユーザー認証に使用する RADIUS 認証サーバーの設定を行うことができます。 +B_LINK カスケード接続の管理(&C) +S_LINK 同一または別のサーバー上の複数の仮想 HUB 同士をカスケード接続することができます。 +STATIC3 この仮想 HUB の現在の状況(&R): +B_REFRESH 最新の状態に更新(&H) +STATIC4 その他の管理(&O) +B_LOG ログ保存設定(&L) +B_LOG_FILE ログファイル一覧(&Q) +S_LOG ログの保存に関する設定を行うことができます。 +B_CA 信頼する証明機関の証明書(&T) +B_CRL 無効な証明書(&K) +S_CA この仮想 HUB が信頼する証明機関の証明書を管理します。 +B_SNAT 仮想 NAT および仮想 DHCP サーバー機能(&V) +S_SNAT この仮想 HUB 内で SecureNAT 機能を動作させます。仮想 NAT と仮想 DHCP を稼動できます。 +STATIC5 セッションの管理(&I): +B_SESSION セッションの管理(&S) +IDCANCEL 閉じる(&X) + + +PREFIX D_SM_USER +CAPTION ユーザーの管理 +S_TITLE 仮想 HUB "%S" に登録されているユーザーは以下の通りです。 +IDOK 編集(&E) +B_CREATE 新規作成(&C) +B_DELETE 削除(&D) +B_REFRESH 最新の状態に更新(&R) +IDCANCEL 閉じる(&X) +B_STATUS ユーザー情報表示(&V) + + +PREFIX D_SM_EDIT_USER +IDC_STATIC1 ユーザー名(&U): +IDC_STATIC3 本名(&R): +IDC_STATIC4 説明(&N): +IDC_STATIC5 グループ名\r\n(省略可能): +B_GROUP グループの参照(&J)... +R_EXPIRES このアカウントの有効期限を設定する(&S) +IDC_STATIC6 認証方法(&A): +S_RADIUS_3 RADIUS または NT ドメイン認証 +S_RADIUS_1 外部の RADIUS サーバー、Windows NT ドメインコントローラ、または Active Directory コントローラによってユーザーが入力したパスワードが検証されます。 +R_SET_RADIUS_USERNAME 認証サーバー上のユーザー名を指定する(&K) +S_RADIUS_2 認証サーバーにおけるユーザー名(&T): +S_POLICY_1 セキュリティポリシー +R_POLICY このユーザーのセキュリティポリシーを設定する(&Y) +B_POLICY セキュリティポリシー(&M) +S_PASSWORD_1 パスワード認証 +S_PASSWORD_2 パスワード(&P): +S_PASSWORD_3 パスワードの確認入力(&C): +S_USER_CERT_1 固有証明書認証 +B_LOAD_CERT 証明書の指定(&E) +B_VIEW_CERT 証明書の表示(&V) +B_CREATE 証明書作成ツール(&W) +S_ROOT_CERT_1 署名済み証明書認証 +S_ROOT_CERT_2 クライアント証明書がこの仮想 HUB の信頼する証明機関の証明書によって署名されているかどうかを検証します。 +R_CN 証明書の Common Name (CN) の値を限定する(&B) +R_SERIAL 証明書のシリアル番号の値を限定する(&L) +S_ROOT_CERT_3 ※ 16 進数で入力してください。(例: 0155ABCDEF) +S_HINT ヒント: ユーザー名が '*' (アスタリスク) のユーザーを作成すると、他に明示的に一致するユーザー名の定義がないユーザーが接続しようとした場合に外部認証サーバーを使用したパスワード認証による接続を許可できます。 +IDOK &OK +IDCANCEL キャンセル + + +PREFIX D_SM_POLICY +STATIC1 選択されているポリシー(&P): +S_BOLD このポリシーの説明(&C): +S_BOLD2 設定値(&V): +R_ENABLE このポリシーを有効にする(&E) +R_DISABLE このポリシーを無効にする(&D) +R_DEFINE このポリシーの値を定義する(&F) +IDOK &OK +IDCANCEL キャンセル + + +PREFIX D_SM_GROUP +CAPTION グループの管理 +S_TITLE 仮想 HUB "%S" に登録されているグループは以下の通りです。 +B_CREATE 新規作成(&C) +IDOK 編集(&E) +B_DELETE 削除(&D) +B_REFRESH 最新の状態に更新(&R) +B_USER メンバ一覧(&M) +IDCANCEL 閉じる(&X) + + +PREFIX D_SM_EDIT_GROUP +IDC_STATIC1 グループ名(&G): +IDC_STATIC3 本名(&R): +IDC_STATIC4 説明(&N): +S_POLICY_1 セキュリティポリシー +R_POLICY このグループのユーザーのセキュリティポリシーを設定する(&Y) +B_POLICY セキュリティポリシー(&M) +S_POLICY_2 このグループの統計情報 +IDOK &OK +IDCANCEL キャンセル + + +PREFIX D_SM_ACCESS_LIST +CAPTION アクセスリスト +S_TITLE 仮想 HUB "%S" には、現在以下のアクセスリスト (パケットフィルタリングルール) が登録されています。 +B_ADD 追加 (IPv&4) +B_ADD_V6 追加 (IPv&6) +IDOK 編集(&E) +B_DELETE 削除(&D) +B_SAVE 保存(&S) +IDCANCEL キャンセル(&C) +STATIC1 優先順位はリストの上のものほど高くなります。 +STATIC2 VPN Server では、どのアクセスリスト項目にも一致しなかった IP パケットは、無条件で仮想 HUB を通過できます。 +B_CLONE クローン(&O) +B_ENABLE 有効にする(&N) +B_DISABLE 無効にする(&I) + + +PREFIX D_SM_EDIT_ACCESS +CAPTION アクセスリスト項目の編集 +STATIC1 アクセスリスト項目を設定してください。ここで設定したアクセスリストは、仮想 HUB 内を通過するすべての IP パケットに対して適用されます。 +STATIC2 基本設定 +STATIC3 アクセスリストの説明(&N): +STATIC4 動作(&A): +R_PASS 通過(&P) +R_DISCARD 破棄(&D) +STATIC5 優先順位(&R): +STATIC6 (整数値: 小さいほど\r\n優先順位が高くなります) +STATIC7 IP ヘッダに関するフィルタリングオプション +S_ACCESS_SRC_ALL 送信元 IP アドレス: +R_SRC_ALL すべての送信元に対して適用する +S_SRC_IP_1 IPv4 アドレス: +S_SRC_IP_2 マスク: +S_SRC_IP_3 (255.255.255.255: 単一ホスト) +S_SRC_IP_1_V6 IPv6 アドレス: +S_SRC_IP_3_V6 (マスク表記例: "ffff:ff00::" または "/24"。単一ホストの場合は "/128") +S_ACCESS_DST_ALL 宛先 IP アドレス: +R_DST_ALL すべての宛先に対して適用する +S_IP_DST_1 IPv4 アドレス: +S_IP_DST_2 マスク: +S_IP_DST_3 (255.255.255.255: 単一ホスト) +S_IP_DST_1_V6 IPv6 アドレス: +S_IP_DST_3_V6 (マスク表記例: "ffff:ff00::" または "/24"。単一ホストの場合は "/128") +STATIC9 プロトコルの種類: +STATIC10 TCP ヘッダまたは UDP ヘッダに関するフィルタリングオプション +S_TCP_1 最小値 +S_TCP_2 最大値 +S_TCP_3 送信元ポート番号: +S_TCP_5 宛先ポート番号: +S_TCP_7 ポート番号が空欄の場合はすべてのポートに対して適用されます。\r\n最小値が指定されていて最大値が指定されていない場合は最小値と一致するパケットのみ適用されます。 +STATIC11 ユーザーまたはグループに関するフィルタリングオプション +STATIC11_OLD ユーザーに関するフィルタリングオプション +STATIC12 このアクセスリスト項目を特定のユーザーまたはグループが送信したパケット、または特定のユーザーまたはグループによって受信されるパケットに対してのみ適用することができます。 +STATIC12_OLD このアクセスリスト項目を特定のユーザーが送信したパケット、または特定のユーザーによって受信されるパケットに対してのみ適用することができます。 +STATIC13 送信元の名前: +B_USER1 参照... +STATIC14 宛先の名前: +B_USER2 参照... +STATIC15 それぞれユーザー名またはグループ名のどちらかを指定してください。指定しない場合は空欄にしてください。 +STATIC15_OLD それぞれユーザー名を指定してください。指定しない場合は空欄にしてください。 +IDOK &OK +IDCANCEL キャンセル +S_PROTOID IP プロトコル番号の指定: +STATIC16 MAC ヘッダに関するフィルタリングオプション +S_CHECK_SRC_MAC 送信元 MAC アドレス: +R_CHECK_SRC_MAC すべての送信元に対して適用する +S_SRC_MAC MAC アドレス: +S_SRC_MAC_MASK マスク: +S_CHECK_DST_MAC 宛先 MAC アドレス: +R_CHECK_DST_MAC すべての宛先に対して適用する +B_SIMULATION 遅延・パケットロス生成機能(&L)... +S_DST_MAC MAC アドレス: +S_DST_MAC_MASK マスク: +S_MAC_NOTE MAC アドレスとマスクに 16 進数と "-" または ":" の文字が使えますが、省略することも可能です。(FF-FF-FF-FF-FF-FF: 単一ホスト) +R_CHECK_TCP_STATE TCP コネクションの状態を検査 (TCP パケットのみ) +R_ESTABLISHED 確立済みパケット +R_UNESTABLISHED 未確立パケット +R_REDIRECT HTTP アクセスを強制的に指定 URL へリダイレクト +B_REDIRECT リダイレクト先 URL... + + +PREFIX D_SM_RADIUS +CAPTION 認証サーバーの設定 +S_TITLE 仮想 HUB "%S" にユーザーが RADIUS サーバー認証モードで接続した場合に、ユーザー名とパスワードを確認する外部の RADIUS サーバーを指定することができます。 +STATIC1 RADIUS サーバーの設定(&F): +R_USE_RADIUS RADIUS 認証を使用する(&U) +S_RADIUS_1 RADIUS サーバーのホスト名または IP アドレス(&S): +S_RADIUS_2 ポート番号(&P): +S_RADIUS3 (UDP ポート) +S_RADIUS_4 共有シークレット(&E): +S_RADIUS_5 共有シークレットの確認入力(&C): +S_RADIUS_6 RADIUS サーバーは、この VPN Server の IP アドレスからの要求を受け付けるように設定しておく必要があります。また、Password Authentication Protocol (PAP) による認証が有効になっている必要があります。 +S_RADIUS_7 ミリ秒 (%u 以上 %u 未満) +S_RADIUS_8 再試行間隔(&R): +S_RADIUS_9 (, または ; で複数指定することができます。) +STATIC2 外部認証サーバーとして Windows NT ドメインコントローラまたは Windows Server の Active Directory コントローラを使用する場合は、VPN Server を動作させているコンピュータをそのドメインに所属させておく必要があります。NT ドメイン認証を使用する場合は、設定する項目はありません。 +IDOK &OK +IDCANCEL キャンセル + + +PREFIX D_SM_LINK +CAPTION %S 上のカスケード接続 +STATIC1 カスケード接続を使用すると、この仮想 HUB を同一または別のコンピュータ上で動作している他の仮想 HUB にレイヤ 2 カスケード接続することができます。 +STATIC2 カスケード接続における警告 +STATIC3 カスケード接続を使用すると、複数の仮想 HUB 間でのレイヤ 2 ブリッジが可能ですが、接続方法を間違えると、ループ状のカスケード接続を作成してしまう場合があります。カスケード接続機能を使用する際には、慎重にネットワークトポロジを設計してください。 +B_CREATE 新規作成(&C) +B_EDIT 編集(&E) +B_ONLINE オンライン(&N) +B_OFFLINE オフライン(&F) +IDOK 状態(&S) +B_DELETE 削除(&D) +B_RENAME 名前の変更(&A) +B_REFRESH 最新の状態に更新(&R) +IDCANCEL 閉じる(&X) + + +PREFIX D_SM_LOG +CAPTION ログ保存設定 +S_TITLE 仮想 HUB "%S" に関するセキュリティログ (ユーザーのログインなどの記録) および仮想 HUB を通過するすべてのパケットに関するパケットログを保存することができます。 +STATIC1 セキュリティログ(&S): +B_SEC セキュリティログを保存する(&E) +S_SEC ログファイルの切り替え周期(&W): +STATIC2 パケットログ(&P): +B_PACKET パケットログを保存する(&F) +S_PACKET ログファイルの切り替え周期(&X): +S_PACKET_0 TCP コネクションログ: +B_PACKET_0_0 保存無し +B_PACKET_0_1 ヘッダ情報のみ +B_PACKET_0_2 パケット内容すべて +S_PACKET_1 TCP パケットログ: +B_PACKET_1_0 保存無し +B_PACKET_1_1 ヘッダ情報のみ +B_PACKET_1_2 パケット内容すべて +S_PACKET_2 DHCP パケットログ: +B_PACKET_2_0 保存無し +B_PACKET_2_1 ヘッダ情報のみ +B_PACKET_2_2 パケット内容すべて +S_PACKET_3 UDP パケットログ: +B_PACKET_3_0 保存無し +B_PACKET_3_1 ヘッダ情報のみ +B_PACKET_3_2 パケット内容すべて +S_PACKET_4 ICMP パケットログ: +B_PACKET_4_0 保存無し +B_PACKET_4_1 ヘッダ情報のみ +B_PACKET_4_2 パケット内容すべて +S_PACKET_5 IP パケットログ: +B_PACKET_5_0 保存無し +B_PACKET_5_1 ヘッダ情報のみ +B_PACKET_5_2 パケット内容すべて +S_PACKET_6 ARP パケットログ: +B_PACKET_6_0 保存無し +B_PACKET_6_1 ヘッダ情報のみ +B_PACKET_6_2 パケット内容すべて +S_PACKET_7 Ethernet\r\nパケットログ: +B_PACKET_7_0 保存無し +B_PACKET_7_1 ヘッダ情報のみ +B_PACKET_7_2 パケット内容すべて +IDOK &OK +IDCANCEL キャンセル +STATIC3 大量のパケットログを保存しようとすると、CPU およびハードディスクに大きな負担がかかり、仮想 HUB や VPN Server 全体のパフォーマンス低下の原因になる場合があります。必要なパケットログ情報のみ保存するように設定してください。 + + +PREFIX D_SM_CA +CAPTION 信頼する証明機関の証明書の管理 +STATIC1 この仮想 HUB が信頼する証明機関の証明書一覧を管理します。\r\n\r\nここで登録された証明機関の証明書一覧は、VPN Client が署名済み証明書認証モードで接続してきた際の証明書の検証に使用されます。 +B_IMPORT 追加(&A) +IDOK 証明書の表示(&V) +IDCANCEL 閉じる(&C) +B_DELETE 削除(&D) + + +PREFIX D_SM_SESSION +CAPTION セッションの管理 - %S +S_TITLE 現在、仮想 HUB "%S" に以下のセッションが接続しています。 +STATIC1 セッションに関する操作 +IDOK セッションの情報を表示(&I) +B_DISCONNECT 切断(&D) +B_REFRESH 最新の状態に更新(&H) +B_SESSION_MAC_TABLE このセッションの MAC テーブル(&M) +B_SESSION_IP_TABLE このセッションの IP テーブル(&P) +STATIC2 その他の管理タスク +B_MAC_TABLE MAC アドレステーブル一覧(&A) +B_IP_TABLE IP アドレステーブル一覧(&B) +IDCANCEL 閉じる(&X) +S_FARM_INFO_2 現在のクラスタ上のすべてのセッションを表示していますが、別のクラスタメンバサーバー上のセッションを管理するにはそのサーバーに管理接続する必要があります。 + + +PREFIX D_SM_MAC +CAPTION MAC アドレステーブル +S_TITLE 仮想 HUB "%S" 上の MAC アドレステーブルデータベースは以下の通りです。 +B_DELETE 選択したエントリを削除(&D) +B_REFRESH 最新の状態に更新(&H) +IDCANCEL 閉じる(&X) + + +PREFIX D_SM_IP +CAPTION IP アドレステーブル +S_TITLE 仮想 HUB "%S" 上の IP アドレステーブルデータベースは以下の通りです。 +B_DELETE 選択したエントリを削除(&D) +B_REFRESH 最新の状態に更新(&H) +IDCANCEL 閉じる(&X) + + +PREFIX D_SM_CREATE_CERT +CAPTION 新しい証明書の作成 +STATIC1 このツールを使用すると、ルート証明書、または既存の証明書によって署名された証明書を簡単に作成することができます。 +STATIC2 証明書の種類(&T): +R_ROOT_CERT ルート証明書 (自己署名証明書)(&R) +R_SIGNED_CERT 他の証明書によって署名された証明書(&S) +S_LOAD_1 署名するために使用する証明書と秘密鍵(&C): +B_LOAD 証明書と秘密鍵の読み込み(&L) +S_LOAD_2 [証明書と秘密鍵の読み込み] をクリックして、新しい証明書の署名に使う X509 証明書と RSA 秘密鍵を指定してください。 +S_LOAD_3 名前 (CN): +S_LOAD_4 所属機関 (O): +S_LOAD_5 組織単位 (OU): +S_LOAD_6 国 (C): +S_LOAD_7 都道府県 (ST): +S_LOAD_8 ローカル (L): +S_LOAD_11 シリアル番号(S):\r\n(16進数) +S_LOAD_9 証明書の有効期間(&E): +S_LOAD_10 日 +STATIC3 大規模に証明書および証明機関を運用する場合は、OpenSSL などのフリーソフトや、市販の CA (証明機関) ソフトウェアを使用することを推奨します。 +IDOK &OK +IDCANCEL キャンセル +S_LOAD_12 暗号強度(&N): + + +PREFIX D_NM_LOGIN +CAPTION deleted +S_TITLE deleted +STATIC1 deleted +STATIC2 deleted +IDOK deleted +IDCANCEL deleted + + +PREFIX D_SPEEDMETER +CAPTION ネットワークデバイスの状態 +STATIC1 ネットワークアダプタの選択: +STATIC2 最新の状況(&L) +STATIC3 更新(&R) + + +PREFIX D_NM_MAIN +CAPTION deleted +STATIC1 deleted +STATIC2 deleted +B_SETTING VPN Server への接続の設定(&S) +B_CONNECT 接続(&C) +B_DISCONNECT 切断(&D) +STATIC3 User-mode Router の動作に関する設定 +STATIC4 SoftEther VPN User-mode Router の仮想ネットワーク内の動作を設定することができます。 +B_OPTION User-mode Router の動作設定(&O) +STATIC5 User-mode Router の動作状況 +STATIC6 SoftEther VPN User-mode Router の現在の動作状況を表示します。 +B_NAT 仮想 NAT の状況(&N) +B_DHCP 仮想 DHCP サーバーの状況(&H) +B_STATUS User-mode Router の状況(&R) +B_INFO User-mode Router の情報(&I) +B_PASSWORD 管理パスワードの設定(&P) +B_REFRESH 最新状態に更新(&E) +B_ABOUT バージョン情報(&A) +IDCANCEL 閉じる(&X) + + +PREFIX D_NM_OPTION +CAPTION SecureNAT の設定 +S_TITLE SecureNAT 仮想ホストが仮想 HUB "%S" の仮想ネットワーク内でどのような動作を行うかを設定してください。 +STATIC1 仮想ホストのネットワークインターフェイスの設定: +STATIC2 MAC アドレス(&M): +STATIC3 IP アドレス(&P): +STATIC4 サブネットマスク(&S): +STATIC5 仮想 NAT の設定: +R_USE_NAT 仮想 NAT 機能を使用する(&A) +STATIC6 M&TU 値: +STATIC7 バイト +STATIC8 TCP セッションのタイムアウト(&C): +STATIC9 秒 +STATIC10 UDP セッションのタイムアウト(&U): +STATIC11 秒 +R_SAVE_LOG NAT および DHCP サーバーの動作をログファイルに保存する(&L) +STATIC12 仮想 DHCP サーバーの設定: +R_USE_DHCP 仮想 DHCP サーバー機能を使用する(&N) +STATIC13 配布 IP アドレス帯(&D): +STATIC14 から +STATIC15 まで +STATIC16 サブネットマスク(&B): +STATIC17 リース期限(&E): +STATIC18 秒 +STATIC19 クライアントに割り当てるオプションの設定 (空欄でも可): +STATIC20 デフォルトゲートウェイの\r\nアドレス(&F): +STATIC21 DNS サーバーのアドレス 1 (&V): +STATIC22 ドメイン名(&W): +STATIC23 DNS サーバーのアドレス 2 (&X): +IDOK &OK +IDCANCEL キャンセル +S_1 静的ルーティングテーブルのプッシュ (スプリットトンネリング) +S_2 VPN クライアントに対して静的ルーティングテーブルをプッシュ送信することができます。 +B_PUSH プッシュする静的ルーティングテーブルの編集 + + +PREFIX D_NM_NAT +CAPTION 仮想 NAT ルータ上の NAT セッションテーブル +S_TITLE 現在、SecureNAT の仮想 NAT ルータ上に以下の TCP または UDP の NAT テーブルエントリがあります。 +B_REFRESH 最新の状態に更新(&H) +IDCANCEL 閉じる(&X) + + +PREFIX D_NM_DHCP +CAPTION 仮想 DHCP サーバー上の IP リーステーブル +S_TITLE 現在、SecureNAT の仮想 DHCP サーバーは以下の IP アドレスをクライアントに配布しています。 +B_REFRESH 最新の状態に更新(&H) +IDCANCEL 閉じる(&X) + + +PREFIX D_NM_CHANGE_PASSWORD +CAPTION %S の管理者パスワードの変更 +S_TITLE SoftEther VPN User-mode Router (%S) の管理者パスワードを変更できます。新しいパスワードを入力してから [OK] をクリックしてください。 +STATIC1 新しいパスワード(&P): +STATIC2 確認入力(&C): +IDOK &OK +IDCANCEL キャンセル + + +PREFIX D_SM_SNAT +CAPTION 仮想 NAT および仮想 DHCP 機能 (SecureNAT) の設定 +S_TITLE SecureNAT 機能を有効にすると、仮想 HUB "%S" 内の仮想ネットワーク内において NAT ルータ (IP マスカレード) や DHCP サーバー機能を仮想的に動作させることができるようになります。 +STATIC1 SecureNAT 機能に関する警告 +S_WARNING SecureNAT 機能はシステム管理者やネットワークに関して詳しい知識のある方向けの機能です。 +S_WARNING2 SecureNAT 機能を正しく使用すると、VPN を経由した安全なリモートアクセスが実現できます。しかし、誤った方法で使用すると、ネットワーク全体を危険な状態にする可能性もあります。ネットワークに関する十分な知識をお持ちでない場合や、ネットワーク管理者の許可を得ていない場合は、SecureNAT 機能を有効にしないでください。SecureNAT 機能に関する詳しい説明は、VPN Server のマニュアルやオンラインドキュメントを参照してください。 +STATIC2 SecureNAT 機能の有効 / 無効および設定の変更 +STATIC3 この仮想 HUB 内で SecureNAT 機能を有効または無効にしたり、設定を変更できます。 +B_ENABLE SecureNAT 機能を有効にする(&E) +B_DISABLE SecureNAT 機能を無効にする(&D) +B_CONFIG SecureNAT の設定(&C) +STATIC4 ※ 動作中の SecureNAT を無効にした場合、現在 SecureNAT を経由して接続中の TCP または UDP セッションはすべて切断されます。 +STATIC5 現在の SecureNAT の状況の表示 +STATIC6 現在の SecureNAT の動作状況を表示することができます。 +B_NAT 仮想 NAT ルータの状況(&N) +B_DHCP 仮想 DHCP サーバーの状況(&H) +B_STATUS SecureNAT の動作状況の表示(&S) +S_TSUKUBA2 SecureNAT は、登 大遊 が筑波大学第三学群情報学類の平成16年度授業 "情報特別演習Ⅰ" で開発した技術を使用しています。 +IDCANCEL 閉じる(&X) + + +PREFIX D_SM_BRIDGE +CAPTION ローカルブリッジ設定 +STATIC1 ローカルブリッジを使用すると、この VPN Server 上で動作する仮想 HUB と物理的な Ethernet デバイス (LAN カード) との間でレイヤ 2 ブリッジ接続を構成することができます。\r\nまた、システムに tap デバイス (仮想のネットワークインターフェイス) を作成し、仮想 HUB との間でブリッジ接続することもできます。(Linux 版のみサポート) +B_DELETE ローカルブリッジの削除(&D) +STATIC2 新しいローカルブリッジの定義(&N): +STATIC3 ブリッジする仮想 HUB を選択するか、名前を入力してください。 +STATIC4 仮想 HUB(&H): +STATIC5 作成する種類(&Y): +R_BRIDGE 物理的な既存の LAN カードとのブリッジ接続(&P) +R_TAP 新しい tap デバイスとのブリッジ接続(&T) +S_ETH_1 LAN カード(&L): +S_TAP_1 新しい tap デバイス名(&V): +S_TAP_2 (11 文字以内) +STATIC6 ※ 稼働中の任意の LAN カードとの間でブリッジできますが、高負荷環境においてはブリッジ専用に LAN カードを用意することをお勧めします。 +IDOK ローカルブリッジを追加(&A) +STATIC7 最近システムに追加された LAN カードが表示されない場合は、コンピュータを再起動して再度この画面を開ければ表示されます。 +IDCANCEL 閉じる(&X) +B_VLAN タグ VLAN パケット透過設定ツール(&G) + + +PREFIX D_WIN9X_REBOOT +CAPTION VPN Client - 仮想 LAN カードのインストール +STATIC1 VPN Client の仮想 LAN カードのインストールを行いました。\r\n直ちに Windows を終了し、コンピュータを再起動する必要があります。\r\n\r\nコンピュータは自動的に再起動されます。自動的に再起動しない場合は、手動で再起動を行ってください。 + + +PREFIX D_EM_MAIN +CAPTION SoftEther EtherLogger Manager +STATIC1 SoftEther EtherLogger は、コンピュータに接続されている LAN カードを流れるデータをキャプチャし、管理者が指定した種類のパケットのヘッダまたはすべてのデータをテキストファイルにログとして記録するサービスです。\r\n\r\n現在、以下のキャプチャデバイスでパケットロギングを実行しています。 +B_PASSWORD 管理パスワード(&P) +B_LICENSE ライセンス(&L) +B_ADD 追加(&A) +IDOK 編集(&E) +B_DELETE 削除(&D) +IDCANCEL 閉じる(&X) + + +PREFIX D_EM_ADD +STATIC1 キャプチャに使用する LAN カード名(&L): +R_PROMISCUOUS キャプチャの際にプロミスキャスモードを使用しない(&N) +STATIC2 パケットログ(&P): +S_PACKET ログファイルの切り替え周期(&W): +S_PACKET_0 TCP コネクションログ: +B_PACKET_0_0 保存無し +B_PACKET_0_1 ヘッダ情報のみ +B_PACKET_0_2 パケット内容すべて +S_PACKET_1 TCP パケットログ: +B_PACKET_1_0 保存無し +B_PACKET_1_1 ヘッダ情報のみ +B_PACKET_1_2 パケット内容すべて +S_PACKET_2 DHCP パケットログ: +B_PACKET_2_0 保存無し +B_PACKET_2_1 ヘッダ情報のみ +B_PACKET_2_2 パケット内容すべて +S_PACKET_3 UDP パケットログ: +B_PACKET_3_0 保存無し +B_PACKET_3_1 ヘッダ情報のみ +B_PACKET_3_2 パケット内容すべて +S_PACKET_4 ICMP パケットログ: +B_PACKET_4_0 保存無し +B_PACKET_4_1 ヘッダ情報のみ +B_PACKET_4_2 パケット内容すべて +S_PACKET_5 IP パケットログ: +B_PACKET_5_0 保存無し +B_PACKET_5_1 ヘッダ情報のみ +B_PACKET_5_2 パケット内容すべて +S_PACKET_6 ARP パケットログ: +B_PACKET_6_0 保存無し +B_PACKET_6_1 ヘッダ情報のみ +B_PACKET_6_2 パケット内容すべて +S_PACKET_7 Ethernet\r\nパケットログ: +B_PACKET_7_0 保存無し +B_PACKET_7_1 ヘッダ情報のみ +B_PACKET_7_2 パケット内容すべて +IDOK &OK +IDCANCEL キャンセル +STATIC3 大量のパケットログを保存しようとすると、CPU およびハードディスクに大きな負担がかかり、システム全体のパフォーマンス低下の原因になる場合があります。必要なパケットログ情報のみ保存するように設定してください。 + + +PREFIX D_EM_PASSWORD +CAPTION 管理者パスワードの変更 +S_TITLE 管理者パスワードを変更できます。新しいパスワードを入力してから [OK] をクリックしてください。 +STATIC1 新しいパスワード(&P): +STATIC2 確認入力(&C): +IDOK &OK +IDCANCEL キャンセル + + +PREFIX D_EM_LICENSE +CAPTION ライセンスの追加と削除 +STATIC1 SoftEther EtherLogger を使用するには、有効なライセンスを取得し、ライセンスキーを登録する必要があります。この画面では、新しいライセンスキーを登録したり、登録済みのライセンスキーを削除したり、現在のライセンス一覧や SoftEther EtherLogger のライセンスモードを表示したりすることができます。 +S_BOLD 現在登録されているライセンスの一覧(&L): +B_OBTAIN ライセンスの入手・更新(&O) +STATIC2 [ライセンスの入手・更新] をクリックすると、ライセンスの入手・更新方法に関する説明が記載された Web サイトを表示します。 +B_ADD 新しいライセンスキーの登録(&A) +B_DEL 削除(&D) +IDOK ライセンスに関する情報(&I) +STATIC3 ライセンスを選択し、[ライセンスに関する情報] をクリックすると、ソフトイーサ株式会社の Web サイト (softether.com) に接続し、そのライセンスに関する登録情報を表示します。 +S_BOLD2 現在の SoftEther EtherLogger のライセンスモード(&M): +IDCANCEL 閉じる(&X) + + +PREFIX D_EM_LICENSE_ADD +CAPTION 新しいライセンスキーの登録 +S_INFO SoftEther EtherLogger の製品ライセンスのライセンスキーを登録することができます。 +STATIC1 ライセンスキーは、36 桁の英数字およびハイフン ( '-' ) で構成されている、ライセンスの所有を証明するキーコードです。\r\n\r\nライセンスキーは、本ソフトウェアと共にライセンス証書を受け取った場合はライセンス証書に印刷されています。本ソフトウェアのライセンスをオンラインで購入した場合は、購入時の Web サイトの画面やメールなどにライセンスキーが記載されていることがあります。その他の方法でライセンスキーが記載されている場合もあります。不明な場合は、ライセンスの購入元にお問い合わせください。 +STATIC2 ライセンスキーを正確に入力してください(&I): +STATIC3 ライセンスキーは 6 桁ごとに区切って入力してください。ハイフンは入力する必要はありません。コピー && ペーストで入力することも可能です。 +B_INFO2 本ソフトウェアの著作権は全世界で保護されています。お客様は、ライセンス契約書の条件に従った場合のみ、本ソフトウェアを複製・使用することが可能です。不正に入手したライセンスキーの使用、複数台のサーバーでの同一ライセンスキーの使用、ライセンスキーの無断頒布などはライセンス契約書に違反し、民事または刑事上の罰を受ける可能性がありますので、ご注意ください。 +IDOK 登録(&R) +IDCANCEL キャンセル + +PREFIX D_EM_REMOTE +STATIC1 接続するコンピュータのホスト名または IP アドレスを指定してください(&S): +R_LOCAL ローカルコンピュータ (この画面を表示しているコンピュータ) に接続(&L) +S_HOSTNAME コンピュータ名(&C): +IDOK &OK +IDCANCEL キャンセル +B_ABOUT バージョン情報 + +PREFIX D_SM_CONFIG +CAPTION Config ファイルの編集 +IDC_INFO VPN Server "%S" の現在のコンフィグレーションファイルは下記のとおりです。\r\nこのコンフィグレーションファイルの内容を編集して、VPN Server に書き込むこともできます。 +B_EXPORT ファイルに保存(&S) +B_IMPORT ファイルからインポートして書き込み(&I) +IDCANCEL 閉じる(&C) +STATIC1 コンフィグレーションファイルは通常のテキストエディタ等で編集可能です。編集したコンフィグレーションファイルを VPN Server に書き込んだ場合、VPN Server は自動的に再起動し、新しいコンフィグレーションファイルに従って起動します。不正なコンフィグレーションファイルを書き込んだ場合はエラーが発生したり現在の設定内容が失われたりする可能性がありますので、十分注意してください。 +B_FACTORY 設定をリセットして初期化(&R) + + +PREFIX D_SM_ADMIN_OPTION +CAPTION 仮想 HUB 管理オプション +S_INFO 現在、仮想 HUB "%S" には以下の管理オプションが設定されています。 +B_ADD 値の追加(&A) +B_EDIT 値の編集(&E) +B_DELETE 値の削除(&D) +STATIC1 仮想 HUB 管理オプションは、VPN Server の管理者が各仮想 HUB の管理者に仮想 HUB の管理を委任している場合に、設定範囲を制限するために使用します。 +IDOK 保存(&S) +IDCANCEL キャンセル +STATIC2 仮想 HUB の管理オプションを編集することができるのは、この VPN Server 全体の管理権限を持った管理者のみです。仮想 HUB の管理者は、管理オプションを表示できますが、変更することはできません。\r\nただし、allow_hub_admin_change_option が 1 に設定されている場合は、仮想 HUB の管理者でも管理オプションを編集することができます。 +S_BOLD 説明: + + +PREFIX D_SM_MSG +CAPTION メッセージの設定 +S_MSG_2 仮想 HUB "%S" に VPN Client が接続した際に、ユーザーの画面にメッセージを表示できます。メッセージを表示する場合は、以下に表示したいメッセージの内容を入力してください。 +C_USEMSG メッセージを表示する(&M) +STATIC1 メッセージの表示機能について +S_INFO 接続元のユーザーが使用している VPN Client のバージョンが 3.0 以降である必要があります。\r\n\r\nメッセージに「http://」で始まる URL を 1 行だけ記載すると、メッセージを表示する代わりにその URL をデフォルトの Web ブラウザを起動して表示することができます。 +IDOK &OK +IDCANCEL キャンセル + + +PREFIX D_NICINFO +CAPTION 仮想 LAN カード "%S" の状態 +IDCANCEL 閉じる(&C) + + +PREFIX D_SM_VLAN +CAPTION タグ VLAN パケット透過設定ツール +STATIC1 LAN カードの種類によっては、デフォルトでタグ VLAN パケット (IEEE802.1Q) を透過できない場合があります。\r\n\r\n仮想 HUB と LAN カードをローカルブリッジ接続する場合で、物理的なネットワークからタグ VLAN パケットを仮想 HUB に入力したり、仮想 HUB からタグ VLAN パケットを物理的なネットワークに出力したりしたい場合は、LAN カードに VLAN パケットを透過するための設定を行う必要があります。 +B_ENABLE 選択した LAN カードをタグ VLAN が透過可能に設定する(&C) +B_DISABLE 設定を解除する(&U) +STATIC2 タグ VLAN パケット透過設定ツールについて +S_WARNING このツールを用いると、Intel、Broadcom および Marvell 製の正規ドライバを用いている一部の Windows 用 LAN カードのタグ VLAN の透過設定を行ったり、設定を解除したりすることができます。 +S_WARNING2 上記のリストに表示されている LAN カードは、このツールによって設定を変更することがサポートされています。リストに表示されていない LAN カードはこのツールによって設定をすることができません。リストにない LAN カードでも、タグ VLAN がデフォルトで透過可能か、または何らかの設定を行うことにより透過可能になることがあります。\r\n\r\nその場合は、システム管理者が自ら Windows にログインし、そのような設定を行う必要があります。 +IDCANCEL 閉じる(&X) + + +PREFIX D_SM_SIMULATION +CAPTION 遅延・パケットロス生成機能 +STATIC1 このアクセスリストの条件に一致するパケットが仮想 HUB を通過する場合に、そのパケットに遅延・ジッタおよびパケットロスを発生させることができます。\r\n\r\nこの機能により、低速で品質の低いインターネット回線や WAN 回線、ワイヤレス回線などを利用した場合の動作を、LAN 内の机上で実験することができます。たとえば、IP 電話 (VoIP) 等の動作試験に便利です。 +STATIC2 発生させる遅延・ジッタ・パケットロスの内容: +C_DELAY 遅延を発生させる(&D) +S_DELAY 発生させる遅延の量 (0 - 10000) : +S_DELAY2 ミリ秒 (msecs) +C_JITTER 遅延にジッタ (揺らぎ) を発生させる(&J) +S_JITTER 発生させる遅延の揺らぎ (0 - 100) : +S_JITTER2 パーセント (%) +C_LOSS パケットロスを発生させる(&L) +S_LOSS 発生させるパケットロス率 (0 - 100) : +S_LOSS2 パーセント (%) +IDOK &OK +IDCANCEL キャンセル + + +PREFIX D_SM_AO_VALUE +CAPTION 名前と値 +STATIC1 名前(&N): +STATIC2 値(&V): +STATIC3 (整数値) +IDOK &OK +IDCANCEL キャンセル + + +PREFIX D_SM_L3 +CAPTION 仮想レイヤ 3 スイッチ設定 +STATIC1 この VPN Server 内で動作している複数の仮想 HUB 間で仮想のレイヤ 3 スイッチを定義し、異なった IP ネットワーク間をルーティングすることができます。 +STATIC2 仮想レイヤ 3 スイッチ機能は、ネットワークおよび IP ルーティングに関する詳しい知識をお持ちの方やネットワーク管理者のための機能です。通常の VPN 機能を使用する場合は、仮想レイヤ 3 スイッチ機能を使用する必要はありません。\r\n\r\n仮想レイヤ 3 スイッチ機能を使用する場合は、IP ルーティングに関する十分な知識をお持ちの上で、ネットワークに与える影響を十分考慮してから設定してください。 +STATIC3 仮想レイヤ 3 スイッチ機能に関するご注意 +S_BOLD 定義されている仮想レイヤ 3 スイッチの一覧(&L): +B_ADD 新規作成(&N) +B_START 動作開始(&S) +B_STOP 動作停止(&T) +IDOK 編集(&E) +B_DELETE 削除(&D) +IDCANCEL 閉じる(&C) + + +PREFIX D_SM_L3_ADD +CAPTION 新規仮想レイヤ 3 スイッチの作成 +STATIC1 新しい仮想レイヤ 3 スイッチを作成します。名前を入力してください。\r\n\r\n仮想レイヤ 3 スイッチの名前は、既にこの VPN Server に存在する他の仮想レイヤ 3 スイッチと重複することはできません。 +STATIC2 名前(&N): +IDOK &OK +IDCANCEL キャンセル + + +PREFIX D_SM_L3_SW +CAPTION 仮想レイヤ 3 スイッチ "%S" の編集 +STATIC1 1 つの仮想レイヤ 3 スイッチには、複数個の仮想インターフェイスとルーティングテーブルを定義することができます。 +STATIC2 仮想インターフェイスは仮想 HUB に関連付けられ、仮想 HUB が動作しているときに仮想 HUB 内で 1 台の IP ホストのように動作します。複数の仮想 HUB に対してそれぞれ別々の IP ネットワークに所属する仮想インターフェイスが定義されているとき、それらのインターフェイス間で IP ルーティングが自動的に行われます。\r\n\r\nまた、ルーティングテーブルを手動で設定して、より細かい経路設定を行うことも可能です。 +S_BOLD1 仮想インターフェイス一覧(&I): +B_ADD_IF 仮想インターフェイスの追加(&A) +B_DEL_IF 仮想インターフェイスの削除(&E) +S_BOLD2 ルーティングテーブル(&R): +B_ADD_TABLE ルーティングテーブルエントリの追加(&D) +B_DEL_TABLE ルーティングテーブルエントリの削除(&L) +B_START 動作開始(&S) +B_STOP 動作停止(&T) +IDCANCEL 閉じる(&C) + + +PREFIX D_SM_L3_SW_IF +CAPTION 仮想インターフェイスの追加 +STATIC1 新しい仮想インターフェイスを仮想レイヤ 3 スイッチに追加します。\r\n\r\n仮想インターフェイスが所属する IP ネットワーク空間とインターフェイス自身の IP アドレスを定義する必要があります。\r\nまた、インターフェイスが接続する先の仮想 HUB 名を選択するか入力してください。\r\n仮想 HUB 名は現在存在していない仮想 HUB を指定することもできます。 +STATIC2 接続先仮想 HUB (&A) +STATIC3 このインターフェイスが接続する仮想 HUB を選択するか、名前を入力してください。 +STATIC4 仮想 HUB (&H): +STATIC5 仮想インターフェイスの持つ IP アドレスと所属するサブネット空間(&D) +STATIC6 仮想インターフェイスは、仮想 HUB 内で 1 つの IP アドレスを持つ必要があります。また、その IP アドレスの属する IP ネットワークのサブネットマスクを指定する必要もあります。\r\n\r\n複数の仮想 HUB 内の IP 空間同士の仮想レイヤ 3 スイッチを経由したルーティングは、ここで指定した IP アドレスに基づいて動作します。 +S_SRC_IP_1 &IP アドレス: +S_SRC_IP_2 サブネットマスク(&S): +IDOK &OK +IDCANCEL キャンセル + + +PREFIX D_SM_L3_SW_TABLE +CAPTION ルーティングテーブルエントリの追加 +STATIC1 仮想レイヤ 3 スイッチのルーティングテーブルに新しいルーティングテーブルエントリを追加します。\r\n\r\n仮想レイヤ 3 スイッチの IP ルーティングエンジンは、IP パケットの宛先 IP アドレスが各仮想インターフェイスの所属する IP ネットワークのいずれにも所属しない場合、ルーティングテーブルを参照してルーティングを行います。 +STATIC2 ルーティングテーブルエントリの内容(&E): +STATIC3 仮想インターフェイスは、仮想 HUB 内で 1 つの IP アドレスを持つ必要があります。また、その IP アドレスの属する IP ネットワークのサブネットマスクを指定する必要もあります。\r\n\r\n複数の仮想 HUB 内の IP 空間同士の仮想レイヤ 3 スイッチを経由したルーティングは、ここで指定した IP アドレスに基づいて動作します。 +S_SRC_IP_1 ネットワークアドレス(&N): +S_SRC_IP_2 サブネットマスク(&S): +S_SRC_IP_3 ゲートウェイアドレス(&G): +S_SRC_IP_4 メトリック値(&M): +STATIC4 ※ ネットワークアドレスに 0.0.0.0 を、サブネットマスクに 0.0.0.0 を指定すると、デフォルトルートの意味になります。 +IDOK &OK +IDCANCEL キャンセル + + +PREFIX D_CM_SELECT_SECURE +CAPTION スマートカードの選択 +STATIC1 使用するスマートカードの種類を選択してください。\r\n\r\nスマートカードの種類の一覧には、現在コンピュータにドライバがインストールされていて、かつ VPN ソフトウェアでサポートされているデバイスの一覧が表示されます。\r\n現在使用しているスマートカードの種類が表示されない場合は、VPN ソフトウェアをより新しいバージョンにアップデートすることにより使用できるようになる場合もあります。\r\n\r\n※ 導入直後のドライバが表示されない場合は、Windows を再起動してみてください。 +IDOK &OK +IDCANCEL キャンセル + + +PREFIX D_CM_SECURE_MANAGER +CAPTION スマートカードマネージャ +S_INFO 現在選択されているスマートカード:\r\n\r\n%S +B_BOLD スマートカードに格納されているオブジェクト一覧: +B_REFRESH オブジェクトリスト更新(&R) +B_IMPORT カードへ書き込み(&I)... +B_EXPORT カードから読み込み(&E)... +B_DELETE カードから削除(&D) +B_NEW_CERT 新しい証明書と秘密鍵を作成してカードに書き込む(&N)... +B_PIN PIN コードの変更(&C)... +IDCANCEL 閉じる + + +PREFIX D_CM_SECURE_TYPE +CAPTION オブジェクトの種類の選択 +STATIC インポートしたいオブジェクトの種類を選択してください。 +R_CERT 証明書(&C) +R_KEY 秘密鍵(&K) +R_DATA 任意のデータ(&D) +IDOK &OK +IDCANCEL キャンセル + + +PREFIX D_STRING +CAPTION VPN ソフトウェア +IDOK &OK +IDCANCEL キャンセル + + +PREFIX D_SM_SELECT_KEYPAIR +CAPTION スマートカード内の証明書の指定 +S_INFO 現在選択されているスマートカード:\r\n\r\n%S +B_BOLD1 スマートカード内の証明書を選択してください: +IDOK &OK +IDCANCEL キャンセル +B_BOLD2 対応した秘密鍵を選択してください: + + +PREFIX D_CM_LOAD_X +CAPTION 証明書の読み込み +STATIC1 どちらの方法で証明書を読み込みますか? +R_FROM_FILE ファイルから証明書を読み込む(&F) +R_FROM_SECURE スマートカードから証明書を読み込む(&R) +S_FILE 証明書データが保存されているファイル (拡張子が .cer, .crt, .p12, .pfx のいずれか) から証明書を読み込むことができます。 +S_CERT このコンピュータにスマートカードが接続されている場合は、スマートカード内の証明書を読み込むことができます。 +B_SELECT 使用するスマートカードの選択(&S)... +IDOK &OK +IDCANCEL キャンセル + + +PREFIX D_CM_SECURE_PIN +CAPTION PIN コードの変更 +STATIC1 スマートカードの PIN コード (暗証番号) を変更することができます。\r\n\r\nPIN コードを変更するには、現在の PIN コードと、新しい PIN コードを 2 回入力してください。設定した PIN コードは忘れないようにしてください。 +STATIC2 現在の PIN コード(&C): +STATIC3 新しい PIN コード(&N): +STATIC4 確認入力(&E): +STATIC5 ご注意 +STATIC6 現在の PIN コードを一定回数間違えると、スマートカードが使用できなくなる場合があります。 +STATIC7 スマートカードを挿入して [OK] をクリックしてください。 +IDOK &OK +IDCANCEL キャンセル + + +PREFIX D_SM_CRL +CAPTION 無効な証明書の一覧 +STATIC1 この仮想 HUB 内で無効な証明書の一覧を管理します。\r\n\r\n無効な証明書の一覧に証明書を登録すると、その証明書を提示したクライアントは、この仮想 HUB に証明書認証モードで接続できなくなります。 +B_ADD 追加(&A) +IDOK 編集(&E) +IDCANCEL 閉じる(&C) +B_DELETE 削除(&D) + + +PREFIX D_SM_EDIT_CRL +CAPTION 無効な証明書 +STATIC1 無効な証明書の一覧に登録する内容を設定します。\r\n\r\n仮想 HUB にユーザーが証明書認証モードで接続してきたとき、その証明書が無効な証明書の一覧に登録されている 1 つ以上の内容に一致する場合に、そのユーザーの接続を拒否します。 +S_BOLD 下記の定義された項目すべての内容に一致する証明書を無効とします。 +STATIC2 証明書の内容 +R_CN 名前 (CN): +R_O 所属機関 (O): +R_OU 組織単位 (OU): +R_C 国 (C): +R_ST 都道府県 (ST): +R_L ローカル (L): +STATIC3 証明書の属性値: +R_SERI シリアル番号 (16進数): +R_MD5_HASH MD5 ダイジェスト値 (16進数, 128 bit): +R_SHA1_HASH SHA-1 ダイジェスト値 (16進数, 160 bit): +STATIC4 ダイジェスト値 (ハッシュ値) の指定は、証明書を事実上一意に指定することになります。通常、MD5 または SHA-1 のダイジェスト値を入力する場合は、その他の項目を入力する必要はありません。 +STATIC5 既存の証明書ファイルからの指定 +STATIC6 無効にしたい証明書のファイルがある場合は、そのファイルを指定することにより証明書を正確に指定して無効リストに追加することができます。[証明書の読み込み] をクリックして指定した証明書ファイルの内容が自動的に入力されます。 +B_LOAD 証明書の読み込み(&L)... +IDOK &OK +IDCANCEL キャンセル + + +PREFIX D_SM_AC_LIST +CAPTION 接続元 IP 制限リスト +S_TITLE クライアントコンピュータの IP アドレスによって、この VPN Server の仮想 HUB "%S" への VPN 接続を許可または拒否することができます。下記に接続を許可または拒否するルールを設定できます。 +B_ADD ルールの追加(&A) +IDOK ルールの編集(&E) +B_DELETE ルールの削除(&D) +B_SAVE 保存(&S) +IDCANCEL キャンセル(&C) +STATIC1 優先順位はリストの上のものほど高くなります。 +STATIC2 クライアントの IP アドレスがリスト内のどの項目にも一致しなかった場合は、この仮想 HUB への VPN 接続を許可されます。 + + +PREFIX D_SM_AC +CAPTION 接続元 IP 制限リストのルール項目の編集 +STATIC1 IP アクセス制限リストのルール項目を設定してください。ここで設定した項目は、VPN Client が仮想 HUB に接続しようとした際にそのクライアントからの接続を許可するか拒否するかを決定するために使用されます。 +STATIC2 ルール項目の内容 +STATIC3 クライアントの IP アドレスが以下のときにルールを適用する: +R_SINGLE 単一の IP アドレス(&S) +R_MASKED 複数の IP アドレス (IP ネットワークアドレスとネットマスクで指定) (&M) : +STATIC4 アドレス(&A): +S_MASK ネットマスク(&K): +STATIC5 動作 +R_PASS 接続を許可する(&P) +R_DENY 接続を拒否する(&D) +STATIC6 その他 +STATIC7 優先順位(&R): +STATIC8 (整数値: 小さいほど優先順位が高くなります) +STATIC9 IP プロトコル バージョン: +IDOK &OK +IDCANCEL キャンセル + + +PREFIX D_SM_LOG_FILE +CAPTION ログファイル一覧 +STATIC1 サーバー上に保存されているログファイルを指定してダウンロードすることができます。\r\n\r\nVPN Server 全体の管理者は、すべての仮想 HUB のログおよびサーバー ログをダウンロードすることができます。仮想 HUB の管理者は、その仮想 HUB のログファイルのみダウンロードできます。 +IDOK ダウンロード(&D) +B_REFRESH 最新の状態に更新(&R) +IDCANCEL 閉じる + + +PREFIX D_SM_READ_LOG_FILE +CAPTION ファイルのダウンロード +S_INFO2 ファイル "%S" を VPN Server からダウンロードしています。\r\nしばらくお待ちください... +IDCANCEL ダウンロードの中止(&S) + + +PREFIX D_SM_SAVE_LOG +CAPTION ログファイルのダウンロード完了 +S_INFO ファイル "%S" のダウンロードが完了しました。\r\n\r\nこのファイルを開くか、保存することができます。 +IDOK 開く(&O) +B_SAVE 保存(&S) +IDCANCEL キャンセル + + +PREFIX D_TCP +CAPTION TCP/IP 最適化ユーティリティ +STATIC1 Windows のインターネットプロトコル (TCP/IP) の設定を最適化することにより、このコンピュータのネットワークの通信速度を高速化することができる場合があります。\r\n\r\nこの TCP/IP 最適化ユーティリティを使用すると、通信速度の最適化の設定を簡単に行うことができます。 +STATIC2 下記に表示されているのは、現在の Windows が保持している TCP/IP の設定値です。これらの値を変更することにより、TCP/IP の設定を最適化することができます。また、このユーティリティを後から起動することで、いつでも値を再設定したり元に戻したりすることができます。 +STATIC3 TCP/IP 通信設定: +STATIC4 TCP 受信ウインドウサイズ(&R): +R_RECV_DISABLE OS のデフォルト値を使用する(&D) +R_RECV_ENABLE 下記の値に設定する(&E) +S_RECV バイト +B_RECV 推奨値を使用(&C) +STATIC5 TCP 送信ウインドウサイズ(&S): +R_SEND_DISABLE OS のデフォルト値を使用する(&I) +R_SEND_ENABLE 下記の値に設定する(&N) +S_SEND バイト +B_SEND 推奨値を使用(&M) +IDOK &OK +IDCANCEL キャンセル +STATIC6 TCP/IP の設定を変更した場合は、Windows を再起動した際に設定が有効になります。設定変更後、すぐにコンピュータを再起動する必要はありませんが、再起動するまでは TCP/IP の最適化設定は有効になりません。 +B_DELETE TCP 通信設定最適化ユーティリティによる管理を行わない + + +PREFIX D_TCP_MSG +CAPTION TCP/IP 通信設定の最適化 +STATIC1 Windows の TCP/IP 通信設定を最適化すると、TCP/IP を使用した通信速度が大幅に向上する場合があります。通信設定を最適化しますか?\r\n\r\n後から TCP/IP 最適化ユーティリティを起動して、いつでも通信設定を最適化したり、元に戻したりすることができます。 +STATIC2 TCP/IP の設定を変更した場合は、Windows を再起動した際に設定が有効になります。設定変更後、すぐにコンピュータを再起動する必要はありませんが、再起動するまでは TCP/IP の最適化設定は有効になりません。 +R_OPTIMIZE 通信設定を自動的に最適化する(&A) +R_MANUAL TCP/IP 最適化ユーティリティを使用して手動で最適化する(&M) +R_NO 最適化は行わない(&D) +IDOK 次へ(&N) > +IDOK3 < 戻る(&B) + + +PREFIX D_CM_PKCSEULA +CAPTION ソフトウェアとスマートカードの使用条件に関する確認 +S_INFO_1 ソフトウェア "%S" を使用して指定したスマートカードにアクセスしようとしています。 +S_INFO_2 ソフトウェア "%S" を使用する場合は、そのソフトウェアや使用するスマートカードの使用条件がある場合は、それに同意した上で使用する必要がある場合があります。\r\n\r\n詳しくは、ソフトウェア "%S" やスマートカードの提供元にお問い合わせください。 +S_INFO_3 上記に同意し、ソフトウェア "%S" を使用して指定したスマートカードへのアクセスを行いますか? +IDOK はい(&Y) +IDCANCEL いいえ(&N) + + +PREFIX D_CM_TRAFFIC +CAPTION 通信スループット測定ツール +STATIC1 通信スループット測定ツールを使用すると、IP ネットワークに接続されている 2 台のコンピュータ間で最大限に通信を行い、実際の通信データ量と通信時間からその間のネットワークの最大帯域幅 (スループット) を測定することができます。このツールは、VPN の仮想ネットワーク内でも、VPN と関係無い物理的なネットワークでも使用することができます。 +STATIC2 このツールを使用して、現在のネットワークの通信能力を測定することができます。ただし、測定結果は測定する両方のコンピュータの CPU 能力や他に動作しているアプリケーションの状態、ネットワークの使用率などによって変化するため、実際のネットワークの処理能力よりも低い値がでる場合もあります。 +S_1 動作設定 +S_3 このコンピュータは測定サーバーまたは測定クライアントのどちらですか? +R_SERVER 測定サーバー(&S) +R_CLIENT 測定クライアント(&C) +S_4 測定サーバーの場合は、待ち受けるポート番号を指定します。\r\n測定クライアントの場合は、接続先の測定サーバーのホスト名または IP アドレスとポート番号を指定し、必要な場合は必要なオプションを設定します。 +S_5 接続先の測定サーバー名(&H): +S_6 ポート番号(&P): +S_7 (TCP ポート) +S_8 下記のオプションはクライアント側で設定します。 +S_9 データ通信の方向 +R_DOWNLOAD 測定サーバーから測定クライアントに伝送 (ダウンロード) (&D) +R_UPLOAD 測定クライアントから測定サーバーに伝送 (アップロード) (&U) +R_FULL 双方向に伝送 (ダウンロードとアップロードを同時に実行) (&F) +S_10 通信の詳細設定 +S_11 並列接続してデータ伝送に使用する TCP コネクション数(&N): +S_12 データ伝送時間 (計測時間) (&A): +S_13 秒間 +R_ETHERNET Ethernet と仮定してレイヤ 2 でのスループットを算出(&E) +R_DOUBLE 中継機器能力測定モード(&B) +S_14 コネクション +IDOK 実行(&R) +IDCANCEL キャンセル +S_15 通信スループット測定ツールは vpncmd コマンドライン管理ユーティリティから実行することもできます (Windows 以外の OS でも使用可能です)。 + + +PREFIX D_CM_TRAFFIC_RUN +CAPTION 通信トラフィック測定ツール +S_INFO 現在、通信トラフィック測定ツールを実行しています。下記に動作状況が表示されます。 +STATIC1 通信トラフィック測定ツールを終了してこの画面を閉じるには、[終了] をクリックしてください。 +IDCANCEL 終了(&X) + + +PREFIX D_CM_TRAFFIC_RESULT +CAPTION 通信トラフィック測定結果 +STATIC1 通信トラフィックの測定が完了しました。結果は次のとおりです。 +IDCANCEL 閉じる(&C) + + +PREFIX D_SM_LICENSE +CAPTION ライセンスの追加と削除 +STATIC1 SoftEther VPN Server を使用するには、有効なライセンスを取得し、ライセンスキーを登録する必要があります。この画面では、新しいライセンスキーを登録したり、登録済みのライセンスキーを削除したり、現在のライセンス一覧や VPN Server のライセンスモードを表示したりすることができます。 +S_BOLD 現在登録されているライセンスの一覧(&L): +B_OBTAIN ライセンスの入手・更新(&O) +STATIC2 [ライセンスの入手・更新] をクリックすると、ライセンスの入手・更新方法に関する説明が記載された Web サイトを表示します。 +B_ADD 新しいライセンスキーの登録(&A) +B_DEL 削除(&D) +IDOK ライセンスに関する情報(&I) +STATIC3 ライセンスを選択し、[ライセンスに関する情報] をクリックすると、ソフトイーサ株式会社の Web サイト (softether.com) に接続し、そのライセンスに関する登録情報を表示します。 +S_BOLD2 現在の SoftEther VPN Server のライセンスモード(&M): +IDCANCEL 閉じる(&X) + + +PREFIX D_SM_LICENSE_ADD +CAPTION 新しいライセンスキーの登録 +S_INFO SoftEther VPN Server の製品ライセンスまたは接続ライセンスのライセンスキーを登録することができます。 +STATIC1 ライセンスキーは、36 桁の英数字およびハイフン ( '-' ) で構成されている、ライセンスの所有を証明するキーコードです。\r\n\r\nライセンスキーは、本ソフトウェアと共にライセンス証書を受け取った場合はライセンス証書に印刷されています。本ソフトウェアのライセンスをオンラインで購入した場合は、購入時の Web サイトの画面やメールなどにライセンスキーが記載されていることがあります。その他の方法でライセンスキーが記載されている場合もあります。不明な場合は、ライセンスの購入元にお問い合わせください。 +STATIC2 ライセンスキーを正確に入力してください(&I): +STATIC3 ライセンスキーは 6 桁ごとに区切って入力してください。ハイフンは入力する必要はありません。コピー && ペーストで入力することも可能です。 +B_INFO2 本ソフトウェアの著作権は全世界で保護されています。お客様は、ライセンス契約書の条件に従った場合のみ、本ソフトウェアを複製・使用することが可能です。不正に入手したライセンスキーの使用、複数台のサーバーでの同一ライセンスキーの使用、ライセンスキーの無断頒布などはライセンス契約書に違反し、民事または刑事上の罰を受ける可能性がありますので、ご注意ください。 +IDOK 登録(&R) +IDCANCEL キャンセル + + +PREFIX D_FREEINFO +CAPTION SoftEther VPN Server Free Edition について +S_INFO_1 SoftEther VPN Server Free Edition をご利用いただきありがとうございます。 +S_INFO_2 接続先のサーバー "%S" で稼動している SoftEther VPN Server は個人利用を目的とした Free Edition です。\r\nFree Edition では SoftEther VPN Server のすべての機能が使用できますが、下記の利用方法は使用権許諾契約によって禁止されています。 +S_INFO_3 ・ VPN Server を経由して、業務のための通信が行われるような使用方法。 +S_INFO_4 上記の禁止されている使用方法で使用した場合は、SoftEther VPN Server 使用権許諾契約違反となりますのでご注意ください。SoftEther VPN Server の通常製品版のライセンスを入手していただくことにより、上記のような制限は無くなります。 通常製品版については、www.softether.com をご覧ください。\r\n\r\nもし、このサーバーを上記のような使用方法で使用されている場合は、www.softether.com までご連絡いただきますようお願いいたします。\r\n\r\n※ この画面は、Free Edition の VPN Server に接続した際に表示されます。Free Edition 以外のエディション製品では表示されません。\r\n※ Free Edition のソフトウェアは、製品版と比較してこのお知らせ画面が表示される以外の違いは全くありません。 +B_HIDE 次回からこのお知らせを表示しない(&H) +IDCANCEL &OK + + +PREFIX D_CM_SETTING +CAPTION SoftEther VPN Client 動作モード変更 +STATIC1 SoftEther VPN Client は「通常モード」または「簡易モード」で使用することができます。使用するモードを切り替えるには、下記のチェックボックスを選択してください。 +R_NORMAL 通常モード(&N) +R_EASY 簡易モード(&E) +STATIC2 [通常モード] は SoftEther VPN Client ソフトウェアのすべての操作を行うことができる動作モードです。一般的なユーザーやシステム管理者にお勧めします。 +STATIC3 [簡易モード] は VPN Server への接続などの最もよく使用する操作しかできない動作モードです。VPN について詳しい知識をお持ちでないユーザーにお勧めします。 +STATIC4 [設定ロック機能] を使用すると、SoftEther VPN Client に登録されている接続設定を使って VPN Server に接続することはできますが、接続設定の内容を変更したり、新しく接続設定を作成したり、削除したりすることができなくなります。 +R_LOCK 設定ロック機能を使う(&L) +S_PASSWORD1 パスワードを指定することができます。パスワードを指定すると、後から設定ロック機能を無効にする際にパスワードの入力が必要になります。 +S_PASSWORD2 パスワード(&P): +S_PASSWORD3 確認入力(&C): +IDOK &OK +IDCANCEL キャンセル +S_VGS2 VPN Gate 学術実験サービスの設定を行うことができます。 +B_VGS VPN &Gate サービスの設定... + + +PREFIX D_CM_EASY +CAPTION SoftEther VPN クライアント簡易接続マネージャ (Developer Edition) +B_MODE 動作モードの変更(&M) +IDCANCEL 閉じる(&C) +B_STATUS 接続状況の表示(&S) +B_VGC VPN Gate 学術実験 + + +PREFIX D_SM_SETUP +CAPTION SoftEther VPN Server / Bridge 簡易セットアップ (Developer Edition) +S_TITLE SoftEther VPN Server / Bridge 簡易セットアップ (Developer Edition) +IDC_STATIC_1 このセットアッププログラムを使用すると、SoftEther VPN Server または VPN Bridge を以下の用途や目的のために簡単にセットアップすることができます。セットアップ終了後は、VPN サーバー管理マネージャを用いて、より詳細な設定を自由に行うことができます。 +S_BOLD 構築しようとしている VPN サーバーの種類を選択してください。複数の用途のための VPN サーバーを構築しようとしている場合は、複数の種類を選択することができます。 +C_REMOTE リモートアクセス VPN サーバー(&R) +S_REMOTE_1 リモートアクセス VPN は、たとえば社内 LAN などの既存の Ethernet セグメントに対して、インターネットなどを経由して遠隔地の VPN クライアントコンピュータが VPN 接続することができる形態の VPN 構成です。\r\nVPN Server に接続した VPN クライアントコンピュータは、社内の Ethernet に対して直接 LAN ケーブルで接続しているのと同等の状態でネットワークにアクセスできるようになります。 +C_SITE 拠点間接続 VPN サーバーまたはブリッジ(&S) +S_SITE_1 拠点間接続 VPN は、既存の 2 箇所以上の拠点の Ethernet セグメント同士を VPN 接続する形態の VPN 構成です。\r\nVPN 接続されたそれぞれの拠点同士はレイヤ 2 レベルで同一のセグメントとなりますので、各拠点内のコンピュータ同士が同一ネットワーク内にあるものとして通信することができるようになります。 +S_SITE_2 この VPN Server の役割を選択してください: +C_CENTER 拠点間接続 VPN の中心となり、他拠点からの接続を受け入れる VPN Server (&M) +C_EDGE 各拠点に設置する VPN Server または VPN Bridge (&E) +C_OTHER 高度な機能を用いた VPN (&O) +S_OTHER クラスタリング機能や仮想レイヤ 3 スイッチ機能などの高度な機能を提供する VPN システムを構築する場合。 +IDOK 次へ(&N) +IDCANCEL 閉じる(&C) + + +PREFIX D_SM_SETUP_HUB +CAPTION 簡易セットアップ - 仮想 HUB 名の決定 +IDC_STATIC_1 VPN Server 上に仮想 HUB を 1 個作成する必要があります。仮想 HUB の名前は自由に指定することができます。 +IDC_STATIC_2 仮想 HUB 名(&N): +IDOK &OK +IDCANCEL キャンセル + + +PREFIX D_SM_SETUP_STEP +CAPTION 簡易セットアップの実行 +IDC_STATIC_1 この VPN Server / VPN Bridge のセットアップを完了するには、下記のタスクのうち必要なものを実行してください。 +S_1_1 1. VPN 接続を受け入れるためのユーザーの作成 +S_1_2 この VPN Server がリモートアクセス VPN を受け入れる場合、または拠点間接続 VPN において中心となり他拠点からの接続を受け入れる場合は、VPN 接続を受け入れるためにユーザーを作成しておく必要があります。 +B_USER ユーザーを作成する(&U) +S_2_1 2. 接続先の VPN Server への接続設定 +S_2_2 拠点間接続 VPN における各拠点に設置する VPN Server または VPN Bridge の場合は、各 VPN 拠点からの接続を受け付ける、中心となる VPN Server のアドレスなどを入力して、その VPN Server への接続を確立する必要があります。 +B_CASCADE 接続先の VPN Server への接続設定を行う(&O) +S_3_1 3. ローカルブリッジの設定 +S_3_2 VPN 経由で LAN にアクセスするためには、VPN 側の仮想的な Ethernet セグメントと物理的な Ethernet セグメントとの間を「ローカルブリッジ接続」機能でブリッジ接続する必要があります。\r\n\r\nVPN に対してブリッジ接続する既存の Ethernet デバイス (LAN カード) を選択してください。 +IDCANCEL 閉じる(&C) +IDC_STATIC_8 必要な設定がすべて完了したら、[閉じる] をクリックしてください。VPN Server / VPN Bridge の詳細な管理画面が表示されます。その後は必要な場合に詳細な設定を行ってください。 +B_SECURENAT SecureN&AT 機能の設定を行う + + +PREFIX D_CPU64_WARNING +CAPTION SoftEther VPN の 64 bit 版に関する情報 +S_BOLD インストールされた SoftEther VPN ソフトウェアは 32 bit 版ですが、現在実行されている Windows オペレーティングシステムは 64 bit 版です。 +S_INFO 64 bit 版 Windows 上で 32 bit 版の SoftEther VPN ソフトウェアを実行することは可能ですが、Windows が搭載している 32 bit エミュレータ上で動作することになるため、パフォーマンスが低下する場合があります。\r\nまた、一部の機能がサポートされない可能性があります。\r\n\r\n64 bit 版 Windows 上では SoftEther VPN ソフトウェアの 64 bit 版をインストールして使用されることを強く推奨します。\r\nSoftEther VPN ソフトウェアの 64 bit 版は http://selinks.org/ よりダウンロードすることができます。\r\n\r\nこのダイアログボックスは、30 秒後に自動的に閉じます。 +IDOK &OK + + +PREFIX D_ONCEMSG +CAPTION TITLE +C_DONTSHOWAGAIN 今後はこのメッセージを表示しない(&D) +IDCANCEL &OK + + +PREFIX D_CONNECT +IDCANCEL キャンセル + + +PREFIX D_SM_IPSEC +CAPTION IPsec / L2TP / EtherIP / L2TPv3 設定 +S_TITLE IPsec / L2TP / EtherIP / L2TPv3 サーバー機能の設定 +S_3 この VPN Server 上の仮想 HUB は、L2TP に対応した PC や Mac OS X、スマートフォン等からリモートアクセス VPN 接続を受け付けたり、EtherIP / L2TPv3 に対応した市販のルータ等から拠点間 VPN 接続を受け付けたりできます。 +S01 L2TP サーバー機能 (リモートアクセス VPN サーバー接続) +S02 iPhone、iPad、Android 等のスマートフォンや Mac OS X、Windows 等の OS 付属の標準 VPN クライアントから VPN 接続ができるようになります。 +R_L2TP_OVER_IPSEC L2TP サーバー機能を有効にする (L2TP over IP&sec) +S03 iPhone、iPad、Android、Windows、Mac OS X からの VPN 接続を受け付けることができます。 +R_L2TP_RAW L2TP サーバー機能を有効にする (暗号化されていない &L2TP) +S04 IPsec を用いない L2TP を使用する特殊なクライアントをサポートできます。 +S_1 接続時のユーザー名で仮想 HUB 名が省略された場合に接続する仮想 HUB の選択(&H): +S_2 L2TP、OpenVPN および MS-SSTP VPN 接続時のユーザー名は "仮想HUB名\\ユーザー名" または "ユーザー名@仮想HUB名" のように指定してください。なお、仮想 HUB 名の指定が省略された場合、デフォルトで接続する仮想 HUB を設定しておくことができます。 +S05 EtherIP / L2TPv3 サーバー機能 (拠点間接続 VPN サーバー機能) +S06 EtherIP / L2TPv3 over IPsec に対応した市販のルータ製品は、この VPN Server の仮想 HUB にレイヤ 2 (Ethernet) でブリッジ接続できます。 +R_ETHERIP &EtherIP / L2TPv3 over IPsec サーバー機能有効 +B_DETAIL サーバー機能の詳細設定(&D) +S07 IPsec 共通設定(&C) +S_PSK IPsec 事前共有鍵(&P): +S_PSK2 IPsec 事前共有鍵は、「PSK (Pre-Shared Key)」または「シークレット」と呼ばれることがあります。8 文字程度で設定し、VPN を利用するすべてのユーザーに配布してください。 +IDOK &OK +IDCANCEL キャンセル + + +PREFIX D_SM_ETHERIP +CAPTION EtherIP / L2TPv3 サーバー機能の詳細設定 +S_TITLE EtherIP / L2TPv3 サーバー機能 +S01 VPN Server に EtherIP / L2TPv3 over IPsec に対応した市販のルータ機器からレイヤ 2 Ethernet ブリッジ接続を行うことができます。\r\nCisco 社のルータや NEC 製の IX ルータ、IIJ 製の SEIL ルータ等がお勧めです。 +S02 EtherIP / L2TPv3 による接続を受け付けるには、予め、クライアント側となる EtherIP / L2TPv3 対応ルータがこの VPN Server に接続する際の IPsec Phase 1 ID 文字列と、接続先の仮想 HUB の情報の対応表を定義しておく必要があります。 +S_BOLD IPsec Phase 1 ID と接続先仮想 HUB との対応表(&T): +B_ADD 追加(&A) +IDOK 編集(&E) +B_DELETE 削除(&D) +IDCANCEL 閉じる(&X) + + +PREFIX D_SM_ETHERIP_ID +CAPTION EtherIP / L2TPv3 over IPsec クライアント定義 +S01 EtherIP / L2TPv3 over IPsec クライアントがこの VPN Server に接続しようとした際の ISAKMP (IKE) Phase 1 のイニシエータ ID 文字列が以下に一致する場合に、次の仮想 HUB への接続設定を適用します。 +S02 ISAKMP Phase 1 &ID: +S03 接続先の仮想 &HUB: +S04 ユーザー名(&U): +S05 パスワード(&P): +S06 ユーザー名とパスワードは、仮想 HUB に登録されている必要があります。EtherIP / L2TPv3 クライアントは、上記で入力された情報で識別されるユーザーの権限で仮想 HUB に接続したものとみなされます。 +IDOK &OK +IDCANCEL キャンセル +S07 (ID はクライアント側のルータの接続設定で設定するものと同一の文字列を指定してください。文字列のほか、ID の種類が IP アドレスの場合は IP アドレスも指定できます。)\r\n\r\nなお、'*' (アスタリスク) を指定するとワイルドカード指定となり、他の明示的なルールに一致しないすべての接続元クライアントが対象となります。 + + +PREFIX D_SM_OPENVPN +CAPTION OpenVPN / MS-SSTP 設定 +S_TITLE OpenVPN / MS-SSTP VPN サーバー機能設定 +S_1 OpenVPN 社の OpenVPN ソフトウェア製品と同等の VPN サーバー機能を搭載しています。\r\n\r\nOpenVPN クライアントからこの VPN Server に接続できます。 +R_OPENVPN &OpenVPN サーバー機能を有効にする +S_TOOL OpenVPN クライアント用サンプル設定ファイル自動作成ツール +S_TOOL2 本来、OpenVPN クライアントを使うためには設定ファイルを手動で記述する必要があり、これは難易度が高い作業です。しかし、以下のボタンをクリックするだけでこの VPN Server に接続することができる基本的な OpenVPN クライアント用の設定ファイルを自動的に生成することができます。 +B_CONFIG OpenVPN クライアント用のサンプル設定ファイルを生成(&C) +S_2 Microsoft SSTP VPN 互換サーバー機能 +S_3 Microsoft 社の Windows Server 2008 / 2012 製品に搭載されている MS-SSTP VPN サーバー機能と互換性がある機能を搭載しています。\r\n\r\nWindows Vista / 7 / 8 / RT / 10 に標準搭載の MS-SSTP クライアントからこの VPN Server に接続できます。 +R_SSTP &MS-SSTP VPN サーバー機能を有効にする +S_SSTP VPN Server の SSL 証明書の CN の値がクライアント側で指定するホスト名と一致し、かつその証明書が信頼されている必要があります。詳しくは Microsoft 社のドキュメントを参照してください。 +S_4 これらの互換サーバー機能で仮想 HUB に接続する場合のユーザー名の指定方法、およびデフォルト仮想 HUB の選択規則は、IPsec サーバー機能と同様です。 +B_IPSEC I&Psec サーバー機能の設定 +S_13 OpenVPN 互換サーバー機能 +IDOK &OK +IDCANCEL キャンセル + + +PREFIX D_SM_DDNS +CAPTION ダイナミック DNS 機能 +S_TITLE ダイナミック DNS 機能 +S_BOLD このバージョンの VPN Server にはダイナミック DNS 機能が搭載されています。 +S_1 ダイナミック DNS により、この VPN Server コンピュータに永続的な固有の DNS ホスト名が割当てられます。これにより独自でドメインを所有していなくても、VPN Client や VPN Bridge などの設定画面上で VPN Server の IP アドレスの代わりに DNS ホスト名によって VPN Server を指定することができます。 +S_22 また、IP アドレスが変化する可能性がある一般的な ISP を用いて VPN Server をインターネットに接続する場合でも、IP アドレスが変化すれば自動的に DNS ホストに対応する IP アドレスが更新されますので、可変 IP アドレスでも VPN Server を運用することができるようになります。\r\nこれにより、高価な月額料金が必要な固定グローバル IP アドレスのサービスを契約する必要がなくなります。 +S_3 さらに、このバージョンの VPN Server は NAT トラバーサル機能をサポートしており、VPN Server が NAT の内側にありプライベート IP アドレスしか持っていない場合でも、NAT 上で特別な設定をすることなく、インターネット側からの VPN 接続を受付けることができます。 +S_4 現在の状態(&S): +S_STATUS3 割当てられているダイナミック DNS ホスト名(&H): +B_HINT ヒント +S_STATUS4 グローバル IPv&4 アドレス: +S_STATUS5 グローバル IPv&6 アドレス: +S_5 設定の変更(&M): +S_STATUS6 ダイナミック DNS ホスト名の変更(&C): +S_STATUS7 3 文字以上 31 文字以内の半角英数字およびハイフン '-' が使用できます。\r\n変更は何度でも可能です。 +IDOK 上記の DNS ホスト名に変更する(&A) +B_RESTORE 変更前に戻す(&R) +S_2 IPv6 インターネットに接続されていない場合は上記の [IPv6 アドレス] の欄にエラーが表示されますが、異常ではありません。一部の国・地域では、行政機関による制限により、ダイナミック DNS サービスが利用できない場合があります。 +IDCANCEL 閉じる(&X) +B_DISABLE ダイナミック DNS 機能を無効にする(&D) +B_PROXY プロキシサーバー経由で接続(&P) +S_STATUS8 DNS 鍵: +B_HINT2 ヒント + + +PREFIX D_SM_SPECIALLISTENER +CAPTION VPN over ICMP / DNS 機能の設定 +S_TITLE VPN over ICMP / DNS 機能 +S_1 VPN over ICMP / DNS 機能 +S_2 ファイアウォールやルータ等の故障や過負荷、設定ミス等により TCP/IP 通信が遮断されている環境のネットワークからでも、ICMP (Ping) または DNS パケットの通信が可能であれば、この VPN Server との間で VPN 通信を行うことができます。そのためには、予め以下の機能を有効にしておく必要があります。 +R_OVER_ICMP VPN over &ICMP サーバー機能を有効にする +R_OVER_DNS VPN over &DNS サーバー機能を有効にする (UDP ポート 53 を使用します) +IDOK &OK +IDCANCEL キャンセル +S_3 接続元の VPN Client または VPN Bridge は内部バージョン 4.0 以降が必要です。 +S_4 警告: これは、ファイウォールやルータ等が一時的に不調となっており ICMP または DNS のみ安定した通信が可能な環境で VPN 通信を確立するための機能です。緊急時などには有益ですが、長期間の利用には適さない場合があります。 + + +PREFIX D_SM_REDIRECT +CAPTION HTTP URL リダイレクション設定 +S_1 仮想 HUB を経由する TCP コネクションがこのアクセスリストの条件に一致した場合、その TCP コネクションを用いてクライアントが何らかの通信を行おうとすると、強制的に以下に設定された URL 文字列をクライアントに対して応答します。\r\n\r\nこれにより、VPN クライアント上で起動している Web ブラウザが特定の IP アドレスにアクセスした場合などに任意の Web ページをその Web ブラウザ上に表示させることができます。 +S_2 リダイレクト先 URL の入力: +S_BOLD2 リダイレクト先 &URL: +S_3 入力例: +S_4 単純な URL リダイレクション: +S_5 高度な URL リダイレクション: +B_HINT 高度な URL リダイレクション機能の使い方(&U)... +S_6 ご注意 +S_BOLD この機能は TCP/IP に詳しいネットワーク管理者向けの機能です。以下の注意事項をよく読み、慎重に設定してください。 +S_7 アクセスリストの条件に宛先セッションのユーザー名またはグループ名が指定されている場合で当該アクセスリストがパケットに一致した場合はこの機能は無視されます。 +S_8 TCP 以外のパケットがアクセスリストに一致した場合はこの機能は無視されます。 +S_9 すべての TCP パケットに対して HTTP リダイレクト応答を返します (ポート 80 に限定されません)。たとえばポート 80 に限定するためには、アクセスリストの条件で宛先ポートを TCP 80 に限定してください。 +S_10 リダイレクト先の URL に対してクライアントがアクセスしようとした結果が再度このアクセスリストに一致した場合は、当該アクセス要求に対して再度リダイレクション応答が返信されます。この場合は無限のリダイレクションの繰り返しが発生する可能性があります。 +IDOK &OK +IDCANCEL キャンセル +S_11 高度なリダイレクション機能は、リダイレクト先 CGI に VPN セッション情報を提供できます。 + + +PREFIX D_SW_WELCOME +CAPTION D_SW_WELCOME +S_WELCOME SoftEther VPN は筑波大学で開発された、Windows や Mac などのコンピュータおよび iPhone, iPad, Android, Windows RT などのスマートフォンやタブレット、Cisco などのサードパーティ製 VPN ルータ、OpenVPN や MS-SSTP などの既存の VPN プロトコルとも互換性がある安全で高性能なオープンソース VPN ソフトウェアです。 +S_TITLE すべての主要なデバイスに対応するオープンソース VPN ソフトウェア + + +PREFIX D_SW_MODE +CAPTION D_SW_MODE +R_SYSTEM システムモード (推奨) (&S) +R_USER ユーザーモード (&U) +S_1 このコンピュータに通常の方法で VPN ソフトウェアをインストールします。このコンピュータの管理者権限が必要です。 +S_USER 一般ユーザー権限で VPN ソフトウェアをインストールします。管理者権限は不要ですが、ローカルブリッジなどの一部の機能が利用できません。ユーザー "%s" が Windows にログオンしている間だけ使用できます。 +S_2 SoftEther VPN は 2 種類のセットアップモードでインストールできます。\r\n\r\n通常は「システムモード」を選択してください。\r\n\r\n何らかの理由で管理者権限を取得することができない場合は、「ユーザーモード」を選択すれば一般ユーザー権限でインストールすることもできます。 + + +PREFIX D_SW_NOT_ADMIN +CAPTION D_SW_NOT_ADMIN +S_INFO 現在 Windows にログオンしているユーザー "%s" には管理者権限 (Administrators 権限) がありません。\r\n\r\nセットアップを続行するには、一度 Windows からログオフし、このコンピュータの管理者権限を持つユーザーでログオンしてから再度セットアップ ウィザードを起動してください。 +S_INFO6 「完了」をクリックすると、セットアップ ウィザードを終了します。 +S_INFO2 管理者権限が無い場合でも、ユーザーモードでインストールすることができます。\r\nユーザーモードでソフトウェアをインストールするには、「戻る」をクリックしてください。 + + +PREFIX D_SW_COMPONENTS +CAPTION D_SW_COMPONENTS + + +PREFIX D_SW_EULA +CAPTION D_SW_EULA +S_1 使用許諾契約書を注意してお読みください。 +B_AGREE 使用許諾契約書に同意します(&A) + + +PREFIX D_SW_WARNING +CAPTION D_SW_WARNING +S_1 SoftEther VPN ソフトウェアは非常に強力な通信機能を有しているため、ご利用にあたっては下記の重要事項説明書をよくお読みください。 + + +PREFIX D_SW_DIR +CAPTION D_SW_DIR +S_INFO 「%s」 のインストール先ディレクトリを指定してください。 +R_CUSTOM インストール先を変更(&S) +S_DEST インストール先(&D): +B_BROWSE 参照(&B)... +R_SHOWCUSTOM 上級者のためのインストールオプション(&A) +R_FOR_SYSTEM このコンピュータの Windows にインストール(&Y) +R_FOR_USER ユーザー "%s" の環境にのみインストール(&U) +S_WARNING ご注意: 推奨されません。ユーザー "%s" が Windows からログオフすると、%s の動作は停止します。また、ローカルブリッジ機能や L2TP/IPsec 機能 (Mac やスマートフォンからの接続) などは動作しません。 + + +PREFIX D_SW_READY +CAPTION D_SW_READY +S_INFO 「%s」 のインストールの準備が完了しました。 +S_INFO7 「次へ」をクリックするとインストール処理を開始します。 + + + +PREFIX D_SW_PERFORM +CAPTION D_SW_PERFORM +S_INFO %s のセットアップが進行中です。\r\n完了までしばらくお待ちください... +S_INFO8 SoftEther VPN は日本国経済産業省のソフトウェア研究開発プロジェクトの成果物です。IPA (独立行政法人 情報処理推進機構) の未踏ソフトウェア創造事業に採択され開発されました。詳しくは http://www.ipa.go.jp/ をご覧ください。 + +PREFIX D_SW_ERROR +CAPTION D_SW_ERROR +S_INFO エラーが発生したため、%s のセットアップを完了できませんでした。\r\n\r\n再試行するには、もう一度セットアップ ウィザードを起動してください。 + + +PREFIX D_SW_FINISH +CAPTION D_SW_FINISH +S_INFO %s のセットアップ処理が正常に完了しました。 +S_INFO8 SoftEther VPN は日本国経済産業省のソフトウェア研究開発プロジェクトの成果物です。IPA (独立行政法人 情報処理推進機構) の未踏ソフトウェア創造事業に採択され開発されました。詳しくは http://www.ipa.go.jp/ をご覧ください。 + +PREFIX D_SW_UNINST1 +CAPTION D_SW_UNINST1 +S_WELCOME このセットアップウィザードを使用すると、%s をコンピュータからアンインストールすることができます。\r\n\r\nアンインストールを開始するには、「次へ」をクリックしてください。 +S_TITLE %s のアンインストール + + + +PREFIX D_SW_EASY1 +CAPTION D_SW_EASY1 +S_WELCOME 企業内の多くの数のユーザーのコンピュータに VPN Client をインストールする際に、1 台ずつ VPN 接続設定を実施するのは大変です。 +S_TITLE SoftEther VPN Client 簡易インストーラとは +S_WELCOME2 「簡易インストーラ作成ウィザード」は、企業のシステム管理者向けのツールです。「簡易インストーラ作成ウィザード」を使用すれば、あらかじめ指定した接続設定ファイルを埋め込んだ VPN Client のインストーラを作成できます。もちろん、個人のユーザーも使用できます。 +S_WELCOME3 作成したインストーラは、社内のファイルサーバーやメールなどを用いて社員に配布できます。インストーラを実行すると VPN Client がインストールされ、自動的に接続設定がインポートされてその接続設定を用いた VPN 接続が開始されます。 + + +PREFIX D_SW_EASY2 +CAPTION D_SW_EASY2 +S_BOLD1 埋め込みたい接続設定ファイル (.vpn ファイル) を指定してください +S_1 簡易インストーラに埋め込みたい接続設定ファイル (拡張子が .vpn のファイル) を指定してください。接続設定ファイルは、VPN クライアント接続マネージャ内の接続設定を右クリックして「接続設定のエクスポート」をクリックしてエクスポートできます。 +S_18 接続設定(&S): +B_BROWSE_SETTING 参照(&B)... +B_DELETE_SENSITIVE 接続設定ファイル内にユーザー名とパスワードを格納しない(&E) +S_BOLD2 生成される EXE ファイルの保存先ファイル名を指定してください +S_3 このウィザードは、簡易インストーラとして EXE ファイル (実行可能ファイル) を生成します。生成されるファイルを保存するためのファイル名を指定してください。 +S_19 ファイル名(&A): +B_BROWSE_OUT 参照(&R)... +B_EASYMODE VPN クライアント接続マネージャを簡易モードに設定する(&E) + + +PREFIX D_SW_WEB1 +CAPTION D_SW_WEB1 +S_WELCOME SoftEther VPN Client Web インストーラを作成すると、Web ブラウザを開き特定のページにアクセスすることにより、SoftEther VPN Client を自動的にインストールすることができます。この際に、予め設定しておいた接続設定ファイルをインポートして VPN 接続を開始させることもできます。 +S_TITLE SoftEther VPN Client Web インストーラとは +S_WELCOME2 作成した Web インストーラは、社内向けの Web サーバーなどに HTML ファイルとして設置できます。設置された HTML ファイルの URL に社員がアクセスすると、SoftEther VPN Client のインストーラが起動します。 +S_WELCOME3 ActiveX コントロールを使用しています。クライアントブラウザは Internet Explorer 5.0 以降、オペレーティングシステムは Windows 2000 以降がサポートされています。IE 以外のブラウザや Windows 98 などの古い OS はサポートされません。 + + +PREFIX D_SW_WEB2 +CAPTION D_SW_WEB2 +S_BOLD1 埋め込みたい接続設定ファイル (.vpn ファイル) を指定してください +S_1 Web インストーラに埋め込みたい接続設定ファイル (拡張子が .vpn のファイル) を指定してください。接続設定ファイルは、VPN クライアント接続マネージャ内の接続設定を右クリックして「接続設定のエクスポート」をクリックしてエクスポートできます。 +S_18 接続設定(&S): +B_BROWSE_SETTING 参照(&B)... +B_DELETE_SENSITIVE 接続設定ファイル内にユーザー名とパスワードを格納しない(&E) +S_BOLD2 生成される Web サーバー設置用ファイルの保存先ファイル名を指定してください +S_3 このウィザードは、Web サーバーに設置するための HTML ファイルや CAB ファイルが格納された ZIP ファイル (アーカイブファイル) を生成します。生成されるファイルを保存するためのファイル名を指定してください。 +S_19 ファイル名(&A): +B_BROWSE_OUT 参照(&R)... +B_EASYMODE VPN クライアント接続マネージャを簡易モードに設定する(&E) + + +PREFIX D_UPDATE_NOTICE +CAPTION %s のアップデート +IDOK 更新 Web サイトを表示(&S)... +B_CONFIG アップデート通知設定(&C)... +IDCANCEL 今後このメッセージを表示しない(&I) +S_INFO %s の最新バージョンがリリースされています。今すぐダウンロードしてアップデートできます。 +S_PRODUCT ソフトウェア: +S_CURRENT 現在使用中のバージョン: +S_CURRENT_STR Ver %u.%02u.%04u%s +S_LATEST 最新バージョン: +S_LATEST_STR Ver %S%s + + +PREFIX D_UPDATE_CONFIG +CAPTION アップデート通知の設定 +S_INFO %s の新しいバージョンがリリースされていないかどうか定期的にチェックし、リリースされていた場合は通知画面を表示します。\r\n\r\nアップデートチェックのために日本の茨城県つくば市に設置されている SoftEther Update サーバーとの間で HTTPS 通信を行います。お客様の個人情報が送信されることはありません。 +S_TITLE %s のアップデートチェックと通知の設定 +S_ENABLE アップデートチェックを有効にする(&E) +S_DISABLE アップデートチェックを無効にする(&D) +IDCANCEL 閉じる(&C) + + +PREFIX D_SM_VMBRIDGE +CAPTION VM 内でローカルブリッジを使用する場合の注意事項 +S_TITLE VM 内でのローカルブリッジ機能の使用 +S_1 VPN Server が VMware や Hyper-V などの VM (仮想マシン) 内で動作している可能性が検出されました。以下の注意事項をよくお読みください。VM を使用していない場合は、このメッセージは無視してください。 +S_2 VM では、デフォルト設定で LAN カードの「プロミスキャスモード」(MAC アドレス スプーフィング) での通信が禁止されている場合があります。\r\n\r\nVM 内で動作する VPN Server の仮想 HUB とホストマシンに装着されている物理的な LAN カードとの間でローカルブリッジを行う場合、プロミスキャスモード (MAC アドレス スプーフィング) が禁止されていると正常に通信ができません。このような場合は、VM の設定ツールを用いてプロミスキャスモード (MAC アドレス スプーフィング) を有効にしてください。\r\n\r\n詳しくは、VM のドキュメントを参照してください。他の管理者によって管理されている共有 VM の場合は、管理者にプロミスキャスモード (MAC アドレス スプーフィング) を許可するよう要請してください。 +S_BOLD 注意事項 +IDCANCEL &OK + + +PREFIX D_SM_AZURE +CAPTION VPN Azure サービスの設定 +S_TITLE VPN Azure クラウド型 VPN サービス (無料) +S_1 VPN Azure により、会社のパソコンに自宅や外出先のパソコンから非常に簡単に VPN 接続できるようになります。VPN 接続中は会社のパソコンを経由して、社内 LAN の他のサーバーにもアクセスできます。 +S_2 会社のパソコン (VPN Server) にはグローバル IP アドレスは不要です。ファイアウォールや NAT の内側であっても動作し、ネットワーク管理者による設定は一切必要ありません。VPN クライアントとなる自宅のパソコンでは、Windows に標準付属の SSTP VPN クライアントを使用できます。 +S_3 VPN Azure は、SoftEther VPN Server をお使いの方はどなたでも無料で利用できるクラウド VPN サービスです。ソフトイーサ株式会社によって運営されています。使い方を表示するには、右のボタンをクリックしてください。 +B_BOLD VPN Azure 設定 +R_ENABLE VPN Azure を有効にする(&E) +R_DISABLE VPN Azure を無効にする(&D) +S_HOSTNAME_BORDER 現在の VPN Azure ホスト名 +S_HOSTNAME_INFO VPN Azure ホスト名はダイナミック DNS サービスのホスト名のドメイン部分を "vpnazure.net" に変更したものが使用されます。 +B_CHANGE ホスト名の変更(&H) +B_WEB VPN Azure の使い方\r\n(Web サイトを表示) +IDCANCEL &OK + + +PREFIX D_SM_PROXY +CAPTION プロキシサーバー経由の接続 +STATIC9 プロキシサーバーを経由してサーバーに接続することができます。 +STATIC10 プロキシの種類(&Y): +R_DIRECT_TCP 直接 TCP/IP 接続 (プロキシを使わない) (&D) +R_HTTPS HTTP プロキシサーバー経由接続(&T) +R_SOCKS SOCKS4 プロキシサーバー経由接続(&K) +R_SOCKS5 SOCKS5 プロキシサーバー経由接続(&K) +B_PROXY_CONFIG プロキシサーバーの接続設定(&R) +IDOK &OK +IDCANCEL キャンセル + + +PREFIX D_VGC_LIST +CAPTION VPN Gate 学術実験プロジェクト プラグイン for SoftEther VPN Client +S_TITLE VPN Gate 公開 VPN 中継サーバー一覧 +S_INFO1 世界中のボランティアによって無償提供されている VPN サーバーに VPN 接続すると、その VPN サーバーを経由してインターネットに自由にアクセスできます。ローカルのファイアウォールの制約を回避したり、自分の IP アドレスを秘匿したりできます。 +IDOK 選択した VPN サーバーに接続(&C) +B_PROXY プロキシ設定(&P) +S_VLAN 仮想 LAN カード: +B_WEB VPN Gate 学術実験\r\nWeb サイト +B_REFRESH リストを更新(&R) +S_REFRESH リストを更新中... +S_RESEARCH 筑波大学における学術研究プロジェクト +S_INFO9 回線速度 (Mbps) が高速で Ping の値が小さな VPN サーバーほど快適です。また、海外に設置されている VPN サーバーを経由すれば、普段あなたの国から閲覧できない Web サイトやコンテンツが見えるようになるかも知れません。 + + +PREFIX D_VGC_PROTOCOL +CAPTION 接続に使用する VPN プロトコルの選択 +S_TITLE 公開 VPN 中継サーバー "%S" (%S) は TCP と UDP の両方の VPN プロトコルをサポートしています。 +S_INFO VPN サーバー "%S" (%S) への接続に使用する VPN プロトコルを選択してください。一般的に TCP のほうがファイアウォールを通過しやすいですが、TCP で正常に使用できなかった場合は代わりに UDP をお試しください。 +R_TCP &TCP を使用 (Ethernet over HTTPS VPN) (推奨) +R_UDP &UDP を使用 (Ethernet over UDP VPN) +IDOK &OK +IDCANCEL キャンセル + + +PREFIX D_VGS_CONFIG +CAPTION VPN Gate サービス コントロールパネル +R_ENABLE VPN Gate 中継サービスを有効にし、ボランティアとして実験に参加する(&E) +S_TITLE VPN Gate 学術実験に参加しますか? +S_INFO1 VPN Gate は筑波大学大学院における学術的な研究として実施されている、分散型公開 VPN 中継サーバーの運用に関する実験です。VPN Gate クライアントのユーザーは、公開 VPN 中継サーバーコンピュータ上で動作する VPN Gate サービスに接続することにより、その VPN サービスを経由してインターネットにアクセスできます。 +S_INFO9 VPN Gate クライアントのユーザーがインターネット上のサーバーにアクセスする際は、アクセス元の IP アドレスが公開 VPN 中継サーバーのコンピュータの IP アドレスに変化します。これにより、VPN Gate クライアントのユーザーはたとえばローカルのファイアウォールが故障しているためアクセスできない海外の Web サイトにスムーズにアクセスできるようになります。 +S_WARNING チェックボックスをチェックして [OK] をクリックすると、このコンピュータ上で VPN Gate 中継サービスが動作します。これにより、任意の VPN Gate クライアントが当該 VPN Gate 中継サービスを経由してインターネットに向かって通信することができるようになります。VPN Gate 中継サービスが動作している場合でも、このコンピュータが接続されている社内 LAN などのプライベート IP アドレスに対する VPN 通信は VPN Gate 中継サービスを経由しないため安全です。 +B_OPTION VPN Gate サービスのオプション設定(&O)... +IDOK &OK +IDCANCEL キャンセル +B_WEB http://www.vpngate.net/ を開く(&B)... + + +PREFIX D_VGS_OPTION +CAPTION VPN Gate サービスのオプション設定 +S_TITLE VPN Gate サービスのオプション設定 +S_1 VPN Gate サービスをこのコンピュータで動作させる場合、このコンピュータは公開 VPN サーバーになります。サーバーの運営者情報を入力してください。入力された運営者情報は、www.vpngate.net 上のサーバー一覧表などに公開され、誰でも閲覧できます。また、VPN Gate 実験に関する連絡先として使用いたします。 +S_2 運営者情報: +S_3 この VPN Gate サービスの運営者(&O): +S_19 (64 文字以内) +S_20 不正利用があったときの通報先\r\n(メールアドレス等) (&A): +S_21 (64 文字以内) +S_22 利用者へのメッセージ(&M):\r\n(128 文字以内) +S_23 利用者へのメッセージは、VPN Gate サーバー一覧表の内で表示されます。楽しいメッセージを入力すると、心理的に良好な気持ちになります。 +S_24 VPN 通信設定: +R_LOG VPN 通信のパケットログを保存する(&S) (推奨) +R_2WEEKS 2 週間以上経過したパケットログは自動削除またはエンコード後アーカイブする(&T) (推奨) +R_PERMANENT パケットログはディスク容量が許す限り恒久的に保存する(&P) +R_L2TP &L2TP/IPsec VPN サーバー機能を有効にする (推奨) +S_25 Mac OS X、iPhone / iPad、Android などからの VPN 接続を可能にします。 +B_MESSAGE VPN Client が VPN 接続してきた際にクライアント PC の画面上にメッセージを表示する(&S)... +IDOK &OK +IDCANCEL キャンセル + + +PREFIX D_VGS_WARNING +CAPTION VPN Gate 学術実験への参加前のご注意 +S1 VPN Gate 学術実験サービスは、日本国に所在する筑波大学大学院における研究プロジェクトとして運営されているサービスです。本サービスは日本国の法令にのみ準拠して運用されており、日本国以外の国・地域の法令については一切関知しておりません。 +S2 そもそも世界には 200 カ国近くの国が存在しており、それぞれの国における法律は互いに異なります。すべての国の法律を調査した上でそれらすべてに適合することを保証したソフトウェアを開発することは事実上不可能です。万一ユーザーが本サービスを特定の国・地域の領域内で利用したことによって公務員により法的なペナルティを科せられるなどの損害が発生した場合であっても、プロジェクト実施者は一切責任を負いません。 +S3 本ソフトウェアまたはサービスを使用する際には、ユーザーが適用されるすべての法令をユーザーの責任により遵守してください。本ソフトウェアまたはサービスを日本国内・国外を問わず使用された場合に発生するすべての損害と責任は、ユーザーに帰責します。本学術実験の運営者およびソフトウェアの供給者は、一切責任を負いません。 +S4 これらの注意事項に同意いただけない場合は、VPN Gate 学術実験サービスに関連する機能を使用しないでください。 +S5 VPN Gate は筑波大学大学院における学術目的の研究プロジェクトです。VPN Gate ソフトウェアはフリーウェアである SoftEther VPN およびオープンソースである UT-VPN を拡張するプラグインの形で開発されていますが、これは本研究プロジェクトにおいて開発されたものであり、ソフトイーサ株式会社によって開発されたものではありません。本研究はソフトイーサ株式会社が主宰、推進または保証するものではありません。 +R_NEVER 今後このメッセージを表示しない(&S) +B_WEB VPN Gate 学術実験 &Web サイト... +IDOK 同意する(&A) +IDCANCEL 同意しない(&D) +S_BOLD VPN 通信が禁止されている国・地域では VPN Gate を使用しないでください。 + + +PREFIX D_NM_PUSH +CAPTION プッシュする静的ルーティングテーブルの編集 +S1 VPN クライアントに対してこの仮想 DHCP サーバーから DHCP 応答を送信する際に、クラスレス静的ルート (RFC 3442) を併せて送信することができます。 +S2 VPN クライアントがクラスレス静的ルート (RFC 3442) を認識できるかどうかは、VPN クライアントソフトウェアによって異なります。SoftEther VPN Client および OpenVPN Client はクラスレス静的ルートに対応しています。L2TP/IPsec および MS-SSTP においては、利用の可否はクライアントソフトウェアに依存します。 +S3 仮想 DHCP サーバーのオプションでデフォルトゲートウェイを空欄に設定することで、スプリットトンネリングが実現できます。L2TP/IPsec および MS-SSTP クライアントを使用している場合は、IPv4 の設定画面でデフォルトゲートウェイを VPN サーバーに向けないようにする設定が必要です。 +S4 ローカルブリッジ経由で外部に DHCP サーバーがある場合は、その DHCP サーバーでクラスレス静的ルート (RFC 3442) をプッシュするよう設定することもできます。その場合は、SecureNAT の仮想 DHCP サーバー機能は無効にしてください。また、この画面での設定は必要ありません。 +S5 プッシュする静的ルーティングテーブルの編集 +S6 例: 192.168.5.0/255.255.255.0/192.168.4.254, 10.0.0.0/255.0.0.0/192.168.4.253\r\n\r\n複数のエントリ (最大 64 個) はカンマまたはスペースで区切ります。\r\n各エントリは、"IP ネットワークアドレス/サブネットマスク/ゲートウェイ IP アドレス" の書式で記述します。 +S7 クラスレス静的ルートについては、RFC 3442 をお読みください。 +IDOK &OK +IDCANCEL キャンセル + + + +########################################################################### +# # +# ソフトウェア内のメニューの文字列データ # +# # +########################################################################### + + +# 接続マネージャのメニュー +PREFIX CM_MENU +# [接続] メニュー +CMD_TOP_CONNECT 接続(&C) +CMD_CONNECT 接続(&O)\tEnter +CMD_STATUS 状態の表示(&S)...\tCtrl+S +CMD_DISCONNECT 切断(&I)\tCtrl+D +CMD_DISCONNECT_ALL すべての接続を切断(&A)\tCtrl+I +CMD_RENAME 名前の変更(&M)\tF2 +CMD_NEW 接続設定の新規作成(&N)...\tCtrl+N +CMD_CLONE コピーの作成(&C)\tCtrl+C +CMD_SHORTCUT 接続ショートカットの作成(&H)... +CMD_EXPORT_ACCOUNT 接続設定のエクスポート(&F)... +CMD_IMPORT_ACCOUNT 接続設定のインポート(&P)... +CMD_STARTUP スタートアップ接続に設定(&T)\tCtrl+T +CMD_NOSTARTUP スタートアップ接続を解除(&E) +CMD_RECENT 最近接続した &VPN サーバー +CMD_DELETE 削除(&D)\tDel +CMD_PROPERTY プロパティ(&R)...\tAlt+Enter +CMD_EXIT 接続マネージャを閉じる(&O)\tAlt+F4 +CMD_QUIT 接続マネージャプログラムの終了(&X)\tAlt+Q +# [編集] メニュー +CMD_TOP_EDIT 編集(&E) +CMD_SELECT_ALL すべて選択(&A)\tCtrl+A +CMD_SWITCH_SELECT 選択の切り替え(&I) +# [表示] メニュー +CMD_TOP_VIEW 表示(&V) +CMD_STATUSBAR ステータスバーの表示(&S) +CMD_VISTASTYLE Windows Vista / 7 / 8 / 10 スタイル(&Y) +CMD_SHOWPORT ポート番号を接続設定一覧に表示(&P) +CMD_TRAYICON タスクトレイのアイコンの表示(&T) +CMD_ICON アイコン(&I) +CMD_DETAIL 詳細(&D) +CMD_GRID 罫線を表示(&G) +CMD_REFRESH 最新の状態に更新(&R)\tF5 +# [仮想 LAN] メニュー +CMD_TOP_VLAN 仮想 &LAN +CMD_NEW_VLAN 新規仮想 LAN カードの作成(&C)...\tCtrl+L +CMD_ENABLE_VLAN 仮想 LAN カードの有効化(&E)\tCtrl+E +CMD_DISABLE_VLAN 仮想 LAN カードの無効化(&S)\tCtrl+B +CMD_DELETE_VLAN 仮想 LAN カードの削除(&D)\tDel +CMD_REINSTALL ドライバの再インストール(&U)...\tCtrl+U +CMD_WINNET &Windows ネットワーク接続の設定...\tCtrl+W +# [スマートカード] メニュー +CMD_TOP_SECURE スマートカード(&S) +CMD_SECURE_MANAGER スマートカードマネージャ(&M)...\tCtrl+G +CMD_SECURE_SELECT 使用するスマートカードの選択(&S)... +# [ツール] メニュー +CMD_TOP_TOOL ツール(&T) +CMD_PASSWORD パスワードの設定(&P)...\tCtrl+P +CMD_TRUST 信頼する証明機関の証明書の管理(&T)...\tCtrl+R +CMD_NETIF ネットワークデバイスの状態(&N)... +CMD_TCPIP TCP/IP 最適化ユーティリティ(&U)... +CMD_MMCSS Windows Vista / 7 / 8 / 10 のための最適化機能(&V)... +CMD_TRAFFIC 通信スループット測定ツール(&R)...\tCtrl+Q +CMD_CM_SETTING 動作モードの変更(&M)... +CMD_LANGUAGE 表示言語の変更(&L)... +CMD_OPTION オプション設定(&O)...\tCtrl+O +# [音声ガイド] メニュー +CMD_TOP_VOICE 音声ガイド(&O) +CMD_VOIDE_NONE 音声ガイド OFF(&D) +CMD_VOICE_NORMAL 標準の音声ガイド(&N) +CMD_VOICE_ODD 拡張音声ガイド(&O) +# [ヘルプ] メニュー +CMD_TOP_HELP ヘルプ(&H) +CMD_ABOUT バージョン情報(&A)... + + + + + + + + + + + + + + + +########################################################################### +# # +# コマンドプロンプトの文字列データ # +# # +########################################################################### + +PREFIX NULL + +# コンソールシステム全般系 +CON_INFILE_ERROR エラー: 指定された入力ファイル "%s" を開くことができません。 +CON_OUTFILE_ERROR エラー: 指定された出力ファイル "%s" を作成することができませんでした。 +CON_INFILE_START ファイル "%s" に記述されているコマンドを、キーボードからの入力の代わりに使用します。 +CON_OUTFILE_START 画面に出力されたメッセージは、ファイル "%s" にも保存されます。 +CON_USER_CANCEL [EOF] +CON_UNKNOWN_CMD "%S": コマンドが見つかりません。\nHELP コマンドで使用できるコマンド一覧を表示できます。 +CON_AMBIGUOUS_CMD "%S": コマンドが曖昧です。 +CON_AMBIGUOUS_CMD_1 指定されたコマンド名は、次の複数のコマンドに一致します: +CON_AMBIGUOUS_CMD_2 より厳密にコマンド名を指定し直してください。 +CON_INVALID_PARAM パラメータ "/%S" が指定されています。コマンド "%S" ではそのようなパラメータは指定できません。詳しくは "%S /HELP" と入力して使用できるパラメータ一覧を確認してください。 +CON_AMBIGUOUS_PARAM "/%S": パラメータ名が曖昧です。 +CON_AMBIGUOUS_PARAM_1 指定されたパラメータ名は、コマンド "%S" のパラメータとして指定可能な次の複数のパラメータに一致します: +CON_AMBIGUOUS_PARAM_2 より厳密にパラメータ名を指定し直してください。 + + +# 不明なコマンド +CMD_UNKNOWM このコマンドに関する説明はありません。 +CMD_UNKNOWN_HELP このコマンドに関する詳細な説明はありません。このコマンドの動作について詳しく知りたい場合は、マニュアルやオンラインドキュメントを参照してください。 +CMD_UNKNOWN_ARGS コマンドの実行例はありません。 +CMD_UNKNOWN_PARAM このパラメータに関する説明はありません。 + + +# コンソールシステム内部で使用している文字列 +CMD_HELP_1 下記の %u 個のコマンドが使用できます: +CMD_HELP_2 それぞれのコマンドの使用方法については、"コマンド名 ?" と入力するとヘルプが表示されます。 +CMD_EVAL_MIN_MAX 値は %u 以上 %u 以下の整数で指定する必要があります。 +CMD_PROMPT 値を入力してください : +CMD_EVAL_NOT_EMPTY 空白を指定することはできません。 +CMD_EVAL_SAFE 使用できない文字が含まれています。 +CMD_EVAL_INT 1 以上の整数を指定する必要があります。 +CMD_HELP_TITLE コマンド "%S" のヘルプ +CMD_HELP_DESCRIPTION [目的] +CMD_HELP_USAGE [使用方法] +CMD_HELP_HELP [説明] +CMD_HELP_ARGS [パラメータ] +CMD_PROMPT_PORT ポート番号を入力してください : +CMD_EVAL_PORT ポート番号が不正です。ポート番号は 1 以上 65535 以下で指定してください。 +CMD_CT_STD_COLUMN_1 項目 +CMD_CT_STD_COLUMN_2 値 +CMD_CT_STD_COLUMN_3 説明 +CMD_PARSE_IP_SUBNET_ERROR_1_6 "IPv6 アドレス/サブネットマスク" の形式で指定してください。\nIPv6 アドレスは 2001:200:0:1:: のように 16 進数をコロンで区切って指定します。サブネットマスクは ffff:ffff:ffff:ffff:: のように IPv6 形式で区切って指定するか、64 のように先頭からのビット長を 10 進数で指定できます。\n単一の IPv6 ホストを指定するには、サブネットマスクを ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff または 128 として指定します。\n(例)\n2001:200:0:1::/64\n2001:200:0:1::/ffff:ffff:ffff:ffff::\n2001:200:0:1::5/128\n\n +CMD_PARSE_IP_SUBNET_ERROR_1 "IPv4 アドレス/サブネットマスク" の形式で指定してください。\nIPv4 アドレスは 192.168.0.1 のように 10 進数をドットで区切って指定します。サブネットマスクは 255.255.255.0 のように 10 進数をドットで区切って指定するか、24 のように先頭からのビット長を 10 進数で指定できます。\n単一のホストを指定するには、サブネットマスクを 255.255.255.255 または 32 として指定します。\n(例)\n192.168.0.1/24\n192.168.0.1/255.255.255.0\n192.168.0.5/255.255.255.255\n\n +CMD_PARSE_IP_SUBNET_ERROR_2 指定された IP アドレスはネットワークアドレスではありません。 +CMD_PARSE_IP_SUBNET_ERROR_3 指定された IP アドレスはネットワークプレフィックスアドレスではありません。 +CMD_EVAL_DATE_TIME_FAILED 日付と時刻の指定が不正です。\n"2005/10/08 19:30:00" のように、年・月・日・時・分・秒 の 6 個の整数をスペース、スラッシュまたはコロンで区切って指定してください。年は 4 桁で指定してください。 +CMD_PARSE_IP_MASK_ERROR_1_6 "IPv6 アドレス/マスク" の形式で指定してください。\nIPv6 アドレスは 2001:200:0:1:: のように 16 進数をコロンで区切って指定します。マスクは ffff:ffff:ffff:ffff:: のように IPv6 形式で区切って指定するか、64 のように先頭からのビット長を 10 進数で指定できます。\n単一の IPv6 ホストを指定するには、マスクを ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff または 128 として指定します。\n(例)\n2001:200:0:1::/64\n2001:200:0:1::/ffff:ffff:ffff:ffff::\n2001:200:0:1::5/128\n\n +CMD_PARSE_IP_MASK_ERROR_1 "IPv4 アドレス/マスク" の形式で指定してください。\nIPv4 アドレスは 192.168.0.1 のように 10 進数をドットで区切って指定します。マスクは 255.255.255.0 のように 10 進数をドットで区切って指定するか、24 のように先頭からのビット長を 10 進数で指定できます。\n単一のホストを指定するには、マスクを 255.255.255.255 または 32 として指定します。\n(例)\n192.168.0.1/24\n192.168.0.1/255.255.255.0\n192.168.0.5/255.255.255.255\n\n + + +# 共通メッセージ +CMD_MSG_INVALID_HOSTNAME ホスト名の指定が正しくありません。 +CMD_MSG_OK コマンドは正常に終了しました。 +CMD_MSG_ALLOW 許可 +CMD_MSG_DENY 禁止 +CMD_MSG_INFINITE 無制限 +CMD_MSG_ENABLE 有効 +CMD_MSG_DISABLE 無効 +CMD_MSG_LOAD_CERT_FAILED 指定された X.509 証明書ファイルを読み込めません。 +CMD_MSG_SAVE_CERT_FAILED X.509 証明書ファイルの書き込みに失敗しました。 +CMD_ACCOUNT_COLUMN_NAME 接続設定名 +CMD_ACCOUNT_COLUMN_HOSTNAME 接続先 VPN Server のホスト名 +CMD_ACCOUNT_COLUMN_PORT 接続先 VPN Server のポート番号 +CMD_ACCOUNT_COLUMN_HUBNAME 接続先 VPN Server の仮想 HUB 名 +CMD_ACCOUNT_COLUMN_PROXY_TYPE 経由するプロキシサーバーの種類 +CMD_ACCOUNT_COLUMN_PROXY_HOSTNAME プロキシサーバーのホスト名 +CMD_ACCOUNT_COLUMN_PROXY_PORT プロキシサーバーのポート番号 +CMD_ACCOUNT_COLUMN_PROXY_USERNAME プロキシサーバーのユーザー名 +CMD_ACCOUNT_COLUMN_SERVER_CERT_USE サーバー証明書の検証 +CMD_ACCOUNT_COLUMN_SERVER_CERT_NAME 登録されているサーバー固有証明書 +CMD_ACCOUNT_COLUMN_RETRY_ON_SERVER_CERT サーバー証明書が信頼できない場合に接続を再試行する +CMD_ACCOUNT_COLUMN_DEVICE_NAME 接続に使用するデバイス名 +CMD_ACCOUNT_COLUMN_AUTH_TYPE 認証の種類 +CMD_ACCOUNT_COLUMN_AUTH_USERNAME ユーザー名 +CMD_ACCOUNT_COLUMN_AUTH_CERT_NAME 認証に使用するクライアント証明書 +CMD_ACCOUNT_COLUMN_NUMTCP VPN 通信に使用する TCP コネクション数 +CMD_ACCOUNT_COLUMN_TCP_INTERVAL 各 TCP コネクションの確立間隔 +CMD_ACCOUNT_COLUMN_TCP_TTL 各 TCP コネクションの寿命 +CMD_ACCOUNT_COLUMN_TCP_HALF 半二重モードの使用 +CMD_ACCOUNT_COLUMN_ENCRYPT SSL による暗号化 +CMD_ACCOUNT_COLUMN_COMPRESS データ圧縮 +CMD_ACCOUNT_COLUMN_BRIDGE_ROUTER ブリッジ / ルータモードで接続 +CMD_ACCOUNT_COLUMN_MONITOR モニタリングモードで接続 +CMD_ACCOUNT_COLUMN_NO_TRACKING ルーティングテーブルを調整しない +CMD_ACCOUNT_COLUMN_QOS_DISABLE QoS 制御機能を使用しない +CMD_ACCOUNT_COLUMN_DISABLEUDP UDP 高速化機能を無効化する + + +# デバッグ情報書き出しコマンド +CMD_DEBUG_SOFTNAME SoftEther VPN デバッグ情報収集ツール +CMD_DEBUG_PRINT SoftEther VPN デバッグ情報収集ツール\r\n\r\n +CMD_DEBUG_NOT_2000 このコマンドは Windows 2000 以降でのみ使用できます。 +CMD_DEBUG_NOT_ADMIN このコマンドを起動するには、Windows に管理者権限でログインする必要があります。 +CMD_DEBUG_UAC_FAILED 管理者権限の取得に失敗しました。 +CMD_DEBUG_SAVE_TITLE デバッグ情報の保存先ファイル名を指定してください +CMD_DEBUG_OK デバッグ情報ファイルを "%s" に保存しました。\r\n\r\nこのファイルをサポート担当者の指示に従ってサポート担当者にお送りください。\r\nなお、ファイルをお送りいただく前に必ずファイルの内容をご確認ください。\r\nもしファイルの内容に秘密情報が含まれている場合で、その情報をファイルの送付先の担当者に開示したくないとお考えの場合は、当該秘密情報の部分のみをあなたの責任において手動で除去してから再度ファイルを ZIP で圧縮しお送りください。\r\n\r\n秘密情報が含まれているにも関わらず、それを削除せずにサポート担当者にお送りいただいた場合、当該秘密情報をサポート担当者に開示することについて同意されたものとみなされますのでご注意ください。 +CMD_DEBUG_NG デバッグ情報ファイルを "%s" に保存できませんでした。 + + +# TEST コマンド +CMD_TEST 実験的な動作を行います。 +CMD_TEST_HELP テストコマンドです。実験的な動作を行います。Test コマンドはいくつかの引数を指定することができます。いくつかの引数は省略することができます。 +CMD_TEST_ARGS Test [/A1:a_str] [/A2:b_str] [/A3:int_value] +CMD_TEST_A1 パラメータ A1 を指定します。省略することができます。 +CMD_TEST_A2 パラメータ A2 を指定します。省略すると、実行時にパラメータ A2 を入力するためのプロンプトが表示されます。空白を指定することはできません。 +CMD_TEST_A3 数値を指定します。1 以上 100 以下の整数を指定しなければなりません。それ以外の整数を指定した場合は、エラーメッセージが表示されます。 +CMD_TEST_EVAL_A2 パラメータ A2 に空白を指定することはできません。 +CMD_IP_EVAL_FAILED IP アドレスの指定が正しくありません。 +CMD_HOSTPORT_EVAL_FAILED ホスト名とポート番号の指定が不正です。\nホスト名:ポート番号 または IPアドレス:ポート番号 のような形式で指定してください。 +CMD_PORTLIST_EVAL_FAILED ポート番号の一覧の指定が不正です。\nポート番号は少なくとも 1 つ以上設定する必要があり、複数個設定することも可能です。その場合は、"443,992,8888" のようにカンマ記号で区切ってください。 +CMD_PROTOCOL_EVAL_FAILED プロトコルの指定が正しくありません。プロトコルは ip, tcp, udp, icmpv4, icmpv6 またはプロトコル番号 (0 から 255 まで) を指定してください。 +CMD_PORT_RANGE_EVAL_FAILED ポート番号またはポート番号の範囲の指定が正しくありません。ポート番号を 1 つだけ指定する場合はそのポート番号を整数で指定してください。複数のポートを指定する場合は範囲の開始ポート番号と終了ポート番号を 80-443 のようにハイフンでつないで指定してください。 +CMD_TCP_CONNECTION_STATE_EVAL_FAILED TCP コネクションの状態指定が不正です。TCP コネクションの状態を指定する場合は、"Established" または "Unestablished" を指定してください。プロトコルの指定で tcp を選択する必要があります。 +CMD_MAC_ADDRESS_AND_MASK_EVAL_FAILED MAC アドレスとマスクの指定が不正です。MAC アドレスとマスクには、16 進数で指定してください。"-" や ":" の区切りが使用出来ますが、省略もできます。例えば "00-AC-84-EA-33-BC/FF-FF-FF-FF-FF-FF" のように指定してください。 +CMD_EXEC_MSG_NAME %S コマンド - %s +CMD_ID ID +CMD_FILE_NOT_FOUND 指定されたファイル "%s" が見つかりません。 +CMD_FILE_NAME_EMPTY ファイル名が指定されていません。 +CMD_SAVECERTPATH X.509 証明書の保存先ファイル名: +CMD_SAVECERT_FAILED 証明書ファイルの保存に失敗しました。 +CMD_SAVEKEYPATH 秘密鍵の保存先ファイル名: +CMD_SAVEKEY_FAILED 秘密鍵ファイルの保存に失敗しました。 +CMD_SAVEFILE_FAILED ファイルの保存に失敗しました。 +CMD_LOADFILE_FAILED ファイルのオープンに失敗しました。 +CMD_LOADCERTPATH 読み込む X.509 証明書のファイル名: +CMD_LOADCERT_FAILED 証明書ファイルの読み込みに失敗しました。 +CMD_LOADKEYPATH 読み込む秘密鍵のファイル名: +CMD_LOADKEY_FAILED 秘密鍵ファイルの読み込みに失敗しました。 +CMD_LOADKEY_ENCRYPTED_1 指定された秘密鍵ファイルはパスフレーズによって保護されています。 +CMD_LOADKEY_ENCRYPTED_2 パスフレーズを入力してください: +CMD_LOADKEY_ENCRYPTED_3 パスフレーズが間違っています。 +CMD_KEYPAIR_FAILED 指定された X.509 証明書と秘密鍵の組合せは正しくありません。証明書とその証明書に対応した秘密鍵が必要です。 +CMD_CERT_NOT_EXISTS 証明書は登録されていません。 +CMD_NO_SETTINGS - +CMD_DISCONNECTED_MSG \n--- エラー ---\n\n管理対象のホストとの通信セッションが切断されました。この後のコマンドを実行してもエラーになります。\n\n管理対象のホストに再接続するには、EXIT と入力して一度プロンプトから抜けてから再接続してください。\n\n + + +# VPNCMD コマンド +CMD_VPNCMD SoftEther VPN Developer Edition コマンドライン管理ユーティリティ +CMD_VPNCMD_HELP vpncmd プログラムは、SoftEther VPN ソフトウェアをコマンドラインで管理することができるユーティリティです。vpncmd を使用すると、ローカルまたはリモートコンピュータで動作している VPN Client、VPN Server、および VPN Bridge に接続してそれらのサービスを管理することができます。また、VPN Tools モードを使用して、VPN Server や VPN Client に接続していなくても使用できる証明書の作成や速度測定機能などを呼び出すこともできます。\nvpncmd では、/IN および /OUT パラメータとしてファイル名を指定した場合、実行するコマンドを列挙したファイルに従ってコマンドを一括実行したり、実行結果をファイルに書き出すことができます。通常、vpncmd を起動した場合はコマンドプロンプトが表示されますが、/IN パラメータで入力ファイルを指定した場合は入力ファイルのすべての行の実行が完了すると自動的に終了します。また、/CMD パラメータで実行するコマンドを指定した場合、そのコマンドの実行が完了すると自動的に終了します。/IN パラメータと /CMD パラメータは同時に指定することはできません。vpncmd プログラムの終了コードは、最後に実行したコマンドのエラーコード (成功した場合は 0) となります。\nWindows 環境では、管理者権限で 1 度以上 vpncmd を起動すると、次回から Windows のコマンドプロンプトや [ファイル名を指定して実行] を開いて vpncmd と入力するだけで vpncmd を起動することができるようになります。UNIX システムで同様のことを実現するためには、PATH 環境変数を手動で適切に設定することができます。 +CMD_VPNCMD_ARGS vpncmd [host:port] [/CLIENT|/SERVER|/TOOLS] [/HUB:hub] [/ADMINHUB:adminhub] [/PASSWORD:password] [/IN:infile] [/OUT:outfile] [/CMD commands...] +CMD_VPNCMD_[host:port] [ホスト名:ポート番号] の形式のパラメータを指定すると、そのホストに自動的に接続します。指定しない場合は、接続先を入力するプロンプトが表示されます。VPN Client に接続する場合は、ポート番号は指定できません。 +CMD_VPNCMD_CLIENT VPN Client に接続して管理を行います。/SERVER と共に指定することはできません。 +CMD_VPNCMD_SERVER VPN Server または VPN Bridge に接続して管理を行います。/CLIENT と共に指定することはできません。 +CMD_VPNCMD_TOOLS VPN Tools のコマンドを使用できるプロンプトを表示します。これには、証明書簡易作成ツール (MakeCert コマンド) および通信速度測定ツール (SpeedTest コマンド) などが含まれます。 +CMD_VPNCMD_HUB VPN Server に「仮想 HUB 管理モード」で接続する際の仮想 HUB 名 'hub' を指定します。ホスト名を指定して /HUB パラメータを指定しない場合は、「サーバー管理モード」で接続します。 +CMD_VPNCMD_ADMINHUB VPN Server に接続した後に自動的に選択する仮想 HUB 名 'adminhub' を指定します。/HUB パラメータを指定した場合は、その仮想 HUB が自動的に選択されますので、指定する必要はありません。 +CMD_VPNCMD_PASSWORD 接続する際に管理パスワードが必要な場合は、パスワード 'password' を指定します。パスワードが指定されていない場合は、入力するプロンプトが表示されます。 +CMD_VPNCMD_IN 接続が完了した後に自動的に実行するコマンドの一覧が記載されたテキストファイル名 'infile' を指定します。/IN パラメータが指定されている場合は、ファイル内のすべての行の実行が完了した後に自動的に vpncmd プログラムは終了します。ファイルに多バイト文字が含まれている場合は、Unicode (UTF-8) でエンコードされている必要があります。/CMD と共に指定することはできません (/CMD と共に指定した場合は /IN は無視されます)。 +CMD_VPNCMD_OUT 画面に表示されるプロンプト、メッセージ、エラー、実行結果などのすべての文字列を書き出すテキストファイル名 'outfile' を指定することができます。既に存在するファイルを指定した場合、ファイルの内容は上書きされますのでご注意ください。多バイト文字は、Unicode (UTF-8) でエンコードされて記録されます。 +CMD_VPNCMD_CMD /CMD の後に任意のコマンド 'commands...' を記述すると、接続が完了した後にそのコマンドが実行され、その後 vpncmd プログラムは終了します。/IN と共に指定することはできません (/IN と共に指定した場合は /IN は無視されます)。/CMD パラメータは他のすべての vpncmd のパラメータよりも後に指定してください。 +CMD_VPNCMD_CSV 各コマンドが結果を CSV 形式で出力するようにします。他のプログラムによって出力結果を自動処理する際に便利です。 +CMD_VPNCMD_CS_1 vpncmd プログラムを使って以下のことができます。\n\n1. VPN Server または VPN Bridge の管理\n2. VPN Client の管理\n3. VPN Tools コマンドの使用 (証明書作成や通信速度測定)\n\n +CMD_VPNCMD_CS_2 1 - 3 を選択: +CMD_VPNCMD_HOST_1 接続先の VPN Server または VPN Bridge が動作しているコンピュータの IP アドレスまたはホスト名を指定してください。\n'ホスト名:ポート番号' の形式で指定すると、ポート番号も指定できます。\n(ポート番号を指定しない場合は 443 が使用されます。)\n何も入力せずに Enter を押すと、localhost (このコンピュータ) のポート 443 に接続します。 +CMD_VPNCMD_HOST_2 接続先の VPN Client が動作しているコンピュータの IP アドレスまたはホスト名を指定してください。\n何も入力せずに Enter を押すと、localhost (このコンピュータ) に接続します。 +CMD_VPNCMD_HOST_3 接続先のホスト名または IP アドレス: +CMD_VPNCMD_HUB_1 サーバーに仮想 HUB 管理モードで接続する場合は、仮想 HUB 名を入力してください。\nサーバー管理モードで接続する場合は、何も入力せずに Enter を押してください。 +CMD_VPNCMD_HUB_2 接続先の仮想 HUB 名を入力: +CMD_VPNCMD_ABOUT SoftEther VPN コマンドライン管理ユーティリティ (vpncmd コマンド)\nDeveloper Edition\n%S\n%S\nCopyright (c) all contributors on SoftEther VPN project in GitHub.\nCopyright (c) Daiyuu Nobori, SoftEther Project at University of Tsukuba, and SoftEther Corporation.\nAll rights reserved.\n +CMD_VPNCMD_PASSWORD_1 アクセスが拒否されました。パスワードが間違っているか、接続する管理モードが正しくない可能性があります。パスワードをもう一度入力することができます。キャンセルする場合は、Ctrl + D を押してください。 +CMD_VPNCMD_PASSWORD_2 パスワード: +CMD_VPNCMD_ERROR エラーが発生しました。(エラーコード: %u)\n%s +CMD_VPNCMD_SERVER_CONNECTED VPN Server "%S" (ポート %u) に接続しました。 +CMD_VPNCMD_SERVER_CONNECTED_1 VPN Server 全体の管理権限があります。 +CMD_VPNCMD_SERVER_CONNECTED_2 VPN Server 内の仮想 HUB '%S' に対する管理権限があります。 +CMD_VPNCMD_CLIENT_NO_REMODE 接続先の VPN Client サービスはリモートコンピュータからの管理接続を許可していません。VPN Client が動作しているコンピュータ上でコマンドライン管理ユーティリティまたは VPN クライアント接続マネージャを起動し、localhost に対して接続してください。 +CMD_VPNCMD_PWPROMPT_0 パスワードを入力してください。キャンセルするには Ctrl+D キーを押してください。 +CMD_VPNCMD_PWPROMPT_1 パスワード: +CMD_VPNCMD_PWPROMPT_2 確認入力 : +CMD_VPNCMD_PWPROMPT_3 入力されたパスワードと確認入力が異なります。もう一度入力してください。 +CMD_VPNCMD_CLIENT_CONNECTED VPN Client "%S" に接続しました。 +CMD_VPNCMD_TOOLS_CONNECTED VPN Tools を起動しました。HELP と入力すると、使用できるコマンド一覧が表示できます。 + + +###################################################### +# # +# ここから下は VPN Server 用の管理コマンド # +# # +###################################################### + + + +# About コマンド +CMD_About バージョン情報の表示 +CMD_About_HELP このコマンドライン管理ユーティリティのバージョン情報を表示します。バージョン情報には、vpncmd のバージョン番号、ビルド番号、ビルド情報などが含まれます。 +CMD_About_ARGS About + + +# ServerInfoGet コマンド +CMD_ServerInfoGet サーバー情報の取得 +CMD_ServerInfoGet_Help 現在接続している VPN Server または VPN Bridge のサーバー情報を取得します。サーバーの情報には、バージョン番号、ビルド番号、ビルド情報などが含まれます。また、現在のサーバーの動作モードや動作しているオペレーティングシステムの情報なども取得できます。 +CMD_ServerInfoGet_Args ServerInfoGet + + +# ServerStatusGet コマンド +CMD_ServerStatusGet サーバーの現在の状態の取得 +CMD_ServerStatusGet_Help 現在接続している VPN Server または VPN Bridge の現在の状態をリアルタイムに取得します。サーバー上に存在する各種オブジェクトの個数や、データ通信の統計情報などを取得できます。また、OS によっては現在コンピュータで使用されているメモリ量などを取得することもできます。 +CMD_ServerStatusGet_Args ServerStatusGet + + +# ListenerCreate コマンド +CMD_ListenerCreate TCP リスナーの追加 +CMD_ListenerCreate_Help サーバーに新しい TCP リスナーを追加します。TCP リスナーを追加すると、サーバーは指定した TCP/IP ポート番号でクライアントからの接続の待機を開始します。\n一度追加した TCP リスナーは、ListenerDelete コマンドで削除することができます。\nなお、現在の登録されている TCP リスナーの一覧は、ListenerList コマンドで取得することができます。\nこのコマンドを実行するには、VPN Server の管理者権限が必要です。 +CMD_ListenerCreate_Args ListenerCreate [port] +CMD_ListenerCreate_[port] 新しく追加する TCP/IP リスナーのポート番号を整数で指定します。すでに別のプログラムが使用しているポート番号を使用することもできますが、そのプログラムがポートの使用を終了するまで、VPN Server はそのポートを使用できません。ポート番号は 1 以上 65535 以下で指定してください。 +CMD_ListenerCreate_PortPrompt 新しく追加する TCP/IP リスナーのポート番号: + + +# ListenerDelete コマンド +CMD_ListenerDelete TCP リスナーの削除 +CMD_ListenerDelete_Help サーバーに登録されている TCP リスナーを削除します。TCP リスナーが動作状態にある場合は、自動的に動作を停止してからリスナーが削除されます。\nなお、現在の登録されている TCP リスナーの一覧は、ListenerList コマンドで取得することができます。\nこのコマンドを実行するには、VPN Server の管理者権限が必要です。 +CMD_ListenerDelete_Args ListenerDelete [port] +CMD_ListenerDelete_[port] 削除したい TCP/IP リスナーのポート番号を、整数で指定します。 +CMD_ListenerDelete_PortPrompt 削除する TCP/IP リスナーのポート番号: + + +# ListenerList コマンド +CMD_ListenerList TCP リスナー一覧の取得 +CMD_ListenerList_Help 現在サーバーに登録されている TCP リスナーの一覧を取得します。各 TCP リスナーが動作中、またはエラー状態であるかどうかの情報も取得します。\nこのコマンドを実行するには、VPN Server の管理者権限が必要です。 +CMD_ListenerList_Args ListenerList +CMD_ListenerList_Column1 TCP ポート番号 +CMD_ListenerList_Column2 状態 + + +# ListenerEnable コマンド +CMD_ListenerEnable TCP リスナーの動作開始 +CMD_ListenerEnable_Help 現在サーバーに登録されている TCP リスナーが停止している場合は、その動作を開始します。\nなお、現在の登録されている TCP リスナーの一覧は、ListenerList コマンドで取得することができます。\nこのコマンドを実行するには、VPN Server の管理者権限が必要です。 +CMD_ListenerEnable_Args ListenerEnable [port] +CMD_ListenerEnable_[port] 開始する TCP/IP リスナーのポート番号を、整数で指定します。 +CMD_ListenerEnable_PortPrompt 開始する TCP/IP リスナーのポート番号: + + +# ListenerDisable コマンド +CMD_ListenerDisable TCP リスナーの動作停止 +CMD_ListenerDisable_Help 現在サーバーに登録されている TCP リスナーが動作している場合は、その動作を停止します。\nなお、現在の登録されている TCP リスナーの一覧は、ListenerList コマンドで取得することができます。\nこのコマンドを実行するには、VPN Server の管理者権限が必要です。 +CMD_ListenerDisable_Args ListenerDisable [port] +CMD_ListenerDisable_[port] 停止する TCP/IP リスナーのポート番号を、整数で指定します。 +CMD_ListenerDisable_PortPrompt 開始する TCP/IP リスナーのポート番号: + + +# PortsUDPSet command +CMD_PortsUDPSet サーバーが着信を受付ける UDP ポート番号の一覧を設定します。 +CMD_PortsUDPSet_Help このコマンドを使用すると、このサーバーが着信を受付ける単一または複数の UDP ポートの一覧を設定することができます。\n他のプロセスによって使用されている UDP ポートを設定することも可能ですが、そのポートが解放されるまでは機能しません。\nポート番号は、1 から 65535 の間で指定します。\n現在設定されているポートの一覧は、PortsUDPGet コマンドを使用して確認することができます。\nこのコマンドを実行するには、VPN Server の管理者権限が必要です。 +CMD_PortsUDPSet_Args PortsUDPSet [ports] +CMD_PortsUDPSet_[ports] 複数のポート番号を指定する場合は、スペース文字またはカンマ文字で区切ってください。例: "443, 992, 1194, 5555". \n"0" を指定すると、UDP リスナーを無効化することができます。\n\nポート一覧: + + +# PortsUDPGet command +CMD_PortsUDPGet サーバーにおける着信 UDP ポートの一覧を表示します。 +CMD_PortsUDPGet_Help このコマンドを使用すると、サーバーで待受け状態になっている UDP ポートの一覧を表示することができます。\nポートの設定を変更するには、PortsUDPSet コマンドを使用してください。 +CMD_PortsUDPGet_Args PortsUDPGet +CMD_PortsUDPGet_Ports UDP ポート一覧 + + +# ProtoOptionsSet コマンド +CMD_ProtoOptionsSet 特定のプロトコル固有のオプション値を設定します。 +CMD_ProtoOptionsSet_Help このコマンドを使用することにより、特定のプロトコル固有のオプション値を設定することができます。 \nProtoOptionsGet コマンドを使用することにより、オプション値を取得することもできます。 \nこのコマンドを実行するには、VPN Server の管理者権限が必要です。 +CMD_ProtoOptionsSet_Args ProtoOptionsSet [protocol] [/NAME:option_name] [/VALUE:string/true/false] +CMD_ProtoOptionsSet_[protocol] プロトコル名 +CMD_ProtoOptionsSet_NAME オプション名 +CMD_ProtoOptionsSet_VALUE オプション値 (対象のプロトコルで対応している値を指定してください) +CMD_ProtoOptionsSet_Prompt_[protocol] プロトコル: +CMD_ProtoOptionsSet_Prompt_NAME オプション: +CMD_ProtoOptionsSet_Prompt_VALUE 値: + + +# ProtoOptionsGet コマンド +CMD_ProtoOptionsGet 指定されたプロトコル固有のオプション値を表示します。 +CMD_ProtoOptionsGet_Help このコマンドを使用することにより、特定のプロトコル固有のオプション値を取得することができます。 \n詳細な情報 (例: 値の型) が表示されます。オプション値を設定するには、ProtoOptionsSet コマンドを使用してください。 +CMD_ProtoOptionsGet_Args ProtoOptionsGet [protocol] +CMD_ProtoOptionsGet_[protocol] プロトコル名 +CMD_ProtoOptionsGet_Prompt_[protocol] プロトコル: +CMD_ProtoOptionsGet_Column_Name 名前 +CMD_ProtoOptionsGet_Column_Type 型 +CMD_ProtoOptionsGet_Column_Value 値 +CMD_ProtoOptionsGet_Column_Description 説明 + + +# ProtoOptions +CMD_ProtoOptions_Description_OpenVPN_DefaultClientOption OpenVPN の OCC codeRT 版以外の場合は、OpenVPN はサーバーに対してオプション文字列を送信しません。OpenVPN サーバーのオリジナル版は、オプションを固定で指定する仕組みになっているため、その場合でも動作します。一方、SoftEther VPN は、様々なオプションを動的に設定することができる機能を有しております。そこで、このオプションを使用することにより、OCC code なしでビルドされた OpenVPN に対してデフォルトの静的オプション文字列を送付することができるようになります。これにより、OCC code なしでビルドされた OpenVPN からの接続が成功するようになります。 +CMD_ProtoOptions_Description_OpenVPN_Obfuscation OpenVPN クライアントが検閲用ファイアウォールを回避するための難読化コードを設定します。クライアント側とサーバー側では、同一の XOR マスクを設定する必要があります。コードが異なると、接続ができません。 +CMD_ProtoOptions_Description_OpenVPN_ObfuscationMask パケットで使用される XOR マスクを指定します。OpenVPN クライアントが検閲用ファイアウォールを回避するための難読化コードとして使用されます。 +CMD_ProtoOptions_Description_OpenVPN_PushDummyIPv4AddressOnL2Mode Linux における特定の状況下では manifests に不具合があります。この不具合により、OpenVPN クライアントは TAP デバイスが UP 状態であるにもかかわらず、切断状態となります。このオプションを使用することにより、VPN サーバーは、ダミーの IPv4 アドレス (RFC7600 で規定) をクライアントに対してプッシュ送信することができるようになります。これにより、TAP アダプタが常に UP 状態になります。 + + +# ServerPasswordSet コマンド +CMD_ServerPasswordSet VPN Server の管理者パスワードの設定 +CMD_ServerPasswordSet_Help VPN Server の管理者パスワードを設定します。パラメータとしてパスワードを指定することができます。パラメータを指定しない場合は、パスワードと、その確認入力を行なうためのプロンプトが表示されます。パスワードをパラメータに与えた場合、そのパスワードが一時的に画面に表示されるため危険です。できる限り、パラメータを指定せずに、パスワードプロンプトを用いてパスワードを入力することを推奨します。\nこのコマンドを実行するには、VPN Server の管理者権限が必要です。 +CMD_ServerPasswordSet_Args ServerPasswordSet [password] +CMD_ServerPasswordSet_[password] 新しく設定するパスワードを指定します。 + + +# ClusterSettingGet コマンド +CMD_ClusterSettingGet 現在の VPN Server のクラスタリング構成の取得 +CMD_ClusterSettingGet_Help 現在の VPN Server のクラスタリング構成を取得します。\nこのコマンドを実行するには、VPN Server の管理者権限が必要です。 +CMD_ClusterSettingGet_Args ClusterSettingGet +CMD_ClusterSettingGet_Current 現在の構成 +CMD_ClusterSettingGet_None (設定無し) +CMD_ClusterSettingGet_PublicIp 公開 IP アドレス +CMD_ClusterSettingGet_PublicPorts 公開ポート一覧 +CMD_ClusterSettingGet_Controller 接続先コントローラ +CMD_ClusterSettingGet_ControllerOnly コントローラ機能のみ +CMD_ClusterSettingGet_Weight クラスタ内での性能基準値 + + +# ClusterSettingStandalone コマンド +CMD_ClusterSettingStandalone VPN Server の種類をスタンドアロンに設定 +CMD_ClusterSettingStandalone_Help VPN Server の種類を、「スタンドアロンサーバー」に設定します。スタンドアロンサーバーとは、いずれのクラスタにも属していない状態の VPN Server を意味します。VPN Server をインストールした状態ではデフォルトでスタンドアロンサーバーモードになります。特にクラスタを構成する予定がない場合は、スタンドアロンサーバーモードで動作させることを推奨します。\nこのコマンドを実行するには、VPN Server の管理者権限が必要です。\nまた、このコマンドを実行すると、VPN Server は自動的に再起動します。\nこのコマンドは、VPN Bridge では実行できません。 +CMD_ClusterSettingStandalone_Args ClusterSettingStandalone + + +# ClusterSettingController コマンド +CMD_ClusterSettingController VPN Server の種類をクラスタコントローラに設定 +CMD_ClusterSettingController_Help VPN Server の種類を、「クラスタコントローラ」に設定します。クラスタコントローラとは、複数台の VPN Server でクラスタリングを構築する場合における、各クラスタメンバサーバーの中心となるコンピュータで、クラスタ内に 1 台必要です。同一クラスタを構成する他のクラスタメンバサーバーは、クラスタコントローラに接続することによりクラスタメンバとしての動作を開始します。\nこのコマンドを実行するには、VPN Server の管理者権限が必要です。\nまた、このコマンドを実行すると、VPN Server は自動的に再起動します。\nこのコマンドは、VPN Bridge では実行できません。 +CMD_ClusterSettingController_Args ClusterSettingController [/WEIGHT:weight] [/ONLY:yes|no] +CMD_ClusterSettingController_WEIGHT この VPN Server の性能基準比の値を設定します。クラスタ内でロードバランシングを行う際に基準となる値です。通常は 100 です。たとえば、他のメンバが 100 の状態で、1 台だけ 200 にすると、他のメンバの 2 倍接続を受け持つようにロードバランシング時に調整されます。値は 1 以上で指定します。このパラメータを指定しない場合は、100 が使用されます。 +CMD_ClusterSettingController_ONLY "yes" を指定すると、VPN Server がクラスタ内でコントローラとしての機能のみを動作させ、一般の VPN Client の接続は、自分自身以外のメンバに必ず振り分けるようになります。この機能は、負荷が高い環境で使用します。このパラメータを指定しない場合は、"no" が使用されます。 + + +# ClusterSettingMember コマンド +CMD_ClusterSettingMember VPN Server の種類をクラスタメンバに設定 +CMD_ClusterSettingMember_Help VPN Server の種類を、「クラスタメンバサーバー」に設定します。クラスタメンバサーバーとは、複数台の VPN Server でクラスタリングを構築する場合における、特定の既存のクラスタコントローラが中心となって構成されるクラスタに属する他のメンバコンピュータで、クラスタに必要なだけ複数追加することができます。\nクラスタメンバサーバーとして VPN Server を設定するには、事前に参加する予定のクラスタのコントローラの管理者に、コントローラの IP アドレスとポート番号、この VPN Server の公開 IP アドレスおよび公開ポート番号 (必要な場合)、およびパスワードを問い合わせる必要があります。\nこのコマンドを実行するには、VPN Server の管理者権限が必要です。\nまた、このコマンドを実行すると、VPN Server は自動的に再起動します。\nこのコマンドは、VPN Bridge では実行できません。 +CMD_ClusterSettingMember_Args ClusterSettingMember [server:port] [/IP:ip] [/PORTS:ports] [/PASSWORD:password] [/WEIGHT:weight] +CMD_ClusterSettingMember_[server:port] [ホスト名:ポート番号] の形式のパラメータで、接続先のクラスタコントローラのホスト名、または IP アドレス、およびポート番号を指定します。 +CMD_ClusterSettingMember_IP このサーバーの公開 IP アドレスを指定します。公開 IP アドレスを指定しない場合、"/IP:none" のように指定してください。公開 IP アドレスを指定しなければ、クラスタコントローラへの接続の際に使用されるネットワークインターフェイスの IP アドレスが自動的に使われます。 +CMD_ClusterSettingMember_PORTS このサーバーの公開ポート番号の一覧を指定します。公開ポート番号は、少なくとも 1 つ以上設定する必要があり、複数個設定することも可能です。その場合は、"/PORTS:443,992,8888" のようにカンマ記号で区切ってください。 +CMD_ClusterSettingMember_PASSWORD 接続先のコントローラに接続するためのパスワードを指定します。接続先のコントローラの管理パスワードと同一です。 +CMD_ClusterSettingMember_WEIGHT この VPN Server の性能基準比の値を設定します。クラスタ内で、ロードバランシングを行う際の基準となる値です。たとえば、他のメンバが 100 の状態で、1 台だけ 200 にすると、他のメンバの 2 倍の接続を受け持つように調整されます。値は 1 以上で指定します。このパラメータを指定しない場合は、100 が使用されます。 +CMD_ClusterSettingMember_Prompt_IP_1 公開 IP アドレスを指定してください。\n指定しない場合は、何も入力せずに Enter を押してください。 +CMD_ClusterSettingMember_Prompt_IP_2 公開 IP アドレス: +CMD_ClusterSettingMember_Prompt_PORT_1 公開ポート番号の一覧を指定してください。\n2 個以上のポート番号を指定する場合は、443,992,8888 のようにカンマ記号で区切ってください。 +CMD_ClusterSettingMember_Prompt_PORT_2 公開ポート番号: +CMD_ClusterSettingMember_Prompt_HOST_1 接続先コントローラのホスト名とポート番号: + + +# ClusterMemberList コマンド +CMD_ClusterMemberList クラスタメンバの一覧の取得 +CMD_ClusterMemberList_Help VPN Server がクラスタコントローラとして動作している場合、そのクラスタ内のクラスタメンバサーバーの一覧を、クラスタコントローラ自身を含めて取得します。\n各メンバ毎に、[種類]、[接続時刻]、[ホスト名]、[ポイント]、[セッション数]、[TCP コネクション数]、[動作仮想 HUB 数]、[消費クライアント接続ライセンス]、[消費ブリッジ接続ライセンス] の一覧も取得します。\nこのコマンドは、VPN Bridge では実行できません。 +CMD_ClusterMemberList_Args ClusterMemberList + + +# ClusterMemberInfoGet コマンド +CMD_ClusterMemberInfoGet クラスタメンバの情報の取得 +CMD_ClusterMemberInfoGet_Help VPN Server がクラスタコントローラとして動作している場合、そのクラスタ内のクラスタメンバサーバーの ID を指定して、そのメンバサーバーの情報を取得することができます。\n指定されたクラスタメンバサーバーの [サーバーの種類]、[接続確立時刻]、[IP アドレス]、[ホスト名]、[ポイント]、[公開ポートの一覧]、[動作している仮想 HUB 数]、[1 個目の仮想 HUB]、[セッション数]、[TCP コネクション数] が取得できます。\nこのコマンドは、VPN Bridge では実行できません。 +CMD_ClusterMemberInfoGet_Args ClusterMemberInfoGet [id] +CMD_ClusterMemberInfoGet_[id] 情報を取得するクラスタメンバの ID を指定します。クラスタメンバサーバーの ID は、ClusterMemberList コマンドで取得することができます。 +CMD_ClusterMemberInfoGet_PROMPT_ID 情報を取得するクラスタメンバの ID: + + +# ClusterMemberCertGet コマンド +CMD_ClusterMemberCertGet クラスタメンバの証明書の取得 +CMD_ClusterMemberCertGet_Help VPN Server がクラスタコントローラとして動作している場合、そのクラスタ内のクラスタメンバサーバーの ID を指定して、そのメンバサーバーの公開している X.509 証明書を取得することができます。証明書は、X.509 形式のファイルに保存することができます。\nこのコマンドは、VPN Bridge では実行できません。 +CMD_ClusterMemberCertGet_Args ClusterMemberCertGet [id] [/SAVECERT:cert] +CMD_ClusterMemberCertGet_[id] 証明書を取得するクラスタメンバの ID を指定します。クラスタメンバサーバーの ID は、ClusterMemberList コマンドで取得することができます。 +CMD_ClusterMemberCertGet_SAVECERT 取得した証明書を保存するファイルのパス名を指定します。証明書は X.509 形式で保存されます。 +CMD_ClusterMemberCertGet_PROMPT_ID 証明書を取得するクラスタメンバの ID: + +# ClusterConnectionStatusGet コマンド +CMD_ClusterConnectionStatusGet クラスタコントローラへの接続状態の取得 +CMD_ClusterConnectionStatusGet_Help VPN Server がクラスタメンバサーバーとして動作している場合、クラスタコントローラへの接続状態を取得します。\n取得できる情報には、[コントローラの IP アドレス]、[ポート番号]、[接続状態]、[接続開始時刻]、[最初の接続確立成功時刻]、[現在の接続成功確立時刻]、[接続試行回数]、[接続に成功した回数]、[接続に失敗した回数] があります。\nこのコマンドは、VPN Bridge では実行できません。 +CMD_ClusterConnectionStatusGet_Args ClusterConnectionStatusGet + + +# Debug コマンド +CMD_Debug デバッグコマンドの実行 +CMD_Debug_Help VPN Server / Bridge の実行中のプロセスでデバッグコマンドを実行します。\nこのコマンドは、ソフトイーサ株式会社からのサポートの指示があった場合のみ使用してください。\nむやみにこのコマンドを使用すると、動作中の VPN Server / Bridge が停止する原因になります。 +CMD_Debug_Args Debug [id] [/ARG:arg] +CMD_Debug_[id] デバッグコマンド番号を整数で指定します。 +CMD_Debug_ARG デバッグコマンドに渡す文字列を指定します。スペースを含む場合は、" " で囲んでください。 +CMD_Debug_Msg1 デバッグコマンドを送信中... +CMD_Debug_Msg2 デバッグコマンドの動作が完了しました。\n戻り値: \"%S\" + +# Crash コマンド +CMD_Crash VPN Server / Bridge プロセスでエラーを発生させプロセスを強制終了する +CMD_Crash_Help VPN Server / Bridge の実行中のプロセスで致命的なエラー (メモリ保護違反など) を発生させ、プロセスをクラッシュさせます。その結果、VPN Server / Bridge がサービスモードで起動している場合は、自動的にプロセスが再起動します。VPN Server がユーザーモードで起動している場合は、プロセスは自動的に再起動しません。\nこのコマンドは、VPN Server / Bridge で何らかの回復不能なエラーが発生したり、プロセスが暴走したりしているときに、すぐにプロセスを再起動しなければならないような場合に利用してください。このコマンドを実行すると、現在 VPN Server / Bridge に接続されているすべての VPN セッションは切断されます。また、VPN Server がメモリ内に保有している未保存のデータはすべて失われます。\nこのコマンドを実行する前に、Flush コマンドを実行してVPN Server / Bridge の未保存の設定データを設定ファイルに強制保存することをお勧めします。\nこのコマンドは、VPN Server / Bridge 全体の管理者のみが実行できます。 +CMD_Crash_Args Crash [yes] +CMD_Crash_[yes] 確認のため、"yes" と指定してください。 +CMD_Crash_Msg VPN Server にクラッシュ コマンドを送信しています。VPN Server は直ちにクラッシュするため、コマンドが成功したかどうかの戻り値は取得できません。このコマンドを実行した後は、vpncmd は VPN Server との間の接続を切断されます。 +CMD_Crash_Confirm 本当に VPN Server をクラッシュさせますか?\nよろしい場合は "yes" と入力してください: +CMD_Crash_Aborted Crash コマンドは中止されました。 + + +# Flush コマンド +CMD_Flush VPN Server / Bridge の未保存の設定データを設定ファイルに強制保存する +CMD_Flush_Help 通常、VPN Server / Bridge は設定内容をメモリ内に保持し、vpn_server.config または vpn_bridge.config ファイルに定期的に保存します。これらの設定ファイルへの保存処理は、通常、300 秒 (5 分) ごとに自動的に行われます (この間隔は、設定ファイルの AutoSaveConfigSpan 項目を編集することで変更できます)。なお、VPN Server / Bridge サービスが正常終了しようとする際にもこれらの設定ファイルは自動的に保存されます。\nFlush コマンドを実行すると、VPN Server / Bridge は、すぐに設定ファイルへの保存処理を実施します。これにより、現在の最新の設定データが必ずサーバーコンピュータのディスクドライブにフラッシュされます。たとえば、やむを得ずサービスプロセスを正常終了する時間的余裕がない場合は、Flush コマンドを用いてデータを強制保存してから、サービスプロセスやサーバーコンピュータを強制シャットダウンしてください。\nこのコマンドは、VPN Server / Bridge 全体の管理者のみが実行できます。 +CMD_Flush_Args Flush +CMD_Flush_Msg1 メモリ上の設定データをディスクに書き込んでいます...\n +CMD_Flush_Msg2 書き込みに成功しました。ファイルサイズは %S bytes です。\n + + +# ServerCertGet コマンド +CMD_ServerCertGet VPN Server の SSL 証明書の取得 +CMD_ServerCertGet_Help VPN Server が、接続したクライアントに対して提示する SSL 証明書を取得します。証明書は、X.509 形式のファイルに保存することができます。 +CMD_ServerCertGet_Args ServerCertGet [cert] +CMD_ServerCertGet_[cert] 取得した証明書を保存するファイルのパス名を指定します。証明書は X.509 形式で保存されます。 + + +# ServerKeyGet コマンド +CMD_ServerKeyGet VPN Server の SSL 証明書の秘密鍵の取得 +CMD_ServerKeyGet_Help VPN Server が接続したクライアントに対して提示する SSL 証明書の秘密鍵を取得します。秘密鍵は、Base 64 でエンコードされたファイルに保存することができます。\nこのコマンドを実行するには、VPN Server の管理者権限が必要です。 +CMD_ServerKeyGet_Args ServerKeyGet [key] +CMD_ServerKeyGet_[key] 取得した秘密鍵を保存するファイルのパス名を指定します。秘密鍵は Base 64 エンコードされて保存されます。 + + +# ServerCertSet コマンド +CMD_ServerCertSet VPN Server の SSL 証明書と秘密鍵の設定 +CMD_ServerCertSet_Help VPN Server が接続したクライアントに対して提示する SSL 証明書と、その証明書に対応する秘密鍵を設定します。証明書は X.509 形式、秘密鍵は Base 64 エンコードされた形式である必要があります。\nこのコマンドを実行するには、VPN Server の管理者権限が必要です。 +CMD_ServerCertSet_Args ServerCertSet [/LOADCERT:cert] [/LOADKEY:key] +CMD_ServerCertSet_LOADCERT 使用する X.509 形式の証明書ファイルを指定します。 +CMD_ServerCertSet_LOADKEY 使用する Base 64 エンコードされた、証明書に対応する秘密鍵ファイルを指定します。 + + +# ServerCipherGet コマンド +CMD_ServerCipherGet VPN 通信で使用される暗号化アルゴリズムの取得 +CMD_ServerCipherGet_Help VPN Server と、接続したクライアントとの間で通信に使用する SSL コネクションにおける暗号化、および電子署名に用いられるアルゴリズムの現在の設定と、VPN Server 上で使用可能なアルゴリズムの一覧を取得します。 +CMD_ServerCipherGet_Args ServerCipherGet +CMD_ServerCipherGet_SERVER VPN Server で現在使用されている暗号化アルゴリズム: +CMD_ServerCipherGet_CIPHERS 使用可能な暗号化アルゴリズム名の一覧: + +# ServerCipherSet コマンド +CMD_ServerCipherSet VPN 通信で使用される暗号化アルゴリズムの設定 +CMD_ServerCipherSet_Help VPN Server と、接続したクライアントとの間で通信に使用する SSL コネクションにおける暗号化、および電子署名に用いられるアルゴリズムを設定します。\nアルゴリズム名を指定すると、以後この VPN Server に接続した VPN Client や、VPN Bridge との間で、指定したアルゴリズムが使用され、データが暗号化されます。\nこのコマンドを実行するには、VPN Server の管理者権限が必要です。 +CMD_ServerCipherSet_Args ServerCipherSet [name] +CMD_ServerCipherSet_[name] 設定するる暗号化および電子署名アルゴリズムを指定します。使用可能なアルゴリズムの一覧は、ServerCipherGet コマンドで取得することができます。 +CMD_ServerCipherSet_PROMPT_NAME 指定する暗号化アルゴリズム名: + +# KeepEnable コマンド +CMD_KeepEnable インターネット接続の維持機能の有効化 +CMD_KeepEnable_Help [インターネット接続の維持機能] を有効にします。[インターネット接続の維持機能] を使用すると、一定期間無通信状態が続くと、自動的に接続が切断されるようなネットワーク接続環境の場合、インターネット上の任意のサーバーに対して一定間隔ごとにパケットを送信することにより、インターネット接続を維持することができます。\n接続先のホスト名などについては、KeepSet コマンドで設定することができます。\nVPN Server または VPN Bridge で、このコマンドを実行するには、管理者権限が必要です。 +CMD_KeepEnable_Args KeepEnable + + +# KeepDisable コマンド +CMD_KeepDisable インターネット接続の維持機能の無効化 +CMD_KeepDisable_Help [インターネット接続の維持機能] を無効にします。\nVPN Server または VPN Bridge で、このコマンドを実行するには、管理者権限が必要です。 +CMD_KeepDisable_Args KeepDisable + + +# KeepSet コマンド +CMD_KeepSet インターネット接続の維持機能の設定 +CMD_KeepSet_Help [インターネット接続の維持機能] の接続先ホスト名などの設定を行ないます。一定期間無通信状態が続くと自動的に接続が切断されるようなネットワーク接続環境で、[インターネット接続の維持機能] を使用すると、インターネット上の任意のサーバーに対して、一定間隔ごとにパケットを送信することにより、インターネット接続を維持することができます。\nこのコマンドでは、通信先の [ホスト名]、[ポート番号]、[パケット送出間隔]、および [プロトコル] を指定することができます。\nインターネット接続維持のために送信されるパケットは、ランダムな内容であり、コンピュータやユーザーを識別する個人情報などが送信されることはありません。\nインターネット接続の維持機能は、KeepEnable コマンド、または KeepDisable コマンドを用いて、有効化 / 無効化することができます。KeepSet は有効 / 無効の状態を変更しません。\nVPN Server または VPN Bridge で、このコマンドを実行するには、管理者権限が必要です。 +CMD_KeepSet_Args KeepSet [/HOST:host:port] [/PROTOCOL:tcp|udp] [/INTERVAL:interval] +CMD_KeepSet_HOST [ホスト名:ポート番号] の形式で、通信先のホスト名、または IP アドレスとポート番号を指定します。 +CMD_KeepSet_PROTOCOL tcp または udp を指定します。 +CMD_KeepSet_INTERVAL パケットを送出する間隔を秒単位で指定します。 +CMD_KeepSet_PROMPT_HOST 通信先のホスト名または IP アドレスとポート番号: +CMD_KeepSet_PROMPT_PROTOCOL tcp または udp: +CMD_KeepSet_PROMPT_INTERVAL パケットを送出する間隔 (秒単位): +CMD_KeepSet_EVAL_TCP_UDP "tcp" または "udp" を指定してください。 + +# KeepGet コマンド +CMD_KeepGet インターネット接続の維持機能の取得 +CMD_KeepGet_Help [インターネット接続の維持機能] の、現在の設定内容を取得します。通信先の [ホスト名]、[ポート番号]、[パケット送出間隔]、および [プロトコル] に加えて、現在の [インターネット接続の維持機能] の有効状態が取得できます。 +CMD_KeepGet_Args KeepGet +CMD_KeepGet_COLUMN_1 ホスト名 +CMD_KeepGet_COLUMN_2 ポート番号 +CMD_KeepGet_COLUMN_3 パケット送出間隔 (秒) +CMD_KeepGet_COLUMN_4 プロトコル +CMD_KeepGet_COLUMN_5 現在の状態 + + +# SyslogEnable コマンド +CMD_SyslogEnable syslog 送信機能の設定 +CMD_SyslogEnable_Help syslog 送信機能の使用方法と使用する syslog サーバーを設定します。 +CMD_SyslogEnable_Args SyslogEnable [1|2|3] [/HOST:host:port] +CMD_SyslogEnable_[1|2|3] syslog 送信機能使用設定を 1 ~ 3 のいずれかの整数で指定します。\n1: サーバーログを syslog で送信。\n2: サーバーおよび仮想 HUB セキュリティログを syslog で送信。\n3: サーバー、仮想 HUB セキュリティおよびパケットログを syslog で送信。 +CMD_SyslogEnable_HOST [ホスト名:ポート番号] の形式で、syslog サーバーのホスト名、または IP アドレスとポート番号を指定します。ポート番号を省略すると 514 を使用します。 +CMD_SyslogEnable_MINMAX syslog 送信機能使用設定は 1 ~ 3 のいずれかの整数を指定してください。 +CMD_SyslogEnable_Prompt_123 syslog 送信機能使用設定 (1 ~ 3): +CMD_SyslogEnable_Prompt_HOST syslog サーバーの指定: + + +# SyslogDisable コマンド +CMD_SyslogDisable syslog 送信機能の無効化 +CMD_SyslogDisable_Help syslog 送信機能を使用しないようにします。 +CMD_SyslogDisable_Args SyslogDisable + + +# SyslogGet コマンド +CMD_SyslogGet syslog 送信機能の取得 +CMD_SyslogGet_Help syslog 送信機能の現在の設定内容を取得します。syslog 機能の使用方法の設定、および使用する syslog サーバーのホスト名とポート番号が取得できます。 +CMD_SyslogGet_Args SyslogGet +CMD_SyslogGet_COLUMN_1 syslog 送信機能使用設定 +CMD_SyslogGet_COLUMN_2 syslog サーバーホスト名 +CMD_SyslogGet_COLUMN_3 syslog サーバーポート番号 + + +# ConnectionList コマンド +CMD_ConnectionList VPN Server に接続中の TCP コネクション一覧の取得 +CMD_ConnectionList_Help 現在、VPN Server に接続中の TCP/IP コネクションの一覧を取得します。ただし、VPN セッションとして確立された TCP/IP コネクションは表示されません。VPN セッションとして確立された TCP/IP コネクションの一覧は、SessionList コマンドを用いて取得できます。\n[コネクション名]、[接続元]、[接続時刻] および [種類] を取得することができます。\nこのコマンドを実行するには、VPN Server の管理者権限が必要です。 +CMD_ConnectionList_Args ConnectionList + + +# ConnectionGet コマンド +CMD_ConnectionGet VPN Server に接続中の TCP コネクションの情報の取得 +CMD_ConnectionGet_Help VPN Server に接続中の指定された TCP/IP コネクションに関する詳細な情報を取得します。\n[コネクション名]、[コネクションの種類]、[接続元ホスト名]、[接続元 IP アドレス]、[接続元ポート番号 (TCP)]、[接続時刻]、[サーバー製品名]、[サーバー バージョン]、[サーバー ビルド番号]、[クライアント製品名]、[クライアントバージョン]、[クライアントビルド番号] が取得できます。\nこのコマンドを実行するには、VPN Server の管理者権限が必要です。 +CMD_ConnectionGet_Args ConnectionGet [name] +CMD_ConnectionGet_[name] 情報を取得するコネクション名を指定します。コネクション名の一覧は、ConnectionList コマンドで取得できます。 +CMD_ConnectionGet_PROMPT_NAME 情報を取得するコネクション名: + +# ConnectionDisconnect コマンド +CMD_ConnectionDisconnect VPN Server に接続中の TCP コネクションの切断 +CMD_ConnectionDisconnect_Help VPN Server に接続中の指定された TCP/IP コネクションを強制的に切断します。\nこのコマンドを実行するには、VPN Server の管理者権限が必要です。 +CMD_ConnectionDisconnect_Args ConnectionDisconnect [name] +CMD_ConnectionDisconnect_[name] 切断するコネクション名を指定します。コネクション名の一覧は ConnectionList コマンドで取得できます。 +CMD_ConnectionDisconnect_PROMPT_NAME 切断するコネクション名: + + +# BridgeDeviceList コマンド +CMD_BridgeDeviceList ローカルブリッジに使用できる LAN カード一覧の取得 +CMD_BridgeDeviceList_Help ローカルブリッジ接続で、ブリッジ先のデバイスとして使用できる Ethernet デバイス (LAN カード) の一覧を取得します。\nここで表示されるデバイス名は、BridgeCreate コマンドで使用することができます。\nこのコマンドを実行するには、VPN Server の管理者権限が必要です。 +CMD_BridgeDeviceList_Args BridgeDeviceList + + +# BridgeList コマンド +CMD_BridgeList ローカルブリッジ接続の一覧の取得 +CMD_BridgeList_Help 現在定義されているローカルブリッジ接続の一覧を取得します。\nローカルブリッジ接続の仮想 HUB 名と、ブリッジ先の Ethernet デバイス (LAN カード) 名、または tap デバイス名および動作状況が取得できます。 +CMD_BridgeList_Args BridgeList + + +# BridgeCreate コマンド +CMD_BridgeCreate ローカルブリッジ接続の作成 +CMD_BridgeCreate_Help 新しいローカルブリッジ接続を VPN Server 上に作成します。\nローカルブリッジを使用すると、この VPN Server 上で動作する仮想 HUB と、物理的な Ethernet デバイス (LAN カード) との間でレイヤ 2 ブリッジ接続を構成することができます。\nシステムに tap デバイス (仮想のネットワークインターフェイス) を作成し、仮想 HUB との間でブリッジ接続することもできます (tap デバイスは Linux 版のみサポートされています)。\nブリッジ先の Ethernet デバイス (LAN カード) には、稼働中の任意の LAN カードとの間でブリッジできますが、高負荷環境においてはブリッジ専用に LAN カードを用意することをお勧めします。\nこのコマンドを実行するには、VPN Server の管理者権限が必要です。 +CMD_BridgeCreate_Args BridgeCreate [hubname] [/DEVICE:device_name] [/TAP:yes|no] +CMD_BridgeCreate_[hubname] ブリッジする仮想 HUB を指定します。仮想 HUB の一覧は、HubList コマンドで取得できます。ただし、必ずしも現在動作している仮想 HUB 名を指定する必要はありません。現在動作していない、または存在しない仮想 HUB 名を指定すると、その仮想 HUB が実際に動作を開始した際にローカルブリッジ接続が有効になります。 +CMD_BridgeCreate_DEVICE ブリッジ先の Ethernet デバイス (LAN カード) 名、または tap デバイス名を指定します。Ethernet デバイス名の一覧は、BridgeDeviceList コマンドで取得することができます。 +CMD_BridgeCreate_TAP ブリッジ先として LAN カードではなく、tap デバイスを使用する場合は yes を指定します (Linux 版のみサポートされます)。省略した場合は no と見なされます。 +CMD_BridgeCreate_PROMPT_HUBNAME ブリッジする仮想 HUB 名: +CMD_BridgeCreate_PROMPT_DEVICE ブリッジ先のデバイス名: +CMD_BridgeCreate_PROMPT_TAP tap デバイスを使用しますか (yes/no): + + +# BridgeDelete コマンド +CMD_BridgeDelete ローカルブリッジ接続の削除 +CMD_BridgeDelete_Help 既存のローカルブリッジ接続を削除します。現在のローカルブリッジ接続の一覧は、BridgeDeviceList コマンドで取得できます。\nこのコマンドを実行するには、VPN Server の管理者権限が必要です。 +CMD_BridgeDelete_Args BridgeDelete [hubname] [/DEVICE:device_name] +CMD_BridgeDelete_[hubname] 削除するローカルブリッジの、仮想 HUB を指定します。 +CMD_BridgeDelete_DEVICE 削除するローカルブリッジの、デバイス名 (LAN カード名または tap デバイス名) を指定します。 +CMD_BridgeDelete_PROMPT_HUBNAME 削除するブリッジの仮想 HUB 名: +CMD_BridgeDelete_PROMPT_DEVICE 削除するブリッジのデバイス名: + + +# Caps コマンド +CMD_Caps サーバーの機能・能力一覧の取得 +CMD_Caps_Help 現在接続して管理している VPN Server の持つ機能と能力の一覧を取得します。\nVPN Server の機能や能力は、動作している VPN Server のエディションやバージョンによって異なります。コマンドライン管理ユーティリティにあるコマンドでも、接続先の VPN Server の機能や能力によっては動作しない場合があります。このコマンドは、接続先の VPN Server の能力を調査して報告します。\nVPN Server のバージョンの方がコマンドライン管理ユーティリティよりも新しく、コマンドライン管理ユーティリティが把握していない機能がある場合は、その内部文字列 (変数名) が、そのまま表示されることがあります。 +CMD_Caps_Args Caps + + +# Reboot コマンド +CMD_Reboot VPN Server サービスの再起動 +CMD_Reboot_Help VPN Server サービスを再起動します。\nVPN Server を再起動すると、現在接続しているセッションや TCP コネクションはすべて切断され、再起動が完了するまで新たな接続は受け付けなくなります。\nこのコマンドでは、VPN Server サービスプログラムのみが再起動され、VPN Server が動作している物理的なコンピュータが再起動することはありません。この管理セッションも切断されるため、管理を続行するには再接続してください。\nまた、/RESETCONFIG:yes パラメータを指定すると、現在の VPN Server が持っているコンフィグレーションファイル (.config) の内容を初期化します。\nこのコマンドを実行するには、VPN Server の管理者権限が必要です。 +CMD_Reboot_Args Reboot [/RESETCONFIG:yes|no] +CMD_Reboot_RESETCONFIG yes を指定すると、現在の VPN Server が持っているコンフィグレーションファイル (.config) の内容を初期化します。このパラメータは慎重に設定してください。 + + +# ConfigGet コマンド +CMD_ConfigGet VPN Server の現在のコンフィグレーションの取得 +CMD_ConfigGet_Help VPN Server の、現在のコンフィグレーションの内容を構造化したテキストファイル (.config ファイル) として取得します。このコマンドを実行した瞬間の VPN Server 内の状態が取得できます。\nコンフィグレーションファイルの内容は、パラメータを指定しない場合は、画面上にそのまま表示されます。パラメータで保存するファイル名を指定すると、そのファイル名で内容が保存されます。\nコンフィグレーションファイルは、通常のテキストエディタ等で編集可能です。編集したコンフィグレーションを VPN Server に書き込むには、ConfigSet コマンドを使用します。\nこのコマンドを実行するには、VPN Server の管理者権限が必要です。 +CMD_ConfigGet_Args ConfigGet [path] +CMD_ConfigGet_[path] コンフィグレーションファイルの内容をファイルに保存したい場合は、そのファイル名を指定します。何も指定しない場合は、コンフィグレーションの内容は画面に表示されます。コンフィグレーションファイルにマルチバイト文字が含まれる場合は、Unicode (UTF-8) でエンコードされて保存されます。 +CMD_ConfigGet_FILENAME Config 名: "%S", サイズ: %u +CMD_ConfigGet_FILE_SAVE_FAILED 指定されたファイルの作成に失敗しました。 + + +# ConfigSet コマンド +CMD_ConfigSet VPN Server へのコンフィグレーションの書き込み +CMD_ConfigSet_Help VPN Server にコンフィグレーションを書き込みます。このコマンドを実行すると、指定したコンフィグレーションファイルの内容が VPN Server に適用され、VPN Server プログラムは自動的に再起動され、新しいコンフィグレーションの内容に従って動作を開始します。\nコンフィグレーションファイルは、すべての内容を管理者が記述するのは困難であるため、ConfigGet コマンドで、まず現在の VPN Server のコンフィグレーションの内容を取得してファイルに保存し、その内容を通常のテキストエディタなどで編集したものを ConfigSet コマンドで VPN Server に書き戻すことを推奨します。\nこのコマンドは、VPN Server に関する詳しい知識をお持ちの方のためのコマンドであり、不正なコンフィグレーションファイルを書き込んだ場合は、エラーが発生したり現在の設定内容が失われたりする可能性がありますので、十分注意してください。\nこのコマンドを実行するには、VPN Server の管理者権限が必要です。 +CMD_ConfigSet_Args ConfigSet [path] +CMD_ConfigSet_[path] 書き込むコンフィグレーションファイルのファイル名を指定します。書き込むファイルにマルチバイト文字が含まれている場合は、Unicode (UTF-8) でエンコードされている必要があります。 +CMD_ConfigSet_PROMPT_PATH サーバーにアップロードする Config ファイルのパス名: +CMD_ConfigSet_FILE_LOAD_FAILED 指定されたファイルの読み込みに失敗しました。 + + +# RouterList コマンド +CMD_RouterList 仮想レイヤ 3 スイッチ一覧の取得 +CMD_RouterList_Help VPN Server 上に定義されている仮想レイヤ 3 スイッチの一覧を取得します。仮想レイヤ 3 スイッチの [スイッチ名]、[動作状況]、[インターフェイス数]、[ルーティングテーブル数] が取得できます。\nこのコマンドを実行するには、VPN Server の管理者権限が必要です。\nまた、このコマンドは VPN Bridge では動作しません。 +CMD_RouterList_Args RouterList + + +# RouterAdd コマンド +CMD_RouterAdd 新しい仮想レイヤ 3 スイッチの定義 +CMD_RouterAdd_Help VPN Server 上に、新しい仮想レイヤ 3 スイッチを定義します。\nこのコマンドを実行するには、VPN Server の管理者権限が必要です。\nまた、このコマンドは VPN Bridge では動作しません。\n\n[仮想レイヤ 3 スイッチ機能についての説明]\nこの VPN Server 内で動作している複数の仮想 HUB 間で、仮想のレイヤ 3 スイッチを定義し、異なった IP ネットワーク間をルーティングすることができます。\n\n[仮想レイヤ 3 スイッチ機能に関するご注意]\n仮想レイヤ 3 スイッチ機能は、ネットワークおよび IP ルーティングに関する詳しい知識をお持ちの方やネットワーク管理者のための機能です。通常の VPN 機能を使用する場合は、仮想レイヤ 3 スイッチ機能を使用する必要はありません。\n仮想レイヤ 3 スイッチ機能を使用する場合は、IP ルーティングに関する十分な知識をお持ちの上で、ネットワークに与える影響を十分考慮してから設定してください。 +CMD_RouterAdd_Args RouterAdd [name] +CMD_RouterAdd_[name] 新しく作成する仮想レイヤ 3 スイッチの名前を指定します。既に存在する仮想レイヤ 3 スイッチと同一の名前を付けることはできません。 +CMD_RouterAdd_PROMPT_NAME 作成する仮想レイヤ 3 スイッチの名前: + + +# RouterDelete コマンド +CMD_RouterDelete 仮想レイヤ 3 スイッチの削除 +CMD_RouterDelete_Help VPN Server 上に定義されている、既存の仮想レイヤ 3 スイッチを削除します。指定した仮想レイヤ 3 スイッチが動作中の場合は、自動的に動作を停止してから削除を行ないます。\n既存の仮想レイヤ 3 スイッチの一覧を取得するには、RouterList コマンドを使用します。\nこのコマンドを実行するには、VPN Server の管理者権限が必要です。\nまた、このコマンドは VPN Bridge では動作しません。 +CMD_RouterDelete_Args RouterDelete [name] +CMD_RouterDelete_[name] 削除する仮想レイヤ 3 スイッチの名前を指定します。 +CMD_RouterDelete_PROMPT_NAME 削除する仮想レイヤ 3 スイッチの名前: + + +# RouterStart コマンド +CMD_RouterStart 仮想レイヤ 3 スイッチの動作の開始 +CMD_RouterStart_Help VPN Server 上に定義されている、既存の仮想レイヤ 3 スイッチの動作が停止している場合は、その動作を開始します。\n既存の仮想レイヤ 3 スイッチの一覧を取得するには、RouterList コマンドを使用します。\nこのコマンドを実行するには、VPN Server の管理者権限が必要です。\nまた、このコマンドは VPN Bridge では動作しません。\n\n[仮想レイヤ 3 スイッチ機能についての説明]\nこの VPN Server 内で動作している、複数の仮想 HUB 間で仮想のレイヤ 3 スイッチを定義し、異なった IP ネットワーク間をルーティングすることができます。\n\n[仮想レイヤ 3 スイッチ機能に関するご注意]\n仮想レイヤ 3 スイッチ機能は、ネットワークおよび IP ルーティングに関する詳しい知識をお持ちの方や、ネットワーク管理者のための機能です。通常の VPN 機能を使用する場合は、仮想レイヤ 3 スイッチ機能を使用する必要はありません。\n仮想レイヤ 3 スイッチ機能を使用する場合は、IP ルーティングに関する十分な知識をお持ちの上で、ネットワークに与える影響を十分考慮してから設定してください。 +CMD_RouterStart_Args RouterStart [name] +CMD_RouterStart_[name] 開始する仮想レイヤ 3 スイッチの名前を指定します。 +CMD_RouterStart_PROMPT_NAME 開始する仮想レイヤ 3 スイッチの名前: + + +# RouterStop コマンド +CMD_RouterStop 仮想レイヤ 3 スイッチの動作の停止 +CMD_RouterStop_Help VPN Server 上に定義されている、既存の仮想レイヤ 3 スイッチの動作が動作している場合は、その動作を停止します。\n既存の仮想レイヤ 3 スイッチの一覧を取得するには、RouterList コマンドを使用します。\nこのコマンドを実行するには、VPN Server の管理者権限が必要です。 +CMD_RouterStop_Args RouterStop [name] +CMD_RouterStop_[name] 停止する仮想レイヤ 3 スイッチの名前を指定します。 +CMD_RouterStop_PROMPT_NAME 停止する仮想レイヤ 3 スイッチの名前: + + +# RouterIfList コマンド +CMD_RouterIfList 仮想レイヤ 3 スイッチに登録されているインターフェイス一覧の取得 +CMD_RouterIfList_Help 指定した仮想レイヤ 3 スイッチに仮想インターフェイスが定義されている場合は、仮想インターフェイスの一覧を取得します。\n1 つの仮想レイヤ 3 スイッチには、複数個の仮想インターフェイスとルーティングテーブルを定義することができます。\n仮想インターフェイスは仮想 HUB に関連付けられ、仮想 HUB が動作しているときに、仮想 HUB 内で 1 台の IP ホストのように動作します。複数の仮想 HUB に対して、それぞれ別々の IP ネットワークに所属する仮想インターフェイスが定義されているとき、それらのインターフェイス間で IP ルーティングが自動的に行われます。\nこのコマンドを実行するには、VPN Server の管理者権限が必要です。\nまた、このコマンドは VPN Bridge では動作しません。 +CMD_RouterIfList_Args RouterIfList [name] +CMD_RouterIfList_[name] 仮想レイヤ 3 スイッチの名前を指定します。 +CMD_RouterIfList_PROMPT_NAME 仮想レイヤ 3 スイッチの名前: + + +# RouterIfAdd コマンド +CMD_RouterIfAdd 仮想レイヤ 3 スイッチへの仮想インターフェイスの追加 +CMD_RouterIfAdd_Help 指定した仮想レイヤ 3 スイッチに、同じ VPN Server 上で動作している仮想 HUB へ接続する仮想インターフェイスを追加します。\n1 つの仮想レイヤ 3 スイッチには、複数個の仮想インターフェイスとルーティングテーブルを定義することができます。\n仮想インターフェイスは仮想 HUB に関連付けられ、仮想 HUB が動作しているときに、仮想 HUB 内で 1 台の IP ホストのように動作します。複数の仮想 HUB に対して、それぞれ別々の IP ネットワークに所属する仮想インターフェイスが定義されているとき、それらのインターフェイス間で IP ルーティングが自動的に行われます。\n仮想インターフェイスが所属する IP ネットワーク空間と、インターフェイス自身の IP アドレスを定義する必要があります。\nまた、インターフェイスが接続する先の仮想 HUB 名を指定する必要があります。\n仮想 HUB 名には現在存在していない仮想 HUB を指定することもできます。\n仮想インターフェイスは、仮想 HUB 内で 1 つの IP アドレスを持つ必要があります。また、その IP アドレスの属する IP ネットワークのサブネットマスクを指定する必要もあります。\n複数の仮想 HUB 内の IP 空間同士の仮想レイヤ 3 スイッチを経由したルーティングは、ここで指定した IP アドレスに基づいて動作します。\nこのコマンドを実行するには、VPN Server の管理者権限が必要です。\nまた、このコマンドは VPN Bridge では動作しません。\nこのコマンドを実行するには、操作対象の仮想レイヤ 3 スイッチが停止している必要があります。もし停止していない場合は、RouterStop コマンドで停止させてからこのコマンドを実行してください。 +CMD_RouterIfAdd_Args RouterIfAdd [name] [/HUB:hub] [/IP:ip/mask] +CMD_RouterIfAdd_[name] 仮想レイヤ 3 スイッチの名前を指定します。 +CMD_RouterIfAdd_HUB 新しく追加する仮想インターフェイスの接続先の仮想 HUB 名を指定します。仮想 HUB の一覧は、HubList コマンドで取得できます。ただし、必ずしも現在動作している仮想 HUB 名を指定する必要はありません。現在動作していない、または存在しない仮想 HUB 名を指定すると、その仮想 HUB が実際に動作を開始した際に、仮想レイヤ 3 スイッチが有効になります。 +CMD_RouterIfAdd_IP [IP アドレス/サブネットマスク] の形式で、新しく追加する仮想インターフェイスの持つ IP アドレスと、サブネットマスクを指定します。IP アドレスは 192.168.0.1 のように、10 進数をドットで区切って指定します。サブネットマスクは 255.255.255.0 のように 10 進数をドットで区切って指定するか、24 のように先頭からのビット長を 10 進数で指定できます。 +CMD_RouterIfAdd_PROMPT_NAME 仮想レイヤ 3 スイッチの名前: +CMD_RouterIfAdd_PROMPT_HUB 仮想インターフェイスの接続先の仮想 HUB 名: +CMD_RouterIfAdd_PROMPT_IP IP アドレス/サブネットマスク: + + +# RouterIfDel コマンド +CMD_RouterIfDel 仮想レイヤ 3 スイッチの仮想インターフェイスの削除 +CMD_RouterIfDel_Help 指定した仮想レイヤ 3 スイッチ内に、すでに定義されている仮想インターフェイスを削除します。\n現在定義されている仮想インターフェイスの一覧は、RouterIfList コマンドで取得することができます。\nこのコマンドを実行するには、VPN Server の管理者権限が必要です。\nまた、このコマンドは VPN Bridge では動作しません。\nこのコマンドを実行するには、操作対象の仮想レイヤ 3 スイッチが停止している必要があります。もし停止していない場合は、RouterStop コマンドで停止させてからこのコマンドを実行してください。 +CMD_RouterIfDel_Args RouterIfDel [name] [/HUB:hub] +CMD_RouterIfDel_[name] 仮想レイヤ 3 スイッチの名前を指定します。 +CMD_RouterIfDel_HUB 削除する仮想インターフェイスの接続先の仮想 HUB 名を指定します。 + + +# RouterTableList コマンド +CMD_RouterTableList 仮想レイヤ 3 スイッチのルーティングテーブル一覧の取得 +CMD_RouterTableList_Help 指定した仮想レイヤ 3 スイッチに、ルーティングテーブルが定義されている場合は、ルーティングテーブルの一覧を取得します。\n仮想レイヤ 3 スイッチの IP ルーティングエンジンは、IP パケットの宛先 IP アドレスが、各仮想インターフェイスの所属する IP ネットワークのいずれにも所属しない場合は、このルーティングテーブルを参照してルーティングを行います。\nこのコマンドを実行するには、VPN Server の管理者権限が必要です。\nまた、このコマンドは VPN Bridge では動作しません。 +CMD_RouterTableList_Args RouterTableList [name] +CMD_RouterTableList_[name] 仮想レイヤ 3 スイッチの名前を指定します。 +CMD_RouterTableList_PROMPT_NAME 仮想レイヤ 3 スイッチの名前: + + +# RouterTableAdd コマンド +CMD_RouterTableAdd 仮想レイヤ 3 スイッチへのルーティングテーブルエントリの追加 +CMD_RouterTableAdd_Help 指定した仮想レイヤ 3 スイッチのルーティングテーブルに、新しいルーティングテーブルエントリを追加します。\n仮想レイヤ 3 スイッチの IP ルーティングエンジンは、IP パケットの宛先 IP アドレスが、各仮想インターフェイスの所属する IP ネットワークのいずれにも所属しない場合、ルーティングテーブルを参照してルーティングを行います。\n仮想レイヤ 3 スイッチに追加するルーティングテーブルのエントリの内容を指定する必要があります。ゲートウェイアドレスとしては、この仮想レイヤ 3 スイッチの仮想インターフェイスのうち、いずれかと同じ IP ネットワークに所属する IP アドレスを指定する必要があります。\nこのコマンドを実行するには、VPN Server の管理者権限が必要です。\nまた、このコマンドは VPN Bridge では動作しません。\nこのコマンドを実行するには、操作対象の仮想レイヤ 3 スイッチが停止している必要があります。もし停止していない場合は、RouterStop コマンドで停止させてからこのコマンドを実行してください。 +CMD_RouterTableAdd_Args RouterTableAdd [name] [/NETWORK:ip/mask] [/GATEWAY:gwip] [/METRIC:metric] +CMD_RouterTableAdd_[name] 仮想レイヤ 3 スイッチの名前を指定します。 +CMD_RouterTableAdd_NETWORK [IP アドレス/サブネットマスク] の形式で、新しく追加するルーティングテーブルエントリの、ネットワークアドレスとサブネットマスクを指定します。ネットワークアドレスは、192.168.0.1 のように 10 進数をドットで区切って指定します。サブネットマスクは、255.255.255.0 のように 10 進数をドットで区切って指定するか、24 のように先頭からのビット長を 10 進数で指定できます。0.0.0.0/0.0.0.0 を指定すると、デフォルトルートの意味になります。 +CMD_RouterTableAdd_GATEWAY ゲートウェイの IP アドレスを指定します。 +CMD_RouterTableAdd_METRIC メトリック値を指定します。1 以上の整数で指定してください。 +CMD_RouterTableAdd_PROMPT_NAME 仮想レイヤ 3 スイッチの名前: +CMD_RouterTableAdd_PROMPT_NETWORK ネットワークアドレス/サブネットマスク: +CMD_RouterTableAdd_PROMPT_GATEWAY ゲートウェイアドレス: +CMD_RouterTableAdd_PROMPT_METRIC メトリック値: + + +# RouterTableDel コマンド +CMD_RouterTableDel 仮想レイヤ 3 スイッチのルーティングテーブルエントリの削除 +CMD_RouterTableDel_Help 指定した仮想レイヤ 3 スイッチ内に定義されているルーティングテーブルのエントリを削除します。\nすでに定義されているルーティンクテーブルエントリの一覧は、RouterTableList コマンドで取得できます。\nこのコマンドを実行するには、VPN Server の管理者権限が必要です。\nまた、このコマンドは VPN Bridge では動作しません。\nこのコマンドを実行するには、操作対象の仮想レイヤ 3 スイッチが停止している必要があります。もし停止していない場合は、RouterStop コマンドで停止させてからこのコマンドを実行してください。 +CMD_RouterTableDel_Args RouterTableDel [name] [/NETWORK:ip/mask] [/GATEWAY:gwip] [/METRIC:metric] +CMD_RouterTableDel_[name] 仮想レイヤ 3 スイッチの名前を指定します。 +CMD_RouterTableDel_NETWORK [IP アドレス/サブネットマスク] の形式で、削除するルーティングテーブルエントリの、ネットワークアドレスを指定します。 +CMD_RouterTableDel_GATEWAY ゲートウェイの IP アドレスを指定します。 +CMD_RouterTableDel_METRIC メトリック値を指定します。1 以上の整数で指定してください。 + + +# LogFileList コマンド +CMD_LogFileList ログファイル一覧の取得 +CMD_LogFileList_Help VPN Server のコンピュータ上に保存されている、VPN Server が出力したログファイルの一覧を表示します。ここで表示されるログファイルのファイル名を指定して LogFileGet コマンドを呼び出すことにより、ログファイルの内容をダウンロードすることもできます。\nVPN Server にサーバー管理モードで接続している場合は、すべての仮想 HUB のパケットログ、セキュリティログ、および VPN Server のサーバー ログを表示またはダウンロードすることができます。\n仮想 HUB 管理モードで接続している場合は、管理対象の仮想 HUB のパケットログとセキュリティログのみを表示またはダウンロードすることができます。 +CMD_LogFileList_Args LogFileList +CMD_LogFileList_START ログファイル一覧を取得しています。これには、時間がかかる場合があります。しばらくお待ちください... +CMD_LogFileList_NUM_LOGS 全部で %u 個のログファイルがあります。 + + +# LogFileGet コマンド +CMD_LogFileGet ログファイルのダウンロード +CMD_LogFileGet_Help VPN Server のコンピュータ上に保存されているログファイルをダウンロードします。ログファイルをダウンロードするには、まず LogFileList コマンドでログファイルの一覧を表示してから、次に LogFileGet コマンドでダウンロードすることができます。VPN Server にサーバー管理モードで接続している場合は、すべての仮想 HUB のパケットログ、セキュリティログ、および VPN Server のサーバー ログを表示またはダウンロードすることができます。仮想 HUB 管理モードで接続している場合は、管理対象の仮想 HUB のパケットログと、セキュリティログのみを表示、またはダウンロードすることができます。\nパラメータとしてファイル名を指定した場合は、ダウンロードしたログファイルは、そのファイル名のファイルに保存されます。ファイル名を指定しなかった場合は、画面上に表示されます。\nログファイルのサイズは、巨大になる場合がありますので、注意してください。 +CMD_LogFileGet_Args LogFileGet [name] [/SERVER:server] [/SAVEPATH:savepath] +CMD_LogFileGet_[name] ダウンロードするログファイル名を指定します。LogFileList コマンドで、ダウンロードできるログファイル名の一覧を取得できます。 +CMD_LogFileGet_SERVER クラスタコントローラに対してダウンロード要求を行う場合は、ログファイルが保存されているサーバー名を指定します。LogFileGet コマンドで表示されるサーバーを指定してください。 +CMD_LogFileGet_SAVEPATH ダウンロードしたログファイルを保存する場合は、ファイル名を指定します。指定しない場合は、画面上に表示されます。 +CMD_LogFileGet_PROMPT_NAME ダウンロードするログファイル名: +CMD_LogFileGet_START ログファイルをダウンロードしています。これには、時間がかかる場合があります。しばらくお待ちください... +CMD_LogFileGet_FAILED ダウンロードに失敗しました。 +CMD_LogFileGet_SAVE_FAILED 指定されたファイルに書き込めません。 +CMD_LogFileGet_FILESIZE ログファイルのファイルサイズ: %u + + +# HubCreate コマンド +CMD_HubCreate 新しい仮想 HUB の作成 +CMD_HubCreate_Help VPN Server 上に新しい仮想 HUB を作成します。\n作成した仮想 HUB は、直ちに動作を開始します。\nVPN Server がクラスタ内で動作している場合は、このコマンドはクラスタコントローラに対してのみ有効です。また、新しい仮想 HUB は、ダイナミック仮想 HUB として動作します。HubSetStatic コマンドで、スタティック仮想 HUB に変更することもできます。すでに VPN Server 上に存在する仮想 HUB の一覧を取得するには、HubList コマンドを使用します。\nこのコマンドを実行するには、VPN Server の管理者権限が必要です。\nまた、このコマンドは VPN Bridge およびクラスタメンバサーバーとして動作している VPN Server では動作しません。\nなお、クラスタ上でクラスタコントローラに対して仮想 HUB の作成コマンドを発行する場合は、HubCreateStatic コマンドまたは HubCreateDynamic コマンドを使用してください (クラスタコントローラに対して HubCreate コマンドを使用すると HubCreateDynamic コマンドと同等に動作します)。 +CMD_HubCreate_Args HubCreate [name] [/PASSWORD:password] +CMD_HubCreate_[name] 作成する仮想 HUB の名前を指定します。 +CMD_HubCreate_PASSWORD 作成する仮想 HUB の管理パスワードを設定する場合は、その管理パスワードを指定します。指定しない場合は、入力するためのプロンプトが表示されます。 +CMD_HubCreate_PROMPT_NAME 作成する仮想 HUB の名前: + + +# HubCreateDynamic コマンド +CMD_HubCreateDynamic 新しいダイナミック仮想 HUB の作成 (クラスタリング用) +CMD_HubCreateDynamic_Help VPN Server 上に新しいダイナミック仮想 HUB を作成します。\n作成した仮想 HUB は、直ちに動作を開始します。\nVPN Server がクラスタ内で動作している場合は、このコマンドはクラスタコントローラに対してのみ有効です。また、新しい仮想 HUB は、ダイナミック仮想 HUB として動作します。HubSetStatic コマンドで、スタティック仮想 HUB に変更することもできます。すでに VPN Server 上に存在する仮想 HUB の一覧を取得するには、HubList コマンドを使用します。\nこのコマンドを実行するには、VPN Server の管理者権限が必要です。\nまた、このコマンドは VPN Bridge およびクラスタメンバサーバー、またはスタンドアロンサーバーとして動作している VPN Server では動作しません。 +CMD_HubCreateDynamic_Args HubCreateDynamic [name] [/PASSWORD:password] +CMD_HubCreateDynamic_[name] 作成する仮想 HUB の名前を指定します。 +CMD_HubCreateDynamic_PASSWORD 作成する仮想 HUB の管理パスワードを設定する場合は、その管理パスワードを指定します。指定しない場合は、入力するためのプロンプトが表示されます。 + + +# HubCreateStatic コマンド +CMD_HubCreateStatic 新しいスタティック仮想 HUB の作成 (クラスタリング用) +CMD_HubCreateStatic_Help VPN Server 上に新しいスタティック仮想 HUB を作成します。\n作成した仮想 HUB は、直ちに動作を開始します。\nVPN Server がクラスタ内で動作している場合は、このコマンドはクラスタコントローラに対してのみ有効です。また、新しい仮想 HUB は、ダイナミック仮想 HUB として動作します。HubSetStatic コマンドで、スタティック仮想 HUB に変更することもできます。すでに VPN Server 上に存在する仮想 HUB の一覧を取得するには、HubList コマンドを使用します。\nこのコマンドを実行するには、VPN Server の管理者権限が必要です。\nまた、このコマンドは VPN Bridge およびクラスタメンバサーバー、またはスタンドアロンサーバーとして動作している VPN Server では動作しません。 +CMD_HubCreateStatic_Args HubCreateStatic [name] [/PASSWORD:password] +CMD_HubCreateStatic_[name] 作成する仮想 HUB の名前を指定します。 +CMD_HubCreateStatic_PASSWORD 作成する仮想 HUB の管理パスワードを設定する場合は、その管理パスワードを指定します。指定しない場合は、入力するためのプロンプトが表示されます。 + + +# HubDelete コマンド +CMD_HubDelete 仮想 HUB の削除 +CMD_HubDelete_Help VPN Server 上の、既存の仮想 HUB を削除します。\n仮想 HUB を削除すると、現在仮想 HUB に接続しているセッションがすべて切断され、新たなセッションが仮想 HUB に接続できなくなります。\nまた、仮想 HUB のすべての設定、ユーザー オブジェクト、グループオブジェクト、証明書、およびカスケード接続が削除されます。\n仮想 HUB を削除すると、元に戻すことはできません。\nこのコマンドを実行するには、VPN Server の管理者権限が必要です。\nまた、このコマンドは VPN Bridge、およびクラスタメンバサーバーとして動作している VPN Server では動作しません。 +CMD_HubDelete_Args HubDelete [name] +CMD_HubDelete_[name] 削除する仮想 HUB の名前を指定します。 +CMD_HubDelete_PROMPT_NAME 削除する仮想 HUB の名前: + + +# HubSetStatic コマンド +CMD_HubSetStatic 仮想 HUB の種類をスタティック仮想 HUB に変更 +CMD_HubSetStatic_Help VPN Server がクラスタ内で動作している場合、仮想 HUB の種類を、スタティック仮想 HUB に設定します。仮想 HUB の種類を変更すると、現在仮想 HUB に接続しているすべてのセッションは一旦切断されます。\nスタティック仮想 HUB として動作している仮想 HUB がある場合、すべてのクラスタメンバサーバー上で、その名前の仮想 HUB が生成されます。その仮想 HUB に接続しようとしたユーザーは、各サーバーの負荷状況を元にしたアルゴリズムによって、その仮想 HUB をホスティングしている、いずれかのクラスタメンバに接続されます。\nスタティック仮想 HUB は、一例として、企業におけるインターネットから社内 LAN へのリモートアクセス用途において、同時に数千~数万単位の大量のユーザーが同時に接続する可能性があるリモートアクセス VPN 用に利用することが可能です。\nこのコマンドを実行するには、VPN Server の管理者権限が必要です。\nまた、このコマンドは VPN Bridge およびクラスタメンバサーバー、またはスタンドアロンサーバーとして動作している VPN Server では動作しません。\nこのコマンドはビルド 5190 より新しい VPN Server では使用できません。 +CMD_HubSetStatic_Args HubSetStatic [name] +CMD_HubSetStatic_[name] スタティック仮想 HUB に設定する仮想 HUB の名前を指定します。 +CMD_HubChange_PROMPT_NAME 設定を変更する仮想 HUB の名前: + + +# HubSetDynamic コマンド +CMD_HubSetDynamic 仮想 HUB の種類をダイナミック仮想 HUB に変更 +CMD_HubSetDynamic_Help VPN Server がクラスタ内で動作している場合、仮想 HUB の種類を、ダイナミック仮想 HUB に設定します。仮想 HUB の種類を変更すると、現在仮想 HUB に接続しているすべてのセッションは一旦切断されます。\nクラスタ内に定義されているダイナミック仮想 HUB にクライアントが 1 台も接続していないとき、その仮想 HUB はどのクラスタメンバ上にも存在しません。ダイナミック仮想 HUB に 1 台目のクライアントが接続しようとすると、クラスタ内で最も負荷の低いサーバーがその仮想 HUB をホスティングします。2 台目以降のクライアントがその仮想 HUB に接続しようとすると、仮想 HUB をホスティングしているサーバーに自動的に接続します。各ダイナミック仮想 HUB は、すべてのクライアントが切断すると、どのサーバーにも実体が存在しない状態に戻ります。\nダイナミック仮想 HUB の応用例は幅広く、たとえば社内において部課毎に仮想 HUB を定義しておき、各社員が自分が所属している部課の仮想 HUB に接続して作業を行うといったことを、単一のクラスタを設置するだけで、集中管理することができます。\nこのコマンドを実行するには、VPN Server の管理者権限が必要です。\nまた、このコマンドは VPN Bridge およびクラスタメンバサーバー、またはスタンドアロンサーバーとして動作している VPN Server では動作しません。\nこのコマンドはビルド 5190 より新しい VPN Server では使用できません。 +CMD_HubSetDynamic_Args HubSetDynamic [name] +CMD_HubSetDynamic_[name] ダイナミック仮想 HUB に設定する仮想 HUB の名前を指定します。 + + +# HubList コマンド +CMD_HubList 仮想 HUB の一覧の取得 +CMD_HubList_Help VPN Server 内の、既存の仮想 HUB の一覧を取得します。それぞれの仮想 HUB について、[仮想 HUB 名]、[状態]、[種類]、[ユーザー数]、[グループ数]、[セッション数]、[MAC テーブル数]、[IP テーブル数]、[ログイン回数]、[最終ログイン日時]、[最終通信日時] を取得できます。\nただし、仮想 HUB 管理モードで接続している場合は、管理権限のない仮想 HUB のオプションで、匿名ユーザーに対して仮想 HUB を列挙しないオプションが有効になっている場合、その仮想 HUB は列挙されません。サーバー管理モードで接続している場合は、すべての仮想 HUB の一覧が表示されます。\nクラスタリング環境におけるクラスタコントローラ以外のクラスタメンバに接続して管理している場合は、その VPN Server が、現在ホスティングしている仮想 HUB のみが表示されます。クラスタコントローラに接続して管理している場合は、すべての仮想 HUB が表示されます。 +CMD_HubList_Args HubList + + +# Hub コマンド +CMD_Hub 管理する仮想 HUB の選択 +CMD_Hub_Help 管理対象の仮想 HUB を選択します。VPN Server に接続した状態の管理ユーティリティでは、仮想 HUB に関する設定・管理を行なうコマンドを実行する前に、管理を行なう仮想 HUB を Hub コマンドで選択しておく必要があります。\nVPN Server に仮想 HUB 管理モードで接続している状態では、管理対象となっている 1 つの仮想 HUB を選択することができ、他の仮想 HUB を選択することはできません。VPN Server にサーバー管理モードで接続している状態では、すべての仮想 HUB の管理を行なうことができます。\n現在サーバー上に存在する仮想 HUB の一覧を取得するには、HubList コマンドを使用します。\nVPN Bridge では、"BRIDGE" という名前の仮想 HUB 以外を選択することはできません。 +CMD_Hub_Args Hub [name] +CMD_Hub_[name] 管理する仮想 HUB の名前を指定します。パラメータを指定していない場合は、管理対象の仮想 HUB の選択を解除します。 +CMD_Hub_Unselected 仮想 HUB の選択を解除しました。 +CMD_Hub_Selected 仮想 HUB "%S" を選択しました。 +CMD_Hub_Select_Failed /ADMINHUB で指定された仮想 HUB "%S" を選択しようとして、下記のエラーが発生しました。 +CMD_Hub_Not_Selected このコマンドを実行する前に、Hub コマンドで管理対象の仮想 HUB を選択してください。 + + +# Online コマンド +CMD_Online 仮想 HUB をオンラインにする +CMD_Online_Help 現在管理している仮想 HUB がオフラインになっている場合は、オンラインにします。オフライン状態の仮想 HUB は、クライアントからの VPN 接続を受け付けません。仮想 HUB をオンライン化することによって、その仮想 HUB はユーザーからの接続を受け付けたり、サービスを提供したりするようになります。\nこのコマンドは、VPN Bridge では実行できません。\nこのコマンドは、クラスタとして動作している VPN Server の仮想 HUB では実行できません。 +CMD_Online_Args Online + + +# Offline コマンド +CMD_Offline 仮想 HUB をオフラインにする +CMD_Offline_Help 現在管理している仮想 HUB がオンラインになっている場合は、オフラインにします。仮想 HUB に接続中のセッションがある場合は、すべて切断されます。オフライン状態の仮想 HUB は、クライアントからの VPN 接続を受け付けません。\nこのコマンドは、VPN Bridge では実行できません。\nこのコマンドは、クラスタとして動作している VPN Server の仮想 HUB では実行できません。 +CMD_Offline_Args Offline + + +# SetMaxSession コマンド +CMD_SetMaxSession 仮想 HUB の最大同時接続セッション数を設定する +CMD_SetMaxSession_Help 現在管理している仮想 HUB の、最大同時接続セッション数を設定します。最大同時接続セッション数を越えたセッションが、VPN Client や VPN Bridge から接続された場合、最大同時接続セッション数を上回った時点で、それ以上クライアントは接続できなくなります。この最大同時接続セッション数の制限には、ローカルブリッジ、仮想 NAT、カスケード接続などによって仮想 HUB 内に生成されるセッションは含まれません。\n現在の最大同時接続セッション数の設定は、OptionsGet コマンドによって取得することができます。\nこのコマンドは、VPN Bridge では実行できません。\nこのコマンドは、クラスタとして動作している VPN Server の仮想 HUB では実行できません。 +CMD_SetMaxSession_Args SetMaxSession [max_session] +CMD_SetMaxSession_[max_session] 設定する最大同時接続セッション数を、整数で指定します。0 を指定すると、無制限になります。 +CMD_SetMaxSession_Prompt 最大同時接続セッション数: + + +# SetHubPassword コマンド +CMD_SetHubPassword 仮想 HUB の管理パスワードを設定する +CMD_SetHubPassword_Help 現在管理している仮想 HUB の、管理パスワードを設定します。仮想 HUB の管理パスワードが設定されている場合、その仮想 HUB に対して、VPN Server の接続ユーティリティから、仮想 HUB 管理モードでパスワードを指定して接続することができます。また、VPN Client や VPN Bridge などから、ユーザー名を "Administrator"、パスワードを仮想 HUB の管理者パスワードに指定して VPN 接続することも可能になります。\nこのコマンドは、VPN Bridge では実行できません。\nこのコマンドは、クラスタとして動作している VPN Server の仮想 HUB では実行できません。 +CMD_SetHubPassword_Args SetHubPassword [password] +CMD_SetHubPassword_[password] 設定するパスワードを指定します。パラメータでパスワードを指定しない場合は、パスワードを入力するプロンプトが表示されます。 + + +# SetEnumAllow コマンド +CMD_SetEnumAllow 仮想 HUB の匿名ユーザーへの列挙の許可設定 +CMD_SetEnumAllow_Help 現在管理している仮想 HUB のオプション設定を変更し、匿名ユーザーに対して、この仮想 HUB を列挙するように設定します。このオプションを設定すると、VPN Client のユーザーは、この VPN Server のアドレスを入力するだけでこの仮想 HUB を列挙することが可能です。また、SetEnumDeny コマンドを使用すると、匿名ユーザーへの列挙を禁止することができます。仮想 HUB は、作成された時点では列挙が許可されています。\nこのコマンドは、VPN Bridge では実行できません。\nこのコマンドは、クラスタとして動作している VPN Server の仮想 HUB では実行できません。 +CMD_SetEnumAllow_Args SetEnumAllow + + +# SetEnumDeny コマンド +CMD_SetEnumDeny 仮想 HUB の匿名ユーザーへの列挙の禁止設定 +CMD_SetEnumDeny_Help 現在管理している仮想 HUB のオプション設定を変更し、匿名ユーザーに対して、この仮想 HUB を列挙しないように設定します。このオプションを設定すると、VPN Client のユーザーが、VPN Server に対して仮想 HUB の列挙を要求した場合でも、この仮想 HUB は列挙されないようになります。また、SetEnumAllow コマンドを使用すると、匿名ユーザーへの列挙を許可することができます。\nこのコマンドは、VPN Bridge では実行できません。\nこのコマンドは、クラスタとして動作している VPN Server の仮想 HUB では実行できません。 +CMD_SetEnumDeny_Args SetEnumDeny + + +# OptionsGet コマンド +CMD_OptionsGet 仮想 HUB のオプション設定の取得 +CMD_OptionsGet_Help 現在管理している仮想 HUB のオプション設定の一覧を取得します。仮想 HUB の列挙の許可 / 禁止の設定、最大同時接続数、オンライン / オフライン状態、およびクラスタリング環境における仮想 HUB の種類を取得することができます。\nこのコマンドは、クラスタとして動作している VPN Server の仮想 HUB では実行できません。 +CMD_OptionsGet_Args OptionsGet +CMD_OptionsGet_TITLE 仮想 HUB "%S" のオプション設定一覧 +CMD_OptionsGet_ENUM 匿名ユーザーに対する仮想 HUB の列挙 +CMD_OptionsGet_MAXSESSIONS 最大同時接続セッション数 +CMD_OptionsGet_STATUS 状態 +CMD_OptionsGet_TYPE 仮想 HUB の種類 + + + +# RadiusServerSet コマンド +CMD_RadiusServerSet ユーザー認証に使用する RADIUS サーバーの設定 +CMD_RadiusServerSet_Help 現在管理している仮想 HUB に、ユーザーが RADIUS サーバー認証モードで接続した場合に、ユーザー名とパスワードを確認するための外部の RADIUS サーバーを指定します。\nRadius サーバーは、この VPN Server の IP アドレスからの要求を受け付けるように設定しておく必要があります。また、Password Authentication Protocol (PAP) による認証が有効になっている必要があります。\nこのコマンドは、VPN Bridge では実行できません。\nこのコマンドは、クラスタとして動作している VPN Server の仮想 HUB では実行できません。 +CMD_RadiusServerSet_Args RadiusServerSet [server_name:port] [/SECRET:secret] [/RETRY_INTERVAL:interval] +CMD_RadiusServerSet_[server_name:port] [ホスト名:ポート番号] の形式で、使用する RADIUS サーバーのホスト名、または IP アドレスと UDP ポート番号を指定します。ポート番号を省略した場合は、1812 が使用されます。 +CMD_RadiusServerSet_SECRET RADIUS サーバーとの間での通信に使用する共有シークレット (パスワード) を指定します。 +CMD_RadiusServerSet_RETRY_INTERVAL RADIUS サーバーとの間での通信に使用する再試行間隔をミリ秒単位で指定します。 +CMD_RadiusServerSet_Prompt_Host 使用する RADIUS サーバーのホスト名とポート番号: +CMD_RadiusServerSet_Prompt_Secret 共有シークレット: +CMD_RadiusServerSet_Prompt_RetryInterval 再試行間隔 (ミリ秒単位): +CMD_RadiusServerSet_EVAL_NUMINTERVAL 再試行間隔は 500 から 10000 ミリ秒の範囲で指定してください。 + +# RadiusServerDelete コマンド +CMD_RadiusServerDelete ユーザー認証に使用する RADIUS サーバー設定の削除 +CMD_RadiusServerDelete_Help 現在管理している仮想 HUB にユーザーが RADIUS サーバー認証モードで接続した場合に使用する RADIUS サーバーに関する設定を削除し、RADIUS 認証を使用できないようにします。現在の RADIUS サーバーに関する設定は、RadiusServerGet コマンドで取得することができます。\nこのコマンドは、VPN Bridge では実行できません。\nこのコマンドは、クラスタとして動作している VPN Server の仮想 HUB では実行できません。 +CMD_RadiusServerDelete_Args RadiusServerDelete + + +# RadiusServerGet コマンド +CMD_RadiusServerGet ユーザー認証に使用する RADIUS サーバー設定の取得 +CMD_RadiusServerGet_Help 現在管理している仮想 HUB に、ユーザーが RADIUS サーバー認証モードで接続した場合に使用する RADIUS サーバーについての現在の設定を取得します。\nこのコマンドは、VPN Bridge では実行できません。\nこのコマンドは、クラスタとして動作している VPN Server の仮想 HUB では実行できません。 +CMD_RadiusServerGet_Args RadiusServerGet +CMD_RadiusServerGet_STATUS RADIUS サーバーの使用 +CMD_RadiusServerGet_HOST RADIUS サーバーのホスト名または IP アドレス +CMD_RadiusServerGet_PORT RADIUS サーバーのポート番号 +CMD_RadiusServerGet_SECRET 共有シークレット +CMD_RadiusServerGet_RetryInterval 再試行間隔 (ミリ秒単位) + + +# StatusGet コマンド +CMD_StatusGet 仮想 HUB の現在の状況の取得 +CMD_StatusGet_Help 現在管理している仮想 HUB の、現在の状況を取得します。仮想 HUB の種類やセッション数、各種オブジェクト数、ログイン回数、最終ログイン日時と最終通信日時、通信の統計データを取得することができます。 +CMD_StatusGet_Args StatusGet + + +# LogGet コマンド +CMD_LogGet 仮想 HUB のログ保存設定の取得 +CMD_LogGet_Help 現在管理している仮想 HUB の、ログ保存設定を取得します。セキュリティログとパケットログに関する保存設定や、保存対象などの設定情報が取得できます。 +CMD_LogGet_Args LogGet +CMD_Log_SecurityLog セキュリティログの保存 +CMD_Log_PacketLog パケットログの保存 +CMD_Log_SwitchType ログファイルの切り替え周期 +CMD_Log_0 TCP コネクションログ +CMD_Log_1 TCP パケットログ +CMD_Log_2 DHCP ログ +CMD_Log_3 UDP ログ +CMD_Log_4 ICMP ログ +CMD_Log_5 IP ログ +CMD_Log_6 ARP ログ +CMD_Log_7 Ethernet ログ + + +# LogEnable コマンド +CMD_LogEnable セキュリティログまたはパケットログの有効化 +CMD_LogEnable_Help 現在管理している仮想 HUB の、セキュリティログまたはパケットログを有効化します。\n現在の設定は、LogGet コマンドで取得することができます。 +CMD_LogEnable_Args LogEnable [security|packet] +CMD_LogEnable_[security|packet] 有効化するログの種類を選択します。"security" または "packet" のいずれかを指定します。 +CMD_LogEnable_Prompt security または packet を選択: +CMD_LogEnable_Prompt_Error 指定が不正です。 + + +# LogDisable コマンド +CMD_LogDisable セキュリティログまたはパケットログの無効化 +CMD_LogDisable_Help 現在管理している仮想 HUB の、セキュリティログまたはパケットログを無効化します。\n現在の設定は、LogGet コマンドで取得することができます。 +CMD_LogDisable_Args LogDisable [security|packet] +CMD_LogDisable_[security|packet] 無効化するログの種類を選択します。"security" または "packet" のいずれかを指定します。 + + +# LogSwitchSet コマンド +CMD_LogSwitchSet ログファイルの切り替え周期の設定 +CMD_LogSwitchSet_Help 現在管理している仮想 HUB が保存する、セキュリティログまたはパケットログのログファイルの切り替え周期を設定します。ログファイルの切り替え周期は、1 秒単位、1 分単位、1 時間単位、1 日単位、1 ヶ月単位、または切り替えを行わないように変更することができます。\n現在の設定は、LogGet コマンドで取得することができます。 +CMD_LogSwitchSet_Args LogSwitchSet [security|packet] [/SWITCH:sec|min|hour|day|month|none] +CMD_LogSwitchSet_[security|packet] 設定を変更するログの種類を選択します。"security" または "packet" のいずれかを指定します。 +CMD_LogSwitchSet_SWITCH 設定する切り替え周期を選択します。sec、min、hour、day、month、none から指定します。 +CMD_LogSwitchSet_Prompt sec, min, hour, day, month, none を指定: + + +# LogPacketSaveType コマンド +CMD_LogPacketSaveType パケットログに保存するパケットの種類と保存内容の設定 +CMD_LogPacketSaveType_Help 現在管理している仮想 HUB で保存する、パケットログの保存内容を、パケットの種類ごとに設定します。パケットの種類には、[TCP コネクションログ]、[TCP パケットログ]、[DHCP パケットログ]、[UDP パケットログ]、[ICMP パケットログ]、[IP パケットログ]、[ARP パケットログ]、[Ethernet パケットログ] があります。\n現在の設定は、LogGet コマンドで取得することができます。 +CMD_LogPacketSaveType_Args LogPacketSaveType [/TYPE:tcpconn|tcpdata|dhcp|udp|icmp|ip|arp|ether] [/SAVE:none|header|full] +CMD_LogPacketSaveType_TYPE 保存内容の変更対称のパケットの種類を、tcpconn、tcpdata、dhcp、udp、icmp、ip、arp、ether の中から指定します。 +CMD_LogPacketSaveType_SAVE パケットログの保存内容を指定します。\nnone : 保存無し\nheader: ヘッダ情報のみ\nfull : パケット内容すべて\nのいずれかを指定します。 +CMD_LogPacketSaveType_Prompt_TYPE tcpconn, tcpdata, dhcp, udp, icmp, ip, arp, ether を指定: +CMD_LogPacketSaveType_Prompt_SAVE none, header, full を指定: + + +# CAList コマンド +CMD_CAList 信頼する証明機関の証明書一覧の取得 +CMD_CAList_Help 現在管理している仮想 HUB が信頼する証明機関の証明書を管理します。登録されている証明機関の証明書一覧は、VPN Client が署名済み証明書認証モードで接続してきた際の証明書の検証に使用されます。\nこのコマンドは、VPN Bridge では実行できません。\nこのコマンドは、クラスタ内でクラスタメンバサーバーとして動作している VPN Server の仮想 HUB では実行できません。 +CMD_CAList_Args CAList +CMD_CAList_COLUMN_ID ID + + +# CAAdd コマンド +CMD_CAAdd 信頼する証明機関の証明書の追加 +CMD_CAAdd_Help 現在管理している仮想 HUB が信頼する証明機関の証明書一覧に、新しい証明書を追加します。登録されている証明機関の証明書一覧は、VPN Client が、署名済み証明書認証モードで接続してきた際の証明書の検証に使用されます。\n現在の証明書一覧を取得するには、CAList コマンドを使用します。\n証明書を追加するには、その証明書が X.509 形式のファイルとして保存されている必要があります。\nこのコマンドは、VPN Bridge では実行できません。\nこのコマンドは、クラスタ内でクラスタメンバサーバーとして動作している VPN Server の仮想 HUB では実行できません。 +CMD_CAAdd_Args CAAdd [path] +CMD_CAAdd_[path] 登録する X.509 証明書ファイル名を指定します。 +CMD_CAAdd_PROMPT_PATH 登録する X.509 証明書ファイル名: + + +# CADelete コマンド +CMD_CADelete 信頼する証明機関の証明書の削除 +CMD_CADelete_Help 現在管理している仮想 HUB が信頼する証明機関の証明書一覧から、既存の証明書を削除します。\n現在の証明書一覧を取得するには、CAList コマンドを使用します。\nこのコマンドは、VPN Bridge では実行できません。\nこのコマンドは、クラスタ内でクラスタメンバサーバーとして動作している VPN Server の仮想 HUB では実行できません。 +CMD_CADelete_Args CADelete [id] +CMD_CADelete_[id] 削除する証明書の ID を指定します。 +CMD_CADelete_PROMPT_ID 削除する証明書の ID: + + +# CAGet コマンド +CMD_CAGet 信頼する証明機関の証明書の取得 +CMD_CAGet_Help 現在管理している仮想 HUB が信頼する証明機関の証明書一覧内の既存の証明書を取得し、X.509 形式のファイルとして保存します。\nこのコマンドは、VPN Bridge では実行できません。\nこのコマンドは、クラスタ内でクラスタメンバサーバーとして動作している VPN Server の仮想 HUB では実行できません。 +CMD_CAGet_Args CAGet [id] [/SAVECERT:path] +CMD_CAGet_[id] 取得する証明書の ID を指定します。 +CMD_CAGet_SAVECERT 取得した証明書を保存するファイル名を指定します。 +CMD_CAGet_PROMPT_ID 取得する証明書の ID: +CMD_CAGet_PROMPT_SAVECERT 保存するファイル名: + + +# CascadeList コマンド +CMD_CascadeList カスケード接続一覧の取得 +CMD_CascadeList_Help 現在管理している仮想 HUB に登録されているカスケード接続の一覧を取得します。\nカスケード接続を使用すると、この仮想 HUB を同一または別のコンピュータ上で動作している他の仮想 HUB に、レイヤ 2 カスケード接続することができます。\n\n[カスケード接続における警告]\nカスケード接続を使用すると、複数の仮想 HUB 間でのレイヤ 2 ブリッジが可能ですが、接続方法を間違えると、ループ状のカスケード接続を作成してしまう場合があります。カスケード接続機能を使用する際には、慎重にネットワークトポロジを設計してください。\nこのコマンドは、クラスタとして動作している VPN Server の仮想 HUB では実行できません。 +CMD_CascadeList_Args CascadeList + + +# CascadeCreate コマンド +CMD_CascadeCreate 新しいカスケード接続の作成 +CMD_CascadeCreate_Help 現在管理している仮想 HUB に、新しいカスケード接続を作成します。\nカスケード接続を使用すると、この仮想 HUB を同一または別のコンピュータ上で動作している他の仮想 HUB にカスケード接続することができます。\nカスケード接続を作成するには、初期パラメータとして、カスケード接続の名前と接続先のサーバーおよび接続先の仮想 HUB、ユーザー名を指定する必要があります。新しいカスケード接続を作成した場合、ユーザー認証の種類は [匿名認証] に初期設定され、プロキシサーバーの設定とサーバー証明書の検証オプションは設定されません。これらの設定やその他の詳細設定を変更するには、カスケード接続を作成した後に "Cascade" という名前で始まる他のコマンドを使用します。\n\n[カスケード接続における警告]\nカスケード接続を使用すると、複数の仮想 HUB 間でのレイヤ 2 ブリッジが可能ですが、接続方法を間違えると、ループ状のカスケード接続を作成してしまう場合があります。カスケード接続機能を使用する際には、慎重にネットワークトポロジを設計してください。\n\nこのコマンドは、クラスタとして動作している VPN Server の仮想 HUB では実行できません。 +CMD_CascadeCreate_Args CascadeCreate [name] [/SERVER:hostname:port] [/HUB:hubname] [/USERNAME:username] +CMD_CascadeCreate_[name] 作成するカスケード接続の名前を指定します。 +CMD_CascadeCreate_SERVER [ホスト名:ポート番号] の形式で、接続先の VPN Server のホスト名とポート番号を指定します。IP アドレスで指定することもできます。 +CMD_CascadeCreate_HUB 接続先の VPN Server 内の仮想 HUB を指定します。 +CMD_CascadeCreate_USERNAME 接続先の VPN Server に接続する際のユーザー認証で使用するユーザー名を指定します。 +CMD_CascadeCreate_Prompt_Name カスケード接続の名前: +CMD_CascadeCreate_Prompt_Server 接続先 VPN Server のホスト名とポート番号: +CMD_CascadeCreate_Prompt_Hub 接続先仮想 HUB 名: +CMD_CascadeCreate_Prompt_Username 接続するユーザー名: + + +# CascadeSet コマンド +CMD_CascadeSet カスケード接続の接続先の設定 +CMD_CascadeSet_Help 現在管理している仮想 HUB に登録されているカスケード接続の、接続先の VPN Server のホスト名とポート番号、仮想 HUB 名、および接続に使用するユーザー名を設定します。\nこのコマンドは、クラスタとして動作している VPN Server の仮想 HUB では実行できません。 +CMD_CascadeSet_Args CascadeSet [name] [/SERVER:hostname:port] [/HUB:hubname] +CMD_CascadeSet_[name] 設定を変更するカスケード接続の名前を指定します。 +CMD_CascadeSet_SERVER [ホスト名:ポート番号] の形式で、接続先の VPN Server のホスト名とポート番号を指定します。IP アドレスで指定することもできます。 +CMD_CascadeSet_HUB 接続先の VPN Server 内の仮想 HUB を指定します。 + + +# CascadeGet コマンド +CMD_CascadeGet カスケード接続の設定の取得 +CMD_CascadeGet_Help 現在管理している仮想 HUB に登録されているカスケード接続の接続設定内容を取得します。\nなお、カスケード接続の接続設定内容を変更するには、カスケード接続を作成した後に "Cascade" という名前で始まる、他のコマンドを使用します。\nこのコマンドは、クラスタとして動作している VPN Server の仮想 HUB では実行できません。 +CMD_CascadeGet_Args CascadeGet [name] +CMD_CascadeGet_[name] 設定を取得するカスケード接続の名前を指定します。 +CMD_CascadeGet_Policy [カスケードセッションのセキュリティポリシー設定値] + +# CascadeDelete コマンド +CMD_CascadeDelete カスケード接続の削除 +CMD_CascadeDelete_Help 現在管理している仮想 HUB に登録されているカスケード接続を削除します。指定されたカスケード接続がオンライン状態である場合は、自動的に接続を切断してから削除します。\nこのコマンドは、クラスタとして動作している VPN Server の仮想 HUB では実行できません。 +CMD_CascadeDelete_Args CascadeDelete [name] +CMD_CascadeDelete_[name] 削除するカスケード接続の名前を指定します。 + + +# CascadeUsernameSet コマンド +CMD_CascadeUsernameSet カスケード接続の接続に使用するユーザー名の設定 +CMD_CascadeUsernameSet_Help 現在管理している仮想 HUB に登録されているカスケード接続を指定し、そのカスケード接続が VPN Server に接続する際の、ユーザー認証に必要なユーザー名を指定します。\nなお、ユーザー認証の種類を指定したり、必要なパラメータを指定したりする必要がある場合があります。これらの情報を変更するには、CascadeAnonymousSet、CascadePasswordSet、CascadeCertSet などのコマンドを使用します。\nこのコマンドは、クラスタとして動作している VPN Server の仮想 HUB では実行できません。 +CMD_CascadeUsernameSet_Args CascadeUsernameSet [name] [/USERNAME:username] +CMD_CascadeUsernameSet_[name] 設定を変更するカスケード接続の名前を指定します。 +CMD_CascadeUsernameSet_USERNAME カスケード接続が VPN Server に接続する際の、ユーザー認証に必要なユーザー名を指定します。 +CMD_CascadeUsername_Notice この接続設定の認証方法は、現在パスワード認証に設定されています。ユーザー名を変更した後、CascadePasswordSet コマンドでパスワードを設定し直す必要があります。 + + +# CascadeAnonymousSet コマンド +CMD_CascadeAnonymousSet カスケード接続のユーザー認証の種類を匿名認証に設定 +CMD_CascadeAnonymousSet_Help 現在管理している仮想 HUB に登録されているカスケード接続を指定し、そのカスケード接続が VPN Server に接続する際の、ユーザー認証の方法を [匿名認証] に設定します。\nこのコマンドは、クラスタとして動作している VPN Server の仮想 HUB では実行できません。 +CMD_CascadeAnonymousSet_Args CascadeAnonymousSet [name] +CMD_CascadeAnonymousSet_[name] 設定を変更するカスケード接続の名前を指定します。 + + +# CascadePasswordSet コマンド +CMD_CascadePasswordSet カスケード接続のユーザー認証の種類をパスワード認証に設定 +CMD_CascadePasswordSet_Help 現在管理している仮想 HUB に登録されているカスケード接続を指定し、そのカスケード接続が VPN Server に接続する際のユーザー認証の方法を [パスワード認証] に設定します。パスワード認証の種類には、[標準パスワード認証] と [RADIUS または NT ドメイン認証] を指定します。\nこのコマンドは、クラスタとして動作している VPN Server の仮想 HUB では実行できません。 +CMD_CascadePasswordSet_Args CascadePasswordSet [name] [/PASSWORD:password] [/TYPE:standard|radius] +CMD_CascadePasswordSet_[name] 設定を変更するカスケード接続の名前を指定します。 +CMD_CascadePasswordSet_PASSWORD パスワード認証で使用するパスワードを指定します。指定しない場合は、パスワードを入力するためのプロンプトが表示されます。 +CMD_CascadePasswordSet_TYPE パスワード認証の種類として、"standard" (標準パスワード認証)、または "radius" (RADIUS または NT ドメイン認証) のどちらかを指定します。 +CMD_CascadePasswordSet_Prompt_Type standard または radius の指定: +CMD_CascadePasswordSet_Type_Invalid standard または radius の指定が不正です。 + + +# CascadeCertSet コマンド +CMD_CascadeCertSet カスケード接続のユーザー認証の種類をクライアント証明書認証に設定 +CMD_CascadeCertSet_Help 現在管理している仮想 HUB に登録されているカスケード接続を指定し、そのカスケード接続が VPN Server に接続する際のユーザー認証の方法を [クライアント証明書認証] に設定します。証明書としては、X.509 形式の証明書ファイルと、Base 64 でエンコードされた対応した秘密鍵ファイルを指定する必要があります。\nこのコマンドは、クラスタとして動作している VPN Server の仮想 HUB では実行できません。 +CMD_CascadeCertSet_Args CascadeCertSet [name] [/LOADCERT:cert] [/LOADKEY:key] +CMD_CascadeCertSet_[name] 設定を変更するカスケード接続の名前を指定します。 +CMD_CascadeCertSet_LOADCERT 証明書認証で提示する X.509 形式の証明書ファイル名を指定します。 +CMD_CascadeCertSet_LOADKEY 証明書に対応した Base 64 形式でエンコードされた秘密鍵ファイル名を指定します。 + + +# CascadeCertGet コマンド +CMD_CascadeCertGet カスケード接続に用いるクライアント証明書の取得 +CMD_CascadeCertGet_Help 現在管理している仮想 HUB に登録されているカスケード接続を指定し、そのカスケード接続がクライアント証明書認証を使用する場合は、クライアント証明書として提示する証明書を取得して、証明書ファイルを X.509 形式で保存します。\nこのコマンドは、クラスタとして動作している VPN Server の仮想 HUB では実行できません。 +CMD_CascadeCertGet_Args CascadeCertGet [name] [/SAVECERT:cert] +CMD_CascadeCertGet_[name] 設定を取得するカスケード接続の名前を指定します。 +CMD_CascadeCertGet_SAVECERT 取得した証明書を X.509 形式で保存するファイル名を指定します。 +CMD_CascadeCertSet_Not_Auth_Cert 指定したカスケード接続はクライアント証明書認証モードではありません。 +CMD_CascadeCertSet_Cert_Not_Exists 指定したカスケード接続の接続設定に証明書が格納されていません。 + + +# CascadeEncryptEnable コマンド +CMD_CascadeEncryptEnable カスケード接続の通信時の暗号化の有効化 +CMD_CascadeEncryptEnable_Help 現在管理している仮想 HUB に登録されているカスケード接続を指定し、そのカスケード接続が VPN Server との間で VPN 接続を行なって通信をする際に、VPN Server との間の通信内容を SSL で暗号化するように設定します。\n通常は、VPN Server との間の通信を SSL で暗号化して、情報の盗聴や改ざんを防止します。暗号化を無効にすることもできます。暗号化を無効にすると、通信のスループットが向上しますが、通信データは平文でネットワーク上を流れます。\nこのコマンドは、クラスタとして動作している VPN Server の仮想 HUB では実行できません。 +CMD_CascadeEncryptEnable_Args CascadeEncryptEnable [name] +CMD_CascadeEncryptEnable_[name] 設定を変更するカスケード接続の名前を指定します。 + + +# CascadeEncryptDisable コマンド +CMD_CascadeEncryptDisable カスケード接続の通信時の暗号化の無効化 +CMD_CascadeEncryptDisable_Help 現在管理している仮想 HUB に登録されているカスケード接続を指定し、そのカスケード接続が VPN Server との間で VPN 接続を行なって通信をする際に VPN Server との間の通信内容を暗号化しないように設定します。\n通常は、VPN Server との間の通信を SSL で暗号化して、情報の盗聴や改ざんを防止します。暗号化を無効にすることもできます。暗号化を無効にすると、通信のスループットが向上しますが、通信データは平文でネットワーク上を流れます。\nこのコマンドは、クラスタとして動作している VPN Server の仮想 HUB では実行できません。 +CMD_CascadeEncryptDisable_Args CascadeEncryptDisable [name] +CMD_CascadeEncryptDisable_[name] 設定を変更するカスケード接続の名前を指定します。 + + +# CascadeCompressEnable コマンド +CMD_CascadeCompressEnable カスケード接続の通信時のデータ圧縮の有効化 +CMD_CascadeCompressEnable_Help 現在管理している仮想 HUB に登録されているカスケード接続を指定し、そのカスケード接続が VPN Server との間で VPN 接続を行なって通信をする際に、VPN Server との間の通信内容を圧縮するように設定します。\n最大で約 80 % 程度の圧縮を行うことができます。ただし、圧縮を行うと、クライアントおよびサーバーの両方で CPU 負荷が高くなります。回線速度が約 10 Mbps 以上の場合は、圧縮を行うとスループットが低下し、逆効果となる場合があります。\nこのコマンドは、クラスタとして動作している VPN Server の仮想 HUB では実行できません。 +CMD_CascadeCompressEnable_Args CascadeCompressEnable [name] +CMD_CascadeCompressEnable_[name] 設定を変更するカスケード接続の名前を指定します。 + + +# CascadeCompressDisable コマンド +CMD_CascadeCompressDisable カスケード接続の通信時のデータ圧縮の無効化 +CMD_CascadeCompressDisable_Help 現在管理している仮想 HUB に登録されているカスケード接続を指定し、そのカスケード接続が VPN Server との間で VPN 接続を行なって通信をする際に、VPN Server との間の通信内容を圧縮しないように設定します。\nこのコマンドは、クラスタとして動作している VPN Server の仮想 HUB では実行できません。 +CMD_CascadeCompressDisable_Args CascadeCompressDisable [name] +CMD_CascadeCompressDisable_[name] 設定を変更するカスケード接続の名前を指定します。 + + +# CascadeHttpHeader* コマンド +CMD_CascadeHttpHeader_Prompt_Name ヘッダー名 (コロンより前の部分): +CMD_CascadeHttpHeader_Prompt_Data ヘッダー値 (コロンより後の部分): + +# CascadeHttpHeaderAdd コマンド +CMD_CascadeHttpHeaderAdd プロキシサーバー経由で接続する際のカスタム HTTP ヘッダーを追加 +CMD_CascadeHttpHeaderAdd_Help VPN Client に登録されている接続設定を指定し、経由する HTTP プロキシサーバーに送信されるカスタム HTTP ヘッダーを追加します。カスタム HTTP ヘッダーを使用することによりネットワークに課された特定の制限を回避したり、QoS により適当される速度制限を回避できる場合があります。 +CMD_CascadeHttpHeaderAdd_Args CascadeHttpHeaderAdd [name] [/NAME:name] [/DATA:data] +CMD_CascadeHttpHeaderAdd_[name] 設定を変更する接続設定の名前を指定します。 +CMD_CascadeHttpHeaderAdd_NAME 追加するヘッダーの名前を指定します (コロンより前の部分)。 +CMD_CascadeHttpHeaderAdd_DATA 追加するヘッダーの値を指定します (コロンより後の部分)。 + + +# CascadeHttpHeaderDelete コマンド +CMD_CascadeHttpHeaderDelete プロキシサーバー経由で接続する際のカスタム HTTP ヘッダーを削除 +CMD_CascadeHttpHeaderDelete_Help VPN Client に登録されている接続設定を指定し、経由する HTTP プロキシサーバーに送信されるカスタム HTTP ヘッダーを削除します。カスタム HTTP ヘッダーを使用することによりネットワークに課された特定の制限を回避したり、QoS により適当される速度制限を回避できる場合があります。 +CMD_CascadeHttpHeaderDelete_Args CascadeHttpHeaderDelete [name] [/NAME:name] +CMD_CascadeHttpHeaderDelete_[name] 設定を削除する接続設定の名前を指定します。 +CMD_CascadeHttpHeaderDelete_NAME 削除するヘッダーの名前を指定します (コロンより前の部分)。 + + +# CascadeHttpHeaderGet コマンド +CMD_CascadeHttpHeaderGet プロキシサーバー経由で接続する際のカスタム HTTP ヘッダー一覧を取得 +CMD_CascadeHttpHeaderGet_Help VPN Client に登録されている接続設定を指定し、経由する HTTP プロキシサーバーに送信されるカスタム HTTP ヘッダーの一覧を表示します。カスタム HTTP ヘッダーを使用することによりネットワークに課された特定の制限を回避したり、QoS により適当される速度制限を回避できる場合があります。 +CMD_CascadeHttpHeaderGet_Args CascadeHttpHeaderGet [name] +CMD_CascadeHttpHeaderGet_[name] 設定を取得する接続設定の名前を指定します。 + + +# CascadeProxyNone コマンド +CMD_CascadeProxyNone カスケード接続の接続方法を直接 TCP/IP 接続に設定 +CMD_CascadeProxyNone_Help 現在管理している仮想 HUB に登録されているカスケード接続を指定し、そのカスケード接続が VPN Server に対して接続する際に、使用する接続方法を [直接 TCP/IP 接続] に設定し、プロキシサーバーを経由しないようにします。\nこのコマンドは、クラスタとして動作している VPN Server の仮想 HUB では実行できません。 +CMD_CascadeProxyNone_Args CascadeProxyNone [name] +CMD_CascadeProxyNone_[name] 設定を変更するカスケード接続の名前を指定します。 + + +# CascadeProxyHttp コマンド +CMD_CascadeProxyHttp カスケード接続の接続方法を HTTP プロキシサーバー経由接続に設定 +CMD_CascadeProxyHttp_Help 現在管理している仮想 HUB に登録されているカスケード接続を指定し、そのカスケード接続が VPN Server に対して接続する際に、使用する接続方法を [HTTP プロキシサーバー経由接続] に設定し、経由する HTTP プロキシサーバーのホスト名とポート番号、ユーザー名とパスワード (必要な場合) を指定します。\n経由する HTTP サーバーは、HTTPS 通信をするための CONNECT メソッドに対応している必要があります。\nこのコマンドは、クラスタとして動作している VPN Server の仮想 HUB では実行できません。 +CMD_CascadeProxyHttp_Args CascadeProxyHttp [name] [/SERVER:hostname:port] [/USERNAME:username] [/PASSWORD:password] +CMD_CascadeProxyHttp_[name] 設定を変更するカスケード接続の名前を指定します。 +CMD_CascadeProxyHttp_SERVER [ホスト名:ポート番号] の形式で、経由する HTTP プロキシサーバーのホスト名、または IP アドレスとポート番号を指定します。 +CMD_CascadeProxyHttp_USERNAME 経由する HTTP プロキシサーバーに接続するためにユーザー認証が必要な場合、ユーザー名を指定します。また、同時に /PASSWORD パラメータも指定します。/USERNAME と /PASSWORD パラメータが指定されない場合は、ユーザー認証データを設定しません。 +CMD_CascadeProxyHttp_PASSWORD 経由する HTTP プロキシサーバーに接続するためにユーザー認証が必要な場合、パスワードを指定します。/USERNAME パラメータと共に指定します。 +CMD_CascadeProxyHttp_Prompt_Server プロキシサーバーのホスト名とポート番号: + + +# CascadeProxySocks コマンド +CMD_CascadeProxySocks カスケード接続の接続方法を SOCKS4 プロキシサーバー経由接続に設定 +CMD_CascadeProxySocks_Help 現在管理している仮想 HUB に登録されているカスケード接続を指定し、そのカスケード接続が VPN Server に対して接続する際に、使用する接続方法を [SOCKS4 プロキシサーバー経由接続] に設定し、経由する SOCKS4 プロキシサーバーのホスト名とポート番号、ユーザー名とパスワード (必要な場合) を指定します。\n経由する SOCKS4 サーバーは、SOCKS4 バージョン 4 に対応している必要があります。\nこのコマンドは、クラスタとして動作している VPN Server の仮想 HUB では実行できません。 +CMD_CascadeProxySocks_Args CascadeProxySocks [name] [/SERVER:hostname:port] [/USERNAME:username] [/PASSWORD:password] +CMD_CascadeProxySocks_[name] 設定を変更するカスケード接続の名前を指定します。 +CMD_CascadeProxySocks_SERVER [ホスト名:ポート番号] の形式で、経由する SOCKS4 プロキシサーバーのホスト名、または IP アドレスとポート番号を指定します。 +CMD_CascadeProxySocks_USERNAME 経由する SOCKS4 プロキシサーバーに接続するためにユーザー認証が必要な場合、ユーザー名を指定します。また、同時に /PASSWORD パラメータも指定します。/USERNAME と /PASSWORD パラメータが指定されない場合は、ユーザー認証データを設定しません。 +CMD_CascadeProxySocks_PASSWORD 経由する SOCKS4 プロキシサーバーに接続するためにユーザー認証が必要な場合、パスワードを指定します。/USERNAME パラメータと共に指定します。 + + +# CascadeProxySocks5 コマンド +CMD_CascadeProxySocks5 カスケード接続の接続方法を SOCKS4 プロキシサーバー経由接続に設定 +CMD_CascadeProxySocks5_Help 現在管理している仮想 HUB に登録されているカスケード接続を指定し、そのカスケード接続が VPN Server に対して接続する際に、使用する接続方法を [SOCKS5 プロキシサーバー経由接続] に設定し、経由する SOCKS5 プロキシサーバーのホスト名とポート番号、ユーザー名とパスワード (必要な場合) を指定します。\nこのコマンドは、クラスタとして動作している VPN Server の仮想 HUB では実行できません。 +CMD_CascadeProxySocks5_Args CascadeProxySocks5 [name] [/SERVER:hostname:port] [/USERNAME:username] [/PASSWORD:password] +CMD_CascadeProxySocks5_[name] 設定を変更するカスケード接続の名前を指定します。 +CMD_CascadeProxySocks5_SERVER [ホスト名:ポート番号] の形式で、経由する SOCKS5 プロキシサーバーのホスト名、または IP アドレスとポート番号を指定します。 +CMD_CascadeProxySocks5_USERNAME 経由する SOCKS5 プロキシサーバーに接続するためにユーザー認証が必要な場合、ユーザー名を指定します。また、同時に /PASSWORD パラメータも指定します。/USERNAME と /PASSWORD パラメータが指定されない場合は、ユーザー認証データを設定しません。 +CMD_CascadeProxySocks5_PASSWORD 経由する SOCKS5 プロキシサーバーに接続するためにユーザー認証が必要な場合、パスワードを指定します。/USERNAME パラメータと共に指定します。 + + +# CascadeServerCertEnable コマンド +CMD_CascadeServerCertEnable カスケード接続のサーバー証明書の検証オプションの有効化 +CMD_CascadeServerCertEnable_Help 現在管理している仮想 HUB に登録されているカスケード接続を指定し、そのカスケード接続が VPN Server に対して接続する際に、接続先の VPN Server の提示する SSL 証明書が信頼できるかどうか検査するオプションを有効にします。\nこのオプションが有効になっている場合、接続先サーバーの SSL 証明書をあらかじめ CascadeServerCertSet コマンドでカスケード接続設定内に保存しておくか、または仮想 HUB の信頼する証明機関の証明書一覧に、サーバーの SSL 証明書を署名したルート証明書を CAAdd コマンドなどで登録しておく必要があります。\nカスケード接続の、サーバー証明書の検証オプションが有効になっている状態で接続した VPN Server の証明書が信頼できない場合、直ちに接続を解除して再試行を繰り返します。\nこのコマンドは、クラスタとして動作している VPN Server の仮想 HUB では実行できません。 +CMD_CascadeServerCertEnable_Args CascadeServerCertEnable [name] +CMD_CascadeServerCertEnable_[name] 設定を変更するカスケード接続の名前を指定します。 + + +# CascadeServerCertDisable コマンド +CMD_CascadeServerCertDisable カスケード接続のサーバー証明書の検証オプションの無効化 +CMD_CascadeServerCertDisable_Help 現在管理している仮想 HUB に登録されているカスケード接続を指定し、そのカスケード接続が VPN Server に対して接続する際に、接続先の VPN Server の提示する SSL 証明書が、信頼できるかどうか検査するオプションを無効にします。\nこのコマンドは、クラスタとして動作している VPN Server の仮想 HUB では実行できません。 +CMD_CascadeServerCertDisable_Args CascadeServerCertDisable [name] +CMD_CascadeServerCertDisable_[name] 設定を変更するカスケード接続の名前を指定します。 + + +# CascadeServerCertSet コマンド +CMD_CascadeServerCertSet カスケード接続のサーバー固有証明書の設定 +CMD_CascadeServerCertSet_Help 現在管理している仮想 HUB に登録されているカスケード接続を指定し、そのカスケード接続が VPN Server に対して接続する際に、接続先の VPN Server の提示する SSL 証明書と同じ証明書をあらかじめ登録します。\nカスケード接続の、サーバー証明書の検証オプションが有効になっている場合、接続先サーバーの SSL 証明書を、あらかじめこのコマンドでカスケード接続設定内に保存しておくか、または仮想 HUB の信頼する証明機関の証明書一覧に、サーバーの SSL 証明書を署名したルート証明書を CAAdd コマンドなどで登録しておく必要があります。\nカスケード接続の、サーバー証明書の検証オプションが有効になっている状態で接続した VPN Server の証明書が信頼できない場合、直ちに接続を解除して再試行を繰り返します。\nこのコマンドは、クラスタとして動作している VPN Server の仮想 HUB では実行できません。 +CMD_CascadeServerCertSet_Args CascadeServerCertSet [name] [/LOADCERT:cert] +CMD_CascadeServerCertSet_[name] 設定を変更するカスケード接続の名前を指定します。 +CMD_CascadeServerCertSet_LOADCERT 設定するサーバー固有証明書が保存されている X.509 形式の証明書ファイル名を指定します。 + + +# CascadeServerCertDelete コマンド +CMD_CascadeServerCertDelete カスケード接続のサーバー固有証明書の削除 +CMD_CascadeServerCertDelete_Help 現在管理している仮想 HUB に登録されているカスケード接続を指定し、そのカスケード接続にサーバー固有証明書が登録されている場合は、それを削除します。\nこのコマンドは、クラスタとして動作している VPN Server の仮想 HUB では実行できません。 +CMD_CascadeServerCertDelete_Args CascadeServerCertDelete [name] +CMD_CascadeServerCertDelete_[name] 設定を変更するカスケード接続の名前を指定します。 + + +# CascadeServerCertGet コマンド +CMD_CascadeServerCertGet カスケード接続のサーバー固有証明書の取得 +CMD_CascadeServerCertGet_Help 現在管理している仮想 HUB に登録されているカスケード接続を指定し、そのカスケード接続にサーバー固有証明書が登録されている場合は、その証明書を取得して、X.509 形式の証明書ファイルとして保存します。\nこのコマンドは、クラスタとして動作している VPN Server の仮想 HUB では実行できません。 +CMD_CascadeServerCertGet_Args CascadeServerCertGet [name] [/SAVECERT:path] +CMD_CascadeServerCertGet_[name] 設定を変更するカスケード接続の名前を指定します。 +CMD_CascadeServerCertGet_SAVECERT サーバー固有証明書を X.509 形式で保存する証明書ファイル名を指定します。 + + +# CascadeDetailSet コマンド +CMD_CascadeDetailSet カスケード接続の高度な通信設定の設定 +CMD_CascadeDetailSet_Help 現在管理している仮想 HUB に登録されているカスケード接続を指定し、そのカスケード接続が VPN Server と通信する際に使用される、VPN プロトコルの通信設定をカスタマイズします。\nこのコマンドは、クラスタとして動作している VPN Server の仮想 HUB では実行できません。 +CMD_CascadeDetailSet_Args CascadeDetailSet [name] [/MAXTCP:max_connection] [/INTERVAL:interval] [/TTL:disconnect_span] [/HALF:yes|no] [/NOQOS:yes|no] +CMD_CascadeDetailSet_[name] 設定を変更するカスケード接続の名前を指定します。 +CMD_CascadeDetailSet_MAXTCP VPN 通信に使用する TCP コネクション数を、1 以上 32 以下の整数で指定します。VPN Server との間の VPN 通信セッションにおけるデータ伝送に、複数本の TCP コネクションを束ねて使用することにより、通信速度を向上できる場合があります。\n注意: サーバーへの接続回線が高速な場合は 8 本程度を、ダイヤルアップ等の低速な場合は 1 本をお勧めします。 +CMD_CascadeDetailSet_INTERVAL 複数の TCP コネクションを確立して VPN 通信を行うとき、各 TCP コネクションの確立間隔を秒単位で指定します。規定値は 1 秒です。 +CMD_CascadeDetailSet_TTL 各 TCP コネクションの寿命を設定する場合は、TCP コネクションが確立されてから切断されるまでの寿命を、秒数で指定します。0 を指定すると、寿命は設定されません。 +CMD_CascadeDetailSet_HALF 半二重モードを有効にする場合は "yes" を指定します。2 本以上の TCP コネクションを束ねて VPN 通信を行う際、「半二重モード」を使用することができます。半二重モードを有効にすると、自動的に各 TCP コネクションのデータ伝送方向を半数ずつ固定することができます。たとえば、8 本の TCP コネクションを使用して VPN セッションを確立した場合、半二重モードを有効にすると、4 本の TCP コネクションはアップロード方向専用、残りの 4 本のコネクションはダウンロード方向専用に固定され通信が行われます。 +CMD_CascadeDetailSet_NOQOS VoIP / QoS 対応機能を無効にする場合は "yes" を指定します。通常は "no" を指定します。 +CMD_CascadeDetailSet_Eval_MaxTcp TCP コネクション数は 1 から 32 の間で指定してください。 +CMD_CascadeDetailSet_Eval_Interval TCP コネクションの確立間隔は 1 秒以上を指定してください。 +CMD_CascadeDetailSet_Prompt_MaxTcp VPN 通信に使用する TCP コネクション数: +CMD_CascadeDetailSet_Prompt_Interval 各 TCP コネクションの確立間隔: +CMD_CascadeDetailSet_Prompt_TTL 各 TCP コネクションの寿命 (0 で無し): +CMD_CascadeDetailSet_Prompt_HALF 半二重モードを有効にする (yes/no): + + +# CascadePolicySet コマンド +CMD_CascadePolicySet カスケード接続セッションのセキュリティポリシーの設定 +CMD_CascadePolicySet_Help 現在管理している仮想 HUB に登録されているカスケード接続を指定し、そのカスケード接続が確立した際に、仮想 HUB で生成されるセッションに適用するセキュリティポリシーの内容を変更します。\n仮想 HUB が別の VPN Server にカスケード接続すると、カスケード接続元の仮想 HUB には「カスケードセッション」が新しく生成されます。そのカスケードセッションに設定するセキュリティポリシーの内容を、このコマンドで設定することができます。\nこのコマンドは、クラスタとして動作している VPN Server の仮想 HUB では実行できません。 +CMD_CascadePolicySet_Args [name] [/NAME:policy_name] [/VALUE:num|yes|no] +CMD_CascadePolicySet_[name] 設定を変更するカスケード接続の名前を指定します。 +CMD_CascadePolicySet_NAME 値を変更するポリシーの名前を指定します。ポリシーの名前と、設定できる値の一覧は PolicyList コマンドで表示することができます。 +CMD_CascadePolicySet_VALUE ポリシーの新しい値を指定します。そのポリシーが数値型の場合は整数を指定します。ブール型の場合は yes または no を指定します。設定できる型と値は PolicyList コマンドで表示することができます。 +CMD_CascadePolicySet_PROMPT_POLNAME 値を変更するポリシーの名前: +CMD_CascadePolicySet_PROMPT_POLVALUE 新しく設定する値: +CMD_CascadePolicySet_Invalid_Name 指定されたポリシー名 "%S" は不正です。\nPolicyList コマンドで設定できるポリシー名の一覧を確認してください。 +CMD_CascadePolicySet_Invalid_Name_For_Cascade 指定されたポリシー名 "%S" はカスケード接続のセキュリティポリシー設定では使用できません。 +CMD_CascadePolicySet_Invalid_Range ポリシー "%S" は %s の範囲で指定してください。 + + +# PolicyList コマンド +CMD_PolicyList セキュリティポリシーの種類と設定可能値の一覧を表示 +CMD_PolicyList_Help VPN Server のユーザーやグループ、カスケード接続に対して設定することができるセキュリティポリシー内の項目の名前、説明、および設定できる値の一覧を表示します。\nPolicyList コマンドに何も引数を指定せずに起動すると、サポートされているすべてのセキュリティポリシーの名前と説明の一覧が表示されます。\nPolicyList コマンドの引数で名前を指定すると、その値に関する詳細な説明と、設定できる値の型および範囲が表示されます。 +CMD_PolicyList_Args PolicyList [name] +CMD_PolicyList_[name] 説明を表示するポリシー名を指定します。指定しない場合は、サポートされているすべてのセキュリティポリシーの名前と、説明の一覧が表示されます。 +CMD_PolicyList_Invalid_Name 指定されたセキュリティポリシー名が不正です。 +CMD_PolicyList_Column_1 ポリシー名 +CMD_PolicyList_Column_2 ポリシーの簡易説明 +CMD_PolicyList_Column_3 設定値 +CMD_PolicyList_Help_1 [ポリシー名] +CMD_PolicyList_Help_2 [ポリシーの簡易説明] +CMD_PolicyList_Help_3 [設定できる値の範囲] +CMD_PolicyList_Help_4 [デフォルト値] +CMD_PolicyList_Help_5 [ポリシーの詳細説明] +CMD_PolicyList_Range_Bool はい (Yes) または いいえ (No) +CMD_PolicyList_Range_Int_1 %s 以上 %s 以下 (0 は指定できない) +CMD_PolicyList_Range_Int_2 %s 以上 %s 以下 (ただし 0 を指定すると設定無し) + + +# CascadeStatusGet コマンド +CMD_CascadeStatusGet カスケード接続の現在の状態の取得 +CMD_CascadeStatusGet_Help 現在管理している仮想 HUB に登録されているカスケード接続を指定し、そのカスケード接続が現在オンラインである場合は、その接続状態やその他の情報を取得します。\nこのコマンドは、クラスタとして動作している VPN Server の仮想 HUB では実行できません。 +CMD_CascadeStatusGet_Args CascadeStatusGet [name] +CMD_CascadeStatusGet_[name] 情報を取得するカスケード接続の名前を指定します。 + + +# CascadeRename コマンド +CMD_CascadeRename カスケード接続の名前の変更 +CMD_CascadeRename_Help 現在管理している仮想 HUB に登録されているカスケード接続を指定し、そのカスケード接続の名前を変更します。\nこのコマンドは、クラスタとして動作している VPN Server の仮想 HUB では実行できません。 +CMD_CascadeRename_Args CascadeRename [name] [/NEW:new_name] +CMD_CascadeRename_[name] 名前を変更するカスケード接続の現在の名前を指定します。 +CMD_CascadeRename_NEW 変更後の新しい名前を指定します。 +CMD_CascadeRename_PROMPT_OLD 現在の名前: +CMD_CascadeRename_PROMPT_NEW 新しい名前: + + + +# CascadeOnline コマンド +CMD_CascadeOnline カスケード接続のオンライン状態への設定 +CMD_CascadeOnline_Help 現在管理している仮想 HUB に登録されているカスケード接続を指定し、そのカスケード接続をオンライン化します。オンライン状態になったカスケード接続は、接続設定に従って、接続先の VPN Server への接続処理を開始します。オンライン状態になったカスケード接続は、CascadeOffline コマンドでオフライン状態に設定するまで、VPN Server に常時接続または接続を試行し続けます。\nこのコマンドは、クラスタとして動作している VPN Server の仮想 HUB では実行できません。 +CMD_CascadeOnline_Args CascadeOnline [name] +CMD_CascadeOnline_[name] オンライン状態にするカスケード接続の名前を指定します。 + + +# CascadeOffline コマンド +CMD_CascadeOffline カスケード接続のオフライン状態への設定 +CMD_CascadeOffline_Help 現在管理している仮想 HUB に登録されているカスケード接続を指定し、そのカスケード接続をオフライン化します。オフライン化されたカスケード接続は、次に CascadeOnline コマンドでオンライン状態に設定するまで VPN Server に対して接続しません。\nこのコマンドは、クラスタとして動作している VPN Server の仮想 HUB では実行できません。 +CMD_CascadeOffline_Args CascadeOffline [name] +CMD_CascadeOffline_[name] オフライン状態にするカスケード接続の名前を指定します。 + + +# AccessAdd コマンド +CMD_AccessAdd アクセスリストへのルールの追加 (IPv4) +CMD_AccessAdd_Help 現在管理している仮想 HUB のアクセスリストに、新しいルールを追加します。\nアクセスリストとは、仮想 HUB 内を流れるパケットに対して適用されるパケットフィルタルールの集合です。アクセスリストには複数のルールを登録することができ、各ルールごとに優先順位を定義することができます。すべてのパケットは、アクセスリストに登録されているルールで指定された条件に、最初に一致したルールで規定されている動作で、通過または破棄が決定されます。どのルールの条件にも一致しなかったパケットは、暗黙で通過を許可されます。なお、AccessAddEx コマンドを使用することで、通過時に遅延・ジッタ・パケットロスを発生させることもできます。\nこのコマンドは、VPN Bridge では実行できません。\nこのコマンドは、クラスタ内でクラスタメンバサーバーとして動作している VPN Server の仮想 HUB では実行できません。 +CMD_AccessAdd_Args AccessAdd [pass|discard] [/MEMO:memo] [/PRIORITY:priority] [/SRCUSERNAME:username] [/DESTUSERNAME:username] [/SRCMAC:mac/mask] [/DESTMAC:mac/mask] [/SRCIP:ip/mask] [/DESTIP:ip/mask] [/PROTOCOL:tcp|udp|icmpv4|icmpv6|ip|num] [/SRCPORT:start-end] [/DESTPORT:start-end] [/TCPSTATE:established|unestablished] +CMD_AccessAdd_[pass|discard] パケットが、このルールの条件に一致した場合の動作を決定します。pass を指定すると [通過] を、discard を指定すると [破棄] を意味します。 +CMD_AccessAdd_MEMO ルールの説明 (メモ) を指定します。 +CMD_AccessAdd_PRIORITY ルールの優先順位を 1 以上の整数で指定します。優先順位は小さいものほど優先度が高くなります。 +CMD_AccessAdd_SRCIP ルールの条件として、送信元 IPv4 アドレスを "IPアドレス/マスク" の形式で指定します。IP アドレスは 192.168.0.1 のように 10 進数をドットで区切って指定します。マスクは 255.255.255.0 のように 10 進数をドットで区切って指定するか、24 のように先頭からのビット長を 10 進数で指定できます。0.0.0.0/0.0.0.0 を指定すると、すべてのホストを示します。 +CMD_AccessAdd_DESTIP ルールの条件として、宛先 IPv4 アドレスを "IPアドレス/マスク" の形式で指定します。指定方法は /SRCIP パラメータと同様です。 +CMD_AccessAdd_PROTOCOL ルールの条件として、プロトコルの種類を指定します。IP プロトコル番号を 10 進数で入力するか、"tcp" (TCP/IP プロトコル、6 番)、"udp" (UDP/IP プロトコル、17番)、"icmpv4" (ICMPv4 プロトコル、1 番)、"icmpv6" (ICMPv6 プロトコル、58 番)、"ip" (すべての IP プロトコル、0 番) のキーワードを指定します。すべての IP プロトコルを対象とするには 0 を指定します。 +CMD_AccessAdd_SRCPORT プロトコルが TCP/IP または UDP/IP の場合は、ルールの条件として、送信元ポート番号を指定します。それ以外のプロトコルの場合は無視されます。このパラメータを指定しない場合は、すべてのポート番号が対象となります。指定方法は、"1-1024" (1 番以上 1024 番以下)、"23" (23 番のみ) などのように指定します。 +CMD_AccessAdd_DESTPORT プロトコルが TCP/IP または UDP/IP の場合は、ルールの条件として、宛先ポート番号を指定します。それ以外のプロトコルの場合は無視されます。指定方法は /SRCPORT パラメータと同様です。 +CMD_AccessAdd_SRCUSERNAME ルールの条件として、指定された名前のユーザーまたはグループのセッションによって送信されたパケットのみに、このルールを適用することができます。その場合は、ユーザー名またはグループ名を指定します。 +CMD_AccessAdd_DESTUSERNAME ルールの条件として、指定された名前のユーザーまたはグループのユーザーのセッションが受信するパケットのみに、このルールを適用することができます。その場合は、ユーザー名またはグループ名を指定します。 +CMD_AccessAdd_SRCMAC ルールの条件として、送信元 MAC アドレスを指定します。MAC アドレスは 00-AC-84-EA-33-BC/FF-FF-FF-FF-FF-00 のように 16 進数と "-" か ":" の区切り文字を使用して指定します。区切り文字は省略できます。 +CMD_AccessAdd_DESTMAC ルールの条件として、宛先 MAC アドレスを指定します。指定方法は、/SRCMAC パラメータと同様です。 +CMD_AccessAdd_TCPSTATE ルールの条件として、TCP コネクションの状態を指定します。 Established または Unestablished を指定します。 +CMD_AccessAdd_Prompt_TYPE pass または discard: +CMD_AccessAdd_Prompt_MEMO ルールの説明 (メモ): +CMD_AccessAdd_Prompt_PRIORITY ルールの優先順位: +CMD_AccessAdd_Eval_PRIORITY 優先順位は 1 以上の整数で指定してください。 +CMD_AccessAdd_Prompt_SRCIP 送信元 IP アドレス (0.0.0.0/0 ですべて): +CMD_AccessAdd_Prompt_DESTIP 宛先 IP アドレス (0.0.0.0/0 ですべて): +CMD_AccessAdd_Prompt_PROTOCOL プロトコル番号またはプロトコル名 (tcp/udp/icmpv4/icmpv6/ip): +CMD_AccessAdd_Prompt_SRCPORT 送信元ポート番号の範囲 (tcp/udp の場合のみ): +CMD_AccessAdd_Prompt_DESTPORT 宛先ポート番号の範囲 (tcp/udp の場合のみ): +CMD_AccessAdd_Prompt_SRCUSERNAME 送信ユーザー名 (無指定ですべて): +CMD_AccessAdd_Prompt_DESTUSERNAME 受信ユーザー名 (無指定ですべて): +CMD_AccessAdd_Prompt_SRCMAC 送信元 MAC アドレスとマスク(無指定ですべて): +CMD_AccessAdd_Prompt_DESTMAC 宛先 MAC アドレスとマスク(無指定ですべて): +CMD_AccessAdd_Prompt_TCPSTATE TCP コネクションの状態 (Established/Unestablished): + + +# AccessAddEx コマンド +CMD_AccessAddEx アクセスリストへのルールの追加 (IPv4, 遅延・ジッタ・パケットロス設定可能) +CMD_AccessAddEx_Help 現在管理している仮想 HUB のアクセスリストに、新しいルールを追加します。通過時に遅延・ジッタ・パケットロスを発生させることができます。\nアクセスリストとは、仮想 HUB 内を流れるパケットに対して適用されるパケットフィルタルールの集合です。アクセスリストには複数のルールを登録することができ、各ルールごとに優先順位を定義することができます。すべてのパケットは、アクセスリストに登録されているルールで指定された条件に、最初に一致したルールで規定されている動作で、通過または破棄が決定されます。どのルールの条件にも一致しなかったパケットは、暗黙で通過を許可されます。\nこのコマンドは、VPN Bridge では実行できません。\nこのコマンドは、クラスタ内でクラスタメンバサーバーとして動作している VPN Server の仮想 HUB では実行できません。 +CMD_AccessAddEx_Args AccessAddEx [pass|discard] [/MEMO:memo] [/PRIORITY:priority] [/SRCUSERNAME:username] [/DESTUSERNAME:username] [/SRCMAC:mac/mask] [/DESTMAC:mac/mask] [/SRCIP:ip/mask] [/DESTIP:ip/mask] [/PROTOCOL:tcp|udp|icmpv4|icmpv6|ip|num] [/SRCPORT:start-end] [/DESTPORT:start-end] [/SRCUSERNAME:username] [/DESTUSERNAME:username] [/TCPSTATE:established|unestablished] [/DELAY:delay_millisec] [/JITTER:jitter_percent] [/LOSS:loss_percent] [/REDIRECTURL:url] +CMD_AccessAddEx_[pass|discard] パケットが、このルールの条件に一致した場合の動作を決定します。pass を指定すると [通過] を、discard を指定すると [破棄] を意味します。遅延・ジッタ・パケットロス設定は、pass の場合のみ適用されます。 +CMD_AccessAddEx_MEMO ルールの説明 (メモ) を指定します。 +CMD_AccessAddEx_PRIORITY ルールの優先順位を 1 以上の整数で指定します。優先順位は小さいものほど優先度が高くなります。 +CMD_AccessAddEx_SRCIP ルールの条件として、送信元 IPv4 アドレスを "IPアドレス/マスク" の形式で指定します。IP アドレスは 192.168.0.1 のように 10 進数をドットで区切って指定します。マスクは 255.255.255.0 のように 10 進数をドットで区切って指定するか、24 のように先頭からのビット長を 10 進数で指定できます。0.0.0.0/0.0.0.0 を指定すると、すべてのホストを示します。 +CMD_AccessAddEx_DESTIP ルールの条件として、宛先 IPv4 アドレスを "IPアドレス/マスク" の形式で指定します。指定方法は /SRCIP パラメータと同様です。 +CMD_AccessAddEx_PROTOCOL ルールの条件として、プロトコルの種類を指定します。IP プロトコル番号を 10 進数で入力するか、"tcp" (TCP/IP プロトコル、6 番)、"udp" (UDP/IP プロトコル、17番)、"icmpv4" (ICMPv4 プロトコル、1 番)、"icmpv6" (ICMPv6 プロトコル、58 番)、"ip" (すべての IP プロトコル、0 番) のキーワードを指定します。すべての IP プロトコルを対象とするには 0 を指定します。 +CMD_AccessAddEx_SRCPORT プロトコルが TCP/IP または UDP/IP の場合は、ルールの条件として、送信元ポート番号を指定します。それ以外のプロトコルの場合は無視されます。このパラメータを指定しない場合は、すべてのポート番号が対象となります。指定方法は、"1-1024" (1 番以上 1024 番以下)、"23" (23 番のみ) などのように指定します。 +CMD_AccessAddEx_DESTPORT プロトコルが TCP/IP または UDP/IP の場合は、ルールの条件として、宛先ポート番号を指定します。それ以外のプロトコルの場合は無視されます。指定方法は /SRCPORT パラメータと同様です。 +CMD_AccessAddEx_SRCUSERNAME ルールの条件として、指定された名前のユーザーまたはグループのセッションによって送信されたパケットのみに、このルールを適用することができます。その場合は、ユーザー名またはグループ名を指定します。 +CMD_AccessAddEx_DESTUSERNAME ルールの条件として、指定された名前のユーザーまたはグループのセッションが受信するパケットのみに、このルールを適用することができます。その場合は、ユーザー名またはグループ名を指定します。 +CMD_AccessAddEx_SRCMAC ルールの条件として、送信元 MAC アドレスを指定します。MAC アドレスは 00-AC-84-EA-33-BC/FF-FF-FF-FF-FF-00 のように 16 進数と "-" か ":" の区切り文字を使用して指定します。区切り文字は省略できます。 +CMD_AccessAddEx_DESTMAC ルールの条件として、宛先 MAC アドレスを指定します。指定方法は、/SRCMAC パラメータと同様です。 +CMD_AccessAddEx_TCPSTATE ルールの条件として、TCP コネクションの状態を指定します。Established または Unestablished を指定します。 +CMD_AccessAddEx_DELAY このルールによってパケットが通過する場合に遅延を発生させることができます。発生させたい遅延時間をミリ秒単位で指定します。無指定または 0 を指定すると、遅延は発生しません。遅延は 10000 ミリ秒以下である必要があります。 +CMD_AccessAddEx_JITTER このルールによってパケットが通過する場合にジッタを発生させることができます。遅延の値に対してジッタの揺らぎを 0% ~ 100% のパーセント数値で指定します。無指定または 0 を指定すると、ジッタは発生しません。 +CMD_AccessAddEx_LOSS このルールによってパケットが通過する場合にパケットロスを発生させることができます。パケットが破棄される可能性を 0% ~ 100% のパーセント数値で指定します。無指定または 0 を指定すると、パケットロスは発生しません。 +CMD_AccessAddEx_REDIRECTURL HTTP リクエストに対するリダイレクト先の URL を指定することができます。仮想 HUB を経由する TCP コネクションがこのアクセスリストの条件に一致した場合、その TCP コネクションを用いてクライアントが何らかの通信を行おうとすると、強制的に設定された URL 文字列をクライアントに対して応答します。これにより、VPN クライアント上で起動している Web ブラウザが特定の IP アドレスにアクセスした場合などに任意の Web ページをその Web ブラウザ上に表示させることができます。 + +CMD_AccessAddEx_Prompt_DELAY 発生させる遅延 (ミリ秒単位: 0 - 10000): +CMD_AccessAddEx_Prompt_JITTER 発生させるジッタの揺らぎ (パーセント単位: 0 - 100): +CMD_AccessAddEx_Prompt_LOSS 発生させるパケットロス率 (パーセント単位: 0 - 100): +CMD_AccessAddEx_Eval_DELAY 遅延は 0 - 10000 の整数で設定してください。 +CMD_AccessAddEx_Eval_JITTER ジッタの揺らぎは 0 - 100 の整数で指定してください。 +CMD_AccessAddEx_Eval_LOSS パケットロス率は 0 - 100 の整数で指定してください。 + + + +# AccessAdd6 コマンド +CMD_AccessAdd6 アクセスリストへのルールの追加 (IPv6) +CMD_AccessAdd6_Help 現在管理している仮想 HUB のアクセスリストに、新しいルールを追加します。\nアクセスリストとは、仮想 HUB 内を流れるパケットに対して適用されるパケットフィルタルールの集合です。アクセスリストには複数のルールを登録することができ、各ルールごとに優先順位を定義することができます。すべてのパケットは、アクセスリストに登録されているルールで指定された条件に、最初に一致したルールで規定されている動作で、通過または破棄が決定されます。どのルールの条件にも一致しなかったパケットは、暗黙で通過を許可されます。なお、AccessAddEx6 コマンドを使用することで、通過時に遅延・ジッタ・パケットロスを発生させることもできます。\nこのコマンドは、VPN Bridge では実行できません。\nこのコマンドは、クラスタ内でクラスタメンバサーバーとして動作している VPN Server の仮想 HUB では実行できません。 +CMD_AccessAdd6_Args AccessAdd6 [pass|discard] [/MEMO:memo] [/PRIORITY:priority] [/SRCUSERNAME:username] [/DESTUSERNAME:username] [/SRCMAC:mac/mask] [/DESTMAC:mac/mask] [/SRCIP:ip/mask] [/DESTIP:ip/mask] [/PROTOCOL:tcp|udp|icmpv4|icmpv6|ip|num] [/SRCPORT:start-end] [/DESTPORT:start-end] [/SRCUSERNAME:username] [/DESTUSERNAME:username] [/TCPSTATE:established|unestablished] +CMD_AccessAdd6_[pass|discard] パケットが、このルールの条件に一致した場合の動作を決定します。pass を指定すると [通過] を、discard を指定すると [破棄] を意味します。 +CMD_AccessAdd6_MEMO ルールの説明 (メモ) を指定します。 +CMD_AccessAdd6_PRIORITY ルールの優先順位を 1 以上の整数で指定します。優先順位は小さいものほど優先度が高くなります。 +CMD_AccessAdd6_SRCIP ルールの条件として、送信元 IPv6 アドレスを "IPアドレス/マスク" の形式で指定します。IPv6 アドレスは 2001:200:0:1:: のように 16 進数をコロンで区切って指定します。マスクは ffff:ffff:ffff:ffff:: のように IPv6 形式で区切って指定するか、64 のように先頭からのビット長を 10 進数で指定します。単一の IPv6 ホストを指定するには、マスクを ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff または 128 として指定します。すべての IPv6 ホストを指定するには、"::/0" と指定します。 +CMD_AccessAdd6_DESTIP ルールの条件として、宛先 IPv6 アドレスを "IPアドレス/マスク" の形式で指定します。指定方法は /SRCIP パラメータと同様です。 +CMD_AccessAdd6_PROTOCOL ルールの条件として、プロトコルの種類を指定します。IP プロトコル番号を 10 進数で入力するか、"tcp" (TCP/IP プロトコル、6 番)、"udp" (UDP/IP プロトコル、17番)、"icmpv4" (ICMPv4 プロトコル、1 番)、"icmpv6" (ICMPv6 プロトコル、58 番)、"ip" (すべての IP プロトコル、0 番) のキーワードを指定します。すべての IP プロトコルを対象とするには 0 を指定します。 +CMD_AccessAdd6_SRCPORT プロトコルが TCP/IP または UDP/IP の場合は、ルールの条件として、送信元ポート番号を指定します。それ以外のプロトコルの場合は無視されます。このパラメータを指定しない場合は、すべてのポート番号が対象となります。指定方法は、"1-1024" (1 番以上 1024 番以下)、"23" (23 番のみ) などのように指定します。 +CMD_AccessAdd6_DESTPORT プロトコルが TCP/IP または UDP/IP の場合は、ルールの条件として、宛先ポート番号を指定します。それ以外のプロトコルの場合は無視されます。指定方法は /SRCPORT パラメータと同様です。 +CMD_AccessAdd6_SRCUSERNAME ルールの条件として、指定された名前のユーザーまたはグループのセッションによって送信されたパケットのみに、このルールを適用することができます。その場合は、ユーザー名またはグループ名を指定します。 +CMD_AccessAdd6_DESTUSERNAME ルールの条件として、指定された名前のユーザーまたはグループのセッションが受信するパケットのみに、このルールを適用することができます。その場合は、ユーザー名またはグループ名を指定します。 +CMD_AccessAdd6_SRCMAC ルールの条件として、送信元 MAC アドレスを指定します。MAC アドレスは 00-AC-84-EA-33-BC/FF-FF-FF-FF-FF-00 のように 16 進数と "-" か ":" の区切り文字を使用して指定します。区切り文字は省略できます。 +CMD_AccessAdd6_DESTMAC ルールの条件として、宛先 MAC アドレスを指定します。指定方法は、/SRCMAC パラメータと同様です。 +CMD_AccessAdd6_TCPSTATE ルールの条件として、TCP コネクションの状態を指定します。 Established または Unestablished を指定します。 +CMD_AccessAdd6_Prompt_TYPE pass または discard: +CMD_AccessAdd6_Prompt_MEMO ルールの説明 (メモ): +CMD_AccessAdd6_Prompt_PRIORITY ルールの優先順位: +CMD_AccessAdd6_Eval_PRIORITY 優先順位は 1 以上の整数で指定してください。 +CMD_AccessAdd6_Prompt_SRCIP 送信元 IPv6 アドレス (::/0 ですべて): +CMD_AccessAdd6_Prompt_DESTIP 宛先 IPv6 アドレス (::/0 ですべて): +CMD_AccessAdd6_Prompt_PROTOCOL プロトコル番号またはプロトコル名 (tcp/udp/icmpv4/icmpv6/ip): +CMD_AccessAdd6_Prompt_SRCPORT 送信元ポート番号の範囲 (tcp/udpの場合のみ): +CMD_AccessAdd6_Prompt_DESTPORT 宛先ポート番号の範囲 (tcp/udpの場合のみ): +CMD_AccessAdd6_Prompt_SRCUSERNAME 送信ユーザー名 (無指定ですべて): +CMD_AccessAdd6_Prompt_DESTUSERNAME 受信ユーザー名 (無指定ですべて): +CMD_AccessAdd6_Prompt_SRCMAC 送信元 MAC アドレスとマスク(無指定ですべて): +CMD_AccessAdd6_Prompt_DESTMAC 宛先 MAC アドレスとマスク(無指定ですべて): +CMD_AccessAdd6_Prompt_TCPSTATE TCP コネクションの状態(Established/Unestablished): + + +# AccessAddEx6 コマンド +CMD_AccessAddEx6 アクセスリストへのルールの追加 (IPv6, 遅延・ジッタ・パケットロス設定可能) +CMD_AccessAddEx6_Help 現在管理している仮想 HUB のアクセスリストに、新しいルールを追加します。通過時に遅延・ジッタ・パケットロスを発生させることができます。\nアクセスリストとは、仮想 HUB 内を流れるパケットに対して適用されるパケットフィルタルールの集合です。アクセスリストには複数のルールを登録することができ、各ルールごとに優先順位を定義することができます。すべてのパケットは、アクセスリストに登録されているルールで指定された条件に、最初に一致したルールで規定されている動作で、通過または破棄が決定されます。どのルールの条件にも一致しなかったパケットは、暗黙で通過を許可されます。\nこのコマンドは、VPN Bridge では実行できません。\nこのコマンドは、クラスタ内でクラスタメンバサーバーとして動作している VPN Server の仮想 HUB では実行できません。 +CMD_AccessAddEx6_Args AccessAddEx6 [pass|discard] [/MEMO:memo] [/PRIORITY:priority] [/SRCUSERNAME:username] [/DESTUSERNAME:username] [/SRCMAC:mac/mask] [/DESTMAC:mac/mask] [/SRCIP:ip/mask] [/DESTIP:ip/mask] [/PROTOCOL:tcp|udp|icmpv4|icmpv6|ip|num] [/SRCPORT:start-end] [/DESTPORT:start-end] [/SRCUSERNAME:username] [/DESTUSERNAME:username] [/TCPSTATE:established|unestablished] [/DELAY:delay_millisec] [/JITTER:jitter_percent] [/LOSS:loss_percent] [/REDIRECTURL:url] +CMD_AccessAddEx6_[pass|discard] パケットが、このルールの条件に一致した場合の動作を決定します。pass を指定すると [通過] を、discard を指定すると [破棄] を意味します。遅延・ジッタ・パケットロス設定は、pass の場合のみ適用されます。 +CMD_AccessAddEx6_MEMO ルールの説明 (メモ) を指定します。 +CMD_AccessAddEx6_PRIORITY ルールの優先順位を 1 以上の整数で指定します。優先順位は小さいものほど優先度が高くなります。 +CMD_AccessAddEx6_SRCIP ルールの条件として、送信元 IPv6 アドレスを "IPアドレス/マスク" の形式で指定します。IPv6 アドレスは 2001:200:0:1:: のように 16 進数をコロンで区切って指定します。マスクは ffff:ffff:ffff:ffff:: のように IPv6 形式で区切って指定するか、64 のように先頭からのビット長を 10 進数で指定します。単一の IPv6 ホストを指定するには、マスクを ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff または 128 として指定します。すべての IPv6 ホストを指定するには、"::/0" と指定します。 +CMD_AccessAddEx6_DESTIP ルールの条件として、宛先 IPv6 アドレスを "IPアドレス/マスク" の形式で指定します。指定方法は /SRCIP パラメータと同様です。 +CMD_AccessAddEx6_PROTOCOL ルールの条件として、プロトコルの種類を指定します。IP プロトコル番号を 10 進数で入力するか、"tcp" (TCP/IP プロトコル、6 番)、"udp" (UDP/IP プロトコル、17番)、"icmpv4" (ICMPv4 プロトコル、1 番)、"icmpv6" (ICMPv6 プロトコル、58 番)、"ip" (すべての IP プロトコル、0 番) のキーワードを指定します。すべての IP プロトコルを対象とするには 0 を指定します。 +CMD_AccessAddEx6_SRCPORT プロトコルが TCP/IP または UDP/IP の場合は、ルールの条件として、送信元ポート番号を指定します。それ以外のプロトコルの場合は無視されます。このパラメータを指定しない場合は、すべてのポート番号が対象となります。指定方法は、"1-1024" (1 番以上 1024 番以下)、"23" (23 番のみ) などのように指定します。 +CMD_AccessAddEx6_DESTPORT プロトコルが TCP/IP または UDP/IP の場合は、ルールの条件として、宛先ポート番号を指定します。それ以外のプロトコルの場合は無視されます。指定方法は /SRCPORT パラメータと同様です。 +CMD_AccessAddEx6_SRCUSERNAME ルールの条件として、指定された名前のユーザーまたはグループのセッションによって送信されたパケットのみに、このルールを適用することができます。その場合は、ユーザー名またはグループ名を指定します。 +CMD_AccessAddEx6_DESTUSERNAME ルールの条件として、指定された名前のユーザーまたはグループのセッションが受信するパケットのみに、このルールを適用することができます。その場合は、ユーザー名またはグループ名を指定します。 +CMD_AccessAddEx6_SRCMAC ルールの条件として、送信元 MAC アドレスを指定します。MAC アドレスは 00-AC-84-EA-33-BC/FF-FF-FF-FF-FF-00 のように 16 進数と "-" か ":" の区切り文字を使用して指定します。区切り文字は省略できます。 +CMD_AccessAddEx6_DESTMAC ルールの条件として、宛先 MAC アドレスを指定します。指定方法は、/SRCMAC パラメータと同様です。 +CMD_AccessAddEx6_TCPSTATE ルールの条件として、TCP コネクションの状態を指定します。 Established または Unestablished を指定します。 +CMD_AccessAddEx6_DELAY このルールによってパケットが通過する場合に遅延を発生させることができます。発生させたい遅延時間をミリ秒単位で指定します。無指定または 0 を指定すると、遅延は発生しません。ジッタは 10000 ミリ秒以下である必要があります。 +CMD_AccessAddEx6_JITTER このルールによってパケットが通過する場合にジッタを発生させることができます。遅延の値に対してジッタの揺らぎを 0% ~ 100% のパーセント数値で指定します。無指定または 0 を指定すると、ジッタは発生しません。 +CMD_AccessAddEx6_LOSS このルールによってパケットが通過する場合にパケットロスを発生させることができます。パケットが破棄される可能性を 0% ~ 100% のパーセント数値で指定します。無指定または 0 を指定すると、パケットロスは発生しません。 +CMD_AccessAddEx6_REDIRECTURL HTTP リクエストに対するリダイレクト先の URL を指定することができます。仮想 HUB を経由する TCP コネクションがこのアクセスリストの条件に一致した場合、その TCP コネクションを用いてクライアントが何らかの通信を行おうとすると、設定された URL 文字列をクライアントに対して応答します。これにより、VPN クライアント上で起動している Web ブラウザが特定の IP アドレスにアクセスした場合などに任意の Web ページをその Web ブラウザ上に表示させることができます。 + +CMD_AccessAddEx6_Prompt_DELAY 発生させる遅延 (ミリ秒単位: 0 - 10000): +CMD_AccessAddEx6_Prompt_JITTER 発生させるジッタの揺らぎ (パーセント単位: 0 - 100): +CMD_AccessAddEx6_Prompt_LOSS 発生させるパケットロス率 (パーセント単位: 0 - 100): +CMD_AccessAddEx6_Eval_DELAY 遅延は 0 - 10000 の整数で設定してください。 +CMD_AccessAddEx6_Eval_JITTER ジッタの揺らぎは 0 - 100 の整数で指定してください。 +CMD_AccessAddEx6_Eval_LOSS パケットロス率は 0 - 100 の整数で指定してください。 + + + + + +# AccessList コマンド +CMD_AccessList アクセスリストのルール一覧の取得 +CMD_AccessList_Help 現在管理している仮想 HUB のアクセスリストに登録されている、パケットフィルタルールの一覧を取得します。\nアクセスリストとは、仮想 HUB 内を流れるパケットに対して適用されるパケットフィルタルールの集合です。アクセスリストには複数のルールを登録することができ、ルール毎に優先順位を定義することができます。すべてのパケットは、アクセスリストに登録されているルールで指定された条件に、最初に一致したルールで規定されている動作で、通過または破棄が決定されます。どのルールの条件にも一致しなかったパケットは、暗黙で通過を許可されます。\nこのコマンドは、VPN Bridge では実行できません。\nこのコマンドは、クラスタ内でクラスタメンバサーバーとして動作している VPN Server の仮想 HUB では実行できません。 +CMD_AccessList_Args AccessList + + +# AccessDelete コマンド +CMD_AccessDelete アクセスリストからルールを削除 +CMD_AccessDelete_Help 現在管理している仮想 HUB のアクセスリストに登録されている、パケットフィルタルールを指定して削除します。\nルールを削除するには、そのルールの ID を指定する必要があります。ID は AccessList コマンドで表示できます。\nなお、ルールを削除しなくても一時的に無効化するには AccessDisable コマンドを使用します。\nこのコマンドは、VPN Bridge では実行できません。\nこのコマンドは、クラスタ内でクラスタメンバサーバーとして動作している VPN Server の仮想 HUB では実行できません。 +CMD_AccessDelete_Args AccessDelete [id] +CMD_AccessDelete_[id] 削除するルールの ID またはユニーク ID を指定します。 +CMD_Access_Prompt_ID アクセスリストのルール ID またはユニーク ID: + + +# AccessEnable コマンド +CMD_AccessEnable アクセスリストのルールの有効化 +CMD_AccessEnable_Help 現在管理している仮想 HUB のアクセスリストに登録されているパケットフィルタルールを指定して有効化します。有効化したルールは、パケットフィルタリングに使用されます。\nルールを有効化するには、そのルールの ID を指定する必要があります。ID は AccessList コマンドで表示できます。\nこのコマンドは、VPN Bridge では実行できません。\nこのコマンドは、クラスタ内でクラスタメンバサーバーとして動作している VPN Server の仮想 HUB では実行できません。 +CMD_AccessEnable_Args AccessEnable [id] +CMD_AccessEnable_[id] 有効化するルールの ID を指定します。 + + +# AccessDisable コマンド +CMD_AccessDisable アクセスリストのルールの無効化 +CMD_AccessDisable_Help 現在管理している仮想 HUB のアクセスリストに登録されているパケットフィルタルールを指定して無効化します。無効化したルールは、パケットフィルタリングに使用されなくなります。\nルールを無効化するには、そのルールの ID を指定する必要があります。ID は AccessList コマンドで表示できます。\nこのコマンドは、VPN Bridge では実行できません。\nこのコマンドは、クラスタ内でクラスタメンバサーバーとして動作している VPN Server の仮想 HUB では実行できません。 +CMD_AccessDisable_Args AccessDisable [id] +CMD_AccessDisable_[id] 無効化するルールの ID を指定します。 + + +# UserList コマンド +CMD_UserList ユーザー一覧の取得 +CMD_UserList_Help 現在管理している仮想 HUB の、セキュリティアカウントデータベースに登録されているユーザー一覧を取得します。\nこのコマンドは、VPN Bridge では実行できません。\nこのコマンドは、クラスタ内でクラスタメンバサーバーとして動作している VPN Server の仮想 HUB では実行できません。 +CMD_UserList_Args UserList + + +# UserCreate コマンド +CMD_UserCreate ユーザーの作成 +CMD_UserCreate_Help 現在管理している仮想 HUB の、セキュリティアカウントデータベースに新しいユーザーを作成します。\nユーザーを作成すると、そのユーザーの認証情報に従って、VPN Client がこの仮想 HUB に接続することができるようになります。\nUserCreate コマンドを使用してユーザーを作成した場合、そのユーザーの認証方法は [パスワード認証] として登録され、パスワードとしてランダムな文字列が割り当てられます。したがって、そのユーザーはそのままでは仮想 HUB に接続することはできません。ユーザーを作成した後、必ず UserPasswordSet コマンドでユーザーのパスワードを指定するか、UserAnonymousSet コマンド、UserCertSet コマンド、UserSignedSet コマンド、UserRadiusSet コマンドまたは UserNTLMSet コマンドでユーザーの認証方法を変更してください。\nただし、ユーザー名を "*" (アスタリスク 1 文字) として作成したユーザーは、自動的に RADIUS 認証のユーザーとして登録されます。"*" という名前のユーザーが存在する場合に限り、クライアントが VPN Server に接続した際に提示したユーザー名が既存のユーザー名と一致しないユーザーは、そのユーザーが入力したユーザー名とパスワードによって、RADIUS サーバーまたは NT ドメインコントローラによって認証されることができ、その場合の認証設定やセキュリティポリシーの設定は "*" ユーザーに設定に準拠します。\n一度作成したユーザーのユーザー情報を変更するには、UserSet コマンドを使用します。\nこのコマンドは、VPN Bridge では実行できません。\nこのコマンドは、クラスタ内でクラスタメンバサーバーとして動作している VPN Server の仮想 HUB では実行できません。 +CMD_UserCreate_Args UserCreate [name] [/GROUP:group] [/REALNAME:realname] [/NOTE:note] +CMD_UserCreate_[name] 新しく作成するユーザーのユーザー名を指定します。 +CMD_UserCreate_GROUP ユーザーをグループに参加させる場合、グループ名を指定します。ユーザーをどのグループにも所属させない場合は /GROUP:none と指定します。 +CMD_UserCreate_REALNAME ユーザーの本名を指定します。指定しない場合は、/REALNAME:none と指定します。 +CMD_UserCreate_NOTE ユーザーの説明を指定します。指定しない場合は、/NOTE:none と指定します。 +CMD_UserCreate_Prompt_NAME ユーザー名: +CMD_UserCreate_Prompt_GROUP 参加するグループ名: +CMD_UserCreate_Prompt_REALNAME ユーザーの本名: +CMD_UserCreate_Prompt_NOTE ユーザーの説明: + + +# UserSet コマンド +CMD_UserSet ユーザー情報の変更 +CMD_UserSet_Help 現在管理している仮想 HUB の、セキュリティアカウントデータベースに登録されているユーザーの情報を変更します。\nこのコマンドで変更できるユーザーの情報は、UserCreate コマンドで、新しくユーザーを作成するときに指定する「グループ名」、「本名」および「説明」の 3 項目です。\n現在登録されているユーザーの一覧を取得するには、UserList コマンドを使用してください。\nこのコマンドは、VPN Bridge では実行できません。\nこのコマンドは、クラスタ内でクラスタメンバサーバーとして動作している VPN Server の仮想 HUB では実行できません。 +CMD_UserSet_Args UserSet [name] [/GROUP:group] [/REALNAME:realname] [/NOTE:note] +CMD_UserSet_[name] 設定を変更するユーザー名を指定します。 +CMD_UserSet_GROUP ユーザーをグループに参加させる場合、グループ名を指定します。ユーザーをどのグループにも所属させない場合は /GROUP:none と指定します。 +CMD_UserSet_REALNAME ユーザーの本名を指定します。指定しない場合は、/REALNAME:none と指定します。 +CMD_UserSet_NOTE ユーザーの説明を指定します。指定しない場合は、/NOTE:none と指定します。 + + +# UserDelete コマンド +CMD_UserDelete ユーザーの削除 +CMD_UserDelete_Help 現在管理している仮想 HUB の、セキュリティアカウントデータベースに登録されているユーザーを削除します。ユーザーを削除すると、そのユーザーは仮想 HUB に接続できなくなります。\nUserPolicySet コマンドを使用すると、ユーザーを削除しなくても、一時的にログインを禁止するように設定することができます。\n現在登録されているユーザーの一覧を取得するには、UserList コマンドを使用してください。\nこのコマンドは、VPN Bridge では実行できません。\nこのコマンドは、クラスタ内でクラスタメンバサーバーとして動作している VPN Server の仮想 HUB では実行できません。 +CMD_UserDelete_Args UserDelete [name] +CMD_UserDelete_[name] 削除するユーザー名を指定します。 + + +# UserGet コマンド +CMD_UserGet ユーザー情報の取得 +CMD_UserGet_Help 現在管理している仮想 HUB の、セキュリティアカウントデータベースに登録されているユーザーの登録情報を所得します。\nこのコマンドで取得できる情報は、「ユーザー名」、「本名」、「説明」、「所属グループ」、「有効期限」、「セキュリティポリシー」、「認証方法」、および設定されている認証方法の属性として指定されているパラメータに加えて、そのユーザーの統計データです。\n現在登録されているユーザーの一覧を取得するには、UserList コマンドを使用してください。\nこのコマンドは、VPN Bridge では実行できません。\nこのコマンドは、クラスタ内でクラスタメンバサーバーとして動作している VPN Server の仮想 HUB では実行できません。 +CMD_UserGet_Args UserGet [name] +CMD_UserGet_[name] 情報を取得するユーザー名を指定します。 +CMD_UserGet_Column_Name ユーザー名 +CMD_UserGet_Column_RealName 本名 +CMD_UserGet_Column_Note 説明 +CMD_UserGet_Column_Group グループ名 +CMD_UserGet_Column_Expires 有効期限 +CMD_UserGet_Column_AuthType 認証方法 +CMD_UserGet_Column_UserCert 登録済みユーザー固有証明書 +CMD_UserGet_Column_RadiusAlias 外部認証サーバーの認証ユーザー名 +CMD_UserGet_Column_RootCert_CN 証明書の CN の値の限定 +CMD_UserGet_Column_RootCert_SERIAL 証明書のシリアル番号の限定 +CMD_UserGet_Policy このユーザーに設定されたセキュリティポリシー + + +# UserAnonymousSet コマンド +CMD_UserAnonymousSet ユーザーの認証方法を匿名認証に設定 +CMD_UserAnonymousSet_Help 現在管理している仮想 HUB の、セキュリティアカウントデータベースに登録されているユーザーの認証方法を「匿名認証」に設定します。匿名認証に設定されたユーザーのユーザー名で仮想 HUB に接続した VPN Client は、いかなるユーザー認証も受けずに無条件で仮想 HUB に接続することができます。匿名認証機能は、インターネットなどで広く誰でも接続できるような設定で公開する VPN Server に最適です。\n現在登録されているユーザーの一覧を取得するには、UserList コマンドを使用してください。\nこのコマンドは、VPN Bridge では実行できません。\nこのコマンドは、クラスタ内でクラスタメンバサーバーとして動作している VPN Server の仮想 HUB では実行できません。 +CMD_UserAnonymousSet_Args UserAnonymousSet [name] +CMD_UserAnonymousSet_[name] 設定を変更するユーザー名を指定します。 + + +# UserPasswordSet コマンド +CMD_UserPasswordSet ユーザーの認証方法をパスワード認証に設定しパスワードを設定 +CMD_UserPasswordSet_Help 現在管理している仮想 HUB の、セキュリティアカウントデータベースに登録されているユーザーの認証方法を「パスワード認証」に設定します。パスワード認証とは、仮想 HUB のセキュリティアカウントデータベース内のユーザー オブジェクトに対して任意のパスワードを設定しておき、そのユーザー名でユーザーが仮想 HUB に接続しようとした際にパスワードの入力を求め、そのパスワードが一致した場合に接続を許可する認証方法です。\n実際には、ユーザーのパスワードはハッシュ化され保存されるので、VPN Server の設定ファイルを解析しても元のパスワードはわかりません。\n現在登録されているユーザーの一覧を取得するには、UserList コマンドを使用してください。\nこのコマンドは、VPN Bridge では実行できません。\nこのコマンドは、クラスタ内でクラスタメンバサーバーとして動作している VPN Server の仮想 HUB では実行できません。 +CMD_UserPasswordSet_Args UserPasswordSet [name] [/PASSWORD:password] +CMD_UserPasswordSet_[name] 設定を変更するユーザー名を指定します。 +CMD_UserPasswordSet_PASSWORD ユーザーに対して設定するパスワードを指定します。このパラメータを指定しない場合は、パスワードを入力するプロンプトが表示されます。 + + +# UserCertSet コマンド +CMD_UserCertSet ユーザーの認証方法を固有証明書認証に設定し証明書を設定 +CMD_UserCertSet_Help 現在管理している仮想 HUB の、セキュリティアカウントデータベースに登録されているユーザーの認証方法を「固有証明書認証」に設定します。固有証明書認証とは、仮想 HUB のセキュリティアカウントデータベース内のユーザー オブジェクトに対して 1 つの X.509 証明書を設定しておき、そのユーザー名でユーザーが仮想 HUB に接続しようとした際に、提示した証明書が登録されている証明書と一致し、かつクライアントがその証明書に対応する秘密鍵を保持しているかを RSA アルゴリズムで検証することによって接続を許可する認証方法です。\n現在登録されているユーザーの一覧を取得するには、UserList コマンドを使用してください。\nこのコマンドは、VPN Bridge では実行できません。\nこのコマンドは、クラスタ内でクラスタメンバサーバーとして動作している VPN Server の仮想 HUB では実行できません。 +CMD_UserCertSet_Args UserCertSet [name] [/LOADCERT:cert] +CMD_UserCertSet_[name] 設定を変更するユーザー名を指定します。 +CMD_UserCertSet_LOADCERT ユーザーに対して設定する証明書を X.509 証明書ファイル名で指定します。 + + +# UserCertGet コマンド +CMD_UserCertGet 固有証明書認証のユーザーの登録されている証明書の取得 +CMD_UserCertGet_Help 現在管理している仮想 HUB の、セキュリティアカウントデータベースに登録されている「固有証明書認証」のユーザーに対して設定されている X.509 形式の証明書を取得し、ファイルに保存します。\n指定したユーザーが「固有証明書認証」として設定されていない場合は、エラーが発生します。\n現在登録されているユーザーの一覧を取得するには、UserList コマンドを使用してください。\nこのコマンドは、VPN Bridge では実行できません。\nこのコマンドは、クラスタ内でクラスタメンバサーバーとして動作している VPN Server の仮想 HUB では実行できません。 +CMD_UserCertGet_Args UserCertGet [name] [/SAVECERT:cert] +CMD_UserCertGet_[name] 情報を取得するユーザー名を指定します。 +CMD_UserCertGet_SAVECERT 取得したユーザーの証明書を X.509 形式で保存するファイル名を指定します。 +CMD_UserCertGet_Not_Cert ユーザーは固有証明書認証でないか、固有証明書が設定されていません。 + + +# UserSignedSet コマンド +CMD_UserSignedSet ユーザーの認証方法を署名済み証明書認証に設定 +CMD_UserSignedSet_Help 現在管理している仮想 HUB の、セキュリティアカウントデータベースに登録されているユーザーの認証方法を「署名済み証明書認証」に設定します。署名済み証明書認証に設定されているユーザー名で、ユーザーが仮想 HUB に接続した際に、ユーザーが提示した証明書がその仮想 HUB の信頼する証明機関の証明書の一覧内の証明書のいずれかによって署名されているかどうかが検査され、かつクライアントがその証明書に対応する秘密鍵を保持しているかを RSA アルゴリズムで検証することによって接続を許可する認証方法です。\nまた、ユーザーごとに期待する証明書の Common Name (CN)、およびシリアル番号を登録しておき、前記の検証を通過した後証明書の内容が設定された値に一致した場合にのみ接続を許可するようにする設定も可能です。\n現在登録されているユーザーの一覧を取得するには、UserList コマンドを使用してください。\nこのコマンドは、VPN Bridge では実行できません。\nこのコマンドは、クラスタ内でクラスタメンバサーバーとして動作している VPN Server の仮想 HUB では実行できません。 +CMD_UserSignedSet_Args UserSignedSet [name] [/CN:cn] [/SERIAL:serial] +CMD_UserSignedSet_[name] 設定を変更するユーザー名を指定します。 +CMD_UserSignedSet_CN このパラメータを指定した場合は、ユーザーが提示した証明書が信頼できる証明機関によって署名されているかどうかを検証した後に、その証明書の Common Name (CN) の値を、このパラメータによって設定された値と比較して一致している場合のみ接続を許可します。"none" を指定した場合は、このチェックは行われません。 +CMD_UserSignedSet_SERIAL このパラメータを指定した場合は、ユーザーが提示した証明書が信頼できる証明機関によって署名されているかどうかを検証した後に、その証明書のシリアル番号の値を、このパラメータによって設定された値と比較して一致している場合のみ接続を許可します。"none" を指定した場合は、このチェックは行われません。 +CMD_UserSignedSet_Prompt_CN Common Name (CN) の値を限定: +CMD_UserSignedSet_Prompt_SERIAL シリアル番号の値を限定: + + +# UserRadiusSet コマンド +CMD_UserRadiusSet ユーザーの認証方法を RADIUS 認証に設定 +CMD_UserRadiusSet_Help 現在管理している仮想 HUB の、セキュリティアカウントデータベースに登録されているユーザーの認証方法を「RADIUS 認証」に設定します。RADIUS 認証に設定されているユーザー名でユーザーが仮想 HUB に接続した際に、ユーザー名とユーザーが入力したパスワードが RADIUS サーバーに送信され、RADIUS サーバーがユーザー名とパスワードのチェックを行った後に認証が成功すると、そのユーザーの VPN 接続が許可されます。\nRadius 認証を使用するには、あらかじめ RadiusServerSet コマンドを使用して使用する RADIUS サーバーを仮想 HUB に設定しておく必要があります。\n現在登録されているユーザーの一覧を取得するには、UserList コマンドを使用してください。\nこのコマンドは、VPN Bridge では実行できません。\nこのコマンドは、クラスタ内でクラスタメンバサーバーとして動作している VPN Server の仮想 HUB では実行できません。 +CMD_UserRadiusSet_Args UserRadiusSet [name] [/ALIAS:alias_name] +CMD_UserRadiusSet_[name] 設定を変更するユーザー名を指定します。 +CMD_UserRadiusSet_ALIAS このパラメータが設定されている場合、RADIUS サーバーに対して送信されるユーザー名を、仮想 HUB 上のユーザー名とは別のユーザー名にすることが可能です。設定しない場合は、/ALIAS:none と指定してください (仮想 HUB 上のユーザー名が使用されます)。ユーザー名が "*" の場合は /ALIAS パラメータは無視されます。"*" ユーザーについての説明は、UserCreate /HELP と入力すると表示されます。 +CMD_UserRadiusSet_Prompt_ALIAS 認証用エイリアス名 (オプション): + + +# UserNTLMSet コマンド +CMD_UserNTLMSet ユーザーの認証方法を NT ドメイン認証に設定 +CMD_UserNTLMSet_Help 現在管理している仮想 HUB の、セキュリティアカウントデータベースに登録されているユーザーの認証方法を「NT ドメイン認証」に設定します。NT ドメイン認証に設定されているユーザー名でユーザーが仮想 HUB に接続した際に、ユーザー名とユーザーが入力したパスワードが Windows NT / 2000 / Server 2003 / Server 2008 / Server 2008 R2 / Server 2012 のドメインコントローラ、または Active Directory サーバーに送信され、認証サーバーがユーザー名とパスワードのチェックを行った後に認証が成功すると、そのユーザーの VPN 接続が許可されます。\nNT ドメイン認証を使用するには、VPN Server がそのドメインに接続されているオペレーティングシステム上で動作している必要があります。詳しくは VPN Server の管理者にお問い合わせください。\n現在登録されているユーザーの一覧を取得するには、UserList コマンドを使用してください。\nこのコマンドは、VPN Bridge では実行できません。\nこのコマンドは、クラスタ内でクラスタメンバサーバーとして動作している VPN Server の仮想 HUB では実行できません。 +CMD_UserNTLMSet_Args UserNTLMSet [name] [/ALIAS:alias_name] +CMD_UserNTLMSet_[name] 設定を変更するユーザー名を指定します。 +CMD_UserNTLMSet_ALIAS このパラメータが設定されている場合、NT ドメインまたは Active Directory に対して送信されるユーザー名を、仮想 HUB 上のユーザー名とは別のユーザー名にすることが可能です。設定しない場合は、/ALIAS:none と指定してください (仮想 HUB 上のユーザー名が使用されます)。ユーザー名が "*" の場合は /ALIAS パラメータは無視されます。"*" ユーザーについての説明は、UserCreate /HELP と入力すると表示されます。 + + +# UserPolicyRemove コマンド +CMD_UserPolicyRemove ユーザーのセキュリティポリシーの削除 +CMD_UserPolicyRemove_Help 現在管理している仮想 HUB の、セキュリティアカウントデータベースに登録されているユーザーに対して設定されている、セキュリティポリシーの設定を削除します。セキュリティポリシーの設定が削除されているユーザーは、そのユーザーが所属しているグループのセキュリティポリシーの設定が適用されます。グループに所属していないか、グループにセキュリティポリシーが設定されていない場合は、デフォルトの値 (アクセスを許可: 有効、TCP 接続数の最大値: 32 個、タイムアウト時間: 20 秒) に従います。\n現在登録されているユーザーの一覧を取得するには、UserList コマンドを使用してください。\nこのコマンドは、VPN Bridge では実行できません。\nこのコマンドは、クラスタ内でクラスタメンバサーバーとして動作している VPN Server の仮想 HUB では実行できません。 +CMD_UserPolicyRemove_Args UserPolicyRemove [name] +CMD_UserPolicyRemove_[name] 設定を変更するユーザー名を指定します。 + + +# UserPolicySet コマンド +CMD_UserPolicySet ユーザーのセキュリティポリシーの設定 +CMD_UserPolicySet_Help 現在管理している仮想 HUB の、セキュリティアカウントデータベースに登録されているユーザーに対して設定されているセキュリティポリシーの内容を変更します。\nユーザーにセキュリティポリシーが設定されていない場合は、新しいデフォルトのセキュリティポリシーを設定してから、指定された値を変更します。\n現在登録されているユーザーの一覧を取得するには、UserList コマンドを使用してください。\nこのコマンドは、VPN Bridge では実行できません。\nこのコマンドは、クラスタ内でクラスタメンバサーバーとして動作している VPN Server の仮想 HUB では実行できません。 +CMD_UserPolicySet_Args UserPolicySet [name] [/NAME:policy_name] [/VALUE:num|yes|no] +CMD_UserPolicySet_[name] 設定を変更するユーザー名を指定します。 +CMD_UserPolicySet_NAME 値を変更するポリシーの名前を指定します。ポリシーの名前と設定できる値の一覧は PolicyList コマンドで表示することができます。 +CMD_UserPolicySet_VALUE ポリシーの新しい値を指定します。そのポリシーが数値型の場合は整数を指定します。ブール型の場合は yes または no を指定します。設定できる型と値は、PolicyList コマンドで表示することができます。 + + +# UserExpiresSet コマンド +CMD_UserExpiresSet ユーザーの有効期限の設定 +CMD_UserExpiresSet_Help 現在管理している仮想 HUB の、セキュリティアカウントデータベースに登録されているユーザーの有効期限を設定します。有効期限が終了したユーザーは、仮想 HUB に接続できなくなります。\n現在登録されているユーザーの一覧を取得するには、UserList コマンドを使用してください。\nこのコマンドは、VPN Bridge では実行できません。\nこのコマンドは、クラスタ内でクラスタメンバサーバーとして動作している VPN Server の仮想 HUB では実行できません。 +CMD_UserExpiresSet_Args UserExpiresSet [name] [/EXPIRES:expires] +CMD_UserExpiresSet_[name] 設定を変更するユーザー名を指定します。 +CMD_UserExpiresSet_EXPIRES ユーザーの有効期限の日時を指定します。"2005/10/08 19:30:00" のように、年・月・日・時・分・秒 の 6 個の整数をスペース、スラッシュまたはコロンで区切って指定してください。年は 4 桁で指定してください。値にスペースを入れる場合は、値全体を "" で囲む必要があります。指定はローカル時刻 (コマンドライン管理ユーティリティを実行しているコンピュータの基準時刻) で指定できます。/EXPIRES:none と指定すると、有効期限は解除されます。 +CMD_UserExpiresSet_Prompt_EXPIRES ユーザーの有効期限 (無指定で無期限): + + +# GroupList コマンド +CMD_GroupList グループ一覧の取得 +CMD_GroupList_Help 現在管理している仮想 HUB の、セキュリティアカウントデータベースに登録されているグループ一覧を取得します。\nこのコマンドは、VPN Bridge では実行できません。\nこのコマンドは、クラスタ内でクラスタメンバサーバーとして動作している VPN Server の仮想 HUB では実行できません。 +CMD_GroupList_Args GroupList + + +# GroupCreate コマンド +CMD_GroupCreate グループの作成 +CMD_GroupCreate_Help 現在管理している仮想 HUB の、セキュリティアカウントデータベースに新しいグループを作成します。\nグループには複数のユーザーを登録することができます。グループにユーザーを登録するには、GroupJoin コマンドを使用します。\nこのコマンドは、VPN Bridge では実行できません。\nこのコマンドは、クラスタ内でクラスタメンバサーバーとして動作している VPN Server の仮想 HUB では実行できません。 +CMD_GroupCreate_Args GroupCreate [name] [/REALNAME:realname] [/NOTE:note] +CMD_GroupCreate_[name] 作成するグループ名を指定します。 +CMD_GroupCreate_REALNAME グループの本名を指定します。たとえば、グループが実際の部課名に対応する場合は、その名前を指定します。指定しない場合は、/REALNAME:none と指定します。 +CMD_GroupCreate_NOTE グループの説明を指定します。指定しない場合は、/NOTE:none と指定します。 +CMD_GroupCreate_Prompt_NAME グループ名: +CMD_GroupCreate_Prompt_REALNAME グループの本名: +CMD_GroupCreate_Prompt_NOTE グループの説明: + + +# GroupSet コマンド +CMD_GroupSet グループ情報の設定 +CMD_GroupSet_Help 現在管理している仮想 HUB の、セキュリティアカウントデータベースに登録されているグループの情報を設定します。\n現在登録されているグループの一覧を取得するには、GroupList コマンドを使用してください。\nこのコマンドは、VPN Bridge では実行できません。\nこのコマンドは、クラスタ内でクラスタメンバサーバーとして動作している VPN Server の仮想 HUB では実行できません。 +CMD_GroupSet_Args GroupSet [name] [/REALNAME:realname] [/NOTE:note] +CMD_GroupSet_[name] 設定を変更するグループ名を指定します。 +CMD_GroupSet_REALNAME グループの本名を指定します。たとえば、グループが実際の部課名に対応する場合は、その名前を指定します。指定しない場合は、/REALNAME:none と指定します。 +CMD_GroupSet_NOTE グループの説明を指定します。指定しない場合は、/NOTE:none と指定します。 + + +# GroupDelete コマンド +CMD_GroupDelete グループの削除 +CMD_GroupDelete_Help 現在管理している仮想 HUB の、セキュリティアカウントデータベースに登録されているグループを削除します。\nグループを削除すると、そのグループに所属していたユーザーはすべて無所属になります。\n現在登録されているグループの一覧を取得するには、GroupList コマンドを使用してください。\nこのコマンドは、VPN Bridge では実行できません。\nこのコマンドは、クラスタ内でクラスタメンバサーバーとして動作している VPN Server の仮想 HUB では実行できません。 +CMD_GroupDelete_Args GroupDelete [name] +CMD_GroupDelete_[name] 削除するグループ名を指定します + + +# GroupGet コマンド +CMD_GroupGet グループ情報と所属しているユーザー一覧の取得 +CMD_GroupGet_Help 現在管理している仮想 HUB の、セキュリティアカウントデータベースに登録されているグループの情報と、そのグループに所属しているユーザーの一覧を取得します。\n現在登録されているグループの一覧を取得するには、GroupList コマンドを使用してください。\nこのコマンドは、VPN Bridge では実行できません。\nこのコマンドは、クラスタ内でクラスタメンバサーバーとして動作している VPN Server の仮想 HUB では実行できません。 +CMD_GroupGet_Args GroupGet [name] +CMD_GroupGet_[name] 情報を取得するグループ名を指定します。 +CMD_GroupGet_Column_NAME グループ名 +CMD_GroupGet_Column_REALNAME 本名 +CMD_GroupGet_Column_NOTE 説明 +CMD_GroupGet_Column_POLICY このグループに設定されているセキュリティポリシー +CMD_GroupGet_Column_MEMBERS このグループに所属しているユーザー名の一覧 + + +# GroupJoin コマンド +CMD_GroupJoin グループにユーザーを追加 +CMD_GroupJoin_Help 現在管理している仮想 HUB の、セキュリティアカウントデータベースに登録されているグループに、セキュリティアカウントデータベース内のユーザーを追加します。\n現在登録されているユーザーとグループの一覧は、UserList コマンドと GroupList コマンドで取得できます。\nこのコマンドは、VPN Bridge では実行できません。\nこのコマンドは、クラスタ内でクラスタメンバサーバーとして動作している VPN Server の仮想 HUB では実行できません。 +CMD_GroupJoin_Args GroupJoin [name] [/USERNAME:username] +CMD_GroupJoin_[name] ユーザーを追加するグループ名を指定します。 +CMD_GroupJoin_USERNAME name で指定したグループに追加するユーザー名を指定します。 +CMD_GroupJoin_Prompt_USERNAME グループに参加させるユーザー名: + + +# GroupUnjoin コマンド +CMD_GroupUnjoin グループからユーザーを削除 +CMD_GroupUnjoin_Help 現在管理している仮想 HUB の、セキュリティアカウントデータベースに登録されているグループから、指定したユーザーを削除します。グループからユーザーが削除されると、そのユーザーは無所属となります。\nグループに現在所属しているユーザーの一覧を取得するには、GroupGet コマンドを使用します。\n現在登録されているグループの一覧を取得するには、GroupList コマンドを使用してください。\nこのコマンドは、VPN Bridge では実行できません。\nこのコマンドは、クラスタ内でクラスタメンバサーバーとして動作している VPN Server の仮想 HUB では実行できません。 +CMD_GroupUnjoin_Args GroupUnjoin [name] +CMD_GroupUnjoin_[name] グループから削除するユーザー名を指定します。 +CMD_GroupUnjoin_Prompt_name グループから削除するユーザー名: + + +# GroupPolicyRemove コマンド +CMD_GroupPolicyRemove グループのセキュリティポリシーの削除 +CMD_GroupPolicyRemove_Help 現在管理している仮想 HUB の、セキュリティアカウントデータベースに登録されているグループに対して設定されているセキュリティポリシーの設定を削除します。所属しているグループにもユーザー本体にもセキュリティポリシーが設定されていないユーザーは、デフォルトの値 (アクセスを許可: 有効、TCP 接続数の最大値: 32 個、タイムアウト時間: 20 秒) に従います。\n現在登録されているグループの一覧を取得するには、GroupList コマンドを使用してください。\nこのコマンドは、VPN Bridge では実行できません。\nこのコマンドは、クラスタ内でクラスタメンバサーバーとして動作している VPN Server の仮想 HUB では実行できません。 +CMD_GroupPolicyRemove_Args GroupPolicyRemove [name] +CMD_GroupPolicyRemove_[name] 設定を変更するグループ名を指定します。 + + +# GroupPolicySet コマンド +CMD_GroupPolicySet グループのセキュリティポリシーの設定 +CMD_GroupPolicySet_Help 現在管理している仮想 HUB の、セキュリティアカウントデータベースに登録されているグループに対して設定されているセキュリティポリシーの内容を変更します。\nグループにセキュリティポリシーが設定されていない場合は、新しいデフォルトのセキュリティポリシーを設定してから、指定された値を変更します。\n現在登録されているグループの一覧を取得するには、GroupList コマンドを使用してください。\nこのコマンドは、VPN Bridge では実行できません。\nこのコマンドは、クラスタ内でクラスタメンバサーバーとして動作している VPN Server の仮想 HUB では実行できません。 +CMD_GroupPolicySet_Args GroupPolicySet [name] [/NAME:policy_name] [/VALUE:num|yes|no] +CMD_GroupPolicySet_[name] 設定を変更するグループ名を指定します。 +CMD_GroupPolicySet_NAME 値を変更するポリシーの名前を指定します。ポリシーの名前と設定できる値の一覧は、PolicyList コマンドで表示することができます。 +CMD_GroupPolicySet_VALUE ポリシーの新しい値を指定します。そのポリシーが数値型の場合は整数を指定します。ブール型の場合は yes または no を指定します。設定できる型と値は、PolicyList コマンドで表示することができます。 + + +# SessionList コマンド +CMD_SessionList 接続中のセッション一覧の取得 +CMD_SessionList_Help 現在管理している仮想 HUB に接続中のセッション一覧を取得します。セッション一覧には、各コネクションごとの [セッション名]、[セッションの場所]、[ユーザー名]、[接続元ホスト名]、[TCP コネクション]、[転送バイト数]、[転送パケット数] が表示されます。\n現在接続中の VPN Server がクラスタコントローラで、管理している仮想 HUB がスタティック仮想 HUB の場合は、すべてのクラスタメンバの当該仮想 HUB に接続しているセッション一覧がすべて結合されて取得されます。\nそれ以外の場合は、現在管理している VPN Server に実際に接続しているセッション一覧のみが取得されます。 +CMD_SessionList_Args SessionList + + +# SessionGet コマンド +CMD_SessionGet セッション情報の取得 +CMD_SessionGet_Help 現在管理している仮想 HUB に接続中のセッションを指定して、そのセッションの情報を取得します。セッション情報には、接続元ホスト名やユーザー名、バージョン情報、時刻情報、TCP コネクション数、通信パラメータ、セッションキー、送受信したデータの統計情報、その他のクライアントやサーバーの情報などが含まれます。\n現在接続中のセッション一覧を取得するには、SessionList コマンドを使用してください。 +CMD_SessionGet_Args SessionGet [name] +CMD_SessionGet_[name] 情報を取得するセッション名を指定します。 +CMD_SessionGet_Prompt_NAME セッション名: + + +# SessionDisconnect コマンド +CMD_SessionDisconnect セッションの切断 +CMD_SessionDisconnect_Help 現在管理している仮想 HUB に接続中のセッションを指定して、そのセッションを管理者権限で強制切断します。\nただし、接続元のクライアント側の設定で通信が切断された場合は自動的に再接続するオプションが有効になっている場合、クライアントはもう一度接続してくる可能性があります。\n現在接続中のセッション一覧を取得するには、SessionList コマンドを使用してください。 +CMD_SessionDisconnect_Args SessionDisconnect [name] +CMD_SessionDisconnect_[name] 切断するセッション名を指定します。 + + +# MacTable コマンド +CMD_MacTable MAC アドレステーブルデータベースの取得 +CMD_MacTable_Help 現在管理している仮想 HUB が保持している MAC アドレステーブルデータベースを取得します。\nMAC アドレステーブルデータベースは、仮想 HUB が Ethernet フレームのスイッチング動作を行うために必要なテーブルで、仮想 HUB は MAC アドレステーブルデータベースに基づいて、各 Ethernet フレームの振り分け先セッションを決定します。MAC アドレスデータベースは、仮想 HUB が流れる通信の内容を自動的に分析して構築します。\nセッション名を指定して、そのセッションに関連付けられている MAC アドレステーブルエントリを取得することもできます。 +CMD_MacTable_Args MacTable [session_name] +CMD_MacTable_[session_name] 引数としてセッション名を指定すると、そのセッションに関連付けられている MAC アドレステーブルエントリのみを表示します。指定しない場合は、すべてのエントリが表示されます。 + + +# MacDelete コマンド +CMD_MacDelete MAC アドレステーブルエントリの削除 +CMD_MacDelete_Help 現在管理している仮想 HUB が保持している MAC アドレステーブルデータベースを操作し、指定された MAC アドレステーブルエントリをデータベースから削除します。\n現在の MAC アドレステーブルデータベースの内容を取得するには、MacTable コマンドを使用してください。 +CMD_MacDelete_Args MacDelete [id] +CMD_MacDelete_[id] 削除する MAC アドレステーブルエントリの ID を指定します。 +CMD_MacDelete_Prompt 削除する ID: + + +# IpTable コマンド +CMD_IpTable IP アドレステーブルデータベースの取得 +CMD_IpTable_Help 現在管理している仮想 HUB が保持している IP アドレステーブルデータベースを取得します。\nIP アドレステーブルデータベースは、どのセッションがどの IP アドレスを使用しているかを常に仮想 HUB が把握するために、自動的に通信内容を分析して生成されるテーブルで、仮想 HUB のセキュリティポリシー適用エンジンによって頻繁に使用されています。\nセッション名を指定して、そのセッションに関連付けられている IP アドレステーブルエントリを取得することもできます。 +CMD_IpTable_Args IpTable [session_name] +CMD_IpTable_[session_name] 引数としてセッション名を指定すると、そのセッションに関連付けられている IP アドレステーブルエントリのみを表示します。指定しない場合は、すべてのエントリが表示されます。 + + +# IpDelete コマンド +CMD_IpDelete IP アドレステーブルエントリの削除 +CMD_IpDelete_Help 現在管理している仮想 HUB が保持している IP アドレステーブルデータベースを操作し、指定された IP アドレステーブルエントリをデータベースから削除します。\n現在の IP アドレステーブルデータベースの内容を取得するには、IpTable コマンドを使用してください。 +CMD_IpDelete_Args IpDelete [id] +CMD_IpDelete_[id] 削除する IP アドレステーブルエントリの ID を指定します。 + + +# SecureNatEnable コマンド +CMD_SecureNatEnable 仮想 NAT および DHCP サーバー機能 (SecureNAT 機能) の有効化 +CMD_SecureNatEnable_Help 現在管理している仮想 HUB 内で、仮想 NAT および DHCP サーバー機能 (SecureNAT 機能) を有効化し、動作を開始します。このコマンドを実行する前に、必ず SecureNatHostGet コマンド、NatGet コマンドおよび DhcpGet コマンドで、現在の仮想 NAT 機能および DHCP サーバー機能の設定内容を確認してください。\nSecureNAT 機能を有効にすると、仮想 HUB 内の仮想ネットワークにおいて NAT ルータ (IP マスカレード) や DHCP サーバー機能を仮想的に動作させることができるようになります。\n\n[SecureNAT 機能に関する警告]\nSecureNAT 機能はシステム管理者やネットワークに関して詳しい知識のある方向けの機能です。\nSecureNAT 機能を正しく使用すると、VPN を経由した安全なリモートアクセスが実現できます。しかし、誤った方法で使用すると、ネットワーク全体を危険な状態にする可能性もあります。ネットワークに関する十分な知識をお持ちでない場合や、ネットワーク管理者の許可を得ていない場合は、SecureNAT 機能を有効にしないでください。SecureNAT 機能に関する詳しい説明は、VPN Server のマニュアルやオンラインドキュメントを参照してください。\nこのコマンドは、クラスタとして動作している VPN Server の仮想 HUB では実行できません。 +CMD_SecureNatEnable_Args SecureNatEnable + + +# SecureNatDisable コマンド +CMD_SecureNatDisable 仮想 NAT および DHCP サーバー機能 (SecureNAT 機能) の無効化 +CMD_SecureNatDisable_Help 現在管理している仮想 HUB 内で、仮想 NAT および DHCP サーバー機能 (SecureNAT 機能) を無効化します。このコマンドを実行すると、仮想 NAT 機能は直ちに動作を停止し、仮想 DHCP サーバー機能は保持している DHCP リースデータベースを削除しサービスを停止します。\nこのコマンドは、クラスタとして動作している VPN Server の仮想 HUB では実行できません。 +CMD_SecureNatDisable_Args SecureNatDisable + + +# SecureNatStatusGet コマンド +CMD_SecureNatStatusGet 仮想 NAT および DHCP サーバー機能 (SecureNAT 機能) の動作状況の取得 +CMD_SecureNatStatusGet_Help 現在管理している仮想 HUB 内で、仮想 NAT および DHCP サーバー機能 (SecureNAT 機能) が動作している場合は、その動作状況を取得します。\nこのコマンドは、クラスタとして動作している VPN Server の仮想 HUB では実行できません。 +CMD_SecureNatStatusGet_Args SecureNatStatusGet + + +# SecureNatHostGet コマンド +CMD_SecureNatHostGet SecureNAT 機能の仮想ホストのネットワークインターフェイス設定の取得 +CMD_SecureNatHostGet_Help 現在管理している仮想 HUB 内で、仮想 NAT および DHCP サーバー機能 (SecureNAT 機能) の設定項目の内、仮想ホストのネットワークインターフェイスの設定を取得します。\nSecureNAT 機能は、仮想 HUB の内部で、L2 セグメント内で 1 枚の仮想的な LAN カードを持ち、MAC アドレスと IP アドレスを割り当てられます。これによって、同一 L2 セグメントに接続している他のホストは、まるで実際の IP ホストがネットワーク上に存在しているかのように SecureNAT の仮想ホストと通信することが可能になります。\n\n[SecureNAT 機能に関する警告]\nSecureNAT 機能はシステム管理者やネットワークに関して詳しい知識のある方向けの機能です。\nSecureNAT 機能を正しく使用すると、VPN を経由した安全なリモートアクセスが実現できます。しかし、誤った方法で使用すると、ネットワーク全体を危険な状態にする可能性もあります。ネットワークに関する十分な知識をお持ちでない場合や、ネットワーク管理者の許可を得ていない場合は、SecureNAT 機能を有効にしないでください。SecureNAT 機能に関する詳しい説明は、VPN Server のマニュアルやオンラインドキュメントを参照してください。\nこのコマンドは、クラスタとして動作している VPN Server の仮想 HUB では実行できません。 +CMD_SecureNatHostGet_Args SecureNatHostGet +CMD_SecureNatHostGet_Column_MAC MAC アドレス +CMD_SecureNatHostGet_Column_IP IP アドレス +CMD_SecureNatHostGet_Column_MASK サブネットマスク +CMD_SecureNatHostGet_Column_LOG NAT および DHCP の動作のログ保存 + + +# SecureNatHostSet コマンド +CMD_SecureNatHostSet SecureNAT 機能の仮想ホストのネットワークインターフェイス設定の変更 +CMD_SecureNatHostSet_Help 現在管理している仮想 HUB 内で、仮想 NAT および DHCP サーバー機能 (SecureNAT 機能) の設定項目の内、仮想ホストのネットワークインターフェイスの設定を変更して保存します。\nSecureNAT 機能は、仮想 HUB の内部で、L2 セグメント内で 1 枚の仮想的な LAN カードを持ち、MAC アドレスと IP アドレスを割り当てられます。これによって、同一 L2 セグメントに接続している他のホストは、まるで実際の IP ホストがネットワーク上に存在しているかのように SecureNAT の仮想ホストと通信することが可能になります。\n\n[SecureNAT 機能に関する警告]\nSecureNAT 機能はシステム管理者やネットワークに関して詳しい知識のある方向けの機能です。\nSecureNAT 機能を正しく使用すると、VPN を経由した安全なリモートアクセスが実現できます。しかし、誤った方法で使用すると、ネットワーク全体を危険な状態にする可能性もあります。ネットワークに関する十分な知識をお持ちでない場合や、ネットワーク管理者の許可を得ていない場合は、SecureNAT 機能を有効にしないでください。SecureNAT 機能に関する詳しい説明は、VPN Server のマニュアルやオンラインドキュメントを参照してください。\nこのコマンドは、クラスタとして動作している VPN Server の仮想 HUB では実行できません。 +CMD_SecureNatHostSet_Args SecureNatHostSet [/MAC:mac] [/IP:ip] [/MASK:mask] +CMD_SecureNatHostSet_MAC 仮想インターフェイスに割り当てる MAC アドレスを指定します。MAC アドレスは "00-AC-01-23-45-67" のように文字列で指定します。/MAC:none を指定すると、現在の設定を変更しません。 +CMD_SecureNatHostSet_IP 仮想インターフェイスに割り当てる IP アドレスを指定します。/IP:none を指定すると、現在の設定を変更しません。 +CMD_SecureNatHostSet_MASK 仮想インターフェイスに割り当てるサブネットマスクを指定します。/MASK:none を指定すると、現在の設定を変更しません。 +CMD_SecureNatHostSet_Prompt_MAC MAC アドレス: +CMD_SecureNatHostSet_Prompt_IP IP アドレス: +CMD_SecureNatHostSet_Prompt_MASK サブネットマスク: + + +# NatGet コマンド +CMD_NatGet SecureNAT 機能の仮想 NAT 機能の設定の取得 +CMD_NatGet_Help 現在管理している仮想 HUB 内で、仮想 NAT および DHCP サーバー機能 (SecureNAT 機能) の設定項目の内、仮想 NAT の設定を取得します。\nこのコマンドは、クラスタとして動作している VPN Server の仮想 HUB では実行できません。 +CMD_NatGet_Args NatGet +CMD_NatGet_Column_USE 仮想 NAT 機能を使用する +CMD_NetGet_Column_MTU MTU 値 +CMD_NatGet_Column_TCP TCP セッションのタイムアウト (秒) +CMD_NatGet_Column_UDP UDP セッションのタイムアウト (秒) + + +# NatEnable コマンド +CMD_NatEnable SecureNAT 機能の仮想 NAT 機能の有効化 +CMD_NatEnable_Help 現在管理している仮想 HUB 内で、仮想 NAT 機能を有効にします。\nこのコマンドを用いて仮想 NAT 機能を有効にしても、SecureNAT 機能が動作していない場合は、仮想 NAT は動作しません。SecureNAT 機能の動作を開始するには、SecureNatEnable コマンドを使用します。\nこのコマンドは、クラスタとして動作している VPN Server の仮想 HUB では実行できません。 +CMD_NatEnable_Args NatEnable + + +# NatDisable コマンド +CMD_NatDisable SecureNAT 機能の仮想 NAT 機能の無効化 +CMD_NatDisable_Help 現在管理している仮想 HUB 内で、仮想 NAT 機能を無効にします。\nこのコマンドは、クラスタとして動作している VPN Server の仮想 HUB では実行できません。 +CMD_NatDisable_Args NatDisable + + +# NatSet コマンド +CMD_NatSet SecureNAT 機能の仮想 NAT 機能の設定の変更 +CMD_NatSet_Help 現在管理している仮想 HUB 内の仮想 NAT の設定を変更します。仮想 NAT の設定には、MTU 値、TCP セッションのタイムアウト時間、UDP セッションのタイムアウト時間が含まれます。\nこのコマンドは、クラスタとして動作している VPN Server の仮想 HUB では実行できません。 +CMD_NatSet_Args NatSet [/MTU:mtu] [/TCPTIMEOUT:tcp_timeout] [/UDPTIMEOUT:udp_timeout] [/LOG:yes|no] +CMD_NatSet_MTU MTU (最大転送可能ユニットサイズ) を、バイト数単位の整数で設定します。この値は、仮想 NAT が送出する Ethernet フレームの MAC ヘッダを除いたペイロードの最大長で、デフォルトでは 1500 バイトです。 +CMD_NatSet_TCPTIMEOUT 仮想 NAT が中継する TCP セッションで、何秒間無通信状態が続けばタイムアウトしセッションを破棄するかを設定します。 +CMD_NatSet_UDPTIMEOUT 仮想 NAT が中継する UDP セッションで、何秒間無通信状態が続けばタイムアウトしセッションを破棄するかを設定します。 +CMD_NatSet_LOG 仮想 NAT の動作を、仮想 HUB のセキュリティログに保存するかどうかを指定します。"yes" を指定すると保存され、"no" を指定すると保存しません。 +CMD_NatSet_Prompt_MTU MTU 値: +CMD_NatSet_Prompt_TCPTIMEOUT TCP セッションのタイムアウト秒数: +CMD_NatSet_Prompt_UDPTIMEOUT UDP セッションのタイムアウト秒数: +CMD_NatSet_Prompt_LOG ログの保存 (yes / no): +CMD_NatSet_Eval_MTU MTU 値は %d から %d の間で設定してください。 +CMD_NatSet_Eval_TCP TCP セッションのタイムアウト秒数は %d から %d の間で設定してください。 +CMD_NatSet_Eval_UDP UDP セッションのタイムアウト秒数は %d から %d の間で設定してください。 + + +# NatTable コマンド +CMD_NatTable SecureNAT 機能の仮想 NAT 機能のセッションテーブルの取得 +CMD_NatTable_Help 現在管理している仮想 HUB 内で仮想 NAT 機能が動作している場合、仮想 NAT を経由して現在通信中の TCP、および UDP のセッションテーブル (NAT テーブル) を取得します。\nこのコマンドは、クラスタとして動作している VPN Server の仮想 HUB では実行できません。 +CMD_NatTable_Args NatTable + + +# DhcpGet コマンド +CMD_DhcpGet SecureNAT 機能の仮想 DHCP サーバー機能の設定の取得 +CMD_DhcpGet_Help 現在管理している仮想 HUB 内で、仮想 NAT および DHCP サーバー機能 (SecureNAT 機能) の設定項目の内、仮想 DHCP サーバーの設定を取得します。\nこのコマンドは、クラスタとして動作している VPN Server の仮想 HUB では実行できません。 +CMD_DhcpGet_Args DhcpGet +CMD_DhcpGet_Column_Log NAT および DHCP 動作のログ記録 +CMD_DhcpGet_Column_USE 仮想 DHCP 機能を使用する +CMD_DhcpGet_Column_IP1 配布アドレス帯の開始 +CMD_DhcpGet_Column_IP2 配布アドレス帯の終了 +CMD_DhcpGet_Column_MASK サブネットマスク +CMD_DhcpGet_Column_LEASE リース期限 (秒) +CMD_DhcpGet_Column_GW デフォルトゲートウェイアドレス +CMD_DhcpGet_Column_DNS DNS サーバー アドレス 1 +CMD_DhcpGet_Column_DNS2 DNS サーバー アドレス 2 +CMD_DhcpGet_Column_DOMAIN ドメイン名 +CMD_DhcpGet_Column_PUSHROUTE プッシュする静的ルーティングテーブル + + +# DhcpEnable コマンド +CMD_DhcpEnable SecureNAT 機能の仮想 DHCP サーバー機能の有効化 +CMD_DhcpEnable_Help 現在管理している仮想 HUB 内で、仮想 DHCP サーバー機能を有効にします。\nこのコマンドを用いて仮想 DHCP 機能を有効にしても、SecureNAT 機能が動作していない場合は、仮想 DHCP サーバーは動作しません。SecureNAT 機能の動作を開始するには、SecureNatEnable コマンドを使用します。\nこのコマンドは、クラスタとして動作している VPN Server の仮想 HUB では実行できません。 +CMD_DhcpEnable_Args DhcpEnable + + +# DhcpDisable コマンド +CMD_DhcpDisable SecureNAT 機能の仮想 DHCP サーバー機能の無効化 +CMD_DhcpDisable_Help 現在管理している仮想 HUB 内で、仮想 DHCP サーバー機能を無効にします。\nこのコマンドは、クラスタとして動作している VPN Server の仮想 HUB では実行できません。 +CMD_DhcpDisable_Args DhcpDisable + + +# DhcpSet コマンド +CMD_DhcpSet SecureNAT 機能の仮想 DHCP サーバー機能の設定の変更 +CMD_DhcpSet_Help 現在管理している仮想 HUB 内の、仮想 DHCP サーバーの設定を変更します。仮想 DHCP サーバーの設定には、配布 IP アドレス帯、サブネットマスク、リース期限、およびクライアントに割り当てるオプション値が含まれます。\nこのコマンドは、クラスタとして動作している VPN Server の仮想 HUB では実行できません。 +CMD_DhcpSet_Args DhcpSet [/START:start_ip] [/END:end_ip] [/MASK:subnetmask] [/EXPIRE:sec] [/GW:gwip] [/DNS:dns] [/DNS2:dns2] [/DOMAIN:domain] [/LOG:yes|no] [/PUSHROUTE:"routing_table"] +CMD_DhcpSet_START クライアントに対して配布するアドレス帯の開始点を指定します。(例: 192.168.30.10) +CMD_DhcpSet_END クライアントに対して配布するアドレス帯の終了点を指定します。(例: 192.168.30.200) +CMD_DhcpSet_MASK クライアントに対して指定するサブネットマスクを指定します。(例: 255.255.255.0) +CMD_DhcpSet_EXPIRE クライアントに対して IP アドレスをリースする際の有効期限を秒単位で指定します。 +CMD_DhcpSet_GW クライアントに対して通知するデフォルトゲートウェイの IP アドレスを指定します。SecureNAT 機能の仮想 NAT 機能と共に有効にして使用する場合は、SecureNAT の仮想ホストの IP アドレスを指定することもできます。0 または none を指定すると、デフォルトゲートウェイをクライアントに対して通知しません。 +CMD_DhcpSet_DNS クライアントに対して通知する DNS サーバー (プライマリ) の IP アドレスを指定します。SecureNAT 機能の仮想 NAT 機能と共に有効にして使用する場合は、SecureNAT の仮想ホストの IP アドレスを指定することもできます。0 または none を指定すると、DNS サーバー アドレスをクライアントに対して通知しません。 +CMD_DhcpSet_DNS2 クライアントに対して通知する DNS サーバー (セカンダリ) の IP アドレスを指定します。SecureNAT 機能の仮想 NAT 機能と共に有効にして使用する場合は、SecureNAT の仮想ホストの IP アドレスを指定することもできます。0 または none を指定すると、DNS サーバー アドレスをクライアントに対して通知しません。 +CMD_DhcpSet_DOMAIN クライアントに対して通知するドメイン名を指定します。none を指定すると、ドメイン名をクライアントに対して通知しません。 +CMD_DhcpSet_LOG 仮想 DHCP サーバーの動作を仮想 HUB のセキュリティログに保存するかどうかを指定します。"yes" を指定すると保存します。この値は、仮想 NAT 機能のログ保存設定と連動しています。 +CMD_DhcpSet_PUSHROUTE プッシュする静的ルーティングテーブルを指定します。\n例: "192.168.5.0/255.255.255.0/192.168.4.254, 10.0.0.0/255.0.0.0/192.168.4.253"\n複数のエントリ (最大 64 個) はカンマまたはスペースで区切ります。各エントリは、"IP ネットワークアドレス/サブネットマスク/ゲートウェイ IP アドレス" の書式で記述します。\nVPN クライアントに対してこの仮想 DHCP サーバーから DHCP 応答を送信する際に、クラスレス静的ルート (RFC 3442) を併せて送信することができます。\nVPN クライアントがクラスレス静的ルート (RFC 3442) を認識できるかどうかは、VPN クライアントソフトウェアによって異なります。SoftEther VPN Client および OpenVPN Client はクラスレス静的ルートに対応しています。L2TP/IPsec および MS-SSTP においては、利用の可否はクライアントソフトウェアに依存します。\n仮想 DHCP サーバーのオプションでデフォルトゲートウェイを空欄に設定することで、スプリットトンネリングが実現できます。L2TP/IPsec および MS-SSTP クライアントを使用している場合は、IPv4 の設定画面でデフォルトゲートウェイを VPN サーバーに向けないようにする設定が必要です。\nローカルブリッジ経由で外部に DHCP サーバーがある場合は、その DHCP サーバーでクラスレス静的ルート (RFC 3442) をプッシュするよう設定することもできます。その場合は、SecureNAT の仮想 DHCP サーバー機能は無効にしてください。また、このコマンドでの設定は必要ありません。\nクラスレス静的ルートについては、RFC 3442 をお読みください。 +CMD_DhcpSet_Prompt_START 配布するアドレス帯の開始点: +CMD_DhcpSet_Prompt_END 配布するアドレス帯の終了点: +CMD_DhcpSet_Prompt_MASK サブネットマスク: +CMD_DhcpSet_Prompt_EXPIRE リース期限 (秒): +CMD_DhcpSet_Prompt_GW デフォルトゲートウェイ (未設定可): +CMD_DhcpSet_Prompt_DNS DNS サーバー 1 (未設定可): +CMD_DhcpSet_Prompt_DNS2 DNS サーバー 2 (未設定可): +CMD_DhcpSet_Prompt_DOMAIN ドメイン名: + + +# DhcpTable コマンド +CMD_DhcpTable SecureNAT 機能の仮想 DHCP サーバー機能のリーステーブルの取得 +CMD_DhcpTable_Help 現在管理している仮想 HUB 内で仮想 DHCP サーバー機能が動作している場合、仮想 DHCP サーバーが保持しているクライアントに対して割り当てた IP アドレスのリーステーブルを取得します。\nこのコマンドは、クラスタとして動作している VPN Server の仮想 HUB では実行できません。 +CMD_DhcpTable_Args DhcpTable + + +# AdminOptionList コマンド +CMD_AdminOptionList 仮想 HUB 管理オプションの一覧の取得 +CMD_AdminOptionList_Help 現在管理している仮想 HUB に設定されている仮想 HUB 管理オプションの一覧を取得します。\n仮想 HUB 管理オプションは、VPN Server の管理者が各仮想 HUB の管理者に仮想 HUB の管理を委任している場合に、設定範囲を制限するために使用します。\n仮想 HUB の管理オプションを追加・編集および削除することができるのは、この VPN Server 全体の管理権限を持った管理者のみです。仮想 HUB の管理者は、管理オプションを表示できますが、変更することはできません。\nただし、allow_hub_admin_change_option が 1 に設定されている場合は、仮想 HUB の管理者でも管理オプションを編集することができます。\nこのコマンドは、VPN Bridge では実行できません。\nこのコマンドは、クラスタ内でクラスタメンバサーバーとして動作している VPN Server の仮想 HUB では実行できません。 +CMD_AdminOptionList_Args AdminOptionList + + +# AdminOptionSet コマンド +CMD_AdminOptionSet 仮想 HUB 管理オプションの値の設定 +CMD_AdminOptionSet_Help 現在管理している仮想 HUB に設定されている仮想 HUB 管理オプションの値を変更します。\n仮想 HUB 管理オプションは、VPN Server の管理者が各仮想 HUB の管理者に仮想 HUB の管理を委任している場合に、設定範囲を制限するために使用します。\n仮想 HUB の管理オプションを追加・編集および削除することができるのは、この VPN Server 全体の管理権限を持った管理者のみです。仮想 HUB の管理者は、管理オプションを表示できますが、変更することはできません。\nただし、allow_hub_admin_change_option が 1 に設定されている場合は、仮想 HUB の管理者でも管理オプションを編集することができます。\nこのコマンドは、VPN Bridge では実行できません。\nこのコマンドは、クラスタ内でクラスタメンバサーバーとして動作している VPN Server の仮想 HUB では実行できません。 +CMD_AdminOptionSet_Args AdminOptionSet [name] [/VALUE:value] +CMD_AdminOptionSet_[name] 値を変更する管理オプション名を指定します。AdminOptionList コマンドで名前の一覧を取得できます。 +CMD_AdminOptionSet_VALUE 設定する値を整数で指定します。 +CMD_AdminOptionSet_Prompt_name 値を変更する管理オプション名: +CMD_AdminOptionSet_Prompt_VALUE 設定する値 (整数): + + +# ExtOptionList コマンド +CMD_ExtOptionList 仮想 HUB 拡張オプションの一覧の取得 +CMD_ExtOptionList_Help 現在管理している仮想 HUB に設定されている仮想 HUB 拡張オプションの一覧を取得します。\n仮想 HUB 拡張オプションは、仮想 HUB に関するより詳細な設定を行うことができる機能です。\n仮想 HUB の管理オプションを追加・編集および削除することができるのは、この VPN Server 全体の管理権限を持った管理者および仮想 HUB の管理者です。\nただし、仮想 HUB 管理オプションの deny_hub_admin_change_ext_option が 1 に設定されている場合は、仮想 HUB の管理者は、拡張オプションを編集することができません。\nこのコマンドは、VPN Bridge では実行できません。\nこのコマンドは、クラスタ内でクラスタメンバサーバーとして動作している VPN Server の仮想 HUB では実行できません。 +CMD_ExtOptionList_Args ExtOptionList + + +# ExtOptionSet コマンド +CMD_ExtOptionSet 仮想 HUB 管理オプションの値の設定 +CMD_ExtOptionSet_Help 現在管理している仮想 HUB に設定されている仮想 HUB 拡張オプションの値を設定します。\n仮想 HUB 拡張オプションは、仮想 HUB に関するより詳細な設定を行うことができる機能です。\n仮想 HUB の管理オプションを追加・編集および削除することができるのは、この VPN Server 全体の管理権限を持った管理者および仮想 HUB の管理者です。\nただし、仮想 HUB 管理オプションの deny_hub_admin_change_ext_option が 1 に設定されている場合は、仮想 HUB の管理者は、拡張オプションを編集することができません。\nこのコマンドは、VPN Bridge では実行できません。\nこのコマンドは、クラスタ内でクラスタメンバサーバーとして動作している VPN Server の仮想 HUB では実行できません。 +CMD_ExtOptionSet_Args ExtOptionSet [name] [/VALUE:value] +CMD_ExtOptionSet_[name] 値を変更する拡張オプション名を指定します。ExtOptionList コマンドで名前の一覧を取得できます。 +CMD_ExtOptionSet_VALUE 設定する値を整数で指定します。 +CMD_ExtOptionSet_Prompt_name 値を変更する拡張オプション名: +CMD_ExtOptionSet_Prompt_VALUE 設定する値 (整数): + + +# CrlList コマンド +CMD_CrlList 無効な証明書リストの一覧の取得 +CMD_CrlList_Help 現在管理している仮想 HUB に設定されている、無効な証明書リストの一覧を取得します。\n無効な証明書の一覧に証明書を登録すると、その証明書を提示したクライアントは、この仮想 HUB に証明書認証モードで接続できなくなります。\n通常、この機能は秘密鍵が漏洩したり、証明書を保有する者の権限が失効した場合に、当該証明書を無効として仮想 HUB に登録することにより、その証明書を用いて VPN Client が仮想 HUB に接続しようとした際に、ユーザー認証を拒否するために使用されます。\nこのコマンドは、VPN Bridge では実行できません。\nこのコマンドは、クラスタとして動作している VPN Server の仮想 HUB では実行できません。 +CMD_CrlList_Args CrlList + + +# CrlAdd コマンド +CMD_CrlAdd 無効な証明書の追加 +CMD_CrlAdd_Help 現在管理している仮想 HUB に設定されている無効な証明書リストに、新しい無効な証明書の定義を追加します。\n無効な証明書の一覧に登録する内容を、このコマンドのパラメータで指定します。仮想 HUB にユーザーが証明書認証モードで接続してきたとき、その証明書が無効な証明書の一覧に登録されている 1 つ以上の内容に一致する場合に、そのユーザーの接続を拒否します。\nこのコマンドで指定したパラメータで定義されるすべての条件に一致した証明書が、無効として判定されます。\n設定できる項目は、[名前 (CN)]、[所属機関 (O)]、[組織単位 (OU)]、[国 (C)]、[都道府県 (ST)]、[ローカル (L)]、[シリアル番号 (16進数)]、[MD5 ダイジェスト値 (16進数, 128 bit)]、[SHA-1 ダイジェスト値 (16進数, 160 bit)] です。ダイジェスト値 (ハッシュ値) の指定は、証明書を事実上一意に指定することになります。通常、MD5 または SHA-1 のダイジェスト値を入力する場合は、その他の項目を入力する必要はありません。\nこのコマンドは、VPN Bridge では実行できません。\nこのコマンドは、クラスタとして動作している VPN Server の仮想 HUB では実行できません。 +CMD_CrlAdd_Args CrlAdd [/SERIAL:serial] [/MD5:md5] [/SHA1:sha1] [/CN:cn] [/O:o] [/OU:ou] [/C:c] [/ST:st] [/L:l] +CMD_CrlAdd_SERIAL 条件として証明書のシリアル番号 (16進数) を設定する場合はこのパラメータで値を指定します。 +CMD_CrlAdd_MD5 条件として証明書の MD5 ダイジェスト値 (16進数, 128 bit) を設定する場合は、このパラメータで値を指定します。16 進数で 32 文字 (16 Bytes) のパラメータを指定しない場合は無視されます。 +CMD_CrlAdd_SHA1 条件として証明書の SHA1 ダイジェスト値 (16進数, 160 bit) を設定する場合は、このパラメータで値を指定します。16 進数で 40 文字 (20 Bytes) のパラメータを指定しない場合は無視されます。 +CMD_CrlAdd_CN 条件として証明書の名前 (CN) を指定する場合は、このパラメータで値を設定します。 +CMD_CrlAdd_O 条件として証明書の所属機関 (O) を指定する場合は、このパラメータで値を設定します。 +CMD_CrlAdd_OU 条件として証明書の組織単位 (OU) を指定する場合は、このパラメータで値を設定します。 +CMD_CrlAdd_C 条件として証明書の国 (C) を指定する場合は、このパラメータで値を設定します。 +CMD_CrlAdd_ST 条件として証明書の都道府県 (ST) を指定する場合は、このパラメータで値を設定します。 +CMD_CrlAdd_L 条件として証明書のローカル (L) を指定する場合は、このパラメータで値を設定します。 + + +# CrlDel コマンド +CMD_CrlDel 無効な証明書の削除 +CMD_CrlDel_Help 現在管理している仮想 HUB に設定されている無効な証明書のリストから、無効な証明書の定義を指定して削除します。\n現在登録されている無効な証明書の定義一覧は、CrlList コマンドで取得できます\nこのコマンドは、VPN Bridge では実行できません。\nこのコマンドは、クラスタとして動作している VPN Server の仮想 HUB では実行できません。 +CMD_CrlDel_Args CrlDel [id] +CMD_CrlDel_[id] 削除する無効な証明書の定義の ID を指定します。 +CMD_CrlDel_Prompt_ID 削除する ID: + + +# CrlGet コマンド +CMD_CrlGet 無効な証明書の取得 +CMD_CrlGet_Help 現在管理している仮想 HUB に設定されている無効な証明書のリストから、無効な証明書の定義を指定して、その定義内容を取得します。\n現在登録されている無効な証明書の定義一覧は、CrlList コマンドで取得できます。\nこのコマンドは、VPN Bridge では実行できません。\nこのコマンドは、クラスタとして動作している VPN Server の仮想 HUB では実行できません。 +CMD_CrlGet_Args CrlGet [id] +CMD_CrlGet_[id] 取得する無効な証明書の定義の ID を指定します。 +CMD_CrlGet_Prompt_ID 取得する ID: +CMD_CrlGet_CN 名前 (CN) +CMD_CrlGet_O 所属機関 (O) +CMD_CrlGet_OU 組織単位 (OU) +CMD_CrlGet_C 国 (C) +CMD_CrlGet_ST 都道府県 (ST) +CMD_CrlGet_L ローカル (L) +CMD_CrlGet_SERI シリアル番号 (16進数) +CMD_CrlGet_MD5_HASH MD5 ダイジェスト値 (16進数, 128 bit) +CMD_CrlGet_SHA1_HASH SHA-1 ダイジェスト値 (16進数, 160 bit) + + +# AcList コマンド +CMD_AcList 接続元 IP 制限リストのルール一覧の取得 +CMD_AcList_Help 現在管理している仮想 HUB に設定されている 接続元 IP 制限リストのルール一覧を取得します。\nクライアントコンピュータの接続元 IP アドレスによって、この仮想 HUB への VPN 接続を、許可または拒否することができます。複数のルールを定義することができ、各ルールには優先順位を設定することができます。優先順位が高いルールから検索を行い、最初に IP アドレスが一致したルールの動作に基づいて、そのクライアントからの接続を、許可または拒否します。\nこのコマンドは、VPN Bridge では実行できません。\nこのコマンドは、クラスタとして動作している VPN Server の仮想 HUB では実行できません。 +CMD_AcList_Args AcList + + +# AcAdd コマンド +CMD_AcAdd 接続元 IP 制限リストにルールを追加 (IPv4) +CMD_AcAdd_Help 現在管理している仮想 HUB に設定されている 接続元 IP 制限リストに新しいルールを追加します。\nここで設定した項目は、VPN Client が仮想 HUB に接続しようとした際に、そのクライアントからの接続を許可するか拒否するかを決定するために使用されます。\nルール項目の内容として、ルールに一致するクライアントの IP アドレス、または IP アドレスとマスクを指定することができます。IP アドレスのみを指定すると、単一の指定したコンピュータのみがルールに一致することになりますが、IP ネットワークアドレスとマスクを指定すると、そのサブネットの範囲内のすべてのコンピュータがルールに一致することになります。\nルールには優先順位を設定することができます。優先順位は 1 以上の整数で指定し、値が小さいほど優先順位は高く評価されます。\n現在登録されている 接続元 IP 制限リストのルール一覧を取得するには、AcList コマンドを使用します。\nこのコマンドは、VPN Bridge では実行できません。\nこのコマンドは、クラスタとして動作している VPN Server の仮想 HUB では実行できません。 +CMD_AcAdd_Args AcAdd [allow|deny] [/PRIORITY:priority] [/IP:ip/mask] +CMD_AcAdd_[allow|deny] ルールに一致したクライアントからの接続を許可する ("allow") か拒否する ("deny") かを設定します。 +CMD_AcAdd_PRIORITY ルールの優先順位を 1 以上の整数で指定します。値が小さいほど優先順位は高く評価されます。 +CMD_AcAdd_IP [IP アドレス/マスク] の形式で、クライアント IPv4 アドレスの範囲を指定します。IPv4 アドレスは 192.168.0.1 のように、10 進数をドットで区切って指定します。マスクは 255.255.255.0 のように 10 進数をドットで区切って指定するか、24 のように先頭からのビット長を 10 進数で指定します。単一の IPv4 ホストを指定するには、マスクを 255.255.255.255 または 32 として指定します。 +CMD_AcAdd_Prompt_AD allow または deny: +CMD_AcAdd_Prompt_PRIORITY 優先順位: +CMD_AcAdd_Prompt_IP IPv4 アドレス/マスク: +CMD_AcAdd_Eval_PRIORITY 優先順位は 1 以上で指定してください。 + + +# AcAdd6 コマンド +CMD_AcAdd6 接続元 IP 制限リストにルールを追加 (IPv6) +CMD_AcAdd6_Help 現在管理している仮想 HUB に設定されている 接続元 IP 制限リストに新しいルールを追加します。\nここで設定した項目は、VPN Client が仮想 HUB に接続しようとした際に、そのクライアントからの接続を許可するか拒否するかを決定するために使用されます。\nルール項目の内容として、ルールに一致するクライアントの IP アドレス、または IP アドレスとマスクを指定することができます。IP アドレスのみを指定すると、単一の指定したコンピュータのみがルールに一致することになりますが、IP ネットワークアドレスとマスクを指定すると、そのサブネットの範囲内のすべてのコンピュータがルールに一致することになります。\nルールには優先順位を設定することができます。優先順位は 1 以上の整数で指定し、値が小さいほど優先順位は高く評価されます。\n現在登録されている 接続元 IP 制限リストのルール一覧を取得するには、AcList コマンドを使用します。\nこのコマンドは、VPN Bridge では実行できません。\nこのコマンドは、クラスタとして動作している VPN Server の仮想 HUB では実行できません。 +CMD_AcAdd6_Args AcAdd6 [allow|deny] [/PRIORITY:priority] [/IP:ip/mask] +CMD_AcAdd6_[allow|deny] ルールに一致したクライアントからの接続を許可する ("allow") か拒否する ("deny") かを設定します。 +CMD_AcAdd6_PRIORITY ルールの優先順位を 1 以上の整数で指定します。値が小さいほど優先順位は高く評価されます。 +CMD_AcAdd6_IP [IP アドレス/マスク] の形式で、クライアント IPv6 アドレスの範囲を指定します。IPv6 アドレスは 2001:200:0:1:: のように 16 進数をコロンで区切って指定します。マスクは ffff:ffff:ffff:ffff:: のように IPv6 形式で区切って指定するか、64 のように先頭からのビット長を 10 進数で指定します。単一の IPv6 ホストを指定するには、マスクを ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff または 128 として指定します。 +CMD_AcAdd6_Prompt_AD allow または deny: +CMD_AcAdd6_Prompt_PRIORITY 優先順位: +CMD_AcAdd6_Prompt_IP IPv6 アドレス/サブネットマスク: +CMD_AcAdd6_Eval_PRIORITY 優先順位は 1 以上で指定してください。 + +# AcDel コマンド +CMD_AcDel 接続元 IP 制限リスト内のルールの削除 +CMD_AcDel_Help 現在管理している仮想 HUB に設定されている 接続元 IP 制限リストのルールを削除します。\n現在登録されている 接続元 IP 制限リストのルール一覧を取得するには、AcList コマンドを使用します。\nこのコマンドは、VPN Bridge では実行できません。\nこのコマンドは、クラスタとして動作している VPN Server の仮想 HUB では実行できません。 +CMD_AcDel_Args AcDel [id] +CMD_AcDel_[id] 削除する接続元 IP 制限リスト内のルールの ID を指定します。 +CMD_AcDel_Prompt_ID 削除するルールの ID: + + +# LicenseAdd コマンド +CMD_LicenseAdd 新しいライセンスキーの登録 +CMD_LicenseAdd_Help SoftEther VPN Server に、新しいライセンスキーを登録します。\nSoftEther VPN Server を使用するには、有効なライセンスを取得し、ライセンスキーを登録する必要があります。ライセンスキーは、36 桁の英数字およびハイフン ( '-' ) で構成されている、ライセンスの所有を証明するキーコードです。\nライセンスキーは、本ソフトウェアと共にライセンス証書を受け取った場合は、ライセンス証書に印刷されています。本ソフトウェアのライセンスをオンラインで購入した場合は、購入時の Web サイトの画面やメールなどにライセンスキーが記載されていることがあります。また、その他の方法で、ライセンスキーが記載されている場合もあります。不明な場合は、ライセンスの購入元にお問い合わせください。\n\n現在登録されているライセンスの一覧を取得するには、LicenseList コマンドを使用します。\n現在の VPN Server のライセンス状態を表示するには、LicenseStatus コマンドを使用します。\nこのコマンドを実行するには、VPN Server の管理者権限が必要です。\nこのコマンドは、VPN Bridge では実行できません。 +CMD_LicenseAdd_Args LicenseAdd [key] +CMD_LicenseAdd_[key] 登録するライセンスキーを指定します。36 桁の英数字を、6 桁ごとにハイフンで区切って指定してください。 +CMD_LicenseAdd_Prompt_Key ライセンスキー: + + +# LicenseDel コマンド +CMD_LicenseDel 登録されているライセンスの削除 +CMD_LicenseDel_Help SoftEther VPN Server に、現在登録されているライセンス一覧から、指定されたライセンスを削除します。\n\n現在登録されているライセンスの一覧を取得するには、LicenseList コマンドを使用します。\n現在の VPN Server のライセンス状態を表示するには、LicenseStatus コマンドを使用します。\nこのコマンドを実行するには、VPN Server の管理者権限が必要です。\nこのコマンドは、VPN Bridge では実行できません。 +CMD_LicenseDel_Args LicenseDel [id] +CMD_LicenseDel_[id] 削除するライセンスの番号を指定します。 +CMD_LicenseDel_Prompt_ID 削除するライセンスの番号: + + +# LicenseList コマンド +CMD_LicenseList 登録されているライセンス一覧の取得 +CMD_LicenseList_Help SoftEther VPN Server に、現在登録されているライセンスのライセンスキー、ライセンス種類名、状態、有効期限、ライセンス ID、ライセンス種類 ID、サーバー ID およびシリアル ID の一覧を表示します。\n\n現在の VPN Server のライセンス状態を表示するには、LicenseStatus コマンドを使用します。\nこのコマンドを実行するには、VPN Server の管理者権限が必要です。\nこのコマンドは、VPN Bridge では実行できません。 +CMD_LicenseList_Args LicenseList + + +# LicenseStatus コマンド +CMD_LicenseStatus 現在の VPN Server のライセンス状態の取得 +CMD_LicenseStatus_Help 現在の SoftEther VPN Server のライセンス状態を取得して表示します。\nSoftEther VPN Server の現在の製品エディション名、サーバー ID、製品ライセンスの有効期限、および利用可能なクライアント接続ライセンス数とブリッジ接続ライセンス数が表示されます。\n\nこのコマンドを実行するには、VPN Server の管理者権限が必要です。\nこのコマンドは、VPN Bridge では実行できません。 +CMD_LicenseStatus_Args LicenseStatus + + +## SoftEther VPN 4.0 で新たに追加されたコマンド + +# IPsecEnable コマンド +CMD_IPsecEnable IPsec VPN サーバー機能の有効化 / 無効化 +CMD_IPsecEnable_Help SoftEther VPN Server の IPsec VPN サーバー機能を有効化 / 無効化します。\nIPsec VPN サーバー機能を有効にすると、VPN Server 上の仮想 HUB は、IPsec / L2TP / EtherIP / L2TPv3 に対応した PC や Mac OS X、スマートフォン、ルータ等からの VPN 接続を受付けることができるようになります。\n\nこのコマンドを実行するには、VPN Server の管理者権限が必要です。\nこのコマンドは、VPN Bridge では実行できません。\nこのコマンドは、クラスタとして動作している VPN Server の仮想 HUB では実行できません。 +CMD_IPsecEnable_Args IPsecEnable [/L2TP:yes|no] [/L2TPRAW:yes|no] [/ETHERIP:yes|no] [/PSK:pre-shared-key] [/DEFAULTHUB:default_hub] +CMD_IPsecEnable_L2TP L2TP over IPsec サーバー機能を有効または無効に設定します。iPhone、iPad、Android、Windows、Mac OS X からの VPN 接続を受付けるにはこの機能を有効にしてください。 +CMD_IPsecEnable_L2TPRAW IPsec を用いない L2TP サーバー機能を有効または無効に設定します。特殊なクライアントからの接続を受付ける場合のみ有効にしてください。 +CMD_IPsecEnable_ETHERIP EtherIP / L2TPv3 over IPsec サーバー機能 (拠点間接続 VPN サーバー機能) を有効または無効に設定します。EtherIP / L2TPv3 over IPsec に対応した市販のルータ製品は、この VPN Server の仮想 HUB にレイヤ 2 (Ethernet) でブリッジ接続できるようになります。 +CMD_IPsecEnable_PSK IPsec 事前共有鍵を設定します。IPsec 事前共有鍵は、「PSK (Pre-Shared Key)」または「シークレット」と呼ばれることがあります。8 文字程度で設定し、VPN を利用するすべてのユーザーに配布してください。Google Android 4.0 にはバグがあり、PSK の文字数が 10 文字を超えた場合は VPN 通信に失敗することがあります。そのため、PSK の文字数は 9 文字以下にすることを推奨します。 +CMD_IPsecEnable_DEFAULTHUB 接続時のユーザー名において仮想 HUB 名が省略された場合に接続するデフォルトの仮想 HUB の名前を指定します。通常、L2TP, OpenVPN および MS-SSTP VPN 接続時のユーザー名は "仮想HUB名\\ユーザー名" または "ユーザー名@仮想HUB名" のように指定される必要があります。もしユーザーが仮想 HUB 名の指定を省略した場合は、DEFAULTHUB パラメータとして指定されている仮想 HUB がデフォルトの仮想 HUB として選択されることになります。 +CMD_IPsecEnable_Prompt_L2TP L2TP over IPsec サーバー機能を有効 (yes / no): +CMD_IPsecEnable_Prompt_L2TPRAW Raw L2TP サーバー機能を有効 (yes / no): +CMD_IPsecEnable_Prompt_ETHERIP EtherIP / L2TPv3 over IPsec サーバー機能を有効 (yes / no): +CMD_IPsecEnable_Prompt_PSK IPsec 事前共有鍵の文字列 (9 文字以下を推奨): +CMD_IPsecEnable_Prompt_DEFAULTHUB VPN 接続時に仮想 HUB 名が省略された場合のデフォルト仮想 HUB 名: + + +# IPsecGet コマンド +CMD_IPsecGet IPsec VPN サーバー機能の現在の設定の取得 +CMD_IPsecGet_Help SoftEther VPN Server の IPsec VPN サーバー機能の現在の設定を取得して表示します。\n\nこのコマンドを実行するには、VPN Server の管理者権限が必要です。\nこのコマンドは、VPN Bridge では実行できません。\nこのコマンドは、クラスタとして動作している VPN Server の仮想 HUB では実行できません。 +CMD_IPsecGet_Args IPsecGet +CMD_IPsecGet_PRINT_L2TP L2TP over IPsec サーバー機能は有効 +CMD_IPsecGet_PRINT_L2TPRAW Raw L2TP サーバー機能は有効 +CMD_IPsecGet_PRINT_ETHERIP EtherIP / L2TPv3 over IPsec サーバー機能は有効 +CMD_IPsecGet_PRINT_PSK IPsec 事前共有鍵の文字列 +CMD_IPsecGet_PRINT_DEFAULTHUB デフォルト仮想 HUB 名 + + +# EtherIpClientAdd コマンド +CMD_EtherIpClientAdd EtherIP / L2TPv3 over IPsec サーバー機能のクライアントデバイスからの接続を受付けるための接続設定の追加 +CMD_EtherIpClientAdd_Help EtherIP / L2TPv3 over IPsec サーバー機能のクライアントデバイスからの接続を受付けるための接続設定を追加します。\nEtherIP / L2TPv3 over IPsec サーバー機能が有効になっている場合にルータ等からの接続を受付けるには、予めクライアント側となる EtherIP / L2TPv3 over IPsec 対応ルータが VPN Server に接続する際の IPsec Phase 1 文字列と、接続先の仮想 HUB の情報の対応表を定義しておく必要があります。\nEtherIpClientAdd コマンドを用いて定義を追加することにより、EtherIP / L2TPv3 over IPsec クライアントがこの VPN Server に接続しようとした際の ISAKMP (IKE) Phase 1 のイニシエータ ID 文字列が定義に一致する場合に、定義されている仮想 HUB への接続設定が適用されます。\nユーザー名とパスワードは、仮想 HUB に登録されている必要があります。EtherIP / L2TPv3 クライアントは、このコマンドで入力された情報で識別されるユーザーの権限で仮想 HUB に接続したものとみなされます。\n\nこのコマンドを実行するには、VPN Server の管理者権限が必要です。\nこのコマンドは、VPN Bridge では実行できません。\nこのコマンドは、クラスタとして動作している VPN Server の仮想 HUB では実行できません。 +CMD_EtherIpClientAdd_Args EtherIpClientAdd [ID] [/HUB:hubname] [/USERNAME:username] [/PASSWORD:password] +CMD_EtherIpClientAdd_[ID] ISAKMP Phase 1 ID を指定します。ID はクライアント側のルータの接続設定で設定するものと同一の文字列を指定してください。文字列のほか、ID の種類が IP アドレスの場合は IP アドレスも指定できます。なお、'*' (アスタリスク) を指定するとワイルドカード指定となり、他の明示的なルールに一致しないすべての接続元クライアントが対象となります。 +CMD_EtherIpClientAdd_HUB 接続先の仮想 HUB の名前を指定します。 +CMD_EtherIpClientAdd_USERNAME 接続先の仮想 HUB にログインするためのユーザー名を指定します。 +CMD_EtherIpClientAdd_PASSWORD 接続先の仮想 HUB にログインするためのパスワードを指定します。 +CMD_EtherIpClientAdd_Prompt_ID ISAKMP Phase 1 ID ('*' でワイルドカード指定): +CMD_EtherIpClientAdd_Prompt_HUB 接続先の仮想 HUB の名前: +CMD_EtherIpClientAdd_Prompt_USERNAME 仮想 HUB ログイン用ユーザー名: +CMD_EtherIpClientAdd_Prompt_PASSWORD 仮想 HUB ログイン用パスワード: + + +# EtherIpClientDelete コマンド +CMD_EtherIpClientDelete EtherIP / L2TPv3 over IPsec サーバー機能のクライアントデバイスからの接続を受付けるための接続設定の削除 +CMD_EtherIpClientDelete_Help EtherIP / L2TPv3 over IPsec サーバー機能のクライアントデバイスからの接続を受付けるための接続設定の定義済み項目を削除します。\n\nこのコマンドを実行するには、VPN Server の管理者権限が必要です。\nこのコマンドは、VPN Bridge では実行できません。\nこのコマンドは、クラスタとして動作している VPN Server の仮想 HUB では実行できません。 +CMD_EtherIpClientDelete_Args EtherIpClientDelete [ID] +CMD_EtherIpClientDelete_[ID] ISAKMP Phase 1 ID を指定します。 +CMD_EtherIpClientDelete_Prompt_ID ISAKMP Phase 1 ID: + + +# EtherIpClientList コマンド +CMD_EtherIpClientList EtherIP / L2TPv3 over IPsec サーバー機能のクライアントデバイスからの接続を受付けるための接続設定の一覧表示 +CMD_EtherIpClientList_Help EtherIP / L2TPv3 over IPsec サーバー機能のクライアントデバイスからの接続を受付けるための接続設定の定義済み一覧を表示します。\n\nこのコマンドを実行するには、VPN Server の管理者権限が必要です。\nこのコマンドは、VPN Bridge では実行できません。\nこのコマンドは、クラスタとして動作している VPN Server の仮想 HUB では実行できません。 +CMD_EtherIpClientList_Args EtherIpClientList + + +# OpenVpnMakeConfig コマンド +CMD_OpenVpnMakeConfig OpenVPN 互換サーバー機能に接続可能なサンプルの OpenVPN 設定ファイルの生成 +CMD_OpenVpnMakeConfig_Help 本来、OpenVPN クライアントを使うためには設定ファイルを手動で記述する必要がありますが、これは難易度が高い作業です。しかし、このコマンドを使用すればこの VPN Server に接続することができる基本的な OpenVPN クライアント用の設定ファイルを自動的に生成することができます。\n\nこのコマンドを実行するには、VPN Server の管理者権限が必要です。\nこのコマンドは、VPN Bridge では実行できません。\nこのコマンドは、クラスタとして動作している VPN Server の仮想 HUB では実行できません。 +CMD_OpenVpnMakeConfig_Args OpenVpnMakeConfig [ZIP_FileName] +CMD_OpenVpnMakeConfig_[ZIP_FileName] このコマンドによって出力される設定ファイル (ZIP 圧縮形式) の保存先ファイル名を指定します。拡張子が指定されていない場合は自動的に ".zip" が付加されます。 +CMD_OpenVpnMakeConfig_Prompt_ZIP 設定ファイルを保存する先のファイル名 (ZIP 圧縮形式): +CMD_OpenVpnMakeConfig_OK サンプル設定ファイルを "%s" ファイルに保存しました。このファイルを unzip コマンドなどを用いて展開して使用できます。\n +CMD_OpenVpnMakeConfig_ERROR サンプル設定ファイルを "%s" ファイルに保存できませんでした。ファイル名が正しくない可能性があります。\n + + +# ServerCertRegenerate コマンド +CMD_ServerCertRegenerate 指定された CN (Common Name) を持つ自己署名証明書を新たに作成し VPN Server に登録 +CMD_ServerCertRegenerate_Help SoftEther VPN Server の SSL-VPN 機能で提示されるサーバー証明書を、新たに作成する証明書に置き換えます。新たな証明書は自己署名証明書として生成され、CN (Common Name) の値を任意の文字列に設定することができます。\n\nこのコマンドは、Microsoft SSTP VPN 互換サーバー機能を使用しようとする場合に便利です。なぜならば、SSTP VPN クライアント (Windows Vista / 7 / 8 / RT / 10 に標準搭載) は接続先の VPN Server の提示する SSL 証明書の CN (Common Name) の値が接続先として指定されているホスト名文字列と完全に一致するかどうかを検証し、もし一致しない場合は接続をキャンセルするためです。\n\nこのコマンドは、既存の VPN Server の SSL 証明書を削除します。ServerCertGet コマンドおよび ServerKeyGet コマンドを用いて、現在の証明書と秘密鍵をバックアップしておくことを推奨します。\n\nこのコマンドを実行するには、VPN Server の管理者権限が必要です。\nこのコマンドは、VPN Bridge では実行できません。 +CMD_ServerCertRegenerate_Args ServerCertRegenerate [CN] +CMD_ServerCertRegenerate_[CN] 新たに生成する自己署名証明書の Common Name (CN) の値を指定します。 +CMD_ServerCertRegenerate_Prompt_CN Common Name (CN) の値: + + +# VpnOverIcmpDnsEnable コマンド +CMD_VpnOverIcmpDnsEnable VPN over ICMP / VPN over DNS サーバー機能を有効化 / 無効化 +CMD_VpnOverIcmpDnsEnable_Help ファイアウォールやルータ等の故障や過負荷、設定ミス等により TCP/IP 通信ができない環境のネットワークからでも、ICMP (Ping) または DNS パケットの通信が可能であれば、VPN Server と VPN Client との間で VPN 通信を行うことができます。そのためには、予め VPN over ICMP / VPN over DNS サーバー機能を有効にしておく必要があります。\n\n警告: この機能はファイアウォールやルータ等が一時的に不調となっており ICMP または DNS のみ安定した通信が可能な環境で VPN 通信を確立するための機能であ。緊急時などには有益ですが、長期間の利用には適しない場合があります。\n\n接続元の VPN Client または VPN Bridge は内部バージョン 4.0 以降が必要です。\n\nこのコマンドを実行するには、VPN Server の管理者権限が必要です。\nこのコマンドは、VPN Bridge では実行できません。 +CMD_VpnOverIcmpDnsEnable_Args VpnOverIcmpDnsEnable [/ICMP:yes|no] [/DNS:yes|no] +CMD_VpnOverIcmpDnsEnable_ICMP VPN over ICMP サーバーを有効にするには yes、無効にするには no を指定します。 +CMD_VpnOverIcmpDnsEnable_DNS VPN over DNS サーバーを有効にするには yes、無効にするには no を指定します。 +CMD_VpnOverIcmpDnsEnable_Prompt_ICMP VPN over ICMP サーバーを有効 (yes / no): +CMD_VpnOverIcmpDnsEnable_Prompt_DNS VPN over DNS サーバーを有効 (yes / no): + + +# VpnOverIcmpDnsGet コマンド +CMD_VpnOverIcmpDnsGet 現在の VPN over ICMP / VPN over DNS サーバー機能の設定を取得 +CMD_VpnOverIcmpDnsGet_Help 現在の VPN over ICMP / VPN over DNS サーバー機能の設定を取得して表示します。\n\nこのコマンドを実行するには、VPN Server の管理者権限が必要です。\nこのコマンドは、VPN Bridge では実行できません。 +CMD_VpnOverIcmpDnsGet_Args VpnOverIcmpDnsGet +CMD_VpnOverIcmpDnsGet_PRINT_ICMP VPN over ICMP サーバーが有効 +CMD_VpnOverIcmpDnsGet_PRINT_DNS VPN over DNS サーバーが有効 + + +# DynamicDnsGetStatus コマンド +CMD_DynamicDnsGetStatus ダイナミック DNS 機能の現在の状態の取得 +CMD_DynamicDnsGetStatus_Help ダイナミック DNS 機能の現在の状態を取得して表示します。\n\nダイナミック DNS による、VPN Server コンピュータに永続的な固有の DNS ホスト名が割当てられます。これにより独自でドメインを所有していなくても、VPN Client や VPN Bridge などの設定画面上が VPN Server の IP アドレスの代わりに DNS ホスト名によって VPN Server を指定することができます。\nまた、IP アドレスが変化する可能性がある一般的な ISP を用いて VPN Server をインターネットに接続する場合でも、IP アドレスが変化すれば自動的に DNS ホスト名対応する IP アドレスが更新されますので、可変 IP アドレスでも VPN Server を運用することができるようになります。\nこれにより、高価な月額料金が必要な固定グローバル IP アドレスのサービスを契約する必要がなくなります。\n\n[注意]\nダイナミック DNS 機能を無効にするには、VPN Server の設定ファイルを編集します。\n"declare root" ディレクティブ内に "declare DDnsClient" ディレクティブがあります。この中にある "bool Disable" の値を true に設定して VPN Server を再起動することにより、ダイナミック DNS 機能が無効になります。\n\nこのコマンドを実行するには、VPN Server の管理者権限が必要です。\nこのコマンドは、VPN Bridge では実行できません。 +CMD_DynamicDnsGetStatus_Args DynamicDnsGetStatus +CMD_DynamicDnsGetStatus_PRINT_FQDN 割当ダイナミック DNS ホスト名 (完全) +CMD_DynamicDnsGetStatus_PRINT_HOSTNAME 割当ダイナミック DNS ホスト名 (ホスト名) +CMD_DynamicDnsGetStatus_PRINT_SUFFIX DNS サフィックス +CMD_DynamicDnsGetStatus_PRINT_IPv4 グローバル IPv4 アドレス +CMD_DynamicDnsGetStatus_PRINT_IPv6 グローバル IPv6 アドレス + + +# DynamicDnsSetHostname コマンド +CMD_DynamicDnsSetHostname ダイナミック DNS ホスト名の設定 +CMD_DynamicDnsSetHostname_Help ダイナミック DNS 機能で VPN Server が使用するホスト名を設定します。現在割当てられているホスト名は DynamicDnsGetStatus コマンドで確認できます。\n\nダイナミック DNS による、VPN Server コンピュータに永続的な固有の DNS ホスト名が割当てられます。これにより独自でドメインを所有していなくても、VPN Client や VPN Bridge などの設定画面上が VPN Server の IP アドレスの代わりに DNS ホスト名によって VPN Server を指定することができます。\nまた、IP アドレスが変化する可能性がある一般的な ISP を用いて VPN Server をインターネットに接続する場合でも、IP アドレスが変化すれば自動的に DNS ホスト名対応する IP アドレスが更新されますので、可変 IP アドレスでも VPN Server を運用することができるようになります。\nこれにより、高価な月額料金が必要な固定グローバル IP アドレスのサービスを契約する必要がなくなります。\n\n[注意]\nダイナミック DNS 機能を無効にするには、VPN Server の設定ファイルを編集します。\n"declare root" ディレクティブ内に "declare DDnsClient" ディレクティブがあります。この中にある "bool Disable" の値を true に設定して VPN Server を再起動することにより、ダイナミック DNS 機能が無効になります。\n\nこのコマンドを実行するには、VPN Server の管理者権限が必要です。\nこのコマンドは、VPN Bridge では実行できません。 +CMD_DynamicDnsSetHostname_Args DynamicDnsSetHostname [hostname] +CMD_DynamicDnsSetHostname_[hostname] 新しいホスト名を 3 文字以上 31 文字以下の半角英数字およびハイフン '-' で指定します。変更は何度でも可能です。 +CMD_DynamicDnsSetHostname_Prompt_hostname ダイナミック DNS ホスト名 (3 - 31 文字): + + +# VpnAzureGetStatus コマンド +CMD_VpnAzureGetStatus VPN Azure 機能の現在の状態の取得 +CMD_VpnAzureGetStatus_Help VPN Azure 機能の現在の状態を取得します。\n\nVPN Azure により、会社のパソコンに自宅や外出先のパソコンから非常に簡単に VPN 接続できるようになります。VPN 接続中は会社のパソコンを経由して、社内 LAN の他のサーバーにもアクセスできます。\n会社のパソコン (VPN Server) にはグローバル IP アドレスは不要です。ファイアウォールや NAT の内側であっても動作し、ネットワーク管理者による設定は一切必要ありません。VPN クライアントとなる自宅のパソコンでは、Windows に標準付属の SSTP VPN クライアントを使用できます。\nVPN Azure は、SoftEther VPN Server をお使いの方はどなたでも無料で利用できるクラウド VPN サービスです。ソフトイーサ株式会社によって運営されています。使い方は http://www.vpnazure.net/ に掲載されています。\n\nVPN Azure ホスト名はダイナミック DNS サービスのホスト名のドメイン部分を "vpnazure.net" に変更したものが使用されます。ホスト名を変更するには DynamicDnsSetHostname コマンドを使用してください。\n\nこのコマンドを実行するには、VPN Server の管理者権限が必要です。\nこのコマンドは、VPN Bridge では実行できません。\nこのコマンドは、クラスタとして動作している VPN Server の仮想 HUB では実行できません。 +CMD_VpnAzureGetStatus_Args VpnAzureGetStatus +CMD_VpnAzureGetStatus_PRINT_ENABLED VPN Azure 機能が有効 +CMD_VpnAzureGetStatus_PRINT_CONNECTED VPN Azure クラウドサーバーへ接続完了 +CMD_VpnAzureGetStatus_PRINT_HOSTNAME VPN Azure サービス上でのホスト名 + + +# VpnAzureSetStatus コマンド +CMD_VpnAzureSetEnable VPN Azure 機能の有効化 / 無効化 +CMD_VpnAzureSetEnable_Help VPN Azure 機能を有効または無効にします。\n\nVPN Azure により、会社のパソコンに自宅や外出先のパソコンから非常に簡単に VPN 接続できるようになります。VPN 接続中は会社のパソコンを経由して、社内 LAN の他のサーバーにもアクセスできます。\n会社のパソコン (VPN Server) にはグローバル IP アドレスは不要です。ファイアウォールや NAT の内側であっても動作し、ネットワーク管理者による設定は一切必要ありません。VPN クライアントとなる自宅のパソコンでは、Windows に標準付属の SSTP VPN クライアントを使用できます。\nVPN Azure は、SoftEther VPN Server をお使いの方はどなたでも無料で利用できるクラウド VPN サービスです。ソフトイーサ株式会社によって運営されています。使い方は http://www.vpnazure.net/ に掲載されています。\n\nVPN Azure ホスト名はダイナミック DNS サービスのホスト名のドメイン部分を "vpnazure.net" に変更したものが使用されます。ホスト名を変更するには DynamicDnsSetHostname コマンドを使用してください。\n\nこのコマンドを実行するには、VPN Server の管理者権限が必要です。\nこのコマンドは、VPN Bridge では実行できません。\nこのコマンドは、クラスタとして動作している VPN Server の仮想 HUB では実行できません。 +CMD_VpnAzureSetEnable_Args VpnAzureSetEnable [yes|no] +CMD_VpnAzureSetEnable_[yes|no] VPN Azure 機能を有効にするには yes、無効にするには no を指定します。 +CMD_VpnAzureSetEnable_PROMPT VPN Azure 機能を有効 (yes / no): + + + +###################################################### +# # +# ここから下は VPN Client 用の管理コマンド # +# # +###################################################### + + +# VersionGet コマンド +CMD_VersionGet VPN Client サービスのバージョン情報の取得 +CMD_VersionGet_Help 現在管理している VPN Client サービスプログラムのバージョン情報を取得します。 +CMD_VersionGet_Args VersionGet +CMD_VersionGet_1 製品名 +CMD_VersionGet_2 バージョン情報 +CMD_VersionGet_3 ビルド情報 +CMD_VersionGet_4 プロセス ID +CMD_VersionGet_5 OS の種類 + + +# PasswordSet コマンド +CMD_PasswordSet VPN Client サービスに接続するためのパスワードの設定 +CMD_PasswordSet_Help VPN Client サービスに、コマンドライン管理ユーティリティや VPN クライアント接続マネージャなどから接続して制御を行う際に、パスワードの入力を求めることができます。このコマンドを用いて、入力を求めるパスワードを設定することができます。\nパスワードは、リモート (localhost 以外のコンピュータ) から操作を行う場合のみ入力させることを要求することもできます。 +CMD_PasswordSet_Args PasswordSet [password] [/REMOTEONLY:yes|no] +CMD_PasswordSet_[password] 設定するパスワードを指定します。"none" と指定すると、パスワードの設定を削除することができます。 +CMD_PasswordSet_REMOTEONLY yes を指定すると、パスワードはリモート (localhost 以外のコンピュータ) から操作を行う場合のみ要求され、localhost からの接続時には要求されなくなります。このパラメータを省略した場合は、"no" と見なします。 + + +# PasswordGet コマンド +CMD_PasswordGet VPN Client サービスに接続するためのパスワードの設定の取得 +CMD_PasswordGet_Help VPN Client サービスに、コマンドライン管理ユーティリティや VPN クライアント接続マネージャなどから接続して制御を行う際に、パスワードの入力を求めるようになっているかどうかの設定を取得します。\nまた、パスワードを要求する場合についは、リモート (localhost 以外のコンピュータ) から操作を行う場合のみ入力させる設定になっているかどうかも取得します。 +CMD_PasswordGet_Args PasswordGet +CMD_PasswordGet_1 パスワードの設定 +CMD_PasswordGet_2 リモートからの接続時のみパスワードを要求 + + +# CertList コマンド +CMD_CertList 信頼する証明機関の証明書一覧の取得 +CMD_CertList_Help VPN Client が信頼する証明機関の証明書一覧を管理します。登録されている証明機関の証明書一覧は、VPN Server への接続時の、サーバー証明書の検証などに利用されます。 +CMD_CertList_Args CertList + + +# CertAdd コマンド +CMD_CertAdd 信頼する証明機関の証明書の追加 +CMD_CertAdd_Help VPN Client が信頼する証明機関の証明書一覧に、新しい証明書を追加します。登録された証明機関の証明書一覧は、VPN Server への接続時の、サーバー証明書の検証などに利用されます。\n現在の証明書一覧を取得するには、CertList コマンドを使用します。\n証明書を追加するには、その証明書が X.509 形式のファイルとして保存されている必要があります。 +CMD_CertAdd_Args CertAdd [path] +CMD_CertAdd_[path] 登録する X.509 証明書ファイル名を指定します。 + + +# CertDelete コマンド +CMD_CertDelete 信頼する証明機関の証明書の削除 +CMD_CertDelete_Help VPN Client が信頼する証明機関の証明書一覧から、既存の証明書を削除します。\n現在の証明書一覧を取得するには、CertList コマンドを使用します。 +CMD_CertDelete_Args CertDelete [id] +CMD_CertDelete_[id] 削除する証明書の ID を指定します。 + + +# CertGet コマンド +CMD_CertGet 信頼する証明機関の証明書の取得 +CMD_CertGet_Help VPN Client が信頼する証明機関の証明書一覧内の、既存の証明書を取得し、X.509 形式のファイルとして保存します。 +CMD_CertGet_Args CertGet [id] [/SAVECERT:path] +CMD_CertGet_[id] 取得する証明書の ID を指定します。 +CMD_CertGet_SAVECERT 取得した証明書を保存するファイル名を指定します。 + + +# SecureList コマンド +CMD_SecureList 使用できるスマートカードの種類の一覧の取得 +CMD_SecureList_Help VPN Client でサポートされているスマートカードの種類の一覧を表示します。\nスマートカードの種類の一覧には、現在コンピュータにドライバがインストールされていて、かつ VPN ソフトウェアでサポートされているデバイスの一覧が表示されます。\r\n現在使用しているスマートカードの種類が表示されない場合は、VPN ソフトウェアをより新しいバージョンにアップデートすることにより使用できるようになる場合もあります。 +CMD_SecureList_Args SecureList + + +# SecureSelect コマンド +CMD_SecureSelect 使用するスマートカードの種類の選択 +CMD_SecureSelect_Help VPN Client で使用するスマートカードの種類を選択します。\n使用できるスマートカードの種類の一覧は、SecureList コマンドで取得することができます。 +CMD_SecureSelect_Args SecureSelect [id] +CMD_SecureSelect_[id] スマートカードの種類の ID を指定します。 +CMD_SecureSelect_PROMPT_ID 使用するスマートカードの種類の ID: + + +# SecureGet コマンド +CMD_SecureGet 使用するスマートカードの種類の ID の取得 +CMD_SecureGet_Help 現在 VPN Client で使用するように設定されているスマートカードの種類の ID を取得します。この ID を元に SecureList コマンドの結果を見ることによって、現在選択されているスマートカードの種類が取得できます。\n現在スマートカードが選択されていない場合は、ID が 0 と表示されます。 +CMD_SecureGet_Args SecureGet +CMD_SecureGet_Print 現在選択されているスマートカード ID は %u です。 +CMD_SecureGet_NoPrint 現在スマートカードは選択されていません。 + + +# NicCreate コマンド +CMD_NicCreate 新規仮想 LAN カードの作成 +CMD_NicCreate_Help 新しい仮想 LAN カードをシステムに追加します。仮想 LAN カードには任意の名前を付けることができます。\nただし、仮想 LAN カード名に使用することができる文字は英数字のみで、Windows 2000 以降のシステムでは 31 文字まで、Windows 98, 98 SE および ME では 4 文字まで設定することができます。\nNicCreate コマンドを呼び出した場合、VPN Client が動作しているオペレーティングシステムに、新しい仮想 LAN カードデバイスドライバがインストールされます。\nこの場合、オペレーティングシステムによっては、デバイスドライバをインストールしても良いかどうか確認するダイアログボックスが表示される場合があります。 +CMD_NicCreate_Args NicCreate [name] +CMD_NicCreate_[name] 仮想 LAN カードの名前を指定します。 +CMD_NicCreate_PROMPT_NAME 仮想 LAN カードの名前: + + +# NicDelete コマンド +CMD_NicDelete 仮想 LAN カードの削除 +CMD_NicDelete_Help 既存の仮想 LAN カードをシステムから削除します。\nシステムから仮想 LAN カードを削除すると、その仮想 LAN カードを使用していた接続は切断されます。\nまた、削除された仮想 LAN カードを使用するように設定されていた接続設定は、別の仮想 LAN カードを使用するように自動的に設定変更されます。\nこのコマンドは、VPN Client が Windows 2000 以降のオペレーティングシステムで動作している場合に使用できます。 +CMD_NicDelete_Args NicDelete [name] +CMD_NicDelete_[name] 仮想 LAN カードの名前を指定します。 + + +# NicUpgrade コマンド +CMD_NicUpgrade 仮想 LAN カードのデバイスドライバのアップグレード +CMD_NicUpgrade_Help 既存の仮想 LAN カードのデバイスドライバのバージョンが古い場合、現在動作している VPN Client に同梱されている最新のデバイスドライバにアップグレードします。アップグレードが行われない場合でも、デバイスドライバを再インストールします。\nオペレーティングシステムによっては、デバイスドライバをインストールしても良いかどうか確認するダイアログボックスが表示される場合があります。\nこのコマンドは、VPN Client が Windows 2000 以降のオペレーティングシステムで動作している場合に使用できます。 +CMD_NicUpgrade_Args NicUpgrade [name] +CMD_NicUpgrade_[name] 仮想 LAN カードの名前を指定します。 + + +# NicGetSetting コマンド +CMD_NicGetSetting 仮想 LAN カードの設定の取得 +CMD_NicGetSetting_Help 既存の仮想 LAN カードの MAC アドレス設定を取得します。\nこのコマンドは、VPN Client が Windows 2000 以降のオペレーティングシステムで動作している場合に使用できます。 +CMD_NicGetSetting_Args NicGetSetting [name] +CMD_NicGetSetting_[name] 仮想 LAN カードの名前を指定します。 +CMD_NicGetSetting_1 デバイス名 +CMD_NicGetSetting_2 状態 +CMD_NicGetSetting_3 MAC アドレス +CMD_NicGetSetting_4 バージョン +CMD_NicGetSetting_5 ドライバファイル名 +CMD_NicGetSetting_6 GUID + + +# NicSetSetting コマンド +CMD_NicSetSetting 仮想 LAN カードの設定の変更 +CMD_NicSetSetting_Help 既存の仮想 LAN カードの MAC アドレス設定を変更します。このコマンドを実行すると、現在動作中の仮想 LAN カードデバイスドライバは再起動します。\nこのコマンドは、VPN Client が Windows 2000 以降のオペレーティングシステムで動作している場合に使用できます。 +CMD_NicSetSetting_Args NicSetSetting [name] [/MAC:mac] +CMD_NicSetSetting_[name] 仮想 LAN カードの名前を指定します。 +CMD_NicSetSetting_MAC 設定する MAC アドレスを指定します。\nMAC アドレスは、6 バイト分の 16 進数を文字列で指定してください。\n例: 00:AC:01:23:45:67 または 00-AC-01-23-45-67 +CMD_NicSetSetting_PROMPT_MAC 設定する MAC アドレス: + + +# NicEnable コマンド +CMD_NicEnable 仮想 LAN カードの有効化 +CMD_NicEnable_Help 既存の仮想 LAN カードが無効化されている場合は、有効化します。\nこのコマンドは、VPN Client が Windows 2000 以降のオペレーティングシステムで動作している場合に使用できます。 +CMD_NicEnable_Args NicEnable [name] +CMD_NicEnable_[name] 仮想 LAN カードの名前を指定します。 + + +# NicDisable コマンド +CMD_NicDisable 仮想 LAN カードの無効化 +CMD_NicDisable_Help 既存の仮想 LAN カードが有効化されている場合は、無効化します。\nこのコマンドは、VPN Client が Windows 2000 以降のオペレーティングシステムで動作している場合に使用できます。 +CMD_NicDisable_Args NicDisable [name] +CMD_NicDisable_[name] 仮想 LAN カードの名前を指定します。 + + +# NicList コマンド +CMD_NicList 仮想 LAN カード一覧の取得 +CMD_NicList_Help 現在システムに登録されている仮想 LAN カードの一覧を取得します。 +CMD_NicList_Args NicList + + +# AccountList コマンド +CMD_AccountList 接続設定一覧の取得 +CMD_AccountList_Help VPN Client に登録されている接続設定の一覧を取得します。 +CMD_AccountList_Args AccountList + + +# AccountCreate コマンド +CMD_AccountCreate 新しい接続設定の作成 +CMD_AccountCreate_Help VPN Client に新しい接続設定を作成します。\n接続設定を作成するには、初期パラメータとして接続設定の名前と接続先のサーバー、および接続先の仮想 HUB、ユーザー名に加えて使用する仮想 LAN カード名を指定する必要があります。新しい接続設定を作成した場合、ユーザー認証の種類は [匿名認証] に初期設定され、プロキシサーバーの設定とサーバー証明書の検証オプションは設定されません。これらの設定やその他の詳細設定を変更するには、接続設定を作成した後に、"Account" という名前で始まる他のコマンドを使用します。 +CMD_AccountCreate_Args AccountCreate [name] [/SERVER:hostname:port] [/HUB:hubname] [/USERNAME:username] [/NICNAME:nicname] +CMD_AccountCreate_[name] 作成する接続設定の名前を指定します。 +CMD_AccountCreate_SERVER [ホスト名:ポート番号] の形式で、接続先の VPN Server のホスト名と、ポート番号を指定します。IP アドレスで指定することもできます。 +CMD_AccountCreate_HUB 接続先の VPN Server 内の仮想 HUB を指定します。 +CMD_AccountCreate_USERNAME 接続先の VPN Server に接続する際の、ユーザー認証で使用するユーザー名を指定します。 +CMD_AccountCreate_NICNAME 接続に使用する仮想 LAN カード名を指定します。 +CMD_AccountCreate_Prompt_Name 接続設定の名前: +CMD_AccountCreate_Prompt_Server 接続先 VPN Server のホスト名とポート番号: +CMD_AccountCreate_Prompt_Hub 接続先仮想 HUB 名: +CMD_AccountCreate_Prompt_Username 接続するユーザー名: +CMD_AccountCreate_Prompt_Nicname 使用する仮想 LAN カード名: + + +# AccountSet コマンド +CMD_AccountSet 接続設定の接続先の設定 +CMD_AccountSet_Help VPN Client に登録されている接続設定の、接続先の VPN Server のホスト名とポート番号、仮想 HUB 名、および接続に使用するユーザー名に加えて使用する仮想 LAN カード名を設定します。 +CMD_AccountSet_Args AccountSet [name] [/SERVER:hostname:port] [/HUB:hubname] +CMD_AccountSet_[name] 設定を変更する接続設定の名前を指定します。 +CMD_AccountSet_SERVER [ホスト名:ポート番号] の形式で、接続先の VPN Server のホスト名と、ポート番号を指定します。IP アドレスで指定することもできます。 +CMD_AccountSet_HUB 接続先の VPN Server 内の仮想 HUB を指定します。 + + +# AccountGet コマンド +CMD_AccountGet 接続設定の設定の取得 +CMD_AccountGet_Help VPN Client に登録されている接続設定の接続設定内容を取得します。\nなお、接続設定の接続設定内容を変更するには、接続設定を作成した後に、"Account" という名前で始まる他のコマンドを使用します。 +CMD_AccountGet_Args AccountGet [name] +CMD_AccountGet_[name] 設定を取得する接続設定の名前を指定します。 + + +# AccountDelete コマンド +CMD_AccountDelete 接続設定の削除 +CMD_AccountDelete_Help VPN Client に登録されている接続設定を削除します。指定された接続設定がオンライン状態である場合は、自動的に接続を切断してから削除します。 +CMD_AccountDelete_Args AccountDelete [name] +CMD_AccountDelete_[name] 削除する接続設定の名前を指定します。 + + +# AccountUsernameSet コマンド +CMD_AccountUsernameSet 接続設定の接続に使用するユーザー名の設定 +CMD_AccountUsernameSet_Help VPN Client に登録されている接続設定を指定し、その接続設定が VPN Server に接続する際の、ユーザー認証に必要なユーザー名を指定します。\nなお、ユーザー認証の種類を指定したり、必要なパラメータを指定したりする必要がある場合があります。これらの情報を変更するには、AccountAnonymousSet、AccountPasswordSet、AccountCertSet、AccountSecureCertSet などのコマンドを使用します。 +CMD_AccountUsernameSet_Args AccountUsernameSet [name] [/USERNAME:username] +CMD_AccountUsernameSet_[name] 設定を変更する接続設定の名前を指定します。 +CMD_AccountUsernameSet_USERNAME 接続設定が VPN Server に接続する際の、ユーザー認証に必要なユーザー名を指定します。 +CMD_AccountUsername_Notice この接続設定の認証方法は、現在パスワード認証に設定されています。ユーザー名を変更した後、AccountPasswordSet コマンドでパスワードを設定し直す必要があります。 + + +# AccountAnonymousSet コマンド +CMD_AccountAnonymousSet 接続設定のユーザー認証の種類を匿名認証に設定 +CMD_AccountAnonymousSet_Help VPN Client に登録されている接続設定を指定し、その接続設定が VPN Server に接続する際のユーザー認証の方法を、[匿名認証] に設定します。 +CMD_AccountAnonymousSet_Args AccountAnonymousSet [name] +CMD_AccountAnonymousSet_[name] 設定を変更する接続設定の名前を指定します。 + + +# AccountPasswordSet コマンド +CMD_AccountPasswordSet 接続設定のユーザー認証の種類をパスワード認証に設定 +CMD_AccountPasswordSet_Help VPN Client に登録されている接続設定を指定し、その接続設定が VPN Server に接続する際のユーザー認証の方法を、[パスワード認証] に設定します。パスワード認証の種類には、[標準パスワード認証] と [RADIUS または NT ドメイン認証] を指定します。 +CMD_AccountPasswordSet_Args AccountPasswordSet [name] [/PASSWORD:password] [/TYPE:standard|radius] +CMD_AccountPasswordSet_[name] 設定を変更する接続設定の名前を指定します。 +CMD_AccountPasswordSet_PASSWORD パスワード認証で使用するパスワードを指定します。指定しない場合は、パスワードを入力するためのプロンプトが表示されます。 +CMD_AccountPasswordSet_TYPE パスワード認証の種類として、"standard" (標準パスワード認証) または "radius" (RADIUS または NT ドメイン認証) の、どちらかを指定します。 +CMD_AccountPasswordSet_Prompt_Type standard または radius の指定: +CMD_AccountPasswordSet_Type_Invalid standard または radius の指定が不正です。 + + +# AccountCertSet コマンド +CMD_AccountCertSet 接続設定のユーザー認証の種類をクライアント証明書認証に設定 +CMD_AccountCertSet_Help VPN Client に登録されている接続設定を指定し、その接続設定が VPN Server に接続する際のユーザー認証の方法を、[クライアント証明書認証] に設定します。証明書としては、X.509 形式の証明書ファイルと、Base 64 でエンコードされた対応した秘密鍵ファイルを指定する必要があります。 +CMD_AccountCertSet_Args AccountCertSet [name] [/LOADCERT:cert] [/LOADKEY:key] +CMD_AccountCertSet_[name] 設定を変更する接続設定の名前を指定します。 +CMD_AccountCertSet_LOADCERT 証明書認証で提示する X.509 形式の証明書ファイル名を指定します。 +CMD_AccountCertSet_LOADKEY 証明書に対応した Base 64 形式でエンコードされた秘密鍵ファイル名を指定します。 + + +# AccountCertGet コマンド +CMD_AccountCertGet 接続設定に用いるクライアント証明書の取得 +CMD_AccountCertGet_Help VPN Client に登録されている接続設定を指定し、その接続設定がクライアント証明書認証を使用する場合は、クライアント証明書として提示する証明書を取得して、証明書ファイルを X.509 形式で保存します。 +CMD_AccountCertGet_Args AccountCertGet [name] [/SAVECERT:cert] +CMD_AccountCertGet_[name] 設定を取得する接続設定の名前を指定します。 +CMD_AccountCertGet_SAVECERT 取得した証明書を X.509 形式で保存するファイル名を指定します。 + + +# AccountEncryptEnable コマンド +CMD_AccountEncryptEnable 接続設定の通信時の暗号化の有効化 +CMD_AccountEncryptEnable_Help VPN Client に登録されている接続設定を指定し、その接続設定が VPN Server との間で VPN 接続を行なって通信をする際に、VPN Server との間の通信内容を SSL で暗号化するように設定します。\n通常は、VPN Server との間の通信を SSL で暗号化して、情報の盗聴や改ざんを防止します。暗号化を無効にすることもできます。暗号化を無効にすると、通信のスループットが向上しますが、通信データは平文でネットワーク上を流れます。 +CMD_AccountEncryptEnable_Args AccountEncryptEnable [name] +CMD_AccountEncryptEnable_[name] 設定を変更する接続設定の名前を指定します。 + + +# AccountEncryptDisable コマンド +CMD_AccountEncryptDisable 接続設定の通信時の暗号化の無効化 +CMD_AccountEncryptDisable_Help VPN Client に登録されている接続設定を指定し、その接続設定が VPN Server との間で VPN 接続を行なって通信をする際に、VPN Server との間の通信内容を暗号化しないように設定します。\n通常は、VPN Server との間の通信を SSL で暗号化して、情報の盗聴や改ざんを防止します。暗号化を無効にすることもできます。暗号化を無効にすると、通信のスループットが向上しますが、通信データは平文でネットワーク上を流れます。 +CMD_AccountEncryptDisable_Args AccountEncryptDisable [name] +CMD_AccountEncryptDisable_[name] 設定を変更する接続設定の名前を指定します。 + + +# AccountCompressEnable コマンド +CMD_AccountCompressEnable 接続設定の通信時のデータ圧縮の有効化 +CMD_AccountCompressEnable_Help VPN Client に登録されている接続設定を指定し、その接続設定が VPN Server との間で VPN 接続を行なって通信をする際に、VPN Server との間の通信内容を圧縮するように設定します。\n最大で約 80 % 程度の圧縮を行うことができます。ただし、圧縮を行うと、クライアントおよびサーバーの両方で CPU 負荷が高くなります。回線速度が約 10 Mbps 以上の場合は、圧縮を行うとスループットが低下し、逆効果となる場合があります。 +CMD_AccountCompressEnable_Args AccountCompressEnable [name] +CMD_AccountCompressEnable_[name] 設定を変更する接続設定の名前を指定します。 + + +# AccountCompressDisable コマンド +CMD_AccountCompressDisable 接続設定の通信時のデータ圧縮の無効化 +CMD_AccountCompressDisable_Help VPN Client に登録されている接続設定を指定し、その接続設定が VPN Server との間で VPN 接続を行なって通信をする際に、VPN Server との間の通信内容を圧縮しないように設定します。 +CMD_AccountCompressDisable_Args AccountCompressDisable [name] +CMD_AccountCompressDisable_[name] 設定を変更する接続設定の名前を指定します。 + + +# AccountHttpHeader* コマンド +CMD_AccountHttpHeader_Prompt_Name ヘッダー名 (コロンより前の部分): +CMD_AccountHttpHeader_Prompt_Data ヘッダー値 (コロンより後の部分): + + +# AccountHttpHeaderAdd コマンド +CMD_AccountHttpHeaderAdd プロキシサーバー経由で接続する際のカスタム HTTP ヘッダーを追加 +CMD_AccountHttpHeaderAdd_Help VPN Client に登録されている接続設定を指定し、経由する HTTP プロキシサーバーに送信されるカスタム HTTP ヘッダーを追加します。カスタム HTTP ヘッダーを使用することによりネットワークに課された特定の制限を回避したり、QoS により適当される速度制限を回避できる場合があります。 +CMD_AccountHttpHeaderAdd_Args AccountHttpHeaderAdd [name] [/NAME:name] [/DATA:data] +CMD_AccountHttpHeaderAdd_[name] 設定を変更する接続設定の名前を指定します。 +CMD_AccountHttpHeaderAdd_NAME 追加するヘッダーの名前を指定します (コロンより前の部分)。 +CMD_AccountHttpHeaderAdd_DATA 追加するヘッダーの値を指定します (コロンより後の部分)。 + + +# AccountHttpHeaderDelete コマンド +CMD_AccountHttpHeaderDelete プロキシサーバー経由で接続する際のカスタム HTTP ヘッダーを削除 +CMD_AccountHttpHeaderDelete_Help VPN Client に登録されている接続設定を指定し、経由する HTTP プロキシサーバーに送信されるカスタム HTTP ヘッダーを削除します。カスタム HTTP ヘッダーを使用することによりネットワークに課された特定の制限を回避したり、QoS により適当される速度制限を回避できる場合があります。 +CMD_AccountHttpHeaderDelete_Args AccountHttpHeaderDelete [name] [/NAME:name] +CMD_AccountHttpHeaderDelete_[name] 設定を削除する接続設定の名前を指定します。 +CMD_AccountHttpHeaderDelete_NAME 削除するヘッダーの名前を指定します (コロンより前の部分)。 + + +# AccountHttpHeaderGet コマンド +CMD_AccountHttpHeaderGet プロキシサーバー経由で接続する際のカスタム HTTP ヘッダー一覧を取得 +CMD_AccountHttpHeaderGet_Help VPN Client に登録されている接続設定を指定し、経由する HTTP プロキシサーバーに送信されるカスタム HTTP ヘッダーの一覧を表示します。カスタム HTTP ヘッダーを使用することによりネットワークに課された特定の制限を回避したり、QoS により適当される速度制限を回避できる場合があります。 +CMD_AccountHttpHeaderGet_Args AccountHttpHeaderGet [name] +CMD_AccountHttpHeaderGet_[name] 設定を取得する接続設定の名前を指定します。 + + +# AccountProxyNone コマンド +CMD_AccountProxyNone 接続設定の接続方法を直接 TCP/IP 接続に設定 +CMD_AccountProxyNone_Help VPN Client に登録されている接続設定を指定し、その接続設定が VPN Server に対して接続する際に使用する接続方法を [直接 TCP/IP 接続] に設定し、プロキシサーバーを経由しないようにします。 +CMD_AccountProxyNone_Args AccountProxyNone [name] +CMD_AccountProxyNone_[name] 設定を変更する接続設定の名前を指定します。 + + +# AccountProxyHttp コマンド +CMD_AccountProxyHttp 接続設定の接続方法を HTTP プロキシサーバー経由接続に設定 +CMD_AccountProxyHttp_Help VPN Client に登録されている接続設定を指定し、その接続設定が VPN Server に対して接続する際に使用する接続方法を [HTTP プロキシサーバー経由接続] に設定し、経由する HTTP プロキシサーバーのホスト名とポート番号、ユーザー名とパスワード (必要な場合) を指定します。\n経由する HTTP プロキシサーバーは、HTTPS 通信をするための CONNECT メソッドに対応している必要があります。 +CMD_AccountProxyHttp_Args AccountProxyHttp [name] [/SERVER:hostname:port] [/USERNAME:username] [/PASSWORD:password] +CMD_AccountProxyHttp_[name] 設定を変更する接続設定の名前を指定します。 +CMD_AccountProxyHttp_SERVER [ホスト名:ポート番号] の形式で、経由する HTTP プロキシサーバーのホスト名、または IP アドレスとポート番号を指定します。 +CMD_AccountProxyHttp_USERNAME 経由する HTTP プロキシサーバーに接続するためにユーザー認証が必要な場合、ユーザー名を指定します。また、同時に /PASSWORD パラメータも指定します。/USERNAME と /PASSWORD パラメータが指定されない場合は、ユーザー認証データを設定しません。 +CMD_AccountProxyHttp_PASSWORD 経由する HTTP プロキシサーバーに接続するためにユーザー認証が必要な場合、パスワードを指定します。/USERNAME パラメータと共に指定します。 +CMD_AccountProxyHttp_Prompt_Server プロキシサーバーのホスト名とポート番号: + + +# AccountProxySocks コマンド +CMD_AccountProxySocks 接続設定の接続方法を SOCKS4 プロキシサーバー経由接続に設定 +CMD_AccountProxySocks_Help VPN Client に登録されている接続設定を指定し、その接続設定が VPN Server に対して接続する際に使用する接続方法を [SOCKS4 プロキシサーバー経由接続] に設定し、経由する SOCKS4 プロキシサーバーのホスト名とポート番号、ユーザー名とパスワード (必要な場合) を指定します。 +CMD_AccountProxySocks_Args AccountProxySocks [name] [/SERVER:hostname:port] [/USERNAME:username] [/PASSWORD:password] +CMD_AccountProxySocks_[name] 設定を変更する接続設定の名前を指定します。 +CMD_AccountProxySocks_SERVER [ホスト名:ポート番号] の形式で、経由する SOCKS4 プロキシサーバーのホスト名、または IP アドレスとポート番号を指定します。 +CMD_AccountProxySocks_USERNAME 経由する SOCKS4 プロキシサーバーに接続するためにユーザー認証が必要な場合、ユーザー名を指定します。また、同時に /PASSWORD パラメータも指定します。/USERNAME と /PASSWORD パラメータが指定されない場合は、ユーザー認証データを設定しません。 +CMD_AccountProxySocks_PASSWORD 経由する SOCKS4 プロキシサーバーに接続するためにユーザー認証が必要な場合、パスワードを指定します。/USERNAME パラメータと共に指定します。 + + +# AccountProxySocks5 コマンド +CMD_AccountProxySocks5 接続設定の接続方法を SOCKS5 プロキシサーバー経由接続に設定 +CMD_AccountProxySocks5_Help VPN Client に登録されている接続設定を指定し、その接続設定が VPN Server に対して接続する際に使用する接続方法を [SOCKS5 プロキシサーバー経由接続] に設定し、経由する SOCKS5 プロキシサーバーのホスト名とポート番号、ユーザー名とパスワード (必要な場合) を指定します。 +CMD_AccountProxySocks5_Args AccountProxySocks5 [name] [/SERVER:hostname:port] [/USERNAME:username] [/PASSWORD:password] +CMD_AccountProxySocks5_[name] 設定を変更する接続設定の名前を指定します。 +CMD_AccountProxySocks5_SERVER [ホスト名:ポート番号] の形式で、経由する SOCKS5 プロキシサーバーのホスト名、または IP アドレスとポート番号を指定します。 +CMD_AccountProxySocks5_USERNAME 経由する SOCKS5 プロキシサーバーに接続するためにユーザー認証が必要な場合、ユーザー名を指定します。また、同時に /PASSWORD パラメータも指定します。/USERNAME と /PASSWORD パラメータが指定されない場合は、ユーザー認証データを設定しません。 +CMD_AccountProxySocks5_PASSWORD 経由する SOCKS5 プロキシサーバーに接続するためにユーザー認証が必要な場合、パスワードを指定します。/USERNAME パラメータと共に指定します。 + + +# AccountServerCertEnable コマンド +CMD_AccountServerCertEnable 接続設定のサーバー証明書の検証オプションの有効化 +CMD_AccountServerCertEnable_Help VPN Client に登録されている接続設定を指定し、その接続設定が VPN Server に対して接続する際に、接続先の VPN Server の提示する SSL 証明書が信頼できるかどうか検査するオプションを有効にします。\nこのオプションが有効になっている場合、接続先サーバーの SSL 証明書を、あらかじめ AccountServerCertSet コマンドで接続設定設定内に保存しておくか、または仮想 HUB の信頼する証明機関の証明書一覧に、サーバーの SSL 証明書を署名したルート証明書を CertAdd コマンドなどで登録しておくことを推奨します。登録されていない場合は、初回接続時に確認のメッセージが表示される場合があります。\n接続設定のサーバー証明書の検証オプションが有効になっている状態で、接続した VPN Server の証明書が信頼できない場合、直ちに接続を解除して再試行を繰り返します。 +CMD_AccountServerCertEnable_Args AccountServerCertEnable [name] +CMD_AccountServerCertEnable_[name] 設定を変更する接続設定の名前を指定します。 + + +# AccountServerCertDisable コマンド +CMD_AccountServerCertDisable 接続設定のサーバー証明書の検証オプションの無効化 +CMD_AccountServerCertDisable_Help VPN Client に登録されている接続設定を指定し、その接続設定が VPN Server に対して接続する際に、接続先の VPN Server の提示する SSL 証明書が信頼できるかどうか検査するオプションを無効にします。 +CMD_AccountServerCertDisable_Args AccountServerCertDisable [name] +CMD_AccountServerCertDisable_[name] 設定を変更する接続設定の名前を指定します。 + + +# AccountRetryOnServerCertEnable コマンド +CMD_AccountRetryOnServerCertEnable 接続設定のサーバー証明書が信頼できない場合の接続再試行を有効化 +CMD_AccountRetryOnServerCertEnable_Help 接続設定のサーバー証明書の検証プションが有効になっている状態で、 VPN Server の証明書が信頼できない場合、直ちに接続を解除して再試行を繰り返します。AccountRetryOnServerCertDisableコマンドを使用することにより再試行を行わないように設定することができますが、このコマンドを使用することにより、デフォルトの接続再試行を行う状態に戻すことができます。 + +CMD_AccountRetryOnServerCertEnable_Args AccountRetryOnServerCertEnable [name] +CMD_AccountRetryOnServerCertEnable_[name] 設定を変更する接続設定の名前を指定します。 + + +# AccountRetryOnServerCertDisable コマンド +CMD_AccountRetryOnServerCertDisable 接続設定のサーバー証明書が信頼できない場合の接続再試行を無効化 +CMD_AccountRetryOnServerCertDisable_Help 接続設定のサーバー証明書の検証プションが有効になっている状態で、 VPN Server の証明書が信頼できない場合、直ちに接続を解除して再試行を繰り返しますが、このコマンドを使用することにより再試行を行わないように設定することができます。 +CMD_AccountRetryOnServerCertDisable_Args AccountRetryOnServerCertDisable [name] +CMD_AccountRetryOnServerCertDisable_[name] 設定を変更する接続設定の名前を指定します。 + + +# AccountServerCertSet コマンド +CMD_AccountServerCertSet 接続設定のサーバー固有証明書の設定 +CMD_AccountServerCertSet_Help VPN Client に登録されている接続設定を指定し、その接続設定が VPN Server に対して接続する際に、接続先の VPN Server の提示する SSL 証明書と同じ証明書をあらかじめ登録します。\n接続設定のサーバー証明書の検証オプションが有効になっている場合、接続先サーバーの SSL 証明書をあらかじめこのコマンドで接続設定設定内に保存しておくか、または仮想 HUB の信頼する証明機関の証明書一覧に、サーバーの SSL 証明書を署名したルート証明書を CAAdd コマンドなどで登録しておく必要があります。\n接続設定のサーバー証明書の検証オプションが有効になっている状態で、接続した VPN Server の証明書が信頼できない場合、直ちに接続を解除して再試行を繰り返します。 +CMD_AccountServerCertSet_Args AccountServerCertSet [name] [/LOADCERT:cert] +CMD_AccountServerCertSet_[name] 設定を変更する接続設定の名前を指定します。 +CMD_AccountServerCertSet_LOADCERT 設定するサーバー固有証明書が保存されている、X.509 形式の証明書ファイル名を指定します。 + + +# AccountServerCertDelete コマンド +CMD_AccountServerCertDelete 接続設定のサーバー固有証明書の削除 +CMD_AccountServerCertDelete_Help VPN Client に登録されている接続設定を指定し、その接続設定にサーバー固有証明書が登録されている場合は、それを削除します。 +CMD_AccountServerCertDelete_Args AccountServerCertDelete [name] +CMD_AccountServerCertDelete_[name] 設定を変更する接続設定の名前を指定します。 + + +# AccountServerCertGet コマンド +CMD_AccountServerCertGet 接続設定のサーバー固有証明書の取得 +CMD_AccountServerCertGet_Help VPN Client に登録されている接続設定を指定し、その接続設定にサーバー固有証明書が登録されている場合はその証明書を取得して、X.509 形式の証明書ファイルとして保存します。 +CMD_AccountServerCertGet_Args AccountServerCertGet [name] [/SAVECERT:path] +CMD_AccountServerCertGet_[name] 設定を変更する接続設定の名前を指定します。 +CMD_AccountServerCertGet_SAVECERT サーバー固有証明書を X.509 形式で保存する証明書ファイル名を指定します。 + + +# AccountDetailSet コマンド +CMD_AccountDetailSet 接続設定の高度な通信設定の設定 +CMD_AccountDetailSet_Help VPN Client に登録されている接続設定を指定し、その接続設定が VPN Server と通信する際に使用される VPN プロトコルの通信設定をカスタマイズします。 +CMD_AccountDetailSet_Args AccountDetailSet [name] [/MAXTCP:max_connection] [/INTERVAL:additional_interval] [/TTL:disconnect_span] [/HALF:yes|no] [/BRIDGE:yes|no] [/MONITOR:yes|no] [/NOTRACK:yes|no] [/NOQOS:yes|no] +CMD_AccountDetailSet_[name] 設定を変更する接続設定の名前を指定します。 +CMD_AccountDetailSet_MAXTCP VPN 通信に使用する TCP コネクション数を、1 以上 32 以下の整数で指定します。VPN Server との間の VPN 通信セッションにおけるデータ伝送に、複数本の TCP コネクションを束ねて使用することにより、通信速度を向上できる場合があります。\n注意: サーバーへの接続回線が高速な場合は 8 本程度を、ダイヤルアップ等の低速な場合は 1 本をお勧めします。 +CMD_AccountDetailSet_INTERVAL 複数の TCP コネクションを確立して VPN 通信を行うとき、各 TCP コネクションの確立間隔を秒単位で指定します。規定値は 1 秒です。 +CMD_AccountDetailSet_TTL 各 TCP コネクションの寿命を設定する場合は、TCP コネクションが確立されてから切断されるまでの寿命を、秒数で指定します。0 を指定すると、寿命は設定されません。 +CMD_AccountDetailSet_HALF 半二重モードを有効にする場合は "yes" を指定します。2 本以上の TCP コネクションを束ねて VPN 通信を行う際、「半二重モード」を使用することができます。半二重モードを有効にすると、自動的に各 TCP コネクションのデータ伝送方向を、半数ずつ固定することができます。たとえば、8 本の TCP コネクションを使用して VPN セッションを確立した場合、半二重モードを有効にすると、4 本の TCP コネクションはアップロード方向専用、残りの 4 本のコネクションはダウンロード方向専用に固定され通信が行われます。 +CMD_AccountDetailSet_BRIDGE VPN Server に「ブリッジ / ルータモード」で接続する場合は "yes" を指定します。ブリッジ / ルータモードを使用して接続した場合、VPN Client の仮想 LAN カードの側で、別のネットワークにブリッジしたりルーティングしたりすることができるようになります。ただし、接続に使用するユーザーのセキュリティポリシーで、ブリッジまたはルーティングが禁止されている場合は、接続に失敗します。 +CMD_AccountDetailSet_MONITOR VPN Server に「モニタリングモード」で接続する場合は "yes" を指定します。モニタリングモードを使用して接続した場合、仮想 HUB 内を流れるすべてのパケットを受信することができます。ただし、接続に使用するユーザーのセキュリティポリシーで、モニタリングモードが許可されていない場合は、接続に失敗します。 +CMD_AccountDetailSet_NOTRACK ルーティングテーブルの調整処理を行わない場合は "yes" を指定します。通常は "no" を指定します。 +CMD_AccountDetailSet_NOQOS VoIP / QoS 対応機能を無効にする場合は "yes" を指定します。通常は "no" を指定します。 +CMD_AccountDetailSet_DISABLEUDP UDP 高速化機能を無効にする場合は "yes" を指定します。通常は "no" を指定します。 +CMD_AccountDetailSet_Eval_MaxTcp TCP コネクション数は 1 から 32 の間で指定してください。 +CMD_AccountDetailSet_Eval_Interval TCP コネクションの確立間隔は 1 秒以上を指定してください。 +CMD_AccountDetailSet_Prompt_MaxTcp VPN 通信に使用する TCP コネクション数: +CMD_AccountDetailSet_Prompt_Interval 各 TCP コネクションの確立間隔: +CMD_AccountDetailSet_Prompt_TTL 各 TCP コネクションの寿命 (0 で無し): +CMD_AccountDetailSet_Prompt_HALF 半二重モードを有効にする (yes/no): +CMD_AccountDetailSet_Prompt_BRIDGE ブリッジ/ルータモードを有効にする (yes/no): +CMD_AccountDetailSet_Prompt_MONITOR モニタリングモードを有効にする (yes/no): +CMD_AccountDetailSet_Prompt_NOTRACK ルーティングテーブル調整処理を無効化する (yes/no): +CMD_AccountDetailSet_Prompt_NOQOS QoS 制御機能を無効化する (yes/no): +CMD_AccountDetailSet_Prompt_DISABLEUDP UDP 高速化機能を無効化する (yes/no): + + +# AccountRename コマンド +CMD_AccountRename 接続設定の名前の変更 +CMD_AccountRename_Help VPN Client に登録されている接続設定を指定し、その接続設定の名前を変更します。 +CMD_AccountRename_Args AccountRename [name] [/NEW:new_name] +CMD_AccountRename_[name] 名前を変更する接続設定の現在の名前を指定します。 +CMD_AccountRename_NEW 変更後の新しい名前を指定します。 +CMD_AccountRename_PROMPT_OLD 現在の名前: +CMD_AccountRename_PROMPT_NEW 新しい名前: + + +# AccountConnect コマンド +CMD_AccountConnect 接続設定を使用して VPN Server へ接続を開始 +CMD_AccountConnect_Help VPN Client に登録されている接続設定を指定し、その接続設定を使用して VPN Server への接続を開始します。接続処理中、または接続済みの状態になった接続設定は、AccountDisconnect コマンドで切断するまで VPN Server に常時接続、または接続を試行し続けます (ただし AccountRetrySet コマンドで再試行回数を指定してある場合は、指定された回数で試行を中断します)。 +CMD_AccountConnect_Args AccountConnect [name] +CMD_AccountConnect_[name] 接続を開始する接続設定の名前を指定します。 + + +# AccountDisconnect コマンド +CMD_AccountDisconnect 接続中の接続設定の切断 +CMD_AccountDisconnect_Help VPN Client に登録されている接続設定を指定し、その接続設定が接続処理中、または接続済みの状態である場合は直ちに切断します。 +CMD_AccountDisconnect_Args AccountDisconnect [name] +CMD_AccountDisconnect_[name] 切断する接続設定の名前を指定します。 + + +# AccountStatusGet コマンド +CMD_AccountStatusGet 接続設定の現在の状態の取得 +CMD_AccountStatusGet_Help VPN Client に登録されている接続設定を指定し、その接続設定が現在接続済みである場合は、その接続状態やその他の情報を取得します。 +CMD_AccountStatusGet_Args AccountStatusGet [name] +CMD_AccountStatusGet_[name] 情報を取得する接続設定の名前を指定します。 + + +# AccountNicSet コマンド +CMD_AccountNicSet 接続設定で使用する仮想 LAN カードの設定 +CMD_AccountNicSet_Help VPN Client に登録されている既存の接続設定が VPN Server への接続に使用する仮想 LAN カード名を変更します。 +CMD_AccountNicSet_Args AccountNicSet [name] [/NICNAME:nicname] +CMD_AccountNicSet_[name] 設定を変更する接続設定の名前を指定します。 +CMD_AccountNicSet_NICNAME VPN Server に接続する際に使用する仮想 LAN カード名を指定します。 + + +# AccountStatusShow コマンド +CMD_AccountStatusShow VPN Server への接続中に接続状況やエラー画面を表示するように設定 +CMD_AccountStatusShow_Help VPN Client に登録されている接続設定を指定し、その接続設定を用いて VPN Server に接続する際に、接続状況やエラー画面などをコンピュータのディスプレイ上に表示するように設定します。 +CMD_AccountStatusShow_Args AccountStatusShow [name] +CMD_AccountStatusShow_[name] 設定を変更する接続設定の名前を指定します。 + + +# AccountStatusHide コマンド +CMD_AccountStatusHide VPN Server への接続中に接続状況やエラー画面を表示しないように設定 +CMD_AccountStatusHide_Help VPN Client に登録されている接続設定を指定し、その接続設定を用いて VPN Server に接続する際に、接続状況やエラー画面などをコンピュータのディスプレイ上に表示しないように設定します。 +CMD_AccountStatusHide_Args AccountStatusHide [name] +CMD_AccountStatusHide_[name] 設定を変更する接続設定の名前を指定します。 + + +# AccountSecureCertSet コマンド +CMD_AccountSecureCertSet 接続設定のユーザー認証の種類をスマートカード認証に設定 +CMD_AccountSecureCertSet_Help VPN Client に登録されている接続設定を指定し、その接続設定が VPN Server に接続する際のユーザー認証の方法を [スマートカード認証] に設定します。また、スマートカード内に格納されている証明書オブジェクトと秘密鍵オブジェクトの名前を指定する必要があります。 +CMD_AccountSecureCertSet_Args AccountSecureCertSet [name] [/CERTNAME:cert] [/KEYNAME:key] +CMD_AccountSecureCertSet_[name] 設定を変更する接続設定の名前を指定します。 +CMD_AccountSecureCertSet_CERTNAME スマートカード内に格納されている証明書オブジェクトの名前を指定します。 +CMD_AccountSecureCertSet_KEYNAME スマートカード内に格納されている秘密鍵オブジェクトの名前を指定します。/CERTNAME で指定した証明書に対応している必要があります。 +CMD_AccountSecureCertSet_PROMPT_CERTNAME スマートカード内証明書オブジェクトの名前: +CMD_AccountSecureCertSet_PROMPT_KEYNAME スマートカード内秘密鍵オブジェクトの名前: + + +# PcAccountOpensslEngineCertSet +CMD_AccountOpensslCertSet_PROMPT_KEYNAME Specify the openssl engine specific key name: +CMD_AccountOpensslCertSet_PROMPT_ENGINENAME Specify the openssl engine name: + + +# AccountRetrySet コマンド +CMD_AccountRetrySet 接続設定の接続失敗または切断時の再試行回数と間隔の設定 +CMD_AccountRetrySet_Help VPN Client に登録されている接続設定を指定し、その接続設定が VPN Server に接続しようとする際、または接続中に VPN Server との通信が切断されたり、接続に失敗したりした場合に、接続を再試行する回数と接続再試行間隔を指定します。\nなお、ユーザー認証の種類が [スマートカード認証] の場合は、接続試行回数の設定にかかわらず、再試行は行いません。 +CMD_AccountRetrySet_Args AccountRetrySet [name] [/NUM:num_retry] [/INTERVAL:retry_interval] +CMD_AccountRetrySet_[name] 設定を変更する接続設定の名前を指定します。 +CMD_AccountRetrySet_NUM 連続して再接続を行う回数を指定します。"999" と指定すると、無限に再接続を試行します (常時接続)。0 を指定すると再接続を行いません。 +CMD_AccountRetrySet_INTERVAL 再接続を行う場合、前回接続が切断または接続失敗してから、何秒後に再接続処理を開始するかを設定します。 +CMD_AccountRetrySet_PROMPT_NUM 再接続回数 ("999" で無限): +CMD_AccountRetrySet_PROMPT_INTERVAL 再接続間隔 (秒): +CMD_AccountRetrySet_EVAL_INTERVAL 再接続間隔は 5 秒以上で指定してください。 + + +# AccountStartupSet コマンド +CMD_AccountStartupSet 接続設定をスタートアップ接続に設定 +CMD_AccountStartupSet_Help VPN Client に登録されている接続設定を指定し、その接続設定をスタートアップ接続に設定します。スタートアップ接続に設定されている接続設定は、VPN Client サービスが起動すると同時に自動的に接続処理を開始します。 +CMD_AccountStartupSet_Args AccountStartupSet [name] +CMD_AccountStartupSet_[name] 設定を変更する接続設定の名前を指定します。 + + +# AccountStartupRemove コマンド +CMD_AccountStartupRemove 接続設定のスタートアップ接続を解除 +CMD_AccountStartupRemove_Help VPN Client に登録されている接続設定を指定し、その接続設定が現在スタートアップ接続に設定されている場合は、スタートアップ接続設定を解除します。 +CMD_AccountStartupRemove_Args AccountStartupRemove [name] +CMD_AccountStartupRemove_[name] 設定を変更する接続設定の名前を指定します。 + + +# AccountExport コマンド +CMD_AccountExport 接続設定のエクスポート +CMD_AccountExport_Help VPN Client に登録されている接続設定を指定し、その接続設定の内容を、テキストファイルとしてエクスポートします。エクスポートされた接続設定ファイルを後からインポートすることによって、接続設定の内容を複製することができます。また、テキストファイルで保存されるため、一般的なテキストエディタで編集することも可能です。\nエクスポート先のファイルは、UTF-8 形式のテキストファイルとして保存されます。なお、ファイル名に .vpn という拡張子を付けると、Windows 版 VPN クライアント接続マネージャと関連付けされるので便利です。 +CMD_AccountExport_Args AccountExport [name] [/SAVEPATH:savepath] +CMD_AccountExport_[name] 接続設定をエクスポートする接続設定名を指定します。 +CMD_AccountExport_SAVEPATH 保存先のファイル名を指定します。 +CMD_AccountExport_PROMPT_SAVEPATH 保存先ファイル名 (拡張子は .vpn を推奨): + + +# AccountImport コマンド +CMD_AccountImport 接続設定のインポート +CMD_AccountImport_Help AccountExport コマンドによってエクスポートされた接続設定ファイルをインポートし、VPN Client に追加します。 +CMD_AccountImport_Args AccountImport [path] +CMD_AccountImport_[path] インポート元のファイル名を指定します。 +CMD_AccountImport_PROMPT_PATH インポート元ファイル名: +CMD_AccountImport_FAILED_PARSE 指定されたファイルを正しく解析することができませんでした。正しくエクスポートされたファイルかどうか確認してください。 +CMD_AccountImport_OK 接続設定 "%s" としてインポートしました。 + + + +# RemoteEnable コマンド +CMD_RemoteEnable VPN Client サービスのリモート管理の許可 +CMD_RemoteEnable_Help VPN Client サービスに、localhost 以外のリモートコンピュータから、コマンドライン管理ユーティリティまたは VPN クライアント接続マネージャでリモート接続して管理することを許可します。 +CMD_RemoteEnable_Args RemoteEnable + + +# RemoteDisable コマンド +CMD_RemoteDisable VPN Client サービスのリモート管理の禁止 +CMD_RemoteDisable_Help VPN Client サービスに、localhost 以外のリモートコンピュータからコマンドライン管理ユーティリティまたは VPN クライアント接続マネージャでリモート接続して管理することを禁止します。 +CMD_RemoteDisable_Args RemoteDisable + + + + + + +################################################### +# # +# ここから下は VPN Tools 用のコマンド # +# # +################################################### + + +# MakeCert コマンド +CMD_MakeCert 新しい X.509 証明書と秘密鍵の作成 (1024 bit) +CMD_MakeCert_Help 新しい X.509 証明書と秘密鍵を作成し、ファイルとして保存します。\n証明書の公開鍵と秘密鍵の生成アルゴリズムには、RSA 1024 bit が使用されます。\n証明書の種類として、ルート証明書 (自己署名証明書) と他の証明書によって署名された証明書のどちらでも作成することができます。他の証明書によって署名された証明書を作成するためには、署名に使用する証明書 (X.509 形式のファイル) と対応する秘密鍵ファイル (Base 64 エンコード) が必要です。\n\n作成する証明書には、名前 (CN)、所属機関 (O)、組織単位 (OU)、国 (C)、都道府県 (ST)、ローカル (L)、シリアル番号、有効期限を指定することができます。\n作成された証明書は X.509 形式のファイルとして、秘密鍵ファイルは RSA 1024 bit 形式の Base 64 エンコードされたファイルとしてそれぞれ保存されます。\n\nMakeCert コマンドは、証明書を作成するための必要最低限の機能を用意したツールです。本格的な証明書を作成したい場合は、OpenSSL などのフリーソフトや、市販の CA (証明機関) ソフトウェアを使用することを推奨します。\n\n※注意: このコマンドは SoftEther VPN コマンドライン管理ユーティリティから呼び出すことが可能です。現在 VPN Server や VPN Client に管理モードで接続している場合も実行できますが、実際に RSA 演算を行い、証明書データを生成しファイルに保存するのはこのコマンドを実行しているコンピュータであり、管理モードで接続先のコンピュータとは一切関係ないコンテキストで実行されます。 +CMD_MakeCert_Args MakeCert [/CN:cn] [/O:o] [/OU:ou] [/C:c] [/ST:st] [/L:l] [/SERIAL:serial] [/EXPIRES:expires] [/SIGNCERT:signcert] [/SIGNKEY:signkey] [/SAVECERT:savecert] [/SAVEKEY:savekey] +CMD_MakeCert_CN 作成する証明書の名前 (CN) 項目を指定します。none を指定することもできます。 +CMD_MakeCert_O 作成する証明書の所属機関 (O) 項目を指定します。none を指定することもできます。 +CMD_MakeCert_OU 作成する証明書の組織単位 (OU) 項目を指定します。none を指定することもできます。 +CMD_MakeCert_C 作成する証明書の国 (C) 項目を指定します。none を指定することもできます。 +CMD_MakeCert_ST 作成する証明書の都道府県 (ST) 項目を指定します。none を指定することもできます。 +CMD_MakeCert_L 作成する証明書のローカル (L) 項目を指定します。none を指定することもできます。 +CMD_MakeCert_SERIAL 作成する証明書のシリアル番号項目を指定します。16 進数で指定します。none を指定することもできます。 +CMD_MakeCert_EXPIRES 作成する証明書の有効期限を指定します。none または 0 を指定すると、3650 日 (約 10 年) が使用されます。最大 10950 日 (約 30 年) まで指定できます。 +CMD_MakeCert_SIGNCERT 作成する証明書を、既存の証明書によって署名する場合は、署名に使用する X.509 形式の証明書のファイル名を指定します。パラメータを省略した場合は、署名は行わず新しい証明書をルート証明書として作成します。 +CMD_MakeCert_SIGNKEY /SIGNCERT で指定した証明書に対応する秘密鍵 (RSA, Base-64 エンコード) を指定します。 +CMD_MakeCert_SAVECERT 作成した証明書を保存するファイル名を指定します。証明書は RSA 形式の 1024 bit の公開鍵を含んだ X.509 ファイルとして保存されます。 +CMD_MakeCert_SAVEKEY 作成した証明書に対応する秘密鍵を保存するファイル名を指定します。秘密鍵は RSA 形式の 1024 bit の秘密鍵ファイルとして保存されます。 +CMD_MakeCert_PROMPT_CN 作成する証明書の名前 (CN): +CMD_MakeCert_PROMPT_O 作成する証明書の所属機関 (O): +CMD_MakeCert_PROMPT_OU 作成する証明書の組織単位 (OU): +CMD_MakeCert_PROMPT_C 作成する証明書の国 (C): +CMD_MakeCert_PROMPT_ST 作成する証明書の都道府県 (ST): +CMD_MakeCert_PROMPT_L 作成する証明書のローカル (L): +CMD_MakeCert_PROMPT_SERIAL 作成する証明書のシリアル番号 (16 進数): +CMD_MakeCert_PROMPT_EXPIRES 作成する証明書の有効期限 (日): +CMD_MakeCert_PROMPT_SAVECERT 作成した証明書を保存するファイル名: +CMD_MakeCert_PROMPT_SAVEKEY 作成した秘密鍵を保存するファイル名: +CMD_MakeCert_EVAL_EXPIRES 有効期限は %u 以上 %u 以下で指定してください。 +CMD_MakeCert_ERROR_SIGNKEY /SIGNCERT と /SIGNKEY で指定された証明書または秘密鍵が読み込めないか、組み合わせが不正です。 +CMD_MakeCert_ERROR_GEN_FAILED 証明書と秘密鍵の生成に失敗しました。 + + +# MakeCert2048 コマンド +CMD_MakeCert2048 新しい X.509 証明書と秘密鍵の作成 (2048 bit) +CMD_MakeCert2048_Help 新しい X.509 証明書と秘密鍵を作成し、ファイルとして保存します。\n証明書の公開鍵と秘密鍵の生成アルゴリズムには、RSA 2048 bit が使用されます。\n証明書の種類として、ルート証明書 (自己署名証明書) と他の証明書によって署名された証明書のどちらでも作成することができます。他の証明書によって署名された証明書を作成するためには、署名に使用する証明書 (X.509 形式のファイル) と対応する秘密鍵ファイル (Base 64 エンコード) が必要です。\n\n作成する証明書には、名前 (CN)、所属機関 (O)、組織単位 (OU)、国 (C)、都道府県 (ST)、ローカル (L)、シリアル番号、有効期限を指定することができます。\n作成された証明書は X.509 形式のファイルとして、秘密鍵ファイルは RSA 2048 bit 形式の Base 64 エンコードされたファイルとしてそれぞれ保存されます。\n\nMakeCert コマンドは、証明書を作成するための必要最低限の機能を用意したツールです。本格的な証明書を作成したい場合は、OpenSSL などのフリーソフトや、市販の CA (証明機関) ソフトウェアを使用することを推奨します。\n\n※注意: このコマンドは SoftEther VPN コマンドライン管理ユーティリティから呼び出すことが可能です。現在 VPN Server や VPN Client に管理モードで接続している場合も実行できますが、実際に RSA 演算を行い、証明書データを生成しファイルに保存するのはこのコマンドを実行しているコンピュータであり、管理モードで接続先のコンピュータとは一切関係ないコンテキストで実行されます。 +CMD_MakeCert2048_Args MakeCert2048 [/CN:cn] [/O:o] [/OU:ou] [/C:c] [/ST:st] [/L:l] [/SERIAL:serial] [/EXPIRES:expires] [/SIGNCERT:signcert] [/SIGNKEY:signkey] [/SAVECERT:savecert] [/SAVEKEY:savekey] +CMD_MakeCert2048_CN 作成する証明書の名前 (CN) 項目を指定します。none を指定することもできます。 +CMD_MakeCert2048_O 作成する証明書の所属機関 (O) 項目を指定します。none を指定することもできます。 +CMD_MakeCert2048_OU 作成する証明書の組織単位 (OU) 項目を指定します。none を指定することもできます。 +CMD_MakeCert2048_C 作成する証明書の国 (C) 項目を指定します。none を指定することもできます。 +CMD_MakeCert2048_ST 作成する証明書の都道府県 (ST) 項目を指定します。none を指定することもできます。 +CMD_MakeCert2048_L 作成する証明書のローカル (L) 項目を指定します。none を指定することもできます。 +CMD_MakeCert2048_SERIAL 作成する証明書のシリアル番号項目を指定します。16 進数で指定します。none を指定することもできます。 +CMD_MakeCert2048_EXPIRES 作成する証明書の有効期限を指定します。none または 0 を指定すると、3650 日 (約 10 年) が使用されます。最大 10950 日 (約 30 年) まで指定できます。 +CMD_MakeCert2048_SIGNCERT 作成する証明書を、既存の証明書によって署名する場合は、署名に使用する X.509 形式の証明書のファイル名を指定します。パラメータを省略した場合は、署名は行わず新しい証明書をルート証明書として作成します。 +CMD_MakeCert2048_SIGNKEY /SIGNCERT で指定した証明書に対応する秘密鍵 (RSA, Base-64 エンコード) を指定します。 +CMD_MakeCert2048_SAVECERT 作成した証明書を保存するファイル名を指定します。証明書は RSA 形式の 2048 bit の公開鍵を含んだ X.509 ファイルとして保存されます。 +CMD_MakeCert2048_SAVEKEY 作成した証明書に対応する秘密鍵を保存するファイル名を指定します。秘密鍵は RSA 形式の 2048 bit の秘密鍵ファイルとして保存されます。 + + +# TrafficClient コマンド +CMD_TrafficClient 通信スループット測定ツールクライアントの実行 +CMD_TrafficClient_Help 通信スループット測定ツールの、クライアントプログラムを実行します。\n通信スループット測定ツールは TrafficClient と TrafficServer の 2 つのコマンドとして利用し、IP ネットワーク上で接続された 2 台のコンピュータの間で伝送することができる通信スループットを計測することができます。すでに別のコンピュータ上で、TrafficServer コマンドを用いて通信スループット測定ツールサーバーを待機させておき、TrafficClient コマンドで、そのサーバーのホスト名または IP アドレスとポート番号を指定して接続し、通信速度を測定することができます。\n通信速度の測定は、同時に複数本の TCP コネクションを確立し、それぞれのコネクションで最大限にストリームデータを伝送した結果、指定された時間内に実際に伝送することができたデータのビット数を計算し、それを元に通信スループットの平均値 (bps) を算出する方法で行われます。通常、1 本の TCP コネクションを用いた場合は TCP のアルゴリズム上の限界により、実際のネットワークスループットよりも遅い速度でしか通信できない場合が多いため、複数本の TCP コネクションを同時に確立して通信した結果を測定することを推奨します。この測定方法によって計測されたスループットは実際に TCP でストリームとして受信側に届いたデータのビット長から計算されるため、途中で発生したパケットロスやデータ破損したパケットは、実際に届いたパケットには含まれず、純粋なネットワークの最大通信可能帯域幅に近い値を算出することができます。\n測定結果として TCP 内で伝送されたストリームサイズから、実際にネットワーク上を流れたデータ量の近似値を計算し、それを時間で割ってビット毎秒 (bps) を算出します。物理的なネットワークの種類は Ethernet (IEEE802.3) で、MAC フレームのペイロードサイズは 1,500 Bytes (TCP の MSS は 1,460 Bytes) と仮定して計算が行われます。/RAW オプションを指定すると、TCP/IP ヘッダや MAC ヘッダのデータ量を補正する計算は行われません。\n\n※注意: このコマンドは SoftEther VPN コマンドライン管理ユーティリティから呼び出すことが可能です。現在 VPN Server や VPN Client に管理モードで接続している場合も実行できますが、実際に通信を行ってスループットを測定するのは、このコマンドを実行しているコンピュータであり、管理モードで接続先のコンピュータとは一切関係ないコンテキストで実行されます。 +CMD_TrafficClient_Args TrafficClient [host:port] [/NUMTCP:numtcp] [/TYPE:download|upload|full] [/SPAN:span] [/DOUBLE:yes|no] [/RAW:yes|no] +CMD_TrafficClient_[host:port] 通信スループット測定ツールサーバー (TrafficServer) が待機しているホスト名、または IP アドレスとポート番号を指定します。ポート番号を省略した場合は、9821 が使用されます。 +CMD_TrafficClient_NUMTCP 同時にクライアントとサーバーとの間で確立されデータが伝送される TCP コネクション数を指定します。省略した場合は 32 が使用されます。 +CMD_TrafficClient_TYPE スループット測定を行う際の、データの流れる方向を指定します。"download"、"upload"、"full" のうち 1 つを指定します。download を指定すると、サーバー側からクライアント側にデータが伝送されます。upload を指定すると、クライアント側からサーバー側にデータが伝送されます。full を指定すると、双方向にデータが伝送されます。full を指定する場合は、NUMTCP の値は 2 以上の偶数に指定する必要があります (同時に接続される TCP コネクションのうち半数がダウンロード方向、残りの半数がアップロード方向に使用されます)。このパラメータを省略した場合は full が使用されます。 +CMD_TrafficClient_SPAN スループットを測定するためのデータ伝送を行う時間を、秒数単位で指定します。このパラメータを省略した場合は 15 秒が使用されます。 +CMD_TrafficClient_DOUBLE "yes" を指定した場合、計測した結果のスループットを 2 倍にして表示します。このオプションは、途中にネットワーク装置などがあり、そのネットワーク装置が入出力した合計のスループット能力を測定する場合に使用します。 +CMD_TrafficClient_RAW "yes" を指定すると、TCP/IP ヘッダや MAC ヘッダのデータ量を補正する計算を行いません。 +CMD_TrafficClient_EVAL_NUMTCP TCP コネクション数は 32 以下で指定してください。 +CMD_TrafficClient_PROMPT_HOST 測定サーバー名とポート番号 (省略した場合は 9821): +CMD_TrafficClient_ERROR_NUMTCP データの流れる方向が "full" (双方向) の場合、TCP コネクション数 (/NUMTCP) は偶数の値を指定する必要があります。 +CMD_TrafficClient_ERROR_HOSTPORT ホスト名またはポート番号の指定が正しくありません。 + + +# TrafficServer コマンド +CMD_TrafficServer 通信スループット測定ツールサーバーの実行 +CMD_TrafficServer_Help 通信スループット測定ツールのサーバープログラムを実行します。\n通信スループット測定ツールは、TrafficClient と TrafficServer の 2 つのコマンドとして利用し、IP ネットワーク上で接続された 2 台のコンピュータの間で伝送することができる通信スループットを計測することができます。\nこのコンピュータ上の TCP ポートを待機状態にして、別のコンピュータからの TrafficClient からの接続を待ち受けるには、TrafficServer コマンドにポート番号を指定して起動します。\n通信スループット測定ツールに関する詳細は、"TrafficClient ?" と入力すると表示されます。\n\n※注意: このコマンドは SoftEther VPN コマンドライン管理ユーティリティから呼び出すことが可能です。現在 VPN Server や VPN Client に管理モードで接続している場合も実行できますが、実際に通信を行ってスループットを測定するのは、このコマンドを実行しているコンピュータであり、管理モードで接続先のコンピュータとは一切関係ないコンテキストで実行されます。 +CMD_TrafficServer_Args TrafficServer [port] [/NOHUP:yes|no] +CMD_TrafficServer_[port] 接続を待ち受けるポート番号を整数で指定します。指定されたポートが、すでに別のプログラムによって使用中の場合や、ポートを開くことができない場合はエラーが発生します。 +CMD_TrafficServer_NOHUP "yes" を指定した場合、コンソールからの入力にかかわらず終了をしません。測定サーバーとして永久に動作させたい場合に便利です。 + + +# TrafficClient / TrafficServer 系内部メッセージ文字列 +TT_LISTEN_FAILED TCP ポート %u を待機状態にすることができませんでした。ポートが他のアプリケーションによって使用されているか、ポートを開く権限が無い可能性があります。 +TTS_LISTEN_STOP 待機ポートを閉じました。 +TTS_ENTER_TO_EXIT \n----------------------------------------\n通信スループット測定ツールのサーバープログラムを起動しました。\n\nEnter キーを押すと、サーバープログラムを停止します。\n----------------------------------------\n\n +TTS_INIT サーバープログラムを起動しています... +TTS_LISTEN_STARTED サーバープログラムを起動しました。IPv4 TCP ポート %u を待機状態にしてクライアントからの接続を待機しています。 +TTS_LISTEN_STARTED_V6 IPv6 TCP ポート %u を待機状態にしてクライアントからの接続を待機しています。 +TTS_LISTEN_FAILED_V6 IPv6 TCP ポート %u を待機状態にできませんでした。他のアプリケーションが同一 IPv6 TCP ポートを使用しているか、IPv6 スタックがインストールされていない可能性があります。 +TTS_STOP_INIT サーバープログラムを停止しています... +TTS_STOP_FINISHED サーバープログラムの停止が完了しました。 +TTS_ACCEPTED コネクション %u: クライアント %S のポート %u から接続されました。 +TTS_DISCONNECTED コネクション %u (%S) が切断されました。 +TTS_DISCONNECT コネクション %u (%S) を切断しました。 +TTC_INIT クライアントプログラムを起動しています... +TTC_FREE クライアントプログラムが終了しました。 +TTC_CONNECT_START サーバー %S (ポート %u) への接続を開始します。%u 本の TCP コネクションを接続します。 +TTC_CONNECT_FAILED %u 本目の TCP コネクションの接続に失敗しました。 +TTC_CONNECT_NOT_SERVER 接続先の TCP ポートで TrafficServer 以外のプログラムが動作しているため、トラフィックを計測できません。 +TTC_CONNECT_OK %u 本目の TCP コネクションを接続しました。 +TTC_CONNECT_OK_2 \ データ伝送方向: %s +TTC_ERROR_ABORTED サーバーとの間の TCP コネクションの初期化に失敗しました。計測を中止します。 +TTC_SUMMARY_BAR ------------------------------------------------------- +TTC_SUMMARY_TITLE 通信スループット測定ツールクライアント 設定内容 +TTC_SUMMARY_HOST 接続先のホスト名 +TTC_SUMMARY_PORT 接続先の TCP ポート番号 +TTC_SUMMARY_NUMTCP 確立する TCP コネクション数 +TTC_SUMMARY_TYPE データ伝送方向 +TTC_SUMMARY_SPAN データ伝送時間 +TTC_SUMMARY_ETHER Ethernet フレーム用にデータ補正 +TTC_SUMMARY_DOUBLE 中継機器の入出力合計速度の計測 +TTC_TYPE_DOWNLOAD ダウンロード (サーバー -> クライアント) +TTC_TYPE_UPLOAD アップロード (クライアント -> サーバー) +TTC_TYPE_FULL 双方向 (サーバー <--> クライアント) +TTC_SPAN_STR %.1f 秒 +TTC_COMM_START \nすべてのコネクションが確立されたので、データ送受信を開始しました。\n測定開始時刻: %s\n完了予定時刻: %s\n\n計測中です。しばらくお待ちください。\n(測定中は他のアプリケーションを使用しないでください。)\n\n +TTC_COMM_END %.1f 秒以上が経過したので、データ通信を終了します。\n\n +TTC_COMM_USER_CANCEL ユーザーによってキャンセルされたので、データ通信を終了します。\n\n +TTC_COMM_DISCONNECTED TCP コネクション %u が切断されました。 +TTC_STOPPING 通信スループット測定ツールクライアントの動作を停止しています... +TTC_ENTER_TO_EXIT \n----------------------------------------\n通信スループット測定ツールのクライアントプログラムを起動しました。\n\nEnter キーを押すと、クライアントプログラムを停止します。\n----------------------------------------\n\n +TTC_RES_TITLE \n\n通信スループット測定ツールによる測定結果\n\n +TTC_RES_COLUMN_1 項目名 +TTC_RES_COLUMN_2 通常の表示 +TTC_RES_COLUMN_3 省略表示 +TTC_RES_SPAN 測定に使用した時間 +TTC_RES_ETHER Ethernet フレーム用にデータ補正 +TTC_RES_BYTES_DOWNLOAD ダウンロード方向の通信データ量 +TTC_RES_BYTES_UPLOAD アップロード方向の通信データ量 +TTC_RES_BYTES_TOTAL 合計通信データ量 +TTC_RES_DOUBLE 中継機器入出力合計スループット算出 +TTC_RES_BPS_DOWNLOAD ダウンロード方向の平均スループット +TTC_RES_BPS_UPLOAD アップロード方向の平均スループット +TTC_RES_BPS_TOTAL 合計平均スループット + + +# Check コマンド +CMD_Check SoftEther VPN の動作が可能かどうかチェックする +CMD_Check_Help 現在 vpncmd を動作させているコンピュータが、SoftEther VPN Server / Bridge の動作プラットフォームとして適切であるかどうかをチェックします。\nこのチェックを通過したシステム上では、SoftEther VPN ソフトウェアが正しく動作する可能性が高いと思われます。\nまた、このチェックを通過できないシステム上では、SoftEther VPN ソフトウェアを使用した場合に、何らかの問題が発生する可能性があります。 +CMD_Check_Args Check + + +# システムチェッカ関係 +# (一部奇妙な文字列が含まれていますが、文字コード変換のチェック用です) +CHECK_TITLE ---------------------------------------------------\nSoftEther VPN 動作環境チェックツール\nDeveloper Edition\n\nCopyright (c) all contributors on SoftEther VPN project in GitHub.\nCopyright (c) Daiyuu Nobori, SoftEther Project at University of Tsukuba, and SoftEther Corporation.\nAll Rights Reserved.\n\n +CHECK_NOTE この動作環境チェックツールを実行したシステムがテストに合格した場合は、SoftEther VPN ソフトウェアが動作する可能性が高いです。チェックにはしばらく時間がかかる場合があります。そのままお待ちください...\n\n +CHECK_EXEC_TAG '%s' のチェック中...\n +CHECK_PASS [合格] ○ +CHECK_FAIL [不合格] × +CHECK_RESULT_1 すべてのチェックに合格しました。このシステム上で SoftEther VPN Server / Bridge が正しく動作する可能性が高いと思われます。 +CHECK_RESULT_2 一部のチェック結果は不合格でした。システムの動作環境を確認してください。このシステム上で SoftEther VPN Server / Bridge を実行した場合、問題が発生する可能性があります。 +CHECK_TEST_123456789 123456789 + + +CHECK_PROC_KERNEL カーネル系 +CHECK_PROC_MEMORY メモリ操作系 +CHECK_PROC_STRINGS ANSI / Unicode 文字列処理系 +CHECK_PROC_FILESYSTEM ファイルシステム +CHECK_PROC_THREAD スレッド処理システム +CHECK_PROC_NETWORK ネットワークシステム + + + + + + +###################################################### +# # +# Setup Wizard (SW) Strings # +# # +###################################################### + +SW_TITLE SoftEther VPN Developer Edition セットアップ ウィザード (バージョン %S) +SW_EXIT_CONFIRM SoftEther VPN のセットアップは完了していません。\r\n\r\nセットアップ ウィザードを終了しますか? +SW_UNINSTALL_CONFIRM %s のアンインストール処理を開始します。\r\n\r\nよろしいですか? + + +SW_COMPONENT_VPNSERVER_TITLE SoftEther VPN Server +SW_COMPONENT_VPNSERVER_DESCRIPTION センター拠点にインストールします。VPN を構築する際にセンター側となる拠点のコンピュータにインストールしてください。管理ツールもインストールされます。 + +SW_COMPONENT_VPNCLIENT_TITLE SoftEther VPN Client +SW_COMPONENT_VPNCLIENT_DESCRIPTION VPN クライアントとなる PC にインストールします。センター拠点で稼働している VPN Server に対してこのコンピュータを VPN 接続するためにインストールしてください。管理ツールもインストールされます。 + +SW_COMPONENT_VPNBRIDGE_TITLE SoftEther VPN Bridge +SW_COMPONENT_VPNBRIDGE_DESCRIPTION ブランチ拠点にインストールします。この拠点の物理的な LAN にあるコンピュータすべてをセンター拠点にある VPN Server を経由して通信できるようにするためにインストールしてください。管理ツールもインストールされます。 + +SW_COMPONENT_VPNSMGR_TITLE SoftEther VPN サーバー管理マネージャ (管理ツールのみ) +SW_COMPONENT_VPNSMGR_DESCRIPTION この PC に VPN サーバー管理マネージャのみをインストールします。VPN Server 本体はインストールしません。別のコンピュータの Windows / Linux / Mac OS X / Solaris / FreeBSD で動作している VPN Server / VPN Bridge をリモート管理することができます。 + +SW_COMPONENT_VPNCMGR_TITLE SoftEther VPN クライアント接続マネージャ (管理ツールのみ) +SW_COMPONENT_VPNCMGR_DESCRIPTION この PC に VPN クライアント接続マネージャのみをインストールします。VPN Client 本体はインストールしません。別のコンピュータの Windows / Linux で動作している VPN Client をリモート管理することができます。 + +SW_WELCOME_TITLE SoftEther VPN Developer Edition セットアップ ウィザードへようこそ +SW_MODE_TITLE セットアップモードの選択 +SW_NOT_ADMIN_TITLE 権限が不足しています +SW_COMPONENTS_TITLE インストールするソフトウェアの選択 +SW_EULA_TITLE 使用許諾契約書 +SW_WARNING_TITLE 重要事項説明書 +SW_DIR_TITLE インストール先ディレクトリ +SW_READY_TITLE インストール準備の完了 +SW_PERFORM_TITLE セットアップの進行中 +SW_ERROR_TITLE セットアップの結果 +SW_FINISH_TITLE セットアップが完了しました +SW_UNINST1_TITLE アンインストールの開始 +SW_LANG1_TITLE SoftEther VPN: Configure the Display Language (言語設定の変更) +SW_EASY1_TITLE SoftEther VPN Client 簡易インストーラ作成ウィザードへようこそ +SW_EASY2_TITLE ファイルの指定 +SW_WEB1_TITLE SoftEther VPN Client Web インストーラ作成ウィザードへようこそ +SW_WEB2_TITLE ファイルの指定 + + +SW_UNINSTALLINFO_URL http://selinks.org/ +SW_UNINSTALLINFO_PUBLISHER SoftEther VPN Project + +SW_KB3033929_REQUIRED Windows 7 および Windows Server 2008 R2 では、SoftEther VPN の一部の機能を利用するためには、Microsoft 社の Windows Update プログラム KB3033929 がインストールされている必要があります。\r\n\r\nKB3033929 がインストールされていない場合は、SoftEther VPN をインストールする前に、Windows Update または Microsoft 社の Web サイトから KB3033929 をインストールをしてください。 + + +SW_COMPONENTS_ABOUT_TAG 「%s」とは +SW_COMPONENTS_REQUIRE_ADMIN インストールには管理者権限が必要です +SW_COMPONENTS_REQUIRE_ADMIN_TEXT 「%s」をインストールするには管理者権限があるユーザーによってセットアップを起動し、「システムモード」でインストールする必要があります。システムモードでインストールするには、「戻る」ボタンをクリックしてください。 +SW_DIR_SELECT インストール先ディレクトリを選択してください +SW_DIR_MORE_THAN_110 インストール先ディレクトリ名が長すぎます。\r\n110 文字以下で指定してください。 +SW_DIR_WRITE_ERROR 指定されたディレクトリ "%s" を作成することができないか、当該ディレクトリにファイルを書き込むことができません。\r\n\r\n他のディレクトリを選択してください。 +SW_DIR_DST_IS_SAME_TO_SRC 指定されたディレクトリ "%s" はインストール元と同一です。 +SW_DIR_IS_NOT_HDD 指定されたディレクトリ "%s" はローカルハードディスクドライブではありません。\r\n\r\nシステムモードで %s をインストールするためには、ローカルハードディスク上のディレクトリを指定する必要があります。 +SW_DIR_IS_NOT_FULLPATH ディレクトリ名 "%s" はフルパス形式ではありません。\r\n\r\nフルパス形式で指定してください。 +SW_DIR_DST_IS_OTHER_PRODUCT 指定されたディレクトリには別のコンポーネントがすでにインストールされています。\r\n\r\n別のディレクトリを指定してください。 +SW_DIR_DST_IS_NEWER 指定されたディレクトリにはより新しいバージョンの本ソフトウェアがすでにインストールされています。\r\n\r\nこのインストールを行う必要はありません。 +SW_DIR_DST_IS_NEWER_2 指定されたディレクトリにはより新しいバージョンの本ソフトウェアがすでにインストールされています。\r\n\r\nこのインストーラでは簡易インストール機能による VPN の接続設定の適用のみを行い、プログラムファイルの上書きは行いません。 +SW_DIR_DST_IS_BROKEN 指定されたディレクトリに存在するファイル "%s" を読み込むことができません。\r\n\r\n別のディレクトリを指定してください。 +SW_DIR_DST_IS_SYSTEM_MODE 指定されたディレクトリにはすでに本ソフトウェアがシステムモードでインストールされています。\r\n\r\n別のディレクトリを指定してください。 +SW_DIR_DST_IS_USER_MODE 指定されたディレクトリにはすでに本ソフトウェアがユーザーモードでインストールされています。\r\n\r\n別のディレクトリを指定してください。 +SW_SYSTEM_MODE_ALREADY_INSTALLED ソフトウェア 「%s」 はすでにこのコンピュータにシステムモードでインストールされています。\r\n\r\n同一コンピュータに同一コンポーネントをシステムモードとユーザーモードの両方でインストールする場合は競合が発生する場合があります。\r\n\r\n本当にユーザーモードでインストールを実行しますか? + +SW_SETUPLOG_CORRUPTED setuplog.dat ファイルが破損しています。 +SW_MSI_UNINSTALL_FAILED %s の古いバージョン (製品コード: "%S") を Windows Installer でアンインストールしようとしましたが、アンインストールに失敗しました。\r\n\r\nこのバージョンを手動でアンインストールしてから、再度このインストーラを起動してください。 +SW_MSI_UNINSTALL_REBOOT_REQUIRED %s の古いバージョンを Windows Installer でアンインストールしました。コンピュータの再起動が必要です。\r\n\r\n「完了」をクリックしてから手動でコンピュータを再起動し、その後もう一度このインストーラを起動してください。 +SW_NOTICE_VPNSERVER_IS_INSTALLED コンポーネントとして SoftEther VPN Bridge が選択されましたが、このコンピュータにはすでに SoftEther VPN Server がインストールされています。\r\n\r\n通常、同一のコンピュータに SoftEther VPN Server と SoftEther VPN Bridge の両方をインストールする必要はありません。\r\n両方をインストールするとポート番号の競合などが発生し、不具合の原因となります。\r\nもし SoftEther VPN Server を SoftEther VPN Bridge に入れ替える場合は、一端このインストーラを終了し、SoftEther VPN Server をアンインストールしてから再度このインストーラを起動してください。\r\n\r\nSoftEther VPN Bridge のインストールを続行しますか? +SW_NOTICE_VPNBRIDGE_IS_INSTALLED コンポーネントとして SoftEther VPN Server が選択されましたが、このコンピュータにはすでに SoftEther VPN Bridge がインストールされています。\r\n\r\n通常、同一のコンピュータに SoftEther VPN Server と SoftEther VPN Bridge の両方をインストールする必要はありません。\r\n両方をインストールするとポート番号の競合などが発生し、不具合の原因となります。\r\nもし SoftEther VPN Bridge を SoftEther VPN Server に入れ替える場合は、一端このインストーラを終了し、SoftEther VPN Bridge をアンインストールしてから再度このインストーラを起動してください。\r\n\r\nSoftEther VPN Server のインストールを続行しますか? +SW_OS_FAILED %s はこのオペレーティングシステムにはインストールできません。 +SW_LANG_NOT_CHANGED %s の言語設定は変更されませんでした。 +SW_LANG_LIST_LOAD_FAILED 言語一覧データの読み込みに失敗しました。 +SW_LANG_OK %s の表示言語の変更が完了しました。\r\n%s のプログラムが起動している場合は、プログラムを一度終了してから再起動すると新しい表示言語が適用されます。表示言語が変化しない場合は、Windows を再起動してみてください。\r\n +SW_LANG_OK_SERVICE \r\nサービスが動作している場合は、サービスの出力するログファイルの言語設定はサービスを再起動した後に適用されます。 +SW_LANG_OK_VPNCMGR \r\nVPN クライアント接続マネージャの表示言語は、VPN クライアント接続マネージャを終了 (タスクトレイに常駐させている場合は完全に終了) してから再起動した後に適用されます。 +SW_CHILD_PROCESS_ERROR 子プロセスを起動できませんでした。 +SW_EXE_FILTER Windows 実行可能ファイル (*.EXE)|*.exe|すべてのファイル (*.*)|*.* +SW_PERFORM_MSG_EASY_INFO VPN Client の簡易インストーラをコンパイル中... +SW_EASY_FINISHED_MSG VPN Client の簡易インストーラの生成が完了しました。\r\n簡易インストーラは、以下のファイル名で保存されました。\r\n\r\n%s\r\n\r\n上記のファイルを組織内で配布して使用できます。 +SW_EASY_ERROR_MSG VPN Client の簡易インストーラの生成に失敗しました。 +SW_OTHER_INSTANCE_EXISTS すでに他の SoftEther VPN セットアップウィザードが起動しています。\r\n\r\n他に起動しているセットアップウィザードを確認し、そのウィザードを終了させてから続行してください。 +SW_PERFORM_MSG_WEB_INFO VPN Client の Web インストーラをコンパイル中... +SW_WEB_ERROR_MSG VPN Client の Web インストーラの生成に失敗しました。 +SW_INSTALLER_CACHE_IS_NOT_SIGNED 現在のコンピュータにインストールされている SoftEther VPN Client は、SoftEther VPN Project の有効な Authenticode デジタル証明書で署名されたパッケージからインストールされていません。\r\nカスタマイズされたバージョンのインストーラからインストールされた可能性があります。\r\nたとえば、「簡易インストーラ作成キット」によってカスタマイズされたインストーラを用いてインストールされた可能性があります。\r\n\r\nこのままの状態で Web インストーラを作成すると、作成したインストーラをロードしようとした際にセキュリティの警告メッセージが表示されます。\r\n警告メッセージを表示しないようにするためには、一端 Web インストーラの作成をキャンセルし、ソフトイーサ社の Web サイトから最新の SoftEther VPN Client パッケージをダウンロードして再インストールしてから再度 Web インストーラを作成してください。\r\n\r\nこのまま続行しますか? +SW_FILE_NOT_FOUNT ファイル "%s" が見つかりません。 +SW_WEB_FINISHED 生成された Web インストーラを格納したファイル "%s" を保存しました。\r\n\r\nこの ZIP ファイルを展開し、中身のファイルを Web サーバーに設置して HTML ファイルや inf ファイル内の URL を適切に書き換えてください。\r\n\r\nWeb インストーラの配置方法に関する説明は ZIP ファイル内に記載されています。 + +SW_VG_CONFIRM_MSG SoftEther VPN Client に組み込まれた VPN Gate P2P 中継機能プラグインモジュール をインストールし有効化します。よろしいですか?\r\n\r\n本プラグインは、政府の検閲用ファイアウォールを回避するための通信の安定化を実現します。しかしながら、VPN Gate のためのネットワーク帯域の消費量が増加します。したがって、モバイル回線において VPN Gate 機能を使用することは推奨されていません。\r\n\r\n政府の検閲用ファイアウォールを回避する目的で暗号化された通信を行うことは、いくつかの国および地域では禁止されています。そのような場合は、VPN Gate 機能をコンピュータで使用してはいけません。VPN Gate は専ら日本国内における使用を想定し開発されています。VPN Gate は学術目的の研究プロジェクトです。VPN Gate は日本国の法令に基づいて提供されます。その他の国の法律については、VPN Gate Project は一切関知しておりません。本ソフトウェアおよびサービスを使用するにあたり、ユーザーはユーザー自身の責任において、適用されるすべての法令を遵守しなければなりません。使用場所が日本国内または国外のいずれであるかに係わらず、本ソフトウェアおよびサービスを使用したことによるすべての損害および責任はユーザーが負うこととなります。 + + + +SW_PERFORM_MSG_INIT_TASKS タスクを準備しています... +SW_PERFORM_MSG_COPY_PREPARE ファイルのコピーの準備をしています... +SW_PERFORM_MSG_WRITE_ERROR インストール先ファイル "%s" に書き込むことができません。\r\n\r\nこのファイルを開いているプログラムが実行中の可能性があります。\r\n「%s」関係のプログラムやサービスが起動している場合は、終了してから「再試行」をクリックしてください。 +SW_PERFORM_MSG_COPY_FILE "%s" をコピーしています... +SW_PERFORM_MSG_SET_SECURITY "%s" にセキュリティを設定しています... +SW_PERFORM_MSG_PLUGIN プラグインをインストールしています... +SW_PERFORM_MSG_STOP_SVC サービス 「%s」 を停止中... +SW_PERFORM_MSG_WAIT_FOR_FILE_UNLOCK ファイル "%s" が実行中のプログラムによってロックされています。ロックが解除されるまで待機中... +SW_PERFORM_MSG_INSTALL_SVC サービス 「%s」 をインストール中... +SW_PERFORM_MSG_START_SVC サービス 「%s」 を開始中... +SW_PERFORM_MSG_CREATE_LINKS ショートカットファイルを作成中... +SW_PERFORM_MSG_DELETE_LINKS ショートカットファイルを削除中... +SW_PERFORM_MSG_DELETE_OLD_LINKS 古いショートカットファイルを削除中... +SW_PERFORM_MSG_REGISTER_UNINSTALL アンインストール情報をコントロールパネルに登録中... +SW_PERFORM_MSG_IMPORTING_ACCOUNT 簡易インストーラに内蔵されている接続設定をインポートしています... +SW_PERFORM_MSG_DELETE_SETUP_INFO インストール情報およびログを削除中... +SW_PERFORM_MSG_WRITE_LOG セットアップログを書き出しています... +SW_PERFORM_MSG_COPY_ERROR ファイル "%s" へのコピーに失敗しました。 +SW_PERFORM_MSG_CREATE_LINK_ERROR ショートカットファイル "%s" の作成に失敗しました。\r\n\r\n再試行しますか? +SW_PERFORM_MSG_WRITE_LOG_ERROR セットアップログファイル "%s" の作成に失敗しました。\r\n\r\n再試行しますか? +SW_PERFORM_MSG_STOP_SVC_ERROR サービス 「%s」 (内部名: "%S") の停止に失敗しました。 +SW_PERFORM_MSG_START_SVC_ERROR サービス 「%s」 (内部名: "%S") の開始に失敗しました。 +SW_PERFORM_MSG_SVC_UNINSTALL_FAILED サービス 「%s」 (内部名: "%S") のアンインストールに失敗しました。 +SW_PERFORM_MSG_SVC_INSTALL_FAILED サービス 「%s」 (内部名: "%S") のインストールに失敗しました。 +SW_PERFORM_MSG_SVC_USERMODE_EXEC_FAILED ユーザーモードサービス "%s" の起動に失敗しました。 +SW_PERFORM_MSG_UPDATING システム設定を更新しています... +SW_PERFORM_MSG_DELETE_NIC 仮想 LAN カードを削除しています... +SW_PERFORM_MSG_FINISHED セットアップ処理が完了しました。 +SW_PERFORM_MSG_UNINSTALL_MSI %s の古いバージョンを Windows Installer を用いてアンインストールしています... +SW_PERFORM_MSG_UPDATE_LANG_CONFIG 言語設定を変更しています... + +SW_PERFORM_MSG_INIT_UNINST アンインストールの準備をしています... +SW_PERFORM_MSG_DELETE_PREPARE ファイルの削除の準備をしています... +SW_PERFORM_MSG_DELETE_ERROR ファイル "%s" を削除することができません。\r\n\r\nこのファイルを開いているプログラムが実行中の可能性があります。\r\n「%s」関係のプログラムやサービスが起動している場合は、終了してから「再試行」をクリックしてください。 +SW_PERFORM_MSG_UNINSTALL_SVC サービス 「%s」 をアンインストール中... +SW_PERFORM_MSG_DELETE "%s" を削除しています... +SW_PERFORM_MSG_EASY_INIT 簡易インストーラをビルドしています... +SW_PERFORM_MSG_WEB_INIT Web インストーラをビルドしています... +SW_PERFORM_MSG_INSTALL_SELOW システムの復元ポイントを作成し、必要なネットワークコンポーネントをインストールしています。これには数分間かかる場合があります... + + +SW_TAG_USERNAME \ (ユーザー) +SW_DIRNAME_CONFIG_TOOLS 構成ツール +SW_DIRNAME_ADMIN_TOOLS 管理者用ツール +SW_DIRNAME_LANGUAGE_TOOLS Language Settings + +SW_RUN_TEXT_VPNSMGR SoftEther VPN サーバー管理マネージャを起動します。 +SW_RUN_TEXT_VPNCMGR SoftEther VPN クライアント接続マネージャを起動します。 + +SW_NIC_UNINSTALL SoftEther VPN Client の仮想 LAN カードが作成されています。\r\nこれらの仮想 LAN カードを削除しますか? + +# Do not translate this section !!! +SW_TAG_USERNAME_ENGLISH \ (User-Mode) +SW_LINK_NAME_VPNSERVER_SVC SoftEther VPN Server Developer User-mode Service +SW_LINK_NAME_VPNBRIDGE_SVC SoftEther VPN Bridge Developer User-mode Service +SW_LONG_VPNSERVER SoftEther VPN Server Developer Edition +SW_LONG_VPNCLIENT SoftEther VPN Client Developer Edition +SW_LONG_VPNBRIDGE SoftEther VPN Bridge Developer Edition +SW_LONG_VPNSMGR SoftEther VPN Server Manager Developer Edition +SW_LONG_VPNCMGR SoftEther VPN Client Manager Developer Edition +SW_LANG_SET_FAILED Failed to write the new language setting on lang.config file. +# --- end of "Do not translate this section" --- + +# ショートカット名 +SW_LINK_NAME_VPNSMGR_SHORT SoftEther VPN サーバー管理 (Dev) +SW_LINK_NAME_VPNSMGR_SHORT_UM SE-VPN サーバー管理 (Dev・ユーザー) +SW_LINK_NAME_VPNSMGR_SHORT_TOOLSONLY SE-VPN サーバー管理 (Dev・ツール) +SW_LINK_NAME_VPNSMGR_SHORT_TOOLSONLY_UM SE-VPN サーバー管理 (Dev・ツール・ユーザー) +SW_LINK_NAME_VPNSMGR_FULL SoftEther VPN サーバー管理マネージャ Developer Edition +SW_LINK_NAME_VPNSMGR_COMMENT ローカルまたはリモート コンピュータ上で動作している SoftEther VPN Server および SoftEther VPN Bridge を管理するための管理ツールです。 + +SW_LINK_NAME_VPNCMGR_SHORT SoftEther VPN クライアント接続 (Dev) +SW_LINK_NAME_VPNCMGR_FULL SoftEther VPN クライアント接続マネージャ Developer Edition +SW_LINK_NAME_VPNCMGR_COMMENT SoftEther VPN Client Developer Edition を使用して VPN サーバーに接続することができます。 + +SW_LINK_NAME_VPNCMGRTOOLS_SHORT SoftEther VPN クライアント リモート管理 (Dev) +SW_LINK_NAME_VPNCMGRTOOLS_SHORT_UM SE-VPN クライアント リモート管理 (Dev・ユーザー) +SW_LINK_NAME_VPNCMGRTOOLS_FULL SoftEther VPN クライアント リモート管理 Developer Edition + +SW_LINK_NAME_VPNCMGR2_FULL 別のコンピュータの SoftEther VPN Client の管理 +SW_LINK_NAME_VPNCMGR2_COMMENT 別のコンピュータ上の SoftEther VPN Client プログラムにリモート接続して管理することができます。 + +SW_LINK_NAME_VPNCMGRTRAY_FULL SoftEther VPN Client Manager Developer Edition Startup +SW_LINK_NAME_VPNCMGRTRAY_COMMENT SoftEther VPN Client Developer Edition のアイコンをタスクバーの通知領域に表示します。 + +SW_LINK_NAME_EASYINSTALLER 簡易インストーラ作成ウィザード +SW_LINK_NAME_EASYINSTALLER_COMMENT 自動的に特定の接続先に VPN 接続を開始する機能を搭載した SoftEther VPN Client の簡易インストーラを作成する管理者向けのツールです。 + +SW_LINK_NAME_WEBINSTALLER Web インストーラ作成ウィザード +SW_LINK_NAME_WEBINSTALLER_COMMENT 自動的に特定の接続先に VPN 接続を開始する機能を搭載した SoftEther VPN Client の Web インストーラ (ActiveX インストーラ)を作成する管理者向けのツールです。 + +SW_LINK_NAME_VPNCMD SoftEther VPN コマンドライン管理ユーティリティ (vpncmd) +SW_LINK_NAME_VPNCMD_COMMENT vpncmd を使用して、SoftEther VPN Server, SoftEther VPN Bridge および SoftEther VPN Client をコマンドライン・インターフェイスで管理します。 +SW_LINK_NAME_TRAFFIC 通信スループット測定ツール +SW_LINK_NAME_TRAFFIC_COMMENT 通信スループット測定ツールを使用して、IP ネットワーク上にある 2 台のコンピュータ間で最大限に通信を行い、通信速度を簡単に測定することができます。 +SW_LINK_NAME_TCP TCP 通信設定最適化ユーティリティ +SW_LINK_NAME_TCP_COMMENT TCP/IP 通信設定を調整して、このコンピュータの TCP/IP プロトコルを使用した通信速度を向上させることができます。 +SW_LINK_NAME_SERVICES このコンピュータで動作中のサービス一覧 +SW_LINK_NAME_SERVICES_COMMENT 現在 Windows 上で動作しているサービス一覧を表示します。SoftEther VPN 関係のサービスの動作を開始または停止することができます。 +SW_LINK_NAME_VPNSERVER_SVC_COMMENT SoftEther VPN Server サービスをユーザーモードで起動します。 +SW_LINK_NAME_VPNBRIDGE_SVC_COMMENT SoftEther VPN Bridge サービスをユーザーモードで起動します。 + +SW_LINK_NAME_UNINSTALL %s のアンインストール +SW_LINK_NAME_UNINSTALL_COMMENT インストールされている %s をアンインストールします。 + +SW_LINK_NAME_LANGUAGE Configure Display Language (言語設定) +SW_LINK_NAME_LANGUAGE_COMMENT %s の表示言語を変更します。 + +SW_LINK_NAME_DEBUG デバッグ情報収集ツール +SW_LINK_NAME_DEBUG_COMMENT SoftEther VPN のデバッグ情報を収集します。サポート担当者から依頼があった場合のみ使用してください。 diff --git a/src/bin/hamcore/strtable_tw.stb b/src/bin/hamcore/strtable_tw.stb index 18314094..4598dfe3 100644 --- a/src/bin/hamcore/strtable_tw.stb +++ b/src/bin/hamcore/strtable_tw.stb @@ -1,4 +1,4 @@ -# SoftEther VPN String Table +# SoftEther VPN String Table # Copyright (c) all contributors on SoftEther VPN project in GitHub. # Copyright (c) Daiyuu Nobori, SoftEther Project at University of Tsukuba, and SoftEther Corporation. # diff --git a/src/bin/hamcore/vpnserver_api_doc.html b/src/bin/hamcore/vpnserver_api_doc.html index 1735667e..fbb8fd8d 100644 --- a/src/bin/hamcore/vpnserver_api_doc.html +++ b/src/bin/hamcore/vpnserver_api_doc.html @@ -1,4 +1,4 @@ - + diff --git a/src/bin/hamcore/vpnweb_sample_cn.htm b/src/bin/hamcore/vpnweb_sample_cn.htm index 54ee20a2..8c7716d0 100644 --- a/src/bin/hamcore/vpnweb_sample_cn.htm +++ b/src/bin/hamcore/vpnweb_sample_cn.htm @@ -1,71 +1,71 @@ - - - VPN Client Web Installer Deployment Page Sample HTML - - - - - - -

VPN Client Web Installer Deployment Page Sample HTML File

-

This HTML file is a sample.
-To create a Web Installer using "SoftEther VPN Client Web Installer", please refer the following explanation and the HTML source of this file.

- - - - -
<OBJECT ID="VpnWebInstaller"
-    CLASSID="CLSID:64F1A16B-C3EE-484C-B551-35338A9BB6D2"
-    CODEBASE="vpnweb.cab#Version=$VER_MAJOR$,$VER_MINOR$,0,$VER_BUILD$">
-    <PARAM NAME="InstallerExeUrl" VALUE="http://example.com/any_folder/vpninstall.exe">
-    <PARAM NAME="InstallerInfUrl" VALUE="http://example.com/any_folder/vpninstall.inf">
-    <PARAM NAME="SettingUrl" VALUE="http://example.com/any_folder/auto_setting.vpn">
-    <PARAM NAME="LanguageID" VALUE="EN">
- </OBJECT>
-

To create a web page which boot the VPN Client Web Installer, insert HTML codes as the above. The HTML code refers the path of the ActiveX control, and the parameters which will be passed to the ActiveX.

-

You have to modify the strings which are emphasized in green fonts above according to the environment of the web server which you deploy on.
-(Notice that the above sample won't work staying in the original code, because the original sample specifies the example URLs.)
-
-For details, refer the online manuals or http://www.softether.org/.
-
-Note: the parameters "SettingUrl" and "LanguageID" are optional.

-

 

- - - -

The below code is an example to embed the ActiveX control.

-

Notice: This HTML file is a sample. Parameters for vpnweb.cab control are dummy.
Therefore, after you click Start VPN Connection button, you will get an error message.

- - - - -
- - - - - - - - -
- 

If the VPN Client Web Installer ActiveX Control is not displayed on the above brown rectangle, verity the requirements, and make sure that your Web browser allows ActiveX control.

- - -

 

-

Copyright (c) SoftEther Project at University of Tsukuba, Japan. All Rights Reserved.

- - - - + + + VPN Client Web Installer Deployment Page Sample HTML + + + + + + +

VPN Client Web Installer Deployment Page Sample HTML File

+

This HTML file is a sample.
+To create a Web Installer using "SoftEther VPN Client Web Installer", please refer the following explanation and the HTML source of this file.

+ + + + +
<OBJECT ID="VpnWebInstaller"
+    CLASSID="CLSID:64F1A16B-C3EE-484C-B551-35338A9BB6D2"
+    CODEBASE="vpnweb.cab#Version=$VER_MAJOR$,$VER_MINOR$,0,$VER_BUILD$">
+    <PARAM NAME="InstallerExeUrl" VALUE="http://example.com/any_folder/vpninstall.exe">
+    <PARAM NAME="InstallerInfUrl" VALUE="http://example.com/any_folder/vpninstall.inf">
+    <PARAM NAME="SettingUrl" VALUE="http://example.com/any_folder/auto_setting.vpn">
+    <PARAM NAME="LanguageID" VALUE="EN">
+ </OBJECT>
+

To create a web page which boot the VPN Client Web Installer, insert HTML codes as the above. The HTML code refers the path of the ActiveX control, and the parameters which will be passed to the ActiveX.

+

You have to modify the strings which are emphasized in green fonts above according to the environment of the web server which you deploy on.
+(Notice that the above sample won't work staying in the original code, because the original sample specifies the example URLs.)
+
+For details, refer the online manuals or http://www.softether.org/.
+
+Note: the parameters "SettingUrl" and "LanguageID" are optional.

+

 

+ + + +

The below code is an example to embed the ActiveX control.

+

Notice: This HTML file is a sample. Parameters for vpnweb.cab control are dummy.
Therefore, after you click Start VPN Connection button, you will get an error message.

+ + + + +
+ + + + + + + + +
+ 

If the VPN Client Web Installer ActiveX Control is not displayed on the above brown rectangle, verity the requirements, and make sure that your Web browser allows ActiveX control.

+ + +

 

+

Copyright (c) SoftEther Project at University of Tsukuba, Japan. All Rights Reserved.

+ + + + diff --git a/src/bin/hamcore/vpnweb_sample_en.htm b/src/bin/hamcore/vpnweb_sample_en.htm index 54ee20a2..8c7716d0 100644 --- a/src/bin/hamcore/vpnweb_sample_en.htm +++ b/src/bin/hamcore/vpnweb_sample_en.htm @@ -1,71 +1,71 @@ - - - VPN Client Web Installer Deployment Page Sample HTML - - - - - - -

VPN Client Web Installer Deployment Page Sample HTML File

-

This HTML file is a sample.
-To create a Web Installer using "SoftEther VPN Client Web Installer", please refer the following explanation and the HTML source of this file.

- - - - -
<OBJECT ID="VpnWebInstaller"
-    CLASSID="CLSID:64F1A16B-C3EE-484C-B551-35338A9BB6D2"
-    CODEBASE="vpnweb.cab#Version=$VER_MAJOR$,$VER_MINOR$,0,$VER_BUILD$">
-    <PARAM NAME="InstallerExeUrl" VALUE="http://example.com/any_folder/vpninstall.exe">
-    <PARAM NAME="InstallerInfUrl" VALUE="http://example.com/any_folder/vpninstall.inf">
-    <PARAM NAME="SettingUrl" VALUE="http://example.com/any_folder/auto_setting.vpn">
-    <PARAM NAME="LanguageID" VALUE="EN">
- </OBJECT>
-

To create a web page which boot the VPN Client Web Installer, insert HTML codes as the above. The HTML code refers the path of the ActiveX control, and the parameters which will be passed to the ActiveX.

-

You have to modify the strings which are emphasized in green fonts above according to the environment of the web server which you deploy on.
-(Notice that the above sample won't work staying in the original code, because the original sample specifies the example URLs.)
-
-For details, refer the online manuals or http://www.softether.org/.
-
-Note: the parameters "SettingUrl" and "LanguageID" are optional.

-

 

- - - -

The below code is an example to embed the ActiveX control.

-

Notice: This HTML file is a sample. Parameters for vpnweb.cab control are dummy.
Therefore, after you click Start VPN Connection button, you will get an error message.

- - - - -
- - - - - - - - -
- 

If the VPN Client Web Installer ActiveX Control is not displayed on the above brown rectangle, verity the requirements, and make sure that your Web browser allows ActiveX control.

- - -

 

-

Copyright (c) SoftEther Project at University of Tsukuba, Japan. All Rights Reserved.

- - - - + + + VPN Client Web Installer Deployment Page Sample HTML + + + + + + +

VPN Client Web Installer Deployment Page Sample HTML File

+

This HTML file is a sample.
+To create a Web Installer using "SoftEther VPN Client Web Installer", please refer the following explanation and the HTML source of this file.

+ + + + +
<OBJECT ID="VpnWebInstaller"
+    CLASSID="CLSID:64F1A16B-C3EE-484C-B551-35338A9BB6D2"
+    CODEBASE="vpnweb.cab#Version=$VER_MAJOR$,$VER_MINOR$,0,$VER_BUILD$">
+    <PARAM NAME="InstallerExeUrl" VALUE="http://example.com/any_folder/vpninstall.exe">
+    <PARAM NAME="InstallerInfUrl" VALUE="http://example.com/any_folder/vpninstall.inf">
+    <PARAM NAME="SettingUrl" VALUE="http://example.com/any_folder/auto_setting.vpn">
+    <PARAM NAME="LanguageID" VALUE="EN">
+ </OBJECT>
+

To create a web page which boot the VPN Client Web Installer, insert HTML codes as the above. The HTML code refers the path of the ActiveX control, and the parameters which will be passed to the ActiveX.

+

You have to modify the strings which are emphasized in green fonts above according to the environment of the web server which you deploy on.
+(Notice that the above sample won't work staying in the original code, because the original sample specifies the example URLs.)
+
+For details, refer the online manuals or http://www.softether.org/.
+
+Note: the parameters "SettingUrl" and "LanguageID" are optional.

+

 

+ + + +

The below code is an example to embed the ActiveX control.

+

Notice: This HTML file is a sample. Parameters for vpnweb.cab control are dummy.
Therefore, after you click Start VPN Connection button, you will get an error message.

+ + + + +
+ + + + + + + + +
+ 

If the VPN Client Web Installer ActiveX Control is not displayed on the above brown rectangle, verity the requirements, and make sure that your Web browser allows ActiveX control.

+ + +

 

+

Copyright (c) SoftEther Project at University of Tsukuba, Japan. All Rights Reserved.

+ + + + diff --git a/src/bin/hamcore/vpnweb_sample_ja.htm b/src/bin/hamcore/vpnweb_sample_ja.htm index 270a72b8..f9339eb3 100644 --- a/src/bin/hamcore/vpnweb_sample_ja.htm +++ b/src/bin/hamcore/vpnweb_sample_ja.htm @@ -1,72 +1,72 @@ - - - VPN クライアント Web インストーラ設置ページ サンプル - - - - - - -

VPN クライアント Web インストーラ設置ページのサンプル HTML ファイル

-

この HTML ファイルはサンプルです。
-「SoftEther VPN クライアント Web インストーラ」プログラムを用いて Web インストーラを作成する場合は、下記の事項と本 HTML -ファイルの内容 (HTML ソースコード) を参考にしてください。

- - - - -
<OBJECT ID="VpnWebInstaller"
-    CLASSID="CLSID:64F1A16B-C3EE-484C-B551-35338A9BB6D2"
-    CODEBASE="vpnweb.cab#Version=$VER_MAJOR$,$VER_MINOR$,0,$VER_BUILD$">
-    <PARAM NAME="InstallerExeUrl" VALUE="http://example.com/any_folder/vpninstall.exe">
-    <PARAM NAME="InstallerInfUrl" VALUE="http://example.com/any_folder/vpninstall.inf">
-    <PARAM NAME="SettingUrl" VALUE="http://example.com/any_folder/auto_setting.vpn">
-    <PARAM NAME="LanguageID" VALUE="JA">
- </OBJECT>
-

VPN クライアント Web インストーラを呼び出すための Web ページを作成するためには、Web インストーラを実行するために使用する ActiveX コントロールとそのパラメータを指定するために、HTML ファイル中に上記のようなコードを挿入してください。

-

その際、上記において緑色のフォントで強調されている部分を、設置する Web サーバーなどの環境にあわせて設定してください。
-(上記のサンプルのままでは存在しない URL を指しているため、インストーラは正常に動作しません。)
-
-詳細については本ソフトウェアに同梱されているオンラインマニュアルまたは http://www.softether.org/ をご確認ください。
-
-※ パラメータ "SettingUrl", "LanguageID" については、指定しなくても動作します。

-

 

- - - -

下記に実際に ActiveX コントロールを埋め込んだ例を示します

-

ご注意: この HTML ファイルはサンプルであり、vpnweb.cab に対して渡されるパラメータの内容としてはダミーの URL が入っています。
そのため「VPN 接続の開始」ボタンをクリックした場合でも VPN クライアントソフトウェアのインストール等の処理は開始されません。

- - - - -
- - - - - - - - -
- 

※ 上記の茶色の枠内に VPN クライアント Web インストーラの ActiveX コントロールが表示されない場合は、動作環境を確認してください。また Web ブラウザが ActiveX コントロールを受け入れる設定になっているかどうか確認してください。

- - -

 

-

Copyright (c) SoftEther Project at University of Tsukuba, Japan. All Rights Reserved.

- - - - + + + VPN クライアント Web インストーラ設置ページ サンプル + + + + + + +

VPN クライアント Web インストーラ設置ページのサンプル HTML ファイル

+

この HTML ファイルはサンプルです。
+「SoftEther VPN クライアント Web インストーラ」プログラムを用いて Web インストーラを作成する場合は、下記の事項と本 HTML +ファイルの内容 (HTML ソースコード) を参考にしてください。

+ + + + +
<OBJECT ID="VpnWebInstaller"
+    CLASSID="CLSID:64F1A16B-C3EE-484C-B551-35338A9BB6D2"
+    CODEBASE="vpnweb.cab#Version=$VER_MAJOR$,$VER_MINOR$,0,$VER_BUILD$">
+    <PARAM NAME="InstallerExeUrl" VALUE="http://example.com/any_folder/vpninstall.exe">
+    <PARAM NAME="InstallerInfUrl" VALUE="http://example.com/any_folder/vpninstall.inf">
+    <PARAM NAME="SettingUrl" VALUE="http://example.com/any_folder/auto_setting.vpn">
+    <PARAM NAME="LanguageID" VALUE="JA">
+ </OBJECT>
+

VPN クライアント Web インストーラを呼び出すための Web ページを作成するためには、Web インストーラを実行するために使用する ActiveX コントロールとそのパラメータを指定するために、HTML ファイル中に上記のようなコードを挿入してください。

+

その際、上記において緑色のフォントで強調されている部分を、設置する Web サーバーなどの環境にあわせて設定してください。
+(上記のサンプルのままでは存在しない URL を指しているため、インストーラは正常に動作しません。)
+
+詳細については本ソフトウェアに同梱されているオンラインマニュアルまたは http://www.softether.org/ をご確認ください。
+
+※ パラメータ "SettingUrl", "LanguageID" については、指定しなくても動作します。

+

 

+ + + +

下記に実際に ActiveX コントロールを埋め込んだ例を示します

+

ご注意: この HTML ファイルはサンプルであり、vpnweb.cab に対して渡されるパラメータの内容としてはダミーの URL が入っています。
そのため「VPN 接続の開始」ボタンをクリックした場合でも VPN クライアントソフトウェアのインストール等の処理は開始されません。

+ + + + +
+ + + + + + + + +
+ 

※ 上記の茶色の枠内に VPN クライアント Web インストーラの ActiveX コントロールが表示されない場合は、動作環境を確認してください。また Web ブラウザが ActiveX コントロールを受け入れる設定になっているかどうか確認してください。

+ + +

 

+

Copyright (c) SoftEther Project at University of Tsukuba, Japan. All Rights Reserved.

+ + + + diff --git a/src/bin/hamcore/vpnweb_sample_tw.htm b/src/bin/hamcore/vpnweb_sample_tw.htm index 26f6e0f7..8c7716d0 100644 --- a/src/bin/hamcore/vpnweb_sample_tw.htm +++ b/src/bin/hamcore/vpnweb_sample_tw.htm @@ -1,4 +1,4 @@ - + VPN Client Web Installer Deployment Page Sample HTML diff --git a/src/bin/hamcore/webui/cryptcom.cgi b/src/bin/hamcore/webui/cryptcom.cgi index 587ddf4d..a3e2db88 100644 --- a/src/bin/hamcore/webui/cryptcom.cgi +++ b/src/bin/hamcore/webui/cryptcom.cgi @@ -1,49 +1,49 @@ - -Virtual HUB page - - - -

暗号化と通信関係の設定

- -
- -

使用する暗号化アルゴリズム

-暗号化アルゴリズム名 -
-
-サーバーの管理画面に戻る - - - + +Virtual HUB page + + + +

暗号化と通信関係の設定

+ +
+ +

使用する暗号化アルゴリズム

+暗号化アルゴリズム名 +
+
+サーバーの管理画面に戻る + + + diff --git a/src/bin/hamcore/webui/edituser.cgi b/src/bin/hamcore/webui/edituser.cgi index d9103cd1..cf850e3e 100644 --- a/src/bin/hamcore/webui/edituser.cgi +++ b/src/bin/hamcore/webui/edituser.cgi @@ -1,32 +1,32 @@ - -User page - - - -

ユーザーの編集

- -
- - - - - - - - - - - - - - -
ユーザー名:{USERNAME}
本名:{REALNAME}
説明:{NOTETEXT}
グループ名:{GROUPNAME}
アカウントの有効期限:{EXPIREDATE}
認証方法: - 匿名認証
- パスワード認証 -
パスワード:
パスワード(確認):
- -
-仮想 HUB「{HUBNAME}」のユーザー一覧に戻る -
- - + +User page + + + +

ユーザーの編集

+ +
+ + + + + + + + + + + + + + +
ユーザー名:{USERNAME}
本名:{REALNAME}
説明:{NOTETEXT}
グループ名:{GROUPNAME}
アカウントの有効期限:{EXPIREDATE}
認証方法: + 匿名認証
+ パスワード認証 +
パスワード:
パスワード(確認):
+ +
+仮想 HUB「{HUBNAME}」のユーザー一覧に戻る +
+ + diff --git a/src/bin/hamcore/webui/error.cgi b/src/bin/hamcore/webui/error.cgi index 79908bd3..27199d07 100644 --- a/src/bin/hamcore/webui/error.cgi +++ b/src/bin/hamcore/webui/error.cgi @@ -1,6 +1,6 @@ - -Redirect -ERRMSG -

ブラウザの戻るボタンで戻ってください。

- - + +Redirect +ERRMSG +

ブラウザの戻るボタンで戻ってください。

+ + diff --git a/src/bin/hamcore/webui/hub.cgi b/src/bin/hamcore/webui/hub.cgi index 2e85c617..1e4ddec6 100644 --- a/src/bin/hamcore/webui/hub.cgi +++ b/src/bin/hamcore/webui/hub.cgi @@ -1,51 +1,51 @@ - - -Virtual HUB page - - - -

仮想 HUB の管理

- - -

管理コマンド

- - - - - -
オンライン -オフライン
ユーザーの管理
仮想 NAT および仮想 DHCP サーバー機能
セッションの管理
- - -

仮想 HUB の状態

- - - - - - - - - - - - - - - - - - - - - - -
仮想 HUB 名{HUBNAME}
状態{HUBSTATE}
種類{HUBTYPE}
SecureNAT 機能{HUBSNAT}
セッション数{HUBSESSIONS}
アクセスリスト数{HUBACLS}
ユーザー数{HUBUSERS}
グループ数{HUBGROUPS}
MAC テーブルエントリ数{HUBMACTBLS}
IP テーブルエントリ数{HUBIPTBLS}
ログイン回数{HUBLOGINS}
最終ログイン日時{HUBLASTLOGIN}
最終通信日時{HUBLASTCOMM}
送信ユニキャストパケット数{HUBTXUNIPKTS}
送信ユニキャスト合計サイズ{HUBTXUNISIZE}
送信ブロードキャストパケット数{HUBTXBRPKTS}
送信ブロードキャスト合計サイズ{HUBTXBRSIZE}
受信ユニキャストパケット数{HUBRXUNIPKTS}
受信ユニキャスト合計サイズ{HUBRXUNISIZE}
受信ブロードキャストパケット数{HUBRXBRPKTS}
受信ブロードキャスト合計サイズ{HUBRXBRSIZE}
- -
-サーバーの管理画面に戻る - - - - - + + +Virtual HUB page + + + +

仮想 HUB の管理

+ + +

管理コマンド

+ + + + + +
オンライン +オフライン
ユーザーの管理
仮想 NAT および仮想 DHCP サーバー機能
セッションの管理
+ + +

仮想 HUB の状態

+ + + + + + + + + + + + + + + + + + + + + + +
仮想 HUB 名{HUBNAME}
状態{HUBSTATE}
種類{HUBTYPE}
SecureNAT 機能{HUBSNAT}
セッション数{HUBSESSIONS}
アクセスリスト数{HUBACLS}
ユーザー数{HUBUSERS}
グループ数{HUBGROUPS}
MAC テーブルエントリ数{HUBMACTBLS}
IP テーブルエントリ数{HUBIPTBLS}
ログイン回数{HUBLOGINS}
最終ログイン日時{HUBLASTLOGIN}
最終通信日時{HUBLASTCOMM}
送信ユニキャストパケット数{HUBTXUNIPKTS}
送信ユニキャスト合計サイズ{HUBTXUNISIZE}
送信ブロードキャストパケット数{HUBTXBRPKTS}
送信ブロードキャスト合計サイズ{HUBTXBRSIZE}
受信ユニキャストパケット数{HUBRXUNIPKTS}
受信ユニキャスト合計サイズ{HUBRXUNISIZE}
受信ブロードキャストパケット数{HUBRXBRPKTS}
受信ブロードキャスト合計サイズ{HUBRXBRSIZE}
+ +
+サーバーの管理画面に戻る + + + + + diff --git a/src/bin/hamcore/webui/license.cgi b/src/bin/hamcore/webui/license.cgi index b259d1a0..2bc8ba37 100644 --- a/src/bin/hamcore/webui/license.cgi +++ b/src/bin/hamcore/webui/license.cgi @@ -1,36 +1,36 @@ - -Virtual HUB page - - - -

ライセンスの追加と削除

- -

登録されているライセンスの一覧

- - - - - -
番号ライセンスキーライセンス種類名状態有効期限ライセンス IDライセンス種類 IDサーバー IDシリアル ID
- -

現在の PacketiX VPN Server のライセンスモード

- - - - - - -
製品エディション名{LSEDITIONNAME}
現在のサーバー ID{LSSERVERID}
現在の製品ライセンスの有効期限{LSEXPIRES}
クライアント接続ライセンス数{LSNUMCLIENTS}
ブリッジ接続ライセンス数{LSNUMBRIDGES}
- -

ライセンスの追加

-
-ライセンスキーを入力してください: - - -
- -
-サーバーの管理画面に戻る - - - + +Virtual HUB page + + + +

ライセンスの追加と削除

+ +

登録されているライセンスの一覧

+ + + + + +
番号ライセンスキーライセンス種類名状態有効期限ライセンス IDライセンス種類 IDサーバー IDシリアル ID
+ +

現在の PacketiX VPN Server のライセンスモード

+ + + + + + +
製品エディション名{LSEDITIONNAME}
現在のサーバー ID{LSSERVERID}
現在の製品ライセンスの有効期限{LSEXPIRES}
クライアント接続ライセンス数{LSNUMCLIENTS}
ブリッジ接続ライセンス数{LSNUMBRIDGES}
+ +

ライセンスの追加

+
+ライセンスキーを入力してください: + + +
+ +
+サーバーの管理画面に戻る + + + diff --git a/src/bin/hamcore/webui/listener.cgi b/src/bin/hamcore/webui/listener.cgi index 8ee79f18..f1073dd5 100644 --- a/src/bin/hamcore/webui/listener.cgi +++ b/src/bin/hamcore/webui/listener.cgi @@ -1,13 +1,13 @@ - -Listener Creation - - -リスナーを作成します。 -
-ポート番号: - - - -
- - + +Listener Creation + + +リスナーを作成します。 +
+ポート番号: + + + +
+ + diff --git a/src/bin/hamcore/webui/localbridge.cgi b/src/bin/hamcore/webui/localbridge.cgi index c3c54db5..56f78030 100644 --- a/src/bin/hamcore/webui/localbridge.cgi +++ b/src/bin/hamcore/webui/localbridge.cgi @@ -1,52 +1,52 @@ - -Virtual HUB page - - - -

ローカルブリッジ接続の設定

- -

ローカルブリッジ接続の一覧

- - - - -
仮想 HUB 名ブリッジ先 LAN カード又は tap デバイス名状態
- -

新しいローカルブリッジの定義

-
- - - - - - - - - - - - - - - - - - -
仮想 HUB 名: -
作成する種類:物理的な既存の LAN カードとのブリッジ接続
-新しい tap デバイスとのブリッジ接続
デバイス名: -
新しい tap デバイス名
-
- -
-サーバーの管理画面に戻る - - - - + +Virtual HUB page + + + +

ローカルブリッジ接続の設定

+ +

ローカルブリッジ接続の一覧

+ + + + +
仮想 HUB 名ブリッジ先 LAN カード又は tap デバイス名状態
+ +

新しいローカルブリッジの定義

+
+ + + + + + + + + + + + + + + + + + +
仮想 HUB 名: +
作成する種類:物理的な既存の LAN カードとのブリッジ接続
+新しい tap デバイスとのブリッジ接続
デバイス名: +
新しい tap デバイス名
+
+ +
+サーバーの管理画面に戻る + + + + diff --git a/src/bin/hamcore/webui/login.cgi b/src/bin/hamcore/webui/login.cgi index aef1c24d..74e1cab5 100644 --- a/src/bin/hamcore/webui/login.cgi +++ b/src/bin/hamcore/webui/login.cgi @@ -1,17 +1,17 @@ - -Login page - - -
-

PacketiX VPN Server Web UI ログインページ.

-
- - - - -
仮想 HUB 名:
※仮想 HUB 名を空欄にするとサーバー管理モードになります。
パスワード:
-
- -
- - + +Login page + + +
+

PacketiX VPN Server Web UI ログインページ.

+
+ + + + +
仮想 HUB 名:
※仮想 HUB 名を空欄にするとサーバー管理モードになります。
パスワード:
+
+ +
+ + diff --git a/src/bin/hamcore/webui/newhub.cgi b/src/bin/hamcore/webui/newhub.cgi index d71dfc00..f2b8941a 100644 --- a/src/bin/hamcore/webui/newhub.cgi +++ b/src/bin/hamcore/webui/newhub.cgi @@ -1,18 +1,18 @@ - -Listener Creation - - -

新しい仮想 HUB の作成

-
- - - - -
作成する仮想 HUB の名前:
管理パスワード:
管理パスワード(確認):
- - - -
-サーバー管理画面に戻る - - + +Listener Creation + + +

新しい仮想 HUB の作成

+
+ + + + +
作成する仮想 HUB の名前:
管理パスワード:
管理パスワード(確認):
+ + + +
+サーバー管理画面に戻る + + diff --git a/src/bin/hamcore/webui/redirect.cgi b/src/bin/hamcore/webui/redirect.cgi index f825b7ea..2f18cdb0 100644 --- a/src/bin/hamcore/webui/redirect.cgi +++ b/src/bin/hamcore/webui/redirect.cgi @@ -1,5 +1,5 @@ - -Redirect -

Redirect to:REDIRECT_TO

- - + +Redirect +

Redirect to:REDIRECT_TO

+ + diff --git a/src/bin/hamcore/webui/securenat.cgi b/src/bin/hamcore/webui/securenat.cgi index 04e73c2b..94854eb1 100644 --- a/src/bin/hamcore/webui/securenat.cgi +++ b/src/bin/hamcore/webui/securenat.cgi @@ -1,59 +1,59 @@ - -Virtual HUB page - - - -

仮想 NAT および仮想 DHCP 機能 (Secure NAT) の設定

- -

SecureNAT 機能の有効 / 無効の設定

- -
SecureNAT 機能: -有効 -無効 -
- -

SecureNAT オプションの設定

-
-

仮想 ホストの設定

- - - - -
MAC アドレス
IP アドレス
サブネットマスク
- -

仮想 NAT の設定

-仮想 NAT 機能を使用する - - - - -
MTU 値バイト
TCP セッションのタイムアウト
UDP セッションのタイムアウト
-仮想 NAT の動作を、仮想 HUB のセキュリティログに保存する - -

仮想 DHCP サーバーの設定

-仮想 DHCP サーバー機能を使用する - - - - - -
配布 IP アドレス帯から
まで
サブネットマスク
リース期限
- -

クライアントに割り当てるオプションの設定

- - - - -
デフォルトゲートウェイのアドレス
DNS サーバーのアドレス
ドメイン名
- - - - - -
- -

-仮想 HUB の管理画面に戻る - - - + +Virtual HUB page + + + +

仮想 NAT および仮想 DHCP 機能 (Secure NAT) の設定

+ +

SecureNAT 機能の有効 / 無効の設定

+ +
SecureNAT 機能: +有効 +無効 +
+ +

SecureNAT オプションの設定

+
+

仮想 ホストの設定

+ + + + +
MAC アドレス
IP アドレス
サブネットマスク
+ +

仮想 NAT の設定

+仮想 NAT 機能を使用する + + + + +
MTU 値バイト
TCP セッションのタイムアウト
UDP セッションのタイムアウト
+仮想 NAT の動作を、仮想 HUB のセキュリティログに保存する + +

仮想 DHCP サーバーの設定

+仮想 DHCP サーバー機能を使用する + + + + + +
配布 IP アドレス帯から
まで
サブネットマスク
リース期限
+ +

クライアントに割り当てるオプションの設定

+ + + + +
デフォルトゲートウェイのアドレス
DNS サーバーのアドレス
ドメイン名
+ + + + + +
+ +

+仮想 HUB の管理画面に戻る + + + diff --git a/src/bin/hamcore/webui/server.cgi b/src/bin/hamcore/webui/server.cgi index 371f789b..94560178 100644 --- a/src/bin/hamcore/webui/server.cgi +++ b/src/bin/hamcore/webui/server.cgi @@ -1,42 +1,42 @@ - -Server page - - -

VPN サーバーの管理

- -

仮想 HUB の一覧

- - - - -
新規作成 -仮想 HUB 名状態種類ユーザーグループセッションMACIPログイン回数最終ログイン日時最終通信日時
-
-

リスナーの一覧

- - - - -
- -開始 -停止 -:LISTENER_TMPL--> - -
ポート番号状態新規作成
-
- - - - -
ライセンスの管理
ローカルブリッジの設定
-
- - - - + +Server page + + +

VPN サーバーの管理

+ +

仮想 HUB の一覧

+ + + + +
新規作成 +仮想 HUB 名状態種類ユーザーグループセッションMACIPログイン回数最終ログイン日時最終通信日時
+
+

リスナーの一覧

+ + + + +
+ +開始 +停止 +:LISTENER_TMPL--> + +
ポート番号状態新規作成
+
+ + + + +
ライセンスの管理
ローカルブリッジの設定
+
+ + + + diff --git a/src/bin/hamcore/webui/session.cgi b/src/bin/hamcore/webui/session.cgi index 36a6a104..eb9b93c3 100644 --- a/src/bin/hamcore/webui/session.cgi +++ b/src/bin/hamcore/webui/session.cgi @@ -1,16 +1,16 @@ - -User page - - - -

仮想 HUB「{HUBNAME}」に接続中のセッション

- - - - - -
コマンドセッション名接続しているサーバーユーザー名接続元ホスト名TCP コネクション転送バイト数転送パケット数
-

-仮想 HUB「{HUBNAME}」の管理画面に戻る。 - - + +User page + + + +

仮想 HUB「{HUBNAME}」に接続中のセッション

+ + + + + +
コマンドセッション名接続しているサーバーユーザー名接続元ホスト名TCP コネクション転送バイト数転送パケット数
+

+仮想 HUB「{HUBNAME}」の管理画面に戻る。 + + diff --git a/src/bin/hamcore/webui/user.cgi b/src/bin/hamcore/webui/user.cgi index 7a17b6d0..1c3f4966 100644 --- a/src/bin/hamcore/webui/user.cgi +++ b/src/bin/hamcore/webui/user.cgi @@ -1,18 +1,18 @@ - -User page - - - -

仮想 HUB「{HUBNAME}」のユーザーの管理

- - - - -
新規作成ユーザー名本名所属グループ説明認証方法ログイン回数最終ログイン日時
-
-仮想 HUB「{HUBNAME}」の管理画面に戻る。 - - + +User page + + + +

仮想 HUB「{HUBNAME}」のユーザーの管理

+ + + + +
新規作成ユーザー名本名所属グループ説明認証方法ログイン回数最終ログイン日時
+
+仮想 HUB「{HUBNAME}」の管理画面に戻る。 + + diff --git a/src/bin/hamcore/webui/webui.css b/src/bin/hamcore/webui/webui.css index cd115aac..4e64be8e 100644 --- a/src/bin/hamcore/webui/webui.css +++ b/src/bin/hamcore/webui/webui.css @@ -1,3 +1,3 @@ -body{ - background:white; -} +body{ + background:white; +} diff --git a/src/bin/hamcore/wwwroot/admin/index.html b/src/bin/hamcore/wwwroot/admin/index.html index 7fd17bf2..b4c71961 100644 --- a/src/bin/hamcore/wwwroot/admin/index.html +++ b/src/bin/hamcore/wwwroot/admin/index.html @@ -1,4 +1,4 @@ - + diff --git a/src/hamcorebuilder/hamcorebuilder.c b/src/hamcorebuilder/hamcorebuilder.c index a9a498d9..27a6bfed 100644 --- a/src/hamcorebuilder/hamcorebuilder.c +++ b/src/hamcorebuilder/hamcorebuilder.c @@ -1,75 +1,75 @@ -// SoftEther VPN Source Code - Developer Edition Master Branch -// Cedar Communication Module - - -// hamcorebuilder.c -// hamcore.se2 Build Utility - -#include - -#ifdef WIN32 -#include -#include -#include -#include -#include -#include -#include -#endif // WIN32 -#include -#include -#include -#include -#include -#include -#include -#include - - -// main function -int main(int argc, char *argv[]) -{ - MayaquaMinimalMode(); - -#if defined(_DEBUG) || defined(DEBUG) // In VC++ compilers, the macro is "_DEBUG", not "DEBUG". - // If set memcheck = true, the program will be vitally slow since it will log all malloc() / realloc() / free() calls to find the cause of memory leak. - // For normal debug we set memcheck = false. - // Please set memcheck = true if you want to test the cause of memory leaks. - InitMayaqua(false, true, argc, argv); -#else - InitMayaqua(false, false, argc, argv); -#endif - InitCedar(); - - Print("hamcore.se2 Build Utility\n"); - Print("Copyright (c) SoftEther VPN Project. All Rights Reserved.\n\n"); - - if (argc < 3) - { - Print("Usage: hamcorebuilder \n\n"); - } - else - { - char *src_dir = argv[1]; - char *dst_filename = argv[2]; - - Print("Src Dir: '%s'\n", src_dir); - Print("Dest Filename: '%s'\n", dst_filename); - - Print("\nProcessing...\n"); - -#ifdef WIN32 - BuildHamcore(dst_filename, src_dir, false); -#else - BuildHamcore(dst_filename, src_dir, true); -#endif - - Print("\nDone.\n"); - } - - FreeCedar(); - FreeMayaqua(); - - return 0; -} - +// SoftEther VPN Source Code - Developer Edition Master Branch +// Cedar Communication Module + + +// hamcorebuilder.c +// hamcore.se2 Build Utility + +#include + +#ifdef WIN32 +#include +#include +#include +#include +#include +#include +#include +#endif // WIN32 +#include +#include +#include +#include +#include +#include +#include +#include + + +// main function +int main(int argc, char *argv[]) +{ + MayaquaMinimalMode(); + +#if defined(_DEBUG) || defined(DEBUG) // In VC++ compilers, the macro is "_DEBUG", not "DEBUG". + // If set memcheck = true, the program will be vitally slow since it will log all malloc() / realloc() / free() calls to find the cause of memory leak. + // For normal debug we set memcheck = false. + // Please set memcheck = true if you want to test the cause of memory leaks. + InitMayaqua(false, true, argc, argv); +#else + InitMayaqua(false, false, argc, argv); +#endif + InitCedar(); + + Print("hamcore.se2 Build Utility\n"); + Print("Copyright (c) SoftEther VPN Project. All Rights Reserved.\n\n"); + + if (argc < 3) + { + Print("Usage: hamcorebuilder \n\n"); + } + else + { + char *src_dir = argv[1]; + char *dst_filename = argv[2]; + + Print("Src Dir: '%s'\n", src_dir); + Print("Dest Filename: '%s'\n", dst_filename); + + Print("\nProcessing...\n"); + +#ifdef WIN32 + BuildHamcore(dst_filename, src_dir, false); +#else + BuildHamcore(dst_filename, src_dir, true); +#endif + + Print("\nDone.\n"); + } + + FreeCedar(); + FreeMayaqua(); + + return 0; +} + diff --git a/src/vpn16/Resource.h b/src/vpn16/Resource.h index 9714d56f..0a4dd6a1 100644 --- a/src/vpn16/Resource.h +++ b/src/vpn16/Resource.h @@ -1,17 +1,17 @@ -//{{NO_DEPENDENCIES}} -// App Studio generated include file. -// Used by VPN16.RC -// -#define IDI_ICON2 102 - -// Next default values for new objects -// -#ifdef APSTUDIO_INVOKED -#ifndef APSTUDIO_READONLY_SYMBOLS - -#define _APS_NEXT_RESOURCE_VALUE 103 -#define _APS_NEXT_COMMAND_VALUE 40001 -#define _APS_NEXT_CONTROL_VALUE 1000 -#define _APS_NEXT_SYMED_VALUE 101 -#endif -#endif +//{{NO_DEPENDENCIES}} +// App Studio generated include file. +// Used by VPN16.RC +// +#define IDI_ICON2 102 + +// Next default values for new objects +// +#ifdef APSTUDIO_INVOKED +#ifndef APSTUDIO_READONLY_SYMBOLS + +#define _APS_NEXT_RESOURCE_VALUE 103 +#define _APS_NEXT_COMMAND_VALUE 40001 +#define _APS_NEXT_CONTROL_VALUE 1000 +#define _APS_NEXT_SYMED_VALUE 101 +#endif +#endif diff --git a/src/vpn16/Vpn16.def b/src/vpn16/Vpn16.def index b331b7a0..a3484c4e 100644 --- a/src/vpn16/Vpn16.def +++ b/src/vpn16/Vpn16.def @@ -1,8 +1,8 @@ -NAME VPN16 -EXETYPE WINDOWS -CODE PRELOAD MOVEABLE DISCARDABLE -DATA PRELOAD MOVEABLE MULTIPLE -HEAPSIZE 1024 - -EXPORTS -; ===List your explicitly exported functions here=== +NAME VPN16 +EXETYPE WINDOWS +CODE PRELOAD MOVEABLE DISCARDABLE +DATA PRELOAD MOVEABLE MULTIPLE +HEAPSIZE 1024 + +EXPORTS +; ===List your explicitly exported functions here=== diff --git a/src/vpn16/Vpn16.mak b/src/vpn16/Vpn16.mak index 6ab27867..534f7311 100644 --- a/src/vpn16/Vpn16.mak +++ b/src/vpn16/Vpn16.mak @@ -1,86 +1,86 @@ -# Microsoft Visual C++ generated build script - Do not modify - -PROJ = VPN16 -DEBUG = 0 -PROGTYPE = 0 -CALLER = -ARGS = -DLLS = -D_RCDEFINES = -d_DEBUG -R_RCDEFINES = -dNDEBUG -ORIGIN = MSVC -ORIGIN_VER = 1.00 -PROJPATH = C:\dev\vpn\vpn16\ -USEMFC = 0 -CC = cl -CPP = cl -CXX = cl -CCREATEPCHFLAG = -CPPCREATEPCHFLAG = -CUSEPCHFLAG = -CPPUSEPCHFLAG = -FIRSTC = -FIRSTCPP = -RC = rc -CFLAGS_D_WEXE = /nologo /W3 /FR /G2 /Zi /D_DEBUG /Od /AM /GA /Fd"VPN16.PDB" /I "C:\98DDK\inc\win98\inc16" /I "C:\98DDK\inc\win98" -CFLAGS_R_WEXE = /nologo /W3 /FR /O1 /DNDEBUG /AM /GA /I "C:\98DDK\inc\win98\inc16" /I "C:\98DDK\inc\win98" -LFLAGS_D_WEXE = /NOLOGO /ONERROR:NOEXE /NOD /PACKC:61440 /CO /ALIGN:16 /STACK:10240 -LFLAGS_R_WEXE = /NOLOGO /ONERROR:NOEXE /NOD /PACKC:61440 /ALIGN:16 /STACK:10240 -LIBS_D_WEXE = oldnames libw commdlg shell olecli olesvr winnls mlibcew C:\98DDK\lib\win98\setupx -LIBS_R_WEXE = oldnames libw commdlg shell olecli olesvr winnls mlibcew C:\98DDK\lib\win98\setupx -RCFLAGS = /nologo -RESFLAGS = /nologo -RUNFLAGS = -DEFFILE = VPN16.DEF -OBJS_EXT = -LIBS_EXT = -!if "$(DEBUG)" == "1" -CFLAGS = $(CFLAGS_D_WEXE) -LFLAGS = $(LFLAGS_D_WEXE) -LIBS = $(LIBS_D_WEXE) -MAPFILE = nul -RCDEFINES = $(D_RCDEFINES) -!else -CFLAGS = $(CFLAGS_R_WEXE) -LFLAGS = $(LFLAGS_R_WEXE) -LIBS = $(LIBS_R_WEXE) -MAPFILE = nul -RCDEFINES = $(R_RCDEFINES) -!endif -!if [if exist MSVC.BND del MSVC.BND] -!endif -SBRS = VPN16.SBR - - -VPN16_DEP = c:\dev\vpn\vpn16\vpn16.h - - -all: $(PROJ).EXE $(PROJ).BSC - -VPN16.OBJ: VPN16.C $(VPN16_DEP) - $(CC) $(CFLAGS) $(CUSEPCHFLAG) /c VPN16.C - - -$(PROJ).EXE:: VPN16.OBJ $(OBJS_EXT) $(DEFFILE) - echo >NUL @<<$(PROJ).CRF -VPN16.OBJ + -$(OBJS_EXT) -$(PROJ).EXE -$(MAPFILE) -c:\msvc\lib\+ -c:\msvc\mfc\lib\+ -$(LIBS) -$(DEFFILE); -<< - link $(LFLAGS) @$(PROJ).CRF - $(RC) $(RESFLAGS) vpn16.rc $(PROJ).EXE - - -run: $(PROJ).EXE - $(PROJ) $(RUNFLAGS) - - -$(PROJ).BSC: $(SBRS) - bscmake @<< -/o$@ $(SBRS) -<< +# Microsoft Visual C++ generated build script - Do not modify + +PROJ = VPN16 +DEBUG = 0 +PROGTYPE = 0 +CALLER = +ARGS = +DLLS = +D_RCDEFINES = -d_DEBUG +R_RCDEFINES = -dNDEBUG +ORIGIN = MSVC +ORIGIN_VER = 1.00 +PROJPATH = C:\dev\vpn\vpn16\ +USEMFC = 0 +CC = cl +CPP = cl +CXX = cl +CCREATEPCHFLAG = +CPPCREATEPCHFLAG = +CUSEPCHFLAG = +CPPUSEPCHFLAG = +FIRSTC = +FIRSTCPP = +RC = rc +CFLAGS_D_WEXE = /nologo /W3 /FR /G2 /Zi /D_DEBUG /Od /AM /GA /Fd"VPN16.PDB" /I "C:\98DDK\inc\win98\inc16" /I "C:\98DDK\inc\win98" +CFLAGS_R_WEXE = /nologo /W3 /FR /O1 /DNDEBUG /AM /GA /I "C:\98DDK\inc\win98\inc16" /I "C:\98DDK\inc\win98" +LFLAGS_D_WEXE = /NOLOGO /ONERROR:NOEXE /NOD /PACKC:61440 /CO /ALIGN:16 /STACK:10240 +LFLAGS_R_WEXE = /NOLOGO /ONERROR:NOEXE /NOD /PACKC:61440 /ALIGN:16 /STACK:10240 +LIBS_D_WEXE = oldnames libw commdlg shell olecli olesvr winnls mlibcew C:\98DDK\lib\win98\setupx +LIBS_R_WEXE = oldnames libw commdlg shell olecli olesvr winnls mlibcew C:\98DDK\lib\win98\setupx +RCFLAGS = /nologo +RESFLAGS = /nologo +RUNFLAGS = +DEFFILE = VPN16.DEF +OBJS_EXT = +LIBS_EXT = +!if "$(DEBUG)" == "1" +CFLAGS = $(CFLAGS_D_WEXE) +LFLAGS = $(LFLAGS_D_WEXE) +LIBS = $(LIBS_D_WEXE) +MAPFILE = nul +RCDEFINES = $(D_RCDEFINES) +!else +CFLAGS = $(CFLAGS_R_WEXE) +LFLAGS = $(LFLAGS_R_WEXE) +LIBS = $(LIBS_R_WEXE) +MAPFILE = nul +RCDEFINES = $(R_RCDEFINES) +!endif +!if [if exist MSVC.BND del MSVC.BND] +!endif +SBRS = VPN16.SBR + + +VPN16_DEP = c:\dev\vpn\vpn16\vpn16.h + + +all: $(PROJ).EXE $(PROJ).BSC + +VPN16.OBJ: VPN16.C $(VPN16_DEP) + $(CC) $(CFLAGS) $(CUSEPCHFLAG) /c VPN16.C + + +$(PROJ).EXE:: VPN16.OBJ $(OBJS_EXT) $(DEFFILE) + echo >NUL @<<$(PROJ).CRF +VPN16.OBJ + +$(OBJS_EXT) +$(PROJ).EXE +$(MAPFILE) +c:\msvc\lib\+ +c:\msvc\mfc\lib\+ +$(LIBS) +$(DEFFILE); +<< + link $(LFLAGS) @$(PROJ).CRF + $(RC) $(RESFLAGS) vpn16.rc $(PROJ).EXE + + +run: $(PROJ).EXE + $(PROJ) $(RUNFLAGS) + + +$(PROJ).BSC: $(SBRS) + bscmake @<< +/o$@ $(SBRS) +<< diff --git a/src/vpn16/Vpn16.rc b/src/vpn16/Vpn16.rc index eac2248f..25dfbb42 100644 --- a/src/vpn16/Vpn16.rc +++ b/src/vpn16/Vpn16.rc @@ -1,57 +1,57 @@ -//Microsoft App Studio generated resource script. -// -#include "resource.h" - -#define APSTUDIO_READONLY_SYMBOLS -///////////////////////////////////////////////////////////////////////// -// -// Generated from the TEXTINCLUDE 2 resource. -// - -///////////////////////////////////////////////////////////////////////////////////// -#undef APSTUDIO_READONLY_SYMBOLS - - -////////////////////////////////////////////////////////////////////////////// -// -// Icon -// - -IDI_ICON2 ICON DISCARDABLE "NET01.ICO" -#ifdef APSTUDIO_INVOKED -////////////////////////////////////////////////////////////////////////////// -// -// TEXTINCLUDE -// - -1 TEXTINCLUDE DISCARDABLE -BEGIN - "resource.h\0" -END - -2 TEXTINCLUDE DISCARDABLE -BEGIN - "#include ""winres.h""\r\n" - "\0" -END - -3 TEXTINCLUDE DISCARDABLE -BEGIN - "\r\n" - "\0" -END - -///////////////////////////////////////////////////////////////////////////////////// -#endif // APSTUDIO_INVOKED - - -#ifndef APSTUDIO_INVOKED -//////////////////////////////////////////////////////////////////////////////// -// -// Generated from the TEXTINCLUDE 3 resource. -// - - -///////////////////////////////////////////////////////////////////////////////////// -#endif // not APSTUDIO_INVOKED - +//Microsoft App Studio generated resource script. +// +#include "resource.h" + +#define APSTUDIO_READONLY_SYMBOLS +///////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 2 resource. +// + +///////////////////////////////////////////////////////////////////////////////////// +#undef APSTUDIO_READONLY_SYMBOLS + + +////////////////////////////////////////////////////////////////////////////// +// +// Icon +// + +IDI_ICON2 ICON DISCARDABLE "NET01.ICO" +#ifdef APSTUDIO_INVOKED +////////////////////////////////////////////////////////////////////////////// +// +// TEXTINCLUDE +// + +1 TEXTINCLUDE DISCARDABLE +BEGIN + "resource.h\0" +END + +2 TEXTINCLUDE DISCARDABLE +BEGIN + "#include ""winres.h""\r\n" + "\0" +END + +3 TEXTINCLUDE DISCARDABLE +BEGIN + "\r\n" + "\0" +END + +///////////////////////////////////////////////////////////////////////////////////// +#endif // APSTUDIO_INVOKED + + +#ifndef APSTUDIO_INVOKED +//////////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 3 resource. +// + + +///////////////////////////////////////////////////////////////////////////////////// +#endif // not APSTUDIO_INVOKED + diff --git a/src/vpn16/Vpn16.vcw b/src/vpn16/Vpn16.vcw index 09695cd0..9ee63c42 100644 --- a/src/vpn16/Vpn16.vcw +++ b/src/vpn16/Vpn16.vcw @@ -1,6 +1,6 @@ -[MSVC Status File] -Version=1.00 -ProjectType=10 -External=0 -BrkptCount=0 -WatchCount=0 +[MSVC Status File] +Version=1.00 +ProjectType=10 +External=0 +BrkptCount=0 +WatchCount=0 diff --git a/src/vpn16/vpn16.c b/src/vpn16/vpn16.c index 5957db08..aeb37d21 100644 --- a/src/vpn16/vpn16.c +++ b/src/vpn16/vpn16.c @@ -1,381 +1,381 @@ -// SoftEther VPN Source Code - Developer Edition Master Branch -// 16-bit Driver Install Utility for Windows 9x - - -// vpn16.c -// 16-bit Driver Install Utility for Windows 9x - -// ---------------------------------------------------------------------------------- -// A part of this file is from Microsoft Windows 98 DDK. -// Copyright (c) 1996, Microsoft Corporation. All Rights Reserved. -// -// Windows 98 Driver Development Kit License.txt: -// * SAMPLE CODE. You may modify the sample source code ("Sample Code") -// included with the SOFTWARE PRODUCT to design, develop and test your Application. -// ---------------------------------------------------------------------------------- - - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "vpn16.h" - -void GetDirFromPath(char *dst, char *src) -{ - char str[MAX_PATH]; - int i,len; - char c; - char tmp[MAX_PATH]; - int wp; - if (src) - { - strcpy(str, src); - } - else - { - strcpy(str, dst); - } - NukuEn(str, NULL); - wp = 0; - len = strlen(str); - dst[0] = 0; - for (i = 0;i < len;i++) - { - c = str[i]; - switch (c) - { - case '\\': - tmp[wp] = 0; - wp = 0; - strcat(dst, tmp); - strcat(dst, "\\"); - break; - default: - tmp[wp] = c; - wp++; - break; - } - } - NukuEn(dst, NULL); -} - -void NukuEn(char *dst, char *src) -{ - char str[MAX_PATH]; - int i; - if (src) - { - strcpy(str, src); - } - else - { - strcpy(str, dst); - } - i = strlen(str); - if (str[i - 1] == '\\') - { - str[i - 1] = 0; - } - strcpy(dst, str); -} - -void Print(char *fmt, ...) -{ - char tmp[260]; - va_list args; - if (fmt == NULL) - { - return; - } - - va_start(args, fmt); - _vsnprintf(tmp, sizeof(tmp), fmt, args); - - MessageBox(NULL, tmp, "SoftEther VPN 16-bit Utility", MB_ICONEXCLAMATION); - va_end(args); -} - -BOOL IsFile(char *name) -{ - HFILE h; - if (name == NULL) - { - return FALSE; - } - - h = _lopen(name, OF_READ); - if (h == HFILE_ERROR) - { - return FALSE; - } - _lclose(h); - - return TRUE; -} - -void InstallMain(char *name) -{ - char sysdir[MAX_PATH]; - char windir[MAX_PATH]; - char infdir[MAX_PATH]; - char otherdir[MAX_PATH]; - char infname[MAX_PATH]; - char deviceid[MAX_PATH]; - char sysname[MAX_PATH]; - if (name == NULL) - { - return; - } - if (strlen(name) == 0 || strlen(name) >= 5) - { - return; - } - - GetSystemDirectory(sysdir, sizeof(sysdir)); - - GetDirFromPath(windir, sysdir); - - sprintf(infdir, "%s\\inf", windir); - - sprintf(otherdir, "%s\\other", infdir); - - sprintf(infname, "%s\\Neo_%s.inf", infdir, name); - - sprintf(sysname, "%s\\Neo_%s.sys", sysdir, name); - - sprintf(deviceid, "NeoAdapter_%s", name); - - if (IsFile(infname) == FALSE) - { - Print("Failed to open %s.", infname); - return; - } - if (IsFile(sysname) == FALSE) - { - Print("Failed to open %s.", sysname); - return; - } - - if (DiInstallClass(infname, 0) != OK) - { - Print("Failed to register %s.\n", infname); - return; - } - - if (InstallNDIDevice("Net", deviceid, NULL, NULL) != OK) - { - return; - } -} - -void Test() -{ - char *inf = "c:\\windows\\inf\\other\\Neo_TEST.inf"; - - if (DiInstallClass(inf, 0) == OK) - { - Print("DiInstallClass Ok."); - if (InstallNDIDevice("Net", "NeoAdapter_TEST", NULL, NULL) == OK) - { - Print("InstallNDIDevice Ok.\n"); - } - else - { - Print("InstallNDIDevice Failed.\n"); - } - } - else - { - Print("DiInstallClass Failed. "); - } -} - -RETERR InstallNDIDevice(const char* szClass, - const char* szDeviceID, - const char* szDriverPath, - const char* szRegPath) -{ - char *szClassNetProtocol = "NetTrans"; - char *szClassNet = "Net"; - char *szClassNetClient = "NetClient"; - char *szClassNetService = "NetService"; - char *szNull = ""; - char *szClassNetInfFileName = "Net.inf"; - char *szClassNetTransInfFileName = "Nettrans.inf"; - char *szClassNetClientInfFileName = "Netcli.inf"; - char *szClassNetServiceInfFileName = "Netservr.inf"; - char *szRegKeyNdi = "Ndi"; - char *szRegKeyBindings = "Bindings"; - char *szRegValDeviceID = "DeviceID"; - char *szRegValDriverDesc = "DriverDesc"; - char *szRegValCompatibleIDs = REGSTR_VAL_COMPATIBLEIDS; - char *szRegPathNetwork = "Enum\\Network\\"; - char *szRegPathFilter = "Enum\\Filter\\"; - char *szRegPathTemp = "\\Temp"; - char *szVServer = "VSERVER"; - LPDEVICE_INFO lpdi = NULL; - RETERR err = OK; - - err = DiCreateDeviceInfo( &lpdi, NULL, 0, NULL, NULL, szClass, NULL ); - - if (err == OK) - { - HKEY hKeyTmp; - - lpdi->hRegKey = HKEY_LOCAL_MACHINE; - lstrcpy( lpdi->szRegSubkey, szRegPathNetwork ); - lstrcat( lpdi->szRegSubkey, lpdi->szClassName ); - lstrcat( lpdi->szRegSubkey, szRegPathTemp ); - - err = DiCreateDevRegKey( lpdi, &hKeyTmp, NULL, NULL, DIREG_DEV ); - - if (err == OK) - { - if (SURegSetValueEx(hKeyTmp, - szRegValCompatibleIDs, - 0, - REG_SZ, - (unsigned char *) szDeviceID, - lstrlen( szDeviceID ) + 1 ) == ERROR_SUCCESS ) - { - if ( szDriverPath ) - { - if ( lpdi->atDriverPath = GlobalAddAtom( szDriverPath ) ) - lpdi->Flags |= DI_ENUMSINGLEINF; - } - - err = DiBuildCompatDrvList( lpdi ); - - SURegCloseKey( hKeyTmp ); - - DiDeleteDevRegKey( lpdi, DIREG_DEV ); - lpdi->hRegKey = NULL; - lstrcpy( lpdi->szRegSubkey, szNull ); - - if ( err || !lpdi->lpCompatDrvList ) - { - err = DiSelectDevice( lpdi ); - } - else - { - lpdi->lpSelectedDriver = lpdi->lpCompatDrvList; - } - - if ( err == OK ) - { - if ( szRegPath ) - { - lpdi->hRegKey = HKEY_LOCAL_MACHINE; - lstrcpy( lpdi->szRegSubkey, szRegPath ); - - DiCreateDevRegKey( lpdi, &hKeyTmp, NULL, NULL, DIREG_DEV ); - } - - lpdi->Flags |= DI_NOVCP | DI_NOFILECOPY | DI_QUIETINSTALL; - err = DiCallClassInstaller( DIF_INSTALLDEVICE, lpdi ); - } - else - { - DiDestroyDeviceInfoList( lpdi ); - } - } - else - { - DiDeleteDevRegKey( lpdi, DIREG_DEV ); - DiDestroyDeviceInfoList( lpdi ); - } - } - else - { - DiDestroyDeviceInfoList( lpdi ); - } - } - - return err; -} - -BOOL IsSafeChar(char c) -{ - UINT i, len; - char *check_str = - "ABCDEFGHIJKLMNOPQRSTUVWXYZ" - "abcdefghijklmnopqrstuvwxyz" - "0123456789" - " ()-_#%&."; - - len = strlen(check_str); - for (i = 0;i < len;i++) - { - if (c == check_str[i]) - { - return TRUE; - } - } - return FALSE; -} - -BOOL IsSafeStr(char *str) -{ - UINT i, len; - if (str == NULL) - { - return FALSE; - } - - len = strlen(str); - for (i = 0;i < len;i++) - { - if (IsSafeChar(str[i]) == FALSE) - { - return FALSE; - } - } - if (str[0] == ' ') - { - return FALSE; - } - if (len != 0) - { - if (str[len - 1] == ' ') - { - return FALSE; - } - } - return TRUE; -} - -// WinMain -int PASCAL WinMain(HINSTANCE hInst, HINSTANCE hPrev, LPSTR CmdLine32, int CmdShow) -{ - char CmdLine[MAX_PATH]; - UINT wp; - wp = 0; - while (TRUE) - { - CmdLine[wp++] = *CmdLine32; - if (*CmdLine32 == 0) - { - break; - } - CmdLine32++; - - } - if (strlen(CmdLine) == 0 || strlen(CmdLine) >= 5 || IsSafeStr(CmdLine) == FALSE) - { - Print("Please execute VPN Client Connection Manager."); - } - else - { - InstallMain(CmdLine); - } - return 0; -} - - +// SoftEther VPN Source Code - Developer Edition Master Branch +// 16-bit Driver Install Utility for Windows 9x + + +// vpn16.c +// 16-bit Driver Install Utility for Windows 9x + +// ---------------------------------------------------------------------------------- +// A part of this file is from Microsoft Windows 98 DDK. +// Copyright (c) 1996, Microsoft Corporation. All Rights Reserved. +// +// Windows 98 Driver Development Kit License.txt: +// * SAMPLE CODE. You may modify the sample source code ("Sample Code") +// included with the SOFTWARE PRODUCT to design, develop and test your Application. +// ---------------------------------------------------------------------------------- + + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "vpn16.h" + +void GetDirFromPath(char *dst, char *src) +{ + char str[MAX_PATH]; + int i,len; + char c; + char tmp[MAX_PATH]; + int wp; + if (src) + { + strcpy(str, src); + } + else + { + strcpy(str, dst); + } + NukuEn(str, NULL); + wp = 0; + len = strlen(str); + dst[0] = 0; + for (i = 0;i < len;i++) + { + c = str[i]; + switch (c) + { + case '\\': + tmp[wp] = 0; + wp = 0; + strcat(dst, tmp); + strcat(dst, "\\"); + break; + default: + tmp[wp] = c; + wp++; + break; + } + } + NukuEn(dst, NULL); +} + +void NukuEn(char *dst, char *src) +{ + char str[MAX_PATH]; + int i; + if (src) + { + strcpy(str, src); + } + else + { + strcpy(str, dst); + } + i = strlen(str); + if (str[i - 1] == '\\') + { + str[i - 1] = 0; + } + strcpy(dst, str); +} + +void Print(char *fmt, ...) +{ + char tmp[260]; + va_list args; + if (fmt == NULL) + { + return; + } + + va_start(args, fmt); + _vsnprintf(tmp, sizeof(tmp), fmt, args); + + MessageBox(NULL, tmp, "SoftEther VPN 16-bit Utility", MB_ICONEXCLAMATION); + va_end(args); +} + +BOOL IsFile(char *name) +{ + HFILE h; + if (name == NULL) + { + return FALSE; + } + + h = _lopen(name, OF_READ); + if (h == HFILE_ERROR) + { + return FALSE; + } + _lclose(h); + + return TRUE; +} + +void InstallMain(char *name) +{ + char sysdir[MAX_PATH]; + char windir[MAX_PATH]; + char infdir[MAX_PATH]; + char otherdir[MAX_PATH]; + char infname[MAX_PATH]; + char deviceid[MAX_PATH]; + char sysname[MAX_PATH]; + if (name == NULL) + { + return; + } + if (strlen(name) == 0 || strlen(name) >= 5) + { + return; + } + + GetSystemDirectory(sysdir, sizeof(sysdir)); + + GetDirFromPath(windir, sysdir); + + sprintf(infdir, "%s\\inf", windir); + + sprintf(otherdir, "%s\\other", infdir); + + sprintf(infname, "%s\\Neo_%s.inf", infdir, name); + + sprintf(sysname, "%s\\Neo_%s.sys", sysdir, name); + + sprintf(deviceid, "NeoAdapter_%s", name); + + if (IsFile(infname) == FALSE) + { + Print("Failed to open %s.", infname); + return; + } + if (IsFile(sysname) == FALSE) + { + Print("Failed to open %s.", sysname); + return; + } + + if (DiInstallClass(infname, 0) != OK) + { + Print("Failed to register %s.\n", infname); + return; + } + + if (InstallNDIDevice("Net", deviceid, NULL, NULL) != OK) + { + return; + } +} + +void Test() +{ + char *inf = "c:\\windows\\inf\\other\\Neo_TEST.inf"; + + if (DiInstallClass(inf, 0) == OK) + { + Print("DiInstallClass Ok."); + if (InstallNDIDevice("Net", "NeoAdapter_TEST", NULL, NULL) == OK) + { + Print("InstallNDIDevice Ok.\n"); + } + else + { + Print("InstallNDIDevice Failed.\n"); + } + } + else + { + Print("DiInstallClass Failed. "); + } +} + +RETERR InstallNDIDevice(const char* szClass, + const char* szDeviceID, + const char* szDriverPath, + const char* szRegPath) +{ + char *szClassNetProtocol = "NetTrans"; + char *szClassNet = "Net"; + char *szClassNetClient = "NetClient"; + char *szClassNetService = "NetService"; + char *szNull = ""; + char *szClassNetInfFileName = "Net.inf"; + char *szClassNetTransInfFileName = "Nettrans.inf"; + char *szClassNetClientInfFileName = "Netcli.inf"; + char *szClassNetServiceInfFileName = "Netservr.inf"; + char *szRegKeyNdi = "Ndi"; + char *szRegKeyBindings = "Bindings"; + char *szRegValDeviceID = "DeviceID"; + char *szRegValDriverDesc = "DriverDesc"; + char *szRegValCompatibleIDs = REGSTR_VAL_COMPATIBLEIDS; + char *szRegPathNetwork = "Enum\\Network\\"; + char *szRegPathFilter = "Enum\\Filter\\"; + char *szRegPathTemp = "\\Temp"; + char *szVServer = "VSERVER"; + LPDEVICE_INFO lpdi = NULL; + RETERR err = OK; + + err = DiCreateDeviceInfo( &lpdi, NULL, 0, NULL, NULL, szClass, NULL ); + + if (err == OK) + { + HKEY hKeyTmp; + + lpdi->hRegKey = HKEY_LOCAL_MACHINE; + lstrcpy( lpdi->szRegSubkey, szRegPathNetwork ); + lstrcat( lpdi->szRegSubkey, lpdi->szClassName ); + lstrcat( lpdi->szRegSubkey, szRegPathTemp ); + + err = DiCreateDevRegKey( lpdi, &hKeyTmp, NULL, NULL, DIREG_DEV ); + + if (err == OK) + { + if (SURegSetValueEx(hKeyTmp, + szRegValCompatibleIDs, + 0, + REG_SZ, + (unsigned char *) szDeviceID, + lstrlen( szDeviceID ) + 1 ) == ERROR_SUCCESS ) + { + if ( szDriverPath ) + { + if ( lpdi->atDriverPath = GlobalAddAtom( szDriverPath ) ) + lpdi->Flags |= DI_ENUMSINGLEINF; + } + + err = DiBuildCompatDrvList( lpdi ); + + SURegCloseKey( hKeyTmp ); + + DiDeleteDevRegKey( lpdi, DIREG_DEV ); + lpdi->hRegKey = NULL; + lstrcpy( lpdi->szRegSubkey, szNull ); + + if ( err || !lpdi->lpCompatDrvList ) + { + err = DiSelectDevice( lpdi ); + } + else + { + lpdi->lpSelectedDriver = lpdi->lpCompatDrvList; + } + + if ( err == OK ) + { + if ( szRegPath ) + { + lpdi->hRegKey = HKEY_LOCAL_MACHINE; + lstrcpy( lpdi->szRegSubkey, szRegPath ); + + DiCreateDevRegKey( lpdi, &hKeyTmp, NULL, NULL, DIREG_DEV ); + } + + lpdi->Flags |= DI_NOVCP | DI_NOFILECOPY | DI_QUIETINSTALL; + err = DiCallClassInstaller( DIF_INSTALLDEVICE, lpdi ); + } + else + { + DiDestroyDeviceInfoList( lpdi ); + } + } + else + { + DiDeleteDevRegKey( lpdi, DIREG_DEV ); + DiDestroyDeviceInfoList( lpdi ); + } + } + else + { + DiDestroyDeviceInfoList( lpdi ); + } + } + + return err; +} + +BOOL IsSafeChar(char c) +{ + UINT i, len; + char *check_str = + "ABCDEFGHIJKLMNOPQRSTUVWXYZ" + "abcdefghijklmnopqrstuvwxyz" + "0123456789" + " ()-_#%&."; + + len = strlen(check_str); + for (i = 0;i < len;i++) + { + if (c == check_str[i]) + { + return TRUE; + } + } + return FALSE; +} + +BOOL IsSafeStr(char *str) +{ + UINT i, len; + if (str == NULL) + { + return FALSE; + } + + len = strlen(str); + for (i = 0;i < len;i++) + { + if (IsSafeChar(str[i]) == FALSE) + { + return FALSE; + } + } + if (str[0] == ' ') + { + return FALSE; + } + if (len != 0) + { + if (str[len - 1] == ' ') + { + return FALSE; + } + } + return TRUE; +} + +// WinMain +int PASCAL WinMain(HINSTANCE hInst, HINSTANCE hPrev, LPSTR CmdLine32, int CmdShow) +{ + char CmdLine[MAX_PATH]; + UINT wp; + wp = 0; + while (TRUE) + { + CmdLine[wp++] = *CmdLine32; + if (*CmdLine32 == 0) + { + break; + } + CmdLine32++; + + } + if (strlen(CmdLine) == 0 || strlen(CmdLine) >= 5 || IsSafeStr(CmdLine) == FALSE) + { + Print("Please execute VPN Client Connection Manager."); + } + else + { + InstallMain(CmdLine); + } + return 0; +} + + diff --git a/src/vpn16/vpn16.h b/src/vpn16/vpn16.h index 7a2bb97d..45856fd9 100644 --- a/src/vpn16/vpn16.h +++ b/src/vpn16/vpn16.h @@ -1,26 +1,26 @@ -// SoftEther VPN Source Code - Developer Edition Master Branch -// 16-bit Driver Install Utility for Windows 9x - - -// vpn16.h -// 16-bit Driver Install Utility for Windows 9x - -#ifndef VPN16_H -#define VPN16_H - -void Test(); -void Print(char *fmt, ...); -RETERR InstallNDIDevice(const char* szClass, - const char* szDeviceID, - const char* szDriverPath, - const char* szRegPath); -void InstallMain(char *name); -void GetDirFromPath(char *dst, char *src); -void NukuEn(char *dst, char *src); -BOOL IsFile(char *name); -BOOL IsSafeStr(char *str); -BOOL IsSafeChar(char c); - -#endif // VPN16_H - - +// SoftEther VPN Source Code - Developer Edition Master Branch +// 16-bit Driver Install Utility for Windows 9x + + +// vpn16.h +// 16-bit Driver Install Utility for Windows 9x + +#ifndef VPN16_H +#define VPN16_H + +void Test(); +void Print(char *fmt, ...); +RETERR InstallNDIDevice(const char* szClass, + const char* szDeviceID, + const char* szDriverPath, + const char* szRegPath); +void InstallMain(char *name); +void GetDirFromPath(char *dst, char *src); +void NukuEn(char *dst, char *src); +BOOL IsFile(char *name); +BOOL IsSafeStr(char *str); +BOOL IsSafeChar(char c); + +#endif // VPN16_H + + diff --git a/src/vpnbridge/resource.h b/src/vpnbridge/resource.h index 53759f1f..b22c1eaf 100644 --- a/src/vpnbridge/resource.h +++ b/src/vpnbridge/resource.h @@ -1,17 +1,17 @@ -//{{NO_DEPENDENCIES}} -// Microsoft Visual C++ generated include file. -// Used by vpnbridge.rc -// -#define IDI_ICON1 101 -#define IDI_MAIN 101 - -// Next default values for new objects -// -#ifdef APSTUDIO_INVOKED -#ifndef APSTUDIO_READONLY_SYMBOLS -#define _APS_NEXT_RESOURCE_VALUE 102 -#define _APS_NEXT_COMMAND_VALUE 40001 -#define _APS_NEXT_CONTROL_VALUE 1001 -#define _APS_NEXT_SYMED_VALUE 101 -#endif -#endif +//{{NO_DEPENDENCIES}} +// Microsoft Visual C++ generated include file. +// Used by vpnbridge.rc +// +#define IDI_ICON1 101 +#define IDI_MAIN 101 + +// Next default values for new objects +// +#ifdef APSTUDIO_INVOKED +#ifndef APSTUDIO_READONLY_SYMBOLS +#define _APS_NEXT_RESOURCE_VALUE 102 +#define _APS_NEXT_COMMAND_VALUE 40001 +#define _APS_NEXT_CONTROL_VALUE 1001 +#define _APS_NEXT_SYMED_VALUE 101 +#endif +#endif diff --git a/src/vpnbridge/vpnbridge.c b/src/vpnbridge/vpnbridge.c index 135644d3..c7baf33c 100644 --- a/src/vpnbridge/vpnbridge.c +++ b/src/vpnbridge/vpnbridge.c @@ -1,63 +1,63 @@ -// SoftEther VPN Source Code - Developer Edition Master Branch -// Cedar Communication Module - - -// vpnbridge.c -// VPN Bridge Service Program - -#include - -#define VPN_EXE - -#ifdef WIN32 -#include -#include -#include -#include -#include -#include -#include -#include "../PenCore/resource.h" -#endif // WIN32 -#include -#include -#include -#include -#include -#include -#include -#include - -// Process start function -void StartProcess() -{ - // Start the server - InitCedar(); - StInit(); - StStartServer(true); -} - -// Process stop function -void StopProcess() -{ - // Stop the server - StStopServer(); - StFree(); - FreeCedar(); -} - -// WinMain function -int main(int argc, char *argv[]) -{ - InitProcessCallOnce(); - - VgUseStaticLink(); - -#ifdef OS_WIN32 - return MsService(GC_SVC_NAME_VPNBRIDGE, StartProcess, StopProcess, ICO_BRIDGE, argv[0]); -#else // OS_WIN32 - return UnixService(argc, argv, "vpnbridge", StartProcess, StopProcess); -#endif // OS_WIN32 -} - - +// SoftEther VPN Source Code - Developer Edition Master Branch +// Cedar Communication Module + + +// vpnbridge.c +// VPN Bridge Service Program + +#include + +#define VPN_EXE + +#ifdef WIN32 +#include +#include +#include +#include +#include +#include +#include +#include "../PenCore/resource.h" +#endif // WIN32 +#include +#include +#include +#include +#include +#include +#include +#include + +// Process start function +void StartProcess() +{ + // Start the server + InitCedar(); + StInit(); + StStartServer(true); +} + +// Process stop function +void StopProcess() +{ + // Stop the server + StStopServer(); + StFree(); + FreeCedar(); +} + +// WinMain function +int main(int argc, char *argv[]) +{ + InitProcessCallOnce(); + + VgUseStaticLink(); + +#ifdef OS_WIN32 + return MsService(GC_SVC_NAME_VPNBRIDGE, StartProcess, StopProcess, ICO_BRIDGE, argv[0]); +#else // OS_WIN32 + return UnixService(argc, argv, "vpnbridge", StartProcess, StopProcess); +#endif // OS_WIN32 +} + + diff --git a/src/vpnbridge/vpnbridge.rc b/src/vpnbridge/vpnbridge.rc index 0cdb5263..7d27f87a 100644 --- a/src/vpnbridge/vpnbridge.rc +++ b/src/vpnbridge/vpnbridge.rc @@ -1,72 +1,72 @@ -// Microsoft Visual C++ generated resource script. -// -#include "resource.h" - -#define APSTUDIO_READONLY_SYMBOLS -///////////////////////////////////////////////////////////////////////////// -// -// Generated from the TEXTINCLUDE 2 resource. -// -#include "winres.h" - -///////////////////////////////////////////////////////////////////////////// -#undef APSTUDIO_READONLY_SYMBOLS - -///////////////////////////////////////////////////////////////////////////// -// Japanese resources - -#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_JPN) -#ifdef _WIN32 -LANGUAGE LANG_JAPANESE, SUBLANG_DEFAULT -#pragma code_page(932) -#endif //_WIN32 - -#ifdef APSTUDIO_INVOKED -///////////////////////////////////////////////////////////////////////////// -// -// TEXTINCLUDE -// - -1 TEXTINCLUDE -BEGIN - "resource.h\0" -END - -2 TEXTINCLUDE -BEGIN - "#include ""winres.h""\r\n" - "\0" -END - -3 TEXTINCLUDE -BEGIN - "\r\n" - "\0" -END - -#endif // APSTUDIO_INVOKED - - -///////////////////////////////////////////////////////////////////////////// -// -// Icon -// - -// Icon with lowest ID value placed first to ensure application icon -// remains consistent on all systems. -IDI_MAIN ICON "vpnbridge.ico" -#endif // Japanese resources -///////////////////////////////////////////////////////////////////////////// - - - -#ifndef APSTUDIO_INVOKED -///////////////////////////////////////////////////////////////////////////// -// -// Generated from the TEXTINCLUDE 3 resource. -// - - -///////////////////////////////////////////////////////////////////////////// -#endif // not APSTUDIO_INVOKED - +// Microsoft Visual C++ generated resource script. +// +#include "resource.h" + +#define APSTUDIO_READONLY_SYMBOLS +///////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 2 resource. +// +#include "winres.h" + +///////////////////////////////////////////////////////////////////////////// +#undef APSTUDIO_READONLY_SYMBOLS + +///////////////////////////////////////////////////////////////////////////// +// Japanese resources + +#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_JPN) +#ifdef _WIN32 +LANGUAGE LANG_JAPANESE, SUBLANG_DEFAULT +#pragma code_page(932) +#endif //_WIN32 + +#ifdef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// TEXTINCLUDE +// + +1 TEXTINCLUDE +BEGIN + "resource.h\0" +END + +2 TEXTINCLUDE +BEGIN + "#include ""winres.h""\r\n" + "\0" +END + +3 TEXTINCLUDE +BEGIN + "\r\n" + "\0" +END + +#endif // APSTUDIO_INVOKED + + +///////////////////////////////////////////////////////////////////////////// +// +// Icon +// + +// Icon with lowest ID value placed first to ensure application icon +// remains consistent on all systems. +IDI_MAIN ICON "vpnbridge.ico" +#endif // Japanese resources +///////////////////////////////////////////////////////////////////////////// + + + +#ifndef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 3 resource. +// + + +///////////////////////////////////////////////////////////////////////////// +#endif // not APSTUDIO_INVOKED + diff --git a/src/vpnclient/resource.h b/src/vpnclient/resource.h index cfc07d3c..93fb4601 100644 --- a/src/vpnclient/resource.h +++ b/src/vpnclient/resource.h @@ -1,17 +1,17 @@ -//{{NO_DEPENDENCIES}} -// Microsoft Visual C++ generated include file. -// Used by vpnclient.rc -// -#define IDI_ICON1 101 -#define IDI_MAIN 101 - -// Next default values for new objects -// -#ifdef APSTUDIO_INVOKED -#ifndef APSTUDIO_READONLY_SYMBOLS -#define _APS_NEXT_RESOURCE_VALUE 102 -#define _APS_NEXT_COMMAND_VALUE 40001 -#define _APS_NEXT_CONTROL_VALUE 1001 -#define _APS_NEXT_SYMED_VALUE 101 -#endif -#endif +//{{NO_DEPENDENCIES}} +// Microsoft Visual C++ generated include file. +// Used by vpnclient.rc +// +#define IDI_ICON1 101 +#define IDI_MAIN 101 + +// Next default values for new objects +// +#ifdef APSTUDIO_INVOKED +#ifndef APSTUDIO_READONLY_SYMBOLS +#define _APS_NEXT_RESOURCE_VALUE 102 +#define _APS_NEXT_COMMAND_VALUE 40001 +#define _APS_NEXT_CONTROL_VALUE 1001 +#define _APS_NEXT_SYMED_VALUE 101 +#endif +#endif diff --git a/src/vpnclient/vpnclient.rc b/src/vpnclient/vpnclient.rc index 478fef16..43658719 100644 --- a/src/vpnclient/vpnclient.rc +++ b/src/vpnclient/vpnclient.rc @@ -1,72 +1,72 @@ -// Microsoft Visual C++ generated resource script. -// -#include "resource.h" - -#define APSTUDIO_READONLY_SYMBOLS -///////////////////////////////////////////////////////////////////////////// -// -// Generated from the TEXTINCLUDE 2 resource. -// -#include "winres.h" - -///////////////////////////////////////////////////////////////////////////// -#undef APSTUDIO_READONLY_SYMBOLS - -///////////////////////////////////////////////////////////////////////////// -// Japanese resources - -#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_JPN) -#ifdef _WIN32 -LANGUAGE LANG_JAPANESE, SUBLANG_DEFAULT -#pragma code_page(932) -#endif //_WIN32 - -#ifdef APSTUDIO_INVOKED -///////////////////////////////////////////////////////////////////////////// -// -// TEXTINCLUDE -// - -1 TEXTINCLUDE -BEGIN - "resource.h\0" -END - -2 TEXTINCLUDE -BEGIN - "#include ""winres.h""\r\n" - "\0" -END - -3 TEXTINCLUDE -BEGIN - "\r\n" - "\0" -END - -#endif // APSTUDIO_INVOKED - - -///////////////////////////////////////////////////////////////////////////// -// -// Icon -// - -// Icon with lowest ID value placed first to ensure application icon -// remains consistent on all systems. -IDI_MAIN ICON "Machine.ico" -#endif // Japanese resources -///////////////////////////////////////////////////////////////////////////// - - - -#ifndef APSTUDIO_INVOKED -///////////////////////////////////////////////////////////////////////////// -// -// Generated from the TEXTINCLUDE 3 resource. -// - - -///////////////////////////////////////////////////////////////////////////// -#endif // not APSTUDIO_INVOKED - +// Microsoft Visual C++ generated resource script. +// +#include "resource.h" + +#define APSTUDIO_READONLY_SYMBOLS +///////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 2 resource. +// +#include "winres.h" + +///////////////////////////////////////////////////////////////////////////// +#undef APSTUDIO_READONLY_SYMBOLS + +///////////////////////////////////////////////////////////////////////////// +// Japanese resources + +#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_JPN) +#ifdef _WIN32 +LANGUAGE LANG_JAPANESE, SUBLANG_DEFAULT +#pragma code_page(932) +#endif //_WIN32 + +#ifdef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// TEXTINCLUDE +// + +1 TEXTINCLUDE +BEGIN + "resource.h\0" +END + +2 TEXTINCLUDE +BEGIN + "#include ""winres.h""\r\n" + "\0" +END + +3 TEXTINCLUDE +BEGIN + "\r\n" + "\0" +END + +#endif // APSTUDIO_INVOKED + + +///////////////////////////////////////////////////////////////////////////// +// +// Icon +// + +// Icon with lowest ID value placed first to ensure application icon +// remains consistent on all systems. +IDI_MAIN ICON "Machine.ico" +#endif // Japanese resources +///////////////////////////////////////////////////////////////////////////// + + + +#ifndef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 3 resource. +// + + +///////////////////////////////////////////////////////////////////////////// +#endif // not APSTUDIO_INVOKED + diff --git a/src/vpnclient/vpncsvc.c b/src/vpnclient/vpncsvc.c index c08055cf..0ddb693c 100644 --- a/src/vpnclient/vpncsvc.c +++ b/src/vpnclient/vpncsvc.c @@ -1,50 +1,50 @@ -// SoftEther VPN Source Code - Developer Edition Master Branch -// Cedar Communication Module - - -// vpncsvc.c -// VPN Client Service Program - -#include - -#define VPN_EXE - -#include -#include -#include -#include -#include -#include -#include -#include - -// Process start function -void StartProcess() -{ - // Start the client - InitCedar(); - CtStartClient(); -} - -// Process termination function -void StopProcess() -{ - // Stop the client - CtStopClient(); - FreeCedar(); -} - -// WinMain function -int main(int argc, char *argv[]) -{ - InitProcessCallOnce(); - -#ifdef OS_WIN32 - - return MsService(GC_SVC_NAME_VPNCLIENT, StartProcess, StopProcess, ICO_MACHINE, argv[0]); -#else // OS_WIN32 - return UnixService(argc, argv, "vpnclient", StartProcess, StopProcess); -#endif // OS_WIN32 -} - - +// SoftEther VPN Source Code - Developer Edition Master Branch +// Cedar Communication Module + + +// vpncsvc.c +// VPN Client Service Program + +#include + +#define VPN_EXE + +#include +#include +#include +#include +#include +#include +#include +#include + +// Process start function +void StartProcess() +{ + // Start the client + InitCedar(); + CtStartClient(); +} + +// Process termination function +void StopProcess() +{ + // Stop the client + CtStopClient(); + FreeCedar(); +} + +// WinMain function +int main(int argc, char *argv[]) +{ + InitProcessCallOnce(); + +#ifdef OS_WIN32 + + return MsService(GC_SVC_NAME_VPNCLIENT, StartProcess, StopProcess, ICO_MACHINE, argv[0]); +#else // OS_WIN32 + return UnixService(argc, argv, "vpnclient", StartProcess, StopProcess); +#endif // OS_WIN32 +} + + diff --git a/src/vpnclient/vpncsvc.h b/src/vpnclient/vpncsvc.h index 675b77ee..758663bb 100644 --- a/src/vpnclient/vpncsvc.h +++ b/src/vpnclient/vpncsvc.h @@ -1,18 +1,18 @@ -// SoftEther VPN Source Code - Developer Edition Master Branch -// Cedar Communication Module - - -// vpncsvc.h -// Header of vpncsvc.c - -#ifndef VPNCSVC_H -#define VPNCSVC_H - -// Function prototype -int PASCAL WinMain(HINSTANCE hInst, HINSTANCE hPrev, char *CmdLine, int CmdShow); -void StartProcess(); -void StopProcess(); - - -#endif // VPNCSVC_H - +// SoftEther VPN Source Code - Developer Edition Master Branch +// Cedar Communication Module + + +// vpncsvc.h +// Header of vpncsvc.c + +#ifndef VPNCSVC_H +#define VPNCSVC_H + +// Function prototype +int PASCAL WinMain(HINSTANCE hInst, HINSTANCE hPrev, char *CmdLine, int CmdShow); +void StartProcess(); +void StopProcess(); + + +#endif // VPNCSVC_H + diff --git a/src/vpncmd/resource.h b/src/vpncmd/resource.h index d0e03622..63cbf16b 100644 --- a/src/vpncmd/resource.h +++ b/src/vpncmd/resource.h @@ -1,17 +1,17 @@ -//{{NO_DEPENDENCIES}} -// Microsoft Visual C++ generated include file. -// Used by vpncmd.rc -// -#define IDI_ICON1 101 -#define IDI_VPNCMD 101 - -// Next default values for new objects -// -#ifdef APSTUDIO_INVOKED -#ifndef APSTUDIO_READONLY_SYMBOLS -#define _APS_NEXT_RESOURCE_VALUE 102 -#define _APS_NEXT_COMMAND_VALUE 40001 -#define _APS_NEXT_CONTROL_VALUE 1001 -#define _APS_NEXT_SYMED_VALUE 101 -#endif -#endif +//{{NO_DEPENDENCIES}} +// Microsoft Visual C++ generated include file. +// Used by vpncmd.rc +// +#define IDI_ICON1 101 +#define IDI_VPNCMD 101 + +// Next default values for new objects +// +#ifdef APSTUDIO_INVOKED +#ifndef APSTUDIO_READONLY_SYMBOLS +#define _APS_NEXT_RESOURCE_VALUE 102 +#define _APS_NEXT_COMMAND_VALUE 40001 +#define _APS_NEXT_CONTROL_VALUE 1001 +#define _APS_NEXT_SYMED_VALUE 101 +#endif +#endif diff --git a/src/vpncmd/vpncmd.c b/src/vpncmd/vpncmd.c index 17fa3b1f..1c517062 100644 --- a/src/vpncmd/vpncmd.c +++ b/src/vpncmd/vpncmd.c @@ -1,108 +1,108 @@ -// SoftEther VPN Source Code - Developer Edition Master Branch -// Cedar Communication Module - - -// vpncmd.c -// VPN Command Line Management Utility - -#include - -#ifdef WIN32 -#include -#include -#include -#include -#include -#include -#include -#endif // WIN32 -#include -#include -#include -#include -#include -#include -#include -#include - -// main function -int main(int argc, char *argv[]) -{ - wchar_t *s; - UINT ret = 0; - - InitProcessCallOnce(); - -#ifdef OS_WIN32 - SetConsoleTitleA(CEDAR_PRODUCT_STR " VPN Command Line Utility"); +// SoftEther VPN Source Code - Developer Edition Master Branch +// Cedar Communication Module + + +// vpncmd.c +// VPN Command Line Management Utility + +#include + +#ifdef WIN32 +#include +#include +#include +#include +#include +#include +#include +#endif // WIN32 +#include +#include +#include +#include +#include +#include +#include +#include + +// main function +int main(int argc, char *argv[]) +{ + wchar_t *s; + UINT ret = 0; + + InitProcessCallOnce(); + +#ifdef OS_WIN32 + SetConsoleTitleA(CEDAR_PRODUCT_STR " VPN Command Line Utility"); #else // For *nix, disable output buffering to allow for interactive use setbuf(stdout,NULL); -#endif // OS_WIN32 - -#if defined(_DEBUG) || defined(DEBUG) // In VC++ compilers, the macro is "_DEBUG", not "DEBUG". - // If set memcheck = true, the program will be vitally slow since it will log all malloc() / realloc() / free() calls to find the cause of memory leak. - // For normal debug we set memcheck = false. - // Please set memcheck = true if you want to test the cause of memory leaks. - InitMayaqua(false, true, argc, argv); -#else - InitMayaqua(false, false, argc, argv); -#endif - InitCedar(); - - s = GetCommandLineUniStr(); - - if (s == NULL) - { - s = CopyUniStr(L""); - } - - if (UniStrCmpi(s, L"exit") != 0) - { - UINT size = UniStrSize(s) + 64; - wchar_t *tmp; - - tmp = Malloc(size); - UniFormat(tmp, size, L"vpncmd %s", s); - ret = CommandMain(tmp); - - Free(tmp); - } - -#ifdef OS_WIN32 - { - UINT i; - LIST *o = MsGetProcessList(); - bool b = false; - - for (i = 0;i < LIST_NUM(o);i++) - { - MS_PROCESS *p = LIST_DATA(o, i); - - if (EndWith(p->ExeFilename, "\\cmd.exe") || EndWith(p->ExeFilename, "\\command.com")) - { - b = true; - break; - } - } - - MsFreeProcessList(o); - - if (b == false) - { - if (ret != ERR_NO_ERROR) - { - SleepThread(1000); - } - } - } -#endif // OS_WIN32 - - Free(s); - - FreeCedar(); - FreeMayaqua(); - return ret; -} - - +#endif // OS_WIN32 + +#if defined(_DEBUG) || defined(DEBUG) // In VC++ compilers, the macro is "_DEBUG", not "DEBUG". + // If set memcheck = true, the program will be vitally slow since it will log all malloc() / realloc() / free() calls to find the cause of memory leak. + // For normal debug we set memcheck = false. + // Please set memcheck = true if you want to test the cause of memory leaks. + InitMayaqua(false, true, argc, argv); +#else + InitMayaqua(false, false, argc, argv); +#endif + InitCedar(); + + s = GetCommandLineUniStr(); + + if (s == NULL) + { + s = CopyUniStr(L""); + } + + if (UniStrCmpi(s, L"exit") != 0) + { + UINT size = UniStrSize(s) + 64; + wchar_t *tmp; + + tmp = Malloc(size); + UniFormat(tmp, size, L"vpncmd %s", s); + ret = CommandMain(tmp); + + Free(tmp); + } + +#ifdef OS_WIN32 + { + UINT i; + LIST *o = MsGetProcessList(); + bool b = false; + + for (i = 0;i < LIST_NUM(o);i++) + { + MS_PROCESS *p = LIST_DATA(o, i); + + if (EndWith(p->ExeFilename, "\\cmd.exe") || EndWith(p->ExeFilename, "\\command.com")) + { + b = true; + break; + } + } + + MsFreeProcessList(o); + + if (b == false) + { + if (ret != ERR_NO_ERROR) + { + SleepThread(1000); + } + } + } +#endif // OS_WIN32 + + Free(s); + + FreeCedar(); + FreeMayaqua(); + return ret; +} + + diff --git a/src/vpncmd/vpncmd.rc b/src/vpncmd/vpncmd.rc index 0873228a..8f942b0c 100644 --- a/src/vpncmd/vpncmd.rc +++ b/src/vpncmd/vpncmd.rc @@ -1,72 +1,72 @@ -// Microsoft Visual C++ generated resource script. -// -#include "resource.h" - -#define APSTUDIO_READONLY_SYMBOLS -///////////////////////////////////////////////////////////////////////////// -// -// Generated from the TEXTINCLUDE 2 resource. -// -#include "winres.h" - -///////////////////////////////////////////////////////////////////////////// -#undef APSTUDIO_READONLY_SYMBOLS - -///////////////////////////////////////////////////////////////////////////// -// Japanese resources - -#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_JPN) -#ifdef _WIN32 -LANGUAGE LANG_JAPANESE, SUBLANG_DEFAULT -#pragma code_page(932) -#endif //_WIN32 - -#ifdef APSTUDIO_INVOKED -///////////////////////////////////////////////////////////////////////////// -// -// TEXTINCLUDE -// - -1 TEXTINCLUDE -BEGIN - "resource.h\0" -END - -2 TEXTINCLUDE -BEGIN - "#include ""winres.h""\r\n" - "\0" -END - -3 TEXTINCLUDE -BEGIN - "\r\n" - "\0" -END - -#endif // APSTUDIO_INVOKED - - -///////////////////////////////////////////////////////////////////////////// -// -// Icon -// - -// Icon with lowest ID value placed first to ensure application icon -// remains consistent on all systems. -IDI_VPNCMD ICON "vpncmd.ico" -#endif // Japanese resources -///////////////////////////////////////////////////////////////////////////// - - - -#ifndef APSTUDIO_INVOKED -///////////////////////////////////////////////////////////////////////////// -// -// Generated from the TEXTINCLUDE 3 resource. -// - - -///////////////////////////////////////////////////////////////////////////// -#endif // not APSTUDIO_INVOKED - +// Microsoft Visual C++ generated resource script. +// +#include "resource.h" + +#define APSTUDIO_READONLY_SYMBOLS +///////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 2 resource. +// +#include "winres.h" + +///////////////////////////////////////////////////////////////////////////// +#undef APSTUDIO_READONLY_SYMBOLS + +///////////////////////////////////////////////////////////////////////////// +// Japanese resources + +#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_JPN) +#ifdef _WIN32 +LANGUAGE LANG_JAPANESE, SUBLANG_DEFAULT +#pragma code_page(932) +#endif //_WIN32 + +#ifdef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// TEXTINCLUDE +// + +1 TEXTINCLUDE +BEGIN + "resource.h\0" +END + +2 TEXTINCLUDE +BEGIN + "#include ""winres.h""\r\n" + "\0" +END + +3 TEXTINCLUDE +BEGIN + "\r\n" + "\0" +END + +#endif // APSTUDIO_INVOKED + + +///////////////////////////////////////////////////////////////////////////// +// +// Icon +// + +// Icon with lowest ID value placed first to ensure application icon +// remains consistent on all systems. +IDI_VPNCMD ICON "vpncmd.ico" +#endif // Japanese resources +///////////////////////////////////////////////////////////////////////////// + + + +#ifndef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 3 resource. +// + + +///////////////////////////////////////////////////////////////////////////// +#endif // not APSTUDIO_INVOKED + diff --git a/src/vpncmdsys/resource.h b/src/vpncmdsys/resource.h index a5e09bba..ef16f367 100644 --- a/src/vpncmdsys/resource.h +++ b/src/vpncmdsys/resource.h @@ -1,16 +1,16 @@ -//{{NO_DEPENDENCIES}} -// Microsoft Visual C++ generated include file. -// Used by vpncmdsys.rc -// -#define IDI_ICON1 101 - -// Next default values for new objects -// -#ifdef APSTUDIO_INVOKED -#ifndef APSTUDIO_READONLY_SYMBOLS -#define _APS_NEXT_RESOURCE_VALUE 102 -#define _APS_NEXT_COMMAND_VALUE 40001 -#define _APS_NEXT_CONTROL_VALUE 1001 -#define _APS_NEXT_SYMED_VALUE 101 -#endif -#endif +//{{NO_DEPENDENCIES}} +// Microsoft Visual C++ generated include file. +// Used by vpncmdsys.rc +// +#define IDI_ICON1 101 + +// Next default values for new objects +// +#ifdef APSTUDIO_INVOKED +#ifndef APSTUDIO_READONLY_SYMBOLS +#define _APS_NEXT_RESOURCE_VALUE 102 +#define _APS_NEXT_COMMAND_VALUE 40001 +#define _APS_NEXT_CONTROL_VALUE 1001 +#define _APS_NEXT_SYMED_VALUE 101 +#endif +#endif diff --git a/src/vpncmdsys/vpncmdsys.c b/src/vpncmdsys/vpncmdsys.c index 59630c24..3c11765d 100644 --- a/src/vpncmdsys/vpncmdsys.c +++ b/src/vpncmdsys/vpncmdsys.c @@ -1,194 +1,194 @@ -// SoftEther VPN Source Code - Developer Edition Master Branch -// Cedar Communication Module - - -// vpncmdsys.c -// vpncmd bootstrup - -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "vpncmdsys.h" - -static UINT ret_code = 0; - -// Get whether the system is a Windows NT -bool IsWindowsNt() -{ - OSVERSIONINFO info; - - ZeroMemory(&info, sizeof(info)); - info.dwOSVersionInfoSize = sizeof(info); - - if (GetVersionEx(&info) == false) - { - return false; - } - - if (info.dwPlatformId == VER_PLATFORM_WIN32_NT) - { - return true; - } - - return false; -} - -// Execute a child process -bool ExecProcess(char *exe_name, wchar_t *args_w) -{ - bool ret; - wchar_t exe_name_w[MAX_SIZE]; - char args[MAX_SIZE]; - STARTUPINFO info; - STARTUPINFOW info_w; - PROCESS_INFORMATION proc; - // Validate arguments - if (exe_name == NULL || args_w == NULL) - { - return false; - } - - ZeroMemory(exe_name_w, sizeof(exe_name_w)); - ZeroMemory(args, sizeof(args)); - mbstowcs(exe_name_w, exe_name, strlen(exe_name)); - wcstombs(args, args_w, sizeof(args)); - - ZeroMemory(&info, sizeof(info)); - info.cb = sizeof(info); - - ZeroMemory(&info_w, sizeof(info_w)); - info_w.cb = sizeof(info_w); - - ZeroMemory(&proc, sizeof(proc)); - - if (IsWindowsNt() == false) - { - ret = CreateProcess(exe_name, args, NULL, NULL, false, NORMAL_PRIORITY_CLASS, - NULL, NULL, &info, &proc); - } - else - { - ret = CreateProcessW(exe_name_w, args_w, NULL, NULL, false, NORMAL_PRIORITY_CLASS, - NULL, NULL, &info_w, &proc); - } - - if (ret) - { - WaitForSingleObject(proc.hProcess, INFINITE); - - GetExitCodeProcess(proc.hProcess, &ret_code); - } - - return ret; -} - -// Entry point -int main(int argc, char *argv[]) -{ - HKEY hKey; - bool ok = false; - char error[MAX_SIZE]; - wchar_t *current_args; - bool flag = false; - bool break_now = false; - - error[0] = 0; - - setlocale(LC_ALL, ""); - - current_args = GetCommandLineW(); - - // Remove the program name portion from the command line string - while (true) - { - switch (*current_args) - { - case L'\"': - if (flag == false) - { - flag = true; - } - else - { - flag = false; - } - break; - - case L' ': - case L'\t': - case 0: - if (flag == false) - { - break_now = true; - } - break; - } - if (break_now) - { - break; - } - current_args++; - } - - while (true) - { - if (*current_args == L' ' || *current_args == L'\t') - { - current_args++; - } - else - { - break; - } - } - - strcpy(error, "VPN Command Line Tools is not Installed.\nPlease reinstall programs."); - - // Get the path of the vpncmd.exe from the registry - if (RegOpenKey(HKEY_LOCAL_MACHINE, VPNCMD_BOOTSTRAP_REG_KEYNAME, &hKey) == 0) - { - DWORD type = REG_SZ; - DWORD size = 4096; - char buf[4096]; - - if (RegQueryValueEx(hKey, VPNCMD_BOOTSTRAP_REG_VALUENAME_PATH, NULL, &type, (LPBYTE)buf, &size) == 0) - { - wchar_t args[MAX_SIZE]; - - swprintf(args, sizeof(args), L"\"%S\" %s", buf, current_args); - if (ExecProcess(buf, args) == false) - { - //sprintf(error, "Failed to execute \"%S\".", buf); - } - else - { - ok = true; - } - } - - RegCloseKey(hKey); - } - - if (ok == false) - { - printf("%s\n", error); - } - - return ret_code; -} - +// SoftEther VPN Source Code - Developer Edition Master Branch +// Cedar Communication Module + + +// vpncmdsys.c +// vpncmd bootstrup + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "vpncmdsys.h" + +static UINT ret_code = 0; + +// Get whether the system is a Windows NT +bool IsWindowsNt() +{ + OSVERSIONINFO info; + + ZeroMemory(&info, sizeof(info)); + info.dwOSVersionInfoSize = sizeof(info); + + if (GetVersionEx(&info) == false) + { + return false; + } + + if (info.dwPlatformId == VER_PLATFORM_WIN32_NT) + { + return true; + } + + return false; +} + +// Execute a child process +bool ExecProcess(char *exe_name, wchar_t *args_w) +{ + bool ret; + wchar_t exe_name_w[MAX_SIZE]; + char args[MAX_SIZE]; + STARTUPINFO info; + STARTUPINFOW info_w; + PROCESS_INFORMATION proc; + // Validate arguments + if (exe_name == NULL || args_w == NULL) + { + return false; + } + + ZeroMemory(exe_name_w, sizeof(exe_name_w)); + ZeroMemory(args, sizeof(args)); + mbstowcs(exe_name_w, exe_name, strlen(exe_name)); + wcstombs(args, args_w, sizeof(args)); + + ZeroMemory(&info, sizeof(info)); + info.cb = sizeof(info); + + ZeroMemory(&info_w, sizeof(info_w)); + info_w.cb = sizeof(info_w); + + ZeroMemory(&proc, sizeof(proc)); + + if (IsWindowsNt() == false) + { + ret = CreateProcess(exe_name, args, NULL, NULL, false, NORMAL_PRIORITY_CLASS, + NULL, NULL, &info, &proc); + } + else + { + ret = CreateProcessW(exe_name_w, args_w, NULL, NULL, false, NORMAL_PRIORITY_CLASS, + NULL, NULL, &info_w, &proc); + } + + if (ret) + { + WaitForSingleObject(proc.hProcess, INFINITE); + + GetExitCodeProcess(proc.hProcess, &ret_code); + } + + return ret; +} + +// Entry point +int main(int argc, char *argv[]) +{ + HKEY hKey; + bool ok = false; + char error[MAX_SIZE]; + wchar_t *current_args; + bool flag = false; + bool break_now = false; + + error[0] = 0; + + setlocale(LC_ALL, ""); + + current_args = GetCommandLineW(); + + // Remove the program name portion from the command line string + while (true) + { + switch (*current_args) + { + case L'\"': + if (flag == false) + { + flag = true; + } + else + { + flag = false; + } + break; + + case L' ': + case L'\t': + case 0: + if (flag == false) + { + break_now = true; + } + break; + } + if (break_now) + { + break; + } + current_args++; + } + + while (true) + { + if (*current_args == L' ' || *current_args == L'\t') + { + current_args++; + } + else + { + break; + } + } + + strcpy(error, "VPN Command Line Tools is not Installed.\nPlease reinstall programs."); + + // Get the path of the vpncmd.exe from the registry + if (RegOpenKey(HKEY_LOCAL_MACHINE, VPNCMD_BOOTSTRAP_REG_KEYNAME, &hKey) == 0) + { + DWORD type = REG_SZ; + DWORD size = 4096; + char buf[4096]; + + if (RegQueryValueEx(hKey, VPNCMD_BOOTSTRAP_REG_VALUENAME_PATH, NULL, &type, (LPBYTE)buf, &size) == 0) + { + wchar_t args[MAX_SIZE]; + + swprintf(args, sizeof(args), L"\"%S\" %s", buf, current_args); + if (ExecProcess(buf, args) == false) + { + //sprintf(error, "Failed to execute \"%S\".", buf); + } + else + { + ok = true; + } + } + + RegCloseKey(hKey); + } + + if (ok == false) + { + printf("%s\n", error); + } + + return ret_code; +} + diff --git a/src/vpncmdsys/vpncmdsys.h b/src/vpncmdsys/vpncmdsys.h index 1e162322..ddd1e507 100644 --- a/src/vpncmdsys/vpncmdsys.h +++ b/src/vpncmdsys/vpncmdsys.h @@ -1,16 +1,16 @@ -// SoftEther VPN Source Code - Developer Edition Master Branch -// Cedar Communication Module - - -// vpncmdsys.h -// Header of VPN vpncmdsys.c - -// Function prototypes -int main(int argc, char *argv[]); -bool ExecProcess(char *exe_name, wchar_t *args_w); -bool IsWindowsNt(); - - - - - +// SoftEther VPN Source Code - Developer Edition Master Branch +// Cedar Communication Module + + +// vpncmdsys.h +// Header of VPN vpncmdsys.c + +// Function prototypes +int main(int argc, char *argv[]); +bool ExecProcess(char *exe_name, wchar_t *args_w); +bool IsWindowsNt(); + + + + + diff --git a/src/vpncmdsys/vpncmdsys.rc b/src/vpncmdsys/vpncmdsys.rc index d66ea179..dc825b6a 100644 --- a/src/vpncmdsys/vpncmdsys.rc +++ b/src/vpncmdsys/vpncmdsys.rc @@ -1,72 +1,72 @@ -// Microsoft Visual C++ generated resource script. -// -#include "resource.h" - -#define APSTUDIO_READONLY_SYMBOLS -///////////////////////////////////////////////////////////////////////////// -// -// Generated from the TEXTINCLUDE 2 resource. -// -#include "winres.h" - -///////////////////////////////////////////////////////////////////////////// -#undef APSTUDIO_READONLY_SYMBOLS - -///////////////////////////////////////////////////////////////////////////// -// Japanese resources - -#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_JPN) -#ifdef _WIN32 -LANGUAGE LANG_JAPANESE, SUBLANG_DEFAULT -#pragma code_page(932) -#endif //_WIN32 - -#ifdef APSTUDIO_INVOKED -///////////////////////////////////////////////////////////////////////////// -// -// TEXTINCLUDE -// - -1 TEXTINCLUDE -BEGIN - "resource.h\0" -END - -2 TEXTINCLUDE -BEGIN - "#include ""winres.h""\r\n" - "\0" -END - -3 TEXTINCLUDE -BEGIN - "\r\n" - "\0" -END - -#endif // APSTUDIO_INVOKED - - -///////////////////////////////////////////////////////////////////////////// -// -// Icon -// - -// Icon with lowest ID value placed first to ensure application icon -// remains consistent on all systems. -IDI_ICON1 ICON "vpncmdsys.ico" -#endif // Japanese resources -///////////////////////////////////////////////////////////////////////////// - - - -#ifndef APSTUDIO_INVOKED -///////////////////////////////////////////////////////////////////////////// -// -// Generated from the TEXTINCLUDE 3 resource. -// - - -///////////////////////////////////////////////////////////////////////////// -#endif // not APSTUDIO_INVOKED - +// Microsoft Visual C++ generated resource script. +// +#include "resource.h" + +#define APSTUDIO_READONLY_SYMBOLS +///////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 2 resource. +// +#include "winres.h" + +///////////////////////////////////////////////////////////////////////////// +#undef APSTUDIO_READONLY_SYMBOLS + +///////////////////////////////////////////////////////////////////////////// +// Japanese resources + +#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_JPN) +#ifdef _WIN32 +LANGUAGE LANG_JAPANESE, SUBLANG_DEFAULT +#pragma code_page(932) +#endif //_WIN32 + +#ifdef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// TEXTINCLUDE +// + +1 TEXTINCLUDE +BEGIN + "resource.h\0" +END + +2 TEXTINCLUDE +BEGIN + "#include ""winres.h""\r\n" + "\0" +END + +3 TEXTINCLUDE +BEGIN + "\r\n" + "\0" +END + +#endif // APSTUDIO_INVOKED + + +///////////////////////////////////////////////////////////////////////////// +// +// Icon +// + +// Icon with lowest ID value placed first to ensure application icon +// remains consistent on all systems. +IDI_ICON1 ICON "vpncmdsys.ico" +#endif // Japanese resources +///////////////////////////////////////////////////////////////////////////// + + + +#ifndef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 3 resource. +// + + +///////////////////////////////////////////////////////////////////////////// +#endif // not APSTUDIO_INVOKED + diff --git a/src/vpncmdsys/vpncmdsys.vcproj b/src/vpncmdsys/vpncmdsys.vcproj index a0b18cf2..c9f3c2bc 100644 --- a/src/vpncmdsys/vpncmdsys.vcproj +++ b/src/vpncmdsys/vpncmdsys.vcproj @@ -1,258 +1,258 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/vpncmgr/resource.h b/src/vpncmgr/resource.h index 198603e5..7b06d878 100644 --- a/src/vpncmgr/resource.h +++ b/src/vpncmgr/resource.h @@ -1,21 +1,21 @@ -//{{NO_DEPENDENCIES}} -// Microsoft Visual C++ generated include file. -// Used by vpncmgr.rc -// -#define IDI_ICON1 101 -#define IDI_VPN 101 -#define IDI_ICON2 102 -#define IDI_SERVER 102 -#define IDI_ICON3 103 -#define IDI_SERVER_OFF 103 - -// Next default values for new objects -// -#ifdef APSTUDIO_INVOKED -#ifndef APSTUDIO_READONLY_SYMBOLS -#define _APS_NEXT_RESOURCE_VALUE 104 -#define _APS_NEXT_COMMAND_VALUE 40001 -#define _APS_NEXT_CONTROL_VALUE 1001 -#define _APS_NEXT_SYMED_VALUE 101 -#endif -#endif +//{{NO_DEPENDENCIES}} +// Microsoft Visual C++ generated include file. +// Used by vpncmgr.rc +// +#define IDI_ICON1 101 +#define IDI_VPN 101 +#define IDI_ICON2 102 +#define IDI_SERVER 102 +#define IDI_ICON3 103 +#define IDI_SERVER_OFF 103 + +// Next default values for new objects +// +#ifdef APSTUDIO_INVOKED +#ifndef APSTUDIO_READONLY_SYMBOLS +#define _APS_NEXT_RESOURCE_VALUE 104 +#define _APS_NEXT_COMMAND_VALUE 40001 +#define _APS_NEXT_CONTROL_VALUE 1001 +#define _APS_NEXT_SYMED_VALUE 101 +#endif +#endif diff --git a/src/vpncmgr/vpncmgr.c b/src/vpncmgr/vpncmgr.c index 4f8b24f8..eecd773f 100644 --- a/src/vpncmgr/vpncmgr.c +++ b/src/vpncmgr/vpncmgr.c @@ -1,55 +1,55 @@ -// SoftEther VPN Source Code - Developer Edition Master Branch -// Cedar Communication Module - - -// vpncmgr.c -// VPN Client connection manager program - -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - - - -// WinMain function -int PASCAL WinMain(HINSTANCE hInst, HINSTANCE hPrev, char *CmdLine, int CmdShow) -{ - InitProcessCallOnce(); - -#if defined(_DEBUG) || defined(DEBUG) // In VC++ compilers, the macro is "_DEBUG", not "DEBUG". - // If set memcheck = true, the program will be vitally slow since it will log all malloc() / realloc() / free() calls to find the cause of memory leak. - // For normal debug we set memcheck = false. - // Please set memcheck = true if you want to test the cause of memory leaks. - InitMayaqua(false, true, 0, NULL); -#else - InitMayaqua(false, false, 0, NULL); -#endif - InitCedar(); - - - //Set Application ID - //if(JL_SetCurrentProcessExplicitAppUserModelID(APPID_CM) != S_OK) - { - } - - CMExec(); - FreeCedar(); - FreeMayaqua(); - return 0; -} - - +// SoftEther VPN Source Code - Developer Edition Master Branch +// Cedar Communication Module + + +// vpncmgr.c +// VPN Client connection manager program + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + + + +// WinMain function +int PASCAL WinMain(HINSTANCE hInst, HINSTANCE hPrev, char *CmdLine, int CmdShow) +{ + InitProcessCallOnce(); + +#if defined(_DEBUG) || defined(DEBUG) // In VC++ compilers, the macro is "_DEBUG", not "DEBUG". + // If set memcheck = true, the program will be vitally slow since it will log all malloc() / realloc() / free() calls to find the cause of memory leak. + // For normal debug we set memcheck = false. + // Please set memcheck = true if you want to test the cause of memory leaks. + InitMayaqua(false, true, 0, NULL); +#else + InitMayaqua(false, false, 0, NULL); +#endif + InitCedar(); + + + //Set Application ID + //if(JL_SetCurrentProcessExplicitAppUserModelID(APPID_CM) != S_OK) + { + } + + CMExec(); + FreeCedar(); + FreeMayaqua(); + return 0; +} + + diff --git a/src/vpncmgr/vpncmgr.rc b/src/vpncmgr/vpncmgr.rc index e142d8d5..108c74fd 100644 --- a/src/vpncmgr/vpncmgr.rc +++ b/src/vpncmgr/vpncmgr.rc @@ -1,74 +1,74 @@ -// Microsoft Visual C++ generated resource script. -// -#include "resource.h" - -#define APSTUDIO_READONLY_SYMBOLS -///////////////////////////////////////////////////////////////////////////// -// -// Generated from the TEXTINCLUDE 2 resource. -// -#include "winres.h" - -///////////////////////////////////////////////////////////////////////////// -#undef APSTUDIO_READONLY_SYMBOLS - -///////////////////////////////////////////////////////////////////////////// -// Japanese resources - -#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_JPN) -#ifdef _WIN32 -LANGUAGE LANG_JAPANESE, SUBLANG_DEFAULT -#pragma code_page(932) -#endif //_WIN32 - -#ifdef APSTUDIO_INVOKED -///////////////////////////////////////////////////////////////////////////// -// -// TEXTINCLUDE -// - -1 TEXTINCLUDE -BEGIN - "resource.h\0" -END - -2 TEXTINCLUDE -BEGIN - "#include ""winres.h""\r\n" - "\0" -END - -3 TEXTINCLUDE -BEGIN - "\r\n" - "\0" -END - -#endif // APSTUDIO_INVOKED - - -///////////////////////////////////////////////////////////////////////////// -// -// Icon -// - -// Icon with lowest ID value placed first to ensure application icon -// remains consistent on all systems. -IDI_VPN ICON "VPN.ico" -IDI_SERVER ICON "Server.ico" -IDI_SERVER_OFF ICON "Server_Offline.ico" -#endif // Japanese resources -///////////////////////////////////////////////////////////////////////////// - - - -#ifndef APSTUDIO_INVOKED -///////////////////////////////////////////////////////////////////////////// -// -// Generated from the TEXTINCLUDE 3 resource. -// - - -///////////////////////////////////////////////////////////////////////////// -#endif // not APSTUDIO_INVOKED - +// Microsoft Visual C++ generated resource script. +// +#include "resource.h" + +#define APSTUDIO_READONLY_SYMBOLS +///////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 2 resource. +// +#include "winres.h" + +///////////////////////////////////////////////////////////////////////////// +#undef APSTUDIO_READONLY_SYMBOLS + +///////////////////////////////////////////////////////////////////////////// +// Japanese resources + +#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_JPN) +#ifdef _WIN32 +LANGUAGE LANG_JAPANESE, SUBLANG_DEFAULT +#pragma code_page(932) +#endif //_WIN32 + +#ifdef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// TEXTINCLUDE +// + +1 TEXTINCLUDE +BEGIN + "resource.h\0" +END + +2 TEXTINCLUDE +BEGIN + "#include ""winres.h""\r\n" + "\0" +END + +3 TEXTINCLUDE +BEGIN + "\r\n" + "\0" +END + +#endif // APSTUDIO_INVOKED + + +///////////////////////////////////////////////////////////////////////////// +// +// Icon +// + +// Icon with lowest ID value placed first to ensure application icon +// remains consistent on all systems. +IDI_VPN ICON "VPN.ico" +IDI_SERVER ICON "Server.ico" +IDI_SERVER_OFF ICON "Server_Offline.ico" +#endif // Japanese resources +///////////////////////////////////////////////////////////////////////////// + + + +#ifndef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 3 resource. +// + + +///////////////////////////////////////////////////////////////////////////// +#endif // not APSTUDIO_INVOKED + diff --git a/src/vpndrvinst/resource.h b/src/vpndrvinst/resource.h index e0df5b0d..7227f239 100644 --- a/src/vpndrvinst/resource.h +++ b/src/vpndrvinst/resource.h @@ -1,19 +1,19 @@ -//{{NO_DEPENDENCIES}} -// Microsoft Visual C++ generated include file. -// Used by vpndrvinst.rc -// -#define IDR_TEST1 101 -#define IDI_ICON1 102 -#define IDI_CERT 102 -#define IDI_ICON2 103 - -// Next default values for new objects -// -#ifdef APSTUDIO_INVOKED -#ifndef APSTUDIO_READONLY_SYMBOLS -#define _APS_NEXT_RESOURCE_VALUE 104 -#define _APS_NEXT_COMMAND_VALUE 40001 -#define _APS_NEXT_CONTROL_VALUE 1001 -#define _APS_NEXT_SYMED_VALUE 101 -#endif -#endif +//{{NO_DEPENDENCIES}} +// Microsoft Visual C++ generated include file. +// Used by vpndrvinst.rc +// +#define IDR_TEST1 101 +#define IDI_ICON1 102 +#define IDI_CERT 102 +#define IDI_ICON2 103 + +// Next default values for new objects +// +#ifdef APSTUDIO_INVOKED +#ifndef APSTUDIO_READONLY_SYMBOLS +#define _APS_NEXT_RESOURCE_VALUE 104 +#define _APS_NEXT_COMMAND_VALUE 40001 +#define _APS_NEXT_CONTROL_VALUE 1001 +#define _APS_NEXT_SYMED_VALUE 101 +#endif +#endif diff --git a/src/vpndrvinst/vpndrvinst.c b/src/vpndrvinst/vpndrvinst.c index 5baf1d7a..df5a94f8 100644 --- a/src/vpndrvinst/vpndrvinst.c +++ b/src/vpndrvinst/vpndrvinst.c @@ -1,253 +1,253 @@ -// SoftEther VPN Source Code - Developer Edition Master Branch -// VPN Driver Installer - - -#include - -#ifdef WIN32 -#define HAM_WIN32 -#define _WIN32_WINNT 0x0502 -#define WINVER 0x0502 -#include -#include -#include -#include -#include -#include -#include "../pencore/resource.h" -#endif - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "vpndrvinst.h" - -void disablevlan(UINT num, char **arg) -{ - bool ok; - if (num < 1) - { - return; - } - - ok = MsDisableVLan(arg[0]); - - if (ok == false) - { - _exit(1); - } - else - { - _exit(0); - } -} - -void enablevlan(UINT num, char **arg) -{ - bool ok; - if (num < 1) - { - return; - } - - ok = MsEnableVLan(arg[0]); - - if (ok == false) - { - _exit(1); - } - else - { - _exit(0); - } -} - -void instvlan(UINT num, char **arg) -{ - KAKUSHI *k = NULL; - MS_DRIVER_VER ver; - bool ok; - if (num < 1) - { - return; - } - - InitWinUi(L"VPN", _SS("DEFAULT_FONT"), _II("DEFAULT_FONT_SIZE")); - - if (MsIsNt()) - { - k = InitKakushi(); - } - - CiInitDriverVerStruct(&ver); - - ok = MsInstallVLan(VLAN_ADAPTER_NAME_TAG, VLAN_CONNECTION_NAME, arg[0], &ver); - - FreeKakushi(k); - - FreeWinUi(); - - if (ok == false) - { - _exit(1); - } - else - { - _exit(0); - } -} - -void upgradevlan(UINT num, char **arg) -{ - bool ok; - KAKUSHI *k = NULL; - MS_DRIVER_VER ver; - if (num < 1) - { - return; - } - - InitWinUi(L"VPN", _SS("DEFAULT_FONT"), _II("DEFAULT_FONT_SIZE")); - - if (MsIsNt()) - { - k = InitKakushi(); - } - - CiInitDriverVerStruct(&ver); - - ok = MsUpgradeVLan(VLAN_ADAPTER_NAME_TAG, VLAN_CONNECTION_NAME, arg[0], &ver); - - FreeKakushi(k); - - FreeWinUi(); - - if (ok == false) - { - _exit(1); - } - else - { - _exit(0); - } -} - -void uninstvlan(UINT num, char **arg) -{ - bool ok; - if (num < 1) - { - return; - } - - ok = MsUninstallVLan(arg[0]); - - if (ok == false) - { - _exit(1); - } - else - { - _exit(0); - } -} - -TEST_LIST test_list[] = -{ - {"instvlan", instvlan}, - {"uninstvlan", uninstvlan}, - {"upgradevlan", upgradevlan}, - {"enablevlan", enablevlan}, - {"disablevlan", disablevlan}, -}; - -// Main function -void MainFunction(char *cmd) -{ - char tmp[MAX_SIZE]; - bool first = true; - bool exit_now = false; - - while (true) - { - if (first && StrLen(cmd) != 0 && g_memcheck == false) - { - first = false; - StrCpy(tmp, sizeof(tmp), cmd); - exit_now = true; - Print("%s\n", cmd); - } - else - { - _exit(0); - } - Trim(tmp); - if (StrLen(tmp) != 0) - { - UINT i, num; - bool b = false; - TOKEN_LIST *token = ParseCmdLine(tmp); - char *cmd = token->Token[0]; - - num = sizeof(test_list) / sizeof(TEST_LIST); - for (i = 0;i < num;i++) - { - if (!StrCmpi(test_list[i].command_str, cmd)) - { - char **arg = Malloc(sizeof(char *) * (token->NumTokens - 1)); - UINT j; - for (j = 0;j < token->NumTokens - 1;j++) - { - arg[j] = CopyStr(token->Token[j + 1]); - } - test_list[i].proc(token->NumTokens - 1, arg); - for (j = 0;j < token->NumTokens - 1;j++) - { - Free(arg[j]); - } - Free(arg); - b = true; - _exit(1); - break; - } - } - FreeToken(token); - - if (exit_now) - { - break; - } - } - } -} - -// winmain function -int PASCAL WinMain(HINSTANCE hInst, HINSTANCE hPrev, char *CmdLine, int CmdShow) -{ - InitProcessCallOnce(); - -#if defined(_DEBUG) || defined(DEBUG) // In VC++ compilers, the macro is "_DEBUG", not "DEBUG". - // If set memcheck = true, the program will be vitally slow since it will log all malloc() / realloc() / free() calls to find the cause of memory leak. - // For normal debug we set memcheck = false. - // Please set memcheck = true if you want to test the cause of memory leaks. - InitMayaqua(false, true, 0, NULL); -#else - InitMayaqua(false, false, 0, NULL); -#endif - EnableProbe(false); - InitCedar(); - SetHamMode(); - MainFunction(cmdline); - FreeCedar(); - FreeMayaqua(); - - return 0; -} - +// SoftEther VPN Source Code - Developer Edition Master Branch +// VPN Driver Installer + + +#include + +#ifdef WIN32 +#define HAM_WIN32 +#define _WIN32_WINNT 0x0502 +#define WINVER 0x0502 +#include +#include +#include +#include +#include +#include +#include "../pencore/resource.h" +#endif + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "vpndrvinst.h" + +void disablevlan(UINT num, char **arg) +{ + bool ok; + if (num < 1) + { + return; + } + + ok = MsDisableVLan(arg[0]); + + if (ok == false) + { + _exit(1); + } + else + { + _exit(0); + } +} + +void enablevlan(UINT num, char **arg) +{ + bool ok; + if (num < 1) + { + return; + } + + ok = MsEnableVLan(arg[0]); + + if (ok == false) + { + _exit(1); + } + else + { + _exit(0); + } +} + +void instvlan(UINT num, char **arg) +{ + KAKUSHI *k = NULL; + MS_DRIVER_VER ver; + bool ok; + if (num < 1) + { + return; + } + + InitWinUi(L"VPN", _SS("DEFAULT_FONT"), _II("DEFAULT_FONT_SIZE")); + + if (MsIsNt()) + { + k = InitKakushi(); + } + + CiInitDriverVerStruct(&ver); + + ok = MsInstallVLan(VLAN_ADAPTER_NAME_TAG, VLAN_CONNECTION_NAME, arg[0], &ver); + + FreeKakushi(k); + + FreeWinUi(); + + if (ok == false) + { + _exit(1); + } + else + { + _exit(0); + } +} + +void upgradevlan(UINT num, char **arg) +{ + bool ok; + KAKUSHI *k = NULL; + MS_DRIVER_VER ver; + if (num < 1) + { + return; + } + + InitWinUi(L"VPN", _SS("DEFAULT_FONT"), _II("DEFAULT_FONT_SIZE")); + + if (MsIsNt()) + { + k = InitKakushi(); + } + + CiInitDriverVerStruct(&ver); + + ok = MsUpgradeVLan(VLAN_ADAPTER_NAME_TAG, VLAN_CONNECTION_NAME, arg[0], &ver); + + FreeKakushi(k); + + FreeWinUi(); + + if (ok == false) + { + _exit(1); + } + else + { + _exit(0); + } +} + +void uninstvlan(UINT num, char **arg) +{ + bool ok; + if (num < 1) + { + return; + } + + ok = MsUninstallVLan(arg[0]); + + if (ok == false) + { + _exit(1); + } + else + { + _exit(0); + } +} + +TEST_LIST test_list[] = +{ + {"instvlan", instvlan}, + {"uninstvlan", uninstvlan}, + {"upgradevlan", upgradevlan}, + {"enablevlan", enablevlan}, + {"disablevlan", disablevlan}, +}; + +// Main function +void MainFunction(char *cmd) +{ + char tmp[MAX_SIZE]; + bool first = true; + bool exit_now = false; + + while (true) + { + if (first && StrLen(cmd) != 0 && g_memcheck == false) + { + first = false; + StrCpy(tmp, sizeof(tmp), cmd); + exit_now = true; + Print("%s\n", cmd); + } + else + { + _exit(0); + } + Trim(tmp); + if (StrLen(tmp) != 0) + { + UINT i, num; + bool b = false; + TOKEN_LIST *token = ParseCmdLine(tmp); + char *cmd = token->Token[0]; + + num = sizeof(test_list) / sizeof(TEST_LIST); + for (i = 0;i < num;i++) + { + if (!StrCmpi(test_list[i].command_str, cmd)) + { + char **arg = Malloc(sizeof(char *) * (token->NumTokens - 1)); + UINT j; + for (j = 0;j < token->NumTokens - 1;j++) + { + arg[j] = CopyStr(token->Token[j + 1]); + } + test_list[i].proc(token->NumTokens - 1, arg); + for (j = 0;j < token->NumTokens - 1;j++) + { + Free(arg[j]); + } + Free(arg); + b = true; + _exit(1); + break; + } + } + FreeToken(token); + + if (exit_now) + { + break; + } + } + } +} + +// winmain function +int PASCAL WinMain(HINSTANCE hInst, HINSTANCE hPrev, char *CmdLine, int CmdShow) +{ + InitProcessCallOnce(); + +#if defined(_DEBUG) || defined(DEBUG) // In VC++ compilers, the macro is "_DEBUG", not "DEBUG". + // If set memcheck = true, the program will be vitally slow since it will log all malloc() / realloc() / free() calls to find the cause of memory leak. + // For normal debug we set memcheck = false. + // Please set memcheck = true if you want to test the cause of memory leaks. + InitMayaqua(false, true, 0, NULL); +#else + InitMayaqua(false, false, 0, NULL); +#endif + EnableProbe(false); + InitCedar(); + SetHamMode(); + MainFunction(cmdline); + FreeCedar(); + FreeMayaqua(); + + return 0; +} + diff --git a/src/vpndrvinst/vpndrvinst.h b/src/vpndrvinst/vpndrvinst.h index a0de9345..30ca4528 100644 --- a/src/vpndrvinst/vpndrvinst.h +++ b/src/vpndrvinst/vpndrvinst.h @@ -1,23 +1,23 @@ -// SoftEther VPN Source Code - Developer Edition Master Branch -// VPN Driver Installer - -// List of test functions -typedef void (TEST_PROC)(UINT num, char **arg); - -typedef struct TEST_LIST -{ - char *command_str; - TEST_PROC *proc; -} TEST_LIST; - -// function prototypes -void disablevlan(UINT num, char **arg); -void enablevlan(UINT num, char **arg); -void instvlan(UINT num, char **arg); -void upgradevlan(UINT num, char **arg); -void uninstvlan(UINT num, char **arg); - -void MainFunction(char *cmd); -int PASCAL WinMain(HINSTANCE hInst, HINSTANCE hPrev, char *CmdLine, int CmdShow); - - +// SoftEther VPN Source Code - Developer Edition Master Branch +// VPN Driver Installer + +// List of test functions +typedef void (TEST_PROC)(UINT num, char **arg); + +typedef struct TEST_LIST +{ + char *command_str; + TEST_PROC *proc; +} TEST_LIST; + +// function prototypes +void disablevlan(UINT num, char **arg); +void enablevlan(UINT num, char **arg); +void instvlan(UINT num, char **arg); +void upgradevlan(UINT num, char **arg); +void uninstvlan(UINT num, char **arg); + +void MainFunction(char *cmd); +int PASCAL WinMain(HINSTANCE hInst, HINSTANCE hPrev, char *CmdLine, int CmdShow); + + diff --git a/src/vpndrvinst/vpndrvinst.rc b/src/vpndrvinst/vpndrvinst.rc index b9b417f9..8c00935a 100644 --- a/src/vpndrvinst/vpndrvinst.rc +++ b/src/vpndrvinst/vpndrvinst.rc @@ -1,72 +1,72 @@ -// Microsoft Visual C++ generated resource script. -// -#include "resource.h" - -#define APSTUDIO_READONLY_SYMBOLS -///////////////////////////////////////////////////////////////////////////// -// -// Generated from the TEXTINCLUDE 2 resource. -// -#include "winres.h" - -///////////////////////////////////////////////////////////////////////////// -#undef APSTUDIO_READONLY_SYMBOLS - -///////////////////////////////////////////////////////////////////////////// -// Japanese resources - -#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_JPN) -#ifdef _WIN32 -LANGUAGE LANG_JAPANESE, SUBLANG_DEFAULT -#pragma code_page(932) -#endif //_WIN32 - -#ifdef APSTUDIO_INVOKED -///////////////////////////////////////////////////////////////////////////// -// -// TEXTINCLUDE -// - -1 TEXTINCLUDE -BEGIN - "resource.h\0" -END - -2 TEXTINCLUDE -BEGIN - "#include ""winres.h""\r\n" - "\0" -END - -3 TEXTINCLUDE -BEGIN - "\r\n" - "\0" -END - -#endif // APSTUDIO_INVOKED - - -///////////////////////////////////////////////////////////////////////////// -// -// Icon -// - -// Icon with lowest ID value placed first to ensure application icon -// remains consistent on all systems. -IDI_ICON2 ICON "vpndrvinst.ico" -#endif // Japanese resources -///////////////////////////////////////////////////////////////////////////// - - - -#ifndef APSTUDIO_INVOKED -///////////////////////////////////////////////////////////////////////////// -// -// Generated from the TEXTINCLUDE 3 resource. -// - - -///////////////////////////////////////////////////////////////////////////// -#endif // not APSTUDIO_INVOKED - +// Microsoft Visual C++ generated resource script. +// +#include "resource.h" + +#define APSTUDIO_READONLY_SYMBOLS +///////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 2 resource. +// +#include "winres.h" + +///////////////////////////////////////////////////////////////////////////// +#undef APSTUDIO_READONLY_SYMBOLS + +///////////////////////////////////////////////////////////////////////////// +// Japanese resources + +#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_JPN) +#ifdef _WIN32 +LANGUAGE LANG_JAPANESE, SUBLANG_DEFAULT +#pragma code_page(932) +#endif //_WIN32 + +#ifdef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// TEXTINCLUDE +// + +1 TEXTINCLUDE +BEGIN + "resource.h\0" +END + +2 TEXTINCLUDE +BEGIN + "#include ""winres.h""\r\n" + "\0" +END + +3 TEXTINCLUDE +BEGIN + "\r\n" + "\0" +END + +#endif // APSTUDIO_INVOKED + + +///////////////////////////////////////////////////////////////////////////// +// +// Icon +// + +// Icon with lowest ID value placed first to ensure application icon +// remains consistent on all systems. +IDI_ICON2 ICON "vpndrvinst.ico" +#endif // Japanese resources +///////////////////////////////////////////////////////////////////////////// + + + +#ifndef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 3 resource. +// + + +///////////////////////////////////////////////////////////////////////////// +#endif // not APSTUDIO_INVOKED + diff --git a/src/vpninstall/resource.h b/src/vpninstall/resource.h index 2d22abfa..84a2f1dc 100644 --- a/src/vpninstall/resource.h +++ b/src/vpninstall/resource.h @@ -1,86 +1,86 @@ -//{{NO_DEPENDENCIES}} -// Microsoft Visual C++ generated include file. -// Used by vpninstall.rc -// -#define IDI_ICON1 101 -#define IDI_MAIN 101 -#define IDS_STRING102 102 -#define IDS_TITLE 102 -#define IDS_FONT 103 -#define IDS_FONT_SIZE 104 -#define IDS_INF_LOAD_FAILED 105 -#define IDS_DIFF_CPU 106 -#define IDS_INSTANCE_EXISTS 107 -#define IDS_BAD_OS 108 -#define IDS_CPU_NOT_SUPPORTED 109 -#define IDS_DOWNLOADING 110 -#define IDS_DOWNLOADSTART 111 -#define IDS_TEMP_ERROR 112 -#define IDS_DOWNLOAD_ERROR 113 -#define IDS_DOWNLOADING2 114 -#define IDS_DOWNLOADING3 115 -#define IDS_INSTALLSTART 116 -#define IDS_INSTALLSTART_ERROR 117 -#define IDS_SECURITY_ERROR 118 -#define IDS_SIGN_WARNING 119 -#define IDS_SIGN_WARNING_TITLE 120 -#define IDS_TITLE_VPNSMGR 121 -#define IDS_VPNSMGR_EXEC_ERROR 122 -#define IDS_DLG_TITLE 123 -#define IDS_INSTALL_DLG__STATUS_INIT 124 -#define IDS_INSTALL_CANCEL 125 -#define IDS_EULA_NOTICE1 126 -#define IDS_EULA_NOTICE2 127 -#define IDS_EULA_NOTICE3 128 -#define IDS_EULA_AGREE 129 -#define IDS_EULA_DISAGREE 130 -#define S_TITLE 1001 -#define P_PROGRESS 1002 -#define S_STATUS 1003 -#define S_SIZEINFO 1005 -#define E_EULA 1006 -#define S_BOLD 1008 -#define S_EULA_NOTICE1 1009 -#define S_EULA_NOTICE3 1010 -#define IDS_TITLE_EN 1102 -#define IDS_FONT_EN 1103 -#define IDS_FONT_SIZE_EN 1104 -#define IDS_INF_LOAD_FAILED_EN 1105 -#define IDS_DIFF_CPU_EN 1106 -#define IDS_INSTANCE_EXISTS_EN 1107 -#define IDS_BAD_OS_EN 1108 -#define IDS_CPU_NOT_SUPPORTED_EN 1109 -#define IDS_DOWNLOADING_EN 1110 -#define IDS_DOWNLOADSTART_EN 1111 -#define IDS_TEMP_ERROR_EN 1112 -#define IDS_DOWNLOAD_ERROR_EN 1113 -#define IDS_DOWNLOADING2_EN 1114 -#define IDS_DOWNLOADING3_EN 1115 -#define IDS_INSTALLSTART_EN 1116 -#define IDS_INSTALLSTART_ERROR_EN 1117 -#define IDS_SECURITY_ERROR_EN 1118 -#define IDS_SIGN_WARNING_EN 1119 -#define IDS_SIGN_WARNING_TITLE_EN 1120 -#define IDS_TITLE_VPNSMGR_EN 1121 -#define IDS_VPNSMGR_EXEC_ERROR_EN 1122 -#define IDS_DLG_TITLE_EN 1123 -#define IDS_INSTALL_DLG__STATUS_INIT_EN 1124 -#define IDS_INSTALL_CANCEL_EN 1125 -#define IDS_EULA_NOTICE1_EN 1126 -#define IDS_EULA_NOTICE2_EN 1127 -#define IDS_EULA_NOTICE3_EN 1128 -#define IDS_EULA_AGREE_EN 1129 -#define IDS_EULA_DISAGREE_EN 1130 -#define D_INSTALL 2007 -#define D_EULA 2008 - -// Next default values for new objects -// -#ifdef APSTUDIO_INVOKED -#ifndef APSTUDIO_READONLY_SYMBOLS -#define _APS_NEXT_RESOURCE_VALUE 123 -#define _APS_NEXT_COMMAND_VALUE 40001 -#define _APS_NEXT_CONTROL_VALUE 1011 -#define _APS_NEXT_SYMED_VALUE 101 -#endif -#endif +//{{NO_DEPENDENCIES}} +// Microsoft Visual C++ generated include file. +// Used by vpninstall.rc +// +#define IDI_ICON1 101 +#define IDI_MAIN 101 +#define IDS_STRING102 102 +#define IDS_TITLE 102 +#define IDS_FONT 103 +#define IDS_FONT_SIZE 104 +#define IDS_INF_LOAD_FAILED 105 +#define IDS_DIFF_CPU 106 +#define IDS_INSTANCE_EXISTS 107 +#define IDS_BAD_OS 108 +#define IDS_CPU_NOT_SUPPORTED 109 +#define IDS_DOWNLOADING 110 +#define IDS_DOWNLOADSTART 111 +#define IDS_TEMP_ERROR 112 +#define IDS_DOWNLOAD_ERROR 113 +#define IDS_DOWNLOADING2 114 +#define IDS_DOWNLOADING3 115 +#define IDS_INSTALLSTART 116 +#define IDS_INSTALLSTART_ERROR 117 +#define IDS_SECURITY_ERROR 118 +#define IDS_SIGN_WARNING 119 +#define IDS_SIGN_WARNING_TITLE 120 +#define IDS_TITLE_VPNSMGR 121 +#define IDS_VPNSMGR_EXEC_ERROR 122 +#define IDS_DLG_TITLE 123 +#define IDS_INSTALL_DLG__STATUS_INIT 124 +#define IDS_INSTALL_CANCEL 125 +#define IDS_EULA_NOTICE1 126 +#define IDS_EULA_NOTICE2 127 +#define IDS_EULA_NOTICE3 128 +#define IDS_EULA_AGREE 129 +#define IDS_EULA_DISAGREE 130 +#define S_TITLE 1001 +#define P_PROGRESS 1002 +#define S_STATUS 1003 +#define S_SIZEINFO 1005 +#define E_EULA 1006 +#define S_BOLD 1008 +#define S_EULA_NOTICE1 1009 +#define S_EULA_NOTICE3 1010 +#define IDS_TITLE_EN 1102 +#define IDS_FONT_EN 1103 +#define IDS_FONT_SIZE_EN 1104 +#define IDS_INF_LOAD_FAILED_EN 1105 +#define IDS_DIFF_CPU_EN 1106 +#define IDS_INSTANCE_EXISTS_EN 1107 +#define IDS_BAD_OS_EN 1108 +#define IDS_CPU_NOT_SUPPORTED_EN 1109 +#define IDS_DOWNLOADING_EN 1110 +#define IDS_DOWNLOADSTART_EN 1111 +#define IDS_TEMP_ERROR_EN 1112 +#define IDS_DOWNLOAD_ERROR_EN 1113 +#define IDS_DOWNLOADING2_EN 1114 +#define IDS_DOWNLOADING3_EN 1115 +#define IDS_INSTALLSTART_EN 1116 +#define IDS_INSTALLSTART_ERROR_EN 1117 +#define IDS_SECURITY_ERROR_EN 1118 +#define IDS_SIGN_WARNING_EN 1119 +#define IDS_SIGN_WARNING_TITLE_EN 1120 +#define IDS_TITLE_VPNSMGR_EN 1121 +#define IDS_VPNSMGR_EXEC_ERROR_EN 1122 +#define IDS_DLG_TITLE_EN 1123 +#define IDS_INSTALL_DLG__STATUS_INIT_EN 1124 +#define IDS_INSTALL_CANCEL_EN 1125 +#define IDS_EULA_NOTICE1_EN 1126 +#define IDS_EULA_NOTICE2_EN 1127 +#define IDS_EULA_NOTICE3_EN 1128 +#define IDS_EULA_AGREE_EN 1129 +#define IDS_EULA_DISAGREE_EN 1130 +#define D_INSTALL 2007 +#define D_EULA 2008 + +// Next default values for new objects +// +#ifdef APSTUDIO_INVOKED +#ifndef APSTUDIO_READONLY_SYMBOLS +#define _APS_NEXT_RESOURCE_VALUE 123 +#define _APS_NEXT_COMMAND_VALUE 40001 +#define _APS_NEXT_CONTROL_VALUE 1011 +#define _APS_NEXT_SYMED_VALUE 101 +#endif +#endif diff --git a/src/vpninstall/vpninstall.c b/src/vpninstall/vpninstall.c index ac843ff2..112d77a0 100644 --- a/src/vpninstall/vpninstall.c +++ b/src/vpninstall/vpninstall.c @@ -1,1567 +1,1567 @@ -// SoftEther VPN Source Code - Developer Edition Master Branch -// Cedar Communication Module - - -// vpninstall.c -// VPN Client Web Installer Bootstrap - -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "vpninstall.h" -#include "resource.h" - -#pragma comment(lib, "wininet.lib") - -static bool is_debug = true; -static LIST *string_table = NULL; -static VI_SETTING setting; -static bool sleep_before_exit = false; -static int skip = 0; - -// Convert the URL to the file name -char *ViUrlToFileName(char *url) -{ - UINT i, len; - char *ret = url; - bool b = true; - len = lstrlen(url); - - for (i = 0;i < len;i++) - { - char c = url[i]; - - if (c == '?' || c == '#') - { - b = false; - } - - if (b) - { - if (c == '/' || c == '\\') - { - if (lstrlen(url + i + 1) > 1) - { - ret = url + i + 1; - } - } - } - } - - return ret; -} - -// Check the signature of the EXE file, and displays a warning if dangerous -bool ViCheckExeSign(HWND hWnd, wchar_t *exew) -{ - wchar_t tmp[2048]; - bool danger = true; - wchar_t *warningMessage = _U(IDS_SIGN_WARNING+skip); - wchar_t *warningMessageTitle = _U(IDS_SIGN_WARNING_TITLE+skip); - // Validate arguments - if (hWnd == NULL || exew == NULL) - { - return false; - } - - if (MsCheckFileDigitalSignatureW(hWnd, exew, &danger)) - { - if (danger == false) - { - // Safe - return true; - } - else - { - wchar_t filename[MAX_PATH]; - - GetFileNameFromFilePathW(filename, sizeof(filename), exew); - - // Show the message because there is potentially dangerous - swprintf(tmp, sizeof(tmp) / 2, warningMessage, - filename, filename, filename); - - if (MessageBoxW(hWnd, tmp, warningMessageTitle, - MB_OKCANCEL | MB_DEFBUTTON2 | MB_ICONEXCLAMATION) == IDOK) - { - return true; - } - - return false; - } - } - else - { - // Danger - return false; - } -} - -// Start the installation process -void ViInstallProcessStart(HWND hWnd, VI_INSTALL_DLG *d) -{ - wchar_t *exew; - bool ok; - char instdir[MAX_PATH]; - char hamcore[MAX_PATH]; - // Validate arguments - if (hWnd == NULL || d == NULL) - { - return; - } - - ViGenerateVpnSMgrTempDirName(instdir, sizeof(instdir), ViGetSuitableArchForCpu()->Build); - ConbinePath(hamcore, sizeof(hamcore), instdir, "hamcore.se2"); - - exew = setting.DownloadedInstallerPathW; - d->NoClose = true; - - Hide(hWnd, IDCANCEL); - SetPos(hWnd, P_PROGRESS, 100); - Hide(hWnd, P_PROGRESS); - Hide(hWnd, S_SIZEINFO); - SetText(hWnd, S_STATUS, _U(IDS_INSTALLSTART+skip)); - - ok = true; - - if (setting.DownloadNotRequired == false) - { - if (setting.WebMode && ViCheckExeSign(hWnd, exew) == false) - { - // The digital signature is not reliable - ok = false; - } - else - { - // Installation - HANDLE hProcess; - SHELLEXECUTEINFOW info; - - // Run - Zero(&info, sizeof(info)); - info.cbSize = sizeof(info); - info.lpVerb = L"open"; - info.lpFile = exew; - info.fMask = SEE_MASK_NOCLOSEPROCESS; - info.lpParameters = L"/HIDESTARTCOMMAND:1 /DISABLEAUTOIMPORT:1 /ISWEBINSTALLER:1"; - info.nShow = SW_SHOWNORMAL; - if (ShellExecuteExW(&info) == false) - { - MsgBox(hWnd, MB_ICONSTOP, _U(IDS_INSTALLSTART_ERROR+skip)); - ok = false; - } - else - { - hProcess = info.hProcess; - - // Wait for the install process to complete - while (true) - { - if (WaitForSingleObject(hProcess, 50) != WAIT_TIMEOUT) - { - break; - } - - DoEvents(hWnd); - } - CloseHandle(hProcess); - } - } - } - - if (ok && d->WindowsShutdowning == false) - { - VI_SETTING_ARCH *a = ViGetSuitableArchForCpu(); - wchar_t arg[MAX_PATH]; - wchar_t exe[MAX_PATH]; - char *arg1 = "/easy"; - // Hide the screen - Hide(hWnd, 0); - - if (setting.NormalMode) - { - arg1 = "/normal"; - } - - // (Just in case) start the VPN Client service - if (MsIsServiceRunning("vpnclient") == false) - { - MsStartService("vpnclient"); - } - - // Wait for that the service becomes available - SwWaitForVpnClientPortReady(0); - - if (UniIsEmptyStr(setting.DownloadedSettingPathW) == false) - { - // Start a connection by importing the configuration file into the VPN Client - UniFormat(arg, sizeof(arg), L"%S \"%s\"", arg1, setting.DownloadedSettingPathW); - } - else - { - // Just start the Connection Manager - UniFormat(arg, sizeof(arg), L"%S", arg1); - } - - // Get the installation state - ViLoadCurrentInstalledStatusForArch(a); - - if (a->CurrentInstalled) - { - HANDLE h; - wchar_t filename[MAX_PATH]; - - StrToUni(filename, sizeof(filename), a->VpnCMgrExeFileName); - - ConbinePathW(exe, sizeof(exe), a->CurrentInstalledPathW, filename); - - // Start the Connection Manager - h = MsRunAsUserExW(exe, arg, false); - if (h != NULL) - { - if (UniIsEmptyStr(setting.DownloadedSettingPathW) == false) - { - sleep_before_exit = true; - } - - CloseHandle(h); - } - } - } - - d->NoClose = false; - Close(hWnd); -} - -// End User License Agreement dialog -UINT ViEulaDlgProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param) -{ - wchar_t *text = (wchar_t *)param; - // Validate arguments - if (hWnd == NULL) - { - return 0; - } - - switch (msg) - { - case WM_INITDIALOG: - SetText(hWnd, 0, _U(IDS_DLG_TITLE+skip)); - SetText(hWnd, S_EULA_NOTICE1, _U(IDS_EULA_NOTICE1+skip)); - SetText(hWnd, S_BOLD, _U(IDS_EULA_NOTICE2+skip)); - SetText(hWnd, S_EULA_NOTICE3, _U(IDS_EULA_NOTICE3+skip)); - SetText(hWnd, IDOK, _U(IDS_EULA_AGREE+skip)); - SetText(hWnd, IDCANCEL, _U(IDS_EULA_DISAGREE+skip)); - - DlgFont(hWnd, S_BOLD, 0, true); - SetText(hWnd, E_EULA, text); - Focus(hWnd, E_EULA); - SendMsg(hWnd, E_EULA, EM_SETSEL, 0, 0); - Center(hWnd); - break; - - case WM_COMMAND: - switch (wParam) - { - case IDOK: - EndDialog(hWnd, 1); - break; - - case IDCANCEL: - Close(hWnd); - break; - } - break; - - case WM_CLOSE: - EndDialog(hWnd, 0); - break; - } - - return 0; -} - -// Display the End User License Agreement -bool ViEulaDlg(HWND hWnd, wchar_t *text) -{ - // Validate arguments - if (text == NULL) - { - return false; - } - - if (Dialog(hWnd, D_EULA, ViEulaDlgProc, text) == 0) - { - return false; - } - - return true; -} - -// Extract the license agreement from the EXE file -wchar_t *ViExtractEula(char *exe) -{ - BUF *b; - UINT tmp_size; - char *tmp; - wchar_t *ret; - // Validate arguments - if (exe == NULL) - { - return false; - } - - b = ViExtractResource(exe, RT_RCDATA, "LICENSE"); - if (b == NULL) - { - return NULL; - } - - tmp_size = b->Size + 1; - tmp = ZeroMalloc(tmp_size); - - Copy(tmp, b->Buf, b->Size); - FreeBuf(b); - - ret = CopyStrToUni(tmp); - Free(tmp); - - return ret; -} - -// Extract the Cabinet file from the EXE file -bool ViExtractCabinetFile(char *exe, char *cab) -{ - BUF *b; - // Validate arguments - if (exe == NULL || cab == NULL) - { - return false; - } - - b = ViExtractResource(exe, RT_RCDATA, "CABINET"); - if (b == NULL) - { - return false; - } - - if (DumpBuf(b, cab) == false) - { - FreeBuf(b); - - return false; - } - - FreeBuf(b); - - return true; -} - -// Extract the resource from the EXE file -BUF *ViExtractResource(char *exe, char *type, char *name) -{ - HINSTANCE h; - HRSRC hr; - HGLOBAL hg; - UINT size; - void *data; - BUF *buf; - // Validate arguments - if (exe == NULL || type == NULL || name == NULL) - { - return NULL; - } - - h = LoadLibraryExA(exe, NULL, LOAD_LIBRARY_AS_DATAFILE); - if (h == NULL) - { - return NULL; - } - - hr = FindResourceA(h, name, type); - if (hr == NULL) - { - FreeLibrary(h); - return NULL; - } - - hg = LoadResource(h, hr); - if (hg == NULL) - { - FreeLibrary(h); - return NULL; - } - - size = SizeofResource(h, hr); - data = (void *)LockResource(hg); - - buf = NewBuf(); - WriteBuf(buf, data, size); - - FreeResource(hg); - FreeLibrary(h); - - SeekBuf(buf, 0, 0); - - return buf; -} - -// Open the file -VI_FILE *ViOpenFile(char *path) -{ - VI_FILE *f; - // Validate arguments - if (path == NULL) - { - return NULL; - } - - if (ViIsInternetFile(path)) - { - HINTERNET hHttpFile; - HINTERNET hInternet = InternetOpenA(DEFAULT_USER_AGENT, - INTERNET_OPEN_TYPE_PRECONFIG, - NULL, NULL, 0); - UINT size; - UINT sizesize; - - if (hInternet == NULL) - { - return NULL; - } - - hHttpFile = InternetOpenUrlA(hInternet, path, NULL, 0, - INTERNET_FLAG_NO_CACHE_WRITE | INTERNET_FLAG_RELOAD, 0); - - if (hHttpFile == NULL) - { - InternetCloseHandle(hInternet); - return NULL; - } - - size = 0; - sizesize = sizeof(size); - - if (StartWith(path, "ftp://")) - { - // ftp - DWORD high = 0; - - size = FtpGetFileSize(hHttpFile, &high); - } - else - { - UINT errorcode = 0; - UINT errorcode_size = sizeof(errorcode); - - // http - if (HttpQueryInfo(hHttpFile, HTTP_QUERY_CONTENT_LENGTH | HTTP_QUERY_FLAG_NUMBER, - &size, &sizesize, NULL) == false) - { - size = 0; - } - - if (HttpQueryInfo(hHttpFile, HTTP_QUERY_STATUS_CODE | HTTP_QUERY_FLAG_NUMBER, - &errorcode, &errorcode_size, NULL) == false || - (errorcode / 100) != 2) - { - // HTTP getting error - InternetCloseHandle(hInternet); - InternetCloseHandle(hHttpFile); - return NULL; - } - } - - f = ZeroMalloc(sizeof(VI_FILE)); - f->InternetFile = true; - f->hInternet = hInternet; - f->hHttpFile = hHttpFile; - f->FileSize = size; - - return f; - } - else - { - IO *io; - char fullpath[MAX_PATH]; - char exedir[MAX_PATH]; - - GetExeDir(exedir, sizeof(exedir)); - - ConbinePath(fullpath, sizeof(fullpath), exedir, path); - - io = FileOpen(fullpath, false); - if (io == NULL) - { - return NULL; - } - - f = ZeroMalloc(sizeof(VI_FILE)); - f->InternetFile = false; - f->FileSize = FileSize(io); - f->io = io; - - return f; - } -} - -// Get the file size -UINT ViGetFileSize(VI_FILE *f) -{ - // Validate arguments - if (f == NULL) - { - return 0; - } - - return f->FileSize; -} - -// Read from the file -UINT ViReadFile(VI_FILE *f, void *buf, UINT size) -{ - // Validate arguments - if (f == NULL || buf == NULL) - { - return INFINITE; - } - - if (f->InternetFile == false) - { - UINT readsize = MIN(size, f->FileSize - f->IoReadFileSize); - bool ret; - - if (readsize == 0) - { - return 0; - } - - ret = FileRead(f->io, buf, readsize); - - if (ret == false) - { - return INFINITE; - } - - f->IoReadFileSize += readsize; - - return readsize; - } - else - { - UINT readsize = 0; - - if (InternetReadFile(f->hHttpFile, buf, size, &readsize) == false) - { - return INFINITE; - } - - return readsize; - } -} - -// Close the file -void ViCloseFile(VI_FILE *f) -{ - // Validate arguments - if (f == NULL) - { - return; - } - - if (f->InternetFile == false) - { - FileClose(f->io); - } - else - { - InternetCloseHandle(f->hHttpFile); - InternetCloseHandle(f->hInternet); - } - - Free(f); -} - -// Determine whether the specified file name is the file on the Internet -bool ViIsInternetFile(char *path) -{ - // Validate arguments - if (path == NULL) - { - return false; - } - - if (StartWith(path, "http://") || StartWith(path, "https://") || StartWith(path, "ftp://")) - { - return true; - } - - return false; -} - -// Installer dialog initialization -void ViInstallDlgOnInit(HWND hWnd, VI_INSTALL_DLG *d) -{ - // Validate arguments - if (hWnd == NULL || d == NULL) - { - return; - } - - d->hWnd = hWnd; - - SetIcon(hWnd, 0, IDI_MAIN); - - SetText(hWnd, 0, _U(IDS_DLG_TITLE+skip)); - SetText(hWnd, S_TITLE, _U(IDS_DLG_TITLE+skip)); - - SetText(hWnd, S_STATUS, _U(IDS_INSTALL_DLG__STATUS_INIT+skip)); - SetText(hWnd, IDCANCEL, _U(IDS_INSTALL_CANCEL+skip)); - - DlgFont(hWnd, S_TITLE+skip, 12, true); - SetRange(hWnd, P_PROGRESS, 0, 100); - SetPos(hWnd, P_PROGRESS, 0); - - SetTimer(hWnd, 1, 22, NULL); -} - -// Start the download thread -void ViDownloadThreadStart(VI_INSTALL_DLG *d) -{ - // Validate arguments - if (d == NULL) - { - return; - } - - d->DownloadStarted = true; - d->DownloadThread = NewThread(ViDownloadThread, d); -} - - -// Stop the download thread -void ViDownloadThreadStop(VI_INSTALL_DLG *d) -{ - // Validate arguments - if (d == NULL) - { - return; - } - - if (d->DownloadStarted == false) - { - return; - } - - d->DownloadStarted = false; - d->Halt = true; - - while (true) - { - if (WaitThread(d->DownloadThread, 50)) - { - break; - } - - DoEvents(NULL); - } - - ReleaseThread(d->DownloadThread); -} - -// Download thread -void ViDownloadThread(THREAD *thread, void *param) -{ - VI_INSTALL_DLG *d; - VI_SETTING_ARCH *a; - HWND hWnd; - UINT num_files = 2; - VI_DOWNLOAD_FILE files[2]; - VI_DOWNLOAD_FILE *f; - UINT i; - // Validate arguments - if (thread == NULL || param == NULL) - { - return; - } - - d = (VI_INSTALL_DLG *)param; - hWnd = d->hWnd; - - Zero(files, sizeof(files)); - - a = ViGetSuitableArchForCpu(); - - // File body - f = &files[0]; - StrCpy(f->SrcPath, sizeof(f->SrcPath), a->Path); - - // Configuration file - if (IsEmptyStr(setting.SettingPath) == false) - { - f = &files[1]; - StrCpy(f->SrcPath, sizeof(f->SrcPath), setting.SettingPath); - } - else - { - // No configuration file - num_files = 1; - } - - for (i = 0;i < num_files;i++) - { - bool b = true; - - if (i == 0 && setting.DownloadNotRequired) - { - b = false; - } - - if (b) - { - wchar_t tmp[MAX_SIZE]; - IO *dest = NULL; - VI_FILE *down; - UINT ret; - UINT totalsize; - UINT currentsize; - wchar_t filename_w[MAX_PATH]; - - f = &files[i]; - GetFileNameFromFilePath(f->FileName, sizeof(f->FileName), f->SrcPath); - MakeSafeFileName(f->FileName, sizeof(f->FileName), f->FileName); - - StrToUni(filename_w, sizeof(filename_w), f->FileName); - ConbinePathW(f->DestPathW, sizeof(f->DestPathW), MsGetMyTempDirW(), filename_w); - - ViInstallDlgSetPos(hWnd, 0); - UniFormat(tmp, sizeof(tmp), _U(IDS_DOWNLOADSTART+skip), f->FileName); - ViInstallDlgSetText(d, hWnd, S_STATUS, tmp); - - down = ViOpenFile(f->SrcPath); - if (down == NULL) - { - MsgBoxEx(hWnd, MB_ICONSTOP, _U(IDS_DOWNLOAD_ERROR+skip), f->FileName); - - ViInstallDlgCancel(hWnd); - return; - } - - dest = FileCreateW(f->DestPathW); - if (dest == NULL) - { - MsgBoxEx(hWnd, MB_ICONSTOP, _U(IDS_TEMP_ERROR+skip), f->DestPathW); - - ViCloseFile(down); - ViInstallDlgCancel(hWnd); - return; - } - - totalsize = ViGetFileSize(down); - currentsize = 0; - - UniFormat(tmp, sizeof(tmp), _U(IDS_DOWNLOADING3+skip), f->FileName); - ViInstallDlgSetText(d, hWnd, S_STATUS, tmp); - - while (true) - { - UINT pos = 0; - - if (d->Halt) - { - // User cancel - FileClose(dest); - ViCloseFile(down); - return; - } - - UniFormat(tmp, sizeof(tmp), _U(IDS_DOWNLOADING3+skip), f->FileName); - - ViInstallDlgSetText(d, hWnd, IDS_DOWNLOADING3+skip, tmp); - ret = ViReadFile(down, d->Buf, d->BufSize); - - if (ret == INFINITE) - { - // Communication error - MsgBoxEx(hWnd, MB_ICONSTOP, _U(IDS_DOWNLOAD_ERROR+skip), f->FileName); - - FileClose(dest); - ViCloseFile(down); - ViInstallDlgCancel(hWnd); - - return; - } - - // Draw progress - currentsize += ret; - - if (totalsize != 0) - { - UniFormat(tmp, sizeof(tmp), _U(IDS_DOWNLOADING+skip), - ((float)totalsize) / 1024.0f / 1024.0f, - ((float)currentsize) / 1024.0f / 1024.0f); - - pos = (UINT)(((float)currentsize) * 100.0f / ((float)totalsize)); - } - else - { - UniFormat(tmp, sizeof(tmp), _U(IDS_DOWNLOADING2+skip), - ((float)currentsize) / 1024.0f / 1024.0f); - pos = (UINT)(((float)currentsize) * 100.0f / (1024.0f * 1024.0f * 10.0f)); - } - - ViInstallDlgSetText(d, hWnd, S_SIZEINFO, tmp); - ViInstallDlgSetPos(hWnd, pos); - - if (ret == 0) - { - // Download Complete - break; - } - else - { - FileWrite(dest, d->Buf, ret); - } - } - - ViCloseFile(down); - FileClose(dest); - } - } - - UniStrCpy(setting.DownloadedInstallerPathW, sizeof(setting.DownloadedInstallerPathW), - files[0].DestPathW); - - if (num_files >= 2) - { - UniStrCpy(setting.DownloadedSettingPathW, sizeof(setting.DownloadedSettingPathW), - files[1].DestPathW); - } - - PostMessageA(hWnd, WM_VI_DOWNLOAD_FINISHED, 0, 0); -} - -// Operation of the progress bar -void ViInstallDlgSetPos(HWND hWnd, UINT pos) -{ - PostMessage(hWnd, WM_VI_SETPOS, 0, pos); -} - -// Set the text -void ViInstallDlgSetText(VI_INSTALL_DLG *d, HWND hWnd, UINT id, wchar_t *text) -{ - DWORD value = 0; - // Validate arguments - if (d == NULL) - { - return; - } - - if (d->Halt) - { - return; - } - - SendMessageTimeout(hWnd, WM_VI_SETTEXT, id, (LPARAM)text, SMTO_BLOCK, 200, &value); -} - -// Cancel -void ViInstallDlgCancel(HWND hWnd) -{ - PostMessageA(hWnd, WM_VI_CANCEL, 0, 0); -} - -// Installer operation start -void ViInstallDlgOnStart(HWND hWnd, VI_INSTALL_DLG *d) -{ - // Validate arguments - if (hWnd == NULL || d == NULL) - { - return; - } - - // Start the download thread - ViDownloadThreadStart(d); -} - -// Cancel the installation -void ViInstallDlgOnClose(HWND hWnd, VI_INSTALL_DLG *d) -{ - // Validate arguments - if (hWnd == NULL || d == NULL) - { - return; - } - - if (d->DialogCanceling) - { - return; - } - if (d->NoClose) - { - return; - } - - d->DialogCanceling = true; - - // Disable the cancel button - Disable(hWnd, IDCANCEL); - - // Stop the download thread if it runs - ViDownloadThreadStop(d); - - // Exit the dialog - EndDialog(hWnd, 0); -} - -// Installer procedure -UINT ViInstallDlgProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param) -{ - VI_INSTALL_DLG *d = (VI_INSTALL_DLG *)param; - UINT pos; - wchar_t *text; - // Validate arguments - if (hWnd == NULL) - { - return 0; - } - - switch (msg) - { - case WM_INITDIALOG: - ViInstallDlgOnInit(hWnd, param); - break; - - case WM_TIMER: - switch (wParam) - { - case 1: - KillTimer(hWnd, 1); - ViInstallDlgOnStart(hWnd, d); - break; - } - break; - - case WM_VI_SETPOS: - // Setting the progress bar - pos = (UINT)lParam; - SetPos(hWnd, P_PROGRESS, MAKESURE(pos, 0, 100)); - break; - - case WM_VI_SETTEXT: - // Set the string - text = (wchar_t *)lParam; - SetText(hWnd, (UINT)wParam, text); - break; - - case WM_VI_CANCEL: - // There was a cancellation from the thread side - ViInstallDlgOnClose(hWnd, d); - break; - - case WM_VI_DOWNLOAD_FINISHED: - // Download Complete - ViInstallProcessStart(hWnd, d); - break; - - case WM_COMMAND: - switch (wParam) - { - case IDCANCEL: - ViInstallDlgOnClose(hWnd, d); - break; - } - break; - - case WM_QUERYENDSESSION: - d->WindowsShutdowning = true; - break; - - case WM_CLOSE: - break; - } - - return 0; -} - -// Show the dialog -void ViInstallDlg() -{ - VI_INSTALL_DLG d; - - Zero(&d, sizeof(d)); - - d.BufSize = 65535; - d.Buf = Malloc(d.BufSize); - - Dialog(NULL, D_INSTALL, ViInstallDlgProc, &d); - - Free(d.Buf); -} - -// Read the inf file from the buffer -bool ViLoadInfFromBuf(VI_SETTING *set, BUF *buf) -{ - bool ret; - if (set == NULL || buf == NULL) - { - return false; - } - - Zero(set, sizeof(VI_SETTING)); - - SeekBuf(buf, 0, 0); - while (true) - { - char *tmp = CfgReadNextLine(buf); - TOKEN_LIST *tokens; - - if (tmp == NULL) - { - break; - } - - tokens = ParseToken(tmp, " \t"); - - if (tokens != NULL) - { - if (tokens->NumTokens >= 2) - { - if (StartWith(tokens->Token[0], "#") == false - || StartWith(tokens->Token[0], "//") == false) - { - char *name, *value; - name = tokens->Token[0]; - value = tokens->Token[1]; - - if (StrCmpi(name, "VpnInstallBuild") == 0) - { - set->VpnInstallBuild = ToInt(value); - } - else if (StrCmpi(name, "NormalMode") == 0) - { - set->NormalMode = ToBool(value); - } - else if (StrCmpi(name, "VpnSettingPath") == 0) - { - StrCpy(set->SettingPath, sizeof(set->SettingPath), value); - } - else if (StrCmpi(name, "VpnClientBuild") == 0) - { - set->x86.Build = ToInt(value); - } - else if (StrCmpi(name, "VpnClientPath") == 0) - { - StrCpy(set->x86.Path, sizeof(set->x86.Path), value); - } - } - } - FreeToken(tokens); - } - - Free(tmp); - } - - ret = false; - - StrCpy(set->x86.VpnCMgrExeFileName, sizeof(set->x86.VpnCMgrExeFileName), (MsIsX64() ? "vpncmgr_x64.exe" : "vpncmgr.exe")); - - if (set->VpnInstallBuild != 0) - { - if (set->x86.Build != 0 && IsEmptyStr(set->x86.Path) == false) - { - set->x86.Supported = true; - ret = true; - } - } - - return ret; -} - -// Read the inf file -bool ViLoadInf(VI_SETTING *set, char *filename) -{ - BUF *b; - bool ret = false; - // Validate arguments - if (set == NULL || filename == NULL) - { - return false; - } - - b = ReadDump(filename); - if (b == NULL) - { - return false; - } - - ret = ViLoadInfFromBuf(set, b); - - FreeBuf(b); - - return ret; -} - -// Get the product information from the Msi -bool ViMsiGetProductInfo(char *product_code, char *name, char *buf, UINT size) -{ - UINT ret; - char tmp[MAX_SIZE]; - DWORD sz; - // Validate arguments - if (product_code == NULL || name == NULL || buf == NULL) - { - return false; - } - - sz = sizeof(tmp); - - ret = MsiGetProductInfoA(product_code, name, tmp, &sz); - if (ret != ERROR_SUCCESS) - { - return false; - } - - StrCpy(buf, size, tmp); - - return true; -} - -// Extract the build number from the version string -UINT ViVersionStrToBuild(char *str) -{ - TOKEN_LIST *t; - UINT ret; - // Validate arguments - if (str == NULL) - { - return 0; - } - - t = ParseToken(str, "."); - if (t == NULL) - { - return 0; - } - - ret = 0; - - if (t->NumTokens == 3) - { - ret = ToInt(t->Token[2]); - } - - FreeToken(t); - - return ret; -} - -// Get the current installation state for the given architecture -void ViLoadCurrentInstalledStatusForArch(VI_SETTING_ARCH *a) -{ - char tmp[MAX_SIZE]; - UINT build; - wchar_t *dir; - // Validate arguments - if (a == NULL) - { - return; - } - if (a->Supported == false) - { - // Unsupported - return; - } - - // Read from the registry - Format(tmp, sizeof(tmp), "%s\\%s", SW_REG_KEY, "vpnclient"); - - build = MsRegReadIntEx2(REG_LOCAL_MACHINE, tmp, "InstalledBuild", false, true); - - dir = MsRegReadStrEx2W(REG_LOCAL_MACHINE, tmp, "InstalledDir", false, true); - - if (build == 0 || UniIsEmptyStr(dir)) - { - // Not installed - a->CurrentInstalled = false; - } - else - { - // Installed - a->CurrentInstalled = true; - a->CurrentInstalledBuild = build; - - UniStrCpy(a->CurrentInstalledPathW, sizeof(a->CurrentInstalledPathW), dir); - } - - Free(dir); -} - -// Get the best architecture for the current CPU -VI_SETTING_ARCH *ViGetSuitableArchForCpu() -{ - return &setting.x86; -} - -// Get the current installation state -void ViLoadCurrentInstalledStates() -{ - ViLoadCurrentInstalledStatusForArch(&setting.x86); -} - -// Main process -void ViMain() -{ - char tmp[MAX_PATH]; - UINT ostype = GetOsInfo()->OsType; - VI_SETTING_ARCH *suitable; - TOKEN_LIST *t; - UINT i; - - if (OS_IS_WINDOWS_NT(ostype) == false || - GET_KETA(ostype, 100) <= 1) - { - // The OS is too old - MsgBox(NULL, MB_ICONEXCLAMATION, _U(IDS_BAD_OS+skip)); - return; - } - - Zero(&setting, sizeof(setting)); - - // Read the inf file - Format(tmp, sizeof(tmp), "%s\\%s", MsGetExeDirName(), VI_INF_FILENAME); - if (ViLoadInf(&setting, tmp) == false) - { - // Failure - MsgBoxEx(NULL, MB_ICONSTOP, _U(IDS_INF_LOAD_FAILED+skip), VI_INF_FILENAME); - return; - } - - ViSetSkip(); - - // Parse the command line options - t = GetCommandLineToken(); - - for (i = 0;i < t->NumTokens;i++) - { - char *s = t->Token[i]; - - if (IsEmptyStr(s) == false) - { - if (StartWith(s, "/") || StartWith(s, "-")) - { - if (StrCmpi(&s[1], "web") == 0) - { - setting.WebMode = true; - } - } - else - { - StrCpy(setting.SettingPath, sizeof(setting.SettingPath), s); - } - } - } - - FreeToken(t); - - suitable = ViGetSuitableArchForCpu(); - - // Security check - if (setting.WebMode) - { - bool ok = true; - - if (ViIsInternetFile(suitable->Path) == false) - { - ok = false; - } - - if (IsEmptyStr(setting.SettingPath) == false) - { - if (ViIsInternetFile(setting.SettingPath) == false) - { - ok = false; - } - } - - if (ok == false) - { - // Security breach - MsgBox(NULL, MB_ICONEXCLAMATION, _U(IDS_SECURITY_ERROR+skip)); - return; - } - } - - // Get the current installation state - ViLoadCurrentInstalledStates(); - - if (suitable->Supported == false) - { - // This CPU isn't supported - MsgBox(NULL, MB_ICONEXCLAMATION, _U(IDS_CPU_NOT_SUPPORTED+skip)); - return; - } - - if (suitable->CurrentInstalled && suitable->Build <= suitable->CurrentInstalledBuild) - { - // Do not download client software since it has already been installed - setting.DownloadNotRequired = true; - } - - // Show the dialog - ViInstallDlg(); -} - -// Generate the temporary directory name for vpnsmgr -void ViGenerateVpnSMgrTempDirName(char *name, UINT size, UINT build) -{ - // Validate arguments - if (name == NULL) - { - return; - } - - Format(name, size, "%s\\px_" GC_SW_SOFTETHER_PREFIX "vpnsmgr_%u", MsGetTempDir(), build); -} - -// Compare the string resources -int ViCompareString(void *p1, void *p2) -{ - VI_STRING *s1, *s2; - if (p1 == NULL || p2 == NULL) - { - return 0; - } - - s1 = *(VI_STRING **)p1; - s2 = *(VI_STRING **)p2; - - if (s1 == NULL || s2 == NULL) - { - return 0; - } - - if (s1->Id > s2->Id) - { - return 1; - } - else if (s1->Id < s2->Id) - { - return -1; - } - return 0; -} - -// Reading a string resource -wchar_t *ViLoadString(HINSTANCE hInst, UINT id) -{ - wchar_t *ret = NULL; - - if (OS_IS_WINDOWS_9X(GetOsInfo()->OsType)) - { - char *a = ViLoadStringA(hInst, id); - if (a != NULL) - { - ret = CopyStrToUni(a); - Free(a); - } - } - else - { - UINT tmp_size = 60000; - wchar_t *tmp = Malloc(tmp_size); - - if (LoadStringW(hInst, id, tmp, tmp_size) != 0) - { - ret = CopyUniStr(tmp); - } - - Free(tmp); - } - - return ret; -} -char *ViLoadStringA(HINSTANCE hInst, UINT id) -{ - UINT tmp_size = 60000; - char *tmp = Malloc(tmp_size); - char *ret = NULL; - - if (LoadStringA(hInst, id, tmp, tmp_size) != 0) - { - ret = CopyStr(tmp); - } - - Free(tmp); - - return ret; -} - -// Acquisition of string -wchar_t *ViGetString(UINT id) -{ - VI_STRING t, *s; - wchar_t *ret = NULL; - - Zero(&t, sizeof(t)); - t.Id = id; - - LockList(string_table); - { - s = Search(string_table, &t); - - if (s != NULL) - { - ret = s->String; - } - } - UnlockList(string_table); - - return ret; -} -char *ViGetStringA(UINT id) -{ - VI_STRING t, *s; - char *ret = NULL; - - Zero(&t, sizeof(t)); - t.Id = id; - - LockList(string_table); - { - s = Search(string_table, &t); - - if (s != NULL) - { - ret = s->StringA; - } - } - UnlockList(string_table); - - return ret; -} - -// Calculate the difference between the the current language configuration and the base of the string table -void ViSetSkip() -{ - skip = 0; - - if (MsIsCurrentUserLocaleIdJapanese() == false) - { - skip = MESSAGE_OFFSET_EN - MESSAGE_OFFSET_JP; - } -} - -// Read the string table -void ViLoadStringTables() -{ - UINT i, n; - HINSTANCE hInst = GetModuleHandle(NULL); - - string_table = NewList(ViCompareString); - - n = 0; - for (i = 1;;i++) - { - wchar_t *str = ViLoadString(hInst, i); - if (str != NULL) - { - VI_STRING *s; - n = 0; - - s = ZeroMalloc(sizeof(VI_STRING)); - s->Id = i; - s->String = str; - s->StringA = CopyUniToStr(str); - - Insert(string_table, s); - } - else - { - n++; - if (n >= 1500) - { - break; - } - } - } -} - -// Release the string table -void ViFreeStringTables() -{ - UINT i; - if (string_table == NULL) - { - return; - } - - for (i = 0;i < LIST_NUM(string_table);i++) - { - VI_STRING *s = LIST_DATA(string_table, i); - - Free(s->String); - Free(s->StringA); - Free(s); - } - - ReleaseList(string_table); - string_table = NULL; -} - -// WinMain function -int PASCAL WinMain(HINSTANCE hInst, HINSTANCE hPrev, char *CmdLine, int CmdShow) -{ - INSTANCE *instance; - InitProcessCallOnce(); -#if defined(_DEBUG) || defined(DEBUG) // In VC++ compilers, the macro is "_DEBUG", not "DEBUG". - is_debug = true; -#else - is_debug = false; -#endif - MayaquaMinimalMode(); - // If set memcheck = true, the program will be vitally slow since it will log all malloc() / realloc() / free() calls to find the cause of memory leak. - // For normal debug we set memcheck = false. - // Please set memcheck = true if you want to test the cause of memory leaks. - InitMayaqua(false, is_debug, 0, NULL); - InitCedar(); - ViSetSkip(); - ViLoadStringTables(); - InitWinUi(_U(IDS_TITLE+skip), _A(IDS_FONT+skip), ToInt(_A(IDS_FONT_SIZE+skip))); - instance = NewSingleInstance(VI_INSTANCE_NAME); - if (instance == NULL) - { - MsgBox(NULL, MB_ICONINFORMATION, _U(IDS_INSTANCE_EXISTS+skip)); - } - else - { - ViMain(); - FreeSingleInstance(instance); - if (sleep_before_exit) - { - SleepThread(60 * 1000); - } - } - FreeWinUi(); - ViFreeStringTables(); - FreeCedar(); - FreeMayaqua(); - return 0; -} - - +// SoftEther VPN Source Code - Developer Edition Master Branch +// Cedar Communication Module + + +// vpninstall.c +// VPN Client Web Installer Bootstrap + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "vpninstall.h" +#include "resource.h" + +#pragma comment(lib, "wininet.lib") + +static bool is_debug = true; +static LIST *string_table = NULL; +static VI_SETTING setting; +static bool sleep_before_exit = false; +static int skip = 0; + +// Convert the URL to the file name +char *ViUrlToFileName(char *url) +{ + UINT i, len; + char *ret = url; + bool b = true; + len = lstrlen(url); + + for (i = 0;i < len;i++) + { + char c = url[i]; + + if (c == '?' || c == '#') + { + b = false; + } + + if (b) + { + if (c == '/' || c == '\\') + { + if (lstrlen(url + i + 1) > 1) + { + ret = url + i + 1; + } + } + } + } + + return ret; +} + +// Check the signature of the EXE file, and displays a warning if dangerous +bool ViCheckExeSign(HWND hWnd, wchar_t *exew) +{ + wchar_t tmp[2048]; + bool danger = true; + wchar_t *warningMessage = _U(IDS_SIGN_WARNING+skip); + wchar_t *warningMessageTitle = _U(IDS_SIGN_WARNING_TITLE+skip); + // Validate arguments + if (hWnd == NULL || exew == NULL) + { + return false; + } + + if (MsCheckFileDigitalSignatureW(hWnd, exew, &danger)) + { + if (danger == false) + { + // Safe + return true; + } + else + { + wchar_t filename[MAX_PATH]; + + GetFileNameFromFilePathW(filename, sizeof(filename), exew); + + // Show the message because there is potentially dangerous + swprintf(tmp, sizeof(tmp) / 2, warningMessage, + filename, filename, filename); + + if (MessageBoxW(hWnd, tmp, warningMessageTitle, + MB_OKCANCEL | MB_DEFBUTTON2 | MB_ICONEXCLAMATION) == IDOK) + { + return true; + } + + return false; + } + } + else + { + // Danger + return false; + } +} + +// Start the installation process +void ViInstallProcessStart(HWND hWnd, VI_INSTALL_DLG *d) +{ + wchar_t *exew; + bool ok; + char instdir[MAX_PATH]; + char hamcore[MAX_PATH]; + // Validate arguments + if (hWnd == NULL || d == NULL) + { + return; + } + + ViGenerateVpnSMgrTempDirName(instdir, sizeof(instdir), ViGetSuitableArchForCpu()->Build); + ConbinePath(hamcore, sizeof(hamcore), instdir, "hamcore.se2"); + + exew = setting.DownloadedInstallerPathW; + d->NoClose = true; + + Hide(hWnd, IDCANCEL); + SetPos(hWnd, P_PROGRESS, 100); + Hide(hWnd, P_PROGRESS); + Hide(hWnd, S_SIZEINFO); + SetText(hWnd, S_STATUS, _U(IDS_INSTALLSTART+skip)); + + ok = true; + + if (setting.DownloadNotRequired == false) + { + if (setting.WebMode && ViCheckExeSign(hWnd, exew) == false) + { + // The digital signature is not reliable + ok = false; + } + else + { + // Installation + HANDLE hProcess; + SHELLEXECUTEINFOW info; + + // Run + Zero(&info, sizeof(info)); + info.cbSize = sizeof(info); + info.lpVerb = L"open"; + info.lpFile = exew; + info.fMask = SEE_MASK_NOCLOSEPROCESS; + info.lpParameters = L"/HIDESTARTCOMMAND:1 /DISABLEAUTOIMPORT:1 /ISWEBINSTALLER:1"; + info.nShow = SW_SHOWNORMAL; + if (ShellExecuteExW(&info) == false) + { + MsgBox(hWnd, MB_ICONSTOP, _U(IDS_INSTALLSTART_ERROR+skip)); + ok = false; + } + else + { + hProcess = info.hProcess; + + // Wait for the install process to complete + while (true) + { + if (WaitForSingleObject(hProcess, 50) != WAIT_TIMEOUT) + { + break; + } + + DoEvents(hWnd); + } + CloseHandle(hProcess); + } + } + } + + if (ok && d->WindowsShutdowning == false) + { + VI_SETTING_ARCH *a = ViGetSuitableArchForCpu(); + wchar_t arg[MAX_PATH]; + wchar_t exe[MAX_PATH]; + char *arg1 = "/easy"; + // Hide the screen + Hide(hWnd, 0); + + if (setting.NormalMode) + { + arg1 = "/normal"; + } + + // (Just in case) start the VPN Client service + if (MsIsServiceRunning("vpnclient") == false) + { + MsStartService("vpnclient"); + } + + // Wait for that the service becomes available + SwWaitForVpnClientPortReady(0); + + if (UniIsEmptyStr(setting.DownloadedSettingPathW) == false) + { + // Start a connection by importing the configuration file into the VPN Client + UniFormat(arg, sizeof(arg), L"%S \"%s\"", arg1, setting.DownloadedSettingPathW); + } + else + { + // Just start the Connection Manager + UniFormat(arg, sizeof(arg), L"%S", arg1); + } + + // Get the installation state + ViLoadCurrentInstalledStatusForArch(a); + + if (a->CurrentInstalled) + { + HANDLE h; + wchar_t filename[MAX_PATH]; + + StrToUni(filename, sizeof(filename), a->VpnCMgrExeFileName); + + ConbinePathW(exe, sizeof(exe), a->CurrentInstalledPathW, filename); + + // Start the Connection Manager + h = MsRunAsUserExW(exe, arg, false); + if (h != NULL) + { + if (UniIsEmptyStr(setting.DownloadedSettingPathW) == false) + { + sleep_before_exit = true; + } + + CloseHandle(h); + } + } + } + + d->NoClose = false; + Close(hWnd); +} + +// End User License Agreement dialog +UINT ViEulaDlgProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param) +{ + wchar_t *text = (wchar_t *)param; + // Validate arguments + if (hWnd == NULL) + { + return 0; + } + + switch (msg) + { + case WM_INITDIALOG: + SetText(hWnd, 0, _U(IDS_DLG_TITLE+skip)); + SetText(hWnd, S_EULA_NOTICE1, _U(IDS_EULA_NOTICE1+skip)); + SetText(hWnd, S_BOLD, _U(IDS_EULA_NOTICE2+skip)); + SetText(hWnd, S_EULA_NOTICE3, _U(IDS_EULA_NOTICE3+skip)); + SetText(hWnd, IDOK, _U(IDS_EULA_AGREE+skip)); + SetText(hWnd, IDCANCEL, _U(IDS_EULA_DISAGREE+skip)); + + DlgFont(hWnd, S_BOLD, 0, true); + SetText(hWnd, E_EULA, text); + Focus(hWnd, E_EULA); + SendMsg(hWnd, E_EULA, EM_SETSEL, 0, 0); + Center(hWnd); + break; + + case WM_COMMAND: + switch (wParam) + { + case IDOK: + EndDialog(hWnd, 1); + break; + + case IDCANCEL: + Close(hWnd); + break; + } + break; + + case WM_CLOSE: + EndDialog(hWnd, 0); + break; + } + + return 0; +} + +// Display the End User License Agreement +bool ViEulaDlg(HWND hWnd, wchar_t *text) +{ + // Validate arguments + if (text == NULL) + { + return false; + } + + if (Dialog(hWnd, D_EULA, ViEulaDlgProc, text) == 0) + { + return false; + } + + return true; +} + +// Extract the license agreement from the EXE file +wchar_t *ViExtractEula(char *exe) +{ + BUF *b; + UINT tmp_size; + char *tmp; + wchar_t *ret; + // Validate arguments + if (exe == NULL) + { + return false; + } + + b = ViExtractResource(exe, RT_RCDATA, "LICENSE"); + if (b == NULL) + { + return NULL; + } + + tmp_size = b->Size + 1; + tmp = ZeroMalloc(tmp_size); + + Copy(tmp, b->Buf, b->Size); + FreeBuf(b); + + ret = CopyStrToUni(tmp); + Free(tmp); + + return ret; +} + +// Extract the Cabinet file from the EXE file +bool ViExtractCabinetFile(char *exe, char *cab) +{ + BUF *b; + // Validate arguments + if (exe == NULL || cab == NULL) + { + return false; + } + + b = ViExtractResource(exe, RT_RCDATA, "CABINET"); + if (b == NULL) + { + return false; + } + + if (DumpBuf(b, cab) == false) + { + FreeBuf(b); + + return false; + } + + FreeBuf(b); + + return true; +} + +// Extract the resource from the EXE file +BUF *ViExtractResource(char *exe, char *type, char *name) +{ + HINSTANCE h; + HRSRC hr; + HGLOBAL hg; + UINT size; + void *data; + BUF *buf; + // Validate arguments + if (exe == NULL || type == NULL || name == NULL) + { + return NULL; + } + + h = LoadLibraryExA(exe, NULL, LOAD_LIBRARY_AS_DATAFILE); + if (h == NULL) + { + return NULL; + } + + hr = FindResourceA(h, name, type); + if (hr == NULL) + { + FreeLibrary(h); + return NULL; + } + + hg = LoadResource(h, hr); + if (hg == NULL) + { + FreeLibrary(h); + return NULL; + } + + size = SizeofResource(h, hr); + data = (void *)LockResource(hg); + + buf = NewBuf(); + WriteBuf(buf, data, size); + + FreeResource(hg); + FreeLibrary(h); + + SeekBuf(buf, 0, 0); + + return buf; +} + +// Open the file +VI_FILE *ViOpenFile(char *path) +{ + VI_FILE *f; + // Validate arguments + if (path == NULL) + { + return NULL; + } + + if (ViIsInternetFile(path)) + { + HINTERNET hHttpFile; + HINTERNET hInternet = InternetOpenA(DEFAULT_USER_AGENT, + INTERNET_OPEN_TYPE_PRECONFIG, + NULL, NULL, 0); + UINT size; + UINT sizesize; + + if (hInternet == NULL) + { + return NULL; + } + + hHttpFile = InternetOpenUrlA(hInternet, path, NULL, 0, + INTERNET_FLAG_NO_CACHE_WRITE | INTERNET_FLAG_RELOAD, 0); + + if (hHttpFile == NULL) + { + InternetCloseHandle(hInternet); + return NULL; + } + + size = 0; + sizesize = sizeof(size); + + if (StartWith(path, "ftp://")) + { + // ftp + DWORD high = 0; + + size = FtpGetFileSize(hHttpFile, &high); + } + else + { + UINT errorcode = 0; + UINT errorcode_size = sizeof(errorcode); + + // http + if (HttpQueryInfo(hHttpFile, HTTP_QUERY_CONTENT_LENGTH | HTTP_QUERY_FLAG_NUMBER, + &size, &sizesize, NULL) == false) + { + size = 0; + } + + if (HttpQueryInfo(hHttpFile, HTTP_QUERY_STATUS_CODE | HTTP_QUERY_FLAG_NUMBER, + &errorcode, &errorcode_size, NULL) == false || + (errorcode / 100) != 2) + { + // HTTP getting error + InternetCloseHandle(hInternet); + InternetCloseHandle(hHttpFile); + return NULL; + } + } + + f = ZeroMalloc(sizeof(VI_FILE)); + f->InternetFile = true; + f->hInternet = hInternet; + f->hHttpFile = hHttpFile; + f->FileSize = size; + + return f; + } + else + { + IO *io; + char fullpath[MAX_PATH]; + char exedir[MAX_PATH]; + + GetExeDir(exedir, sizeof(exedir)); + + ConbinePath(fullpath, sizeof(fullpath), exedir, path); + + io = FileOpen(fullpath, false); + if (io == NULL) + { + return NULL; + } + + f = ZeroMalloc(sizeof(VI_FILE)); + f->InternetFile = false; + f->FileSize = FileSize(io); + f->io = io; + + return f; + } +} + +// Get the file size +UINT ViGetFileSize(VI_FILE *f) +{ + // Validate arguments + if (f == NULL) + { + return 0; + } + + return f->FileSize; +} + +// Read from the file +UINT ViReadFile(VI_FILE *f, void *buf, UINT size) +{ + // Validate arguments + if (f == NULL || buf == NULL) + { + return INFINITE; + } + + if (f->InternetFile == false) + { + UINT readsize = MIN(size, f->FileSize - f->IoReadFileSize); + bool ret; + + if (readsize == 0) + { + return 0; + } + + ret = FileRead(f->io, buf, readsize); + + if (ret == false) + { + return INFINITE; + } + + f->IoReadFileSize += readsize; + + return readsize; + } + else + { + UINT readsize = 0; + + if (InternetReadFile(f->hHttpFile, buf, size, &readsize) == false) + { + return INFINITE; + } + + return readsize; + } +} + +// Close the file +void ViCloseFile(VI_FILE *f) +{ + // Validate arguments + if (f == NULL) + { + return; + } + + if (f->InternetFile == false) + { + FileClose(f->io); + } + else + { + InternetCloseHandle(f->hHttpFile); + InternetCloseHandle(f->hInternet); + } + + Free(f); +} + +// Determine whether the specified file name is the file on the Internet +bool ViIsInternetFile(char *path) +{ + // Validate arguments + if (path == NULL) + { + return false; + } + + if (StartWith(path, "http://") || StartWith(path, "https://") || StartWith(path, "ftp://")) + { + return true; + } + + return false; +} + +// Installer dialog initialization +void ViInstallDlgOnInit(HWND hWnd, VI_INSTALL_DLG *d) +{ + // Validate arguments + if (hWnd == NULL || d == NULL) + { + return; + } + + d->hWnd = hWnd; + + SetIcon(hWnd, 0, IDI_MAIN); + + SetText(hWnd, 0, _U(IDS_DLG_TITLE+skip)); + SetText(hWnd, S_TITLE, _U(IDS_DLG_TITLE+skip)); + + SetText(hWnd, S_STATUS, _U(IDS_INSTALL_DLG__STATUS_INIT+skip)); + SetText(hWnd, IDCANCEL, _U(IDS_INSTALL_CANCEL+skip)); + + DlgFont(hWnd, S_TITLE+skip, 12, true); + SetRange(hWnd, P_PROGRESS, 0, 100); + SetPos(hWnd, P_PROGRESS, 0); + + SetTimer(hWnd, 1, 22, NULL); +} + +// Start the download thread +void ViDownloadThreadStart(VI_INSTALL_DLG *d) +{ + // Validate arguments + if (d == NULL) + { + return; + } + + d->DownloadStarted = true; + d->DownloadThread = NewThread(ViDownloadThread, d); +} + + +// Stop the download thread +void ViDownloadThreadStop(VI_INSTALL_DLG *d) +{ + // Validate arguments + if (d == NULL) + { + return; + } + + if (d->DownloadStarted == false) + { + return; + } + + d->DownloadStarted = false; + d->Halt = true; + + while (true) + { + if (WaitThread(d->DownloadThread, 50)) + { + break; + } + + DoEvents(NULL); + } + + ReleaseThread(d->DownloadThread); +} + +// Download thread +void ViDownloadThread(THREAD *thread, void *param) +{ + VI_INSTALL_DLG *d; + VI_SETTING_ARCH *a; + HWND hWnd; + UINT num_files = 2; + VI_DOWNLOAD_FILE files[2]; + VI_DOWNLOAD_FILE *f; + UINT i; + // Validate arguments + if (thread == NULL || param == NULL) + { + return; + } + + d = (VI_INSTALL_DLG *)param; + hWnd = d->hWnd; + + Zero(files, sizeof(files)); + + a = ViGetSuitableArchForCpu(); + + // File body + f = &files[0]; + StrCpy(f->SrcPath, sizeof(f->SrcPath), a->Path); + + // Configuration file + if (IsEmptyStr(setting.SettingPath) == false) + { + f = &files[1]; + StrCpy(f->SrcPath, sizeof(f->SrcPath), setting.SettingPath); + } + else + { + // No configuration file + num_files = 1; + } + + for (i = 0;i < num_files;i++) + { + bool b = true; + + if (i == 0 && setting.DownloadNotRequired) + { + b = false; + } + + if (b) + { + wchar_t tmp[MAX_SIZE]; + IO *dest = NULL; + VI_FILE *down; + UINT ret; + UINT totalsize; + UINT currentsize; + wchar_t filename_w[MAX_PATH]; + + f = &files[i]; + GetFileNameFromFilePath(f->FileName, sizeof(f->FileName), f->SrcPath); + MakeSafeFileName(f->FileName, sizeof(f->FileName), f->FileName); + + StrToUni(filename_w, sizeof(filename_w), f->FileName); + ConbinePathW(f->DestPathW, sizeof(f->DestPathW), MsGetMyTempDirW(), filename_w); + + ViInstallDlgSetPos(hWnd, 0); + UniFormat(tmp, sizeof(tmp), _U(IDS_DOWNLOADSTART+skip), f->FileName); + ViInstallDlgSetText(d, hWnd, S_STATUS, tmp); + + down = ViOpenFile(f->SrcPath); + if (down == NULL) + { + MsgBoxEx(hWnd, MB_ICONSTOP, _U(IDS_DOWNLOAD_ERROR+skip), f->FileName); + + ViInstallDlgCancel(hWnd); + return; + } + + dest = FileCreateW(f->DestPathW); + if (dest == NULL) + { + MsgBoxEx(hWnd, MB_ICONSTOP, _U(IDS_TEMP_ERROR+skip), f->DestPathW); + + ViCloseFile(down); + ViInstallDlgCancel(hWnd); + return; + } + + totalsize = ViGetFileSize(down); + currentsize = 0; + + UniFormat(tmp, sizeof(tmp), _U(IDS_DOWNLOADING3+skip), f->FileName); + ViInstallDlgSetText(d, hWnd, S_STATUS, tmp); + + while (true) + { + UINT pos = 0; + + if (d->Halt) + { + // User cancel + FileClose(dest); + ViCloseFile(down); + return; + } + + UniFormat(tmp, sizeof(tmp), _U(IDS_DOWNLOADING3+skip), f->FileName); + + ViInstallDlgSetText(d, hWnd, IDS_DOWNLOADING3+skip, tmp); + ret = ViReadFile(down, d->Buf, d->BufSize); + + if (ret == INFINITE) + { + // Communication error + MsgBoxEx(hWnd, MB_ICONSTOP, _U(IDS_DOWNLOAD_ERROR+skip), f->FileName); + + FileClose(dest); + ViCloseFile(down); + ViInstallDlgCancel(hWnd); + + return; + } + + // Draw progress + currentsize += ret; + + if (totalsize != 0) + { + UniFormat(tmp, sizeof(tmp), _U(IDS_DOWNLOADING+skip), + ((float)totalsize) / 1024.0f / 1024.0f, + ((float)currentsize) / 1024.0f / 1024.0f); + + pos = (UINT)(((float)currentsize) * 100.0f / ((float)totalsize)); + } + else + { + UniFormat(tmp, sizeof(tmp), _U(IDS_DOWNLOADING2+skip), + ((float)currentsize) / 1024.0f / 1024.0f); + pos = (UINT)(((float)currentsize) * 100.0f / (1024.0f * 1024.0f * 10.0f)); + } + + ViInstallDlgSetText(d, hWnd, S_SIZEINFO, tmp); + ViInstallDlgSetPos(hWnd, pos); + + if (ret == 0) + { + // Download Complete + break; + } + else + { + FileWrite(dest, d->Buf, ret); + } + } + + ViCloseFile(down); + FileClose(dest); + } + } + + UniStrCpy(setting.DownloadedInstallerPathW, sizeof(setting.DownloadedInstallerPathW), + files[0].DestPathW); + + if (num_files >= 2) + { + UniStrCpy(setting.DownloadedSettingPathW, sizeof(setting.DownloadedSettingPathW), + files[1].DestPathW); + } + + PostMessageA(hWnd, WM_VI_DOWNLOAD_FINISHED, 0, 0); +} + +// Operation of the progress bar +void ViInstallDlgSetPos(HWND hWnd, UINT pos) +{ + PostMessage(hWnd, WM_VI_SETPOS, 0, pos); +} + +// Set the text +void ViInstallDlgSetText(VI_INSTALL_DLG *d, HWND hWnd, UINT id, wchar_t *text) +{ + DWORD value = 0; + // Validate arguments + if (d == NULL) + { + return; + } + + if (d->Halt) + { + return; + } + + SendMessageTimeout(hWnd, WM_VI_SETTEXT, id, (LPARAM)text, SMTO_BLOCK, 200, &value); +} + +// Cancel +void ViInstallDlgCancel(HWND hWnd) +{ + PostMessageA(hWnd, WM_VI_CANCEL, 0, 0); +} + +// Installer operation start +void ViInstallDlgOnStart(HWND hWnd, VI_INSTALL_DLG *d) +{ + // Validate arguments + if (hWnd == NULL || d == NULL) + { + return; + } + + // Start the download thread + ViDownloadThreadStart(d); +} + +// Cancel the installation +void ViInstallDlgOnClose(HWND hWnd, VI_INSTALL_DLG *d) +{ + // Validate arguments + if (hWnd == NULL || d == NULL) + { + return; + } + + if (d->DialogCanceling) + { + return; + } + if (d->NoClose) + { + return; + } + + d->DialogCanceling = true; + + // Disable the cancel button + Disable(hWnd, IDCANCEL); + + // Stop the download thread if it runs + ViDownloadThreadStop(d); + + // Exit the dialog + EndDialog(hWnd, 0); +} + +// Installer procedure +UINT ViInstallDlgProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param) +{ + VI_INSTALL_DLG *d = (VI_INSTALL_DLG *)param; + UINT pos; + wchar_t *text; + // Validate arguments + if (hWnd == NULL) + { + return 0; + } + + switch (msg) + { + case WM_INITDIALOG: + ViInstallDlgOnInit(hWnd, param); + break; + + case WM_TIMER: + switch (wParam) + { + case 1: + KillTimer(hWnd, 1); + ViInstallDlgOnStart(hWnd, d); + break; + } + break; + + case WM_VI_SETPOS: + // Setting the progress bar + pos = (UINT)lParam; + SetPos(hWnd, P_PROGRESS, MAKESURE(pos, 0, 100)); + break; + + case WM_VI_SETTEXT: + // Set the string + text = (wchar_t *)lParam; + SetText(hWnd, (UINT)wParam, text); + break; + + case WM_VI_CANCEL: + // There was a cancellation from the thread side + ViInstallDlgOnClose(hWnd, d); + break; + + case WM_VI_DOWNLOAD_FINISHED: + // Download Complete + ViInstallProcessStart(hWnd, d); + break; + + case WM_COMMAND: + switch (wParam) + { + case IDCANCEL: + ViInstallDlgOnClose(hWnd, d); + break; + } + break; + + case WM_QUERYENDSESSION: + d->WindowsShutdowning = true; + break; + + case WM_CLOSE: + break; + } + + return 0; +} + +// Show the dialog +void ViInstallDlg() +{ + VI_INSTALL_DLG d; + + Zero(&d, sizeof(d)); + + d.BufSize = 65535; + d.Buf = Malloc(d.BufSize); + + Dialog(NULL, D_INSTALL, ViInstallDlgProc, &d); + + Free(d.Buf); +} + +// Read the inf file from the buffer +bool ViLoadInfFromBuf(VI_SETTING *set, BUF *buf) +{ + bool ret; + if (set == NULL || buf == NULL) + { + return false; + } + + Zero(set, sizeof(VI_SETTING)); + + SeekBuf(buf, 0, 0); + while (true) + { + char *tmp = CfgReadNextLine(buf); + TOKEN_LIST *tokens; + + if (tmp == NULL) + { + break; + } + + tokens = ParseToken(tmp, " \t"); + + if (tokens != NULL) + { + if (tokens->NumTokens >= 2) + { + if (StartWith(tokens->Token[0], "#") == false + || StartWith(tokens->Token[0], "//") == false) + { + char *name, *value; + name = tokens->Token[0]; + value = tokens->Token[1]; + + if (StrCmpi(name, "VpnInstallBuild") == 0) + { + set->VpnInstallBuild = ToInt(value); + } + else if (StrCmpi(name, "NormalMode") == 0) + { + set->NormalMode = ToBool(value); + } + else if (StrCmpi(name, "VpnSettingPath") == 0) + { + StrCpy(set->SettingPath, sizeof(set->SettingPath), value); + } + else if (StrCmpi(name, "VpnClientBuild") == 0) + { + set->x86.Build = ToInt(value); + } + else if (StrCmpi(name, "VpnClientPath") == 0) + { + StrCpy(set->x86.Path, sizeof(set->x86.Path), value); + } + } + } + FreeToken(tokens); + } + + Free(tmp); + } + + ret = false; + + StrCpy(set->x86.VpnCMgrExeFileName, sizeof(set->x86.VpnCMgrExeFileName), (MsIsX64() ? "vpncmgr_x64.exe" : "vpncmgr.exe")); + + if (set->VpnInstallBuild != 0) + { + if (set->x86.Build != 0 && IsEmptyStr(set->x86.Path) == false) + { + set->x86.Supported = true; + ret = true; + } + } + + return ret; +} + +// Read the inf file +bool ViLoadInf(VI_SETTING *set, char *filename) +{ + BUF *b; + bool ret = false; + // Validate arguments + if (set == NULL || filename == NULL) + { + return false; + } + + b = ReadDump(filename); + if (b == NULL) + { + return false; + } + + ret = ViLoadInfFromBuf(set, b); + + FreeBuf(b); + + return ret; +} + +// Get the product information from the Msi +bool ViMsiGetProductInfo(char *product_code, char *name, char *buf, UINT size) +{ + UINT ret; + char tmp[MAX_SIZE]; + DWORD sz; + // Validate arguments + if (product_code == NULL || name == NULL || buf == NULL) + { + return false; + } + + sz = sizeof(tmp); + + ret = MsiGetProductInfoA(product_code, name, tmp, &sz); + if (ret != ERROR_SUCCESS) + { + return false; + } + + StrCpy(buf, size, tmp); + + return true; +} + +// Extract the build number from the version string +UINT ViVersionStrToBuild(char *str) +{ + TOKEN_LIST *t; + UINT ret; + // Validate arguments + if (str == NULL) + { + return 0; + } + + t = ParseToken(str, "."); + if (t == NULL) + { + return 0; + } + + ret = 0; + + if (t->NumTokens == 3) + { + ret = ToInt(t->Token[2]); + } + + FreeToken(t); + + return ret; +} + +// Get the current installation state for the given architecture +void ViLoadCurrentInstalledStatusForArch(VI_SETTING_ARCH *a) +{ + char tmp[MAX_SIZE]; + UINT build; + wchar_t *dir; + // Validate arguments + if (a == NULL) + { + return; + } + if (a->Supported == false) + { + // Unsupported + return; + } + + // Read from the registry + Format(tmp, sizeof(tmp), "%s\\%s", SW_REG_KEY, "vpnclient"); + + build = MsRegReadIntEx2(REG_LOCAL_MACHINE, tmp, "InstalledBuild", false, true); + + dir = MsRegReadStrEx2W(REG_LOCAL_MACHINE, tmp, "InstalledDir", false, true); + + if (build == 0 || UniIsEmptyStr(dir)) + { + // Not installed + a->CurrentInstalled = false; + } + else + { + // Installed + a->CurrentInstalled = true; + a->CurrentInstalledBuild = build; + + UniStrCpy(a->CurrentInstalledPathW, sizeof(a->CurrentInstalledPathW), dir); + } + + Free(dir); +} + +// Get the best architecture for the current CPU +VI_SETTING_ARCH *ViGetSuitableArchForCpu() +{ + return &setting.x86; +} + +// Get the current installation state +void ViLoadCurrentInstalledStates() +{ + ViLoadCurrentInstalledStatusForArch(&setting.x86); +} + +// Main process +void ViMain() +{ + char tmp[MAX_PATH]; + UINT ostype = GetOsInfo()->OsType; + VI_SETTING_ARCH *suitable; + TOKEN_LIST *t; + UINT i; + + if (OS_IS_WINDOWS_NT(ostype) == false || + GET_KETA(ostype, 100) <= 1) + { + // The OS is too old + MsgBox(NULL, MB_ICONEXCLAMATION, _U(IDS_BAD_OS+skip)); + return; + } + + Zero(&setting, sizeof(setting)); + + // Read the inf file + Format(tmp, sizeof(tmp), "%s\\%s", MsGetExeDirName(), VI_INF_FILENAME); + if (ViLoadInf(&setting, tmp) == false) + { + // Failure + MsgBoxEx(NULL, MB_ICONSTOP, _U(IDS_INF_LOAD_FAILED+skip), VI_INF_FILENAME); + return; + } + + ViSetSkip(); + + // Parse the command line options + t = GetCommandLineToken(); + + for (i = 0;i < t->NumTokens;i++) + { + char *s = t->Token[i]; + + if (IsEmptyStr(s) == false) + { + if (StartWith(s, "/") || StartWith(s, "-")) + { + if (StrCmpi(&s[1], "web") == 0) + { + setting.WebMode = true; + } + } + else + { + StrCpy(setting.SettingPath, sizeof(setting.SettingPath), s); + } + } + } + + FreeToken(t); + + suitable = ViGetSuitableArchForCpu(); + + // Security check + if (setting.WebMode) + { + bool ok = true; + + if (ViIsInternetFile(suitable->Path) == false) + { + ok = false; + } + + if (IsEmptyStr(setting.SettingPath) == false) + { + if (ViIsInternetFile(setting.SettingPath) == false) + { + ok = false; + } + } + + if (ok == false) + { + // Security breach + MsgBox(NULL, MB_ICONEXCLAMATION, _U(IDS_SECURITY_ERROR+skip)); + return; + } + } + + // Get the current installation state + ViLoadCurrentInstalledStates(); + + if (suitable->Supported == false) + { + // This CPU isn't supported + MsgBox(NULL, MB_ICONEXCLAMATION, _U(IDS_CPU_NOT_SUPPORTED+skip)); + return; + } + + if (suitable->CurrentInstalled && suitable->Build <= suitable->CurrentInstalledBuild) + { + // Do not download client software since it has already been installed + setting.DownloadNotRequired = true; + } + + // Show the dialog + ViInstallDlg(); +} + +// Generate the temporary directory name for vpnsmgr +void ViGenerateVpnSMgrTempDirName(char *name, UINT size, UINT build) +{ + // Validate arguments + if (name == NULL) + { + return; + } + + Format(name, size, "%s\\px_" GC_SW_SOFTETHER_PREFIX "vpnsmgr_%u", MsGetTempDir(), build); +} + +// Compare the string resources +int ViCompareString(void *p1, void *p2) +{ + VI_STRING *s1, *s2; + if (p1 == NULL || p2 == NULL) + { + return 0; + } + + s1 = *(VI_STRING **)p1; + s2 = *(VI_STRING **)p2; + + if (s1 == NULL || s2 == NULL) + { + return 0; + } + + if (s1->Id > s2->Id) + { + return 1; + } + else if (s1->Id < s2->Id) + { + return -1; + } + return 0; +} + +// Reading a string resource +wchar_t *ViLoadString(HINSTANCE hInst, UINT id) +{ + wchar_t *ret = NULL; + + if (OS_IS_WINDOWS_9X(GetOsInfo()->OsType)) + { + char *a = ViLoadStringA(hInst, id); + if (a != NULL) + { + ret = CopyStrToUni(a); + Free(a); + } + } + else + { + UINT tmp_size = 60000; + wchar_t *tmp = Malloc(tmp_size); + + if (LoadStringW(hInst, id, tmp, tmp_size) != 0) + { + ret = CopyUniStr(tmp); + } + + Free(tmp); + } + + return ret; +} +char *ViLoadStringA(HINSTANCE hInst, UINT id) +{ + UINT tmp_size = 60000; + char *tmp = Malloc(tmp_size); + char *ret = NULL; + + if (LoadStringA(hInst, id, tmp, tmp_size) != 0) + { + ret = CopyStr(tmp); + } + + Free(tmp); + + return ret; +} + +// Acquisition of string +wchar_t *ViGetString(UINT id) +{ + VI_STRING t, *s; + wchar_t *ret = NULL; + + Zero(&t, sizeof(t)); + t.Id = id; + + LockList(string_table); + { + s = Search(string_table, &t); + + if (s != NULL) + { + ret = s->String; + } + } + UnlockList(string_table); + + return ret; +} +char *ViGetStringA(UINT id) +{ + VI_STRING t, *s; + char *ret = NULL; + + Zero(&t, sizeof(t)); + t.Id = id; + + LockList(string_table); + { + s = Search(string_table, &t); + + if (s != NULL) + { + ret = s->StringA; + } + } + UnlockList(string_table); + + return ret; +} + +// Calculate the difference between the the current language configuration and the base of the string table +void ViSetSkip() +{ + skip = 0; + + if (MsIsCurrentUserLocaleIdJapanese() == false) + { + skip = MESSAGE_OFFSET_EN - MESSAGE_OFFSET_JP; + } +} + +// Read the string table +void ViLoadStringTables() +{ + UINT i, n; + HINSTANCE hInst = GetModuleHandle(NULL); + + string_table = NewList(ViCompareString); + + n = 0; + for (i = 1;;i++) + { + wchar_t *str = ViLoadString(hInst, i); + if (str != NULL) + { + VI_STRING *s; + n = 0; + + s = ZeroMalloc(sizeof(VI_STRING)); + s->Id = i; + s->String = str; + s->StringA = CopyUniToStr(str); + + Insert(string_table, s); + } + else + { + n++; + if (n >= 1500) + { + break; + } + } + } +} + +// Release the string table +void ViFreeStringTables() +{ + UINT i; + if (string_table == NULL) + { + return; + } + + for (i = 0;i < LIST_NUM(string_table);i++) + { + VI_STRING *s = LIST_DATA(string_table, i); + + Free(s->String); + Free(s->StringA); + Free(s); + } + + ReleaseList(string_table); + string_table = NULL; +} + +// WinMain function +int PASCAL WinMain(HINSTANCE hInst, HINSTANCE hPrev, char *CmdLine, int CmdShow) +{ + INSTANCE *instance; + InitProcessCallOnce(); +#if defined(_DEBUG) || defined(DEBUG) // In VC++ compilers, the macro is "_DEBUG", not "DEBUG". + is_debug = true; +#else + is_debug = false; +#endif + MayaquaMinimalMode(); + // If set memcheck = true, the program will be vitally slow since it will log all malloc() / realloc() / free() calls to find the cause of memory leak. + // For normal debug we set memcheck = false. + // Please set memcheck = true if you want to test the cause of memory leaks. + InitMayaqua(false, is_debug, 0, NULL); + InitCedar(); + ViSetSkip(); + ViLoadStringTables(); + InitWinUi(_U(IDS_TITLE+skip), _A(IDS_FONT+skip), ToInt(_A(IDS_FONT_SIZE+skip))); + instance = NewSingleInstance(VI_INSTANCE_NAME); + if (instance == NULL) + { + MsgBox(NULL, MB_ICONINFORMATION, _U(IDS_INSTANCE_EXISTS+skip)); + } + else + { + ViMain(); + FreeSingleInstance(instance); + if (sleep_before_exit) + { + SleepThread(60 * 1000); + } + } + FreeWinUi(); + ViFreeStringTables(); + FreeCedar(); + FreeMayaqua(); + return 0; +} + + diff --git a/src/vpninstall/vpninstall.h b/src/vpninstall/vpninstall.h index b822b106..749fcb16 100644 --- a/src/vpninstall/vpninstall.h +++ b/src/vpninstall/vpninstall.h @@ -1,132 +1,132 @@ -// SoftEther VPN Source Code - Developer Edition Master Branch -// Cedar Communication Module - - -// vpninstall.h -// Header of vpninstall.c - -#ifndef VPNINSTALL_H -#define VPNINSTALL_H - -// Constants -#define VI_INF_FILENAME "vpninstall.inf" -#define VI_INSTANCE_NAME "VpnAutoInstaller" -#define WM_VI_SETPOS (WM_APP + 41) -#define WM_VI_SETTEXT (WM_APP + 42) -#define WM_VI_CANCEL (WM_APP + 43) -#define WM_VI_DOWNLOAD_FINISHED (WM_APP + 44) -#define MESSAGE_OFFSET_JP IDS_TITLE -#define MESSAGE_OFFSET_EN IDS_TITLE_EN - -// Macro -#define _U(id) (ViGetString(id)) -#define _A(id) (ViGetStringA(id)) - - -// Type declaration -typedef struct VI_STRING -{ - UINT Id; - wchar_t *String; - char *StringA; -} VI_STRING; - -typedef struct VI_SETTING_ARCH -{ - bool Supported; - UINT Build; - char Path[MAX_SIZE]; - char VpnCMgrExeFileName[MAX_PATH]; - bool CurrentInstalled; - wchar_t CurrentInstalledPathW[MAX_PATH]; - UINT CurrentInstalledBuild; -} VI_SETTING_ARCH; - -typedef struct VI_SETTING -{ - UINT VpnInstallBuild; - VI_SETTING_ARCH x86; - char SettingPath[MAX_SIZE]; - wchar_t DownloadedSettingPathW[MAX_PATH]; - wchar_t DownloadedInstallerPathW[MAX_PATH]; - bool DownloadNotRequired; - bool WebMode; - bool NormalMode; -} VI_SETTING; - -typedef struct VI_INSTALL_DLG -{ - HWND hWnd; - bool DownloadStarted; - THREAD *DownloadThread; - bool DialogCanceling; - UINT BufSize; - void *Buf; - bool Halt; - bool NoClose; - bool WindowsShutdowning; -} VI_INSTALL_DLG; - -typedef struct VI_FILE -{ - bool InternetFile; - UINT FileSize; - HINTERNET hInternet; - HINTERNET hHttpFile; - UINT IoReadFileSize; - IO *io; -} VI_FILE; - -typedef struct VI_DOWNLOAD_FILE -{ - char SrcPath[MAX_SIZE]; - char FileName[MAX_PATH]; - wchar_t DestPathW[MAX_SIZE]; -} VI_DOWNLOAD_FILE; - -// Function prototype -int main(int argc, char *argv[]); -void ViLoadStringTables(); -void ViFreeStringTables(); -wchar_t *ViLoadString(HINSTANCE hInst, UINT id); -char *ViLoadStringA(HINSTANCE hInst, UINT id); -int ViCompareString(void *p1, void *p2); -wchar_t *ViGetString(UINT id); -char *ViGetStringA(UINT id); -void ViMain(); -bool ViLoadInf(VI_SETTING *set, char *filename); -bool ViLoadInfFromBuf(VI_SETTING *set, BUF *buf); -void ViLoadCurrentInstalledStates(); -void ViLoadCurrentInstalledStatusForArch(VI_SETTING_ARCH *a); -bool ViMsiGetProductInfo(char *product_code, char *name, char *buf, UINT size); -UINT ViVersionStrToBuild(char *str); -VI_SETTING_ARCH *ViGetSuitableArchForCpu(); -void ViInstallDlg(); -UINT ViInstallDlgProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param); -void ViInstallDlgOnInit(HWND hWnd, VI_INSTALL_DLG *d); -void ViInstallDlgOnStart(HWND hWnd, VI_INSTALL_DLG *d); -void ViInstallDlgOnClose(HWND hWnd, VI_INSTALL_DLG *d); -VI_FILE *ViOpenFile(char *path); -UINT ViGetFileSize(VI_FILE *f); -UINT ViReadFile(VI_FILE *f, void *buf, UINT size); -void ViCloseFile(VI_FILE *f); -bool ViIsInternetFile(char *path); -void ViDownloadThreadStart(VI_INSTALL_DLG *d); -void ViDownloadThreadStop(VI_INSTALL_DLG *d); -void ViDownloadThread(THREAD *thread, void *param); -void ViInstallDlgSetPos(HWND hWnd, UINT pos); -void ViInstallDlgSetText(VI_INSTALL_DLG *d, HWND hWnd, UINT id,wchar_t *text); -void ViInstallDlgCancel(HWND hWnd); -void ViInstallProcessStart(HWND hWnd, VI_INSTALL_DLG *d); -bool ViExtractCabinetFile(char *exe, char *cab); -wchar_t *ViExtractEula(char *exe); -BUF *ViExtractResource(char *exe, char *type, char *name); -bool ViEulaDlg(HWND hWnd, wchar_t *text); -UINT ViEulaDlgProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param); -bool ViCheckExeSign(HWND hWnd, wchar_t *exew); -char *ViUrlToFileName(char *url); -void ViGenerateVpnSMgrTempDirName(char *name, UINT size, UINT build); -void ViSetSkip(); - -#endif // VPNINSTALL_H - +// SoftEther VPN Source Code - Developer Edition Master Branch +// Cedar Communication Module + + +// vpninstall.h +// Header of vpninstall.c + +#ifndef VPNINSTALL_H +#define VPNINSTALL_H + +// Constants +#define VI_INF_FILENAME "vpninstall.inf" +#define VI_INSTANCE_NAME "VpnAutoInstaller" +#define WM_VI_SETPOS (WM_APP + 41) +#define WM_VI_SETTEXT (WM_APP + 42) +#define WM_VI_CANCEL (WM_APP + 43) +#define WM_VI_DOWNLOAD_FINISHED (WM_APP + 44) +#define MESSAGE_OFFSET_JP IDS_TITLE +#define MESSAGE_OFFSET_EN IDS_TITLE_EN + +// Macro +#define _U(id) (ViGetString(id)) +#define _A(id) (ViGetStringA(id)) + + +// Type declaration +typedef struct VI_STRING +{ + UINT Id; + wchar_t *String; + char *StringA; +} VI_STRING; + +typedef struct VI_SETTING_ARCH +{ + bool Supported; + UINT Build; + char Path[MAX_SIZE]; + char VpnCMgrExeFileName[MAX_PATH]; + bool CurrentInstalled; + wchar_t CurrentInstalledPathW[MAX_PATH]; + UINT CurrentInstalledBuild; +} VI_SETTING_ARCH; + +typedef struct VI_SETTING +{ + UINT VpnInstallBuild; + VI_SETTING_ARCH x86; + char SettingPath[MAX_SIZE]; + wchar_t DownloadedSettingPathW[MAX_PATH]; + wchar_t DownloadedInstallerPathW[MAX_PATH]; + bool DownloadNotRequired; + bool WebMode; + bool NormalMode; +} VI_SETTING; + +typedef struct VI_INSTALL_DLG +{ + HWND hWnd; + bool DownloadStarted; + THREAD *DownloadThread; + bool DialogCanceling; + UINT BufSize; + void *Buf; + bool Halt; + bool NoClose; + bool WindowsShutdowning; +} VI_INSTALL_DLG; + +typedef struct VI_FILE +{ + bool InternetFile; + UINT FileSize; + HINTERNET hInternet; + HINTERNET hHttpFile; + UINT IoReadFileSize; + IO *io; +} VI_FILE; + +typedef struct VI_DOWNLOAD_FILE +{ + char SrcPath[MAX_SIZE]; + char FileName[MAX_PATH]; + wchar_t DestPathW[MAX_SIZE]; +} VI_DOWNLOAD_FILE; + +// Function prototype +int main(int argc, char *argv[]); +void ViLoadStringTables(); +void ViFreeStringTables(); +wchar_t *ViLoadString(HINSTANCE hInst, UINT id); +char *ViLoadStringA(HINSTANCE hInst, UINT id); +int ViCompareString(void *p1, void *p2); +wchar_t *ViGetString(UINT id); +char *ViGetStringA(UINT id); +void ViMain(); +bool ViLoadInf(VI_SETTING *set, char *filename); +bool ViLoadInfFromBuf(VI_SETTING *set, BUF *buf); +void ViLoadCurrentInstalledStates(); +void ViLoadCurrentInstalledStatusForArch(VI_SETTING_ARCH *a); +bool ViMsiGetProductInfo(char *product_code, char *name, char *buf, UINT size); +UINT ViVersionStrToBuild(char *str); +VI_SETTING_ARCH *ViGetSuitableArchForCpu(); +void ViInstallDlg(); +UINT ViInstallDlgProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param); +void ViInstallDlgOnInit(HWND hWnd, VI_INSTALL_DLG *d); +void ViInstallDlgOnStart(HWND hWnd, VI_INSTALL_DLG *d); +void ViInstallDlgOnClose(HWND hWnd, VI_INSTALL_DLG *d); +VI_FILE *ViOpenFile(char *path); +UINT ViGetFileSize(VI_FILE *f); +UINT ViReadFile(VI_FILE *f, void *buf, UINT size); +void ViCloseFile(VI_FILE *f); +bool ViIsInternetFile(char *path); +void ViDownloadThreadStart(VI_INSTALL_DLG *d); +void ViDownloadThreadStop(VI_INSTALL_DLG *d); +void ViDownloadThread(THREAD *thread, void *param); +void ViInstallDlgSetPos(HWND hWnd, UINT pos); +void ViInstallDlgSetText(VI_INSTALL_DLG *d, HWND hWnd, UINT id,wchar_t *text); +void ViInstallDlgCancel(HWND hWnd); +void ViInstallProcessStart(HWND hWnd, VI_INSTALL_DLG *d); +bool ViExtractCabinetFile(char *exe, char *cab); +wchar_t *ViExtractEula(char *exe); +BUF *ViExtractResource(char *exe, char *type, char *name); +bool ViEulaDlg(HWND hWnd, wchar_t *text); +UINT ViEulaDlgProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param); +bool ViCheckExeSign(HWND hWnd, wchar_t *exew); +char *ViUrlToFileName(char *url); +void ViGenerateVpnSMgrTempDirName(char *name, UINT size, UINT build); +void ViSetSkip(); + +#endif // VPNINSTALL_H + diff --git a/src/vpninstall/vpninstall.rc b/src/vpninstall/vpninstall.rc index 0bb9ecf0..cae13f70 100644 --- a/src/vpninstall/vpninstall.rc +++ b/src/vpninstall/vpninstall.rc @@ -1,221 +1,221 @@ -// Microsoft Visual C++ generated resource script. -// -#include "resource.h" - -#define APSTUDIO_READONLY_SYMBOLS -///////////////////////////////////////////////////////////////////////////// -// -// Generated from the TEXTINCLUDE 2 resource. -// -#include "winres.h" - -///////////////////////////////////////////////////////////////////////////// -#undef APSTUDIO_READONLY_SYMBOLS - -///////////////////////////////////////////////////////////////////////////// -// Japanese resources - -#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_JPN) -#ifdef _WIN32 -LANGUAGE LANG_JAPANESE, SUBLANG_DEFAULT -#pragma code_page(932) -#endif //_WIN32 - -#ifdef APSTUDIO_INVOKED -///////////////////////////////////////////////////////////////////////////// -// -// TEXTINCLUDE -// - -1 TEXTINCLUDE -BEGIN - "resource.h\0" -END - -2 TEXTINCLUDE -BEGIN - "#include ""winres.h""\r\n" - "\0" -END - -3 TEXTINCLUDE -BEGIN - "\r\n" - "\0" -END - -#endif // APSTUDIO_INVOKED - - -///////////////////////////////////////////////////////////////////////////// -// -// Icon -// - -// Icon with lowest ID value placed first to ensure application icon -// remains consistent on all systems. -IDI_MAIN ICON "vpninstall.ico" - -///////////////////////////////////////////////////////////////////////////// -// -// Dialog -// - -D_INSTALL DIALOGEX 0, 0, 311, 123 -STYLE DS_SETFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION -CAPTION "VPN NCAg\tgEFA" -FONT 9, "MS UI Gothic", 400, 0, 0x80 -BEGIN - ICON IDI_MAIN,IDC_STATIC,7,7,20,20 - LTEXT "VPN NCAg\tgEFA",S_TITLE,33,7,259,19,WS_TABSTOP - CONTROL "",P_PROGRESS,"msctls_progress32",PBS_SMOOTH | WS_BORDER,7,55,297,14 - LTEXT "...",S_STATUS,7,34,297,19 - PUSHBUTTON "LZ(&C)",IDCANCEL,127,100,59,16 - RTEXT "",S_SIZEINFO,165,74,139,12 -END - -D_EULA DIALOGEX 0, 0, 218, 216 -STYLE DS_SETFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU -CAPTION "VPN NCAg\tgEFA" -FONT 9, "MS UI Gothic", 400, 0, 0x80 -BEGIN - LTEXT "̎gp_񏑂ǂ݂BPageDown L[găXN[ĂB",S_EULA_NOTICE1,7,7,204,19 - EDITTEXT E_EULA,7,27,204,115,ES_MULTILINE | ES_READONLY | ES_WANTRETURN | WS_VSCROLL - LTEXT "gp_񏑂ɓӂ܂?",S_BOLD,7,146,204,18 - LTEXT "[ӂ܂] NbNƃCXg[𒆎~܂BCXg[ɂ́Ǎ_ɓӂĂB",S_EULA_NOTICE3,7,165,204,26 - DEFPUSHBUTTON "ӂ܂(&A)",IDOK,95,192,56,17 - PUSHBUTTON "ӂ܂(&D)",IDCANCEL,155,192,56,17 -END - - -///////////////////////////////////////////////////////////////////////////// -// -// DESIGNINFO -// - -#ifdef APSTUDIO_INVOKED -GUIDELINES DESIGNINFO -BEGIN - D_INSTALL, DIALOG - BEGIN - LEFTMARGIN, 7 - RIGHTMARGIN, 304 - TOPMARGIN, 7 - BOTTOMMARGIN, 116 - END - - D_EULA, DIALOG - BEGIN - LEFTMARGIN, 7 - RIGHTMARGIN, 211 - TOPMARGIN, 7 - BOTTOMMARGIN, 209 - END -END -#endif // APSTUDIO_INVOKED - - -///////////////////////////////////////////////////////////////////////////// -// -// String Table -// - -STRINGTABLE -BEGIN - IDS_TITLE "VPN NCAg Web CXg[" - IDS_FONT "MS UI Gothic" - IDS_FONT_SIZE "9" - IDS_INF_LOAD_FAILED "t@C '%S' ̓ǂݍ݂Ɏs܂B\r\nt@C‚ȂAeȂ”\܂B" - IDS_DIFF_CPU "̃VXeɂłɕʂ CPU A[LeN`p VPN NCAg\tgEFACXg[Ă܂B\r\nRg[pl [vO̒ljƍ폜] gpāACXg[Ăʂ̃o[W VPN NCAg\tgEFAACXg[ĂB" - IDS_INSTANCE_EXISTS "łɕʂ̊ȈՃCXg[NĂ܂B" - IDS_BAD_OS "ȈՃCXg[ Windows 2000 ȍ~ OS œ삵܂B\r\nȊÕIy[eBOVXe VPN NCAg\tgEFACXg[ꍇ́A蓮ŃCXg[vONăCXg[sĂB" - IDS_CPU_NOT_SUPPORTED "݂̃VXe CPU A[LeN`ɑΉ VPN NCAg\tgEFÁAVPN NCAgȈՃCXg[ł̓T|[gĂ܂B\r\n蓮ŃCXg[Kv܂B" - IDS_DOWNLOADING "(%.2f MB %.2f MB )" - IDS_DOWNLOADSTART "t@C '%S' ̃_E[hJnĂ܂..." -END - -STRINGTABLE -BEGIN - IDS_TEMP_ERROR "ꎞt@C '%s' ̍쐬Ɏs܂B" - IDS_DOWNLOAD_ERROR "t@C '%S' ̃_E[hɎs܂B" - IDS_DOWNLOADING2 "(%.2f MB )" - IDS_DOWNLOADING3 "t@C '%S' _E[hĂ܂B΂炭҂..." - IDS_INSTALLSTART "ʂɕ\ꂽ VPN Client CXg[̎wɏ]ăCXg[ĂB" - IDS_INSTALLSTART_ERROR "CXg[̊JnɎs܂B" - IDS_SECURITY_ERROR "ZLeBی삷邽߁AWeb oR̃CXg[̓[Jt@CCXg[t@CƂĎw肷邱Ƃ͂ł܂B\r\ninf t@C̓ew肵pXȂǂmFĂB\r\n\r\nCXg[I܂B" - IDS_SIGN_WARNING "C^[lbg玩Ń_E[hꂽt@C '%s' ́AMł锭sɂēdqĂ܂łB\r\ñ݂bZ[W\ĂvO̊JєzźAC^[lbg玩Ń_E[hꂽt@C '%s' Sł邩ǂۏ؂łAɃZLeB댯ȃR[h܂܂ĂꍇłӔC𕉂܂B\r\n\r\ñt@Cs邱Ƃ̓ZLeB㐄܂B̃t@CM邱Ƃł邩ǂTdɔfĂB\r\n\r\n[U[̔fƐӔCɂ [OK] NbNƁACXg[𑱍s܂B[LZ] NbNƁACXg[𒆒f܂B\r\n\r\n ̃bZ[ẂAt@C '%s' LȃR[hpؖɂď邱Ƃɂ\ȂȂ܂B" - IDS_SIGN_WARNING_TITLE "ZLeBɊւx" - IDS_TITLE_VPNSMGR "VPN T[o[Ǘ}l[WȈՃCXg[" - IDS_VPNSMGR_EXEC_ERROR "VPN T[o[Ǘ}l[W̋NɎs܂B\r\n蓮 VPN T[o[Ǘ}l[WCXg[sĂ݂ĂB" - IDS_DLG_TITLE "VPN NCAg\tgEFA" - IDS_INSTALL_DLG__STATUS_INIT "" - IDS_INSTALL_CANCEL "LZ" - IDS_EULA_NOTICE1 "̎gp_񏑂ǂ݂BPageDown L[găXN[ĂB" - IDS_EULA_NOTICE2 "gp_񏑂ɓӂ܂?" -END - -STRINGTABLE -BEGIN - IDS_EULA_NOTICE3 "[ӂ܂] NbNƃCXg[𒆎~܂BCXg[ɂ́Ǎ_ɓӂĂB" - IDS_EULA_AGREE "ӂ܂" - IDS_EULA_DISAGREE "ӂ܂" -END - -STRINGTABLE -BEGIN - IDS_TITLE_EN "VPN Client Web Installer" - IDS_FONT_EN "Arial" -END - -STRINGTABLE -BEGIN - IDS_FONT_SIZE_EN "8" - IDS_INF_LOAD_FAILED_EN "Failed to load initial configuration file '%S'.\r\nThe cause may be that threre are not the file or the description is invalid." - IDS_DIFF_CPU_EN "There already is VPN Client software for another CPU architecture installed on this system.\r\nUninstall that VPN Client software with [Add or Remove Programs] in Control Panel." - IDS_INSTANCE_EXISTS_EN "Another easy installer is already running." - IDS_BAD_OS_EN "The easy installer runs on Windows 2000 or greater.\r\nTo install VPN Client software for other operating systems, please install the software manually from a file. " - IDS_CPU_NOT_SUPPORTED_EN - "The VPN Client Easy Installer is not supported for this CPU architecture on this system.\r\nPlease install VPN Client software manually from an installation file. " - IDS_DOWNLOADING_EN "(Total:%.2f MB - Downloaded:%.2f MB)" - IDS_DOWNLOADSTART_EN "Starting download file '%S'..." - IDS_TEMP_ERROR_EN "Failed to create temporary file '%s'." - IDS_DOWNLOAD_ERROR_EN "Failed to download file '%S'." - IDS_DOWNLOADING2_EN "(Downloaded: %.2f)" - IDS_DOWNLOADING3_EN "Downloading file '%S'. Please wait." - IDS_INSTALLSTART_EN "Complete the VPN Client Installer displayed on the screen." - IDS_INSTALLSTART_ERROR_EN "Failed to start installation." - IDS_SECURITY_ERROR_EN "For security reasons, a local file cannot be used as the installation soruce during Web-based installation.\r\nConfirm the inf file of context and check the path specified in the inf file. \r\nInstallation process aborted." - IDS_SIGN_WARNING_EN "The automatically downloaded file '%s' from the Internet is not digitally signed with a trusted certificate.\r\nThe developer and publisher do not guarantee that the downloaded file '%s' is safe and do not take responsibility in case of unsafe code included in the file.\r\n\r\nWe recommend to abort the installation by clicking [Cancel]. Proceed the installation by clicking [OK] at your own risk.\r\n\r\nNotice: the message will not be disappeared when the file '%s' is signed by valid code signing certificate authentication." -END - -STRINGTABLE -BEGIN - IDS_SIGN_WARNING_TITLE_EN "Security Alert" - IDS_TITLE_VPNSMGR_EN "VPN Server Manager Easy Installer" - IDS_VPNSMGR_EXEC_ERROR_EN - "Failed to start VPN Server Manager.\r\nTry installing VPN Server Manager manually." - IDS_DLG_TITLE_EN "VPN Client Software" - IDS_INSTALL_DLG__STATUS_INIT_EN "Initializing..." - IDS_INSTALL_CANCEL_EN "Cancel" - IDS_EULA_NOTICE1_EN "Please read the following license agreement. Press the PAGE DOWN key to see the rest of the agreement." - IDS_EULA_NOTICE2_EN "Do you accept all of the terms of the preceding License Agreement?" - IDS_EULA_NOTICE3_EN "If you choose No, the installation will abort. To install you must accept this agreement." - IDS_EULA_AGREE_EN "Agree" - IDS_EULA_DISAGREE_EN "Disagree" -END - -#endif // Japanese resources -///////////////////////////////////////////////////////////////////////////// - - - -#ifndef APSTUDIO_INVOKED -///////////////////////////////////////////////////////////////////////////// -// -// Generated from the TEXTINCLUDE 3 resource. -// - - -///////////////////////////////////////////////////////////////////////////// -#endif // not APSTUDIO_INVOKED - +// Microsoft Visual C++ generated resource script. +// +#include "resource.h" + +#define APSTUDIO_READONLY_SYMBOLS +///////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 2 resource. +// +#include "winres.h" + +///////////////////////////////////////////////////////////////////////////// +#undef APSTUDIO_READONLY_SYMBOLS + +///////////////////////////////////////////////////////////////////////////// +// Japanese resources + +#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_JPN) +#ifdef _WIN32 +LANGUAGE LANG_JAPANESE, SUBLANG_DEFAULT +#pragma code_page(932) +#endif //_WIN32 + +#ifdef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// TEXTINCLUDE +// + +1 TEXTINCLUDE +BEGIN + "resource.h\0" +END + +2 TEXTINCLUDE +BEGIN + "#include ""winres.h""\r\n" + "\0" +END + +3 TEXTINCLUDE +BEGIN + "\r\n" + "\0" +END + +#endif // APSTUDIO_INVOKED + + +///////////////////////////////////////////////////////////////////////////// +// +// Icon +// + +// Icon with lowest ID value placed first to ensure application icon +// remains consistent on all systems. +IDI_MAIN ICON "vpninstall.ico" + +///////////////////////////////////////////////////////////////////////////// +// +// Dialog +// + +D_INSTALL DIALOGEX 0, 0, 311, 123 +STYLE DS_SETFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION +CAPTION "VPN NCAg\tgEFA" +FONT 9, "MS UI Gothic", 400, 0, 0x80 +BEGIN + ICON IDI_MAIN,IDC_STATIC,7,7,20,20 + LTEXT "VPN NCAg\tgEFA",S_TITLE,33,7,259,19,WS_TABSTOP + CONTROL "",P_PROGRESS,"msctls_progress32",PBS_SMOOTH | WS_BORDER,7,55,297,14 + LTEXT "...",S_STATUS,7,34,297,19 + PUSHBUTTON "LZ(&C)",IDCANCEL,127,100,59,16 + RTEXT "",S_SIZEINFO,165,74,139,12 +END + +D_EULA DIALOGEX 0, 0, 218, 216 +STYLE DS_SETFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "VPN NCAg\tgEFA" +FONT 9, "MS UI Gothic", 400, 0, 0x80 +BEGIN + LTEXT "̎gp_񏑂ǂ݂BPageDown L[găXN[ĂB",S_EULA_NOTICE1,7,7,204,19 + EDITTEXT E_EULA,7,27,204,115,ES_MULTILINE | ES_READONLY | ES_WANTRETURN | WS_VSCROLL + LTEXT "gp_񏑂ɓӂ܂?",S_BOLD,7,146,204,18 + LTEXT "[ӂ܂] NbNƃCXg[𒆎~܂BCXg[ɂ́Ǎ_ɓӂĂB",S_EULA_NOTICE3,7,165,204,26 + DEFPUSHBUTTON "ӂ܂(&A)",IDOK,95,192,56,17 + PUSHBUTTON "ӂ܂(&D)",IDCANCEL,155,192,56,17 +END + + +///////////////////////////////////////////////////////////////////////////// +// +// DESIGNINFO +// + +#ifdef APSTUDIO_INVOKED +GUIDELINES DESIGNINFO +BEGIN + D_INSTALL, DIALOG + BEGIN + LEFTMARGIN, 7 + RIGHTMARGIN, 304 + TOPMARGIN, 7 + BOTTOMMARGIN, 116 + END + + D_EULA, DIALOG + BEGIN + LEFTMARGIN, 7 + RIGHTMARGIN, 211 + TOPMARGIN, 7 + BOTTOMMARGIN, 209 + END +END +#endif // APSTUDIO_INVOKED + + +///////////////////////////////////////////////////////////////////////////// +// +// String Table +// + +STRINGTABLE +BEGIN + IDS_TITLE "VPN NCAg Web CXg[" + IDS_FONT "MS UI Gothic" + IDS_FONT_SIZE "9" + IDS_INF_LOAD_FAILED "t@C '%S' ̓ǂݍ݂Ɏs܂B\r\nt@C‚ȂAeȂ”\܂B" + IDS_DIFF_CPU "̃VXeɂłɕʂ CPU A[LeN`p VPN NCAg\tgEFACXg[Ă܂B\r\nRg[pl [vO̒ljƍ폜] gpāACXg[Ăʂ̃o[W VPN NCAg\tgEFAACXg[ĂB" + IDS_INSTANCE_EXISTS "łɕʂ̊ȈՃCXg[NĂ܂B" + IDS_BAD_OS "ȈՃCXg[ Windows 2000 ȍ~ OS œ삵܂B\r\nȊÕIy[eBOVXe VPN NCAg\tgEFACXg[ꍇ́A蓮ŃCXg[vONăCXg[sĂB" + IDS_CPU_NOT_SUPPORTED "݂̃VXe CPU A[LeN`ɑΉ VPN NCAg\tgEFÁAVPN NCAgȈՃCXg[ł̓T|[gĂ܂B\r\n蓮ŃCXg[Kv܂B" + IDS_DOWNLOADING "(%.2f MB %.2f MB )" + IDS_DOWNLOADSTART "t@C '%S' ̃_E[hJnĂ܂..." +END + +STRINGTABLE +BEGIN + IDS_TEMP_ERROR "ꎞt@C '%s' ̍쐬Ɏs܂B" + IDS_DOWNLOAD_ERROR "t@C '%S' ̃_E[hɎs܂B" + IDS_DOWNLOADING2 "(%.2f MB )" + IDS_DOWNLOADING3 "t@C '%S' _E[hĂ܂B΂炭҂..." + IDS_INSTALLSTART "ʂɕ\ꂽ VPN Client CXg[̎wɏ]ăCXg[ĂB" + IDS_INSTALLSTART_ERROR "CXg[̊JnɎs܂B" + IDS_SECURITY_ERROR "ZLeBی삷邽߁AWeb oR̃CXg[̓[Jt@CCXg[t@CƂĎw肷邱Ƃ͂ł܂B\r\ninf t@C̓ew肵pXȂǂmFĂB\r\n\r\nCXg[I܂B" + IDS_SIGN_WARNING "C^[lbg玩Ń_E[hꂽt@C '%s' ́AMł锭sɂēdqĂ܂łB\r\ñ݂bZ[W\ĂvO̊JєzźAC^[lbg玩Ń_E[hꂽt@C '%s' Sł邩ǂۏ؂łAɃZLeB댯ȃR[h܂܂ĂꍇłӔC𕉂܂B\r\n\r\ñt@Cs邱Ƃ̓ZLeB㐄܂B̃t@CM邱Ƃł邩ǂTdɔfĂB\r\n\r\n[U[̔fƐӔCɂ [OK] NbNƁACXg[𑱍s܂B[LZ] NbNƁACXg[𒆒f܂B\r\n\r\n ̃bZ[ẂAt@C '%s' LȃR[hpؖɂď邱Ƃɂ\ȂȂ܂B" + IDS_SIGN_WARNING_TITLE "ZLeBɊւx" + IDS_TITLE_VPNSMGR "VPN T[o[Ǘ}l[WȈՃCXg[" + IDS_VPNSMGR_EXEC_ERROR "VPN T[o[Ǘ}l[W̋NɎs܂B\r\n蓮 VPN T[o[Ǘ}l[WCXg[sĂ݂ĂB" + IDS_DLG_TITLE "VPN NCAg\tgEFA" + IDS_INSTALL_DLG__STATUS_INIT "" + IDS_INSTALL_CANCEL "LZ" + IDS_EULA_NOTICE1 "̎gp_񏑂ǂ݂BPageDown L[găXN[ĂB" + IDS_EULA_NOTICE2 "gp_񏑂ɓӂ܂?" +END + +STRINGTABLE +BEGIN + IDS_EULA_NOTICE3 "[ӂ܂] NbNƃCXg[𒆎~܂BCXg[ɂ́Ǎ_ɓӂĂB" + IDS_EULA_AGREE "ӂ܂" + IDS_EULA_DISAGREE "ӂ܂" +END + +STRINGTABLE +BEGIN + IDS_TITLE_EN "VPN Client Web Installer" + IDS_FONT_EN "Arial" +END + +STRINGTABLE +BEGIN + IDS_FONT_SIZE_EN "8" + IDS_INF_LOAD_FAILED_EN "Failed to load initial configuration file '%S'.\r\nThe cause may be that threre are not the file or the description is invalid." + IDS_DIFF_CPU_EN "There already is VPN Client software for another CPU architecture installed on this system.\r\nUninstall that VPN Client software with [Add or Remove Programs] in Control Panel." + IDS_INSTANCE_EXISTS_EN "Another easy installer is already running." + IDS_BAD_OS_EN "The easy installer runs on Windows 2000 or greater.\r\nTo install VPN Client software for other operating systems, please install the software manually from a file. " + IDS_CPU_NOT_SUPPORTED_EN + "The VPN Client Easy Installer is not supported for this CPU architecture on this system.\r\nPlease install VPN Client software manually from an installation file. " + IDS_DOWNLOADING_EN "(Total:%.2f MB - Downloaded:%.2f MB)" + IDS_DOWNLOADSTART_EN "Starting download file '%S'..." + IDS_TEMP_ERROR_EN "Failed to create temporary file '%s'." + IDS_DOWNLOAD_ERROR_EN "Failed to download file '%S'." + IDS_DOWNLOADING2_EN "(Downloaded: %.2f)" + IDS_DOWNLOADING3_EN "Downloading file '%S'. Please wait." + IDS_INSTALLSTART_EN "Complete the VPN Client Installer displayed on the screen." + IDS_INSTALLSTART_ERROR_EN "Failed to start installation." + IDS_SECURITY_ERROR_EN "For security reasons, a local file cannot be used as the installation soruce during Web-based installation.\r\nConfirm the inf file of context and check the path specified in the inf file. \r\nInstallation process aborted." + IDS_SIGN_WARNING_EN "The automatically downloaded file '%s' from the Internet is not digitally signed with a trusted certificate.\r\nThe developer and publisher do not guarantee that the downloaded file '%s' is safe and do not take responsibility in case of unsafe code included in the file.\r\n\r\nWe recommend to abort the installation by clicking [Cancel]. Proceed the installation by clicking [OK] at your own risk.\r\n\r\nNotice: the message will not be disappeared when the file '%s' is signed by valid code signing certificate authentication." +END + +STRINGTABLE +BEGIN + IDS_SIGN_WARNING_TITLE_EN "Security Alert" + IDS_TITLE_VPNSMGR_EN "VPN Server Manager Easy Installer" + IDS_VPNSMGR_EXEC_ERROR_EN + "Failed to start VPN Server Manager.\r\nTry installing VPN Server Manager manually." + IDS_DLG_TITLE_EN "VPN Client Software" + IDS_INSTALL_DLG__STATUS_INIT_EN "Initializing..." + IDS_INSTALL_CANCEL_EN "Cancel" + IDS_EULA_NOTICE1_EN "Please read the following license agreement. Press the PAGE DOWN key to see the rest of the agreement." + IDS_EULA_NOTICE2_EN "Do you accept all of the terms of the preceding License Agreement?" + IDS_EULA_NOTICE3_EN "If you choose No, the installation will abort. To install you must accept this agreement." + IDS_EULA_AGREE_EN "Agree" + IDS_EULA_DISAGREE_EN "Disagree" +END + +#endif // Japanese resources +///////////////////////////////////////////////////////////////////////////// + + + +#ifndef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 3 resource. +// + + +///////////////////////////////////////////////////////////////////////////// +#endif // not APSTUDIO_INVOKED + diff --git a/src/vpninstall/vpninstall.vcproj b/src/vpninstall/vpninstall.vcproj index 5df88e05..7cf49bc1 100644 --- a/src/vpninstall/vpninstall.vcproj +++ b/src/vpninstall/vpninstall.vcproj @@ -1,248 +1,248 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/vpnserver/resource.h b/src/vpnserver/resource.h index 4e838a5f..b65ad2b9 100644 --- a/src/vpnserver/resource.h +++ b/src/vpnserver/resource.h @@ -1,17 +1,17 @@ -//{{NO_DEPENDENCIES}} -// Microsoft Visual C++ generated include file. -// Used by vpnserver.rc -// -#define IDI_ICON1 101 -#define IDI_SERVER 101 - -// Next default values for new objects -// -#ifdef APSTUDIO_INVOKED -#ifndef APSTUDIO_READONLY_SYMBOLS -#define _APS_NEXT_RESOURCE_VALUE 102 -#define _APS_NEXT_COMMAND_VALUE 40001 -#define _APS_NEXT_CONTROL_VALUE 1001 -#define _APS_NEXT_SYMED_VALUE 101 -#endif -#endif +//{{NO_DEPENDENCIES}} +// Microsoft Visual C++ generated include file. +// Used by vpnserver.rc +// +#define IDI_ICON1 101 +#define IDI_SERVER 101 + +// Next default values for new objects +// +#ifdef APSTUDIO_INVOKED +#ifndef APSTUDIO_READONLY_SYMBOLS +#define _APS_NEXT_RESOURCE_VALUE 102 +#define _APS_NEXT_COMMAND_VALUE 40001 +#define _APS_NEXT_CONTROL_VALUE 1001 +#define _APS_NEXT_SYMED_VALUE 101 +#endif +#endif diff --git a/src/vpnserver/vpnserver.c b/src/vpnserver/vpnserver.c index 6a39ab65..fdcd9a51 100644 --- a/src/vpnserver/vpnserver.c +++ b/src/vpnserver/vpnserver.c @@ -1,63 +1,63 @@ -// SoftEther VPN Source Code - Developer Edition Master Branch -// Cedar Communication Module - - -// vpnserver.c -// VPN Server service program - -#include - -#define VPN_EXE - -#ifdef WIN32 -#include -#include -#include -#include -#include -#include -#include -#include "../PenCore/resource.h" -#endif // WIN32 -#include -#include -#include -#include -#include -#include -#include -#include - -// Process starting function -void StartProcess() -{ - // Start the server - InitCedar(); - StInit(); - StStartServer(false); -} - -// Process termination function -void StopProcess() -{ - // Stop the server - StStopServer(); - StFree(); - FreeCedar(); -} - -// WinMain function -int main(int argc, char *argv[]) -{ - InitProcessCallOnce(); - - VgUseStaticLink(); - -#ifdef OS_WIN32 - - return MsService(GC_SVC_NAME_VPNSERVER, StartProcess, StopProcess, ICO_CASCADE, argv[0]); -#else // OS_WIN32 - return UnixService(argc, argv, "vpnserver", StartProcess, StopProcess); -#endif // OS_WIN32 -} - +// SoftEther VPN Source Code - Developer Edition Master Branch +// Cedar Communication Module + + +// vpnserver.c +// VPN Server service program + +#include + +#define VPN_EXE + +#ifdef WIN32 +#include +#include +#include +#include +#include +#include +#include +#include "../PenCore/resource.h" +#endif // WIN32 +#include +#include +#include +#include +#include +#include +#include +#include + +// Process starting function +void StartProcess() +{ + // Start the server + InitCedar(); + StInit(); + StStartServer(false); +} + +// Process termination function +void StopProcess() +{ + // Stop the server + StStopServer(); + StFree(); + FreeCedar(); +} + +// WinMain function +int main(int argc, char *argv[]) +{ + InitProcessCallOnce(); + + VgUseStaticLink(); + +#ifdef OS_WIN32 + + return MsService(GC_SVC_NAME_VPNSERVER, StartProcess, StopProcess, ICO_CASCADE, argv[0]); +#else // OS_WIN32 + return UnixService(argc, argv, "vpnserver", StartProcess, StopProcess); +#endif // OS_WIN32 +} + diff --git a/src/vpnserver/vpnserver.rc b/src/vpnserver/vpnserver.rc index 819753d9..e96dc783 100644 --- a/src/vpnserver/vpnserver.rc +++ b/src/vpnserver/vpnserver.rc @@ -1,72 +1,72 @@ -// Microsoft Visual C++ generated resource script. -// -#include "resource.h" - -#define APSTUDIO_READONLY_SYMBOLS -///////////////////////////////////////////////////////////////////////////// -// -// Generated from the TEXTINCLUDE 2 resource. -// -#include "winres.h" - -///////////////////////////////////////////////////////////////////////////// -#undef APSTUDIO_READONLY_SYMBOLS - -///////////////////////////////////////////////////////////////////////////// -// Japanese resources - -#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_JPN) -#ifdef _WIN32 -LANGUAGE LANG_JAPANESE, SUBLANG_DEFAULT -#pragma code_page(932) -#endif //_WIN32 - -#ifdef APSTUDIO_INVOKED -///////////////////////////////////////////////////////////////////////////// -// -// TEXTINCLUDE -// - -1 TEXTINCLUDE -BEGIN - "resource.h\0" -END - -2 TEXTINCLUDE -BEGIN - "#include ""winres.h""\r\n" - "\0" -END - -3 TEXTINCLUDE -BEGIN - "\r\n" - "\0" -END - -#endif // APSTUDIO_INVOKED - - -///////////////////////////////////////////////////////////////////////////// -// -// Icon -// - -// Icon with lowest ID value placed first to ensure application icon -// remains consistent on all systems. -IDI_SERVER ICON "Server.ico" -#endif // Japanese resources -///////////////////////////////////////////////////////////////////////////// - - - -#ifndef APSTUDIO_INVOKED -///////////////////////////////////////////////////////////////////////////// -// -// Generated from the TEXTINCLUDE 3 resource. -// - - -///////////////////////////////////////////////////////////////////////////// -#endif // not APSTUDIO_INVOKED - +// Microsoft Visual C++ generated resource script. +// +#include "resource.h" + +#define APSTUDIO_READONLY_SYMBOLS +///////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 2 resource. +// +#include "winres.h" + +///////////////////////////////////////////////////////////////////////////// +#undef APSTUDIO_READONLY_SYMBOLS + +///////////////////////////////////////////////////////////////////////////// +// Japanese resources + +#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_JPN) +#ifdef _WIN32 +LANGUAGE LANG_JAPANESE, SUBLANG_DEFAULT +#pragma code_page(932) +#endif //_WIN32 + +#ifdef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// TEXTINCLUDE +// + +1 TEXTINCLUDE +BEGIN + "resource.h\0" +END + +2 TEXTINCLUDE +BEGIN + "#include ""winres.h""\r\n" + "\0" +END + +3 TEXTINCLUDE +BEGIN + "\r\n" + "\0" +END + +#endif // APSTUDIO_INVOKED + + +///////////////////////////////////////////////////////////////////////////// +// +// Icon +// + +// Icon with lowest ID value placed first to ensure application icon +// remains consistent on all systems. +IDI_SERVER ICON "Server.ico" +#endif // Japanese resources +///////////////////////////////////////////////////////////////////////////// + + + +#ifndef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 3 resource. +// + + +///////////////////////////////////////////////////////////////////////////// +#endif // not APSTUDIO_INVOKED + diff --git a/src/vpnsetup/resource.h b/src/vpnsetup/resource.h index 1406aa4e..d292c50d 100644 --- a/src/vpnsetup/resource.h +++ b/src/vpnsetup/resource.h @@ -1,33 +1,33 @@ -//{{NO_DEPENDENCIES}} -// Microsoft Visual C++ generated include file. -// Used by vpnsetup.rc -// -#define IDI_ICON1 101 -#define IDI_ICON2 103 -#define IDI_VPNSVR 103 -#define IDI_VPNSETUP 103 -#define IDI_SETUP_MAIN 103 -#define IDI_SETUP_INTERNET 104 -#define IDI_SETUP_PROTOCOL 105 -#define IDI_SETUP_SWITCH 106 -#define IDI_ICON3 107 -#define IDI_SETUP_MACHINE 107 -#define IDI_ICON4 108 -#define IDI_ICON5 109 -#define IDI_ICON6 110 -#define IDI_ICON7 111 -#define IDI_ICON8 112 -#define IDI_ICON9 113 -#define IDI_ICON10 115 -#define IDI_ICON11 120 - -// Next default values for new objects -// -#ifdef APSTUDIO_INVOKED -#ifndef APSTUDIO_READONLY_SYMBOLS -#define _APS_NEXT_RESOURCE_VALUE 121 -#define _APS_NEXT_COMMAND_VALUE 40001 -#define _APS_NEXT_CONTROL_VALUE 1002 -#define _APS_NEXT_SYMED_VALUE 101 -#endif -#endif +//{{NO_DEPENDENCIES}} +// Microsoft Visual C++ generated include file. +// Used by vpnsetup.rc +// +#define IDI_ICON1 101 +#define IDI_ICON2 103 +#define IDI_VPNSVR 103 +#define IDI_VPNSETUP 103 +#define IDI_SETUP_MAIN 103 +#define IDI_SETUP_INTERNET 104 +#define IDI_SETUP_PROTOCOL 105 +#define IDI_SETUP_SWITCH 106 +#define IDI_ICON3 107 +#define IDI_SETUP_MACHINE 107 +#define IDI_ICON4 108 +#define IDI_ICON5 109 +#define IDI_ICON6 110 +#define IDI_ICON7 111 +#define IDI_ICON8 112 +#define IDI_ICON9 113 +#define IDI_ICON10 115 +#define IDI_ICON11 120 + +// Next default values for new objects +// +#ifdef APSTUDIO_INVOKED +#ifndef APSTUDIO_READONLY_SYMBOLS +#define _APS_NEXT_RESOURCE_VALUE 121 +#define _APS_NEXT_COMMAND_VALUE 40001 +#define _APS_NEXT_CONTROL_VALUE 1002 +#define _APS_NEXT_SYMED_VALUE 101 +#endif +#endif diff --git a/src/vpnsetup/vpnsetup.c b/src/vpnsetup/vpnsetup.c index fc401cf9..b486dbd9 100644 --- a/src/vpnsetup/vpnsetup.c +++ b/src/vpnsetup/vpnsetup.c @@ -1,42 +1,42 @@ -// SoftEther VPN Source Code - Developer Edition Master Branch -// Cedar Communication Module - - -#include - -// vpnsetup.c -// VPN Setup Wizard - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -// WinMain function -int PASCAL WinMain(HINSTANCE hInst, HINSTANCE hPrev, char *CmdLine, int CmdShow) -{ - UINT ret; - - InitProcessCallOnce(); - - VgUseStaticLink(); - - ret = SWExec(); - - ExitProcess(ret); - - return (int)ret; -} - - +// SoftEther VPN Source Code - Developer Edition Master Branch +// Cedar Communication Module + + +#include + +// vpnsetup.c +// VPN Setup Wizard + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +// WinMain function +int PASCAL WinMain(HINSTANCE hInst, HINSTANCE hPrev, char *CmdLine, int CmdShow) +{ + UINT ret; + + InitProcessCallOnce(); + + VgUseStaticLink(); + + ret = SWExec(); + + ExitProcess(ret); + + return (int)ret; +} + + diff --git a/src/vpnsetup/vpnsetup.rc b/src/vpnsetup/vpnsetup.rc index 363d597d..7f3f7a0e 100644 --- a/src/vpnsetup/vpnsetup.rc +++ b/src/vpnsetup/vpnsetup.rc @@ -1,174 +1,174 @@ -// Microsoft Visual C++ generated resource script. -// -#include "resource.h" - -#define APSTUDIO_READONLY_SYMBOLS -///////////////////////////////////////////////////////////////////////////// -// -// Generated from the TEXTINCLUDE 2 resource. -// -#include "winres.h" - -///////////////////////////////////////////////////////////////////////////// -#undef APSTUDIO_READONLY_SYMBOLS - -///////////////////////////////////////////////////////////////////////////// -// Japanese resources - -#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_JPN) -#ifdef _WIN32 -LANGUAGE LANG_JAPANESE, SUBLANG_DEFAULT -#pragma code_page(932) -#endif //_WIN32 - -#ifdef APSTUDIO_INVOKED -///////////////////////////////////////////////////////////////////////////// -// -// TEXTINCLUDE -// - -1 TEXTINCLUDE -BEGIN - "resource.h\0" -END - -2 TEXTINCLUDE -BEGIN - "#include ""winres.h""\r\n" - "\0" -END - -3 TEXTINCLUDE -BEGIN - "\r\n" - "\0" -END - -#endif // APSTUDIO_INVOKED - - -///////////////////////////////////////////////////////////////////////////// -// -// Icon -// - -// Icon with lowest ID value placed first to ensure application icon -// remains consistent on all systems. -IDI_SETUP_MAIN ICON "vpnsetup.ico" - -///////////////////////////////////////////////////////////////////////////// -// -// DESIGNINFO -// - -#ifdef APSTUDIO_INVOKED -GUIDELINES DESIGNINFO -BEGIN - 10001, DIALOG - BEGIN - LEFTMARGIN, 7 - RIGHTMARGIN, 254 - TOPMARGIN, 7 - BOTTOMMARGIN, 68 - END -END -#endif // APSTUDIO_INVOKED - - -///////////////////////////////////////////////////////////////////////////// -// -// Dialog -// - -10001 DIALOGEX 0, 0, 261, 75 -STYLE DS_SETFONT | DS_MODALFRAME | DS_CENTER | WS_POPUP | WS_CAPTION -CAPTION "SoftEther Installer" -FONT 9, "MS PGothic", 400, 0, 0x80 -BEGIN - ICON IDI_ICON10,IDC_STATIC,7,7,20,20,WS_TABSTOP - LTEXT "CXg[̏...",IDC_STATIC,30,7,189,20 - DEFPUSHBUTTON "LZ",IDCANCEL,195,52,59,16 -END - -#endif // Japanese resources -///////////////////////////////////////////////////////////////////////////// - - -///////////////////////////////////////////////////////////////////////////// -// English resources - -#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) -#ifdef _WIN32 -LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US -#pragma code_page(1252) -#endif //_WIN32 - -///////////////////////////////////////////////////////////////////////////// -// -// Icon -// - -// Icon with lowest ID value placed first to ensure application icon -// remains consistent on all systems. -IDI_SETUP_INTERNET ICON "..\\PenCore\\Internet.ico" -IDI_SETUP_PROTOCOL ICON "..\\PenCore\\Protocol.ico" -IDI_SETUP_SWITCH ICON "..\\PenCore\\Switch.ico" -IDI_SETUP_MACHINE ICON "..\\PenCore\\Machine.ico" -IDI_ICON4 ICON "..\\PenCore\\VPNSvr.ico" -IDI_ICON5 ICON "..\\PenCore\\VPN.ico" -IDI_ICON6 ICON "..\\PenCore\\Cascade.ico" -IDI_ICON7 ICON "..\\PenCore\\UserAdmin.ico" -IDI_ICON8 ICON "..\\PenCore\\Internet.ico" -IDI_ICON9 ICON "..\\PenCore\\Language.ico" -IDI_ICON10 ICON "Installer.ico" -IDI_ICON11 ICON "..\\PenCore\\EasyInstaller.ico" - -///////////////////////////////////////////////////////////////////////////// -// -// DESIGNINFO -// - -#ifdef APSTUDIO_INVOKED -GUIDELINES DESIGNINFO -BEGIN - 10002, DIALOG - BEGIN - LEFTMARGIN, 7 - RIGHTMARGIN, 254 - TOPMARGIN, 7 - BOTTOMMARGIN, 68 - END -END -#endif // APSTUDIO_INVOKED - - -///////////////////////////////////////////////////////////////////////////// -// -// Dialog -// - -10002 DIALOGEX 0, 0, 261, 75 -STYLE DS_SETFONT | DS_MODALFRAME | DS_CENTER | WS_POPUP | WS_CAPTION -CAPTION "SoftEther Installer" -FONT 8, "Arial", 400, 0, 0x0 -BEGIN - ICON IDI_ICON10,IDC_STATIC,7,7,20,20,WS_TABSTOP - LTEXT "Preparing to install...",IDC_STATIC,33,7,189,20 - DEFPUSHBUTTON "Cancel",IDCANCEL,195,54,59,14 -END - -#endif // English resources -///////////////////////////////////////////////////////////////////////////// - - - -#ifndef APSTUDIO_INVOKED -///////////////////////////////////////////////////////////////////////////// -// -// Generated from the TEXTINCLUDE 3 resource. -// - - -///////////////////////////////////////////////////////////////////////////// -#endif // not APSTUDIO_INVOKED - +// Microsoft Visual C++ generated resource script. +// +#include "resource.h" + +#define APSTUDIO_READONLY_SYMBOLS +///////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 2 resource. +// +#include "winres.h" + +///////////////////////////////////////////////////////////////////////////// +#undef APSTUDIO_READONLY_SYMBOLS + +///////////////////////////////////////////////////////////////////////////// +// Japanese resources + +#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_JPN) +#ifdef _WIN32 +LANGUAGE LANG_JAPANESE, SUBLANG_DEFAULT +#pragma code_page(932) +#endif //_WIN32 + +#ifdef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// TEXTINCLUDE +// + +1 TEXTINCLUDE +BEGIN + "resource.h\0" +END + +2 TEXTINCLUDE +BEGIN + "#include ""winres.h""\r\n" + "\0" +END + +3 TEXTINCLUDE +BEGIN + "\r\n" + "\0" +END + +#endif // APSTUDIO_INVOKED + + +///////////////////////////////////////////////////////////////////////////// +// +// Icon +// + +// Icon with lowest ID value placed first to ensure application icon +// remains consistent on all systems. +IDI_SETUP_MAIN ICON "vpnsetup.ico" + +///////////////////////////////////////////////////////////////////////////// +// +// DESIGNINFO +// + +#ifdef APSTUDIO_INVOKED +GUIDELINES DESIGNINFO +BEGIN + 10001, DIALOG + BEGIN + LEFTMARGIN, 7 + RIGHTMARGIN, 254 + TOPMARGIN, 7 + BOTTOMMARGIN, 68 + END +END +#endif // APSTUDIO_INVOKED + + +///////////////////////////////////////////////////////////////////////////// +// +// Dialog +// + +10001 DIALOGEX 0, 0, 261, 75 +STYLE DS_SETFONT | DS_MODALFRAME | DS_CENTER | WS_POPUP | WS_CAPTION +CAPTION "SoftEther Installer" +FONT 9, "MS PGothic", 400, 0, 0x80 +BEGIN + ICON IDI_ICON10,IDC_STATIC,7,7,20,20,WS_TABSTOP + LTEXT "CXg[̏...",IDC_STATIC,30,7,189,20 + DEFPUSHBUTTON "LZ",IDCANCEL,195,52,59,16 +END + +#endif // Japanese resources +///////////////////////////////////////////////////////////////////////////// + + +///////////////////////////////////////////////////////////////////////////// +// English resources + +#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) +#ifdef _WIN32 +LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US +#pragma code_page(1252) +#endif //_WIN32 + +///////////////////////////////////////////////////////////////////////////// +// +// Icon +// + +// Icon with lowest ID value placed first to ensure application icon +// remains consistent on all systems. +IDI_SETUP_INTERNET ICON "..\\PenCore\\Internet.ico" +IDI_SETUP_PROTOCOL ICON "..\\PenCore\\Protocol.ico" +IDI_SETUP_SWITCH ICON "..\\PenCore\\Switch.ico" +IDI_SETUP_MACHINE ICON "..\\PenCore\\Machine.ico" +IDI_ICON4 ICON "..\\PenCore\\VPNSvr.ico" +IDI_ICON5 ICON "..\\PenCore\\VPN.ico" +IDI_ICON6 ICON "..\\PenCore\\Cascade.ico" +IDI_ICON7 ICON "..\\PenCore\\UserAdmin.ico" +IDI_ICON8 ICON "..\\PenCore\\Internet.ico" +IDI_ICON9 ICON "..\\PenCore\\Language.ico" +IDI_ICON10 ICON "Installer.ico" +IDI_ICON11 ICON "..\\PenCore\\EasyInstaller.ico" + +///////////////////////////////////////////////////////////////////////////// +// +// DESIGNINFO +// + +#ifdef APSTUDIO_INVOKED +GUIDELINES DESIGNINFO +BEGIN + 10002, DIALOG + BEGIN + LEFTMARGIN, 7 + RIGHTMARGIN, 254 + TOPMARGIN, 7 + BOTTOMMARGIN, 68 + END +END +#endif // APSTUDIO_INVOKED + + +///////////////////////////////////////////////////////////////////////////// +// +// Dialog +// + +10002 DIALOGEX 0, 0, 261, 75 +STYLE DS_SETFONT | DS_MODALFRAME | DS_CENTER | WS_POPUP | WS_CAPTION +CAPTION "SoftEther Installer" +FONT 8, "Arial", 400, 0, 0x0 +BEGIN + ICON IDI_ICON10,IDC_STATIC,7,7,20,20,WS_TABSTOP + LTEXT "Preparing to install...",IDC_STATIC,33,7,189,20 + DEFPUSHBUTTON "Cancel",IDCANCEL,195,54,59,14 +END + +#endif // English resources +///////////////////////////////////////////////////////////////////////////// + + + +#ifndef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 3 resource. +// + + +///////////////////////////////////////////////////////////////////////////// +#endif // not APSTUDIO_INVOKED + diff --git a/src/vpnsmgr/resource.h b/src/vpnsmgr/resource.h index f3acecf5..9c21ea43 100644 --- a/src/vpnsmgr/resource.h +++ b/src/vpnsmgr/resource.h @@ -1,18 +1,18 @@ -//{{NO_DEPENDENCIES}} -// Microsoft Visual C++ generated include file. -// Used by vpnsmgr.rc -// -#define IDI_ICON1 101 -#define IDI_ICON2 103 -#define IDI_VPNSVR 103 - -// Next default values for new objects -// -#ifdef APSTUDIO_INVOKED -#ifndef APSTUDIO_READONLY_SYMBOLS -#define _APS_NEXT_RESOURCE_VALUE 104 -#define _APS_NEXT_COMMAND_VALUE 40001 -#define _APS_NEXT_CONTROL_VALUE 1001 -#define _APS_NEXT_SYMED_VALUE 101 -#endif -#endif +//{{NO_DEPENDENCIES}} +// Microsoft Visual C++ generated include file. +// Used by vpnsmgr.rc +// +#define IDI_ICON1 101 +#define IDI_ICON2 103 +#define IDI_VPNSVR 103 + +// Next default values for new objects +// +#ifdef APSTUDIO_INVOKED +#ifndef APSTUDIO_READONLY_SYMBOLS +#define _APS_NEXT_RESOURCE_VALUE 104 +#define _APS_NEXT_COMMAND_VALUE 40001 +#define _APS_NEXT_CONTROL_VALUE 1001 +#define _APS_NEXT_SYMED_VALUE 101 +#endif +#endif diff --git a/src/vpnsmgr/vpnsmgr.c b/src/vpnsmgr/vpnsmgr.c index d341dc00..db0abc5d 100644 --- a/src/vpnsmgr/vpnsmgr.c +++ b/src/vpnsmgr/vpnsmgr.c @@ -1,46 +1,46 @@ -// SoftEther VPN Source Code - Developer Edition Master Branch -// Cedar Communication Module - - -// vpncmgr.c -// VPN Client connection manager program - -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -// WinMain function -int PASCAL WinMain(HINSTANCE hInst, HINSTANCE hPrev, char *CmdLine, int CmdShow) -{ - InitProcessCallOnce(); - -#if defined(_DEBUG) || defined(DEBUG) // In VC++ compilers, the macro is "_DEBUG", not "DEBUG". - // If set memcheck = true, the program will be vitally slow since it will log all malloc() / realloc() / free() calls to find the cause of memory leak. - // For normal debug we set memcheck = false. - // Please set memcheck = true if you want to test the cause of memory leaks. - InitMayaqua(false, true, 0, NULL); -#else - InitMayaqua(false, false, 0, NULL); -#endif - InitCedar(); - SMExec(); - FreeCedar(); - FreeMayaqua(); - return 0; -} - - +// SoftEther VPN Source Code - Developer Edition Master Branch +// Cedar Communication Module + + +// vpncmgr.c +// VPN Client connection manager program + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +// WinMain function +int PASCAL WinMain(HINSTANCE hInst, HINSTANCE hPrev, char *CmdLine, int CmdShow) +{ + InitProcessCallOnce(); + +#if defined(_DEBUG) || defined(DEBUG) // In VC++ compilers, the macro is "_DEBUG", not "DEBUG". + // If set memcheck = true, the program will be vitally slow since it will log all malloc() / realloc() / free() calls to find the cause of memory leak. + // For normal debug we set memcheck = false. + // Please set memcheck = true if you want to test the cause of memory leaks. + InitMayaqua(false, true, 0, NULL); +#else + InitMayaqua(false, false, 0, NULL); +#endif + InitCedar(); + SMExec(); + FreeCedar(); + FreeMayaqua(); + return 0; +} + + diff --git a/src/vpnsmgr/vpnsmgr.rc b/src/vpnsmgr/vpnsmgr.rc index 444131ab..33daf7b6 100644 --- a/src/vpnsmgr/vpnsmgr.rc +++ b/src/vpnsmgr/vpnsmgr.rc @@ -1,72 +1,72 @@ -// Microsoft Visual C++ generated resource script. -// -#include "resource.h" - -#define APSTUDIO_READONLY_SYMBOLS -///////////////////////////////////////////////////////////////////////////// -// -// Generated from the TEXTINCLUDE 2 resource. -// -#include "winres.h" - -///////////////////////////////////////////////////////////////////////////// -#undef APSTUDIO_READONLY_SYMBOLS - -///////////////////////////////////////////////////////////////////////////// -// Japanese resources - -#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_JPN) -#ifdef _WIN32 -LANGUAGE LANG_JAPANESE, SUBLANG_DEFAULT -#pragma code_page(932) -#endif //_WIN32 - -#ifdef APSTUDIO_INVOKED -///////////////////////////////////////////////////////////////////////////// -// -// TEXTINCLUDE -// - -1 TEXTINCLUDE -BEGIN - "resource.h\0" -END - -2 TEXTINCLUDE -BEGIN - "#include ""winres.h""\r\n" - "\0" -END - -3 TEXTINCLUDE -BEGIN - "\r\n" - "\0" -END - -#endif // APSTUDIO_INVOKED - - -///////////////////////////////////////////////////////////////////////////// -// -// Icon -// - -// Icon with lowest ID value placed first to ensure application icon -// remains consistent on all systems. -IDI_VPNSVR ICON "VPNSvr.ico" -#endif // Japanese resources -///////////////////////////////////////////////////////////////////////////// - - - -#ifndef APSTUDIO_INVOKED -///////////////////////////////////////////////////////////////////////////// -// -// Generated from the TEXTINCLUDE 3 resource. -// - - -///////////////////////////////////////////////////////////////////////////// -#endif // not APSTUDIO_INVOKED - +// Microsoft Visual C++ generated resource script. +// +#include "resource.h" + +#define APSTUDIO_READONLY_SYMBOLS +///////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 2 resource. +// +#include "winres.h" + +///////////////////////////////////////////////////////////////////////////// +#undef APSTUDIO_READONLY_SYMBOLS + +///////////////////////////////////////////////////////////////////////////// +// Japanese resources + +#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_JPN) +#ifdef _WIN32 +LANGUAGE LANG_JAPANESE, SUBLANG_DEFAULT +#pragma code_page(932) +#endif //_WIN32 + +#ifdef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// TEXTINCLUDE +// + +1 TEXTINCLUDE +BEGIN + "resource.h\0" +END + +2 TEXTINCLUDE +BEGIN + "#include ""winres.h""\r\n" + "\0" +END + +3 TEXTINCLUDE +BEGIN + "\r\n" + "\0" +END + +#endif // APSTUDIO_INVOKED + + +///////////////////////////////////////////////////////////////////////////// +// +// Icon +// + +// Icon with lowest ID value placed first to ensure application icon +// remains consistent on all systems. +IDI_VPNSVR ICON "VPNSvr.ico" +#endif // Japanese resources +///////////////////////////////////////////////////////////////////////////// + + + +#ifndef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 3 resource. +// + + +///////////////////////////////////////////////////////////////////////////// +#endif // not APSTUDIO_INVOKED + diff --git a/src/vpntest/resource.h b/src/vpntest/resource.h index 2f5bec73..e95d3e6e 100644 --- a/src/vpntest/resource.h +++ b/src/vpntest/resource.h @@ -1,19 +1,19 @@ -//{{NO_DEPENDENCIES}} -// Microsoft Visual C++ generated include file. -// Used by Ham.rc -// -#define IDR_TEST1 101 -#define IDI_ICON1 102 -#define IDI_CERT 102 -#define IDI_ICON2 103 - -// Next default values for new objects -// -#ifdef APSTUDIO_INVOKED -#ifndef APSTUDIO_READONLY_SYMBOLS -#define _APS_NEXT_RESOURCE_VALUE 104 -#define _APS_NEXT_COMMAND_VALUE 40001 -#define _APS_NEXT_CONTROL_VALUE 1001 -#define _APS_NEXT_SYMED_VALUE 101 -#endif -#endif +//{{NO_DEPENDENCIES}} +// Microsoft Visual C++ generated include file. +// Used by Ham.rc +// +#define IDR_TEST1 101 +#define IDI_ICON1 102 +#define IDI_CERT 102 +#define IDI_ICON2 103 + +// Next default values for new objects +// +#ifdef APSTUDIO_INVOKED +#ifndef APSTUDIO_READONLY_SYMBOLS +#define _APS_NEXT_RESOURCE_VALUE 104 +#define _APS_NEXT_COMMAND_VALUE 40001 +#define _APS_NEXT_CONTROL_VALUE 1001 +#define _APS_NEXT_SYMED_VALUE 101 +#endif +#endif diff --git a/src/vpntest/vpntest.c b/src/vpntest/vpntest.c index 8dd3061e..544ac836 100644 --- a/src/vpntest/vpntest.c +++ b/src/vpntest/vpntest.c @@ -1,269 +1,269 @@ -// vpntest.c -// VPN Server / VPN Client / VPN Bridge test program - -#include -#define VPN_EXE - -#include -#include -#include -#include -#include -#include -#include -#include -#include "vpntest.h" - -void client_test(UINT num, char **arg) -{ - Print("VPN Client Test. Press Enter key to stop the VPN Client .\n"); - CtStartClient(); - GetLine(NULL, 0); - CtStopClient(); -} - -void server_test(UINT num, char **arg) -{ - Print("VPN Server Test. Press Enter key to stop the VPN Server .\n"); - - StInit(); - - StStartServer(false); - - GetLine(NULL, 0); - - StStopServer(); - - StFree(); -} - -void bridge_test(UINT num, char **arg) -{ - Print("VPN Bridge Test. Press Enter key to stop the VPN Bridge .\n"); - - StInit(); - - StStartServer(true); - - GetLine(NULL, 0); - - StStopServer(); - - StFree(); -} - -#ifdef OS_WIN32 -void server_manager_test(UINT num, char **arg) -{ - SMExec(); -} - -void client_manager_test(UINT num, char **arg) -{ - CMExec(); -} - -void setup_test(UINT num, char **arg) -{ - char name[MAX_SIZE]; - Print("SetupAPI test. Please enter the name of the NIC I should retrieve the status of.\n"); - GetLine(name, sizeof(name)); - Print("Status: %s\n", MsIsVLanEnabledWithoutLock(name) ? "enabled" : "disabled"); -} -#endif - -void memory_leak_test(UINT num, char **arg) -{ - char *a = Malloc(1); - - Print("Hello, I am the great dictator of this kingdom!\n"); - Print("Just now I called Malloc(1) and never free! Ha ha ha !!\n"); -} - -// The list of test functions -// Test function definition list -typedef void (TEST_PROC)(UINT num, char **arg); - -typedef struct TEST_LIST -{ - char *command_str; - TEST_PROC *proc; - char *help; -} TEST_LIST; - -TEST_LIST test_list[] = -{ - {"c", client_test, "VPN Client in Test Mode, enter key to graceful stop."}, - {"s", server_test, "VPN Server in Test Mode, enter key to graceful stop."}, - {"b", bridge_test, "VPN Bridge in Test Mode, enter key to graceful stop."}, -#ifdef OS_WIN32 - {"sm", server_manager_test, "VPN Server Manager UI in Test Mode."}, - {"cm", client_manager_test, "VPN Client Manager UI in Test Mode."}, - {"setupapi", setup_test, "SetupAPI test: tries to retrieve the specified NIC's status."}, -#endif - {"memory_leak", memory_leak_test, "Memory leak test: Try to leak one byte by malloc()."}, -}; - -// Test function -int TestMain(char *cmd) -{ - char tmp[MAX_SIZE]; - bool first = true; - bool exit_now = false; - int status = 0; - - Print("SoftEther VPN Project\n"); - Print("vpntest: VPN Server / VPN Client / VPN Bridge test program\n"); - Print("Usage: vpntest [/memcheck] [command]\n\n"); - Print("Enter '?' or 'help' to show the command list.\n"); - Print("Enter 'q' or 'exit' to exit the process.\n\n"); - Print(" - In Jurassic Park: \"It's a UNIX system! I know this!\"\n\n"); - -#ifdef OS_WIN32 - MsSetEnableMinidump(true); -#endif // OS_WIN32 - - while (true) - { - Print("TEST>"); - if (first && StrLen(cmd) != 0 && g_memcheck == false) - { - first = false; - StrCpy(tmp, sizeof(tmp), cmd); - exit_now = true; - Print("%s\n", cmd); - } - else - { - GetLine(tmp, sizeof(tmp)); - } - Trim(tmp); - if (StrLen(tmp) != 0) - { - UINT i, num; - bool b = false; - TOKEN_LIST *token = ParseCmdLine(tmp); - char *cmd = token->Token[0]; - if (!StrCmpi(cmd, "exit") || !StrCmpi(cmd, "quit") || !StrCmpi(cmd, "q")) - { - FreeToken(token); - break; - } - else if (StrCmpi(cmd, "?") == 0 || StrCmpi(cmd, "help") == 0) - { - UINT max_len = 0; - Print("Available commands:\n\n"); - num = sizeof(test_list) / sizeof(TEST_LIST); - for (i = 0;i < num;i++) - { - TEST_LIST *t = &test_list[i]; - max_len = MAX(max_len, StrLen(t->command_str)); - } - for (i = 0;i < num;i++) - { - TEST_LIST *t = &test_list[i]; - UINT len = StrLen(t->command_str); - char *pad = NULL; - if (len < max_len) - { - UINT padlen = max_len - len; - pad = MakeCharArray(' ', padlen); - } - Print(" '%s'%s : %s\n", t->command_str, pad == NULL ? "" : pad, t->help); - if (pad != NULL) - { - Free(pad); - } - } - Print("\n"); - } - else if (StartWith(tmp, "vpncmd")) - { - wchar_t *s = CopyStrToUni(tmp); - CommandMain(s); - Free(s); - } - else - { - num = sizeof(test_list) / sizeof(TEST_LIST); - for (i = 0;i < num;i++) - { - if (!StrCmpi(test_list[i].command_str, cmd)) - { - char **arg = Malloc(sizeof(char *) * (token->NumTokens - 1)); - UINT j; - for (j = 0;j < token->NumTokens - 1;j++) - { - arg[j] = CopyStr(token->Token[j + 1]); - } - test_list[i].proc(token->NumTokens - 1, arg); - for (j = 0;j < token->NumTokens - 1;j++) - { - Free(arg[j]); - } - Free(arg); - b = true; - Print("\n"); - break; - } - } - if (b == false) - { - status = 2; - Print("Invalid Command: %s\n\n", cmd); - } - } - FreeToken(token); - - if (exit_now) - { - break; - } - } - } - Print("Exiting...\n\n"); - return status; -} - -// Main function -int main(int argc, char *argv[]) -{ - bool memchk = false; - UINT i; - char cmd[MAX_SIZE]; - char *s; - int status = 0; - - InitProcessCallOnce(); - - cmd[0] = 0; - if (argc >= 2) - { - for (i = 1;i < (UINT)argc;i++) - { - s = argv[i]; - if (s[0] == '/') - { - if (!StrCmpi(s, "/memcheck")) - { - memchk = true; - } - } - else - { - StrCpy(cmd, sizeof(cmd), &s[0]); - } - } - } - - InitMayaqua(memchk, true, argc, argv); - EnableProbe(true); - InitCedar(); - SetHamMode(); - status = TestMain(cmdline); - FreeCedar(); - FreeMayaqua(); - - return status; -} - +// vpntest.c +// VPN Server / VPN Client / VPN Bridge test program + +#include +#define VPN_EXE + +#include +#include +#include +#include +#include +#include +#include +#include +#include "vpntest.h" + +void client_test(UINT num, char **arg) +{ + Print("VPN Client Test. Press Enter key to stop the VPN Client .\n"); + CtStartClient(); + GetLine(NULL, 0); + CtStopClient(); +} + +void server_test(UINT num, char **arg) +{ + Print("VPN Server Test. Press Enter key to stop the VPN Server .\n"); + + StInit(); + + StStartServer(false); + + GetLine(NULL, 0); + + StStopServer(); + + StFree(); +} + +void bridge_test(UINT num, char **arg) +{ + Print("VPN Bridge Test. Press Enter key to stop the VPN Bridge .\n"); + + StInit(); + + StStartServer(true); + + GetLine(NULL, 0); + + StStopServer(); + + StFree(); +} + +#ifdef OS_WIN32 +void server_manager_test(UINT num, char **arg) +{ + SMExec(); +} + +void client_manager_test(UINT num, char **arg) +{ + CMExec(); +} + +void setup_test(UINT num, char **arg) +{ + char name[MAX_SIZE]; + Print("SetupAPI test. Please enter the name of the NIC I should retrieve the status of.\n"); + GetLine(name, sizeof(name)); + Print("Status: %s\n", MsIsVLanEnabledWithoutLock(name) ? "enabled" : "disabled"); +} +#endif + +void memory_leak_test(UINT num, char **arg) +{ + char *a = Malloc(1); + + Print("Hello, I am the great dictator of this kingdom!\n"); + Print("Just now I called Malloc(1) and never free! Ha ha ha !!\n"); +} + +// The list of test functions +// Test function definition list +typedef void (TEST_PROC)(UINT num, char **arg); + +typedef struct TEST_LIST +{ + char *command_str; + TEST_PROC *proc; + char *help; +} TEST_LIST; + +TEST_LIST test_list[] = +{ + {"c", client_test, "VPN Client in Test Mode, enter key to graceful stop."}, + {"s", server_test, "VPN Server in Test Mode, enter key to graceful stop."}, + {"b", bridge_test, "VPN Bridge in Test Mode, enter key to graceful stop."}, +#ifdef OS_WIN32 + {"sm", server_manager_test, "VPN Server Manager UI in Test Mode."}, + {"cm", client_manager_test, "VPN Client Manager UI in Test Mode."}, + {"setupapi", setup_test, "SetupAPI test: tries to retrieve the specified NIC's status."}, +#endif + {"memory_leak", memory_leak_test, "Memory leak test: Try to leak one byte by malloc()."}, +}; + +// Test function +int TestMain(char *cmd) +{ + char tmp[MAX_SIZE]; + bool first = true; + bool exit_now = false; + int status = 0; + + Print("SoftEther VPN Project\n"); + Print("vpntest: VPN Server / VPN Client / VPN Bridge test program\n"); + Print("Usage: vpntest [/memcheck] [command]\n\n"); + Print("Enter '?' or 'help' to show the command list.\n"); + Print("Enter 'q' or 'exit' to exit the process.\n\n"); + Print(" - In Jurassic Park: \"It's a UNIX system! I know this!\"\n\n"); + +#ifdef OS_WIN32 + MsSetEnableMinidump(true); +#endif // OS_WIN32 + + while (true) + { + Print("TEST>"); + if (first && StrLen(cmd) != 0 && g_memcheck == false) + { + first = false; + StrCpy(tmp, sizeof(tmp), cmd); + exit_now = true; + Print("%s\n", cmd); + } + else + { + GetLine(tmp, sizeof(tmp)); + } + Trim(tmp); + if (StrLen(tmp) != 0) + { + UINT i, num; + bool b = false; + TOKEN_LIST *token = ParseCmdLine(tmp); + char *cmd = token->Token[0]; + if (!StrCmpi(cmd, "exit") || !StrCmpi(cmd, "quit") || !StrCmpi(cmd, "q")) + { + FreeToken(token); + break; + } + else if (StrCmpi(cmd, "?") == 0 || StrCmpi(cmd, "help") == 0) + { + UINT max_len = 0; + Print("Available commands:\n\n"); + num = sizeof(test_list) / sizeof(TEST_LIST); + for (i = 0;i < num;i++) + { + TEST_LIST *t = &test_list[i]; + max_len = MAX(max_len, StrLen(t->command_str)); + } + for (i = 0;i < num;i++) + { + TEST_LIST *t = &test_list[i]; + UINT len = StrLen(t->command_str); + char *pad = NULL; + if (len < max_len) + { + UINT padlen = max_len - len; + pad = MakeCharArray(' ', padlen); + } + Print(" '%s'%s : %s\n", t->command_str, pad == NULL ? "" : pad, t->help); + if (pad != NULL) + { + Free(pad); + } + } + Print("\n"); + } + else if (StartWith(tmp, "vpncmd")) + { + wchar_t *s = CopyStrToUni(tmp); + CommandMain(s); + Free(s); + } + else + { + num = sizeof(test_list) / sizeof(TEST_LIST); + for (i = 0;i < num;i++) + { + if (!StrCmpi(test_list[i].command_str, cmd)) + { + char **arg = Malloc(sizeof(char *) * (token->NumTokens - 1)); + UINT j; + for (j = 0;j < token->NumTokens - 1;j++) + { + arg[j] = CopyStr(token->Token[j + 1]); + } + test_list[i].proc(token->NumTokens - 1, arg); + for (j = 0;j < token->NumTokens - 1;j++) + { + Free(arg[j]); + } + Free(arg); + b = true; + Print("\n"); + break; + } + } + if (b == false) + { + status = 2; + Print("Invalid Command: %s\n\n", cmd); + } + } + FreeToken(token); + + if (exit_now) + { + break; + } + } + } + Print("Exiting...\n\n"); + return status; +} + +// Main function +int main(int argc, char *argv[]) +{ + bool memchk = false; + UINT i; + char cmd[MAX_SIZE]; + char *s; + int status = 0; + + InitProcessCallOnce(); + + cmd[0] = 0; + if (argc >= 2) + { + for (i = 1;i < (UINT)argc;i++) + { + s = argv[i]; + if (s[0] == '/') + { + if (!StrCmpi(s, "/memcheck")) + { + memchk = true; + } + } + else + { + StrCpy(cmd, sizeof(cmd), &s[0]); + } + } + } + + InitMayaqua(memchk, true, argc, argv); + EnableProbe(true); + InitCedar(); + SetHamMode(); + status = TestMain(cmdline); + FreeCedar(); + FreeMayaqua(); + + return status; +} + diff --git a/src/vpntest/vpntest.h b/src/vpntest/vpntest.h index d3f5a12f..8b137891 100644 --- a/src/vpntest/vpntest.h +++ b/src/vpntest/vpntest.h @@ -1 +1 @@ - + diff --git a/src/vpntest/vpntest.rc b/src/vpntest/vpntest.rc index 86a3b0d6..85c49fc0 100644 --- a/src/vpntest/vpntest.rc +++ b/src/vpntest/vpntest.rc @@ -1,72 +1,72 @@ -// Microsoft Visual C++ generated resource script. -// -#include "resource.h" - -#define APSTUDIO_READONLY_SYMBOLS -///////////////////////////////////////////////////////////////////////////// -// -// Generated from the TEXTINCLUDE 2 resource. -// -#include "winres.h" - -///////////////////////////////////////////////////////////////////////////// -#undef APSTUDIO_READONLY_SYMBOLS - -///////////////////////////////////////////////////////////////////////////// -// Japanese resources - -#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_JPN) -#ifdef _WIN32 -LANGUAGE LANG_JAPANESE, SUBLANG_DEFAULT -#pragma code_page(932) -#endif //_WIN32 - -#ifdef APSTUDIO_INVOKED -///////////////////////////////////////////////////////////////////////////// -// -// TEXTINCLUDE -// - -1 TEXTINCLUDE -BEGIN - "resource.h\0" -END - -2 TEXTINCLUDE -BEGIN - "#include ""winres.h""\r\n" - "\0" -END - -3 TEXTINCLUDE -BEGIN - "\r\n" - "\0" -END - -#endif // APSTUDIO_INVOKED - - -///////////////////////////////////////////////////////////////////////////// -// -// Icon -// - -// Icon with lowest ID value placed first to ensure application icon -// remains consistent on all systems. -IDI_ICON2 ICON "vpntest.ico" -#endif // Japanese resources -///////////////////////////////////////////////////////////////////////////// - - - -#ifndef APSTUDIO_INVOKED -///////////////////////////////////////////////////////////////////////////// -// -// Generated from the TEXTINCLUDE 3 resource. -// - - -///////////////////////////////////////////////////////////////////////////// -#endif // not APSTUDIO_INVOKED - +// Microsoft Visual C++ generated resource script. +// +#include "resource.h" + +#define APSTUDIO_READONLY_SYMBOLS +///////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 2 resource. +// +#include "winres.h" + +///////////////////////////////////////////////////////////////////////////// +#undef APSTUDIO_READONLY_SYMBOLS + +///////////////////////////////////////////////////////////////////////////// +// Japanese resources + +#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_JPN) +#ifdef _WIN32 +LANGUAGE LANG_JAPANESE, SUBLANG_DEFAULT +#pragma code_page(932) +#endif //_WIN32 + +#ifdef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// TEXTINCLUDE +// + +1 TEXTINCLUDE +BEGIN + "resource.h\0" +END + +2 TEXTINCLUDE +BEGIN + "#include ""winres.h""\r\n" + "\0" +END + +3 TEXTINCLUDE +BEGIN + "\r\n" + "\0" +END + +#endif // APSTUDIO_INVOKED + + +///////////////////////////////////////////////////////////////////////////// +// +// Icon +// + +// Icon with lowest ID value placed first to ensure application icon +// remains consistent on all systems. +IDI_ICON2 ICON "vpntest.ico" +#endif // Japanese resources +///////////////////////////////////////////////////////////////////////////// + + + +#ifndef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 3 resource. +// + + +///////////////////////////////////////////////////////////////////////////// +#endif // not APSTUDIO_INVOKED + diff --git a/src/vpnweb/VpnWebControl.cpp b/src/vpnweb/VpnWebControl.cpp index fb298b96..020390a3 100644 --- a/src/vpnweb/VpnWebControl.cpp +++ b/src/vpnweb/VpnWebControl.cpp @@ -1,4 +1,4 @@ -// VpnWebControl.cpp : CVpnWebControl -#include "stdafx.h" -#include "VpnWebControl.h" - +// VpnWebControl.cpp : CVpnWebControl +#include "stdafx.h" +#include "VpnWebControl.h" + diff --git a/src/vpnweb/VpnWebControl.h b/src/vpnweb/VpnWebControl.h index 6c25bb8f..33e8317b 100644 --- a/src/vpnweb/VpnWebControl.h +++ b/src/vpnweb/VpnWebControl.h @@ -1,382 +1,382 @@ -#pragma once -#include "resource.h" -#include -#include "vpnweb.h" -#include "vpnwebdlg.h" - -#if defined(_WIN32_WCE) && !defined(_CE_DCOM) && !defined(_CE_ALLOW_SINGLE_THREADED_OBJECTS_IN_MTA) -#error "DCOM is not supported." -#endif - - -// CVpnWebControl -class ATL_NO_VTABLE CVpnWebControl : - public CComObjectRootEx, - public IDispatchImpl, - public IPersistStreamInitImpl, - public IOleControlImpl, - public IOleObjectImpl, - public IOleInPlaceActiveObjectImpl, - public IViewObjectExImpl, - public IOleInPlaceObjectWindowlessImpl, - public ISupportErrorInfo, - public IPersistStorageImpl, - public IPersistPropertyBagImpl, - public ISpecifyPropertyPagesImpl, - public IQuickActivateImpl, - public IObjectSafetyImpl, -#ifndef _WIN32_WCE - public IDataObjectImpl, -#endif - public IProvideClassInfo2Impl<&CLSID_VpnWebControl, NULL, &LIBID_vpnwebLib>, -#ifdef _WIN32_WCE - public IObjectSafetyImpl, -#endif - public CComCoClass, - public CComControl -{ -public: - - HWND hDlg; - - CVpnWebControl() - { - hDlg = NULL; - SIZE dlgSize; - - GetVpnWebDlgSize(&dlgSize); - - m_bWindowOnly = TRUE; - m_bAutoSize = TRUE; - m_bRecomposeOnResize = TRUE; - m_bResizeNatural = TRUE; - - setSize(dlgSize.cx, dlgSize.cy); - } - - DECLARE_OLEMISC_STATUS(OLEMISC_RECOMPOSEONRESIZE | - OLEMISC_CANTLINKINSIDE | - OLEMISC_INSIDEOUT | - OLEMISC_ACTIVATEWHENVISIBLE | - OLEMISC_SETCLIENTSITEFIRST - ) - - DECLARE_REGISTRY_RESOURCEID(IDR_VPNWEBCONTROL) - - - BEGIN_COM_MAP(CVpnWebControl) - COM_INTERFACE_ENTRY(IVpnWebControl) - COM_INTERFACE_ENTRY(IDispatch) - COM_INTERFACE_ENTRY(IViewObjectEx) - COM_INTERFACE_ENTRY(IViewObject2) - COM_INTERFACE_ENTRY(IViewObject) - COM_INTERFACE_ENTRY(IOleInPlaceObjectWindowless) - COM_INTERFACE_ENTRY(IOleInPlaceObject) - COM_INTERFACE_ENTRY2(IOleWindow, IOleInPlaceObjectWindowless) - COM_INTERFACE_ENTRY(IOleInPlaceActiveObject) - COM_INTERFACE_ENTRY(IOleControl) - COM_INTERFACE_ENTRY(IOleObject) - COM_INTERFACE_ENTRY(IPersistStreamInit) - COM_INTERFACE_ENTRY(IPersistPropertyBag) - COM_INTERFACE_ENTRY2(IPersist, IPersistStreamInit) - COM_INTERFACE_ENTRY(ISupportErrorInfo) - COM_INTERFACE_ENTRY(ISpecifyPropertyPages) - COM_INTERFACE_ENTRY(IQuickActivate) - COM_INTERFACE_ENTRY(IPersistStorage) - COM_INTERFACE_ENTRY(IObjectSafety) -#ifndef _WIN32_WCE - COM_INTERFACE_ENTRY(IDataObject) -#endif - COM_INTERFACE_ENTRY(IProvideClassInfo) - COM_INTERFACE_ENTRY(IProvideClassInfo2) -#ifdef _WIN32_WCE - COM_INTERFACE_ENTRY_IID(IID_IObjectSafety, IObjectSafety) -#endif - END_COM_MAP() - - BEGIN_PROP_MAP(CVpnWebControl) - //PROP_DATA_ENTRY("_cx", m_sizeExtent.cx, VT_UI4) - //PROP_DATA_ENTRY("_cy", m_sizeExtent.cy, VT_UI4) - PROP_ENTRY("InstallerExeUrl", 1, CVpnWebControl::GetObjectCLSID()) - PROP_ENTRY("InstallerInfUrl", 2, CVpnWebControl::GetObjectCLSID()) - PROP_ENTRY("SettingUrl", 3, CVpnWebControl::GetObjectCLSID()) - PROP_ENTRY("VpnServerManagerMode", 4, CVpnWebControl::GetObjectCLSID()) - PROP_ENTRY("VpnServerHostname", 5, CVpnWebControl::GetObjectCLSID()) - PROP_ENTRY("VpnServerHubName", 6, CVpnWebControl::GetObjectCLSID()) - PROP_ENTRY("VpnServerPassword", 7, CVpnWebControl::GetObjectCLSID()) - - PROP_ENTRY("LanguageID", 8, CVpnWebControl::GetObjectCLSID()) - PROP_ENTRY("LanguageID", 9, CVpnWebControl::GetObjectCLSID()) - - END_PROP_MAP() - - - BEGIN_MSG_MAP(CVpnWebControl) - MESSAGE_HANDLER(WM_CREATE, OnCreate) - CHAIN_MSG_MAP(CComControl) - DEFAULT_REFLECTION_HANDLER() - END_MSG_MAP() - // LRESULT MessageHandler(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled); - // LRESULT CommandHandler(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled); - // LRESULT NotifyHandler(int idCtrl, LPNMHDR pnmh, BOOL& bHandled); - - // ISupportsErrorInfo - STDMETHOD(InterfaceSupportsErrorInfo)(REFIID riid) - { - static const IID* arr[] = - { - &IID_IVpnWebControl, - }; - - for (int i=0; i::SetInterfaceSafetyOptions(riid, - dwSupportedOptions, dwEnabledOptions); - }*/ - - // IViewObjectEx - DECLARE_VIEW_STATUS(0) - - void setSize(UINT width, UINT height) - { - SIZEL src; - - ZeroMemory(&src, sizeof(src)); - - src.cx = width; - src.cy = height; - - AtlPixelToHiMetric(&src, &m_sizeNatural); - AtlPixelToHiMetric(&src, &m_sizeExtent); - } - -private: - CComBSTR m_installer_exe_url, m_installer_inf_url, m_setting_url, - m_vpnserver_manager_mode, m_vpnserver_hostname, m_vpnserver_hubname, - m_vpnserver_password; - CComBSTR m_language_id; - - // IVpnWebControl -public: - LRESULT OnCreate(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/) - { - RECT rc; - GetWindowRect(&rc); - rc.right -= rc.left; - rc.bottom -= rc.top; - rc.top = rc.left = 0; - - VPNWEBDLG_INIT init; - ZeroMemory(&init, sizeof(init)); - init.hControlWnd = m_hWnd; - - CW2A installer_exe_url(m_installer_exe_url); - CW2A installer_inf_url(m_installer_inf_url); - CW2A setting_url(m_setting_url); - CW2A vpnserver_manager_mode(m_vpnserver_manager_mode); - CW2A vpnserver_hostname(m_vpnserver_hostname); - CW2A vpnserver_hubname(m_vpnserver_hubname); - CW2A vpnserver_password(m_vpnserver_password); - CW2A language_id(m_language_id); - - if (installer_exe_url != NULL) - { - if (lstrlen(installer_exe_url) <= 256) - { - lstrcpy(init.InstallerExeUrl, installer_exe_url); - } - } - - if (installer_inf_url != NULL) - { - if (lstrlen(installer_inf_url) <= 256) - { - lstrcpy(init.InstallerInfUrl, installer_inf_url); - } - } - - if (setting_url != NULL) - { - if (lstrlen(setting_url) <= 256) - { - lstrcpy(init.SettingUrl, setting_url); - } - } - - if (vpnserver_manager_mode != NULL) - { - init.VpnServerManagerMode = (BOOL)strtod(vpnserver_manager_mode, NULL); - } - - if( m_language_id!=NULL ){ - if (lstrlen(language_id) <= 32) - { - lstrcpy(init.LanguageId, language_id); - } - } - if (init.VpnServerManagerMode) - { - if (vpnserver_hostname != NULL) - { - if (lstrlen(vpnserver_hostname) <= 256) - { - lstrcpy(init.VpnServerHostname, vpnserver_hostname); - } - } - - if (vpnserver_hubname != NULL) - { - if (lstrlen(vpnserver_hubname) <= 256) - { - lstrcpy(init.VpnServerHubName, vpnserver_hubname); - } - } - - if (vpnserver_password != NULL) - { - if (lstrlen(vpnserver_password) <= 256) - { - lstrcpy(init.VpnServerPassword, vpnserver_password); - } - } - } - - hDlg = InitVpnWebDlg(&init); - - return 0; - } - - HRESULT OnDraw(ATL_DRAWINFO& di) - { - return S_OK; - } - - - DECLARE_PROTECT_FINAL_CONSTRUCT() - - HRESULT FinalConstruct() - { - return S_OK; - } - - void FinalRelease() - { - FreeVpnWebDlg(); - } - - STDMETHODIMP get_InstallerExeUrl(BSTR* pVal) - { - *pVal = m_installer_exe_url.Copy(); - return S_OK; - } - - STDMETHODIMP put_InstallerExeUrl(BSTR newVal) - { - m_installer_exe_url = newVal; - return S_OK; - } - - STDMETHODIMP get_InstallerInfUrl(BSTR* pVal) - { - *pVal = m_installer_inf_url.Copy(); - return S_OK; - } - - STDMETHODIMP put_InstallerInfUrl(BSTR newVal) - { - m_installer_inf_url = newVal; - return S_OK; - } - - STDMETHODIMP get_SettingUrl(BSTR* pVal) - { - *pVal = m_setting_url.Copy(); - return S_OK; - } - - STDMETHODIMP put_SettingUrl(BSTR newVal) - { - m_setting_url = newVal; - return S_OK; - } - - STDMETHODIMP get_VpnServerManagerMode(BSTR* pVal) - { - *pVal = m_vpnserver_manager_mode.Copy(); - return S_OK; - } - - STDMETHODIMP put_VpnServerManagerMode(BSTR newVal) - { - m_vpnserver_manager_mode = newVal; - return S_OK; - } - - STDMETHODIMP get_VpnServerHostname(BSTR* pVal) - { - *pVal = m_vpnserver_hostname.Copy(); - return S_OK; - } - - STDMETHODIMP put_VpnServerHostname(BSTR newVal) - { - m_vpnserver_hostname = newVal; - return S_OK; - } - - STDMETHODIMP get_VpnServerHubName(BSTR* pVal) - { - *pVal = m_vpnserver_hubname.Copy(); - return S_OK; - } - - STDMETHODIMP put_VpnServerHubName(BSTR newVal) - { - m_vpnserver_hubname = newVal; - return S_OK; - } - - STDMETHODIMP get_VpnServerPassword(BSTR* pVal) - { - *pVal = m_vpnserver_password.Copy(); - return S_OK; - } - - STDMETHODIMP put_VpnServerPassword(BSTR newVal) - { - m_vpnserver_password = newVal; - return S_OK; - } - - STDMETHODIMP get_LanguageID(BSTR* pVal) - { - *pVal = m_language_id.Copy(); - return S_OK; - } - - STDMETHODIMP put_LanguageID(BSTR newVal) - { - m_language_id = newVal; - return S_OK; - } -}; - -OBJECT_ENTRY_AUTO(__uuidof(VpnWebControl), CVpnWebControl) +#pragma once +#include "resource.h" +#include +#include "vpnweb.h" +#include "vpnwebdlg.h" + +#if defined(_WIN32_WCE) && !defined(_CE_DCOM) && !defined(_CE_ALLOW_SINGLE_THREADED_OBJECTS_IN_MTA) +#error "DCOM is not supported." +#endif + + +// CVpnWebControl +class ATL_NO_VTABLE CVpnWebControl : + public CComObjectRootEx, + public IDispatchImpl, + public IPersistStreamInitImpl, + public IOleControlImpl, + public IOleObjectImpl, + public IOleInPlaceActiveObjectImpl, + public IViewObjectExImpl, + public IOleInPlaceObjectWindowlessImpl, + public ISupportErrorInfo, + public IPersistStorageImpl, + public IPersistPropertyBagImpl, + public ISpecifyPropertyPagesImpl, + public IQuickActivateImpl, + public IObjectSafetyImpl, +#ifndef _WIN32_WCE + public IDataObjectImpl, +#endif + public IProvideClassInfo2Impl<&CLSID_VpnWebControl, NULL, &LIBID_vpnwebLib>, +#ifdef _WIN32_WCE + public IObjectSafetyImpl, +#endif + public CComCoClass, + public CComControl +{ +public: + + HWND hDlg; + + CVpnWebControl() + { + hDlg = NULL; + SIZE dlgSize; + + GetVpnWebDlgSize(&dlgSize); + + m_bWindowOnly = TRUE; + m_bAutoSize = TRUE; + m_bRecomposeOnResize = TRUE; + m_bResizeNatural = TRUE; + + setSize(dlgSize.cx, dlgSize.cy); + } + + DECLARE_OLEMISC_STATUS(OLEMISC_RECOMPOSEONRESIZE | + OLEMISC_CANTLINKINSIDE | + OLEMISC_INSIDEOUT | + OLEMISC_ACTIVATEWHENVISIBLE | + OLEMISC_SETCLIENTSITEFIRST + ) + + DECLARE_REGISTRY_RESOURCEID(IDR_VPNWEBCONTROL) + + + BEGIN_COM_MAP(CVpnWebControl) + COM_INTERFACE_ENTRY(IVpnWebControl) + COM_INTERFACE_ENTRY(IDispatch) + COM_INTERFACE_ENTRY(IViewObjectEx) + COM_INTERFACE_ENTRY(IViewObject2) + COM_INTERFACE_ENTRY(IViewObject) + COM_INTERFACE_ENTRY(IOleInPlaceObjectWindowless) + COM_INTERFACE_ENTRY(IOleInPlaceObject) + COM_INTERFACE_ENTRY2(IOleWindow, IOleInPlaceObjectWindowless) + COM_INTERFACE_ENTRY(IOleInPlaceActiveObject) + COM_INTERFACE_ENTRY(IOleControl) + COM_INTERFACE_ENTRY(IOleObject) + COM_INTERFACE_ENTRY(IPersistStreamInit) + COM_INTERFACE_ENTRY(IPersistPropertyBag) + COM_INTERFACE_ENTRY2(IPersist, IPersistStreamInit) + COM_INTERFACE_ENTRY(ISupportErrorInfo) + COM_INTERFACE_ENTRY(ISpecifyPropertyPages) + COM_INTERFACE_ENTRY(IQuickActivate) + COM_INTERFACE_ENTRY(IPersistStorage) + COM_INTERFACE_ENTRY(IObjectSafety) +#ifndef _WIN32_WCE + COM_INTERFACE_ENTRY(IDataObject) +#endif + COM_INTERFACE_ENTRY(IProvideClassInfo) + COM_INTERFACE_ENTRY(IProvideClassInfo2) +#ifdef _WIN32_WCE + COM_INTERFACE_ENTRY_IID(IID_IObjectSafety, IObjectSafety) +#endif + END_COM_MAP() + + BEGIN_PROP_MAP(CVpnWebControl) + //PROP_DATA_ENTRY("_cx", m_sizeExtent.cx, VT_UI4) + //PROP_DATA_ENTRY("_cy", m_sizeExtent.cy, VT_UI4) + PROP_ENTRY("InstallerExeUrl", 1, CVpnWebControl::GetObjectCLSID()) + PROP_ENTRY("InstallerInfUrl", 2, CVpnWebControl::GetObjectCLSID()) + PROP_ENTRY("SettingUrl", 3, CVpnWebControl::GetObjectCLSID()) + PROP_ENTRY("VpnServerManagerMode", 4, CVpnWebControl::GetObjectCLSID()) + PROP_ENTRY("VpnServerHostname", 5, CVpnWebControl::GetObjectCLSID()) + PROP_ENTRY("VpnServerHubName", 6, CVpnWebControl::GetObjectCLSID()) + PROP_ENTRY("VpnServerPassword", 7, CVpnWebControl::GetObjectCLSID()) + + PROP_ENTRY("LanguageID", 8, CVpnWebControl::GetObjectCLSID()) + PROP_ENTRY("LanguageID", 9, CVpnWebControl::GetObjectCLSID()) + + END_PROP_MAP() + + + BEGIN_MSG_MAP(CVpnWebControl) + MESSAGE_HANDLER(WM_CREATE, OnCreate) + CHAIN_MSG_MAP(CComControl) + DEFAULT_REFLECTION_HANDLER() + END_MSG_MAP() + // LRESULT MessageHandler(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled); + // LRESULT CommandHandler(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled); + // LRESULT NotifyHandler(int idCtrl, LPNMHDR pnmh, BOOL& bHandled); + + // ISupportsErrorInfo + STDMETHOD(InterfaceSupportsErrorInfo)(REFIID riid) + { + static const IID* arr[] = + { + &IID_IVpnWebControl, + }; + + for (int i=0; i::SetInterfaceSafetyOptions(riid, + dwSupportedOptions, dwEnabledOptions); + }*/ + + // IViewObjectEx + DECLARE_VIEW_STATUS(0) + + void setSize(UINT width, UINT height) + { + SIZEL src; + + ZeroMemory(&src, sizeof(src)); + + src.cx = width; + src.cy = height; + + AtlPixelToHiMetric(&src, &m_sizeNatural); + AtlPixelToHiMetric(&src, &m_sizeExtent); + } + +private: + CComBSTR m_installer_exe_url, m_installer_inf_url, m_setting_url, + m_vpnserver_manager_mode, m_vpnserver_hostname, m_vpnserver_hubname, + m_vpnserver_password; + CComBSTR m_language_id; + + // IVpnWebControl +public: + LRESULT OnCreate(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/) + { + RECT rc; + GetWindowRect(&rc); + rc.right -= rc.left; + rc.bottom -= rc.top; + rc.top = rc.left = 0; + + VPNWEBDLG_INIT init; + ZeroMemory(&init, sizeof(init)); + init.hControlWnd = m_hWnd; + + CW2A installer_exe_url(m_installer_exe_url); + CW2A installer_inf_url(m_installer_inf_url); + CW2A setting_url(m_setting_url); + CW2A vpnserver_manager_mode(m_vpnserver_manager_mode); + CW2A vpnserver_hostname(m_vpnserver_hostname); + CW2A vpnserver_hubname(m_vpnserver_hubname); + CW2A vpnserver_password(m_vpnserver_password); + CW2A language_id(m_language_id); + + if (installer_exe_url != NULL) + { + if (lstrlen(installer_exe_url) <= 256) + { + lstrcpy(init.InstallerExeUrl, installer_exe_url); + } + } + + if (installer_inf_url != NULL) + { + if (lstrlen(installer_inf_url) <= 256) + { + lstrcpy(init.InstallerInfUrl, installer_inf_url); + } + } + + if (setting_url != NULL) + { + if (lstrlen(setting_url) <= 256) + { + lstrcpy(init.SettingUrl, setting_url); + } + } + + if (vpnserver_manager_mode != NULL) + { + init.VpnServerManagerMode = (BOOL)strtod(vpnserver_manager_mode, NULL); + } + + if( m_language_id!=NULL ){ + if (lstrlen(language_id) <= 32) + { + lstrcpy(init.LanguageId, language_id); + } + } + if (init.VpnServerManagerMode) + { + if (vpnserver_hostname != NULL) + { + if (lstrlen(vpnserver_hostname) <= 256) + { + lstrcpy(init.VpnServerHostname, vpnserver_hostname); + } + } + + if (vpnserver_hubname != NULL) + { + if (lstrlen(vpnserver_hubname) <= 256) + { + lstrcpy(init.VpnServerHubName, vpnserver_hubname); + } + } + + if (vpnserver_password != NULL) + { + if (lstrlen(vpnserver_password) <= 256) + { + lstrcpy(init.VpnServerPassword, vpnserver_password); + } + } + } + + hDlg = InitVpnWebDlg(&init); + + return 0; + } + + HRESULT OnDraw(ATL_DRAWINFO& di) + { + return S_OK; + } + + + DECLARE_PROTECT_FINAL_CONSTRUCT() + + HRESULT FinalConstruct() + { + return S_OK; + } + + void FinalRelease() + { + FreeVpnWebDlg(); + } + + STDMETHODIMP get_InstallerExeUrl(BSTR* pVal) + { + *pVal = m_installer_exe_url.Copy(); + return S_OK; + } + + STDMETHODIMP put_InstallerExeUrl(BSTR newVal) + { + m_installer_exe_url = newVal; + return S_OK; + } + + STDMETHODIMP get_InstallerInfUrl(BSTR* pVal) + { + *pVal = m_installer_inf_url.Copy(); + return S_OK; + } + + STDMETHODIMP put_InstallerInfUrl(BSTR newVal) + { + m_installer_inf_url = newVal; + return S_OK; + } + + STDMETHODIMP get_SettingUrl(BSTR* pVal) + { + *pVal = m_setting_url.Copy(); + return S_OK; + } + + STDMETHODIMP put_SettingUrl(BSTR newVal) + { + m_setting_url = newVal; + return S_OK; + } + + STDMETHODIMP get_VpnServerManagerMode(BSTR* pVal) + { + *pVal = m_vpnserver_manager_mode.Copy(); + return S_OK; + } + + STDMETHODIMP put_VpnServerManagerMode(BSTR newVal) + { + m_vpnserver_manager_mode = newVal; + return S_OK; + } + + STDMETHODIMP get_VpnServerHostname(BSTR* pVal) + { + *pVal = m_vpnserver_hostname.Copy(); + return S_OK; + } + + STDMETHODIMP put_VpnServerHostname(BSTR newVal) + { + m_vpnserver_hostname = newVal; + return S_OK; + } + + STDMETHODIMP get_VpnServerHubName(BSTR* pVal) + { + *pVal = m_vpnserver_hubname.Copy(); + return S_OK; + } + + STDMETHODIMP put_VpnServerHubName(BSTR newVal) + { + m_vpnserver_hubname = newVal; + return S_OK; + } + + STDMETHODIMP get_VpnServerPassword(BSTR* pVal) + { + *pVal = m_vpnserver_password.Copy(); + return S_OK; + } + + STDMETHODIMP put_VpnServerPassword(BSTR newVal) + { + m_vpnserver_password = newVal; + return S_OK; + } + + STDMETHODIMP get_LanguageID(BSTR* pVal) + { + *pVal = m_language_id.Copy(); + return S_OK; + } + + STDMETHODIMP put_LanguageID(BSTR newVal) + { + m_language_id = newVal; + return S_OK; + } +}; + +OBJECT_ENTRY_AUTO(__uuidof(VpnWebControl), CVpnWebControl) diff --git a/src/vpnweb/VpnWebControl.rgs b/src/vpnweb/VpnWebControl.rgs index a143dc71..f40b07ba 100644 --- a/src/vpnweb/VpnWebControl.rgs +++ b/src/vpnweb/VpnWebControl.rgs @@ -1,34 +1,34 @@ -HKCR -{ - vpnweb.VpnWebControl.1 = s 'VpnWebControl Class' - { - CLSID = s '{64F1A16B-C3EE-484C-B551-35338A9BB6D2}' - } - vpnweb.VpnWebControl = s 'VpnWebControl Class' - { - CLSID = s '{64F1A16B-C3EE-484C-B551-35338A9BB6D2}' - CurVer = s 'vpnweb.VpnWebControl.1' - } - NoRemove CLSID - { - ForceRemove {64F1A16B-C3EE-484C-B551-35338A9BB6D2} = s 'VpnWebControl Class' - { - ProgID = s 'vpnweb.VpnWebControl.1' - VersionIndependentProgID = s 'vpnweb.VpnWebControl' - ForceRemove 'Programmable' - InprocServer32 = s '%MODULE%' - { - val ThreadingModel = s 'Apartment' - } - val AppID = s '%APPID%' - ForceRemove 'Control' - ForceRemove 'ToolboxBitmap32' = s '%MODULE%, 102' - 'MiscStatus' = s '0' - { - '1' = s '%OLEMISC%' - } - 'TypeLib' = s '{D8FDDBA5-B33F-4B0A-8162-A771ECD32B04}' - 'Version' = s '1.0' - } - } -} +HKCR +{ + vpnweb.VpnWebControl.1 = s 'VpnWebControl Class' + { + CLSID = s '{64F1A16B-C3EE-484C-B551-35338A9BB6D2}' + } + vpnweb.VpnWebControl = s 'VpnWebControl Class' + { + CLSID = s '{64F1A16B-C3EE-484C-B551-35338A9BB6D2}' + CurVer = s 'vpnweb.VpnWebControl.1' + } + NoRemove CLSID + { + ForceRemove {64F1A16B-C3EE-484C-B551-35338A9BB6D2} = s 'VpnWebControl Class' + { + ProgID = s 'vpnweb.VpnWebControl.1' + VersionIndependentProgID = s 'vpnweb.VpnWebControl' + ForceRemove 'Programmable' + InprocServer32 = s '%MODULE%' + { + val ThreadingModel = s 'Apartment' + } + val AppID = s '%APPID%' + ForceRemove 'Control' + ForceRemove 'ToolboxBitmap32' = s '%MODULE%, 102' + 'MiscStatus' = s '0' + { + '1' = s '%OLEMISC%' + } + 'TypeLib' = s '{D8FDDBA5-B33F-4B0A-8162-A771ECD32B04}' + 'Version' = s '1.0' + } + } +} diff --git a/src/vpnweb/dlldata.c b/src/vpnweb/dlldata.c index 714d7e30..432eda3b 100644 --- a/src/vpnweb/dlldata.c +++ b/src/vpnweb/dlldata.c @@ -1,38 +1,38 @@ -/********************************************************* - DllData file -- generated by MIDL compiler - - DO NOT ALTER THIS FILE - - This file is regenerated by MIDL on every IDL file compile. - - To completely reconstruct this file, delete it and rerun MIDL - on all the IDL files in this DLL, specifying this file for the - /dlldata command line option - -*********************************************************/ - -#define PROXY_DELEGATION - -#include - -#ifdef __cplusplus -extern "C" { -#endif - -EXTERN_PROXY_FILE( vpnweb ) - - -PROXYFILE_LIST_START -/* Start of list */ - REFERENCE_PROXY_FILE( vpnweb ), -/* End of list */ -PROXYFILE_LIST_END - - -DLLDATA_ROUTINES( aProxyFileList, GET_DLL_CLSID ) - -#ifdef __cplusplus -} /*extern "C" */ -#endif - -/* end of generated dlldata file */ +/********************************************************* + DllData file -- generated by MIDL compiler + + DO NOT ALTER THIS FILE + + This file is regenerated by MIDL on every IDL file compile. + + To completely reconstruct this file, delete it and rerun MIDL + on all the IDL files in this DLL, specifying this file for the + /dlldata command line option + +*********************************************************/ + +#define PROXY_DELEGATION + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +EXTERN_PROXY_FILE( vpnweb ) + + +PROXYFILE_LIST_START +/* Start of list */ + REFERENCE_PROXY_FILE( vpnweb ), +/* End of list */ +PROXYFILE_LIST_END + + +DLLDATA_ROUTINES( aProxyFileList, GET_DLL_CLSID ) + +#ifdef __cplusplus +} /*extern "C" */ +#endif + +/* end of generated dlldata file */ diff --git a/src/vpnweb/resource.h b/src/vpnweb/resource.h index 3ce75431..36bbb866 100644 --- a/src/vpnweb/resource.h +++ b/src/vpnweb/resource.h @@ -1,80 +1,80 @@ -//{{NO_DEPENDENCIES}} -// Microsoft Visual C++ generated include file. -// Used by vpnweb.rc -// -#define IDS_PROJNAME 100 -#define IDR_VPNWEB 101 -#define IDB_VPNWEBCONTROL 102 -#define IDR_VPNWEBCONTROL 103 -#define IDD_VPNWEBDLG 201 -#define IDC_PROGRESS1 201 -#define P_PROGRESS 201 -#define IDI_VPN 202 -#define S_INFO 202 -#define S_INFO2 203 -#define IDC_BUTTON1 204 -#define IDI_ICON1 204 -#define IDI_SERVER 204 -#define S_ICON_VPN 205 -#define S_ICON_SERVER 206 -#define B_START 207 -#define IDS_MESSAGE_APPTITLE 10001 -#define IDS_STRING10002 10002 -#define IDS_STRING10003 10003 -#define IDS_STRING10004 10004 -#define IDS_STRING10005 10005 -#define IDS_STRING10006 10006 -#define IDS_STRING10007 10007 -#define IDS_STRING10008 10008 -#define IDS_STRING10009 10009 -#define IDS_STRING10010 10010 -#define IDS_STRING10011 10011 -#define IDS_STRING10012 10012 -#define IDS_STRING10013 10013 -#define IDS_STRING10014 10014 -#define IDS_STRING10015 10015 -#define IDS_STRING10016 10016 -#define IDS_STRING10017 10017 -#define IDS_STRING10018 10018 -#define IDS_STRING10019 10019 -#define IDS_MESSAGE_APPTITLE_EN 11001 -#define IDS_STRING11002 11002 -#define IDS_STRING10020 11003 -#define IDS_STRING11003 11003 -#define IDS_STRING10021 11004 -#define IDS_STRING11004 11004 -#define IDS_STRING10022 11005 -#define IDS_STRING11005 11005 -#define IDS_STRING10023 11006 -#define IDS_STRING11006 11006 -#define IDS_STRING10024 11007 -#define IDS_STRING11007 11007 -#define IDS_STRING10025 11008 -#define IDS_STRING11008 11008 -#define IDS_STRING10026 11009 -#define IDS_STRING11009 11009 -#define IDS_STRING10027 11010 -#define IDS_STRING11010 11010 -#define IDS_STRING10028 11011 -#define IDS_STRING11011 11011 -#define IDS_STRING10029 11012 -#define IDS_STRING11012 11012 -#define IDS_STRING101 11013 -#define IDS_STRING11013 11013 -#define IDS_STRING11014 11014 -#define IDS_STRING11015 11015 -#define IDS_STRING11016 11016 -#define IDS_STRING11017 11017 -#define IDS_STRING11018 11018 -#define IDS_STRING11019 11019 - -// Next default values for new objects -// -#ifdef APSTUDIO_INVOKED -#ifndef APSTUDIO_READONLY_SYMBOLS -#define _APS_NEXT_RESOURCE_VALUE 205 -#define _APS_NEXT_COMMAND_VALUE 32768 -#define _APS_NEXT_CONTROL_VALUE 206 -#define _APS_NEXT_SYMED_VALUE 104 -#endif -#endif +//{{NO_DEPENDENCIES}} +// Microsoft Visual C++ generated include file. +// Used by vpnweb.rc +// +#define IDS_PROJNAME 100 +#define IDR_VPNWEB 101 +#define IDB_VPNWEBCONTROL 102 +#define IDR_VPNWEBCONTROL 103 +#define IDD_VPNWEBDLG 201 +#define IDC_PROGRESS1 201 +#define P_PROGRESS 201 +#define IDI_VPN 202 +#define S_INFO 202 +#define S_INFO2 203 +#define IDC_BUTTON1 204 +#define IDI_ICON1 204 +#define IDI_SERVER 204 +#define S_ICON_VPN 205 +#define S_ICON_SERVER 206 +#define B_START 207 +#define IDS_MESSAGE_APPTITLE 10001 +#define IDS_STRING10002 10002 +#define IDS_STRING10003 10003 +#define IDS_STRING10004 10004 +#define IDS_STRING10005 10005 +#define IDS_STRING10006 10006 +#define IDS_STRING10007 10007 +#define IDS_STRING10008 10008 +#define IDS_STRING10009 10009 +#define IDS_STRING10010 10010 +#define IDS_STRING10011 10011 +#define IDS_STRING10012 10012 +#define IDS_STRING10013 10013 +#define IDS_STRING10014 10014 +#define IDS_STRING10015 10015 +#define IDS_STRING10016 10016 +#define IDS_STRING10017 10017 +#define IDS_STRING10018 10018 +#define IDS_STRING10019 10019 +#define IDS_MESSAGE_APPTITLE_EN 11001 +#define IDS_STRING11002 11002 +#define IDS_STRING10020 11003 +#define IDS_STRING11003 11003 +#define IDS_STRING10021 11004 +#define IDS_STRING11004 11004 +#define IDS_STRING10022 11005 +#define IDS_STRING11005 11005 +#define IDS_STRING10023 11006 +#define IDS_STRING11006 11006 +#define IDS_STRING10024 11007 +#define IDS_STRING11007 11007 +#define IDS_STRING10025 11008 +#define IDS_STRING11008 11008 +#define IDS_STRING10026 11009 +#define IDS_STRING11009 11009 +#define IDS_STRING10027 11010 +#define IDS_STRING11010 11010 +#define IDS_STRING10028 11011 +#define IDS_STRING11011 11011 +#define IDS_STRING10029 11012 +#define IDS_STRING11012 11012 +#define IDS_STRING101 11013 +#define IDS_STRING11013 11013 +#define IDS_STRING11014 11014 +#define IDS_STRING11015 11015 +#define IDS_STRING11016 11016 +#define IDS_STRING11017 11017 +#define IDS_STRING11018 11018 +#define IDS_STRING11019 11019 + +// Next default values for new objects +// +#ifdef APSTUDIO_INVOKED +#ifndef APSTUDIO_READONLY_SYMBOLS +#define _APS_NEXT_RESOURCE_VALUE 205 +#define _APS_NEXT_COMMAND_VALUE 32768 +#define _APS_NEXT_CONTROL_VALUE 206 +#define _APS_NEXT_SYMED_VALUE 104 +#endif +#endif diff --git a/src/vpnweb/stdafx.cpp b/src/vpnweb/stdafx.cpp index a27b824d..fd4f341c 100644 --- a/src/vpnweb/stdafx.cpp +++ b/src/vpnweb/stdafx.cpp @@ -1 +1 @@ -#include "stdafx.h" +#include "stdafx.h" diff --git a/src/vpnweb/stdafx.h b/src/vpnweb/stdafx.h index d5dd2200..d4ced21e 100644 --- a/src/vpnweb/stdafx.h +++ b/src/vpnweb/stdafx.h @@ -1,35 +1,35 @@ -#include - -#pragma once - -#ifndef STRICT -#define STRICT -#endif -#ifndef WINVER -#define WINVER 0x0502 -#endif - -#ifndef _WIN32_WINNT -#define _WIN32_WINNT 0x0502 -#endif - -#ifndef _WIN32_WINDOWS -#define _WIN32_WINDOWS 0x0410 -#endif - -#ifndef _WIN32_IE -#define _WIN32_IE 0x0600 -#endif - -#define _ATL_APARTMENT_THREADED -#define _ATL_NO_AUTOMATIC_NAMESPACE - -#define _ATL_CSTRING_EXPLICIT_CONSTRUCTORS - - -#include "resource.h" -#include -#include - -using namespace ATL; - +#include + +#pragma once + +#ifndef STRICT +#define STRICT +#endif +#ifndef WINVER +#define WINVER 0x0502 +#endif + +#ifndef _WIN32_WINNT +#define _WIN32_WINNT 0x0502 +#endif + +#ifndef _WIN32_WINDOWS +#define _WIN32_WINDOWS 0x0410 +#endif + +#ifndef _WIN32_IE +#define _WIN32_IE 0x0600 +#endif + +#define _ATL_APARTMENT_THREADED +#define _ATL_NO_AUTOMATIC_NAMESPACE + +#define _ATL_CSTRING_EXPLICIT_CONSTRUCTORS + + +#include "resource.h" +#include +#include + +using namespace ATL; + diff --git a/src/vpnweb/vpnweb.cpp b/src/vpnweb/vpnweb.cpp index bdb0f4fc..e8a0244e 100644 --- a/src/vpnweb/vpnweb.cpp +++ b/src/vpnweb/vpnweb.cpp @@ -1,61 +1,61 @@ -#include "stdafx.h" -#include "resource.h" -#include "vpnweb.h" - -extern "C" { -HINSTANCE hDllInstance; -} - - -class CvpnwebModule : public CAtlDllModuleT< CvpnwebModule > -{ -public : - DECLARE_LIBID(LIBID_vpnwebLib) - DECLARE_REGISTRY_APPID_RESOURCEID(IDR_VPNWEB, "{7CE8BF01-70D6-48F6-A83A-69CA03D885C9}") -}; - -CvpnwebModule _AtlModule; - - -#ifdef _MANAGED -#pragma managed(push, off) -#endif - -extern "C" BOOL WINAPI DllMain(HINSTANCE hInstance, DWORD dwReason, LPVOID lpReserved) -{ - hDllInstance = hInstance; - return _AtlModule.DllMain(dwReason, lpReserved); -} - -#ifdef _MANAGED -#pragma managed(pop) -#endif - - - - -STDAPI DllCanUnloadNow(void) -{ - return _AtlModule.DllCanUnloadNow(); -} - - -STDAPI DllGetClassObject(REFCLSID rclsid, REFIID riid, LPVOID* ppv) -{ - return _AtlModule.DllGetClassObject(rclsid, riid, ppv); -} - - -STDAPI DllRegisterServer(void) -{ - HRESULT hr = _AtlModule.DllRegisterServer(); - return hr; -} - - -STDAPI DllUnregisterServer(void) -{ - HRESULT hr = _AtlModule.DllUnregisterServer(); - return hr; -} - +#include "stdafx.h" +#include "resource.h" +#include "vpnweb.h" + +extern "C" { +HINSTANCE hDllInstance; +} + + +class CvpnwebModule : public CAtlDllModuleT< CvpnwebModule > +{ +public : + DECLARE_LIBID(LIBID_vpnwebLib) + DECLARE_REGISTRY_APPID_RESOURCEID(IDR_VPNWEB, "{7CE8BF01-70D6-48F6-A83A-69CA03D885C9}") +}; + +CvpnwebModule _AtlModule; + + +#ifdef _MANAGED +#pragma managed(push, off) +#endif + +extern "C" BOOL WINAPI DllMain(HINSTANCE hInstance, DWORD dwReason, LPVOID lpReserved) +{ + hDllInstance = hInstance; + return _AtlModule.DllMain(dwReason, lpReserved); +} + +#ifdef _MANAGED +#pragma managed(pop) +#endif + + + + +STDAPI DllCanUnloadNow(void) +{ + return _AtlModule.DllCanUnloadNow(); +} + + +STDAPI DllGetClassObject(REFCLSID rclsid, REFIID riid, LPVOID* ppv) +{ + return _AtlModule.DllGetClassObject(rclsid, riid, ppv); +} + + +STDAPI DllRegisterServer(void) +{ + HRESULT hr = _AtlModule.DllRegisterServer(); + return hr; +} + + +STDAPI DllUnregisterServer(void) +{ + HRESULT hr = _AtlModule.DllUnregisterServer(); + return hr; +} + diff --git a/src/vpnweb/vpnweb.def b/src/vpnweb/vpnweb.def index 58c191f3..7dccb7c7 100644 --- a/src/vpnweb/vpnweb.def +++ b/src/vpnweb/vpnweb.def @@ -1,7 +1,7 @@ -LIBRARY "vpnweb.ocx" - -EXPORTS - DllCanUnloadNow PRIVATE - DllGetClassObject PRIVATE - DllRegisterServer PRIVATE - DllUnregisterServer PRIVATE +LIBRARY "vpnweb.ocx" + +EXPORTS + DllCanUnloadNow PRIVATE + DllGetClassObject PRIVATE + DllRegisterServer PRIVATE + DllUnregisterServer PRIVATE diff --git a/src/vpnweb/vpnweb.idl b/src/vpnweb/vpnweb.idl index 8e13438c..823b0ad0 100644 --- a/src/vpnweb/vpnweb.idl +++ b/src/vpnweb/vpnweb.idl @@ -1,51 +1,51 @@ -#include "olectl.h" -import "oaidl.idl"; -import "ocidl.idl"; - -[ - object, - uuid(BEAC96A9-05ED-46B3-975C-4462E83878F5), - dual, - nonextensible, - helpstring("IVpnWebControl Interface"), - pointer_default(unique) -] -interface IVpnWebControl : IDispatch{ - [propget, id(1), helpstring("InstallerExeUrl Property")] HRESULT InstallerExeUrl([out, retval] BSTR* pVal); - [propput, id(1), helpstring("InstallerExeUrl Property")] HRESULT InstallerExeUrl([in] BSTR newVal); - [propget, id(2), helpstring("InstallerInfUrl Property")] HRESULT InstallerInfUrl([out, retval] BSTR* pVal); - [propput, id(2), helpstring("InstallerInfUrl Property")] HRESULT InstallerInfUrl([in] BSTR newVal); - [propget, id(3), helpstring("SettingUrl Property")] HRESULT SettingUrl([out, retval] BSTR* pVal); - [propput, id(3), helpstring("SettingUrl Property")] HRESULT SettingUrl([in] BSTR newVal); - [propget, id(4), helpstring("VpnServerManagerMode Property")] HRESULT VpnServerManagerMode([out, retval] BSTR* pVal); - [propput, id(4), helpstring("VpnServerManagerMode Property")] HRESULT VpnServerManagerMode([in] BSTR newVal); - [propget, id(5), helpstring("VpnServerHostname Property")] HRESULT VpnServerHostname([out, retval] BSTR* pVal); - [propput, id(5), helpstring("VpnServerHostname Property")] HRESULT VpnServerHostname([in] BSTR newVal); - [propget, id(6), helpstring("VpnServerHubName Property")] HRESULT VpnServerHubName([out, retval] BSTR* pVal); - [propput, id(6), helpstring("VpnServerHubName Property")] HRESULT VpnServerHubName([in] BSTR newVal); - [propget, id(7), helpstring("VpnServerPassword Property")] HRESULT VpnServerPassword([out, retval] BSTR* pVal); - [propput, id(7), helpstring("VpnServerPassword Property")] HRESULT VpnServerPassword([in] BSTR newVal); - [propget, id(8), helpstring("Language Property")] HRESULT LanguageID([out, retval] BSTR* pVal); - [propput, id(8), helpstring("Language Property")] HRESULT LanguageID([in] BSTR newVal); -}; - -[ - uuid(D8FDDBA5-B33F-4B0A-8162-A771ECD32B04), - version(1.0), - helpstring("VPN Client Web Installer Version Library") -] -library vpnwebLib -{ - importlib("stdole2.tlb"); - [ - uuid(64F1A16B-C3EE-484C-B551-35338A9BB6D2), - control, - helpstring("VPN Client Web Installer") - ] - coclass VpnWebControl - { - [default] interface IVpnWebControl; - }; - - -}; +#include "olectl.h" +import "oaidl.idl"; +import "ocidl.idl"; + +[ + object, + uuid(BEAC96A9-05ED-46B3-975C-4462E83878F5), + dual, + nonextensible, + helpstring("IVpnWebControl Interface"), + pointer_default(unique) +] +interface IVpnWebControl : IDispatch{ + [propget, id(1), helpstring("InstallerExeUrl Property")] HRESULT InstallerExeUrl([out, retval] BSTR* pVal); + [propput, id(1), helpstring("InstallerExeUrl Property")] HRESULT InstallerExeUrl([in] BSTR newVal); + [propget, id(2), helpstring("InstallerInfUrl Property")] HRESULT InstallerInfUrl([out, retval] BSTR* pVal); + [propput, id(2), helpstring("InstallerInfUrl Property")] HRESULT InstallerInfUrl([in] BSTR newVal); + [propget, id(3), helpstring("SettingUrl Property")] HRESULT SettingUrl([out, retval] BSTR* pVal); + [propput, id(3), helpstring("SettingUrl Property")] HRESULT SettingUrl([in] BSTR newVal); + [propget, id(4), helpstring("VpnServerManagerMode Property")] HRESULT VpnServerManagerMode([out, retval] BSTR* pVal); + [propput, id(4), helpstring("VpnServerManagerMode Property")] HRESULT VpnServerManagerMode([in] BSTR newVal); + [propget, id(5), helpstring("VpnServerHostname Property")] HRESULT VpnServerHostname([out, retval] BSTR* pVal); + [propput, id(5), helpstring("VpnServerHostname Property")] HRESULT VpnServerHostname([in] BSTR newVal); + [propget, id(6), helpstring("VpnServerHubName Property")] HRESULT VpnServerHubName([out, retval] BSTR* pVal); + [propput, id(6), helpstring("VpnServerHubName Property")] HRESULT VpnServerHubName([in] BSTR newVal); + [propget, id(7), helpstring("VpnServerPassword Property")] HRESULT VpnServerPassword([out, retval] BSTR* pVal); + [propput, id(7), helpstring("VpnServerPassword Property")] HRESULT VpnServerPassword([in] BSTR newVal); + [propget, id(8), helpstring("Language Property")] HRESULT LanguageID([out, retval] BSTR* pVal); + [propput, id(8), helpstring("Language Property")] HRESULT LanguageID([in] BSTR newVal); +}; + +[ + uuid(D8FDDBA5-B33F-4B0A-8162-A771ECD32B04), + version(1.0), + helpstring("VPN Client Web Installer Version Library") +] +library vpnwebLib +{ + importlib("stdole2.tlb"); + [ + uuid(64F1A16B-C3EE-484C-B551-35338A9BB6D2), + control, + helpstring("VPN Client Web Installer") + ] + coclass VpnWebControl + { + [default] interface IVpnWebControl; + }; + + +}; diff --git a/src/vpnweb/vpnweb.rc b/src/vpnweb/vpnweb.rc index 05734103..6c5b2f37 100644 --- a/src/vpnweb/vpnweb.rc +++ b/src/vpnweb/vpnweb.rc @@ -1,188 +1,188 @@ -// Microsoft Visual C++ generated resource script. -// -#include "resource.h" - -#define APSTUDIO_READONLY_SYMBOLS -///////////////////////////////////////////////////////////////////////////// -// -// Generated from the TEXTINCLUDE 2 resource. -// -#include "winres.h" - -///////////////////////////////////////////////////////////////////////////// -#undef APSTUDIO_READONLY_SYMBOLS - -///////////////////////////////////////////////////////////////////////////// -// Japanese resources - -#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_JPN) -#ifdef _WIN32 -LANGUAGE LANG_JAPANESE, SUBLANG_DEFAULT -#pragma code_page(932) -#endif //_WIN32 - -#ifdef APSTUDIO_INVOKED -///////////////////////////////////////////////////////////////////////////// -// -// TEXTINCLUDE -// - -1 TEXTINCLUDE -BEGIN - "resource.h\0" -END - -2 TEXTINCLUDE -BEGIN - "#include ""winres.h""\r\n" - "\0" -END - -3 TEXTINCLUDE -BEGIN - "1 TYPELIB ""vpnweb.tlb""\r\n" - "\0" -END - -#endif // APSTUDIO_INVOKED - - -///////////////////////////////////////////////////////////////////////////// -// -// REGISTRY -// - -IDR_VPNWEB REGISTRY "vpnweb.rgs" -IDR_VPNWEBCONTROL REGISTRY "VpnWebControl.rgs" - -///////////////////////////////////////////////////////////////////////////// -// -// Bitmap -// - -IDB_VPNWEBCONTROL BITMAP "VpnWebControl.bmp" - -///////////////////////////////////////////////////////////////////////////// -// -// Dialog -// - -IDD_VPNWEBDLG DIALOGEX 0, 0, 240, 84 -STYLE DS_SETFONT | WS_CHILD -FONT 11, "Segoe UI", 400, 0, 0x0 -BEGIN - ICON IDI_VPN,S_ICON_VPN,2,4,16,13 - LTEXT "҂...",S_INFO,26,4,209,59 - CONTROL "",P_PROGRESS,"msctls_progress32",WS_BORDER,2,66,233,12 - LTEXT "[VPN ڑ̊Jn] {^NbNƁAVPN ڑJn܂B",S_INFO2,26,4,209,46 - DEFPUSHBUTTON "VPN ڑ̊Jn",B_START,68,51,107,23 - ICON IDI_SERVER,S_ICON_SERVER,2,4,16,13 -END - - -///////////////////////////////////////////////////////////////////////////// -// -// DESIGNINFO -// - -#ifdef APSTUDIO_INVOKED -GUIDELINES DESIGNINFO -BEGIN - IDD_VPNWEBDLG, DIALOG - BEGIN - LEFTMARGIN, 2 - TOPMARGIN, 3 - END -END -#endif // APSTUDIO_INVOKED - - -///////////////////////////////////////////////////////////////////////////// -// -// Icon -// - -// Icon with lowest ID value placed first to ensure application icon -// remains consistent on all systems. -IDI_VPN ICON "VPN.ico" -IDI_SERVER ICON "VPNSvr.ico" - -///////////////////////////////////////////////////////////////////////////// -// -// String Table -// - -STRINGTABLE -BEGIN - IDS_PROJNAME "vpnweb" -END - -STRINGTABLE -BEGIN - IDS_MESSAGE_APPTITLE "VPN \tgEFA Web CXg[" - IDS_STRING10002 "VPN \tgEFA Web CXg[́ÃIy[eBOVXeT|[gĂ܂BWeb CXg[ Windows 2000 / XP / Server 2003 / Vista / Server 2008 / 7 / Server 2008 R2 ɑΉĂ܂B蓮 VPN \tgEFACXg[ĂB" - IDS_STRING10003 "VPN \tgEFȀmFĂ܂..." - IDS_STRING10004 "t@C %S ̃_E[hɎs܂B\r\nVPN \tgEFÃCXg[𒆎~܂B" - IDS_STRING10005 "t@C %S ̓e܂B\r\nVPN \tgEFÃCXg[𒆎~܂B" - IDS_STRING10006 "ꎞt@C %s 쐬ł܂łB" - IDS_STRING10007 "Kvȃf[^̎擾 VPN \tgEFÃCXg[...\r\n҂B\r\n\r\nql̃Rs[^̌lȂǂC^[lbgɑM邱Ƃ͂܂B" - IDS_STRING10008 "vZX %S Nł܂łB\r\nVPN \tgEFÃCXg[𒆎~܂B" - IDS_STRING10009 "VPN \tgEFÃCXg[JnĂ܂..." - IDS_STRING10010 "VPN \tgEFÃCXg[܂͐ڑ͐ɊJn܂B\r\n\r\ñy[W‚邩Aʂ̃y[WɈړ邱Ƃł܂B" - IDS_STRING10011 "C^[lbg玩Ń_E[hꂽt@C %S ́AMł锭sɂēdqĂ܂łB\r\ñ݂bZ[W\ĂvO̊JєzźAC^[lbg玩Ń_E[hꂽt@C %S Sł邩ǂۏ؂łAɃZLeB댯ȃR[h܂܂ĂꍇłӔC𕉂܂B\r\n\r\ñt@Cs邱Ƃ̓ZLeB㐄܂B̃t@CM邱Ƃł邩ǂTdɔfĂB\r\n\r\n[U[̔fƐӔCɂ [OK] NbNƁACXg[𑱍s܂B[LZ] NbNƁACXg[𒆒f܂B\r\n\r\n ̃bZ[ẂAt@C %S LȃR[hpؖɂď邱Ƃɂ\ȂȂ܂B" - IDS_STRING10012 "ZLeBɊւx" - IDS_STRING10013 "VPN \tgEFÃCXg[́A[U[ɂăLZ܂B" - IDS_STRING10014 "[z HUB ̊Ǘ] {^NbNƁAVPN T[o[Ǘ}l[WNĉz HUB ̊ǗJn邱Ƃł܂B" - IDS_STRING10015 "z HUB ̊Ǘ" -END - -STRINGTABLE -BEGIN - IDS_MESSAGE_APPTITLE_EN "VPN Software Web Installer" - IDS_STRING11002 "This web installer is not supported by this operating system. Windows 2000, XP, 2003, Vista, Server 2008, 7 or Server 2008 R2 required. Please install VPN software manually." - IDS_STRING11003 "Verifying VPN Software..." - IDS_STRING11004 "Failed to download file %S.\r\nInstallation of VPN software aborted." - IDS_STRING11005 "Invalid file %S. \r\nInstallation of VPN software aborted." - IDS_STRING11006 "Failed to create temporary file %s." - IDS_STRING11007 "Getting data and installing VPN software...\r\nPlease wait.\r\n\r\nAny of your private information is not sent to the Internet." -END - -STRINGTABLE -BEGIN - IDS_STRING11008 "Failed to start process %S. Installation of VPN software aborted." - IDS_STRING11009 "Starting installation of VPN Software." - IDS_STRING11010 "Installation process finished. Connection process are started correctly.\r\n\r\nYou can now close your browser or move the other pages." - IDS_STRING11011 "The automatically downloaded file %S from the Internet is not digitally signed with a trusted certificate.\r\nThe developer and publisher do not guarantee that the downloaded file %S is safe and do not take responsibility in case of unsafe code included in the file.\r\n\r\nWe recommend to abort the installation by clicking [Cancel]. Proceed the installation by clicking [OK] at your own risk.\r\n\r\nNotice: the message will not be disappeared when the file %S is signed by valid code signing certificate authentication." - IDS_STRING11012 "Security Alert" - IDS_STRING11013 "Installation cancelled by user." - IDS_STRING11014 "Press [Manage Virtual HUB] button to manage Virtual HUB with VPN Server Manager started." - IDS_STRING11015 "Manage Virtual HUB" - IDS_STRING11016 "You can now close your browser or move the other pages.\r\n\r\nWhen VPN Server Manager displayed, reload this page on web browser." - IDS_STRING11017 "Invalid Parameters for the ActiveX control.\r\n\r\nPlease check the tag entry in the HTML file." - IDS_STRING11018 "Press Start VPN Connection to start the VPN connection." - IDS_STRING11019 "Start VPN Connection" -END - -STRINGTABLE -BEGIN - IDS_STRING10016 "̃y[W‚邩Aʂ̃y[WɈړ邱Ƃł܂B\r\n\r\nx VPN T[o[Ǘ}l[W\ɂ́AWeb uEUł̃y[Wĕ\ (XV) ĂB" - IDS_STRING10017 "VPN \tgEFA Web CXg[ ActiveX Rg[ɑ΂ăp[^K؂Ɏw肳Ă܂B\r\n\r\nHTML t@C ^ŐLqmFĂB" - IDS_STRING10018 "[VPN ڑ̊Jn] {^NbNƁAVPN ڑJn܂B" - IDS_STRING10019 "VPN ڑ̊Jn" -END - -#endif // Japanese resources -///////////////////////////////////////////////////////////////////////////// - - - -#ifndef APSTUDIO_INVOKED -///////////////////////////////////////////////////////////////////////////// -// -// Generated from the TEXTINCLUDE 3 resource. -// -1 TYPELIB "vpnweb.tlb" - -///////////////////////////////////////////////////////////////////////////// -#endif // not APSTUDIO_INVOKED - +// Microsoft Visual C++ generated resource script. +// +#include "resource.h" + +#define APSTUDIO_READONLY_SYMBOLS +///////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 2 resource. +// +#include "winres.h" + +///////////////////////////////////////////////////////////////////////////// +#undef APSTUDIO_READONLY_SYMBOLS + +///////////////////////////////////////////////////////////////////////////// +// Japanese resources + +#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_JPN) +#ifdef _WIN32 +LANGUAGE LANG_JAPANESE, SUBLANG_DEFAULT +#pragma code_page(932) +#endif //_WIN32 + +#ifdef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// TEXTINCLUDE +// + +1 TEXTINCLUDE +BEGIN + "resource.h\0" +END + +2 TEXTINCLUDE +BEGIN + "#include ""winres.h""\r\n" + "\0" +END + +3 TEXTINCLUDE +BEGIN + "1 TYPELIB ""vpnweb.tlb""\r\n" + "\0" +END + +#endif // APSTUDIO_INVOKED + + +///////////////////////////////////////////////////////////////////////////// +// +// REGISTRY +// + +IDR_VPNWEB REGISTRY "vpnweb.rgs" +IDR_VPNWEBCONTROL REGISTRY "VpnWebControl.rgs" + +///////////////////////////////////////////////////////////////////////////// +// +// Bitmap +// + +IDB_VPNWEBCONTROL BITMAP "VpnWebControl.bmp" + +///////////////////////////////////////////////////////////////////////////// +// +// Dialog +// + +IDD_VPNWEBDLG DIALOGEX 0, 0, 240, 84 +STYLE DS_SETFONT | WS_CHILD +FONT 11, "Segoe UI", 400, 0, 0x0 +BEGIN + ICON IDI_VPN,S_ICON_VPN,2,4,16,13 + LTEXT "҂...",S_INFO,26,4,209,59 + CONTROL "",P_PROGRESS,"msctls_progress32",WS_BORDER,2,66,233,12 + LTEXT "[VPN ڑ̊Jn] {^NbNƁAVPN ڑJn܂B",S_INFO2,26,4,209,46 + DEFPUSHBUTTON "VPN ڑ̊Jn",B_START,68,51,107,23 + ICON IDI_SERVER,S_ICON_SERVER,2,4,16,13 +END + + +///////////////////////////////////////////////////////////////////////////// +// +// DESIGNINFO +// + +#ifdef APSTUDIO_INVOKED +GUIDELINES DESIGNINFO +BEGIN + IDD_VPNWEBDLG, DIALOG + BEGIN + LEFTMARGIN, 2 + TOPMARGIN, 3 + END +END +#endif // APSTUDIO_INVOKED + + +///////////////////////////////////////////////////////////////////////////// +// +// Icon +// + +// Icon with lowest ID value placed first to ensure application icon +// remains consistent on all systems. +IDI_VPN ICON "VPN.ico" +IDI_SERVER ICON "VPNSvr.ico" + +///////////////////////////////////////////////////////////////////////////// +// +// String Table +// + +STRINGTABLE +BEGIN + IDS_PROJNAME "vpnweb" +END + +STRINGTABLE +BEGIN + IDS_MESSAGE_APPTITLE "VPN \tgEFA Web CXg[" + IDS_STRING10002 "VPN \tgEFA Web CXg[́ÃIy[eBOVXeT|[gĂ܂BWeb CXg[ Windows 2000 / XP / Server 2003 / Vista / Server 2008 / 7 / Server 2008 R2 ɑΉĂ܂B蓮 VPN \tgEFACXg[ĂB" + IDS_STRING10003 "VPN \tgEFȀmFĂ܂..." + IDS_STRING10004 "t@C %S ̃_E[hɎs܂B\r\nVPN \tgEFÃCXg[𒆎~܂B" + IDS_STRING10005 "t@C %S ̓e܂B\r\nVPN \tgEFÃCXg[𒆎~܂B" + IDS_STRING10006 "ꎞt@C %s 쐬ł܂łB" + IDS_STRING10007 "Kvȃf[^̎擾 VPN \tgEFÃCXg[...\r\n҂B\r\n\r\nql̃Rs[^̌lȂǂC^[lbgɑM邱Ƃ͂܂B" + IDS_STRING10008 "vZX %S Nł܂łB\r\nVPN \tgEFÃCXg[𒆎~܂B" + IDS_STRING10009 "VPN \tgEFÃCXg[JnĂ܂..." + IDS_STRING10010 "VPN \tgEFÃCXg[܂͐ڑ͐ɊJn܂B\r\n\r\ñy[W‚邩Aʂ̃y[WɈړ邱Ƃł܂B" + IDS_STRING10011 "C^[lbg玩Ń_E[hꂽt@C %S ́AMł锭sɂēdqĂ܂łB\r\ñ݂bZ[W\ĂvO̊JєzźAC^[lbg玩Ń_E[hꂽt@C %S Sł邩ǂۏ؂łAɃZLeB댯ȃR[h܂܂ĂꍇłӔC𕉂܂B\r\n\r\ñt@Cs邱Ƃ̓ZLeB㐄܂B̃t@CM邱Ƃł邩ǂTdɔfĂB\r\n\r\n[U[̔fƐӔCɂ [OK] NbNƁACXg[𑱍s܂B[LZ] NbNƁACXg[𒆒f܂B\r\n\r\n ̃bZ[ẂAt@C %S LȃR[hpؖɂď邱Ƃɂ\ȂȂ܂B" + IDS_STRING10012 "ZLeBɊւx" + IDS_STRING10013 "VPN \tgEFÃCXg[́A[U[ɂăLZ܂B" + IDS_STRING10014 "[z HUB ̊Ǘ] {^NbNƁAVPN T[o[Ǘ}l[WNĉz HUB ̊ǗJn邱Ƃł܂B" + IDS_STRING10015 "z HUB ̊Ǘ" +END + +STRINGTABLE +BEGIN + IDS_MESSAGE_APPTITLE_EN "VPN Software Web Installer" + IDS_STRING11002 "This web installer is not supported by this operating system. Windows 2000, XP, 2003, Vista, Server 2008, 7 or Server 2008 R2 required. Please install VPN software manually." + IDS_STRING11003 "Verifying VPN Software..." + IDS_STRING11004 "Failed to download file %S.\r\nInstallation of VPN software aborted." + IDS_STRING11005 "Invalid file %S. \r\nInstallation of VPN software aborted." + IDS_STRING11006 "Failed to create temporary file %s." + IDS_STRING11007 "Getting data and installing VPN software...\r\nPlease wait.\r\n\r\nAny of your private information is not sent to the Internet." +END + +STRINGTABLE +BEGIN + IDS_STRING11008 "Failed to start process %S. Installation of VPN software aborted." + IDS_STRING11009 "Starting installation of VPN Software." + IDS_STRING11010 "Installation process finished. Connection process are started correctly.\r\n\r\nYou can now close your browser or move the other pages." + IDS_STRING11011 "The automatically downloaded file %S from the Internet is not digitally signed with a trusted certificate.\r\nThe developer and publisher do not guarantee that the downloaded file %S is safe and do not take responsibility in case of unsafe code included in the file.\r\n\r\nWe recommend to abort the installation by clicking [Cancel]. Proceed the installation by clicking [OK] at your own risk.\r\n\r\nNotice: the message will not be disappeared when the file %S is signed by valid code signing certificate authentication." + IDS_STRING11012 "Security Alert" + IDS_STRING11013 "Installation cancelled by user." + IDS_STRING11014 "Press [Manage Virtual HUB] button to manage Virtual HUB with VPN Server Manager started." + IDS_STRING11015 "Manage Virtual HUB" + IDS_STRING11016 "You can now close your browser or move the other pages.\r\n\r\nWhen VPN Server Manager displayed, reload this page on web browser." + IDS_STRING11017 "Invalid Parameters for the ActiveX control.\r\n\r\nPlease check the tag entry in the HTML file." + IDS_STRING11018 "Press Start VPN Connection to start the VPN connection." + IDS_STRING11019 "Start VPN Connection" +END + +STRINGTABLE +BEGIN + IDS_STRING10016 "̃y[W‚邩Aʂ̃y[WɈړ邱Ƃł܂B\r\n\r\nx VPN T[o[Ǘ}l[W\ɂ́AWeb uEUł̃y[Wĕ\ (XV) ĂB" + IDS_STRING10017 "VPN \tgEFA Web CXg[ ActiveX Rg[ɑ΂ăp[^K؂Ɏw肳Ă܂B\r\n\r\nHTML t@C ^ŐLqmFĂB" + IDS_STRING10018 "[VPN ڑ̊Jn] {^NbNƁAVPN ڑJn܂B" + IDS_STRING10019 "VPN ڑ̊Jn" +END + +#endif // Japanese resources +///////////////////////////////////////////////////////////////////////////// + + + +#ifndef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 3 resource. +// +1 TYPELIB "vpnweb.tlb" + +///////////////////////////////////////////////////////////////////////////// +#endif // not APSTUDIO_INVOKED + diff --git a/src/vpnweb/vpnweb.rgs b/src/vpnweb/vpnweb.rgs index 14bb7951..d7c4def7 100644 --- a/src/vpnweb/vpnweb.rgs +++ b/src/vpnweb/vpnweb.rgs @@ -1,11 +1,11 @@ -HKCR -{ - NoRemove AppID - { - '%APPID%' = s 'vpnweb' - 'vpnweb.ocx' - { - val AppID = s '%APPID%' - } - } -} +HKCR +{ + NoRemove AppID + { + '%APPID%' = s 'vpnweb' + 'vpnweb.ocx' + { + val AppID = s '%APPID%' + } + } +} diff --git a/src/vpnweb/vpnweb.vcproj b/src/vpnweb/vpnweb.vcproj index ab2ab381..ec6eb0f4 100644 --- a/src/vpnweb/vpnweb.vcproj +++ b/src/vpnweb/vpnweb.vcproj @@ -1,370 +1,370 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/vpnweb/vpnwebdlg.c b/src/vpnweb/vpnwebdlg.c index 0f2bcc9a..cec1353d 100644 --- a/src/vpnweb/vpnwebdlg.c +++ b/src/vpnweb/vpnwebdlg.c @@ -1,1501 +1,1501 @@ -// SoftEther VPN Source Code - Developer Edition Master Branch -// Cedar Communication Module - - -// vpnwebdlg.c -// VPN Client Web Installer - -#include - -#define VPNWEBDLG_C -#define _CRT_SECURE_NO_DEPRECATE - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "vpnwebdlg.h" -#include "vpnwebdlg_inner.h" -#include "resource.h" - -#pragma comment(lib, "wininet.lib") - -static VPNWEBDLG_INIT data; -static bool inited = false; -static VW_TASK task; -static bool clicked_flag = false; - -// Check the signature of the EXE file, and displays a warning if dangerous -bool VwCheckExeSign(HWND hWnd, char *exe) -{ - wchar_t tmp[2048]; - bool danger = true; - wchar_t *warningMessage = msgWarning; - wchar_t *warningMessageTitle = msgWarningTitle; - // Validate arguments - if (hWnd == NULL || exe == NULL) - { - return false; - } - - if (VwCheckFileDigitalSignature(hWnd, exe, &danger)) - { - if (danger == false) - { - // Safe - return true; - } - else - { - // Show the message because there is potentially dangerous - swprintf(tmp, sizeof(tmp) / 2, warningMessage, - VwUrlToFileName(exe), VwUrlToFileName(exe), VwUrlToFileName(exe)); - - if (MessageBoxW(hWnd, tmp, warningMessageTitle, - MB_OKCANCEL | MB_DEFBUTTON2 | MB_ICONEXCLAMATION) == IDOK) - { - return true; - } - - return false; - } - } - else - { - // Danger - return false; - } -} - -// Check the digital signature of the file -bool VwCheckFileDigitalSignature(HWND hWnd, char *name, bool *danger) -{ - HRESULT ret = S_OK; - wchar_t tmp[MAX_PATH]; - LONG (WINAPI *_WinVerifyTrust)(HWND, GUID *, LPVOID) = NULL; - HINSTANCE hDll; - // Validate arguments - if (name == NULL) - { - return false; - } - - if (danger != NULL) - { - *danger = false; - } - - swprintf(tmp, sizeof(tmp), L"%S", name); - - hDll = LoadLibrary("Wintrust.dll"); - if (hDll == NULL) - { - return false; - } - - _WinVerifyTrust = - (LONG (__stdcall *)(HWND,GUID *,LPVOID)) - GetProcAddress(hDll, "WinVerifyTrust"); - if (_WinVerifyTrust == NULL) - { - FreeLibrary(hDll); - return false; - } - else - { - GUID action_id = WINTRUST_ACTION_GENERIC_VERIFY_V2; - WINTRUST_FILE_INFO file; - WINTRUST_DATA data; - - Zero(&file, sizeof(file)); - file.cbStruct = sizeof(file); - file.pcwszFilePath = tmp; - - Zero(&data, sizeof(data)); - data.cbStruct = sizeof(data); - data.fdwRevocationChecks = WTD_REVOKE_WHOLECHAIN; - data.dwUIChoice = (hWnd != NULL ? WTD_UI_NOGOOD : WTD_UI_NONE); - data.dwProvFlags = WTD_REVOCATION_CHECK_CHAIN; - data.dwUnionChoice = WTD_CHOICE_FILE; - data.pFile = &file; - - ret = _WinVerifyTrust(hWnd, &action_id, &data); - - if (ret == ERROR_SUCCESS && danger != NULL) - { - if (hWnd != NULL) - { - if (VwCheckFileDigitalSignature(NULL, name, NULL) == false) - { - // It's a dangerous file, but the user selected the [OK] - *danger = true; - } - } - } - } - - FreeLibrary(hDll); - - if (ret != ERROR_SUCCESS) - { - return false; - } - - return true; -} - -// Task execution thread -DWORD CALLBACK VwTaskThread(void *param) -{ - HWND hWnd = data.hWnd; - VW_FILE *f; - - // Download the Inf file - f = VwOpenFile(data.InstallerInfUrl); - - if (f == NULL) - { - wchar_t tmp[MAX_SIZE]; - swprintf(tmp, sizeof(tmp) / 2, msgInfDownloadFailed, VwUrlToFileName(data.InstallerInfUrl)); - VwPrint(hWnd, tmp); - return 0; - } - else - { - UINT size = 0; - UINT bufsize = 0; - UINT readsize = 1024; - UINT build = 0; - char *buf; - - // Read all the contents of the file - buf = ZeroMalloc(size); - - while (true) - { - UINT ret; - - bufsize = size + readsize; - buf = ReAlloc(buf, bufsize); - ret = VwReadFile(f, buf + size, readsize); - - if (ret == INFINITE || size >= 65536 || task.Halt) - { - wchar_t tmp[MAX_SIZE]; - // Download Failed - Free(buf); - VwCloseFile(f); - swprintf(tmp, sizeof(tmp) / 2, msgInfDownloadFailed, VwUrlToFileName(data.InstallerInfUrl)); - VwPrint(hWnd, tmp); - return 0; - } - else if (ret == 0) - { - // Download Complete - break; - } - else - { - size += ret; - } - } - - VwCloseFile(f); - - bufsize = size + 1; - buf = ReAlloc(buf, bufsize); - buf[size] = 0; - - build = VwGetBuildFromVpnInstallInf(buf); - if (build == 0) - { - wchar_t tmp[MAX_SIZE]; - // Build number incorrect - Free(buf); - swprintf(tmp, sizeof(tmp) / 2, msgBadInfFile, VwUrlToFileName(data.InstallerInfUrl)); - VwPrint(hWnd, tmp); - return 0; - } - else - { - char tmpdir[MAX_SIZE]; - char wintmp[MAX_SIZE]; - char temp_vpninstaller_exe[MAX_SIZE]; - char temp_vpninstaller_exe_tmp[MAX_SIZE]; - char temp_vpninstaller_inf[MAX_SIZE]; - HANDLE h; - - GetTempPath(sizeof(wintmp), wintmp); - - if (lstrlen(wintmp) >= 1) - { - if (wintmp[lstrlen(wintmp) - 1] == '\\') - { - wintmp[lstrlen(wintmp) - 1] = 0; - } - } - - // Generate a temporary directory name - _snprintf(tmpdir, sizeof(tmpdir), "%s\\vpninstall_%u", wintmp, build); - - // Generate a temporary file name - _snprintf(temp_vpninstaller_exe, sizeof(temp_vpninstaller_exe), - "%s\\%s", tmpdir, VPNINSTALL_EXE_FILENAME); - _snprintf(temp_vpninstaller_exe_tmp, sizeof(temp_vpninstaller_exe_tmp), - "%s\\%s", tmpdir, VPNINSTALL_EXE_FILENAME_TMP); - _snprintf(temp_vpninstaller_inf, sizeof(temp_vpninstaller_inf), - "%s\\%s", tmpdir, VPNINSTALL_INF_FILENAME); - - // Create a directory - MakeDir(tmpdir); - - // Save the inf file - h = FileCreate(temp_vpninstaller_inf); - if (h == NULL) - { - wchar_t tmp[MAX_SIZE]; - // File creation failure - Free(buf); - swprintf(tmp, sizeof(tmp) / 2, msgWriteFailed, VPNINSTALL_INF_FILENAME); - VwPrint(hWnd, tmp); - return 0; - } - - FileWrite(h, buf, lstrlen(buf)); - FileClose(h); - - Free(buf); - - // Download the vpninstall.exe - h = FileOpen(temp_vpninstaller_exe, false); - if (h == NULL) - { - UCHAR *buffer; - UINT buffer_size = 65536; - UINT total_size, current_size; - - // Perform the download so download unfinished - VwPrint(hWnd, msgDownloading); - Show(hWnd, P_PROGRESS); - SetPos(hWnd, P_PROGRESS, 0); - - f = VwOpenFile(data.InstallerExeUrl); - if (f == NULL) - { - // Download Failed - wchar_t tmp[MAX_SIZE]; - - swprintf(tmp, sizeof(tmp) / 2, msgInfDownloadFailed, VwUrlToFileName(data.InstallerExeUrl)); - VwPrint(hWnd, tmp); - return 0; - } - - total_size = VwGetFileSize(f); - if (total_size == 0) - { - total_size = 2 * 1024 * 1024; - } - current_size = 0; - - h = FileCreate(temp_vpninstaller_exe_tmp); - if (h == NULL) - { - wchar_t tmp[MAX_SIZE]; - // File creation failure - swprintf(tmp, sizeof(tmp) / 2, msgWriteFailed, VPNINSTALL_EXE_FILENAME); - VwPrint(hWnd, tmp); - VwCloseFile(f); - return 0; - } - - buffer = ZeroMalloc(buffer_size); - - while (true) - { - UINT ret; - - ret = VwReadFile(f, buffer, buffer_size); - - if (ret == INFINITE || task.Halt || current_size >= (8 * 1024 * 1024)) - { - // Download Failed - wchar_t tmp[MAX_SIZE]; - -DOWNLOAD_FAILED: - swprintf(tmp, sizeof(tmp) / 2, msgInfDownloadFailed, VwUrlToFileName(data.InstallerExeUrl)); - VwPrint(hWnd, tmp); - Free(buffer); - FileClose(h); - VwCloseFile(f); - return 0; - } - else if (ret == 0) - { - // Download Complete - break; - } - else - { - UINT pos = 0; - current_size += ret; - - pos = (UINT)((float)current_size * 100.0f / (float)total_size); - SetPos(hWnd, P_PROGRESS, pos); - - if (FileWrite(h, buffer, ret) == false) - { - goto DOWNLOAD_FAILED; - } - } - } - - Free(buffer); - FileClose(h); - VwCloseFile(f); - - Hide(hWnd, P_PROGRESS); - - // Rename the file - if (MoveFile(temp_vpninstaller_exe_tmp, temp_vpninstaller_exe) == false) - { - // Download Failed - wchar_t tmp[MAX_SIZE]; - swprintf(tmp, sizeof(tmp) / 2, msgInfDownloadFailed, VwUrlToFileName(data.InstallerExeUrl)); - VwPrint(hWnd, tmp); - return 0; - } - } - else - { - // Download has already been completed - FileClose(h); - } - - VwPrint(hWnd, msgProcessCreating); - - if (VwCheckExeSign(hWnd, temp_vpninstaller_exe)) - { - // Starting the vpninstall.exe - STARTUPINFO info; - PROCESS_INFORMATION ret; - char cmdline[MAX_SIZE]; - - Zero(&info, sizeof(info)); - Zero(&ret, sizeof(ret)); - info.cb = sizeof(info); - info.dwFlags = STARTF_USESHOWWINDOW; - info.wShowWindow = SW_SHOWDEFAULT; - - if (data.VpnServerManagerMode == FALSE) - { - if (lstrlen(data.SettingUrl) == 0) - { - _snprintf(cmdline, sizeof(cmdline) - 1, - "\"%s\" /web", temp_vpninstaller_exe); - } - else - { - _snprintf(cmdline, sizeof(cmdline) - 1, - "\"%s\" /web \"%s\"", temp_vpninstaller_exe, data.SettingUrl); - } - } - else - { - char args[MAX_SIZE]; - - _snprintf(args, sizeof(args) - 1, - "\"\"%s\"\" /HUB:\"\"%s\"\" /PASSWORD:\"\"%s\"\" /HWND:%I64u", - data.VpnServerHostname, - data.VpnServerHubName, - data.VpnServerPassword, - (UINT64)/*data.hControlWnd*/0ULL); - - _snprintf(cmdline, sizeof(cmdline) - 1, - "\"%s\" /web \"%s\"", temp_vpninstaller_exe, args); - } - - if (CreateProcess(NULL, cmdline, NULL, NULL, FALSE, - NORMAL_PRIORITY_CLASS, NULL, NULL, &info, &ret) == false) - { - // Process startup failure - wchar_t tmp[MAX_SIZE]; - swprintf(tmp, sizeof(tmp) / 2, msgProcessFailed, VPNINSTALL_EXE_FILENAME); - VwPrint(hWnd, tmp); - return 0; - } - - if (data.VpnServerManagerMode == FALSE) - { - VwPrint(hWnd, msgProcessCreated); - } - else - { - VwPrint(hWnd, msgProcessCreatedForVpnServer); - } - } - else - { - VwPrint(hWnd, msgUserCancel); - } - } - } - - return 0; -} - -// Get the build number from file vpninstall.inf -UINT VwGetBuildFromVpnInstallInf(char *buf) -{ - UINT i, len; - char tmp[MAX_SIZE]; - UINT wp; - char seps[] = " \t"; - - len = lstrlen(buf); - - wp = 0; - for (i = 0;i < len;i++) - { - char c = buf[i]; - - if (c == 13 || c == 10) - { - tmp[wp] = 0; - wp = 0; - - if (lstrlen(tmp) >= 1) - { - char *token = strtok(tmp, seps); - if (token != NULL && lstrcmpi(token, VPNINSTALL_INF_BUILDTAG) == 0) - { - token = strtok(NULL, seps); - if (token != NULL) - { - return (UINT)strtod(token, NULL); - } - } - } - } - else - { - if ((wp + 2) < sizeof(tmp)) - { - tmp[wp++] = c; - } - } - } - - return 0; -} - -// Convert the URL to the file name -char *VwUrlToFileName(char *url) -{ - UINT i, len; - char *ret = url; - bool b = true; - len = lstrlen(url); - - for (i = 0;i < len;i++) - { - char c = url[i]; - - if (c == '?' || c == '#') - { - b = false; - } - - if (b) - { - if (c == '/' || c == '\\') - { - if (lstrlen(url + i + 1) > 1) - { - ret = url + i + 1; - } - } - } - } - - return ret; -} - -// Initialization -void VwOnInit(HWND hWnd) -{ - inited = false; - if (IsSupportedOs() == false) - { - // The OS is unsupported - Hide(hWnd, P_PROGRESS); - SetDlgItemTextA(hWnd, S_INFO, msgNotSupported); - return; - } - - if(data.VpnServerManagerMode == FALSE) - { - SetText(hWnd, S_INFO2, msgStartTextForVpnClient); - SetText(hWnd, B_START, msgButtonForVpnClient); - } - else - { - SetText(hWnd, S_INFO2, msgStartTextForVpnServer); - SetText(hWnd, B_START, msgButtonForVpnServer); - } - - if (lstrlen(data.InstallerExeUrl) == 0 || lstrlen(data.InstallerInfUrl) == 0) - { - // Parameter is not specified - Hide(hWnd, P_PROGRESS); - SetDlgItemTextA(hWnd, S_INFO, msgNoParam); - return; - } - - if (data.VpnServerManagerMode == FALSE) - { - Show(hWnd, S_ICON_VPN); - Hide(hWnd, S_ICON_SERVER); - } - else - { - Show(hWnd, S_ICON_SERVER); - Hide(hWnd, S_ICON_VPN); - - - } - - Hide(hWnd, P_PROGRESS); - Hide(hWnd, S_INFO); - Show(hWnd, S_INFO2); - Show(hWnd, B_START); - clicked_flag = false; - - Zero(&task, sizeof(task)); -} - -// Release -void VwOnFree(HWND hWnd) -{ - if (inited == false) - { - return; - } - - task.Halt = true; - - if (task.Thread != NULL) - { - while (true) - { - if (WaitForSingleObject(task.Thread, 30) != WAIT_TIMEOUT) - { - break; - } - DoEvents(hWnd); - } - CloseHandle(task.Thread); - task.Thread = NULL; - } -} - -// Show the string -void VwPrint(HWND hWnd, wchar_t *str) -{ - // Validate arguments - if (hWnd == NULL || str == NULL) - { - return; - } - - SetText(hWnd, S_INFO, str); -} - -// Dialog procedure -INT_PTR CALLBACK VpnWebDlgProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam) -{ - switch (msg) - { - case WM_INITDIALOG: - VwOnInit(hWnd); - break; - - case WM_COMMAND: - switch (wParam) - { - case B_START: - if (clicked_flag == false) - { - clicked_flag = true; - SetTimer(hWnd, 1, 1, NULL); - } - break; - } - break; - - case WM_DESTROY: - VwOnFree(hWnd); - break; - - case WM_CLOSE: - return 1; - - case WM_TIMER: - switch (wParam) - { - case 1: - KillTimer(hWnd, 1); - inited = true; - Hide(hWnd, B_START); - Hide(hWnd, S_INFO2); - Show(hWnd, S_INFO); - VwPrint(hWnd, msgInfDownload); - task.Thread = VwNewThread(VwTaskThread, NULL); - break; - - case 2: - KillTimer(hWnd, 2); - SendMessage(hWnd, WM_COMMAND, B_START, 0); - break; - } - break; - - case WM_CTLCOLORBTN: - case WM_CTLCOLORDLG: - case WM_CTLCOLOREDIT: - case WM_CTLCOLORLISTBOX: - case WM_CTLCOLORMSGBOX: - case WM_CTLCOLORSCROLLBAR: - case WM_CTLCOLORSTATIC: - return (UINT)GetStockObject(WHITE_BRUSH); - } - - return 0; -} - -// Set the string to window -void SetText(HWND hWnd, UINT id, wchar_t *str) -{ - wchar_t tmp[512]; - // Validate arguments - if (hWnd == NULL || str == NULL) - { - return; - } - - Zero(tmp, sizeof(tmp)); - GetWindowTextW(DlgItem(hWnd, id), tmp, sizeof(tmp) - 1); - - if (lstrcmpW(tmp, str) == 0) - { - return; - } - - SetWindowTextW(DlgItem(hWnd, id), str); -} - -// Check whether the OS is supported -bool IsSupportedOs() -{ - OSVERSIONINFO ver; - - Zero(&ver, sizeof(ver)); - - ver.dwOSVersionInfoSize = sizeof(ver); - if (GetVersionExA(&ver) == false) - { - return false; - } - - if (ver.dwMajorVersion <= 4) - { - return false; - } - - if (ver.dwPlatformId == VER_PLATFORM_WIN32_WINDOWS || ver.dwPlatformId == VER_PLATFORM_WIN32s) - { - return false; - } - - return true; -} - -// Show a message box -UINT MsgBox(HWND hWnd, UINT flag, wchar_t *msg) -{ - // Validate arguments - if (msg == NULL) - { - msg = L"MessageBox"; - } - - return MessageBoxW(hWnd, msg, msgAppTitle, flag); -} - -// Create a directory -bool MakeDir(char *name) -{ - // Validate arguments - if (name == NULL) - { - return false; - } - - return CreateDirectory(name, NULL); -} - -// Create a file -HANDLE FileCreate(char *name) -{ - HANDLE h; - // Validate arguments - if (name == NULL) - { - return NULL; - } - - h = CreateFile(name, GENERIC_READ | GENERIC_WRITE, - FILE_SHARE_READ, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, - NULL); - if (h == NULL || h == INVALID_HANDLE_VALUE) - { - return NULL; - } - - return h; -} - -// Open the file -HANDLE FileOpen(char *name, bool write_mode) -{ - HANDLE h; - DWORD lock_mode; - // Validate arguments - if (name == NULL) - { - return NULL; - } - - if (write_mode) - { - lock_mode = FILE_SHARE_READ; - } - else - { - lock_mode = FILE_SHARE_READ | FILE_SHARE_WRITE; - } - - h = CreateFile(name, - (write_mode ? GENERIC_READ | GENERIC_WRITE : GENERIC_READ), - lock_mode, - NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); - - if (h == INVALID_HANDLE_VALUE) - { - return NULL; - } - - return h; -} - -// Close the file -void FileClose(HANDLE h) -{ - // Validate arguments - if (h == NULL) - { - return; - } - - FlushFileBuffers(h); - - CloseHandle(h); -} - -// Read from the file -bool FileRead(HANDLE h, void *buf, UINT size) -{ - UINT read_size; - // Validate arguments - if (h == NULL || buf == NULL || size == 0) - { - return false; - } - - if (ReadFile(h, buf, size, &read_size, NULL) == false) - { - return false; - } - - if (read_size != size) - { - return false; - } - - return true; -} - -// Write to the file -bool FileWrite(HANDLE h, void *buf, UINT size) -{ - DWORD write_size; - // Validate arguments - if (h == NULL || buf == NULL || size == 0) - { - return false; - } - - if (WriteFile(h, buf, size, &write_size, NULL) == false) - { - return false; - } - - if (write_size != size) - { - return false; - } - - return true; -} - -// Get the file size -UINT64 FileSize(HANDLE h) -{ - UINT64 ret; - DWORD tmp; - // Validate arguments - if (h == NULL) - { - return 0; - } - - tmp = 0; - ret = GetFileSize(h, &tmp); - if (ret == (DWORD)-1) - { - return 0; - } - - if (tmp != 0) - { - ret += (UINT64)tmp * 4294967296ULL; - } - - return ret; -} - -// Open the Internet file -VW_FILE *VwOpenFile(char *path) -{ - VW_FILE *f; - HINTERNET hHttpFile; - HINTERNET hInternet = InternetOpenA( - "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; .NET CLR 1.1.4322)", - INTERNET_OPEN_TYPE_PRECONFIG, - NULL, NULL, 0); - UINT size; - UINT sizesize; - char tmp[8]; - // Validate arguments - if (path == NULL) - { - return NULL; - } - - if (hInternet == NULL) - { - return NULL; - } - - hHttpFile = InternetOpenUrlA(hInternet, path, NULL, 0, - INTERNET_FLAG_NO_CACHE_WRITE | INTERNET_FLAG_RELOAD, 0); - - if (hHttpFile == NULL) - { - InternetCloseHandle(hInternet); - return NULL; - } - - size = 0; - sizesize = sizeof(size); - - ZeroMemory(tmp, sizeof(tmp)); - - if (strlen(path) >= 6) - { - CopyMemory(tmp, path, 6); - } - - if (lstrcmpi(tmp, "ftp://") == 0) - { - // ftp - DWORD high = 0; - - size = FtpGetFileSize(hHttpFile, &high); - } - else - { - UINT errorcode = 0; - UINT errorcode_size = sizeof(errorcode); - - // http - if (HttpQueryInfo(hHttpFile, HTTP_QUERY_CONTENT_LENGTH | HTTP_QUERY_FLAG_NUMBER, - &size, &sizesize, NULL) == false) - { - size = 0; - } - - if (HttpQueryInfo(hHttpFile, HTTP_QUERY_STATUS_CODE | HTTP_QUERY_FLAG_NUMBER, - &errorcode, &errorcode_size, NULL) == false || - (errorcode / 100) != 2) - { - // HTTP getting error - InternetCloseHandle(hInternet); - InternetCloseHandle(hHttpFile); - return NULL; - } - } - - f = ZeroMalloc(sizeof(VW_FILE)); - f->hInternet = hInternet; - f->hHttpFile = hHttpFile; - f->FileSize = size; - - return f; -} - -// Get the Internet file size -UINT VwGetFileSize(VW_FILE *f) -{ - // Validate arguments - if (f == NULL) - { - return 0; - } - - return f->FileSize; -} - -// Read from the Internet file -UINT VwReadFile(VW_FILE *f, void *buf, UINT size) -{ - UINT readsize = 0; - // Validate arguments - if (f == NULL || buf == NULL) - { - return INFINITE; - } - - if (InternetReadFile(f->hHttpFile, buf, size, &readsize) == false) - { - return INFINITE; - } - - return readsize; -} - -// Close the Internet file -void VwCloseFile(VW_FILE *f) -{ - // Validate arguments - if (f == NULL) - { - return; - } - - InternetCloseHandle(f->hHttpFile); - InternetCloseHandle(f->hInternet); - - Free(f); -} - -// Memory reallocation -void *ReAlloc(void *p, UINT size) -{ - void *ret; - if (size == 0) - { - size = 1; - } - - ret = realloc(p, size); - if (ret == NULL) - { - _exit(0); - } - - return ret; -} - -// Memory allocation -void *ZeroMalloc(UINT size) -{ - void *p; - if (size == 0) - { - size = 1; - } - - p = malloc(size); - if (p == NULL) - { - _exit(0); - } - - Zero(p, size); - - return p; -} - -// Memory clear -void Zero(void *p, UINT size) -{ - if (p != NULL) - { - ZeroMemory(p, size); - } -} - -// Memory release -void Free(void *p) -{ - if (p != NULL) - { - free(p); - } -} - -// Thread creation -HANDLE VwNewThread(LPTHREAD_START_ROUTINE start, void *param) -{ - HANDLE h; - DWORD id; - // Validate arguments - if (start == NULL) - { - return NULL; - } - - h = (HANDLE)_beginthreadex(NULL, 0, start, param, 0, &id); - - return h; -} - -// Thread release -void VwFreeThread(HANDLE h) -{ - // Validate arguments - if (h == NULL) - { - return; - } - - CloseHandle(h); -} - -// Dialog procedure that does not do anything -INT_PTR CALLBACK VpnWebDummyDlgProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam) -{ - return 0; -} - -// Initialization of the dialog -HWND InitVpnWebDlg(VPNWEBDLG_INIT *init) -{ - HWND hWnd; - // Validate arguments - if (init == NULL) - { - return NULL; - } - - _configthreadlocale(_DISABLE_PER_THREAD_LOCALE); - setlocale(LC_ALL, ""); - - ZeroMemory(&data, sizeof(data)); - CopyMemory(&data, init, sizeof(data)); - - LoadTables(data.LanguageId); - - hWnd = CreateDialog(hDllInstance, MAKEINTRESOURCE(IDD_VPNWEBDLG), - data.hControlWnd, VpnWebDlgProc); - - data.hWnd = hWnd; - - ShowWindow(hWnd, SW_SHOW); - - return hWnd; -} - -// Exit the dialog -void FreeVpnWebDlg() -{ - DestroyWindow(data.hWnd); -} - -// Get the size of the dialog -void GetVpnWebDlgSize(SIZE *size) -{ - HWND hWnd; - RECT rect; - // Validate arguments - if (size == NULL) - { - return; - } - - hWnd = CreateDialog(hDllInstance, MAKEINTRESOURCE(IDD_VPNWEBDLG), - GetDesktopWindow(), VpnWebDummyDlgProc); - - ZeroMemory(&rect, sizeof(rect)); - GetWindowRect(hWnd, &rect); - - DestroyWindow(hWnd); - - size->cx = rect.right - rect.left; - size->cy = rect.bottom - rect.top; -} - - -// Get the item in the dialog -HWND DlgItem(HWND hWnd, UINT id) -{ - // Validate arguments - if (hWnd == NULL) - { - return NULL; - } - - if (id == 0) - { - return hWnd; - } - else - { - return GetDlgItem(hWnd, id); - } -} - -// Hide the window -void Hide(HWND hWnd, UINT id) -{ - // Validate arguments - if (hWnd == NULL) - { - return; - } - - if (IsShow(hWnd, id)) - { - ShowWindow(DlgItem(hWnd, id), SW_HIDE); - } -} - -// Display the window -void Show(HWND hWnd, UINT id) -{ - // Validate arguments - if (hWnd == NULL) - { - return; - } - - if (IsHide(hWnd, id)) - { - ShowWindow(DlgItem(hWnd, id), SW_SHOW); - } -} - -// Changing the visibility setting -void SetShow(HWND hWnd, UINT id, bool b) -{ - // Validate arguments - if (hWnd == NULL) - { - return; - } - - if (b) - { - Show(hWnd, id); - } - else - { - Hide(hWnd, id); - } -} - -// Get whether the window is shown -bool IsShow(HWND hWnd, UINT id) -{ - return IsHide(hWnd, id) ? false : true; -} - -// Get whether the window is hidden -bool IsHide(HWND hWnd, UINT id) -{ - // Validate arguments - if (hWnd == NULL) - { - return true; - } - - if (GetStyle(hWnd, id) & WS_VISIBLE) - { - return false; - } - else - { - return true; - } -} - -// Remove the window style -void RemoveExStyle(HWND hWnd, UINT id, UINT style) -{ - UINT old; - // Validate arguments - if (hWnd == NULL) - { - return; - } - - old = GetExStyle(hWnd, id); - if ((old & style) == 0) - { - return; - } - - SetWindowLong(DlgItem(hWnd, id), GWL_EXSTYLE, old & ~style); - Refresh(DlgItem(hWnd, id)); -} - -// Set the window style -void SetExStyle(HWND hWnd, UINT id, UINT style) -{ - UINT old; - // Validate arguments - if (hWnd == NULL) - { - return; - } - - old = GetExStyle(hWnd, id); - if (old & style) - { - return; - } - - SetWindowLong(DlgItem(hWnd, id), GWL_EXSTYLE, old | style); - Refresh(DlgItem(hWnd, id)); -} - -// Get the window style -UINT GetExStyle(HWND hWnd, UINT id) -{ - // Validate arguments - if (hWnd == NULL) - { - return 0; - } - - return GetWindowLong(DlgItem(hWnd, id), GWL_EXSTYLE); -} - -// Remove the window style -void RemoveStyle(HWND hWnd, UINT id, UINT style) -{ - UINT old; - // Validate arguments - if (hWnd == NULL) - { - return; - } - - old = GetStyle(hWnd, id); - if ((old & style) == 0) - { - return; - } - - SetWindowLong(DlgItem(hWnd, id), GWL_STYLE, old & ~style); - Refresh(DlgItem(hWnd, id)); -} - -// Set the window style -void SetStyle(HWND hWnd, UINT id, UINT style) -{ - UINT old; - // Validate arguments - if (hWnd == NULL) - { - return; - } - - old = GetStyle(hWnd, id); - if (old & style) - { - return; - } - - SetWindowLong(DlgItem(hWnd, id), GWL_STYLE, old | style); - Refresh(DlgItem(hWnd, id)); -} - -// Get the window style -UINT GetStyle(HWND hWnd, UINT id) -{ - // Validate arguments - if (hWnd == NULL) - { - return 0; - } - - return GetWindowLong(DlgItem(hWnd, id), GWL_STYLE); -} - -// Update the window -void Refresh(HWND hWnd) -{ - HWND parent; - // Validate arguments - if (hWnd == NULL) - { - return; - } - - DoEvents(hWnd); - UpdateWindow(hWnd); - DoEvents(hWnd); - - parent = GetParent(hWnd); - if (parent != NULL) - { - Refresh(parent); - } -} - -// Handle the event -void DoEvents(HWND hWnd) -{ - MSG msg; - - if (PeekMessage(&msg, hWnd, 0, 0, PM_REMOVE)) - { - TranslateMessage(&msg); - DispatchMessage(&msg); - } - UpdateWindow(hWnd); - - if (hWnd) - { - DoEvents(NULL); - } -} - -// Disable the window -void Disable(HWND hWnd, UINT id) -{ - SetEnable(hWnd, id, false); -} - -// Enable the window -void Enable(HWND hWnd, UINT id) -{ - SetEnable(hWnd, id, true); -} - -// Set the enabled state of the window -void SetEnable(HWND hWnd, UINT id, bool b) -{ - // Validate arguments - if (hWnd == NULL) - { - return; - } - - if (b == false) - { - if (IsEnable(hWnd, id)) - { - EnableWindow(DlgItem(hWnd, id), false); - Refresh(DlgItem(hWnd, id)); - } - } - else - { - if (IsDisable(hWnd, id)) - { - EnableWindow(DlgItem(hWnd, id), true); - Refresh(DlgItem(hWnd, id)); - } - } -} - -// Examine whether the Window is disabled -bool IsDisable(HWND hWnd, UINT id) -{ - return IsEnable(hWnd, id) ? false : true; -} - -// Examine whether the window is enabled -bool IsEnable(HWND hWnd, UINT id) -{ - // Validate arguments - if (hWnd == NULL) - { - return false; - } - - return IsWindowEnabled(DlgItem(hWnd, id)); -} - -// Set the position of the progress bar -void SetPos(HWND hWnd, UINT id, UINT pos) -{ - // Validate arguments - if (hWnd == NULL) - { - return; - } - - SendMsg(hWnd, id, PBM_SETPOS, pos, 0); -} - -// Set the range of the progress bar -void SetRange(HWND hWnd, UINT id, UINT start, UINT end) -{ - // Validate arguments - if (hWnd == NULL) - { - return; - } - - SendMsg(hWnd, id, PBM_SETRANGE32, start, end); -} - -// Transmit a message to the control -UINT SendMsg(HWND hWnd, UINT id, UINT msg, WPARAM wParam, LPARAM lParam) -{ - // Validate arguments - if (hWnd == NULL) - { - return 0; - } - - return (UINT)SendMessageA(DlgItem(hWnd, id), msg, wParam, lParam); -} +// SoftEther VPN Source Code - Developer Edition Master Branch +// Cedar Communication Module + + +// vpnwebdlg.c +// VPN Client Web Installer + +#include + +#define VPNWEBDLG_C +#define _CRT_SECURE_NO_DEPRECATE + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "vpnwebdlg.h" +#include "vpnwebdlg_inner.h" +#include "resource.h" + +#pragma comment(lib, "wininet.lib") + +static VPNWEBDLG_INIT data; +static bool inited = false; +static VW_TASK task; +static bool clicked_flag = false; + +// Check the signature of the EXE file, and displays a warning if dangerous +bool VwCheckExeSign(HWND hWnd, char *exe) +{ + wchar_t tmp[2048]; + bool danger = true; + wchar_t *warningMessage = msgWarning; + wchar_t *warningMessageTitle = msgWarningTitle; + // Validate arguments + if (hWnd == NULL || exe == NULL) + { + return false; + } + + if (VwCheckFileDigitalSignature(hWnd, exe, &danger)) + { + if (danger == false) + { + // Safe + return true; + } + else + { + // Show the message because there is potentially dangerous + swprintf(tmp, sizeof(tmp) / 2, warningMessage, + VwUrlToFileName(exe), VwUrlToFileName(exe), VwUrlToFileName(exe)); + + if (MessageBoxW(hWnd, tmp, warningMessageTitle, + MB_OKCANCEL | MB_DEFBUTTON2 | MB_ICONEXCLAMATION) == IDOK) + { + return true; + } + + return false; + } + } + else + { + // Danger + return false; + } +} + +// Check the digital signature of the file +bool VwCheckFileDigitalSignature(HWND hWnd, char *name, bool *danger) +{ + HRESULT ret = S_OK; + wchar_t tmp[MAX_PATH]; + LONG (WINAPI *_WinVerifyTrust)(HWND, GUID *, LPVOID) = NULL; + HINSTANCE hDll; + // Validate arguments + if (name == NULL) + { + return false; + } + + if (danger != NULL) + { + *danger = false; + } + + swprintf(tmp, sizeof(tmp), L"%S", name); + + hDll = LoadLibrary("Wintrust.dll"); + if (hDll == NULL) + { + return false; + } + + _WinVerifyTrust = + (LONG (__stdcall *)(HWND,GUID *,LPVOID)) + GetProcAddress(hDll, "WinVerifyTrust"); + if (_WinVerifyTrust == NULL) + { + FreeLibrary(hDll); + return false; + } + else + { + GUID action_id = WINTRUST_ACTION_GENERIC_VERIFY_V2; + WINTRUST_FILE_INFO file; + WINTRUST_DATA data; + + Zero(&file, sizeof(file)); + file.cbStruct = sizeof(file); + file.pcwszFilePath = tmp; + + Zero(&data, sizeof(data)); + data.cbStruct = sizeof(data); + data.fdwRevocationChecks = WTD_REVOKE_WHOLECHAIN; + data.dwUIChoice = (hWnd != NULL ? WTD_UI_NOGOOD : WTD_UI_NONE); + data.dwProvFlags = WTD_REVOCATION_CHECK_CHAIN; + data.dwUnionChoice = WTD_CHOICE_FILE; + data.pFile = &file; + + ret = _WinVerifyTrust(hWnd, &action_id, &data); + + if (ret == ERROR_SUCCESS && danger != NULL) + { + if (hWnd != NULL) + { + if (VwCheckFileDigitalSignature(NULL, name, NULL) == false) + { + // It's a dangerous file, but the user selected the [OK] + *danger = true; + } + } + } + } + + FreeLibrary(hDll); + + if (ret != ERROR_SUCCESS) + { + return false; + } + + return true; +} + +// Task execution thread +DWORD CALLBACK VwTaskThread(void *param) +{ + HWND hWnd = data.hWnd; + VW_FILE *f; + + // Download the Inf file + f = VwOpenFile(data.InstallerInfUrl); + + if (f == NULL) + { + wchar_t tmp[MAX_SIZE]; + swprintf(tmp, sizeof(tmp) / 2, msgInfDownloadFailed, VwUrlToFileName(data.InstallerInfUrl)); + VwPrint(hWnd, tmp); + return 0; + } + else + { + UINT size = 0; + UINT bufsize = 0; + UINT readsize = 1024; + UINT build = 0; + char *buf; + + // Read all the contents of the file + buf = ZeroMalloc(size); + + while (true) + { + UINT ret; + + bufsize = size + readsize; + buf = ReAlloc(buf, bufsize); + ret = VwReadFile(f, buf + size, readsize); + + if (ret == INFINITE || size >= 65536 || task.Halt) + { + wchar_t tmp[MAX_SIZE]; + // Download Failed + Free(buf); + VwCloseFile(f); + swprintf(tmp, sizeof(tmp) / 2, msgInfDownloadFailed, VwUrlToFileName(data.InstallerInfUrl)); + VwPrint(hWnd, tmp); + return 0; + } + else if (ret == 0) + { + // Download Complete + break; + } + else + { + size += ret; + } + } + + VwCloseFile(f); + + bufsize = size + 1; + buf = ReAlloc(buf, bufsize); + buf[size] = 0; + + build = VwGetBuildFromVpnInstallInf(buf); + if (build == 0) + { + wchar_t tmp[MAX_SIZE]; + // Build number incorrect + Free(buf); + swprintf(tmp, sizeof(tmp) / 2, msgBadInfFile, VwUrlToFileName(data.InstallerInfUrl)); + VwPrint(hWnd, tmp); + return 0; + } + else + { + char tmpdir[MAX_SIZE]; + char wintmp[MAX_SIZE]; + char temp_vpninstaller_exe[MAX_SIZE]; + char temp_vpninstaller_exe_tmp[MAX_SIZE]; + char temp_vpninstaller_inf[MAX_SIZE]; + HANDLE h; + + GetTempPath(sizeof(wintmp), wintmp); + + if (lstrlen(wintmp) >= 1) + { + if (wintmp[lstrlen(wintmp) - 1] == '\\') + { + wintmp[lstrlen(wintmp) - 1] = 0; + } + } + + // Generate a temporary directory name + _snprintf(tmpdir, sizeof(tmpdir), "%s\\vpninstall_%u", wintmp, build); + + // Generate a temporary file name + _snprintf(temp_vpninstaller_exe, sizeof(temp_vpninstaller_exe), + "%s\\%s", tmpdir, VPNINSTALL_EXE_FILENAME); + _snprintf(temp_vpninstaller_exe_tmp, sizeof(temp_vpninstaller_exe_tmp), + "%s\\%s", tmpdir, VPNINSTALL_EXE_FILENAME_TMP); + _snprintf(temp_vpninstaller_inf, sizeof(temp_vpninstaller_inf), + "%s\\%s", tmpdir, VPNINSTALL_INF_FILENAME); + + // Create a directory + MakeDir(tmpdir); + + // Save the inf file + h = FileCreate(temp_vpninstaller_inf); + if (h == NULL) + { + wchar_t tmp[MAX_SIZE]; + // File creation failure + Free(buf); + swprintf(tmp, sizeof(tmp) / 2, msgWriteFailed, VPNINSTALL_INF_FILENAME); + VwPrint(hWnd, tmp); + return 0; + } + + FileWrite(h, buf, lstrlen(buf)); + FileClose(h); + + Free(buf); + + // Download the vpninstall.exe + h = FileOpen(temp_vpninstaller_exe, false); + if (h == NULL) + { + UCHAR *buffer; + UINT buffer_size = 65536; + UINT total_size, current_size; + + // Perform the download so download unfinished + VwPrint(hWnd, msgDownloading); + Show(hWnd, P_PROGRESS); + SetPos(hWnd, P_PROGRESS, 0); + + f = VwOpenFile(data.InstallerExeUrl); + if (f == NULL) + { + // Download Failed + wchar_t tmp[MAX_SIZE]; + + swprintf(tmp, sizeof(tmp) / 2, msgInfDownloadFailed, VwUrlToFileName(data.InstallerExeUrl)); + VwPrint(hWnd, tmp); + return 0; + } + + total_size = VwGetFileSize(f); + if (total_size == 0) + { + total_size = 2 * 1024 * 1024; + } + current_size = 0; + + h = FileCreate(temp_vpninstaller_exe_tmp); + if (h == NULL) + { + wchar_t tmp[MAX_SIZE]; + // File creation failure + swprintf(tmp, sizeof(tmp) / 2, msgWriteFailed, VPNINSTALL_EXE_FILENAME); + VwPrint(hWnd, tmp); + VwCloseFile(f); + return 0; + } + + buffer = ZeroMalloc(buffer_size); + + while (true) + { + UINT ret; + + ret = VwReadFile(f, buffer, buffer_size); + + if (ret == INFINITE || task.Halt || current_size >= (8 * 1024 * 1024)) + { + // Download Failed + wchar_t tmp[MAX_SIZE]; + +DOWNLOAD_FAILED: + swprintf(tmp, sizeof(tmp) / 2, msgInfDownloadFailed, VwUrlToFileName(data.InstallerExeUrl)); + VwPrint(hWnd, tmp); + Free(buffer); + FileClose(h); + VwCloseFile(f); + return 0; + } + else if (ret == 0) + { + // Download Complete + break; + } + else + { + UINT pos = 0; + current_size += ret; + + pos = (UINT)((float)current_size * 100.0f / (float)total_size); + SetPos(hWnd, P_PROGRESS, pos); + + if (FileWrite(h, buffer, ret) == false) + { + goto DOWNLOAD_FAILED; + } + } + } + + Free(buffer); + FileClose(h); + VwCloseFile(f); + + Hide(hWnd, P_PROGRESS); + + // Rename the file + if (MoveFile(temp_vpninstaller_exe_tmp, temp_vpninstaller_exe) == false) + { + // Download Failed + wchar_t tmp[MAX_SIZE]; + swprintf(tmp, sizeof(tmp) / 2, msgInfDownloadFailed, VwUrlToFileName(data.InstallerExeUrl)); + VwPrint(hWnd, tmp); + return 0; + } + } + else + { + // Download has already been completed + FileClose(h); + } + + VwPrint(hWnd, msgProcessCreating); + + if (VwCheckExeSign(hWnd, temp_vpninstaller_exe)) + { + // Starting the vpninstall.exe + STARTUPINFO info; + PROCESS_INFORMATION ret; + char cmdline[MAX_SIZE]; + + Zero(&info, sizeof(info)); + Zero(&ret, sizeof(ret)); + info.cb = sizeof(info); + info.dwFlags = STARTF_USESHOWWINDOW; + info.wShowWindow = SW_SHOWDEFAULT; + + if (data.VpnServerManagerMode == FALSE) + { + if (lstrlen(data.SettingUrl) == 0) + { + _snprintf(cmdline, sizeof(cmdline) - 1, + "\"%s\" /web", temp_vpninstaller_exe); + } + else + { + _snprintf(cmdline, sizeof(cmdline) - 1, + "\"%s\" /web \"%s\"", temp_vpninstaller_exe, data.SettingUrl); + } + } + else + { + char args[MAX_SIZE]; + + _snprintf(args, sizeof(args) - 1, + "\"\"%s\"\" /HUB:\"\"%s\"\" /PASSWORD:\"\"%s\"\" /HWND:%I64u", + data.VpnServerHostname, + data.VpnServerHubName, + data.VpnServerPassword, + (UINT64)/*data.hControlWnd*/0ULL); + + _snprintf(cmdline, sizeof(cmdline) - 1, + "\"%s\" /web \"%s\"", temp_vpninstaller_exe, args); + } + + if (CreateProcess(NULL, cmdline, NULL, NULL, FALSE, + NORMAL_PRIORITY_CLASS, NULL, NULL, &info, &ret) == false) + { + // Process startup failure + wchar_t tmp[MAX_SIZE]; + swprintf(tmp, sizeof(tmp) / 2, msgProcessFailed, VPNINSTALL_EXE_FILENAME); + VwPrint(hWnd, tmp); + return 0; + } + + if (data.VpnServerManagerMode == FALSE) + { + VwPrint(hWnd, msgProcessCreated); + } + else + { + VwPrint(hWnd, msgProcessCreatedForVpnServer); + } + } + else + { + VwPrint(hWnd, msgUserCancel); + } + } + } + + return 0; +} + +// Get the build number from file vpninstall.inf +UINT VwGetBuildFromVpnInstallInf(char *buf) +{ + UINT i, len; + char tmp[MAX_SIZE]; + UINT wp; + char seps[] = " \t"; + + len = lstrlen(buf); + + wp = 0; + for (i = 0;i < len;i++) + { + char c = buf[i]; + + if (c == 13 || c == 10) + { + tmp[wp] = 0; + wp = 0; + + if (lstrlen(tmp) >= 1) + { + char *token = strtok(tmp, seps); + if (token != NULL && lstrcmpi(token, VPNINSTALL_INF_BUILDTAG) == 0) + { + token = strtok(NULL, seps); + if (token != NULL) + { + return (UINT)strtod(token, NULL); + } + } + } + } + else + { + if ((wp + 2) < sizeof(tmp)) + { + tmp[wp++] = c; + } + } + } + + return 0; +} + +// Convert the URL to the file name +char *VwUrlToFileName(char *url) +{ + UINT i, len; + char *ret = url; + bool b = true; + len = lstrlen(url); + + for (i = 0;i < len;i++) + { + char c = url[i]; + + if (c == '?' || c == '#') + { + b = false; + } + + if (b) + { + if (c == '/' || c == '\\') + { + if (lstrlen(url + i + 1) > 1) + { + ret = url + i + 1; + } + } + } + } + + return ret; +} + +// Initialization +void VwOnInit(HWND hWnd) +{ + inited = false; + if (IsSupportedOs() == false) + { + // The OS is unsupported + Hide(hWnd, P_PROGRESS); + SetDlgItemTextA(hWnd, S_INFO, msgNotSupported); + return; + } + + if(data.VpnServerManagerMode == FALSE) + { + SetText(hWnd, S_INFO2, msgStartTextForVpnClient); + SetText(hWnd, B_START, msgButtonForVpnClient); + } + else + { + SetText(hWnd, S_INFO2, msgStartTextForVpnServer); + SetText(hWnd, B_START, msgButtonForVpnServer); + } + + if (lstrlen(data.InstallerExeUrl) == 0 || lstrlen(data.InstallerInfUrl) == 0) + { + // Parameter is not specified + Hide(hWnd, P_PROGRESS); + SetDlgItemTextA(hWnd, S_INFO, msgNoParam); + return; + } + + if (data.VpnServerManagerMode == FALSE) + { + Show(hWnd, S_ICON_VPN); + Hide(hWnd, S_ICON_SERVER); + } + else + { + Show(hWnd, S_ICON_SERVER); + Hide(hWnd, S_ICON_VPN); + + + } + + Hide(hWnd, P_PROGRESS); + Hide(hWnd, S_INFO); + Show(hWnd, S_INFO2); + Show(hWnd, B_START); + clicked_flag = false; + + Zero(&task, sizeof(task)); +} + +// Release +void VwOnFree(HWND hWnd) +{ + if (inited == false) + { + return; + } + + task.Halt = true; + + if (task.Thread != NULL) + { + while (true) + { + if (WaitForSingleObject(task.Thread, 30) != WAIT_TIMEOUT) + { + break; + } + DoEvents(hWnd); + } + CloseHandle(task.Thread); + task.Thread = NULL; + } +} + +// Show the string +void VwPrint(HWND hWnd, wchar_t *str) +{ + // Validate arguments + if (hWnd == NULL || str == NULL) + { + return; + } + + SetText(hWnd, S_INFO, str); +} + +// Dialog procedure +INT_PTR CALLBACK VpnWebDlgProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam) +{ + switch (msg) + { + case WM_INITDIALOG: + VwOnInit(hWnd); + break; + + case WM_COMMAND: + switch (wParam) + { + case B_START: + if (clicked_flag == false) + { + clicked_flag = true; + SetTimer(hWnd, 1, 1, NULL); + } + break; + } + break; + + case WM_DESTROY: + VwOnFree(hWnd); + break; + + case WM_CLOSE: + return 1; + + case WM_TIMER: + switch (wParam) + { + case 1: + KillTimer(hWnd, 1); + inited = true; + Hide(hWnd, B_START); + Hide(hWnd, S_INFO2); + Show(hWnd, S_INFO); + VwPrint(hWnd, msgInfDownload); + task.Thread = VwNewThread(VwTaskThread, NULL); + break; + + case 2: + KillTimer(hWnd, 2); + SendMessage(hWnd, WM_COMMAND, B_START, 0); + break; + } + break; + + case WM_CTLCOLORBTN: + case WM_CTLCOLORDLG: + case WM_CTLCOLOREDIT: + case WM_CTLCOLORLISTBOX: + case WM_CTLCOLORMSGBOX: + case WM_CTLCOLORSCROLLBAR: + case WM_CTLCOLORSTATIC: + return (UINT)GetStockObject(WHITE_BRUSH); + } + + return 0; +} + +// Set the string to window +void SetText(HWND hWnd, UINT id, wchar_t *str) +{ + wchar_t tmp[512]; + // Validate arguments + if (hWnd == NULL || str == NULL) + { + return; + } + + Zero(tmp, sizeof(tmp)); + GetWindowTextW(DlgItem(hWnd, id), tmp, sizeof(tmp) - 1); + + if (lstrcmpW(tmp, str) == 0) + { + return; + } + + SetWindowTextW(DlgItem(hWnd, id), str); +} + +// Check whether the OS is supported +bool IsSupportedOs() +{ + OSVERSIONINFO ver; + + Zero(&ver, sizeof(ver)); + + ver.dwOSVersionInfoSize = sizeof(ver); + if (GetVersionExA(&ver) == false) + { + return false; + } + + if (ver.dwMajorVersion <= 4) + { + return false; + } + + if (ver.dwPlatformId == VER_PLATFORM_WIN32_WINDOWS || ver.dwPlatformId == VER_PLATFORM_WIN32s) + { + return false; + } + + return true; +} + +// Show a message box +UINT MsgBox(HWND hWnd, UINT flag, wchar_t *msg) +{ + // Validate arguments + if (msg == NULL) + { + msg = L"MessageBox"; + } + + return MessageBoxW(hWnd, msg, msgAppTitle, flag); +} + +// Create a directory +bool MakeDir(char *name) +{ + // Validate arguments + if (name == NULL) + { + return false; + } + + return CreateDirectory(name, NULL); +} + +// Create a file +HANDLE FileCreate(char *name) +{ + HANDLE h; + // Validate arguments + if (name == NULL) + { + return NULL; + } + + h = CreateFile(name, GENERIC_READ | GENERIC_WRITE, + FILE_SHARE_READ, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, + NULL); + if (h == NULL || h == INVALID_HANDLE_VALUE) + { + return NULL; + } + + return h; +} + +// Open the file +HANDLE FileOpen(char *name, bool write_mode) +{ + HANDLE h; + DWORD lock_mode; + // Validate arguments + if (name == NULL) + { + return NULL; + } + + if (write_mode) + { + lock_mode = FILE_SHARE_READ; + } + else + { + lock_mode = FILE_SHARE_READ | FILE_SHARE_WRITE; + } + + h = CreateFile(name, + (write_mode ? GENERIC_READ | GENERIC_WRITE : GENERIC_READ), + lock_mode, + NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); + + if (h == INVALID_HANDLE_VALUE) + { + return NULL; + } + + return h; +} + +// Close the file +void FileClose(HANDLE h) +{ + // Validate arguments + if (h == NULL) + { + return; + } + + FlushFileBuffers(h); + + CloseHandle(h); +} + +// Read from the file +bool FileRead(HANDLE h, void *buf, UINT size) +{ + UINT read_size; + // Validate arguments + if (h == NULL || buf == NULL || size == 0) + { + return false; + } + + if (ReadFile(h, buf, size, &read_size, NULL) == false) + { + return false; + } + + if (read_size != size) + { + return false; + } + + return true; +} + +// Write to the file +bool FileWrite(HANDLE h, void *buf, UINT size) +{ + DWORD write_size; + // Validate arguments + if (h == NULL || buf == NULL || size == 0) + { + return false; + } + + if (WriteFile(h, buf, size, &write_size, NULL) == false) + { + return false; + } + + if (write_size != size) + { + return false; + } + + return true; +} + +// Get the file size +UINT64 FileSize(HANDLE h) +{ + UINT64 ret; + DWORD tmp; + // Validate arguments + if (h == NULL) + { + return 0; + } + + tmp = 0; + ret = GetFileSize(h, &tmp); + if (ret == (DWORD)-1) + { + return 0; + } + + if (tmp != 0) + { + ret += (UINT64)tmp * 4294967296ULL; + } + + return ret; +} + +// Open the Internet file +VW_FILE *VwOpenFile(char *path) +{ + VW_FILE *f; + HINTERNET hHttpFile; + HINTERNET hInternet = InternetOpenA( + "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; .NET CLR 1.1.4322)", + INTERNET_OPEN_TYPE_PRECONFIG, + NULL, NULL, 0); + UINT size; + UINT sizesize; + char tmp[8]; + // Validate arguments + if (path == NULL) + { + return NULL; + } + + if (hInternet == NULL) + { + return NULL; + } + + hHttpFile = InternetOpenUrlA(hInternet, path, NULL, 0, + INTERNET_FLAG_NO_CACHE_WRITE | INTERNET_FLAG_RELOAD, 0); + + if (hHttpFile == NULL) + { + InternetCloseHandle(hInternet); + return NULL; + } + + size = 0; + sizesize = sizeof(size); + + ZeroMemory(tmp, sizeof(tmp)); + + if (strlen(path) >= 6) + { + CopyMemory(tmp, path, 6); + } + + if (lstrcmpi(tmp, "ftp://") == 0) + { + // ftp + DWORD high = 0; + + size = FtpGetFileSize(hHttpFile, &high); + } + else + { + UINT errorcode = 0; + UINT errorcode_size = sizeof(errorcode); + + // http + if (HttpQueryInfo(hHttpFile, HTTP_QUERY_CONTENT_LENGTH | HTTP_QUERY_FLAG_NUMBER, + &size, &sizesize, NULL) == false) + { + size = 0; + } + + if (HttpQueryInfo(hHttpFile, HTTP_QUERY_STATUS_CODE | HTTP_QUERY_FLAG_NUMBER, + &errorcode, &errorcode_size, NULL) == false || + (errorcode / 100) != 2) + { + // HTTP getting error + InternetCloseHandle(hInternet); + InternetCloseHandle(hHttpFile); + return NULL; + } + } + + f = ZeroMalloc(sizeof(VW_FILE)); + f->hInternet = hInternet; + f->hHttpFile = hHttpFile; + f->FileSize = size; + + return f; +} + +// Get the Internet file size +UINT VwGetFileSize(VW_FILE *f) +{ + // Validate arguments + if (f == NULL) + { + return 0; + } + + return f->FileSize; +} + +// Read from the Internet file +UINT VwReadFile(VW_FILE *f, void *buf, UINT size) +{ + UINT readsize = 0; + // Validate arguments + if (f == NULL || buf == NULL) + { + return INFINITE; + } + + if (InternetReadFile(f->hHttpFile, buf, size, &readsize) == false) + { + return INFINITE; + } + + return readsize; +} + +// Close the Internet file +void VwCloseFile(VW_FILE *f) +{ + // Validate arguments + if (f == NULL) + { + return; + } + + InternetCloseHandle(f->hHttpFile); + InternetCloseHandle(f->hInternet); + + Free(f); +} + +// Memory reallocation +void *ReAlloc(void *p, UINT size) +{ + void *ret; + if (size == 0) + { + size = 1; + } + + ret = realloc(p, size); + if (ret == NULL) + { + _exit(0); + } + + return ret; +} + +// Memory allocation +void *ZeroMalloc(UINT size) +{ + void *p; + if (size == 0) + { + size = 1; + } + + p = malloc(size); + if (p == NULL) + { + _exit(0); + } + + Zero(p, size); + + return p; +} + +// Memory clear +void Zero(void *p, UINT size) +{ + if (p != NULL) + { + ZeroMemory(p, size); + } +} + +// Memory release +void Free(void *p) +{ + if (p != NULL) + { + free(p); + } +} + +// Thread creation +HANDLE VwNewThread(LPTHREAD_START_ROUTINE start, void *param) +{ + HANDLE h; + DWORD id; + // Validate arguments + if (start == NULL) + { + return NULL; + } + + h = (HANDLE)_beginthreadex(NULL, 0, start, param, 0, &id); + + return h; +} + +// Thread release +void VwFreeThread(HANDLE h) +{ + // Validate arguments + if (h == NULL) + { + return; + } + + CloseHandle(h); +} + +// Dialog procedure that does not do anything +INT_PTR CALLBACK VpnWebDummyDlgProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam) +{ + return 0; +} + +// Initialization of the dialog +HWND InitVpnWebDlg(VPNWEBDLG_INIT *init) +{ + HWND hWnd; + // Validate arguments + if (init == NULL) + { + return NULL; + } + + _configthreadlocale(_DISABLE_PER_THREAD_LOCALE); + setlocale(LC_ALL, ""); + + ZeroMemory(&data, sizeof(data)); + CopyMemory(&data, init, sizeof(data)); + + LoadTables(data.LanguageId); + + hWnd = CreateDialog(hDllInstance, MAKEINTRESOURCE(IDD_VPNWEBDLG), + data.hControlWnd, VpnWebDlgProc); + + data.hWnd = hWnd; + + ShowWindow(hWnd, SW_SHOW); + + return hWnd; +} + +// Exit the dialog +void FreeVpnWebDlg() +{ + DestroyWindow(data.hWnd); +} + +// Get the size of the dialog +void GetVpnWebDlgSize(SIZE *size) +{ + HWND hWnd; + RECT rect; + // Validate arguments + if (size == NULL) + { + return; + } + + hWnd = CreateDialog(hDllInstance, MAKEINTRESOURCE(IDD_VPNWEBDLG), + GetDesktopWindow(), VpnWebDummyDlgProc); + + ZeroMemory(&rect, sizeof(rect)); + GetWindowRect(hWnd, &rect); + + DestroyWindow(hWnd); + + size->cx = rect.right - rect.left; + size->cy = rect.bottom - rect.top; +} + + +// Get the item in the dialog +HWND DlgItem(HWND hWnd, UINT id) +{ + // Validate arguments + if (hWnd == NULL) + { + return NULL; + } + + if (id == 0) + { + return hWnd; + } + else + { + return GetDlgItem(hWnd, id); + } +} + +// Hide the window +void Hide(HWND hWnd, UINT id) +{ + // Validate arguments + if (hWnd == NULL) + { + return; + } + + if (IsShow(hWnd, id)) + { + ShowWindow(DlgItem(hWnd, id), SW_HIDE); + } +} + +// Display the window +void Show(HWND hWnd, UINT id) +{ + // Validate arguments + if (hWnd == NULL) + { + return; + } + + if (IsHide(hWnd, id)) + { + ShowWindow(DlgItem(hWnd, id), SW_SHOW); + } +} + +// Changing the visibility setting +void SetShow(HWND hWnd, UINT id, bool b) +{ + // Validate arguments + if (hWnd == NULL) + { + return; + } + + if (b) + { + Show(hWnd, id); + } + else + { + Hide(hWnd, id); + } +} + +// Get whether the window is shown +bool IsShow(HWND hWnd, UINT id) +{ + return IsHide(hWnd, id) ? false : true; +} + +// Get whether the window is hidden +bool IsHide(HWND hWnd, UINT id) +{ + // Validate arguments + if (hWnd == NULL) + { + return true; + } + + if (GetStyle(hWnd, id) & WS_VISIBLE) + { + return false; + } + else + { + return true; + } +} + +// Remove the window style +void RemoveExStyle(HWND hWnd, UINT id, UINT style) +{ + UINT old; + // Validate arguments + if (hWnd == NULL) + { + return; + } + + old = GetExStyle(hWnd, id); + if ((old & style) == 0) + { + return; + } + + SetWindowLong(DlgItem(hWnd, id), GWL_EXSTYLE, old & ~style); + Refresh(DlgItem(hWnd, id)); +} + +// Set the window style +void SetExStyle(HWND hWnd, UINT id, UINT style) +{ + UINT old; + // Validate arguments + if (hWnd == NULL) + { + return; + } + + old = GetExStyle(hWnd, id); + if (old & style) + { + return; + } + + SetWindowLong(DlgItem(hWnd, id), GWL_EXSTYLE, old | style); + Refresh(DlgItem(hWnd, id)); +} + +// Get the window style +UINT GetExStyle(HWND hWnd, UINT id) +{ + // Validate arguments + if (hWnd == NULL) + { + return 0; + } + + return GetWindowLong(DlgItem(hWnd, id), GWL_EXSTYLE); +} + +// Remove the window style +void RemoveStyle(HWND hWnd, UINT id, UINT style) +{ + UINT old; + // Validate arguments + if (hWnd == NULL) + { + return; + } + + old = GetStyle(hWnd, id); + if ((old & style) == 0) + { + return; + } + + SetWindowLong(DlgItem(hWnd, id), GWL_STYLE, old & ~style); + Refresh(DlgItem(hWnd, id)); +} + +// Set the window style +void SetStyle(HWND hWnd, UINT id, UINT style) +{ + UINT old; + // Validate arguments + if (hWnd == NULL) + { + return; + } + + old = GetStyle(hWnd, id); + if (old & style) + { + return; + } + + SetWindowLong(DlgItem(hWnd, id), GWL_STYLE, old | style); + Refresh(DlgItem(hWnd, id)); +} + +// Get the window style +UINT GetStyle(HWND hWnd, UINT id) +{ + // Validate arguments + if (hWnd == NULL) + { + return 0; + } + + return GetWindowLong(DlgItem(hWnd, id), GWL_STYLE); +} + +// Update the window +void Refresh(HWND hWnd) +{ + HWND parent; + // Validate arguments + if (hWnd == NULL) + { + return; + } + + DoEvents(hWnd); + UpdateWindow(hWnd); + DoEvents(hWnd); + + parent = GetParent(hWnd); + if (parent != NULL) + { + Refresh(parent); + } +} + +// Handle the event +void DoEvents(HWND hWnd) +{ + MSG msg; + + if (PeekMessage(&msg, hWnd, 0, 0, PM_REMOVE)) + { + TranslateMessage(&msg); + DispatchMessage(&msg); + } + UpdateWindow(hWnd); + + if (hWnd) + { + DoEvents(NULL); + } +} + +// Disable the window +void Disable(HWND hWnd, UINT id) +{ + SetEnable(hWnd, id, false); +} + +// Enable the window +void Enable(HWND hWnd, UINT id) +{ + SetEnable(hWnd, id, true); +} + +// Set the enabled state of the window +void SetEnable(HWND hWnd, UINT id, bool b) +{ + // Validate arguments + if (hWnd == NULL) + { + return; + } + + if (b == false) + { + if (IsEnable(hWnd, id)) + { + EnableWindow(DlgItem(hWnd, id), false); + Refresh(DlgItem(hWnd, id)); + } + } + else + { + if (IsDisable(hWnd, id)) + { + EnableWindow(DlgItem(hWnd, id), true); + Refresh(DlgItem(hWnd, id)); + } + } +} + +// Examine whether the Window is disabled +bool IsDisable(HWND hWnd, UINT id) +{ + return IsEnable(hWnd, id) ? false : true; +} + +// Examine whether the window is enabled +bool IsEnable(HWND hWnd, UINT id) +{ + // Validate arguments + if (hWnd == NULL) + { + return false; + } + + return IsWindowEnabled(DlgItem(hWnd, id)); +} + +// Set the position of the progress bar +void SetPos(HWND hWnd, UINT id, UINT pos) +{ + // Validate arguments + if (hWnd == NULL) + { + return; + } + + SendMsg(hWnd, id, PBM_SETPOS, pos, 0); +} + +// Set the range of the progress bar +void SetRange(HWND hWnd, UINT id, UINT start, UINT end) +{ + // Validate arguments + if (hWnd == NULL) + { + return; + } + + SendMsg(hWnd, id, PBM_SETRANGE32, start, end); +} + +// Transmit a message to the control +UINT SendMsg(HWND hWnd, UINT id, UINT msg, WPARAM wParam, LPARAM lParam) +{ + // Validate arguments + if (hWnd == NULL) + { + return 0; + } + + return (UINT)SendMessageA(DlgItem(hWnd, id), msg, wParam, lParam); +} diff --git a/src/vpnweb/vpnwebdlg.h b/src/vpnweb/vpnwebdlg.h index a6e7d9fb..fc1423d1 100644 --- a/src/vpnweb/vpnwebdlg.h +++ b/src/vpnweb/vpnwebdlg.h @@ -1,42 +1,42 @@ -// SoftEther VPN Source Code - Developer Edition Master Branch -// Cedar Communication Module - - -// vpnwebdlg.h -// Header of vpnwebdlg.c - -#ifndef VPNWEBDLG_H -#define VPNWEBDLG_H - - -#ifdef __cplusplus -extern "C" { -#endif - -extern HINSTANCE hDllInstance; - -typedef struct VPNWEBDLG_INIT -{ - char InstallerExeUrl[512]; - char InstallerInfUrl[512]; - char SettingUrl[512]; - BOOL VpnServerManagerMode; - char VpnServerHostname[512]; - char VpnServerHubName[512]; - char VpnServerPassword[512]; - - char LanguageId[32]; - HWND hControlWnd; - HWND hWnd; -} VPNWEBDLG_INIT; - -HWND InitVpnWebDlg(VPNWEBDLG_INIT *init); -void FreeVpnWebDlg(); -void GetVpnWebDlgSize(SIZE *size); - - -#ifdef __cplusplus -} -#endif - -#endif // VPNWEBDLG_H +// SoftEther VPN Source Code - Developer Edition Master Branch +// Cedar Communication Module + + +// vpnwebdlg.h +// Header of vpnwebdlg.c + +#ifndef VPNWEBDLG_H +#define VPNWEBDLG_H + + +#ifdef __cplusplus +extern "C" { +#endif + +extern HINSTANCE hDllInstance; + +typedef struct VPNWEBDLG_INIT +{ + char InstallerExeUrl[512]; + char InstallerInfUrl[512]; + char SettingUrl[512]; + BOOL VpnServerManagerMode; + char VpnServerHostname[512]; + char VpnServerHubName[512]; + char VpnServerPassword[512]; + + char LanguageId[32]; + HWND hControlWnd; + HWND hWnd; +} VPNWEBDLG_INIT; + +HWND InitVpnWebDlg(VPNWEBDLG_INIT *init); +void FreeVpnWebDlg(); +void GetVpnWebDlgSize(SIZE *size); + + +#ifdef __cplusplus +} +#endif + +#endif // VPNWEBDLG_H diff --git a/src/vpnweb/vpnwebdlg_inner.h b/src/vpnweb/vpnwebdlg_inner.h index 8f46aae4..5152963f 100644 --- a/src/vpnweb/vpnwebdlg_inner.h +++ b/src/vpnweb/vpnwebdlg_inner.h @@ -1,175 +1,175 @@ -// SoftEther VPN Source Code - Developer Edition Master Branch -// Cedar Communication Module - - -// vpnwebdlg.h -// Header of vpnwebdlg.c (Inner) - - -#define VPNINSTALL_EXE_FILENAME "vpninstall.exe" -#define VPNINSTALL_EXE_FILENAME_TMP "vpninstall.exe.tmp" -#define VPNINSTALL_INF_FILENAME "vpninstall.inf" -#define VPNINSTALL_INF_BUILDTAG "VpnInstallBuild" - -#include "resource.h" -extern HINSTANCE hDllInstance; -#define MESSAGE_OFFSET_JP IDS_MESSAGE_APPTITLE -#define MESSAGE_OFFSET_EN IDS_MESSAGE_APPTITLE_EN -#define MESSAGE_OFFSET_RES1 12000 -#define MESSAGE_OFFSET_RES2 13000 - -static wchar_t *msgAppTitle = NULL; -static char *msgNotSupported = NULL; -static wchar_t *msgInfDownload = NULL; -static wchar_t *msgInfDownloadFailed = NULL; -static wchar_t *msgBadInfFile = NULL; -static wchar_t *msgWriteFailed = NULL; -static wchar_t *msgDownloading = NULL; -static wchar_t *msgProcessFailed = NULL; -static wchar_t *msgProcessCreating =NULL; -static wchar_t *msgProcessCreated = NULL; -static wchar_t *msgWarning = NULL; -static wchar_t *msgWarningTitle = NULL; -static wchar_t *msgUserCancel = NULL; -static wchar_t *msgStartTextForVpnServer = NULL; -static wchar_t *msgButtonForVpnServer = NULL; -static wchar_t *msgProcessCreatedForVpnServer = NULL; -static wchar_t *msgStartTextForVpnClient = NULL; -static wchar_t *msgButtonForVpnClient = NULL; -static char *msgNoParam = NULL; - -static void **_messages; - -typedef enum MessageType { - _e_msgAppTitle,_e_msgNotSupported,_e_msgInfDownload,_e_msgInfDownloadFailed, - _e_msgBadInfFile,_e_msgWriteFailed,_e_msgDownloading,_e_msgProcessFailed, - _e_msgProcessCreating,_e_msgProcessCreated,_e_msgWarning,_e_msgWarningTitle, - _e_msgUserCancel,_e_msgStartTextForVpnServer,_e_msgButtonForVpnServer,_e_msgProcessCreatedForVpnServer, - _e_msgNoParam, _e_msgStartTextForVpnClient, _e_msgButtonForVpnClient, _e_msgEnd} MessageType_t; - - int currentPage=MESSAGE_OFFSET_EN; - -int GetLocalizedMessageOffset(){ - return currentPage; -} -wchar_t *LoadMessageW(enum MessageType e){ - wchar_t *pTmp=(wchar_t*)calloc(sizeof(wchar_t),1024); - LoadStringW(hDllInstance,GetLocalizedMessageOffset()+e,pTmp,1024); - return pTmp; -} -char *LoadMessageA(enum MessageType e){ - char *pTmp=(char*)calloc(sizeof(char),1024); - LoadStringA(hDllInstance,GetLocalizedMessageOffset()+e,pTmp,1024); - return pTmp; -} -void FreeMessage(void *p){ - free(p); -} -int LoadTables(char *pTag){ - if( stricmp(pTag,"JP")==0 || stricmp(pTag,"JA")==0){ - currentPage=MESSAGE_OFFSET_JP; - - }else if( stricmp(pTag,"EN")==0) - { - currentPage=MESSAGE_OFFSET_EN; - } -// currentPage=MESSAGE_OFFSET_EN; - - msgAppTitle=LoadMessageW(_e_msgAppTitle); - msgNotSupported=LoadMessageA(_e_msgNotSupported); - msgInfDownload=LoadMessageW(_e_msgInfDownload); - msgInfDownloadFailed=LoadMessageW(_e_msgInfDownloadFailed); - msgBadInfFile=LoadMessageW(_e_msgBadInfFile); - msgWriteFailed=LoadMessageW(_e_msgWriteFailed); - msgDownloading=LoadMessageW(_e_msgDownloading); - msgProcessFailed=LoadMessageW(_e_msgProcessFailed); - msgProcessCreating=LoadMessageW(_e_msgProcessCreating); - msgProcessCreated=LoadMessageW(_e_msgProcessCreated); - msgWarning=LoadMessageW(_e_msgWarning); - msgWarningTitle=LoadMessageW(_e_msgWarningTitle); - msgUserCancel=LoadMessageW(_e_msgUserCancel); - msgStartTextForVpnServer=LoadMessageW(_e_msgStartTextForVpnServer); - msgButtonForVpnServer=LoadMessageW(_e_msgButtonForVpnServer); - msgProcessCreatedForVpnServer=LoadMessageW(_e_msgProcessCreatedForVpnServer); - msgNoParam=LoadMessageA(_e_msgNoParam); - msgStartTextForVpnClient=LoadMessageW(_e_msgStartTextForVpnClient); - msgButtonForVpnClient=LoadMessageW(_e_msgButtonForVpnClient); - return 0; - -} - -#define false 0 -#define true 1 -#define bool UINT -#define MAX_SIZE 512 - -typedef struct VW_FILE -{ - UINT FileSize; - HINTERNET hInternet; - HINTERNET hHttpFile; -} VW_FILE; - -typedef struct VW_TASK -{ - HANDLE Thread; - bool Halt; -} VW_TASK; - - -INT_PTR CALLBACK VpnWebDlgProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam); -INT_PTR CALLBACK VpnWebDummyDlgProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam); - -void VwOnInit(HWND hWnd); -void VwOnFree(HWND hWnd); -HANDLE VwNewThread(LPTHREAD_START_ROUTINE start, void *param); -void VwFreeThread(HANDLE h); -void VwCloseFile(VW_FILE *f); -UINT VwReadFile(VW_FILE *f, void *buf, UINT size); -UINT VwGetFileSize(VW_FILE *f); -VW_FILE *VwOpenFile(char *path); -void VwPrint(HWND hWnd, wchar_t *str); -DWORD CALLBACK VwTaskThread(void *param); -char *VwUrlToFileName(char *url); -UINT VwGetBuildFromVpnInstallInf(char *buf); -bool VwCheckFileDigitalSignature(HWND hWnd, char *name, bool *danger); -bool VwCheckExeSign(HWND hWnd, char *exe); - -void *ZeroMalloc(UINT size); -void Free(void *p); -void *ReAlloc(void *p, UINT size); -void Zero(void *p, UINT size); -HANDLE FileCreate(char *name); -HANDLE FileOpen(char *name, bool write_mode); -void FileClose(HANDLE h); -bool FileRead(HANDLE h, void *buf, UINT size); -bool FileWrite(HANDLE h, void *buf, UINT size); -UINT64 FileSize(HANDLE h); -bool MakeDir(char *name); -UINT MsgBox(HWND hWnd, UINT flag, wchar_t *msg); -void Hide(HWND hWnd, UINT id); -void Show(HWND hWnd, UINT id); -void SetShow(HWND hWnd, UINT id, bool b); -bool IsShow(HWND hWnd, UINT id); -bool IsHide(HWND hWnd, UINT id); -void RemoveExStyle(HWND hWnd, UINT id, UINT style); -void SetExStyle(HWND hWnd, UINT id, UINT style); -UINT GetExStyle(HWND hWnd, UINT id); -void RemoveStyle(HWND hWnd, UINT id, UINT style); -void SetStyle(HWND hWnd, UINT id, UINT style); -UINT GetStyle(HWND hWnd, UINT id); -void Refresh(HWND hWnd); -void DoEvents(HWND hWnd); -void Disable(HWND hWnd, UINT id); -void Enable(HWND hWnd, UINT id); -void SetEnable(HWND hWnd, UINT id, bool b); -bool IsDisable(HWND hWnd, UINT id); -bool IsEnable(HWND hWnd, UINT id); -HWND DlgItem(HWND hWnd, UINT id); -bool IsSupportedOs(); -void SetText(HWND hWnd, UINT id, wchar_t *str); -UINT SendMsg(HWND hWnd, UINT id, UINT msg, WPARAM wParam, LPARAM lParam); -void SetRange(HWND hWnd, UINT id, UINT start, UINT end); -void SetPos(HWND hWnd, UINT id, UINT pos); - - +// SoftEther VPN Source Code - Developer Edition Master Branch +// Cedar Communication Module + + +// vpnwebdlg.h +// Header of vpnwebdlg.c (Inner) + + +#define VPNINSTALL_EXE_FILENAME "vpninstall.exe" +#define VPNINSTALL_EXE_FILENAME_TMP "vpninstall.exe.tmp" +#define VPNINSTALL_INF_FILENAME "vpninstall.inf" +#define VPNINSTALL_INF_BUILDTAG "VpnInstallBuild" + +#include "resource.h" +extern HINSTANCE hDllInstance; +#define MESSAGE_OFFSET_JP IDS_MESSAGE_APPTITLE +#define MESSAGE_OFFSET_EN IDS_MESSAGE_APPTITLE_EN +#define MESSAGE_OFFSET_RES1 12000 +#define MESSAGE_OFFSET_RES2 13000 + +static wchar_t *msgAppTitle = NULL; +static char *msgNotSupported = NULL; +static wchar_t *msgInfDownload = NULL; +static wchar_t *msgInfDownloadFailed = NULL; +static wchar_t *msgBadInfFile = NULL; +static wchar_t *msgWriteFailed = NULL; +static wchar_t *msgDownloading = NULL; +static wchar_t *msgProcessFailed = NULL; +static wchar_t *msgProcessCreating =NULL; +static wchar_t *msgProcessCreated = NULL; +static wchar_t *msgWarning = NULL; +static wchar_t *msgWarningTitle = NULL; +static wchar_t *msgUserCancel = NULL; +static wchar_t *msgStartTextForVpnServer = NULL; +static wchar_t *msgButtonForVpnServer = NULL; +static wchar_t *msgProcessCreatedForVpnServer = NULL; +static wchar_t *msgStartTextForVpnClient = NULL; +static wchar_t *msgButtonForVpnClient = NULL; +static char *msgNoParam = NULL; + +static void **_messages; + +typedef enum MessageType { + _e_msgAppTitle,_e_msgNotSupported,_e_msgInfDownload,_e_msgInfDownloadFailed, + _e_msgBadInfFile,_e_msgWriteFailed,_e_msgDownloading,_e_msgProcessFailed, + _e_msgProcessCreating,_e_msgProcessCreated,_e_msgWarning,_e_msgWarningTitle, + _e_msgUserCancel,_e_msgStartTextForVpnServer,_e_msgButtonForVpnServer,_e_msgProcessCreatedForVpnServer, + _e_msgNoParam, _e_msgStartTextForVpnClient, _e_msgButtonForVpnClient, _e_msgEnd} MessageType_t; + + int currentPage=MESSAGE_OFFSET_EN; + +int GetLocalizedMessageOffset(){ + return currentPage; +} +wchar_t *LoadMessageW(enum MessageType e){ + wchar_t *pTmp=(wchar_t*)calloc(sizeof(wchar_t),1024); + LoadStringW(hDllInstance,GetLocalizedMessageOffset()+e,pTmp,1024); + return pTmp; +} +char *LoadMessageA(enum MessageType e){ + char *pTmp=(char*)calloc(sizeof(char),1024); + LoadStringA(hDllInstance,GetLocalizedMessageOffset()+e,pTmp,1024); + return pTmp; +} +void FreeMessage(void *p){ + free(p); +} +int LoadTables(char *pTag){ + if( stricmp(pTag,"JP")==0 || stricmp(pTag,"JA")==0){ + currentPage=MESSAGE_OFFSET_JP; + + }else if( stricmp(pTag,"EN")==0) + { + currentPage=MESSAGE_OFFSET_EN; + } +// currentPage=MESSAGE_OFFSET_EN; + + msgAppTitle=LoadMessageW(_e_msgAppTitle); + msgNotSupported=LoadMessageA(_e_msgNotSupported); + msgInfDownload=LoadMessageW(_e_msgInfDownload); + msgInfDownloadFailed=LoadMessageW(_e_msgInfDownloadFailed); + msgBadInfFile=LoadMessageW(_e_msgBadInfFile); + msgWriteFailed=LoadMessageW(_e_msgWriteFailed); + msgDownloading=LoadMessageW(_e_msgDownloading); + msgProcessFailed=LoadMessageW(_e_msgProcessFailed); + msgProcessCreating=LoadMessageW(_e_msgProcessCreating); + msgProcessCreated=LoadMessageW(_e_msgProcessCreated); + msgWarning=LoadMessageW(_e_msgWarning); + msgWarningTitle=LoadMessageW(_e_msgWarningTitle); + msgUserCancel=LoadMessageW(_e_msgUserCancel); + msgStartTextForVpnServer=LoadMessageW(_e_msgStartTextForVpnServer); + msgButtonForVpnServer=LoadMessageW(_e_msgButtonForVpnServer); + msgProcessCreatedForVpnServer=LoadMessageW(_e_msgProcessCreatedForVpnServer); + msgNoParam=LoadMessageA(_e_msgNoParam); + msgStartTextForVpnClient=LoadMessageW(_e_msgStartTextForVpnClient); + msgButtonForVpnClient=LoadMessageW(_e_msgButtonForVpnClient); + return 0; + +} + +#define false 0 +#define true 1 +#define bool UINT +#define MAX_SIZE 512 + +typedef struct VW_FILE +{ + UINT FileSize; + HINTERNET hInternet; + HINTERNET hHttpFile; +} VW_FILE; + +typedef struct VW_TASK +{ + HANDLE Thread; + bool Halt; +} VW_TASK; + + +INT_PTR CALLBACK VpnWebDlgProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam); +INT_PTR CALLBACK VpnWebDummyDlgProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam); + +void VwOnInit(HWND hWnd); +void VwOnFree(HWND hWnd); +HANDLE VwNewThread(LPTHREAD_START_ROUTINE start, void *param); +void VwFreeThread(HANDLE h); +void VwCloseFile(VW_FILE *f); +UINT VwReadFile(VW_FILE *f, void *buf, UINT size); +UINT VwGetFileSize(VW_FILE *f); +VW_FILE *VwOpenFile(char *path); +void VwPrint(HWND hWnd, wchar_t *str); +DWORD CALLBACK VwTaskThread(void *param); +char *VwUrlToFileName(char *url); +UINT VwGetBuildFromVpnInstallInf(char *buf); +bool VwCheckFileDigitalSignature(HWND hWnd, char *name, bool *danger); +bool VwCheckExeSign(HWND hWnd, char *exe); + +void *ZeroMalloc(UINT size); +void Free(void *p); +void *ReAlloc(void *p, UINT size); +void Zero(void *p, UINT size); +HANDLE FileCreate(char *name); +HANDLE FileOpen(char *name, bool write_mode); +void FileClose(HANDLE h); +bool FileRead(HANDLE h, void *buf, UINT size); +bool FileWrite(HANDLE h, void *buf, UINT size); +UINT64 FileSize(HANDLE h); +bool MakeDir(char *name); +UINT MsgBox(HWND hWnd, UINT flag, wchar_t *msg); +void Hide(HWND hWnd, UINT id); +void Show(HWND hWnd, UINT id); +void SetShow(HWND hWnd, UINT id, bool b); +bool IsShow(HWND hWnd, UINT id); +bool IsHide(HWND hWnd, UINT id); +void RemoveExStyle(HWND hWnd, UINT id, UINT style); +void SetExStyle(HWND hWnd, UINT id, UINT style); +UINT GetExStyle(HWND hWnd, UINT id); +void RemoveStyle(HWND hWnd, UINT id, UINT style); +void SetStyle(HWND hWnd, UINT id, UINT style); +UINT GetStyle(HWND hWnd, UINT id); +void Refresh(HWND hWnd); +void DoEvents(HWND hWnd); +void Disable(HWND hWnd, UINT id); +void Enable(HWND hWnd, UINT id); +void SetEnable(HWND hWnd, UINT id, bool b); +bool IsDisable(HWND hWnd, UINT id); +bool IsEnable(HWND hWnd, UINT id); +HWND DlgItem(HWND hWnd, UINT id); +bool IsSupportedOs(); +void SetText(HWND hWnd, UINT id, wchar_t *str); +UINT SendMsg(HWND hWnd, UINT id, UINT msg, WPARAM wParam, LPARAM lParam); +void SetRange(HWND hWnd, UINT id, UINT start, UINT end); +void SetPos(HWND hWnd, UINT id, UINT pos); + +